1"use strict";(self.webpackChunkStammer_ai=self.webpackChunkStammer_ai||[]).push([[2931],{32931:function(e,n,t){t.r(n),t.d(n,{AdminMessagingUsagePage:function(){return K}});var o=t(78685),r=t(2057),i=t(10219),s=t(73349),l=t(52811),a=t(63818),c=t(31547),u=t(17577),d=t(10838),x=t(13066),p=t(41175),h=t(38588),f=t(88458),g=t(26400),_=t(76776),b=t(45924),j=t(67076),A=t(96509),v=t(64901),m=t(77040),k=t(93610),y=t(65179),C=t(69656),S=t(83589),w=t(34994),W=t(60894),z=t(26120),I=t(30350),P=t(53630),M=t(7098),O=t(77214),T=t(81304),E=t(89543),F=t(42683),U=t(95550),V=t(57390),Z=t(54007),D=t(21120),Y=t(63294),L=t(19423),R=t(601),X=t(19124),B=function(){return B=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},B.apply(this,arguments)},G=function(e,n,t){if(t||2===arguments.length)for(var o,r=0,i=n.length;r<i;r++)!o&&r in n||(o||(o=Array.prototype.slice.call(n,0,r)),o[r]=n[r]);return e.concat(o||Array.prototype.slice.call(n))},N=function(e){var n=e.users,t=e.loading,i=e.searchTerm,s=e.onSearchChange,l=e.currentPage,a=e.totalCount,N=e.totalPages,Q=e.onPageChange,H=e.filters,J=e.onFiltersChange,$=e.entriesPerPage,q=e.onEntriesPerPageChange,K=e.onResetFilters,ee=e.sortField,ne=e.sortOrder,te=e.onSortChange,oe=e.onExport,re=(0,r.useState)(null),ie=re[0],se=re[1],le=(0,r.useState)(H),ae=le[0],ce=le[1],ue=function(){se(null)},de=function(e,n){var t;ce(B(B({},ae),((t={})[e]=n,t)))},xe=0===a?0:(l-1)*$+1,pe=Math.min(l*$,a),he=function(e){return ee!==e?null:"asc"===ne?(0,o.jsx)(U.A,{fontSize:"small"}):(0,o.jsx)(F.A,{fontSize:"small"})},fe=function(e,n){return"input"===n?e<=3500?"#10b981":e<=5e3?"#f59e0b":"#ef4444":e<=110?"#10b981":e<=300?"#f59e0b":"#ef4444"},ge=["OpenAI","Claude","Grok"],_e=Boolean(ie);return(0,o.jsxs)(x.A,{maxWidth:"xl",sx:{py:4},children:[(0,o.jsxs)(p.A,{elevation:0,sx:function(e){return{p:4,borderRadius:2,border:"1px solid ".concat(e.palette.divider),backgroundColor:e.palette.background.paper,boxShadow:"dark"===e.palette.mode?"0 12px 24px rgba(0, 0, 0, 0.24)":"0 1px 3px rgba(15, 23, 42, 0.08)"}},children:[(0,o.jsxs)(c.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:4},children:[(0,o.jsx)(d.A,{variant:"h5",component:"h1",sx:{fontWeight:600,color:"text.primary"},children:"Token Usage Analytics"}),(0,o.jsxs)(d.A,{variant:"body2",sx:{color:"text.secondary",fontSize:"14px"},children:[a," users"]})]}),(0,o.jsxs)(c.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,gap:2},children:[(0,o.jsx)(h.A,{size:"small",value:i,onChange:function(e){return s(e.target.value)},placeholder:"Search users...",InputProps:{startAdornment:(0,o.jsx)(f.A,{position:"start",children:(0,o.jsx)(O.A,{fontSize:"small"})})},sx:{width:300}}),(0,o.jsxs)(c.A,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,o.jsx)(g.A,{variant:"outlined",color:"primary",startIcon:(0,o.jsx)(T.A,{}),onClick:function(e){se(e.currentTarget),ce(H)},children:"Filters"}),(0,o.jsx)(g.A,{variant:"outlined",color:"primary",startIcon:(0,o.jsx)(V.A,{}),onClick:oe,children:"Export CSV"})]})]}),(0,o.jsx)(_.A,{component:p.A,elevation:0,sx:function(e){return{border:"1px solid ".concat(e.palette.divider),backgroundColor:e.palette.background.paper}},children:(0,o.jsxs)(b.A,{children:[(0,o.jsxs)(j.A,{children:[(0,o.jsxs)(A.A,{children:[(0,o.jsxs)(Y.h5,{onClick:function(){return null==te?void 0:te("full_name","full_name"===ee&&"desc"===ne?"asc":"desc")},style:{cursor:"pointer"},children:["User ",he("full_name")]}),(0,o.jsx)(Y.h5,{children:"Tier"}),(0,o.jsx)(Y.h5,{children:"Personal APIs"}),(0,o.jsx)(Y.h5,{children:"Wallet Usage"}),(0,o.jsxs)(Y.h5,{align:"center",sx:function(e){return{backgroundColor:"dark"===e.palette.mode?(0,M.X4)(e.palette.common.white,.04):(0,M.X4)(e.palette.primary.main,.03),borderLeft:"2px solid ".concat(e.palette.divider)}},children:[(0,o.jsx)(d.A,{variant:"body2",sx:{fontWeight:600,color:"text.primary"},children:"Input"}),(0,o.jsx)(d.A,{variant:"caption",sx:{color:"text.secondary"},children:"Tokens"})]}),(0,o.jsxs)(Y.h5,{align:"center",sx:function(e){return{backgroundColor:"dark"===e.palette.mode?(0,M.X4)(e.palette.common.white,.04):(0,M.X4)(e.palette.primary.main,.03),borderLeft:"2px s
1olid ".concat(e.palette.divider)}},children:[(0,o.jsx)(d.A,{variant:"body2",sx:{fontWeight:600,color:"text.primary"},children:"Output"}),(0,o.jsx)(d.A,{variant:"caption",sx:{color:"text.secondary"},children:"Tokens"})]})]}),(0,o.jsxs)(A.A,{children:[(0,o.jsx)(Y.h5,{sx:{border:"none",padding:0}}),(0,o.jsx)(Y.h5,{sx:{border:"none",padding:0}}),(0,o.jsx)(Y.h5,{sx:{border:"none",padding:0}}),(0,o.jsx)(Y.h5,{sx:{border:"none",padding:0}}),(0,o.jsx)(Y.h5,{sx:{borderTop:"none",padding:"8px 12px"},children:(0,o.jsxs)(c.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:2},children:[(0,o.jsxs)(d.A,{variant:"caption",sx:{cursor:"pointer",fontWeight:"input_tokens_max"===ee?600:400,color:"input_tokens_max"===ee?"#1976d2":"#6b7280",flex:1,textAlign:"center"},onClick:function(){return null==te?void 0:te("input_tokens_max","input_tokens_max"===ee&&"desc"===ne?"asc":"desc")},children:["Max ",he("input_tokens_max")]}),(0,o.jsxs)(d.A,{variant:"caption",sx:{cursor:"pointer",fontWeight:"input_tokens_avg"===ee?600:400,color:"input_tokens_avg"===ee?"#1976d2":"#6b7280",flex:1,textAlign:"center"},onClick:function(){return null==te?void 0:te("input_tokens_avg","input_tokens_avg"===ee&&"desc"===ne?"asc":"desc")},children:["Avg ",he("input_tokens_avg")]}),(0,o.jsxs)(d.A,{variant:"caption",sx:{cursor:"pointer",fontWeight:"input_tokens_min"===ee?600:400,color:"input_tokens_min"===ee?"#1976d2":"#6b7280",flex:1,textAlign:"center"},onClick:function(){return null==te?void 0:te("input_tokens_min","input_tokens_min"===ee&&"desc"===ne?"asc":"desc")},children:["Min ",he("input_tokens_min")]}),(0,o.jsxs)(d.A,{variant:"caption",sx:{cursor:"pointer",fontWeight:"input_tokens_total"===ee?600:400,color:"input_tokens_total"===ee?"#1976d2":"#6b7280",flex:1,textAlign:"center"},onClick:function(){return null==te?void 0:te("input_tokens_total","input_tokens_total"===ee&&"desc"===ne?"asc":"desc")},children:["Total ",he("input_tokens_total")]})]})}),(0,o.jsx)(Y.h5,{sx:{borderTop:"none",padding:"8px 12px"},children:(0,o.jsxs)(c.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:2},children:[(0,o.jsxs)(d.A,{variant:"caption",sx:{cursor:"pointer",fontWeight:"output_tokens_max"===ee?600:400,color:"output_tokens_max"===ee?"#1976d2":"#6b7280",flex:1,textAlign:"center"},onClick:function(){return null==te?void 0:te("output_tokens_max","output_tokens_max"===ee&&"desc"===ne?"asc":"desc")},children:["Max ",he("output_tokens_max")]}),(0,o.jsxs)(d.A,{variant:"caption",sx:{cursor:"pointer",fontWeight:"output_tokens_avg"===ee?600:400,color:"output_tokens_avg"===ee?"#1976d2":"#6b7280",flex:1,textAlign:"center"},onClick:function(){return null==te?void 0:te("output_tokens_avg","output_tokens_avg"===ee&&"desc"===ne?"asc":"desc")},children:["Avg ",he("output_tokens_avg")]}),(0,o.jsxs)(d.A,{variant:"caption",sx:{cursor:"pointer",fontWeight:"output_tokens_min"===ee?600:400,color:"output_tokens_min"===ee?"#1976d2":"#6b7280",flex:1,textAlign:"center"},onClick:function(){return null==te?void 0:te("output_tokens_min","output_tokens_min"===ee&&"desc"===ne?"asc":"desc")},children:["Min ",he("output_tokens_min")]}),(0,o.jsxs)(d.A,{variant:"caption",sx:{cursor:"pointer",fontWeight:"output_tokens_total"===ee?600:400,color:"output_tokens_total"===ee?"#1976d2":"#6b7280",flex:1,textAlign:"center"},onClick:function(){return null==te?void 0:te("output_tokens_total","output_tokens_total"===ee&&"desc"===ne?"asc":"desc")},children:["Total ",he("output_tokens_total")]})]})})]})]}),(0,o.jsx)(v.A,{children:t?(0,o.jsx)(L.bU,{rows:6,columns:5}):n&&0!==n.length?n.map((function(e,n){var t,r,i,s,l,a=(t=e.tier,{label:(null==(r=R.UE.find((function(e){return e.value===t})))?void 0:r.label)||t||"Free",tier:t||"free"}),x=-e.wallet_balance_used;return(0,o.jsxs)(Y.oM,{children:[(0,o.jsx)(Y.Yc,{children:(0,o.jsxs)(c.A,{children:[(0,o.jsx)(d.A,{variant:"body2",fontWeight:500,children:e.full_name}),(0,o.jsx)(d.A,{variant:"caption",color:"text.secondary",children:e.email}),(0,o.jsx)("br",{}),(0,o.jsx)(d.A,{variant:"caption",color:"text.secondary",children:e.agency_name})]})}),(0,o.jsx)(Y.Yc,{children:(0,o.jsx)(Y.nY,{label:a.label,size:"small",tier:a.tier})}),(0,o.jsx)(Y.Yc,{children:(i=e.personal_api_keys,s=i||[],l=!0,(0,o.jsxs)(c.A,{sx:{display:"flex",gap:.5,flexWrap:"wrap"},children:[ge.map((function(e){var n=s.includes(e);return n&&(l=!1),n?(0,o.jsx)(u.A,{label:e,size:"small",sx:{fontSize:"11px",height:"22px",fontWeight:600,backgroundColor:"OpenAI"===e?"#10b981":"Claude"===e?"#8b5cf6":"#f59e0b",color:"white"}},e):null})),l&&(0,o.jsx)(d.A,{variant:"caption",children:"-"})]}))}),(0,o.jsx)(Y.Yc,{children:(0,o.jsxs)(d.A,{variant:"body2",fontWeight:500,color:x>=0?"success":"error",children:["$",(0,X.ZV)(x,4)]})}
1),(0,o.jsx)(Y.Yc,{sx:{borderLeft:"1px solid #f0f0f0"},children:(0,o.jsxs)(c.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:2},children:[(0,o.jsx)(c.A,{sx:{textAlign:"center",flex:1},children:(0,o.jsx)(d.A,{variant:"body2",fontWeight:600,sx:{color:fe(e.input_tokens_max,"input")},children:(0,X.ZV)(e.input_tokens_max)})}),(0,o.jsx)(c.A,{sx:{textAlign:"center",flex:1},children:(0,o.jsx)(d.A,{variant:"body2",sx:{color:fe(Math.round(e.input_tokens_avg),"input")},children:(0,X.ZV)(Math.round(e.input_tokens_avg))})}),(0,o.jsx)(c.A,{sx:{textAlign:"center",flex:1},children:(0,o.jsx)(d.A,{variant:"body2",sx:{color:fe(e.input_tokens_min,"input")},children:(0,X.ZV)(e.input_tokens_min)})}),(0,o.jsx)(c.A,{sx:{textAlign:"center",flex:1},children:(0,o.jsx)(d.A,{variant:"body2",fontWeight:600,sx:{color:fe(e.input_tokens_total,"input")},children:(0,X.ZV)(e.input_tokens_total)})})]})}),(0,o.jsx)(Y.Yc,{sx:{borderLeft:"1px solid #f0f0f0"},children:(0,o.jsxs)(c.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:2},children:[(0,o.jsx)(c.A,{sx:{textAlign:"center",flex:1},children:(0,o.jsx)(d.A,{variant:"body2",fontWeight:600,sx:{color:fe(e.output_tokens_max,"output")},children:(0,X.ZV)(e.output_tokens_max)})}),(0,o.jsx)(c.A,{sx:{textAlign:"center",flex:1},children:(0,o.jsx)(d.A,{variant:"body2",sx:{color:fe(Math.round(e.output_tokens_avg),"output")},children:(0,X.ZV)(Math.round(e.output_tokens_avg))})}),(0,o.jsx)(c.A,{sx:{textAlign:"center",flex:1},children:(0,o.jsx)(d.A,{variant:"body2",sx:{color:fe(e.output_tokens_min,"output")},children:(0,X.ZV)(e.output_tokens_min)})}),(0,o.jsx)(c.A,{sx:{textAlign:"center",flex:1},children:(0,o.jsx)(d.A,{variant:"body2",fontWeight:600,sx:{color:fe(e.output_tokens_total,"output")},children:(0,X.ZV)(e.output_tokens_total)})})]})})]},e.id||n)})):(0,o.jsx)(A.A,{children:(0,o.jsx)(Y.Yc,{colSpan:5,align:"center",children:(0,o.jsx)(d.A,{color:"text.secondary",children:i?"No matching users found":"No users found"})})})})]})}),(0,o.jsxs)(c.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mt:3},children:[(0,o.jsxs)(c.A,{sx:{display:"flex",alignItems:"center"},children:[(0,o.jsx)(d.A,{variant:"body2",sx:{mr:1},children:"Show"}),(0,o.jsx)(m.A,{variant:"outlined",size:"small",sx:{minWidth:80},children:(0,o.jsx)(k.A,{value:$,onChange:function(e){q(e.target.value)},displayEmpty:!0,children:R.A3.map((function(e){return(0,o.jsx)(y.A,{value:e,children:e},e)}))})}),(0,o.jsx)(d.A,{variant:"body2",sx:{ml:1},children:"entries"})]}),(0,o.jsxs)(d.A,{variant:"body2",color:"text.secondary",children:["Showing ",xe," to ",pe," of ",a," results"]}),(0,o.jsx)(C.A,{count:N,page:l,onChange:function(e,n){Q(n)},color:"primary",shape:"rounded",showFirstButton:!0,showLastButton:!0})]})]}),(0,o.jsx)(S.Ay,{open:_e,anchorEl:ie,onClose:ue,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},PaperProps:{sx:{width:280,border:"1px solid #e5e7eb",borderRadius:"8px",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"}},children:(0,o.jsxs)(c.A,{sx:{p:2},children:[(0,o.jsxs)(c.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,o.jsx)(d.A,{variant:"h6",sx:{fontWeight:600,fontSize:"16px"},children:"Filters"}),(0,o.jsx)(w.A,{onClick:ue,size:"small",children:(0,o.jsx)(E.A,{fontSize:"small"})})]}),(0,o.jsxs)(c.A,{sx:{mb:2},children:[(0,o.jsx)(d.A,{variant:"subtitle2",sx:{mb:1,fontWeight:600,color:"#374151"},children:"Tier"}),(0,o.jsxs)(m.A,{fullWidth:!0,size:"small",children:[(0,o.jsx)(W.A,{children:"All tiers"}),(0,o.jsxs)(k.A,{value:ae.tier,label:"All tiers",onChange:function(e){return ce((function(n){return B(B({},n),{tier:e.target.value})}))},sx:{backgroundColor:"white","& .MuiOutlinedInput-notchedOutline":{borderColor:"#d1d5db"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#9ca3af"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#3b82f6"}},children:[(0,o.jsx)(y.A,{value:"",children:"All tiers"}),R.UE.map((function(e){return(0,o.jsx)(y.A,{value:e.value,children:e.label},e.value)}))]})]})]}),(0,o.jsxs)(c.A,{sx:{mb:2},children:[(0,o.jsx)(d.A,{variant:"subtitle2",sx:{mb:1,fontWeight:600,color:"#374151"},children:"Personal API"}),(0,o.jsx)(c.A,{sx:{display:"flex",flexDirection:"column",gap:.5},children:R.JQ.map((function(e){return(0,o.jsx)(z.A,{control:(0,o.jsx)(I.A,{checked:(ae.personal_api||[]).includes(e.value),onChange:function(n){var t=ae.personal_api||[],o=t.includes(e.value)?t.filter((function(n){return n!==e.value})):G(G([],t,!0),[e.value],!1);ce((function(e){return B(B({},e),{personal_api:o})}))}
1,size:"small",sx:{color:"#6b7280","&.Mui-checked":{color:"#3b82f6"},padding:"4px"}}),label:(0,o.jsx)(d.A,{variant:"body2",sx:{fontWeight:500,color:"#374151",fontSize:"13px"},children:e.label}),sx:{margin:0}},e.value)}))})]}),(0,o.jsxs)(c.A,{sx:{mb:2},children:[(0,o.jsx)(d.A,{variant:"subtitle2",sx:{mb:1,fontWeight:600,color:"#374151"},children:"Users without Personal API"}),(0,o.jsxs)(c.A,{sx:{display:"flex",flexDirection:"column",gap:.5},children:[(0,o.jsx)(z.A,{control:(0,o.jsx)(I.A,{checked:ae.exclude_no_openai,onChange:function(e){return ce((function(n){return B(B({},n),{exclude_no_openai:e.target.checked})}))},size:"small",sx:{color:"#6b7280","&.Mui-checked":{color:"#3b82f6"},padding:"4px"}}),label:(0,o.jsx)(d.A,{variant:"body2",sx:{fontWeight:500,color:"#374151",fontSize:"13px"},children:"Without OpenAI key"}),sx:{margin:0}}),(0,o.jsx)(z.A,{control:(0,o.jsx)(I.A,{checked:ae.exclude_no_claude,onChange:function(e){return ce((function(n){return B(B({},n),{exclude_no_claude:e.target.checked})}))},size:"small",sx:{color:"#6b7280","&.Mui-checked":{color:"#3b82f6"},padding:"4px"}}),label:(0,o.jsx)(d.A,{variant:"body2",sx:{fontWeight:500,color:"#374151",fontSize:"13px"},children:"Without Claude key"}),sx:{margin:0}}),(0,o.jsx)(z.A,{control:(0,o.jsx)(I.A,{checked:ae.exclude_no_grok,onChange:function(e){return ce((function(n){return B(B({},n),{exclude_no_grok:e.target.checked})}))},size:"small",sx:{color:"#6b7280","&.Mui-checked":{color:"#3b82f6"},padding:"4px"}}),label:(0,o.jsx)(d.A,{variant:"body2",sx:{fontWeight:500,color:"#374151",fontSize:"13px"},children:"Without Grok key"}),sx:{margin:0}})]})]}),(0,o.jsxs)(c.A,{sx:{mb:2},children:[(0,o.jsx)(d.A,{variant:"subtitle2",sx:{mb:1,fontWeight:600,color:"#374151"},children:"Duration"}),(0,o.jsxs)(c.A,{sx:{display:"flex",flexDirection:"column",gap:1},children:[(0,o.jsxs)(c.A,{children:[(0,o.jsx)(d.A,{variant:"body2",sx:{mb:.5,fontWeight:500,color:"#6b7280",fontSize:"12px"},children:"Start Date"}),(0,o.jsx)(h.A,{fullWidth:!0,size:"small",type:"date",value:ae.start_date,onChange:function(e){return de("start_date",e.target.value)},sx:{"& .MuiOutlinedInput-root":{backgroundColor:"white","& fieldset":{borderColor:"#d1d5db"},"&:hover fieldset":{borderColor:"#9ca3af"},"&.Mui-focused fieldset":{borderColor:"#3b82f6"}}}})]}),(0,o.jsxs)(c.A,{children:[(0,o.jsx)(d.A,{variant:"body2",sx:{mb:.5,fontWeight:500,color:"#6b7280",fontSize:"12px"},children:"End Date"}),(0,o.jsx)(h.A,{fullWidth:!0,size:"small",type:"date",value:ae.end_date,onChange:function(e){return de("end_date",e.target.value)},sx:{"& .MuiOutlinedInput-root":{backgroundColor:"white","& fieldset":{borderColor:"#d1d5db"},"&:hover fieldset":{borderColor:"#9ca3af"},"&.Mui-focused fieldset":{borderColor:"#3b82f6"}}}})]})]})]}),(0,o.jsx)(P.A,{sx:{my:1.5}}),(0,o.jsxs)(c.A,{sx:{display:"flex",gap:1},children:[(0,o.jsx)(g.A,{onClick:function(){var e={tier:"",personal_api:[],start_date:"",end_date:"",exclude_no_openai:!1,exclude_no_claude:!1,exclude_no_grok:!1};ce(e),J(e),K(),se(null)},variant:"outlined",color:"secondary",startIcon:(0,o.jsx)(Z.A,{}),fullWidth:!0,sx:{fontSize:"12px",py:1},children:"Reset"}),(0,o.jsx)(g.A,{onClick:function(){J(ae),se(null)},variant:"contained",color:"primary",startIcon:(0,o.jsx)(D.A,{}),fullWidth:!0,sx:{fontSize:"12px",py:1},children:"Apply"})]}),(0,o.jsx)(c.A,{sx:{mt:1.5,pt:1.5,borderTop:"1px solid #f3f4f6"},children:(0,o.jsxs)(d.A,{variant:"caption",sx:{color:"#6b7280",fontSize:"11px"},children:["Showing ",a," of ",a," users"]})})]})})]})},Q=function(){return Q=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},Q.apply(this,arguments)},H=function(e,n,t,o){return new(t||(t=Promise))((function(r,i){function s(e){try{a(o.next(e))}catch(e){i(e)}}function l(e){try{a(o.throw(e))}catch(e){i(e)}}function a(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,l)}a((o=o.apply(e,n||[])).next())}))},J=function(e,n){var t,o,r,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]}
1,trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=l(0),s.throw=l(1),s.return=l(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function l(l){return function(a){return function(l){if(t)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(i=0)),i;)try{if(t=1,o&&(r=2&l[0]?o.return:l[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,l[1])).done)return r;switch(o=0,r&&(l=[2&l[0],r.value]),l[0]){case 0:case 1:r=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,o=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(r=i.trys,(r=r.length>0&&r[r.length-1])||6!==l[0]&&2!==l[0])){i=0;continue}if(3===l[0]&&(!r||l[1]>r[0]&&l[1]<r[3])){i.label=l[1];break}if(6===l[0]&&i.label<r[1]){i.label=r[1],r=l;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(l);break}r[2]&&i.ops.pop(),i.trys.pop();continue}l=n.call(e,i)}catch(e){l=[6,e],o=0}finally{t=r=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,a])}}};function $(){var e=new Date,n=new Date(e);return n.setMonth(e.getMonth()-1),{start_date:n.toISOString().slice(0,10),end_date:e.toISOString().slice(0,10)}}
1var q=function(){var e=$(),n=e.start_date,t=e.end_date,i=(0,r.useState)(R._U),c=i[0],u=i[1],d=(0,r.useState)(R.yQ),x=d[0],p=d[1],h=(0,r.useState)(""),f=h[0],g=h[1],_=(0,r.useState)({tier:"",personal_api:[],start_date:n,end_date:t,exclude_no_openai:!1,exclude_no_claude:!1,exclude_no_grok:!1}),b=_[0],j=_[1],A=(0,r.useState)("input_tokens_max"),v=A[0],m=A[1],k=(0,r.useState)("desc"),y=k[0],C=k[1],S=(0,l.RT)({page:c,page_size:x,search:f,filters:b,ordering:v?"".concat("desc"===y?"-":"").concat(v):void 0}),w=S.data,W=S.isLoading,z=S.error,I=(0,r.useCallback)((function(e){u(e)}),[]),P=(0,r.useCallback)((function(e){p(e),u(1)}),[]),M=(0,r.useCallback)((function(e){g(e),u(1)}),[]),O=(0,r.useCallback)((function(e){j(e),u(1)}),[]),T=(0,r.useCallback)((function(){j(Q({tier:"",personal_api:[],exclude_no_openai:!1,exclude_no_claude:!1,exclude_no_grok:!1},$())),u(1)}),[]),E=(0,r.useCallback)((function(e,n){m(e),C(n),u(1)}),[]),F=(0,r.useCallback)((function(){return H(void 0,void 0,void 0,(function(){var e;return J(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,a.Hz.exportMessagingUsageList({tier:b.tier||void 0,personal_api:b.personal_api.length>0?b.personal_api:void 0,start_date:b.start_date||void 0,end_date:b.end_date||void 0,exclude_no_openai:b.exclude_no_openai||void 0,exclude_no_claude:b.exclude_no_claude||void 0,exclude_no_grok:b.exclude_no_grok||void 0,ordering:v?"".concat("desc"===y?"-":"").concat(v):void 0})];case 1:return n.sent(),[3,3];case 2:return e=n.sent(),console.error("Export failed:",e),[3,3];case 3:return[2]}}
1))}))}),[b,v,y]),U=(null==w?void 0:w.count)?Math.ceil(w.count/x):0;return z?(0,o.jsx)(s.A,{severity:"error",sx:{m:4},children:"Error loading messaging usage data. Please try again."}):(0,o.jsx)(N,{users:(null==w?void 0:w.results)||[],loading:W,searchTerm:f,onSearchChange:M,currentPage:c,totalCount:(null==w?void 0:w.count)||0,totalPages:U,onPageChange:I,filters:b,onFiltersChange:O,entriesPerPage:x,onEntriesPerPageChange:P,onResetFilters:T,sortField:v,sortOrder:y,onSortChange:E,onExport:F})};function K(){return(0,o.jsx)(i.i,{children:(0,o.jsx)(q,{})})}}}]);
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.