@openchambery/web 2.1.10-beta.10 → 2.1.10-beta.11

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 (57) hide show
  1. package/dist/assets/AssistantView-h4JgDKch.js +3 -0
  2. package/dist/assets/{DiagramView-CD0JRf9L.js → DiagramView-COkfppid.js} +1 -1
  3. package/dist/assets/{ImageLoadingPlaceholder-Da1xKjxc.js → ImageLoadingPlaceholder-BH8oXC-W.js} +1 -1
  4. package/dist/assets/{LoadingImage-DO_V7mRh.js → LoadingImage-BiQ8G0W3.js} +1 -1
  5. package/dist/assets/MarkdownRenderer-BI0rNBtw.js +2 -0
  6. package/dist/assets/{MarkdownRendererImpl-BwBPrsxq.js → MarkdownRendererImpl-BLyOCqTz.js} +1 -1
  7. package/dist/assets/{MarkstreamRendererImpl-BeCY-mui.js → MarkstreamRendererImpl-Do60i4aN.js} +1 -1
  8. package/dist/assets/{MobileDetailNavigation-tDiUj5U0.js → MobileDetailNavigation-CH1olmS8.js} +1 -1
  9. package/dist/assets/{MobileShareBridge-iApPj95w.js → MobileShareBridge-D4PDUXQS.js} +2 -2
  10. package/dist/assets/{MobileTabPageHeader-DOpvXyuR.js → MobileTabPageHeader-B4l8kjn4.js} +1 -1
  11. package/dist/assets/{MultiRunWindow-CAzMa1Nm.js → MultiRunWindow-CPEzqHIB.js} +1 -1
  12. package/dist/assets/{SettingsView-BSKkzr8d.js → SettingsView-BnlqCPxN.js} +1 -1
  13. package/dist/assets/{SettingsWindow-BGmZ-fkc.js → SettingsWindow-BgSOpeEz.js} +1 -1
  14. package/dist/assets/{TerminalView-BnHTLMST.js → TerminalView-CZtA47Sq.js} +1 -1
  15. package/dist/assets/{ToolOutputDialog-DAVZmdoA.css → ToolOutputDialog-BgjZ_2_o.css} +1 -1
  16. package/dist/assets/ToolOutputDialog-DjKdgCBP.js +10 -0
  17. package/dist/assets/{appThemeRegistry-w-Ebbmh5.js → appThemeRegistry-BIjwa_wL.js} +1 -1
  18. package/dist/assets/{assistant-attachment-cache-CecNXB7z.js → assistant-attachment-cache-C-JB3e_-.js} +1 -1
  19. package/dist/assets/{fileMentionTouchSelection-CtLKSOq0.js → fileMentionTouchSelection-DFsw2Air.js} +1 -1
  20. package/dist/assets/{gitApi-D3JDHCiI.js → gitApi-CmIIjInT.js} +1 -1
  21. package/dist/assets/{image-loading-DImQz00b.js → image-loading-BLKPYB1F.js} +1 -1
  22. package/dist/assets/{insertionBoundaries-JP72UEgW.js → insertionBoundaries-BRzI9-zA.js} +1 -1
  23. package/dist/assets/main-B18HaTNc.js +169 -0
  24. package/dist/assets/{main-BnRW5v-z.js → main-DyI3Npnd.js} +2 -2
  25. package/dist/assets/{mcpQueries-B__Ge5kV.js → mcpQueries-ylwK_h6F.js} +1 -1
  26. package/dist/assets/{miniChat-DGxEvelP.js → miniChat-_Ap6jcID.js} +2 -2
  27. package/dist/assets/{mobile-eGR6pZsC.js → mobile-D-4NtQFc.js} +2 -2
  28. package/dist/assets/{mobileBackNavigation-CGH0aRvP.js → mobileBackNavigation-mSj0hnU6.js} +1 -1
  29. package/dist/assets/{multirun-D0s4kPUs.js → multirun-DCBP8mIS.js} +1 -1
  30. package/dist/assets/{projectMeta-DPvDDfM0.js → projectMeta-DRVg_EU7.js} +1 -1
  31. package/dist/assets/relay-image-stream-B05lazQn.js +2 -0
  32. package/dist/assets/{renderElectronMiniChatApp-DoJOOOvp.js → renderElectronMiniChatApp-DsMQnVs5.js} +2 -2
  33. package/dist/assets/{renderMobileApp-D8ARkO58.js → renderMobileApp-OVPO-Ol5.js} +4 -4
  34. package/dist/assets/{runtimeConfig-D0fGrt74.js → runtimeConfig-BQKJNTNq.js} +1 -1
  35. package/dist/assets/{runtimeEndpointReset-asSGzNnU.js → runtimeEndpointReset-KlafK5Te.js} +1 -1
  36. package/dist/assets/sessionChangeSummary-BW__1utJ.js +1 -0
  37. package/dist/assets/{sessionLookup-CZWffaVD.js → sessionLookup-CuUmBpTW.js} +1 -1
  38. package/dist/assets/{speechSettingsQueries-D9HkL9-8.js → speechSettingsQueries-CQnnDLiJ.js} +2 -2
  39. package/dist/assets/src-DtMCDy_d.css +2 -0
  40. package/dist/assets/{useAppFontEffects-CN_sjO4l.js → useAppFontEffects-_ks0w1bd.js} +53 -53
  41. package/dist/assets/{useDesktopWindowControlsLayout-QxfqckBX.js → useDesktopWindowControlsLayout-DXQVvdHD.js} +1 -1
  42. package/dist/assets/{useEffectiveDirectory-DXbRKe4_.js → useEffectiveDirectory-CCu_lDxO.js} +1 -1
  43. package/dist/assets/{useMobileNavigationStore-BvJJ9SP1.js → useMobileNavigationStore-DzAYtvXh.js} +3 -3
  44. package/dist/assets/{useWorkerHighlightedLines-hl5s_wXd.js → useWorkerHighlightedLines-cWzxInp-.js} +1 -1
  45. package/dist/index.html +3 -3
  46. package/dist/mini-chat.html +3 -3
  47. package/dist/mobile.html +3 -3
  48. package/package.json +1 -1
  49. package/server/lib/relay/relay-server.e2e.test.ts +8 -0
  50. package/dist/assets/AssistantView-CPPxqPo7.js +0 -3
  51. package/dist/assets/MarkdownRenderer-BZZFoaPb.js +0 -2
  52. package/dist/assets/ToolOutputDialog-Dm4ljddO.js +0 -10
  53. package/dist/assets/main-Vubfe9XA.js +0 -169
  54. package/dist/assets/relay-image-stream-CqgxIcA5.js +0 -2
  55. package/dist/assets/sessionChangeSummary-BTJ_oAdX.js +0 -1
  56. package/dist/assets/src-Doy5O-1o.css +0 -2
  57. package/dist/assets/vendor-legendapp-list-CNxU_ALy.js +0 -1
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/rolldown-runtime-hePW80VL.js"])))=>i.map(i=>d[i]);
2
- import{c as e,i as t}from"./runtime-switch-CMiMO5Yj.js";import{n}from"./runtime-fetch-WgH0pROs.js";import{o as r}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";var i=`__openchamberNativeRelayAssetBridge`,a=e=>typeof e==`function`,o=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return a(t.openAsset)&&a(t.writeChunk)&&a(t.endAsset)&&a(t.abortAsset)&&a(t.releaseAsset)},s=()=>{let e=globalThis[i];return o(e)?e:null},c=e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=``,n=32768;for(let r=0;r<e.byteLength;r+=n){let i=Math.min(r+n,e.byteLength),a=``;for(let t=r;t<i;t++)a+=String.fromCharCode(e[t]);t+=a}return btoa(t)},l=e=>({openAsset:async({mimeType:t})=>{let n=await e.create({mimeType:t});if(!n?.assetId||!n?.url)throw Error(`Desktop virtualAsset.create returned an incomplete result`);return{assetId:n.assetId,url:n.url}},writeChunk:async(t,n)=>{let r=n.byteOffset===0&&n.byteLength===n.buffer.byteLength?n:n.slice();await e.push(t,r)},endAsset:async t=>{await e.finish(t)},abortAsset:async t=>{try{await e.cancel(t)}catch{}},releaseAsset:async t=>{try{await e.cancel(t)}catch{}}}),u=e=>({openAsset:async({assetId:t,mimeType:n})=>{let r=await e.create({assetId:t,mime:n});if(!r?.url)throw Error(`Capacitor virtual asset create returned no url`);return{assetId:r.assetId||t,url:r.url}},writeChunk:async(t,n)=>{await e.append({assetId:t,chunk:c(n)})},endAsset:async t=>{await e.finish({assetId:t})},abortAsset:async t=>{try{await e.cancel({assetId:t})}catch{}},releaseAsset:async t=>{try{await e.cancel({assetId:t})}catch{}}}),d=()=>{if(typeof window>`u`)return null;let e=window.__OPENCHAMBER_DESKTOP__?.virtualAsset;return!e||!a(e.create)||!a(e.push)||!a(e.finish)||!a(e.cancel)?null:e},f=null,p=async()=>{if(typeof window>`u`)return null;let e=window.Capacitor;if(!e||typeof e.isNativePlatform!=`function`||!e.isNativePlatform())return null;let t=e.Plugins?.OpenChamberVirtualAsset;if(t&&typeof t==`object`&&a(t.create)&&a(t.append)&&a(t.finish)&&a(t.cancel))return t;try{let{registerPlugin:e}=await r(async()=>{let{registerPlugin:e}=await import(`./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js`).then(e=>e.i);return{registerPlugin:e}},__vite__mapDeps([0,1])),t=e(`OpenChamberVirtualAsset`);if(a(t.create)&&a(t.append)&&a(t.finish)&&a(t.cancel))return t}catch{}return null},m=async()=>{let e=s();if(e)return e;let t=d();if(t)return l(t);f??=p();let n=await f;return n?u(n):null},h=()=>{if(typeof window>`u`)return null;let e=window.__OPENCHAMBER_DESKTOP__?.imageCache;return e&&a(e.acquire)&&a(e.append)&&a(e.commit)&&a(e.release)?e:null},g=3e5,_=33554432,v=524288,y=new Map,b=new Map,x=new Set,S=0,C=null,w=0,T=()=>x.size+S,E=()=>(w+=1,`ria_${(typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`${Date.now().toString(36)}${Math.random().toString(36).slice(2,12)}`).replace(/-/g,``).slice(0,24)}_${(w%1e6).toString(36)}`),D=e=>{e.ttlTimer!==null&&(clearTimeout(e.ttlTimer),e.ttlTimer=null)},O=e=>{D(e),y.delete(e.url),b.delete(e.assetId),x.delete(e.assetId)},k=async e=>{try{await e()}catch{}},A=async(e,t={})=>{if(e.released)return;if(e.released=!0,O(e),e.kind===`blob`){try{URL.revokeObjectURL(e.url)}catch{}return}let n=e.bridge;n&&(t.abort&&await k(()=>n.abortAsset(e.assetId,t.reason)),await k(()=>n.releaseAsset(e.assetId)))},j=e=>{D(e),!(e.retainCount>0)&&(e.ttlTimer=setTimeout(()=>{A(e,{abort:!0,reason:`ttl-expired`})},g))},M=e=>{if(!e)return!1;let t=y.get(e);return!!(t&&!t.released)},N=e=>{let t=y.get(e);return!t||t.released?!1:(t.retainCount+=1,D(t),!0)},P=e=>{let t=y.get(e);!t||t.released||(t.retainCount=Math.max(0,t.retainCount-1),t.retainCount===0&&j(t))},F=async e=>{for(;T()>=6;){if(e.aborted)throw e.reason instanceof Error?e.reason:Error(`aborted`);await new Promise((t,n)=>{let r=()=>{clearTimeout(i),n(e.reason instanceof Error?e.reason:Error(`aborted`))},i=setTimeout(()=>{e.removeEventListener(`abort`,r),t()},25);e.addEventListener(`abort`,r,{once:!0})})}},I=async e=>{for(;;)if(await F(e),T()<6){S+=1;return}},L=()=>{S=Math.max(0,S-1)},R=e=>{let t=e.headers.get(`content-type`)?.split(`;`)[0]?.trim().toLowerCase();return t&&t.startsWith(`image/`)?t:`image/png`},z=async(e,t,n,r,i)=>{if(await I(n),n.aborted)throw L(),n.reason instanceof Error?n.reason:Error(`aborted`);let a=t.body;if(!a||typeof a.getReader!=`function`)throw L(),Error(`Image response body is not readable`);let o=E(),s=R(t),c;try{c=await e.openAsset({assetId:o,mimeType:s})}catch(e){throw L(),e}if(!c?.url||typeof c.url!=`string`||!c.assetId)throw L(),await k(()=>e.abortAsset(o,`invalid-open`)),Error(`Native asset bridge returned an incomplete open result`);x.add(c.assetId),L();let l={assetId:c.assetId,url:c.url,kind:`native`,transportIdentity:r,ttlTimer:null,retainCount:0,released:!1,byteLength:0,bridge:e,sourcePath:i};return y.set(c.url,l),b.set(c.assetId,l),j(l),B(e,a,l,n,r),c.url},B=(e,n,r,i,a)=>{let o=n.getReader(),s=()=>{o.cancel().catch(()=>void 0),A(r,{abort:!0,reason:`aborted`})};return i.addEventListener(`abort`,s,{once:!0}),(async()=>{let n=[],c=0,l=e=>{if(e<=0)return new Uint8Array;if(n.length===1&&n[0].byteLength===e)return c=0,n.pop();let t=new Uint8Array(e),r=0;for(;r<e&&n.length>0;){let i=n[0],a=e-r;i.byteLength<=a?(t.set(i,r),r+=i.byteLength,n.shift()):(t.set(i.subarray(0,a),r),n[0]=i.subarray(a),r+=a)}return c-=r,t},u=()=>{n.length=0,c=0},d=()=>{if(i.aborted||r.released)throw i.reason instanceof Error?i.reason:Error(`aborted`);if(t()!==a)throw Error(`Runtime transport changed during image stream`)},f=async t=>{for(;c>0&&(t||c>=524288);){d();let t=l(Math.min(c,v));await e.writeChunk(r.assetId,t)}};try{for(;;){d();let{done:e,value:t}=await o.read();if(e)break;if(!(!t||t.byteLength===0)){if(r.byteLength+=t.byteLength,r.byteLength>33554432)throw Error(`Image exceeds maximum size of ${_} bytes`);n.push(t),c+=t.byteLength,c>=524288&&await f(!1)}}d(),await f(!0),d(),await e.endAsset(r.assetId),x.delete(r.assetId)}catch(e){u(),await A(r,{abort:!0,reason:e instanceof Error?e.message:`stream-failed`})}finally{i.removeEventListener(`abort`,s)}})().catch(()=>{})},V=async(e,n,r)=>{let i=await e.blob();if(n.aborted)throw n.reason instanceof Error?n.reason:Error(`aborted`);if(i.size>33554432)throw Error(`Image exceeds maximum size of ${_} bytes`);if(t()!==r)throw Error(`Runtime transport changed during image load`);let a=URL.createObjectURL(i),o={assetId:E(),url:a,kind:`blob`,transportIdentity:r,ttlTimer:null,retainCount:0,released:!1,byteLength:i.size,bridge:null};return y.set(a,o),b.set(o.assetId,o),j(o),a},H=async(e,n,r={})=>{if(X(),n.aborted)throw n.reason instanceof Error?n.reason:Error(`aborted`);if(!(e instanceof Blob))throw Error(`Verified display requires a Blob`);if(e.size>33554432)throw Error(`Image exceeds maximum size of ${_} bytes`);let i=t(),a=U(e,r.mimeType),o=await m();return o?G(o,e,a,n,i):W(e,n,i)},U=(e,t)=>{let n=(t||e.type||``).split(`;`)[0]?.trim().toLowerCase();return n&&n.startsWith(`image/`)?n:n||`image/png`},W=async(e,n,r)=>{if(n.aborted)throw n.reason instanceof Error?n.reason:Error(`aborted`);if(t()!==r)throw Error(`Runtime transport changed during image load`);let i=URL.createObjectURL(e),a={assetId:E(),url:i,kind:`blob`,transportIdentity:r,ttlTimer:null,retainCount:0,released:!1,byteLength:e.size,bridge:null};return y.set(i,a),b.set(a.assetId,a),j(a),i},G=async(e,n,r,i,a)=>{if(await I(i),i.aborted)throw L(),i.reason instanceof Error?i.reason:Error(`aborted`);if(t()!==a)throw L(),Error(`Runtime transport changed during image load`);let o=E(),s;try{s=await e.openAsset({assetId:o,mimeType:r})}catch(e){throw L(),e}if(!s?.url||typeof s.url!=`string`||!s.assetId)throw L(),await k(()=>e.abortAsset(o,`invalid-open`)),Error(`Native asset bridge returned an incomplete open result`);x.add(s.assetId),L();let c={assetId:s.assetId,url:s.url,kind:`native`,transportIdentity:a,ttlTimer:null,retainCount:0,released:!1,byteLength:n.size,bridge:e,sourceBlob:n};y.set(s.url,c),b.set(s.assetId,c),j(c);try{if(i.aborted)throw i.reason instanceof Error?i.reason:Error(`aborted`);if(t()!==a)throw Error(`Runtime transport changed during image load`);let r=new Uint8Array(await n.arrayBuffer());if(i.aborted)throw i.reason instanceof Error?i.reason:Error(`aborted`);let o=0;for(;o<r.byteLength;){if(i.aborted||c.released)throw i.reason instanceof Error?i.reason:Error(`aborted`);if(t()!==a)throw Error(`Runtime transport changed during image load`);let n=Math.min(o+v,r.byteLength);await e.writeChunk(s.assetId,r.subarray(o,n)),o=n}return await e.endAsset(s.assetId),x.delete(s.assetId),s.url}catch(e){throw await A(c,{abort:!0,reason:e instanceof Error?e.message:`verified-blob-failed`}),e}},K=async(e,r)=>{X();let i=t(),a=await n(`/api/fs/raw`,{method:`GET`,cache:`no-store`,query:{path:e},signal:r});if(!a.ok)throw Error(`Image source request failed with status ${a.status}`);let o=await m();return o?z(o,a,r,i,e):V(a,r,i)},q=async(e,r)=>{let i=y.get(e);if(!i||i.released)return null;if(i.transportIdentity!==t())throw Error(`Image runtime changed`);if(r?.throwIfAborted(),i.sourceBlob)return i.sourceBlob;if(!i.sourcePath)return null;let a=await n(`/api/fs/raw`,{query:{path:i.sourcePath},signal:r});if(!a.ok)throw Error(`Image source request failed (${a.status})`);let o=await a.blob();if(r?.throwIfAborted(),i.transportIdentity!==t())throw Error(`Image runtime changed`);if(!o.size||o.size>33554432)throw Error(`Invalid image size`);return o},J=e=>{if(!e)return;let t=y.get(e);if(t){A(t,{abort:!0,reason:`released`});return}if(e.startsWith(`blob:`))try{URL.revokeObjectURL(e)}catch{}},Y=(e=`cleared`)=>{let t=Array.from(y.values());for(let n of t)A(n,{abort:!0,reason:e});x.clear(),S=0},X=()=>{C||typeof window>`u`||(C=e(()=>{Y(`transport-changed`)}))};export{J as a,H as c,P as i,h as l,M as n,N as o,q as r,K as s,_ as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{_t as t,dt as n,ft as r,gt as i,ln as a,yt as o}from"./persistence-BKszKaoQ.js";import{it as s,nt as c,rt as l}from"./vendor-base-ui-CdzJ6My_.js";import{n as u,t as d}from"./platform-QykS5eAQ.js";import{n as f}from"./vendor-react-BP2cRVqX.js";import{a as p,n as m}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{f as h,n as g,r as _}from"./vendor-reactuses-core-BpfIZ1tg.js";import{f as v,r as y,t as b}from"./button-Ca8Z9cOP.js";import{Br as x,Rr as S,wa as C}from"./useMobileNavigationStore-BvJJ9SP1.js";import{n as w}from"./Icon-x0XTu231.js";import{v as T}from"./image-loading-DImQz00b.js";import{a as ee,o as E}from"./dropdown-menu.styles-vl6a_Aes.js";import{i as D,t as O}from"./textarea-BfNgh87h.js";import{t as k}from"./LoadingImage-DO_V7mRh.js";var A=e(s(),1),j=f(),M=l(),N=e(c(),1),te=p(`OpenChamberMedia`);function P(e){return e.platform===`android`||/Android/i.test(e.userAgent)||e.userAgentDataPlatform===`Android`}function F(){if(typeof window>`u`)return!1;let e=navigator.userAgentData;return P({platform:d(),userAgent:navigator.userAgent||``,userAgentDataPlatform:e?.platform})}function ne(){return u()&&m.getPlatform()===`android`&&m.isPluginAvailable(`OpenChamberMedia`)}async function I(e){if(!ne())return null;let t=await te.pickMedia({limit:e});if(t.cancelled)return[];let n=[];for(let e of t.files){let t=await fetch(m.convertFileSrc(e.path));if(!t.ok)throw Error(`Native media fetch failed (${t.status})`);let r=await t.blob();n.push(new File([r],e.name,{type:e.mimeType}))}return n}var re=`h-auto min-h-12 w-full justify-start gap-3 rounded-none supports-[corner-shape:squircle]:rounded-none px-4 border-b border-[var(--surface-subtle)] last:border-b-0`,ie=e=>{let t=(0,j.c)(38),{id:n,open:r,onOpenChange:i,onPickPhotos:a,onPickFiles:o}=e,{t:s}=v(),c;t[0]===s?c=t[1]:(c=s(`chat.chatInput.actions.addAttachment`),t[0]=s,t[1]=c);let l;t[2]===c?l=t[3]:(l=(0,M.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold`,children:c}),t[2]=c,t[3]=l);let u;t[4]===s?u=t[5]:(u=s(`chat.chatInput.actions.addAttachment`),t[4]=s,t[5]=u);let d;t[6]===s?d=t[7]:(d=s(`mobile.surface.closeAria`),t[6]=s,t[7]=d);let f;t[8]===s?f=t[9]:(f=s(`mobile.sessions.sheet.resizeAria`),t[8]=s,t[9]=f);let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,M.jsx)(w,{name:`file-image`,className:`size-5 flex-shrink-0 text-muted-foreground`}),t[10]=p):p=t[10];let m;t[11]===s?m=t[12]:(m=s(`chat.chatInput.actions.attachPhotos`),t[11]=s,t[12]=m);let h;t[13]===m?h=t[14]:(h=(0,M.jsx)(`span`,{className:`truncate`,children:m}),t[13]=m,t[14]=h);let g;t[15]!==a||t[16]!==h?(g=(0,M.jsxs)(b,{type:`button`,variant:`ghost`,size:`lg`,className:re,"data-mobile-press-feedback":`none`,onClick:a,children:[p,h]}),t[15]=a,t[16]=h,t[17]=g):g=t[17];let _;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,M.jsx)(w,{name:`attachment-2`,className:`size-5 flex-shrink-0 text-muted-foreground`}),t[18]=_):_=t[18];let y;t[19]===s?y=t[20]:(y=s(`chat.chatInput.actions.attachFiles`),t[19]=s,t[20]=y);let x;t[21]===y?x=t[22]:(x=(0,M.jsx)(`span`,{className:`truncate`,children:y}),t[21]=y,t[22]=x);let S;t[23]!==o||t[24]!==x?(S=(0,M.jsxs)(b,{type:`button`,variant:`ghost`,size:`lg`,className:re,"data-mobile-press-feedback":`none`,onClick:o,children:[_,x]}),t[23]=o,t[24]=x,t[25]=S):S=t[25];let C;t[26]!==S||t[27]!==g?(C=(0,M.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-y-auto overscroll-contain px-3 pb-3`,children:(0,M.jsxs)(`div`,{className:`overflow-hidden rounded-2xl bg-[var(--surface-muted)]`,"data-page-scroll-lock":`true`,children:[g,S]})}),t[26]=S,t[27]=g,t[28]=C):C=t[28];let T;return t[29]!==n||t[30]!==i||t[31]!==r||t[32]!==C||t[33]!==l||t[34]!==u||t[35]!==d||t[36]!==f?(T=(0,M.jsx)(D,{id:n,open:r,onOpenChange:i,title:l,ariaLabel:u,closeAriaLabel:d,resizeAriaLabel:f,fitContent:!0,children:C}),t[29]=n,t[30]=i,t[31]=r,t[32]=C,t[33]=l,t[34]=u,t[35]=d,t[36]=f,t[37]=T):T=t[37],T},L={glyph:`_glyph_1xs2e_1`,lens:`_lens_1xs2e_12`,shape:`_shape_1xs2e_21`,revolve:`_revolve_1xs2e_1`};function ae(e){let t=(0,j.c)(18),{decorative:n,size:r}=e,i=n!==void 0&&n,a=r===void 0?20:r,{t:o}=v(),s;t[0]===a?s=t[1]:(s={width:a,height:a},t[0]=a,t[1]=s);let c=i||void 0,l=i?void 0:`img`,u;t[2]!==i||t[3]!==o?(u=i?void 0:o(`common.loading`),t[2]=i,t[3]=o,t[4]=u):u=t[4];let d=`scale(${a/28})`,f;t[5]===d?f=t[6]:(f={transform:d},t[5]=d,t[6]=f);let p,m,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,M.jsx)(`span`,{className:L.shape}),p=(0,M.jsx)(`span`,{className:L.shape}),m=(0,M.jsx)(`span`,{className:L.shape}),t[7]=p,t[8]=m,t[9]=h):(p=t[7],m=t[8],h=t[9]);let g;t[10]===f?g=t[11]:(g=(0,M.jsxs)(`span`,{className:L.lens,style:f,children:[h,p,m]}),t[10]=f,t[11]=g);let _;return t[12]!==g||t[13]!==s||t[14]!==c||t[15]!==l||t[16]!==u?(_=(0,M.jsx)(`span`,{"data-dictation-loading":!0,className:L.glyph,style:s,"aria-hidden":c,role:l,"aria-label":u,children:g}),t[12]=g,t[13]=s,t[14]=c,t[15]=l,t[16]=u,t[17]=_):_=t[17],_}var R=T(!1).colors,oe=`M-50 74.564 A600 600 0 0 1 147.707 22.283 A38 38 0 0 1 154.330 97.994 A524 524 0 0 0 -18.333 143.653 Z`,se=`M450 74.564 A600 600 0 0 0 252.293 22.283 A38 38 0 0 0 245.670 97.994 A524 524 0 0 1 418.333 143.653 Z`,ce={colorScheme:`light`,"--surface-background":R.surface.background,"--surface-foreground":R.surface.foreground,"--primary-base":R.primary.base,"--foreground":R.surface.background,"--interactive-hover":`color-mix(in srgb, var(--surface-background) 12%, transparent)`,"--interactive-active":`color-mix(in srgb, var(--surface-background) 20%, transparent)`,"--ring":R.interactive.focusRing,"--status-error":R.status.error};function le(e){let t=(0,j.c)(85),{containerRef:n,disabled:r,onInsert:i,onSend:a,onRelease:o,onError:s,onHintChange:c}=e,{t:l}=v(),[u,d]=(0,A.useState)(!1),[f,p]=(0,A.useState)(!1),[m,h]=(0,A.useState)(`edit`),_=(0,A.useRef)(null),y=(0,A.useRef)(null),b=(0,A.useRef)(`insert`),S=(0,A.useRef)(null),C=(0,A.useId)(),w=(0,A.useId)(),T=(0,A.useId)(),E;t[0]!==i||t[1]!==a?(E=e=>b.current===`send`?a(e):i(e),t[0]=i,t[1]=a,t[2]=E):E=t[2];let D;t[3]!==s||t[4]!==E?(D={onTranscript:E,onError:s},t[3]=s,t[4]=E,t[5]=D):D=t[5];let O=ee(D),{status:k,isStarting:te,partialTranscript:P,error:F,volume:ne}=O,I=g(c),re=u?m===`cancel`?`cancelling`:m===`edit`?`editing`:`recording`:f?`processing`:null,ie,L;t[6]!==re||t[7]!==I?(ie=()=>{I(re)},L=[re,I],t[6]=re,t[7]=I,t[8]=ie,t[9]=L):(ie=t[8],L=t[9]),(0,A.useEffect)(ie,L);let R,le;t[10]===I?(R=t[11],le=t[12]):(R=()=>()=>I(null),le=[I],t[10]=I,t[11]=R,t[12]=le),(0,A.useEffect)(R,le);let de;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(de=()=>{y.current&&clearTimeout(y.current),y.current=null},t[13]=de):de=t[13];let z=g(de),B;t[14]!==n||t[15]!==r?(B=e=>{if(r||!(e instanceof HTMLElement))return null;let t=n.current?.querySelector(`textarea`);return!t||t.value!==``||t.disabled||t.readOnly||e!==t&&!e.closest(`[data-oc-composer-compact-surface]`)||e.closest(`button, [data-composer-action]`)?null:t},t[14]=n,t[15]=r,t[16]=B):B=t[16];let V=g(B),fe;t[17]!==z||t[18]!==O||t[19]!==F||t[20]!==f||t[21]!==k?(fe=()=>{f||(z(),_.current=null,d(!1),h(`edit`),k===`failed`||k===`idle`&&F?O.discardFailedDictation():O.cancelDictation())},t[17]=z,t[18]=O,t[19]=F,t[20]=f,t[21]=k,t[22]=fe):fe=t[22];let H=g(fe),U;t[23]!==O||t[24]!==r||t[25]!==V||t[26]!==f||t[27]!==k?(U=e=>{let t=e.target;r||f||k!==`idle`||_.current||!e.isPrimary||e.button!==0||!(t instanceof HTMLElement)||V(t)&&(e.preventDefault(),e.stopPropagation(),_.current={pointer:e.pointerId,x:e.clientX,y:e.clientY,intent:`edit`,started:!1},y.current=setTimeout(()=>{if(y.current=null,!_.current)return;let e=V(t);if(!e){_.current=null;return}e.blur(),_.current.started=!0,b.current=`insert`,d(!0),h(`edit`),O.startDictation()},300))},t[23]=O,t[24]=r,t[25]=V,t[26]=f,t[27]=k,t[28]=U):U=t[28];let W=g(U),pe;t[29]===z?pe=t[30]:(pe=e=>{let t=_.current;if(!t||t.pointer!==e.pointerId)return;e.preventDefault(),e.stopPropagation();let n=e.clientX-t.x,r=S.current?.getBoundingClientRect(),i=r&&r.width>0&&e.clientY>=r.top&&e.clientY<=r.bottom?e.clientX<r.left+r.width/2?`cancel`:`send`:n<=-64?`cancel`:n>=64?`send`:`edit`;if(!t.started&&Math.hypot(n,t.y-e.clientY)>12){z(),_.current=null;return}t.started&&i!==t.intent&&(t.intent=i,h(i),x(i===`edit`?`light`:`medium`,{bypassCadence:!0}))},t[29]=z,t[30]=pe);let me=g(pe),he;t[31]!==H||t[32]!==z||t[33]!==n||t[34]!==O||t[35]!==F||t[36]!==o||t[37]!==P||t[38]!==k?(he=e=>{let t=_.current;if(!(!t||t.pointer!==e.pointerId)){if(e.preventDefault(),e.stopPropagation(),z(),F||k===`failed`){H();return}_.current=null,d(!1),t.started?t.intent===`cancel`?O.cancelDictation():(b.current=t.intent===`edit`?`insert`:`send`,o(P),p(!0),Promise.resolve(O.confirmDictation()).finally(()=>{p(!1),O.discardFailedDictation(),t.intent===`edit`&&n.current?.querySelector(`textarea`)?.focus()})):n.current?.querySelector(`textarea`)?.focus()}},t[31]=H,t[32]=z,t[33]=n,t[34]=O,t[35]=F,t[36]=o,t[37]=P,t[38]=k,t[39]=he):he=t[39];let ge=g(he),_e;t[40]===H?_e=t[41]:(_e=e=>{_.current?.pointer===e.pointerId&&H()},t[40]=H,t[41]=_e);let G=g(_e),ve;t[42]===V?ve=t[43]:(ve=e=>{V(e.target)&&e.preventDefault()},t[42]=V,t[43]=ve);let K=g(ve),q,J;t[44]!==H||t[45]!==z||t[46]!==n||t[47]!==W||t[48]!==G||t[49]!==me||t[50]!==K||t[51]!==ge?(q=()=>{let e=n.current;if(!e)return;let t=()=>{document.visibilityState===`hidden`&&H()};return e.addEventListener(`pointerdown`,W,!0),e.addEventListener(`touchstart`,K,{capture:!0,passive:!1}),window.addEventListener(`pointermove`,me,{capture:!0,passive:!1}),window.addEventListener(`pointerup`,ge,!0),window.addEventListener(`pointercancel`,G,!0),e.addEventListener(`contextmenu`,K,!0),e.addEventListener(`selectstart`,K,!0),window.addEventListener(`blur`,H),document.addEventListener(`visibilitychange`,t),()=>{z(),e.removeEventListener(`pointerdown`,W,!0),e.removeEventListener(`touchstart`,K,!0),window.removeEventListener(`pointermove`,me,!0),window.removeEventListener(`pointerup`,ge,!0),window.removeEventListener(`pointercancel`,G,!0),e.removeEventListener(`contextmenu`,K,!0),e.removeEventListener(`selectstart`,K,!0),window.removeEventListener(`blur`,H),document.removeEventListener(`visibilitychange`,t)}},J=[n,W,me,ge,G,H,z,K],t[44]=H,t[45]=z,t[46]=n,t[47]=W,t[48]=G,t[49]=me,t[50]=K,t[51]=ge,t[52]=q,t[53]=J):(q=t[52],J=t[53]),(0,A.useEffect)(q,J);let ye,Y;if(t[54]!==H||t[55]!==r?(ye=()=>{r&&H()},Y=[r,H],t[54]=H,t[55]=r,t[56]=ye,t[57]=Y):(ye=t[56],Y=t[57]),(0,A.useEffect)(ye,Y),!u&&!f)return null;let be=Math.min(1,Math.max(0,ne))**.6,xe=!!F,Se=F?H:void 0,Ce;t[58]===be?Ce=t[59]:(Ce={...ce,"--speech-energy":be},t[58]=be,t[59]=Ce);let we=Ce,X;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,M.jsx)(`div`,{className:`oc-speech-light-field`,"aria-hidden":`true`,children:[`ice`,`lilac`,`mint`,`blush`,`mid`,`core`].map(ue)}),t[60]=X):X=t[60];let Te=te||f,Z;t[61]!==F||t[62]!==te||t[63]!==P||t[64]!==f||t[65]!==k||t[66]!==l?(Z=F&&!f?(0,M.jsx)(`p`,{role:`alert`,className:`oc-speech-caption oc-speech-error`,children:F}):(0,M.jsx)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`oc-speech-caption`,children:te||f?(0,M.jsx)(ae,{size:72}):P?(0,M.jsx)(`span`,{className:`oc-speech-interim`,children:P}):l(k===`uploading`?`chat.dictation.processing`:`chat.dictation.listening`)}),t[61]=F,t[62]=te,t[63]=P,t[64]=f,t[65]=k,t[66]=l,t[67]=Z):Z=t[67];let Q;t[68]!==Te||t[69]!==Z?(Q=(0,M.jsx)(`div`,{className:`oc-speech-content`,"data-starting":Te,children:Z}),t[68]=Te,t[69]=Z,t[70]=Q):Q=t[70];let $;t[71]!==C||t[72]!==w||t[73]!==T||t[74]!==u||t[75]!==m||t[76]!==l?($=u&&(0,M.jsx)(`div`,{className:`oc-speech-gesture-stage`,"aria-hidden":`true`,children:(0,M.jsxs)(`div`,{className:`oc-speech-gesture-surfaces`,children:[(0,M.jsx)(`div`,{className:`oc-speech-target-glass`,style:{clipPath:`url(#${w})`}}),(0,M.jsx)(`div`,{className:`oc-speech-target-glass`,style:{clipPath:`url(#${T})`}}),(0,M.jsxs)(`svg`,{className:`oc-speech-geometry`,viewBox:`0 0 400 226`,focusable:`false`,children:[(0,M.jsxs)(`defs`,{children:[(0,M.jsx)(`clipPath`,{id:w,clipPathUnits:`objectBoundingBox`,children:(0,M.jsx)(`path`,{transform:`scale(0.0025 0.004424778761)`,d:oe})}),(0,M.jsx)(`clipPath`,{id:T,clipPathUnits:`objectBoundingBox`,children:(0,M.jsx)(`path`,{transform:`scale(0.0025 0.004424778761)`,d:se})}),(0,M.jsxs)(`linearGradient`,{id:C,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,M.jsx)(`stop`,{offset:`0%`,className:`oc-speech-arc-top`}),(0,M.jsx)(`stop`,{offset:`100%`,className:`oc-speech-arc-bottom`})]})]}),(0,M.jsxs)(`g`,{className:`oc-speech-targets`,ref:S,children:[(0,M.jsxs)(`g`,{className:`oc-speech-target oc-speech-target--cancel`,"data-active":m===`cancel`,children:[(0,M.jsx)(`path`,{d:oe}),(0,M.jsx)(`text`,{x:`95`,y:`68`,textAnchor:`middle`,dominantBaseline:`central`,transform:`rotate(-11 95 68)`,children:l(`chat.dictation.cancelGesture`)})]}),(0,M.jsxs)(`g`,{className:`oc-speech-target oc-speech-target--send`,"data-active":m===`send`,children:[(0,M.jsx)(`path`,{d:se}),(0,M.jsx)(`text`,{x:`305`,y:`68`,textAnchor:`middle`,dominantBaseline:`central`,transform:`rotate(11 305 68)`,children:l(`chat.dictation.send`)})]})]}),(0,M.jsx)(`path`,{className:`oc-speech-hold-arc`,fill:`url(#${C})`,d:`M-50 186.987 A500 500 0 0 1 450 186.987 L450 300 H-50 Z`})]})]})}),t[71]=C,t[72]=w,t[73]=T,t[74]=u,t[75]=m,t[76]=l,t[77]=$):$=t[77];let Ee;return t[78]!==m||t[79]!==xe||t[80]!==Se||t[81]!==we||t[82]!==Q||t[83]!==$?(Ee=(0,N.createPortal)((0,M.jsxs)(`div`,{className:`oc-speech-overlay`,"data-intent":m,"data-error":xe,onClick:Se,style:we,children:[X,Q,$]}),document.body),t[78]=m,t[79]=xe,t[80]=Se,t[81]=we,t[82]=Q,t[83]=$,t[84]=Ee):Ee=t[84],Ee}function ue(e){return(0,M.jsx)(`div`,{className:`oc-speech-reactor oc-speech-reactor--${e}`,children:(0,M.jsx)(`div`,{className:`oc-speech-light`})},e)}function de(e){let t=(0,j.c)(7),{available:n}=e,r=C(z),[i,o]=(0,A.useState)(null),s;t[0]!==n||t[1]!==r?(s=n&&r&&!a()&&E(),t[0]=n,t[1]=r,t[2]=s):s=t[2];let c=s,l=c?i:null,u;return t[3]!==c||t[4]!==r||t[5]!==l?(u={globallyEnabled:r,enabled:c,hint:l,onHintChange:o},t[3]=c,t[4]=r,t[5]=l,t[6]=u):u=t[6],u}function z(e){return e.dictationEnabled}var B=A.createContext(null),V=e=>{let t=(0,j.c)(3),{actions:n,children:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,M.jsx)(B.Provider,{value:n,children:r}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},fe=()=>A.useContext(B),H=e=>e.nativeEvent.isComposing||e.nativeEvent.keyCode===229;function U(e){let t=(0,j.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=y(`inline-flex shrink-0 items-center justify-center rounded-full bg-foreground text-background`,r),t[4]=r,t[5]=a);let o;return t[6]!==n||t[7]!==i||t[8]!==a?(o=(0,M.jsx)(`span`,{className:a,...i,"aria-hidden":!0,children:n}),t[6]=n,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function W(e){let t=(0,j.c)(7),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]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,M.jsx)(`span`,{"data-stop-glyph":`true`,className:`block size-[38%] rounded-[20%] bg-current`}),t[3]=i):i=t[3];let a;return t[4]!==n||t[5]!==r?(a=(0,M.jsx)(U,{className:n,...r,children:i}),t[4]=n,t[5]=r,t[6]=a):a=t[6],a}function pe(e){let t=(0,j.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,spinning:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i,o=a?`loader-4`:`arrow-up`,s=a?`size-[50%] animate-spin`:`size-[56%]`,c;t[4]===s?c=t[5]:(c=y(s),t[4]=s,t[5]=c);let l;t[6]!==o||t[7]!==c?(l=(0,M.jsx)(w,{name:o,weight:`medium`,className:c}),t[6]=o,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==n||t[10]!==r||t[11]!==l?(u=(0,M.jsx)(U,{className:n,...r,children:l}),t[9]=n,t[10]=r,t[11]=l,t[12]=u):u=t[12],u}var me=A.forwardRef((e,t)=>{let n=(0,j.c)(19),r,i,a,o,s,c;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6]):({children:r,className:i,expanded:s,focusedTone:c,style:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c);let l=s!==void 0&&s,u=c===void 0?`primary`:c,d=l&&`min-h-0 flex-1`,f=u===`info`?`focus-within:ring-[var(--status-info)]`:`focus-within:ring-primary/50`,p;n[7]!==i||n[8]!==d||n[9]!==f?(p=y(`relative flex flex-col overflow-visible border border-border/80 focus-within:ring-1`,d,f,i),n[7]=i,n[8]=d,n[9]=f,n[10]=p):p=n[10];let m;n[11]===o?m=n[12]:(m={borderRadius:`var(--radius-xl)`,backgroundColor:`var(--surface-subtle)`,...o},n[11]=o,n[12]=m);let h;return n[13]!==r||n[14]!==a||n[15]!==t||n[16]!==p||n[17]!==m?(h=(0,M.jsx)(`div`,{ref:t,className:p,style:m,...a,children:r}),n[13]=r,n[14]=a,n[15]=t,n[16]=p,n[17]=m,n[18]=h):h=n[18],h});me.displayName=`ChatComposerSurface`;var he=A.forwardRef((e,t)=>{let n=(0,j.c)(3),r;return n[0]!==e||n[1]!==t?(r=(0,M.jsx)(O,{ref:t,...e}),n[0]=e,n[1]=t,n[2]=r):r=n[2],r});he.displayName=`ChatPromptTextarea`;var ge=e=>{let t=(0,j.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=y(`flex shrink-0 items-center gap-2 bg-transparent px-2.5 py-1.5`,r),t[4]=r,t[5]=a);let o;return t[6]!==n||t[7]!==i||t[8]!==a?(o=(0,M.jsx)(`div`,{className:a,"data-chat-input-footer":`true`,...i,children:n}),t[6]=n,t[7]=i,t[8]=a,t[9]=o):o=t[9],o},_e=(e,t)=>{typeof e==`function`?e(t):e&&(e.current=t)},G=({value:e,attachments:t=[],disabled:n=!1,pending:r=!1,placeholder:i,isMobile:a=!1,onChange:o,onSubmit:s,onStop:c,onAddFiles:l,onRemoveAttachment:u,addFilesLabel:d,removeAttachmentLabel:f,fileAccept:p=`image/*`,sendLabel:m,stopLabel:_,hint:b,leftControls:x,rightControls:C,footerContent:T,inputHeader:ee,attachmentContent:E,highlightedContent:D,highlightRef:O,inputRef:j,textareaProps:N,textLayoutClassName:te,inputClassName:P,inputOuterClassName:re,inputStyle:L,footerClassName:ae,footerStyle:R,contentClassName:oe,inputSectionClassName:se,autoResize:ce=!0,disableInputWhilePending:le=!0,layout:ue=`stacked`,children:de,className:z,expanded:B=!1,...V})=>{let{t:fe}=v(),U=ue===`inline`,[G,ve]=A.useState(!1),[K,q]=A.useState(!1),J=F(),ye=t.length>0||G,Y=A.useRef(null),be=A.useRef(null),xe=A.useRef(null),Se=A.useId().replace(/:/g,``),Ce=g(()=>{if(!ce||B||N?.fillContainer){U&&ve(!1);return}let e=Y.current;if(!e)return;e.style.height=U?`0px`:`auto`;let t=Number.parseFloat(window.getComputedStyle(e).maxHeight),n=U?Math.max(e.scrollHeight,48):e.scrollHeight,r=Number.isFinite(t)?Math.min(n,t):n;e.style.height=`${r}px`,e.style.overflowY=Number.isFinite(t)&&n>t?`auto`:`hidden`;let i=r>48;U&&ve(e=>e===i?e:i)});A.useLayoutEffect(()=>{Ce()},[ce,B,U,N?.fillContainer,e]),h(U&&ce&&!B&&!N?.fillContainer?Y:null,Ce);let we=e=>{N?.onKeyDown?.(e),!(e.defaultPrevented||H(e))&&e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),!n&&(!r||!le)&&s())},X=e=>{l?.(e.target.files),e.target.value=``},Te=g(()=>{Y.current?.blur(),q(!0)}),Z=g(e=>{q(!1),requestAnimationFrame(()=>e?.click())}),Q=g(()=>{q(!1),requestAnimationFrame(()=>{(async()=>{if(!ne()){xe.current?.click();return}try{let e=await I(20);if(e===null){xe.current?.click();return}e.length>0&&l?.(e)}catch(e){console.error(`Native photo pick failed`,e),S.error(fe(`chat.chatInput.toast.attachFileFailed`))}})()})}),$=e.trim().length>0||t.length>0,Ee=t.filter(e=>e.mime.startsWith(`image/`)),De=t.filter(e=>!e.mime.startsWith(`image/`)),Oe=l?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`input`,{ref:be,type:`file`,accept:p,multiple:!0,className:`hidden`,onChange:X}),J?(0,M.jsx)(`input`,{ref:xe,type:`file`,accept:`image/*`,multiple:!0,className:`hidden`,onChange:X}):null,(0,M.jsx)(`button`,{type:`button`,className:`flex size-8 shrink-0 items-center justify-center rounded-md text-foreground outline-none hover:bg-[var(--interactive-hover)] disabled:cursor-not-allowed disabled:opacity-40`,onClick:()=>J?Te():be.current?.click(),onMouseDown:a?e=>e.preventDefault():void 0,onPointerDownCapture:a?e=>e.preventDefault():void 0,disabled:n||r,"aria-label":d,children:(0,M.jsx)(w,{name:`attachment-2`,className:`size-[18px]`})})]}):null,ke=!n&&!r&&$,Ae=a?`size-6`:`size-full`,je=r&&c?(0,M.jsx)(`button`,{type:`button`,"data-composer-stop":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-full outline-none hover:opacity-80`,onClick:c,"aria-label":_,children:(0,M.jsx)(W,{className:Ae})}):(0,M.jsx)(`button`,{type:`submit`,"data-composer-send":`true`,"data-composer-circle":ke?`true`:void 0,className:y(`flex size-8 shrink-0 items-center justify-center outline-none`,ke?`rounded-full hover:opacity-80`:`rounded-md text-primary hover:bg-[var(--interactive-hover)] disabled:cursor-not-allowed disabled:opacity-30`),disabled:n||r||!$,"aria-label":m,children:ke?(0,M.jsx)(pe,{className:Ae}):(0,M.jsx)(w,{name:r?`loader-4`:`send-plane-2`,className:y(`size-4`,r&&`animate-spin`)})}),Me=r&&c?(0,M.jsx)(`button`,{type:`button`,"data-composer-stop":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-full outline-none hover:opacity-80`,onClick:c,"aria-label":_,children:(0,M.jsx)(W,{className:Ae})}):(0,M.jsx)(`button`,{type:`submit`,"data-composer-send":`true`,"data-composer-circle":`true`,className:y(`flex size-8 shrink-0 items-center justify-center rounded-full outline-none`,ke?`hover:opacity-80`:`cursor-not-allowed opacity-30`),disabled:n||r||!$,"aria-busy":r||void 0,"aria-label":m,children:(0,M.jsx)(pe,{className:Ae,spinning:r})}),Ne=U?Me:je,Pe=x===void 0?Oe:x;return(0,M.jsxs)(me,{className:z,expanded:B,...V,children:[de,(0,M.jsxs)(`div`,{"data-composer-content":`true`,"data-composer-layout":ue,className:y(`relative flex min-h-0`,U?y(`min-h-12 flex-row`,ye?`items-end`:`items-center`):`flex-col`,B&&`flex-1`,oe),children:[U&&Pe?(0,M.jsx)(`div`,{className:`flex h-12 shrink-0 items-center pl-1.5`,"data-composer-inline-attach":`true`,children:Pe}):null,(0,M.jsxs)(`div`,{className:y(`overflow-hidden`,U&&`min-w-0 flex-1`,B&&`flex min-h-0 flex-1 flex-col`,se),children:[ee,E,Ee.length>0?(0,M.jsx)(`div`,{className:`flex gap-2 overflow-x-auto px-3 pt-3`,"data-chat-prompt-attachments":`true`,children:Ee.map(e=>(0,M.jsxs)(`div`,{className:`group relative shrink-0`,children:[(0,M.jsx)(`span`,{className:`block size-16`,children:(0,M.jsx)(k,{fill:!0,src:e.url,alt:e.name,className:`size-16 rounded-lg border border-border object-cover`})}),u?(0,M.jsx)(`button`,{type:`button`,className:`absolute -right-1 -top-1 flex size-6 items-center justify-center rounded-full border border-border bg-[var(--surface-elevated)] shadow-sm hover:bg-[var(--interactive-hover)]`,onClick:()=>u(e.id),"aria-label":f,children:(0,M.jsx)(w,{name:`close`,className:`size-3`})}):null]},e.id))}):null,De.length>0?(0,M.jsx)(`div`,{className:`flex flex-wrap gap-2 px-3 pt-3`,"data-chat-prompt-file-attachments":`true`,children:De.map(e=>(0,M.jsxs)(`div`,{className:`relative flex max-w-[12rem] items-center gap-1.5 rounded-lg border border-border bg-[var(--surface-elevated)] px-2 py-1`,children:[(0,M.jsx)(w,{name:`file-text`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate typography-micro`,children:e.name}),u?(0,M.jsx)(`button`,{type:`button`,className:`flex size-5 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-[var(--interactive-hover)]`,onClick:()=>u(e.id),"aria-label":f,children:(0,M.jsx)(w,{name:`close`,className:`size-3`})}):null]},e.id))}):null,(0,M.jsxs)(`div`,{className:y(`relative overflow-hidden`,U&&y(`flex min-h-12`,G?`items-end`:`items-center`),B&&`flex min-h-0 flex-1 flex-col`),"data-composer-input-shell":`true`,children:[D?(0,M.jsx)(`div`,{ref:O,"aria-hidden":!0,"data-composer-highlight":`true`,className:y(`pointer-events-none absolute inset-0 z-0 rounded-b-none`,te,P),children:D}):null,(0,M.jsx)(he,{...N,simple:!0,fillContainer:!U&&N?.fillContainer,ref:e=>{Y.current=e,_e(j,e)},"data-chat-input":`true`,value:e,onChange:e=>o(e.target.value,e),onKeyDown:we,disabled:n||r&&le,placeholder:i,enterKeyHint:a?`send`:N?.enterKeyHint,outerClassName:y(`ring-0 bg-transparent shadow-none hover:bg-transparent focus-within:ring-0`,U&&`flex-none`,B&&`min-h-0 flex-1`,re),className:y(`relative z-10 resize-none overflow-y-hidden appearance-none border-0 bg-transparent typography-markdown hover:border-transparent md:typography-ui-label`,U?`field-sizing-fixed min-h-12 max-h-32 px-3 py-3 leading-6`:`min-h-[52px] max-h-40 rounded-b-none px-3 pb-2 pt-4`,te,P,D&&`text-transparent caret-[var(--surface-foreground)]`),style:L,rows:N?.rows??1})]})]}),U?(0,M.jsx)(`div`,{className:y(`flex h-12 shrink-0 items-center pr-1.5`,ae),style:R,"data-composer-inline-send":`true`,children:C??Ne}):(0,M.jsx)(ge,{className:ae,style:R,children:T??(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:`flex items-center gap-1.5`,children:x??Oe}),b?(0,M.jsx)(`div`,{className:`min-w-0 flex-1 truncate typography-micro text-muted-foreground`,children:b}):(0,M.jsx)(`div`,{className:`flex-1`}),(0,M.jsx)(`div`,{className:`flex items-center gap-1.5`,children:C??Ne})]})})]}),J&&l?(0,M.jsx)(ie,{id:`mobile-attach-pick-${Se}`,open:K,onOpenChange:e=>{e||q(!1)},onPickPhotos:Q,onPickFiles:()=>Z(be.current)}):null]})},ve={dictation:102,mentionFile:100,mentionAgent:100,mentionSession:100,mentionCommand:100,mentionPaste:100,code:90,codeFence:90,link:80,linkUrl:78,heading:70,blockquote:40,listMarker:35,marker:10},K={dictation:`text-foreground underline decoration-current underline-offset-4`,mentionFile:`text-[var(--primary)]`,mentionAgent:`text-[var(--primary)]`,mentionSession:`text-[var(--primary)]`,mentionCommand:`text-[var(--primary)]`,mentionPaste:`text-[var(--primary)]`,code:`rounded-[3px] bg-[var(--surface-subtle)] text-[var(--markdown-inline-code)]`,codeFence:`bg-[var(--surface-subtle)] text-[var(--markdown-inline-code)]`,link:`text-[var(--status-info)] underline`,linkUrl:`text-muted-foreground`,heading:`text-[var(--syntax-keyword)]`,blockquote:`text-muted-foreground`,listMarker:`text-[var(--syntax-keyword)]`,marker:`text-muted-foreground`},q=`text-foreground`;function J(e,t){if(!e||t.length===0)return null;let n=e.length,r=new Set([0,n]);for(let e of t)e.start>0&&e.start<n&&r.add(e.start),e.end>0&&e.end<n&&r.add(e.end);let i=[...r].sort((e,t)=>e-t),a=t.map((e,t)=>({range:e,index:t})).filter(e=>e.range.end>e.range.start).sort((e,t)=>e.range.start-t.range.start),s=[],c=[],l=0;for(let t=0;t<i.length-1;t+=1){let n=i[t],r=i[t+1];if(r<=n)continue;for(;l<a.length&&a[l].range.start<=n;)c.push(a[l]),l+=1;for(let e=c.length-1;e>=0;--e)c[e].range.end<=n&&c.splice(e,1);let u=null,d=-1,f=1/0;for(let{range:e,index:t}of c){let n=e.priority??ve[e.style];(n>d||n===d&&t<f)&&(d=n,f=t,u=e)}let p=u?u.className??K[u.style]:q,m=e.slice(n,r),h=u?.visual,g=u?.skillName,_=s[s.length-1];_&&_.className===p&&o(_.visual,h)&&_.skillName===g?_.text+=m:s.push({text:m,className:p,visual:h,skillName:g})}return s.length>0?s:null}function ye(e,t){let n=new Set(Array.from(t,e=>e.toLowerCase())),r=[];for(let t of[/(^|\s)\/(\u2003)?([a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?)/gi,/(^|\s)@(\u2003)?([a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?)(?=$|\s|[),.;:!?])/gi]){let i;for(;(i=t.exec(e))!==null;){let e=i[2]??``,t=i[3]||``;if(!n.has(t.toLowerCase()))continue;let a=i.index+(i[1]?.length??0);r.push({start:a,end:a+1+e.length+t.length,name:t})}}return r}function Y(e,t,n){if(e===t){let t=n.find(t=>e>t.start&&e<t.end);return t?{start:t.start,end:t.end}:null}let r=n.filter(n=>n.start<t&&n.end>e);return r.length===0?null:{start:Math.min(e,...r.map(e=>e.start)),end:Math.max(t,...r.map(e=>e.end))}}function be(e,t,n){let r=ye(e,t),i=Math.max(0,Math.min(n.selectionStart,e.length)),a=Math.max(i,Math.min(n.selectionEnd,e.length)),o=i,s=a;if(i===a)if(n.altKey)if(n.key===`Backspace`){for(;o>0&&/\s/.test(e[o-1]);)--o;for(;o>0&&!/\s/.test(e[o-1]);)--o}else{for(;s<e.length&&/\s/.test(e[s]);)s+=1;for(;s<e.length&&!/\s/.test(e[s]);)s+=1}else n.key===`Backspace`?o=Math.max(0,i-1):s=Math.min(e.length,i+1);if(o===s)return null;let c=r.filter(e=>e.start<s&&e.end>o);if(c.length===0)return null;let l=Math.min(o,...c.map(e=>e.start)),u=Math.max(s,...c.map(e=>e.end));return u<e.length&&/\s/.test(e[u])&&(l===0||/\s/.test(e[l-1]))?u+=1:u===e.length&&l>0&&/\s/.test(e[l-1])&&--l,{text:`${e.slice(0,l)}${e.slice(u)}`,caret:l,removedSkillNames:c.map(e=>e.name)}}function xe(e){return e.map(e=>({start:e.start,end:e.end,style:e.kind===`file`?`mentionFile`:e.kind===`session`?`mentionSession`:`mentionAgent`,visual:e.kind===`session`&&e.label?t({trigger:`@`,icon:`chat-thread`,label:e.label},i({trigger:`@`,icon:`chat-thread`,label:e.label})):void 0}))}function Se(e){let t=(0,j.c)(28),{visual:i,text:a}=e,o=i.trigger.length,s=o+i.label.length,c=s+(i.suffix?.length??0),l;t[0]!==s||t[1]!==o||t[2]!==a?(l=a.slice(o,Math.min(s,a.length)),t[0]=s,t[1]=o,t[2]=a,t[3]=l):l=t[3];let u=l,d;t[4]!==s||t[5]!==c||t[6]!==a?(d=a.slice(s,Math.min(c,a.length)),t[4]=s,t[5]=c,t[6]=a,t[7]=d):d=t[7];let f=d,p;t[8]!==c||t[9]!==a?(p=a.slice(Math.min(c,a.length)),t[8]=c,t[9]=a,t[10]=p):p=t[10];let m=p,h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(h={left:n,right:n},t[11]=h):h=t[11];let g=i.icon,_;t[12]===g?_=t[13]:(_=(0,M.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 inline-flex items-center justify-center`,style:h,children:(0,M.jsx)(w,{name:g,className:`${r} shrink-0 text-[var(--primary)]`,"aria-hidden":`true`})}),t[12]=g,t[13]=_);let v;t[14]!==_||t[15]!==i.trigger?(v=(0,M.jsxs)(`span`,{className:`relative inline-block align-baseline text-transparent leading-none`,children:[i.trigger,_]}),t[14]=_,t[15]=i.trigger,t[16]=v):v=t[16];let y;t[17]===u?y=t[18]:(y=(0,M.jsx)(`span`,{children:u}),t[17]=u,t[18]=y);let b;t[19]===f?b=t[20]:(b=f?(0,M.jsx)(`span`,{className:`text-transparent`,children:f}):null,t[19]=f,t[20]=b);let x;t[21]===m?x=t[22]:(x=m?(0,M.jsx)(`span`,{className:`text-transparent`,children:m}):null,t[21]=m,t[22]=x);let S;return t[23]!==x||t[24]!==v||t[25]!==y||t[26]!==b?(S=(0,M.jsxs)(M.Fragment,{children:[v,y,b,x]}),t[23]=x,t[24]=v,t[25]=y,t[26]=b,t[27]=S):S=t[27],S}var Ce=e=>({text:e.text,references:e.references.map(e=>({...e}))}),we=e=>e.map(e=>({...e,range:{...e.range}})),X=(e,t)=>e.text===t.text&&JSON.stringify(e.references)===JSON.stringify(t.references),Te=(e,t,n)=>({document:Ce(e),mentions:we(t),selection:{...n}}),Z=()=>({undo:[],redo:[]}),Q=(e,t)=>({undo:[...e.undo,t].slice(-100),redo:[]}),$=(e,t)=>{let n=e.undo.at(-1);return!n||!X(n.after.document,t)?null:{history:{undo:e.undo.slice(0,-1),redo:[...e.redo,n]},snapshot:Te(n.before.document,n.before.mentions,n.before.selection)}},Ee=(e,t)=>{let n=e.redo.at(-1);return!n||!X(n.before.document,t)?null:{history:{undo:[...e.undo,n],redo:e.redo.slice(0,-1)},snapshot:Te(n.after.document,n.after.mentions,n.after.selection)}},De=e=>{if(e.altKey||e.ctrlKey||e.metaKey)return!1;switch(e.key){case`ArrowUp`:case`PageUp`:case`Home`:return!0;default:return!1}},Oe=(e,t,n)=>{let r=t instanceof Element?t:t instanceof Node?t.parentElement:null;for(;r&&r!==e;){if(r instanceof HTMLElement){let e=r.scrollHeight-r.clientHeight;if(e>1&&(n===`up`?r.scrollTop>0:r.scrollTop<e-1))return!0}r=r.parentElement}return!1},ke=(e,t)=>Oe(e,t,`up`),Ae=(e,t)=>Oe(e,t,`down`),je=e=>{let t=(0,j.c)(15),{scrollRef:n,enabled:r,onUpwardIntent:i}=e,a=r===void 0||r,o=A.useRef(null),s;t[0]===i?s=t[1]:(s=()=>{i()},t[0]=i,t[1]=s);let c=g(s),l;t[2]!==c||t[3]!==n?(l=e=>{let t=n.current;t&&(e.deltaY>=0||t instanceof HTMLElement&&(ke(t,e.target)||c()))},t[2]=c,t[3]=n,t[4]=l):l=t[4];let u=g(l),d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>{let t=e.touches.item(0);o.current=t?t.clientY:null},t[5]=d):d=t[5];let f=g(d),p;t[6]!==c||t[7]!==n?(p=e=>{let t=n.current,r=e.touches.item(0);if(!r){o.current=null;return}let i=o.current;o.current=r.clientY,i!==null&&(r.clientY-i<=2||!t||!(t instanceof HTMLElement)||ke(t,e.target)||c())},t[6]=c,t[7]=n,t[8]=p):p=t[8];let m=g(p),h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{o.current=null},t[9]=h):h=t[9];let v=g(h),y;t[10]===c?y=t[11]:(y=e=>{De(e)&&c()},t[10]=c,t[11]=y);let b=g(y),[x,S]=A.useState(null),C;t[12]===n?C=t[13]:(C=()=>{let e=n.current??null;S(t=>t===e?t:e)},t[12]=n,t[13]=C),A.useEffect(C);let w=a&&x?x:Me,T;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(T={passive:!0},t[14]=T):T=t[14];let ee=T;_(`wheel`,u,w,ee),_(`touchstart`,f,w,ee),_(`touchmove`,m,w,ee),_(`touchend`,v,w,ee),_(`touchcancel`,v,w,ee),_(`keydown`,b,w)};function Me(){}var Ne=e=>{if(typeof e!=`number`||!Number.isFinite(e))return;let t=Math.trunc(e);return t>=0?t:void 0},Pe=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.summary;return!t||typeof t!=`object`||Array.isArray(t)?null:t},Fe=e=>{let t=Ne(e);return t!==void 0&&t>0?t:void 0};function Ie(e){let t=Pe(e);if(!t)return null;let n=Fe(t.additions),r=Fe(t.deletions),i=Fe(t.files)??Fe(t.diffCount);return n===void 0&&r===void 0&&i===void 0?null:{...n===void 0?{}:{additions:n},...r===void 0?{}:{deletions:r},...i===void 0?{}:{files:i}}}function Le(e){if(!e)return null;let t=[];return e.additions!==void 0&&e.additions>0&&t.push(`+${e.additions}`),e.deletions!==void 0&&e.deletions>0&&t.push(`−${e.deletions}`),t.length>0?t.join(` `):null}function Re(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=typeof t.providerID==`string`?t.providerID.trim():``,r=typeof t.modelID==`string`?t.modelID.trim():``;if(n&&r)return`${n}/${r}`;let i=t.model;if(typeof i==`string`&&i.trim())return i.trim();if(i&&typeof i==`object`&&!Array.isArray(i)){let e=i,t=typeof e.providerID==`string`?e.providerID.trim():typeof e.provider==`string`?e.provider.trim():``,n=typeof e.modelID==`string`?e.modelID.trim():typeof e.id==`string`?e.id.trim():``;if(t&&n)return`${t}/${n}`}return null}function ze(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e;if(typeof t.branch==`string`&&t.branch.trim())return t.branch.trim();let n=t.project;if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n.branch;if(typeof e==`string`&&e.trim())return e.trim()}return null}export{ne as A,H as C,le as D,de as E,F as M,ae as O,W as S,fe as T,xe as _,De as a,G as b,je as c,Q as d,Ee as f,ye as g,J as h,Re as i,I as j,ie as k,Te as l,Se as m,ze as n,Ae as o,$ as p,Ie as r,ke as s,Le as t,Z as u,Y as v,V as w,pe as x,be as y};