import{b as s,c as r,e as n,aa as M,d as Q,cF as z,s as R,u as j,x as v,r as S,cG as O,cH as Y,E as G,o as K,F as d,h as p,g as y,cI as U,av as W,a4 as J,f as m,w as _,i as L,t as a,m as $,n as B,q as E,cC as X,K as Z,_ as tt}from"./D2kI-Quc.js";import{E as et}from"./CiX9FjAZ.js";import{_ as st}from"./DlAUqK2U.js";import"./l0sNRNKZ.js";import{u as rt}from"./CQHj3onu.js";const nt={},ot={class:"card"},at={class:"card-title !tw-text-center"},ct={class:"!tw-text-xs"},lt={class:"card-content tw-h-full"};function it(f,h){return s(),r("div",ot,[n("div",at,[n("h2",ct,[M(f.$slots,"card-title",{},void 0,!0)])]),n("div",lt,[M(f.$slots,"card-content",{},void 0,!0)])])}const ut=st(nt,[["render",it],["__scopeId","data-v-8c0583a2"]]),dt={class:"desktop:!tw-flex tw-h-full"},pt={class:"tw-mb-1 !tw-text-2xl"},mt={class:"tw-mb-6"},_t={key:0,class:"starts-at tw-mb-2"},ft={class:"gradient default-v2 !tw-text-2xl !tw-font-bold"},ht={key:1,class:"tw-mt-2 tw-mb-6"},wt=["innerHTML"],vt={key:2,class:"tw-mt-2 tw-mb-6"},yt=["onClick"],$t={key:0,class:"plan-tip tw-mt-2 tw-mb-8"},Pt=Q({__name:"Plans",props:{isLpPage:{type:Boolean,default:!1}},setup(f){z(t=>({"97c88d02":y(I),"647d58cb":y(V)}));const h=f,g=R(),{tm:H}=j(),k=v(()=>{const t=H("lp-upgrade-emqx");return[{title:t.fullyManaged,list:[{...t.serverless,action:"serverless"},{...t.dedicated,action:"dedicated"},{...t.premium,action:"premium"},{...t.byoc,action:"byoc"}]},{title:t.selfManaged,list:[{...t.enterprise,action:"enterprise"}]}]}),D=v(()=>k.value.reduce((o,i)=>o.concat(i.list),[]).some(o=>o.startsAt));function T(t){if(["serverless","dedicated"].includes(t))rt("new");else if(t==="enterprise"){const o=h.isLpPage?"/lp/contact/emqx":"/contact?product=enterprise";g.push(E(o))}else if(t==="premium"){const o=h.isLpPage?"/lp/contact/cloud?productEdition=Premium":"/contact?product=cloud&productEdition=Premium";g.push(E(o))}else if(t==="byoc"){const o=h.isLpPage?"/lp/contact/cloud?productEdition=BYOC":"/contact?product=cloud&productEdition=BYOC";g.push(E(o))}}const I=v(()=>k.value.map(t=>`${t.list.length}fr`).join(" ")),b=S(null),w=S(Array(4).fill("auto")),V=v(()=>w.value.join(" ")),q=O(()=>{var o;if(!b.value)return;const t=(o=b.value)==null?void 0:o.querySelectorAll(".plan");if(t){if(U.value){w.value=Array(4).fill("auto");return}w.value=Array(4).fill("auto"),W(()=>{const i=Array.from(t).reduce((u,x)=>u.map((C,P)=>{const c=x.querySelector(`.plan > :nth-child(${P+1})`);return Math.max(C,(c==null?void 0:c.clientHeight)||0)}),Array(4).fill(0));w.value=i.map(u=>`${u}px`)})}},200,!0),{width:F}=Y();return G(()=>F.value,q),K(()=>{q()}),(t,o)=>{const i=X,u=Z,x=et,C=tt,P=ut;return s(),r("div",{id:"page-lp-upgrade-emqx-plans",ref_key:"plansRef",ref:b},[(s(!0),r(d,null,p(y(k),(c,N)=>(s(),r("div",{key:N,style:J({"--card-max-width":`${c.list.length*400}px`})},[m(P,null,{"card-title":_(()=>[L(a(t.$rt(c.title)),1)]),"card-content":_(()=>[n("div",dt,[(s(!0),r(d,null,p(c.list,e=>(s(),r("div",{key:e.action,class:"plan"},[n("div",null,[n("h3",pt,a(t.$rt(e.title)),1),n("p",mt,a(t.$rt(e.desc)),1)]),n("div",null,[e.startsAt?(s(),r("p",_t,a(t.$rt(e.startsAt)),1)):$("",!0),n("div",{class:B({"tw-mt-8":!e.startsAt&&y(D),"tw-mb-8":!e.priceDesc&&!e.freeQuota})},[n("span",ft,a(t.$rt(e.price)),1)],2),e.priceDesc?(s(),r("ul",ht,[(s(!0),r(d,null,p(e.priceDesc,(l,A)=>(s(),r("li",{key:A},[n("p",{innerHTML:t.$rt(l)},null,8,wt)]))),128))])):$("",!0),e.freeQuota?(s(),r("p",vt,[L(a(t.$rt(e.freeQuota))+" ",1),m(x,{effect:"dark",placement:"top-start","popper-class":"tw-max-w-80"},{content:_(()=>[(s(!0),r(d,null,p(e.freeQuotaDesc,l=>(s(),r("p",{key:t.$rt(l),class:"tw-mb-1 last:tw-mb-0"},a(t.$rt(l)),1))),128))]),default:_(()=>[m(u,{class:"!tw-text-gray-p-dark tw-cursor-pointer"},{default:_(()=>[m(i)]),_:1})]),_:2},1024)])):$("",!0)]),n("div",null,[n("button",{class:B(["button is-gradient tw-px-3",[e.tip?"":"tw-mb-8"]]),onClick:l=>T(e.action)},a(t.$rt(e.btn))+" → ",11,yt),e.tip?(s(),r("p",$t,a(t.$rt(e.tip)),1)):$("",!0)]),n("ul",null,[(s(!0),r(d,null,p(e.features,(l,A)=>(s(),r("li",{key:A,class:"!tw-flex"},[m(C,{name:"check",class:"tw-my-1 tw-mr-2"}),L(" "+a(t.$rt(l)),1)]))),128))])]))),128))])]),_:2},1024)],4))),128))],512)}}});export{Pt as _};