Loading
function(e,t,n){"use strict";n.d(t,{U_:()=>Q,yq:()=>ee,LR:()=>eu,$p:()=>ec,cD:()=>es,O8:()=>et,Ct:()=>ea,RO:()=>en});var l=n(627968),i=n(64700),s=n(284009),r=n.n(s),a=n(17928),o=n(785007),u=n(331322),c=n(534514),d=n(834730),m=n(726656),h=n(463376),p=n(558620),f=n(211159),g=n(34188),E=n(661531),A=n(939249),C=n(398590),x=n(793574),I=n(688810),_=n(63152),S=n(663066),y=n(976860),v=n(662388),T=n(652215),N=n(375708),j=n(456508);let b=function(e){let{onClose:t}=e,{analyticsLocations:n}=(0,I.Ay)();function i(){t(),(0,y.pX)(T.BVt.COLLECTIBLES_SHOP),(0,v.Cz)({analyticsSource:x.A.PREMIUM_PAYMENT_MODAL,analyticsLocations:n}),(0,C.jH)(),(0,S.dF)(_.Zt)}return(0,l.jsxs)("div",{className:j.kL,children:[(0,l.jsx)("div",{className:j.Wk,children:(0,l.jsx)(g.U,{size:"custom",width:20,height:20,color:E.A.colors.ICON_DEFAULT})}),(0,l.jsx)(d.E,{variant:"text-sm/normal",children:N.intl.format(N.t.twSHte,{checkItOut:e=>(0,l.jsx)(A.D,{className:j.nf,onClick:i,children:e})})})]})};var R=n(937008),P=n(222707),L=n(561794),M=n(97352),O=n(45938),w=n(975571),k=n(428262),D=n(580630),U=n(960851),G=n(881489),F=n(380619),V=n(477421),B=n(410516),H=n(735164),W=n(363476),K=n(531506),Y=n(871181),z=n(318007),Z=n(736339),q=n(285719),$=n(788868);n(26279);var J=n(818348),X=n(345138);function Q(e,t){let{isEligibleForBOGOPromotion:n}=t;return null!=e&&!n}function ee(e,t){let n=N.intl.string(N.t.BYa62u),l=N.intl.string(N.t.CDa6Dq),i=(()=>{switch(e.interval){case $.WT.YEAR:return n;case $.WT.MONTH:default:return l}})(),s=e.skuId;switch(t){case $.pe.TIER_0:switch(s){case $.pe.TIER_1:return N.intl.string(N.t.q6mxDS);case $.pe.TIER_2:return N.intl.string(N.t.seZVS0);default:return i}case $.pe.TIER_1:switch(s){case $.pe.TIER_0:return N.intl.string(N.t["7+u2zg"]);case $.pe.TIER_2:return N.intl.string(N.t.NG2qcc);default:return i}case $.pe.TIER_2:switch(s){case $.pe.TIER_0:case $.pe.TIER_1:return N.intl.string(N.t["eB0/w9"]);case $.pe.TIER_2:return e.interval===$.WT.MONTH?N.intl.formatToPlainString(N.t.RqUv86,{numFreeGuildSubscriptions:$.M4}):i;default:return i}default:return i}}function et(){let{userTrialOffer:e}=(0,h.i)(),t=e?.subscription_trial,{daysCount:n,copy:l}=i.useMemo(()=>t?.interval===$.WT.DAY?t?.interval_count>7?{daysCount:14,copy:N.intl.string(N.t.Z1V2cs)}:{daysCount:7,copy:N.intl.string(N.t.MI1rHs)}:{daysCount:30,copy:N.intl.string(N.t["+S5lrV"])},[t]);return{daysCount:n,copy:l,userTrialOffer:e}}function en(e){let{selectedPlanId:t,priceOptions:n,planOptions:l,subscriptionPeriodEnd:s,showTotal:u}=e,{selectedSkuId:c,setSelectedPlanId:d,checkoutPriceOptions:m,activeSubscription:g}=(0,f.t4)(e=>({selectedSkuId:e.selectedSkuId,setSelectedPlanId:e.setSelectedPlanId,checkoutPriceOptions:e.checkoutPriceOptions,activeSubscription:e.activeSubscription})),{userTrialOffer:E,isEligibleForTrial:A,discountOffer:C}=(0,h.i)(),x=(0,B.YJ)(C),{isGift:I,giftRecipient:_,selectedGiftStyle:S,customGiftMessage:y,setCustomGiftMessage:v,claimableRewards:T,setSelectedGiftingPromotionReward:N}=(0,R.Pv)(),j=(0,p.A)(),b=(0,F.kz)(j,I&&(0,O.Ik)(_),T),P=(0,L.tA)({giftRecipient:_,isGift:I});r()(void 0!==g,"should not be undefined");let[w,D]=(0,a.yK)([M.A],()=>[null!=g?M.A.get(g.planId):null,null!=t?M.A.get(t):null]),G=E?.subscription_trial,H=(0,U.cg)(),W=D??j,K=n??m;r()(null!=K,"Price option has to be set");let Y=C?.discount?.planIds,z=null!=C&&l.some(e=>Y?.includes(e))&&null!=C.discount,Z=null!=x&&l.includes(x)?(0,k.y8)(x,!1,I,K):void 0,q=W?.id!=null&&l.includes(W.id);i.useEffect(()=>{if(!q){let e=!I&&null!=x&&l.includes(x)?x:null;if(null==w||I)d(e??l[0]);else if(null!=w){let e=l.find(e=>e!==w.id);null!=e&&d(e)}}},[q,I,l,w,d,x]),i.useEffect(()=>{b&&null!=T&&T.length>0&&N(T[0])},[T,N,b]);let{ref:$,...X}=(0,o._u)(),Q=W?.id!=null?(0,k.y8)(W.id,!1,I,K):void 0,{ipCountryCode:ee}=(0,V.A)(),en="HR"===ee&&null!=Q&&Q.currency===J.Yr.EUR,el=(0,k.J$)(K.paymentSourceId),ei=!I&&(z||null!=G&&A&&null!=s),{copy:es}=et();return{skuId:c,selectedPlan:W,selectedPlanPrice:Q,premiumSubscriptionPlan:w,premiumSubscription:g,thePriceOptions:K,hasSeenCollectiblesInSkuSelect:P,shouldShowTrialOrDiscountLayout:ei,shouldShowHRKEuroWarning:en,shouldShowTotalInSubscriptionFlow:!A&&!z&&q&&u,canContinue:q,isPrepaid:el,radioGroupRef:$,radioGroupProps:X,isGift:I,giftRecipient:_,customGiftMessage:y,setCustomGiftMessage:v,selectedGiftStyle:S,isEligibleForBOGOPromotion:H,isEligibleForTrial:A,userTrialOffer:E,trialPeriodCopy:es,isPlansEligibleForDiscount:z,discountedPlanRegularPrice:Z}}function el(e){let{isPrepaid:t,selectedPlan:n,selectedPlanPrice:i,intervalType:s,className:r}=e;return(0,l.jsxs)("div",{className:r,children:[(0,l.jsx)("div",{className:X.T}),(0,l.jsx)(H.Sd,{label:N.intl.string(N.t.txajQG),value:(0,l.jsx)(W.A,{price:i.amount,currency:i.currency,intervalType:s,intervalCount:n.intervalCount,isPrepaidPaymentSource:t}),className:X.M3})]})}function ei(e){let{giftRecipient:t,customGiftMessage:n,setCustomGiftMessage:i,selectedGiftStyle:s,hasSeenCollectiblesInSkuSelect:r,isPrepaid:a,canContinue:o,selectedPlan:d,selectedPlanPrice:m,useCompactGiftComponents:h,handleClose:p,showTotal:f,switchPlanSelectComponent:g,warningComponent:E}=e;function A(e){return(0,l.jsxs)(u.B,{gap:8,children:[(0,l.jsx)(c.D,{variant:"heading-md/semibold",color:"text-strong",children:N.intl.string(N.t["3E5hXj"])}),e]})}return(0,O.Ik)(t)?(0,l.jsxs)("div",{className:X.mh,children:[(0,l.jsx)("div",{className:X.MU,children:null!=s&&(0,l.jsx)(z.t,{})}),(0,l.jsxs)("div",{className:X.Tc,children:[(0,l.jsx)(q.Z,{className:h?X.KW:void 0,giftRecipient:t}),(()=>{if((0,O.lo)(t)===O.tB.CUSTOM_MESSAGE_EMOJI_SOUNDBOARD&&null!=i)return(0,l.jsx)(Y.A,{className:X.iX,innerClassName:X.pt,onTextChange:e=>i(e),pendingText:n,currentText:n})})(),A(g),E,!r&&(0,l.jsx)(b,{onClose:p})]})]}):(0,l.jsxs)("div",{className:X.Du,children:[(0,l.jsx)(q.Z,{className:h?X.KW:void 0,giftRecipient:t}),A(g),o&&f&&null!=d&&null!=m&&(0,l.jsx)(el,{selectedPlan:d,selectedPlanPrice:m,intervalType:null,isPrepaid:a}),E,!r&&(0,l.jsx)(b,{onClose:p})]})}function es(e,t){let n=null!=e&&e.planId===t,l=n||t===$.gD.PREMIUM_MONTH_TIER_2&&null!=e&&[$.gD.PREMIUM_YEAR_TIER_0,$.gD.PREMIUM_YEAR_TIER_1].includes(e.planId);return{isCurrentPlan:n,disabled:l}}function er(e){let{isPrepaid:t,planOptions:n,radioGroupRef:s,selectedPlan:r,radioGroupProps:a,shouldShowTrialOrDiscountLayout:o,thePriceOptions:u,isPlansEligibleForDiscount:c,isEligibleForTrial:d}=e,{currentPremiumSubscriptionForCheckout:m}=(0,f.t4)(e=>({currentPremiumSubscriptionForCheckout:e.isGift?null:e.activeSubscription})),h=i.useMemo(()=>n.map(n=>{let{isCurrentPlan:i,disabled:s}=es(m,n);return(0,l.jsx)(Z.Ay,{planId:n,selected:r?.id===n,isCurrentPlan:i,disabled:e.disabled||s,premiumSubscription:m,isPrepaid:t,priceOptions:u,shouldShowTrialOrDiscountLayout:o,isEligibleForDiscount:c,isEligibleForTrial:d},n)}),[e.disabled,n,r,m,t,u,o,c,d]);return(0,l.jsx)("div",{ref:s,...a,children:h})}function ea(e,t){let{subscriptionPeriodEnd:n,trialPeriodCopy:l}=t,i=e?.trial_id===$.Dw;return null==n?null:i?N.intl.format(N.t.nG95hA,{endDate:n}):N.intl.format(N.t.s4E7kb,{trialEnd:n,trialPeriod:l})}function eo(e){let{shouldShowHRKEuroWarning:t,selectedPlanPrice:n}=e;return t&&null!=n?(0,l.jsx)(m.A,{message:N.intl.formatToPlainString(N.t["9hnZoK"],{kunaPriceWithCurrency:(0,D.$g)(7.5345*n.amount,J.Yr.HRK)})}):null}function eu(e){let{selectedPlan:t,selectedPlanPrice:n,isPrepaid:i,shouldShowHRKEuroWarning:s,shouldShowTrialOrDiscountLayout:r,showTotal:a,shouldShowTotalInSubscriptionFlow:o,previewTotalSectionClassName:u}=e;return(0,l.jsxs)(l.Fragment,{children:[o&&null!=t&&null!=n&&(0,l.jsx)(el,{className:u,selectedPlan:t,selectedPlanPrice:n,intervalType:t.interval,isPrepaid:i}),eo({shouldShowHRKEuroWarning:s,selectedPlanPrice:n}),!r&&a&&(0,l.jsx)(m.A,{message:N.intl.format(N.t.Om31w8,{documentationLink:w.A.getArticleURL(T.MVz.LOCALIZED_PRICING)})})]})}function ec(e){let{disabled:t,selectedPlanId:n,planGroup:i,priceOptions:s,planOptions:r,subscriptionPeriodEnd:a,showTotal:o=!0,useCompactGiftComponents:u,handleClose:m}=e,{skuId:h,selectedPlan:p,premiumSubscription:g,premiumSubscriptionPlan:E,isEligibleForBOGOPromotion:A,isGift:C,thePriceOptions:x,isEligibleForTrial:I,giftRecipient:_,customGiftMessage:S,setCustomGiftMessage:y,selectedGiftStyle:v,isPlansEligibleForDiscount:T,discountedPlanRegularPrice:j,hasSeenCollectiblesInSkuSelect:b,userTrialOffer:R,shouldShowTrialOrDiscountLayout:L,isPrepaid:M,radioGroupRef:O,radioGroupProps:w,selectedPlanPrice:k,shouldShowHRKEuroWarning:U,shouldShowTotalInSubscriptionFlow:F,canContinue:V,trialPeriodCopy:B}=en({selectedPlanId:n,priceOptions:s,planOptions:r,subscriptionPeriodEnd:a,showTotal:o}),{discountAmountOff:H,applicablePlan:W,discountOffer:Y}=(0,f.t4)(e=>e.premiumDiscountInfo),z=(0,G.ds)();function Z(){return(0,l.jsx)(er,{disabled:t,planOptions:r,radioGroupRef:O,radioGroupProps:w,isGift:C,isPrepaid:M,premiumSubscription:g,selectedPlan:p,thePriceOptions:x,shouldShowTrialOrDiscountLayout:L,isEligibleForTrial:I,isPlansEligibleForDiscount:T})}let{showFractionalPremiumBanner:q,fractionalPremiumInfo:J}=(0,P._V)({premiumSubscription:g,selectedPlanId:n,planGroup:i,isGift:C,fractionalPremiumInfoArgs:{forceFetch:!1,excludeReverseTrial:!1,excludeReverseTrialFromCountdown:!0}});if(C)return(0,l.jsx)(ei,{giftRecipient:_,customGiftMessage:S,setCustomGiftMessage:y,selectedGiftStyle:v,hasSeenCollectiblesInSkuSelect:b,isPrepaid:M,canContinue:V,selectedPlan:p,selectedPlanPrice:k,useCompactGiftComponents:u,handleClose:m,showTotal:o,switchPlanSelectComponent:Z(),warningComponent:eo({shouldShowHRKEuroWarning:U,selectedPlanPrice:k})});let et=!(I&&q&&!z),el=Q(E,{isEligibleForBOGOPromotion:A});return(0,l.jsxs)("div",{children:[q&&!z&&(0,l.jsx)(K.vi,{fractionalPremiumInfo:J,enablePremiumBrandRefresh:!0,variant:I?K.uA.TRIAL:void 0,trialPeriod:I?B:void 0,trialEnd:I?a:void 0}),el&&!q&&(0,l.jsx)("div",{className:X.G3,children:ee(E,h)}),et&&((e,t,i)=>{if(!L)return(0,l.jsx)(c.D,{variant:"heading-md/semibold",color:"text-strong",className:X.VZ,children:N.intl.string(N.t.a19jpU)});if(t)return(0,l.jsxs)("div",{children:[(0,l.jsx)(d.E,{variant:"text-sm/normal",className:X.Tz,children:ea(e,{subscriptionPeriodEnd:a,trialPeriodCopy:B})}),(0,l.jsx)("hr",{className:X.RA})]});if(i&&null!=H&&null!=j&&null!=W&&n===W){let e=p?.interval===$.WT.YEAR,t=(0,D.$g)(j.amount-H,j.currency),n=(0,D.$g)(j.amount,j.currency);return(0,l.jsxs)("div",{children:[(0,l.jsx)(d.E,{variant:"text-sm/normal",className:X.Tz,children:e?N.intl.format(N.t.ofweWu,{numYears:Y?.discount.userUsageLimit??"",discountedPrice:t,regularPrice:n}):N.intl.format(N.t["nG7g/E"],{numMonths:Y?.discount.userUsageLimit??"",discountedPrice:t,regularPrice:n})}),(0,l.jsx)("hr",{className:X.RA})]})}})(R,I,T),Z(),eu({selectedPlan:p,selectedPlanPrice:k,isPrepaid:M,shouldShowHRKEuroWarning:U,shouldShowTrialOrDiscountLayout:L,showTotal:o,shouldShowTotalInSubscriptionFlow:F})]})}}