@bpinternal/billing-ui 0.0.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +93 -30
- package/dist/index.js +2244 -1934
- package/dist/index.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(d,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("@tanstack/react-query"),require("react"),require("@stripe/stripe-js"),require("react-dom"),require("@stripe/react-stripe-js")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@tanstack/react-query","react","@stripe/stripe-js","react-dom","@stripe/react-stripe-js"],e):(d=typeof globalThis<"u"?globalThis:d||self,e(d.BillingUI={},d.ReactJsxRuntime,d.ReactQuery,d.React,d.StripeJs,d.ReactDOM,d.ReactStripeJs))})(this,function(d,e,ne,w,sn,nn,me){"use strict";const Ga=new Map;function ja(a){let s=Ga.get(a);return s||(s=sn.loadStripe(a,{developerTools:{assistant:{enabled:!1}}}),Ga.set(a,s)),s}const da=w.createContext(null);function rn(a){const[s,n]=w.useState(()=>typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches);return w.useEffect(()=>{if(a!=="system")return;const r=window.matchMedia("(prefers-color-scheme: dark)"),t=o=>n(o.matches);return r.addEventListener("change",t),()=>r.removeEventListener("change",t)},[a]),a==="system"?s:a==="dark"}const tn=({client:a,stripePublishableKey:s,email:n,locale:r="en-US",theme:t="light",onToast:o,analytics:l,featureLabels:i,billingVersion:c,workspaceId:h,persist:b=!0,manageBillingUrl:p,onBillingChange:y,refreshInterval:_=3e4,children:C})=>{const v=h||"default",[m]=w.useState(()=>new ne.QueryClient({defaultOptions:{queries:{retry:1,staleTime:3e4,gcTime:1e3*60*60}}})),S=rn(t),I=w.useMemo(()=>ja(s),[s]);w.useEffect(()=>{if(!b||typeof window>"u")return;const P=`bpb-cache:${v}`;try{const x=window.localStorage.getItem(P);x&&ne.hydrate(m,JSON.parse(x))}catch{window.localStorage.removeItem(P)}let u=null;const B=m.getQueryCache().subscribe(x=>{x.type!=="added"&&x.type!=="removed"&&x.type!=="updated"||(u&&clearTimeout(u),u=setTimeout(()=>{try{window.localStorage.setItem(P,JSON.stringify(ne.dehydrate(m)))}catch{}},250))});return()=>{u&&clearTimeout(u),B()}},[b,v,m]);const L=w.useCallback(()=>m.invalidateQueries({queryKey:["bpb",v]}),[m,v]),D=w.useCallback(P=>y==null?void 0:y(P),[y]),f=_>0?_:!1,A=w.useMemo(()=>({client:a,queryClient:m,scope:v,stripePromise:I,email:n,locale:r,isDark:S,toast:o??(()=>{}),analytics:l??{},featureLabels:i,isOutdatedBilling:c!==void 0&&c!=="v4",manageBillingUrl:p,refetchInterval:f,refresh:L,notifyBillingChange:D}),[a,m,v,I,n,r,S,o,l,i,c,p,f,L,D]);return e.jsx(da.Provider,{value:A,children:e.jsx("div",{className:"bpb-scope","data-bpb-theme":S?"dark":"light",style:{display:"contents"},children:C})})};function E(){const a=w.useContext(da);if(!a)throw new Error("@bpinternal/billing-ui components must be rendered inside <BillingProvider>");return a}function on(){var a;return((a=w.useContext(da))==null?void 0:a.isDark)??!1}const ae={root:a=>["bpb",a],plans:a=>["bpb",a,"plans"],addons:a=>["bpb",a,"addons"],subscription:a=>["bpb",a,"subscription"],preview:(a,s)=>["bpb",a,"preview",s],paymentMethod:a=>["bpb",a,"payment-method"],billingAddress:a=>["bpb",a,"billing-address"],customer:a=>["bpb",a,"customer"],invoices:a=>["bpb",a,"invoices"],readonly:a=>["bpb",a,"billing-readonly"],usages:(a,s)=>["bpb",a,"usages",s],bots:a=>["bpb",a,"bots"],usageByBot:(a,s,n)=>["bpb",a,"usage-by-bot",s,n]};function we(){const{client:a,queryClient:s,scope:n}=E();return ne.useQuery({queryKey:ae.plans(n),queryFn:()=>a.listPlans({})},s)}function De(){const{client:a,queryClient:s,scope:n}=E();return ne.useQuery({queryKey:ae.addons(n),queryFn:()=>a.listAddons({})},s)}function _e(a){const{client:s,queryClient:n,scope:r,refetchInterval:t}=E();return ne.useQuery({queryKey:ae.subscription(r),queryFn:()=>s.getSubscription({}),enabled:(a==null?void 0:a.enabled)??!0,refetchInterval:t},n)}function ba(a,s){const{client:n,queryClient:r,scope:t}=E();return ne.useQuery({queryKey:ae.preview(t,a),queryFn:()=>n.previewSubscriptionUpdate(a),enabled:(s==null?void 0:s.enabled)??!0},r)}function pa(a){const{client:s,queryClient:n,scope:r}=E();return ne.useQuery({queryKey:ae.paymentMethod(r),queryFn:()=>s.getPaymentMethod({}),enabled:(a==null?void 0:a.enabled)??!0},n)}function ua(a){const{client:s,queryClient:n,scope:r}=E();return ne.useQuery({queryKey:ae.billingAddress(r),queryFn:()=>s.getBillingAddress({}),enabled:(a==null?void 0:a.enabled)??!0},n)}function ha(a){const{client:s,queryClient:n,scope:r}=E();return ne.useQuery({queryKey:ae.customer(r),queryFn:()=>s.getCustomer({}),enabled:(a==null?void 0:a.enabled)??!0},n)}function Va(a){const{client:s,queryClient:n,scope:r,refetchInterval:t}=E();return ne.useQuery({queryKey:ae.invoices(r),queryFn:()=>s.listInvoices({}),enabled:(a==null?void 0:a.enabled)??!0,refetchInterval:t},n)}function ma(a){const{client:s,queryClient:n,scope:r}=E();return ne.useQuery({queryKey:ae.readonly(r),queryFn:()=>s.getBillingReadonly({}),enabled:(a==null?void 0:a.enabled)??!0},n)}function Ue(a){const{client:s,queryClient:n,scope:r,refetchInterval:t}=E(),o=a!=null&&a.period?new Date(a.period):new Date,l=`${o.getUTCFullYear()}-${String(o.getUTCMonth()+1).padStart(2,"0")}`;return ne.useQuery({queryKey:ae.usages(r,l),queryFn:()=>s.getWorkspaceUsages({period:`${l}-01T00:00:00.000Z`}).then(i=>i.quotas),enabled:(a==null?void 0:a.enabled)??!0,refetchInterval:t},n)}function Ka(a,s){const{client:n,queryClient:r,scope:t,refetchInterval:o}=E(),l=n.breakDownWorkspaceUsageByBot,i=n.listBots,c=typeof l=="function"&&typeof i=="function",h=s!=null&&s.period?new Date(s.period):new Date,b=`${h.getUTCFullYear()}-${String(h.getUTCMonth()+1).padStart(2,"0")}`;return ne.useQuery({queryKey:ae.usageByBot(t,a,b),queryFn:async()=>{const[p,y]=await Promise.all([l({id:t,type:a,period:`${b}-01T00:00:00.000Z`}),i({})]),_=new Map(y.bots.map(C=>[C.id,C.name]));return p.data.map(C=>({botId:C.botId,name:_.get(C.botId)??C.botId,value:C.value})).sort((C,v)=>v.value-C.value)},enabled:c&&((s==null?void 0:s.enabled)??!0),refetchInterval:o},r)}function Ya(){const{client:a}=E();return typeof a.breakDownWorkspaceUsageByBot=="function"&&typeof a.listBots=="function"}function ga(){const{client:a,queryClient:s}=E();return ne.useMutation({mutationFn:()=>a.createPaymentMethodIntent({})},s)}function ya(){const{client:a,queryClient:s,scope:n,notifyBillingChange:r}=E();return ne.useMutation({mutationFn:t=>a.setPaymentMethod(t),onSuccess:async()=>{await s.invalidateQueries({queryKey:ae.paymentMethod(n)}),r({type:"payment-method"})}},s)}function fa(){const{client:a,queryClient:s,scope:n,notifyBillingChange:r}=E();return ne.useMutation({mutationFn:async t=>{await a.setBillingAddress(t)},onSuccess:async()=>{await Promise.all([s.invalidateQueries({queryKey:ae.billingAddress(n)}),s.invalidateQueries({queryKey:ae.customer(n)})]),r({type:"billing-address"})}},s)}function _a(){const{client:a,queryClient:s,scope:n}=E();return ne.useMutation({mutationFn:r=>a.setCustomer(r),onSuccess:()=>s.invalidateQueries({queryKey:ae.customer(n)})},s)}function Ha(){const{client:a,queryClient:s,scope:n,notifyBillingChange:r}=E();return ne.useMutation({mutationFn:async t=>{await a.setAddons(t)},onSuccess:async()=>{await Promise.all([s.invalidateQueries({queryKey:ae.subscription(n)}),s.invalidateQueries({queryKey:ae.invoices(n)}),s.invalidateQueries({queryKey:["bpb",n,"preview"]})]),r({type:"addons"})}},s)}function va(){const{client:a,queryClient:s,scope:n,notifyBillingChange:r}=E();return ne.useMutation({mutationFn:async t=>{await a.setPlan({planId:t.planId,interval:t.interval,couponCode:t.couponCode}),t.addons&&Object.keys(t.addons).length>0&&await a.setAddons({addons:t.addons,couponCode:t.couponCode})},onSuccess:async()=>{await Promise.all([s.invalidateQueries({queryKey:ae.subscription(n)}),s.invalidateQueries({queryKey:ae.plans(n)}),s.invalidateQueries({queryKey:ae.invoices(n)}),s.invalidateQueries({queryKey:["bpb",n,"preview"]})]),r({type:"subscription"})}},s)}function Qa(a){var s,n,r="";if(typeof a=="string"||typeof a=="number")r+=a;else if(typeof a=="object")if(Array.isArray(a)){var t=a.length;for(s=0;s<t;s++)a[s]&&(n=Qa(a[s]))&&(r&&(r+=" "),r+=n)}else for(n in a)a[n]&&(r&&(r+=" "),r+=n);return r}function ln(){for(var a,s,n=0,r="",t=arguments.length;n<t;n++)(a=arguments[n])&&(s=Qa(a))&&(r&&(r+=" "),r+=s);return r}const cn=(a,s)=>{const n=new Array(a.length+s.length);for(let r=0;r<a.length;r++)n[r]=a[r];for(let r=0;r<s.length;r++)n[a.length+r]=s[r];return n},dn=(a,s)=>({classGroupId:a,validator:s}),Za=(a=new Map,s=null,n)=>({nextPart:a,validators:s,classGroupId:n}),je="-",Xa=[],bn="arbitrary..",pn=a=>{const s=hn(a),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=a;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return un(l);const i=l.split(je),c=i[0]===""&&i.length>1?1:0;return Ja(i,c,s)},getConflictingClassGroupIds:(l,i)=>{if(i){const c=r[l],h=n[l];return c?h?cn(h,c):c:h||Xa}return n[l]||Xa}}},Ja=(a,s,n)=>{if(a.length-s===0)return n.classGroupId;const t=a[s],o=n.nextPart.get(t);if(o){const h=Ja(a,s+1,o);if(h)return h}const l=n.validators;if(l===null)return;const i=s===0?a.join(je):a.slice(s).join(je),c=l.length;for(let h=0;h<c;h++){const b=l[h];if(b.validator(i))return b.classGroupId}},un=a=>a.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const s=a.slice(1,-1),n=s.indexOf(":"),r=s.slice(0,n);return r?bn+r:void 0})(),hn=a=>{const{theme:s,classGroups:n}=a;return mn(n,s)},mn=(a,s)=>{const n=Za();for(const r in a){const t=a[r];ka(t,n,r,s)}return n},ka=(a,s,n,r)=>{const t=a.length;for(let o=0;o<t;o++){const l=a[o];gn(l,s,n,r)}},gn=(a,s,n,r)=>{if(typeof a=="string"){yn(a,s,n);return}if(typeof a=="function"){fn(a,s,n,r);return}_n(a,s,n,r)},yn=(a,s,n)=>{const r=a===""?s:Ra(s,a);r.classGroupId=n},fn=(a,s,n,r)=>{if(vn(a)){ka(a(r),s,n,r);return}s.validators===null&&(s.validators=[]),s.validators.push(dn(n,a))},_n=(a,s,n,r)=>{const t=Object.entries(a),o=t.length;for(let l=0;l<o;l++){const[i,c]=t[l];ka(c,Ra(s,i),n,r)}},Ra=(a,s)=>{let n=a;const r=s.split(je),t=r.length;for(let o=0;o<t;o++){const l=r[o];let i=n.nextPart.get(l);i||(i=Za(),n.nextPart.set(l,i)),n=i}return n},vn=a=>"isThemeGetter"in a&&a.isThemeGetter===!0,kn=a=>{if(a<1)return{get:()=>{},set:()=>{}};let s=0,n=Object.create(null),r=Object.create(null);const t=(o,l)=>{n[o]=l,s++,s>a&&(s=0,r=n,n=Object.create(null))};return{get(o){let l=n[o];if(l!==void 0)return l;if((l=r[o])!==void 0)return t(o,l),l},set(o,l){o in n?n[o]=l:t(o,l)}}},Na="!",es=":",Nn=[],as=(a,s,n,r,t)=>({modifiers:a,hasImportantModifier:s,baseClassName:n,maybePostfixModifierPosition:r,isExternal:t}),wn=a=>{const{prefix:s,experimentalParseClassName:n}=a;let r=t=>{const o=[];let l=0,i=0,c=0,h;const b=t.length;for(let v=0;v<b;v++){const m=t[v];if(l===0&&i===0){if(m===es){o.push(t.slice(c,v)),c=v+1;continue}if(m==="/"){h=v;continue}}m==="["?l++:m==="]"?l--:m==="("?i++:m===")"&&i--}const p=o.length===0?t:t.slice(c);let y=p,_=!1;p.endsWith(Na)?(y=p.slice(0,-1),_=!0):p.startsWith(Na)&&(y=p.slice(1),_=!0);const C=h&&h>c?h-c:void 0;return as(o,_,y,C)};if(s){const t=s+es,o=r;r=l=>l.startsWith(t)?o(l.slice(t.length)):as(Nn,!1,l,void 0,!0)}if(n){const t=r;r=o=>n({className:o,parseClassName:t})}return r},Cn=a=>{const s=new Map;return a.orderSensitiveModifiers.forEach((n,r)=>{s.set(n,1e6+r)}),n=>{const r=[];let t=[];for(let o=0;o<n.length;o++){const l=n[o],i=l[0]==="[",c=s.has(l);i||c?(t.length>0&&(t.sort(),r.push(...t),t=[]),r.push(l)):t.push(l)}return t.length>0&&(t.sort(),r.push(...t)),r}},Sn=a=>({cache:kn(a.cacheSize),parseClassName:wn(a),sortModifiers:Cn(a),postfixLookupClassGroupIds:In(a),...pn(a)}),In=a=>{const s=Object.create(null),n=a.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)s[n[r]]=!0;return s},xn=/\s+/,An=(a,s)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:t,sortModifiers:o,postfixLookupClassGroupIds:l}=s,i=[],c=a.trim().split(xn);let h="";for(let b=c.length-1;b>=0;b-=1){const p=c[b],{isExternal:y,modifiers:_,hasImportantModifier:C,baseClassName:v,maybePostfixModifierPosition:m}=n(p);if(y){h=p+(h.length>0?" "+h:h);continue}let S=!!m,I;if(S){const P=v.substring(0,m);I=r(P);const u=I&&l[I]?r(v):void 0;u&&u!==I&&(I=u,S=!1)}else I=r(v);if(!I){if(!S){h=p+(h.length>0?" "+h:h);continue}if(I=r(v),!I){h=p+(h.length>0?" "+h:h);continue}S=!1}const L=_.length===0?"":_.length===1?_[0]:o(_).join(":"),D=C?L+Na:L,f=D+I;if(i.indexOf(f)>-1)continue;i.push(f);const A=t(I,S);for(let P=0;P<A.length;++P){const u=A[P];i.push(D+u)}h=p+(h.length>0?" "+h:h)}return h},Mn=(...a)=>{let s=0,n,r,t="";for(;s<a.length;)(n=a[s++])&&(r=ss(n))&&(t&&(t+=" "),t+=r);return t},ss=a=>{if(typeof a=="string")return a;let s,n="";for(let r=0;r<a.length;r++)a[r]&&(s=ss(a[r]))&&(n&&(n+=" "),n+=s);return n},Tn=(a,...s)=>{let n,r,t,o;const l=c=>{const h=s.reduce((b,p)=>p(b),a());return n=Sn(h),r=n.cache.get,t=n.cache.set,o=i,i(c)},i=c=>{const h=r(c);if(h)return h;const b=An(c,n);return t(c,b),b};return o=l,(...c)=>o(Mn(...c))},Bn=[],te=a=>{const s=n=>n[a]||Bn;return s.isThemeGetter=!0,s},ns=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,rs=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ln=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Pn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,En=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,zn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Dn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Un=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ae=a=>Ln.test(a),z=a=>!!a&&!Number.isNaN(Number(a)),ve=a=>!!a&&Number.isInteger(Number(a)),wa=a=>a.endsWith("%")&&z(a.slice(0,-1)),Ce=a=>Pn.test(a),ts=()=>!0,$n=a=>En.test(a)&&!zn.test(a),Ca=()=>!1,Fn=a=>Dn.test(a),On=a=>Un.test(a),qn=a=>!k(a)&&!N(a),Wn=a=>a.startsWith("@container")&&(a[10]==="/"&&a[11]!==void 0||a[11]==="s"&&a[16]!==void 0&&a.startsWith("-size/",10)||a[11]==="n"&&a[18]!==void 0&&a.startsWith("-normal/",10)),Gn=a=>Me(a,bs,Ca),k=a=>ns.test(a),Te=a=>Me(a,ps,$n),os=a=>Me(a,Xn,z),jn=a=>Me(a,hs,ts),Vn=a=>Me(a,us,Ca),ls=a=>Me(a,is,Ca),Kn=a=>Me(a,ds,On),Ve=a=>Me(a,ms,Fn),N=a=>rs.test(a),qe=a=>Be(a,ps),Yn=a=>Be(a,us),cs=a=>Be(a,is),Hn=a=>Be(a,bs),Qn=a=>Be(a,ds),Ke=a=>Be(a,ms,!0),Zn=a=>Be(a,hs,!0),Me=(a,s,n)=>{const r=ns.exec(a);return r?r[1]?s(r[1]):n(r[2]):!1},Be=(a,s,n=!1)=>{const r=rs.exec(a);return r?r[1]?s(r[1]):n:!1},is=a=>a==="position"||a==="percentage",ds=a=>a==="image"||a==="url",bs=a=>a==="length"||a==="size"||a==="bg-size",ps=a=>a==="length",Xn=a=>a==="number",us=a=>a==="family-name",hs=a=>a==="number"||a==="weight",ms=a=>a==="shadow",Jn=Tn(()=>{const a=te("color"),s=te("font"),n=te("text"),r=te("font-weight"),t=te("tracking"),o=te("leading"),l=te("breakpoint"),i=te("container"),c=te("spacing"),h=te("radius"),b=te("shadow"),p=te("inset-shadow"),y=te("text-shadow"),_=te("drop-shadow"),C=te("blur"),v=te("perspective"),m=te("aspect"),S=te("ease"),I=te("animate"),L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],f=()=>[...D(),N,k],A=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],u=()=>[N,k,c],B=()=>[Ae,"full","auto",...u()],x=()=>[ve,"none","subgrid",N,k],R=()=>["auto",{span:["full",ve,N,k]},ve,N,k],X=()=>[ve,"auto",N,k],ue=()=>["auto","min","max","fr",N,k],pe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],oe=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...u()],J=()=>[Ae,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...u()],M=()=>[Ae,"screen","full","dvw","lvw","svw","min","max","fit",...u()],le=()=>[Ae,"screen","full","lh","dvh","lvh","svh","min","max","fit",...u()],g=()=>[a,N,k],W=()=>[...D(),cs,ls,{position:[N,k]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],G=()=>["auto","cover","contain",Hn,Gn,{size:[N,k]}],Y=()=>[wa,qe,Te],V=()=>["","none","full",h,N,k],H=()=>["",z,qe,Te],ke=()=>["solid","dashed","dotted","double"],he=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],O=()=>[z,wa,cs,ls],de=()=>["","none",C,N,k],re=()=>["none",z,N,k],fe=()=>["none",z,N,k],ce=()=>[z,N,k],$=()=>[Ae,"full",...u()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ce],breakpoint:[Ce],color:[ts],container:[Ce],"drop-shadow":[Ce],ease:["in","out","in-out"],font:[qn],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ce],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ce],shadow:[Ce],spacing:["px",z],text:[Ce],"text-shadow":[Ce],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ae,k,N,m]}],container:["container"],"container-type":[{"@container":["","normal","size",N,k]}],"container-named":[Wn],columns:[{columns:[z,k,N,i]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:f()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:B()}],"inset-x":[{"inset-x":B()}],"inset-y":[{"inset-y":B()}],start:[{"inset-s":B(),start:B()}],end:[{"inset-e":B(),end:B()}],"inset-bs":[{"inset-bs":B()}],"inset-be":[{"inset-be":B()}],top:[{top:B()}],right:[{right:B()}],bottom:[{bottom:B()}],left:[{left:B()}],visibility:["visible","invisible","collapse"],z:[{z:[ve,"auto",N,k]}],basis:[{basis:[Ae,"full","auto",i,...u()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[z,Ae,"auto","initial","none",k]}],grow:[{grow:["",z,N,k]}],shrink:[{shrink:["",z,N,k]}],order:[{order:[ve,"first","last","none",N,k]}],"grid-cols":[{"grid-cols":x()}],"col-start-end":[{col:R()}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":x()}],"row-start-end":[{row:R()}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ue()}],"auto-rows":[{"auto-rows":ue()}],gap:[{gap:u()}],"gap-x":[{"gap-x":u()}],"gap-y":[{"gap-y":u()}],"justify-content":[{justify:[...pe(),"normal"]}],"justify-items":[{"justify-items":[...oe(),"normal"]}],"justify-self":[{"justify-self":["auto",...oe()]}],"align-content":[{content:["normal",...pe()]}],"align-items":[{items:[...oe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...oe(),{baseline:["","last"]}]}],"place-content":[{"place-content":pe()}],"place-items":[{"place-items":[...oe(),"baseline"]}],"place-self":[{"place-self":["auto",...oe()]}],p:[{p:u()}],px:[{px:u()}],py:[{py:u()}],ps:[{ps:u()}],pe:[{pe:u()}],pbs:[{pbs:u()}],pbe:[{pbe:u()}],pt:[{pt:u()}],pr:[{pr:u()}],pb:[{pb:u()}],pl:[{pl:u()}],m:[{m:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mbs:[{mbs:U()}],mbe:[{mbe:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":u()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":u()}],"space-y-reverse":["space-y-reverse"],size:[{size:J()}],"inline-size":[{inline:["auto",...M()]}],"min-inline-size":[{"min-inline":["auto",...M()]}],"max-inline-size":[{"max-inline":["none",...M()]}],"block-size":[{block:["auto",...le()]}],"min-block-size":[{"min-block":["auto",...le()]}],"max-block-size":[{"max-block":["none",...le()]}],w:[{w:[i,"screen",...J()]}],"min-w":[{"min-w":[i,"screen","none",...J()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[l]},...J()]}],h:[{h:["screen","lh",...J()]}],"min-h":[{"min-h":["screen","lh","none",...J()]}],"max-h":[{"max-h":["screen","lh",...J()]}],"font-size":[{text:["base",n,qe,Te]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Zn,jn]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",wa,k]}],"font-family":[{font:[Yn,Vn,s]}],"font-features":[{"font-features":[k]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[t,N,k]}],"line-clamp":[{"line-clamp":[z,"none",N,os]}],leading:[{leading:[o,...u()]}],"list-image":[{"list-image":["none",N,k]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",N,k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:g()}],"text-color":[{text:g()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ke(),"wavy"]}],"text-decoration-thickness":[{decoration:[z,"from-font","auto",N,Te]}],"text-decoration-color":[{decoration:g()}],"underline-offset":[{"underline-offset":[z,"auto",N,k]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:u()}],"tab-size":[{tab:[ve,N,k]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",N,k]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",N,k]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:W()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:G()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ve,N,k],radial:["",N,k],conic:[ve,N,k]},Qn,Kn]}],"bg-color":[{bg:g()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:g()}],"gradient-via":[{via:g()}],"gradient-to":[{to:g()}],rounded:[{rounded:V()}],"rounded-s":[{"rounded-s":V()}],"rounded-e":[{"rounded-e":V()}],"rounded-t":[{"rounded-t":V()}],"rounded-r":[{"rounded-r":V()}],"rounded-b":[{"rounded-b":V()}],"rounded-l":[{"rounded-l":V()}],"rounded-ss":[{"rounded-ss":V()}],"rounded-se":[{"rounded-se":V()}],"rounded-ee":[{"rounded-ee":V()}],"rounded-es":[{"rounded-es":V()}],"rounded-tl":[{"rounded-tl":V()}],"rounded-tr":[{"rounded-tr":V()}],"rounded-br":[{"rounded-br":V()}],"rounded-bl":[{"rounded-bl":V()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-bs":[{"border-bs":H()}],"border-w-be":[{"border-be":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":H()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ke(),"hidden","none"]}],"divide-style":[{divide:[...ke(),"hidden","none"]}],"border-color":[{border:g()}],"border-color-x":[{"border-x":g()}],"border-color-y":[{"border-y":g()}],"border-color-s":[{"border-s":g()}],"border-color-e":[{"border-e":g()}],"border-color-bs":[{"border-bs":g()}],"border-color-be":[{"border-be":g()}],"border-color-t":[{"border-t":g()}],"border-color-r":[{"border-r":g()}],"border-color-b":[{"border-b":g()}],"border-color-l":[{"border-l":g()}],"divide-color":[{divide:g()}],"outline-style":[{outline:[...ke(),"none","hidden"]}],"outline-offset":[{"outline-offset":[z,N,k]}],"outline-w":[{outline:["",z,qe,Te]}],"outline-color":[{outline:g()}],shadow:[{shadow:["","none",b,Ke,Ve]}],"shadow-color":[{shadow:g()}],"inset-shadow":[{"inset-shadow":["none",p,Ke,Ve]}],"inset-shadow-color":[{"inset-shadow":g()}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:g()}],"ring-offset-w":[{"ring-offset":[z,Te]}],"ring-offset-color":[{"ring-offset":g()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":g()}],"text-shadow":[{"text-shadow":["none",y,Ke,Ve]}],"text-shadow-color":[{"text-shadow":g()}],opacity:[{opacity:[z,N,k]}],"mix-blend":[{"mix-blend":[...he(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":he()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[z]}],"mask-image-linear-from-pos":[{"mask-linear-from":O()}],"mask-image-linear-to-pos":[{"mask-linear-to":O()}],"mask-image-linear-from-color":[{"mask-linear-from":g()}],"mask-image-linear-to-color":[{"mask-linear-to":g()}],"mask-image-t-from-pos":[{"mask-t-from":O()}],"mask-image-t-to-pos":[{"mask-t-to":O()}],"mask-image-t-from-color":[{"mask-t-from":g()}],"mask-image-t-to-color":[{"mask-t-to":g()}],"mask-image-r-from-pos":[{"mask-r-from":O()}],"mask-image-r-to-pos":[{"mask-r-to":O()}],"mask-image-r-from-color":[{"mask-r-from":g()}],"mask-image-r-to-color":[{"mask-r-to":g()}],"mask-image-b-from-pos":[{"mask-b-from":O()}],"mask-image-b-to-pos":[{"mask-b-to":O()}],"mask-image-b-from-color":[{"mask-b-from":g()}],"mask-image-b-to-color":[{"mask-b-to":g()}],"mask-image-l-from-pos":[{"mask-l-from":O()}],"mask-image-l-to-pos":[{"mask-l-to":O()}],"mask-image-l-from-color":[{"mask-l-from":g()}],"mask-image-l-to-color":[{"mask-l-to":g()}],"mask-image-x-from-pos":[{"mask-x-from":O()}],"mask-image-x-to-pos":[{"mask-x-to":O()}],"mask-image-x-from-color":[{"mask-x-from":g()}],"mask-image-x-to-color":[{"mask-x-to":g()}],"mask-image-y-from-pos":[{"mask-y-from":O()}],"mask-image-y-to-pos":[{"mask-y-to":O()}],"mask-image-y-from-color":[{"mask-y-from":g()}],"mask-image-y-to-color":[{"mask-y-to":g()}],"mask-image-radial":[{"mask-radial":[N,k]}],"mask-image-radial-from-pos":[{"mask-radial-from":O()}],"mask-image-radial-to-pos":[{"mask-radial-to":O()}],"mask-image-radial-from-color":[{"mask-radial-from":g()}],"mask-image-radial-to-color":[{"mask-radial-to":g()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":D()}],"mask-image-conic-pos":[{"mask-conic":[z]}],"mask-image-conic-from-pos":[{"mask-conic-from":O()}],"mask-image-conic-to-pos":[{"mask-conic-to":O()}],"mask-image-conic-from-color":[{"mask-conic-from":g()}],"mask-image-conic-to-color":[{"mask-conic-to":g()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:W()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:G()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",N,k]}],filter:[{filter:["","none",N,k]}],blur:[{blur:de()}],brightness:[{brightness:[z,N,k]}],contrast:[{contrast:[z,N,k]}],"drop-shadow":[{"drop-shadow":["","none",_,Ke,Ve]}],"drop-shadow-color":[{"drop-shadow":g()}],grayscale:[{grayscale:["",z,N,k]}],"hue-rotate":[{"hue-rotate":[z,N,k]}],invert:[{invert:["",z,N,k]}],saturate:[{saturate:[z,N,k]}],sepia:[{sepia:["",z,N,k]}],"backdrop-filter":[{"backdrop-filter":["","none",N,k]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[z,N,k]}],"backdrop-contrast":[{"backdrop-contrast":[z,N,k]}],"backdrop-grayscale":[{"backdrop-grayscale":["",z,N,k]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[z,N,k]}],"backdrop-invert":[{"backdrop-invert":["",z,N,k]}],"backdrop-opacity":[{"backdrop-opacity":[z,N,k]}],"backdrop-saturate":[{"backdrop-saturate":[z,N,k]}],"backdrop-sepia":[{"backdrop-sepia":["",z,N,k]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":u()}],"border-spacing-x":[{"border-spacing-x":u()}],"border-spacing-y":[{"border-spacing-y":u()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",N,k]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[z,"initial",N,k]}],ease:[{ease:["linear","initial",S,N,k]}],delay:[{delay:[z,N,k]}],animate:[{animate:["none",I,N,k]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,N,k]}],"perspective-origin":[{"perspective-origin":f()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":["scale-3d"],skew:[{skew:ce()}],"skew-x":[{"skew-x":ce()}],"skew-y":[{"skew-y":ce()}],transform:[{transform:[N,k,"","none","gpu","cpu"]}],"transform-origin":[{origin:f()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:$()}],"translate-x":[{"translate-x":$()}],"translate-y":[{"translate-y":$()}],"translate-z":[{"translate-z":$()}],"translate-none":["translate-none"],zoom:[{zoom:[ve,N,k]}],accent:[{accent:g()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:g()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",N,k]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":g()}],"scrollbar-track-color":[{"scrollbar-track":g()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":u()}],"scroll-mx":[{"scroll-mx":u()}],"scroll-my":[{"scroll-my":u()}],"scroll-ms":[{"scroll-ms":u()}],"scroll-me":[{"scroll-me":u()}],"scroll-mbs":[{"scroll-mbs":u()}],"scroll-mbe":[{"scroll-mbe":u()}],"scroll-mt":[{"scroll-mt":u()}],"scroll-mr":[{"scroll-mr":u()}],"scroll-mb":[{"scroll-mb":u()}],"scroll-ml":[{"scroll-ml":u()}],"scroll-p":[{"scroll-p":u()}],"scroll-px":[{"scroll-px":u()}],"scroll-py":[{"scroll-py":u()}],"scroll-ps":[{"scroll-ps":u()}],"scroll-pe":[{"scroll-pe":u()}],"scroll-pbs":[{"scroll-pbs":u()}],"scroll-pbe":[{"scroll-pbe":u()}],"scroll-pt":[{"scroll-pt":u()}],"scroll-pr":[{"scroll-pr":u()}],"scroll-pb":[{"scroll-pb":u()}],"scroll-pl":[{"scroll-pl":u()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",N,k]}],fill:[{fill:["none",...g()]}],"stroke-w":[{stroke:[z,qe,Te,os]}],stroke:[{stroke:["none",...g()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function T(...a){return Jn(ln(a))}function j(a,s="usd",n=2){return new Intl.NumberFormat("en-US",{style:"currency",currency:s.toUpperCase(),minimumFractionDigits:n,maximumFractionDigits:n}).format(a)}function Se(a,s="en-US"){return new Date(a).toLocaleDateString(s,{month:"short",day:"numeric",year:"numeric"})}function gs(a,s){const n=new Date(a);return n.setDate(n.getDate()+s),n.toISOString()}function se(a){return new Intl.NumberFormat("en-US").format(a)}function Le(a){if(a<=0)return"0 MB";const s=a/1e9;if(s>=1)return`${Number.isInteger(s)?s:s.toFixed(1)} GB`;const n=a/1e6;return`${Number.isInteger(n)?n:n.toFixed(0)} MB`}function ee(a){return a.replace("Plan - ","")}function ys(a){return{usd:"$",eur:"€",gbp:"£",cad:"$",aud:"$",jpy:"¥"}[a.toLowerCase()]??`${a.toUpperCase()} `}const We=["community","plus","team","enterprise","managed"],Rn=["community","plus","team","enterprise","managed"];function ge(a){var r;const s=a.name.toLowerCase();if(s.includes("community")||s.includes("pay-as-you-go")||s.includes("free"))return"community";if(s.includes("plus"))return"plus";if(s.includes("team"))return"team";if(s.includes("managed"))return"managed";if(s.includes("enterprise"))return"enterprise";const n=(r=a.metadata)==null?void 0:r.legacyName;return Rn.find(t=>t===n)??"community"}const fs="https://botpress.com/contact-us/managed-plan",Sa={community:["AI usage included","3 seats","3 AI agents","Botpress Desk","Botpress Studio + ADK","Help center","1K table rows","100MB file storage","100MB vector DB storage","Community support"],plus:["3 seats","Unlimited AI agents","WhatsApp channel","Help Center custom domain","Whitelabel webchat","100K table rows","10GB file storage","1GB vector DB storage","Technical support via live chat"],team:["Unlimited seats","Teams, routing & RBAC","Team-level analytics","500K table rows","50GB file storage","5GB vector DB storage"],enterprise:["Voice channel","Dedicated support","SLA & security review","Custom storage"],managed:[]},Ia={"AI usage included":"A monthly allowance of AI model spend is bundled into every plan — no separate AI bill.","3 seats":"Up to 3 team members can collaborate in this workspace.","Unlimited seats":"Invite as many team members to the workspace as you need.","3 AI agents":"Build and publish up to 3 distinct AI agents.","Unlimited AI agents":"Build and publish as many AI agents as you need.","Botpress Desk":"The human-handoff inbox where agents triage and reply to live conversations.","Botpress Studio + ADK":"The visual Studio builder plus the Agent Development Kit for building agents in code.","Help center":"A hosted knowledge base your agent answers from and customers can browse.","Help Center custom domain":"Serve your help center from your own domain instead of a Botpress URL.","WhatsApp channel":"Connect your agent to WhatsApp to chat with customers there.","Voice channel":"Connect your agent to phone/voice so it can handle spoken conversations.","Whitelabel webchat":"Remove Botpress branding from the web chat widget so it’s fully your own.","Teams, routing & RBAC":"Organize members into teams, route conversations between them, and control access by role.","Team-level analytics":"Performance and volume metrics broken down per team.","Technical support via live chat":"Reach the Botpress support team over live chat for help.","Community support":"Get help from the Botpress community forum and Discord.","Dedicated support":"A named contact and priority support channel for your account.","SLA & security review":"A contractual uptime SLA and a security/compliance review for your procurement.","Custom storage":"Storage limits tailored to your workload, beyond the standard tiers."},er=[{test:/table rows/i,describe:a=>`${a.replace(/ table rows/i,"")} rows across all your data tables.`},{test:/file storage/i,describe:a=>`${a.replace(/ file storage/i,"")} of uploaded files (documents, images, attachments).`},{test:/vector db storage/i,describe:a=>`${a.replace(/ vector db storage/i,"")} of embeddings for knowledge-base search and retrieval.`}];function _s(a,s){var n;return s!=null&&s[a]?s[a]:Ia[a]?Ia[a]:(n=er.find(r=>r.test.test(a)))==null?void 0:n.describe(a)}function Ye(a,s,n){return a.prices[s.id]??a.prices[ge(s)]??a.prices[n]??null}function Ge(a){return a.replace("Add-on - ","")}function vs(a){return(a==null?void 0:a.find(s=>{var n;return(((n=s.increments)==null?void 0:n.conversation_sessions)??0)>0}))??null}const ks=[{key:"conversation_sessions",label:"Conversations / month",unit:"count"},{key:"table_rows",label:"Table rows",unit:"count"},{key:"vector_db_storage",label:"Vector DB storage",unit:"bytes"},{key:"file_storage",label:"File storage",unit:"bytes"}];function Ns(a,s,n){var t;if(!s)return[];const r=[];for(const o of ks){const l=a.features[o.key]??0;let i=0;for(const c of s){const h=((t=c.increments)==null?void 0:t[o.key])??0,b=n[c.id]??0;i+=h*b}i>0&&r.push({...o,now:l,next:l+i})}return r}function ws(a,s,n){var t;if(!a)return[];const r=[];for(const o of ks){const l=a.features[o.key]??0;let i=0;for(const c of s??[])i+=(((t=c.increments)==null?void 0:t[o.key])??0)*(n[c.id]??0);(l>0||i>0)&&r.push({...o,base:l,added:i,total:l+i})}return r}function xa(a,s,n){var l;const r=vs(a);if(!r)return null;const t=((l=r.increments)==null?void 0:l.conversation_sessions)??0,o=Ye(r,s,n);return t<=0||!o||o.amount<=0?null:{packSize:t,amount:o.amount,currency:o.currency}}const Aa=({variant:a="accent",children:s,className:n})=>e.jsx("span",{className:T("bpb-badge",`bpb-badge--${a}`,n),children:s}),ie=({variant:a="primary",size:s="md",block:n=!1,loading:r=!1,className:t,disabled:o,children:l,type:i="button",...c})=>e.jsxs("button",{type:i,className:T("bpb-btn",`bpb-btn--${a}`,`bpb-btn--${s}`,n&&"bpb-btn--block",t),disabled:o||r,"data-loading":r||void 0,...c,children:[r&&e.jsx("span",{className:"bpb-btn__spinner","aria-hidden":!0}),e.jsx("span",{className:"bpb-btn__label",children:l})]}),Q=(a,s)=>({width:a??16,height:a??16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,...s}),Cs=({size:a,...s})=>e.jsx("svg",{...Q(a,s),children:e.jsx("path",{d:"M3 8.5l3.5 3.5L13 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Ma=({size:a,...s})=>e.jsxs("svg",{...Q(a,s),children:[e.jsx("path",{d:"M8 1.5l1.4 3.6a1 1 0 00.6.6L13.5 7l-3.5 1.4a1 1 0 00-.6.6L8 12.5 6.6 9a1 1 0 00-.6-.6L2.5 7 6 5.7a1 1 0 00.6-.6L8 1.5z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),e.jsx("path",{d:"M12.8 11l.5 1.2 1.2.5-1.2.5-.5 1.3-.5-1.3-1.2-.5 1.2-.5.5-1.2z",fill:"currentColor"})]}),Ss=({size:a,...s})=>e.jsx("svg",{...Q(a,s),children:e.jsx("path",{d:"M2.5 8a5.5 5.5 0 115.5 5.5c-.9 0-1.8-.2-2.5-.6L2.5 13.5l.6-3A5.5 5.5 0 012.5 8z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})}),Ta=({size:a,...s})=>e.jsxs("svg",{...Q(a,s),children:[e.jsx("path",{d:"M8 1.8l5 1.8v4c0 3.2-2.1 5.4-5 6.6-2.9-1.2-5-3.4-5-6.6v-4l5-1.8z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),e.jsx("path",{d:"M5.8 8l1.6 1.6 2.8-3",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),Is=({size:a,...s})=>e.jsx("svg",{...Q(a,s),children:e.jsx("path",{d:"M6 2.5h3v1.6a1.4 1.4 0 102.8 0V2.5h1.7v3h-1.6a1.4 1.4 0 100 2.8h1.6v3h-3v1.6a1.4 1.4 0 11-2.8 0v-1.6h-3v-3h1.6a1.4 1.4 0 100-2.8H2.5v-3H6z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})}),He=({size:a,...s})=>e.jsxs("svg",{...Q(a,s),children:[e.jsx("path",{d:"M8 2l6 3-6 3-6-3 6-3z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),e.jsx("path",{d:"M2 8l6 3 6-3M2 11l6 3 6-3",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})]}),xs=({size:a,...s})=>e.jsx("svg",{...Q(a,s),children:e.jsx("path",{d:"M8 8c-1.2-1.6-2-2.4-3.3-2.4a2.4 2.4 0 100 4.8C6 10.4 6.8 9.6 8 8zm0 0c1.2 1.6 2 2.4 3.3 2.4a2.4 2.4 0 100-4.8C10 5.6 9.2 6.4 8 8z",stroke:"currentColor",strokeWidth:"1.3"})}),Qe=({size:a,...s})=>e.jsx("svg",{...Q(a,s),children:e.jsx("path",{d:"M8.5 1.5L3 9h4l-.5 5.5L12 7H8l.5-5.5z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})}),As=({size:a,...s})=>e.jsxs("svg",{...Q(a,s),children:[e.jsx("circle",{cx:"6",cy:"5.5",r:"2.2",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M2 13c0-2.2 1.8-3.6 4-3.6s4 1.4 4 3.6",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),e.jsx("path",{d:"M10.5 3.6a2.2 2.2 0 010 4.1M11 9.6c1.7.3 3 1.6 3 3.4",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]}),Ms=({size:a,...s})=>e.jsxs("svg",{...Q(a,s),children:[e.jsx("path",{d:"M2.5 2.5v11h11",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M5 10l2.2-2.4 2 1.6L12.5 5.5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ts=({size:a,...s})=>e.jsxs("svg",{...Q(a,s),children:[e.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M2 8h12M8 2c1.8 1.6 2.8 3.8 2.8 6S9.8 12.4 8 14C6.2 12.4 5.2 10.2 5.2 8S6.2 3.6 8 2z",stroke:"currentColor",strokeWidth:"1.3"})]}),Bs=({size:a,...s})=>e.jsxs("svg",{...Q(a,s),children:[e.jsx("path",{d:"M2.5 11.5L9 5l2 2-6.5 6.5H2.5v-2z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),e.jsx("path",{d:"M9 5l1.8-1.8a1.4 1.4 0 012 2L11 7",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})]}),Ba=({size:a,...s})=>e.jsxs("svg",{...Q(a,s),children:[e.jsx("rect",{x:"1.8",y:"3.5",width:"12.4",height:"9",rx:"1.6",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M1.8 6.4h12.4",stroke:"currentColor",strokeWidth:"1.3"})]}),ar=({size:a,...s})=>e.jsx("svg",{...Q(a,s),children:e.jsx("path",{d:"M2 6l6-3.5L14 6v1H2V6zM3 7v5M6.3 7v5M9.7 7v5M13 7v5M2 12.5h12",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})}),sr=({size:a,...s})=>e.jsxs("svg",{...Q(a,s),children:[e.jsx("rect",{x:"3.5",y:"7",width:"9",height:"6.5",rx:"1.4",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M5.5 7V5.5a2.5 2.5 0 015 0V7",stroke:"currentColor",strokeWidth:"1.3"})]}),Ze=({size:a,...s})=>e.jsx("svg",{...Q(a,s),children:e.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Xe=({size:a,...s})=>e.jsx("svg",{...Q(a,s),children:e.jsx("path",{d:"M4 6.5L8 10.5l4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Ls=({size:a,...s})=>e.jsx("svg",{...Q(a,s),children:e.jsx("path",{d:"M10 3.5L5.5 8l4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),$e=({size:a,...s})=>e.jsx("svg",{...Q(a,s),children:e.jsx("path",{d:"M6 3.5L10.5 8L6 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Ps=({size:a,...s})=>e.jsx("svg",{...Q(a,s),children:e.jsx("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Es=({size:a,...s})=>e.jsx("svg",{...Q(a,s),children:e.jsx("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),nr=({size:a,...s})=>e.jsxs("svg",{...Q(a,s),children:[e.jsx("path",{d:"M8 2.2L14.5 13.2a.7.7 0 01-.6 1H2.1a.7.7 0 01-.6-1L8 2.2z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),e.jsx("path",{d:"M8 6.3v3.1",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("circle",{cx:"8",cy:"11.6",r:"0.85",fill:"currentColor"})]}),Je=({size:a,...s})=>e.jsx("svg",{...Q(a,s),children:e.jsx("path",{d:"M9 3.5h3.5V7M12 4L7 9M11 9.5v2a1 1 0 01-1 1H4.5a1 1 0 01-1-1V6a1 1 0 011-1h2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),La=({size:a,...s})=>e.jsx("svg",{...Q(a,s),children:e.jsx("path",{d:"M8 2.5v7M5 7l3 3 3-3M3 12.5h10",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),rr=({size:a,...s})=>e.jsxs("svg",{...Q(a,s),children:[e.jsx("path",{d:"M4 2h8v12l-1.5-1-1.5 1-1.5-1-1.5 1L4 14V2z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),e.jsx("path",{d:"M6.2 5.5h3.6M6.2 8h3.6",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]}),zs=({size:a,...s})=>e.jsxs("svg",{...Q(a,s),children:[e.jsx("rect",{x:"2.5",y:"3.5",width:"11",height:"10",rx:"1.5",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M2.5 6.5h11M5.5 2v2.5M10.5 2v2.5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]}),Re=({brand:a})=>{const s=a==="visa"?"VISA":a==="mastercard"?"MC":a==="amex"?"AMEX":a==="discover"?"DISC":a.slice(0,4).toUpperCase(),n=a==="visa"?"#1a1f71":a==="mastercard"?"#252525":a==="amex"?"#016fd0":"#5d5d5d";return e.jsx("span",{"aria-hidden":!0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:34,height:22,padding:"0 4px",borderRadius:4,background:n,color:"#fff",fontSize:9,fontWeight:700,letterSpacing:"0.04em"},children:s})};function Pa(a){const s=a.toLowerCase();return/seat|member|user|team|rbac|rout/.test(s)?As:/analytic|report|insight|dashboard/.test(s)?Ms:/whatsapp|channel|chat|message|conversation|webchat|voice/.test(s)?Ss:/storage|table|vector|file|gb|rows|db/.test(s)?He:/domain|help center|whitelabel|website|url|web/.test(s)?Ts:/brand|theme|custom|white-?label/.test(s)?Bs:/unlimited|infinit/.test(s)?xs:/security|sla|compliance|soc|audit/.test(s)||/support|sla|dedicated|priority/.test(s)?Ta:/integration|api|plugin|sdk|adk|studio/.test(s)?Is:/ai|agent|model|gpt|llm/.test(s)?Qe:Ma}const ye=({open:a,onOpenChange:s,size:n="md",children:r,className:t,showClose:o=!0,...l})=>{const i=w.useRef(null),c=on(),h=w.useCallback(()=>s(!1),[s]);return w.useEffect(()=>{var y;if(!a)return;const b=_=>{_.key==="Escape"&&h()};document.addEventListener("keydown",b);const p=document.body.style.overflow;return document.body.style.overflow="hidden",(y=i.current)==null||y.focus(),()=>{document.removeEventListener("keydown",b),document.body.style.overflow=p}},[a,h]),a?nn.createPortal(e.jsx("div",{className:"bpb-portal bpb-dialog__overlay","data-bpb-theme":c?"dark":"light",onClick:h,children:e.jsxs("div",{ref:i,role:"dialog","aria-modal":"true","aria-label":l["aria-label"],tabIndex:-1,className:T("bpb-dialog",`bpb-dialog--${n}`,t),onClick:b=>b.stopPropagation(),children:[o&&e.jsx("button",{type:"button",className:"bpb-dialog__close","aria-label":"Close",onClick:h,children:e.jsx(Ze,{size:18})}),r]})}),document.body):null},ea=({label:a,children:s})=>e.jsxs("span",{className:"bpb-tooltip",tabIndex:0,role:"note",children:[e.jsx("span",{className:"bpb-tooltip__term",children:a}),e.jsx("span",{className:"bpb-tooltip__bubble",role:"tooltip",children:s})]}),Pe=()=>{const{manageBillingUrl:a}=E();return e.jsxs("div",{className:"bpb-outdated",children:[e.jsx("h3",{className:"bpb-outdated__title",children:"Billing is managed in the Botpress Dashboard"}),e.jsx("p",{className:"bpb-outdated__text",children:"This workspace is on an earlier billing system, so plan changes and payment details can’t be managed here."}),a&&e.jsxs(ie,{variant:"primary",onClick:()=>window.open(a,"_blank","noopener"),children:["Open billing in Dashboard",e.jsx(Je,{size:15})]})]})},Ds=({options:a,value:s,onChange:n,className:r,...t})=>e.jsx("div",{role:"radiogroup","aria-label":t["aria-label"],className:T("bpb-segmented",r),children:a.map(o=>{const l=o.value===s;return e.jsxs("button",{type:"button",role:"radio","aria-checked":l,className:T("bpb-segmented__option",l&&"bpb-segmented__option--selected"),onClick:()=>n(o.value),children:[o.label,o.badge&&e.jsx("span",{className:"bpb-segmented__badge",children:o.badge})]},o.value)})}),q=({width:a,height:s=14,rounded:n=!1,className:r})=>e.jsx("span",{"aria-hidden":!0,className:T("bpb-skeleton",n&&"bpb-skeleton--rounded",r),style:{width:a??"100%",height:s}});function tr(a,s){const n=a.prices[s];return n||((s==="month"?a.prices.year:a.prices.month)??null)}function or(a,s){var t,o;const n=(t=a.prices.month)==null?void 0:t.amount;if(s==="month")return n??null;const r=((o=a.prices.year)==null?void 0:o.amount)??(n===void 0?void 0:n*12);return r===void 0?null:r/12}function lr(a){var n,r;let s=0;for(const t of a){const o=(n=t.prices.month)==null?void 0:n.amount,l=(r=t.prices.year)==null?void 0:r.amount;o&&l&&o>0&&(s=Math.max(s,1-l/(o*12)))}return Math.round(s*100)}const Us=({open:a,onOpenChange:s,onSelectPlan:n,recommendedPlanId:r="team",defaultInterval:t="year",excludePlanIds:o=[],planFeatures:l={},featureDescriptions:i})=>{var oe,U,J;const{isOutdatedBilling:c,toast:h,analytics:b}=E(),[p,y]=w.useState(t),{data:_,isLoading:C}=we(),{data:v}=De(),{data:m}=_e({enabled:a}),{data:S}=ma({enabled:a}),I=va(),L=(S==null?void 0:S.planReadonly)??!1,D=m==null?void 0:m.plan.current.interval,f=_==null?void 0:_.find(M=>M.id===(m==null?void 0:m.plan.current.planId)),A=m?f?ge(f):"community":void 0,P=((oe=m==null?void 0:m.plan.next)==null?void 0:oe.planId)??null,u=!!P&&P!==(m==null?void 0:m.plan.current.planId),B=L||A==="enterprise"||A==="managed",x=w.useMemo(()=>_?_.filter(M=>ge(M)!=="managed"&&ge(M)!=="enterprise"&&!o.includes(M.id)).sort((M,le)=>We.indexOf(ge(M))-We.indexOf(ge(le))):[],[_,o]),R=w.useMemo(()=>lr(x),[x]),X=((J=(U=_==null?void 0:_.find(M=>ge(M)==="enterprise"))==null?void 0:U.metadata)==null?void 0:J.contact_url)??fs,ue=M=>{I.mutate({planId:M.id,interval:p},{onSuccess:()=>{var le;(le=b.trackPlanDowngraded)==null||le.call(b,{plan_name:ee(M.name),interval:p,previous_plan_name:f?ee(f.name):void 0}),h({type:"success",message:"Plan downgraded"})},onError:()=>h({type:"error",message:"Downgrade failed"})})},pe=()=>{m&&I.mutate({planId:m.plan.current.planId,interval:m.plan.current.interval},{onSuccess:()=>{var M;(M=b.trackPlanDowngradeCancelled)==null||M.call(b,{plan_name:f?ee(f.name):m.plan.current.planId}),h({type:"success",message:"Scheduled downgrade canceled"})},onError:()=>h({type:"error",message:"Could not cancel the downgrade"})})};return c?e.jsx(ye,{open:a,onOpenChange:s,size:"md","aria-label":"Upgrade your plan",className:"bpb-scope",children:e.jsx(Pe,{})}):e.jsx(ye,{open:a,onOpenChange:s,size:"xl","aria-label":"Upgrade your plan",className:"bpb-scope",children:e.jsxs("div",{className:"bpb-upgrade",children:[e.jsx("h2",{className:"bpb-upgrade__title",children:"Upgrade your plan"}),e.jsx("div",{className:"bpb-upgrade__toggle",children:e.jsx(Ds,{"aria-label":"Billing interval",value:p,onChange:y,options:[{value:"month",label:"Monthly"},{value:"year",label:"Annual",badge:R>0?`Save ${R}%`:void 0}]})}),e.jsxs("div",{className:"bpb-upgrade__grid",children:[C&&[0,1,2].map(M=>e.jsxs("div",{className:"bpb-plan-card","aria-hidden":!0,children:[e.jsx(q,{width:120,height:22}),e.jsx(q,{width:90,height:40}),e.jsx(q,{width:"100%",height:36,rounded:!0}),e.jsx(q,{width:"100%",height:140})]},M)),x.map((M,le)=>{var be,K;const g=ge(M),W=tr(M,p),F=or(M,p),G=(((be=M.prices.month)==null?void 0:be.amount)??0)<=0,Y=g===A&&(A==="community"||p===D),V=g===A&&A!=="community"&&p!==D,H=!!P&&M.id===P&&!Y,ke=A!==void 0&&We.indexOf(g)<We.indexOf(A),he=(g===r||M.id===r)&&!Y,O=Y&&u?"cancel_downgrade":Y?"current":V?"switch_interval":H?"next":ke?"downgrade":"upgrade",de=le>0?x[le-1]:void 0,re=l[g]??Sa[g],fe=M.features.conversation_sessions,ce=xa(v,M,p),$=I.isPending&&(O==="downgrade"&&((K=I.variables)==null?void 0:K.planId)===M.id||O==="cancel_downgrade");return e.jsxs("div",{className:T("bpb-plan-card",he&&"bpb-plan-card--highlighted"),"data-plan-id":M.id,children:[e.jsxs("div",{className:"bpb-plan-card__header",children:[e.jsxs("h3",{className:"bpb-plan-card__name",children:[ee(M.name),he&&e.jsx(Aa,{className:"bpb-plan-card__badge",children:"Recommended"})]}),e.jsx("p",{className:"bpb-plan-card__tagline",children:M.description}),e.jsx("div",{className:"bpb-plan-card__price",children:F!==null&&W?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"bpb-plan-card__currency",children:ys(W.currency)}),e.jsx("span",{className:"bpb-plan-card__amount",children:Number.isInteger(F)?F:F.toFixed(2).replace(/\.00$/,"")}),e.jsxs("span",{className:"bpb-plan-card__per",children:["/ month (",W.currency.toUpperCase(),")"]})]}):e.jsx("span",{className:"bpb-plan-card__amount",children:j(0,"usd",0)})})]}),fe!==void 0&&e.jsxs("div",{className:"bpb-plan-card__allowance",children:[e.jsxs("div",{className:"bpb-plan-card__metric",children:[e.jsx("span",{className:"bpb-plan-card__metric-value",children:se(fe)}),e.jsxs("span",{className:"bpb-plan-card__metric-unit",children:["conversations",G?"":" / month"]})]}),ce?e.jsxs("p",{className:"bpb-plan-card__pack",children:["then ",j(ce.amount,ce.currency,0)," per"," ",se(ce.packSize)," more"]}):e.jsx("p",{className:"bpb-plan-card__pack",children:"No top-up"})]}),O==="current"&&e.jsx(ie,{variant:"outline",block:!0,disabled:!0,children:"Your current plan"}),O==="next"&&e.jsx(ie,{variant:"outline",block:!0,disabled:!0,children:"Next plan"}),O==="cancel_downgrade"&&e.jsx(ie,{variant:"primary",block:!0,loading:$,onClick:pe,children:"Cancel downgrade"}),O==="downgrade"&&e.jsx(ie,{variant:"outline",block:!0,disabled:B||I.isPending,loading:$,onClick:()=>ue(M),children:"Downgrade"}),O==="switch_interval"&&e.jsx(ie,{variant:"primary",block:!0,disabled:B||I.isPending,title:B?"Your plan is managed by Botpress — contact us to change it":void 0,onClick:()=>{var Z;(Z=b.trackPlanUpgradeInitiated)==null||Z.call(b,{plan_name:ee(M.name),interval:p,current_plan_name:f?ee(f.name):void 0}),n(M.id,p)},children:p==="year"?"Switch to annual":"Switch to monthly"}),O==="upgrade"&&e.jsx(ie,{variant:he?"accent":"primary",block:!0,disabled:B||I.isPending,title:B?"Your plan is managed by Botpress — contact us to change it":void 0,onClick:()=>{var Z;(Z=b.trackPlanUpgradeInitiated)==null||Z.call(b,{plan_name:ee(M.name),interval:p,current_plan_name:f?ee(f.name):void 0}),n(M.id,p)},children:"Upgrade"}),e.jsxs("ul",{className:"bpb-plan-card__features",children:[de&&e.jsxs("li",{className:"bpb-plan-card__features-lead",children:[e.jsx("span",{className:"bpb-plan-card__feature-chip bpb-plan-card__feature-chip--lead",children:e.jsx(Cs,{size:13})}),e.jsxs("span",{children:["Everything in ",ee(de.name)]})]}),re.map(Z=>{const Ne=Pa(Z),Ie=_s(Z,i);return e.jsxs("li",{children:[e.jsx("span",{className:"bpb-plan-card__feature-chip",children:e.jsx(Ne,{size:13})}),Ie?e.jsx(ea,{label:Z,children:Ie}):e.jsx("span",{children:Z})]},Z)})]})]},M.id)})]}),e.jsxs("p",{className:"bpb-upgrade__footer",children:["Need more, or running at scale?"," ",e.jsx("a",{href:X,target:"_blank",rel:"noopener noreferrer",children:"Contact us"})," ","about Enterprise. Compare plans at"," ",e.jsx("a",{href:"https://botpress.com/pricing",target:"_blank",rel:"noopener noreferrer",children:"botpress.com/pricing"}),"."]})]})})},Ea='-apple-system, "ui-sans-serif", "system-ui", "Segoe UI", Helvetica, Arial, sans-serif',za="14px",$s="10px";function Da(a){return a?{theme:"night",variables:{fontFamily:Ea,fontSizeBase:za,borderRadius:$s,colorPrimary:"#ececec",colorBackground:"#1c1c1c",colorText:"#f9f9f9",colorTextSecondary:"#b4b4b4",colorTextPlaceholder:"#9b9b9b",colorDanger:"#ff8583"},rules:{".Input":{backgroundColor:"#212121",border:"1px solid rgba(255,255,255,0.12)",boxShadow:"none",color:"#f9f9f9"},".Input:focus":{border:"1px solid rgba(255,255,255,0.3)",boxShadow:"none"},".Label":{color:"#ececec",fontWeight:"500",fontSize:"12px"},".Error":{color:"#ff8583"},".Tab":{border:"1px solid rgba(255,255,255,0.12)",boxShadow:"none"}}}:{theme:"stripe",variables:{fontFamily:Ea,fontSizeBase:za,borderRadius:$s,colorPrimary:"#0d0d0d",colorBackground:"#f7f7f7",colorText:"#0d0d0d",colorTextSecondary:"#5d5d5d",colorTextPlaceholder:"#8f8f8f",colorDanger:"#e02e2a"},rules:{".Input":{backgroundColor:"#f7f7f7",border:"1px solid transparent",boxShadow:"none",color:"#0d0d0d"},".Input:focus":{backgroundColor:"#fff",border:"1px solid #0d0d0d",boxShadow:"none"},".Label":{color:"#5d5d5d",fontWeight:"500",fontSize:"12px"},".Error":{color:"#e02e2a"},".Tab":{border:"1px solid #0d0d0d1a",boxShadow:"none",backgroundColor:"#f7f7f7"},".Tab--selected":{border:"1px solid #0d0d0d",backgroundColor:"#fff"},".Block":{backgroundColor:"#f9f9f9",boxShadow:"none"}}}}function Ua(a){return{base:{fontFamily:Ea,fontSize:za,color:a?"#f9f9f9":"#0d0d0d","::placeholder":{color:a?"#9b9b9b":"#8f8f8f"}},invalid:{color:a?"#ff8583":"#e02e2a"}}}const cr={pt:"pt-BR",es:"es-419"};function $a(a){const s=a.split("-")[0]??a;return cr[s]??a}const ir=4,dr=({plan:a,interval:s,preview:n,isLoadingPreview:r,isPreviewError:t,canSubscribe:o,isSubmitting:l,onSubscribe:i})=>{var R,X,ue,pe,oe;const{locale:c}=E(),{data:h}=De(),b=((R=a==null?void 0:a.prices.month)==null?void 0:R.currency)??((X=a==null?void 0:a.prices.year)==null?void 0:X.currency)??"usd",p=a==null?void 0:a.features.conversation_sessions,y=a?xa(h,a,s):null,_=(n==null?void 0:n.costs.immediate.amountDue)??0,C=(n==null?void 0:n.costs.immediate.accountBalance)??0,v=(n==null?void 0:n.costs.nextCycle.total)??0,m=n!=null&&n.nextBillingDate?Se(gs(n.nextBillingDate,1),c):null,S=a?Sa[ge(a)].slice(0,ir):[],I=a?((ue=a.prices[s])==null?void 0:ue.amount)??0:0,L=(n==null?void 0:n.costs.immediate.lineItems)??[],D=L.filter(U=>U.type==="discount"),f=L.filter(U=>U.type==="proration_credit"||U.type==="proration_charge").reduce((U,J)=>U+J.amount,0),A=!!(n!=null&&n.subscription.plan.effectiveDate),P=((pe=a==null?void 0:a.prices.month)==null?void 0:pe.amount)??0,u=((oe=a==null?void 0:a.prices.year)==null?void 0:oe.amount)??0,B=s==="year"&&P>0&&u>0?Math.round(P*12-u):0,x=Math.round(B/12);return e.jsxs("div",{className:"bpb-summary-wrap",children:[e.jsxs("div",{className:"bpb-summary",children:[e.jsx("h3",{className:"bpb-summary__title",children:a?`${ee(a.name)} plan`:e.jsx(q,{width:140,height:24})}),p!==void 0&&e.jsxs("div",{className:"bpb-summary__metric",children:[e.jsx("span",{className:"bpb-summary__metric-value",children:se(p)}),e.jsx("span",{className:"bpb-summary__metric-unit",children:"conversations / month"}),y&&e.jsxs("span",{className:"bpb-summary__metric-pack",children:["then ",j(y.amount,y.currency,0)," per ",se(y.packSize)]})]}),S.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"bpb-summary__features-label",children:"Top features"}),e.jsx("ul",{className:"bpb-summary__features",children:S.map(U=>{const J=Pa(U);return e.jsxs("li",{children:[e.jsx(J,{size:16,className:"bpb-summary__feature-icon"}),e.jsx("span",{children:U})]},U)})})]}),e.jsx("hr",{className:"bpb-summary__divider"}),r&&e.jsxs("div",{className:"bpb-summary__lines","aria-busy":"true",children:[e.jsx(q,{height:16}),e.jsx(q,{height:16}),e.jsx(q,{height:20})]}),t&&e.jsx("p",{role:"alert",className:"bpb-summary__error",children:"We couldn’t compute your total. Try again in a moment."}),n&&!r&&A&&e.jsxs("div",{className:"bpb-summary__lines",children:[e.jsxs("div",{className:"bpb-summary__line",children:[e.jsxs("span",{className:"bpb-summary__line-label",children:[a?ee(a.name):""," plan",m?` — from ${m}`:""]}),e.jsxs("span",{className:"bpb-summary__line-amount",children:[j(v,b),s==="year"?"/yr":"/mo"]})]}),e.jsxs("div",{className:"bpb-summary__line",children:[e.jsx("span",{className:"bpb-summary__line-label",children:e.jsx(ea,{label:"Prorated for today",children:"Switching mid-period, we charge only for the time left in your current billing period. The full plan price above is billed at your next renewal, not today."})}),e.jsx("span",{className:"bpb-summary__line-amount",children:j(_,b)})]}),e.jsxs("div",{className:"bpb-summary__line bpb-summary__line--total",children:[e.jsx("span",{children:"Due today"}),e.jsx("span",{children:j(_,b)})]}),f<0&&e.jsxs("p",{className:"bpb-summary__addon-note",children:["You have ",j(Math.abs(f),b)," of unused time credited toward your next invoice."]})]}),n&&!r&&!A&&e.jsxs("div",{className:"bpb-summary__lines",children:[e.jsxs("div",{className:"bpb-summary__line",children:[e.jsxs("span",{className:"bpb-summary__line-label",children:[a?ee(a.name):""," plan (",s==="year"?"annual":"monthly",")"]}),e.jsxs("span",{className:"bpb-summary__line-amount",children:[j(I,b),s==="year"?"/yr":"/mo"]})]}),D.map((U,J)=>e.jsxs("div",{className:"bpb-summary__line",children:[e.jsx("span",{className:"bpb-summary__line-label",children:U.description}),e.jsx("span",{className:"bpb-summary__line-amount",children:j(U.amount,b)})]},`${U.id}-${J}`)),f!==0&&e.jsxs("div",{className:"bpb-summary__line",children:[e.jsx("span",{className:"bpb-summary__line-label",children:e.jsx(ea,{label:f<0?"Credit for unused time":"Adjustment for unused time",children:f<0?"You already paid for time left in your current billing period. We credit that unused time and re-apply it at your new rate, so you’re never double-charged.":"Switching mid-cycle means we prorate the difference between your old and new plan for the days remaining in your current billing period."})}),e.jsx("span",{className:"bpb-summary__line-amount",children:j(f,b)})]}),C!==0&&e.jsxs("div",{className:"bpb-summary__line",children:[e.jsx("span",{className:"bpb-summary__line-label",children:"Account credit"}),e.jsx("span",{className:"bpb-summary__line-amount",children:j(C,b)})]}),e.jsxs("div",{className:"bpb-summary__line bpb-summary__line--total",children:[e.jsx("span",{children:"Due today"}),e.jsx("span",{children:j(_,b)})]}),f<0&&_===0&&e.jsxs("p",{className:"bpb-summary__addon-note",children:["Your remaining balance of ",j(Math.abs(f),b)," is applied as credit on your next invoice."]})]}),B>0&&e.jsxs("div",{className:"bpb-summary__savings",children:[e.jsx(Ma,{size:18,className:"bpb-summary__savings-icon"}),e.jsxs("span",{children:["You’re saving ",j(x,b,0),"/month by choosing an annual plan. That’s"," ",j(B,b,0),"/year."]})]}),e.jsx(ie,{variant:"primary",size:"lg",block:!0,className:"bpb-summary__cta",disabled:!o,loading:l,onClick:i,children:t?"Preview unavailable":"Subscribe"})]}),e.jsxs("p",{className:"bpb-summary__fineprint",children:["Renews ",s==="month"?"monthly":"annually"," until cancelled.",n&&` You’ll be charged ${j(v,b)}${s==="month"?"/month":"/year"}${m?` starting ${m}`:""}.`," ","Cancel anytime in Settings. By subscribing, you authorize Botpress to store and charge your payment method."]})]})},br=["AT","BE","BG","HR","CY","CZ","DK","EE","FI","FR","DE","GR","HU","IE","IT","LV","LT","LU","MT","NL","PL","PT","RO","SK","SI","ES","SE"],pr={CA:[{type:"ca_bn",label:"CA BN",description:"Canadian BN"},{type:"ca_gst_hst",label:"CA GST/HST",description:"Canadian GST/HST number"},{type:"ca_qst",label:"CA QST",description:"Canadian QST number (Québec)"},{type:"ca_pst_bc",label:"CA PST-BC",description:"Canadian PST number (British Columbia)"},{type:"ca_pst_mb",label:"CA PST-MB",description:"Canadian PST number (Manitoba)"},{type:"ca_pst_sk",label:"CA PST-SK",description:"Canadian PST number (Saskatchewan)"}],US:[{type:"us_ein",label:"US EIN",description:"United States EIN"}],GB:[{type:"gb_vat",label:"GB VAT",description:"United Kingdom VAT number"}],AU:[{type:"au_abn",label:"AU ABN",description:"Australian Business Number"}],NZ:[{type:"nz_gst",label:"NZ GST",description:"New Zealand GST number"}],IN:[{type:"in_gst",label:"IN GST",description:"Indian GST number"}],JP:[{type:"jp_cn",label:"JP CN",description:"Japanese Corporate Number"}],BR:[{type:"br_cnpj",label:"BR CNPJ",description:"Brazilian CNPJ number"},{type:"br_cpf",label:"BR CPF",description:"Brazilian CPF number"}],MX:[{type:"mx_rfc",label:"MX RFC",description:"Mexican RFC number"}],CH:[{type:"ch_vat",label:"CH VAT",description:"Switzerland VAT number"}],AE:[{type:"ae_trn",label:"AE TRN",description:"United Arab Emirates TRN"}],SG:[{type:"sg_gst",label:"SG GST",description:"Singaporean GST number"},{type:"sg_uen",label:"SG UEN",description:"Singaporean UEN"}],ZA:[{type:"za_vat",label:"ZA VAT",description:"South African VAT number"}]},ur=[{type:"eu_vat",label:"EU VAT",description:"European VAT number"}];function Fs(a){if(!a)return[];const s=a.toUpperCase();return br.includes(s)?ur:pr[s]??[]}const aa=({label:a,className:s,id:n,...r})=>a?e.jsxs("label",{className:T("bpb-input",s),children:[e.jsx("span",{className:"bpb-input__label",children:a}),e.jsx("input",{className:"bpb-input__field bpb-input__field--labeled",id:n,...r})]}):e.jsx("input",{className:T("bpb-input__field",s),id:n,...r}),Fa=({label:a,className:s,children:n,...r})=>e.jsxs("label",{className:T("bpb-input",s),children:[a&&e.jsx("span",{className:"bpb-input__label",children:a}),e.jsxs("span",{className:"bpb-input__select-wrap",children:[e.jsx("select",{className:T("bpb-input__field bpb-input__field--select",a&&"bpb-input__field--labeled"),...r,children:n}),e.jsx(Xe,{size:16,className:"bpb-input__chevron"})]})]}),hr=({plan:a,interval:s,onChange:n})=>{const r=a.prices.month,t=a.prices.year,o=r&&t&&r.amount>0?Math.round((1-t.amount/(r.amount*12))*100):0;return e.jsxs("section",{className:"bpb-checkout__section",children:[e.jsx("h3",{className:"bpb-checkout__section-title",children:"Plan details"}),e.jsxs("div",{className:"bpb-interval-cards",role:"radiogroup","aria-label":"Billing interval",children:[r&&e.jsxs("button",{type:"button",role:"radio","aria-checked":s==="month",className:T("bpb-interval-card",s==="month"&&"bpb-interval-card--selected"),onClick:()=>n("month"),children:[e.jsx("span",{className:"bpb-interval-card__title",children:"Monthly billing"}),e.jsxs("span",{className:"bpb-interval-card__price",children:[j(r.amount,r.currency,0)," /mo"]})]}),t&&e.jsxs("button",{type:"button",role:"radio","aria-checked":s==="year",className:T("bpb-interval-card",s==="year"&&"bpb-interval-card--selected"),onClick:()=>n("year"),children:[e.jsxs("span",{className:"bpb-interval-card__title",children:["Annual billing",o>0&&e.jsxs(Aa,{children:["Save ",o,"%"]})]}),e.jsxs("span",{className:"bpb-interval-card__price",children:[j(t.amount/12,t.currency,0)," /mo"]})]})]})]})},Oa=({number:a,title:s,onEdit:n})=>e.jsxs("div",{className:"bpb-step__header",children:[n?e.jsxs("button",{type:"button",className:"bpb-step__title bpb-step__title--button",onClick:n,children:[a,". ",s]}):e.jsxs("h3",{className:"bpb-step__title",children:[a,". ",s]}),n&&e.jsx("button",{type:"button",className:"bpb-step__edit",onClick:n,children:"Edit"})]}),mr=({stepNumber:a,collapsed:s,summary:n,savedCard:r,isDark:t,tab:o,onTabChange:l,onPaymentChange:i,canContinue:c,onContinue:h,onEdit:b})=>{const[p,y]=w.useState(!1),_=o==="new"||!r;return e.jsxs("section",{className:T("bpb-step",s&&"bpb-step--collapsed"),children:[e.jsx(Oa,{number:a,title:"Payment method",onEdit:s?b:void 0}),s?r&&o!=="new"?e.jsxs("div",{className:"bpb-saved-card bpb-saved-card--readonly",children:[e.jsx(Re,{brand:r.brand}),e.jsxs("span",{className:"bpb-saved-card__number",children:[e.jsx("span",{className:"bpb-saved-card__brand",children:r.brand})," •••• ",r.lastFour]}),e.jsxs("span",{className:"bpb-saved-card__exp",children:[String(r.expMonth).padStart(2,"0"),"/",String(r.expYear).slice(-2)]})]}):e.jsx("p",{className:"bpb-step__summary",children:n}):e.jsxs(e.Fragment,{children:[r&&e.jsxs("div",{className:"bpb-pay-tabs",role:"tablist","aria-label":"Payment method",children:[e.jsxs("button",{type:"button",role:"tab","aria-selected":o==="saved",className:T("bpb-pay-tab",o==="saved"&&"bpb-pay-tab--selected"),onClick:()=>l("saved"),children:[e.jsx(Ba,{size:16}),"Saved"]}),e.jsxs("button",{type:"button",role:"tab","aria-selected":o==="new",className:T("bpb-pay-tab",o==="new"&&"bpb-pay-tab--selected"),onClick:()=>l("new"),children:[e.jsx(Ba,{size:16}),"New card"]})]}),r&&o==="saved"&&e.jsxs("div",{className:"bpb-saved-card",children:[e.jsx(Re,{brand:r.brand}),e.jsxs("span",{className:"bpb-saved-card__number",children:[e.jsx("span",{className:"bpb-saved-card__brand",children:r.brand})," •••• ",r.lastFour]}),e.jsxs("span",{className:"bpb-saved-card__exp",children:[String(r.expMonth).padStart(2,"0"),"/",String(r.expYear).slice(-2)]})]})]}),_&&e.jsxs("div",{className:T("bpb-payment-element",s&&"bpb-payment-element--hidden"),children:[!p&&!s&&e.jsx("div",{className:"bpb-payment-element__skeleton",children:e.jsx(q,{height:48})}),e.jsx("div",{className:T("bpb-card-element",!p&&"bpb-payment-element--hidden"),children:e.jsx(me.CardElement,{options:{style:Ua(t),hidePostalCode:!0},onReady:()=>y(!0),onChange:C=>i(C.complete)})})]}),!s&&e.jsx(ie,{variant:"primary",block:!0,disabled:!c,onClick:h,children:"Next"})]})},gr=({stepNumber:a,collapsed:s,summary:n,onEditStep:r,existingAddress:t,customerName:o,isLoading:l,editing:i,onEdit:c,onCancelEdit:h,onCompleteChange:b,onCountryChange:p,country:y,isBusiness:_,onIsBusinessChange:C,businessName:v,onBusinessNameChange:m,taxType:S,onTaxTypeChange:I,taxValue:L,onTaxValueChange:D})=>{const[f,A]=w.useState(!1),P=i||!t,u=Fs(y),B=u.find(x=>x.type===S);return s?e.jsxs("section",{className:"bpb-step bpb-step--collapsed",children:[e.jsx(Oa,{number:a,title:"Billing address",onEdit:r}),t?e.jsx("div",{className:"bpb-address-card bpb-address-card--readonly",children:e.jsxs("div",{className:"bpb-address-card__lines",children:[o&&e.jsx("span",{className:"bpb-address-card__name",children:o}),e.jsxs("span",{children:[t.lineOne,t.lineTwo?`, ${t.lineTwo}`:""]}),e.jsx("span",{children:[t.city,t.state,t.postalCode,t.country].filter(Boolean).join(", ")})]})}):e.jsx("p",{className:"bpb-step__summary",children:n})]}):e.jsxs("section",{className:"bpb-step",children:[e.jsx(Oa,{number:a,title:"Billing address"}),l?e.jsx(q,{height:72}):P?e.jsxs("div",{className:"bpb-payment-element",children:[!f&&e.jsxs("div",{className:"bpb-payment-element__skeleton",children:[e.jsx(q,{height:48}),e.jsx(q,{height:48})]}),e.jsx("div",{className:T(!f&&"bpb-payment-element--hidden"),children:e.jsx(me.AddressElement,{options:{mode:"billing",display:{name:"full"},defaultValues:t?{name:o??void 0,address:{line1:t.lineOne,line2:t.lineTwo,city:t.city,state:t.state,postal_code:t.postalCode,country:t.country}}:void 0},onReady:()=>A(!0),onChange:x=>{b(x.complete),p(x.value.address.country||void 0)}})}),h&&i&&e.jsx("button",{type:"button",className:"bpb-address-cancel",onClick:h,children:"Cancel"})]}):e.jsxs("div",{className:"bpb-address-card",children:[e.jsxs("div",{className:"bpb-address-card__lines",children:[o&&e.jsx("span",{className:"bpb-address-card__name",children:o}),e.jsxs("span",{children:[t.lineOne,t.lineTwo?`, ${t.lineTwo}`:""]}),e.jsxs("span",{children:[t.city," ",t.state??""," ",t.postalCode," ",t.country]})]}),e.jsx("button",{type:"button",className:"bpb-link-button",onClick:c,children:"Update"})]}),e.jsxs("label",{className:"bpb-checkbox",children:[e.jsx("input",{type:"checkbox",checked:_,onChange:x=>{C(x.target.checked),x.target.checked&&!S&&u[0]&&I(u[0].type)}}),e.jsx("span",{children:"I’m purchasing as business"})]}),_&&e.jsxs("div",{className:"bpb-business-fields",children:[e.jsx("h4",{className:"bpb-step__subtitle",children:"Business details"}),e.jsx(aa,{placeholder:"Business name",value:v,onChange:x=>m(x.target.value),autoComplete:"organization"}),u.length>0?e.jsxs(e.Fragment,{children:[e.jsx(Fa,{"aria-label":"Tax ID type",value:S,onChange:x=>I(x.target.value),children:u.map(x=>e.jsxs("option",{value:x.type,children:[x.label," — ",x.description]},x.type))}),e.jsx(aa,{placeholder:B?B.description:"Tax ID number",value:L,onChange:x=>D(x.target.value),inputMode:"text"})]}):e.jsx("p",{className:"bpb-business-fields__note",children:y?"No tax ID is required for your billing country.":"Select your billing country above to add a tax ID."})]})]})},yr=({planId:a,initialInterval:s,clientSecret:n,onSuccess:r})=>{var Ys;const t=me.useStripe(),o=me.useElements(),{email:l,toast:i,analytics:c,isDark:h}=E(),[b,p]=w.useState(s),[y,_]=w.useState("payment"),[C,v]=w.useState(!1),[m,S]=w.useState(null),[I,L]=w.useState(!1),[D,f]=w.useState(!1),[A,P]=w.useState(!1),[u,B]=w.useState(void 0),[x,R]=w.useState(!1),[X,ue]=w.useState(""),[pe,oe]=w.useState(""),[U,J]=w.useState(""),[M,le]=w.useState(!1),[g,W]=w.useState(null),{data:F}=we(),{data:G}=_e(),{data:Y,isLoading:V}=pa(),{data:H,isLoading:ke}=ua(),{data:he}=ha(),O=F==null?void 0:F.find(ca=>ca.id===a),de=((Ys=Y==null?void 0:Y.paymentMethod)==null?void 0:Ys.card)??null,re=(H==null?void 0:H.address)??null;w.useEffect(()=>{m===null&&!V&&Y!==void 0&&S(de?"saved":"new")},[m,V,Y,de]),w.useEffect(()=>{u===void 0&&re&&B(re.country)},[u,re]);const fe=w.useMemo(()=>({plan:{planId:a,interval:b}}),[a,b]),ce=ba(fe),$=ya(),be=fa(),K=_a(),Z=va(),Ne=O?ee(O.name):"",Ie=m==="new"||!de,oa=D||!re,la=Ie?I:!!de,Ee=oa?A:!0,Ks=()=>{la&&(v(!0),_("address"))},Ur=y==="address"&&!!t&&!!o&&!!O&&!ce.isError&&!!ce.data&&la&&Ee&&!M,$r=de?`${de.brand.charAt(0).toUpperCase()}${de.brand.slice(1)} •••• ${de.lastFour}`:null,Fr=Ie?"New card":$r??"Saved card",Or=re?`${re.city}${re.state?`, ${re.state}`:""} ${re.country}`:"Not set",qr=async()=>{var ca,Hs,Qs,Zs,Xs,Js;if(!(!t||!o||!O)){le(!0),W(null);try{if((ca=c.trackPaymentDetailsConfirmed)==null||ca.call(c,{plan_name:Ne,interval:b}),Ie){const ze=o.getElement(me.CardElement);if(!ze){W("Card field is not ready");return}const{error:ia,setupIntent:xe}=await t.confirmCardSetup(n,{payment_method:{card:ze}});if(ia){W(ia.message??"Payment setup failed");return}if(!(xe!=null&&xe.payment_method)||typeof xe.payment_method!="string"){W("Could not retrieve payment method");return}await $.mutateAsync({paymentMethodId:xe.payment_method})}let Rs;if(oa){const ze=o.getElement("address");if(ze){const{complete:ia,value:xe}=await ze.getValue();if(!ia||!xe.address){W("Please complete your billing address");return}const{address:Oe}=xe;Rs=((Hs=xe.name)==null?void 0:Hs.trim())||void 0,await be.mutateAsync({lineOne:Oe.line1??"",lineTwo:Oe.line2??void 0,city:Oe.city??"",state:Oe.state??void 0,postalCode:Oe.postal_code??"",country:Oe.country??""})}}const en=x&&X.trim()||Rs||void 0,an=x&&pe&&U.trim()?[{type:pe,value:U.trim()}]:void 0;(en!==void 0||an!==void 0)&&await K.mutateAsync({name:en,taxIds:an});const Wr=((Qs=ce.data)==null?void 0:Qs.costs.immediate.amountDue)??0,Gr=((Zs=ce.data)==null?void 0:Zs.costs.nextCycle.total)??0;await Z.mutateAsync({planId:a,interval:b}),(Js=c.trackPlanUpgraded)==null||Js.call(c,{plan_name:Ne,interval:b,amount_paid:Wr,next_cycle_amount:Gr,previous_plan_name:(Xs=F==null?void 0:F.find(ze=>ze.id===(G==null?void 0:G.plan.current.planId)))==null?void 0:Xs.name.replace("Plan - ",""),previous_interval:G==null?void 0:G.plan.current.interval}),i({type:"success",message:"Subscription activated"}),r()}catch{W("Something went wrong while processing your payment. You have not been charged twice."),i({type:"error",message:"Payment error"})}finally{le(!1)}}};return e.jsxs("div",{className:"bpb-checkout__columns",children:[e.jsxs("div",{className:"bpb-checkout__main",children:[O&&e.jsx(hr,{plan:O,interval:b,onChange:p}),l&&e.jsxs("section",{className:"bpb-checkout__section",children:[e.jsx("h3",{className:"bpb-checkout__section-title",children:"Contact information"}),e.jsxs("div",{className:"bpb-checkout__static-field",children:[e.jsx("span",{className:"bpb-checkout__static-label",children:"Email"}),e.jsx("span",{children:l})]})]}),e.jsx(mr,{stepNumber:1,collapsed:y!=="payment",summary:Fr,savedCard:de,isDark:h,tab:m??"new",onTabChange:S,onPaymentChange:L,canContinue:la,onContinue:Ks,onEdit:()=>_("payment")}),C&&e.jsx(gr,{stepNumber:2,collapsed:y!=="address",summary:Or,onEditStep:Ks,existingAddress:re,customerName:(he==null?void 0:he.name)??null,isLoading:ke,editing:D,onEdit:()=>f(!0),onCancelEdit:re?()=>f(!1):void 0,onCompleteChange:P,onCountryChange:B,country:u,isBusiness:x,onIsBusinessChange:R,businessName:X,onBusinessNameChange:ue,taxType:pe,onTaxTypeChange:oe,taxValue:U,onTaxValueChange:J}),g&&e.jsx("p",{role:"alert",className:"bpb-checkout__submit-error",children:g})]}),e.jsx("div",{className:"bpb-checkout__aside",children:e.jsx(dr,{plan:O,interval:b,preview:ce.data,isLoadingPreview:ce.isLoading,isPreviewError:ce.isError,canSubscribe:Ur,isSubmitting:M,onSubscribe:()=>void qr()})})]})},Os=({open:a,onOpenChange:s,planId:n,interval:r,onBack:t,onSuccess:o})=>{var v;const{stripePromise:l,isDark:i,locale:c,isOutdatedBilling:h}=E(),b=ga(),p=(v=b.data)==null?void 0:v.clientSecret,{mutate:y,reset:_}=b;w.useEffect(()=>{a&&!h?y():_()},[a,h,y,_]);const C=w.useMemo(()=>p?{clientSecret:p,appearance:Da(i),locale:$a(c)}:null,[p,i,c]);return h?e.jsx(ye,{open:a,onOpenChange:s,size:"md","aria-label":"Configure your plan",className:"bpb-scope",children:e.jsx(Pe,{})}):e.jsx(ye,{open:a,onOpenChange:s,size:"xl","aria-label":"Configure your plan",className:"bpb-scope",children:e.jsxs("div",{className:"bpb-checkout",children:[e.jsxs("header",{className:"bpb-checkout__header",children:[t&&e.jsx("button",{type:"button",className:"bpb-checkout__back","aria-label":"Back to plans",onClick:t,children:"‹"}),e.jsx("h2",{className:"bpb-checkout__title",children:"Configure your plan"})]}),b.isError?e.jsxs("div",{className:"bpb-checkout__error-state",children:[e.jsx("p",{children:"We couldn’t start the payment session."}),b.error instanceof Error&&b.error.message&&e.jsx("p",{className:"bpb-checkout__error-detail",children:b.error.message}),e.jsx("p",{className:"bpb-checkout__error-detail",children:"If this persists, the workspace may not exist in this environment or may not be on billing v4."}),e.jsx(ie,{variant:"outline",onClick:()=>y(),children:"Try again"})]}):!C||!p?e.jsxs("div",{className:"bpb-checkout__columns","aria-busy":"true",children:[e.jsxs("div",{className:"bpb-checkout__main",children:[e.jsx(q,{height:56}),e.jsx(q,{height:56}),e.jsx(q,{height:120}),e.jsx(q,{height:56})]}),e.jsx("div",{className:"bpb-checkout__aside",children:e.jsx(q,{height:320})})]}):e.jsx(me.Elements,{stripe:l,options:C,children:e.jsx(yr,{planId:n,initialInterval:r,clientSecret:p,onSuccess:()=>{s(!1),o==null||o()}})})]})})},qs=({value:a,onChange:s,min:n=0,max:r,step:t=1,className:o,...l})=>{const i=()=>s(Math.max(n,a-t)),c=()=>s(r===void 0?a+t:Math.min(r,a+t));return e.jsxs("div",{className:T("bpb-stepper",o),children:[e.jsx("button",{type:"button",className:"bpb-stepper__btn","aria-label":`Decrease ${l["aria-label"]}`,onClick:i,disabled:a<=n,children:e.jsx(Ps,{size:14})}),e.jsx("span",{className:"bpb-stepper__value","aria-label":l["aria-label"],children:a}),e.jsx("button",{type:"button",className:"bpb-stepper__btn","aria-label":`Increase ${l["aria-label"]}`,onClick:c,disabled:r!==void 0&&a>=r,children:e.jsx(Es,{size:14})})]})},fr=({open:a,onOpenChange:s,onSuccess:n})=>{const{isOutdatedBilling:r}=E();return r?e.jsx(ye,{open:a,onOpenChange:s,size:"md","aria-label":"Manage add-ons",className:"bpb-scope",children:e.jsx(Pe,{})}):e.jsx(ye,{open:a,onOpenChange:s,size:"md","aria-label":"Manage add-ons",className:"bpb-scope",children:e.jsx(_r,{onOpenChange:s,onSuccess:n})})},_r=({onOpenChange:a,onSuccess:s})=>{var U,J,M,le;const{toast:n,locale:r}=E(),{data:t}=_e(),{data:o}=De(),{data:l}=we(),{data:i}=ma(),c=Ha(),[h,b]=w.useState(null),p=l==null?void 0:l.find(g=>g.id===(t==null?void 0:t.plan.current.planId)),y=(t==null?void 0:t.plan.current.interval)??"month",_=(i==null?void 0:i.addonsReadonly)??!1,C=t!=null&&t.plan.current.periodEnd?Se(t.plan.current.periodEnd,r):null,v=w.useMemo(()=>{var W;if(!t||!o)return null;const g={};for(const F of o){const G=t.addons[F.id];g[F.id]=((W=G==null?void 0:G.next)==null?void 0:W.quantity)??(G==null?void 0:G.current.quantity)??0}return g},[t,o]),m=h??v,S=w.useMemo(()=>!o||!p?[]:o.flatMap(g=>{const W=Ye(g,p,y);return W?[{addon:g,price:W}]:[]}),[o,p,y]),I=!!m&&!!v&&Object.keys(m).some(g=>m[g]!==v[g]),L=S.reduce((g,{addon:W,price:F})=>g+((m==null?void 0:m[W.id])??0)*F.amount,0),D=w.useMemo(()=>p&&m?{plan:{planId:p.id,interval:y},addons:m}:null,[p,y,m]),f=ba(D??{plan:{planId:"",interval:y}},{enabled:!!D&&I}),A=((U=p==null?void 0:p.prices[y])==null?void 0:U.currency)??"usd",P=((J=f.data)==null?void 0:J.costs.immediate.amountDue)??0,u=(M=f.data)!=null&&M.nextBillingDate?Se(f.data.nextBillingDate,r):null,B=((le=p==null?void 0:p.prices[y])==null?void 0:le.amount)??0,x=B+L,R=p&&m?Ns(p,o,m):[],X=(g,W)=>W==="bytes"?Le(g):se(g),ue=(g,W)=>{const F=o==null?void 0:o.find(H=>H.id===g),G=F==null?void 0:F.increments;if(!G||W<=0)return null;const Y=G.conversation_sessions??0;if(Y>0)return`${se(Y*W)} convos`;const V=G.file_storage??0;return V>0?Le(V*W):null},pe=()=>{m&&c.mutate({addons:m},{onSuccess:()=>{n({type:"success",message:"Subscription updated"}),a(!1),s==null||s()},onError:()=>n({type:"error",message:"Could not update your add-ons"})})},oe=!t||!o||!l;return e.jsxs("div",{className:"bpb-manage-addons",children:[e.jsx("h2",{className:"bpb-manage-addons__title",children:"Manage add-ons"}),e.jsx("p",{className:"bpb-manage-addons__subtitle",children:p?`Additional usage for your ${ee(p.name)} plan. Set a quantity to 0 to remove an add-on.`:"Additional usage for your plan. Set a quantity to 0 to remove an add-on."}),oe?e.jsxs("div",{className:"bpb-manage-addons__loading","aria-busy":"true",children:[e.jsx(q,{height:56}),e.jsx(q,{height:56})]}):S.length===0?e.jsxs("p",{className:"bpb-manage-addons__empty",children:["Add-ons aren’t available on the ",p?ee(p.name):"current"," plan. Upgrade to a paid plan to add extra usage."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bpb-addons",children:S.map(({addon:g,price:W})=>{var V;const F=((V=t==null?void 0:t.addons[g.id])==null?void 0:V.current.quantity)??0,G=(m==null?void 0:m[g.id])??0,Y=G!==F?G===0?`${F} active now · removed${C?` ${C}`:" next cycle"}`:`${F} active now · ${G}${C?` from ${C}`:" next cycle"}`:F>0?`${F} active`:null;return e.jsxs("div",{className:"bpb-addon-row",children:[e.jsxs("div",{className:"bpb-addon-row__info",children:[e.jsx("span",{className:"bpb-addon-row__name",children:Ge(g.name)}),e.jsx("span",{className:"bpb-addon-row__description",children:g.description}),e.jsxs("span",{className:"bpb-addon-row__price",children:[j(W.amount,W.currency)," each"]}),Y&&e.jsx("span",{className:T("bpb-addon-row__status",G!==F&&"bpb-addon-row__status--changed"),children:Y})]}),e.jsxs("div",{className:"bpb-addon-row__control",children:[ue(g.id,G)&&e.jsx("span",{className:"bpb-addon-row__grant",children:ue(g.id,G)}),e.jsx(qs,{"aria-label":`${Ge(g.name)} quantity`,value:G,onChange:H=>b({...m??{},[g.id]:H})})]})]},g.id)})}),R.length>0&&e.jsxs("div",{className:"bpb-manage-addons__limits",children:[e.jsx("p",{className:"bpb-manage-addons__limits-title",children:"Your new limits"}),R.map(g=>e.jsxs("div",{className:"bpb-manage-addons__limit-row",children:[e.jsx("span",{className:"bpb-manage-addons__limit-label",children:g.label}),e.jsxs("span",{className:"bpb-manage-addons__limit-values",children:[e.jsx("span",{className:"bpb-manage-addons__limit-now",children:X(g.now,g.unit)}),e.jsx("span",{className:"bpb-manage-addons__limit-arrow","aria-hidden":!0,children:"→"}),e.jsx("span",{className:"bpb-manage-addons__limit-next",children:X(g.next,g.unit)})]})]},g.key))]}),e.jsxs("div",{className:"bpb-manage-addons__totals",children:[e.jsxs("div",{className:"bpb-manage-addons__line",children:[e.jsx("span",{children:p?`${ee(p.name)} plan`:"Plan"}),e.jsx("span",{children:j(B,A)})]}),S.map(({addon:g,price:W})=>{const F=(m==null?void 0:m[g.id])??0;return F<=0?null:e.jsxs("div",{className:"bpb-manage-addons__line",children:[e.jsxs("span",{children:[F,"× ",Ge(g.name)]}),e.jsx("span",{children:j(W.amount*F,A)})]},g.id)}),e.jsxs("div",{className:"bpb-manage-addons__line bpb-manage-addons__line--total",children:[e.jsxs("span",{children:["Total ",y==="year"?"yearly":"monthly"," cost"]}),e.jsxs("span",{children:[j(x,A),y==="year"?"/yr":"/mo"]})]}),I&&e.jsxs("div",{className:"bpb-manage-addons__line bpb-manage-addons__line--due",children:[e.jsx("span",{children:"Due today"}),e.jsx("span",{children:f.isLoading?"…":f.isError?"—":j(Math.max(P,0),A)})]})]}),I&&!f.isError&&e.jsxs("p",{className:"bpb-manage-addons__note",children:[P>0?`You’ll be charged ${j(P,A)} now for the rest of this billing period. `:"No charge today — the change is prorated. ","Add-ons stay active until you remove them and renew with your plan",u?` on ${u}`:"",", when you’ll be billed ",j(L,A),y==="year"?"/yr":"/mo"," for them."]}),_&&e.jsx("p",{className:"bpb-manage-addons__note",role:"alert",children:"Add-ons for this workspace are managed by Botpress — contact us to change them."}),e.jsxs("div",{className:"bpb-manage-addons__actions",children:[e.jsx(ie,{variant:"outline",onClick:()=>a(!1),disabled:c.isPending,children:"Cancel"}),e.jsx(ie,{variant:"primary",disabled:!I||_,loading:c.isPending,onClick:pe,children:"Update subscription"})]})]})]})},vr={paid:"Paid",open:"Due",draft:"Draft",uncollectible:"Unpaid",void:"Void"},kr=({open:a,onOpenChange:s})=>{const{isOutdatedBilling:n}=E();return n?e.jsx(ye,{open:a,onOpenChange:s,size:"md","aria-label":"Billing history",className:"bpb-scope",children:e.jsx(Pe,{})}):e.jsx(ye,{open:a,onOpenChange:s,size:"md","aria-label":"Billing history",className:"bpb-scope",children:e.jsx(Nr,{open:a})})},Nr=({open:a})=>{const{locale:s}=E(),{data:n,isLoading:r,isError:t}=Va({enabled:a}),o=(n==null?void 0:n.invoices)??[];return e.jsxs("div",{className:"bpb-invoices",children:[e.jsx("h2",{className:"bpb-invoices__title",children:"Billing history"}),r?e.jsxs("div",{className:"bpb-invoices__loading","aria-busy":"true",children:[e.jsx(q,{height:52}),e.jsx(q,{height:52}),e.jsx(q,{height:52})]}):t?e.jsx("p",{className:"bpb-invoices__empty",role:"alert",children:"We couldn’t load your invoices. Try again in a moment."}):o.length===0?e.jsx("p",{className:"bpb-invoices__empty",children:"No invoices yet. They’ll appear here after your first charge."}):e.jsx("ul",{className:"bpb-invoices__list",children:o.map(l=>e.jsxs("li",{className:"bpb-invoices__row",children:[e.jsxs("div",{className:"bpb-invoices__row-main",children:[e.jsx("span",{className:"bpb-invoices__date",children:Se(l.createdAt,s)}),e.jsx("span",{className:`bpb-invoices__status bpb-invoices__status--${l.status}`,children:vr[l.status]})]}),e.jsxs("div",{className:"bpb-invoices__row-end",children:[e.jsx("span",{className:"bpb-invoices__amount",children:j(l.amount,l.currency)}),l.pdfUrl?e.jsx("a",{className:"bpb-invoices__download",href:l.pdfUrl,target:"_blank",rel:"noopener noreferrer","aria-label":`Download invoice from ${Se(l.createdAt,s)}`,children:e.jsx(La,{size:16})}):e.jsx("span",{className:"bpb-invoices__download bpb-invoices__download--disabled","aria-hidden":!0,children:e.jsx(La,{size:16})})]})]},l.id))})]})},wr=({open:a,onOpenChange:s,onSuccess:n})=>{var y;const{stripePromise:r,isDark:t,locale:o,isOutdatedBilling:l}=E(),i=ga(),c=(y=i.data)==null?void 0:y.clientSecret,{mutate:h,reset:b}=i;w.useEffect(()=>{a&&!l?h():b()},[a,l,h,b]);const p=w.useMemo(()=>c?{clientSecret:c,appearance:Da(t),locale:$a(o)}:null,[c,t,o]);return l?e.jsx(ye,{open:a,onOpenChange:s,size:"md","aria-label":"Payment & billing",className:"bpb-scope",children:e.jsx(Pe,{})}):e.jsx(ye,{open:a,onOpenChange:s,size:"md","aria-label":"Payment & billing",className:"bpb-scope",children:e.jsxs("div",{className:"bpb-payment-dialog",children:[e.jsx("h2",{className:"bpb-payment-dialog__title",children:"Payment & billing"}),i.isError?e.jsxs("div",{className:"bpb-payment-dialog__error",children:[e.jsx("p",{children:"We couldn’t start a secure session."}),e.jsx(ie,{variant:"outline",onClick:()=>h(),children:"Try again"})]}):!p||!c?e.jsxs("div",{className:"bpb-payment-dialog__loading","aria-busy":"true",children:[e.jsx(q,{height:48}),e.jsx(q,{height:120})]}):e.jsx(me.Elements,{stripe:r,options:p,children:e.jsx(Cr,{clientSecret:c,isDark:t,onSuccess:n})})]})})},Cr=({clientSecret:a,isDark:s,onSuccess:n})=>{var ce;const r=me.useStripe(),t=me.useElements(),{toast:o}=E(),{data:l,isLoading:i}=pa(),{data:c,isLoading:h}=ua(),{data:b,isLoading:p}=ha(),y=ya(),_=fa(),C=_a(),v=((ce=l==null?void 0:l.paymentMethod)==null?void 0:ce.card)??null,m=(c==null?void 0:c.address)??null,S=(b==null?void 0:b.taxIds)??[],[I,L]=w.useState(!1),[D,f]=w.useState(!1),[A,P]=w.useState(!1),[u,B]=w.useState(!1),[x,R]=w.useState(null),[X,ue]=w.useState(!1),[pe,oe]=w.useState(!1),[U,J]=w.useState(null),[M,le]=w.useState(m==null?void 0:m.country),[g,W]=w.useState(S.length>0),[F,G]=w.useState(null),Y=F??S.map($=>({type:$.type,value:$.value})),V=Fs(M),H=F!==null,ke=I||!v,he=($,be)=>G(Y.map((K,Z)=>Z===$?{...K,...be}:K)),O=()=>{var $;return G([...Y,{type:(($=V[0])==null?void 0:$.type)??"",value:""}])},de=$=>G(Y.filter((be,K)=>K!==$)),re=async()=>{if(!r||!t)return;const $=t.getElement(me.CardElement);if($){B(!0),R(null);try{const{error:be,setupIntent:K}=await r.confirmCardSetup(a,{payment_method:{card:$}});if(be){R(be.message??"Could not save your card");return}if(!(K!=null&&K.payment_method)||typeof K.payment_method!="string"){R("Could not retrieve payment method");return}await y.mutateAsync({paymentMethodId:K.payment_method}),o({type:"success",message:"Card updated"}),L(!1),n==null||n()}catch{R("We couldn’t save your card. Please check your details and try again.")}finally{B(!1)}}},fe=async()=>{if(!t)return;const $=t.getElement("address");if(!$)return;const{complete:be,value:K}=await $.getValue();if(!be||!K.address){J("Please complete your billing address.");return}oe(!0),J(null);try{const{address:Z,name:Ne}=K;await _.mutateAsync({lineOne:Z.line1??"",lineTwo:Z.line2??void 0,city:Z.city??"",state:Z.state??void 0,postalCode:Z.postal_code??"",country:Z.country??""});const Ie=(Ne==null?void 0:Ne.trim())||void 0,oa=Y.filter(Ee=>!!Ee.type&&Ee.value.trim()!=="").map(Ee=>({type:Ee.type,value:Ee.value.trim()}));(Ie!==((b==null?void 0:b.name)??void 0)||H)&&await C.mutateAsync({name:Ie,taxIds:oa}),o({type:"success",message:"Billing details updated"}),n==null||n()}catch(Z){const Ne=Z instanceof Error&&Z.message?Z.message:"Could not update your billing details.";J(Ne),o({type:"error",message:"Could not update your billing details"})}finally{oe(!1)}};return e.jsxs("div",{className:"bpb-payment-dialog__sections",children:[e.jsxs("section",{className:"bpb-payment-dialog__section",children:[e.jsx("h3",{className:"bpb-payment-dialog__section-title",children:"Payment method"}),i?e.jsx(q,{height:56}):ke?e.jsxs("div",{className:"bpb-payment-element",children:[!D&&e.jsx(q,{height:48}),e.jsx("div",{className:D?"bpb-card-element":"bpb-payment-element--hidden",children:e.jsx(me.CardElement,{options:{style:Ua(s),hidePostalCode:!0},onReady:()=>f(!0),onChange:$=>P($.complete)})}),x&&e.jsx("p",{role:"alert",className:"bpb-payment-dialog__field-error",children:x}),e.jsxs("div",{className:"bpb-payment-dialog__section-actions",children:[v&&e.jsx(ie,{variant:"ghost",onClick:()=>L(!1),disabled:u,children:"Cancel"}),e.jsx(ie,{variant:"primary",disabled:!A,loading:u,onClick:re,children:"Save card"})]})]}):e.jsxs("div",{className:"bpb-saved-card",children:[e.jsx(Re,{brand:v.brand}),e.jsxs("span",{className:"bpb-saved-card__number",children:[e.jsx("span",{className:"bpb-saved-card__brand",children:v.brand})," •••• ",v.lastFour]}),e.jsxs("span",{className:"bpb-saved-card__exp",children:[String(v.expMonth).padStart(2,"0"),"/",String(v.expYear).slice(-2)]}),e.jsx("button",{type:"button",className:"bpb-link-button",onClick:()=>L(!0),children:"Replace"})]})]}),e.jsxs("section",{className:"bpb-payment-dialog__section",children:[e.jsx("h3",{className:"bpb-payment-dialog__section-title",children:"Billing address"}),h||p?e.jsx(q,{height:72}):e.jsxs("div",{className:"bpb-payment-element",children:[!X&&e.jsx(q,{height:120}),e.jsx("div",{className:X?void 0:"bpb-payment-element--hidden",children:e.jsx(me.AddressElement,{options:{mode:"billing",display:{name:"full"},defaultValues:m?{name:(b==null?void 0:b.name)??void 0,address:{line1:m.lineOne,line2:m.lineTwo,city:m.city,state:m.state,postal_code:m.postalCode,country:m.country}}:void 0},onReady:()=>ue(!0),onChange:$=>le($.value.address.country||void 0)})}),e.jsxs("div",{className:"bpb-tax-section",children:[e.jsxs("button",{type:"button",className:"bpb-tax-toggle","aria-expanded":g,onClick:()=>W($=>!$),children:[e.jsx(Xe,{size:16,className:T("bpb-tax-toggle__chevron",g&&"bpb-tax-toggle__chevron--open")}),"Tax IDs",S.length>0&&e.jsx("span",{className:"bpb-tax-toggle__count",children:S.length})]}),g&&e.jsxs("div",{className:"bpb-tax",children:[Y.length===0&&e.jsx("p",{className:"bpb-tax__empty",children:"Add a VAT or tax registration number to show it on your invoices."}),Y.map(($,be)=>e.jsxs("div",{className:"bpb-tax__row",children:[e.jsxs(Fa,{"aria-label":"Tax ID type",value:$.type,onChange:K=>he(be,{type:K.target.value}),children:[e.jsx("option",{value:"",children:"Select type"}),V.map(K=>e.jsx("option",{value:K.type,children:K.label},K.type)),$.type&&!V.some(K=>K.type===$.type)&&e.jsx("option",{value:$.type,children:$.type})]}),e.jsx(aa,{placeholder:"Tax ID number",value:$.value,onChange:K=>he(be,{value:K.target.value})}),e.jsx("button",{type:"button",className:"bpb-tax__remove","aria-label":"Remove tax ID",onClick:()=>de(be),children:e.jsx(Ze,{size:14})})]},be)),e.jsx("button",{type:"button",className:"bpb-link-button bpb-tax__add",onClick:O,children:"+ Add tax ID"})]})]}),U&&e.jsx("p",{role:"alert",className:"bpb-payment-dialog__field-error",children:U}),e.jsx("div",{className:"bpb-payment-dialog__section-actions",children:e.jsx(ie,{variant:"primary",loading:pe,onClick:fe,children:"Save billing details"})})]})]})]})},sa=1e9,Ws={incoming_messages_events:a=>`${se(a)} incoming messages & events`,conversation_sessions:a=>`${se(a)} conversation sessions`,table_rows:a=>`${se(a)} table rows`,vector_db_storage:a=>`${Le(a)} vector database storage`,file_storage:a=>`${Le(a)} file storage`,collaborator_count:a=>a===1?"1 collaborator":`${se(a)} collaborators`,bot_count:a=>a===1?"1 bot":`${se(a)} bots`,indexed_file_count:a=>`${se(a)} indexed files for RAG`,ai_spend:a=>`${j(a/sa,"usd",0)} AI credit included`,always_alive:a=>a===1?"1 always-alive bot":`${se(a)} always-alive bots`};function Sr(a,s,n){const r=(n==null?void 0:n[a])??Ws[a];return r?r(s):`${se(s)} ${a.replaceAll("_"," ")}`}const Ir=[{key:"table_rows",label:"Table rows",unit:"count"},{key:"vector_db_storage",label:"Vector DB storage",unit:"bytes"},{key:"file_storage",label:"File storage",unit:"bytes"}],Fe=(a,s)=>s==="bytes"?Le(a):s==="nano-usd"?`$${(a/sa).toFixed(2)}`:se(a),xr=(a,s)=>{const n=new Date;return Array.from({length:a},(r,t)=>{const o=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()-t,1));return{value:o.toISOString(),label:o.toLocaleDateString(s,{month:"long",year:"numeric",timeZone:"UTC"})}})},Ar=({period:a})=>{const{data:s,isLoading:n,isError:r}=Ka("ai_spend",{period:a});if(r)return null;if(n)return e.jsx(q,{height:96});if(!s||s.length===0)return e.jsx("p",{className:"bpb-usage__group-hint",children:"No per-bot AI spend this period."});const t=Math.max(...s.map(o=>o.value),1);return e.jsx("div",{className:"bpb-usage-bots",children:s.map(o=>e.jsxs("div",{className:"bpb-usage-bot",children:[e.jsxs("div",{className:"bpb-usage-bot__head",children:[e.jsx("span",{className:"bpb-usage-bot__name",title:o.name,children:o.name}),e.jsx("span",{className:"bpb-usage-bot__value",children:Fe(o.value,"nano-usd")})]}),e.jsx("div",{className:"bpb-usage-bar",role:"presentation",children:e.jsx("div",{className:"bpb-usage-bar__fill bpb-usage-bar__fill--normal",style:{width:`${Math.max(2,Math.round(o.value/t*100))}%`}})})]},o.botId))})},qa=({entry:a,metric:s,planAllowance:n,planName:r})=>{const t=a.usage??0,o=a.quota>0?Math.max(0,Math.min(100,Math.round(t/a.quota*100))):0,l=o>0?Math.max(5,o):0,i=o>=90?"critical":o>=75?"warning":"normal",c=n??a.quota,h=Math.max(0,a.quota-c),b=r?`${r} plan`:"your plan",p=h>0?`${Fe(c,s.unit)} from ${b} + ${Fe(h,s.unit)} from add-ons`:`${Fe(a.quota,s.unit)} from ${b}`;return e.jsxs("div",{className:"bpb-usage-row",children:[e.jsxs("div",{className:"bpb-usage-row__head",children:[e.jsx("span",{className:"bpb-usage-row__label",children:s.label}),e.jsxs("span",{className:"bpb-usage-row__value",children:[e.jsx("span",{className:"bpb-usage-row__used",children:Fe(t,s.unit)}),e.jsxs("span",{className:"bpb-usage-row__quota",children:[" / ",Fe(a.quota,s.unit)]})]})]}),e.jsxs("span",{className:"bpb-usage-tip",tabIndex:0,role:"note","aria-label":p,children:[e.jsx("div",{className:"bpb-usage-bar",role:"progressbar","aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":100,children:e.jsx("div",{className:T("bpb-usage-bar__fill",`bpb-usage-bar__fill--${i}`),style:{width:`${l}%`}})}),e.jsx("span",{className:"bpb-usage-tip__bubble",role:"tooltip",children:p})]})]})},Mr=({period:a,showPeriodSelector:s=!0,periodMonths:n=12,className:r})=>{var P;const{isOutdatedBilling:t,locale:o}=E(),l=w.useMemo(()=>xr(n,o),[n,o]),[i,c]=w.useState(a??((P=l[0])==null?void 0:P.value)??""),h=Ya(),b=Math.max(0,l.findIndex(u=>u.value===i)),p=u=>{const B=l[b+u];B&&c(B.value)},{data:y,isLoading:_,isError:C}=Ue({period:i,enabled:!t}),{data:v}=_e({enabled:!t}),{data:m}=we(),S=m==null?void 0:m.find(u=>u.id===(v==null?void 0:v.plan.current.planId)),I=S?ee(S.name):void 0,L=u=>S==null?void 0:S.features[u];if(t)return e.jsx("div",{className:T("bpb-usage bpb-scope",r),children:e.jsx(Pe,{})});if(_)return e.jsxs("div",{className:T("bpb-usage bpb-scope",r),"aria-busy":"true",children:[e.jsx(q,{height:80}),e.jsx(q,{height:140})]});if(C||!y)return e.jsx("div",{className:T("bpb-usage bpb-scope",r),children:e.jsx("p",{className:"bpb-usage__error",role:"alert",children:"We couldn’t load your usage. Try again in a moment."})});const D=y.conversation_sessions,f=y.ai_spend,A=Ir.filter(u=>y[u.key]);return e.jsxs("div",{className:T("bpb-usage bpb-scope",r),children:[s&&l.length>1&&e.jsxs("div",{className:"bpb-usage__header",children:[e.jsx("span",{className:"bpb-usage__header-title",children:"Usage"}),e.jsxs("div",{className:"bpb-usage__period",children:[e.jsx("span",{className:"bpb-usage__period-label",children:"Billing period"}),e.jsxs("div",{className:"bpb-usage__period-control",children:[e.jsx("button",{type:"button",className:"bpb-usage__period-step","aria-label":"Previous month",onClick:()=>p(1),disabled:b>=l.length-1,children:e.jsx(Ls,{size:15})}),e.jsxs("span",{className:"bpb-usage__period-field",children:[e.jsx(zs,{size:15,className:"bpb-usage__period-icon"}),e.jsx("select",{className:"bpb-usage__period-select","aria-label":"Billing period",value:i,onChange:u=>c(u.target.value),children:l.map(u=>e.jsx("option",{value:u.value,children:u.label},u.value))}),e.jsx(Xe,{size:14,className:"bpb-usage__period-chevron"})]}),e.jsx("button",{type:"button",className:"bpb-usage__period-step","aria-label":"Next month",onClick:()=>p(-1),disabled:b<=0,children:e.jsx($e,{size:15})})]})]})]}),D&&e.jsxs("section",{className:"bpb-usage__group",children:[e.jsx("h3",{className:"bpb-usage__group-title",children:"Conversations"}),e.jsx("p",{className:"bpb-usage__group-hint",children:"Each conversation includes AI usage. When you reach your limit, extra conversations are added automatically so service continues."}),e.jsx("div",{className:"bpb-usage__card",children:e.jsx(qa,{entry:D,metric:{key:"conversation_sessions",label:"Conversations",unit:"count"},planAllowance:L("conversation_sessions"),planName:I})})]}),A.length>0&&e.jsxs("section",{className:"bpb-usage__group",children:[e.jsx("h3",{className:"bpb-usage__group-title",children:"Storage"}),e.jsx("p",{className:"bpb-usage__group-hint",children:"Shared across files, knowledge base, and tables."}),e.jsx("div",{className:"bpb-usage__card",children:A.map(u=>e.jsx(qa,{entry:y[u.key],metric:u,planAllowance:L(u.key),planName:I},u.key))})]}),f&&e.jsxs("section",{className:"bpb-usage__group",children:[e.jsx("h3",{className:"bpb-usage__group-title",children:"AI usage"}),e.jsx("p",{className:"bpb-usage__group-hint",children:"Each conversation includes an AI allowance — this is how much you’ve used."}),e.jsx("div",{className:"bpb-usage__card",children:e.jsx(qa,{entry:f,metric:{key:"ai_spend",label:"AI spend",unit:"nano-usd"}})}),h&&e.jsxs("div",{className:"bpb-usage__card bpb-usage__card--bots",children:[e.jsx("span",{className:"bpb-usage__subhead",children:"AI spend by bot"}),e.jsx(Ar,{period:i})]})]})]})},Tr={conversation_sessions:"monthly conversations",table_rows:"table rows",vector_db_storage:"vector DB storage",file_storage:"file storage",ai_spend:"AI spend"},Br=({position:a="inline",threshold:s=.9,onUpgrade:n,dismissible:r=!0,ctaLabel:t="Upgrade plan",period:o,className:l})=>{const{isOutdatedBilling:i}=E(),{data:c}=Ue({period:o,enabled:!i}),[h,b]=w.useState(!1),[p,y]=w.useState(!1),[_,C]=w.useState(null),v=c?Object.entries(c).map(([f,A])=>({key:f,pct:A.quota>0?(A.usage??0)/A.quota:0})).filter(f=>f.pct>=s).sort((f,A)=>A.pct-f.pct)[0]:void 0;if(i||!v||h)return null;const m=Tr[v.key]??v.key.replace(/_/g," "),S=Math.min(100,Math.round(v.pct*100)),I=n??(()=>y(!0)),L=v.pct>=1,D=L?"critical":"warning";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:T("bpb-usage-banner bpb-scope",`bpb-usage-banner--${a}`,`bpb-usage-banner--${D}`,l),role:"alert","aria-live":"polite",children:[e.jsx(nr,{size:18,className:"bpb-usage-banner__icon"}),e.jsx("p",{className:"bpb-usage-banner__text",children:L?e.jsxs(e.Fragment,{children:["You’ve reached your ",m," limit. Upgrade now to avoid interruptions."]}):e.jsxs(e.Fragment,{children:["You’ve used ",e.jsxs("strong",{children:[S,"%"]})," of your ",m,". Upgrade to avoid hitting your limit."]})}),e.jsxs("div",{className:"bpb-usage-banner__actions",children:[e.jsx(ie,{variant:"primary",size:"sm",onClick:I,children:t}),r&&e.jsx("button",{type:"button",className:"bpb-usage-banner__dismiss","aria-label":"Dismiss",onClick:()=>b(!0),children:e.jsx(Ze,{size:16})})]})]}),!n&&e.jsxs(e.Fragment,{children:[e.jsx(Us,{open:p,onOpenChange:y,onSelectPlan:(f,A)=>{y(!1),C({planId:f,interval:A})}}),_&&e.jsx(Os,{open:!!_,onOpenChange:f=>!f&&C(null),planId:_.planId,interval:_.interval,onBack:()=>{C(null),y(!0)},onSuccess:()=>C(null)})]})]})},Wa=({children:a})=>e.jsx("span",{className:"bpb-summary-card__icon","aria-hidden":"true",children:a}),Gs=({eyebrow:a,className:s})=>{const{manageBillingUrl:n}=E(),r=()=>n&&window.open(n,"_blank","noopener");return e.jsxs("button",{type:"button",className:T("bpb-summary-card bpb-scope",a==="Add-ons"?"bpb-summary-card--addons":"bpb-summary-card--plan",s),onClick:r,disabled:!n,children:[e.jsx(Wa,{children:a==="Add-ons"?e.jsx(Qe,{size:22}):e.jsx(He,{size:22})}),e.jsxs("div",{className:"bpb-summary-card__content",children:[e.jsxs("div",{className:"bpb-summary-card__body",children:[e.jsx("span",{className:"bpb-summary-card__eyebrow",children:a}),e.jsx("span",{className:"bpb-summary-card__title",children:"Managed in Dashboard"}),e.jsx("span",{className:"bpb-summary-card__meta",children:"This workspace uses an earlier billing system."})]}),e.jsxs("span",{className:"bpb-summary-card__action",children:["Open",e.jsx(Je,{size:15})]})]})]})},Lr=({onManage:a,className:s})=>{var C,v;const{isOutdatedBilling:n}=E(),{data:r,isLoading:t}=_e({enabled:!n}),{data:o,isLoading:l}=we();if(n)return e.jsx(Gs,{eyebrow:"Current plan",className:s});if(t||l)return e.jsx(q,{height:84,rounded:!0,className:T("bpb-scope",s)});const i=r==null?void 0:r.plan.current,c=o==null?void 0:o.find(m=>m.id===(i==null?void 0:i.planId)),h=(i==null?void 0:i.interval)??"month",b=((C=c==null?void 0:c.prices[h])==null?void 0:C.amount)??0,p=((v=c==null?void 0:c.prices[h])==null?void 0:v.currency)??"usd",y=c==null?void 0:c.features.conversation_sessions,_=c?ge(c):"community";return e.jsxs("button",{type:"button",className:T("bpb-summary-card bpb-summary-card--plan bpb-scope",`bpb-summary-card--tier-${_==="managed"?"enterprise":_}`,s),onClick:a,children:[e.jsx(Wa,{children:e.jsx(He,{size:22})}),e.jsxs("div",{className:"bpb-summary-card__content",children:[e.jsxs("div",{className:"bpb-summary-card__body",children:[e.jsx("span",{className:"bpb-summary-card__eyebrow",children:"Current plan"}),e.jsx("span",{className:"bpb-summary-card__title",children:c?ee(c.name):"No plan"}),e.jsxs("span",{className:"bpb-summary-card__meta",children:[b>0?`${j(b,p,0)}/${h==="year"?"yr":"mo"}`:"Free",y!==void 0&&` · ${se(y)} conversations/mo`]})]}),e.jsxs("span",{className:"bpb-summary-card__action",children:["Manage",e.jsx($e,{size:16})]})]})]})},Pr=({onManage:a,className:s})=>{const{isOutdatedBilling:n}=E(),{data:r,isLoading:t}=_e({enabled:!n}),{data:o,isLoading:l}=De();if(n)return e.jsx(Gs,{eyebrow:"Add-ons",className:s});if(t||l)return e.jsx(q,{height:84,rounded:!0,className:T("bpb-scope",s)});const i=(o??[]).flatMap(c=>{var b;const h=((b=r==null?void 0:r.addons[c.id])==null?void 0:b.current.quantity)??0;return h>0?[{name:Ge(c.name),quantity:h}]:[]});return e.jsxs("button",{type:"button",className:T("bpb-summary-card bpb-summary-card--addons bpb-scope",i.length>0&&"bpb-summary-card--active",s),onClick:a,children:[e.jsx(Wa,{children:e.jsx(Qe,{size:22})}),e.jsxs("div",{className:"bpb-summary-card__content",children:[e.jsxs("div",{className:"bpb-summary-card__body",children:[e.jsx("span",{className:"bpb-summary-card__eyebrow",children:"Add-ons"}),i.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"bpb-summary-card__title",children:[i.length," active add-on",i.length>1?"s":""]}),e.jsx("span",{className:"bpb-summary-card__meta",children:i.map(c=>`${c.quantity}× ${c.name}`).join(" · ")})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"bpb-summary-card__title",children:"No add-ons"}),e.jsx("span",{className:"bpb-summary-card__meta",children:"Add extra conversations or storage"})]})]}),e.jsxs("span",{className:"bpb-summary-card__action",children:["Manage",e.jsx($e,{size:16})]})]})]})},Er=({onManage:a,className:s})=>{var u,B;const{isOutdatedBilling:n,locale:r,manageBillingUrl:t}=E(),{data:o,isLoading:l}=_e({enabled:!n}),{data:i,isLoading:c}=we(),{data:h,isLoading:b}=De();if(n){const x=()=>t&&window.open(t,"_blank","noopener");return e.jsxs("button",{type:"button",className:T("bpb-plan-banner bpb-plan-banner--community bpb-scope",s),onClick:x,disabled:!t,children:[e.jsxs("div",{className:"bpb-plan-banner__main",children:[e.jsx("span",{className:"bpb-plan-banner__eyebrow",children:"Current plan"}),e.jsx("span",{className:"bpb-plan-banner__name",children:"Managed in Dashboard"}),e.jsx("span",{className:"bpb-plan-banner__sub",children:"This workspace uses an earlier billing system."})]}),e.jsxs("span",{className:"bpb-plan-banner__cta",children:["Open ",e.jsx(Je,{size:16})]})]})}if(l||c||b)return e.jsx(q,{height:132,rounded:!0,className:T("bpb-scope",s)});const p=o==null?void 0:o.plan.current,y=i==null?void 0:i.find(x=>x.id===(p==null?void 0:p.planId)),_=(p==null?void 0:p.interval)??"month",C=((u=y==null?void 0:y.prices[_])==null?void 0:u.currency)??"usd",v=y?ge(y):"community",m=Object.fromEntries(Object.entries((o==null?void 0:o.addons)??{}).map(([x,R])=>{var X;return[x,((X=R.current)==null?void 0:X.quantity)??0]})),S=((B=y==null?void 0:y.prices[_])==null?void 0:B.amount)??0,I=(h??[]).reduce((x,R)=>{const X=y?Ye(R,y,_):null;return x+(m[R.id]??0)*((X==null?void 0:X.amount)??0)},0),L=S+I,D=_==="year"?"/yr":"/mo",f=ws(y,h,m).find(x=>x.key==="conversation_sessions"),A=p!=null&&p.periodEnd?Se(p.periodEnd,r):null,P=v==="enterprise"||v==="managed";return e.jsxs("button",{type:"button",className:T("bpb-plan-banner",`bpb-plan-banner--${v}`,"bpb-scope",s),onClick:a,children:[e.jsxs("div",{className:"bpb-plan-banner__main",children:[e.jsx("span",{className:"bpb-plan-banner__eyebrow",children:"Current plan"}),e.jsx("span",{className:"bpb-plan-banner__name",children:y?ee(y.name):"No plan"}),f&&e.jsx("span",{className:"bpb-plan-banner__sub",children:f.added>0?e.jsxs(e.Fragment,{children:[se(f.base)," + ",se(f.added)," conversations / month"]}):`${se(f.total)} conversations / month`})]}),e.jsxs("div",{className:"bpb-plan-banner__summary",children:[P?e.jsx("span",{className:"bpb-plan-banner__price",children:"Custom pricing"}):e.jsxs("span",{className:"bpb-plan-banner__price",children:[L>0?j(L,C,0):"Free",L>0&&e.jsx("span",{className:"bpb-plan-banner__price-suffix",children:D})]}),e.jsxs("span",{className:"bpb-plan-banner__meta",children:[_==="year"?"Billed annually":"Billed monthly",I>0&&" · incl. add-ons"]}),A&&e.jsxs("span",{className:"bpb-plan-banner__meta",children:["Renews ",A]})]}),e.jsxs("span",{className:"bpb-plan-banner__cta",children:["Manage plan ",e.jsx($e,{size:16})]})]})},js=[{key:"conversation_sessions",label:"Conversations",unit:"count"},{key:"ai_spend",label:"AI spend",unit:"nano-usd"},{key:"table_rows",label:"Table rows",unit:"count"},{key:"vector_db_storage",label:"Vector DB storage",unit:"bytes"},{key:"file_storage",label:"File storage",unit:"bytes"}];function na(a,s){return s==="bytes"?Le(a):s==="nano-usd"?`$${(a/sa).toFixed(2)}`:se(a)}function ra(a){return a>=90?"critical":a>=75?"warning":"normal"}function ta(a){return a?js.flatMap(({key:s,label:n,unit:r})=>{const t=a[s];if(!t||t.quota<=0)return[];const o=t.usage??0,l=Math.max(0,Math.min(100,o/t.quota*100));return[{key:s,label:n,unit:r,used:o,quota:t.quota,remaining:Math.max(0,t.quota-o),pct:l}]}).sort((s,n)=>n.pct-s.pct):[]}const zr=({onManage:a,period:s,variant:n="card",className:r,style:t})=>{const{isOutdatedBilling:o,locale:l}=E(),{data:i,isLoading:c}=_e({enabled:!o}),{data:h,isLoading:b}=we(),{data:p,isLoading:y}=Ue({period:s,enabled:!o});if(o)return null;if(c||b||y)return e.jsx(q,{height:72,rounded:!0,className:T("bpb-scope",r)});const _=h==null?void 0:h.find(u=>u.id===(i==null?void 0:i.plan.current.planId)),C=ta(p),v=C.find(u=>u.key==="conversation_sessions"),m=C[0],S=m&&m.key!=="conversation_sessions"&&m.pct>=75?m:v??m,I=S?Math.round(S.pct):0,L=I>0?Math.max(5,I):0,D=S?ra(S.pct):"normal",f=i!=null&&i.plan.current.periodEnd?Se(i.plan.current.periodEnd,l):null,A=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bpb-plan-usage__head",children:[e.jsx("span",{className:"bpb-plan-usage__plan",children:_?ee(_.name):"Free"}),a&&e.jsx($e,{size:15,className:"bpb-plan-usage__chevron"})]}),S&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bpb-plan-usage__meta",children:[e.jsx("span",{className:"bpb-plan-usage__meta-label",children:S.label}),e.jsxs("span",{className:"bpb-plan-usage__meta-value",children:[e.jsx("strong",{children:na(S.remaining,S.unit)})," left"]})]}),e.jsx("div",{className:"bpb-plan-usage__bar",role:"progressbar","aria-valuenow":I,"aria-valuemin":0,"aria-valuemax":100,children:e.jsx("div",{className:T("bpb-plan-usage__fill",`bpb-plan-usage__fill--${D}`),style:{width:`${L}%`}})}),f&&e.jsxs("span",{className:"bpb-plan-usage__reset",children:["Resets ",f]})]})]}),P=T("bpb-plan-usage bpb-scope",`bpb-plan-usage--${n}`,a&&"bpb-plan-usage--clickable",r);return a?e.jsx("button",{type:"button",className:P,style:t,onClick:a,children:A}):e.jsx("div",{className:P,style:t,children:A})},Vs=({children:a,delay:s=200,placement:n="top",period:r,className:t})=>{const{isOutdatedBilling:o,locale:l}=E(),{data:i}=Ue({period:r,enabled:!o}),{data:c}=_e({enabled:!o}),{data:h}=we(),[b,p]=w.useState(!1),y=w.useRef(null),_=()=>{y.current&&(clearTimeout(y.current),y.current=null)};w.useEffect(()=>_,[]);const C=ta(i),v=!o&&C.length>0,m=()=>{v&&(_(),y.current=setTimeout(()=>p(!0),Math.max(0,s)))},S=()=>{_(),p(!1)},I=h==null?void 0:h.find(f=>f.id===(c==null?void 0:c.plan.current.planId)),L=I?ee(I.name):"Free",D=c!=null&&c.plan.current.periodEnd?Se(c.plan.current.periodEnd,l):null;return e.jsxs("span",{className:T("bpb-usage-pop bpb-scope",t),onMouseEnter:m,onMouseLeave:S,onFocus:m,onBlur:S,children:[a,b&&v&&e.jsxs("span",{className:T("bpb-usage-pop__card",`bpb-usage-pop__card--${n}`),role:"tooltip",children:[e.jsxs("span",{className:"bpb-usage-pop__plan",children:[e.jsxs("span",{className:"bpb-usage-pop__plan-name",children:[L," plan"]}),D&&e.jsxs("span",{className:"bpb-usage-pop__reset",children:["Resets ",D]})]}),e.jsx("span",{className:"bpb-usage-pop__title",children:"Usage this period"}),C.map(f=>{const A=f.pct>0?Math.max(5,f.pct):0;return e.jsxs("span",{className:"bpb-usage-pop__item",children:[e.jsxs("span",{className:"bpb-usage-pop__head",children:[e.jsx("span",{className:"bpb-usage-pop__name",children:f.label}),e.jsxs("span",{className:"bpb-usage-pop__val",children:[na(f.used,f.unit)," / ",na(f.quota,f.unit)]})]}),e.jsx("span",{className:"bpb-usage-pop__bar",children:e.jsx("span",{className:T("bpb-usage-pop__fill",`bpb-usage-pop__fill--${ra(f.pct)}`),style:{width:`${A}%`}})})]},f.key)})]})]})},Dr=({size:a=20,thickness:s=3.5,showLabel:n=!1,onClick:r,popoverDelay:t=200,period:o,className:l,...i})=>{const{isOutdatedBilling:c}=E(),{data:h}=Ue({period:o,enabled:!c}),b=ta(h);if(c||b.length===0)return null;const p=b[0],y=ra(p.pct),_=p.pct>0?Math.max(5,p.pct):0,C=(a-s)/2,v=2*Math.PI*C,m=v*(1-_/100),S=i["aria-label"]??`${Math.round(p.pct)}% of your ${p.label.toLowerCase()} used`,I=e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:"bpb-usage-ring__svg",width:a,height:a,viewBox:`0 0 ${a} ${a}`,"aria-hidden":!0,children:[e.jsx("circle",{className:"bpb-usage-ring__track",cx:a/2,cy:a/2,r:C,fill:"none",strokeWidth:s}),e.jsx("circle",{className:T("bpb-usage-ring__arc",`bpb-usage-ring__arc--${y}`),cx:a/2,cy:a/2,r:C,fill:"none",strokeWidth:s,strokeLinecap:"round",strokeDasharray:v,strokeDashoffset:m,transform:`rotate(-90 ${a/2} ${a/2})`})]}),n&&e.jsxs("span",{className:"bpb-usage-ring__label",children:[Math.round(p.pct),"%"]})]}),L=T("bpb-usage-ring",r&&"bpb-usage-ring--clickable"),D=r?e.jsx("button",{type:"button",className:L,onClick:r,"aria-label":S,children:I}):e.jsx("span",{className:L,tabIndex:0,role:"img","aria-label":S,children:I});return e.jsx(Vs,{delay:t,period:o,className:l,children:D})};d.AddonsSummaryCard=Pr,d.Badge=Aa,d.BankIcon=ar,d.BillingProvider=tn,d.BoltIcon=Qe,d.Button=ie,d.CalendarIcon=zs,d.CardBrandBadge=Re,d.CardIcon=Ba,d.ChartIcon=Ms,d.CheckIcon=Cs,d.CheckoutDialog=Os,d.ChevronDownIcon=Xe,d.ChevronLeftIcon=Ls,d.ChevronRightIcon=$e,d.CloseIcon=Ze,d.DEFAULT_FEATURE_DESCRIPTIONS=Ia,d.DEFAULT_FEATURE_LABELS=Ws,d.DEFAULT_PLAN_FEATURES=Sa,d.Dialog=ye,d.DownloadIcon=La,d.ENTERPRISE_CONTACT_URL=fs,d.ExternalLinkIcon=Je,d.GlobeIcon=Ts,d.InfinityIcon=xs,d.InfoTooltip=ea,d.Input=aa,d.InvoicesDialog=kr,d.LayersIcon=He,d.LockIcon=sr,d.ManageAddonsDialog=fr,d.MessageIcon=Ss,d.MinusIcon=Ps,d.NANO_DOLLARS_PER_DOLLAR=sa,d.OutdatedBillingGate=Pe,d.PLAN_ORDER=We,d.PaintIcon=Bs,d.PaymentMethodDialog=wr,d.PlanBanner=Er,d.PlanSummaryCard=Lr,d.PlanUsageWidget=zr,d.PlusIcon=Es,d.PuzzleIcon=Is,d.ReceiptIcon=rr,d.SegmentedControl=Ds,d.Select=Fa,d.ShieldIcon=Ta,d.Skeleton=q,d.SparkleIcon=Ma,d.Stepper=qs,d.USAGE_METRICS=js,d.UpgradePlanDialog=Us,d.UsageBanner=Br,d.UsageDashboard=Mr,d.UsagePopover=Vs,d.UsageRing=Dr,d.UsersIcon=As,d.addDays=gs,d.addonDisplayName=Ge,d.addonLimitsPreview=Ns,d.addonPrice=Ye,d.billingKeys=ae,d.cn=T,d.conversationPackPrice=xa,d.conversationsAddon=vs,d.currencySymbol=ys,d.featureDescription=_s,d.featureLabel=Sr,d.formatBytes=Le,d.formatCurrency=j,d.formatDate=Se,d.formatQuantity=se,d.formatUsage=na,d.getCardElementStyle=Ua,d.getStripeAppearance=Da,d.getStripePromise=ja,d.iconForFeature=Pa,d.planDisplayName=ee,d.planEntitlements=ws,d.planKind=ge,d.toStripeLocale=$a,d.usageItems=ta,d.usageTier=ra,d.useAddons=De,d.useBilling=E,d.useBillingAddress=ua,d.useBillingReadonly=ma,d.useCreatePaymentMethodIntent=ga,d.useCustomer=ha,d.useInvoices=Va,d.usePaymentMethod=pa,d.usePlans=we,d.useSetAddons=Ha,d.useSetBillingAddress=fa,d.useSetCustomer=_a,d.useSetPaymentMethod=ya,d.useSetSubscription=va,d.useSubscription=_e,d.useSubscriptionPreview=ba,d.useSupportsUsageByBot=Ya,d.useUsage=Ue,d.useUsageByBot=Ka,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(p,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("@tanstack/react-query"),require("react"),require("@stripe/stripe-js"),require("react-dom"),require("@stripe/react-stripe-js")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@tanstack/react-query","react","@stripe/stripe-js","react-dom","@stripe/react-stripe-js"],e):(p=typeof globalThis<"u"?globalThis:p||self,e(p.BillingUI={},p.ReactJsxRuntime,p.ReactQuery,p.React,p.StripeJs,p.ReactDOM,p.ReactStripeJs))})(this,function(p,e,be,N,pn,un,fe){"use strict";const Za=new Map;function Xa(a){let s=Za.get(a);return s||(s=pn.loadStripe(a,{developerTools:{assistant:{enabled:!1}}}),Za.set(a,s)),s}const fa=N.createContext(null),hn={capture:()=>{}};function mn(a){const[s,n]=N.useState(()=>typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches);return N.useEffect(()=>{if(a!=="system")return;const r=window.matchMedia("(prefers-color-scheme: dark)"),t=o=>n(o.matches);return r.addEventListener("change",t),()=>r.removeEventListener("change",t)},[a]),a==="system"?s:a==="dark"}const gn=({client:a,stripePublishableKey:s,email:n,locale:r="en-US",theme:t="light",onToast:o,analytics:l,featureLabels:c,billingVersion:b,workspaceId:u,persist:h=!0,manageBillingUrl:d,onBillingChange:_,refreshInterval:f=3e4,children:k})=>{const v=u||"default",[m]=N.useState(()=>new be.QueryClient({defaultOptions:{queries:{retry:1,staleTime:3e4,gcTime:1e3*60*60}}})),y=mn(t),S=N.useMemo(()=>Xa(s),[s]);N.useEffect(()=>{if(!h||typeof window>"u")return;const M=`bpb-cache:${v}`;try{const E=window.localStorage.getItem(M);E&&be.hydrate(m,JSON.parse(E))}catch{window.localStorage.removeItem(M)}let i=null;const T=m.getQueryCache().subscribe(E=>{E.type!=="added"&&E.type!=="removed"&&E.type!=="updated"||(i&&clearTimeout(i),i=setTimeout(()=>{try{window.localStorage.setItem(M,JSON.stringify(be.dehydrate(m)))}catch{}},250))});return()=>{i&&clearTimeout(i),T()}},[h,v,m]);const O=N.useCallback(()=>m.invalidateQueries({queryKey:["bpb",v]}),[m,v]),I=N.useCallback(M=>_==null?void 0:_(M),[_]),P=f>0?f:!1,A=N.useMemo(()=>({client:a,queryClient:m,scope:v,stripePromise:S,email:n,locale:r,isDark:y,toast:o??(()=>{}),analytics:l??hn,featureLabels:c,isOutdatedBilling:b!==void 0&&b!=="v4",manageBillingUrl:d,refetchInterval:P,refresh:O,notifyBillingChange:I}),[a,m,v,S,n,r,y,o,l,c,b,d,P,O,I]);return e.jsx(fa.Provider,{value:A,children:e.jsx("div",{className:"bpb-scope","data-bpb-theme":y?"dark":"light",style:{display:"contents"},children:k})})};function U(){const a=N.useContext(fa);if(!a)throw new Error("@bpinternal/billing-ui components must be rendered inside <BillingProvider>");return a}function yn(){var a;return((a=N.useContext(fa))==null?void 0:a.isDark)??!1}const le={PLAN_PICKER_VIEWED:"billing_plan_picker_viewed",PLAN_INTERVAL_TOGGLED:"billing_plan_interval_toggled",PLAN_UPGRADE_INITIATED:"billing_plan_upgrade_initiated",PLAN_DOWNGRADED:"billing_plan_downgraded",PLAN_DOWNGRADE_CANCELLED:"billing_plan_downgrade_cancelled",CHECKOUT_STEP_VIEWED:"billing_checkout_step_viewed",CHECKOUT_INTERVAL_CHANGED:"billing_checkout_interval_changed",PAYMENT_METHOD_SELECTED:"billing_payment_method_selected",PAYMENT_DETAILS_CONFIRMED:"billing_payment_details_confirmed",PLAN_UPGRADED:"billing_plan_upgraded",CHECKOUT_ERROR:"billing_checkout_error",PAYMENT_METHOD_UPDATED:"billing_payment_method_updated",BILLING_ADDRESS_UPDATED:"billing_address_updated",INVOICE_DOWNLOADED:"billing_invoice_downloaded",UPGRADE_CTA_CLICKED:"billing_upgrade_cta_clicked"},ce={root:a=>["bpb",a],plans:a=>["bpb",a,"plans"],addons:a=>["bpb",a,"addons"],subscription:a=>["bpb",a,"subscription"],preview:(a,s)=>["bpb",a,"preview",s],paymentMethod:a=>["bpb",a,"payment-method"],billingAddress:a=>["bpb",a,"billing-address"],customer:a=>["bpb",a,"customer"],invoices:a=>["bpb",a,"invoices"],readonly:a=>["bpb",a,"billing-readonly"],usages:(a,s)=>["bpb",a,"usages",s],bots:a=>["bpb",a,"bots"],usageByBot:(a,s,n)=>["bpb",a,"usage-by-bot",s,n]};function we(){const{client:a,queryClient:s,scope:n}=U();return be.useQuery({queryKey:ce.plans(n),queryFn:()=>a.listPlans({})},s)}function Pe(){const{client:a,queryClient:s,scope:n}=U();return be.useQuery({queryKey:ce.addons(n),queryFn:()=>a.listAddons({})},s)}function Ne(a){const{client:s,queryClient:n,scope:r,refetchInterval:t}=U();return be.useQuery({queryKey:ce.subscription(r),queryFn:()=>s.getSubscription({}),enabled:(a==null?void 0:a.enabled)??!0,refetchInterval:t},n)}function va(a,s){const{client:n,queryClient:r,scope:t}=U();return be.useQuery({queryKey:ce.preview(t,a),queryFn:()=>n.previewSubscriptionUpdate(a),enabled:(s==null?void 0:s.enabled)??!0},r)}function Na(a){const{client:s,queryClient:n,scope:r}=U();return be.useQuery({queryKey:ce.paymentMethod(r),queryFn:()=>s.getPaymentMethod({}),enabled:(a==null?void 0:a.enabled)??!0},n)}function ka(a){const{client:s,queryClient:n,scope:r}=U();return be.useQuery({queryKey:ce.billingAddress(r),queryFn:()=>s.getBillingAddress({}),enabled:(a==null?void 0:a.enabled)??!0},n)}function wa(a){const{client:s,queryClient:n,scope:r}=U();return be.useQuery({queryKey:ce.customer(r),queryFn:()=>s.getCustomer({}),enabled:(a==null?void 0:a.enabled)??!0},n)}function Ja(a){const{client:s,queryClient:n,scope:r,refetchInterval:t}=U();return be.useQuery({queryKey:ce.invoices(r),queryFn:()=>s.listInvoices({}),enabled:(a==null?void 0:a.enabled)??!0,refetchInterval:t},n)}function Ca(a){const{client:s,queryClient:n,scope:r}=U();return be.useQuery({queryKey:ce.readonly(r),queryFn:()=>s.getBillingReadonly({}),enabled:(a==null?void 0:a.enabled)??!0},n)}function De(a){const{client:s,queryClient:n,scope:r,refetchInterval:t}=U(),o=a!=null&&a.period?new Date(a.period):new Date,l=`${o.getUTCFullYear()}-${String(o.getUTCMonth()+1).padStart(2,"0")}`;return be.useQuery({queryKey:ce.usages(r,l),queryFn:()=>s.getWorkspaceUsages({period:`${l}-01T00:00:00.000Z`}).then(c=>c.quotas),enabled:(a==null?void 0:a.enabled)??!0,refetchInterval:t},n)}function Ra(a,s){const{client:n,queryClient:r,scope:t,refetchInterval:o}=U(),l=n.breakDownWorkspaceUsageByBot,c=n.listBots,b=typeof l=="function"&&typeof c=="function",u=s!=null&&s.period?new Date(s.period):new Date,h=`${u.getUTCFullYear()}-${String(u.getUTCMonth()+1).padStart(2,"0")}`;return be.useQuery({queryKey:ce.usageByBot(t,a,h),queryFn:async()=>{const[d,_]=await Promise.all([l({id:t,type:a,period:`${h}-01T00:00:00.000Z`}),c({})]),f=new Map(_.bots.map(k=>[k.id,k.name]));return d.data.map(k=>({botId:k.botId,name:f.get(k.botId)??k.botId,value:k.value})).sort((k,v)=>v.value-k.value)},enabled:b&&((s==null?void 0:s.enabled)??!0),refetchInterval:o},r)}function es(){const{client:a}=U();return typeof a.breakDownWorkspaceUsageByBot=="function"&&typeof a.listBots=="function"}function Sa(){const{client:a,queryClient:s}=U();return be.useMutation({mutationFn:()=>a.createPaymentMethodIntent({})},s)}function Ia(){const{client:a,queryClient:s,scope:n,notifyBillingChange:r}=U();return be.useMutation({mutationFn:t=>a.setPaymentMethod(t),onSuccess:async()=>{await s.invalidateQueries({queryKey:ce.paymentMethod(n)}),r({type:"payment-method"})}},s)}function Aa(){const{client:a,queryClient:s,scope:n,notifyBillingChange:r}=U();return be.useMutation({mutationFn:async t=>{await a.setBillingAddress(t)},onSuccess:async()=>{await Promise.all([s.invalidateQueries({queryKey:ce.billingAddress(n)}),s.invalidateQueries({queryKey:ce.customer(n)})]),r({type:"billing-address"})}},s)}function Ea(){const{client:a,queryClient:s,scope:n}=U();return be.useMutation({mutationFn:r=>a.setCustomer(r),onSuccess:()=>s.invalidateQueries({queryKey:ce.customer(n)})},s)}function as(){const{client:a,queryClient:s,scope:n,notifyBillingChange:r}=U();return be.useMutation({mutationFn:async t=>{await a.setAddons(t)},onSuccess:async()=>{await Promise.all([s.invalidateQueries({queryKey:ce.subscription(n)}),s.invalidateQueries({queryKey:ce.invoices(n)}),s.invalidateQueries({queryKey:["bpb",n,"preview"]})]),r({type:"addons"})}},s)}function Ta(){const{client:a,queryClient:s,scope:n,notifyBillingChange:r}=U();return be.useMutation({mutationFn:async t=>{await a.setPlan({planId:t.planId,interval:t.interval,couponCode:t.couponCode}),t.addons&&Object.keys(t.addons).length>0&&await a.setAddons({addons:t.addons,couponCode:t.couponCode})},onSuccess:async()=>{await Promise.all([s.invalidateQueries({queryKey:ce.subscription(n)}),s.invalidateQueries({queryKey:ce.plans(n)}),s.invalidateQueries({queryKey:ce.invoices(n)}),s.invalidateQueries({queryKey:["bpb",n,"preview"]})]),r({type:"subscription"})}},s)}function ss(a){var s,n,r="";if(typeof a=="string"||typeof a=="number")r+=a;else if(typeof a=="object")if(Array.isArray(a)){var t=a.length;for(s=0;s<t;s++)a[s]&&(n=ss(a[s]))&&(r&&(r+=" "),r+=n)}else for(n in a)a[n]&&(r&&(r+=" "),r+=n);return r}function _n(){for(var a,s,n=0,r="",t=arguments.length;n<t;n++)(a=arguments[n])&&(s=ss(a))&&(r&&(r+=" "),r+=s);return r}const fn=(a,s)=>{const n=new Array(a.length+s.length);for(let r=0;r<a.length;r++)n[r]=a[r];for(let r=0;r<s.length;r++)n[a.length+r]=s[r];return n},vn=(a,s)=>({classGroupId:a,validator:s}),ns=(a=new Map,s=null,n)=>({nextPart:a,validators:s,classGroupId:n}),aa="-",rs=[],Nn="arbitrary..",kn=a=>{const s=Cn(a),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=a;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return wn(l);const c=l.split(aa),b=c[0]===""&&c.length>1?1:0;return ts(c,b,s)},getConflictingClassGroupIds:(l,c)=>{if(c){const b=r[l],u=n[l];return b?u?fn(u,b):b:u||rs}return n[l]||rs}}},ts=(a,s,n)=>{if(a.length-s===0)return n.classGroupId;const t=a[s],o=n.nextPart.get(t);if(o){const u=ts(a,s+1,o);if(u)return u}const l=n.validators;if(l===null)return;const c=s===0?a.join(aa):a.slice(s).join(aa),b=l.length;for(let u=0;u<b;u++){const h=l[u];if(h.validator(c))return h.classGroupId}},wn=a=>a.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const s=a.slice(1,-1),n=s.indexOf(":"),r=s.slice(0,n);return r?Nn+r:void 0})(),Cn=a=>{const{theme:s,classGroups:n}=a;return Sn(n,s)},Sn=(a,s)=>{const n=ns();for(const r in a){const t=a[r];La(t,n,r,s)}return n},La=(a,s,n,r)=>{const t=a.length;for(let o=0;o<t;o++){const l=a[o];In(l,s,n,r)}},In=(a,s,n,r)=>{if(typeof a=="string"){An(a,s,n);return}if(typeof a=="function"){En(a,s,n,r);return}Tn(a,s,n,r)},An=(a,s,n)=>{const r=a===""?s:os(s,a);r.classGroupId=n},En=(a,s,n,r)=>{if(Ln(a)){La(a(r),s,n,r);return}s.validators===null&&(s.validators=[]),s.validators.push(vn(n,a))},Tn=(a,s,n,r)=>{const t=Object.entries(a),o=t.length;for(let l=0;l<o;l++){const[c,b]=t[l];La(b,os(s,c),n,r)}},os=(a,s)=>{let n=a;const r=s.split(aa),t=r.length;for(let o=0;o<t;o++){const l=r[o];let c=n.nextPart.get(l);c||(c=ns(),n.nextPart.set(l,c)),n=c}return n},Ln=a=>"isThemeGetter"in a&&a.isThemeGetter===!0,Mn=a=>{if(a<1)return{get:()=>{},set:()=>{}};let s=0,n=Object.create(null),r=Object.create(null);const t=(o,l)=>{n[o]=l,s++,s>a&&(s=0,r=n,n=Object.create(null))};return{get(o){let l=n[o];if(l!==void 0)return l;if((l=r[o])!==void 0)return t(o,l),l},set(o,l){o in n?n[o]=l:t(o,l)}}},Ma="!",ls=":",xn=[],cs=(a,s,n,r,t)=>({modifiers:a,hasImportantModifier:s,baseClassName:n,maybePostfixModifierPosition:r,isExternal:t}),Pn=a=>{const{prefix:s,experimentalParseClassName:n}=a;let r=t=>{const o=[];let l=0,c=0,b=0,u;const h=t.length;for(let v=0;v<h;v++){const m=t[v];if(l===0&&c===0){if(m===ls){o.push(t.slice(b,v)),b=v+1;continue}if(m==="/"){u=v;continue}}m==="["?l++:m==="]"?l--:m==="("?c++:m===")"&&c--}const d=o.length===0?t:t.slice(b);let _=d,f=!1;d.endsWith(Ma)?(_=d.slice(0,-1),f=!0):d.startsWith(Ma)&&(_=d.slice(1),f=!0);const k=u&&u>b?u-b:void 0;return cs(o,f,_,k)};if(s){const t=s+ls,o=r;r=l=>l.startsWith(t)?o(l.slice(t.length)):cs(xn,!1,l,void 0,!0)}if(n){const t=r;r=o=>n({className:o,parseClassName:t})}return r},Dn=a=>{const s=new Map;return a.orderSensitiveModifiers.forEach((n,r)=>{s.set(n,1e6+r)}),n=>{const r=[];let t=[];for(let o=0;o<n.length;o++){const l=n[o],c=l[0]==="[",b=s.has(l);c||b?(t.length>0&&(t.sort(),r.push(...t),t=[]),r.push(l)):t.push(l)}return t.length>0&&(t.sort(),r.push(...t)),r}},Bn=a=>({cache:Mn(a.cacheSize),parseClassName:Pn(a),sortModifiers:Dn(a),postfixLookupClassGroupIds:zn(a),...kn(a)}),zn=a=>{const s=Object.create(null),n=a.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)s[n[r]]=!0;return s},Un=/\s+/,On=(a,s)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:t,sortModifiers:o,postfixLookupClassGroupIds:l}=s,c=[],b=a.trim().split(Un);let u="";for(let h=b.length-1;h>=0;h-=1){const d=b[h],{isExternal:_,modifiers:f,hasImportantModifier:k,baseClassName:v,maybePostfixModifierPosition:m}=n(d);if(_){u=d+(u.length>0?" "+u:u);continue}let y=!!m,S;if(y){const M=v.substring(0,m);S=r(M);const i=S&&l[S]?r(v):void 0;i&&i!==S&&(S=i,y=!1)}else S=r(v);if(!S){if(!y){u=d+(u.length>0?" "+u:u);continue}if(S=r(v),!S){u=d+(u.length>0?" "+u:u);continue}y=!1}const O=f.length===0?"":f.length===1?f[0]:o(f).join(":"),I=k?O+Ma:O,P=I+S;if(c.indexOf(P)>-1)continue;c.push(P);const A=t(S,y);for(let M=0;M<A.length;++M){const i=A[M];c.push(I+i)}u=d+(u.length>0?" "+u:u)}return u},$n=(...a)=>{let s=0,n,r,t="";for(;s<a.length;)(n=a[s++])&&(r=is(n))&&(t&&(t+=" "),t+=r);return t},is=a=>{if(typeof a=="string")return a;let s,n="";for(let r=0;r<a.length;r++)a[r]&&(s=is(a[r]))&&(n&&(n+=" "),n+=s);return n},Fn=(a,...s)=>{let n,r,t,o;const l=b=>{const u=s.reduce((h,d)=>d(h),a());return n=Bn(u),r=n.cache.get,t=n.cache.set,o=c,c(b)},c=b=>{const u=r(b);if(u)return u;const h=On(b,n);return t(b,h),h};return o=l,(...b)=>o($n(...b))},qn=[],pe=a=>{const s=n=>n[a]||qn;return s.isThemeGetter=!0,s},ds=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,bs=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Wn=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Gn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Vn=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Kn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,jn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Yn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Le=a=>Wn.test(a),q=a=>!!a&&!Number.isNaN(Number(a)),Ce=a=>!!a&&Number.isInteger(Number(a)),xa=a=>a.endsWith("%")&&q(a.slice(0,-1)),Ae=a=>Gn.test(a),ps=()=>!0,Hn=a=>Vn.test(a)&&!Kn.test(a),Pa=()=>!1,Qn=a=>jn.test(a),Zn=a=>Yn.test(a),Xn=a=>!w(a)&&!C(a),Jn=a=>a.startsWith("@container")&&(a[10]==="/"&&a[11]!==void 0||a[11]==="s"&&a[16]!==void 0&&a.startsWith("-size/",10)||a[11]==="n"&&a[18]!==void 0&&a.startsWith("-normal/",10)),Rn=a=>Me(a,_s,Pa),w=a=>ds.test(a),Be=a=>Me(a,fs,Hn),us=a=>Me(a,lr,q),er=a=>Me(a,Ns,ps),ar=a=>Me(a,vs,Pa),hs=a=>Me(a,gs,Pa),sr=a=>Me(a,ys,Zn),sa=a=>Me(a,ks,Qn),C=a=>bs.test(a),He=a=>ze(a,fs),nr=a=>ze(a,vs),ms=a=>ze(a,gs),rr=a=>ze(a,_s),tr=a=>ze(a,ys),na=a=>ze(a,ks,!0),or=a=>ze(a,Ns,!0),Me=(a,s,n)=>{const r=ds.exec(a);return r?r[1]?s(r[1]):n(r[2]):!1},ze=(a,s,n=!1)=>{const r=bs.exec(a);return r?r[1]?s(r[1]):n:!1},gs=a=>a==="position"||a==="percentage",ys=a=>a==="image"||a==="url",_s=a=>a==="length"||a==="size"||a==="bg-size",fs=a=>a==="length",lr=a=>a==="number",vs=a=>a==="family-name",Ns=a=>a==="number"||a==="weight",ks=a=>a==="shadow",cr=Fn(()=>{const a=pe("color"),s=pe("font"),n=pe("text"),r=pe("font-weight"),t=pe("tracking"),o=pe("leading"),l=pe("breakpoint"),c=pe("container"),b=pe("spacing"),u=pe("radius"),h=pe("shadow"),d=pe("inset-shadow"),_=pe("text-shadow"),f=pe("drop-shadow"),k=pe("blur"),v=pe("perspective"),m=pe("aspect"),y=pe("ease"),S=pe("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],P=()=>[...I(),C,w],A=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],i=()=>[C,w,b],T=()=>[Le,"full","auto",...i()],E=()=>[Ce,"none","subgrid",C,w],ee=()=>["auto",{span:["full",Ce,C,w]},Ce,C,w],L=()=>[Ce,"auto",C,w],ne=()=>["auto","min","max","fr",C,w],se=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],K=()=>["auto",...i()],G=()=>[Le,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...i()],Z=()=>[Le,"screen","full","dvw","lvw","svw","min","max","fit",...i()],x=()=>[Le,"screen","full","lh","dvh","lvh","svh","min","max","fit",...i()],g=()=>[a,C,w],B=()=>[...I(),ms,hs,{position:[C,w]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],W=()=>["auto","cover","contain",rr,Rn,{size:[C,w]}],te=()=>[xa,He,Be],z=()=>["","none","full",u,C,w],H=()=>["",q,He,Be],ye=()=>["solid","dashed","dotted","double"],Se=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],j=()=>[q,xa,ms,hs],oe=()=>["","none",k,C,w],de=()=>["none",q,C,w],Ie=()=>["none",q,C,w],me=()=>[q,C,w],ge=()=>[Le,"full",...i()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ae],breakpoint:[Ae],color:[ps],container:[Ae],"drop-shadow":[Ae],ease:["in","out","in-out"],font:[Xn],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ae],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ae],shadow:[Ae],spacing:["px",q],text:[Ae],"text-shadow":[Ae],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Le,w,C,m]}],container:["container"],"container-type":[{"@container":["","normal","size",C,w]}],"container-named":[Jn],columns:[{columns:[q,w,C,c]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:P()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[Ce,"auto",C,w]}],basis:[{basis:[Le,"full","auto",c,...i()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[q,Le,"auto","initial","none",w]}],grow:[{grow:["",q,C,w]}],shrink:[{shrink:["",q,C,w]}],order:[{order:[Ce,"first","last","none",C,w]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:ee()}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:ee()}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ne()}],"auto-rows":[{"auto-rows":ne()}],gap:[{gap:i()}],"gap-x":[{"gap-x":i()}],"gap-y":[{"gap-y":i()}],"justify-content":[{justify:[...se(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...se()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":se()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:i()}],px:[{px:i()}],py:[{py:i()}],ps:[{ps:i()}],pe:[{pe:i()}],pbs:[{pbs:i()}],pbe:[{pbe:i()}],pt:[{pt:i()}],pr:[{pr:i()}],pb:[{pb:i()}],pl:[{pl:i()}],m:[{m:K()}],mx:[{mx:K()}],my:[{my:K()}],ms:[{ms:K()}],me:[{me:K()}],mbs:[{mbs:K()}],mbe:[{mbe:K()}],mt:[{mt:K()}],mr:[{mr:K()}],mb:[{mb:K()}],ml:[{ml:K()}],"space-x":[{"space-x":i()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":i()}],"space-y-reverse":["space-y-reverse"],size:[{size:G()}],"inline-size":[{inline:["auto",...Z()]}],"min-inline-size":[{"min-inline":["auto",...Z()]}],"max-inline-size":[{"max-inline":["none",...Z()]}],"block-size":[{block:["auto",...x()]}],"min-block-size":[{"min-block":["auto",...x()]}],"max-block-size":[{"max-block":["none",...x()]}],w:[{w:[c,"screen",...G()]}],"min-w":[{"min-w":[c,"screen","none",...G()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...G()]}],h:[{h:["screen","lh",...G()]}],"min-h":[{"min-h":["screen","lh","none",...G()]}],"max-h":[{"max-h":["screen","lh",...G()]}],"font-size":[{text:["base",n,He,Be]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,or,er]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",xa,w]}],"font-family":[{font:[nr,ar,s]}],"font-features":[{"font-features":[w]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[t,C,w]}],"line-clamp":[{"line-clamp":[q,"none",C,us]}],leading:[{leading:[o,...i()]}],"list-image":[{"list-image":["none",C,w]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",C,w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:g()}],"text-color":[{text:g()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ye(),"wavy"]}],"text-decoration-thickness":[{decoration:[q,"from-font","auto",C,Be]}],"text-decoration-color":[{decoration:g()}],"underline-offset":[{"underline-offset":[q,"auto",C,w]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:i()}],"tab-size":[{tab:[Ce,C,w]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",C,w]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",C,w]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:B()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:W()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ce,C,w],radial:["",C,w],conic:[Ce,C,w]},tr,sr]}],"bg-color":[{bg:g()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:g()}],"gradient-via":[{via:g()}],"gradient-to":[{to:g()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-bs":[{"border-bs":H()}],"border-w-be":[{"border-be":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":H()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ye(),"hidden","none"]}],"divide-style":[{divide:[...ye(),"hidden","none"]}],"border-color":[{border:g()}],"border-color-x":[{"border-x":g()}],"border-color-y":[{"border-y":g()}],"border-color-s":[{"border-s":g()}],"border-color-e":[{"border-e":g()}],"border-color-bs":[{"border-bs":g()}],"border-color-be":[{"border-be":g()}],"border-color-t":[{"border-t":g()}],"border-color-r":[{"border-r":g()}],"border-color-b":[{"border-b":g()}],"border-color-l":[{"border-l":g()}],"divide-color":[{divide:g()}],"outline-style":[{outline:[...ye(),"none","hidden"]}],"outline-offset":[{"outline-offset":[q,C,w]}],"outline-w":[{outline:["",q,He,Be]}],"outline-color":[{outline:g()}],shadow:[{shadow:["","none",h,na,sa]}],"shadow-color":[{shadow:g()}],"inset-shadow":[{"inset-shadow":["none",d,na,sa]}],"inset-shadow-color":[{"inset-shadow":g()}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:g()}],"ring-offset-w":[{"ring-offset":[q,Be]}],"ring-offset-color":[{"ring-offset":g()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":g()}],"text-shadow":[{"text-shadow":["none",_,na,sa]}],"text-shadow-color":[{"text-shadow":g()}],opacity:[{opacity:[q,C,w]}],"mix-blend":[{"mix-blend":[...Se(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Se()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[q]}],"mask-image-linear-from-pos":[{"mask-linear-from":j()}],"mask-image-linear-to-pos":[{"mask-linear-to":j()}],"mask-image-linear-from-color":[{"mask-linear-from":g()}],"mask-image-linear-to-color":[{"mask-linear-to":g()}],"mask-image-t-from-pos":[{"mask-t-from":j()}],"mask-image-t-to-pos":[{"mask-t-to":j()}],"mask-image-t-from-color":[{"mask-t-from":g()}],"mask-image-t-to-color":[{"mask-t-to":g()}],"mask-image-r-from-pos":[{"mask-r-from":j()}],"mask-image-r-to-pos":[{"mask-r-to":j()}],"mask-image-r-from-color":[{"mask-r-from":g()}],"mask-image-r-to-color":[{"mask-r-to":g()}],"mask-image-b-from-pos":[{"mask-b-from":j()}],"mask-image-b-to-pos":[{"mask-b-to":j()}],"mask-image-b-from-color":[{"mask-b-from":g()}],"mask-image-b-to-color":[{"mask-b-to":g()}],"mask-image-l-from-pos":[{"mask-l-from":j()}],"mask-image-l-to-pos":[{"mask-l-to":j()}],"mask-image-l-from-color":[{"mask-l-from":g()}],"mask-image-l-to-color":[{"mask-l-to":g()}],"mask-image-x-from-pos":[{"mask-x-from":j()}],"mask-image-x-to-pos":[{"mask-x-to":j()}],"mask-image-x-from-color":[{"mask-x-from":g()}],"mask-image-x-to-color":[{"mask-x-to":g()}],"mask-image-y-from-pos":[{"mask-y-from":j()}],"mask-image-y-to-pos":[{"mask-y-to":j()}],"mask-image-y-from-color":[{"mask-y-from":g()}],"mask-image-y-to-color":[{"mask-y-to":g()}],"mask-image-radial":[{"mask-radial":[C,w]}],"mask-image-radial-from-pos":[{"mask-radial-from":j()}],"mask-image-radial-to-pos":[{"mask-radial-to":j()}],"mask-image-radial-from-color":[{"mask-radial-from":g()}],"mask-image-radial-to-color":[{"mask-radial-to":g()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":I()}],"mask-image-conic-pos":[{"mask-conic":[q]}],"mask-image-conic-from-pos":[{"mask-conic-from":j()}],"mask-image-conic-to-pos":[{"mask-conic-to":j()}],"mask-image-conic-from-color":[{"mask-conic-from":g()}],"mask-image-conic-to-color":[{"mask-conic-to":g()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:B()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:W()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",C,w]}],filter:[{filter:["","none",C,w]}],blur:[{blur:oe()}],brightness:[{brightness:[q,C,w]}],contrast:[{contrast:[q,C,w]}],"drop-shadow":[{"drop-shadow":["","none",f,na,sa]}],"drop-shadow-color":[{"drop-shadow":g()}],grayscale:[{grayscale:["",q,C,w]}],"hue-rotate":[{"hue-rotate":[q,C,w]}],invert:[{invert:["",q,C,w]}],saturate:[{saturate:[q,C,w]}],sepia:[{sepia:["",q,C,w]}],"backdrop-filter":[{"backdrop-filter":["","none",C,w]}],"backdrop-blur":[{"backdrop-blur":oe()}],"backdrop-brightness":[{"backdrop-brightness":[q,C,w]}],"backdrop-contrast":[{"backdrop-contrast":[q,C,w]}],"backdrop-grayscale":[{"backdrop-grayscale":["",q,C,w]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[q,C,w]}],"backdrop-invert":[{"backdrop-invert":["",q,C,w]}],"backdrop-opacity":[{"backdrop-opacity":[q,C,w]}],"backdrop-saturate":[{"backdrop-saturate":[q,C,w]}],"backdrop-sepia":[{"backdrop-sepia":["",q,C,w]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":i()}],"border-spacing-x":[{"border-spacing-x":i()}],"border-spacing-y":[{"border-spacing-y":i()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",C,w]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[q,"initial",C,w]}],ease:[{ease:["linear","initial",y,C,w]}],delay:[{delay:[q,C,w]}],animate:[{animate:["none",S,C,w]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,C,w]}],"perspective-origin":[{"perspective-origin":P()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:Ie()}],"scale-x":[{"scale-x":Ie()}],"scale-y":[{"scale-y":Ie()}],"scale-z":[{"scale-z":Ie()}],"scale-3d":["scale-3d"],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[C,w,"","none","gpu","cpu"]}],"transform-origin":[{origin:P()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ge()}],"translate-x":[{"translate-x":ge()}],"translate-y":[{"translate-y":ge()}],"translate-z":[{"translate-z":ge()}],"translate-none":["translate-none"],zoom:[{zoom:[Ce,C,w]}],accent:[{accent:g()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:g()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",C,w]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":g()}],"scrollbar-track-color":[{"scrollbar-track":g()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":i()}],"scroll-mx":[{"scroll-mx":i()}],"scroll-my":[{"scroll-my":i()}],"scroll-ms":[{"scroll-ms":i()}],"scroll-me":[{"scroll-me":i()}],"scroll-mbs":[{"scroll-mbs":i()}],"scroll-mbe":[{"scroll-mbe":i()}],"scroll-mt":[{"scroll-mt":i()}],"scroll-mr":[{"scroll-mr":i()}],"scroll-mb":[{"scroll-mb":i()}],"scroll-ml":[{"scroll-ml":i()}],"scroll-p":[{"scroll-p":i()}],"scroll-px":[{"scroll-px":i()}],"scroll-py":[{"scroll-py":i()}],"scroll-ps":[{"scroll-ps":i()}],"scroll-pe":[{"scroll-pe":i()}],"scroll-pbs":[{"scroll-pbs":i()}],"scroll-pbe":[{"scroll-pbe":i()}],"scroll-pt":[{"scroll-pt":i()}],"scroll-pr":[{"scroll-pr":i()}],"scroll-pb":[{"scroll-pb":i()}],"scroll-pl":[{"scroll-pl":i()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",C,w]}],fill:[{fill:["none",...g()]}],"stroke-w":[{stroke:[q,He,Be,us]}],stroke:[{stroke:["none",...g()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function D(...a){return cr(_n(a))}function Q(a,s="usd",n=2){return new Intl.NumberFormat("en-US",{style:"currency",currency:s.toUpperCase(),minimumFractionDigits:n,maximumFractionDigits:n}).format(a)}function Ee(a,s="en-US"){return new Date(a).toLocaleDateString(s,{month:"short",day:"numeric",year:"numeric"})}function ws(a,s){const n=new Date(a);return n.setDate(n.getDate()+s),n.toISOString()}function J(a){return new Intl.NumberFormat("en-US").format(a)}function Ue(a){if(a<=0)return"0 MB";const s=a/1e9;if(s>=1)return`${Number.isInteger(s)?s:s.toFixed(1)} GB`;const n=a/1e6;return`${Number.isInteger(n)?n:n.toFixed(0)} MB`}function ae(a){return a.replace("Plan - ","")}function Qe(a){return{usd:"$",eur:"€",gbp:"£",cad:"$",aud:"$",jpy:"¥"}[a.toLowerCase()]??`${a.toUpperCase()} `}const Oe=["community","plus","team","enterprise","managed"],ir=["community","plus","team","enterprise","managed"];function ie(a){var r;const s=a.name.toLowerCase();if(s.includes("community")||s.includes("pay-as-you-go")||s.includes("free"))return"community";if(s.includes("plus"))return"plus";if(s.includes("team"))return"team";if(s.includes("managed"))return"managed";if(s.includes("enterprise"))return"enterprise";const n=(r=a.metadata)==null?void 0:r.legacyName;return ir.find(t=>t===n)??"community"}const Da="https://botpress.com/contact-us/managed-plan",ra={community:["AI usage included","3 seats","3 AI agents","Botpress Desk","Botpress Studio + ADK","Help center","1K table rows","100MB file storage","100MB vector DB storage","Community support"],plus:["3 seats","Unlimited AI agents","WhatsApp channel","Help Center custom domain","Whitelabel webchat","100K table rows","10GB file storage","1GB vector DB storage","Technical support via live chat"],team:["Unlimited seats","Teams, routing & RBAC","Team-level analytics","500K table rows","50GB file storage","5GB vector DB storage"],enterprise:["Voice channel","Dedicated support","SLA & security review","Custom storage"],managed:[]},Ba={"AI usage included":"A monthly allowance of AI model spend is bundled into every plan — no separate AI bill.","3 seats":"Up to 3 team members can collaborate in this workspace.","Unlimited seats":"Invite as many team members to the workspace as you need.","3 AI agents":"Build and publish up to 3 distinct AI agents.","Unlimited AI agents":"Build and publish as many AI agents as you need.","Botpress Desk":"The human-handoff inbox where agents triage and reply to live conversations.","Botpress Studio + ADK":"The visual Studio builder plus the Agent Development Kit for building agents in code.","Help center":"A hosted knowledge base your agent answers from and customers can browse.","Help Center custom domain":"Serve your help center from your own domain instead of a Botpress URL.","WhatsApp channel":"Connect your agent to WhatsApp to chat with customers there.","Voice channel":"Connect your agent to phone/voice so it can handle spoken conversations.","Whitelabel webchat":"Remove Botpress branding from the web chat widget so it’s fully your own.","Teams, routing & RBAC":"Organize members into teams, route conversations between them, and control access by role.","Team-level analytics":"Performance and volume metrics broken down per team.","Technical support via live chat":"Reach the Botpress support team over live chat for help.","Community support":"Get help from the Botpress community forum and Discord.","Dedicated support":"A named contact and priority support channel for your account.","SLA & security review":"A contractual uptime SLA and a security/compliance review for your procurement.","Custom storage":"Storage limits tailored to your workload, beyond the standard tiers."},dr=[{test:/table rows/i,describe:a=>`${a.replace(/ table rows/i,"")} rows across all your data tables.`},{test:/file storage/i,describe:a=>`${a.replace(/ file storage/i,"")} of uploaded files (documents, images, attachments).`},{test:/vector db storage/i,describe:a=>`${a.replace(/ vector db storage/i,"")} of embeddings for knowledge-base search and retrieval.`}];function za(a,s){var n;return s!=null&&s[a]?s[a]:Ba[a]?Ba[a]:(n=dr.find(r=>r.test.test(a)))==null?void 0:n.describe(a)}function ta(a,s,n){return a.prices[s.id]??a.prices[ie(s)]??a.prices[n]??null}function Ze(a){return a.replace("Add-on - ","")}function Cs(a){return(a==null?void 0:a.find(s=>{var n;return(((n=s.increments)==null?void 0:n.conversation_sessions)??0)>0}))??null}const Ss=[{key:"conversation_sessions",label:"Conversations / month",unit:"count"},{key:"table_rows",label:"Table rows",unit:"count"},{key:"vector_db_storage",label:"Vector DB storage",unit:"bytes"},{key:"file_storage",label:"File storage",unit:"bytes"}];function Is(a,s,n){var t;if(!s)return[];const r=[];for(const o of Ss){const l=a.features[o.key]??0;let c=0;for(const b of s){const u=((t=b.increments)==null?void 0:t[o.key])??0,h=n[b.id]??0;c+=u*h}c>0&&r.push({...o,now:l,next:l+c})}return r}function As(a,s,n){var t;if(!a)return[];const r=[];for(const o of Ss){const l=a.features[o.key]??0;let c=0;for(const b of s??[])c+=(((t=b.increments)==null?void 0:t[o.key])??0)*(n[b.id]??0);(l>0||c>0)&&r.push({...o,base:l,added:c,total:l+c})}return r}function oa(a,s,n){var l;const r=Cs(a);if(!r)return null;const t=((l=r.increments)==null?void 0:l.conversation_sessions)??0,o=ta(r,s,n);return t<=0||!o||o.amount<=0?null:{packSize:t,amount:o.amount,currency:o.currency}}const la=({variant:a="accent",children:s,className:n})=>e.jsx("span",{className:D("bpb-badge",`bpb-badge--${a}`,n),children:s}),ue=({variant:a="primary",size:s="md",block:n=!1,loading:r=!1,className:t,disabled:o,children:l,type:c="button",...b})=>e.jsxs("button",{type:c,className:D("bpb-btn",`bpb-btn--${a}`,`bpb-btn--${s}`,n&&"bpb-btn--block",t),disabled:o||r,"data-loading":r||void 0,...b,children:[r&&e.jsx("span",{className:"bpb-btn__spinner","aria-hidden":!0}),e.jsx("span",{className:"bpb-btn__label",children:l})]}),R=(a,s)=>({width:a??16,height:a??16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,...s}),Es=({size:a,...s})=>e.jsx("svg",{...R(a,s),children:e.jsx("path",{d:"M3 8.5l3.5 3.5L13 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Ua=({size:a,...s})=>e.jsxs("svg",{...R(a,s),children:[e.jsx("path",{d:"M8 1.5l1.4 3.6a1 1 0 00.6.6L13.5 7l-3.5 1.4a1 1 0 00-.6.6L8 12.5 6.6 9a1 1 0 00-.6-.6L2.5 7 6 5.7a1 1 0 00.6-.6L8 1.5z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),e.jsx("path",{d:"M12.8 11l.5 1.2 1.2.5-1.2.5-.5 1.3-.5-1.3-1.2-.5 1.2-.5.5-1.2z",fill:"currentColor"})]}),Ts=({size:a,...s})=>e.jsx("svg",{...R(a,s),children:e.jsx("path",{d:"M2.5 8a5.5 5.5 0 115.5 5.5c-.9 0-1.8-.2-2.5-.6L2.5 13.5l.6-3A5.5 5.5 0 012.5 8z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})}),Oa=({size:a,...s})=>e.jsxs("svg",{...R(a,s),children:[e.jsx("path",{d:"M8 1.8l5 1.8v4c0 3.2-2.1 5.4-5 6.6-2.9-1.2-5-3.4-5-6.6v-4l5-1.8z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),e.jsx("path",{d:"M5.8 8l1.6 1.6 2.8-3",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ls=({size:a,...s})=>e.jsx("svg",{...R(a,s),children:e.jsx("path",{d:"M6 2.5h3v1.6a1.4 1.4 0 102.8 0V2.5h1.7v3h-1.6a1.4 1.4 0 100 2.8h1.6v3h-3v1.6a1.4 1.4 0 11-2.8 0v-1.6h-3v-3h1.6a1.4 1.4 0 100-2.8H2.5v-3H6z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})}),ca=({size:a,...s})=>e.jsxs("svg",{...R(a,s),children:[e.jsx("path",{d:"M8 2l6 3-6 3-6-3 6-3z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),e.jsx("path",{d:"M2 8l6 3 6-3M2 11l6 3 6-3",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})]}),Ms=({size:a,...s})=>e.jsx("svg",{...R(a,s),children:e.jsx("path",{d:"M8 8c-1.2-1.6-2-2.4-3.3-2.4a2.4 2.4 0 100 4.8C6 10.4 6.8 9.6 8 8zm0 0c1.2 1.6 2 2.4 3.3 2.4a2.4 2.4 0 100-4.8C10 5.6 9.2 6.4 8 8z",stroke:"currentColor",strokeWidth:"1.3"})}),ia=({size:a,...s})=>e.jsx("svg",{...R(a,s),children:e.jsx("path",{d:"M8.5 1.5L3 9h4l-.5 5.5L12 7H8l.5-5.5z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})}),xs=({size:a,...s})=>e.jsxs("svg",{...R(a,s),children:[e.jsx("circle",{cx:"6",cy:"5.5",r:"2.2",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M2 13c0-2.2 1.8-3.6 4-3.6s4 1.4 4 3.6",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),e.jsx("path",{d:"M10.5 3.6a2.2 2.2 0 010 4.1M11 9.6c1.7.3 3 1.6 3 3.4",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]}),Ps=({size:a,...s})=>e.jsxs("svg",{...R(a,s),children:[e.jsx("path",{d:"M2.5 2.5v11h11",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M5 10l2.2-2.4 2 1.6L12.5 5.5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ds=({size:a,...s})=>e.jsxs("svg",{...R(a,s),children:[e.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M2 8h12M8 2c1.8 1.6 2.8 3.8 2.8 6S9.8 12.4 8 14C6.2 12.4 5.2 10.2 5.2 8S6.2 3.6 8 2z",stroke:"currentColor",strokeWidth:"1.3"})]}),Bs=({size:a,...s})=>e.jsxs("svg",{...R(a,s),children:[e.jsx("path",{d:"M2.5 11.5L9 5l2 2-6.5 6.5H2.5v-2z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),e.jsx("path",{d:"M9 5l1.8-1.8a1.4 1.4 0 012 2L11 7",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})]}),$a=({size:a,...s})=>e.jsxs("svg",{...R(a,s),children:[e.jsx("rect",{x:"1.8",y:"3.5",width:"12.4",height:"9",rx:"1.6",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M1.8 6.4h12.4",stroke:"currentColor",strokeWidth:"1.3"})]}),br=({size:a,...s})=>e.jsx("svg",{...R(a,s),children:e.jsx("path",{d:"M2 6l6-3.5L14 6v1H2V6zM3 7v5M6.3 7v5M9.7 7v5M13 7v5M2 12.5h12",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})}),pr=({size:a,...s})=>e.jsxs("svg",{...R(a,s),children:[e.jsx("rect",{x:"3.5",y:"7",width:"9",height:"6.5",rx:"1.4",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M5.5 7V5.5a2.5 2.5 0 015 0V7",stroke:"currentColor",strokeWidth:"1.3"})]}),da=({size:a,...s})=>e.jsx("svg",{...R(a,s),children:e.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),ba=({size:a,...s})=>e.jsx("svg",{...R(a,s),children:e.jsx("path",{d:"M4 6.5L8 10.5l4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),zs=({size:a,...s})=>e.jsx("svg",{...R(a,s),children:e.jsx("path",{d:"M10 3.5L5.5 8l4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),$e=({size:a,...s})=>e.jsx("svg",{...R(a,s),children:e.jsx("path",{d:"M6 3.5L10.5 8L6 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Us=({size:a,...s})=>e.jsx("svg",{...R(a,s),children:e.jsx("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Os=({size:a,...s})=>e.jsx("svg",{...R(a,s),children:e.jsx("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),$s=({size:a,...s})=>e.jsxs("svg",{...R(a,s),children:[e.jsx("path",{d:"M8 2.2L14.5 13.2a.7.7 0 01-.6 1H2.1a.7.7 0 01-.6-1L8 2.2z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),e.jsx("path",{d:"M8 6.3v3.1",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),e.jsx("circle",{cx:"8",cy:"11.6",r:"0.85",fill:"currentColor"})]}),Xe=({size:a,...s})=>e.jsx("svg",{...R(a,s),children:e.jsx("path",{d:"M9 3.5h3.5V7M12 4L7 9M11 9.5v2a1 1 0 01-1 1H4.5a1 1 0 01-1-1V6a1 1 0 011-1h2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),pa=({size:a,...s})=>e.jsx("svg",{...R(a,s),children:e.jsx("path",{d:"M3 8h10M9 4l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Fa=({size:a,...s})=>e.jsx("svg",{...R(a,s),children:e.jsx("path",{d:"M8 2.5v7M5 7l3 3 3-3M3 12.5h10",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),ur=({size:a,...s})=>e.jsxs("svg",{...R(a,s),children:[e.jsx("path",{d:"M4 2h8v12l-1.5-1-1.5 1-1.5-1-1.5 1L4 14V2z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),e.jsx("path",{d:"M6.2 5.5h3.6M6.2 8h3.6",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]}),Fs=({size:a,...s})=>e.jsxs("svg",{...R(a,s),children:[e.jsx("rect",{x:"2.5",y:"3.5",width:"11",height:"10",rx:"1.5",stroke:"currentColor",strokeWidth:"1.3"}),e.jsx("path",{d:"M2.5 6.5h11M5.5 2v2.5M10.5 2v2.5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]}),ua=({brand:a})=>{const s=a==="visa"?"VISA":a==="mastercard"?"MC":a==="amex"?"AMEX":a==="discover"?"DISC":a.slice(0,4).toUpperCase(),n=a==="visa"?"#1a1f71":a==="mastercard"?"#252525":a==="amex"?"#016fd0":"#5d5d5d";return e.jsx("span",{"aria-hidden":!0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:34,height:22,padding:"0 4px",borderRadius:4,background:n,color:"#fff",fontSize:9,fontWeight:700,letterSpacing:"0.04em"},children:s})};function ha(a){const s=a.toLowerCase();return/seat|member|user|team|rbac|rout/.test(s)?xs:/analytic|report|insight|dashboard/.test(s)?Ps:/whatsapp|channel|chat|message|conversation|webchat|voice/.test(s)?Ts:/storage|table|vector|file|gb|rows|db/.test(s)?ca:/domain|help center|whitelabel|website|url|web/.test(s)?Ds:/brand|theme|custom|white-?label/.test(s)?Bs:/unlimited|infinit/.test(s)?Ms:/security|sla|compliance|soc|audit/.test(s)||/support|sla|dedicated|priority/.test(s)?Oa:/integration|api|plugin|sdk|adk|studio/.test(s)?Ls:/ai|agent|model|gpt|llm/.test(s)?ia:Ua}const ve=({open:a,onOpenChange:s,size:n="md",children:r,className:t,showClose:o=!0,...l})=>{const c=N.useRef(null),b=yn(),u=N.useCallback(()=>s(!1),[s]);return N.useEffect(()=>{var _;if(!a)return;const h=f=>{f.key==="Escape"&&u()};document.addEventListener("keydown",h);const d=document.body.style.overflow;return document.body.style.overflow="hidden",(_=c.current)==null||_.focus(),()=>{document.removeEventListener("keydown",h),document.body.style.overflow=d}},[a,u]),a?un.createPortal(e.jsx("div",{className:"bpb-portal bpb-dialog__overlay","data-bpb-theme":b?"dark":"light",onClick:u,children:e.jsxs("div",{ref:c,role:"dialog","aria-modal":"true","aria-label":l["aria-label"],tabIndex:-1,className:D("bpb-dialog",`bpb-dialog--${n}`,t),onClick:h=>h.stopPropagation(),children:[o&&e.jsx("button",{type:"button",className:"bpb-dialog__close","aria-label":"Close",onClick:u,children:e.jsx(da,{size:18})}),r]})}),document.body):null},Je=({label:a,children:s})=>e.jsxs("span",{className:"bpb-tooltip",tabIndex:0,role:"note",children:[e.jsx("span",{className:"bpb-tooltip__term",children:a}),e.jsx("span",{className:"bpb-tooltip__bubble",role:"tooltip",children:s})]}),Fe=()=>{const{manageBillingUrl:a}=U();return e.jsxs("div",{className:"bpb-outdated",children:[e.jsx("h3",{className:"bpb-outdated__title",children:"Billing is managed in the Botpress Dashboard"}),e.jsx("p",{className:"bpb-outdated__text",children:"This workspace is on an earlier billing system, so plan changes and payment details can’t be managed here."}),a&&e.jsxs(ue,{variant:"primary",onClick:()=>window.open(a,"_blank","noopener"),children:["Open billing in Dashboard",e.jsx(Xe,{size:15})]})]})},qs=({options:a,value:s,onChange:n,className:r,...t})=>e.jsx("div",{role:"radiogroup","aria-label":t["aria-label"],className:D("bpb-segmented",r),children:a.map(o=>{const l=o.value===s;return e.jsxs("button",{type:"button",role:"radio","aria-checked":l,className:D("bpb-segmented__option",l&&"bpb-segmented__option--selected"),onClick:()=>n(o.value),children:[o.label,o.badge&&e.jsx("span",{className:"bpb-segmented__badge",children:o.badge})]},o.value)})}),V=({width:a,height:s=14,rounded:n=!1,className:r})=>e.jsx("span",{"aria-hidden":!0,className:D("bpb-skeleton",n&&"bpb-skeleton--rounded",r),style:{width:a??"100%",height:s}});function hr(a,s){const n=a.prices[s];return n||((s==="month"?a.prices.year:a.prices.month)??null)}function mr(a,s){var t,o;const n=(t=a.prices.month)==null?void 0:t.amount;if(s==="month")return n??null;const r=((o=a.prices.year)==null?void 0:o.amount)??(n===void 0?void 0:n*12);return r===void 0?null:r/12}function gr(a){var n,r;let s=0;for(const t of a){const o=(n=t.prices.month)==null?void 0:n.amount,l=(r=t.prices.year)==null?void 0:r.amount;o&&l&&o>0&&(s=Math.max(s,1-l/(o*12)))}return Math.round(s*100)}const Ws=({open:a,onOpenChange:s,onSelectPlan:n,recommendedPlanId:r="team",defaultInterval:t="year",excludePlanIds:o=[],planFeatures:l={},featureDescriptions:c})=>{var K,G,Z;const{isOutdatedBilling:b,toast:u,analytics:h}=U(),[d,_]=N.useState(t),{data:f,isLoading:k}=we(),{data:v}=Pe(),{data:m}=Ne({enabled:a}),{data:y}=Ca({enabled:a}),S=Ta(),O=(y==null?void 0:y.planReadonly)??!1;N.useEffect(()=>{a&&h.capture(le.PLAN_PICKER_VIEWED,{interval:d})},[a,h]);const I=x=>{x!==d&&h.capture(le.PLAN_INTERVAL_TOGGLED,{interval:x}),_(x)},P=m==null?void 0:m.plan.current.interval,A=f==null?void 0:f.find(x=>x.id===(m==null?void 0:m.plan.current.planId)),M=m?A?ie(A):"community":void 0,i=((K=m==null?void 0:m.plan.next)==null?void 0:K.planId)??null,T=!!i&&i!==(m==null?void 0:m.plan.current.planId),E=O||M==="enterprise"||M==="managed",ee=N.useMemo(()=>f?f.filter(x=>ie(x)!=="managed"&&ie(x)!=="enterprise"&&!o.includes(x.id)).sort((x,g)=>Oe.indexOf(ie(x))-Oe.indexOf(ie(g))):[],[f,o]),L=N.useMemo(()=>gr(ee),[ee]),ne=((Z=(G=f==null?void 0:f.find(x=>ie(x)==="enterprise"))==null?void 0:G.metadata)==null?void 0:Z.contact_url)??Da,se=x=>{S.mutate({planId:x.id,interval:d},{onSuccess:()=>{h.capture(le.PLAN_DOWNGRADED,{plan_name:ae(x.name),interval:d,previous_plan_name:A?ae(A.name):void 0}),u({type:"success",message:"Plan downgraded"})},onError:()=>u({type:"error",message:"Downgrade failed"})})},$=()=>{m&&S.mutate({planId:m.plan.current.planId,interval:m.plan.current.interval},{onSuccess:()=>{h.capture(le.PLAN_DOWNGRADE_CANCELLED,{plan_name:A?ae(A.name):m.plan.current.planId}),u({type:"success",message:"Scheduled downgrade canceled"})},onError:()=>u({type:"error",message:"Could not cancel the downgrade"})})};return b?e.jsx(ve,{open:a,onOpenChange:s,size:"md","aria-label":"Upgrade your plan",className:"bpb-scope",children:e.jsx(Fe,{})}):e.jsx(ve,{open:a,onOpenChange:s,size:"xl","aria-label":"Upgrade your plan",className:"bpb-scope",children:e.jsxs("div",{className:"bpb-upgrade",children:[e.jsx("h2",{className:"bpb-upgrade__title",children:"Upgrade your plan"}),e.jsx("div",{className:"bpb-upgrade__toggle",children:e.jsx(qs,{"aria-label":"Billing interval",value:d,onChange:I,options:[{value:"month",label:"Monthly"},{value:"year",label:"Annual",badge:L>0?`Save ${L}%`:void 0}]})}),e.jsxs("div",{className:"bpb-upgrade__grid",children:[k&&[0,1,2].map(x=>e.jsxs("div",{className:"bpb-plan-card","aria-hidden":!0,children:[e.jsx(V,{width:120,height:22}),e.jsx(V,{width:90,height:40}),e.jsx(V,{width:"100%",height:36,rounded:!0}),e.jsx(V,{width:"100%",height:140})]},x)),ee.map((x,g)=>{var he,X;const B=ie(x),F=hr(x,d),W=mr(x,d),te=(((he=x.prices.month)==null?void 0:he.amount)??0)<=0,z=B===M&&(M==="community"||d===P),H=B===M&&M!=="community"&&d!==P,ye=!!i&&x.id===i&&!z,Se=M!==void 0&&Oe.indexOf(B)<Oe.indexOf(M),j=(B===r||x.id===r)&&!z,oe=z&&T?"cancel_downgrade":z?"current":H?"switch_interval":ye?"next":Se?"downgrade":"upgrade",de=g>0?ee[g-1]:void 0,Ie=l[B]??ra[B],me=x.features.conversation_sessions,ge=oa(v,x,d),Y=S.isPending&&(oe==="downgrade"&&((X=S.variables)==null?void 0:X.planId)===x.id||oe==="cancel_downgrade");return e.jsxs("div",{className:D("bpb-plan-card",j&&"bpb-plan-card--highlighted bpb-glow"),"data-plan-id":x.id,children:[e.jsxs("div",{className:"bpb-plan-card__header",children:[e.jsxs("h3",{className:"bpb-plan-card__name",children:[ae(x.name),j&&e.jsx(la,{className:"bpb-plan-card__badge",children:"Recommended"})]}),e.jsx("p",{className:"bpb-plan-card__tagline",children:x.description}),e.jsx("div",{className:"bpb-plan-card__price",children:W!==null&&F?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"bpb-plan-card__currency",children:Qe(F.currency)}),e.jsx("span",{className:"bpb-plan-card__amount",children:Number.isInteger(W)?W:W.toFixed(2).replace(/\.00$/,"")}),e.jsxs("span",{className:"bpb-plan-card__per",children:["/ month (",F.currency.toUpperCase(),")"]})]}):e.jsx("span",{className:"bpb-plan-card__amount",children:Q(0,"usd",0)})})]}),me!==void 0&&e.jsxs("div",{className:"bpb-plan-card__allowance",children:[e.jsxs("div",{className:"bpb-plan-card__metric",children:[e.jsx("span",{className:"bpb-plan-card__metric-value",children:J(me)}),e.jsxs("span",{className:"bpb-plan-card__metric-unit",children:["conversations",te?"":" / month"]})]}),ge?e.jsxs("p",{className:"bpb-plan-card__pack",children:["then ",Q(ge.amount,ge.currency,0)," per"," ",J(ge.packSize)," more"]}):e.jsx("p",{className:"bpb-plan-card__pack",children:"No top-up"})]}),oe==="current"&&e.jsx(ue,{variant:"outline",block:!0,disabled:!0,children:"Your current plan"}),oe==="next"&&e.jsx(ue,{variant:"outline",block:!0,disabled:!0,children:"Next plan"}),oe==="cancel_downgrade"&&e.jsx(ue,{variant:"primary",block:!0,loading:Y,onClick:$,children:"Cancel downgrade"}),oe==="downgrade"&&e.jsx(ue,{variant:"outline",block:!0,disabled:E||S.isPending,loading:Y,onClick:()=>se(x),children:"Downgrade"}),oe==="switch_interval"&&e.jsx(ue,{variant:"primary",block:!0,disabled:E||S.isPending,title:E?"Your plan is managed by Botpress — contact us to change it":void 0,onClick:()=>{h.capture(le.PLAN_UPGRADE_INITIATED,{plan_name:ae(x.name),interval:d,current_plan_name:A?ae(A.name):void 0}),n(x.id,d)},children:d==="year"?"Switch to annual":"Switch to monthly"}),oe==="upgrade"&&e.jsx(ue,{variant:j?"accent":"primary",block:!0,disabled:E||S.isPending,title:E?"Your plan is managed by Botpress — contact us to change it":void 0,onClick:()=>{h.capture(le.PLAN_UPGRADE_INITIATED,{plan_name:ae(x.name),interval:d,current_plan_name:A?ae(A.name):void 0}),n(x.id,d)},children:"Upgrade"}),e.jsxs("ul",{className:"bpb-plan-card__features",children:[de&&e.jsxs("li",{className:"bpb-plan-card__features-lead",children:[e.jsx("span",{className:"bpb-plan-card__feature-chip bpb-plan-card__feature-chip--lead",children:e.jsx(Es,{size:13})}),e.jsxs("span",{children:["Everything in ",ae(de.name)]})]}),Ie.map(re=>{const ke=ha(re),xe=za(re,c);return e.jsxs("li",{children:[e.jsx("span",{className:"bpb-plan-card__feature-chip",children:e.jsx(ke,{size:13})}),xe?e.jsx(Je,{label:re,children:xe}):e.jsx("span",{children:re})]},re)})]})]},x.id)})]}),e.jsxs("p",{className:"bpb-upgrade__footer",children:["Need more, or running at scale?"," ",e.jsx("a",{href:ne,target:"_blank",rel:"noopener noreferrer",children:"Contact us"})," ","about Enterprise. Compare plans at"," ",e.jsx("a",{href:"https://botpress.com/pricing",target:"_blank",rel:"noopener noreferrer",children:"botpress.com/pricing"}),"."]})]})})},qa='-apple-system, "ui-sans-serif", "system-ui", "Segoe UI", Helvetica, Arial, sans-serif',Wa="14px",Gs="10px";function Ga(a){return a?{theme:"night",variables:{fontFamily:qa,fontSizeBase:Wa,borderRadius:Gs,colorPrimary:"#ececec",colorBackground:"#1c1c1c",colorText:"#f9f9f9",colorTextSecondary:"#b4b4b4",colorTextPlaceholder:"#9b9b9b",colorDanger:"#ff8583"},rules:{".Input":{backgroundColor:"#212121",border:"1px solid rgba(255,255,255,0.12)",boxShadow:"none",color:"#f9f9f9"},".Input:focus":{border:"1px solid rgba(255,255,255,0.3)",boxShadow:"none"},".Label":{color:"#ececec",fontWeight:"500",fontSize:"12px"},".Error":{color:"#ff8583"},".Tab":{border:"1px solid rgba(255,255,255,0.12)",boxShadow:"none"}}}:{theme:"stripe",variables:{fontFamily:qa,fontSizeBase:Wa,borderRadius:Gs,colorPrimary:"#0d0d0d",colorBackground:"#f7f7f7",colorText:"#0d0d0d",colorTextSecondary:"#5d5d5d",colorTextPlaceholder:"#8f8f8f",colorDanger:"#e02e2a"},rules:{".Input":{backgroundColor:"#f7f7f7",border:"1px solid transparent",boxShadow:"none",color:"#0d0d0d"},".Input:focus":{backgroundColor:"#fff",border:"1px solid #0d0d0d",boxShadow:"none"},".Label":{color:"#5d5d5d",fontWeight:"500",fontSize:"12px"},".Error":{color:"#e02e2a"},".Tab":{border:"1px solid #0d0d0d1a",boxShadow:"none",backgroundColor:"#f7f7f7"},".Tab--selected":{border:"1px solid #0d0d0d",backgroundColor:"#fff"},".Block":{backgroundColor:"#f9f9f9",boxShadow:"none"}}}}function Va(a){return{base:{fontFamily:qa,fontSize:Wa,color:a?"#f9f9f9":"#0d0d0d","::placeholder":{color:a?"#9b9b9b":"#8f8f8f"}},invalid:{color:a?"#ff8583":"#e02e2a"}}}const yr={pt:"pt-BR",es:"es-419"};function Ka(a){const s=a.split("-")[0]??a;return yr[s]??a}const _r=4,fr=({plan:a,interval:s,preview:n,isLoadingPreview:r,isPreviewError:t,canSubscribe:o,isSubmitting:l,onSubscribe:c})=>{var L,ne,se,$,K;const{locale:b}=U(),{data:u}=Pe(),h=((L=a==null?void 0:a.prices.month)==null?void 0:L.currency)??((ne=a==null?void 0:a.prices.year)==null?void 0:ne.currency)??"usd",d=a==null?void 0:a.features.conversation_sessions,_=a&&ie(a)==="community"?"conversations":"conversations / month",f=a?oa(u,a,s):null,k=(n==null?void 0:n.costs.immediate.amountDue)??0,v=(n==null?void 0:n.costs.immediate.accountBalance)??0,m=(n==null?void 0:n.costs.nextCycle.total)??0,y=n!=null&&n.nextBillingDate?Ee(ws(n.nextBillingDate,1),b):null,S=a?ra[ie(a)].slice(0,_r):[],O=a?((se=a.prices[s])==null?void 0:se.amount)??0:0,I=(n==null?void 0:n.costs.immediate.lineItems)??[],P=I.filter(G=>G.type==="discount"),A=I.filter(G=>G.type==="proration_credit"||G.type==="proration_charge").reduce((G,Z)=>G+Z.amount,0),M=!!(n!=null&&n.subscription.plan.effectiveDate),i=(($=a==null?void 0:a.prices.month)==null?void 0:$.amount)??0,T=((K=a==null?void 0:a.prices.year)==null?void 0:K.amount)??0,E=s==="year"&&i>0&&T>0?Math.round(i*12-T):0,ee=Math.round(E/12);return e.jsxs("div",{className:"bpb-summary-wrap",children:[e.jsxs("div",{className:"bpb-summary bpb-glow",children:[e.jsx("h3",{className:"bpb-summary__title",children:a?`${ae(a.name)} plan`:e.jsx(V,{width:140,height:24})}),d!==void 0&&e.jsxs("div",{className:"bpb-summary__metric",children:[e.jsx("span",{className:"bpb-summary__metric-value",children:J(d)}),e.jsx("span",{className:"bpb-summary__metric-unit",children:_}),f&&e.jsxs("span",{className:"bpb-summary__metric-pack",children:["then ",Q(f.amount,f.currency,0)," per ",J(f.packSize)]})]}),S.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"bpb-summary__features-label",children:"Top features"}),e.jsx("ul",{className:"bpb-summary__features",children:S.map(G=>{const Z=ha(G);return e.jsxs("li",{children:[e.jsx(Z,{size:16,className:"bpb-summary__feature-icon"}),e.jsx("span",{children:G})]},G)})})]}),e.jsx("hr",{className:"bpb-summary__divider"}),r&&e.jsxs("div",{className:"bpb-summary__lines","aria-busy":"true",children:[e.jsx(V,{height:16}),e.jsx(V,{height:16}),e.jsx(V,{height:20})]}),t&&e.jsx("p",{role:"alert",className:"bpb-summary__error",children:"We couldn’t compute your total. Try again in a moment."}),n&&!r&&M&&e.jsxs("div",{className:"bpb-summary__lines",children:[e.jsxs("div",{className:"bpb-summary__line",children:[e.jsxs("span",{className:"bpb-summary__line-label",children:[a?ae(a.name):""," plan",y?` — from ${y}`:""]}),e.jsxs("span",{className:"bpb-summary__line-amount",children:[Q(m,h),s==="year"?"/yr":"/mo"]})]}),e.jsxs("div",{className:"bpb-summary__line",children:[e.jsx("span",{className:"bpb-summary__line-label",children:e.jsx(Je,{label:"Prorated for today",children:"Switching mid-period, we charge only for the time left in your current billing period. The full plan price above is billed at your next renewal, not today."})}),e.jsx("span",{className:"bpb-summary__line-amount",children:Q(k,h)})]}),e.jsxs("div",{className:"bpb-summary__line bpb-summary__line--total",children:[e.jsx("span",{children:"Due today"}),e.jsx("span",{children:Q(k,h)})]}),A<0&&e.jsxs("p",{className:"bpb-summary__addon-note",children:["You have ",Q(Math.abs(A),h)," of unused time credited toward your next invoice."]})]}),n&&!r&&!M&&e.jsxs("div",{className:"bpb-summary__lines",children:[e.jsxs("div",{className:"bpb-summary__line",children:[e.jsxs("span",{className:"bpb-summary__line-label",children:[a?ae(a.name):""," plan (",s==="year"?"annual":"monthly",")"]}),e.jsxs("span",{className:"bpb-summary__line-amount",children:[Q(O,h),s==="year"?"/yr":"/mo"]})]}),P.map((G,Z)=>e.jsxs("div",{className:"bpb-summary__line",children:[e.jsx("span",{className:"bpb-summary__line-label",children:G.description}),e.jsx("span",{className:"bpb-summary__line-amount",children:Q(G.amount,h)})]},`${G.id}-${Z}`)),A!==0&&e.jsxs("div",{className:"bpb-summary__line",children:[e.jsx("span",{className:"bpb-summary__line-label",children:e.jsx(Je,{label:A<0?"Credit for unused time":"Adjustment for unused time",children:A<0?"You already paid for time left in your current billing period. We credit that unused time and re-apply it at your new rate, so you’re never double-charged.":"Switching mid-cycle means we prorate the difference between your old and new plan for the days remaining in your current billing period."})}),e.jsx("span",{className:"bpb-summary__line-amount",children:Q(A,h)})]}),v!==0&&e.jsxs("div",{className:"bpb-summary__line",children:[e.jsx("span",{className:"bpb-summary__line-label",children:"Account credit"}),e.jsx("span",{className:"bpb-summary__line-amount",children:Q(v,h)})]}),e.jsxs("div",{className:"bpb-summary__line bpb-summary__line--total",children:[e.jsx("span",{children:"Due today"}),e.jsx("span",{children:Q(k,h)})]}),A<0&&k===0&&e.jsxs("p",{className:"bpb-summary__addon-note",children:["Your remaining balance of ",Q(Math.abs(A),h)," is applied as credit on your next invoice."]})]}),E>0&&e.jsxs("div",{className:"bpb-summary__savings",children:[e.jsx(Ua,{size:18,className:"bpb-summary__savings-icon"}),e.jsxs("span",{children:["You’re saving ",Q(ee,h,0),"/month by choosing an annual plan. That’s"," ",Q(E,h,0),"/year."]})]}),e.jsx(ue,{variant:"primary",size:"lg",block:!0,className:"bpb-summary__cta",disabled:!o,loading:l,onClick:c,children:t?"Preview unavailable":"Subscribe"})]}),e.jsxs("p",{className:"bpb-summary__fineprint",children:["Renews ",s==="month"?"monthly":"annually"," until cancelled.",n&&` You’ll be charged ${Q(m,h)}${s==="month"?"/month":"/year"}${y?` starting ${y}`:""}.`," ","Cancel anytime in Settings. By subscribing, you authorize Botpress to store and charge your payment method."]})]})},vr=["AT","BE","BG","HR","CY","CZ","DK","EE","FI","FR","DE","GR","HU","IE","IT","LV","LT","LU","MT","NL","PL","PT","RO","SK","SI","ES","SE"],Nr={CA:[{type:"ca_bn",label:"CA BN",description:"Canadian BN"},{type:"ca_gst_hst",label:"CA GST/HST",description:"Canadian GST/HST number"},{type:"ca_qst",label:"CA QST",description:"Canadian QST number (Québec)"},{type:"ca_pst_bc",label:"CA PST-BC",description:"Canadian PST number (British Columbia)"},{type:"ca_pst_mb",label:"CA PST-MB",description:"Canadian PST number (Manitoba)"},{type:"ca_pst_sk",label:"CA PST-SK",description:"Canadian PST number (Saskatchewan)"}],US:[{type:"us_ein",label:"US EIN",description:"United States EIN"}],GB:[{type:"gb_vat",label:"GB VAT",description:"United Kingdom VAT number"}],AU:[{type:"au_abn",label:"AU ABN",description:"Australian Business Number"}],NZ:[{type:"nz_gst",label:"NZ GST",description:"New Zealand GST number"}],IN:[{type:"in_gst",label:"IN GST",description:"Indian GST number"}],JP:[{type:"jp_cn",label:"JP CN",description:"Japanese Corporate Number"}],BR:[{type:"br_cnpj",label:"BR CNPJ",description:"Brazilian CNPJ number"},{type:"br_cpf",label:"BR CPF",description:"Brazilian CPF number"}],MX:[{type:"mx_rfc",label:"MX RFC",description:"Mexican RFC number"}],CH:[{type:"ch_vat",label:"CH VAT",description:"Switzerland VAT number"}],AE:[{type:"ae_trn",label:"AE TRN",description:"United Arab Emirates TRN"}],SG:[{type:"sg_gst",label:"SG GST",description:"Singaporean GST number"},{type:"sg_uen",label:"SG UEN",description:"Singaporean UEN"}],ZA:[{type:"za_vat",label:"ZA VAT",description:"South African VAT number"}]},kr=[{type:"eu_vat",label:"EU VAT",description:"European VAT number"}];function Vs(a){if(!a)return[];const s=a.toUpperCase();return vr.includes(s)?kr:Nr[s]??[]}const ma=({label:a,className:s,id:n,...r})=>a?e.jsxs("label",{className:D("bpb-input",s),children:[e.jsx("span",{className:"bpb-input__label",children:a}),e.jsx("input",{className:"bpb-input__field bpb-input__field--labeled",id:n,...r})]}):e.jsx("input",{className:D("bpb-input__field",s),id:n,...r}),ja=({label:a,className:s,children:n,...r})=>e.jsxs("label",{className:D("bpb-input",s),children:[a&&e.jsx("span",{className:"bpb-input__label",children:a}),e.jsxs("span",{className:"bpb-input__select-wrap",children:[e.jsx("select",{className:D("bpb-input__field bpb-input__field--select",a&&"bpb-input__field--labeled"),...r,children:n}),e.jsx(ba,{size:16,className:"bpb-input__chevron"})]})]}),wr=({plan:a,interval:s,onChange:n})=>{const r=a.prices.month,t=a.prices.year,o=r&&t&&r.amount>0?Math.round((1-t.amount/(r.amount*12))*100):0;return e.jsxs("section",{className:"bpb-checkout__section",children:[e.jsx("h3",{className:"bpb-checkout__section-title",children:"Plan details"}),e.jsxs("div",{className:"bpb-interval-cards",role:"radiogroup","aria-label":"Billing interval",children:[r&&e.jsxs("button",{type:"button",role:"radio","aria-checked":s==="month",className:D("bpb-interval-card",s==="month"&&"bpb-interval-card--selected"),onClick:()=>n("month"),children:[e.jsx("span",{className:"bpb-interval-card__title",children:"Monthly billing"}),e.jsxs("span",{className:"bpb-interval-card__price",children:[Q(r.amount,r.currency,0)," /mo"]})]}),t&&e.jsxs("button",{type:"button",role:"radio","aria-checked":s==="year",className:D("bpb-interval-card",s==="year"&&"bpb-interval-card--selected"),onClick:()=>n("year"),children:[e.jsxs("span",{className:"bpb-interval-card__title",children:["Annual billing",o>0&&e.jsxs(la,{children:["Save ",o,"%"]})]}),e.jsxs("span",{className:"bpb-interval-card__price",children:[Q(t.amount/12,t.currency,0)," /mo"]})]})]})]})},Ya=({number:a,title:s,onEdit:n})=>e.jsxs("div",{className:"bpb-step__header",children:[n?e.jsxs("button",{type:"button",className:"bpb-step__title bpb-step__title--button",onClick:n,children:[a,". ",s]}):e.jsxs("h3",{className:"bpb-step__title",children:[a,". ",s]}),n&&e.jsx("button",{type:"button",className:"bpb-step__edit",onClick:n,children:"Edit"})]}),Cr=({stepNumber:a,collapsed:s,summary:n,savedCard:r,isDark:t,tab:o,onTabChange:l,onPaymentChange:c,canContinue:b,onContinue:u,onEdit:h})=>{const[d,_]=N.useState(!1),f=o==="new"||!r;return e.jsxs("section",{className:D("bpb-step",s&&"bpb-step--collapsed"),children:[e.jsx(Ya,{number:a,title:"Payment method",onEdit:s?h:void 0}),s?r&&o!=="new"?e.jsxs("div",{className:"bpb-saved-card bpb-saved-card--readonly",children:[e.jsx(ua,{brand:r.brand}),e.jsxs("span",{className:"bpb-saved-card__number",children:[e.jsx("span",{className:"bpb-saved-card__brand",children:r.brand})," •••• ",r.lastFour]}),e.jsxs("span",{className:"bpb-saved-card__exp",children:[String(r.expMonth).padStart(2,"0"),"/",String(r.expYear).slice(-2)]})]}):e.jsx("p",{className:"bpb-step__summary",children:n}):e.jsxs(e.Fragment,{children:[r&&e.jsxs("div",{className:"bpb-pay-tabs",role:"tablist","aria-label":"Payment method",children:[e.jsxs("button",{type:"button",role:"tab","aria-selected":o==="saved",className:D("bpb-pay-tab",o==="saved"&&"bpb-pay-tab--selected"),onClick:()=>l("saved"),children:[e.jsx($a,{size:16}),"Saved"]}),e.jsxs("button",{type:"button",role:"tab","aria-selected":o==="new",className:D("bpb-pay-tab",o==="new"&&"bpb-pay-tab--selected"),onClick:()=>l("new"),children:[e.jsx($a,{size:16}),"New card"]})]}),r&&o==="saved"&&e.jsxs("div",{className:"bpb-saved-card",children:[e.jsx(ua,{brand:r.brand}),e.jsxs("span",{className:"bpb-saved-card__number",children:[e.jsx("span",{className:"bpb-saved-card__brand",children:r.brand})," •••• ",r.lastFour]}),e.jsxs("span",{className:"bpb-saved-card__exp",children:[String(r.expMonth).padStart(2,"0"),"/",String(r.expYear).slice(-2)]})]})]}),f&&e.jsxs("div",{className:D("bpb-payment-element",s&&"bpb-payment-element--hidden"),children:[!d&&!s&&e.jsx("div",{className:"bpb-payment-element__skeleton",children:e.jsx(V,{height:48})}),e.jsx("div",{className:D("bpb-card-element",!d&&"bpb-payment-element--hidden"),children:e.jsx(fe.CardElement,{options:{style:Va(t),hidePostalCode:!0},onReady:()=>_(!0),onChange:k=>c(k.complete)})})]}),!s&&e.jsx(ue,{variant:"primary",block:!0,disabled:!b,onClick:u,children:"Next"})]})},Sr=({stepNumber:a,collapsed:s,summary:n,onEditStep:r,existingAddress:t,customerName:o,isLoading:l,editing:c,onEdit:b,onCancelEdit:u,onCompleteChange:h,onCountryChange:d,country:_,isBusiness:f,onIsBusinessChange:k,businessName:v,onBusinessNameChange:m,taxType:y,onTaxTypeChange:S,taxValue:O,onTaxValueChange:I})=>{const[P,A]=N.useState(!1),M=c||!t,i=Vs(_),T=i.find(E=>E.type===y);return s?e.jsxs("section",{className:"bpb-step bpb-step--collapsed",children:[e.jsx(Ya,{number:a,title:"Billing address",onEdit:r}),t?e.jsx("div",{className:"bpb-address-card bpb-address-card--readonly",children:e.jsxs("div",{className:"bpb-address-card__lines",children:[o&&e.jsx("span",{className:"bpb-address-card__name",children:o}),e.jsxs("span",{children:[t.lineOne,t.lineTwo?`, ${t.lineTwo}`:""]}),e.jsx("span",{children:[t.city,t.state,t.postalCode,t.country].filter(Boolean).join(", ")})]})}):e.jsx("p",{className:"bpb-step__summary",children:n})]}):e.jsxs("section",{className:"bpb-step",children:[e.jsx(Ya,{number:a,title:"Billing address"}),l?e.jsx(V,{height:72}):M?e.jsxs("div",{className:"bpb-payment-element",children:[!P&&e.jsxs("div",{className:"bpb-payment-element__skeleton",children:[e.jsx(V,{height:48}),e.jsx(V,{height:48})]}),e.jsx("div",{className:D(!P&&"bpb-payment-element--hidden"),children:e.jsx(fe.AddressElement,{options:{mode:"billing",display:{name:"full"},defaultValues:t?{name:o??void 0,address:{line1:t.lineOne,line2:t.lineTwo,city:t.city,state:t.state,postal_code:t.postalCode,country:t.country}}:void 0},onReady:()=>A(!0),onChange:E=>{h(E.complete),d(E.value.address.country||void 0)}})}),u&&c&&e.jsx("button",{type:"button",className:"bpb-address-cancel",onClick:u,children:"Cancel"})]}):e.jsxs("div",{className:"bpb-address-card",children:[e.jsxs("div",{className:"bpb-address-card__lines",children:[o&&e.jsx("span",{className:"bpb-address-card__name",children:o}),e.jsxs("span",{children:[t.lineOne,t.lineTwo?`, ${t.lineTwo}`:""]}),e.jsxs("span",{children:[t.city," ",t.state??""," ",t.postalCode," ",t.country]})]}),e.jsx("button",{type:"button",className:"bpb-link-button",onClick:b,children:"Update"})]}),e.jsxs("label",{className:"bpb-checkbox",children:[e.jsx("input",{type:"checkbox",checked:f,onChange:E=>{k(E.target.checked),E.target.checked&&!y&&i[0]&&S(i[0].type)}}),e.jsx("span",{children:"I’m purchasing as business"})]}),f&&e.jsxs("div",{className:"bpb-business-fields",children:[e.jsx("h4",{className:"bpb-step__subtitle",children:"Business details"}),e.jsx(ma,{placeholder:"Business name",value:v,onChange:E=>m(E.target.value),autoComplete:"organization"}),i.length>0?e.jsxs(e.Fragment,{children:[e.jsx(ja,{"aria-label":"Tax ID type",value:y,onChange:E=>S(E.target.value),children:i.map(E=>e.jsxs("option",{value:E.type,children:[E.label," — ",E.description]},E.type))}),e.jsx(ma,{placeholder:T?T.description:"Tax ID number",value:O,onChange:E=>I(E.target.value),inputMode:"text"})]}):e.jsx("p",{className:"bpb-business-fields__note",children:_?"No tax ID is required for your billing country.":"Select your billing country above to add a tax ID."})]})]})},Ir=({planId:a,initialInterval:s,clientSecret:n,onSuccess:r})=>{var tn;const t=fe.useStripe(),o=fe.useElements(),{email:l,toast:c,analytics:b,isDark:u}=U(),[h,d]=N.useState(s),[_,f]=N.useState("payment"),[k,v]=N.useState(!1),[m,y]=N.useState(null),[S,O]=N.useState(!1),[I,P]=N.useState(!1),[A,M]=N.useState(!1),[i,T]=N.useState(void 0),[E,ee]=N.useState(!1),[L,ne]=N.useState(""),[se,$]=N.useState(""),[K,G]=N.useState(""),[Z,x]=N.useState(!1),[g,B]=N.useState(null),{data:F}=we(),{data:W}=Ne(),{data:te,isLoading:z}=Na(),{data:H,isLoading:ye}=ka(),{data:Se}=wa(),j=F==null?void 0:F.find(_e=>_e.id===a),oe=((tn=te==null?void 0:te.paymentMethod)==null?void 0:tn.card)??null,de=(H==null?void 0:H.address)??null;N.useEffect(()=>{m===null&&!z&&te!==void 0&&y(oe?"saved":"new")},[m,z,te,oe]),N.useEffect(()=>{i===void 0&&de&&T(de.country)},[i,de]);const Ie=N.useMemo(()=>({plan:{planId:a,interval:h}}),[a,h]),me=va(Ie),ge=Ia(),Y=Aa(),he=Ea(),X=Ta(),re=j?ae(j.name):"";N.useEffect(()=>{b.capture(le.CHECKOUT_STEP_VIEWED,{step:_,plan_name:re,interval:h})},[_,b]);const ke=m==="new"||!oe,xe=I||!de,ea=ke?S:!!oe,nn=xe?A:!0,qe=_e=>{_e!==h&&b.capture(le.CHECKOUT_INTERVAL_CHANGED,{plan_name:re,interval:_e}),d(_e)},Xr=_e=>{b.capture(le.PAYMENT_METHOD_SELECTED,{method:_e==="saved"?"saved_card":"new_card"}),y(_e)},rn=()=>{ea&&(v(!0),f("address"))},Jr=_==="address"&&!!t&&!!o&&!!j&&!me.isError&&!!me.data&&ea&&nn&&!Z,Rr=oe?`${oe.brand.charAt(0).toUpperCase()}${oe.brand.slice(1)} •••• ${oe.lastFour}`:null,et=ke?"New card":Rr??"Saved card",at=de?`${de.city}${de.state?`, ${de.state}`:""} ${de.country}`:"Not set",st=async()=>{var on,ln,cn,dn;if(!t||!o||!j)return;x(!0),B(null);const _e=(We,_a)=>b.capture(le.CHECKOUT_ERROR,{plan_name:re,interval:h,step:_,reason:We,message:_a});try{if(b.capture(le.PAYMENT_DETAILS_CONFIRMED,{plan_name:re,interval:h}),ke){const Ge=o.getElement(fe.CardElement);if(!Ge){B("Card field is not ready"),_e("card_element_not_ready");return}const{error:Ve,setupIntent:Te}=await t.confirmCardSetup(n,{payment_method:{card:Ge}});if(Ve){B(Ve.message??"Payment setup failed"),b.capture(le.CHECKOUT_ERROR,{plan_name:re,interval:h,step:_,reason:Ve.code??"card_setup_failed",decline_code:Ve.decline_code,message:Ve.message});return}if(!(Te!=null&&Te.payment_method)||typeof Te.payment_method!="string"){B("Could not retrieve payment method"),_e("payment_method_missing");return}await ge.mutateAsync({paymentMethodId:Te.payment_method})}let We;if(xe){const Ge=o.getElement("address");if(Ge){const{complete:Ve,value:Te}=await Ge.getValue();if(!Ve||!Te.address){B("Please complete your billing address"),_e("address_incomplete");return}const{address:Ye}=Te;We=((on=Te.name)==null?void 0:on.trim())||void 0,await Y.mutateAsync({lineOne:Ye.line1??"",lineTwo:Ye.line2??void 0,city:Ye.city??"",state:Ye.state??void 0,postalCode:Ye.postal_code??"",country:Ye.country??""})}}const _a=E&&L.trim()||We||void 0,bn=E&&se&&K.trim()?[{type:se,value:K.trim()}]:void 0;(_a!==void 0||bn!==void 0)&&await he.mutateAsync({name:_a,taxIds:bn});const nt=((ln=me.data)==null?void 0:ln.costs.immediate.amountDue)??0,rt=((cn=me.data)==null?void 0:cn.costs.nextCycle.total)??0;await X.mutateAsync({planId:a,interval:h}),b.capture(le.PLAN_UPGRADED,{plan_name:re,interval:h,amount_paid:nt,next_cycle_amount:rt,previous_plan_name:(dn=F==null?void 0:F.find(Ge=>Ge.id===(W==null?void 0:W.plan.current.planId)))==null?void 0:dn.name.replace("Plan - ",""),previous_interval:W==null?void 0:W.plan.current.interval}),c({type:"success",message:"Subscription activated"}),r()}catch(We){B("Something went wrong while processing your payment. You have not been charged twice."),_e("exception",We instanceof Error?We.message:void 0),c({type:"error",message:"Payment error"})}finally{x(!1)}};return e.jsxs("div",{className:"bpb-checkout__columns",children:[e.jsxs("div",{className:"bpb-checkout__main",children:[j&&e.jsx(wr,{plan:j,interval:h,onChange:qe}),l&&e.jsxs("section",{className:"bpb-checkout__section",children:[e.jsx("h3",{className:"bpb-checkout__section-title",children:"Contact information"}),e.jsxs("div",{className:"bpb-checkout__static-field",children:[e.jsx("span",{className:"bpb-checkout__static-label",children:"Email"}),e.jsx("span",{children:l})]})]}),e.jsx(Cr,{stepNumber:1,collapsed:_!=="payment",summary:et,savedCard:oe,isDark:u,tab:m??"new",onTabChange:Xr,onPaymentChange:O,canContinue:ea,onContinue:rn,onEdit:()=>f("payment")}),k&&e.jsx(Sr,{stepNumber:2,collapsed:_!=="address",summary:at,onEditStep:rn,existingAddress:de,customerName:(Se==null?void 0:Se.name)??null,isLoading:ye,editing:I,onEdit:()=>P(!0),onCancelEdit:de?()=>P(!1):void 0,onCompleteChange:M,onCountryChange:T,country:i,isBusiness:E,onIsBusinessChange:ee,businessName:L,onBusinessNameChange:ne,taxType:se,onTaxTypeChange:$,taxValue:K,onTaxValueChange:G}),g&&e.jsx("p",{role:"alert",className:"bpb-checkout__submit-error",children:g})]}),e.jsx("div",{className:"bpb-checkout__aside",children:e.jsx(fr,{plan:j,interval:h,preview:me.data,isLoadingPreview:me.isLoading,isPreviewError:me.isError,canSubscribe:Jr,isSubmitting:Z,onSubscribe:()=>void st()})})]})},Ks=({open:a,onOpenChange:s,planId:n,interval:r,onBack:t,onSuccess:o})=>{var v;const{stripePromise:l,isDark:c,locale:b,isOutdatedBilling:u}=U(),h=Sa(),d=(v=h.data)==null?void 0:v.clientSecret,{mutate:_,reset:f}=h;N.useEffect(()=>{a&&!u?_():f()},[a,u,_,f]);const k=N.useMemo(()=>d?{clientSecret:d,appearance:Ga(c),locale:Ka(b)}:null,[d,c,b]);return u?e.jsx(ve,{open:a,onOpenChange:s,size:"md","aria-label":"Configure your plan",className:"bpb-scope",children:e.jsx(Fe,{})}):e.jsx(ve,{open:a,onOpenChange:s,size:"xl","aria-label":"Configure your plan",className:"bpb-scope",children:e.jsxs("div",{className:"bpb-checkout",children:[e.jsxs("header",{className:"bpb-checkout__header",children:[t&&e.jsx("button",{type:"button",className:"bpb-checkout__back","aria-label":"Back to plans",onClick:t,children:"‹"}),e.jsx("h2",{className:"bpb-checkout__title",children:"Configure your plan"})]}),h.isError?e.jsxs("div",{className:"bpb-checkout__error-state",children:[e.jsx("p",{children:"We couldn’t start the payment session."}),h.error instanceof Error&&h.error.message&&e.jsx("p",{className:"bpb-checkout__error-detail",children:h.error.message}),e.jsx("p",{className:"bpb-checkout__error-detail",children:"If this persists, the workspace may not exist in this environment or may not be on billing v4."}),e.jsx(ue,{variant:"outline",onClick:()=>_(),children:"Try again"})]}):!k||!d?e.jsxs("div",{className:"bpb-checkout__columns","aria-busy":"true",children:[e.jsxs("div",{className:"bpb-checkout__main",children:[e.jsx(V,{height:56}),e.jsx(V,{height:56}),e.jsx(V,{height:120}),e.jsx(V,{height:56})]}),e.jsx("div",{className:"bpb-checkout__aside",children:e.jsx(V,{height:320})})]}):e.jsx(fe.Elements,{stripe:l,options:k,children:e.jsx(Ir,{planId:n,initialInterval:r,clientSecret:d,onSuccess:()=>{s(!1),o==null||o()}})})]})})},js=({value:a,onChange:s,min:n=0,max:r,step:t=1,className:o,...l})=>{const c=()=>s(Math.max(n,a-t)),b=()=>s(r===void 0?a+t:Math.min(r,a+t));return e.jsxs("div",{className:D("bpb-stepper",o),children:[e.jsx("button",{type:"button",className:"bpb-stepper__btn","aria-label":`Decrease ${l["aria-label"]}`,onClick:c,disabled:a<=n,children:e.jsx(Us,{size:14})}),e.jsx("span",{className:"bpb-stepper__value","aria-label":l["aria-label"],children:a}),e.jsx("button",{type:"button",className:"bpb-stepper__btn","aria-label":`Increase ${l["aria-label"]}`,onClick:b,disabled:r!==void 0&&a>=r,children:e.jsx(Os,{size:14})})]})},Ar=({open:a,onOpenChange:s,onSuccess:n})=>{const{isOutdatedBilling:r}=U();return r?e.jsx(ve,{open:a,onOpenChange:s,size:"md","aria-label":"Manage add-ons",className:"bpb-scope",children:e.jsx(Fe,{})}):e.jsx(ve,{open:a,onOpenChange:s,size:"md","aria-label":"Manage add-ons",className:"bpb-scope",children:e.jsx(Er,{onOpenChange:s,onSuccess:n})})},Er=({onOpenChange:a,onSuccess:s})=>{var K,G,Z,x;const{toast:n,locale:r}=U(),{data:t}=Ne(),{data:o}=Pe(),{data:l}=we(),{data:c}=Ca(),b=as(),[u,h]=N.useState(null),d=l==null?void 0:l.find(g=>g.id===(t==null?void 0:t.plan.current.planId)),_=(t==null?void 0:t.plan.current.interval)??"month",f=(c==null?void 0:c.addonsReadonly)??!1,k=t!=null&&t.plan.current.periodEnd?Ee(t.plan.current.periodEnd,r):null,v=N.useMemo(()=>{var B;if(!t||!o)return null;const g={};for(const F of o){const W=t.addons[F.id];g[F.id]=((B=W==null?void 0:W.next)==null?void 0:B.quantity)??(W==null?void 0:W.current.quantity)??0}return g},[t,o]),m=u??v,y=N.useMemo(()=>!o||!d?[]:o.flatMap(g=>{const B=ta(g,d,_);return B?[{addon:g,price:B}]:[]}),[o,d,_]),S=!!m&&!!v&&Object.keys(m).some(g=>m[g]!==v[g]),O=y.reduce((g,{addon:B,price:F})=>g+((m==null?void 0:m[B.id])??0)*F.amount,0),I=N.useMemo(()=>d&&m?{plan:{planId:d.id,interval:_},addons:m}:null,[d,_,m]),P=va(I??{plan:{planId:"",interval:_}},{enabled:!!I&&S}),A=((K=d==null?void 0:d.prices[_])==null?void 0:K.currency)??"usd",M=((G=P.data)==null?void 0:G.costs.immediate.amountDue)??0,i=(Z=P.data)!=null&&Z.nextBillingDate?Ee(P.data.nextBillingDate,r):null,T=((x=d==null?void 0:d.prices[_])==null?void 0:x.amount)??0,E=T+O,ee=d&&m?Is(d,o,m):[],L=(g,B)=>B==="bytes"?Ue(g):J(g),ne=(g,B)=>{const F=o==null?void 0:o.find(H=>H.id===g),W=F==null?void 0:F.increments;if(!W||B<=0)return null;const te=W.conversation_sessions??0;if(te>0)return`${J(te*B)} convos`;const z=W.file_storage??0;return z>0?Ue(z*B):null},se=()=>{m&&b.mutate({addons:m},{onSuccess:()=>{n({type:"success",message:"Subscription updated"}),a(!1),s==null||s()},onError:()=>n({type:"error",message:"Could not update your add-ons"})})},$=!t||!o||!l;return e.jsxs("div",{className:"bpb-manage-addons",children:[e.jsx("h2",{className:"bpb-manage-addons__title",children:"Manage add-ons"}),e.jsx("p",{className:"bpb-manage-addons__subtitle",children:d?`Additional usage for your ${ae(d.name)} plan. Set a quantity to 0 to remove an add-on.`:"Additional usage for your plan. Set a quantity to 0 to remove an add-on."}),$?e.jsxs("div",{className:"bpb-manage-addons__loading","aria-busy":"true",children:[e.jsx(V,{height:56}),e.jsx(V,{height:56})]}):y.length===0?e.jsxs("p",{className:"bpb-manage-addons__empty",children:["Add-ons aren’t available on the ",d?ae(d.name):"current"," plan. Upgrade to a paid plan to add extra usage."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bpb-addons",children:y.map(({addon:g,price:B})=>{var z;const F=((z=t==null?void 0:t.addons[g.id])==null?void 0:z.current.quantity)??0,W=(m==null?void 0:m[g.id])??0,te=W!==F?W===0?`${F} active now · removed${k?` ${k}`:" next cycle"}`:`${F} active now · ${W}${k?` from ${k}`:" next cycle"}`:F>0?`${F} active`:null;return e.jsxs("div",{className:"bpb-addon-row",children:[e.jsxs("div",{className:"bpb-addon-row__info",children:[e.jsx("span",{className:"bpb-addon-row__name",children:Ze(g.name)}),e.jsx("span",{className:"bpb-addon-row__description",children:g.description}),e.jsxs("span",{className:"bpb-addon-row__price",children:[Q(B.amount,B.currency)," each"]}),te&&e.jsx("span",{className:D("bpb-addon-row__status",W!==F&&"bpb-addon-row__status--changed"),children:te})]}),e.jsxs("div",{className:"bpb-addon-row__control",children:[ne(g.id,W)&&e.jsx("span",{className:"bpb-addon-row__grant",children:ne(g.id,W)}),e.jsx(js,{"aria-label":`${Ze(g.name)} quantity`,value:W,onChange:H=>h({...m??{},[g.id]:H})})]})]},g.id)})}),ee.length>0&&e.jsxs("div",{className:"bpb-manage-addons__limits",children:[e.jsx("p",{className:"bpb-manage-addons__limits-title",children:"Your new limits"}),ee.map(g=>e.jsxs("div",{className:"bpb-manage-addons__limit-row",children:[e.jsx("span",{className:"bpb-manage-addons__limit-label",children:g.label}),e.jsxs("span",{className:"bpb-manage-addons__limit-values",children:[e.jsx("span",{className:"bpb-manage-addons__limit-now",children:L(g.now,g.unit)}),e.jsx("span",{className:"bpb-manage-addons__limit-arrow","aria-hidden":!0,children:"→"}),e.jsx("span",{className:"bpb-manage-addons__limit-next",children:L(g.next,g.unit)})]})]},g.key))]}),e.jsxs("div",{className:"bpb-manage-addons__totals",children:[e.jsxs("div",{className:"bpb-manage-addons__line",children:[e.jsx("span",{children:d?`${ae(d.name)} plan`:"Plan"}),e.jsx("span",{children:Q(T,A)})]}),y.map(({addon:g,price:B})=>{const F=(m==null?void 0:m[g.id])??0;return F<=0?null:e.jsxs("div",{className:"bpb-manage-addons__line",children:[e.jsxs("span",{children:[F,"× ",Ze(g.name)]}),e.jsx("span",{children:Q(B.amount*F,A)})]},g.id)}),e.jsxs("div",{className:"bpb-manage-addons__line bpb-manage-addons__line--total",children:[e.jsxs("span",{children:["Total ",_==="year"?"yearly":"monthly"," cost"]}),e.jsxs("span",{children:[Q(E,A),_==="year"?"/yr":"/mo"]})]}),S&&e.jsxs("div",{className:"bpb-manage-addons__line bpb-manage-addons__line--due",children:[e.jsx("span",{children:"Due today"}),e.jsx("span",{children:P.isLoading?"…":P.isError?"—":Q(Math.max(M,0),A)})]})]}),S&&!P.isError&&e.jsxs("p",{className:"bpb-manage-addons__note",children:[M>0?`You’ll be charged ${Q(M,A)} now for the rest of this billing period. `:"No charge today — the change is prorated. ","Add-ons stay active until you remove them and renew with your plan",i?` on ${i}`:"",", when you’ll be billed ",Q(O,A),_==="year"?"/yr":"/mo"," for them."]}),f&&e.jsx("p",{className:"bpb-manage-addons__note",role:"alert",children:"Add-ons for this workspace are managed by Botpress — contact us to change them."}),e.jsxs("div",{className:"bpb-manage-addons__actions",children:[e.jsx(ue,{variant:"outline",onClick:()=>a(!1),disabled:b.isPending,children:"Cancel"}),e.jsx(ue,{variant:"primary",disabled:!S||f,loading:b.isPending,onClick:se,children:"Update subscription"})]})]})]})},Tr={paid:"Paid",open:"Due",draft:"Draft",uncollectible:"Unpaid",void:"Void"},Lr=({open:a,onOpenChange:s})=>{const{isOutdatedBilling:n}=U();return n?e.jsx(ve,{open:a,onOpenChange:s,size:"md","aria-label":"Billing history",className:"bpb-scope",children:e.jsx(Fe,{})}):e.jsx(ve,{open:a,onOpenChange:s,size:"md","aria-label":"Billing history",className:"bpb-scope",children:e.jsx(Mr,{open:a})})},Mr=({open:a})=>{const{locale:s,analytics:n}=U(),{data:r,isLoading:t,isError:o}=Ja({enabled:a}),l=(r==null?void 0:r.invoices)??[];return e.jsxs("div",{className:"bpb-invoices",children:[e.jsx("h2",{className:"bpb-invoices__title",children:"Billing history"}),t?e.jsxs("div",{className:"bpb-invoices__loading","aria-busy":"true",children:[e.jsx(V,{height:52}),e.jsx(V,{height:52}),e.jsx(V,{height:52})]}):o?e.jsx("p",{className:"bpb-invoices__empty",role:"alert",children:"We couldn’t load your invoices. Try again in a moment."}):l.length===0?e.jsx("p",{className:"bpb-invoices__empty",children:"No invoices yet. They’ll appear here after your first charge."}):e.jsx("ul",{className:"bpb-invoices__list",children:l.map(c=>e.jsxs("li",{className:"bpb-invoices__row",children:[e.jsxs("div",{className:"bpb-invoices__row-main",children:[e.jsx("span",{className:"bpb-invoices__date",children:Ee(c.createdAt,s)}),e.jsx("span",{className:`bpb-invoices__status bpb-invoices__status--${c.status}`,children:Tr[c.status]})]}),e.jsxs("div",{className:"bpb-invoices__row-end",children:[e.jsx("span",{className:"bpb-invoices__amount",children:Q(c.amount,c.currency)}),c.pdfUrl?e.jsx("a",{className:"bpb-invoices__download",href:c.pdfUrl,target:"_blank",rel:"noopener noreferrer","aria-label":`Download invoice from ${Ee(c.createdAt,s)}`,onClick:()=>n.capture(le.INVOICE_DOWNLOADED,{status:c.status}),children:e.jsx(Fa,{size:16})}):e.jsx("span",{className:"bpb-invoices__download bpb-invoices__download--disabled","aria-hidden":!0,children:e.jsx(Fa,{size:16})})]})]},c.id))})]})},xr=({open:a,onOpenChange:s,onSuccess:n})=>{var _;const{stripePromise:r,isDark:t,locale:o,isOutdatedBilling:l}=U(),c=Sa(),b=(_=c.data)==null?void 0:_.clientSecret,{mutate:u,reset:h}=c;N.useEffect(()=>{a&&!l?u():h()},[a,l,u,h]);const d=N.useMemo(()=>b?{clientSecret:b,appearance:Ga(t),locale:Ka(o)}:null,[b,t,o]);return l?e.jsx(ve,{open:a,onOpenChange:s,size:"md","aria-label":"Payment & billing",className:"bpb-scope",children:e.jsx(Fe,{})}):e.jsx(ve,{open:a,onOpenChange:s,size:"md","aria-label":"Payment & billing",className:"bpb-scope",children:e.jsxs("div",{className:"bpb-payment-dialog",children:[e.jsx("h2",{className:"bpb-payment-dialog__title",children:"Payment & billing"}),c.isError?e.jsxs("div",{className:"bpb-payment-dialog__error",children:[e.jsx("p",{children:"We couldn’t start a secure session."}),e.jsx(ue,{variant:"outline",onClick:()=>u(),children:"Try again"})]}):!d||!b?e.jsxs("div",{className:"bpb-payment-dialog__loading","aria-busy":"true",children:[e.jsx(V,{height:48}),e.jsx(V,{height:120})]}):e.jsx(fe.Elements,{stripe:r,options:d,children:e.jsx(Pr,{clientSecret:b,isDark:t,onSuccess:n})})]})})},Pr=({clientSecret:a,isDark:s,onSuccess:n})=>{var ge;const r=fe.useStripe(),t=fe.useElements(),{toast:o,analytics:l}=U(),{data:c,isLoading:b}=Na(),{data:u,isLoading:h}=ka(),{data:d,isLoading:_}=wa(),f=Ia(),k=Aa(),v=Ea(),m=((ge=c==null?void 0:c.paymentMethod)==null?void 0:ge.card)??null,y=(u==null?void 0:u.address)??null,S=(d==null?void 0:d.taxIds)??[],[O,I]=N.useState(!1),[P,A]=N.useState(!1),[M,i]=N.useState(!1),[T,E]=N.useState(!1),[ee,L]=N.useState(null),[ne,se]=N.useState(!1),[$,K]=N.useState(!1),[G,Z]=N.useState(null),[x,g]=N.useState(y==null?void 0:y.country),[B,F]=N.useState(S.length>0),[W,te]=N.useState(null),z=W??S.map(Y=>({type:Y.type,value:Y.value})),H=Vs(x),ye=W!==null,Se=O||!m,j=(Y,he)=>te(z.map((X,re)=>re===Y?{...X,...he}:X)),oe=()=>{var Y;return te([...z,{type:((Y=H[0])==null?void 0:Y.type)??"",value:""}])},de=Y=>te(z.filter((he,X)=>X!==Y)),Ie=async()=>{if(!r||!t)return;const Y=t.getElement(fe.CardElement);if(Y){E(!0),L(null);try{const{error:he,setupIntent:X}=await r.confirmCardSetup(a,{payment_method:{card:Y}});if(he){L(he.message??"Could not save your card");return}if(!(X!=null&&X.payment_method)||typeof X.payment_method!="string"){L("Could not retrieve payment method");return}await f.mutateAsync({paymentMethodId:X.payment_method}),l.capture(le.PAYMENT_METHOD_UPDATED),o({type:"success",message:"Card updated"}),I(!1),n==null||n()}catch{L("We couldn’t save your card. Please check your details and try again.")}finally{E(!1)}}},me=async()=>{if(!t)return;const Y=t.getElement("address");if(!Y)return;const{complete:he,value:X}=await Y.getValue();if(!he||!X.address){Z("Please complete your billing address.");return}K(!0),Z(null);try{const{address:re,name:ke}=X;await k.mutateAsync({lineOne:re.line1??"",lineTwo:re.line2??void 0,city:re.city??"",state:re.state??void 0,postalCode:re.postal_code??"",country:re.country??""});const xe=(ke==null?void 0:ke.trim())||void 0,ea=z.filter(qe=>!!qe.type&&qe.value.trim()!=="").map(qe=>({type:qe.type,value:qe.value.trim()}));(xe!==((d==null?void 0:d.name)??void 0)||ye)&&await v.mutateAsync({name:xe,taxIds:ea}),l.capture(le.BILLING_ADDRESS_UPDATED),o({type:"success",message:"Billing details updated"}),n==null||n()}catch(re){const ke=re instanceof Error&&re.message?re.message:"Could not update your billing details.";Z(ke),o({type:"error",message:"Could not update your billing details"})}finally{K(!1)}};return e.jsxs("div",{className:"bpb-payment-dialog__sections",children:[e.jsxs("section",{className:"bpb-payment-dialog__section",children:[e.jsx("h3",{className:"bpb-payment-dialog__section-title",children:"Payment method"}),b?e.jsx(V,{height:56}):Se?e.jsxs("div",{className:"bpb-payment-element",children:[!P&&e.jsx(V,{height:48}),e.jsx("div",{className:P?"bpb-card-element":"bpb-payment-element--hidden",children:e.jsx(fe.CardElement,{options:{style:Va(s),hidePostalCode:!0},onReady:()=>A(!0),onChange:Y=>i(Y.complete)})}),ee&&e.jsx("p",{role:"alert",className:"bpb-payment-dialog__field-error",children:ee}),e.jsxs("div",{className:"bpb-payment-dialog__section-actions",children:[m&&e.jsx(ue,{variant:"ghost",onClick:()=>I(!1),disabled:T,children:"Cancel"}),e.jsx(ue,{variant:"primary",disabled:!M,loading:T,onClick:Ie,children:"Save card"})]})]}):e.jsxs("div",{className:"bpb-saved-card",children:[e.jsx(ua,{brand:m.brand}),e.jsxs("span",{className:"bpb-saved-card__number",children:[e.jsx("span",{className:"bpb-saved-card__brand",children:m.brand})," •••• ",m.lastFour]}),e.jsxs("span",{className:"bpb-saved-card__exp",children:[String(m.expMonth).padStart(2,"0"),"/",String(m.expYear).slice(-2)]}),e.jsx("button",{type:"button",className:"bpb-link-button",onClick:()=>I(!0),children:"Replace"})]})]}),e.jsxs("section",{className:"bpb-payment-dialog__section",children:[e.jsx("h3",{className:"bpb-payment-dialog__section-title",children:"Billing address"}),h||_?e.jsx(V,{height:72}):e.jsxs("div",{className:"bpb-payment-element",children:[!ne&&e.jsx(V,{height:120}),e.jsx("div",{className:ne?void 0:"bpb-payment-element--hidden",children:e.jsx(fe.AddressElement,{options:{mode:"billing",display:{name:"full"},defaultValues:y?{name:(d==null?void 0:d.name)??void 0,address:{line1:y.lineOne,line2:y.lineTwo,city:y.city,state:y.state,postal_code:y.postalCode,country:y.country}}:void 0},onReady:()=>se(!0),onChange:Y=>g(Y.value.address.country||void 0)})}),e.jsxs("div",{className:"bpb-tax-section",children:[e.jsxs("button",{type:"button",className:"bpb-tax-toggle","aria-expanded":B,onClick:()=>F(Y=>!Y),children:[e.jsx(ba,{size:16,className:D("bpb-tax-toggle__chevron",B&&"bpb-tax-toggle__chevron--open")}),"Tax IDs",S.length>0&&e.jsx("span",{className:"bpb-tax-toggle__count",children:S.length})]}),B&&e.jsxs("div",{className:"bpb-tax",children:[z.length===0&&e.jsx("p",{className:"bpb-tax__empty",children:"Add a VAT or tax registration number to show it on your invoices."}),z.map((Y,he)=>e.jsxs("div",{className:"bpb-tax__row",children:[e.jsxs(ja,{"aria-label":"Tax ID type",value:Y.type,onChange:X=>j(he,{type:X.target.value}),children:[e.jsx("option",{value:"",children:"Select type"}),H.map(X=>e.jsx("option",{value:X.type,children:X.label},X.type)),Y.type&&!H.some(X=>X.type===Y.type)&&e.jsx("option",{value:Y.type,children:Y.type})]}),e.jsx(ma,{placeholder:"Tax ID number",value:Y.value,onChange:X=>j(he,{value:X.target.value})}),e.jsx("button",{type:"button",className:"bpb-tax__remove","aria-label":"Remove tax ID",onClick:()=>de(he),children:e.jsx(da,{size:14})})]},he)),e.jsx("button",{type:"button",className:"bpb-link-button bpb-tax__add",onClick:oe,children:"+ Add tax ID"})]})]}),G&&e.jsx("p",{role:"alert",className:"bpb-payment-dialog__field-error",children:G}),e.jsx("div",{className:"bpb-payment-dialog__section-actions",children:e.jsx(ue,{variant:"primary",loading:$,onClick:me,children:"Save billing details"})})]})]})]})},Ys=(a,s,n)=>`bpb-dismissed:${a}:${s}:${n}`,Hs=()=>new Date().toLocaleDateString("en-CA");function Qs(a,s,n){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Ys(a,s,n))===Hs()}catch{return!1}}function Zs(a,s,n){if(!(typeof window>"u"))try{window.localStorage.setItem(Ys(a,s,n),Hs())}catch{}}const ga=1e9,Xs={incoming_messages_events:a=>`${J(a)} incoming messages & events`,conversation_sessions:a=>`${J(a)} conversation sessions`,table_rows:a=>`${J(a)} table rows`,vector_db_storage:a=>`${Ue(a)} vector database storage`,file_storage:a=>`${Ue(a)} file storage`,collaborator_count:a=>a===1?"1 collaborator":`${J(a)} collaborators`,bot_count:a=>a===1?"1 bot":`${J(a)} bots`,indexed_file_count:a=>`${J(a)} indexed files for RAG`,ai_spend:a=>`${Q(a/ga,"usd",0)} AI credit included`,always_alive:a=>a===1?"1 always-alive bot":`${J(a)} always-alive bots`};function Dr(a,s,n){const r=(n==null?void 0:n[a])??Xs[a];return r?r(s):`${J(s)} ${a.replaceAll("_"," ")}`}const Js=[{key:"conversation_sessions",label:"Conversations",unit:"count"},{key:"ai_spend",label:"AI spend",unit:"nano-usd"},{key:"table_rows",label:"Table rows",unit:"count"},{key:"vector_db_storage",label:"Vector DB storage",unit:"bytes"},{key:"file_storage",label:"File storage",unit:"bytes"}];function Ke(a,s){return s==="bytes"?Ue(a):s==="nano-usd"?`$${(a/ga).toFixed(2)}`:J(a)}function ya(a){return a>=90?"critical":a>=75?"warning":"normal"}function Re(a){return a?Js.flatMap(({key:s,label:n,unit:r})=>{const t=a[s];if(!t||t.quota<=0)return[];const o=t.usage??0,l=Math.max(0,Math.min(100,o/t.quota*100));return[{key:s,label:n,unit:r,used:o,quota:t.quota,remaining:Math.max(0,t.quota-o),pct:l}]}).sort((s,n)=>n.pct-s.pct):[]}const Rs="outgrow-free",Br=.75,zr=5;function Ur(a,s){return a.prices[s]??(s==="month"?a.prices.year:a.prices.month)??null}function Or(a,s){var t,o;const n=(t=a.prices.month)==null?void 0:t.amount;if(s==="month")return n??null;const r=((o=a.prices.year)==null?void 0:o.amount)??(n===void 0?void 0:n*12);return r===void 0?null:r/12}const $r=({open:a,onOpenChange:s,onSelectPlan:n,recommendedPlanId:r="team",interval:t="year",planFeatures:o={},featureDescriptions:l,period:c})=>{var ne,se;const{isOutdatedBilling:b,analytics:u,scope:h}=U(),{data:d}=we(),{data:_}=Pe(),{data:f}=Ne({enabled:!b}),{data:k}=De({period:c,enabled:!b}),v=a!==void 0,[m,y]=N.useState(!1),S=d==null?void 0:d.find($=>$.id===(f==null?void 0:f.plan.current.planId)),O=f?S?ie(S)==="community":!0:!1,I=N.useMemo(()=>Re(k).find($=>$.key==="conversation_sessions"),[k]),P=!v&&!b&&O&&!!I&&I.pct/100>=Br&&!m&&!Qs(Rs,h,"modal"),A=v?!!a:P;N.useEffect(()=>{A&&u.capture(le.PLAN_PICKER_VIEWED,{source:v?"outgrow_free":"outgrow_free_auto",interval:t})},[A,v,u]);const M=()=>{v||(Zs(Rs,h,"modal"),y(!0)),s==null||s(!1)},i=N.useMemo(()=>d?d.filter($=>{const K=ie($);return K!=="community"&&K!=="enterprise"&&K!=="managed"}).sort(($,K)=>Oe.indexOf(ie($))-Oe.indexOf(ie(K))):[],[d]),T=((se=(ne=d==null?void 0:d.find($=>ie($)==="enterprise"))==null?void 0:ne.metadata)==null?void 0:se.contact_url)??Da;if(b||!A)return null;const E=(I==null?void 0:I.quota)??(S==null?void 0:S.features.conversation_sessions)??100,ee=(I==null?void 0:I.used)??0,L=I&&I.pct>0?Math.min(100,Math.max(5,Math.round(I.pct))):0;return e.jsx(ve,{open:A,onOpenChange:M,size:"xl","aria-label":"You’re about to outgrow the Free plan",children:e.jsxs("div",{className:"bpb-outgrow",children:[e.jsxs("header",{className:"bpb-outgrow__head",children:[e.jsx("h2",{className:"bpb-outgrow__title",children:"You’re about to outgrow the Free plan"}),e.jsxs("p",{className:"bpb-outgrow__lede",children:["Free includes ",e.jsxs("strong",{children:[J(E)," conversations total"]}),", and they don’t renew. Upgrading moves you to a ",e.jsx("strong",{children:"monthly allowance"}),", unlocks more channels, and adds conversation packs, so your agents never stop replying."]})]}),e.jsxs("div",{className:"bpb-outgrow__usage",children:[e.jsx("span",{className:"bpb-outgrow__usage-label",children:"So far"}),e.jsx("span",{className:"bpb-outgrow__usage-bar",role:"progressbar","aria-valuenow":L,"aria-valuemin":0,"aria-valuemax":100,children:e.jsx("span",{className:"bpb-outgrow__usage-fill",style:{width:`${L}%`}})}),e.jsxs("span",{className:"bpb-outgrow__usage-text",children:[e.jsxs("strong",{children:[J(ee)," of ",J(E)]})," ","free conversations used · they don’t renew"]})]}),e.jsx("div",{className:"bpb-outgrow__grid",children:i.map(($,K)=>{const G=ie($),Z=Ur($,t),x=Or($,t),g=G===r||$.id===r,B=$.features.conversation_sessions,F=oa(_,$,t),W=K>0?i[K-1]:void 0,te=(o[G]??ra[G]).slice(0,zr);return e.jsxs("div",{className:D("bpb-plan-card",g&&"bpb-plan-card--highlighted bpb-glow"),"data-plan-id":$.id,children:[e.jsxs("div",{className:"bpb-plan-card__header",children:[e.jsxs("h3",{className:"bpb-plan-card__name",children:[ae($.name),g&&e.jsx(la,{className:"bpb-plan-card__badge",children:"Recommended"})]}),e.jsx("div",{className:"bpb-plan-card__price",children:x!==null&&Z?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"bpb-plan-card__currency",children:Qe(Z.currency)}),e.jsx("span",{className:"bpb-plan-card__amount",children:Number.isInteger(x)?x:x.toFixed(2).replace(/\.00$/,"")}),e.jsx("span",{className:"bpb-plan-card__per",children:"/mo"})]}):e.jsxs("span",{className:"bpb-plan-card__amount",children:[Qe((Z==null?void 0:Z.currency)??"usd"),"0"]})})]}),B!==void 0&&e.jsxs("div",{className:"bpb-outgrow__allowance",children:[e.jsxs("p",{className:"bpb-outgrow__allowance-value",children:[e.jsxs("strong",{children:[J(B)," conversations"]})," /mo"]}),e.jsx("p",{className:"bpb-outgrow__allowance-pack",children:F?`then ${Qe(F.currency)}${F.amount} per ${J(F.packSize)} more`:"No top-up"})]}),e.jsxs(ue,{variant:g?"accent":"outline",block:!0,onClick:()=>{u.capture(le.PLAN_UPGRADE_INITIATED,{plan_name:ae($.name),interval:t,source:"outgrow_free"}),n($.id,t),M()},children:["Upgrade to ",ae($.name),g&&e.jsx(pa,{size:15})]}),e.jsxs("ul",{className:"bpb-plan-card__features",children:[W&&e.jsxs("li",{className:"bpb-outgrow__features-lead",children:["Everything in ",ae(W.name),", and"]}),te.map(z=>{const H=ha(z),ye=za(z,l);return e.jsxs("li",{children:[e.jsx("span",{className:"bpb-plan-card__feature-chip",children:e.jsx(H,{size:13})}),ye?e.jsx(Je,{label:z,children:ye}):e.jsx("span",{children:z})]},z)})]})]},$.id)})}),e.jsxs("footer",{className:"bpb-outgrow__footer",children:[e.jsxs("span",{children:["Need custom volume, SLAs, or voice?"," ",e.jsx("a",{href:T,target:"_blank",rel:"noopener noreferrer",children:"Talk to sales"})]}),e.jsxs("a",{className:"bpb-outgrow__compare",href:"https://botpress.com/pricing",target:"_blank",rel:"noopener noreferrer",children:["Compare all plans",e.jsx(Xe,{size:14})]})]})]})})},Fr=[{key:"table_rows",label:"Table rows",unit:"count"},{key:"vector_db_storage",label:"Vector DB storage",unit:"bytes"},{key:"file_storage",label:"File storage",unit:"bytes"}],je=(a,s)=>s==="bytes"?Ue(a):s==="nano-usd"?`$${(a/ga).toFixed(2)}`:J(a),qr=(a,s)=>{const n=new Date;return Array.from({length:a},(r,t)=>{const o=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()-t,1));return{value:o.toISOString(),label:o.toLocaleDateString(s,{month:"long",year:"numeric",timeZone:"UTC"})}})},Wr=({period:a})=>{const{data:s,isLoading:n,isError:r}=Ra("ai_spend",{period:a});if(r)return null;if(n)return e.jsx(V,{height:96});if(!s||s.length===0)return e.jsx("p",{className:"bpb-usage__group-hint",children:"No per-bot AI spend this period."});const t=Math.max(...s.map(o=>o.value),1);return e.jsx("div",{className:"bpb-usage-bots",children:s.map(o=>e.jsxs("div",{className:"bpb-usage-bot",children:[e.jsxs("div",{className:"bpb-usage-bot__head",children:[e.jsx("span",{className:"bpb-usage-bot__name",title:o.name,children:o.name}),e.jsx("span",{className:"bpb-usage-bot__value",children:je(o.value,"nano-usd")})]}),e.jsx("div",{className:"bpb-usage-bar",role:"presentation",children:e.jsx("div",{className:"bpb-usage-bar__fill bpb-usage-bar__fill--normal",style:{width:`${Math.max(2,Math.round(o.value/t*100))}%`}})})]},o.botId))})},Ha=({entry:a,metric:s,planAllowance:n,planName:r})=>{const t=a.usage??0,o=a.quota>0?Math.max(0,Math.min(100,Math.round(t/a.quota*100))):0,l=o>0?Math.max(5,o):0,c=o>=90?"critical":o>=75?"warning":"normal",b=n??a.quota,u=Math.max(0,a.quota-b),h=r?`${r} plan`:"your plan",d=u>0?`${je(b,s.unit)} from ${h} + ${je(u,s.unit)} from add-ons`:`${je(a.quota,s.unit)} from ${h}`;return e.jsxs("div",{className:"bpb-usage-row",children:[e.jsxs("div",{className:"bpb-usage-row__head",children:[e.jsx("span",{className:"bpb-usage-row__label",children:s.label}),e.jsxs("span",{className:"bpb-usage-row__value",children:[e.jsx("span",{className:"bpb-usage-row__used",children:je(t,s.unit)}),e.jsxs("span",{className:"bpb-usage-row__quota",children:[" / ",je(a.quota,s.unit)]})]})]}),e.jsxs("span",{className:"bpb-usage-tip",tabIndex:0,role:"note","aria-label":d,children:[e.jsx("div",{className:"bpb-usage-bar",role:"progressbar","aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":100,children:e.jsx("div",{className:D("bpb-usage-bar__fill",`bpb-usage-bar__fill--${c}`),style:{width:`${l}%`}})}),e.jsx("span",{className:"bpb-usage-tip__bubble",role:"tooltip",children:d})]})]})},Gr=({period:a,showPeriodSelector:s=!0,periodMonths:n=12,className:r})=>{var M;const{isOutdatedBilling:t,locale:o}=U(),l=N.useMemo(()=>qr(n,o),[n,o]),[c,b]=N.useState(a??((M=l[0])==null?void 0:M.value)??""),u=es(),h=Math.max(0,l.findIndex(i=>i.value===c)),d=i=>{const T=l[h+i];T&&b(T.value)},{data:_,isLoading:f,isError:k}=De({period:c,enabled:!t}),{data:v}=Ne({enabled:!t}),{data:m}=we(),y=m==null?void 0:m.find(i=>i.id===(v==null?void 0:v.plan.current.planId)),S=y?ae(y.name):void 0,O=i=>y==null?void 0:y.features[i];if(t)return e.jsx("div",{className:D("bpb-usage bpb-scope",r),children:e.jsx(Fe,{})});if(f)return e.jsxs("div",{className:D("bpb-usage bpb-scope",r),"aria-busy":"true",children:[e.jsx(V,{height:80}),e.jsx(V,{height:140})]});if(k||!_)return e.jsx("div",{className:D("bpb-usage bpb-scope",r),children:e.jsx("p",{className:"bpb-usage__error",role:"alert",children:"We couldn’t load your usage. Try again in a moment."})});const I=_.conversation_sessions,P=_.ai_spend,A=Fr.filter(i=>_[i.key]);return e.jsxs("div",{className:D("bpb-usage bpb-scope",r),children:[s&&l.length>1&&e.jsxs("div",{className:"bpb-usage__header",children:[e.jsx("span",{className:"bpb-usage__header-title",children:"Usage"}),e.jsxs("div",{className:"bpb-usage__period",children:[e.jsx("span",{className:"bpb-usage__period-label",children:"Billing period"}),e.jsxs("div",{className:"bpb-usage__period-control",children:[e.jsx("button",{type:"button",className:"bpb-usage__period-step","aria-label":"Previous month",onClick:()=>d(1),disabled:h>=l.length-1,children:e.jsx(zs,{size:15})}),e.jsxs("span",{className:"bpb-usage__period-field",children:[e.jsx(Fs,{size:15,className:"bpb-usage__period-icon"}),e.jsx("select",{className:"bpb-usage__period-select","aria-label":"Billing period",value:c,onChange:i=>b(i.target.value),children:l.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))}),e.jsx(ba,{size:14,className:"bpb-usage__period-chevron"})]}),e.jsx("button",{type:"button",className:"bpb-usage__period-step","aria-label":"Next month",onClick:()=>d(-1),disabled:h<=0,children:e.jsx($e,{size:15})})]})]})]}),I&&e.jsxs("section",{className:"bpb-usage__group",children:[e.jsx("h3",{className:"bpb-usage__group-title",children:"Conversations"}),e.jsx("p",{className:"bpb-usage__group-hint",children:"Each conversation includes AI usage. When you reach your limit, extra conversations are added automatically so service continues."}),e.jsx("div",{className:"bpb-usage__card",children:e.jsx(Ha,{entry:I,metric:{key:"conversation_sessions",label:"Conversations",unit:"count"},planAllowance:O("conversation_sessions"),planName:S})})]}),A.length>0&&e.jsxs("section",{className:"bpb-usage__group",children:[e.jsx("h3",{className:"bpb-usage__group-title",children:"Storage"}),e.jsx("p",{className:"bpb-usage__group-hint",children:"Shared across files, knowledge base, and tables."}),e.jsx("div",{className:"bpb-usage__card",children:A.map(i=>e.jsx(Ha,{entry:_[i.key],metric:i,planAllowance:O(i.key),planName:S},i.key))})]}),P&&e.jsxs("section",{className:"bpb-usage__group",children:[e.jsx("h3",{className:"bpb-usage__group-title",children:"AI usage"}),e.jsx("p",{className:"bpb-usage__group-hint",children:"Each conversation includes an AI allowance — this is how much you’ve used."}),e.jsx("div",{className:"bpb-usage__card",children:e.jsx(Ha,{entry:P,metric:{key:"ai_spend",label:"AI spend",unit:"nano-usd"}})}),u&&e.jsxs("div",{className:"bpb-usage__card bpb-usage__card--bots",children:[e.jsx("span",{className:"bpb-usage__subhead",children:"AI spend by bot"}),e.jsx(Wr,{period:c})]})]})]})},en="usage-banner",Vr={conversation_sessions:"monthly conversations",table_rows:"table rows",vector_db_storage:"vector DB storage",file_storage:"file storage",ai_spend:"AI spend"},Kr=({position:a="inline",threshold:s=.9,onUpgrade:n,dismissible:r=!0,ctaLabel:t="Upgrade plan",period:o,className:l})=>{const{isOutdatedBilling:c,analytics:b,scope:u}=U(),{data:h}=De({period:o,enabled:!c}),[d,_]=N.useState({}),[f,k]=N.useState(!1),[v,m]=N.useState(null),y=h?Object.entries(h).map(([i,T])=>({key:i,pct:T.quota>0?(T.usage??0)/T.quota:0})).filter(i=>i.pct>=s).sort((i,T)=>T.pct-i.pct)[0]:void 0,S=!!y&&(d[y.key]||Qs(en,u,y.key));if(c||!y||S)return null;const O=Vr[y.key]??y.key.replace(/_/g," "),I=Math.min(100,Math.round(y.pct*100)),P=y.pct>=1,A=()=>{b.capture(le.UPGRADE_CTA_CLICKED,{source:"usage_banner",metric:y.key,usage_pct:Math.round(y.pct*100)}),n?n():k(!0)},M=P?"critical":"warning";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:D("bpb-usage-banner bpb-scope",`bpb-usage-banner--${a}`,`bpb-usage-banner--${M}`,l),role:"alert","aria-live":"polite",children:[e.jsx($s,{size:18,className:"bpb-usage-banner__icon"}),e.jsx("p",{className:"bpb-usage-banner__text",children:P?e.jsxs(e.Fragment,{children:["You’ve reached your ",O," limit. Upgrade now to avoid interruptions."]}):e.jsxs(e.Fragment,{children:["You’ve used ",e.jsxs("strong",{children:[I,"%"]})," of your ",O,". Upgrade to avoid hitting your limit."]})}),e.jsxs("div",{className:"bpb-usage-banner__actions",children:[e.jsx(ue,{variant:"primary",size:"sm",onClick:A,children:t}),r&&e.jsx("button",{type:"button",className:"bpb-usage-banner__dismiss","aria-label":"Dismiss",onClick:()=>{Zs(en,u,y.key),_(i=>({...i,[y.key]:!0}))},children:e.jsx(da,{size:16})})]})]}),!n&&e.jsxs(e.Fragment,{children:[e.jsx(Ws,{open:f,onOpenChange:k,onSelectPlan:(i,T)=>{k(!1),m({planId:i,interval:T})}}),v&&e.jsx(Ks,{open:!!v,onOpenChange:i=>!i&&m(null),planId:v.planId,interval:v.interval,onBack:()=>{m(null),k(!0)},onSuccess:()=>m(null)})]})]})},Qa=({children:a})=>e.jsx("span",{className:"bpb-summary-card__icon","aria-hidden":"true",children:a}),an=({eyebrow:a,className:s})=>{const{manageBillingUrl:n}=U(),r=()=>n&&window.open(n,"_blank","noopener");return e.jsxs("button",{type:"button",className:D("bpb-summary-card bpb-scope",a==="Add-ons"?"bpb-summary-card--addons":"bpb-summary-card--plan",s),onClick:r,disabled:!n,children:[e.jsx(Qa,{children:a==="Add-ons"?e.jsx(ia,{size:22}):e.jsx(ca,{size:22})}),e.jsxs("div",{className:"bpb-summary-card__content",children:[e.jsxs("div",{className:"bpb-summary-card__body",children:[e.jsx("span",{className:"bpb-summary-card__eyebrow",children:a}),e.jsx("span",{className:"bpb-summary-card__title",children:"Managed in Dashboard"}),e.jsx("span",{className:"bpb-summary-card__meta",children:"This workspace uses an earlier billing system."})]}),e.jsxs("span",{className:"bpb-summary-card__action",children:["Open",e.jsx(Xe,{size:15})]})]})]})},jr=({onManage:a,className:s})=>{var k,v;const{isOutdatedBilling:n}=U(),{data:r,isLoading:t}=Ne({enabled:!n}),{data:o,isLoading:l}=we();if(n)return e.jsx(an,{eyebrow:"Current plan",className:s});if(t||l)return e.jsx(V,{height:84,rounded:!0,className:D("bpb-scope",s)});const c=r==null?void 0:r.plan.current,b=o==null?void 0:o.find(m=>m.id===(c==null?void 0:c.planId)),u=(c==null?void 0:c.interval)??"month",h=((k=b==null?void 0:b.prices[u])==null?void 0:k.amount)??0,d=((v=b==null?void 0:b.prices[u])==null?void 0:v.currency)??"usd",_=b==null?void 0:b.features.conversation_sessions,f=b?ie(b):"community";return e.jsxs("button",{type:"button",className:D("bpb-summary-card bpb-summary-card--plan bpb-scope",`bpb-summary-card--tier-${f==="managed"?"enterprise":f}`,s),onClick:a,children:[e.jsx(Qa,{children:e.jsx(ca,{size:22})}),e.jsxs("div",{className:"bpb-summary-card__content",children:[e.jsxs("div",{className:"bpb-summary-card__body",children:[e.jsx("span",{className:"bpb-summary-card__eyebrow",children:"Current plan"}),e.jsx("span",{className:"bpb-summary-card__title",children:b?ae(b.name):"No plan"}),e.jsxs("span",{className:"bpb-summary-card__meta",children:[h>0?`${Q(h,d,0)}/${u==="year"?"yr":"mo"}`:"Free",_!==void 0&&` · ${J(_)} conversations/mo`]})]}),e.jsxs("span",{className:"bpb-summary-card__action",children:["Manage",e.jsx($e,{size:16})]})]})]})},Yr=({onManage:a,className:s})=>{const{isOutdatedBilling:n}=U(),{data:r,isLoading:t}=Ne({enabled:!n}),{data:o,isLoading:l}=Pe();if(n)return e.jsx(an,{eyebrow:"Add-ons",className:s});if(t||l)return e.jsx(V,{height:84,rounded:!0,className:D("bpb-scope",s)});const c=(o??[]).flatMap(b=>{var h;const u=((h=r==null?void 0:r.addons[b.id])==null?void 0:h.current.quantity)??0;return u>0?[{name:Ze(b.name),quantity:u}]:[]});return e.jsxs("button",{type:"button",className:D("bpb-summary-card bpb-summary-card--addons bpb-scope",c.length>0&&"bpb-summary-card--active",s),onClick:a,children:[e.jsx(Qa,{children:e.jsx(ia,{size:22})}),e.jsxs("div",{className:"bpb-summary-card__content",children:[e.jsxs("div",{className:"bpb-summary-card__body",children:[e.jsx("span",{className:"bpb-summary-card__eyebrow",children:"Add-ons"}),c.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"bpb-summary-card__title",children:[c.length," active add-on",c.length>1?"s":""]}),e.jsx("span",{className:"bpb-summary-card__meta",children:c.map(b=>`${b.quantity}× ${b.name}`).join(" · ")})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"bpb-summary-card__title",children:"No add-ons"}),e.jsx("span",{className:"bpb-summary-card__meta",children:"Add extra conversations or storage"})]})]}),e.jsxs("span",{className:"bpb-summary-card__action",children:["Manage",e.jsx($e,{size:16})]})]})]})},Hr=({onManage:a,className:s})=>{var E,ee;const{isOutdatedBilling:n,locale:r,manageBillingUrl:t,analytics:o}=U(),{data:l,isLoading:c}=Ne({enabled:!n}),{data:b,isLoading:u}=we(),{data:h,isLoading:d}=Pe();if(n){const L=()=>t&&window.open(t,"_blank","noopener");return e.jsxs("button",{type:"button",className:D("bpb-plan-banner bpb-plan-banner--community bpb-scope",s),onClick:L,disabled:!t,children:[e.jsxs("div",{className:"bpb-plan-banner__main",children:[e.jsx("span",{className:"bpb-plan-banner__eyebrow",children:"Current plan"}),e.jsx("span",{className:"bpb-plan-banner__name",children:"Managed in Dashboard"}),e.jsx("span",{className:"bpb-plan-banner__sub",children:"This workspace uses an earlier billing system."})]}),e.jsxs("span",{className:"bpb-plan-banner__cta",children:["Open ",e.jsx(Xe,{size:16})]})]})}if(c||u||d)return e.jsx(V,{height:132,rounded:!0,className:D("bpb-scope",s)});const _=l==null?void 0:l.plan.current,f=b==null?void 0:b.find(L=>L.id===(_==null?void 0:_.planId)),k=(_==null?void 0:_.interval)??"month",v=((E=f==null?void 0:f.prices[k])==null?void 0:E.currency)??"usd",m=f?ie(f):"community",y=Object.fromEntries(Object.entries((l==null?void 0:l.addons)??{}).map(([L,ne])=>{var se;return[L,((se=ne.current)==null?void 0:se.quantity)??0]})),S=((ee=f==null?void 0:f.prices[k])==null?void 0:ee.amount)??0,O=(h??[]).reduce((L,ne)=>{const se=f?ta(ne,f,k):null;return L+(y[ne.id]??0)*((se==null?void 0:se.amount)??0)},0),I=S+O,P=k==="year"?"/yr":"/mo",A=As(f,h,y).find(L=>L.key==="conversation_sessions"),M=m==="community"?"conversations":"conversations / month",i=_!=null&&_.periodEnd?Ee(_.periodEnd,r):null,T=m==="enterprise"||m==="managed";return e.jsxs("button",{type:"button",className:D("bpb-plan-banner",`bpb-plan-banner--${m}`,"bpb-scope",s),onClick:()=>{o.capture(le.UPGRADE_CTA_CLICKED,{source:"plan_banner",current_tier:m}),a()},children:[e.jsxs("div",{className:"bpb-plan-banner__main",children:[e.jsx("span",{className:"bpb-plan-banner__eyebrow",children:"Current plan"}),e.jsx("span",{className:"bpb-plan-banner__name",children:f?ae(f.name):"No plan"}),A&&e.jsx("span",{className:"bpb-plan-banner__sub",children:A.added>0?e.jsxs(e.Fragment,{children:[J(A.base)," + ",J(A.added)," ",M]}):`${J(A.total)} ${M}`})]}),e.jsxs("div",{className:"bpb-plan-banner__summary",children:[T?e.jsx("span",{className:"bpb-plan-banner__price",children:"Custom pricing"}):e.jsxs("span",{className:"bpb-plan-banner__price",children:[I>0?Q(I,v,0):"Free",I>0&&e.jsx("span",{className:"bpb-plan-banner__price-suffix",children:P})]}),e.jsxs("span",{className:"bpb-plan-banner__meta",children:[k==="year"?"Billed annually":"Billed monthly",O>0&&" · incl. add-ons"]}),i&&e.jsxs("span",{className:"bpb-plan-banner__meta",children:["Renews ",i]})]}),e.jsxs("span",{className:"bpb-plan-banner__cta",children:["Manage plan ",e.jsx($e,{size:16})]})]})},Qr=({onManage:a,period:s,variant:n="card",className:r,style:t})=>{const{isOutdatedBilling:o,locale:l}=U(),{data:c,isLoading:b}=Ne({enabled:!o}),{data:u,isLoading:h}=we(),{data:d,isLoading:_}=De({period:s,enabled:!o});if(o)return null;if(b||h||_)return e.jsx(V,{height:72,rounded:!0,className:D("bpb-scope",r)});const f=u==null?void 0:u.find(L=>L.id===(c==null?void 0:c.plan.current.planId)),k=Re(d),v=k.find(L=>L.key==="conversation_sessions"),m=k[0],y=m&&m.key!=="conversation_sessions"&&m.pct>=75?m:v??m,S=y?Math.round(y.pct):0,O=S>0?Math.max(5,S):0,I=y?ya(y.pct):"normal",P=I!=="normal",A=f?ie(f)==="community":!1,M=c!=null&&c.plan.current.periodEnd?Ee(c.plan.current.periodEnd,l):null;let i=null,T=null;if(y&&P){const L=Ke(y.remaining,y.unit);i=I==="critical"?"Limit reached":"Running low",A&&y.key==="conversation_sessions"?T=I==="critical"?e.jsxs(e.Fragment,{children:["All your free conversations are used, and they ",e.jsx("strong",{children:"don’t renew"}),"."]}):e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:L})," free conversations left, and they ",e.jsx("strong",{children:"don’t renew"}),"."]}):T=I==="critical"?"Upgrade to keep going.":e.jsxs(e.Fragment,{children:["Only ",e.jsx("strong",{children:L})," left."]})}const E=e.jsx(e.Fragment,{children:y?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bpb-plan-usage__head",children:[P&&e.jsx($s,{size:16,className:D("bpb-plan-usage__alert",`bpb-plan-usage__alert--${I}`)}),e.jsx("span",{className:"bpb-plan-usage__plan",children:y.label}),e.jsxs("span",{className:"bpb-plan-usage__count",children:[Ke(y.used,y.unit)," / ",Ke(y.quota,y.unit)]}),a&&!P&&e.jsx($e,{size:15,className:"bpb-plan-usage__chevron"})]}),e.jsx("div",{className:"bpb-plan-usage__bar",role:"progressbar","aria-valuenow":S,"aria-valuemin":0,"aria-valuemax":100,children:e.jsx("div",{className:D("bpb-plan-usage__fill",`bpb-plan-usage__fill--${I}`),style:{width:`${O}%`}})}),i?e.jsxs("p",{className:"bpb-plan-usage__status",children:[e.jsxs("strong",{className:D("bpb-plan-usage__status-word",`bpb-plan-usage__status-word--${I}`),children:[i,"."]})," ",T&&e.jsx("span",{className:"bpb-plan-usage__status-detail",children:T})]}):M&&e.jsxs("span",{className:"bpb-plan-usage__reset",children:["Resets ",M]}),a&&P&&e.jsxs("span",{className:"bpb-plan-usage__cta",children:["View plan options",e.jsx(pa,{size:14})]})]}):e.jsxs("div",{className:"bpb-plan-usage__head",children:[e.jsx("span",{className:"bpb-plan-usage__plan",children:f?ae(f.name):"Free"}),a&&e.jsx($e,{size:15,className:"bpb-plan-usage__chevron"})]})}),ee=D("bpb-plan-usage bpb-scope",`bpb-plan-usage--${n}`,P&&`bpb-plan-usage--${I}`,a&&"bpb-plan-usage--clickable",r);return a?e.jsx("button",{type:"button",className:ee,style:t,onClick:a,children:E}):e.jsx("div",{className:ee,style:t,children:E})},sn=({children:a,delay:s=200,placement:n="top",period:r,onUpgrade:t,block:o=!1,className:l})=>{const{isOutdatedBilling:c,locale:b,analytics:u}=U(),{data:h}=De({period:r,enabled:!c}),{data:d}=Ne({enabled:!c}),{data:_}=we(),[f,k]=N.useState(!1),v=N.useRef(null),m=()=>{v.current&&(clearTimeout(v.current),v.current=null)};N.useEffect(()=>m,[]);const y=Re(h),S=!c&&y.length>0,O=()=>{S&&(m(),v.current=setTimeout(()=>k(!0),Math.max(0,s)))},I=()=>{m(),k(!1)},P=_==null?void 0:_.find(L=>L.id===(d==null?void 0:d.plan.current.planId)),A=P?ae(P.name):"Free",M=d!=null&&d.plan.current.periodEnd?Ee(d.plan.current.periodEnd,b):null,i=P?ie(P)==="community":!P,T=i?y.find(L=>L.key==="conversation_sessions"):void 0,E=i&&!!t,ee=()=>{u.capture(le.UPGRADE_CTA_CLICKED,{source:"usage_popover"}),t==null||t()};return e.jsxs("span",{className:D("bpb-usage-pop bpb-scope",o&&"bpb-usage-pop--block",l),onMouseEnter:O,onMouseLeave:I,onFocus:O,onBlur:I,children:[a,f&&S&&e.jsxs("span",{className:D("bpb-usage-pop__card",`bpb-usage-pop__card--${n}`),role:"tooltip",children:[i?e.jsxs("span",{className:"bpb-usage-pop__header",children:[e.jsx("span",{className:"bpb-usage-pop__plan-name",children:"Free plan usage"}),T&&e.jsxs("span",{className:"bpb-usage-pop__subtitle",children:[e.jsxs("strong",{children:[J(T.quota)," conversations"]})," included, total. They don’t renew, and Free has no top-ups."]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"bpb-usage-pop__plan",children:[e.jsxs("span",{className:"bpb-usage-pop__plan-name",children:[A," plan"]}),M&&e.jsxs("span",{className:"bpb-usage-pop__reset",children:["Resets ",M]})]}),e.jsx("span",{className:"bpb-usage-pop__title",children:"Usage this period"})]}),y.map(L=>{const ne=L.pct>0?Math.max(5,L.pct):0;return e.jsxs("span",{className:"bpb-usage-pop__item",children:[e.jsxs("span",{className:"bpb-usage-pop__head",children:[e.jsx("span",{className:"bpb-usage-pop__name",children:L.label}),e.jsxs("span",{className:"bpb-usage-pop__val",children:[Ke(L.used,L.unit)," / ",Ke(L.quota,L.unit)]})]}),e.jsx("span",{className:"bpb-usage-pop__bar",children:e.jsx("span",{className:D("bpb-usage-pop__fill",`bpb-usage-pop__fill--${ya(L.pct)}`),style:{width:`${ne}%`}})})]},L.key)}),E&&e.jsxs("span",{className:"bpb-usage-pop__nudge",children:[e.jsxs("span",{className:"bpb-usage-pop__nudge-text",children:[e.jsx("strong",{children:"Need more room?"})," Plus includes 250 conversations a month, unlimited AI agents, and packs of 100 when you need them."]}),e.jsxs("button",{type:"button",className:"bpb-usage-pop__nudge-cta",onClick:ee,children:["See what you get with Plus",e.jsx(pa,{size:14})]})]})]})]})},Zr=({size:a=20,thickness:s=3.5,showLabel:n=!1,onClick:r,popoverDelay:t=200,period:o,className:l,...c})=>{const{isOutdatedBilling:b}=U(),{data:u}=De({period:o,enabled:!b}),h=Re(u);if(b||h.length===0)return null;const d=h[0],_=ya(d.pct),f=d.pct>0?Math.max(5,d.pct):0,k=(a-s)/2,v=2*Math.PI*k,m=v*(1-f/100),y=c["aria-label"]??`${Math.round(d.pct)}% of your ${d.label.toLowerCase()} used`,S=e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:"bpb-usage-ring__svg",width:a,height:a,viewBox:`0 0 ${a} ${a}`,"aria-hidden":!0,children:[e.jsx("circle",{className:"bpb-usage-ring__track",cx:a/2,cy:a/2,r:k,fill:"none",strokeWidth:s}),e.jsx("circle",{className:D("bpb-usage-ring__arc",`bpb-usage-ring__arc--${_}`),cx:a/2,cy:a/2,r:k,fill:"none",strokeWidth:s,strokeLinecap:"round",strokeDasharray:v,strokeDashoffset:m,transform:`rotate(-90 ${a/2} ${a/2})`})]}),n&&e.jsxs("span",{className:"bpb-usage-ring__label",children:[Math.round(d.pct),"%"]})]}),O=D("bpb-usage-ring",r&&"bpb-usage-ring--clickable"),I=r?e.jsx("button",{type:"button",className:O,onClick:r,"aria-label":y,children:S}):e.jsx("span",{className:O,tabIndex:0,role:"img","aria-label":y,children:S});return e.jsx(sn,{delay:t,period:o,className:l,children:I})};p.AddonsSummaryCard=Yr,p.ArrowRightIcon=pa,p.BILLING_EVENTS=le,p.Badge=la,p.BankIcon=br,p.BillingProvider=gn,p.BoltIcon=ia,p.Button=ue,p.CalendarIcon=Fs,p.CardBrandBadge=ua,p.CardIcon=$a,p.ChartIcon=Ps,p.CheckIcon=Es,p.CheckoutDialog=Ks,p.ChevronDownIcon=ba,p.ChevronLeftIcon=zs,p.ChevronRightIcon=$e,p.CloseIcon=da,p.DEFAULT_FEATURE_DESCRIPTIONS=Ba,p.DEFAULT_FEATURE_LABELS=Xs,p.DEFAULT_PLAN_FEATURES=ra,p.Dialog=ve,p.DownloadIcon=Fa,p.ENTERPRISE_CONTACT_URL=Da,p.ExternalLinkIcon=Xe,p.GlobeIcon=Ds,p.InfinityIcon=Ms,p.InfoTooltip=Je,p.Input=ma,p.InvoicesDialog=Lr,p.LayersIcon=ca,p.LockIcon=pr,p.ManageAddonsDialog=Ar,p.MessageIcon=Ts,p.MinusIcon=Us,p.NANO_DOLLARS_PER_DOLLAR=ga,p.OutdatedBillingGate=Fe,p.OutgrowFreeDialog=$r,p.PLAN_ORDER=Oe,p.PaintIcon=Bs,p.PaymentMethodDialog=xr,p.PlanBanner=Hr,p.PlanSummaryCard=jr,p.PlanUsageWidget=Qr,p.PlusIcon=Os,p.PuzzleIcon=Ls,p.ReceiptIcon=ur,p.SegmentedControl=qs,p.Select=ja,p.ShieldIcon=Oa,p.Skeleton=V,p.SparkleIcon=Ua,p.Stepper=js,p.USAGE_METRICS=Js,p.UpgradePlanDialog=Ws,p.UsageBanner=Kr,p.UsageDashboard=Gr,p.UsagePopover=sn,p.UsageRing=Zr,p.UsersIcon=xs,p.addDays=ws,p.addonDisplayName=Ze,p.addonLimitsPreview=Is,p.addonPrice=ta,p.billingKeys=ce,p.cn=D,p.conversationPackPrice=oa,p.conversationsAddon=Cs,p.currencySymbol=Qe,p.featureDescription=za,p.featureLabel=Dr,p.formatBytes=Ue,p.formatCurrency=Q,p.formatDate=Ee,p.formatQuantity=J,p.formatUsage=Ke,p.getCardElementStyle=Va,p.getStripeAppearance=Ga,p.getStripePromise=Xa,p.iconForFeature=ha,p.planDisplayName=ae,p.planEntitlements=As,p.planKind=ie,p.toStripeLocale=Ka,p.usageItems=Re,p.usageTier=ya,p.useAddons=Pe,p.useBilling=U,p.useBillingAddress=ka,p.useBillingReadonly=Ca,p.useCreatePaymentMethodIntent=Sa,p.useCustomer=wa,p.useInvoices=Ja,p.usePaymentMethod=Na,p.usePlans=we,p.useSetAddons=as,p.useSetBillingAddress=Aa,p.useSetCustomer=Ea,p.useSetPaymentMethod=Ia,p.useSetSubscription=Ta,p.useSubscription=Ne,p.useSubscriptionPreview=va,p.useSupportsUsageByBot=es,p.useUsage=De,p.useUsageByBot=Ra,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|