import{j as e,r as t}from"./vendor-react-RSDKEZ60.js";import{bb as s,b_ as n,f as a,eA as i,eB as r,eC as o,eD as l,eE as c,bQ as d}from"./c818056db-BBpc4u6S.js";import{M as m}from"./vendor-intl-BNW8a19h.js";import{m as p,A as u}from"./vendor-motion-Bnihp5FA.js";import{T as x}from"./ce1bfd762-BAr2B8fo.js";import{f as h,T as g,I as f}from"./vendor-ant-cds-CBh5POw1.js";import{t as _}from"./vendor-lodash-wKOE1Xsv.js";const b=t=>e.jsx(s,{...t,children:e.jsx("path",{d:"M10 7c.106 0 .21.033.294.095l.078.07 4.5 5a.501.501 0 0 1-.744.67L10 8.248l-4.128 4.587-.075.067a.5.5 0 0 1-.729-.655l.06-.082 4.5-5A.5.5 0 0 1 10 7"})});function v({direction:s="vertical",disabled:a,containerClassName:i,className:r,gradientHeight:o=24,hideTopGradient:l=!1,hideBottomGradient:c=!1,contentHeightMayChange:d=!1,containerHeightMayChange:m=!1,children:p,...u}){const x=t.useRef(null),h=t.useRef(null),[g,f]=t.useState(!0),[b,v]=t.useState(!0),y=t.useRef(g),j=t.useRef(b),w=_(t.useCallback(()=>{const e=h.current;e&&(("vertical"===s?e.scrollHeight-e.scrollTop-e.clientHeight<=1:e.scrollWidth-e.scrollLeft-e.clientWidth<=1)?y.current||(f(!0),y.current=!0):y.current&&(f(!1),y.current=!1),("vertical"===s?e.scrollTop:e.scrollLeft)<=0?j.current||(v(!0),j.current=!0):j.current&&(v(!1),j.current=!1))},[s]),150);return t.useEffect(()=>{w()},[w]),t.useEffect(()=>{if(!x.current||!d)return;const e=new ResizeObserver(w);return e.observe(x.current),()=>{e.disconnect()}},[w,d]),t.useEffect(()=>{if(!h.current||!m)return;const e=new ResizeObserver(w);return e.observe(h.current),()=>{e.disconnect()}},[w,m]),e.jsx("div",{style:{maskImage:a?void 0:`linear-gradient(to ${"vertical"===s?"bottom":"right"}, transparent 0%, black ${b||l?0:o}px, black calc(100% - ${g||c?0:o}px), transparent 100%)`},className:n("vertical"===s?"min-h-0":"min-w-0",i),children:e.jsx("div",{onScroll:a?void 0:w,ref:h,className:n("vertical"===s?"overflow-y-auto overflow-x-hidden min-h-0":"overflow-x-auto overflow-y-hidden min-w-0",r),...u,children:d?e.jsx("div",{ref:x,children:p}):p})})}var y=(e=>(e.Standard="Standard",e.TimelineGroup="TimelineGroup",e))(y||{});const j=new Set(["get_organization_settings","update_organization_settings","list_organization_members","get_allowed_invite_domains","update_allowed_invite_domains","search_organization_members","invite_organization_member","update_organization_member_role","remove_organization_member","list_pending_admin_requests","dismiss_admin_request","approve_join_request","list_groups","create_group","update_group","delete_group","list_group_members","add_group_member","remove_group_member","get_org_overage_limit","get_member_overage_limit","set_member_overage_limit","get_group_spend_limits","get_billing_status","get_identity_config","list_org_connectors","get_cowork_settings","list_roles","get_roles_configuration","create_role","update_role","delete_role","list_role_permissions","add_role_permission","remove_role_permission","list_role_assignments","assign_role","unassign_role"]),w=t.memo(({collapsedCount:t,isExpanded:s,onToggle:n})=>{if(0===t)return null;const i=s?e.jsx(m,{defaultMessage:"Hide steps",id:"Iufn28MeR1"}):e.jsx(m,{defaultMessage:"{collapsedCount, plural, one {# step} other {# steps}}",id:"dS6ebV+vpY",values:{collapsedCount:t}});return e.jsxs("button",{onClick:n,type:"button","aria-expanded":s,className:a("group/collapse-indicator flex flex-row min-h-[2.125rem] shrink-0 w-full","hover:bg-bg-200 cursor-pointer transition-colors duration-200"),children:[e.jsxs("div",{className:"flex flex-col items-center pl-3 box-border pointer-events-none",children:[e.jsx("div",{className:a("transition-all grow w-[1px] bg-border-300",s&&"opacity-0"),style:{minHeight:"calc((2.125rem - 16px) / 2)"}}),e.jsx("div",{className:"transition-all flex items-center justify-center my-0.5 shrink-0 w-[16px] h-[16px]",children:e.jsx("span",{className:a("inline-flex transition-transform duration-400 ease-snappy-out",s?"rotate-180":"rotate-0"),children:e.jsx(b,{className:"text-text-500 group-hover/collapse-indicator:text-text-300",size:16})})}),e.jsx("div",{className:"transition-all grow w-[1px] bg-border-300",style:{minHeight:"calc((2.125rem - 16px) / 2)"}})]}),e.jsx("div",{className:"flex items-center px-3 py-2 flex-1 text-sm pointer-events-none",children:e.jsx("span",{className:"text-text-500 group-hover/collapse-indicator:text-text-300",children:i})})]})});function N(e,t,s,n){if(!["thinking","tool_use","tool_result","token_budget"].includes(e.type))return!1;if("tool_use"===e.type){if(["prism","end_conversation","launch_extended_search_task","image_search","artifacts","enterprise_analytics"].includes(e.name)||j.has(e.name))return!1;if(s(e))return!1;if(i(e.name)||r(e.name)||o(e.name)||l(e.name)||e.name.includes("save_skill")||e.name.includes("task_propose")||"create"===c(e.name))return!1;if(n?.has(e.name))return!1}return!(!t.timeline_artifacts_enabled&&("tool_use"===e.type&&"artifacts"===e.name||"tool_result"===e.type&&"artifacts"===e.name))&&!(!t.timeline_gsuite_enabled&&"tool_use"===e.type&&e.integration_name)}function k(e){return"tool_result"!==e.type&&"token_budget"!==e.type&&"process_group_marker"!==e.type}w.displayName="CollapsedToolsIndicator";const E=t.createContext({});function C(){return t.useContext(E)}function I(s){const[n,a]=t.useState(void 0),i=t.useMemo(()=>({expandedItemKey:n,setExpandedItemKey:a}),[n,a]);return e.jsx(E.Provider,{value:i,children:s.children})}function T({children:s,isFirstBlockOfMessage:n,isLastBlockOfMessage:i,isStreaming:r,defaultExpanded:o=!1,alwaysExpanded:l=!1}){const[c,d]=t.useState(o),m=t.useCallback(e=>{e.stopPropagation(),d(e=>!e)},[]),h=t.Children.toArray(s),g=Math.max(0,h.length-2),f=c||l?h:h.slice(-2);return e.jsx(p.div,{initial:{opacity:r?0:1},animate:{opacity:1},transition:{duration:.5,ease:"easeIn"},className:a("transition-all duration-400 ease-out rounded-lg border-0.5 flex flex-col font-ui leading-normal my-3 border-border-300 min-h-[2.625rem] overflow-hidden",n?"mt-2":"mt-3",i?"mb-2":"mb-3"),children:e.jsxs(I,{children:[g>0&&!l&&e.jsx(w,{collapsedCount:g,isExpanded:c,onToggle:m}),e.jsx(u,{initial:!1,mode:"sync",children:f.map((s,n)=>e.jsx(p.div,{className:"overflow-hidden shrink-0",layout:"position",initial:{opacity:0,height:0},animate:"expanded",exit:"collapsed",variants:{expanded:{opacity:1,height:"auto"},collapsed:{opacity:0,height:0}},transition:{layout:{duration:0},ease:x.snappyOut,duration:.2},children:s},t.isValidElement(s)&&null!==s.key?s.key:n))})]})})}function M({icon:t,isExpanded:s,isFirstItem:n,isLastItem:i,isActive:r,children:o}){const l={minHeight:`calc((2.125rem - ${t?"16px":"6px"}) / 2)`};return e.jsxs("div",{className:a("flex flex-row min-h-[2.125rem] shrink-0",{"bg-bg-000":s},{"hover:bg-bg-200":!s}),children:[e.jsxs("div",{className:"flex flex-col items-center justify-center pl-3 box-border",children:[e.jsx("div",{className:a("transition-all w-[1px]",{"bg-border-300":!n}),style:l}),e.jsx("div",{className:a("transition-all flex items-center justify-center my-1 shrink-0 w-[16px]",{"h-[16px]":!!t}),children:t??e.jsx("div",{className:a("size-[6px] rounded-full",r?"bg-brand-200":"bg-border-300")})}),e.jsx("div",{className:a("transition-all grow w-[1px]",{"bg-border-300":!i}),style:l})]}),e.jsx("div",{className:"w-full flex flex-col min-w-0",children:o})]})}function S({isExpanded:s,isScrollable:n,snappyTransition:i,children:r,className:o,onTransitionEnd:l,onAnimationComplete:c,collapsesHalfway:d,setIsExpanded:m,footer:h}){const g=t.useRef(s),f=!(!d||s||!m),_=d&&!s,b=i?{ease:x.snappyOut,duration:.25}:{ease:x.snappyOut,duration:.3};return d?e.jsxs(p.div,{className:a("overflow-hidden shrink-0",!s&&f&&"cursor-pointer"),tabIndex:-1,initial:{opacity:0,height:g.current?"auto":0},animate:s?"expanded":"collapsed",variants:{expanded:{opacity:1,height:"auto"},collapsed:{opacity:.6,height:72}},whileHover:{opacity:1},transition:b,onTransitionEnd:l,onAnimationComplete:c,onClick:f?()=>m(!0):void 0,children:[e.jsx(v,{gradientHeight:16,tabIndex:-1,style:{scrollbarGutter:"stable"},className:a("h-full",n&&"!max-h-[238px]",o,_&&"[mask-image:linear-gradient(to_bottom,_hsl(var(--always-black)/100%)_0%,_hsl(var(--always-black)/0%)_100%)]",!s&&"pointer-events-none"),children:r}),h]}):e.jsxs(e.Fragment,{children:[e.jsx(u,{initial:!g.current,children:s&&e.jsx(p.div,{className:"overflow-hidden shrink-0",tabIndex:-1,initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:b,onTransitionEnd:l,onAnimationComplete:c,children:e.jsx(v,{gradientHeight:16,tabIndex:-1,style:{scrollbarGutter:"stable"},className:a("h-full",n&&"!max-h-[238px]",o),children:r})},"content")}),h]})}function z({isBorderless:t,handleClick:s,isDisabled:n,isExpanded:i,isStreaming:r,isError:o,errorMessage:l,isErrorExpandable:c,icon:m,text:u,badge:x,secondaryIcon:_,secondaryText:b,isFirstBlockOfMessage:v,isLastBlockOfMessage:j,className:w,wrapperClassName:N,children:k,renderMode:E=y.Standard,isFirstItemInGroup:C,isLastItemInGroup:I,shimmerPaused:T}){const S=n||!s,z=S?"div":"button",H=e.jsxs(e.Fragment,{children:[e.jsxs(z,{onClick:S?void 0:s,className:a("group/row flex flex-row items-center justify-between gap-4 rounded-lg text-text-300 h-[2.625rem] py-2 compact:h-9 compact:py-1",!t&&"px-3 compact:px-2",S?"cursor-default":"cursor-pointer transition-colors duration-200 hover:text-text-200 hover:text-text-000",w),children:[e.jsxs("div",{className:"flex flex-row items-center gap-2 min-w-0",children:[m&&E!==y.TimelineGroup&&e.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-text-100",children:m}),e.jsxs("div",{className:"flex gap-2 relative bottom-[0.5px] font-base compact:font-small text-left overflow-hidden overflow-ellipsis whitespace-nowrap flex-grow text-text-300",children:[r?e.jsx(d,{paused:T,children:u}):u,x&&e.jsx(h,{variant:"neutral",children:x})]})]}),e.jsx("div",{className:"flex flex-row items-center gap-1.5 min-w-0 shrink-0",children:o?e.jsxs(e.Fragment,{children:[e.jsx(g,{multiline:!0,className:"[overflow-wrap:anywhere]",content:l,align:"center",children:e.jsx("span",{className:"inline-flex",children:e.jsx(f,{name:"Warning",size:"sm",className:"text-danger-000"})})}),c&&_]}):e.jsxs(e.Fragment,{children:[!!b&&e.jsx("p",{className:"relative bottom-[0.5px] pl-1 text-text-500 font-small shrink-0 whitespace-nowrap",children:b}),_]})})]},r?"streaming":"non-streaming"),k]});return E===y.TimelineGroup?e.jsx(M,{icon:m,isExpanded:i,isFirstItem:!!C,isLastItem:!!I,isActive:r&&j&&I,children:H}):e.jsx(p.div,{initial:{opacity:r?0:1},animate:{opacity:1},transition:{duration:.5,ease:"easeIn"},className:a("ease-out transition-all flex flex-col font-ui leading-normal my-3 min-h-[2.625rem] compact:min-h-9 overflow-hidden",!t&&"border-0.5  border-border-300 rounded-lg",!n&&!i&&"hover:bg-bg-200",v?"mt-2 compact:mt-1":"mt-3 compact:mt-1.5",j?"mb-2 compact:mb-1":"mb-3 compact:mb-1.5",i&&!t&&"bg-bg-000 shadow-sm",N),children:H})}function H({isExpandingDisabled:t,setIsExpanded:s,...n}){const{isExpanded:i,isError:r,isErrorExpandable:o,secondaryIcon:l}=n,c=t||r&&!o;return e.jsx(z,{...n,isError:r,isDisabled:c,handleClick:()=>s(!i),secondaryIcon:e.jsxs(e.Fragment,{children:[l,!c&&e.jsx("span",{className:a("inline-flex transition-transform duration-400 ease-snappy-out",i?"rotate-180":"rotate-0"),children:e.jsx(f,{name:"CaretDown",size:"sm",className:a("relative bottom-[0.5px] text-text-300",c&&"opacity-15")})})]})})}export{H as C,v as G,j as S,z as T,S as a,b,y as c,k as d,T as e,N as i,C as u};
