PageSourceSearch

https://app.slaydigital.ai/static/react/9808.c026bb835c25a25516f9.js

js slaydigital.ai collected 2026-10-05 14:40:37 UTC 53,286 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkStammer_ai=self.webpackChunkStammer_ai||[]).push([[9808],{38172:function(e,n,t){var r=t(81056),a=t(78685);n.A=(0,r.A)([(0,a.jsx)("path",{d:"M21 7.28V5c0-1.1-.9-2-2-2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-2.28c.59-.35 1-.98 1-1.72V9c0-.74-.41-1.37-1-1.72M20 9v6h-7V9zM5 19V5h14v2h-6c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h6v2z"},"0"),(0,a.jsx)("circle",{cx:"16",cy:"12",r:"1.5"},"1")],"AccountBalanceWalletOutlined")},52280:function(e,n,t){var r=t(81056),a=t(78685);n.A=(0,r.A)((0,a.jsx)("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"}),"EditOutlined")},97506:function(e,n,t){var r=t(81056),a=t(78685);n.A=(0,r.A)((0,a.jsx)("path",{d:"M22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2zm-2 0-8 5-8-5zm0 12H4V8l8 5 8-5z"}),"EmailOutlined")},90855:function(e,n,t){var r=t(81056),a=t(78685);n.A=(0,r.A)((0,a.jsx)("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess")},25594:function(e,n,t){var r=t(81056),a=t(78685);n.A=(0,r.A)((0,a.jsx)("path",{d:"M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}),"Folder")},25045:function(e,n,t){var r=t(81056),a=t(78685);n.A=(0,r.A)((0,a.jsx)("path",{d:"M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3 1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5"}),"People")},23837:function(e,n,t){var r=t(81056),a=t(78685);n.A=(0,r.A)((0,a.jsx)("path",{d:"M12 6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2m0 10c2.7 0 5.8 1.29 6 2H6c.23-.72 3.31-2 6-2m0-12C9.79 4 8 5.79 8 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4m0 10c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4"}),"PersonOutlined")},38519:function(e,n,t){var r=t(81056),a=t(78685);n.A=(0,r.A)((0,a.jsx)("path",{d:"M6 15c-.83 0-1.58.34-2.12.88C2.7 17.06 2 22 2 22s4.94-.7 6.12-1.88c.54-.54.88-1.29.88-2.12 0-1.66-1.34-3-3-3m.71 3.71c-.28.28-2.17.76-2.17.76s.47-1.88.76-2.17c.17-.19.42-.3.7-.3.55 0 1 .45 1 1 0 .28-.11.53-.29.71m10.71-5.06c6.36-6.36 4.24-11.31 4.24-11.31S16.71.22 10.35 6.58l-2.49-.5c-.65-.13-1.33.08-1.81.55L2 10.69l5 2.14L11.17 17l2.14 5 4.05-4.05c.47-.47.68-1.15.55-1.81zM7.41 10.83l-1.91-.82 1.97-1.97 1.44.29c-.57.83-1.08 1.7-1.5 2.5m6.58 7.67-.82-1.91c.8-.42 1.67-.93 2.49-1.5l.29 1.44zM16 12.24c-1.32 1.32-3.38 2.4-4.04 2.73l-2.93-2.93c.32-.65 1.4-2.71 2.73-4.04 4.68-4.68 8.23-3.99 8.23-3.99s.69 3.55-3.99 8.23M15 11c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2"}),"RocketLaunchOutlined")},70023:function(e,n,t){var r=t(81056),a=t(78685);n.A=(0,r.A)((0,a.jsx)("path",{d:"m16 18 2.29-2.29-4.88-4.88-4 4L2 7.41 3.41 6l6 6 4-4 6.3 6.29L22 12v6z"}),"TrendingDown")},37922:function(e,n,t){var r=t(81056),a=t(78685);n.A=(0,r.A)((0,a.jsx)("path",{d:"m16 6 2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z"}),"TrendingUp")},55073:function(e,n,t){t.r(n),t.d(n,{SubaccountsPage:function(){return un}});var r=t(78685),a=t(2057),l=t(45602),o=t(13289),i=t(39675),s=t(78166),c=t(69179),u=t(81e3),d=t(96078),A=t(83474),S=t(14428),h=t(31547),x=t(77040),p=t(93610),f=t(65179),I=t(26400),v=t(83589),g=t(38588),b=t(97184),L=t(10838),m=t(69656),T=t(16657),_=t(18707),E=(0,t(81056).A)((0,r.jsx)("path",{d:"m18 12 4-4-4-4v3H3v2h15zM6 12l-4 4 4 4v-3h15v-2H6z"}),"SyncAlt"),j=t(9414),C=t(33559),R=t(63809),y=t(76776),D=t(45924),N=t(67076),P=t(96509),O=t(30017),Y=t(70559),G=t(64901),w=t(81971),U=t(45043),B=t(17577),k=t(34994),W=t(50616),z=t(98333),F=t(95614),V=t(64998),M=t(50764),H=t(79108),K=t(74058),q=t(34467),Q=t(9388),X=t(70023),$=t(37922),J=t(47577),Z=t(19124),ee=t(35611),ne=t(20976),te=t(34502),re=function(){return re=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var a in n=arguments[t])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},re.apply(this,arguments)},ae=function(e,n,t,r){return new(t||(t=Promise))((function(a,l){function o(e){try{s(r.next(e))}catch(e){l(e)}}function i(e){try{s(r.throw(e))}catch(e){l(e)}}function s(e){var n;e.done?a(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,i)}s((r=r.apply(e,n||[])).next())}))},le=function(e,n){var t,r,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=i(0),o.throw=i(1),o.return=i(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(s){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(l=0)),l;)try{if(t=1,r&&(a=2&i[0]?r.return:i[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;switch(r=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,r=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!(a=l.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){l=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){l.label=i[1];break}if(6===i[0]&&l.label<a[1]){l.label=a[1],a=i;break}if(a&&l.label<a[2]){l.label=a[2],l.ops.push(i);break}a[2]&&l.ops.pop(),l.trys.pop();continue}i=n.call(e,l)}catch(e){i=[6,e],r=0}finally{t=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},oe=function(e){var n,t,l=e.subaccounts,o=e.currencyLabel,i=e.isLoading,s=e.setSelectedSubaccount,c=e.setIsSubaccountDrawerOpen,u=e.setSubaccountToDelete,S=e.startDate,x=e.endDate,p=e.compareEnabled,f=e.compareStartDate,I=e.compareEndDate,v=e.compareUsageMap,g=e.isLoadingCompare,b
1=(0,T.Bd)().t,m=(0,A.A)(),_=(0,a.useState)(null),E=_[0],j=_[1],C=(0,a.useState)(null),oe=C[0],ie=C[1],se=(0,a.useState)(null),ce=se[0],ue=se[1],de=(0,a.useState)(null),Ae=de[0],Se=de[1],he=null!==(t=null!==(n=null==ce?void 0:ce.totalChatbots)&&void 0!==n?n:null==ce?void 0:ce.allocatedChatbots)&&void 0!==t?t:0,xe=function(){j(null),ie(null)},pe={fontWeight:600,color:"text.secondary",backgroundColor:m.palette.action.hover,borderBottom:"1px solid ".concat(m.palette.divider)},fe=function(e){return e?e.toLocaleDateString("en-US",{month:"short",day:"numeric"}):""},Ie=function(e,n){var t=e-n;if(0===t)return(0,r.jsx)(L.A,{variant:"body2",color:"text.secondary",children:"—"});var a=t>0,l=a?"success.main":"error.main",i=a?$.A:X.A,s=a?"+":"−",c=0===n?null:t/n*100;return(0,r.jsxs)(h.A,{display:"inline-flex",alignItems:"center",gap:.5,sx:{color:l},children:[(0,r.jsx)(i,{sx:{fontSize:14}}),(0,r.jsxs)(L.A,{variant:"body2",sx:{fontWeight:600,color:"inherit"},children:[s,o,(0,Z.IY)(Math.abs(t)),null!==c&&(0,r.jsxs)(L.A,{component:"span",variant:"caption",sx:{ml:.5,color:"inherit"},children:["(",s,Math.abs(c).toFixed(1),"%)"]})]})]})};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(R.A,{elevation:0,sx:{width:"100%",borderRadius:2,border:"1px solid ".concat(m.palette.divider),overflow:"hidden"},children:(0,r.jsx)(y.A,{children:(0,r.jsxs)(D.A,{size:"medium",children:[(0,r.jsx)(N.A,{children:(0,r.jsxs)(P.A,{children:[(0,r.jsx)(O.A,{sx:pe,children:b("DISPLAY_STRINGS.SUB_ACCOUNT","Sub-Account")}),(0,r.jsx)(O.A,{sx:pe,align:"right",children:b("DISPLAY_STRINGS.WALLET_BALANCE","Wallet Balance")}),(0,r.jsx)(O.A,{sx:pe,align:"right",children:(0,r.jsxs)(h.A,{sx:{display:"inline-flex",alignItems:"center",gap:.5},children:[b("DISPLAY_STRINGS.USAGE","Usage")," (",S&&x?"".concat(fe(S)," - ").concat(fe(x)):b("DISPLAY_STRINGS.ALL_TIME","All time"),")",(0,r.jsx)(Y.A,{title:b("DISPLAY_STRINGS.USAGE_TOOLTIP","Amount the agency was billed from the agency's wallet for the sub-account during the selected time period"),arrow:!0,placement:"top",children:(0,r.jsx)(M.A,{sx:{fontSize:14,color:"text.secondary",cursor:"help"}})})]})}),p&&(0,r.jsxs)(O.A,{sx:pe,align:"right",children:[b("DISPLAY_STRINGS.USAGE","Usage")," (",fe(f)," -"," ",fe(I),")"]}),p&&(0,r.jsxs)(O.A,{sx:pe,align:"right",children:["Δ ",b("DISPLAY_STRINGS.CHANGE","Change")]}),(0,r.jsx)(O.A,{sx:pe,align:"right",children:b("DISPLAY_STRINGS.ACTIONS","Actions")})]})}),(0,r.jsxs)(G.A,{children:[i&&Array.from({length:5}).map((function(e,n){return(0,r.jsx)(P.A,{children:(0,r.jsx)(O.A,{colSpan:p?6:4,children:(0,r.jsx)(w.A,{variant:"rounded",height:48})})},"skeleton-".concat(n))})),!i&&0===l.length&&(0,r.jsx)(P.A,{children:(0,r.jsx)(O.A,{colSpan:4,align:"center",sx:{py:6},children:(0,r.jsx)(L.A,{variant:"body2",color:"text.secondary",children:b("DISPLAY_STRINGS.NO_SUBACCOUNTS_FOUND","No sub-accounts found")})})}),!i&&l.map((function(e){var n=(0,te.qY)(e.billingStatus),t=Ae===e.userId;return(0,r.jsxs)(P.A,{hover:!0,sx:{"&:last-child td":{borderBottom:0},transition:"background-color 160ms ease"},children:[(0,r.jsx)(O.A,{children:(0,r.jsxs)(h.A,{sx:{display:"flex",alignItems:"center",gap:1.5}
1,children:[(0,r.jsx)(U.A,{sx:re(re({width:36,height:36,borderRadius:1.5,bgcolor:m.palette.primary.light,color:m.palette.primary.main},m.typography.subtitle2),{fontWeight:700}),children:(0,te.IM)(e.name)}),(0,r.jsxs)(h.A,{sx:{minWidth:0},children:[(0,r.jsxs)(h.A,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,r.jsx)(L.A,{variant:"subtitle2",sx:{fontWeight:600},noWrap:!0,children:e.name}),(0,r.jsx)(B.A,{label:e.billingStatus.charAt(0).toUpperCase()+e.billingStatus.slice(1),size:"small",variant:"outlined",sx:{height:20,fontWeight:600,textTransform:"capitalize",borderColor:n,color:n,backgroundColor:"".concat(n,"14"),"& .MuiChip-label":re(re({},m.typography.caption),{fontWeight:600,fontSize:"0.68rem"})}})]}),(0,r.jsx)(L.A,{variant:"caption",color:"text.secondary",noWrap:!0,children:e.email})]})]})}),(0,r.jsx)(O.A,{align:"right",children:e.isDirectlyBillable?(0,r.jsx)(Y.A,{title:b("DISPLAY_STRINGS.DIRECTLY_BILLED_TOOLTIP"),arrow:!0,placement:"top",children:(0,r.jsxs)(h.A,{sx:{display:"inline-flex",alignItems:"center",gap:.5,cursor:"help"},children:[(0,r.jsx)(L.A,{variant:"body2",color:"text.secondary",children:b("DISPLAY_STRINGS.SUBSCRIPTION_DIRECTLY_BILLED")}),(0,r.jsx)(M.A,{sx:{fontSize:14,color:"text.secondary"}})]})}):(0,r.jsxs)(L.A,{variant:"body2",sx:{fontWeight:600},children:[o,(0,Z.IY)(e.currentWalletBalance||0)]})}),(0,r.jsx)(O.A,{align:"right",children:(0,r.jsx)(L.A,{variant:"body2",sx:{fontWeight:600},children:null==e.usageInRange?"—":"".concat(o).concat((0,Z.IY)(e.usageInRange))})}),p&&(0,r.jsx)(O.A,{align:"right",children:g?(0,r.jsx)(w.A,{variant:"text",width:60,sx:{ml:"auto"}}):(0,r.jsx)(L.A,{variant:"body2",sx:{fontWeight:600},children:null==v[e.id]?"—":"".concat(o).concat((0,Z.IY)(v[e.id]))})}),p&&(0,r.jsx)(O.A,{align:"right",children:g?(0,r.jsx)(w.A,{variant:"text",width:80,sx:{ml:"auto"}}):null==e.usageInRange||null==v[e.id]?(0,r.jsx)(L.A,{variant:"body2",color:"text.secondary",children:"—"}):Ie(e.usageInRange,v[e.id])}),(0,r.jsx)(O.A,{align:"right",children:(0,r.jsxs)(h.A,{sx:{display:"inline-flex",alignItems:"center",gap:.5},children:[!e.isEmailVerified&&(0,r.jsx)(Y.A,{title:b("DISPLAY_STRINGS.RESEND"),placement:"top",arrow:!0,children:(0,r.jsx)(k.A,{size:"small",sx:{width:32,height:32,transform:"rotate(-45deg)"},color:"warning",onClick:function(){return n=e.email,void(0,d.WE)(n).then((function(e){(0,Z.vd)(e.message)}));var n},children:(0,r.jsx)(K.A,{fontSize:"small"})})}),(0,r.jsx)(Y.A,{title:b("DISPLAY_STRINGS.SWITCH_TO_SUBACCOUNT"),placement:"top",arrow:!0,children:(0,r.jsx)(k.A,{size:"small",disabled:t,sx:{width:32,height:32,color:"text.secondary","&:hover":{color:"primary.main",backgroundColor:m.palette.primary.main+"14"}},onClick:function(){return ae(void 0,void 0,void 0,(function(){return le(this,(function(n){switch(n.label){case 0:Se(e.userId),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,(0,d.Ft)(e.userId)];case 2:return n.sent(),[3,4];case 3:return n.sent(),Se(null),[3,4];case 4:return[2]}}
1))}))},children:t?(0,r.jsx)(W.A,{size:16,color:"inherit"}):(0,r.jsx)(q.A,{fontSize:"small"})})}),(0,r.jsx)(Y.A,{title:b("DISPLAY_STRINGS.EDIT_SUBACCOUNT"),placement:"top",arrow:!0,children:(0,r.jsx)(k.A,{size:"small",sx:{width:32,height:32,color:"text.secondary","&:hover":{color:"success.main",backgroundColor:m.palette.success.main+"14"}},onClick:function(){s(e),c(!0)},children:(0,r.jsx)(V.A,{fontSize:"small"})})}),(0,r.jsx)(Y.A,{title:b("DISPLAY_STRINGS.MORE_OPTIONS"),placement:"top",arrow:!0,children:(0,r.jsx)(k.A,{size:"small",sx:{width:32,height:32,color:"text.secondary","&:hover":{color:"text.primary"}},onClick:function(n){return function(e,n){ie(n),j(e.currentTarget)}(n,e)},children:(0,r.jsx)(H.A,{fontSize:"small"})})})]})})]},e.id)}))]})]})})}),oe&&(0,r.jsx)(ee.A,{subaccount:oe,anchorEl:E,open:Boolean(E),onClose:xe,setSubaccountToDelete:u,onViewUsage:function(){ue(oe),xe()}}),ce&&(0,r.jsx)(ne.A,{open:Boolean(ce),onClose:function(){return ue(null)},title:"Usage - ".concat(ce.name),rows:[{label:b("DISPLAY_STRINGS.BALANCE"),value:"".concat(o).concat((0,Z.IY)(ce.currentWalletBalance||0)),progress:(ce.currentWalletBalance||0)>0?100:0,icon:(0,r.jsx)(z.A,{sx:{fontSize:16}})},{label:b("DISPLAY_STRINGS.VOICE_AGENTS"),value:"".concat((0,Z.IY)(ce.usedVoiceAgents||0),"/").concat((0,Z.IY)(ce.allocatedVoiceAgents||0)),progress:(ce.allocatedVoiceAgents||0)>0?(ce.usedVoiceAgents||0)/(ce.allocatedVoiceAgents||1)*100:0,icon:(0,r.jsx)(J.A,{sx:{fontSize:16}})},{label:b("DISPLAY_STRINGS.CHAT_AGENTS"),value:"".concat((0,Z.IY)(ce.usedChatbots||0),"/").concat((0,Z.IY)(he)),progress:he>0?(ce.usedChatbots||0)/he*100:0,icon:(0,r.jsx)(F.A,{sx:{fontSize:16}})},{label:b("DISPLAY_STRINGS.STORAGE"),value:"".concat((0,Z.IY)(ce.usedCharacterCount||0),"/").concat((0,Z.IY)(ce.characterCount||0)),progress:(ce.characterCount||0)>0?(ce.usedCharacterCount||0)/(ce.characterCount||1)*100:0,icon:(0,r.jsx)(Q.A,{sx:{fontSize:16}})}]})]})},ie=t(31467),se=t(60551),ce=t(21762),ue=t(86591),de=t(97749),Ae=function(e,n,t,r){return new(t||(t=Promise))((function(a,l){function o(e){try{s(r.next(e))}catch(e){l(e)}}function i(e){try{s(r.throw(e))}catch(e){l(e)}}function s(e){var n;e.done?a(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,i)}s((r=r.apply(e,n||[])).next())}))},Se=function(e,n){var t,r,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=i(0),o.throw=i(1),o.return=i(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(s){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(l=0)),l;)try{if(t=1,r&&(a=2&i[0]?r.return:i[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;switch(r=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,r=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!(a=l.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){l=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){l.label=i[1];break}if(6===i[0]&&l.label<a[1]){l.label=a[1],a=i;break}if(a&&l.label<a[2]){l.label=a[2],l.ops.push(i);break}a[2]&&l.ops.pop(),l.trys.pop();continue}i=n.call(e,l)}catch(e){i=[6,e],r=0}finally{t=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},he="alert-rules-list",xe="alert-rules-subaccounts-brief",pe=function(){return Ae(void 0,void 0,Promise,(function(){var e,n,t,r,a,l;return Se(this,(function(o){switch(o.label){case 0:return[4,se.A.get(ce.n.WHITE_LABEL.ABSTRACT_SUBACCOUNTS)];case 1:return e=o.sent(),n=null!==(a=null===(r=e.data)||void 0===r?void 0:r.data)&&void 0!==a?a:e.data,t=Array.isArray(n)?n:null!==(l=null==n?void 0:n.results)&&void 0!==l?l:[],[2,(0,Z.Cb)(t)]}}))}))},fe=function(){return Ae(void 0,void 0,Promise,(function(){var e,n,t,r;return Se(this,(function(a){switch(a.label){case 0:return[4,se.A.get(ce.n.WHITE_LABEL.ALERT_RULES)];case 1:return e=a.sent(),n=e.data,t=Array.isArray(n)?n:null!==(r=null==n?void 0:n.results)&&void 0!==r?r:[],[2,(0,Z.Cb)(t)]}}))}))},Ie=function(e){return void 0===e&&(e=!0),(0,ue.I)({queryKey:[he],queryFn:fe,enabled:e,refetchOnWindowFocus:!1,staleTime:3e4})},ve=function(e){return Ae(void 0,void 0,Promise,(function(){var n;return Se(this,(function(t){switch(t.label){case 0:return[4,se.A.post(ce.n.WHITE_LABEL.ALERT_RULES,(0,Z.uc)(e))];case 1:return n=t.sent(),[2,(0,Z.Cb)(n.data)]}}))}))},ge=function(e,n){return Ae(void 0,void 0,Promise,(function(){var t;return Se(this,(function(r){switch(r.label){case 0:return[4,se.A.patch(ce.n.WHITE_LABEL.ALERT_RULE_DETAIL(e),(0,Z.uc)(n))];case 1:return t=r.sent(),[2,(0,Z.Cb)(t.data)]}}))}))},be=function(e){return Ae(void 0,void 0,Promise,(function(){return Se(this,(function(n){switch(n.label){case 0:return[4,se.A.delete(ce.n.WHITE_LABEL.ALERT_RULE_DETAIL(e))];case 1:return n.sent(),[2]}}))}))},Le=t(74294),me=t(30778),Te=t(7098),_e=t(53630),Ee=t(91811),je=t(51140),Ce=t(47838),Re=t(90855),ye=t(54935),De=t(97506),Ne=t(52280),Pe=t(57559),Oe=t(54815),Ye=t(26120),Ge=t(49780),we=t(88458),Ue="all_subaccounts",Be="specific_subaccount",ke="wallet_balance",We="usage",ze="above",Fe="below",Ve=[{value:1,labelKey:"DISPLAY_STRINGS.LAST_1_DAY",fallback:"Last 1 day"},{value:7,labelKey:"DISPLAY_STRINGS.LAST_7_DAYS",fallback:"Last 7 days"},{value:30,labelKey:"DISPLAY_STRINGS.LAST_30_DAYS",fallback:"Last 30 days"}],Me=function(e){var n,t,o=e.rule,i=e.onClose,s=(0,T.Bd)().t,c=(0,A.A)(),u=null!==o,d=(0,a.useState)(Ue),S=d[0],v=d[1],b=(0,a.useState)(""),m=b[0],_=b[1],E=(0,a.useState)(ke),j=E[0],C=E[1],R=(0,a.useState)(Fe),y=R[0],D=R[1],N=(0,a.useState)(""),P=N[0],O=N[1],Y=(0,a.useState)(7),G=Y[0],w=Y[1],U=(0,a.useState)({}),B=U[0],k=U[1],W=(n=!0,void 0===n&&(n=!0),(0,ue.I)({queryKey:[xe],queryFn:pe,enabled:n,refetchOnWindowFocus:!1,staleTime:6e4})).data,z=void 0===W?[]:W,F=(t=(0,l.jE)(),(0,de.n)({mutationFn:ve,onSuccess:function(){t.invalidateQueries({queryKey:[he]})}})),V=function(){var e=(0,l.jE)();return(0,de.n)({mutationFn:function(e){var n=e.id,t=e.payload;return ge(n,t)}
1,onSuccess:function(){e.invalidateQueries({queryKey:[he]})}})}(),M=F.isPending||V.isPending;(0,a.useEffect)((function(){var e,n;o?(v(o.scope),_(null!==(e=o.subaccount)&&void 0!==e?e:""),C(o.triggerType),D(o.condition),O(o.thresholdAmount),w(null!==(n=o.timeWindowDays)&&void 0!==n?n:7)):(v(Ue),_(""),C(ke),D(Fe),O(""),w(7)),k({})}),[o]);var H=(0,a.useMemo)((function(){return function(e,n,t,r,a){var l=t||"0";if(e===ke)return n===Fe?a("DISPLAY_STRINGS.RULE_NAME_WALLET_BELOW",{defaultValue:"Wallet balance below ${{amount}}",amount:l}):a("DISPLAY_STRINGS.RULE_NAME_WALLET_ABOVE",{defaultValue:"Wallet balance above ${{amount}}",amount:l});var o=1===r?a("DISPLAY_STRINGS.WINDOW_LABEL_1_DAY",{defaultValue:"last 1 day"}):a("DISPLAY_STRINGS.WINDOW_LABEL_N_DAYS",{defaultValue:"last {{days}} days",days:null!=r?r:7});return n===Fe?a("DISPLAY_STRINGS.RULE_NAME_USAGE_UNDER",{defaultValue:"Usage under ${{amount}} in {{windowLabel}}",amount:l,windowLabel:o}):a("DISPLAY_STRINGS.RULE_NAME_USAGE_OVER",{defaultValue:"Usage over ${{amount}} in {{windowLabel}}",amount:l,windowLabel:o})}(j,y,P,G,s)}),[j,y,P,G,s]);return(0,r.jsxs)(h.A,{sx:{mt:2,padding:"14px",border:"1px solid ".concat(c.palette.divider),borderRadius:2,backgroundColor:(0,Te.X4)(c.palette.primary.main,.02),display:"flex",flexDirection:"column",gap:2},children:[(0,r.jsx)(L.A,{variant:"body2",fontWeight:600,children:u?s("DISPLAY_STRINGS.EDIT_ALERT_RULE","Edit alert rule"):s("DISPLAY_STRINGS.ADD_ALERT_RULE","Add alert rule")}),(0,r.jsxs)(h.A,{children:[(0,r.jsx)(L.A,{variant:"caption",fontWeight:500,color:"text.secondary",children:s("DISPLAY_STRINGS.SCOPE","Scope")}),(0,r.jsxs)(Oe.A,{row:!0,value:S,onChange:function(e){return v(e.target.value)},children:[(0,r.jsx)(Ye.A,{value:Ue,control:(0,r.jsx)(Ge.A,{size:"small"}),label:(0,r.jsx)(L.A,{variant:"body2",children:s("DISPLAY_STRINGS.ALL_SUBACCOUNTS","All sub-accounts")})}),(0,r.jsx)(Ye.A,{value:Be,control:(0,r.jsx)(Ge.A,{size:"small"}),label:(0,r.jsx)(L.A,{variant:"body2",children:s("DISPLAY_STRINGS.SPECIFIC_SUBACCOUNT","Specific sub-account")})})]})]}),S===Be&&(0,r.jsxs)(x.A,{fullWidth:!0,size:"small",error:!!B.subaccount,children:[(0,r.jsx)(L.A,{variant:"caption",fontWeight:500,color:"text.secondary",mb:.5,children:s("DISPLAY_STRINGS.SUBACCOUNT","Sub-account")}),(0,r.jsxs)(p.A,{value:m,onChange:function(e){return _(Number(e.target.value))},displayEmpty:!0,children:[(0,r.jsx)(f.A,{value:"",disabled:!0,children:s("DISPLAY_STRINGS.CHOOSE_SUBACCOUNT","Choose a sub-account...")}),z.map((function(e){return(0,r.jsx)(f.A,{value:e.id,children:e.name||"Sub-account #".concat(e.id)},e.id)}))]}),B.subaccount&&(0,r.jsx)(L.A,{variant:"caption",color:"error",mt:.5,children:B.subaccount})]}),(0,r.jsxs)(h.A,{display:"flex",gap:1.5,children:[(0,r.jsxs)(x.A,{fullWidth:!0,size:"small",children:[(0,r.jsx)(L.A,{variant:"caption",fontWeight:500,color:"text.secondary",mb:.5,children:s("DISPLAY_STRINGS.METRIC","Metric")}),(0,r.jsxs)(p.A,{value:j,onChange:function(e){return C(e.target.value)},children:[(0,r.jsx)(f.A,{value:ke,children:s("DISPLAY_STRINGS.WALLET_BALANCE","Wallet balance")}),(0,r.jsx)(f.A,{value:We,children:s("DISPLAY_STRINGS.USAGE_SPEND","Usage spend")})]})]}),(0,r.jsxs)(x.A,{fullWidth:!0,size:"small",children:[(0,r.jsx)(L.A,{variant:"caption",fontWeight:500,color:"text.secondary",mb:.5,children:s("DISPLAY_STRINGS.CONDITION","Condition")}),(0,r.jsxs)(p.A,{value:y,onChange:function(e){return D(e.target.value)},children:[(0,r.jsx)(f.A,{value:Fe,children:s("DISPLAY_STRINGS.BELOW","Below")}),(0,r.jsx)(f.A,{value:ze,children:s("DISPLAY_STRINGS.ABOVE","Above")})]})]})]}),(0,r.jsxs)(h.A,{display:"flex",gap:1.5,children:[(0,r.jsxs)(x.A,{fullWidth:!0,size:"small",error:!!B.thresholdAmount,children:[(0,r.jsx)(L.A,{variant:"caption",fontWeight:500,color:"text.secondary",mb:.5,children:s("DISPLAY_STRINGS.THRESHOLD","Threshold ($)")}),(0,r.jsx)(g.A,{type:"number",size:"small",value:P,onChange:function(e){return O(e.target.value)},error:!!B.thresholdAmount,helperText:B.thresholdAmount,InputProps:{startAdornment:(0,r.jsx)(we.A,{position:"start",children:"$"}),inputProps:{min:0,step:"0.01"}}})]}),j===We&&(0,r.jsxs)(x.A,{fullWidth:!0,size:"small",children:[(0,r.jsx)(L.A,{variant:"caption",fontWeight:500,color:"text.secondary",mb:.5,children:s("DISPLAY_STRINGS.TIME_WINDOW","Time window")}),(0,r.jsx)(p.A,{value:G,onChange:function(e){return w(Number(e.target.value))},children:Ve.map((function(e){return(0,r.jsx)(f.A,{value:e.value,children:s(e.labelKey,e.fallback)},e.value)}))})]})]}),(0,r.jsxs)(h.A,{children:[(0,r.jsx)(L.A,{variant:"caption",fontWeight:500,color:"text.secondary",children:s("DISPLAY_STRINGS.NOTIFY_VIA","Notify via")}),(0,r.jsx)(Oe.A,{row:!0,value:"email",children:(0,r.jsx)(Ye.A,{value:"email",control:(0,r.jsx)(Ge.A,{size:"small"}),label:(0,r.jsx)(L.A,{variant:"body2",children:s("DISPLAY_STRINGS.EMAIL","Email")})})})]}),(0,r.jsx)(_e.A,{}),(0,r.jsxs)(h.A,{display:"flex",justifyContent:"flex-end",gap:1,children:[(0,r.jsx)(I.A,{onClick:i,variant:"outlined",sx:{height:36,textTransform:"none",fontWeight:500,color:"text.primary",borderColor:c.palette.divider,backgroundColor:c.palette.background.paper,"&:hover":{borderColor:c.palette.text.primary,backgroundColor:(0,Te.X4)(c.palette.text.primary,.04)}},children:s("DISPLAY_STRINGS.CANCEL_BUTTON","Cancel")}),(0,r.jsx)(I.A,{variant:"contained",color:"primary",onClick:function(){var e;if(n={},t=parseFloat(P),(!P||isNaN(t)||t<0)&&(n.thresholdAmount=s("DISPLAY_STRINGS.ENTER_VALID_AMOUNT","Enter a valid amount.")),S!==Be||m||(n.subaccount=s("DISPLAY_STRINGS.SELECT_SUBACCOUNT","Select a sub-account.")),k(n),0===Object.keys(n).length){var n,t,r={name:H,scope:S,subaccount:S===Be?m:null,triggerType:j,condition:y,thresholdAmount:parseFloat(P),timeWindowDays:j===We?G:null,isEnabled:null===(e=null==o?void 0:o.isEnabled)||void 0===e||e};u&&o?V.mutate({id:o.id,payload:r},{onSuccess:function(){(0,Z.vd)(s("DISPLAY_STRINGS.ALERT_RULE_UPDATED","Rule updated.")),i()},onError:function(e){var n,t;(0,Z.ag)((null===(t=null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.data)||void 0===t?void 0:t.detail)||s("DISPLAY_STRINGS.ALERT_RULE_UPDATE_FAILED","Failed to update rule."))}}):F.mutate(r,{onSuccess:function(){(0,Z.vd)(s("DISPLAY_STRINGS.ALERT_RULE_CREATED","Rule created.")),i()},onError:function(e){var n,t;(0,Z.ag)((null===(t=null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.data)||void 0===t?void 0:t.detail)||s("DISPLAY_STRINGS.ALERT_RULE_CREATE_FAILED","Failed to create rule."))}})}},disabled:M,sx:{height:36,textTransform:"none",fontWeight:500},children:u?s("DISPLAY_STRINGS.SAVE_CHANGES","Save changes"):s("DISPLAY_STRINGS.SAVE_RULE","Save rule")})]})]})},He=function(e){var n=e.rule,t=e.onToggle,a=e.onEdit,l=e.onDelete,o=e.showSubaccountName,i=(0,A.A)();return(0,r.jsxs)(h.A,{display:"flex",alignItems:"center",justifyContent:"space-between",sx:{padding:"12px 14px",border:"1px solid ".concat(i.palette.divider),borderRadius:2,backgroundColor:n.isEnabled?(0,Te.X4)(i.palette.primary.main,.04):i.palette.background.paper,transition:"border-color 0.15s, box-shadow 0.15s","&:hover":{borderColor:i.palette.primary.main,boxShadow:"0 1px 4px ".concat((0,Te.X4)(i.palette.primary.main,.08))}},children:[(0,r.jsxs)(h.A,{display:"flex",alignItems:"center",gap:1.5,flex:1,minWidth:0,children:[(0,r.jsx)(je.A,{checked:n.isEnabled,onChange:t,size:"small"}),(0,r.jsxs)(h.A,{minWidth:0,children:[(0,r.jsx)(L.A,{variant:"body2",fontWeight:500,noWrap:!0,children:n.name}),o&&n.subaccountName&&(0,r.jsx)(L.A,{variant:"caption",color:"text.secondary",display:"block",children:n.subaccountName}),(0,r.jsx)(h.A,{mt:.5,children:(0,r.jsx)(B.A,{icon:(0,r.jsx)(De.A,{sx:{fontSize:14}}),label:"Email",size:"small",variant:"outlined",sx:{height:20,fontSize:"0.7rem"}})})]})]}),(0,r.jsxs)(h.A,{display:"flex",gap:.5,children:[(0,r.jsx)(k.A,{size:"small",onClick:a,sx:{color:"text.secondary","&:hover":{color:i.palette.primary.main,backgroundColor:(0,Te.X4)(i.palette.primary.main,.08)}},children:(0,r.jsx)(Ne.A,{sx:{fontSize:18}})}),(0,r.jsx)(k.A,{size:"small",onClick:l,sx:{color:"text.secondary","&:hover":{color:i.palette.error.main,backgroundColor:(0,Te.X4)(i.palette.error.main,.08)}},children:(0,r.jsx)(Pe.A,{sx:{fontSize:18}})})]})]})},Ke=function(e){var n,t=e.isOpen,o=e.onClose,i=(0,T.Bd)().t,s=(0,A.A)(),u=(0,Le.A)(s.breakpoints.down("sm")),d=(0,a.useState)(!0),S=d[0],x=d[1],p=(0,a.useState)(null),f=p[0],v=p[1],g=(0,a.useState)(!1),b=g[0],m=g[1],_=(0,a.useState)(null),E=_[0],R=_[1],y=function(e){R(e),m(!0)},D=Ie(t),N=D.data,P=void 0===N?[]:N,O=D.isLoading,Y=(n=(0,l.jE)(),(0,de.n)({mutationFn:function(e){var n=e.id,t=e.isEnabled;return ge(n,{isEnabled:t})},onSuccess:function(){n.invalidateQueries({queryKey:[he]})}})),G=function(){var e=(0,l.jE)();
1return(0,de.n)({mutationFn:be,onSuccess:function(){e.invalidateQueries({queryKey:[he]})}})}(),w=P.filter((function(e){return e.scope===Ue})),U=P.filter((function(e){return e.scope===Be})),B=function(e){Y.mutate({id:e.id,isEnabled:!e.isEnabled},{onError:function(){return(0,Z.ag)(i("DISPLAY_STRINGS.ALERT_RULE_TOGGLE_FAILED","Failed to toggle rule."))}})};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(me.Ay,{anchor:"right",open:t,onClose:o,PaperProps:{sx:{width:u?"100%":460}},children:[(0,r.jsxs)(h.A,{display:"flex",justifyContent:"space-between",alignItems:"flex-start",sx:{borderBottom:"1px solid ".concat(s.palette.divider),padding:"16px 20px"},children:[(0,r.jsxs)(h.A,{display:"flex",alignItems:"center",gap:1.5,children:[(0,r.jsx)(h.A,{display:"flex",alignItems:"center",justifyContent:"center",width:36,height:36,borderRadius:2,bgcolor:(0,Te.X4)(s.palette.primary.main,.1),children:(0,r.jsx)(j.A,{htmlColor:s.palette.primary.main})}),(0,r.jsxs)(h.A,{children:[(0,r.jsx)(L.A,{variant:"h6",fontWeight:600,children:i("DISPLAY_STRINGS.ALERT_RULES","Alert Rules")}),(0,r.jsx)(L.A,{variant:"body2",color:"text.secondary",children:i("DISPLAY_STRINGS.ALERT_RULES_SUBTITLE","Get notified when sub-accounts cross thresholds")})]})]}),(0,r.jsx)(k.A,{onClick:o,size:"small",children:(0,r.jsx)(Ce.A,{})})]}),(0,r.jsxs)(h.A,{sx:{padding:"16px 20px",overflowY:"auto",flex:1},children:[(0,r.jsxs)(h.A,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:.5,children:[(0,r.jsxs)(h.A,{children:[(0,r.jsx)(L.A,{variant:"subtitle1",fontWeight:600,children:i("DISPLAY_STRINGS.DEFAULT_RULES","Default rules")}),(0,r.jsx)(L.A,{variant:"body2",color:"text.secondary",children:i("DISPLAY_STRINGS.DEFAULT_RULES_SUBTITLE","Apply to all sub-accounts")})]}),(0,r.jsx)(I.A,{variant:"outlined",startIcon:(0,r.jsx)(C.A,{}),onClick:function(){R(null),m(!0)},disabled:b,sx:{height:36,textTransform:"none",fontWeight:500,color:"text.primary",borderColor:s.palette.divider,backgroundColor:s.palette.background.paper,"&:hover":{borderColor:s.palette.primary.main,backgroundColor:(0,Te.X4)(s.palette.primary.main,.04)},"&.Mui-disabled":{borderColor:s.palette.divider}},children:i("DISPLAY_STRINGS.ADD_RULE","Add rule")})]}),O&&(0,r.jsx)(L.A,{variant:"body2",color:"text.secondary",mt:2,children:i("DISPLAY_STRINGS.LOADING","Loading...")}),!O&&0===w.length&&(0,r.jsx)(L.A,{variant:"body2",color:"text.secondary",mt:2,children:i("DISPLAY_STRINGS.NO_DEFAULT_RULES","No default rules yet.")}),(0,r.jsx)(h.A,{display:"flex",flexDirection:"column",gap:1,mt:2,children:w.map((function(e){return(0,r.jsx)(He,{rule:e,onToggle:function(){return B(e)},onEdit:function(){return y(e)},onDelete:function(){return v(e)}},e.id)}))}),b&&(0,r.jsx)(Me,{rule:E,onClose:function(){m(!1),R(null)}}),(0,r.jsx)(_e.A,{sx:{my:3}}),(0,r.jsxs)(h.A,{display:"flex",justifyContent:"space-between",alignItems:"center",sx:{cursor:"pointer"},onClick:function(){return x((function(e){return!e}))},children:[(0,r.jsxs)(h.A,{children:[(0,r.jsx)(L.A,{variant:"subtitle1",fontWeight:600,children:i("DISPLAY_STRINGS.PER_ACCOUNT_OVERRIDES","Per-account overrides")}),(0,r.jsx)(L.A,{variant:"body2",color:"text.secondary",children:i("DISPLAY_STRINGS.PER_ACCOUNT_OVERRIDES_SUBTITLE","Customize thresholds per account")})]}),(0,r.jsx)(k.A,{size:"small",children:S?(0,r.jsx)(Re.A,{}):(0,r.jsx)(ye.A,{})})]}),(0,r.jsx)(Ee.A,{in:S,children:(0,r.jsxs)(h.A,{display:"flex",flexDirection:"column",gap:1,mt:2,children:[0===U.length&&(0,r.jsx)(L.A,{variant:"body2",color:"text.secondary",children:i("DISPLAY_STRINGS.NO_OVERRIDES","No per-account overrides yet.")}),U.map((function(e){return(0,r.jsx)(He,{rule:e,onToggle:function(){return B(e)},onEdit:function(){return y(e)},onDelete:function(){return v(e)},showSubaccountName:!0},e.id)}))]})})]})]}),(0,r.jsx)(c.KKB,{isOpen:null!==f,title:i("DISPLAY_STRINGS.DELETE_ALERT_RULE_TITLE","Delete Alert Rule"),message:(0,r.jsxs)(L.A,{variant:"body2",children:[i("DISPLAY_STRINGS.DELETE_ALERT_RULE_CONFIRMATION","Are you sure you want to delete this rule? This cannot be undone."),f&&(0,r.jsx)(h.A,{mt:1,children:(0,r.jsx)("b",{children:f.name})})]}),confirmButtonLabel:i("DISPLAY_STRINGS.DELETE_BUTTON","Delete"),cancelButtonLabel:i("DISPLAY_STRINGS.CANCEL_BUTTON","Cancel"),onClose:function(){return v(null)},onConfirm:function(){f&&G.mutate(f.id,{onSuccess:function(){(0,Z.ag)(i("DISPLAY_STRINGS.ALERT_RULE_DELETED","Rule deleted.")),v(null)},onError:function(){(0,Z.ag)(i("DISPLAY_STRINGS.ALERT_RULE_DELETE_FAILED","Failed to delete rule.")),v(null)}})}})]})},qe=function(){return qe=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var a in n=arguments[t])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},qe.apply(this,arguments)},Qe=function(e){if(!e)return null;var n=new Date(e);return Number.isNaN(n.getTime())?null:n},Xe=function(e){e.DEFAULT_FILTERS;var n,t,l=e.currencyLabel,o=void 0===l?"$":l,i=e.data,s=e.isLoading,u=e.setSearchQuery,R=e.page,y=e.totalPages,D=e.handlePageChange,N=e.filters,P=e.setFilters,O=e.refetchSubA
1ccounts,Y=e.dateRange,G=e.setDateRange,w=e.compareEnabled,U=e.setCompareEnabled,B=e.compareDateRange,k=e.setCompareDateRange,W=e.compareUsageMap,z=e.isLoadingCompare,F=(0,T.Bd)().t,V=(0,A.A)(),M=(0,a.useState)(!1),H=M[0],K=M[1],q=(0,a.useState)(null),Q=q[0],X=q[1],$=(0,a.useState)(null),J=$[0],ee=$[1],ne=(0,a.useState)(null),te=ne[0],re=ne[1],ae=(0,a.useState)(null),le=ae[0],se=ae[1],ce=(0,a.useState)(!1),ue=ce[0],de=ce[1],Ae=(Ie(!0).data||[]).filter((function(e){return e.isEnabled})).length,Se=null!==(t=null!==(n=null==Q?void 0:Q.totalChatbots)&&void 0!==n?n:null==Q?void 0:Q.allocatedChatbots)&&void 0!==t?t:0,he=function(e){return e?e.toLocaleDateString("en-CA"):""},xe=Y.start&&Y.end?"".concat(he(Y.start)," → ").concat(he(Y.end)):F("DISPLAY_STRINGS.ALL_TIME","All time"),pe=B.start&&B.end?"".concat(he(B.start)," → ").concat(he(B.end)):F("DISPLAY_STRINGS.ALL_TIME","All time"),fe=null==i?void 0:i.ownerRemainingResources,ve=[{label:F("DISPLAY_STRINGS.ALL"),value:""},{label:F("DISPLAY_STRINGS.SUBSCRIPTION_PAID_ACCOUNT"),value:"paid"},{label:F("DISPLAY_STRINGS.SUBSCRIPTION_DIRECTLY_BILLED"),value:"directly_billable"},{label:F("DISPLAY_STRINGS.SUBSCRIPTION_EXPIRED"),value:"expired"},{label:F("DISPLAY_STRINGS.SUBSCRIPTION_FREE_TRIAL"),value:"free_trial"},{label:F("DISPLAY_STRINGS.SUBSCRIPTION_CC_FREE_TRIAL"),value:"cc_free_trial"},{label:F("DISPLAY_STRINGS.SCHEDULED_FOR_CANCELLATION"),value:"scheduled_for_cancellation"},{label:F("DISPLAY_STRINGS.SUBSCRIPTION_CANCELLED"),value:"cancelled"}];return(0,r.jsxs)(S.A,{container:!0,spacing:1,children:[(0,r.jsxs)(h.A,{mt:1,mb:2,width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",gap:1.5,flexWrap:"wrap",children:[(0,r.jsxs)(h.A,{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap",flex:1,minWidth:0,children:[(0,r.jsx)(c.DOo,{onSearch:function(e){u(e),D(1)},placeholder:F("DISPLAY_STRINGS.SEARCH_SUBACCOUNTS"),sx:{"& .MuiInputBase-root":{height:36,backgroundColor:V.palette.background.paper,minWidth:240}}}),(0,r.jsx)(x.A,{size:"small",sx:{minWidth:140},children:(0,r.jsx)(p.A,{value:N.status,onChange:function(e){return P(qe(qe({},N),{status:e.target.value}))},displayEmpty:!0,sx:{height:36,backgroundColor:V.palette.background.paper,fontSize:"0.875rem"},children:ve.map((function(e){return(0,r.jsx)(f.A,{value:e.value,children:""===e.value?F("DISPLAY_STRINGS.ALL_STATUS"):e.label},e.value||"all")}))})})]}),(0,r.jsxs)(h.A,{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap",children:[(0,r.jsx)(I.A,{variant:"outlined",startIcon:(0,r.jsx)(_.A,{sx:{fontSize:16}}),onClick:function(e){return re(e.currentTarget)},sx:{height:36,textTransform:"none",color:"text.primary",borderColor:V.palette.divider,backgroundColor:V.palette.background.paper,fontWeight:500},children:xe}),(0,r.jsx)(v.Ay,{open:!!te,anchorEl:te,onClose:function(){return re(null)},anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:(0,r.jsxs)(h.A,{display:"flex",gap:2,p:2,children:[(0,r.jsx)(g.A,{type:"date",label:"Start",size:"small",value:he(Y.start),onChange:function(e){var n=Qe(e.target.value);G(qe(qe({},Y),{start:n}))},InputLabelProps:{shrink:!0}}),(0,r.jsx)(g.A,{type:"date",label:"End",size:"small",value:he(Y.end),onChange:function(e){var n=Qe(e.target.value);G(qe(qe({},Y),{end:n}))},InputLabelProps:{shrink:!0}})]})}),(0,r.jsx)(I.A,{variant:w?"contained":"outlined",startIcon:(0,r.jsx)(E,{sx:{fontSize:16}}),onClick:function(){return U(!w)},sx:qe({height:36,textTransform:"none",fontWeight:500},w?{}:{color:"text.primary",borderColor:V.palette.divider,backgroundColor:V.palette.background.paper}),children:F("DISPLAY_STRINGS.COMPARE")}),w&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(I.A,{variant:"outlined",startIcon:(0,r.jsx)(_.A,{sx:{fontSize:16}}),onClick:function(e){return se(e.currentTarget)},sx:{height:36,textTransform:"none",color:"text.primary",borderColor:V.palette.divider,backgroundColor:V.palette.background.paper,fontWeight:500},children:pe}),(0,r.jsx)(v.Ay,{open:!!le,anchorEl:le,onClose:function(){return se(null)},anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:(0,r.jsxs)(h.A,{display:"flex",gap:2,p:2,children:[(0,r.jsx)(g.A,{type:"date",label:"Start",size:"small",value:he(B.start),onChange:function(e){var n=Qe(e.target.value);k(qe(qe({},B),{start:n}))},InputLabelProps:{shrink:!0}}),(0,r.jsx)(g.A,{type:"date",label:"End",size:"small",value:he(B.end),onChange:function(e){var n=Qe(e.target.value);k(qe(qe({},B),{end:n}))},InputLabelProps:{shrink:!0}})]})})]}),(0,r.jsx)(I.A,{variant:"outlined",startIcon:(0,r.jsx)(b.A,{badgeContent:Ae,color:"primary",max:99,invisible:0===Ae,children:(0,r.jsx)(j.A,{sx:{fontSize:18}})}),onClick:function(){return de(!0)},sx:{height:36,textTransform:"none",color:"text.primary",borderColor:V.palette.divider,backgroundColor:V.palette.background.paper,fontWeight:500},children:F("DISPLAY_STRINGS.ALERTS","Alerts")}),(0,r.jsx)(I.A,{variant:"contained",color:"primary",onClick:function(){ee(null),K(!0)},startIcon:(0,r.jsx)(C.A,{}),sx:{height:36},children:F("DISPLAY_STRINGS.ADD_ACCOUNT")})]})]}),(0,r.jsx)(h.A,{sx:{width:"100%"},children:(0,r.jsx)(oe,{isLoading:s||!1,subaccounts:(null==i?void 0:i.results)||[],currencyLabel:o,setSelectedSubaccount:ee,setIsSubaccountDrawerOpen:K,setSubaccountToDelete:X,startDate:Y.start,endDate:Y.end,compareEnabled:w,compareStartDate:B.start,compareEndDate:B.end,compareUsageMap:W,isLoadingCompare:z})}),(0,r.jsx)(c.KKB,{isOpen:null!==Q,message:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(L.A,{variant:"body2",sx:{whiteSpace:"break-spaces"},children:F("DISPLAY_STRINGS.DELETE_SUBACCOUNT_CONFIRMATION")}),(0,r.jsx)(h.A,{sx:{mt:2},children:(0,r.jsxs)(S.A,{container:!0,spacing:2,sx:{typography:"body1"},children:[!!(null==Q?void 0:Q.currentWalletBalance)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(S.A,{size:6,children:F("DISPLAY_STRINGS.BALANCE")}),(0,r.jsxs)(S.A,{size:6,children:[o,(0,Z.IY)((null==Q?void 0:Q.currentWalletBalance)||0)]})]}),(!!Se||!!(null==Q?void 0:Q.usedChatbots))&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(S.A,{size:6,children:F("DISPLAY_STRINGS.CHAT_AGENTS")}),(0,r.jsxs)(S.A,{size:6,children:[(0,Z.IY)((null==Q?void 0:Q.usedChatbots)||0),"/",(0,Z.IY)(Se)]})]}),(!!(null==Q?void 0:Q.characterCount)||!!(null==Q?void 0:Q.usedCharacterCount))&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(S.A,{size:6,children:F("DISPLAY_STRINGS.STORAGE")}),(0,r.jsxs)(S.A,{size:6,children:[(0,Z.IY)((null==Q?void 0:Q.usedCharacterCount)||0),"/",(0,Z.IY)((null==Q?void 0:Q.characterCount)||0)]})]}),(!!(null==Q?void 0:Q.allocatedVoiceAgents)||!!(null==Q?void 0:Q.usedVoiceAgents))&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(S.A,{size:6,children:F("DISPLAY_STRINGS.VOICE_AGENTS")}),(0,r.jsxs)(S.A,{size:6,children:[(0,Z.IY)((null==Q?void 0:Q.usedVoiceAgents)||0),"/",(0,Z.IY)((null==Q?void 0:Q.allocatedVoiceAgents)||0)]})]}),!(null==Q?void 0:Q.currentWalletBalance)&&!Se&&!(null==Q?void 0:Q.usedChatbots)&&!(null==Q?void 0:Q.characterCount)&&!(null==Q?void 0:Q.usedCharacterCount)&&!(null==Q?void 0:Q.allocatedVoiceAgents)&&!(null==Q?void 0:Q.usedVoiceAgents)&&(0,r.jsx)(S.A,{size:12,children:F("DISPLAY_STRINGS.NO_RESOURCES_TO_DELETE")})]})})]}),title:F("DISPLAY_STRINGS.DELETE_SUB_ACCOUNT_TITLE"),confirmButtonLabel:F("DISPLAY_STRINGS.DELETE_BUTTON"),cancelButtonLabel:F("DISPLAY_STRINGS.CANCEL_BUTTON"),onClose:function(){return X(null)}
1,onConfirm:function(){Q&&(0,d.Jl)(Q.id).then((function(e){(0,Z.ag)(e.message),X(null),O()})).catch((function(e){(0,Z.ag)(e.response.data.message),X(null)}))}}),y>1&&(0,r.jsx)(h.A,{display:"flex",justifyContent:"center",mt:1,width:"100%",children:(0,r.jsx)(m.A,{count:y,page:R,onChange:function(e,n){return D(n)}})}),(0,r.jsx)(ie.A,{isOpen:H,selectedSubaccount:J,ownerRemainingResources:fe,refetchSubAccounts:O,handleClose:function(){K(!1),ee(null)}}),(0,r.jsx)(Ke,{isOpen:ue,onClose:function(){return de(!1)}})]})},$e=t(50143),Je=function(e){var n=e.title,t=e.formattedValue,a=e.value,l=e.subtitle,o=e.icon,i=e.iconBgColor,s=e.isLoading,u=(0,$e.f)();return(0,r.jsxs)(c.tu9,{elevation:0,sx:{p:2,display:"flex",gap:1,backgroundColor:u.theme.palette.background.paper,borderRadius:2,border:"1px solid ".concat(u.theme.palette.divider),width:"100%",minWidth:0},children:[(0,r.jsxs)(c.azJ,{sx:{flex:1,minWidth:0},children:[(0,r.jsx)(c.o5u,{variant:"body2",color:"text.secondary",fontWeight:500,children:n}),(0,r.jsx)(c.m_M,{title:a&&!s&&a.toLocaleString(),placement:"top-start",arrow:!0,children:(0,r.jsx)(c.o5u,{variant:"h5",color:"text.primary",fontWeight:700,my:1,children:s?(0,r.jsx)(c.EAD,{variant:"text",width:100,height:24}):t})}),(0,r.jsx)(c.o5u,{variant:"caption",color:"text.secondary",children:l})]}),(0,r.jsx)(c.azJ,{sx:{width:40,height:40,borderRadius:1.5,backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:o})]})},Ze=t(25045),en=function(){return en=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var a in n=arguments[t])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},en.apply(this,arguments)};var nn=function(e){var n,t,a,l,o,i,s,d=e.stats,A=e.currencyLabel,S=e.isLoading,h=(0,T.Bd)().t,x=(0,u.J)().userDetails,p=(null==x?void 0:x.userSellingCurrencyLabel)||A||"$",f=[{title:h("DISPLAY_STRINGS.TOTAL_SUB_ACCOUNTS"),formattedValue:(null===(n=null==d?void 0:d.totalSubAccounts)||void 0===n?void 0:n.toLocaleString())||"0",value:(null==d?void 0:d.totalSubAccounts)||0,subtitle:h("DISPLAY_STRINGS.CREATED"),icon:(0,r.jsx)(Ze.A,{htmlColor:"#3b82f6"}),iconBgColor:"#E6F0FD"},{title:h("DISPLAY_STRINGS.CHAT_AGENTS"),formattedValue:(null===(a=null!==(t=null==d?void 0:d.chatAgentsTotal)&&void 0!==t?t:null==d?void 0:d.chatAgentsAllocated)||void 0===a?void 0:a.toLocaleString())||"0",value:null!==(o=null!==(l=null==d?void 0:d.chatAgentsTotal)&&void 0!==l?l:null==d?void 0:d.chatAgentsAllocated)&&void 0!==o?o:0,subtitle:h("DISPLAY_STRINGS.ALLOCATED"),icon:(0,r.jsx)(F.A,{htmlColor:"#10b981"}),iconBgColor:"#E6F6EC"},{title:h("DISPLAY_STRINGS.VOICE_AGENTS_STATS"),formattedValue:(null===(i=null==d?void 0:d.voiceAgentsAllocated)||void 0===i?void 0:i.toLocaleString())||"0",value:(null==d?void 0:d.voiceAgentsAllocated)||0,subtitle:h("DISPLAY_STRINGS.ALLOCATED"),icon:(0,r.jsx)(J.A,{htmlColor:"#f97316"}),iconBgColor:"#FEF5E9"},{title:h("DISPLAY_STRINGS.CHARACTER_STORAGE"),formattedValue:(0,Z.IY)((null==d?void 0:d.characterStorageTotal)||0,1),value:(null==d?void 0:d.characterStorageTotal)||0,subtitle:h("DISPLAY_STRINGS.ALLOCATED"),icon:(0,r.jsx)(Q.A,{htmlColor:"#a855f7"}),iconBgColor:"#E6F0FD"},{title:h("DISPLAY_STRINGS.TOTAL_BALANCE"),formattedValue:(null==d?void 0:d.totalBalanceUsd)?(s=d.totalBalanceUsd,"".concat(p).concat((0,Z.IY)(s,2))):"".concat(p,"0.00"),value:(null==d?void 0:d.totalBalanceUsd)||0,subtitle:h("DISPLAY_STRINGS.ACROSS_ALL_ACCOUNTS"),icon:(0,r.jsx)(c.azJ,{color:"#10b981",fontWeight:500,sx:{typography:"h3"},marginTop:"4px",children:p}),iconBgColor:"#E6F6EC"}];return(0,r.jsx)(c.fPr,{container:!0,spacing:2,mb:2,children:f.map((function(e,n){return(0,r.jsx)(c.fPr,{size:{xs:12,sm:6,md:2.4},children:(0,r.jsx)(Je,en({},e,{isLoading:S}))},n)}))})},tn=t(25594),rn=t(89543),an=t(80202),ln=t(39595);var on=function(e){var n=e.folders,t=e.isLoadingFolders,l=e.refetchFolders,o=e.subaccountFolderId,i=e.setSubaccountFolderId,s=(0,T.Bd)().t,u=(0,A.A)(),S=(0,a.useState)(!1),x=S[0],p=S[1],f=(0,a.useState)(null),v=f[0],g=f[1],b=(0,a.useState)(null),m=b[0],_=b[1];if(t)return null;var E=function(){p(!1),g(null)};return(0,r.jsxs)(h.A,{width:"100%",display:"flex",alignItems:"center",gap:1,my:1.5,flexWrap:"wrap",children:[null==n?void 0:n.map((function(e){var n=o===e.id,t=e.color||"#0061f2",a="#ffffff",l=(null==e?void 0:e.subaccountCount)||0;return(0,r.jsxs)(I.A,{variant:n?"contained":"outlined",startIcon:(0,r.jsx)(tn.A,{fontSize:"small",htmlColor:n?a:t}),onClick:function(){return n=e.id,void i(n);var n},sx:{border:"1px solid ".concat(t),borderRadius:2,position:"relative",backgroundColor:n?t:u.palette.background.paper,color:n?a:"inherit","&:hover":{backgroundColor:n?"".concat(t,"DD"):"transparent",color:n?a:"inherit"}},children:[e.name,(0,r.jsx)(L.A,{sx:{height:"20px",width:"20px",marginLeft:.5,borderRadius:"50%",backgroundColor:"".concat(n?a:t,"20"),color:n?a:t,display:"flex",alignItems:"center",justifyContent:"center"},variant:"caption",children:l}),n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Y.A,{title:s("DISPLAY_STRINGS.EDIT_FOLDER_TOOLTIP"),children:(0,r.jsx)(k.A,{size:"small",onClick:function(n){return function(e,n){e.stopPropagation(),g(n),p(!0)}(n,e)},sx:{ml:.5,color:a,backgroundColor:"".concat(a,"20"),"&:hover":{backgroundColor:"".concat(a,"40")}},children:(0,r.jsx)(V.A,{sx:{fontSize:10}})})}),(0,r.jsx)(Y.A,{title:s("DISPLAY_STRINGS.DELETE_FOLDER_TOOLTIP"),children:(0,r.jsx)(k.A,{size:"small",onClick:function(n){n.stopPropagation(),_(e)},sx:{ml:.5,color:a,backgroundColor:"".concat(a,"20"),"&:hover":{backgroundColor:"".concat(a,"40")}},children:(0,r.jsx)(rn.A,{sx:{fontSize:10}})})})]})]},e.id)})),(0,r.jsx)(ln.A,{open:x,onClose:E,folder:v,onSuccess:function(){l(),E()}}),(0,r.jsx)(c.KKB,{isOpen:null!==m,onClose:function(){return _(null)},onConfirm:function(){m&&(0,d.Jr)(m.id).then((function(){_(null),i(null),l()})).catch((function(e){var n;_(null),(0,an.oh)(null===(n=e.response)||void 0===n?void 0:n.data)}))},title:s("DISPLAY_STRINGS.DELETE_FOLDER_TITLE"),message:s("DISPLAY_STRINGS.DELETE_FOLDER_CONFIRMATION"),confirmButtonLabel:s("DISPLAY_STRINGS.DELETE_BUTTON"),cancelButtonLabel:s("DISPLAY_STRINGS.CANCEL_BUTTON")})]})},sn=function(){var e={status:"",plan:"",billingCycle:""},n=(0,a.useState)(1),t=n[0],l=n[1],o=(0,a.useState)(null),i=o[0],s=o[1],A=(0,a.useState)(""),S=A[0],h=A[1],x=(0,a.useState)(e),p=x[0],f=x[1],I=(0,a.useState)((function(){var e=new Date,n=new Date;return n.setDate(e.getDate()-30),{start:n,end:e}})),v=I[0],g=I[1],b=(0,a.useState)(!1),L=b[0],m=b[1],T=(0,a.useState)((function(){var e=new Date,n=new Date;n.setDate(e.getDate()-60);var t=new Date;return t.setDate(e.getDate()-31),{start:n,end:t}}
1)),_=T[0],E=T[1],j=(0,u.J)().userDetails,C=(null==j?void 0:j.userSellingCurrencyLabel)||"$",R=(0,d.I2)(t,9,S,p,i,v.start,v.end),y=R.data,D=R.isLoading,N=R.refetch,P=(0,d.I2)(t,9,S,p,i,_.start,_.end,L),O=P.data,Y=P.isLoading,G=(0,a.useMemo)((function(){var e,n={};return null===(e=null==O?void 0:O.results)||void 0===e||e.forEach((function(e){var t;n[e.id]=null!==(t=e.usageInRange)&&void 0!==t?t:null})),n}),[O]),w=(0,d.et)(),U=w.data,B=w.isLoading,k=w.refetch,W=Math.ceil(((null==y?void 0:y.count)||0)/9);return(0,r.jsxs)(c.azJ,{children:[(0,r.jsx)(nn,{stats:null==y?void 0:y.stats,currencyLabel:C,isLoading:D}),(0,r.jsx)(on,{folders:U||[],isLoadingFolders:B,refetchFolders:k,subaccountFolderId:i,setSubaccountFolderId:s}),(0,r.jsx)(Xe,{page:t,DEFAULT_FILTERS:e,currencyLabel:C,data:y,isLoading:D,setSearchQuery:h,filters:p,setFilters:f,totalPages:W,handlePageChange:function(e){l(e)},refetchSubAccounts:N,dateRange:v,setDateRange:g,compareEnabled:L,setCompareEnabled:m,compareDateRange:_,setCompareDateRange:E,compareUsageMap:G,isLoadingCompare:Y})]})};function cn(){var e=(0,T.Bd)().t;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.aTG,{heading:e("DISPLAY_STRINGS.SUBACCOUNT_HEADER_TITLE"),icon:(0,r.jsx)(o.A,{})}),(0,r.jsx)(s.KGj,{children:(0,r.jsx)(sn,{})})]})}function un(){var e=(0,l.jE)();return(0,r.jsx)(i.bq,{queryClient:e,children:(0,r.jsx)(cn,{})})}},39595:function(e,n,t){t.d(n,{G:function(){return b}});var r=t(78685),a=t(2057),l=t(93715),o=t(24926),i=t(10838),s=t(34994),c=t(8482),u=t(31547),d=t(38588),A=t(72433),S=t(26400),h=t(89543),x=t(21120),p=t(45602),f=t(16657),I=t(96078),v=function(e,n,t,r){return new(t||(t=Promise))((function(a,l){function o(e){try{s(r.next(e))}catch(e){l(e)}}function i(e){try{s(r.throw(e))}catch(e){l(e)}}function s(e){var n;e.done?a(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,i)}s((r=r.apply(e,n||[])).next())}))},g=function(e,n){var t,r,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=i(0),o.throw=i(1),o.return=i(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(i){return function(s){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(l=0)),l;)try{if(t=1,r&&(a=2&i[0]?r.return:i[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;switch(r=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,r=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!(a=l.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){l=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){l.label=i[1];break}if(6===i[0]&&l.label<a[1]){l.label=a[1],a=i;break}if(a&&l.label<a[2]){l.label=a[2],l.ops.push(i);break}a[2]&&l.ops.pop(),l.trys.pop();continue}i=n.call(e,l)}catch(e){i=[6,e],r=0}finally{t=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},b=function(e){return[{value:"#0061f2",label:e("DISPLAY_STRINGS.COLOR_BLUE")},{value:"#28a745",label:e("DISPLAY_STRINGS.COLOR_GREEN")},{value:"#6f42c1",label:e("DISPLAY_STRINGS.COLOR_PURPLE")},{value:"#fd7e14",label:e("DISPLAY_STRINGS.COLOR_ORANGE")},{value:"#e83e8c",label:e("DISPLAY_STRINGS.COLOR_PINK")},{value:"#20c997",label:e("DISPLAY_STRINGS.COLOR_TEAL")}]};n.A=function(e){var n=this,t=e.open,L=e.onClose,m=e.folder,T=e.onSuccess,_=(0,f.Bd)().t,E=b(_),j=(0,a.useState)(""),C=j[0],R=j[1],y=(0,a.useState)(E[0].value),D=y[0],N=y[1],P=(0,a.useState)(null),O=P[0],Y=P[1],G=(0,a.useState)(!1),w=G[0],U=G[1],B=(0,p.jE)(),k=(0,I.R2)(),W=null!==m,z=k.isPending||w;(0,a.useEffect)((function(){t&&(m?(R(m.name),N(m.color||E[0].value)):(R(""),N(E[0].value)),Y(null))}),[t,m]);var F=function(){z||(Y(null),L())};return(0,r.jsxs)(l.A,{open:t,onClose:F,maxWidth:"xs",fullWidth:!0,PaperProps:{sx:{borderRadius:2}},children:[(0,r.jsxs)(o.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",pb:1},children:[(0,r.jsx)(i.A,{variant:"h6",component:"div",fontWeight:600,children:_(W?"DISPLAY_STRINGS.EDIT_FOLDER":"DISPLAY_STRINGS.CREATE_FOL
1DER")}),(0,r.jsx)(s.A,{size:"small",onClick:F,disabled:z,sx:{color:"text.secondary"},children:(0,r.jsx)(h.A,{fontSize:"small"})})]}),(0,r.jsx)(c.A,{children:(0,r.jsxs)(u.A,{sx:{display:"flex",flexDirection:"column",gap:3},children:[(0,r.jsxs)(u.A,{children:[(0,r.jsx)(i.A,{variant:"body2",sx:{mb:1,fontWeight:500,color:"text.primary"},children:_("DISPLAY_STRINGS.FOLDER_NAME")}),(0,r.jsx)(d.A,{fullWidth:!0,size:"small",placeholder:_("DISPLAY_STRINGS.ENTER_FOLDER_NAME"),value:C,onChange:function(e){R(e.target.value),Y(null)},error:!!O,helperText:O,disabled:z,autoFocus:!0,sx:{"& .MuiOutlinedInput-root":{borderRadius:1,"& fieldset":{borderColor:"primary.main",borderWidth:2},"&:hover fieldset":{borderColor:"primary.main"},"&.Mui-focused fieldset":{borderColor:"primary.main"}}}})]}),(0,r.jsxs)(u.A,{children:[(0,r.jsx)(i.A,{variant:"body2",sx:{mb:1.5,fontWeight:500,color:"text.primary"},children:_("DISPLAY_STRINGS.COLOR")}),(0,r.jsx)(u.A,{sx:{display:"flex",gap:1.5,flexWrap:"wrap"},children:E.map((function(e){return(0,r.jsx)(u.A,{onClick:function(){z||N(e.value)},sx:{width:40,height:40,borderRadius:"50%",backgroundColor:e.value,cursor:z?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"center",border:D===e.value?"2px solid":"2px solid transparent",borderColor:D===e.value?"primary.main":"transparent",opacity:z?.6:1,transition:"all 0.2s","&:hover":{transform:z?"none":"scale(1.1)",opacity:z?.6:1}},children:D===e.value&&(0,r.jsx)(x.A,{sx:{color:"white",fontSize:20,filter:"drop-shadow(0 1px 2px rgba(0,0,0,0.3))"}})},e.value)}))})]})]})}),(0,r.jsxs)(A.A,{sx:{px:3,pb:2.5,pt:1,gap:1},children:[(0,r.jsx)(S.A,{onClick:F,disabled:z,variant:"outlined",color:"secondary",sx:{borderRadius:1,minWidth:100},children:_("DISPLAY_STRINGS.CANCEL_BUTTON")}),(0,r.jsx)(S.A,{onClick:function(){return v(n,void 0,void 0,(function(){var e,n,t;return g(this,(function(r){switch(r.label){case 0:if(!C.trim())return Y(_("DISPLAY_STRINGS.FOLDER_NAME_REQUIRED")),[2];Y(null),r.label=1;case 1:return r.trys.push([1,5,,6]),W&&m?(U(!0),[4,(0,I.x2)(m.id,C.trim(),D)]):[3,3];case 2:return r.sent(),B.invalidateQueries({queryKey:[I.es.SUBACCOUNT_FOLDERS]}),B.invalidateQueries({queryKey:[I.es.SUBACCOUNTS_LIST]}),U(!1),null==T||T(),L(),[3,4];case 3:k.mutate({name:C.trim(),color:D},{onSuccess:function(){null==T||T(),L()},onError:function(e){var n,t;Y((null===(t=null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.data)||void 0===t?void 0:t.message)||(null==e?void 0:e.message)||_("DISPLAY_STRINGS.FAILED_TO_CREATE_FOLDER"))}}),r.label=4;case 4:return[3,6];case 5:return e=r.sent(),U(!1),Y((null===(t=null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.data)||void 0===t?void 0:t.message)||(null==e?void 0:e.message)||_("DISPLAY_STRINGS.FAILED_TO_SAVE_FOLDER")),[3,6];case 6:return[2]}}
1))}))},disabled:z||!C.trim(),variant:"contained",color:"primary",sx:{borderRadius:1,minWidth:140},children:_(z?"DISPLAY_STRINGS.SAVING":W?"DISPLAY_STRINGS.UPDATE_FOLDER":"DISPLAY_STRINGS.CREATE_FOLDER_BUTTON")})]})]})}}}]);

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.