1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="dbf9ebd3-3ee6-195f-c34c-6582ad80c644")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,261085,908155,e=>{"use strict";var t,n=e.i(320778),a=e.i(92571);e.i(694876);var i=e.i(661784);e.i(640616);var r=e.i(479398);e.i(710273);var l=e.i(983739),o=e.i(521275);e.i(505864);var s=e.i(414055),u=e.i(122427),d=e.i(626773),c=e.i(319266);e.i(581355);var p=e.i(129823),m=e.i(742572),y=e.i(694790),h=e.i(52094),g=e.i(301366),f=e.i(529249);e.i(408340);var v=e.i(14210);e.i(225583);var b=e.i(65726),S=e.i(132244);e.i(934276);var x=e.i(655565),E=e.i(838939),T=e.i(431711);e.i(994414);var _=e.i(933465),C=e.i(106787);let P="Upgrade Now";var I=e.i(504405),w=e.i(618406);e.i(330428);var A=e.i(165365),U=e.i(540626);function j(){let e=(0,I._)(["\n position: relative;\n margin-top: ",";\n gap: 1rem;\n justify-content: flex-start;\n width: fit-content;\n"]);return j=function(){return e},e}function N(){let e=(0,I._)(["\n position: relative;\n display: inline-block;\n"]);return N=function(){return e},e}function M(){let e=(0,I._)(["\n position: absolute;\n top: -0.9rem;\n right: 1rem;\n padding: 0.2rem 1.2rem;\n font-size: ",";\n font-family: ",";\n font-weight: ",";\n line-height: 1.4rem;\n border-radius: 3.2rem;\n background: linear-gradient(89.06deg, #3505FC -53.48%, #87A9F2 110.87%);\n color:#EEEFF2;\n"]);return M=function(){return e},e}function k(){let e=(0,I._)(["\n right: auto;\n left: 50%;\n transform: translateX(-50%);\n white-space: nowrap;\n"]);return k=function(){return e},e}function D(){let e=(0,I._)(["\n color: ",";\n span {\n font-size: ",";\n line-height: ",";\n color: ",";\n margin-right: 0.6rem;\n }\n"]);return D=function(){return e},e}function L(){let e=(0,I._)(["\n display: flex;\n background: ",";\n border: 1px solid ",";\n border-radius: ",";\n padding: 1.2rem;\n margin-bottom: 1.6rem;\n color: ",";\n\n p {\n margin-top: -0.3rem;\n }\n"]);return L=function(){return e},e}function F(){let e=(0,I._)(["\n margin-right: 0.8rem;\n color: ",";\n"]);return F=function(){return e},e}let R=(0,U.default)(A.StyledFlex).withConfig({displayName:"upgrade-to-annual.styles__StyledButtonContainerFlex",componentId:"sc-bb3bca0e-0"})(j(),e=>{let{$inline:t}=e;return t?"0":"2rem"}),B=U.default.span.withConfig({displayName:"upgrade-to-annual.styles__InlineRelative",componentId:"sc-bb3bca0e-1"})(N()),O=U.default.span.withConfig({displayName:"upgrade-to-annual.styles__UpgradeSubscriptionDescription",componentId:"sc-bb3bca0e-2"})(M(),e=>{let{theme:t}=e;return t.fonts.sizes.tiny},e=>{let{theme:t}=e;return t.fonts.familyUbuntu},e=>{let{theme:t}=e;return t.fonts.weight.semiBold}),G=(0,U.default)(O).withConfig({displayName:"upgrade-to-annual.styles__ThreeMonthsFreePill",componentId:"sc-bb3bca0e-3"})(k());U.default.span.withConfig({displayName:"upgrade-to-annual.styles__StyledModalBodyPriceText",componentId:"sc-bb3bca0e-4"})(D(),e=>{let{theme:t}=e;return t.colors.text.main},e=>{let{theme:t}=e;return t.fonts.sizes.default},e=>{let{theme:t}=e;return t.fonts.lineHeight.default},e=>{let{theme:t}=e;return t.colors.text.lighter}),U.default.div.withConfig({displayName:"upgrade-to-annual.styles__StyledErrorReason",componentId:"sc-bb3bca0e-5"})(L(),e=>{let{theme:t}=e;return t.colors.error.lighter},e=>{let{theme:t}=e;return t.colors.error.main},e=>{let{theme:t}=e;return t.radius.small},e=>{let{theme:t}=e;return t.colors.text.main}),(0,U.default)(w.FontAwesomeIcon).withConfig({displayName:"upgrade-to-annual.styles__StyledIcon",componentId:"sc-bb3bca0e-6"})(F(),e=>{let{theme:t,$error:n}=e;return n?t.colors.error.main:t.colors.success.main});var Y=((t={})[t.PENDING=0]="PENDING",t[t.FAILED=1]="FAILED",t[t.SUCCESS=2]="SUCCESS",t[t.SUCCESS_STRIPE_V2=3]="SUCCESS_STRIPE_V2",t[t.FAILED_STRIPE_V2=4]="FAILED_STRIPE_V2",t),V=e.i(421102),z=e.i(848295),q=e.i(331907),W=e.i(917160),Q=e.i(974072),H=e.i(106241),X=e.i(648534),K=e.i(460142);let $=(0,o.forwardRef)((e,t)=>{var I,w,A,U;
2let{b2cSubscription:j,renderInline:N,analyticsSource:M="manage-account",hideTrigger:k=!1}=e,[D]=(0,g.useTrackEventMutation)(),[L]=(0,g.useTrackCTAClickMutation)(),{data:F}=(0,h.useGetUserQuery)(),[O,$]=(0,o.useState)(!1),[J,Z]=(0,o.useState)(null),[ee,et]=(0,o.useState)({state:Y.PENDING}),{monthsFreePill:en,subscriptionDiscountPricePending:ea,availableSale:ei}=function(){var e;let{data:t,isSuccess:n}=(0,z.useGetSubscriptionPricingQuery)(m.StripePlan.REGULAR),a=null==t?void 0:t.data,{data:i}=(0,K.useGetAvailableSaleQuery)(),r=null==i?void 0:i.data,{data:l,isSuccess:s,isError:u,isUninitialized:d}=(0,K.useGetSubscriptionDiscountMetaQuery)(void 0),c=null==l?void 0:l.data,{hasSaleApplied:p}=(0,X.useSaleManualApply)(),y=(0,o.useMemo)(()=>{if(!(s&&c))return null;let{allowedCheckoutSaleIds:e,roster:t,primarySale:n}=c,a=t=>null!=t&&e.includes(t);if(1===t.length){var i;let e=null==(i=t.at(0))?void 0:i.saleId;return a(e)?e:null}let r=null==n?void 0:n.saleId;return a(r)?r:null},[s,c]),h=(0,o.useMemo)(()=>(0,Q.resolveSaleForDiscount)({discountMetaQuerySuccess:s,discountMeta:c,checkoutValidatedSaleId:y,availableSale:r}),[s,c,y,r]),g=h&&h.saleType!==m.AVAILABLE_SALE_TYPE.URL_ACTIVATED_SALE_NOT_APPLICABLE?h:null,{activeOffer:f}=(0,H.useRotatingOffer)(null!=(e=null==g?void 0:g.offers)?e:[]),v=(0,o.useMemo)(()=>!!s&&null!=c&&c.roster.some(e=>e.saleId===m.SUBSCRIPTION_STUDENT_ROSTER_SALE_ID)&&c.allowedCheckoutSaleIds.includes(m.SUBSCRIPTION_STUDENT_ROSTER_SALE_ID),[s,c]),b=(0,o.useMemo)(()=>{var e;return null==y||null==c?null:null!=(e=c.roster.find(e=>e.saleId===y))?e:null},[y,c]),S=v?y===m.SUBSCRIPTION_STUDENT_ROSTER_SALE_ID||null==y&&!!(null==a?void 0:a.isStudent):!!(null==a?void 0:a.isStudent),x=null!=b?b.percentOff:void 0,E,T=(0,o.useMemo)(()=>{var e,t,n;return(0,W.computeSaleDiscount)({sale:h,hasSaleApplied:p,monthlyPrice:null!=(e=null==a?void 0:a.monthlyPlan.price)?e:0,yearlyPrice:null!=(t=null==a?void 0:a.yearlyPlan.price)?t:0,isStudent:S,studentDiscount:S&&null!=(n=null==a?void 0:a.studentDiscount)?n:0,activeOfferPercentageOff:E,selectedRosterPercentageOff:x})},[h,p,null==a?void 0:a.monthlyPlan.price,null==a?void 0:a.yearlyPlan.price,S,null==a?void 0:a.studentDiscount,E,x]),_=!d&&!s&&!u,C=(0,o.useMemo)(()=>!(n&&a)||_?null:(0,V.computeMonthsEquivalentFreeVsMonthly)(a.monthlyPlan.price,T.discountedYearlyPrice),[n,a,_,T.discountedYearlyPrice]);return{pricingData:n?a:void 0,saleResult:T,availableSale:null!=r?r:void 0,monthsFreePill:C,subscriptionDiscountPricePending:_,pricingLoaded:n}}(),er=(0,o.useMemo)(()=>(e=>{var t;if(null==e||e.saleType!==m.AVAILABLE_SALE_TYPE.FLASH_SALE||e.type!==m.SALE_TYPE.SUBSCRIPTION&&e.type!==m.SALE_TYPE.SUBSCRIPTION_AND_CERTTIFICATION)return;let n=(0,q.getFlashSaleActiveOffer)(null!=(t=e.offers)?t:[],e),a=null==n?void 0:n.percentageOff;return a?"Flash sale ".concat(a,"% off"):"Flash sale discount"})(ei),[ei]),[el,eo]=(0,o.useState)(!1),[es,eu]=(0,o.useState)(!1),ed=(0,o.useRef)(null),ec=(0,d.useFeatureIsOn)("new-welcome-to-premium-animation"),{annualLabel:ep,monthlyLabel:em,planTitle:ey}=(0,y.useMaxPlanDisplayCopy)(),eh=(0,p.isMaxSubscriptionType)(null!=(I=null==j?void 0:j.type)?I:""),eg=(0,m.isMonthlyB2cSubscriptionType)(null!=(w=null==j?void 0:j.type)?w:""),ef=(null==j?void 0:j.status)==="active",ev=(null==j?void 0:j.isTrialing)===!0,eb="paused"===j.status,eS="non_renewing"===j.status;(0,o.useEffect)(()=>()=>{ed.current&&clearTimeout(ed.current)},[]);let ex=!eb&&eg&&!eS&&O&&"annual"===J&&!es,{data:eE,isFetching:eT,
2isLoading:e_,isError:eC,refetch:eP}=(0,S.useGetUpgradeCostEstimationQuery)(void 0,{skip:!ex});(0,o.useEffect)(()=>{var e,t;O&&"annual"===J&&((null==eE||null==(e=eE.data)?void 0:e.paymentMethodExpired)===!0?Promise.resolve(D({event:"upgrade-card-expired",properties:{upgrade_type:eh?"max":"annual",source:M,reason:"calendar_expired"}})).catch(()=>{}):(null==eE||null==(t=eE.data)?void 0:t.requiresPaymentMethod)===!0&&Promise.resolve(D({event:"upgrade-payment-method-required-viewed",properties:{upgrade_type:eh?"max":"annual",source:M,reason:"missing_payment_method"}})).catch(()=>{}))},[M,null==eE||null==(A=eE.data)?void 0:A.paymentMethodExpired,null==eE||null==(U=eE.data)?void 0:U.requiresPaymentMethod,eh,O,J,D]);let eI=!eb&&eg&&!eS&&ev&&O&&"monthly"===J&&!es,{data:ew,isFetching:eA,isLoading:eU,isError:ej,refetch:eN}=(0,S.useGetTrialToMonthlyUpgradeCostEstimationQuery)(void 0,{skip:!eI}),[eM,{isLoading:ek}]=(0,S.useUpgradeToAnnualSubscriptionMutation)(),[eD,{isLoading:eL}]=(0,S.useUpgradeTrialToMonthlySubscriptionMutation)(),eF=null==eE?void 0:eE.data,eR=null==ew?void 0:ew.data,eB=ek||eL||es,eO=(0,C.computeUpgradeInvoiceSavePercent)(j.preDiscountTotal,null==eF?void 0:eF.totalDue),eG=(0,o.useCallback)(e=>L({button_text:e,page:"why-subscribe"===M?"Why Subscribe / Trial upgrade modal":"pricing"===M?"Pricing / Trial upgrade modal":"Manage Account / Subscription / Switch to annual modal",anonymousId:f.anonymousId}),[L,M]),eY=(0,o.useCallback)(function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"annual",n="annual"===t?"Annual":"Monthly";D({event:"click-subscribe-now",properties:{"clicked-on":"why-subscribe"===M?"why subscribe":"pricing"===M?"pricing":"manage account",type:"upgrade",plan:(0,b.getUserPlan)(null==F||null==(e=F.data)?void 0:e.user),SubscribePlan:eh?"MAX ".concat(n):"Premium ".concat(n)}})},[D,M,F,eh]),eV=(0,o.useCallback)(()=>{D({event:"view-popup",properties:{name:"why-subscribe"===M?"why-subscribe-trial-upgrade":"pricing"===M?"pricing-trial-upgrade":"manage-subscription-upgrade-to-annual"}})},[D,M]),ez=(0,o.useCallback)(e=>{!e&&ed.current&&(clearTimeout(ed.current),ed.current=null),e&&(eu(!1),et({state:Y.PENDING})),e||Z(null),$(e)},[]),eq=(0,o.useCallback)(()=>{(0,l.NotificationDispatch)("success","You have successfully switched to an annual subscription."),eu(!0),ez(!1),ed.current=setTimeout(()=>{eu(!1)},2e3),ec&&eo(!0)},[ez,ec]),eW=(0,o.useCallback)(()=>{"manage-account"===M&&D({event:"upgrade-to-annual-clicked"}),eY(),eV(),Z("annual"),ez(!0)},[eY,eV,ez,M,D]),eQ=(0,o.useCallback)(()=>{eY("monthly"),eV(),Z("monthly"),ez(!0)},[eY,eV,ez]);(0,o.useImperativeHandle)(t,()=>({openAnnualUpgrade:eW,openTrialUpgrade:e=>{eY(e),eV(),Z(e),ez(!0)}}),[eY,eV,ez,eW]);let eH=ev&&null!=J,eX=eH?P:"Start monthly billing",eK=eH?P:"Switch to annual subscription",e$=async()=>{eG(eX).catch(e=>{console.error("trackCTAClick failed in onUpgradeTrialToMonthlyFromModal",e)}),eY("monthly");try{await eD().unwrap(),(0,l.NotificationDispatch)("success","Your trial has been ended and your monthly subscription is now active."),ez(!1)}catch(e){(0,c.isQueryErrorWithMessage)(e)?(0,l.NotificationDispatch)("error",e.data.message.replace(/\(card_declined\)/,"")):(0,l.NotificationDispatch)("error","We couldn't start your paid subscription. Check your payment method in billing settings, then try again. If it keeps failing, contact support.")}},eJ=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if((null==eE?void 0:eE.status)==="error"||!eF)return void et({state:Y.FAILED,message:"Unable to calculate upgrade cost. Please contact support.",isEstimationError:!0});D({event:"pay-now-annual-upgrade-clicked",properties:{"Subscribe Plan":eh?"MAX":"Premium"}}),eG(eK).catch(e=>{console.error("trackCTAClick failed in onUpgradeToAnnualSubClick",e)});try{var t,n,a,i,r,l;let o=await eM(!0===e?{forceCheckout:!0}:void 0).unwrap(),s=null!=(t=null==o||null==(n=o.data)?void 0:n.paymentUrl)?t:null==o||null==(a=o.data)?void 0:a.checkoutUrl;if((null==o||null==(i=o.data)?void 0:i.requiresInvoicePayment)&&s){Promise.resolve(D({event:"upgrade-invoice-payment-redirected",properties:{upgrade_type:eh?"max":"annual",source:M,payment_page:null!=(l=o.data.paymentPage)?l:"checkout"}})).catch(()=>{}),window.location.href=s;return}if((null==o||null==(r=o.data)?void 0:r.requiresReauthorization)&&o.data.checkoutUrl){window.location.href=o.data.checkoutUrl;return}eq()}catch(t){if((0,c.getApiErrorType)(t)===u.ApiErrorType.PAYMENT_METHOD_REQUIRED){et({state:Y.PENDING}),eP().catch(()=>{});return}Promise.resolve(D({event:"upgrade-payment-failed",properties:(0,c.getUpgradePaymentFailureEventProperties)(t,M,eh?"max":"annual")})).catch(()=>{});let e=(0,c.getUpgradePaymentFailureDisplayMessage)(t);(null==j?void 0:j.isStripeV2Subscription)?et({state:Y.FAILED_STRIPE_V2,message:e}):et({state:Y.FAILED,message:e})}};if(!ef)return null;let eZ=ee.state===Y.PENDING,e0=ee.state===Y.FAILED||ee.state===Y.FAILED_STRIPE_V2,e1=(0,a.jsx)(s.ToolTip,{toolTipText:ev?"End your trial now and continue with monthly ".concat(eh?ey:"Premium","."):eO>0&&!ea?"Save ".concat(eO,"% with an annual subscription"):"Switch to annual billing",side:"top",$contentMaxWidth:"28rem",children:(0,a.jsxs)(B,{children:[(0,a.jsx)(i.StyledButton,{color:"primary",variant:"solid",disabled:eB,onClick:ev?eQ:eW,isLoading:eB,"aria-label":ev?"Upgrade Now":"Switch to annual subscription Save ".concat(eO,"%"),children:(0,a.jsx)("span",{children:ev?"Upgrade Now":"Switch to annual"})}),!ev&&null!=en&&en>
20&&!ea&&(0,a.jsxs)(G,{children:[en," month",1===en?"":"s"," free"]})]})}),e2=!es&&"annual"===J&&!eT&&!e_&&(eC||(null==eE?void 0:eE.status)==="error"||(null==eE?void 0:eE.status)==="success"&&!eF),e4=(null==eE?void 0:eE.status)==="error"&&eE.errorType===u.ApiErrorType.SUBSCRIPTION_ALREADY_ANNUAL?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(T.StyledTrialEndNotice,{children:(0,a.jsx)("span",{children:"You're already on an annual subscription. Please reload the page to see your up-to-date plan."})}),(0,a.jsx)(i.StyledButton,{color:"primary",variant:"solid",onClick:()=>window.location.reload(),children:(0,a.jsx)("span",{children:"Reload page"})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(T.StyledTrialEndNotice,{children:(0,a.jsx)("span",{children:"We could not load your upgrade estimate. Check your connection and try again."})}),(0,a.jsx)(i.StyledButton,{color:"primary",variant:"solid",onClick:()=>void eP(),children:(0,a.jsx)("span",{children:"Retry"})})]}),e6=!es&&"monthly"===J&&!eA&&!eU&&(ej||(null==ew?void 0:ew.status)==="error"||(null==ew?void 0:ew.status)==="success"&&!eR);return(0,a.jsxs)(a.Fragment,{children:[eg&&!k&&(N?e1:(0,a.jsx)(R,{children:e1})),(0,a.jsxs)(r.Modal,{open:O,onOpenChange:ez,isSmall:!0,handleCloseButtonAction:()=>{eg&&eG("Cancel").catch(e=>{console.error("trackCTAClick failed in handleClose (Cancel)",e)}),ez(!1)},children:[eZ?(()=>{if(ev&&null!=J){let e="annual"===J&&!eT&&!e2||"monthly"===J&&!eA&&!e6,t="annual"===J?"Ready to Upgrade to Annual?":"Ready to Upgrade to Monthly?",r=(0,a.jsx)("span",{children:"Your Free trial will end immediately. We will charge the payment method on your account for the amount shown below:"}),l="annual"===J?eh?ep:"Premium Annual":eh?em:"Premium Monthly",o=eH?{title:t,subtitle:r,confirmLabel:P,finalPriceOnly:!0,finalPriceLabel:l}:{},s=eH?(0,a.jsxs)(T.StyledUpgradeEstimateContainer,{children:[(0,a.jsx)(T.StyledTitle,{children:t}),(0,a.jsx)(T.StyledSubtitle,{children:r})]}):null,u=(0,a.jsx)(T.StyledTrialEndNotice,{children:"Your free trial will end immediately. We will charge the payment method on your account after your estimate loads."});return(0,a.jsxs)(a.Fragment,{children:[eH||e?null:u,"annual"===J&&eT?(0,a.jsxs)(a.Fragment,{children:[s,(0,a.jsx)(T.StyledTrialEndNotice,{children:(0,a.jsx)("span",{children:"Loading price estimateâ¦"})})]}):null,"annual"===J&&e2?(0,a.jsxs)(a.Fragment,{children:[s,e4]}):null,"annual"!==J||eT||e2?null:(0,a.jsx)(x.UpgradeEstimate,(0,n._)({b2cSubscription:j,upgradeCostEstimate:eF,onUpgrade:()=>void eJ(),isLoading:eB,paymentMethodRequiredLabel:eH?P:"Pay now",flashSaleDiscountLabel:er},o)),"monthly"===J&&eA?(0,a.jsxs)(a.Fragment,{children:[s,(0,a.jsx)(T.StyledTrialEndNotice,{children:(0,a.jsx)("span",{children:"Loading price estimateâ¦"})})]}):null,"monthly"===J&&e6?(0,a.jsxs)(a.Fragment,{children:[s,(0,a.jsx)(T.StyledTrialEndNotice,{children:(0,a.jsx)("span",{children:"We could not load your upgrade estimate. Check your connection and try again."})}),(0,a.jsx)(i.StyledButton,{color:"primary",variant:"solid",onClick:()=>void eN(),children:(0,a.jsx)("span",{children:"Retry"})})]}):null,"monthly"!==J||eA||e6?null:(0,a.jsx)(E.TrialMonthlyUpgradeEstimate,(0,n._)({b2cSubscription:j,upgradeCostEstimate:eR,onConfirm:e$,isLoading:eB},o))]})}return ev||"annual"!==J?null:eT?(0,a.jsx)(T.StyledTrialEndNotice,{children:(0,a.jsx)("span",{children:"Loading price estimateâ¦"})}):e2?e4:(0,a.jsx)(x.UpgradeEstimate,{b2cSubscription:j,upgradeCostEstimate:eF,onUpgrade:()=>void eJ(),isLoading:eB,paymentMethodRequiredLabel:"Pay now",monthsFree:null!=en?en:void 0,flashSaleDiscountLabel:er})})():null,e0?(0,a.jsx)(_.UpgradeFailedStripeV2,{onTryAgain:()=>{"monthly"===J?e$():eJ()},onTryAnotherPaymentMethod:()=>{eG("Try another payment method").catch(e=>{console.error("trackCTAClick failed in handleTryAnotherPaymentMethod",e)}),eJ(!0)},isLoading:eB,message:ee.message}):null]}),el&&(0,a.jsx)(v.WelcomeToPremiumAnimationDialog,{dismiss:()=>eo(!1),primaryText:(0,a.jsxs)(a.Fragment,{children:["Congratulations! You've successfully switched to an ",(0,a.jsx)("span",{children:"annual subscription"}),"."]}),secondaryText:"You've been billed for the full year at a discounted rate, with your current payments credited towards the total. We'll email you the receipt!",buttonLabel:"Let's go!"})]})});$.displayName="UpgradeToAnnualModal",e.s(["UpgradeToAnnualModal",0,$],908155),e.s([],261085)},934276,e=>{"use strict";e.i(655565),e.s([])},838939,e=>{"use strict";var t=e.i(92571);e.i(694876);var n=e.i(786714),a=e.i(632640);e.i(620147);var i=e.i(752630);e.i(685090);var r=e.i(162666),l=e.i(431711);
2e.s(["TrialMonthlyUpgradeEstimate",0,e=>{var o,s;let{upgradeCostEstimate:u,b2cSubscription:{currencySymbol:d,currencyCode:c},onConfirm:p,isLoading:m,belowCostBreakdown:y,finalPriceOnly:h=!1,finalPriceLabel:g="Premium Monthly",title:f,subtitle:v,confirmLabel:b}=e;if(!u)return null;let S=null!=v?v:(0,t.jsx)("span",{children:"Your first billing period starts today. Below is what we expect to charge right now."});return(0,t.jsxs)(l.StyledUpgradeEstimateContainer,{children:[(0,t.jsx)(l.StyledMascotImage,{src:a.default,alt:"Echo celebrating Premium subscription."}),(0,t.jsx)(l.StyledTitle,{children:null!=f?f:"Continue with monthly Premium"}),(0,t.jsx)(l.StyledSubtitle,{children:S}),h?(0,t.jsxs)(l.StyledSimpleFinalPrice,{"data-testid":"trial-monthly-upgrade-simple-final-price",children:[(0,t.jsxs)(l.StyledSimpleFinalPriceLabel,{"data-testid":"trial-monthly-upgrade-simple-final-price-label",children:[g,":"]}),(0,t.jsx)(l.StyledSimpleFinalPriceAmount,{"data-testid":"trial-monthly-upgrade-simple-final-price-amount",children:"".concat(d).concat(u.totalDue)})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l.StyledUpgradeCostBreakdown,{children:[(0,t.jsx)(r.UpgradeSubscriptionCostItem,{label:"Monthly subscription",amount:"".concat(d).concat(u.subscriptionCost)}),["usd","cad"].includes((c||"").toLowerCase())&&(null==(o=u.taxes)?void 0:o.map(e=>(0,t.jsx)(r.UpgradeSubscriptionCostItem,{label:(null==e?void 0:e.description)||"Applicable tax calculated based on your location",amount:"".concat(d).concat(e.amount)},e.name))),!Number.isNaN(Number.parseFloat(u.creditsApplied))&&Number.parseFloat(u.creditsApplied)>0&&(0,t.jsx)(r.UpgradeSubscriptionCostItem,{label:"Prorated credits from last monthly payment",amount:"".concat(d).concat(u.creditsApplied),tooltip:i.ProratedCreditsTooltip,isNegative:!0}),null==(s=u.discounts)?void 0:s.map(e=>{var n;return(0,t.jsx)(r.UpgradeSubscriptionCostItem,{label:(null==e?void 0:e.description)||"Discount",amount:"".concat(d).concat(e.amount),isNegative:!0},"".concat(null!=(n=null==e?void 0:e.description)?n:"discount","-").concat(e.amount))})]}),(0,t.jsxs)(l.StyledUpgradeCostBreakdownTotal,{children:[(0,t.jsx)(l.StyledTotalDueLabel,{"data-testid":"trial-monthly-upgrade-total-due-label",children:"Total due today"}),(0,t.jsx)(l.StyledUpgradeCostTotalDueAmount,{"data-testid":"trial-monthly-upgrade-total-due-amount",children:"".concat(d).concat(u.totalDue)})]})]}),y?(0,t.jsx)(l.StyledBelowCostBreakdownSlot,{children:y}):null,(0,t.jsx)(l.StyledActions,{children:(0,t.jsx)(n.Button,{color:"primary",variant:"solid",onClick:p,isLoading:m,isDisabled:m,children:(0,t.jsx)("span",{children:null!=b?b:"Start monthly billing"})})})]})}])},994414,e=>{"use strict";e.i(933465),e.s([])},917418,e=>{"use strict";var t,n=e.i(320778),a=e.i(92571);e.i(694876);var i=e.i(661784);e.i(640616);var r=e.i(479398);e.i(710273);var l=e.i(983739),o=e.i(521275),s=e.i(122427),u=e.i(319266),d=e.i(694790),c=e.i(52094),p=e.i(301366),m=e.i(529249),y=e.i(132244);e.i(934276);var h=e.i(655565),g=e.i(431711);e.i(994414);var f=e.i(933465);e.i(225583);var v=e.i(65726),b=e.i(98864),S=e.i(504405),x=e.i(540626);function E(){let e=(0,S._)(["\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n padding-top: 1.5rem;\n"]);return E=function(){return e},e}function T(){let e=(0,S._)(["\n width: 100px;\n height: auto;\n margin-bottom: 1.6rem;\n"]);return T=function(){return e},e}function _(){let e=(0,S._)(["\n font-size: ",";\n font-weight: ",";\n color: ",";\n margin: 0 0 1.2rem;\n"]);return _=function(){return e},e}function C(){let e=(0,S._)(["\n font-size: ",";\n line-height: ",";\n color: ",";\n margin: 1rem 0;\n"]);return C=function(){return e},e}let P=x.default.div.withConfig({displayName:"upgrade-temporarily-unavailable.styles__StyledUpgradeTemporarilyUnavailableContainer",componentId:"sc-a31c26e4-0"})(E()),I=x.default.img.withConfig({displayName:"upgrade-temporarily-unavailable.styles__StyledMascotImage",componentId:"sc-a31c26e4-1"})(T()),w=x.default.h2.withConfig({displayName:"upgrade-temporarily-unavailable.styles__StyledTitle",componentId:"sc-a31c26e4-2"})(_(),e=>{let{theme:t}=e;return t.fonts.sizes.large},e=>{let{theme:t}=e;return t.fonts.weight.semiBold},e=>{let{theme:t}=e;return t.colors.text.main}),A=x.default.p.withConfig({displayName:"upgrade-temporarily-unavailable.styles__StyledDescription",componentId:"sc-a31c26e4-3"})(C(),e=>{let{theme:t}=e;return t.fonts.sizes.default},e=>{let{theme:t}=e;return t.fonts.lineHeight.default},e=>{let{theme:t}=e;return t.colors.text.lighter}),U=()=>(0,a.jsxs)(P,{children:[(0,a.jsx)(I,{src:b.default,alt:"Sad Echo mascot."}),(0,a.jsx)(w,{children:"You can't upgrade right now as we're working through an issue."}),(0,a.jsx)(A,{children:"We expect to have this fixed soon and will let you know as soon as upgrades are available again."})]});var j=((t={}
2).PENDING="PENDING",t.FAILED_STRIPE_V2="FAILED_STRIPE_V2",t),N=e.i(531917),M=e.i(786714);function k(){let e=(0,S._)(["\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n padding-top: 1.5rem;\n"]);return k=function(){return e},e}function D(){let e=(0,S._)(["\n width: 100px;\n height: auto;\n margin-bottom: 1.6rem;\n"]);return D=function(){return e},e}function L(){let e=(0,S._)(["\n font-size: ",";\n font-weight: ",";\n color: ",";\n margin: 0 0 1.2rem;\n"]);return L=function(){return e},e}function F(){let e=(0,S._)(["\n font-size: ",";\n line-height: ",";\n color: ",";\n margin: 1rem 0;\n"]);return F=function(){return e},e}function R(){let e=(0,S._)(["\n display: flex;\n gap: 1.2rem;\n justify-content: center;\n margin: 2rem 0 1rem;\n"]);return R=function(){return e},e}function B(){let e=(0,S._)(["\n min-width: 100px;\n"]);return B=function(){return e},e}function O(){let e=(0,S._)(["\n min-width: 180px;\n"]);return O=function(){return e},e}let G=x.default.div.withConfig({displayName:"upi-upgrade-unavailable.styles__StyledUpiUpgradeUnavailableContainer",componentId:"sc-e431f250-0"})(k()),Y=x.default.img.withConfig({displayName:"upi-upgrade-unavailable.styles__StyledMascotImage",componentId:"sc-e431f250-1"})(D()),V=x.default.h2.withConfig({displayName:"upi-upgrade-unavailable.styles__StyledTitle",componentId:"sc-e431f250-2"})(L(),e=>{let{theme:t}=e;return t.fonts.sizes.large},e=>{let{theme:t}=e;return t.fonts.weight.semiBold},e=>{let{theme:t}=e;return t.colors.text.main}),z=x.default.p.withConfig({displayName:"upi-upgrade-unavailable.styles__StyledDescription",componentId:"sc-e431f250-3"})(F(),e=>{let{theme:t}=e;return t.fonts.sizes.default},e=>{let{theme:t}=e;return t.fonts.lineHeight.default},e=>{let{theme:t}=e;return t.colors.text.lighter}),q=x.default.div.withConfig({displayName:"upi-upgrade-unavailable.styles__StyledButtonContainer",componentId:"sc-e431f250-4"})(R()),W=(0,x.default)(M.Button).withConfig({displayName:"upi-upgrade-unavailable.styles__StyledCancelButton",componentId:"sc-e431f250-5"})(B()),Q=(0,x.default)(M.Button).withConfig({displayName:"upi-upgrade-unavailable.styles__StyledUpdatePaymentButton",componentId:"sc-e431f250-6"})(O()),H=e=>{let{onCancel:t}=e,{openStripeCustomerPortal:n,isLoading:i}=(0,N.useStripeCustomerPortal)();return(0,a.jsxs)(G,{children:[(0,a.jsx)(Y,{src:b.default,alt:"Sad Echo mascot."}),(0,a.jsx)(V,{children:"This upgrade isn't available with UPI AutoPay"}),(0,a.jsx)(z,{children:"UPI AutoPay can't change your billing period during an upgrade. You can upgrade to MAX on your current billing period, or switch to a card payment method first â we'll take you to our secure billing portal to update it."}),(0,a.jsxs)(q,{children:[(0,a.jsx)(W,{color:"secondary",variant:"outlined",onClick:t,children:"Cancel"}),(0,a.jsx)(Q,{color:"primary",variant:"solid",isLoading:i,isDisabled:i,onClick:()=>void n({}),children:"Update Payment Method"})]})]})},X=(e,t)=>{switch(e){case"why-subscribe":return"Why Subscribe / ".concat(t);case"manage-account":return"Manage Account / ".concat(t);default:return"Pricing / ".concat(t)}},K=(0,o.forwardRef)((e,t)=>{var b,S;let{b2cSubscription:x,targetInterval:E,analyticsSource:T="pricing",onUpgradeSuccess:_}=e,{maxUpgradeConfirmCtaLabel:C,upgradedSuccessToast:P,analyticsMaxUpgradeModalSuffix:I}=(0,d.useMaxPlanDisplayCopy)(),[w]=(0,p.useTrackEventMutation)(),[A]=(0,p.useTrackCTAClickMutation)(),{data:N}=(0,c.useGetUserQuery)(),[M,k]=(0,o.useState)(!1),[D,L]=(0,o.useState)({state:j.PENDING}),{data:F,isFetching:R,isError:B,refetch:O}=(0,y.useGetUpgradeToMaxCostEstimationQuery)({interval:E},{skip:!M}),[G,{isLoading:Y}]=(0,y.useUpgradeToMaxSubscriptionMutation)(),V=null==F?void 0:F.data,z=(0,o.useCallback)(()=>{var e;w({event:"click-subscribe-now",properties:{"clicked-on":(e=>{switch(e){case"why-subscribe":return"why subscribe";case"manage-account":return"manage account";default:return"pricing"}})(T),type:"upgrade",plan:(0,v.getUserPlan)(null==N||null==(e=N.data)?void 0:e.user),SubscribePlan:"yearly"===E?"MAX Annual":"MAX Monthly"}})},[w,T,N,E]),q=(0,o.useCallback)(()=>{w({event:"view-popup",properties:{name:"premium-plus-upgrade-modal"}})},[w]),W=(0,o.useCallback)(e=>{k(e),e&&L({state:j.PENDING})},[]),Q=()=>{A({button_text:"Cancel",page:X(T,I),anonymousId:m.anonymousId}).catch(e=>{console.error("trackCTAClick failed in handleClose (Cancel)",e)}),W(!1)},K=(0,o.useCallback)(()=>{z(),q(),W(!0)},[z,q,W]);(0,o.useImperativeHandle)(t,()=>({open:K}),[K]);let $=!R&&(B||(null==F?void 0:F.status)==="error"||(null==F?void 0:F.status)==="success"&&!V),J=$&&(null==F?void 0:F.status)==="error"&&F.errorType===s.ApiErrorType.UPGRADE_TEMPORARILY_UNAVAILABLE;(0,o.useEffect)(()=>{var e;M&&J&&w({event:"max-upgrade-temporarily-unavailable-viewed",properties:{source:T,plan:(0,v.getUserPlan)(null==N||null==(e=N.data)?void 0:e.user),reason:"stacked_subscription",errorType:s.ApiErrorType.UPGRADE_TEMPORARILY_UNAVAILABLE}})},[M,J,w,T,N]),(0,o.useEffect)(()=>{var e,t;M&&((null==F||null==(e=F.data)?void 0:e.paymentMethodExpired)===!0?Promise.resolve(w({event:"upgrade-card-expired",properties:{upgrade_type:"max",source:T,reason:"calendar_expired"}})).catch(()=>{}):(null==F||null==(t=F.data)?void 0:t.requiresPaymentMethod)===!0&&Promise.resolve(w({event:"upgrade-payment-method-required-viewed",properties:{upgrade_type:"max",source:T,reason:"missing_payment_method"}})).catch(()=>{}))},[T,null==F||null==(b=F.data)?void 0:b.paymentMethodExpired,null==F||null==(S=F.data)?void 0:S.requiresPaymentMethod,M,w]);let Z=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if((null==F?void 0:F.status)!=="error"&&V){A({button_text:C,page:X(T,I),anonymousId:m.anonymousId}).catch(e=>{console.error("trackCTAClick failed in onUpgradeClick",e)}),z();try{var t,a,i,r,o,d;let s=await G((0,n._)({interval:E},!0===e?{forceCheckout:!0}:{})).unwrap(),u=null!=(t=null==s||null==(a=s.data)?void 0:a.paymentUrl)?t:null==s||null==(i=s.data)?void 0:i.checkoutUrl;if((null==s||null==(r=s.data)?void 0:r.requiresInvoicePayment)&&u){Promise.resolve(w({event:"upgrade-invoice-payment-redirected",properties:{upgrade_type:"max",source:T,payment_page:null!=(d=s.data.paymentPage)?d:"checkout"}})).catch(()=>{}),window.location.href=u;return}if((null==s||null==(o=s.data)?void 0:o.requiresReauthorization)&&s.data.checkoutUrl){window.location.href=s.data.checkoutUrl;return}await (null==_?void 0:_()),(0,l.NotificationDispatch)("success",P),W(!1)}catch(t){if((0,u.getApiErrorType)(t)===s.ApiErrorType.PAYMENT_METHOD_REQUIRED){L({state:j.PENDING}),O().catch(()=>{});return}Promise.resolve(w({event:"upgrade-payment-failed",properties:(0,u.getUpgradePaymentFailureEventProperties)(t,T,"max")}
2)).catch(()=>{});let e=(0,u.getUpgradePaymentFailureDisplayMessage)(t);L({state:j.FAILED_STRIPE_V2,message:e})}}};return(0,a.jsxs)(r.Modal,{open:M,onOpenChange:W,isSmall:!0,handleCloseButtonAction:Q,children:[D.state===j.PENDING?(()=>{if(R)return(0,a.jsx)(g.StyledTrialEndNotice,{children:(0,a.jsx)("span",{children:"Loading price estimateâ¦"})});if($){if(J)return(0,a.jsx)(U,{});if((null==F?void 0:F.status)==="error"&&F.errorType===s.ApiErrorType.UPI_NOT_SUPPORTED)return(0,a.jsx)(H,{onCancel:Q});let e=(null==F?void 0:F.status)==="error"&&F.errorType===s.ApiErrorType.PRICING_UNAVAILABLE;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.StyledTrialEndNotice,{children:(0,a.jsx)("span",{children:e?"You are currently on a legacy TryHackMe plan. To upgrade to Max, please contact support.":"We could not load your upgrade estimate. Check your connection and try again."})}),!e&&(0,a.jsx)(i.StyledButton,{color:"primary",variant:"solid",onClick:()=>void O(),children:(0,a.jsx)("span",{children:"Retry"})})]})}return(0,a.jsx)(h.UpgradeEstimate,{b2cSubscription:x,upgradeCostEstimate:V,onUpgrade:()=>void Z(),isLoading:Y,maxUpgrade:!0})})():null,D.state===j.FAILED_STRIPE_V2?(0,a.jsx)(f.UpgradeFailedStripeV2,{onTryAgain:()=>{Z()},onTryAnotherPaymentMethod:()=>{A({button_text:"Try another payment method",page:X(T,I),anonymousId:m.anonymousId}).catch(e=>{console.error("trackCTAClick failed in handleTryAnotherPaymentMethod",e)}),Z(!0)},isLoading:Y,message:D.message}):null]})});K.displayName="UpgradeToMaxModal",e.s(["UpgradeToMaxModal",0,K],917418)}]); 3 4//# debugId=dbf9ebd3-3ee6-195f-c34c-6582ad80c644
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.