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