Loading
function(e,t,n){"use strict";n.d(t,{c:()=>eR});var l=n(627968),i=n(64700),s=n(284009),r=n.n(s),a=n(17928),o=n(683071),u=n(512950),c=n(821609),d=n(123292),m=n(444927),h=n(529427),p=n(655857),f=n(211159),g=n(958340),E=n(166532),A=n(482132),C=n(87719),x=n(489254);let I=(0,n(240921).Ay)({name:"2026-05-boosting-pre-checkout-modal-refresh-monthly-rate",kind:"user",defaultConfig:{enabled:!1},variations:{0:{enabled:!1},1:{enabled:!0}}});var _=n(71393),S=n(178368),y=n(97352),v=n(473145),T=n(615396),N=n(526151);n(321073);var j=n(503698),b=n.n(j),R=n(661531),P=n(990078),L=n(408278),M=n(834040),O=n(499373),w=n(834730),k=n(403581),D=n(663803),U=n(320448),G=n(534514),F=n(104510),V=n(695366),B=n(289873),H=n(726656),W=n(793574),K=n(688810),Y=n(531260),z=n(666646),Z=n(404374),q=n(543767),$=n(881489),J=n(477421),X=n(234419),Q=n(295405),ee=n(166403),et=n(363476),en=n(531506),el=n(375708),ei=n(51465);function es(){return(0,l.jsxs)("div",{className:b()(ei.dt,ei.dE),children:[(0,l.jsx)("img",{src:"https://cdn.discordapp.com/assets/content/0253ce7b3c383fba5cadfd162724ef1769e45a69203a87698bf89d6b87a53acd.svg",alt:"reverse trial unlock",className:ei.qq}),(0,l.jsx)(w.E,{variant:"text-sm/medium",className:ei.tD,children:el.intl.format(el.t.f5VHKm,{})})]})}function er(e){let{text:t,color:n}=e;return(0,l.jsxs)("div",{className:ei.dt,children:[(0,l.jsx)(k.t,{size:"md",className:ei.YW,color:n}),(0,l.jsx)("div",{children:t})]})}var ea=n(773669),eo=n(287809),eu=n(975571),ec=n(252424),ed=n(428262),em=n(580630),eh=n(599669),ep=n(652215);n(26279);var ef=n(788868),eg=n(818348),eE=n(406263),eA=n(7921);function eC(e){return""===e||"-"===e}function ex(e){let{value:t,onChange:n,minValue:s=1,maxValue:r=30,ariaLabel:a}=e,[o,u]=i.useState(t);i.useEffect(()=>{u(t)},[t]);let c="number"==typeof o,d=e=>{u(e),eC(e)||n(e)};return(0,l.jsxs)("div",{className:eE.U$,children:[(0,l.jsx)(L.K,{variant:"secondary",size:"md",icon:M.Q,onClick:()=>{c&&!(o<=s)&&d(o-1)},"aria-label":el.intl.string(el.t["k+ohJm"]),disabled:!c||o<=s}),(0,l.jsx)("div",{className:eE.WJ,children:(0,l.jsx)("input",{className:eE.Zh,"aria-label":a,inputMode:"numeric",value:`${o}`,onChange:e=>(e=>{if(eC(e))return void d(e);let t=parseInt(e,10);if(!isNaN(t)){if(t<=s)return void d(s);if(t>=r)return void d(r);d(t)}})(e.currentTarget.value),onBlur:()=>{eC(o)&&u(t)}})}),(0,l.jsx)(L.K,{variant:"secondary",size:"md",icon:O.T,onClick:()=>{c&&!(o>=r)&&d(o+1)},"aria-label":el.intl.string(el.t.w8Sc4B),disabled:!c||o>=r})]})}function eI(e){let{message:t}=e;return(0,l.jsx)(w.E,{variant:"text-xs/normal",color:"text-muted",className:eE.jH,children:t})}function e_(e){let{text:t}=e;return(0,l.jsxs)("div",{className:eE.Vk,children:[(0,l.jsx)("div",{className:eE.D0,children:(0,l.jsx)(k.t,{"aria-hidden":"true",size:"custom",width:20,height:20,className:eE.ue,color:Z.k0.PREMIUM_TIER_2})}),(0,l.jsx)("div",{className:eE.yP,children:t})]})}function eS(e){let{isLoading:t,numGuildBoosts:n,setNumGuildBoosts:s,planLabel:r,planPriceContent:a,subtotalContent:o,refreshSubtotalContent:u,legacyDescriptionContent:c,refreshDescriptionContent:d,fractionalBanner:m,existingSlotNotice:h,discountCallout:p,refreshDiscountCallout:f,legacyPricingNotes:g,refreshPricingNotes:E}=e;return(0,l.jsxs)("div",{children:[m,c,h,(0,l.jsxs)("div",{className:eA.mP,children:[(0,l.jsxs)("div",{className:eA.E6,children:[(0,l.jsx)(D.l,{value:n,onChange:e=>s(e),className:eA.__invalid_planSelector,minValue:1,maxValue:30}),(0,l.jsx)("div",{className:eA.$0,children:r})]}),(0,l.jsx)("div",{className:b()(eA.QK,{[eA.S]:t}),children:a})]}),(0,l.jsx)("div",{className:eA.J3}),(0,l.jsxs)("div",{className:eA.mP,children:[(0,l.jsx)("div",{className:eA.xp,children:el.intl.string(el.t.RtA7nR)}),(0,l.jsx)("div",{className:b()(eA.__invalid_planSelectorSubtotalPrice,{[eA.S]:t}),children:o})]}),g.map((e,t)=>(0,l.jsx)(i.Fragment,{children:e},t)),p]})}function ey(e){let{isLoading:t,numGuildBoosts:n,setNumGuildBoosts:s,refreshNextStepLabel:r,planLabel:a,planPriceContent:o,subtotalContent:u,refreshSubtotalContent:c,legacyDescriptionContent:d,refreshDescriptionContent:m,fractionalBanner:h,existingSlotNotice:p,discountCallout:f,refreshDiscountCallout:g,legacyPricingNotes:E,refreshPricingNotes:A}=e;return(0,l.jsxs)("div",{className:eE.xY,children:[h,(0,l.jsxs)("div",{className:eE.K3,children:[(0,l.jsx)(w.E,{variant:"text-md/medium",className:eE.bk,children:el.intl.string(el.t["r+SebU"])}),(0,l.jsx)(U._,{className:eE.bN,color:"currentColor",size:"xs"}),(0,l.jsx)(w.E,{variant:"text-md/medium",className:eE.kX,children:r})]}),m,p,(0,l.jsxs)("div",{className:eE.fh,children:[(0,l.jsxs)("div",{className:eE.fX,children:[(0,l.jsx)(ex,{value:n,onChange:e=>s(e),ariaLabel:a,minValue:1,maxValue:30}),(0,l.jsx)(w.E,{variant:"text-md/medium",className:eE.ny,children:a})]}),(0,l.jsx)("div",{className:b()(eE.El,{[eA.S]:t}),children:o})]}),g,(0,l.jsxs)("div",{className:eE.fh,children:[(0,l.jsx)(G.D,{variant:"heading-lg/semibold",className:eE.O3,children:el.intl.string(el.t.RtA7nR)}),(0,l.jsx)("div",{className:b()(eE.BU,{[eA.S]:t}),children:c})]}),A.map((e,t)=>(0,l.jsx)(i.Fragment,{children:e},t))]})}function ev(e){let{existingAvailableSlots:t,canceledCount:n,premiumSubscription:i}=e;return(0,l.jsxs)("div",{className:eA.Mv,children:[(0,l.jsx)(F._,{className:eA.T5,color:R.A.unsafe_rawColors.GUILD_BOOSTING_PINK}),(0,l.jsxs)("div",{children:[el.intl.format(el.t.F8xlhr,{slotCount:t.length}),n>0&&null!=i?(0,l.jsx)(P.m,{text:el.intl.formatToPlainString(el.t.SFpsCH,{canceledCount:n,date:i.currentPeriodEnd}),children:(0,l.jsx)(V.E,{size:"custom",width:20,height:20,className:eA.Y5,color:R.A.unsafe_rawColors.YELLOW_300.css})}):null]})]})}function eT(e){let{premiumSubscriptionPlan:t,numGuildBoosts:n,setNumGuildBoosts:s,setForceDisableSubmitButton:o,premiumSubscription:u,onClickPremiumSubscriptionLink:c,existingAvailableSlots:d=[],priceOptions:m,isRefreshEnabled:h=!1,showRefreshSubtotalRate:p=!1,refreshNextStepLabel:f=el.intl.string(el.t.QBnNHq)}=e,g=function(e){let t,n,{premiumSubscriptionPlan:s,numGuildBoosts:o,setForceDisableSubmitButton:u,premiumSubscription:c,onClickPremiumSubscriptionLink:d,existingAvailableSlots:m,priceOptions:h,showRefreshSubtotalRate:p}=e,f=(t=(0,a.bG)([ee.A],()=>ee.A.getPremiumTypeSubscription()),(0,a.bG)([Q.A],()=>t?.paymentSourceId!=null?Q.A.getPaymentSource(t.paymentSourceId)?.country:null)),g=s.interval,E=s.intervalCount,A=(0,a.bG)([y.A],()=>y.A.getForSkuAndInterval((0,ed.mH)(ef.pe.GUILD),g,E)),C=(0,a.bG)([eo.default],()=>eo.default.getCurrentUser()),x=(0,Y.A)({forceFetch:!1});r()(null!=A,"Missing guildBoostingSubscriptionPlan");let I=[{planId:A.id,quantity:1}],_=c?.items.find(e=>e.planId===ef.gD.PREMIUM_MONTH_TIER_2||e.planId===ef.gD.PREMIUM_YEAR_TIER_2);null!=_&&I.push(_);let S=c?.items.find(e=>e.planId===ef.gD.PREMIUM_MONTH_GUILD||e.planId===ef.gD.PREMIUM_YEAR_GUILD),T=null==f||!ef.uJ.has(f)||null==S,{analyticsLocations:N}=(0,K.Ay)(),[j,R]=(0,q.YV)({subscriptionId:c?.id,items:I,renewal:!0,paymentSourceId:c?.paymentSourceId,currency:h.currency,preventFetch:T,analyticsLocations:N,analyticsLocation:W.A.GUILD_BOOSTING_PLAN_SELECT});(0,z.Tr)(j,R);let P=!T&&null==j&&null==R;i.useLayoutEffect(()=>{u(P)},[P,u]);let L=(0,X.V)()?.subscription_trial?.sku_id===ef.pe.TIER_2,M=ed.Ay.hasBoostDiscount(C),O=M&&null!=c&&ed.Ay.isPremiumAtLeast(ed.Ay.getPremiumType(c.planId),ef.PremiumTypes.TIER_1),w=j?.findInvoiceItemByPlanId(A.id),k=null!=w?{amount:w.amount,tax:0,taxInclusive:!0,currency:j.currency}:ed.Ay.getPrice(A.id,M,!1,h),D=o*k.amount,U=(0,$.ds)()&&M&&null!=c,G=function(e){let t,{existingAvailableSlotsCount:n,fractionalPremiumState:l,isReverseTrial:i,hasDiscountUpsell:s,withTrialOfferCopyVariant:r}=e;return t=i?"reverse_trial":s?"discount":r?"upsell_trial":"upsell",{showExistingSlotNotice:n>0,showFractionalPremiumBanner:l===ef.xc.FP_SUB_PAUSED,upsellVariant:t}}({existingAvailableSlotsCount:m.length,fractionalPremiumState:x.fractionalState,isReverseTrial:U,hasDiscountUpsell:O,withTrialOfferCopyVariant:L});"discount"===G.upsellVariant?(r()(null!=c,"Missing premiumSubscription for discount upsell variant"),n=el.intl.format(el.t.hf6YOY,{planName:ed.Ay.getTierDisplayNameByPlanId(c.planId)})):n=el.intl.format("upsell_trial"===G.upsellVariant?el.t.ba1L74:el.t.fkffDT,{onPremiumSubscriptionClick:d,discountPercentage:(0,ec.l9)(ea.default.locale,ef.oX/100),freeSubscriptionCount:ef.M4});let F=m.filter(e=>(0,v.I5)(e)).length,V=(0,ed.J$)(h.paymentSourceId),{ipCountryCode:ei}=(0,J.A)(),eC="HR"===ei&&k.currency===eg.Yr.EUR,ex=U&&null!=c?(0,l.jsx)(eh.Ak,{text:(0,eh.zT)(c.currentPeriodEnd)}):(0,l.jsx)("div",{className:b()(eA.hA,eA.G3),children:el.intl.string(el.t.jNY1FO)}),eS=U&&null!=c?(0,l.jsx)(eh.Ak,{text:(0,eh.zT)(c.currentPeriodEnd),className:eA.jk}):(0,l.jsx)("div",{className:eE._X,children:el.intl.string(el.t.jNY1FO)}),ey=G.showExistingSlotNotice?(0,l.jsx)(ev,{existingAvailableSlots:m,canceledCount:F,premiumSubscription:c}):null,eT=G.showFractionalPremiumBanner?(0,l.jsx)(en.vi,{fractionalPremiumInfo:x}):null,eN=V?function(e){let{intervalType:t,intervalCount:n=1}=e;return t===ef.WT.YEAR?el.intl.string(el.t.YDpAzZ):t===ef.WT.MONTH&&1===n?el.intl.string(el.t["6ZR3By"]):null}({intervalType:g,intervalCount:E})??el.intl.string(el.t.K9Bmze):el.intl.string(el.t.K9Bmze),ej=P?(0,l.jsx)(B.y,{}):V?(0,em.$g)(k.amount,k.currency):function(e){let{amount:t,currency:n,intervalType:l,intervalCount:i=1}=e,s=(0,em.$g)(t,n);return l===ef.WT.YEAR?el.intl.formatToPlainString(el.t["8M04YJ"],{price:s}):l===ef.WT.MONTH&&1===i?el.intl.formatToPlainString(el.t.VStWCR,{price:s}):l===ef.WT.MONTH&&i>1?el.intl.formatToPlainString(el.t.xJvAFU,{price:s}):null}({intervalType:g,intervalCount:E,amount:k.amount,currency:k.currency}),eb=P?(0,l.jsx)(B.y,{}):(0,l.jsx)(et.A,{price:D,currency:k.currency,intervalType:g,intervalCount:E,isPrepaidPaymentSource:V}),eR=P?(0,l.jsx)(B.y,{}):p&&!V?(0,em.CE)((0,em.$g)(D,k.currency),g,E):(0,em.$g)(D,k.currency),eP=[],eL=[];if(eC){let e=(0,l.jsx)(H.A,{message:el.intl.formatToPlainString(el.t["9hnZoK"],{kunaPriceWithCurrency:(0,em.$g)(7.5345*D,eg.Yr.HRK)})},"hrk-warning");eP.push(e),eL.push(e)}let eM=el.intl.format(el.t.Om31w8,{documentationLink:eu.A.getArticleURL(ep.MVz.LOCALIZED_PRICING)});return eP.push((0,l.jsx)(H.A,{message:eM},"localized-pricing")),eL.push((0,l.jsx)(eI,{message:eM},"localized-pricing")),{isLoading:P,planLabel:eN,planPriceContent:ej,subtotalContent:eb,refreshSubtotalContent:eR,legacyDescriptionContent:ex,refreshDescriptionContent:eS,existingSlotNotice:ey,fractionalBanner:eT,legacyPricingNotes:eP,refreshPricingNotes:eL,discountCallout:"reverse_trial"===G.upsellVariant?(0,l.jsx)(es,{}):(0,l.jsx)(er,{text:n,color:Z.k0.PREMIUM_TIER_2}),refreshDiscountCallout:"reverse_trial"===G.upsellVariant?(0,l.jsx)(es,{}):(0,l.jsx)(e_,{text:n})}}({premiumSubscriptionPlan:t,numGuildBoosts:n,setForceDisableSubmitButton:o,premiumSubscription:u,onClickPremiumSubscriptionLink:c,existingAvailableSlots:d,priceOptions:m,showRefreshSubtotalRate:p});return(0,l.jsx)(h?ey:eS,{isLoading:g.isLoading,numGuildBoosts:n,setNumGuildBoosts:s,planLabel:g.planLabel,planPriceContent:g.planPriceContent,subtotalContent:g.subtotalContent,refreshSubtotalContent:g.refreshSubtotalContent,legacyDescriptionContent:g.legacyDescriptionContent,refreshDescriptionContent:g.refreshDescriptionContent,fractionalBanner:g.fractionalBanner,existingSlotNotice:g.existingSlotNotice,discountCallout:g.discountCallout,refreshDiscountCallout:g.refreshDiscountCallout,legacyPricingNotes:g.legacyPricingNotes,refreshPricingNotes:g.refreshPricingNotes,refreshNextStepLabel:f})}var eN=n(879100),ej=n(469633),eb=n(898640);function eR(e){let{handleClose:t,handleStepChange:n}=e,{numGuildBoostsToPurchase:i,setNumGuildBoostsToPurchase:s,guildId:j,closeGuildPerksModal:b,disablePremiumUpsell:R,setForceDisableSubmitButton:P,forceDisableSubmitButton:L,paymentModalArgs:M,premiumSubscriptionPaymentSourceId:O}=(0,N.Oe)(),{paymentSourceId:w,activeSubscription:k}=(0,f.t4)(e=>({paymentSourceId:e.paymentSourceId,activeSubscription:e.activeSubscription})),{displayCurrency:D}=(0,p.Jn)(),U=null!=O||Object.keys(M.paymentSources).length>0,G=(0,E.Ir)(U?E.pn.REVIEW:E.pn.ADD_PAYMENT_STEPS),F=(0,m.A)(()=>(0,v.D$)(S.A.boostSlots)),V=(0,x.n)("GuildBoostPurchaseModal"),B=I.useConfig({location:"GuildBoostPurchaseModal"}).enabled,H=V&&B,W=(0,a.bG)([g.A],()=>null!=j?g.A.getGuild(j):void 0,[j]),K=null!=j?_.A.getGuild(j):null,Y=null==W&&null==K,z=null!=k&&k.isPurchasedExternally,Z=Object.keys(M.paymentSources).length>0,q=(0,a.bG)([y.A],()=>null!=k?(0,T.c9)(k.planId):null),$=(0,a.bG)([y.A],()=>null==q?y.A.get(ej.Z):q);if(null==j)throw new h.vd({message:"Missing guildId"});r()(null!=$,"Missing nextPremiumSubscriptionPlan");let J=(0,l.jsx)(eT,{premiumSubscriptionPlan:$,numGuildBoosts:i,setNumGuildBoosts:s,setForceDisableSubmitButton:P,premiumSubscription:k,existingAvailableSlots:F,onClickPremiumSubscriptionLink:()=>{if(__BILLING_STANDALONE__){window.location.href="discord://app/settings/nitro";return}t(),null!=b&&b(),(0,C.e)()},priceOptions:null!=w?{paymentSourceId:w,currency:null!=D?D:void 0}:{currency:null!=D?D:void 0},isRefreshEnabled:V,showRefreshSubtotalRate:H,refreshNextStepLabel:G});return z&&null!=k&&null!=k.paymentGateway?J=(0,l.jsxs)("div",{className:eb.xK,children:[(0,l.jsx)(o.w,{type:"critical",children:el.intl.format(el.t["/m3Y3s"],{paymentGatewayName:eg.qm[k.paymentGateway]})}),J]}):null!=j&&!g.A.isGuildFetching(j)&&Y&&(J=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(u.p,{messageType:u.Y.ERROR,className:eb.MR,children:el.intl.string(el.t.eAn6z2)}),J]})),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(A.dZ,{children:J}),(0,l.jsx)(A.UX,{children:(0,l.jsx)(eN._,{currentStep:E.pn.PLAN_SELECT,isRefreshEnabled:V,backStep:void 0,handleStepChange:n,primaryButtonProps:null,secondaryButton:V?(0,l.jsx)(c.$,{variant:"secondary",text:el.intl.string(el.t["ETE/oC"]),onClick:t}):(0,l.jsx)(d.Q,{text:el.intl.string(el.t.oEAioF),onClick:t,variant:"secondary"}),legacySubmitButton:(0,l.jsx)(c.$,{variant:"primary",text:el.intl.string(el.t["3PatSz"]),type:"submit",disabled:function(e){let{forceDisableSubmitButton:t,numGuildBoostsToPurchase:n,isDisabledBecauseExternalSubscription:l,isMissingGuildInformation:i}=e;return t||0===n||l||i}({forceDisableSubmitButton:L,numGuildBoostsToPurchase:i,isDisabledBecauseExternalSubscription:z,isMissingGuildInformation:Y}),onClick:()=>{R||null!=q&&q.premiumSubscriptionType===ef.PremiumTypes.TIER_2?n(null!=O||Z?E.pn.REVIEW:E.pn.ADD_PAYMENT_STEPS):n(E.pn.PREMIUM_UPSELL)}})})})]})}}