1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7106],{77106:(r,s,e)=>{e.d(s,{useSubscriptionStore:()=>c});var i=e(89546),t=e(6945),n=e(41916),o=e(96504);let c=(0,i.v)()((0,t.lt)((0,n.D)((r,s)=>({subscription:null,creditHistory:[],isLoading:!1,isRefreshing:!1,error:null,fetchSubscription:async()=>{if(!s().isLoading){r(r=>{r.isLoading=!0,r.error=null});try{let s=await o.k.getSubscription();r(r=>{r.subscription=s,r.creditHistory=s.creditHistory||[],r.isLoading=!1})}catch(s){console.error("Failed to fetch subscription:",s),r(r=>{r.error=s instanceof Error?s.message:"Failed to fetch subscription",r.isLoading=!1})}}},refreshSubscription:async()=>{if(!s().isRefreshing){r(r=>{r.isRefreshing=!0,r.error=null});try{let s=await o.k.getSubscription();r(r=>{r.subscription=s,r.creditHistory=s.creditHistory||[],r.isRefreshing=!1})}catch(s){console.error("Failed to refresh subscription:",s),r(r=>{r.error=s instanceof Error?s.message:"Failed to refresh subscription",r.isRefreshing=!1})}}},updateCredits:s=>{r(r=>{r.subscription&&(r.subscription.mockTestCredits=s)})},addCreditTransaction:s=>{r(r=>{r.creditHistory.unshift(s),r.subscription&&(r.subscription.mockTestCredits=s.balance)})},clearError:()=>{r(r=>{r.error=null})},hasUnlimitedAccess:()=>{let{subscription:r}=s();return!!r&&["PREMIUM","PREMIUM_PLUS"].includes(r.planType)},getPurchasedTestIds:()=>{let{creditHistory:r}=s();return r.filter(r=>r.mockTestId).map(r=>r.mockTestId).filter((r,s,e)=>e.indexOf(r)===s)},canPurchaseTest:(r,e)=>{let{subscription:i}=s();return!(!i||s().getPurchasedTestIds().includes(r))&&i.mockTestCredits>=e},reset:()=>{r(r=>{r.subscription=null,r.creditHistory=[],r.isLoading=!1,r.isRefreshing=!1,r.error=null})}})),{name:"subscription-store"}))}}]);
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.