@bpinternal/billing-ui 0.1.0 → 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 +54 -2
- package/dist/index.js +2069 -1809
- 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,oe,N,nn,rn,ye){"use strict";const ja=new Map;function Ya(a){let s=ja.get(a);return s||(s=nn.loadStripe(a,{developerTools:{assistant:{enabled:!1}}}),ja.set(a,s)),s}const ua=N.createContext(null),tn={capture:()=>{}};function on(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 ln=({client:a,stripePublishableKey:s,email:n,locale:r="en-US",theme:t="light",onToast:o,analytics:l,featureLabels:c,billingVersion:i,workspaceId:h,persist:m=!0,manageBillingUrl:b,onBillingChange:y,refreshInterval:f=3e4,children:w})=>{const C=h||"default",[u]=N.useState(()=>new oe.QueryClient({defaultOptions:{queries:{retry:1,staleTime:3e4,gcTime:1e3*60*60}}})),_=on(t),A=N.useMemo(()=>Ya(s),[s]);N.useEffect(()=>{if(!m||typeof window>"u")return;const E=`bpb-cache:${C}`;try{const x=window.localStorage.getItem(E);x&&oe.hydrate(u,JSON.parse(x))}catch{window.localStorage.removeItem(E)}let p=null;const B=u.getQueryCache().subscribe(x=>{x.type!=="added"&&x.type!=="removed"&&x.type!=="updated"||(p&&clearTimeout(p),p=setTimeout(()=>{try{window.localStorage.setItem(E,JSON.stringify(oe.dehydrate(u)))}catch{}},250))});return()=>{p&&clearTimeout(p),B()}},[m,C,u]);const O=N.useCallback(()=>u.invalidateQueries({queryKey:["bpb",C]}),[u,C]),M=N.useCallback(E=>y==null?void 0:y(E),[y]),S=f>0?f:!1,I=N.useMemo(()=>({client:a,queryClient:u,scope:C,stripePromise:A,email:n,locale:r,isDark:_,toast:o??(()=>{}),analytics:l??tn,featureLabels:c,isOutdatedBilling:i!==void 0&&i!=="v4",manageBillingUrl:b,refetchInterval:S,refresh:O,notifyBillingChange:M}),[a,u,C,A,n,r,_,o,l,c,i,b,S,O,M]);return e.jsx(ua.Provider,{value:I,children:e.jsx("div",{className:"bpb-scope","data-bpb-theme":_?"dark":"light",style:{display:"contents"},children:w})})};function P(){const a=N.useContext(ua);if(!a)throw new Error("@bpinternal/billing-ui components must be rendered inside <BillingProvider>");return a}function cn(){var a;return((a=N.useContext(ua))==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"},se={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 Ie(){const{client:a,queryClient:s,scope:n}=P();return oe.useQuery({queryKey:se.plans(n),queryFn:()=>a.listPlans({})},s)}function qe(){const{client:a,queryClient:s,scope:n}=P();return oe.useQuery({queryKey:se.addons(n),queryFn:()=>a.listAddons({})},s)}function ke(a){const{client:s,queryClient:n,scope:r,refetchInterval:t}=P();return oe.useQuery({queryKey:se.subscription(r),queryFn:()=>s.getSubscription({}),enabled:(a==null?void 0:a.enabled)??!0,refetchInterval:t},n)}function ha(a,s){const{client:n,queryClient:r,scope:t}=P();return oe.useQuery({queryKey:se.preview(t,a),queryFn:()=>n.previewSubscriptionUpdate(a),enabled:(s==null?void 0:s.enabled)??!0},r)}function ma(a){const{client:s,queryClient:n,scope:r}=P();return oe.useQuery({queryKey:se.paymentMethod(r),queryFn:()=>s.getPaymentMethod({}),enabled:(a==null?void 0:a.enabled)??!0},n)}function ga(a){const{client:s,queryClient:n,scope:r}=P();return oe.useQuery({queryKey:se.billingAddress(r),queryFn:()=>s.getBillingAddress({}),enabled:(a==null?void 0:a.enabled)??!0},n)}function ya(a){const{client:s,queryClient:n,scope:r}=P();return oe.useQuery({queryKey:se.customer(r),queryFn:()=>s.getCustomer({}),enabled:(a==null?void 0:a.enabled)??!0},n)}function Ha(a){const{client:s,queryClient:n,scope:r,refetchInterval:t}=P();return oe.useQuery({queryKey:se.invoices(r),queryFn:()=>s.listInvoices({}),enabled:(a==null?void 0:a.enabled)??!0,refetchInterval:t},n)}function fa(a){const{client:s,queryClient:n,scope:r}=P();return oe.useQuery({queryKey:se.readonly(r),queryFn:()=>s.getBillingReadonly({}),enabled:(a==null?void 0:a.enabled)??!0},n)}function We(a){const{client:s,queryClient:n,scope:r,refetchInterval:t}=P(),o=a!=null&&a.period?new Date(a.period):new Date,l=`${o.getUTCFullYear()}-${String(o.getUTCMonth()+1).padStart(2,"0")}`;return oe.useQuery({queryKey:se.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 Qa(a,s){const{client:n,queryClient:r,scope:t,refetchInterval:o}=P(),l=n.breakDownWorkspaceUsageByBot,c=n.listBots,i=typeof l=="function"&&typeof c=="function",h=s!=null&&s.period?new Date(s.period):new Date,m=`${h.getUTCFullYear()}-${String(h.getUTCMonth()+1).padStart(2,"0")}`;return oe.useQuery({queryKey:se.usageByBot(t,a,m),queryFn:async()=>{const[b,y]=await Promise.all([l({id:t,type:a,period:`${m}-01T00:00:00.000Z`}),c({})]),f=new Map(y.bots.map(w=>[w.id,w.name]));return b.data.map(w=>({botId:w.botId,name:f.get(w.botId)??w.botId,value:w.value})).sort((w,C)=>C.value-w.value)},enabled:i&&((s==null?void 0:s.enabled)??!0),refetchInterval:o},r)}function Za(){const{client:a}=P();return typeof a.breakDownWorkspaceUsageByBot=="function"&&typeof a.listBots=="function"}function _a(){const{client:a,queryClient:s}=P();return oe.useMutation({mutationFn:()=>a.createPaymentMethodIntent({})},s)}function va(){const{client:a,queryClient:s,scope:n,notifyBillingChange:r}=P();return oe.useMutation({mutationFn:t=>a.setPaymentMethod(t),onSuccess:async()=>{await s.invalidateQueries({queryKey:se.paymentMethod(n)}),r({type:"payment-method"})}},s)}function ka(){const{client:a,queryClient:s,scope:n,notifyBillingChange:r}=P();return oe.useMutation({mutationFn:async t=>{await a.setBillingAddress(t)},onSuccess:async()=>{await Promise.all([s.invalidateQueries({queryKey:se.billingAddress(n)}),s.invalidateQueries({queryKey:se.customer(n)})]),r({type:"billing-address"})}},s)}function Na(){const{client:a,queryClient:s,scope:n}=P();return oe.useMutation({mutationFn:r=>a.setCustomer(r),onSuccess:()=>s.invalidateQueries({queryKey:se.customer(n)})},s)}function Xa(){const{client:a,queryClient:s,scope:n,notifyBillingChange:r}=P();return oe.useMutation({mutationFn:async t=>{await a.setAddons(t)},onSuccess:async()=>{await Promise.all([s.invalidateQueries({queryKey:se.subscription(n)}),s.invalidateQueries({queryKey:se.invoices(n)}),s.invalidateQueries({queryKey:["bpb",n,"preview"]})]),r({type:"addons"})}},s)}function wa(){const{client:a,queryClient:s,scope:n,notifyBillingChange:r}=P();return oe.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:se.subscription(n)}),s.invalidateQueries({queryKey:se.plans(n)}),s.invalidateQueries({queryKey:se.invoices(n)}),s.invalidateQueries({queryKey:["bpb",n,"preview"]})]),r({type:"subscription"})}},s)}function Ja(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=Ja(a[s]))&&(r&&(r+=" "),r+=n)}else for(n in a)a[n]&&(r&&(r+=" "),r+=n);return r}function dn(){for(var a,s,n=0,r="",t=arguments.length;n<t;n++)(a=arguments[n])&&(s=Ja(a))&&(r&&(r+=" "),r+=s);return r}const bn=(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},pn=(a,s)=>({classGroupId:a,validator:s}),Ra=(a=new Map,s=null,n)=>({nextPart:a,validators:s,classGroupId:n}),Ze="-",es=[],un="arbitrary..",hn=a=>{const s=gn(a),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=a;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return mn(l);const c=l.split(Ze),i=c[0]===""&&c.length>1?1:0;return as(c,i,s)},getConflictingClassGroupIds:(l,c)=>{if(c){const i=r[l],h=n[l];return i?h?bn(h,i):i:h||es}return n[l]||es}}},as=(a,s,n)=>{if(a.length-s===0)return n.classGroupId;const t=a[s],o=n.nextPart.get(t);if(o){const h=as(a,s+1,o);if(h)return h}const l=n.validators;if(l===null)return;const c=s===0?a.join(Ze):a.slice(s).join(Ze),i=l.length;for(let h=0;h<i;h++){const m=l[h];if(m.validator(c))return m.classGroupId}},mn=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?un+r:void 0})(),gn=a=>{const{theme:s,classGroups:n}=a;return yn(n,s)},yn=(a,s)=>{const n=Ra();for(const r in a){const t=a[r];Ca(t,n,r,s)}return n},Ca=(a,s,n,r)=>{const t=a.length;for(let o=0;o<t;o++){const l=a[o];fn(l,s,n,r)}},fn=(a,s,n,r)=>{if(typeof a=="string"){_n(a,s,n);return}if(typeof a=="function"){vn(a,s,n,r);return}kn(a,s,n,r)},_n=(a,s,n)=>{const r=a===""?s:ss(s,a);r.classGroupId=n},vn=(a,s,n,r)=>{if(Nn(a)){Ca(a(r),s,n,r);return}s.validators===null&&(s.validators=[]),s.validators.push(pn(n,a))},kn=(a,s,n,r)=>{const t=Object.entries(a),o=t.length;for(let l=0;l<o;l++){const[c,i]=t[l];Ca(i,ss(s,c),n,r)}},ss=(a,s)=>{let n=a;const r=s.split(Ze),t=r.length;for(let o=0;o<t;o++){const l=r[o];let c=n.nextPart.get(l);c||(c=Ra(),n.nextPart.set(l,c)),n=c}return n},Nn=a=>"isThemeGetter"in a&&a.isThemeGetter===!0,wn=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)}}},Sa="!",ns=":",Cn=[],rs=(a,s,n,r,t)=>({modifiers:a,hasImportantModifier:s,baseClassName:n,maybePostfixModifierPosition:r,isExternal:t}),Sn=a=>{const{prefix:s,experimentalParseClassName:n}=a;let r=t=>{const o=[];let l=0,c=0,i=0,h;const m=t.length;for(let C=0;C<m;C++){const u=t[C];if(l===0&&c===0){if(u===ns){o.push(t.slice(i,C)),i=C+1;continue}if(u==="/"){h=C;continue}}u==="["?l++:u==="]"?l--:u==="("?c++:u===")"&&c--}const b=o.length===0?t:t.slice(i);let y=b,f=!1;b.endsWith(Sa)?(y=b.slice(0,-1),f=!0):b.startsWith(Sa)&&(y=b.slice(1),f=!0);const w=h&&h>i?h-i:void 0;return rs(o,f,y,w)};if(s){const t=s+ns,o=r;r=l=>l.startsWith(t)?o(l.slice(t.length)):rs(Cn,!1,l,void 0,!0)}if(n){const t=r;r=o=>n({className:o,parseClassName:t})}return r},In=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]==="[",i=s.has(l);c||i?(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}},An=a=>({cache:wn(a.cacheSize),parseClassName:Sn(a),sortModifiers:In(a),postfixLookupClassGroupIds:En(a),...hn(a)}),En=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},Tn=/\s+/,xn=(a,s)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:t,sortModifiers:o,postfixLookupClassGroupIds:l}=s,c=[],i=a.trim().split(Tn);let h="";for(let m=i.length-1;m>=0;m-=1){const b=i[m],{isExternal:y,modifiers:f,hasImportantModifier:w,baseClassName:C,maybePostfixModifierPosition:u}=n(b);if(y){h=b+(h.length>0?" "+h:h);continue}let _=!!u,A;if(_){const E=C.substring(0,u);A=r(E);const p=A&&l[A]?r(C):void 0;p&&p!==A&&(A=p,_=!1)}else A=r(C);if(!A){if(!_){h=b+(h.length>0?" "+h:h);continue}if(A=r(C),!A){h=b+(h.length>0?" "+h:h);continue}_=!1}const O=f.length===0?"":f.length===1?f[0]:o(f).join(":"),M=w?O+Sa:O,S=M+A;if(c.indexOf(S)>-1)continue;c.push(S);const I=t(A,_);for(let E=0;E<I.length;++E){const p=I[E];c.push(M+p)}h=b+(h.length>0?" "+h:h)}return h},Ln=(...a)=>{let s=0,n,r,t="";for(;s<a.length;)(n=a[s++])&&(r=ts(n))&&(t&&(t+=" "),t+=r);return t},ts=a=>{if(typeof a=="string")return a;let s,n="";for(let r=0;r<a.length;r++)a[r]&&(s=ts(a[r]))&&(n&&(n+=" "),n+=s);return n},Mn=(a,...s)=>{let n,r,t,o;const l=i=>{const h=s.reduce((m,b)=>b(m),a());return n=An(h),r=n.cache.get,t=n.cache.set,o=c,c(i)},c=i=>{const h=r(i);if(h)return h;const m=xn(i,n);return t(i,m),m};return o=l,(...i)=>o(Ln(...i))},Pn=[],ce=a=>{const s=n=>n[a]||Pn;return s.isThemeGetter=!0,s},os=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ls=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Dn=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Bn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zn=/\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$/,Un=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,On=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$n=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,xe=a=>Dn.test(a),D=a=>!!a&&!Number.isNaN(Number(a)),Ne=a=>!!a&&Number.isInteger(Number(a)),Ia=a=>a.endsWith("%")&&D(a.slice(0,-1)),Ae=a=>Bn.test(a),cs=()=>!0,Fn=a=>zn.test(a)&&!Un.test(a),Aa=()=>!1,qn=a=>On.test(a),Wn=a=>$n.test(a),Gn=a=>!v(a)&&!k(a),Vn=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)),Kn=a=>Le(a,hs,Aa),v=a=>os.test(a),Pe=a=>Le(a,ms,Fn),is=a=>Le(a,Rn,D),jn=a=>Le(a,ys,cs),Yn=a=>Le(a,gs,Aa),ds=a=>Le(a,ps,Aa),Hn=a=>Le(a,us,Wn),Xe=a=>Le(a,fs,qn),k=a=>ls.test(a),je=a=>De(a,ms),Qn=a=>De(a,gs),bs=a=>De(a,ps),Zn=a=>De(a,hs),Xn=a=>De(a,us),Je=a=>De(a,fs,!0),Jn=a=>De(a,ys,!0),Le=(a,s,n)=>{const r=os.exec(a);return r?r[1]?s(r[1]):n(r[2]):!1},De=(a,s,n=!1)=>{const r=ls.exec(a);return r?r[1]?s(r[1]):n:!1},ps=a=>a==="position"||a==="percentage",us=a=>a==="image"||a==="url",hs=a=>a==="length"||a==="size"||a==="bg-size",ms=a=>a==="length",Rn=a=>a==="number",gs=a=>a==="family-name",ys=a=>a==="number"||a==="weight",fs=a=>a==="shadow",er=Mn(()=>{const a=ce("color"),s=ce("font"),n=ce("text"),r=ce("font-weight"),t=ce("tracking"),o=ce("leading"),l=ce("breakpoint"),c=ce("container"),i=ce("spacing"),h=ce("radius"),m=ce("shadow"),b=ce("inset-shadow"),y=ce("text-shadow"),f=ce("drop-shadow"),w=ce("blur"),C=ce("perspective"),u=ce("aspect"),_=ce("ease"),A=ce("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...M(),k,v],I=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],p=()=>[k,v,i],B=()=>[xe,"full","auto",...p()],x=()=>[Ne,"none","subgrid",k,v],Y=()=>["auto",{span:["full",Ne,k,v]},Ne,k,v],Z=()=>[Ne,"auto",k,v],ae=()=>["auto","min","max","fr",k,v],pe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],de=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...p()],J=()=>[xe,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...p()],ue=()=>[xe,"screen","full","dvw","lvw","svw","min","max","fit",...p()],T=()=>[xe,"screen","full","lh","dvh","lvh","svh","min","max","fit",...p()],g=()=>[a,k,v],U=()=>[...M(),bs,ds,{position:[k,v]}],W=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",Zn,Kn,{size:[k,v]}],re=()=>[Ia,je,Pe],q=()=>["","none","full",h,k,v],j=()=>["",D,je,Pe],we=()=>["solid","dashed","dotted","double"],Ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>[D,Ia,bs,ds],R=()=>["","none",w,k,v],te=()=>["none",D,k,v],Se=()=>["none",D,k,v],he=()=>[D,k,v],me=()=>[xe,"full",...p()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ae],breakpoint:[Ae],color:[cs],container:[Ae],"drop-shadow":[Ae],ease:["in","out","in-out"],font:[Gn],"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",D],text:[Ae],"text-shadow":[Ae],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",xe,v,k,u]}],container:["container"],"container-type":[{"@container":["","normal","size",k,v]}],"container-named":[Vn],columns:[{columns:[D,v,k,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:S()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],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:[Ne,"auto",k,v]}],basis:[{basis:[xe,"full","auto",c,...p()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[D,xe,"auto","initial","none",v]}],grow:[{grow:["",D,k,v]}],shrink:[{shrink:["",D,k,v]}],order:[{order:[Ne,"first","last","none",k,v]}],"grid-cols":[{"grid-cols":x()}],"col-start-end":[{col:Y()}],"col-start":[{"col-start":Z()}],"col-end":[{"col-end":Z()}],"grid-rows":[{"grid-rows":x()}],"row-start-end":[{row:Y()}],"row-start":[{"row-start":Z()}],"row-end":[{"row-end":Z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ae()}],"auto-rows":[{"auto-rows":ae()}],gap:[{gap:p()}],"gap-x":[{"gap-x":p()}],"gap-y":[{"gap-y":p()}],"justify-content":[{justify:[...pe(),"normal"]}],"justify-items":[{"justify-items":[...de(),"normal"]}],"justify-self":[{"justify-self":["auto",...de()]}],"align-content":[{content:["normal",...pe()]}],"align-items":[{items:[...de(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...de(),{baseline:["","last"]}]}],"place-content":[{"place-content":pe()}],"place-items":[{"place-items":[...de(),"baseline"]}],"place-self":[{"place-self":["auto",...de()]}],p:[{p:p()}],px:[{px:p()}],py:[{py:p()}],ps:[{ps:p()}],pe:[{pe:p()}],pbs:[{pbs:p()}],pbe:[{pbe:p()}],pt:[{pt:p()}],pr:[{pr:p()}],pb:[{pb:p()}],pl:[{pl:p()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":p()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":p()}],"space-y-reverse":["space-y-reverse"],size:[{size:J()}],"inline-size":[{inline:["auto",...ue()]}],"min-inline-size":[{"min-inline":["auto",...ue()]}],"max-inline-size":[{"max-inline":["none",...ue()]}],"block-size":[{block:["auto",...T()]}],"min-block-size":[{"min-block":["auto",...T()]}],"max-block-size":[{"max-block":["none",...T()]}],w:[{w:[c,"screen",...J()]}],"min-w":[{"min-w":[c,"screen","none",...J()]}],"max-w":[{"max-w":[c,"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,je,Pe]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Jn,jn]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ia,v]}],"font-family":[{font:[Qn,Yn,s]}],"font-features":[{"font-features":[v]}],"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,k,v]}],"line-clamp":[{"line-clamp":[D,"none",k,is]}],leading:[{leading:[o,...p()]}],"list-image":[{"list-image":["none",k,v]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",k,v]}],"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:[...we(),"wavy"]}],"text-decoration-thickness":[{decoration:[D,"from-font","auto",k,Pe]}],"text-decoration-color":[{decoration:g()}],"underline-offset":[{"underline-offset":[D,"auto",k,v]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:p()}],"tab-size":[{tab:[Ne,k,v]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",k,v]}],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",k,v]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:U()}],"bg-repeat":[{bg:W()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ne,k,v],radial:["",k,v],conic:[Ne,k,v]},Xn,Hn]}],"bg-color":[{bg:g()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:g()}],"gradient-via":[{via:g()}],"gradient-to":[{to:g()}],rounded:[{rounded:q()}],"rounded-s":[{"rounded-s":q()}],"rounded-e":[{"rounded-e":q()}],"rounded-t":[{"rounded-t":q()}],"rounded-r":[{"rounded-r":q()}],"rounded-b":[{"rounded-b":q()}],"rounded-l":[{"rounded-l":q()}],"rounded-ss":[{"rounded-ss":q()}],"rounded-se":[{"rounded-se":q()}],"rounded-ee":[{"rounded-ee":q()}],"rounded-es":[{"rounded-es":q()}],"rounded-tl":[{"rounded-tl":q()}],"rounded-tr":[{"rounded-tr":q()}],"rounded-br":[{"rounded-br":q()}],"rounded-bl":[{"rounded-bl":q()}],"border-w":[{border:j()}],"border-w-x":[{"border-x":j()}],"border-w-y":[{"border-y":j()}],"border-w-s":[{"border-s":j()}],"border-w-e":[{"border-e":j()}],"border-w-bs":[{"border-bs":j()}],"border-w-be":[{"border-be":j()}],"border-w-t":[{"border-t":j()}],"border-w-r":[{"border-r":j()}],"border-w-b":[{"border-b":j()}],"border-w-l":[{"border-l":j()}],"divide-x":[{"divide-x":j()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":j()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...we(),"hidden","none"]}],"divide-style":[{divide:[...we(),"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:[...we(),"none","hidden"]}],"outline-offset":[{"outline-offset":[D,k,v]}],"outline-w":[{outline:["",D,je,Pe]}],"outline-color":[{outline:g()}],shadow:[{shadow:["","none",m,Je,Xe]}],"shadow-color":[{shadow:g()}],"inset-shadow":[{"inset-shadow":["none",b,Je,Xe]}],"inset-shadow-color":[{"inset-shadow":g()}],"ring-w":[{ring:j()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:g()}],"ring-offset-w":[{"ring-offset":[D,Pe]}],"ring-offset-color":[{"ring-offset":g()}],"inset-ring-w":[{"inset-ring":j()}],"inset-ring-color":[{"inset-ring":g()}],"text-shadow":[{"text-shadow":["none",y,Je,Xe]}],"text-shadow-color":[{"text-shadow":g()}],opacity:[{opacity:[D,k,v]}],"mix-blend":[{"mix-blend":[...Ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ce()}],"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":[D]}],"mask-image-linear-from-pos":[{"mask-linear-from":G()}],"mask-image-linear-to-pos":[{"mask-linear-to":G()}],"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":G()}],"mask-image-t-to-pos":[{"mask-t-to":G()}],"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":G()}],"mask-image-r-to-pos":[{"mask-r-to":G()}],"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":G()}],"mask-image-b-to-pos":[{"mask-b-to":G()}],"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":G()}],"mask-image-l-to-pos":[{"mask-l-to":G()}],"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":G()}],"mask-image-x-to-pos":[{"mask-x-to":G()}],"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":G()}],"mask-image-y-to-pos":[{"mask-y-to":G()}],"mask-image-y-from-color":[{"mask-y-from":g()}],"mask-image-y-to-color":[{"mask-y-to":g()}],"mask-image-radial":[{"mask-radial":[k,v]}],"mask-image-radial-from-pos":[{"mask-radial-from":G()}],"mask-image-radial-to-pos":[{"mask-radial-to":G()}],"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":M()}],"mask-image-conic-pos":[{"mask-conic":[D]}],"mask-image-conic-from-pos":[{"mask-conic-from":G()}],"mask-image-conic-to-pos":[{"mask-conic-to":G()}],"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:U()}],"mask-repeat":[{mask:W()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",k,v]}],filter:[{filter:["","none",k,v]}],blur:[{blur:R()}],brightness:[{brightness:[D,k,v]}],contrast:[{contrast:[D,k,v]}],"drop-shadow":[{"drop-shadow":["","none",f,Je,Xe]}],"drop-shadow-color":[{"drop-shadow":g()}],grayscale:[{grayscale:["",D,k,v]}],"hue-rotate":[{"hue-rotate":[D,k,v]}],invert:[{invert:["",D,k,v]}],saturate:[{saturate:[D,k,v]}],sepia:[{sepia:["",D,k,v]}],"backdrop-filter":[{"backdrop-filter":["","none",k,v]}],"backdrop-blur":[{"backdrop-blur":R()}],"backdrop-brightness":[{"backdrop-brightness":[D,k,v]}],"backdrop-contrast":[{"backdrop-contrast":[D,k,v]}],"backdrop-grayscale":[{"backdrop-grayscale":["",D,k,v]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[D,k,v]}],"backdrop-invert":[{"backdrop-invert":["",D,k,v]}],"backdrop-opacity":[{"backdrop-opacity":[D,k,v]}],"backdrop-saturate":[{"backdrop-saturate":[D,k,v]}],"backdrop-sepia":[{"backdrop-sepia":["",D,k,v]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":p()}],"border-spacing-x":[{"border-spacing-x":p()}],"border-spacing-y":[{"border-spacing-y":p()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",k,v]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[D,"initial",k,v]}],ease:[{ease:["linear","initial",_,k,v]}],delay:[{delay:[D,k,v]}],animate:[{animate:["none",A,k,v]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[C,k,v]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:te()}],"rotate-x":[{"rotate-x":te()}],"rotate-y":[{"rotate-y":te()}],"rotate-z":[{"rotate-z":te()}],scale:[{scale:Se()}],"scale-x":[{"scale-x":Se()}],"scale-y":[{"scale-y":Se()}],"scale-z":[{"scale-z":Se()}],"scale-3d":["scale-3d"],skew:[{skew:he()}],"skew-x":[{"skew-x":he()}],"skew-y":[{"skew-y":he()}],transform:[{transform:[k,v,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:me()}],"translate-x":[{"translate-x":me()}],"translate-y":[{"translate-y":me()}],"translate-z":[{"translate-z":me()}],"translate-none":["translate-none"],zoom:[{zoom:[Ne,k,v]}],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",k,v]}],"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":p()}],"scroll-mx":[{"scroll-mx":p()}],"scroll-my":[{"scroll-my":p()}],"scroll-ms":[{"scroll-ms":p()}],"scroll-me":[{"scroll-me":p()}],"scroll-mbs":[{"scroll-mbs":p()}],"scroll-mbe":[{"scroll-mbe":p()}],"scroll-mt":[{"scroll-mt":p()}],"scroll-mr":[{"scroll-mr":p()}],"scroll-mb":[{"scroll-mb":p()}],"scroll-ml":[{"scroll-ml":p()}],"scroll-p":[{"scroll-p":p()}],"scroll-px":[{"scroll-px":p()}],"scroll-py":[{"scroll-py":p()}],"scroll-ps":[{"scroll-ps":p()}],"scroll-pe":[{"scroll-pe":p()}],"scroll-pbs":[{"scroll-pbs":p()}],"scroll-pbe":[{"scroll-pbe":p()}],"scroll-pt":[{"scroll-pt":p()}],"scroll-pr":[{"scroll-pr":p()}],"scroll-pb":[{"scroll-pb":p()}],"scroll-pl":[{"scroll-pl":p()}],"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",k,v]}],fill:[{fill:["none",...g()]}],"stroke-w":[{stroke:[D,je,Pe,is]}],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 L(...a){return er(dn(a))}function K(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 _s(a,s){const n=new Date(a);return n.setDate(n.getDate()+s),n.toISOString()}function ne(a){return new Intl.NumberFormat("en-US").format(a)}function Be(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 vs(a){return{usd:"$",eur:"€",gbp:"£",cad:"$",aud:"$",jpy:"¥"}[a.toLowerCase()]??`${a.toUpperCase()} `}const Ye=["community","plus","team","enterprise","managed"],ar=["community","plus","team","enterprise","managed"];function fe(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 ar.find(t=>t===n)??"community"}const ks="https://botpress.com/contact-us/managed-plan",Ea={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:[]},Ta={"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."},sr=[{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 Ns(a,s){var n;return s!=null&&s[a]?s[a]:Ta[a]?Ta[a]:(n=sr.find(r=>r.test.test(a)))==null?void 0:n.describe(a)}function Re(a,s,n){return a.prices[s.id]??a.prices[fe(s)]??a.prices[n]??null}function He(a){return a.replace("Add-on - ","")}function ws(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 Cs=[{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 Ss(a,s,n){var t;if(!s)return[];const r=[];for(const o of Cs){const l=a.features[o.key]??0;let c=0;for(const i of s){const h=((t=i.increments)==null?void 0:t[o.key])??0,m=n[i.id]??0;c+=h*m}c>0&&r.push({...o,now:l,next:l+c})}return r}function Is(a,s,n){var t;if(!a)return[];const r=[];for(const o of Cs){const l=a.features[o.key]??0;let c=0;for(const i of s??[])c+=(((t=i.increments)==null?void 0:t[o.key])??0)*(n[i.id]??0);(l>0||c>0)&&r.push({...o,base:l,added:c,total:l+c})}return r}function xa(a,s,n){var l;const r=ws(a);if(!r)return null;const t=((l=r.increments)==null?void 0:l.conversation_sessions)??0,o=Re(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:L("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:c="button",...i})=>e.jsxs("button",{type:c,className:L("bpb-btn",`bpb-btn--${a}`,`bpb-btn--${s}`,n&&"bpb-btn--block",t),disabled:o||r,"data-loading":r||void 0,...i,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}),As=({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"})]}),Es=({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"})}),Pa=({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"})]}),Ts=({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"})}),ea=({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"})}),aa=({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"})}),Ls=({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"})]}),Ps=({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"})]}),Ds=({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"})]}),Da=({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"})]}),nr=({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"})}),rr=({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"})]}),sa=({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"})}),na=({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"})}),Bs=({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"})}),Ge=({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"})}),zs=({size:a,...s})=>e.jsx("svg",{...Q(a,s),children:e.jsx("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Us=({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"})}),tr=({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"})]}),ra=({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"})}),Ba=({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"})}),or=({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"})]}),Os=({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"})]}),ta=({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 za(a){const s=a.toLowerCase();return/seat|member|user|team|rbac|rout/.test(s)?Ls:/analytic|report|insight|dashboard/.test(s)?Ms:/whatsapp|channel|chat|message|conversation|webchat|voice/.test(s)?Es:/storage|table|vector|file|gb|rows|db/.test(s)?ea:/domain|help center|whitelabel|website|url|web/.test(s)?Ps:/brand|theme|custom|white-?label/.test(s)?Ds:/unlimited|infinit/.test(s)?xs:/security|sla|compliance|soc|audit/.test(s)||/support|sla|dedicated|priority/.test(s)?Pa:/integration|api|plugin|sdk|adk|studio/.test(s)?Ts:/ai|agent|model|gpt|llm/.test(s)?aa:Ma}const _e=({open:a,onOpenChange:s,size:n="md",children:r,className:t,showClose:o=!0,...l})=>{const c=N.useRef(null),i=cn(),h=N.useCallback(()=>s(!1),[s]);return N.useEffect(()=>{var y;if(!a)return;const m=f=>{f.key==="Escape"&&h()};document.addEventListener("keydown",m);const b=document.body.style.overflow;return document.body.style.overflow="hidden",(y=c.current)==null||y.focus(),()=>{document.removeEventListener("keydown",m),document.body.style.overflow=b}},[a,h]),a?rn.createPortal(e.jsx("div",{className:"bpb-portal bpb-dialog__overlay","data-bpb-theme":i?"dark":"light",onClick:h,children:e.jsxs("div",{ref:c,role:"dialog","aria-modal":"true","aria-label":l["aria-label"],tabIndex:-1,className:L("bpb-dialog",`bpb-dialog--${n}`,t),onClick:m=>m.stopPropagation(),children:[o&&e.jsx("button",{type:"button",className:"bpb-dialog__close","aria-label":"Close",onClick:h,children:e.jsx(sa,{size:18})}),r]})}),document.body):null},oa=({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})]}),ze=()=>{const{manageBillingUrl:a}=P();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(ra,{size:15})]})]})},$s=({options:a,value:s,onChange:n,className:r,...t})=>e.jsx("div",{role:"radiogroup","aria-label":t["aria-label"],className:L("bpb-segmented",r),children:a.map(o=>{const l=o.value===s;return e.jsxs("button",{type:"button",role:"radio","aria-checked":l,className:L("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)})}),$=({width:a,height:s=14,rounded:n=!1,className:r})=>e.jsx("span",{"aria-hidden":!0,className:L("bpb-skeleton",n&&"bpb-skeleton--rounded",r),style:{width:a??"100%",height:s}});function lr(a,s){const n=a.prices[s];return n||((s==="month"?a.prices.year:a.prices.month)??null)}function cr(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 ir(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 Fs=({open:a,onOpenChange:s,onSelectPlan:n,recommendedPlanId:r="team",defaultInterval:t="year",excludePlanIds:o=[],planFeatures:l={},featureDescriptions:c})=>{var z,J,ue;const{isOutdatedBilling:i,toast:h,analytics:m}=P(),[b,y]=N.useState(t),{data:f,isLoading:w}=Ie(),{data:C}=qe(),{data:u}=ke({enabled:a}),{data:_}=fa({enabled:a}),A=wa(),O=(_==null?void 0:_.planReadonly)??!1;N.useEffect(()=>{a&&m.capture(le.PLAN_PICKER_VIEWED,{interval:b})},[a,m]);const M=T=>{T!==b&&m.capture(le.PLAN_INTERVAL_TOGGLED,{interval:T}),y(T)},S=u==null?void 0:u.plan.current.interval,I=f==null?void 0:f.find(T=>T.id===(u==null?void 0:u.plan.current.planId)),E=u?I?fe(I):"community":void 0,p=((z=u==null?void 0:u.plan.next)==null?void 0:z.planId)??null,B=!!p&&p!==(u==null?void 0:u.plan.current.planId),x=O||E==="enterprise"||E==="managed",Y=N.useMemo(()=>f?f.filter(T=>fe(T)!=="managed"&&fe(T)!=="enterprise"&&!o.includes(T.id)).sort((T,g)=>Ye.indexOf(fe(T))-Ye.indexOf(fe(g))):[],[f,o]),Z=N.useMemo(()=>ir(Y),[Y]),ae=((ue=(J=f==null?void 0:f.find(T=>fe(T)==="enterprise"))==null?void 0:J.metadata)==null?void 0:ue.contact_url)??ks,pe=T=>{A.mutate({planId:T.id,interval:b},{onSuccess:()=>{m.capture(le.PLAN_DOWNGRADED,{plan_name:ee(T.name),interval:b,previous_plan_name:I?ee(I.name):void 0}),h({type:"success",message:"Plan downgraded"})},onError:()=>h({type:"error",message:"Downgrade failed"})})},de=()=>{u&&A.mutate({planId:u.plan.current.planId,interval:u.plan.current.interval},{onSuccess:()=>{m.capture(le.PLAN_DOWNGRADE_CANCELLED,{plan_name:I?ee(I.name):u.plan.current.planId}),h({type:"success",message:"Scheduled downgrade canceled"})},onError:()=>h({type:"error",message:"Could not cancel the downgrade"})})};return i?e.jsx(_e,{open:a,onOpenChange:s,size:"md","aria-label":"Upgrade your plan",className:"bpb-scope",children:e.jsx(ze,{})}):e.jsx(_e,{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($s,{"aria-label":"Billing interval",value:b,onChange:M,options:[{value:"month",label:"Monthly"},{value:"year",label:"Annual",badge:Z>0?`Save ${Z}%`:void 0}]})}),e.jsxs("div",{className:"bpb-upgrade__grid",children:[w&&[0,1,2].map(T=>e.jsxs("div",{className:"bpb-plan-card","aria-hidden":!0,children:[e.jsx($,{width:120,height:22}),e.jsx($,{width:90,height:40}),e.jsx($,{width:"100%",height:36,rounded:!0}),e.jsx($,{width:"100%",height:140})]},T)),Y.map((T,g)=>{var be,H;const U=fe(T),W=lr(T,b),F=cr(T,b),re=(((be=T.prices.month)==null?void 0:be.amount)??0)<=0,q=U===E&&(E==="community"||b===S),j=U===E&&E!=="community"&&b!==S,we=!!p&&T.id===p&&!q,Ce=E!==void 0&&Ye.indexOf(U)<Ye.indexOf(E),G=(U===r||T.id===r)&&!q,R=q&&B?"cancel_downgrade":q?"current":j?"switch_interval":we?"next":Ce?"downgrade":"upgrade",te=g>0?Y[g-1]:void 0,Se=l[U]??Ea[U],he=T.features.conversation_sessions,me=xa(C,T,b),V=A.isPending&&(R==="downgrade"&&((H=A.variables)==null?void 0:H.planId)===T.id||R==="cancel_downgrade");return e.jsxs("div",{className:L("bpb-plan-card",G&&"bpb-plan-card--highlighted"),"data-plan-id":T.id,children:[e.jsxs("div",{className:"bpb-plan-card__header",children:[e.jsxs("h3",{className:"bpb-plan-card__name",children:[ee(T.name),G&&e.jsx(La,{className:"bpb-plan-card__badge",children:"Recommended"})]}),e.jsx("p",{className:"bpb-plan-card__tagline",children:T.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:vs(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:K(0,"usd",0)})})]}),he!==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:ne(he)}),e.jsxs("span",{className:"bpb-plan-card__metric-unit",children:["conversations",re?"":" / month"]})]}),me?e.jsxs("p",{className:"bpb-plan-card__pack",children:["then ",K(me.amount,me.currency,0)," per"," ",ne(me.packSize)," more"]}):e.jsx("p",{className:"bpb-plan-card__pack",children:"No top-up"})]}),R==="current"&&e.jsx(ie,{variant:"outline",block:!0,disabled:!0,children:"Your current plan"}),R==="next"&&e.jsx(ie,{variant:"outline",block:!0,disabled:!0,children:"Next plan"}),R==="cancel_downgrade"&&e.jsx(ie,{variant:"primary",block:!0,loading:V,onClick:de,children:"Cancel downgrade"}),R==="downgrade"&&e.jsx(ie,{variant:"outline",block:!0,disabled:x||A.isPending,loading:V,onClick:()=>pe(T),children:"Downgrade"}),R==="switch_interval"&&e.jsx(ie,{variant:"primary",block:!0,disabled:x||A.isPending,title:x?"Your plan is managed by Botpress — contact us to change it":void 0,onClick:()=>{m.capture(le.PLAN_UPGRADE_INITIATED,{plan_name:ee(T.name),interval:b,current_plan_name:I?ee(I.name):void 0}),n(T.id,b)},children:b==="year"?"Switch to annual":"Switch to monthly"}),R==="upgrade"&&e.jsx(ie,{variant:G?"accent":"primary",block:!0,disabled:x||A.isPending,title:x?"Your plan is managed by Botpress — contact us to change it":void 0,onClick:()=>{m.capture(le.PLAN_UPGRADE_INITIATED,{plan_name:ee(T.name),interval:b,current_plan_name:I?ee(I.name):void 0}),n(T.id,b)},children:"Upgrade"}),e.jsxs("ul",{className:"bpb-plan-card__features",children:[te&&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(As,{size:13})}),e.jsxs("span",{children:["Everything in ",ee(te.name)]})]}),Se.map(X=>{const ve=za(X),Me=Ns(X,c);return e.jsxs("li",{children:[e.jsx("span",{className:"bpb-plan-card__feature-chip",children:e.jsx(ve,{size:13})}),Me?e.jsx(oa,{label:X,children:Me}):e.jsx("span",{children:X})]},X)})]})]},T.id)})]}),e.jsxs("p",{className:"bpb-upgrade__footer",children:["Need more, or running at scale?"," ",e.jsx("a",{href:ae,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"}),"."]})]})})},Ua='-apple-system, "ui-sans-serif", "system-ui", "Segoe UI", Helvetica, Arial, sans-serif',Oa="14px",qs="10px";function $a(a){return a?{theme:"night",variables:{fontFamily:Ua,fontSizeBase:Oa,borderRadius:qs,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:Ua,fontSizeBase:Oa,borderRadius:qs,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 Fa(a){return{base:{fontFamily:Ua,fontSize:Oa,color:a?"#f9f9f9":"#0d0d0d","::placeholder":{color:a?"#9b9b9b":"#8f8f8f"}},invalid:{color:a?"#ff8583":"#e02e2a"}}}const dr={pt:"pt-BR",es:"es-419"};function qa(a){const s=a.split("-")[0]??a;return dr[s]??a}const br=4,pr=({plan:a,interval:s,preview:n,isLoadingPreview:r,isPreviewError:t,canSubscribe:o,isSubmitting:l,onSubscribe:c})=>{var Y,Z,ae,pe,de;const{locale:i}=P(),{data:h}=qe(),m=((Y=a==null?void 0:a.prices.month)==null?void 0:Y.currency)??((Z=a==null?void 0:a.prices.year)==null?void 0:Z.currency)??"usd",b=a==null?void 0:a.features.conversation_sessions,y=a?xa(h,a,s):null,f=(n==null?void 0:n.costs.immediate.amountDue)??0,w=(n==null?void 0:n.costs.immediate.accountBalance)??0,C=(n==null?void 0:n.costs.nextCycle.total)??0,u=n!=null&&n.nextBillingDate?Ee(_s(n.nextBillingDate,1),i):null,_=a?Ea[fe(a)].slice(0,br):[],A=a?((ae=a.prices[s])==null?void 0:ae.amount)??0:0,O=(n==null?void 0:n.costs.immediate.lineItems)??[],M=O.filter(z=>z.type==="discount"),S=O.filter(z=>z.type==="proration_credit"||z.type==="proration_charge").reduce((z,J)=>z+J.amount,0),I=!!(n!=null&&n.subscription.plan.effectiveDate),E=((pe=a==null?void 0:a.prices.month)==null?void 0:pe.amount)??0,p=((de=a==null?void 0:a.prices.year)==null?void 0:de.amount)??0,B=s==="year"&&E>0&&p>0?Math.round(E*12-p):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($,{width:140,height:24})}),b!==void 0&&e.jsxs("div",{className:"bpb-summary__metric",children:[e.jsx("span",{className:"bpb-summary__metric-value",children:ne(b)}),e.jsx("span",{className:"bpb-summary__metric-unit",children:"conversations / month"}),y&&e.jsxs("span",{className:"bpb-summary__metric-pack",children:["then ",K(y.amount,y.currency,0)," per ",ne(y.packSize)]})]}),_.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:_.map(z=>{const J=za(z);return e.jsxs("li",{children:[e.jsx(J,{size:16,className:"bpb-summary__feature-icon"}),e.jsx("span",{children:z})]},z)})})]}),e.jsx("hr",{className:"bpb-summary__divider"}),r&&e.jsxs("div",{className:"bpb-summary__lines","aria-busy":"true",children:[e.jsx($,{height:16}),e.jsx($,{height:16}),e.jsx($,{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&&I&&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",u?` — from ${u}`:""]}),e.jsxs("span",{className:"bpb-summary__line-amount",children:[K(C,m),s==="year"?"/yr":"/mo"]})]}),e.jsxs("div",{className:"bpb-summary__line",children:[e.jsx("span",{className:"bpb-summary__line-label",children:e.jsx(oa,{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:K(f,m)})]}),e.jsxs("div",{className:"bpb-summary__line bpb-summary__line--total",children:[e.jsx("span",{children:"Due today"}),e.jsx("span",{children:K(f,m)})]}),S<0&&e.jsxs("p",{className:"bpb-summary__addon-note",children:["You have ",K(Math.abs(S),m)," of unused time credited toward your next invoice."]})]}),n&&!r&&!I&&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:[K(A,m),s==="year"?"/yr":"/mo"]})]}),M.map((z,J)=>e.jsxs("div",{className:"bpb-summary__line",children:[e.jsx("span",{className:"bpb-summary__line-label",children:z.description}),e.jsx("span",{className:"bpb-summary__line-amount",children:K(z.amount,m)})]},`${z.id}-${J}`)),S!==0&&e.jsxs("div",{className:"bpb-summary__line",children:[e.jsx("span",{className:"bpb-summary__line-label",children:e.jsx(oa,{label:S<0?"Credit for unused time":"Adjustment for unused time",children:S<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:K(S,m)})]}),w!==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:K(w,m)})]}),e.jsxs("div",{className:"bpb-summary__line bpb-summary__line--total",children:[e.jsx("span",{children:"Due today"}),e.jsx("span",{children:K(f,m)})]}),S<0&&f===0&&e.jsxs("p",{className:"bpb-summary__addon-note",children:["Your remaining balance of ",K(Math.abs(S),m)," 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 ",K(x,m,0),"/month by choosing an annual plan. That’s"," ",K(B,m,0),"/year."]})]}),e.jsx(ie,{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 ${K(C,m)}${s==="month"?"/month":"/year"}${u?` starting ${u}`:""}.`," ","Cancel anytime in Settings. By subscribing, you authorize Botpress to store and charge your payment method."]})]})},ur=["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"],hr={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"}]},mr=[{type:"eu_vat",label:"EU VAT",description:"European VAT number"}];function Ws(a){if(!a)return[];const s=a.toUpperCase();return ur.includes(s)?mr:hr[s]??[]}const la=({label:a,className:s,id:n,...r})=>a?e.jsxs("label",{className:L("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:L("bpb-input__field",s),id:n,...r}),Wa=({label:a,className:s,children:n,...r})=>e.jsxs("label",{className:L("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:L("bpb-input__field bpb-input__field--select",a&&"bpb-input__field--labeled"),...r,children:n}),e.jsx(na,{size:16,className:"bpb-input__chevron"})]})]}),gr=({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:L("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:[K(r.amount,r.currency,0)," /mo"]})]}),t&&e.jsxs("button",{type:"button",role:"radio","aria-checked":s==="year",className:L("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:[K(t.amount/12,t.currency,0)," /mo"]})]})]})]})},Ga=({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"})]}),yr=({stepNumber:a,collapsed:s,summary:n,savedCard:r,isDark:t,tab:o,onTabChange:l,onPaymentChange:c,canContinue:i,onContinue:h,onEdit:m})=>{const[b,y]=N.useState(!1),f=o==="new"||!r;return e.jsxs("section",{className:L("bpb-step",s&&"bpb-step--collapsed"),children:[e.jsx(Ga,{number:a,title:"Payment method",onEdit:s?m:void 0}),s?r&&o!=="new"?e.jsxs("div",{className:"bpb-saved-card bpb-saved-card--readonly",children:[e.jsx(ta,{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:L("bpb-pay-tab",o==="saved"&&"bpb-pay-tab--selected"),onClick:()=>l("saved"),children:[e.jsx(Da,{size:16}),"Saved"]}),e.jsxs("button",{type:"button",role:"tab","aria-selected":o==="new",className:L("bpb-pay-tab",o==="new"&&"bpb-pay-tab--selected"),onClick:()=>l("new"),children:[e.jsx(Da,{size:16}),"New card"]})]}),r&&o==="saved"&&e.jsxs("div",{className:"bpb-saved-card",children:[e.jsx(ta,{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:L("bpb-payment-element",s&&"bpb-payment-element--hidden"),children:[!b&&!s&&e.jsx("div",{className:"bpb-payment-element__skeleton",children:e.jsx($,{height:48})}),e.jsx("div",{className:L("bpb-card-element",!b&&"bpb-payment-element--hidden"),children:e.jsx(ye.CardElement,{options:{style:Fa(t),hidePostalCode:!0},onReady:()=>y(!0),onChange:w=>c(w.complete)})})]}),!s&&e.jsx(ie,{variant:"primary",block:!0,disabled:!i,onClick:h,children:"Next"})]})},fr=({stepNumber:a,collapsed:s,summary:n,onEditStep:r,existingAddress:t,customerName:o,isLoading:l,editing:c,onEdit:i,onCancelEdit:h,onCompleteChange:m,onCountryChange:b,country:y,isBusiness:f,onIsBusinessChange:w,businessName:C,onBusinessNameChange:u,taxType:_,onTaxTypeChange:A,taxValue:O,onTaxValueChange:M})=>{const[S,I]=N.useState(!1),E=c||!t,p=Ws(y),B=p.find(x=>x.type===_);return s?e.jsxs("section",{className:"bpb-step bpb-step--collapsed",children:[e.jsx(Ga,{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(Ga,{number:a,title:"Billing address"}),l?e.jsx($,{height:72}):E?e.jsxs("div",{className:"bpb-payment-element",children:[!S&&e.jsxs("div",{className:"bpb-payment-element__skeleton",children:[e.jsx($,{height:48}),e.jsx($,{height:48})]}),e.jsx("div",{className:L(!S&&"bpb-payment-element--hidden"),children:e.jsx(ye.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:()=>I(!0),onChange:x=>{m(x.complete),b(x.value.address.country||void 0)}})}),h&&c&&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:i,children:"Update"})]}),e.jsxs("label",{className:"bpb-checkbox",children:[e.jsx("input",{type:"checkbox",checked:f,onChange:x=>{w(x.target.checked),x.target.checked&&!_&&p[0]&&A(p[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(la,{placeholder:"Business name",value:C,onChange:x=>u(x.target.value),autoComplete:"organization"}),p.length>0?e.jsxs(e.Fragment,{children:[e.jsx(Wa,{"aria-label":"Tax ID type",value:_,onChange:x=>A(x.target.value),children:p.map(x=>e.jsxs("option",{value:x.type,children:[x.label," — ",x.description]},x.type))}),e.jsx(la,{placeholder:B?B.description:"Tax ID number",value:O,onChange:x=>M(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."})]})]})},_r=({planId:a,initialInterval:s,clientSecret:n,onSuccess:r})=>{var Xs;const t=ye.useStripe(),o=ye.useElements(),{email:l,toast:c,analytics:i,isDark:h}=P(),[m,b]=N.useState(s),[y,f]=N.useState("payment"),[w,C]=N.useState(!1),[u,_]=N.useState(null),[A,O]=N.useState(!1),[M,S]=N.useState(!1),[I,E]=N.useState(!1),[p,B]=N.useState(void 0),[x,Y]=N.useState(!1),[Z,ae]=N.useState(""),[pe,de]=N.useState(""),[z,J]=N.useState(""),[ue,T]=N.useState(!1),[g,U]=N.useState(null),{data:W}=Ie(),{data:F}=ke(),{data:re,isLoading:q}=ma(),{data:j,isLoading:we}=ga(),{data:Ce}=ya(),G=W==null?void 0:W.find(ge=>ge.id===a),R=((Xs=re==null?void 0:re.paymentMethod)==null?void 0:Xs.card)??null,te=(j==null?void 0:j.address)??null;N.useEffect(()=>{u===null&&!q&&re!==void 0&&_(R?"saved":"new")},[u,q,re,R]),N.useEffect(()=>{p===void 0&&te&&B(te.country)},[p,te]);const Se=N.useMemo(()=>({plan:{planId:a,interval:m}}),[a,m]),he=ha(Se),me=va(),V=ka(),be=Na(),H=wa(),X=G?ee(G.name):"";N.useEffect(()=>{i.capture(le.CHECKOUT_STEP_VIEWED,{step:y,plan_name:X,interval:m})},[y,i]);const ve=u==="new"||!R,Me=M||!te,Qe=ve?A:!!R,Qs=Me?I:!0,Ue=ge=>{ge!==m&&i.capture(le.CHECKOUT_INTERVAL_CHANGED,{plan_name:X,interval:ge}),b(ge)},$r=ge=>{i.capture(le.PAYMENT_METHOD_SELECTED,{method:ge==="saved"?"saved_card":"new_card"}),_(ge)},Zs=()=>{Qe&&(C(!0),f("address"))},Fr=y==="address"&&!!t&&!!o&&!!G&&!he.isError&&!!he.data&&Qe&&Qs&&!ue,qr=R?`${R.brand.charAt(0).toUpperCase()}${R.brand.slice(1)} •••• ${R.lastFour}`:null,Wr=ve?"New card":qr??"Saved card",Gr=te?`${te.city}${te.state?`, ${te.state}`:""} ${te.country}`:"Not set",Vr=async()=>{var Js,Rs,en,an;if(!t||!o||!G)return;T(!0),U(null);const ge=(Oe,pa)=>i.capture(le.CHECKOUT_ERROR,{plan_name:X,interval:m,step:y,reason:Oe,message:pa});try{if(i.capture(le.PAYMENT_DETAILS_CONFIRMED,{plan_name:X,interval:m}),ve){const $e=o.getElement(ye.CardElement);if(!$e){U("Card field is not ready"),ge("card_element_not_ready");return}const{error:Fe,setupIntent:Te}=await t.confirmCardSetup(n,{payment_method:{card:$e}});if(Fe){U(Fe.message??"Payment setup failed"),i.capture(le.CHECKOUT_ERROR,{plan_name:X,interval:m,step:y,reason:Fe.code??"card_setup_failed",decline_code:Fe.decline_code,message:Fe.message});return}if(!(Te!=null&&Te.payment_method)||typeof Te.payment_method!="string"){U("Could not retrieve payment method"),ge("payment_method_missing");return}await me.mutateAsync({paymentMethodId:Te.payment_method})}let Oe;if(Me){const $e=o.getElement("address");if($e){const{complete:Fe,value:Te}=await $e.getValue();if(!Fe||!Te.address){U("Please complete your billing address"),ge("address_incomplete");return}const{address:Ke}=Te;Oe=((Js=Te.name)==null?void 0:Js.trim())||void 0,await V.mutateAsync({lineOne:Ke.line1??"",lineTwo:Ke.line2??void 0,city:Ke.city??"",state:Ke.state??void 0,postalCode:Ke.postal_code??"",country:Ke.country??""})}}const pa=x&&Z.trim()||Oe||void 0,sn=x&&pe&&z.trim()?[{type:pe,value:z.trim()}]:void 0;(pa!==void 0||sn!==void 0)&&await be.mutateAsync({name:pa,taxIds:sn});const Kr=((Rs=he.data)==null?void 0:Rs.costs.immediate.amountDue)??0,jr=((en=he.data)==null?void 0:en.costs.nextCycle.total)??0;await H.mutateAsync({planId:a,interval:m}),i.capture(le.PLAN_UPGRADED,{plan_name:X,interval:m,amount_paid:Kr,next_cycle_amount:jr,previous_plan_name:(an=W==null?void 0:W.find($e=>$e.id===(F==null?void 0:F.plan.current.planId)))==null?void 0:an.name.replace("Plan - ",""),previous_interval:F==null?void 0:F.plan.current.interval}),c({type:"success",message:"Subscription activated"}),r()}catch(Oe){U("Something went wrong while processing your payment. You have not been charged twice."),ge("exception",Oe instanceof Error?Oe.message:void 0),c({type:"error",message:"Payment error"})}finally{T(!1)}};return e.jsxs("div",{className:"bpb-checkout__columns",children:[e.jsxs("div",{className:"bpb-checkout__main",children:[G&&e.jsx(gr,{plan:G,interval:m,onChange:Ue}),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(yr,{stepNumber:1,collapsed:y!=="payment",summary:Wr,savedCard:R,isDark:h,tab:u??"new",onTabChange:$r,onPaymentChange:O,canContinue:Qe,onContinue:Zs,onEdit:()=>f("payment")}),w&&e.jsx(fr,{stepNumber:2,collapsed:y!=="address",summary:Gr,onEditStep:Zs,existingAddress:te,customerName:(Ce==null?void 0:Ce.name)??null,isLoading:we,editing:M,onEdit:()=>S(!0),onCancelEdit:te?()=>S(!1):void 0,onCompleteChange:E,onCountryChange:B,country:p,isBusiness:x,onIsBusinessChange:Y,businessName:Z,onBusinessNameChange:ae,taxType:pe,onTaxTypeChange:de,taxValue:z,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(pr,{plan:G,interval:m,preview:he.data,isLoadingPreview:he.isLoading,isPreviewError:he.isError,canSubscribe:Fr,isSubmitting:ue,onSubscribe:()=>void Vr()})})]})},Gs=({open:a,onOpenChange:s,planId:n,interval:r,onBack:t,onSuccess:o})=>{var C;const{stripePromise:l,isDark:c,locale:i,isOutdatedBilling:h}=P(),m=_a(),b=(C=m.data)==null?void 0:C.clientSecret,{mutate:y,reset:f}=m;N.useEffect(()=>{a&&!h?y():f()},[a,h,y,f]);const w=N.useMemo(()=>b?{clientSecret:b,appearance:$a(c),locale:qa(i)}:null,[b,c,i]);return h?e.jsx(_e,{open:a,onOpenChange:s,size:"md","aria-label":"Configure your plan",className:"bpb-scope",children:e.jsx(ze,{})}):e.jsx(_e,{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"})]}),m.isError?e.jsxs("div",{className:"bpb-checkout__error-state",children:[e.jsx("p",{children:"We couldn’t start the payment session."}),m.error instanceof Error&&m.error.message&&e.jsx("p",{className:"bpb-checkout__error-detail",children:m.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"})]}):!w||!b?e.jsxs("div",{className:"bpb-checkout__columns","aria-busy":"true",children:[e.jsxs("div",{className:"bpb-checkout__main",children:[e.jsx($,{height:56}),e.jsx($,{height:56}),e.jsx($,{height:120}),e.jsx($,{height:56})]}),e.jsx("div",{className:"bpb-checkout__aside",children:e.jsx($,{height:320})})]}):e.jsx(ye.Elements,{stripe:l,options:w,children:e.jsx(_r,{planId:n,initialInterval:r,clientSecret:b,onSuccess:()=>{s(!1),o==null||o()}})})]})})},Vs=({value:a,onChange:s,min:n=0,max:r,step:t=1,className:o,...l})=>{const c=()=>s(Math.max(n,a-t)),i=()=>s(r===void 0?a+t:Math.min(r,a+t));return e.jsxs("div",{className:L("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(zs,{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:i,disabled:r!==void 0&&a>=r,children:e.jsx(Us,{size:14})})]})},vr=({open:a,onOpenChange:s,onSuccess:n})=>{const{isOutdatedBilling:r}=P();return r?e.jsx(_e,{open:a,onOpenChange:s,size:"md","aria-label":"Manage add-ons",className:"bpb-scope",children:e.jsx(ze,{})}):e.jsx(_e,{open:a,onOpenChange:s,size:"md","aria-label":"Manage add-ons",className:"bpb-scope",children:e.jsx(kr,{onOpenChange:s,onSuccess:n})})},kr=({onOpenChange:a,onSuccess:s})=>{var z,J,ue,T;const{toast:n,locale:r}=P(),{data:t}=ke(),{data:o}=qe(),{data:l}=Ie(),{data:c}=fa(),i=Xa(),[h,m]=N.useState(null),b=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",f=(c==null?void 0:c.addonsReadonly)??!1,w=t!=null&&t.plan.current.periodEnd?Ee(t.plan.current.periodEnd,r):null,C=N.useMemo(()=>{var U;if(!t||!o)return null;const g={};for(const W of o){const F=t.addons[W.id];g[W.id]=((U=F==null?void 0:F.next)==null?void 0:U.quantity)??(F==null?void 0:F.current.quantity)??0}return g},[t,o]),u=h??C,_=N.useMemo(()=>!o||!b?[]:o.flatMap(g=>{const U=Re(g,b,y);return U?[{addon:g,price:U}]:[]}),[o,b,y]),A=!!u&&!!C&&Object.keys(u).some(g=>u[g]!==C[g]),O=_.reduce((g,{addon:U,price:W})=>g+((u==null?void 0:u[U.id])??0)*W.amount,0),M=N.useMemo(()=>b&&u?{plan:{planId:b.id,interval:y},addons:u}:null,[b,y,u]),S=ha(M??{plan:{planId:"",interval:y}},{enabled:!!M&&A}),I=((z=b==null?void 0:b.prices[y])==null?void 0:z.currency)??"usd",E=((J=S.data)==null?void 0:J.costs.immediate.amountDue)??0,p=(ue=S.data)!=null&&ue.nextBillingDate?Ee(S.data.nextBillingDate,r):null,B=((T=b==null?void 0:b.prices[y])==null?void 0:T.amount)??0,x=B+O,Y=b&&u?Ss(b,o,u):[],Z=(g,U)=>U==="bytes"?Be(g):ne(g),ae=(g,U)=>{const W=o==null?void 0:o.find(j=>j.id===g),F=W==null?void 0:W.increments;if(!F||U<=0)return null;const re=F.conversation_sessions??0;if(re>0)return`${ne(re*U)} convos`;const q=F.file_storage??0;return q>0?Be(q*U):null},pe=()=>{u&&i.mutate({addons:u},{onSuccess:()=>{n({type:"success",message:"Subscription updated"}),a(!1),s==null||s()},onError:()=>n({type:"error",message:"Could not update your add-ons"})})},de=!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:b?`Additional usage for your ${ee(b.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."}),de?e.jsxs("div",{className:"bpb-manage-addons__loading","aria-busy":"true",children:[e.jsx($,{height:56}),e.jsx($,{height:56})]}):_.length===0?e.jsxs("p",{className:"bpb-manage-addons__empty",children:["Add-ons aren’t available on the ",b?ee(b.name):"current"," plan. Upgrade to a paid plan to add extra usage."]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bpb-addons",children:_.map(({addon:g,price:U})=>{var q;const W=((q=t==null?void 0:t.addons[g.id])==null?void 0:q.current.quantity)??0,F=(u==null?void 0:u[g.id])??0,re=F!==W?F===0?`${W} active now · removed${w?` ${w}`:" next cycle"}`:`${W} active now · ${F}${w?` from ${w}`:" next cycle"}`:W>0?`${W} 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:He(g.name)}),e.jsx("span",{className:"bpb-addon-row__description",children:g.description}),e.jsxs("span",{className:"bpb-addon-row__price",children:[K(U.amount,U.currency)," each"]}),re&&e.jsx("span",{className:L("bpb-addon-row__status",F!==W&&"bpb-addon-row__status--changed"),children:re})]}),e.jsxs("div",{className:"bpb-addon-row__control",children:[ae(g.id,F)&&e.jsx("span",{className:"bpb-addon-row__grant",children:ae(g.id,F)}),e.jsx(Vs,{"aria-label":`${He(g.name)} quantity`,value:F,onChange:j=>m({...u??{},[g.id]:j})})]})]},g.id)})}),Y.length>0&&e.jsxs("div",{className:"bpb-manage-addons__limits",children:[e.jsx("p",{className:"bpb-manage-addons__limits-title",children:"Your new limits"}),Y.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:Z(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:Z(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:b?`${ee(b.name)} plan`:"Plan"}),e.jsx("span",{children:K(B,I)})]}),_.map(({addon:g,price:U})=>{const W=(u==null?void 0:u[g.id])??0;return W<=0?null:e.jsxs("div",{className:"bpb-manage-addons__line",children:[e.jsxs("span",{children:[W,"× ",He(g.name)]}),e.jsx("span",{children:K(U.amount*W,I)})]},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:[K(x,I),y==="year"?"/yr":"/mo"]})]}),A&&e.jsxs("div",{className:"bpb-manage-addons__line bpb-manage-addons__line--due",children:[e.jsx("span",{children:"Due today"}),e.jsx("span",{children:S.isLoading?"…":S.isError?"—":K(Math.max(E,0),I)})]})]}),A&&!S.isError&&e.jsxs("p",{className:"bpb-manage-addons__note",children:[E>0?`You’ll be charged ${K(E,I)} 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",p?` on ${p}`:"",", when you’ll be billed ",K(O,I),y==="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(ie,{variant:"outline",onClick:()=>a(!1),disabled:i.isPending,children:"Cancel"}),e.jsx(ie,{variant:"primary",disabled:!A||f,loading:i.isPending,onClick:pe,children:"Update subscription"})]})]})]})},Nr={paid:"Paid",open:"Due",draft:"Draft",uncollectible:"Unpaid",void:"Void"},wr=({open:a,onOpenChange:s})=>{const{isOutdatedBilling:n}=P();return n?e.jsx(_e,{open:a,onOpenChange:s,size:"md","aria-label":"Billing history",className:"bpb-scope",children:e.jsx(ze,{})}):e.jsx(_e,{open:a,onOpenChange:s,size:"md","aria-label":"Billing history",className:"bpb-scope",children:e.jsx(Cr,{open:a})})},Cr=({open:a})=>{const{locale:s,analytics:n}=P(),{data:r,isLoading:t,isError:o}=Ha({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($,{height:52}),e.jsx($,{height:52}),e.jsx($,{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:Nr[c.status]})]}),e.jsxs("div",{className:"bpb-invoices__row-end",children:[e.jsx("span",{className:"bpb-invoices__amount",children:K(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(Ba,{size:16})}):e.jsx("span",{className:"bpb-invoices__download bpb-invoices__download--disabled","aria-hidden":!0,children:e.jsx(Ba,{size:16})})]})]},c.id))})]})},Sr=({open:a,onOpenChange:s,onSuccess:n})=>{var y;const{stripePromise:r,isDark:t,locale:o,isOutdatedBilling:l}=P(),c=_a(),i=(y=c.data)==null?void 0:y.clientSecret,{mutate:h,reset:m}=c;N.useEffect(()=>{a&&!l?h():m()},[a,l,h,m]);const b=N.useMemo(()=>i?{clientSecret:i,appearance:$a(t),locale:qa(o)}:null,[i,t,o]);return l?e.jsx(_e,{open:a,onOpenChange:s,size:"md","aria-label":"Payment & billing",className:"bpb-scope",children:e.jsx(ze,{})}):e.jsx(_e,{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(ie,{variant:"outline",onClick:()=>h(),children:"Try again"})]}):!b||!i?e.jsxs("div",{className:"bpb-payment-dialog__loading","aria-busy":"true",children:[e.jsx($,{height:48}),e.jsx($,{height:120})]}):e.jsx(ye.Elements,{stripe:r,options:b,children:e.jsx(Ir,{clientSecret:i,isDark:t,onSuccess:n})})]})})},Ir=({clientSecret:a,isDark:s,onSuccess:n})=>{var me;const r=ye.useStripe(),t=ye.useElements(),{toast:o,analytics:l}=P(),{data:c,isLoading:i}=ma(),{data:h,isLoading:m}=ga(),{data:b,isLoading:y}=ya(),f=va(),w=ka(),C=Na(),u=((me=c==null?void 0:c.paymentMethod)==null?void 0:me.card)??null,_=(h==null?void 0:h.address)??null,A=(b==null?void 0:b.taxIds)??[],[O,M]=N.useState(!1),[S,I]=N.useState(!1),[E,p]=N.useState(!1),[B,x]=N.useState(!1),[Y,Z]=N.useState(null),[ae,pe]=N.useState(!1),[de,z]=N.useState(!1),[J,ue]=N.useState(null),[T,g]=N.useState(_==null?void 0:_.country),[U,W]=N.useState(A.length>0),[F,re]=N.useState(null),q=F??A.map(V=>({type:V.type,value:V.value})),j=Ws(T),we=F!==null,Ce=O||!u,G=(V,be)=>re(q.map((H,X)=>X===V?{...H,...be}:H)),R=()=>{var V;return re([...q,{type:((V=j[0])==null?void 0:V.type)??"",value:""}])},te=V=>re(q.filter((be,H)=>H!==V)),Se=async()=>{if(!r||!t)return;const V=t.getElement(ye.CardElement);if(V){x(!0),Z(null);try{const{error:be,setupIntent:H}=await r.confirmCardSetup(a,{payment_method:{card:V}});if(be){Z(be.message??"Could not save your card");return}if(!(H!=null&&H.payment_method)||typeof H.payment_method!="string"){Z("Could not retrieve payment method");return}await f.mutateAsync({paymentMethodId:H.payment_method}),l.capture(le.PAYMENT_METHOD_UPDATED),o({type:"success",message:"Card updated"}),M(!1),n==null||n()}catch{Z("We couldn’t save your card. Please check your details and try again.")}finally{x(!1)}}},he=async()=>{if(!t)return;const V=t.getElement("address");if(!V)return;const{complete:be,value:H}=await V.getValue();if(!be||!H.address){ue("Please complete your billing address.");return}z(!0),ue(null);try{const{address:X,name:ve}=H;await w.mutateAsync({lineOne:X.line1??"",lineTwo:X.line2??void 0,city:X.city??"",state:X.state??void 0,postalCode:X.postal_code??"",country:X.country??""});const Me=(ve==null?void 0:ve.trim())||void 0,Qe=q.filter(Ue=>!!Ue.type&&Ue.value.trim()!=="").map(Ue=>({type:Ue.type,value:Ue.value.trim()}));(Me!==((b==null?void 0:b.name)??void 0)||we)&&await C.mutateAsync({name:Me,taxIds:Qe}),l.capture(le.BILLING_ADDRESS_UPDATED),o({type:"success",message:"Billing details updated"}),n==null||n()}catch(X){const ve=X instanceof Error&&X.message?X.message:"Could not update your billing details.";ue(ve),o({type:"error",message:"Could not update your billing details"})}finally{z(!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($,{height:56}):Ce?e.jsxs("div",{className:"bpb-payment-element",children:[!S&&e.jsx($,{height:48}),e.jsx("div",{className:S?"bpb-card-element":"bpb-payment-element--hidden",children:e.jsx(ye.CardElement,{options:{style:Fa(s),hidePostalCode:!0},onReady:()=>I(!0),onChange:V=>p(V.complete)})}),Y&&e.jsx("p",{role:"alert",className:"bpb-payment-dialog__field-error",children:Y}),e.jsxs("div",{className:"bpb-payment-dialog__section-actions",children:[u&&e.jsx(ie,{variant:"ghost",onClick:()=>M(!1),disabled:B,children:"Cancel"}),e.jsx(ie,{variant:"primary",disabled:!E,loading:B,onClick:Se,children:"Save card"})]})]}):e.jsxs("div",{className:"bpb-saved-card",children:[e.jsx(ta,{brand:u.brand}),e.jsxs("span",{className:"bpb-saved-card__number",children:[e.jsx("span",{className:"bpb-saved-card__brand",children:u.brand})," •••• ",u.lastFour]}),e.jsxs("span",{className:"bpb-saved-card__exp",children:[String(u.expMonth).padStart(2,"0"),"/",String(u.expYear).slice(-2)]}),e.jsx("button",{type:"button",className:"bpb-link-button",onClick:()=>M(!0),children:"Replace"})]})]}),e.jsxs("section",{className:"bpb-payment-dialog__section",children:[e.jsx("h3",{className:"bpb-payment-dialog__section-title",children:"Billing address"}),m||y?e.jsx($,{height:72}):e.jsxs("div",{className:"bpb-payment-element",children:[!ae&&e.jsx($,{height:120}),e.jsx("div",{className:ae?void 0:"bpb-payment-element--hidden",children:e.jsx(ye.AddressElement,{options:{mode:"billing",display:{name:"full"},defaultValues:_?{name:(b==null?void 0:b.name)??void 0,address:{line1:_.lineOne,line2:_.lineTwo,city:_.city,state:_.state,postal_code:_.postalCode,country:_.country}}:void 0},onReady:()=>pe(!0),onChange:V=>g(V.value.address.country||void 0)})}),e.jsxs("div",{className:"bpb-tax-section",children:[e.jsxs("button",{type:"button",className:"bpb-tax-toggle","aria-expanded":U,onClick:()=>W(V=>!V),children:[e.jsx(na,{size:16,className:L("bpb-tax-toggle__chevron",U&&"bpb-tax-toggle__chevron--open")}),"Tax IDs",A.length>0&&e.jsx("span",{className:"bpb-tax-toggle__count",children:A.length})]}),U&&e.jsxs("div",{className:"bpb-tax",children:[q.length===0&&e.jsx("p",{className:"bpb-tax__empty",children:"Add a VAT or tax registration number to show it on your invoices."}),q.map((V,be)=>e.jsxs("div",{className:"bpb-tax__row",children:[e.jsxs(Wa,{"aria-label":"Tax ID type",value:V.type,onChange:H=>G(be,{type:H.target.value}),children:[e.jsx("option",{value:"",children:"Select type"}),j.map(H=>e.jsx("option",{value:H.type,children:H.label},H.type)),V.type&&!j.some(H=>H.type===V.type)&&e.jsx("option",{value:V.type,children:V.type})]}),e.jsx(la,{placeholder:"Tax ID number",value:V.value,onChange:H=>G(be,{value:H.target.value})}),e.jsx("button",{type:"button",className:"bpb-tax__remove","aria-label":"Remove tax ID",onClick:()=>te(be),children:e.jsx(sa,{size:14})})]},be)),e.jsx("button",{type:"button",className:"bpb-link-button bpb-tax__add",onClick:R,children:"+ Add tax ID"})]})]}),J&&e.jsx("p",{role:"alert",className:"bpb-payment-dialog__field-error",children:J}),e.jsx("div",{className:"bpb-payment-dialog__section-actions",children:e.jsx(ie,{variant:"primary",loading:de,onClick:he,children:"Save billing details"})})]})]})]})},ca=1e9,Ks={incoming_messages_events:a=>`${ne(a)} incoming messages & events`,conversation_sessions:a=>`${ne(a)} conversation sessions`,table_rows:a=>`${ne(a)} table rows`,vector_db_storage:a=>`${Be(a)} vector database storage`,file_storage:a=>`${Be(a)} file storage`,collaborator_count:a=>a===1?"1 collaborator":`${ne(a)} collaborators`,bot_count:a=>a===1?"1 bot":`${ne(a)} bots`,indexed_file_count:a=>`${ne(a)} indexed files for RAG`,ai_spend:a=>`${K(a/ca,"usd",0)} AI credit included`,always_alive:a=>a===1?"1 always-alive bot":`${ne(a)} always-alive bots`};function Ar(a,s,n){const r=(n==null?void 0:n[a])??Ks[a];return r?r(s):`${ne(s)} ${a.replaceAll("_"," ")}`}const Er=[{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"}],Ve=(a,s)=>s==="bytes"?Be(a):s==="nano-usd"?`$${(a/ca).toFixed(2)}`:ne(a),Tr=(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"})}})},xr=({period:a})=>{const{data:s,isLoading:n,isError:r}=Qa("ai_spend",{period:a});if(r)return null;if(n)return e.jsx($,{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:Ve(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))})},Va=({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",i=n??a.quota,h=Math.max(0,a.quota-i),m=r?`${r} plan`:"your plan",b=h>0?`${Ve(i,s.unit)} from ${m} + ${Ve(h,s.unit)} from add-ons`:`${Ve(a.quota,s.unit)} from ${m}`;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:Ve(t,s.unit)}),e.jsxs("span",{className:"bpb-usage-row__quota",children:[" / ",Ve(a.quota,s.unit)]})]})]}),e.jsxs("span",{className:"bpb-usage-tip",tabIndex:0,role:"note","aria-label":b,children:[e.jsx("div",{className:"bpb-usage-bar",role:"progressbar","aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":100,children:e.jsx("div",{className:L("bpb-usage-bar__fill",`bpb-usage-bar__fill--${c}`),style:{width:`${l}%`}})}),e.jsx("span",{className:"bpb-usage-tip__bubble",role:"tooltip",children:b})]})]})},Lr=({period:a,showPeriodSelector:s=!0,periodMonths:n=12,className:r})=>{var E;const{isOutdatedBilling:t,locale:o}=P(),l=N.useMemo(()=>Tr(n,o),[n,o]),[c,i]=N.useState(a??((E=l[0])==null?void 0:E.value)??""),h=Za(),m=Math.max(0,l.findIndex(p=>p.value===c)),b=p=>{const B=l[m+p];B&&i(B.value)},{data:y,isLoading:f,isError:w}=We({period:c,enabled:!t}),{data:C}=ke({enabled:!t}),{data:u}=Ie(),_=u==null?void 0:u.find(p=>p.id===(C==null?void 0:C.plan.current.planId)),A=_?ee(_.name):void 0,O=p=>_==null?void 0:_.features[p];if(t)return e.jsx("div",{className:L("bpb-usage bpb-scope",r),children:e.jsx(ze,{})});if(f)return e.jsxs("div",{className:L("bpb-usage bpb-scope",r),"aria-busy":"true",children:[e.jsx($,{height:80}),e.jsx($,{height:140})]});if(w||!y)return e.jsx("div",{className:L("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 M=y.conversation_sessions,S=y.ai_spend,I=Er.filter(p=>y[p.key]);return e.jsxs("div",{className:L("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:()=>b(1),disabled:m>=l.length-1,children:e.jsx(Bs,{size:15})}),e.jsxs("span",{className:"bpb-usage__period-field",children:[e.jsx(Os,{size:15,className:"bpb-usage__period-icon"}),e.jsx("select",{className:"bpb-usage__period-select","aria-label":"Billing period",value:c,onChange:p=>i(p.target.value),children:l.map(p=>e.jsx("option",{value:p.value,children:p.label},p.value))}),e.jsx(na,{size:14,className:"bpb-usage__period-chevron"})]}),e.jsx("button",{type:"button",className:"bpb-usage__period-step","aria-label":"Next month",onClick:()=>b(-1),disabled:m<=0,children:e.jsx(Ge,{size:15})})]})]})]}),M&&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(Va,{entry:M,metric:{key:"conversation_sessions",label:"Conversations",unit:"count"},planAllowance:O("conversation_sessions"),planName:A})})]}),I.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:I.map(p=>e.jsx(Va,{entry:y[p.key],metric:p,planAllowance:O(p.key),planName:A},p.key))})]}),S&&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(Va,{entry:S,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(xr,{period:c})]})]})]})},Mr={conversation_sessions:"monthly conversations",table_rows:"table rows",vector_db_storage:"vector DB storage",file_storage:"file storage",ai_spend:"AI spend"},Pr=({position:a="inline",threshold:s=.9,onUpgrade:n,dismissible:r=!0,ctaLabel:t="Upgrade plan",period:o,className:l})=>{const{isOutdatedBilling:c,analytics:i}=P(),{data:h}=We({period:o,enabled:!c}),[m,b]=N.useState(!1),[y,f]=N.useState(!1),[w,C]=N.useState(null),u=h?Object.entries(h).map(([I,E])=>({key:I,pct:E.quota>0?(E.usage??0)/E.quota:0})).filter(I=>I.pct>=s).sort((I,E)=>E.pct-I.pct)[0]:void 0;if(c||!u||m)return null;const _=Mr[u.key]??u.key.replace(/_/g," "),A=Math.min(100,Math.round(u.pct*100)),O=u.pct>=1,M=()=>{i.capture(le.UPGRADE_CTA_CLICKED,{source:"usage_banner",metric:u.key,usage_pct:Math.round(u.pct*100)}),n?n():f(!0)},S=O?"critical":"warning";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:L("bpb-usage-banner bpb-scope",`bpb-usage-banner--${a}`,`bpb-usage-banner--${S}`,l),role:"alert","aria-live":"polite",children:[e.jsx(tr,{size:18,className:"bpb-usage-banner__icon"}),e.jsx("p",{className:"bpb-usage-banner__text",children:O?e.jsxs(e.Fragment,{children:["You’ve reached your ",_," limit. Upgrade now to avoid interruptions."]}):e.jsxs(e.Fragment,{children:["You’ve used ",e.jsxs("strong",{children:[A,"%"]})," of your ",_,". Upgrade to avoid hitting your limit."]})}),e.jsxs("div",{className:"bpb-usage-banner__actions",children:[e.jsx(ie,{variant:"primary",size:"sm",onClick:M,children:t}),r&&e.jsx("button",{type:"button",className:"bpb-usage-banner__dismiss","aria-label":"Dismiss",onClick:()=>b(!0),children:e.jsx(sa,{size:16})})]})]}),!n&&e.jsxs(e.Fragment,{children:[e.jsx(Fs,{open:y,onOpenChange:f,onSelectPlan:(I,E)=>{f(!1),C({planId:I,interval:E})}}),w&&e.jsx(Gs,{open:!!w,onOpenChange:I=>!I&&C(null),planId:w.planId,interval:w.interval,onBack:()=>{C(null),f(!0)},onSuccess:()=>C(null)})]})]})},Ka=({children:a})=>e.jsx("span",{className:"bpb-summary-card__icon","aria-hidden":"true",children:a}),js=({eyebrow:a,className:s})=>{const{manageBillingUrl:n}=P(),r=()=>n&&window.open(n,"_blank","noopener");return e.jsxs("button",{type:"button",className:L("bpb-summary-card bpb-scope",a==="Add-ons"?"bpb-summary-card--addons":"bpb-summary-card--plan",s),onClick:r,disabled:!n,children:[e.jsx(Ka,{children:a==="Add-ons"?e.jsx(aa,{size:22}):e.jsx(ea,{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(ra,{size:15})]})]})]})},Dr=({onManage:a,className:s})=>{var w,C;const{isOutdatedBilling:n}=P(),{data:r,isLoading:t}=ke({enabled:!n}),{data:o,isLoading:l}=Ie();if(n)return e.jsx(js,{eyebrow:"Current plan",className:s});if(t||l)return e.jsx($,{height:84,rounded:!0,className:L("bpb-scope",s)});const c=r==null?void 0:r.plan.current,i=o==null?void 0:o.find(u=>u.id===(c==null?void 0:c.planId)),h=(c==null?void 0:c.interval)??"month",m=((w=i==null?void 0:i.prices[h])==null?void 0:w.amount)??0,b=((C=i==null?void 0:i.prices[h])==null?void 0:C.currency)??"usd",y=i==null?void 0:i.features.conversation_sessions,f=i?fe(i):"community";return e.jsxs("button",{type:"button",className:L("bpb-summary-card bpb-summary-card--plan bpb-scope",`bpb-summary-card--tier-${f==="managed"?"enterprise":f}`,s),onClick:a,children:[e.jsx(Ka,{children:e.jsx(ea,{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:i?ee(i.name):"No plan"}),e.jsxs("span",{className:"bpb-summary-card__meta",children:[m>0?`${K(m,b,0)}/${h==="year"?"yr":"mo"}`:"Free",y!==void 0&&` · ${ne(y)} conversations/mo`]})]}),e.jsxs("span",{className:"bpb-summary-card__action",children:["Manage",e.jsx(Ge,{size:16})]})]})]})},Br=({onManage:a,className:s})=>{const{isOutdatedBilling:n}=P(),{data:r,isLoading:t}=ke({enabled:!n}),{data:o,isLoading:l}=qe();if(n)return e.jsx(js,{eyebrow:"Add-ons",className:s});if(t||l)return e.jsx($,{height:84,rounded:!0,className:L("bpb-scope",s)});const c=(o??[]).flatMap(i=>{var m;const h=((m=r==null?void 0:r.addons[i.id])==null?void 0:m.current.quantity)??0;return h>0?[{name:He(i.name),quantity:h}]:[]});return e.jsxs("button",{type:"button",className:L("bpb-summary-card bpb-summary-card--addons bpb-scope",c.length>0&&"bpb-summary-card--active",s),onClick:a,children:[e.jsx(Ka,{children:e.jsx(aa,{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(i=>`${i.quantity}× ${i.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(Ge,{size:16})]})]})]})},zr=({onManage:a,className:s})=>{var B,x;const{isOutdatedBilling:n,locale:r,manageBillingUrl:t,analytics:o}=P(),{data:l,isLoading:c}=ke({enabled:!n}),{data:i,isLoading:h}=Ie(),{data:m,isLoading:b}=qe();if(n){const Y=()=>t&&window.open(t,"_blank","noopener");return e.jsxs("button",{type:"button",className:L("bpb-plan-banner bpb-plan-banner--community bpb-scope",s),onClick:Y,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(ra,{size:16})]})]})}if(c||h||b)return e.jsx($,{height:132,rounded:!0,className:L("bpb-scope",s)});const y=l==null?void 0:l.plan.current,f=i==null?void 0:i.find(Y=>Y.id===(y==null?void 0:y.planId)),w=(y==null?void 0:y.interval)??"month",C=((B=f==null?void 0:f.prices[w])==null?void 0:B.currency)??"usd",u=f?fe(f):"community",_=Object.fromEntries(Object.entries((l==null?void 0:l.addons)??{}).map(([Y,Z])=>{var ae;return[Y,((ae=Z.current)==null?void 0:ae.quantity)??0]})),A=((x=f==null?void 0:f.prices[w])==null?void 0:x.amount)??0,O=(m??[]).reduce((Y,Z)=>{const ae=f?Re(Z,f,w):null;return Y+(_[Z.id]??0)*((ae==null?void 0:ae.amount)??0)},0),M=A+O,S=w==="year"?"/yr":"/mo",I=Is(f,m,_).find(Y=>Y.key==="conversation_sessions"),E=y!=null&&y.periodEnd?Ee(y.periodEnd,r):null,p=u==="enterprise"||u==="managed";return e.jsxs("button",{type:"button",className:L("bpb-plan-banner",`bpb-plan-banner--${u}`,"bpb-scope",s),onClick:()=>{o.capture(le.UPGRADE_CTA_CLICKED,{source:"plan_banner",current_tier:u}),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?ee(f.name):"No plan"}),I&&e.jsx("span",{className:"bpb-plan-banner__sub",children:I.added>0?e.jsxs(e.Fragment,{children:[ne(I.base)," + ",ne(I.added)," conversations / month"]}):`${ne(I.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:[M>0?K(M,C,0):"Free",M>0&&e.jsx("span",{className:"bpb-plan-banner__price-suffix",children:S})]}),e.jsxs("span",{className:"bpb-plan-banner__meta",children:[w==="year"?"Billed annually":"Billed monthly",O>0&&" · incl. add-ons"]}),E&&e.jsxs("span",{className:"bpb-plan-banner__meta",children:["Renews ",E]})]}),e.jsxs("span",{className:"bpb-plan-banner__cta",children:["Manage plan ",e.jsx(Ge,{size:16})]})]})},Ys=[{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 ia(a,s){return s==="bytes"?Be(a):s==="nano-usd"?`$${(a/ca).toFixed(2)}`:ne(a)}function da(a){return a>=90?"critical":a>=75?"warning":"normal"}function ba(a){return a?Ys.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 Ur=({onManage:a,period:s,variant:n="card",className:r,style:t})=>{const{isOutdatedBilling:o,locale:l}=P(),{data:c,isLoading:i}=ke({enabled:!o}),{data:h,isLoading:m}=Ie(),{data:b,isLoading:y}=We({period:s,enabled:!o});if(o)return null;if(i||m||y)return e.jsx($,{height:72,rounded:!0,className:L("bpb-scope",r)});const f=h==null?void 0:h.find(p=>p.id===(c==null?void 0:c.plan.current.planId)),w=ba(b),C=w.find(p=>p.key==="conversation_sessions"),u=w[0],_=u&&u.key!=="conversation_sessions"&&u.pct>=75?u:C??u,A=_?Math.round(_.pct):0,O=A>0?Math.max(5,A):0,M=_?da(_.pct):"normal",S=c!=null&&c.plan.current.periodEnd?Ee(c.plan.current.periodEnd,l):null,I=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bpb-plan-usage__head",children:[e.jsx("span",{className:"bpb-plan-usage__plan",children:f?ee(f.name):"Free"}),a&&e.jsx(Ge,{size:15,className:"bpb-plan-usage__chevron"})]}),_&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bpb-plan-usage__meta",children:[e.jsx("span",{className:"bpb-plan-usage__meta-label",children:_.label}),e.jsxs("span",{className:"bpb-plan-usage__meta-value",children:[e.jsx("strong",{children:ia(_.remaining,_.unit)})," left"]})]}),e.jsx("div",{className:"bpb-plan-usage__bar",role:"progressbar","aria-valuenow":A,"aria-valuemin":0,"aria-valuemax":100,children:e.jsx("div",{className:L("bpb-plan-usage__fill",`bpb-plan-usage__fill--${M}`),style:{width:`${O}%`}})}),S&&e.jsxs("span",{className:"bpb-plan-usage__reset",children:["Resets ",S]})]})]}),E=L("bpb-plan-usage bpb-scope",`bpb-plan-usage--${n}`,a&&"bpb-plan-usage--clickable",r);return a?e.jsx("button",{type:"button",className:E,style:t,onClick:a,children:I}):e.jsx("div",{className:E,style:t,children:I})},Hs=({children:a,delay:s=200,placement:n="top",period:r,className:t})=>{const{isOutdatedBilling:o,locale:l}=P(),{data:c}=We({period:r,enabled:!o}),{data:i}=ke({enabled:!o}),{data:h}=Ie(),[m,b]=N.useState(!1),y=N.useRef(null),f=()=>{y.current&&(clearTimeout(y.current),y.current=null)};N.useEffect(()=>f,[]);const w=ba(c),C=!o&&w.length>0,u=()=>{C&&(f(),y.current=setTimeout(()=>b(!0),Math.max(0,s)))},_=()=>{f(),b(!1)},A=h==null?void 0:h.find(S=>S.id===(i==null?void 0:i.plan.current.planId)),O=A?ee(A.name):"Free",M=i!=null&&i.plan.current.periodEnd?Ee(i.plan.current.periodEnd,l):null;return e.jsxs("span",{className:L("bpb-usage-pop bpb-scope",t),onMouseEnter:u,onMouseLeave:_,onFocus:u,onBlur:_,children:[a,m&&C&&e.jsxs("span",{className:L("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:[O," 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"}),w.map(S=>{const I=S.pct>0?Math.max(5,S.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:S.label}),e.jsxs("span",{className:"bpb-usage-pop__val",children:[ia(S.used,S.unit)," / ",ia(S.quota,S.unit)]})]}),e.jsx("span",{className:"bpb-usage-pop__bar",children:e.jsx("span",{className:L("bpb-usage-pop__fill",`bpb-usage-pop__fill--${da(S.pct)}`),style:{width:`${I}%`}})})]},S.key)})]})]})},Or=({size:a=20,thickness:s=3.5,showLabel:n=!1,onClick:r,popoverDelay:t=200,period:o,className:l,...c})=>{const{isOutdatedBilling:i}=P(),{data:h}=We({period:o,enabled:!i}),m=ba(h);if(i||m.length===0)return null;const b=m[0],y=da(b.pct),f=b.pct>0?Math.max(5,b.pct):0,w=(a-s)/2,C=2*Math.PI*w,u=C*(1-f/100),_=c["aria-label"]??`${Math.round(b.pct)}% of your ${b.label.toLowerCase()} used`,A=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:w,fill:"none",strokeWidth:s}),e.jsx("circle",{className:L("bpb-usage-ring__arc",`bpb-usage-ring__arc--${y}`),cx:a/2,cy:a/2,r:w,fill:"none",strokeWidth:s,strokeLinecap:"round",strokeDasharray:C,strokeDashoffset:u,transform:`rotate(-90 ${a/2} ${a/2})`})]}),n&&e.jsxs("span",{className:"bpb-usage-ring__label",children:[Math.round(b.pct),"%"]})]}),O=L("bpb-usage-ring",r&&"bpb-usage-ring--clickable"),M=r?e.jsx("button",{type:"button",className:O,onClick:r,"aria-label":_,children:A}):e.jsx("span",{className:O,tabIndex:0,role:"img","aria-label":_,children:A});return e.jsx(Hs,{delay:t,period:o,className:l,children:M})};d.AddonsSummaryCard=Br,d.BILLING_EVENTS=le,d.Badge=La,d.BankIcon=nr,d.BillingProvider=ln,d.BoltIcon=aa,d.Button=ie,d.CalendarIcon=Os,d.CardBrandBadge=ta,d.CardIcon=Da,d.ChartIcon=Ms,d.CheckIcon=As,d.CheckoutDialog=Gs,d.ChevronDownIcon=na,d.ChevronLeftIcon=Bs,d.ChevronRightIcon=Ge,d.CloseIcon=sa,d.DEFAULT_FEATURE_DESCRIPTIONS=Ta,d.DEFAULT_FEATURE_LABELS=Ks,d.DEFAULT_PLAN_FEATURES=Ea,d.Dialog=_e,d.DownloadIcon=Ba,d.ENTERPRISE_CONTACT_URL=ks,d.ExternalLinkIcon=ra,d.GlobeIcon=Ps,d.InfinityIcon=xs,d.InfoTooltip=oa,d.Input=la,d.InvoicesDialog=wr,d.LayersIcon=ea,d.LockIcon=rr,d.ManageAddonsDialog=vr,d.MessageIcon=Es,d.MinusIcon=zs,d.NANO_DOLLARS_PER_DOLLAR=ca,d.OutdatedBillingGate=ze,d.PLAN_ORDER=Ye,d.PaintIcon=Ds,d.PaymentMethodDialog=Sr,d.PlanBanner=zr,d.PlanSummaryCard=Dr,d.PlanUsageWidget=Ur,d.PlusIcon=Us,d.PuzzleIcon=Ts,d.ReceiptIcon=or,d.SegmentedControl=$s,d.Select=Wa,d.ShieldIcon=Pa,d.Skeleton=$,d.SparkleIcon=Ma,d.Stepper=Vs,d.USAGE_METRICS=Ys,d.UpgradePlanDialog=Fs,d.UsageBanner=Pr,d.UsageDashboard=Lr,d.UsagePopover=Hs,d.UsageRing=Or,d.UsersIcon=Ls,d.addDays=_s,d.addonDisplayName=He,d.addonLimitsPreview=Ss,d.addonPrice=Re,d.billingKeys=se,d.cn=L,d.conversationPackPrice=xa,d.conversationsAddon=ws,d.currencySymbol=vs,d.featureDescription=Ns,d.featureLabel=Ar,d.formatBytes=Be,d.formatCurrency=K,d.formatDate=Ee,d.formatQuantity=ne,d.formatUsage=ia,d.getCardElementStyle=Fa,d.getStripeAppearance=$a,d.getStripePromise=Ya,d.iconForFeature=za,d.planDisplayName=ee,d.planEntitlements=Is,d.planKind=fe,d.toStripeLocale=qa,d.usageItems=ba,d.usageTier=da,d.useAddons=qe,d.useBilling=P,d.useBillingAddress=ga,d.useBillingReadonly=fa,d.useCreatePaymentMethodIntent=_a,d.useCustomer=ya,d.useInvoices=Ha,d.usePaymentMethod=ma,d.usePlans=Ie,d.useSetAddons=Xa,d.useSetBillingAddress=ka,d.useSetCustomer=Na,d.useSetPaymentMethod=va,d.useSetSubscription=wa,d.useSubscription=ke,d.useSubscriptionPreview=ha,d.useSupportsUsageByBot=Za,d.useUsage=We,d.useUsageByBot=Qa,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"})});
|