PageSourceSearch

https://docsbot.ai/_next/static/chunks/pages/app/account-481061e44454e131.js

js docsbot.ai collected 2026-10-01 09:15:35 UTC 77,281 bytes, 11 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[16034],{62897:function(e){"use strict";e.exports=e=>{if("string"!=typeof e)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!/^[a-zA-Z]:\\/.test(e)&&/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e)}},2314:function(e,t,a){"use strict";var n=a(85553);e.exports=function(e,t){var a;return a=function(e,t){var a={};if(!e||!e.type)throw Error("mdast-util-definitions expected node");return n(e,"definition",t&&t.commonmark?function(e){var t=r(e.identifier);s.call(a,t)||(a[t]=e)}:function(e){a[r(e.identifier)]=e}),a}(e,t),function(e){var t=e&&r(e);return t&&s.call(a,t)?a[t]:null}};var s={}.hasOwnProperty;function r(e){return e.toUpperCase()}},48330:function(e,t,a){var n=a(85553),s=a(2314),r=a(28395).Q,i=a(62897),l=a(26723);e.exports=function(e){var t=e||{},a=t.target,c=t.rel,u=t.protocols||d,m=t.content;return"string"==typeof c&&(c=r(c)),!m||"object"!=typeof m||"length"in m||(m=[m]),function(e){var t=s(e);n(e,["link","linkReference"],function(e){var n,s,r="link"===e.type?e:t(e.identifier);if(r){var d=r.url.slice(0,r.url.indexOf(":"));i(r.url)&&-1!==u.indexOf(d)&&(s=(n=e.data||(e.data={})).hProperties||(n.hProperties={}),!1!==a&&(s.target=a||"_blank"),!1!==c&&(s.rel=(c||o).concat()),m&&e.children.push({type:"fragment",children:[],data:{hName:"span",hChildren:l(!0,m)}}))}})}};var o=["nofollow","noopener","noreferrer"],d=["http","https"]},28395:function(e,t){"use strict";t.Q=function(e){var t=String(e||"").trim();return""===t?[]:t.split(a)};var a=/[ \t\n\r\f]+/g},85553:function(e,t,a){"use strict";e.exports=l;var n=a(95978),s=n.CONTINUE,r=n.SKIP,i=n.EXIT;function l(e,t,a,s){"function"==typeof t&&"function"!=typeof a&&(s=a,a=t,t=null),n(e,t,function(e,t){var n=t[t.length-1],s=n?n.children.indexOf(e):null;return a(e,s,n)},s)}l.CONTINUE=s,l.SKIP=r,l.EXIT=i},92825:function(e){"use strict";function t(){return!0}e.exports=function e(a){if("string"==typeof a)return function(e){return!!(e&&e.type===a)};if(null==a)return t;if("object"==typeof a)return("length"in a?function(t){var a=function(t){for(var a=[],n=t.length,s=-1;++s<n;)a[s]=e(t[s]);return a}(t),n=a.length;return function(){for(var e=-1;++e<n;)if(a[e].apply(this,arguments))return!0;return!1}}:function(e){return function(t){var a;for(a in e)if(t[a]!==e[a])return!1;return!0}})(a);if("function"==typeof a)return a;throw Error("Expected function, string, or object as test")}},95978:function(e,t,a){"use strict";e.exports=r;var n=a(92825),s="skip";function r(e,t,a,r){var l;"function"==typeof t&&"function"!=typeof a&&(r=a,a=t,t=null),l=n(t),function e(n,o,d){var c,u=[];return(!t||l(n,o,d[d.length-1]||null))&&!1===(u=i(a(n,d)))[0]?u:n.children&&u[0]!==s&&!1===(c=i(function(t,a){for(var n,s=r?-1:1,i=(r?t.length:-1)+s;i>-1&&i<t.length;){if(!1===(n=e(t[i],i,a))[0])return n;i="number"==typeof n[1]?n[1]:i+s}}(n.children,d.concat(n))))[0]?c:u}(e,null,[])}function i(e){return null!==e&&"object"==typeof e&&"length"in e?e:"number"==typeof e?[!0,e]:[e]}r.CONTINUE=!0,r.SKIP=s,r.EXIT=!1},57992:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/app/account",function(){return a(45142)}])},96089:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});var n=a(79619);function s(){return(0,n.jsxs)("div",{className:"loader-dots relative mt-1.5 block h-4 w-20",children:[(0,n.jsx)("div",{className:"absolute top-0 mt-1 h-2 w-2 rounded-full bg-cyan-500"}),(0,n.jsx)("div",{className:"absolute top-0 mt-1 h-2 w-2 rounded-full bg-cyan-500"}),(0,n.jsx)("div",{className:"absolute top-0 mt-1 h-2 w-2 rounded-full bg-cyan-500"}),(0,n.jsx)("div",{className:"absolute top-0 mt-1 h-2 w-2 rounded-full bg-cyan-500"})]})}},79567:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});var n=a(79619),s=a(66743);function r({value:e}){return(0,n.jsx)(s.Z,{children:e.toLocaleString()})}},53153:function(e,t,a){"use strict";a.d(t,{qI:function(){return p},Zn:function(){return s.Zn},oh:function(){return s.oh}});var n=a(79619),s=a(2436),r=a(54128),i=a(28651),l=a(33295),o=a(43508),d=a(99301);let c=e=>{if(!e||"string"!=typeof e)return!1;let t=e.toLowerCase();return t.includes("failed to fetch")||t.includes("dynamically imported module")||t.includes("cdn")||t.includes("requires a cdn")||t.includes("loading css chunk")||t.includes("networkerror")};var u=({chart:e,error:t,showActions:a=!1})=>{let[s,u]=(0,r.useState)(!1),m=c(t),p=async()=>
1{if(t)try{await navigator.clipboard.writeText(t),u(!0),setTimeout(()=>u(!1),1500)}catch(e){console.error("Failed to copy error message:",e)}};return(0,n.jsxs)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 mt-1 p-4",children:[t?(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)(d.Z,{content:t,placement:"top",children:(0,n.jsxs)("div",{className:"flex items-center gap-2 text-amber-700 cursor-help",children:[(0,n.jsx)(i.Z,{className:"h-4 w-4 text-amber-600"}),(0,n.jsx)("p",{className:"font-semibold",children:"Diagram could not be rendered"})]})}),(0,n.jsx)(d.Z,{content:s?"Copied!":"Copy error message",children:(0,n.jsx)("button",{onClick:p,className:"rounded-sm text-amber-600 hover:text-amber-700 focus:outline-none focus:ring-2 focus:ring-amber-500 focus:ring-offset-2",children:s?(0,n.jsx)(l.Z,{className:"h-4 w-4"}):(0,n.jsx)(o.Z,{className:"h-4 w-4"})})})]}):(0,n.jsxs)("div",{className:"flex items-center gap-2 text-amber-700",children:[(0,n.jsx)(i.Z,{className:"h-4 w-4 text-amber-600"}),(0,n.jsx)("p",{className:"font-semibold",children:"Diagram could not be rendered"})]}),(0,n.jsx)("p",{className:"mt-2 text-xs text-amber-700",children:m?"The diagram library could not be loaded. Refresh the page and try again.":"This diagram contains invalid Mermaid syntax, so it cannot be displayed."}),a&&(0,n.jsxs)("div",{className:"mt-3",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-amber-800",children:"What you can do:"}),(0,n.jsx)("ul",{className:"mt-1 list-disc list-inside text-sm text-amber-700",children:(0,n.jsx)("li",{children:"Ask me to try to fix the invalid syntax"})})]}),e&&(0,n.jsx)("div",{className:"mt-3 rounded border border-amber-200 bg-white p-3",children:(0,n.jsx)("pre",{className:"text-xs text-amber-900 overflow-x-auto",children:(0,n.jsx)("code",{children:e})})})]})};let m="/streamdown-cdn",p=({mermaid:e,showMermaidActions:t,cdnUrl:a=m,...r})=>{let i=(e,t)=>{if(!t)return e;let a={...e};for(let n in t)t[n]&&"object"==typeof t[n]&&!Array.isArray(t[n])&&e[n]&&"object"==typeof e[n]?a[n]=i(e[n],t[n]):a[n]=t[n];return a},l=i({flowchart:{htmlLabels:!1}},e?.config),o={...e??{},errorComponent:({chart:e,error:a})=>(0,n.jsx)(u,{chart:e,error:a,showActions:t}),config:l};return(0,n.jsx)(s.qI,{...r,cdnUrl:a,mermaid:o})}},45142:function(e,t,a){"use strict";a.r(t),a.d(t,{__N_SSP:function(){return er},default:function(){return ei}});var n=a(79619),s=a(82385),r=a.n(s),i=a(29009),l=a(54128),o=a(19166),d=a(67529),c=a(81269),u=a(35960),m=a(43096),p=a(59215),h=a(79191),y=a(55640),f=a(25477),x=a(61335),g=a(4241),b=a(39719),w=a(59850),j=a(23734),v=a(57036),N=a(25527),C=a(96219),S=a(84519),A=a(54025),k=a(28651),T=a(9965),D=a(53153),I=a(48330),q=a.n(I),M=a(13013),P=a(96089);function _({planName:e,message:t,limitDifferences:a=[],className:s="mt-5"}){if(!t)return null;let r=e=>Number(e||0).toLocaleString();return(0,n.jsxs)("div",{className:`${s} rounded-md border border-red-200 bg-red-50 p-4`,children:[(0,n.jsx)("p",{className:"text-sm font-semibold text-red-900",children:"You have grandfathered plan limits"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-red-800",children:t}),a.length>0&&(0,n.jsx)("ul",{className:"mt-3 space-y-1 text-sm text-red-900",children:a.map(e=>(0,n.jsxs)("li",{className:"flex gap-2",children:[(0,n.jsx)("span",{"aria-hidden":"true",children:"-"}),(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{className:"font-medium",children:e.label}),": ",r(e.grandfatheredLimit)," grandfathered"," vs ",r(e.currentLimit)," currently offered"]})]},e.key))})]})}let E=e=>`Your ${e} plan includes limits that are no longer offered on current plans. If you downgrade, you won't be able to switch back to these grandfathered limits.`,O=e=>`Your ${e} plan includes limits that are no longer offered on current plans. If you cancel, you won't be able to get these grandfathered limits back if you resubscribe.`;var L=a(79486),J=a(90729),U=a(99301),B=a(8226),$=a(3186);function F({team:e,bots:t=[],teamInvites:a=[],teamSourceTypes:s=[],setErrorText:r,onBillingChange:i=null,trackingContext:o={}}){let d=(0,u.U0)(),[c,m]=(0,l.useState)(!1),[p,h]=(0,l.useState)(""),[y,f]=(0,l.useState)(!1),[x,g]=(0,l.useState)(null),[b,w]=(0,l.useState)(null),j=(0,v.dR)(e),N=(0,v.S6)(e),C=(0,l.useMemo)(()=>(0,v.tF)(e),[e]),T=(0,l.useMemo)(()=>(0,$.DG)({team:e,bots:t,teamInvites:a,teamSourceTypes:s}),[e,t,a,s]),D=(0,l.useMemo)(()=>T.filter(e=>e.eligible),[T]),I=T[0]||null,q=D.find(e=>e.id===p),M=(0,l.useMemo)(()=>p&&j?.id?(0,$.i1)({currentPlanId:j.id,targetPlanId:p}):[],[p,j?.id]);if((0,l.useEffect)(()=>
1{if(!c){h(""),g(null),w(null);return}D.some(e=>e.id===p)||h(D[0]?.id||"")},[c,D,p]),0===T.length)return null;let P=e?.stripeSubscriptionInterval==="year"?"annually":"monthly",O=e?.stripeSubscriptionCurrency?.toUpperCase?.()||"USD",F=D.length>0,Z=F?null:(0,n.jsxs)("div",{className:"max-w-xs text-left normal-case",children:[(0,n.jsxs)("p",{className:"text-sm leading-5",children:["You do not currently qualify for the ",I?.name||"next lower"," plan."]}),I?.blockers?.length>0&&(0,n.jsx)("ul",{className:"mt-2 list-disc space-y-1 pl-4 text-sm leading-5",children:I.blockers.map(e=>(0,n.jsx)("li",{children:e},e))})]}),R=(e,t={})=>{d?.capture(e,{source:"account_page",...o,currentPlanId:j?.id,currentPlanName:j?.name,selectedTierId:p,selectedTierName:q?.name||null,lowerPlanOptionCount:D.length,downgradeLossCount:M.length,isGrandfatheredPlan:N,...t})};async function K(){if(!p)return;R("Account Downgrade Preview Started",{targetPlanId:p,targetPlanName:q?.name||null,frequency:P,currency:O}),r?.(null),f(!0);let t=await fetch(`/api/teams/${e.id}/subscription-change`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"preview",tier:p,frequency:P,currency:O})});if(t.ok){let e=await t.json();w({tier:p,frequency:P,currency:O}),g(e.preview),R("Account Downgrade Previewed",{targetPlanId:p,targetPlanName:q?.name||null,frequency:P,currency:O,amountDue:Number(e.preview?.amountDue||0),total:Number(e.preview?.total||0),creditAmount:Number(e.preview?.creditAmount||0),accountCreditApplied:Number(e.preview?.accountCreditApplied||0)}),f(!1);return}try{let e=await t.json();R("Account Downgrade Preview Failed",{targetPlanId:p,targetPlanName:q?.name||null,frequency:P,currency:O,status:t.status,error:e.message||"Something went wrong, please try again."}),r?.(e.message||"Something went wrong, please try again.")}catch(e){R("Account Downgrade Preview Failed",{targetPlanId:p,targetPlanName:q?.name||null,frequency:P,currency:O,status:t.status,error:"Error "+t.status}),r?.("Error "+t.status+", please try again.")}f(!1)}async function G(){if(!b||!x)return;R("Account Downgrade Confirm Started",{targetPlanId:b.tier,frequency:b.frequency,currency:b.currency,amountDue:Number(x.amountDue||0),total:Number(x.total||0),creditAmount:Number(x.creditAmount||0),accountCreditApplied:Number(x.accountCreditApplied||0)}),r?.(null),f(!0);let t=await fetch(`/api/teams/${e.id}/subscription-change`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"confirm",...b,prorationDate:x.prorationDate})});if(t.ok){try{let e=await t.json();e.paymentAction?.requiresAction&&(R("Account Downgrade Payment Action Required",{targetPlanId:b.tier}),await (0,B.B)(e.paymentAction))}catch(e){R("Account Downgrade Failed",{targetPlanId:b.tier,error:e.message||"Payment verification was not completed."}),r?.(e.message||"Payment verification was not completed."),f(!1);return}if(R("Account Downgrade Confirmed",{targetPlanId:b.tier,frequency:b.frequency,currency:b.currency}),m(!1),g(null),w(null),i){try{await i()}catch(e){r?.(e.message||"Plan updated, but billing details could not be refreshed.")}f(!1);return}window.location.reload();return}try{let e=await t.json();R("Account Downgrade Failed",{targetPlanId:b.tier,status:t.status,error:e.message||"Something went wrong, please try again."}),r?.(e.message||"Something went wrong, please try again.")}catch(e){R("Account Downgrade Failed",{targetPlanId:b.tier,status:t.status,error:"Error "+t.status}),r?.("Error "+t.status+", please try again.")}f(!1)}let V=()=>{y||(R("Account Downgrade Cancelled",{targetPlanId:p||null,targetPlanName:q?.name||null}),m(!1))};return(0,n.jsxs)(n.Fragment,{children:[F?(0,n.jsx)("button",{type:"button",className:"text-sm font-medium text-cyan-700 hover:text-cyan-900 hover:underline focus:outline-none",onClick:()=>{R("Account Downgrade Started",{defaultTargetPlanId:D[0]?.id||null,defaultTargetPlanName:D[0]?.name||null}),m(!0)},children:"Switch to a lower plan"}):(0,n.jsx)(U.Z,{content:Z,children:(0,n.jsx)("span",{className:"inline-flex cursor-not-allowed",children:(0,n.jsx)("button",{type:"button",className:"text-sm font-medium text-gray-400 focus:outline-none",disabled:!0,children:"Switch to a lower plan"})})}),(0,n.jsx)(J.Z,{preview:x,opening:y,onClose:()=>{R("Account Downgrade Preview Cancelled",{targetPlanId:b?.tier||p||null}),g(null),w(null)},onConfirm:G}),(0,n.jsx)(S.u.Root,{show:c&&!x,as:l.Fragment,children:(0,n.jsxs)(A.Vq,{as:"div",className:"relative z-50",onClose:V,children:[(0,n.jsx)(S.u.Child,{as:l.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)("div",{className:"fixed inset-0 bg-gray-900/50 transition-opacity"})}),(0,n.jsx)("div",{className:"fixed inset-0 z-50 overflow-y-auto",children:(0,n.jsx)("div",{className:"flex min-h-full items-center justify-center p-4",children:(0,n.jsx)(S.u.Child,{as:l.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,n.jsxs)(A.Vq.Panel,{className:"w-full max-w-lg transform rounded-lg bg-white p-6 text-left shadow-xl transition-all",children:[(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.jsx)("div",{className:"flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full bg-amber-100",children:(0,n.jsx)(k.Z,{className:"h-5 w-5 text-amber-600","aria-hidden":"true"})}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)(A.Vq.Title,{className:"text-lg font-semibold text-gray-900",children:"Switch to a lower plan"}),(0,n.jsxs)("p",{className:"mt-2 text-sm text-gray-600",children:["You are currently on the ",j.name," plan. Choose a lower plan to see what changes. Your add-ons stay active."]})]})]}),(0,n.jsxs)("div",{className:"mt-5",children:[(0,n.jsx)("label",{htmlFor:"downgrade-plan-select",className:"block text-sm font-medium text-gray-700",children:"New plan"}),(0,n.jsx)("select",{id:"downgrade-plan-select",value:p,onChange:e=>{let t=D.find(t=>
1t.id===e.target.value);R("Account Downgrade Target Selected",{targetPlanId:e.target.value,targetPlanName:t?.name||null}),h(e.target.value)},disabled:D.length<=1,className:"mt-2 block w-full rounded-md border-gray-300 text-sm shadow-sm focus:border-cyan-500 focus:ring-cyan-500 disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-700",children:D.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name},e.id))})]}),q&&(0,n.jsxs)(n.Fragment,{children:[N&&(0,n.jsx)(_,{message:E(j.name),limitDifferences:C}),(0,n.jsxs)("div",{className:"mt-5 rounded-md border border-amber-200 bg-amber-50 p-4",children:[(0,n.jsxs)("h4",{className:"text-sm font-semibold text-amber-900",children:["What you lose moving to ",q.name]}),M.length>0?(0,n.jsx)("ul",{className:"mt-3 space-y-2 text-sm text-amber-950",children:M.map(e=>(0,n.jsxs)("li",{className:"flex gap-2",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:"text-amber-600",children:"-"}),(0,n.jsx)("span",{children:"limit"===e.type?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"font-medium",children:e.label}),": ",e.from," → ",e.to]}):e.from&&e.to?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"font-medium",children:e.label}),": ",e.from," → ",e.to]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"font-medium",children:e.label})," — no longer included"]})})]},`${e.type}-${e.label}`))}):(0,n.jsx)("p",{className:"mt-3 text-sm text-amber-950",children:"This plan has lower included limits, but no additional feature removals were detected."}),(0,n.jsx)("p",{className:"mt-3 text-xs text-amber-800",children:"Add-ons are unchanged. Only the plan's included limits and features change."})]})]}),(0,n.jsxs)("div",{className:"mt-6 flex justify-end gap-3",children:[(0,n.jsx)("button",{type:"button",className:"rounded-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50",onClick:V,disabled:y,children:"Cancel"}),(0,n.jsx)("button",{type:"button",className:"inline-flex items-center justify-center rounded-md bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-700 disabled:cursor-not-allowed disabled:opacity-50",onClick:K,disabled:y||!p,children:y?(0,n.jsx)(L.Z,{}):"Review billing change"})]})]})})})})]})})]})}var Z=a(7453);function R({team:e,bots:t,teamInvites:a=[],teamSourceTypes:s=[],setParentErrorText:r=null,onBillingChange:i=null,trackingContext:d={}}){let m=(0,u.U0)(),[p,h]=(0,l.useState)(!1),[y,f]=(0,l.useState)(0),[x,g]=(0,l.useState)(null),[b,w]=(0,l.useState)(null),[N,C]=(0,l.useState)(""),[I,E]=(0,l.useState)(!1),L=[...Object.values(D.oh),[q(),{target:"_blank",rel:["noopener"]}]],[J]=(0,o.F_)(c.I8),[U,B]=(0,l.useState)(null),R=!e.stripeCustomerId||!["active","trialing","past_due","incomplete"].includes(e.stripeSubscriptionStatus)||e.stripeSubscriptionCancelAtPeriodEnd,K=(e,t={})=>{m?.capture(e,{source:"account_page",...d,currentStep:y,cancellationReason:x||null,hasCancellationDetails:!!b,isCancellationScheduled:R,...t})};(0,l.useEffect)(()=>{p||f(0)},[p]),(0,l.useEffect)(()=>{p&&K("Account Cancellation Step Viewed",{stepIndex:y,stepTitle:Q[y]?.title||null})},[p,y]),(0,l.useEffect)(()=>{if(4===y&&x&&b){let a=`Cancelation reason: ${z.find(e=>e.id===x).value}
2Followup question: ${z.find(e=>e.id===x).followup_question}
3Answer: ${b}`;J.displayName&&(a+=`
4Customer name: ${J.displayName}`),e.name.includes(J.displayName)||(a+=`
5Team/organization name: ${e.name}`),a+=`
6
7The following bots were being used by the user:`;for(let e=0;e<t.length;e++){let n=t[e];a+=`
8---
9Bot name: ${n.name}
10Bot description: ${n.description}
11Bot question count: ${n.questionCount}`}G(a=a.substring(0,2e3))}},[y]);let G=async e=>{C(""),E(!1);let t=new WebSocket("wss://api.docsbot.ai/teams/ZrbLG98bbxZ9EFqiPvyl/bots/FzpZv43hHhFNWZJ038xf/chat");t.onopen=function(a){let n={};J&&(n.name=J.displayName,n.email=J.email),t.send(JSON.stringify({question:e,metadata:n,context_items:16}))},t.onerror=function(e){console.log("There was a connection error",e),E(!0)},t.onclose=function(e){e.wasClean||(console.error("Network error, please try again."),E(!0))},t.onmessage=function(e){let a=JSON.parse(e.data);"bot"===a.sender&&("stream"===a.type?C(e=>e+a.message):"end"===a.type?(C(JSON.parse(a.message).answer),E(!0),t.close()):"error"===a.type&&(B(a.message),E(!0),t.close()))}};async function V(){if(B(null),!x||!b){K("Account Cancellation Validation Failed",{missingReason:!x,missingDetails:!b}),B("Please select a reason and provide details.");return}K("Account Cancellation Confirm Started",{reason:x,detailsLength:b.length});let t=await fetch(`/api/teams/${e.id}/stripe-portal`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:x,details:b})});if(t.ok){if(K("Account Cancellation Scheduled",{reason:x,detailsLength:b.length}),h(!1),g(null),w(null),i){try{await i({successMessage:"Your subscription is scheduled to cancel at the end of your billing period."})}catch(e){r?.(e.message||"Cancellation scheduled, but billing details could not be refreshed.")}return}window.location.reload();return}try{let e=await t.json();K("Account Cancellation Failed",{reason:x,status:t.status,error:e.message||"Something went wrong, please try again."}),B(e.message||"Something went wrong, please try again.")}catch(e){K("Account Cancellation Failed",{reason:x,status:t.status,error:"Error "+t.status}),B("Error "+t.status+", please try again.")}}let Y=(0,l.useRef)(null),Q=[{title:"Begin Cancellation",text:"We're sorry to see you go! To start the cancellation process for your DocsBot subscription, click 'Next'. Your feedback is valuable to us, and we'd appreciate it if you could share your reasons for cancellation in the next steps."}
11,{title:"See What’s New",text:"With support from customers like you, we’ve been hard at work innovating and making DocsBot even better. Here are some of our favorite recent highlights:"},{title:"Share Your Thoughts",text:"Your feedback helps us improve DocsBot. Please select your main reason for cancelling your subscription from the options below."},{title:"Can we have more details?",text:"Please provide some additional details to help us improve DocsBot."},{title:"Suggestions",text:""},{title:"Confirm Your Cancellation",text:"Are you absolutely sure you are ready to cancel your DocsBot plan? By clicking 'Confirm', cancellation will be scheduled for the end of your current billing period, after which all bots, question logs, reports, and other data will be deleted!"}],z=[{id:"too_expensive",value:"It’s too expensive",followup_question:"What features would provide enough value to be worth the cost?",suggestion:"We understand that cost can be a concern. Did you know we offer a variety of pricing plans? Let's find one that fits your budget. Would you be interested in exploring our [discounted/lesser-priced] plans?"},{id:"missing_features",value:"Some features are missing",followup_question:"What needed features are missing?"},{id:"switched_service",value:"I’m switching to a different service",followup_question:"Which service are you switching to?",suggestion:"We're sad to hear you're considering a switch. We'd love to offer a comparison to ensure you're getting the best value."},{id:"unused",value:"I don’t use the service enough",followup_question:"How could we improve DocsBot to make it more useful for you?",suggestion:"We want DocsBot to be a vital part of your daily activities. Here are some ways our other users integrate it into their workflow. Perhaps these could make it more useful for you too?"},{id:"customer_service",value:"Customer service was less than expected",followup_question:"What could we have done better?",suggestion:"We apologize if our service didn't meet your expectations. Your satisfaction is our priority. Can we offer you a one-on-one session with our founder to address any unresolved issues? Book a time here: https://tidycal.com/docsbot/customer-support-escalation"},{id:"too_complex",value:"Ease of use was less than expected",followup_question:"What was complex or difficult to use?",suggestion:"Ease of use is critical for us. Would you be open to a guided walkthrough to help streamline your experience and get  you setup with DocsBot? Book a time here: https://tidycal.com/team/docsbot/onboarding"},{id:"low_quality",value:"Quality was less than expected",followup_question:"What was the issue with quality?",suggestion:"Your experience with our platform should be nothing less than excellent. Please let us know the specific issues, and we'll work swiftly to resolve them—perhaps a service credit could make up for our shortcoming in the meantime?"},{id:"other",value:"Other reason",followup_question:"Please specify your reason for cancellation?"}];if(R)return null;let W=(0,$.DG)({team:e,bots:t,teamInvites:a,teamSourceTypes:s}).length>0,H=(0,v.dR)(e),X=(0,v.S6)(e),ee=(0,v.tF)(e);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3 text-center",children:[(0,n.jsx)(F,{team:e,bots:t,teamInvites:a,teamSourceTypes:s,setErrorText:r,onBillingChange:i,trackingContext:d}),W?(0,n.jsx)("span",{className:"hidden text-gray-300 sm:inline","aria-hidden":"true",children:"\xb7"}):null,(0,n.jsx)("button",{type:"button",className:"text-sm font-medium text-red-600 hover:text-red-900 hover:underline focus:outline-none",onClick:e=>{h(!0),K("Started Cancellation"),K("Account Cancellation Started",{hasLowerPlanOptions:W,isGrandfatheredPlan:X,currentPlanId:H?.id,currentPlanName:H?.name}),void 0!==window.bento&&window.bento.track("startedCancel")},children:"Cancel Plan"})]}),(0,n.jsx)(S.u.Root,{show:p,as:l.Fragment,children:(0,n.jsxs)(A.Vq,{as:"div",className:"relative z-modal",initialFocus:Y,onClose:e=>{e||K("Account Cancellation Modal Closed",{stepIndex:y,stepTitle:Q[y]?.title||null,reason:x||null}),h(e)},children:[(0,n.jsx)(S.u.Child,{as:l.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"})}),(0,n.jsx)("div",{className:"fixed inset-0 z-modal w-screen overflow-y-auto",children:(0,n.jsx)("div",{className:"flex min-h-full items-center justify-center p-4 text-center sm:items-center sm:p-0",children:(0,n.jsx)(S.u.Child,{as:l.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,n.jsxs)(A.Vq.Panel,{className:"relative flex max-h-[85vh] transform flex-col overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-2xl",children:[(0,n.jsxs)("div",{className:"overflow-y-auto bg-white px-4 pb-4 pt-5 sm:p-6 sm:pb-4",children:[(0,n.jsx)(j.Z,{title:U,type:"error"}),(0,n.jsxs)("div",{className:"sm:flex sm:items-start",children:[(0,n.jsx)("div",{className:"mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10",children:(0,n.jsx)(k.Z,{className:"h-6 w-6 text-red-600","aria-hidden":"true"})}),(0,n.jsxs)("div",{className:"mt-3 text-center sm:ml-4 sm:mt-0 sm:text-left",children:[(0,n.jsx)(A.Vq.Title,{as:"h3",className:"text-base font-semibold leading-6 text-gray-900",children:Q[y].title}),(0,n.jsxs)("div",{className:"mt-2",children:[(0,n.jsx)("p",{className:"my-4 text-sm text-gray-600",children:Q[y].text}),y===Q.length-1&&X&&(0,n.jsx)(_,{className:"mb-4",message:O(H.name),limitDifferences:ee}),1===y?(0,n.jsx)(()=>{let e=Z.slice(0,12);return(0,n.jsx)("div",{className:"mt-6",children:(0,n.jsx)("div",{className:"grid gap-4 sm:grid-cols-2",children:e.map(e=>(0,n.jsxs)("div",{className:"flex h-full flex-col justify-between rounded-lg border border-gray-200 bg-white p-4 shadow-sm",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h4",{className:"text-sm font-semibold text-gray-900",children:e.title}),(0,n.jsx)("p",{className:"mt-2 text-sm text-gray-600",children:e.description})]}),(0,n.jsx)("p",{className:"mt-4 text-xs font-medium text-cyan-700",children:e.date})]},`${e.date}-${e.title}`))})})},{}):2===y?(0,n.jsx)(()=>(0,n.jsxs)("div",{className:"my-4",children:[(0,n.jsx)("label",{className:"text-base font-semibold text-gray-900",children:"Reason"}),(0,n.jsxs)("fieldset",{className:"mt-4",children:[(0,n.jsx)("legend",{className:"sr-only",children:"Reason"}),(0,n.jsx)("div",{className:"space-y-4",children:z.map(e=>(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("input",{id:e.id,value:e.id,name:"reason",type:"radio",defaultChecked:e.id===x,onChange:t=>{K("Account Cancellation Reason Selected",{reason:t.target.value,reasonLabel:e.value}),g(t.target.value)},className:"h-4 w-4 border-gray-300 text-cyan-600 focus:ring-cyan-600"}),(0,n.jsx)("label",{htmlFor:e.id,className:"ml-3 block text-sm font-medium leading-6 text-gray-900",children:e.value})]},e.id))})]})]}),{}):3===y?(0,n.jsxs)("div",{className:"my-4",children:[(0,n.jsx)("label",{htmlFor:"details",className:"text-base font-semibold text-gray-900",children:z.find(e=>e.id===x).followup_question}),(0,n.jsx)("textarea",{id:"details",name:"details",rows:2,className:"mt-1 block w-full rounded-md border border-gray-300 shadow-sm focus:border-cyan-500 focus:ring-cyan-500 sm:text-sm",placeholder:"Please provide details...",onChange:e=>w(e.target.value),defaultValue:b})]}):4===y?N?(0,n.jsx)("div",{className:"my-4 text-sm text-gray-800",children:(0,n.jsx)(D.qI,{mode:"static",isAnimating:!1,remarkPlugins:L,children:(0,M.V)(N)})}):(0,n.jsx)("div",{className:"my-4",children:(0,n.jsx)(P.Z,{})}):null]})]})]})]}),(0,n.jsxs)("div",{className:"items-center bg-gray-50 px-4 py-3 sm:flex sm:justify-between sm:px-6",children:[(0,n.jsx)(()=>(0,n.jsxs)("nav",{className:"flex items-center justify-center","aria-label":"Progress",children:[(0,n.jsxs)("p",{className:"text-xs font-medium",children:["Step ",y+1," of ",Q.length]}),(0,n.jsx)("ol",{role:"list",className:"ml-8 flex items-center space-x-5",children:Q.map((e,t)=>(0,n.jsx)("li",{children:t<y?(0,n.jsx)("div",{className:"block h-2.5 w-2.5 rounded-full bg-red-600 hover:bg-red-900",children:(0,n.jsx)("span",{className:"sr-only",children:e.title})}):y===t?(0,n.jsxs)("div",{className:"relative flex items-center justify-center","aria-current":"step",children:[(0,n.jsx)("span",{className:"absolute flex h-5 w-5 p-px","aria-hidden":"true",children:(0,n.jsx)("span",{className:"h-full w-full rounded-full bg-red-200"})}),(0,n.jsx)("span",{className:"relative block h-2.5 w-2.5 rounded-full bg-red-600","aria-hidden":"true"}),(0,n.jsx)("span",{className:"sr-only",children:e.title})]}):(0,n.jsx)("div",{className:"block h-2.5 w-2.5 rounded-full bg-gray-200 hover:bg-gray-400",children:(0,n.jsx)("span",{className:"sr-only",children:e.title})})}
11,e.title))})]}),{}),(0,n.jsxs)("div",{className:"mt-3 flex items-center justify-between space-x-2 sm:mt-0",children:[(0,n.jsx)("button",{type:"button",className:"inline-flex w-full items-center justify-center rounded-md bg-cyan-600 px-6 py-2 text-sm font-medium text-white shadow-md hover:bg-cyan-700 focus:outline-none sm:w-auto",onClick:()=>{K("Account Cancellation Modal Closed",{stepIndex:y,stepTitle:Q[y]?.title||null,reason:x||null}),h(!1)},ref:Y,children:"Close"}),(0,n.jsx)("button",{type:"button",className:(0,T.Z)("inline-flex w-auto justify-center whitespace-nowrap rounded-md px-3 py-2 text-sm font-semibold shadow-sm disabled:opacity-25",y===Q.length-1?"bg-red-600 text-white hover:bg-red-500":"bg-red-50 text-red-600 ring-2 ring-inset ring-red-600 hover:bg-red-100"),onClick:()=>{y===Q.length-1?V():(K("Account Cancellation Step Continued",{fromStepIndex:y,fromStepTitle:Q[y]?.title||null,toStepIndex:y+1,toStepTitle:Q[y+1]?.title||null,reason:x||null,detailsLength:b?.length||0}),f(y+1))},disabled:2===y&&!x||3===y&&(!b||b.length<=5)||4===y&&!I,children:y===Q.length-1?"Confirm Cancellation":4===y?"I still want to cancel":"Next"})]})]})]})})})})]})})]})}var K=a(58269),G=a(660);function V({team:e}
11){let[t,a]=(0,l.useState)(!1),[s,r]=(0,l.useState)(!1),[i,o]=(0,l.useState)(null),m=(0,l.useRef)(null),p=(0,u.U0)(),h=()=>{(0,K.y)({signOutUser:()=>(0,d.w7)(c.I8),redirectTo:G.X.LOGIN,onComplete:()=>p?.reset()})};async function y(){o(""),r(!0);let t="/api/"+["teams",e.id].join("/"),n=await fetch(t,{method:"DELETE",headers:{"Content-Type":"application/json"}});if(n.ok)await n.json(),a(!1),r(!1),h();else{try{let e=await n.json();o(e.message||"Something went wrong, please try again.")}catch(e){o(n.status+" error, please try again.")}r(!1)}}return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",className:"inline-flex w-full justify-center rounded-md bg-red-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-red-500 sm:ml-3 sm:w-auto disabled:opacity-25 disabled:cursor-not-allowed",onClick:()=>a(!0),disabled:["active","trialing","past_due","incomplete"].includes(e.stripeSubscriptionStatus),children:"Delete"}),(0,n.jsx)(S.u.Root,{show:t,as:l.Fragment,children:(0,n.jsxs)(A.Vq,{as:"div",className:"relative z-modal",initialFocus:m,onClose:a,children:[(0,n.jsx)(S.u.Child,{as:l.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"})}),(0,n.jsx)("div",{className:"fixed inset-0 z-10 overflow-y-auto",children:(0,n.jsx)("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:(0,n.jsx)(S.u.Child,{as:l.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,n.jsxs)(A.Vq.Panel,{className:"relative transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg sm:p-6",children:[(0,n.jsxs)("div",{className:"sm:flex sm:items-start",children:[(0,n.jsx)("div",{className:"mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10",children:(0,n.jsx)(k.Z,{className:"h-6 w-6 text-red-600","aria-hidden":"true"})}),(0,n.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,n.jsx)(j.Z,{title:i,type:"error"}),(0,n.jsx)(A.Vq.Title,{as:"h3",className:"text-base font-semibold leading-6 text-gray-900",children:"Delete team account"}),(0,n.jsx)("div",{className:"mt-2",children:(0,n.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete your team account? All of your data will be permanently removed from our servers forever. This action cannot be undone."})})]})]}),(0,n.jsxs)("div",{className:"mt-5 sm:mt-4 sm:flex sm:flex-row-reverse",children:[(0,n.jsx)("button",{type:"button",className:"inline-flex w-full justify-center rounded-md bg-red-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-red-500 sm:ml-3 sm:w-auto disabled:opacity-25",onClick:e=>{y(),e.preventDefault()},disabled:s,children:"Delete"}),(0,n.jsx)("button",{type:"button",className:"mt-3 inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50 sm:mt-0 sm:w-auto",onClick:()=>a(!1),ref:m,children:"Cancel"})]})]})})})})]})})]})}var Y=a(79567),Q=a(75862),z=a(56706);function W({team:e}
11){let[t,a]=(0,l.useState)(!1),[s,r]=(0,l.useState)(!1),[i,o]=(0,l.useState)(null),[u,m]=(0,l.useState)("");return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("a",{type:"button",className:"inline-flex cursor-pointer items-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50",onClick:()=>a(!0),children:[(0,n.jsx)(Q.Z,{className:"mr-1 h-4 w-4","aria-hidden":"true"}),"Reset Password"]}),(0,n.jsx)(S.u.Root,{show:t,as:l.Fragment,children:(0,n.jsxs)(A.Vq,{as:"div",className:"relative z-modal",onClose:a,children:[(0,n.jsx)(S.u.Child,{as:l.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"})}),(0,n.jsx)("div",{className:"fixed inset-0 z-modal overflow-y-auto",children:(0,n.jsx)("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:(0,n.jsx)(S.u.Child,{as:l.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:(0,n.jsxs)(A.Vq.Panel,{className:"relative transform rounded-lg bg-white p-6 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-xl",children:[(0,n.jsx)("h3",{className:"inline-flex text-2xl font-bold",children:"Reset Password"}),(0,n.jsx)("div",{className:"absolute right-0 top-0 hidden pr-4 pt-4 sm:block",children:(0,n.jsxs)("button",{type:"button",className:"rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-cyan-500 focus:ring-offset-2",onClick:()=>a(!1),children:[(0,n.jsx)("span",{className:"sr-only",children:"Close"}),(0,n.jsx)(z.Z,{className:"h-6 w-6","aria-hidden":"true"})]})}),(0,n.jsxs)("div",{className:"light mt-4 overflow-visible",children:[(0,n.jsx)(j.Z,{type:"success",title:u}),(0,n.jsx)(j.Z,{type:"error",title:i}),(0,n.jsxs)("p",{children:["Are you sure you want to send a password reset link to"," ",c.I8.currentUser?.email,"?"]})]}),(0,n.jsx)("div",{className:"mt-6 flex w-full flex-shrink-0 items-end justify-end",children:(0,n.jsxs)("button",{onClick:()=>{r(!0),(0,d.LS)(c.I8,c.I8.currentUser.email).then(()=>{r(!1),m("Password reset email sent!"),o(null)}).catch(e=>{e.code;let t=e.message;r(!1),o(t),m(null)})},disabled:s,type:"button",className:"inline-flex items-center justify-center rounded-md border border-transparent bg-cyan-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-cyan-700 focus:outline-none focus:ring-2 focus:ring-cyan-500 focus:ring-offset-2 disabled:opacity-75",children:[s?(0,n.jsx)(L.Z,{className:"mr-2 h-4 w-4"}):(0,n.jsx)(Q.Z,{className:"mr-2 h-4 w-4"}),"Reset Password"]})})]})})})})]})})]})}let H=({name:e,stat:t,href:a,linkText:s,tooltip:i,CardIcon:l,limit:o,grandfathered:d=!1})=>{let c=(0,n.jsxs)("div",{className:"overflow-hidden rounded-lg bg-white shadow",children:[(0,n.jsx)("div",{className:"p-5",children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("div",{className:"flex-shrink-0",children:(0,n.jsx)(l,{className:"h-6 w-6 text-gray-400","aria-hidden":"true"})}),(0,n.jsx)("div",{className:"ml-5 w-0 flex-1",children:(0,n.jsxs)("dl",{children:[(0,n.jsxs)("dt",{className:"truncate text-sm font-medium text-gray-500",children:[e,d&&(0,n.jsx)("span",{"aria-label":"Grandfathered limit",className:"ml-0.5 text-cyan-700",children:"*"})]}),(0,n.jsx)("dd",{children:(0,n.jsxs)("div",{className:"text-lg font-medium text-gray-900",children:[(0,n.jsx)(Y.Z,{value:t}),o&&(0,n.jsxs)("span",{className:"text-sm text-gray-500",children:[" ","/ ",(0,n.jsx)(Y.Z,{value:o})]})]})})]})})]})}),a&&(0,n.jsx)("div",{className:"bg-gray-50 px-5 py-3",children:(0,n.jsx)("div",{className:"text-sm",children:(0,n.jsxs)(r(),{href:a,className:"font-medium text-cyan-700 hover:text-cyan-900",children:[s,(0,n.jsx)(m.Z,{className:"-mr-0.5 ml-1 inline h-3 w-3","aria-hidden":"true"})]})})})]},e);
11return i?(0,n.jsx)(U.Z,{content:i,children:c}):c},X=()=>{try{return JSON.parse('{"hobby":{"name":"Hobby (Legacy)","bots":1,"pages":1000,"questions":1000,"researchTasks":0,"teamMembers":1,"scheduleInterval":"none","logLimit":"6","prices":{"current":{"monthly":"price_1O20HPDdpfaJ8tM4lrcqoX25","annually":"price_1O20KRDdpfaJ8tM4S5xgEt3Y"},"old":["price_1Mj8ktDdpfaJ8tM4pfbJzHP7","price_1Mj8ktDdpfaJ8tM4gtMxkSAP"]},"actionsLimit":0},"personal":{"name":"Personal","bots":1,"pages":5000,"questions":5000,"researchTasks":0,"teamMembers":1,"scheduleInterval":"monthly","logLimit":"1000000000","prices":{"current":{"monthly":"price_1TUByKDdpfaJ8tM4e9gZ0NSK","annually":"price_1TUByKDdpfaJ8tM411fmD5kU"},"USD":{"monthly":"price_1TUByKDdpfaJ8tM4e9gZ0NSK","annually":"price_1TUByKDdpfaJ8tM411fmD5kU"},"JPY":{"monthly":"price_1TUByKDdpfaJ8tM4e9gZ0NSK","annually":"price_1TUByKDdpfaJ8tM411fmD5kU"},"AUD":{"monthly":"price_1TUByKDdpfaJ8tM4e9gZ0NSK","annually":"price_1TUByKDdpfaJ8tM411fmD5kU"},"EUR":{"monthly":"price_1TUByKDdpfaJ8tM4e9gZ0NSK","annually":"price_1TUByKDdpfaJ8tM411fmD5kU"},"GBP":{"monthly":"price_1TUByKDdpfaJ8tM4e9gZ0NSK","annually":"price_1TUByKDdpfaJ8tM411fmD5kU"},"versions":[{"name":"legacy_3bots","prices":["price_1O20g9DdpfaJ8tM4d7XFCX6Q","price_1O20h9DdpfaJ8tM4weg24BD2","price_1Ml2gcDdpfaJ8tM4qUgIh6dB","price_1Ml2gcDdpfaJ8tM4VScIa3GN"],"limits":{"bots":3}}]},"actionsLimit":3},"pro":{"name":"Pro (Legacy)","bots":10,"pages":10000,"questions":10000,"researchTasks":0,"teamMembers":3,"scheduleInterval":"weekly","logLimit":"1000000000","prices":{"current":{"monthly":"price_1O20kRDdpfaJ8tM4ow7l3uHf","annually":"price_1O20lXDdpfaJ8tM4bgDO1hzs"},"old":["price_1Mj8knDdpfaJ8tM400qBTiwF","price_1Mj8knDdpfaJ8tM4lESSwjC4"]},"actionsLimit":0},"standard":{"name":"Standard","bots":3,"pages":15000,"questions":15000,"researchTasks":5,"teamMembers":5,"scheduleInterval":"weekly","logLimit":"1000000000","prices":{"current":{"monthly":"price_1TUC14DdpfaJ8tM4NXax4GDH","annually":"price_1TUC14DdpfaJ8tM4fnezpCMp"},"USD":{"monthly":"price_1TUC14DdpfaJ8tM4NXax4GDH","annually":"price_1TUC14DdpfaJ8tM4fnezpCMp"},"JPY":{"monthly":"price_1TUC14DdpfaJ8tM4NXax4GDH","annually":"price_1TUC14DdpfaJ8tM4fnezpCMp"},"AUD":{"monthly":"price_1TUC14DdpfaJ8tM4NXax4GDH","annually":"price_1TUC14DdpfaJ8tM4fnezpCMp"},"EUR":{"monthly":"price_1TUC14DdpfaJ8tM4NXax4GDH","annually":"price_1TUC14DdpfaJ8tM4fnezpCMp"},"GBP":{"monthly":"price_1TUC14DdpfaJ8tM4NXax4GDH","annually":"price_1TUC14DdpfaJ8tM4fnezpCMp"},"versions":[{"name":"legacy_10bots","prices":["price_1RWNueDdpfaJ8tM4JL5njBAr","price_1RWNueDdpfaJ8tM4pRj7X1M1"],"limits":{"bots":10}}]},"actionsLimit":8},"business":{"name":"Business","bots":10,"pages":100000,"questions":60000,"researchTasks":25,"teamMembers":10,"scheduleInterval":"daily","logLimit":"1000000000","prices":{"current":{"monthly":"price_1TUByLDdpfaJ8tM48eHJM1VG","annually":"price_1TUByLDdpfaJ8tM4rZbnV3m7"},"USD":{"monthly":"price_1TUByLDdpfaJ8tM48eHJM1VG","annually":"price_1TUByLDdpfaJ8tM4rZbnV3m7"},"JPY":{"monthly":"price_1TUByLDdpfaJ8tM48eHJM1VG","annually":"price_1TUByLDdpfaJ8tM4rZbnV3m7"},"AUD":{"monthly":"price_1TUByLDdpfaJ8tM48eHJM1VG","annually":"price_1TUByLDdpfaJ8tM4rZbnV3m7"},"EUR":{"monthly":"price_1TUByLDdpfaJ8tM48eHJM1VG","annually":"price_1TUByLDdpfaJ8tM4rZbnV3m7"},"GBP":{"monthly":"price_1TUByLDdpfaJ8tM48eHJM1VG","annually":"price_1TUByLDdpfaJ8tM4rZbnV3m7"},"versions":[{"name":"legacy_100k_100bots","prices":["price_1O20oGDdpfaJ8tM4hR9BAb8D","price_1O20qSDdpfaJ8tM4voByPV5J","price_1Mj8kNDdpfaJ8tM4LdTiwKSn","price_1NAEKhDdpfaJ8tM4lpVhmffz"],"limits":{"bots":100,"questions":100000}}]},"actionsLimit":12},"enterprise":{"name":"Enterprise","bots":100,"pages":100000,"questions":100000,"researchTasks":25,"teamMembers":25,"scheduleInterval":"daily","logLimit":"1000000000","prices":{"current":{"monthly":"price_1NzoK9DdpfaJ8tM4KUeXYlii","annually":"price_1No93WDdpfaJ8tM4eKdGHNRV"},"old":["price_1PnAehDdpfaJ8tM4BTVFJudz"]},"actionsLimit":12},"enterprise2":{"name":"Custom Enterprise","bots":100,"pages":150000,"questions":100000,"teamMembers":15,"scheduleInterval":"daily","logLimit":"1000000000","prices":{"current":{"monthly":"price_1Nql9vDdpfaJ8tM47UTz9lcq"}},"actionsLimit":12},"enterprise3":{"name":"Custom Enterprise","bots":100,"pages":100000,"questions":200000,"teamMembers":25,"scheduleInterval":"daily","logLimit":"1000000000","prices":{"current":{"monthly":"price_1No91mDdpfaJ8tM4M0spKI8U"}},"actionsLimit":12},"enterprise4":{"name":"Custom Enterprise","bots":100,"pages":300000,"questions":100000,"teamMembers":15,"sc
11heduleInterval":"daily","logLimit":"1000000000","prices":{"current":{"monthly":"price_1Obyh2DdpfaJ8tM4VJjN0QH4"}},"actionsLimit":12},"enterprise5":{"name":"Custom Enterprise","bots":100,"pages":150000,"questions":100000,"teamMembers":25,"scheduleInterval":"daily","logLimit":"1000000000","prices":{"current":{"annually":"price_1QNIy3DdpfaJ8tM4lDeTBvff"}},"actionsLimit":12},"enterprise6":{"name":"Custom Enterprise","bots":150,"pages":150000,"questions":100000,"teamMembers":25,"scheduleInterval":"daily","logLimit":"1000000000","prices":{"current":{"monthly":"price_1QkHCuDdpfaJ8tM4kfRDoNHt"}},"actionsLimit":12},"enterprise7":{"name":"Custom Enterprise","bots":100,"pages":100000,"questions":150000,"teamMembers":15,"scheduleInterval":"weekly","logLimit":"1000000000","prices":{"current":{"monthly":"price_1RT2B5DdpfaJ8tM4BYjJcqj2"}},"actionsLimit":12},"automattic":{"name":"Custom Enterprise","bots":110,"pages":110000,"questions":130000,"teamMembers":50,"scheduleInterval":"daily","logLimit":"1000000000","prices":{"current":{"monthly":"price_1NaOivDdpfaJ8tM4nGoB24aW"}},"actionsLimit":12},"sony":{"name":"Custom Enterprise","bots":100,"pages":100000,"questions":130000,"teamMembers":25,"scheduleInterval":"daily","logLimit":"1000000000","prices":{"current":{"annually":"price_1Qrjb0DdpfaJ8tM4g2v3Y0B7"}},"actionsLimit":12},"jpa":{"name":"Custom Enterprise","bots":150,"pages":200000,"questions":100000,"teamMembers":35,"scheduleInterval":"daily","logLimit":"1000000000","prices":{"current":{"monthly":"price_1RttZlDdpfaJ8tM4QcrnIBlE"}},"actionsLimit":12},"citizengo":{"name":"Business Custom","bots":100,"pages":150000,"questions":100000,"researchTasks":25,"teamMembers":15,"scheduleInterval":"daily","logLimit":"1000000000","prices":{"current":{"monthly":"price_1SssPuDdpfaJ8tM4202mMWV9"}},"actionsLimit":12},"aruba":{"name":"Custom Enterprise","bots":100,"pages":100000,"questions":250000,"teamMembers":15,"scheduleInterval":"weekly","logLimit":"1000000000","prices":{"current":{"monthly":"price_1SuxJVDdpfaJ8tM4EE9ULo4a"}},"actionsLimit":12}}')}catch(e){return console.warn("Unable to parse NEXT_PUBLIC_STRIPE_PLANS",e),{}}},ee=(e,t=null)=>{if("number"==typeof e&&Number.isFinite(e))return e;if("string"==typeof e&&""!==e.trim()){let a=Number(e);return Number.isFinite(a)?a:t}return t},et=(e,t)=>ee(e?.[t]),ea=({currentPlan:e,resolvedPlan:t,key:a})=>{let n=et(t,a),s=et(e,a);return null===n||null===s||n===s?{isGrandfathered:!1,currentLimit:s}:{isGrandfathered:!0,currentLimit:s}},en=({tooltip:e,isGrandfathered:t})=>t?`${e} * This is a grandfathered limit for your current plan. If you downgrade or cancel, new limits will apply if you come back to this plan later.`:e,es="Unused prorated credit will stay on your account and be applied automatically to future invoices.";var er=!0,ei=function({team:e,bots:t,checkout:a,teamInvites:s=[],teamSourceTypes:r=[],role:m,canManageBilling:S,userId:A,hasDemoTrialPromotion:k=!1,trialPromotionKind:T=null,handoffError:D=!1}){let[I,q]=(0,l.useState)(null),M=I?{...e,...I}:e,[P]=(0,o.F_)(c.I8),[_,E]=(0,l.useState)(D?"This client handoff link is invalid, has already been accepted, or belongs to another email address.":null),[O,J]=(0,l.useState)(null),[$,F]=(0,l.useState)(""),[Z,K]=(0,l.useState)(!1),[G,Y]=(0,l.useState)(!1),[Q,z]=(0,l.useState)(""),[ee,et]=(0,l.useState)(!1),[er,ei]=(0,l.useState)(!1),[el,eo]=(0,l.useState)({}),[ed,ec]=(0,l.useState)(null),[eu,em]=(0,l.useState)((0,N.io)(M)),[ep,eh]=(0,l.useState)(!!M?.emailPaidInvoices),[ey,ef]=(0,l.useState)(M?.additionalBillingEmail||""),[ex,eg]=(0,l.useState)(!1),[eb,ew]=(0,l.useState)(!1);(0,l.useEffect)(()=>{ew(!0)},[]);let ej=eb&&P?.providerData?.some(e=>"google.com"===e.providerId),ev=M?.roles?.[A]==="owner",eN=(0,u.U0)(),eC=(0,i.useRouter)(),[eS,eA]=(0,l.useState)(!1),ek=(0,l.useCallback)((e={})=>{e&&0!==Object.keys(e).length&&q(t=>({...t||{},...e}))},[]),eT=(0,l.useCallback)(async()=>{if(!M?.id||!S)return null;let e=await fetch(`/api/teams/${M.id}/subscription-sync`,{method:"POST",headers:{"Content-Type":"application/json"}}),t=await e.json();if(e.ok&&t.teamBilling)return ek(t.teamBilling),t.teamBilling;if(e.ok&&t.skipped)return null;throw Error(t.message||"Unable to refresh billing details.")},[M?.id,S,ek]),eD=(0,l.useCallback)(async({successMessage:e}={})=>{await eT(),J(e||"Plan updated."),window.scrollTo({top:0,behavior:"smooth"})},[eT]);(0,l.useEffect)(()=>{z(P?.displayName||"")},[P]),(0,l.useEffect)(()=>{q(null)},[e?.id]),(0,l.useEffect)(()=>{em((0,N.io)(e))},[e?.id,e?.autoIncreaseAiCredits]),(0,l.useEffect)(()=>{eh(!!e?.emailPaidInvoices),ef(e?.additionalBillingEmail||"")},[e?.id,e?.emailPaidInvoices,e?.additionalBillingEmail]),(0,l.useEffect)(()=>{eN?.startSessionRecording()},[eN]),(0,l.useEffect)(()=>{(a||eC.query.session_id)&&(eS||(eA(!0),eT().catch(e=>{console.warn("Unable to sync billing state",e)})))},[a,eC.query.session_id,eS,eT]);let eI=Object.keys(M?.roles||{}).length+s.length,eq=(0,v.dR)(M),eM=(0,v.dR)({...M,stripeAddOns:{}}),eP=(0,N.je)(),e_=(0,N.G7)(M),eE=eP[N.t2.AI_CREDITS],eO=eP[N.t2.BOTS],eL=eP[N.t2.SOURCE_PAGES],eJ=eP[N.t2.TEAM_MEMBERS],eU=M?.stripeSubscriptionCurrency?.toUpperCase?.()||"USD",eB=M?.stripeSubscriptionInterval==="year"?"annually":"monthly",e$=e=>new Intl.NumberFormat("en-US",{style:"currency",currency:eU,maximumFractionDigits:"JPY"===eU||Number.isInteger(e)?0:2}).format(e||0),eF=!!M?.stripeCustomerId&&["active","trialing","past_due"].includes(M?.stripeSubscriptionStatus),eZ=eF&&!M?.stripeSubscriptionCancelAtPeriodEnd,eR={source:"account_page",teamId:M?.id,teamRole:m,canManageBilling:S,planId:eq?.id,planName:eq?.name,basePlanId:eM?.id,billingInterval:eB,currency:eU,subscriptionStatus:M?.stripeSubscriptionStatus||null,cancelAtPeriodEnd:!!M?.stripeSubscriptionCancelAtPeriodEnd,isPaidSubscription:eF,canManageAddOns:eZ,aiCreditAddOnQuantity:e_.aiCredits?.quantity||0,botAddOnQuantity:e_.bots?.quantity||0,sourcePageAddOnQuantity:e_.sourcePages?.quantity||0,autoIncreaseAiCredits:eu,emailPaidInvoices:ep,botCount:Number(M?.botCount||0),sourcePageCount:Number(M?.pageCount||0),aiCreditCount:Number(M?.questionCount||0),botLimit:Number(eq?.bots||0),sourcePageLimit:Number(eq?.pages||0),aiCreditLimit:Number(eq?.questions||0)},eK=(e,t={})=>{eN?.capture(e,{...eR,...t})};(0,l.useEffect)(()=>{eZ||ec(null)},[eZ]),(0,l.useEffect)(()=>{eK("Account Billing Viewed",{hasCheckoutSession:!!(a||eC.query.session_id),hasDemoTrialPromotion:k})},[M?.id]),(0,l.useEffect)(()=>{eo({[N.t2.AI_CREDITS]:e_.aiCredits?.quantity||0,[N.t2.BOTS]:e_.bots?.quantity||0,[N.t2.SOURCE_PAGES]:e_.sourcePages?.quantity||0,[N.t2.TEAM_MEMBERS]:e_.teamMembers?.quantity||0})},[e_.aiCredits?.quantity,e_.bots?.quantity,e_.sourcePages?.quantity,e_.teamMembers?.quantity]);let eG=X()?.[eq?.id],eV=(0,v.$J)(M),eY={bots:ea({currentPlan:eG,resolvedPlan:eM,key:"bots"}),pages:ea({currentPlan:eG,resolvedPlan:eM,key:"pages"}),questions:ea({currentPlan:eG,resolvedPlan:eM,key:"questions"}),actionsLimit:ea({currentPlan:eG,resolvedPlan:eM,key:"actionsLimit"}),teamMembers:ea({currentPlan:eG,resolvedPlan:eM,key:"teamMembers"})},eQ=e=>{let t=eP?.[e],a=e_?.[e]?.quantity||0;return a&&t?a*t.unit:0},ez=(e,t)=>{let a=eQ(t);return a?{planLimit:Math.max(0,Number(eq?.[e]||0)-a),addOnAmount:a}:null},eW=(e,t)=>
11t?`${t.planLimit.toLocaleString()} ${e} from your plan and ${t.addOnAmount.toLocaleString()} from add-ons.`:null,eH=ez("bots",N.t2.BOTS),eX=ez("pages",N.t2.SOURCE_PAGES),e0=ez("questions",N.t2.AI_CREDITS),e1=ez("teamMembers",N.t2.TEAM_MEMBERS),e5=[{name:"Bots",tooltip:en({tooltip:eH?`You can create up to ${eq.bots.toLocaleString()} bots. ${eW("bots",eH)}`:"You can create up to "+eq.bots+" bots.",...eY.bots}),icon:p.Z,stat:M?.botCount||0,limit:eq.bots,grandfathered:eY.bots.isGrandfathered},{name:"Source Pages",href:!1,tooltip:en({tooltip:eX?`A source page is the greater of 5000 characters of processed text or one document/web page. Your limit is ${eq.pages.toLocaleString()} pages. ${eW("pages",eX)}`:"A source page is the greater of 5000 characters of processed text or one document/web page.",...eY.pages}),icon:h.Z,stat:M?.pageCount||0,limit:eq.pages,grandfathered:eY.pages.isGrandfathered},{name:"AI Credits",href:!1,tooltip:en({tooltip:e0?`AI Credits used in the current month, including chat, skills, and deep research. Your monthly AI credit limit is ${eq.questions.toLocaleString()}. ${e0?`This includes ${e0.planLimit.toLocaleString()} from your plan and a ${e0.addOnAmount.toLocaleString()}-credit monthly limit increase from add-ons.`:null}`:"AI Credits used in the current month, including chat, skills, and deep research. This is a monthly limit, not a prepaid credit balance.",...eY.questions}),icon:y.Z,stat:(0,v.yS)(M?.questionCount),limit:eq.questions,grandfathered:eY.questions.isGrandfathered},{name:"Actions per Bot",tooltip:en({tooltip:eV>0?`Your ${eq.name} plan allows up to ${eV} actions per bot.`:"Actions are not available on your current plan.",...eY.actionsLimit}),icon:f.Z,stat:eV,grandfathered:eY.actionsLimit.isGrandfathered},{name:"Team Members",tooltip:en({tooltip:e1?`Current team members including invites. Your limit is ${eq.teamMembers.toLocaleString()} members. ${eW("members",e1)}`:"Current team members including invites. Your plan allows up to "+eq.teamMembers+" members.",...eY.teamMembers}),icon:x.Z,stat:eI,limit:eq.teamMembers,grandfathered:eY.teamMembers.isGrandfathered}],e2=e=>e?.limitKey==="questions"?Number(M?.questionCount||0):e?.limitKey==="bots"?Number(M?.botCount||0):e?.limitKey==="pages"?Number(M?.pageCount||0):e?.limitKey==="teamMembers"?eI:0,e4=e=>Number(eM?.[e?.limitKey]||0),e8=(e,t=0)=>e?.limitKey&&e?.unit?Math.max(0,Math.ceil((e2(e)-e4(e,t))/e.unit)):0,e3=(e,t=0)=>e?.limitKey==="questions"?"AI credits":e?.limitKey==="pages"?"pages":e?.limitKey==="bots"?1===t?"bot":"bots":e?.limitKey==="teamMembers"?1===t?"team user":"team users":e?.unitLabel||"units",e9=(e,t=0)=>{let a=Number(t||0)*Number(e?.unit||1);return`${a.toLocaleString()} ${e3(e,a)}`},e6=(e,t=0)=>{let a=e9(e,t);return e?.limitKey==="questions"?`${a} monthly limit increase`:a},e7=(e,t,{priceLabel:a=null,isCurrent:n=!1}={})=>{if(0===t)return"None";let s=e?.limitKey==="questions"?`+${e6(e,t)}`:e9(e,t),r=[a?`— ${a}`:null,n?"(current)":null].filter(Boolean).join(" ");return r?`${s} ${r}`:s},te=(e=0,t=0)=>Math.min(50,Math.max(10,e+10,t+5)),tt=(e,t="monthly")=>"annually"===t?`${e$(e)}/year`:`${e$(e)}/month`,ta=e=>eP?.[e]||null,tn=e=>(0,N.VZ)(e,eq);async function ts(e,t){let a=ta(e),n=e_?.[e]?.quantity||0;eK("Account Add-On Preview Started",{addOnId:e,addOnName:a?.name||e,currentQuantity:n,requestedQuantity:Number(t||0),quantityDelta:Number(t||0)-n}),ei(!0),E(null);try{let s=await fetch(`/api/teams/${M.id}/addons`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"previewQuantity",addOnId:e,quantity:t})}),r=await s.json();if(!s.ok)throw Error(r.message||"Unable to preview add-on change.");ec({addOnId:e,quantity:t,...r.preview}),eK("Account Add-On Previewed",{addOnId:e,addOnName:a?.name||e,currentQuantity:n,requestedQuantity:Number(t||0),nextQuantity:Number(r.preview?.nextQuantity||t||0),quantityDelta:Number(t||0)-n,amountDue:Number(r.preview?.amountDue||0),total:Number(r.preview?.total||0),creditAmount:Number(r.preview?.creditAmount||0),accountCreditApplied:Number(r.preview?.accountCreditApplied||0)})}
11catch(s){eK("Account Add-On Preview Failed",{addOnId:e,addOnName:a?.name||e,currentQuantity:n,requestedQuantity:Number(t||0),quantityDelta:Number(t||0)-n,error:s.message}),E(s.message),window.scrollTo({top:0,behavior:"smooth"})}finally{ei(!1)}}async function tr(){if(!ed)return;let e=ta(ed.addOnId),t=e_?.[ed.addOnId]?.quantity||0;eK("Account Add-On Confirm Started",{addOnId:ed.addOnId,addOnName:e?.name||ed.addOnId,currentQuantity:t,requestedQuantity:Number(ed.quantity||0),nextQuantity:Number(ed.nextQuantity||ed.quantity||0),quantityDelta:Number(ed.quantity||0)-t,amountDue:Number(ed.amountDue||0),creditAmount:Number(ed.creditAmount||0),accountCreditApplied:Number(ed.accountCreditApplied||0)}),ei(!0),E(null);try{let a=await fetch(`/api/teams/${M.id}/addons`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"confirmQuantity",addOnId:ed.addOnId,quantity:ed.quantity})}),n=await a.json();if(!a.ok)throw Error(n.message||"Unable to update add-ons.");if(n.paymentAction?.requiresAction){eK("Account Add-On Payment Action Required",{addOnId:ed.addOnId,addOnName:e?.name||ed.addOnId,currentQuantity:t,requestedQuantity:Number(ed.quantity||0)}),await (0,B.B)(n.paymentAction),ek({stripeAddOns:n.stripeAddOns,questionLimit:n.questionLimit}),ec(null),J("Add-ons updated."),window.scrollTo({top:0,behavior:"smooth"}),eK("Account Add-On Updated",{addOnId:ed.addOnId,addOnName:e?.name||ed.addOnId,currentQuantity:t,requestedQuantity:Number(ed.quantity||0),nextQuantity:Number(ed.nextQuantity||ed.quantity||0),quantityDelta:Number(ed.quantity||0)-t,requiredPaymentAction:!0});return}ek({stripeAddOns:n.stripeAddOns,questionLimit:n.questionLimit}),ec(null),J("Add-ons updated."),window.scrollTo({top:0,behavior:"smooth"}),eK("Account Add-On Updated",{addOnId:ed.addOnId,addOnName:e?.name||ed.addOnId,currentQuantity:t,requestedQuantity:Number(ed.quantity||0),nextQuantity:Number(ed.nextQuantity||ed.quantity||0),quantityDelta:Number(ed.quantity||0)-t,requiredPaymentAction:!1})}catch(a){eK("Account Add-On Update Failed",{addOnId:ed.addOnId,addOnName:e?.name||ed.addOnId,currentQuantity:t,requestedQuantity:Number(ed.quantity||0),quantityDelta:Number(ed.quantity||0)-t,error:a.message}),E(a.message),window.scrollTo({top:0,behavior:"smooth"})}finally{ei(!1)}}let ti=(e,t,a=0)=>{let n=Math.max(a,Number(t)||0),s=e_?.[e]?.quantity||0,r=ta(e);eK("Account Add-On Quantity Selected",{addOnId:e,addOnName:r?.name||e,currentQuantity:s,selectedQuantity:n,quantityDelta:n-s,minimumQuantity:a}),eo(t=>({...t,[e]:n}))};async function tl(e){eK("Account Add-On Auto Increase Toggled",{enabled:e,previousEnabled:eu}),em(e),E(null);try{let t=await fetch(`/api/teams/${M.id}/addons`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoIncreaseAiCredits:e})}),a=await t.json();if(!t.ok)throw Error(a.message||"Unable to update AI credit setting.");eK("Account Add-On Auto Increase Updated",{enabled:e})}catch(t){eK("Account Add-On Auto Increase Failed",{enabled:e,error:t.message}),em(!e),E(t.message),window.scrollTo({top:0,behavior:"smooth"})}}async function to(e=ep){let t=ey.trim();eK("Account Paid Invoice Emails Toggled",{enabled:e,previousEnabled:ep,hasAdditionalBillingEmail:!!t}),eh(e),eg(!0),E(null);try{let a=await fetch(`/api/teams/${M.id}/billing-preferences`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({emailPaidInvoices:e,additionalBillingEmail:t})}),n=await a.json();if(!a.ok)throw Error(n.message||"Unable to update paid invoice email setting.");ef(n.additionalBillingEmail||""),ek({emailPaidInvoices:n.emailPaidInvoices,additionalBillingEmail:n.additionalBillingEmail}),eK("Account Paid Invoice Emails Updated",{enabled:n.emailPaidInvoices,hasAdditionalBillingEmail:!!n.additionalBillingEmail})}catch(t){eK("Account Paid Invoice Emails Failed",{enabled:e,error:t.message}),eh(ep),E(t.message),window.scrollTo({top:0,behavior:"smooth"})}finally{eg(!1)}}return(0,n.jsxs)(w.Z,{page:"Account",team:M,bots:t,disablePageTitleLink:!0,children:[(0,n.jsx)(j.Z,{title:_,type:"error"}),(0,n.jsx)(j.Z,{title:O,type:"success"}),(0,n.jsxs)("div",{className:"mb-6 flex items-center gap-3 text-2xl font-semibold text-gray-700",children:[(0,n.jsx)(g.Z,{className:"h-8 w-8 text-cyan-600","aria-hidden":"true"}),(0,n.jsxs)("span",{children:["Current plan:"," ",(0,n.jsx)("span",{className:"font-bold text-gray-950",children:eq.name})]})]}),"partner"===eq.id&&(0,n.jsxs)("div",{className:"mb-6 rounded-lg border border-cyan-200 bg-cyan-50 p-5",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-cyan-950",children:"Partner workspace"}),(0,n.jsx)("p",{className:"mt-2 text-sm text-cyan-900",children:"This complimentary workspace includes Business-level features and capacity with a limited monthly AI-credit allowance for building and piloting client bots. When a client is ready for production, deploy only their bot to a client-owned team. To convert this entire workspace, choose an available paid plan below."})]}),(0,n.jsx)("div",{className:"grid grid-cols-2 gap-5 md:grid-cols-3 2xl:grid-cols-5",children:e5.map(e=>(0,n.jsx)(H,{name:e.name,href:e.href,linkText:e.linkText,tooltip:e.tooltip,CardIcon:e.icon,stat:e.stat,limit:e.limit,grandfathered:e.grandfathered},e.name))}),S&&(0,n.jsxs)(n.Fragment,{children:[ed&&(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-gray-900/50 px-4",children:(0,n.jsxs)("div",{className:"w-full max-w-lg rounded-lg bg-white p-6 shadow-xl",children:[(0,n.jsx)("h3",{className:"text-xl font-semibold text-gray-950",children:"Confirm add-on change"}),(0,n.jsx)("p",{className:"mt-2 text-sm text-gray-600",children:"Review the prorated billing impact before updating your subscription."}),(0,n.jsxs)("div",{className:"mt-5 rounded-lg border border-gray-200",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between border-b border-gray-200 px-4 py-3",children:[(0,n.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"New add-on limit increase"}),(0,n.jsx)("span",{className:"font-semibold text-gray-950",children:e6(ta(ed.addOnId),ed.nextQuantity)})]}),ed.lines?.length>0&&(0,n.jsx)("div",{className:"max-h-56 overflow-y-auto border-b border-gray-200 px-4 py-3",children:(0,n.jsx)("ul",{className:"space-y-3",children:ed.lines.map(e=>(0,n.jsxs)("li",{className:"flex items-start justify-between gap-4 text-sm",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("div",{className:"text-gray-600",children:e.description}),e.periodLabel&&(0,n.jsx)("div",{className:"mt-0.5 text-xs text-gray-400",children:e.periodLabel})]}),(0,n.jsx)("span",{className:"shrink-0 font-medium text-gray-900",children:e.formattedAmount})]},e.id))})}),ed.accountCreditApplied>0&&(0,n.jsxs)("div",{className:"flex items-center justify-between border-b border-gray-200 px-4 py-3 text-sm",children:[(0,n.jsx)("span",{className:"text-gray-600",children:"Account credit applied"}),(0,n.jsxs)("span",{className:"font-medium text-gray-900",children:["-",ed.formattedAccountCreditApplied]})]}),ed.creditAmount>0&&(0,n.jsxs)("div",{className:"flex items-center justify-between gap-4 border-b border-gray-200 px-4 py-3 text-sm",children:[(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-gray-600",children:["Credit kept for future invoices",(0,n.jsx)(U.Z,{content:es,children:(0,n.jsx)("span",{className:"inline-flex cursor-help text-gray-400","aria-label":es,children:(0,n.jsx)(b.Z,{className:"h-4 w-4","aria-hidden":"true"})})})]}),(0,n.jsx)("span",{className:"shrink-0 font-medium text-gray-900",children:ed.formattedCreditAmount})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",children:[(0,n.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Amount due now"}),(0,n.jsx)("span",{className:"font-semibold text-gray-950",children:ed.formattedAmountDue})]})]}),(0,n.jsxs)("div",{className:"mt-6 flex justify-end gap-3",children:[(0,n.jsx)("button",{type:"button",onClick:()=>
11{eK("Account Add-On Preview Cancelled",{addOnId:ed.addOnId,addOnName:ta(ed.addOnId)?.name||ed.addOnId,requestedQuantity:Number(ed.quantity||0),nextQuantity:Number(ed.nextQuantity||ed.quantity||0)}),ec(null)},disabled:er,className:"rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-25",children:"Cancel"}),(0,n.jsx)("button",{type:"button",onClick:tr,disabled:er,className:"inline-flex items-center justify-center rounded-md border border-transparent bg-cyan-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-cyan-700 disabled:cursor-not-allowed disabled:opacity-25",children:er?(0,n.jsx)(L.Z,{}):"Confirm update"})]})]})}),(0,n.jsxs)("div",{className:"mt-6 rounded-lg bg-white p-8 shadow",children:[(0,n.jsx)(C.Z,{team:M,bots:t,teamInvites:s,teamSourceTypes:r,hasDemoTrialPromotion:k,trialPromotionKind:T,onBillingChange:eD,trackingContext:eR}),(0,n.jsx)(R,{team:M,bots:t,teamInvites:s,teamSourceTypes:r,setParentErrorText:E,onBillingChange:eD,trackingContext:eR})]}),eZ&&(0,n.jsxs)("div",{className:"mt-6 rounded-lg bg-white p-8 shadow",children:[(0,n.jsx)("div",{className:"flex flex-col gap-6 lg:flex-row lg:items-start lg:justify-between",children:(0,n.jsxs)("div",{className:"w-full",children:[(0,n.jsx)("h3",{className:"text-2xl font-bold",children:"Add-ons"}),(0,n.jsx)("p",{className:"text-md mt-2 w-full text-gray-800",children:"Increase selected monthly plan limits without changing plans. Add-ons renew with your billing cycle, and billing changes are prorated."})]})}),(0,n.jsx)("div",{className:"mt-6 grid gap-4 md:grid-cols-2",children:[{addOn:eE,quantity:e_.aiCredits?.quantity||0,actionId:N.t2.AI_CREDITS,Icon:y.Z},{addOn:eO,quantity:e_.bots?.quantity||0,actionId:N.t2.BOTS,Icon:p.Z},{addOn:eL,quantity:e_.sourcePages?.quantity||0,actionId:N.t2.SOURCE_PAGES,Icon:h.Z},{addOn:eJ,quantity:e_.teamMembers?.quantity||0,actionId:N.t2.TEAM_MEMBERS,Icon:x.Z}].map(({addOn:e,quantity:t,actionId:a,Icon:s})=>{if(!e)return null;let r=e8(e,t),i=el[a]??t,l=tn(e),o=i<r,d=i===t,c=(0,N.kk)(e,eU,eB),u="annually"===eB?c/12:c,m=te(t,r),p="annually"===eB?"year":"month";return(0,n.jsxs)("div",{className:"rounded-lg border border-gray-200 p-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("h4",{className:"flex items-center gap-2 font-semibold text-gray-950",children:[(0,n.jsx)(s,{className:"h-5 w-5 shrink-0 text-cyan-600","aria-hidden":"true"}),(0,n.jsx)("span",{children:e.name})]}),(0,n.jsx)("p",{className:"mt-1 text-sm text-gray-600",children:e.description})]}),(0,n.jsxs)("p",{className:"mt-4 text-sm text-gray-700",children:[(0,n.jsx)("span",{className:"text-2xl font-bold text-gray-950",children:e$(u)}),(0,n.jsxs)("span",{className:"ml-1 text-sm text-gray-600",children:["/month per ",e.unitLabel]})]}),"annually"===eB&&(0,n.jsxs)("p",{className:"mt-1 text-xs text-gray-500",children:[e$(c)," billed annually."]}),(0,n.jsxs)("div",{className:"mt-4",children:[(0,n.jsxs)("p",{className:"text-sm text-gray-600",children:[e?.limitKey==="questions"?"Current monthly limit increase: ":"Current subscription: ",(0,n.jsx)("span",{className:"font-medium text-gray-900",children:t>0?`${e6(e,t)} (${e$(c*t)}/${p})`:"None"})]}),(0,n.jsx)("label",{htmlFor:`addon-${a}-quantity`,className:"sr-only",children:"Adjust add-on"}),(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[(0,n.jsx)("select",{id:`addon-${a}-quantity`,value:i,disabled:!l,onChange:e=>ti(a,e.target.value,r),className:"block min-w-0 flex-1 rounded-md border-gray-300 text-sm shadow-sm focus:border-cyan-500 focus:ring-cyan-500",children:Array.from({length:m+1},(a,s)=>(0,n.jsx)("option",{value:s,disabled:s<r,children:e7(e,s,{priceLabel:s>0?tt(c*s,eB):null,isCurrent:s===t})},s))}),(0,n.jsx)("button",{type:"button",onClick:()=>ts(a,el[a]??t),disabled:er||o||d||!l,className:"inline-flex items-center justify-center rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-25",children:"Change"})]}),!l&&(0,n.jsx)("p",{className:"mt-2 text-xs text-gray-500",children:"Extra team users are available on Business and Enterprise plans."}),r>0&&(0,n.jsx)("p",{className:"mt-2 text-xs text-gray-500",children:e?.limitKey==="questions"?`You have already used enough AI credits this month that your account needs at least a ${e9(e,r)} add-on limit increase. You can reduce it after usage resets at the start of the next calendar month.`:`Your current usage needs at least ${e9(e,r)} from add-ons. You can't reduce below this until usage drops.`})]})]},e.id)})}),(0,n.jsxs)("div",{className:"mt-6 flex items-center justify-between rounded-lg border border-gray-200 p-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h4",{className:"font-semibold text-gray-950",children:"Auto-increase AI credit limit"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-gray-600",children:"When you hit your monthly AI credit limit, automatically add another 5,000-credit monthly limit increase so bots keep responding."})]}),(0,n.jsxs)("label",{className:"relative inline-flex cursor-pointer items-center",children:[(0,n.jsx)("input",{type:"checkbox",className:"peer sr-only",checked:eu,onChange:e=>tl(e.target.checked)}),(0,n.jsx)("div",{className:"peer h-6 w-11 rounded-full bg-gray-200 after:absolute after:left-[2px] after:top-[2px] after:h-5 after:w-5 after:rounded-full after:bg-white after:transition-all peer-checked:bg-cyan-600 peer-checked:after:translate-x-full peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-cyan-500 peer-focus:ring-offset-2"})]})]})]}),(0,n.jsxs)("div",{className:"mt-6 rounded-lg bg-white p-8 shadow",children:[(0,n.jsx)("h3",{className:"text-2xl font-bold",children:"Invoice delivery"}),(0,n.jsxs)("div",{className:"mt-6 rounded-lg border border-gray-200 p-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-6",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h4",{className:"font-semibold text-gray-950",children:"Email paid invoice links"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-gray-600",children:"Email the team owner a Stripe link to view or download each paid invoice PDF for accounting records."})]}),(0,n.jsxs)("label",{className:"relative inline-flex cursor-pointer items-center",children:[(0,n.jsx)("input",{type:"checkbox",className:"peer sr-only",checked:ep,disabled:ex,onChange:e=>to(e.target.checked)}),(0,n.jsx)("span",{className:"sr-only",children:"Email paid invoice links"}),(0,n.jsx)("div",{className:"peer h-6 w-11 rounded-full bg-gray-200 after:absolute after:left-[2px] after:top-[2px] after:h-5 after:w-5 after:rounded-full after:bg-white after:transition-all peer-checked:bg-cyan-600 peer-checked:after:translate-x-full peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-cyan-500 peer-focus:ring-offset-2 peer-disabled:cursor-not-allowed peer-disabled:opacity-50"})]})]}),(0,n.jsxs)("div",{className:"mt-4 flex flex-col gap-3 border-t border-gray-200 pt-4 sm:flex-row sm:items-end",children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("label",{htmlFor:"additional_billing_email",className:"block text-sm font-medium text-gray-700",children:["Additional billing email address ",(0,n.jsx)("span",{className:"font-normal text-gray-500",children:"(optional)"})]}),(0,n.jsx)("input",{id:"additional_billing_email",type:"email",value:ey,disabled:ex,onChange:e=>ef(e.target.value),placeholder:"[email protected]",className:"mt-1 block w-full rounded-md border-gray-300 text-sm shadow-sm focus:border-cyan-500 focus:ring-cyan-500 disabled:cursor-not-allowed disabled:bg-gray-100"}),(0,n.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"The team owner is always included. This address receives the same paid invoice email."})]}),(0,n.jsx)("button",{type:"button",disabled:ex,onClick:()=>to(),className:"inline-flex h-10 items-center justify-center rounded-md border border-gray-300 bg-white px-4 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-25",children:ex?(0,n.jsx)(L.Z,{}):"Save"})]})]})]})]}),(0,n.jsxs)("div",{className:"mt-6 gap-6 md:grid md:grid-cols-2",children:[(0,n.jsxs)("div",{className:"rounded-lg bg-white p-8 shadow",children:[(0,n.jsx)("h3",{className:"text-2xl font-bold",children:"Update your name"}
11),(0,n.jsx)("p",{className:"text-md mt-2 text-justify text-gray-800",children:"You can update your display name here. This will update your name across the app."}),ej?(0,n.jsx)("p",{className:"mt-3 text-sm text-gray-500",children:"Your account is linked to Google. To change your name, update it in your Google account."}):(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"display_name",className:"block text-sm font-medium text-gray-700",children:"Display Name"}),(0,n.jsxs)("div",{className:"mt-1 flex rounded-md shadow-sm",children:[(0,n.jsx)("div",{className:"relative flex flex-grow items-stretch focus-within:z-10",children:(0,n.jsx)("input",{type:"text",id:"display_name",value:Q,onChange:e=>z(e.target.value),className:`block w-full rounded-none rounded-l-md border-gray-300 focus:border-cyan-500 focus:ring-cyan-500 sm:text-sm ${ee?"bg-gray-100 text-gray-500":""}`,placeholder:"Your name",disabled:ej||ee,required:!0})}),(0,n.jsx)("button",{type:"button",onClick:()=>{et(!0),(0,d.ck)(c.I8.currentUser,{displayName:Q}).then(()=>{J("Name updated successfully"),E(null),window.scrollTo({top:0,behavior:"smooth"})}).catch(e=>{E(e.message),J(null),window.scrollTo({top:0,behavior:"smooth"})}).finally(()=>{et(!1)})},className:"relative -ml-px inline-flex items-center space-x-2 rounded-r-md border border-gray-300 bg-gray-50 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-100 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500",disabled:ej||!Q||Q===(P?.displayName||"")||ee,children:ee?(0,n.jsx)(L.Z,{}):"Update"})]})]})]}),(0,n.jsxs)("div",{className:"rounded-lg bg-white p-8 shadow",children:[(0,n.jsx)("h3",{className:"text-2xl font-bold",children:"Update your email address"}),(0,n.jsx)("p",{className:"text-md mt-2 text-justify text-gray-800",children:"You can update your email address here. This will update your email address for all of your teams."}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"team_id",className:"block text-sm font-medium text-gray-700",children:"New Email"}),(0,n.jsxs)("div",{className:"mt-1 flex rounded-md shadow-sm",children:[(0,n.jsx)("div",{className:"relative flex flex-grow items-stretch focus-within:z-10",children:(0,n.jsx)("input",{type:"email",id:"team_id",value:$,onChange:e=>F(e.target.value),className:"block w-full rounded-none rounded-l-md border-gray-300 focus:border-cyan-500 focus:ring-cyan-500 sm:text-sm",placeholder:"Email",required:!0})}),(0,n.jsx)("button",{type:"button",onClick:()=>{(0,d.s)(c.I8.currentUser,$).then(()=>{J("Email updated successfully"),E(null),window.scrollTo({top:0,behavior:"smooth"})}).catch(e=>{E(e.message+" If you havn't recently logged in to your account, you may need log out then back in to change your email address for security reasons."),J(null),window.scrollTo({top:0,behavior:"smooth"})})},className:"relative -ml-px inline-flex items-center space-x-2 rounded-r-md border border-gray-300 bg-gray-50 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-100 focus:border-cyan-500 focus:outline-none focus:ring-1 focus:ring-cyan-500",children:"Update"})]})]})]}),(0,n.jsxs)("div",{className:"rounded-lg bg-white p-8 shadow",children:[(0,n.jsx)("h3",{className:"text-2xl font-bold",children:"Reset your password"}),(0,n.jsx)("p",{className:"text-md mt-2 text-justify text-gray-800",children:"You can request a password reset email here. This will send a password reset email to your email address. Please check your spam folder if you do not receive the email."}),(0,n.jsx)("div",{className:"mt-5 flex justify-end",children:(0,n.jsx)(W,{team:M})})]}),ev&&(0,n.jsxs)("div",{className:"rounded-lg bg-white p-8 shadow",children:[(0,n.jsx)("h3",{className:"text-2xl font-bold",children:"Delete Team Account"}),(0,n.jsx)("p",{className:"text-md mt-2 text-justify text-gray-800",children:"You can delete your team account here. This will delete all of your bots, sources, questions, keys, any other data, and remove all team members. This action cannot be undone and you should cancel any subscriptions before deleting your team account."}),(0,n.jsx)("div",{className:"mt-5 flex justify-end",children:(0,n.jsx)(V,{team:M})})]})]})]})}},13013:function(e,t,a){"use strict";function n(e){let t=null==e||""===e?"":"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):"";if(!t)return"";let a=[],n=[],s=t;s=(s=(s=(s=(s=s.replace(/```[\s\S]*?```/g,e=>{let t=`\u0001CODEBLOCK${a.length}\u0001`;return a.push(e),t})).replace(/`[^`\n]+`/g,e=>{let t=`\u0001INLINECODE${n.length}\u0001`;return n.push(e),t})).replace(/\\\[([\s\S]*?)\\\]/g,"$$$$$1$$$$")).replace(/\\\(([\s\S]*?)\\\)/g,"$$$$$1$$$$")).replace(/(^|\s)\$(\s+[^$]+\s+|\s*[^\d\s$][^$]*)\$(?!\w)/g,(e,t,a)=>t+"$$"+a+"$$");for(let e=n.length-1;e>=0;e--){let t=`\u0001INLINECODE${e}\u0001`;s=s.replace(t,()=>n[e])}for(let e=a.length-1;e>=0;e--){let t=`\u0001CODEBLOCK${e}\u0001`;s=s.replace(t,()=>a[e])}return s}a.d(t,{V:function(){return n}})},51226:function(e,t,a){"use strict";var n=a(54128);let s=n.forwardRef(function({title:e,titleId:t,...a},s){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},a),e?n.createElement("title",{id:t},e):null,n.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z",clipRule:"evenodd"}))});t.Z=s}},function(e){e.O(0,[48307,15059,19188,37111,59850,77199,80863,96219,49774,92888,40179],function(){return e(e.s=57992)}),_N_E=e.O()}]);

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.