1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8793],{3229:(e,t,r)=>{Promise.resolve().then(r.bind(r,86989)),Promise.resolve().then(r.bind(r,35135)),Promise.resolve().then(r.bind(r,50114)),Promise.resolve().then(r.bind(r,72539)),Promise.resolve().then(r.bind(r,34783)),Promise.resolve().then(r.bind(r,63852)),Promise.resolve().then(r.bind(r,97609)),Promise.resolve().then(r.bind(r,22356)),Promise.resolve().then(r.bind(r,72754)),Promise.resolve().then(r.bind(r,96215)),Promise.resolve().then(r.bind(r,86032))},22356:(e,t,r)=>{"use strict";r.d(t,{RelatedBooksSection:()=>c});var a=r(95155),l=r(12115),s=r(81693),n=r(73775),o=r(93420),i=r(15012);let c=({bookId:e,bookLanguage:t})=>{let{t:r,language:c}=(0,s.o)(),[d,u]=(0,l.useState)([]),[m,h]=(0,l.useState)([]),[f,g]=(0,l.useState)(!0),[b,p]=(0,l.useState)(!1),x=(0,l.useRef)(0);if((0,l.useEffect)(()=>{x.current=d.length},[d.length]),(0,l.useEffect)(()=>{let r=new AbortController,a=t||c,l=async()=>{try{x.current>0?p(!0):g(!0);let[t,l]=await Promise.all([(0,o.us)(e,{language:a,limit:5,signal:r.signal}),(0,o.fetchBookCategories)()]);u(t.books),h(l)}catch(e){"AbortError"!==e.name&&console.error("Failed to load related books",e)}finally{g(!1),p(!1)}};return e&&l(),()=>r.abort()},[e,t,c]),f)return(0,a.jsxs)("section",{className:"mt-12 border-t border-gray-100 pt-12",children:[(0,a.jsx)("h2",{className:"text-2xl font-bold text-gray-900 mb-6",children:r.catalog.relatedBooks}),(0,a.jsx)("div",{className:"flex justify-center py-12",children:(0,a.jsx)(i.k,{size:"lg"})})]});if(0===d.length)return null;let k=d.slice(0,5);return(0,a.jsxs)("section",{className:"mt-12 border-t border-gray-100 pt-12",children:[(0,a.jsxs)("div",{className:"mb-6 flex items-center justify-between gap-3",children:[(0,a.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:r.catalog.relatedBooks}),b&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,a.jsx)("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-gray-300 border-t-primary"}),(0,a.jsx)("span",{children:"tr"===c?"Sonuclar guncelleniyor...":"Updating results..."})]})]}),(0,a.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4",children:k.map(e=>(0,a.jsx)(n.M,{book:e,categories:m,hideDownloadSelect:!0},e.id))})]})}},35135:(e,t,r)=>{"use strict";r.d(t,{BookCreditBadge:()=>u});var a=r(95155),l=r(12115),s=r(81693),n=r(24944),o=r(84347),i=r(60597),c=r(31069),d=r(94290);function u({authorUsername:e}){let{isAuthenticated:t,profile:r}=(0,n.J)(),{t:m}=(0,s.o)(),{credits:h}=(0,i.I)(),[f,g]=(0,l.useState)(null),[b,p]=(0,l.useState)(null),x=r?.username;if((0,l.useEffect)(()=>{t&&(async()=>{try{let e=localStorage.getItem("accessToken"),t={accept:"application/json"};e&&(t.Authorization=`Bearer ${e}`);let r=await fetch("/api/subscriptions/my-plan/",{headers:t,credentials:"include"});if(r.ok){let e=await r.json();if(e?.plan&&!e.plan.is_free&&"active"===e.status){g(e.plan.name);let t=["reader","creator","author"].some(t=>e.plan.name.toLowerCase().includes(t));p(!0===e.plan.is_unlimited_reading||t)}else g("FREE"),p(!1)}else g("FREE"),p(!1)}catch(e){console.error("[BookCreditBadge] Failed to fetch plan name:",e),g("FREE"),p(!1)}})()},[t]),!t||e&&x&&e===x||!f||null===b)return null;if(b){let e=f,t=null;return f.includes("Author")?(e="Author",t=(0,a.jsx)(c.A,{className:"inline-block w-4 h-4 mr-1 text-yellow-500 fill-yellow-500"})):f.includes("Reader")?(e="Reader",t=(0,a.jsx)(d.A,{className:"inline-block w-4 h-4 mr-1 text-yellow-400 fill-yellow-400"})):f.includes("Creator")&&(e="Creator",t=(0,a.jsx)(d.A,{className:"inline-block w-4 h-4 mr-1 text-yellow-400 fill-yellow-400"})),(0,a.jsxs)("div",{className:"text-sm font-medium px-3 rounded-full inline-flex items-center font-bold",children:[t,(0,o.GW)(m.share.unlimitedPlanReads,{planName:e})]})}if(!h)return null;let k=h.costs?.read??1,y=(h.monthly_remaining??0)+(h.referral_balance??0)+(h.welcome_bonus_balance??0);return(0,a.jsx)("div",{className:"text-sm font-medium px-3 rounded-full inline-block font-bold",children:(0,o.GW)(m.share.burnCredit,{cost:k,remaining:y})})}},50114:(e,t,r)=>{"use strict";r.d(t,{BookDetailAnalytics:()=>s});var a=r(12115),l=r(95183);function s({bookId:e,title:t,category:r,language:n}){return(0,a.useEffect)(()=>{(0,l.pushViewBook)({book_id:e,book_title:t,book_genre:r,generation_book_language:n,page_path:window.location.pathname})},[e,t,r,n]),null}},60597:(e,t,r)=>{"use strict";r.d(t,{I:()=>s});var a=r(12115),l=r(24944);function s(){let{isAuthenticated:e,initialized:t}=(0,l.J)(),[s,n]=(0,a.useState)(null),[o,i]=(0,a.useState)(!1),c=(0,a.useCallback)(async()=>
1{if(t&&e){i(!0);try{let e=localStorage.getItem("accessToken"),t={};e&&(t.Authorization=`Bearer ${e}`);let{authenticatedFetch:a}=await Promise.resolve().then(r.bind(r,6843)),l=await a("/api/books/reading-credits",{headers:t,credentials:"include"});if(l.ok){let e=await l.json();n(e)}}catch(e){console.error("Failed to fetch credits:",e)}finally{i(!1)}}},[t,e]);return(0,a.useEffect)(()=>{c()},[c]),{credits:s,loading:o,refresh:c}}},86989:(e,t,r)=>{"use strict";r.d(t,{PrivateBookGuard:()=>o});var a=r(95155),l=r(12115),s=r(73321),n=r(24944);function o({authorUsername:e,fallbackRedirect:t,children:r}){let{initialized:i,isAuthenticated:c,user:d,profile:u}=(0,n.J)(),m=(0,s.useRouter)();return((0,l.useEffect)(()=>{if(i){if(!c||!d)return void m.push(t);u?.username!==e&&m.push(t)}},[i,c,d,u,e,t,m]),i&&c&&d&&u?.username===e)?(0,a.jsx)(a.Fragment,{children:r}):(0,a.jsx)("div",{className:"min-h-dvh flex items-center justify-center bg-gray-50",children:(0,a.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto"})})}},97609:(e,t,r)=>{"use strict";r.d(t,{ReadBookButton:()=>m});var a=r(95155),l=r(12115),s=r(24944),n=r(63852),o=r(24954),i=r(81693),c=r(93420),d=r(73321),u=r(60597);function m({bookId:e,className:t,"data-testid":r}){let h=(0,o.t)(),f=(0,d.usePathname)(),g=(0,d.useSearchParams)(),{isAuthenticated:b,initialized:p}=(0,s.J)(),{t:x}=(0,i.o)(),{credits:k}=(0,u.I)(),[y,w]=(0,l.useState)(!1),v=k?.costs?.read??1,j=(k?.monthly_remaining??0)+(k?.referral_balance??0)+(k?.welcome_bonus_balance??0),_=!k||k.is_unlimited_reading||j>=v,N=b&&k&&!_,B=(0,l.useCallback)(async()=>{if(!y){if(!_)return void console.log("[ReadBookButton] Not enough credits");w(!0);try{await (0,c.Bg)(e),h.push(`/flow/${e}`)}catch(t){console.error("[ReadBookButton] Error adding book to library:",t),console.error("[ReadBookButton] Error details:",{message:t instanceof Error?t.message:"Unknown error",bookId:e}),w(!1)}}},[y,_,e,h]),E=async t=>{if(t.preventDefault(),p){if(N)return void h.push(`/paywall/${e}`);if(!b){let e=new URLSearchParams(g.toString());e.set("action","start_reading");let t=`${f}?${e.toString()}`;h.push(`/login?next=${encodeURIComponent(t)}`);return}await B()}};(0,l.useEffect)(()=>{p&&b&&"start_reading"===g.get("action")&&B()},[p,b,g,B]);let P=N?x.share.upgradeToRead:y&&x.common?.loading||x.share.readNowForFree;return(0,a.jsx)(n.LocaleLink,{href:N?`/paywall/${e}
1`:`/flow/${e}`,onClick:E,className:t,"data-testid":r,style:{pointerEvents:y?"none":"auto",cursor:"pointer"},children:P})}}},e=>{e.O(0,[1292,692,386,8191,8258,799,3860,6326,2901,236,7813,9559,5986,6727,3908,4949,5442,8086,4460,938,7358],()=>e(e.s=3229)),_N_E=e.O()}]); 2//# sourceMappingURL=page-4de602b4c19ff6df.js.map
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.