@openchambery/web 2.1.9-beta.4 → 2.1.9-beta.5

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 (46) hide show
  1. package/dist/assets/{AssistantView-Bn-ie4vz.js → AssistantView-BMvmzMFI.js} +3 -3
  2. package/dist/assets/{DiagramView-tawWR3qT.js → DiagramView-BO6rDoTN.js} +1 -1
  3. package/dist/assets/{MarkdownRenderer-BtVmyJy4.js → MarkdownRenderer-D_ZS58Ur.js} +2 -2
  4. package/dist/assets/{MarkdownRendererImpl-D2OCbzEp.js → MarkdownRendererImpl-gBtduBHO.js} +1 -1
  5. package/dist/assets/{MarkstreamRendererImpl-wLbde29-.js → MarkstreamRendererImpl-CKilBBOc.js} +1 -1
  6. package/dist/assets/{MobileDetailNavigation-DgCfvpng.js → MobileDetailNavigation-Dgqdqrmy.js} +1 -1
  7. package/dist/assets/{MobileShareBridge-D9esHh6J.js → MobileShareBridge-G2wjyn4g.js} +1 -1
  8. package/dist/assets/{MobileTabPageHeader-DzTewIJq.js → MobileTabPageHeader-Cipo7N8C.js} +1 -1
  9. package/dist/assets/MobileWindowStack-DGLdgoGr.js +1 -0
  10. package/dist/assets/{MultiRunWindow-CrcHT1DW.js → MultiRunWindow-C_ow_lbm.js} +1 -1
  11. package/dist/assets/{SettingsView-ChHvQPP-.js → SettingsView-BaLgORC_.js} +1 -1
  12. package/dist/assets/{SettingsWindow-BLmp9C90.js → SettingsWindow-DfSPTDHb.js} +1 -1
  13. package/dist/assets/{TerminalView-D9TwFDxt.js → TerminalView-DhUynfus.js} +1 -1
  14. package/dist/assets/ToolOutputDialog-DaKPwmer.js +10 -0
  15. package/dist/assets/{appThemeRegistry-C0lox0ME.js → appThemeRegistry-zPqSQBFx.js} +1 -1
  16. package/dist/assets/{fileMentionTouchSelection-CWtqJ0pV.js → fileMentionTouchSelection-C8mKDaBe.js} +1 -1
  17. package/dist/assets/{gitApi-D4E7MHPI.js → gitApi-BCPykg93.js} +1 -1
  18. package/dist/assets/{insertionBoundaries-fvEQLEE_.js → insertionBoundaries-h0pySzQJ.js} +1 -1
  19. package/dist/assets/{main-DTaOcMED.js → main-4JVZhTAZ.js} +2 -2
  20. package/dist/assets/{main-6QL82M1U.js → main-C8RDC4kz.js} +4 -4
  21. package/dist/assets/{mcpQueries-D-rsCnTq.js → mcpQueries-Cm1VNAmy.js} +1 -1
  22. package/dist/assets/{miniChat-LDIwR98X.js → miniChat-_SvWYZuQ.js} +2 -2
  23. package/dist/assets/mobile-Cil7_kYn.js +2 -0
  24. package/dist/assets/{multirun-BV5qdnL3.js → multirun-BzeInZt6.js} +1 -1
  25. package/dist/assets/{projectMeta-Cp7A0mPx.js → projectMeta-CUAgRGwW.js} +1 -1
  26. package/dist/assets/{renderElectronMiniChatApp-DrhDj1Jh.js → renderElectronMiniChatApp-BrAIRgb-.js} +2 -2
  27. package/dist/assets/{renderMobileApp-DrG8-J7P.js → renderMobileApp-DxTazPkB.js} +6 -6
  28. package/dist/assets/{runtimeConfig-B1lpYz9l.js → runtimeConfig-Bljmgd6r.js} +1 -1
  29. package/dist/assets/{runtimeEndpointReset-Dp74zZAo.js → runtimeEndpointReset-BYsDk8ux.js} +1 -1
  30. package/dist/assets/{sessionChangeSummary-BH28eSaw.js → sessionChangeSummary-BslBzYAm.js} +1 -1
  31. package/dist/assets/{sessionLookup-Ca1342QR.js → sessionLookup-5MrKwBXP.js} +1 -1
  32. package/dist/assets/{speechSettingsQueries-CG9u1h1Z.js → speechSettingsQueries-otzPynPJ.js} +1 -1
  33. package/dist/assets/{src-CcT-GitE.css → src-Cq3Axl32.css} +1 -1
  34. package/dist/assets/textarea-D_tvJ-Lw.js +1 -0
  35. package/dist/assets/{useAppFontEffects-Brve5y_3.js → useAppFontEffects-DHJ_Qc3g.js} +5 -5
  36. package/dist/assets/{useDesktopWindowControlsLayout-DpEWNKaQ.js → useDesktopWindowControlsLayout-BnMDHglb.js} +1 -1
  37. package/dist/assets/{useEffectiveDirectory-CFr8k_MH.js → useEffectiveDirectory-D0qR3aRK.js} +1 -1
  38. package/dist/assets/{useMobileNavigationStore-CSnG4CUz.js → useMobileNavigationStore-BZ7oo4Ir.js} +3 -3
  39. package/dist/assets/{useWorkerHighlightedLines-uJlySvgF.js → useWorkerHighlightedLines-B86utfqe.js} +1 -1
  40. package/dist/index.html +3 -3
  41. package/dist/mini-chat.html +3 -3
  42. package/dist/mobile.html +3 -3
  43. package/package.json +1 -1
  44. package/dist/assets/ToolOutputDialog-0S7fJLLw.js +0 -10
  45. package/dist/assets/mobile-CTXp1iXI.js +0 -2
  46. package/dist/assets/textarea-ClV5sMS-.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t}from"./runtime-fetch-WgH0pROs.js";import{Mn as n,ln as r}from"./persistence-BKszKaoQ.js";import{it as i,rt as a}from"./vendor-base-ui-CdzJ6My_.js";import{n as o}from"./platform-CgwxwfA4.js";import{v as s}from"./useUIStore-CEqU9Ujv.js";import{n as c}from"./vendor-react-BP2cRVqX.js";import{a as l,n as u}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{f as d,r as f,t as p}from"./button-CWSs9Baz.js";import{n as m}from"./useThemeSystem-8jhE4Zyk.js";import{n as h}from"./Icon-BCFeHDWx.js";import{i as g,n as _,t as v}from"./tooltip-CV6dvLBp.js";import{a as y,i as b,o as x,t as S}from"./image-loading-Bj11k4gM.js";import{n as C}from"./MarkdownRenderer-BtVmyJy4.js";import{n as w,o as T,s as E,t as D}from"./markdown-worker-DFNZ3KJ_.js";import{n as ee}from"./markdownTheme-CV7_0QAL.js";import{t as te}from"./vendor-tanstack-react-virtual-B_EO--9t.js";var O=e(i(),1),k=c(),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)(h,{name:`record-circle`,className:`h-3.5 w-3.5 text-[var(--status-info)]`,"aria-hidden":`true`}):o===`completed`?(0,A.jsx)(h,{name:`checkbox-circle`,className:`h-3.5 w-3.5 text-[var(--status-success)]`,"aria-hidden":`true`}):(0,A.jsx)(h,{name:`time`,className:`h-3.5 w-3.5 text-muted-foreground`,"aria-hidden":`true`}),t[3]=o,t[4]=u);let p=u,m=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]!==p||t[8]!==l?(x=(0,A.jsx)(g,{asChild:!0,children:(0,A.jsx)(`span`,{className:`flex size-4 items-center justify-center`,"aria-label":l,children:p})}),t[7]=p,t[8]=l,t[9]=x):x=t[9];let S;t[10]===l?S=t[11]:(S=(0,A.jsx)(_,{side:`left`,sideOffset:6,children:l}),t[10]=l,t[11]=S);let C;t[12]!==x||t[13]!==S?(C=(0,A.jsxs)(v,{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]!==m||t[23]!==b||t[24]!==C?(D=(0,A.jsxs)(`li`,{ref:i,"aria-current":m,className:b,children:[C,E]}),t[20]=i,t[21]=E,t[22]=m,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=l(`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&&y(n)}},he=async(e,n)=>{let r=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,n)}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,n);else{let e=x(a,r);if(b(e))try{i=await me(e.path,n)}catch{let r=await t(`/api/fs/raw`,{method:`GET`,cache:`no-store`,query:{path:e.path},signal:n});if(!r.ok)throw Error(`Image source request failed with status ${r.status}`);i=await r.blob()}else i=await G(e.source,n)}}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=()=>!o()||u===void 0?!1:u.isPluginAvailable(`OpenChamberMedia`),_e=async(e,t)=>{let{blob:i,filename:a,mimeType:o}=await he(e,t);if(ge()){let e=await de(i);return await V.saveImage({dataBase64:e,mimeType:o,filename:a}),`saved`}if(r()){let e=n()?.vscode;if(e?.saveImage){let t=await W(i);return await e.saveImage({fileName:a,dataUrl:t}),`saved`}}return fe(i,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}=m(),u=O.useRef(null),d;t[0]===l?d=t[1]:(d=ee(l),t[0]=l,t[1]=d);let p=d,h,g;t[2]!==n||t[3]!==o||t[4]!==c?(h=()=>{let e=u.current;e&&(e.innerHTML=be(n),K(e,c,o))},g=[n,c,o],t[2]=n,t[3]=o,t[4]=c,t[5]=h,t[6]=g):(h=t[5],g=t[6]),O.useLayoutEffect(h,g);let _,v;t[7]!==n||t[8]!==o||t[9]!==r||t[10]!==c?(_=()=>{let e=u.current;if(!e)return;let t=!0,i=new AbortController;return D(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()}},v=[n,r,c,o],t[7]=n,t[8]=o,t[9]=r,t[10]=c,t[11]=_,t[12]=v):(_=t[11],v=t[12]),O.useEffect(_,v);let y;t[13]===i?y=t[14]:(y=f(`typography-code`,i),t[13]=i,t[14]=y);let b=p,x;t[15]!==a||t[16]!==b?(x={...b,...a},t[15]=a,t[16]=b,t[17]=x):x=t[17];let S;return t[18]!==y||t[19]!==x?(S=(0,A.jsx)(`div`,{ref:u,className:y,style:x}),t[18]=y,t[19]=x,t[20]=S):S=t[20],S},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,`
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t}from"./runtime-fetch-WgH0pROs.js";import{Mn as n,ln as r}from"./persistence-BKszKaoQ.js";import{it as i,rt as a}from"./vendor-base-ui-CdzJ6My_.js";import{n as o}from"./platform-CgwxwfA4.js";import{v as s}from"./useUIStore-CEqU9Ujv.js";import{n as c}from"./vendor-react-BP2cRVqX.js";import{a as l,n as u}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{f as d,r as f,t as p}from"./button-CWSs9Baz.js";import{n as m}from"./useThemeSystem-8jhE4Zyk.js";import{n as h}from"./Icon-BCFeHDWx.js";import{i as g,n as _,t as v}from"./tooltip-CV6dvLBp.js";import{a as y,i as b,o as x,t as S}from"./image-loading-Bj11k4gM.js";import{n as C}from"./MarkdownRenderer-D_ZS58Ur.js";import{n as w,o as T,s as E,t as D}from"./markdown-worker-DFNZ3KJ_.js";import{n as ee}from"./markdownTheme-CV7_0QAL.js";import{t as te}from"./vendor-tanstack-react-virtual-B_EO--9t.js";var O=e(i(),1),k=c(),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)(h,{name:`record-circle`,className:`h-3.5 w-3.5 text-[var(--status-info)]`,"aria-hidden":`true`}):o===`completed`?(0,A.jsx)(h,{name:`checkbox-circle`,className:`h-3.5 w-3.5 text-[var(--status-success)]`,"aria-hidden":`true`}):(0,A.jsx)(h,{name:`time`,className:`h-3.5 w-3.5 text-muted-foreground`,"aria-hidden":`true`}),t[3]=o,t[4]=u);let p=u,m=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]!==p||t[8]!==l?(x=(0,A.jsx)(g,{asChild:!0,children:(0,A.jsx)(`span`,{className:`flex size-4 items-center justify-center`,"aria-label":l,children:p})}),t[7]=p,t[8]=l,t[9]=x):x=t[9];let S;t[10]===l?S=t[11]:(S=(0,A.jsx)(_,{side:`left`,sideOffset:6,children:l}),t[10]=l,t[11]=S);let C;t[12]!==x||t[13]!==S?(C=(0,A.jsxs)(v,{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]!==m||t[23]!==b||t[24]!==C?(D=(0,A.jsxs)(`li`,{ref:i,"aria-current":m,className:b,children:[C,E]}),t[20]=i,t[21]=E,t[22]=m,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=l(`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&&y(n)}},he=async(e,n)=>{let r=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,n)}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,n);else{let e=x(a,r);if(b(e))try{i=await me(e.path,n)}catch{let r=await t(`/api/fs/raw`,{method:`GET`,cache:`no-store`,query:{path:e.path},signal:n});if(!r.ok)throw Error(`Image source request failed with status ${r.status}`);i=await r.blob()}else i=await G(e.source,n)}}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=()=>!o()||u===void 0?!1:u.isPluginAvailable(`OpenChamberMedia`),_e=async(e,t)=>{let{blob:i,filename:a,mimeType:o}=await he(e,t);if(ge()){let e=await de(i);return await V.saveImage({dataBase64:e,mimeType:o,filename:a}),`saved`}if(r()){let e=n()?.vscode;if(e?.saveImage){let t=await W(i);return await e.saveImage({fileName:a,dataUrl:t}),`saved`}}return fe(i,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}=m(),u=O.useRef(null),d;t[0]===l?d=t[1]:(d=ee(l),t[0]=l,t[1]=d);let p=d,h,g;t[2]!==n||t[3]!==o||t[4]!==c?(h=()=>{let e=u.current;e&&(e.innerHTML=be(n),K(e,c,o))},g=[n,c,o],t[2]=n,t[3]=o,t[4]=c,t[5]=h,t[6]=g):(h=t[5],g=t[6]),O.useLayoutEffect(h,g);let _,v;t[7]!==n||t[8]!==o||t[9]!==r||t[10]!==c?(_=()=>{let e=u.current;if(!e)return;let t=!0,i=new AbortController;return D(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()}},v=[n,r,c,o],t[7]=n,t[8]=o,t[9]=r,t[10]=c,t[11]=_,t[12]=v):(_=t[11],v=t[12]),O.useEffect(_,v);let y;t[13]===i?y=t[14]:(y=f(`typography-code`,i),t[13]=i,t[14]=y);let b=p,x;t[15]!==a||t[16]!==b?(x={...b,...a},t[15]=a,t[16]=b,t[17]=x):x=t[17];let S;return t[18]!==y||t[19]!==x?(S=(0,A.jsx)(`div`,{ref:u,className:y,style:x}),t[18]=y,t[19]=x,t[20]=S):S=t[20],S},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
2
  `).split(`
3
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,t)=>{try{let n=e.trim().split(`
4
4
  `).filter(Boolean);if(n.length===0)return null;let r=[];return n.forEach(e=>{let t=e.match(/^(\s*)(.+)$/);if(t){let[,e,n]=t,i=Math.floor(e.length/2),a=!n.endsWith(`/`);r.push({name:n.replace(/\/$/,``),depth:i,isFile:a})}}),(0,A.jsx)(`div`,{className:f(`w-full min-w-0 font-mono space-y-0.5`,t?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:s.tool.popup,children:r.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,t,n)=>{try{let r=e.trim().split(`
package/dist/index.html CHANGED
@@ -552,7 +552,7 @@
552
552
  opacity: 0.72;
553
553
  }
554
554
  </style>
555
- <script type="module" crossorigin src="/assets/main-DTaOcMED.js"></script>
555
+ <script type="module" crossorigin src="/assets/main-4JVZhTAZ.js"></script>
556
556
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
557
557
  <link rel="modulepreload" crossorigin href="/assets/runtime-auth-BpCQ-dPr.js">
558
558
  <link rel="modulepreload" crossorigin href="/assets/runtime-switch-CMiMO5Yj.js">
@@ -572,8 +572,8 @@
572
572
  <link rel="modulepreload" crossorigin href="/assets/terminalApi-rxsMWL0o.js">
573
573
  <link rel="modulepreload" crossorigin href="/assets/types-BuiqMmh_.js">
574
574
  <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-KNLHDj7G.js">
575
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-B1lpYz9l.js">
576
- <link rel="stylesheet" crossorigin href="/assets/src-CcT-GitE.css">
575
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-Bljmgd6r.js">
576
+ <link rel="stylesheet" crossorigin href="/assets/src-Cq3Axl32.css">
577
577
  </head>
578
578
  <body class="h-full bg-background text-foreground">
579
579
  <!-- Keep the startup layer outside #root. React replaces every child of
@@ -74,7 +74,7 @@
74
74
  }
75
75
  </style>
76
76
 
77
- <script type="module" crossorigin src="/assets/miniChat-LDIwR98X.js"></script>
77
+ <script type="module" crossorigin src="/assets/miniChat-_SvWYZuQ.js"></script>
78
78
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
79
79
  <link rel="modulepreload" crossorigin href="/assets/runtime-auth-BpCQ-dPr.js">
80
80
  <link rel="modulepreload" crossorigin href="/assets/runtime-switch-CMiMO5Yj.js">
@@ -94,8 +94,8 @@
94
94
  <link rel="modulepreload" crossorigin href="/assets/terminalApi-rxsMWL0o.js">
95
95
  <link rel="modulepreload" crossorigin href="/assets/types-BuiqMmh_.js">
96
96
  <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-KNLHDj7G.js">
97
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-B1lpYz9l.js">
98
- <link rel="stylesheet" crossorigin href="/assets/src-CcT-GitE.css">
97
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-Bljmgd6r.js">
98
+ <link rel="stylesheet" crossorigin href="/assets/src-Cq3Axl32.css">
99
99
  </head>
100
100
  <body class="h-full bg-background text-foreground">
101
101
  <div id="root" class="h-full">
package/dist/mobile.html CHANGED
@@ -63,7 +63,7 @@
63
63
  })();
64
64
  </script>
65
65
 
66
- <script type="module" crossorigin src="/assets/mobile-CTXp1iXI.js"></script>
66
+ <script type="module" crossorigin src="/assets/mobile-Cil7_kYn.js"></script>
67
67
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
68
68
  <link rel="modulepreload" crossorigin href="/assets/runtime-auth-BpCQ-dPr.js">
69
69
  <link rel="modulepreload" crossorigin href="/assets/runtime-switch-CMiMO5Yj.js">
@@ -83,8 +83,8 @@
83
83
  <link rel="modulepreload" crossorigin href="/assets/terminalApi-rxsMWL0o.js">
84
84
  <link rel="modulepreload" crossorigin href="/assets/types-BuiqMmh_.js">
85
85
  <link rel="modulepreload" crossorigin href="/assets/capgoAdapter-KNLHDj7G.js">
86
- <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-B1lpYz9l.js">
87
- <link rel="stylesheet" crossorigin href="/assets/src-CcT-GitE.css">
86
+ <link rel="modulepreload" crossorigin href="/assets/runtimeConfig-Bljmgd6r.js">
87
+ <link rel="stylesheet" crossorigin href="/assets/src-Cq3Axl32.css">
88
88
  </head>
89
89
  <body class="h-full bg-background text-foreground">
90
90
  <div id="root" class="h-full"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openchambery/web",
3
- "version": "2.1.9-beta.4",
3
+ "version": "2.1.9-beta.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./server/index.js",
@@ -1,10 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t}from"./runtime-fetch-WgH0pROs.js";import{it as n,nt as r,rt as i}from"./vendor-base-ui-CdzJ6My_.js";import{_ as a}from"./useUIStore-CEqU9Ujv.js";import{n as o}from"./vendor-react-BP2cRVqX.js";import{a as s,i as c}from"./vendor-pierre-diffs-DPBtNDJ5.js";import{n as l}from"./vendor-reactuses-core-BpfIZ1tg.js";import{f as u,r as d,t as f}from"./button-CWSs9Baz.js";import{n as p,t as m}from"./useThemeSystem-8jhE4Zyk.js";import{n as h}from"./Icon-BCFeHDWx.js";import{n as g,t as _}from"./dialog-BMa16qrs.js";import{s as v,v as y}from"./image-loading-Bj11k4gM.js";import{i as b,t as x}from"./appThemeRegistry-C0lox0ME.js";import{n as S}from"./MarkdownRenderer-BtVmyJy4.js";import{l as C}from"./markdown-worker-DFNZ3KJ_.js";import{n as w}from"./useEffectiveDirectory-CFr8k_MH.js";import{i as T,n as E}from"./markdownTheme-CV7_0QAL.js";import{t as D}from"./ImageLoadingPlaceholder-DEpMJXzV.js";import{_ as O,d as k,f as A,g as j,h as M,l as N,m as P,n as F,p as I,r as L,s as R,t as z,u as ee}from"./useWorkerHighlightedLines-uJlySvgF.js";import{t as B}from"./vendor-tanstack-react-virtual-B_EO--9t.js";var V=o(),H=e(n(),1),U=i(),W=80,G=20,te=H.memo(e=>{let t=(0,V.c)(26),{lines:n,language:r,maxHeight:i,showLineNumbers:a,lineStyles:o}=e,s=i===void 0?`60vh`:i,c=a===void 0||a,{currentTheme:l}=p(),u;t[0]===l?u=t[1]:(u=E(l),t[0]=l,t[1]=u);let d=u,f;t[2]===n?f=t[3]:(f=n.map(ie).join(`
2
- `),t[2]=n,t[3]=f);let m=z(f,r);if(!(n.length>W)){let e=d,r;t[4]!==s||t[5]!==e?(r={...e,maxHeight:s,overflow:`auto`},t[4]=s,t[5]=e,t[6]=r):r=t[6];let i;if(t[7]!==m||t[8]!==o||t[9]!==n||t[10]!==c){let e;t[12]!==m||t[13]!==o||t[14]!==c?(e=(e,t)=>(0,U.jsx)(re,{line:e,html:m?.[t],showLineNumbers:c,style:o?.(e)},t),t[12]=m,t[13]=o,t[14]=c,t[15]=e):e=t[15],i=n.map(e),t[7]=m,t[8]=o,t[9]=n,t[10]=c,t[11]=i}else i=t[11];let a;return t[16]!==r||t[17]!==i?(a=(0,U.jsx)(`div`,{className:`typography-code font-mono w-full min-w-0`,style:r,children:i}),t[16]=r,t[17]=i,t[18]=a):a=t[18],a}let h;return t[19]!==m||t[20]!==o||t[21]!==n||t[22]!==s||t[23]!==c||t[24]!==d?(h=(0,U.jsx)(ne,{lines:n,highlighted:m,syntaxVars:d,maxHeight:s,showLineNumbers:c,lineStyles:o}),t[19]=m,t[20]=o,t[21]=n,t[22]=s,t[23]=c,t[24]=d,t[25]=h):h=t[25],h});te.displayName=`VirtualizedCodeBlock`;var ne=H.memo(({lines:e,highlighted:t,syntaxVars:n,maxHeight:r,showLineNumbers:i,lineStyles:a})=>{let o=H.useRef(null),s=`min(${e.length*G}px, ${r})`,c=B({count:e.length,getScrollElement:()=>o.current,estimateSize:()=>G,overscan:20}),l=c.getVirtualItems();return(0,U.jsx)(`div`,{ref:o,className:`typography-code font-mono w-full min-w-0`,style:{...n,height:s,maxHeight:r,overflow:`auto`},children:(0,U.jsx)(`div`,{style:{height:c.getTotalSize(),position:`relative`},children:l.map(n=>{let r=e[n.index];return r?(0,U.jsx)(`div`,{"data-index":n.index,ref:c.measureElement,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${n.start}px)`},children:(0,U.jsx)(re,{line:r,html:t?.[n.index],showLineNumbers:i,style:a?.(r)})},n.index):null})})})});ne.displayName=`VirtualizedRows`;var re=H.memo(e=>{let t=(0,V.c)(12),{line:n,html:r,showLineNumbers:i,style:a}=e,o;t[0]!==n.isInfo||t[1]!==n.lineNumber||t[2]!==i?(o=i&&(0,U.jsx)(`span`,{className:`w-10 flex-shrink-0 text-right pr-3 select-none border-r mr-3 -my-0.5 py-0.5`,style:{color:`var(--tools-edit-line-number)`,borderColor:`var(--tools-border)`},children:!n.isInfo&&n.lineNumber!=null?n.lineNumber:``}),t[0]=n.isInfo,t[1]=n.lineNumber,t[2]=i,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==n.isInfo||t[6]!==n.text?(s=(0,U.jsx)(`div`,{className:`flex-1 min-w-0`,children:n.isInfo?(0,U.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-muted-foreground/70 italic`,children:n.text}):r===void 0?(0,U.jsx)(`div`,{className:`whitespace-pre`,children:n.text}):(0,U.jsx)(`div`,{className:`whitespace-pre`,dangerouslySetInnerHTML:{__html:r}})}),t[4]=r,t[5]=n.isInfo,t[6]=n.text,t[7]=s):s=t[7];let c;return t[8]!==a||t[9]!==o||t[10]!==s?(c=(0,U.jsxs)(`div`,{className:`typography-code font-mono flex w-full min-w-0`,style:a,children:[o,s]}),t[8]=a,t[9]=o,t[10]=s,t[11]=c):c=t[11],c});re.displayName=`VirtualizedCodeBlock.Row`;function ie(e){return e.text}var ae=H.memo(function({jsonString:e,className:t,maxHeight:n=`100%`,initiallyExpandedDepth:r=2}){let{t:i}=u(),a=H.useRef(null),[o,s]=H.useState(null),c=H.useMemo(()=>{try{let t=e.trim();if(!t)return s(i(`jsonTreeView.error.emptyJson`)),null;let n=JSON.parse(t);return s(null),n}catch(e){return s(e instanceof Error?e.message:i(`jsonTreeView.error.invalidJson`)),null}},[e,i]),l=H.useCallback(()=>{a.current?.expandAll()},[]),d=H.useCallback(()=>{a.current?.collapseAll()},[]);return o?(0,U.jsx)(`div`,{className:t,children:(0,U.jsxs)(`div`,{className:`rounded-md border border-[var(--interactive-border)] bg-[var(--syntax-base-background)] p-4`,children:[(0,U.jsx)(`div`,{className:`mb-1 font-medium text-[var(--surface-foreground)]`,children:i(`jsonTreeView.error.invalidJsonTitle`)}),(0,U.jsx)(`div`,{className:`font-mono text-xs text-[var(--surface-mutedForeground)]`,children:o})]})}):c===null?null:(0,U.jsxs)(`div`,{className:t,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-[var(--interactive-border)] px-2 py-1`,children:[(0,U.jsxs)(f,{variant:`ghost`,size:`xs`,onClick:l,className:`gap-1 text-xs text-muted-foreground`,children:[(0,U.jsx)(h,{name:`arrow-down-s`,className:`h-3 w-3`}),i(`jsonTreeView.actions.expandAll`)]}),(0,U.jsxs)(f,{variant:`ghost`,size:`xs`,onClick:d,className:`gap-1 text-xs text-muted-foreground`,children:[(0,U.jsx)(h,{name:`arrow-up-s`,className:`h-3 w-3`}),i(`jsonTreeView.actions.collapseAll`)]})]}),(0,U.jsx)(`div`,{className:`bg-[var(--syntax-base-background)] py-1`,style:{maxHeight:n,overflow:`auto`},children:(0,U.jsx)(L,{ref:a,data:c,maxHeight:n,initiallyExpandedDepth:r})})]})}),oe=class extends Error{key;params;constructor(e,t){super(e),this.name=`MermaidLoadFailure`,this.key=e,this.params=t}},K=(e,t)=>new oe(e,t),se=e=>e instanceof oe,ce=e=>e+1,q=(e,t)=>e===t,J=e=>{let t=e.indexOf(`,`);if(t<0)throw K(`chat.toolOutputDialog.mermaid.dataUrlMalformed`);let n=e.slice(0,t).toLowerCase(),r=e.slice(t+1);return n.includes(`;base64`)?atob(r):decodeURIComponent(r)},le=e=>Promise.resolve().then(()=>J(e)),Y=1,ue=56,X=(e,t,n)=>Math.min(n,Math.max(t,e)),de=({isMobile:e,pointerType:t,cancelled:n,moved:r,suppressTap:i,targetWasCanvas:a,start:o,end:s,startScale:c,hasMultipleImages:l})=>{if(n||i)return`none`;let u={x:s.x-o.x,y:s.y-o.y},d=Math.hypot(u.x,u.y),f=t!==`mouse`;if(e&&f&&c<=1.01&&Math.abs(u.x)>=ue&&Math.abs(u.x)>Math.abs(u.y)*1.2)return l?u.x<0?`next`:`previous`:`none`;let p=!r&&d<=10;return e&&f&&p||!e&&t===`mouse`&&p&&a?`close`:`none`},fe=(e,t)=>{if(e.width<=0||e.height<=0||t.width<=0||t.height<=0)return{width:1,height:1};let n=Math.min(t.width/e.width,t.height/e.height);return{width:Math.max(1,e.width*n),height:Math.max(1,e.height*n)}},pe=(e,t)=>{let n=t.minScale??Y,r=t.maxScale??5,i=X(e.scale,n,r),a=Math.max(0,(t.image.width*i-t.viewport.width)/2),o=Math.max(0,(t.image.height*i-t.viewport.height)/2);return{scale:i,x:X(e.x,-a,a),y:X(e.y,-o,o)}},me=(e,t,n,r,i)=>{let a=X(t,i.minScale??Y,i.maxScale??5),o=a/e.scale;return pe({scale:a,x:n.x-r.x-(n.x-r.x-e.x)*o,y:n.y-r.y-(n.y-r.y-e.y)*o},i)},he=(e,t,n)=>pe({...e,x:e.x+t.x,y:e.y+t.y},n),ge=(e,t,n,r,i,a)=>{let o=X(r,a.minScale??Y,a.maxScale??5),s=o/e.scale;return pe({scale:o,x:n.x-i.x-(t.x-i.x-e.x)*s,y:n.y-i.y-(t.y-i.y-e.y)*s},a)},Z=500,_e=24,ve=(e,t={})=>{let n=t.target??(typeof document>`u`?null:document);if(!n)return()=>{};let r=t.durationMs??Z,i=t.maxDistance??_e,a=!0,o,s=()=>{a&&(a=!1,n.removeEventListener(`click`,c,!0),o!==void 0&&globalThis.clearTimeout(o))},c=t=>{let n=t;typeof n.clientX==`number`&&typeof n.clientY==`number`&&(Math.hypot(n.clientX-e.x,n.clientY-e.y)>i||(s(),t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()))};return n.addEventListener(`click`,c,!0),o=globalThis.setTimeout(s,r),s},ye=(e,t,n={})=>{ve(e,n),t()},be=e(r(),1);function xe(e,t,n,r,i){let a=e instanceof HTMLImageElement?e:e.querySelector(`img`);if(!a||!t.complete||!t.naturalWidth||!t.animate)return;let o=t.getBoundingClientRect(),s=a.getBoundingClientRect();if(!o.width||!o.height||!s.width||!s.height)return;let c=getComputedStyle(a),l=t.naturalWidth/t.naturalHeight,u=c.objectFit===`cover`?Math.max(s.width,s.height*l):Math.min(s.width,s.height*l),d=u/l,f=c.objectPosition.split(` `);if(!f.every(e=>e.endsWith(`%`)))return;let p=(s.width-u)*parseFloat(f[0])/100,m=(s.height-d)*parseFloat(f[1]??f[0])/100,h=s.left,g=s.top,_=s.right,v=s.bottom,y=c.borderRadius;for(let e=a.parentElement;e;e=e.parentElement){let t=getComputedStyle(e),n=e.getBoundingClientRect();[`hidden`,`clip`,`auto`,`scroll`].includes(t.overflowX)&&(h=Math.max(h,n.left),_=Math.min(_,n.right)),[`hidden`,`clip`,`auto`,`scroll`].includes(t.overflowY)&&(g=Math.max(g,n.top),v=Math.min(v,n.bottom)),n.width===s.width&&n.height===s.height&&t.borderRadius!==`0px`&&(y=t.borderRadius)}if(_<=h||v<=g)return;let b=document.createElement(`div`);b.dataset.mediaCropAnimation=``,b.setAttribute(`aria-hidden`,`true`),Object.assign(b.style,{position:`fixed`,left:`0`,top:`0`,overflow:`hidden`,pointerEvents:`none`,zIndex:`51`,contain:`paint`});let x=document.createElement(`img`);x.src=t.currentSrc||t.src,x.alt=``,Object.assign(x.style,{display:`block`,width:`${o.width}px`,height:`${o.height}px`,maxWidth:`none`,transformOrigin:`0 0`}),b.append(x),document.body.append(b);let S={transform:`translate(${o.left}px, ${o.top}px)`,width:`${o.width}px`,height:`${o.height}px`,borderRadius:`0px`},C={transform:`translate(${h}px, ${g}px)`,width:`${_-h}px`,height:`${v-g}px`,borderRadius:y},w={transform:`translate(0px, 0px) scale(1)`},T={transform:`translate(${s.left+p-h}px, ${s.top+m-g}px) scale(${u/o.width})`},E={duration:280,easing:`cubic-bezier(0.2, 0, 0, 1)`,fill:`both`},D=t.style.visibility;t.style.visibility=`hidden`;let O=[b.animate(r?[S,C]:[C,S],E),x.animate(r?[w,T]:[T,w],E),n.animate({opacity:r?[1,0]:[0,1]},E)],k=!1,A=(e=!1)=>{b.remove(),t.style.visibility=D,O.forEach((t,n)=>{(!e||n!==2)&&t.cancel()})};return Promise.all(O.map(e=>e.finished)).then(()=>{k||(A(r),i())},()=>{k||(A(),i())}),()=>{k=!0,A()}}function Se(e,t,n,r,i=()=>{}){let a=e?.getBoundingClientRect(),o=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(!o&&e?.isConnected&&t instanceof HTMLImageElement&&n&&a?.width&&a.height&&a.bottom>0&&a.top<window.innerHeight&&a.right>0&&a.left<window.innerWidth){let a=xe(e,t,n,r,i);if(a)return a}if(!document.startViewTransition||o||!e?.isConnected||!t||!n||!a?.width||!a.height||a.bottom<=0||a.top>=window.innerHeight||a.right<=0||a.left>=window.innerWidth){if(!n?.animate||o)return i(),()=>{};let e=n.animate({opacity:r?[1,0]:[0,1]},{duration:150,fill:`forwards`}),t=!1;return e.finished.then(()=>{t||i()},()=>{}),()=>{t=!0,e.cancel()}}let s=e.style.viewTransitionName,c=t.style.viewTransitionName,l=n.style.visibility,u=!1,d=`oc-media-preview`;e.style.viewTransitionName=r?`none`:d,t.style.viewTransitionName=r?d:`none`,r||(n.style.visibility=`hidden`);let f=document.startViewTransition(()=>{u||(e.style.viewTransitionName=r?d:`none`,t.style.viewTransitionName=r?`none`:d,n.style.visibility=r?`hidden`:l)}),p=()=>{e.style.viewTransitionName=s,t.style.viewTransitionName=c,n.style.visibility=l};f.ready.catch(()=>{});let m=()=>{u||(p(),i())};return f.finished.then(m,m),()=>{u=!0,f.skipTransition(),p()}}function Ce(e){let t=(0,V.c)(12),{onClose:n,isMobile:r,size:i}=e,{t:a}=u(),o;t[0]!==r||t[1]!==i?(o=r?{top:`calc(var(--oc-safe-area-top, 0px) + 0.5rem)`,right:`calc(var(--oc-safe-area-right, 0px) + 0.75rem)`}:{top:i?`calc(50% - ${i.height/2}px + 0.5rem)`:`0.5rem`,right:i?`calc(50% - ${i.width/2}px + 0.5rem)`:`0.5rem`},t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a(`dialog.common.actions.close`),t[3]=a,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,U.jsx)(h,{name:`close`,className:`size-5`}),t[5]=c):c=t[5];let l;t[6]!==n||t[7]!==s?(l=(0,U.jsx)(f,{variant:`mobileGlass`,size:`mobileIcon`,"aria-label":s,onClick:n,children:c}),t[6]=n,t[7]=s,t[8]=l):l=t[8];let d;return t[9]!==o||t[10]!==l?(d=(0,U.jsx)(`div`,{className:`absolute right-3 z-20`,style:o,children:l}),t[9]=o,t[10]=l,t[11]=d):d=t[11],d}function we(e){let t=(0,V.c)(25),{open:n,title:r,kind:i,source:a,isMobile:o,onOpenChange:s,children:c}=e,u=H.useRef(null),d=H.useRef(null),f=H.useRef(!1),[p,m]=H.useState(!1),h;t[0]!==s||t[1]!==a?(h=()=>{if(f.current)return;f.current=!0,d.current?.();let e=u.current?.querySelector(`[data-preview-transition-target]`)??null;d.current=Se(e?.dataset.previewReturn===`false`?void 0:a,e,u.current,!0,()=>{m(!0),s(!1)})},t[0]=s,t[1]=a,t[2]=h):h=t[2];let g=l(h),_=`${i}-preview`,v=n&&!p&&o,y;t[3]!==g||t[4]!==_||t[5]!==v?(y={id:_,active:v,layer:`overlay`,onBack:g,surfaceRef:u},t[3]=g,t[4]=_,t[5]=v,t[6]=y):y=t[6],b(y);let x,S;if(t[7]!==p||t[8]!==n||t[9]!==a?(x=()=>{if(!n){m(!1),f.current=!1;return}if(p)return;let e=u.current,t=document.activeElement instanceof HTMLElement?document.activeElement:null;return e?.querySelector(`button`)?.focus({preventScroll:!0}),d.current=Se(a,e?.querySelector(`[data-preview-transition-target]`)??null,e,!1),()=>{d.current?.(),d.current=null,f.current=!1,t?.isConnected&&t.focus({preventScroll:!0})}},S=[p,n,a],t[7]=p,t[8]=n,t[9]=a,t[10]=x,t[11]=S):(x=t[10],S=t[11]),H.useLayoutEffect(x,S),!n||p||typeof document>`u`)return null;let C=o?`var(--oc-media-preview-background)`:`color-mix(in srgb, var(--oc-media-preview-background) ${i===`mermaid`?90:70}%, transparent)`,w;t[12]===C?w=t[13]:(w={backgroundColor:C,color:`var(--oc-media-preview-foreground)`},t[12]=C,t[13]=w);let T;t[14]===g?T=t[15]:(T=e=>{if(e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),g()),e.key!==`Tab`)return;let t=Array.from(e.currentTarget.querySelectorAll(`button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex="0"]`)),n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())},t[14]=g,t[15]=T);let E;t[16]!==c||t[17]!==g?(E=c(g),t[16]=c,t[17]=g,t[18]=E):E=t[18];let D;return t[19]!==i||t[20]!==E||t[21]!==w||t[22]!==T||t[23]!==r?(D=(0,be.createPortal)((0,U.jsx)(`div`,{ref:u,role:`dialog`,"aria-modal":`true`,"aria-label":r,"data-media-preview":i,"data-page-scroll-lock":`true`,tabIndex:-1,className:`fixed inset-0 z-50 overflow-hidden select-none`,style:w,onClick:Te,onKeyDown:T,children:E}),document.body),t[19]=i,t[20]=E,t[21]=w,t[22]=T,t[23]=r,t[24]=D):D=t[24],D}function Te(e){e.preventDefault(),e.stopPropagation()}var Ee=500,De=400,Q=(e,t)=>new oe(e,t),Oe=e=>{let t=`h-3.5 w-3.5 flex-shrink-0`,n=e.toLowerCase();return n===`reasoning`?(0,U.jsx)(h,{name:`brain-ai-3`,className:t}):n===`image-preview`?(0,U.jsx)(h,{name:`file-image`,className:t}):n===`mermaid-preview`?(0,U.jsx)(h,{name:`file-list-2`,className:t}):n===`edit`||n===`multiedit`||n===`apply_patch`||n===`str_replace`||n===`str_replace_based_edit_tool`?(0,U.jsx)(h,{name:`pencil-ai`,className:t}):n===`write`||n===`create`||n===`file_write`||n===`read`||n===`view`||n===`file_read`||n===`cat`?(0,U.jsx)(h,{name:`file-pdf`,className:t}):n===`bash`||n===`shell`||n===`cmd`||n===`terminal`?(0,U.jsx)(h,{name:`terminal-box`,className:t}):n===`list`||n===`ls`||n===`dir`||n===`list_files`?(0,U.jsx)(h,{name:`folder-6`,className:t}):n===`search`||n===`grep`||n===`find`||n===`ripgrep`?(0,U.jsx)(h,{name:`search`,className:t}):n===`glob`?(0,U.jsx)(h,{name:`file-search`,className:t}):n===`fetch`||n===`curl`||n===`wget`||n===`webfetch`?(0,U.jsx)(h,{name:`global`,className:t}):n===`web-search`||n===`websearch`||n===`search_web`||n===`google`||n===`bing`||n===`duckduckgo`?(0,U.jsx)(h,{name:`search`,className:t}):n===`todowrite`||n===`todoread`?(0,U.jsx)(h,{name:`list-check-3`,className:t}):n.startsWith(`git`)?(0,U.jsx)(h,{name:`git-branch`,className:t}):(0,U.jsx)(h,{name:`tools`,className:t})},ke={style:{background:`transparent`,backgroundColor:`transparent`,fontSize:`inherit`}},Ae={download:!1,copy:!1,showPanZoomControls:!0},je=`
3
- [data-diff-header],
4
- [data-diff] {
5
- [data-separator] {
6
- height: 24px !important;
7
- }
8
- }
9
- `,$={hunkLineCount:50,lineHeight:24,diffHeaderHeight:44,hunkSeparatorHeight:24,spacing:0},Me=()=>{let e=(0,V.c)(22),t=m(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=y(!1),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=y(!0),e[1]=i):i=e[1];let a=i,o;e[2]===t?.availableThemes?o=e[3]:(o=()=>t?.availableThemes??[r,a],e[2]=t?.availableThemes,e[3]=o),t?.availableThemes;let s;e[4]===o?s=e[5]:(s=o(),e[4]=o,e[5]=s);let c=s,l=t?.lightThemeId??r.metadata.id,u=t?.darkThemeId??a.metadata.id,d;e[6]!==c||e[7]!==l?(d=c.find(e=>e.metadata.id===l)??r,e[6]=c,e[7]=l,e[8]=d):d=e[8];let f=d,p;e[9]!==c||e[10]!==u?(p=c.find(e=>e.metadata.id===u)??a,e[9]=c,e[10]=u,e[11]=p):p=e[11];let h=p,g,_;e[12]!==h||e[13]!==f?(g=()=>{x(f),x(h)},_=[h,f],e[12]=h,e[13]=f,e[14]=g,e[15]=_):(g=e[14],_=e[15]),H.useEffect(g,_);let v=t?.currentTheme.metadata.variant??`light`,b;e[16]!==h.metadata.id||e[17]!==f.metadata.id?(b={light:f.metadata.id,dark:h.metadata.id},e[16]=h.metadata.id,e[17]=f.metadata.id,e[18]=b):b=e[18];let S=v===`dark`?`dark`:`light`,C;return e[19]!==b||e[20]!==S?(C={theme:b,themeType:S},e[19]=b,e[20]=S,e[21]=C):C=e[21],C},Ne=()=>({width:typeof window<`u`?window.innerWidth:0,height:typeof window<`u`?window.innerHeight:0}),Pe=e=>{let t=(0,V.c)(3),[n,r]=H.useState(Ne),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e||typeof window>`u`)return;let t=()=>{r(Ne())};return t(),window.addEventListener(`resize`,t),()=>{window.removeEventListener(`resize`,t)}},a=[e],t[0]=e,t[1]=i,t[2]=a),H.useEffect(i,a),n},Fe=({popup:e,onOpenChange:t,isMobile:n})=>{let{t:r}=u(),i=m(),a=w()??``,o=H.useMemo(()=>{let t=e.image;if(!t)return[];let n=Array.isArray(t.gallery)?t.gallery.filter(e=>!!e?.url):[];return n.length>0?n:[{url:t.url,mimeType:t.mimeType,filename:t.filename,size:t.size}]},[e.image]),[s,c]=H.useState(()=>{let t=e.image?.index??o.findIndex(t=>t.url===e.image?.url);return t>=0&&t<o.length?t:0}),p=e.previewSource instanceof HTMLImageElement?e.previewSource:void 0,g=p?.naturalWidth&&p.naturalHeight?{width:p.naturalWidth,height:p.naturalHeight}:null,[_,y]=H.useState(g),[b,x]=H.useState(!!g),S=e.open,C=Pe(e.open),E=H.useRef(null),k=H.useRef(null),A=H.useRef(null),j=H.useRef(null),M=H.useRef({scale:1,x:0,y:0}),N=H.useRef({image:{width:1,height:1},viewport:{width:1,height:1},maxScale:5}),P=H.useRef(new Map),F=H.useRef(null),I=H.useRef(null),L=H.useRef(null),R=H.useRef(null),z=H.useRef(0);H.useEffect(()=>{e.open&&(z.current=typeof performance<`u`?performance.now():Date.now())},[e.open]);let ee=l(()=>(typeof performance<`u`?performance.now():Date.now())-z.current<De),B=l(()=>{let e=F.current;e?.longPressTimer&&(clearTimeout(e.longPressTimer),e.longPressTimer=null)});H.useEffect(()=>{if(!e.open||o.length===0)return;let t=typeof e.image?.index==`number`?e.image.index:-1;if(t>=0&&t<o.length){c(t);return}let n=e.image?.url?o.findIndex(t=>t.url===e.image?.url):-1;c(n>=0?n:0)},[o,e.image?.index,e.image?.url,e.open]);let V=o[s]??o[0]??e.image,W=v(V?.url??``,a,`preview`),G=W.source||(V?.url===e.image?.url?p?.currentSrc:``)||``,te=`${W.key}\n${G}`,[ne,re]=H.useState(``),ie=!!(W.error||ne===te),ae=l(()=>re(te)),oe=V?.filename||e.title,K=o.length>1,se=l(()=>{let t=V?.url??e.image?.url??``;if(!t&&!G)return;let n=V?.mimeType||e.image?.mimeType,r=V?.filename||e.image?.filename||e.title,i=A.current;if(i&&i.naturalWidth>0){O(i,n||`image/png`).then(e=>{T({sourceUrl:t||G,displayUrl:G||i.currentSrc||i.src||void 0,filename:r,mimeType:n,effectiveDirectory:a,prefetchedBlob:e??void 0})});return}T({sourceUrl:t||G,displayUrl:G||void 0,filename:r,mimeType:n,effectiveDirectory:a})}),ce=l(()=>{o.length<=1||c(e=>(e-1+o.length)%o.length)}),q=l(()=>{o.length<=1||c(e=>(e+1)%o.length)}),J=H.useMemo(()=>{let e={width:Math.max(1,C.width*(n?1:.8)),height:Math.max(1,C.height*(n?1:.95))};return _?fe(_,e):e},[_,n,C.height,C.width]),le=H.useMemo(()=>({image:J,viewport:{width:Math.max(1,C.width),height:Math.max(1,C.height)},maxScale:5}),[J,C.height,C.width]),Y=l((e,t=!1)=>{let n=pe(e,N.current);M.current=n,R.current={transform:n,animate:t},!(L.current!==null||typeof window>`u`)&&(L.current=window.requestAnimationFrame(()=>{L.current=null;let e=R.current;R.current=null,e&&(A.current&&(A.current.style.transition=e.animate?`transform 180ms cubic-bezier(0.22, 1, 0.36, 1)`:`none`,A.current.style.transform=`translate3d(${e.transform.x}px, ${e.transform.y}px, 0) scale(${e.transform.scale})`),j.current&&(j.current.textContent=`${Math.round(e.transform.scale*100)}%`),E.current&&(E.current.style.cursor=e.transform.scale>1?`grab`:`zoom-in`))}))}),ue=l((e=!0)=>{Y({scale:1,x:0,y:0},e)}),X=l(()=>({x:N.current.viewport.width/2,y:N.current.viewport.height/2})),Z=l((e,t,n=!1)=>{Y(me(M.current,e,t,X(),N.current),n)}),_e=l(e=>{if(M.current.scale>1.01){ue(!0);return}Z(2,e,!0)}),ve=l(e=>{if(!(n||e.defaultPrevented)){if(e.key===`+`||e.key===`=`){e.preventDefault(),Z(M.current.scale*1.4,X(),!0);return}if(e.key===`-`||e.key===`_`){e.preventDefault(),Z(M.current.scale/1.4,X(),!0);return}if(e.key===`0`){e.preventDefault(),ue(!0);return}if(e.key===`ArrowLeft`&&K){e.preventDefault(),ce();return}e.key===`ArrowRight`&&K&&(e.preventDefault(),q())}});H.useEffect(()=>{if(e.open)return window.addEventListener(`keydown`,ve),()=>{window.removeEventListener(`keydown`,ve)}},[e.open]),H.useEffect(()=>{L.current!==null&&window.cancelAnimationFrame(L.current),L.current=null,R.current=null;let t=V?.url===e.image?.url?p:void 0;y(t?.naturalWidth&&t.naturalHeight?{width:t.naturalWidth,height:t.naturalHeight}:null),x(!!t?.naturalWidth),M.current={scale:1,x:0,y:0},P.current.clear(),F.current=null,I.current=null,A.current&&(A.current.style.transform=`translate3d(0, 0, 0) scale(1)`),j.current&&(j.current.textContent=`100%`)},[V?.url,G,e.image?.url,p]),H.useLayoutEffect(()=>{N.current=le;let e=pe(M.current,N.current);M.current=e,A.current&&(A.current.style.transition=`none`,A.current.style.transform=`translate3d(${e.x}px, ${e.y}px, 0) scale(${e.scale})`)},[le]),H.useEffect(()=>()=>{L.current!==null&&window.cancelAnimationFrame(L.current),L.current=null,R.current=null;let e=F.current;e?.longPressTimer&&(clearTimeout(e.longPressTimer),e.longPressTimer=null)},[]);let be=l(e=>{if(n)return;e.preventDefault();let t={x:e.clientX,y:e.clientY},r=Math.exp(-e.deltaY*.002);Z(M.current.scale*r,t)});H.useEffect(()=>{let e=E.current;if(!(!S||n||!e))return e.addEventListener(`wheel`,be,{passive:!1}),()=>e.removeEventListener(`wheel`,be)},[n,S]);let xe=l(e=>{n||(e.preventDefault(),_e({x:e.clientX,y:e.clientY}))}),Se=l(e=>{e.preventDefault(),e.stopPropagation()}),we=l(e=>{e.pointerType!==`mouse`&&e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId);let t={x:e.clientX,y:e.clientY};if(P.current.set(e.pointerId,{point:t,pointerType:e.pointerType}),P.current.size===1){if(F.current={pointerId:e.pointerId,pointerType:e.pointerType,start:t,transform:M.current,moved:!1,targetWasCanvas:e.target===e.currentTarget,suppressTap:!1,longPressTimer:null,longPressTriggered:!1},e.pointerType!==`mouse`||M.current.scale<=1.01){let t=F.current;t.longPressTimer=setTimeout(()=>{!F.current||F.current.pointerId!==e.pointerId||F.current.moved||(F.current.longPressTriggered=!0,F.current.suppressTap=!0,se())},Ee)}E.current&&M.current.scale>1&&(E.current.style.cursor=`grabbing`);return}B(),F.current&&(F.current.suppressTap=!0,F.current.longPressTriggered=!1);let n=Array.from(P.current.values()).slice(0,2).map(e=>e.point),r=n[1].x-n[0].x,i=n[1].y-n[0].y;I.current={distance:Math.max(1,Math.hypot(r,i)),midpoint:{x:(n[0].x+n[1].x)/2,y:(n[0].y+n[1].y)/2},transform:M.current},F.current&&(F.current.suppressTap=!0)}),Te=l(e=>{if(!P.current.has(e.pointerId))return;e.preventDefault();let t={x:e.clientX,y:e.clientY};if(P.current.set(e.pointerId,{point:t,pointerType:e.pointerType}),P.current.size>=2&&I.current){B();let e=Array.from(P.current.values()).slice(0,2).map(e=>e.point),t=e[1].x-e[0].x,n=e[1].y-e[0].y,r={x:(e[0].x+e[1].x)/2,y:(e[0].y+e[1].y)/2},i=I.current.transform.scale*Math.hypot(t,n)/I.current.distance;Y(ge(I.current.transform,I.current.midpoint,r,i,X(),N.current));return}let n=F.current;if(!n||n.pointerId!==e.pointerId)return;let r={x:t.x-n.start.x,y:t.y-n.start.y};Math.hypot(r.x,r.y)>10&&(n.moved=!0,B()),n.transform.scale>1.01&&Y(he(n.transform,r,N.current))}),Q=l((e,r)=>{let i=F.current,a=P.current.get(e.pointerId)?{x:e.clientX,y:e.clientY}:void 0;if(P.current.delete(e.pointerId),i?.pointerId===e.pointerId&&(B(),a&&!i.longPressTriggered)){let e=de({isMobile:n,pointerType:i.pointerType,cancelled:r,moved:i.moved||Math.hypot(a.x-i.start.x,a.y-i.start.y)>10,suppressTap:i.suppressTap,targetWasCanvas:i.targetWasCanvas,start:i.start,end:a,startScale:i.transform.scale,hasMultipleImages:K});if(e===`next`&&q(),e===`previous`&&ce(),e===`close`){if(ee())return;if(n&&i.pointerType!==`mouse`){ye(a,()=>t(!1));return}t(!1)}}if(P.current.size===1){let[e,t]=Array.from(P.current.entries())[0];F.current={pointerId:e,pointerType:t.pointerType,start:t.point,transform:M.current,moved:!1,targetWasCanvas:!1,suppressTap:!0,longPressTimer:null,longPressTriggered:!1},I.current=null}else P.current.size===0&&(F.current=null,I.current=null,E.current&&(E.current.style.cursor=M.current.scale>1?`grab`:`zoom-in`));e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)}),Oe=l(e=>{e.preventDefault(),e.stopPropagation(),se()}),ke=l(e=>{let t=e.currentTarget;t.naturalWidth>0&&t.naturalHeight>0&&y(e=>e?.width===t.naturalWidth&&e.height===t.naturalHeight?e:{width:t.naturalWidth,height:t.naturalHeight}),x(!0)});if(!S||!V||typeof document>`u`)return null;let Ae=i?.currentTheme.metadata.variant===`dark`,je=Ae?`border-foreground/15 bg-foreground/10 text-foreground`:`border-background/15 bg-background/10 text-background`,$=Ae?`text-foreground hover:bg-foreground/15 hover:text-foreground`:`text-background hover:bg-background/15 hover:text-background`;return(0,U.jsxs)(`div`,{ref:k,className:`absolute inset-0 overflow-hidden select-none`,tabIndex:-1,onClick:Se,children:[(0,U.jsx)(Ce,{onClose:()=>t(!1),isMobile:n,size:J}),(0,U.jsxs)(`div`,{ref:E,className:`absolute inset-0 flex items-center justify-center overflow-hidden touch-none [overscroll-behavior:none]`,onDoubleClick:n?void 0:xe,onContextMenu:Oe,onPointerDown:we,onPointerMove:Te,onPointerUp:e=>Q(e,!1),onPointerCancel:e=>Q(e,!0),onLostPointerCapture:e=>Q(e,!0),children:[!b&&!ie&&(0,U.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,role:`status`,children:(0,U.jsx)(D,{className:`aspect-square w-64 max-w-[80vw] rounded-xl`})}),ie?(0,U.jsx)(`p`,{role:`status`,className:`px-6 text-center typography-ui-label`,children:r(`filesView.error.readFileFailed`)}):(0,U.jsx)(`img`,{ref:A,"data-preview-transition-target":``,"data-preview-return":V?.url===e.image?.url,src:G||void 0,alt:oe??``,className:d(`block max-w-none object-contain will-change-transform`,b?`opacity-100`:`opacity-0`),style:{width:`${J.width}px`,height:`${J.height}px`},loading:`lazy`,draggable:!1,onLoad:ke,onError:ae})]}),(0,U.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 z-10 flex justify-center px-2 pb-2`,children:(0,U.jsxs)(`div`,{className:d(`pointer-events-auto flex h-10 items-center gap-0.5 rounded-full border px-1 shadow-lg backdrop-blur-xl`,je),onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:[K&&(0,U.jsx)(f,{variant:`ghost`,size:`icon`,className:d(`size-8 rounded-full`,$),onClick:ce,"aria-label":r(`chat.toolOutputDialog.image.previousAria`),title:r(`chat.toolOutputDialog.image.previousAria`),children:(0,U.jsx)(h,{name:`arrow-left-s`,className:`size-5`})}),K&&(0,U.jsxs)(`span`,{className:`min-w-10 px-1 text-center typography-micro tabular-nums opacity-80`,children:[s+1,` / `,o.length]}),K&&(0,U.jsx)(f,{variant:`ghost`,size:`icon`,className:d(`size-8 rounded-full`,$),onClick:q,"aria-label":r(`chat.toolOutputDialog.image.nextAria`),title:r(`chat.toolOutputDialog.image.nextAria`),children:(0,U.jsx)(h,{name:`arrow-right-s`,className:`size-5`})}),K&&(0,U.jsx)(`span`,{className:`mx-0.5 h-4 w-px bg-current opacity-15`,"aria-hidden":`true`}),(0,U.jsx)(f,{variant:`ghost`,size:`icon`,className:d(`size-8 rounded-full`,$),onClick:()=>Z(M.current.scale/1.4,X(),!0),"aria-label":r(`chat.toolOutputDialog.image.zoomOutAria`),title:r(`chat.toolOutputDialog.image.zoomOutAria`),children:(0,U.jsx)(h,{name:`subtract`,className:`size-4`})}),(0,U.jsxs)(f,{variant:`ghost`,size:`sm`,className:d(`h-8 min-w-14 rounded-full px-2 tabular-nums`,$),onClick:()=>ue(!0),"aria-label":r(`chat.toolOutputDialog.image.resetZoomAria`),title:r(`chat.toolOutputDialog.image.resetZoomAria`),children:[(0,U.jsx)(h,{name:`restart`,className:`size-3.5`}),(0,U.jsx)(`span`,{ref:j,children:`100%`})]}),(0,U.jsx)(f,{variant:`ghost`,size:`icon`,className:d(`size-8 rounded-full`,$),onClick:()=>Z(M.current.scale*1.4,X(),!0),"aria-label":r(`chat.toolOutputDialog.image.zoomInAria`),title:r(`chat.toolOutputDialog.image.zoomInAria`),children:(0,U.jsx)(h,{name:`add`,className:`size-4`})})]})})]})},Ie=H.memo(e=>{let t=(0,V.c)(7),{popup:n,diffViewMode:r,pierreThemeConfig:i}=e,a=n.content||``,o=r===`unified`?`unified`:`split`,s;t[0]!==i.theme||t[1]!==i.themeType||t[2]!==o?(s={diffStyle:o,diffIndicators:`none`,hunkSeparators:`line-info-basic`,lineDiffType:`none`,disableFileHeader:!0,maxLineDiffLength:1e3,expansionLineCount:20,overflow:`wrap`,theme:i.theme,themeType:i.themeType,unsafeCSS:je},t[0]=i.theme,t[1]=i.themeType,t[2]=o,t[3]=s):s=t[3];let l;return t[4]!==a||t[5]!==s?(l=(0,U.jsx)(`div`,{className:`typography-code`,children:(0,U.jsx)(c,{patch:a,metrics:$,options:s,className:`block w-full`})}),t[4]=a,t[5]=s,t[6]=l):l=t[6],l});Ie.displayName=`DialogUnifiedDiff`;var Le=H.memo(e=>{let t=(0,V.c)(29),{popup:n,pierreThemeConfig:r}=e,i;t[0]===n.content?i=t[1]:(i=N(n.content),t[0]=n.content,t[1]=i);let a=i,o=n.metadata?.input,c;t[2]===o?c=t[3]:(c=typeof o==`object`&&o?o:{},t[2]=o,t[3]=c);let l=c,u=typeof l.offset==`number`?l.offset:0,d=typeof l.file_path==`string`?l.file_path:typeof l.filePath==`string`?l.filePath:typeof l.path==`string`?l.path:`read-output`,f;t[4]===a.lines?f=t[5]:(f=a.lines.map(Be).join(`
10
- `),t[4]=a.lines,t[5]=f);let p=f,m;t[6]!==d||t[7]!==n.language?(m=n.language||C(d)||`text`,t[6]=d,t[7]=n.language,t[8]=m):m=t[8];let h=m,g;t[9]===a.lines?g=t[10]:(g=a.lines.some(Ve),t[9]=a.lines,t[10]=g);let _=g,v;if(t[11]!==_||t[12]!==u||t[13]!==a.lines||t[14]!==a.type){v=[];let e=u;for(let t of a.lines){t.lineNumber!==null&&(e=t.lineNumber);let n=a.type===`file`&&!_&&t.lineNumber===null&&!t.isInfo,r=t.lineNumber??(n?e+1:null);typeof r==`number`&&(e=r),v.push({text:t.text,lineNumber:r,isInfo:t.isInfo})}t[11]=_,t[12]=u,t[13]=a.lines,t[14]=a.type,t[15]=v}else v=t[15];let y=v;if(a.type===`file`){let e=h||void 0,n;t[16]!==p||t[17]!==d||t[18]!==e?(n={name:d,contents:p,lang:e},t[16]=p,t[17]=d,t[18]=e,t[19]=n):n=t[19];let i;t[20]!==r.theme||t[21]!==r.themeType?(i={disableFileHeader:!0,overflow:`wrap`,theme:r.theme,themeType:r.themeType},t[20]=r.theme,t[21]=r.themeType,t[22]=i):i=t[22];let a;return t[23]!==n||t[24]!==i?(a=(0,U.jsx)(s,{file:n,options:i,className:`block w-full`}),t[23]=n,t[24]=i,t[25]=a):a=t[25],a}let b;return t[26]!==y||t[27]!==h?(b=(0,U.jsx)(te,{lines:y,language:h,maxHeight:`70vh`}),t[26]=y,t[27]=h,t[28]=b):b=t[28],b});Le.displayName=`DialogReadContent`;var Re=({popup:e,onOpenChange:n,isMobile:r})=>{let{t:i}=u(),a=m(),o=H.useMemo(()=>a?.currentTheme.metadata.variant===`dark`?a.currentTheme:a?.availableThemes.find(e=>e.metadata.id===a.darkThemeId&&e.metadata.variant===`dark`)??y(!0),[a?.currentTheme,a?.availableThemes,a?.darkThemeId]),[s,c]=H.useState(e.mermaid?.source||``),[l,d]=H.useState(e.mermaid?.source?`ready`:`idle`),[f,p]=H.useState(``),g=H.useRef(0),_=H.useCallback(e=>{let t=e.trim();if(!t.toLowerCase().startsWith(`file://`))return null;let n=e=>{if(!e||/[\0\r\n]/.test(e))return!1;let t=e.replace(/\\/g,`/`);return t.split(`/`).filter(Boolean).includes(`..`)?!1:t.startsWith(`/`)?!0:/^[A-Za-z]:\//.test(t)},r=e=>e.replace(/%([0-9A-Fa-f]{2})/g,(e,t)=>{let n=Number.parseInt(t,16);return Number.isFinite(n)?String.fromCharCode(n):`%${t}`});if(typeof URL.canParse==`function`&&URL.canParse(t)){let e=r(new URL(t).pathname||``);return/^\/[A-Za-z]:\//.test(e)&&(e=e.slice(1)),n(e)?e:null}let i=t.replace(/^file:\/\//i,``),a=r(i);return n(a)?a:n(i)?i:null},[]),v=H.useCallback(async()=>{let n=e.mermaid,r=ce(g.current);if(g.current=r,!n?.url){d(`error`),p(i(`chat.toolOutputDialog.mermaid.missingSource`));return}if(n.source){c(n.source),d(`ready`),p(``);return}d(`loading`),p(``);let a;if(n.url.startsWith(`data:`))a=le(n.url);else if(n.url.toLowerCase().startsWith(`file://`)){let e=_(n.url);a=e?t(`/api/fs/raw`,{query:{path:e}}).then(e=>e.ok?e.text():Promise.reject(Q(`chat.toolOutputDialog.mermaid.readFileFailedWithStatus`,{status:e.status}))):Promise.reject(Q(`chat.toolOutputDialog.mermaid.invalidLocalPath`))}else{let e=typeof URL.canParse==`function`&&URL.canParse(n.url,window.location.origin)?new URL(n.url,window.location.origin):null;a=!e||e.protocol!==`http:`&&e.protocol!==`https:`?Promise.reject(Q(`chat.toolOutputDialog.mermaid.unsupportedUrlProtocol`)):fetch(e.toString()).then(e=>e.ok?e.text():Promise.reject(Q(`chat.toolOutputDialog.mermaid.loadFailedWithStatus`,{status:e.status})))}await a.then(e=>{q(g.current,r)&&(c(e),d(`ready`))}).catch(e=>{q(g.current,r)&&(d(`error`),p(se(e)?i(e.key,e.params):i(`chat.toolOutputDialog.mermaid.loadFailed`)))})},[_,e.mermaid,i]);H.useEffect(()=>{!e.open||!e.mermaid||v()},[v,e.mermaid,e.open]);let b=`\`\`\`mermaid\n${s}\n\`\`\``;return!e.open||typeof document>`u`?null:(0,U.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,onClick:e=>{e.target===e.currentTarget&&n(!1)},children:(0,U.jsxs)(`div`,{"data-mermaid-preview":`true`,"data-preview-transition-target":``,className:`relative flex min-h-0 flex-col overflow-hidden`,style:{width:r?`100%`:`80%`,height:r?`100%`:`95%`},onMouseDown:e=>e.stopPropagation(),children:[(0,U.jsx)(Ce,{onClose:()=>n(!1),isMobile:r}),(0,U.jsx)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:(0,U.jsxs)(`div`,{className:`h-full overflow-hidden`,children:[l===`loading`&&(0,U.jsxs)(`div`,{className:`h-full min-h-28 flex items-center justify-center gap-2 text-muted-foreground typography-meta`,children:[(0,U.jsx)(h,{name:`loader-4`,className:`h-4 w-4 animate-spin`}),(0,U.jsx)(`span`,{children:i(`chat.toolOutputDialog.mermaid.loading`)})]}),l===`error`&&(0,U.jsxs)(`div`,{className:`rounded-xl border p-3 space-y-3`,style:{backgroundColor:`var(--status-error-background)`,borderColor:`var(--status-error-border)`},children:[(0,U.jsx)(`p`,{className:`typography-markdown`,style:{color:`var(--status-error)`},children:f||i(`chat.toolOutputDialog.mermaid.renderFailed`)}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>{v()},className:`px-3 py-1.5 rounded-lg typography-meta border transition-colors hover:bg-[var(--interactive-hover)]`,style:{borderColor:`var(--interactive-border)`,color:`var(--surface-foreground)`},children:i(`chat.toolOutputDialog.mermaid.retry`)})]}),l===`ready`&&(0,U.jsx)(`div`,{className:`h-full`,children:(0,U.jsx)(S,{content:b,variant:`tool`,allowMermaidWheelEvents:!0,className:`markdown-mermaid-fullscreen h-full`,mermaidControls:Ae,mermaidTheme:o,enableFileReferences:!1})})]})})]})})},ze=e=>{let t=(0,V.c)(51),{popup:n,onOpenChange:r,isMobile:i}=e,{t:o}=u(),[c,l]=H.useState(`unified`),f=Me(),p;t[0]===n.open?p=t[1]:(p=()=>{n.open&&l(`unified`)},t[0]=n.open,t[1]=p);let m;if(t[2]!==n.open||t[3]!==n.title?(m=[n.open,n.title],t[2]=n.open,t[3]=n.title,t[4]=m):m=t[4],H.useEffect(p,m),n.image||n.mermaid){let e=n.image?`image`:`mermaid`,a;t[5]!==i||t[6]!==n?(a=e=>n.image?(0,U.jsx)(Fe,{popup:n,onOpenChange:e,isMobile:i}):(0,U.jsx)(Re,{popup:n,onOpenChange:e,isMobile:i}),t[5]=i,t[6]=n,t[7]=a):a=t[7];let o;return t[8]!==i||t[9]!==r||t[10]!==n.open||t[11]!==n.previewSource||t[12]!==n.title||t[13]!==e||t[14]!==a?(o=(0,U.jsx)(we,{open:n.open,title:n.title,kind:e,source:n.previewSource,isMobile:i,onOpenChange:r,children:a}),t[8]=i,t[9]=r,t[10]=n.open,t[11]=n.previewSource,t[12]=n.title,t[13]=e,t[14]=a,t[15]=o):o=t[15],o}let v=n.open,y=i?`w-[95vw] max-w-[95vw]`:`max-w-5xl`,b=i?`[&>button]:right-1`:`[&>button]:top-2.5 [&>button]:right-4`,x;t[16]!==y||t[17]!==b?(x=d(`overflow-hidden flex flex-col min-h-0 pt-3 pb-4 px-4 gap-1`,`[&>button]:top-1.5`,y,b),t[16]=y,t[17]=b,t[18]=x):x=t[18];let w;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(w={maxHeight:`90vh`},t[19]=w):w=t[19];let T;t[20]===n.metadata?T=t[21]:(T=n.metadata?.tool?Oe(n.metadata.tool):(0,U.jsx)(h,{name:`tools`,className:`h-3.5 w-3.5 text-foreground flex-shrink-0`}),t[20]=n.metadata,t[21]=T);let E;t[22]===n.title?E=t[23]:(E=(0,U.jsx)(`span`,{className:`break-words flex-1 leading-tight`,children:n.title}),t[22]=n.title,t[23]=E);let D;t[24]!==c||t[25]!==n.isDiff?(D=n.isDiff&&(0,U.jsx)(F,{mode:c,onModeChange:l,className:`mr-8 flex-shrink-0`}),t[24]=c,t[25]=n.isDiff,t[26]=D):D=t[26];let O;t[27]!==D||t[28]!==T||t[29]!==E?(O=(0,U.jsx)(`div`,{className:`flex-shrink-0 pb-1`,children:(0,U.jsxs)(`div`,{className:`flex items-start gap-2 text-foreground typography-ui-header font-semibold`,children:[T,E,D]})}),t[27]=D,t[28]=T,t[29]=E,t[30]=O):O=t[30];let N;t[31]!==f||t[32]!==n.metadata?(N=n.metadata?.input&&typeof n.metadata.input==`object`&&Object.keys(n.metadata.input).length>0&&n.metadata?.tool!==`todowrite`&&n.metadata?.tool!==`todoread`&&n.metadata?.tool!==`apply_patch`?(()=>{let e=n.metadata,t=e.input,r=e=>{let n=t[e];return typeof n==`string`?n:typeof n==`number`?String(n):null};return(0,U.jsxs)(`div`,{className:`border-b border-border/20 p-4 -mx-3`,children:[(0,U.jsx)(`div`,{className:`typography-markdown font-medium text-muted-foreground mb-2 px-3`,children:e.tool===`bash`||e.tool===`shell`?`Command:`:e.tool===`task`||e.tool===`subagent`?`Task Details:`:`Input:`}),(e.tool===`bash`||e.tool===`shell`)&&r(`command`)?(0,U.jsx)(`div`,{className:`tool-input-surface bg-transparent rounded-xl border border-border/20 mx-3`,children:(0,U.jsx)(j,{language:`bash`,code:r(`command`),style:a.getPopupStyles(),codeStyle:ke.style,wrap:!0})}):(e.tool===`task`||e.tool===`subagent`)&&r(`prompt`)?(0,U.jsxs)(`div`,{className:`tool-input-surface bg-transparent rounded-xl border border-border/20 font-mono whitespace-pre-wrap text-foreground/90 mx-3`,style:a.getPopupStyles(),children:[r(`description`)?`Task: ${r(`description`)}\n`:``,r(`subagent_type`)||r(`agent`)?`Agent Type: ${r(`subagent_type`)||r(`agent`)}\n`:``,`Instructions:\n${r(`prompt`)}`]}):e.tool===`write`&&r(`content`)?(0,U.jsx)(`div`,{className:`tool-input-surface bg-transparent rounded-xl border border-border/20 mx-3`,children:(0,U.jsx)(s,{file:{name:r(`filePath`)||r(`file_path`)||`new-file`,contents:r(`content`),lang:C(r(`filePath`)||r(`file_path`)||``)||void 0},options:{disableFileHeader:!0,overflow:`wrap`,theme:f.theme,themeType:f.themeType},className:`block w-full`})}):(0,U.jsx)(`div`,{className:`tool-input-surface bg-transparent rounded-xl border border-border/20 font-mono whitespace-pre-wrap text-foreground/90 mx-3`,style:a.getPopupStyles(),children:R(t,e.tool)})]})})():null,t[31]=f,t[32]=n.metadata,t[33]=N):N=t[33];let L;t[34]!==c||t[35]!==i||t[36]!==f||t[37]!==n||t[38]!==o?(L=n.isDiff?(0,U.jsx)(Ie,{popup:n,diffViewMode:c,pierreThemeConfig:f}):n.content?(0,U.jsx)(`div`,{className:`p-4`,children:(()=>{let e=n.metadata?.tool;return e===`todowrite`||e===`todoread`?I(n.content)||(0,U.jsx)(j,{language:`json`,code:n.content,style:a.getPopupContainerStyles(),codeStyle:ke.style,wrap:!0}):e===`list`?A(n.content)||(0,U.jsx)(`pre`,{className:`typography-markdown bg-muted/30 p-2 rounded-xl border border-border/20 font-mono whitespace-pre-wrap`,children:n.content}):e===`grep`?k(n.content,i)||(0,U.jsx)(`pre`,{className:`typography-code bg-muted/30 p-2 rounded-xl border border-border/20 font-mono whitespace-pre-wrap`,children:n.content}):e===`glob`?ee(n.content,i)||(0,U.jsx)(`pre`,{className:`typography-code bg-muted/30 p-2 rounded-xl border border-border/20 font-mono whitespace-pre-wrap`,children:n.content}):e===`task`||e===`subagent`||e===`reasoning`?(0,U.jsx)(`div`,{className:e===`reasoning`?`text-muted-foreground/70`:``,children:(0,U.jsx)(S,{content:n.content,variant:`tool`})}):e===`web-search`||e===`websearch`||e===`search_web`?P(n.content)||(0,U.jsx)(j,{language:`text`,code:n.content,style:a.getPopupContainerStyles(),codeStyle:ke.style,wrap:!0}):e===`read`?(0,U.jsx)(Le,{popup:n,pierreThemeConfig:f}):(n.content?M(n.content):{data:null,isJson:!1}).isJson?(0,U.jsx)(ae,{jsonString:n.content,initiallyExpandedDepth:3,maxHeight:`70vh`}):(0,U.jsx)(j,{language:n.language||`text`,code:n.content,style:a.getPopupContainerStyles(),codeStyle:ke.style,wrap:!0})})()}):(0,U.jsxs)(`div`,{className:`p-8 text-muted-foreground typography-ui-header`,children:[(0,U.jsx)(`div`,{className:`mb-2`,children:o(`chat.toolOutputDialog.commandCompleted`)}),(0,U.jsx)(`div`,{className:`typography-meta`,children:o(`chat.toolOutputDialog.noOutputProduced`)})]}),t[34]=c,t[35]=i,t[36]=f,t[37]=n,t[38]=o,t[39]=L):L=t[39];let z;t[40]!==N||t[41]!==L?(z=(0,U.jsx)(`div`,{className:`flex-1 min-h-0 rounded-xl border border-border/30 bg-muted/10 overflow-hidden`,children:(0,U.jsxs)(`div`,{className:`tool-output-surface h-full max-h-[75vh] overflow-y-auto px-3 pr-4`,children:[N,L]})}),t[40]=N,t[41]=L,t[42]=z):z=t[42];let B;t[43]!==O||t[44]!==z||t[45]!==x?(B=(0,U.jsxs)(g,{className:x,style:w,children:[O,z]}),t[43]=O,t[44]=z,t[45]=x,t[46]=B):B=t[46];let W;return t[47]!==r||t[48]!==n.open||t[49]!==B?(W=(0,U.jsx)(_,{open:v,onOpenChange:r,children:B}),t[47]=r,t[48]=n.open,t[49]=B,t[50]=W):W=t[50],W};function Be(e){return e.text}function Ve(e){return e.lineNumber!==null}export{ze as default};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/renderMobileApp-DrG8-J7P.js","assets/rolldown-runtime-hePW80VL.js","assets/runtime-auth-BpCQ-dPr.js","assets/runtime-switch-CMiMO5Yj.js","assets/runtime-fetch-WgH0pROs.js","assets/persistence-BKszKaoQ.js","assets/vendor-zustand-o69pgTEK.js","assets/vendor-base-ui-CdzJ6My_.js","assets/useUIStore-CEqU9Ujv.js","assets/vendor-react-BP2cRVqX.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/platform-CgwxwfA4.js","assets/vendor-opencode-client-MF2GBrFx.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/capgoAdapter-KNLHDj7G.js","assets/types-BuiqMmh_.js","assets/vendor-pierre-diffs-DPBtNDJ5.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/vendor-sonner-ZS8XIOVl.js","assets/vendor-reactuses-core-BpfIZ1tg.js","assets/vendor-lodash-es-DfLbG5Af.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/button-CWSs9Baz.js","assets/store-CG7Ytsg9.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/MobileShareBridge-D9esHh6J.js","assets/MobileDetailNavigation-DgCfvpng.js","assets/vendor-tanstack-react-query-CdqCAt40.js","assets/useMobileNavigationStore-CSnG4CUz.js","assets/useAssistantUIStore-OyPm_4M_.js","assets/vendor-zod-Dzk5kdUU.js","assets/vendor-fuse.js-DB5wDJbI.js","assets/Icon-BCFeHDWx.js","assets/rasterizePng-CpK-xCkB.js","assets/AgentAvatar-qLxaEaDh.js","assets/vendor-dicebear-core-CV95S5Pg.js","assets/vendor-dicebear-styles-7lEG-JsF.js","assets/dualLimitLru-D8Sphgua.js","assets/useThemeSystem-8jhE4Zyk.js","assets/dialog-BMa16qrs.js","assets/gitApi-D4E7MHPI.js","assets/useAppFontEffects-Brve5y_3.js","assets/desktopHosts-C0e7Nes2.js","assets/desktopRelayRestore-DckkHKsi.js","assets/vendor-simplewebauthn-browser-Dwhcdg_5.js","assets/projectMeta-Cp7A0mPx.js","assets/input-CALwaZEB.js","assets/tooltip-CV6dvLBp.js","assets/OverlayScrollbar-BY5HaNrb.js","assets/textarea-ClV5sMS-.js","assets/vendor-framer-motion-D-oiwsxL.js","assets/vendor-dnd-kit-core-5pNnzVdw.js","assets/vendor-dnd-kit-accessibility-COSwgjFs.js","assets/vendor-dnd-kit-sortable-Dm50I0m7.js","assets/speechSettingsQueries-CG9u1h1Z.js","assets/dropdown-menu.styles-BNwZmBRp.js","assets/image-loading-Bj11k4gM.js","assets/fileQueries-DVpZC5ha.js","assets/useRuntimeAPIs-Cx8S1HLz.js","assets/relay-image-stream-SV0lH6aG.js","assets/image-loading-CObM4tcX.css","assets/sessionChangeSummary-BH28eSaw.js","assets/LoadingImage-BAT9D9wN.js","assets/ImageLoadingPlaceholder-DEpMJXzV.js","assets/sessionChangeSummary-vC84qM3v.css","assets/insertionBoundaries-fvEQLEE_.js","assets/fileMentionTouchSelection-CWtqJ0pV.js","assets/appThemeRegistry-C0lox0ME.js","assets/MarkdownRenderer-BtVmyJy4.js","assets/markdownHeightCache-DXM_5jTe.js","assets/url-nBOUbtV_.js","assets/markdown-worker-DFNZ3KJ_.js","assets/useEffectiveDirectory-CFr8k_MH.js","assets/FadeInOnReveal-CX8Bkq-l.js","assets/markdownTheme-CV7_0QAL.js","assets/useWorkerHighlightedLines-uJlySvgF.js","assets/vendor-tanstack-react-virtual-B_EO--9t.js","assets/vendor-cmdk-RDxC-9Iz.js","assets/vendor-aria-hidden-BbL3cEyI.js","assets/sortable-tabs-strip-CscHgCaq.js","assets/vendor-motion-88WXBOBf.js","assets/vendor-legendapp-list-CNxU_ALy.js","assets/useFontPreferences-DqEIKMEW.js","assets/terminalApi-rxsMWL0o.js","assets/MobileTabPageHeader-DzTewIJq.js","assets/vendor-codemirror-autocomplete-7c2L_4dM.js","assets/vendor-codemirror-lang-angular-DXOgWEVj.js","assets/vendor-codemirror-lang-json-mLulNbwB.js","assets/vendor-codemirror-lang-markdown-CV1IO6Qs.js","assets/vendor-codemirror-lang-python-YM2WVLHF.js","assets/vendor-codemirror-legacy-modes-DwltVFbT.js","assets/mcpQueries-D-rsCnTq.js","assets/collapsible-ngtoKADo.js","assets/vendor-codemirror-commands-B8KrBQ9B.js","assets/vendor-codemirror-search-ZqtrPLjU.js","assets/vendor-replit-codemirror-vim-DDj0dSVY.js","assets/vendor-codemirror-language-data-Ctd4WxgW.js","assets/projectActions-CWvNGKfA.js","assets/runtimeEndpointReset-Dp74zZAo.js","assets/scheduledTaskNavigation-DQcLqQ52.js","assets/sessionLookup-Ca1342QR.js","assets/vendor-cron-parser-BmO80h0C.js","assets/runtimeEndpointReset-ByXtaeWD.css","assets/SettingsView-ChHvQPP-.js","assets/vendor-yaml-C9KlJAlj.js","assets/vendor-qrcode-D7jBCyl-.js","assets/vendor-dijkstrajs-BAzPDGZM.js","assets/AssistantView-Bn-ie4vz.js","assets/assistant-attachment-cache-B2UAUHUZ.js","assets/src-CcT-GitE.css"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./runtimeConfig-B1lpYz9l.js";import{o as t}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";/* empty css */window.__OPENCHAMBER_RUNTIME_APIS__=e(),t(async()=>{let{renderMobileApp:e}=await import(`./renderMobileApp-DrG8-J7P.js`);return{renderMobileApp:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119])).then(({renderMobileApp:t})=>{t(window.__OPENCHAMBER_RUNTIME_APIS__??e())});
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{it as t,nt as n,rt as r}from"./vendor-base-ui-CdzJ6My_.js";import{n as i}from"./vendor-react-BP2cRVqX.js";import{n as a}from"./vendor-reactuses-core-BpfIZ1tg.js";import{f as o,r as s,t as c}from"./button-CWSs9Baz.js";import{n as l}from"./Icon-BCFeHDWx.js";import{t as u}from"./OverlayScrollbar-BY5HaNrb.js";import{a as d,s as f}from"./vendor-framer-motion-D-oiwsxL.js";var p=e(t(),1),m=i(),h=r(),g=e(n(),1),_=0,v=()=>{_=Date.now()+800},y=()=>Date.now()<_;function b(e){let t=(0,m.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=s(`flex cursor-ns-resize touch-none justify-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)]`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,h.jsx)(`div`,{className:`pointer-events-none h-1.5 w-11 rounded-full bg-[var(--interactive-border)]`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,h.jsx)(`div`,{role:`separator`,tabIndex:0,"aria-orientation":`horizontal`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}var x=100,S=.35;function C(e,t,n){let r=e.at(-1),i=e.at(-2);for(r&&i&&Math.abs(t-r.height)>2&&(t-r.height)*(r.height-i.height)<0&&e.splice(0,e.length-1),e.push({height:t,time:n});e.length>2&&(e.length>16||e[1].time<n-x);)e.shift()}function w(e,t){let n=e.at(-1);if(!n||t-n.time>=x)return 0;let r=e.find(e=>e.time>=t-x);return!r||n.time<=r.time?0:Math.max(-4,Math.min(4,(n.height-r.height)/Math.max(1,t-r.time)))}function T(e,t,n,r,i){let a=Math.abs(r)>=S&&Math.abs(i)>=8,o=n+(a?r*180:0),s=e.reduce((e,t)=>Math.abs(t.height-o)<Math.abs(e.height-o)?t:e),c=e.find(e=>e.id===t)??s;return!a||Math.abs(s.height-c.height)>1?s.id:[...e].sort((e,t)=>r>0?e.height-t.height:t.height-e.height).find(e=>r>0?e.height>c.height+1:e.height<c.height-1)?.id??s.id}function E(e,t,n){let r=e<t?t:e>n?n:e,i=e-r;return r+Math.sign(i)*48*(1-1/(1+Math.abs(i)*.55/48))}function D(e){let t=(0,m.c)(82),{surfaceRef:n,initialPoint:r,getPoints:i,minimumHeight:o,onRelease:s,onCommit:c,renderMode:l}=e,u=l===void 0?`height`:l,[h,g]=(0,p.useState)(r),[_,v]=(0,p.useState)(!1),[y,b]=(0,p.useState)(!1),x=(0,p.useRef)(r),S=(0,p.useRef)(null),D=(0,p.useRef)(null),F=(0,p.useRef)(null),I=(0,p.useRef)(null),L=(0,p.useRef)(!1),R=(0,p.useRef)(null),z;t[0]===n?z=t[1]:(z=()=>{let e=n.current;if(!e)return 0;if(!R.current)return e.getBoundingClientRect().height;let t=parseFloat(getComputedStyle(e).translate.split(` `)[1])||0;return R.current.layoutHeight-t},t[0]=n,t[1]=z);let B=a(z),V;t[2]===n?V=t[3]:(V=e=>{let t=n.current;t&&(R.current?t.style.translate=`0 ${R.current.layoutHeight-e}px`:t.style.height=`${e}px`)},t[2]=n,t[3]=V);let H=a(V),te;t[4]!==u||t[5]!==n||t[6]!==H?(te=(e,t)=>{let r=n.current;if(r){if(u===`translate`&&!R.current){let e=Math.max(...t.map(P))+144,{maxHeight:n,position:i,bottom:a,left:o,right:s}=r.style;R.current={layoutHeight:e,styles:{maxHeight:n,position:i,bottom:a,left:o,right:s}},Object.assign(r.style,{position:`absolute`,bottom:`0px`,left:`0px`,right:`0px`}),r.style.maxHeight=`none`,r.style.height=`${e}px`}r.setAttribute(`data-height-snap-active`,``),r.style.willChange=R.current?`translate`:`height`,H(e)}},t[4]=u,t[5]=n,t[6]=H,t[7]=te):te=t[7];let U=a(te),ne;t[8]===n?ne=t[9]:(ne=()=>{let e=n.current;e&&(R.current&&(e.style.translate=``,Object.assign(e.style,R.current.styles),e.style.height=``),e.style.willChange=``,e.removeAttribute(`data-height-snap-active`)),R.current=null},t[8]=n,t[9]=ne);let W=a(ne),G;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>{D.current!==null&&cancelAnimationFrame(D.current),D.current=null,F.current=null,I.current?.cancel(),I.current=null},t[10]=G):G=t[10];let K=a(G),re;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(re=()=>{let e=S.current;S.current=null,e?.handle.hasPointerCapture?.(e.pointerId)&&e.handle.releasePointerCapture(e.pointerId)},t[11]=re):re=t[11];let q=a(re),ie;t[12]!==K||t[13]!==W||t[14]!==i||t[15]!==c||t[16]!==U||t[17]!==B||t[18]!==q||t[19]!==n||t[20]!==H?(ie=(e,t,r,a)=>{let o=r===void 0||r,s=a===void 0?0:a,l=n.current;if(!l)return;let u=t??B();K(),H(u);let p=i(),m=p.find(t=>t.id===e);if(!m)return;if(U(u,p),q(),v(!1),b(!1),x.current=e,g(e),H(m.height),c?.(e),!o||Math.abs(u-m.height)<1||typeof l.animate!=`function`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){W();return}b(!0);let h=R.current?.layoutHeight,_=m.height-u,y=d([l],h===void 0?{height:[`${u}px`,`${m.height}px`]}:{translate:[`0 ${h-u}px`,`0 ${h-m.height}px`]},{type:f,stiffness:576,damping:48,mass:1,velocity:s*1e3*100/_,restDelta:20/Math.abs(_),restSpeed:500/Math.abs(_)});I.current=y,y.finished.catch(ee).then(()=>{I.current===y&&(I.current=null,W(),b(!1))})},t[12]=K,t[13]=W,t[14]=i,t[15]=c,t[16]=U,t[17]=B,t[18]=q,t[19]=n,t[20]=H,t[21]=ie):ie=t[21];let J=a(ie),ae;t[22]!==K||t[23]!==i||t[24]!==o||t[25]!==U||t[26]!==B||t[27]!==n||t[28]!==H?(ae=e=>{if(S.current||!e.isPrimary||e.pointerType===`mouse`&&e.button!==0||!n.current)return;let t=B();K(),H(t);let r=i();r.length&&(b(!1),S.current={pointerId:e.pointerId,startY:e.clientY,height:t,point:x.current,points:r,handle:e.currentTarget,minimum:o??Math.min(...r.map(N)),maximum:Math.max(...r.map(M)),samples:[{height:t,time:e.timeStamp}]},L.current=!1,U(t,r),v(!0),e.currentTarget.setPointerCapture(e.pointerId),e.preventDefault())},t[22]=K,t[23]=i,t[24]=o,t[25]=U,t[26]=B,t[27]=n,t[28]=H,t[29]=ae):ae=t[29];let oe=a(ae),Y;t[30]!==u||t[31]!==H?(Y=e=>{let t=S.current;if(!t||t.pointerId!==e.pointerId)return;let n=t.startY-e.clientY;Math.abs(n)>3&&(L.current=!0),C(t.samples,t.height+n,e.timeStamp);let r=E(t.height+n,t.minimum,t.maximum);F.current=u===`height`?Math.max(t.minimum,r):r,D.current===null&&(D.current=requestAnimationFrame(()=>{D.current=null,F.current!==null&&H(F.current)})),e.preventDefault()},t[30]=u,t[31]=H,t[32]=Y):Y=t[32];let se=a(Y),ce;t[33]!==K||t[34]!==s||t[35]!==B||t[36]!==q||t[37]!==J||t[38]!==n?(ce=(e,t)=>{let r=S.current;if(!r||r.pointerId!==e.pointerId)return;let i=F.current??B(),a=r.height+r.startY-e.clientY;t||C(r.samples,a,e.timeStamp);let o=t?0:w(r.samples,e.timeStamp);if(q(),!t&&L.current&&s?.(i,o,r.height))K(),v(!1),n.current&&(n.current.style.willChange=``);else{let e=t||!L.current?r.point:T(r.points,r.point,i,o,a-r.height);J(e,i,!0,o)}e.preventDefault()},t[33]=K,t[34]=s,t[35]=B,t[36]=q,t[37]=J,t[38]=n,t[39]=ce):ce=t[39];let X=a(ce),le;t[40]!==i||t[41]!==J?(le=e=>{let t=[...i()].sort(j),n=t.find(e=>e.id===x.current);if(!n)return;let r=e>0?t.find(e=>e.height>n.height+1):t.sort(A).find(e=>e.height<n.height-1);r&&J(r.id)},t[40]=i,t[41]=J,t[42]=le):le=t[42];let Z=a(le),Q;t[43]!==i||t[44]!==J||t[45]!==Z?(Q=()=>{if(L.current){L.current=!1;return}let e=[...i()].sort(k);x.current===e.at(-1)?.id?J(e[0].id):Z(1)},t[43]=i,t[44]=J,t[45]=Z,t[46]=Q):Q=t[46];let $=a(Q),ue;t[47]!==i||t[48]!==$||t[49]!==J||t[50]!==Z?(ue=e=>{if(![`ArrowUp`,`ArrowDown`,`Home`,`End`,`Enter`,` `].includes(e.key))return;e.preventDefault();let t=[...i()].sort(O);t.length&&(e.key===`ArrowUp`?Z(1):e.key===`ArrowDown`?Z(-1):e.key===`Home`?J(t.at(-1).id):e.key===`End`?J(t[0].id):$())},t[47]=i,t[48]=$,t[49]=J,t[50]=Z,t[51]=ue):ue=t[51];let de=a(ue),fe;t[52]!==K||t[53]!==W||t[54]!==r||t[55]!==q||t[56]!==n?(fe=()=>{K(),q(),W(),x.current=r,g(r),v(!1),b(!1),L.current=!1,n.current&&(n.current.style.height=``,n.current.style.willChange=``)},t[52]=K,t[53]=W,t[54]=r,t[55]=q,t[56]=n,t[57]=fe):fe=t[57];let pe=a(fe),me,he;t[58]!==K||t[59]!==W||t[60]!==q?(me=()=>()=>{K(),q(),W()},he=[K,q,W],t[58]=K,t[59]=W,t[60]=q,t[61]=me,t[62]=he):(me=t[61],he=t[62]),(0,p.useLayoutEffect)(me,he);let ge;t[63]===X?ge=t[64]:(ge=e=>X(e,!1),t[63]=X,t[64]=ge);let _e=a(ge),ve;t[65]===X?ve=t[66]:(ve=e=>X(e,!0),t[65]=X,t[66]=ve);let ye=a(ve),be;t[67]===X?be=t[68]:(be=e=>X(e,!0),t[67]=X,t[68]=be);let xe=a(be),Se;return t[69]!==_||t[70]!==$||t[71]!==de||t[72]!==oe||t[73]!==se||t[74]!==pe||t[75]!==J||t[76]!==y||t[77]!==h||t[78]!==_e||t[79]!==ye||t[80]!==xe?(Se={snapPoint:h,dragging:_,settling:y,settleAt:J,reset:pe,handlePointerDown:oe,handlePointerMove:se,handlePointerUp:_e,handlePointerCancel:ye,handleLostPointerCapture:xe,handleClick:$,handleKeyDown:de},t[69]=_,t[70]=$,t[71]=de,t[72]=oe,t[73]=se,t[74]=pe,t[75]=J,t[76]=y,t[77]=h,t[78]=_e,t[79]=ye,t[80]=xe,t[81]=Se):Se=t[81],Se}function O(e,t){return e.height-t.height}function k(e,t){return e.height-t.height}function A(e,t){return t.height-e.height}function j(e,t){return e.height-t.height}function M(e){return e.height}function N(e){return e.height}function ee(){}function P(e){return e.height}var F=.72,I=.98,L=64,R=()=>Math.max(1,window.innerHeight),z=(e,t)=>{let n=Math.max(1,e)*F;return t==null||!Number.isFinite(t)?n:Math.min(n,Math.max(0,t))},B=e=>{let t=(0,m.c)(20),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{initialSnapPoint:r,fitContent:i,onDismiss:o,dismissThresholdPx:s}=n,c=r===void 0?F:r,l=i!==void 0&&i,u=s===void 0?L:s,d=p.useRef(null),f=p.useRef(null),h=p.useRef(c),g=o?0:void 0,_;t[2]===l?_=t[3]:(_=()=>{let e=R(),t=d.current?.parentElement?.clientHeight||e;return l&&h.current===.72&&d.current&&!d.current.hasAttribute(`data-height-snap-active`)&&(f.current=z(e,d.current.getBoundingClientRect().height)),[{id:F,height:Math.min(t,z(e,l?f.current:void 0))},{id:I,height:Math.min(t,e*I)}]},t[2]=l,t[3]=_);let v;t[4]!==u||t[5]!==l||t[6]!==o?(v=(e,t,n)=>{let r=d.current?.parentElement?.clientHeight||R(),i=Math.min(r,z(R(),l?f.current:void 0)),a=t<-.55&&n<=i+1&&e<i-8;return!o||!a&&e>i-u?!1:(o(),!0)},t[4]=u,t[5]=l,t[6]=o,t[7]=v):v=t[7];let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{h.current=e},t[8]=y):y=t[8];let b;t[9]!==c||t[10]!==g||t[11]!==_||t[12]!==v?(b={surfaceRef:d,initialPoint:c,renderMode:`translate`,minimumHeight:g,getPoints:_,onRelease:v,onCommit:y},t[9]=c,t[10]=g,t[11]=_,t[12]=v,t[13]=b):b=t[13];let x=D(b),S;t[14]!==x||t[15]!==c?(S=()=>{f.current=null,h.current=c,x.reset()},t[14]=x,t[15]=c,t[16]=S):S=t[16];let C=a(S),w;return t[17]!==x||t[18]!==C?(w={...x,surfaceRef:d,reset:C},t[17]=x,t[18]=C,t[19]=w):w=t[19],w},V=e=>{let t=(0,m.c)(12),{controller:n,ariaLabel:r}=e,i;t[0]===n.snapPoint?i=t[1]:(i=Math.round(n.snapPoint*100),t[0]=n.snapPoint,t[1]=i);let a;return t[2]!==r||t[3]!==n.handleClick||t[4]!==n.handleKeyDown||t[5]!==n.handleLostPointerCapture||t[6]!==n.handlePointerCancel||t[7]!==n.handlePointerDown||t[8]!==n.handlePointerMove||t[9]!==n.handlePointerUp||t[10]!==i?(a=(0,h.jsx)(b,{"data-mobile-sheet-snap-handle":!0,role:`separator`,tabIndex:0,"aria-label":r,"aria-orientation":`horizontal`,"aria-valuemin":F*100,"aria-valuemax":I*100,"aria-valuenow":i,className:`flex min-h-8 cursor-ns-resize touch-none justify-center pt-2.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)]`,onPointerDown:n.handlePointerDown,onPointerMove:n.handlePointerMove,onPointerUp:n.handlePointerUp,onPointerCancel:n.handlePointerCancel,onLostPointerCapture:n.handleLostPointerCapture,onClick:n.handleClick,onKeyDown:n.handleKeyDown}),t[2]=r,t[3]=n.handleClick,t[4]=n.handleKeyDown,t[5]=n.handleLostPointerCapture,t[6]=n.handlePointerCancel,t[7]=n.handlePointerDown,t[8]=n.handlePointerMove,t[9]=n.handlePointerUp,t[10]=i,t[11]=a):a=t[11],a},H=new WeakMap;function te(e){H.set(e.currentTarget,!0)}function U(e){if(H.delete(e.currentTarget))return!0;if(e.detail!==0)return!1;if(typeof document>`u`)return!0;let t=document.activeElement,n=e.currentTarget;return n instanceof Node&&t instanceof Node&&n.contains(t)}function ne(e){e.target===e.currentTarget&&te(e)}function W(e){return e.target===e.currentTarget&&U(e)}var G=new class{entries=[];listeners=new Set;previousOverflow=null;getSnapshot=()=>this.entries.at(-1)?.id??null;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));add(e,t){return this.entries=[...this.entries.filter(t=>t.id!==e.id),e],this.entries.length===1&&t&&(this.previousOverflow=t.style.overflow,t.style.overflow=`hidden`),this.emit(),()=>this.remove(e.id,t)}remove(e,t){let n=this.entries.length;this.entries=this.entries.filter(t=>t.id!==e),n>0&&this.entries.length===0&&t&&this.previousOverflow!==null&&(t.style.overflow=this.previousOverflow,this.previousOverflow=null),this.emit()}closeTop(){this.entries.at(-1)?.onClose()}emit(){for(let e of this.listeners)e()}},K=(e,t)=>{let n=`flex min-h-0 flex-col bg-background shadow-none`;if(e===`page`)return`${n} h-full w-full`;let r=`${n} pwa-overlay-panel`;return t===`top`?`${r} mx-auto mb-auto max-h-[calc(100dvh-0.75rem)] w-full max-w-lg rounded-b-xl border-x border-b border-border/50`:t===`left`?`${r} h-full w-[min(86vw,24rem)] rounded-r-xl border-r border-y border-border/50`:t===`right`?`${r} ml-auto h-full w-[min(86vw,24rem)] rounded-l-xl border-l border-y border-border/50`:`${r} mx-auto mt-auto max-h-[calc(100dvh-0.75rem)] w-full max-w-lg rounded-t-2xl border-x border-t border-border/50 pb-[max(0.5rem,var(--oc-app-bottom-safe,0px),var(--oc-safe-area-bottom,env(safe-area-inset-bottom,0px)))]`},re=e=>Math.min(1,Math.max(0,Number.isFinite(e)?e:0)),q=(e,t)=>{let n=re(t),r=`${(1-n)*100}%`;return{progress:n,scrimOpacity:n,surfaceOpacity:n,surfaceTransform:e===`left`?`translate3d(-${r}, 0, 0)`:e===`right`?`translate3d(${r}, 0, 0)`:e===`top`?`translate3d(0, -${r}, 0)`:`translate3d(0, ${r}, 0)`}},ie=(e,t)=>{let n=re(t);return e===`present`?n:1-n},J=(e,t)=>e===`present`?+(t===`commit`):t===`commit`?0:1,ae=e=>+!!e,oe=`mobile-sessions`,Y=new Map,se=e=>Y.get(e)??null,ce=(e,t)=>(Y.set(e,t),()=>{Y.get(e)===t&&Y.delete(e)}),X=`.overlay-scrollbar-container`,le=1,Z=e=>e===`left`||e===`right`?`x`:`y`,Q=e=>e===`bottom`||e===`right`?1:-1,$=(e,t,n)=>{let r=Z(e)===`x`?t:n;return Math.max(0,r*Q(e))},ue=(e,t,n,r,i)=>{let a=$(e,t,n),o=Math.abs(Z(e)===`x`?n:t);return Math.hypot(t,n)>r&&a>0&&o<a*i},de=(e,t)=>Math.min(1,Math.max(0,e/Math.max(1,t))),fe=(e,t,n,r)=>Math.min(r,Math.max(n,e*t)),pe=(e,t,n,r,i)=>e>=n||e>=i&&t>=r,me=(e,t,n,r,i)=>t!==0&&n>0?t*i/n:r>80?0:e,he=(e,t,n=le)=>{if(t===`bottom`)return e.scrollTop<=n;if(t===`top`)return e.scrollTop>=e.scrollHeight-e.clientHeight-n;if(e.matches?.(`:dir(rtl)`)){let r=e.scrollWidth-e.clientWidth;return t===`right`?Math.abs(e.scrollLeft)<=n:Math.abs(e.scrollLeft)>=r-n}return t===`right`?e.scrollLeft<=n:e.scrollLeft>=e.scrollWidth-e.clientWidth-n},ge=(e,t)=>{for(let n=0;n<e.length;n+=1){let r=e.item(n);if(r?.identifier===t)return r}return null},_e=(e,t)=>{let n=window.getComputedStyle(e),r=Z(t),i=r===`x`?n.overflowX:n.overflowY,a=r===`x`?e.scrollWidth:e.scrollHeight,o=r===`x`?e.clientWidth:e.clientHeight;return(i===`auto`||i===`scroll`||i===`overlay`)&&a>o},ve=(e,t,n,r)=>{let i=t instanceof Element?t:null,a=i instanceof HTMLElement?i:i?.parentElement??null;for(;a&&e.contains(a);){if(_e(a,n))return a;if(a===e)break;a=a.parentElement}let o=i?.closest(r)??null;return o&&e.contains(o)&&_e(o,n)?o:null},ye=e=>{let t=p.useRef(e),n=p.useRef(null),r=p.useRef(null);return t.current=e,p.useCallback(e=>{if(n.current?.(),n.current=null,!e)return;let i=()=>{let e=r.current;r.current=null,e?.active&&e.controller?.finish(`cancel`)},a=(e,t,n)=>{let r=Z(e.edge)===`x`?t.clientX:t.clientY,i=n-e.lastTime,a=r-e.lastPrimary;e.velocity=me(e.velocity,a,i,n-e.lastVelocityTime,Q(e.edge)),a!==0&&i>0&&(e.lastVelocityTime=n),e.lastPrimary=r,e.lastTime=n,e.distance=$(e.edge,t.clientX-e.startX,t.clientY-e.startY)},o=n=>{i();let a=t.current;if(a.disabled||n.touches.length!==1)return;let o=n.target instanceof Element?n.target:null,s=a.reservedTargetSelector?o?.closest(a.reservedTargetSelector):null;if(s&&e.contains(s)||o?.closest(`input, textarea, select, [contenteditable=""], [contenteditable="true"], [data-mobile-sheet-no-dismiss]`))return;let c=n.touches[0],l=ve(e,n.target,a.edge,a.scrollContainerSelector??X);if(l&&!he(l,a.edge))return;let u=e.getBoundingClientRect(),d=Z(a.edge)===`x`?u.width||window.innerWidth:u.height||window.innerHeight;r.current={edge:a.edge,motionId:a.motionId,touchId:c.identifier,startX:c.clientX,startY:c.clientY,lastPrimary:Z(a.edge)===`x`?c.clientX:c.clientY,lastTime:n.timeStamp,lastVelocityTime:n.timeStamp,velocity:0,distance:0,commitDistance:fe(d,a.commitDistanceRatio??.1,a.minCommitDistance??40,a.maxCommitDistance??64),motionDistance:d,intentDistance:a.intentDistance??8,maxOffAxisRatio:a.maxOffAxisRatio??1,flingVelocity:a.flingVelocity??.65,flingMinDistance:a.flingMinDistance??12,controller:null,active:!1}},s=e=>{let n=r.current;if(!n)return;if(t.current.disabled||e.touches.length!==1){i();return}let o=ge(e.touches,n.touchId);if(!o){i();return}if(a(n,o,e.timeStamp),!n.active){if(Math.hypot(o.clientX-n.startX,o.clientY-n.startY)<=n.intentDistance)return;if(!ue(n.edge,o.clientX-n.startX,o.clientY-n.startY,n.intentDistance,n.maxOffAxisRatio)){r.current=null;return}let e=se(n.motionId);if(!e){r.current=null;return}if(!e.begin(`dismiss`)){r.current=null;return}n.active=!0,n.controller=e}n.controller?.update(de(n.distance,n.motionDistance)),e.preventDefault()},c=e=>{let t=r.current;if(!t)return;let n=ge(e.changedTouches,t.touchId);if(!n){i();return}if(r.current=null,!t.active)return;a(t,n,e.timeStamp),t.controller?.update(de(t.distance,t.motionDistance));let o=pe(t.distance,t.velocity,t.commitDistance,t.flingVelocity,t.flingMinDistance);t.controller?.finish(o?`commit`:`cancel`),e.preventDefault()},l=()=>i();e.addEventListener(`touchstart`,o,{passive:!0,capture:!0}),e.addEventListener(`touchmove`,s,{passive:!1,capture:!0}),e.addEventListener(`touchend`,c,{passive:!1,capture:!0}),e.addEventListener(`touchcancel`,l,{passive:!0,capture:!0}),n.current=()=>{i(),e.removeEventListener(`touchstart`,o,!0),e.removeEventListener(`touchmove`,s,!0),e.removeEventListener(`touchend`,c,!0),e.removeEventListener(`touchcancel`,l,!0)}},[])},be=`mobile-overlay-root`,xe=200,Se=80,Ce=`cubic-bezier(0.32, 0.72, 0, 1)`,we=`a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])`,Te=()=>{if(typeof document>`u`)return null;let e=document.getElementById(be);return e||(e=document.createElement(`div`),e.id=be,document.body.appendChild(e)),e},Ee=()=>typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,De=({id:e,open:t,onOpenChange:n,keepMounted:r=!1,presentation:i=`sheet`,edge:a=`bottom`,children:o,className:c,scrimClassName:l,surfaceClassName:u,surfaceElementRef:d,dismissGesture:f=!1,onExitComplete:m,onPreviewChange:_,ariaLabel:v})=>{let b=p.useRef(null),x=p.useRef(null),S=p.useRef(null),C=p.useRef(t),w=p.useRef(n),T=p.useRef(m),E=p.useRef(_),D=p.useRef(0),O=p.useRef(0),k=p.useRef(null),A=p.useRef([]),j=p.useRef(null),M=p.useRef(`standard`),N=p.useRef(`present`),ee=p.useRef(0),P=p.useRef(!1),F=p.useRef(t),I=p.useRef(!1),L=p.useRef(t),R=p.useRef(null),[z,B]=p.useState(t),[V,H]=p.useState(t),[te,U]=p.useState(`standard`),[re,oe]=p.useState(!1),Y=te===`interactive-present`,se=p.useSyncExternalStore(G.subscribe,G.getSnapshot,G.getSnapshot),X=V&&!Y&&se===e,le=ye({motionId:e,edge:a,disabled:!f,...typeof f==`object`?f:{}}),Z=p.useCallback(e=>{S.current=e,le(e),typeof d==`function`?d(e):d&&typeof d==`object`&&(d.current=e)},[le,d]),Q=p.useCallback(()=>{L.current&&(L.current=!1,H(!1),r||B(!1),T.current?.())},[r]);C.current=t,w.current=n,T.current=m,E.current=_,p.useLayoutEffect(()=>{E.current?.(V&&Y)},[V,Y]),typeof document<`u`&&!b.current&&(b.current=Te());let $=p.useCallback(e=>{let t=q(a,e);D.current=t.progress,!(!x.current||!S.current)&&(x.current.style.opacity=String(t.scrimOpacity),S.current.style.transform=t.surfaceTransform,S.current.style.opacity=String(t.surfaceOpacity))},[a]),ue=p.useCallback(()=>{k.current!==null&&window.cancelAnimationFrame(k.current),k.current=null},[]),de=p.useCallback(()=>{x.current&&(x.current.style.willChange=``),S.current&&(S.current.style.willChange=``)},[]),fe=p.useCallback((e=A.current)=>{for(let t of e)t.cancel();A.current=[]},[]),pe=p.useCallback(()=>{ue();let e=j.current;if(e){let t=e.animations[1]?.effect?.getComputedTiming().progress;$(typeof t==`number`&&Number.isFinite(t)?e.from+(e.target-e.from)*t:D.current),fe(e.animations),j.current=null}else fe();de(),oe(!1)},[$,fe,ue,de]),me=p.useCallback((e,t)=>{if(j.current?.target===e)return;pe();let n=D.current,r=x.current,i=S.current;if(oe(!0),!r||!i||Ee()||n===e){$(e),de(),oe(!1),t?.();return}let o=q(a,n),s=q(a,e);r.style.willChange=`opacity`,i.style.willChange=`transform, opacity`;let c=Math.max(Se,xe*Math.abs(e-n)),l=[r.animate([{opacity:o.scrimOpacity},{opacity:s.scrimOpacity}],{duration:c,easing:Ce,fill:`forwards`}),i.animate([{transform:o.surfaceTransform,opacity:o.surfaceOpacity},{transform:s.surfaceTransform,opacity:s.surfaceOpacity}],{duration:c,easing:Ce,fill:`forwards`})];A.current=l;let u={from:n,target:e,animations:l};j.current=u,Promise.all(l.map(e=>e.finished.catch(()=>void 0))).then(()=>{j.current===u&&($(e),fe(l),j.current=null,de(),oe(!1),t?.())})},[$,fe,de,a,pe]);if(p.useLayoutEffect(()=>{I.current=z,z&&$(O.current)},[$,z]),p.useLayoutEffect(()=>{L.current=V},[V]),p.useEffect(()=>{t&&!I.current&&(O.current=D.current,B(!0)),t&&!L.current&&(L.current=!0,H(!0)),I.current&&M.current===`standard`&&me(ae(t),()=>{!C.current&&M.current===`standard`&&Q()})},[Q,t,me]),p.useLayoutEffect(()=>{!z||M.current!==`standard`||me(+!!t,()=>{!C.current&&M.current===`standard`&&Q()})},[Q,z,t,me]),p.useEffect(()=>{if(!(!V||Y))return window.dispatchEvent(new Event(`oc:mobile-overlay-opened`)),()=>{window.dispatchEvent(new Event(`oc:mobile-overlay-closed`))}},[V,Y]),p.useEffect(()=>{if(!(!V||Y))return G.add({id:e,onClose:()=>w.current(!1)},document.body)},[V,e,Y]),p.useEffect(()=>{if(!V||Y||!X)return;let e=S.current,t=document.activeElement instanceof HTMLElement?document.activeElement:null;e?.focus({preventScroll:!0});let n=t=>{if(t.key===`Escape`&&G.closeTop(),t.key!==`Tab`||!e)return;let n=Array.from(e.querySelectorAll(we)).filter(e=>!e.closest(`[data-mobile-sheet-snap-handle]`)),r=n[0]??e,i=n.at(-1)??e;t.shiftKey&&document.activeElement===r&&(t.preventDefault(),i.focus({preventScroll:!0})),!t.shiftKey&&document.activeElement===i&&(t.preventDefault(),r.focus({preventScroll:!0}))};return document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`keydown`,n),y()||t?.focus({preventScroll:!0})}},[V,Y,X]),R.current={begin:e=>{if(e===`dismiss`&&(!L.current||M.current===`interactive-present`))return!1;pe(),ee.current+=1,P.current=!0,N.current=e;let t=e===`present`?`interactive-present`:`interactive-dismiss`;return M.current=t,U(t),oe(!0),e===`present`&&(O.current=D.current,L.current=!0,H(!0),B(!0)),!0},update:e=>{P.current&&(O.current=ie(N.current,e),k.current===null&&(k.current=window.requestAnimationFrame(()=>{k.current=null,P.current&&$(O.current)})))},finish:e=>{if(!P.current)return;P.current=!1;let t=ee.current,n=N.current,r=J(n,e);k.current!==null&&(ue(),$(O.current)),me(r,()=>{t===ee.current&&(e===`commit`&&w.current(n===`present`),n===`present`&&e===`cancel`&&!C.current&&Q(),M.current=`standard`,U(`standard`),r===0&&Q())})},interrupt:()=>{ee.current+=1,P.current=!1;let e=M.current===`interactive-present`&&!C.current;e||(M.current=`standard`,U(`standard`)),pe(),me(ae(C.current),()=>{C.current||Q(),e&&(M.current=`standard`,U(`standard`))})}},p.useLayoutEffect(()=>{let e=F.current;F.current=t,e&&!t&&M.current!==`standard`&&R.current?.interrupt()},[t]),p.useEffect(()=>{let t=ce(e,{begin:e=>R.current?.begin(e)??!1,update:e=>R.current?.update(e),finish:e=>R.current?.finish(e),interrupt:()=>R.current?.interrupt()});return()=>{t(),ue(),fe(),j.current=null,de(),R.current=null}},[fe,ue,de,e]),!z||!b.current)return null;let he=(0,h.jsx)(`div`,{ref:x,className:s(`oc-mobile-window-motion oc-keyboard-inset-surface fixed inset-0 z-[60] flex flex-col bg-[rgb(0_0_0_/_0.45)]`,re&&`oc-mobile-window-motion-active`,!V&&!Y&&`pointer-events-none invisible`,l,c),"data-mobile-overlay-active":String(V),role:Y?void 0:`dialog`,"aria-label":Y?void 0:v,"aria-modal":V&&X?`true`:void 0,"aria-hidden":Y||!V||!X||void 0,inert:Y||!V||!X||void 0,onPointerDown:ne,onClick:e=>{!V||Y||!X||W(e)&&w.current(!1)},children:(0,h.jsx)(`div`,{ref:Z,tabIndex:-1,className:s(`oc-mobile-floating-shell`,K(i,a),u),"data-oc-motion-id":e,style:{contain:`layout paint style`},onClick:e=>e.stopPropagation(),children:o})});return(0,g.createPortal)(he,b.current)},Oe=p.createContext(null),ke=e=>{let t=(0,m.c)(5),{children:n}=e,r=p.useContext(Oe);if(!r)return null;let i;t[0]===n?i=t[1]:(i=(0,h.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,g.createPortal)(i,r),t[2]=r,t[3]=i,t[4]=a):a=t[4],a},Ae=e=>{let t=(0,m.c)(46),{id:n,open:r,onOpenChange:i,title:a,leading:o,trailing:u,ariaLabel:d,closeAriaLabel:f,resizeAriaLabel:g,initiallyExpanded:_,fitContent:v,bodyClassName:y,children:b}=e,x=_!==void 0&&_,S=v!==void 0&&v,C=x?I:void 0,w;t[0]!==i||t[1]!==r?(w=r?()=>i(!1):void 0,t[0]=i,t[1]=r,t[2]=w):w=t[2];let T;t[3]!==S||t[4]!==C||t[5]!==w?(T={initialSnapPoint:C,fitContent:S,onDismiss:w},t[3]=S,t[4]=C,t[5]=w,t[6]=T):T=t[6];let E=B(T),[D,O]=p.useState(null),k=a!=null||o!=null||u!=null,A=E.snapPoint===I,j=A||!S,M;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(M={reservedTargetSelector:`[data-mobile-sheet-snap-handle]`},t[7]=M):M=t[7];let N=A?`h-[98dvh] max-h-[98dvh]`:S?`h-auto max-h-[72dvh]`:`h-[72dvh] max-h-[98dvh]`,ee=E.surfaceRef,P=E.reset,F=j&&`flex-1`,L;t[8]===F?L=t[9]:(L=s(`flex min-h-0 flex-col`,F),t[8]=F,t[9]=L);let R;t[10]!==g||t[11]!==E?(R=(0,h.jsx)(V,{controller:E,ariaLabel:g}),t[10]=g,t[11]=E,t[12]=R):R=t[12];let z;t[13]!==f||t[14]!==S||t[15]!==k||t[16]!==o||t[17]!==i||t[18]!==a||t[19]!==u?(z=k?(0,h.jsxs)(`div`,{className:S?`flex min-h-9 items-center gap-2 px-4 pb-1`:`flex min-h-10 items-center gap-2 px-4 pb-2`,children:[o?(0,h.jsx)(`div`,{className:`flex shrink-0 items-center`,children:o}):null,(0,h.jsx)(`div`,{className:`min-w-0 flex-1`,children:a}),u?(0,h.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:u}):null,(0,h.jsx)(`div`,{ref:O,className:`contents`}),(0,h.jsx)(c,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>i(!1),"aria-label":f,className:`shrink-0 text-muted-foreground`,style:{touchAction:`manipulation`},children:(0,h.jsx)(l,{name:`close`,className:`size-5`})})]}):null,t[13]=f,t[14]=S,t[15]=k,t[16]=o,t[17]=i,t[18]=a,t[19]=u,t[20]=z):z=t[20];let H;t[21]!==R||t[22]!==z?(H=(0,h.jsxs)(`div`,{className:`shrink-0`,children:[R,z]}),t[21]=R,t[22]=z,t[23]=H):H=t[23];let te=j&&`flex-1`,U;t[24]!==y||t[25]!==te?(U=s(`flex min-h-0 flex-col overflow-hidden`,te,y),t[24]=y,t[25]=te,t[26]=U):U=t[26];let ne;t[27]!==b||t[28]!==U?(ne=(0,h.jsx)(`div`,{className:U,"data-page-scroll-lock":`true`,children:b}),t[27]=b,t[28]=U,t[29]=ne):ne=t[29];let W;t[30]!==L||t[31]!==H||t[32]!==ne?(W=(0,h.jsxs)(`div`,{className:L,children:[H,ne]}),t[30]=L,t[31]=H,t[32]=ne,t[33]=W):W=t[33];let G;t[34]!==d||t[35]!==n||t[36]!==i||t[37]!==r||t[38]!==E.reset||t[39]!==E.surfaceRef||t[40]!==W||t[41]!==N?(G=(0,h.jsx)(De,{id:n,open:r,onOpenChange:i,presentation:`sheet`,edge:`bottom`,dismissGesture:M,ariaLabel:d,surfaceClassName:N,surfaceElementRef:ee,onExitComplete:P,children:W}),t[34]=d,t[35]=n,t[36]=i,t[37]=r,t[38]=E.reset,t[39]=E.surfaceRef,t[40]=W,t[41]=N,t[42]=G):G=t[42];let K;return t[43]!==D||t[44]!==G?(K=(0,h.jsx)(Oe.Provider,{value:D,children:G}),t[43]=D,t[44]=G,t[45]=K):K=t[45],K};function je(e,t){let n=(0,m.c)(3),r;return n[0]!==e||n[1]!==t?(r=n=>{[e,t].forEach(e=>{typeof e==`function`?e(n):e&&typeof e==`object`&&(e.current=n)})},n[0]=e,n[1]=t,n[2]=r):r=n[2],r}var Me=p.forwardRef((e,t)=>{let n=(0,m.c)(28),{as:r,orientation:i,offset:a,size:o,isEnabled:s,hideTopShadow:c,hideBottomShadow:l,observeMutations:u,onVisibilityChange:d,style:f,className:g,children:_,...v}=e,y=r===void 0?`div`:r,b=i===void 0?`vertical`:i,x=a===void 0?0:a,S=o===void 0?48:o,C=s===void 0||s,w=c!==void 0&&c,T=l!==void 0&&l,E=u===void 0||u,D=p.useRef(null),O=p.useRef(`none`),k=v[`data-scroll-shadow`];delete v[`data-scroll-shadow`];let A=f,j;n[0]!==S||n[1]!==A?(j={...A},j[`--scroll-shadow-size`]=`${S}px`,n[0]=S,n[1]=A,n[2]=j):j=n[2];let M=j,N=Ne,ee=Pe,P;n[3]!==T||n[4]!==w||n[5]!==C||n[6]!==x||n[7]!==d||n[8]!==b?(P=()=>{let e=D.current;if(!e)return;if(!C){ee(e),O.current!==`none`&&(O.current=`none`,d?.(`none`));return}let t=b===`vertical`?e.scrollTop>x+1:e.scrollLeft>x+1,n=b===`vertical`?e.scrollHeight-(e.scrollTop+e.clientHeight)>x+1:e.scrollWidth-(e.scrollLeft+e.clientWidth)>x+1,r=w&&b===`vertical`?!1:t;T&&b===`vertical`&&(n=!1),N(e,r,n,b===`vertical`?`top`:`left`,b===`vertical`?`bottom`:`right`);let i=r&&n?`both`:r?b===`vertical`?`top`:`left`:n?b===`vertical`?`bottom`:`right`:`none`;i!==O.current&&(O.current=i,d?.(i))},n[3]=T,n[4]=w,n[5]=C,n[6]=x,n[7]=d,n[8]=b,n[9]=P):P=n[9];let F=P,I,L;n[10]!==F||n[11]!==C?(I=()=>{C||F()},L=[F,C],n[10]=F,n[11]=C,n[12]=I,n[13]=L):(I=n[12],L=n[13]),p.useLayoutEffect(I,L);let R,z;n[14]!==F||n[15]!==C||n[16]!==E?(R=()=>{let e=D.current;if(!e||!C)return;let t=null,n=()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,F()}))},r=n,i=typeof ResizeObserver<`u`?new ResizeObserver(n):null,a=E&&typeof MutationObserver<`u`?new MutationObserver(n):null;return F(),e.addEventListener(`scroll`,r,{passive:!0}),i?.observe(e),a?.observe(e,{childList:!0,subtree:!0,characterData:!0}),()=>{t!==null&&cancelAnimationFrame(t),e.removeEventListener(`scroll`,r),i?.disconnect(),a?.disconnect()}},z=[F,C,E],n[14]=F,n[15]=C,n[16]=E,n[17]=R,n[18]=z):(R=n[17],z=n[18]),p.useEffect(R,z);let B=je(D,t),V=k??!0,H;return n[19]!==y||n[20]!==_||n[21]!==g||n[22]!==B||n[23]!==M||n[24]!==b||n[25]!==v||n[26]!==V?(H=(0,h.jsx)(y,{...v,ref:B,className:g,"data-orientation":b,"data-scroll-shadow":V,style:M,children:_}),n[19]=y,n[20]=_,n[21]=g,n[22]=B,n[23]=M,n[24]=b,n[25]=v,n[26]=V,n[27]=H):H=n[27],H});Me.displayName=`ScrollShadow`;function Ne(e,t,n,r,i){let a=`${r}${i.charAt(0).toUpperCase()}${i.slice(1)}Scroll`;t&&n?(e.dataset[a]=`true`,e.removeAttribute(`data-${r}-scroll`),e.removeAttribute(`data-${i}-scroll`)):(e.dataset[`${r}Scroll`]=String(t),e.dataset[`${i}Scroll`]=String(n),e.removeAttribute(`data-${r}-${i}-scroll`))}function Pe(e){[`top`,`bottom`,`top-bottom`,`left`,`right`,`left-right`].forEach(t=>{e.removeAttribute(`data-${t}-scroll`)})}var Fe=p.forwardRef((e,t)=>{let n=(0,m.c)(45),r,i,a,o,c,l,d,f,g,_,v,y,b,x,S,C;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],c=n[5],l=n[6],d=n[7],f=n[8],g=n[9],_=n[10],v=n[11],y=n[12],b=n[13],x=n[14],S=n[15],C=n[16]):({className:i,outerClassName:c,children:r,style:g,minThumbSize:o,hideDelayMs:a,as:_,scrollbarClassName:f,disableHorizontal:v,observeMutations:y,fillContainer:b,preventOverscroll:x,useScrollShadow:S,scrollShadowSize:d,userIntentOnly:C,...l}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=c,n[6]=l,n[7]=d,n[8]=f,n[9]=g,n[10]=_,n[11]=v,n[12]=y,n[13]=b,n[14]=x,n[15]=S,n[16]=C);let w=_===void 0?`div`:_,T=v!==void 0&&v,E=y===void 0||y,D=b===void 0||b,O=x!==void 0&&x,k=S!==void 0&&S,A=C!==void 0&&C,j=p.useRef(null),M,N;n[17]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>j.current,N=[],n[17]=M,n[18]=N):(M=n[17],N=n[18]),p.useImperativeHandle(t,M,N);let ee=O&&`overscroll-none`,P;n[19]!==c||n[20]!==ee?(P=s(`relative flex flex-col min-h-0 w-full overflow-hidden`,ee,c),n[19]=c,n[20]=ee,n[21]=P):P=n[21];let F;n[22]!==w||n[23]!==r||n[24]!==i||n[25]!==T||n[26]!==D||n[27]!==E||n[28]!==O||n[29]!==l||n[30]!==d||n[31]!==g||n[32]!==k?(F=k?(0,h.jsx)(Me,{as:w,ref:j,size:d,className:s(`overlay-scrollbar-target overlay-scrollbar-container`,O&&`overscroll-none`,D?`flex-1 min-h-0 w-full`:`flex-none w-full h-auto`,T?`overflow-y-auto overflow-x-hidden`:`overflow-auto`,i),style:g,observeMutations:E,...l,children:r}):(0,h.jsx)(w,{ref:j,className:s(`overlay-scrollbar-target overlay-scrollbar-container`,O&&`overscroll-none`,D?`flex-1 min-h-0 w-full`:`flex-none w-full h-auto`,T?`overflow-y-auto overflow-x-hidden`:`overflow-auto`,i),style:g,...l,children:r}),n[22]=w,n[23]=r,n[24]=i,n[25]=T,n[26]=D,n[27]=E,n[28]=O,n[29]=l,n[30]=d,n[31]=g,n[32]=k,n[33]=F):F=n[33];let I;n[34]!==T||n[35]!==a||n[36]!==o||n[37]!==E||n[38]!==f||n[39]!==A?(I=(0,h.jsx)(u,{containerRef:j,minThumbSize:o,hideDelayMs:a,className:f,disableHorizontal:T,observeMutations:E,userIntentOnly:A}),n[34]=T,n[35]=a,n[36]=o,n[37]=E,n[38]=f,n[39]=A,n[40]=I):I=n[40];let L;return n[41]!==P||n[42]!==F||n[43]!==I?(L=(0,h.jsxs)(`div`,{className:P,children:[F,I]}),n[41]=P,n[42]=F,n[43]=I,n[44]=L):L=n[44],L});Fe.displayName=`ScrollableOverlay`;function Ie(e){let t=(0,m.c)(4),{onResizeStart:n,ariaLabel:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,h.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":!0,children:(0,h.jsx)(`path`,{d:`M9.11111 2L2 9.11111M10 6.44444L6.44444 10`,className:`stroke-muted-foreground`,strokeLinecap:`round`})}),t[0]=i):i=t[0];let a;return t[1]!==r||t[2]!==n?(a=(0,h.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":r,onPointerDown:n,className:`pointer-events-auto -m-2 flex size-7 cursor-ns-resize items-end justify-end p-2 touch-none select-none`,children:i}),t[1]=r,t[2]=n,t[3]=a):a=t[3],a}var Le=p.forwardRef((e,t)=>{let n=(0,m.c)(64),r,i,a,c,l,u,d,f,g,_,v,y,b,x;n[0]===e?(r=n[1],i=n[2],a=n[3],c=n[4],l=n[5],u=n[6],d=n[7],f=n[8],g=n[9],_=n[10],v=n[11],y=n[12],b=n[13],x=n[14]):({className:r,outerClassName:d,scrollbarClassName:_,fillContainer:y,useScrollShadow:b,scrollShadowSize:g,hasError:l,resizedHeight:i,onResizeHeightChange:u,disabled:a,simple:v,embedded:x,endSlot:c,...f}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=c,n[5]=l,n[6]=u,n[7]=d,n[8]=f,n[9]=g,n[10]=_,n[11]=v,n[12]=y,n[13]=b,n[14]=x);let S=y!==void 0&&y,C=b!==void 0&&b,w=x!==void 0&&x,{t:T}=o(),E=p.useRef(null),D=p.useRef(null),[O,k]=p.useState(null),A=i??O,j;n[15]===u?j=n[16]:(j=e=>{let t=E.current;if(!t)return;D.current={startY:e.clientY,startHeight:t.getBoundingClientRect().height};let n=e.currentTarget;n.setPointerCapture(e.pointerId);let r=e=>{let t=D.current;if(!t)return;let n=t.startHeight+(e.clientY-t.startY),r=Math.max(82,n);u?u(r):k(r)},i=()=>{D.current=null,n.removeEventListener(`pointermove`,r),n.removeEventListener(`pointerup`,i),n.removeEventListener(`pointercancel`,i)};n.addEventListener(`pointermove`,r),n.addEventListener(`pointerup`,i),n.addEventListener(`pointercancel`,i),e.preventDefault()},n[15]=u,n[16]=j);let M=j,N;n[17]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{if(e.target.closest(`textarea, button, [role="separator"]`))return;let t=E.current?.querySelector(`textarea`);t&&document.activeElement!==t&&(e.preventDefault(),t.focus())},n[17]=N):N=n[17];let ee=N;if(v){let e=t,i=S?`[field-sizing:fixed]`:`field-sizing-content`,o;n[18]!==r||n[19]!==i?(o=s(`block w-full appearance-none resize-none bg-transparent text-foreground typography-markdown outline-none`,`px-3 py-2 md:typography-ui-label`,`placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50`,i,r),n[18]=r,n[19]=i,n[20]=o):o=n[20];let c;return n[21]!==a||n[22]!==S||n[23]!==d||n[24]!==f||n[25]!==g||n[26]!==_||n[27]!==e||n[28]!==o||n[29]!==C?(c=(0,h.jsx)(Fe,{as:`textarea`,ref:e,disableHorizontal:!0,fillContainer:S,useScrollShadow:C,scrollShadowSize:g,outerClassName:d,scrollbarClassName:_,className:o,spellCheck:!1,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,disabled:a,...f}),n[21]=a,n[22]=S,n[23]=d,n[24]=f,n[25]=g,n[26]=_,n[27]=e,n[28]=o,n[29]=C,n[30]=c):c=n[30],c}let P;n[31]===A?P=n[32]:(P=A===null?void 0:{height:`${A}px`},n[31]=A,n[32]=P);let F;if(n[33]!==w||n[34]!==l||n[35]!==d){let e;n[37]===l?e=n[38]:(e=l&&[`ring-[var(--status-error)]`,`focus-within:ring-2 focus-within:ring-[var(--status-error)]`],n[37]=l,n[38]=e);let t;n[39]===w?t=n[40]:(t=w&&[`rounded-none bg-transparent ring-0`,`hover:[&:not(:focus-within)]:bg-transparent`,`has-[[disabled]]:bg-transparent`],n[39]=w,n[40]=t),F=s(`group/textarea relative flex w-full flex-col rounded-[var(--radius-xl)] bg-[var(--surface-elevated)] pb-2.5`,`ring-1 ring-inset ring-border/60 transition duration-200 ease-out`,`hover:[&:not(:focus-within)]:bg-[var(--surface-subtle)]`,`has-[[disabled]]:pointer-events-none has-[[disabled]]:bg-[var(--surface-subtle)] has-[[disabled]]:ring-transparent`,!l&&[`hover:[&:not(:focus-within)]:ring-transparent`,`focus-within:ring-2 focus-within:ring-[var(--interactive-focus-ring)]`],e,t,d),n[33]=w,n[34]=l,n[35]=d,n[36]=F}else F=n[36];let I;n[41]!==r||n[42]!==a?(I=s(`block w-full flex-1 min-h-0 appearance-none resize-none bg-transparent text-foreground typography-markdown outline-none`,`min-h-[82px] pl-3 pr-2.5 pt-2.5 md:typography-ui-label`,`focus-visible:outline-none disabled:cursor-not-allowed`,!a&&[`placeholder:select-none placeholder:text-muted-foreground placeholder:transition placeholder:duration-200 placeholder:ease-out`,`group-hover/textarea:placeholder:text-foreground/80`,`focus:placeholder:text-foreground/80`],a&&`text-muted-foreground/60 placeholder:text-muted-foreground/60`,r),n[41]=r,n[42]=a,n[43]=I):I=n[43];let L;n[44]!==a||n[45]!==f||n[46]!==t||n[47]!==I?(L=(0,h.jsx)(`textarea`,{ref:t,className:I,spellCheck:!1,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,disabled:a,...f}),n[44]=a,n[45]=f,n[46]=t,n[47]=I,n[48]=L):L=n[48];let R;n[49]===T?R=n[50]:(R=T(`textarea.resizeHandleAria`),n[49]=T,n[50]=R);let z;n[51]!==M||n[52]!==R?(z=(0,h.jsx)(Ie,{onResizeStart:M,ariaLabel:R}),n[51]=M,n[52]=R,n[53]=z):z=n[53];let B;n[54]!==c||n[55]!==z?(B=(0,h.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5 pl-3 pr-2.5`,children:[c,z]}),n[54]=c,n[55]=z,n[56]=B):B=n[56];let V;n[57]!==B||n[58]!==L?(V=(0,h.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col gap-2`,children:[L,B]}),n[57]=B,n[58]=L,n[59]=V):V=n[59];let H;return n[60]!==V||n[61]!==P||n[62]!==F?(H=(0,h.jsx)(`div`,{ref:E,onPointerDown:ee,style:P,className:F,children:V}),n[60]=V,n[61]=P,n[62]=F,n[63]=H):H=n[63],H});Le.displayName=`Textarea`;export{b as C,D as S,v as T,ne as _,ke as a,I as b,$ as c,ue as d,pe as f,te as g,U as h,Ae as i,de as l,se as m,Fe as n,De as o,oe as p,Me as r,fe as s,Le as t,me as u,W as v,y as w,B as x,V as y};