@heroui/agent 0.2.0-beta.7 → 0.2.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -2
- package/README.md +15 -10
- package/dist/chart-content-BBHQVMP4.js +1 -0
- package/dist/chunk-2XBFFSW2.js +1 -0
- package/dist/chunk-64RI74L5.js +1 -0
- package/dist/chunk-6ZJJN322.js +1 -0
- package/dist/chunk-7KCGPNEN.js +1 -0
- package/dist/chunk-BBB5EHDN.js +5 -0
- package/dist/chunk-CR3H7AVI.js +1 -0
- package/dist/chunk-HCLXS4HQ.js +1 -0
- package/dist/chunk-MXLGM4WV.js +1 -0
- package/dist/chunk-OA3TG5CS.js +1 -0
- package/dist/chunk-PZJ4NC3J.js +1 -0
- package/dist/chunk-RNNGE7KM.js +1 -0
- package/dist/chunk-S6OIAJSC.js +1 -0
- package/dist/chunk-SUDHJNTJ.js +2 -0
- package/dist/chunk-WUAFMD7Z.js +2 -0
- package/dist/component-renderer-GG6JVRUG.js +1 -0
- package/dist/composer-draft-NSKK65F3.js +1 -0
- package/dist/composer-image-draft-KAGTNQR7.js +1 -0
- package/dist/contracts.d.ts +50 -19
- package/dist/contracts.js +2 -2545
- package/dist/css/index.css +1 -1
- package/dist/embed-runtime-GYXK7V6N.js +5 -0
- package/dist/identity-3P8-17km.d.ts +95 -0
- package/dist/index.d.ts +46 -10
- package/dist/index.js +1 -28
- package/dist/interactive-map-surface-WC2LPCR7.js +1 -0
- package/dist/internal/client-tools.js +1 -0
- package/dist/internal/models.js +1 -0
- package/dist/internal/runtime.js +1 -0
- package/dist/internal/theme.js +1 -0
- package/dist/next.d.ts +2 -1
- package/dist/next.js +1 -22
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -260
- package/package.json +6 -6
- package/dist/chart-content-E4NPTUPR.js +0 -2696
- package/dist/chunk-3FG5NRTX.js +0 -9
- package/dist/chunk-6O3SFXJK.js +0 -325
- package/dist/chunk-FNGGMHVR.js +0 -625
- package/dist/chunk-OQGXZY5L.js +0 -1091
- package/dist/chunk-TOOT6SZ2.js +0 -74
- package/dist/chunk-V5S5FRGV.js +0 -984
- package/dist/chunk-VJA52U5P.js +0 -137
- package/dist/component-renderer-46EJDPTB.js +0 -10627
- package/dist/embed-runtime-UF7XJIFA.js +0 -7650
- package/dist/identity-Z6i6pL0F.d.ts +0 -166
- package/dist/interactive-map-surface-67KHT3VB.js +0 -362
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0-beta.9
|
|
4
|
+
|
|
5
|
+
- Reduce the published JavaScript footprint while preserving ESM code splitting, lazy UI tiers,
|
|
6
|
+
webpack prefetching, and downstream tree shaking.
|
|
7
|
+
|
|
8
|
+
## 0.2.0-beta.8
|
|
9
|
+
|
|
10
|
+
- Replace the HeroUI Agents Trigger.dev transport with a preconnected protocol-v6 Durable Object
|
|
11
|
+
WebSocket, resumable streaming, direct provider requests, and runtime-derived activity updates.
|
|
12
|
+
- Move conversation presence and transcript hydration onto the edge connection; InstantDB is now
|
|
13
|
+
an asynchronous monitoring projection rather than an interactive runtime dependency.
|
|
14
|
+
- Preload project configuration and the complete composer behind an immediately available launcher,
|
|
15
|
+
show a centered loading state on an early open, and expose readiness through `onReady` and the
|
|
16
|
+
reactive `useAgent().ready` status for custom entry points.
|
|
17
|
+
- Stabilize startup and composer presentation so the initial prompt appears immediately, controls
|
|
18
|
+
stay compact while bootstrapping, and the disclaimer remains visible.
|
|
19
|
+
- Bound live activity details and smooth status transitions during long-running turns.
|
|
20
|
+
|
|
3
21
|
## 0.2.0-beta.7
|
|
4
22
|
|
|
5
23
|
- Polish the activity trail with smoother status transitions, semantic summary icons, bounded
|
|
@@ -62,8 +80,8 @@
|
|
|
62
80
|
- Fold `renderUI` into `composeUI`, which now accepts either a single component or a layout tree as
|
|
63
81
|
its root. The component union is no longer declared to the model as a tool schema: it reads a
|
|
64
82
|
compact kind catalog and fetches the props it needs with `getComponentSchema`, which cut ~300 KB
|
|
65
|
-
(~76K tokens) of JSON Schema off every rendering request. `renderUI` and the
|
|
66
|
-
deferral it needed are gone
|
|
83
|
+
(~76K tokens) of JSON Schema off every rendering request. `renderUI` and the
|
|
84
|
+
`loadUIRenderers` deferral it needed are gone.
|
|
67
85
|
- Promote fourteen polished Storybook response compositions to validated Agent UI kinds, including
|
|
68
86
|
current weather, forecasts, flights, events, rides, playlists, commerce, messages, player stats,
|
|
69
87
|
notifications, and product-signal tabs.
|
package/README.md
CHANGED
|
@@ -174,16 +174,21 @@ Projects and API keys are managed in the [Agents dashboard](https://heroui.pro/d
|
|
|
174
174
|
|
|
175
175
|
## What runs where
|
|
176
176
|
|
|
177
|
-
The
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
and
|
|
181
|
-
|
|
182
|
-
|
|
177
|
+
The HeroUI API authenticates the visitor once, verifies conversation ownership, and returns a
|
|
178
|
+
one-use connection ticket. The browser then keeps a resumable WebSocket directly to the
|
|
179
|
+
conversation's Cloudflare Durable Object. That object owns the transcript, streams from the model
|
|
180
|
+
provider, and starts MCP or an offline, per-call-scoped sandbox only when a tool actually needs
|
|
181
|
+
one. Before the composer clears, the SDK durably stores the submitted turn and attachment blobs in
|
|
182
|
+
an identity-and-conversation-scoped IndexedDB outbox. It removes that entry only after the Durable
|
|
183
|
+
Object acknowledges committed admission, and reconciles the same `turnId` after a reload. InstantDB
|
|
184
|
+
is updated asynchronously for dashboard monitoring and never sits in front of a response stream.
|
|
185
|
+
|
|
186
|
+
| In the browser | At the HeroUI edge runtime |
|
|
183
187
|
| ------------------------------------------- | -------------------------------------------- |
|
|
184
|
-
| Panel, theme, composer, generated UI |
|
|
185
|
-
| Client tools, running as the signed-in user | Server tools, MCP
|
|
186
|
-
|
|
|
188
|
+
| Panel, theme, composer, generated UI | Conversation Durable Object and model stream |
|
|
189
|
+
| Client tools, running as the signed-in user | Server tools, lazy MCP and offline Python |
|
|
190
|
+
| Pre-admission IndexedDB turn outbox | SDK transcript and resumable stream storage |
|
|
191
|
+
| A short-lived HeroUI browser credential | Hashed tickets, credit lease, Queue outbox |
|
|
187
192
|
|
|
188
193
|
## Compatibility
|
|
189
194
|
|
|
@@ -192,7 +197,7 @@ and pseudonymous viewer identifiers, never messages or tool data.
|
|
|
192
197
|
- Chrome/Edge 120+, Firefox 121+, Safari 17.2+
|
|
193
198
|
- ESM only
|
|
194
199
|
|
|
195
|
-
This SDK speaks protocol version `
|
|
200
|
+
This SDK speaks protocol version `6`. The hosted API returns `426 Upgrade Required` when a beta SDK is no longer compatible.
|
|
196
201
|
|
|
197
202
|
## Support
|
|
198
203
|
|
|
@@ -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-BBB5EHDN.js";import{b as U}from"./chunk-S6OIAJSC.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 f=["base","brutalism","glass","mouve"];function S(e){return f.includes(e)?e:"base"}var m={accent:"accent",background:"background",foreground:"foreground",overlay:"overlay",surface:"surface",surfaceSecondary:"surface-secondary",tooltip:"tooltip"},h="oklch(from var(--ha-accent) clamp(0, (0.7 - l) * 1000, 1) 0 h)",l="oklch(from var(--ha-launcher-bg) clamp(0, (0.7 - l) * 1000, 1) 0 h)";function C(e){let r={},o=t(e,"light"),n=t(e,"dark");return o&&(r["--ha-theme-launcher-background-light"]=o,r["--ha-theme-launcher-foreground-light"]=l),n&&(r["--ha-theme-launcher-background-dark"]=n,r["--ha-theme-launcher-foreground-dark"]=l),r}var p="oklch(from var(--ha-card-secondary) calc(l - 0.0151) c h)",A="oklch(from var(--ha-card-secondary) calc(l + 0.017) c h)",d={pill:"0.875rem",round:"0.5rem",sharp:"0.125rem",soft:"0.375rem"},y=12,T=18;function u(e){let r=e?.trim();if(!(!r||r.length>256||/[;{}]/.test(r)))return r}function t(e,r){if(e!==void 0)return u(typeof e=="string"?e:e[r])}function k(e){if(!e)return{};let r={};e.radius&&e.radius in d&&(r["--radius"]=d[e.radius]);let o=u(e.typography?.fontFamily);o&&(r["--ha-font-family"]=o);let n=e.typography?.baseSize;if(typeof n=="number"&&Number.isFinite(n)){let a=Math.min(Math.max(Math.round(n),y),T);r["--ha-font-size"]=`${a}px`}for(let[a,s]of Object.entries(m)){let i=e.colors?.[a],c=t(i,"light"),g=t(i,"dark");c&&(r[`--ha-theme-${s}-light`]=c),g&&(r[`--ha-theme-${s}-dark`]=g)}return t(e.colors?.accent,"light")&&(r["--ha-theme-accent-foreground-light"]=h),t(e.colors?.accent,"dark")&&(r["--ha-theme-accent-foreground-dark"]=h),t(e.colors?.surfaceSecondary,"light")&&(r["--ha-theme-surface-tertiary-light"]=p),t(e.colors?.surfaceSecondary,"dark")&&(r["--ha-theme-surface-tertiary-dark"]=A),r}export{f as a,S as b,h as c,l as d,C as e,k as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(){return function(n){return n}}function t(e){return!!(e&&typeof e=="object"&&typeof e.safeParse=="function")}function s(e,n){return t(e.parameters)?e.parameters.parse(n):n}function i(e,n){let o=e.get(n);return!o||o.needsApproval?null:o}export{r as a,t as b,s as c,i as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";var f=/(\*\*[^*\n]+\*\*|\*[^*\s][^*\n]*\*|_[^_\s][^_\n]*_|`[^`\n]+`|\[[^\]\n]+\]\([^\s)\n]+\))/g,h=/^\[([^\]]+)\]\(([^\s)]+)\)$/,l=/^(?:[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?\.)+[a-z]{2,63}(?::\d{1,5})?(?:[/?#][^\s]*)?$/i;function g(n){let t=/^https?:\/\//i.test(n)?n:l.test(n)?`https://${n}`:void 0;if(t)try{let s=new URL(t);return s.protocol==="http:"||s.protocol==="https:"?t:void 0}catch{return}}function k(n){let t=n.split(f);if(t.length===1)return n;let s=new Map;return t.map(e=>{let c=(s.get(e)??0)+1,i=`${e}:${c}`;if(s.set(e,c),e.startsWith("**")&&e.endsWith("**")&&e.length>4)return r("strong",{children:e.slice(2,-2)},i);if(e.startsWith("*")&&e.endsWith("*")&&e.length>2)return r("em",{children:e.slice(1,-1)},i);if(e.startsWith("_")&&e.endsWith("_")&&e.length>2)return r("em",{children:e.slice(1,-1)},i);if(e.startsWith("`")&&e.endsWith("`")&&e.length>2)return r("code",{children:e.slice(1,-1)},i);let o=h.exec(e),d=o?.[2],u=d?g(d):void 0;return o&&u?r("a",{href:u,rel:"noopener noreferrer",target:"_blank",children:o[1]},i):e})}export{k as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t="heroui-agent:runtime-timing",e="heroui_agent_turn_admitted",n="getTurnAdmissionStatuses",r=50;export{t as a,e as b,n as c,r as d};
|
|
@@ -0,0 +1,5 @@
|
|
|
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(`
|
|
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
|
+
`)}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
|
+
`):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(`
|
|
5
|
+
`):JSON.stringify(t);await navigator.clipboard?.writeText(a)}import{jsx as p,jsxs as h}from"react/jsx-runtime";var M={csv:"Export as CSV",png:"Export as PNG",svg:"Export as SVG"},st={csv:rt,png:at,svg:et};function Ft({component:t,copyAction:e,formats:a=[],onAction:r,viewAction:n}){let i=B(null),[o,s]=U(),[m,c]=U(!1),u=B(0),g=l=>{!l&&Date.now()-u.current<350||c(l)},f=it(l=>{i.current=l,s(A(l))},[]),x=a.filter(l=>l!=="csv"||S(t)),P=e?`Table options for ${t.title}`:n?`${x.length>0?"View and export":"View"} options for ${t.title}`:`Export options for ${t.title}`;return x.length===0&&!n&&!e?null:p("div",{className:"aui-export-actions","data-slot":"agent-ui-export-actions",children:h(d,{isOpen:m,onOpenChange:g,children:[p(ot,{ref:f,isIconOnly:!0,"aria-label":P,size:"sm",variant:"ghost",onPointerDown:()=>{u.current=Date.now()},children:p(tt,{})}),p(d.Popover,{placement:"bottom end",UNSTABLE_portalContainer:o,children:h(d.Menu,{onAction:l=>{if(l==="view"){n?.onAction(),c(!1);return}if(l==="copy"){e?.(),r?.({componentId:t.id,format:"text",type:"copy"}),c(!1);return}let C=l;i.current&&K(i.current,t,C),r?.({componentId:t.id,format:C,type:"export"}),c(!1)},children:[n?h(d.Item,{id:"view",textValue:n.label,children:[n.target==="table"?p(nt,{"aria-hidden":"true",className:"size-4 shrink-0"}):p(Z,{"aria-hidden":"true",className:"size-4 shrink-0"}),p(T,{children:n.label})]}):null,e?h(d.Item,{id:"copy",textValue:"Copy table",children:[p(Q,{"aria-hidden":"true",className:"size-4 shrink-0"}),p(T,{children:"Copy table"})]}):null,x.map(l=>{let C=st[l];return h(d.Item,{id:l,textValue:M[l],children:[p(C,{"aria-hidden":"true",className:"size-4 shrink-0"}),p(T,{children:M[l]})]},l)})]})})]})})}import{jsx as b,jsxs as mt}from"react/jsx-runtime";function lt({direction:t}){return b("svg",{"aria-hidden":"true",className:"aui-change__indicator",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",children:t==="up"?b("path",{d:"M12 19V5m-5 5 5-5 5 5"}):b("path",{d:"M12 5v14m5-5-5 5-5-5"})})}function ct({slot:t,value:e}){return mt("span",{className:"aui-change","data-slot":t,"data-trend":e>0?"up":e<0?"down":"neutral",children:[e===0?null:b(lt,{direction:e>0?"up":"down"}),F(e),"%"]})}var y=["var(--chart-3, var(--accent))","var(--chart-1, oklch(from var(--accent) calc(l - 0.24) c h))","var(--chart-4, oklch(from var(--accent) calc(l + 0.12) c h))","var(--chart-2, oklch(from var(--accent) calc(l - 0.12) c h))","var(--chart-5, oklch(from var(--accent) calc(l + 0.24) c h))"],ut={accent:"var(--accent)","chart-1":"var(--chart-1, oklch(from var(--accent) calc(l - 0.24) c h))","chart-2":"var(--chart-2, oklch(from var(--accent) calc(l - 0.12) c h))","chart-3":"var(--chart-3, var(--accent))","chart-4":"var(--chart-4, oklch(from var(--accent) calc(l + 0.12) c h))","chart-5":"var(--chart-5, oklch(from var(--accent) calc(l + 0.24) c h))",danger:"var(--danger)",default:"var(--default-foreground, var(--foreground))",success:"var(--success)",warning:"var(--warning)"};function Bt(t,e){return t?ut[t]:y[e%y.length]}function Ut(t){return y[t%y.length]}export{D as a,gt as b,dt as c,V as d,ft as e,L as f,E as g,wt as h,Ft as i,ct as j,ut as k,Bt as l,Ut as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function s(...e){return e.filter(Boolean).join(" ")||void 0}export{s as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var I=85.051129,p=256,m=3,C=2;function _(t,n,o){let e=t.find(i=>i.id===n);return e?{latitude:e.latitude,longitude:e.longitude}:o}function x(t,n,o){return Math.min(Math.max(t,n),o)}function M({latitude:t,longitude:n},o){let e=p*2**o,r=x(t,-I,I)*Math.PI/180,c=Math.sin(r);return{x:(n+180)/360*e,y:(.5-Math.log((1+c)/(1-c))/(4*Math.PI))*e}}function L(t,n){return t>n/2?t-n:t<-n/2?t+n:t}function T(t){if(t.length===1)return t[0].longitude;let n=t.map(r=>(r.longitude+360)%360).sort((r,c)=>r-c),o=-1,e=n[0];for(let r=0;r<n.length;r+=1){let c=n[r],s=r===n.length-1?n[0]+360:n[r+1],l=s-c;l>o&&(o=l,e=s%360)}let i=(e+(360-o)/2)%360;return i>180?i-360:i}function v(t,n){if(n)return n;let o=t[0].latitude,e=t[0].latitude;for(let i of t.slice(1))o=Math.min(o,i.latitude),e=Math.max(e,i.latitude);return{latitude:(o+e)/2,longitude:T(t)}}function X(t,n,o,e){if(o!==void 0)return x(o,1,e);if(t.length===1)return Math.min(14,e);for(let i=Math.min(16,e);i>=2;i-=1){let r=M(n,i),c=p*2**i,s=M(t[0],i),l=L(s.x-r.x,c),a=s.y-r.y,u=l,d=l,f=a,y=a;for(let P of t.slice(1)){let h=M(P,i),b=L(h.x-r.x,c),g=h.y-r.y;u=Math.min(u,b),d=Math.max(d,b),f=Math.min(f,g),y=Math.max(y,g)}if(d-u<=420&&y-f<=190)return i}return Math.min(2,e)}function E(t,n=18){n=Number.isFinite(n)?x(Math.floor(n),1,18):18;let o=v(t.locations,t.viewport?.center),e=X(t.locations,o,t.viewport?.zoom,n),i=M(o,e),r=Math.floor(i.x/p),c=Math.floor(i.y/p),s=2**e,l=[];for(let a=c-C;a<=c+C;a+=1)if(!(a<0||a>=s))for(let u=r-m;u<=r+m;u+=1){let d=(u%s+s)%s;l.push({key:`${e}-${u}-${a}`,x:u*p-i.x,xIndex:d,y:a*p-i.y,yIndex:a,zoom:e})}return{center:o,points:t.locations.map(a=>{let u=M(a,e),d=p*2**e;return{id:a.id,x:L(u.x-i.x,d),y:u.y-i.y}}),tiles:l,zoom:e}}function Y(t){if(t.initialLocationId&&t.locations.some(o=>o.id===t.initialLocationId))return t.initialLocationId;let n=t.locations[0];for(let o of t.locations.slice(1))(o.relevance??-1)>(n.relevance??-1)&&(n=o);return n.id}export{_ as a,E as b,Y as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as m}from"./chunk-CR3H7AVI.js";import{useCallback as L,useEffect as _,useRef as f}from"react";import{jsx as C}from"react/jsx-runtime";function A({children:o,className:e,offset:t=0,size:i=32,style:l,...d}){let p=f(null),a=f(null),s=f(null),c=L(()=>{let r=p.current;if(!r)return;let u=r.scrollLeft>t,y=r.scrollLeft+r.clientWidth+t<r.scrollWidth,h=u&&y?"both":u?"left":y?"right":"none";a.current!==h&&(a.current=h,s.current!==null&&cancelAnimationFrame(s.current),s.current=requestAnimationFrame(()=>{s.current=null,delete r.dataset.leftScroll,delete r.dataset.rightScroll,delete r.dataset.leftRightScroll,h==="both"?r.dataset.leftRightScroll="true":h!=="none"&&(r.dataset[`${h}Scroll`]="true")}))},[t]);return _(()=>{let r=p.current;if(!r)return;c(),r.addEventListener("scroll",c,{passive:!0});let u=typeof ResizeObserver>"u"?null:new ResizeObserver(c);return u?.observe(r),()=>{r.removeEventListener("scroll",c),u?.disconnect(),s.current!==null&&cancelAnimationFrame(s.current),s.current=null,a.current=null}},[c]),C("div",{ref:p,className:m("aui-scroll-shadow",e),"data-slot":"agent-ui-scroll-shadow",style:{"--scroll-shadow-size":`${i}px`,...l},...d,children:o})}import{jsx as T}from"react/jsx-runtime";function q({className:o,size:e="sm",variant:t="secondary",...i}){return T("button",{className:m("aui-button",o),"data-size":e,"data-slot":"agent-ui-action-button","data-variant":t,type:"button",...i})}import{Button as H}from"@heroui/react";import{useEffect as v,useRef as x,useState as b}from"react";import{jsx as n,jsxs as g}from"react/jsx-runtime";var R=2e3,E="github-dark",k="github-light",w={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")},S=new Map;function M(o){let e={js:"javascript",md:"markdown",py:"python",sh:"shellscript",shell:"shellscript",ts:"typescript"},t=o.toLowerCase();return t in w?t:e[t]??null}async function B(o){let[{createHighlighterCore:e},{createJavaScriptRegexEngine:t},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"),w[o]()]);return e({engine:t(),langs:[d.default],themes:[i.default,l.default]})}async function N(o,e){let t=M(e);if(!t)return null;let i=S.get(t),l=i??B(t);return i||S.set(t,l),(await l).codeToHtml(o,{defaultColor:!1,lang:t,themes:{dark:E,light:k}})}async function P(o){try{return await navigator.clipboard.writeText(o),!0}catch{let e=document.createElement("textarea");e.value=o,e.setAttribute("readonly",""),e.style.position="fixed",e.style.opacity="0",document.body.append(e),e.select();try{return document.execCommand?.("copy")??!1}catch{return!1}finally{e.remove()}}}function z(){return n("svg",{"aria-hidden":"true",fill:"none",viewBox:"0 0 16 16",children:n("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 V(){return n("svg",{"aria-hidden":"true",fill:"none",viewBox:"0 0 16 16",children:n("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 D(){return n("svg",{"aria-hidden":"true",fill:"none",viewBox:"0 0 16 16",children:n("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 Q({code:o,language:e="text"}){let t=`${e}:${o}`,[i,l]=b(null),[d,p]=b(!1),a=x(null);v(()=>{let c=!1;async function r(){try{let u=await N(o,e);c||l(u?{html:u,key:t}:null)}catch{c||l(null)}}return r(),()=>{c=!0}},[o,t,e]),v(()=>()=>{a.current!==null&&window.clearTimeout(a.current)},[]);let s=async()=>{await P(o)&&(p(!0),a.current!==null&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>{p(!1),a.current=null},R))};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:[n(z,{}),n("span",{children:e.toUpperCase()})]}),n(H,{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:[n("span",{className:"aui-code__copy-icon aui-code__copy-icon--copy",children:n(V,{})}),n("span",{className:"aui-code__copy-icon aui-code__copy-icon--check",children:n(D,{})})]})})]}),i?.key===t?n("div",{className:"aui-code__content",dangerouslySetInnerHTML:{__html:i.html},"data-slot":"agent-ui-code"}):n("div",{className:"aui-code__content","data-slot":"agent-ui-code",children:n("pre",{children:n("code",{children:o})})})]})}export{q as a,A as b,Q as c};
|
|
@@ -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.6-flash","anthropic/claude-sonnet-5","anthropic/claude-opus-4.8"],t={"google/gemini-3.5-flash":"google/gemini-3.6-flash"};function r(e){return t[e]??e}var a="openai/gpt-5.6-luna",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.6-flash",label:"Gemini 3.6 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 d(e){return typeof e=="string"&&s.has(e)}function p(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,d as f,p as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function a(t,e=Date.now()){if(typeof window>"u")return"";try{let o=window.localStorage.getItem(t);if(!o)return"";let r=JSON.parse(o);return!(typeof r.savedAt=="number"&&e-r.savedAt<=6048e5)||typeof r.prompt!="string"||!r.prompt.trim()?(window.localStorage.removeItem(t),""):r.prompt}catch{try{window.localStorage.removeItem(t)}catch{}return""}}function i(t,e,o=Date.now()){if(!(typeof window>"u"))try{if(!e.trim()){window.localStorage.removeItem(t);return}window.localStorage.setItem(t,JSON.stringify({prompt:e,savedAt:o}))}catch{}}export{a,i as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a=":composer-draft:";function i(t,r){return`${t}${a}${r}:v1`}async function m(t,r=Date.now()){try{return await(await import("./composer-image-draft-KAGTNQR7.js")).readAgentComposerImageDraft(t,r)}catch{return[]}}async function g(t,r,e=Date.now()){try{await(await import("./composer-image-draft-KAGTNQR7.js")).saveAgentComposerImageDraft(t,r,e)}catch{}}async function f(t){try{localStorage.removeItem(t)}catch{}try{await(await import("./composer-image-draft-KAGTNQR7.js")).clearAgentComposerImageDraft(t)}catch{}}async function p(t){let r=`heroui-agent:conversation:${t}:`;try{for(let e=localStorage.length-1;e>=0;e-=1){let o=localStorage.key(e);o?.startsWith(r)&&o.includes(a)&&localStorage.removeItem(o)}}catch{}try{await(await import("./composer-image-draft-KAGTNQR7.js")).clearAgentComposerImageDraftsForProject(r)}catch{}}export{i as a,m as b,g as c,f as d,p as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as c}from"./chunk-CR3H7AVI.js";import{createContext as N,useContext as g}from"react";import{jsx as e,jsxs as i}from"react/jsx-runtime";var u=N(void 0);function v({children:a,variant:t}){return e(u,{value:t,children:a})}function h({actions:a,children:t,className:r,"data-component-kind":p,description:n,footer:o,legend:l,title:d,variant:m}){let C=g(u),s=d!=null||n!=null||l!=null||a!=null,f=C??m??"surface";return i("section",{className:c("aui-card",r),"data-component-kind":p,"data-has-footer":o!=null,"data-has-header":s,"data-slot":"agent-ui-card","data-variant":f,children:[s?i("header",{className:"aui-card__header","data-has-actions":a!=null,"data-slot":"agent-ui-card-header",children:[i("span",{className:"aui-card__heading","data-slot":"agent-ui-card-heading",children:[d!=null?e("span",{className:"aui-card__title","data-slot":"agent-ui-card-title",children:d}):null,n!=null?e("span",{className:"aui-card__description","data-slot":"agent-ui-card-description",children:n}):null]}),a!=null?e("span",{className:"aui-card__actions","data-slot":"agent-ui-card-actions",children:a}):null,l]}):null,e("div",{className:"aui-card__content","data-slot":"agent-ui-card-content",children:t}),o!=null?e("footer",{className:"aui-card__footer","data-slot":"agent-ui-card-footer",children:o}):null]})}function k(a){if(!a)return;let t=a.closest("[data-agent-overlay-root], dialog");if(t)return t.querySelector("[data-agent-overlay-portal]")??t;let r=a.getRootNode();return typeof ShadowRoot<"u"&&r instanceof ShadowRoot?r:void 0}export{v as a,h as b,k as c};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{C as tn,a as qe,b as je,d as de,e as ze,h as Ke,i as Ye,j as Qe,m as fe,o as Ze,p as en,u as nn}from"./chunk-WUAFMD7Z.js";import{a as Be}from"./chunk-6ZJJN322.js";import{d as Je,e as Xe}from"./chunk-OA3TG5CS.js";import{useCallback as C,useEffect as w,useEffectEvent as gt,useLayoutEffect as An,useMemo as Ce,useRef as v,useState as p,useSyncExternalStore as Nn}from"react";import{createRoot as ht}from"react-dom/client";import{SparklesFill as Kn}from"@gravity-ui/icons";import{jsx as Bn}from"react/jsx-runtime";function on(e){return Bn(Kn,{...e})}import{jsx as me}from"react/jsx-runtime";function Jn(e){return/\.svg(?:[?#]|$)/i.test(e)||/^data:image\/svg\+xml[;,]/i.test(e)}function rn(e){return`url("${e.replace(/["\\\n\r]/g,encodeURIComponent)}")`}function sn({icon:e}){return e?Jn(e)?me("span",{"aria-hidden":"true",className:"ha-launcher__icon ha-launcher__icon--tinted",style:{WebkitMaskImage:rn(e),maskImage:rn(e)}}):me("img",{alt:"",className:"ha-launcher__icon",src:e}):me(on,{})}function an(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function cn(e,n){if(n===void 0)return e;if(!an(e)||!an(n))return n;let t={...e};for(let[r,a]of Object.entries(n))a!==void 0&&(t[r]=r in e?cn(e[r],a):a);return t}function ln(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,startScreen:e.startScreen},r=cn(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,startScreen:n.startScreen});return{...n,...r}}function un(e){return!!e.appearance?.theme?.typography?.fontFamily?.trim()}var dn=1,c=Symbol("invalid");function G(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function S(e){if(e!==void 0)return typeof e=="string"?e:c}function I(e){if(e!==void 0)return typeof e=="boolean"?e:c}function pe(e){if(e!==void 0)return typeof e=="number"&&Number.isFinite(e)?e:c}function M(e){return n=>{if(n!==void 0)return typeof n=="string"&&e.includes(n)?n:c}}function fn(e){if(e===void 0)return;if(typeof e=="string")return e;if(!G(e))return c;let n=S(e.dark),t=S(e.light);return n===c||t===c?c:{...n===void 0?{}:{dark:n},...t===void 0?{}:{light:t}}}function Xn(e){if(e===void 0)return;if(!G(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 Yn(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||!G(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 T(e){return e===c?void 0:e}var Qn=["accent","background","foreground","overlay","surface","surfaceSecondary","tooltip"];function Zn(e){return b(e,{launcher:n=>n===void 0?void 0:b(n,{background:fn,icon:S,position:M(["bottom-left","bottom-right"]),style:Xn}),panel:n=>n===void 0?void 0:b(n,{expandable:I,expanded:I,initialHeight:t=>t===void 0||typeof t=="string"?t:pe(t),initialWidth:t=>t===void 0||typeof t=="string"?t:pe(t)}),theme:n=>n===void 0?void 0:b(n,{colorScheme:M(["dark","light","system"]),colors:t=>t===void 0?void 0:b(t,Object.fromEntries(Qn.map(r=>[r,fn]))),designTheme:M(["base","brutalism","glass","mouve"]),radius:M(["pill","round","sharp","soft"]),typography:t=>t===void 0?void 0:b(t,{baseSize:pe,fontFamily:S})}),viewMode:M(["floating","sidebar"])})}function et(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"&&Ke(r));return t.length===n.length?t:c},defaultModel:S,dictation:I,disclaimer:n=>n===!1?!1:S(n),modelPicker:I,placeholder:S})}function nt(e){return b(e,{animated:n=>{if(n===void 0||n===!1)return n;if(!G(n))return c;let t=M(["blurIn","fadeIn","slideUp"])(n.animation);return t===c||t===void 0?c:{...n,animation:t}},caret:n=>n===!1?!1:M(["block","circle"])(n)})}function tt(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(!G(e)||e.version!==dn)return null;let n=e.revision;if(typeof n!="string"||!n)return null;let t=T(Zn(e.appearance)),r=T(b(e.capabilities,{imageSearch:I,newsSearch:I,webSearch:I})),a=T(et(e.composer)),l=T(nt(e.markdown)),f=T(b(e.permissions,{defaultMode:M(["ask","auto","full"]),showPicker:I})),u=T(tt(e.responseActions)),m=T(b(e.startScreen,{greeting:S,promptShortcuts:I,prompts:Yn})),k=T(b(e.webfont,{familyName:g=>typeof g=="string"&&g?g:c,fontFaceUrl:S,stylesheetUrl:S}));return{...t?{appearance:t}:{},...r?{capabilities:r}:{},...a?{composer:a}:{},...l?{markdown:l}:{},...f?{permissions:f}:{},...u===void 0?{}:{responseActions:u},...m?{startScreen:m}:{},...k?{webfont:k}:{},revision:n,version:dn}}function ge(e){return`heroui-agent:config:${e}`}var mn=1;function pn(e){try{let n=window.localStorage.getItem(ge(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===mn&&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 he(e,n,t=Date.now()){try{let r={cacheVersion:mn,cachedAt:t,config:n};window.localStorage.setItem(ge(e),JSON.stringify(r))}catch{}}function gn(e){try{window.localStorage.removeItem(ge(e))}catch{}}async function hn(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 ot,Microphone as rt,Plus as it,ShieldCheck as st}from"@gravity-ui/icons";import{useEffect as at,useRef as ct}from"react";import{Fragment as Cn,jsx as h,jsxs as ye}from"react/jsx-runtime";var lt={ask:"Ask for approval",auto:"Approve for me",full:"Full access"};function bn({onFileDialogActiveChange:e,onIntent:n,options:t}){return{end:h(dt,{options:t}),footer:t.composerDisclaimer?h("p",{className:"ha-footnote",children:Be(t.composerDisclaimer)}):null,start:t.composerAttachmentContentTypes.length>0?h(ut,{accept:t.composerAttachmentAccept,agentId:t.agentId,onFileDialogActiveChange:e,onIntent:n}):null}}function ut({accept:e,agentId:n,onFileDialogActiveChange:t,onIntent:r}){let a=ct(null);return at(()=>{let l=a.current,f,u=()=>t(!1),m=()=>{f=window.setTimeout(u,0)};return l?.addEventListener("cancel",u),window.addEventListener("focus",m),()=>{l?.removeEventListener("cancel",u),window.removeEventListener("focus",m),window.clearTimeout(f)}},[t]),ye(Cn,{children:[h("input",{ref:a,multiple:!0,accept:e,"aria-label":"Choose files to attach",className:"ha-file-input",type:"file",onChange:l=>{en(n,Array.from(l.currentTarget.files??[])),l.currentTarget.value="",t(!1),r()}}),h("button",{"aria-label":"Attach files",className:"ha-attach",type:"button",onClick:()=>{t(!0),a.current?.click()},children:h(it,{"aria-hidden":"true"})})]})}function dt({options:e}){let n=e.composerDefaultModel??Je,t=Xe.find(r=>r.id===n)?.label??n;return ye(Cn,{children:[e.permissionShowPicker&&e.tools.length>0?h(yn,{icon:h(st,{"aria-hidden":"true",className:"aui-permission-picker__trigger-icon"}),kind:"permission",label:lt[e.permissionDefaultMode],tone:e.permissionDefaultMode==="full"?"warning":void 0}):null,e.composerModelPicker?h(yn,{kind:"model",label:t}):null,e.composerDictation?h("button",{disabled:!0,"aria-label":"Dictate message",className:"ha-dictation",type:"button",children:h(rt,{"aria-hidden":"true"})}):null]})}function yn({icon:e,kind:n,label:t,tone:r}){let a=`aui-${n}-picker`;return h("div",{className:`${a} ha-${n}-picker`,"data-tone":r,children:ye("button",{disabled:!0,"aria-label":n==="model"?"AI model":"Tool permissions",className:`${a}__trigger ha-shell-picker-trigger`,type:"button",children:[e,h("span",{className:`${a}__value`,children:t}),h(ot,{"aria-hidden":"true",className:`${a}__indicator`})]})})}var ft=[".woff2",".woff",".ttf",".otf",".eot"];function mt(e){return`heroui-agent-font-${e.familyName.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`}function pt(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 wn(e,n){try{let t=new URL(e);if(t.protocol!=="https:")return!1;if(!n)return!0;let r=t.pathname.toLowerCase();return ft.some(a=>r.endsWith(a))}catch{return!1}}function Rn(e){if(!e||typeof document>"u")return()=>{};let n=mt(e);if(document.getElementById(n))return()=>{};if(e.stylesheetUrl&&wn(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&&wn(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('${pt(e.fontFaceUrl)}');`,"}"].join(`
|
|
2
|
+
`),document.head.append(t),()=>t.remove()}return()=>{}}import{Fragment as En,jsx as O,jsxs as vn}from"react/jsx-runtime";var yt=600,bt=5*6e4,Ct="heroui-agent:open:";function we(e){return`${Ct}${e}`}function wt(e){if(typeof window>"u")return!1;try{return window.sessionStorage.getItem(we(e))==="true"}catch{return!1}}function be(e,n){try{n?window.sessionStorage.setItem(we(e),"true"):window.sessionStorage.removeItem(we(e))}catch{}}var Sn;function kn(){return Sn??=import(/* webpackPrefetch: true */"./embed-runtime-GYXK7V6N.js").then(e=>e.default),Sn}var D=new Map,Re=new Set;function Tn(e){return e?D.get(e):[...D.values()][D.size-1]}function In(){for(let e of Re)e()}function Rt(e){return Re.add(e),()=>Re.delete(e)}function At(e){let n=window.matchMedia?.("(prefers-color-scheme: dark)");return n?.addEventListener?.("change",e),()=>n?.removeEventListener?.("change",e)}function St(){return window.matchMedia?.("(prefers-color-scheme: dark)").matches===!0}function U(e,n,...t){let r=Tn(e);if(!r){console.warn("HeroUI Agent is not mounted yet. Add <HeroUIAgent /> to your layout.");return}let a=r[n];a(...t)}function kt(e,n,t){let[r]=p(()=>!t||typeof window>"u"?null:pn(e)),[a,l]=p(()=>{if(!t)return{config:null,presentationReady:!0};let f=r?Date.now()-r.cachedAt:Number.POSITIVE_INFINITY,u=r!==null&&!r.legacy&&f>=0&&f<=bt;return{config:u?r.config:null,presentationReady:u}});return w(()=>{if(!t)return;let f=new AbortController,u=!0,m=g=>{l(q=>q.presentationReady?q:{config:g,presentationReady:!0})},k=window.setTimeout(()=>{u&&(f.abort(),m(r?.config??null))},yt);return hn(n,e,{...r?.config.revision?{revision:r.config.revision}:{},signal:f.signal}).then(g=>{if(!(!u||f.signal.aborted)){if(g.status==="ok"){he(e,g.config),m(g.config);return}if(g.status==="not-modified"){r&&he(e,r.config),m(r?.config??null);return}if(g.status==="missing"){gn(e),m(null);return}m(r?.config??null)}}).finally(()=>{!u||f.signal.aborted||window.clearTimeout(k)}),()=>{u=!1,f.abort(),window.clearTimeout(k)}},[n,r,t,e]),t?a:{config:null,presentationReady:!0}}function io(e){let n=C(()=>Tn(e)?.ready??!1,[e]),t=Nn(Rt,n,()=>!1);return Ce(()=>({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 so(e){let n=`${e.agentId}\0${e._api?.baseUrl??""}\0${e.remoteConfig!==!1}`;return O(It,{...e},n)}function It(e){let{_api:n,agentId:t,appearance:r,capabilities:a,componentExports:l,composer:f,context:u,getAuthToken:m,markdown:k,onFeedback:g,onReady:q,permissions:Mn,preload:On,remoteConfig:Pn=!0,reopenOnRefresh:Ae,responseActions:_n,showLauncher:Ln,startNewConversationOnOpen:Un,startScreen:xn,tools:Se}=e,j=k?.plugins,Fn=(n?.baseUrl??"https://api.heroui.com").replace(/\/$/,""),{config:ke,presentationReady:x}=kt(t,Fn,Pn),Ie=JSON.stringify({_api:n,appearance:r,capabilities:a,componentExports:l,composer:f,markdown:k?{...k,plugins:void 0}:void 0,permissions:Mn,preload:On,remote:ke,reopenOnRefresh:Ae,responseActions:_n,showLauncher:Ln,startNewConversationOnOpen:Un,startScreen:xn}),o=Ce(()=>{let{remote:i,...s}=JSON.parse(Ie),d=ln(i,{...s,agentId:t,getAuthToken:m});return tn({...d,context:u,markdown:d.markdown?{...d.markdown,plugins:j}:j?{plugins:j}:void 0,onFeedback:g,tools:Se})},[u,m,j,g,t,Ie,Se]),z=Ce(()=>new qe(t,m),[t,m]),ve=un(e),Ee=ke?.webfont;w(()=>{if(!ve)return Rn(Ee)},[ve,Ee]);let[K]=p(()=>Ae===!0&&wt(t)),[ee,V]=p(K),[P,$n]=p(1),[Ne,Te]=p(1),[Me,Oe]=p(!1),[B,Hn]=p(K||o.startNewConversationOnOpen?null:void 0),[E,Dn]=p(null),[J,Vn]=p(null),[Pe,Wn]=p(!1),[ne,te]=p(!1),[Gn,_e]=p(null),oe=v(1),Le=v(null),re=v(!1),ie=v(null),Ue=v(null),F=v(K),se=v(null),X=v(null),ae=v([]),qn=Nn(At,St,()=>!1),ce=o.designTheme==="base"?null:`${o.designTheme}-${o.colorScheme==="system"?qn?"dark":"light":o.colorScheme}`,_=x&&Gn===P&&J!==null,y=x&&ee,[Y,jn]=p(K||o.preload),R=C(()=>jn(!0),[]),[W,$]=p(!1),[xe,Fe]=p(!1),le=C(()=>$(!0),[]);w(()=>{if(!W||!E)return;let i=()=>{queueMicrotask(()=>{let s=E.querySelector(".ha-composer:not([hidden] *)");s&&Ze(s,document.activeElement)||$(!1)})};return E.addEventListener("focusout",i),()=>E.removeEventListener("focusout",i)},[W,E]),w(()=>{Y&&z.get().catch(()=>{})},[Y,z]),w(()=>{o.reopenOnRefresh?be(o.agentId,ee):be(o.agentId,!1)},[ee,o.agentId,o.reopenOnRefresh]),w(()=>{if(!Y)return;if(!x){kn().catch(()=>{});return}let i=!0;return kn().then(s=>{i&&Vn(()=>s)}).catch(()=>{}),()=>{i=!1}},[x,Y]),w(()=>{if(!y||o.viewMode!=="sidebar"||window.innerWidth<640)return;let i=document.documentElement,s=i.style.marginRight,d=i.style.transition,A=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ue=Math.min(de(o.agentId,window.innerWidth),window.innerWidth);return A||(i.style.transition=[d,"margin-right .28s cubic-bezier(.2,.8,.2,1)"].filter(Boolean).join(", ")),i.style.marginRight=`${ue}px`,()=>{i.style.marginRight=s,window.setTimeout(()=>{i.style.transition=d},300)}},[y,o.agentId,o.viewMode]),w(()=>{let i=document.createElement("div"),s=document.createElement("div");i.dataset.herouiAgent=o.agentId,s.className="ha-root",se.current=i,ie.current=s,X.current=ht(s),i.append(s),document.body.append(i);let d=!0;return queueMicrotask(()=>{d&&Dn(s)}),()=>{d=!1,fe(o.agentId,!1);let A=X.current;ie.current=null,se.current=null,X.current=null,ae.current=[],queueMicrotask(()=>{A?.unmount(),i.remove()})}},[o.agentId]),An(()=>{let i=ie.current,s=se.current;if(!i||!s)return;i.className=ce?`ha-root ${ce}`:"ha-root",i.dataset.theme=o.colorScheme,i.dataset.viewMode=o.viewMode,i.dataset.position=o.launcherPosition,s.dataset.open=y?"true":"false",s.dataset.viewMode=o.viewMode,s.dataset.position=o.launcherPosition,o.launcherOffset?(s.style.setProperty("--ha-launcher-x",`${o.launcherOffset.x}px`),s.style.setProperty("--ha-launcher-y",`${o.launcherOffset.y}px`)):(s.style.removeProperty("--ha-launcher-x"),s.style.removeProperty("--ha-launcher-y")),o.viewMode==="sidebar"&&s.style.setProperty("--ha-sidebar-width",`${de(o.agentId,window.innerWidth)}px`);let d={...o.themeStyle,...o.panelStyle};for(let A of ae.current)A in d||i.style.removeProperty(A);for(let[A,ue]of Object.entries(d))i.style.setProperty(A,ue);ae.current=Object.keys(d)},[ce,y,o.colorScheme,o.agentId,o.launcherOffset,o.launcherPosition,o.panelStyle,o.themeStyle,o.viewMode,E]);let N=C(i=>{fe(o.agentId,!1),Fe(!1),_e(null),Hn(i);let s=oe.current+1;oe.current=s,$n(s)},[o.agentId]),$e=C(i=>{oe.current===i&&(Wn(!0),_e(i))},[]),zn=gt(()=>q?.());w(()=>{!_||Ue.current===P||(Ue.current=P,zn())},[P,_]);let L=C(()=>{F.current=!1,re.current=!0,V(!1),$(!1),N(o.startNewConversationOnOpen?null:void 0)},[o.startNewConversationOnOpen,N]);w(()=>{y||!_||!re.current||(re.current=!1,requestAnimationFrame(()=>Le.current?.focus()))},[y,_]);let H=C(()=>{F.current=!0,V(!0),R()},[R]),He=R,Q=C(i=>{let s=i?Ye(i):null;s&&Qe(o.agentId,s),F.current=!0,V(!0),$(!1),R(),N(null)},[o.agentId,N,R]),De=C(i=>{F.current=!0,V(!0),$(!1),R(),N(i)},[N,R]),Ve=C(()=>{y||F.current?L():H()},[L,y,H]),We=C(()=>{te(!1),Oe(!1),Te(i=>i+1)},[]),Ge=C(()=>{let i=[`heroui-agent:anonymous:${o.agentId}`,`heroui-agent:conversation:${o.agentId}:`,`heroui-agent:history:${o.agentId}:`];for(let s=localStorage.length-1;s>=0;s-=1){let d=localStorage.key(s);d&&i.some(A=>d.startsWith(A))&&localStorage.removeItem(d)}F.current=!1,te(!1),V(!1),$(!1),be(o.agentId,!1),Oe(!0),Te(s=>s+1),N(),window.setTimeout(()=>{import("./composer-draft-NSKK65F3.js").then(({clearAgentComposerDraftsForProject:s})=>s(o.agentId)).catch(()=>{})},0)},[o.agentId,N]);return w(()=>{let i={hide:L,newConversation:Q,preload:He,ready:_,refreshAuth:We,show:H,shutdown:Ge,toggle:Ve};return D.set(o.agentId,i),In(),()=>{D.get(o.agentId)===i&&(D.delete(o.agentId),In())}},[L,Q,o.agentId,He,_,We,H,Ge,Ve]),An(()=>{let i=X.current;if(!E||!i)return;let s=bn({onFileDialogActiveChange:Fe,onIntent:R,options:o});i.render(vn(En,{children:[x&&o.showLauncher&&!y?vn("button",{ref:Le,"aria-expanded":!1,"aria-haspopup":"dialog",className:"ha-launcher",style:o.launcherStyle,type:"button","aria-label":ne?"Open data assistant, unread messages":"Open data assistant",onClick:H,children:[O(sn,{icon:o.launcherIcon}),ne?O("span",{"aria-hidden":"true",className:"ha-launcher__unread"}):null]}):null,J&&!xe?O(J,{composerControlsRevealed:W,conversationEpoch:P,identityEpoch:Ne,identityReset:Me,open:y,options:o,requestedConversationId:B,shellComposerEndSlot:s.end,shellComposerFooterSlot:s.footer,showReadyLoader:!Pe&&B!==null,tokenManager:z,onClose:L,onComposerControlsReveal:le,onNewConversation:Q,onReady:$e,onSelectConversation:De,onUnreadChange:te}):O(ze,{agentId:o.agentId,defaultExpanded:o.panelExpanded,expandable:o.panelExpandable,historySlot:O(En,{}),modal:o.viewMode!=="sidebar",name:"Data assistant",open:y,onClose:L,children:B===null?O(nn,{composerConnecting:!0,agentId:o.agentId,composerControlsAvailable:o.composerControlsAvailable,composerControlsRevealed:W,composerEndSlot:s.end,composerFooterSlot:s.footer,composerStartSlot:s.start,greeting:o.greeting,placeholder:o.composerPlaceholder,suggestedPrompts:o.suggestedPrompts??[],onComposerControlsReveal:le,onIntent:R},`shell-${P}`):O(je,{})})]}))},[J,W,xe,P,$e,ne,Pe,L,Ne,Me,y,Q,o,E,_,x,B,R,le,De,H,z]),null}export{io as a,so as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as ce,e as de,f as ue}from"./chunk-2XBFFSW2.js";import{jsx as We,jsxs as Ue}from"react/jsx-runtime";function gt({indicator:e,label:t="Loading agent\u2026"}){return Ue("div",{"aria-live":"polite",className:"ha-agent-loading",role:"status",children:[e,We("span",{children:t})]})}import{jsx as me,jsxs as Be}from"react/jsx-runtime";function U({children:e,shortcut:t}){return Be("span",{"aria-hidden":"true",className:"ha-control-tooltip",children:[me("span",{children:e}),t?me("kbd",{className:"ha-control-tooltip__shortcut",children:t}):null]})}import{ChevronsCollapseUpRight as Ke,ChevronsExpandUpRight as $e}from"@gravity-ui/icons";import{useCallback as he,useEffect as J,useEffectEvent as Ve,useRef as Q,useState as B}from"react";function pe(e){return`heroui-agent:sidebar-width:${e}`}function Y(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 ge(e,t){let n=Number.NaN;try{n=Number(localStorage.getItem(pe(e))??Number.NaN)}catch{}return Y(Number.isFinite(n)?n:420,t)}function Z(e,t){try{localStorage.setItem(pe(e),String(Math.round(t)))}catch{}}import{jsx as d,jsxs as I}from"react/jsx-runtime";function St({actionsSlot:e,agentId:t,children:n,defaultExpanded:o=!1,expandable:s=!0,expandedSidebarSlot:f,expandedTitle:y,historySlot:a,keepMounted:l=!1,modal:p,name:x,onClose:S,onNewConversation:E,open:h}){let v=Q(null),u=Q(0),[M,j]=B(()=>typeof window<"u"&&window.matchMedia?.("(max-width: 639px)").matches===!0),O=Ve(S),[g,H]=B(o),P=!p&&!M,A=p||M||P&&g,[R,k]=B(!1),i=!M&&s,m=P&&g&&f;return J(()=>{let r=window.matchMedia?.("(max-width: 639px)");if(!r)return;let T=()=>j(r.matches);return T(),r.addEventListener?.("change",T),()=>r.removeEventListener?.("change",T)},[]),J(()=>{if(!R)return;let r=v.current;if(!r)return;let T=()=>k(!1),C=L=>{let{propertyName:F,target:q}=L;q===r&&(F!=="width"&&F!=="height"||T())},D=window.setTimeout(T,600);return r.addEventListener("transitionend",C),()=>{window.clearTimeout(D),r.removeEventListener("transitionend",C)}},[R]),J(()=>{if(!h)return;let r=v.current;if(!r)return;let T=document.activeElement instanceof HTMLElement?document.activeElement:null;r.open||(A&&typeof r.showModal=="function"?r.showModal():!A&&typeof r.show=="function"?r.show():r.open=!0);let C=document.documentElement,D=window.scrollX,L=window.scrollY,F=C.style.overflow,q=document.body.style.overflow,Ie=document.body.style.position,_e=document.body.style.top,Oe=document.body.style.left,De=document.body.style.right,Le=document.body.style.width;A&&(C.style.overflow="hidden",document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.top=`${-L}px`,document.body.style.left=`${-D}px`,document.body.style.right="0",document.body.style.width="100%");let Fe=r.querySelector("button,textarea,input,[tabindex]:not([tabindex='-1'])");r.contains(document.activeElement)||Fe?.focus();let re=b=>{if(!A&&b.key==="Escape"){if(fe(r)){u.current=Date.now(),b.preventDefault(),b.stopPropagation();return}b.preventDefault(),O();return}if(!A||b.key!=="Tab")return;let W=Array.from(r.querySelectorAll("button:not(:disabled),textarea:not(:disabled),input:not(:disabled),[tabindex]:not([tabindex='-1'])"));if(W.length===0)return;let ae=W[0],ie=W[W.length-1],se=r.getRootNode(),le=se instanceof ShadowRoot?se.activeElement:document.activeElement;b.shiftKey&&le===ae?(b.preventDefault(),ie.focus()):!b.shiftKey&&le===ie&&(b.preventDefault(),ae.focus())};return r.addEventListener("keydown",re),()=>{r.removeEventListener("keydown",re),typeof r.close=="function"?r.close():r.open=!1,C.style.overflow=F,document.body.style.overflow=q,document.body.style.position=Ie,document.body.style.top=_e,document.body.style.left=Oe,document.body.style.right=De,document.body.style.width=Le,A&&window.scrollTo(D,L),document.activeElement===document.body&&T?.focus()}},[A,h]),!h&&!l?null:I("dialog",{ref:v,"aria-label":x,"aria-modal":A,className:"ha-panel","data-agent-overlay-root":"","data-expanded":!M&&g?"true":void 0,"data-expanded-sidebar":m?"true":void 0,"data-resizing":R?"true":void 0,hidden:!h,onCancel:r=>{if(r.preventDefault(),Date.now()-u.current<350||fe(v.current)){u.current=Date.now();return}S()},children:[P&&!g?d(Xe,{agentId:t,panelRef:v}):null,m?d("aside",{"aria-label":"Chat history",className:"ha-expanded-sidebar",children:f}):null,I("div",{className:"ha-panel-main",children:[I("header",{className:"ha-header",children:[m?d("span",{className:"ha-session-title ha-expanded-chat-title",children:y??x}):a??d("strong",{children:x}),I("div",{className:"ha-header-actions",children:[m?null:e??(E?d("button",{"aria-label":"New chat",className:"ha-icon-button ha-new-chat-button",type:"button",onClick:E,children:d(qe,{})}):null),i?d("button",{"aria-expanded":g,"aria-label":g?"Collapse assistant":"Expand assistant",className:"ha-expand-button ha-icon-button",type:"button",onClick:()=>{k(!0),H(r=>!r)},children:g?d(Ke,{"aria-hidden":"true"}):d($e,{"aria-hidden":"true"})}):null,I("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:S,children:[d(je,{}),d(U,{shortcut:"ESC",children:"Close assistant"})]})]})]}),n,d("div",{className:"ha-overlay-portal","data-agent-overlay-portal":""})]})]})}function fe(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 Xe({agentId:e,panelRef:t}){let[n,o]=B(()=>ge(e,window.innerWidth)),s=Q(null),f=he(a=>{let l=t.current,p=l?.getRootNode();(p instanceof ShadowRoot?p.host:l?.closest("[data-heroui-agent]"))?.style.setProperty("--ha-sidebar-width",`${a}px`),window.innerWidth>=640&&(document.documentElement.style.marginRight=`${Math.min(a,window.innerWidth)}px`),o(a)},[t]),y=he((a,l)=>{let p=Y(a,window.innerWidth);return f(p),l&&Z(e,p),p},[f,e]);return d("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:a=>{let l=a.key==="ArrowLeft"?24:a.key==="ArrowRight"?-24:0;l!==0&&(a.preventDefault(),y(n+l,!0))},onPointerCancel:a=>{let l=s.current;l&&(s.current=null,delete a.currentTarget.dataset.resizing,t.current&&delete t.current.dataset.dragResizing,document.documentElement.style.transition=l.pageTransition,y(l.startWidth,!1))},onPointerDown:a=>{a.button!==0&&a.pointerType==="mouse"||(a.preventDefault(),a.currentTarget.setPointerCapture(a.pointerId),a.currentTarget.dataset.resizing="true",s.current={currentWidth:n,pageTransition:document.documentElement.style.transition,startWidth:n,startX:a.clientX},document.documentElement.style.transition="none",t.current&&(t.current.dataset.dragResizing="true"))},onPointerMove:a=>{let l=s.current;l&&(l.currentWidth=y(l.startWidth+(l.startX-a.clientX),!1))},onPointerUp:a=>{let l=s.current;l&&(s.current=null,delete a.currentTarget.dataset.resizing,t.current&&delete t.current.dataset.dragResizing,a.currentTarget.releasePointerCapture(a.pointerId),document.documentElement.style.transition=l.pageTransition,Z(e,l.currentWidth))}})}function je(){return d("svg",{"aria-hidden":"true",fill:"none",height:"18",viewBox:"0 0 18 18",width:"18",children:d("path",{d:"m4.25 4.25 9.5 9.5m0-9.5-9.5 9.5",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.6"})})}function qe(){return d("svg",{"aria-hidden":"true",fill:"none",height:"18",viewBox:"0 0 18 18",width:"18",children:d("path",{d:"M9 4v10M4 9h10",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.6"})})}function Ae(e){let t=performance.now(),n=Date.now(),o=e.trim();return o?{messageId:crypto.randomUUID(),prompt:o,startedAt:t,startedAtWallClock:n,submitted:!0}:null}var N=new Map,G=new Map,Ye=10080*60*1e3,z=new Map;function be(e){return`heroui-agent:shell-draft:${e}:composer-draft:v1`}function ee(e,t){try{let n=be(e);t.trim()?localStorage.setItem(n,JSON.stringify({prompt:t,savedAt:Date.now()})):localStorage.removeItem(n)}catch{}}function Ze(e){let t=be(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<=Ye)return n.prompt;localStorage.removeItem(t)}catch{}return""}function K(e,t){if(!t.prompt.trim()&&!t.submitted){N.delete(e),ee(e,"");return}N.set(e,t),t.submitted||ee(e,t.prompt)}function te(e){let t=N.get(e);if(t)return t;let n=Ze(e);return n?{prompt:n,submitted:!1}:void 0}function ye(e,t,n){let o=N.get(e);!o?.submitted||o.messageId!==t||o.firstFeedbackPaintedAt!==void 0||N.set(e,{...o,firstFeedbackPaintedAt:n})}function kt(e){let t=te(e);return N.delete(e),ee(e,""),t}function _(e,t,n){t?z.set(e,[n?.selectionStart??0,n?.selectionEnd??0,n?.selectionDirection??"none"]):z.delete(e)}function ve(e,t){let n=z.get(e);if(!n||!t)return;t.focus({preventScroll:!0});let o=Math.min(n[0],t.value.length),s=Math.min(n[1],t.value.length);t.setSelectionRange(o,s,n[2]),z.set(e,[o,s,n[2]])}function Te(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 Ct(e,t){t.length===0?G.delete(e):G.set(e,t)}function Je(e){return G.get(e)??[]}function Nt(e){let t=Je(e);return G.delete(e),t}function we(e){let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Qe(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 et(e){let t=getComputedStyle(e);return we(t.paddingTop)+we(t.paddingBottom)}function tt(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 s=e.scrollHeight;return e.style.height=t,e.style.minHeight=n,e.style.maxHeight=o,s}function nt(e){if(e.value.includes(`
|
|
2
|
+
`))return!0;if(e.clientWidth===0)return!1;let t=tt(e),n=et(e),o=Qe(e);return Math.max(0,t-n)>o*1.5}function ne(e,{hasAttachments:t=!1,maxHeight:n=120}={}){if(!e)return!1;let o=e.value.length>0;return t||o&&nt(e)?(e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,n)}px`,!0):(e.style.height="auto",!1)}import{jsx as oe,jsxs as xe}from"react/jsx-runtime";var ot="https://heroui.pro/?utm_source=heroui-agent&utm_medium=referral&utm_campaign=powered-by-hero";function Se(){return xe("a",{"aria-label":"Powered by HeroUI Pro (opens in a new tab)",className:"ha-powered-by",href:ot,rel:"noopener noreferrer",target:"_blank",children:[oe("span",{children:"Powered by"}),xe("svg",{"aria-hidden":"true",className:"ha-powered-by-logo",fill:"none",viewBox:"0 0 140 44",children:[oe("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"}),oe("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 Ee=new Set(["ask","auto","full"]);function $(e){return Ee.has(e)?e:"auto"}function _t(e,t){return`${e}:permission-mode:${t}:v1`}function Ot(e,t){return`${e}:active-permission-mode:${t}:v1`}function Dt(e){try{let t=localStorage.getItem(e);return t!==null&&Ee.has(t)?$(t):void 0}catch{return}}function Lt(e,t){try{localStorage.setItem(e,t)}catch{}}function Ft(e){try{localStorage.removeItem(e)}catch{}}function Wt(e,t){let n=$(t);if(n==="auto")return e;let o=n==="ask";return e.map(s=>!!s.needsApproval===o?s:{...s,needsApproval:o})}function Me(e){return`heroui-agent:anonymous:${e}`}var ke=class{constructor(t,n){this.agentId=t;this.getAuthToken=n}cached=null;generation=0;pending=null;clear(){this.generation+=1,this.cached=null,this.pending=null}reset(){this.clear();try{localStorage.removeItem(Me(this.agentId))}catch{}}async get(){if(this.cached&&this.expiresAt(this.cached)>Date.now()+6e4)return this.cached.token;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,o.token)}finally{this.pending===n&&(this.pending=null)}}async subjectHash(){let t=await this.get(),n=rt(t),o=typeof n.sub=="string"?n.sub:"anonymous",s=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(`${this.agentId}:${o}`));return Array.from(new Uint8Array(s),f=>f.toString(16).padStart(2,"0")).join("").slice(0,24)}anonymousId(){let t=Me(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 rt(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 at={"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"},V=Object.freeze(Object.keys(at)),Gt=V.join(","),it=new Set(V);function Ce(e){return it.has(e.trim().toLowerCase())}import{useEffect as st,useLayoutEffect as Ne,useRef as lt,useState as X}from"react";import{Fragment as He,jsx as c,jsxs as w}from"react/jsx-runtime";function qt({agentId:e,composerConnecting:t=!1,composerControlsAvailable:n,composerControlsRevealed:o,composerEndSlot:s,composerFooterSlot:f,composerStartSlot:y,greeting:a,onComposerControlsReveal:l,onIntent:p,placeholder:x,suggestedPrompts:S}){let[E]=X(()=>te(e)),[h,v]=X(()=>E?.prompt??""),[u,M]=X(()=>E?.submitted?E:null),[j,O]=X(!1),g=lt(null),H=n??!!(y||s),P=o??(H&&j),A=i=>{_(e,!0,i.currentTarget),O(H),H&&l?.(),p()},R=i=>{let m=i.currentTarget.querySelector(".ha-composer");m&&Te(m,i.relatedTarget)||(O(!1),_(e,!1))};Ne(()=>{ve(e,g.current),ne(g.current)},[e]),st(()=>{u||K(e,{prompt:h,submitted:!1})},[h,e,u]),Ne(()=>{if(!u)return;let i=requestAnimationFrame(m=>{ye(e,u.messageId,m)});return()=>cancelAnimationFrame(i)},[e,u]);let k=i=>{if(u)return;let m=Ae(i);m&&(M(m),v(""),g.current.style.height="auto",K(e,m),p())};return w(He,{children:[c("div",{className:"ha-conversation",children:c("div",{"aria-live":"polite",className:"ha-messages",role:"log",children:u?w(He,{children:[c("div",{className:"ha-message","data-role":"user",children:c("div",{className:"ha-message-body",children:u.prompt})}),c("div",{className:"ha-message","data-role":"assistant","data-stream-anchor":"true","data-turn-feedback-id":u.messageId,children:c("div",{className:"ha-message-body",children:c("div",{"aria-label":"Working on your request\u2026",className:"ha-progress ha-activity-status ha-progress-shimmer",role:"status",children:c("span",{"aria-hidden":"true",className:"ha-shimmer",children:"Thinking\u2026"})})})})]}):w("div",{className:"ha-empty",children:[c("h2",{children:a}),c("p",{children:"Live answers with charts, metrics, and tables."})]})})}),w("form",{className:"ha-composer-wrap",onBlur:R,onSubmit:i=>{i.preventDefault(),k(h)},children:[!u&&S.length>0?c("div",{"aria-label":"Suggested prompts",className:"ha-suggestions",role:"group",children:S.map(i=>w("button",{className:"ha-suggestion",type:"button",onClick:()=>k(i),children:[c("span",{children:i}),c(dt,{})]},i))}):null,w("div",{className:"@container ha-composer","data-connecting":t||void 0,"data-controls-revealed":P||void 0,children:[y,c("textarea",{ref:g,"aria-label":"Message the assistant",placeholder:x,readOnly:!!u,rows:1,value:h,onFocus:A,onSelect:i=>_(e,!0,i.currentTarget),onChange:i=>{let m=i.currentTarget.value;K(e,{prompt:m,submitted:!1}),_(e,!0,i.currentTarget),v(m),ne(i.currentTarget),p()},onKeyDown:i=>{i.key!=="Enter"||i.shiftKey||(i.preventDefault(),k(h))}}),s,w("button",{"aria-label":"Send message",className:"ha-send",disabled:!h.trim()||!!u,type:"submit",children:[c(ct,{}),c(U,{shortcut:"\u21B5",children:"Send message"})]})]}),c("div",{className:"ha-composer-footer","data-revealed":!!f||void 0,children:c("div",{className:"ha-composer-footer-content",children:f})}),c(Se,{})]})]})}function ct(){return c("svg",{"aria-hidden":"true",fill:"none",height:"18",viewBox:"0 0 18 18",width:"18",children:c("path",{d:"M9 14.5V3.5m0 0L4.5 8M9 3.5 13.5 8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function dt(){return c("svg",{"aria-hidden":"true",fill:"none",height:"16",viewBox:"0 0 16 16",width:"16",children:c("path",{d:"M5 11 11 5m0 0H6m5 0v5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})}var ut={animation:"fadeIn",duration:160,easing:"ease-out",sep:"word",stagger:18};function Pe(e){return typeof e=="number"?Number.isFinite(e)?`${Math.round(e)}px`:void 0:e?.trim()||void 0}function mt(e){let t=Pe(e?.initialWidth),n=Pe(e?.initialHeight);return{...t?{"--ha-panel-width":t}:{},...n?{"--ha-panel-height":n}:{}}}function Re(e){return e===void 0||!Number.isFinite(e)?24:Math.min(Math.max(Math.round(e),0),200)}function pt(e){if(e===void 0)return[...V];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();Ce(o)&&t.add(o)}return[...t]}function tn(e){if(!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=pt(e.composer?.attachments),n=typeof e.composer?.disclaimer=="string"&&e.composer.disclaimer.trim().slice(0,240)||void 0;return{apiBaseUrl:(e._api?.baseUrl??"https://api.heroui.com").replace(/\/$/,""),colorScheme:e.appearance?.theme?.colorScheme??"system",componentExportFormats:e.componentExports===!1?[]:e.componentExports??["csv","svg","png"],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:ce(e.appearance?.theme?.designTheme),...n?{composerDisclaimer:n}:{},agentId:e.agentId,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??ut,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:mt(e.appearance?.panel),permissionDefaultMode:$(e.permissions?.defaultMode),permissionShowPicker:e.permissions?.showPicker===!0,preload:e.preload??!0,reopenOnRefresh:e.reopenOnRefresh??!1,showLauncher:e.showLauncher??!0,startNewConversationOnOpen:e.startNewConversationOnOpen??!1,suggestedPromptShortcuts:e.startScreen?.promptShortcuts??!1,...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:Re(e.appearance.launcher.offset.x),y:Re(e.appearance.launcher.offset.y)}}:{},imageSearch:(e.capabilities?.webSearch??!1)&&(e.capabilities?.imageSearch??!0),newsSearch:(e.capabilities?.webSearch??!1)&&(e.capabilities?.newsSearch??!1),suggestedPrompts:e.startScreen?.prompts?.map(o=>o.trim()).filter(Boolean).slice(0,5),themeStyle:{...ue(e.appearance?.theme),...de(e.appearance?.launcher?.background)},tools:e.tools??[],viewMode:e.appearance?.viewMode??"floating",webSearch:e.capabilities?.webSearch??!1}}export{ke as a,gt as b,U as c,ge as d,St as e,at as f,V as g,Ce as h,Ae as i,K as j,te as k,kt as l,_ as m,ve as n,Te as o,Ct as p,Je as q,Nt as r,ne as s,Se as t,qt as u,_t as v,Ot as w,Dt as x,Lt as y,Ft as z,Wt as A,ut as B,tn as C};
|