PageSourceSearch

https://kalcend.ai/assets/DashboardPage-C1s_LEB1.js

js kalcend.ai collected 2026-10-05 12:07:42 UTC 27,371 bytes, 1 lines download raw bytes

1import{a3 as ge,aG as f,ae as de,r as je,a as Ne,ac as we,aL as Ae,j as t,aM as H,x as Se,y as te,V as Ce,aN as ke,aO as me,aP as Oe,as as Pe,aQ as Ee,aR as De,a9 as Me,aS as L,O as ae,aT as se,aa as Te,an as Le}from"./index-BTfcerCQ.js";import{f as ze}from"./format-Bd6wlyr6.js";import{i as U,U as Ie}from"./UsageUpdating-O_-p5jwW.js";import{C as ue}from"./cpu-CrR3pFOC.js";import{Z as xe}from"./zap-DcVmJDO1.js";import{T as Re}from"./trending-up-CTi3lL1m.js";import{f as z,L as W,m as K,i as _,C as Q,A as _e,a as I,b as ne,c as $e,d as ie,h as Be,e as Fe,u as We,g as q,G as Ve,j as re,k as le,D as Ue,l as Ke,X as pe,Y as he,n as Ge,R as Xe,o as Ye,T as He,p as Qe}from"./generateCategoricalChart-DUoONBe0.js";import{C as qe}from"./chart-column-BJMAlkHY.js";import{C as Ze}from"./circle-x-D0gVR8qn.js";const Je=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],et=ge("trending-down",Je);var tt=["layout","type","stroke","connectNulls","isRange","ref"],at=["key"],fe;function $(s){"@babel/helpers - typeof";return $=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},$(s)}function ve(s,n){if(s==null)return{};var e=st(s,n),a,i;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(s);for(i=0;i<r.length;i++)a=r[i],!(n.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(s,a)&&(e[a]=s[a])}return e}function st(s,n){if(s==null)return{};var e={};for(var a in s)if(Object.prototype.hasOwnProperty.call(s,a)){if(n.indexOf(a)>=0)continue;e[a]=s[a]}return e}function M(){return M=Object.assign?Object.assign.bind():function(s){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(s[a]=e[a])}return s},M.apply(this,arguments)}function oe(s,n){var e=Object.keys(s);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(s);n&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(s,i).enumerable})),e.push.apply(e,a)}return e}function P(s){for(var n=1;n<arguments.length;n++){var e=arguments[n]!=null?arguments[n]:{};n%2?oe(Object(e),!0).forEach(function(a){S(s,a,e[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(e)):oe(Object(e)).forEac
vendor: 9,104 bytes, line 1
1h(function(a){Object.defineProperty(s,a,Object.getOwnPropertyDescriptor(e,a))})}return s}function nt(s,n){if(!(s instanceof n))throw new TypeError("Cannot call a class as a function")}function ce(s,n){for(var e=0;e<n.length;e++){var a=n[e];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(s,ye(a.key),a)}}function it(s,n,e){return n&&ce(s.prototype,n),e&&ce(s,e),Object.defineProperty(s,"prototype",{writable:!1}),s}function rt(s,n,e){return n=Y(n),lt(s,be()?Reflect.construct(n,e||[],Y(s).constructor):n.apply(s,e))}function lt(s,n){if(n&&($(n)==="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ot(s)}function ot(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}function be(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(be=function(){return!!s})()}function Y(s){return Y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Y(s)}function ct(s,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");s.prototype=Object.create(n&&n.prototype,{constructor:{value:s,writable:!0,configurable:!0}}),Object.defineProperty(s,"prototype",{writable:!1}),n&&Z(s,n)}function Z(s,n){return Z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,i){return a.__proto__=i,a},Z(s,n)}function S(s,n,e){return n=ye(n),n in s?Object.defineProperty(s,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[n]=e,s}function ye(s){var n=dt(s,"string");return $(n)=="symbol"?n:n+""}function dt(s,n){if($(s)!="object"||!s)return s;var e=s[Symbol.toPrimitive];if(e!==void 0){var a=e.call(s,n);if($(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(s)}var E=function(s){function n(){var e;nt(this,n);for(var a=arguments.length,i=new Array(a),r=0;r<a;r++)i[r]=arguments[r];return e=rt(this,n,[].concat(i)),S(e,"state",{isAnimationFinished:!0}),S(e,"id",We("recharts-area-")),S(e,"handleAnimationEnd",function(){var l=e.props.onAnimationEnd;e.setState({isAnimationFinished:!0}),q(l)&&l()}),S(e,"handleAnimationStart",function(){var l=e.props.onAnimationStart;e.setState({isAnimationFinished:!1}),q(l)&&l()}),e}return ct(n,s),it(n,[{key:"renderDots",value:function(a,i,r){var l=this.props.isAnimationActive,o=this.state.isAnimationFinished;if(l&&!o)return null;var c=this.props,d=c.dot,u=c.points,m=c.dataKey,x=z(this.props,!1),g=z(d,!0),p=u.map(function(h,A){var j=P(P(P({key:"dot-".concat(A),r:3},x),g),{},{index:A,cx:h.x,cy:h.y,dataKey:m,value:h.value,payload:h.payload,points:u});return n.renderDotItem(d,j)}),v={clipPath:a?"url(#clipPath-".concat(i?"":"dots-").concat(r,")"):null};return f.createElement(W,M({className:"recharts-area-dots"},v),p)}},{key:"renderHorizontalRect",value:function(a){var i=this.props,r=i.baseLine,l=i.points,o=i.strokeWidth,c=l[0].x,d=l[l.length-1].x,u=a*Math.abs(c-d),m=K(l.map(function(x){return x.y||0}));return _(r)&&typeof r=="number"?m=Math.max(r,m):r&&Array.isArray(r)&&r.length&&(m=Math.max(K(r.map(function(x){return x.y||0})),m)),_(m)?f.createElement("rect",{x:c<d?c:c-u,y:0,width:u,height:Math.floor(m+(o?parseInt("".concat(o),10):1))}):null}},{key:"renderVerticalRect",value:function(a){var i=this.props,r=i.baseLine,l=i.points,o=i.strokeWidth,c=l[0].y,d=l[l.length-1].y,u=a*Math.abs(c-d),m=K(l.map(function(x){return x.x||0}));return _(r)&&typeof r=="number"?m=Math.max(r,m):r&&Array.isArray(r)&&r.length&&(m=Math.max(K(r.map(function(x){return x.x||0})),m)),_(m)?f.createElement("rect",{x:0,y:c<d?c:c-u,width:m+(o?parseInt("".concat(o),10):1),height:Math.floor(u)}):null}},{key:"renderClipRect",value:function(a){var i=this.props.layout;return i==="vertical"?this.renderVerticalRect(a):this.renderHorizontalRect(a)}},{key:"renderAreaStatically",value:function(a,i,r,l){var o=this.props,c=o.layout,d=o.type,u=o.stroke,m=o.connectNulls,x=o.isRange;o.ref;var g=ve(o,tt);return f.createElement(W,{clipPath:r?"url(#clipPath-".concat(l,")"):null},f.createElement(Q,M({},z(g,!0),{points:a,connectNulls:m,type:d,baseLine:i,layout:c,stroke:"none",className:"recharts-area-area"})),u!=="none"&&f.createElement(Q,M({},z(this.props,!1),{className:"recharts-area-curve",layout:c,type:d,connectNulls:m,fill:"none",points:a})),u!=="none"&&x&&f.createElement(Q,M({},z(this.props,!1),{className:"recharts-area-curve",layout:c,type:d,connectNulls:m,fill:"none",points:i})))}},{key:"renderAreaWithAnimation",value:function(a,i){var r=this,l=this.props,o=l.points,c=l.baseLine,d=l.isAnimationActive,u=l.animationBegin,m=l.animationDuration,x=l.animationEasing,g=l.animationId,p=this.state,v=p.prevPoints,h=p.prevBaseLine;return f.createElement(_e,{begin:u,duration:m,isActive:d,easing:x,from:{t:0},to:{t:1},key:"area-".concat(g),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(A){var j=A.t;if(v){var k=v.length/o.length,b=o.map(function(w,T){var D=Math.floor(T*k);if(v[D]){var O=v[D],B=I(O.x,w.x),F=I(O.y,w.y);return P(P({},w),{},{x:B(j),y:F(j)})}return w}),y;if(_(c)&&typeof c=="number"){var N=I(h,c);y=N(j)}else if(ne(c)||$e(c)){var C=I(h,0);y=C(j)}else y=c.map(function(w,T){var D=Math.floor(T*k);if(h[D]){var O=h[D],B=I(O.x,w.x),F=I(O.y,w.y);return P(P({},w),{},{x:B(j),y:F(j)})}return w});return r.renderAreaStatically(b,y,a,i)}return f.createElement(W,null,f.createElement("defs",null,f.createElement("clipPath",{id:"animationClipPath-".concat(i)},r.renderClipRect(j))),f.createElement(W,{clipPath:"url(#animationClipPath-".concat(i,")")},r.renderAreaStatically(o,c,a,i)))})}},{key:"renderArea",value:function(a,i){var r=this.props,l=r.points,o=r.baseLine,c=r.isAnimationActive,d=this.state,u=d.prevPoints,m=d.prevBaseLine,x=d.totalLength;return c&&l&&l.length&&(!u&&x>0||!ie(u,l)||!ie(m,o))?this.renderAreaWithAnimation(a,i):this.renderAreaStatically(l,o,a,i)}},{key:"render",value:function(){var a,i=this.props,r=i.hide,l=i.dot,o=i.points,c=i.className,d=i.top,u=i.left,m=i.xAxis,x=i.yAxis,g=i.width,p=i.height,v=i.isAnimationActive,h=i.id;if(r||!o||!o.length)return null;var A=this.state.isAnimationFinished,j=o.length===1,k=de("recharts-area",c),b=m&&m.allowDataOverflow,y=x&&x.allowDataOverflow,N=b||y,C=ne(h)?this.id:h,w=(a=z(l,!1))!==null&&a!==void 0?a:{r:3,strokeWidth:2},T=w.r,D=T===void 0?3:T,O=w.strokeWidth,B=O===void 0?2:O,F=Be(l)?l:{},J=F.clipDot,ee=J===void 0?!0:J,V=D*2+B;return f.createElement(W,{className:k},b||y?f.createElement("defs",null,f.createElement("clipPath",{id:"clipPath-".concat(C)},f.createElement("rect",{x:b?u:u-g/2,y:y?d:d-p/2,width:b?g:g*2,height:y?p:p*2})),!ee&&f.createElement("clipPath",{id:"clipPath-dots-".concat(C)},f.createElement("rect",{x:u-V/2,y:d-V/2,width:g+V,height:p+V}))):null,j?null:this.renderArea(N,C),(l||j)&&this.renderDots(N,ee,C),(!v||A)&&Fe.renderCallByParent(this.props,o))}}],[{key:"getDerivedStateFromProps",value:function(a,i){return a.animationId!==i.prevAnimationId?{prevAnimationId:a.animationId,curPoints:a.points,curBaseLine:a.baseLine,prevPoints:i.curPoints,prevBaseLine:i.curBaseLine}:a.points!==i.curPoints||a.baseLine!==i.curBaseLine?{curPoints:a.points,curBaseLine:a.baseLine}:null}}])}(je.PureComponent);fe=E;S(E,"displayName","Area");S(E,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!Ve.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});S(E,"getBaseValue",function(s,n,e,a){var i=s.layout,r=s.baseValue,l=n.props.baseValue,o=l??r;if(_(o)&&typeof o=="number")return o;var c=i==="horizontal"?a:e,d=c.scale.domain();if(c.type==="number"){var u=Math.max(d[0],d[1]),m=Math.min(d[0],d[1]);return o==="dataMin"?m:o==="dataMax"||u<0?u:Math.max(Math.min(d[0],d[1]),0)}return o==="dataMin"?d[0]:o==="dataMax"?d[1]:d[0]});S(E,"getComposedData",function(s){var n=s.props,e=s.item,a=s.xAxis,i=s.yAxis,r=s.xAxisTicks,l=s.yAxisTicks,o=s.bandSize,c=s.dataKey,d=s.stackedData,u=s.dataStartIndex,m=s.displayedData,x=s.offset,g=n.layout,p=d&&d.length,v=fe.getBaseValue(n,e,a,i),h=g==="horizontal",A=!1,j=m.map(function(b,y){var N;p?N=d[u+y]:(N=re(b,c),Array.isArray(N)?A=!0:N=[v,N]);var C=N[1]==null||p&&re(b,c)==null;return h?{x:le({axis:a,ticks:r,bandSize:o,entry:b,index:y}),y:C?null:i.scale(N[1]),value:N,payload:b}:{x:C?null:a.scale(N[1]),y:le({axis:i,ticks:l,bandSize:o,entry:b,index:y}),value:N,payload:b}}),k;return p||A?k=j.map(function(b){var y=Array.isArray(b.value)?b.value[0]:null;return h?{x:b.x,y:y!=null&&b.y!=null?i.scale(y):null}:{x:y!=null?a.scale(y):null,y:b.y}}):k=h?i.scale(v):a.scale(v),P({points:j,baseLine:k,layout:g,isRange:A},x)});S(E,"renderDotItem",function(s,n){var e;if(f.isValidElement(s))e=f.cloneElement(s,n);else if(q(s))e=s(n);else{var a=de("recharts-area-dot",typeof s!="boolean"?s.className:""),i=n.key,r=ve(n,at);e=f.createElement(Ue,M({},r,{key:i,className:a}))}return e});
1var mt=Ke({chartName:"AreaChart",GraphicalChild:E,axisComponents:[{axisType:"xAxis",AxisComp:pe},{axisType:"yAxis",AxisComp:he}],formatAxisMap:Ge});const ut=new De,xt="'JetBrains Mono', ui-monospace, SFMono-Regular, monospace";function G({title:s,value:n,change:e,trend:a,icon:i,updating:r=!1}){return t.jsxs("div",{className:" border border-white/[0.06] bg-[#1A1A1A] p-5 2xl:p-6",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsx("span",{className:"text-[11px] font-medium uppercase tracking-[0.06em] text-[#5C5C5C]",children:s}),t.jsx(i,{size:15,className:"text-[#5C5C5C]"})]}),t.jsx("div",{className:"text-[26px] leading-none font-semibold text-white tabular-nums",style:{fontFamily:xt},children:n}),r&&t.jsx("span",{role:"status",className:"mt-2 inline-block text-xs text-[#949494]",children:"Updating"}),e&&a&&t.jsxs("div",{className:"flex items-center gap-1 mt-1.5",children:[a==="up"?t.jsx(Re,{size:14,className:"text-[#10b981]"}):a==="down"?t.jsx(et,{size:14,className:"text-[#ef4444]"}):null,t.jsxs("span",{className:`text-xs font-medium ${a==="up"?"text-[#10b981]":a==="down"?"text-[#ef4444]":"text-[#8e8e8e]"}`,children:[e," vs last month"]})]})]})}const X={whatsapp:"#10b981",slack:"#8b5cf6",terminal:"#3b82f6",automation:"#f59e0b",voice:"#f43f5e",webchat:"#06b6d4",playground:"#d946ef",teammates:"#84cc16",tools:"#f97316",other:"#94a3b8"};function pt({data:s}){const n={whatsapp:"WhatsApp",slack:"Slack",terminal:"Terminal",automation:"Automation",voice:"Voice",webchat:"Webchat",playground:"Playground",teammates:"Teammates",tools:"AI tools",other:"Other"},e=Object.keys(X).filter(a=>s?.some(i=>Number(i[a]??0)>0));return t.jsxs("div",{className:"bg-[#1A1A1A] border border-white/[0.06] p-6 2xl:p-8 min-w-0 flex-1 flex flex-col",children:[t.jsxs("div",{className:"mb-4",children:[t.jsx("h3",{className:"text-sm font-semibold text-white uppercase tracking-wider",children:"Standard tokens"}),t.jsx("p",{className:"text-xs text-[#8e8e8e] mt-1",children:"Daily standard-token usage by channel (last 7 days)"})]}),t.jsx("div",{className:"min-w-0 h-[300px] shrink-0",children:s&&s.length>0?t.jsx(Xe,{width:"100%",height:300,minWidth:0,children:t.jsxs(mt,{data:s.map(a=>({...a,...Object.fromEntries(e.map(i=>[i,Number(a[i]??0)]))})),margin:{top:10,right:10,left:-20,bottom:5},children:[t.jsx("defs",{children:e.map(a=>t.jsxs("linearGradient",{id:`usage-${a}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:X[a],stopOpacity:.3}),t.jsx("stop",{offset:"100%",stopColor:X[a],stopOpacity:.02})]},a))}),t.jsx(Ye,{strokeDasharray:"3 3",stroke:"rgba(255,255,255,0.06)",vertical:!1}),t.jsx(pe,{dataKey:"date",axisLine:!1,tickLine:!1,tick:{fontSize:11,fill:"#8e8e8e"},tickFormatter:a=>new Date(a).toLocaleDateString("en-IN",{day:"numeric",month:"short"})}),t.jsx(he,{axisLine:!1,tickLine:!1,tick:{fontSize:11,fill:"#8e8e8e"},allowDecimals:!1,tickFormatter:a=>a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(0)}K`:a}),t.jsx(He,{contentStyle:{backgroundColor:"#1a1a1a",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"10px",fontSize:"12px",color:"#cfcfcf",boxShadow:"0 8px 24px rgba(0,0,0,0.5)",padding:"10px 14px"},labelFormatter:a=>new Date(a).toLocaleDateString("en-IN",{weekday:"short",day:"numeric",month:"short"}),formatter:a=>[ze(a),void 0]}),t.jsx(Qe,{iconType:"circle",iconSize:8,wrapperStyle:{fontSize:"11px",paddingTop:"12px"}}),e.map(a=>t.jsx(E,{type:"monotone",dataKey:a,name:n[a],stroke:X[a],fill:`url(#usage-${a})`,strokeWidth:2,dot:!1,activeDot:{r:4,strokeWidth:2}},a))]})}):t.jsx("div",{className:"h-full flex items-center justify-center",children:t.jsxs("div",{className:"text-center",children:[t.jsx(qe,{size:32,className:"text-[#6b6b6b] mx-auto mb-2"}),t.jsx("p",{className:"text-[#8e8e8e] text-sm",children:"No data available yet"})]})})})]})}function R(s){const n=Date.now(),e=new Date(s).getTime(),a=n-e;return a<6e4?"just now":a<36e5?`${Math.floor(a/6e4)}m ago`:a<864e5?`${Math.floor(a/36e5)}h ago`:`${Math.floor(a/864e5)}d ago`}function ht({event:s,index:n}){const e=s;if(e.event==="voice.call")return t.jsxs("div",{className:"flex items-start gap-3 px-3 py-2.5  hover:bg-white/[0.03] transition-colors",children:[t.jsx("div",{className:"p-2  bg-white/[0.05]",children:t.jsx(Me,{size:16,className:"text-[#8e8e8e]"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-[#cfcfcf]",children:"Voice Call"}),t.jsx("p",{className:"text-xs text-[#8e8e8e] mt-0.5 font-mono",children:e.realtimeModel})]}),t.jsxs("span",{className:"text-xs text-[#6b6b6b] whitespace-nowrap flex items-center gap-1",children:[t.jsx(L,{size:12}),R(e.timestamp)]})]}),t.jsxs("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:[t.jsx("span",{className:`text-xs font-medium px-2 py-0.5  ${e.callStatus==="completed"?"bg-white/[0.05] text-[#8e8e8e]":"bg-white/[0.05] text-[#ef4444]"}`,children:e.callStatus==="completed"?"COMPLETED":"FAILED"}),e.durationSeconds>0&&t.jsxs("span",{className:"text-xs text-[#6b6b6b]",children:[e.durationSeconds,"s"]}),e.toolCallCount>0&&t.jsxs("span",{className:"text-xs text-[#6b6b6b]",children:[e.toolCallCount," tools"]})]})]})]},n);if(e.event==="status.update"){const a={sent:t.jsx(se,{size:16,className:"text-[#8e8e8e]"}),delivered:t.jsx(ae,{size:16,className:"text-[#8e8e8e]"}),read:t.jsx(ae,{size:16,className:"text-[#8e8e8e]"}),failed:t.jsx(Ze,{size:16,className:"text-[#ef4444]"})}[e.statusType]||t.jsx(se,{size:16,className:"text-[#8e8e8e]"});return t.jsxs("div",{className:"flex items-start gap-3 px-3 py-2.5  hover:bg-white/[0.03] transition-colors",children:[t.jsx("div",{className:"p-2  bg-white/[0.05]",children:a}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{children:[t.jsxs("p",{className:"text-sm font-medium text-[#cfcfcf]",children:["Message ",e.statusType]}),t.jsx("p",{className:"text-xs text-[#8e8e8e] mt-0.5 truncate",children:e.recipientId})]}),t.jsxs("span",{className:"text-xs text-[#6b6b6b] whitespace-nowrap flex items-center gap-1",children:[t.jsx(L,{size:12}),R(e.timestamp)]})]})})]},n)}return e.event==="message.inbound"?t.jsxs("div",{className:"flex items-start gap-3 px-3 py-2.5  hover:bg-white/[0.03] transition-colors",children:[t.jsx("div",{className:"p-2  bg-white/[0.05]",children:t.jsx(Te,{size:16,className:"text-[#8e8e8e]"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-[#cfcfcf]",children:"Inbound Message"}),t.jsx("p",{className:"text-xs text-[#8e8e8e] mt-0.5 truncate",children:e.from})]}),t.jsxs("span",{className:"text-xs text-[#6b6b6b] whitespace-nowrap flex items-center gap-1",children:[t.jsx(L,{size:12}),R(e.timestamp)]})]}),e.message&&t.jsx("p",{className:"text-xs text-[#8e8e8e] mt-1.5 line-clamp-1",children:e.message})]})]},n):e.event==="tool.call"?t.jsxs("div",{className:"flex items-start gap-3 px-3 py-2.5  hover:bg-white/[0.03] transition-colors",children:[t.jsx("div",{className:"p-2  bg-white/[0.05]",children:t.jsx(Le,{size:16,className:"text-[#8e8e8e]"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-[#cfcfcf]",children:"Tool Call"}),t.jsx("p",{className:"text-xs text-[#8e8e8e] mt-0.5 font-mono",children:e.toolName})]}),t.jsxs("span",{className:"text-xs text-[#6b6b6b] whitespace-nowrap flex items-center gap-1",children:[t.jsx(L,{size:12}),R(e.timestamp)]})]}),t.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[t.jsx("span",{className:`text-xs font-medium px-2 py-0.5  ${e.success?"bg-white/[0.05] text-[#8e8e8e]":"bg-white/[0.05] text-[#ef4444]"}`,children:e.success?"SUCCESS":"FAILED"}),e.executionTimeMs&&t.jsxs("span",{className:"text-xs text-[#6b6b6b]",children:[e.executionTimeMs,"ms"]})]})]})]},n):e.event==="openai.interaction"?t.jsxs("div",{className:"flex items-start gap-3 px-3 py-2.5  hover:bg-white/[0.03] transition-colors",children:[t.jsx("div",{className:"p-2  bg-white/[0.05]",children:t.jsx(ue,{size:16,className:"text-[#8e8e8e]"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-[#cfcfcf]",children:"AI Interaction"}),t.jsx("p",{className:"text-xs text-[#8e8e8e] mt-0.5 font-mono",children:e.model})]}),t.jsxs("span",{className:"text-xs text-[#6b6b6b] whitespace-nowrap flex items-center gap-1",children:[t.jsx(L,{size:12}),R(e.timestamp)]})]}),t.jsxs("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:[t.jsx("span",{className:`text-xs font-medium px-2 py-0.5  ${e.success?"bg-white/[0.05] text-[#8e8e8e]":"bg-white/[0.05] text-[#ef4444]"}`,children:e.success?"SUCCESS":"FAILED"}
1),typeof e.standardTokens=="string"&&t.jsxs("span",{className:"text-xs text-[#6b6b6b]",children:[me(e.standardTokens)," standard tokens"]}),e.executionTimeMs&&t.jsxs("span",{className:"text-xs text-[#6b6b6b]",children:[e.executionTimeMs,"ms"]})]})]})]},n):t.jsxs("div",{className:"flex items-start gap-3 px-3 py-2.5  hover:bg-white/[0.03]",children:[t.jsx("div",{className:"p-2  bg-white/[0.05]",children:t.jsx(xe,{size:16,className:"text-[#8e8e8e]"})}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsx("p",{className:"text-sm font-medium text-[#cfcfcf]",children:e.event}),t.jsxs("span",{className:"text-xs text-[#6b6b6b] whitespace-nowrap flex items-center gap-1",children:[t.jsx(L,{size:12}),R(e.timestamp)]})]})})]},n)}function St(){const s=Ne(p=>p.claims?.orgId),n=we(),{data:e,loading:a,error:i,fetching:r,refresh:l}=Ae(ut,n,()=>Ee({orgId:s})),o=!n||!!i,c=(p,v)=>{if(p===null||v===null)return null;if(v===0)return{change:"N/A",trend:"neutral"};const h=(p-v)/v*100;return{change:`${h>=0?"+":"-"}${Math.abs(h).toFixed(1)}%`,trend:h>0?"up":h<0?"down":"neutral"}};if(a)return t.jsx(H,{level:"route",context:"Dashboard Page",children:t.jsx("div",{className:"flex items-center justify-center h-96",children:t.jsxs("div",{className:"text-center",children:[t.jsx(Se,{className:"w-8 h-8 animate-spin text-[#8e8e8e] mx-auto mb-3"}),t.jsx("p",{className:"text-sm text-[#8e8e8e]",children:"Loading dashboard..."})]})})});if(o&&!e)return t.jsx(H,{level:"route",context:"Dashboard Page",children:t.jsx("div",{className:"flex h-96 items-center justify-center",children:t.jsxs("div",{className:"max-w-sm text-center",role:"alert",children:[t.jsx(te,{className:"mx-auto mb-3 text-[#ef4444]",size:32}),t.jsx("h1",{className:"text-lg font-semibold text-white",children:"Dashboard unavailable"}),t.jsx("p",{className:"mt-2 text-sm text-[#8e8e8e]",children:"We couldn't load your organization activity."}),t.jsx("button",{type:"button",className:"mt-5 border border-white/[0.12] px-4 py-2 text-sm font-medium text-white hover:bg-white/[0.05]",onClick:()=>void l(),children:"Retry"})]})})});const d=e?c(e.thisMonth.aiInteractions,e.lastMonth.aiInteractions):null,u=e?c(e.thisMonth.activeAgents,e.lastMonth.activeAgents):null,m=e&&[e.thisMonth,e.lastMonth].every(p=>U(p.accountingStatus,["standardTokensComplete"]))?c(Number(e.thisMonth.standardTokens),Number(e.lastMonth.standardTokens)):null,x=e?c(Number(e.thisMonth.walletSpentSubunits),Number(e.lastMonth.walletSpentSubunits)):null,g=e!==void 0&&e.allTime.aiInteractions===0&&e.allTime.activeAgents===0&&Number(e.allTime.standardTokens)===0&&e.allTime.walletSpentSubunits==="0"&&U(e.allTime.accountingStatus,["standardTokensComplete"]);return t.jsx(H,{level:"route",context:"Dashboard Page",children:t.jsxs("div",{className:"space-y-6 2xl:space-y-8 p-1",style:{fontFamily:"'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif"},children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-semibold text-white",children:"Dashboard"}),t.jsx("p",{className:"text-sm text-[#8e8e8e] mt-1",children:"Overview of your organization's AI activity"})]}),t.jsxs("button",{type:"button",onClick:()=>void l(),disabled:r,className:"inline-flex min-h-10 items-center gap-2 rounded-lg border border-white/10 px-3 py-2 text-sm text-[#cfcfcf] disabled:opacity-60",children:[t.jsx(Ce,{size:14,className:r?"animate-spin":""}),r?"Refreshing…":"Refresh"]})]}),i&&e&&t.jsxs("div",{role:"status",className:"border border-white/10 p-4 text-sm text-[#cfcfcf]",children:["Refresh failed. Showing the last loaded dashboard.",t.jsx("button",{type:"button",className:"ml-3 underline",onClick:()=>void l(),children:"Retry refresh"})]}),g&&t.jsxs("div",{className:"border border-white/[0.06] bg-[#1A1A1A] px-5 py-4",role:"status",children:[t.jsx("p",{className:"text-sm font-medium text-white",children:"No activity yet"}),t.jsx("p",{className:"mt-1 text-xs text-[#8e8e8e]",children:"Your dashboard will populate as your agents begin working."})]}),(e?.operationalStatus?.counts===!1||e?.operationalStatus?.recentActivity===!1)&&t.jsxs("div",{className:"border border-white/[0.06] bg-[#1A1A1A] px-5 py-4 text-sm text-[#8e8e8e]",role:"status",children:["Some activity statistics are temporarily unavailable. Recorded token usage and wallet spend remain visible.",t.jsx("button",{className:"ml-3 text-white underline",onClick:()=>void l(),children:"Retry activity"})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4 2xl:gap-6",children:[t.jsx(G,{title:"AI Interactions",value:e?.thisMonth.aiInteractions??"—",change:d?.change,trend:d?.trend,icon:ue}),t.jsx(G,{title:"Active Agents",value:e?.thisMonth.activeAgents??"—",change:u?.change,trend:u?.trend,icon:ke}),t.jsx(G,{title:"Standard tokens",updating:!!e&&!U(e.thisMonth.accountingStatus,["standardTokensComplete"]),value:me(e?.thisMonth.standardTokens),change:m?.change,trend:m?.trend,icon:xe}),t.jsx(G,{title:"Spending this month",value:e?Pe(e.thisMonth.walletSpentSubunits):"—",change:x?.change,trend:x?.trend,icon:Oe})]}
1),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-5 gap-4 2xl:gap-6",children:[t.jsxs("div",{className:"lg:col-span-3 min-w-0 min-h-[420px] flex flex-col",children:[e&&U(e.thisMonth.accountingStatus,["standardTokensComplete"])&&t.jsx(Ie,{status:e.dailyAccountingStatus,metrics:["standardTokensComplete"],scope:"Chart usage"}),t.jsx(pt,{data:e?.dailyActivity})]}),t.jsx("div",{className:"lg:col-span-2 min-h-[420px]",children:t.jsxs("div",{className:"bg-[#1A1A1A] border border-white/[0.06]  p-6 2xl:p-8 h-full flex flex-col",children:[t.jsxs("div",{className:"mb-4",children:[t.jsx("h3",{className:"text-sm font-semibold text-white uppercase tracking-wider",children:"Recent Activity"}),t.jsx("p",{className:"text-xs text-[#8e8e8e] mt-1",children:"Latest events across all channels"})]}),t.jsx("div",{className:"space-y-2 flex-1 overflow-y-auto",children:e?.operationalStatus?.recentActivity===!1?t.jsx("p",{className:"text-sm text-[#8e8e8e]",children:"Recent activity is temporarily unavailable."}):e?.recentActivity&&e.recentActivity.length>0?e.recentActivity.slice(0,5).map((p,v)=>t.jsx(ht,{event:p,index:v},v)):t.jsx("div",{className:"flex items-center justify-center flex-1 text-[#8e8e8e]",children:t.jsxs("div",{className:"text-center py-12",children:[t.jsx(te,{size:32,className:"mx-auto mb-2 text-[#6b6b6b]"}),t.jsx("p",{className:"text-sm font-medium",children:"No recent events"}),t.jsx("p",{className:"text-xs text-[#6b6b6b] mt-1",children:"Activity will appear as your agents run"})]})})})]})})]})]})})}export{St as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.