@internetarchive/bookreader 5.0.0-8 → 5.0.0-80
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.js +17 -15
- package/.github/workflows/node.js.yml +73 -10
- package/.github/workflows/npm-publish.yml +6 -20
- package/.testcaferc.js +10 -0
- package/BookReader/BookReader.css +398 -1133
- package/BookReader/BookReader.js +1 -1
- package/BookReader/BookReader.js.LICENSE.txt +20 -20
- package/BookReader/BookReader.js.map +1 -1
- package/BookReader/ia-bookreader-bundle.js +1782 -0
- package/BookReader/ia-bookreader-bundle.js.LICENSE.txt +7 -0
- package/BookReader/ia-bookreader-bundle.js.map +1 -0
- package/BookReader/icons/1up.svg +1 -1
- package/BookReader/icons/2up.svg +1 -1
- package/BookReader/icons/advance.svg +1 -1
- package/BookReader/icons/chevron-right.svg +1 -1
- package/BookReader/icons/close-circle-dark.svg +1 -1
- package/BookReader/icons/close-circle.svg +1 -1
- package/BookReader/icons/fullscreen.svg +1 -1
- package/BookReader/icons/fullscreen_exit.svg +1 -1
- package/BookReader/icons/hamburger.svg +1 -1
- package/BookReader/icons/left-arrow.svg +1 -1
- package/BookReader/icons/magnify-minus.svg +1 -1
- package/BookReader/icons/magnify-plus.svg +1 -1
- package/BookReader/icons/magnify.svg +1 -1
- package/BookReader/icons/pause.svg +1 -1
- package/BookReader/icons/play.svg +1 -1
- package/BookReader/icons/playback-speed.svg +1 -1
- package/BookReader/icons/read-aloud.svg +1 -1
- package/BookReader/icons/review.svg +1 -1
- package/BookReader/icons/thumbnails.svg +1 -1
- package/BookReader/icons/voice.svg +1 -0
- package/BookReader/icons/volume-full.svg +1 -1
- package/BookReader/images/BRicons.svg +3 -3
- package/BookReader/images/books_graphic.svg +1 -1
- package/BookReader/images/icon_book.svg +1 -1
- package/BookReader/images/icon_bookmark.svg +1 -1
- package/BookReader/images/icon_gear.svg +1 -1
- package/BookReader/images/icon_hamburger.svg +1 -1
- package/BookReader/images/icon_home.svg +1 -1
- package/BookReader/images/icon_info.svg +1 -1
- package/BookReader/images/icon_one_page.svg +1 -1
- package/BookReader/images/icon_pause.svg +1 -1
- package/BookReader/images/icon_play.svg +1 -1
- package/BookReader/images/icon_playback-rate.svg +1 -1
- package/BookReader/images/icon_search_button.svg +1 -1
- package/BookReader/images/icon_share.svg +1 -1
- package/BookReader/images/icon_skip-ahead.svg +1 -1
- package/BookReader/images/icon_skip-back.svg +1 -1
- package/BookReader/images/icon_speaker.svg +1 -1
- package/BookReader/images/icon_speaker_open.svg +1 -1
- package/BookReader/images/icon_thumbnails.svg +1 -1
- package/BookReader/images/icon_toc.svg +1 -1
- package/BookReader/images/icon_two_pages.svg +1 -1
- package/BookReader/images/marker_chap-off.svg +1 -1
- package/BookReader/images/marker_chap-on.svg +1 -1
- package/BookReader/images/marker_srch-on.svg +1 -1
- package/BookReader/jquery-3.js +2 -0
- package/BookReader/jquery-3.js.LICENSE.txt +24 -0
- package/BookReader/plugins/plugin.archive_analytics.js +1 -1
- package/BookReader/plugins/plugin.archive_analytics.js.map +1 -1
- package/BookReader/plugins/plugin.autoplay.js +1 -1
- package/BookReader/plugins/plugin.autoplay.js.map +1 -1
- package/BookReader/plugins/plugin.chapters.js +25 -1
- package/BookReader/plugins/plugin.chapters.js.LICENSE.txt +1 -0
- package/BookReader/plugins/plugin.chapters.js.map +1 -1
- package/BookReader/plugins/plugin.iframe.js +1 -1
- package/BookReader/plugins/plugin.iframe.js.map +1 -1
- package/BookReader/plugins/plugin.iiif.js +2 -0
- package/BookReader/plugins/plugin.iiif.js.map +1 -0
- package/BookReader/plugins/plugin.resume.js +1 -1
- package/BookReader/plugins/plugin.resume.js.map +1 -1
- package/BookReader/plugins/plugin.search.js +2 -1
- package/BookReader/plugins/plugin.search.js.LICENSE.txt +1 -0
- package/BookReader/plugins/plugin.search.js.map +1 -1
- package/BookReader/plugins/plugin.text_selection.js +2 -1
- package/BookReader/plugins/plugin.text_selection.js.LICENSE.txt +1 -0
- package/BookReader/plugins/plugin.text_selection.js.map +1 -1
- package/BookReader/plugins/plugin.tts.js +1 -1
- package/BookReader/plugins/plugin.tts.js.LICENSE.txt +2 -0
- package/BookReader/plugins/plugin.tts.js.map +1 -1
- package/BookReader/plugins/plugin.url.js +1 -1
- package/BookReader/plugins/plugin.url.js.map +1 -1
- package/BookReader/plugins/plugin.vendor-fullscreen.js +1 -1
- package/BookReader/plugins/plugin.vendor-fullscreen.js.map +1 -1
- package/BookReader/webcomponents-bundle.js +3 -0
- package/BookReader/webcomponents-bundle.js.LICENSE.txt +9 -0
- package/BookReader/webcomponents-bundle.js.map +1 -0
- package/BookReaderDemo/BookReaderDemo.css +18 -19
- package/BookReaderDemo/BookReaderJSAdvanced.js +0 -3
- package/BookReaderDemo/BookReaderJSAutoplay.js +4 -1
- package/BookReaderDemo/BookReaderJSSimple.js +1 -0
- package/BookReaderDemo/IADemoBr.js +147 -0
- package/BookReaderDemo/demo-advanced.html +2 -2
- package/BookReaderDemo/demo-autoplay.html +2 -3
- package/BookReaderDemo/demo-embed-iframe-src.html +2 -1
- package/BookReaderDemo/demo-fullscreen-mobile.html +3 -5
- package/BookReaderDemo/demo-fullscreen.html +2 -4
- package/BookReaderDemo/demo-iiif.html +99 -12
- package/BookReaderDemo/demo-internetarchive.html +214 -18
- package/BookReaderDemo/demo-multiple.html +2 -1
- package/BookReaderDemo/demo-preview-pages.html +2 -1
- package/BookReaderDemo/demo-simple.html +2 -1
- package/BookReaderDemo/demo-vendor-fullscreen.html +2 -4
- package/BookReaderDemo/ia-multiple-volumes-manifest.js +170 -0
- package/BookReaderDemo/immersion-1up.html +2 -2
- package/BookReaderDemo/immersion-mode.html +2 -4
- package/BookReaderDemo/toggle_controls.html +3 -2
- package/BookReaderDemo/view_mode.html +2 -1
- package/BookReaderDemo/viewmode-cycle.html +2 -3
- package/CHANGELOG.md +536 -33
- package/README.md +14 -1
- package/babel.config.js +20 -0
- package/codecov.yml +6 -0
- package/index.html +4 -1
- package/jsconfig.json +19 -0
- package/netlify.toml +9 -0
- package/package.json +70 -60
- package/renovate.json +52 -0
- package/scripts/preversion.js +0 -1
- package/src/BookNavigator/assets/bookmark-colors.js +1 -1
- package/src/BookNavigator/assets/button-base.js +4 -2
- package/src/BookNavigator/assets/ia-logo.js +17 -0
- package/src/BookNavigator/assets/icon_checkmark.js +1 -1
- package/src/BookNavigator/assets/icon_close.js +1 -1
- package/src/BookNavigator/book-navigator.js +590 -0
- package/src/BookNavigator/bookmarks/bookmark-button.js +3 -2
- package/src/BookNavigator/bookmarks/bookmark-edit.js +3 -4
- package/src/BookNavigator/bookmarks/bookmarks-list.js +2 -3
- package/src/BookNavigator/bookmarks/bookmarks-loginCTA.js +3 -8
- package/src/BookNavigator/bookmarks/bookmarks-provider.js +27 -17
- package/src/BookNavigator/bookmarks/ia-bookmarks.js +116 -67
- package/src/BookNavigator/delete-modal-actions.js +1 -1
- package/src/BookNavigator/downloads/downloads-provider.js +36 -21
- package/src/BookNavigator/downloads/downloads.js +41 -25
- package/src/BookNavigator/search/search-provider.js +49 -27
- package/src/BookNavigator/search/search-results.js +23 -9
- package/src/BookNavigator/sharing.js +27 -0
- package/src/BookNavigator/viewable-files.js +95 -0
- package/src/BookNavigator/visual-adjustments/visual-adjustments-provider.js +11 -10
- package/src/BookNavigator/visual-adjustments/visual-adjustments.js +3 -3
- package/src/BookReader/BookModel.js +64 -34
- package/src/BookReader/DragScrollable.js +233 -0
- package/src/BookReader/Mode1Up.js +56 -351
- package/src/BookReader/Mode1UpLit.js +388 -0
- package/src/BookReader/Mode2Up.js +73 -1318
- package/src/BookReader/Mode2UpLit.js +776 -0
- package/src/BookReader/ModeCoordinateSpace.js +29 -0
- package/src/BookReader/ModeSmoothZoom.js +312 -0
- package/src/BookReader/ModeThumb.js +18 -12
- package/src/BookReader/Navbar/Navbar.js +14 -40
- package/src/BookReader/PageContainer.js +81 -6
- package/src/BookReader/ReduceSet.js +1 -1
- package/src/BookReader/Toolbar/Toolbar.js +10 -37
- package/src/BookReader/events.js +2 -3
- package/src/BookReader/options.js +27 -2
- package/src/BookReader/utils/HTMLDimensionsCacher.js +44 -0
- package/src/BookReader/utils/ScrollClassAdder.js +31 -0
- package/src/BookReader/utils/SelectionObserver.js +45 -0
- package/src/BookReader/utils.js +118 -13
- package/src/BookReader.js +427 -1061
- package/src/assets/icons/magnify-minus.svg +3 -7
- package/src/assets/icons/magnify-plus.svg +3 -7
- package/src/assets/icons/voice.svg +1 -0
- package/src/css/BookReader.scss +1 -5
- package/src/css/_BRBookmarks.scss +1 -1
- package/src/css/_BRComponent.scss +1 -1
- package/src/css/_BRmain.scss +16 -3
- package/src/css/_BRnav.scss +12 -39
- package/src/css/_BRpages.scss +149 -40
- package/src/css/_BRsearch.scss +68 -25
- package/src/css/_BRtoolbar.scss +5 -5
- package/src/css/_TextSelection.scss +87 -27
- package/src/css/_colorbox.scss +2 -2
- package/src/css/_controls.scss +20 -7
- package/src/css/_icons.scss +1 -1
- package/src/ia-bookreader/ia-bookreader.js +224 -0
- package/src/plugins/plugin.archive_analytics.js +3 -3
- package/src/plugins/plugin.autoplay.js +5 -11
- package/src/plugins/plugin.chapters.js +237 -191
- package/src/plugins/plugin.iiif.js +151 -0
- package/src/plugins/plugin.resume.js +3 -3
- package/src/plugins/plugin.text_selection.js +464 -134
- package/src/plugins/plugin.vendor-fullscreen.js +4 -4
- package/src/plugins/search/plugin.search.js +142 -125
- package/src/plugins/search/utils.js +43 -0
- package/src/plugins/search/view.js +33 -58
- package/src/plugins/tts/AbstractTTSEngine.js +71 -40
- package/src/plugins/tts/FestivalTTSEngine.js +13 -14
- package/src/plugins/tts/PageChunk.js +15 -21
- package/src/plugins/tts/PageChunkIterator.js +8 -12
- package/src/plugins/tts/WebTTSEngine.js +87 -71
- package/src/plugins/tts/plugin.tts.js +96 -127
- package/src/plugins/tts/utils.js +15 -25
- package/src/plugins/url/UrlPlugin.js +191 -0
- package/src/plugins/{plugin.url.js → url/plugin.url.js} +45 -16
- package/src/util/browserSniffing.js +22 -0
- package/src/util/docCookies.js +21 -2
- package/tests/e2e/README.md +37 -0
- package/tests/e2e/autoplay.test.js +2 -2
- package/tests/e2e/base.test.js +8 -16
- package/tests/e2e/helpers/base.js +53 -48
- package/tests/e2e/helpers/debug.js +1 -1
- package/tests/e2e/helpers/params.js +17 -0
- package/tests/e2e/helpers/rightToLeft.js +8 -14
- package/tests/e2e/helpers/search.js +73 -0
- package/tests/e2e/models/Navigation.js +20 -37
- package/tests/e2e/rightToLeft.test.js +4 -5
- package/tests/e2e/viewmode.test.js +40 -33
- package/tests/jest/BookNavigator/book-navigator.test.js +661 -0
- package/tests/jest/BookNavigator/bookmarks/bookmark-button.test.js +43 -0
- package/tests/{karma → jest}/BookNavigator/bookmarks/bookmark-edit.test.js +25 -26
- package/tests/{karma → jest}/BookNavigator/bookmarks/bookmarks-list.test.js +41 -42
- package/tests/jest/BookNavigator/bookmarks/ia-bookmarks.test.js +45 -0
- package/tests/jest/BookNavigator/downloads/downloads-provider.test.js +67 -0
- package/tests/jest/BookNavigator/downloads/downloads.test.js +53 -0
- package/tests/jest/BookNavigator/search/search-provider.test.js +167 -0
- package/tests/{karma → jest}/BookNavigator/search/search-results.test.js +109 -60
- package/tests/jest/BookNavigator/sharing/sharing-provider.test.js +49 -0
- package/tests/jest/BookNavigator/viewable-files/viewable-files-provider.test.js +80 -0
- package/tests/jest/BookNavigator/visual-adjustments.test.js +200 -0
- package/tests/{BookReader → jest/BookReader}/BookModel.test.js +74 -14
- package/tests/jest/BookReader/BookReaderPublicFunctions.test.js +193 -0
- package/tests/{BookReader → jest/BookReader}/ImageCache.test.js +4 -4
- package/tests/jest/BookReader/Mode1UpLit.test.js +73 -0
- package/tests/jest/BookReader/Mode2Up.test.js +98 -0
- package/tests/jest/BookReader/Mode2UpLit.test.js +190 -0
- package/tests/jest/BookReader/ModeCoordinateSpace.test.js +16 -0
- package/tests/jest/BookReader/ModeSmoothZoom.test.js +218 -0
- package/tests/jest/BookReader/ModeThumb.test.js +71 -0
- package/tests/{BookReader → jest/BookReader}/Navbar/Navbar.test.js +10 -10
- package/tests/{BookReader → jest/BookReader}/PageContainer.test.js +88 -6
- package/tests/{BookReader → jest/BookReader}/ReduceSet.test.js +1 -1
- package/tests/{BookReader → jest/BookReader}/Toolbar/Toolbar.test.js +2 -2
- package/tests/jest/BookReader/utils/HTMLDimensionsCacher.test.js +59 -0
- package/tests/jest/BookReader/utils/ScrollClassAdder.test.js +49 -0
- package/tests/jest/BookReader/utils/SelectionObserver.test.js +57 -0
- package/tests/{BookReader → jest/BookReader}/utils/classes.test.js +1 -1
- package/tests/jest/BookReader/utils.test.js +229 -0
- package/tests/jest/BookReader.keyboard.test.js +190 -0
- package/tests/{BookReader.options.test.js → jest/BookReader.options.test.js} +9 -1
- package/tests/{BookReader.test.js → jest/BookReader.test.js} +26 -37
- package/tests/{plugins → jest/plugins}/plugin.archive_analytics.test.js +2 -2
- package/tests/{plugins → jest/plugins}/plugin.autoplay.test.js +4 -4
- package/tests/jest/plugins/plugin.chapters.test.js +195 -0
- package/tests/{plugins → jest/plugins}/plugin.iframe.test.js +2 -2
- package/tests/{plugins → jest/plugins}/plugin.resume.test.js +3 -3
- package/tests/jest/plugins/plugin.text_selection.test.js +317 -0
- package/tests/{plugins → jest/plugins}/plugin.vendor-fullscreen.test.js +2 -2
- package/tests/{plugins → jest/plugins}/search/plugin.search.test.js +25 -47
- package/tests/{plugins → jest/plugins}/search/plugin.search.view.test.js +39 -6
- package/tests/jest/plugins/search/utils.js +25 -0
- package/tests/jest/plugins/search/utils.test.js +29 -0
- package/tests/{plugins → jest/plugins}/tts/AbstractTTSEngine.test.js +29 -9
- package/tests/{plugins → jest/plugins}/tts/FestivalTTSEngine.test.js +4 -4
- package/tests/{plugins → jest/plugins}/tts/PageChunk.test.js +1 -1
- package/tests/{plugins → jest/plugins}/tts/PageChunkIterator.test.js +3 -3
- package/tests/{plugins → jest/plugins}/tts/WebTTSEngine.test.js +47 -1
- package/tests/{plugins → jest/plugins}/tts/utils.test.js +1 -60
- package/tests/jest/plugins/url/UrlPlugin.test.js +198 -0
- package/tests/{plugins → jest/plugins/url}/plugin.url.test.js +53 -14
- package/tests/jest/setup.js +3 -0
- package/tests/{util → jest/util}/browserSniffing.test.js +1 -1
- package/tests/jest/util/docCookies.test.js +24 -0
- package/tests/{util → jest/util}/strings.test.js +1 -1
- package/tests/{utils.js → jest/utils.js} +38 -0
- package/webpack.config.js +12 -6
- package/.babelrc +0 -12
- package/.dependabot/config.yml +0 -6
- package/.testcaferc.json +0 -5
- package/BookReader/bookreader-component-bundle.js +0 -1450
- package/BookReader/bookreader-component-bundle.js.LICENSE.txt +0 -38
- package/BookReader/bookreader-component-bundle.js.map +0 -1
- package/BookReader/jquery-1.10.1.js +0 -2
- package/BookReader/jquery-1.10.1.js.LICENSE.txt +0 -24
- package/BookReader/plugins/plugin.menu_toggle.js +0 -2
- package/BookReader/plugins/plugin.menu_toggle.js.map +0 -1
- package/BookReader/plugins/plugin.mobile_nav.js +0 -2
- package/BookReader/plugins/plugin.mobile_nav.js.map +0 -1
- package/BookReaderDemo/IIIFBookReader.js +0 -207
- package/BookReaderDemo/bookreader-template-bundle.js +0 -7178
- package/BookReaderDemo/demo-iiif.js +0 -26
- package/BookReaderDemo/demo-plugin-menu-toggle.html +0 -34
- package/karma.conf.js +0 -23
- package/src/BookNavigator/BookModel.js +0 -14
- package/src/BookNavigator/BookNavigator.js +0 -446
- package/src/BookNavigator/assets/book-loader.js +0 -27
- package/src/BookNavigator/br-fullscreen-mgr.js +0 -83
- package/src/BookNavigator/search/a-search-result.js +0 -55
- package/src/BookReader/DebugConsole.js +0 -54
- package/src/BookReaderComponent/BookReaderComponent.js +0 -112
- package/src/ItemNavigator/ItemNavigator.js +0 -376
- package/src/ItemNavigator/providers/sharing.js +0 -29
- package/src/css/_MobileNav.scss +0 -194
- package/src/dragscrollable-br.js +0 -261
- package/src/lit-wrapper.js +0 -2
- package/src/plugins/menu_toggle/plugin.menu_toggle.js +0 -324
- package/src/plugins/plugin.mobile_nav.js +0 -287
- package/tests/BookReader/BookReaderPublicFunctions.test.js +0 -171
- package/tests/BookReader/DebugConsole.test.js +0 -25
- package/tests/BookReader/Mode1Up.test.js +0 -164
- package/tests/BookReader/Mode2Up.test.js +0 -247
- package/tests/BookReader/utils.test.js +0 -109
- package/tests/e2e/helpers/desktopSearch.js +0 -72
- package/tests/e2e/helpers/mobileSearch.js +0 -85
- package/tests/e2e/ia-production/ia-prod-base.js +0 -17
- package/tests/karma/BookNavigator/book-navigator.test.js +0 -132
- package/tests/karma/BookNavigator/search/search-provider.test.js +0 -23
- package/tests/karma/BookNavigator/visual-adjustments.test.js +0 -201
- package/tests/plugins/menu_toggle/plugin.menu_toggle.test.js +0 -68
- package/tests/plugins/plugin.chapters.test.js +0 -130
- package/tests/plugins/plugin.mobile_nav.test.js +0 -66
- package/tests/plugins/plugin.text_selection.test.js +0 -203
- package/tests/util/docCookies.test.js +0 -15
@@ -1,2 +1,26 @@
|
|
1
|
-
|
1
|
+
/*! For license information please see plugin.chapters.js.LICENSE.txt */
|
2
|
+
"use strict";(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[529],{4775:function(e,t,r){r(9749),r(6544),r(4254),r(752),r(1694),r(6265),r(8373),r(6793),r(7629),r(7509),r(8052),r(4284),r(9730),r(1830),r(7049),r(2826),r(4043),r(2349),r(1919),r(9373),r(9903),r(9288),r(2506),r(5728),r(50),r(886),r(429),r(228),r(7522),r(6203),r(8077),r(2320),r(4338),r(3374),r(9772),r(3964);var n=r(8318),o=r(9089),i=r(4817),a=r(1312),c=n.dy`
|
3
|
+
<svg
|
4
|
+
viewBox="0 0 24 24"
|
5
|
+
xmlns="http://www.w3.org/2000/svg"
|
6
|
+
aria-labelledby="tocTitleID tocDescID"
|
7
|
+
>
|
8
|
+
<title id="tocTitleID">Table of contents icon</title>
|
9
|
+
<desc id="tocDescID">An illustration of three text list items</desc>
|
10
|
+
<g class="fill-color" fill-rule="evenodd"><rect height="3" rx="1.5" width="18" x="6"/><rect height="3" rx="1.5" width="18" x="6" y="21"/><rect height="3" rx="1.5" width="18" x="6" y="14"/><rect height="3" rx="1.5" width="18" x="6" y="7"/><rect height="3" rx="1.5" width="4"/><rect height="3" rx="1.5" width="4" y="21"/><rect height="3" rx="1.5" width="4" y="14"/><rect height="3" rx="1.5" width="4" y="7"/></g>
|
11
|
+
</svg>
|
12
|
+
`;class s extends n.oi{static get styles(){return n.iv`
|
13
|
+
:host {
|
14
|
+
width: var(--iconWidth, 'auto');
|
15
|
+
height: var(--iconHeight, 'auto');
|
16
|
+
}
|
17
|
+
|
18
|
+
.fill-color {
|
19
|
+
fill: var(--iconFillColor);
|
20
|
+
}
|
21
|
+
|
22
|
+
.stroke-color {
|
23
|
+
stroke: var(--iconStrokeColor);
|
24
|
+
}
|
25
|
+
`}render(){return c}}customElements.define("ia-icon-toc",s);var l,u,f,p,h,d,y,v=r(5311),m=r(5311);function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}function w(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function k(){k=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(n){t.forEach((function(t){var o=t.placement;if(t.kind===n&&("static"===o||"prototype"===o)){var i="static"===o?e:r;this.defineClassElement(i,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var n=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===n?void 0:n.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],n=[],o={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,o)}),this),e.forEach((function(e){if(!P(e))return r.push(e);var t=this.decorateElement(e,o);r.push(t.element),r.push.apply(r,t.extras),n.push.apply(n,t.finishers)}),this),!t)return{elements:r,finishers:n};var i=this.decorateConstructor(r,t);return n.push.apply(n,i.finishers),i.finishers=n,i},addElementPlacement:function(e,t,r){var n=t[e.placement];if(!r&&-1!==n.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");n.push(e.key)},decorateElement:function(e,t){for(var r=[],n=[],o=e.decorators,i=o.length-1;i>=0;i--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var c=this.fromElementDescriptor(e),s=this.toElementFinisherExtras((0,o[i])(c)||c);e=s.element,this.addElementPlacement(e,t),s.finisher&&n.push(s.finisher);var l=s.extras;if(l){for(var u=0;u<l.length;u++)this.addElementPlacement(l[u],t);r.push.apply(r,l)}}return{element:e,finishers:n,extras:r}},decorateConstructor:function(e,t){for(var r=[],n=t.length-1;n>=0;n--){var o=this.fromClassDescriptor(e),i=this.toClassDescriptor((0,t[n])(o)||o);if(void 0!==i.finisher&&r.push(i.finisher),void 0!==i.elements){e=i.elements;for(var a=0;a<e.length-1;a++)for(var c=a+1;c<e.length;c++)if(e[a].key===e[c].key&&e[a].placement===e[c].placement)throw new TypeError("Duplicated element ("+e[a].key+")")}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t},toElementDescriptors:function(e){var t;if(void 0!==e)return(t=e,function(e){if(Array.isArray(e))return e}(t)||I(t)||R(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this)},toElementDescriptor:function(e){var t=String(e.kind);if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var r=O(e.key),n=String(e.placement);if("static"!==n&&"prototype"!==n&&"own"!==n)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+n+'"');var o=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var i={kind:t,key:r,placement:n,descriptor:Object.assign({},o)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(o,"get","The property descriptor of a field descriptor"),this.disallowProperty(o,"set","The property descriptor of a field descriptor"),this.disallowProperty(o,"value","The property descriptor of a field descriptor"),i.initializer=e.initializer),i},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:_(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t},toClassDescriptor:function(e){var t=String(e.kind);if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');this.disallowProperty(e,"key","A class descriptor"),this.disallowProperty(e,"placement","A class descriptor"),this.disallowProperty(e,"descriptor","A class descriptor"),this.disallowProperty(e,"initializer","A class descriptor"),this.disallowProperty(e,"extras","A class descriptor");var r=_(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var n=(0,t[r])(e);if(void 0!==n){if("function"!=typeof n)throw new TypeError("Finishers must return a constructor.");e=n}}return e},disallowProperty:function(e,t,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}};return e}function x(e){var t,r=O(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var n={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(n.decorators=e.decorators),"field"===e.kind&&(n.initializer=e.value),n}function E(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function P(e){return e.decorators&&e.decorators.length}function C(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function _(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}function O(e){var t=function(e,t){if("object"!==g(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==g(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===g(t)?t:String(t)}function j(){return j="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=T(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},j.apply(this,arguments)}function T(e){return T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},T(e)}function R(e,t){if(e){if("string"==typeof e)return L(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?L(e,t):void 0}}function I(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function L(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function S(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function D(){D=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),c=new I(n||[]);return o(a,"_invoke",{value:O(e,r,c)}),a}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function b(){}function w(){}var k={};l(k,a,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(L([])));E&&E!==r&&n.call(E,a)&&(k=E);var P=w.prototype=m.prototype=Object.create(k);function C(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function r(o,i,a,c){var s=f(e[o],e,i);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==g(u)&&n.call(u,"__await")?t.resolve(u.__await).then((function(e){r("next",e,a,c)}),(function(e){r("throw",e,a,c)})):t.resolve(u).then((function(e){l.value=e,a(l)}),(function(e){return r("throw",e,a,c)}))}c(s.arg)}var i;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return i=i?i.then(o,o):o()}})}function O(t,r,n){var o=p;return function(i,a){if(o===d)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var s=j(c,n);if(s){if(s===v)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var l=f(t,r,n);if("normal"===l.type){if(o=n.done?y:h,l.arg===v)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=y,n.method="throw",n.arg=l.arg)}}}function j(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,j(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function L(t){if(t||""===t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(g(t)+" is not iterable")}return b.prototype=w,o(P,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:b,configurable:!0}),b.displayName=l(w,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,l(e,s,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},C(_.prototype),l(_.prototype,c,(function(){return this})),t.AsyncIterator=_,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new _(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},C(P),l(P,s,"Generator"),l(P,a,(function(){return this})),l(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(R),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),R(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;R(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:L(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}function B(e,t,r,n,o,i,a){try{var c=e[i](a),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function A(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){B(i,n,o,a,c,"next",e)}function c(e){B(i,n,o,a,c,"throw",e)}a(void 0)}))}}v.extend(BookReader.defaultOptions,{olHost:"https://openlibrary.org",enableChaptersPlugin:!0,bookId:""}),BookReader.prototype.init=(y=BookReader.prototype.init,function(){y.call(this),this.options.enableChaptersPlugin&&"embed"!==this.ui&&this._chapterInit()}),BookReader.prototype._chapterInit=A(D().mark((function e(){var t,r,n,o,i=this;return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=null,null===(t=this.options.table_of_contents)||void 0===t||!t.length){e.next=5;break}r=this.options.table_of_contents,e.next=9;break;case 5:return e.next=7,this.getOpenLibraryRecord(this.options.olHost,this.options.bookId);case 7:null!=(o=e.sent)&&null!==(n=o.table_of_contents)&&void 0!==n&&n.length&&(r=o.table_of_contents);case 9:r&&(this._tocEntries=r.map((function(e){return Object.assign({},e,{pageIndex:"number"==typeof e.leaf?i.book.leafNumToIndex(e.leaf):e.pagenum?i.book.getPageIndex(e.pagenum):void 0})})),this._chaptersRender(this._tocEntries),this.bind(BookReader.eventNames.pageChanged,(function(){return i._chaptersUpdateCurrent()})));case 10:case"end":return e.stop()}}),e,this)}))),BookReader.prototype._chaptersRender=function(){var e=this,t=this.shell;t.menuProviders.chapters={id:"chapters",icon:(0,n.dy)(l||(l=S(['<ia-icon-toc style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon-toc>']))),label:"Table of Contents",component:(0,n.dy)(u||(u=S(['<br-chapters-panel\n .contents="','"\n .jumpToPage="','"\n @connected="','"\n />'])),this._tocEntries,(function(t){e._chaptersUpdateCurrent(t),e.jumpToIndex(t)}),(function(t){e._chaptersPanel=t.target,e._chaptersUpdateCurrent()}))},t.addMenuShortcut("chapters"),t.updateMenuContents(),this._tocEntries.forEach((function(t,r){return e._chaptersRenderMarker(t,r)}))},BookReader.prototype._chaptersRenderMarker=function(e,t){var r=this;if(null!=e.pageIndex){var n=[e.label,e.title].filter((function(e){return e})).join(" ")||"Chapter ".concat(t+1),o=BookReader.util.cssPercentage(e.pageIndex,this.book.getNumLeafs()-1);m("<div></div>").append(m("<div />").text(n).append(m('<div class="BRchapterPage" />').text(this.book.getPageName(e.pageIndex)))).addClass("BRchapter").css({left:o}).appendTo(this.$(".BRnavline")).on("mouseenter",(function(e){var t=e.currentTarget,n=t.querySelector("div"),o=n.getBoundingClientRect(),i=t.getBoundingClientRect(),a=2*parseInt(getComputedStyle(n).paddingLeft);o.x-a<0&&n.style.setProperty("transform","translateX(-".concat(i.left-a,"px)")),r.$(".BRsearch,.BRchapter").removeClass("front"),m(e.target).addClass("front")})).on("mouseleave",(function(e){return m(e.target).removeClass("front")})).on("click",(function(){r._chaptersUpdateCurrent(e.pageIndex),r.jumpToIndex(e.pageIndex)})),this.$(".BRchapter, .BRsearch").each((function(e,t){var r=m(t);r.on("mouseenter",(function(){return r.addClass("front")})).on("mouseleave",(function(){return r.removeClass("front")}))}))}},BookReader.prototype.getOpenLibraryRecord=function(){var e=A(D().mark((function e(t,r){var n,o,i,a;return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o="".concat(t,"/query.json?type=/type/edition&*="),i="".concat(o,"&ocaid=").concat(r),e.next=4,m.ajax({url:i,dataType:"jsonp"});case 4:if((a=e.sent)&&a.length){e.next=9;break}return e.next=8,m.ajax({url:"".concat(o,"&source_records=ia:").concat(r),dataType:"jsonp"});case 8:a=e.sent;case 9:return e.abrupt("return",null===(n=a)||void 0===n?void 0:n[0]);case 10:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),BookReader.prototype._chaptersUpdateCurrent=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2==this.mode?Math.max.apply(Math,function(e){if(Array.isArray(e))return L(e)}(e=this.displayedIndices)||I(e)||R(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()):this.firstIndex,r=this._tocEntries.filter((function(e){return null!=e.pageIndex})).reverse(),n=r[r.findIndex((function(e){return e.pageIndex<=t}))];this._chaptersPanel&&(this._chaptersPanel.currentChapter=n)},function(e,t,r,n){var o=k(),i=t((function(e){o.initializeInstanceElements(e,a.elements)}),r),a=o.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===i.key&&e.placement===i.placement},n=0;n<e.length;n++){var o,i=e[n];if("method"===i.kind&&(o=t.find(r)))if(C(i.descriptor)||C(o.descriptor)){if(P(i)||P(o))throw new ReferenceError("Duplicated methods ("+i.key+") can't be decorated.");o.descriptor=i.descriptor}else{if(P(i)){if(P(o))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+i.key+").");o.decorators=i.decorators}E(i,o)}else t.push(i)}return t}(i.d.map(x)),e);o.initializeClassElements(i.F,a.elements),o.runClassFinishers(i.F,a.finishers)}([(0,o.Mo)("br-chapters-panel")],(function(e,t){var r=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)}(a,t);var r,n,o,i=(n=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=T(n);if(o){var r=T(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===g(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return w(e)}(this,e)});function a(t){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),r=i.call(this),e(w(r)),r.contents=t,r}return r=a,Object.defineProperty(r,"prototype",{writable:!1}),r}(t);return{F:r,d:[{kind:"field",decorators:[(0,o.Cb)({type:Array})],key:"contents",value:function(){return[]}},{kind:"field",decorators:[(0,o.Cb)({type:Object})],key:"currentChapter",value:function(){return{}}},{kind:"field",key:"jumpToPage",value:function(){return function(){}}},{kind:"method",key:"render",value:function(){var e=this;return(0,n.dy)(f||(f=S(["\n <ol>\n ","\n </ol>\n "])),this.contents.map((function(t){return e.renderTOCEntry(t)})))}},{kind:"method",key:"renderTOCEntry",value:function(e){var t,r=this,o=[e.label,e.title].filter((function(e){return e})).join(" "),c=null!=e.pageIndex;return(0,n.dy)(p||(p=S(['\n <li\n class="\n BRtable-contents-el\n ',"\n ",'\n "\n style="','"\n data-event-click-tracking="','"\n @click="','"\n >\n ',"\n ","\n </li>"])),c?"clickable":"",e==this.currentChapter?"current":"",(0,a.V)({marginLeft:10*(e.level-1)+"px"}),null!=(t=c?"BRTOCPanel|GoToChapter":void 0)?t:i.Ld,(function(){return r.jumpToPage(e.pageIndex)}),o,e.pagenum?(0,n.dy)(h||(h=S(['\n <br />\n <span class="BRTOCElementPage">Page ',"</span>\n "])),e.pagenum):n.Ld)}},{kind:"method",key:"connectedCallback",value:function(){j(T(r.prototype),"connectedCallback",this).call(this),this.dispatchEvent(new CustomEvent("connected"))}},{kind:"method",key:"updated",value:function(e){var t;e.has("currentChapter")&&(null===(t=this.shadowRoot.querySelector("li.current"))||void 0===t||t.scrollIntoView({block:"nearest",behavior:"smooth"}))}},{kind:"get",static:!0,key:"styles",value:function(){return(0,n.iv)(d||(d=S(["\n ol {\n padding: 0;\n margin: 0;\n margin-right: 5px;\n }\n li {\n padding: 10px;\n overflow: hidden;\n border-radius: 4px;\n }\n li.clickable {\n font-weight: normal;\n cursor: pointer;\n transition: background-color 0.2s;\n }\n\n li.clickable:not(.current):hover {\n background-color: rgba(255,255,255, 0.05);\n }\n\n li.current {\n background-color: rgba(255,255,255,0.9);\n color: #333;\n }\n\n .BRTOCElementPage {\n font-size: 0.85em;\n opacity: .8;\n }"])))}}]}}),n.oi)}},function(e){e(e.s=4775)}]);
|
2
26
|
//# sourceMappingURL=plugin.chapters.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["webpack://@internetarchive/bookreader/./src/plugins/plugin.chapters.js"],"names":["super_","jQuery","extend","BookReader","defaultOptions","olHost","enableChaptersPlugin","bookId","prototype","setup","options","call","this","init","ui","getOpenLibraryRecord","enableMobileNav","bind","eventNames","mobileNavOpen","updateTOCState","firstIndex","_tocEntries","$","parent","hasClass","click","addChapter","chapterTitle","pageNumber","pageIndex","percentThrough","util","cssPercentage","getNumLeafs","jumpToChapter","event","jumpToIndex","delegateTarget","data","removeClass","addClass","title","pageStr","mobileChapter","append","text","appendTo","undefined","css","left","hover","marker","currentTarget","tooltip","querySelector","tooltipOffset","getBoundingClientRect","targetOffset","boxSizeAdjust","parseInt","getComputedStyle","paddingLeft","x","style","setProperty","target","on","attr","removeChapters","remove","updateTOC","tocEntries","length","show","i","addChapterFromEntry","children","each","el","mobileHTML","tocEntryObject","getPageIndex","chapterStr","label","filter","join","$el","baseURL","fetchUrlByBookId","ajax","url","dataType","then","olObject","table_of_contents","buildMobileDrawerElement","find","after","imagesBaseURL","hide","currIndex","tocEntriesIndexed","reverse","currChapter","findIndex"],"mappings":"2LAawCA,E,oBAPxCC,EAAOC,OAAOC,WAAWC,eAAgB,CACvCC,OAAQ,0BACRC,sBAAsB,EACtBC,OAAQ,KAIVJ,WAAWK,UAAUC,OAAmBT,EAQrCG,WAAWK,UAAUC,MAPf,SAAUC,GACfV,EAAOW,KAAKC,KAAMF,GAElBE,KAAKP,OAASK,EAAQL,OACtBO,KAAKN,qBAAuBI,EAAQJ,qBACpCM,KAAKL,OAASG,EAAQH,SAK1BJ,WAAWK,UAAUK,KAAQ,SAASb,GACpC,OAAO,WAAW,WAChBA,EAAOW,KAAKC,MACRA,KAAKN,sBAAoC,UAAZM,KAAKE,IACpCF,KAAKG,uBAEHH,KAAKI,kBACPJ,KAAKK,KAAKd,WAAWe,WAAWC,eAC9B,WACE,EAAKC,eAAe,EAAKC,WAAY,EAAKC,aACtCC,EAAE,uBAAuBC,SAASC,SAAS,cAC7C,EAAKL,eAAe,EAAKC,WAAY,EAAKC,gBAIhDC,EAAE,gCAAgCG,OAChC,WACE,EAAKN,eAAe,EAAKC,WAAY,EAAKC,kBAjBvB,CAsB1BnB,WAAWK,UAAUK,MASxBV,WAAWK,UAAUmB,WAAa,SAASC,EAAcC,EAAYC,GAAW,WAExEC,EAAiB5B,WAAW6B,KAAKC,cAAcH,EAAWlB,KAAKsB,cAAgB,GAC/EC,EAAgB,SAACC,GACrB,EAAKC,YAAYd,EAAEa,EAAME,gBAAgBC,KAAK,cAC9ChB,EAAE,oBAAoBiB,YAAY,mBAClCjB,EAAEa,EAAME,gBAAgBG,SAAS,oBAE7BC,EAAQ,GAAH,OAAMd,EAAN,OACLe,EAAU,GAAH,OARQ,OAQR,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AY,mBAClC,IAAM8D,EAAoB9B,EAAWa,QAAO,SAACN,GAAD,OAAwB/B,MAAhB+B,EAAGjD,aAAwByE,UACzEC,EAAcF,EAAkBA,EAAkBG,WACtD,SAAC1B,GAAD,OAAQA,EAAGjD,WAAauE,MACPrD,MAAfwD,GACFjF,EAAEiF,EAAYxB,YAAYvC,SAAS,uB","file":"plugins/plugin.chapters.js","sourcesContent":["/* global BookReader */\n/**\n * Plugin for chapter markers in BookReader. Fetches from openlibrary.org\n * Could be forked, or extended to alter behavior\n */\n\njQuery.extend(BookReader.defaultOptions, {\n olHost: 'https://openlibrary.org',\n enableChaptersPlugin: true,\n bookId: '',\n});\n\n/** @override Extend the constructor to add search properties */\nBookReader.prototype.setup = (function (super_) {\n return function (options) {\n super_.call(this, options);\n\n this.olHost = options.olHost;\n this.enableChaptersPlugin = options.enableChaptersPlugin;\n this.bookId = options.bookId;\n };\n})(BookReader.prototype.setup);\n\n/** @override Extend to call Open Library for TOC */\nBookReader.prototype.init = (function(super_) {\n return function() {\n super_.call(this);\n if (this.enableChaptersPlugin && this.ui !== 'embed') {\n this.getOpenLibraryRecord();\n }\n if (this.enableMobileNav) {\n this.bind(BookReader.eventNames.mobileNavOpen,\n () => {\n this.updateTOCState(this.firstIndex, this._tocEntries);\n if ($('table-contents-list').parent().hasClass('mm-opened')) {\n this.updateTOCState(this.firstIndex, this._tocEntries);\n }\n }\n )\n $(\".BRmobileMenu__tableContents\").click(\n () => {\n this.updateTOCState(this.firstIndex, this._tocEntries);\n }\n );\n }\n }\n})(BookReader.prototype.init);\n\n/**\n * Adds chapter marker to navigation scrubber\n *\n * @param {string} chapterTitle\n * @param {string} pageNumber\n * @param {number} pageIndex\n */\nBookReader.prototype.addChapter = function(chapterTitle, pageNumber, pageIndex) {\n const uiStringPage = 'Page'; // i18n\n const percentThrough = BookReader.util.cssPercentage(pageIndex, this.getNumLeafs() - 1);\n const jumpToChapter = (event) => {\n this.jumpToIndex($(event.delegateTarget).data('pageIndex'));\n $('.current-chapter').removeClass('current-chapter');\n $(event.delegateTarget).addClass('current-chapter');\n }\n const title = `${chapterTitle} | `;\n const pageStr = `${uiStringPage} ${pageNumber}`;\n\n //adding items to mobile table of contents\n const mobileChapter = $(`<li></li>`).append($(`<span class='BRTOCElementTitle'></span>`).text(title))\n .append($(`<span class='BRTOCElementPage'></span>`).text(pageStr));\n mobileChapter.addClass('BRtable-contents-el')\n .appendTo(this.$('.table-contents-list'))\n .data({ pageIndex });\n\n //adds .BRchapters to the slider only if pageIndex exists\n if (pageIndex != undefined) {\n $(`<div></div>`)\n .append($('<div />').text(title + pageStr))\n .addClass('BRchapter')\n .css({ left: percentThrough })\n .appendTo(this.$('.BRnavline'))\n .data({ pageIndex })\n .hover(event => {\n // remove hover effect from other markers then turn on just for this\n const marker = event.currentTarget;\n const tooltip = marker.querySelector('div');\n const tooltipOffset = tooltip.getBoundingClientRect();\n const targetOffset = marker.getBoundingClientRect();\n const boxSizeAdjust = parseInt(getComputedStyle(tooltip).paddingLeft) * 2;\n if (tooltipOffset.x - boxSizeAdjust < 0) {\n tooltip.style.setProperty('transform', `translateX(-${targetOffset.left - boxSizeAdjust}px)`);\n }\n this.$('.BRsearch,.BRchapter').removeClass('front');\n $(event.target).addClass('front');\n },\n event => $(event.target).removeClass('front')\n )\n .on('click', jumpToChapter);\n\n //adding clickable properties to mobile chapters\n mobileChapter.bind('click', jumpToChapter)\n .addClass('chapter-clickable')\n .attr(\"data-event-click-tracking\",\"BRTOCPanel|GoToChapter\");\n }\n\n};\n\n/*\n * Remove all chapters.\n */\nBookReader.prototype.removeChapters = function() {\n this.$('.BRnavpos .BRchapter').remove();\n};\n\n/**\n * Update the table of contents based on array of TOC entries.\n * @param {TocEntry[]} tocEntries\n */\nBookReader.prototype.updateTOC = function(tocEntries) {\n this.removeChapters();\n if (this.enableMobileNav && tocEntries.length > 0) {\n this.$(\".BRmobileMenu__tableContents\").show();\n }\n for (let i = 0; i < tocEntries.length; i++) {\n this.addChapterFromEntry(tocEntries[i]);\n }\n this._tocEntries = tocEntries;\n $('.table-contents-list').children().each((i, el) => {\n tocEntries[i].mobileHTML = el;\n })\n};\n\n/**\n * @typedef {Object} TocEntry\n * Table of contents entry as defined -- format is defined by Open Library\n * @property {string} pagenum\n * @property {number} level\n * @property {string} label\n * @property {{type: '/type/toc_item'}} type\n * @property {string} title\n * @property {HTMLElement} mobileHTML\n * @property {number} pageIndex\n\n *\n * @example {\n * \"pagenum\": \"17\",\n * \"level\": 1,\n * \"label\": \"CHAPTER I\",\n * \"type\": {\"key\": \"/type/toc_item\"},\n * \"title\": \"THE COUNTRY AND THE MISSION\"\n * }\n */\n\n/**\n * @param {TocEntry} tocEntryObject\n */\nBookReader.prototype.addChapterFromEntry = function(tocEntryObject) {\n tocEntryObject.pageIndex = this.getPageIndex(tocEntryObject['pagenum']);\n //creates a string with non-void tocEntryObject.label and tocEntryObject.title\n const chapterStr = [tocEntryObject.label, tocEntryObject.title]\n .filter(x => x)\n .join(' ');\n this.addChapter(chapterStr, tocEntryObject['pagenum'], tocEntryObject.pageIndex);\n this.$('.BRchapter, .BRsearch').each((i, el) => {\n const $el = $(el);\n $el.hover(\n () => $el.addClass('front'),\n () => $el.removeClass('front'));\n });\n};\n\n/**\n * getOpenLibraryRecord\n *\n * The bookreader is designed to call openlibrary API and constructs the\n * \"Return book\" button using the response.\n *\n * This makes a call to OL API and calls the given callback function with the\n * response from the API.\n */\nBookReader.prototype.getOpenLibraryRecord = function () {\n // Try looking up by ocaid first, then by source_record\n const baseURL = `${this.olHost}/query.json?type=/type/edition&*=`;\n const fetchUrlByBookId = `${baseURL}&ocaid=${this.bookId}`;\n\n /*\n * Update Chapter markers based on received record from Open Library.\n * Notes that Open Library record is used for extra metadata, and also for lending\n */\n const setUpChapterMarkers = (olObject) => {\n if (olObject && olObject.table_of_contents) {\n // XXX check here that TOC is valid\n this.updateTOC(olObject.table_of_contents);\n }\n };\n\n $.ajax({ url: fetchUrlByBookId, dataType: 'jsonp' })\n .then(data => {\n if (data && data.length > 0) {\n return data;\n } else {\n // try sourceid\n return $.ajax({ url: `${baseURL}&source_records=ia:${this.bookId}`, dataType: 'jsonp' });\n }\n })\n .then(data => {\n if (data && data.length > 0) {\n setUpChapterMarkers(data[0]);\n }\n });\n}\n\n// Extend buildMobileDrawerElement with table of contents list\nBookReader.prototype.buildMobileDrawerElement = (function (super_) {\n return function () {\n const $el = super_.call(this);\n if (this.enableMobileNav && this.options.enableChaptersPlugin) {\n $el.find('.BRmobileMenu__moreInfoRow').after($(`\n <li class=\"BRmobileMenu__tableContents\" data-event-click-tracking=\"BRSidebar|TOCPanel\">\n <span>\n <span class=\"DrawerIconWrapper\">\n <img class=\"DrawerIcon\" src=\"${this.imagesBaseURL}icon_toc.svg\" alt=\"toc-icon\"/>\n </span>\n Table of Contents\n </span>\n <div>\n <ol class=\"table-contents-list\">\n </ol>\n </div>\n </li>`).hide());\n }\n return $el;\n };\n})(BookReader.prototype.buildMobileDrawerElement);\n\n/**\n * highlights the current chapter based on current page\n * @private\n * @param {TocEntry[]} tocEntries\n * @param {number} tocEntries\n */\nBookReader.prototype.updateTOCState = function(currIndex, tocEntries) {\n //this function won't have any effects if called before OpenLibrary request is finished\n if (!tocEntries) {return}\n $('.current-chapter').removeClass('current-chapter');\n const tocEntriesIndexed = tocEntries.filter((el) => el.pageIndex != undefined).reverse();\n const currChapter = tocEntriesIndexed[tocEntriesIndexed.findIndex(\n (el) => el.pageIndex <= currIndex)];\n if (currChapter != undefined) {\n $(currChapter.mobileHTML).addClass('current-chapter');\n }\n}\n"],"sourceRoot":""}
|
1
|
+
{"version":3,"file":"plugins/plugin.chapters.js","mappings":";qdAEA,EAAe,IAAI;;;;;;;;;;ECCnB,MAAMA,UAAkB,KACXC,oBACT,OAAO,IAAG;;;;;;;;;;;;;KAcZ,CAEAC,SACE,OAAO,CACT,EAGFC,eAAeC,OAAO,cAAeJ,GAErC,gBCRsCK,uwPAnBtCC,EAAA,kBAAAC,CAAA,MAAAC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://@internetarchive/bookreader/./node_modules/@internetarchive/icon-toc/icon-toc.js","webpack://@internetarchive/bookreader/./src/plugins/plugin.chapters.js","webpack://@internetarchive/bookreader/../src/directives/if-defined.ts"],"sourcesContent":["import { html } from 'lit';\n\nexport default html`\n<svg\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"tocTitleID tocDescID\"\n>\n <title id=\"tocTitleID\">Table of contents icon</title>\n <desc id=\"tocDescID\">An illustration of three text list items</desc>\n <g class=\"fill-color\" fill-rule=\"evenodd\"><rect height=\"3\" rx=\"1.5\" width=\"18\" x=\"6\"/><rect height=\"3\" rx=\"1.5\" width=\"18\" x=\"6\" y=\"21\"/><rect height=\"3\" rx=\"1.5\" width=\"18\" x=\"6\" y=\"14\"/><rect height=\"3\" rx=\"1.5\" width=\"18\" x=\"6\" y=\"7\"/><rect height=\"3\" rx=\"1.5\" width=\"4\"/><rect height=\"3\" rx=\"1.5\" width=\"4\" y=\"21\"/><rect height=\"3\" rx=\"1.5\" width=\"4\" y=\"14\"/><rect height=\"3\" rx=\"1.5\" width=\"4\" y=\"7\"/></g>\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconToc extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-toc', IAIconToc);\n\nexport default IAIconToc;\n","/* global BookReader */\nimport { css, html, LitElement, nothing } from \"lit\";\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport '@internetarchive/icon-toc/icon-toc';\n/** @typedef {import('@/src/BookNavigator/book-navigator.js').BookNavigator} BookNavigator */\n\n/**\n * Plugin for chapter markers in BookReader. Fetches from openlibrary.org\n * Could be forked, or extended to alter behavior\n */\n\njQuery.extend(BookReader.defaultOptions, {\n olHost: 'https://openlibrary.org',\n enableChaptersPlugin: true,\n bookId: '',\n});\n\n/** @override Extend to call Open Library for TOC */\nBookReader.prototype.init = (function(super_) {\n return function() {\n super_.call(this);\n if (this.options.enableChaptersPlugin && this.ui !== 'embed') {\n this._chapterInit();\n }\n };\n})(BookReader.prototype.init);\n\nBookReader.prototype._chapterInit = async function() {\n let rawTableOfContents = null;\n // Prefer IA TOC for now, until we update the second half to check for\n // `openlibrary_edition` on the IA metadata instead of making a bunch of\n // requests to OL.\n if (this.options.table_of_contents?.length) {\n rawTableOfContents = this.options.table_of_contents;\n } else {\n const olEdition = await this.getOpenLibraryRecord(this.options.olHost, this.options.bookId);\n if (olEdition?.table_of_contents?.length) {\n rawTableOfContents = olEdition.table_of_contents;\n }\n }\n\n if (rawTableOfContents) {\n this._tocEntries = rawTableOfContents\n .map(rawTOCEntry => (Object.assign({}, rawTOCEntry, {\n pageIndex: (\n typeof(rawTOCEntry.leaf) == 'number' ? this.book.leafNumToIndex(rawTOCEntry.leaf) :\n rawTOCEntry.pagenum ? this.book.getPageIndex(rawTOCEntry.pagenum) :\n undefined\n ),\n })));\n this._chaptersRender(this._tocEntries);\n this.bind(BookReader.eventNames.pageChanged, () => this._chaptersUpdateCurrent());\n }\n};\n\n/**\n * Update the table of contents based on array of TOC entries.\n */\nBookReader.prototype._chaptersRender = function() {\n const shell = /** @type {BookNavigator} */(this.shell);\n shell.menuProviders['chapters'] = {\n id: 'chapters',\n icon: html`<ia-icon-toc style=\"width: var(--iconWidth); height: var(--iconHeight);\"></ia-icon-toc>`,\n label: 'Table of Contents',\n component: html`<br-chapters-panel\n .contents=\"${this._tocEntries}\"\n .jumpToPage=\"${(pageIndex) => {\n this._chaptersUpdateCurrent(pageIndex);\n this.jumpToIndex(pageIndex);\n }}\"\n @connected=\"${(e) => {\n this._chaptersPanel = e.target;\n this._chaptersUpdateCurrent();\n }}\"\n />`,\n };\n shell.addMenuShortcut('chapters');\n shell.updateMenuContents();\n this._tocEntries.forEach((tocEntry, i) => this._chaptersRenderMarker(tocEntry, i));\n};\n\n/**\n * @typedef {Object} TocEntry\n * Table of contents entry as defined by Open Library, with some extra values for internal use\n * @property {number} [level]\n * @property {string} [label]\n * @property {string} [title]\n * @property {PageString} [pagenum]\n * @property {LeafNum} [leaf]\n * @property {number} [pageIndex] - Added\n *\n * @example {\n * \"pagenum\": \"17\",\n * \"level\": 1,\n * \"label\": \"CHAPTER I\",\n * \"title\": \"THE COUNTRY AND THE MISSION\"\n * }\n */\n\n/**\n * @param {TocEntry} tocEntry\n * @param {number} entryIndex\n */\nBookReader.prototype._chaptersRenderMarker = function(tocEntry, entryIndex) {\n if (tocEntry.pageIndex == undefined) return;\n\n //creates a string with non-void tocEntry.label and tocEntry.title\n const chapterStr = [tocEntry.label, tocEntry.title]\n .filter(x => x)\n .join(' ') || `Chapter ${entryIndex + 1}`;\n\n const percentThrough = BookReader.util.cssPercentage(tocEntry.pageIndex, this.book.getNumLeafs() - 1);\n $(`<div></div>`)\n .append(\n $('<div />')\n .text(chapterStr)\n .append(\n $('<div class=\"BRchapterPage\" />')\n .text(this.book.getPageName(tocEntry.pageIndex))\n )\n )\n .addClass('BRchapter')\n .css({ left: percentThrough })\n .appendTo(this.$('.BRnavline'))\n .on(\"mouseenter\", event => {\n // remove hover effect from other markers then turn on just for this\n const marker = event.currentTarget;\n const tooltip = marker.querySelector('div');\n const tooltipOffset = tooltip.getBoundingClientRect();\n const targetOffset = marker.getBoundingClientRect();\n const boxSizeAdjust = parseInt(getComputedStyle(tooltip).paddingLeft) * 2;\n if (tooltipOffset.x - boxSizeAdjust < 0) {\n tooltip.style.setProperty('transform', `translateX(-${targetOffset.left - boxSizeAdjust}px)`);\n }\n this.$('.BRsearch,.BRchapter').removeClass('front');\n $(event.target).addClass('front');\n })\n .on(\"mouseleave\", event => $(event.target).removeClass('front'))\n .on('click', () => {\n this._chaptersUpdateCurrent(tocEntry.pageIndex);\n this.jumpToIndex(tocEntry.pageIndex);\n });\n\n this.$('.BRchapter, .BRsearch').each((i, el) => {\n const $el = $(el);\n $el\n .on(\"mouseenter\", () => $el.addClass('front'))\n .on(\"mouseleave\", () => $el.removeClass('front'));\n });\n};\n\n/**\n * This makes a call to OL API and calls the given callback function with the\n * response from the API.\n *\n * @param {string} olHost\n * @param {string} ocaid\n */\nBookReader.prototype.getOpenLibraryRecord = async function (olHost, ocaid) {\n // Try looking up by ocaid first, then by source_record\n const baseURL = `${olHost}/query.json?type=/type/edition&*=`;\n const fetchUrlByBookId = `${baseURL}&ocaid=${ocaid}`;\n\n let data = await $.ajax({ url: fetchUrlByBookId, dataType: 'jsonp' });\n\n if (!data || !data.length) {\n // try sourceid\n data = await $.ajax({ url: `${baseURL}&source_records=ia:${ocaid}`, dataType: 'jsonp' });\n }\n\n return data?.[0];\n};\n\n/**\n * @private\n * Highlights the current chapter based on current page\n * @param {PageIndex} curIndex\n */\nBookReader.prototype._chaptersUpdateCurrent = function(\n curIndex = (this.mode == 2 ? Math.max(...this.displayedIndices) : this.firstIndex)\n) {\n const tocEntriesIndexed = this._tocEntries.filter((el) => el.pageIndex != undefined).reverse();\n const currChapter = tocEntriesIndexed[\n // subtract one so that 2up shows the right label\n tocEntriesIndexed.findIndex((chapter) => chapter.pageIndex <= curIndex)\n ];\n if (this._chaptersPanel) {\n this._chaptersPanel.currentChapter = currChapter;\n }\n};\n\n@customElement('br-chapters-panel')\nexport class BRChaptersPanel extends LitElement {\n /** @type {TocEntry[]} */\n @property({ type: Array })\n contents = [];\n\n /** @type {TocEntry?} */\n @property({ type: Object })\n currentChapter = {};\n\n /** @type {(pageIndex: PageIndex) => void} */\n jumpToPage = () => {};\n\n /**\n * @param {TocEntry[]} contents\n */\n constructor(contents) {\n super();\n this.contents = contents;\n }\n\n render() {\n return html`\n <ol>\n ${this.contents.map(tocEntry => this.renderTOCEntry(tocEntry))}\n </ol>\n `;\n }\n\n /**\n * @param {TocEntry} tocEntry\n */\n renderTOCEntry(tocEntry) {\n const chapterTitle = [tocEntry.label, tocEntry.title]\n .filter(x => x)\n .join(' ');\n const clickable = tocEntry.pageIndex != undefined;\n // note the click-tracking won't work...\n return html`\n <li\n class=\"\n BRtable-contents-el\n ${clickable ? 'clickable' : ''}\n ${tocEntry == this.currentChapter ? 'current' : ''}\n \"\n style=\"${styleMap({marginLeft: (tocEntry.level - 1) * 10 + 'px'})}\"\n data-event-click-tracking=\"${ifDefined(clickable ? \"BRTOCPanel|GoToChapter\" : undefined)}\"\n @click=\"${() => this.jumpToPage(tocEntry.pageIndex)}\"\n >\n ${chapterTitle}\n ${tocEntry.pagenum ? html`\n <br />\n <span class=\"BRTOCElementPage\">Page ${tocEntry.pagenum}</span>\n ` : nothing}\n </li>`;\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.dispatchEvent(new CustomEvent('connected'));\n }\n\n updated(changedProperties) {\n if (changedProperties.has('currentChapter')) {\n this.shadowRoot.querySelector('li.current')?.scrollIntoView({\n block: 'nearest',\n behavior: 'smooth',\n });\n }\n }\n\n static get styles() {\n return css`\n ol {\n padding: 0;\n margin: 0;\n margin-right: 5px;\n }\n li {\n padding: 10px;\n overflow: hidden;\n border-radius: 4px;\n }\n li.clickable {\n font-weight: normal;\n cursor: pointer;\n transition: background-color 0.2s;\n }\n\n li.clickable:not(.current):hover {\n background-color: rgba(255,255,255, 0.05);\n }\n\n li.current {\n background-color: rgba(255,255,255,0.9);\n color: #333;\n }\n\n .BRTOCElementPage {\n font-size: 0.85em;\n opacity: .8;\n }`;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {nothing} from '../lit-html.js';\n\n/**\n * For AttributeParts, sets the attribute if the value is defined and removes\n * the attribute if the value is undefined.\n *\n * For other part types, this directive is a no-op.\n */\nexport const ifDefined = <T>(value: T) => value ?? nothing;\n"],"names":["IAIconToc","styles","render","customElements","define","super_","_regeneratorRuntime","e","t","r","Object","prototype","n","hasOwnProperty","o","defineProperty","value","i","Symbol","a","iterator","c","asyncIterator","u","toStringTag","enumerable","configurable","writable","wrap","Generator","create","Context","makeInvokeMethod","tryCatch","type","arg","call","h","l","f","s","y","GeneratorFunction","GeneratorFunctionPrototype","p","d","getPrototypeOf","v","values","g","defineIteratorMethods","forEach","_invoke","AsyncIterator","invoke","_typeof","resolve","__await","then","callInvokeWithMethodAndArg","Error","done","method","delegate","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","return","TypeError","resultName","next","nextLoc","pushTryEntry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","isNaN","length","displayName","isGeneratorFunction","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","keys","reverse","pop","prev","charAt","slice","stop","rval","handle","complete","finish","catch","delegateYield","asyncGeneratorStep","gen","reject","_next","_throw","key","info","error","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","jQuery","extend","BookReader","defaultOptions","olHost","enableChaptersPlugin","bookId","init","this","options","ui","_chapterInit","_callee","_this$options$table_o","rawTableOfContents","_olEdition$table_of_c","olEdition","_this","_context","table_of_contents","getOpenLibraryRecord","_tocEntries","map","rawTOCEntry","assign","pageIndex","leaf","book","leafNumToIndex","pagenum","getPageIndex","_chaptersRender","bind","eventNames","pageChanged","_chaptersUpdateCurrent","_this2","shell","menuProviders","id","icon","html","_templateObject","_taggedTemplateLiteral","label","component","_templateObject2","jumpToIndex","_chaptersPanel","target","addMenuShortcut","updateMenuContents","tocEntry","_chaptersRenderMarker","entryIndex","_this3","chapterStr","title","filter","x","join","concat","percentThrough","util","cssPercentage","getNumLeafs","$","append","text","getPageName","addClass","css","left","appendTo","on","event","marker","currentTarget","tooltip","querySelector","tooltipOffset","getBoundingClientRect","targetOffset","boxSizeAdjust","parseInt","getComputedStyle","paddingLeft","style","setProperty","removeClass","each","el","$el","_ref2","_callee2","ocaid","_data","baseURL","fetchUrlByBookId","data","_context2","ajax","url","dataType","_x","_x2","curIndex","mode","Math","max","displayedIndices","firstIndex","tocEntriesIndexed","currChapter","findIndex","chapter","currentChapter","_decorate","customElement","_initialize","_LitElement","BRChaptersPanel","_LitElement2","_inherits","_super","contents","_this4","_classCallCheck","_assertThisInitialized","F","kind","decorators","property","Array","_this5","_templateObject3","renderTOCEntry","_this6","chapterTitle","clickable","_templateObject4","styleMap","marginLeft","level","jumpToPage","_templateObject5","nothing","_get","_getPrototypeOf","dispatchEvent","CustomEvent","changedProperties","_this$shadowRoot$quer","has","shadowRoot","scrollIntoView","block","behavior","static","_templateObject6","LitElement"],"sourceRoot":""}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[697],{5206:function(e,a,t){
|
1
|
+
"use strict";(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[697],{5206:function(e,a,t){var n,r="bookReaderFragmentChange";BookReader.prototype.init=(n=BookReader.prototype.init,function(){n.call(this),function(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.parent;a&&(e.bind(BookReader.eventNames.fragmentChange,(function(){var t=e.fragmentFromParams(e.paramsFromCurrent());a.postMessage({type:r,fragment:t},"*")})),window.addEventListener("message",(function(a){a.data&&a.data.type===r&&e.updateFromParams(e.paramsFromFragment(a.data.fragment))})))}(this)})}},function(e){e(e.s=5206)}]);
|
2
2
|
//# sourceMappingURL=plugin.iframe.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"file":"plugins/plugin.iframe.js","mappings":"+IAMA,IAEuCA,EAFjCC,EAA+B,2BAErCC,WAAWC,UAAUC,MAAkBJ,EAKpCE,WAAWC,UAAUC,KAJf,WACLJ,EAAOK,KAAKC,MAcT,SAA+BC,GAA4B,IAAxBC,EAAMC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAGG,OAAOJ,OAEnDA,IAILD,EAAGM,KAAKX,WAAWY,WAAWC,gBAAgB,WAC5C,IAAMC,EAAWT,EAAGU,mBAAmBV,EAAGW,qBAE1CV,EAAOW,YACL,CAAEC,KAAMnB,EAA8Be,SAAAA,GACtC,IAEJ,IAEAJ,OAAOS,iBAAiB,WAAW,SAAAC,GAE5BA,EAAMC,MAAQD,EAAMC,KAAKH,OAASnB,GAIvCM,EAAGiB,iBAAiBjB,EAAGkB,mBAAmBH,EAAMC,KAAKP,UACvD,IACF,CApCIU,CAAsBpB,KACxB,E","sources":["webpack://@internetarchive/bookreader/./src/plugins/plugin.iframe.js"],"sourcesContent":["/* global BookReader */\n/**\n * Plugin for two-way communication between a BookReader in an IFrame and the\n * parent web page\n */\n\nconst MESSAGE_TYPE_FRAGMENT_CHANGE = 'bookReaderFragmentChange';\n\nBookReader.prototype.init = (function (super_) {\n return function () {\n super_.call(this);\n _attachEventListeners(this);\n };\n})(BookReader.prototype.init);\n\n/**\n * @private\n * Using window.postMessage() and event listeners, the plugin notifies the\n * parent window when pages change, and the parent window can also\n * explicitly request a page change by sending its own message.\n *\n * @param {BookReader} br\n * @param {Window?} [parent]\n */\nexport function _attachEventListeners(br, parent = window.parent) {\n // Not embedded, abort\n if (!parent) {\n return;\n }\n\n br.bind(BookReader.eventNames.fragmentChange, () => {\n const fragment = br.fragmentFromParams(br.paramsFromCurrent());\n\n parent.postMessage(\n { type: MESSAGE_TYPE_FRAGMENT_CHANGE, fragment },\n '*'\n );\n });\n\n window.addEventListener('message', event => {\n // Not a recognized message type, abort\n if (!event.data || event.data.type !== MESSAGE_TYPE_FRAGMENT_CHANGE) {\n return;\n }\n\n br.updateFromParams(br.paramsFromFragment(event.data.fragment));\n });\n}\n"],"names":["super_","MESSAGE_TYPE_FRAGMENT_CHANGE","BookReader","prototype","init","call","this","br","parent","arguments","length","undefined","window","bind","eventNames","fragmentChange","fragment","fragmentFromParams","paramsFromCurrent","postMessage","type","addEventListener","event","data","updateFromParams","paramsFromFragment","_attachEventListeners"],"sourceRoot":""}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
"use strict";(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[623],{121:function(t,e,n){function r(){return r="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=o(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},r.apply(this,arguments)}function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}function o(t){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},o(t)}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==a(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!==a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(r.key),"symbol"===a(i)?i:String(i)),r)}var i}function f(t,e,n){return e&&c(t.prototype,e),n&&c(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}n(886),n(4338),n(228),n(7522),n(9373),n(9903),n(9749),n(6544),n(9288),n(9358),n(429),n(4254),n(752),n(1694),n(6265),n(8052),n(50),n(2349),n(1919);var s=window.BookReader,l={enabled:!0,manifest:null},p=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,n=arguments.length>1?arguments[1]:void 0;u(this,t),this.options=e,this.optionVariables=n,this.manifest=e.manifest}return f(t,[{key:"load",value:function(){if("http://iiif.io/api/presentation/2/context.json"==this.manifest["@context"]){var t=this.manifest;return this.manifestToBookReaderV2(t)}if("http://iiif.io/api/presentation/3/context.json"==this.manifest["@context"]){var e=this.manifest;return this.manifestToBookReaderV3(e)}throw new Error("Unsupported IIIF context "+this.manifest["@context"])}},{key:"manifestToBookReaderV3",value:function(t){var e={bookTitle:h(t.label),pageProgression:"right-to-left"==t.viewingDirection?"rl":"lr",metadata:t.metadata.map((function(t){return{label:h(t.label),value:h(t.value)}})),data:[],getPageURI:function(e,n,r){var i=Math.floor(100/n),o=t.items[e].items[0].items[0].body,a=(o instanceof Array?o[0]:o).service[0].id;return"".concat(a,"/full/pct:").concat(i,"/0/default.jpg")}};"top-to-bottom"!=t.viewingDirection&&"bottom-to-top"!=t.viewingDirection||console.warn("Unsupported viewingDirection",t.viewingDirection);var n=[];return t.items.forEach((function(r,i){var o=t.items[i].items[0].items[0].body,a={uri:(o instanceof Array?o[0]:o).service[0].id,width:r.width,height:r.height,pageNum:h(r.label)};n.push(a),i%2==0&&(e.data.push(n),n=[])})),e}},{key:"manifestToBookReaderV2",value:function(t){var e,n={bookTitle:t.label,metadata:t.metadata,thumbnail:null===(e=t.thumbnail)||void 0===e?void 0:e["@id"],data:[],getPageURI:function(e,n,r){var i=Math.floor(100/n),o=t.sequences[0].canvases[e].images[0].resource.service["@id"];return"".concat(o,"/full/pct:").concat(i,"/0/default.jpg")}},r=[];return t.sequences[0].canvases.forEach((function(t,e){var i={uri:t.images[0].resource.service["@id"],width:t.width,height:t.height,pageNum:t.label};r.push(i),e%2==0&&(n.data.push(r),r=[])})),n}}]),t}();function h(t){var e=Object.keys(t)[0];return(t[navigator.language]||t[e])[0]}var b=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&i(t,e)}(s,t);var e,n,c=(e=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,r=o(e);if(n){var i=o(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return function(t,e){if(e&&("object"===a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function s(){return u(this,s),c.apply(this,arguments)}return f(s,[{key:"setup",value:function(t){var e=Object.assign({},l,t.plugins.iiif);return e.enabled&&(this.iiifPlugin=new p(e,t.vars),t.plugins.iiif=this.iiifPlugin.options,Object.assign(t,this.iiifPlugin.load())),r(o(s.prototype),"setup",this).call(this,t)}}]),s}(s);window.BookReader=b}},function(t){t(t.s=121)}]);
|
2
|
+
//# sourceMappingURL=plugin.iiif.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"plugins/plugin.iiif.js","mappings":"0tDACA,IAAMA,EAAmEC,OAAOD,WAEnEE,EAAkB,CAC7BC,SAAS,EAETC,SAAU,MAGNC,EAAU,WACd,SAAAA,IAAwD,IAA5CC,EAAOC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAGL,EAAiBQ,EAAeH,UAAAC,OAAA,EAAAD,UAAA,QAAAE,EAAAE,EAAA,KAAAN,GACpDO,KAAKN,QAAUA,EACfM,KAAKF,gBAAkBA,EACvBE,KAAKR,SAAWE,EAAQF,QAC1B,CA0GC,OA1GAS,EAAAR,EAAA,EAAAS,IAAA,OAAAC,MAED,WACE,GAAiC,kDAA7BH,KAAKR,SAAS,YAAiE,CACjF,IAAMA,EAAkEQ,KA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WrE,UACbS,KAAKgE,WAAa,IAAIvE,EAAWmE,EAAYlE,EAAQuE,MAGrDvE,EAAQoE,QAAQC,KAAO/D,KAAKgE,WAAWtE,QACvCyD,OAAOU,OAAOnE,EAASM,KAAKgE,WAAWE,SAEzCC,EAAAC,EAAAb,EAAAc,WAAA,cAAAC,KAAA,KAAmB5E,EACrB,KAAC6D,CAAA,CAhBkC,CAASnE,GAkB9CC,OAAOD,WAAamE,C","sources":["webpack://@internetarchive/bookreader/./src/plugins/plugin.iiif.js"],"sourcesContent":["// @ts-check\nconst BookReader = /** @type {typeof import('../BookReader').default} */(window.BookReader);\n\nexport const DEFAULT_OPTIONS = {\n enabled: true,\n /** @type {import('@iiif/presentation-3').Manifest | import('@iiif/presentation-2').Manifest} */\n manifest: null,\n};\n\nclass IIIFPlugin {\n constructor(options = DEFAULT_OPTIONS, optionVariables) {\n this.options = options;\n this.optionVariables = optionVariables;\n this.manifest = options.manifest;\n }\n\n load() {\n if (this.manifest[\"@context\"] == \"http://iiif.io/api/presentation/2/context.json\") {\n const manifest = /** @type {import('@iiif/presentation-2').Manifest} */(this.manifest);\n return this.manifestToBookReaderV2(manifest);\n } else if (this.manifest[\"@context\"] == \"http://iiif.io/api/presentation/3/context.json\") {\n const manifest = /** @type {import('@iiif/presentation-3').Manifest} */(this.manifest);\n return this.manifestToBookReaderV3(manifest);\n } else {\n throw new Error(\"Unsupported IIIF context \" + this.manifest[\"@context\"]);\n }\n }\n\n /**\n * @param {import('@iiif/presentation-3').Manifest} manifest\n */\n manifestToBookReaderV3(manifest) {\n /** @type {import('../BookReader/options.js').BookReaderOptions} */\n const book = {\n bookTitle: resolveInternationalString(manifest.label),\n pageProgression: manifest.viewingDirection == \"right-to-left\" ? \"rl\" : \"lr\",\n // numLeafs: manifest.items.length,\n metadata: manifest.metadata.map((metadata) => {\n return {\n label: resolveInternationalString(metadata.label),\n value: resolveInternationalString(metadata.value),\n };\n }),\n data: [],\n /**\n * @this {import('../BookReader.js').default}\n */\n getPageURI(pageIndex, reduce, rotate) {\n const percent = Math.floor(100 * 1 / reduce);\n const bodyArr = manifest.items[pageIndex].items[0].items[0].body;\n const body = bodyArr instanceof Array ? bodyArr[0] : bodyArr;\n const uri = body.service[0].id;\n return `${uri}/full/pct:${percent}/0/default.jpg`;\n }\n };\n\n if (manifest.viewingDirection == \"top-to-bottom\" || manifest.viewingDirection == \"bottom-to-top\") {\n console.warn(\"Unsupported viewingDirection\", manifest.viewingDirection);\n }\n\n let spread = [];\n manifest.items.forEach((item, index) => {\n const bodyArr = manifest.items[index].items[0].items[0].body;\n const body = bodyArr instanceof Array ? bodyArr[0] : bodyArr;\n const uri = body.service[0].id;\n /** @type {import('../BookReader/options.js').PageData} */\n const pageData = {\n uri,\n width: item.width,\n height: item.height,\n pageNum: resolveInternationalString(item.label),\n };\n spread.push(pageData);\n if (index % 2 == 0) {\n book.data.push(spread);\n spread = [];\n }\n });\n\n return book;\n }\n\n /**\n * @param {import('@iiif/presentation-2').Manifest} manifest\n */\n manifestToBookReaderV2(manifest) {\n /** @type {import('../BookReader/options.js').BookReaderOptions} */\n const book = {\n bookTitle: manifest.label,\n metadata: manifest.metadata,\n thumbnail: manifest.thumbnail?.['@id'],\n // numLeafs: manifest.sequences[0].canvases.length,\n data: [],\n /**\n * @this {import('../BookReader.js').default}\n */\n getPageURI(pageIndex, reduce, rotate) {\n const percent = Math.floor(100 * 1 / reduce);\n const uri = manifest.sequences[0].canvases[pageIndex].images[0].resource.service['@id'];\n return `${uri}/full/pct:${percent}/0/default.jpg`;\n }\n };\n\n let spread = [];\n manifest.sequences[0].canvases.forEach((canvas, index) => {\n /** @type {import('../BookReader/options.js').PageData} */\n const pageData = {\n uri: canvas.images[0].resource.service['@id'],\n width: canvas.width,\n height: canvas.height,\n pageNum: canvas.label,\n };\n spread.push(pageData);\n if (index % 2 == 0) {\n book.data.push(spread);\n spread = [];\n }\n });\n\n return book;\n }\n}\n\n/**\n * @param {import('@iiif/presentation-3').InternationalString} internationalString\n */\nfunction resolveInternationalString(internationalString) {\n const anyLang = Object.keys(internationalString)[0];\n return (internationalString[navigator.language] || internationalString[anyLang])[0];\n}\n\nexport class BookReaderWithIIIFPlugin extends BookReader {\n setup(options) {\n const pluginOpts = Object.assign(\n {},\n DEFAULT_OPTIONS,\n options.plugins.iiif,\n );\n\n if (pluginOpts.enabled) {\n this.iiifPlugin = new IIIFPlugin(pluginOpts, options.vars);\n // Write this back; this way the plugin is the source of truth, and BR just\n // contains a reference to it.\n options.plugins.iiif = this.iiifPlugin.options;\n Object.assign(options, this.iiifPlugin.load());\n }\n return super.setup(options);\n }\n}\nwindow.BookReader = BookReaderWithIIIFPlugin;\nexport default BookReaderWithIIIFPlugin;\n"],"names":["BookReader","window","DEFAULT_OPTIONS","enabled","manifest","IIIFPlugin","options","arguments","length","undefined","optionVariables","_classCallCheck","this","_createClass","key","value","manifestToBookReaderV2","manifestToBookReaderV3","Error","book","bookTitle","resolveInternationalString","label","pageProgression","viewingDirection","metadata","map","data","getPageURI","pageIndex","reduce","rotate","percent","Math","floor","bodyArr","items","body","uri","Array","service","id","concat","console","warn","spread","forEach","item","index","pageData","width","height","pageNum","push","_manifest$thumbnail","thumbnail","sequences","canvases","images","resource","canvas","internationalString","anyLang","Object","keys","navigator","language","BookReaderWithIIIFPlugin","_BookReader","_inherits","_super","apply","pluginOpts","assign","plugins","iiif","iiifPlugin","vars","load","_get","_getPrototypeOf","prototype","call"],"sourceRoot":""}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[951],{5842:function(e,t
|
1
|
+
"use strict";(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[951],{5842:function(e,o,t){var n={};function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;try{return e.cookie,!1}catch(e){return!0}}t.r(n),t.d(n,{areCookiesBlocked:function(){return r},getItem:function(){return u},removeItem:function(){return i},setItem:function(){return c}}),t(2320),t(4043),t(2462),t(7267),t(2003),t(2826);var a=r();function u(e){return a||!e?null:decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null}function c(e,o,t,n,r,u){return!a&&(document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(o)+(t?"; expires=".concat(t.toUTCString()):"")+(r?"; domain=".concat(r):"")+(n?"; path=".concat(n):"")+(u?"; secure":""),!0)}function i(e,o,t){return!a&&!!hasItem(e)&&(document.cookie=encodeURIComponent(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"+(t?"; domain=".concat(t):"")+(o?"; path=".concat(o):""),!0)}var s,d=t(5311);BookReader.docCookies=n,d.extend(BookReader.defaultOptions,{enablePageResume:!0,resumeCookiePath:null}),BookReader.prototype.init=(s=BookReader.prototype.init,function(){var e=this;s.call(this),this.options.enablePageResume&&this.bind(BookReader.eventNames.fragmentChange,(function(){var o=e.paramsFromCurrent();e.updateResumeValue(o.index)}))}),BookReader.prototype.getResumeValue=function(){var e=BookReader.docCookies.getItem("br-resume");return null!==e?parseInt(e):null},BookReader.prototype.getCookiePath=function(e){return e.match(".+?(?=/page/|/mode/|$)")[0]},BookReader.prototype.updateResumeValue=function(e,o){var t=new Date(+new Date+12096e5),n=this.options.resumeCookiePath||this.getCookiePath(window.location.pathname);BookReader.docCookies.setItem(o||"br-resume",e,t,n,null,!1)}}},function(e){e(e.s=5842)}]);
|
2
2
|
//# sourceMappingURL=plugin.resume.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["webpack://@internetarchive/bookreader/./src/util/docCookies.js","webpack://@internetarchive/bookreader/./src/plugins/plugin.resume.js","webpack://@internetarchive/bookreader/./node_modules/core-js/internals/inherit-if-required.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.regexp.constructor.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.string.match.js"],"names":["getItem","sKey","decodeURIComponent","document","cookie","replace","RegExp","encodeURIComponent","setItem","sValue","vEnd","sPath","sDomain","bSecure","toUTCString","removeItem","hasItem","super_","BookReader","docCookies","jQuery","extend","defaultOptions","enablePageResume","resumeCookiePath","prototype","init","call","this","options","bind","eventNames","fragmentChange","params","paramsFromCurrent","updateResumeValue","index","getResumeValue","val","parseInt","getCookiePath","urlPathPart","match","cookieName","ttl","Date","path","window","location","pathname","isObject","setPrototypeOf","module","exports","$this","dummy","Wrapper","NewTarget","NewTargetPrototype","constructor","DESCRIPTORS","global","isForced","inheritIfRequired","defineProperty","getOwnPropertyNames","isRegExp","getFlags","stickyHelpers","redefine","fails","enforceInternalState","setSpecies","MATCH","wellKnownSymbol","NativeRegExp","RegExpPrototype","re1","re2","CORRECT_NEW","UNSUPPORTED_Y","RegExpWrapper","pattern","flags","sticky","thisIsRegExp","patternIsRegExp","flagsAreUndefined","undefined","source","indexOf","result","proxy","key","configurable","get","set","it","keys","length","fixRegExpWellKnownSymbolLogic","anObject","toLength","requireObjectCoercible","advanceStringIndex","regExpExec","nativeMatch","maybeCallNative","regexp","O","matcher","String","res","done","value","rx","S","fullUnicode","unicode","lastIndex","A","n","matchStr"],"mappings":"wJAkBO,SAASA,EAAQC,GACtB,OAAKA,GAEEC,mBAELC,SAASC,OAAOC,QAAQ,IAAIC,OAAO,mBAAqBC,mBAAmBN,GAAMI,QAAQ,cAAe,QAAU,+BAAgC,QAJlI,KAmBb,SAASG,EAAQP,EAAMQ,EAAQC,EAAMC,EAAOC,EAASC,GAO1D,OANAV,SAASC,OAASG,mBAAmBN,GAAQ,IAAMM,mBAAmBE,IACnEC,EAAO,aAAH,OAAgBA,EAAKI,eAAkB,KAC3CF,EAAU,YAAH,OAAeA,GAAY,KAClCD,EAAQ,UAAH,OAAaA,GAAU,KAC5BE,EAAU,WAAa,KAEnB,EAYF,SAASE,EAAWd,EAAMU,EAAOC,GAEtC,Q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,EAAOjC,EAAoBU,GAC3BvC,EAAQ,EACL8D,EAAKC,OAAS/D,GAAOwD,EAAMM,EAAK9D,MACvCwC,EAAgBjB,YAAcsB,EAC9BA,EAAcxD,UAAYmD,EAC1BP,EAASR,EAAQ,SAAUoB,GAI7BT,EAAW,W,kCCrFX,IAAI4B,EAAgC,EAAQ,MACxCC,EAAW,EAAQ,MACnBC,EAAW,EAAQ,MACnBC,EAAyB,EAAQ,MACjCC,EAAqB,EAAQ,MAC7BC,EAAa,EAAQ,MAGzBL,EAA8B,QAAS,GAAG,SAAU3B,EAAOiC,EAAaC,GACtE,MAAO,CAGL,SAAeC,GACb,IAAIC,EAAIN,EAAuB3E,MAC3BkF,EAAoBtB,MAAVoB,OAAsBpB,EAAYoB,EAAOnC,GACvD,YAAmBe,IAAZsB,EAAwBA,EAAQnF,KAAKiF,EAAQC,GAAK,IAAIvG,OAAOsG,GAAQnC,GAAOsC,OAAOF,KAI5F,SAAUD,GACR,IAAII,EAAML,EAAgBD,EAAaE,EAAQhF,MAC/C,GAAIoF,EAAIC,KAAM,OAAOD,EAAIE,MAEzB,IAAIC,EAAKd,EAASO,GACdQ,EAAIL,OAAOnF,MAEf,IAAKuF,EAAGtD,OAAQ,OAAO4C,EAAWU,EAAIC,GAEtC,IAAIC,EAAcF,EAAGG,QACrBH,EAAGI,UAAY,EAIf,IAHA,IAEI5B,EAFA6B,EAAI,GACJC,EAAI,EAEgC,QAAhC9B,EAASc,EAAWU,EAAIC,KAAc,CAC5C,IAAIM,EAAWX,OAAOpB,EAAO,IAC7B6B,EAAEC,GAAKC,EACU,KAAbA,IAAiBP,EAAGI,UAAYf,EAAmBY,EAAGd,EAASa,EAAGI,WAAYF,IAClFI,IAEF,OAAa,IAANA,EAAU,KAAOD,S","file":"plugins/plugin.resume.js","sourcesContent":["/**\n * Helper module use to get, set and remove item from cookie\n *\n * See more:\n * https://developer.mozilla.org/en-US/docs/Web/API/document.cookie\n * https://developer.mozilla.org/User:fusionchess\n * https://github.com/madmurphy/cookies.js\n * This framework is released under the GNU Public License, version 3 or later.\n * http://www.gnu.org/licenses/gpl-3.0-standalone.html\n */\n\n/**\n * Get specific key's value stored in cookie\n *\n * @param {string} sKey\n *\n * @returns {string|null}\n */\nexport function getItem(sKey) {\n if (!sKey) return null;\n\n return decodeURIComponent(\n // eslint-disable-next-line no-useless-escape\n document.cookie.replace(new RegExp('(?:(?:^|.*;)\\\\s*' + encodeURIComponent(sKey).replace(/[\\-\\.\\+\\*]/g, '\\\\$&') + '\\\\s*\\\\=\\\\s*([^;]*).*$)|^.*$'), '$1')) || null;\n}\n\n/**\n * Set specific key's value in cookie\n *\n * @param {string} sKey cookie name\n * @param {string} sValue cookie value\n * @param {string} [vEnd] expire|max-age\n * @param {string} [sPath] path of current item\n * @param {string} [sDomain] domain name\n * @param {boolean} [bSecure]\n *\n * @returns {true}\n */\nexport function setItem(sKey, sValue, vEnd, sPath, sDomain, bSecure) {\n document.cookie = encodeURIComponent(sKey) + '=' + encodeURIComponent(sValue)\n + (vEnd ? `; expires=${vEnd.toUTCString()}` : '')\n + (sDomain ? `; domain=${sDomain}` : '')\n + (sPath ? `; path=${sPath}` : '')\n + (bSecure ? `; secure` : '');\n\n return true;\n}\n\n/**\n * BROKEN Remove specific key's value from cookie\n * @fixme hasItem isn't even implemented! This will always error.\n * @param {string} sKey cookie name\n * @param {string} [sPath] path of current item\n * @param {string} [sDomain]\n *\n * @returns {boolean}\n */\nexport function removeItem(sKey, sPath, sDomain) {\n // eslint-disable-next-line\n if (!hasItem(sKey)) return false;\n\n document.cookie = encodeURIComponent(sKey) + `=; expires=Thu, 01 Jan 1970 00:00:00 GMT`\n + (sDomain ? `; domain=${sDomain}` : '')\n + (sPath ? `; path=${sPath}` : '');\n\n return true;\n}\n","import * as docCookies from '../util/docCookies.js';\n\n/* global BookReader */\n\n/** @deprecated Exposed for backward compatibility */\nBookReader.docCookies = docCookies;\n\n/**\n * Plugin to remember the current page number in a cookie\n */\njQuery.extend(BookReader.defaultOptions, {\n enablePageResume: true,\n /** @type {string|null} eg '/', '/details/id' */\n resumeCookiePath: null,\n});\n\n/** @override */\nBookReader.prototype.init = (function(super_) {\n return function() {\n super_.call(this);\n if (this.options.enablePageResume) {\n this.bind(BookReader.eventNames.fragmentChange, () => {\n const params = this.paramsFromCurrent();\n this.updateResumeValue(params.index);\n });\n }\n };\n})(BookReader.prototype.init);\n\n/**\n * Gets page resume value, for remembering reader's page\n * Can be overridden for different implementation\n *\n * @return {number|null}\n */\nBookReader.prototype.getResumeValue = function() {\n const val = BookReader.docCookies.getItem('br-resume');\n if (val !== null) return parseInt(val);\n else return null;\n}\n\n/**\n * Return cookie path using pathname up to /page/... or /mode/...\n * using window.location.pathname for urlPathPart:\n * - matches encoding\n * - ignores querystring part\n * - ignores fragment part (after #)\n * @param {string} urlPathPart - window.location.pathname\n */\nBookReader.prototype.getCookiePath = function(urlPathPart) {\n return urlPathPart.match('.+?(?=/page/|/mode/|$)')[0];\n}\n\n/**\n * Sets page resume value, for remembering reader's page\n * Can be overridden for different implementation\n *\n * @param {Number} index leaf index\n * @param {string} [cookieName]\n */\nBookReader.prototype.updateResumeValue = function(index, cookieName) {\n const ttl = new Date(+new Date + 12096e5); // 2 weeks\n // For multiple files in item, leave resumeCookiePath blank\n // It's likely we can remove resumeCookiePath using getCookiePath()\n const path = this.options.resumeCookiePath\n || this.getCookiePath(window.location.pathname);\n BookReader.docCookies.setItem(cookieName || 'br-resume', index, ttl, path, null, false);\n}\n","var isObject = require('../internals/is-object');\nvar setPrototypeOf = require('../internals/object-set-prototype-of');\n\n// makes subclassing work correct for wrapped built-ins\nmodule.exports = function ($this, dummy, Wrapper) {\n var NewTarget, NewTargetPrototype;\n if (\n // it can work only with native `setPrototypeOf`\n setPrototypeOf &&\n // we haven't completely correct pre-ES6 way for getting `new.target`, so use this\n typeof (NewTarget = dummy.constructor) == 'function' &&\n NewTarget !== Wrapper &&\n isObject(NewTargetPrototype = NewTarget.prototype) &&\n NewTargetPrototype !== Wrapper.prototype\n ) setPrototypeOf($this, NewTargetPrototype);\n return $this;\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar global = require('../internals/global');\nvar isForced = require('../internals/is-forced');\nvar inheritIfRequired = require('../internals/inherit-if-required');\nvar defineProperty = require('../internals/object-define-property').f;\nvar getOwnPropertyNames = require('../internals/object-get-own-property-names').f;\nvar isRegExp = require('../internals/is-regexp');\nvar getFlags = require('../internals/regexp-flags');\nvar stickyHelpers = require('../internals/regexp-sticky-helpers');\nvar redefine = require('../internals/redefine');\nvar fails = require('../internals/fails');\nvar enforceInternalState = require('../internals/internal-state').enforce;\nvar setSpecies = require('../internals/set-species');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar MATCH = wellKnownSymbol('match');\nvar NativeRegExp = global.RegExp;\nvar RegExpPrototype = NativeRegExp.prototype;\nvar re1 = /a/g;\nvar re2 = /a/g;\n\n// \"new\" should create a new object, old webkit bug\nvar CORRECT_NEW = new NativeRegExp(re1) !== re1;\n\nvar UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;\n\nvar FORCED = DESCRIPTORS && isForced('RegExp', (!CORRECT_NEW || UNSUPPORTED_Y || fails(function () {\n re2[MATCH] = false;\n // RegExp constructor can alter flags and IsRegExp works correct with @@match\n return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';\n})));\n\n// `RegExp` constructor\n// https://tc39.es/ecma262/#sec-regexp-constructor\nif (FORCED) {\n var RegExpWrapper = function RegExp(pattern, flags) {\n var thisIsRegExp = this instanceof RegExpWrapper;\n var patternIsRegExp = isRegExp(pattern);\n var flagsAreUndefined = flags === undefined;\n var sticky;\n\n if (!thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined) {\n return pattern;\n }\n\n if (CORRECT_NEW) {\n if (patternIsRegExp && !flagsAreUndefined) pattern = pattern.source;\n } else if (pattern instanceof RegExpWrapper) {\n if (flagsAreUndefined) flags = getFlags.call(pattern);\n pattern = pattern.source;\n }\n\n if (UNSUPPORTED_Y) {\n sticky = !!flags && flags.indexOf('y') > -1;\n if (sticky) flags = flags.replace(/y/g, '');\n }\n\n var result = inheritIfRequired(\n CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags),\n thisIsRegExp ? this : RegExpPrototype,\n RegExpWrapper\n );\n\n if (UNSUPPORTED_Y && sticky) {\n var state = enforceInternalState(result);\n state.sticky = true;\n }\n\n return result;\n };\n var proxy = function (key) {\n key in RegExpWrapper || defineProperty(RegExpWrapper, key, {\n configurable: true,\n get: function () { return NativeRegExp[key]; },\n set: function (it) { NativeRegExp[key] = it; }\n });\n };\n var keys = getOwnPropertyNames(NativeRegExp);\n var index = 0;\n while (keys.length > index) proxy(keys[index++]);\n RegExpPrototype.constructor = RegExpWrapper;\n RegExpWrapper.prototype = RegExpPrototype;\n redefine(global, 'RegExp', RegExpWrapper);\n}\n\n// https://tc39.es/ecma262/#sec-get-regexp-@@species\nsetSpecies('RegExp');\n","'use strict';\nvar fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');\nvar anObject = require('../internals/an-object');\nvar toLength = require('../internals/to-length');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar advanceStringIndex = require('../internals/advance-string-index');\nvar regExpExec = require('../internals/regexp-exec-abstract');\n\n// @@match logic\nfixRegExpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {\n return [\n // `String.prototype.match` method\n // https://tc39.es/ecma262/#sec-string.prototype.match\n function match(regexp) {\n var O = requireObjectCoercible(this);\n var matcher = regexp == undefined ? undefined : regexp[MATCH];\n return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));\n },\n // `RegExp.prototype[@@match]` method\n // https://tc39.es/ecma262/#sec-regexp.prototype-@@match\n function (regexp) {\n var res = maybeCallNative(nativeMatch, regexp, this);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n\n if (!rx.global) return regExpExec(rx, S);\n\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n var A = [];\n var n = 0;\n var result;\n while ((result = regExpExec(rx, S)) !== null) {\n var matchStr = String(result[0]);\n A[n] = matchStr;\n if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n n++;\n }\n return n === 0 ? null : A;\n }\n ];\n});\n"],"sourceRoot":""}
|
1
|
+
{"version":3,"file":"plugins/plugin.resume.js","mappings":"wJAgBO,SAASA,IAAkC,IAAhBC,EAAGC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAGG,SACtC,IAEE,OADAJ,EAAIK,QACG,CACT,CAAE,MAAOC,GACP,OAAO,CACT,CACF,C,iMAEA,IAAMC,EAAkBR,IASjB,SAASS,EAAQC,GACtB,OAAIF,IAAoBE,EAAa,KAE9BC,mBAELN,SAASC,OAAOM,QAAQ,IAAIC,OAAO,mBAAqBC,mBAAmBJ,GAAME,QAAQ,cAAe,QAAU,+BAAgC,QAAU,IAChK,CAcO,SAASG,EAAQL,EAAMM,EAAQC,EAAMC,EAAOC,EAASC,GAC1D,OAAIZ,IAEJH,SAASC,OAASQ,mBAAmBJ,GAAQ,IAAMI,mBAAmBE,IACnEC,EAAO,aAAHI,OAAgBJ,EAAKK,eAAkB,KAC3CH,EAAU,YAAHE,OAAeF,GAAY,KAClCD,EAAQ,UAAHG,OAAaH,GAAU,KAC5BE,EAAU,WAAa,KAEnB,EACT,CAWO,SAASG,EAAWb,EAAMQ,EAAOC,GACtC,OAAIX,KAECgB,QAAQd,KAEbL,SAASC,OAASQ,mBAAmBJ,GAAQ,4CAC1CS,EAAU,YAAHE,OAAeF,GAAY,KAClCD,EAAQ,UAAHG,OAAaH,GAAU,KAExB,EACT,C,ICpEsCO,E,UAZtCC,WAAWC,WAAaA,EAKxBC,EAAOC,OAAOH,WAAWI,eAAgB,CACvCC,kBAAkB,EAElBC,iBAAkB,OAIpBN,WAAWO,UAAUC,MAAiBT,EAUnCC,WAAWO,UAAUC,KATf,WAAW,IAAAC,EAAA,KAChBV,EAAOW,KAAKC,MACRA,KAAKC,QAAQP,kBACfM,KAAKE,KAAKb,WAAWc,WAAWC,gBAAgB,WAC9C,IAAMC,EAASP,EAAKQ,oBACpBR,EAAKS,kBAAkBF,EAAOG,MAChC,GAEJ,GASFnB,WAAWO,UAAUa,eAAiB,WACpC,IAAMC,EAAMrB,WAAWC,WAAWlB,QAAQ,aAC1C,OAAY,OAARsC,EAAqBC,SAASD,GACtB,IACd,EAUArB,WAAWO,UAAUgB,cAAgB,SAASC,GAC5C,OAAOA,EAAYC,MAAM,0BAA0B,EACrD,EASAzB,WAAWO,UAAUW,kBAAoB,SAASC,EAAOO,GACvD,IAAMC,EAAM,IAAIC,MAAM,IAAIA,KAAO,SAG3BC,EAAOlB,KAAKC,QAAQN,kBACrBK,KAAKY,cAAcO,OAAOC,SAASC,UACxChC,WAAWC,WAAWZ,QAAQqC,GAAc,YAAaP,EAAOQ,EAAKE,EAAM,MAAM,EACnF,C","sources":["webpack://@internetarchive/bookreader/./src/util/docCookies.js","webpack://@internetarchive/bookreader/./src/plugins/plugin.resume.js"],"sourcesContent":["/**\n * Helper module use to get, set and remove item from cookie\n *\n * See more:\n * https://developer.mozilla.org/en-US/docs/Web/API/document.cookie\n * https://developer.mozilla.org/User:fusionchess\n * https://github.com/madmurphy/cookies.js\n * This framework is released under the GNU Public License, version 3 or later.\n * http://www.gnu.org/licenses/gpl-3.0-standalone.html\n */\n\n/**\n * Check to see if the browser has cookies enabled.\n * Accessing document.cookies errors if eg iframe with sandbox enabled.\n * @returns {boolean}\n */\nexport function areCookiesBlocked(doc = document) {\n try {\n doc.cookie;\n return false;\n } catch (e) {\n return true;\n }\n}\n\nconst COOKIES_BLOCKED = areCookiesBlocked();\n\n/**\n * Get specific key's value stored in cookie\n *\n * @param {string} sKey\n *\n * @returns {string|null}\n */\nexport function getItem(sKey) {\n if (COOKIES_BLOCKED || !sKey) return null;\n\n return decodeURIComponent(\n // eslint-disable-next-line no-useless-escape\n document.cookie.replace(new RegExp('(?:(?:^|.*;)\\\\s*' + encodeURIComponent(sKey).replace(/[\\-\\.\\+\\*]/g, '\\\\$&') + '\\\\s*\\\\=\\\\s*([^;]*).*$)|^.*$'), '$1')) || null;\n}\n\n/**\n * Set specific key's value in cookie\n *\n * @param {string} sKey cookie name\n * @param {string} sValue cookie value\n * @param {string} [vEnd] expire|max-age\n * @param {string} [sPath] path of current item\n * @param {string} [sDomain] domain name\n * @param {boolean} [bSecure]\n *\n * @returns {boolean}\n */\nexport function setItem(sKey, sValue, vEnd, sPath, sDomain, bSecure) {\n if (COOKIES_BLOCKED) return false;\n\n document.cookie = encodeURIComponent(sKey) + '=' + encodeURIComponent(sValue)\n + (vEnd ? `; expires=${vEnd.toUTCString()}` : '')\n + (sDomain ? `; domain=${sDomain}` : '')\n + (sPath ? `; path=${sPath}` : '')\n + (bSecure ? `; secure` : '');\n\n return true;\n}\n\n/**\n * BROKEN Remove specific key's value from cookie\n * @fixme hasItem isn't even implemented! This will always error.\n * @param {string} sKey cookie name\n * @param {string} [sPath] path of current item\n * @param {string} [sDomain]\n *\n * @returns {boolean}\n */\nexport function removeItem(sKey, sPath, sDomain) {\n if (COOKIES_BLOCKED) return false;\n // eslint-disable-next-line\n if (!hasItem(sKey)) return false;\n\n document.cookie = encodeURIComponent(sKey) + `=; expires=Thu, 01 Jan 1970 00:00:00 GMT`\n + (sDomain ? `; domain=${sDomain}` : '')\n + (sPath ? `; path=${sPath}` : '');\n\n return true;\n}\n","import * as docCookies from '../util/docCookies.js';\n\n/* global BookReader */\n\n/** @deprecated Exposed for backward compatibility */\nBookReader.docCookies = docCookies;\n\n/**\n * Plugin to remember the current page number in a cookie\n */\njQuery.extend(BookReader.defaultOptions, {\n enablePageResume: true,\n /** @type {string|null} eg '/', '/details/id' */\n resumeCookiePath: null,\n});\n\n/** @override */\nBookReader.prototype.init = (function(super_) {\n return function() {\n super_.call(this);\n if (this.options.enablePageResume) {\n this.bind(BookReader.eventNames.fragmentChange, () => {\n const params = this.paramsFromCurrent();\n this.updateResumeValue(params.index);\n });\n }\n };\n})(BookReader.prototype.init);\n\n/**\n * Gets page resume value, for remembering reader's page\n * Can be overridden for different implementation\n *\n * @return {number|null}\n */\nBookReader.prototype.getResumeValue = function() {\n const val = BookReader.docCookies.getItem('br-resume');\n if (val !== null) return parseInt(val);\n else return null;\n};\n\n/**\n * Return cookie path using pathname up to /page/... or /mode/...\n * using window.location.pathname for urlPathPart:\n * - matches encoding\n * - ignores querystring part\n * - ignores fragment part (after #)\n * @param {string} urlPathPart - window.location.pathname\n */\nBookReader.prototype.getCookiePath = function(urlPathPart) {\n return urlPathPart.match('.+?(?=/page/|/mode/|$)')[0];\n};\n\n/**\n * Sets page resume value, for remembering reader's page\n * Can be overridden for different implementation\n *\n * @param {Number} index leaf index\n * @param {string} [cookieName]\n */\nBookReader.prototype.updateResumeValue = function(index, cookieName) {\n const ttl = new Date(+new Date + 12096e5); // 2 weeks\n // For multiple files in item, leave resumeCookiePath blank\n // It's likely we can remove resumeCookiePath using getCookiePath()\n const path = this.options.resumeCookiePath\n || this.getCookiePath(window.location.pathname);\n BookReader.docCookies.setItem(cookieName || 'br-resume', index, ttl, path, null, false);\n};\n"],"names":["areCookiesBlocked","doc","arguments","length","undefined","document","cookie","e","COOKIES_BLOCKED","getItem","sKey","decodeURIComponent","replace","RegExp","encodeURIComponent","setItem","sValue","vEnd","sPath","sDomain","bSecure","concat","toUTCString","removeItem","hasItem","super_","BookReader","docCookies","jQuery","extend","defaultOptions","enablePageResume","resumeCookiePath","prototype","init","_this","call","this","options","bind","eventNames","fragmentChange","params","paramsFromCurrent","updateResumeValue","index","getResumeValue","val","parseInt","getCookiePath","urlPathPart","match","cookieName","ttl","Date","path","window","location","pathname"],"sourceRoot":""}
|
@@ -1,2 +1,3 @@
|
|
1
|
-
(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[73],{8011:function(e,t,r){"use strict";r(5666),r(4916),r(4765),r(9826),r(5306),r(2222),r(9601),r(4747),r(1539),r(8674),r(6992),r(8783),r(3948),r(285),r(7042),r(8309),r(1038),r(2526),r(1817),r(2165),r(4603),r(9714),r(1249);var a=r(3609);function n(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var i,s=function(){function e(t){var r=t.br,a=t.searchCancelledCallback,n=void 0===a?function(){}:a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.br=r,this.matcher=new RegExp("{{{(.+?)}}}","g"),this.matches=[],this.cacheDOMElements(),this.bindEvents(),this.cancelSearch=n}var t,r;return t=e,(r=[{key:"cacheDOMElements",value:function(){this.dom={},this.dom.toolbarSearch=this.buildToolbarSearch()}},{key:"setQuery",value:function(e){this.br.$('[name="query"]').val(e)}},{key:"emptyMatches",value:function(){this.matches=[]}},{key:"removeResultPins",value:function(){this.br.$(".BRnavpos .BRsearch").remove()}},{key:"clearSearchFieldAndResults",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.br.removeSearchResults(),this.removeResultPins(),this.emptyMatches(),this.setQuery(""),this.teardownSearchNavigation(),e&&this.br.trigger("SearchResultsCleared")}},{key:"toggleSidebar",value:function(){this.br.trigger("ToggleSearchMenu")}},{key:"renderSearchNavigation",value:function(){var e="BRsearch-navigation";a(".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=a(".".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,r){return t[0]>r}))+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,r){return e[e.length-1]>r}))-1),this.br.$(".BRnavline .BRsearch").eq(++this.currentMatchIndex).click(),this.updateResultsPosition(),this.updateSearchNavigationButtons())}},{key:"getClosestMatchIndex",value:function(e){var t=function t(r,a){if(1===r.length)return r[0];var n=r.slice(0,r.length/2),i=r.slice(r.length/2);return t(e(n,i,a)?n:i,a)}(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=a(".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:"togglePinsFor",value:function(e){var t=e?"visible":"hidden";this.br.refs.$BRfooter.find(".BRsearch").css({visibility:t})}},{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 r=e.text,n=t.br.leafNumToIndex(e.par[0].page),i=t.br.getPageNum(n),s=t.br.constructor.util.cssPercentage(n,t.br.getNumLeafs()-1),o=r.replace(t.matcher,"<b>$1</b>"),c="";r.length>100&&(c=r.replace(/^(.{100}[^\s]*).*/,"$1").replace(t.matcher,"<b>$1</b>")+"..."),a("<div>").addClass("BRsearch").css({left:s}).attr("title","Search result").append('\n <div class="BRquery">\n <div>'.concat(c||o,"</div>\n <div>").concat("Page"," ").concat(i,"</div>\n </div>\n ")).data({pageIndex:n}).appendTo(t.br.$(".BRnavline")).hover((function(e){var t=e.currentTarget,r=t.querySelector(".BRquery"),n=r.getBoundingClientRect(),i=t.getBoundingClientRect(),s=2*parseInt(getComputedStyle(r).paddingLeft);n.x-s<0&&r.style.setProperty("transform","translateX(-".concat(i.left-s,"px)")),a(".BRsearch,.BRchapter").removeClass("front"),a(e.target).addClass("front")}),(function(e){return a(e.target).removeClass("front")})).click(function(e){this.br._searchPluginGoToResult(+a(e.target).data("pageIndex")),this.br.updateSearchHilites()}.bind(t))}))}},{key:"toggleSearchPending",value:function(e){var t=this;e?this.br.showProgressPopup("Search results will appear below...",(function(){return t.progressPopupClosed()})):this.br.removeProgressPopup()}},{key:"progressPopupClosed",value:function(){this.toggleSearchPending(),this.cancelSearch()}},{key:"renderErrorModal",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t="".concat(e?"":"The text may still be processing. ","Please try again.");this.renderModalMessage("\n Sorry, there was an error with your search.\n <br />\n ".concat(t,"\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:"submitHandler",value:function(e){e.preventDefault();var t=e.target.querySelector('[name="query"]').value;return!!t.length&&(this.br.search(t),this.emptyMatches(),this.toggleSearchPending(!0),!1)}},{key:"handleSearchCallback",value:function(e,t){var r=this,n=t.results,i=t.options;this.matches=n.matches,this.setCurrentMatchIndex(),this.teardownSearchNavigation(),this.renderSearchNavigation(),this.bindSearchNavigationEvents(),this.renderPins(n.matches),this.toggleSearchPending(!1),i.goToFirstResult?a(document).one("BookReader:pageChanged",(function(){r.br.resize()})):this.br.resize()}},{key:"handleNavToggledCallback",value:function(e){var t=this.br.navigationIsVisible();this.togglePinsFor(t)}},{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(){var e,t,r,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.toggleSearchPending(!1);var n=null==a||null===(e=a.detail)||void 0===e||null===(t=e.props)||void 0===t||null===(r=t.results)||void 0===r?void 0:r.indexed;this.renderErrorModal(n)}},{key:"handleSearchCallbackBookNotIndexed",value:function(){this.toggleSearchPending(!1),this.renderBookNotIndexedModal()}},{key:"handleSearchCallbackEmpty",value:function(){this.toggleSearchPending(!1),this.renderResultsEmptyModal()}},{key:"bindEvents",value:function(){var e="BookReader:";window.addEventListener("".concat(e,"SearchCallbackError"),this.handleSearchCallbackError.bind(this)),a(document).on("".concat(e,"SearchCallback"),this.handleSearchCallback.bind(this)).on("".concat(e,"navToggled"),this.handleNavToggledCallback.bind(this)).on("".concat(e,"SearchStarted"),this.handleSearchStarted.bind(this)).on("".concat(e,"SearchCallbackBookNotIndexed"),this.handleSearchCallbackBookNotIndexed.bind(this)).on("".concat(e,"SearchCallbackEmpty"),this.handleSearchCallbackEmpty.bind(this)).on("".concat(e,"pageChanged"),this.updateSearchNavigation.bind(this)),this.dom.toolbarSearch.querySelector("form").addEventListener("submit",this.submitHandler.bind(this))}}])&&n(t.prototype,r),e}(),o=r(3609),c=r(3609);function h(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var a=0,n=function(){};return{s:n,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:n}}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,s=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){o=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(o)throw i}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}function u(e,t,r,a,n,i,s){try{var o=e[i](s),c=o.value}catch(e){return void r(e)}o.done?t(c):Promise.resolve(c).then(a,n)}o.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){var t=this;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.searchXHR=null,this._cancelSearch.bind(this),this.cancelSearchRequest.bind(this),this.searchView||(this.searchView=new s({br:this,searchCancelledCallback:function(){t._cancelSearch(),t.trigger("SearchCanceled",{term:t.searchTerm,instance:t})}}))}),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.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]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a={goToFirstResult:!1,disablePopup:!1,suppressFragmentChange:!1,error:null,success:null},n=o.extend({},a,r);this.suppressFragmentChange=n.suppressFragmentChange,this.searchTerm=t.replace(/\//g," "),n.suppressFragmentChange||this.trigger(BookReader.eventNames.fragmentChange);var i=this.server.replace(/:.+/,""),s="https://".concat(i).concat(this.searchInsideUrl,"?"),h=this.bookPath,l="/".concat(this.subPrefix);this.bookPath.length-this.bookPath.lastIndexOf(l)==l.length&&(h=this.bookPath.substr(0,this.bookPath.length-l.length));var u={item_id:this.bookId,doc:this.subPrefix,path:h,q:t},d=c.param(u).replace(/%2F/g,"/"),p="".concat(s).concat(d),g=function(){e.searchXHR=null,window.BRSearchInProgress=function(){}},v=function(t){if(e.searchXHR){var r=t.error||!t.matches.length,a="function"==typeof n.error,i="function"==typeof n.success;r?a?n.error.call(e,t,n):e.BRSearchCallbackError(t,n):i?n.success.call(e,t,n):e.BRSearchCallback(t,n),g()}},f=function(t){e.searchXHR=t,window.BRSearchInProgress=v};return this.trigger("SearchStarted",{term:this.searchTerm,instance:this}),c.ajax({url:p,dataType:"jsonp",beforeSend:f,jsonpCallback:"BRSearchInProgress"}).then(v)},BookReader.prototype._cancelSearch=function(){var e;null===(e=this.searchXHR)||void 0===e||e.abort(),this.searchView.clearSearchFieldAndResults(!1),this.searchTerm="",this.searchXHR=null,this.searchResults=[],window.BRSearchInProgress=function(){}},BookReader.prototype.cancelSearchRequest=function(){null!==this.searchXHR&&(this._cancelSearch(),this.searchView.toggleSearchPending(),this.trigger("SearchCanceled",{term:this.searchTerm,instance:this}))},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 r=Object.assign({},t,{results:e});this.trigger("SearchCallbackError",r)}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,t=this,r=this.searchResults;null!=r&&(null===(e=r.matches)||void 0===e||e.forEach((function(e){e.par[0].boxes.forEach((function(e){var r=t.leafNumToIndex(e.page);if(o.inArray(r,t.displayedIndices)>=0){e.div||(e.div=document.createElement("div"),c(e.div).prop("className","BookReaderSearchHilite").appendTo(t.$(".pagediv".concat(r))));var a=t._models.book.getPage(r),n={width:t._modes.mode1Up.physicalInchesToDisplayPixels((e.r-e.l)/a.ppi),height:t._modes.mode1Up.physicalInchesToDisplayPixels((e.b-e.t)/a.ppi),left:t._modes.mode1Up.physicalInchesToDisplayPixels(e.l/a.ppi),top:t._modes.mode1Up.physicalInchesToDisplayPixels(e.t/a.ppi)};c(e.div).css(n)}else e.div&&(c(e.div).remove(),e.div=null)}))})))},BookReader.prototype.updateSearchHilites2UP=function(){var e=this,t=this.searchResults;if(null!==t){var r=t.matches;(void 0===r?[]:r).forEach((function(t){t.par[0].boxes.forEach((function(r){var a=e.leafNumToIndex(t.par[0].page),n=o.inArray(a,e.displayedIndices)>=0,i=e._models.book.getPage(a).isViewable;n&&i?(r.div||(r.div=document.createElement("div"),c(r.div).addClass("BookReaderSearchHilite").appendTo(e.refs.$brTwoPageView)),e.setHilightCss2UP(r.div,a,r.l,r.r,r.t,r.b)):r.div&&(c(r.div).remove(),r.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 r,a,n,i,s,o,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._models.book,a=r.getPage(t),n=!1,a.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:a.leafNum})).then((function(e){return e.json()}));case 6:i=e.sent,s=h(i.value);try{for(s.s();!(o=s.n()).done;)c=o.value,r.getPage(r.leafNumToIndex(c)).makeViewable()}catch(e){s.e(e)}finally{s.f()}i.value.length||(r.getPage(t).makeViewable(),n=!0);case 10:this.suppressFragmentChange=!1,this.jumpToIndex(t),n&&r.getPage(t).makeViewable(!1);case 13:case"end":return e.stop()}}),e,this)})),function(){var t=this,r=arguments;return new Promise((function(a,n){var i=e.apply(t,r);function s(e){u(i,a,n,s,o,"next",e)}function o(e){u(i,a,n,s,o,"throw",e)}s(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,r=[];if(null==t)return!1;if(this.constMode2up==this.mode)r=[this.twoPage.currentIndexL,this.twoPage.currentIndexR];else{if(this.constMode1up!=this.mode)return!1;r=[this.currentIndex()]}return t.matches.some((function(t){return t.par[0].boxes.some((function(t){var a=e.leafNumToIndex(t.page);if(o.inArray(a,r)>=0)return!0}))})),!1}},9587:function(e,t,r){var a=r(111),n=r(7674);e.exports=function(e,t,r){var i,s;return n&&"function"==typeof(i=t.constructor)&&i!==r&&a(s=i.prototype)&&s!==r.prototype&&n(e,s),e}},9601:function(e,t,r){var a=r(2109),n=r(1574);a({target:"Object",stat:!0,forced:Object.assign!==n},{assign:n})},4603:function(e,t,r){var a=r(9781),n=r(7854),i=r(4705),s=r(9587),o=r(3070).f,c=r(8006).f,h=r(7850),l=r(7066),u=r(2999),d=r(1320),p=r(7293),g=r(9909).enforce,v=r(6340),f=r(5112)("match"),b=n.RegExp,m=b.prototype,y=/a/g,k=/a/g,R=new b(y)!==y,S=u.UNSUPPORTED_Y;if(a&&i("RegExp",!R||S||p((function(){return k[f]=!1,b(y)!=y||b(k)==k||"/a/i"!=b(y,"i")})))){for(var x=function(e,t){var r,a=this instanceof x,n=h(e),i=void 0===t;if(!a&&n&&e.constructor===x&&i)return e;R?n&&!i&&(e=e.source):e instanceof x&&(i&&(t=l.call(e)),e=e.source),S&&(r=!!t&&t.indexOf("y")>-1)&&(t=t.replace(/y/g,""));var o=s(R?new b(e,t):b(e,t),a?this:m,x);return S&&r&&(g(o).sticky=!0),o},P=function(e){e in x||o(x,e,{configurable:!0,get:function(){return b[e]},set:function(t){b[e]=t}})},B=c(b),I=0;B.length>I;)P(B[I++]);m.constructor=x,x.prototype=m,d(n,"RegExp",x)}v("RegExp")}},function(e){"use strict";e(e.s=8011)}]);
|
1
|
+
/*! For license information please see plugin.search.js.LICENSE.txt */
|
2
|
+
"use strict";(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[73],{2225:function(e,t,r){r(4043),r(1514),r(5728),r(228),r(886),r(7267),r(4338),r(429),r(3964),r(6585),r(939),r(752),r(1694),r(6265),r(9307),r(9749),r(6544),r(4254),r(8373),r(6793),r(7629),r(7509),r(8052),r(7522),r(4284),r(3374),r(9730),r(2826),r(7049);var n=r(5685),a=r(9860),o=(r(2320),r(9373),r(9903),r(9288),r(5311));function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(void 0,a=function(e,t){if("object"!==i(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(n.key),"symbol"===i(a)?a:String(a)),n)}var a}var c=function(){function e(t){var r=t.br,n=t.searchCancelledCallback,a=void 0===n?function(){}:n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.br=r,this.matches=[],this.cacheDOMElements(),this.bindEvents(),this.cancelSearch=a}var t,r;return t=e,r=[{key:"cacheDOMElements",value:function(){this.dom={},this.dom.toolbarSearch=this.buildToolbarSearch()}},{key:"setQuery",value:function(e){this.br.$('[name="query"]').val(e)}},{key:"emptyMatches",value:function(){this.matches=[]}},{key:"removeResultPins",value:function(){this.br.$(".BRnavpos .BRsearch").remove()}},{key:"clearSearchFieldAndResults",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.br.removeSearchResults(),this.removeResultPins(),this.emptyMatches(),this.setQuery(""),this.teardownSearchNavigation(),e&&this.br.trigger("SearchResultsCleared")}},{key:"toggleSidebar",value:function(){this.br.trigger("ToggleSearchMenu")}},{key:"renderSearchNavigation",value:function(){var e="BRsearch-navigation";o(".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=o(".".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,r){return t[0]>r}))+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,r){return e[e.length-1]>r}))-1),this.br.$(".BRnavline .BRsearch").eq(++this.currentMatchIndex).click(),this.updateResultsPosition(),this.updateSearchNavigationButtons())}},{key:"getClosestMatchIndex",value:function(e){var t=function t(r,n){if(1===r.length)return r[0];var a=r.slice(0,r.length/2),o=r.slice(r.length/2);return t(e(a,o,n)?a:o,n)}(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&&this.dom.searchNavigation.find("[data-id=resultsCount]").text(this.resultsPosition())}},{key:"updateSearchNavigationButtons",value:function(){this.dom.searchNavigation&&(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=o(".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:"togglePinsFor",value:function(e){var t=e?"visible":"hidden";this.br.refs.$BRfooter.find(".BRsearch").css({visibility:t})}},{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 r=t.br.book.leafNumToIndex(e.par[0].page),n=t.br.constructor.util.cssPercentage(r,t.br.book.getNumLeafs()-1),a=e.html;if(a.length>200){var i=Math.max(0,a.indexOf("<mark>")-100);0!=i&&(a="…"+e.html.substring(i).replace(/^\S+/,""))}o("<div>").addClass("BRsearch").css({left:n}).attr("title","Search result").append('\n <div class="BRquery">\n <main>'.concat(a,"</main>\n <footer>Page ").concat(e.displayPageNumber,"</footer>\n </div>\n ")).appendTo(t.br.$(".BRnavline")).on("mouseenter",(function(e){var t=e.currentTarget,r=t.querySelector(".BRquery"),n=r.getBoundingClientRect(),a=t.getBoundingClientRect(),i=2*parseInt(getComputedStyle(r).paddingLeft);n.x-i<0&&r.style.setProperty("transform","translateX(-".concat(a.left-i,"px)")),o(".BRsearch,.BRchapter").removeClass("front"),o(e.target).addClass("front")})).on("mouseleave",(function(e){return o(e.target).removeClass("front")})).on("click",(function(){t.br._searchPluginGoToResult(e.matchIndex)}))}))}},{key:"toggleSearchPending",value:function(e){var t=this;e?this.br.showProgressPopup("Search results will appear below...",(function(){return t.progressPopupClosed()})):this.br.removeProgressPopup()}},{key:"progressPopupClosed",value:function(){this.toggleSearchPending(),this.cancelSearch()}},{key:"renderErrorModal",value:function(){var e="".concat(arguments.length>0&&void 0!==arguments[0]&&arguments[0]?"":"The text may still be processing. ","Please try again.");this.renderModalMessage("\n Sorry, there was an error with your search.\n <br />\n ".concat(e,"\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:"submitHandler",value:function(e){e.preventDefault();var t=e.target.querySelector('[name="query"]').value;return!!t.length&&(this.br.search(t),this.emptyMatches(),this.toggleSearchPending(!0),!1)}},{key:"handleSearchCallback",value:function(e,t){var r=this,n=t.results,a=t.options;this.matches=n.matches,this.setCurrentMatchIndex(),this.teardownSearchNavigation(),this.renderSearchNavigation(),this.bindSearchNavigationEvents(),this.renderPins(n.matches),this.toggleSearchPending(!1),a.goToFirstResult?o(document).one("BookReader:pageChanged",(function(){r.br.resize()})):this.br.resize()}},{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(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.toggleSearchPending(!1);var r=null==t||null===(e=t.detail)||void 0===e||null===(e=e.props)||void 0===e||null===(e=e.results)||void 0===e?void 0:e.indexed;this.renderErrorModal(r)}},{key:"handleSearchCallbackBookNotIndexed",value:function(){this.toggleSearchPending(!1),this.renderBookNotIndexedModal()}},{key:"handleSearchCallbackEmpty",value:function(){this.toggleSearchPending(!1),this.renderResultsEmptyModal()}},{key:"bindEvents",value:function(){var e="BookReader:";window.addEventListener("".concat(e,"SearchCallbackError"),this.handleSearchCallbackError.bind(this)),o(document).on("".concat(e,"SearchCallback"),this.handleSearchCallback.bind(this)).on("".concat(e,"SearchStarted"),this.handleSearchStarted.bind(this)).on("".concat(e,"SearchCallbackBookNotIndexed"),this.handleSearchCallbackBookNotIndexed.bind(this)).on("".concat(e,"SearchCallbackEmpty"),this.handleSearchCallbackEmpty.bind(this)).on("".concat(e,"pageChanged"),this.updateSearchNavigation.bind(this)),this.dom.toolbarSearch.querySelector("form").addEventListener("submit",this.submitHandler.bind(this))}}],r&&s(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}(),h=c;function l(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=u(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},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 o,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}function u(e,t){if(e){if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e,t,r){var a=(0,n.escapeRegExp)((0,n.escapeHTML)(t)),o=(0,n.escapeRegExp)((0,n.escapeHTML)(r)),i=new RegExp("".concat(a,"([^]+?)").concat(o),"g");return(0,n.escapeHTML)(e).replace(i,"<mark>$1</mark>").replace(/(\b)- /g,"$1")}r(2003);var p,v=r(5311),g=r(5311);function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function y(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=b(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},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 o,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}function b(e,t){if(e){if("string"==typeof e)return k(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?k(e,t):void 0}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function S(){S=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function h(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(e){h=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var o=t&&t.prototype instanceof y?t:y,i=Object.create(o.prototype),s=new N(n||[]);return a(i,"_invoke",{value:C(e,r,s)}),i}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var d="suspendedStart",f="suspendedYield",p="executing",v="completed",g={};function y(){}function b(){}function k(){}var x={};h(x,i,(function(){return this}));var R=Object.getPrototypeOf,w=R&&R(R(L([])));w&&w!==r&&n.call(w,i)&&(x=w);var P=k.prototype=y.prototype=Object.create(x);function I(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function B(e,t){function r(a,o,i,s){var c=u(e[a],e,o);if("throw"!==c.type){var h=c.arg,l=h.value;return l&&"object"==m(l)&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,i,s)}),(function(e){r("throw",e,i,s)})):t.resolve(l).then((function(e){h.value=e,i(h)}),(function(e){return r("throw",e,i,s)}))}s(c.arg)}var o;a(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,a){r(e,n,t,a)}))}return o=o?o.then(a,a):a()}})}function C(t,r,n){var a=d;return function(o,i){if(a===p)throw new Error("Generator is already running");if(a===v){if("throw"===o)throw i;return{value:e,done:!0}}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var c=M(s,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===d)throw a=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=p;var h=u(t,r,n);if("normal"===h.type){if(a=n.done?v:f,h.arg===g)continue;return{value:h.arg,done:n.done}}"throw"===h.type&&(a=v,n.method="throw",n.arg=h.arg)}}}function M(t,r){var n=r.method,a=t.iterator[n];if(a===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,M(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var o=u(a,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,g;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function L(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function r(){for(;++a<t.length;)if(n.call(t,a))return r.value=t[a],r.done=!1,r;return r.value=e,r.done=!0,r};return o.next=o}}throw new TypeError(m(t)+" is not iterable")}return b.prototype=k,a(P,"constructor",{value:k,configurable:!0}),a(k,"constructor",{value:b,configurable:!0}),b.displayName=h(k,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,k):(e.__proto__=k,h(e,c,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},I(B.prototype),h(B.prototype,s,(function(){return this})),t.AsyncIterator=B,t.async=function(e,r,n,a,o){void 0===o&&(o=Promise);var i=new B(l(e,r,n,a),o);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},I(P),h(P,c,"Generator"),h(P,i,(function(){return this})),h(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=L,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(E),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function a(n,a){return s.type="throw",s.arg=t,r.next=n,a&&(r.method="next",r.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),h=n.call(i,"finallyLoc");if(c&&h){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!h)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;E(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:L(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function x(e,t,r,n,a,o,i){try{var s=e[o](i),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,a)}function R(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){x(o,n,a,i,s,"next",e)}function s(e){x(o,n,a,i,s,"throw",e)}i(void 0)}))}}v.extend(BookReader.defaultOptions,{server:"ia600609.us.archive.org",bookId:"",subPrefix:"",bookPath:"",enableSearch:!0,searchInsideProtocol:"https",searchInsideUrl:"/fulltext/inside.php",searchInsidePreTag:"{{{",searchInsidePostTag:"}}}",initialSearchTerm:null}),BookReader.prototype.setup=(p=BookReader.prototype.setup,function(e){p.call(this,e),this.searchTerm="",this.searchResults=null,this.searchInsideUrl=e.searchInsideUrl,this.enableSearch=e.enableSearch,this.bookId=e.bookId,this.server=e.server,this.subPrefix=e.subPrefix,this.bookPath=e.bookPath,this.searchXHR=null,this._cancelSearch.bind(this),this.cancelSearchRequest.bind(this),this._searchBoxesByIndex={},this.searchView=void 0}),BookReader.prototype.init=function(e){return function(){var t=this;e.call(this),this.searchView=new h({br:this,searchCancelledCallback:function(){t._cancelSearch(),t.trigger("SearchCanceled",{term:t.searchTerm,instance:t})}}),this.options.enableSearch&&this.options.initialSearchTerm&&this.search(this.options.initialSearchTerm,{goToFirstResult:this.options.goToFirstResult,suppressFragmentChange:!1})}}(BookReader.prototype.init),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._createPageContainer=function(e){return function(t){var r=e.call(this,t);if(this.enableSearch&&r.page&&t in this._searchBoxesByIndex){var n=r.page.index,o=this._searchBoxesByIndex[n];(0,a.Tm)("searchHiliteLayer",o,r.page,r.$container[0],o.map((function(e){return"match-index-".concat(e.matchIndex)})))}return r}}(BookReader.prototype._createPageContainer),BookReader.prototype.search=R(S().mark((function e(){var t,r,n,a,o,i,s,c,h,l,u,d,f=this,p=arguments;return S().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.length>0&&void 0!==p[0]?p[0]:"",r=p.length>1&&void 0!==p[1]?p[1]:{},n={goToFirstResult:!1,disablePopup:!1,suppressFragmentChange:!1,error:null,success:null},a=v.extend({},n,r),this.suppressFragmentChange=a.suppressFragmentChange,this.searchCancelled=!1,this.searchTerm=t.replace(/\//g," "),a.suppressFragmentChange||this.trigger(BookReader.eventNames.fragmentChange),o=this.server.replace(/:.+/,""),i="".concat(this.options.searchInsideProtocol,"://").concat(o).concat(this.searchInsideUrl,"?"),s=this.bookPath,c="/".concat(this.subPrefix),this.bookPath.length-this.bookPath.lastIndexOf(c)==c.length&&(s=this.bookPath.substr(0,this.bookPath.length-c.length)),h={item_id:this.bookId,doc:this.subPrefix,path:s,q:t,pre_tag:this.options.searchInsidePreTag,post_tag:this.options.searchInsidePostTag},l=g.param(h).replace(/%2F/g,"/"),u="".concat(i).concat(l),d=function(e){if(!f.searchCancelled){var t=e.error||!e.matches.length,r="function"==typeof a.error,n="function"==typeof a.success;t?(console.error("Search Inside Response Error",e.error||"matches.length == 0"),r?a.error.call(f,e,a):f.BRSearchCallbackError(e,a)):n?a.success.call(f,e,a):f.BRSearchCallback(e,a)}},this.trigger("SearchStarted",{term:this.searchTerm,instance:this}),e.t0=d,e.next=21,g.ajax({url:u,dataType:"jsonp",cache:!0,beforeSend:function(e){f.searchXHR=e}});case 21:e.t1=e.sent,(0,e.t0)(e.t1);case 23:case"end":return e.stop()}}),e,this)}))),BookReader.prototype._cancelSearch=function(){var e;null===(e=this.searchXHR)||void 0===e||e.abort(),this.searchView.clearSearchFieldAndResults(!1),this.searchTerm="",this.searchXHR=null,this.searchCancelled=!0,this.searchResults=[]},BookReader.prototype.cancelSearchRequest=function(){this.searchCancelled=!0,null!==this.searchXHR&&(this._cancelSearch(),this.searchView.toggleSearchPending(),this.trigger("SearchCanceled",{term:this.searchTerm,instance:this}))},BookReader.prototype.BRSearchCallback=function(e,t){var r=this;!function(e,t,n,a){var o,i,s,c,h=l(e.matches.entries());try{for(h.s();!(o=h.n()).done;){var d=(s=o.value,c=2,function(e){if(Array.isArray(e))return e}(s)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o,i,s=[],c=!0,h=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){h=!0,a=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(h)throw a}}return s}}(s,c)||u(s,c)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),p=d[0],v=d[1];v.matchIndex=p,v.displayPageNumber=(i=v.par[0].page,r.book.getPageNum(r.book.leafNumToIndex(i))),v.html=f(v.text,n,a);var g,m=l(v.par);try{for(m.s();!(g=m.n()).done;){var y,b=l(g.value.boxes);try{for(b.s();!(y=b.n()).done;)y.value.matchIndex=p}catch(e){b.e(e)}finally{b.f()}}}catch(e){m.e(e)}finally{m.f()}}}catch(e){h.e(e)}finally{h.f()}}(e,0,this.options.searchInsidePreTag,this.options.searchInsidePostTag),this.searchResults=e||[],this.updateSearchHilites(),this.removeProgressPopup(),t.goToFirstResult&&this._searchPluginGoToResult(0),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 r=Object.assign({},t,{results:e});this.trigger("SearchCallbackError",r)}else if(0==e.matches.length){if(!1===e.indexed)return void this.trigger("SearchCallbackBookNotIndexed",t);this.trigger("SearchCallbackEmpty",t)}},BookReader.prototype.updateSearchHilites=function(){var e,t=(null===(e=this.searchResults)||void 0===e?void 0:e.matches)||[],r={};this.removeSearchHilites();var n,o,i,s=y(t);try{for(s.s();!(n=s.n()).done;){var c,h=y(n.value.par[0].boxes);try{for(h.s();!(c=h.n()).done;){var l=c.value,u=this.book.leafNumToIndex(l.page);(r[u]||(r[u]=[])).push(l)}}catch(e){h.e(e)}finally{h.f()}}}catch(e){s.e(e)}finally{s.f()}for(var d=0,f=Object.entries(r);d<f.length;d++){var p,v=(o=f[d],i=2,function(e){if(Array.isArray(e))return e}(o)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o,i,s=[],c=!0,h=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){h=!0,a=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(h)throw a}}return s}}(o,i)||b(o,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),g=v[0],m=v[1],k=parseFloat(g),S=this.book.getPage(k),x=y(this.getActivePageContainerElementsForIndex(k));try{for(x.s();!(p=x.n()).done;){var R=p.value;(0,a.Tm)("searchHiliteLayer",m,S,R,m.map((function(e){return"match-index-".concat(e.matchIndex)})))}}catch(e){x.e(e)}finally{x.f()}}this._searchBoxesByIndex=r},BookReader.prototype.removeSearchHilites=function(){g(this.getActivePageContainerElements()).find(".searchHiliteLayer").remove()},BookReader.prototype._searchPluginGoToResult=function(){var e=R(S().mark((function e(t){var r,a,o,i,s,c,h,l,u,d,f,p;return S().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=null===(r=this.searchResults)||void 0===r?void 0:r.matches[t],o=this.book,i=o.leafNumToIndex(a.par[0].page),s=o.getPage(i),c=Math.abs(this.currentIndex()-i)<3,h=!1,s.isViewable){e.next=17;break}return e.next=9,fetch("/services/bookreader/request_page?"+new URLSearchParams({id:this.options.bookId,subprefix:this.options.subPrefix,leafNum:s.leafNum})).then((function(e){return e.json()}));case 9:l=e.sent,u=y(l.value);try{for(u.s();!(d=u.n()).done;)f=d.value,o.getPage(o.leafNumToIndex(f)).makeViewable()}catch(e){u.e(e)}finally{u.f()}if(l.value.length||(o.getPage(i).makeViewable(),h=!0),this._modes.mode1Up.mode1UpLit.updatePages(),this.activeMode!=this._modes.mode1Up){e.next=17;break}return e.next=17,this._modes.mode1Up.mode1UpLit.updateComplete;case 17:return this._isIndexDisplayed(i)||(this.suppressFragmentChange=!1,this.jumpToIndex(i)),h&&o.getPage(i).makeViewable(!1),e.next=21,(0,n.poll)((function(){return g("rect.match-index-".concat(a.matchIndex))}),{until:function(e){return e.length>0}});case 21:if(!(p=e.sent).length){e.next=28;break}return p.css("animation","none"),p[0].scrollIntoView({block:this.constMode1up==this.mode||this.isFullscreenActive?"center":"nearest",inline:"center",behavior:c?"smooth":"auto"}),e.next=27,new Promise((function(e){return setTimeout(e,100)}));case 27:p.removeAttr("style");case 28:case"end":return e.stop()}}),e,this)})));return function(t){return e.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,r=[];if(null==t)return!1;if(this.constMode2up==this.mode)r=[this.twoPage.currentIndexL,this.twoPage.currentIndexR];else{if(this.constMode1up!=this.mode)return!1;r=[this.currentIndex()]}return t.matches.some((function(t){return t.par[0].boxes.some((function(t){var n=e.book.leafNumToIndex(t.page);if(v.inArray(n,r)>=0)return!0}))})),!1}},6585:function(e,t,r){var n=r(9989),a=r(9419).entries;n({target:"Object",stat:!0},{entries:function(e){return a(e)}})}},function(e){e(e.s=2225)}]);
|
2
3
|
//# sourceMappingURL=plugin.search.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|