try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="864c7021-102a-4dcd-9f25-e30ab2723319",e._sentryDebugIdIdentifier="sentry-dbid-864c7021-102a-4dcd-9f25-e30ab2723319")}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4899],{14753:(e,t,r)=>{"use strict";r.d(t,{ErrorBoundary:()=>s});var o=r(87085);let l=(0,o.createContext)(null),n={didCatch:!1,error:null};class s extends o.Component{static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){let{error:e}=this.state;if(null!==e){for(var t,r,o=arguments.length,l=Array(o),s=0;s0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some((e,r)=>!Object.is(e,t[r]))}(e.resetKeys,o)){var l,s;null==(l=(s=this.props).onReset)||l.call(s,{next:o,prev:e.resetKeys,reason:"keys"}),this.setState(n)}}render(){let{children:e,fallbackRender:t,FallbackComponent:r,fallback:n}=this.props,{didCatch:s,error:a}=this.state,i=e;if(s){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)i=t(e);else if(r)i=(0,o.createElement)(r,e);else if(void 0!==n)i=n;else throw a}return(0,o.createElement)(l.Provider,{value:{didCatch:s,error:a,resetErrorBoundary:this.resetErrorBoundary}},i)}constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=n}}},18505:(e,t,r)=>{"use strict";r.d(t,{s:()=>n});var o=r(29179),l=r(87085);function n(){return{sendEvent:(0,l.useCallback)(e=>{let{name:t,params:r}=e;{let e={event:t};if(r)for(let t in r)e[t]=r[t];(0,o.sendGAEvent)(e)}},[])}}},35736:(e,t,r)=>{"use strict";r.d(t,{ReviewsCarousel:()=>c});var o=r(97657),l=r(87085),n=r(36280);let s={SCROLL_AMOUNT:300},a=(0,l.memo)(function(e){let{review:t,showRating:r,isLast:l}=e;return(0,o.jsx)("div",{className:"w-48 md:w-64 shrink-0 ".concat(l?"":"mr-4 md:mr-8"),children:(0,o.jsx)(n.ReviewCard,{review:t,showRating:r})})}),i=(0,l.memo)(function(e){let{direction:t,show:r,onClick:l}=e;return(0,o.jsx)("button",{onClick:l,className:"absolute ".concat(t,"-0 top-0 bottom-0 w-16 bg-transparent\n no-button-style shadow-none focus:ring-0 focus:outline-hidden active:bg-transparent \n border-none focus:border-none outline-hidden\n ").concat(r?"bg-gradient-".concat("left"===t?"to-r":"to-l"," from-white to-transparent"):"pointer-events-none"),"aria-label":"Scroll ".concat(t)})}),c=(0,l.memo)(function(e){let{reviews:t,showRatings:r,title:n="Some reviews",width:c,height:u}=e,d=(0,l.useRef)(null),[m,h]=(0,l.useState)(!1),[f,b]=(0,l.useState)(!0),p=(0,l.useCallback)(()=>{let e=d.current;if(!e)return;let{scrollLeft:t,scrollWidth:r,clientWidth:o}=e;h(t>0),b(t{let t=d.current;if(!t)return;let r="left"===e?-s.SCROLL_AMOUNT:s.SCROLL_AMOUNT;t.scrollBy({left:r,behavior:"smooth"})},[]),{isDragging:v,handleDragStart:g,handleDragEnd:y,handleDragMove:w}=(e=>{let[t,r]=(0,l.useState)(!1),o=(0,l.useRef)({x:0,scrollLeft:0}),n=(0,l.useCallback)(t=>{e.current&&(r(!0),o.current={x:"touches"in t?t.touches[0].clientX:t.clientX,scrollLeft:e.current.scrollLeft})},[e]),s=(0,l.useCallback)(()=>{r(!1)},[]),a=(0,l.useCallback)(r=>{if(!t||!e.current)return;r.preventDefault();let l="touches"in r?r.touches[0].clientX:r.clientX,n=o.current.x-l;e.current.scrollLeft=o.current.scrollLeft+n},[t,e]);return{isDragging:t,handleDragStart:n,handleDragEnd:s,handleDragMove:a}})(d),k=(0,l.useCallback)(e=>{(null==e?void 0:e.currentTarget)&&(null==e?void 0:e.target)&&(e.persist(),w(e))},[w]),j=(0,l.useCallback)(e=>{(null==e?void 0:e.currentTarget)&&(null==e?void 0:e.target)&&(e.persist(),g(e))},[g]),N=(0,l.useCallback)(e=>{(null==e?void 0:e.currentTarget)&&(null==e?void 0:e.target)&&(e.persist(),y())},[y]),B=t.length<2,C=t.length<3&&"lg"===c;return(0,o.jsxs)("section",{className:"".concat("sm"===u?"mt-0 mb-0 p-0":""," section-separator"),children:[(0,o.jsx)("h3",{className:"text-2xl font-bold mb-4",children:n}),(0,o.jsxs)("div",{className:"w-full relative",children:[(0,o.jsx)("div",{className:"mx-auto mb-4 relative overflow-x-auto scrollbar-hide select-none\n max-w-[280px] sm:max-w-[380px] md:max-w-[420px] ".concat("lg"===c?"lg:max-w-[600px]":"","\n cursor-grab active:cursor-grabbing ").concat(B?"flex justify-center":""),ref:d,onScroll:p,onMouseDown:j,onMouseUp:N,onMouseLeave:N,onMouseMove:k,onTouchStart:j,onTouchEnd:N,onTouchMove:k,children:(0,o.jsx)("div",{className:"flex ".concat(C?"md:justify-center":""),children:t.map((e,l)=>(0,o.jsx)(a,{review:e,showRating:r,isLast:l===t.length-1},"review-".concat(l)))})}),(0,o.jsx)(i,{direction:"left",show:m,onClick:()=>x("left")}),(0,o.jsx)(i,{direction:"right",show:f,onClick:()=>x("right")})]})]})})},36280:(e,t,r)=>{"use strict";r.d(t,{ReviewCard:()=>f});var o=r(97657),l=r(77633),n=r(61472),s=r(26342),a=r(87085);let i=(0,a.memo)(function(e){var t;let{author:r}=e;if(!r)return null;let l=null==(t=r.image)?void 0:t.trim(),n=(null==l?void 0:l.startsWith("/"))?l:l?"/".concat(l):void 0;return(0,o.jsxs)("div",{className:"flex mx-auto items-center",children:[n&&(0,o.jsx)("div",{className:"w-8 h-8 rounded-full border border-slate-400 overflow-hidden shrink-0",children:(0,o.jsx)(s.default,{src:n,alt:"Avatar of ".concat(r.name),width:30,height:30,className:"w-full h-full object-cover"})}),(0,o.jsxs)("div",{className:"".concat(n?"ml-2":""),children:[(0,o.jsx)("p",{className:"my-0 text-xs",children:r.name}),r.description&&(0,o.jsx)("p",{className:"my-0 text-[10px] leading-3 text-slate-400",children:r.description})]})]})});var c=r(21471);let u={active:"text-yellow-400 fill-yellow-400",inactive:"text-gray-300",base:"w-5 h-5"},d=(0,a.memo)(function(e){let{rating:t,maxStars:r=5}=e;return(0,o.jsx)("div",{className:"flex mx-auto mb-2",role:"img","aria-label":"".concat(t," out of ").concat(r," stars"),children:Array.from({length:r},(e,r)=>(0,o.jsx)(c.A,{className:"".concat(u.base," ").concat(r{"use strict";r.d(t,{default:()=>s});var o=r(97657),l=r(14753),n=r(95684);let s=(0,r(87085).memo)(function(e){let{children:t}=e;return(0,o.jsx)(l.ErrorBoundary,{FallbackComponent:n.default,children:t})})},41663:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,63330,23)),Promise.resolve().then(r.t.bind(r,2095,23)),Promise.resolve().then(r.bind(r,67663)),Promise.resolve().then(r.bind(r,35736)),Promise.resolve().then(r.bind(r,64650)),Promise.resolve().then(r.bind(r,78664)),Promise.resolve().then(r.bind(r,37217))},64650:(e,t,r)=>{"use strict";r.d(t,{BookImage:()=>n});var o=r(87085),l=r(26342);let n=(0,o.memo)(e=>{let{maxRetries:t=3,retryDelay:r=1e3,priority:n=!1,...s}=e,[a,i]=(0,o.useState)(0),c=a{if(!c||0===a)return;let e=setTimeout(()=>i(0),r);return()=>clearTimeout(e)},[a,r,c]);let u=(0,o.useCallback)(()=>{c&&i(e=>e+1)},[c]);return(0,o.createElement)(l.default,{...s,key:a,onError:u,priority:n,alt:s.alt||"Book cover image"})});n.displayName="BookImage"},65015:(e,t,r)=>{"use strict";r.d(t,{B:()=>b});var o=r(97657),l=r(69267),n=r(50295),s=r(51987),a=r(65566),i=r(631),c=r(53993),u=r(42342),d=r(28630),m=r(87085),h=r(18505);let f="/books/preorder",b=m.memo(e=>{let{book:t,isOpen:r,onOpenChange:b}=e,{sendEvent:p}=(0,h.s)(),x=!!(null==t?void 0:t.title),v=(0,m.useMemo)(()=>{if(!x)return[];let e=[];return(t.amazonLink||f)&&e.push({type:"Paperback",href:t.amazonLink||f}),(t.myStoreLink||f)&&e.push({type:"eBook",href:t.myStoreLink||f}),t.hasAudiobook&&t.myStoreLink&&e.push({type:"Audiobook",href:t.myStoreLink}),t.hasAudible&&t.amazonLink&&e.push({type:"Audible",href:t.amazonLink}),e},[t,x]),g=(0,m.useCallback)(e=>{null==b||b(e)},[b]);if(!x){let e=Error("BuyBookModal: Book or book title is missing");return console.error(e),l.Cp(e),null}if(0===v.length){let e=Error("BuyBookModal: No purchase options available for book: ".concat(t.title));return console.warn(e),l.wd(e.message,{level:"warning"}),null}return(0,o.jsx)(n.Y,{isOpen:r,onOpenChange:g,size:"sm",hideCloseButton:!0,children:(0,o.jsx)(s.g,{className:"pb-0",children:e=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(a.c,{className:"flex flex-col gap-1",children:["Buy ",t.title]}),(0,o.jsx)(i.h,{children:v.map(e=>{let{type:r,href:n}=e;return(0,o.jsxs)(c.T,{as:u.h,href:n,color:"primary",className:"w-full mb-2",isExternal:n.startsWith("http"),"aria-label":"Buy ".concat(r," version of ").concat(t.title),onPress:()=>{try{if(!n)return;p({name:"redirect_to_ext_store_with_intent_to_buy",params:{book_title:t.title,format:r}}),n.startsWith("http")&&window.open(n,"_blank","noopener,noreferrer")}catch(e){console.error("Error handling button press:",e),l.Cp(e)}},children:[r,"Audible"===r&&(0,o.jsx)("span",{className:"text-xs",children:"(only on Amazon.com \uD83C\uDDFA\uD83C\uDDF8)"})]},r)})}),(0,o.jsx)(d.q,{children:(0,o.jsx)(c.T,{color:"primary",variant:"light",onPress:()=>{try{null==e||e()}catch(e){console.error("Error closing modal:",e),l.Cp(e)}},className:"shadow-none text-white","aria-label":"Close purchase options modal",children:"Close"})})]})})})});b.displayName="BuyBookModal"},67663:(e,t,r)=>{"use strict";r.d(t,{BooksGrid:()=>u});var o=r(97657),l=r(87085),n=r(26342),s=r(63330),a=r.n(s),i=r(5622);let c=(0,l.memo)(function(e){let{book:t,isPriority:r}=e,s=(0,l.useCallback)(e=>{e.preventDefault();let r=document.getElementById(t.slug);r&&r.scrollIntoView({behavior:"smooth"})},[t.slug]);return(0,o.jsx)(a(),{href:"#".concat(t.slug),onClick:s,className:"inline-block","aria-label":"View ".concat(t.title),children:(0,o.jsx)(n.default,{src:t.coverSrc,alt:t.title,width:100,height:150,className:"border border-black rounded-xs shadow-md transition-transform hover:scale-105",priority:r,loading:r?"eager":"lazy"})})}),u=(0,l.memo)(function(){let e=i.b.slice(0,10);return(0,o.jsx)("div",{className:"mx-auto max-w-2xl flex flex-wrap gap-4 md:gap-8 justify-center",children:e.map((e,t)=>(0,o.jsx)(c,{book:e,isPriority:t<3},e.slug))})})},78664:(e,t,r)=>{"use strict";r.d(t,{BuyBookButton:()=>c});var o=r(97657),l=r(69267),n=r(31676),s=r(53993),a=r(87085),i=r(65015);let c=(0,a.memo)(e=>{let{book:t,className:r}=e,{isOpen:a,onOpen:c,onOpenChange:u}=(0,n.j)();return t?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s.T,{color:"primary",onPress:e=>{try{null==c||c()}catch(e){console.error("Error opening modal:",e),l.Cp(e)}},"aria-label":"Buy ".concat(t.title),className:"".concat(r," rounded-lg shadow-lg text-white"),children:"Buy Now"}),(0,o.jsx)(i.B,{book:t,isOpen:a,onOpenChange:u})]}):(!function(){let e="BuyBookButton: No book provided";console.warn(e),l.wd(e,{level:"warning",extra:{component:"BuyBookButton"}})}(),null)});c.displayName="BuyBookButton"},95684:(e,t,r)=>{"use strict";r.d(t,{default:()=>s});var o=r(97657),l=r(87085),n=r(53993);let s=(0,l.memo)(function(e){let{error:t,resetErrorBoundary:r,message:l="We're sorry, a problem occurred. Please try again later."}=e;return(0,o.jsxs)("div",{role:"alert",className:"p-4 border border-red-500 rounded-lg bg-red-50 max-w-xl mx-auto my-8",children:[(0,o.jsx)("h2",{className:"text-lg font-semibold text-red-800 mb-2",children:"Oops! Something went wrong"}),(0,o.jsx)("p",{className:"text-red-700 mb-4",children:l}),!1,(0,o.jsx)(n.T,{onPress:r,color:"danger",className:"w-full sm:w-auto",children:"Try again"})]})})}},e=>{e.O(0,[7924,2095,3993,7612,9179,3161,9563,2355,5622,6331,4341,7358],()=>e(e.s=41663)),_N_E=e.O()}]);