bloom-player 2.20.0-alpha.4 → 2.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7979,7 +7979,7 @@ Add a <Suspense fallback=...> component higher in the tree to provide a loading
7979
7979
  display:none !important;
7980
7980
  }
7981
7981
  `.replace(`
7982
- `,"").replace("\r","")}const ac=[];function EM(){return ac.length>0}function PM(e){const t=ac.pop();if(t)return{bookUrl:e===t.bookId?void 0:gh(t.bookId),pageId:t.pageId}}function MM(e,t,n){const a=e.target.closest("[href], [data-href]");if(!a)return;e.preventDefault(),e.stopPropagation();const r=(a.getAttribute("href")||a.getAttribute("data-href"))??void 0;if(!r)return;if(r.startsWith("http://")||r.startsWith("https://")){window.open(r,"_blank","noreferrer");return}let l,d;if(r==="back"){const p=ac.pop();return p?{bookUrl:t===p.bookId?void 0:gh(p.bookId),pageId:p.pageId}:void 0}else if(r.startsWith("/book/")){const p=AM(r);l=p.bookId,d=p.pageId,p.bookId===t&&(l=void 0)}else r.startsWith("#")&&(d=r.substring(1));const f=n();if(l)return Ev(t,f),{bookUrl:gh(l),pageId:d};if(d)return Ev(t,f),{pageId:d}}function Ev(e,t,n){ac.push({bookId:e,pageId:t})}function gh(e){return`/book/${e}/index.htm`}function AM(e){try{const t=new URL(e,window.location.origin);if(!t.pathname.startsWith("/book/"))throw new Error("Invalid book URL format");const n=t.pathname.replace("/book/",""),a=t.hash.replace("#","");return{bookId:n,pageId:a}}catch(t){return console.error("Error parsing book URL:",t),{bookId:void 0,pageId:void 0}}}const NM="2.20.0-alpha.4",LM={version:NM},ar="#d65649",BM="#2e2e2e",zM="#febf00",Db=sl({palette:{primary:{main:BM,contrastText:ar},secondary:{main:ar}}});function Rb(){var e=LM.version;return e}const IM=({getBookInstanceId:e})=>{const[t,n]=O.useState(!1),a=Rb(),r=new Date("2026-06-17T22:20:53.890Z").toLocaleDateString();if(O.useEffect(()=>{const d=p=>{p.key==="Control"&&n(!0)},f=p=>{p.key==="Control"&&n(!1)};return window.addEventListener("keydown",d),window.addEventListener("keyup",f),()=>{window.removeEventListener("keydown",d),window.removeEventListener("keyup",f)}},[]),!t)return null;const l=e?.();return Dt.createElement("div",{className:"diagnostic-info-control",style:{color:ar,fontFamily:"sans-serif",padding:"5px",zIndex:1e3,lineHeight:"1.5"}},Dt.createElement("div",null,"Bloom Player v",a," (built ",r,")"),Dt.createElement("div",null,"Book ID: ",l??""))},DM=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Pv=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const t=e.match(DM);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Mv=e=>e==="*"||e==="x"||e==="X",Av=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},RM=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],jM=(e,t)=>{if(Mv(e)||Mv(t))return 0;const[n,a]=RM(Av(e),Av(t));return n>a?1:n<a?-1:0},Nv=(e,t)=>{for(let n=0;n<Math.max(e.length,t.length);n++){const a=jM(e[n]||"0",t[n]||"0");if(a!==0)return a}return 0},Lv=(e,t)=>{const n=Pv(e),a=Pv(t),r=n.pop(),l=a.pop(),d=Nv(n,a);return d!==0?d:r&&l?Nv(r.split("."),l.split(".")):r||l?r?-1:1:0},mh=new or;class Qe extends O.Component{constructor(t,n){super(t,n),this.activityManager=new U1,this.initialPages=["loading..."],this.initialStyleRules="",this.originalPageClass="Device16x9Portrait",this.bookInfo=new ph,this.bookInteraction=new xM,this.mustUseOriginalPageSize=!1,this.indicesOfPagesWhereWeShouldPreserveDOMState={},this.startingUpSwiper=!0,this.state={pages:this.initialPages,pageIdToIndexMap:{},styleRules:this.initialStyleRules,importedBodyAttributes:{},currentSwiperIndex:0,isLoading:!0,loadFailed:!1,loadErrorHtml:"",ignorePhonyClick:!1,isFinishUpForNewBookComplete:!1,inPauseForced:!1,bookUrl:""},this.isPagesLocalized=!1,this.currentPageHidesNavigationButtons=!1,this.handleDocumentLevelKeyDown=r=>{r.key==="Home"&&(this.goToFirstPage(),r.preventDefault()),r.key==="End"&&(this.goToLastPage(),r.preventDefault())},this.distributionSource="",this.finishUpCalled=!1,this.hasImageDescriptions=!1,this.handlePageVideoComplete=r=>{r.page===Qe.currentPage&&this.playAudioAndAnimation(r.page)},this.handlePlayFailed=()=>{this.setState({inPauseForced:!0}),this.props.setForcedPausedCallback&&this.props.setForcedPausedCallback(!0)},this.handlePlayUnblocked=()=>{this.state.inPauseForced&&this.props.setForcedPausedCallback&&this.props.setForcedPausedCallback(!1),this.setState({inPauseForced:!1})},this.handlePlayCompleted=()=>{Un(Cn.MediaFinished),this.props.imageDescriptionCallback(!1)},this.handleToggleImageDescription=r=>{this.props.imageDescriptionCallback(r)},this.handlePageNarrationComplete=r=>{if(r&&(Un(Cn.MediaFinished),this.shouldAutoPlay())){const l=this.props.autoplayCount??0,d=this.state.startPageIndex??0,f=this.swiperInstance.slides.length-1;let p=this.props.autoplayCount?Math.min(d+l-1,f):f;this.swiperInstance.activeIndex>=p?(this.music.pause(),this.props.shouldReportSoundLog&&Ux(),Vx(),IS({})):this.swiperInstance.slideNext()}},this.skipAutoPlay=!1,this.sentBloomNotification=!1;const a=t.url.startsWith("http")?new URL(t.url):new URL(t.url,window.location.origin);a.hash?(this.state.startPageId=a.hash.substring(1),a.hash=""):this.state.startPageIndex=t.startPageIndex,this.state.bookUrl=a.href,Qe.currentPagePlayer=this,this.legacyQuestionHandler=new X1(t.locationOfDistFolder)}componentDidMount(){wn.setUp(),window.addEventListener("focus",()=>this.handleWindowFocus()),window.addEventListener("blur",()=>this.handleWindowBlur()),document.addEventListener("keydown",t=>this.handleDocumentLevelKeyDown(t)),document.addEventListener("pointerdown",t=>{(t.target.closest("[href], [data-href]")||t.target.closest(".bloom-videoContainer")&&!t.target.closest("[data-draggable-id]"))&&(t.stopPropagation(),t.preventDefault())},{capture:!0}),document.addEventListener("dragstart",t=>{this.activityManager.getActivityAbsorbsDragging()||t.preventDefault()},{capture:!0}),this.componentDidUpdate(this.props,this.state)}CanGoBack(){return EM()}HandleBackButtonClickedIfHavePlayerHistory(){const t=this.getBookIdFromBookUrlForHistory(this.state.bookUrl)||this.bookInfo.bookInstanceId,n=PM(t);return n?(this.navigate(n.bookUrl,n.pageId),!0):!1}navigate(t,n){if(t){const a=new URL(t,this.state.bookUrl);this.setState({bookUrl:a.href,startPageId:n,startPageIndex:void 0})}else if(n!==void 0){const a=this.state.pageIdToIndexMap[n];this.swiperInstance.slideTo(a)}}getBookIdFromBookUrlForHistory(t){if(t)try{const a=new URL(t,window.location.href).pathname.match(/^\/book\/([^/]+)\/index\.htm$/i);return a?a[1]:void 0}catch{return}}handleWindowFocus(){const t=localStorage.getItem(zu),n=localStorage.getItem(Cm);t&&n==this.sourceUrl&&(this.bookInteraction.beginReadTime=Date.now()-parseInt(t,10))}handleWindowBlur(){const t=Date.now()-this.bookInteraction.beginReadTime;localStorage.setItem(zu,t.toString()),localStorage.setItem(Cm,this.sourceUrl)}getRequiredVersionMessage(t){const n=t.querySelector('meta[name="FeatureRequirement"]')?.getAttribute("content");if(!n)return"";const a=/BloomPlayerMinVersion":"(.*?)".*?"FeatureId":"(.*?)"/g;let r,l=null,d=null;for(;(r=a.exec(n))!==null;){const p=r[1];(!l||Lv(p,l)>0)&&(l=p,d=r[2])}if(!l||!d)return"";const f=Rb();if(Lv(f,l)>=0)return"";if(window.location.hostname.toLowerCase().indexOf("bloomlibrary.org")>=0)return wn.getTranslation("Version.Problem.Web",this.props.preferredUiLanguages,"This book uses the feature {feature}. Unfortunately, {hostname} is not ready to display this book yet. Please check back again later or write to issues@bloomlibrary.org if you think this is unexpected.").replace("{feature}",d).replace("{hostname}",window.location.hostname);{let p=Ua("host","");switch(p){case"bloomreader":p="Bloom Reader";break;case"bloompubviewer":p="BloomPUB Viewer";break;case"readerapp":p="";break}return p?wn.getTranslation("Version.Problem.Host",this.props.preferredUiLanguages,"This book uses the feature {feature} and requires a newer version of {host} to read it. Please upgrade to the latest version.").replace("{feature}",d).replace("{host}",p):wn.getTranslation("Version.Problem.NoHost",this.props.preferredUiLanguages,"This book uses the feature {feature} and requires a newer version of the program you are using to read it. Please upgrade to the latest version.").replace("{feature}",d)}}componentDidUpdate(t,n){try{if(!this.props.url||this.state.loadFailed&&n.bookUrl===this.state.bookUrl)return;this.initializeMedia();const a=this.preprocessUrl();if(a&&a!=="/working"&&a!==this.sourceUrl){this.finishUpCalled=!1,this.setState({isLoading:!0,loadFailed:!1}),this.metaDataObject=void 0,this.htmlElement=void 0,this.sourceUrl=a;const r=this.sourceUrl.lastIndexOf("/"),l=this.sourceUrl.lastIndexOf("%2f");let d;r>l?d=this.sourceUrl.substring(r+1,this.sourceUrl.length):d=this.sourceUrl.substring(l+3,this.sourceUrl.length);const f=d.endsWith(".htm"),p=f?this.sourceUrl:this.sourceUrl+"/"+d+".htm";this.urlPrefix=f?this.sourceUrl.substring(0,Math.max(r,l)):this.sourceUrl,this.music.urlPrefix=this.urlPrefix,gx(this.music.urlPrefix);const y=Di.get(this.fullUrl(".distribution")).then(N=>N,N=>({data:""})),k=Di.get(p),P=Di.get(this.fullUrl("meta.json"));Promise.all([k,P,y]).then(N=>{const[B,L,$]=N;this.metaDataObject=L?.data,this.distributionSource=$.data;const W=new DOMParser().parseFromString(B?.data,"text/html"),U=W.documentElement,_=this.getRequiredVersionMessage(W);this.setState({requiredVersion:_});const tt=U.getElementsByTagName("body")[0];this.mustUseOriginalPageSize=this.computeMustUseOriginalPageSize(tt),this.bookInfo.setSomeBookInfoFromBody(tt),this.localizeOnce(),this.props.shouldReportSoundLog&&(this.videoList=this.getVideoList(W)),this.animation.PlayAnimations=this.bookInfo.playAnimations,this.collectBodyAttributes(tt),this.makeNonEditable(tt),this.htmlElement=U;const D=U.getElementsByClassName("bloom-page")[0];this.originalPageClass="Device16x9Portrait",D&&(this.originalPageClass=Qe.getPageSizeClass(D)),this.legacyQuestionHandler.generateQuizPagesFromLegacyJSON(this.urlPrefix,tt,this.originalPageClass,()=>{this.finishUp()})}).catch(N=>this.HandleLoadingError(N))}else if(t.landscape!==this.props.landscape||t.useOriginalPageSize!==this.props.useOriginalPageSize||t.autoplay!==this.props.autoplay){const r=document.getElementsByClassName("bloom-page");for(let l=0;l<r.length;l++){const d=r[l];this.setPageSizeClass(d)}}!this.state.isLoading&&(n.isLoading||t.activeLanguageCode!==this.props.activeLanguageCode)&&(this.updateDivVisibilityByLangCode(n.isLoading),this.updateOverlayPositionsByLangCode(),this.finishUpCalled&&this.finishUp(!1)),this.state.currentSwiperIndex!=n.currentSwiperIndex&&this.rootDiv?.querySelectorAll(Qh).forEach(r=>{const l=cl(r).getNiceScroll();l&&l.length>0&&l.remove()}),!this.state.isLoading&&(n.isLoading||t.shouldReadImageDescriptions!==this.props.shouldReadImageDescriptions)&&this.finishUpCalled&&(this.setIndex(this.state.currentSwiperIndex),this.showingPage(this.state.currentSwiperIndex)),this.state.isFinishUpForNewBookComplete&&t.landscape!==this.props.landscape&&(this.setIndex(this.state.currentSwiperIndex),this.showingPage(this.state.currentSwiperIndex)),t.paused!==this.props.paused&&this.handlePausePlay(),this.swiperInstance&&this.swiperInstance.lazy.load()}catch(a){this.setState({isLoading:!1,loadFailed:!0,loadErrorHtml:a.message})}}collectBodyAttributes(t){for(var n={},a=0;a<t.attributes.length;a++)n[t.attributes.item(a).nodeName]=t.attributes.item(a).nodeValue;this.setState({importedBodyAttributes:n})}HandleLoadingError(t){let a=`<p>There was a problem displaying this book: ${t.message}<p>`;const r=!!t.config?.url&&new URL(t.config.url,window.location.href).pathname.startsWith("/book/");r?a="<p>We could not find that book.</p>":(t.config&&t.config.url&&t.config.url.startsWith("file://")||t.message.indexOf("404")>=0)&&(a="<p>This book (or some part of it) was not found.<p>",t.config&&t.config.url&&(a+=`<p class='errorDetails'>${OM(t.config.url)}</p>`)),this.setState({isLoading:!1,loadFailed:!0,loadErrorHtml:a}),r&&mh.raise()}async finishUp(t=!0){if(this.finishUpCalled=!0,!this.htmlElement)return;Zs.setAllVideoPostersTo1x1TransparentPNG(this.htmlElement);const n=this.htmlElement.getElementsByClassName("bloom-page"),a=[];t&&(this.bookInfo.totalNumberedPages=0,this.bookInfo.questionCount=0,this.activityManager.collectActivityContextForBook(n),this.bookInteraction.clearPagesShown(),this.music.processAllMusicForBook(n));const r=this.bookInfo.getPreferredTranslationLanguages(),l=r[0]===this.props.activeLanguageCode||!this.props.activeLanguageCode,d={},f=y=>y.classList.contains("bloom-interactive-page")||y.classList.contains("simple-comprehension-quiz")||y.getAttribute("data-activity")=="iframe"||y.getElementsByClassName("questions").length>0;d.length=0,d.cover=0;for(let y=0;y<n.length;y++){const k=n[y],P=k.getAttribute("id");P&&(d[P]=y);const N=this.setPageSizeClass(k);k.setAttribute("data-index",y.toString(10)),y===0&&this.props.reportBookProperties&&this.props.reportBookProperties({landscape:N,canRotate:this.bookInfo.canRotate,preferredLanguages:r,pageNumbers:Array.from(n).map(L=>L.getAttribute("data-page-number")??""),isRtl:this.metaDataObject.isRtl,internalUrl:this.state.bookUrl}),t&&(this.fixRelativeUrls(k),k.classList.contains("numberedPage")&&(this.indexOflastNumberedPage=y,this.bookInfo.totalNumberedPages++),(k.getAttribute("data-analyticscategories")||k.getAttribute("data-analyticsCategories"))==="comprehension"&&this.bookInfo.questionCount++),this.showOrHideL1OnlyText(k,l);const B=f(k);B&&this.activityManager.initializePageHtml(this.urlPrefix,k,a.length),(!this.props.skipActivities||!B)&&a.push(k.outerHTML)}if(t){const y=this.htmlElement.getElementsByTagName("head")[0];this.bookInfo.setSomeBookInfoFromHead(y);const k=this.htmlElement.getElementsByTagName("body")[0];if(this.metaDataObject&&(this.bookInfo.setSomeBookInfoFromMetadata(this.metaDataObject,k),this.reportBookOpened(k)),this.props.controlsCallback){const P=rl.createLangDataArrayFromDomAndMetadata(k,this.metaDataObject);this.hasImageDescriptions=KM(k),this.props.controlsCallback(P,this.hasImageDescriptions,N=>{this.swiperInstance?.slideTo(N)})}}if(t){var p;try{p=await SM(this.htmlElement,this.urlPrefix,this.bookInfo,()=>this.legacyQuestionHandler.getPromiseForAnyQuizCss())}catch(y){this.HandleLoadingError(y),p=""}if(this.startingUpSwiper=!0,this.state.startPageId){if(d[this.state.startPageId]===void 0)throw new Error(`Page ID ${this.state.startPageId} not found in the current pageIdToIndexMap`);this.setState({startPageIndex:d[this.state.startPageId]})}this.setState({pages:a,pageIdToIndexMap:d,styleRules:p,isLoading:!1,currentSwiperIndex:this.state.startPageIndex??0})}else this.setState({pages:a,isLoading:!1});this.props.pageStylesAreNowInstalled(),t?window.setTimeout(()=>{this.setState({isFinishUpForNewBookComplete:!0});const y=this.startingUpSwiper;this.startingUpSwiper=!1;var k=this.state.startPageIndex??0;this.setIndex(k),this.showingPage(k),y&&this.addScrollbarsToPageWhenReady(this.swiperInstance.activeIndex);const P=document.getElementsByClassName("swiper-button-next")[0];document.getElementsByClassName("swiper-button-prev")[0]?.setAttribute("tabindex","4"),P?.setAttribute("tabindex","5"),this.shouldFocusNextButtonForNewBook()&&P?.focus()},500):Qe.currentPage&&window.setTimeout(()=>{this.setIndex(Qe.currentPageIndex),this.showingPage(Qe.currentPageIndex)},200)}shouldFocusNextButtonForNewBook(){return window.self===window.top||document.referrer.startsWith("http://localhost:")?!0:document.referrer.includes("bloomlibrary.org/player/")}showOrHideL1OnlyText(t,n){t.querySelectorAll(".coverBottomBookTopic, .coverBottomLangName").forEach(a=>{n||a.classList.contains("bloom-content1")?a.classList.remove("do-not-display"):a.classList.add("do-not-display")})}localizeOnce(){!this.isPagesLocalized&&this.state.pages!==this.initialPages&&this.state.styleRules!==this.initialStyleRules&&(wn.localizePages(document.body,this.bookInfo.getPreferredTranslationLanguages()),this.isPagesLocalized=!0)}initializeMedia(){this.video||(this.video=new Zs,this.video.PageVideoComplete=new or,this.video.PageVideoComplete.subscribe(this.handlePageVideoComplete)),this.animation||(this.animation=new Tu),Do.subscribe(this.handlePageNarrationComplete),nl.subscribe(this.handlePlayFailed),Hf.subscribe(this.handlePlayUnblocked),el.subscribe(this.handlePlayCompleted),fx(this.storeAudioAnalytics.bind(this)),Ro.subscribe(this.handleToggleImageDescription.bind(this)),hx(()=>this.swiperInstance?.animating),px(t=>xy(t,1)),this.music||(this.music=new Yx,this.music.PlayFailed=new or,this.music.PlayFailed.subscribe(()=>{this.setState({inPauseForced:!0}),this.props.setForcedPausedCallback&&this.props.setForcedPausedCallback(!0)}))}preprocessUrl(){let t=this.state.bookUrl;if(t===void 0||t.trim()==="")throw new Error("The url parameter was empty. It should point to the url of a book.");return t.endsWith("/")&&(t=t.substring(0,t.length-1)),t.endsWith("%2f")&&(t=t.substring(0,t.length-3)),t}handlePausePlay(){this.props.paused?this.pauseAllMultimedia():Qe.currentPage!==ey()||aa===Cn.MediaFinished?this.resetForNewPageAndPlay(Qe.currentPage):aa===Cn.VideoPaused?this.video.play():(Kx(),this.animation.resumeAnimation(),this.music.play())}getAllBloomCanvasElementsOnPage(){const t=this.htmlElement?.ownerDocument.getElementsByClassName("bloom-canvas");if(t&&t.length>0)return Array.from(t);const n=this.htmlElement?.ownerDocument.getElementsByClassName("bloom-imageContainer");return n?Array.from(n).filter(a=>a.parentElement.closest(".bloom-imageContainer")===null):[]}computeMustUseOriginalPageSize(t){return this.props.useOriginalPageSize||t.querySelector(".bloom-canvas-element")?!0:!!t.querySelector(".bloom-textOverPicture")}updateOverlayPositionsByLangCode(){if(!(!this.props.activeLanguageCode||!this.htmlElement))try{const t=this.props.activeLanguageCode;this.getAllBloomCanvasElementsOnPage().forEach(n=>{Array.from(n.querySelectorAll(ul)).forEach(r=>{const l=Array.from(r.getElementsByClassName("bloom-editable")).find(d=>d.getAttribute("lang")===t);if(l){const d=l.getAttribute("data-bubble-alternate");if(d){const f=JSON.parse(d.replace(/`/g,'"'));r.setAttribute("style",f.style)}}});const a=Array.from(n.getElementsByClassName("comical-alternate")).find(r=>r.getAttribute("data-lang")===t);if(a){const r=n.getElementsByClassName("comical-generated")[0];r&&(r.classList.remove("comical-generated"),r.classList.add("comical-alternate"),r.style.display="none"),a.classList.remove("comical-alternate"),a.classList.add("comical-generated"),a.style.removeProperty("display")}})}catch(t){console.error(t)}}updateDivVisibilityByLangCode(t){if(!this.props.activeLanguageCode||!this.htmlElement)return;const a=this.bookInfo.getPreferredTranslationLanguages()[0]===this.props.activeLanguageCode||!this.props.activeLanguageCode,r=this.props.activeLanguageCode,l=this.htmlElement.ownerDocument.evaluate(".//div[contains(@class, 'bloom-translationGroup')]",this.htmlElement,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null),d="bloom-visibility-code-on";for(let f=0;f<l.snapshotLength;f++){const p=l.snapshotItem(f),y=p.getAttribute("data-default-languages"),k=y?y.split(/,| /):[],P=k==null||k.length===0||!k[0]||k.includes("V")||k.includes("L1")||Qe.areStringsEqualInvariantCultureIgnoreCase(k[0],"auto"),N=p.childNodes;for(let B=0;B<N.length;B++){const L=N.item(B);!L||!L.classList||!L.classList.contains("bloom-editable")||(t&&L.setAttribute("data-original-class",L.getAttribute("class")||""),a?L.setAttribute("class",L.getAttribute("data-original-class")||""):P&&(L.getAttribute("lang")===r?(L.classList.add(d),Array.from(L.classList).forEach(et=>{et.startsWith("bloom-content")&&L.classList.remove(et)}),L.classList.add("bloom-content1"),L.classList.add("bloom-contentFirst")):L.classList.remove(d)))}}}static areStringsEqualInvariantCultureIgnoreCase(t,n){return t.localeCompare(n,"en-US",{sensitivity:"accent"})===0}static isDivInL2(t){return t.classList.contains("bloom-contentNational1")}static isDivInL3(t){return t.classList.contains("bloom-contentNational2")}componentWillUnmount(){this.pauseAllMultimedia(),document.removeEventListener("keydown",t=>this.handleDocumentLevelKeyDown(t)),this.unsubscribeAllEvents()}unsubscribeAllEvents(){this.video.PageVideoComplete.unsubscribe(this.handlePageVideoComplete),Do.unsubscribe(this.handlePageNarrationComplete),nl.unsubscribe(this.handlePlayFailed),Hf.unsubscribe(this.handlePlayUnblocked),el.unsubscribe(this.handlePlayCompleted),Ro.unsubscribe(this.handleToggleImageDescription)}pauseAllMultimedia(){aa===Cn.VideoPlaying?this.video.pause():aa===Cn.AudioPlaying&&(qx(),this.animation.PauseAnimation()),this.music.pause()}reportBookOpened(t){const n=this.bookInfo.getAmbientAnalyticsProps();this.distributionSource&&(n.distributionSource=this.distributionSource),BS(n),Cy("BookOrShelf opened",{})}sendUpdateOfBookProgressReportToExternalContext(){const t=this.bookInteraction.getProgressReportPropertiesForAnalytics();DS("Pages Read",t)}makeNonEditable(t){const n=t.ownerDocument.evaluate(".//*[@contenteditable]",t,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(let a=0;a<n.snapshotLength;a++)n.snapshotItem(a).removeAttribute("contenteditable")}setPageSizeClass(t){return Qe.setPageSizeClass(t,this.bookInfo.canRotate,this.props.landscape,this.mustUseOriginalPageSize,this.originalPageClass)}static getPageSizeClass(t){const a=(t.getAttribute("class")||"").match(/\b\S*?(Portrait|Landscape)\b/);return a&&a.length?a[0]:""}static setPageSizeClass(t,n,a,r,l){let d=!1;const f=this.getPageSizeClass(t);if(f){d=n?a:f.endsWith("Landscape");let p="";r?p=d?l.replace("Portrait","Landscape"):l.replace("Landscape","Portrait"):p=d?"Device16x9Landscape":"Device16x9Portrait",f!==p&&(t.classList.remove(f),t.classList.add(p))}return d}goToFirstPage(){this.swiperInstance.slideTo(0)}goToLastPage(){this.swiperInstance.slideTo(99999)}fixRelativeUrls(t){const n=t.ownerDocument.evaluate(".//*[@src]",t,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(let l=0;l<n.snapshotLength;l++){const d=n.snapshotItem(l);if(!d)continue;const f=d.getAttribute("src"),p=this.fullUrl(f);d.setAttribute("src",p)}const a=t.ownerDocument.evaluate(".//*[@style]",t,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null),r=new RegExp(/background-image:url\(['"](.*)['"]\)/);for(let l=0;l<a.snapshotLength;l++){const d=a.snapshotItem(l);if(!d)continue;const f=d.getAttribute("style")||"",p=r.exec(f);if(!p)continue;const y=this.fullUrl(p[1]),k=f.replace(r,"");d.setAttribute("style",k),d.setAttribute("data-background",y),d.classList.add("swiper-lazy")}}fullUrl(t){return this.urlPrefix+"/"+t}getRootDiv(){return this.rootDiv}slideNext(){this.swiperInstance&&this.swiperInstance.slideNext()}slidePrevious(){this.swiperInstance&&this.swiperInstance.slidePrev()}getBookInstanceId(){return this.bookInfo.bookInstanceId}getPlayerOptionsForPage(t){if(!t)return;let n=t.getAttribute("data-player-options");if(n)try{return n=n.replace(/'/g,'"'),JSON.parse(n)}catch(a){console.log("getPlayerOptionsForPage failed to parse json: "+n+" with error "+a.message);return}}render(){const t=this.activityManager.getActivityAbsorbsDragging();if(this.state.isLoading)return O.createElement(yP,{className:"loadingSpinner",color:"secondary"});if(this.state.loadFailed)return O.createElement(O.Fragment,null,O.createElement(r1,{className:"loadFailedIcon",color:"secondary"}),O.createElement("div",{className:"loadErrorMessage",dangerouslySetInnerHTML:{__html:this.state.loadErrorHtml}}));if(this.state.requiredVersion)return O.createElement("div",{className:"requiredVersionMessage"},this.state.requiredVersion);kx(this.props.shouldReadImageDescriptions&&this.hasImageDescriptions);const n={getSwiper:r=>{this.swiperInstance=r,this.metaDataObject?.isRtl&&this.swiperInstance&&(this.swiperInstance.el?.setAttribute("dir","rtl"),this.swiperInstance.rtl=!0,this.swiperInstance.rtlTranslate=!0)},simulateTouch:!0,touchStartPreventDefault:!1,on:{slideChange:()=>{this.state.inPauseForced&&this.props.setForcedPausedCallback&&this.props.setForcedPausedCallback(!1),this.setState({inPauseForced:!1}),this.startingUpSwiper||this.showingPage(this.swiperInstance.activeIndex)},slideChangeTransitionStart:()=>{this.startingUpSwiper||this.setIndex(this.swiperInstance.activeIndex)},slideChangeTransitionEnd:()=>{this.addScrollbarsToPageWhenReady(this.swiperInstance.activeIndex)}},keyboard:{enabled:!0,onlyInViewport:!1},preloadImages:!1,lazy:{loadPrevNext:!0,loadOnTransitionStart:!0,loadPrevNextAmount:2},shouldSwiperUpdate:!0};this.startingUpSwiper&&(n.activeSlideKey=this.state.startPageIndex?.toString());let a="bloomPlayer";return this.currentPageHidesNavigationButtons?a+=" hideNextPrevButtons extraScalingForChrome85Bug":(this.props.outsideButtonPageClass&&(a+=" "+this.props.outsideButtonPageClass),t&&(a+=" showNavigationButtonsEvenOnTouchDevices")),O.createElement("div",{"aria-label":"Player Content",className:a+(this.props.extraClassNames?" "+this.props.extraClassNames:""),ref:r=>this.rootDiv=r},O.createElement(ux,{key:this.shouldAutoPlay()?"fade":"slide",...n,effect:this.shouldAutoPlay()?"fade":"slide"},this.state.pages.map((r,l)=>{const f=Math.abs(l-this.state.currentSwiperIndex)<2||this.indicesOfPagesWhereWeShouldPreserveDOMState[l];return O.createElement("div",{key:l,className:"page-preview-slide",onClick:p=>this.handlePageClick(p)},f?O.createElement(O.Fragment,null,O.createElement("style",{scoped:!0},this.state.styleRules),O.createElement("div",{...this.state.importedBodyAttributes,className:`bloomPlayer-page ${this.bookInfo.hasAppearanceSystem?"appearance-system":""} ${this.state.importedBodyAttributes.class??""}`,dangerouslySetInnerHTML:{__html:r}})):"")})),O.createElement("div",{className:"swiper-button-prev "+(this.metaDataObject.isRtl?"swiper-button-right":"swiper-button-left")+(this.props.hideSwiperButtons||this.state.currentSwiperIndex===0?" swiper-button-disabled":""),onClick:()=>this.slidePrevious(),onTouchStart:r=>{this.setState({ignorePhonyClick:!0})}},O.createElement(mi,{className:"nav-button",disableRipple:!0},this.metaDataObject.isRtl?O.createElement(lv,{titleAccess:wn.getTranslation("Button.Prev",this.props.preferredUiLanguages,"Previous Page")}):O.createElement(ov,{titleAccess:wn.getTranslation("Button.Prev",this.props.preferredUiLanguages,"Previous Page")}))),O.createElement("div",{className:"swiper-button-next "+(this.metaDataObject.isRtl?"swiper-button-left":"swiper-button-right")+(this.props.hideSwiperButtons||this.state.currentSwiperIndex>=this.state.pages.length-1?" swiper-button-disabled":""),onClick:()=>this.slideNext(),onTouchStart:r=>{this.setState({ignorePhonyClick:!0})}},O.createElement(mi,{className:"nav-button",disableRipple:!0},this.metaDataObject.isRtl?O.createElement(ov,{titleAccess:wn.getTranslation("Button.Next",this.props.preferredUiLanguages,"Next Page")}):O.createElement(lv,{titleAccess:wn.getTranslation("Button.Next",this.props.preferredUiLanguages,"Next Page")}))))}shouldAutoPlay(){var t=this.bookInfo.autoAdvance&&this.props.landscape;return this.props.autoplay==="yes"?t=!0:this.props.autoplay==="no"&&(t=!1),t&&!this.skipAutoPlay}setIndex(t){if(this.state.isLoading||this.startingUpSwiper)return;this.setState({currentSwiperIndex:t});const n=this.getPageAtSwiperIndex(t);n&&(this.setPageSizeClass(n),this.animation.HandlePageBeforeVisible(n),this.video.hidingPage(),this.video.HandlePageBeforeVisible(n),Hx(),this.music.hidingPage(),aa===Cn.AudioPaused||aa===Cn.VideoPaused?Un(Cn.NewPageMediaPaused):(this.skipAutoPlay=!0,Bx(),this.skipAutoPlay=!1,Un(Cn.NewPage)))}getPageAtSwiperIndex(t){if(this.swiperInstance==null)return null;const n=this.swiperInstance.slides[t];return n?n.getElementsByClassName("bloom-page")[0]:null}getPageIdFromIndex(t){const n=this.getPageAtSwiperIndex(t);if(!n)throw new Error("No bloomPage at index "+t);return n.getAttribute("id")}static getCurrentPage(){return Qe.currentPage}isXmatterPage(){const t=Qe.currentPage;if(!t)return!0;const n=t.getAttribute("class");return!n||n.indexOf("bloom-page")<0||n.indexOf("bloom-backMatter")>=0||n.indexOf("bloom-frontMatter")>=0?!0:t.hasAttribute("data-xmatter-page")}showingPage(t){if(this.state.isLoading||this.startingUpSwiper)return;this.props.pageChanged&&this.props.pageChanged(t);const n=this.getPageAtSwiperIndex(t);if(!n){window.setTimeout(()=>this.showingPage(t),50);return}const a=this.getPlayerOptionsForPage(n);this.currentPageHidesNavigationButtons=!!(a&&a.hideNavigation),this.props.hidingNavigationButtonsCallback&&this.props.hidingNavigationButtonsCallback(this.currentPageHidesNavigationButtons),this.activityManager.showingPage(t,n)&&(this.indicesOfPagesWhereWeShouldPreserveDOMState[t]=!0),window.setTimeout(()=>{Qe.currentPage=n,Qe.currentPageIndex=t,Qe.currentPageHasVideo=Zs.pageHasVideo(n),this.setPageSizeClass(n),this.resetForNewPageAndPlay(n),this.props.paused&&this.animation.shouldAnimate(n)&&(this.animation.HandlePageBeforeVisible(n),this.animation.HandlePageVisible(n,this.props.paused),this.animation.HandlePageDurationAvailable(n,km(n),this.props.paused)),this.isXmatterPage()||(this.bookInteraction.pageShown(t),t===this.indexOflastNumberedPage&&(this.bookInteraction.lastNumberedPageWasRead=!0)),this.props.reportPageProperties&&this.props.reportPageProperties({hasAudio:Ox(n),hasMusic:this.music.pageHasMusic(n),hasVideo:Qe.currentPageHasVideo}),this.bookInteraction.reportedAudioOnCurrentPage=!1,this.bookInteraction.reportedVideoOnCurrentPage=!1,this.sendUpdateOfBookProgressReportToExternalContext(),this.swiperInstance.params.noSwiping=this.activityManager.getActivityAbsorbsDragging(),this.swiperInstance.params.touchRatio=this.activityManager.getActivityAbsorbsDragging()?0:1,this.activityManager.getActivityAbsorbsTyping()?this.swiperInstance.keyboard.disable():this.swiperInstance.keyboard.enable(),Array.from(n.querySelectorAll("[data-sound]")).forEach(l=>{l.addEventListener("click",Gh)})},0)}addScrollbarsToPageWhenReady(t){if(this.state.isLoading||this.startingUpSwiper)return;const n=this.getPageAtSwiperIndex(t);if(!n){window.setTimeout(()=>this.addScrollbarsToPageWhenReady(t),50);return}A1(n,Qe.handlePointerMoveEvent)}static handlePointerMoveEvent(t){t.pointerType==="mouse"&&t.target?.closest(".nicescroll-cursors")&&t.stopPropagation()}storeAudioAnalytics(t){t<.001||Number.isNaN(t)||(this.bookInteraction.totalAudioDuration+=t,!this.isXmatterPage()&&(this.bookInteraction.reportedAudioOnCurrentPage||(this.bookInteraction.reportedAudioOnCurrentPage=!0,this.bookInteraction.audioPageShown(Qe.currentPageIndex)),this.sendUpdateOfBookProgressReportToExternalContext()))}static storeVideoAnalytics(t){if(t<.001)return;const n=Qe.currentPagePlayer;n.bookInteraction.totalVideoDuration+=t,!n.bookInteraction.reportedVideoOnCurrentPage&&!n.isXmatterPage()&&(n.bookInteraction.reportedVideoOnCurrentPage=!0,n.bookInteraction.videoPageShown(Qe.currentPageIndex)),n.sendUpdateOfBookProgressReportToExternalContext()}resetForNewPageAndPlay(t){if(this.props.paused){this.video.HandlePageVisible(t,()=>this.props.paused);return}if(ty(t),Qe.currentPageHasVideo){const n=()=>{this.video.HandlePageVisible(t,()=>this.props.paused),this.music.pause()};if(Un(Cn.VideoPlaying),!this.sentBloomNotification&&(this.sentBloomNotification=!0,this.props.shouldReportSoundLog)){_f("/publish/av/startRecording",this.videoList).then(n);return}n()}else this.playAudioAndAnimation(t)}playAudioAndAnimation(t){if(this.activityManager.getActivityManagesSound()){this.activityManager.doInitialSoundAndAnimation();return}if(Un(Cn.AudioPlaying),!t)return;const n=km(t);this.animation.HandlePageDurationAvailable(t,n,this.props.paused);const a=()=>{Tu.pageHasAnimation(t)&&this.animation.HandlePageBeforeVisible(t),this.animation.HandlePageVisible(t,this.props.paused),ay(t,this.animation.animatableCanvas),this.music.HandlePageVisible(t)};if(!this.sentBloomNotification&&(this.sentBloomNotification=!0,this.props.shouldReportSoundLog)){_f("/publish/av/startRecording",this.videoList).then(a);return}a()}getVideoList(t){let n="";for(const l of Array.from(t.getElementsByTagName("video"))){var a=l,r=a.getElementsByTagName("source")[0].getAttribute("src");n&&(n+="|"),n+=r}return n}handlePageClick(t){if(!this.state.ignorePhonyClick&&(!this.activityManager.getActivityAbsorbsClicking()||t.target.closest("[data-href]")&&t.target.closest(".bloom-canvas"))&&!t.target.closest(".bloom-videoContainer")){const n=MM(t.nativeEvent,this.bookInfo.bookInstanceId,()=>this.getPageIdFromIndex(this.state.currentSwiperIndex));n?(this.navigate(n.bookUrl,n.pageId),t.stopPropagation(),t.preventDefault()):this.props.onContentClick&&this.props.onContentClick(t)}this.setState({ignorePhonyClick:!1})}}function OM(e){return e.replace("%23","#").replace(/[\u00A0-\u9999<>\&]/gim,t=>"&#"+t.charCodeAt(0)+";")}function KM(e){return e.ownerDocument.evaluate("//div[contains(@class, 'bloom-imageDescription')]/div[contains(@class, 'bloom-editable') and contains(@class, 'bloom-visibility-code-on')]//*[contains(@class, 'audio-sentence') or contains(@class, 'bloom-highlightSegment')]",e,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null).snapshotLength>0?!0:e.ownerDocument.evaluate("//div[contains(@class, 'bloom-imageDescription')]/div[contains(@class, 'bloom-editable') and contains(@class, 'bloom-visibility-code-on') and @data-audiorecordingmode='TextBox']/p[text()]",e,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null).snapshotLength>0}var Rs={},Bv;function qM(){if(Bv)return Rs;Bv=1;var e=Ja(),t=Qa();Object.defineProperty(Rs,"__esModule",{value:!0}),Rs.default=void 0;var n=t(ia()),a=e(ti()),r=(0,a.default)(n.createElement("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"}),"ArrowBack");return Rs.default=r,Rs}var $M=qM();const HM=Rn($M);var js={},zv;function FM(){if(zv)return js;zv=1;var e=Ja(),t=Qa();Object.defineProperty(js,"__esModule",{value:!0}),js.default=void 0;var n=t(ia()),a=e(ti()),r=(0,a.default)(n.createElement("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreHoriz");return js.default=r,js}var WM=FM();const _M=Rn(WM);var Os={},Iv;function VM(){if(Iv)return Os;Iv=1;var e=Ja(),t=Qa();Object.defineProperty(Os,"__esModule",{value:!0}),Os.default=void 0;var n=t(ia()),a=e(ti()),r=(0,a.default)(n.createElement("path",{d:"M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"}),"PlayCircleOutline");return Os.default=r,Os}var GM=VM();const jb=Rn(GM);var Ks={},Dv;function UM(){if(Dv)return Ks;Dv=1;var e=Ja(),t=Qa();Object.defineProperty(Ks,"__esModule",{value:!0}),Ks.default=void 0;var n=t(ia()),a=e(ti()),r=(0,a.default)(n.createElement("path",{d:"M9 16h2V8H9v8zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm1-4h2V8h-2v8z"}),"PauseCircleOutline");return Ks.default=r,Ks}var YM=UM();const XM=Rn(YM);var qs={},Rv;function ZM(){if(Rv)return qs;Rv=1;var e=Ja(),t=Qa();Object.defineProperty(qs,"__esModule",{value:!0}),qs.default=void 0;var n=t(ia()),a=e(ti()),r=(0,a.default)(n.createElement("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56zm2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.16-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z"}),"Language");return qs.default=r,qs}var JM=ZM();const QM=Rn(JM);var $s={},jv;function tA(){if(jv)return $s;jv=1;var e=Ja(),t=Qa();Object.defineProperty($s,"__esModule",{value:!0}),$s.default=void 0;var n=t(ia()),a=e(ti()),r=(0,a.default)(n.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"}),"Fullscreen");return $s.default=r,$s}var eA=tA();const nA=Rn(eA);var Hs={},Ov;function aA(){if(Ov)return Hs;Ov=1;var e=Ja(),t=Qa();Object.defineProperty(Hs,"__esModule",{value:!0}),Hs.default=void 0;var n=t(ia()),a=e(ti()),r=(0,a.default)(n.createElement("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}),"FullscreenExit");return Hs.default=r,Hs}var iA=aA();const rA=Rn(iA);function oA(e){return Dt.createElement(lh,{...e,width:"21",height:"20",viewBox:"0 0 21 20"},Dt.createElement("path",{d:"M20.6181 9.909C20.6181 9.909 17.3581 3.70568 10.2454 3.70568C10.1127 3.70568 9.9821 3.70851 9.8522 3.71275L9.23133 0.590958L8.27889 0.807585L8.87136 3.78574C2.72807 4.50344 0 9.86355 0 9.86355C0 9.86355 0.566707 11.0581 1.77366 12.4165L1.27674 9.91983C1.26639 9.90052 1.26089 9.89016 1.26089 9.89016C1.26089 9.89016 1.45882 9.53343 1.86833 9.01188L2.73952 13.3918C3.09729 13.7179 3.49205 14.0383 3.92423 14.3419L2.68074 8.09074C2.92754 7.84068 3.20826 7.58049 3.52199 7.32171L5.05787 15.0424C5.40441 15.2277 5.77033 15.3993 6.15474 15.5514L4.38901 6.67725C4.6772 6.48487 4.98565 6.29932 5.31568 6.12485L7.26481 15.9206C7.59924 16.0118 7.94578 16.0871 8.30509 16.146L7.56314 12.4167C7.89823 12.8518 8.32205 13.2046 8.80465 13.4464L9.36563 16.2656C9.59813 16.2802 9.83459 16.2891 10.0765 16.2891C10.1734 16.2891 10.2694 16.2873 10.3654 16.2844L9.86541 13.773C10.0112 13.7923 10.1591 13.8033 10.3099 13.8033C10.4957 13.8033 10.6783 13.7883 10.8559 13.7588L11.9801 19.4091L12.9321 19.1924L12.3108 16.0683C17.848 14.9378 20.6181 9.909 20.6181 9.909ZM6.88084 8.9881L6.22651 5.69889C6.53386 5.57339 6.8575 5.45942 7.19546 5.35982L7.6228 7.50844C7.28066 7.93015 7.02351 8.43381 6.88084 8.9881ZM8.46692 6.74577L8.14503 5.12836C8.45547 5.06785 8.77691 5.01958 9.11002 4.9859L9.3773 6.32923C9.05322 6.42294 8.74741 6.56375 8.46692 6.74577ZM10.3467 6.19713L10.0944 4.93033C10.1472 4.92963 10.1998 4.92845 10.2533 4.92845C10.4858 4.92845 10.713 4.93599 10.9365 4.94941C13.2188 5.33628 14.964 7.44981 14.964 9.99965C14.964 12.1188 13.7579 13.9352 12.0406 14.7106L11.7914 13.4565C13.0153 12.8558 13.8654 11.5342 13.8654 9.99942C13.8652 7.91226 12.2936 6.21856 10.3467 6.19713ZM14.5336 14.0984C15.4349 13.0056 15.9823 11.5718 15.9823 9.99942C15.9823 8.35399 15.3821 6.8595 14.405 5.74928C17.7771 7.16772 19.3574 9.92642 19.3574 9.92642C19.3574 9.92642 17.7491 12.6074 14.5336 14.0984Z"}))}var Fs={},Kv;function sA(){if(Kv)return Fs;Kv=1;var e=Ja(),t=Qa();Object.defineProperty(Fs,"__esModule",{value:!0}),Fs.default=void 0;var n=t(ia()),a=e(ti()),r=(0,a.default)(n.createElement("path",{d:"M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"}),"VolumeUp");return Fs.default=r,Fs}var lA=sA();const uA=Rn(lA),cA=e=>{const[t,n]=O.useState((e.languages.filter(d=>d.IsSelected)[0]||e.languages[0]).Code),a=d=>{const f=d.target.value;n(f),e.onClose(f)},r=()=>{e.onClose("")},l=()=>{const d=e.languages.map(f=>Dt.createElement("div",{className:"chooserItem",key:f.Code},Dt.createElement(XP,{value:f.Code,control:Dt.createElement(uM,null),label:f.Name,checked:f.Code===t}),Dt.createElement("span",{className:"spacer"}),Dt.createElement(uA,{className:"icon",visibility:f.HasAudio?"inherit":"hidden"})));return Dt.createElement("div",{className:"radioGroupDiv"},d)};return Dt.createElement(RP,{className:"languageMenu",onClose:r,"aria-labelledby":"language-menu-title",open:!0,scroll:"paper"},Dt.createElement(HP,{id:"language-menu-title"},"Languages in this book:"),Dt.createElement(GP,{component:"fieldset"},Dt.createElement(cM,{className:"radioGroup","aria-label":"languages",name:"languages",value:t,onChange:a},l())),Dt.createElement(KP,null,Dt.createElement(fP,{onClick:r,color:"secondary"},"Close")))};var Ys=(e=>(e[e.showArrow=0]="showArrow",e[e.showEllipsis=1]="showEllipsis",e[e.showNothing=2]="showNothing",e))(Ys||{});const dA=e=>{const[t,n]=O.useState(!1),a="button"+(e.bookLanguages.length<2?" disabled":""),r=L=>{n(!1),L!==""&&(e.onLanguageChanged(L),d({lang:L}))},l=()=>{try{document.fullscreenElement!=null||document.webkitFullscreenElement!=null?document.exitFullscreen?document.exitFullscreen():document.webkitExitFullScreen&&document.webkitExitFullScreen():document.documentElement.requestFullscreen?document.documentElement.requestFullscreen():document.documentElement.webkitRequestFullscreen&&document.documentElement.webkitRequestFullscreen()}catch(L){console.error("RequestFullScreen failed: ",L)}},d=L=>{if(!e.videoPreviewMode)return;const $={lang:e.activeLanguageCode,imageDescriptions:e.readImageDescriptions,...L};_f("publish/av/videoSettings",encodeURIComponent(JSON.stringify($)))},f=wn.getTranslation("Audio.Pause",e.preferredLanguages,"Pause"),p=e.paused?Dt.createElement(jb,{titleAccess:e.playLabel}):Dt.createElement(XM,{titleAccess:f}),y=wn.getTranslation("Button.ReadImageDescriptions",e.preferredLanguages,"Read Image Descriptions"),k=wn.getTranslation("Button.IgnoreImageDescriptions",e.preferredLanguages,"Ignore Image Descriptions"),P=sl({palette:{primary:{main:zM},secondary:{main:Db.palette.secondary.main}}}),N=Dt.createElement(ju,{theme:P},Dt.createElement(oA,{"aria-label":e.readImageDescriptions?"Read image descriptions":"Ignore image descriptions",titleAccess:e.readImageDescriptions?k:y,opacity:e.readImageDescriptions?1:.38,color:e.nowReadingImageDescription?"primary":"secondary"})),B=e.extraButtons?e.extraButtons.map(L=>Dt.createElement(mi,{key:L.id,color:"secondary",title:L.description,onClick:()=>ki({messageType:L.id})},Dt.createElement("img",{style:{maxHeight:"24px",maxWidth:"24px"},src:L.iconUrl}))):void 0;return Dt.createElement(nP,{color:"primary",className:`control-bar ${e.visible?", visible":""}`,id:"control-bar",elevation:0,position:"relative"},Dt.createElement(kM,null,!e.videoPreviewMode&&Dt.createElement(mi,{color:"secondary",onClick:()=>{e.backClicked&&e.backClicked()},"data-testid":"history-back-button",disabled:e.getBackButtonState()===2},e.getBackButtonState()===0?Dt.createElement(HM,{"aria-label":"Go Back",titleAccess:wn.getTranslation("Button.Back",e.preferredLanguages,"Back")}):e.getBackButtonState()===1&&Dt.createElement(_M,{"aria-label":"More Menu",titleAccess:wn.getTranslation("Button.More",e.preferredLanguages,"More")})),Dt.createElement("div",{className:"filler"}),e.bookHasImageDescriptions&&Dt.createElement(mi,{onClick:()=>{e.onReadImageDescriptionToggled(),d({imageDescriptions:!e.readImageDescriptions})}},N),e.bookLanguages.length>1&&Dt.createElement(mi,{className:a,"aria-label":"Choose Language",color:"secondary",onClick:()=>{n(!0)}},Dt.createElement(QM,{titleAccess:wn.getTranslation("Button.ChooseLanguage",e.preferredLanguages,"Choose Language")})),t&&Dt.createElement(cA,{languages:e.bookLanguages,onClose:r}),!e.videoPreviewMode&&Dt.createElement(mi,{color:"secondary","aria-label":"PlayPause",onClick:()=>{e.pausedChanged&&e.pausedChanged(!e.paused)}},e.showPlayPause?p:null),B,document.fullscreenEnabled&&e.canShowFullScreen&&!e.videoPreviewMode&&Dt.createElement(mi,{color:"secondary",onClick:()=>l()},document.fullscreenElement==null?Dt.createElement(nA,{"aria-label":"Full Screen",titleAccess:wn.getTranslation("Button.FullScreen",e.preferredLanguages,"Full Screen")}):Dt.createElement(rA,{"aria-label":"Exit Full Screen",titleAccess:wn.getTranslation("Button.ExitFullScreen",e.preferredLanguages,"Exit Full Screen")}))))};function Rf(e,t){return Math.round(e/t)*t}function fA(e){if(!(!e||e==="cover")){if(/^\d+$/.test(e))return e;try{return e.replace(new RegExp("(?![0-9])\\p{Nd}","gu"),t=>{const n=t.charCodeAt(0);return(n&15)-6*(new RegExp("\\p{Nd}","u").test(String.fromCodePoint(n|15))?1:0)})}catch{return}}}let jf=!1,vh=e=>{};function hA(e){vh&&vh(e)}let qv=0,$v=0;function Hv(){const e=/iPad|iPhone|iPod/.test(navigator.platform);let t,n,a;e&&(t=document.getElementsByClassName("bloomPlayer")[0],n=t.parentElement,a=t.nextSibling,n.removeChild(t));const r=document.documentElement.clientWidth,l=document.documentElement.clientHeight;return e&&n.insertBefore(t,a),{width:r,height:l}}const pA=e=>{const[t,n]=O.useState(e.autoplay),a=e.centerVertically===void 0?!0:e.centerVertically;qS(Tt=>{Tt.pause?(jf=!D,R(!0)):Tt.resume&&jf?R(!1):Tt.play?(R(!1),Tt.autoplay&&n(Tt.autoplay)):Tt.reset?(k(e.startPage??0),je.current&&je.current(e.startPage??0)):Tt.controlAction&&ct(Tt.controlAction)});const[r,l]=O.useState(!1),[d,f]=O.useState(e.initiallyShowAppBar),[,p]=O.useState(0);O.useEffect(()=>{const Tt=()=>{f(!0),p(Vt=>Vt+1)};return mh.subscribe(Tt),()=>{mh.unsubscribe(Tt)}},[]);const[y,k]=O.useState(e.startPage??0),[P,N]=O.useState([""]),[B,L]=O.useState(!1),[$,et]=O.useState(!1),[W,U]=O.useState(""),[_,tt]=O.useState("Device16x9Portrait");O.useEffect(()=>{f(e.initiallyShowAppBar)},[e.initiallyShowAppBar]),O.useEffect(()=>{d?jS():OS()},[d]),O.useEffect(()=>{R(e.paused)},[e.paused]);const[D,R]=O.useState(e.paused),[m,ot]=O.useState(!1),st=wn.getBloomUiLanguage(),Nt=st==="en"?[st]:[st,"en"],[Pt,Et]=O.useState(Nt);O.useEffect(()=>{D||(jf=!1)},[D]);const[Q,F]=O.useState(!1),[s,pt]=O.useState(!1),[x,dt]=O.useState(!1),[bt,St]=O.useState(!1),[q,wt]=O.useState(!1),[xt,Ot]=O.useState(0),[Lt,Ft]=O.useState(9/16),te=[],[de,me]=O.useState(te),[Ee,cn]=O.useState(""),je=O.useRef(),[sn,Ue]=O.useState(!0),[kn,Xe]=O.useState(!1),[yn,tn]=O.useState(!1),[dn,M]=O.useState(0),j=()=>{M(Tt=>Tt+1)},[X,lt]=O.useState("");O.useEffect(()=>{Zt()},[q,dn,Q,e.useOriginalPageSize]),O.useEffect(()=>()=>{const Tt=document.getElementById("scale-style-sheet");Tt&&Tt.parentNode.removeChild(Tt)},[]);const vt=O.useRef(),ct=Tt=>{switch(Tt){case"navigate-to-next-page":vt&&vt.current&&vt.current.slideNext();break;case"navigate-to-previous-page":vt&&vt.current&&vt.current.slidePrevious();break;default:console.log("'handleControlMessage' received an unknown message.");return}},Zt=()=>{const Tt=document.getElementsByClassName("swiper-slide-active")[0];let Vt=null;if(Tt&&(Vt=Tt.getElementsByClassName("bloom-page")[0]),!Vt||!q){window.setTimeout(j,100);return}let He=document.getElementById("scale-style-sheet");He||(He=document.createElement("style"),He.setAttribute("type","text/css"),He.setAttribute("id","scale-style-sheet"),document.head.appendChild(He));let ve=xt,ke=Lt;const jt=Qe.getPageSizeClass(Vt);(e.url!==W||jt!==_)&&(U(e.url),tt(jt),window.onresize=()=>{const{width:ya,height:ba}=Hv();(ba!==$v||ya!==qv)&&j()},ve=Math.max(Vt.offsetHeight,Vt.offsetWidth),ke=Math.min(Vt.offsetHeight,Vt.offsetWidth)/ve,Ft(ke),Ot(ve));const{width:$t,height:se}=Hv();qv=$t,$v=se;const Oe=$t>se;if(Oe!==Q){F(Oe);return}let Ae=0,fn=0;const Me=window.getComputedStyle(document.body);Me&&Me.marginTop&&(Ae=parseInt(Me.marginTop,10)),Me&&Me.marginBottom&&(fn=parseInt(Me.marginBottom,10));const ma=Vt.getAttribute("class").indexOf("Landscape")>=0,oa=ma?ve*ke:ve,On=ma?ve:ve*ke;let sa=Ae+fn;if(d){const ya=document.getElementById("control-bar");ya&&(sa+=ya.offsetHeight);const ba=document.getElementById("pageNumberControl");ba&&(sa+=ba.offsetHeight)}const Ta=se-sa,dr=Pe({pageWidth:On,pageHeight:oa,desiredPageHeight:Ta}),Sn=De(On);let Re=Math.min(dr,Sn);const Kn=oa*Re;let va=Kn*ke/Re;ma&&(va=Kn/ke/Re);const qn=$t/Re-va;let Ea="",$a=Math.max(($t-On*Re)/2,0);e.roundMarginToNearestK&&($a=Rf($a,e.roundMarginToNearestK));const Zn=$a,fr=Re,hr=30;if(qn>100*2)Ea="largeOutsideButtons";else if(qn>hr*2)Ea="smallOutsideButtons";else if($t>407&&navigator.userAgent.includes("Chrome")&&!e.hideSwiperButtons){const ba=new RegExp(" Chrome/([0-9]+).").exec(navigator.userAgent),ji=parseInt(ba[1]);ji&&ji<90&&(Re*=.9,$a=Math.max(($t-On*Re)/2,0),Ea="smallOutsideButtons extraScalingForChrome85Bug")}Ea!==X&&lt(Ea);let xi="";if(a){const ya=(se-Kn-sa)/2;ya>0&&(xi=`translate(0, ${ya.toFixed(0)}px) `)}He.innerText=`.bloomPlayer {
7982
+ `,"").replace("\r","")}const ac=[];function EM(){return ac.length>0}function PM(e){const t=ac.pop();if(t)return{bookUrl:e===t.bookId?void 0:gh(t.bookId),pageId:t.pageId}}function MM(e,t,n){const a=e.target.closest("[href], [data-href]");if(!a)return;e.preventDefault(),e.stopPropagation();const r=(a.getAttribute("href")||a.getAttribute("data-href"))??void 0;if(!r)return;if(r.startsWith("http://")||r.startsWith("https://")){window.open(r,"_blank","noreferrer");return}let l,d;if(r==="back"){const p=ac.pop();return p?{bookUrl:t===p.bookId?void 0:gh(p.bookId),pageId:p.pageId}:void 0}else if(r.startsWith("/book/")){const p=AM(r);l=p.bookId,d=p.pageId,p.bookId===t&&(l=void 0)}else r.startsWith("#")&&(d=r.substring(1));const f=n();if(l)return Ev(t,f),{bookUrl:gh(l),pageId:d};if(d)return Ev(t,f),{pageId:d}}function Ev(e,t,n){ac.push({bookId:e,pageId:t})}function gh(e){return`/book/${e}/index.htm`}function AM(e){try{const t=new URL(e,window.location.origin);if(!t.pathname.startsWith("/book/"))throw new Error("Invalid book URL format");const n=t.pathname.replace("/book/",""),a=t.hash.replace("#","");return{bookId:n,pageId:a}}catch(t){return console.error("Error parsing book URL:",t),{bookId:void 0,pageId:void 0}}}const NM="2.20.0",LM={version:NM},ar="#d65649",BM="#2e2e2e",zM="#febf00",Db=sl({palette:{primary:{main:BM,contrastText:ar},secondary:{main:ar}}});function Rb(){var e=LM.version;return e}const IM=({getBookInstanceId:e})=>{const[t,n]=O.useState(!1),a=Rb(),r=new Date("2026-07-06T21:46:05.876Z").toLocaleDateString();if(O.useEffect(()=>{const d=p=>{p.key==="Control"&&n(!0)},f=p=>{p.key==="Control"&&n(!1)};return window.addEventListener("keydown",d),window.addEventListener("keyup",f),()=>{window.removeEventListener("keydown",d),window.removeEventListener("keyup",f)}},[]),!t)return null;const l=e?.();return Dt.createElement("div",{className:"diagnostic-info-control",style:{color:ar,fontFamily:"sans-serif",padding:"5px",zIndex:1e3,lineHeight:"1.5"}},Dt.createElement("div",null,"Bloom Player v",a," (built ",r,")"),Dt.createElement("div",null,"Book ID: ",l??""))},DM=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Pv=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const t=e.match(DM);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Mv=e=>e==="*"||e==="x"||e==="X",Av=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},RM=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],jM=(e,t)=>{if(Mv(e)||Mv(t))return 0;const[n,a]=RM(Av(e),Av(t));return n>a?1:n<a?-1:0},Nv=(e,t)=>{for(let n=0;n<Math.max(e.length,t.length);n++){const a=jM(e[n]||"0",t[n]||"0");if(a!==0)return a}return 0},Lv=(e,t)=>{const n=Pv(e),a=Pv(t),r=n.pop(),l=a.pop(),d=Nv(n,a);return d!==0?d:r&&l?Nv(r.split("."),l.split(".")):r||l?r?-1:1:0},mh=new or;class Qe extends O.Component{constructor(t,n){super(t,n),this.activityManager=new U1,this.initialPages=["loading..."],this.initialStyleRules="",this.originalPageClass="Device16x9Portrait",this.bookInfo=new ph,this.bookInteraction=new xM,this.mustUseOriginalPageSize=!1,this.indicesOfPagesWhereWeShouldPreserveDOMState={},this.startingUpSwiper=!0,this.state={pages:this.initialPages,pageIdToIndexMap:{},styleRules:this.initialStyleRules,importedBodyAttributes:{},currentSwiperIndex:0,isLoading:!0,loadFailed:!1,loadErrorHtml:"",ignorePhonyClick:!1,isFinishUpForNewBookComplete:!1,inPauseForced:!1,bookUrl:""},this.isPagesLocalized=!1,this.currentPageHidesNavigationButtons=!1,this.handleDocumentLevelKeyDown=r=>{r.key==="Home"&&(this.goToFirstPage(),r.preventDefault()),r.key==="End"&&(this.goToLastPage(),r.preventDefault())},this.distributionSource="",this.finishUpCalled=!1,this.hasImageDescriptions=!1,this.handlePageVideoComplete=r=>{r.page===Qe.currentPage&&this.playAudioAndAnimation(r.page)},this.handlePlayFailed=()=>{this.setState({inPauseForced:!0}),this.props.setForcedPausedCallback&&this.props.setForcedPausedCallback(!0)},this.handlePlayUnblocked=()=>{this.state.inPauseForced&&this.props.setForcedPausedCallback&&this.props.setForcedPausedCallback(!1),this.setState({inPauseForced:!1})},this.handlePlayCompleted=()=>{Un(Cn.MediaFinished),this.props.imageDescriptionCallback(!1)},this.handleToggleImageDescription=r=>{this.props.imageDescriptionCallback(r)},this.handlePageNarrationComplete=r=>{if(r&&(Un(Cn.MediaFinished),this.shouldAutoPlay())){const l=this.props.autoplayCount??0,d=this.state.startPageIndex??0,f=this.swiperInstance.slides.length-1;let p=this.props.autoplayCount?Math.min(d+l-1,f):f;this.swiperInstance.activeIndex>=p?(this.music.pause(),this.props.shouldReportSoundLog&&Ux(),Vx(),IS({})):this.swiperInstance.slideNext()}},this.skipAutoPlay=!1,this.sentBloomNotification=!1;const a=t.url.startsWith("http")?new URL(t.url):new URL(t.url,window.location.origin);a.hash?(this.state.startPageId=a.hash.substring(1),a.hash=""):this.state.startPageIndex=t.startPageIndex,this.state.bookUrl=a.href,Qe.currentPagePlayer=this,this.legacyQuestionHandler=new X1(t.locationOfDistFolder)}componentDidMount(){wn.setUp(),window.addEventListener("focus",()=>this.handleWindowFocus()),window.addEventListener("blur",()=>this.handleWindowBlur()),document.addEventListener("keydown",t=>this.handleDocumentLevelKeyDown(t)),document.addEventListener("pointerdown",t=>{(t.target.closest("[href], [data-href]")||t.target.closest(".bloom-videoContainer")&&!t.target.closest("[data-draggable-id]"))&&(t.stopPropagation(),t.preventDefault())},{capture:!0}),document.addEventListener("dragstart",t=>{this.activityManager.getActivityAbsorbsDragging()||t.preventDefault()},{capture:!0}),this.componentDidUpdate(this.props,this.state)}CanGoBack(){return EM()}HandleBackButtonClickedIfHavePlayerHistory(){const t=this.getBookIdFromBookUrlForHistory(this.state.bookUrl)||this.bookInfo.bookInstanceId,n=PM(t);return n?(this.navigate(n.bookUrl,n.pageId),!0):!1}navigate(t,n){if(t){const a=new URL(t,this.state.bookUrl);this.setState({bookUrl:a.href,startPageId:n,startPageIndex:void 0})}else if(n!==void 0){const a=this.state.pageIdToIndexMap[n];this.swiperInstance.slideTo(a)}}getBookIdFromBookUrlForHistory(t){if(t)try{const a=new URL(t,window.location.href).pathname.match(/^\/book\/([^/]+)\/index\.htm$/i);return a?a[1]:void 0}catch{return}}handleWindowFocus(){const t=localStorage.getItem(zu),n=localStorage.getItem(Cm);t&&n==this.sourceUrl&&(this.bookInteraction.beginReadTime=Date.now()-parseInt(t,10))}handleWindowBlur(){const t=Date.now()-this.bookInteraction.beginReadTime;localStorage.setItem(zu,t.toString()),localStorage.setItem(Cm,this.sourceUrl)}getRequiredVersionMessage(t){const n=t.querySelector('meta[name="FeatureRequirement"]')?.getAttribute("content");if(!n)return"";const a=/BloomPlayerMinVersion":"(.*?)".*?"FeatureId":"(.*?)"/g;let r,l=null,d=null;for(;(r=a.exec(n))!==null;){const p=r[1];(!l||Lv(p,l)>0)&&(l=p,d=r[2])}if(!l||!d)return"";const f=Rb();if(Lv(f,l)>=0)return"";if(window.location.hostname.toLowerCase().indexOf("bloomlibrary.org")>=0)return wn.getTranslation("Version.Problem.Web",this.props.preferredUiLanguages,"This book uses the feature {feature}. Unfortunately, {hostname} is not ready to display this book yet. Please check back again later or write to issues@bloomlibrary.org if you think this is unexpected.").replace("{feature}",d).replace("{hostname}",window.location.hostname);{let p=Ua("host","");switch(p){case"bloomreader":p="Bloom Reader";break;case"bloompubviewer":p="BloomPUB Viewer";break;case"readerapp":p="";break}return p?wn.getTranslation("Version.Problem.Host",this.props.preferredUiLanguages,"This book uses the feature {feature} and requires a newer version of {host} to read it. Please upgrade to the latest version.").replace("{feature}",d).replace("{host}",p):wn.getTranslation("Version.Problem.NoHost",this.props.preferredUiLanguages,"This book uses the feature {feature} and requires a newer version of the program you are using to read it. Please upgrade to the latest version.").replace("{feature}",d)}}componentDidUpdate(t,n){try{if(!this.props.url||this.state.loadFailed&&n.bookUrl===this.state.bookUrl)return;this.initializeMedia();const a=this.preprocessUrl();if(a&&a!=="/working"&&a!==this.sourceUrl){this.finishUpCalled=!1,this.setState({isLoading:!0,loadFailed:!1}),this.metaDataObject=void 0,this.htmlElement=void 0,this.sourceUrl=a;const r=this.sourceUrl.lastIndexOf("/"),l=this.sourceUrl.lastIndexOf("%2f");let d;r>l?d=this.sourceUrl.substring(r+1,this.sourceUrl.length):d=this.sourceUrl.substring(l+3,this.sourceUrl.length);const f=d.endsWith(".htm"),p=f?this.sourceUrl:this.sourceUrl+"/"+d+".htm";this.urlPrefix=f?this.sourceUrl.substring(0,Math.max(r,l)):this.sourceUrl,this.music.urlPrefix=this.urlPrefix,gx(this.music.urlPrefix);const y=Di.get(this.fullUrl(".distribution")).then(N=>N,N=>({data:""})),k=Di.get(p),P=Di.get(this.fullUrl("meta.json"));Promise.all([k,P,y]).then(N=>{const[B,L,$]=N;this.metaDataObject=L?.data,this.distributionSource=$.data;const W=new DOMParser().parseFromString(B?.data,"text/html"),U=W.documentElement,_=this.getRequiredVersionMessage(W);this.setState({requiredVersion:_});const tt=U.getElementsByTagName("body")[0];this.mustUseOriginalPageSize=this.computeMustUseOriginalPageSize(tt),this.bookInfo.setSomeBookInfoFromBody(tt),this.localizeOnce(),this.props.shouldReportSoundLog&&(this.videoList=this.getVideoList(W)),this.animation.PlayAnimations=this.bookInfo.playAnimations,this.collectBodyAttributes(tt),this.makeNonEditable(tt),this.htmlElement=U;const D=U.getElementsByClassName("bloom-page")[0];this.originalPageClass="Device16x9Portrait",D&&(this.originalPageClass=Qe.getPageSizeClass(D)),this.legacyQuestionHandler.generateQuizPagesFromLegacyJSON(this.urlPrefix,tt,this.originalPageClass,()=>{this.finishUp()})}).catch(N=>this.HandleLoadingError(N))}else if(t.landscape!==this.props.landscape||t.useOriginalPageSize!==this.props.useOriginalPageSize||t.autoplay!==this.props.autoplay){const r=document.getElementsByClassName("bloom-page");for(let l=0;l<r.length;l++){const d=r[l];this.setPageSizeClass(d)}}!this.state.isLoading&&(n.isLoading||t.activeLanguageCode!==this.props.activeLanguageCode)&&(this.updateDivVisibilityByLangCode(n.isLoading),this.updateOverlayPositionsByLangCode(),this.finishUpCalled&&this.finishUp(!1)),this.state.currentSwiperIndex!=n.currentSwiperIndex&&this.rootDiv?.querySelectorAll(Qh).forEach(r=>{const l=cl(r).getNiceScroll();l&&l.length>0&&l.remove()}),!this.state.isLoading&&(n.isLoading||t.shouldReadImageDescriptions!==this.props.shouldReadImageDescriptions)&&this.finishUpCalled&&(this.setIndex(this.state.currentSwiperIndex),this.showingPage(this.state.currentSwiperIndex)),this.state.isFinishUpForNewBookComplete&&t.landscape!==this.props.landscape&&(this.setIndex(this.state.currentSwiperIndex),this.showingPage(this.state.currentSwiperIndex)),t.paused!==this.props.paused&&this.handlePausePlay(),this.swiperInstance&&this.swiperInstance.lazy.load()}catch(a){this.setState({isLoading:!1,loadFailed:!0,loadErrorHtml:a.message})}}collectBodyAttributes(t){for(var n={},a=0;a<t.attributes.length;a++)n[t.attributes.item(a).nodeName]=t.attributes.item(a).nodeValue;this.setState({importedBodyAttributes:n})}HandleLoadingError(t){let a=`<p>There was a problem displaying this book: ${t.message}<p>`;const r=!!t.config?.url&&new URL(t.config.url,window.location.href).pathname.startsWith("/book/");r?a="<p>We could not find that book.</p>":(t.config&&t.config.url&&t.config.url.startsWith("file://")||t.message.indexOf("404")>=0)&&(a="<p>This book (or some part of it) was not found.<p>",t.config&&t.config.url&&(a+=`<p class='errorDetails'>${OM(t.config.url)}</p>`)),this.setState({isLoading:!1,loadFailed:!0,loadErrorHtml:a}),r&&mh.raise()}async finishUp(t=!0){if(this.finishUpCalled=!0,!this.htmlElement)return;Zs.setAllVideoPostersTo1x1TransparentPNG(this.htmlElement);const n=this.htmlElement.getElementsByClassName("bloom-page"),a=[];t&&(this.bookInfo.totalNumberedPages=0,this.bookInfo.questionCount=0,this.activityManager.collectActivityContextForBook(n),this.bookInteraction.clearPagesShown(),this.music.processAllMusicForBook(n));const r=this.bookInfo.getPreferredTranslationLanguages(),l=r[0]===this.props.activeLanguageCode||!this.props.activeLanguageCode,d={},f=y=>y.classList.contains("bloom-interactive-page")||y.classList.contains("simple-comprehension-quiz")||y.getAttribute("data-activity")=="iframe"||y.getElementsByClassName("questions").length>0;d.length=0,d.cover=0;for(let y=0;y<n.length;y++){const k=n[y],P=k.getAttribute("id");P&&(d[P]=y);const N=this.setPageSizeClass(k);k.setAttribute("data-index",y.toString(10)),y===0&&this.props.reportBookProperties&&this.props.reportBookProperties({landscape:N,canRotate:this.bookInfo.canRotate,preferredLanguages:r,pageNumbers:Array.from(n).map(L=>L.getAttribute("data-page-number")??""),isRtl:this.metaDataObject.isRtl,internalUrl:this.state.bookUrl}),t&&(this.fixRelativeUrls(k),k.classList.contains("numberedPage")&&(this.indexOflastNumberedPage=y,this.bookInfo.totalNumberedPages++),(k.getAttribute("data-analyticscategories")||k.getAttribute("data-analyticsCategories"))==="comprehension"&&this.bookInfo.questionCount++),this.showOrHideL1OnlyText(k,l);const B=f(k);B&&this.activityManager.initializePageHtml(this.urlPrefix,k,a.length),(!this.props.skipActivities||!B)&&a.push(k.outerHTML)}if(t){const y=this.htmlElement.getElementsByTagName("head")[0];this.bookInfo.setSomeBookInfoFromHead(y);const k=this.htmlElement.getElementsByTagName("body")[0];if(this.metaDataObject&&(this.bookInfo.setSomeBookInfoFromMetadata(this.metaDataObject,k),this.reportBookOpened(k)),this.props.controlsCallback){const P=rl.createLangDataArrayFromDomAndMetadata(k,this.metaDataObject);this.hasImageDescriptions=KM(k),this.props.controlsCallback(P,this.hasImageDescriptions,N=>{this.swiperInstance?.slideTo(N)})}}if(t){var p;try{p=await SM(this.htmlElement,this.urlPrefix,this.bookInfo,()=>this.legacyQuestionHandler.getPromiseForAnyQuizCss())}catch(y){this.HandleLoadingError(y),p=""}if(this.startingUpSwiper=!0,this.state.startPageId){if(d[this.state.startPageId]===void 0)throw new Error(`Page ID ${this.state.startPageId} not found in the current pageIdToIndexMap`);this.setState({startPageIndex:d[this.state.startPageId]})}this.setState({pages:a,pageIdToIndexMap:d,styleRules:p,isLoading:!1,currentSwiperIndex:this.state.startPageIndex??0})}else this.setState({pages:a,isLoading:!1});this.props.pageStylesAreNowInstalled(),t?window.setTimeout(()=>{this.setState({isFinishUpForNewBookComplete:!0});const y=this.startingUpSwiper;this.startingUpSwiper=!1;var k=this.state.startPageIndex??0;this.setIndex(k),this.showingPage(k),y&&this.addScrollbarsToPageWhenReady(this.swiperInstance.activeIndex);const P=document.getElementsByClassName("swiper-button-next")[0];document.getElementsByClassName("swiper-button-prev")[0]?.setAttribute("tabindex","4"),P?.setAttribute("tabindex","5"),this.shouldFocusNextButtonForNewBook()&&P?.focus()},500):Qe.currentPage&&window.setTimeout(()=>{this.setIndex(Qe.currentPageIndex),this.showingPage(Qe.currentPageIndex)},200)}shouldFocusNextButtonForNewBook(){return window.self===window.top||document.referrer.startsWith("http://localhost:")?!0:document.referrer.includes("bloomlibrary.org/player/")}showOrHideL1OnlyText(t,n){t.querySelectorAll(".coverBottomBookTopic, .coverBottomLangName").forEach(a=>{n||a.classList.contains("bloom-content1")?a.classList.remove("do-not-display"):a.classList.add("do-not-display")})}localizeOnce(){!this.isPagesLocalized&&this.state.pages!==this.initialPages&&this.state.styleRules!==this.initialStyleRules&&(wn.localizePages(document.body,this.bookInfo.getPreferredTranslationLanguages()),this.isPagesLocalized=!0)}initializeMedia(){this.video||(this.video=new Zs,this.video.PageVideoComplete=new or,this.video.PageVideoComplete.subscribe(this.handlePageVideoComplete)),this.animation||(this.animation=new Tu),Do.subscribe(this.handlePageNarrationComplete),nl.subscribe(this.handlePlayFailed),Hf.subscribe(this.handlePlayUnblocked),el.subscribe(this.handlePlayCompleted),fx(this.storeAudioAnalytics.bind(this)),Ro.subscribe(this.handleToggleImageDescription.bind(this)),hx(()=>this.swiperInstance?.animating),px(t=>xy(t,1)),this.music||(this.music=new Yx,this.music.PlayFailed=new or,this.music.PlayFailed.subscribe(()=>{this.setState({inPauseForced:!0}),this.props.setForcedPausedCallback&&this.props.setForcedPausedCallback(!0)}))}preprocessUrl(){let t=this.state.bookUrl;if(t===void 0||t.trim()==="")throw new Error("The url parameter was empty. It should point to the url of a book.");return t.endsWith("/")&&(t=t.substring(0,t.length-1)),t.endsWith("%2f")&&(t=t.substring(0,t.length-3)),t}handlePausePlay(){this.props.paused?this.pauseAllMultimedia():Qe.currentPage!==ey()||aa===Cn.MediaFinished?this.resetForNewPageAndPlay(Qe.currentPage):aa===Cn.VideoPaused?this.video.play():(Kx(),this.animation.resumeAnimation(),this.music.play())}getAllBloomCanvasElementsOnPage(){const t=this.htmlElement?.ownerDocument.getElementsByClassName("bloom-canvas");if(t&&t.length>0)return Array.from(t);const n=this.htmlElement?.ownerDocument.getElementsByClassName("bloom-imageContainer");return n?Array.from(n).filter(a=>a.parentElement.closest(".bloom-imageContainer")===null):[]}computeMustUseOriginalPageSize(t){return this.props.useOriginalPageSize||t.querySelector(".bloom-canvas-element")?!0:!!t.querySelector(".bloom-textOverPicture")}updateOverlayPositionsByLangCode(){if(!(!this.props.activeLanguageCode||!this.htmlElement))try{const t=this.props.activeLanguageCode;this.getAllBloomCanvasElementsOnPage().forEach(n=>{Array.from(n.querySelectorAll(ul)).forEach(r=>{const l=Array.from(r.getElementsByClassName("bloom-editable")).find(d=>d.getAttribute("lang")===t);if(l){const d=l.getAttribute("data-bubble-alternate");if(d){const f=JSON.parse(d.replace(/`/g,'"'));r.setAttribute("style",f.style)}}});const a=Array.from(n.getElementsByClassName("comical-alternate")).find(r=>r.getAttribute("data-lang")===t);if(a){const r=n.getElementsByClassName("comical-generated")[0];r&&(r.classList.remove("comical-generated"),r.classList.add("comical-alternate"),r.style.display="none"),a.classList.remove("comical-alternate"),a.classList.add("comical-generated"),a.style.removeProperty("display")}})}catch(t){console.error(t)}}updateDivVisibilityByLangCode(t){if(!this.props.activeLanguageCode||!this.htmlElement)return;const a=this.bookInfo.getPreferredTranslationLanguages()[0]===this.props.activeLanguageCode||!this.props.activeLanguageCode,r=this.props.activeLanguageCode,l=this.htmlElement.ownerDocument.evaluate(".//div[contains(@class, 'bloom-translationGroup')]",this.htmlElement,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null),d="bloom-visibility-code-on";for(let f=0;f<l.snapshotLength;f++){const p=l.snapshotItem(f),y=p.getAttribute("data-default-languages"),k=y?y.split(/,| /):[],P=k==null||k.length===0||!k[0]||k.includes("V")||k.includes("L1")||Qe.areStringsEqualInvariantCultureIgnoreCase(k[0],"auto"),N=p.childNodes;for(let B=0;B<N.length;B++){const L=N.item(B);!L||!L.classList||!L.classList.contains("bloom-editable")||(t&&L.setAttribute("data-original-class",L.getAttribute("class")||""),a?L.setAttribute("class",L.getAttribute("data-original-class")||""):P&&(L.getAttribute("lang")===r?(L.classList.add(d),Array.from(L.classList).forEach(et=>{et.startsWith("bloom-content")&&L.classList.remove(et)}),L.classList.add("bloom-content1"),L.classList.add("bloom-contentFirst")):L.classList.remove(d)))}}}static areStringsEqualInvariantCultureIgnoreCase(t,n){return t.localeCompare(n,"en-US",{sensitivity:"accent"})===0}static isDivInL2(t){return t.classList.contains("bloom-contentNational1")}static isDivInL3(t){return t.classList.contains("bloom-contentNational2")}componentWillUnmount(){this.pauseAllMultimedia(),document.removeEventListener("keydown",t=>this.handleDocumentLevelKeyDown(t)),this.unsubscribeAllEvents()}unsubscribeAllEvents(){this.video.PageVideoComplete.unsubscribe(this.handlePageVideoComplete),Do.unsubscribe(this.handlePageNarrationComplete),nl.unsubscribe(this.handlePlayFailed),Hf.unsubscribe(this.handlePlayUnblocked),el.unsubscribe(this.handlePlayCompleted),Ro.unsubscribe(this.handleToggleImageDescription)}pauseAllMultimedia(){aa===Cn.VideoPlaying?this.video.pause():aa===Cn.AudioPlaying&&(qx(),this.animation.PauseAnimation()),this.music.pause()}reportBookOpened(t){const n=this.bookInfo.getAmbientAnalyticsProps();this.distributionSource&&(n.distributionSource=this.distributionSource),BS(n),Cy("BookOrShelf opened",{})}sendUpdateOfBookProgressReportToExternalContext(){const t=this.bookInteraction.getProgressReportPropertiesForAnalytics();DS("Pages Read",t)}makeNonEditable(t){const n=t.ownerDocument.evaluate(".//*[@contenteditable]",t,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(let a=0;a<n.snapshotLength;a++)n.snapshotItem(a).removeAttribute("contenteditable")}setPageSizeClass(t){return Qe.setPageSizeClass(t,this.bookInfo.canRotate,this.props.landscape,this.mustUseOriginalPageSize,this.originalPageClass)}static getPageSizeClass(t){const a=(t.getAttribute("class")||"").match(/\b\S*?(Portrait|Landscape)\b/);return a&&a.length?a[0]:""}static setPageSizeClass(t,n,a,r,l){let d=!1;const f=this.getPageSizeClass(t);if(f){d=n?a:f.endsWith("Landscape");let p="";r?p=d?l.replace("Portrait","Landscape"):l.replace("Landscape","Portrait"):p=d?"Device16x9Landscape":"Device16x9Portrait",f!==p&&(t.classList.remove(f),t.classList.add(p))}return d}goToFirstPage(){this.swiperInstance.slideTo(0)}goToLastPage(){this.swiperInstance.slideTo(99999)}fixRelativeUrls(t){const n=t.ownerDocument.evaluate(".//*[@src]",t,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(let l=0;l<n.snapshotLength;l++){const d=n.snapshotItem(l);if(!d)continue;const f=d.getAttribute("src"),p=this.fullUrl(f);d.setAttribute("src",p)}const a=t.ownerDocument.evaluate(".//*[@style]",t,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null),r=new RegExp(/background-image:url\(['"](.*)['"]\)/);for(let l=0;l<a.snapshotLength;l++){const d=a.snapshotItem(l);if(!d)continue;const f=d.getAttribute("style")||"",p=r.exec(f);if(!p)continue;const y=this.fullUrl(p[1]),k=f.replace(r,"");d.setAttribute("style",k),d.setAttribute("data-background",y),d.classList.add("swiper-lazy")}}fullUrl(t){return this.urlPrefix+"/"+t}getRootDiv(){return this.rootDiv}slideNext(){this.swiperInstance&&this.swiperInstance.slideNext()}slidePrevious(){this.swiperInstance&&this.swiperInstance.slidePrev()}getBookInstanceId(){return this.bookInfo.bookInstanceId}getPlayerOptionsForPage(t){if(!t)return;let n=t.getAttribute("data-player-options");if(n)try{return n=n.replace(/'/g,'"'),JSON.parse(n)}catch(a){console.log("getPlayerOptionsForPage failed to parse json: "+n+" with error "+a.message);return}}render(){const t=this.activityManager.getActivityAbsorbsDragging();if(this.state.isLoading)return O.createElement(yP,{className:"loadingSpinner",color:"secondary"});if(this.state.loadFailed)return O.createElement(O.Fragment,null,O.createElement(r1,{className:"loadFailedIcon",color:"secondary"}),O.createElement("div",{className:"loadErrorMessage",dangerouslySetInnerHTML:{__html:this.state.loadErrorHtml}}));if(this.state.requiredVersion)return O.createElement("div",{className:"requiredVersionMessage"},this.state.requiredVersion);kx(this.props.shouldReadImageDescriptions&&this.hasImageDescriptions);const n={getSwiper:r=>{this.swiperInstance=r,this.metaDataObject?.isRtl&&this.swiperInstance&&(this.swiperInstance.el?.setAttribute("dir","rtl"),this.swiperInstance.rtl=!0,this.swiperInstance.rtlTranslate=!0)},simulateTouch:!0,touchStartPreventDefault:!1,on:{slideChange:()=>{this.state.inPauseForced&&this.props.setForcedPausedCallback&&this.props.setForcedPausedCallback(!1),this.setState({inPauseForced:!1}),this.startingUpSwiper||this.showingPage(this.swiperInstance.activeIndex)},slideChangeTransitionStart:()=>{this.startingUpSwiper||this.setIndex(this.swiperInstance.activeIndex)},slideChangeTransitionEnd:()=>{this.addScrollbarsToPageWhenReady(this.swiperInstance.activeIndex)}},keyboard:{enabled:!0,onlyInViewport:!1},preloadImages:!1,lazy:{loadPrevNext:!0,loadOnTransitionStart:!0,loadPrevNextAmount:2},shouldSwiperUpdate:!0};this.startingUpSwiper&&(n.activeSlideKey=this.state.startPageIndex?.toString());let a="bloomPlayer";return this.currentPageHidesNavigationButtons?a+=" hideNextPrevButtons extraScalingForChrome85Bug":(this.props.outsideButtonPageClass&&(a+=" "+this.props.outsideButtonPageClass),t&&(a+=" showNavigationButtonsEvenOnTouchDevices")),O.createElement("div",{"aria-label":"Player Content",className:a+(this.props.extraClassNames?" "+this.props.extraClassNames:""),ref:r=>this.rootDiv=r},O.createElement(ux,{key:this.shouldAutoPlay()?"fade":"slide",...n,effect:this.shouldAutoPlay()?"fade":"slide"},this.state.pages.map((r,l)=>{const f=Math.abs(l-this.state.currentSwiperIndex)<2||this.indicesOfPagesWhereWeShouldPreserveDOMState[l];return O.createElement("div",{key:l,className:"page-preview-slide",onClick:p=>this.handlePageClick(p)},f?O.createElement(O.Fragment,null,O.createElement("style",{scoped:!0},this.state.styleRules),O.createElement("div",{...this.state.importedBodyAttributes,className:`bloomPlayer-page ${this.bookInfo.hasAppearanceSystem?"appearance-system":""} ${this.state.importedBodyAttributes.class??""}`,dangerouslySetInnerHTML:{__html:r}})):"")})),O.createElement("div",{className:"swiper-button-prev "+(this.metaDataObject.isRtl?"swiper-button-right":"swiper-button-left")+(this.props.hideSwiperButtons||this.state.currentSwiperIndex===0?" swiper-button-disabled":""),onClick:()=>this.slidePrevious(),onTouchStart:r=>{this.setState({ignorePhonyClick:!0})}},O.createElement(mi,{className:"nav-button",disableRipple:!0},this.metaDataObject.isRtl?O.createElement(lv,{titleAccess:wn.getTranslation("Button.Prev",this.props.preferredUiLanguages,"Previous Page")}):O.createElement(ov,{titleAccess:wn.getTranslation("Button.Prev",this.props.preferredUiLanguages,"Previous Page")}))),O.createElement("div",{className:"swiper-button-next "+(this.metaDataObject.isRtl?"swiper-button-left":"swiper-button-right")+(this.props.hideSwiperButtons||this.state.currentSwiperIndex>=this.state.pages.length-1?" swiper-button-disabled":""),onClick:()=>this.slideNext(),onTouchStart:r=>{this.setState({ignorePhonyClick:!0})}},O.createElement(mi,{className:"nav-button",disableRipple:!0},this.metaDataObject.isRtl?O.createElement(ov,{titleAccess:wn.getTranslation("Button.Next",this.props.preferredUiLanguages,"Next Page")}):O.createElement(lv,{titleAccess:wn.getTranslation("Button.Next",this.props.preferredUiLanguages,"Next Page")}))))}shouldAutoPlay(){var t=this.bookInfo.autoAdvance&&this.props.landscape;return this.props.autoplay==="yes"?t=!0:this.props.autoplay==="no"&&(t=!1),t&&!this.skipAutoPlay}setIndex(t){if(this.state.isLoading||this.startingUpSwiper)return;this.setState({currentSwiperIndex:t});const n=this.getPageAtSwiperIndex(t);n&&(this.setPageSizeClass(n),this.animation.HandlePageBeforeVisible(n),this.video.hidingPage(),this.video.HandlePageBeforeVisible(n),Hx(),this.music.hidingPage(),aa===Cn.AudioPaused||aa===Cn.VideoPaused?Un(Cn.NewPageMediaPaused):(this.skipAutoPlay=!0,Bx(),this.skipAutoPlay=!1,Un(Cn.NewPage)))}getPageAtSwiperIndex(t){if(this.swiperInstance==null)return null;const n=this.swiperInstance.slides[t];return n?n.getElementsByClassName("bloom-page")[0]:null}getPageIdFromIndex(t){const n=this.getPageAtSwiperIndex(t);if(!n)throw new Error("No bloomPage at index "+t);return n.getAttribute("id")}static getCurrentPage(){return Qe.currentPage}isXmatterPage(){const t=Qe.currentPage;if(!t)return!0;const n=t.getAttribute("class");return!n||n.indexOf("bloom-page")<0||n.indexOf("bloom-backMatter")>=0||n.indexOf("bloom-frontMatter")>=0?!0:t.hasAttribute("data-xmatter-page")}showingPage(t){if(this.state.isLoading||this.startingUpSwiper)return;this.props.pageChanged&&this.props.pageChanged(t);const n=this.getPageAtSwiperIndex(t);if(!n){window.setTimeout(()=>this.showingPage(t),50);return}const a=this.getPlayerOptionsForPage(n);this.currentPageHidesNavigationButtons=!!(a&&a.hideNavigation),this.props.hidingNavigationButtonsCallback&&this.props.hidingNavigationButtonsCallback(this.currentPageHidesNavigationButtons),this.activityManager.showingPage(t,n)&&(this.indicesOfPagesWhereWeShouldPreserveDOMState[t]=!0),window.setTimeout(()=>{Qe.currentPage=n,Qe.currentPageIndex=t,Qe.currentPageHasVideo=Zs.pageHasVideo(n),this.setPageSizeClass(n),this.resetForNewPageAndPlay(n),this.props.paused&&this.animation.shouldAnimate(n)&&(this.animation.HandlePageBeforeVisible(n),this.animation.HandlePageVisible(n,this.props.paused),this.animation.HandlePageDurationAvailable(n,km(n),this.props.paused)),this.isXmatterPage()||(this.bookInteraction.pageShown(t),t===this.indexOflastNumberedPage&&(this.bookInteraction.lastNumberedPageWasRead=!0)),this.props.reportPageProperties&&this.props.reportPageProperties({hasAudio:Ox(n),hasMusic:this.music.pageHasMusic(n),hasVideo:Qe.currentPageHasVideo}),this.bookInteraction.reportedAudioOnCurrentPage=!1,this.bookInteraction.reportedVideoOnCurrentPage=!1,this.sendUpdateOfBookProgressReportToExternalContext(),this.swiperInstance.params.noSwiping=this.activityManager.getActivityAbsorbsDragging(),this.swiperInstance.params.touchRatio=this.activityManager.getActivityAbsorbsDragging()?0:1,this.activityManager.getActivityAbsorbsTyping()?this.swiperInstance.keyboard.disable():this.swiperInstance.keyboard.enable(),Array.from(n.querySelectorAll("[data-sound]")).forEach(l=>{l.addEventListener("click",Gh)})},0)}addScrollbarsToPageWhenReady(t){if(this.state.isLoading||this.startingUpSwiper)return;const n=this.getPageAtSwiperIndex(t);if(!n){window.setTimeout(()=>this.addScrollbarsToPageWhenReady(t),50);return}A1(n,Qe.handlePointerMoveEvent)}static handlePointerMoveEvent(t){t.pointerType==="mouse"&&t.target?.closest(".nicescroll-cursors")&&t.stopPropagation()}storeAudioAnalytics(t){t<.001||Number.isNaN(t)||(this.bookInteraction.totalAudioDuration+=t,!this.isXmatterPage()&&(this.bookInteraction.reportedAudioOnCurrentPage||(this.bookInteraction.reportedAudioOnCurrentPage=!0,this.bookInteraction.audioPageShown(Qe.currentPageIndex)),this.sendUpdateOfBookProgressReportToExternalContext()))}static storeVideoAnalytics(t){if(t<.001)return;const n=Qe.currentPagePlayer;n.bookInteraction.totalVideoDuration+=t,!n.bookInteraction.reportedVideoOnCurrentPage&&!n.isXmatterPage()&&(n.bookInteraction.reportedVideoOnCurrentPage=!0,n.bookInteraction.videoPageShown(Qe.currentPageIndex)),n.sendUpdateOfBookProgressReportToExternalContext()}resetForNewPageAndPlay(t){if(this.props.paused){this.video.HandlePageVisible(t,()=>this.props.paused);return}if(ty(t),Qe.currentPageHasVideo){const n=()=>{this.video.HandlePageVisible(t,()=>this.props.paused),this.music.pause()};if(Un(Cn.VideoPlaying),!this.sentBloomNotification&&(this.sentBloomNotification=!0,this.props.shouldReportSoundLog)){_f("/publish/av/startRecording",this.videoList).then(n);return}n()}else this.playAudioAndAnimation(t)}playAudioAndAnimation(t){if(this.activityManager.getActivityManagesSound()){this.activityManager.doInitialSoundAndAnimation();return}if(Un(Cn.AudioPlaying),!t)return;const n=km(t);this.animation.HandlePageDurationAvailable(t,n,this.props.paused);const a=()=>{Tu.pageHasAnimation(t)&&this.animation.HandlePageBeforeVisible(t),this.animation.HandlePageVisible(t,this.props.paused),ay(t,this.animation.animatableCanvas),this.music.HandlePageVisible(t)};if(!this.sentBloomNotification&&(this.sentBloomNotification=!0,this.props.shouldReportSoundLog)){_f("/publish/av/startRecording",this.videoList).then(a);return}a()}getVideoList(t){let n="";for(const l of Array.from(t.getElementsByTagName("video"))){var a=l,r=a.getElementsByTagName("source")[0].getAttribute("src");n&&(n+="|"),n+=r}return n}handlePageClick(t){if(!this.state.ignorePhonyClick&&(!this.activityManager.getActivityAbsorbsClicking()||t.target.closest("[data-href]")&&t.target.closest(".bloom-canvas"))&&!t.target.closest(".bloom-videoContainer")){const n=MM(t.nativeEvent,this.bookInfo.bookInstanceId,()=>this.getPageIdFromIndex(this.state.currentSwiperIndex));n?(this.navigate(n.bookUrl,n.pageId),t.stopPropagation(),t.preventDefault()):this.props.onContentClick&&this.props.onContentClick(t)}this.setState({ignorePhonyClick:!1})}}function OM(e){return e.replace("%23","#").replace(/[\u00A0-\u9999<>\&]/gim,t=>"&#"+t.charCodeAt(0)+";")}function KM(e){return e.ownerDocument.evaluate("//div[contains(@class, 'bloom-imageDescription')]/div[contains(@class, 'bloom-editable') and contains(@class, 'bloom-visibility-code-on')]//*[contains(@class, 'audio-sentence') or contains(@class, 'bloom-highlightSegment')]",e,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null).snapshotLength>0?!0:e.ownerDocument.evaluate("//div[contains(@class, 'bloom-imageDescription')]/div[contains(@class, 'bloom-editable') and contains(@class, 'bloom-visibility-code-on') and @data-audiorecordingmode='TextBox']/p[text()]",e,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null).snapshotLength>0}var Rs={},Bv;function qM(){if(Bv)return Rs;Bv=1;var e=Ja(),t=Qa();Object.defineProperty(Rs,"__esModule",{value:!0}),Rs.default=void 0;var n=t(ia()),a=e(ti()),r=(0,a.default)(n.createElement("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"}),"ArrowBack");return Rs.default=r,Rs}var $M=qM();const HM=Rn($M);var js={},zv;function FM(){if(zv)return js;zv=1;var e=Ja(),t=Qa();Object.defineProperty(js,"__esModule",{value:!0}),js.default=void 0;var n=t(ia()),a=e(ti()),r=(0,a.default)(n.createElement("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreHoriz");return js.default=r,js}var WM=FM();const _M=Rn(WM);var Os={},Iv;function VM(){if(Iv)return Os;Iv=1;var e=Ja(),t=Qa();Object.defineProperty(Os,"__esModule",{value:!0}),Os.default=void 0;var n=t(ia()),a=e(ti()),r=(0,a.default)(n.createElement("path",{d:"M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"}),"PlayCircleOutline");return Os.default=r,Os}var GM=VM();const jb=Rn(GM);var Ks={},Dv;function UM(){if(Dv)return Ks;Dv=1;var e=Ja(),t=Qa();Object.defineProperty(Ks,"__esModule",{value:!0}),Ks.default=void 0;var n=t(ia()),a=e(ti()),r=(0,a.default)(n.createElement("path",{d:"M9 16h2V8H9v8zm3-14C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm1-4h2V8h-2v8z"}),"PauseCircleOutline");return Ks.default=r,Ks}var YM=UM();const XM=Rn(YM);var qs={},Rv;function ZM(){if(Rv)return qs;Rv=1;var e=Ja(),t=Qa();Object.defineProperty(qs,"__esModule",{value:!0}),qs.default=void 0;var n=t(ia()),a=e(ti()),r=(0,a.default)(n.createElement("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56zm2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.16-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z"}),"Language");return qs.default=r,qs}var JM=ZM();const QM=Rn(JM);var $s={},jv;function tA(){if(jv)return $s;jv=1;var e=Ja(),t=Qa();Object.defineProperty($s,"__esModule",{value:!0}),$s.default=void 0;var n=t(ia()),a=e(ti()),r=(0,a.default)(n.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"}),"Fullscreen");return $s.default=r,$s}var eA=tA();const nA=Rn(eA);var Hs={},Ov;function aA(){if(Ov)return Hs;Ov=1;var e=Ja(),t=Qa();Object.defineProperty(Hs,"__esModule",{value:!0}),Hs.default=void 0;var n=t(ia()),a=e(ti()),r=(0,a.default)(n.createElement("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}),"FullscreenExit");return Hs.default=r,Hs}var iA=aA();const rA=Rn(iA);function oA(e){return Dt.createElement(lh,{...e,width:"21",height:"20",viewBox:"0 0 21 20"},Dt.createElement("path",{d:"M20.6181 9.909C20.6181 9.909 17.3581 3.70568 10.2454 3.70568C10.1127 3.70568 9.9821 3.70851 9.8522 3.71275L9.23133 0.590958L8.27889 0.807585L8.87136 3.78574C2.72807 4.50344 0 9.86355 0 9.86355C0 9.86355 0.566707 11.0581 1.77366 12.4165L1.27674 9.91983C1.26639 9.90052 1.26089 9.89016 1.26089 9.89016C1.26089 9.89016 1.45882 9.53343 1.86833 9.01188L2.73952 13.3918C3.09729 13.7179 3.49205 14.0383 3.92423 14.3419L2.68074 8.09074C2.92754 7.84068 3.20826 7.58049 3.52199 7.32171L5.05787 15.0424C5.40441 15.2277 5.77033 15.3993 6.15474 15.5514L4.38901 6.67725C4.6772 6.48487 4.98565 6.29932 5.31568 6.12485L7.26481 15.9206C7.59924 16.0118 7.94578 16.0871 8.30509 16.146L7.56314 12.4167C7.89823 12.8518 8.32205 13.2046 8.80465 13.4464L9.36563 16.2656C9.59813 16.2802 9.83459 16.2891 10.0765 16.2891C10.1734 16.2891 10.2694 16.2873 10.3654 16.2844L9.86541 13.773C10.0112 13.7923 10.1591 13.8033 10.3099 13.8033C10.4957 13.8033 10.6783 13.7883 10.8559 13.7588L11.9801 19.4091L12.9321 19.1924L12.3108 16.0683C17.848 14.9378 20.6181 9.909 20.6181 9.909ZM6.88084 8.9881L6.22651 5.69889C6.53386 5.57339 6.8575 5.45942 7.19546 5.35982L7.6228 7.50844C7.28066 7.93015 7.02351 8.43381 6.88084 8.9881ZM8.46692 6.74577L8.14503 5.12836C8.45547 5.06785 8.77691 5.01958 9.11002 4.9859L9.3773 6.32923C9.05322 6.42294 8.74741 6.56375 8.46692 6.74577ZM10.3467 6.19713L10.0944 4.93033C10.1472 4.92963 10.1998 4.92845 10.2533 4.92845C10.4858 4.92845 10.713 4.93599 10.9365 4.94941C13.2188 5.33628 14.964 7.44981 14.964 9.99965C14.964 12.1188 13.7579 13.9352 12.0406 14.7106L11.7914 13.4565C13.0153 12.8558 13.8654 11.5342 13.8654 9.99942C13.8652 7.91226 12.2936 6.21856 10.3467 6.19713ZM14.5336 14.0984C15.4349 13.0056 15.9823 11.5718 15.9823 9.99942C15.9823 8.35399 15.3821 6.8595 14.405 5.74928C17.7771 7.16772 19.3574 9.92642 19.3574 9.92642C19.3574 9.92642 17.7491 12.6074 14.5336 14.0984Z"}))}var Fs={},Kv;function sA(){if(Kv)return Fs;Kv=1;var e=Ja(),t=Qa();Object.defineProperty(Fs,"__esModule",{value:!0}),Fs.default=void 0;var n=t(ia()),a=e(ti()),r=(0,a.default)(n.createElement("path",{d:"M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"}),"VolumeUp");return Fs.default=r,Fs}var lA=sA();const uA=Rn(lA),cA=e=>{const[t,n]=O.useState((e.languages.filter(d=>d.IsSelected)[0]||e.languages[0]).Code),a=d=>{const f=d.target.value;n(f),e.onClose(f)},r=()=>{e.onClose("")},l=()=>{const d=e.languages.map(f=>Dt.createElement("div",{className:"chooserItem",key:f.Code},Dt.createElement(XP,{value:f.Code,control:Dt.createElement(uM,null),label:f.Name,checked:f.Code===t}),Dt.createElement("span",{className:"spacer"}),Dt.createElement(uA,{className:"icon",visibility:f.HasAudio?"inherit":"hidden"})));return Dt.createElement("div",{className:"radioGroupDiv"},d)};return Dt.createElement(RP,{className:"languageMenu",onClose:r,"aria-labelledby":"language-menu-title",open:!0,scroll:"paper"},Dt.createElement(HP,{id:"language-menu-title"},"Languages in this book:"),Dt.createElement(GP,{component:"fieldset"},Dt.createElement(cM,{className:"radioGroup","aria-label":"languages",name:"languages",value:t,onChange:a},l())),Dt.createElement(KP,null,Dt.createElement(fP,{onClick:r,color:"secondary"},"Close")))};var Ys=(e=>(e[e.showArrow=0]="showArrow",e[e.showEllipsis=1]="showEllipsis",e[e.showNothing=2]="showNothing",e))(Ys||{});const dA=e=>{const[t,n]=O.useState(!1),a="button"+(e.bookLanguages.length<2?" disabled":""),r=L=>{n(!1),L!==""&&(e.onLanguageChanged(L),d({lang:L}))},l=()=>{try{document.fullscreenElement!=null||document.webkitFullscreenElement!=null?document.exitFullscreen?document.exitFullscreen():document.webkitExitFullScreen&&document.webkitExitFullScreen():document.documentElement.requestFullscreen?document.documentElement.requestFullscreen():document.documentElement.webkitRequestFullscreen&&document.documentElement.webkitRequestFullscreen()}catch(L){console.error("RequestFullScreen failed: ",L)}},d=L=>{if(!e.videoPreviewMode)return;const $={lang:e.activeLanguageCode,imageDescriptions:e.readImageDescriptions,...L};_f("publish/av/videoSettings",encodeURIComponent(JSON.stringify($)))},f=wn.getTranslation("Audio.Pause",e.preferredLanguages,"Pause"),p=e.paused?Dt.createElement(jb,{titleAccess:e.playLabel}):Dt.createElement(XM,{titleAccess:f}),y=wn.getTranslation("Button.ReadImageDescriptions",e.preferredLanguages,"Read Image Descriptions"),k=wn.getTranslation("Button.IgnoreImageDescriptions",e.preferredLanguages,"Ignore Image Descriptions"),P=sl({palette:{primary:{main:zM},secondary:{main:Db.palette.secondary.main}}}),N=Dt.createElement(ju,{theme:P},Dt.createElement(oA,{"aria-label":e.readImageDescriptions?"Read image descriptions":"Ignore image descriptions",titleAccess:e.readImageDescriptions?k:y,opacity:e.readImageDescriptions?1:.38,color:e.nowReadingImageDescription?"primary":"secondary"})),B=e.extraButtons?e.extraButtons.map(L=>Dt.createElement(mi,{key:L.id,color:"secondary",title:L.description,onClick:()=>ki({messageType:L.id})},Dt.createElement("img",{style:{maxHeight:"24px",maxWidth:"24px"},src:L.iconUrl}))):void 0;return Dt.createElement(nP,{color:"primary",className:`control-bar ${e.visible?", visible":""}`,id:"control-bar",elevation:0,position:"relative"},Dt.createElement(kM,null,!e.videoPreviewMode&&Dt.createElement(mi,{color:"secondary",onClick:()=>{e.backClicked&&e.backClicked()},"data-testid":"history-back-button",disabled:e.getBackButtonState()===2},e.getBackButtonState()===0?Dt.createElement(HM,{"aria-label":"Go Back",titleAccess:wn.getTranslation("Button.Back",e.preferredLanguages,"Back")}):e.getBackButtonState()===1&&Dt.createElement(_M,{"aria-label":"More Menu",titleAccess:wn.getTranslation("Button.More",e.preferredLanguages,"More")})),Dt.createElement("div",{className:"filler"}),e.bookHasImageDescriptions&&Dt.createElement(mi,{onClick:()=>{e.onReadImageDescriptionToggled(),d({imageDescriptions:!e.readImageDescriptions})}},N),e.bookLanguages.length>1&&Dt.createElement(mi,{className:a,"aria-label":"Choose Language",color:"secondary",onClick:()=>{n(!0)}},Dt.createElement(QM,{titleAccess:wn.getTranslation("Button.ChooseLanguage",e.preferredLanguages,"Choose Language")})),t&&Dt.createElement(cA,{languages:e.bookLanguages,onClose:r}),!e.videoPreviewMode&&Dt.createElement(mi,{color:"secondary","aria-label":"PlayPause",onClick:()=>{e.pausedChanged&&e.pausedChanged(!e.paused)}},e.showPlayPause?p:null),B,document.fullscreenEnabled&&e.canShowFullScreen&&!e.videoPreviewMode&&Dt.createElement(mi,{color:"secondary",onClick:()=>l()},document.fullscreenElement==null?Dt.createElement(nA,{"aria-label":"Full Screen",titleAccess:wn.getTranslation("Button.FullScreen",e.preferredLanguages,"Full Screen")}):Dt.createElement(rA,{"aria-label":"Exit Full Screen",titleAccess:wn.getTranslation("Button.ExitFullScreen",e.preferredLanguages,"Exit Full Screen")}))))};function Rf(e,t){return Math.round(e/t)*t}function fA(e){if(!(!e||e==="cover")){if(/^\d+$/.test(e))return e;try{return e.replace(new RegExp("(?![0-9])\\p{Nd}","gu"),t=>{const n=t.charCodeAt(0);return(n&15)-6*(new RegExp("\\p{Nd}","u").test(String.fromCodePoint(n|15))?1:0)})}catch{return}}}let jf=!1,vh=e=>{};function hA(e){vh&&vh(e)}let qv=0,$v=0;function Hv(){const e=/iPad|iPhone|iPod/.test(navigator.platform);let t,n,a;e&&(t=document.getElementsByClassName("bloomPlayer")[0],n=t.parentElement,a=t.nextSibling,n.removeChild(t));const r=document.documentElement.clientWidth,l=document.documentElement.clientHeight;return e&&n.insertBefore(t,a),{width:r,height:l}}const pA=e=>{const[t,n]=O.useState(e.autoplay),a=e.centerVertically===void 0?!0:e.centerVertically;qS(Tt=>{Tt.pause?(jf=!D,R(!0)):Tt.resume&&jf?R(!1):Tt.play?(R(!1),Tt.autoplay&&n(Tt.autoplay)):Tt.reset?(k(e.startPage??0),je.current&&je.current(e.startPage??0)):Tt.controlAction&&ct(Tt.controlAction)});const[r,l]=O.useState(!1),[d,f]=O.useState(e.initiallyShowAppBar),[,p]=O.useState(0);O.useEffect(()=>{const Tt=()=>{f(!0),p(Vt=>Vt+1)};return mh.subscribe(Tt),()=>{mh.unsubscribe(Tt)}},[]);const[y,k]=O.useState(e.startPage??0),[P,N]=O.useState([""]),[B,L]=O.useState(!1),[$,et]=O.useState(!1),[W,U]=O.useState(""),[_,tt]=O.useState("Device16x9Portrait");O.useEffect(()=>{f(e.initiallyShowAppBar)},[e.initiallyShowAppBar]),O.useEffect(()=>{d?jS():OS()},[d]),O.useEffect(()=>{R(e.paused)},[e.paused]);const[D,R]=O.useState(e.paused),[m,ot]=O.useState(!1),st=wn.getBloomUiLanguage(),Nt=st==="en"?[st]:[st,"en"],[Pt,Et]=O.useState(Nt);O.useEffect(()=>{D||(jf=!1)},[D]);const[Q,F]=O.useState(!1),[s,pt]=O.useState(!1),[x,dt]=O.useState(!1),[bt,St]=O.useState(!1),[q,wt]=O.useState(!1),[xt,Ot]=O.useState(0),[Lt,Ft]=O.useState(9/16),te=[],[de,me]=O.useState(te),[Ee,cn]=O.useState(""),je=O.useRef(),[sn,Ue]=O.useState(!0),[kn,Xe]=O.useState(!1),[yn,tn]=O.useState(!1),[dn,M]=O.useState(0),j=()=>{M(Tt=>Tt+1)},[X,lt]=O.useState("");O.useEffect(()=>{Zt()},[q,dn,Q,e.useOriginalPageSize]),O.useEffect(()=>()=>{const Tt=document.getElementById("scale-style-sheet");Tt&&Tt.parentNode.removeChild(Tt)},[]);const vt=O.useRef(),ct=Tt=>{switch(Tt){case"navigate-to-next-page":vt&&vt.current&&vt.current.slideNext();break;case"navigate-to-previous-page":vt&&vt.current&&vt.current.slidePrevious();break;default:console.log("'handleControlMessage' received an unknown message.");return}},Zt=()=>{const Tt=document.getElementsByClassName("swiper-slide-active")[0];let Vt=null;if(Tt&&(Vt=Tt.getElementsByClassName("bloom-page")[0]),!Vt||!q){window.setTimeout(j,100);return}let He=document.getElementById("scale-style-sheet");He||(He=document.createElement("style"),He.setAttribute("type","text/css"),He.setAttribute("id","scale-style-sheet"),document.head.appendChild(He));let ve=xt,ke=Lt;const jt=Qe.getPageSizeClass(Vt);(e.url!==W||jt!==_)&&(U(e.url),tt(jt),window.onresize=()=>{const{width:ya,height:ba}=Hv();(ba!==$v||ya!==qv)&&j()},ve=Math.max(Vt.offsetHeight,Vt.offsetWidth),ke=Math.min(Vt.offsetHeight,Vt.offsetWidth)/ve,Ft(ke),Ot(ve));const{width:$t,height:se}=Hv();qv=$t,$v=se;const Oe=$t>se;if(Oe!==Q){F(Oe);return}let Ae=0,fn=0;const Me=window.getComputedStyle(document.body);Me&&Me.marginTop&&(Ae=parseInt(Me.marginTop,10)),Me&&Me.marginBottom&&(fn=parseInt(Me.marginBottom,10));const ma=Vt.getAttribute("class").indexOf("Landscape")>=0,oa=ma?ve*ke:ve,On=ma?ve:ve*ke;let sa=Ae+fn;if(d){const ya=document.getElementById("control-bar");ya&&(sa+=ya.offsetHeight);const ba=document.getElementById("pageNumberControl");ba&&(sa+=ba.offsetHeight)}const Ta=se-sa,dr=Pe({pageWidth:On,pageHeight:oa,desiredPageHeight:Ta}),Sn=De(On);let Re=Math.min(dr,Sn);const Kn=oa*Re;let va=Kn*ke/Re;ma&&(va=Kn/ke/Re);const qn=$t/Re-va;let Ea="",$a=Math.max(($t-On*Re)/2,0);e.roundMarginToNearestK&&($a=Rf($a,e.roundMarginToNearestK));const Zn=$a,fr=Re,hr=30;if(qn>100*2)Ea="largeOutsideButtons";else if(qn>hr*2)Ea="smallOutsideButtons";else if($t>407&&navigator.userAgent.includes("Chrome")&&!e.hideSwiperButtons){const ba=new RegExp(" Chrome/([0-9]+).").exec(navigator.userAgent),ji=parseInt(ba[1]);ji&&ji<90&&(Re*=.9,$a=Math.max(($t-On*Re)/2,0),Ea="smallOutsideButtons extraScalingForChrome85Bug")}Ea!==X&&lt(Ea);let xi="";if(a){const ya=(se-Kn-sa)/2;ya>0&&(xi=`translate(0, ${ya.toFixed(0)}px) `)}He.innerText=`.bloomPlayer {
7983
7983
  width: ${va}px;
7984
7984
  transform-origin: left top 0;
7985
7985
  transform: ${xi}scale(${Re});
@@ -7992,4 +7992,4 @@ Add a <Suspense fallback=...> component higher in the tree to provide a loading
7992
7992
  }
7993
7993
  }
7994
7994
  .bloomPlayer-page {height: ${Kn/Re}px; overflow: hidden;}`,B1(Vt,Re),r||l(!0)},Pe=Tt=>{const{pageWidth:Vt,pageHeight:He,desiredPageHeight:ve}=Tt,ke=ve/He;if(!e.roundPageWidthToNearestK)return ke;const jt=Vt*ke;return Rf(jt,e.roundPageWidthToNearestK)/Vt},De=Tt=>{let Vt=document.body.offsetWidth;return e.roundPageWidthToNearestK&&(Vt=Rf(Vt,e.roundPageWidthToNearestK)),Vt/Tt};O.useEffect(()=>{m&&!D&&ot(!1);const Tt=document.getElementById("root");Tt&&(vh=Vt=>{(Vt.key===" "||Vt.key==="ArrowRight"&&m)&&(Vt.preventDefault(),Vt.stopImmediatePropagation(),R(!D),ot(!1))},Tt.addEventListener("keydown",hA,{capture:!0}))});const ne=Tt=>{Ee!==Tt&&(rl.selectNewLanguageCode(de,Tt),cn(Tt))},Ze=(Tt,Vt,He)=>{je.current=He;let ve;if(e.videoSettings){const ke=JSON.parse(e.videoSettings);ve=ke.lang,Ue(ke.imageDescriptions??!1)}e.initialLanguageCode&&(ve=e.initialLanguageCode),ve&&Tt.map(ke=>ke.Code).includes(ve)?rl.selectNewLanguageCode(Tt,ve):ve=Tt.length>0?Tt[0].Code:"",cn(ve),me(Tt),Xe(Vt),e.videoPreviewMode&&!d&&f(!0)},en=wn.getTranslation("Audio.Play",Pt,"Play"),jn=wn.getTranslation("Audio.ReadAloud",Pt,"Read Aloud"),Je=s?jn:en,{allowToggleAppBar:xn,showBackButton:Ln,initiallyShowAppBar:ra,locationOfDistFolder:Gt,hideFullScreenButton:An,...Z}=e,Ut=sl({palette:{primary:{main:"#000",contrastText:"#FFF"},secondary:{main:"#FFF"}}}),ie=Tt=>{tn(Tt)},$e=gn({root:{color:ar,height:2,padding:"15px 0"},active:{},valueLabel:{left:"calc(50% - 16px)",top:-31,"& *":{background:ar,color:"white"}},track:{height:4,opacity:.5},rail:{height:2,opacity:.5,backgroundColor:ar},mark:{backgroundColor:"transparent"},markActive:{backgroundColor:"transparent"},markLabel:{top:20,fontSize:"0.6rem",color:ar},markLabelActive:{top:20,fontSize:"0.6rem",color:ar}})(yM),Ye=sl({direction:"rtl"}),Ve=Dt.createElement($e,{valueLabelDisplay:"on",min:1,max:P.length,step:1,disabled:$,defaultValue:y+1,onChangeCommitted:(Tt,Vt)=>{Vt-1!=y&&(k(Vt-1),je.current&&je.current(Vt-1))},valueLabelFormat:(Tt,Vt)=>P[Tt-1],marks:[{value:P.length,label:P.length.toString()}]});return Dt.createElement("div",{className:"reactRoot"},m&&Dt.createElement(Dt.Fragment,null,Dt.createElement("div",{className:"bigButtonOverlay"},Dt.createElement(ju,{theme:Ut},Dt.createElement(mi,{className:"bigPlayButton",color:"secondary",onClick:()=>{ot(!1),R(!1)}},Dt.createElement(jb,{titleAccess:Je,preserveAspectRatio:"xMidYMid meet"})))),Dt.createElement("div",{className:"behindBigButtonOverlay"})),Dt.createElement(dA,{getBackButtonState:()=>vt.current?.CanGoBack()?Ys.showArrow:Ln?window===window.top?Ys.showArrow:Ys.showEllipsis:Ys.showNothing,visible:d,paused:D,pausedChanged:Tt=>R(Tt),playLabel:Je,preferredLanguages:Pt,backClicked:()=>{vt.current?.HandleBackButtonClickedIfHavePlayerHistory()||RS()},showPlayPause:s||x||bt,bookLanguages:de,activeLanguageCode:Ee,onLanguageChanged:ne,canShowFullScreen:!e.hideFullScreenButton,extraButtons:e.extraButtons,bookHasImageDescriptions:kn,readImageDescriptions:sn,onReadImageDescriptionToggled:()=>Ue(!sn),nowReadingImageDescription:yn,videoPreviewMode:e.videoPreviewMode}),Dt.createElement(IM,{getBookInstanceId:()=>vt.current?.getBookInstanceId()??""}),Dt.createElement(Qe,{ref:vt,url:e.url,landscape:Q,paused:D,preferredUiLanguages:Pt,pageStylesAreNowInstalled:()=>{wt(!0)},locationOfDistFolder:e.locationOfDistFolder,reportBookProperties:Tt=>{const Vt={landscape:Tt.landscape,canRotate:Tt.canRotate};zS(Vt),Et([st].concat(Tt.preferredLanguages)),N(Tt.pageNumbers),L(Tt.isRtl),Tt.internalUrl!=Of&&(Of&&j(),Of=Tt.internalUrl)},controlsCallback:Ze,setForcedPausedCallback:Tt=>{Tt?(R(Tt),ot(!0)):ot(!1)},reportPageProperties:Tt=>{pt(Tt.hasAudio),dt(Tt.hasMusic),St(Tt.hasVideo)},onContentClick:Tt=>{e.allowToggleAppBar&&(f(!d),window.setTimeout(j,300+50))},activeLanguageCode:Ee,useOriginalPageSize:e.useOriginalPageSize,hideSwiperButtons:e.hideSwiperButtons,autoplay:t,skipActivities:e.skipActivities,outsideButtonPageClass:X,extraClassNames:r?"":"hidePlayer",shouldReadImageDescriptions:sn,imageDescriptionCallback:ie,pageChanged:Tt=>{Tt!=y&&k(Tt)},hidingNavigationButtonsCallback:Tt=>{Tt!=$&&et(Tt)},shouldReportSoundLog:e.shouldReportSoundLog,startPageIndex:e.startPage,autoplayCount:e.autoplayCount}),d&&!e.videoPreviewMode&&Dt.createElement("div",{id:"pageNumberControl",className:"MuiToolbar-gutters"},B?Dt.createElement(ju,{theme:Ye},Ve):Ve))};function gA(){const e=Ua("extraButtons");if(!e)return[];const t=decodeURIComponent(e);try{return JSON.parse(t)}catch(n){return console.error("Failed to parse extra button info "+JSON.stringify(n)),KS("error decoding extraButtons param "+e+": "+n),[]}}function mA(){wx(parseFloat(Ua("defaultDuration","3.0")));const e=Ua("autoplay","motion"),t=Ua("start-page"),n=fA(t),a=n?parseInt(n):void 0,r=Ua("autoplay-count"),l=t?parseInt(r):void 0,d=Sa("paused",!1);cr.render(Dt.createElement(ju,{theme:Db},Dt.createElement(pA,{url:Ua("url"),allowToggleAppBar:Sa("allowToggleAppBar",!1),showBackButton:Sa("showBackButton",!1),initiallyShowAppBar:Sa("initiallyShowAppBar",!0),centerVertically:Sa("centerVertically",!0),initialLanguageCode:Ua("lang"),videoSettings:Ua("videoSettings"),paused:d,locationOfDistFolder:"",useOriginalPageSize:Sa("useOriginalPageSize",!1),hideFullScreenButton:Sa("hideFullScreenButton",!1),autoplay:e,skipActivities:Sa("skipActivities",!1),videoPreviewMode:Sa("videoPreviewMode",!1),hideSwiperButtons:Sa("hideNavButtons",!1),extraButtons:gA(),shouldReportSoundLog:Sa("reportSoundLog",!1),startPage:a,autoplayCount:l,roundPageWidthToNearestK:Sm("roundPageWidthToNearestK"),roundMarginToNearestK:Sm("roundMarginToNearestK")})),document.getElementById("root"))}let Of="";mA();
7995
- //# sourceMappingURL=bloomPlayer.Cekh2e5S.js.map
7995
+ //# sourceMappingURL=bloomPlayer.BHAcHhHT.js.map
@@ -18,7 +18,7 @@
18
18
 
19
19
  <!-- At build time, we replace the target of this script tag to point at the
20
20
  the bloom player bundle with the cache-busting hash in its name. -->
21
- <script src="bloomPlayer.Cekh2e5S.js"></script>
21
+ <script src="bloomPlayer.BHAcHhHT.js"></script>
22
22
  </body>
23
23
 
24
24
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A library for displaying Bloom books in iframes or WebViews",
4
4
  "author": "SIL Global",
5
5
  "license": "MIT",
6
- "version": "2.20.0-alpha.4",
6
+ "version": "2.20.0",
7
7
  "packageManager": "pnpm@11.1.2",
8
8
  "private": false,
9
9
  "// sideeffects might need to be ['*.css'] to avoid 'shaking' our CSS, if we ever get tree shaking working": "",