Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@internetarchive/bookreader

Package Overview
Dependencies
Maintainers
11
Versions
300
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@internetarchive/bookreader - npm Package Compare versions

Comparing version 4.22.1-alpha-3 to 4.23.0-alpha-1

2

BookReader/plugins/plugin.search.js

@@ -1,2 +0,2 @@

(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[73],{2728:function(e,t,n){"use strict";n(2222),n(2526),n(9826),n(1817),n(9554),n(2165),n(2772),n(9600),n(1249),n(7042),n(1038),n(4603),n(6992),n(4916),n(4986),n(9714),n(5827),n(5306),n(4765),n(5212),n(4747),n(8309),n(9601),n(1539),n(8674),n(8783),n(3948),n(285),n(5666);var r=n(3609);function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var i,o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t.selector?(this.br=t.br,this.matcher=new RegExp("{{{(.+?)}}}","g"),this.matches=[],this.cacheDOMElements(t.selector),this.bindEvents()):console.warn("BookReader::Search - SearchView must be passed a valid CSS selector")}var t,n;return t=e,(n=[{key:"cacheDOMElements",value:function(e){this.dom={},this.dom.searchTray=this.renderSearchTray(e),this.dom.results=this.dom.searchTray.querySelector('[data-id="results"]'),this.dom.resultsCount=this.dom.searchTray.querySelector('[data-id="results_count"]'),this.dom.searchField=this.dom.searchTray.querySelector('[name="query"]'),this.dom.searchPending=this.dom.searchTray.querySelector('[data-id="searchPending"]'),this.dom.mobileSearch=this.buildMobileDrawer(),this.dom.toolbarSearch=this.buildToolbarSearch()}},{key:"toggleSearchTray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dom.searchTray.classList.contains("hidden");this.dom.searchTray.classList.toggle("hidden",!e)}},{key:"toggleResultsCount",value:function(e){this.dom.resultsCount.classList.toggle("visible",e)}},{key:"updateResultsCount",value:function(e){this.dom.resultsCount.innerText="(".concat(e," result").concat(1!=e?"s":"",")"),this.toggleResultsCount(!0)}},{key:"setQuery",value:function(e){this.br.$('[name="query"]').val(e)}},{key:"emptyMatches",value:function(){this.dom.results.innerHTML="",this.matches=[]}},{key:"removeResultPins",value:function(){this.br.$(".BRnavpos .BRsearch").remove()}},{key:"clearSearchFieldAndResults",value:function(){this.br.removeSearchResults(),this.toggleResultsCount(!1),this.removeResultPins(),this.emptyMatches(),this.setQuery(""),this.teardownSearchNavigation(),this.br.trigger("SearchResultsCleared")}},{key:"toggleSidebar",value:function(){this.br.trigger("ToggleSearchMenu")}},{key:"renderSearchTray",value:function(e){var t=document.createElement("div");return t.setAttribute("id",e.replace(/^#/,"")),t.innerHTML='\n <header>\n <div>\n <h3>Search inside</h3>\n <p data-id="results_count"></p>\n </div>\n <a href="#" class="close"></a>\n </header>\n <form action="" method="get">\n <fieldset>\n <input name="all_files" id="all_files" type="checkbox" />\n <label class="checkbox" for="all_files">Search all files</label>\n <input type="search" name="query" placeholder="Enter a search term" />\n </fieldset>\n </form>\n <div data-id="searchPending" id="search_pending">\n <p>Your search results will appear below</p>\n <div class="loader tc mt20"></div>\n </div>\n <ul data-id="results"></ul>\n ',t}},{key:"renderSearchNavigation",value:function(){var e="BRsearch-navigation";r(".BRnav").before('\n <div class="'.concat(e,'">\n <button class="toggle-sidebar">\n <h4>\n <span class="icon icon-search"></span> Results\n </h4>\n </button>\n <div class="pagination">\n <button class="prev" title="Previous result"><span class="icon icon-chevron hflip"></span></button>\n <span data-id="resultsCount">').concat(this.resultsPosition(),'</span>\n <button class="next" title="Next result"><span class="icon icon-chevron"></button>\n </div>\n <button class="clear" title="Clear search results">\n <span class="icon icon-close"></span>\n </button>\n </div>\n ')),this.dom.searchNavigation=r(".".concat(e))}},{key:"resultsPosition",value:function(){var e="".concat(this.matches.length," result").concat(1===this.matches.length?"":"s");return~this.currentMatchIndex&&(e="".concat(this.currentMatchIndex+1," / ").concat(this.matches.length)),e}},{key:"bindSearchNavigationEvents",value:function(){if(this.dom.searchNavigation){var e="searchNavigation";this.dom.searchNavigation.on("click.".concat(e),".clear",this.clearSearchFieldAndResults.bind(this)).on("click.".concat(e),".prev",this.showPrevResult.bind(this)).on("click.".concat(e),".next",this.showNextResult.bind(this)).on("click.".concat(e),".toggle-sidebar",this.toggleSidebar.bind(this)).on("click.".concat(e),!1)}}},{key:"showPrevResult",value:function(){0!==this.currentMatchIndex&&(this.br.mode===this.br.constModeThumb&&this.br.switchMode(this.br.constMode1up),~this.currentMatchIndex||(this.currentMatchIndex=this.getClosestMatchIndex((function(e,t,n){return t[0]>n}))+1),this.br.$(".BRnavline .BRsearch").eq(--this.currentMatchIndex).click(),this.updateResultsPosition(),this.updateSearchNavigationButtons())}},{key:"showNextResult",value:function(){this.currentMatchIndex+1!==this.matches.length&&(this.br.mode===this.br.constModeThumb&&this.br.switchMode(this.br.constMode1up),~this.currentMatchIndex||(this.currentMatchIndex=this.getClosestMatchIndex((function(e,t,n){return e[e.length-1]>n}))-1),this.br.$(".BRnavline .BRsearch").eq(++this.currentMatchIndex).click(),this.updateResultsPosition(),this.updateSearchNavigationButtons())}},{key:"getClosestMatchIndex",value:function(e){var t=function t(n,r){if(1===n.length)return n[0];var a=n.slice(0,n.length/2),i=n.slice(n.length/2);return t(e(a,i,r)?a:i,r)}(this.matches.map((function(e){return e.par[0].page})),this.br.currentIndex()+1);return this.matches.indexOf(this.matches.find((function(e){return e.par[0].page===t})))}},{key:"updateResultsPosition",value:function(){this.dom.searchNavigation.find("[data-id=resultsCount]").text(this.resultsPosition())}},{key:"updateSearchNavigationButtons",value:function(){this.dom.searchNavigation.find(".prev").attr("disabled",!this.currentMatchIndex),this.dom.searchNavigation.find(".next").attr("disabled",this.currentMatchIndex+1===this.matches.length)}},{key:"teardownSearchNavigation",value:function(){this.dom.searchNavigation||(this.dom.searchNavigation=r(".BRsearch-navigation")),this.dom.searchNavigation.length&&(this.dom.searchNavigation.off(".searchNavigation").remove(),this.dom.searchNavigation=null,this.br.resize())}},{key:"setCurrentMatchIndex",value:function(){var e;this.br.mode!==this.br.constModeThumb?(e=this.br.mode===this.br.constMode2up?this.find2upMatchingSearchResult():this.find1upMatchingSearchResult(),this.currentMatchIndex=this.matches.indexOf(e)):this.currentMatchIndex=-1}},{key:"find1upMatchingSearchResult",value:function(){var e=this;return this.matches.find((function(t){return e.br.currentIndex()===t.par[0].page-1}))}},{key:"find2upMatchingSearchResult",value:function(){var e=this;return this.matches.find((function(t){return e.br._isIndexDisplayed(t.par[0].page-1)}))}},{key:"updateSearchNavigation",value:function(){this.matches.length&&(this.setCurrentMatchIndex(),this.updateResultsPosition(),this.updateSearchNavigationButtons())}},{key:"renderMatches",value:function(e){var t=this,n=e.map((function(e){return'\n <li data-page="'.concat(e.par[0].page,'" data-page-index="').concat(t.br.leafNumToIndex(e.par[0].page),'">\n <h4>Page ').concat(e.par[0].page,"</h4>\n <p>").concat(e.text.replace(t.matcher,"<mark>$1</mark>"),"</p>\n </li>\n ")}));this.dom.results.innerHTML=n.join("")}},{key:"togglePinsFor",value:function(e){var t=e?"visible":"hidden";this.br.refs.$BRfooter.find(".BRsearch").css({visibility:t})}},{key:"buildMobileDrawer",value:function(){var e=document.createElement("li");return e.innerHTML='\n <span>\n <span class="DrawerIconWrapper">\n <img class="DrawerIcon" src="'.concat(this.br.imagesBaseURL,'icon_search_button.svg" />\n </span>\n Search\n </span>\n <div data-id="search_slot">\n </div>\n '),e.querySelector('[data-id="search_slot"]').appendChild(this.dom.searchTray),e.classList.add("BRmobileMenu__search"),e}},{key:"buildToolbarSearch",value:function(){var e=document.createElement("span");return e.classList.add("BRtoolbarSection","BRtoolbarSectionSearch"),e.innerHTML='\n <form class="BRbooksearch desktop">\n <input type="search" name="query" class="BRsearchInput" value="" placeholder="Search inside"/>\n <button type="submit" class="BRsearchSubmit">\n <img src="'.concat(this.br.imagesBaseURL,'icon_search_button.svg" />\n </button>\n </form>\n '),e}},{key:"renderPins",value:function(e){var t=this;e.forEach((function(e){var n=e.text,a=t.br.leafNumToIndex(e.par[0].page),i=t.br.getPageNum(a),o=t.br.constructor.util.cssPercentage(a,t.br.getNumLeafs()-1),s=n.replace(t.matcher,"<b>$1</b>"),c="";n.length>100&&(c=n.replace(/^(.{100}[^\s]*).*/,"$1").replace(t.matcher,"<b>$1</b>")+"..."),r("<div>").addClass("BRsearch").css({left:o}).attr("title","Search result").append('\n <div class="BRquery">\n <div>'.concat(c||s,"</div>\n <div>").concat("Page"," ").concat(i,"</div>\n </div>\n ")).data({pageIndex:a}).appendTo(t.br.$(".BRnavline")).hover((function(e){var t=e.currentTarget,n=t.querySelector(".BRquery"),a=n.getBoundingClientRect(),i=t.getBoundingClientRect(),o=2*parseInt(getComputedStyle(n).paddingLeft);a.x-o<0&&n.style.setProperty("transform","translateX(-".concat(i.left-o,"px)")),r(".BRsearch,.BRchapter").removeClass("front"),r(e.target).addClass("front")}),(function(e){return r(e.target).removeClass("front")})).click(function(e){this.br._searchPluginGoToResult(+r(e.target).data("pageIndex")),this.br.updateSearchHilites()}.bind(t))}))}},{key:"toggleSearchPending",value:function(e){this.dom.searchPending.classList.toggle("visible",e),e?this.br.showProgressPopup("Search results will appear below..."):this.br.removeProgressPopup()}},{key:"renderErrorModal",value:function(){this.renderModalMessage("\n Sorry, there was an error with your search.\n <br />\n The text may still be processing.\n "),this.delayModalRemovalFor(4e3)}},{key:"renderBookNotIndexedModal",value:function(){this.renderModalMessage("\n <p>\n This book hasn't been indexed for searching yet.\n We've just started indexing it, so search should be available soon.\n <br />\n Please try again later. Thanks!\n </p>\n "),this.delayModalRemovalFor(5e3)}},{key:"renderResultsEmptyModal",value:function(){this.renderModalMessage("No matches were found."),this.delayModalRemovalFor(2e3)}},{key:"renderModalMessage",value:function(e){var t=document.createElement("div");t.classList.add("BRprogresspopup","search_modal"),t.innerHTML=e,document.querySelector(this.br.el).append(t)}},{key:"delayModalRemovalFor",value:function(e){setTimeout(this.br.removeProgressPopup.bind(this.br),e)}},{key:"openMobileMenu",value:function(){this.br.refs.$mmenu.data("mmenu").open()}},{key:"closeMobileMenu",value:function(){this.br.refs.$mmenu.data("mmenu").close()}},{key:"submitHandler",value:function(e){e.preventDefault();var t=e.target.querySelector('[name="query"]').value;return!!t.length&&(this.br.search(t),this.dom.searchField.blur(),this.emptyMatches(),this.toggleSearchPending(!0),!1)}},{key:"handleSearchCallback",value:function(e,t){var n=this,a=t.results,i=t.options;this.matches=a.matches,this.setCurrentMatchIndex(),this.teardownSearchNavigation(),this.renderSearchNavigation(),this.bindSearchNavigationEvents(),this.renderMatches(a.matches),this.renderPins(a.matches),this.updateResultsCount(a.matches.length),this.toggleSearchPending(!1),this.br.trigger("ToggleSearchMenu"),console.log("ToggleSearchMenu"),i.goToFirstResult?r(document).one("BookReader:pageChanged",(function(){n.br.resize()})):this.br.resize()}},{key:"handleNavToggledCallback",value:function(e){var t=this.br.navigationIsVisible();this.togglePinsFor(t),this.toggleSearchTray(!!t&&!!this.dom.results.querySelector("li"))}},{key:"handleSearchStarted",value:function(){this.emptyMatches(),this.br.removeSearchHilites(),this.removeResultPins(),this.toggleSearchPending(!0),this.teardownSearchNavigation(),this.setQuery(this.br.searchTerm)}},{key:"handleSearchCallbackError",value:function(){this.toggleSearchPending(!1),this.renderErrorModal()}},{key:"handleSearchCallbackBookNotIndexed",value:function(){this.toggleSearchPending(!1),this.renderBookNotIndexedModal()}},{key:"handleSearchCallbackEmpty",value:function(){this.toggleSearchPending(!1),this.renderResultsEmptyModal()}},{key:"bindEvents",value:function(){var e=this,t="BookReader:";r(document).on("".concat(t,"SearchCallback"),this.handleSearchCallback.bind(this)).on("".concat(t,"navToggled"),this.handleNavToggledCallback.bind(this)).on("".concat(t,"SearchStarted"),this.handleSearchStarted.bind(this)).on("".concat(t,"SearchCallbackError"),this.handleSearchCallbackError.bind(this)).on("".concat(t,"SearchCallbackBookNotIndexed"),this.handleSearchCallbackBookNotIndexed.bind(this)).on("".concat(t,"SearchCallbackEmpty"),this.handleSearchCallbackEmpty.bind(this)).on("".concat(t,"pageChanged"),this.updateSearchNavigation.bind(this)),this.dom.searchTray.addEventListener("submit",this.submitHandler.bind(this)),this.dom.toolbarSearch.querySelector("form").addEventListener("submit",this.submitHandler.bind(this)),this.dom.searchField.addEventListener("search",(function(){e.dom.searchField.value||e.clearSearchFieldAndResults()})),r(this.dom.results).on("click","li",(function(t){e.br._searchPluginGoToResult(+t.currentTarget.dataset.pageIndex),e.br.updateSearchHilites(),e.closeMobileMenu()}))}}])&&a(t.prototype,n),e}(),s=n(3609),c=n(3609);function h(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t,n,r,a,i,o){try{var s=e[i](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,a)}s.extend(BookReader.defaultOptions,{server:"ia600609.us.archive.org",bookId:"",subPrefix:"",bookPath:"",enableSearch:!0,searchInsideUrl:"/fulltext/inside.php",initialSearchTerm:null}),BookReader.prototype.setup=(i=BookReader.prototype.setup,function(e){i.call(this,e),this.searchTerm="",this.searchResults=null,this.searchInsideUrl=e.searchInsideUrl,this.enableSearch=e.enableSearch,this.goToFirstResult=!1,this.bookId=e.bookId,this.server=e.server,this.subPrefix=e.subPrefix,this.bookPath=e.bookPath,this.searchView||(this.searchView=new o({br:this,selector:"#BRsearch_tray"}))}),BookReader.prototype.init=function(e){return function(){e.call(this),this.options.enableSearch&&this.options.initialSearchTerm&&this.search(this.options.initialSearchTerm,{goToFirstResult:this.goToFirstResult,suppressFragmentChange:!0})}}(BookReader.prototype.init),BookReader.prototype.buildMobileDrawerElement=function(e){return function(){var t=e.call(this);if(this.enableSearch)return this.searchView.dom.mobileSearch&&t.find(".BRmobileMenu__moreInfoRow").after(this.searchView.dom.mobileSearch),t}}(BookReader.prototype.buildMobileDrawerElement),BookReader.prototype.buildToolbarElement=function(e){return function(){var t=e.call(this);if(this.enableSearch)return this.searchView.dom.toolbarSearch&&t.find(".BRtoolbarSectionInfo").after(this.searchView.dom.toolbarSearch),t}}(BookReader.prototype.buildToolbarElement),BookReader.prototype.search=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={goToFirstResult:!1,disablePopup:!1,suppressFragmentChange:!1,error:null,success:null},a=s.extend({},r,n);this.suppressFragmentChange=a.suppressFragmentChange,this.searchTerm=t.replace(/\//g," "),a.suppressFragmentChange||this.trigger(BookReader.eventNames.fragmentChange);var i=this.server.replace(/:.+/,""),o="https://".concat(i).concat(this.searchInsideUrl,"?"),h=this.bookPath,u="/".concat(this.subPrefix);this.bookPath.length-this.bookPath.lastIndexOf(u)==u.length&&(h=this.bookPath.substr(0,this.bookPath.length-u.length));var l={item_id:this.bookId,doc:this.subPrefix,path:h,q:t},d=c.param(l).replace(/%2F/g,"/"),f="".concat(o).concat(d),p=function(t){var n=t.error||!t.matches.length,r="function"==typeof a.error,i="function"==typeof a.success;n?r?a.error.call(e,t,a):e.BRSearchCallbackError(t,a):i?a.success.call(e,t,a):e.BRSearchCallback(t,a)};return this.trigger("SearchStarted",{term:this.searchTerm}),c.ajax({url:f,dataType:"jsonp"}).then(p)},BookReader.prototype.BRSearchCallback=function(e,t){this.searchResults=e,this.updateSearchHilites(),this.removeProgressPopup(),t.goToFirstResult&&this._searchPluginGoToResult(e.matches[0].par[0].page),this.trigger("SearchCallback",{results:e,options:t,instance:this})},BookReader.prototype.BRSearchCallbackError=function(e){this._BRSearchCallbackError(e)},BookReader.prototype._BRSearchCallbackError=function(e){this.searchResults=e;var t={term:this.searchTerm,instance:this};if(e.error){var n=Object.assign({},t,{results:e});this.trigger("SearchCallbackError",n)}else if(0==e.matches.length){if(!1===e.indexed)return void this.trigger("SearchCallbackBookNotIndexed",t);this.trigger("SearchCallbackEmpty",t)}},BookReader.prototype.updateSearchHilites=function(){this.constMode2up!=this.mode?this.updateSearchHilites1UP():this.updateSearchHilites2UP()},BookReader.prototype.updateSearchHilites1UP=function(){var e=this,t=this.searchResults;null!=t&&t.matches.forEach((function(t){t.par[0].boxes.forEach((function(t){var n=e.leafNumToIndex(t.page);if(s.inArray(n,e.displayedIndices)>=0){t.div||(t.div=document.createElement("div"),c(t.div).prop("className","BookReaderSearchHilite").appendTo(e.$(".pagediv".concat(n))));var r={width:"".concat((t.r-t.l)/e.reduce,"px"),height:"".concat((t.b-t.t)/e.reduce,"px"),left:"".concat(t.l/e.reduce,"px"),top:"".concat(t.t/e.reduce,"px")};c(t.div).css(r)}else t.div&&(c(t.div).remove(),t.div=null)}))}))},BookReader.prototype.updateSearchHilites2UP=function(){var e=this,t=this.searchResults;null!==t&&t.matches.forEach((function(t){t.par[0].boxes.forEach((function(n){var r=e.leafNumToIndex(t.par[0].page),a=s.inArray(r,e.displayedIndices)>=0,i=e._models.book.getPage(r).isViewable;a&&i?(n.div||(n.div=document.createElement("div"),c(n.div).addClass("BookReaderSearchHilite").appendTo(e.refs.$brTwoPageView)),e.setHilightCss2UP(n.div,r,n.l,n.r,n.t,n.b)):n.div&&(c(n.div).remove(),n.div=null)}))}))},BookReader.prototype.removeSearchHilites=function(){var e=this.searchResults;null!=e&&e.matches&&e.matches.forEach((function(e){e.par[0].boxes.forEach((function(e){null!=e.div&&(c(e.div).remove(),e.div=null)}))}))},BookReader.prototype._searchPluginGoToResult=function(){var e,t=(e=regeneratorRuntime.mark((function e(t){var n,r,a,i,o,s,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._models.book,r=n.getPage(t),a=!1,r.isViewable){e.next=10;break}return e.next=6,fetch("/services/bookreader/request_page?"+new URLSearchParams({id:this.options.bookId,subprefix:this.options.subPrefix,leafNum:r.leafNum})).then((function(e){return e.json()}));case 6:i=e.sent,o=h(i.value);try{for(o.s();!(s=o.n()).done;)c=s.value,n.getPage(n.leafNumToIndex(c)).makeViewable()}catch(e){o.e(e)}finally{o.f()}i.value.length||(n.getPage(t).makeViewable(),a=!0);case 10:this.suppressFragmentChange=!1,this.jumpToIndex(t),a&&n.getPage(t).makeViewable(!1);case 13:case"end":return e.stop()}}),e,this)})),function(){var t=this,n=arguments;return new Promise((function(r,a){var i=e.apply(t,n);function o(e){l(i,r,a,o,s,"next",e)}function s(e){l(i,r,a,o,s,"throw",e)}o(void 0)}))});return function(e){return t.apply(this,arguments)}}(),BookReader.prototype.removeSearchResults=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.removeSearchHilites(),this.searchTerm=null,this.searchResults=null,e||this.trigger(BookReader.eventNames.fragmentChange)},BookReader.prototype.searchHighlightVisible=function(){var e=this,t=this.searchResults,n=[];if(null==t)return!1;if(this.constMode2up==this.mode)n=[this.twoPage.currentIndexL,this.twoPage.currentIndexR];else{if(this.constMode1up!=this.mode)return!1;n=[this.currentIndex()]}return t.matches.some((function(t){return t.par[0].boxes.some((function(t){var r=e.leafNumToIndex(t.page);if(s.inArray(r,n)>=0)return!0}))})),!1}},8533:function(e,t,n){"use strict";var r=n(2092).forEach,a=n(9341),i=n(9207),o=a("forEach"),s=i("forEach");e.exports=o&&s?[].forEach:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}},6583:function(e,t,n){"use strict";var r=n(5656),a=n(9958),i=n(7466),o=n(9341),s=n(9207),c=Math.min,h=[].lastIndexOf,u=!!h&&1/[1].lastIndexOf(1,-0)<0,l=o("lastIndexOf"),d=s("indexOf",{ACCESSORS:!0,1:0}),f=u||!l||!d;e.exports=f?function(e){if(u)return h.apply(this,arguments)||0;var t=r(this),n=i(t.length),o=n-1;for(arguments.length>1&&(o=c(o,a(arguments[1]))),o<0&&(o=n+o);o>=0;o--)if(o in t&&t[o]===e)return o||0;return-1}:h},6833:function(e,t,n){var r=n(8113);e.exports=/(iphone|ipod|ipad).*applewebkit/i.test(r)},842:function(e,t,n){var r=n(7854);e.exports=function(e,t){var n=r.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}},9587:function(e,t,n){var r=n(111),a=n(7674);e.exports=function(e,t,n){var i,o;return a&&"function"==typeof(i=t.constructor)&&i!==n&&r(o=i.prototype)&&o!==n.prototype&&a(e,o),e}},408:function(e,t,n){var r=n(9670),a=n(7659),i=n(7466),o=n(9974),s=n(1246),c=n(3411),h=function(e,t){this.stopped=e,this.result=t};(e.exports=function(e,t,n,u,l){var d,f,p,v,g,m,b,y=o(t,n,u?2:1);if(l)d=e;else{if("function"!=typeof(f=s(e)))throw TypeError("Target is not iterable");if(a(f)){for(p=0,v=i(e.length);v>p;p++)if((g=u?y(r(b=e[p])[0],b[1]):y(e[p]))&&g instanceof h)return g;return new h(!1)}d=f.call(e)}for(m=d.next;!(b=m.call(d)).done;)if("object"==typeof(g=c(d,y,b.value,u))&&g&&g instanceof h)return g;return new h(!1)}).stop=function(e){return new h(!0,e)}},5948:function(e,t,n){var r,a,i,o,s,c,h,u,l=n(7854),d=n(1236).f,f=n(4326),p=n(261).set,v=n(6833),g=l.MutationObserver||l.WebKitMutationObserver,m=l.process,b=l.Promise,y="process"==f(m),k=d(l,"queueMicrotask"),S=k&&k.value;S||(r=function(){var e,t;for(y&&(e=m.domain)&&e.exit();a;){t=a.fn,a=a.next;try{t()}catch(e){throw a?o():i=void 0,e}}i=void 0,e&&e.enter()},y?o=function(){m.nextTick(r)}:g&&!v?(s=!0,c=document.createTextNode(""),new g(r).observe(c,{characterData:!0}),o=function(){c.data=s=!s}):b&&b.resolve?(h=b.resolve(void 0),u=h.then,o=function(){u.call(h,r)}):o=function(){p.call(l,r)}),e.exports=S||function(e){var t={fn:e,next:void 0};i&&(i.next=t),a||(a=t,o()),i=t}},3366:function(e,t,n){var r=n(7854);e.exports=r.Promise},8523:function(e,t,n){"use strict";var r=n(3099),a=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=r(t),this.reject=r(n)};e.exports.f=function(e){return new a(e)}},2534:function(e){e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},9478:function(e,t,n){var r=n(9670),a=n(111),i=n(8523);e.exports=function(e,t){if(r(e),a(t)&&t.constructor===e)return t;var n=i.f(e);return(0,n.resolve)(t),n.promise}},6340:function(e,t,n){"use strict";var r=n(5005),a=n(3070),i=n(5112),o=n(9781),s=i("species");e.exports=function(e){var t=r(e),n=a.f;o&&t&&!t[s]&&n(t,s,{configurable:!0,get:function(){return this}})}},261:function(e,t,n){var r,a,i,o=n(7854),s=n(7293),c=n(4326),h=n(9974),u=n(490),l=n(317),d=n(6833),f=o.location,p=o.setImmediate,v=o.clearImmediate,g=o.process,m=o.MessageChannel,b=o.Dispatch,y=0,k={},S=function(e){if(k.hasOwnProperty(e)){var t=k[e];delete k[e],t()}},R=function(e){return function(){S(e)}},x=function(e){S(e.data)},M=function(e){o.postMessage(e+"",f.protocol+"//"+f.host)};p&&v||(p=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return k[++y]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},r(y),y},v=function(e){delete k[e]},"process"==c(g)?r=function(e){g.nextTick(R(e))}:b&&b.now?r=function(e){b.now(R(e))}:m&&!d?(i=(a=new m).port2,a.port1.onmessage=x,r=h(i.postMessage,i,1)):!o.addEventListener||"function"!=typeof postMessage||o.importScripts||s(M)||"file:"===f.protocol?r="onreadystatechange"in l("script")?function(e){u.appendChild(l("script")).onreadystatechange=function(){u.removeChild(this),S(e)}}:function(e){setTimeout(R(e),0)}:(r=M,o.addEventListener("message",x,!1))),e.exports={set:p,clear:v}},9554:function(e,t,n){"use strict";var r=n(2109),a=n(8533);r({target:"Array",proto:!0,forced:[].forEach!=a},{forEach:a})},4986:function(e,t,n){var r=n(2109),a=n(6583);r({target:"Array",proto:!0,forced:a!==[].lastIndexOf},{lastIndexOf:a})},5212:function(e,t,n){"use strict";var r=n(2109),a=n(2092).some,i=n(9341),o=n(9207),s=i("some"),c=o("some");r({target:"Array",proto:!0,forced:!s||!c},{some:function(e){return a(this,e,arguments.length>1?arguments[1]:void 0)}})},8674:function(e,t,n){"use strict";var r,a,i,o,s=n(2109),c=n(1913),h=n(7854),u=n(5005),l=n(3366),d=n(1320),f=n(2248),p=n(8003),v=n(6340),g=n(111),m=n(3099),b=n(5787),y=n(4326),k=n(2788),S=n(408),R=n(7072),x=n(6707),M=n(261).set,P=n(5948),w=n(9478),T=n(842),B=n(8523),E=n(2534),C=n(9909),I=n(4705),N=n(5112),_=n(7392),j=N("species"),F="Promise",H=C.get,L=C.set,q=C.getterFor(F),O=l,A=h.TypeError,U=h.document,V=h.process,$=u("fetch"),D=B.f,G=D,z="process"==y(V),Q=!!(U&&U.createEvent&&h.dispatchEvent),W="unhandledrejection",Y=I(F,(function(){if(k(O)===String(O)){if(66===_)return!0;if(!z&&"function"!=typeof PromiseRejectionEvent)return!0}if(c&&!O.prototype.finally)return!0;if(_>=51&&/native code/.test(O))return!1;var e=O.resolve(1),t=function(e){e((function(){}),(function(){}))};return(e.constructor={})[j]=t,!(e.then((function(){}))instanceof t)})),K=Y||!R((function(e){O.all(e).catch((function(){}))})),X=function(e){var t;return!(!g(e)||"function"!=typeof(t=e.then))&&t},J=function(e,t,n){if(!t.notified){t.notified=!0;var r=t.reactions;P((function(){for(var a=t.value,i=1==t.state,o=0;r.length>o;){var s,c,h,u=r[o++],l=i?u.ok:u.fail,d=u.resolve,f=u.reject,p=u.domain;try{l?(i||(2===t.rejection&&ne(e,t),t.rejection=1),!0===l?s=a:(p&&p.enter(),s=l(a),p&&(p.exit(),h=!0)),s===u.promise?f(A("Promise-chain cycle")):(c=X(s))?c.call(s,d,f):d(s)):f(a)}catch(e){p&&!h&&p.exit(),f(e)}}t.reactions=[],t.notified=!1,n&&!t.rejection&&ee(e,t)}))}},Z=function(e,t,n){var r,a;Q?((r=U.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),h.dispatchEvent(r)):r={promise:t,reason:n},(a=h["on"+e])?a(r):e===W&&T("Unhandled promise rejection",n)},ee=function(e,t){M.call(h,(function(){var n,r=t.value;if(te(t)&&(n=E((function(){z?V.emit("unhandledRejection",r,e):Z(W,e,r)})),t.rejection=z||te(t)?2:1,n.error))throw n.value}))},te=function(e){return 1!==e.rejection&&!e.parent},ne=function(e,t){M.call(h,(function(){z?V.emit("rejectionHandled",e):Z("rejectionhandled",e,t.value)}))},re=function(e,t,n,r){return function(a){e(t,n,a,r)}},ae=function(e,t,n,r){t.done||(t.done=!0,r&&(t=r),t.value=n,t.state=2,J(e,t,!0))},ie=function(e,t,n,r){if(!t.done){t.done=!0,r&&(t=r);try{if(e===n)throw A("Promise can't be resolved itself");var a=X(n);a?P((function(){var r={done:!1};try{a.call(n,re(ie,e,r,t),re(ae,e,r,t))}catch(n){ae(e,r,n,t)}})):(t.value=n,t.state=1,J(e,t,!1))}catch(n){ae(e,{done:!1},n,t)}}};Y&&(O=function(e){b(this,O,F),m(e),r.call(this);var t=H(this);try{e(re(ie,this,t),re(ae,this,t))}catch(e){ae(this,t,e)}},(r=function(e){L(this,{type:F,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=f(O.prototype,{then:function(e,t){var n=q(this),r=D(x(this,O));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=z?V.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&J(this,n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),a=function(){var e=new r,t=H(e);this.promise=e,this.resolve=re(ie,e,t),this.reject=re(ae,e,t)},B.f=D=function(e){return e===O||e===i?new a(e):G(e)},c||"function"!=typeof l||(o=l.prototype.then,d(l.prototype,"then",(function(e,t){var n=this;return new O((function(e,t){o.call(n,e,t)})).then(e,t)}),{unsafe:!0}),"function"==typeof $&&s({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return w(O,$.apply(h,arguments))}}))),s({global:!0,wrap:!0,forced:Y},{Promise:O}),p(O,F,!1,!0),v(F),i=u(F),s({target:F,stat:!0,forced:Y},{reject:function(e){var t=D(this);return t.reject.call(void 0,e),t.promise}}),s({target:F,stat:!0,forced:c||Y},{resolve:function(e){return w(c&&this===i?O:this,e)}}),s({target:F,stat:!0,forced:K},{all:function(e){var t=this,n=D(t),r=n.resolve,a=n.reject,i=E((function(){var n=m(t.resolve),i=[],o=0,s=1;S(e,(function(e){var c=o++,h=!1;i.push(void 0),s++,n.call(t,e).then((function(e){h||(h=!0,i[c]=e,--s||r(i))}),a)})),--s||r(i)}));return i.error&&a(i.value),n.promise},race:function(e){var t=this,n=D(t),r=n.reject,a=E((function(){var a=m(t.resolve);S(e,(function(e){a.call(t,e).then(n.resolve,r)}))}));return a.error&&r(a.value),n.promise}})},4603:function(e,t,n){var r=n(9781),a=n(7854),i=n(4705),o=n(9587),s=n(3070).f,c=n(8006).f,h=n(7850),u=n(7066),l=n(2999),d=n(1320),f=n(7293),p=n(9909).set,v=n(6340),g=n(5112)("match"),m=a.RegExp,b=m.prototype,y=/a/g,k=/a/g,S=new m(y)!==y,R=l.UNSUPPORTED_Y;if(r&&i("RegExp",!S||R||f((function(){return k[g]=!1,m(y)!=y||m(k)==k||"/a/i"!=m(y,"i")})))){for(var x=function(e,t){var n,r=this instanceof x,a=h(e),i=void 0===t;if(!r&&a&&e.constructor===x&&i)return e;S?a&&!i&&(e=e.source):e instanceof x&&(i&&(t=u.call(e)),e=e.source),R&&(n=!!t&&t.indexOf("y")>-1)&&(t=t.replace(/y/g,""));var s=o(S?new m(e,t):m(e,t),r?this:b,x);return R&&n&&p(s,{sticky:n}),s},M=function(e){e in x||s(x,e,{configurable:!0,get:function(){return m[e]},set:function(t){m[e]=t}})},P=c(m),w=0;P.length>w;)M(P[w++]);b.constructor=x,x.prototype=b,d(a,"RegExp",x)}v("RegExp")},4747:function(e,t,n){var r=n(7854),a=n(8324),i=n(8533),o=n(8880);for(var s in a){var c=r[s],h=c&&c.prototype;if(h&&h.forEach!==i)try{o(h,"forEach",i)}catch(e){h.forEach=i}}}},0,[[2728,898]]]);
(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[73],{2728:function(e,t,n){"use strict";n(2222),n(2526),n(9826),n(1817),n(9554),n(2165),n(2772),n(9600),n(1249),n(7042),n(1038),n(4603),n(6992),n(4916),n(4986),n(9714),n(5827),n(5306),n(4765),n(5212),n(4747),n(8309),n(9601),n(1539),n(8674),n(8783),n(3948),n(285),n(5666);var r=n(3609);function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var i,o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t.selector?(this.br=t.br,this.matcher=new RegExp("{{{(.+?)}}}","g"),this.matches=[],this.cacheDOMElements(t.selector),this.bindEvents()):console.warn("BookReader::Search - SearchView must be passed a valid CSS selector")}var t,n;return t=e,(n=[{key:"cacheDOMElements",value:function(e){this.dom={},this.dom.searchTray=this.renderSearchTray(e),this.dom.results=this.dom.searchTray.querySelector('[data-id="results"]'),this.dom.resultsCount=this.dom.searchTray.querySelector('[data-id="results_count"]'),this.dom.searchField=this.dom.searchTray.querySelector('[name="query"]'),this.dom.searchPending=this.dom.searchTray.querySelector('[data-id="searchPending"]'),this.dom.mobileSearch=this.buildMobileDrawer(),this.dom.toolbarSearch=this.buildToolbarSearch()}},{key:"toggleSearchTray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dom.searchTray.classList.contains("hidden");this.dom.searchTray.classList.toggle("hidden",!e)}},{key:"toggleResultsCount",value:function(e){this.dom.resultsCount.classList.toggle("visible",e)}},{key:"updateResultsCount",value:function(e){this.dom.resultsCount.innerText="(".concat(e," result").concat(1!=e?"s":"",")"),this.toggleResultsCount(!0)}},{key:"setQuery",value:function(e){this.br.$('[name="query"]').val(e)}},{key:"emptyMatches",value:function(){this.dom.results.innerHTML="",this.matches=[]}},{key:"removeResultPins",value:function(){this.br.$(".BRnavpos .BRsearch").remove()}},{key:"clearSearchFieldAndResults",value:function(){this.br.removeSearchResults(),this.toggleResultsCount(!1),this.removeResultPins(),this.emptyMatches(),this.setQuery(""),this.teardownSearchNavigation(),this.br.trigger("SearchResultsCleared")}},{key:"toggleSidebar",value:function(){this.br.trigger("ToggleSearchMenu")}},{key:"renderSearchTray",value:function(e){var t=document.createElement("div");return t.setAttribute("id",e.replace(/^#/,"")),t.innerHTML='\n <header>\n <div>\n <h3>Search inside</h3>\n <p data-id="results_count"></p>\n </div>\n <a href="#" class="close"></a>\n </header>\n <form action="" method="get">\n <fieldset>\n <input name="all_files" id="all_files" type="checkbox" />\n <label class="checkbox" for="all_files">Search all files</label>\n <input type="search" name="query" placeholder="Enter a search term" />\n </fieldset>\n </form>\n <div data-id="searchPending" id="search_pending">\n <p>Your search results will appear below</p>\n <div class="loader tc mt20"></div>\n </div>\n <ul data-id="results"></ul>\n ',t}},{key:"renderSearchNavigation",value:function(){var e="BRsearch-navigation";r(".BRnav").before('\n <div class="'.concat(e,'">\n <button class="toggle-sidebar">\n <h4>\n <span class="icon icon-search"></span> Results\n </h4>\n </button>\n <div class="pagination">\n <button class="prev" title="Previous result"><span class="icon icon-chevron hflip"></span></button>\n <span data-id="resultsCount">').concat(this.resultsPosition(),'</span>\n <button class="next" title="Next result"><span class="icon icon-chevron"></button>\n </div>\n <button class="clear" title="Clear search results">\n <span class="icon icon-close"></span>\n </button>\n </div>\n ')),this.dom.searchNavigation=r(".".concat(e))}},{key:"resultsPosition",value:function(){var e="".concat(this.matches.length," result").concat(1===this.matches.length?"":"s");return~this.currentMatchIndex&&(e="".concat(this.currentMatchIndex+1," / ").concat(this.matches.length)),e}},{key:"bindSearchNavigationEvents",value:function(){if(this.dom.searchNavigation){var e="searchNavigation";this.dom.searchNavigation.on("click.".concat(e),".clear",this.clearSearchFieldAndResults.bind(this)).on("click.".concat(e),".prev",this.showPrevResult.bind(this)).on("click.".concat(e),".next",this.showNextResult.bind(this)).on("click.".concat(e),".toggle-sidebar",this.toggleSidebar.bind(this)).on("click.".concat(e),!1)}}},{key:"showPrevResult",value:function(){0!==this.currentMatchIndex&&(this.br.mode===this.br.constModeThumb&&this.br.switchMode(this.br.constMode1up),~this.currentMatchIndex||(this.currentMatchIndex=this.getClosestMatchIndex((function(e,t,n){return t[0]>n}))+1),this.br.$(".BRnavline .BRsearch").eq(--this.currentMatchIndex).click(),this.updateResultsPosition(),this.updateSearchNavigationButtons())}},{key:"showNextResult",value:function(){this.currentMatchIndex+1!==this.matches.length&&(this.br.mode===this.br.constModeThumb&&this.br.switchMode(this.br.constMode1up),~this.currentMatchIndex||(this.currentMatchIndex=this.getClosestMatchIndex((function(e,t,n){return e[e.length-1]>n}))-1),this.br.$(".BRnavline .BRsearch").eq(++this.currentMatchIndex).click(),this.updateResultsPosition(),this.updateSearchNavigationButtons())}},{key:"getClosestMatchIndex",value:function(e){var t=function t(n,r){if(1===n.length)return n[0];var a=n.slice(0,n.length/2),i=n.slice(n.length/2);return t(e(a,i,r)?a:i,r)}(this.matches.map((function(e){return e.par[0].page})),this.br.currentIndex()+1);return this.matches.indexOf(this.matches.find((function(e){return e.par[0].page===t})))}},{key:"updateResultsPosition",value:function(){this.dom.searchNavigation.find("[data-id=resultsCount]").text(this.resultsPosition())}},{key:"updateSearchNavigationButtons",value:function(){this.dom.searchNavigation.find(".prev").attr("disabled",!this.currentMatchIndex),this.dom.searchNavigation.find(".next").attr("disabled",this.currentMatchIndex+1===this.matches.length)}},{key:"teardownSearchNavigation",value:function(){this.dom.searchNavigation||(this.dom.searchNavigation=r(".BRsearch-navigation")),this.dom.searchNavigation.length&&(this.dom.searchNavigation.off(".searchNavigation").remove(),this.dom.searchNavigation=null,this.br.resize())}},{key:"setCurrentMatchIndex",value:function(){var e;this.br.mode!==this.br.constModeThumb?(e=this.br.mode===this.br.constMode2up?this.find2upMatchingSearchResult():this.find1upMatchingSearchResult(),this.currentMatchIndex=this.matches.indexOf(e)):this.currentMatchIndex=-1}},{key:"find1upMatchingSearchResult",value:function(){var e=this;return this.matches.find((function(t){return e.br.currentIndex()===t.par[0].page-1}))}},{key:"find2upMatchingSearchResult",value:function(){var e=this;return this.matches.find((function(t){return e.br._isIndexDisplayed(t.par[0].page-1)}))}},{key:"updateSearchNavigation",value:function(){this.matches.length&&(this.setCurrentMatchIndex(),this.updateResultsPosition(),this.updateSearchNavigationButtons())}},{key:"renderMatches",value:function(e){var t=this,n=e.map((function(e){return'\n <li data-page="'.concat(e.par[0].page,'" data-page-index="').concat(t.br.leafNumToIndex(e.par[0].page),'">\n <h4>Page ').concat(e.par[0].page,"</h4>\n <p>").concat(e.text.replace(t.matcher,"<mark>$1</mark>"),"</p>\n </li>\n ")}));this.dom.results.innerHTML=n.join("")}},{key:"togglePinsFor",value:function(e){var t=e?"visible":"hidden";this.br.refs.$BRfooter.find(".BRsearch").css({visibility:t})}},{key:"buildMobileDrawer",value:function(){var e=document.createElement("li");return e.innerHTML='\n <span>\n <span class="DrawerIconWrapper">\n <img class="DrawerIcon" src="'.concat(this.br.imagesBaseURL,'icon_search_button.svg" />\n </span>\n Search\n </span>\n <div data-id="search_slot">\n </div>\n '),e.querySelector('[data-id="search_slot"]').appendChild(this.dom.searchTray),e.classList.add("BRmobileMenu__search"),e}},{key:"buildToolbarSearch",value:function(){var e=document.createElement("span");return e.classList.add("BRtoolbarSection","BRtoolbarSectionSearch"),e.innerHTML='\n <form class="BRbooksearch desktop">\n <input type="search" name="query" class="BRsearchInput" value="" placeholder="Search inside"/>\n <button type="submit" class="BRsearchSubmit">\n <img src="'.concat(this.br.imagesBaseURL,'icon_search_button.svg" />\n </button>\n </form>\n '),e}},{key:"renderPins",value:function(e){var t=this;e.forEach((function(e){var n=e.text,a=t.br.leafNumToIndex(e.par[0].page),i=t.br.getPageNum(a),o=t.br.constructor.util.cssPercentage(a,t.br.getNumLeafs()-1),s=n.replace(t.matcher,"<b>$1</b>"),c="";n.length>100&&(c=n.replace(/^(.{100}[^\s]*).*/,"$1").replace(t.matcher,"<b>$1</b>")+"..."),r("<div>").addClass("BRsearch").css({left:o}).attr("title","Search result").append('\n <div class="BRquery">\n <div>'.concat(c||s,"</div>\n <div>").concat("Page"," ").concat(i,"</div>\n </div>\n ")).data({pageIndex:a}).appendTo(t.br.$(".BRnavline")).hover((function(e){var t=e.currentTarget,n=t.querySelector(".BRquery"),a=n.getBoundingClientRect(),i=t.getBoundingClientRect(),o=2*parseInt(getComputedStyle(n).paddingLeft);a.x-o<0&&n.style.setProperty("transform","translateX(-".concat(i.left-o,"px)")),r(".BRsearch,.BRchapter").removeClass("front"),r(e.target).addClass("front")}),(function(e){return r(e.target).removeClass("front")})).click(function(e){this.br._searchPluginGoToResult(+r(e.target).data("pageIndex")),this.br.updateSearchHilites()}.bind(t))}))}},{key:"toggleSearchPending",value:function(e){this.dom.searchPending.classList.toggle("visible",e),e?this.br.showProgressPopup("Search results will appear below..."):this.br.removeProgressPopup()}},{key:"renderErrorModal",value:function(){this.renderModalMessage("\n Sorry, there was an error with your search.\n <br />\n The text may still be processing.\n "),this.delayModalRemovalFor(4e3)}},{key:"renderBookNotIndexedModal",value:function(){this.renderModalMessage("\n <p>\n This book hasn't been indexed for searching yet.\n We've just started indexing it, so search should be available soon.\n <br />\n Please try again later. Thanks!\n </p>\n "),this.delayModalRemovalFor(5e3)}},{key:"renderResultsEmptyModal",value:function(){this.renderModalMessage("No matches were found."),this.delayModalRemovalFor(2e3)}},{key:"renderModalMessage",value:function(e){var t=document.createElement("div");t.classList.add("BRprogresspopup","search_modal"),t.innerHTML=e,document.querySelector(this.br.el).append(t)}},{key:"delayModalRemovalFor",value:function(e){setTimeout(this.br.removeProgressPopup.bind(this.br),e)}},{key:"openMobileMenu",value:function(){this.br.refs.$mmenu.data("mmenu").open()}},{key:"closeMobileMenu",value:function(){this.br.refs.$mmenu.data("mmenu").close()}},{key:"submitHandler",value:function(e){e.preventDefault();var t=e.target.querySelector('[name="query"]').value;return!!t.length&&(this.br.search(t),this.dom.searchField.blur(),this.emptyMatches(),this.toggleSearchPending(!0),!1)}},{key:"handleSearchCallback",value:function(e,t){var n=this,a=t.results,i=t.options;this.matches=a.matches,this.setCurrentMatchIndex(),this.teardownSearchNavigation(),this.renderSearchNavigation(),this.bindSearchNavigationEvents(),this.renderMatches(a.matches),this.renderPins(a.matches),this.updateResultsCount(a.matches.length),this.toggleSearchPending(!1),i.goToFirstResult?r(document).one("BookReader:pageChanged",(function(){n.br.resize()})):this.br.resize()}},{key:"handleNavToggledCallback",value:function(e){var t=this.br.navigationIsVisible();this.togglePinsFor(t),this.toggleSearchTray(!!t&&!!this.dom.results.querySelector("li"))}},{key:"handleSearchStarted",value:function(){this.emptyMatches(),this.br.removeSearchHilites(),this.removeResultPins(),this.toggleSearchPending(!0),this.teardownSearchNavigation(),this.setQuery(this.br.searchTerm)}},{key:"handleSearchCallbackError",value:function(){this.toggleSearchPending(!1),this.renderErrorModal()}},{key:"handleSearchCallbackBookNotIndexed",value:function(){this.toggleSearchPending(!1),this.renderBookNotIndexedModal()}},{key:"handleSearchCallbackEmpty",value:function(){this.toggleSearchPending(!1),this.renderResultsEmptyModal()}},{key:"bindEvents",value:function(){var e=this,t="BookReader:";r(document).on("".concat(t,"SearchCallback"),this.handleSearchCallback.bind(this)).on("".concat(t,"navToggled"),this.handleNavToggledCallback.bind(this)).on("".concat(t,"SearchStarted"),this.handleSearchStarted.bind(this)).on("".concat(t,"SearchCallbackError"),this.handleSearchCallbackError.bind(this)).on("".concat(t,"SearchCallbackBookNotIndexed"),this.handleSearchCallbackBookNotIndexed.bind(this)).on("".concat(t,"SearchCallbackEmpty"),this.handleSearchCallbackEmpty.bind(this)).on("".concat(t,"pageChanged"),this.updateSearchNavigation.bind(this)),this.dom.searchTray.addEventListener("submit",this.submitHandler.bind(this)),this.dom.toolbarSearch.querySelector("form").addEventListener("submit",this.submitHandler.bind(this)),this.dom.searchField.addEventListener("search",(function(){e.dom.searchField.value||e.clearSearchFieldAndResults()})),r(this.dom.results).on("click","li",(function(t){e.br._searchPluginGoToResult(+t.currentTarget.dataset.pageIndex),e.br.updateSearchHilites(),e.closeMobileMenu()}))}}])&&a(t.prototype,n),e}(),s=n(3609),c=n(3609);function h(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t,n,r,a,i,o){try{var s=e[i](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,a)}s.extend(BookReader.defaultOptions,{server:"ia600609.us.archive.org",bookId:"",subPrefix:"",bookPath:"",enableSearch:!0,searchInsideUrl:"/fulltext/inside.php",initialSearchTerm:null}),BookReader.prototype.setup=(i=BookReader.prototype.setup,function(e){i.call(this,e),this.searchTerm="",this.searchResults=null,this.searchInsideUrl=e.searchInsideUrl,this.enableSearch=e.enableSearch,this.goToFirstResult=!1,this.bookId=e.bookId,this.server=e.server,this.subPrefix=e.subPrefix,this.bookPath=e.bookPath,this.searchView||(this.searchView=new o({br:this,selector:"#BRsearch_tray"}))}),BookReader.prototype.init=function(e){return function(){e.call(this),this.options.enableSearch&&this.options.initialSearchTerm&&this.search(this.options.initialSearchTerm,{goToFirstResult:this.goToFirstResult,suppressFragmentChange:!0})}}(BookReader.prototype.init),BookReader.prototype.buildMobileDrawerElement=function(e){return function(){var t=e.call(this);if(this.enableSearch)return this.searchView.dom.mobileSearch&&t.find(".BRmobileMenu__moreInfoRow").after(this.searchView.dom.mobileSearch),t}}(BookReader.prototype.buildMobileDrawerElement),BookReader.prototype.buildToolbarElement=function(e){return function(){var t=e.call(this);if(this.enableSearch)return this.searchView.dom.toolbarSearch&&t.find(".BRtoolbarSectionInfo").after(this.searchView.dom.toolbarSearch),t}}(BookReader.prototype.buildToolbarElement),BookReader.prototype.search=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={goToFirstResult:!1,disablePopup:!1,suppressFragmentChange:!1,error:null,success:null},a=s.extend({},r,n);this.suppressFragmentChange=a.suppressFragmentChange,this.searchTerm=t.replace(/\//g," "),a.suppressFragmentChange||this.trigger(BookReader.eventNames.fragmentChange);var i=this.server.replace(/:.+/,""),o="https://".concat(i).concat(this.searchInsideUrl,"?"),h=this.bookPath,u="/".concat(this.subPrefix);this.bookPath.length-this.bookPath.lastIndexOf(u)==u.length&&(h=this.bookPath.substr(0,this.bookPath.length-u.length));var l={item_id:this.bookId,doc:this.subPrefix,path:h,q:t},d=c.param(l).replace(/%2F/g,"/"),f="".concat(o).concat(d),p=function(t){var n=t.error||!t.matches.length,r="function"==typeof a.error,i="function"==typeof a.success;n?r?a.error.call(e,t,a):e.BRSearchCallbackError(t,a):i?a.success.call(e,t,a):e.BRSearchCallback(t,a)};return this.trigger("SearchStarted",{term:this.searchTerm}),c.ajax({url:f,dataType:"jsonp"}).then(p)},BookReader.prototype.BRSearchCallback=function(e,t){this.searchResults=e,this.updateSearchHilites(),this.removeProgressPopup(),t.goToFirstResult&&this._searchPluginGoToResult(e.matches[0].par[0].page),this.trigger("SearchCallback",{results:e,options:t,instance:this})},BookReader.prototype.BRSearchCallbackError=function(e){this._BRSearchCallbackError(e)},BookReader.prototype._BRSearchCallbackError=function(e){this.searchResults=e;var t={term:this.searchTerm,instance:this};if(e.error){var n=Object.assign({},t,{results:e});this.trigger("SearchCallbackError",n)}else if(0==e.matches.length){if(!1===e.indexed)return void this.trigger("SearchCallbackBookNotIndexed",t);this.trigger("SearchCallbackEmpty",t)}},BookReader.prototype.updateSearchHilites=function(){this.constMode2up!=this.mode?this.updateSearchHilites1UP():this.updateSearchHilites2UP()},BookReader.prototype.updateSearchHilites1UP=function(){var e=this,t=this.searchResults;null!=t&&t.matches.forEach((function(t){t.par[0].boxes.forEach((function(t){var n=e.leafNumToIndex(t.page);if(s.inArray(n,e.displayedIndices)>=0){t.div||(t.div=document.createElement("div"),c(t.div).prop("className","BookReaderSearchHilite").appendTo(e.$(".pagediv".concat(n))));var r={width:"".concat((t.r-t.l)/e.reduce,"px"),height:"".concat((t.b-t.t)/e.reduce,"px"),left:"".concat(t.l/e.reduce,"px"),top:"".concat(t.t/e.reduce,"px")};c(t.div).css(r)}else t.div&&(c(t.div).remove(),t.div=null)}))}))},BookReader.prototype.updateSearchHilites2UP=function(){var e=this,t=this.searchResults;null!==t&&t.matches.forEach((function(t){t.par[0].boxes.forEach((function(n){var r=e.leafNumToIndex(t.par[0].page),a=s.inArray(r,e.displayedIndices)>=0,i=e._models.book.getPage(r).isViewable;a&&i?(n.div||(n.div=document.createElement("div"),c(n.div).addClass("BookReaderSearchHilite").appendTo(e.refs.$brTwoPageView)),e.setHilightCss2UP(n.div,r,n.l,n.r,n.t,n.b)):n.div&&(c(n.div).remove(),n.div=null)}))}))},BookReader.prototype.removeSearchHilites=function(){var e=this.searchResults;null!=e&&e.matches&&e.matches.forEach((function(e){e.par[0].boxes.forEach((function(e){null!=e.div&&(c(e.div).remove(),e.div=null)}))}))},BookReader.prototype._searchPluginGoToResult=function(){var e,t=(e=regeneratorRuntime.mark((function e(t){var n,r,a,i,o,s,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._models.book,r=n.getPage(t),a=!1,r.isViewable){e.next=10;break}return e.next=6,fetch("/services/bookreader/request_page?"+new URLSearchParams({id:this.options.bookId,subprefix:this.options.subPrefix,leafNum:r.leafNum})).then((function(e){return e.json()}));case 6:i=e.sent,o=h(i.value);try{for(o.s();!(s=o.n()).done;)c=s.value,n.getPage(n.leafNumToIndex(c)).makeViewable()}catch(e){o.e(e)}finally{o.f()}i.value.length||(n.getPage(t).makeViewable(),a=!0);case 10:this.suppressFragmentChange=!1,this.jumpToIndex(t),a&&n.getPage(t).makeViewable(!1);case 13:case"end":return e.stop()}}),e,this)})),function(){var t=this,n=arguments;return new Promise((function(r,a){var i=e.apply(t,n);function o(e){l(i,r,a,o,s,"next",e)}function s(e){l(i,r,a,o,s,"throw",e)}o(void 0)}))});return function(e){return t.apply(this,arguments)}}(),BookReader.prototype.removeSearchResults=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.removeSearchHilites(),this.searchTerm=null,this.searchResults=null,e||this.trigger(BookReader.eventNames.fragmentChange)},BookReader.prototype.searchHighlightVisible=function(){var e=this,t=this.searchResults,n=[];if(null==t)return!1;if(this.constMode2up==this.mode)n=[this.twoPage.currentIndexL,this.twoPage.currentIndexR];else{if(this.constMode1up!=this.mode)return!1;n=[this.currentIndex()]}return t.matches.some((function(t){return t.par[0].boxes.some((function(t){var r=e.leafNumToIndex(t.page);if(s.inArray(r,n)>=0)return!0}))})),!1}},8533:function(e,t,n){"use strict";var r=n(2092).forEach,a=n(9341),i=n(9207),o=a("forEach"),s=i("forEach");e.exports=o&&s?[].forEach:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}},6583:function(e,t,n){"use strict";var r=n(5656),a=n(9958),i=n(7466),o=n(9341),s=n(9207),c=Math.min,h=[].lastIndexOf,u=!!h&&1/[1].lastIndexOf(1,-0)<0,l=o("lastIndexOf"),d=s("indexOf",{ACCESSORS:!0,1:0}),f=u||!l||!d;e.exports=f?function(e){if(u)return h.apply(this,arguments)||0;var t=r(this),n=i(t.length),o=n-1;for(arguments.length>1&&(o=c(o,a(arguments[1]))),o<0&&(o=n+o);o>=0;o--)if(o in t&&t[o]===e)return o||0;return-1}:h},6833:function(e,t,n){var r=n(8113);e.exports=/(iphone|ipod|ipad).*applewebkit/i.test(r)},842:function(e,t,n){var r=n(7854);e.exports=function(e,t){var n=r.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}},9587:function(e,t,n){var r=n(111),a=n(7674);e.exports=function(e,t,n){var i,o;return a&&"function"==typeof(i=t.constructor)&&i!==n&&r(o=i.prototype)&&o!==n.prototype&&a(e,o),e}},408:function(e,t,n){var r=n(9670),a=n(7659),i=n(7466),o=n(9974),s=n(1246),c=n(3411),h=function(e,t){this.stopped=e,this.result=t};(e.exports=function(e,t,n,u,l){var d,f,p,v,g,m,b,y=o(t,n,u?2:1);if(l)d=e;else{if("function"!=typeof(f=s(e)))throw TypeError("Target is not iterable");if(a(f)){for(p=0,v=i(e.length);v>p;p++)if((g=u?y(r(b=e[p])[0],b[1]):y(e[p]))&&g instanceof h)return g;return new h(!1)}d=f.call(e)}for(m=d.next;!(b=m.call(d)).done;)if("object"==typeof(g=c(d,y,b.value,u))&&g&&g instanceof h)return g;return new h(!1)}).stop=function(e){return new h(!0,e)}},5948:function(e,t,n){var r,a,i,o,s,c,h,u,l=n(7854),d=n(1236).f,f=n(4326),p=n(261).set,v=n(6833),g=l.MutationObserver||l.WebKitMutationObserver,m=l.process,b=l.Promise,y="process"==f(m),k=d(l,"queueMicrotask"),S=k&&k.value;S||(r=function(){var e,t;for(y&&(e=m.domain)&&e.exit();a;){t=a.fn,a=a.next;try{t()}catch(e){throw a?o():i=void 0,e}}i=void 0,e&&e.enter()},y?o=function(){m.nextTick(r)}:g&&!v?(s=!0,c=document.createTextNode(""),new g(r).observe(c,{characterData:!0}),o=function(){c.data=s=!s}):b&&b.resolve?(h=b.resolve(void 0),u=h.then,o=function(){u.call(h,r)}):o=function(){p.call(l,r)}),e.exports=S||function(e){var t={fn:e,next:void 0};i&&(i.next=t),a||(a=t,o()),i=t}},3366:function(e,t,n){var r=n(7854);e.exports=r.Promise},8523:function(e,t,n){"use strict";var r=n(3099),a=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=r(t),this.reject=r(n)};e.exports.f=function(e){return new a(e)}},2534:function(e){e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},9478:function(e,t,n){var r=n(9670),a=n(111),i=n(8523);e.exports=function(e,t){if(r(e),a(t)&&t.constructor===e)return t;var n=i.f(e);return(0,n.resolve)(t),n.promise}},6340:function(e,t,n){"use strict";var r=n(5005),a=n(3070),i=n(5112),o=n(9781),s=i("species");e.exports=function(e){var t=r(e),n=a.f;o&&t&&!t[s]&&n(t,s,{configurable:!0,get:function(){return this}})}},261:function(e,t,n){var r,a,i,o=n(7854),s=n(7293),c=n(4326),h=n(9974),u=n(490),l=n(317),d=n(6833),f=o.location,p=o.setImmediate,v=o.clearImmediate,g=o.process,m=o.MessageChannel,b=o.Dispatch,y=0,k={},S=function(e){if(k.hasOwnProperty(e)){var t=k[e];delete k[e],t()}},R=function(e){return function(){S(e)}},x=function(e){S(e.data)},M=function(e){o.postMessage(e+"",f.protocol+"//"+f.host)};p&&v||(p=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return k[++y]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},r(y),y},v=function(e){delete k[e]},"process"==c(g)?r=function(e){g.nextTick(R(e))}:b&&b.now?r=function(e){b.now(R(e))}:m&&!d?(i=(a=new m).port2,a.port1.onmessage=x,r=h(i.postMessage,i,1)):!o.addEventListener||"function"!=typeof postMessage||o.importScripts||s(M)||"file:"===f.protocol?r="onreadystatechange"in l("script")?function(e){u.appendChild(l("script")).onreadystatechange=function(){u.removeChild(this),S(e)}}:function(e){setTimeout(R(e),0)}:(r=M,o.addEventListener("message",x,!1))),e.exports={set:p,clear:v}},9554:function(e,t,n){"use strict";var r=n(2109),a=n(8533);r({target:"Array",proto:!0,forced:[].forEach!=a},{forEach:a})},4986:function(e,t,n){var r=n(2109),a=n(6583);r({target:"Array",proto:!0,forced:a!==[].lastIndexOf},{lastIndexOf:a})},5212:function(e,t,n){"use strict";var r=n(2109),a=n(2092).some,i=n(9341),o=n(9207),s=i("some"),c=o("some");r({target:"Array",proto:!0,forced:!s||!c},{some:function(e){return a(this,e,arguments.length>1?arguments[1]:void 0)}})},8674:function(e,t,n){"use strict";var r,a,i,o,s=n(2109),c=n(1913),h=n(7854),u=n(5005),l=n(3366),d=n(1320),f=n(2248),p=n(8003),v=n(6340),g=n(111),m=n(3099),b=n(5787),y=n(4326),k=n(2788),S=n(408),R=n(7072),x=n(6707),M=n(261).set,P=n(5948),w=n(9478),T=n(842),B=n(8523),E=n(2534),C=n(9909),I=n(4705),N=n(5112),_=n(7392),j=N("species"),F="Promise",H=C.get,L=C.set,q=C.getterFor(F),O=l,A=h.TypeError,U=h.document,V=h.process,$=u("fetch"),D=B.f,G=D,z="process"==y(V),Q=!!(U&&U.createEvent&&h.dispatchEvent),W="unhandledrejection",Y=I(F,(function(){if(k(O)===String(O)){if(66===_)return!0;if(!z&&"function"!=typeof PromiseRejectionEvent)return!0}if(c&&!O.prototype.finally)return!0;if(_>=51&&/native code/.test(O))return!1;var e=O.resolve(1),t=function(e){e((function(){}),(function(){}))};return(e.constructor={})[j]=t,!(e.then((function(){}))instanceof t)})),K=Y||!R((function(e){O.all(e).catch((function(){}))})),X=function(e){var t;return!(!g(e)||"function"!=typeof(t=e.then))&&t},J=function(e,t,n){if(!t.notified){t.notified=!0;var r=t.reactions;P((function(){for(var a=t.value,i=1==t.state,o=0;r.length>o;){var s,c,h,u=r[o++],l=i?u.ok:u.fail,d=u.resolve,f=u.reject,p=u.domain;try{l?(i||(2===t.rejection&&ne(e,t),t.rejection=1),!0===l?s=a:(p&&p.enter(),s=l(a),p&&(p.exit(),h=!0)),s===u.promise?f(A("Promise-chain cycle")):(c=X(s))?c.call(s,d,f):d(s)):f(a)}catch(e){p&&!h&&p.exit(),f(e)}}t.reactions=[],t.notified=!1,n&&!t.rejection&&ee(e,t)}))}},Z=function(e,t,n){var r,a;Q?((r=U.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),h.dispatchEvent(r)):r={promise:t,reason:n},(a=h["on"+e])?a(r):e===W&&T("Unhandled promise rejection",n)},ee=function(e,t){M.call(h,(function(){var n,r=t.value;if(te(t)&&(n=E((function(){z?V.emit("unhandledRejection",r,e):Z(W,e,r)})),t.rejection=z||te(t)?2:1,n.error))throw n.value}))},te=function(e){return 1!==e.rejection&&!e.parent},ne=function(e,t){M.call(h,(function(){z?V.emit("rejectionHandled",e):Z("rejectionhandled",e,t.value)}))},re=function(e,t,n,r){return function(a){e(t,n,a,r)}},ae=function(e,t,n,r){t.done||(t.done=!0,r&&(t=r),t.value=n,t.state=2,J(e,t,!0))},ie=function(e,t,n,r){if(!t.done){t.done=!0,r&&(t=r);try{if(e===n)throw A("Promise can't be resolved itself");var a=X(n);a?P((function(){var r={done:!1};try{a.call(n,re(ie,e,r,t),re(ae,e,r,t))}catch(n){ae(e,r,n,t)}})):(t.value=n,t.state=1,J(e,t,!1))}catch(n){ae(e,{done:!1},n,t)}}};Y&&(O=function(e){b(this,O,F),m(e),r.call(this);var t=H(this);try{e(re(ie,this,t),re(ae,this,t))}catch(e){ae(this,t,e)}},(r=function(e){L(this,{type:F,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=f(O.prototype,{then:function(e,t){var n=q(this),r=D(x(this,O));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=z?V.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&J(this,n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),a=function(){var e=new r,t=H(e);this.promise=e,this.resolve=re(ie,e,t),this.reject=re(ae,e,t)},B.f=D=function(e){return e===O||e===i?new a(e):G(e)},c||"function"!=typeof l||(o=l.prototype.then,d(l.prototype,"then",(function(e,t){var n=this;return new O((function(e,t){o.call(n,e,t)})).then(e,t)}),{unsafe:!0}),"function"==typeof $&&s({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return w(O,$.apply(h,arguments))}}))),s({global:!0,wrap:!0,forced:Y},{Promise:O}),p(O,F,!1,!0),v(F),i=u(F),s({target:F,stat:!0,forced:Y},{reject:function(e){var t=D(this);return t.reject.call(void 0,e),t.promise}}),s({target:F,stat:!0,forced:c||Y},{resolve:function(e){return w(c&&this===i?O:this,e)}}),s({target:F,stat:!0,forced:K},{all:function(e){var t=this,n=D(t),r=n.resolve,a=n.reject,i=E((function(){var n=m(t.resolve),i=[],o=0,s=1;S(e,(function(e){var c=o++,h=!1;i.push(void 0),s++,n.call(t,e).then((function(e){h||(h=!0,i[c]=e,--s||r(i))}),a)})),--s||r(i)}));return i.error&&a(i.value),n.promise},race:function(e){var t=this,n=D(t),r=n.reject,a=E((function(){var a=m(t.resolve);S(e,(function(e){a.call(t,e).then(n.resolve,r)}))}));return a.error&&r(a.value),n.promise}})},4603:function(e,t,n){var r=n(9781),a=n(7854),i=n(4705),o=n(9587),s=n(3070).f,c=n(8006).f,h=n(7850),u=n(7066),l=n(2999),d=n(1320),f=n(7293),p=n(9909).set,v=n(6340),g=n(5112)("match"),m=a.RegExp,b=m.prototype,y=/a/g,k=/a/g,S=new m(y)!==y,R=l.UNSUPPORTED_Y;if(r&&i("RegExp",!S||R||f((function(){return k[g]=!1,m(y)!=y||m(k)==k||"/a/i"!=m(y,"i")})))){for(var x=function(e,t){var n,r=this instanceof x,a=h(e),i=void 0===t;if(!r&&a&&e.constructor===x&&i)return e;S?a&&!i&&(e=e.source):e instanceof x&&(i&&(t=u.call(e)),e=e.source),R&&(n=!!t&&t.indexOf("y")>-1)&&(t=t.replace(/y/g,""));var s=o(S?new m(e,t):m(e,t),r?this:b,x);return R&&n&&p(s,{sticky:n}),s},M=function(e){e in x||s(x,e,{configurable:!0,get:function(){return m[e]},set:function(t){m[e]=t}})},P=c(m),w=0;P.length>w;)M(P[w++]);b.constructor=x,x.prototype=b,d(a,"RegExp",x)}v("RegExp")},4747:function(e,t,n){var r=n(7854),a=n(8324),i=n(8533),o=n(8880);for(var s in a){var c=r[s],h=c&&c.prototype;if(h&&h.forEach!==i)try{o(h,"forEach",i)}catch(e){h.forEach=i}}}},0,[[2728,898]]]);
//# sourceMappingURL=plugin.search.js.map

@@ -0,1 +1,4 @@

# 4.23.0
Fix: first search result click now updates url @nsharma123
# 4.22.0

@@ -2,0 +5,0 @@ Fix: update non-asserted page labelling next to nav scrubber @iisa

{
"name": "@internetarchive/bookreader",
"version": "4.22.1-alpha-3",
"version": "4.23.0-alpha-1",
"description": "The Internet Archive BookReader.",

@@ -5,0 +5,0 @@ "repository": {

@@ -36,6 +36,3 @@ /** @typedef {import("../../BookReader.js").default} BookReader */

_viewModeControls() {
if (this.br.options.controls.viewmode.visible) {
return this.controlFor('viewmode');
}
return ['onePage', 'twoPage', 'thumbnail'].map((mode) => (
return ['onePage', 'twoPage', 'thumbnail', 'viewmode'].map((mode) => (
this.controlFor(mode)

@@ -42,0 +39,0 @@ )).join('');

@@ -213,3 +213,3 @@ /** @typedef {import('./BookModel.js').PageNumString} PageNumString */

visible: true,
className: 'onepg',
className: 'onepg hide-mobile',
},

@@ -219,3 +219,3 @@ twoPage: {

visible: true,
className: 'twopg',
className: 'twopg hide-mobile',
},

@@ -225,6 +225,6 @@ thumbnail: {

visible: true,
className: 'thumb',
className: 'thumb hide-mobile',
},
viewmode: {
visible: false,
visible: true,
className: 'viewmode',

@@ -231,0 +231,0 @@ excludedModes: [],

@@ -486,4 +486,2 @@ class SearchView {

this.toggleSearchPending(false);
this.br.trigger('ToggleSearchMenu');
console.log('ToggleSearchMenu')
if (options.goToFirstResult) {

@@ -490,0 +488,0 @@ $(document).one('BookReader:pageChanged', () => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc