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]="dd818b17-3716-c055-d009-59fb1af60287")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,395769,e=>{"use strict";var t=e.i(843476),r=e.i(500932),a=e.i(82861);function i(e){e.detail>1&&e.preventDefault()}e.s(["default",0,e=>{let s,n,l=(0,r.c)(5),{children:o,className:u}=e;return l[0]!==u?(s=(0,a.cn)("select-none","**:select-none","[&_*]:-webkit-user-select-none","[&_*]:-webkit-touch-callout-none","[&_*]:-webkit-tap-highlight-color:transparent","[&_input]:select-text","[&_textarea]:select-text","**:[[contenteditable=true]]:select-text","[&_[contenteditable=true]_*]:select-text","**:[contenteditable=true]]:select-text","[&_[contenteditable=true]_*]:select-text",u),l[0]=u,l[1]=s):s=l[1],l[2]!==o||l[3]!==s?(n=(0,t.jsx)("div",{className:s,onMouseDown:i,children:o}),l[2]=o,l[3]=s,l[4]=n):n=l[4],n}])},89454,e=>{"use strict";var t=e.i(843476),r=e.i(500932),a=e.i(657688),i=e.i(861745),s=e.i(948148),n=e.i(39839),l=e.i(886392),o=e.i(497140),o=o;e.i(249205);var u=e.i(626289);e.i(301714);var c=e.i(693299),d=e.i(82861);let m=e=>{let a,n,l,o,m,p,f,x,h,g,v=(0,r.c)(28),{className:b,isVisible:S}=e;v[0]!==S?(a={experiment:c.EStatsigExperiment.AB_BOOK_BOOK_HEAER_ADULT_BADGE_V1,autoTrack:S},v[0]=S,v[1]=a):a=v[1];let{exp:E}=(0,u.useTrackExperiment)(a),y=E.get("show_adult_badge"),_=(0,i.useLocale)(),w=(0,s.useTranslations)("reader.reader_book_info");v[2]!==E||v[3]!==_||v[4]!==w?(n=E.get(`hot_label_${_}`,w("adult_badge.hot")),v[2]=E,v[3]=_,v[4]=w,v[5]=n):n=v[5];let N=n;v[6]!==E||v[7]!==_?(l=E.get(`hot_label_icon_${_}`,"ð¶ï¸"),v[6]=E,v[7]=_,v[8]=l):l=v[8];let j=l;v[9]!==E||v[10]!==_||v[11]!==w?(o=E.get(`subtitle_${_}`,w("adult_badge.subtitle")),v[9]=E,v[10]=_,v[11]=w,v[12]=o):o=v[12];let k=o;return y&&S?(v[13]!==b?(m=(0,d.cn)("border-warning-badge/20 bg-warning-badge/5 mt-4 grid w-8/12 items-center rounded-full border-2 py-2 sm:w-5/12",b),v[13]=b,v[14]=m):m=v[14],v[15]!==j?(p=(0,t.jsx)("span",{className:"rounded-full",children:j}),v[15]=j,v[16]=p):p=v[16],v[17]!==N?(f=(0,t.jsx)("span",{className:"text-warning-badge-foreground text-xs font-bold tracking-wider uppercase",children:N}),v[17]=N,v[18]=f):f=v[18],v[19]!==k?(x=(0,t.jsx)("span",{className:"text-muted-foreground text-xs font-bold",children:k}),v[19]=k,v[20]=x):x=v[20],v[21]!==p||v[22]!==f||v[23]!==x?(h=(0,t.jsxs)("div",{className:"flex w-full flex-row items-center justify-center gap-2",children:[p,f,x]}),v[21]=p,v[22]=f,v[23]=x,v[24]=h):h=v[24],v[25]!==m||v[26]!==h?(g=(0,t.jsx)("div",{className:m,children:h}),v[25]=m,v[26]=h,v[27]=g):g=v[27],g):null};e.i(760756);var p=e.i(781345),p=p,f=e.i(872253),f=f,x=e.i(117859),h=e.i(473928),h=h,g=e.i(540093),v=e.i(179624);let b=e=>{let n,l,u,c,b,S,E,y,_,w,N,j,k,T,P,C,R,A,I=(0,r.c)(54),{book:L,classNames:M,gateRef:U,showElements:O}=e;I[0]!==M?(n=void 0===M?{container:"",description:""}:M,I[0]=M,I[1]=n):n=I[1];let B=n;I[2]!==O?(l=void 0===O?{description:!0,stats:!0,author:!0,bookTitle:!0,statsAtCover:!0}:O,I[2]=O,I[3]=l):l=I[3];let D=l,F=(0,i.useLocale)(),G=(0,s.useTranslations)("reader.reader_book_info"),V=(0,h.default)(L.creatives);I[4]===Symbol.for("react.memo_cache_sentinel")?(u=(0,v.imageShimmer)(460,470),I[4]=u):u=I[4];let z=u,H=L.views||0;I[5]!==H?(c=Math.round(.61*H),I[5]=H,I[6]=c):c=I[6];let K=Math.max(L.likes||0,c),Y=V||L.cover?.url||"/placeholder.png";return I[7]!==L.title||I[8]!==Y?(b=(0,t.jsx)(a.default,{src:Y,alt:L.title,width:375,height:476,sizes:"(max-width: 768px) 350px, 1px",className:"h-full w-full object-cover object-[50%_20%]",loading:"eager",placeholder:"blur",blurDataURL:z,fetchPriority:"high",preload:!0}),I[7]=L.title,I[8]=Y,I[9]=b):b=I[9],I[10]!==L.isAdult||I[11]!==b?(S=(0,t.jsx)(f.default,{isAdult:L.isAdult,children:b}),I[10]=L.isAdult,I[11]=b,I[12]=S):S=I[12],I[13]===Symbol.for("react.memo_cache_sentinel")?(E=(0,t.jsx)("div",{className:"to-background pointer-events-none absolute inset-x-0 bottom-0 h-[2.5%] bg-linear-to-b from-transparent"}),I[13]=E):E=I[13],I[14]!==L.title||I[15]!==K||I[16]!==H||I[17]!==D.statsAtCover?(y=D.statsAtCover&&(0,t.jsx)(p.default,{title:L.title,likes:K,reads:H,className:"absolute bottom-0 pb-6"}),I[14]=L.title,I[15]=K,I[16]=H,I[17]=D.statsAtCover,I[18]=y):y=I[18],I[19]!==y||I[20]!==S?(_=(0,t.jsxs)("div",{className:"h-full w-full overflow-hidden",children:[S,E,y]}),I[19]=y,I[20]=S,I[21]=_):_=I[21],I[22]===Symbol.for("react.memo_cache_sentinel")?(w=(0,t.jsx)("div",{className:"to-background pointer-events-none absolute inset-x-0 bottom-0 h-3 bg-gradient-to-b from-transparent"}),I[22]=w):w=I[22],I[23]!==_?(N=(0,t.jsxs)("div",{className:"relative -mx-[calc(50vw-
250%)] h-[410px] w-screen overflow-hidden",children:[_,w]}),I[23]=_,I[24]=N):N=I[24],I[25]!==U?(j=(0,t.jsx)("div",{ref:U,className:"pointer-events-none h-px w-full shrink-0","aria-hidden":!0}),I[25]=U,I[26]=j):j=I[26],I[27]!==L.title||I[28]!==D.bookTitle?(k=D.bookTitle&&(0,t.jsx)("h2",{className:"text-foreground/90 pt-5 text-xl leading-tight font-black",children:L.title}),I[27]=L.title,I[28]=D.bookTitle,I[29]=k):k=I[29],I[30]!==L.author?.name||I[31]!==D.author?(T=D.author&&(0,t.jsx)("p",{className:"text-muted-foreground text-sm font-medium",children:L.author?.name}),I[30]=L.author?.name,I[31]=D.author,I[32]=T):T=I[32],I[33]!==L.description||I[34]!==B.description||I[35]!==D.description?(P=D.description&&(0,t.jsx)("div",{className:(0,d.cn)("text-muted-foreground pt-4 text-sm [-webkit-line-clamp:4]",B.description),children:(0,t.jsx)(x.DescriptionRenderComponent,{value:L.description})}),I[33]=L.description,I[34]=B.description,I[35]=D.description,I[36]=P):P=I[36],I[37]!==L.isAdult?(C=(0,t.jsx)(m,{isVisible:L.isAdult}),I[37]=L.isAdult,I[38]=C):C=I[38],I[39]!==L.rating||I[40]!==L.totalChapters||I[41]!==L.views||I[42]!==F||I[43]!==D.stats||I[44]!==G?(R=D.stats&&(0,t.jsxs)("div",{className:"bg-muted/70 mt-4 grid w-full grid-cols-3 items-center rounded-xl py-4",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-[10px] font-bold tracking-wider uppercase",children:G("chapters")}),(0,t.jsx)("span",{className:"text-foreground text-sm font-bold",children:L.totalChapters??""})]}),(0,t.jsxs)("div",{className:"border-muted/50 flex flex-col items-center gap-1 border-x px-2",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-[10px] font-bold tracking-wider uppercase",children:G("rating")}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-[14px]",children:(0,t.jsx)(o.default,{className:"fill-additional stroke-additional size-4"})}),(0,t.jsx)("span",{className:"text-foreground text-sm font-bold",children:L.rating||"0.0"})]})]}),(0,t.jsxs)("div",{className:"flex flex-col items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground text-[10px] font-bold tracking-wider uppercase",children:G("reads")}),(0,t.jsx)("span",{className:"text-foreground text-sm font-bold",children:(0,g.formatTruncatedNumber)(L.views||0,{locale:F})})]})]}),I[39]=L.rating,I[40]=L.totalChapters,I[41]=L.views,I[42]=F,I[43]=D.stats,I[44]=G,I[45]=R):R=I[45],I[46]!==N||I[47]!==j||I[48]!==k||I[49]!==T||I[50]!==P||I[51]!==C||I[52]!==R?(A=(0,t.jsx)("section",{className:((0,d.cn)(B.container),"md:hidden"),children:(0,t.jsxs)("div",{className:"relative flex flex-col items-center text-center",children:[N,j,k,T,P,C,R]})}),I[46]=N,I[47]=j,I[48]=k,I[49]=T,I[50]=P,I[51]=C,I[52]=R,I[53]=A):A=I[53],A};var S=e.i(212733),E=e.i(443661);let y=e=>{let a,i,s,n,l,o=(0,r.c)(17),{genres:u,className:c}=e;if(o[0]!==c||o[1]!==u){let e;o[3]!==c?(e=e=>(0,t.jsx)(S.BookTagComponent,{tag:e.name,className:c},e.slug),o[3]=c,o[4]=e):e=o[4],a=u.map(e),o[0]=c,o[1]=u,o[2]=a}else a=o[2];if(o[5]!==a?(i=(0,t.jsx)("section",{className:"hidden md:block",children:(0,t.jsx)(E.default,{variant:"reader",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:a})})}),o[5]=a,o[6]=i):i=o[6],o[7]!==c||o[8]!==u){let e;o[10]!==c?(e=e=>(0,t.jsx)(S.BookTagComponent,{tag:e.name,className:c},e.slug),o[10]=c,o[11]=e):e=o[11],s=u.map(e),o[7]=c,o[8]=u,o[9]=s}else s=o[9];return o[12]!==s?(n=(0,t.jsx)("section",{className:"pt-3 md:hidden",children:(0,t.jsx)(E.default,{variant:"reader",children:(0,t.jsx)("div",{className:"w-full",children:(0,t.jsx)("div",{className:"flex h-auto max-w-screen justify-start gap-2 bg-transparent whitespace-nowrap",children:s})})})}),o[12]=s,o[13]=n):n=o[13],o[14]!==i||o[15]!==n?(l=(0,t.jsxs)(t.Fragment,{children:[i,n]}),o[14]=i,o[15]=n,o[16]=l):l=o[16],l};var f=f,_=e.i(947135),h=h,w=e.i(472145),w=w,N=e.i(933211),j=e.i(361839),j=j,k=e.i(451477),k=k,T=e.i(271645),P=e.i(346944),C=e.i(320560);e.i(142936);var R=e.i(771633),A=e.i(602177);let I=e=>{let a,i,n,l,o,u,c=(0,r.c)(17),{hasAudio:d}=e,m=(0,s.useTranslations)("reader.audio"),{isPlaying:p,setIsPlaying:f,openMiniPlayer:x}=(0,R.useAudioStore)((0,P.useShallow)(L));if(!d)return null;c[0]!==x||c[1]!==f?(a=()=>{f(M),x()},c[0]=x,c[1]=f,c[2]=a):a=c[2];let h=a;return c[3]!==p||c[4]!==m?(i=m(p?"pause_audio_book":"play_audio_book"),c[3]=p,c[4]=m,c[5]=i):i=c[5],c[6]!==p?(n=p?(0,t.jsx)(j.default,{fill:"currentColor",className:"size-3.5"}):(0,t.jsx)(k.default,{fill:"currentColor",className:"size-3.5"}),c[6]=p,c[7]=n):n=c[7],c[8]!==m?(l=m("audiobook"),c[8]=m,c[9]=l):l=c[9],c[10]!==l?(o=(0,t.jsx)("span",{className:"text-primary-foreground font-semibold",children:l}),c[10]=l,c[11]=o):o=c[11],c[12]!==h||c[13]!==i||c[14]!==n||c[15]!==o?(u=(0,t.jsx)(T.Suspense,{fallback:null,children:(0,t.jsx)(C.MarketingGateComponent,{children:(0,t.jsxs)(A.Button,{onClick:h,"aria-label":i,className:"bg-primary text-primary-foreground absolute right-2 bottom-2 inline-flex h-8! items-center gap-1.5 rounded-full px-3! text-xs font-light",children:[n,o]})})}),c[12]=h,c[13]=i,c[14]=n,c[15]=o,c[16]=u):u=c[16],u};function L(e){return{isPlaying:e.isPlaying,setIsPlaying:e.setIsPlaying,openMiniPlayer:e.openMiniPlayer}}function M(e){return!e}e.s(["default",0,e=>{let o,u,c,p,v,S,E,j,k,T,P,C,R,A,L,M,U,O,B,D,F,G,V,z,H,K,Y,Q,W,$,q,X,J,Z,ee,et,er,ea,ei,es,en,el,eo,eu,ec=(0,r.c)(90),{book:ed}=e,em=(0,s.useTranslations)("reader.reader_book_info"),ep=(0,n.useMediaQuery)("(max-width: 767px)"),ef=(0,i.useLocale)(),ex=(0,h.default)(ed.creatives);
2ec[0]===Symbol.for("react.memo_cache_sentinel")?(o={showWhenSentinelNotVisible:!1},ec[0]=o):o=ec[0];let eh=o,{ref:eg}=(0,w.default)(ep,eh);ec[1]===Symbol.for("react.memo_cache_sentinel")?(u={description:!1,author:!1,bookTitle:!1,stats:!1,statsAtCover:!0},c={container:"-mt-1 mb-8 flex flex-col md:hidden",description:"text-foreground text-xl font-bold"},ec[1]=u,ec[2]=c):(u=ec[1],c=ec[2]),ec[3]!==ed||ec[4]!==eg?(p=(0,t.jsx)(b,{book:ed,gateRef:eg,showElements:u,classNames:c}),ec[3]=ed,ec[4]=eg,ec[5]=p):p=ec[5];let ev=!ed?.cover?.url,eb=ed?.isAdult,eS=ex||ed.cover?.url||"/placeholder.png";ec[6]!==ed.title||ec[7]!==eS?(v=(0,t.jsx)(a.default,{src:eS,alt:ed.title,width:120,height:240,className:"h-full w-full object-cover",sizes:"120px",fetchPriority:"high",preload:!0,loading:"eager"}),ec[6]=ed.title,ec[7]=eS,ec[8]=v):v=ec[8],ec[9]!==eb||ec[10]!==v?(S=(0,t.jsx)(f.default,{isAdult:eb,children:v}),ec[9]=eb,ec[10]=v,ec[11]=S):S=ec[11],ec[12]!==ed.hasAudio?(E=(0,t.jsx)(I,{hasAudio:ed.hasAudio}),ec[12]=ed.hasAudio,ec[13]=E):E=ec[13],ec[14]!==E||ec[15]!==ev||ec[16]!==S?(j=(0,t.jsx)("div",{className:"h-76 w-64 overflow-hidden rounded-md",children:(0,t.jsxs)(_.BookImageComponent,{skip:ev,children:[S,E]})}),ec[14]=E,ec[15]=ev,ec[16]=S,ec[17]=j):j=ec[17],ec[18]===Symbol.for("react.memo_cache_sentinel")?(k=(0,d.cn)("text-foreground text-xl leading-tight font-bold"),ec[18]=k):k=ec[18],ec[19]!==ed.title?(T=(0,t.jsx)("h2",{className:k,children:ed.title}),ec[19]=ed.title,ec[20]=T):T=ec[20],ec[21]===Symbol.for("react.memo_cache_sentinel")?(P=(0,d.cn)("text-foreground flex items-center gap-6 text-sm leading-relaxed"),C=(0,d.cn)("text-foreground/90 font-semibold"),ec[21]=P,ec[22]=C):(P=ec[21],C=ec[22]),ec[23]!==em?(R=em("author"),ec[23]=em,ec[24]=R):R=ec[24],ec[25]!==R?(A=(0,t.jsx)("span",{className:C,children:R}),ec[25]=R,ec[26]=A):A=ec[26],ec[27]===Symbol.for("react.memo_cache_sentinel")?(L=(0,d.cn)("text-foreground font-semibold"),ec[27]=L):L=ec[27];let eE=ed.author?.name;return ec[28]!==eE?(M=(0,t.jsx)("p",{className:L,children:eE}),ec[28]=eE,ec[29]=M):M=ec[29],ec[30]!==A||ec[31]!==M?(U=(0,t.jsxs)("div",{children:[A,M]}),ec[30]=A,ec[31]=M,ec[32]=U):U=ec[32],ec[33]===Symbol.for("react.memo_cache_sentinel")?(O=(0,t.jsx)(l.Separator,{orientation:"vertical",className:"border-border origin-center scale-y-[0.6] self-stretch border-l"}),B=(0,d.cn)("text-foreground/90 font-semibold"),ec[33]=O,ec[34]=B):(O=ec[33],B=ec[34]),ec[35]!==em?(D=em("reads"),ec[35]=em,ec[36]=D):D=ec[36],ec[37]!==D?(F=(0,t.jsx)("span",{className:B,children:D}),ec[37]=D,ec[38]=F):F=ec[38],ec[39]===Symbol.for("react.memo_cache_sentinel")?(G=(0,d.cn)("text-foreground/90 font-semibold"),ec[39]=G):G=ec[39],ec[40]!==ed.views||ec[41]!==ef?(V=ed.views?(0,g.formatTruncatedNumber)(ed.views,{locale:ef}):"",ec[40]=ed.views,ec[41]=ef,ec[42]=V):V=ec[42],ec[43]!==V?(z=(0,t.jsx)("p",{className:G,children:V}),ec[43]=V,ec[44]=z):z=ec[44],ec[45]!==F||ec[46]!==z?(H=(0,t.jsxs)("div",{children:[F,z]}),ec[45]=F,ec[46]=z,ec[47]=H):H=ec[47],ec[48]===Symbol.for("react.memo_cache_sentinel")?(K=(0,t.jsx)(l.Separator,{orientation:"vertical",className:"border-border origin-center scale-y-[0.6] self-stretch border-l"}),Y=(0,d.cn)("text-foreground/90 font-semibold"),ec[48]=K,ec[49]=Y):(K=ec[48],Y=ec[49]),ec[50]!==em?(Q=em("chapters"),ec[50]=em,ec[51]=Q):Q=ec[51],ec[52]!==Q?(W=(0,t.jsx)("span",{className:Y,children:Q}),ec[52]=Q,ec[53]=W):W=ec[53],ec[54]===Symbol.for("react.memo_cache_sentinel")?($=(0,d.cn)("text-foreground font-semibold"),ec[54]=$):$=ec[54],ec[55]!==ed.totalChapters?(q=(0,t.jsx)("p",{className:$,children:ed.totalChapters}),ec[55]=ed.totalChapters,ec[56]=q):q=ec[56],ec[57]!==W||ec[58]!==q?(X=(0,t.jsxs)("div",{children:[W,q]}),ec[57]=W,ec[58]=q,ec[59]=X):X=ec[59],ec[60]!==U||ec[61]!==H||ec[62]!==X?(J=(0,t.jsxs)("div",{className:P,children:[U,O,H,K,X]}),ec[60]=U,ec[61]=H,ec[62]=X,ec[63]=J):J=ec[63],ec[64]!==T||ec[65]!==J?(Z=(0,t.jsxs)("div",{className:"flex w-10/12 flex-col gap-4",children:[T,J]}),ec[64]=T,ec[65]=J,ec[66]=Z):Z=ec[66],ec[67]!==ed.genres?(ee=ed.genres&&(0,t.jsx)(y,{genres:ed.genres}),ec[67]=ed.genres,ec[68]=ee):ee=ec[68],ec[69]!==ee?(et=(0,t.jsx)("div",{children:ee}),ec[69]=ee,ec[70]=et):et=ec[70],ec[71]!==ed.isAdult?(er=(0,t.jsx)(m,{isVisible:ed.isAdult,className:"mt-0 w-5/12"}),ec[71]=ed.isAdult,ec[72]=er):er=ec[72],ec[73]!==Z||ec[74]!==et||ec[75]!==er?(ea=(0,t.jsxs)("div",{className:"flex h-full min-h-26 w-full flex-col items-start justify-between gap-4",children:[Z,et,er]}),ec[73]=Z,ec[74]=et,ec[75]=er,ec[76]=ea):ea=ec[76],ec[77]!==j||ec[78]!==ea?(ei=(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[j,ea]}),ec[77]=j,ec[78]=ea,ec[79]=ei):ei=ec[79],ec[80]===Symbol.for("react.memo_cache_sentinel")?(es=(0,d.cn)("text-foreground
2/90"),ec[80]=es):es=ec[80],ec[81]!==ed.description?(en=(0,t.jsx)(N.Tabs,{defaultValue:"summary",className:"relative mt-6 gap-4",children:(0,t.jsx)(N.TabsContent,{className:es,value:"summary",children:(0,t.jsx)("div",{className:"text-foreground/90 [display:-webkit-box] overflow-hidden text-sm leading-relaxed [-webkit-box-orient:vertical] [-webkit-line-clamp:4]",children:(0,t.jsx)(x.DescriptionRenderComponent,{value:ed.description})})})}),ec[81]=ed.description,ec[82]=en):en=ec[82],ec[83]===Symbol.for("react.memo_cache_sentinel")?(el=(0,t.jsx)(l.Separator,{className:"bg-border mt-6 h-px"}),ec[83]=el):el=ec[83],ec[84]!==ei||ec[85]!==en?(eo=(0,t.jsxs)("section",{className:"mb-4 hidden pt-5 md:block md:pt-3",children:[ei,en,el]}),ec[84]=ei,ec[85]=en,ec[86]=eo):eo=ec[86],ec[87]!==p||ec[88]!==eo?(eu=(0,t.jsxs)("div",{className:"relative space-y-4 pb-0","data-reader-content":"true",children:[p,eo]}),ec[87]=p,ec[88]=eo,ec[89]=eu):eu=ec[89],eu}],89454)},174548,e=>{"use strict";var t=e.i(500932),r=e.i(271645),a=e.i(39839),i=e.i(954616),s=e.i(386704),n=e.i(13348);e.i(262200);var l=e.i(681307),o=e.i(901355);l.z.object({q:l.z.string().optional(),page:l.z.coerce.number().optional(),limit:l.z.coerce.number().optional(),sort:l.z.string().transform(e=>e?(0,o.mapStringSortToEnum)(e):void 0).optional(),filters:l.z.object({genres:l.z.array(l.z.string()).optional(),vibes:l.z.array(l.z.string()).optional(),tropes:l.z.array(l.z.string()).optional(),spiceLevel:l.z.string().optional()}).optional(),withColumns:l.z.array(l.z.enum(["description","tags"])).optional()}),l.z.object({filters:l.z.object({genres:l.z.array(l.z.string()).optional(),vibes:l.z.array(l.z.string()).optional(),tropes:l.z.array(l.z.string()).optional(),spiceLevel:l.z.string().optional()}).optional(),page:l.z.coerce.number().default(1).optional(),limit:l.z.coerce.number().default(24).optional(),sort:l.z.string().transform(e=>e?(0,o.mapStringSortToEnum)(e):void 0).optional()}),l.z.object({isReading:l.z.boolean().optional(),page:l.z.coerce.number().optional(),limit:l.z.coerce.number().optional()}),e.i(301714);var u=e.i(325020);e.s(["BookViewTrackerComponent",0,e=>{let l,o,c,d,m=(0,t.c)(13),{slug:p}=e,f=(0,r.useRef)(!1);m[0]===Symbol.for("react.memo_cache_sentinel")?(l={},m[0]=l):l=m[0];let[x,h]=(0,a.useSessionStorage)(u.EStorageKey.VIEWED_BOOKS,l);m[1]===Symbol.for("react.memo_cache_sentinel")?(o=(0,n.mutationOptions)({mutationFn:e=>(0,s.trackBookViewApi)(e)}),m[1]=o):o=m[1];let g=(0,i.useMutation)(o),v=x[p];return m[2]!==v||m[3]!==h||m[4]!==p||m[5]!==g||m[6]!==x?(c=()=>{v||f.current||(f.current=!0,h({...x,[p]:!0}),g.mutate(p))},m[2]=v,m[3]=h,m[4]=p,m[5]=g,m[6]=x,m[7]=c):c=m[7],m[8]!==v||m[9]!==h||m[10]!==p||m[11]!==g?(d=[p,v,h,g],m[8]=v,m[9]=h,m[10]=p,m[11]=g,m[12]=d):d=m[12],(0,r.useEffect)(c,d),null}],174548)},900167,e=>{"use strict";var t=e.i(500932),r=e.i(618566),a=e.i(271645),i=e.i(346944);e.i(932921);var s=e.i(548389);e.i(296665);var n=e.i(872560);e.i(249205);var l=e.i(181929),o=e.i(839930),u=e.i(493255);e.i(142936);var c=e.i(771633),d=e.i(643540),m=e.i(926636);e.i(223432);var p=e.i(528155);e.i(752189);var f=e.i(470329),x=e.i(773862);function h(e){return e.currentChapter}function g(e){return e.showMobileUI}function v(e){return{scrollProgress:e.scrollProgress,nextChapterPage:e.nextChapter?.page}}function b(e){return{audioCompletionPercentage:e.duration>0?Math.min(100,Math.max(0,Math.round(e.currentTime/e.duration*100))):0,activeAudioPlayerType:e.activeAudioPlayerType}}function S(e){return e.sessionId}e.s(["default",0,e=>{let E,y,_,w,N,j,k,T,P,C,R,A,I=(0,t.c)(61),{book:L,initialChapter:M}=e,{id:U,slug:O,title:B,totalChapters:D,genres:F}=L,G=F?.[0]?.name,V=(0,r.useSearchParams)(),z=(0,d.useReaderStore)(h)??M,H=z.page,K=(0,d.useReaderStore)(g),Y=(0,l.useMediaQuery)("(max-width: 767px)"),{scrollProgress:Q,nextChapterPage:W}=(0,d.useReaderStore)((0,i.useShallow)(v)),{audioCompletionPercentage:$,activeAudioPlayerType:q}=(0,c.useAudioStore)((0,i.useShallow)(b)),X=(q===c.EAudioPlayerType.FULL?$>=90:Q>=90)&&!W,J=(0,a.useRef)(!1),Z=(0,m.useReaderFunnelSessionStore)(S),{email:ee,userId:et}=(0,o.useUserInfo)();I[0]===Symbol.for("react.memo_cache_sentinel")?(E={readingStarted:!1,bookCompleted:!1},I[0]=E):E=I[0];let er=(0,a.useRef)(E),ea=(0,a.useRef)(null),{settings:ei}=(0,u.useUserSettings)(),{readerMode:es}=ei;I[1]!==U||I[2]!==O||I[3]!==B||I[4]!==H||I[5]!==z.lockType||I[6]!==z.t
2itle||I[7]!==G||I[8]!==W||I[9]!==V||I[10]!==D?(y=()=>{if(J.current||!ea.current)return;J.current=!0;let e=c.useAudioStore.getState().activeAudioPlayerType===c.EAudioPlayerType.FULL,t=e?V.get("voiceSlug"):null,r=Date.now()-ea.current.startedAt,a=e&&c.useAudioStore.getState().duration>0?Math.round(1e3*c.useAudioStore.getState().duration):null;f.mixpanelService.track(x.EMixpanelReaderEvents.CHAPTER_COMPLETED,{book_id:U,book_title:B,book_slug:O,chapter_number:H,chapter_title:z.title,is_free_chapter:z.lockType===s.EChapterLockType.NONE,is_last_chapter:!W,completion_time_ms:r,total_chapters:D,completion_percentage:D?Math.min(100,Math.max(0,Math.round(H/D*100))):void 0,book_genre:G,type:e?"listen":"read",voice_slug:t,chapter_duration_ms:e?a:null})},I[1]=U,I[2]=O,I[3]=B,I[4]=H,I[5]=z.lockType,I[6]=z.title,I[7]=G,I[8]=W,I[9]=V,I[10]=D,I[11]=y):y=I[11];let en=y;return I[12]!==O||I[13]!==H||I[14]!==en?(_=()=>(m.useReaderFunnelSessionStore.getState().initSession(),J.current=!1,ea.current={chapterNumber:H,startedAt:Date.now()},n.userSegment.trackChapterView({bookSlug:O,chapterPage:H}),en),I[12]=O,I[13]=H,I[14]=en,I[15]=_):_=I[15],I[16]!==O||I[17]!==H?(w=[H,O],I[16]=O,I[17]=H,I[18]=w):w=I[18],(0,a.useEffect)(_,w),I[19]!==U||I[20]!==B||I[21]!==H||I[22]!==es||I[23]!==Z?(N=()=>{if(!Z||er.current.readingStarted||c.useAudioStore.getState().activeAudioPlayerType===c.EAudioPlayerType.FULL)return;let e=window.scrollY,t=()=>{if(er.current.readingStarted)return void window.removeEventListener("scroll",t);if(!(100>Math.abs(window.scrollY-e))){let e;e=d.useReaderStore.getState().scrollProgress,f.mixpanelService.track(x.EMixpanelReaderEvents.READING_STARTED,{book_id:U,book_title:B,chapter_number:H,is_resume:H>0,scroll_depth_start:e,reading_session_id:Z,reader_mode:es}),er.current.readingStarted=!0,window.removeEventListener("scroll",t)}};return window.addEventListener("scroll",t,{passive:!0}),()=>window.removeEventListener("scroll",t)},j=[H,U,B,Z,es],I[19]=U,I[20]=B,I[21]=H,I[22]=es,I[23]=Z,I[24]=N,I[25]=j):(N=I[24],j=I[25]),(0,a.useEffect)(N,j),I[26]!==q||I[27]!==U||I[28]!==B||I[29]!==H||I[30]!==ee||I[31]!==X||I[32]!==V||I[33]!==Z||I[34]!==et?(k=()=>{if(!Z||!X||er.current.bookCompleted)return;let e=q===c.EAudioPlayerType.FULL?"audio-player":"reader";p.googleTagManagerService.trackBookCompleted({book_id:U,book_title:B,chapter_number:H,user_id:et,email:ee,source:e}),f.mixpanelService.track(x.EMixpanelReaderEvents.BOOK_COMPLETED,{book_id:U,book_title:B,chapter_number:H,completion_percentage:X?100:void 0,is_last_chapter:!0,reading_session_id:Z,voice_slug:"audio-player"===e?V.get("voiceSlug"):null,source:"audio-player"===e?"audio-player":"reader"}),er.current.bookCompleted=!0},T=[H,U,B,Z,ee,et,V,X,q],I[26]=q,I[27]=U,I[28]=B,I[29]=H,I[30]=ee,I[31]=X,I[32]=V,I[33]=Z,I[34]=et,I[35]=k,I[36]=T):(k=I[35],T=I[36]),(0,a.useEffect)(k,T),I[37]!==O||I[38]!==H||I[39]!==Y||I[40]!==K?(P=()=>{Y&&K&&f.mixpanelService.track(x.EMixpanelReaderEvents.NAVIGATION_DISPLAYED,{book_slug:O,chapter_page:H})},I[37]=O,I[38]=H,I[39]=Y,I[40]=K,I[41]=P):P=I[41],I[42]!==O||I[43]!==B||I[44]!==H||I[45]!==Y||I[46]!==K?(C=[Y,K,B,O,H],I[42]=O,I[43]=B,I[44]=H,I[45]=Y,I[46]=K,I[47]=C):C=I[47],(0,a.useEffect)(P,C),I[48]!==O||I[49]!==H||I[50]!==ee||I[51]!==G||I[52]!==et?(R=()=>{let e=c.useAudioStore.getState().activeAudioPlayerType===c.EAudioPlayerType.FULL;p.googleTagManagerService.trackChapterCompleted({book_slug:O,chapter_number:H,user_id:et,book_genre:G,email:ee,source:e?"audio-player":"reader"})},I[48]=O,I[49]=H,I[50]=ee,I[51]=G,I[52]=et,I[53]=R):R=I[53],I[54]!==O||I[55]!==B||I[56]!==H||I[57]!==ee||I[58]!==G||I[59]!==et?(A=[O,B,H,ee,et,G],I[54]=O,I[55]=B,I[56]=H,I[57]=ee,I[58]=G,I[59]=et,I[60]=A):A=I[60],(0,a.useEffect)(R,A),null}],900167)},963275,e=>{"use strict";e.i(142936);var t=e.i(643540);function r(e){return e.currentChapter?.page}e.s(["default",0,e=>{let{showOnChapter:a,children:i,defaultPage:s}=e,n=(0,t.useReaderStore)(r);return a.includes(s)&&!n||n&&a.includes(n)?i:null}])},798,e=>{"use strict";var t=e.i(500932),r=e.i(363178),a=e.i(271645),i=e.i(346944);e.i(142936);var s=e.i(926636);e.i(752189);var n=e.i(470329),l=e.i(773862);function o(e){return{hasStarted:e.hasStarted,markStarted:e.markStarted}}e.s(["default",0,e=>{let u,c,d=(0,t.c)(8),{bookId:m,bookTitle:p,chapterPage:f}=e,{markStarted:x,hasStarted:h}=(0,s.useReaderFunnelSessionStore)((0,i.useShallow)(o)),{resolvedTheme:g}=(0,r.useTheme)();return d[0]!==m||d[1]!==p||d[2]!==f||d[3]!==h||d[4]!==x||d[5]!==g?(u=()=>
2{h||(n.mixpanelService.track(l.EMixpanelEvent.FUNNEL_START_VIEWED,{book_id:m,book_title:p,chapter_number:f,theme:g,page_referrer:"https://sagabox.com/"}),x())},c=[h,x,m,p,f,g],d[0]=m,d[1]=p,d[2]=f,d[3]=h,d[4]=x,d[5]=g,d[6]=u,d[7]=c):(u=d[6],c=d[7]),(0,a.useEffect)(u,c),null}])},714655,e=>{"use strict";var t=e.i(500932),r=e.i(271645),a=e.i(346944),i=e.i(266027);e.i(218922);var s=e.i(592928);e.i(932921);var n=e.i(548389);e.i(249205);var l=e.i(138377),o=e.i(31529);e.i(300212);var u=e.i(824374),c=e.i(579738);e.i(142936);var d=e.i(12631),m=e.i(643540);e.i(179770);var p=e.i(833737);e.i(466270);var f=e.i(573319),x=e.i(887992);function h(e){return{bookSlug:e.book?.slug,bookId:e.book?.id,nextChapter:e.nextChapter}}function g(e){return e.handleOpen}e.s(["default",0,e=>{let v,b,S,E,y,_,w,N=(0,t.c)(32),{children:j}=e,{data:k}=(0,p.useSession)(),T=(0,l.useHasUserSessionFlag)(),{bookSlug:P,bookId:C,nextChapter:R}=(0,m.useReaderStore)((0,a.useShallow)(h));N[0]!==C||N[1]!==T?(v=(0,s.getTokenUnlockedQueryOptions)({bookId:C,enabled:T}),N[0]=C,N[1]=T,N[2]=v):v=N[2];let{data:A}=(0,i.useQuery)(v),I=A?.chapterIds;N[3]===Symbol.for("react.memo_cache_sentinel")?(b=(0,s.getTokenBundlesQueryOptions)(),N[3]=b):b=N[3];let{data:L}=(0,i.useQuery)(b);N[4]!==T?(S=(0,s.getTokenBalanceQueryOptions)({enabled:T}),N[4]=T,N[5]=S):S=N[5];let{data:M}=(0,i.useQuery)(S),{subscribe:U}=(0,x.useEventBus)(),O=(0,d.useMultiViewModalStore)(g),B=!!k?.user?.hasPurchasedTokens||(M?.balance??0)>0,[D,F]=(0,r.useState)(null),G=(0,o.useIsInlinePaywall)(),V=G&&D?.reason&&[n.EChapterLockType.REGISTER,n.EChapterLockType.SUBSCRIPTION].includes(D?.reason)&&!(D.reason===n.EChapterLockType.SUBSCRIPTION&&B);N[6]!==P||N[7]!==G||N[8]!==R?.id||N[9]!==R?.lockType||N[10]!==R?.page||N[11]!==k||N[12]!==I?(E=()=>{let e=!1,t=async()=>{if(!P||!R?.page||!R?.lockType){e||F(null);return}let t=await (0,c.evaluateReaderGateClient)({bookSlug:P,chapterPage:R?.page,session:k,chapterId:R?.id,unlockedChapterIds:I},R?.lockType);e||F(t)};return G&&t(),()=>{e=!0}},N[6]=P,N[7]=G,N[8]=R?.id,N[9]=R?.lockType,N[10]=R?.page,N[11]=k,N[12]=I,N[13]=E):E=N[13];let z=R?.page,H=R?.lockType,K=R?.id;N[14]!==P||N[15]!==G||N[16]!==k||N[17]!==z||N[18]!==H||N[19]!==K||N[20]!==I?(y=[P,z,H,K,k,G,I],N[14]=P,N[15]=G,N[16]=k,N[17]=z,N[18]=H,N[19]=K,N[20]=I,N[21]=y):y=N[21],(0,r.useEffect)(E,y),N[22]!==L?.tokensPerChapter||N[23]!==B||N[24]!==O||N[25]!==U?(_=()=>{let e=U(f.EEventBusEvent.PAGE_NAVIGATION_RESULT,e=>{if(e?.allow||e.reason!==n.EChapterLockType.SUBSCRIPTION||!B)return;let t=e.metadata?.chapterId;t&&O((0,u.buildTokenUnlockView)({chapterId:t,chapterPage:e.metadata?.chapterNumber,cost:L?.tokensPerChapter}))});return()=>e()},N[22]=L?.tokensPerChapter,N[23]=B,N[24]=O,N[25]=U,N[26]=_):_=N[26];let Y=L?.tokensPerChapter;return(N[27]!==B||N[28]!==O||N[29]!==U||N[30]!==Y?(w=[U,O,B,Y],N[27]=B,N[28]=O,N[29]=U,N[30]=Y,N[31]=w):w=N[31],(0,r.useEffect)(_,w),V)?j:null}])},188634,e=>{"use strict";var t=e.i(500932),r=e.i(271645);e.i(932921);var a=e.i(800814);e.i(249205);var i=e.i(485776),s=e.i(493255);e.s(["default",0,e=>{let n,l,o=(0,t.c)(4),{children:u,scrollComponent:c,defaultMode:d}=e,m=void 0===d?a.EUserSettingsReaderMode.CHAPTERS:d,{settings:p}=(0,s.useUserSettings)(),{readerMode:f}=p,[x,h]=(0,r.useState)(m),g=(0,i.useIsMounted)();return o[0]!==g||o[1]!==f?(n=()=>{f&&g&&h(f)},l=[f,g],o[0]=g,o[1]=f,o[2]=n,o[3]=l):(n=o[2],l=o[3]),(0,r.useEffect)(n,l),x===a.EUserSettingsReaderMode.SCROLL?c:u}])},757139,e=>{"use strict";var t=e.i(843476),r=e.i(500932),a=e.i(271645);e.i(301714);var i=e.i(637860);e.i(142936);var s=e.i(771633),n=e.i(771575),l=e.i(16422);function o(e){return e.activeAudioPlayerType}e.s(["default",0,e=>{let u,c,d,m,p=(0,r.c)(11),{children:f,pageViewTrack:x}=e,h=void 0===x||x,g=(0,s.useAudioStore)(o)===s.EAudioPlayerType.FULL?i.EMixpanelPages.AUDIO_PLAYER_PAGE:i.EMixpanelPages.READER_PAGE;return p[0]!==g||p[1]!==h?(u=h&&(0,t.jsx)(a.Suspense,{fallback:null,children:(0,t.jsx)(n.default,{pageName:g})}),p[0]=g,p[1]=h,p[2]=u):u=p[2],p[3]!==g?(c={pageName:g},p[3]=g,p[4]=c):c=p[4],p[5]!==f||p[6]!==c?(d=(0,t.jsx)(l.MixpanelPageAnalyticProvider.Provider,{value:c,children:f}),p[5]=f,p[6]=c,p[7]=d):d=p[7],p[8]!==u||p[9]!==d?(m=(0,t.jsxs)(t.Fragment,{children:[u,d]}),p[8]=u,p[9]=d,p[10]=m):m=p[10],m}],757139)},816200,e=>{"use strict";var t=e.i(500932),r=e.i(271645);e.i(932921);var a=e.i(548389);e.i(249205);var i=e.i(602075),i=i;e.i(466270);var s=e.i(573319),n=e.i(887992);e.s(["default",0,()=>{let e,l,o=(0,t.c)(4),{subscribe:u}=(0,n.useEventBus)(),{handleDecision:c}=(0,i.default)();return o[0]!==c||o[1]!==u?(e=()=>{let e=u(s.EEventBusEvent.PAGE_NAVIGATION_RESULT,e=>{c({decision:e||{allow:!1,reason:a.EChapterLockType.NONE}})});return()=>e()},l=[u,c],o[0]=c,o[1]=u,o[2]=e,o[3]=l):(e=o[2],l=o[3]),(0,r.useEffect)(e,l),null}],816200)},281319,e=>{"use strict";e.i(249205);var t=e.i(818644),r=e.i(831398),a=e.i(17039),a=a,i=e.i(441527),s=e.i(400430),n=e.i(103247),l=e.i(760228),o=e.i(714453),u=e.i(81890),c=e.i(702164),d=e.i(848380),m=e.i(405408),p=e.i(963076),f=e.i(602075),x=e.i(482981),h=e.i(585740),g=e.i(695541),v=e.i(362264),b=e.i(869113),S=e.i(473928),E=e.i(517371),y=e.i(495167),_=e.i(216185),w=e.i(140684),N=e.i(717116),j=e.i(261093),k=e.i(669959),T=e.i(828107),P=e.i(753296),C=e.i(982455),R=e.i(662303),A=e.i(295772),I=e.i(421445),L=e.i(842285),M=e.i(592064),U=e.i(331159),O=e.i(760803),B=e.i(195454),D=e.i(847945),F=e.i(104850),G=e.i(154278),V=e.i(982025),z=e.i(303824),H=e.i(777043),K=e.i(831543),Y=e.i(737435),Q=e.i(472145),W=e.i(944456),$=e.i(867161),q=e.i(584030),X=e.i(101255),J=e.i(617125),Z=e.i(589357),ee=e.i(703505),et=e.i(501601),er=e.i(854347),ea=e.i(891688),ei=e.i(785118),es=e.i(678720);e.s(["useAbGatePositioningExperiment",()=>t.useAbGatePositioningExperiment,"useAbPaywallPlacementExperiment",()=>r.useAbPaywallPlacementExperiment,"useActiveSpecialOffer",()=>n.default,"useAppVersionCheck",()=>l.default,"useBillingDateQuery",()=>o.default,"useBillingPeriodLabel",()=>u.default,"useBookRatingModal",()=>d.default,"useBookmark",()=>m.default,"useCancelSubscription",()=>p.default,"useChapterGateModal",()=>f.default,"useClaimSubscriptionReactivation",()=>x.default,"useCountdownProgress",()=>h.default,"useCountdownTimer",()=>g.default,"useCountry",()=>v.default,"useCountryMatch",()=>b.default,"useCreativeImage",()=>S.default,"useFitTags",()=>es.default,"useHasUserSessionFlag",()=>y.default,"useInlinePaywall",()=>_.default,"useIsInlinePaywall",()=>w.default,"useIsMounted",()=>N.default,"useIsPastDue",()=>j.default,"useIsPromo",()=>k.default,"useMediaQuery",()=>T.default,"useModalExitIntent",()=>P.default,"useMultiPlanExperiment",()=>
2a.default,"useMultiPlanSelection",()=>C.default,"useMultimodalModalContext",()=>R.default,"useNavigationEvent",()=>A.default,"useOfferDisplay",()=>I.default,"usePaymentDisclaimer",()=>L.default,"usePaymentDisclosureGate",()=>M.default,"usePaymentFormTitle",()=>U.default,"usePaywall",()=>O.default,"usePaywallOpenedTracker",()=>B.default,"usePaywallPlanContext",()=>D.default,"usePaywallPlanSync",()=>F.default,"usePlanPrice",()=>G.default,"usePriceExperiment",()=>i.usePriceExperiment,"usePromoCounter",()=>V.default,"usePromoCounterExperiment",()=>s.usePromoCounterExperiment,"useRateLimit",()=>z.default,"useReactivateSubscriptionDialog",()=>H.default,"useReadLink",()=>K.default,"useReaderBookPath",()=>c.default,"useReaderChapterHref",()=>Y.default,"useReaderToggleGate",()=>Q.default,"useResolveMultiPlanReady",()=>E.default,"useTap",()=>W.default,"useTokenUnlockedChapters",()=>$.default,"useTrackExperiment",()=>q.default,"useUpdateSearchParams",()=>X.default,"useUpdateSessionPlan",()=>J.default,"useUserBook",()=>Z.default,"useUserInfo",()=>ee.default,"useUserInteraction",()=>et.default,"useUserSettings",()=>er.default,"useUserStatusPaymentPreload",()=>ea.default,"useUserSubscriptionStatus",()=>ei.default],281319)},798048,e=>{"use strict";e.s(["default",()=>eB],798048);var t=e.i(843476),r=e.i(500932);e.i(932921);var a=e.i(548389),i=e.i(618566),s=e.i(861745),n=e.i(948148),l=e.i(915101),o=e.i(954616);e.i(235711);var u=e.i(18776);e.i(760756);var c=e.i(414613);e.i(284969);var d=e.i(448428);e.i(249205);var m=e.i(867887),p=e.i(839930);e.i(301714);var f=e.i(325020),x=e.i(693299);e.i(300212);var h=e.i(562203);e.i(142936);var g=e.i(12631),v=e.i(756686);e.i(756503);var b=e.i(542516);e.i(355770);var S=e.i(274678);e.i(787628);var E=e.i(294222),y=e.i(773862),_=e.i(82861),w=e.i(602177);let N=e=>{let{className:r,bookSlug:a}=e,N=(0,n.useTranslations)("reader.emailCaptureInline"),j=(0,n.useTranslations)("reader.emailCapture"),k=(0,s.useLocale)(),T=(0,l.useLogger)(),P=(0,v.useUserInfoSubscriptionStore)(e=>e.email),{navigateToNextPage:C}=(0,m.useNavigationEvent)(),{userId:R}=(0,p.useUserInfo)(),A=(0,S.usePathname)(),I=(0,i.useSearchParams)(),L=(0,g.useMultiViewModalStore)(e=>e.handleOpen);(0,E.useMixpanelLoadComponent)(y.EMixpanelEvent.ELEMENT_OPENED,{content_value:"email_gate",paywall_type:x.EStatsigGroup.AB_READER_PAYWALL_INLINE,...a?{book_slug:a}:{}});let M=(0,o.useMutation)({mutationFn:async e=>{if((0,h.createUserSubscriptionToken)(e),await (0,h.handleSubscriptionStatusInline)(e,{promptLoginExistingUser:!0,locale:k}))return}}),U=()=>{v.useUserInfoSubscriptionStore.getState().setEmailDismissed(!0),C({scroll:!0})},O=()=>{let e=I?.toString(),t=e?`${A}?${e}`:A;L({value:f.EModalViewKey.LOGIN,metadata:{callbackURL:t}})},B=async e=>{let t=e.email.trim();if(!t)return void U();T.info("Checkout funnel: email submitted",{event:d.ELogEvent.SUCCESS,flow:d.ELogFlow.CHECKOUT_FUNNEL,step:d.ELogCheckoutStep.EMAIL_SUBMITTED,traceId:R,env:b.envClient.NEXT_PUBLIC_APP_ENV,email:t,bookSlug:a});try{t&&await M.mutateAsync(t)}finally{U()}};return(0,t.jsxs)("div",{className:(0,_.cn)("mx-auto w-full max-w-3xl",r),children:[(0,t.jsx)(c.PaymentHeaderComponent,{variant:"emailCapture",className:"mb-8"}),(0,t.jsxs)("div",{className:"mx-auto w-full max-w-xl",children:[(0,t.jsx)(u.EmailCaptureFormComponent,{buttonText:j("backToReading"),onSubmit:B,defaultEmail:P,allowEmptyEmailSkip:!0}),(0,t.jsxs)("p",{className:"text-muted-foreground flex items-center justify-center pt-3 text-sm",children:[j.rich("login",{login:e=>(0,t.jsx)(w.Button,{variant:"link",type:"button",onClick:O,className:"px-1 hover:no-underline",children:e})}),(0,t.jsx)("span",{className:"text-muted-foreground px-1",children:"|"}),(0,t.jsx)(w.Button,{variant:"link",type:"button",onClick:U,disabled:M.isPending,className:"!text-muted-foreground px-1 hover:no-underline",children:N("skipForNow")})]})]})]})};var j=e.i(23639),k=e.i(203228);let T=e=>{let a,i,s,l,o,u,c,d,m,p=(0,r.c)(24),{email:x,hasActiveSubscription:h}=e,v=void 0!==h&&h,b=(0,n.useTranslations)("payment.reader_email_exist_inline"),S=(0,g.useMultiViewModalStore)(P),{getPaywallOpenCallbackURL:E}=(0,j.usePaywall)();return p[0]!==b?(a=b("title"),p[0]=b,p[1]=a):a=p[1],p[2]!==a?(i=(0,t.jsx)(k.CardTitle,{className:"text-foreground mx-auto max-w-[32rem] text-[2.25rem] leading-tight font-semibold tracking-tight",children:a}),p[2]=a,p[3]=i):i=p[3],p[4]!==v||p[5]!==b?(s=b(v?"has_subscription":"no_subscription"),p[4]=v,p[5]=b,p[6]=s):s=p[6],p[7]!==s?(l=(0,t.jsx)(k.CardDescription,{className:"text-muted-foreground mx-auto mt-2 max-w-[38rem] text-lg leading-relaxed",children:s}),p[7]=s,p[8]=l):l=p[8],p[9]!==i||p[10]!==l?(o=(0,t.jsxs)(k.CardHeader,{className:"mb-1 p-0 text-center",children:[i,l]}),p[9]=i,p[10]=l,p[11]=o):o=p[11],p[12]!==x||p[13]!==E||p[14]!==S?(u=()=>S({value:f.EModalViewKey.LOGIN,metadata:{email:x,callbackURL:E()}}),p[12]=x,p[13]=E,p[14]=S,p[15]=u):u=p[15],p[16]!==b?(c=b("proceed_to_login"),p[16]=b,p[17]=c):c=p[17],p[18]!==u||p[19]!==c?(d=(0,t.jsx)(w.Button,{size:"lg",className:"mt-6 w-full rounded-xl text-base",onClick:u,children:c}),p[18]=u,p[19]=c,p[20]=d):d=p[20],p[21]!==o||p[22]!==d?(m=(0,t.jsxs)(k.Card,{className:"bg-background mx-auto mb-10 w-full max-w-3xl gap-0 rounded-[28px] border p-5 shadow-none sm:p-7",children:[o,d]}),p[21]=o,p[22]=d,p[23]=m):m=p[23],m};function P(e){return e.handleOpen}var C=e.i(950250),C=C,R=e.i(19126),A=e.i(271645);e.i(466270);var I=e.i(573319),L=e.i(887992),M=e.i(768144);let U=e=>{let i,s,n,l,o,u=(0,r.c)(9),{children:c,reason:d,className:m}=e,{subscribe:p}=(0,L.useEventBus)(),f=(0,A.useRef)(null),x=(0,A.useRef)(!1);return u[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{let e=()=>{x.current||(x.current=!0,window.removeEventListener("pointerdown",e),window.removeEventListener("wheel",e))};return window.addEventListener("pointerdown",e),window.addEventListener("wheel",e,{passive:!0}),()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("wheel",e)}},s=[],u[0]=i,u[1]=s):(i=u[0],s=u[1]),(0,A.useEffect)(i,s),u[2]!==d||u[3]!==p?(n=()=>{let e=p(I.EEventBusEvent.PAGE_NAVIGATION_RESULT,e=>{if(e?.allow)return;let t=e.reason;if(t!==a.EChapterLockType.REGISTER&&t!==a.EChapterLockType.SUBSCRIPTION||(t===a.EChapterLockType.REGISTER&&x.current&&v.useUserInfoSubscriptionStore.getState().setEmailDismissed(!0),t!==d))return;let r=f.current;if(!r)return;let i=r.style.scrollMarginTop;r.style.scrollMarginTop=M.PAYWALL_SCROLL_MARGIN_TOP,r.scrollIntoView({behavior:"instant",block:"start"}),r.style.scrollMarginTop=i});return()=>e()},l=[d,p],u[2]=d,u[3]=p,u[4]=n,u[5]=l):(n=u[4],l=u[5]),(0,A.useEffect)(n,l),u[6]!==c||u[7]!==m?(o=(0,t.jsx)("div",{ref:f,className:m,children:c}),u[6]=c,u[7]=m,u[8]=o):o=u[8],o};e.i(154250);var O=e.i(68636);e.i(954297);
2var B=e.i(157760),D=e.i(802984),F=e.i(872515);e.i(815636);var G=e.i(110843);e.i(573808);var V=e.i(303576),z=e.i(44489),H=e.i(368421);let K=e=>{let a,i=(0,r.c)(2),{ref:s}=e;return i[0]!==s?(a=(0,t.jsx)("div",{ref:s,className:"pointer-events-none h-px w-full shrink-0 opacity-0","aria-hidden":!0}),i[0]=s,i[1]=a):a=i[1],a};var Y=e.i(538160),Y=Y,Q=e.i(693412),Q=Q;let W=e=>{let a,i,s,n,l,o=(0,r.c)(10),{book:u,className:d}=e;o[0]!==d?(a=(0,_.cn)("flex flex-col gap-8",d),o[0]=d,o[1]=a):a=o[1],o[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)(c.PaymentHeaderComponent,{variant:"emailPayment"}),o[2]=i):i=o[2];let m=u?.title??"",p=u?.cover?.url;return o[3]!==m||o[4]!==p?(s=(0,t.jsx)(Q.default,{title:m,coverUrl:p}),o[3]=m,o[4]=p,o[5]=s):s=o[5],o[6]===Symbol.for("react.memo_cache_sentinel")?(n=(0,t.jsx)(Y.default,{}),o[6]=n):n=o[6],o[7]!==a||o[8]!==s?(l=(0,t.jsxs)("section",{className:a,children:[i,s,n]}),o[7]=a,o[8]=s,o[9]=l):l=o[9],l},$=e=>{let a,i,s,n,l,o,u,d,m,p,f,x=(0,r.c)(27),{book:h,trial:g,children:v,className:b}=e,{setContentRef:S,endRef:E}=(0,H.useInlinePaywallScroll)(h),{showTokenBalance:y}=(0,z.useMultiPlanSelection)();x[0]!==b?(a=(0,_.cn)("mx-auto w-full max-w-3xl py-8",b),x[0]=b,x[1]=a):a=x[1],x[2]!==y?(i=y&&(0,t.jsx)(B.TokenBalanceComponent,{}),x[2]=y,x[3]=i):i=x[3],x[4]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(c.PaymentHeaderComponent,{variant:"emailPayment",className:"mb-4"}),x[4]=s):s=x[4];let w=h?.slug;return x[5]===Symbol.for("react.memo_cache_sentinel")?(n=(0,t.jsx)(D.SocialProofAvatarsComponent,{}),x[5]=n):n=x[5],x[6]!==w?(l=(0,t.jsx)(F.SocialProofInlineComponent,{bookSlug:w,children:n}),x[6]=w,x[7]=l):l=x[7],x[8]!==v||x[9]!==g?(o=(0,t.jsx)(O.PaywallPlanSectionComponent,{trial:g,children:v}),x[8]=v,x[9]=g,x[10]=o):o=x[10],x[11]!==g?(u=(0,t.jsx)(V.PaymentTermsSectionComponent,{trial:g,className:"mt-2"}),x[11]=g,x[12]=u):u=x[12],x[13]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsx)(G.PaymentMethodsRowComponent,{className:"mt-4"}),x[13]=d):d=x[13],x[14]!==h?(m=(0,t.jsx)(W,{book:h,className:"mt-12"}),x[14]=h,x[15]=m):m=x[15],x[16]!==E?(p=(0,t.jsx)(K,{ref:E}),x[16]=E,x[17]=p):p=x[17],x[18]!==S||x[19]!==a||x[20]!==i||x[21]!==p||x[22]!==l||x[23]!==o||x[24]!==u||x[25]!==m?(f=(0,t.jsxs)("div",{ref:S,className:a,children:[i,s,l,o,u,d,m,p]}),x[18]=S,x[19]=a,x[20]=i,x[21]=p,x[22]=l,x[23]=o,x[24]=u,x[25]=m,x[26]=f):f=x[26],f};var q=e.i(81463),X=e.i(136514),J=e.i(81890),J=J,Z=e.i(363465),ee=e.i(465565),et=e.i(45874),er=e.i(204110);let ea=e=>{let a,i,s=(0,r.c)(5),{trial:l,className:o}=e,u=(0,n.useTranslations)("payment.form.discount_inline"),c=(0,n.useTranslations)("payment.form"),{trial:d,base:m,discount:p,discountPercent:f}=(0,Z.usePlanPrice)(),x=(0,ee.isTrialOfferActive)(!!l,d),h=(0,ee.resolveTrialAmount)(d,m),g=(0,J.default)(d,"adjective"),v=(0,et.useCouponStore)(ei);s[0]!==o?(a=(0,_.cn)("flex items-center justify-between border-t px-4 pt-3",o),s[0]=o,s[1]=a):a=s[1];let b=x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-start gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,t.jsx)("span",{className:"text-foreground text-sm",children:u("trial_label",{trialPeriod:g})}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs line-through",children:m.interval===q.PLAN_INTERVAL.YEARS?c("save_percent_promo"):p.label})]}),(0,t.jsx)(er.Badge,{variant:"completed",className:"w-fit rounded-xs px-2 py-0.5 text-xs font-bold",children:c("save_percent",{percent:v?100:f})})]}),(0,t.jsx)("div",{className:"flex flex-col items-end gap-0.5",children:(0,t.jsxs)("div",{className:"flex items-start",children:[(0,t.jsx)("span",{className:"text-foreground mt-0.5 text-sm leading-none",children:"$"}),(0,t.jsx)("span",{className:"text-foreground text-2xl leading-none font-bold",children:v?((0,ee.parsePrice)(X.FREE_ACCESS_PRICE)??0).toFixed(2):h.value.toFixed(2)})]})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"text-foreground text-base font-semibold",children:u(m.interval===q.PLAN_INTERVAL.YEARS?"total_due_promo":"total_due")}),(0,t.jsx)("span",{className:"text-foreground text-xl leading-none font-bold",children:m.label})]});return s[2]!==a||s[3]!==b?(i=(0,t.jsx)("div",{className:a,children:b}),s[2]=a,s[3]=b,s[4]=i):i=s[4],i};function ei(e){return e.isCouponFreeAccess}var es=e.i(818644),en=e.i(20510);let el=e=>{let a,i,l,d,m,p,f,g,b=(0,r.c)(20),{className:S}=e,{bookSlug:_}=(0,en.useReaderBookPath)(),w=(0,s.useLocale)(),N=(0,n.useTranslations)("payment.form.email_inline"),j=(0,v.useUserInfoSubscriptionStore)(eo),k=(0,v.useUserInfoSubscriptionStore)(eu),T=!!_;b[0]!==_||b[1]!==T?(a={bookSlug:_,autoTrack:T},b[0]=_,b[1]=T,b[2]=a):a=b[2],(0,es.useAbGatePositioningExperiment)(a),b[3]!==_?(i={content_value:"email_gate",paywall_type:x.EStatsigGroup.AB_READER_PAYWALL_INLINE,..._?{book_slug:_}:{}},b[3]=_,b[4]=i):i=b[4],(0,E.useMixpanelLoadComponent)(y.EMixpanelEvent.ELEMENT_OPENED,i),b[5]!==w?(l={mutationFn:async e=>{if((0,h.createUserSubscriptionToken)(e),await (0,h.handleSubscriptionStatusInline)(e,{locale:w}))return}},b[5]=w,b[6]=l):l=b[6];let P=(0,o.useMutation)(l);b[7]!==P?(d=async e=>{await P.mutateAsync(e.email.trim())},b[7]=P,b[8]=d):d=b[8];let C=d;b[9]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)(c.PaymentHeaderComponent,{variant:"emailPayment",className:"mb-8"}),b[9]=m):m=b[9],b[10]!==N?(p=N("continue"),b[10]=N,b[11]=p):p=b[11];let R=j||"";return b[12]!==C||b[13]!==k||b[14]!==p||b[15]!==R?(f=(0,t.jsx)(u.EmailCaptureFormComponent,{buttonText:p,onSubmit:C,defaultEmail:R,inputId:"payment-inline-email",isLoading:k}),b[12]=C,b[13]=k,b[14]=p,b[15]=R,b[16]=f):f=b[16],b[17]!==S||b[18]!==f?(g=(0,t.jsxs)("div",{"data-no-reader-toggle":"true",className:S,children:[m,f]}),b[17]=S,b[18]=f,b[19]=g):g=b[19],g};function eo(e){return e.email}function eu(e){return e.sessionTokenLoading}var ec=e.i(742642),ed=e.i(716428);e.i(802943);var em=e.i(833323),ep=e.i(626289);let ef=e=>{let t,a,i,s=(0,r.c)(7),{email:n,book:l}=e;return s[0]!==l?(t=l&&{book_slug:l.slug,book_id:l.id},s[0]=l,s[1]=t):t=s[1],s[2]!==n?(a=n&&{user_email:n},s[2]=n,s[3]=a):a=s[3],s[4]!==t||s[5]!==a?(i={experiment:x.EStatsigExperiment.AB_PAYWALL_PLACEMENT,additionalEventProperties:{...t,...a}},s[4]=t,s[5]=a,s[6]=i):i=s[6],(0,ep.useTrackExperiment)(i),null};e.i(296665);var ex=e.i(872560),eh=e.i(113391),eg=e.i(682829),ev=e.i(379293),eb=e.i(457882),eS=e.i(649896),eE=e.i(777078),ey=e.i(947736),e_=e.i(206185),ew=e.i(315042),eN=e.i(470329);e.i(943665);var ej=e.i(423920);e.i(895620);var ek=e.i(830185),eT=e.i(353961);let eP=e=>{let a,i,s,l,o,u,d,p,f,x,h,g,b,S,E,y=(0,r.c)(39),w=(0,n.useTranslations)("payment.form"),{children:N,trial:T,className:P,book:C,showPastDueNotice:R,email:I}=e,{setContentRef:L,endRef:M}=(0,H.useInlinePaywallScroll)(C),{getPaywallOpenCallbackURL:U}=(0,j.usePaywall)(),O=(0,v.useUserInfoSubscriptionStore)(eC),B=I||O,{navigateToNextPage:G}=(0,m.useNavigationEvent)();y[0]!==P?(a=(0,_.cn)("relative mx-auto w-full max-w-3xl",P),y[0]=P,y[1]=a):a=y[1],y[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)(c.PaymentHeaderComponent,{variant:"payment"}),y[2]=i):i=y[2];let z=C?.slug;return y[3]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(D.SocialProofAvatarsComponent,{}),y[3]=s):s=y[3],y[4]!==z?(l=(0,t.jsx)(F.SocialProofInlineComponent,{bookSlug:z,children:s}),y[4]=z,y[5]=l):l=y[5],y[6]!==R||y[7]!==w?(o=R&&(0,t.jsx)(eT.PaymentPastDueNoticeComponent,{title:w("past_due_title"),description:w("past_due_description")}
2),y[6]=R,y[7]=w,y[8]=o):o=y[8],y[9]!==T?(u=(0,t.jsx)(ea,{trial:T,className:"mt-1"}),y[9]=T,y[10]=u):u=y[10],y[11]!==U?(d=U(),y[11]=U,y[12]=d):d=y[12],y[13]!==G?(p=()=>{G()},y[13]=G,y[14]=p):p=y[14],y[15]!==B||y[16]!==d||y[17]!==p?(f=(0,t.jsx)(A.Suspense,{fallback:null,children:(0,t.jsx)(ek.DiscountCouponComponent,{emailProp:B,callbackURL:d,onCouponSuccess:p})}),y[15]=B,y[16]=d,y[17]=p,y[18]=f):f=y[18],y[19]!==N?(x=(0,t.jsx)("div",{children:N}),y[19]=N,y[20]=x):x=y[20],y[21]!==T?(h=(0,t.jsx)(V.PaymentTermsSectionComponent,{trial:T}),y[21]=T,y[22]=h):h=y[22],y[23]!==x||y[24]!==h||y[25]!==l||y[26]!==o||y[27]!==u||y[28]!==f?(g=(0,t.jsx)(k.Card,{className:"bg-background w-full gap-0 rounded-3xl border-none p-3 px-0 shadow-none sm:p-4",children:(0,t.jsxs)(k.CardContent,{className:"space-y-4 p-0",children:[l,o,u,f,x,h]})}),y[23]=x,y[24]=h,y[25]=l,y[26]=o,y[27]=u,y[28]=f,y[29]=g):g=y[29],y[30]!==M?(b=(0,t.jsx)(K,{ref:M}),y[30]=M,y[31]=b):b=y[31],y[32]!==L||y[33]!==g||y[34]!==b?(S=(0,t.jsxs)("div",{ref:L,children:[g,b," "]}),y[32]=L,y[33]=g,y[34]=b,y[35]=S):S=y[35],y[36]!==a||y[37]!==S?(E=(0,t.jsxs)("div",{className:a,children:[i,S]}),y[36]=a,y[37]=S,y[38]=E):E=y[38],E};function eC(e){return e.email}let eR=e=>{let a,i,s,l,o,u,c,d,p,h,b,E,y,_,w,N,j=(0,r.c)(58),{className:k,book:T,userStatus:P}=e,C=!!(0,ew.useSpecialPlanStore)(eA);j[0]!==C?(a={disabled:C},j[0]=C,j[1]=a):a=j[1];let{isMultiPlan:R}=(0,z.useMultiPlanSelection)(a),I=(0,n.useTranslations)("payment.form"),{navigateToNextPage:L}=(0,m.useNavigationEvent)(),M=(0,S.useRouter)(),U=(0,g.useMultiViewModalStore)(eI);j[2]!==U?(i=U(f.EModalViewKey.SUBSCRIBE),j[2]=U,j[3]=i):i=j[3];let O=i;j[4]!==O?(s=O||{},j[4]=O,j[5]=s):s=j[5];let{origin:B}=s,D=void 0===B?ey.EOriginType.READER:B,F=(0,g.useMultiViewModalStore)(eL),G=(0,g.useMultiViewModalStore)(eM),V=(0,eE.useUserSubscriptionStatus)();j[6]!==V||j[7]!==P?(l=P??{status:V.status??ed.EUserSubscriptionStatusCheck.NOT_FOUND,hasUsedTrial:V.hasUsedTrial??!1,hasSubscription:V.hasSubscription??!1,email:V.email??"",subscription:V.subscription??null},j[6]=V,j[7]=P,j[8]=l):l=j[8];let H=l,K=(0,v.useUserInfoSubscriptionStore)(eU),Y=H.email||K,{hasUsedTrial:Q,status:W,hasSubscription:q,subscription:X}=H,J=X?.status===ec.ESubscriptionStatus.PAST_DUE,Z=!Q;j[9]!==T.slug?(o=ex.userSegment.getPaywallContext(T?.slug),j[9]=T.slug,j[10]=o):o=j[10];let ee=o,et=T.genres?.[0],er=ee?.sessionNumber,ea=ee?.milestoneReached;j[11]!==T.slug||j[12]!==q||j[13]!==Q||j[14]!==et||j[15]!==er||j[16]!==ea?(u={bookSlug:T.slug,genre:et,hasUsedTrial:Q,hasSubscription:q,paywallType:x.EStatsigGroup.AB_READER_PAYWALL_INLINE,sessionNumber:er,milestoneReached:ea},j[11]=T.slug,j[12]=q,j[13]=Q,j[14]=et,j[15]=er,j[16]=ea,j[17]=u):u=j[17],(0,eS.usePaywallOpenedTracker)(u),j[18]===Symbol.for("react.memo_cache_sentinel")?(c=[],j[18]=c):c=j[18],(0,A.useEffect)(eO,c),j[19]!==G||j[20]!==F||j[21]!==L||j[22]!==M||j[23]!==I?(d=async(e,t)=>{e_.useCheckoutStore.getState().setIsPaymentSubmitting(!1),t?F({value:f.EModalViewKey.SUBSCRIBE_SUCCESS_NEW_USER,metadata:{email:e.customer?.email??"",afterAction:"sendWelcomeEmail",preventCloseOnPathChange:!0,navigateNextPage:!1}}):(eb.toast.success({message:I("payment_success")}),G(),L(),M.refresh())},j[19]=G,j[20]=F,j[21]=L,j[22]=M,j[23]=I,j[24]=d):d=j[24];let ei=d;j[25]!==T||j[26]!==Y?(p=(0,t.jsx)(ef,{email:Y,book:T}),j[25]=T,j[26]=Y,j[27]=p):p=j[27];let es=W!==ed.EUserSubscriptionStatusCheck.USER_EXISTS;j[28]!==I?(h=()=>{e_.useCheckoutStore.getState().setIsPaymentSubmitting(!1),eb.toast.error({message:I("errorSubscribe"),id:ej.EToasterId.DIALOG_TOASTER})},j[28]=I,j[29]=h):h=j[29],j[30]!==T||j[31]!==Y||j[32]!==ei||j[33]!==D||j[34]!==X||j[35]!==es||j[36]!==h?(b=(0,t.jsx)(em.SubscribePaymentFormComponent,{book:T,origin:D,email:Y,newUser:es,subscription:X,onSuccess:ei,onError:h}),j[30]=T,j[31]=Y,j[32]=ei,j[33]=D,j[34]=X,j[35]=es,j[36]=h,j[37]=b):b=j[37],j[38]!==p||j[39]!==b?(E=(0,t.jsxs)(t.Fragment,{children:[p,b]}),j[38]=p,j[39]=b,j[40]=E):E=j[40];let en=E,el=W??ed.EUserSubscriptionStatusCheck.NOT_FOUND,eo=!!q,eu=Y??"";return j[41]!==el||j[42]!==eo||j[43]!==eu?(y=(0,t.jsx)(eg.PaymentExistingUserGateComponent,{status:el,hasSubscription:eo,email:eu}),j[41]=el,j[42]=eo,j[43]=eu,j[44]=y):y=j[44],j[45]!==T||j[46]!==en||j[47]!==Y||j[48]!==R||j[49]!==J||j[50]!==Z?(_=R?(0,t.jsx)($,{book:T,trial:Z,children:en}):(0,t.jsx)(eP,{email:Y,trial:Z,showPastDueNotice:J,book:T,children:en}),j[45]=T,j[46]=en,j[47]=Y,j[48]=R,j[49]=J,j[50]=Z,j[51]=_):_=j[51],j[52]!==k||j[53]!==_?(w=(0,t.jsx)(ev.PaymentSubmittingContainerComponent,{className:k,children:_}),j[52]=k,j[53]=_,j[54]=w):w=j[54],j[55]!==y||j[56]!==w?(N=(0,t.jsxs)(t.Fragment,{children:[y,w]}),j[55]=y,j[56]=w,j[57]=N):N=j[57],N};function eA(e){return e.promoData}function eI(e){return e.getTypeContext}function eL(e){return e.handleOpen}function eM(e){return e.handleClose}function eU(e){return e.email}function eO(){let e=ex.userSegment.getUserSegmentForPaywall();if(e&&e.userState!==eh.EUserSegmentType.UNCLASSIFIED){let t=ex.userSegment.getSegmentOrigin();eN.mixpanelService.track(y.EMixpanelEvent.USER_SEGMENT,{user_segment:e.userState,user_reason:e.reason,segment_session_origin:t?.userState??null,segment_origin_session_number:t?.sessionNumber??null})}}let eB=()=>{let e=(0,r.c)(24),{decision:i,shouldShowPaywall:s,showContentFadeOverlay:n,book:l,chapterNumber:o,session:u}=(0,R.useInlinePaywall)(),c=(0,v.useUserInfoSubscriptionStore)(eD);
2if(!s||!i||!l||!o)return null;if(i.reason===a.EChapterLockType.REGISTER){let r,a;return e[0]!==l.slug?(r=(0,t.jsx)(N,{bookSlug:l.slug,className:"mb-10"}),e[0]=l.slug,e[1]=r):r=e[1],e[2]!==i.reason||e[3]!==r?(a=(0,t.jsx)(U,{reason:i.reason,children:r}),e[2]=i.reason,e[3]=r,e[4]=a):a=e[4],a}if(i.reason===a.EChapterLockType.SUBSCRIPTION){let r,a,s,o,d=i.metadata;if(!u&&d?.userStatus?.subscription?.exist){let r,a,s=d.userStatus?.email,n=d.userStatus?.hasSubscription;return e[5]!==s||e[6]!==n?(r=(0,t.jsx)(T,{email:s,hasActiveSubscription:n}),e[5]=s,e[6]=n,e[7]=r):r=e[7],e[8]!==i.reason||e[9]!==r?(a=(0,t.jsx)(U,{reason:i.reason,children:r}),e[8]=i.reason,e[9]=r,e[10]=a):a=e[10],a}let m=i.reason,p=n&&"-mt-[350px]";return e[11]!==p?(r=(0,_.cn)("bg-background relative",p),e[11]=p,e[12]=r):r=e[12],e[13]!==n?(a=n&&(0,t.jsx)(C.default,{className:"-mt-[350px] h-[350px]",height:350}),e[13]=n,e[14]=a):a=e[14],e[15]!==l||e[16]!==d?.userStatus||e[17]!==c?(s=c?(0,t.jsx)(eR,{book:l,userStatus:d?.userStatus}):(0,t.jsx)(el,{className:"mx-auto w-full max-w-3xl"}),e[15]=l,e[16]=d?.userStatus,e[17]=c,e[18]=s):s=e[18],e[19]!==i.reason||e[20]!==r||e[21]!==a||e[22]!==s?(o=(0,t.jsxs)(U,{reason:m,className:r,children:[a,s]}),e[19]=i.reason,e[20]=r,e[21]=a,e[22]=s,e[23]=o):o=e[23],o}return null};function eD(e){return e.email}},768144,368421,e=>{"use strict";let t="70px",r="0px 0px 100px 0px";e.s(["PAYWALL_SCROLL_BOTTOM_LINE",0,r,"PAYWALL_SCROLL_MARGIN_TOP",0,t],768144);var a=e.i(500932),i=e.i(271645);e.i(249205);var s=e.i(23639);e.i(301714);var n=e.i(693299);e.i(752189);var l=e.i(773862),o=e.i(470329);e.s(["useInlinePaywallScroll",0,e=>{let u,c,d,m,p,f,x,h=(0,a.c)(17),g=(0,i.useRef)(null),v=(0,i.useRef)(null),b=(0,i.useRef)(!1),S=(0,i.useRef)(!1),{showPaymentForm:E,setHidePaymentForm:y}=(0,s.usePaywall)();h[0]!==y?(u=e=>{y();let r=e.style.scrollMarginTop;e.style.scrollMarginTop=t,e.scrollIntoView({behavior:"instant",block:"start"}),e.style.scrollMarginTop=r},h[0]=y,h[1]=u):u=h[1];let _=u;h[2]!==_||h[3]!==E?(c=e=>{g.current=e,e&&E&&!S.current&&(S.current=!0,_(e))},h[2]=_,h[3]=E,h[4]=c):c=h[4];let w=c;h[5]!==e?.id||h[6]!==e?.slug?(d=()=>{b.current=!1;let t=v.current;if(!t)return;let a=new IntersectionObserver(t=>{let[r]=t;r?.isIntersecting&&!b.current&&(b.current=!0,o.mixpanelService.track(l.EMixpanelPaywallInlineEvents.PAYWALL_INLINE_SCROLLED,{book_id:e?.id,book_slug:e?.slug,paywall_type:n.EStatsigGroup.AB_READER_PAYWALL_INLINE}),a.disconnect())},{root:null,rootMargin:r,threshold:0});return a.observe(t),()=>a.disconnect()},h[5]=e?.id,h[6]=e?.slug,h[7]=d):d=h[7];let N=e?.id,j=e?.slug;return h[8]!==N||h[9]!==j?(m=[N,j],h[8]=N,h[9]=j,h[10]=m):m=h[10],(0,i.useEffect)(d,m),h[11]!==_||h[12]!==E?(p=()=>
2{if(!E){S.current=!1;return}let e=g.current;e&&!S.current&&(S.current=!0,_(e))},f=[_,E],h[11]=_,h[12]=E,h[13]=p,h[14]=f):(p=h[13],f=h[14]),(0,i.useEffect)(p,f),h[15]!==w?(x={setContentRef:w,endRef:v},h[15]=w,h[16]=x):x=h[16],x}],368421)},692743,e=>{"use strict";var t=e.i(843476),r=e.i(500932),a=e.i(861745),i=e.i(948148),s=e.i(266027);e.i(577063);var n=e.i(421562);e.i(249205);var l=e.i(626289);e.i(301714);var o=e.i(693299);e.i(142936);var u=e.i(430665),c=e.i(82861),d=e.i(204110),m=e.i(203228),p=e.i(190819);function f(e){return e.emotions}function x(e,t){return e+t.count}e.s(["default",0,e=>{let h,g,v,b,S,E,y,_,w=(0,r.c)(18),{chapterId:N,bookSlug:j,chapterPage:k,className:T}=e,P=(0,a.useLocale)(),C=(0,i.useTranslations)("reader.chapter_reactions");w[0]===Symbol.for("react.memo_cache_sentinel")?(h={experiment:o.EStatsigExperiment.AB_EMOTIONS,autoTrack:!1},w[0]=h):h=w[0];let{variationId:R}=(0,l.useTrackExperiment)(h),A=R===o.EStatsigGroup.TEST,I=`${j}:${k}`,L=(0,u.useChapterEmotionsStore)(f)[I]??{};w[1]!==N||w[2]!==P?(g=(0,n.chapterReactionsQueryOptions)({chapterId:N,locale:P}),w[1]=N,w[2]=P,w[3]=g):g=w[3];let M=A&&!!N;w[4]!==g||w[5]!==M?(v={...g,enabled:M},w[4]=g,w[5]=M,w[6]=v):v=w[6];let{data:U}=(0,s.useQuery)(v);if(!A)return null;let O=(0,p.buildReactionCountMap)(U?.reactions,L),B=(0,p.buildReactionStats)(O),D=B.reduce(x,0),F=(0,p.getLocalReactionCount)(L);if(0===D)return null;let G=B[0],V=Math.round(G.count/D*100),z=(0,p.getReactionSummaryKey)(F);w[7]!==T?(b=(0,c.cn)("bg-muted/35 border-border/70 mt-8 gap-0 rounded-[28px] px-1 py-0 shadow-none backdrop-blur-sm",T),w[7]=T,w[8]=b):b=w[8],w[9]!==C?(S=C("description"),w[9]=C,w[10]=S):S=w[10],w[11]!==S?(E=(0,t.jsx)(m.CardDescription,{className:"text-muted-foreground text-sm",children:S}),w[11]=S,w[12]=E):E=w[12],w[13]!==D?(y=e=>{let r=Math.round(e.count/D*100);return(0,t.jsxs)(d.Badge,{variant:"light",className:"text-foreground border-border rounded-full border px-2 py-2 text-sm font-medium shadow-none",children:[(0,t.jsx)("span",{className:"text-sm leading-none",children:e.label}),(0,t.jsxs)("span",{children:[r,"%"]})]},e.reactionKey)},w[13]=D,w[14]=y):y=w[14];let H=m.CardContent,K=F>0&&(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:C(`summary.${z}`,{count:F})});return w[15]!==H||w[16]!==K?(_=(0,t.jsx)(H,{className:"px-5 pt-0 pb-5 sm:px-6",children:K}),w[15]=H,w[16]=K,w[17]=_):_=w[17],(0,t.jsx)("div",{children:(0,t.jsxs)(m.Card,{className:b,children:[(0,t.jsxs)(m.CardHeader,{className:"gap-3 px-5 pt-5 pb-3 sm:px-6",children:[(0,t.jsx)(m.CardTitle,{className:"text-foreground text-xl leading-tight font-semibold tracking-tight sm:text-2xl",children:C("title",{percent:V,reaction:G.label,chapter:k})}),E]}),(0,t.jsx)(m.CardContent,{className:"flex flex-wrap gap-1 px-5 pb-4 sm:px-6",children:B.map(y)}),_]})})}])},6299,e=>{"use strict";var t=e.i(843476),r=e.i(500932),a=e.i(409797),i=e.i(54131),s=e.i(948148),n=e.i(271645),l=e.i(82861),o=e.i(602177);e.s(["default",0,e=>{let u,c,d,m,p,f,x,h,g,v,b,S,E=(0,r.c)(34),{isLoading:y,onRetry:_,direction:w,shouldShowRetry:N,className:j,triggerRef:k}=e,T=(0,s.useTranslations)("reader"),P=(0,n.useRef)(null),C="previous"===w?i.ChevronUpIcon:a.ChevronDownIcon;if(E[0]!==w||E[1]!==y||E[2]!==N?(u=()=>{if(!N||y)return;let e=window.requestAnimationFrame(()=>{let e=P.current;if(!e)return;let{top:t,bottom:r}=e.getBoundingClientRect();t>=0&&r<=window.innerHeight||e.scrollIntoView({behavior:"smooth",block:"previous"===w?"start":"end"})});return()=>window.cancelAnimationFrame(e)},c=[w,y,N],E[0]=w,E[1]=y,E[2]=N,E[3]=u,E[4]=c):(u=E[3],c=E[4]),(0,n.useEffect)(u,c),!N){let e;return E[5]!==k?(e=(0,t.jsx)("div",{ref:k,className:"pointer-events-none h-1"}),E[5]=k,E[6]=e):e=E[6],e}return E[7]!==j?(d=(0,l.cn)("mx-auto h-auto p-0 hover:bg-transparent",j),E[7]=j,E[8]=d):d=E[8],E[9]!==T?(m=T("tap_to_retry"),E[9]=T,E[10]=m):m=E[10],E[11]!==j?(p=(0,l.cn)("flex flex-col items-center justify-center gap-3",j),E[11]=j,E[12]=p):p=E[12],E[13]!==C?(f=(0,t.jsx)("div",{className:"border-muted-foreground flex h-12 w-12 items-center justify-center rounded-full border-4",children:(0,t.jsx)(C,{size:6})}),E[13]=C,E[14]=f):f=E[14],E[15]!==T?(x=T("loading_failed"),E[15]=T,E[16]=x):x=E[16],E[17]!==x?(h=(0,t.jsx)("p",{className:"text-foreground text-center text-sm font-medium",children:x}),E[17]=x,E[18]=h):h=E[18],E[19]!==T?(g=T("tap_to_retry"),E[19]=T,E[20]=g):g=E[20],E[21]!==g?(v=(0,t.jsx)("p",{className:"text-muted-foreground text-center text-sm",children:g}),E[21]=g,E[22]=v):v=E[22],E[23]!==p||E[24]!==f||E[25]!==h||E[26]!==v?(b=(0,t.jsxs)("div",{className:p,children:[f,h,v]}),E[23]=p,E[24]=f,E[25]=h,E[26]=v,E[27]=b):b=E[27],E[28]!==y||E[29]!==_||E[30]!==b||E[31]!==d||E[32]!==m?(S=(0,t.jsx)("div",{ref:P,className:"flex justify-center",children:(0,t.jsx)(o.Button,{type:"button",variant:"ghost",onClick:_,disabled:y,className:d,"aria-label":m,children:b})}),E[28]=y,E[29]=_,E[30]=b,E[31]=d,E[32]=m,E[33]=S):S=E[33],S}])},477015,e=>{"use strict";var t=e.i(843476),r=e.i(500932),a=e.i(861745),i=e.i(271645),s=e.i(621482),n=e.i(879814);e.i(284969);var l=e.i(133894);e.i(301714);var o=e.i(639491);e.i(300212);var u=e.i(548774);let c=async(e,t,r,a)=>{let{locale:i="en"}=a||{},s=(0,n.stringify)({bookSlug:t,chapterPage:r,locale:i});
2try{let t=await fetch(`/api/chapters/content?${s}`,{signal:e.signal,credentials:"include"});if(!t.ok&&403!==t.status)throw new o.ApiError(l.EError.FAILED_FETCHING_CHAPTER);return await t.json()}catch(e){return await (0,u.handleHttpError)(e)}};e.i(932921);var d=e.i(744359),m=e.i(548389);e.i(299640);var p=e.i(32397);e.i(249205);var f=e.i(133873),x=e.i(562203);e.i(142936);var h=e.i(756686);e.i(466270);var g=e.i(573319),v=e.i(887992),b=e.i(82861),S=e.i(6299),E=e.i(395769);let y=e=>{let a,i,s=(0,r.c)(5),{title:n,className:l}=e;return s[0]!==l?(a=(0,b.cn)("m-0 text-left text-lg font-bold md:text-xl",l),s[0]=l,s[1]=a):a=s[1],s[2]!==a||s[3]!==n?(i=(0,t.jsx)("h3",{id:"reader-title",className:a,children:n}),s[2]=a,s[3]=n,s[4]=i):i=s[4],i},_=e=>{let a,i,s,n,l,o=(0,r.c)(14),{title:u,children:c,classNames:d}=e,m=d?.container;o[0]!==m?(a=(0,b.cn)("mb-8 w-full",m),o[0]=m,o[1]=a):a=o[1],o[2]!==d?.title||o[3]!==u?(i=u&&(0,t.jsx)(y,{title:u,className:(0,b.cn)("my-4!",d?.title)}),o[2]=d?.title,o[3]=u,o[4]=i):i=o[4];let p=d?.content;return o[5]!==p?(s=(0,b.cn)("mt-7 flex flex-col gap-4 md:mt-0 md:mb-10",p),o[5]=p,o[6]=s):s=o[6],o[7]!==c||o[8]!==s?(n=(0,t.jsx)(E.default,{children:(0,t.jsx)("div",{className:s,children:c})}),o[7]=c,o[8]=s,o[9]=n):n=o[9],o[10]!==a||o[11]!==i||o[12]!==n?(l=(0,t.jsx)("section",{children:(0,t.jsxs)("div",{className:a,children:[i,n]})}),o[10]=a,o[11]=i,o[12]=n,o[13]=l):l=o[13],l};var w=e.i(484888),N=e.i(39839);e.i(179770);var j=e.i(833737),k=e.i(948148),T=e.i(218669);let P=()=>{let e,a,i,s=(0,r.c)(5),n=(0,k.useTranslations)("common");return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(T.Spinner,{className:"text-muted-foreground h-8 w-8"}),s[0]=e):e=s[0],s[1]!==n?(a=n("loading"),s[1]=n,s[2]=a):a=s[2],s[3]!==a?(i=(0,t.jsxs)("div",{className:"mb-2 flex justify-center pb-6",children:[e,(0,t.jsx)("span",{className:"sr-only",children:a})]}),s[3]=a,s[4]=i):i=s[4],i};var C=e.i(968673),R=e.i(867887),A=e.i(206079),I=e.i(643540),L=e.i(209849),M=e.i(772765);let U=e=>{let a,i,s,n,l,o,u=(0,r.c)(15),{chapterPage:c,className:d,ref:m}=e,p=(0,k.useTranslations)("reader"),f=`chapter-${c}`,x=1===c;return u[0]!==d||u[1]!==x?(a=(0,b.cn)("my-4 flex scroll-mt-16 items-center gap-3",d,{"-my-7 opacity-0":x}),u[0]=d,u[1]=x,u[2]=a):a=u[2],u[3]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)(M.Separator,{className:"flex-1 border"}),u[3]=i):i=u[3],u[4]!==c||u[5]!==p?(s=p("short_chapter",{chapter:c}),u[4]=c,u[5]=p,u[6]=s):s=u[6],u[7]!==s?(n=(0,t.jsx)("span",{className:"text-muted-foreground text-sm tracking-wide",children:s}),u[7]=s,u[8]=n):n=u[8],u[9]===Symbol.for("react.memo_cache_sentinel")?(l=(0,t.jsx)(M.Separator,{className:"flex-1 border"}),u[9]=l):l=u[9],u[10]!==m||u[11]!==f||u[12]!==a||u[13]!==n?(o=(0,t.jsxs)("div",{ref:m,id:f,className:a,children:[i,n,l]}),u[10]=m,u[11]=f,u[12]=a,u[13]=n,u[14]=o):o=u[14],o},O=e=>{let a,s,n,l,o,u,c,d,m,p,f,x,h=(0,r.c)(38),{chapterPage:g,activePage:v,bookId:b,isEnabled:S,currentRoutePage:E,hasPassedInitialRouteActivation:y,setHasPassedInitialRouteActivation:_,setActivePage:w}=e;h[0]===Symbol.for("react.memo_cache_sentinel")?(a={threshold:0,rootMargin:"0px 0px -25% 0px"},h[0]=a):a=h[0];let{isIntersecting:j,ref:k}=(0,N.useIntersectionObserver)(a),{updateBook:T}=(0,A.useUserBook)(b),P=(0,L.useReadingBarStore)(B);(0,I.useReaderStore)(D);let M=(0,i.useRef)(0),O=(0,i.useRef)(!1),F=(0,i.useRef)(!1),G=(0,i.useRef)(null),V=(0,i.useRef)(null),{navigateToPage:z}=(0,R.useNavigationEvent)();h[1]!==E||h[2]!==y||h[3]!==S||h[4]!==z||h[5]!==w||h[6]!==_||h[7]!==T||h[8]!==P?(s=e=>{!S||(y||e===E)&&(y||e!==E||_(!0),w(e),T({currentPage:e}),P({chapterPage:e.toString()}),z(e))},h[1]=E,h[2]=y,h[3]=S,h[4]=z,h[5]=w,h[6]=_,h[7]=T,h[8]=P,h[9]=s):s=h[9];let H=s;h[10]!==H||h[11]!==g||h[12]!==S||h[13]!==j?(n=()=>{S&&j&&H(g)},l=[S,j,g,H],h[10]=H,h[11]=g,h[12]=S,h[13]=j,h[14]=n,h[15]=l):(n=h[14],l=h[15]),(0,i.useEffect)(n,l),h[16]!==v||h[17]!==g||h[18]!==j?(o=()=>{if(v!==g){F.current=!1;return}j&&(F.current=!0)},u=[j,v,g],h[16]=v,h[17]=g,h[18]=j,h[19]=o,h[20]=u):(o=h[19],u=h[20]),(0,i.useEffect)(o,u),h[21]!==H||h[22]!==g?(c=()=>{let e=G.current;if(!e)return;let t=window.scrollY,r=t<M.current;if(M.current=t,!r){e.getBoundingClientRect().bottom<=0&&V.current&&(window.removeEventListener("scroll",V.current),V.current=null);return}let a=e.getBoundingClientRect();if(a.top<window.innerHeight&&a.bottom>0){O.current=!0;return}let i=a.top>=window.innerHeight;O.current&&i&&!(g-1<=0)&&(H(g-1),V.current&&(window.removeEventListener("scroll",V.current),V.current=null))},h[21]=H,h[22]=g,h[23]=c):c=h[23];let K=(0,C.useThrottledCallback)(c,200);return h[24]!==K?(d=()=>()=>{K.cancel(),V.current&&(window.removeEventListener("scroll",V.current),V.current=null)},m=[K],h[24]=K,h[25]=d,h[26]=m):(d=h[25],m=h[26]),(0,i.useEffect)(d,m),h[27]!==v||h[28]!==g||h[29]!==K||h[30]!==y||h[31]!==S||h[32]!==j?(f=()=>{if(!S||!y||g<=1||v!==g||!F.current)return;let e=document.getElementById(`chapter-${g}`);if(!e)return;G.current=e,O.current=O.current||j,M.current=window.scrollY;let t=()=>{K()};return V.current=t,window.addEventListener("scroll",t,{passive:!0}),()=>{G.current=null,K.cancel(),V.current===t&&(window.removeEventListener("scroll",t),V.current=null)}},p=[S,j,y,g,v,K],h[27]=v,h[28]=g,h[29]=K,h[30]=y,h[31]=S,h[32]=j,h[33]=p,h[34]=f):(p=h[33],f=h[34]),(0,i.useEffect)(f,p),h[35]!==g||h[36]!==k?(x=(0,t.jsx)(U,{chapterPage:g,ref:k}),h[35]=g,h[36]=k,h[37]=x):x=h[37],x};function B(e){return e.updateProgress}function D(e){return e.setCurrentChapter}let F=e=>{let a,i=(0,r.c)(4),{chapterPage:s,activePage:n,isEnabled:l}=e;if(!(l&&1>=Math.abs(s-n))){let e;return i[0]!==s?(e=(0,t.jsx)(U,{chapterPage:s}),i[0]=s,i[1]=e):e=i[1],e}return i[2]!==e?(a=(0,t.jsx)(O,{...e}),i[2]=e,i[3]=a):a=i[3],a};var G=e.i(692743);function V(e,t,r){if(!(r<=1))return r-1}function z(e,t){return(!(t instanceof o.ApiError)||t.message!==l.EError.GATE_LOCKED&&t.message!==l.EError.CHAPTER_NOT_FOUND)&&e<3}function H(e){return null!==e}e.s(["default",0,e=>{let n,u,E,k,T,C,R,A,I,L,M,U,O,B,D,K,Y,Q,W,$,q,X,J=(0,r.c)(88),{initialChapter:Z,bookSlug:ee,chapterPage:et,totalChapters:er,children:ea,bookId:ei,chaptersPreview:es,classNames:en}=e,el=(0,a.useLocale)(),[eo,eu]=(0,i.useState)(et),{emit:ec}=(0,v.useEventBus)(),[ed,em]=(0,i.useState)(1===et);J[0]!==ei?(n={bookId:ei},J[0]=ei,J[1]=n):n=J[1];let{unlockedChapterIds:ep}=(0,f.useTokenUnlockedChapters)(n);J[2]!==ee||J[3]!==et||J[4]!==el?(u=[d.EReaderQueryKey.READER_CHAPTERS,ee,el,et],J[2]=ee,J[3]=et,J[4]=el,J[5]=u):u=J[5],J[6]!==ee||J[7]!==es||J[8]!==ec||J[9]!==el?(E=async e=>{let t=es.find(t=>t.page===e.pageParam);if(!t)throw new o.ApiError(l.EError.CHAPTER_NOT_FOUND);let r=await c(e,ee,e.pageParam,{locale:el}),a=r?.decision.reason===m.EChapterLockType.REGISTER&&!h.useUserInfoSubscriptionStore.getState().emailDismissed;if(!r?.chapter||!r.decision.allow||a){if(a)ec(g.EEventBusEvent.PAGE_NAVIGATION_RESULT,{allow:!1,reason:m.EChapterLockType.REGISTER});else{let{email:a}=h.useUserInfoSubscriptionStore.getState(),i={};a&&(i=await (0,x.default)(a,!0)),ec(g.EEventBusEvent.PAGE_NAVIGATION_RESULT,{...r?.decision,metadata:{...r?.decision.metadata,chapterId:r?.decision.metadata?.chapterId??t.id,chapterNumber:r?.decision.metadata?.chapterNumber??e.pageParam,userStatus:{email:a,...i}}})}throw new o.ApiError(l.EError.GATE_LOCKED)}return r.chapter},J[6]=ee,J[7]=es,J[8]=ec,J[9]=el,J[10]=E):E=J[10],J[11]!==er?(k=(e,t,r)=>{if("number"!=typeof er||!(r>=er))return r+1},J[11]=er,J[12]=k):k=J[12],J[13]!==Z?(T=[Z],J[13]=Z,J[14]=T):T=J[14],J[15]!==et?(C=[et],J[15]=et,J[16]=C):C=J[16],J[17]!==T||J[18]!==C?(R={pages:T,pageParams:C},J[17]=T,J[18]=C,J[19]=R):R=J[19],J[20]!==et||J[21]!==u||J[22]!==E||J[23]!==k||J[24]!==R?(A={queryKey:u,queryFn:E,initialPageParam:et,getPreviousPageParam:V,getNextPageParam:k,initialData:R,refetchOnWindowFocus:!1,retryDelay:1e3,retry:z,retryOn
2Mount:!1},J[20]=et,J[21]=u,J[22]=E,J[23]=k,J[24]=R,J[25]=A):A=J[25];let{data:ef,error:ex,isFetchingNextPage:eh,isFetchingPreviousPage:eg,isFetchNextPageError:ev,isFetchPreviousPageError:eb,fetchNextPage:eS,fetchPreviousPage:eE,hasNextPage:ey,hasPreviousPage:e_}=(0,s.useInfiniteQuery)(A),ew=ex?.message!==l.EError.GATE_LOCKED&&ex?.message!==l.EError.CHAPTER_NOT_FOUND,eN=!!(ev&&ew&&!eh),ej=!!(eb&&ew&&!eg),ek=ef?.pageParams;J[26]!==es||J[27]!==ek?(I={pageParams:ek,chaptersPreview:es},J[26]=es,J[27]=ek,J[28]=I):I=J[28];let eT=(e=>{let{chaptersPreview:t,pageParams:r}=e,{data:a}=(0,j.useSession)(),i=r?.[r.length-1],s="number"==typeof i?t.find(e=>e.page===i+1):null,n=!!a?.user&&(0,x.checkUserSubscription)(a.user).hasSubscription;return!s||s.lockType===m.EChapterLockType.NONE||s.lockType===m.EChapterLockType.REGISTER||n?"0px 0px 300px 0px":"0px 0px 0px 0px"})(I);J[29]!==ef?.pageParams?(L=ef?.pageParams.at(-1),J[29]=ef?.pageParams,J[30]=L):L=J[30];let eP=L;if(J[31]!==es||J[32]!==eP||J[33]!==ep){let e="number"==typeof eP?es.find(e=>e.page===eP+1):null;M=e?.lockType===m.EChapterLockType.NONE||!!(e?.id&&ep.has(e.id)),J[31]=es,J[32]=eP,J[33]=ep,J[34]=M}else M=J[34];let eC=M;J[35]!==eC||J[36]!==eS||J[37]!==eE||J[38]!==ey||J[39]!==e_||J[40]!==Z.page||J[41]!==eh||J[42]!==eg||J[43]!==eT||J[44]!==eN||J[45]!==ej?(U={hasNextPage:ey,chapterPage:Z.page,allowNextPrefetch:eC,hasPreviousPage:e_,shouldPauseNextAutoFetch:eN,shouldPausePreviousAutoFetch:ej,isFetchingNextPage:eh,isFetchingPreviousPage:eg,nextRootMargin:eT,fetchNextPage:eS,fetchPreviousPage:eE},J[35]=eC,J[36]=eS,J[37]=eE,J[38]=ey,J[39]=e_,J[40]=Z.page,J[41]=eh,J[42]=eg,J[43]=eT,J[44]=eN,J[45]=ej,J[46]=U):U=J[46];let{nextRef:eR,prevRef:eA,isInitialScrollReady:eI}=(e=>{let t,a,s,n,l,o,u,c,d,m,p,f,h,g,v,b,S,E,y,_,w,k,T=(0,r.c)(63),{hasNextPage:P,hasPreviousPage:C,shouldPauseNextAutoFetch:R,shouldPausePreviousAutoFetch:A,isFetchingNextPage:I,isFetchingPreviousPage:L,chapterPage:M,allowNextPrefetch:U,nextRootMargin:O,fetchNextPage:B,fetchPreviousPage:D}=e,F=void 0===O?"0px 0px 300px 0px":O,{data:G}=(0,j.useSession)();T[0]!==F?(t={threshold:.5,rootMargin:F},T[0]=F,T[1]=t):t=T[1];let{isIntersecting:V,ref:z}=(0,N.useIntersectionObserver)(t);T[2]===Symbol.for("react.memo_cache_sentinel")?(a={threshold:1},T[2]=a):a=T[2];let{isIntersecting:H,ref:K}=(0,N.useIntersectionObserver)(a),Y=(0,i.useRef)(!1),Q=(0,i.useRef)(!1),W=(0,i.useRef)(0),$=(0,i.useRef)(!1),q=(0,i.useRef)(!1),X=(0,i.useRef)(null),J=(0,i.useRef)(!1);T[3]!==G?(s=!!G?.user&&(0,x.checkUserSubscription)(G.user).hasSubscription,T[3]=G,T[4]=s):s=T[4];let Z=(0,i.useRef)(s),[ee,et]=(0,i.useState)(1===M);T[5]!==G?(n=!!G?.user&&(0,x.checkUserSubscription)(G.user).hasSubscription,T[5]=G,T[6]=n):n=T[6];let er=n,[ea,ei]=(0,i.useState)(!1),[es,en]=(0,i.useState)(!1),el=er||void 0!==U&&U||ea;T[7]!==D||T[8]!==C||T[9]!==L?(l=()=>{C&&!L&&(X.current={scrollHeight:document.documentElement.scrollHeight,scrollY:window.scrollY},D?.({cancelRefetch:!1}))},T[7]=D,T[8]=C,T[9]=L,T[10]=l):l=T[10];let eo=l;return T[11]===Symbol.for("react.memo_cache_sentinel")?(o=()=>()=>{Y.current=!1,Q.current=!1,$.current=!1,X.current=null,J.current=!1},u=[],T[11]=o,T[12]=u):(o=T[11],u=T[12]),(0,i.useEffect)(o,u),T[13]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{W.current=window.scrollY;let e=()=>{let e=window.scrollY,t=e-W.current;2>Math.abs(t)||($.current=t>0,en(t<0),W.current=e)};return window.addEventListener("scroll",e,{passive:!0}),()=>{window.removeEventListener("scroll",e)}},d=[],T[13]=c,T[14]=d):(c=T[13],d=T[14]),(0,i.useEffect)(c,d),T[15]!==er?(m=()=>{if(er)return;let e=()=>{ei(!0)},t=t=>{("ArrowDown"===t.key||"PageDown"===t.key||" "===t.key||"Spacebar"===t.key)&&e()};return window.addEventListener("wheel",e,{passive:!0}),window.addEventListener("touchmove",e,{passive:!0}),window.addEventListener("keydown",t),()=>{window.removeEventListener("wheel",e),window.removeEventListener("touchmove",e),window.removeEventListener("keydown",t)}},p=[er],T[15]=er,T[16]=m,T[17]=p):(m=T[16],p=T[17]),(0,i.useEffect)(m,p),T[18]!==el||T[19]!==B||T[20]!==P||T[21]!==I||T[22]!==ee||T[23]!==V||T[24]!==R?(f=()=>{if(ee&&!R){if(!V){Y.current=!1;return}Y.current||!P||I||!$.current&&!q.current||el&&(Y.current=!0,q.current=!1,B?.())}},h=[ee,V,P,I,B,el,R],T[18]=el,T[19]=B,T[20]=P,T[21]=I,T[22]=ee,T[23]=V,T[24]=R,T[25]=f,T[26]=h):(f=T[25],h=T[26]),(0,i.useEffect)(f,h),T[27]!==B||T[28]!==P||T[29]!==er||T[30]!==I||T[31]!==ee||T[32]!==V||T[33]!==R?(g=()=>{if(ee&&!R){if(!er||Z.current===er){Z.current=er;return}Z.current=er,Y.current=!1,q.current=!0,V&&P&&!I&&(Y.current=!0,q.current=!1,B?.())}},v=[ee,er,V,P,I,B,R],T[27]=B,T[28]=P,T[29]=er,T[30]=I,T[31]=ee,T[32]=V,T[33]=R,T[34]=g,T[35]=v):(g=T[34],v=T[35]),(0,i.useEffect)(g,v),T[36]!==es||T[37]!==C||T[38]!==er||T[39]!==L||T[40]!==ee||T[41]!==H||T[42]!==eo||T[43]!==A?(b=()=>{if(ee&&!A){if(!H){Q.current=!1,en(!1);return}Q.current||!C||L||(er||es)&&(Q.current=!0,en(!1),eo())}},T[36]=es,T[37]=C,T[38]=er,T[39]=L,T[40]=ee,T[41]=H,T[42]=eo,T[43]=A,T[44]=b):b=T[44],T[45]!==es||T[46]!==C||T[47]!==er||T[48]!==L||T[49]!==ee||T[50]!==H||T[51]!==A?(S=[ee,H,C,L,A,er,es],T[45]=es,T[46]=C,T[47]=er,T[48]=L,T[49]=ee,T[50]=H,T[51]=A,T[52]=S):S=T[52],(0,i.useEffect)(b,S),T[53]!==L?(E=()=>
2{if(L||!X.current)return;let{scrollHeight:e,scrollY:t}=X.current,r=document.documentElement.scrollHeight-e;r>0&&window.scrollTo({top:t+r}),X.current=null},y=[L],T[53]=L,T[54]=E,T[55]=y):(E=T[54],y=T[55]),(0,i.useLayoutEffect)(E,y),T[56]!==M?(_=()=>{if(!M||J.current)return;if(1===M){window.scrollTo({top:0,behavior:"auto"}),J.current=!0,et(!0);return}let e=document.getElementById(`chapter-${M}`);if(!e)return;e.scrollIntoView({behavior:"auto",block:"start"}),J.current=!0;let t=window.setTimeout(()=>{et(!0)},120);return()=>window.clearTimeout(t)},w=[M],T[56]=M,T[57]=_,T[58]=w):(_=T[57],w=T[58]),(0,i.useEffect)(_,w),T[59]!==ee||T[60]!==z||T[61]!==K?(k={nextRef:z,prevRef:K,isInitialScrollReady:ee},T[59]=ee,T[60]=z,T[61]=K,T[62]=k):k=T[62],k})(U);J[47]!==eS||J[48]!==ey||J[49]!==eh?(O=()=>{!eh&&ey&&eS()},J[47]=eS,J[48]=ey,J[49]=eh,J[50]=O):O=J[50];let eL=O;J[51]!==eE||J[52]!==e_||J[53]!==eg?(B=()=>{!eg&&e_&&eE({cancelRefetch:!1})},J[51]=eE,J[52]=e_,J[53]=eg,J[54]=B):B=J[54];let eM=B;return J[55]!==eg||J[56]!==eA||J[57]!==eM||J[58]!==ej?(D=(0,t.jsx)(S.default,{direction:"previous",isLoading:eg,shouldShowRetry:ej,onRetry:eM,triggerRef:eA}),J[55]=eg,J[56]=eA,J[57]=eM,J[58]=ej,J[59]=D):D=J[59],J[60]!==eg?(K=eg&&(0,t.jsx)(P,{}),J[60]=eg,J[61]=K):K=J[61],J[62]===Symbol.for("react.memo_cache_sentinel")?(Y={container:"-mt-1",content:"mt-0",title:"pt-6! md:pt-0!"},J[62]=Y):Y=J[62],J[63]!==eo||J[64]!==ei||J[65]!==ee||J[66]!==et||J[67]!==ea||J[68]!==en?.richText||J[69]!==ef?.pages||J[70]!==ed||J[71]!==eI?(Q=ef?.pages.filter(H).map(e=>(0,t.jsxs)(i.Fragment,{children:[1===e.page&&ea,(0,t.jsx)(F,{activePage:eo,setActivePage:eu,bookId:ei,isEnabled:eI,chapterPage:e.page,currentRoutePage:et,hasPassedInitialRouteActivation:ed,setHasPassedInitialRouteActivation:em}),(0,t.jsxs)("div",{className:"mt-1",children:[e.title&&(0,t.jsx)(y,{title:e.title,className:1===e.page?"my-4! md:my-4!":void 0}),(0,t.jsx)("div",{className:(0,b.cn)("mt-7 md:mt-0"),children:(0,t.jsx)(w.default,{className:en?.richText,children:(0,t.jsx)(p.RichText,{data:e.content})})}),(0,t.jsx)(G.default,{chapterId:e.id,bookSlug:ee,chapterPage:e.page})]})]},e.id)),J[63]=eo,J[64]=ei,J[65]=ee,J[66]=et,J[67]=ea,J[68]=en?.richText,J[69]=ef?.pages,J[70]=ed,J[71]=eI,J[72]=Q):Q=J[72],J[73]!==Q?(W=(0,t.jsx)(_,{classNames:Y,children:Q}),J[73]=Q,J[74]=W):W=J[74],J[75]!==eh||J[76]!==eR||J[77]!==eL||J[78]!==eN?($=(0,t.jsx)(S.default,{direction:"next",isLoading:eh,shouldShowRetry:eN,onRetry:eL,triggerRef:eR,className:"pb-2"}),J[75]=eh,J[76]=eR,J[77]=eL,J[78]=eN,J[79]=$):$=J[79],J[80]!==eh?(q=eh&&(0,t.jsx)(P,{}),J[80]=eh,J[81]=q):q=J[81],J[82]!==D||J[83]!==K||J[84]!==W||J[85]!==$||J[86]!==q?(X=(0,t.jsxs)(t.Fragment,{children:[D,K,W,$,q]}),J[82]=D,J[83]=K,J[84]=W,J[85]=$,J[86]=q,J[87]=X):X=J[87],X}],477015)},484888,e=>{"use strict";var t=e.i(843476),r=e.i(500932);e.i(249205);var a=e.i(493255),i=e.i(82861);e.s(["default",0,e=>{let s,n,l,o=(0,r.c)(10),{children:u,className:c}=e,{settings:d}=(0,a.useUserSettings)(),{fontSize:m,lineSpacing:p,fontFamily:f}=d;return o[0]!==c?(s=(0,i.cn)("[&_p]:mb-[0.75em]!",c),o[0]=c,o[1]=s):s=o[1],o[2]!==f||o[3]!==m||o[4]!==p?(n={fontSize:m,lineHeight:p,fontFamily:f},o[2]=f,o[3]=m,o[4]=p,o[5]=n):n=o[5],o[6]!==u||o[7]!==s||o[8]!==n?(l=(0,t.jsx)("div",{className:s,style:n,children:u}),o[6]=u,o[7]=s,o[8]=n,o[9]=l):l=o[9],l}])},23383,e=>{"use strict";e.i(142936);var t=e.i(643540);function r(e){return e.currentChapter?.page}e.s(["default",0,e=>{let{children:a,isLastChapter:i,totalChapters:s}=e,n=(0,t.useReaderStore)(r)||0;return i||n>=s?a:null}])},271035,e=>{"use strict";var t=e.i(843476),r=e.i(929652),a=e.i(948148),i=e.i(271645),s=e.i(266027);e.i(218922);var n=e.i(592928);e.i(932921);var l=e.i(548389),o=e.i(716428);e.i(760756);var u=e.i(164177);e.i(249205);var c=e.i(138377),d=e.i(31529),m=e.i(23639),p=e.i(133873);e.i(301714);var f=e.i(637860),x=e.i(325020);e.i(300212);var h=e.i(824374),g=e.i(562203);e.i(142936);var v=e.i(12631),b=e.i(643540),S=e.i(209849),E=e.i(756686);e.i(179770);var y=e.i(833737);e.i(205852);var _=e.i(328973),w=e.i(773862),N=e.i(772765);e.s(["default",0,e=>{let{chapter:j,chapterId:k,reason:T,userStatus:P,previewText:C,title:R}=e,A=(0,a.useTranslations)("reader.notAllowed"),I=(0,d.useIsInlinePaywall)(),{setShowPaymentForm:L}=(0,m.usePaywall)(),M=(0,c.useHasUserSessionFlag)(),U=(0,v.useMultiViewModalStore)(e=>e.handleOpen),O=(0,v.useMultiViewModalStore)(e=>e.activeView?.value),B=(0,i.useRef)(!1),D=(0,i.useRef)(null),{data:F}=(0,y.useSession)(),G=(0,b.useReaderStore)(e=>e.book?.id),{data:V}=(0,s.useQuery)((0,n.getTokenBundlesQueryOptions)()),{data:z}=(0,s.useQuery)((0,n.getTokenBalanceQueryOptions)({enabled:M})),{isChapterUnlocked:H,isReady:K}=(0,p.useTokenUnlockedChapters)({bookId:G,chapterId:k}),Y=!!F?.user?.hasPurchasedTokens||(z?.balance??0)>0,Q=T===l.EChapterLockType.SUBSCRIPTION&&!!k&&Y,W=()=>{U((0,h.buildTokenUnlockView)({chapterId:k,chapterPage:j,cost:V?.tokensPerChapter}))},[$,q]=(0,i.useState)(!1),X=(0,E.useUserInfoSubscriptionStore)(e=>e.hydrationReady),J=(0,E.useUserInfoSubscriptionStore)(e=>e.setForceSideEffectsLoad),Z=(0,E.useUserInfoSubscriptionStore)(e=>e.email),ee=P?.email||Z,et=(0,S.useReadingBarStore)(e=>e.progress?.bookCover),er=k??(j?String(j):null);(0,i.useEffect)(()=>{J(!0)},[J]),(0,i.useEffect)(()=>{D.current=null,B.current=!1},[er]);let ea=async e=>{if(!H&&("autoEffect"!==e||!O)){if(Q)return void W();if(I&&"button"===e)return void L();if(T&&[l.EChapterLockType.REGISTER,l.EChapterLockType.SUBSCRIPTION].includes(T)&&!ee)return void U({value:x.EModalViewKey.EMAIL_GATEWAY,metadata:{userCheck:!0,...x.ModalViewKeyOptions[x.EModalViewKey.EMAIL_GATEWAY]}});if(T===l.EChapterLockType.SUBSCRIPTION&&ee){if("autoEffect"===e||P?.email){var t;return void(t=P?.email?{...P,email:ee}:{email:ee,hasSubscription:!1,hasUsedTrial:!1,status:o.EUserSubscriptionStatusCheck.NOT_FOUND,subscription:null},U({value:x.EModalViewKey.SUBSCRIBE,metadata:{...x.ModalViewKeyOptions[x.EModalViewKey.SUBSCRIBE],userStatus:t}}))}q(!0);try{await (0,g.handleSubscriptionStatusDialog)(ee,{userCheck:!0})}finally{q(!1)}}}},ei=(0,i.useEffectEvent)(ea);return(0,i.useEffect)(()=>{I||O||!X||!K||H||D.current!==er&&(D.current=er,ei("autoEffect"))},[et,T,ee,j,er,I,O,X,K,H,Q]),(0,i.useEffect)(()=>
2{if(I&&!O&&!B.current&&X&&K&&!H){if(B.current=!0,Q)return void W();L()}},[j,I,O,L,X,K,H,Q]),(0,t.jsxs)("div",{className:"bg-background items-center justify-center px-4",children:[(0,t.jsxs)("div",{className:"mt-20 text-left md:mt-15",children:[(0,t.jsx)("h1",{id:"reader-title",className:"m-4! mb-4 text-center text-xl font-semibold md:m-4! md:text-3xl",children:R}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"text-foreground line-clamp-3 overflow-hidden leading-relaxed",children:C}),(0,t.jsx)("div",{className:"from-background pointer-events-none absolute inset-x-0 bottom-0 h-24 bg-linear-to-t to-transparent"})]})]}),!I&&(0,t.jsx)("div",{className:"mt-20 flex w-full items-center justify-center bg-transparent",children:(0,t.jsxs)("div",{className:"bg-background text-foreground w-full max-w-md rounded-2xl text-center",children:[(0,t.jsxs)("div",{className:"mb-7 flex items-center gap-2",children:[(0,t.jsx)(N.Separator,{className:"flex-1"}),(0,t.jsxs)("span",{className:"text-muted-foreground/60 flex items-center gap-3",children:[(0,t.jsx)(N.Separator,{className:"w-3!"}),(0,t.jsx)(r.Sparkle,{size:16,strokeWidth:0,className:"shrink-0 [&_path]:fill-current [&_path]:stroke-none","aria-hidden":!0}),(0,t.jsx)(N.Separator,{className:"w-3!"})]}),(0,t.jsx)(N.Separator,{className:"flex-1"})]}),(0,t.jsx)("h1",{className:"mb-6! text-xl leading-7 font-semibold tracking-tight md:text-2xl",children:A("title")}),(0,t.jsx)(_.MixpanelEventComponent,{type:"click",event:{event:w.EMixpanelEvent.PAGE_CLICKED,properties:{content_value:"subscribe",content_group:f.EMixpanelContentGroups.REGULAR}},children:(0,t.jsx)(u.CtaButtonComponent,{className:"mt-2 min-w-60",disabled:$,isLoading:$,onClick:()=>void ea("button"),children:A("button")})})]})})]})}])},657919,e=>{"use strict";var t=e.i(500932);e.i(249205);var r=e.i(662303),r=r;e.i(301714);var a=e.i(325020),i=e.i(947736);e.s(["default",0,e=>{let s,n=(0,t.c)(2),l=e?.book||null;return n[0]!==l?(s={type:a.EModalViewKey.SUBSCRIBE,props:{origin:i.EOriginType.READER,originProps:{book:l}}},n[0]=l,n[1]=s):s=n[1],(0,r.default)(s),null}],657919)},423259,e=>{"use strict";var t=e.i(500932),r=e.i(271645);e.i(284969);var a=e.i(395625);e.i(249205);var i=e.i(181929),s=e.i(206079);e.i(142936);var n=e.i(643540);function l(e){return e.currentChapter?.page}function o(e){return e.scrollProgress}e.s(["default",0,e=>{let u,c,d,m,p=(0,t.c)(11),{bookId:f,chapterPage:x}=e,{updateBook:h,data:g}=(0,s.useUserBook)(f),v=(0,n.useReaderStore)(l),b=(0,n.useReaderStore)(o),S=(0,r.useRef)(null),E=(0,r.useRef)(null),y=(0,i.useMediaQuery)("(max-width: 767px)"),_=v??x,w=1===_?b>10:_!==g?.currentPage,N=1===_&&!g?.currentPage;return p[0]!==w||p[1]!==_||p[2]!==h?(u=()=>{w&&E.current!==_.toString()&&(E.current=_.toString(),h({currentPage:_}))},c=[w,h,_],p[0]=w,p[1]=_,p[2]=h,p[3]=u,p[4]=c):(u=p[3],c=p[4]),(0,r.useEffect)(u,c),p[5]!==y||p[6]!==N||p[7]!==_||p[8]!==h?(d=()=>{if(!N||E.current===_.toString()){S.current&&clearTimeout(S.current);return}return S.current=setTimeout(()=>{E.current!==_.toString()&&(E.current=_.toString(),h({currentPage:_}))},y?a.MOBILE_UPDATE_DELAY:a.DESKTOP_UPDATE_DELAY),()=>{S.current&&clearTimeout(S.current)}},m=[N,h,_,y],p[5]=y,p[6]=N,p[7]=_,p[8]=h,p[9]=d,p[10]=m):(d=p[9],m=p[10]),(0,r.useEffect)(d,m),null}])}]); 3 4//# debugId=dd818b17-3716-c055-d009-59fb1af60287 5//# sourceMappingURL=1fi4x-1p2ot81.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.