1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="78f352e7-a3d7-4e1c-abd9-70965d82b325",e._sentryDebugIdIdentifier="sentry-dbid-78f352e7-a3d7-4e1c-abd9-70965d82b325")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2839],{62839:function(e,t,n){n.d(t,{I:function(){return isExpectPaymentStatus},c:function(){return PaymentResult}});var r=n(47886),u=n(77461),c=n(64170),i=n(86206),a=n(25887),o=n(37403),l=n(80572),s=n(56602),f=n(39036),d=n(27719),p=n(1597),m=n(44194),v=n(11461),h=n(62940),y=["PAYMENT_STATUS_SUCCEEDED","PAYMENT_STATUS_WAITING_DO_PAYMENT","PAYMENT_STATUS_FAILED"],isExpectPaymentStatus=function(e){return y.indexOf(e)>=0},E={name:"844x3e",styles:"width:40%;height:300px;margin-left:auto;margin-right:auto"},PaymentResult=function(e){var t,n=e.render,s=(0,p.useRouter)(),f=s.query[o.U_.PaymentId],d=(0,c.xl)(),v=(0,r.V)();"string"==typeof f?t=f:"object"==typeof f&&(t=f[0]);var y=(0,u.V7)(t),T=y.data,k=y.error,w=y.mutate,x=T||{},g=x.payment,b=x.gatewayErrorReason;if((0,m.useEffect)(function(){if((null==g?void 0:g.status)==="PAYMENT_STATUS_WAITING_DO_PAYMENT")return(0,i.q)(w,400,1500);(null==g?void 0:g.status)==="PAYMENT_STATUS_SUCCEEDED"&&d()},[null==g?void 0:g.status,w]),(0,m.useEffect)(function(){s.isReady&&!f&&s.push((0,o.kr)())},[!f,s.isReady]),!g||!f){var I=(0,a.errToGrpcError)(k);return(null==I?void 0:I.message)==="unauthenticated"?(0,h.tZ)(LoginRequiredScreen,{}):(null==I?void 0:I.message)==="document not found"?(0,h.tZ)(AccountVerificationError,{}):(0,h.tZ)(h.HY,{children:(0,h.tZ)(l.Z,{css:E})})}return g.status&&isExpectPaymentStatus(g.status)?(k&&v(k),(0,h.tZ)(h.HY,{children:n(g,b)})):(s.push((0,o.kr)()),null)},LoginRequiredScreen=function(){var e=(0,v.$G)().t,t=(0,p.useRouter)();return(0,h.BX)(s.Z,{className:"flex flex-col items-center justify-center w-full h-96 gap-y-8",children:[(0,h.tZ)(f.Z,{variant:"h5",children:e("checkout-page.login-instruction")}),(0,h.tZ)(d.Z,{variant:"contained",fullWidth:!0,className:"tablet:max-w-80",onClick:function(){return t.push((0,o.Qv)())},children:e("common.login")})]})},AccountVerificationError=function(){var e=(0,v.$G)().t;return(0,h.BX)(s.Z,{className:"flex flex-col items-center justify-center w-full h-96 gap-y-8",children:[(0,h.tZ)(f.Z,{variant:"h5",className:"text-center",children:e("checkout-page.wrong-account-detail")}),(0,h.tZ)("div",{className:"flex flex-col items-center justify-center",children:(0,h.tZ)(v.cC,{i18nKey:"checkout-page.wrong-account",components:{0:(0,h.tZ)(f.Z,{variant:"h5",className:"text-center"}),1:(0,h.tZ)(f.Z,{variant:"body1",className:"text-center"})}})})]})}},61910:function(e,t,n){n.d(t,{D:function(){return useTurnstile}});var r=n(33461),u=n(44194),rejectPendingExecute=function(e,t,n){t.current&&t.current(Error(n)),e.current=null,t.current=null},useTurnstile=function(e){var t=e.action,n=e.size,c=e.theme,i=void 0===c?"light":c,a=e.appearance,o=e.execution,l=e.autoRefresh,s=void 0===l||l,f=e.refreshInterval,d=void 0===f?24e4:f,p=(0,u.useRef)(null),m=(0,u.useRef)(null),v=(0,u.useRef)(null),h=(0,u.useRef)(null),y=(0,u.useRef)(null),E=(0,u.useState)(null),T=E[0],k=E[1],w=(0,u.useState)(null),x=w[0],g=w[1],b=(0,u.useState)(!1),I=b[0],P=b[1],_=(0,u.useState)(null),C=_[0],S=_[1],A=(0,u.useState)(!1),R=A[0],Z=A[1],N=r.m.cfTurnstileSiteKey,U=r.m.cfTurnstileEnabled&&!!N;(0,u.useEffect)(function(){U||(P(!0),S(null),k(null),g(null))},[U]);var D=(0,u.useCallback)(function(e){var t,n=null!==(t=y.current)&&void 0!==t?t:crypto.randomUUID();y.current=null,k(e),g(n),Z(!1),S(null),v.current&&(v.current({token:e,idempotencyKey:n}),v.current=null,h.current=null)},[]),j=(0,u.useCallback)(function(e){y.current=null,S(e),Z(!1),k(null),g(null),h.current&&(h.current(e),v.current=null,h.current=null)},[]),Y=(0,u.useCallback)(function(){y.current=null,k(null),g(null),Z(!1),rejectPendingExecute(v,h,"Turnstile token expired"),m.current&&window.turnstile&&window.turnstile.reset(m.current)},[]),M=(0,u.useCallback)(function(){U&&m.current&&window.turnstile&&(rejectPendingExecute(v,h,"Turnstile reset"),y.current=null,window.turnstile.reset(m.current),k(null),g(null),S(null))},[U]),O=(0,u.useCallback)(function(){if(!U||!m.current||!(null!==(e=window.turnstile)&&void 0!==e&&e.execute))return Promise.reject(Error("Turnstile not ready"));rejectPendingExecute(v,h,"Superseded by new execute call");var e,t=crypto.randomUUID();return new Promise(function(e,n){v.current=e,h.current=n,y.current=t,window.turnstile.execute(m.current)})},[U]);
1return(0,u.useEffect)(function(){if(U&&s&&T){var e=setTimeout(M,d);return function(){return clearTimeout(e)}}},[s,U,d,M,T]),(0,u.useEffect)(function(){if(U){var e=setInterval(function(){window.turnstile&&p.current&&(clearInterval(e),clearTimeout(t),P(!0))},100),t=setTimeout(function(){clearInterval(e),P(!1),j(Error("Turnstile script load timeout"))},1e4);return function(){clearInterval(e),clearTimeout(t)}}},[U,j]),(0,u.useEffect)(function(){if(U&&I&&p.current&&!m.current&&N){try{m.current=window.turnstile.render(p.current,{sitekey:N,size:n,action:t,theme:i,appearance:a,execution:o,callback:D,"error-callback":j,"expired-callback":Y,"before-interactive-callback":function(){return Z(!0)},"after-interactive-callback":function(){Z(!1),rejectPendingExecute(v,h,"Turnstile challenge dismissed")}})}catch(e){j(e)}return function(){m.current&&window.turnstile&&(window.turnstile.remove(m.current),m.current=null),rejectPendingExecute(v,h,"Turnstile unmounted"),y.current=null}}},[U,I,N,t,n,i,a,o,D,j,Y]),{token:T,idempotencyKey:x,isEnabled:U,isInteractive:R,error:C,execute:O,containerRef:p}}},77461:function(e,t,n){n.d(t,{V7:function(){return usePayment},lz:function(){return useUnlockWithCoin},w1:function(){return useIsFirstTimeCheckout}});var r=n(84320),u=n(30179),c=n(76880),i=n.n(c),a=n(97770),o=n(67546),l=n(61910),s=n(93766),f=n(11461),d=n(50155),useUnlockWithCoin=function(){var e,t=(0,(0,o.Ek)().orderAPI)("/checkout").method("post").create(),n=(0,a.VY)(),r=(0,f.$G)().t,c=(0,l.D)({action:s.SL.CHECKOUT,appearance:"interaction-only",execution:"execute"}),d=c.containerRef,p=c.isEnabled,m=c.isInteractive,v=c.execute;return{instantUnlock:(e=(0,u.Z)(i().mark(function _callee(e){var u,c,a;return i().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(u=1e6*e.userConfirmPrice,c={},!p){i.next=11;break}return i.next=5,v().catch(function(){return null});case 5:if(a=i.sent){i.next=9;break}return n({message:r("turnstile.verify-failed"),severity:"error"}),i.abrupt("return",!1);case 9:c[s.En]=a.token,c[s.te]=a.idempotencyKey;case 11:return i.next=13,t({input:{payment:{payload:{coin:{}},instantPay:!0},userConfirmPrice:u.toString(),shops:[{shopId:e.shopId,digitalContentProducts:[{productId:e.productId,productType:e.productType,isRental:e.isRental,variant:e.variant,amount:1}]}]}},{headers:c});case 13:return i.abrupt("return",!0);case 14:case"end":return i.stop()}},_callee)})),function(t){return e.apply(this,arguments)}),turnstileContainerRef:d,isTurnstileInteractive:m}},usePayment=function(e,t){var n,c=(0,o.Ek)().paymentAPI;return(0,d.u)(e?["/payment",e]:null,(n=(0,u.Z)(i().mark(function _callee2(e){var t,n,u;return i().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return t=(0,r.Z)(e,2)[1],n=c("/payment/{paymentId}").method("get").create(),i.prev=2,i.next=5,n({paymentId:t});case 5:return u=i.sent,i.abrupt("return",u.data);case 9:if(i.prev=9,i.t0=i.catch(2),!(i.t0 instanceof n.Error)){i.next=14;break}throw Error(i.t0.getActualType().data.message);case 14:throw i.t0;case 15:case"end":return i.stop()}},_callee2,null,[[2,9]])})),function(e){return n.apply(this,arguments)}),t)},useIsFirstTimeCheckout=function(){var e=(0,o.Ek)().paymentAPI;return(0,d.u)("/is-first-time-checkout",(0,u.Z)(i().mark(function _callee3(){var t,n;return i().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return t=e("/is-first-time-checkout").method("get").create(),r.prev=1,r.next=4,t({});case 4:return n=r.sent,r.abrupt("return",n.data);case 8:if(r.prev=8,r.t0=r.catch(1),!(r.t0 instanceof t.Error)){r.next=13;break}throw Error(r.t0.getActualType().data.message);case 13:throw r.t0;case 14:case"end":return r.stop()}},_callee3,null,[[1,8]])})))}},86206:function(e,t,n){function backoff(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,u=e,c=1;c<n;c++)if((u*=r)>t)return t;return u}function setBackoffInterval(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,u=void 0,c=1;return u=setTimeout(function loop(){e(),u=setTimeout(loop,backoff(t,n,c++,r))},backoff(t,n,c++,r)),function(){u&&clearTimeout(u)}}n.d(t,{P:function(){return backoff},q:function(){return setBackoffInterval}})},93766:function(e,t,n){n.d(t,{En:function(){return c},SL:function(){return u},te:function(){return i}});var r,u,c="Cf-Turnstile-Response",i="Cf-Turnstile-Idempotency-Key";(r=u||(u={})).AI_SEARCH_PRODUCT="ai-search-product",r.CHECKOUT="checkout",r.REVIEW_PHYSICAL_PRODUCT="review-physical-product",r.NOVEL_CHAPTER_COMMENT="review-novel-chapter"}}]);
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.