1import{j as e}from"./vendor-motion-hRg_q8lq.js";import{a as ce,r as c}from"./vendor-react-E98sgxjj.js";import{u as ue}from"./useLocaleNavigate-BNriJdRU.js";import{u as de,a as L}from"./vendor-query-bOUN_gKe.js";import{u as q,L as z,b as me,c as pe,B as ge,aE as xe,ae as N,aF as I,ai as he,aG as fe,aH as be,H as je,d as u,aI as w,aJ as ye,aK as Pe,aL as _e}from"./index-BKzE8EQ8.js";import{P as Ne,L as we}from"./LandingFooter-DjCjfhwD.js";import{A as ve}from"./index-BxtVm1Yj.js";import{O as Ce,g as ke,P as O,a as Se,b as Ae,c as Fe,d as Me,i as Te,C as Be,e as Ee,f as Ve}from"./pricingExperiments-zMZby8z7.js";import{du as v,cn as Le,d as Ie}from"./vendor-fa-Bn2dnpnC.js";import{F as Oe}from"./FAQSection-PgbFZ6Mj.js";import{i as $e,p as qe,F as $}from"./FirstPaymentBonus-BMjPAYA8.js";import{u as m}from"./useExperiment-DuA8vjwk.js";import"./UserAvatarMenu-BoKKInby.js";import"./Tooltip-C8AvPGtA.js";import"./Avatar-B60wpoS5.js";import"./MediaImage-DKgx-nW4.js";import"./tabBarStore-624ukDKJ.js";import"./socialLinks-DmmZmq5v.js";import"./exploreHandoff-RQymaHkp.js";import"./AuthShell-DPeun0C_.js";import"./AuthPanel-B4zt6SJ5.js";import"./pendingReferral-B4JPXhl_.js";import"./LaunchPromoClips-eRoWsyBt.js";import"./organization-BuGhuc22.js";function ze(){const{t:r}=q("checkout");return e.jsxs(z,{to:"/enterprise",className:"group mt-6 flex flex-col gap-4 roun
1ded-md bg-foreground/[0.04] p-6 transition-colors hover:bg-foreground/[0.07] sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md bg-accent/10 text-accent",children:e.jsx(v,{icon:Le,"aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-lg text-foreground",children:r("publicPricing.teamsTitle")}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:r("publicPricing.teamsBody")})]})]}),e.jsxs("span",{className:"inline-flex h-10 shrink-0 items-center gap-2 self-start rounded-md bg-foreground px-4 text-sm text-background transition-opacity group-hover:opacity-80 sm:self-auto",children:[r("publicPricing.teamsCta"),e.jsx(v,{icon:Ie,className:"text-xs transition-transform duration-200 group-hover:translate-x-0.5","aria-hidden":"true"})]})]})}function pn(){const{t:r}=q("checkout"),{isAuthenticated:R,user:i,refreshUser:U}=me(),H=ue(),C=ce(),{isLight:h}=pe(),k=!!i?.organization?.billing_managed,[D,f]=c.useState(!1),Q=ge(n=>n.setPendingCheckout),[G,b]=c.useState(!1),[J,W]=c.useState("signup"),[d,X]=c.useState("monthly"),[S,g]=c.useState(null);c.useEffect(()=>{xe()},[]);const{data:a,isLoading:A}=de({queryKey:["pricing",i?.pricing_region??"auto"],queryFn:()=>N.getPricing()}),p=I(a);c.useEffect(()=>{a&&he({user:i,sourcePage:"pricing",currency:I(a),pricingRegion:a.pricing_region})},[a,i]);const Y=`${window.location.origin}/payment-success?session_id={CHECKOUT_SESSION_ID}&return_to=${encodeURIComponent(C.pathname)}`,Z=L({mutationFn:n=>N.createCheckoutSession({...n,success_url:Y,cancel_url:window.location.href}),onSuccess:(n,t)=>{Q(null,C.pathname,void 0,"subscription");const s=a?.[t.tier];if(s){const o=t.billing_period==="annual"&&s.annual_price?s.annual_price:s.monthly_price;be({user:i,planName:s.name,planId:`${t.tier}_${t.billing_period}`,billingCycle:t.billing_period,value:o,currency:p})}window.location.href=n.checkout_url},onError:n=>{if(g(null),fe(n)){U().then(()=>f(!0));return}alert(n.response?.data?.error||r("upgradeModal.checkoutFailed"))}}),K=L({mutationFn:()=>N.getBillingPortalUrl(window.location.href,"downgrade"),onSuccess:n=>{window.location.href=n.url},onError:n=>{g(null),alert(n.response?.data?.error||r("upgradeModal.checkoutFailed"))}}),ee=m("pricing_feature_copy"),j=m("pricing_popular_nudge")==="nudge_max_ultra",ne=m("pricing_credit_value_pills"),te=m("pricing_tier_descriptions"),y=m("pricing_card_style"),F=m("pricing_cta_style"),x=a?.first_payment_bonus,P=!!x?.enabled&&$e(i),_=[{key:"pro",data:a?.pro,popular:!j,bestValue:!1},{key:"max",data:a?.max,popular:j,bestValue:!1},{key:"ultra",data:a?.ultra,popular:!1,bestValue:j}].filter(n=>n.data&&!n.data.legacy),re=(n,t)=>{const s=d==="annual"&&t.annual_price?"annual":"monthly",o=s==="annual"&&t.annual_price?t.annual_price:t.monthly_price;if(ye(n,`${n}_${s}`),Pe(n,o),_e({user:i,planName:t.name,planId:`${n}_${s}`,billingCycle:s,value:o,currency:p,sourcePage:"pricing"}),!R){b(!0);return}if(k){f(!0);return}if(Ve(n,i?.subscription_tier)){if(!window.confirm(r("pricing.downgradeConfirm",{defaultValue:"Downgrades take effect at the end of your current billing period â you'll keep your current plan until then and won't be charged now. Continue to the billing portal to switch to {{plan}}?",plan:t.name})))return;g(n),K.mutate();return}g(n),Z.mutate({tier:n,billing_period:s})},se=n=>i?.subscription_tier===n,ae=n=>n.annual_price?Math.round(n.monthly_price*12-n.annual_price):0,ie=qe(r,P?x:null);return e.jsxs("div",{className:"min-h-screen transition-colors duration-500 bg-background text-foreground",children:[e.jsxs(je,{children:[e.jsx("title",{children:r("publicPricing.pageTitle")}),e.jsx("meta",{name:"description",content:r("publicPricing.metaDescription")}),e.jsx("meta",{property:"og:title",content:r("publicPricing.pageTitle")}),e.jsx("meta",{property:"og:description",content:r("publicPricing.metaDescription")}),e.jsx("meta",{property:"og:type",content:"website"}),e.jsx("meta",{name:"twitter:card",content:"summary_large_image"})]}),e.jsx(Ne,{onAuthClick:n=>{W(n||"signup"),b(!0)},skipScrolled:!0}),e.jsx(ve,{isOpen:G,onClose:()=>b(!1),initialMode:J}),k&&e.jsx(Ce,{isOpen:D,onClose:()=>f(!1),reason:"managed"}),e.jsx("section",{className:"relative z-10 pt-28 md:pt-32 pb-16 px-6",children:e.jsxs("div",{className:"max-w-3xl mx-auto text-center",children:[e.jsx("h1",{className:"text-h1-sm md:text-h1 text-center text-foreground",children:r("publicPricing.heading")}),e.jsx("p",{className:"text-base md:text-lg text-center mt-4 text-muted-foreground",children:r("publicPricing.subheading")})]})}),e.jsx("section",{className:"relative z-10 pb-10 md:pb-16",children:e.jsxs("div",{className:"container",children:[P&&!A&&_.length>0&&e.jsx($,{bonus:x,variant:"banner",className:"mb-8"}),A?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 py-4",children:[1,2,3].map(n=>e.jsxs("div",{className:"rounded-md p-6 min-h-[420px] animate-pulse",children:[e.jsx("div",{className:"h-6 w-24 bg-secondary rounded mb-4"}),e.jsx("div",{className:"h-10 w-32 bg-secondary rounded mb-6"}),e.jsx("div",{className:"space-y-3",children:[1,2,3,4,5].map(t=>e.jsx("div",{className:"h-4 bg-secondary rounded w-full"},t))}),e.jsx("div",{className:"h-10 bg-secondary rounded mt-8"})]},n))}):_.length===0?e.jsx("div",{"data-prerender-error":"1",className:"text-center py-20 text-muted-foreground",children:e.jsx("p",{children:r("publicPricing.unableToLoad")})}):e.jsx("div",{className:"grid md:grid-cols-3 gap-6",children:_.map(({key:n,data:t,popular:s,bestValue:o})=>{const l=se(n),oe=d==="annual"&&t.annual_price?Math.round(t.annual_price/12):t.monthly_price,M=ae(t),T=s||o,le=ee==="rewrite"?t.features:t.features_control??t.features,B=ke(n,t,a?.pro,ne);return e.jsxs("div",{className:u("relative rounded-md p-6 transition-all",l?"bg-foreground
1/[0.04]":T?Ee(s,o,y," bg-foreground/[0.04]"):" bg-foreground/[0.04]"),children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-lg text-foreground",children:t.name}),s&&!l&&e.jsx(O,{kind:"popular",styleVariant:y,label:r("publicPricing.mostPopular")}),o&&!l&&e.jsx(O,{kind:"bestValue",styleVariant:y,label:r("publicPricing.bestValue",{defaultValue:"Best value"})}),l&&e.jsx("div",{className:u("bg-green-500/15 px-3 py-0.5 rounded-full text-xs uppercase tracking-wider font-medium",h?"text-green-700":"text-green-400"),children:r("publicPricing.currentPlanBadge")})]}),e.jsx("p",{className:"text-sm text-foreground mb-8",children:Se(n,te,Ae[n]||(t.games_per_month===-1?"Unlimited games":`${t.games_per_month} games per month`))}),e.jsxs("div",{className:"flex items-baseline gap-1 mb-1",children:[e.jsx("span",{className:"text-3xl text-foreground",children:w(oe,p)}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"per month"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:d==="annual"&&t.annual_price?`${w(t.annual_price,p)} billed annually`:"Â "}),P&&!l&&e.jsx($,{bonus:x,variant:"card",className:"mb-4"}),t.annual_price&&e.jsxs("div",{className:"flex items-center justify-between mb-5 border-y border-border py-4 -mx-6 px-6",children:[e.jsxs("button",{onClick:()=>X(d==="annual"?"monthly":"annual"),className:"flex items-center gap-2.5 cursor-pointer",children:[e.jsx("div",{className:u("relative w-9 h-5 rounded-full transition-colors",d==="annual"?"bg-foreground":"bg-foreground
1/20"),children:e.jsx("div",{className:u("absolute top-0.5 w-4 h-4 rounded-full bg-background transition-transform",d==="annual"?"translate-x-4.5":"translate-x-0.5")})}),e.jsx("span",{className:"text-sm text-foreground",children:"Annual"})]}),M>0&&e.jsxs("span",{className:u("bg-green-500/15 text-xs px-2 py-0.5 rounded-full font-medium",h?"text-green-700":"text-green-400"),children:["Save ",w(M,p)]})]}),l?e.jsx("button",{onClick:()=>H("/settings/billing"),className:"w-full flex items-center justify-center rounded-md bg-foreground/6 text-foreground hover:bg-foreground/10 transition-all cursor-pointer mb-6 h-12 text-base font-medium",children:r("publicPricing.manageBilling")}):e.jsx("button",{onClick:()=>re(n,t),disabled:S!==null,className:u("w-full flex items-center justify-center rounded-md transition-all cursor-pointer mb-6",Me(F),T?"bg-foreground text-background hover:opacity-80":"bg-foreground/6 text-foreground hover:bg-foreground/10"),children:S===n?e.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):Fe(F,t.name,r("publicPricing.getStarted"))}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-foreground",children:n==="ultra"?"All features in Max, plus:":n==="max"?"All features in Pro, plus:":"All features in Free, plus:"}),le.map((E,V)=>e.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[e.jsx(v,{icon:["far","check"],className:"text-green-500 text-xs mt-0.75 flex-shrink-0"}),e.jsxs("span",{className:"text-foreground",children:[E,Te(E)&&e.jsx(Be,{text:r("publicPricing.concurrentPlayersTooltip",{defaultValue:"How many people can play your game at the same time in Tesana."})})]}),V===0&&B&&e.jsx("span",{className:u("ml-auto flex-shrink-0 rounded-full bg-green-500/15 px-2 py-0.5 text-xs font-medium",h?"text-green-700":"text-green-400"),children:B})]},V))]})]},n)})}),e.jsx(ze,{})]})}),e.jsx("section",{className:"relative z-10",children:e.jsx("div",{className:"container py-10 md:py-16",children:e.jsx(Oe,{title:r("publicPricing.faqTitle"),items:ie,footer:e.jsx(z,{to:"/faq",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:r("publicPricing.viewAllFaqs")})})})}),e.jsx(we,{})]})}export{pn as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.