1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7010],{67143:function(e,o,t){t.d(o,{Fh:function(){return BookCover}});var i=t(35944),r=t(67294),n=t(66242),a=t(9974),l=t(83965),d=t(59225),c=t(75648),s=t(41664),h=t.n(s);t(25675);var u=t(27709),v=t(44267),p=t(23972),g=t(94855),b=t(707),x=t(28058),f=t(17420),m=t(78368),k=t(95429),w=t(46761),y=t(49185),Z=t(57765),B=t(50748),C=t(56445),S=t(8868),R=t(55754),N=t(23309),_=t(50438);let E=(0,c.Z)(e=>({root:{flexGrow:1,width:"100%",backgroundColor:e.palette.background.paper,cursor:"pointer"},bottomBar:{display:"flex",justifyContent:"center",alignItems:"center"},container:{color:"#000"},cardBook:{width:126,height:195,overflow:"initial",zIndex:1},cardBookDetails:{background:"transparent"},cardBookCoverDetails:{width:"113px !important",height:"169px !important",overflow:"hidden",margin:15},cardBookCover:{height:"100%",backgroundColor:"#eaeaea"},carouselSectionBooks:{width:"100%",height:300,whiteSpace:"nowrap",overflowX:"scroll",overflowY:"hidden",display:"inline-flex"},radius8:{borderRadius:8},radius2:{borderRadius:2},ellipsis:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},containerSectionBooks:{},gridList:{paddingTop:20,width:"100%",display:"flex",justifyContent:"center",alignItems:"center"},icon:{color:"rgba(255, 255, 255, 0.54)"},detailsRoot:{display:"flex",border:"1px solid #eaeaea",height:200,maxWidth:"500px",minWidth:320,boxShadow:"unset",cursor:"pointer",backgroundSize:"cover",overflow:"hidden",position:"relative",marginRight:10},imgCoverBg:{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:0,filter:"invert(0.2) brightness(1.6)",backgroundColor:"rgba(255,255,255,.2)",backgroundSize:"cover"},details:{display:"flex",flexDirection:"column"},content:{flex:"1 0 auto"},cover:{width:151},controls:{display:"flex",alignItems:"center",paddingLeft:e.spacing(1),paddingBottom:e.spacing(1)},playIcon:{height:38,width:38},transparentBackground:{background:"transparent",backdropFilter:"blur(30px)",border:"1px solid rgba(255,255,255,.4)"}}));function BookCover(e){var o;let{showBookDetails:t,item:c,width:s,height:z,index:I,style:D,start:W,transparentBackground:H,hideTitle:A}=e,[F,L]=(0,r.useState)(!1),{user:X}=(0,R.aF)(),{show:j}=(0,N.ZP)(),M=null==c?void 0:null===(o=c._id)||void 0===o?void 0:o.split("-book:"),T=null==M?void 0:M[1],Y=E(),{affinities:{rows:G}}=(0,g.G$)(),O=(0,r.useMemo)(()=>{let e=null==G?void 0:G.find(e=>{var o;return null===(o=e._id)||void 0===o?void 0:o.includes(T)});return(null==e?void 0:e.total_index)&&(null==e?void 0:e.index)?Number(parseFloat(null==e?void 0:e.index)/parseFloat(null==e?void 0:e.total_index)*100).toFixed(1):0},[T,G]),P=(null==X?void 0:X.super)||(null==X?void 0:X.name)===(null==c?void 0:c.userId),handleArchive=async()=>{if(null==c?void 0:c._id)try{let e={...c,archive:!c.archive,updated_at:(0,_.o0)(Date.now())};await C.Z.put(e),j("Book ".concat(c.archive?"unarchived":"archived"," successfully"))}catch(e){j("Error updating book"),console.error("Error archiving book:",e)}},handleDelete=async()=>{if(null==c?void 0:c._id)try{let e=await C.Z.delete(c._id);(null==e?void 0:e.ok)?j("Book deleted successfully"):j("Error deleting book")}catch(e){j("Error deleting book"),console.error("Error deleting book:",e)}},handleRemoveAffinity=async()=>{if(T)try{let e=null==G?void 0:G.find(e=>{var o;return null===(o=e._id)||void 0===o?void 0:o.includes(T)});e?(await S.Z.Affinities.delete(e._id),j("Reading progress removed successfully")):j("No reading progress found for this book")}catch(e){j("Error removing reading progress"),console.error("Error removing affinity:",e)}},handleShare=async()=>{let e="".concat(window.location.origin,"/").concat(null==M?void 0:M[0],"/").concat(T);try{await navigator.clipboard.writeText(e),j("Book link copied to clipboard")}catch(e){j("Error copying link to clipboard"),console.error("Error sharing book:",e)}},U=[{icon:c.archive?(0,i.tZ)(B.Z,{}):(0,i.tZ)(k.Z,{}),label:c.archive?"Unarchive":"Archive",onClick:handleArchive,hide:!P},{icon:(0,i.tZ)(w.Z,{}),label:"Delete",onClick:()=>L(!0),hide:!P,color:"#d32f2f"},{icon:(0,i.tZ)(Z.Z,{}),label:"Remove Reading Progress",onClick:handleRemoveAffinity,hide:!O||0===Number(O)},{icon:(0,i.tZ)(y.Z,{}),label:"Share",onClick:handleShare}],cover=()=>{var e,o;return(0,i.BX)(n.Z,{sx:{boxShadow:t?void 0:"0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12)",position:"relative",overflow:!t&&"hidden !important",width:s?"".concat(s," !important"):126,height:z?"".concat(z," !important"):195,flex:"none"},className:[Y.cardBook,t&&Y.cardBookDetails,Y.radius8].join(" "),elevation:0,style:t?{}:D,children:[(null==c?void 0:c.coverHash)&&(0,i.tZ)(u.Z,{className:[Y.cardBookCover,t&&Y.cardBookCoverDetails,Y.radius8].join(" "),sx:{position:"relative",top:0,left:0,maxWidth:"100%",maxHeight:"100%",zIndex:-1,overflow:"hidden",borderRadius:10,width:s?"".concat(s," !important"):126,height:z?"".concat(z," !important"):195},children:(0,i.tZ)(x.E,{hash:null==c?void 0:c.coverHash,style:{width:"100%",height:"100%",borderRadius:"8px",position:"absolute",top:0,left:0}})}),(0,i.BX)(l.Z,{className:[Y.cardBookCover,t&&Y.cardBookCoverDetails,Y.radius8].join(" "),image:(null==c?void 0:c.cover)||"/images/skeleton_cover.png",title:null==c?void 0:c.title,component:"div",style:{backgroundColor:(null==c?void 0:c.coverHash)?"transparent":(null==c?void 0:null===(e=c.colors)||void 0===e?void 0:e[0])?null==c?void 0:null===(o=c.colors)||void 0===o?void 0:o[0]:"#eaeaea"},sx:{width:s?"".concat(s," !important"):126,height:z?"".concat(z," !important"):195,position:"absolute",top:0,left:0,overflow:"hidden"},children:[!t&&!A&&(0,i.tZ)(a.Z,{style:{height:"100%"},children:(0,i.tZ)(d.Z,{title:null==c?void 0:c.title,sx:{borderBottomLeftRadius:8,borderBottomRightRadius:8,backdropFilter:"blur(5px)",WebkitMask:"linear-gradient(#000, #000, #000, #000, transparent)",mask:"linear-gradient(transparent, transparent, #000, #000, #000, #000)",background:"linear-gradient(transparent, transparent, rgb(0, 0, 0, 0.4)) !important","& .MuiImageListItemBar-title":{textShadow:"0 1px 3px rgb(0 0 0 / 78%), 0 1px 1px rgb(0 0 0 / 45%)"},"& .MuiImageListItemBar-titleWrap":{padding:"6px 11px"}}})}),!t&&Number(O)>0&&(0,i.tZ)("div",{style:{width:"100%"},children:(0,i.tZ)(b.C,{value:Number(O),variant:"determinate",color:"primary",style:{width:"100%",backgroundColor:"rgba(0,0,0,.1)",position:"absolute",bottom:0,left:0,height:3}})})]})]},null==c?void 0:c._id)},$=t?(0,i.BX)(n.Z,{className:[Y.detailsRoot,H&&Y.transparentBackgroun
1d].join(" "),sx:{boxShadow:"0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12) !important"},style:D,children:[((null==c?void 0:c.cover)||(null==c?void 0:c.coverBg)||(null==c?void 0:c.coverBgHash))&&(0,i.tZ)("div",{style:{backgroundImage:"url(".concat(c.cover||c.coverBg||"/images/skeleton_cover.png",")"),opacity:1},className:Y.imgCoverBg,children:(0,i.tZ)("div",{style:{mask:"linear-gradient(to right, transparent, black, black, black)",WebkitBackdropFilter:"blur(20px)",backdropFilter:"blur(20px)",width:"100%",height:"100%"},children:((null==c?void 0:c.coverBgHash)||(null==c?void 0:c.coverHash))&&(0,i.tZ)(x.E,{hash:c.coverBgHash||(null==c?void 0:c.coverHash),style:{width:"100%",height:"100%",borderRadius:"8px",position:"absolute",top:0,left:0}})})}),cover(),(0,i.BX)("div",{className:Y.details,style:{zIndex:1},children:[(0,i.BX)(v.Z,{className:Y.content,children:[(0,i.tZ)(p.Z,{component:"h6",variant:"h6",sx:{maxWidth:345,textShadow:"0 2px 2px rgb(255 255 255 / 25%)",fontWeight:"600",fontSize:"1.45rem"},className:"truncate",children:null==c?void 0:c.title}),(0,i.tZ)(p.Z,{variant:"subtitle1",color:"textSecondary",sx:{fontWeight:"600"},className:"truncate",children:null==c?void 0:c.userId}),(0,i.tZ)(p.Z,{style:{overflow:"hidden",display:"-webkit-box",WebkitLineClamp:4,WebkitBoxOrient:"vertical",fontSize:"1rem"},variant:"body2",color:"textSecondary",component:"p",children:null==c?void 0:c.description})]}),(0,i.tZ)("div",{className:Y.controls})]}),Number(O)>0&&(0,i.tZ)("div",{style:{flex:1,width:"110%"},children:(0,i.tZ)(b.C,{value:Number(O),variant:"determinate",color:"primary",style:{width:"100%",backgroundColor:"rgba(0,0,0,.1)",position:"absolute",bottom:0,left:0,height:3}})})]}):cover();return(0,i.BX)(i.HY,{children:[(0,i.tZ)(f.Y,{actions:U,children:(0,i.tZ)(h(),{href:W?"/[profile]/[book]/[chapter]":"/[profile]/[book]",as:W?"/".concat(null==M?void 0:M[0],"/").concat(T,"/start"):"/".concat(null==M?void 0:M[0],"/").concat(T),children:$})}),(0,i.tZ)(m.Z,{visible:F,onClose:()=>L(!1),title:"Delete Book",content:(0,i.BX)("div",{style:{padding:15},children:['Are you sure you want to delete "',null==c?void 0:c.title,'"? This action cannot be undone.']}),actions:[{type:"close",children:"Cancel"},{type:"button",onClick:handleDelete,children:"Delete",color:"primary",variant:"outlined",closeAfter:!0}]})]})}},28357:function(e,o,t){t.d(o,{Sy:function(){return shuffleArray},dz:function(){return useWindowDimensions}});var i=t(67294);function useWindowDimensions(){let[e,o]=(0,i.useState)({width:void 0,height:void 0});return(0,i.useEffect)(()=>{var e;function handleResize(){o(function(){let{innerWidth:e,innerHeight:o}=window;return{width:e,height:o}}())}return handleResize(),null===(e=window)||void 0===e||e.addEventListener("resize",handleResize),()=>{var e;return null===(e=window)||void 0===e?void 0:e.removeEventListener("resize",handleResize)}},[]),e}t(82515);let shuffleArray=e=>{let o=e.slice();for(let e=o.length-1;e>0;e--){let t=Math.floor(Math.random()*(e+1));[o[e],o[t]]=[o[t],o[e]]}return o}}}]);
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.