@heroui/agent 1.0.0-beta.2 → 1.0.0-beta.3

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.
@@ -0,0 +1,2 @@
1
+ import{b as pe,e as me,f as ge}from"./chunk-4JEZZR5J.js";var kt="1.0.0-beta.3",he="https://api.heroui.pro";import{jsx as Ye,jsxs as je}from"react/jsx-runtime";function Ht({indicator:e,label:t="Loading agent\u2026"}){return je("div",{"aria-live":"polite",className:"ha-agent-loading",role:"status",children:[e,Ye("span",{children:t})]})}import{jsx as fe,jsxs as qe}from"react/jsx-runtime";function j({children:e,shortcut:t}){return qe("span",{"aria-hidden":"true",className:"ha-control-tooltip",children:[fe("span",{children:e}),t?fe("kbd",{className:"ha-control-tooltip__shortcut",children:t}):null]})}import{ChevronsCollapseUpRight as et,ChevronsExpandUpRight as tt}from"@gravity-ui/icons";import{useCallback as ye,useEffect as q,useEffectEvent as nt,useLayoutEffect as ot,useRef as ie,useState as Z}from"react";function Ae(e){return`heroui-agent:sidebar-width:${e}`}function re(e,t){let n=Math.min(720,Math.floor(t*.9)),o=Math.max(n,320);return Math.min(Math.max(Math.round(e),320),o)}function be(e,t){let n=Number.NaN;try{n=Number(localStorage.getItem(Ae(e))??Number.NaN)}catch{}return re(Number.isFinite(n)?n:420,t)}function ae(e,t){try{localStorage.setItem(Ae(e),String(Math.round(t)))}catch{}}import{jsx as u,jsxs as P}from"react/jsx-runtime";function rt(e,t){return e===!1?!1:e===void 0||e===!0||!(t instanceof Element)?!0:e(t)}function Ut({actionsSlot:e,agentId:t,children:n,defaultExpanded:o=!1,expandable:r=!0,expandedSidebarSlot:h,expandedTitle:T,historySlot:i,keepMounted:c=!1,name:m,onClose:N,onNewConversation:W,open:y,shouldCloseOnInteractOutside:E,showBetaBadge:x=!1,viewMode:V}){let d=ie(null),_=ie(0),[z,G]=Z(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:null),I=nt(N),[b,C]=Z(o),H=z!==null,R=z??!1,L=V==="floating",D=!L&&!R,g=R||D&&b,[M,s]=Z(!1),f=!R&&r,w=D&&b&&h;return ot(()=>{let a=window.matchMedia?.("(max-width: 639px)");if(!a)return;let A=()=>G(a.matches);return A(),a.addEventListener?.("change",A),()=>a.removeEventListener?.("change",A)},[]),q(()=>{if(!M)return;let a=d.current;if(!a)return;let A=()=>s(!1),S=$=>{let{propertyName:p,target:v}=$;v===a&&(p!=="width"&&p!=="height"||A())},oe=window.setTimeout(A,600);return a.addEventListener("transitionend",S),()=>{window.clearTimeout(oe),a.removeEventListener("transitionend",S)}},[M]),q(()=>{if(!y||!H)return;let a=d.current;if(!a)return;let A=document.activeElement instanceof HTMLElement?document.activeElement:null;a.open||(g&&typeof a.showModal=="function"?a.showModal():!g&&typeof a.show=="function"?a.show():a.open=!0);let S;if(g){let p=document.documentElement,v=window.scrollX,F=window.scrollY,K=p.style.overflow,X=document.body.style.overflow,Y=document.body.style.position,Ge=document.body.style.top,$e=document.body.style.left,Ke=document.body.style.right,Xe=document.body.style.width;p.style.overflow="hidden",document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.top=`${-F}px`,document.body.style.left=`${-v}px`,document.body.style.right="0",document.body.style.width="100%",S=()=>{p.style.overflow=K,document.body.style.overflow=X,document.body.style.position=Y,document.body.style.top=Ge,document.body.style.left=$e,document.body.style.right=Ke,document.body.style.width=Xe,window.scrollTo(v,F)}}let oe=a.querySelector("button,textarea,input,[tabindex]:not([tabindex='-1'])");a.contains(document.activeElement)||oe?.focus();let $=p=>{if(!g&&p.key==="Escape"){if(ve(a)){_.current=Date.now(),p.preventDefault(),p.stopPropagation();return}p.preventDefault(),I();return}if(!g||p.key!=="Tab")return;let v=Array.from(a.querySelectorAll("button:not(:disabled),textarea:not(:disabled),input:not(:disabled),[tabindex]:not([tabindex='-1'])"));if(v.length===0)return;let F=v[0],K=v[v.length-1],X=a.getRootNode(),Y=X instanceof ShadowRoot?X.activeElement:document.activeElement;p.shiftKey&&Y===F?(p.preventDefault(),K.focus()):!p.shiftKey&&Y===K&&(p.preventDefault(),F.focus())};return a.addEventListener("keydown",$),()=>{a.removeEventListener("keydown",$),typeof a.close=="function"?a.close():a.open=!1,S?.(),document.activeElement===document.body&&A?.focus()}},[g,y,H]),q(()=>{if(!y||!L||g)return;let a=d.current;if(!a)return;let A=S=>{S.composedPath().includes(a)||rt(E,S.target)&&I()};return document.addEventListener("click",A,!0),()=>document.removeEventListener("click",A,!0)},[g,L,y,E]),!y&&!c?null:P("dialog",{ref:d,"aria-label":m,"aria-modal":g,className:"ha-panel","data-agent-overlay-root":"","data-expanded":!R&&b?"true":void 0,"data-expanded-sidebar":w?"true":void 0,"data-resizing":M?"true":void 0,hidden:!y,onCancel:a=>{if(a.preventDefault(),Date.now()-_.current<350||ve(d.current)){_.current=Date.now();return}N()},children:[D&&!b?u(at,{agentId:t,panelRef:d}):null,w?u("aside",{"aria-label":"Chat history",className:"ha-expanded-sidebar",children:h}):null,P("div",{className:"ha-panel-main",children:[P("header",{className:"ha-header",children:[P("div",{className:"ha-header-title",children:[w?u("span",{className:"ha-session-title ha-expanded-chat-title",children:T??m}):i??u("strong",{children:m}),x?u("span",{className:"ha-beta-badge",children:"Beta"}):null]}),P("div",{className:"ha-header-actions",children:[w?null:e??(W?u("button",{"aria-label":"New chat",className:"ha-icon-button ha-new-chat-button",type:"button",onClick:W,children:u(st,{})}):null),f?u("button",{"aria-expanded":b,"aria-label":b?"Collapse assistant":"Expand assistant",className:"ha-expand-button ha-icon-button",type:"button",onClick:()=>{s(!0),C(a=>!a)},children:b?u(et,{"aria-hidden":"true"}):u(tt,{"aria-hidden":"true"})}):null,P("button",{"aria-keyshortcuts":"Escape","aria-label":"Close assistant",className:"ha-close-button ha-icon-button","data-shortcut":"ESC","data-tooltip":"Close assistant",type:"button",onClick:N,children:[u(it,{}),u(j,{shortcut:"ESC",children:"Close assistant"})]})]})]}),n,u("div",{className:"ha-overlay-portal","data-agent-overlay-portal":""})]})]})}function ve(e){let t=e?.querySelector(['[data-slot$="-popover"]','[data-slot="agent-ui-image-modal"]','[data-slot="modal-dialog"]',".ha-feedback-popover"].join(","));return t?(t.querySelector('button[aria-label="Dismiss"]')?.click(),!0):!1}function at({agentId:e,panelRef:t}){let[n,o]=Z(420),r=ie(null),h=ye(i=>{let c=t.current,m=c?.getRootNode();(m instanceof ShadowRoot?m.host:c?.closest("[data-heroui-agent]"))?.style.setProperty("--ha-sidebar-width",`${i}px`),window.innerWidth>=640&&(document.documentElement.style.marginRight=`${Math.min(i,window.innerWidth)}px`),o(i)},[t]);q(()=>{o(be(e,window.innerWidth))},[e]);let T=ye((i,c)=>{let m=re(i,window.innerWidth);return h(m),c&&ae(e,m),m},[h,e]);return u("div",{"aria-label":"Resize assistant panel","aria-orientation":"vertical","aria-valuemax":720,"aria-valuemin":320,"aria-valuenow":n,className:"ha-resize-handle",role:"separator",tabIndex:0,onKeyDown:i=>{let c=i.key==="ArrowLeft"?24:i.key==="ArrowRight"?-24:0;c!==0&&(i.preventDefault(),T(n+c,!0))},onPointerCancel:i=>{let c=r.current;c&&(r.current=null,delete i.currentTarget.dataset.resizing,t.current&&delete t.current.dataset.dragResizing,document.documentElement.style.transition=c.pageTransition,T(c.startWidth,!1))},onPointerDown:i=>{i.button!==0&&i.pointerType==="mouse"||(i.preventDefault(),i.currentTarget.setPointerCapture(i.pointerId),i.currentTarget.dataset.resizing="true",r.current={currentWidth:n,pageTransition:document.documentElement.style.transition,startWidth:n,startX:i.clientX},document.documentElement.style.transition="none",t.current&&(t.current.dataset.dragResizing="true"))},onPointerMove:i=>{let c=r.current;c&&(c.currentWidth=T(c.startWidth+(c.startX-i.clientX),!1))},onPointerUp:i=>{let c=r.current;c&&(r.current=null,delete i.currentTarget.dataset.resizing,t.current&&delete t.current.dataset.dragResizing,i.currentTarget.releasePointerCapture(i.pointerId),document.documentElement.style.transition=c.pageTransition,ae(e,c.currentWidth))}})}function it(){return u("svg",{"aria-hidden":"true",fill:"none",height:"18",viewBox:"0 0 18 18",width:"18",children:u("path",{d:"m4.25 4.25 9.5 9.5m0-9.5-9.5 9.5",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.6"})})}function st(){return u("svg",{"aria-hidden":"true",fill:"none",height:"18",viewBox:"0 0 18 18",width:"18",children:u("path",{d:"M9 4v10M4 9h10",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.6"})})}function Te(e,{generateConversationTitle:t=!0}={}){let n=performance.now(),o=Date.now(),r=e.trim();return r?{...t?{}:{generateConversationTitle:!1},messageId:crypto.randomUUID(),prompt:r,startedAt:n,startedAtWallClock:o,submitted:!0}:null}var O=new Map,J=new Map,se=new Map,lt=10080*60*1e3,Q=new Map;function xe(e){return`heroui-agent:shell-draft:${e}:composer-draft:v1`}function le(e,t){try{let n=xe(e);t.trim()?localStorage.setItem(n,JSON.stringify({prompt:t,savedAt:Date.now()})):localStorage.removeItem(n)}catch{}}function ct(e){let t=xe(e);try{let n=JSON.parse(localStorage.getItem(t)??"null");if(n&&typeof n.prompt=="string"&&n.prompt.trim()&&typeof n.savedAt=="number"&&Date.now()-n.savedAt<=lt)return n.prompt;localStorage.removeItem(t)}catch{}return""}function ee(e,t){if(!t.prompt.trim()&&!t.submitted){O.delete(e),le(e,"");return}O.set(e,t),t.submitted||le(e,t.prompt)}function ce(e){let t=O.get(e);if(t)return t;let n=ct(e);return n?{prompt:n,submitted:!1}:void 0}function we(e,t,n){let o=O.get(e);!o?.submitted||o.messageId!==t||o.firstFeedbackPaintedAt!==void 0||O.set(e,{...o,firstFeedbackPaintedAt:n})}function zt(e){let t=ce(e);return O.delete(e),le(e,""),t}function Gt(e,t){se.set(e,t)}function $t(e){let t=se.get(e);return se.delete(e),t}function B(e,t,n){t?Q.set(e,[n?.selectionStart??0,n?.selectionEnd??0,n?.selectionDirection??"none"]):Q.delete(e)}function Se(e,t){let n=Q.get(e);if(!n||!t)return;t.focus({preventScroll:!0});let o=Math.min(n[0],t.value.length),r=Math.min(n[1],t.value.length);t.setSelectionRange(o,r,n[2]),Q.set(e,[o,r,n[2]])}function Ee(e,t){return t instanceof Node?e.contains(t)||e.closest(".ha-composer-wrap")?.querySelector(".ha-footnote")?.contains(t)===!0||e.closest(".ha-root")?.querySelector(".ha-overlay-portal")?.contains(t)===!0:!1}function Kt(e,t){t.length===0?J.delete(e):J.set(e,t)}function dt(e){return J.get(e)??[]}function Xt(e){let t=dt(e);return J.delete(e),t}function Ce(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Me(e){let t=getComputedStyle(e),n=Number.parseFloat(t.lineHeight);if(Number.isFinite(n)&&n>0)return n;let o=Number.parseFloat(t.fontSize);return Number.isFinite(o)&&o>0?o*1.2:20}function ke(e){let t=getComputedStyle(e);return Ce(t.paddingTop)+Ce(t.paddingBottom)}function Ne(e){let t=e.style.height,n=e.style.minHeight,o=e.style.maxHeight,r=e.style.transition;e.style.transition="none",e.style.height="0px",e.style.minHeight="0px",e.style.maxHeight="none";let h=e.scrollHeight;return e.style.height=t,e.style.minHeight=n,e.style.maxHeight=o,e.offsetHeight,e.style.transition=r,h}function ut(e){if(e.value.includes(`
2
+ `))return!0;if(e.clientWidth===0)return!1;let t=Ne(e),n=ke(e),o=Me(e);return Math.max(0,t-n)>o*1.5}function He(e,{hasAttachments:t=!1,maxHeight:n=120}={}){if(!e)return!1;let o=e.value.length>0,r=t||o&&ut(e);return e.style.height=`${r?Math.min(Ne(e),n):Me(e)+ke(e)}px`,r}function Re(e,t){if(!e||typeof ResizeObserver>"u")return()=>{};let n=e.clientWidth,o=new ResizeObserver(()=>{let r=e.clientWidth;r!==n&&(n=r,t(e))});return o.observe(e),()=>o.disconnect()}import{jsx as de,jsxs as Pe}from"react/jsx-runtime";var pt="https://heroui.pro/?utm_source=heroui-agent&utm_medium=referral&utm_campaign=powered-by-hero";function Oe(){return Pe("a",{"aria-label":"Powered by HeroUI Pro (opens in a new tab)",className:"ha-powered-by",href:pt,rel:"noopener noreferrer",target:"_blank",children:[de("span",{children:"Powered by"}),Pe("svg",{"aria-hidden":"true",className:"ha-powered-by-logo",fill:"none",viewBox:"0 0 140 44",children:[de("path",{d:"M.678 11.385V24.04c0 .599.307 1.155.813 1.471l8.628 5.396c1.15.719 2.639-.11 2.639-1.47V18.798c0-.612.322-1.18.847-1.491l5.263-3.13v27.267c0 1.355 1.48 2.186 2.63 1.476l8.905-5.497a1.72 1.72 0 0 0 .822-1.476V9.765c0-1.349-1.467-2.18-2.618-1.484l-9.74 5.897V2.556c0-1.345-1.46-2.177-2.61-1.488L1.52 9.897a1.72 1.72 0 0 0-.842 1.488Z",fill:"currentColor"}),de("path",{d:"M63.876 24.071c0-3.59-1.468-5.246-4.405-5.246-3.363 0-5.732 2.255-5.732 7.316v11.595h-6.063V5.528h6.063v11.779c1.468-2.393 3.884-3.59 7.2-3.59 5.637 0 8.953 3.451 8.953 9.25v14.769h-6.016V24.071ZM84.9 38.473c-7.533 0-12.317-4.877-12.317-12.378 0-7.408 4.737-12.378 12.317-12.378 8.195 0 12.648 5.798 11.416 13.942H78.647c.331 3.865 2.605 6.075 6.253 6.075 2.984 0 4.784-1.52 5.258-3.037h6.016c-.947 4.509-5.115 7.776-11.274 7.776ZM78.789 23.657h11.653c-.047-3.175-2.132-5.338-5.685-5.338-3.174 0-5.4 1.84-5.968 5.338ZM99.623 20.344c0-3.82 2.131-5.89 6.205-5.89h7.77v4.97h-7.912v18.312h-6.063V20.344ZM126.863 38.473c-7.674 0-12.553-4.924-12.553-12.378 0-7.454 4.879-12.378 12.553-12.378 7.58 0 12.459 4.924 12.459 12.378 0 7.454-4.88 12.378-12.46 12.378Zm0-5.016c3.79 0 6.3-2.898 6.3-7.362 0-4.463-2.51-7.408-6.3-7.408-3.838 0-6.348 2.945-6.348 7.408 0 4.464 2.51 7.362 6.348 7.362Z",fill:"currentColor"})]})]})}var _e=new Set(["ask","auto","full"]);function te(e){return _e.has(e)?e:"auto"}function Jt(e,t){return`${e}:permission-mode:${t}:v1`}function Qt(e,t){return`${e}:active-permission-mode:${t}:v1`}function en(e){try{let t=localStorage.getItem(e);return t!==null&&_e.has(t)?te(t):void 0}catch{return}}function tn(e,t){try{localStorage.setItem(e,t)}catch{}}function nn(e){try{localStorage.removeItem(e)}catch{}}function on(e,t){let n=te(t);if(n==="auto")return e;let o=n==="ask";return e.map(r=>!!r.needsApproval===o?r:{...r,needsApproval:o})}function Ie(e){return`heroui-agent:anonymous:${e}`}function mt(e){return e instanceof Error?e:new Error("Auth token request failed")}var Le=class{constructor(t,n){this.agentId=t;this.getAuthToken=n}cached=null;failure=null;generation=0;pending=null;clear(){this.generation+=1,this.cached=null,this.failure=null,this.pending=null}reset(){this.clear();try{localStorage.removeItem(Ie(this.agentId))}catch{}}async get(){if(this.cached&&this.expiresAt(this.cached)>Date.now()+6e4)return this.cached.token;if(!this.pending&&this.failure&&Date.now()<this.failure.retryAt)throw this.failure.error;let t=this.generation,n=this.pending??this.refresh();this.pending||(this.pending=n);try{let o=await n;return t!==this.generation?this.get():(this.cached=o,this.failure=null,o.token)}catch(o){throw t===this.generation&&(this.failure={error:mt(o),retryAt:Date.now()+5e3}),o}finally{this.pending===n&&(this.pending=null)}}async subjectHash(){let t=await this.get(),n=gt(t),o=typeof n.sub=="string"?n.sub:"anonymous",r=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(`${this.agentId}:${o}`));return Array.from(new Uint8Array(r),h=>h.toString(16).padStart(2,"0")).join("").slice(0,24)}anonymousId(){let t=Ie(this.agentId);try{let n=localStorage.getItem(t);if(n)return n;let o=crypto.randomUUID();return localStorage.setItem(t,o),o}catch{return crypto.randomUUID()}}expiresAt(t){return t.expiresAt}async refresh(){let t=await this.getAuthToken({agentId:this.agentId,anonymousId:this.anonymousId()});if(!t||typeof t.token!="string"||!t.token.trim()||typeof t.expiresAt!="number"||!Number.isFinite(t.expiresAt)||t.expiresAt<=0)throw new Error("Auth token callback returned invalid data");return{expiresAt:t.expiresAt,token:t.token}}};function gt(e){try{let t=e.split(".")[1];if(!t)return{};let n=t.replace(/-/g,"+").replace(/_/g,"/"),o=n.padEnd(Math.ceil(n.length/4)*4,"=");return JSON.parse(atob(o))}catch{return{}}}var De={"application/epub+zip":"epub","application/json":"json","application/msword":"doc","application/pdf":"pdf","application/rtf":"rtf","application/vnd.ms-excel":"xls","application/vnd.ms-excel.sheet.binary.macroenabled.12":"xlsb","application/vnd.ms-excel.sheet.macroenabled.12":"xlsm","application/vnd.ms-powerpoint":"ppt","application/vnd.ms-powerpoint.presentation.macroenabled.12":"pptm","application/vnd.ms-word.document.macroenabled.12":"docm","application/vnd.oasis.opendocument.presentation":"odp","application/vnd.oasis.opendocument.spreadsheet":"ods","application/vnd.oasis.opendocument.text":"odt","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","image/gif":"gif","image/jpeg":"jpg","image/png":"png","image/webp":"webp","text/csv":"csv","text/html":"html","text/markdown":"md","text/plain":"txt","text/rtf":"rtf","text/tab-separated-values":"tsv"},ne=Object.freeze(Object.keys(De)),sn=ne.join(","),ht=Object.freeze({...Object.fromEntries(Object.entries(De).map(([e,t])=>[t,e])),htm:"text/html",xhtml:"text/html"}),ft=new Set(ne);function ue(e){return ft.has(e.trim().toLowerCase())}function ln(e,t){let n=e.trim().toLowerCase();if(ue(n))return n;let o=t.trim().toLowerCase().match(/\.([a-z0-9]+)$/)?.[1];return o?ht[o]??null:null}import{useId as At}from"react";import{jsx as Fe,jsxs as bt}from"react/jsx-runtime";function Be({children:e,className:t,...n}){let o=`ha-shimmer-${At().replaceAll(":","")}`,r={"--_ha-firefox-mask":`-moz-element(#${o})`};return bt("span",{...n,className:`ha-shimmer${t?` ${t}`:""}`,children:[Fe("span",{className:"ha-shimmer__text",id:o,children:e}),Fe("span",{inert:!0,"aria-hidden":"true",className:"ha-shimmer__highlight",style:r,children:e})]})}import{useCallback as yt,useEffect as vt,useLayoutEffect as Ue,useRef as Tt,useState as U}from"react";import{Fragment as We,jsx as l,jsxs as k}from"react/jsx-runtime";function yn({agentId:e,composerConnecting:t=!1,composerControlsAvailable:n,composerControlsRevealed:o,composerEndSlot:r,composerFooterSlot:h,composerStartSlot:T,greeting:i,onComposerControlsReveal:c,onIntent:m,placeholder:N,subtitle:W="Live answers with charts, metrics, and tables.",suggestedPrompts:y}){let[E]=U(()=>ce(e)),[x,V]=U(()=>E?.submitted?"":E?.prompt??""),[d,_]=U(()=>E?.submitted?E:null),[z,G]=U(!1),[I,b]=U(!1),C=Tt(null),H=n??!!(T||r),R=o??(H&&z),L=s=>{B(e,!0,s.currentTarget),G(H),H&&c?.(),m()},D=s=>{let f=s.currentTarget.querySelector(".ha-composer");f&&Ee(f,s.relatedTarget)||(G(!1),B(e,!1))},g=yt(s=>{b(He(s))},[]);Ue(()=>(Se(e,C.current),g(C.current),Re(C.current,g)),[e,g]),vt(()=>{d||ee(e,{prompt:x,submitted:!1})},[x,e,d]),Ue(()=>{if(!d)return;let s=requestAnimationFrame(f=>{we(e,d.messageId,f)});return()=>cancelAnimationFrame(s)},[e,d]);let M=(s,f=!0)=>{if(d)return;let w=Te(s,{generateConversationTitle:f});w&&(_(w),V(""),b(!1),C.current.style.height="auto",ee(e,w),m())};return k(We,{children:[l("div",{className:"ha-conversation",children:l("div",{"aria-live":"polite",className:"ha-messages",role:"log",children:d?k(We,{children:[l("div",{className:"ha-message","data-role":"user",children:l("div",{className:"ha-bubble",children:l("div",{className:"ha-message-content",children:l("p",{className:"ha-message-text",children:d.prompt})})})}),l("div",{className:"ha-message","data-role":"assistant","data-stream-anchor":"true","data-turn-feedback-id":d.messageId,children:l("div",{className:"ha-message-body",children:l("div",{"aria-label":"Working on your request\u2026",className:"ha-progress ha-activity-status ha-progress-shimmer",role:"status",children:l(Be,{"aria-hidden":"true",children:"Thinking\u2026"})})})})]}):k("div",{className:"ha-empty",children:[l("h2",{children:i}),l("p",{children:W})]})})}),k("form",{className:"ha-composer-wrap",onBlur:D,onSubmit:s=>{s.preventDefault(),M(x)},children:[!d&&y.length>0?l("div",{"aria-label":"Suggested prompts",className:"ha-suggestions",role:"group",children:y.map(s=>k("button",{className:"ha-suggestion",type:"button",onClick:()=>M(s,!1),children:[l("span",{children:s}),l(wt,{})]},s))}):null,k("div",{className:"@container ha-composer","data-connecting":t||void 0,"data-controls-revealed":R||I||void 0,"data-expanded":I||void 0,children:[T,l("textarea",{ref:C,"aria-label":"Message the assistant",placeholder:N,readOnly:!!d,rows:1,value:x,onFocus:L,onSelect:s=>B(e,!0,s.currentTarget),onChange:s=>{let f=s.currentTarget.value;ee(e,{prompt:f,submitted:!1}),B(e,!0,s.currentTarget),V(f),g(s.currentTarget),m()},onKeyDown:s=>{s.key!=="Enter"||s.shiftKey||(s.preventDefault(),M(x))}}),r,k("button",{"aria-label":"Send message",className:"ha-send",disabled:!x.trim()||!!d,type:"submit",children:[l(xt,{}),l(j,{shortcut:"\u21B5",children:"Send message"})]})]}),l("div",{className:"ha-composer-footer","data-revealed":!!h||void 0,children:l("div",{className:"ha-composer-footer-content",children:h})}),l(Oe,{})]})]})}function xt(){return l("svg",{"aria-hidden":"true",fill:"none",height:"18",viewBox:"0 0 18 18",width:"18",children:l("path",{d:"M9 14.5V3.5m0 0L4.5 8M9 3.5 13.5 8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function wt(){return l("svg",{"aria-hidden":"true",fill:"none",height:"16",viewBox:"0 0 16 16",width:"16",children:l("path",{d:"M5 11 11 5m0 0H6m5 0v5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})}var St={animation:"fadeIn",duration:160,easing:"ease-out",sep:"word",stagger:18};function Ve(e){return typeof e=="number"?Number.isFinite(e)?`${Math.round(e)}px`:void 0:e?.trim()||void 0}function Et(e){let t=Ve(e?.initialWidth),n=Ve(e?.initialHeight);return{...t?{"--ha-panel-width":t}:{},...n?{"--ha-panel-height":n}:{}}}function ze(e){return e===void 0||!Number.isFinite(e)?24:Math.min(Math.max(Math.round(e),0),200)}function Ct(e){if(!(e===void 0||!Number.isFinite(e)))return Math.min(Math.max(Math.round(e),0),2147483647)}function Mt(e){if(e===void 0)return[...ne];if(e===!1||!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!="string")continue;let o=n.trim().toLowerCase();ue(o)&&t.add(o)}return[...t]}function Cn(e){if(typeof e.agentId!="string"||!e.agentId.trim())throw new Error("HeroUI Agent agentId is required");if(typeof e.getAuthToken!="function")throw new Error("HeroUI Agent getAuthToken is required");let t=Mt(e.composer?.attachments),n=typeof e.composer?.disclaimer=="string"&&e.composer.disclaimer.trim().slice(0,240)||void 0,o=Ct(e.appearance?.zIndex);return{apiBaseUrl:(e._api?.baseUrl??he).replace(/\/$/,""),colorScheme:e.appearance?.theme?.colorScheme??"system",componentExportFormats:e.componentExports===!1?[]:e.componentExports??["csv","svg","png"],componentSurfaceVariant:e.appearance?.componentSurfaceVariant,composerAttachmentAccept:t.join(","),composerAttachmentContentTypes:t,composerControlsAvailable:t.length>0||e.permissions?.showPicker===!0&&!!e.tools?.length||e.composer?.modelPicker===!0||(e.composer?.dictation??!0),composerDefaultModel:e.composer?.defaultModel,composerDictation:e.composer?.dictation??!0,designTheme:pe(e.appearance?.theme?.designTheme),...n?{composerDisclaimer:n}:{},agentId:e.agentId,...e.appearance?.shouldCloseOnInteractOutside!==void 0?{shouldCloseOnInteractOutside:e.appearance.shouldCloseOnInteractOutside}:{},composerModelPicker:e.composer?.modelPicker??!1,composerPlaceholder:e.composer?.placeholder?.trim().slice(0,120)||"Ask anything\u2026",context:e.context,getAuthToken:e.getAuthToken,greeting:e.startScreen?.greeting?.trim().slice(0,120)||"Ask about your data",launcherPosition:e.appearance?.launcher?.position??"bottom-right",markdownAnimation:e.markdown?.animated??St,markdownCaret:e.markdown?.caret??"block",markdownPlugins:e.markdown?.plugins,messageActions:e.responseActions===!1?[]:e.responseActions??["copy","feedback","retry"],onFeedback:e.onFeedback,panelExpandable:e.appearance?.panel?.expandable??!0,panelExpanded:e.appearance?.panel?.expanded??!1,panelStyle:Et(e.appearance?.panel),permissionDefaultMode:te(e.permissions?.defaultMode),permissionShowPicker:e.permissions?.showPicker===!0,preload:e.preload??!0,reopenOnRefresh:e.reopenOnRefresh??!1,showBetaBadge:e.showBetaBadge??!1,showLauncher:e.showLauncher??!0,startNewConversationOnOpen:e.startNewConversationOnOpen??!1,suggestedPromptShortcuts:e.startScreen?.promptShortcuts??!1,surfaceVariant:e.appearance?.surfaceVariant,...e.appearance?.launcher?.icon?.trim()?{launcherIcon:e.appearance.launcher.icon.trim()}:{},...e.appearance?.launcher?.style?{launcherStyle:e.appearance.launcher.style}:{},...e.appearance?.launcher?.offset?{launcherOffset:{x:ze(e.appearance.launcher.offset.x),y:ze(e.appearance.launcher.offset.y)}}:{},imageSearch:(e.capabilities?.webSearch??!1)&&(e.capabilities?.imageSearch??!0),newsSearch:(e.capabilities?.webSearch??!1)&&(e.capabilities?.newsSearch??!1),subtitle:e.startScreen?.subtitle===void 0?"Live answers with charts, metrics, and tables.":e.startScreen.subtitle.trim().slice(0,240),suggestedPrompts:e.startScreen?.prompts?.map(r=>r.trim()).filter(Boolean).slice(0,5),themeStyle:{...ge(e.appearance?.theme),...me(e.appearance?.launcher?.background)},tools:e.tools??[],viewMode:e.appearance?.viewMode??"floating",webSearch:e.capabilities?.webSearch??!1,...o!==void 0?{zIndex:o}:{}}}export{Le as a,kt as b,he as c,Ht as d,j as e,be as f,Ut as g,De as h,ne as i,ue as j,ln as k,Te as l,ee as m,ce as n,zt as o,Gt as p,$t as q,B as r,Se as s,Ee as t,Kt as u,dt as v,Xt as w,He as x,Re as y,Oe as z,Be as A,yn as B,Jt as C,Qt as D,en as E,tn as F,nn as G,on as H,St as I,Cn as J};
@@ -1,2 +1,2 @@
1
- import{A as sn,I as an,a as je,c as Ke,d as Je,f as fe,g as Xe,j as Ye,k as en,l as nn,o as tn,q as pe,s as on,t as rn}from"./chunk-CN4UQBKO.js";import{a as Qe}from"./chunk-6ZJJN322.js";import{d as Ze,e as me}from"./chunk-UHHKMESI.js";import{useCallback as w,useEffect as A,useEffectEvent as St,useLayoutEffect as Mn,useMemo as Ae,useRef as M,useState as h,useSyncExternalStore as xn}from"react";import{createRoot as kt}from"react-dom/client";import{SparklesFill as Zn}from"@gravity-ui/icons";import{jsx as et}from"react/jsx-runtime";function cn(e){return et(Zn,{...e})}import{jsx as ge}from"react/jsx-runtime";function nt(e){return/\.svg(?:[?#]|$)/i.test(e)||/^data:image\/svg\+xml[;,]/i.test(e)}function ln(e){return`url("${e.replace(/["\\\n\r]/g,encodeURIComponent)}")`}function un({icon:e}){return e?nt(e)?ge("span",{"aria-hidden":"true",className:"ha-launcher__icon ha-launcher__icon--tinted",style:{WebkitMaskImage:ln(e),maskImage:ln(e)}}):ge("img",{alt:"",className:"ha-launcher__icon",src:e}):ge(cn,{})}function dn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function fn(e,n){if(n===void 0)return e;if(!dn(e)||!dn(n))return n;let t={...e};for(let[r,a]of Object.entries(n))a!==void 0&&(t[r]=r in e?fn(e[r],a):a);return t}function mn(e,n){if(!e)return n;let t={appearance:e.appearance,capabilities:e.capabilities,composer:e.composer,markdown:e.markdown,permissions:e.permissions,responseActions:e.responseActions,showBetaBadge:e.showBetaBadge,startScreen:e.startScreen},r=fn(t,{appearance:n.appearance,capabilities:n.capabilities,composer:n.composer,markdown:n.markdown?{...n.markdown,plugins:void 0}:void 0,permissions:n.permissions,responseActions:n.responseActions,showBetaBadge:n.showBetaBadge,startScreen:n.startScreen});return{...n,...r}}function pn(e){return!!e.appearance?.theme?.typography?.fontFamily?.trim()}var gn=1,c=Symbol("invalid");function z(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function R(e){if(e!==void 0)return typeof e=="string"?e:c}function v(e){if(e!==void 0)return typeof e=="boolean"?e:c}function he(e){if(e!==void 0)return typeof e=="number"&&Number.isFinite(e)?e:c}function I(e){return n=>{if(n!==void 0)return typeof n=="string"&&e.includes(n)?n:c}}function hn(e){if(e===void 0)return;if(typeof e=="string")return e;if(!z(e))return c;let n=R(e.dark),t=R(e.light);return n===c||t===c?c:{...n===void 0?{}:{dark:n},...t===void 0?{}:{light:t}}}function tt(e){if(e===void 0)return;if(!z(e))return c;let n={};for(let[t,r]of Object.entries(e)){if(typeof r!="string")return c;n[t]=r}return n}function ot(e){if(e!==void 0)return!Array.isArray(e)||e.some(n=>typeof n!="string")?c:e}function b(e,n){if(e===void 0||!z(e))return c;let t={};for(let[r,a]of Object.entries(n)){let l=a(e[r]);if(l===c)return c;l!==void 0&&(t[r]=l)}return t}function E(e){return e===c?void 0:e}var rt=["accent","background","foreground","overlay","surface","surfaceSecondary","tooltip"];function st(e){return b(e,{componentSurfaceVariant:I(["outline","plain","surface","surface-secondary"]),launcher:n=>n===void 0?void 0:b(n,{background:hn,icon:R,position:I(["bottom-left","bottom-right"]),style:tt}),panel:n=>n===void 0?void 0:b(n,{expandable:v,expanded:v,initialHeight:t=>t===void 0||typeof t=="string"?t:he(t),initialWidth:t=>t===void 0||typeof t=="string"?t:he(t)}),surfaceVariant:I(["outline","plain","surface","surface-secondary"]),theme:n=>n===void 0?void 0:b(n,{colorScheme:I(["dark","light","system"]),colors:t=>t===void 0?void 0:b(t,Object.fromEntries(rt.map(r=>[r,hn]))),designTheme:I(["base","brutalism","glass","mouve"]),radius:I(["pill","round","sharp","soft"]),typography:t=>t===void 0?void 0:b(t,{baseSize:he,fontFamily:R})}),viewMode:I(["floating","sidebar"])})}function it(e){return b(e,{attachments:n=>{if(n===void 0||n===!1)return n;if(!Array.isArray(n))return c;let t=n.filter(r=>typeof r=="string"&&Ye(r));return t.length===n.length?t:c},defaultModel:R,dictation:v,disclaimer:n=>n===!1?!1:R(n),modelPicker:v,placeholder:R})}function at(e){return b(e,{animated:n=>{if(n===void 0||n===!1)return n;if(!z(n))return c;let t=I(["blurIn","fadeIn","slideUp"])(n.animation);return t===c||t===void 0?c:{...n,animation:t}},caret:n=>n===!1?!1:I(["block","circle"])(n)})}function ct(e){if(e===void 0||e===!1)return e;if(!Array.isArray(e))return c;let n=["copy","feedback","retry"],t=e.filter(r=>typeof r=="string"&&n.includes(r));return t.length===e.length?t:c}function Z(e){if(!z(e)||e.version!==gn)return null;let n=e.revision;if(typeof n!="string"||!n)return null;let t=E(st(e.appearance)),r=E(b(e.capabilities,{imageSearch:v,newsSearch:v,webSearch:v})),a=E(it(e.composer)),l=E(at(e.markdown)),d=E(b(e.permissions,{defaultMode:I(["ask","auto","full"]),showPicker:v})),u=E(ct(e.responseActions)),f=E(v(e.showBetaBadge)),C=E(b(e.startScreen,{greeting:R,promptShortcuts:v,prompts:ot,subtitle:R})),m=E(b(e.webfont,{familyName:O=>typeof O=="string"&&O?O:c,fontFaceUrl:R,stylesheetUrl:R}));return{...t?{appearance:t}:{},...r?{capabilities:r}:{},...a?{composer:a}:{},...l?{markdown:l}:{},...d?{permissions:d}:{},...u===void 0?{}:{responseActions:u},...f===void 0?{}:{showBetaBadge:f},...C?{startScreen:C}:{},...m?{webfont:m}:{},revision:n,version:gn}}function ye(e){return`heroui-agent:config:${e}`}var yn=1;function bn(e){try{let n=window.localStorage.getItem(ye(e));if(!n)return null;let t=JSON.parse(n);if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let a=t;if(a.cacheVersion===yn&&typeof a.cachedAt=="number"&&Number.isFinite(a.cachedAt)){let l=Z(a.config);return l?{cachedAt:a.cachedAt,config:l,legacy:!1}:null}}let r=Z(t);return r?{cachedAt:0,config:r,legacy:!0}:null}catch{return null}}function be(e,n,t=Date.now()){try{let r={cacheVersion:yn,cachedAt:t,config:n};window.localStorage.setItem(ye(e),JSON.stringify(r))}catch{}}function wn(e){try{window.localStorage.removeItem(ye(e))}catch{}}async function Cn(e,n,t={}){try{let r=await fetch(`${e}/v1/agents/${encodeURIComponent(n)}/appearance`,{headers:t.revision?{"If-None-Match":`"${t.revision}"`}:{},...t.signal?{signal:t.signal}:{}});if(r.status===304)return{status:"not-modified"};if(r.status===404||r.status===410)return{status:"missing"};if(!r.ok)return{status:"unavailable"};let a=Z(await r.json());return a?{config:a,status:"ok"}:{status:"unavailable"}}catch{return{status:"unavailable"}}}import{ChevronDown as lt,Microphone as ut,Plus as dt,ShieldCheck as ft}from"@gravity-ui/icons";import{Suspense as Rn,lazy as Sn,useEffect as mt,useRef as pt,useState as we}from"react";import{Fragment as In,jsx as p,jsxs as Ce}from"react/jsx-runtime";var gt={ask:"Ask for approval",auto:"Approve for me",full:"Full access"},ht=Sn(()=>import("./model-picker-BSJRGXGB.js").then(({ModelPicker:e})=>({default:e}))),yt=Sn(()=>import("./shell-permission-picker-KIC3VEYJ.js").then(({ShellPermissionPicker:e})=>({default:e})));function kn({onFileDialogActiveChange:e,onIntent:n,options:t}){return{end:p(wt,{options:t,onIntent:n}),footer:t.composerDisclaimer?p("p",{className:"ha-footnote",children:Qe(t.composerDisclaimer)}):null,start:t.composerAttachmentContentTypes.length>0?p(bt,{accept:t.composerAttachmentAccept,agentId:t.agentId,onFileDialogActiveChange:e,onIntent:n}):null}}function bt({accept:e,agentId:n,onFileDialogActiveChange:t,onIntent:r}){let a=pt(null);return mt(()=>{let l=a.current,d,u=()=>t(!1),f=()=>{d=window.setTimeout(u,0)};return l?.addEventListener("cancel",u),window.addEventListener("focus",f),()=>{l?.removeEventListener("cancel",u),window.removeEventListener("focus",f),window.clearTimeout(d)}},[t]),Ce(In,{children:[p("input",{ref:a,multiple:!0,accept:e,"aria-label":"Choose files to attach",className:"ha-file-input",type:"file",onChange:l=>{rn(n,Array.from(l.currentTarget.files??[])),l.currentTarget.value="",t(!1),r()}}),p("button",{"aria-label":"Attach files",className:"ha-attach",type:"button",onClick:()=>{t(!0),a.current?.click()},children:p(dt,{"aria-hidden":"true"})})]})}function wt({onIntent:e,options:n}){let t=n.composerDefaultModel??Ze,[r,a]=we(t),[l,d]=we(!1),[u,f]=we(!1),C=me.find(m=>m.id===r)?.label??r;return Ce(In,{children:[n.permissionShowPicker&&n.tools.length>0?p(Rn,{fallback:p(An,{kind:"permission",label:gt[n.permissionDefaultMode],tone:n.permissionDefaultMode==="full"?"warning":void 0,onActivate:()=>f(!0)}),children:p(yt,{agentId:n.agentId,defaultMode:n.permissionDefaultMode,defaultOpen:u,onIntent:e})}):null,n.composerModelPicker?p(Rn,{fallback:p(An,{kind:"model",label:C,onActivate:()=>d(!0)}),children:p(ht,{"aria-label":"AI model",className:"ha-model-picker",defaultOpen:l,options:me,value:r,onChange:m=>{a(m),tn(n.agentId,m),e()}})}):null,n.composerDictation?p("button",{disabled:!0,"aria-label":"Dictate message",className:"ha-dictation",type:"button",children:p(ut,{"aria-hidden":"true"})}):null]})}function An({kind:e,label:n,onActivate:t,tone:r}){let a=`aui-${e}-picker`;return p("div",{className:`${a} ha-${e}-picker`,"data-tone":r,children:Ce("button",{"aria-label":e==="model"?"AI model":"Tool permissions",className:`${a}__trigger ha-shell-picker-trigger`,type:"button",onClick:t,onPointerDown:l=>l.preventDefault(),children:[e==="permission"?p(ft,{"aria-hidden":"true",className:"aui-permission-picker__trigger-icon"}):null,p("span",{className:`${a}__value`,children:n}),p(lt,{"aria-hidden":"true",className:`${a}__indicator`})]})})}var Ct=[".woff2",".woff",".ttf",".otf",".eot"];function Rt(e){return`heroui-agent-font-${e.familyName.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`}function At(e){let n=e.includes(":vf@")||e.includes("-wght-")||e.includes("-opsz-");return e.endsWith(".woff")?"woff":e.endsWith(".ttf")?"truetype":e.endsWith(".otf")?"opentype":n?"woff2-variations":"woff2"}function vn(e,n){try{let t=new URL(e);if(t.protocol!=="https:")return!1;if(!n)return!0;let r=t.pathname.toLowerCase();return Ct.some(a=>r.endsWith(a))}catch{return!1}}function En(e){if(!e||typeof document>"u")return()=>{};let n=Rt(e);if(document.getElementById(n))return()=>{};if(e.stylesheetUrl&&vn(e.stylesheetUrl,!1)){let t=document.createElement("link");return t.id=n,t.rel="stylesheet",t.href=e.stylesheetUrl,document.head.append(t),()=>t.remove()}if(e.fontFaceUrl&&vn(e.fontFaceUrl,!0)){let t=document.createElement("style"),r=e.fontFaceUrl.includes(":vf@")||e.fontFaceUrl.includes("-wght-")||e.fontFaceUrl.includes("-opsz-");return t.id=n,t.textContent=["@font-face {",` font-family: '${e.familyName.replaceAll("'","")}';`," font-style: normal;"," font-display: swap;",` font-weight: ${r?"100 900":"400"};`,` src: url(${e.fontFaceUrl}) format('${At(e.fontFaceUrl)}');`,"}"].join(`
2
- `),document.head.append(t),()=>t.remove()}return()=>{}}import{Fragment as _n,jsx as T,jsxs as Tn}from"react/jsx-runtime";var It=600,vt=5*6e4,Et="heroui-agent:open:";function Se(e){return`${Et}${e}`}function Mt(e){if(typeof window>"u")return!1;try{return window.sessionStorage.getItem(Se(e))==="true"}catch{return!1}}function Re(e,n){try{n?window.sessionStorage.setItem(Se(e),"true"):window.sessionStorage.removeItem(Se(e))}catch{}}var On;function Nn(){return On??=import(/* webpackPrefetch: true */"./embed-runtime-CLCMDESV.js").then(e=>e.default),On}var B=new Map,ke=new Set;function Ln(e){return e?B.get(e):[...B.values()][B.size-1]}function Pn(){for(let e of ke)e()}function Ot(e){return ke.add(e),()=>ke.delete(e)}function Nt(e){let n=window.matchMedia?.("(prefers-color-scheme: dark)");return n?.addEventListener?.("change",e),()=>n?.removeEventListener?.("change",e)}function Pt(){return window.matchMedia?.("(prefers-color-scheme: dark)").matches===!0}function U(e,n,...t){let r=Ln(e);if(!r){console.warn("HeroUI Agent is not mounted yet. Add <HeroUIAgent /> to your layout.");return}let a=r[n];a(...t)}function Tt(e,n,t){let[r]=h(()=>!t||typeof window>"u"?null:bn(e)),[a,l]=h(()=>{if(!t)return{config:null,presentationReady:!0};let d=r?Date.now()-r.cachedAt:Number.POSITIVE_INFINITY,u=r!==null&&!r.legacy&&d>=0&&d<=vt;return{config:u?r.config:null,presentationReady:u}});return A(()=>{if(!t)return;let d=new AbortController,u=!0,f=m=>{l(O=>O.presentationReady?O:{config:m,presentationReady:!0})},C=window.setTimeout(()=>{u&&(d.abort(),f(r?.config??null))},It);return Cn(n,e,{...r?.config.revision?{revision:r.config.revision}:{},signal:d.signal}).then(m=>{if(!(!u||d.signal.aborted)){if(m.status==="ok"){be(e,m.config),f(m.config);return}if(m.status==="not-modified"){r&&be(e,r.config),f(r?.config??null);return}if(m.status==="missing"){wn(e),f(null);return}f(r?.config??null)}}).finally(()=>{!u||d.signal.aborted||window.clearTimeout(C)}),()=>{u=!1,d.abort(),window.clearTimeout(C)}},[n,r,t,e]),t?a:{config:null,presentationReady:!0}}function go(e){let n=w(()=>Ln(e)?.ready??!1,[e]),t=xn(Ot,n,()=>!1);return Ae(()=>({hide:()=>U(e,"hide"),newConversation:r=>U(e,"newConversation",r),preload:()=>U(e,"preload"),ready:t,refreshAuth:()=>U(e,"refreshAuth"),show:()=>U(e,"show"),shutdown:()=>U(e,"shutdown"),toggle:()=>U(e,"toggle")}),[e,t])}function ho(e){let n=`${e.agentId}\0${e._api?.baseUrl??""}\0${e.remoteConfig!==!1}`;return T(_t,{...e},n)}function _t(e){let{_api:n,agentId:t,appearance:r,capabilities:a,componentExports:l,composer:d,context:u,getAuthToken:f,markdown:C,onFeedback:m,onReady:O,permissions:Un,preload:Fn,remoteConfig:$n=!0,reopenOnRefresh:Ie,responseActions:Hn,showLauncher:Dn,startNewConversationOnOpen:Bn,startScreen:Vn,tools:ve}=e,G=C?.plugins,ee=r?.shouldCloseOnInteractOutside,Wn=(n?.baseUrl??Ke).replace(/\/$/,""),{config:Ee,presentationReady:F}=Tt(t,Wn,$n),Me=JSON.stringify({_api:n,appearance:r?{...r,shouldCloseOnInteractOutside:void 0}:void 0,capabilities:a,componentExports:l,composer:d,markdown:C?{...C,plugins:void 0}:void 0,permissions:Un,preload:Fn,remote:Ee,reopenOnRefresh:Ie,responseActions:Hn,showLauncher:Dn,startNewConversationOnOpen:Bn,startScreen:Vn}),o=Ae(()=>{let{remote:s,...i}=JSON.parse(Me),g=mn(s,{...i,agentId:t,getAuthToken:f,...ee!==void 0?{appearance:{...i.appearance,shouldCloseOnInteractOutside:ee}}:{}});return an({...g,context:u,markdown:g.markdown?{...g.markdown,plugins:G}:G?{plugins:G}:void 0,onFeedback:m,tools:ve})},[u,f,G,m,t,Me,ee,ve]),q=Ae(()=>new je(t,f),[t,f]),Oe=pn(e),Ne=Ee?.webfont;A(()=>{if(!Oe)return En(Ne)},[Oe,Ne]);let[j]=h(()=>Ie===!0&&Mt(t)),[ne,V]=h(j),[_,zn]=h(1),[Pe,Te]=h(1),[_e,xe]=h(!1),[K,Gn]=h(j||o.startNewConversationOnOpen?null:void 0),[N,qn]=h(null),[J,jn]=h(null),[Le,Kn]=h(!1),[te,oe]=h(!1),[Jn,Ue]=h(null),re=M(1),Fe=M(null),se=M(!1),ie=M(null),$e=M(null),$=M(j),ae=M(null),X=M(null),ce=M([]),Xn=xn(Nt,Pt,()=>!1),le=o.designTheme==="base"?null:`${o.designTheme}-${o.colorScheme==="system"?Xn?"dark":"light":o.colorScheme}`,x=F&&Jn===_&&J!==null,y=F&&ne,[Y,Yn]=h(j||o.preload),S=w(()=>Yn(!0),[]),[W,H]=h(!1),[He,De]=h(!1),ue=w(()=>H(!0),[]);A(()=>{if(!W||!N)return;let s=()=>{queueMicrotask(()=>{let i=N.querySelector(".ha-composer:not([hidden] *)");i&&on(i,document.activeElement)||H(!1)})};return N.addEventListener("focusout",s),()=>N.removeEventListener("focusout",s)},[W,N]),A(()=>{Y&&q.get().catch(()=>{})},[Y,q]),A(()=>{o.reopenOnRefresh?Re(o.agentId,ne):Re(o.agentId,!1)},[ne,o.agentId,o.reopenOnRefresh]),A(()=>{if(!Y)return;if(!F){Nn().catch(()=>{});return}let s=!0;return Nn().then(i=>{s&&jn(()=>i)}).catch(()=>{}),()=>{s=!1}},[F,Y]),A(()=>{if(!y||o.viewMode!=="sidebar"||window.innerWidth<640)return;let s=document.documentElement,i=s.style.marginRight,g=s.style.transition,k=window.matchMedia("(prefers-reduced-motion: reduce)").matches,de=Math.min(fe(o.agentId,window.innerWidth),window.innerWidth);return k||(s.style.transition=[g,"margin-right .28s cubic-bezier(.2,.8,.2,1)"].filter(Boolean).join(", ")),s.style.marginRight=`${de}px`,()=>{s.style.marginRight=i,window.setTimeout(()=>{s.style.transition=g},300)}},[y,o.agentId,o.viewMode]),A(()=>{let s=document.createElement("div"),i=document.createElement("div");s.dataset.herouiAgent=o.agentId,i.className="ha-root",ae.current=s,ie.current=i,X.current=kt(i),s.append(i),document.body.append(s);let g=!0;return queueMicrotask(()=>{g&&qn(i)}),()=>{g=!1,pe(o.agentId,!1);let k=X.current;ie.current=null,ae.current=null,X.current=null,ce.current=[],queueMicrotask(()=>{k?.unmount(),s.remove()})}},[o.agentId]),Mn(()=>{let s=ie.current,i=ae.current;if(!s||!i)return;s.className=le?`ha-root ${le}`:"ha-root",s.dataset.theme=o.colorScheme,s.dataset.viewMode=o.viewMode,s.dataset.position=o.launcherPosition,i.dataset.open=y?"true":"false",i.dataset.viewMode=o.viewMode,i.dataset.position=o.launcherPosition,o.zIndex===void 0?i.style.removeProperty("--ha-z-index"):i.style.setProperty("--ha-z-index",String(o.zIndex)),o.launcherOffset?(i.style.setProperty("--ha-launcher-x",`${o.launcherOffset.x}px`),i.style.setProperty("--ha-launcher-y",`${o.launcherOffset.y}px`)):(i.style.removeProperty("--ha-launcher-x"),i.style.removeProperty("--ha-launcher-y")),o.viewMode==="sidebar"&&i.style.setProperty("--ha-sidebar-width",`${fe(o.agentId,window.innerWidth)}px`);let g={...o.themeStyle,...o.panelStyle};for(let k of ce.current)k in g||s.style.removeProperty(k);for(let[k,de]of Object.entries(g))s.style.setProperty(k,de);ce.current=Object.keys(g)},[le,y,o.colorScheme,o.agentId,o.launcherOffset,o.launcherPosition,o.panelStyle,o.themeStyle,o.viewMode,o.zIndex,N]);let P=w(s=>{pe(o.agentId,!1),De(!1),Ue(null),Gn(s);let i=re.current+1;re.current=i,zn(i)},[o.agentId]),Be=w(s=>{re.current===s&&(Kn(!0),Ue(s))},[]),Qn=St(()=>O?.());A(()=>{!x||$e.current===_||($e.current=_,Qn())},[_,x]);let L=w(()=>{$.current=!1,se.current=!0,V(!1),H(!1),P(o.startNewConversationOnOpen?null:void 0)},[o.startNewConversationOnOpen,P]);A(()=>{y||!x||!se.current||(se.current=!1,requestAnimationFrame(()=>Fe.current?.focus()))},[y,x]);let D=w(()=>{$.current=!0,V(!0),S()},[S]),Ve=S,Q=w(s=>{let i=s?en(s):null;i&&nn(o.agentId,i),$.current=!0,V(!0),H(!1),S(),P(null)},[o.agentId,P,S]),We=w(s=>{$.current=!0,V(!0),H(!1),S(),P(s)},[P,S]),ze=w(()=>{y||$.current?L():D()},[L,y,D]),Ge=w(()=>{oe(!1),xe(!1),Te(s=>s+1)},[]),qe=w(()=>{let s=[`heroui-agent:anonymous:${o.agentId}`,`heroui-agent:conversation:${o.agentId}:`,`heroui-agent:history:${o.agentId}:`];for(let i=localStorage.length-1;i>=0;i-=1){let g=localStorage.key(i);g&&s.some(k=>g.startsWith(k))&&localStorage.removeItem(g)}$.current=!1,oe(!1),V(!1),H(!1),Re(o.agentId,!1),xe(!0),Te(i=>i+1),P(),window.setTimeout(()=>{import("./composer-draft-NSKK65F3.js").then(({clearAgentComposerDraftsForProject:i})=>i(o.agentId)).catch(()=>{})},0)},[o.agentId,P]);return A(()=>{let s={hide:L,newConversation:Q,preload:Ve,ready:x,refreshAuth:Ge,show:D,shutdown:qe,toggle:ze};return B.set(o.agentId,s),Pn(),()=>{B.get(o.agentId)===s&&(B.delete(o.agentId),Pn())}},[L,Q,o.agentId,Ve,x,Ge,D,qe,ze]),Mn(()=>{let s=X.current;if(!N||!s)return;let i=kn({onFileDialogActiveChange:De,onIntent:S,options:o});s.render(Tn(_n,{children:[F&&o.showLauncher&&!y?Tn("button",{ref:Fe,"aria-expanded":!1,"aria-haspopup":"dialog",className:"ha-launcher",style:o.launcherStyle,type:"button","aria-label":te?"Open data assistant, unread messages":"Open data assistant",onClick:D,children:[T(un,{icon:o.launcherIcon}),te?T("span",{"aria-hidden":"true",className:"ha-launcher__unread"}):null]}):null,J&&!He?T(J,{composerControlsRevealed:W,conversationEpoch:_,identityEpoch:Pe,identityReset:_e,open:y,options:o,requestedConversationId:K,shellComposerEndSlot:i.end,shellComposerFooterSlot:i.footer,showReadyLoader:!Le&&K!==null,tokenManager:q,onClose:L,onComposerControlsReveal:ue,onNewConversation:Q,onReady:Be,onSelectConversation:We,onUnreadChange:oe}):T(Xe,{agentId:o.agentId,shouldCloseOnInteractOutside:o.shouldCloseOnInteractOutside,defaultExpanded:o.panelExpanded,expandable:o.panelExpandable,historySlot:T(_n,{}),name:"Data assistant",open:y,showBetaBadge:o.showBetaBadge,viewMode:o.viewMode,onClose:L,children:K===null?T(sn,{composerConnecting:!0,agentId:o.agentId,composerControlsAvailable:o.composerControlsAvailable,composerControlsRevealed:W,composerEndSlot:i.end,composerFooterSlot:i.footer,composerStartSlot:i.start,greeting:o.greeting,placeholder:o.composerPlaceholder,subtitle:o.subtitle,suggestedPrompts:o.suggestedPrompts??[],onComposerControlsReveal:ue,onIntent:S},`shell-${_}`):T(Je,{})})]}))},[J,W,He,_,Be,te,Le,L,Pe,_e,y,Q,o,N,x,F,K,S,ue,We,D,q]),null}export{go as a,ho as b};
1
+ import{B as sn,J as an,a as je,c as Ke,d as Je,f as fe,g as Xe,j as Ye,l as en,m as nn,p as tn,r as pe,t as on,u as rn}from"./chunk-6RWQT7JH.js";import{a as Qe}from"./chunk-6ZJJN322.js";import{d as Ze,e as me}from"./chunk-UHHKMESI.js";import{useCallback as w,useEffect as A,useEffectEvent as St,useLayoutEffect as Mn,useMemo as Ae,useRef as M,useState as h,useSyncExternalStore as xn}from"react";import{createRoot as kt}from"react-dom/client";import{SparklesFill as Zn}from"@gravity-ui/icons";import{jsx as et}from"react/jsx-runtime";function cn(e){return et(Zn,{...e})}import{jsx as ge}from"react/jsx-runtime";function nt(e){return/\.svg(?:[?#]|$)/i.test(e)||/^data:image\/svg\+xml[;,]/i.test(e)}function ln(e){return`url("${e.replace(/["\\\n\r]/g,encodeURIComponent)}")`}function un({icon:e}){return e?nt(e)?ge("span",{"aria-hidden":"true",className:"ha-launcher__icon ha-launcher__icon--tinted",style:{WebkitMaskImage:ln(e),maskImage:ln(e)}}):ge("img",{alt:"",className:"ha-launcher__icon",src:e}):ge(cn,{})}function dn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function fn(e,n){if(n===void 0)return e;if(!dn(e)||!dn(n))return n;let t={...e};for(let[r,a]of Object.entries(n))a!==void 0&&(t[r]=r in e?fn(e[r],a):a);return t}function mn(e,n){if(!e)return n;let t={appearance:e.appearance,capabilities:e.capabilities,composer:e.composer,markdown:e.markdown,permissions:e.permissions,responseActions:e.responseActions,showBetaBadge:e.showBetaBadge,startScreen:e.startScreen},r=fn(t,{appearance:n.appearance,capabilities:n.capabilities,composer:n.composer,markdown:n.markdown?{...n.markdown,plugins:void 0}:void 0,permissions:n.permissions,responseActions:n.responseActions,showBetaBadge:n.showBetaBadge,startScreen:n.startScreen});return{...n,...r}}function pn(e){return!!e.appearance?.theme?.typography?.fontFamily?.trim()}var gn=1,c=Symbol("invalid");function z(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function R(e){if(e!==void 0)return typeof e=="string"?e:c}function v(e){if(e!==void 0)return typeof e=="boolean"?e:c}function he(e){if(e!==void 0)return typeof e=="number"&&Number.isFinite(e)?e:c}function I(e){return n=>{if(n!==void 0)return typeof n=="string"&&e.includes(n)?n:c}}function hn(e){if(e===void 0)return;if(typeof e=="string")return e;if(!z(e))return c;let n=R(e.dark),t=R(e.light);return n===c||t===c?c:{...n===void 0?{}:{dark:n},...t===void 0?{}:{light:t}}}function tt(e){if(e===void 0)return;if(!z(e))return c;let n={};for(let[t,r]of Object.entries(e)){if(typeof r!="string")return c;n[t]=r}return n}function ot(e){if(e!==void 0)return!Array.isArray(e)||e.some(n=>typeof n!="string")?c:e}function b(e,n){if(e===void 0||!z(e))return c;let t={};for(let[r,a]of Object.entries(n)){let l=a(e[r]);if(l===c)return c;l!==void 0&&(t[r]=l)}return t}function E(e){return e===c?void 0:e}var rt=["accent","background","foreground","overlay","surface","surfaceSecondary","tooltip"];function st(e){return b(e,{componentSurfaceVariant:I(["outline","plain","surface","surface-secondary"]),launcher:n=>n===void 0?void 0:b(n,{background:hn,icon:R,position:I(["bottom-left","bottom-right"]),style:tt}),panel:n=>n===void 0?void 0:b(n,{expandable:v,expanded:v,initialHeight:t=>t===void 0||typeof t=="string"?t:he(t),initialWidth:t=>t===void 0||typeof t=="string"?t:he(t)}),surfaceVariant:I(["outline","plain","surface","surface-secondary"]),theme:n=>n===void 0?void 0:b(n,{colorScheme:I(["dark","light","system"]),colors:t=>t===void 0?void 0:b(t,Object.fromEntries(rt.map(r=>[r,hn]))),designTheme:I(["base","brutalism","glass","mouve"]),radius:I(["pill","round","sharp","soft"]),typography:t=>t===void 0?void 0:b(t,{baseSize:he,fontFamily:R})}),viewMode:I(["floating","sidebar"])})}function it(e){return b(e,{attachments:n=>{if(n===void 0||n===!1)return n;if(!Array.isArray(n))return c;let t=n.filter(r=>typeof r=="string"&&Ye(r));return t.length===n.length?t:c},defaultModel:R,dictation:v,disclaimer:n=>n===!1?!1:R(n),modelPicker:v,placeholder:R})}function at(e){return b(e,{animated:n=>{if(n===void 0||n===!1)return n;if(!z(n))return c;let t=I(["blurIn","fadeIn","slideUp"])(n.animation);return t===c||t===void 0?c:{...n,animation:t}},caret:n=>n===!1?!1:I(["block","circle"])(n)})}function ct(e){if(e===void 0||e===!1)return e;if(!Array.isArray(e))return c;let n=["copy","feedback","retry"],t=e.filter(r=>typeof r=="string"&&n.includes(r));return t.length===e.length?t:c}function Z(e){if(!z(e)||e.version!==gn)return null;let n=e.revision;if(typeof n!="string"||!n)return null;let t=E(st(e.appearance)),r=E(b(e.capabilities,{imageSearch:v,newsSearch:v,webSearch:v})),a=E(it(e.composer)),l=E(at(e.markdown)),d=E(b(e.permissions,{defaultMode:I(["ask","auto","full"]),showPicker:v})),u=E(ct(e.responseActions)),f=E(v(e.showBetaBadge)),C=E(b(e.startScreen,{greeting:R,promptShortcuts:v,prompts:ot,subtitle:R})),m=E(b(e.webfont,{familyName:O=>typeof O=="string"&&O?O:c,fontFaceUrl:R,stylesheetUrl:R}));return{...t?{appearance:t}:{},...r?{capabilities:r}:{},...a?{composer:a}:{},...l?{markdown:l}:{},...d?{permissions:d}:{},...u===void 0?{}:{responseActions:u},...f===void 0?{}:{showBetaBadge:f},...C?{startScreen:C}:{},...m?{webfont:m}:{},revision:n,version:gn}}function ye(e){return`heroui-agent:config:${e}`}var yn=1;function bn(e){try{let n=window.localStorage.getItem(ye(e));if(!n)return null;let t=JSON.parse(n);if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let a=t;if(a.cacheVersion===yn&&typeof a.cachedAt=="number"&&Number.isFinite(a.cachedAt)){let l=Z(a.config);return l?{cachedAt:a.cachedAt,config:l,legacy:!1}:null}}let r=Z(t);return r?{cachedAt:0,config:r,legacy:!0}:null}catch{return null}}function be(e,n,t=Date.now()){try{let r={cacheVersion:yn,cachedAt:t,config:n};window.localStorage.setItem(ye(e),JSON.stringify(r))}catch{}}function wn(e){try{window.localStorage.removeItem(ye(e))}catch{}}async function Cn(e,n,t={}){try{let r=await fetch(`${e}/v1/agents/${encodeURIComponent(n)}/appearance`,{headers:t.revision?{"If-None-Match":`"${t.revision}"`}:{},...t.signal?{signal:t.signal}:{}});if(r.status===304)return{status:"not-modified"};if(r.status===404||r.status===410)return{status:"missing"};if(!r.ok)return{status:"unavailable"};let a=Z(await r.json());return a?{config:a,status:"ok"}:{status:"unavailable"}}catch{return{status:"unavailable"}}}import{ChevronDown as lt,Microphone as ut,Plus as dt,ShieldCheck as ft}from"@gravity-ui/icons";import{Suspense as Rn,lazy as Sn,useEffect as mt,useRef as pt,useState as we}from"react";import{Fragment as In,jsx as p,jsxs as Ce}from"react/jsx-runtime";var gt={ask:"Ask for approval",auto:"Approve for me",full:"Full access"},ht=Sn(()=>import("./model-picker-QTI5TDBG.js").then(({ModelPicker:e})=>({default:e}))),yt=Sn(()=>import("./shell-permission-picker-KIC3VEYJ.js").then(({ShellPermissionPicker:e})=>({default:e})));function kn({onFileDialogActiveChange:e,onIntent:n,options:t}){return{end:p(wt,{options:t,onIntent:n}),footer:t.composerDisclaimer?p("p",{className:"ha-footnote",children:Qe(t.composerDisclaimer)}):null,start:t.composerAttachmentContentTypes.length>0?p(bt,{accept:t.composerAttachmentAccept,agentId:t.agentId,onFileDialogActiveChange:e,onIntent:n}):null}}function bt({accept:e,agentId:n,onFileDialogActiveChange:t,onIntent:r}){let a=pt(null);return mt(()=>{let l=a.current,d,u=()=>t(!1),f=()=>{d=window.setTimeout(u,0)};return l?.addEventListener("cancel",u),window.addEventListener("focus",f),()=>{l?.removeEventListener("cancel",u),window.removeEventListener("focus",f),window.clearTimeout(d)}},[t]),Ce(In,{children:[p("input",{ref:a,multiple:!0,accept:e,"aria-label":"Choose files to attach",className:"ha-file-input",type:"file",onChange:l=>{rn(n,Array.from(l.currentTarget.files??[])),l.currentTarget.value="",t(!1),r()}}),p("button",{"aria-label":"Attach files",className:"ha-attach",type:"button",onClick:()=>{t(!0),a.current?.click()},children:p(dt,{"aria-hidden":"true"})})]})}function wt({onIntent:e,options:n}){let t=n.composerDefaultModel??Ze,[r,a]=we(t),[l,d]=we(!1),[u,f]=we(!1),C=me.find(m=>m.id===r)?.label??r;return Ce(In,{children:[n.permissionShowPicker&&n.tools.length>0?p(Rn,{fallback:p(An,{kind:"permission",label:gt[n.permissionDefaultMode],tone:n.permissionDefaultMode==="full"?"warning":void 0,onActivate:()=>f(!0)}),children:p(yt,{agentId:n.agentId,defaultMode:n.permissionDefaultMode,defaultOpen:u,onIntent:e})}):null,n.composerModelPicker?p(Rn,{fallback:p(An,{kind:"model",label:C,onActivate:()=>d(!0)}),children:p(ht,{"aria-label":"AI model",className:"ha-model-picker",defaultOpen:l,options:me,value:r,onChange:m=>{a(m),tn(n.agentId,m),e()}})}):null,n.composerDictation?p("button",{disabled:!0,"aria-label":"Dictate message",className:"ha-dictation",type:"button",children:p(ut,{"aria-hidden":"true"})}):null]})}function An({kind:e,label:n,onActivate:t,tone:r}){let a=`aui-${e}-picker`;return p("div",{className:`${a} ha-${e}-picker`,"data-tone":r,children:Ce("button",{"aria-label":e==="model"?"AI model":"Tool permissions",className:`${a}__trigger ha-shell-picker-trigger`,type:"button",onClick:t,onPointerDown:l=>l.preventDefault(),children:[e==="permission"?p(ft,{"aria-hidden":"true",className:"aui-permission-picker__trigger-icon"}):null,p("span",{className:`${a}__value`,children:n}),p(lt,{"aria-hidden":"true",className:`${a}__indicator`})]})})}var Ct=[".woff2",".woff",".ttf",".otf",".eot"];function Rt(e){return`heroui-agent-font-${e.familyName.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`}function At(e){let n=e.includes(":vf@")||e.includes("-wght-")||e.includes("-opsz-");return e.endsWith(".woff")?"woff":e.endsWith(".ttf")?"truetype":e.endsWith(".otf")?"opentype":n?"woff2-variations":"woff2"}function vn(e,n){try{let t=new URL(e);if(t.protocol!=="https:")return!1;if(!n)return!0;let r=t.pathname.toLowerCase();return Ct.some(a=>r.endsWith(a))}catch{return!1}}function En(e){if(!e||typeof document>"u")return()=>{};let n=Rt(e);if(document.getElementById(n))return()=>{};if(e.stylesheetUrl&&vn(e.stylesheetUrl,!1)){let t=document.createElement("link");return t.id=n,t.rel="stylesheet",t.href=e.stylesheetUrl,document.head.append(t),()=>t.remove()}if(e.fontFaceUrl&&vn(e.fontFaceUrl,!0)){let t=document.createElement("style"),r=e.fontFaceUrl.includes(":vf@")||e.fontFaceUrl.includes("-wght-")||e.fontFaceUrl.includes("-opsz-");return t.id=n,t.textContent=["@font-face {",` font-family: '${e.familyName.replaceAll("'","")}';`," font-style: normal;"," font-display: swap;",` font-weight: ${r?"100 900":"400"};`,` src: url(${e.fontFaceUrl}) format('${At(e.fontFaceUrl)}');`,"}"].join(`
2
+ `),document.head.append(t),()=>t.remove()}return()=>{}}import{Fragment as _n,jsx as T,jsxs as Tn}from"react/jsx-runtime";var It=600,vt=5*6e4,Et="heroui-agent:open:";function Se(e){return`${Et}${e}`}function Mt(e){if(typeof window>"u")return!1;try{return window.sessionStorage.getItem(Se(e))==="true"}catch{return!1}}function Re(e,n){try{n?window.sessionStorage.setItem(Se(e),"true"):window.sessionStorage.removeItem(Se(e))}catch{}}var On;function Nn(){return On??=import(/* webpackPrefetch: true */"./embed-runtime-YK64GOPA.js").then(e=>e.default),On}var B=new Map,ke=new Set;function Ln(e){return e?B.get(e):[...B.values()][B.size-1]}function Pn(){for(let e of ke)e()}function Ot(e){return ke.add(e),()=>ke.delete(e)}function Nt(e){let n=window.matchMedia?.("(prefers-color-scheme: dark)");return n?.addEventListener?.("change",e),()=>n?.removeEventListener?.("change",e)}function Pt(){return window.matchMedia?.("(prefers-color-scheme: dark)").matches===!0}function U(e,n,...t){let r=Ln(e);if(!r){console.warn("HeroUI Agent is not mounted yet. Add <HeroUIAgent /> to your layout.");return}let a=r[n];a(...t)}function Tt(e,n,t){let[r]=h(()=>!t||typeof window>"u"?null:bn(e)),[a,l]=h(()=>{if(!t)return{config:null,presentationReady:!0};let d=r?Date.now()-r.cachedAt:Number.POSITIVE_INFINITY,u=r!==null&&!r.legacy&&d>=0&&d<=vt;return{config:u?r.config:null,presentationReady:u}});return A(()=>{if(!t)return;let d=new AbortController,u=!0,f=m=>{l(O=>O.presentationReady?O:{config:m,presentationReady:!0})},C=window.setTimeout(()=>{u&&(d.abort(),f(r?.config??null))},It);return Cn(n,e,{...r?.config.revision?{revision:r.config.revision}:{},signal:d.signal}).then(m=>{if(!(!u||d.signal.aborted)){if(m.status==="ok"){be(e,m.config),f(m.config);return}if(m.status==="not-modified"){r&&be(e,r.config),f(r?.config??null);return}if(m.status==="missing"){wn(e),f(null);return}f(r?.config??null)}}).finally(()=>{!u||d.signal.aborted||window.clearTimeout(C)}),()=>{u=!1,d.abort(),window.clearTimeout(C)}},[n,r,t,e]),t?a:{config:null,presentationReady:!0}}function go(e){let n=w(()=>Ln(e)?.ready??!1,[e]),t=xn(Ot,n,()=>!1);return Ae(()=>({hide:()=>U(e,"hide"),newConversation:r=>U(e,"newConversation",r),preload:()=>U(e,"preload"),ready:t,refreshAuth:()=>U(e,"refreshAuth"),show:()=>U(e,"show"),shutdown:()=>U(e,"shutdown"),toggle:()=>U(e,"toggle")}),[e,t])}function ho(e){let n=`${e.agentId}\0${e._api?.baseUrl??""}\0${e.remoteConfig!==!1}`;return T(_t,{...e},n)}function _t(e){let{_api:n,agentId:t,appearance:r,capabilities:a,componentExports:l,composer:d,context:u,getAuthToken:f,markdown:C,onFeedback:m,onReady:O,permissions:Un,preload:Fn,remoteConfig:$n=!0,reopenOnRefresh:Ie,responseActions:Hn,showLauncher:Dn,startNewConversationOnOpen:Bn,startScreen:Vn,tools:ve}=e,G=C?.plugins,ee=r?.shouldCloseOnInteractOutside,Wn=(n?.baseUrl??Ke).replace(/\/$/,""),{config:Ee,presentationReady:F}=Tt(t,Wn,$n),Me=JSON.stringify({_api:n,appearance:r?{...r,shouldCloseOnInteractOutside:void 0}:void 0,capabilities:a,componentExports:l,composer:d,markdown:C?{...C,plugins:void 0}:void 0,permissions:Un,preload:Fn,remote:Ee,reopenOnRefresh:Ie,responseActions:Hn,showLauncher:Dn,startNewConversationOnOpen:Bn,startScreen:Vn}),o=Ae(()=>{let{remote:s,...i}=JSON.parse(Me),g=mn(s,{...i,agentId:t,getAuthToken:f,...ee!==void 0?{appearance:{...i.appearance,shouldCloseOnInteractOutside:ee}}:{}});return an({...g,context:u,markdown:g.markdown?{...g.markdown,plugins:G}:G?{plugins:G}:void 0,onFeedback:m,tools:ve})},[u,f,G,m,t,Me,ee,ve]),q=Ae(()=>new je(t,f),[t,f]),Oe=pn(e),Ne=Ee?.webfont;A(()=>{if(!Oe)return En(Ne)},[Oe,Ne]);let[j]=h(()=>Ie===!0&&Mt(t)),[ne,V]=h(j),[_,zn]=h(1),[Pe,Te]=h(1),[_e,xe]=h(!1),[K,Gn]=h(j||o.startNewConversationOnOpen?null:void 0),[N,qn]=h(null),[J,jn]=h(null),[Le,Kn]=h(!1),[te,oe]=h(!1),[Jn,Ue]=h(null),re=M(1),Fe=M(null),se=M(!1),ie=M(null),$e=M(null),$=M(j),ae=M(null),X=M(null),ce=M([]),Xn=xn(Nt,Pt,()=>!1),le=o.designTheme==="base"?null:`${o.designTheme}-${o.colorScheme==="system"?Xn?"dark":"light":o.colorScheme}`,x=F&&Jn===_&&J!==null,y=F&&ne,[Y,Yn]=h(j||o.preload),S=w(()=>Yn(!0),[]),[W,H]=h(!1),[He,De]=h(!1),ue=w(()=>H(!0),[]);A(()=>{if(!W||!N)return;let s=()=>{queueMicrotask(()=>{let i=N.querySelector(".ha-composer:not([hidden] *)");i&&on(i,document.activeElement)||H(!1)})};return N.addEventListener("focusout",s),()=>N.removeEventListener("focusout",s)},[W,N]),A(()=>{Y&&q.get().catch(()=>{})},[Y,q]),A(()=>{o.reopenOnRefresh?Re(o.agentId,ne):Re(o.agentId,!1)},[ne,o.agentId,o.reopenOnRefresh]),A(()=>{if(!Y)return;if(!F){Nn().catch(()=>{});return}let s=!0;return Nn().then(i=>{s&&jn(()=>i)}).catch(()=>{}),()=>{s=!1}},[F,Y]),A(()=>{if(!y||o.viewMode!=="sidebar"||window.innerWidth<640)return;let s=document.documentElement,i=s.style.marginRight,g=s.style.transition,k=window.matchMedia("(prefers-reduced-motion: reduce)").matches,de=Math.min(fe(o.agentId,window.innerWidth),window.innerWidth);return k||(s.style.transition=[g,"margin-right .28s cubic-bezier(.2,.8,.2,1)"].filter(Boolean).join(", ")),s.style.marginRight=`${de}px`,()=>{s.style.marginRight=i,window.setTimeout(()=>{s.style.transition=g},300)}},[y,o.agentId,o.viewMode]),A(()=>{let s=document.createElement("div"),i=document.createElement("div");s.dataset.herouiAgent=o.agentId,i.className="ha-root",ae.current=s,ie.current=i,X.current=kt(i),s.append(i),document.body.append(s);let g=!0;return queueMicrotask(()=>{g&&qn(i)}),()=>{g=!1,pe(o.agentId,!1);let k=X.current;ie.current=null,ae.current=null,X.current=null,ce.current=[],queueMicrotask(()=>{k?.unmount(),s.remove()})}},[o.agentId]),Mn(()=>{let s=ie.current,i=ae.current;if(!s||!i)return;s.className=le?`ha-root ${le}`:"ha-root",s.dataset.theme=o.colorScheme,s.dataset.viewMode=o.viewMode,s.dataset.position=o.launcherPosition,i.dataset.open=y?"true":"false",i.dataset.viewMode=o.viewMode,i.dataset.position=o.launcherPosition,o.zIndex===void 0?i.style.removeProperty("--ha-z-index"):i.style.setProperty("--ha-z-index",String(o.zIndex)),o.launcherOffset?(i.style.setProperty("--ha-launcher-x",`${o.launcherOffset.x}px`),i.style.setProperty("--ha-launcher-y",`${o.launcherOffset.y}px`)):(i.style.removeProperty("--ha-launcher-x"),i.style.removeProperty("--ha-launcher-y")),o.viewMode==="sidebar"&&i.style.setProperty("--ha-sidebar-width",`${fe(o.agentId,window.innerWidth)}px`);let g={...o.themeStyle,...o.panelStyle};for(let k of ce.current)k in g||s.style.removeProperty(k);for(let[k,de]of Object.entries(g))s.style.setProperty(k,de);ce.current=Object.keys(g)},[le,y,o.colorScheme,o.agentId,o.launcherOffset,o.launcherPosition,o.panelStyle,o.themeStyle,o.viewMode,o.zIndex,N]);let P=w(s=>{pe(o.agentId,!1),De(!1),Ue(null),Gn(s);let i=re.current+1;re.current=i,zn(i)},[o.agentId]),Be=w(s=>{re.current===s&&(Kn(!0),Ue(s))},[]),Qn=St(()=>O?.());A(()=>{!x||$e.current===_||($e.current=_,Qn())},[_,x]);let L=w(()=>{$.current=!1,se.current=!0,V(!1),H(!1),P(o.startNewConversationOnOpen?null:void 0)},[o.startNewConversationOnOpen,P]);A(()=>{y||!x||!se.current||(se.current=!1,requestAnimationFrame(()=>Fe.current?.focus()))},[y,x]);let D=w(()=>{$.current=!0,V(!0),S()},[S]),Ve=S,Q=w(s=>{let i=s?en(s):null;i&&nn(o.agentId,i),$.current=!0,V(!0),H(!1),S(),P(null)},[o.agentId,P,S]),We=w(s=>{$.current=!0,V(!0),H(!1),S(),P(s)},[P,S]),ze=w(()=>{y||$.current?L():D()},[L,y,D]),Ge=w(()=>{oe(!1),xe(!1),Te(s=>s+1)},[]),qe=w(()=>{let s=[`heroui-agent:anonymous:${o.agentId}`,`heroui-agent:conversation:${o.agentId}:`,`heroui-agent:history:${o.agentId}:`];for(let i=localStorage.length-1;i>=0;i-=1){let g=localStorage.key(i);g&&s.some(k=>g.startsWith(k))&&localStorage.removeItem(g)}$.current=!1,oe(!1),V(!1),H(!1),Re(o.agentId,!1),xe(!0),Te(i=>i+1),P(),window.setTimeout(()=>{import("./composer-draft-NSKK65F3.js").then(({clearAgentComposerDraftsForProject:i})=>i(o.agentId)).catch(()=>{})},0)},[o.agentId,P]);return A(()=>{let s={hide:L,newConversation:Q,preload:Ve,ready:x,refreshAuth:Ge,show:D,shutdown:qe,toggle:ze};return B.set(o.agentId,s),Pn(),()=>{B.get(o.agentId)===s&&(B.delete(o.agentId),Pn())}},[L,Q,o.agentId,Ve,x,Ge,D,qe,ze]),Mn(()=>{let s=X.current;if(!N||!s)return;let i=kn({onFileDialogActiveChange:De,onIntent:S,options:o});s.render(Tn(_n,{children:[F&&o.showLauncher&&!y?Tn("button",{ref:Fe,"aria-expanded":!1,"aria-haspopup":"dialog",className:"ha-launcher",style:o.launcherStyle,type:"button","aria-label":te?"Open data assistant, unread messages":"Open data assistant",onClick:D,children:[T(un,{icon:o.launcherIcon}),te?T("span",{"aria-hidden":"true",className:"ha-launcher__unread"}):null]}):null,J&&!He?T(J,{composerControlsRevealed:W,conversationEpoch:_,identityEpoch:Pe,identityReset:_e,open:y,options:o,requestedConversationId:K,shellComposerEndSlot:i.end,shellComposerFooterSlot:i.footer,showReadyLoader:!Le&&K!==null,tokenManager:q,onClose:L,onComposerControlsReveal:ue,onNewConversation:Q,onReady:Be,onSelectConversation:We,onUnreadChange:oe}):T(Xe,{agentId:o.agentId,shouldCloseOnInteractOutside:o.shouldCloseOnInteractOutside,defaultExpanded:o.panelExpanded,expandable:o.panelExpandable,historySlot:T(_n,{}),name:"Data assistant",open:y,showBetaBadge:o.showBetaBadge,viewMode:o.viewMode,onClose:L,children:K===null?T(sn,{composerConnecting:!0,agentId:o.agentId,composerControlsAvailable:o.composerControlsAvailable,composerControlsRevealed:W,composerEndSlot:i.end,composerFooterSlot:i.footer,composerStartSlot:i.start,greeting:o.greeting,placeholder:o.composerPlaceholder,subtitle:o.subtitle,suggestedPrompts:o.suggestedPrompts??[],onComposerControlsReveal:ue,onIntent:S},`shell-${_}`):T(Je,{})})]}))},[J,W,He,_,Be,te,Le,L,Pe,_e,y,Q,o,N,x,F,K,S,ue,We,D,q]),null}export{go as a,ho as b};
@@ -0,0 +1 @@
1
+ import{a as $}from"./chunk-MXXCR5SR.js";import{a as T}from"./chunk-CR3H7AVI.js";import{Description as K,Label as X,ListBox as P,Select as x}from"@heroui/react";import{useCallback as Z,useEffect as U,useLayoutEffect as J,useRef as b,useState as S}from"react";import{useId as A}from"react";import{jsx as e,jsxs as y}from"react/jsx-runtime";function N({className:r,provider:i}){let o=i?.toLowerCase();return o==="openai"?e(q,{className:r,"data-provider":"openai"}):o==="google"?e(F,{className:r,"data-provider":"google"}):o==="anthropic"?e(z,{className:r,"data-provider":"anthropic"}):o==="moonshot ai"?e(V,{className:r,"data-provider":"moonshot-ai"}):null}function q(r){return e("svg",{"aria-hidden":"true",fill:"currentColor",focusable:"false",role:"presentation",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...r,children:e("path",{d:"M22.282 9.821a5.985 5.985 0 0 0-.516-4.911 6.046 6.046 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.182a5.985 5.985 0 0 0-3.998 2.9 6.046 6.046 0 0 0 .743 7.096 5.98 5.98 0 0 0 .511 4.911 6.051 6.051 0 0 0 6.515 2.9A5.985 5.985 0 0 0 13.26 24a6.056 6.056 0 0 0 5.772-4.206 5.99 5.99 0 0 0 3.997-2.9 6.056 6.056 0 0 0-.747-7.073m-9.022 12.608a4.476 4.476 0 0 1-2.877-1.041l.142-.08 4.778-2.758a.795.795 0 0 0 .393-.682v-6.737l2.02 1.169a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.758a.77.77 0 0 0 .781 0l5.843-3.368v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.141-1.646M2.341 7.896a4.485 4.485 0 0 1 2.365-1.973V11.6a.766.766 0 0 0 .388.677l5.814 3.354-2.02 1.169a.08.08 0 0 1-.071 0l-4.83-2.787A4.504 4.504 0 0 1 2.34 7.872zm16.596 3.856-5.833-3.388L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.104v-5.677a.79.79 0 0 0-.407-.667m2.011-3.023-.142-.085-4.773-2.782a.776.776 0 0 0-.786 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.499 4.499 0 0 1 6.68 4.66zM8.307 12.863l-2.02-1.164a.08.08 0 0 1-.038-.056V6.074a4.499 4.499 0 0 1 7.376-3.453l-.142.08-4.778 2.758a.795.795 0 0 0-.393.682zm1.098-2.365 2.602-1.5 2.607 1.5v2.999l-2.598 1.5-2.607-1.5Z"})})}function F(r){let i=A().replace(/:/g,""),o=`${i}-gemini-shape`,l=`${i}-gemini-mask`,c=`${i}-gemini-yellow-blur`,a=`${i}-gemini-red-blur`,u=`${i}-gemini-green-blur`,m=`${i}-gemini-blue-blur`,f=`${i}-gemini-gold-blur`,d=`${i}-gemini-cyan-blur`,p=`${i}-gemini-violet-blur`,g=`${i}-gemini-coral-blur`,k=`${i}-gemini-lemon-blur`;return y("svg",{"aria-hidden":"true",fill:"none",focusable:"false",role:"presentation",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",...r,children:[e("path",{d:"M0 0h32v32H0z",fill:"none"}),e("defs",{children:e("path",{d:"M57.067 28.61q-7.396-3.184-12.945-8.732q-5.547-5.546-8.732-12.944a38.4 38.4 0 0 1-1.97-5.824A1.464 1.464 0 0 0 32 .001c-.671 0-1.255.458-1.419 1.11a38.4 38.4 0 0 1-1.971 5.823q-3.186 7.397-8.732 12.944q-5.548 5.548-12.945 8.732a38.4 38.4 0 0 1-5.824 1.972A1.464 1.464 0 0 0 0 32c0 .67.458 1.255 1.11 1.418a38.4 38.4 0 0 1 5.823 1.972q7.396 3.184 12.945 8.732q5.55 5.546 8.732 12.944a38.4 38.4 0 0 1 1.971 5.824c.164.65.749 1.11 1.419 1.11s1.255-.458 1.419-1.11a38.4 38.4 0 0 1 1.971-5.823q3.185-7.395 8.732-12.944q5.548-5.548 12.945-8.732a38.4 38.4 0 0 1 5.824-1.972A1.464 1.464 0 0 0 64 32.001c0-.672-.458-1.255-1.11-1.42a38.4 38.4 0 0 1-5.823-1.97",fill:"#fff",id:o})}),y("g",{fill:"none",children:[y("g",{mask:`url(#${l})`,transform:"translate(2 2)scale(.4375)",children:[e("use",{href:`#${o}`}),e("g",{filter:`url(#${c})`,children:e("ellipse",{cx:"14.208",cy:"16.716",fill:"#ffe432",rx:"14.208",ry:"16.716",transform:"rotate(19.552 -43.96 -16.268)"})}),e("g",{filter:`url(#${a})`,children:e("ellipse",{cx:"27.054",cy:"2.551",fill:"#fc413d",rx:"18.394",ry:"18.799"})}),e("g",{filter:`url(#${u})`,children:e("ellipse",{cx:"19.224",cy:"24.904",fill:"#00b95c",rx:"19.224",ry:"24.904",transform:"rotate(-2.799 667.58 51.694)"})}),e("g",{filter:`url(#${u})`,children:e("ellipse",{cx:"18.843",cy:"20.744",fill:"#00b95c",rx:"18.843",ry:"20.744",transform:"rotate(-31.317 81.174 36.482)"})}),e("g",{filter:`url(#${m})`,children:e("ellipse",{cx:"66.462",cy:"24.977",fill:"#3186ff",rx:"18.093",ry:"17.423"})}),e("g",{filter:`url(#${f})`,children:e("ellipse",{cx:"20.929",cy:"22.075",fill:"#fbbc04",rx:"20.929",ry:"22.075",transform:"rotate(37.251 9.618 -7.898)"})}),e("g",{filter:`url(#${d})`,children:e("ellipse",{cx:"24.131",cy:"22.292",fill:"#3186ff",rx:"24.131",ry:"22.292",transform:"rotate(34.51 19.317 63.957)"})}),e("g",{filter:`url(#${p})`,children:e("path",{d:"M54.226-2.304c2.794 3.799-.797 11.184-8.02 16.497c-7.222 5.312-15.342 6.539-18.136 2.74S28.866 5.75 36.09.436c7.223-5.312 15.343-6.539 18.136-2.74",fill:"#749bff"})}),e("g",{filter:`url(#${g})`,children:e("ellipse",{cx:"27.585",cy:"17.148",fill:"#fc413d",rx:"27.585",ry:"17.148",transform:"rotate(-42.847 5.973 20.37)"})}),e("g",{filter:`url(#${k})`,children:e("ellipse",{cx:"14.782",cy:"8.596",fill:"#ffee48",rx:"14.782",ry:"8.596",transform:"rotate(35.592 -44.338 25.191)"})})]}),y("defs",{children:[e("filter",{colorInterpolationFilters:"sRGB",filterUnits:"userSpaceOnUse",height:"42.756",id:c,width:"38.868",x:"-19.618",y:"12.903",children:e("feGaussianBlur",{stdDeviation:"2.46"})}),e("filter",{colorInterpolationFilters:"sRGB",filterUnits:"userSpaceOnUse",height:"85.162",id:a,width:"84.353",x:"-15.122",y:"-40.03",children:e("feGaussianBlur",{stdDeviation:"11.891"})}),e("filter",{colorInterpolationFilters:"sRGB",filterUnits:"userSpaceOnUse",height:"90.22",id:u,width:"78.916",x:"-20.768",y:"11.483",children:e("feGaussianBlur",{stdDeviation:"10.109"})}),e("filter",{colorInterpolationFilters:"sRGB",filterUnits:"userSpaceOnUse",height:"73.27",id:m,width:"74.611",x:"29.156",y:"-11.658",children:e("feGaussianBlur",{stdDeviation:"9.606"})}),e("filter",{colorInterpolationFilters:"sRGB",filterUnits:"userSpaceOnUse",height:"78.151",id:f,width:"77.538",x:"-38.291",y:"-16.269",children:e("feGaussianBlur",{stdDeviation:"8.706"})}),e("filter",{colorInterpolationFilters:"sRGB",filterUnits:"userSpaceOnUse",height:"76.898",id:d,width:"78.218",x:"7.78",y:"-6.098",children:e("feGaussianBlur",{stdDeviation:"7.775"})}),e("filter",{colorInterpolationFilters:"sRGB",filterUnits:"userSpaceOnUse",height:"51.479",id:p,width:"55.879",x:"13.208",y:"-18.425",children:e("feGaussianBlur",{stdDeviation:"6.957"})}),e("filter",{colorInterpolationFilters:"sRGB",filterUnits:"userSpaceOnUse",height:"68.674",id:g,width:"70.203",x:"-15.474",y:"-31.027",children:e("feGaussianBlur",{stdDeviation:"5.876"})}),e("filter",{colorInterpolationFilters:"sRGB",filterUnits:"userSpaceOnUse",height:"51.261",id:k,width:"55.137",x:"-14.173",y:"20.474",children:e("feGaussianBlur",{stdDeviation:"7.273"})}),e("mask",{height:"64",id:l,maskUnits:"userSpaceOnUse",width:"64",x:"0",y:"0",children:e("use",{href:`#${o}`})})]})]})]})}function z(r){return e("svg",{"aria-hidden":"true",fill:"none",focusable:"false",role:"presentation",viewBox:"0 0 256 257",xmlns:"http://www.w3.org/2000/svg",...r,children:e("path",{d:"m50.228 170.321 50.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0 125.796l.583-3.759 5.12-3.434 7.324.648 16.202 1.101 24.304 1.685 17.629 1.037 26.118 2.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758 7-7.713 9.397.649 2.398.648 9.527 7.323 20.35 15.75L94.817 91.9l3.889 3.24 1.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42 0l10.63 1.426 4.472 3.888 6.61 15.101 10.694 23.786 16.591 32.34 4.861 9.592 2.592 8.879.973 2.722h1.685v-1.556l1.36-18.211 2.528-22.36 2.463-28.776.843-8.1 4.018-9.722 7.971-5.25 6.222 2.981 5.12 7.324-.713 4.73-3.046 19.768-5.962 30.98-3.889 20.739h2.268l2.593-2.593 10.499-13.934 17.628-22.036 7.778-8.749 9.073-9.657 5.833-4.601h11.018l8.1 12.055-3.628 12.443-11.342 14.388-9.398 12.184-13.48 18.147-8.426 14.518.778 1.166 2.01-.194 30.46-6.481 16.462-2.982 19.637-3.37 8.88 4.148.971 4.213-3.5 8.62-20.998 5.184-24.628 4.926-36.682 8.685-.454.324.519.648 16.526 1.555 7.065.389h17.304l32.21 2.398 8.426 5.574 5.055 6.805-.843 5.184-12.962 6.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666 11.406 21.387 19.314 26.767 24.887 1.36 6.157-3.434 4.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73 6.935 25.017 37.59 1.296 11.536-1.814 3.76-6.481 2.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194 77.448-3.37 3.953-7.778 2.981-6.48-4.925-3.436-7.972 3.435-15.749 4.148-20.544 3.37-16.333 3.046-20.285 1.815-6.74-.13-.454-1.49.194-15.295 20.999-23.267 31.433-18.406 19.702-4.407 1.75-7.648-3.954.713-7.064 4.277-6.286 25.47-32.405 15.36-20.092 9.917-11.6-.065-1.686h-.583L44.07 198.125l-12.055 1.555-5.185-4.86.648-7.972 2.463-2.593 20.35-13.999z",fill:"#d97757"})})}function V(r){return y("svg",{"aria-hidden":"true",clipRule:"evenodd",fillRule:"evenodd",focusable:"false",role:"presentation",strokeLinejoin:"round",strokeMiterlimit:2,viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg",...r,children:[e("path",{d:"M503 114.333v280c0 60.711-49.29 110-110 110H113c-60.711 0-110-49.289-110-110v-280c0-60.71 49.289-110 110-110h280c60.71 0 110 49.29 110 110z"}),e("path",{d:"M342.065 189.759c1.886-2.42 3.541-4.63 5.289-6.77.81-1.007.74-1.771-.046-2.824-7.58-9.965-8.298-21.028-3.935-32.254 3.275-8.448 10.52-12.406 19.373-13.25 5.52-.521 10.936.046 15.959 2.73 6.596 3.53 10.438 8.912 11.688 16.341.995 5.926.81 11.712-.868 17.452-2.974 10.161-10.277 15.427-20.287 16.758-8.31 1.11-16.734 1.25-25.113 1.817-.648.046-1.308 0-2.06 0z",fill:"#027aff"}),e("path",{d:"M321.512 144.254h-50.064l-39.637 90.384h-56.036v-89.99H131v232.868h44.787v-98.103h78.973c13.598 0 26.015-7.927 31.744-20.252v118.355h44.787v-98.103c0-23.342-18.239-42.97-41.523-44.671v-.116h-24.593a45.577 45.577 0 0026.884-24.534l29.453-65.838z",fill:"#fff"})]})}import{jsx as s,jsxs as M}from"react/jsx-runtime";var v=8,Q=384,O=96;function W({description:r,provider:i}){return i?r?`${i} \xB7 ${r}`:i:r}function Y(r){let i=r?.closest(".ha-composer-wrap")?.querySelector(".ha-suggestions");if(!r||!i)return v;let o=r.getBoundingClientRect(),l=i.getBoundingClientRect();return l.bottom>o.top?v:Math.ceil(o.top-l.top+v)}function _(r){let i=Y(r),o=r?.closest("[data-agent-overlay-root], dialog")?.querySelector("header");if(!r||!o)return{maxHeight:void 0,offset:i};let l=r.getBoundingClientRect().top,c=o.getBoundingClientRect().bottom+v,a=Math.min(i,Math.max(v,Math.floor(l-c-O))),u=Math.floor(l-a-c);return{maxHeight:Math.min(Q,Math.max(O,u)),offset:a}}function j({"aria-label":r="AI model",className:i,defaultOpen:o=!1,isDisabled:l=!1,onChange:c,options:a,placement:u="top start",value:m}){let[f,d]=S(o),[p,g]=S({maxHeight:void 0,offset:v}),[k,R]=S(),I=b(!1),E=b(null),G=b(0),B=b(o&&typeof document<"u"&&document.activeElement instanceof HTMLElement?document.activeElement:null),h=b(null),w=l||a.length===0,H=a.find(t=>t.id===m),C=Z(t=>{h.current=t,t?.setAttribute("aria-keyshortcuts","Control+Shift+M"),R($(t))},[]),L=()=>{let t=B.current;B.current=null,t?.focus({preventScroll:!0}),requestAnimationFrame(()=>{queueMicrotask(()=>t?.focus({preventScroll:!0}))})},D=t=>{!t&&!I.current&&!f&&Date.now()-G.current<350||(t&&g(_(h.current)),t||L(),d(t),I.current=!1)};return U(()=>{if(w)return;let t=n=>{n.defaultPrevented||n.isComposing||n.repeat||!n.ctrlKey||!n.shiftKey||n.altKey||n.metaKey||n.key.toLowerCase()!=="m"||(n.preventDefault(),h.current?.focus(),g(_(h.current)),d(!0))};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[w]),J(()=>{o&&g(_(h.current))},[o]),U(()=>{if(!f)return;let t=({target:n})=>{n instanceof Node&&!h.current?.contains(n)&&!E.current?.contains(n)&&d(!1)};return document.addEventListener("pointerdown",t,!0),()=>document.removeEventListener("pointerdown",t,!0)},[f]),M(x,{"aria-label":r,className:T("aui-model-picker",i),isDisabled:w,isOpen:f,value:m,onOpenChange:D,onChange:t=>{t!=null&&c(t),L(),d(!1)},children:[M(x.Trigger,{ref:C,className:"aui-model-picker__trigger","data-shortcut":"\u2303\u21E7M","data-slot":"agent-ui-model-picker-trigger","data-tooltip":"Select model",onPointerDown:t=>{let n=t.currentTarget.getAttribute("aria-expanded")==="true";t.preventDefault(),I.current=n,n?B.current?.focus({preventScroll:!0}):B.current=document.activeElement instanceof HTMLElement?document.activeElement:null,n||(G.current=Date.now())},children:[s(x.Value,{className:"aui-model-picker__value",children:H?.label??m}),s(x.Indicator,{className:"aui-model-picker__indicator"}),M("span",{"aria-hidden":"true",className:"aui-picker-tooltip",children:[s("span",{children:"Select model"}),s("kbd",{className:"aui-picker-tooltip__shortcut",children:"\u2303\u21E7M"})]})]}),s(x.Popover,{ref:E,isNonModal:!0,className:"aui-model-picker__popover","data-panel-max-height":p.maxHeight,"data-suggestion-clearance":p.offset,maxHeight:p.maxHeight,offset:p.offset,placement:u,UNSTABLE_portalContainer:k,children:s(P,{"aria-label":`${r} options`,className:"aui-model-picker__list",children:a.map(t=>{let n=W(t);return M(P.Item,{className:"aui-model-picker__option","data-description":n,id:t.id,textValue:t.label,children:[s(N,{className:"aui-model-picker__option-icon",provider:t.provider}),M("span",{className:"aui-model-picker__option-copy",children:[s(X,{className:"aui-model-picker__option-label",children:t.label}),n?s(K,{className:"aui-model-picker__option-description",title:n,children:n}):null]}),s(P.ItemIndicator,{className:"aui-model-picker__option-indicator"})]},t.id)})})})]})}export{j as a};
@@ -1 +1 @@
1
- function r(){return function(n){return n}}function t(e){return!!(e&&typeof e=="object"&&typeof e.safeParse=="function")}function s(e,n){return t(e.parameters)?e.parameters.parse(n):n}function i(e,n){let o=e.get(n);return!o||o.needsApproval?null:o}export{r as a,t as b,s as c,i as d};
1
+ function r(){return function(n){return n}}function t(e){return!!(e&&typeof e=="object"&&typeof e.safeParse=="function")}function a(e,n){return t(e.parameters)?e.parameters.parse(n):n}function i(e,n){let o=e.get(n);return!o||o.needsApproval?null:o}export{r as a,t as b,a as c,i as d};
@@ -9,26 +9,46 @@ declare const HEROUI_AGENT_ATTACHMENT_MAX_BYTES: number;
9
9
  /**
10
10
  * File types that the hosted model pipeline can process consistently.
11
11
  *
12
- * SVG and office/archive formats are intentionally excluded: SVG can carry
13
- * active content, while provider support for zipped document formats varies.
12
+ * SVG is intentionally excluded because it can carry active content. Hosted
13
+ * document parsing handles the remaining office and publishing formats.
14
14
  */
15
15
  declare const HEROUI_AGENT_ATTACHMENT_EXTENSION_BY_CONTENT_TYPE: {
16
+ readonly "application/epub+zip": "epub";
16
17
  readonly "application/json": "json";
18
+ readonly "application/msword": "doc";
17
19
  readonly "application/pdf": "pdf";
20
+ readonly "application/rtf": "rtf";
21
+ readonly "application/vnd.ms-excel": "xls";
22
+ readonly "application/vnd.ms-excel.sheet.binary.macroenabled.12": "xlsb";
23
+ readonly "application/vnd.ms-excel.sheet.macroenabled.12": "xlsm";
24
+ readonly "application/vnd.ms-powerpoint": "ppt";
25
+ readonly "application/vnd.ms-powerpoint.presentation.macroenabled.12": "pptm";
26
+ readonly "application/vnd.ms-word.document.macroenabled.12": "docm";
27
+ readonly "application/vnd.oasis.opendocument.presentation": "odp";
28
+ readonly "application/vnd.oasis.opendocument.spreadsheet": "ods";
29
+ readonly "application/vnd.oasis.opendocument.text": "odt";
30
+ readonly "application/vnd.openxmlformats-officedocument.presentationml.presentation": "pptx";
31
+ readonly "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx";
32
+ readonly "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx";
18
33
  readonly "image/gif": "gif";
19
34
  readonly "image/jpeg": "jpg";
20
35
  readonly "image/png": "png";
21
36
  readonly "image/webp": "webp";
22
37
  readonly "text/csv": "csv";
38
+ readonly "text/html": "html";
23
39
  readonly "text/markdown": "md";
24
40
  readonly "text/plain": "txt";
41
+ readonly "text/rtf": "rtf";
25
42
  readonly "text/tab-separated-values": "tsv";
26
43
  };
27
44
  type HeroUIAgentAttachmentContentType = keyof typeof HEROUI_AGENT_ATTACHMENT_EXTENSION_BY_CONTENT_TYPE;
28
- declare const HEROUI_AGENT_ATTACHMENT_CONTENT_TYPES: readonly ("application/json" | "application/pdf" | "image/gif" | "image/jpeg" | "image/png" | "image/webp" | "text/csv" | "text/markdown" | "text/plain" | "text/tab-separated-values")[];
45
+ declare const HEROUI_AGENT_ATTACHMENT_CONTENT_TYPES: readonly ("application/epub+zip" | "application/json" | "application/msword" | "application/pdf" | "application/rtf" | "application/vnd.ms-excel" | "application/vnd.ms-excel.sheet.binary.macroenabled.12" | "application/vnd.ms-excel.sheet.macroenabled.12" | "application/vnd.ms-powerpoint" | "application/vnd.ms-powerpoint.presentation.macroenabled.12" | "application/vnd.ms-word.document.macroenabled.12" | "application/vnd.oasis.opendocument.presentation" | "application/vnd.oasis.opendocument.spreadsheet" | "application/vnd.oasis.opendocument.text" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "image/gif" | "image/jpeg" | "image/png" | "image/webp" | "text/csv" | "text/html" | "text/markdown" | "text/plain" | "text/rtf" | "text/tab-separated-values")[];
29
46
  declare const HEROUI_AGENT_ATTACHMENT_ACCEPT: string;
47
+ declare const HEROUI_AGENT_ATTACHMENT_CONTENT_TYPE_BY_EXTENSION: Readonly<Record<string, "application/epub+zip" | "application/json" | "application/msword" | "application/pdf" | "application/rtf" | "application/vnd.ms-excel" | "application/vnd.ms-excel.sheet.binary.macroenabled.12" | "application/vnd.ms-excel.sheet.macroenabled.12" | "application/vnd.ms-powerpoint" | "application/vnd.ms-powerpoint.presentation.macroenabled.12" | "application/vnd.ms-word.document.macroenabled.12" | "application/vnd.oasis.opendocument.presentation" | "application/vnd.oasis.opendocument.spreadsheet" | "application/vnd.oasis.opendocument.text" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "image/gif" | "image/jpeg" | "image/png" | "image/webp" | "text/csv" | "text/html" | "text/markdown" | "text/plain" | "text/rtf" | "text/tab-separated-values">>;
30
48
  declare const HEROUI_AGENT_TEXT_ATTACHMENT_CONTENT_TYPES: ReadonlySet<string>;
31
49
  declare function isHeroUIAgentAttachmentContentType(value: string): value is HeroUIAgentAttachmentContentType;
50
+ /** Browsers sometimes omit Office MIME types; fall back to the file extension. */
51
+ declare function resolveHeroUIAgentAttachmentContentType(contentType: string, filename: string): HeroUIAgentAttachmentContentType | null;
32
52
 
33
53
  /**
34
54
  * Public remote configuration document served by
@@ -1158,7 +1178,7 @@ declare const AGENT_UI_KIND_NAMES: readonly AgentUIRenderableKind[];
1158
1178
  declare function renderAgentUICatalogPrompt(): string;
1159
1179
 
1160
1180
  /** Names owned by the hosted runtime; client tools may not shadow them. */
1161
- declare const RESERVED_AGENT_TOOL_NAMES: readonly ["callMcpTool", "composeUI", "executeSandbox", "getComponentSchema", "renderComponent", "searchKnowledge", "searchMcpTools", "searchWeb"];
1181
+ declare const RESERVED_AGENT_TOOL_NAMES: readonly ["callMcpTool", "composeUI", "executeSandbox", "generateFile", "getComponentSchema", "renderComponent", "searchKnowledge", "searchMcpTools", "searchWeb"];
1162
1182
  /**
1163
1183
  * Namespace the runtime uses for tools borrowed from a project's MCP servers
1164
1184
  * (`mcp_<serverSlug>_<toolName>`). Reserved wholesale so a client tool can
@@ -1186,7 +1206,7 @@ declare const clientToolsSchema: z.ZodArray<z.ZodObject<{
1186
1206
  type ClientToolManifestEntry = z.infer<typeof clientToolManifestEntrySchema>;
1187
1207
 
1188
1208
  declare const HEROUI_AGENT_PROTOCOL_VERSION: 6;
1189
- declare const HEROUI_AGENT_SDK_VERSION: "1.0.0-beta.2";
1209
+ declare const HEROUI_AGENT_SDK_VERSION: "1.0.0-beta.3";
1190
1210
  /** Production Agent API origin used when hosts omit `_api.baseUrl` / `apiBaseUrl`. */
1191
1211
  declare const HEROUI_AGENT_API_BASE_URL: "https://api.heroui.pro";
1192
1212
 
@@ -1393,7 +1413,7 @@ declare const agentModelIdSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.
1393
1413
  * Durable usage and success metrics come from the server-side runtime events,
1394
1414
  * not from this best-effort client channel.
1395
1415
  */
1396
- declare const HEROUI_AGENT_EMBED_EVENT_NAMES: readonly ["action_approved", "action_declined", "component_copy", "component_export", "component_followup", "component_rendered", "component_submit", "component_tool", "embed_loaded", "failure", "feedback_down", "feedback_up", "first_chunk", "first_feedback_paint", "first_server_content_paint", "first_text_paint", "message_copied", "message_sent", "opened", "reconnected", "retry", "stopped", "turn_completed", "turn_stalled"];
1416
+ declare const HEROUI_AGENT_EMBED_EVENT_NAMES: readonly ["action_approved", "action_declined", "component_copy", "component_export", "component_followup", "component_rendered", "component_submit", "component_tool", "embed_loaded", "failure", "feedback_down", "feedback_up", "file_download", "first_chunk", "first_feedback_paint", "first_server_content_paint", "first_text_paint", "message_copied", "message_sent", "opened", "reconnected", "retry", "stopped", "turn_completed", "turn_stalled"];
1397
1417
  declare const HEROUI_AGENT_EMBED_EVENT_SOURCES: readonly ["client-inactivity-watchdog", "cloudflare-chat", "message-send-failed", "stream-error"];
1398
1418
  declare const HEROUI_AGENT_FEEDBACK_REASONS: readonly ["did_not_follow_instructions", "incomplete", "incorrect", "not_relevant", "other", "unclear"];
1399
1419
  declare const HEROUI_AGENT_TURN_ERROR_CODES: readonly ["client_stopped", "conversation_deleted", "provider_error", "provider_rate_limited", "provider_timeout", "turn_deadline_exceeded", "turn_stalled", "unknown"];
@@ -1482,8 +1502,11 @@ declare const heroUIAgentEmbedEventPropertiesSchema: z.ZodObject<{
1482
1502
  }>>>;
1483
1503
  format: z.ZodOptional<z.ZodEnum<{
1484
1504
  json: "json";
1505
+ pdf: "pdf";
1506
+ xlsx: "xlsx";
1485
1507
  png: "png";
1486
1508
  csv: "csv";
1509
+ markdown: "markdown";
1487
1510
  text: "text";
1488
1511
  svg: "svg";
1489
1512
  }>>;
@@ -1492,6 +1515,7 @@ declare const heroUIAgentEmbedEventPropertiesSchema: z.ZodObject<{
1492
1515
  latencyMs: z.ZodOptional<z.ZodNumber>;
1493
1516
  latencyOrigin: z.ZodOptional<z.ZodLiteral<"user_submit">>;
1494
1517
  messageId: z.ZodOptional<z.ZodString>;
1518
+ outputBytes: z.ZodOptional<z.ZodNumber>;
1495
1519
  protocolVersion: z.ZodOptional<z.ZodLiteral<6>>;
1496
1520
  sdkVersion: z.ZodOptional<z.ZodString>;
1497
1521
  source: z.ZodOptional<z.ZodEnum<{
@@ -1518,6 +1542,7 @@ declare const heroUIAgentEmbedEventSchema: z.ZodObject<{
1518
1542
  failure: "failure";
1519
1543
  feedback_down: "feedback_down";
1520
1544
  feedback_up: "feedback_up";
1545
+ file_download: "file_download";
1521
1546
  first_chunk: "first_chunk";
1522
1547
  first_feedback_paint: "first_feedback_paint";
1523
1548
  first_server_content_paint: "first_server_content_paint";
@@ -1615,8 +1640,11 @@ declare const heroUIAgentEmbedEventSchema: z.ZodObject<{
1615
1640
  }>>>;
1616
1641
  format: z.ZodOptional<z.ZodEnum<{
1617
1642
  json: "json";
1643
+ pdf: "pdf";
1644
+ xlsx: "xlsx";
1618
1645
  png: "png";
1619
1646
  csv: "csv";
1647
+ markdown: "markdown";
1620
1648
  text: "text";
1621
1649
  svg: "svg";
1622
1650
  }>>;
@@ -1625,6 +1653,7 @@ declare const heroUIAgentEmbedEventSchema: z.ZodObject<{
1625
1653
  latencyMs: z.ZodOptional<z.ZodNumber>;
1626
1654
  latencyOrigin: z.ZodOptional<z.ZodLiteral<"user_submit">>;
1627
1655
  messageId: z.ZodOptional<z.ZodString>;
1656
+ outputBytes: z.ZodOptional<z.ZodNumber>;
1628
1657
  protocolVersion: z.ZodOptional<z.ZodLiteral<6>>;
1629
1658
  sdkVersion: z.ZodOptional<z.ZodString>;
1630
1659
  source: z.ZodOptional<z.ZodEnum<{
@@ -1651,4 +1680,4 @@ type HeroUIAgentEmbedEventName = HeroUIAgentEmbedEvent["event"];
1651
1680
  type HeroUIAgentEmbedEventProperties = z.infer<typeof heroUIAgentEmbedEventPropertiesSchema>;
1652
1681
  type HeroUIAgentTurnErrorCode = z.infer<typeof heroUIAgentTurnErrorCodeSchema>;
1653
1682
 
1654
- export { AGENT_MODEL_IDS, AGENT_MODEL_OPTIONS, AGENT_UI_CATALOG, AGENT_UI_CONTAINER_KINDS, AGENT_UI_KIND_NAMES, AGENT_UI_KIND_SCHEMAS, AGENT_UI_LAYOUT_LEAF_KINDS, AGENT_UI_PRIMITIVE_KINDS, type AccordionComponent, type ActionGroupComponent, type ActionToolCall, type ActionVariant, type AgentActivityPhase, type AgentDataTypes, type AgentIconName, type AgentMessage, type AgentModelId, type AgentModelOption, type AgentModelTier, type AgentRemoteConfig, type AgentRemoteThemeColor, type AgentRuntimeTiming, type AgentRuntimeTimingEventDetail, type AgentSource, type AgentTurnAdmissionStatus, type AgentTurnAdmissionStatusRequest, type AgentTurnAdmissionStatusResponse, type AgentTurnAdmittedFrame, type AgentUIAmount, type AgentUICatalogEntry, type AgentUICatalogGroup, type AgentUIComponent, type AgentUIContainerComponent, type AgentUIImage, type AgentUILayoutLeafComponent, type AgentUILeafComponent, type AgentUINode, type AgentUIPrimitiveComponent, type AgentUIRenderable, type AgentUIRenderableKind, type AnalyticalLeafComponent, type AreaChartComponent, type BadgeComponent, type BarChartComponent, type ButtonComponent, COMPOSED_UI_MAX_DEPTH, COMPOSED_UI_MAX_NODES, type CalloutComponent, type CandlestickChartComponent, type CardComponent, type CardComponentVariant, type CartesianComponent, type CartesianRange, type CartesianSeries, type ChannelMessageComponent, type ChartColor, type ClientToolManifestEntry, type CodeBlockComponent, type ColComponent, type ComparisonListComponent, type ComponentActionSpec, type ComponentBase, type ComposedChartComponent, type ComposedChartSeries, type CreateEventComponent, DEFAULT_AGENT_PICKER_MODEL_ID, type DashboardComponent, type DataTableComponent, type Datum, type DiagramComponent, type DividerComponent, type DonutChartComponent, type EnableNotificationComponent, type EventSessionComponent, type FlightTrackerComponent, type FollowupComponent, type FormComponent, type FormDateRange, type FormField, type FunnelChartComponent, type GaugeChartComponent, type GridComponent, HEROUI_AGENT_API_BASE_URL, HEROUI_AGENT_ATTACHMENT_ACCEPT, HEROUI_AGENT_ATTACHMENT_CONTENT_TYPES, HEROUI_AGENT_ATTACHMENT_EXTENSION_BY_CONTENT_TYPE, HEROUI_AGENT_ATTACHMENT_MAX_BYTES, HEROUI_AGENT_EMBED_EVENT_NAMES, HEROUI_AGENT_EMBED_EVENT_SOURCES, HEROUI_AGENT_FEEDBACK_REASONS, HEROUI_AGENT_MAX_ATTACHMENTS, HEROUI_AGENT_PROTOCOL_VERSION, HEROUI_AGENT_REMOTE_CONFIG_VERSION, HEROUI_AGENT_RUNTIME_TIMING_EVENT, HEROUI_AGENT_SDK_VERSION, HEROUI_AGENT_TEXT_ATTACHMENT_CONTENT_TYPES, HEROUI_AGENT_TURN_ADMISSION_STATUS_MAX_IDS, HEROUI_AGENT_TURN_ADMISSION_STATUS_METHOD, HEROUI_AGENT_TURN_ADMITTED_FRAME_TYPE, HEROUI_AGENT_TURN_ERROR_CODES, type HeadingComponent, type HeatmapComponent, type HeroUIAgentAttachmentContentType, type HeroUIAgentEmbedEvent, type HeroUIAgentEmbedEventName, type HeroUIAgentEmbedEventProperties, type HeroUIAgentTurnErrorCode, type IconComponent, type ImageComponent, type ItemCardComponent, type ItemCardGroupComponent, type ItemCardVariant, type KpiGridComponent, LEGACY_AGENT_MODEL_IDS, type LayoutAlign, type LayoutGap, type LayoutJustify, type LineChartComponent, type ListBlockComponent, type ListComponent, MAX_CLIENT_TOOLS, MAX_CLIENT_TOOLS_BYTES, type MapComponent, type MapCoordinate, type MapLocation, type MapLocationAction, type MeterListComponent, type MeterTone, type MetricGridComponent, type NumberFormat, type PieChartComponent, type PlayerCardComponent, type PlaylistComponent, type ProductCardComponent, type ProductCardItem, type ProductCardPrice, type ProductCardRating, type ProductSignalsComponent, type ProgressComponent, type PurchaseCompleteComponent, type PurchaseItemsComponent, RESERVED_AGENT_TOOL_NAMES, RESERVED_AGENT_TOOL_PREFIX, type RadarChartComponent, type RadialChartComponent, type RatingComponent, type RecordCardComponent, type RecordCardLayout, type RecordCardTone, type RideStatusComponent, type RowComponent, type SankeyChartComponent, type ScatterChartComponent, type SpacerComponent, type StepStatus, type StepsComponent, type SunburstChartComponent, type SunburstNode, type SwitchGroupComponent, type TabsComponent, type TagListComponent, type TextComponent, type ToggleGroupComponent, type ViewEventComponent, type WeatherCondition, type WeatherCurrentComponent, type WeatherForecastComponent, type WeatherUnit, accordionComponentSchema, actionGroupComponentSchema, agentIconNames, agentIconSchema, agentModelIdSchema, agentSourceSchema, agentSourcesSchema, agentUIComponentSchema, agentUILeafComponentSchema, agentUINodeSchema, agentUIRenderableSchema, analyticalLeafComponentSchema, areaChartComponentSchema, badgeComponentSchema, barChartComponentSchema, buttonComponentSchema, calloutComponentSchema, candlestickChartComponentSchema, cardComponentSchema, cardComponentVariantSchema, channelMessageComponentSchema, chartColorSchema, clientToolManifestEntrySchema, clientToolsSchema, codeBlockComponentSchema, colComponentSchema, comparisonListComponentSchema, composeUIInputSchema, composedChartComponentSchema, composedUIComponentSchema, createEventComponentSchema, dashboardComponentSchema, dataTableComponentSchema, diagramComponentSchema, dividerComponentSchema, donutChartComponentSchema, enableNotificationComponentSchema, eventSessionComponentSchema, flightTrackerComponentSchema, followupComponentSchema, formComponentSchema, funnelChartComponentSchema, gaugeChartComponentSchema, getAgentModelTier, getAgentUIContainerChildren, gridComponentSchema, headingComponentSchema, heatmapComponentSchema, heroUIAgentEmbedEventPropertiesSchema, heroUIAgentEmbedEventSchema, heroUIAgentTurnErrorCodeSchema, iconComponentSchema, imageComponentSchema, isAgentModelId, isAgentUIContainerComponent, isAgentUILayoutLeafComponent, isAgentUIPrimitiveComponent, isHeroUIAgentAttachmentContentType, itemCardComponentSchema, itemCardGroupComponentSchema, kpiGridComponentSchema, lineChartComponentSchema, listBlockComponentSchema, listComponentSchema, mapComponentSchema, meterListComponentSchema, metricGridComponentSchema, numberFormatSchema, parseAgentRemoteConfig, pieChartComponentSchema, playerCardComponentSchema, playlistComponentSchema, productCardComponentSchema, productSignalsComponentSchema, progressComponentSchema, purchaseCompleteComponentSchema, purchaseItemsComponentSchema, radarChartComponentSchema, radialChartComponentSchema, ratingComponentSchema, recordCardComponentSchema, recordCardLayoutSchema, renderAgentUICatalogPrompt, renderComponentInputSchema, resolveAgentModelId, rideStatusComponentSchema, rowComponentSchema, sankeyChartComponentSchema, scatterChartComponentSchema, spacerComponentSchema, stepsComponentSchema, sunburstChartComponentSchema, switchGroupComponentSchema, tabsComponentSchema, tagListComponentSchema, textComponentSchema, toggleGroupComponentSchema, viewEventComponentSchema, weatherConditionSchema, weatherConditions, weatherCurrentComponentSchema, weatherForecastComponentSchema };
1683
+ export { AGENT_MODEL_IDS, AGENT_MODEL_OPTIONS, AGENT_UI_CATALOG, AGENT_UI_CONTAINER_KINDS, AGENT_UI_KIND_NAMES, AGENT_UI_KIND_SCHEMAS, AGENT_UI_LAYOUT_LEAF_KINDS, AGENT_UI_PRIMITIVE_KINDS, type AccordionComponent, type ActionGroupComponent, type ActionToolCall, type ActionVariant, type AgentActivityPhase, type AgentDataTypes, type AgentIconName, type AgentMessage, type AgentModelId, type AgentModelOption, type AgentModelTier, type AgentRemoteConfig, type AgentRemoteThemeColor, type AgentRuntimeTiming, type AgentRuntimeTimingEventDetail, type AgentSource, type AgentTurnAdmissionStatus, type AgentTurnAdmissionStatusRequest, type AgentTurnAdmissionStatusResponse, type AgentTurnAdmittedFrame, type AgentUIAmount, type AgentUICatalogEntry, type AgentUICatalogGroup, type AgentUIComponent, type AgentUIContainerComponent, type AgentUIImage, type AgentUILayoutLeafComponent, type AgentUILeafComponent, type AgentUINode, type AgentUIPrimitiveComponent, type AgentUIRenderable, type AgentUIRenderableKind, type AnalyticalLeafComponent, type AreaChartComponent, type BadgeComponent, type BarChartComponent, type ButtonComponent, COMPOSED_UI_MAX_DEPTH, COMPOSED_UI_MAX_NODES, type CalloutComponent, type CandlestickChartComponent, type CardComponent, type CardComponentVariant, type CartesianComponent, type CartesianRange, type CartesianSeries, type ChannelMessageComponent, type ChartColor, type ClientToolManifestEntry, type CodeBlockComponent, type ColComponent, type ComparisonListComponent, type ComponentActionSpec, type ComponentBase, type ComposedChartComponent, type ComposedChartSeries, type CreateEventComponent, DEFAULT_AGENT_PICKER_MODEL_ID, type DashboardComponent, type DataTableComponent, type Datum, type DiagramComponent, type DividerComponent, type DonutChartComponent, type EnableNotificationComponent, type EventSessionComponent, type FlightTrackerComponent, type FollowupComponent, type FormComponent, type FormDateRange, type FormField, type FunnelChartComponent, type GaugeChartComponent, type GridComponent, HEROUI_AGENT_API_BASE_URL, HEROUI_AGENT_ATTACHMENT_ACCEPT, HEROUI_AGENT_ATTACHMENT_CONTENT_TYPES, HEROUI_AGENT_ATTACHMENT_CONTENT_TYPE_BY_EXTENSION, HEROUI_AGENT_ATTACHMENT_EXTENSION_BY_CONTENT_TYPE, HEROUI_AGENT_ATTACHMENT_MAX_BYTES, HEROUI_AGENT_EMBED_EVENT_NAMES, HEROUI_AGENT_EMBED_EVENT_SOURCES, HEROUI_AGENT_FEEDBACK_REASONS, HEROUI_AGENT_MAX_ATTACHMENTS, HEROUI_AGENT_PROTOCOL_VERSION, HEROUI_AGENT_REMOTE_CONFIG_VERSION, HEROUI_AGENT_RUNTIME_TIMING_EVENT, HEROUI_AGENT_SDK_VERSION, HEROUI_AGENT_TEXT_ATTACHMENT_CONTENT_TYPES, HEROUI_AGENT_TURN_ADMISSION_STATUS_MAX_IDS, HEROUI_AGENT_TURN_ADMISSION_STATUS_METHOD, HEROUI_AGENT_TURN_ADMITTED_FRAME_TYPE, HEROUI_AGENT_TURN_ERROR_CODES, type HeadingComponent, type HeatmapComponent, type HeroUIAgentAttachmentContentType, type HeroUIAgentEmbedEvent, type HeroUIAgentEmbedEventName, type HeroUIAgentEmbedEventProperties, type HeroUIAgentTurnErrorCode, type IconComponent, type ImageComponent, type ItemCardComponent, type ItemCardGroupComponent, type ItemCardVariant, type KpiGridComponent, LEGACY_AGENT_MODEL_IDS, type LayoutAlign, type LayoutGap, type LayoutJustify, type LineChartComponent, type ListBlockComponent, type ListComponent, MAX_CLIENT_TOOLS, MAX_CLIENT_TOOLS_BYTES, type MapComponent, type MapCoordinate, type MapLocation, type MapLocationAction, type MeterListComponent, type MeterTone, type MetricGridComponent, type NumberFormat, type PieChartComponent, type PlayerCardComponent, type PlaylistComponent, type ProductCardComponent, type ProductCardItem, type ProductCardPrice, type ProductCardRating, type ProductSignalsComponent, type ProgressComponent, type PurchaseCompleteComponent, type PurchaseItemsComponent, RESERVED_AGENT_TOOL_NAMES, RESERVED_AGENT_TOOL_PREFIX, type RadarChartComponent, type RadialChartComponent, type RatingComponent, type RecordCardComponent, type RecordCardLayout, type RecordCardTone, type RideStatusComponent, type RowComponent, type SankeyChartComponent, type ScatterChartComponent, type SpacerComponent, type StepStatus, type StepsComponent, type SunburstChartComponent, type SunburstNode, type SwitchGroupComponent, type TabsComponent, type TagListComponent, type TextComponent, type ToggleGroupComponent, type ViewEventComponent, type WeatherCondition, type WeatherCurrentComponent, type WeatherForecastComponent, type WeatherUnit, accordionComponentSchema, actionGroupComponentSchema, agentIconNames, agentIconSchema, agentModelIdSchema, agentSourceSchema, agentSourcesSchema, agentUIComponentSchema, agentUILeafComponentSchema, agentUINodeSchema, agentUIRenderableSchema, analyticalLeafComponentSchema, areaChartComponentSchema, badgeComponentSchema, barChartComponentSchema, buttonComponentSchema, calloutComponentSchema, candlestickChartComponentSchema, cardComponentSchema, cardComponentVariantSchema, channelMessageComponentSchema, chartColorSchema, clientToolManifestEntrySchema, clientToolsSchema, codeBlockComponentSchema, colComponentSchema, comparisonListComponentSchema, composeUIInputSchema, composedChartComponentSchema, composedUIComponentSchema, createEventComponentSchema, dashboardComponentSchema, dataTableComponentSchema, diagramComponentSchema, dividerComponentSchema, donutChartComponentSchema, enableNotificationComponentSchema, eventSessionComponentSchema, flightTrackerComponentSchema, followupComponentSchema, formComponentSchema, funnelChartComponentSchema, gaugeChartComponentSchema, getAgentModelTier, getAgentUIContainerChildren, gridComponentSchema, headingComponentSchema, heatmapComponentSchema, heroUIAgentEmbedEventPropertiesSchema, heroUIAgentEmbedEventSchema, heroUIAgentTurnErrorCodeSchema, iconComponentSchema, imageComponentSchema, isAgentModelId, isAgentUIContainerComponent, isAgentUILayoutLeafComponent, isAgentUIPrimitiveComponent, isHeroUIAgentAttachmentContentType, itemCardComponentSchema, itemCardGroupComponentSchema, kpiGridComponentSchema, lineChartComponentSchema, listBlockComponentSchema, listComponentSchema, mapComponentSchema, meterListComponentSchema, metricGridComponentSchema, numberFormatSchema, parseAgentRemoteConfig, pieChartComponentSchema, playerCardComponentSchema, playlistComponentSchema, productCardComponentSchema, productSignalsComponentSchema, progressComponentSchema, purchaseCompleteComponentSchema, purchaseItemsComponentSchema, radarChartComponentSchema, radialChartComponentSchema, ratingComponentSchema, recordCardComponentSchema, recordCardLayoutSchema, renderAgentUICatalogPrompt, renderComponentInputSchema, resolveAgentModelId, resolveHeroUIAgentAttachmentContentType, rideStatusComponentSchema, rowComponentSchema, sankeyChartComponentSchema, scatterChartComponentSchema, spacerComponentSchema, stepsComponentSchema, sunburstChartComponentSchema, switchGroupComponentSchema, tabsComponentSchema, tagListComponentSchema, textComponentSchema, toggleGroupComponentSchema, viewEventComponentSchema, weatherConditionSchema, weatherConditions, weatherCurrentComponentSchema, weatherForecastComponentSchema };