@heroui/agent 0.2.0-beta.9 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +3 -3
  3. package/dist/chart-content-YGW25P3Z.js +1 -0
  4. package/dist/chunk-4JEZZR5J.js +1 -0
  5. package/dist/{chunk-BBB5EHDN.js → chunk-7CUSOLDM.js} +1 -1
  6. package/dist/chunk-CLHBM3HQ.js +1 -0
  7. package/dist/chunk-CN4UQBKO.js +2 -0
  8. package/dist/chunk-FOK4MNBE.js +2 -0
  9. package/dist/chunk-KQTLIOZ3.js +1 -0
  10. package/dist/chunk-M22IGTLZ.js +1 -0
  11. package/dist/chunk-MXXCR5SR.js +1 -0
  12. package/dist/chunk-OA7E6MEQ.js +1 -0
  13. package/dist/chunk-UHHKMESI.js +1 -0
  14. package/dist/component-renderer-KWBZJPBV.js +1 -0
  15. package/dist/contracts.d.ts +279 -9
  16. package/dist/contracts.js +2 -2
  17. package/dist/css/index.css +1 -1
  18. package/dist/embed-runtime-CLCMDESV.js +5 -0
  19. package/dist/{identity-3P8-17km.d.ts → identity-CAJPsGqJ.d.ts} +8 -2
  20. package/dist/index.d.ts +40 -7
  21. package/dist/index.js +1 -1
  22. package/dist/internal/models.js +1 -1
  23. package/dist/internal/theme.js +1 -1
  24. package/dist/model-picker-BSJRGXGB.js +1 -0
  25. package/dist/next.d.ts +1 -1
  26. package/dist/next.js +1 -1
  27. package/dist/server.d.ts +1 -1
  28. package/dist/server.js +1 -1
  29. package/dist/shell-permission-picker-KIC3VEYJ.js +1 -0
  30. package/package.json +7 -6
  31. package/dist/chart-content-BBHQVMP4.js +0 -1
  32. package/dist/chunk-2XBFFSW2.js +0 -1
  33. package/dist/chunk-MXLGM4WV.js +0 -1
  34. package/dist/chunk-OA3TG5CS.js +0 -1
  35. package/dist/chunk-S6OIAJSC.js +0 -1
  36. package/dist/chunk-SUDHJNTJ.js +0 -2
  37. package/dist/chunk-WUAFMD7Z.js +0 -2
  38. package/dist/component-renderer-GG6JVRUG.js +0 -1
  39. package/dist/embed-runtime-GYXK7V6N.js +0 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,70 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ - Keep the built-in Agent palette isolated from generic host variables such as
6
+ `--background` and `--foreground`, which may contain framework-specific color
7
+ channels rather than valid CSS colors and previously made panels transparent.
8
+ - Scope Glass and Mouve effects to an explicitly themed Agent root so similarly
9
+ named classes in the host application cannot restyle the embed.
10
+ - Add `appearance.zIndex` for applications that need the Agent below their own
11
+ dialogs or above unusually high application chrome.
12
+ - Use a default Agent layer of `40`, below HeroUI overlays at `50`, and keep
13
+ internal Agent layers relative to that host stacking context.
14
+ - Expose `--ha-z-index`, `--ha-panel-z-index`, `--ha-launcher-z-index`,
15
+ `--ha-popover-z-index`, `--ha-modal-z-index`, and `--ha-overlay-z-index` for
16
+ CSS-level control of the Agent layer scale.
17
+
18
+ ## 0.2.0-beta.17
19
+
20
+ - Publish prereleases with `--tag latest` so `npm i @heroui/agent` gets this
21
+ version. OIDC trusted publishing cannot `dist-tag add` (E401 on 0.2.0-beta.16).
22
+
23
+ ## 0.2.0-beta.16
24
+
25
+ - Move conversation shimmers to the GPU with a mask and translate animation;
26
+ reduced-motion keeps readable contrast instead of leaving the shimmer at low
27
+ opacity (#1020).
28
+
29
+ ## 0.2.0-beta.15
30
+
31
+ - Add `appearance.shouldCloseOnInteractOutside` for floating panels: omitted or
32
+ `true` closes on outside click; `false` or a predicate that returns false keeps
33
+ the panel open. Type is `boolean | ((element: Element) => boolean)`, matching
34
+ React Aria (#997).
35
+ - Add optional `showBetaBadge` to render a compact Beta chip in the open panel
36
+ header, including when set from the project's remote appearance configuration
37
+ (#994).
38
+ - Move optional runtime libraries (including `mermaid`, `maplibre-gl`, `motion`,
39
+ `shiki`, `recharts`, and related HeroUI packages) from peer dependencies into
40
+ `@heroui/agent` dependencies so `npm i @heroui/agent@beta` installs the full
41
+ graph. React and React DOM remain the only peer dependencies hosts must
42
+ provide. Renderers still load heavy libraries on demand and do not bundle them
43
+ into the published JavaScript (#993).
44
+
45
+ ## 0.2.0-beta.14
46
+
47
+ - Restore user-message bubbles to `--ha-surface` / `--ha-fg`, reverting the accent bubble from
48
+ `0.2.0-beta.13` / #949 (#959).
49
+
50
+ ## 0.2.0-beta.13
51
+
52
+ - Apply the configured Design System accent across Agent controls, generated UI, focus states,
53
+ launchers, and user-message bubbles, including when a Pro design theme is active.
54
+ - Keep the host page scrollable when the Agent is open as a floating desktop panel while
55
+ preserving modal scroll locking on mobile and expanded sidebars.
56
+
57
+ ## 0.2.0-beta.12
58
+
59
+ - Default the Agent API origin to `https://api.heroui.pro` so embeds and `createAuthToken` reach
60
+ production without an `_api.baseUrl` override.
61
+ - Default the Agent model picker to Gemini 3.7 Flash, and keep retired Gemini 3.5/3.6 Flash ids
62
+ resolving to it.
63
+ - Sanitize generated HTML and SVG markup with DOMPurify before rendering, and keep the sanitizer
64
+ external to the published bundle.
65
+ - Preserve suggested-prompt titles on first-turn submission instead of replacing them with a
66
+ generated conversation title.
67
+
3
68
  ## 0.2.0-beta.9
4
69
 
5
70
  - Reduce the published JavaScript footprint while preserving ESM code splitting, lazy UI tiers,
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # HeroUI Agents SDK
4
4
 
5
- Embed a hosted generative-UI agent in your React app with [`@heroui/agent`](https://www.heroui.com/agents). Declare typed client tools that read your data — the hosted runtime plans the answer, runs calculations in a sandbox, and streams back charts, tables, and metrics.
5
+ Embed a hosted generative-UI agent in your React app with [`@heroui/agent`](https://heroui.pro/agents). Declare typed client tools that read your data — the hosted runtime plans the answer, runs calculations in a sandbox, and streams back charts, tables, and metrics.
6
6
 
7
7
  ## Installation
8
8
 
@@ -83,7 +83,7 @@ The core React SDK for embedding a hosted agent.
83
83
 
84
84
  - **Generative UI** — Charts, tables, metrics, and forms streamed from a validated component union
85
85
  - **Client tools** — Typed browser functions that run with the signed-in user's session
86
- - **Dashboard-driven appearance** — Theme, launcher, greeting, and composer without a redeploy
86
+ - **Dashboard-driven appearance** — Theme, launcher, greeting, subtitle, and composer without a redeploy
87
87
  - **Anonymous → identified** — Merge guest history when the user signs in
88
88
  - **Edge-safe contracts** — Protocol types with no Node built-ins
89
89
 
@@ -202,7 +202,7 @@ This SDK speaks protocol version `6`. The hosted API returns `426 Upgrade Requir
202
202
  ## Support
203
203
 
204
204
  - [Documentation](https://heroui.pro/docs/agent)
205
- - [Agents product](https://www.heroui.com/agents)
205
+ - [Agents product](https://heroui.pro/agents)
206
206
  - [Issues](https://github.com/heroui-inc/heroui-platform/issues)
207
207
  - [Discord](https://discord.gg/9b6yyZKmH4)
208
208
 
@@ -0,0 +1 @@
1
+ "use client";import{a as Me,c as W,d as _,e as ce,i as j,j as Ke,l as L,m as Ne}from"./chunk-7CUSOLDM.js";import{c as U}from"./chunk-KQTLIOZ3.js";import"./chunk-MXXCR5SR.js";import{a as J}from"./chunk-CR3H7AVI.js";import{useId as qe,useMemo as ae,useState as X}from"react";import{Area as Ue,Bar as je,CartesianGrid as Je,Cell as At,Label as Nt,Line as Ze,Pie as St,PolarAngleAxis as Qe,PolarGrid as kt,PolarRadiusAxis as wt,Radar as _t,RadialBar as Rt,AreaChart as $t,BarChart as Mt,ComposedChart as Kt,LineChart as Lt,PieChart as Pt,RadarChart as Tt,RadialBarChart as Gt,ScatterChart as It,ReferenceLine as Et,ResponsiveContainer as oe,Sankey as Vt,Scatter as Bt,Tooltip as ue,XAxis as Re,YAxis as be,ZAxis as Dt}from"recharts";import{createContext as at,useCallback as rt,useContext as nt,useMemo as it,useState as st}from"react";import{jsx as he,jsxs as lt}from"react/jsx-runtime";var Le=at(null);function Se({children:t,className:e,defaultSelectedKey:r,isDisabled:i=!1,onSelectionChange:n,selectedKey:s,size:h="md",variant:g="default",...m}){let[o,d]=st(r),u=s??o,p=rt(v=>{i||v===u||(s===void 0&&d(v),n?.(v))},[u,i,n,s]),k=it(()=>({isDisabled:i,select:p,selectedKey:u}),[u,i,p]);return he(Le,{value:k,children:he("div",{className:J("aui-segment",e),"data-disabled":i||void 0,"data-size":h,"data-slot":"agent-ui-segment","data-variant":g,role:"group",...m,children:t})})}function Pe({children:t,className:e,disabled:r,id:i,onClick:n,...s}){let h=nt(Le);if(!h)throw new Error("Segment.Item must be rendered inside Segment.");let g=h.isDisabled||r,m=h.selectedKey===i;return lt("button",{"aria-pressed":m,className:J("aui-segment__item",e),"data-selected":m,"data-slot":"agent-ui-segment-item",disabled:g,type:"button",onClick:o=>{n?.(o),o.defaultPrevented||h.select(i)},...s,children:[he("span",{"aria-hidden":"true",className:"aui-segment__indicator"}),he("span",{className:"aui-segment__label",children:t})]})}function Te({className:t,...e}){return he("span",{"aria-hidden":"true",className:J("aui-segment__separator",t),"data-slot":"agent-ui-segment-separator",...e})}var ke=Object.assign(Se,{Item:Pe,Root:Se,Separator:Te});var ot=[4,4,4,4],ut=[4,0,0,4],Ge=[0,0,0,0],Ie=[0,4,4,0],Ee=[4,4,0,0];function we({dataKey:t,horizontal:e,stacked:r,visibleStackKeys:i}){if(!r)return e?Ie:Ee;let n=i.indexOf(t);return n<0?Ge:e&&i.length===1?ot:e&&n===0?ut:e&&n===i.length-1?Ie:!e&&n===i.length-1?Ee:Ge}function Ve(t,{height:e,margins:r,width:i}){if(t.length===0||!mt(i,e,r)||!t.every(bt))return null;let n={bottom:e-r.bottom,height:e-r.top-r.bottom,left:r.left,right:i-r.right,top:r.top,width:i-r.left-r.right};if(n.width<1||n.height<1)return null;let s=Math.min(...t.map(c=>c.low)),h=Math.max(...t.map(c=>c.high)),g=ct(s,h);if(!g)return null;let m=ht(g[0],g[1]),o=[m[0],m.at(-1)],d=o[1]-o[0];if(!Number.isFinite(d)||d<=0)return null;let u=c=>n.top+(o[1]-c)/d*n.height,p=n.width/t.length,k=Math.max(1,Math.min(14,p*.62)),v=t.map((c,y)=>{let A=n.left+p*(y+.5),$=u(c.open),w=u(c.close),S=($+w)/2,f=Math.max(1,Math.abs(w-$)),M=dt(S-f/2,n.top,n.bottom-f);return{body:{height:f,width:k,x:A-k/2,y:M},direction:c.close>c.open?"up":c.close<c.open?"down":"flat",index:y,label:c.label,wick:{bottom:u(c.low),top:u(c.high),x:A},x:A}});return{bounds:n,candles:v,xLabelIndices:gt(t.length,n.width),yDomain:o,yTicks:m.map(c=>({value:c,y:u(c)}))}}function dt(t,e,r){return Math.min(Math.max(t,e),r)}function _e(t){let e=Number(t.toPrecision(12));return Object.is(e,-0)?0:e}function ct(t,e){if(e>t)return[t,e];let r=t===0?1:Math.abs(t)*.05,i=t-r,n=e+r;return Number.isFinite(i)&&Number.isFinite(n)&&n>i?[i,n]:null}function ht(t,e){let r=e-t,i=r/4,n=Math.floor(Math.log10(i)),s=[],h=new Set;for(let g=n-2;g<=n+2;g+=1)for(let m of[1,2,2.5,5,10]){let o=_e(m*10**g);if(!Number.isFinite(o)||o<=0||h.has(o))continue;h.add(o);let d=Math.floor(t/o)*o,u=Math.ceil(e/o)*o,p=Math.round((u-d)/o)+1;if(p<4||p>6)continue;let k=Array.from({length:p},(y,A)=>_e(d+A*o)),v=Math.max(0,u-d-r)/r,c=Math.abs(p-5)*100+v+Math.abs(Math.log10(o/i))*.01;s.push({score:c,ticks:k})}return s.sort((g,m)=>g.score-m.score),s[0]?.ticks??Array.from({length:5},(g,m)=>_e(t+r*m/4))}function gt(t,e){if(t===1)return[0];let r=Math.min(t,6,Math.max(2,Math.floor(e/72)+1));return r===t?Array.from({length:t},(i,n)=>n):Array.from({length:r},(i,n)=>Math.round(n*(t-1)/(r-1)))}function mt(t,e,r){return Number.isFinite(t)&&t>0&&Number.isFinite(e)&&e>0&&Object.values(r).every(i=>Number.isFinite(i)&&i>=0)}function bt(t){return[t.open,t.high,t.low,t.close].every(Number.isFinite)&&t.high>=Math.max(t.open,t.close,t.low)&&t.low<=Math.min(t.open,t.close,t.high)}function Be(t,e,r){if(![t,e,r].every(Number.isFinite)||e===r)return 0;let i=(t-e)/(r-e);return Math.min(1,Math.max(0,i))}function De(t){let{centerX:e,centerY:r,count:i,endAngle:n=405,height:s,max:h,min:g,notchLength:m,notchWidth:o,padding:d=0,radius:u,startAngle:p=135,value:k,width:v}=t;if(!Oe(v,s)||!He(i)||!ft(e,r,m,o,u)||![n,d,p].every(Number.isFinite)||d<0||m!==void 0&&m<=0||o!==void 0&&o<=0||u!==void 0&&u<=0)return null;let c=e??v/2,y=r??s/2;if(c<0||c>v||y<0||y>s)return null;let A=Math.min(c,v-c,y,s-y)-d;if(A<=0)return null;let $=Math.min(u??A,A),w=Math.min(m??Math.max(2,$*.16),$),S=Math.min(o??Math.max(1,$*.035),$*2);if(w<=0||S<=0)return null;let f=ie(c,y),M=Be(k,g,h),b=Array.from({length:i},(I,F)=>{let V=i===1?.5:F/(i-1),x=(F+1)/i,K=p+(n-p)*V,G=K*Math.PI/180,P=Math.cos(G),B=Math.sin(G),R=-B,E=P,H=$-w,T=S/2,D=ie(c+P*H,y+B*H),Y=ie(c+P*$,y+B*$),ne=ie(D.x-R*T,D.y-E*T),ee=ie(Y.x-R*T,Y.y-E*T),xe=ie(Y.x+R*T,Y.y+E*T),le=ie(D.x+R*T,D.y+E*T);return{active:M>=x,angle:O(K,1e6),index:F,inner:D,outer:Y,path:`M ${me(ne)} L ${me(ee)} L ${me(xe)} L ${me(le)} Z`,position:O(V,1e6),threshold:O(x,1e6)}});return{center:f,notchLength:O(w),notchWidth:O(S),notches:b,progress:M,radius:O($)}}function Fe(t){let{count:e,gap:r=2,height:i,inset:n=0,max:s,min:h,orientation:g="horizontal",value:m,width:o}=t;if(!Oe(o,i)||!He(e)||![r,n].every(Number.isFinite)||r<0||n<0)return null;let d=i-n*2,u=o-n*2;if(d<=0||u<=0)return null;let v=((g==="horizontal"?u:d)-r*(e-1))/e;if(!Number.isFinite(v)||v<=0)return null;let c=Be(m,h,s);return{notches:Array.from({length:e},(A,$)=>{let w=($+1)/e;return g==="horizontal"?{active:c>=w,height:O(d),index:$,threshold:O(w,1e6),width:O(v),x:O(n+$*(v+r)),y:O(n)}:{active:c>=w,height:O(v),index:$,threshold:O(w,1e6),width:O(u),x:O(n),y:O(i-n-v-$*(v+r))}}),orientation:g,progress:c}}function ft(...t){return t.every(e=>e===void 0||Number.isFinite(e))}function ie(t,e){return{x:O(t),y:O(e)}}function me(t){return`${t.x} ${t.y}`}function O(t,e=1e3){let r=Math.round(t*e)/e;return Object.is(r,-0)?0:r}function Oe(t,e){return[t,e].every(Number.isFinite)&&t>0&&e>0}function He(t){return Number.isInteger(t)&&t>=1&&t<=512}function Ye(t,e){if(!t)return[];let r=We(t,new Set),i=se(e.innerRadius,0),n=se(e.outerRadius,0),s=xt(e.maxDepth),h=se(e.startAngle,-90),g=se(e.endAngle,h+360),m=Math.min(g-h,360);if(!r||r.value<=0||s===0||i<0||n<=i||m<=1e-6)return[];let o=ze(r.children,1,s);if(o===0)return[];let d={arcs:[],centerX:se(e.centerX,0),centerY:se(e.centerY,0),gapAngle:Math.max(0,se(e.gapAngle,0)),innerRadius:i,maxDepth:s,ringWidth:(n-i)/o};return Xe(r.children,h,h+m,1,[r.id],d),d.arcs}function We(t,e){if(e.has(t))return null;e.add(t);let r=Array.isArray(t.children)?t.children:[],i=r.map(s=>We(s,e)).filter(s=>s!==null);e.delete(t);let n=r.length>0?i.reduce((s,h)=>s+h.value,0):Ct(t.value);return{children:i,id:t.id,label:t.label,value:n}}function ze(t,e,r){if(e>r)return 0;let i=0;for(let n of t)n.value<=0||(i=Math.max(i,e),e<r&&(i=Math.max(i,ze(n.children,e+1,r))));return i}function Xe(t,e,r,i,n,s){if(i>s.maxDepth)return;let h=t.filter(o=>o.value>0),g=h.reduce((o,d)=>o+d.value,0);if(g<=0)return;let m=e;for(let[o,d]of h.entries()){let u=o===h.length-1?r:m+(r-e)*d.value/g,[p,k]=yt(m,u,s.gapAngle),v=s.innerRadius+(i-1)*s.ringWidth,c=v+s.ringWidth,y=[...n,d.id];s.arcs.push({d:pt({centerX:s.centerX,centerY:s.centerY,endAngle:k,innerRadius:v,outerRadius:c,startAngle:p}),depth:i,endAngle:k,id:d.id,innerRadius:v,label:d.label,outerRadius:c,path:y,startAngle:p,value:d.value}),Xe(d.children,m,u,i+1,y,s),m=u}}function yt(t,e,r){let i=e-t,n=Math.min(r,Math.max(0,i-1e-6));return[t+n/2,e-n/2]}function pt(t){let e=t.endAngle-t.startAngle;if(e>=360-1e-6)return vt(t);let r=te(t,t.outerRadius,t.startAngle),i=te(t,t.outerRadius,t.endAngle),n=e>180?1:0,s=`M ${q(r)} A ${z(t.outerRadius)} ${z(t.outerRadius)} 0 ${n} 1 ${q(i)}`;if(t.innerRadius<=0)return`${s} L ${z(t.centerX)} ${z(t.centerY)} Z`;let h=te(t,t.innerRadius,t.endAngle),g=te(t,t.innerRadius,t.startAngle);return`${s} L ${q(h)} A ${z(t.innerRadius)} ${z(t.innerRadius)} 0 ${n} 0 ${q(g)} Z`}function vt(t){let e=t.startAngle+180,r=te(t,t.outerRadius,t.startAngle),i=te(t,t.outerRadius,e),n=`M ${q(r)} A ${z(t.outerRadius)} ${z(t.outerRadius)} 0 0 1 ${q(i)} A ${z(t.outerRadius)} ${z(t.outerRadius)} 0 0 1 ${q(r)}`;if(t.innerRadius<=0)return`${n} Z`;let s=te(t,t.innerRadius,t.startAngle),h=te(t,t.innerRadius,e);return`${n} L ${q(s)} A ${z(t.innerRadius)} ${z(t.innerRadius)} 0 0 0 ${q(h)} A ${z(t.innerRadius)} ${z(t.innerRadius)} 0 0 0 ${q(s)} Z`}function te(t,e,r){let i=r*Math.PI/180;return{x:t.centerX+Math.cos(i)*e,y:t.centerY+Math.sin(i)*e}}function q(t){return`${z(t.x)} ${z(t.y)}`}function z(t){let e=Math.round(t*1e6)/1e6;return String(Object.is(e,-0)?0:e)}function se(t,e){return typeof t=="number"&&Number.isFinite(t)?t:e}function Ct(t){return typeof t=="number"&&Number.isFinite(t)&&t>0?t:0}function xt(t){return t===void 0||t===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:Number.isFinite(t)?Math.max(0,Math.floor(t)):0}import{Fragment as fe,jsx as a,jsxs as C}from"react/jsx-runtime";function ye(t,e,r){return r<1?null:t==="Home"?0:t==="End"?r-1:t==="ArrowRight"||t==="ArrowDown"?(e+1)%r:t==="ArrowLeft"||t==="ArrowUp"?(e-1+r)%r:null}function pe(t,e,r){let n=t.currentTarget.ownerSVGElement?.querySelectorAll(`[data-slot="${e}"]`)?.item(r);n&&typeof n.focus=="function"&&n.focus()}function Q({activeKeys:t,ariaLabel:e,items:r,onToggle:i}){let n=i!=null&&r.length>1,s=r.some(h=>h.value!=null);return a("div",{"aria-label":e,className:J("aui-legend",s?"aui-legend--values":void 0),"data-slot":"agent-ui-chart-legend",role:n?"group":"list",children:r.map(h=>{let g=C(fe,{children:[a("span",{className:"aui-legend__dot","data-slot":"agent-ui-chart-legend-indicator",style:{backgroundColor:h.color}}),a("span",{className:"aui-legend__label",children:h.label}),h.value!=null?a("span",{className:"aui-legend__value",children:h.value}):null]});return n?a("button",{"aria-pressed":t?.has(h.id)??!0,className:"aui-legend__button","data-slot":"agent-ui-chart-legend-item",type:"button",onClick:()=>i(h.id),children:g},h.id):a("span",{className:"aui-legend__item","data-slot":"agent-ui-chart-legend-item",role:"listitem",children:g},h.id)})})}function et({className:t,id:e,items:r,label:i,placement:n,style:s,visuallyHiddenFromAssistiveTechnology:h}){return C("div",{"aria-hidden":h||void 0,className:J("aui-chart-tooltip",t),"data-placement":n,"data-slot":"agent-ui-chart-tooltip",id:e,role:"tooltip",style:s,children:[i!==void 0&&i!==""?a("div",{className:"aui-chart-tooltip__header","data-slot":"agent-ui-chart-tooltip-header",children:i}):null,r.map(g=>C("div",{className:"aui-chart-tooltip__item","data-slot":"agent-ui-chart-tooltip-item",children:[a("span",{className:"aui-chart-tooltip__indicator","data-slot":"agent-ui-chart-tooltip-indicator",style:{backgroundColor:g.color}}),a("span",{className:"aui-chart-tooltip__label","data-slot":"agent-ui-chart-tooltip-label",children:g.label}),a("span",{className:"aui-chart-tooltip__value","data-slot":"agent-ui-chart-tooltip-value",children:g.value})]},g.id))]})}function de({active:t,indicatorColor:e,label:r,payload:i,series:n}){return!t||!i?.length?null:a(et,{label:r,items:i.map((s,h)=>{let g=n?.find(m=>m.dataKey===s.dataKey)?.format;return{color:e?.(s,h)??s.color??s.payload?.fill??s.fill??s.stroke??Ne(h),id:String(s.dataKey??s.name??`series-${h}`),label:s.name??s.dataKey,value:typeof s.value=="number"?_(s.value,g):s.value}})})}function ve({state:t}){return t?a(et,{visuallyHiddenFromAssistiveTechnology:!0,className:"aui-chart-tooltip--floating",items:t.items,label:t.label,placement:t.placement,style:{left:t.anchorX,top:t.anchorY}}):null}function re(t,e,r){let i=t.currentTarget.ownerSVGElement,n=i?.parentElement;if(!i||!n)return{...r,anchorX:0,anchorY:0,placement:"bottom"};let s=n.getBoundingClientRect(),h=s.width/2,g=s.height/2,m=typeof i.getScreenCTM=="function"?i.getScreenCTM():null;if(m)h=m.a*e.x+m.c*e.y+m.e-s.left,g=m.b*e.x+m.d*e.y+m.f-s.top;else{let d=i.getBoundingClientRect(),u=i.getAttribute("viewBox")?.trim().split(/[ ,]+/).map(Number);if(u?.length===4&&u.every(Number.isFinite)&&u[2]>0&&u[3]>0&&d.width>0&&d.height>0){let p=Math.min(d.width/u[2],d.height/u[3]),k=u[2]*p,v=u[3]*p;h=d.left-s.left+(d.width-k)/2+(e.x-u[0])*p,g=d.top-s.top+(d.height-v)/2+(e.y-u[1])*p}}let o=Math.min(95,s.width/2);return h=Math.min(Math.max(h,o),Math.max(o,s.width-o)),g=Math.min(Math.max(g,0),s.height),{...r,anchorX:h,anchorY:g,placement:g<92?"bottom":"top"}}function Ft({color:t,cx:e,cy:r,index:i,lastIndex:n}){return i!==n||e===void 0||r===void 0?null:C("g",{"aria-hidden":"true","data-slot":"agent-ui-chart-live-point",children:[a("circle",{className:"aui-chart-live-point__pulse",cx:e,cy:r,fill:t,r:"7"}),a("circle",{className:"aui-chart-live-point__core",cx:e,cy:r,fill:t,r:"3.5"})]})}function Ot(t,e){let r=Number(typeof e=="number"?e:e??NaN);return Number.isInteger(r)?t[r]:void 0}function Ce({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,type:s,viewAction:h}){let g=qe().replaceAll(":",""),[m,o]=X(()=>new Set),d=e.ranges??[],u=d.find(l=>l.id===e.defaultRangeId)?.id??d.at(-1)?.id,[p,k]=X(u),v=d.find(l=>l.id===p)??d.find(l=>l.id===u),c=ae(()=>new Set(e.series.map(l=>l.dataKey)),[e.series]),y=ae(()=>{let l=new Set([...m].filter(N=>c.has(N)));return l.size<e.series.length?l:new Set},[e.series.length,m,c]),A=ae(()=>e.data.map(l=>Object.fromEntries(Object.entries(l).map(([N,Z])=>[N,typeof Z=="number"||typeof Z=="string"?Z:String(Z??"")]))),[e.data]),$=v?.maxItems?A.slice(-v.maxItems):A,w=e.kind==="line-chart"&&e.mode==="live"?$.slice(-(e.windowSize??30)):$,S=e.series[0],f=(()=>{if(!e.showSummary||!S||w.length===0)return null;let l=Number(w[0]?.[S.dataKey]),N=Number(w.at(-1)?.[S.dataKey]);return!Number.isFinite(l)||!Number.isFinite(N)?null:{change:l===0?void 0:(N-l)/Math.abs(l)*100,format:S.format&&S.format.style!=="percent"?{...S.format,compact:!1}:S.format,label:S.label,value:N}})(),M=s==="bar"&&e.kind==="bar-chart"&&e.layout==="horizontal",b=e.kind==="composed-chart",I=e.series.filter(l=>!y.has(l.dataKey)).map(l=>l.dataKey),F=b?e.series.filter(l=>l.type==="bar"&&l.stacked&&!y.has(l.dataKey)).map(l=>l.dataKey):[],V=b?e.series.find(l=>l.axis!=="right")?.format:e.series[0]?.format,x=b?e.series.find(l=>l.axis==="right")?.format:void 0,K=b&&e.series.some(l=>l.axis==="right"),G=(l,N=V)=>N?_(l,N):ce(l),P=e.kind==="line-chart"?e.mode??"standard":"standard",B=e.kind==="line-chart"?e.baseline??0:0,R=S?w.flatMap(l=>{let N=Number(l[S.dataKey]);return Number.isFinite(N)?[N]:[]}):[],E=Math.min(B,...R),H=Math.max(B,...R),T=H===E?50:(H-B)/(H-E)*100,D=L(e.kind==="line-chart"?e.positiveColor??"success":"success",0),Y=L(e.kind==="line-chart"?e.negativeColor??"danger":"danger",1),ne=P==="live"&&S?Number(w.at(-1)?.[S.dataKey]):void 0,ee=new Set(e.series.filter(l=>!y.has(l.dataKey)).map(l=>l.dataKey)),xe=P==="profit-loss"?a(Q,{ariaLabel:"Chart direction",items:[{color:D,id:"positive",label:"Above baseline"},{color:Y,id:"negative",label:"Below baseline"}]}):a(Q,{activeKeys:ee,ariaLabel:"Chart series",items:e.series.map((l,N)=>({color:L(l.color,N),id:l.dataKey,label:l.label})),onToggle:e.series.length>1?l=>o(()=>{let N=new Set(y),Z=e.series.length-N.size;return N.has(l)?N.delete(l):Z>1&&N.add(l),N}):void 0}),le=C(fe,{children:[a(Je,{vertical:!1}),M?C(fe,{children:[a(Re,{tickFormatter:l=>G(l),type:"number"}),a(be,{dataKey:e.xKey,type:"category",width:88})]}):C(fe,{children:[a(Re,{dataKey:e.xKey,interval:"preserveStartEnd",minTickGap:28,tickMargin:10}),a(be,{domain:s==="line"?["auto","auto"]:void 0,tickFormatter:l=>G(l),width:"auto",yAxisId:b?"left":void 0}),K?a(be,{orientation:"right",tickFormatter:l=>G(l,x),width:"auto",yAxisId:"right"}):null]}),a(ue,{isAnimationActive:!1,content:a(de,{series:e.series,indicatorColor:P==="profit-loss"?l=>{let N=Number(l.value);return Number.isFinite(N)?N>=B?D:Y:void 0}:void 0})})]}),ge={data:w,margin:{bottom:2,left:8,right:K?8:12,top:8},...n&&{onClick:l=>{let N=Ot(w,l.activeIndex);N&&n(W(e,N))}}};return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||h?a(j,{component:e,formats:r,viewAction:h,onAction:i}):null,children:[f||d.length>0||P==="live"?C("div",{className:"aui-chart-toolbar","data-slot":"agent-ui-chart-toolbar",children:[f?C("div",{className:"aui-chart-summary","data-slot":"agent-ui-chart-summary",children:[a("span",{className:"aui-chart-summary__label",children:f.label}),C("div",{className:"aui-chart-summary__value-row",children:[a("strong",{className:"aui-chart-summary__value",children:_(f.value,f.format)}),f.change!==void 0?a(Ke,{value:f.change}):null,v?a("span",{className:"aui-chart-summary__range","data-slot":"agent-ui-chart-summary-range",children:v.label}):null]})]}):null,P==="live"?C("span",{className:"aui-chart-live","data-slot":"agent-ui-chart-live",children:[a("span",{"aria-hidden":"true",className:"aui-chart-live__dot"}),"Live",S&&Number.isFinite(ne)?a("span",{className:"aui-chart-accessible-value",children:`Latest ${S.label}: ${_(ne,S.format)}`}):null]}):null,d.length>0?a(ke,{"aria-label":"Chart range",className:"aui-chart-ranges",selectedKey:v?.id,variant:"text",onSelectionChange:k,children:d.map(l=>a(ke.Item,{id:l.id,children:l.label},l.id))}):null]}):null,a("div",{"aria-label":`${e.title} chart`,"data-slot":"agent-ui-chart",role:"img",className:J(`aui-chart aui-chart--${s}`,P==="live"?"aui-chart--live":void 0,P==="profit-loss"?"aui-chart--profit-loss":void 0),children:a(oe,{height:220,width:"100%",children:s==="composed"&&e.kind==="composed-chart"?C(Kt,{accessibilityLayer:!0,...ge,children:[a("defs",{children:e.series.map((l,N)=>C("linearGradient",{id:`${g}-${N}`,x1:"0",x2:"0",y1:"0",y2:"1",children:[a("stop",{offset:"0%",stopColor:L(l.color,N),stopOpacity:.18}),a("stop",{offset:"100%",stopColor:L(l.color,N),stopOpacity:.02})]},l.dataKey))}),le,e.series.map((l,N)=>{let Z=L(l.color,N),Ae=l.axis??"left";return l.type==="area"?a(Ue,{dataKey:l.dataKey,dot:!1,fill:`url(#${g}-${N})`,hide:y.has(l.dataKey),isAnimationActive:!1,name:l.label,stackId:l.stacked?"area-stack":void 0,stroke:Z,strokeWidth:2,type:"monotone",yAxisId:Ae},l.dataKey):l.type==="bar"?a(je,{dataKey:l.dataKey,fill:Z,hide:y.has(l.dataKey),isAnimationActive:!1,name:l.label,stackId:l.stacked?"bar-stack":void 0,yAxisId:Ae,radius:we({dataKey:l.dataKey,horizontal:!1,stacked:!!l.stacked,visibleStackKeys:F})},l.dataKey):a(Ze,{dataKey:l.dataKey,dot:!1,hide:y.has(l.dataKey),isAnimationActive:!1,name:l.label,stroke:Z,strokeWidth:2,type:"monotone",yAxisId:Ae},l.dataKey)})]}):s==="line"?C(Lt,{accessibilityLayer:!0,...ge,children:[P==="profit-loss"&&e.kind==="line-chart"?a("defs",{children:C("linearGradient",{id:`${g}-profit-loss`,x1:"0",x2:"0",y1:"0",y2:"1",children:[a("stop",{offset:`${T}%`,stopColor:D}),a("stop",{offset:`${T}%`,stopColor:Y})]})}):null,le,P==="profit-loss"?a(Et,{stroke:"var(--border)",strokeDasharray:"4 4",y:B}):null,e.series.map((l,N)=>a(Ze,{dataKey:l.dataKey,hide:y.has(l.dataKey),isAnimationActive:!1,name:l.label,strokeWidth:2,type:"monotone",dot:P==="live"?a(Ft,{color:L(l.color,N),lastIndex:w.length-1}):!1,stroke:P==="profit-loss"?`url(#${g}-profit-loss)`:L(l.color,N)},l.dataKey))]}):s==="area"?C($t,{accessibilityLayer:!0,...ge,children:[a("defs",{children:e.series.map((l,N)=>C("linearGradient",{id:`${g}-${N}`,x1:"0",x2:"0",y1:"0",y2:"1",children:[a("stop",{offset:"0%",stopColor:L(l.color,N),stopOpacity:.2}),a("stop",{offset:"100%",stopColor:L(l.color,N),stopOpacity:.01})]},l.dataKey))}),le,e.series.map((l,N)=>a(Ue,{dataKey:l.dataKey,dot:!1,fill:`url(#${g}-${N})`,hide:y.has(l.dataKey),isAnimationActive:!1,name:l.label,stroke:L(l.color,N),strokeWidth:2,type:"monotone",stackId:e.kind==="area-chart"&&e.stacked?"stack":void 0},l.dataKey))]}):C(Mt,{accessibilityLayer:!0,...ge,layout:M?"vertical":"horizontal",children:[le,e.series.map((l,N)=>a(je,{dataKey:l.dataKey,fill:L(l.color,N),hide:y.has(l.dataKey),isAnimationActive:!1,name:l.label,radius:we({dataKey:l.dataKey,horizontal:M,stacked:e.kind==="bar-chart"&&!!e.stacked,visibleStackKeys:I}),stackId:e.kind==="bar-chart"&&e.stacked?"stack":void 0},l.dataKey))]})})}),xe]})}function fa(t){return a(Ce,{...t,type:"line"})}function ya(t){return a(Ce,{...t,type:"area"})}function pa(t){return a(Ce,{...t,type:"bar"})}function va(t){return a(Ce,{...t,type:"composed"})}function tt({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,variant:s,viewAction:h}){let[g,m]=X(()=>new Set),o=ae(()=>new Set(e.data.map(c=>String(c[e.labelKey]??""))),[e.data,e.labelKey]),d=ae(()=>{let c=new Set([...g].filter(y=>o.has(y)));return c.size<e.data.length?c:new Set},[e.data.length,g,o]),u=e.data.flatMap((c,y)=>{let A=String(c[e.labelKey]??"");return d.has(A)?[]:[{color:L(e.colors?.[A],y),name:A,original:c,value:Number(c[e.valueKey]??0)}]}),p=u.reduce((c,y)=>c+y.value,0),k=new Set(e.data.map(c=>String(c[e.labelKey]??"")).filter(c=>!d.has(c))),v=a(Q,{activeKeys:k,ariaLabel:"Chart categories",items:e.data.map((c,y)=>{let A=String(c[e.labelKey]??"");return{color:L(e.colors?.[A],y),id:A,label:A,value:_(Number(c[e.valueKey]??0),e.format)}}),onToggle:c=>m(()=>{let y=new Set(d);return y.has(c)?y.delete(c):y.size<e.data.length-1&&y.add(c),y})});return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||h?a(j,{component:e,formats:r,viewAction:h,onAction:i}):null,children:[a("div",{"aria-label":`${e.title} ${s} chart`,className:"aui-chart aui-chart--pie","data-slot":"agent-ui-chart",role:"img",children:a(oe,{height:220,width:"100%",children:C(Pt,{accessibilityLayer:!0,children:[C(St,{cx:"50%",cy:"50%",data:u,dataKey:"value",innerRadius:s==="donut"?58:0,isAnimationActive:!1,nameKey:"name",outerRadius:88,paddingAngle:0,strokeWidth:0,onClick:(c,y)=>{let A=u[y]?.original;A&&n?.(W(e,A))},children:[u.map(c=>a(At,{fill:c.color},c.name)),s==="donut"?a(Nt,{className:"aui-donut-total",position:"center",value:_(p,e.format)}):null]}),a(ue,{content:a(de,{series:[{dataKey:"value",format:e.format}]}),isAnimationActive:!1})]})})}),v]})}function Ca(t){return a(tt,{...t,variant:"pie"})}function xa(t){return a(tt,{...t,variant:"donut"})}function Aa({className:t,component:e,exportFormats:r,onAction:i,viewAction:n}){let[s,h]=X(()=>new Set),g=ae(()=>new Set(e.series.map(u=>u.dataKey)),[e.series]),m=ae(()=>{let u=new Set([...s].filter(p=>g.has(p)));return u.size<e.series.length?u:new Set},[e.series.length,s,g]),o=new Set(e.series.filter(u=>!m.has(u.dataKey)).map(u=>u.dataKey)),d=a(Q,{activeKeys:o,ariaLabel:"Chart series",items:e.series.map((u,p)=>({color:L(u.color,p),id:u.dataKey,label:u.label})),onToggle:e.series.length>1?u=>h(()=>{let p=new Set(m),k=e.series.length-p.size;return p.has(u)?p.delete(u):k>1&&p.add(u),p}):void 0});return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||n?a(j,{component:e,formats:r,viewAction:n,onAction:i}):null,children:[a("div",{"aria-label":`${e.title} radar chart`,className:"aui-chart aui-chart--radar","data-slot":"agent-ui-chart",role:"img",children:a(oe,{height:240,width:"100%",children:C(Tt,{data:e.data,margin:{bottom:8,left:20,right:20,top:8},children:[a(kt,{}),a(Qe,{dataKey:e.angleKey}),a(wt,{axisLine:!1,tick:!1}),e.series.map((u,p)=>m.has(u.dataKey)?null:a(_t,{dataKey:u.dataKey,fill:L(u.color,p),fillOpacity:.12,isAnimationActive:!1,name:u.label,stroke:L(u.color,p),strokeWidth:2},u.dataKey)),a(ue,{content:a(de,{series:e.series}),isAnimationActive:!1})]})})}),d]})}function Na({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,viewAction:s}){let h=e.data.map((m,o)=>({...m,fill:L(e.colors?.[String(m[e.labelKey]??"")],o)})),g=a(Q,{ariaLabel:"Chart categories",items:e.data.map((m,o)=>{let d=String(m[e.labelKey]??"");return{color:L(e.colors?.[d],o),id:`${d}-${o}`,label:d,value:_(Number(m[e.valueKey]??0),e.format)}})});return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||s?a(j,{component:e,formats:r,viewAction:s,onAction:i}):null,children:[a("div",{"aria-label":`${e.title} radial chart`,className:"aui-chart aui-chart--radial","data-slot":"agent-ui-chart",role:"img",children:a(oe,{height:230,width:"100%",children:C(Gt,{cx:"50%",cy:"50%",data:h,endAngle:e.endAngle??-270,innerRadius:"24%",outerRadius:"92%",startAngle:e.startAngle??90,children:[a(Qe,{domain:[0,e.maxValue??"auto"],tick:!1,type:"number"}),a(Rt,{background:!0,dataKey:e.valueKey,isAnimationActive:!1,name:e.labelKey,onClick:m=>n?.(W(e,m))}),a(ue,{isAnimationActive:!1,content:a(de,{series:[{dataKey:e.valueKey,format:e.format}]})})]})})}),g]})}function Sa({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,viewAction:s}){let h=ae(()=>{let o=new Map;for(let d of e.data){let u=e.groupKey?String(d[e.groupKey]??"Other"):e.title,p=o.get(u)??[];p.push(d),o.set(u,p)}return[...o.entries()]},[e.data,e.groupKey,e.title]),g=[{dataKey:e.xKey,format:e.format},{dataKey:e.yKey,format:e.format},...e.sizeKey?[{dataKey:e.sizeKey,format:e.format}]:[]],m=a(Q,{ariaLabel:"Chart groups",items:h.map(([o],d)=>({color:L(e.colors?.[o],d),id:o,label:o}))});return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||s?a(j,{component:e,formats:r,viewAction:s,onAction:i}):null,children:[a("div",{"aria-label":`${e.title} scatter chart`,className:"aui-chart aui-chart--scatter","data-slot":"agent-ui-chart",role:"img",children:a(oe,{height:240,width:"100%",children:C(It,{accessibilityLayer:!0,margin:{bottom:8,left:0,right:8,top:8},children:[a(Je,{}),a(Re,{dataKey:e.xKey,name:e.xKey,tickFormatter:o=>ce(o),type:"number"}),a(be,{dataKey:e.yKey,name:e.yKey,tickFormatter:o=>ce(o),type:"number",width:42}),e.sizeKey?a(Dt,{dataKey:e.sizeKey,range:[48,320],type:"number"}):null,a(ue,{content:a(de,{series:g}),cursor:{strokeDasharray:"4 4"},isAnimationActive:!1}),h.map(([o,d],u)=>a(Bt,{data:d,fill:L(e.colors?.[o],u),isAnimationActive:!1,name:o,onClick:p=>{let k="payload"in p?p.payload:p;n?.(W(e,k))}},o))]})})}),m]})}function ka({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,viewAction:s}){let[h,g]=X(0),m=[...new Set(e.data.map(x=>String(x[e.xKey]??"")))],o=[...new Set(e.data.map(x=>String(x[e.yKey]??"")))],d=e.data.map(x=>Number(x[e.valueKey]??0)),u=Math.min(...d),p=Math.max(...d),k=p-u||1,v=420,c=84,y=28,A=8,$=44,w=(v-c-A)/Math.max(1,m.length),S=Math.max(26,Math.min(44,230/Math.max(1,o.length))),f=y+o.length*S+$,M=new Map(e.data.map(x=>[`${String(x[e.xKey]??"")}\0${String(x[e.yKey]??"")}`,x])),b=new Map([...M.keys()].map((x,K)=>[x,K])),I=Math.min(h,Math.max(0,M.size-1)),F=L(e.color,0),V=C("div",{"aria-label":"Heatmap intensity",className:"aui-legend aui-legend--scale","data-slot":"agent-ui-chart-legend",role:"img",children:[a("span",{className:"aui-legend__value",children:_(u,e.format)}),a("span",{className:"aui-legend__scale",style:{background:`linear-gradient(90deg, color-mix(in srgb, ${F} 8%, transparent), ${F})`}}),a("span",{className:"aui-legend__value",children:_(p,e.format)})]});return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||s?a(j,{component:e,formats:r,viewAction:s,onAction:i}):null,children:[a("div",{"aria-label":`${e.title} heatmap`,className:"aui-chart aui-chart--heatmap","data-slot":"agent-ui-chart",role:n?"group":"img",children:C("svg",{"aria-hidden":n?void 0:!0,preserveAspectRatio:"xMidYMid meet",viewBox:`0 0 ${v} ${f}`,children:[m.map((x,K)=>a("text",{className:"aui-heatmap__axis",textAnchor:"middle",x:c+K*w+w/2,y:f-14,children:x},x)),o.map((x,K)=>C("g",{children:[a("text",{className:"aui-heatmap__axis",dominantBaseline:"middle",textAnchor:"end",x:c-8,y:y+K*S+S/2,children:x}),m.map((G,P)=>{let B=`${G}\0${x}`,R=M.get(B),E=b.get(B),H=Number(R?.[e.valueKey]??0),T=R?.14+(H-u)/k*.76:.04;return C("g",{className:"aui-heatmap__cell","data-slot":R?"agent-ui-heatmap-cell":void 0,role:R&&n?"button":void 0,tabIndex:R&&n&&E!==void 0?E===I?0:-1:void 0,onClick:()=>{R&&n?.(W(e,R))},onFocus:()=>{E!==void 0&&g(E)},onKeyDown:D=>{if(!R||!n||E===void 0)return;let Y=ye(D.key,E,M.size);if(Y!==null){D.preventDefault(),g(Y),pe(D,"agent-ui-heatmap-cell",Y);return}D.key!=="Enter"&&D.key!==" "||(D.preventDefault(),n(W(e,R)))},children:[a("rect",{fill:F,fillOpacity:T,height:Math.max(1,S-3),rx:6,width:Math.max(1,w-3),x:c+P*w+1.5,y:y+K*S+1.5}),R?a("title",{children:`${x}, ${G}: ${_(H,e.format)}`}):null]},G)})]},x))]})}),V]})}function wa({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,viewAction:s}){let[h,g]=X(0),[m,o]=X(null),[d,u]=X(null),p=d??m,k=420,v=260,c=e.data.map(f=>({close:Number(f[e.closeKey]),high:Number(f[e.highKey]),label:String(f[e.xKey]??""),low:Number(f[e.lowKey]),open:Number(f[e.openKey])})),y=Ve(c,{height:v,margins:{bottom:34,left:58,right:8,top:10},width:k}),A=L(e.upColor??"success",0),$=L(e.downColor??"danger",1),w=L("default",2),S=Math.min(h,e.data.length-1);return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||s?a(j,{component:e,formats:r,viewAction:s,onAction:i}):null,children:[C("div",{"aria-label":`${e.title} candlestick chart`,className:"aui-chart aui-chart--candlestick","data-slot":"agent-ui-chart",role:"group",children:[C("svg",{preserveAspectRatio:"xMidYMid meet",viewBox:`0 0 ${k} ${v}`,children:[y?.yTicks.map(f=>C("g",{children:[a("line",{className:"aui-chart-grid-line",x1:y.bounds.left,x2:y.bounds.right,y1:f.y,y2:f.y}),a("text",{className:"aui-chart-axis-label",dominantBaseline:"middle",textAnchor:"end",x:y.bounds.left-9,y:f.y,children:e.format?_(f.value,e.format):ce(f.value)})]},f.value)),y?.candles.map(f=>{let M=e.data[f.index],b=c[f.index],I=f.direction==="up"?A:f.direction==="down"?$:w,F={items:[{color:I,id:"open",label:"Open",value:_(b.open,e.format)},{color:I,id:"high",label:"High",value:_(b.high,e.format)},{color:I,id:"low",label:"Low",value:_(b.low,e.format)},{color:I,id:"close",label:"Close",value:_(b.close,e.format)}],label:f.label};return C("g",{"aria-label":`${f.label}: open ${_(b.open,e.format)}, high ${_(b.high,e.format)}, low ${_(b.low,e.format)}, close ${_(b.close,e.format)}`,className:"aui-chart-mark","data-slot":"agent-ui-candlestick",role:M&&n?"button":"img",tabIndex:f.index===S?0:-1,onBlur:()=>o(null),onPointerLeave:()=>u(null),onClick:M&&n?()=>n(W(e,M)):void 0,onFocus:V=>{g(f.index),o(re(V,{x:f.x,y:Math.min(f.wick.top,f.body.y)},F))},onKeyDown:V=>{let x=ye(V.key,f.index,y.candles.length);if(x!==null){V.preventDefault(),g(x),pe(V,"agent-ui-candlestick",x);return}!M||!n||V.key!=="Enter"&&V.key!==" "||(V.preventDefault(),n(W(e,M)))},onPointerEnter:V=>{u(re(V,{x:f.x,y:Math.min(f.wick.top,f.body.y)},F))},children:[a("line",{stroke:I,strokeWidth:1.5,x1:f.wick.x,x2:f.wick.x,y1:f.wick.top,y2:f.wick.bottom}),a("rect",{fill:I,height:f.body.height,rx:Math.min(2,f.body.width/2),width:f.body.width,x:f.body.x,y:f.body.y})]},`${f.label}-${f.index}`)}),y?.xLabelIndices.map(f=>{let M=y.candles[f];return M?a("text",{className:"aui-chart-axis-label",textAnchor:"middle",x:M.x,y:v-10,children:M.label},`${M.label}-${f}`):null})]}),a(ve,{state:p})]}),a(Q,{ariaLabel:"Price direction",items:[{color:A,id:"up",label:"Close above open"},{color:$,id:"down",label:"Close below open"}]})]})}function _a({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,viewAction:s}){let[h,g]=X(0),[m,o]=X(null),[d,u]=X(null),p=d??m,k=640,v=250,c=12,y=238,A=22,$=618,w=(e.orientation??"vertical")==="vertical",S=e.data.map(x=>Math.max(0,Number(x[e.valueKey]??0))),f=Math.max(...S,1),M=S[0]??0,b=Math.min(h,e.data.length-1),I=w?(y-c)/e.data.length:($-A)/e.data.length,F=x=>{let K=(S[x]??0)/f,G=(S[x+1]??S[x]??0)/f;if(w){let T=c+I*x,D=c+I*(x+1)-3,Y=Math.max(8,K*($-A)),ne=Math.max(8,G*($-A)),ee=k/2;return`${ee-Y/2},${T} ${ee+Y/2},${T} ${ee+ne/2},${D} ${ee-ne/2},${D}`}let P=A+I*x,B=A+I*(x+1)-3,R=Math.max(8,K*(y-c)),E=Math.max(8,G*(y-c)),H=v/2;return`${P},${H-R/2} ${B},${H-E/2} ${B},${H+E/2} ${P},${H+R/2}`},V=e.data.map((x,K)=>{let G=String(x[e.labelKey]??""),P=S[K]??0,B=M>0?P/M:0;return{color:L(e.colors?.[G],K),id:`${G}-${K}`,label:G,value:e.showPercentages?`${_(P,e.format)} \xB7 ${_(B,{maximumFractionDigits:1,style:"percent"})}`:_(P,e.format)}});return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||s?a(j,{component:e,formats:r,viewAction:s,onAction:i}):null,children:[C("div",{"aria-label":`${e.title} funnel chart`,"data-slot":"agent-ui-chart",role:"group",className:J("aui-chart aui-chart--funnel",w?"aui-chart--funnel-vertical":"aui-chart--funnel-horizontal"),children:[a("svg",{preserveAspectRatio:"xMidYMid meet",viewBox:`0 0 ${k} ${v}`,children:e.data.map((x,K)=>{let G=String(x[e.labelKey]??""),P=L(e.colors?.[G],K),B=S[K]??0,R=M>0?B/M:0,E={items:[{color:P,id:"value",label:"Value",value:_(B,e.format)},...e.showPercentages?[{color:P,id:"conversion",label:"From first stage",value:_(R,{maximumFractionDigits:1,style:"percent"})}]:[]],label:G},H=w?{x:k/2,y:c+I*K}:{x:A+I*(K+.5),y:c};return a("g",{"aria-label":`${G}: ${_(S[K]??0,e.format)}`,className:"aui-chart-mark","data-slot":"agent-ui-funnel-stage",role:n?"button":"img",tabIndex:K===b?0:-1,onBlur:()=>o(null),onPointerLeave:()=>u(null),onClick:n?()=>n(W(e,x)):void 0,onFocus:T=>{g(K),o(re(T,H,E))},onKeyDown:T=>{let D=ye(T.key,K,e.data.length);if(D!==null){T.preventDefault(),g(D),pe(T,"agent-ui-funnel-stage",D);return}n&&(T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),n(W(e,x))))},onPointerEnter:T=>{u(re(T,H,E))},children:a("polygon",{fill:P,points:F(K)})},`${G}-${K}`)})}),a(ve,{state:p})]}),a(Q,{ariaLabel:"Funnel stages",items:V})]})}function Ra({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,viewAction:s}){let[h,g]=X(null),[m,o]=X(null),d=m??h,{maximum:u,minimum:p}=Me(e),k=e.notches??30,v=L(e.color,0),c=_(e.value,e.format),y={label:e.label,max:u,min:p,value:e.value},A=e.orientation??"arc",$={items:[{color:v,id:"value",label:"Value",value:c},{color:v,id:"range",label:"Range",value:`${_(p,e.format)} \u2013 ${_(u,e.format)}`}],label:e.label},w=A==="arc"?{x:240,y:4}:{x:280,y:34},S={"aria-label":`${e.label}: ${c}`,onBlur:()=>g(null),onClick:n?()=>n(W(e,y)):void 0,onFocus:b=>{g(re(b,w,$))},onKeyDown:b=>{!n||b.key!=="Enter"&&b.key!==" "||(b.preventDefault(),n(W(e,y)))},onPointerEnter:b=>{o(re(b,w,$))},onPointerLeave:()=>o(null),role:n?"button":"img",tabIndex:0},f=A==="arc"?De({centerX:240,centerY:126,count:k,height:240,max:u,min:p,padding:12,radius:104,value:e.value,width:480}):null,M=A==="linear"?Fe({count:k,gap:3,height:24,max:u,min:p,value:e.value,width:520}):null;return a(U,{className:t,description:e.description,title:e.title,actions:r?.length||s?a(j,{component:e,formats:r,viewAction:s,onAction:i}):null,children:C("div",{"aria-label":`${e.title} gauge chart`,className:`aui-chart aui-chart--gauge aui-chart--gauge-${A}`,"data-slot":"agent-ui-chart",role:"group",children:[A==="arc"?a("svg",{preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 480 240",children:C("g",{className:"aui-chart-mark","data-slot":"agent-ui-gauge",...S,children:[f?.notches.map(b=>a("path",{className:"aui-gauge__notch",d:b.path,"data-active":b.active,fill:b.active?v:"var(--surface-secondary)"},b.index)),a("text",{className:"aui-gauge__value",textAnchor:"middle",x:"240",y:"126",children:c}),a("text",{className:"aui-gauge__label",textAnchor:"middle",x:"240",y:"150",children:e.label}),a("text",{className:"aui-gauge__bound",textAnchor:"end",x:"154",y:"220",children:_(p,e.format)}),a("text",{className:"aui-gauge__bound",textAnchor:"start",x:"326",y:"220",children:_(u,e.format)})]})}):a("svg",{preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 560 130",children:C("g",{className:"aui-chart-mark","data-slot":"agent-ui-gauge",...S,children:[a("text",{className:"aui-gauge__label",x:"20",y:"24",children:e.label}),a("text",{className:"aui-gauge__value",textAnchor:"end",x:"540",y:"24",children:c}),M?.notches.map(b=>a("rect",{className:"aui-gauge__notch","data-active":b.active,fill:b.active?v:"var(--surface-secondary)",height:b.height,rx:Math.min(3,b.width/2),width:b.width,x:20+b.x,y:44+b.y},b.index)),a("text",{className:"aui-gauge__bound",x:"20",y:"96",children:_(p,e.format)}),a("text",{className:"aui-gauge__bound",textAnchor:"end",x:"540",y:"96",children:_(u,e.format)})]})}),a(ve,{state:d})]})})}function $e(t){return t.children?.length?t.children.reduce((e,r)=>e+$e(r),0):t.value??0}function $a({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,viewAction:s}){let[h,g]=X(0),[m,o]=X(null),[d,u]=X(null),p=d??m,k=360,v=250,c=Ye(e.data,{centerX:k/2,centerY:v/2,gapAngle:1.1,innerRadius:34,maxDepth:4,outerRadius:112}),y=new Map,A=new Map,$=0,w=(b,I=!1)=>{y.set(b.id,b),I||(A.set(b.id,L(b.color,$)),$+=1),b.children?.forEach(F=>w(F))};w(e.data,!0);let S=$e(e.data),f=Math.min(h,Math.max(0,c.length-1)),M=(e.data.children??[]).map(b=>({color:A.get(b.id)??L(b.color,0),id:b.id,label:b.label,value:_($e(b),e.format)}));return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||s?a(j,{component:e,formats:r,viewAction:s,onAction:i}):null,children:[C("div",{"aria-label":`${e.title} sunburst chart`,className:"aui-chart aui-chart--sunburst","data-slot":"agent-ui-chart",role:"group",children:[C("svg",{preserveAspectRatio:"xMidYMid meet",viewBox:`0 0 ${k} ${v}`,children:[c.map((b,I)=>{let F=A.get(b.id)??L(void 0,b.depth),V=b.path.map(R=>y.get(R)?.label??R),x=(b.startAngle+b.endAngle)/2*(Math.PI/180),K=(b.innerRadius+b.outerRadius)/2,G={items:[{color:F,id:"value",label:"Value",value:_(b.value,e.format)},{color:F,id:"share",label:"Share of total",value:_(S>0?b.value/S:0,{maximumFractionDigits:1,style:"percent"})}],label:V.join(" / ")},P={x:k/2+Math.cos(x)*K,y:v/2+Math.sin(x)*K},B={depth:b.depth,id:b.id,label:b.label,path:V.join(" / "),value:b.value};return a("g",{"aria-label":`${V.join(", ")}: ${_(b.value,e.format)}`,className:"aui-chart-mark","data-slot":"agent-ui-sunburst-segment",role:n?"button":"img",tabIndex:I===f?0:-1,onBlur:()=>o(null),onPointerLeave:()=>u(null),onClick:n?()=>n(W(e,B)):void 0,onFocus:R=>{g(I),o(re(R,P,G))},onKeyDown:R=>{let E=ye(R.key,I,c.length);if(E!==null){R.preventDefault(),g(E),pe(R,"agent-ui-sunburst-segment",E);return}n&&(R.key!=="Enter"&&R.key!==" "||(R.preventDefault(),n(W(e,B))))},onPointerEnter:R=>{u(re(R,P,G))},children:a("path",{className:"aui-sunburst__arc",d:b.d,fill:F})},b.id)}),a("text",{className:"aui-sunburst__total",textAnchor:"middle",x:k/2,y:v/2-2,children:_(S,e.format)}),a("text",{className:"aui-sunburst__root",textAnchor:"middle",x:k/2,y:v/2+16,children:e.data.label})]}),a(ve,{state:p})]}),M.length?a(Q,{ariaLabel:"Top-level categories",items:M}):null]})}function Ht({height:t,index:e,payload:r,width:i,x:n,y:s}){return C("g",{children:[a("rect",{className:"aui-sankey__node",fill:Ne(e),height:t,rx:4,width:i,x:n,y:s}),a("text",{className:"aui-sankey__label",dominantBaseline:"middle",x:n+i+7,y:s+t/2,children:r.name})]})}function Yt({chartId:t,index:e,linkWidth:r,payload:i,sourceControlX:n,sourceX:s,sourceY:h,targetControlX:g,targetX:m,targetY:o}){let d=Math.max(1,r)/2,u=`M${s},${h-d} C${n},${h-d} ${g},${o-d} ${m},${o-d} L${m},${o+d} C${g},${o+d} ${n},${h+d} ${s},${h+d} Z`;return C("g",{children:[C("defs",{children:[C("linearGradient",{id:`${t}-link-${e}`,x1:"0",x2:"1",children:[a("stop",{offset:"0%",stopColor:"var(--chart-3, var(--accent))",stopOpacity:.2}),a("stop",{offset:"50%",stopColor:"var(--chart-4, oklch(from var(--accent) calc(l + 0.12) c h))",stopOpacity:.55}),a("stop",{offset:"100%",stopColor:"var(--chart-1, oklch(from var(--accent) calc(l - 0.24) c h))",stopOpacity:.25})]}),a("filter",{height:"180%",id:`${t}-glow-${e}`,width:"180%",x:"-40%",y:"-40%",children:a("feGaussianBlur",{stdDeviation:"2.5"})})]}),a("path",{d:u,fill:`url(#${t}-link-${e})`,filter:`url(#${t}-glow-${e})`,opacity:.35}),a("path",{d:u,fill:`url(#${t}-link-${e})`,opacity:.8}),a("title",{children:`${i.source.name} \u2192 ${i.target.name}: ${i.value}`})]})}function Ma({className:t,component:e,exportFormats:r,onAction:i,onSelect:n,viewAction:s}){let h=qe().replaceAll(":",""),g=new Map(e.nodes.map((o,d)=>[o.id,d])),m={links:e.links.flatMap(o=>{let d=g.get(o.source),u=g.get(o.target);return d===void 0||u===void 0?[]:[{source:d,target:u,value:o.value}]}),nodes:e.nodes.map(o=>({name:o.label}))};return C(U,{className:t,description:e.description,title:e.title,actions:r?.length||s?a(j,{component:e,formats:r,viewAction:s,onAction:i}):null,children:[a("div",{"aria-label":`${e.title} sankey chart`,className:"aui-chart aui-chart--sankey aui-sankey","data-slot":"agent-ui-chart",role:"img",children:a(oe,{height:260,width:"100%",children:a(Vt,{data:m,link:o=>a(Yt,{...o,chartId:h}),linkCurvature:.55,margin:{bottom:12,left:8,right:92,top:12},node:o=>a(Ht,{...o}),nodePadding:18,nodeWidth:12,onClick:(o,d)=>n?.(W(e,{element:d,index:o.index,value:"payload"in o?o.payload.value:void 0})),children:a(ue,{content:a(de,{series:[{dataKey:"value",format:e.format}]}),isAnimationActive:!1})})})}),a("div",{"aria-label":"Chart encoding",className:"aui-legend","data-slot":"agent-ui-chart-legend",role:"list",children:C("span",{className:"aui-legend__item","data-slot":"agent-ui-chart-legend-item",role:"listitem",children:[a("span",{className:"aui-legend__flow"}),a("span",{className:"aui-legend__label",children:"Flow volume"})]})})]})}export{ya as AreaChartComponentContent,pa as BarChartComponentContent,wa as CandlestickChartComponentContent,va as ComposedChartComponentContent,xa as DonutChartComponentContent,_a as FunnelChartComponentContent,Ra as GaugeChartComponentContent,ka as HeatmapComponentContent,fa as LineChartComponentContent,Ca as PieChartComponentContent,Aa as RadarChartComponentContent,Na as RadialChartComponentContent,Ma as SankeyChartComponentContent,Sa as ScatterChartComponentContent,$a as SunburstChartComponentContent};
@@ -0,0 +1 @@
1
+ var m=["base","brutalism","glass","mouve"];function k(e){return m.includes(e)?e:"base"}var A={accent:"accent",background:"background",foreground:"foreground",overlay:"overlay",surface:"surface",surfaceSecondary:"surface-secondary",tooltip:"tooltip"},p={"--accent":"var(--ha-accent)","--accent-foreground":"var(--ha-accent-foreground)","--accent-hover":"var(--ha-accent)","--field-border-focus":"var(--ha-accent)","--focus":"var(--ha-accent)"},l="oklch(from var(--ha-accent) clamp(0, (0.7 - l) * 1000, 1) 0 h)",d="oklch(from var(--ha-launcher-bg) clamp(0, (0.7 - l) * 1000, 1) 0 h)";function R(e){let r={},o=n(e,"light"),t=n(e,"dark");return o&&(r["--ha-theme-launcher-background-light"]=o,r["--ha-theme-launcher-foreground-light"]=d),t&&(r["--ha-theme-launcher-background-dark"]=t,r["--ha-theme-launcher-foreground-dark"]=d),r}var y="oklch(from var(--ha-card-secondary) calc(l - 0.0151) c h)",T="oklch(from var(--ha-card-secondary) calc(l + 0.017) c h)",u={pill:"0.875rem",round:"0.5rem",sharp:"0.125rem",soft:"0.375rem"},C=12,S=18;function f(e){let r=e?.trim();if(!(!r||r.length>256||/[;{}]/.test(r)))return r}function n(e,r){if(e!==void 0)return f(typeof e=="string"?e:e[r])}function b(e){if(!e)return{};let r={},o=!!(n(e.colors?.accent,"light")||n(e.colors?.accent,"dark"));e.radius&&e.radius in u&&(r["--radius"]=u[e.radius]);let t=f(e.typography?.fontFamily);t&&(r["--ha-font-family"]=t);let a=e.typography?.baseSize;if(typeof a=="number"&&Number.isFinite(a)){let c=Math.min(Math.max(Math.round(a),C),S);r["--ha-font-size"]=`${c}px`}for(let[c,s]of Object.entries(A)){let i=e.colors?.[c],g=n(i,"light"),h=n(i,"dark");g&&(r[`--ha-theme-${s}-light`]=g),h&&(r[`--ha-theme-${s}-dark`]=h)}return o&&Object.assign(r,p),n(e.colors?.accent,"light")&&(r["--ha-theme-accent-foreground-light"]=l),n(e.colors?.accent,"dark")&&(r["--ha-theme-accent-foreground-dark"]=l),n(e.colors?.surfaceSecondary,"light")&&(r["--ha-theme-surface-tertiary-light"]=y),n(e.colors?.surfaceSecondary,"dark")&&(r["--ha-theme-surface-tertiary-dark"]=T),r}export{m as a,k as b,l as c,d,R as e,b as f};
@@ -1,4 +1,4 @@
1
- import{c as A}from"./chunk-S6OIAJSC.js";function D(t){return{maximum:t.max??(t.format?.style==="percent"?1:100),minimum:t.min??0}}function gt(t,e){return e.toolCall?{actionId:e.id,args:e.toolCall.arguments,componentId:t,label:e.label,prompt:e.prompt,toolName:e.toolCall.name,type:"tool"}:e.prompt?{componentId:t,label:e.label,prompt:e.prompt,type:"followup"}:null}function dt(t,e){return{componentId:t.id,componentTitle:t.title,datum:e}}var I=new Map;function v(t){try{return Intl.NumberFormat.supportedLocalesOf([t])[0]??"en"}catch{return"en"}}function V(t,e,a="en"){let r=v(a);if(!e)return t.toLocaleString(r);let n={...e.style==="currency"?{currency:e.currency,style:"currency"}:{},...e.style==="percent"?{style:"percent"}:{},...e.style==="percent"&&e.maximumFractionDigits!==void 0?{maximumFractionDigits:e.maximumFractionDigits}:{},...e.style!=="percent"&&e.compact?{notation:"compact"}:{}},i=`${r}:${JSON.stringify(n)}`,o=I.get(i);return o||(o=new Intl.NumberFormat(r,n),I.set(i,o)),o.format(t)}function ft(t,e="en"){let a=v(e),r=Math.abs(t);return r>=1e6?`${(t/1e6).toLocaleString(a,{maximumFractionDigits:1})}M`:r>=1e3?`${(t/1e3).toLocaleString(a,{maximumFractionDigits:1})}K`:t.toLocaleString(a,{maximumFractionDigits:1})}function F(t,e={},a="en"){return new Intl.NumberFormat(v(a),{maximumFractionDigits:e.maximumFractionDigits??2,signDisplay:"always",style:e.style==="percent"?"percent":"decimal"}).format(t)}function L(t,e,a="en"){return typeof t=="number"?V(t,e,a):String(t??"")}import{ChartColumn as Z,Copy as Q,Ellipsis as tt,FileCode as et,FileText as rt,LayoutCells as nt,Picture as at}from"@gravity-ui/icons";import{Button as ot,Dropdown as d,Label as T}from"@heroui/react";import{useCallback as it,useRef as B,useState as U}from"react";function j(t){let e=t.replace(/([a-z\d])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim();return e?`${e[0]?.toUpperCase()}${e.slice(1)}`:t}function _(t){let e=[],a=(r,n,i)=>{let o=[...n,r.label],s=r.children?.reduce((c,u)=>c+a(u,o,i+1),0),m=r.children?.length?s??0:r.value??0;return i>0&&e.push({depth:i,id:r.id,label:r.label,path:o.join(" / "),value:m}),m};return a(t,[],0),e}function E(t){let e=[],a=new Set,r=o=>{a.has(o.key)||(a.add(o.key),e.push(o))},n=(o,s)=>r({format:s,key:o,label:j(o)});switch(t.kind){case"line-chart":case"area-chart":case"bar-chart":case"composed-chart":n(t.xKey),t.series.forEach(o=>r({format:o.format,key:o.dataKey,label:o.label}));break;case"candlestick-chart":n(t.xKey),n(t.openKey,t.format),n(t.highKey,t.format),n(t.lowKey,t.format),n(t.closeKey,t.format);break;case"funnel-chart":n(t.labelKey),n(t.valueKey,t.format);break;case"gauge-chart":n("label"),n("value",t.format),n("min",t.format),n("max",t.format);break;case"pie-chart":case"donut-chart":case"radial-chart":n(t.labelKey),n(t.valueKey,t.format);break;case"radar-chart":n(t.angleKey),t.series.forEach(o=>r({format:o.format,key:o.dataKey,label:o.label}));break;case"scatter-chart":t.labelKey&&n(t.labelKey),t.groupKey&&n(t.groupKey),n(t.xKey,t.format),n(t.yKey,t.format),t.sizeKey&&n(t.sizeKey,t.format);break;case"heatmap":n(t.xKey),n(t.yKey),n(t.valueKey,t.format);break;case"sankey-chart":n("source"),n("target"),n("value",t.format);break;case"sunburst-chart":n("id"),n("label"),n("path"),n("depth"),n("value",t.format);break}let i;if(t.kind==="sankey-chart"){let o=new Map(t.nodes.map(s=>[s.id,s.label]));i=t.links.map(s=>({source:o.get(s.source)??s.source,target:o.get(s.target)??s.target,value:s.value}))}else if(t.kind==="gauge-chart"){let{maximum:o,minimum:s}=D(t);i=[{label:t.label,max:o,min:s,value:t.value}]}else t.kind==="sunburst-chart"?i=_(t.data):i=t.data;return{columns:e,description:t.description,id:t.id,kind:"data-table",rows:i,title:t.title,variant:"secondary"}}var z=new Set(["area-chart","bar-chart","candlestick-chart","composed-chart","donut-chart","funnel-chart","gauge-chart","heatmap","line-chart","pie-chart","radar-chart","radial-chart","sankey-chart","scatter-chart","sunburst-chart"]);function G(t){return z.has(t.kind)}function w(t,e){return`${t.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,80)||"agent-ui"}.${e}`}function k(t,e,a){if(typeof document>"u"||typeof URL.createObjectURL!="function")return;let r=URL.createObjectURL(new Blob([t],{type:e})),n=document.createElement("a");n.download=a,n.href=r,n.click(),URL.revokeObjectURL(r)}function N(t){let e=String(t??"");return/[",\r\n]/.test(e)?`"${e.replaceAll('"','""')}"`:e}function S(t){let e,a;if(t.kind==="data-table")e=t.rows,a=t.columns.map(r=>r.key);else if(G(t)){let r=E(t);e=r.rows,a=r.columns.map(n=>n.key)}return!e||!a?.length?null:[a.map(N).join(","),...e.map(r=>a.map(n=>N(r[n])).join(","))].join(`
1
+ import{a as A}from"./chunk-MXXCR5SR.js";function D(t){return{maximum:t.max??(t.format?.style==="percent"?1:100),minimum:t.min??0}}function gt(t,e){return e.toolCall?{actionId:e.id,args:e.toolCall.arguments,componentId:t,label:e.label,prompt:e.prompt,toolName:e.toolCall.name,type:"tool"}:e.prompt?{componentId:t,label:e.label,prompt:e.prompt,type:"followup"}:null}function dt(t,e){return{componentId:t.id,componentTitle:t.title,datum:e}}var I=new Map;function v(t){try{return Intl.NumberFormat.supportedLocalesOf([t])[0]??"en"}catch{return"en"}}function V(t,e,a="en"){let r=v(a);if(!e)return t.toLocaleString(r);let n={...e.style==="currency"?{currency:e.currency,style:"currency"}:{},...e.style==="percent"?{style:"percent"}:{},...e.style==="percent"&&e.maximumFractionDigits!==void 0?{maximumFractionDigits:e.maximumFractionDigits}:{},...e.style!=="percent"&&e.compact?{notation:"compact"}:{}},i=`${r}:${JSON.stringify(n)}`,o=I.get(i);return o||(o=new Intl.NumberFormat(r,n),I.set(i,o)),o.format(t)}function ft(t,e="en"){let a=v(e),r=Math.abs(t);return r>=1e6?`${(t/1e6).toLocaleString(a,{maximumFractionDigits:1})}M`:r>=1e3?`${(t/1e3).toLocaleString(a,{maximumFractionDigits:1})}K`:t.toLocaleString(a,{maximumFractionDigits:1})}function F(t,e={},a="en"){return new Intl.NumberFormat(v(a),{maximumFractionDigits:e.maximumFractionDigits??2,signDisplay:"always",style:e.style==="percent"?"percent":"decimal"}).format(t)}function L(t,e,a="en"){return typeof t=="number"?V(t,e,a):String(t??"")}import{ChartColumn as Z,Copy as Q,Ellipsis as tt,FileCode as et,FileText as rt,LayoutCells as nt,Picture as at}from"@gravity-ui/icons";import{Button as ot,Dropdown as d,Label as T}from"@heroui/react";import{useCallback as it,useRef as B,useState as U}from"react";function j(t){let e=t.replace(/([a-z\d])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim();return e?`${e[0]?.toUpperCase()}${e.slice(1)}`:t}function _(t){let e=[],a=(r,n,i)=>{let o=[...n,r.label],s=r.children?.reduce((c,u)=>c+a(u,o,i+1),0),m=r.children?.length?s??0:r.value??0;return i>0&&e.push({depth:i,id:r.id,label:r.label,path:o.join(" / "),value:m}),m};return a(t,[],0),e}function E(t){let e=[],a=new Set,r=o=>{a.has(o.key)||(a.add(o.key),e.push(o))},n=(o,s)=>r({format:s,key:o,label:j(o)});switch(t.kind){case"line-chart":case"area-chart":case"bar-chart":case"composed-chart":n(t.xKey),t.series.forEach(o=>r({format:o.format,key:o.dataKey,label:o.label}));break;case"candlestick-chart":n(t.xKey),n(t.openKey,t.format),n(t.highKey,t.format),n(t.lowKey,t.format),n(t.closeKey,t.format);break;case"funnel-chart":n(t.labelKey),n(t.valueKey,t.format);break;case"gauge-chart":n("label"),n("value",t.format),n("min",t.format),n("max",t.format);break;case"pie-chart":case"donut-chart":case"radial-chart":n(t.labelKey),n(t.valueKey,t.format);break;case"radar-chart":n(t.angleKey),t.series.forEach(o=>r({format:o.format,key:o.dataKey,label:o.label}));break;case"scatter-chart":t.labelKey&&n(t.labelKey),t.groupKey&&n(t.groupKey),n(t.xKey,t.format),n(t.yKey,t.format),t.sizeKey&&n(t.sizeKey,t.format);break;case"heatmap":n(t.xKey),n(t.yKey),n(t.valueKey,t.format);break;case"sankey-chart":n("source"),n("target"),n("value",t.format);break;case"sunburst-chart":n("id"),n("label"),n("path"),n("depth"),n("value",t.format);break}let i;if(t.kind==="sankey-chart"){let o=new Map(t.nodes.map(s=>[s.id,s.label]));i=t.links.map(s=>({source:o.get(s.source)??s.source,target:o.get(s.target)??s.target,value:s.value}))}else if(t.kind==="gauge-chart"){let{maximum:o,minimum:s}=D(t);i=[{label:t.label,max:o,min:s,value:t.value}]}else t.kind==="sunburst-chart"?i=_(t.data):i=t.data;return{columns:e,description:t.description,id:t.id,kind:"data-table",rows:i,title:t.title,variant:"secondary"}}var z=new Set(["area-chart","bar-chart","candlestick-chart","composed-chart","donut-chart","funnel-chart","gauge-chart","heatmap","line-chart","pie-chart","radar-chart","radial-chart","sankey-chart","scatter-chart","sunburst-chart"]);function G(t){return z.has(t.kind)}function w(t,e){return`${t.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,80)||"agent-ui"}.${e}`}function k(t,e,a){if(typeof document>"u"||typeof URL.createObjectURL!="function")return;let r=URL.createObjectURL(new Blob([t],{type:e})),n=document.createElement("a");n.download=a,n.href=r,n.click(),URL.revokeObjectURL(r)}function N(t){let e=String(t??"");return/[",\r\n]/.test(e)?`"${e.replaceAll('"','""')}"`:e}function S(t){let e,a;if(t.kind==="data-table")e=t.rows,a=t.columns.map(r=>r.key);else if(G(t)){let r=E(t);e=r.rows,a=r.columns.map(n=>n.key)}return!e||!a?.length?null:[a.map(N).join(","),...e.map(r=>a.map(n=>N(r[n])).join(","))].join(`
2
2
  `)}function R(t){return t.replace(/[\t\r\n]+/g," ")}function H(t){return[t.columns.map(e=>R(e.label)).join(" "),...t.rows.map(e=>t.columns.map(a=>R(L(e[a.key],a.format))).join(" "))].join(`
3
3
  `)}var J=["--accent","--border","--chart-1","--chart-2","--chart-3","--chart-4","--chart-5","--danger","--default-foreground","--focus","--foreground","--muted","--success","--surface","--surface-secondary","--warning"],q=["color","display","dominant-baseline","fill","fill-opacity","font-family","font-size","font-style","font-weight","letter-spacing","opacity","paint-order","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","vector-effect","visibility"];function $(t){if(!t||t.trim().endsWith("%"))return 0;let e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:0}function W(t){let e=t.getAttribute("viewBox")?.trim().split(/[ ,]+/).map(Number);return{height:e?.length===4&&Number.isFinite(e[3])?Math.max(0,e[3]):0,width:e?.length===4&&Number.isFinite(e[2])?Math.max(0,e[2]):0}}function X(t,e){let a=[t,...Array.from(t.querySelectorAll("*"))],r=[e,...Array.from(e.querySelectorAll("*"))];a.forEach((n,i)=>{let o=r[i];if(!o)return;let s=getComputedStyle(n),m=q.flatMap(c=>{let u=s.getPropertyValue(c).trim();return u?[`${c}:${u}`]:[]});m.length!==0&&o.setAttribute("style",[o.getAttribute("style"),...m].filter(Boolean).join(";"))})}function O(t){let e=t.closest('[data-slot="agent-ui-card"]'),a=e?.querySelector('[data-slot="agent-ui-chart"] svg');if(!(e instanceof HTMLElement)||!(a instanceof SVGElement))return null;let r=a.cloneNode(!0),n=a.closest('[data-slot="agent-ui-chart"]')?.getAttribute("aria-label")?.trim(),i=a.getBoundingClientRect(),o=W(a),s=Math.max(1,Math.round(i.width||$(a.getAttribute("width"))||o.width)),m=Math.max(1,Math.round(i.height||$(a.getAttribute("height"))||o.height)),c=getComputedStyle(e),u=J.flatMap(g=>{let f=c.getPropertyValue(g).trim();return f?[`${g}:${f}`]:[]}).join(";");if(X(a,r),r.removeAttribute("aria-hidden"),r.setAttribute("role","img"),n){let g=document.createElementNS("http://www.w3.org/2000/svg","title");g.textContent=n,r.prepend(g),r.setAttribute("aria-label",n)}return r.setAttribute("xmlns","http://www.w3.org/2000/svg"),r.setAttribute("height",String(m)),r.setAttribute("width",String(s)),r.hasAttribute("viewBox")||r.setAttribute("viewBox",`0 0 ${s} ${m}`),r.setAttribute("style",[r.getAttribute("style"),u].filter(Boolean).join(";")),{height:m,markup:new XMLSerializer().serializeToString(r),width:s}}async function Y(t,e){let a=O(t);if(!a||typeof Image>"u"||typeof URL.createObjectURL!="function")return;let r=URL.createObjectURL(new Blob([a.markup],{type:"image/svg+xml;charset=utf-8"})),n=new Image;await new Promise((c,u)=>{n.onload=()=>c(),n.onerror=()=>{URL.revokeObjectURL(r),u(new Error("Unable to render component image"))},n.src=r}),URL.revokeObjectURL(r);let i=document.createElement("canvas"),o=Math.max(1,window.devicePixelRatio||1);i.width=a.width*o,i.height=a.height*o;let s=i.getContext("2d");if(!s)return;s.scale(o,o),s.drawImage(n,0,0,a.width,a.height);let m=await new Promise(c=>i.toBlob(c,"image/png"));m&&k(m,"image/png",w(e,"png"))}function K(t,e,a){if(a==="csv"){let r=S(e);r&&k(r,"text/csv;charset=utf-8",w(e.title,"csv"))}else if(a==="svg"){let r=O(t);r&&k(r.markup,"image/svg+xml;charset=utf-8",w(e.title,"svg"))}else Y(t,e.title).catch(()=>{})}async function wt(t,e){let a=e==="json"?JSON.stringify(t,null,2):t.kind==="data-table"?H(t):t.kind==="record-card"?[t.title,t.description,t.status?.label,...t.fields.map(r=>`${r.label}: ${r.value}`)].filter(Boolean).join(`
4
4
  `):t.kind==="product-card"?[t.title,t.description,...t.products.flatMap(r=>[[r.name,r.meta].filter(Boolean).join(" \xB7 "),`${r.price.currency??"USD"} ${r.price.amount}`,r.rating?`Rated ${r.rating.value}/5${r.rating.count===void 0?"":` (${r.rating.count})`}`:void 0])].filter(Boolean).join(`
@@ -0,0 +1 @@
1
+ import{a as h}from"./chunk-CR3H7AVI.js";import{useCallback as A,useEffect as C,useRef as f}from"react";import{jsx as R}from"react/jsx-runtime";function E({children:e,className:t,offset:r=0,size:i=32,style:l,...d}){let p=f(null),a=f(null),s=f(null),c=A(()=>{let n=p.current;if(!n)return;let u=n.scrollLeft>r,y=n.scrollLeft+n.clientWidth+r<n.scrollWidth,m=u&&y?"both":u?"left":y?"right":"none";a.current!==m&&(a.current=m,s.current!==null&&cancelAnimationFrame(s.current),s.current=requestAnimationFrame(()=>{s.current=null,delete n.dataset.leftScroll,delete n.dataset.rightScroll,delete n.dataset.leftRightScroll,m==="both"?n.dataset.leftRightScroll="true":m!=="none"&&(n.dataset[`${m}Scroll`]="true")}))},[r]);return C(()=>{let n=p.current;if(!n)return;c(),n.addEventListener("scroll",c,{passive:!0});let u=typeof ResizeObserver>"u"?null:new ResizeObserver(c);return u?.observe(n),()=>{n.removeEventListener("scroll",c),u?.disconnect(),s.current!==null&&cancelAnimationFrame(s.current),s.current=null,a.current=null}},[c]),R("div",{ref:p,className:h("aui-scroll-shadow",t),"data-slot":"agent-ui-scroll-shadow",style:{"--scroll-shadow-size":`${i}px`,...l},...d,children:e})}import{jsx as H}from"react/jsx-runtime";function J({className:e,size:t="sm",variant:r="secondary",...i}){return H("button",{className:h("aui-button",e),"data-size":t,"data-slot":"agent-ui-action-button","data-variant":r,type:"button",...i})}import{Button as M}from"@heroui/react";import{useEffect as b,useLayoutEffect as x,useRef as w,useState as L}from"react";import v from"dompurify";function S(e){return v.sanitize(e,{RETURN_DOM_FRAGMENT:!0,USE_PROFILES:{html:!0}})}function ee(e){return v.sanitize(e,{RETURN_DOM_FRAGMENT:!0,USE_PROFILES:{html:!0,svg:!0,svgFilters:!0}})}import{jsx as o,jsxs as g}from"react/jsx-runtime";var N=2e3,k="github-dark",z="github-light",T={bash:()=>import("shiki/langs/bash.mjs"),css:()=>import("shiki/langs/css.mjs"),html:()=>import("shiki/langs/html.mjs"),javascript:()=>import("shiki/langs/javascript.mjs"),json:()=>import("shiki/langs/json.mjs"),jsx:()=>import("shiki/langs/jsx.mjs"),markdown:()=>import("shiki/langs/markdown.mjs"),python:()=>import("shiki/langs/python.mjs"),shellscript:()=>import("shiki/langs/shellscript.mjs"),sql:()=>import("shiki/langs/sql.mjs"),tsx:()=>import("shiki/langs/tsx.mjs"),typescript:()=>import("shiki/langs/typescript.mjs")},_=new Map;function P(e){let t={js:"javascript",md:"markdown",py:"python",sh:"shellscript",shell:"shellscript",ts:"typescript"},r=e.toLowerCase();return r in T?r:t[r]??null}async function B(e){let[{createHighlighterCore:t},{createJavaScriptRegexEngine:r},i,l,d]=await Promise.all([import("shiki/core"),import("shiki/engine/javascript"),import("shiki/themes/github-light.mjs"),import("shiki/themes/github-dark.mjs"),T[e]()]);return t({engine:r(),langs:[d.default],themes:[i.default,l.default]})}async function F(e,t){let r=P(t);if(!r)return null;let i=_.get(r),l=i??B(r);return i||_.set(r,l),(await l).codeToHtml(e,{defaultColor:!1,lang:r,themes:{dark:k,light:z}})}async function D(e){try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.append(t),t.select();try{return document.execCommand?.("copy")??!1}catch{return!1}finally{t.remove()}}}function O({html:e}){let t=w(null);return x(()=>{let r=t.current;if(r)return r.replaceChildren(S(e)),()=>r.replaceChildren()},[e]),o("div",{ref:t,className:"aui-code__content","data-slot":"agent-ui-code"})}function V(){return o("svg",{"aria-hidden":"true",fill:"none",viewBox:"0 0 16 16",children:o("path",{clipRule:"evenodd",d:"M10.218 3.216a.75.75 0 0 0-1.436-.431l-3 10a.75.75 0 0 0 1.436.43zM4.53 4.97a.75.75 0 0 1 0 1.06L2.56 8l1.97 1.97a.75.75 0 0 1-1.06 1.06l-2.5-2.5a.75.75 0 0 1 0-1.06l2.5-2.5a.75.75 0 0 1 1.06 0m6.94 6.06a.75.75 0 0 1 0-1.06L13.44 8l-1.97-1.97a.75.75 0 0 1 1.06-1.06l2.5 2.5a.75.75 0 0 1 0 1.06l-2.5 2.5a.75.75 0 0 1-1.06 0",fill:"currentColor",fillRule:"evenodd"})})}function U(){return o("svg",{"aria-hidden":"true",fill:"none",viewBox:"0 0 16 16",children:o("path",{clipRule:"evenodd",d:"M12 2.5H8A1.5 1.5 0 0 0 6.5 4v1H8a3 3 0 0 1 3 3v1.5h1A1.5 1.5 0 0 0 13.5 8V4A1.5 1.5 0 0 0 12 2.5M11 11h1a3 3 0 0 0 3-3V4a3 3 0 0 0-3-3H8a3 3 0 0 0-3 3v1H4a3 3 0 0 0-3 3v4a3 3 0 0 0 3 3h4a3 3 0 0 0 3-3zM4 6.5h4A1.5 1.5 0 0 1 9.5 8v4A1.5 1.5 0 0 1 8 13.5H4A1.5 1.5 0 0 1 2.5 12V8A1.5 1.5 0 0 1 4 6.5",fill:"currentColor",fillRule:"evenodd"})})}function G(){return o("svg",{"aria-hidden":"true",fill:"none",viewBox:"0 0 16 16",children:o("path",{clipRule:"evenodd",d:"M13.488 3.43a.75.75 0 0 1 .081 1.058l-6 7a.75.75 0 0 1-1.1.042l-3.5-3.5A.75.75 0 0 1 4.03 6.97l2.928 2.927 5.473-6.385a.75.75 0 0 1 1.057-.081",fill:"currentColor",fillRule:"evenodd"})})}function ie({code:e,language:t="text"}){let r=`${t}:${e}`,[i,l]=L(null),[d,p]=L(!1),a=w(null);b(()=>{let c=!1;async function n(){try{let u=await F(e,t);c||l(u?{html:u,key:r}:null)}catch{c||l(null)}}return n(),()=>{c=!0}},[e,r,t]),b(()=>()=>{a.current!==null&&window.clearTimeout(a.current)},[]);let s=async()=>{await D(e)&&(p(!0),a.current!==null&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>{p(!1),a.current=null},N))};return g("div",{className:"aui-code","data-slot":"agent-ui-code-block",children:[g("header",{className:"aui-code__header","data-slot":"agent-ui-code-header",children:[g("span",{className:"aui-code__language",children:[o(V,{}),o("span",{children:t.toUpperCase()})]}),o(M,{isIconOnly:!0,"aria-label":d?"Code copied":"Copy code",className:"aui-code__copy","data-slot":"agent-ui-code-copy",size:"sm",variant:"ghost",onPress:s,children:g("span",{className:"aui-code__copy-swap","data-copied":d||void 0,"data-slot":"agent-ui-code-copy-icon",children:[o("span",{className:"aui-code__copy-icon aui-code__copy-icon--copy",children:o(U,{})}),o("span",{className:"aui-code__copy-icon aui-code__copy-icon--check",children:o(G,{})})]})})]}),i?.key===r?o(O,{html:i.html}):o("div",{className:"aui-code__content","data-slot":"agent-ui-code",children:o("pre",{children:o("code",{children:e})})})]})}export{J as a,E as b,ee as c,ie as d};
@@ -0,0 +1,2 @@
1
+ import{b as ue,e as me,f as pe}from"./chunk-4JEZZR5J.js";var Ct="1.0.0-beta.2",ge="https://api.heroui.pro";import{jsx as Ge,jsxs as Ke}from"react/jsx-runtime";function Nt({indicator:e,label:t="Loading agent\u2026"}){return Ke("div",{"aria-live":"polite",className:"ha-agent-loading",role:"status",children:[e,Ge("span",{children:t})]})}import{jsx as he,jsxs as $e}from"react/jsx-runtime";function q({children:e,shortcut:t}){return $e("span",{"aria-hidden":"true",className:"ha-control-tooltip",children:[he("span",{children:e}),t?he("kbd",{className:"ha-control-tooltip__shortcut",children:t}):null]})}import{ChevronsCollapseUpRight as je,ChevronsExpandUpRight as Ze}from"@gravity-ui/icons";import{useCallback as be,useEffect as j,useEffectEvent as Je,useLayoutEffect as Qe,useRef as ie,useState as Z}from"react";function fe(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 Ae(e,t){let n=Number.NaN;try{n=Number(localStorage.getItem(fe(e))??Number.NaN)}catch{}return re(Number.isFinite(n)?n:420,t)}function ae(e,t){try{localStorage.setItem(fe(e),String(Math.round(t)))}catch{}}import{jsx as u,jsxs as P}from"react/jsx-runtime";function et(e,t){return e===!1?!1:e===void 0||e===!0||!(t instanceof Element)?!0:e(t)}function Bt({actionsSlot:e,agentId:t,children:n,defaultExpanded:o=!1,expandable:r=!0,expandedSidebarSlot:A,expandedTitle:T,historySlot:i,keepMounted:c=!1,name:p,onClose:N,onNewConversation:U,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=Je(N),[b,M]=Z(o),R=z!==null,H=z??!1,L=V==="floating",D=!L&&!H,g=H||D&&b,[C,s]=Z(!1),h=!H&&r,w=D&&b&&A;return Qe(()=>{let a=window.matchMedia?.("(max-width: 639px)");if(!a)return;let f=()=>G(a.matches);return f(),a.addEventListener?.("change",f),()=>a.removeEventListener?.("change",f)},[]),j(()=>{if(!C)return;let a=d.current;if(!a)return;let f=()=>s(!1),S=K=>{let{propertyName:m,target:v}=K;v===a&&(m!=="width"&&m!=="height"||f())},oe=window.setTimeout(f,600);return a.addEventListener("transitionend",S),()=>{window.clearTimeout(oe),a.removeEventListener("transitionend",S)}},[C]),j(()=>{if(!y||!R)return;let a=d.current;if(!a)return;let f=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 m=document.documentElement,v=window.scrollX,F=window.scrollY,$=m.style.overflow,X=document.body.style.overflow,Y=document.body.style.position,We=document.body.style.top,Ue=document.body.style.left,Ve=document.body.style.right,ze=document.body.style.width;m.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=()=>{m.style.overflow=$,document.body.style.overflow=X,document.body.style.position=Y,document.body.style.top=We,document.body.style.left=Ue,document.body.style.right=Ve,document.body.style.width=ze,window.scrollTo(v,F)}}let oe=a.querySelector("button,textarea,input,[tabindex]:not([tabindex='-1'])");a.contains(document.activeElement)||oe?.focus();let K=m=>{if(!g&&m.key==="Escape"){if(ye(a)){_.current=Date.now(),m.preventDefault(),m.stopPropagation();return}m.preventDefault(),I();return}if(!g||m.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],$=v[v.length-1],X=a.getRootNode(),Y=X instanceof ShadowRoot?X.activeElement:document.activeElement;m.shiftKey&&Y===F?(m.preventDefault(),$.focus()):!m.shiftKey&&Y===$&&(m.preventDefault(),F.focus())};return a.addEventListener("keydown",K),()=>{a.removeEventListener("keydown",K),typeof a.close=="function"?a.close():a.open=!1,S?.(),document.activeElement===document.body&&f?.focus()}},[g,y,R]),j(()=>{if(!y||!L||g)return;let a=d.current;if(!a)return;let f=S=>{S.composedPath().includes(a)||et(E,S.target)&&I()};return document.addEventListener("click",f,!0),()=>document.removeEventListener("click",f,!0)},[g,L,y,E]),!y&&!c?null:P("dialog",{ref:d,"aria-label":p,"aria-modal":g,className:"ha-panel","data-agent-overlay-root":"","data-expanded":!H&&b?"true":void 0,"data-expanded-sidebar":w?"true":void 0,"data-resizing":C?"true":void 0,hidden:!y,onCancel:a=>{if(a.preventDefault(),Date.now()-_.current<350||ye(d.current)){_.current=Date.now();return}N()},children:[D&&!b?u(tt,{agentId:t,panelRef:d}):null,w?u("aside",{"aria-label":"Chat history",className:"ha-expanded-sidebar",children:A}):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??p}):i??u("strong",{children:p}),x?u("span",{className:"ha-beta-badge",children:"Beta"}):null]}),P("div",{className:"ha-header-actions",children:[w?null:e??(U?u("button",{"aria-label":"New chat",className:"ha-icon-button ha-new-chat-button",type:"button",onClick:U,children:u(ot,{})}):null),h?u("button",{"aria-expanded":b,"aria-label":b?"Collapse assistant":"Expand assistant",className:"ha-expand-button ha-icon-button",type:"button",onClick:()=>{s(!0),M(a=>!a)},children:b?u(je,{"aria-hidden":"true"}):u(Ze,{"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(nt,{}),u(q,{shortcut:"ESC",children:"Close assistant"})]})]})]}),n,u("div",{className:"ha-overlay-portal","data-agent-overlay-portal":""})]})]})}function ye(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 tt({agentId:e,panelRef:t}){let[n,o]=Z(420),r=ie(null),A=be(i=>{let c=t.current,p=c?.getRootNode();(p instanceof ShadowRoot?p.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]);j(()=>{o(Ae(e,window.innerWidth))},[e]);let T=be((i,c)=>{let p=re(i,window.innerWidth);return A(p),c&&ae(e,p),p},[A,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 nt(){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 ot(){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 ve(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,rt=10080*60*1e3,Q=new Map;function Te(e){return`heroui-agent:shell-draft:${e}:composer-draft:v1`}function le(e,t){try{let n=Te(e);t.trim()?localStorage.setItem(n,JSON.stringify({prompt:t,savedAt:Date.now()})):localStorage.removeItem(n)}catch{}}function at(e){let t=Te(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<=rt)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=at(e);return n?{prompt:n,submitted:!1}:void 0}function xe(e,t,n){let o=O.get(e);!o?.submitted||o.messageId!==t||o.firstFeedbackPaintedAt!==void 0||O.set(e,{...o,firstFeedbackPaintedAt:n})}function Vt(e){let t=ce(e);return O.delete(e),le(e,""),t}function zt(e,t){se.set(e,t)}function Gt(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 we(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 Se(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 it(e){return J.get(e)??[]}function $t(e){let t=it(e);return J.delete(e),t}function Ee(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function st(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 lt(e){let t=getComputedStyle(e);return Ee(t.paddingTop)+Ee(t.paddingBottom)}function ct(e){let t=e.style.height,n=e.style.minHeight,o=e.style.maxHeight;e.style.height="0px",e.style.minHeight="0px",e.style.maxHeight="none";let r=e.scrollHeight;return e.style.height=t,e.style.minHeight=n,e.style.maxHeight=o,r}function dt(e){if(e.value.includes(`
2
+ `))return!0;if(e.clientWidth===0)return!1;let t=ct(e),n=lt(e),o=st(e);return Math.max(0,t-n)>o*1.5}function Me(e,{hasAttachments:t=!1,maxHeight:n=120}={}){if(!e)return!1;let o=e.value.length>0;return t||o&&dt(e)?(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,n)}px`,!0):(e.style.height="auto",!1)}function Ce(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 ke}from"react/jsx-runtime";var ut="https://heroui.pro/?utm_source=heroui-agent&utm_medium=referral&utm_campaign=powered-by-hero";function Ne(){return ke("a",{"aria-label":"Powered by HeroUI Pro (opens in a new tab)",className:"ha-powered-by",href:ut,rel:"noopener noreferrer",target:"_blank",children:[de("span",{children:"Powered by"}),ke("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 Re=new Set(["ask","auto","full"]);function te(e){return Re.has(e)?e:"auto"}function Zt(e,t){return`${e}:permission-mode:${t}:v1`}function Jt(e,t){return`${e}:active-permission-mode:${t}:v1`}function Qt(e){try{let t=localStorage.getItem(e);return t!==null&&Re.has(t)?te(t):void 0}catch{return}}function en(e,t){try{localStorage.setItem(e,t)}catch{}}function tn(e){try{localStorage.removeItem(e)}catch{}}function nn(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 He(e){return`heroui-agent:anonymous:${e}`}function mt(e){return e instanceof Error?e:new Error("Auth token request failed")}var Pe=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(He(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=pt(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),A=>A.toString(16).padStart(2,"0")).join("").slice(0,24)}anonymousId(){let t=He(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 pt(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 gt={"application/json":"json","application/pdf":"pdf","image/gif":"gif","image/jpeg":"jpg","image/png":"png","image/webp":"webp","text/csv":"csv","text/markdown":"md","text/plain":"txt","text/tab-separated-values":"tsv"},ne=Object.freeze(Object.keys(gt)),an=ne.join(","),ht=new Set(ne);function Oe(e){return ht.has(e.trim().toLowerCase())}import{useId as ft}from"react";import{jsx as _e,jsxs as At}from"react/jsx-runtime";function Ie({children:e,className:t,...n}){let o=`ha-shimmer-${ft().replaceAll(":","")}`,r={"--_ha-firefox-mask":`-moz-element(#${o})`};return At("span",{...n,className:`ha-shimmer${t?` ${t}`:""}`,children:[_e("span",{className:"ha-shimmer__text",id:o,children:e}),_e("span",{inert:!0,"aria-hidden":"true",className:"ha-shimmer__highlight",style:r,children:e})]})}import{useCallback as bt,useEffect as yt,useLayoutEffect as Le,useRef as vt,useState as W}from"react";import{Fragment as De,jsx as l,jsxs as k}from"react/jsx-runtime";function An({agentId:e,composerConnecting:t=!1,composerControlsAvailable:n,composerControlsRevealed:o,composerEndSlot:r,composerFooterSlot:A,composerStartSlot:T,greeting:i,onComposerControlsReveal:c,onIntent:p,placeholder:N,subtitle:U="Live answers with charts, metrics, and tables.",suggestedPrompts:y}){let[E]=W(()=>ce(e)),[x,V]=W(()=>E?.submitted?"":E?.prompt??""),[d,_]=W(()=>E?.submitted?E:null),[z,G]=W(!1),[I,b]=W(!1),M=vt(null),R=n??!!(T||r),H=o??(R&&z),L=s=>{B(e,!0,s.currentTarget),G(R),R&&c?.(),p()},D=s=>{let h=s.currentTarget.querySelector(".ha-composer");h&&Se(h,s.relatedTarget)||(G(!1),B(e,!1))},g=bt(s=>{b(Me(s))},[]);Le(()=>(we(e,M.current),g(M.current),Ce(M.current,g)),[e,g]),yt(()=>{d||ee(e,{prompt:x,submitted:!1})},[x,e,d]),Le(()=>{if(!d)return;let s=requestAnimationFrame(h=>{xe(e,d.messageId,h)});return()=>cancelAnimationFrame(s)},[e,d]);let C=(s,h=!0)=>{if(d)return;let w=ve(s,{generateConversationTitle:h});w&&(_(w),V(""),b(!1),M.current.style.height="auto",ee(e,w),p())};return k(De,{children:[l("div",{className:"ha-conversation",children:l("div",{"aria-live":"polite",className:"ha-messages",role:"log",children:d?k(De,{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(Ie,{"aria-hidden":"true",children:"Thinking\u2026"})})})})]}):k("div",{className:"ha-empty",children:[l("h2",{children:i}),l("p",{children:U})]})})}),k("form",{className:"ha-composer-wrap",onBlur:D,onSubmit:s=>{s.preventDefault(),C(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:()=>C(s,!1),children:[l("span",{children:s}),l(xt,{})]},s))}):null,k("div",{className:"@container ha-composer","data-connecting":t||void 0,"data-controls-revealed":H||I||void 0,"data-expanded":I||void 0,children:[T,l("textarea",{ref:M,"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 h=s.currentTarget.value;ee(e,{prompt:h,submitted:!1}),B(e,!0,s.currentTarget),V(h),g(s.currentTarget),p()},onKeyDown:s=>{s.key!=="Enter"||s.shiftKey||(s.preventDefault(),C(x))}}),r,k("button",{"aria-label":"Send message",className:"ha-send",disabled:!x.trim()||!!d,type:"submit",children:[l(Tt,{}),l(q,{shortcut:"\u21B5",children:"Send message"})]})]}),l("div",{className:"ha-composer-footer","data-revealed":!!A||void 0,children:l("div",{className:"ha-composer-footer-content",children:A})}),l(Ne,{})]})]})}function Tt(){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 xt(){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 wt={animation:"fadeIn",duration:160,easing:"ease-out",sep:"word",stagger:18};function Fe(e){return typeof e=="number"?Number.isFinite(e)?`${Math.round(e)}px`:void 0:e?.trim()||void 0}function St(e){let t=Fe(e?.initialWidth),n=Fe(e?.initialHeight);return{...t?{"--ha-panel-width":t}:{},...n?{"--ha-panel-height":n}:{}}}function Be(e){return e===void 0||!Number.isFinite(e)?24:Math.min(Math.max(Math.round(e),0),200)}function Et(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();Oe(o)&&t.add(o)}return[...t]}function Sn(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=Et(e.appearance?.zIndex);return{apiBaseUrl:(e._api?.baseUrl??ge).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:ue(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??wt,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:St(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:Be(e.appearance.launcher.offset.x),y:Be(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:{...pe(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{Pe as a,Ct as b,ge as c,Nt as d,q as e,Ae as f,Bt as g,gt as h,ne as i,Oe as j,ve as k,ee as l,ce as m,Vt as n,zt as o,Gt as p,B as q,we as r,Se as s,Kt as t,it as u,$t as v,Me as w,Ce as x,Ne as y,Ie as z,An as A,Zt as B,Jt as C,Qt as D,en as E,tn as F,nn as G,wt as H,Sn as I};
@@ -0,0 +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};
@@ -0,0 +1 @@
1
+ import{a as u}from"./chunk-CR3H7AVI.js";import{useContext as v}from"react";import{createContext as N}from"react";var r=N({});import{useContext as h}from"react";function C(a="main"){return h(r)[a]}import{jsx as t,jsxs as s}from"react/jsx-runtime";function _({children:a,componentVariant:e,variant:o}){let n=v(r);return t(r,{value:{component:e??n.component,main:o??n.main},children:a})}function g({actions:a,children:e,className:o,"data-component-kind":n,description:d,footer:i,legend:p,title:c,variant:V,variantScope:l="main"}){let f=C(l),m=c!=null||d!=null||p!=null||a!=null,x=f??V??"surface";return s("section",{className:u("aui-card",o),"data-component-kind":n,"data-has-footer":i!=null,"data-has-header":m,"data-slot":"agent-ui-card","data-variant":x,"data-variant-scope":l,children:[m?s("header",{className:"aui-card__header","data-has-actions":a!=null,"data-slot":"agent-ui-card-header",children:[s("span",{className:"aui-card__heading","data-slot":"agent-ui-card-heading",children:[c!=null?t("span",{className:"aui-card__title","data-slot":"agent-ui-card-title",children:c}):null,d!=null?t("span",{className:"aui-card__description","data-slot":"agent-ui-card-description",children:d}):null]}),a!=null?t("span",{className:"aui-card__actions","data-slot":"agent-ui-card-actions",children:a}):null,p]}):null,t("div",{className:"aui-card__content","data-slot":"agent-ui-card-content",children:e}),i!=null?t("footer",{className:"aui-card__footer","data-slot":"agent-ui-card-footer",children:i}):null]})}export{C as a,_ as b,g as c};
@@ -0,0 +1 @@
1
+ import{a as y}from"./chunk-MXXCR5SR.js";import{a as b}from"./chunk-CR3H7AVI.js";import{Hand as T,LockOpen as w,ShieldCheck as N}from"@gravity-ui/icons";import{Description as I,Label as x,ListBox as d,Select as o}from"@heroui/react";import{useCallback as R,useEffect as D,useRef as c,useState as h}from"react";import{jsx as r,jsxs as s}from"react/jsx-runtime";var A=[{description:"Ask before every client tool action.",icon:T,id:"ask",label:"Ask for approval"},{description:"Only ask for actions marked as needing approval.",icon:N,id:"auto",label:"Approve for me"},{description:"Run client tools without asking for approval.",icon:w,id:"full",label:"Full access"}];function H({"aria-label":t="Tool permissions",className:n,defaultOpen:g=!1,isDisabled:p=!1,onChange:v,value:a}){let[k,m]=h(g),[C,E]=h(),u=c(!1),P=c(0),l=c(g&&typeof document<"u"&&document.activeElement instanceof HTMLElement?document.activeElement:null),_=c(null),M=A.find(e=>e.id===a),O=R(e=>{_.current=e,e?.setAttribute("aria-keyshortcuts","Control+Shift+P"),E(y(e))},[]),S=()=>{let e=l.current;l.current=null,e?.focus({preventScroll:!0}),requestAnimationFrame(()=>{queueMicrotask(()=>e?.focus({preventScroll:!0}))})},L=e=>{!e&&!u.current&&!k&&Date.now()-P.current<350||(e||S(),m(e),u.current=!1)};return D(()=>{if(p)return;let e=i=>{i.defaultPrevented||i.isComposing||i.repeat||!i.ctrlKey||!i.shiftKey||i.altKey||i.metaKey||i.key.toLowerCase()!=="p"||(i.preventDefault(),_.current?.focus(),m(!0))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[p]),s(o,{"aria-label":t,className:b("aui-permission-picker",n),"data-tone":a==="full"?"warning":void 0,isDisabled:p,isOpen:k,value:a,onOpenChange:L,onChange:e=>{e!=null&&v(e),S(),m(!1)},children:[s(o.Trigger,{ref:O,className:"aui-permission-picker__trigger","data-shortcut":"\u2303\u21E7P","data-slot":"agent-ui-permission-picker-trigger","data-tooltip":"Change permissions",onPointerDown:e=>{let i=e.currentTarget.getAttribute("aria-expanded")==="true";e.preventDefault(),u.current=i,i?l.current?.focus({preventScroll:!0}):l.current=document.activeElement instanceof HTMLElement?document.activeElement:null,i||(P.current=Date.now())},children:[r(N,{"aria-hidden":"true",className:"aui-permission-picker__trigger-icon"}),r(o.Value,{className:"aui-permission-picker__value",children:M?.label??a}),r(o.Indicator,{className:"aui-permission-picker__indicator"}),s("span",{"aria-hidden":"true",className:"aui-picker-tooltip",children:[r("span",{children:"Change permissions"}),r("kbd",{className:"aui-picker-tooltip__shortcut",children:"\u2303\u21E7P"})]})]}),r(o.Popover,{className:"aui-permission-picker__popover",placement:"top start",UNSTABLE_portalContainer:C,children:r(d,{"aria-label":`${t} options`,className:"aui-permission-picker__list",children:A.map(e=>{let i=e.icon;return s(d.Item,{className:"aui-permission-picker__option","data-description":e.description,"data-tone":e.id==="full"?"warning":void 0,id:e.id,textValue:e.label,children:[r(i,{"aria-hidden":"true",className:"aui-permission-picker__option-icon"}),s("span",{className:"aui-permission-picker__option-copy",children:[r(x,{className:"aui-permission-picker__option-label",children:e.label}),r(I,{className:"aui-permission-picker__option-description",title:e.description,children:e.description})]}),r(d.ItemIndicator,{className:"aui-permission-picker__option-indicator"})]},e.id)})})})]})}var f=new Map;function $(t,n){f.set(t,n)}function z(t){let n=f.get(t);return f.delete(t),n}export{H as a,$ as b,z as c};
@@ -0,0 +1 @@
1
+ function n(e){if(!e)return;let o=e.closest("[data-agent-overlay-root], dialog");if(o)return o.querySelector("[data-agent-overlay-portal]")??o;let t=e.getRootNode();return typeof ShadowRoot<"u"&&t instanceof ShadowRoot?t:void 0}export{n as a};
@@ -0,0 +1 @@
1
+ import{a as $}from"./chunk-MXXCR5SR.js";import{a as S}from"./chunk-CR3H7AVI.js";import{Description as R,Label as A,ListBox as w,Select as m}from"@heroui/react";import{useCallback as q,useEffect as F,useRef as b,useState as O}from"react";import{useId as D}from"react";import{jsx as e,jsxs as p}from"react/jsx-runtime";function _({className:t,provider:i}){let o=i?.toLowerCase();return o==="openai"?e(N,{className:t,"data-provider":"openai"}):o==="google"?e(T,{className:t,"data-provider":"google"}):o==="anthropic"?e(C,{className:t,"data-provider":"anthropic"}):o==="moonshot ai"?e(E,{className:t,"data-provider":"moonshot-ai"}):null}function N(t){return e("svg",{"aria-hidden":"true",fill:"currentColor",focusable:"false",role:"presentation",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...t,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 T(t){let i=D().replace(/:/g,""),o=`${i}-gemini-shape`,h=`${i}-gemini-mask`,v=`${i}-gemini-yellow-blur`,a=`${i}-gemini-red-blur`,d=`${i}-gemini-green-blur`,s=`${i}-gemini-blue-blur`,f=`${i}-gemini-gold-blur`,c=`${i}-gemini-cyan-blur`,y=`${i}-gemini-violet-blur`,x=`${i}-gemini-coral-blur`,u=`${i}-gemini-lemon-blur`;return p("svg",{"aria-hidden":"true",fill:"none",focusable:"false",role:"presentation",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",...t,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})}),p("g",{fill:"none",children:[p("g",{mask:`url(#${h})`,transform:"translate(2 2)scale(.4375)",children:[e("use",{href:`#${o}`}),e("g",{filter:`url(#${v})`,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(#${d})`,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(#${d})`,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(#${s})`,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(#${c})`,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(#${y})`,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(#${x})`,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(#${u})`,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)"})})]}),p("defs",{children:[e("filter",{colorInterpolationFilters:"sRGB",filterUnits:"userSpaceOnUse",height:"42.756",id:v,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:d,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:s,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:c,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:y,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:x,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:u,width:"55.137",x:"-14.173",y:"20.474",children:e("feGaussianBlur",{stdDeviation:"7.273"})}),e("mask",{height:"64",id:h,maskUnits:"userSpaceOnUse",width:"64",x:"0",y:"0",children:e("use",{href:`#${o}`})})]})]})]})}function C(t){return e("svg",{"aria-hidden":"true",fill:"none",focusable:"false",role:"presentation",viewBox:"0 0 256 257",xmlns:"http://www.w3.org/2000/svg",...t,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 E(t){return p("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",...t,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 n,jsxs as g}from"react/jsx-runtime";function z({description:t,provider:i}){return i?t?`${i} \xB7 ${t}`:i:t}function V({"aria-label":t="AI model",className:i,defaultOpen:o=!1,isDisabled:h=!1,onChange:v,options:a,placement:d="top start",value:s}){let[f,c]=O(o),[y,x]=O(),u=b(!1),B=b(0),k=b(o&&typeof document<"u"&&document.activeElement instanceof HTMLElement?document.activeElement:null),P=b(null),I=h||a.length===0,G=a.find(r=>r.id===s),L=q(r=>{P.current=r,r?.setAttribute("aria-keyshortcuts","Control+Shift+M"),x($(r))},[]),M=()=>{let r=k.current;k.current=null,r?.focus({preventScroll:!0}),requestAnimationFrame(()=>{queueMicrotask(()=>r?.focus({preventScroll:!0}))})},U=r=>{!r&&!u.current&&!f&&Date.now()-B.current<350||(r||M(),c(r),u.current=!1)};return F(()=>{if(I)return;let r=l=>{l.defaultPrevented||l.isComposing||l.repeat||!l.ctrlKey||!l.shiftKey||l.altKey||l.metaKey||l.key.toLowerCase()!=="m"||(l.preventDefault(),P.current?.focus(),c(!0))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[I]),g(m,{"aria-label":t,className:S("aui-model-picker",i),isDisabled:I,isOpen:f,value:s,onOpenChange:U,onChange:r=>{r!=null&&v(r),M(),c(!1)},children:[g(m.Trigger,{ref:L,className:"aui-model-picker__trigger","data-shortcut":"\u2303\u21E7M","data-slot":"agent-ui-model-picker-trigger","data-tooltip":"Select model",onPointerDown:r=>{let l=r.currentTarget.getAttribute("aria-expanded")==="true";r.preventDefault(),u.current=l,l?k.current?.focus({preventScroll:!0}):k.current=document.activeElement instanceof HTMLElement?document.activeElement:null,l||(B.current=Date.now())},children:[n(m.Value,{className:"aui-model-picker__value",children:G?.label??s}),n(m.Indicator,{className:"aui-model-picker__indicator"}),g("span",{"aria-hidden":"true",className:"aui-picker-tooltip",children:[n("span",{children:"Select model"}),n("kbd",{className:"aui-picker-tooltip__shortcut",children:"\u2303\u21E7M"})]})]}),n(m.Popover,{className:"aui-model-picker__popover",placement:d,UNSTABLE_portalContainer:y,children:n(w,{"aria-label":`${t} options`,className:"aui-model-picker__list",children:a.map(r=>{let l=z(r);return g(w.Item,{className:"aui-model-picker__option","data-description":l,id:r.id,textValue:r.label,children:[n(_,{className:"aui-model-picker__option-icon",provider:r.provider}),g("span",{className:"aui-model-picker__option-copy",children:[n(A,{className:"aui-model-picker__option-label",children:r.label}),l?n(R,{className:"aui-model-picker__option-description",title:l,children:l}):null]}),n(w.ItemIndicator,{className:"aui-model-picker__option-indicator"})]},r.id)})})})]})}export{V as a};
@@ -0,0 +1 @@
1
+ var n=["moonshotai/Kimi-K3","openai/gpt-5.6-luna","openai/gpt-5.6-terra","openai/gpt-5.6-sol","google/gemini-3.7-flash","anthropic/claude-sonnet-5","anthropic/claude-opus-4.8"],t={"google/gemini-3.5-flash":"google/gemini-3.7-flash","google/gemini-3.6-flash":"google/gemini-3.7-flash"};function r(e){return t[e]??e}var a="google/gemini-3.7-flash",l=[{description:"Flagship model for coding, reasoning, and knowledge work",id:"moonshotai/Kimi-K3",label:"Kimi K3",provider:"Moonshot AI",tier:"light"},{description:"Fast answers and lightweight agent workflows",id:"openai/gpt-5.6-luna",label:"GPT-5.6 Luna",provider:"OpenAI",tier:"light"},{description:"Balanced reasoning for everyday agent tasks",id:"openai/gpt-5.6-terra",label:"GPT-5.6 Terra",provider:"OpenAI",tier:"codegen"},{description:"Deep reasoning for complex, multi-step analysis",id:"openai/gpt-5.6-sol",label:"GPT-5.6 Sol",provider:"OpenAI",tier:"complex"},{description:"Fast multimodal analysis with a large context window",id:"google/gemini-3.7-flash",label:"Gemini 3.7 Flash",provider:"Google",tier:"light"},{description:"Strong agentic reasoning and polished UI decisions",id:"anthropic/claude-sonnet-5",label:"Claude Sonnet 5",provider:"Anthropic",tier:"codegen"},{description:"Highest-capability Claude for difficult research and analysis",id:"anthropic/claude-opus-4.8",label:"Claude Opus 4.8",provider:"Anthropic",tier:"complex"}],s=new Set(n);function g(e){return typeof e=="string"&&s.has(e)}function d(e){let o=e?r(e):void 0;return l.find(i=>i.id===o)?.tier??"light"}export{n as a,t as b,r as c,a as d,l as e,g as f,d as g};