@icanbwell/baileyai-chat-ui 1.0.26 → 1.0.28
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.
- package/dist/baileyai-chat-ui.cjs +1 -1
- package/dist/baileyai-chat-ui.js +1 -1
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -9,4 +9,4 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
|
|
|
9
9
|
`);if(o===`[DONE]`){i=!0;continue}let s;try{s=JSON.parse(o)}catch{s=void 0}let c=s;if(n===`error`){let e=typeof c?.message==`string`?c.message:o;r.push({type:`error`,message:e})}else if(c?.type===`response.output_text.delta`&&typeof c.delta==`string`){let e=T(c.delta);e&&r.push({type:`response.output_text.delta`,delta:e})}else c&&typeof c.type==`string`?r.push(c):n!==`message`&&r.push({type:`info`,message:`${n}: ${o}`})}return{events:r,remainder:n,done:i}}var D={inaccurate:!0,unhelpful:!0,unsafe:!0,too_long:!0,other:!0},O=e=>Object.hasOwn(D,e)?e:`other`;function k(e){if(!e||e.rating!==`up`&&e.rating!==`down`)return;let t=(e.reasonCodes??[]).map(O);return{rating:e.rating,...t.length>0?{reasonCodes:t}:{},...e.comment?{comment:e.comment}:{}}}function A(e){let t=[];return e.messages.forEach((e,n)=>{if(e.hidden||e.role!==`user`&&e.role!==`assistant`)return;let r=Date.parse(e.createdAt),i=Number.isNaN(r)?void 0:r,a=e.messageId||`loaded-${n}-${e.role}-${i??0}`,o=e.role===`assistant`?k(e.feedback):void 0;t.push({id:a,role:e.role,content:e.content,streaming:!1,...i===void 0?{}:{createdAt:i},...e.role===`assistant`&&e.messageId?{serverMessageId:e.messageId}:{},...o?{feedback:o}:{}})}),t}var j=e=>e.serverMessageId??e.id;function ee(e){let t=new Set(e.current.map(j)),n=e.earlier.filter(e=>!t.has(j(e)));return n.length===0?e.current:[...n,...e.current]}function M(e){let t=e.sub.trim();if(!t)return!1;let n=`${t}:`;return e.conversationId.startsWith(n)&&e.conversationId.length>n.length}var te=`baileyai-chat-ui:conversation`;function ne(){return{get:e=>window.sessionStorage.getItem(e),set:(e,t)=>window.sessionStorage.setItem(e,t),remove:e=>window.sessionStorage.removeItem(e)}}function re(){let e=new Map;return{get:t=>e.get(t)??null,set:(t,n)=>void e.set(t,n),remove:t=>void e.delete(t)}}var N=200,ie=100,P=15e4,F=()=>typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`bailey-${Date.now()}-${Math.random().toString(36).slice(2)}`,ae=(e,t,n)=>{if(e===401||e===403)return`Bailey isn't reachable with your current login.`;let r=`Bailey request failed (status ${e??`network error`}).`,i=(n||t||``).trim();return i?`${r} ${i.length>N?`${i.slice(0,N)}…`:i}`:r};function I(e,t,n){if(e)try{return e.get(t)||void 0}catch(e){n(e,`read`);return}}function oe(e,t){t.signal.aborted||typeof e!=`string`||(t.historyStatus=e)}function se(e,t,n,r){try{e?.set(t,n)}catch(e){r(e,`write`)}}function L(e,t,n){try{e?.remove(t)}catch(e){n(e,`remove`)}}var R=(e,t)=>t?`${e}:${t}`:e;function ce(e){let{seed:t,sub:n,storage:r,key:i,report:a}=e;if(!n)return t||I(r,i,a);if(t&&M({conversationId:t,sub:n}))return t;let o=I(r,i,a);if(o){if(M({conversationId:o,sub:n}))return o;L(r,i,a)}}var le=({transport:e,model:t,instructions:n,tools:r=[],toolChoice:i,firstUserMessagePrefix:a,onAssistantMessageComplete:o,idleTimeoutMs:s=P,client:c,conversationId:u,sub:d,storage:f,storageKey:p=te,sendFullTranscript:m=!1,onStorageError:h,onContextLoss:g})=>{let[_,v]=(0,l.useState)([]),[y,b]=(0,l.useState)([]),[x,S]=(0,l.useState)(null),[C,T]=(0,l.useState)(`idle`),[D,O]=(0,l.useState)(null),k=d!==void 0&&d.trim()===``,j=k?void 0:d?.trim()||void 0,re=(0,l.useMemo)(()=>ne(),[]),N=k?null:f===void 0?re:f||null,I=(0,l.useRef)(h),le=(0,l.useRef)(g);(0,l.useEffect)(()=>{I.current=h,le.current=g},[h,g]);let z=(0,l.useCallback)((e,t)=>{try{I.current?.(e,t)}catch{}},[]),B=e=>ce({seed:u,sub:j,storage:N,key:R(p,j),report:e}),[V]=(0,l.useState)(()=>{let e=[];return{id:B((t,n)=>void e.push({error:t,operation:n})),errors:e}}),[ue,H]=(0,l.useState)(V.id),[de,fe]=(0,l.useState)(V.errors.length>0),U=(0,l.useCallback)((e,t)=>{fe(!0),z(e,t)},[z]);(0,l.useEffect)(()=>{V.errors.forEach(({error:e,operation:t})=>z(e,t))},[V,z]),(0,l.useEffect)(()=>{k&&z(Error(`sub is blank`),`key`)},[k,z]);let W=(0,l.useRef)(ue),G=(0,l.useRef)({storage:N,key:R(p,j),sub:j,sendFullTranscript:m});(0,l.useEffect)(()=>{G.current={storage:N,key:R(p,j),sub:j,sendFullTranscript:m}},[N,p,j,m]);let pe=f===!1?`off`:de||k?`degraded`:`ok`,[me,K]=(0,l.useState)(!1),[he,q]=(0,l.useState)(`idle`),[J,ge]=(0,l.useState)(!1),Y=(0,l.useRef)(0),X=(0,l.useRef)(null),_e=(0,l.useRef)(null),Z=(0,l.useRef)(!1),ve=(0,l.useCallback)(()=>{Y.current+=1,X.current?.abort(),X.current=null,_e.current=null,Z.current=!1,ge(!1),q(`idle`)},[]),ye=(0,l.useRef)(c);(0,l.useEffect)(()=>{ye.current=c},[c]),(0,l.useEffect)(()=>()=>X.current?.abort(),[]);let be=(0,l.useRef)(null),xe=(0,l.useRef)(``),Se=(0,l.useRef)(0),Ce=(0,l.useRef)([]);(0,l.useEffect)(()=>{Ce.current=_},[_]);let Q=(0,l.useRef)([]),we=(0,l.useRef)(new Map),Te=(0,l.useRef)(new Map),Ee=(0,l.useRef)(null),De=(0,l.useCallback)(()=>{Ee.current!==null&&(clearTimeout(Ee.current),Ee.current=null)},[]),Oe=(0,l.useCallback)(e=>{De(),Ee.current=setTimeout(()=>{e.abort(new DOMException(`The assistant took too long to respond. Please try again.`,`TimeoutError`))},s)},[De,s]);(0,l.useEffect)(()=>()=>{be.current?.abort(),De()},[De]);let ke=(0,l.useCallback)(({reportedId:e,source:t,turn:n})=>{if(n.signal.aborted||typeof e!=`string`||!e)return;if(t===`event`)n.reportedId=e,n.reportedFromEvent=!0;else if(!n.reportedFromEvent)n.reportedId=e;else return;if(n.heldId||e===W.current)return;let{sub:r,storage:i,key:a}=G.current;r&&!M({conversationId:e,sub:r})||(W.current=e,H(e),se(i,a,e,U))},[U]),Ae=(0,l.useCallback)((e,t,n,r)=>{let i=e=>{n.push(e),b(t=>[...t,e])};if(t.type===`response.output_text.delta`){if(!t.delta)return!1;let n=we.current.get(e)??{raw:``,emittedCount:0};n.raw+=t.delta;let{cleanedText:r,matches:a}=w(n.raw),o=r.trim(),s=a.slice(n.emittedCount);if(n.emittedCount=a.length,we.current.set(e,n),Te.current.set(e,o),v(t=>t.map(t=>t.id===e?{...t,content:o}:t)),s.length>0){let e=Date.now(),t=Se.current;s.forEach(n=>i({kind:`pseudo_tool_call`,name:n.name,args:n.args,at:e,turnSentAt:t}))}return!0}if(t.type===`response.output_item.added`||t.type===`response.output_item.done`){let n=t.item;if(n.type===`output_image`)return n.image_url&&v(t=>t.map(t=>t.id===e?{...t,parts:[...t.parts??[],{type:`image`,src:n.image_url}]}:t)),!0;if(n.type===`function_call`||n.type===`mcp_call`){let e=Date.now(),r=Se.current,a=n.name||`unknown_tool`;return i(t.type===`response.output_item.added`?{kind:`tool_start`,name:a,args:n.arguments,at:e,turnSentAt:r,callId:n.call_id,displayName:n.display_name}:{kind:`tool_end`,name:a,args:n.arguments,at:e,turnSentAt:r,callId:n.call_id,displayName:n.display_name,output:n.output,isError:n.is_error,runtimeSeconds:n.runtime_seconds,structuredOutput:n.structured_output}),!0}if(n.type===`llm_call`){let e=Date.now(),r=Se.current;return i(t.type===`response.output_item.added`?{kind:`llm_call_start`,request:n.request??[],at:e,turnSentAt:r}:{kind:`llm_call_end`,response:n.output,at:e,turnSentAt:r}),!0}return!1}if(t.type===`task.progress`)return i({kind:`progress`,status:t.status,message:t.message,at:Date.now(),turnSentAt:Se.current}),!0;if(t.type===`response.output_text.done`)return!1;if(t.type===`response.created`)return ke({reportedId:t.response?.conversation?.id,source:`event`,turn:r}),oe(t.response?.conversation?.history_status,r),!1;if(t.type===`response.completed`){ke({reportedId:t.response?.conversation?.id,source:`event`,turn:r}),oe(t.response?.conversation?.history_status,r);let n=typeof t.message_id==`string`&&t.message_id?t.message_id:void 0;n&&v(t=>t.map(t=>t.id===e?{...t,serverMessageId:n}:t));let i=we.current.get(e);if(i){let{cleanedText:t}=w(i.raw,{hideOpenBlock:!1}),n=t.trim();n!==Te.current.get(e)&&(Te.current.set(e,n),v(t=>t.map(t=>t.id===e?{...t,content:n}:t)))}return!1}if(t.type===`info`)return i({kind:`info`,message:t.message,at:Date.now(),turnSentAt:Se.current}),!0;if(t.type===`mcp_app`){let n=t.resourceUri;if(!n)return i({kind:`raw`,eventType:t.type,raw:JSON.stringify(t),at:Date.now(),turnSentAt:Se.current}),!0;let{html:r,title:a,csp:o,permissions:s,prefersBorder:c,displayMode:l}=t;return v(t=>t.map(t=>t.id===e?{...t,parts:[...t.parts??[],{type:`mcp_app`,html:r,title:a,resourceUri:n,csp:o,permissions:s,prefersBorder:c,displayMode:l}]}:t)),!0}return i({kind:`raw`,eventType:t.type,raw:JSON.stringify(t),at:Date.now(),turnSentAt:Se.current}),!0},[ke]),je=(0,l.useCallback)(async s=>{T(`streaming`),O(null),K(!1);let c=Date.now();Se.current=c;let l=F(),u={id:l,role:`assistant`,content:``,streaming:!0,createdAt:c};v(e=>[...e,u]),Q.current=[...s,u];let d=s.findIndex(e=>e.role===`user`&&!e.hidden),f=s.map((e,t)=>t===d&&a?{role:e.role,content:`${a}${e.content}`,hidden:e.hidden,titleHint:e.titleHint}:{role:e.role,content:e.content,hidden:e.hidden,titleHint:e.titleHint}),{sendFullTranscript:p}=G.current,m=p?void 0:W.current,h=m?f.slice(-1):f;S({model:t,systemPrompt:n,messages:h,tools:r,toolChoice:i,stream:!0,sentAt:c,streamStats:{chunkCount:0,firstChunkAt:null,lastChunkAt:null}});let g=new AbortController;be.current=g,Oe(g);let _={signal:g.signal,heldId:m},y=``,x=null,C=!1,w=!1,D=!1,k=[],A=(e,t)=>{T(`error`),O(e);let n={kind:`error`,message:e,at:Date.now(),turnSentAt:c,...t};k.push(n),b(e=>[...e,n])},j=(e,t)=>{e.forEach(e=>{if(e.type===`error`){x=e.message;let t={kind:`error`,message:e.message,at:Date.now(),turnSentAt:c};k.push(t),b(e=>[...e,t]);return}e.type===`response.output_text.delta`&&e.delta&&(D=!0),Ae(l,e,k,_)&&(w=!0)}),t&&(C=!0,v(e=>e.map(e=>e.id===l?{...e,streaming:!1}:e)))};try{let{status:a,text:s,errorMessage:u,errorKind:d,interrupted:f}=await e.streamChat({model:t,instructions:n,input:h,tools:r,toolChoice:i,...m?{conversationId:m}:{},onConversationId:e=>ke({reportedId:e,source:`header`,turn:_}),signal:g.signal,onChunk:e=>{Oe(g),y+=e;let{events:t,remainder:n,done:r}=E(y);y=n,j(t,r);let i=Date.now();S(e=>e&&e.sentAt===c?{...e,streamStats:{chunkCount:e.streamStats.chunkCount+1,firstChunkAt:e.streamStats.firstChunkAt??i,lastChunkAt:i}}:e)},onRequestId:e=>{S(t=>t&&t.sentAt===c?{...t,requestId:e}:t)},onMessageId:e=>{typeof e==`string`&&e&&v(t=>t.map(t=>t.id===l?{...t,serverMessageId:e}:t))}});if(y.trim()){let{events:e,done:t}=E(`${y}\n\n`);y=``,j(e,t)}if(x){T(`error`),O(x);return}if(d===`timeout`&&!C){A(u||`The assistant took too long to respond. Please try again.`,{source:`client-timeout`});return}if(f&&!C){A(`The connection was interrupted before the answer finished. Try again.`);return}if(a===void 0||a>=400){A(ae(a,s,u),{httpStatus:a,rawBody:s||void 0});return}let p=_.reportedId,b=p!==m,ee=_.historyStatus===`failed`||_.historyStatus===`empty`;if(m&&!_.signal.aborted&&(b||ee)){W.current=void 0,H(void 0),L(G.current.storage,G.current.key,U),ve(),K(!0);try{le.current?.({sentId:m,...p?{reportedId:p}:{},reason:b?`id`:`history`})}catch{}}if(!w){A(`Bailey returned an empty response.`);return}if(!D){A(`Bailey ran some tools but didn't return an answer. Try asking again.`);return}T(`idle`);let M=Te.current.get(l)??``;S(e=>e&&e.sentAt===c?{...e,response:{content:M}}:e),o&&await o({id:l,role:`assistant`,content:M,streaming:!1},k)}catch(e){let t=e;if(t?.name===`TimeoutError`){A(t.message,{source:`client-timeout`});return}if(t?.name===`AbortError`){T(`idle`);return}A(t?.message||`Bailey request failed.`)}finally{De();let e=Te.current.get(l)??``;we.current.delete(l),Te.current.delete(l);let t=k.some(e=>e.kind===`tool_start`||e.kind===`tool_end`);v(e=>e.flatMap(e=>e.id===l?e.content||t?[{...e,streaming:!1}]:[]:[e])),Q.current=Q.current.flatMap(t=>t.id===l?e?[{...t,content:e,streaming:!1}]:[]:[t])}},[e,t,n,r,i,a,o,Ae,ke,Oe,De,U,ve]),$=(0,l.useCallback)(e=>{Ce.current=e,v(e)},[]),Me=(0,l.useCallback)(e=>{let t=e.trim();if(!t)return;xe.current=t;let n={id:F(),role:`user`,content:t,createdAt:Date.now()},r=[...Q.current,n];Q.current=r,$([...Ce.current,n]),je(r)},[je,$]),Ne=(0,l.useCallback)((e,t)=>{if(C===`streaming`)return;let n=e.trim();if(!n)return;xe.current=n;let r=t?.trim(),i={id:F(),role:`user`,content:n,createdAt:Date.now(),hidden:!0,...r?{titleHint:r}:{}},a=[...Q.current,i];Q.current=a,je(a)},[je,C]),Pe=(0,l.useCallback)(()=>{be.current?.abort()},[]),Fe=(0,l.useCallback)(()=>{if(C===`streaming`||!xe.current)return;let e=Ce.current,t=e[e.length-1],n=t&&t.role===`assistant`?e.slice(0,-1):e;$(n);let r=Q.current,i=r[r.length-1],a=i&&i.role===`assistant`?r.slice(0,-1):r;Q.current=a,je(a)},[je,$,C]),Ie=(0,l.useCallback)(()=>b([]),[]),Le=(0,l.useCallback)(()=>{O(null),T(e=>e===`error`?`idle`:e)},[]),Re=(0,l.useCallback)(()=>{be.current?.abort(),ve(),K(!1),$([]),Q.current=[],b([]),S(null),T(`idle`),O(null),xe.current=``},[ve,$]),ze=(0,l.useCallback)(()=>{Re(),W.current=void 0,H(void 0),L(G.current.storage,G.current.key,U)},[Re,U]),Be=(0,l.useRef)(j);(0,l.useEffect)(()=>{let e=Be.current;if(e===j)return;Be.current=j,e!==void 0&&Re();let t=B(U);W.current=t,H(t)},[j]);let Ve=(0,l.useCallback)(e=>{be.current?.abort();let t=e.filter(e=>e.role===`user`||e.role===`assistant`).map(e=>({...e,streaming:!1}));$(t.filter(e=>!e.hidden)),Q.current=t,b([]),S(null),T(`idle`),O(null),xe.current=``},[$]),He=(0,l.useCallback)(e=>{ve(),Ve(e)},[ve,Ve]),Ue=(0,l.useCallback)(e=>{W.current=e,H(e),se(G.current.storage,G.current.key,e,U),K(!1)},[U]),We=(0,l.useCallback)(e=>{let t=e.hasMoreBefore&&e.nextBeforeAbsoluteIndex!==null;_e.current=t?e.nextBeforeAbsoluteIndex:null,ge(t)},[]);return{conversationId:ue,persistence:pe,contextLost:me,messages:_,traceEvents:y,lastRequest:x,status:C,error:D,send:Me,sendHidden:Ne,stop:Pe,retryLast:Fe,clearTrace:Ie,clearError:Le,newChat:ze,loadMessages:He,loadConversation:(0,l.useCallback)(async({conversationId:e})=>{let t=ye.current,{sub:n}=G.current,r=!!e&&(!n||M({conversationId:e,sub:n}));if(!t||!r)throw q(`error`),Error(t?`invalid conversation id`:`no client`);be.current?.abort(),ve();let i=Y.current,a=new AbortController;X.current=a,q(`loading`);try{let n=await t.getConversation({conversationId:e,limit:ie,signal:a.signal});if(i!==Y.current)return;Ve(A({messages:n.messages})),Ue(e),We(n),q(`idle`)}catch(e){if(i!==Y.current)return;throw q(`error`),e}},[We,ve,Ue,Ve]),loadEarlier:(0,l.useCallback)(async()=>{let e=ye.current,t=W.current,n=_e.current;if(!e||!t||n===null||Z.current)return;let r=Y.current,i=new AbortController;X.current=i,Z.current=!0,q(`loading`);try{let a=await e.getConversation({conversationId:t,limit:ie,beforeAbsoluteIndex:n,signal:i.signal});if(r!==Y.current)return;let o=A({messages:a.messages});Q.current=ee({current:Q.current,earlier:o}),v(e=>{let t=ee({current:e,earlier:o});return Ce.current=t,t}),We(a),q(`idle`)}catch(e){if(r!==Y.current)return;throw q(`error`),e}finally{r===Y.current&&(Z.current=!1)}},[We]),hasEarlier:J,historyStatus:he}},z=class extends Error{status;kind;constructor(e){super(e.message??B(e),e.cause===void 0?void 0:{cause:e.cause}),this.name=`BaileyApiError`,this.status=e.status,this.kind=e.kind}};function B(e){switch(e.kind){case`http`:return`Bailey request failed (status ${e.status})`;case`timeout`:return`Bailey request timed out`;case`aborted`:return`Bailey request aborted`;case`invalid-response`:return`Bailey returned an unreadable response (status ${e.status})`;default:return`Bailey request failed (network error)`}}var V=class extends Error{operation;constructor(e){super(`Bailey cleanup failed (${e.operation})`),this.name=`BaileyCleanupError`,this.operation=e.operation}},ue=e=>e instanceof z?e:new z({status:0,kind:`network`});function H(e){let{pageSize:t,enabled:n=!0}=e,[r,i]=(0,l.useState)([]),[a,o]=(0,l.useState)(n?`loading`:`idle`),[s,c]=(0,l.useState)(null),[u,d]=(0,l.useState)(null),f=(0,l.useRef)(e.client),p=(0,l.useRef)([]);(0,l.useEffect)(()=>{f.current=e.client,p.current=r});let m=(0,l.useRef)(null),h=(0,l.useRef)(null),g=(0,l.useCallback)(async e=>{h.current?.abort();let n=new AbortController;h.current=n,o(`loading`);try{let r=await f.current.listConversations({...t===void 0?{}:{limit:t},cursor:e===`append`?m.current??void 0:void 0,signal:n.signal});if(n.signal.aborted)return;i(t=>{if(e===`replace`)return r.conversations;let n=new Set(t.map(e=>e.conversationId));return[...t,...r.conversations.filter(e=>!n.has(e.conversationId))]}),m.current=r.nextCursor,d(r.nextCursor),c(null),o(`idle`)}catch(e){if(n.signal.aborted)return;c(ue(e)),o(`error`)}},[t]);(0,l.useEffect)(()=>{if(n)return g(`replace`),()=>h.current?.abort()},[n,g]);let _=(0,l.useCallback)(()=>g(`replace`),[g]),v=(0,l.useCallback)(async()=>{m.current!==null&&await g(`append`)},[g]),y=(0,l.useCallback)(async({conversationId:e})=>{let t=p.current.findIndex(t=>t.conversationId===e),n=t===-1?void 0:{row:p.current[t],index:t};i(t=>t.filter(t=>t.conversationId!==e));try{await f.current.deleteConversation({conversationId:e})}catch(t){if(!n)throw t;let{row:r,index:a}=n;throw i(t=>{if(t.some(t=>t.conversationId===e))return t;let n=[...t];return n.splice(Math.min(a,n.length),0,r),n}),t}},[]);return{conversations:r,status:a,error:s,hasMore:u!==null,refresh:_,loadMore:v,remove:y}}function de(e){return e.replace(/\/+$/,``)}function fe(e,t){let n=new URLSearchParams;for(let[e,r]of Object.entries(t))r!==void 0&&n.set(e,String(r));let r=n.toString();return r?`${e}?${r}`:e}var U={responses(e){return`${de(e)}/responses`},conversations(e,t){return fe(`${de(e)}/conversations`,{limit:t.limit,cursor:t.cursor})},conversation(e,t,n){return fe(`${de(e)}/conversations/${encodeURIComponent(t)}`,{limit:n.limit,before_absolute_index:n.beforeAbsoluteIndex})},feedback(e,t,n){return`${de(e)}/conversations/${encodeURIComponent(t)}/messages/${encodeURIComponent(n)}/feedback`}};function W(e){return{status:void 0,text:``,errorMessage:`Request failed`,errorKind:`network`,...e?{errorCause:e.cause}:{}}}var G=`The assistant took too long to respond. Please try again.`;function pe(e){return{status:e.status,text:``,errorMessage:G,errorKind:`timeout`,errorCause:e.cause,...e.status===void 0?{}:{interrupted:!0}}}var me=3e4,K=155e3,he=`x-chat-id`,q=`header`,J=`body`,ge=`x-request-id`,Y=`x-conversation-id`,X=`x-message-id`,_e=e=>e&&typeof e==`object`?e:{},Z=(e,t=``)=>typeof e==`string`?e:t,ve=(e,t=0)=>typeof e==`number`?e:t;function ye(e){let t=_e(e);return{conversationId:Z(t.conversation_id),title:typeof t.title==`string`?t.title:null,status:Z(t.status),messageCount:ve(t.message_count),createdAt:Z(t.created_at),updatedAt:Z(t.updated_at)}}function be(e){if(!e||typeof e!=`object`)return null;let t=_e(e);return{rating:Z(t.rating),reasonCodes:Array.isArray(t.reason_codes)?t.reason_codes.filter(e=>typeof e==`string`):[],comment:typeof t.comment==`string`?t.comment:null,...typeof t.updated_at==`string`?{updatedAt:t.updated_at}:{}}}function xe(e){let t=_e(e);return{messageId:Z(t.message_id),role:Z(t.role),content:Z(t.content),hidden:t.hidden===!0,createdAt:Z(t.created_at),feedback:be(t.feedback)}}function Se(e){let t=new AbortController,n=!1,r=setTimeout(()=>{n=!0,t.abort()},e.timeoutMs),i=()=>t.abort(e.caller?.reason);return e.caller?.aborted?i():e.caller?.addEventListener(`abort`,i,{once:!0}),{signal:t.signal,timedOut:()=>n,dispose:()=>{clearTimeout(r),e.caller?.removeEventListener(`abort`,i)}}}function Ce(e){return e.timedOut()?new z({status:0,kind:`timeout`,cause:e.signal.reason}):new z({status:0,kind:`aborted`})}function Q(e){let{baseUrl:t,getHeaders:n,onAuthError:r}=e,i=e.requestTimeoutMs??me,a=e.idleTimeoutMs??K,o=e.conversationVia??q;if(o!==q&&o!==J)throw TypeError(`createBaileyClient: conversationVia must be 'header' or 'body'`);let s=e.fetch??((e,t)=>globalThis.fetch(e,t));function c(t){try{e.onCleanupError?.(new V({operation:t}))}catch{}}function l(e){e.kind===`http`&&(e.status===401||e.status===403)&&r?.(e)}async function u(e){let t=Se({caller:e.signal,timeoutMs:i});try{let r;try{r={Accept:`application/json`,...await n()}}catch{throw new z({status:0,kind:`network`})}if(t.signal.aborted)throw Ce(t);e.body!==void 0&&(r[`Content-Type`]=`application/json`);let i;try{i=await s(e.url,{method:e.method,headers:r,...e.body===void 0?{}:{body:JSON.stringify(e.body)},signal:t.signal})}catch(e){throw t.signal.aborted?Ce(t):new z({status:0,kind:`network`,cause:e})}if(!i.ok)throw i.body?.cancel().catch(()=>c(`cancel-response-body`)),new z({status:i.status,kind:`http`});if(i.status===204){if(e.requireJsonBody)throw new z({status:204,kind:`invalid-response`});return}try{let t=await i.json();if(e.requireJsonBody&&(typeof t!=`object`||!t||Array.isArray(t)))throw new z({status:i.status,kind:`invalid-response`});return t}catch(n){if(n instanceof z)throw n;if(t.timedOut()||t.signal.aborted)throw Ce(t);if(e.requireJsonBody)throw new z({status:i.status,kind:`invalid-response`});return}}catch(e){throw e instanceof z&&l(e),e}finally{t.dispose()}}return{streamChat:async e=>{let r=new AbortController,i=()=>r.abort(e.signal.reason);e.signal.aborted?i():e.signal.addEventListener(`abort`,i,{once:!0});let u,d,f=()=>{clearTimeout(u),u=setTimeout(()=>{d=new DOMException(G,`TimeoutError`),r.abort(d)},a)},p=t=>{if(d&&!e.signal.aborted)return pe({cause:d,status:t});throw r.signal.reason};try{f();let i;try{i={Accept:`text/event-stream`,...await n()}}catch{return W()}if(r.signal.aborted)return p();i[`Content-Type`]=`application/json`,e.conversationId&&o===q&&(i[he]=e.conversationId);let a=e.input[e.input.length-1],u={...a?.hidden===!0?{hidden:!0}:{},...a?.titleHint?{title_hint:a.titleHint}:{}},d={model:e.model,instructions:e.instructions,input:e.input.map(({role:e,content:t})=>({role:e,content:t})),stream:!0,...Object.keys(u).length>0?{metadata:u}:{}};e.conversationId&&o===J&&(d.conversation=e.conversationId),e.tools.length>0&&(d.tools=e.tools),e.toolChoice&&(d.tool_choice=e.toolChoice);let m;try{m=await s(U.responses(t),{method:`POST`,headers:i,body:JSON.stringify(d),signal:r.signal})}catch(e){return r.signal.aborted?p():W({cause:e})}let h=m.headers.get(ge);h&&e.onRequestId?.(h);let g=m.headers.get(X);if(g&&e.onMessageId?.(g),!m.ok){l(new z({status:m.status,kind:`http`}));let e=await m.text().catch(()=>``);return{status:m.status,text:e}}let _=m.headers.get(Y);if(_&&e.onConversationId?.(_),!m.body)return{status:m.status,text:``};let v=m.body.getReader(),y=new TextDecoder,b=()=>void v.cancel(r.signal.reason).catch(()=>c(`cancel-stream-reader`));r.signal.addEventListener(`abort`,b,{once:!0});try{for(;;){let{done:t,value:n}=await v.read();if(r.signal.aborted)return p(m.status);if(t){let t=y.decode();t&&e.onChunk(t);break}f(),e.onChunk(y.decode(n,{stream:!0}))}}catch{if(r.signal.aborted)return p(m.status);if(e.signal.aborted)throw e.signal.reason;return{status:m.status,text:``,errorMessage:`Stream interrupted`,interrupted:!0}}return r.signal.removeEventListener(`abort`,b),{status:m.status,text:``}}finally{clearTimeout(u),e.signal.removeEventListener(`abort`,i)}},async listConversations(e={}){let n=_e(await u({method:`GET`,url:U.conversations(t,e),signal:e.signal,requireJsonBody:!0}));return{conversations:Array.isArray(n.conversations)?n.conversations.map(ye).filter(e=>e.conversationId!==``):[],nextCursor:typeof n.next_cursor==`string`?n.next_cursor:null}},async getConversation(e){let n=_e(await u({method:`GET`,url:U.conversation(t,e.conversationId,e),signal:e.signal,requireJsonBody:!0}));if(!n.conversation||typeof n.conversation!=`object`)throw new z({status:200,kind:`invalid-response`});return{conversation:ye(n.conversation),messages:Array.isArray(n.messages)?n.messages.map(xe):[],hasMoreBefore:n.has_more_before===!0,nextBeforeAbsoluteIndex:typeof n.next_before_absolute_index==`number`?n.next_before_absolute_index:null}},async deleteConversation(e){await u({method:`DELETE`,url:U.conversation(t,e.conversationId,{}),signal:e.signal})},async submitFeedback(e){await u({method:`PUT`,url:U.feedback(t,e.conversationId,e.messageId),body:{rating:e.rating,...e.reasonCodes?{reason_codes:e.reasonCodes}:{},...e.comment===void 0?{}:{comment:e.comment}},signal:e.signal})},async clearFeedback(e){await u({method:`DELETE`,url:U.feedback(t,e.conversationId,e.messageId),signal:e.signal})}}}function we(e){let{client:t,getConversationId:n}=e,r=()=>{let e=n();if(!e)throw Error(`no conversation id`);return e};return{async onSubmit(e){let n=r();await t.submitFeedback({conversationId:n,messageId:e.messageId,rating:e.rating,...e.reasonCodes?{reasonCodes:e.reasonCodes}:{},...e.comment?{comment:e.comment}:{}})},async onClear({messageId:e}){let n=r();await t.clearFeedback({conversationId:n,messageId:e})}}}function Te(...e){return e.filter(e=>!!(e&&e.trim())).join(`
|
|
10
10
|
|
|
11
11
|
`)}var Ee=`call_tool`,De=`a tool`;function Oe(e,t){let n={name:e===Ee?De:e,args:null,viaCallTool:!1};if(!t)return n;let r;try{r=JSON.parse(t)}catch{return n}if(typeof r!=`object`||!r)return n;let i=r;if(e===Ee){let e=typeof i.name==`string`?i.name:void 0;if(!e)return n;let t=i.arguments;return{name:e,args:typeof t==`object`&&t?t:null,viaCallTool:!0}}return{name:e,args:i,viaCallTool:!1}}var ke=5,Ae=e=>e.type===`text`?e.value??``:(e.children??[]).map(Ae).join(``),je=e=>{if(e.tagName===`a`&&e.properties?.href)return e.properties.href;for(let t of e.children??[]){let e=je(t);if(e)return e}},$=(e,t)=>(e.children??[]).find(e=>e.tagName===t),Me=e=>{let t=Ae(e),n=je(e);return n?{text:t,href:n}:{text:t}},Ne=e=>(e.children??[]).filter(e=>e.type===`element`).map(Me),Pe=e=>{if(e.tagName!==`table`)return null;let t=$(e,`thead`),n=t&&$(t,`tr`);return{headers:n?Ne(n).map(e=>e.text):[],rows:($(e,`tbody`)?.children??[]).filter(e=>e.tagName===`tr`).map(Ne)}},Fe=e=>e.length>5,Ie='When a chart would help answer a question (e.g. plotting a trend over time), include a fenced code block tagged `chartjs` containing a JSON object with this exact shape: {"type": "bar" | "line" | "pie" | "doughnut" | "scatter", "title"?: string, "data": {"labels": string[], "datasets": [{"label": string, "data": number[]}]}}. For "scatter" charts, omit "labels" and give each dataset "data" as an array of {"x": number, "y": number} points instead of a number array. "pie" and "doughnut" charts must have exactly one dataset. Do not include any other fields (no "options", no colors) — the app handles styling. Example:\n```chartjs\n{"type": "line", "title": "BP readings", "data": {"labels": ["Jul 14", "Jul 21", "Jul 28"], "datasets": [{"label": "Systolic", "data": [120, 118, 122]}]}}\n```',Le=[`bar`,`line`,`pie`,`doughnut`,`scatter`],Re=8,ze=50,Be=8,Ve=500,He=e=>typeof e==`object`&&!!e&&typeof e.x==`number`&&typeof e.y==`number`,Ue=e=>{let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t)return null;let n=t;if(typeof n.type!=`string`||!Le.includes(n.type))return null;let r=n.type;if(n.title!==void 0&&typeof n.title!=`string`)return null;let i=n.title;if(typeof n.data!=`object`||n.data===null)return null;let a=n.data;if(!Array.isArray(a.datasets)||a.datasets.length<1||a.datasets.length>Re||(r===`pie`||r===`doughnut`)&&a.datasets.length!==1)return null;for(let e of a.datasets)if(typeof e!=`object`||!e||typeof e.label!=`string`||!Array.isArray(e.data))return null;let o=a.datasets;if(r===`scatter`){for(let e of o)if(e.data.length<1||e.data.length>Ve||!e.data.every(He))return null;return{type:r,title:i,data:{datasets:o}}}if(!Array.isArray(a.labels)||!a.labels.every(e=>typeof e==`string`))return null;let s=a.labels,c=r===`pie`||r===`doughnut`?Be:ze;if(s.length<1||s.length>c)return null;for(let e of o)if(e.data.length!==s.length||!e.data.every(e=>typeof e==`number`))return null;return{type:r,title:i,data:{labels:s,datasets:o}}},We={tool_start:`Tool start`,tool_end:`Tool end`,pseudo_tool_call:`Narrated tool call`,llm_call_start:`LLM call start`,llm_call_end:`LLM call end`,progress:`Progress`,info:`Info`,error:`Error`,raw:`Raw event`};function Ge(e){return e.kind!==`tool_start`&&e.kind!==`tool_end`?null:Oe(e.name,e.args)}function Ke(e,t=Ge(e)){return e.kind===`pseudo_tool_call`?e.name:t?.name??null}function qe(e,t=Ge(e)){switch(e.kind){case`tool_start`:return t.viaCallTool?`${t.name} (via call_tool)`:t.name;case`tool_end`:return`${t.viaCallTool?`${t.name} (via call_tool)`:t.name}${e.runtimeSeconds===void 0?``:` — ${e.runtimeSeconds.toFixed(2)}s`}${e.isError?` — failed`:``}`;case`pseudo_tool_call`:return`${e.name} — written as text, not actually called`;case`llm_call_start`:return`LLM call — ${e.request.length} message${e.request.length===1?``:`s`}`;case`llm_call_end`:return`LLM call returned`;case`progress`:return e.message?`${e.status} — ${e.message}`:e.status;case`info`:return e.message;case`error`:return e.httpStatus?`${e.message} (HTTP ${e.httpStatus})`:e.message;case`raw`:return`Unrecognized event: ${e.eventType}`}}function Je(e,t=Ge(e)){return e.kind===`tool_start`||e.kind===`tool_end`?t.args?JSON.stringify(t.args,null,2):e.args??null:e.kind===`pseudo_tool_call`?e.args??null:e.kind===`llm_call_start`?JSON.stringify(e.request,null,2):null}function Ye(e){return e.kind===`tool_end`?e.output??null:e.kind===`llm_call_end`?e.response??null:null}function Xe(e){return e.kind===`tool_end`&&e.structuredOutput?JSON.stringify(e.structuredOutput,null,2):null}function Ze(e){return e.kind===`raw`?e.raw:e.kind===`error`?e.rawBody??null:null}function Qe(e){switch(e.kind){case`tool_start`:return`Calling ${Oe(e.name,e.args).name}...`;case`tool_end`:{let t=Oe(e.name,e.args).name;return e.isError?`${t} failed`:`${t} returned`}case`pseudo_tool_call`:return`${e.name} (written as text, not called)`;case`llm_call_start`:return`Calling the model...`;case`llm_call_end`:return`Model responded`;case`progress`:return e.message??e.status;case`info`:return e.message;case`error`:return e.source===`client-timeout`?`Timed out: ${e.message}`:`Error: ${e.message}`;case`raw`:return`Unrecognized event: ${e.eventType}`}}function $e(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}.${String(t.getMilliseconds()).padStart(3,`0`)}`}function et(e){if(e<=0)return`+0ms`;if(e<1e3)return`+${Math.round(e)}ms`;let t=e/1e3;if(t<60)return`+${t.toFixed(1)}s`;let n=Math.floor(t/60),r=Math.round(t%60);return`+${n}m${String(r).padStart(2,`0`)}s`}function tt(e){return e.map((t,n)=>{let r=Ge(t),i=n===0?t.turnSentAt:e[n-1].at;return{key:`${t.at}-${n}`,kind:t.kind,toolName:Ke(t,r),isToolStart:t.kind===`tool_start`,failed:t.kind===`tool_end`&&t.isError===!0,time:$e(t.at),gapMs:t.at-i,label:t.kind===`tool_end`&&t.isError===!0?`Tool failed`:We[t.kind],summary:qe(t,r),argsDetail:Je(t,r),outputDetail:Ye(t),structuredOutputDetail:Xe(t),rawDetail:Ze(t)}})}function nt(e){let t=e.filter(e=>e.kind===`tool_end`),n=t.filter(e=>e.kind===`tool_end`&&e.isError),r=e.filter(e=>e.kind===`llm_call_end`),i=e.filter(e=>e.kind===`error`),a=[];return r.length>0&&a.push(`${r.length} LLM call${r.length===1?``:`s`}`),t.length>0&&a.push(`${t.length} tool call${t.length===1?``:`s`}`+(n.length>0?`, ${n.length} failed`:``)),i.length>0&&a.push(`${i.length} stream error${i.length===1?``:`s`}`),a.join(` · `)}function rt(e){let t=[];for(let n of e){let e=t[t.length-1];if(n.toolName&&e?.type===`group`&&e.toolName===n.toolName){e.rows.push(n);continue}t.push(n.toolName?{type:`group`,toolName:n.toolName,rows:[n]}:{type:`single`,row:n})}return t}function it(e){return e.some(e=>e.kind===`tool_end`&&e.isError||e.kind===`error`)}function at(e,t){return t===void 0?[]:e.filter(e=>e.turnSentAt===t&&(e.kind===`tool_end`||e.kind===`pseudo_tool_call`||e.kind===`progress`)).map((e,t)=>({key:`${e.at}-${t}`,text:Qe(e),toolName:Ke(e)}))}function ot(e,t){if(t===void 0)return[];let n=[];for(let r of e)if(r.turnSentAt===t){if(r.kind===`tool_start`){let e=Oe(r.name,r.args).name;n.push({key:`step-${n.length}`,callId:r.callId,toolName:e,label:r.displayName||e,status:`running`,startOffsetMs:r.at-t})}else if(r.kind===`tool_end`){let e=Oe(r.name,r.args).name,i=r.isError?`failed`:`done`,a=n.find(t=>t.status===`running`&&t.callId===r.callId&&t.toolName===e);a?(a.status=i,a.runtimeSeconds=r.runtimeSeconds,a.label=r.displayName||a.label):n.push({key:`step-${n.length}`,callId:r.callId,toolName:e,label:r.displayName||e,status:i,runtimeSeconds:r.runtimeSeconds,startOffsetMs:r.runtimeSeconds===void 0?void 0:Math.max(0,r.at-t-r.runtimeSeconds*1e3)})}}return n}var st=`/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
12
|
-
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-border-style:solid;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-leading:initial;--tw-space-y-reverse:0;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:"Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-green-100:oklch(96.2% .044 156.743);--color-green-700:oklch(52.7% .154 150.069);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-700:oklch(48.8% .243 264.376);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-700:oklch(49.6% .265 301.924);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--color-bailey-accent:#4f46e5;--color-bailey-bubble-bg:#fff;--color-bailey-error:#d32f2f;--color-bailey-border:#e5e5e5;--color-bailey-surface:#fff;--color-bailey-surface-muted:#f9fafb;--color-bailey-text:#000;--color-bailey-text-secondary:#6b6b6b;--color-bailey-tooltip-bg:#000;--color-bailey-tooltip-text:#fff;--color-bailey-page-bg:#eceef4;--color-bailey-heart:#16a34a}}@layer utilities;.bailey-chat-panel{box-sizing:border-box;background-color:var(--color-bailey-page-bg);height:100%;padding:calc(var(--spacing) * 3);font-family:var(--font-sans);flex-direction:column;display:flex;position:relative}.bailey-chat-panel-inner{width:100%;min-height:0;max-width:var(--container-3xl);gap:calc(var(--spacing) * 2);flex-direction:column;flex:1;margin-inline:auto;display:flex;overflow-y:auto}.bailey-chat-transcript{min-height:0;padding:calc(var(--spacing) * 2);padding-bottom:calc(var(--spacing) * 4);flex:1;overflow-y:auto}.bailey-message-row{margin-bottom:calc(var(--spacing) * 3);justify-content:flex-start;display:flex}.bailey-message-row-user{justify-content:flex-end}.bailey-user-message{flex-direction:column;align-items:flex-end;max-width:75%;display:flex}.bailey-message-meta{margin-bottom:var(--spacing);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-message-meta-name{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-bailey-text)}.bailey-user-bubble{border-radius:var(--radius-2xl);background-color:var(--color-bailey-bubble-bg);max-width:100%;padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);white-space:pre-wrap;color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.bailey-assistant-message{width:100%;padding-inline:var(--spacing)}.bailey-tool-result-image{margin-top:calc(var(--spacing) * 2);border-radius:var(--radius-lg);max-width:100%;height:auto;display:block}.bailey-mcp-app-frame{margin-top:calc(var(--spacing) * 2);border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:0;width:100%;height:480px;display:block}.bailey-thinking-hint{align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);font-style:italic;display:flex}.bailey-streaming-hint{margin-top:var(--spacing);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);font-style:italic;display:flex}.bailey-message-actions{margin-top:var(--spacing);align-items:center;gap:var(--spacing);flex-wrap:wrap;display:flex}.bailey-empty-state{text-align:center;height:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);justify-content:center;align-items:center;display:flex}.bailey-suggestions{gap:calc(var(--spacing) * 3);padding:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-suggestions-title{padding-inline:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text)}.bailey-suggestion-card{cursor:pointer;appearance:none;justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-2xl);--tw-border-style:none;background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 3);text-align:left;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-style:none;display:flex}@media (hover:hover){.bailey-suggestion-card:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}}.bailey-suggestion-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-text-secondary);flex-shrink:0}.bailey-privacy-note{border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 4);padding-top:calc(var(--spacing) * 3);padding-bottom:var(--spacing);text-align:center;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-privacy-note a{color:var(--color-bailey-text-secondary);text-decoration-line:underline}.bailey-tool-steps-live{margin-top:calc(var(--spacing) * 2);gap:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-activity-line{align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-activity-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-accent);flex-shrink:0}.bailey-step-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-bailey-border);border-top-color:var(--color-bailey-accent);border-radius:2147483647px;flex-shrink:0}@media (prefers-reduced-motion:no-preference){.bailey-step-spinner{animation:var(--animate-spin)}}.bailey-tool-steps-summary{margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary)}.bailey-tool-steps-summary>summary{cursor:pointer;-webkit-user-select:none;user-select:none}.bailey-tool-steps-list{margin:0;margin-top:var(--spacing);gap:var(--spacing);flex-direction:column;padding:0;list-style-type:none;display:flex}.bailey-tool-step{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-tool-step-start{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.bailey-tool-step-failed{color:var(--color-bailey-error)}.bailey-error-banner{margin-bottom:calc(var(--spacing) * 2);justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-error);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);color:var(--color-bailey-error);display:flex}.bailey-retry-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);background-color:#0000;border-style:none;text-decoration-line:underline}.bailey-error-actions{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-dismiss-button{cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-error);background-color:#0000;border-style:none}@media (hover:hover){.bailey-dismiss-button:hover{opacity:.7}}.bailey-input-area{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-input-row{align-items:center;gap:calc(var(--spacing) * 2);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);min-width:0;padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;flex:1;display:flex}.bailey-input-row:focus-within{border-color:var(--color-bailey-accent)}.bailey-input{--tw-border-style:none;min-width:0;padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;background-color:#0000;border-style:none;outline-style:none;flex:1}.bailey-input:disabled{opacity:.5}.bailey-send-button,.bailey-stop-button{cursor:pointer;appearance:none;background-color:#0000;border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}:is(.bailey-send-button,.bailey-stop-button):disabled{cursor:default;opacity:.4}.bailey-send-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-heart);border-style:none}@media (hover:hover){.bailey-send-button:hover{background-color:#16a34a1a}@supports (color:color-mix(in lab, red, red)){.bailey-send-button:hover{background-color:color-mix(in oklab, var(--color-bailey-heart) 10%, transparent)}}}.bailey-send-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-stop-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-error);border-style:none}@media (hover:hover){.bailey-stop-button:hover{background-color:#d32f2f1a}@supports (color:color-mix(in lab, red, red)){.bailey-stop-button:hover{background-color:color-mix(in oklab, var(--color-bailey-error) 10%, transparent)}}}.bailey-stop-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-copy-button{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;border-radius:2147483647px;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-copy-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-copy-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-copy-button:hover{color:var(--color-bailey-text)}}.bailey-copy-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-tooltip-content{padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));background-color:var(--color-bailey-tooltip-bg,#000);color:var(--color-bailey-tooltip-text,#fff);border-radius:.25rem}.bailey-menu-button{height:calc(var(--spacing) * 13);width:calc(var(--spacing) * 13);cursor:pointer;appearance:none;border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-menu-button:hover{background-color:var(--color-gray-50)}}.bailey-menu-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-menu-content{z-index:50;min-width:calc(var(--spacing) * 44);border-radius:var(--radius-2xl);background-color:var(--color-white);padding-block:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-black);--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);font-family:var(--font-sans,"Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif)}.bailey-menu-item{cursor:pointer;align-items:center;gap:calc(var(--spacing) * 3);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;outline-style:none;display:flex}.bailey-menu-item[data-highlighted]{background-color:var(--color-gray-100)}.bailey-menu-item-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-gray-600)}.bailey-tooltip-arrow{fill:var(--color-bailey-tooltip-bg,#000)}.bailey-markdown-content table{border-collapse:collapse;width:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.bailey-markdown-content th{background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);text-align:left;--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content td{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);vertical-align:top}.bailey-markdown-content tr:nth-child(2n){background-color:var(--color-bailey-surface-muted)}.bailey-markdown-content{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.bailey-markdown-content>:first-child{margin-top:0}.bailey-markdown-content>:last-child{margin-bottom:0}.bailey-markdown-content p{margin-block:calc(var(--spacing) * 2)}.bailey-markdown-content h1{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h2{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h3{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h4,.bailey-markdown-content h5,.bailey-markdown-content h6{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content ul{margin-block:calc(var(--spacing) * 2);list-style-type:disc}:where(.bailey-markdown-content ul>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ul{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content ol{margin-block:calc(var(--spacing) * 2);list-style-type:decimal}:where(.bailey-markdown-content ol>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ol{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content a{color:var(--color-bailey-accent);text-underline-offset:2px;text-decoration-line:underline}.bailey-markdown-content code{background-color:var(--color-bailey-surface-muted);padding-inline:var(--spacing);padding-block:calc(var(--spacing) * .5);font-family:var(--font-mono);border-radius:.25rem;font-size:.85em}.bailey-markdown-content pre{margin-block:calc(var(--spacing) * 2);border-radius:var(--radius-md);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 2);overflow-x:auto}.bailey-markdown-content pre code{background-color:#0000;padding:0}.bailey-markdown-content blockquote{margin-block:calc(var(--spacing) * 2);border-left-style:var(--tw-border-style);border-left-width:2px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 3);color:var(--color-bailey-text-secondary);font-style:italic}.bailey-markdown-content hr{margin-block:calc(var(--spacing) * 3);border-color:var(--color-bailey-border)}.bailey-trace-panel{margin-bottom:calc(var(--spacing) * 2)}.bailey-trace-toggle-row{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-trace-toggle{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none}@media (hover:hover){.bailey-trace-toggle:hover{text-decoration-line:underline}}.bailey-trace-toggle-error{color:var(--color-bailey-error)}.bailey-trace-summary{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-trace-summary-error{color:var(--color-bailey-error)}.bailey-trace-body{margin-top:var(--spacing);max-height:calc(var(--spacing) * 80);overflow-y:auto}.bailey-trace-actions-row{justify-content:flex-end;gap:calc(var(--spacing) * 3);display:flex}.bailey-trace-copy-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none;text-decoration-line:underline}@media (hover:hover){.bailey-trace-copy-button:hover{text-decoration-line:none}}.bailey-trace-request-details{margin-bottom:var(--spacing);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding:calc(var(--spacing) * 2)}.bailey-trace-request-meta{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:block}.bailey-trace-rows{gap:var(--spacing);flex-direction:column;display:flex}.bailey-trace-row{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-row-header{align-items:center;gap:calc(var(--spacing) * 2);flex-wrap:wrap;display:flex}.bailey-trace-row-time{color:var(--color-bailey-text-secondary)}.bailey-trace-row-gap{color:var(--color-gray-400)}.bailey-trace-row-summary{word-break:break-all}.bailey-trace-chip{padding-inline:calc(var(--spacing) * 1.5);padding-block:calc(var(--spacing) * .5);--tw-font-weight:var(--font-weight-semibold);font-size:.65rem;font-weight:var(--font-weight-semibold);border-radius:.25rem}.bailey-trace-chip-default{background-color:var(--color-gray-200);color:var(--color-gray-700)}.bailey-trace-chip-info{background-color:var(--color-blue-100);color:var(--color-blue-700)}.bailey-trace-chip-success{background-color:var(--color-green-100);color:var(--color-green-700)}.bailey-trace-chip-secondary{background-color:var(--color-purple-100);color:var(--color-purple-700)}.bailey-trace-chip-error{background-color:var(--color-red-100);color:var(--color-bailey-error)}.bailey-trace-disclosure{margin-top:var(--spacing)}.bailey-trace-disclosure-summary{cursor:pointer;color:var(--color-bailey-text-secondary);font-size:.7rem}.bailey-trace-disclosure-actions{margin-top:var(--spacing);justify-content:flex-end;display:flex}.bailey-trace-disclosure-content{margin-top:var(--spacing);max-height:calc(var(--spacing) * 48);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 1.5);word-break:break-all;white-space:pre-wrap;border-radius:.25rem;font-size:.7rem;overflow:auto}.bailey-trace-group{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing)}.bailey-trace-group-summary{cursor:pointer;font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-group-failed{margin-left:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-feedback{align-items:center;gap:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);flex-wrap:wrap;display:flex}.bailey-message-actions>.bailey-feedback{display:contents}.bailey-feedback-thumbs{margin-left:var(--spacing);align-items:center;gap:calc(var(--spacing) * .5);border-left-style:var(--tw-border-style);border-left-width:1px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 2);display:flex}.bailey-feedback-thumb{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;border-radius:var(--radius-lg);--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-feedback-thumb:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-thumb:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-feedback-thumb:hover{color:var(--color-bailey-text)}}.bailey-feedback-thumb:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-thumb:disabled{cursor:default;opacity:.5}.bailey-feedback-thumb[aria-pressed=true]{background-color:#4f46e51a}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-thumb[aria-pressed=true]{background-color:color-mix(in oklab, var(--color-bailey-accent) 10%, transparent)}}.bailey-feedback-thumb[aria-pressed=true]{color:var(--color-bailey-accent)}.bailey-feedback-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-feedback-status{align-items:center;gap:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:inline-flex}.bailey-feedback-status:empty{display:none}.bailey-feedback-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);animation:var(--animate-spin);border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-bailey-border);border-top-color:var(--color-bailey-accent);border-radius:2147483647px;display:inline-block}.bailey-feedback-link{cursor:pointer;appearance:none;--tw-border-style:none;padding-inline:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none;text-decoration-line:underline}.bailey-feedback-link:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-error{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-feedback-form{margin-top:calc(var(--spacing) * 2);box-sizing:border-box;border-radius:var(--radius-xl);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);width:100%;padding:calc(var(--spacing) * 3);flex-basis:100%}.bailey-feedback-reasons{margin:0;margin-bottom:calc(var(--spacing) * 2);--tw-border-style:none;border-style:none;min-width:0;padding:0}.bailey-feedback-legend{margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text);padding:0;display:block}.bailey-feedback-chips{gap:calc(var(--spacing) * 1.5);flex-wrap:wrap;display:flex}.bailey-feedback-chip{cursor:pointer;appearance:none;border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text);border-radius:2147483647px}.bailey-feedback-chip:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-chip:disabled{cursor:default;opacity:.5}.bailey-feedback-chip[aria-pressed=true]{border-color:var(--color-bailey-accent);background-color:#4f46e51a}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-chip[aria-pressed=true]{background-color:color-mix(in oklab, var(--color-bailey-accent) 10%, transparent)}}.bailey-feedback-chip[aria-pressed=true]{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-accent)}.bailey-feedback-textarea{box-sizing:border-box;min-height:calc(var(--spacing) * 18);resize:vertical;border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);width:100%;padding-inline:calc(var(--spacing) * 2.5);padding-block:calc(var(--spacing) * 2);font-family:var(--font-sans);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);display:block}.bailey-feedback-textarea:disabled{opacity:.5}.bailey-feedback-meta{margin-top:calc(var(--spacing) * 1.5);justify-content:space-between;align-items:flex-start;gap:calc(var(--spacing) * 3);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-feedback-buttons{margin-top:calc(var(--spacing) * 2.5);justify-content:flex-end;gap:calc(var(--spacing) * 2);display:flex}.bailey-feedback-button{cursor:pointer;appearance:none;border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3.5);padding-block:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-feedback-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-button:disabled{cursor:default;opacity:.5}.bailey-feedback-button-primary{border-color:var(--color-bailey-accent);background-color:var(--color-bailey-accent);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-load-earlier{align-items:center;gap:var(--spacing);padding-bottom:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-load-earlier-button{cursor:pointer;appearance:none;border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3.5);padding-block:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-load-earlier-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-load-earlier-button:disabled{cursor:default;opacity:.5}.bailey-load-earlier-error{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-history-drawer{z-index:10;background-color:var(--color-bailey-surface);font-family:var(--font-sans);color:var(--color-bailey-text);border-radius:14px;flex-direction:column;display:flex;position:absolute;inset:0;overflow:hidden;container-type:inline-size}.bailey-history-header{align-items:center;gap:calc(var(--spacing) * 2);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);display:flex}.bailey-history-heading{text-overflow:ellipsis;white-space:nowrap;--tw-font-weight:var(--font-weight-semibold);min-width:0;font-size:15px;font-weight:var(--font-weight-semibold);--tw-outline-style:none;outline-style:none;flex:1;margin:0;overflow:hidden}.bailey-history-icon-button{height:calc(var(--spacing) * 11);width:calc(var(--spacing) * 11);cursor:pointer;appearance:none;border-radius:var(--radius-lg);--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;flex:none;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-history-icon-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-history-icon-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-history-icon-button:hover{color:var(--color-bailey-text)}}.bailey-history-icon-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-icon-button:disabled{cursor:default;opacity:.5}.bailey-history-icon{width:18px;height:18px}.bailey-history-icon-small{height:calc(var(--spacing) * 3.5);width:calc(var(--spacing) * 3.5);flex:none}.bailey-history-button{min-height:calc(var(--spacing) * 11);cursor:pointer;appearance:none;justify-content:center;align-items:center;gap:calc(var(--spacing) * 1.5);border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 1.5);white-space:nowrap;color:var(--color-bailey-text);font-size:13px;display:inline-flex}.bailey-history-button:focus-visible{outline-style:var(--tw-outline-style);outline-offset:2px;outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-button:disabled{cursor:default;opacity:.5}.bailey-history-button-primary{border-color:var(--color-bailey-accent);background-color:var(--color-bailey-accent);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-history-button-danger{border-color:var(--color-bailey-error);background-color:var(--color-bailey-error);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-history-button-small{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-history-body{padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);flex:1;overflow-y:auto}.bailey-history-list{margin:0;padding:0;list-style-type:none}.bailey-history-row{border-radius:10px;flex-wrap:wrap;align-items:center;display:flex;position:relative}.bailey-history-row+.bailey-history-row{margin-top:calc(var(--spacing) * .5)}.bailey-history-row:not(.bailey-history-row-active):hover{background-color:var(--color-gray-100)}.bailey-history-row-active{box-shadow:inset 3px 0 0 var(--color-bailey-accent,#4f46e5);background-color:#4f46e514}.bailey-history-select{min-height:calc(var(--spacing) * 11);cursor:pointer;appearance:none;gap:calc(var(--spacing) * .5);--tw-border-style:none;min-width:0;padding-block:calc(var(--spacing) * 2.5);padding-right:calc(var(--spacing) * 2.5);padding-left:calc(var(--spacing) * 3);text-align:left;color:var(--color-bailey-text);background-color:#0000;border-style:none;border-radius:10px;flex-direction:column;flex:1;font-family:inherit;display:flex}.bailey-history-select:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-select:disabled{cursor:default;opacity:.6}.bailey-history-row-title{text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);overflow:hidden}.bailey-history-meta{align-items:center;gap:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-history-meta>span+.bailey-history-count:before{content:"·";margin-right:.375rem}.bailey-history-current{--tw-font-weight:var(--font-weight-semibold);font-size:11px;font-weight:var(--font-weight-semibold);color:var(--color-bailey-accent)}.bailey-history-delete{margin-right:var(--spacing)}.bailey-history-row-confirming{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-red-200);background-color:var(--color-red-50)}.bailey-history-confirm{align-items:center;gap:calc(var(--spacing) * 2);min-width:0;padding-block:calc(var(--spacing) * 2);padding-right:calc(var(--spacing) * 2.5);padding-left:calc(var(--spacing) * 3);flex-wrap:wrap;flex:1;display:flex}.bailey-history-confirm-question{--tw-font-weight:var(--font-weight-semibold);min-width:7.5rem;font-size:13px;font-weight:var(--font-weight-semibold);flex:1}.bailey-history-confirm-title{text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);flex-basis:100%;overflow:hidden}.bailey-history-row-failed{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-red-200);background-color:#fff7f7}.bailey-history-row-error{align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 3);padding-bottom:calc(var(--spacing) * 2.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error);flex-wrap:wrap;flex-basis:100%;display:flex}.bailey-history-state{align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 6);padding-block:calc(var(--spacing) * 12);text-align:center;color:var(--color-bailey-text-secondary);flex-direction:column;font-size:13px;display:flex}.bailey-history-state strong{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-history-state-icon{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);color:var(--color-gray-400)}.bailey-history-state-error .bailey-history-state-icon{color:var(--color-bailey-error)}.bailey-history-more{padding-top:calc(var(--spacing) * 2.5);padding-bottom:calc(var(--spacing) * 1.5);justify-content:center;display:flex}.bailey-history-inline-error{justify-content:center;align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error);flex-wrap:wrap;display:flex}.bailey-history-status{min-height:calc(var(--spacing) * 9);align-items:center;gap:calc(var(--spacing) * 2);border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3.5);padding-block:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-history-skeleton{margin-inline:var(--spacing);margin-bottom:calc(var(--spacing) * 1.5);background:linear-gradient(90deg,#f1f1f4 25%,#e6e6ec 50%,#f1f1f4 75%) 0 0/200% 100%;border-radius:10px;height:52px;animation:1.3s infinite bailey-history-shimmer}.bailey-history-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-bailey-border);border-top-color:var(--color-bailey-accent,#4f46e5);border-radius:2147483647px;animation:.8s linear infinite bailey-history-rotate;display:inline-block}@keyframes bailey-history-shimmer{to{background-position:-200% 0}}@keyframes bailey-history-rotate{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.bailey-history-skeleton,.bailey-history-spinner{animation:none}}@container (width<=340px){.bailey-history-new-chat{width:calc(var(--spacing) * 11);padding-inline:0}.bailey-history-new-chat-text,.bailey-history-count{display:none}}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-leading{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@keyframes spin{to{transform:rotate(360deg)}}`,ct=(0,l.createContext)(void 0),lt=/:root\s*,\s*:host\s*\{([^}]*)\}/,ut=`.bailey-chat-panel`,dt=`.bailey-menu-content,.bailey-tooltip-content`,ft=`--color-bailey-`;function pt(e){let t=e.match(new RegExp(lt,`g`))?.length??0;if(t!==1)throw Error(`Expected exactly one ":root, :host {" rule in the compiled styles.css, found ${t}. Tailwind likely changed how @theme compiles — update this rewrite (and its sibling, scripts/scope-theme-vars.js) before shipping.`);return e.replace(lt,(e,t)=>`${ut}{${t}}${dt}{${t.split(`;`).filter(e=>e.trim()&&!e.trim().startsWith(ft)).join(`;`)}}`)}var mt=pt(st),ht=`data-source`,gt=`baileyai-chat-ui`,_t=new WeakMap;function vt(e){let t=e.getRootNode();return t instanceof ShadowRoot?t:document}function yt(e){let t=e instanceof ShadowRoot?e:document.head,n=_t.get(e)??0;if(n===0&&!t.querySelector(`style[${ht}="${gt}"]`)){let e=document.createElement(`style`);e.setAttribute(ht,gt),e.textContent=mt,t.appendChild(e)}return _t.set(e,n+1),()=>{let n=(_t.get(e)??1)-1;n<=0?(_t.delete(e),t.querySelector(`style[${ht}="${gt}"]`)?.remove()):_t.set(e,n)}}function bt(e,t=!1){let[n,r]=(0,l.useState)(null);return(0,l.useLayoutEffect)(()=>{if(t)return;let n=e.current;if(!n)return;let i=vt(n);return r(i),yt(i)},[t,e]),n}function xt(e){let t=(0,l.useContext)(ct),n=t!==void 0,r=bt(e,n);return n?t:r}function St({renderTable:e,renderChart:t}={}){return{a:({href:e,children:t})=>!e||!c.n(e)?(0,m.jsx)(m.Fragment,{children:t}):(0,m.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t}),table:({node:t,children:n})=>{let r=t&&Pe(t);if(r&&Fe(r.rows)&&e){let t=r.rows.map(e=>e.map(e=>e.href&&!c.n(e.href)?{text:e.text}:e));return(0,m.jsx)(m.Fragment,{children:e({headers:r.headers,rows:t})})}return(0,m.jsx)(`table`,{children:n})},pre:({children:e})=>{let n=(Array.isArray(e)?e[0]:e)?.props;if((n?.className?.split(` `)??[]).includes(`language-chartjs`)&&t){let e=n?.children,r=Ue(Array.isArray(e)?e.join(``):String(e??``));if(r)return(0,m.jsx)(m.Fragment,{children:t(r)})}return(0,m.jsx)(`pre`,{children:e})}}}function Ct({className:e}){return(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,m.jsx)(`path`,{d:`M12 20.3s-7.6-4.7-10-9.4C.4 7.7 1.7 4 5.2 3.1c2.2-.6 4.4.4 5.5 2.2 1.2-1.8 3.4-2.8 5.6-2.2 3.5.9 4.8 4.6 3.2 7.8-2.4 4.7-10 9.4-10 9.4z`})})}function wt({className:e}){return(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,m.jsx)(`rect`,{x:`6`,y:`6`,width:`12`,height:`12`,rx:`2`})})}function Tt({className:e}){return(0,m.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M7 17 17 7`}),(0,m.jsx)(`path`,{d:`M9 7h8v8`})]})}function Et({className:e}){return(0,m.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[(0,m.jsx)(`rect`,{x:`8`,y:`8`,width:`12`,height:`12`,rx:`2`}),(0,m.jsx)(`path`,{d:`M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2`})]})}function Dt({className:e}){return(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:(0,m.jsx)(`path`,{d:`M5 12.5 9.5 17 19 7`})})}function Ot({className:e}){return(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:(0,m.jsx)(`path`,{d:`m22.7 13.5-2-2-2 2M21 12a9 9 0 1 1-1.245-4.57M12 7v5l3 2`})})}function kt({className:e}){return(0,m.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[(0,m.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,m.jsx)(`path`,{d:`M8.5 12.5 11 15l4.5-5.5`})]})}function At({className:e}){return(0,m.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:[(0,m.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.75`}),(0,m.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.75`}),(0,m.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.75`})]})}function jt({className:e}){return(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:(0,m.jsx)(`path`,{d:`M12 5v14M5 12h14`})})}var Mt=`M7 11v9H4v-9h3zm0 0 4-8c1.7 0 2.7 1.3 2.4 3L13 9h5.5a2 2 0 0 1 2 2.4l-1.3 6.8A2 2 0 0 1 17.2 20H7`,Nt=`M17 13V4h3v9h-3zm0 0-4 8c-1.7 0-2.7-1.3-2.4-3L11 15H5.5a2 2 0 0 1-2-2.4l1.3-6.8A2 2 0 0 1 6.8 4H17`;function Pt({className:e,filled:t=!1}){return(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:t?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:1.8,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:(0,m.jsx)(`path`,{d:Mt})})}function Ft({className:e,filled:t=!1}){return(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:t?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:1.8,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:(0,m.jsx)(`path`,{d:Nt})})}function It({className:e}){return(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:(0,m.jsx)(`path`,{d:`M15 6l-6 6 6 6`})})}function Lt({className:e}){return(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:(0,m.jsx)(`path`,{d:`M4 7h16M10 11v6M14 11v6M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12M9 7V4h6v3`})})}function Rt({className:e}){return(0,m.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[(0,m.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,m.jsx)(`path`,{d:`M12 8v5M12 16.5v.01`})]})}var zt=1500;function Bt({markdown:e,className:t,ariaLabel:n=`copy response as markdown`,tooltipDefaultText:r=`Copy as markdown`,tooltipCopiedText:i=`Copied!`}){let[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(!1),u=(0,l.useRef)(null),d=(0,l.useRef)(null),f=xt(d);return(0,l.useEffect)(()=>()=>{u.current!==null&&clearTimeout(u.current)},[]),(0,m.jsx)(p.Provider,{delayDuration:200,children:(0,m.jsxs)(p.Root,{open:a||s,onOpenChange:c,children:[(0,m.jsx)(p.Trigger,{asChild:!0,children:(0,m.jsx)(`button`,{ref:d,type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(e)}catch{return}o(!0),u.current!==null&&clearTimeout(u.current),u.current=setTimeout(()=>o(!1),zt)},"aria-label":n,className:`bailey-copy-button${t?` ${t}`:``}`,children:a?(0,m.jsx)(Dt,{className:`bailey-copy-icon`}):(0,m.jsx)(Et,{className:`bailey-copy-icon`})})}),(0,m.jsx)(p.Portal,{container:f instanceof ShadowRoot?f:void 0,children:(0,m.jsxs)(p.Content,{side:`top`,className:`bailey-tooltip-content`,children:[a?i:r,(0,m.jsx)(p.Arrow,{className:`bailey-tooltip-arrow`})]})})]})})}async function Vt(e){try{await navigator.clipboard.writeText(e)}catch{}}function Ht({text:e,label:t=`Copy`}){return(0,m.jsx)(`button`,{type:`button`,onClick:()=>Vt(e),className:`bailey-trace-copy-button`,children:t})}function Ut(e){if(e.failed||e.kind===`error`)return`bailey-trace-chip bailey-trace-chip-error`;switch(e.kind){case`tool_start`:case`llm_call_start`:return`bailey-trace-chip bailey-trace-chip-info`;case`tool_end`:case`llm_call_end`:return`bailey-trace-chip bailey-trace-chip-success`;case`progress`:return`bailey-trace-chip bailey-trace-chip-secondary`;default:return`bailey-trace-chip bailey-trace-chip-default`}}function Wt({label:e,content:t,copyable:n}){return(0,m.jsxs)(`details`,{className:`bailey-trace-disclosure`,children:[(0,m.jsx)(`summary`,{className:`bailey-trace-disclosure-summary`,children:e}),n&&(0,m.jsx)(`div`,{className:`bailey-trace-disclosure-actions`,children:(0,m.jsx)(Ht,{text:t})}),(0,m.jsx)(`pre`,{className:`bailey-trace-disclosure-content`,children:t})]})}function Gt({row:e}){return(0,m.jsxs)(`div`,{className:`bailey-trace-row`,children:[(0,m.jsxs)(`div`,{className:`bailey-trace-row-header`,children:[(0,m.jsx)(`span`,{className:`bailey-trace-row-time`,children:e.time}),(0,m.jsx)(`span`,{className:`bailey-trace-row-gap`,title:`Time since the previous event`,children:et(e.gapMs)}),(0,m.jsx)(`span`,{className:Ut(e),children:e.label}),(0,m.jsx)(`span`,{className:`bailey-trace-row-summary`,children:e.summary})]}),e.argsDetail&&(0,m.jsx)(Wt,{label:e.kind===`llm_call_start`?`request`:`args`,content:e.argsDetail}),e.outputDetail&&(0,m.jsx)(Wt,{label:e.kind===`llm_call_end`?`response`:`output`,content:e.outputDetail}),e.structuredOutputDetail&&(0,m.jsx)(Wt,{label:`structured output`,content:e.structuredOutputDetail}),e.rawDetail&&(0,m.jsx)(Wt,{label:`raw`,content:e.rawDetail})]})}function Kt(e,t){if(e.chunkCount===0)return`Streamed: no chunks received`;if(e.chunkCount===1||e.firstChunkAt===null)return`Streamed: 1 chunk (not incremental)`;let n=e.firstChunkAt-t,r=(e.lastChunkAt??e.firstChunkAt)-e.firstChunkAt;return`Streamed: ${e.chunkCount} chunks · first chunk after ${n}ms · spread over ${(r/1e3).toFixed(1)}s`}function qt({request:e}){let t=(0,l.useMemo)(()=>JSON.stringify({model:e.model,instructions:e.systemPrompt,input:e.messages,stream:e.stream,tools:e.tools,toolChoice:e.toolChoice},null,2),[e]);return(0,m.jsxs)(`div`,{className:`bailey-trace-request-details`,children:[(0,m.jsxs)(`span`,{className:`bailey-trace-request-meta`,children:[`Last request — `,e.model,` · `,new Date(e.sentAt).toLocaleTimeString(),e.requestId?` · ${e.requestId}`:``]}),(0,m.jsx)(`span`,{className:`bailey-trace-request-meta`,children:Kt(e.streamStats,e.sentAt)}),(0,m.jsx)(Wt,{label:`System prompt (${e.systemPrompt.length.toLocaleString()} chars)`,content:e.systemPrompt,copyable:!0}),(0,m.jsx)(Wt,{label:`Messages (${e.messages.length})`,content:JSON.stringify(e.messages,null,2),copyable:!0}),e.response&&(0,m.jsx)(Wt,{label:`Response (${e.response.content.length.toLocaleString()} chars)`,content:e.response.content,copyable:!0}),(0,m.jsx)(Wt,{label:`Full payload (JSON)`,content:t,copyable:!0})]})}function Jt({events:e,lastRequest:t,onClear:n}){let r=(0,l.useMemo)(()=>tt(e),[e]),i=(0,l.useMemo)(()=>rt(r),[r]),a=(0,l.useMemo)(()=>JSON.stringify(e,null,2),[e]);return(0,m.jsxs)(`div`,{className:`bailey-trace-body`,children:[(0,m.jsxs)(`div`,{className:`bailey-trace-actions-row`,children:[e.length>0&&(0,m.jsx)(Ht,{text:a,label:`Copy trace as JSON`}),(0,m.jsx)(`button`,{type:`button`,onClick:n,className:`bailey-trace-copy-button`,children:`Clear`})]}),t&&(0,m.jsx)(qt,{request:t}),(0,m.jsx)(`div`,{className:`bailey-trace-rows`,children:i.map((e,t)=>{if(e.type===`single`)return(0,m.jsx)(Gt,{row:e.row},e.row.key);let n=e.rows.filter(e=>e.isToolStart).length;if(n<=1)return(0,m.jsx)(`div`,{className:`bailey-trace-rows`,children:e.rows.map(e=>(0,m.jsx)(Gt,{row:e},e.key))},`group-${t}`);let r=e.rows.filter(e=>e.failed).length;return(0,m.jsxs)(`details`,{className:`bailey-trace-group`,children:[(0,m.jsxs)(`summary`,{className:`bailey-trace-group-summary`,children:[(0,m.jsx)(`strong`,{children:e.toolName}),` × `,n,r>0&&(0,m.jsxs)(`span`,{className:`bailey-trace-group-failed`,children:[` `,r,` failed`]})]}),(0,m.jsx)(`div`,{className:`bailey-trace-rows`,children:e.rows.map(e=>(0,m.jsx)(Gt,{row:e},e.key))})]},`group-${t}`)})})]})}function Yt({events:e,lastRequest:t,onClear:n}){let[r,i]=(0,l.useState)(!1),a=(0,l.useMemo)(()=>it(e),[e]),o=(0,l.useMemo)(()=>nt(e),[e]);return e.length===0&&!t?null:(0,m.jsxs)(`div`,{className:`bailey-trace-panel`,children:[(0,m.jsxs)(`div`,{className:`bailey-trace-toggle-row`,children:[(0,m.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),"aria-expanded":r,className:a?`bailey-trace-toggle bailey-trace-toggle-error`:`bailey-trace-toggle`,children:[a&&!r?`⚠ `:``,r?`Hide details`:`Show details`,` (`,e.length,`)`]}),o&&(0,m.jsx)(`span`,{className:a?`bailey-trace-summary bailey-trace-summary-error`:`bailey-trace-summary`,children:o})]}),r&&(0,m.jsx)(Jt,{events:e,lastRequest:t,onClear:n})]})}function Xt({src:e,alt:t,className:n}){return c.t(e)?(0,m.jsx)(`img`,{src:e,alt:t??``,className:`bailey-tool-result-image${n?` ${n}`:``}`,referrerPolicy:`no-referrer`}):null}var Zt=/^ui:\/\//,Qt=2097152,$t=new Set([`connectDomains`,`resourceDomains`,`frameDomains`,`baseUriDomains`]),en=new Set([`camera`,`microphone`,`geolocation`,`clipboardWrite`]),tn=(e,t)=>e===void 0?!0:typeof e!=`object`||!e||Array.isArray(e)?!1:Object.keys(e).every(e=>t.has(e)),nn=e=>!(!Zt.test(e.resourceUri)||typeof e.html!=`string`||e.html.length===0||e.html.length>Qt||!tn(e.csp,$t)||!tn(e.permissions,en));function rn({html:e,title:t,resourceUri:n,csp:r,permissions:i,className:a}){return nn({html:e,resourceUri:n,csp:r,permissions:i})?(0,m.jsx)(`iframe`,{title:t??`MCP App`,srcDoc:e,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,className:`bailey-mcp-app-frame${a?` ${a}`:``}`}):null}function an({toolName:e,resolveActivityIcon:t}){let n=t?.(e);return n===0||n&&n!==!0?(0,m.jsx)(`span`,{className:`bailey-activity-icon`,children:n}):null}function on({offsetMs:e,labels:t}){let n=et(e),r=t.toolStepStartedText?.replace(`{offset}`,n);return(0,m.jsx)(`span`,{className:`bailey-tool-step-start`,title:r,"aria-label":r,role:r?`text`:void 0,children:n})}function sn({steps:e,resolveActivityIcon:t}){let n=e.filter(e=>e.status===`running`);return n.length===0?null:(0,m.jsx)(`div`,{className:`bailey-tool-steps-live`,role:`status`,"aria-live":`polite`,children:n.map(e=>(0,m.jsxs)(`div`,{className:`bailey-activity-line`,children:[(0,m.jsx)(an,{toolName:e.toolName,resolveActivityIcon:t}),(0,m.jsx)(`span`,{children:e.label}),(0,m.jsx)(`span`,{className:`bailey-step-spinner`,"aria-hidden":`true`})]},e.key))})}function cn({steps:e,labels:t,resolveActivityIcon:n}){if(e.length===0)return null;let r=e.filter(e=>e.status===`failed`).length,i=e.length===1?t.toolStepsSummaryOne:t.toolStepsSummaryMany.replace(`{count}`,String(e.length)),a=r>0?`${i}${t.toolStepsFailedSuffix.replace(`{failed}`,String(r))}`:i;return(0,m.jsxs)(`details`,{className:`bailey-tool-steps-summary`,children:[(0,m.jsx)(`summary`,{children:a}),(0,m.jsx)(`ul`,{className:`bailey-tool-steps-list`,children:e.map(e=>(0,m.jsxs)(`li`,{className:`bailey-tool-step`,children:[(0,m.jsx)(an,{toolName:e.toolName,resolveActivityIcon:n}),(0,m.jsx)(`span`,{children:e.label}),e.startOffsetMs!==void 0&&(0,m.jsx)(on,{offsetMs:e.startOffsetMs,labels:t}),e.runtimeSeconds!==void 0&&(0,m.jsx)(`span`,{children:`${e.runtimeSeconds.toFixed(1)}s`}),e.status===`failed`&&(0,m.jsx)(`span`,{className:`bailey-tool-step-failed`,children:t.toolStepFailedText}),e.status===`running`&&(0,m.jsx)(`span`,{children:t.toolStepStoppedText})]},e.key))})]})}var ln=/(Z|[+-]\d{2}:?\d{2})$/i,un=60,dn=3600,fn=24*dn,pn=30*fn*1e3;function mn(e){return e?Date.parse(ln.test(e)?e:`${e}Z`):NaN}function hn(e){let t=mn(e.iso);if(Number.isNaN(t))return``;let n=e.now??Date.now(),r=Math.max(0,n-t);if(typeof Intl>`u`||typeof Intl.RelativeTimeFormat!=`function`)return e.justNowText??``;if(r>=pn)return new Intl.DateTimeFormat(e.locale,{dateStyle:`medium`}).format(t);let i=r/1e3,a=new Intl.RelativeTimeFormat(e.locale,{numeric:`auto`});return i<un?a.format(0,`second`):i<dn?a.format(-Math.floor(i/un),`minute`):i<fn?a.format(-Math.floor(i/dn),`hour`):a.format(-Math.floor(i/fn),`day`)}function gn({client:e,pageSize:t,chat:n,labels:r,locale:i,onClose:a}){let o=H({client:e,pageSize:t}),{loadConversation:s,newChat:c}=n,u=(0,l.useCallback)(e=>s?s(e):Promise.reject(Error(`no loadConversation`)),[s]),d=(0,l.useCallback)(()=>{c(),a({restoreFocusTo:`input`})},[c,a]);return(0,m.jsx)(yn,{conversations:o,activeConversationId:n.conversationId,selectStatus:n.historyStatus,onSelect:u,onActiveDeleted:c,onNewChat:d,onClose:a,labels:r,locale:i})}var _n=(e,t)=>Object.entries(t).reduce((e,[t,n])=>e.split(`{${t}}`).join(String(n)),e),vn=e=>!e||e.kind!==`http`?!1:e.status===401||e.status===403;function yn({conversations:e,activeConversationId:t,selectStatus:n,onSelect:r,onActiveDeleted:i,onNewChat:a,onClose:o,labels:s,locale:c,now:u}){let{conversations:d,status:f,error:p,hasMore:h,refresh:g,loadMore:_,remove:v}=e,y=(0,l.useId)(),b=(0,l.useId)(),x=(0,l.useRef)(null),S=(0,l.useRef)(null),C=(0,l.useRef)(null),w=(0,l.useRef)(new Map),T=(0,l.useRef)(new Map),E=(0,l.useRef)(null),D=(0,l.useRef)(null),[O,k]=(0,l.useState)(null),[A,j]=(0,l.useState)(null),[ee,M]=(0,l.useState)(0),[te,ne]=(0,l.useState)(!1),[re,N]=(0,l.useState)(!1),[ie,P]=(0,l.useState)(!1),F=c??(typeof navigator<`u`?navigator.language:void 0);(0,l.useEffect)(()=>{x.current?.focus()},[]),(0,l.useEffect)(()=>{let e=E.current;if(!e)return;let t=e.kind===`select`?w.current.get(e.id):e.kind===`delete`?T.current.get(e.id):e.kind===`cancel`?C.current:S.current;t&&(t.focus(),E.current=null)}),(0,l.useEffect)(()=>{let e=D.current;e!==null&&f!==`loading`&&(D.current=null,!h&&d.length>e&&(E.current={kind:`select`,id:d[e].conversationId}))},[f,h,d]);let ae=()=>{D.current=d.length,_()},I=e=>{E.current={kind:`delete`,id:e},k(null)},oe=e=>{if(e.key===`Escape`){if(e.stopPropagation(),O){I(O);return}o({restoreFocusTo:`menu`})}},se=async e=>{if(P(!1),e===t){o({restoreFocusTo:`input`});return}N(!0);try{await r({conversationId:e})}catch{E.current={kind:`select`,id:e},P(!0),N(!1);return}N(!1),o({restoreFocusTo:`input`})},L=async e=>{let n=d.findIndex(t=>t.conversationId===e),r=d[n+1]??d[n-1];E.current=r?{kind:`select`,id:r.conversationId}:{kind:`newChat`},k(null),j(null),ne(!1),M(e=>e+1);try{await v({conversationId:e}),ne(!0),e===t&&i?.()}catch{E.current={kind:`delete`,id:e},j(e)}finally{M(e=>e-1)}},R=f===`loading`&&d.length===0,ce=f===`error`&&d.length===0,le=f===`error`&&d.length>0&&h,z=f===`loading`&&d.length>0,B=re||n===`loading`,V=R?s.historyLoadingText:ee>0?s.historyDeletingText:te?s.historyDeletedText:d.length>0?_n(d.length===1?s.historyCountTextOne:s.historyCountTextMany,{count:d.length}):``,ue=R||ee>0;return(0,m.jsxs)(`section`,{role:`region`,"aria-labelledby":y,className:`bailey-history-drawer`,onKeyDown:oe,children:[(0,m.jsxs)(`div`,{className:`bailey-history-header`,children:[(0,m.jsx)(`button`,{type:`button`,className:`bailey-history-icon-button`,"aria-label":s.historyBackAriaLabel,onClick:()=>o({restoreFocusTo:`menu`}),children:(0,m.jsx)(It,{className:`bailey-history-icon`})}),(0,m.jsx)(`h3`,{id:y,ref:x,tabIndex:-1,className:`bailey-history-heading`,children:s.historyTitle}),(0,m.jsxs)(`button`,{ref:S,type:`button`,className:`bailey-history-button bailey-history-new-chat`,"aria-label":s.newChatButtonText,disabled:R,onClick:a,children:[(0,m.jsx)(jt,{className:`bailey-history-icon-small`}),(0,m.jsx)(`span`,{className:`bailey-history-new-chat-text`,children:s.newChatButtonText})]})]}),(0,m.jsxs)(`div`,{className:`bailey-history-body`,"aria-busy":R||void 0,children:[R&&(0,m.jsxs)(`div`,{"aria-hidden":`true`,children:[(0,m.jsx)(`div`,{className:`bailey-history-skeleton`}),(0,m.jsx)(`div`,{className:`bailey-history-skeleton`}),(0,m.jsx)(`div`,{className:`bailey-history-skeleton`}),(0,m.jsx)(`div`,{className:`bailey-history-skeleton`})]}),ce&&(0,m.jsxs)(`div`,{role:`alert`,className:`bailey-history-state bailey-history-state-error`,children:[(0,m.jsx)(Rt,{className:`bailey-history-state-icon`}),(0,m.jsx)(`strong`,{children:vn(p)?s.historySessionExpiredTitle:s.historyErrorTitle}),(0,m.jsx)(`span`,{children:vn(p)?s.historySessionExpiredDescription:s.historyErrorDescription}),(0,m.jsx)(`button`,{type:`button`,className:`bailey-history-button bailey-history-button-primary`,onClick:()=>void g(),children:s.retryButtonText})]}),!R&&!ce&&d.length===0&&(0,m.jsxs)(`div`,{className:`bailey-history-state`,children:[(0,m.jsx)(Ot,{className:`bailey-history-state-icon`}),(0,m.jsx)(`strong`,{children:s.historyEmptyTitle}),(0,m.jsx)(`span`,{children:s.historyEmptyDescription}),(0,m.jsx)(`button`,{type:`button`,className:`bailey-history-button bailey-history-button-primary`,onClick:a,children:s.historyEmptyCtaText})]}),d.length>0&&(0,m.jsx)(`ul`,{className:`bailey-history-list`,children:d.map(e=>{let n=e.conversationId,r=e.title?.trim()?e.title:s.historyUntitledText,i=n===t;if(O===n)return(0,m.jsx)(`li`,{className:`bailey-history-row bailey-history-row-confirming`,children:(0,m.jsxs)(`div`,{role:`group`,"aria-labelledby":b,className:`bailey-history-confirm`,children:[(0,m.jsx)(`span`,{id:b,className:`bailey-history-confirm-question`,children:s.historyDeleteConfirmQuestion}),(0,m.jsx)(`span`,{className:`bailey-history-confirm-title`,children:r}),(0,m.jsx)(`button`,{type:`button`,className:`bailey-history-button bailey-history-button-danger`,onClick:()=>void L(n),children:s.historyDeleteConfirmText}),(0,m.jsx)(`button`,{ref:C,type:`button`,className:`bailey-history-button`,onClick:()=>I(n),children:s.historyDeleteCancelText})]})},n);let a=hn({iso:e.updatedAt,locale:F,now:u?.(),justNowText:s.historyJustNowText}),o=_n(e.messageCount===1?s.historyMessageCountOne:s.historyMessageCountMany,{count:e.messageCount}),c=A===n;return(0,m.jsxs)(`li`,{className:`bailey-history-row${i?` bailey-history-row-active`:``}${c?` bailey-history-row-failed`:``}`,children:[(0,m.jsxs)(`button`,{type:`button`,ref:e=>{e?w.current.set(n,e):w.current.delete(n)},className:`bailey-history-select`,"aria-current":i?`true`:void 0,"aria-disabled":B||void 0,onClick:()=>{B||se(n)},children:[(0,m.jsx)(`span`,{className:`bailey-history-row-title`,children:r}),(0,m.jsxs)(`span`,{className:`bailey-history-meta`,children:[i&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`bailey-history-current`,children:s.historyCurrentText}),(0,m.jsx)(`span`,{"aria-hidden":`true`,children:`·`})]}),a&&(0,m.jsx)(`span`,{children:a}),(0,m.jsx)(`span`,{className:`bailey-history-count`,children:o})]})]}),(0,m.jsx)(`button`,{type:`button`,ref:e=>{e?T.current.set(n,e):T.current.delete(n)},className:`bailey-history-icon-button bailey-history-delete`,"aria-label":_n(s.historyDeleteAriaLabel,{title:r}),onClick:()=>{j(null),ne(!1),E.current={kind:`cancel`},k(n)},children:(0,m.jsx)(Lt,{className:`bailey-history-icon`})}),c&&(0,m.jsxs)(`div`,{role:`alert`,className:`bailey-history-row-error`,children:[(0,m.jsx)(Rt,{className:`bailey-history-icon-small`}),(0,m.jsx)(`span`,{children:s.historyDeleteFailedText}),(0,m.jsx)(`button`,{type:`button`,className:`bailey-history-button bailey-history-button-small`,onClick:()=>void L(n),children:s.historyDeleteRetryText}),(0,m.jsx)(`button`,{type:`button`,className:`bailey-history-button bailey-history-button-small`,onClick:()=>j(null),children:s.historyDeleteDismissText})]})]},n)})}),ie&&(0,m.jsx)(`div`,{role:`alert`,className:`bailey-history-inline-error`,children:s.historySelectErrorText}),h&&d.length>0&&(0,m.jsx)(`div`,{className:`bailey-history-more`,children:le?(0,m.jsxs)(`div`,{role:`alert`,className:`bailey-history-inline-error`,children:[(0,m.jsx)(`span`,{children:s.historyLoadMoreErrorText}),(0,m.jsx)(`button`,{type:`button`,className:`bailey-history-button`,onClick:ae,children:s.retryButtonText})]}):(0,m.jsxs)(`button`,{type:`button`,className:`bailey-history-button`,disabled:z,onClick:ae,children:[z&&(0,m.jsx)(`span`,{className:`bailey-history-spinner`,"aria-hidden":`true`}),z?s.historyLoadingMoreText:s.historyLoadMoreText]})})]}),(0,m.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`bailey-history-status`,children:[ue&&(0,m.jsx)(`span`,{className:`bailey-history-spinner`,"aria-hidden":`true`}),V]})]})}var bn={newChatButtonText:`New chat`,retryButtonText:`Retry`,historyTitle:`Chat history`,historyBackAriaLabel:`Back to chat`,historyLoadingText:`Loading conversations…`,historyLoadingMoreText:`Loading…`,historyLoadMoreText:`Load more`,historyLoadMoreErrorText:`Couldn't load more conversations.`,historyCountTextOne:`Showing {count} conversation`,historyCountTextMany:`Showing {count} conversations`,historyEmptyTitle:`No conversations yet`,historyEmptyDescription:`Your past conversations will show up here.`,historyEmptyCtaText:`Start a new chat`,historyErrorTitle:`Couldn't load your conversations`,historyErrorDescription:`Check your connection and try again.`,historySessionExpiredTitle:`Your session has expired`,historySessionExpiredDescription:`Sign in again to see your past conversations.`,historySelectErrorText:`Couldn't open this conversation.`,historyUntitledText:`Untitled conversation`,historyCurrentText:`Current`,historyMessageCountOne:`1 message`,historyMessageCountMany:`{count} messages`,historyDeleteAriaLabel:`Delete conversation: {title}`,historyDeleteConfirmQuestion:`Delete this conversation?`,historyDeleteConfirmText:`Delete`,historyDeleteCancelText:`Cancel`,historyDeletingText:`Deleting conversation…`,historyDeletedText:`Conversation deleted`,historyDeleteFailedText:`Couldn't delete this conversation.`,historyDeleteRetryText:`Try again`,historyDeleteDismissText:`Dismiss`,historyJustNowText:`just now`},xn=`How can bailey AI help you today?`,Sn=`Reply to bailey AI`,Cn={...bn,newChatButtonText:`New chat`,newChatAriaLabel:`new chat`,historyAriaLabel:`conversation history`,historyMenuItemText:`Chat history`,menuAriaLabel:`more options`,suggestionsTitle:`Suggested for you`,emptyStateMessage:`Ask Bailey a question to get started.`,youLabel:`You`,thinkingHint:`Thinking…`,retryButtonText:`Retry`,dismissErrorAriaLabel:`dismiss error`,sendAriaLabel:`send`,stopButtonText:`Stop`,stopAriaLabel:`stop`,copyButtonAriaLabel:`copy response as markdown`,copyButtonTooltipDefault:`Copy as markdown`,copyButtonTooltipCopied:`Copied!`,toolStepsSummaryOne:`Used 1 agent`,toolStepsSummaryMany:`Used {count} agents`,toolStepsFailedSuffix:`, {failed} failed`,toolStepFailedText:`failed`,toolStepStoppedText:`stopped`,toolStepStartedText:`started {offset} after send`,mcpAppDefaultTitle:`MCP App`,loadEarlierButtonText:`Load earlier messages`,loadEarlierErrorText:`Couldn't load earlier messages.`},wn=[d.default],Tn={...St(),p:({children:e})=>(0,m.jsx)(m.Fragment,{children:e})},En=(0,l.memo)(function({content:e,components:t}){return(0,m.jsx)(`div`,{className:`bailey-markdown-content`,children:(0,m.jsx)(u.default,{remarkPlugins:wn,components:t,skipHtml:!0,children:e})})});function Dn(e,t,n){if(e!==`streaming`)return;let r=t.filter(e=>e.turnSentAt===n?.sentAt);return r[r.length-1]}function On(e){if(!(!e||e.kind===`tool_end`))return Qe(e)}function kn(e){let t=new Date(e),n=t.toDateString()===new Date().toDateString(),r=t.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`});return n?`Today ${r}`:`${t.toLocaleDateString()} ${r}`}function An({chat:e,placeholder:t,replyPlaceholder:n=Sn,emptyPlaceholder:r,suggestions:i,onHistoryClick:a,history:o,locale:s,privacyNote:c,resolveActivityIcon:d,sendIcon:h,className:g,height:_,width:v,hideDeveloperDetails:y=!1,renderMessageActions:b,renderTable:x,renderChart:S,renderMcpApp:C,labels:w,formatMessageTime:T}){let{messages:E,traceEvents:D,lastRequest:O,status:k,error:A,send:j,stop:ee,retryLast:M,clearTrace:te,clearError:ne,newChat:re}=e,[N,ie]=(0,l.useState)(``),P={...Cn,...w},F=T??kn,ae=(0,l.useRef)(null),I=(0,l.useRef)(null),oe=(0,l.useRef)(null),se=(0,l.useRef)(null),[L,R]=(0,l.useState)(!1),ce=(0,l.useRef)(null),le=(0,l.useRef)(!1),z=!!a||!!o,B=bt(ae),V=(0,l.useRef)(null),ue=(0,l.useRef)(null),H=(0,l.useRef)(!0),de=(0,l.useMemo)(()=>St({renderTable:x,renderChart:S}),[x,S]),fe=(0,l.useMemo)(()=>Dn(k,D,O),[k,D,O]),U=On(fe),W=fe?.kind===`tool_end`?fe.at:void 0,G=E[E.length-1]?.content.length??0,[pe,me]=(0,l.useState)(null),K=pe;W!==void 0&&pe?.at!==W&&(K={at:W,length:G},me(K));let he=W!==void 0&&K?.at===W&&G<=K.length,q=U??(he?P.thinkingHint:void 0),J=E.length===0,ge=t??(J?r??xn:n);(0,l.useEffect)(()=>{let e=ue.current;if(!e)return;let t=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight;H.current=t<60};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[]),(0,l.useEffect)(()=>{H.current&&V.current?.scrollIntoView({behavior:k===`streaming`?`auto`:`smooth`,block:`nearest`})},[E,k]);let Y=e=>{H.current=!0,j(e)},X=(0,l.useRef)(null),_e=()=>{let t=ue.current;H.current=!1,X.current=t?{height:t.scrollHeight,top:t.scrollTop}:null,e.loadEarlier?.().catch(()=>{X.current=null})};(0,l.useEffect)(()=>{let e=X.current,t=ue.current;!e||!t||t.scrollHeight===e.height||(t.scrollTop=e.top+(t.scrollHeight-e.height),X.current=null)},[E]),(0,l.useEffect)(()=>{I.current?.toggleAttribute(`inert`,L)},[L]),(0,l.useEffect)(()=>{L||!ce.current||((ce.current===`input`?oe.current:se.current)?.focus(),ce.current=null)},[L]);let Z=(0,l.useCallback)(e=>{ce.current=e.restoreFocusTo,R(!1)},[]);return(0,m.jsx)(ct.Provider,{value:B,children:(0,m.jsxs)(`div`,{ref:ae,className:`bailey-chat-panel${g?` ${g}`:``}`,style:_!==void 0||v!==void 0?{height:_,width:v}:void 0,children:[(0,m.jsxs)(`div`,{className:`bailey-chat-panel-inner`,ref:I,children:[(0,m.jsxs)(`div`,{className:`bailey-chat-transcript`,ref:ue,children:[e.hasEarlier&&e.loadEarlier&&(0,m.jsxs)(`div`,{className:`bailey-load-earlier`,children:[(0,m.jsx)(`button`,{type:`button`,className:`bailey-load-earlier-button`,disabled:e.historyStatus===`loading`,onClick:_e,children:P.loadEarlierButtonText}),e.historyStatus===`error`&&(0,m.jsx)(`div`,{role:`alert`,className:`bailey-load-earlier-error`,children:P.loadEarlierErrorText})]}),J&&(i&&i.length>0?(0,m.jsxs)(`div`,{className:`bailey-suggestions`,children:[(0,m.jsx)(`div`,{className:`bailey-suggestions-title`,children:P.suggestionsTitle}),i.map((e,t)=>(0,m.jsxs)(`button`,{type:`button`,onClick:()=>Y(e.value??e.label),className:`bailey-suggestion-card`,children:[(0,m.jsx)(`span`,{children:e.label}),(0,m.jsx)(Tt,{className:`bailey-suggestion-icon`})]},`${e.label}-${t}`))]}):(0,m.jsx)(`div`,{className:`bailey-empty-state`,children:P.emptyStateMessage})),E.map((e,t)=>{let n=e.role===`assistant`&&t===E.length-1,r=k===`streaming`&&n&&e.content===``,i=e.role===`assistant`?ot(D,e.createdAt):[],a=i.some(e=>e.status===`running`);return(0,m.jsx)(`div`,{className:e.role===`user`?`bailey-message-row bailey-message-row-user`:`bailey-message-row`,children:e.role===`user`?(0,m.jsxs)(`div`,{className:`bailey-user-message`,children:[(0,m.jsxs)(`div`,{className:`bailey-message-meta`,children:[(0,m.jsx)(`span`,{className:`bailey-message-meta-name`,children:P.youLabel}),e.createdAt!==void 0&&(0,m.jsx)(`span`,{children:F(e.createdAt)})]}),(0,m.jsx)(`div`,{className:`bailey-user-bubble`,children:e.content})]}):r?a?(0,m.jsx)(sn,{steps:i,resolveActivityIcon:d}):(0,m.jsxs)(`div`,{className:`bailey-thinking-hint`,children:[(0,m.jsx)(`span`,{children:U??P.thinkingHint}),(0,m.jsx)(`span`,{className:`bailey-step-spinner`,"aria-hidden":`true`})]}):(0,m.jsxs)(`div`,{className:`bailey-assistant-message`,children:[!e.streaming&&(0,m.jsx)(cn,{steps:i,labels:P,resolveActivityIcon:d}),(0,m.jsx)(En,{content:e.content,components:de}),e.parts?.map((e,t)=>e.type===`image`?(0,m.jsx)(Xt,{src:e.src,alt:e.alt},t):e.type===`mcp_app`?(0,m.jsx)(l.Fragment,{children:C?C(e):(0,m.jsx)(rn,{...e,title:e.title??P.mcpAppDefaultTitle})},t):null),e.streaming&&(0,m.jsx)(sn,{steps:i,resolveActivityIcon:d}),e.streaming&&q&&!a&&(0,m.jsxs)(`div`,{className:`bailey-streaming-hint`,children:[(0,m.jsx)(`span`,{children:q}),(0,m.jsx)(`span`,{className:`bailey-step-spinner`,"aria-hidden":`true`})]}),!e.streaming&&(0,m.jsxs)(`div`,{className:`bailey-message-actions`,children:[(0,m.jsx)(Bt,{markdown:e.content,ariaLabel:P.copyButtonAriaLabel,tooltipDefaultText:P.copyButtonTooltipDefault,tooltipCopiedText:P.copyButtonTooltipCopied}),b?.(e)]})]})},e.id)}),(0,m.jsx)(`div`,{ref:V})]}),A&&(0,m.jsxs)(`div`,{className:`bailey-error-banner`,role:`alert`,children:[(0,m.jsx)(`span`,{children:A}),(0,m.jsxs)(`div`,{className:`bailey-error-actions`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:M,className:`bailey-retry-button`,children:P.retryButtonText}),(0,m.jsx)(`button`,{type:`button`,onClick:ne,"aria-label":P.dismissErrorAriaLabel,className:`bailey-dismiss-button`,children:`✕`})]})]}),!y&&(0,m.jsx)(Yt,{events:D,lastRequest:O,onClear:te}),(0,m.jsxs)(`div`,{className:`bailey-input-area`,children:[(0,m.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),!(!N.trim()||k===`streaming`)&&(Y(N),ie(``))},className:`bailey-input-row`,children:[(0,m.jsx)(`input`,{ref:oe,type:`text`,placeholder:ge,"aria-label":ge,value:N,onChange:e=>ie(e.target.value),disabled:k===`streaming`,className:`bailey-input`}),k===`streaming`?(0,m.jsx)(p.Provider,{delayDuration:200,children:(0,m.jsxs)(p.Root,{children:[(0,m.jsx)(p.Trigger,{asChild:!0,children:(0,m.jsx)(`button`,{type:`button`,onClick:ee,"aria-label":P.stopAriaLabel,className:`bailey-stop-button`,children:(0,m.jsx)(wt,{className:`bailey-stop-icon`})})}),(0,m.jsx)(p.Portal,{container:B instanceof ShadowRoot?B:void 0,children:(0,m.jsxs)(p.Content,{side:`top`,className:`bailey-tooltip-content`,children:[P.stopButtonText,(0,m.jsx)(p.Arrow,{className:`bailey-tooltip-arrow`})]})})]})}):(0,m.jsx)(`button`,{type:`submit`,"aria-label":P.sendAriaLabel,disabled:!N.trim(),className:`bailey-send-button`,children:h??(0,m.jsx)(Ct,{className:`bailey-send-icon`})})]}),(!J||z)&&(0,m.jsxs)(f.Root,{children:[(0,m.jsx)(f.Trigger,{asChild:!0,children:(0,m.jsx)(`button`,{type:`button`,ref:se,"aria-label":P.menuAriaLabel,className:`bailey-menu-button`,children:(0,m.jsx)(At,{className:`bailey-menu-icon`})})}),(0,m.jsx)(f.Portal,{container:B instanceof ShadowRoot?B:void 0,children:(0,m.jsxs)(f.Content,{side:`top`,align:`end`,sideOffset:8,className:`bailey-menu-content`,onCloseAutoFocus:e=>{le.current&&=(e.preventDefault(),!1)},children:[!J&&(0,m.jsxs)(f.Item,{onSelect:()=>re(),className:`bailey-menu-item`,children:[(0,m.jsx)(jt,{className:`bailey-menu-item-icon`}),P.newChatButtonText]}),z&&(0,m.jsxs)(f.Item,{onSelect:()=>{if(a){a();return}le.current=!0,R(!0)},className:`bailey-menu-item`,children:[(0,m.jsx)(Ot,{className:`bailey-menu-item-icon`}),P.historyMenuItemText]})]})})]})]}),(J||c?.alwaysVisible)&&c&&(0,m.jsx)(`div`,{className:`bailey-privacy-note`,children:(0,m.jsx)(u.default,{remarkPlugins:wn,components:Tn,skipHtml:!0,children:c.markdown})})]}),L&&o&&!a&&(0,m.jsx)(gn,{client:o.client,pageSize:o.pageSize,chat:e,labels:P,locale:s,onClose:Z})]})})}var jn={feedbackGroupLabel:`Rate this response`,feedbackThumbsUpAriaLabel:`Good response`,feedbackThumbsDownAriaLabel:`Bad response`,feedbackReasonGroupLabel:`What went wrong?`,feedbackCommentLabel:`Tell us more`,feedbackCommentPlaceholder:`What should Bailey have said or done differently?`,feedbackSubmitText:`Submit`,feedbackCancelText:`Cancel`,feedbackThanksText:`Thanks for your feedback`,feedbackUndoText:`Undo`,feedbackEditText:`Edit`,feedbackAddCommentText:`Add a comment`,feedbackSavingText:`Saving…`,feedbackErrorText:`Couldn't save your feedback. Try again.`,feedbackPrivacyNote:`Your comment is saved with this conversation and may be reviewed by support.`,feedbackReasonInaccurate:`Inaccurate`,feedbackReasonUnhelpful:`Unhelpful`,feedbackReasonUnsafe:`Unsafe`,feedbackReasonTooLong:`Too long`,feedbackReasonOther:`Other`},Mn=2e3,Nn=[`inaccurate`,`unhelpful`,`unsafe`,`too_long`,`other`],Pn={inaccurate:`feedbackReasonInaccurate`,unhelpful:`feedbackReasonUnhelpful`,unsafe:`feedbackReasonUnsafe`,too_long:`feedbackReasonTooLong`,other:`feedbackReasonOther`},Fn=e=>Nn.includes(e)?e:`other`;function In(e){return Array.from(new Set((e??Nn).map(Fn)))}function Ln(e){return typeof e==`number`&&e>0?Math.min(Math.floor(e),Mn):Mn}function Rn(e,t){if(e===null||t===null)return e===t;let n=e.reasonCodes??[],r=t.reasonCodes??[];return e.rating===t.rating&&(e.comment??``)===(t.comment??``)&&n.length===r.length&&n.every((e,t)=>e===r[t])}function zn(e){return e.messageId?(0,m.jsx)(Bn,{...e},e.messageId):null}function Bn({messageId:e,onSubmit:t,onClear:n,initialRating:r,reasonOptions:i,maxCommentLength:a,labels:o,className:s}){let c={...jn,...o},u=In(i),d=Ln(a),f=r?{rating:r}:null,[h,g]=(0,l.useState)(f),[_,v]=(0,l.useState)(r??null),[y,b]=(0,l.useState)(!1),[x,S]=(0,l.useState)(`down`),[C,w]=(0,l.useState)([]),[T,E]=(0,l.useState)(``),[D,O]=(0,l.useState)(!1),[k,A]=(0,l.useState)(!1),[j,ee]=(0,l.useState)(!1),[M,te]=(0,l.useState)(!1),ne=(0,l.useRef)(f),re=(0,l.useRef)(null),N=(0,l.useRef)(0),ie=(0,l.useRef)(!1),P=(0,l.useRef)(!0),F=(0,l.useRef)(null),ae=(0,l.useRef)(null),I=(0,l.useRef)(null),oe=(0,l.useRef)(null),se=(0,l.useRef)(null),L=xt(ae),R=(0,l.useId)(),ce=`${R}-comment`,le=`${R}-counter`,z=`${R}-privacy`;(0,l.useEffect)(()=>(P.current=!0,()=>{P.current=!1}),[]),(0,l.useEffect)(()=>{y&&se.current?.focus()},[y]),(0,l.useEffect)(()=>{F.current&&!j&&!y&&((F.current===`up`?I:oe).current?.focus(),F.current=null)});let B=()=>{w([]),E(``)},V=async r=>{try{return r.kind===`clear`?await n({messageId:e}):await t({messageId:e,...r.snapshot}),!0}catch{return!1}},ue=async()=>{if(!ie.current){ie.current=!0,A(!0);try{for(;re.current&&P.current;){let e=re.current,t=e.kind===`clear`?null:e.snapshot,n=!(e.kind===`submit`&&e.formSubmit)&&Rn(t,ne.current)||await V(e);if(!P.current)return;let r=re.current?.version!==e.version;!n&&r||(n?(ne.current=t,g(t)):(v(ne.current?.rating??null),te(!0)),r||(re.current=null,ee(!1),n&&e.kind===`submit`&&e.formSubmit&&(b(!1),O(!0),F.current=e.snapshot.rating)))}}finally{ie.current=!1,P.current&&A(!1)}}},H=e=>{N.current+=1,re.current={...e,version:N.current},te(!1),ue()},de=()=>{v(null),b(!1),O(!1),B(),H({kind:`clear`})},fe=e=>{if(!j){if(_===e){de();return}v(e),O(!1),B(),e===`down`?(S(`down`),b(!0)):b(!1),H({kind:`submit`,snapshot:{rating:e},formSubmit:!1})}},U=e=>{_!==null&&(S(_),w((e?.reasonCodes??[]).map(Fn)),E(e?.comment??``),te(!1),b(!0))},W=()=>{j||(b(!1),te(!1),B(),F.current=x)},G=()=>{if(j)return;let e=T.trim(),t=u.filter(e=>C.includes(e)),n={rating:x,...t.length>0?{reasonCodes:t}:{},...e?{comment:e}:{}};ee(!0),v(x),H({kind:`submit`,snapshot:n,formSubmit:!0})},pe=e=>{w(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},me=e=>{e.key===`Escape`&&(e.stopPropagation(),W())},K=_!==null&&h?.rating===_&&!k&&!y,he=!!h&&(!!h.comment||(h.reasonCodes?.length??0)>0),q=k?c.feedbackSavingText:K?c.feedbackThanksText:``,J=e=>{let t=_===e,n=e===`up`?c.feedbackThumbsUpAriaLabel:c.feedbackThumbsDownAriaLabel,r=e===`up`?Pt:Ft;return(0,m.jsxs)(p.Root,{children:[(0,m.jsx)(p.Trigger,{asChild:!0,children:(0,m.jsx)(`button`,{ref:e===`up`?I:oe,type:`button`,className:`bailey-feedback-thumb`,"aria-pressed":t,"aria-label":n,"aria-busy":t&&k?!0:void 0,disabled:j,onClick:()=>fe(e),children:(0,m.jsx)(r,{className:`bailey-feedback-icon`,filled:t})})}),(0,m.jsx)(p.Portal,{container:L instanceof ShadowRoot?L:void 0,children:(0,m.jsxs)(p.Content,{side:`top`,className:`bailey-tooltip-content`,children:[n,(0,m.jsx)(p.Arrow,{className:`bailey-tooltip-arrow`})]})})]})};return(0,m.jsxs)(`div`,{ref:ae,className:`bailey-feedback${s?` ${s}`:``}`,children:[(0,m.jsx)(p.Provider,{delayDuration:200,children:(0,m.jsxs)(`div`,{role:`group`,"aria-label":c.feedbackGroupLabel,"aria-busy":k?!0:void 0,className:`bailey-feedback-thumbs`,children:[J(`up`),J(`down`)]})}),(0,m.jsxs)(`span`,{role:`status`,className:`bailey-feedback-status`,children:[k&&(0,m.jsx)(`span`,{className:`bailey-feedback-spinner`,"aria-hidden":`true`}),q]}),K&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`button`,{type:`button`,className:`bailey-feedback-link`,onClick:()=>U(h),children:D||he?c.feedbackEditText:c.feedbackAddCommentText}),(0,m.jsx)(`button`,{type:`button`,className:`bailey-feedback-link`,onClick:de,children:c.feedbackUndoText})]}),M&&(0,m.jsx)(`span`,{role:`alert`,className:`bailey-feedback-error`,children:c.feedbackErrorText}),y&&(0,m.jsxs)(`div`,{className:`bailey-feedback-form`,onKeyDown:me,children:[u.length>0&&(0,m.jsxs)(`fieldset`,{className:`bailey-feedback-reasons`,children:[(0,m.jsx)(`legend`,{className:`bailey-feedback-legend`,children:c.feedbackReasonGroupLabel}),(0,m.jsx)(`div`,{className:`bailey-feedback-chips`,children:u.map((e,t)=>(0,m.jsx)(`button`,{ref:t===0?e=>{se.current=e}:void 0,type:`button`,className:`bailey-feedback-chip`,"aria-pressed":C.includes(e),disabled:j,onClick:()=>pe(e),children:c[Pn[e]]},e))})]}),(0,m.jsx)(`label`,{htmlFor:ce,className:`bailey-feedback-legend`,children:c.feedbackCommentLabel}),(0,m.jsx)(`textarea`,{id:ce,ref:u.length===0?e=>{se.current=e}:void 0,className:`bailey-feedback-textarea`,value:T,maxLength:d,placeholder:c.feedbackCommentPlaceholder,"aria-describedby":`${le} ${z}`,disabled:j,onChange:e=>E(e.target.value.slice(0,d))}),(0,m.jsxs)(`div`,{className:`bailey-feedback-meta`,children:[(0,m.jsx)(`span`,{id:z,className:`bailey-feedback-privacy`,children:c.feedbackPrivacyNote}),(0,m.jsx)(`span`,{id:le,className:`bailey-feedback-counter`,children:`${T.length} / ${d}`})]}),(0,m.jsxs)(`div`,{className:`bailey-feedback-buttons`,children:[(0,m.jsx)(`button`,{type:`button`,className:`bailey-feedback-button`,disabled:j,onClick:W,children:c.feedbackCancelText}),(0,m.jsx)(`button`,{type:`button`,className:`bailey-feedback-button bailey-feedback-button-primary`,disabled:j,onClick:G,children:j?c.feedbackSavingText:c.feedbackSubmitText})]})]})]})}var Vn=`0.3.1-pre.2`;exports.ActivityIcon=kt,exports.ArrowUpRightIcon=Tt,exports.BAILEYAI_CHAT_UI_VERSION=Vn,exports.BAILEY_CHART_PROMPT_FRAGMENT=Ie,exports.BAILEY_TABLE_GRID_ROW_THRESHOLD=ke,exports.BaileyApiError=z,exports.BaileyChatPanel=An,exports.BaileyCleanupError=V,exports.BaileyFeedbackButtons=zn,exports.BaileyHistoryDrawer=gn,exports.BaileyTracePanel=Yt,exports.CopyMarkdownButton=Bt,exports.DEFAULT_CONVERSATION_STORAGE_KEY=te,exports.HeartIcon=Ct,exports.TRACE_KIND_LABEL=We,exports.ThumbDownIcon=Ft,exports.ThumbUpIcon=Pt,exports.createBaileyClient=Q,exports.createBaileyFeedbackHandlers=we,exports.createBaileyMarkdownComponents=St,exports.createMemoryConversationStorage=re,exports.createSessionConversationStorage=ne,exports.extractPseudoToolCalls=w,exports.extractTableData=Pe,exports.formatRelativeTime=hn,exports.formatTraceGap=et,exports.formatTraceTime=$e,exports.hasTraceFailure=it,exports.isConversationIdForSub=M,exports.isSafeMarkdownUrl=c.n,exports.joinInstructions=Te,exports.mapTranscript=A,exports.mergeEarlierPage=ee,exports.parseBaileyChartSpec=Ue,exports.parseSseFrames=E,exports.resolveToolCall=Oe,exports.shouldUseGrid=Fe,exports.toActivityLines=at,exports.toToolSteps=ot,exports.toTraceRows=tt,exports.toTraceSegments=rt,exports.traceEventArgsDetail=Je,exports.traceEventHint=Qe,exports.traceEventOutputDetail=Ye,exports.traceEventRawDetail=Ze,exports.traceEventSummary=qe,exports.traceEventToolName=Ke,exports.traceSummaryLine=nt,exports.useBaileyChat=le,exports.useBaileyConversations=H;
|
|
12
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-border-style:solid;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-leading:initial;--tw-space-y-reverse:0;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:"Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-green-100:oklch(96.2% .044 156.743);--color-green-700:oklch(52.7% .154 150.069);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-700:oklch(48.8% .243 264.376);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-700:oklch(49.6% .265 301.924);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--color-bailey-accent:#4f46e5;--color-bailey-bubble-bg:#fff;--color-bailey-error:#d32f2f;--color-bailey-border:#e5e5e5;--color-bailey-surface:#fff;--color-bailey-surface-muted:#f9fafb;--color-bailey-text:#000;--color-bailey-text-secondary:#6b6b6b;--color-bailey-tooltip-bg:#000;--color-bailey-tooltip-text:#fff;--color-bailey-page-bg:#eceef4;--color-bailey-heart:#16a34a}}@layer utilities;.bailey-chat-panel{box-sizing:border-box;background-color:var(--color-bailey-page-bg);height:100%;padding:calc(var(--spacing) * 3);font-family:var(--font-sans);flex-direction:column;display:flex;position:relative}.bailey-chat-panel-inner{width:100%;min-height:0;max-width:var(--container-3xl);gap:calc(var(--spacing) * 2);flex-direction:column;flex:1;margin-inline:auto;display:flex;overflow-y:auto}.bailey-chat-transcript{min-height:0;padding:calc(var(--spacing) * 2);padding-bottom:calc(var(--spacing) * 4);flex:1;overflow-y:auto}.bailey-message-row{margin-bottom:calc(var(--spacing) * 3);justify-content:flex-start;display:flex}.bailey-message-row-user{justify-content:flex-end}.bailey-user-message{flex-direction:column;align-items:flex-end;max-width:75%;display:flex}.bailey-message-meta{margin-bottom:var(--spacing);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-message-meta-name{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);color:var(--color-bailey-text)}.bailey-user-bubble{border-radius:var(--radius-2xl);background-color:var(--color-bailey-bubble-bg);max-width:100%;padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);white-space:pre-wrap;color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.bailey-assistant-message{width:100%;padding-inline:var(--spacing)}.bailey-tool-result-image{margin-top:calc(var(--spacing) * 2);border-radius:var(--radius-lg);max-width:100%;height:auto;display:block}.bailey-mcp-app-frame{margin-top:calc(var(--spacing) * 2);border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:0;width:100%;height:480px;display:block}.bailey-thinking-hint{align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);font-style:italic;display:flex}.bailey-streaming-hint{margin-top:var(--spacing);align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);font-style:italic;display:flex}.bailey-message-actions{margin-top:var(--spacing);align-items:center;gap:var(--spacing);flex-wrap:wrap;display:flex}.bailey-empty-state{text-align:center;height:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);justify-content:center;align-items:center;display:flex}.bailey-suggestions{gap:calc(var(--spacing) * 3);padding:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-suggestions-title{padding-inline:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text)}.bailey-suggestion-card{cursor:pointer;appearance:none;justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-2xl);--tw-border-style:none;background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 3);text-align:left;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-style:none;display:flex}@media (hover:hover){.bailey-suggestion-card:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}}.bailey-suggestion-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-text-secondary);flex-shrink:0}.bailey-privacy-note{border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 4);padding-top:calc(var(--spacing) * 3);padding-bottom:var(--spacing);text-align:center;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-privacy-note a{color:var(--color-bailey-text-secondary);text-decoration-line:underline}.bailey-tool-steps-live{margin-top:calc(var(--spacing) * 2);gap:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-activity-line{align-items:center;gap:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-activity-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-bailey-accent);flex-shrink:0}.bailey-step-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-bailey-border);border-top-color:var(--color-bailey-accent);border-radius:2147483647px;flex-shrink:0}@media (prefers-reduced-motion:no-preference){.bailey-step-spinner{animation:var(--animate-spin)}}.bailey-tool-steps-summary{margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text-secondary)}.bailey-tool-steps-summary>summary{cursor:pointer;-webkit-user-select:none;user-select:none}.bailey-tool-steps-list{margin:0;margin-top:var(--spacing);gap:var(--spacing);flex-direction:column;padding:0;list-style-type:none;display:flex}.bailey-tool-step{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-tool-step-start{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.bailey-tool-step-failed{color:var(--color-bailey-error)}.bailey-error-banner{margin-bottom:calc(var(--spacing) * 2);justify-content:space-between;align-items:center;gap:calc(var(--spacing) * 2);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-error);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);color:var(--color-bailey-error);display:flex}.bailey-retry-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);background-color:#0000;border-style:none;text-decoration-line:underline}.bailey-error-actions{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-dismiss-button{cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-error);background-color:#0000;border-style:none}@media (hover:hover){.bailey-dismiss-button:hover{opacity:.7}}.bailey-input-area{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-input-row{align-items:center;gap:calc(var(--spacing) * 2);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);min-width:0;padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;flex:1;display:flex}.bailey-input-row:focus-within{border-color:var(--color-bailey-accent)}.bailey-input{--tw-border-style:none;min-width:0;padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;background-color:#0000;border-style:none;outline-style:none;flex:1}.bailey-input:disabled{opacity:.5}.bailey-send-button,.bailey-stop-button{cursor:pointer;appearance:none;background-color:#0000;border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}:is(.bailey-send-button,.bailey-stop-button):disabled{cursor:default;opacity:.4}.bailey-send-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-heart);border-style:none}@media (hover:hover){.bailey-send-button:hover{background-color:#16a34a1a}@supports (color:color-mix(in lab, red, red)){.bailey-send-button:hover{background-color:color-mix(in oklab, var(--color-bailey-heart) 10%, transparent)}}}.bailey-send-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-stop-button{height:calc(var(--spacing) * 9);width:calc(var(--spacing) * 9);--tw-border-style:none;color:var(--color-bailey-error);border-style:none}@media (hover:hover){.bailey-stop-button:hover{background-color:#d32f2f1a}@supports (color:color-mix(in lab, red, red)){.bailey-stop-button:hover{background-color:color-mix(in oklab, var(--color-bailey-error) 10%, transparent)}}}.bailey-stop-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-copy-button{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;border-radius:2147483647px;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-copy-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-copy-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-copy-button:hover{color:var(--color-bailey-text)}}.bailey-copy-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-tooltip-content{padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));background-color:var(--color-bailey-tooltip-bg,#000);color:var(--color-bailey-tooltip-text,#fff);border-radius:.25rem}.bailey-menu-button{height:calc(var(--spacing) * 13);width:calc(var(--spacing) * 13);cursor:pointer;appearance:none;border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);color:var(--color-bailey-text);--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-radius:2147483647px;flex-shrink:0;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-menu-button:hover{background-color:var(--color-gray-50)}}.bailey-menu-icon{height:calc(var(--spacing) * 5);width:calc(var(--spacing) * 5)}.bailey-menu-content{z-index:50;min-width:calc(var(--spacing) * 44);border-radius:var(--radius-2xl);background-color:var(--color-white);padding-block:calc(var(--spacing) * 2);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-black);--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);font-family:var(--font-sans,"Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif)}.bailey-menu-item{cursor:pointer;align-items:center;gap:calc(var(--spacing) * 3);padding-inline:calc(var(--spacing) * 4);padding-block:calc(var(--spacing) * 2);--tw-outline-style:none;outline-style:none;display:flex}.bailey-menu-item[data-highlighted]{background-color:var(--color-gray-100)}.bailey-menu-item-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4);color:var(--color-gray-600)}.bailey-tooltip-arrow{fill:var(--color-bailey-tooltip-bg,#000)}.bailey-markdown-content table{border-collapse:collapse;width:100%;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.bailey-markdown-content th{background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);text-align:left;--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content td{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);vertical-align:top}.bailey-markdown-content tr:nth-child(2n){background-color:var(--color-bailey-surface-muted)}.bailey-markdown-content{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.bailey-markdown-content>:first-child{margin-top:0}.bailey-markdown-content>:last-child{margin-bottom:0}.bailey-markdown-content p{margin-block:calc(var(--spacing) * 2)}.bailey-markdown-content h1{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h2{margin-top:calc(var(--spacing) * 4);margin-bottom:calc(var(--spacing) * 2);font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h3{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content h4,.bailey-markdown-content h5,.bailey-markdown-content h6{margin-top:calc(var(--spacing) * 3);margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.bailey-markdown-content ul{margin-block:calc(var(--spacing) * 2);list-style-type:disc}:where(.bailey-markdown-content ul>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ul{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content ol{margin-block:calc(var(--spacing) * 2);list-style-type:decimal}:where(.bailey-markdown-content ol>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}.bailey-markdown-content ol{padding-left:calc(var(--spacing) * 5)}.bailey-markdown-content a{color:var(--color-bailey-accent);text-underline-offset:2px;text-decoration-line:underline}.bailey-markdown-content code{background-color:var(--color-bailey-surface-muted);padding-inline:var(--spacing);padding-block:calc(var(--spacing) * .5);font-family:var(--font-mono);border-radius:.25rem;font-size:.85em}.bailey-markdown-content pre{margin-block:calc(var(--spacing) * 2);border-radius:var(--radius-md);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 2);overflow-x:auto}.bailey-markdown-content pre code{background-color:#0000;padding:0}.bailey-markdown-content blockquote{margin-block:calc(var(--spacing) * 2);border-left-style:var(--tw-border-style);border-left-width:2px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 3);color:var(--color-bailey-text-secondary);font-style:italic}.bailey-markdown-content hr{margin-block:calc(var(--spacing) * 3);border-color:var(--color-bailey-border)}.bailey-trace-panel{margin-bottom:calc(var(--spacing) * 2)}.bailey-trace-toggle-row{align-items:center;gap:calc(var(--spacing) * 2);display:flex}.bailey-trace-toggle{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none}@media (hover:hover){.bailey-trace-toggle:hover{text-decoration-line:underline}}.bailey-trace-toggle-error{color:var(--color-bailey-error)}.bailey-trace-summary{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary)}.bailey-trace-summary-error{color:var(--color-bailey-error)}.bailey-trace-body{margin-top:var(--spacing);max-height:calc(var(--spacing) * 80);overflow-y:auto}.bailey-trace-actions-row{justify-content:flex-end;gap:calc(var(--spacing) * 3);display:flex}.bailey-trace-copy-button{cursor:pointer;appearance:none;--tw-border-style:none;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none;text-decoration-line:underline}@media (hover:hover){.bailey-trace-copy-button:hover{text-decoration-line:none}}.bailey-trace-request-details{margin-bottom:var(--spacing);border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding:calc(var(--spacing) * 2)}.bailey-trace-request-meta{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:block}.bailey-trace-rows{gap:var(--spacing);flex-direction:column;display:flex}.bailey-trace-row{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing);font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-row-header{align-items:center;gap:calc(var(--spacing) * 2);flex-wrap:wrap;display:flex}.bailey-trace-row-time{color:var(--color-bailey-text-secondary)}.bailey-trace-row-gap{color:var(--color-gray-400)}.bailey-trace-row-summary{word-break:break-all}.bailey-trace-chip{padding-inline:calc(var(--spacing) * 1.5);padding-block:calc(var(--spacing) * .5);--tw-font-weight:var(--font-weight-semibold);font-size:.65rem;font-weight:var(--font-weight-semibold);border-radius:.25rem}.bailey-trace-chip-default{background-color:var(--color-gray-200);color:var(--color-gray-700)}.bailey-trace-chip-info{background-color:var(--color-blue-100);color:var(--color-blue-700)}.bailey-trace-chip-success{background-color:var(--color-green-100);color:var(--color-green-700)}.bailey-trace-chip-secondary{background-color:var(--color-purple-100);color:var(--color-purple-700)}.bailey-trace-chip-error{background-color:var(--color-red-100);color:var(--color-bailey-error)}.bailey-trace-disclosure{margin-top:var(--spacing)}.bailey-trace-disclosure-summary{cursor:pointer;color:var(--color-bailey-text-secondary);font-size:.7rem}.bailey-trace-disclosure-actions{margin-top:var(--spacing);justify-content:flex-end;display:flex}.bailey-trace-disclosure-content{margin-top:var(--spacing);max-height:calc(var(--spacing) * 48);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding:calc(var(--spacing) * 1.5);word-break:break-all;white-space:pre-wrap;border-radius:.25rem;font-size:.7rem;overflow:auto}.bailey-trace-group{border-radius:var(--radius-md);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 2);padding-block:var(--spacing)}.bailey-trace-group-summary{cursor:pointer;font-family:var(--font-mono);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-trace-group-failed{margin-left:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-feedback{align-items:center;gap:var(--spacing);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);flex-wrap:wrap;display:flex}.bailey-message-actions>.bailey-feedback{display:contents}.bailey-feedback-thumbs{margin-left:var(--spacing);align-items:center;gap:calc(var(--spacing) * .5);border-left-style:var(--tw-border-style);border-left-width:1px;border-color:var(--color-bailey-border);padding-left:calc(var(--spacing) * 2);display:flex}.bailey-feedback-thumb{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);cursor:pointer;appearance:none;border-radius:var(--radius-lg);--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-feedback-thumb:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-thumb:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-feedback-thumb:hover{color:var(--color-bailey-text)}}.bailey-feedback-thumb:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-thumb:disabled{cursor:default;opacity:.5}.bailey-feedback-thumb[aria-pressed=true]{background-color:#4f46e51a}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-thumb[aria-pressed=true]{background-color:color-mix(in oklab, var(--color-bailey-accent) 10%, transparent)}}.bailey-feedback-thumb[aria-pressed=true]{color:var(--color-bailey-accent)}.bailey-feedback-icon{height:calc(var(--spacing) * 4);width:calc(var(--spacing) * 4)}.bailey-feedback-status{align-items:center;gap:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:inline-flex}.bailey-feedback-status:empty{display:none}.bailey-feedback-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);animation:var(--animate-spin);border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-bailey-border);border-top-color:var(--color-bailey-accent);border-radius:2147483647px;display:inline-block}.bailey-feedback-link{cursor:pointer;appearance:none;--tw-border-style:none;padding-inline:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-accent);background-color:#0000;border-style:none;text-decoration-line:underline}.bailey-feedback-link:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-error{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-feedback-form{margin-top:calc(var(--spacing) * 2);box-sizing:border-box;border-radius:var(--radius-xl);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);width:100%;padding:calc(var(--spacing) * 3);flex-basis:100%}.bailey-feedback-reasons{margin:0;margin-bottom:calc(var(--spacing) * 2);--tw-border-style:none;border-style:none;min-width:0;padding:0}.bailey-feedback-legend{margin-bottom:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-text);padding:0;display:block}.bailey-feedback-chips{gap:calc(var(--spacing) * 1.5);flex-wrap:wrap;display:flex}.bailey-feedback-chip{cursor:pointer;appearance:none;border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3);padding-block:var(--spacing);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text);border-radius:2147483647px}.bailey-feedback-chip:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-chip:disabled{cursor:default;opacity:.5}.bailey-feedback-chip[aria-pressed=true]{border-color:var(--color-bailey-accent);background-color:#4f46e51a}@supports (color:color-mix(in lab, red, red)){.bailey-feedback-chip[aria-pressed=true]{background-color:color-mix(in oklab, var(--color-bailey-accent) 10%, transparent)}}.bailey-feedback-chip[aria-pressed=true]{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-bailey-accent)}.bailey-feedback-textarea{box-sizing:border-box;min-height:calc(var(--spacing) * 18);resize:vertical;border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);width:100%;padding-inline:calc(var(--spacing) * 2.5);padding-block:calc(var(--spacing) * 2);font-family:var(--font-sans);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text);display:block}.bailey-feedback-textarea:disabled{opacity:.5}.bailey-feedback-meta{margin-top:calc(var(--spacing) * 1.5);justify-content:space-between;align-items:flex-start;gap:calc(var(--spacing) * 3);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-feedback-buttons{margin-top:calc(var(--spacing) * 2.5);justify-content:flex-end;gap:calc(var(--spacing) * 2);display:flex}.bailey-feedback-button{cursor:pointer;appearance:none;border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3.5);padding-block:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-feedback-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-feedback-button:disabled{cursor:default;opacity:.5}.bailey-feedback-button-primary{border-color:var(--color-bailey-accent);background-color:var(--color-bailey-accent);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-load-earlier{align-items:center;gap:var(--spacing);padding-bottom:calc(var(--spacing) * 2);flex-direction:column;display:flex}.bailey-load-earlier-button{cursor:pointer;appearance:none;border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3.5);padding-block:calc(var(--spacing) * 1.5);font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-load-earlier-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-load-earlier-button:disabled{cursor:default;opacity:.5}.bailey-load-earlier-error{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error)}.bailey-history-drawer{z-index:10;background-color:var(--color-bailey-surface);font-family:var(--font-sans);color:var(--color-bailey-text);border-radius:14px;flex-direction:column;display:flex;position:absolute;inset:0;overflow:hidden;container-type:inline-size}.bailey-history-header{align-items:center;gap:calc(var(--spacing) * 2);border-bottom-style:var(--tw-border-style);border-bottom-width:1px;border-color:var(--color-bailey-border);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);display:flex}.bailey-history-heading{text-overflow:ellipsis;white-space:nowrap;--tw-font-weight:var(--font-weight-semibold);min-width:0;font-size:15px;font-weight:var(--font-weight-semibold);--tw-outline-style:none;outline-style:none;flex:1;margin:0;overflow:hidden}.bailey-history-icon-button{height:calc(var(--spacing) * 11);width:calc(var(--spacing) * 11);cursor:pointer;appearance:none;border-radius:var(--radius-lg);--tw-border-style:none;color:var(--color-bailey-text-secondary);background-color:#0000;border-style:none;flex:none;justify-content:center;align-items:center;display:flex}@media (hover:hover){.bailey-history-icon-button:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.bailey-history-icon-button:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.bailey-history-icon-button:hover{color:var(--color-bailey-text)}}.bailey-history-icon-button:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-icon-button:disabled{cursor:default;opacity:.5}.bailey-history-icon{width:18px;height:18px}.bailey-history-icon-small{height:calc(var(--spacing) * 3.5);width:calc(var(--spacing) * 3.5);flex:none}.bailey-history-button{min-height:calc(var(--spacing) * 11);cursor:pointer;appearance:none;justify-content:center;align-items:center;gap:calc(var(--spacing) * 1.5);border-radius:var(--radius-lg);border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 1.5);white-space:nowrap;color:var(--color-bailey-text);font-size:13px;display:inline-flex}.bailey-history-button:focus-visible{outline-style:var(--tw-outline-style);outline-offset:2px;outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-button:disabled{cursor:default;opacity:.5}.bailey-history-button-primary{border-color:var(--color-bailey-accent);background-color:var(--color-bailey-accent);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-history-button-danger{border-color:var(--color-bailey-error);background-color:var(--color-bailey-error);--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold);color:var(--color-white)}.bailey-history-button-small{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.bailey-history-body{padding-inline:calc(var(--spacing) * 2);padding-block:calc(var(--spacing) * 1.5);flex:1;overflow-y:auto}.bailey-history-list{margin:0;padding:0;list-style-type:none}.bailey-history-row{border-radius:10px;flex-wrap:wrap;align-items:center;display:flex;position:relative}.bailey-history-row+.bailey-history-row{margin-top:calc(var(--spacing) * .5)}.bailey-history-row:not(.bailey-history-row-active):hover{background-color:var(--color-gray-100)}.bailey-history-row-active{box-shadow:inset 3px 0 0 var(--color-bailey-accent,#4f46e5);background-color:#4f46e514}.bailey-history-select{min-height:calc(var(--spacing) * 11);cursor:pointer;appearance:none;gap:calc(var(--spacing) * .5);--tw-border-style:none;min-width:0;padding-block:calc(var(--spacing) * 2.5);padding-right:calc(var(--spacing) * 2.5);padding-left:calc(var(--spacing) * 3);text-align:left;color:var(--color-bailey-text);background-color:#0000;border-style:none;border-radius:10px;flex-direction:column;flex:1;font-family:inherit;display:flex}.bailey-history-select:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px;outline-color:var(--color-bailey-accent)}.bailey-history-select:disabled{cursor:default;opacity:.6}.bailey-history-row-title{text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);overflow:hidden}.bailey-history-meta{align-items:center;gap:calc(var(--spacing) * 1.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-history-meta>span+.bailey-history-count:before{content:"·";margin-right:.375rem}.bailey-history-current{--tw-font-weight:var(--font-weight-semibold);font-size:11px;font-weight:var(--font-weight-semibold);color:var(--color-bailey-accent)}.bailey-history-delete{margin-right:var(--spacing)}.bailey-history-row-confirming{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-red-200);background-color:var(--color-red-50)}.bailey-history-confirm{align-items:center;gap:calc(var(--spacing) * 2);min-width:0;padding-block:calc(var(--spacing) * 2);padding-right:calc(var(--spacing) * 2.5);padding-left:calc(var(--spacing) * 3);flex-wrap:wrap;flex:1;display:flex}.bailey-history-confirm-question{--tw-font-weight:var(--font-weight-semibold);min-width:7.5rem;font-size:13px;font-weight:var(--font-weight-semibold);flex:1}.bailey-history-confirm-title{text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);flex-basis:100%;overflow:hidden}.bailey-history-row-failed{border-style:var(--tw-border-style);border-width:1px;border-color:var(--color-red-200);background-color:#fff7f7}.bailey-history-row-error{align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 3);padding-bottom:calc(var(--spacing) * 2.5);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error);flex-wrap:wrap;flex-basis:100%;display:flex}.bailey-history-state{align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 6);padding-block:calc(var(--spacing) * 12);text-align:center;color:var(--color-bailey-text-secondary);flex-direction:column;font-size:13px;display:flex}.bailey-history-state strong{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height));color:var(--color-bailey-text)}.bailey-history-state-icon{height:calc(var(--spacing) * 7);width:calc(var(--spacing) * 7);color:var(--color-gray-400)}.bailey-history-state-error .bailey-history-state-icon{color:var(--color-bailey-error)}.bailey-history-more{padding-top:calc(var(--spacing) * 2.5);padding-bottom:calc(var(--spacing) * 1.5);justify-content:center;display:flex}.bailey-history-inline-error{justify-content:center;align-items:center;gap:calc(var(--spacing) * 2);padding-inline:calc(var(--spacing) * 3);padding-block:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-error);flex-wrap:wrap;display:flex}.bailey-history-status{min-height:calc(var(--spacing) * 9);align-items:center;gap:calc(var(--spacing) * 2);border-top-style:var(--tw-border-style);border-top-width:1px;border-color:var(--color-bailey-border);background-color:var(--color-bailey-surface-muted);padding-inline:calc(var(--spacing) * 3.5);padding-block:calc(var(--spacing) * 2);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));color:var(--color-bailey-text-secondary);display:flex}.bailey-history-skeleton{margin-inline:var(--spacing);margin-bottom:calc(var(--spacing) * 1.5);background:linear-gradient(90deg,#f1f1f4 25%,#e6e6ec 50%,#f1f1f4 75%) 0 0/200% 100%;border-radius:10px;height:52px;animation:1.3s infinite bailey-history-shimmer}.bailey-history-spinner{height:calc(var(--spacing) * 3);width:calc(var(--spacing) * 3);border-style:var(--tw-border-style);border-width:2px;border-color:var(--color-bailey-border);border-top-color:var(--color-bailey-accent,#4f46e5);border-radius:2147483647px;animation:.8s linear infinite bailey-history-rotate;display:inline-block}@keyframes bailey-history-shimmer{to{background-position:-200% 0}}@keyframes bailey-history-rotate{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.bailey-history-skeleton,.bailey-history-spinner{animation:none}}@container (width<=340px){.bailey-history-new-chat{width:calc(var(--spacing) * 11);padding-inline:0}.bailey-history-new-chat-text,.bailey-history-count{display:none}}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-leading{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@keyframes spin{to{transform:rotate(360deg)}}`,ct=(0,l.createContext)(void 0),lt=/:root\s*,\s*:host\s*\{([^}]*)\}/,ut=`.bailey-chat-panel`,dt=`.bailey-menu-content,.bailey-tooltip-content`,ft=`--color-bailey-`;function pt(e){let t=e.match(new RegExp(lt,`g`))?.length??0;if(t!==1)throw Error(`Expected exactly one ":root, :host {" rule in the compiled styles.css, found ${t}. Tailwind likely changed how @theme compiles — update this rewrite (and its sibling, scripts/scope-theme-vars.js) before shipping.`);return e.replace(lt,(e,t)=>`${ut}{${t}}${dt}{${t.split(`;`).filter(e=>e.trim()&&!e.trim().startsWith(ft)).join(`;`)}}`)}var mt=pt(st),ht=`data-source`,gt=`baileyai-chat-ui`,_t=new WeakMap;function vt(e){let t=e.getRootNode();return t instanceof ShadowRoot?t:document}function yt(e){let t=e instanceof ShadowRoot?e:document.head,n=_t.get(e)??0;if(n===0&&!t.querySelector(`style[${ht}="${gt}"]`)){let e=document.createElement(`style`);e.setAttribute(ht,gt),e.textContent=mt,t.appendChild(e)}return _t.set(e,n+1),()=>{let n=(_t.get(e)??1)-1;n<=0?(_t.delete(e),t.querySelector(`style[${ht}="${gt}"]`)?.remove()):_t.set(e,n)}}function bt(e,t=!1){let[n,r]=(0,l.useState)(null);return(0,l.useLayoutEffect)(()=>{if(t)return;let n=e.current;if(!n)return;let i=vt(n);return r(i),yt(i)},[t,e]),n}function xt(e){let t=(0,l.useContext)(ct),n=t!==void 0,r=bt(e,n);return n?t:r}function St({renderTable:e,renderChart:t}={}){return{a:({href:e,children:t})=>!e||!c.n(e)?(0,m.jsx)(m.Fragment,{children:t}):(0,m.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t}),table:({node:t,children:n})=>{let r=t&&Pe(t);if(r&&Fe(r.rows)&&e){let t=r.rows.map(e=>e.map(e=>e.href&&!c.n(e.href)?{text:e.text}:e));return(0,m.jsx)(m.Fragment,{children:e({headers:r.headers,rows:t})})}return(0,m.jsx)(`table`,{children:n})},pre:({children:e})=>{let n=(Array.isArray(e)?e[0]:e)?.props;if((n?.className?.split(` `)??[]).includes(`language-chartjs`)&&t){let e=n?.children,r=Ue(Array.isArray(e)?e.join(``):String(e??``));if(r)return(0,m.jsx)(m.Fragment,{children:t(r)})}return(0,m.jsx)(`pre`,{children:e})}}}function Ct({className:e}){return(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,m.jsx)(`path`,{d:`M12 20.3s-7.6-4.7-10-9.4C.4 7.7 1.7 4 5.2 3.1c2.2-.6 4.4.4 5.5 2.2 1.2-1.8 3.4-2.8 5.6-2.2 3.5.9 4.8 4.6 3.2 7.8-2.4 4.7-10 9.4-10 9.4z`})})}function wt({className:e}){return(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,m.jsx)(`rect`,{x:`6`,y:`6`,width:`12`,height:`12`,rx:`2`})})}function Tt({className:e}){return(0,m.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[(0,m.jsx)(`path`,{d:`M7 17 17 7`}),(0,m.jsx)(`path`,{d:`M9 7h8v8`})]})}function Et({className:e}){return(0,m.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[(0,m.jsx)(`rect`,{x:`8`,y:`8`,width:`12`,height:`12`,rx:`2`}),(0,m.jsx)(`path`,{d:`M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2`})]})}function Dt({className:e}){return(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:(0,m.jsx)(`path`,{d:`M5 12.5 9.5 17 19 7`})})}function Ot({className:e}){return(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:(0,m.jsx)(`path`,{d:`m22.7 13.5-2-2-2 2M21 12a9 9 0 1 1-1.245-4.57M12 7v5l3 2`})})}function kt({className:e}){return(0,m.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[(0,m.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,m.jsx)(`path`,{d:`M8.5 12.5 11 15l4.5-5.5`})]})}function At({className:e}){return(0,m.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:[(0,m.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.75`}),(0,m.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.75`}),(0,m.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.75`})]})}function jt({className:e}){return(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:(0,m.jsx)(`path`,{d:`M12 5v14M5 12h14`})})}var Mt=`M7 11v9H4v-9h3zm0 0 4-8c1.7 0 2.7 1.3 2.4 3L13 9h5.5a2 2 0 0 1 2 2.4l-1.3 6.8A2 2 0 0 1 17.2 20H7`,Nt=`M17 13V4h3v9h-3zm0 0-4 8c-1.7 0-2.7-1.3-2.4-3L11 15H5.5a2 2 0 0 1-2-2.4l1.3-6.8A2 2 0 0 1 6.8 4H17`;function Pt({className:e,filled:t=!1}){return(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:t?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:1.8,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:(0,m.jsx)(`path`,{d:Mt})})}function Ft({className:e,filled:t=!1}){return(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:t?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:1.8,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:(0,m.jsx)(`path`,{d:Nt})})}function It({className:e}){return(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:(0,m.jsx)(`path`,{d:`M15 6l-6 6 6 6`})})}function Lt({className:e}){return(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:(0,m.jsx)(`path`,{d:`M4 7h16M10 11v6M14 11v6M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12M9 7V4h6v3`})})}function Rt({className:e}){return(0,m.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[(0,m.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,m.jsx)(`path`,{d:`M12 8v5M12 16.5v.01`})]})}var zt=1500;function Bt({markdown:e,className:t,ariaLabel:n=`copy response as markdown`,tooltipDefaultText:r=`Copy as markdown`,tooltipCopiedText:i=`Copied!`}){let[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(!1),u=(0,l.useRef)(null),d=(0,l.useRef)(null),f=xt(d);return(0,l.useEffect)(()=>()=>{u.current!==null&&clearTimeout(u.current)},[]),(0,m.jsx)(p.Provider,{delayDuration:200,children:(0,m.jsxs)(p.Root,{open:a||s,onOpenChange:c,children:[(0,m.jsx)(p.Trigger,{asChild:!0,children:(0,m.jsx)(`button`,{ref:d,type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(e)}catch{return}o(!0),u.current!==null&&clearTimeout(u.current),u.current=setTimeout(()=>o(!1),zt)},"aria-label":n,className:`bailey-copy-button${t?` ${t}`:``}`,children:a?(0,m.jsx)(Dt,{className:`bailey-copy-icon`}):(0,m.jsx)(Et,{className:`bailey-copy-icon`})})}),(0,m.jsx)(p.Portal,{container:f instanceof ShadowRoot?f:void 0,children:(0,m.jsxs)(p.Content,{side:`top`,className:`bailey-tooltip-content`,children:[a?i:r,(0,m.jsx)(p.Arrow,{className:`bailey-tooltip-arrow`})]})})]})})}async function Vt(e){try{await navigator.clipboard.writeText(e)}catch{}}function Ht({text:e,label:t=`Copy`}){return(0,m.jsx)(`button`,{type:`button`,onClick:()=>Vt(e),className:`bailey-trace-copy-button`,children:t})}function Ut(e){if(e.failed||e.kind===`error`)return`bailey-trace-chip bailey-trace-chip-error`;switch(e.kind){case`tool_start`:case`llm_call_start`:return`bailey-trace-chip bailey-trace-chip-info`;case`tool_end`:case`llm_call_end`:return`bailey-trace-chip bailey-trace-chip-success`;case`progress`:return`bailey-trace-chip bailey-trace-chip-secondary`;default:return`bailey-trace-chip bailey-trace-chip-default`}}function Wt({label:e,content:t,copyable:n}){return(0,m.jsxs)(`details`,{className:`bailey-trace-disclosure`,children:[(0,m.jsx)(`summary`,{className:`bailey-trace-disclosure-summary`,children:e}),n&&(0,m.jsx)(`div`,{className:`bailey-trace-disclosure-actions`,children:(0,m.jsx)(Ht,{text:t})}),(0,m.jsx)(`pre`,{className:`bailey-trace-disclosure-content`,children:t})]})}function Gt({row:e}){return(0,m.jsxs)(`div`,{className:`bailey-trace-row`,children:[(0,m.jsxs)(`div`,{className:`bailey-trace-row-header`,children:[(0,m.jsx)(`span`,{className:`bailey-trace-row-time`,children:e.time}),(0,m.jsx)(`span`,{className:`bailey-trace-row-gap`,title:`Time since the previous event`,children:et(e.gapMs)}),(0,m.jsx)(`span`,{className:Ut(e),children:e.label}),(0,m.jsx)(`span`,{className:`bailey-trace-row-summary`,children:e.summary})]}),e.argsDetail&&(0,m.jsx)(Wt,{label:e.kind===`llm_call_start`?`request`:`args`,content:e.argsDetail}),e.outputDetail&&(0,m.jsx)(Wt,{label:e.kind===`llm_call_end`?`response`:`output`,content:e.outputDetail}),e.structuredOutputDetail&&(0,m.jsx)(Wt,{label:`structured output`,content:e.structuredOutputDetail}),e.rawDetail&&(0,m.jsx)(Wt,{label:`raw`,content:e.rawDetail})]})}function Kt(e,t){if(e.chunkCount===0)return`Streamed: no chunks received`;if(e.chunkCount===1||e.firstChunkAt===null)return`Streamed: 1 chunk (not incremental)`;let n=e.firstChunkAt-t,r=(e.lastChunkAt??e.firstChunkAt)-e.firstChunkAt;return`Streamed: ${e.chunkCount} chunks · first chunk after ${n}ms · spread over ${(r/1e3).toFixed(1)}s`}function qt({request:e}){let t=(0,l.useMemo)(()=>JSON.stringify({model:e.model,instructions:e.systemPrompt,input:e.messages,stream:e.stream,tools:e.tools,toolChoice:e.toolChoice},null,2),[e]);return(0,m.jsxs)(`div`,{className:`bailey-trace-request-details`,children:[(0,m.jsxs)(`span`,{className:`bailey-trace-request-meta`,children:[`Last request — `,e.model,` · `,new Date(e.sentAt).toLocaleTimeString(),e.requestId?` · ${e.requestId}`:``]}),(0,m.jsx)(`span`,{className:`bailey-trace-request-meta`,children:Kt(e.streamStats,e.sentAt)}),(0,m.jsx)(Wt,{label:`System prompt (${e.systemPrompt.length.toLocaleString()} chars)`,content:e.systemPrompt,copyable:!0}),(0,m.jsx)(Wt,{label:`Messages (${e.messages.length})`,content:JSON.stringify(e.messages,null,2),copyable:!0}),e.response&&(0,m.jsx)(Wt,{label:`Response (${e.response.content.length.toLocaleString()} chars)`,content:e.response.content,copyable:!0}),(0,m.jsx)(Wt,{label:`Full payload (JSON)`,content:t,copyable:!0})]})}function Jt({events:e,lastRequest:t,onClear:n}){let r=(0,l.useMemo)(()=>tt(e),[e]),i=(0,l.useMemo)(()=>rt(r),[r]),a=(0,l.useMemo)(()=>JSON.stringify(e,null,2),[e]);return(0,m.jsxs)(`div`,{className:`bailey-trace-body`,children:[(0,m.jsxs)(`div`,{className:`bailey-trace-actions-row`,children:[e.length>0&&(0,m.jsx)(Ht,{text:a,label:`Copy trace as JSON`}),(0,m.jsx)(`button`,{type:`button`,onClick:n,className:`bailey-trace-copy-button`,children:`Clear`})]}),t&&(0,m.jsx)(qt,{request:t}),(0,m.jsx)(`div`,{className:`bailey-trace-rows`,children:i.map((e,t)=>{if(e.type===`single`)return(0,m.jsx)(Gt,{row:e.row},e.row.key);let n=e.rows.filter(e=>e.isToolStart).length;if(n<=1)return(0,m.jsx)(`div`,{className:`bailey-trace-rows`,children:e.rows.map(e=>(0,m.jsx)(Gt,{row:e},e.key))},`group-${t}`);let r=e.rows.filter(e=>e.failed).length;return(0,m.jsxs)(`details`,{className:`bailey-trace-group`,children:[(0,m.jsxs)(`summary`,{className:`bailey-trace-group-summary`,children:[(0,m.jsx)(`strong`,{children:e.toolName}),` × `,n,r>0&&(0,m.jsxs)(`span`,{className:`bailey-trace-group-failed`,children:[` `,r,` failed`]})]}),(0,m.jsx)(`div`,{className:`bailey-trace-rows`,children:e.rows.map(e=>(0,m.jsx)(Gt,{row:e},e.key))})]},`group-${t}`)})})]})}function Yt({events:e,lastRequest:t,onClear:n}){let[r,i]=(0,l.useState)(!1),a=(0,l.useMemo)(()=>it(e),[e]),o=(0,l.useMemo)(()=>nt(e),[e]);return e.length===0&&!t?null:(0,m.jsxs)(`div`,{className:`bailey-trace-panel`,children:[(0,m.jsxs)(`div`,{className:`bailey-trace-toggle-row`,children:[(0,m.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),"aria-expanded":r,className:a?`bailey-trace-toggle bailey-trace-toggle-error`:`bailey-trace-toggle`,children:[a&&!r?`⚠ `:``,r?`Hide details`:`Show details`,` (`,e.length,`)`]}),o&&(0,m.jsx)(`span`,{className:a?`bailey-trace-summary bailey-trace-summary-error`:`bailey-trace-summary`,children:o})]}),r&&(0,m.jsx)(Jt,{events:e,lastRequest:t,onClear:n})]})}function Xt({src:e,alt:t,className:n}){return c.t(e)?(0,m.jsx)(`img`,{src:e,alt:t??``,className:`bailey-tool-result-image${n?` ${n}`:``}`,referrerPolicy:`no-referrer`}):null}var Zt=/^ui:\/\//,Qt=2097152,$t=new Set([`connectDomains`,`resourceDomains`,`frameDomains`,`baseUriDomains`]),en=new Set([`camera`,`microphone`,`geolocation`,`clipboardWrite`]),tn=(e,t)=>e===void 0?!0:typeof e!=`object`||!e||Array.isArray(e)?!1:Object.keys(e).every(e=>t.has(e)),nn=e=>!(!Zt.test(e.resourceUri)||typeof e.html!=`string`||e.html.length===0||e.html.length>Qt||!tn(e.csp,$t)||!tn(e.permissions,en));function rn({html:e,title:t,resourceUri:n,csp:r,permissions:i,className:a}){return nn({html:e,resourceUri:n,csp:r,permissions:i})?(0,m.jsx)(`iframe`,{title:t??`MCP App`,srcDoc:e,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,className:`bailey-mcp-app-frame${a?` ${a}`:``}`}):null}function an({toolName:e,resolveActivityIcon:t}){let n=t?.(e);return n===0||n&&n!==!0?(0,m.jsx)(`span`,{className:`bailey-activity-icon`,children:n}):null}function on({offsetMs:e,labels:t}){let n=et(e),r=t.toolStepStartedText?.replace(`{offset}`,n);return(0,m.jsx)(`span`,{className:`bailey-tool-step-start`,title:r,"aria-label":r,role:r?`text`:void 0,children:n})}function sn({steps:e,resolveActivityIcon:t}){let n=e.filter(e=>e.status===`running`);return n.length===0?null:(0,m.jsx)(`div`,{className:`bailey-tool-steps-live`,role:`status`,"aria-live":`polite`,children:n.map(e=>(0,m.jsxs)(`div`,{className:`bailey-activity-line`,children:[(0,m.jsx)(an,{toolName:e.toolName,resolveActivityIcon:t}),(0,m.jsx)(`span`,{children:e.label}),(0,m.jsx)(`span`,{className:`bailey-step-spinner`,"aria-hidden":`true`})]},e.key))})}function cn({steps:e,labels:t,resolveActivityIcon:n}){if(e.length===0)return null;let r=e.filter(e=>e.status===`failed`).length,i=e.length===1?t.toolStepsSummaryOne:t.toolStepsSummaryMany.replace(`{count}`,String(e.length)),a=r>0?`${i}${t.toolStepsFailedSuffix.replace(`{failed}`,String(r))}`:i;return(0,m.jsxs)(`details`,{className:`bailey-tool-steps-summary`,children:[(0,m.jsx)(`summary`,{children:a}),(0,m.jsx)(`ul`,{className:`bailey-tool-steps-list`,children:e.map(e=>(0,m.jsxs)(`li`,{className:`bailey-tool-step`,children:[(0,m.jsx)(an,{toolName:e.toolName,resolveActivityIcon:n}),(0,m.jsx)(`span`,{children:e.label}),e.startOffsetMs!==void 0&&(0,m.jsx)(on,{offsetMs:e.startOffsetMs,labels:t}),e.runtimeSeconds!==void 0&&(0,m.jsx)(`span`,{children:`${e.runtimeSeconds.toFixed(1)}s`}),e.status===`failed`&&(0,m.jsx)(`span`,{className:`bailey-tool-step-failed`,children:t.toolStepFailedText}),e.status===`running`&&(0,m.jsx)(`span`,{children:t.toolStepStoppedText})]},e.key))})]})}var ln=/(Z|[+-]\d{2}:?\d{2})$/i,un=60,dn=3600,fn=24*dn,pn=30*fn*1e3;function mn(e){return e?Date.parse(ln.test(e)?e:`${e}Z`):NaN}function hn(e){let t=mn(e.iso);if(Number.isNaN(t))return``;let n=e.now??Date.now(),r=Math.max(0,n-t);if(typeof Intl>`u`||typeof Intl.RelativeTimeFormat!=`function`)return e.justNowText??``;if(r>=pn)return new Intl.DateTimeFormat(e.locale,{dateStyle:`medium`}).format(t);let i=r/1e3,a=new Intl.RelativeTimeFormat(e.locale,{numeric:`auto`});return i<un?a.format(0,`second`):i<dn?a.format(-Math.floor(i/un),`minute`):i<fn?a.format(-Math.floor(i/dn),`hour`):a.format(-Math.floor(i/fn),`day`)}function gn({client:e,pageSize:t,chat:n,labels:r,locale:i,onClose:a}){let o=H({client:e,pageSize:t}),{loadConversation:s,newChat:c}=n,u=(0,l.useCallback)(e=>s?s(e):Promise.reject(Error(`no loadConversation`)),[s]),d=(0,l.useCallback)(()=>{c(),a({restoreFocusTo:`input`})},[c,a]);return(0,m.jsx)(yn,{conversations:o,activeConversationId:n.conversationId,selectStatus:n.historyStatus,onSelect:u,onActiveDeleted:c,onNewChat:d,onClose:a,labels:r,locale:i})}var _n=(e,t)=>Object.entries(t).reduce((e,[t,n])=>e.split(`{${t}}`).join(String(n)),e),vn=e=>!e||e.kind!==`http`?!1:e.status===401||e.status===403;function yn({conversations:e,activeConversationId:t,selectStatus:n,onSelect:r,onActiveDeleted:i,onNewChat:a,onClose:o,labels:s,locale:c,now:u}){let{conversations:d,status:f,error:p,hasMore:h,refresh:g,loadMore:_,remove:v}=e,y=(0,l.useId)(),b=(0,l.useId)(),x=(0,l.useRef)(null),S=(0,l.useRef)(null),C=(0,l.useRef)(null),w=(0,l.useRef)(new Map),T=(0,l.useRef)(new Map),E=(0,l.useRef)(null),D=(0,l.useRef)(null),[O,k]=(0,l.useState)(null),[A,j]=(0,l.useState)(null),[ee,M]=(0,l.useState)(0),[te,ne]=(0,l.useState)(!1),[re,N]=(0,l.useState)(!1),[ie,P]=(0,l.useState)(!1),F=c??(typeof navigator<`u`?navigator.language:void 0);(0,l.useEffect)(()=>{x.current?.focus()},[]),(0,l.useEffect)(()=>{let e=E.current;if(!e)return;let t=e.kind===`select`?w.current.get(e.id):e.kind===`delete`?T.current.get(e.id):e.kind===`cancel`?C.current:S.current;t&&(t.focus(),E.current=null)}),(0,l.useEffect)(()=>{let e=D.current;e!==null&&f!==`loading`&&(D.current=null,!h&&d.length>e&&(E.current={kind:`select`,id:d[e].conversationId}))},[f,h,d]);let ae=()=>{D.current=d.length,_()},I=e=>{E.current={kind:`delete`,id:e},k(null)},oe=e=>{if(e.key===`Escape`){if(e.stopPropagation(),O){I(O);return}o({restoreFocusTo:`menu`})}},se=async e=>{if(P(!1),e===t){o({restoreFocusTo:`input`});return}N(!0);try{await r({conversationId:e})}catch{E.current={kind:`select`,id:e},P(!0),N(!1);return}N(!1),o({restoreFocusTo:`input`})},L=async e=>{let n=d.findIndex(t=>t.conversationId===e),r=d[n+1]??d[n-1];E.current=r?{kind:`select`,id:r.conversationId}:{kind:`newChat`},k(null),j(null),ne(!1),M(e=>e+1);try{await v({conversationId:e}),ne(!0),e===t&&i?.()}catch{E.current={kind:`delete`,id:e},j(e)}finally{M(e=>e-1)}},R=f===`loading`&&d.length===0,ce=f===`error`&&d.length===0,le=f===`error`&&d.length>0&&h,z=f===`loading`&&d.length>0,B=re||n===`loading`,V=R?s.historyLoadingText:ee>0?s.historyDeletingText:te?s.historyDeletedText:d.length>0?_n(d.length===1?s.historyCountTextOne:s.historyCountTextMany,{count:d.length}):``,ue=R||ee>0;return(0,m.jsxs)(`section`,{role:`region`,"aria-labelledby":y,className:`bailey-history-drawer`,onKeyDown:oe,children:[(0,m.jsxs)(`div`,{className:`bailey-history-header`,children:[(0,m.jsx)(`button`,{type:`button`,className:`bailey-history-icon-button`,"aria-label":s.historyBackAriaLabel,onClick:()=>o({restoreFocusTo:`menu`}),children:(0,m.jsx)(It,{className:`bailey-history-icon`})}),(0,m.jsx)(`h3`,{id:y,ref:x,tabIndex:-1,className:`bailey-history-heading`,children:s.historyTitle}),(0,m.jsxs)(`button`,{ref:S,type:`button`,className:`bailey-history-button bailey-history-new-chat`,"aria-label":s.newChatButtonText,disabled:R,onClick:a,children:[(0,m.jsx)(jt,{className:`bailey-history-icon-small`}),(0,m.jsx)(`span`,{className:`bailey-history-new-chat-text`,children:s.newChatButtonText})]})]}),(0,m.jsxs)(`div`,{className:`bailey-history-body`,"aria-busy":R||void 0,children:[R&&(0,m.jsxs)(`div`,{"aria-hidden":`true`,children:[(0,m.jsx)(`div`,{className:`bailey-history-skeleton`}),(0,m.jsx)(`div`,{className:`bailey-history-skeleton`}),(0,m.jsx)(`div`,{className:`bailey-history-skeleton`}),(0,m.jsx)(`div`,{className:`bailey-history-skeleton`})]}),ce&&(0,m.jsxs)(`div`,{role:`alert`,className:`bailey-history-state bailey-history-state-error`,children:[(0,m.jsx)(Rt,{className:`bailey-history-state-icon`}),(0,m.jsx)(`strong`,{children:vn(p)?s.historySessionExpiredTitle:s.historyErrorTitle}),(0,m.jsx)(`span`,{children:vn(p)?s.historySessionExpiredDescription:s.historyErrorDescription}),(0,m.jsx)(`button`,{type:`button`,className:`bailey-history-button bailey-history-button-primary`,onClick:()=>void g(),children:s.retryButtonText})]}),!R&&!ce&&d.length===0&&(0,m.jsxs)(`div`,{className:`bailey-history-state`,children:[(0,m.jsx)(Ot,{className:`bailey-history-state-icon`}),(0,m.jsx)(`strong`,{children:s.historyEmptyTitle}),(0,m.jsx)(`span`,{children:s.historyEmptyDescription}),(0,m.jsx)(`button`,{type:`button`,className:`bailey-history-button bailey-history-button-primary`,onClick:a,children:s.historyEmptyCtaText})]}),d.length>0&&(0,m.jsx)(`ul`,{className:`bailey-history-list`,children:d.map(e=>{let n=e.conversationId,r=e.title?.trim()?e.title:s.historyUntitledText,i=n===t;if(O===n)return(0,m.jsx)(`li`,{className:`bailey-history-row bailey-history-row-confirming`,children:(0,m.jsxs)(`div`,{role:`group`,"aria-labelledby":b,className:`bailey-history-confirm`,children:[(0,m.jsx)(`span`,{id:b,className:`bailey-history-confirm-question`,children:s.historyDeleteConfirmQuestion}),(0,m.jsx)(`span`,{className:`bailey-history-confirm-title`,children:r}),(0,m.jsx)(`button`,{type:`button`,className:`bailey-history-button bailey-history-button-danger`,onClick:()=>void L(n),children:s.historyDeleteConfirmText}),(0,m.jsx)(`button`,{ref:C,type:`button`,className:`bailey-history-button`,onClick:()=>I(n),children:s.historyDeleteCancelText})]})},n);let a=hn({iso:e.updatedAt,locale:F,now:u?.(),justNowText:s.historyJustNowText}),o=_n(e.messageCount===1?s.historyMessageCountOne:s.historyMessageCountMany,{count:e.messageCount}),c=A===n;return(0,m.jsxs)(`li`,{className:`bailey-history-row${i?` bailey-history-row-active`:``}${c?` bailey-history-row-failed`:``}`,children:[(0,m.jsxs)(`button`,{type:`button`,ref:e=>{e?w.current.set(n,e):w.current.delete(n)},className:`bailey-history-select`,"aria-current":i?`true`:void 0,"aria-disabled":B||void 0,onClick:()=>{B||se(n)},children:[(0,m.jsx)(`span`,{className:`bailey-history-row-title`,children:r}),(0,m.jsxs)(`span`,{className:`bailey-history-meta`,children:[i&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`bailey-history-current`,children:s.historyCurrentText}),(0,m.jsx)(`span`,{"aria-hidden":`true`,children:`·`})]}),a&&(0,m.jsx)(`span`,{children:a}),(0,m.jsx)(`span`,{className:`bailey-history-count`,children:o})]})]}),(0,m.jsx)(`button`,{type:`button`,ref:e=>{e?T.current.set(n,e):T.current.delete(n)},className:`bailey-history-icon-button bailey-history-delete`,"aria-label":_n(s.historyDeleteAriaLabel,{title:r}),onClick:()=>{j(null),ne(!1),E.current={kind:`cancel`},k(n)},children:(0,m.jsx)(Lt,{className:`bailey-history-icon`})}),c&&(0,m.jsxs)(`div`,{role:`alert`,className:`bailey-history-row-error`,children:[(0,m.jsx)(Rt,{className:`bailey-history-icon-small`}),(0,m.jsx)(`span`,{children:s.historyDeleteFailedText}),(0,m.jsx)(`button`,{type:`button`,className:`bailey-history-button bailey-history-button-small`,onClick:()=>void L(n),children:s.historyDeleteRetryText}),(0,m.jsx)(`button`,{type:`button`,className:`bailey-history-button bailey-history-button-small`,onClick:()=>j(null),children:s.historyDeleteDismissText})]})]},n)})}),ie&&(0,m.jsx)(`div`,{role:`alert`,className:`bailey-history-inline-error`,children:s.historySelectErrorText}),h&&d.length>0&&(0,m.jsx)(`div`,{className:`bailey-history-more`,children:le?(0,m.jsxs)(`div`,{role:`alert`,className:`bailey-history-inline-error`,children:[(0,m.jsx)(`span`,{children:s.historyLoadMoreErrorText}),(0,m.jsx)(`button`,{type:`button`,className:`bailey-history-button`,onClick:ae,children:s.retryButtonText})]}):(0,m.jsxs)(`button`,{type:`button`,className:`bailey-history-button`,disabled:z,onClick:ae,children:[z&&(0,m.jsx)(`span`,{className:`bailey-history-spinner`,"aria-hidden":`true`}),z?s.historyLoadingMoreText:s.historyLoadMoreText]})})]}),(0,m.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`bailey-history-status`,children:[ue&&(0,m.jsx)(`span`,{className:`bailey-history-spinner`,"aria-hidden":`true`}),V]})]})}var bn={newChatButtonText:`New chat`,retryButtonText:`Retry`,historyTitle:`Chat history`,historyBackAriaLabel:`Back to chat`,historyLoadingText:`Loading conversations…`,historyLoadingMoreText:`Loading…`,historyLoadMoreText:`Load more`,historyLoadMoreErrorText:`Couldn't load more conversations.`,historyCountTextOne:`Showing {count} conversation`,historyCountTextMany:`Showing {count} conversations`,historyEmptyTitle:`No conversations yet`,historyEmptyDescription:`Your past conversations will show up here.`,historyEmptyCtaText:`Start a new chat`,historyErrorTitle:`Couldn't load your conversations`,historyErrorDescription:`Check your connection and try again.`,historySessionExpiredTitle:`Your session has expired`,historySessionExpiredDescription:`Sign in again to see your past conversations.`,historySelectErrorText:`Couldn't open this conversation.`,historyUntitledText:`Untitled conversation`,historyCurrentText:`Current`,historyMessageCountOne:`1 message`,historyMessageCountMany:`{count} messages`,historyDeleteAriaLabel:`Delete conversation: {title}`,historyDeleteConfirmQuestion:`Delete this conversation?`,historyDeleteConfirmText:`Delete`,historyDeleteCancelText:`Cancel`,historyDeletingText:`Deleting conversation…`,historyDeletedText:`Conversation deleted`,historyDeleteFailedText:`Couldn't delete this conversation.`,historyDeleteRetryText:`Try again`,historyDeleteDismissText:`Dismiss`,historyJustNowText:`just now`},xn=`How can bailey AI help you today?`,Sn=`Reply to bailey AI`,Cn={...bn,newChatButtonText:`New chat`,newChatAriaLabel:`new chat`,historyAriaLabel:`conversation history`,historyMenuItemText:`Chat history`,menuAriaLabel:`more options`,suggestionsTitle:`Suggested for you`,emptyStateMessage:`Ask Bailey a question to get started.`,youLabel:`You`,thinkingHint:`Thinking…`,retryButtonText:`Retry`,dismissErrorAriaLabel:`dismiss error`,sendAriaLabel:`send`,stopButtonText:`Stop`,stopAriaLabel:`stop`,copyButtonAriaLabel:`copy response as markdown`,copyButtonTooltipDefault:`Copy as markdown`,copyButtonTooltipCopied:`Copied!`,toolStepsSummaryOne:`Used 1 agent`,toolStepsSummaryMany:`Used {count} agents`,toolStepsFailedSuffix:`, {failed} failed`,toolStepFailedText:`failed`,toolStepStoppedText:`stopped`,toolStepStartedText:`started {offset} after send`,mcpAppDefaultTitle:`MCP App`,loadEarlierButtonText:`Load earlier messages`,loadEarlierErrorText:`Couldn't load earlier messages.`},wn=[d.default],Tn={...St(),p:({children:e})=>(0,m.jsx)(m.Fragment,{children:e})},En=(0,l.memo)(function({content:e,components:t}){return(0,m.jsx)(`div`,{className:`bailey-markdown-content`,children:(0,m.jsx)(u.default,{remarkPlugins:wn,components:t,skipHtml:!0,children:e})})});function Dn(e,t,n){if(e!==`streaming`)return;let r=t.filter(e=>e.turnSentAt===n?.sentAt);return r[r.length-1]}function On(e){if(!(!e||e.kind===`tool_end`))return Qe(e)}function kn(e){let t=new Date(e),n=t.toDateString()===new Date().toDateString(),r=t.toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`});return n?`Today ${r}`:`${t.toLocaleDateString()} ${r}`}function An({chat:e,placeholder:t,replyPlaceholder:n=Sn,emptyPlaceholder:r,suggestions:i,onHistoryClick:a,history:o,locale:s,privacyNote:c,resolveActivityIcon:d,sendIcon:h,className:g,height:_,width:v,hideDeveloperDetails:y=!1,renderMessageActions:b,renderTable:x,renderChart:S,renderMcpApp:C,labels:w,formatMessageTime:T}){let{messages:E,traceEvents:D,lastRequest:O,status:k,error:A,send:j,stop:ee,retryLast:M,clearTrace:te,clearError:ne,newChat:re}=e,[N,ie]=(0,l.useState)(``),P={...Cn,...w},F=T??kn,ae=(0,l.useRef)(null),I=(0,l.useRef)(null),oe=(0,l.useRef)(null),se=(0,l.useRef)(null),[L,R]=(0,l.useState)(!1),ce=(0,l.useRef)(null),le=(0,l.useRef)(!1),z=!!a||!!o,B=bt(ae),V=(0,l.useRef)(null),ue=(0,l.useRef)(null),H=(0,l.useRef)(!0),de=(0,l.useMemo)(()=>St({renderTable:x,renderChart:S}),[x,S]),fe=(0,l.useMemo)(()=>Dn(k,D,O),[k,D,O]),U=On(fe),W=fe?.kind===`tool_end`?fe.at:void 0,G=E[E.length-1]?.content.length??0,[pe,me]=(0,l.useState)(null),K=pe;W!==void 0&&pe?.at!==W&&(K={at:W,length:G},me(K));let he=W!==void 0&&K?.at===W&&G<=K.length,q=U??(he?P.thinkingHint:void 0),J=E.length===0,ge=t??(J?r??xn:n);(0,l.useEffect)(()=>{let e=ue.current;if(!e)return;let t=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight;H.current=t<60};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[]),(0,l.useEffect)(()=>{H.current&&V.current?.scrollIntoView({behavior:k===`streaming`?`auto`:`smooth`,block:`nearest`})},[E,k]);let Y=e=>{H.current=!0,j(e)},X=(0,l.useRef)(null),_e=()=>{let t=ue.current;H.current=!1,X.current=t?{height:t.scrollHeight,top:t.scrollTop}:null,e.loadEarlier?.().catch(()=>{X.current=null})};(0,l.useEffect)(()=>{let e=X.current,t=ue.current;!e||!t||t.scrollHeight===e.height||(t.scrollTop=e.top+(t.scrollHeight-e.height),X.current=null)},[E]),(0,l.useEffect)(()=>{I.current?.toggleAttribute(`inert`,L)},[L]),(0,l.useEffect)(()=>{L||!ce.current||((ce.current===`input`?oe.current:se.current)?.focus(),ce.current=null)},[L]);let Z=(0,l.useCallback)(e=>{ce.current=e.restoreFocusTo,R(!1)},[]);return(0,m.jsx)(ct.Provider,{value:B,children:(0,m.jsxs)(`div`,{ref:ae,className:`bailey-chat-panel${g?` ${g}`:``}`,style:_!==void 0||v!==void 0?{height:_,width:v}:void 0,children:[(0,m.jsxs)(`div`,{className:`bailey-chat-panel-inner`,ref:I,children:[(0,m.jsxs)(`div`,{className:`bailey-chat-transcript`,ref:ue,children:[e.hasEarlier&&e.loadEarlier&&(0,m.jsxs)(`div`,{className:`bailey-load-earlier`,children:[(0,m.jsx)(`button`,{type:`button`,className:`bailey-load-earlier-button`,disabled:e.historyStatus===`loading`,onClick:_e,children:P.loadEarlierButtonText}),e.historyStatus===`error`&&(0,m.jsx)(`div`,{role:`alert`,className:`bailey-load-earlier-error`,children:P.loadEarlierErrorText})]}),J&&(i&&i.length>0?(0,m.jsxs)(`div`,{className:`bailey-suggestions`,children:[(0,m.jsx)(`div`,{className:`bailey-suggestions-title`,children:P.suggestionsTitle}),i.map((e,t)=>(0,m.jsxs)(`button`,{type:`button`,onClick:()=>Y(e.value??e.label),className:`bailey-suggestion-card`,children:[(0,m.jsx)(`span`,{children:e.label}),e.icon??(0,m.jsx)(Tt,{className:`bailey-suggestion-icon`})]},`${e.label}-${t}`))]}):(0,m.jsx)(`div`,{className:`bailey-empty-state`,children:P.emptyStateMessage})),E.map((e,t)=>{let n=e.role===`assistant`&&t===E.length-1,r=k===`streaming`&&n&&e.content===``,i=e.role===`assistant`?ot(D,e.createdAt):[],a=i.some(e=>e.status===`running`);return(0,m.jsx)(`div`,{className:e.role===`user`?`bailey-message-row bailey-message-row-user`:`bailey-message-row`,children:e.role===`user`?(0,m.jsxs)(`div`,{className:`bailey-user-message`,children:[(0,m.jsxs)(`div`,{className:`bailey-message-meta`,children:[(0,m.jsx)(`span`,{className:`bailey-message-meta-name`,children:P.youLabel}),e.createdAt!==void 0&&(0,m.jsx)(`span`,{children:F(e.createdAt)})]}),(0,m.jsx)(`div`,{className:`bailey-user-bubble`,children:e.content})]}):r?a?(0,m.jsx)(sn,{steps:i,resolveActivityIcon:d}):(0,m.jsxs)(`div`,{className:`bailey-thinking-hint`,children:[(0,m.jsx)(`span`,{children:U??P.thinkingHint}),(0,m.jsx)(`span`,{className:`bailey-step-spinner`,"aria-hidden":`true`})]}):(0,m.jsxs)(`div`,{className:`bailey-assistant-message`,children:[!e.streaming&&(0,m.jsx)(cn,{steps:i,labels:P,resolveActivityIcon:d}),(0,m.jsx)(En,{content:e.content,components:de}),e.parts?.map((e,t)=>e.type===`image`?(0,m.jsx)(Xt,{src:e.src,alt:e.alt},t):e.type===`mcp_app`?(0,m.jsx)(l.Fragment,{children:C?C(e):(0,m.jsx)(rn,{...e,title:e.title??P.mcpAppDefaultTitle})},t):null),e.streaming&&(0,m.jsx)(sn,{steps:i,resolveActivityIcon:d}),e.streaming&&q&&!a&&(0,m.jsxs)(`div`,{className:`bailey-streaming-hint`,children:[(0,m.jsx)(`span`,{children:q}),(0,m.jsx)(`span`,{className:`bailey-step-spinner`,"aria-hidden":`true`})]}),!e.streaming&&(0,m.jsxs)(`div`,{className:`bailey-message-actions`,children:[(0,m.jsx)(Bt,{markdown:e.content,ariaLabel:P.copyButtonAriaLabel,tooltipDefaultText:P.copyButtonTooltipDefault,tooltipCopiedText:P.copyButtonTooltipCopied}),b?.(e)]})]})},e.id)}),(0,m.jsx)(`div`,{ref:V})]}),A&&(0,m.jsxs)(`div`,{className:`bailey-error-banner`,role:`alert`,children:[(0,m.jsx)(`span`,{children:A}),(0,m.jsxs)(`div`,{className:`bailey-error-actions`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:M,className:`bailey-retry-button`,children:P.retryButtonText}),(0,m.jsx)(`button`,{type:`button`,onClick:ne,"aria-label":P.dismissErrorAriaLabel,className:`bailey-dismiss-button`,children:`✕`})]})]}),!y&&(0,m.jsx)(Yt,{events:D,lastRequest:O,onClear:te}),(0,m.jsxs)(`div`,{className:`bailey-input-area`,children:[(0,m.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),!(!N.trim()||k===`streaming`)&&(Y(N),ie(``))},className:`bailey-input-row`,children:[(0,m.jsx)(`input`,{ref:oe,type:`text`,placeholder:ge,"aria-label":ge,value:N,onChange:e=>ie(e.target.value),disabled:k===`streaming`,className:`bailey-input`}),k===`streaming`?(0,m.jsx)(p.Provider,{delayDuration:200,children:(0,m.jsxs)(p.Root,{children:[(0,m.jsx)(p.Trigger,{asChild:!0,children:(0,m.jsx)(`button`,{type:`button`,onClick:ee,"aria-label":P.stopAriaLabel,className:`bailey-stop-button`,children:(0,m.jsx)(wt,{className:`bailey-stop-icon`})})}),(0,m.jsx)(p.Portal,{container:B instanceof ShadowRoot?B:void 0,children:(0,m.jsxs)(p.Content,{side:`top`,className:`bailey-tooltip-content`,children:[P.stopButtonText,(0,m.jsx)(p.Arrow,{className:`bailey-tooltip-arrow`})]})})]})}):(0,m.jsx)(`button`,{type:`submit`,"aria-label":P.sendAriaLabel,disabled:!N.trim(),className:`bailey-send-button`,children:h??(0,m.jsx)(Ct,{className:`bailey-send-icon`})})]}),(!J||z)&&(0,m.jsxs)(f.Root,{children:[(0,m.jsx)(f.Trigger,{asChild:!0,children:(0,m.jsx)(`button`,{type:`button`,ref:se,"aria-label":P.menuAriaLabel,className:`bailey-menu-button`,children:(0,m.jsx)(At,{className:`bailey-menu-icon`})})}),(0,m.jsx)(f.Portal,{container:B instanceof ShadowRoot?B:void 0,children:(0,m.jsxs)(f.Content,{side:`top`,align:`end`,sideOffset:8,className:`bailey-menu-content`,onCloseAutoFocus:e=>{le.current&&=(e.preventDefault(),!1)},children:[!J&&(0,m.jsxs)(f.Item,{onSelect:()=>re(),className:`bailey-menu-item`,children:[(0,m.jsx)(jt,{className:`bailey-menu-item-icon`}),P.newChatButtonText]}),z&&(0,m.jsxs)(f.Item,{onSelect:()=>{if(a){a();return}le.current=!0,R(!0)},className:`bailey-menu-item`,children:[(0,m.jsx)(Ot,{className:`bailey-menu-item-icon`}),P.historyMenuItemText]})]})})]})]}),(J||c?.alwaysVisible)&&c&&(0,m.jsx)(`div`,{className:`bailey-privacy-note`,children:(0,m.jsx)(u.default,{remarkPlugins:wn,components:Tn,skipHtml:!0,children:c.markdown})})]}),L&&o&&!a&&(0,m.jsx)(gn,{client:o.client,pageSize:o.pageSize,chat:e,labels:P,locale:s,onClose:Z})]})})}var jn={feedbackGroupLabel:`Rate this response`,feedbackThumbsUpAriaLabel:`Good response`,feedbackThumbsDownAriaLabel:`Bad response`,feedbackReasonGroupLabel:`What went wrong?`,feedbackCommentLabel:`Tell us more`,feedbackCommentPlaceholder:`What should Bailey have said or done differently?`,feedbackSubmitText:`Submit`,feedbackCancelText:`Cancel`,feedbackThanksText:`Thanks for your feedback`,feedbackUndoText:`Undo`,feedbackEditText:`Edit`,feedbackAddCommentText:`Add a comment`,feedbackSavingText:`Saving…`,feedbackErrorText:`Couldn't save your feedback. Try again.`,feedbackPrivacyNote:`Your comment is saved with this conversation and may be reviewed by support.`,feedbackReasonInaccurate:`Inaccurate`,feedbackReasonUnhelpful:`Unhelpful`,feedbackReasonUnsafe:`Unsafe`,feedbackReasonTooLong:`Too long`,feedbackReasonOther:`Other`},Mn=2e3,Nn=[`inaccurate`,`unhelpful`,`unsafe`,`too_long`,`other`],Pn={inaccurate:`feedbackReasonInaccurate`,unhelpful:`feedbackReasonUnhelpful`,unsafe:`feedbackReasonUnsafe`,too_long:`feedbackReasonTooLong`,other:`feedbackReasonOther`},Fn=e=>Nn.includes(e)?e:`other`;function In(e){return Array.from(new Set((e??Nn).map(Fn)))}function Ln(e){return typeof e==`number`&&e>0?Math.min(Math.floor(e),Mn):Mn}function Rn(e,t){if(e===null||t===null)return e===t;let n=e.reasonCodes??[],r=t.reasonCodes??[];return e.rating===t.rating&&(e.comment??``)===(t.comment??``)&&n.length===r.length&&n.every((e,t)=>e===r[t])}function zn(e){return e.messageId?(0,m.jsx)(Bn,{...e},e.messageId):null}function Bn({messageId:e,onSubmit:t,onClear:n,initialRating:r,reasonOptions:i,maxCommentLength:a,labels:o,className:s}){let c={...jn,...o},u=In(i),d=Ln(a),f=r?{rating:r}:null,[h,g]=(0,l.useState)(f),[_,v]=(0,l.useState)(r??null),[y,b]=(0,l.useState)(!1),[x,S]=(0,l.useState)(`down`),[C,w]=(0,l.useState)([]),[T,E]=(0,l.useState)(``),[D,O]=(0,l.useState)(!1),[k,A]=(0,l.useState)(!1),[j,ee]=(0,l.useState)(!1),[M,te]=(0,l.useState)(!1),ne=(0,l.useRef)(f),re=(0,l.useRef)(null),N=(0,l.useRef)(0),ie=(0,l.useRef)(!1),P=(0,l.useRef)(!0),F=(0,l.useRef)(null),ae=(0,l.useRef)(null),I=(0,l.useRef)(null),oe=(0,l.useRef)(null),se=(0,l.useRef)(null),L=xt(ae),R=(0,l.useId)(),ce=`${R}-comment`,le=`${R}-counter`,z=`${R}-privacy`;(0,l.useEffect)(()=>(P.current=!0,()=>{P.current=!1}),[]),(0,l.useEffect)(()=>{y&&se.current?.focus()},[y]),(0,l.useEffect)(()=>{F.current&&!j&&!y&&((F.current===`up`?I:oe).current?.focus(),F.current=null)});let B=()=>{w([]),E(``)},V=async r=>{try{return r.kind===`clear`?await n({messageId:e}):await t({messageId:e,...r.snapshot}),!0}catch{return!1}},ue=async()=>{if(!ie.current){ie.current=!0,A(!0);try{for(;re.current&&P.current;){let e=re.current,t=e.kind===`clear`?null:e.snapshot,n=!(e.kind===`submit`&&e.formSubmit)&&Rn(t,ne.current)||await V(e);if(!P.current)return;let r=re.current?.version!==e.version;!n&&r||(n?(ne.current=t,g(t)):(v(ne.current?.rating??null),te(!0)),r||(re.current=null,ee(!1),n&&e.kind===`submit`&&e.formSubmit&&(b(!1),O(!0),F.current=e.snapshot.rating)))}}finally{ie.current=!1,P.current&&A(!1)}}},H=e=>{N.current+=1,re.current={...e,version:N.current},te(!1),ue()},de=()=>{v(null),b(!1),O(!1),B(),H({kind:`clear`})},fe=e=>{if(!j){if(_===e){de();return}v(e),O(!1),B(),e===`down`?(S(`down`),b(!0)):b(!1),H({kind:`submit`,snapshot:{rating:e},formSubmit:!1})}},U=e=>{_!==null&&(S(_),w((e?.reasonCodes??[]).map(Fn)),E(e?.comment??``),te(!1),b(!0))},W=()=>{j||(b(!1),te(!1),B(),F.current=x)},G=()=>{if(j)return;let e=T.trim(),t=u.filter(e=>C.includes(e)),n={rating:x,...t.length>0?{reasonCodes:t}:{},...e?{comment:e}:{}};ee(!0),v(x),H({kind:`submit`,snapshot:n,formSubmit:!0})},pe=e=>{w(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},me=e=>{e.key===`Escape`&&(e.stopPropagation(),W())},K=_!==null&&h?.rating===_&&!k&&!y,he=!!h&&(!!h.comment||(h.reasonCodes?.length??0)>0),q=k?c.feedbackSavingText:K?c.feedbackThanksText:``,J=e=>{let t=_===e,n=e===`up`?c.feedbackThumbsUpAriaLabel:c.feedbackThumbsDownAriaLabel,r=e===`up`?Pt:Ft;return(0,m.jsxs)(p.Root,{children:[(0,m.jsx)(p.Trigger,{asChild:!0,children:(0,m.jsx)(`button`,{ref:e===`up`?I:oe,type:`button`,className:`bailey-feedback-thumb`,"aria-pressed":t,"aria-label":n,"aria-busy":t&&k?!0:void 0,disabled:j,onClick:()=>fe(e),children:(0,m.jsx)(r,{className:`bailey-feedback-icon`,filled:t})})}),(0,m.jsx)(p.Portal,{container:L instanceof ShadowRoot?L:void 0,children:(0,m.jsxs)(p.Content,{side:`top`,className:`bailey-tooltip-content`,children:[n,(0,m.jsx)(p.Arrow,{className:`bailey-tooltip-arrow`})]})})]})};return(0,m.jsxs)(`div`,{ref:ae,className:`bailey-feedback${s?` ${s}`:``}`,children:[(0,m.jsx)(p.Provider,{delayDuration:200,children:(0,m.jsxs)(`div`,{role:`group`,"aria-label":c.feedbackGroupLabel,"aria-busy":k?!0:void 0,className:`bailey-feedback-thumbs`,children:[J(`up`),J(`down`)]})}),(0,m.jsxs)(`span`,{role:`status`,className:`bailey-feedback-status`,children:[k&&(0,m.jsx)(`span`,{className:`bailey-feedback-spinner`,"aria-hidden":`true`}),q]}),K&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`button`,{type:`button`,className:`bailey-feedback-link`,onClick:()=>U(h),children:D||he?c.feedbackEditText:c.feedbackAddCommentText}),(0,m.jsx)(`button`,{type:`button`,className:`bailey-feedback-link`,onClick:de,children:c.feedbackUndoText})]}),M&&(0,m.jsx)(`span`,{role:`alert`,className:`bailey-feedback-error`,children:c.feedbackErrorText}),y&&(0,m.jsxs)(`div`,{className:`bailey-feedback-form`,onKeyDown:me,children:[u.length>0&&(0,m.jsxs)(`fieldset`,{className:`bailey-feedback-reasons`,children:[(0,m.jsx)(`legend`,{className:`bailey-feedback-legend`,children:c.feedbackReasonGroupLabel}),(0,m.jsx)(`div`,{className:`bailey-feedback-chips`,children:u.map((e,t)=>(0,m.jsx)(`button`,{ref:t===0?e=>{se.current=e}:void 0,type:`button`,className:`bailey-feedback-chip`,"aria-pressed":C.includes(e),disabled:j,onClick:()=>pe(e),children:c[Pn[e]]},e))})]}),(0,m.jsx)(`label`,{htmlFor:ce,className:`bailey-feedback-legend`,children:c.feedbackCommentLabel}),(0,m.jsx)(`textarea`,{id:ce,ref:u.length===0?e=>{se.current=e}:void 0,className:`bailey-feedback-textarea`,value:T,maxLength:d,placeholder:c.feedbackCommentPlaceholder,"aria-describedby":`${le} ${z}`,disabled:j,onChange:e=>E(e.target.value.slice(0,d))}),(0,m.jsxs)(`div`,{className:`bailey-feedback-meta`,children:[(0,m.jsx)(`span`,{id:z,className:`bailey-feedback-privacy`,children:c.feedbackPrivacyNote}),(0,m.jsx)(`span`,{id:le,className:`bailey-feedback-counter`,children:`${T.length} / ${d}`})]}),(0,m.jsxs)(`div`,{className:`bailey-feedback-buttons`,children:[(0,m.jsx)(`button`,{type:`button`,className:`bailey-feedback-button`,disabled:j,onClick:W,children:c.feedbackCancelText}),(0,m.jsx)(`button`,{type:`button`,className:`bailey-feedback-button bailey-feedback-button-primary`,disabled:j,onClick:G,children:j?c.feedbackSavingText:c.feedbackSubmitText})]})]})]})}var Vn=`0.3.1-pre.2`;exports.ActivityIcon=kt,exports.ArrowUpRightIcon=Tt,exports.BAILEYAI_CHAT_UI_VERSION=Vn,exports.BAILEY_CHART_PROMPT_FRAGMENT=Ie,exports.BAILEY_TABLE_GRID_ROW_THRESHOLD=ke,exports.BaileyApiError=z,exports.BaileyChatPanel=An,exports.BaileyCleanupError=V,exports.BaileyFeedbackButtons=zn,exports.BaileyHistoryDrawer=gn,exports.BaileyTracePanel=Yt,exports.CopyMarkdownButton=Bt,exports.DEFAULT_CONVERSATION_STORAGE_KEY=te,exports.HeartIcon=Ct,exports.TRACE_KIND_LABEL=We,exports.ThumbDownIcon=Ft,exports.ThumbUpIcon=Pt,exports.createBaileyClient=Q,exports.createBaileyFeedbackHandlers=we,exports.createBaileyMarkdownComponents=St,exports.createMemoryConversationStorage=re,exports.createSessionConversationStorage=ne,exports.extractPseudoToolCalls=w,exports.extractTableData=Pe,exports.formatRelativeTime=hn,exports.formatTraceGap=et,exports.formatTraceTime=$e,exports.hasTraceFailure=it,exports.isConversationIdForSub=M,exports.isSafeMarkdownUrl=c.n,exports.joinInstructions=Te,exports.mapTranscript=A,exports.mergeEarlierPage=ee,exports.parseBaileyChartSpec=Ue,exports.parseSseFrames=E,exports.resolveToolCall=Oe,exports.shouldUseGrid=Fe,exports.toActivityLines=at,exports.toToolSteps=ot,exports.toTraceRows=tt,exports.toTraceSegments=rt,exports.traceEventArgsDetail=Je,exports.traceEventHint=Qe,exports.traceEventOutputDetail=Ye,exports.traceEventRawDetail=Ze,exports.traceEventSummary=qe,exports.traceEventToolName=Ke,exports.traceSummaryLine=nt,exports.useBaileyChat=le,exports.useBaileyConversations=H;
|
package/dist/baileyai-chat-ui.js
CHANGED
|
@@ -2692,7 +2692,7 @@ function Fn({ chat: e, placeholder: t, replyPlaceholder: r = Dn, emptyPlaceholde
|
|
|
2692
2692
|
type: "button",
|
|
2693
2693
|
onClick: () => Se(e.value ?? e.label),
|
|
2694
2694
|
className: "bailey-suggestion-card",
|
|
2695
|
-
children: [/* @__PURE__ */ v("span", { children: e.label }), /* @__PURE__ */ v(At, { className: "bailey-suggestion-icon" })]
|
|
2695
|
+
children: [/* @__PURE__ */ v("span", { children: e.label }), e.icon ?? /* @__PURE__ */ v(At, { className: "bailey-suggestion-icon" })]
|
|
2696
2696
|
}, `${e.label}-${t}`))]
|
|
2697
2697
|
}) : /* @__PURE__ */ v("div", {
|
|
2698
2698
|
className: "bailey-empty-state",
|
package/dist/index.d.ts
CHANGED
|
@@ -700,6 +700,8 @@ export declare interface BaileySuggestion {
|
|
|
700
700
|
label: string;
|
|
701
701
|
/** Sent to chat.send() when the card is clicked — defaults to `label` when omitted. */
|
|
702
702
|
value?: string;
|
|
703
|
+
/** Replaces the default up-right arrow on this card; the host sizes and colors its own icon. */
|
|
704
|
+
icon?: ReactNode;
|
|
703
705
|
}
|
|
704
706
|
|
|
705
707
|
export declare interface BaileyTableCell {
|