PageSourceSearch

https://app.stammer.ai/static/react/8653.f168106829379d2b1991.js

js stammer.ai collected 2026-09-28 10:06:29 UTC 77,189 bytes, 1 lines download raw bytes

1(self.webpackChunkStammer_ai=self.webpackChunkStammer_ai||[]).push([[8653],{59569:function(e,n,t){"use strict";t.r(n),t.d(n,{AccountPage:function(){return kn}});var a=t(78685),r=t(2057),i=t(31547),o=t(10838),s=t(81971),l=t(73349),c=t(26400),u=t(63809),d=t(36206),p=t(38588),A=t(88458),_=t(34994),f=t(77040),m=t(60894),E=t(93610),h=t(65179),S=t(41007),v=t(46200),x=t(34210),T=t(33559),I=t(52280),L=t(53053),y=t(45602),b=t(86591),g=t(97749),C=t(6765),P=t(21762),D=t(39675),N=t(78166),j=t(19124),O=t(52676),R=t(69179),w=t(60551),B="email-templates",M=function(e,n,t,a){return new(t||(t=Promise))((function(r,i){function o(e){try{l(a.next(e))}catch(e){i(e)}}function s(e){try{l(a.throw(e))}catch(e){i(e)}}function l(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,s)}l((a=a.apply(e,n||[])).next())}))},U=function(e,n){var t,a,r,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(i=0)),i;)try{if(t=1,a&&(r=2&s[0]?a.return:s[0]?a.throw||((r=a.return)&&r.call(a),0):a.next)&&!(r=r.call(a,s[1])).done)return r;switch(a=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,a=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(r=i.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){i.label=s[1];break}if(6===s[0]&&i.label<r[1]){i.label=r[1],r=s;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(s);break}r[2]&&i.ops.pop(),i.trys.pop();continue}s=n.call(e,i)}catch(e){s=[6,e],a=0}finally{t=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},K=function(){return(0,b.I)({queryKey:[B],queryFn:function(){return M(void 0,void 0,Promise,(function(){return U(this,(function(e){switch(e.label){case 0:return[4,w.A.get(P.n.EMAIL_TEMPLATES.LIST)];case 1:return[2,e.sent().data]}}))}))},refetchOnWindowFocus:!0,refetchOnMount:!0,staleTime:0,retry:!1})},k=t(50143),Y=t(16657),F=t(93715),V=t(24926),G=t(8482),z=t(14428),W=t(47838),H=t(82474),q=(0,r.lazy)((function(){return Promise.all([t.e(2692),t.e(9258)]).then(t.bind(t,49258))})),J=(0,r.lazy)((function(){return t.e(9363).then(t.bind(t,9363))}));var X,Q,Z=function(e){var n=e.open,t=e.onClose,o=e.template,s=e.templateType,l=e.refetchEmailTemplates,c=e.availableVariables,u=e.previewData,d=(0,Y.Bd)().t,A=(0,r.useState)((null==o?void 0:o.subject)||""),f=A[0],m=A[1],E=(0,r.useState)((null==o?void 0:o.body)||""),h=E[0],S=E[1],v=(0,r.useState)(!1),x=v[0],T=v[1],I=(0,r.useState)((null==o?void 0:o.id)||null),L=I[0],y=I[1],b=(0,r.useState)(!1),g=b[0],C=b[1];return(0,a.jsxs)(F.A,{open:n,onClose:t,PaperProps:{sx:{width:"90vw",maxWidth:"90vw",maxHeight:"90vh",height:"90vh",overflow:"hidden"}},children:[(0,a.jsx)(V.A,{children:(0,a.jsxs)(i.A,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[(0,j.wy)(s)," ",d("EMAIL_TEMPLATES.EMAIL_TEMPLATE_SUFFIX"),(0,a.jsxs)(i.A,{display:"flex",alignItems:"center",gap:1,children:[L&&(0,a.jsx)(R.$nd,{onClick:function(){return C(!0)},variant:"outlined",color:"primary",size:"small",disabled:x,startIcon:(0,a.jsx)(H.A,{fontSize:"small"}),children:d("EMAIL_TEMPLATES.RESET_TO_DEFAULT")}),(0,a.jsx)(_.A,{onClick:t,size:"small",children:(0,a.jsx)(W.A,{fontSize:"small"})})]})]})}),(0,a.jsx)(G.A,{children:(0,a.jsxs)(z.A,{container:!0,spacing:2,children:[(0,a.jsxs)(z.A,{size:6,children:[(0,a.jsx)(R.JU7,{name:d("EMAIL_TEMPLATES.SUBJECT")}),(0,a.jsx)(p.A,{value:f,fullWidth:!0,size:"small",onChange:function(e){return m(e.target.value)}}),(0,a.jsx)(R.JU7,{name:d("EMAIL_TEMPLATES.BODY")}),(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)(i.A,{sx:{height:"calc(100vh - 400px)"}}),children:(0,a.jsx)(q,{height:"calc(100vh - 400px)",width:"100%",value:h,onChange:function(e){return S(e)},onSave:function(e){if(!x){T(!0);var n,a={id:L||void 0,subject:f.trim(),body:e.trim(),templateType:s};(n=a,M(void 0,void 0,Promise,(function(){var e;return U(this,(function(t){switch(t.label){case 0:return e=(0,j.uc)(n),[4,w.A.post(P.n.EMAIL_TEMPLATES.CREATE,e)];case 1:return[2,t.sent().data]}}))}
1))).then((function(){(0,j.vd)(d("EMAIL_TEMPLATES.SAVE_SUCCESS")),t(),l()})).catch((function(e){var n,t;(0,j.ag)((null===(t=null===(n=e.response)||void 0===n?void 0:n.data)||void 0===t?void 0:t.message)||d("EMAIL_TEMPLATES.SAVE_FAILED"))})).finally((function(){T(!1)}))}},placeholder:d("EMAIL_TEMPLATES.START_TYPING_PLACEHOLDER"),availableVariables:c,disabled:x,allowImage:!1})})]}),(0,a.jsxs)(z.A,{size:6,children:[(0,a.jsx)(R.JU7,{name:d("EMAIL_TEMPLATES.PREVIEW"),helptext:d("EMAIL_TEMPLATES.PREVIEW_HELPTEXT")}),(0,a.jsx)(i.A,{sx:{height:"calc(100vh - 225px)",overflow:"auto"},children:(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)(i.A,{sx:{height:"100%"}}),children:(0,a.jsx)(J,{html:h,previewData:u})})})]})]})}),(0,a.jsx)(R.KKB,{isOpen:g,onClose:function(){return C(!1)},onConfirm:function(){x||(T(!0),function(e){return M(void 0,void 0,Promise,(function(){return U(this,(function(n){switch(n.label){case 0:return[4,w.A.delete(P.n.EMAIL_TEMPLATES.RESET(e))];case 1:return[2,n.sent().data]}}))}))}(s).then((function(e){y(null),m(e.subject),S(e.body),C(!1),(0,j.vd)(d("EMAIL_TEMPLATES.RESET_SUCCESS")),l()})).catch((function(e){var n,t;(0,j.ag)((null===(t=null===(n=e.response)||void 0===n?void 0:n.data)||void 0===t?void 0:t.message)||d("EMAIL_TEMPLATES.RESET_FAILED"))})).finally((function(){T(!1)})))},title:d("EMAIL_TEMPLATES.RESET_TO_DEFAULT"),message:d("EMAIL_TEMPLATES.RESET_CONFIRMATION"),confirmButtonLabel:d("EMAIL_TEMPLATES.RESET_TO_DEFAULT"),confirmButtonDisabled:x})]})},$=t(84969),ee="lead_collection",ne="human_handoff",te="unanswered_question",ae="subaccount_welcome",re="account_activation",ie="conversation_summary",oe="voice_phone_number_recharged",se="voice_phone_number_recharge_failed",le="voice_call_summary",ce="voice_call_notification",ue="voice_addon_rebilled",de="voice_addon_rebilling_failed",pe="voice_addon_unsubscribed",Ae="voice_addon_unsubscription_failed",_e=((X={})[ee]={nameKey:"EMAIL_TEMPLATES.LEAD_COLLECTION_NAME",descriptionKey:"EMAIL_TEMPLATES.LEAD_COLLECTION_DESCRIPTION"},X[ne]={nameKey:"EMAIL_TEMPLATES.HUMAN_HANDOFF_NAME",descriptionKey:"EMAIL_TEMPLATES.HUMAN_HANDOFF_DESCRIPTION"},X[te]={nameKey:"EMAIL_TEMPLATES.UNANSWERED_QUESTION_NAME",descriptionKey:"EMAIL_TEMPLATES.UNANSWERED_QUESTION_DESCRIPTION"},X[ae]={nameKey:"EMAIL_TEMPLATES.SUBACCOUNT_WELCOME_NAME",descriptionKey:"EMAIL_TEMPLATES.SUBACCOUNT_WELCOME_DESCRIPTION"},X[re]={nameKey:"EMAIL_TEMPLATES.ACCOUNT_ACTIVATION_NAME",descriptionKey:"EMAIL_TEMPLATES.ACCOUNT_ACTIVATION_DESCRIPTION"},X[ie]={nameKey:"EMAIL_TEMPLATES.CONVERSATION_SUMMARY_NAME",descriptionKey:"EMAIL_TEMPLATES.CONVERSATION_SUMMARY_DESCRIPTION"},X[oe]={nameKey:"EMAIL_TEMPLATES.VOICE_PHONE_NUMBER_RECHARGED_NAME",descriptionKey:"EMAIL_TEMPLATES.VOICE_PHONE_NUMBER_RECHARGED_DESCRIPTION"},X[se]={nameKey:"EMAIL_TEMPLATES.VOICE_PHONE_NUMBER_RECHARGE_FAILED_NAME",descriptionKey:"EMAIL_TEMPLATES.VOICE_PHONE_NUMBER_RECHARGE_FAILED_DESCRIPTION"},X[le]={nameKey:"EMAIL_TEMPLATES.VOICE_CALL_SUMMARY_NAME",descriptionKey:"EMAIL_TEMPLATES.VOICE_CALL_SUMMARY_DESCRIPTION"},X[ce]={nameKey:"EMAIL_TEMPLATES.VOICE_CALL_NOTIFICATION_NAME",descriptionKey:"EMAIL_TEMPLATES.VOICE_CALL_NOTIFICATION_DESCRIPTION"},X[ue]={nameKey:"EMAIL_TEMPLATES.VOICE_ADDON_REBILLED_NAME",descriptionKey:"EMAIL_TEMPLATES.VOICE_ADDON_REBILLED_DESCRIPTION"},X[de]={nameKey:"EMAIL_TEMPLATES.VOICE_ADDON_REBILLING_FAILED_NAME",descriptionKey:"EMAIL_TEMPLATES.VOICE_ADDON_REBILLING_FAILED_DESCRIPTION"},X[pe]={nameKey:"EMAIL_TEMPLATES.VOICE_ADDON_UNSUBSCRIBED_NAME",descriptionKey:"EMAIL_TEMPLATES.VOICE_ADDON_UNSUBSCRIBED_DESCRIPTION"},X[Ae]={nameKey:"EMAIL_TEMPLATES.VOICE_ADDON_UNSUBSCRIPTION_FAILED_NAME",descriptionKey:"EMAIL_TEMPLATES.VOICE_ADDON_UNSUBSCRIPTION_FAILED_DESCRIPTION"},X),fe="all",me=[{id:fe,labelKey:"EMAIL_TEMPLATES.ALL_TEMPLATES"},{id:"account",labelKey:"EMAIL_TEMPLATES.ACCOUNT_TEMPLATES"},{id:"chat",labelKey:"EMAIL_TEMPLATES.CHAT_TEMPLATES"},{id:"voice",labelKey:"EMAIL_TEMPLATES.VOICE_TEMPLATES"}],Ee=((Q={})[ee]={name:"Lead Collection Email Template",description:"This email template is used to send a notification to the user when a new lead has been collected by the chatbot.",category:"chat",variables:["full_name","chatbot.id","chatbot.name","chatbot.uuid","chatbot_link","conversation_link","conversation_public_link","conversation.source_platform","conversation.uuid","conversation.public_user_key","collected_at","support_email","collected_leads_table","site_name"],previewData:{full_name:"John Doe","chatbot.id":"123","chatbot.name":"Custom Chatbot","chatbot.uuid":"chatbot-uuid","conversation.source_platform":"embed",chatbot_link:'<a href="#">https://example.com/chatbot</a>',conversation_link:'<a href="#">https://example.com/conversation</a>',conversation_public_link:'<a href="#">https://example.com/conversation/public</a>',"conversation.uuid":"conversation-uuid","conversation.public_user_key":"conversation-user-key",collected_at:"Jan. 01, 2026, 12:00 PM",supp
1ort_email:"[email protected]",site_name:"Support",collected_leads_table:'\n <table style="width: 100%;">\n  <tr>\n    <td>Name</td>\n    <td>John Doe</td>\n  </tr>\n  <tr>\n    <td>Email</td>\n    <td>[email protected]</td>\n  </tr>\n</table>\n'.trim()}},Q[ne]={name:"Human Handoff Email Template",description:"This email template is used to send a notification to the user when a visitor has requested human assistance in a conversation with the chatbot.",category:"chat",variables:["full_name","source_platform","conversation_public_url","conversation_app_url","sender","receiver","chatbot_name","support_email","site_name"],previewData:{full_name:"John Doe",source_platform:"embed",conversation_public_url:'<a href="#">https://example.com/conversation/public</a>',conversation_app_url:'<a href="#">https://example.com/conversation</a>',sender:"John Doe",receiver:"Support Team",chatbot_name:"Custom Chatbot",support_email:"[email protected]",site_name:"Support"}},Q[te]={name:"Unanswered Question Email Template",description:"This email template is used to send a notification to the user when the chatbot could not answer a visitor question from its knowledge base.",category:"chat",variables:["full_name","chatbot_name","query","conversation_id","channel","support_email","site_name"],previewData:{full_name:"John Doe",chatbot_name:"Custom Chatbot",query:"Do you offer refunds after 30 days?",conversation_id:"conversation-uuid",channel:"embed",support_email:"[email protected]",site_name:"Support"}},Q[ae]={name:"Subaccount Welcome Email Template",description:"This email template is used to welcome a newly created subaccount and send them their login credentials.",category:"account",variables:["full_name","email","password","login_url","support_email","site_name"],previewData:{full_name:"John Doe",email:"[email protected]",password:"a-generated-password",login_url:"https://example.com",support_email:"[email protected]",site_name:"Support"}},Q[re]={name:"Account Activation Email Template",description:"This email template is used to invite a newly added team member to verify their email address and set their credentials.",category:"account",variables:["full_name","agency_name","agency_admin_name","contact_email","account_activation_link"],previewData:{full_name:"John Doe",agency_name:"Acme",agency_admin_name:"Jane",contact_email:"[email protected]",account_activation_link:"https://example.com/activate/token/uid/"}},Q[ie]={name:"Conversation Summary Email Template",description:"This email template is used to send the summary of a finished conversation to the addresses configured on the chatbot.",category:"chat",variables:["full_name","chatbot_name","conversation_number","ai_summary_section","stats_section","conversation_link_section","lead_data_section","conversation_history_section","token_usage_section","support_email","site_name"],previewData:{full_name:"John Doe",chatbot_name:"Custom Chatbot",conversation_number:"42",support_email:"[email protected]",site_name:"Support",ai_summary_section:"<p><strong>Summary generated by AI: </strong> The visitor asked about refund policy.</p>",stats_section:"\n<h2>Stats:</h2>\n<p><strong>Chat Agent Name:</strong> Custom Chatbot</p>\n<p><strong>Time Started:</strong> Monday, 2026-01-01 12:00 PM</p>\n<p><strong>Time Ended:</strong> Monday, 2026-01-01 12:05 PM</p>\n<p><strong>Number of user messages:</strong> 4</p>\n<p><strong>Number of AI responses:</strong> 4</p>\n".trim(),conversation_link_section:'\n<h2>Conversation Link:</h2>\n<p><a href="#">https://example.com/conversation</a></p>\n'.trim(),lead_data_section:"\n<h2>Lead Data:</h2>\n<ul><li>Email: [email protected]</li></ul>\n".trim(),conversation_history_section:"\n<h2>Conversation History:</h2>\n<p><strong>User Message:</strong> Do you offer refunds?</p>\n<p><strong>Chatbot Response:</strong> Yes, within 30 days.</p>\n<p><strong>Timestamp:</strong> Jan. 01, 2026, 12:01 PM</p>\n".trim(),token_usage_section:"\n<h2>Token Usage:</h2>\n<p><strong>Input Tokens:</strong> 1,204</p>\n<p><strong>Output Tokens:</strong> 486</p>\n".trim()}},Q[oe]={name:"Phone Number Recharged Email Template",description:"This email template is used to confirm that a voice phone number has been automatically recharged and the amount deducted from the wallet.",category:"voice",variables:["full_name","phone_number","price","support_email","site_name"],previewData:{full_name:"John Doe",phone_number:"+1 555 0100",price:"2.50",support_email:"[email protected]",site_name:"Support"}},Q[se]={name:"Phone Number Recharge Failed Email Template",description:"This email template is used to warn that a voice phone number could not be automatically recharged, so the wallet balance needs checking.",category:"voice",variables:["full_name","phone_number","support_email","site_name"],previewData:{full_name:"John Doe",phone_number:"+1 555 0100",support_email:"[email protected]",site_name:"Support"}},Q[le]={name:"Voice Call Summary Email Template",description:"This email template is used to send the summary of a completed voice call to the addresses configured on the voice agent.",category:"voice",variables:["agent_name","call_information_section","call_summary_section","user_sentiment_section","extracted_information_section","call_transcript_section","recording_section","support_email","site_name"],previewData:{agent_name:"+1 555 0100",support_email:"[email protected]",site_name:"Support",call_information_section:'\n<div style="background: #ffffff; border-radius: 8px; padding: 24px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);">\n<h2 style="margin: 0 0 16px 0; font-size: 16px; font-weight: 600; color: #000;">Call Information</h2>\n<p style="margin: 0 0 8px 0; font-size: 14px; line-height: 1.5; color: #333;"><strong>Caller\'s Name:</strong> John Doe</p>\n<p style="margin: 0 0 8px 0; font-size: 14px; line-height: 1.5; color: #333;"><strong>Caller\'s Number:</strong> +1 555 0199</p>\n<p style="margin: 0 0 8px 0; font-size: 14px; line-height: 1.5; color: #333;"><strong>Number Called:</strong> +1 555 0100</p>\n<p style="margin: 0 0 8px 0; font-size: 14px; line-height: 1.5; color: #333;"><strong>Call Duration:</strong> 3 minutes 5 seconds</p>\n<p style="margin: 0 0 8px 0; font-size: 14px; line-height: 1.5; color: #333;"><strong>AI Agent Name:</strong> +1 555 0100</p>\n</div>\n'.trim(),call_summary_section:'\n<div style="background: #ffffff; border-radius: 8px; padding: 24px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);">\n<h2 style="margin: 0 0 16px 0; font-size: 16px; font-weight: 600; color: #000;">Call Summary</h2>\n<p style="margin: 0; font-size: 14px; line-height: 1.6; color: #333;">The caller asked about pricing and booked a follow-up.</p>\n</div>\n'.trim(),user_sentiment_section:'\n<div style="background: #ffffff; border-radius: 8px; padding: 24px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);">\n<h2 style="margin: 0 0 16px 0; font-size: 16px; font-weight: 600; color: #000;">User Sentiment</h2>\n<p style="margin: 0; font-size: 14px; line-height: 1.5; color: #333;">Positive</p>\n</div>\n'.trim(),extracted_information_section:'\n<div style="background: #ffffff; border-radius: 8px; padding: 24px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);">\n<h2 style="margin: 0 0 16px 0; font-size: 16px; font-weight: 600; color: #000;">Extracted Information</h2>\n<p style="margin: 0 0 8px 0; font-size: 14px; line-height: 1.5; color: #333;"><strong>Customer Email:</strong> [email protected]</p>\n</div>\n'.trim(),call_transcript_section:'\n<div style="background: #ffffff; border-radius: 8px; padding: 24px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);">\n<h2 style="margin: 0 0 16px 0; font-size: 16px; font-weight: 600; color: #000;">Call Transcript</h2>\n<p style="margin: 0 0 12px 0; font-size: 14px; line-height: 1.6; color: #333;"><strong>Agent:</strong> Thanks for calling, how can I help?</p>\n<p style="margin: 0 0 12px 0; font-size: 14px; line-height: 1.6; color: #333;"><strong>User:</strong>
1 I\'d like to know your pricing.</p>\n</div>\n'.trim(),recording_section:'\n<div style="background: #ffffff; border-radius: 8px; padding: 24px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); text-align: center;">\n<a href="#" style="display: inline-block; background-color: #0066cc; color: #ffffff; padding: 12px 32px; text-decoration: none; border-radius: 6px; font-size: 14px; font-weight: 600;">Listen to Recording</a>\n</div>\n'.trim()}},Q[ce]={name:"Voice Call Notification Email Template",description:"This email template is used to notify the addresses configured on the voice agent as soon as an inbound or outbound call is initiated.",category:"voice",variables:["call_direction_phrase","call_number","from_number","to_number","call_details_table","support_email","site_name"],previewData:{call_direction_phrase:"Inbound Call from",call_number:"+1 555 0199",from_number:"+1 555 0199",to_number:"+1 555 0100",support_email:"[email protected]",site_name:"Support",call_details_table:'\n<table border="1" style="border-collapse: collapse; margin: 10px 0;">\n  <tr>\n    <td style="padding: 5px; font-weight: bold; background-color: #f5f5f5;">Call Id</td>\n    <td style="padding: 5px;">call-uuid</td>\n  </tr>\n  <tr>\n    <td style="padding: 5px; font-weight: bold; background-color: #f5f5f5;">Status</td>\n    <td style="padding: 5px;">completed</td>\n  </tr>\n</table>\n'.trim()}},Q[ue]={name:"Voice Add-on Rebilled Email Template",description:"This email template is used to confirm to a subaccount that its additional voice add-on subscription has been rebilled.",category:"voice",variables:["full_name","resource_type","quantity","amount","total","support_email","site_name"],previewData:{full_name:"John Doe",resource_type:"Voice Agents",quantity:"3",amount:"$30.00",total:"12",support_email:"[email protected]",site_name:"Support"}},Q[de]={name:"Voice Add-on Rebilling Failed Email Template",description:"This email template is used to warn a subaccount that rebilling its additional voice add-on subscription has failed.",category:"voice",variables:["full_name","resource_type","quantity","amount","support_email","site_name"],previewData:{full_name:"John Doe",resource_type:"Voice Agents",quantity:"3",amount:"$30.00",support_email:"[email protected]",site_name:"Support"}},Q[pe]={name:"Voice Add-on Unsubscribed Email Template",description:"This email template is used to confirm to a subaccount that its additional voice add-on subscription has been cancelled.",category:"voice",variables:["full_name","resource_type","quantity","amount","total","support_email","site_name"],previewData:{full_name:"John Doe",resource_type:"Voice Agents",quantity:"3",amount:"$30.00",total:"12",support_email:"[email protected]",site_name:"Support"}},Q[Ae]={name:"Voice Add-on Unsubscription Failed Email Template",description:"This email template is used to warn a subaccount that cancelling its additional voice add-on subscription has failed.",category:"voice",variables:["full_name","resource_type","quantity","amount","total","support_email","site_name"],previewData:{full_name:"John Doe",resource_type:"Voice Agents",quantity:"3",amount:"$30.00",total:"12",support_email:"[email protected]",site_name:"Support"}},Q),he=function(e){var n=e.template,t=e.templateType,r=e.templateInformation,i=e.setE
1ditingTemplate,o=(0,k.f)().theme,s=(0,Y.Bd)().t,l=_e[t];return(0,a.jsx)(R.fPr,{size:{xs:12,md:6,lg:4},children:(0,a.jsxs)(R.azJ,{sx:{padding:"16px",border:"1px solid ".concat(o.palette.divider),borderRadius:"8px",backgroundColor:o.palette.background.paper},children:[(0,a.jsxs)(R.azJ,{display:"flex",alignItems:"center",gap:2,mb:2,children:[(0,a.jsx)(R.euF,{sx:{backgroundColor:o.palette.primary.main,color:o.palette.primary.contrastText},children:(0,a.jsx)($.A,{fontSize:"medium"})}),(0,a.jsxs)(R.azJ,{children:[(0,a.jsx)(R.o5u,{fontSize:"16px",fontWeight:600,color:"primary",children:l?s(l.nameKey):r.name}),(0,a.jsx)(R.o5u,{variant:"body2",color:"text.secondary",children:l?s(l.descriptionKey):r.description})]})]}),(0,a.jsx)(R.$nd,{onClick:function(){return i({template:n,templateType:t,varibales:r.variables,previewData:r.previewData})},variant:"outlined",fullWidth:!0,color:"primary",size:"small",startIcon:(0,a.jsx)(I.A,{fontSize:"small"}),children:s("EMAIL_TEMPLATES.CUSTOMIZE_TEMPLATE")})]})})},Se=function(){var e=(0,Y.Bd)().t,n=K(),t=n.data,i=n.isLoading,o=n.error,s=n.refetch,l=(0,r.useState)(null),c=l[0],u=l[1],d=(0,r.useState)(fe),p=d[0],A=d[1],_=(0,r.useMemo)((function(){return Object.entries(t||{}).filter((function(e){var n=e[0],t=Ee[n];return!!t&&(p===fe||t.category===p)}))}),[t,p]),f=(0,r.useMemo)((function(){var e=new Set;return Object.keys(t||{}).forEach((function(n){var t,a=null===(t=Ee[n])||void 0===t?void 0:t.category;a&&e.add(a)})),e}),[t]),m=me.filter((function(e){return e.id===fe||f.has(e.id)})).map((function(n){return{id:n.id,label:e(n.labelKey),isActive:n.id===p}}));(0,r.useEffect)((function(){p===fe||f.has(String(p))||A(fe)}),[f,p]);return i?(0,a.jsx)(R.ZpM,{sx:{height:"100%"},children:(0,a.jsxs)(R.Wux,{children:[(0,a.jsx)(R.o5u,{variant:"h6",fontSize:"1.2rem",color:"primary",children:e("EMAIL_TEMPLATES.SECTION_TITLE")}),(0,a.jsx)(R.o5u,{variant:"body2",color:"text.secondary",mb:2,children:e("EMAIL_TEMPLATES.SECTION_DESCRIPTION")}),(0,a.jsx)(R.azJ,{mb:2,children:(0,a.jsx)(R.qIE,{tabs:m,selectedTab:p,onTabChange:A,isLoading:!0})}),(0,a.jsx)(R.fPr,{container:!0,spacing:2,children:Array.from({length:6}).map((function(e,n){return(0,a.jsx)(R.fPr,{size:{xs:12,md:6,lg:4},children:(0,a.jsxs)(R.azJ,{sx:function(e){return{padding:"16px",border:"1px solid ".concat(e.palette.divider),borderRadius:"8px",backgroundColor:e.palette.background.paper}},children:[(0,a.jsxs)(R.azJ,{display:"flex",alignItems:"center",gap:2,mb:2,children:[(0,a.jsx)(R.EAD,{variant:"circular",width:40,height:40}),(0,a.jsxs)(R.azJ,{sx:{flex:1},children:[(0,a.jsx)(R.EAD,{variant:"text",width:"72%",height:24}),(0,a.jsx)(R.EAD,{variant:"text",width:"88%",height:20})]})]}),(0,a.jsx)(R.EAD,{variant:"rounded",height:36})]})},n)}))})]})}):o?(0,a.jsx)(R.ZpM,{sx:{height:"100%"},children:(0,a.jsx)(R.Wux,{children:(0,a.jsx)(R.FcD,{severity:"error",children:e("EMAIL_TEMPLATES.FAILED_TO_LOAD")})})}):(0,a.jsx)(R.ZpM,{sx:{height:"100%"},children:(0,a.jsxs)(R.Wux,{children:[(0,a.jsx)(R.o5u,{variant:"h6",fontSize:"1.2rem",color:"primary",children:e("EMAIL_TEMPLATES.SECTION_TITLE")}),(0,a.jsx)(R.o5u,{variant:"body2",color:"text.secondary",mb:2,children:e("EMAIL_TEMPLATES.SECTION_DESCRIPTION")}),(0,a.jsx)(R.azJ,{mb:2,children:(0,a.jsx)(R.qIE,{tabs:m,selectedTab:p,onTabChange:A})}),0===_.length?(0,a.jsx)(R.o5u,{variant:"body2",color:"text.secondary",py:4,textAlign:"center",children:e("EMAIL_TEMPLATES.NO_TEMPLATES_IN_CATEGORY")}):(0,a.jsx)(R.fPr,{container:!0,spacing:2,children:_.map((function(e){var n=e[0],t=e[1],r=n,i=Ee[r];return(0,a.jsx)(he,{template:t,templateType:r,templateInformation:i,setEditingTemplate:function(e){return u(e)}},n)}))}),c&&(0,a.jsx)(Z,{open:null!==c,onClose:function(){return u(null)},template:c.template||null,templateType:c.templateType,refetchEmailTemplates:s,availableVariables:c.varibales,previewData:c.previewData})]})})},ve="vault-status",xe=t(30673),Te=t.n(xe);function Ie(){var e="495fc2dbbb33b160e54e66ffcba99ba817aa15eaab54bbd47e2977932bbbe102";return Te().SHA256(e)}function Le(e){if(!e)return"";
1var n=Ie(),t=Te().lib.WordArray.random(16),a=Te().AES.encrypt(e,n,{iv:t,mode:Te().mode.CBC,padding:Te().pad.Pkcs7}),r=t.clone().concat(a.ciphertext);return Te().enc.Base64.stringify(r)}function ye(e){if(!e)return"";try{var n=Te().enc.Base64.parse(e),t=Te().lib.WordArray.create(n.words.slice(0,4),16),a=n.words.slice(4),r=n.sigBytes-16,i=Te().lib.WordArray.create(a,r),o=Ie();return Te().AES.decrypt({ciphertext:i},o,{iv:t,mode:Te().mode.CBC,padding:Te().pad.Pkcs7}).toString(Te().enc.Utf8)}catch(e){return""}}var be=function(){return be=Object.assign||function(e){for(var n,t=1,a=arguments.length;t<a;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},be.apply(this,arguments)},ge=function(e,n,t,a){return new(t||(t=Promise))((function(r,i){function o(e){try{l(a.next(e))}catch(e){i(e)}}function s(e){try{l(a.throw(e))}catch(e){i(e)}}function l(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,s)}l((a=a.apply(e,n||[])).next())}))},Ce=function(e,n){var t,a,r,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(i=0)),i;)try{if(t=1,a&&(r=2&s[0]?a.return:s[0]?a.throw||((r=a.return)&&r.call(a),0):a.next)&&!(r=r.call(a,s[1])).done)return r;switch(a=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,a=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(r=i.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){i.label=s[1];break}if(6===s[0]&&i.label<r[1]){i.label=r[1],r=s;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(s);break}r[2]&&i.ops.pop(),i.trys.pop();continue}s=n.call(e,i)}catch(e){s=[6,e],a=0}finally{t=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};function Pe(e){var n,t,a,r,i;return be(be({},e),{openaiKey:ye(null!==(n=e.openaiKey)&&void 0!==n?n:""),xaiKey:ye(null!==(t=e.xaiKey)&&void 0!==t?t:""),anthropicKey:ye(null!==(a=e.anthropicKey)&&void 0!==a?a:""),elevenLabsApiKey:ye(null!==(r=e.elevenLabsApiKey)&&void 0!==r?r:""),elevenLabsVoiceId:ye(null!==(i=e.elevenLabsVoiceId)&&void 0!==i?i:"")})}var De=function(){return ge(void 0,void 0,Promise,(function(){var e;return Ce(this,(function(n){switch(n.label){case 0:return[4,w.A.get(P.n.WHITE_LABEL.VAULT_STATUS)];case 1:return e=n.sent(),[2,Pe((0,j.Cb)(e.data.data||e.data))]}}))}))},Ne=function(e){var n=(0,y.jE)();return(0,g.n)({mutationFn:function(e){return function(e){return ge(void 0,void 0,Promise,(function(){var n,t;return Ce(this,(function(a){switch(a.label){case 0:return n=be(be({},e),{apiKey:Le(e.apiKey)}),[4,w.A.post(P.n.WHITE_LABEL.VERIFY_AND_SAVE_API_KEY,(0,j.uc)(n))];case 1:return t=a.sent(),[2,(0,j.Cb)(t.data)]}}))}))}(e)},onSuccess:function(){n.invalidateQueries({queryKey:[ve]})}})},je=function(e){var n=(0,y.jE)();return(0,g.n)({mutationFn:function(n){return function(e,n){return ge(void 0,void 0,Promise,(function(){var t;return Ce(this,(function(a){switch(a.label){case 0:return[4,w.A.post(P.n.WHITE_LABEL.VERIFY_AND_SAVE_API_KEY,(0,j.uc)({apiKey:"",provider:e,useBackupKey:n}))];case 1:return t=a.sent(),[2,(0,j.Cb)(t.data)]}}))}))}(e,n)},onSuccess:function(){n.invalidateQueries({queryKey:[ve]})}})},Oe=function(){var e=(0,y.jE)();return(0,g.n)({mutationFn:function(e){return function(e){return ge(void 0,void 0,Promise,(function(){var n,t;return Ce(this,(function(a){switch(a.label){case 0:return n={apiKey:Le(e.apiKey),voiceId:Le(e.voiceId)},[4,w.A.post(P.n.WHITE_LABEL.VERIFY_ELEVEN_LABS_API_KEY,(0,j.uc)(n))];case 1:return t=a.sent(),[2,(0,j.Cb)(t.data)]}}))}))}(e)},onSuccess:function(){e.invalidateQueries({queryKey:[ve]})}})},Re=function(){return ge(void 0,void 0,Promise,(function(){var e;return Ce(this,(function(n){switch(n.label){case 0:return[4,w.A.post(P.n.WHITE_LABEL.VERIFY_ELEVEN_LABS_API_KEY,(0,j.uc)({apiKey:"",voiceId:""}))];case 1:return e=n.sent(),[2,(0,j.Cb)(e.data)]}}))}))},we=t(77090),Be=t(79900),Me=t(74294),Ue=t(83474),Ke=function(){return Ke=Object.assign||function(e){for(var n,t=1,a=arguments.length;t<a;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},Ke.apply(this,arguments)},ke=[{id:"openai",label:"OpenAI",isActive:!1,icon:(0,a.jsx)(Be.EC,{})},{id:"xai",label:"XAI",isActive:!1,icon:(0,a.jsx)(Be.nX,{})},{id:"anthropic",label:"Anthropic",isActive:!1,icon:(0,a.jsx)(Be.vO,{})},{id:"elevenlabs",label:"ElevenLabs",isActive:!1,icon:(0,a.jsx)(Be.Se,{})}],Ye=function(e){var n=e.activeTab,t=e.onTabChange,r=e.showElevenLabs,i=void 0===r||r,o=(0,Ue.A)(),s=(0,Me.A)(o.breakpoints.down("sm")),l=ke.filter((function(e){return i||"elevenlabs"!==e.id})).map((function(e){return Ke(Ke({},e),{isActive:e.id===n,label:s?"":e.label,disabledTooltip:s?e.label:void 0})}));return(0,a.jsx)(we.A,{tabs:l,selectedTab:n,onTabChange:function(e){return t(e)},sx:{mt:.5,mb:3}}
1)},Fe=t(51140),Ve=t(70559),Ge=t(85747),ze=t(67756),We=t(72283),He=t(50764),qe=t(62984),Je=t(47308),Xe=t(6755),Qe=function(e){var n=e.label,t=e.fieldName,s=e.value,l=e.onChange,c=e.onVerifyAndSave,u=e.onReset,d=e.showBackupToggle,f=void 0===d||d,m=e.backupKeyValue,E=void 0!==m&&m,h=e.onBackupKeyChange,S=e.backupKeyTooltip,x=e.verificationState,T=e.isResetting,I=e.isVerifying,L=e.errorMessage,y=e.helperText,b=e.disabled,g=void 0!==b&&b,C=e.externalLink,P=e.externalLinkLabel,D=e.fieldError,N=e.fieldTouched,j=e.onBlur,O=(0,Y.Bd)().t,R=(0,r.useState)(!1),w=R[0],B=R[1],M=(0,Ue.A)(),U=(null==s?void 0:s.trim().length)>0,K=N&&!!D,k="success"===x&&U,F=I||T,V=O(k?"DISPLAY_STRINGS.VERIFIED_AND_SAVED":"DISPLAY_STRINGS.VERIFY_AND_SAVE"),G=k?"success":"warning";return(0,a.jsxs)(i.A,{children:[(0,a.jsxs)(i.A,{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1,children:[(0,a.jsx)(o.A,{variant:"subtitle2",fontWeight:600,fontSize:15,children:n}),f&&(0,a.jsxs)(i.A,{display:"flex",alignItems:"center",gap:.5,children:[(0,a.jsx)(Fe.A,{size:"small",checked:E,onChange:function(e){return null==h?void 0:h(e.target.checked)},disabled:g||F}),(0,a.jsx)(o.A,{variant:"body2",color:"text.secondary",children:O("DISPLAY_STRINGS.BACKUP_KEY")}),S&&(0,a.jsx)(Ve.A,{title:(0,a.jsx)(o.A,{variant:"caption",sx:{whiteSpace:"normal",maxWidth:220,display:"block"},children:S}),placement:"top",arrow:!0,slotProps:{tooltip:{sx:{maxWidth:240,fontSize:13,padding:"8px 10px"}}},children:(0,a.jsx)(He.A,{sx:{fontSize:16,color:"text.disabled",cursor:"pointer"}})})]})]}),(0,a.jsx)(p.A,{fullWidth:!0,size:"small",name:t,value:s,onChange:function(e){return l(e.target.value)},onBlur:j,type:w?"text":"password",autoComplete:"new-password",disabled:g||F,error:"error"===x||K,helperText:K?D:void 0,sx:{mb:.5,"& .MuiOutlinedInput-root":{minHeight:40,borderRadius:1.5},"& .MuiOutlinedInput-input":{paddingTop:"10px",paddingBottom:"10px"}},slotProps:{input:{endAdornment:(0,a.jsx)(A.A,{position:"end",children:(0,a.jsx)(_.A,{size:"small",onClick:function(){return B((function(e){return!e}))},edge:"end",disabled:g||F,children:w?(0,a.jsx)(We.A,{fontSize:"small"}):U?(0,a.jsx)(ze.A,{fontSize:"small"}):(0,a.jsx)(Ge.A,{fontSize:"small",sx:{color:"text.disabled"}})})})}}}),!U&&!K&&(0,a.jsxs)(i.A,{display:"flex",alignItems:"center",gap:.5,mb:1.5,children:[(0,a.jsx)(He.A,{sx:{fontSize:13,color:"text.disabled"}}),(0,a.jsx)(o.A,{variant:"caption",color:"text.secondary",sx:{fontSize:13,fontWeight:400},children:y||O("DISPLAY_STRINGS.ENTER_KEY_PROMPT")})]}),k&&(0,a.jsxs)(i.A,{display:"flex",alignItems:"center",gap:.5,mt:1.5,children:[(0,a.jsx)(Je.A,{sx:{fontSize:13,color:"#258651ff"}}),(0,a.jsx)(o.A,{variant:"caption",color:"success.main",sx:{fontSize:13},children:O("DISPLAY_STRINGS.KEY_ENCRYPTED")})]}),"error"===x&&L&&!K&&(0,a.jsx)(o.A,{variant:"caption",color:"error",display:"block",mb:.5,children:L}),(0,a.jsxs)(i.A,{display:"flex",alignItems:"center",justifyContent:"space-between",mt:2,children:[(0,a.jsx)(i.A,{children:C&&P&&(0,a.jsxs)("a",{href:C,target:"_blank",rel:"noopener noreferrer",style:{color:M.palette.primary.main,textDecoration:"none",fontSize:14,display:"inline-flex",alignItems:"center",gap:4},children:[P,(0,a.jsx)("span",{style:{fontSize:12},children:"↗"})]})}),(0,a.jsxs)(i.A,{display:"flex",gap:1,children:[(0,a.jsx)(v.A,{variant:"outlined",color:"inherit",startIcon:(0,a.jsx)(qe.A,{}),loading:T,onClick:u,disabled:g||I,sx:{textTransform:"none",minHeight:36},children:O("DISPLAY_STRINGS.RESET")}),(0,a.jsx)(v.A,{variant:"contained",color:G,startIcon:k?(0,a.jsx)(Xe.A,{}):(0,a.jsx)(Je.A,{}),loading:I,onClick:c,disabled:g||T,sx:{textTransform:"none",minHeight:36},children:V})]})]})]})},Ze=function(e){var n=e.providerName,t=e.providerIcon,r=e.isConfigured,s=e.description,l=e.externalLink,c=e.externalLinkLabel,p=e.children,A=(0,Y.Bd)().t;return(0,a.jsx)(u.A,{variant:"outlined",sx:{borderRadius:2},children:(0,a.jsxs)(d.A,{sx:{p:3},children:[(0,a.jsxs)(i.A,{display:"flex",alignItems:"center",gap:1.5,mb:1.5,children:[(0,a.jsx)(i.A,{sx:{width:40,height:40,borderRadius:"50%",bgcolor:"grey.100",display:"flex",alignItems:"center",justifyContent:"center",color:"text.primary",flexShrink:0},children:t}),(0,a.jsxs)(i.A,{display:"flex",flexDirection:"column",children:[(0,a.jsx)(o.A,{variant:"subtitle1",fontWeight:600,children:n}),(0,a.jsx)(o.A,{variant:"caption",sx:{fontSize:13,fontWeight:600,color:r?"success.main":"text.secondary"},children:A(r?"DISPLAY_STRINGS.KEY_CONFIGURED":"DISPLAY_STRINGS.NO_KEY_CONFIGURED")}
1)]})]}),(0,a.jsx)(o.A,{variant:"body2",color:"text.secondary",mb:2.5,sx:{fontSize:15},children:s}),(0,a.jsx)(i.A,{children:p}),l&&c&&(0,a.jsx)(i.A,{mt:2.5,children:(0,a.jsxs)("a",{href:l,target:"_blank",rel:"noopener noreferrer",style:{color:"#3949AB",textDecoration:"none",fontSize:14,display:"inline-flex",alignItems:"center",gap:4},children:[c,(0,a.jsx)("span",{style:{fontSize:12},children:"↗"})]})})]})})},$e=t(28481),en=t(48513),nn=t(38451),tn=en.Ik().shape({apiKey:en.Yj().required(nn.Ay.t("VALIDATION_ERRORS.API_KEY_REQUIRED")),useBackupKey:en.zM().notRequired()}),an=en.Ik().shape({apiKey:en.Yj().required(nn.Ay.t("VALIDATION_ERRORS.API_KEY_REQUIRED")),voiceId:en.Yj().required(nn.Ay.t("VALIDATION_ERRORS.VOICE_ID_REQUIRED"))}),rn=function(e,n,t,a){return new(t||(t=Promise))((function(r,i){function o(e){try{l(a.next(e))}catch(e){i(e)}}function s(e){try{l(a.throw(e))}catch(e){i(e)}}function l(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,s)}l((a=a.apply(e,n||[])).next())}))},on=function(e,n){var t,a,r,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(i=0)),i;)try{if(t=1,a&&(r=2&s[0]?a.return:s[0]?a.throw||((r=a.return)&&r.call(a),0):a.next)&&!(r=r.call(a,s[1])).done)return r;switch(a=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,a=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(r=i.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){i.label=s[1];break}if(6===s[0]&&i.label<r[1]){i.label=r[1],r=s;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(s);break}r[2]&&i.ops.pop(),i.trys.pop();continue}s=n.call(e,i)}catch(e){s=[6,e],a=0}finally{t=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},sn=function(e){var n,t,i=e.vaultStatus,o=(0,Y.Bd)().t,s=(0,r.useState)("idle"),l=s[0],c=s[1],u=(0,r.useState)(""),d=u[0],p=u[1],A=Ne(),_=A.mutate,f=A.isPending,m=je("openai"),E=m.mutate,h=m.isPending,S=(0,$e.Wx)({initialValues:{apiKey:(null==i?void 0:i.openaiKey)||"",useBackupKey:(null==i?void 0:i.useBackupOpenaiKey)||!1},enableReinitialize:!0,validationSchema:tn,validateOnChange:!1,validateOnBlur:!0,onSubmit:function(){}}),v=(null===(n=S.values.apiKey)||void 0===n?void 0:n.trim())?l:"idle";return(0,a.jsx)(Ze,{providerName:"OpenAI",providerIcon:(0,a.jsx)(Be.EC,{}),isConfigured:null!==(t=null==i?void 0:i.hasOpenaiKey)&&void 0!==t&&t,description:o("DISPLAY_STRINGS.OPENAI_DESCRIPTION"),children:(0,a.jsx)(Qe,{label:o("DISPLAY_STRINGS.OPENAI_API_KEY_LABEL"),fieldName:"apiKey",value:S.values.apiKey,onChange:function(e){S.setFieldValue("apiKey",e),c("idle"),p("")},onBlur:function(){return S.setFieldTouched("apiKey",!0)},onVerifyAndSave:function(){return rn(void 0,void 0,void 0,(function(){return on(this,(function(e){switch(e.label){case 0:return[4,S.setFieldTouched("apiKey",!0)];case 1:return e.sent(),[4,S.validateForm()];case 2:return e.sent().apiKey||(c("loading"),_({apiKey:S.values.apiKey,provider:"openai",useBackupKey:S.values.useBackupKey},{onSuccess:function(){c("success"),(0,j.vd)(o("DISPLAY_STRINGS.OPENAI_KEY_VERIFIED"))},onError:function(e){c("error"),p(o("DISPLAY_STRINGS.VERIFICATION_FAILED")),(0,j.ag)(o("DISPLAY_STRINGS.VERIFICATION_FAILED"))}})),[2]}}))}))},onReset:function(){E(S.values.useBackupKey,{onSuccess:function(){S.resetForm(),c("idle"),p(""),(0,j.vd)(o("DISPLAY_STRINGS.API_KEY_RESET"))}})},showBackupToggle:!0,backupKeyValue:S.values.useBackupKey,onBackupKeyChange:function(e){return S.setFieldValue("useBackupKey",e)},backupKeyTooltip:o("DISPLAY_STRINGS.BACKUP_KEY_TOOLTIP"),verificationState:v,isResetting:h,isVerifying:f,errorMessage:d,helperText:o("DISPLAY_STRINGS.OPENAI_HELPER_TEXT"),externalLink:"https://platform.openai.com/usage",externalLinkLabel:o("DISPLAY_STRINGS.OPENAI_USAGE_LINK"),fieldError:S.errors.apiKey,fieldTouched:S.touched.apiKey})})},ln=function(e,n,t,a){return new(t||(t=Promise))((function(r,i){function o(e){try{l(a.next(e))}catch(e){i(e)}}function s(e){try{l(a.throw(e))}catch(e){i(e)}}function l(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,s)}l((a=a.apply(e,n||[])).next())}))},cn=function(e,n){var t,a,r,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]}
1,trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(i=0)),i;)try{if(t=1,a&&(r=2&s[0]?a.return:s[0]?a.throw||((r=a.return)&&r.call(a),0):a.next)&&!(r=r.call(a,s[1])).done)return r;switch(a=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,a=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(r=i.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){i.label=s[1];break}if(6===s[0]&&i.label<r[1]){i.label=r[1],r=s;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(s);break}r[2]&&i.ops.pop(),i.trys.pop();continue}s=n.call(e,i)}catch(e){s=[6,e],a=0}finally{t=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},un=function(e){var n,t,i=e.vaultStatus,o=(0,Y.Bd)().t,s=(0,r.useState)("idle"),l=s[0],c=s[1],u=(0,r.useState)(""),d=u[0],p=u[1],A=Ne(),_=A.mutate,f=A.isPending,m=je("xai"),E=m.mutate,h=m.isPending,S=(0,$e.Wx)({initialValues:{apiKey:(null==i?void 0:i.xaiKey)||"",useBackupKey:(null==i?void 0:i.useBackupXaiKey)||!1},enableReinitialize:!0,validationSchema:tn,validateOnChange:!1,validateOnBlur:!0,onSubmit:function(){}}),v=(null===(n=S.values.apiKey)||void 0===n?void 0:n.trim())?l:"idle";return(0,a.jsx)(Ze,{providerName:"XAI",providerIcon:(0,a.jsx)(Be.nX,{}),isConfigured:null!==(t=null==i?void 0:i.hasXaiKey)&&void 0!==t&&t,description:o("DISPLAY_STRINGS.XAI_DESCRIPTION"),children:(0,a.jsx)(Qe,{label:o("DISPLAY_STRINGS.XAI_API_KEY_LABEL"),fieldName:"apiKey",value:S.values.apiKey,onChange:function(e){S.setFieldValue("apiKey",e),c("idle"),p("")},onBlur:function(){return S.setFieldTouched("apiKey",!0)},onVerifyAndSave:function(){return ln(void 0,void 0,void 0,(function(){return cn(this,(function(e){switch(e.label){case 0:return[4,S.setFieldTouched("apiKey",!0)];case 1:return e.sent(),[4,S.validateForm()];case 2:return e.sent().apiKey||(c("loading"),_({apiKey:S.values.apiKey,provider:"xai",useBackupKey:S.values.useBackupKey},{onSuccess:function(){c("success"),(0,j.vd)(o("DISPLAY_STRINGS.XAI_KEY_VERIFIED"))},onError:function(e){c("error"),p(o("DISPLAY_STRINGS.VERIFICATION_FAILED")),(0,j.ag)(o("DISPLAY_STRINGS.VERIFICATION_FAILED"))}})),[2]}}))}))},onReset:function(){E(S.values.useBackupKey,{onSuccess:function(){S.resetForm(),c("idle"),p(""),(0,j.vd)(o("DISPLAY_STRINGS.API_KEY_RESET"))}})},showBackupToggle:!0,backupKeyValue:S.values.useBackupKey,onBackupKeyChange:function(e){return S.setFieldValue("useBackupKey",e)},backupKeyTooltip:o("DISPLAY_STRINGS.BACKUP_KEY_TOOLTIP"),verificationState:v,isResetting:h,isVerifying:f,errorMessage:d,helperText:o("DISPLAY_STRINGS.XAI_HELPER_TEXT"),externalLink:"https://x.ai/api",externalLinkLabel:o("DISPLAY_STRINGS.XAI_CONSOLE_LINK"),fieldError:S.errors.apiKey,fieldTouched:S.touched.apiKey})})},dn=t(67309),pn=t(67735),An=function(e,n,t,a){return new(t||(t=Promise))((function(r,i){function o(e){try{l(a.next(e))}catch(e){i(e)}}function s(e){try{l(a.throw(e))}catch(e){i(e)}}function l(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,s)}l((a=a.apply(e,n||[])).next())}))},_n=function(e,n){var t,a,r,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(i=0)),i;)try{if(t=1,a&&(r=2&s[0]?a.return:s[0]?a.throw||((r=a.return)&&r.call(a),0):a.next)&&!(r=r.call(a,s[1])).done)return r;switch(a=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,a=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(r=i.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){i.label=s[1];break}if(6===s[0]&&i.label<r[1]){i.label=r[1],r=s;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(s);break}r[2]&&i.ops.pop(),i.trys.pop();continue}s=n.call(e,i)}catch(e){s=[6,e],a=0}finally{t=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},fn=function(e){var n,t,s=e.vaultStatus,l=(0,Y.Bd)().t,c=(0,r.useState)(!1),u=c[0],d=c[1],f=(0,r.useState)("idle"),m=f[0],E=f[1],h=(0,r.useState)(""),S=h[0],x=h[1],T=(0,Ue.A)(),I=Oe(),L=I.mutate,b=I.isPending,C=(t=(0,y.jE)(),(0,g.n)({mutationFn:Re,onSuccess:function(){t.invalidateQueries({queryKey:[ve]})}})),P=C.mutate,D=C.isPending,N=(0,$e.Wx)({initialValues:{apiKey:(null==s?void 0:s.elevenLabsApiKey)||"",voiceId:(null==s?void 0:s.elevenLabsVoiceId)||""},enableReinitialize:!0,validationSchema:an,validateOnChange:!1,validateOnBlur:!0,onSubmit:function(){}}),O=N.values.apiKey.trim().length>0||N.values.voiceId.trim().length>0,R="success"===(O?m:"idle"),w=function(e){return function(n){N.setFieldValue(e,n),E("idle"),x("")}},B=l(R?"DISPLAY_STRINGS.VERIFIED_AND_SAVED":"DISPLAY_STRINGS.VERIFY_AND_SAVE"),M=R?"success":"warning",U=b||D,K={"& .MuiOutlinedInput-root":{minHeight:40,borderRadius:1.5},"& .MuiOutlinedInput-input":{paddingTop:"10px",paddingBottom:"10px"}};return(0,a.jsxs)(Ze,{providerName:"ElevenLabs",providerIcon:(0,a.jsx)(Be.Se,{}),isConfigured:null!==(n=null==s?void 0:s.hasElevenLabsKey)&&void 0!==n&&n,description:l("DISPLAY_STRINGS.ELEVENLABS_DESCRIPTION"),children:[(0,a.jsxs)(i.A,{mb:2.5,children:[(0,a.jsx)(o.A,{variant:"subtitle2",fontWeight:600,fontSize:15,mb:1,children:l("DISPLAY_STRINGS.ELEVENLABS_API_KEY_LABEL")}),(0,a.jsx)(p.A,{fullWidth:!0,size:"small",name:"apiKey",value:N.values.apiKey,onChange:function(e){return w("apiKey")(e.target.value)},onBlur:function(){return N.setFieldTouched("apiKey",!0)},type:u?"text":"password",autoComplete:"new-password",disabled:U,error:N.touched.apiKey&&!!N.errors.apiKey||"error"===m,helperText:N.touched.apiKey&&N.errors.apiKey?N.errors.apiKey:void 0,slotProps:{input:{endAdornment:(0,a.jsx)(A.A,{position:"end",children:(0,a.jsx)(_.A,{onClick:function(){return d((function(e){return!e}))},edge:"end",disabled:U,children:u?(0,a.jsx)(We.A,{fontSize:"small"}):N.values.apiKey.length>0?(0,a.jsx)(ze.A,{fontSize:"small"}):(0,a.jsx)(Ge.A,{fontSize:"small",sx:{color:"text.disabled"}})})})}},sx:K}),!(N.touched.apiKey&&N.errors.apiKey)&&(0,a.jsx)(o.A,{variant:"caption",fontSize:13,color:"text.secondary",mt:.5,display:"block",children:l("DISPLAY_STRINGS.ELEVENLABS_KEY_HELPER")})]}),(0,a.jsxs)(i.A,{mb:1,children:[(0,a.jsxs)(i.A,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1,children:[(0,a.jsx)(o.A,{variant:"subtitle2",fontWeight:600,fontSize:15,children:l("DISPLAY_STRINGS.VOICE_ID_LABEL")}),(0,a.jsxs)("a",{href:"https://elevenlabs.io/docs/api-reference/get-voices",target:"_blank",rel:"noopener noreferrer",style:{fontSize:13,color:T.palette.primary.main,textDecoration:"none",display:"inline-flex",alignItems:"center",gap:2},children:[l("DISPLAY_STRINGS.GET_VOICE_ID"),(0,a.jsx)(pn.A,{sx:{fontSize:13,ml:.25}})]})]}),(0,a.jsx)(p.A,{fullWidth:!0,size:"small",name:"voiceId",value:N.values.voiceId,disabled:U,onChange:function(e){return w("voiceId")(e.target.value)},onBlur:function(){return N.setFieldTouched("voiceId",!0)},error:N.touched.voiceId&&!!N.errors.voiceId,helperText:N.touched.voiceId&&N.errors.voiceId?N.errors.voiceId:void 0,autoComplete:"off",sx:K}),!(N.touched.voiceId&&N.errors.voiceId)&&(0,a.jsx)(o.A,{variant:"caption",fontSize:13,color:"text.secondary",mt:.5,display:"block",children:l("DISPLAY_STRINGS.VOICE_ID_HELPER")})]}),!O&&(0,a.jsxs)(i.A,{display:"flex",alignItems:"center",gap:.5,my:1,children:[(0,a.jsx)(He.A,{sx:{fontSize:13,color:"text.disabled"}}),(0,a.jsx)(o.A,{variant:"caption",color:"text.secondary",fontSize:13,children:l("DISPLAY_STRINGS.ELEVENLABS_ENTER_BOTH")})]}),R&&(0,a.jsxs)(i.A,{display:"flex",alignItems:"center",gap:.5,my:1,children:[(0,a.jsx)(dn.A,{sx:{fontSize:13,color:"#258651ff"}}),(0,a.jsx)(o.A,{variant:"caption",color:"success.main",fontSize:13,children:l("DISPLAY_STRINGS.KEY_ENCRYPTED")})]}),"error"===m&&S&&(0,a.jsx)(o.A,{variant:"caption",color:"error",display:"block",my:1,children:S}),(0,a.jsxs)(i.A,{display:"flex",alignItems:"center",justifyContent:"space-between",mt:2,children:[(0,a.jsxs)("a",{href:"https://elevenlabs.io/usage",target:"_blank",rel:"noopener noreferrer",style:{color:T.palette.primary.main,textDecoration:"none",fontSize:14,display:"inline-flex",alignItems:"center",gap:4},children:[l("DISPLAY_STRINGS.ELEVENLABS_USAGE_LINK"),(0,a.jsx)("span",{style:{fontSize:12},children:"↗"})]}),(0,a.jsxs)(i.A,{display:"flex",gap:1,children:[(0,a.jsx)(v.A,{variant:"outlined",color:"inherit",startIcon:(0,a.jsx)(qe.A,{}),disabled:b,loading:D,onClick:function(){P(void 0,{onSuccess:function(){N.resetForm(),E("idle"),x(""),(0,j.vd)(l("DISPLAY_STRINGS.API_KEY_RESET"))}})},sx:{textTransform:"none",minHeight:36},children:l("DISPLAY_STRINGS.RESET")}),(0,a.jsx)(v.A,{variant:"contained",color:M,startIcon:R?(0,a.jsx)(Xe.A,{}):(0,a.jsx)(Je.A,{}),onClick:function(){return An(void 0,void 0,void 0,(function(){var e;return _n(this,(function(n){switch(n.label){case 0:return[4,N.setFieldTouched("apiKey",!0)];case 1:return n.sent(),[4,N.setFieldTouched("voiceId",!0)];case 2:return n.sent(),[4,N.validateForm()];case 3:return(e=n.sent()).apiKey||e.voiceId||(x(""),L({apiKey:N.values.apiKey,voiceId:N.values.voiceId},{onSuccess:function(){E("success"),(0,j.vd)(l("DISPLAY_STRINGS.ELEVENLABS_KEY_VERIFIED"))},onError:function(e){E("error"),x(l("DISPLAY_STRINGS.VERIFICATION_FAILED")),(0,j.ag)(l("DISPLAY_STRINGS.VERIFICATION_FAILED"))}})),[2]}}))}))},disabled:D,loading:b,sx:{textTransform:"none",minHeight:36},children:B})]})]})]})},mn=function(e,n,t,a){return new(t||(t=Promise))((function(r,i){function o(e){try{l(a.next(e))}catch(e){i(e)}}function s(e){try{l(a.throw(e))}catch(e){i(e)}}function l(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,s)}l((a=a.apply(e,n||[])).next())}))},En=function(e,n){var t,a,r,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]}
1,trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(i=0)),i;)try{if(t=1,a&&(r=2&s[0]?a.return:s[0]?a.throw||((r=a.return)&&r.call(a),0):a.next)&&!(r=r.call(a,s[1])).done)return r;switch(a=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,a=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(r=i.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){i.label=s[1];break}if(6===s[0]&&i.label<r[1]){i.label=r[1],r=s;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(s);break}r[2]&&i.ops.pop(),i.trys.pop();continue}s=n.call(e,i)}catch(e){s=[6,e],a=0}finally{t=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},hn=function(e){var n,t,i=e.vaultStatus,o=(0,Y.Bd)().t,s=(0,r.useState)("idle"),l=s[0],c=s[1],u=(0,r.useState)(""),d=u[0],p=u[1],A=Ne(),_=A.mutate,f=A.isPending,m=je("anthropic"),E=m.mutate,h=m.isPending,S=(0,$e.Wx)({initialValues:{apiKey:(null==i?void 0:i.anthropicKey)||"",useBackupKey:(null==i?void 0:i.useBackupAnthropicKey)||!1},enableReinitialize:!0,validationSchema:tn,validateOnChange:!1,validateOnBlur:!0,onSubmit:function(){}}),v=(null===(n=S.values.apiKey)||void 0===n?void 0:n.trim())?l:"idle";return(0,a.jsx)(Ze,{providerName:"Anthropic",providerIcon:(0,a.jsx)(Be.vO,{}),isConfigured:null!==(t=null==i?void 0:i.hasAnthropicKey)&&void 0!==t&&t,description:o("DISPLAY_STRINGS.ANTHROPIC_DESCRIPTION"),children:(0,a.jsx)(Qe,{label:o("DISPLAY_STRINGS.ANTHROPIC_API_KEY_LABEL"),fieldName:"apiKey",value:S.values.apiKey,onChange:function(e){S.setFieldValue("apiKey",e),c("idle"),p("")},onBlur:function(){return S.setFieldTouched("apiKey",!0)},onVerifyAndSave:function(){return mn(void 0,void 0,void 0,(function(){return En(this,(function(e){switch(e.label){case 0:return[4,S.setFieldTouched("apiKey",!0)];case 1:return e.sent(),[4,S.validateForm()];case 2:return e.sent().apiKey||_({apiKey:S.values.apiKey,provider:"anthropic",useBackupKey:S.values.useBackupKey},{onSuccess:function(){c("success"),(0,j.vd)(o("DISPLAY_STRINGS.ANTHROPIC_KEY_VERIFIED"))},onError:function(e){c("error"),p(o("DISPLAY_STRINGS.VERIFICATION_FAILED")),(0,j.ag)(o("DISPLAY_STRINGS.VERIFICATION_FAILED"))}}),[2]}}))}))},onReset:function(){E(S.values.useBackupKey,{onSuccess:function(){S.resetForm(),c("idle"),p(""),(0,j.vd)(o("DISPLAY_STRINGS.API_KEY_RESET"))}})},showBackupToggle:!0,backupKeyValue:S.values.useBackupKey,onBackupKeyChange:function(e){return S.setFieldValue("useBackupKey",e)},backupKeyTooltip:o("DISPLAY_STRINGS.BACKUP_KEY_TOOLTIP"),verificationState:v,isResetting:h,isVerifying:f,errorMessage:d,helperText:o("DISPLAY_STRINGS.ANTHROPIC_HELPER_TEXT"),externalLink:"https://console.anthropic.com/",externalLinkLabel:o("DISPLAY_STRINGS.ANTHROPIC_CONSOLE_LINK"),fieldError:S.errors.apiKey,fieldTouched:S.touched.apiKey})})},Sn=function(e){var n=e.showElevenLabs,t=void 0===n||n,o=(0,r.useState)("openai"),l=o[0],c=o[1],u=(0,b.I)({queryKey:[ve],queryFn:De}),d=u.data,p=u.isLoading;r.useEffect((function(){t||"elevenlabs"!==l||c("openai")}),[l,t]);return(0,a.jsxs)(i.A,{children:[(0,a.jsx)(Ye,{activeTab:l,onTabChange:c,showElevenLabs:t}),p?(0,a.jsx)(s.A,{variant:"rectangular",height:300,sx:{borderRadius:2}}):(0,a.jsx)(i.A,{children:function(){switch(l){case"openai":return(0,a.jsx)(sn,{vaultStatus:d});case"xai":return(0,a.jsx)(un,{vaultStatus:d});case"anthropic":return(0,a.jsx)(hn,{vaultStatus:d});case"elevenlabs":return(0,a.jsx)(fn,{vaultStatus:d});default:return null}}()})]})},vn=t(28719),xn=t(31326),Tn=t(43012),In=t(17e3),Ln=t(50212),yn=t(14160),bn=t(11163),gn=t(35230),Cn=function(){return Cn=Object.assign||function(e){for(var n,t=1,a=arguments.length;t<a;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},Cn.apply(this,arguments)},Pn=function(e,n,t,a){return new(t||(t=Promise))((function(r,i){function o(e){try{l(a.next(e))}catch(e){i(e)}}function s(e){try{l(a.throw(e))}catch(e){i(e)}}function l(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,s)}l((a=a.apply(e,n||[])).next())}))},Dn=function(e,n){var t,a,r,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]}
1,trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(i=0)),i;)try{if(t=1,a&&(r=2&s[0]?a.return:s[0]?a.throw||((r=a.return)&&r.call(a),0):a.next)&&!(r=r.call(a,s[1])).done)return r;switch(a=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,a=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(r=i.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){i.label=s[1];break}if(6===s[0]&&i.label<r[1]){i.label=r[1],r=s;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(s);break}r[2]&&i.ops.pop(),i.trys.pop();continue}s=n.call(e,i)}catch(e){s=[6,e],a=0}finally{t=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},Nn=function(e){var n=e.title,t=e.description,r=e.rightContent;return(0,a.jsxs)(i.A,{sx:{mb:2,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:2,flexWrap:"wrap"},children:[(0,a.jsxs)(i.A,{children:[(0,a.jsx)(o.A,{variant:"subtitle1",color:"primary",fontWeight:700,children:n}),t&&(0,a.jsx)(o.A,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:t})]}),r]})},jn=function(e){var n=e.title;return(0,a.jsx)(o.A,{variant:"subtitle1",color:"primary",fontWeight:700,sx:{mb:1.5},children:n})},On=function(){var e=(0,Y.Bd)().t,n=(0,D.Jd)(),t=n.userDetails;return n.isLoading?(0,a.jsxs)(i.A,{sx:{display:"grid",gap:2},children:[(0,a.jsx)(s.A,{variant:"rounded",height:56}),(0,a.jsx)(s.A,{variant:"rounded",height:112}),(0,a.jsx)(s.A,{variant:"rounded",height:112})]}):(null==t?void 0:t.agencyId)?(0,a.jsx)(vn.A,{agencyId:t.agencyId}):(0,a.jsx)(l.A,{severity:"warning",children:e("DISPLAY_LABELS.ACCOUNT_NOTIFICATIONS_LOAD_ERROR")})},Rn=function(){var e=(0,Y.Bd)().t,n=(0,yn.mm)(),t=n.data,r=n.isLoading,i=Object.keys((null==t?void 0:t.user_permissions)||{}),o=yn.Qp.CAN_USE_ELEVEN_LABS_API.value,s=!r&&i.includes(o);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Nn,{title:e("DISPLAY_LABELS.ACCOUNT_VAULT_TAB"),description:e("DISPLAY_LABELS.ACCOUNT_VAULT_HELP")}),(0,a.jsx)(Sn,{showElevenLabs:s})]})},wn=function(){var e=(0,Y.Bd)().t,n=r.useState(!1),t=n[0],i=n[1],o=(0,Tn.$0)(),s=o.data,l=void 0===s?[]:s,c=o.isLoading;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Nn,{title:e("DISPLAY_STRINGS.CUSTOM_MENU_TITLE"),rightContent:l.length>0?(0,a.jsx)(v.A,{variant:"contained",startIcon:(0,a.jsx)(T.A,{}),onClick:function(){return i(!0)},sx:{textTransform:"none"},children:e("DISPLAY_STRINGS.CUSTOM_MENU_CREATE")}):void 0}),(0,a.jsx)(xn.A,{formOpen:t,setFormOpen:i,menuLinks:l,isLoading:c})]})},Bn=function(e){var n,t=null===(n=e.response)||void 0===n?void 0:n.data;if(!t)return"DEFAULT_ERROR";if(t.message)return t.message;if(t.detail)return t.detail;if(t.errors){var a=Object.values(t.errors)[0];if(Array.isArray(a)&&a.length)return a[0];if("string"==typeof a)return a}return"DEFAULT_ERROR"},Mn=function(){return Pn(void 0,void 0,Promise,(function(){return Dn(this,(function(e){switch(e.label){case 0:return[4,C.nv.get(P.n.USERS.ACCOUNT_SETTINGS)];case 1:return[2,e.sent().data]}}))}))},Un=function(){var e=(0,Y.Bd)().t,n=(0,In.Zp)(),t=(0,y.jE)(),s=(0,b.I)({queryKey:["account-settings"],queryFn:Mn,refetchOnWindowFocus:!0}),v=s.data,T=s.isLoading,D=r.useState({firstName:"",lastName:"",timezone:"UTC"}),R=D[0],w=D[1],B=r.useState({}),M=B[0],U=B[1],K=r.useState({currentPassword:"",newPassword:"",confirmPassword:""}),k=K[0],F=K[1],V=r.useState({newEmail:"",otp:""}),G=V[0],z=V[1],W=r.useState(!1),H=W[0],q=W[1],J=r.useState(!1),X=J[0],Q=J[1],Z=r.useState(""),$=Z[0],ee=Z[1],ne=r.useState("en"),te=ne[0],ae=ne[1],re=r.useState("account-profile"),ie=re[0],oe=re[1],se=r.useState((function(){var e=new URLSearchParams(window.location.search).get("section");return["basic","two-factor","password","delete"].includes(e)?e:"basic"})),le=se[0],ce=se[1],ue=r.useState(""),de=ue[0],pe=ue[1],Ae=e("DISPLAY_LABELS.ACCOUNT_DELETE_CONFIRM_TEXT"),_e=$.trim()===Ae;r.useEffect((function(){v&&(w({firstName:v.user.first_name||"",lastName:v.user.last_name||"",timezone:v.user.timezone||"UTC"}),ae(v.language.current||"en"),pe(v.default_prompts.default_chatbot_base_system_message||""))}),[v]);var fe=r.useMemo((function(){return[{key:"account-profile",label:e("DISPLAY_LABELS.ACCOUNT_PROFILE_TAB"),href:"",renderInline:!0},{key:"notifications",label:e("DISPLAY_LABELS.ACCOUNT_NOTIFICATIONS_TAB"),href:(null==v?void 0:v.routes.notifications)||"",renderInline:!0},{key:"custom-menu-links",label:e("DISPLAY_LABELS.ACCOUNT_CUSTOM_MENU_TAB"),href:(null==v?void 0:v.routes.custom_menu_links)||"",renderInline:!0},{key:"default-prompts",label:e("DISPLAY_LABELS.ACCOUNT_DEFAULT_PROMPTS_TAB"),href:(null==v?void 0:v.routes.default_prompts)||"",renderInline:!0},{key:"email-templates",label:e("DISPLAY_LABELS.ACCOUNT_EMAIL_TEMPLATES_TAB"),href:(null==v?void 0:v.routes.email_templates)||"",renderInline:!0},{key:"vault",label:e("DISPLAY_LABELS.ACCOUNT_VAULT_TAB"),href:(null==v?void 0:v.routes.vault)||"",renderInline:!0},{key:"users",label:e("DISPLAY_LABELS.ACCOUNT_USERS_TAB"),href:(null==v?void 0:v.routes.users)||"",renderInline:!0}].filter((function(e){return"account-profile"===e.key||Boolean(e.href)}))}),[v,e]),me=r.useCallback((function(e){var n=new URLSearchParams(window.location.search).get("tab")||"";return n&&e.includes(n)?n:"account-profile"}),[]),Ee=r.useCallback((function(e,n){void 0===n&&(n=!1);var t=new URLSearchParams(window.location.search);"account-profile"===e?t.delete("tab"):t.set("tab",e);var a=t.toString(),r="".concat(window.location.pathname).concat(a?"?".concat(a):"");window.history[n?"replaceState":"pushState"]({},"",r)}),[]),he=function(){t.invalidateQueries({queryKey:["account-settings"]})},ve=(0,g.n)({mutationFn:function(){return C.nv.patch(P.n.USERS.ACCOUNT_SETTINGS_PROFILE,{first_name:R.firstName,last_name:R.lastName,timezone:R.timezone})},onSuccess:function(n){var t;U({}),(0,j.Sx)("",(null===(t=n.data)||void 0===t?void 0:t.message)||e("DISPLAY_LABELS.ACCOUNT_PROFILE_UPDATED"),"success"),he()},onError:function(n){var t,a,r=(null===(a=null===(t=n.response)||void 0===t?void 0:t.data)||void 0===a?void 0:a.errors)||{};U({first_name:Array.isArray(r.first_name)?r.first_name[0]:String(r.first_name||""),last_name:Array.isArray(r.last_name)?r.last_name[0]:String(r.last_name||""),timezone:Array.isArray(r.timezone)?r.timezone[0]:String(r.timezone||"")});var i=Bn(n);(0,j.Sx)("","DEFAULT_ERROR"===i?e("DISPLAY_LABELS.DEFAULT_ERROR"):i,"error")}}),xe=(0,g.n)({mutationFn:function(){return C.nv.post(P.n.USERS.ACCOUNT_SETTINGS_PASSWORD,{current_password:k.currentPassword,new_password:k.newPassword,confirm_password:k.confirmPassword})},onSuccess:function(n){var t;(0,j.Sx)("",(null===(t=n.data)||void 0===t?void 0:t.message)||e("DISPLAY_LABELS.ACCOUNT_PASSWORD_UPDATED"),"success"),F({currentPassword:"",newPassword:"",confirmPassword:""}),he()},onError:function(n){var t=Bn(n);(0,j.Sx)("","DEFAULT_ERROR"===t?e("DISPLAY_LABELS.DEFAULT_ERROR"):t,"error")}}),Te=(0,g.n)({mutationFn:function(){return C.nv.post(P.n.USERS.ACCOUNT_SETTINGS_EMAIL,{action:"generate_otp",new_email:G.newEmail})},onSuccess:function(n){var t;(0,j.Sx)("",(null===(t=n.data)||void 0===t?void 0:t.message)||e("DISPLAY_LABELS.ACCOUNT_OTP_GENERATED"),"success"),q(!0)},onError:function(n){var t=Bn(n);(0,j.Sx)("","DEFAULT_ERROR"===t?e("DISPLAY_LABELS.DEFAULT_ERROR"):t,"error")}}),Ie=(0,g.n)({mutationFn:function(){return C.nv.post(P.n.USERS.ACCOUNT_SETTINGS_EMAIL,{action:"verify",new_email:G.newEmail,otp:G.otp})},onSuccess:function(n){var t;(0,j.Sx)("",(null===(t=n.data)||void 0===t?void 0:t.message)||e("DISPLAY_LABELS.ACCOUNT_EMAIL_UPDATED"),"success"),z({newEmail:"",otp:""}),q(!1),Q(!1),he()},onError:function(n){var t=Bn(n);(0,j.Sx)("","DEFAULT_ERROR"===t?e("DISPLAY_LABELS.DEFAULT_ERROR"):t,"error")}}),Le=(0,g.n)({mutationFn:function(){return C.nv.post(P.n.USERS.ACCOUNT_SETTINGS_TWO_FACTOR,{action:"disable"})},onSuccess:function(n){var t;(0,j.Sx)("",(null===(t=n.data)||void 0===t?void 0:t.message)||e("DISPLAY_LABELS.ACCOUNT_TWO_FACTOR_DISABLED"),"success"),he()},onError:function(n){var t=Bn(n);(0,j.Sx)("","DEFAULT_ERROR"===t?e("DISPLAY_LABELS.DEFAULT_ERROR"):t,"error")}}),ye=(0,g.n)({mutationFn:function(){return C.nv.post(P.n.USERS.ACCOUNT_SETTINGS_LANGUAGE,{language:te})},onSuccess:function(n){var t;(0,j.Sx)("",(null===(t=n.data)||void 0===t?void 0:t.message)||e("DISPLAY_LABELS.ACCOUNT_LANGUAGE_UPDATED"),"success"),window.location.reload()},onError:function(n){var t=Bn(n);(0,j.Sx)("","DEFAULT_ERROR"===t?e("DISPLAY_LABELS.DEFAULT_ERROR"):t,"error")}}),be=(0,g.n)({mutationFn:function(e){return C.nv.post(P.n.USERS.ACCOUNT_SETTINGS_DEFAULT_PROMPTS,e)},onSuccess:function(n){var t,a;(0,j.Sx)("",(null===(t=n.data)||void 0===t?void 0:t.message)||e("DISPLAY_LABELS.ACCOUNT_DEFAULT_PROMPT_UPDATED"),"success"),"string"==typeof(null===(a=n.data)||void 0===a?void 0:a.default_chatbot_base_system_message)&&pe(n.data.default_chatbot_base_system_message),he()},onError:function(n){var t=Bn(n);(0,j.Sx)("","DEFAULT_ERROR"===t?e("DISPLAY_LABELS.DEFAULT_ERROR"):t,"error")}}),ge=(0,g.n)({mutationFn:function(){return C.nv.post(P.n.USERS.ACCOUNT_SETTINGS_DELET
1E,{confirmation_text:_e?"Delete Account":$})},onSuccess:function(n){var t;(0,j.Sx)("",(null===(t=n.data)||void 0===t?void 0:t.message)||e("DISPLAY_LABELS.ACCOUNT_DELETED_SUCCESSFULLY"),"success"),window.location.href="/".concat((0,j.BY)(),"/")},onError:function(n){var t=Bn(n);(0,j.Sx)("","DEFAULT_ERROR"===t?e("DISPLAY_LABELS.DEFAULT_ERROR"):t,"error")}});return r.useEffect((function(){if(v){var e=fe.map((function(e){return e.key})),n=me(e);oe(n)}}),[v,fe,me]),r.useEffect((function(){var e=function(){var e=fe.map((function(e){return e.key}));oe(me(e))};return window.addEventListener("popstate",e),function(){return window.removeEventListener("popstate",e)}}),[fe,me]),T||!v?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(N.aTG,{heading:e("DISPLAY_LABELS.SHELL_ACCOUNT_SETTINGS"),icon:(0,a.jsx)(L.A,{})}),(0,a.jsx)(bn.A,{showHeader:!1})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(N.aTG,{heading:e("DISPLAY_LABELS.SHELL_ACCOUNT_SETTINGS"),icon:(0,a.jsx)(L.A,{})}),(0,a.jsx)(N.KGj,{children:(0,a.jsxs)(i.A,{sx:{py:{xs:2,md:3}},children:[(0,a.jsx)(i.A,{sx:{mb:3,display:"flex",flexWrap:"wrap",gap:0,borderBottom:1,borderColor:"divider",overflowX:"auto"},children:fe.map((function(e){var n=e.key===ie;return(0,a.jsx)(c.A,{onClick:function(){oe(e.key),Ee(e.key)},sx:{borderRadius:0,px:2,py:1.25,borderBottom:n?2:0,borderColor:n?"primary.main":"transparent",color:n?"primary.main":"text.secondary",fontWeight:n?600:500,whiteSpace:"nowrap"},children:e.label},e.key)}))}),(0,a.jsx)(u.A,{sx:{minHeight:"calc(100vh - 260px)",display:"flex",flexDirection:"column"},children:(0,a.jsxs)(d.A,{sx:{p:3,"&:last-child":{pb:3},flex:1,display:"flex",flexDirection:"column"},children:["account-profile"===ie?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.A,{sx:{mb:3},children:(0,a.jsxs)(N.IzF,{value:le,exclusive:!0,onChange:function(e,n){
1null!==n&&ce(n)},size:"small",color:"primary","aria-label":e("DISPLAY_LABELS.ACCOUNT_PROFILE_TAB"),children:[(0,a.jsx)(N.ffE,{value:"basic",children:e("DISPLAY_LABELS.ACCOUNT_BASIC_TAB",{defaultValue:"Basic"})}),(0,a.jsx)(N.ffE,{value:"two-factor",children:e("DISPLAY_LABELS.ACCOUNT_TWO_FACTOR_TAB",{defaultValue:"2FA"})}),(0,a.jsx)(N.ffE,{value:"password",children:e("DISPLAY_LABELS.ACCOUNT_PASSWORD_TAB",{defaultValue:"Password"})}),v.flags.show_delete_card&&(0,a.jsx)(N.ffE,{value:"delete",children:e("DISPLAY_LABELS.ACCOUNT_DELETE_TAB",{defaultValue:"Delete Account"})})]})}),(0,a.jsxs)(i.A,{sx:{maxWidth:640},children:["basic"===le?(0,a.jsxs)(i.A,{children:[(0,a.jsx)(jn,{title:e("DISPLAY_LABELS.ACCOUNT_UPDATE_PROFILE_DETAILS")}),(0,a.jsxs)(i.A,{sx:{display:"grid",gap:2},children:[(0,a.jsx)(p.A,{label:e("DISPLAY_LABELS.EMAIL"),value:v.user.email,fullWidth:!0,InputProps:{readOnly:!0,endAdornment:v.flags.is_agency_user?(0,a.jsx)(A.A,{position:"end",children:(0,a.jsx)(_.A,{"aria-label":e("DISPLAY_LABELS.CHANGE_BUTTON"),edge:"end",onClick:function(){return Q((function(e){return!e}))},size:"small",children:(0,a.jsx)(I.A,{fontSize:"small"})})}):void 0}}),X&&v.flags.is_agency_user?(0,a.jsx)(u.A,{variant:"outlined",sx:{ml:{xs:0,sm:2},mr:{xs:0,sm:2},mb:1,bgcolor:"background.default",boxShadow:"none"},children:(0,a.jsxs)(d.A,{sx:{display:"grid",gap:2,p:2.5,"&:last-child":{pb:2.5}},children:[(0,a.jsx)(o.A,{color:"primary",fontWeight:600,variant:"subtitle2",children:e("DISPLAY_LABELS.ACCOUNT_UPDATE_EMAIL")}),(0,a.jsx)(p.A,{label:e("DISPLAY_LABELS.ACCOUNT_NEW_EMAIL"),type:"email",InputLabelProps:{shrink:!0},value:G.newEmail,onChange:function(e){return z((function(n){return Cn(Cn({},n),{newEmail:e.target.value})}))}}),(0,a.jsx)(p.A,{label:e("DISPLAY_LABELS.ACCOUNT_OTP"),InputLabelProps:{shrink:!0},value:G.otp,onChange:function(e){return z((function(n){return Cn(Cn({},n),{otp:e.target.value})}))},disabled:!H}),(0,a.jsxs)(i.A,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:[(0,a.jsx)(c.A,{variant:"contained",color:"warning",disabled:!G.newEmail||Te.isPending,onClick:function(){return Te.mutate()},children:e("DISPLAY_LABELS.ACCOUNT_GENERATE_OTP")}),(0,a.jsx)(c.A,{variant:"contained",color:"primary",disabled:!H||!G.otp||Ie.isPending,onClick:function(){return Ie.mutate()},children:e("DISPLAY_LABELS.ACCOUNT_VERIFY")})]})]})}):null,(0,a.jsxs)(i.A,{sx:{display:"grid",gap:2,gridTemplateColumns:{xs:"1fr",sm:"1fr 1fr"}},children:[(0,a.jsx)(p.A,{label:e("DISPLAY_LABELS.ACCOUNT_FIRST_NAME"),value:R.firstName,onChange:function(e){w((function(n){return Cn(Cn({},n),{firstName:e.target.value})})),U((function(e){return Cn(Cn({},e),{first_name:""})}))},error:Boolean(M.first_name),helperText:M.first_name,fullWidth:!0}),(0,a.jsx)(p.A,{label:e("DISPLAY_LABELS.ACCOUNT_LAST_NAME"),value:R.lastName,onChange:function(e){w((function(n){return Cn(Cn({},n),{lastName:e.target.value})})),U((function(e){return Cn(Cn({},e),{last_name:""})}))},error:Boolean(M.last_name),helperText:M.last_name,fullWidth:!0})]}),(0,a.jsxs)(f.A,{fullWidth:!0,error:Boolean(M.timezone),size:"small",children:[(0,a.jsx)(m.A,{id:"timezone-select-label",children:e("DISPLAY_LABELS.TIMEZONE")}),(0,a.jsx)(E.A,{label:e("DISPLAY_LABELS.TIMEZONE"),labelId:"timezone-select-label",value:R.timezone,IconComponent:x.A,onChange:function(e){w((function(n){return Cn(Cn({},n),{timezone:e.target.value})})),U((function(e){return Cn(Cn({},e),{timezone:""})}))},children:v.timezone_choices.map((function(e){return(0,a.jsx)(h.A,{value:e.value,children:e.label},e.value)}))}),M.timezone?(0,a.jsx)(S.A,{children:M.timezone}):null]}),(0,a.jsx)(i.A,{children:(0,a.jsx)(c.A,{variant:"contained",color:"primary",onClick:function(){return ve.mutate()},disabled:ve.isPending,children:e("DISPLAY_LABELS.SAVE_CHANGES")})}),(0,a.jsxs)(i.A,{sx:{display:"grid",gap:2,mt:1,pt:3,borderTop:1,borderColor:"divider"},children:[(0,a.jsx)(jn,{title:e("DISPLAY_LABELS.ACCOUNT_LANGUAGE_PREFERENCES")}),(0,a.jsxs)(f.A,{fullWidth:!0,size:"small",children:[(0,a.jsx)(m.A,{id:"language-select-label",children:e("DISPLAY_LABELS.SHELL_LANGUAGE")}),(0,a.jsx)(E.A,{label:e("DISPLAY_LABELS.SHELL_LANGUAGE"),labelId:"language-select-label",value:te,onChange:function(e){return ae(e.target.value)},children:v.language.options.map((function(e){return(0,a.jsx)(h.A,{value:e.code,children:e.label},e.code)}))})]}),(0,a.jsx)(i.A,{children:(0,a.jsx)(c.A,{variant:"contained",color:"primary",onClick:function(){return ye.mutate()},disabled:ye.isPending,children:e("DISPLAY_LABELS.ACCOUNT_SAVE_LANGUAGE")})})]})]})]}):null,"two-factor"===le?(0,a.jsxs)(i.A,{children:[(0,a.jsx)(jn,{title:e("DISPLAY_LABELS.TWO_FACTOR_SETUP_HEADING")}),(0,a.jsxs)(i.A,{sx:{display:"grid",gap:1.5},children:[(0,a.jsx)(o.A,{variant:"body2",color:"text.secondary",children:e("DISPLAY_LABELS.ACCOUNT_TWO_FACTOR_DESC_1")}),(0,a.jsx)(o.A,{variant:"body2",color:"text.secondary",children:e("DISPLAY_LABELS.ACCOUNT_TWO_FACTOR_DESC_2")}),v.flags.account_using_2fa?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.A,{severity:"success",children:e("DISPLAY_LABELS.ACCOUNT_TWO_FACTOR_ACTIVE")}),(0,a.jsx)(i.A,{children:(0,a.jsx)(c.A,{variant:"contained",color:"error",disabled:v.flags.enforce_2fa||Le.isPending,onClick:function(){return Le.mutate()},children:e("DISPLAY_LABELS.ACCOUNT_TWO_FACTOR_DISABLE")})})]}):(0,a.jsx)(i.A,{children:(0,a.jsx)(c.A,{variant:"contained",color:"primary",onClick:function(){if(v.routes.setup_2fa){var e=(0,Ln.Ih)(v.routes.setup_2fa);if(e)return void n(e);window.location.href=v.routes.setup_2fa}},children:e("DISPLAY_LABELS.ACCOUNT_TWO_FACTOR_ENABLE")})})]})]}):null,"password"===le?(0,a.jsxs)(i.A,{children:[(0,a.jsx)(jn,{title:v.user.has_usable_password?e("DISPLAY_LABELS.ACCOUNT_CHANGE_PASSWORD"):e("DISPLAY_LABELS.ACCOUNT_SET_PASSWORD")}),(0,a.jsxs)(i.A,{sx:{display:"grid",gap:2},children:[v.user.has_usable_password?(0,a.jsx)(gn.A,{id:"account-current-password",name:"current_password",label:e("DISPLAY_LABELS.ACCOUNT_CURRENT_PASSWORD"),value:k.currentPassword,onChange:function(e){return F((function(n){return Cn(Cn({}
1,n),{currentPassword:e})}))},autoComplete:"current-password"}):null,(0,a.jsx)(gn.A,{id:"account-new-password",name:"new_password",label:e("DISPLAY_LABELS.ACCOUNT_NEW_PASSWORD"),value:k.newPassword,onChange:function(e){return F((function(n){return Cn(Cn({},n),{newPassword:e})}))},showStrength:!0}),(0,a.jsx)(gn.A,{id:"account-confirm-new-password",name:"confirm_password",label:e("DISPLAY_LABELS.ACCOUNT_CONFIRM_NEW_PASSWORD"),value:k.confirmPassword,onChange:function(e){return F((function(n){return Cn(Cn({},n),{confirmPassword:e})}))},errors:k.confirmPassword&&k.newPassword!==k.confirmPassword?[e("DISPLAY_STRINGS.AUTH_PASSWORDS_DIFFER")]:[]}),(0,a.jsx)(i.A,{children:(0,a.jsx)(c.A,{variant:"contained",color:"primary",disabled:xe.isPending||!(0,gn.v)(k.newPassword)||!k.confirmPassword||k.newPassword!==k.confirmPassword||v.user.has_usable_password&&!k.currentPassword,onClick:function(){return xe.mutate()},children:v.user.has_usable_password?e("DISPLAY_LABELS.ACCOUNT_UPDATE_PASSWORD"):e("DISPLAY_LABELS.ACCOUNT_SET_PASSWORD")})})]})]}):null,"delete"===le&&v.flags.show_delete_card?(0,a.jsxs)(i.A,{children:[(0,a.jsx)(jn,{title:e("DISPLAY_LABELS.ACCOUNT_DELETE_ACCOUNT")}),(0,a.jsxs)(i.A,{sx:{display:"grid",gap:2},children:[!v.flags.disable_delete_button&&(0,a.jsx)(l.A,{severity:"warning",children:e("DISPLAY_LABELS.ACCOUNT_DELETE_CONFIRM_BODY",{defaultValue:e("DISPLAY_LABELS.ACCOUNT_DELETE_WARNING")})}),v.flags.disable_delete_button?(0,a.jsx)(l.A,{severity:"info",children:e("DISPLAY_LABELS.ACCOUNT_DELETE_UNAVAILABLE",{defaultValue:"Account deletion is not available for this account. Please contact support if you need to proceed."})}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(o.A,{variant:"body2",color:"text.secondary",children:[e("DISPLAY_LABELS.ACCOUNT_DELETE_CONFIRM_PROMPT_PREFIX")," ",(0,a.jsx)(i.A,{component:"strong",sx:{color:"text.primary"},children:Ae})," ",e("DISPLAY_LABELS.ACCOUNT_DELETE_CONFIRM_PROMPT_SUFFIX")]}),(0,a.jsx)(p.A,{fullWidth:!0,value:$,onChange:function(e){return ee(e.target.value)},placeholder:Ae}),(0,a.jsx)(i.A,{children:(0,a.jsx)(c.A,{variant:"contained",color:"error",disabled:!_e||ge.isPending,onClick:function(){return ge.mutate()},children:e("DISPLAY_LABELS.DELETE")})})]})]})]}):null]})]}):null,"notifications"===ie?(0,a.jsx)(On,{}):null,"custom-menu-links"===ie?(0,a.jsx)(wn,{}):null,"default-prompts"===ie?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Nn,{title:e("DISPLAY_LABELS.ACCOUNT_DEFAULT_PROMPTS_TAB")}),(0,a.jsxs)(i.A,{sx:{display:"grid",gap:2},children:[(0,a.jsx)(l.A,{severity:"info",children:e("DISPLAY_LABELS.ACCOUNT_DEFAULT_PROMPTS_HELP")}),(0,a.jsx)(p.A,{multiline:!0,minRows:14,maxRows:20,value:de,onChange:function(e){return pe(e.target.value)},disabled:!v.default_prompts.can_edit||be.isPending,fullWidth:!0}),(0,a.jsxs)(i.A,{sx:{display:"flex",gap:1,justifyContent:"flex-end"},children:[(0,a.jsx)(c.A,{variant:"outlined",color:"error",disabled:!v.default_prompts.can_edit||be.isPending,onClick:function(){return be.mutate({action:"reset"})},children:e("DISPLAY_LABELS.RESET_BUTTON")}),(0,a.jsx)(c.A,{variant:"contained",color:"primary",disabled:!v.default_prompts.can_edit||be.isPending,onClick:function(){return be.mutate({action:"update",default_chatbot_base_system_message:de})},children:e("DISPLAY_LABELS.UPDATE_BUTTON")})]})]})]}):null,"vault"===ie?(0,a.jsx)(Rn,{}):null,"users"===ie?(0,a.jsx)(O.A,{}):null,"email-templates"===ie?(0,a.jsx)(Se,{}):null]})})]})})]})},Kn=function(){var e=(0,y.jE)();return(0,a.jsx)(D.bq,{queryClient:e,children:(0,a.jsx)(Un,{})})};function kn(){return(0,a.jsx)(Kn,{})}},35230:function(e,n,t){"use strict";t.d(n,{v:function(){return _}});var a=t(78685),r=t(2057),i=t(31938),o=t(47273),s=t(31547),l=t(38588),c=t(88458),u=t(34994),d=t(32417),p=t(10838),A=t(16657),_=function(e){return/^(?=.*\d)(?=.*[a-zA-Z]).{8,}$/.test(e)};n.A=function(e){var n=e.id,t=e.name,f=e.value,m=e.onChange,E=e.label,h=e.placeholder,S=e.errors,v=void 0===S?[]:S,x=e.autoComplete,T=void 0===x?"new-password":x,I=e.showStrength,L=void 0!==I&&I,y=(0,A.Bd)().t,b=(0,r.useState)(!1),g=b[0],C=b[1],P=f.length>0&&!_(f);return(0,a.jsxs)(s.A,{children:[(0,a.jsx)(l.A,{id:n,name:t,label:E,placeholder:h,type:g?"text":"password",value:f,onChange:function(e){return m(e.target.value)},error:v.length>0,helperText:v[0],autoComplete:T,fullWidth:!0,size:"small",InputProps:{startAdornment:(0,a.jsx)(c.A,{position:"start",children:(0,a.jsx)(s.A,{component:"i",className:"fa fa-lock",sx:{fontSize:"1rem"}})}),endAdornment:(0,a.jsx)(c.A,{position:"end",children:(0,a.jsx)(u.A,{"aria-label":y(g?"DISPLAY_STRINGS.AUTH_HIDE_PASSWORD":"DISPLAY_STRINGS.AUTH_SHOW_PASSWORD"),edge:"end",onClick:function(){return C((function(e){return!e}))},onMouseDown:function(e){return e.preventDefault()},size:"small",children:g?(0,a.jsx)(o.A,{}):(0,a.jsx)(i.A,{})})}),sx:{minHeight:46}},inputProps:{maxLength:72}}),L&&f?(0,a.jsxs)(s.A,{sx:{mt:1},children:[(0,a.jsxs)(d.A,{direction:"row",justifyContent:"space-between",children:[(0,a.jsx)(p.A,{color:"text.secondary",variant:"caption",children:y("DISPLAY_STRINGS.AUTH_PASSWORD_STRENGTH")}),(0,a.jsx)(p.A,{color:P?"error":"success.main",variant:"caption",children:y(P?"DISPLAY_STRINGS.AUTH_PASSWORD_WEAK":"DISPLAY_STRINGS.AUTH_PASSWORD_GOOD")})]}),(0,a.jsx)(d.A,{direction:"row",spacing:.5,sx:{mt:.75},children:[0,1,2].map((function(e){return(0,a.jsx)(s.A,{sx:{flex:1,height:3,borderRadius:1,bgcolor:P?0===e?"error.main":"divider":"primary.main"}},e)}))}
1),P?(0,a.jsx)(p.A,{color:"error",variant:"caption",sx:{display:"block",mt:1},children:y("DISPLAY_STRINGS.AUTH_INVALID_PASSWORD")}):null]}):null]})}},50477:function(){}}]);

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.