1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6d9e9283-0e02-4591-b9d3-2b6fb8883fd8",e._sentryDebugIdIdentifier="sentry-dbid-6d9e9283-0e02-4591-b9d3-2b6fb8883fd8")}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[716],{20716:(e,t,n)=>{n.d(t,{hG:()=>m,Ln:()=>h,vi:()=>N,Uz:()=>C,l8:()=>Y});var l=n(14232),r=n(37004),o=n(89099),u=n(40097),a=n(74359),i=n(42149),s=n(38248),E=n(94937);let d=()=>{let e=window.sessionStorage.getItem(E.ok.PAYMENT_REPLENISH_DATA)||(0,s.getCookie)(E.eu.PAYMENT_REPLENISH_DATA);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},R=e=>{var t,n;let l=null!=(n=null==e||null==(t=e.split("?"))?void 0:t[0].split("/").filter(Boolean))?n:[],r=l.indexOf("payment");return -1!==r&&"token"===l[r+2]&&!!l[r+1]&&!!l[r+3]},c=()=>{let e=window.sessionStorage.getItem(E.ok.PAYMENT_TOKEN_EXPIRES_AT);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},T=e=>{let{paymentToken:t}=e,n=1e3*E.F_.PURCHASE_TOKEN_LIFE_TIME,l=c();return l&&l.token===t?Math.max(l.expiresAt-Date.now(),1e3):n};var _=n(88314),y=n(74222),O=n(66002),P=n(71374),v=n(82761),A=n(78298),S=n(28023),f=n(94574);let w={purchasePrototype:e=>{let{token:t}=e;return[E.es.PURCHASE_PROTOTYPE,"token: ".concat(t)]},refreshToken:e=>{let{token:t}=e;return[E.es.PURCHASE_PROTOTYPE_REFRESH_TOKEN,"token: ".concat(t)]}},g=new Map,p=e=>{var t;let{paymentToken:n}=e,l=(0,o.useRouter)(),{isWebView:a,webViewSessionId:s,webViewUserHash:c,platformDevice:T,callBackUrlAlternative:O}=(0,P.r)(),{mutateAsync:v}=(0,A.W)(),p=(0,r.d4)(e=>e.locale),h=(0,r.d4)(e=>e.user),C=(0,i._8)(),N=null==h||null==(t=h.profile)?void 0:t.id,Y=d(),k=w.refreshToken({token:n});return(0,u.n)({mutationKey:k,mutationFn:async()=>{if(!n)return{newToken:void 0,requestContext:C,purchasePrototypeParams:Y};let e=g.get(n);if(e)return e;let t=(async()=>{let e=null;return Y&&(e=await (0,f.Xk)({purchasePrototypeParams:Y,requestContext:C})),{newToken:null==e?void 0:e.token,requestContext:C,purchasePrototypeParams:Y}})();g.set(n,t);try{return await t}finally{g.delete(n)}},onSuccess:async e=>{let{newToken:t,requestContext:r,purchasePrototypeParams:o}=e;if(!t)return;m({token:t});let u=null==l?void 0:l.asPath;if(u){let e=u;n&&(e=e.replace(n,t));let r=p.isLangCustom?"":"/".concat(p.currentLang),o=e.startsWith("/")?e:"/".concat(e),a=r&&!o.startsWith(r)?"".concat(r).concat(o):o;await l.replace(a,void 0,{shallow:!0})}if(R(null==l?void 0:l.asPath)){var i,d,P;try{let e=await (0,f.HX)({token:t,requestContext:r}),n=(null==l||null==(i=l.query)?void 0:i.pageName)||"",o=null==e?void 0:e.find(e=>e.slug===n);(null==o?void 0:o.id)&&await v({token:t,paymentSystem:o})}catch(e){_.z(y.A.DEFAULT_ERROR),await (0,S.z)({requestContext:r,data:{logType:null===E.$9||void 0===E.$9||null==(d=E.$9.TYPE)?void 0:d.CLIENT,category:E.wD.PAYMENT_SYSTEMS_LIST_ERROR.CATEGORY,reason:E.wD.PAYMENT_SYSTEMS_LIST_ERROR.REASON.AUTO_REFRESH_TOKEN_FLOW_ERROR,url:null==e||null==(P=e.config)?void 0:P.url,fullErrorObj:e,isWebView:null==a?void 0:a.toString(),purchasePrototypeParams:o,webViewUserHash:c,webViewSessionId:s,platformDevice:T,userId:N}}),a&&O&&(window.location.href=O)}}},onError:async e=>{var t,n;_.z(y.A.DEFAULT_ERROR),await (0,S.z)({requestContext:C,data:{logType:null===E.$9||void 0===E.$9||null==(t=E.$9.TYPE)?void 0:t.CLIENT,category:E.wD.PURCHASE_PROTOTYPE_ERROR.CATEGORY,reason:E.wD.PURCHASE_PROTOTYPE_ERROR.REASON.AUTO_REFRESH_TOKEN_FLOW_ERROR,fullErrorObj:e,url:null==e||null==(n=e.config)?void 0:n.url,isWebView:a.toString(),purchasePrototypeParams:Y,webViewUserHash:c,webViewSessionId:s,platformDevice:T,userId:N}}),a&&O&&(window.location.href=O)}})},m=e=>{let{token:t}=e,n=c();if((null==n?void 0:n.token)===t)return;let l={token:t,expiresAt:Date.now()+1e3*E.F_.PURCHASE_TOKEN_LIFE_TIME};window.sessionStorage.setItem(E.ok.PAYMENT_TOKEN_EXPIRES_AT,JSON.stringify(l))},h=e=>{let{token:t}=e,n=(0,r.d4)(e=>e.user),[o,u]=(0,l.useState)(t);(0,l.useEffect)(()=>{u(t)},[t]);let a=p({paymentToken:o});return(0,l.useEffect)(()=>
1{if(!(null==n?void 0:n.isAuthenticated)||!o||a.isPending)return;m({token:o});let e=T({paymentToken:o}),t=window.setTimeout(()=>{a.mutate(void 0,{onSuccess:e=>{let{newToken:t}=e;t&&u(t)}})},e);return()=>window.clearTimeout(t)},[null==n?void 0:n.isAuthenticated,o,a.isPending]),a},C=()=>{var e;let{isWebView:t,webViewUserHash:n,webViewSessionId:l,platformDevice:o,callBackUrlAlternative:a}=(0,P.r)(),s=(0,r.d4)(e=>e.user),d=(0,i._8)(),R=null==s||null==(e=s.profile)?void 0:e.id;return(0,u.n)({mutationFn:async e=>{let{purchasePrototypeParams:t}=e;return(0,f.Xk)({purchasePrototypeParams:t,requestContext:d})},onError:(e,r)=>{var u,i,s;let{purchasePrototypeParams:c}=r;_.z((null==e?void 0:e.message)||(null==e||null==(u=e.data)?void 0:u.message)||y.A.DEFAULT_ERROR);let T={logType:null===E.$9||void 0===E.$9||null==(i=E.$9.TYPE)?void 0:i.CLIENT,category:E.wD.PURCHASE_PROTOTYPE_ERROR.CATEGORY,reason:E.wD.PURCHASE_PROTOTYPE_ERROR.REASON.CREATE_PURCHASE_PROTOTYPE_ERROR,url:null==e||null==(s=e.config)?void 0:s.url,fullErrorObj:e,purchasePrototypeParams:c,isWebView:t.toString(),webViewUserHash:n,webViewSessionId:l,platformDevice:o,userId:R};(0,S.z)({requestContext:d,data:T}),t&&a&&(window.location.href=a)}})},N=()=>{let e=(0,o.useRouter)(),{redirectToUrl:t}=(0,v.A)(),n=C();return{...n,createPurchasePrototypeWithRedirect:l=>{n.mutate(l,{onSuccess:n=>{var l,r,o,u;let a=(null==e||null==(l=e.query)?void 0:l.paymentType)?"&paymentType=".concat(null==e||null==(r=e.query)?void 0:r.paymentType):"",i=(null==e||null==(o=e.query)?void 0:o.budget)?"&budget=".concat(null==e||null==(u=e.query)?void 0:u.budget):"";t({path:"".concat(E.W_.PAYMENT_SELECT_REPLENISHMENT_WALLET,"?token=").concat(n.token).concat(a).concat(i)})}})}}},Y=e=>{var t;let{token:n,enabled:l=!0}=e,{isWebView:o,webViewSessionId:u,webViewUserHash:s,platformDevice:R,callBackUrlAlternative:c}=(0,P.r)(),T=(0,r.d4)(e=>e.user),v=d(),{mutateAsync:A}=p({paymentToken:n}),g=(0,i._8)(),m=w.purchasePrototype({token:n}),h=null==T||null==(t=T.profile)?void 0:t.id;return(0,a.I)({queryKey:m,queryFn:async()=>{try{return await (0,f.UQ)({token:n,requestContext:g})}catch(r){var e,t;if((null==r?void 0:r.status)===404&&v)return await A(),null;_.z(y.A.DEFAULT_ERROR);let l={logType:null===E.$9||void 0===E.$9||null==(e=E.$9.TYPE)?void 0:e.CLIENT,category:E.wD.PURCHASE_PROTOTYPE_ERROR.CATEGORY,reason:E.wD.PURCHASE_PROTOTYPE_ERROR.REASON.DEFAULT_FETCH_ERROR,fullErrorObj:r,url:null==r||null==(t=r.config)?void 0:t.url,isWebView:o.toString(),token:n,userId:h,webViewSessionId:u,webViewUserHash:s,platformDevice:R};if((0,O.A)({data:l,requestContext:g})||await (0,S.z)({requestContext:g,data:l}),o&&c)return window.location.href=c,null;throw r}},staleTime:0,gcTime:0,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,retry:!1,enabled:(null==T?void 0:T.isAuthenticated)&&!!n&&l})}},39806:(e,t,n)=>{n.d(t,{P:()=>E,Y:()=>d});var l=n(74359),r=n(37004),o=n(94937),u=n(71374),a=n(42149),i=n(94574),s=n(28023);let E={paymentSystemsPurchaseParams:e=>{let{token:t}=e;return[o.es.PAYMENT_SYSTEM_PURCHASE_PARAMS,"token: ".concat(t)]}},d=e=>{var t;let{token:n,enabled:d=!0}=e,{isWebView:R,webViewSessionId:c,webViewUserHash:T}=(0,u.r)(),_=(0,r.d4)(e=>e.user),y=(0,a._8)(),O=null==_||null==(t=_.profile)?void 0:t.id,P=E.paymentSystemsPurchaseParams({token:n});return(0,l.I)({queryKey:P,queryFn:async()=>{try{return await (0,i.Q8)({token:n,requestContext:y})}catch(l){var e,t;let n={logType:null===o.$9||void 0===o.$9||null==(e=o.$9.TYPE)?void 0:e.CLIENT,category:o.wD.PURCHASE_PARAMS_ERROR.CATEGORY,url:null==l||null==(t=l.config)?void 0:t.url,responseData:null==l?void 0:l.data,status:null==l?void 0:l.status,message:null==l?void 0:l.statusText,isWebView:null==R?void 0:R.toString(),userId:O,webViewSessionId:c,webViewUserHash:T};throw await (0,s.z)({requestContext:y,data:n}),l}},staleTime:0,gcTime:0,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,retry:!1,enabled:(null==_?void 0:_.isAuthenticated)&&!!n&&d})}},78298:(e,t,n)=>{n.d(t,{W:()=>T});var l=n(37004),r=n(67768),o=n(40097),u=n(39806),a=n(42149),i=n(88314),s=n(74222),E=n(71374),d=n(94937),R=n(94574),c=n(28023);let T=()=>{var e;let{isWebView:t,webViewUserHash:n,webViewSessionId:T,platformDevice:_}=(0,E.r)(),y=(0,r.jE)(),O=(0,l.d4)(e=>e.user),P=(0,a._8)(),v=null==O||null==(e=O.profile)?void 0:e.id;return(0,o.n)({mutationFn:async e=>{let{token:t,paymentSystem:n}=e;return(0,R.Qq)({token:t,paymentSystemId:n.id,paymentMethodId:n.payment_method_id,requestContext:P})},onSuccess:(e,t)=>{null==y||y.invalidateQueries({queryKey:u.P.paymentSystemsPurchaseParams({token:null==t?void 0:t.token})})},onError:(e,l)=>{var r,o;i.z(s.A.OCCURRED_ERROR);let u={logType:null===d.$9||void 0===d.$9||null==(r=d.$9.TYPE)?void 0:r.CLIENT,category:d.wD.PURCHASE_PROTOTYPE_ER
1ROR.CATEGORY,reason:d.wD.PURCHASE_PROTOTYPE_ERROR.REASON.PATCH_PAYMENT_SYSTEM_ERROR,fullErrorObj:e,url:null==e||null==(o=e.config)?void 0:o.url,token:l.token,paymentSystemId:l.paymentSystem.id,slug:l.paymentSystem.slug,isWebView:t.toString(),webViewUserHash:n,webViewSessionId:T,platformDevice:_,userId:v};(0,c.z)({requestContext:P,data:u})}})}}}]); 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0a0be459-9173-5447-aebc-c2b0b322eab4")}catch(e){}}(); 3//# debugId=0a0be459-9173-5447-aebc-c2b0b322eab4
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.