@internetarchive/bookreader 5.0.0-20 → 5.0.0-24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/BookReader/BookReader.css +0 -55
  2. package/BookReader/BookReader.js +1 -1
  3. package/BookReader/BookReader.js.map +1 -1
  4. package/BookReader/bookreader-component-bundle.js +4 -4
  5. package/BookReader/bookreader-component-bundle.js.map +1 -1
  6. package/BookReader/plugins/plugin.url.js +1 -1
  7. package/BookReader/plugins/plugin.url.js.map +1 -1
  8. package/CHANGELOG.md +15 -0
  9. package/index.html +3 -0
  10. package/package.json +2 -6
  11. package/src/BookNavigator/BookNavigator.js +5 -1
  12. package/src/BookNavigator/bookmarks/bookmarks-provider.js +1 -0
  13. package/src/BookNavigator/bookmarks/ia-bookmarks.js +3 -0
  14. package/src/BookNavigator/visual-adjustments/visual-adjustments-provider.js +1 -1
  15. package/src/BookReader/Mode1Up.js +10 -2
  16. package/src/BookReader/ModeThumb.js +13 -6
  17. package/src/BookReader/Navbar/Navbar.js +0 -29
  18. package/src/BookReader/options.js +4 -0
  19. package/src/BookReader.js +35 -35
  20. package/src/ItemNavigator/ItemNavigator.js +1 -0
  21. package/src/css/_BRnav.scss +0 -23
  22. package/src/plugins/plugin.url.js +1 -1
  23. package/tests/{BookReader → jest/BookReader}/BookModel.test.js +0 -0
  24. package/tests/{BookReader → jest/BookReader}/BookReaderPublicFunctions.test.js +2 -2
  25. package/tests/{BookReader → jest/BookReader}/DebugConsole.test.js +0 -0
  26. package/tests/{BookReader → jest/BookReader}/ImageCache.test.js +0 -0
  27. package/tests/{BookReader → jest/BookReader}/Mode1UpLit.test.js +0 -0
  28. package/tests/{BookReader → jest/BookReader}/Mode2Up.test.js +0 -0
  29. package/tests/{BookReader → jest/BookReader}/ModeSmoothZoom.test.js +0 -0
  30. package/tests/jest/BookReader/ModeThumb.test.js +71 -0
  31. package/tests/{BookReader → jest/BookReader}/Navbar/Navbar.test.js +0 -0
  32. package/tests/{BookReader → jest/BookReader}/PageContainer.test.js +0 -0
  33. package/tests/{BookReader → jest/BookReader}/ReduceSet.test.js +0 -0
  34. package/tests/{BookReader → jest/BookReader}/Toolbar/Toolbar.test.js +0 -0
  35. package/tests/{BookReader → jest/BookReader}/utils/HTMLDimensionsCacher.test.js +0 -0
  36. package/tests/{BookReader → jest/BookReader}/utils/classes.test.js +0 -0
  37. package/tests/{BookReader → jest/BookReader}/utils.test.js +0 -0
  38. package/tests/{BookReader.options.test.js → jest/BookReader.options.test.js} +8 -0
  39. package/tests/{BookReader.test.js → jest/BookReader.test.js} +16 -0
  40. package/tests/{plugins → jest/plugins}/plugin.archive_analytics.test.js +0 -0
  41. package/tests/{plugins → jest/plugins}/plugin.autoplay.test.js +0 -0
  42. package/tests/{plugins → jest/plugins}/plugin.chapters.test.js +0 -0
  43. package/tests/{plugins → jest/plugins}/plugin.iframe.test.js +0 -0
  44. package/tests/{plugins → jest/plugins}/plugin.mobile_nav.test.js +0 -0
  45. package/tests/{plugins → jest/plugins}/plugin.resume.test.js +0 -0
  46. package/tests/{plugins → jest/plugins}/plugin.text_selection.test.js +0 -0
  47. package/tests/{plugins → jest/plugins}/plugin.url.test.js +18 -0
  48. /package/tests/{plugins → jest/plugins}/plugin.vendor-fullscreen.test.js +0 -0
  49. /package/tests/{plugins → jest/plugins}/search/plugin.search.test.js +0 -0
  50. /package/tests/{plugins → jest/plugins}/search/plugin.search.view.test.js +0 -0
  51. /package/tests/{plugins → jest/plugins}/tts/AbstractTTSEngine.test.js +0 -0
  52. /package/tests/{plugins → jest/plugins}/tts/FestivalTTSEngine.test.js +0 -0
  53. /package/tests/{plugins → jest/plugins}/tts/PageChunk.test.js +0 -0
  54. /package/tests/{plugins → jest/plugins}/tts/PageChunkIterator.test.js +0 -0
  55. /package/tests/{plugins → jest/plugins}/tts/WebTTSEngine.test.js +0 -0
  56. /package/tests/{plugins → jest/plugins}/tts/utils.test.js +0 -0
  57. /package/tests/{util → jest/util}/browserSniffing.test.js +0 -0
  58. /package/tests/{util → jest/util}/docCookies.test.js +0 -0
  59. /package/tests/{util → jest/util}/strings.test.js +0 -0
  60. /package/tests/{utils.js → jest/utils.js} +0 -0
@@ -1149,7 +1149,7 @@
1149
1149
  width: ${n};
1150
1150
  max-width: ${r};
1151
1151
  }
1152
- `}};function he(e){return(he="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})(e)}var fe,pe,me,ve,be,ye,ge,ke,we,Ce,xe,Se,Be;function Oe(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Ie(e){return function(e){if(Array.isArray(e))return ze(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return ze(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ze(e,t):void 0}}(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.")}()}function ze(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function De(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Le(e,t){return(Le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Te(e,t){if(t&&("object"===he(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Ee(e){return(Ee=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}ne([(0,o.Cb)({type:String,reflect:!0})],ue.prototype,"mode",void 0),ne([(0,o.Cb)({type:Object})],ue.prototype,"customModalContent",void 0),ne([(0,o.Cb)({type:Object})],ue.prototype,"hostBridge",void 0),ne([(0,o.IO)("modal-template")],ue.prototype,"modalTemplate",void 0),ue=ne([(0,o.Mo)("modal-manager")],ue);var je=function(e){!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}}),t&&Le(e,t)}(c,e);var t,n,i,a,s,l=(a=c,s=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=Ee(a);if(s){var n=Ee(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Te(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.call(this)).baseHost="archive.org",e.item={},e.itemType="",e.menuOpened=!1,e.signedIn=!1,e.menuShortcuts=[],e.menuContents=[],e.viewportInFullscreen=!1,e.openMenu="",e.renderModalManager(),e}return t=c,i=[{key:"properties",get:function(){return{baseHost:{type:String},item:{type:Object,converter:function(e){return e?JSON.parse(atob(e)):{}}},itemType:{type:String},menuShortcuts:{type:Array,hasChanged:function(e,t){return e!==t}},menuOpened:{type:Boolean},menuContents:{type:Array},openMenu:{type:String},signedIn:{type:Boolean,converter:function(e){return"boolean"==typeof e?e:"true"===e}},viewportInFullscreen:{type:Boolean}}}},{key:"styles",get:function(){var e=(0,o.iv)(we||(we=Oe(["var(--menuWidth, 320px)"]))),t=(0,o.iv)(Ce||(Ce=Oe(["@media (min-width: 640px)"]))),n=(0,o.iv)(xe||(xe=Oe(["var(--animationTiming, 200ms)"]))),r=(0,o.iv)(Se||(Se=Oe(["transform "," ease-out"])),n);return(0,o.iv)(Be||(Be=Oe(["\n #frame {\n position: relative;\n overflow: hidden;\n }\n\n #frame.fullscreen,\n #frame.fullscreen #reader {\n height: 100vh;\n }\n\n button {\n cursor: pointer;\n padding: 0;\n border: 0;\n }\n\n button:focus,\n button:active {\n outline: none;\n }\n\n .menu-and-reader {\n position: relative;\n }\n\n nav button {\n background: none;\n }\n\n nav .minimized {\n background: rgba(0, 0, 0, .7);\n border-bottom-right-radius: 5%;\n position: absolute;\n padding-top: .6rem;\n left: 0;\n width: 4rem;\n z-index: 2;\n }\n\n nav .minimized button {\n width: var(--iconWidth);\n height: var(--iconHeight);\n margin: auto;\n display: inline-flex;\n vertical-align: middle;\n -webkit-box-align: center;\n align-items: center;\n -webkit-box-pack: center;\n justify-content: center;\n width: 4rem;\n height: 4rem;\n }\n\n nav .minimized button.toggle-menu > * {\n border: 2px solid var(--iconStrokeColor);\n border-radius: var(--iconWidth);\n width: var(--iconWidth);\n height: var(--iconHeight);\n margin: auto;\n }\n\n #menu {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n z-index: 3;\n overflow: hidden;\n transform: translateX(-",");\n width: ",";\n transform: translateX(calc("," * -1));\n transition: ",";\n }\n\n #reader {\n position: relative;\n z-index: 1;\n transition: ",";\n transform: translateX(0);\n width: 100%;\n }\n\n .open #menu {\n width: ",";\n transform: translateX(0);\n transition: ",";\n }\n\n "," {\n .open #reader {\n transition: ",";\n transform: translateX(",");\n width: calc(100% - ",");\n }\n }\n\n #loading-indicator {\n display: none;\n }\n\n #loading-indicator.visible {\n display: block;\n }\n "])),e,e,e,r,r,e,r,t,r,e,e)}}],(n=[{key:"showItemNavigatorModal",value:function(e){var t=e.detail;this.modal.showModal({config:this.modalConfig,customModalContent:t.customModalContent})}},{key:"closeItemNavigatorModal",value:function(){this.modal.closeModal()}},{key:"manageViewportFullscreen",value:function(e){var t=e.detail.isFullScreen;this.viewportInFullscreen=t}},{key:"manageSideMenuEvents",value:function(e){var t=e.detail,n=t.action,o=void 0===n?"":n,r=t.menuId,i=void 0===r?"":r;if(i)switch(o){case"open":this.openShortcut(i);break;case"toggle":this.openMenu=i,this.toggleMenu();break;default:this.closeMenu()}}},{key:"toggleMenu",value:function(){this.menuOpened=!this.menuOpened}},{key:"closeMenu",value:function(){this.menuOpened=!1}},{key:"openShortcut",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.openMenu=e,this.menuOpened=!0}},{key:"setOpenMenu",value:function(e){var t=e.detail.id;this.openMenu=t===this.openMenu?"":t}},{key:"setMenuContents",value:function(e){var t=e.detail;this.menuContents=Ie(t)}},{key:"setMenuShortcuts",value:function(e){var t=e.detail;this.menuShortcuts=Ie(t)}},{key:"menuClass",get:function(){var e=this.menuOpened?"open":"",t=this.viewportInFullscreen?"fullscreen":"";return"".concat(e," ").concat(t)}},{key:"menuToggleButton",get:function(){return(0,o.dy)(fe||(fe=Oe(['\n <button class="toggle-menu" @click=','>\n <div>\n <ia-icon icon="ellipses" style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon>\n </div>\n </button>\n '])),this.toggleMenu.bind(this))}},{key:"menuSlider",get:function(){return(0,o.dy)(pe||(pe=Oe(['\n <div id="menu">\n <ia-menu-slider\n .menus=',"\n .open=","\n .selectedMenu=","\n @menuTypeSelected=","\n @menuSliderClosed=","\n ?manuallyHandleClose=","\n ?animateMenuOpen=","\n ></ia-menu-slider>\n </div>\n "])),this.menuContents,!0,this.openMenu,this.setOpenMenu,this.closeMenu,!0,!1)}},{key:"shortcuts",get:function(){var e=this,t=this.menuShortcuts.map((function(t){var n=t.icon,r=t.id;return(0,o.dy)(me||(me=Oe(['\n <button class="shortcut ','" @click="','">\n ',"\n </button>\n "])),r,(function(t){e.openShortcut(r)}),n)}));return(0,o.dy)(ve||(ve=Oe(['<div class="shortcuts">',"</div>"])),t)}},{key:"renderSideMenu",get:function(){return(0,o.dy)(be||(be=Oe(['\n <nav>\n <div class="minimized">\n ',"\n ","\n </div>\n ","\n </nav>\n "])),this.shortcuts,this.menuToggleButton,this.menuSlider)}},{key:"renderViewport",get:function(){return"bookreader"===this.itemType?(0,o.dy)(ye||(ye=Oe(["\n <book-navigator\n .baseHost=","\n .book=","\n ?signedIn=","\n ?sideMenuOpen=","\n @ViewportInFullScreen=","\n @updateSideMenu=","\n @menuUpdated=","\n @menuShortcutsUpdated=","\n @showItemNavigatorModal=","\n @closeItemNavigatorModal=",'\n >\n <div slot="bookreader">\n <slot name="bookreader"></slot>\n </div>\n </book-navigator>\n '])),this.baseHost,this.item,this.signedIn,this.menuOpened,this.manageViewportFullscreen,this.manageSideMenuEvents,this.setMenuContents,this.setMenuShortcuts,this.showItemNavigatorModal,this.closeItemNavigatorModal):(0,o.dy)(ge||(ge=Oe(['<div class="viewport"></div>'])))}},{key:"renderModalManager",value:function(){this.modal=document.createElement("modal-manager"),this.modal.setAttribute("id","item-navigator-modal"),this.modalConfig=new te,this.modalConfig.title="Delete Bookmark",this.modalConfig.headline="This bookmark contains a note. Deleting it will permanently delete the note. Are you sure?",this.modalConfig.headerColor="#194880",document.body.appendChild(this.modal)}},{key:"render",value:function(){var e=this.menuContents.length||this.menuShortcuts.length;return(0,o.dy)(ke||(ke=Oe(['\n <div id="frame" class=','>\n <slot name="item-nav-header"></slot>\n <div class="menu-and-reader">\n ','\n <div id="reader">\n ',"\n </div>\n </div>\n </div>\n "])),this.menuClass,e?this.renderSideMenu:r.Ld,this.renderViewport)}}])&&De(t.prototype,n),i&&De(t,i),c}(o.oi);customElements.define("ia-icon",ee),customElements.define("ia-menu-slider",p),customElements.define("item-navigator",je),n(7941),n(7327),n(561),n(9826),n(5827),n(4747),n(9653);var Me,Pe=[],Ae="ResizeObserver loop completed with undelivered notifications.";!function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(Me||(Me={}));var Re,_e,$e,Ne,He,Fe=function(e){return Object.freeze(e)},Ze=function(e,t){this.inlineSize=e,this.blockSize=t,Fe(this)},We=function(){function e(e,t,n,o){return this.x=e,this.y=t,this.width=n,this.height=o,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Fe(this)}return e.prototype.toJSON=function(){var e=this;return{x:e.x,y:e.y,top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.width,height:e.height}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),qe=function(e){return e instanceof SVGElement&&"getBBox"in e},Ue=function(e){if(qe(e)){var t=e.getBBox(),n=t.width,o=t.height;return!n&&!o}var r=e,i=r.offsetWidth,a=r.offsetHeight;return!(i||a||e.getClientRects().length)},Ve=function(e){var t,n;if(e instanceof Element)return!0;var o=null===(n=null===(t=e)||void 0===t?void 0:t.ownerDocument)||void 0===n?void 0:n.defaultView;return!!(o&&e instanceof o.Element)},Ge="undefined"!=typeof window?window:{},Xe=new WeakMap,Ye=/auto|scroll/,Je=/^tb|vertical/,Qe=/msie|trident/i.test(Ge.navigator&&Ge.navigator.userAgent),Ke=function(e){return parseFloat(e||"0")},et=function(e,t,n){return void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=!1),new Ze((n?t:e)||0,(n?e:t)||0)},tt=Fe({devicePixelContentBoxSize:et(),borderBoxSize:et(),contentBoxSize:et(),contentRect:new We(0,0,0,0)}),nt=function(e,t){if(void 0===t&&(t=!1),Xe.has(e)&&!t)return Xe.get(e);if(Ue(e))return Xe.set(e,tt),tt;var n=getComputedStyle(e),o=qe(e)&&e.ownerSVGElement&&e.getBBox(),r=!Qe&&"border-box"===n.boxSizing,i=Je.test(n.writingMode||""),a=!o&&Ye.test(n.overflowY||""),s=!o&&Ye.test(n.overflowX||""),l=o?0:Ke(n.paddingTop),c=o?0:Ke(n.paddingRight),d=o?0:Ke(n.paddingBottom),u=o?0:Ke(n.paddingLeft),h=o?0:Ke(n.borderTopWidth),f=o?0:Ke(n.borderRightWidth),p=o?0:Ke(n.borderBottomWidth),m=u+c,v=l+d,b=(o?0:Ke(n.borderLeftWidth))+f,y=h+p,g=s?e.offsetHeight-y-e.clientHeight:0,k=a?e.offsetWidth-b-e.clientWidth:0,w=r?m+b:0,C=r?v+y:0,x=o?o.width:Ke(n.width)-w-k,S=o?o.height:Ke(n.height)-C-g,B=x+m+k+b,O=S+v+g+y,I=Fe({devicePixelContentBoxSize:et(Math.round(x*devicePixelRatio),Math.round(S*devicePixelRatio),i),borderBoxSize:et(B,O,i),contentBoxSize:et(x,S,i),contentRect:new We(u,l,x,S)});return Xe.set(e,I),I},ot=function(e,t,n){var o=nt(e,n),r=o.borderBoxSize,i=o.contentBoxSize,a=o.devicePixelContentBoxSize;switch(t){case Me.DEVICE_PIXEL_CONTENT_BOX:return a;case Me.BORDER_BOX:return r;default:return i}},rt=function(e){var t=nt(e);this.target=e,this.contentRect=t.contentRect,this.borderBoxSize=Fe([t.borderBoxSize]),this.contentBoxSize=Fe([t.contentBoxSize]),this.devicePixelContentBoxSize=Fe([t.devicePixelContentBoxSize])},it=function(e){if(Ue(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},at=function(){var e=1/0,t=[];Pe.forEach((function(n){if(0!==n.activeTargets.length){var o=[];n.activeTargets.forEach((function(t){var n=new rt(t.target),r=it(t.target);o.push(n),t.lastReportedSize=ot(t.target,t.observedBox),r<e&&(e=r)})),t.push((function(){n.callback.call(n.observer,o,n.observer)})),n.activeTargets.splice(0,n.activeTargets.length)}}));for(var n=0,o=t;n<o.length;n++)(0,o[n])();return e},st=function(e){Pe.forEach((function(t){t.activeTargets.splice(0,t.activeTargets.length),t.skippedTargets.splice(0,t.skippedTargets.length),t.observationTargets.forEach((function(n){n.isActive()&&(it(n.target)>e?t.activeTargets.push(n):t.skippedTargets.push(n))}))}))},lt=[],ct=0,dt={attributes:!0,characterData:!0,childList:!0,subtree:!0},ut=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],ht=function(e){return void 0===e&&(e=0),Date.now()+e},ft=!1,pt=new(function(){function e(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return e.prototype.run=function(e){var t=this;if(void 0===e&&(e=250),!ft){ft=!0;var n,o=ht(e);n=function(){var n=!1;try{n=function(){var e,t=0;for(st(t);Pe.some((function(e){return e.activeTargets.length>0}));)t=at(),st(t);return Pe.some((function(e){return e.skippedTargets.length>0}))&&("function"==typeof ErrorEvent?e=new ErrorEvent("error",{message:Ae}):((e=document.createEvent("Event")).initEvent("error",!1,!1),e.message=Ae),window.dispatchEvent(e)),t>0}()}finally{if(ft=!1,e=o-ht(),!ct)return;n?t.run(1e3):e>0?t.run(e):t.start()}},function(e){if(!Re){var t=0,n=document.createTextNode("");new MutationObserver((function(){return lt.splice(0).forEach((function(e){return e()}))})).observe(n,{characterData:!0}),Re=function(){n.textContent=""+(t?t--:t++)}}lt.push(e),Re()}((function(){requestAnimationFrame(n)}))}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var e=this,t=function(){return e.observer&&e.observer.observe(document.body,dt)};document.body?t():Ge.addEventListener("DOMContentLoaded",t)},e.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),ut.forEach((function(t){return Ge.addEventListener(t,e.listener,!0)})))},e.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),ut.forEach((function(t){return Ge.removeEventListener(t,e.listener,!0)})),this.stopped=!0)},e}()),mt=function(e){!ct&&e>0&&pt.start(),!(ct+=e)&&pt.stop()},vt=function(){function e(e,t){this.target=e,this.observedBox=t||Me.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var e,t=ot(this.target,this.observedBox,!0);return e=this.target,qe(e)||function(e){switch(e.tagName){case"INPUT":if("image"!==e.type)break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(e)||"inline"!==getComputedStyle(e).display||(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),bt=function(e,t){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=t},yt=new WeakMap,gt=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},kt=function(){function e(){}return e.connect=function(e,t){var n=new bt(e,t);yt.set(e,n)},e.observe=function(e,t,n){var o=yt.get(e),r=0===o.observationTargets.length;gt(o.observationTargets,t)<0&&(r&&Pe.push(o),o.observationTargets.push(new vt(t,n&&n.box)),mt(1),pt.schedule())},e.unobserve=function(e,t){var n=yt.get(e),o=gt(n.observationTargets,t),r=1===n.observationTargets.length;o>=0&&(r&&Pe.splice(Pe.indexOf(n),1),n.observationTargets.splice(o,1),mt(-1))},e.disconnect=function(e){var t=this,n=yt.get(e);n.observationTargets.slice().forEach((function(n){return t.unobserve(e,n.target)})),n.activeTargets.splice(0,n.activeTargets.length)},e}(),wt=function(){function e(e){if(0===arguments.length)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if("function"!=typeof e)throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");kt.connect(this,e)}return e.prototype.observe=function(e,t){if(0===arguments.length)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Ve(e))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");kt.observe(this,e,t)},e.prototype.unobserve=function(e){if(0===arguments.length)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Ve(e))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");kt.unobserve(this,e)},e.prototype.disconnect=function(){kt.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),Ct=(n(4723),n(4603),n(9714),n(5306),n(3161),n(4129),n(7552)),xt=new WeakMap,St=(0,r.XM)((function(e){return function(t){if(!(t instanceof r.nt))throw new Error("unsafeHTML can only be used in text bindings");var n=xt.get(t);if(void 0===n||!(0,Ct.pt)(e)||e!==n.value||t.value!==n.fragment){var o=document.createElement("template");o.innerHTML=e;var i=document.importNode(o.content,!0);t.setValue(i),xt.set(t,{value:e,fragment:i})}}}));function Bt(e){return(Bt="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})(e)}function Ot(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function It(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function zt(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Dt(e,t){return(Dt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Lt(e,t){if(t&&("object"===Bt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Tt(e){return(Tt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Et,jt=function(e){!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}}),t&&Dt(e,t)}(c,e);var t,n,i,a,s,l=(a=c,s=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=Tt(a);if(s){var n=Tt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Lt(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.call(this)).matchRegex=new RegExp("{{{(.+?)}}}","g"),e}return t=c,i=[{key:"properties",get:function(){return{match:{type:Object}}}}],(n=[{key:"createRenderRoot",value:function(){return this}},{key:"highlightedHit",value:function(e){return(0,o.dy)(_e||(_e=It(["\n <p>","</p>\n "])),St(e.replace(this.matchRegex,"<mark>$1</mark>")))}},{key:"resultSelected",value:function(){this.dispatchEvent(new CustomEvent("resultSelected",{bubbles:!0,composed:!0,detail:{match:this.match}}))}},{key:"render",value:function(){var e,t,n=this.match,i=n.par,a=(e=void 0===i?[]:i,t=1,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ot(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ot(e,t):void 0}}(e,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.")}())[0],s=void 0===a?{}:a,l=Number.isInteger(s.page)?(0,o.dy)($e||($e=It(['<p class="page-num">Page -',"-</p>"])),s.page):r.Ld,c=(0,o.dy)(Ne||(Ne=It(['<img src="','" />'])),n.cover);return(0,o.dy)(He||(He=It(["\n <li @click=",">\n ","\n <h4>","</h4>\n ","\n ","\n </li>\n "])),this.resultSelected,n.cover?c:r.Ld,n.title||r.Ld,l,this.highlightedHit(n.text))}}])&&zt(t.prototype,n),i&&zt(t,i),c}(o.oi);customElements.define("book-search-result",jt);var Mt,Pt,At,Rt,_t,$t,Nt,Ht,Ft,Zt,Wt,qt,Ut,Vt,Gt,Xt,Yt,Jt,Qt,Kt=(0,o.iv)(Et||(Mt=["data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEwIiB2aWV3Qm94PSIwIDAgMTMgMTAiIHdpZHRoPSIxMyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtNC4zMzMzMzMzMyAxMC00LjMzMzMzMzMzLTQuMTY2NjY2NjcgMS43MzMzMzMzMy0xLjY2NjY2NjY2IDIuNiAyLjUgNi45MzMzMzMzNy02LjY2NjY2NjY3IDEuNzMzMzMzMyAxLjY2NjY2NjY3eiIgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIi8+PC9zdmc+"],Pt||(Pt=Mt.slice(0)),Et=Object.freeze(Object.defineProperties(Mt,{raw:{value:Object.freeze(Pt)}})))),en=(0,o.iv)(At||(At=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNDAgNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgYXJpYS1sYWJlbGxlZGJ5PSJjbG9zZVRpdGxlSUQgY2xvc2VEZXNjSUQiPjxwYXRoIGQ9Ik0yOS4xOTIgMTAuODA4YTEuNSAxLjUgMCAwMTAgMi4xMkwyMi4xMjIgMjBsNy4wNyA3LjA3MmExLjUgMS41IDAgMDEtMi4xMiAyLjEyMWwtNy4wNzMtNy4wNy03LjA3IDcuMDdhMS41IDEuNSAwIDAxLTIuMTIxLTIuMTJsNy4wNy03LjA3My03LjA3LTcuMDdhMS41IDEuNSAwIDAxMi4xMi0yLjEyMUwyMCAxNy44NzhsNy4wNzItNy4wN2ExLjUgMS41IDAgMDEyLjEyMSAweiIgY2xhc3M9ImZpbGwtY29sb3IiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg=="]))),tn=(0,o.iv)(Rt||(Rt=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n .ia-button {\n min-height: 3rem;\n border: none;\n outline: none;\n cursor: pointer;\n color: var(--primaryTextColor);\n line-height: normal;\n border-radius: .4rem;\n text-align: center;\n vertical-align: middle;\n font-size: 1.4rem;\n display: inline-block;\n padding: .6rem 1.2rem;\n border: 1px solid transparent;\n\n white-space: nowrap;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -o-user-select: none;\n user-select: none;\n }\n\n .ia-button.link,\n .ia-button.external {\n min-height: unset;\n text-decoration: none;\n }\n\n .ia-button:disabled,\n .ia-button.disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n .ia-button.transparent {\n background-color: transparent;\n }\n \n .ia-button.slim {\n padding: 0;\n }\n\n .ia-button.primary {\n background-color: var(--primaryCTAFill);\n border-color: var(--primaryCTABorder);\n }\n\n .ia-button.cancel {\n background-color: var(--primaryErrorCTAFill);\n border-color: var(--primaryErrorCTABorder);\n }\n\n .ia-button.external {\n background: var(--secondaryCTAFill);\n border-color: var(--secondaryCTABorder);\n }\n"])));function nn(e){return(nn="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})(e)}function on(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function rn(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function an(e,t){return(an=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function sn(e,t){if(t&&("object"===nn(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function ln(e){return(ln=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var cn,dn,un,hn,fn=function(e){!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}}),t&&an(e,t)}(c,e);var t,n,i,a,s,l=(a=c,s=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=ln(a);if(s){var n=ln(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return sn(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.call(this)).results=[],e.query="",e.queryInProgress=!1,e.renderHeader=!1,e.renderSearchAllFields=!1,e.displayResultImages=!1,e.errorMessage="",e.bindBookReaderListeners(),e}return t=c,i=[{key:"properties",get:function(){return{results:{type:Array},query:{type:String},queryInProgress:{type:Boolean},renderHeader:{type:Boolean},renderSearchAllFiles:{type:Boolean},displayResultImages:{type:Boolean},errorMessage:{type:String}}}},{key:"styles",get:function(){var e=(0,o.iv)(Gt||(Gt=on(["var(--searchResultText, #adaedc)"]))),t=(0,o.iv)(Xt||(Xt=on(["var(--searchResultBg, #272958)"]))),n=(0,o.iv)(Yt||(Yt=on(["var(--searchResultBorder, #adaedc)"]))),r=(0,o.iv)(Jt||(Jt=on(["(--tertiaryBGColor, #333)"]))),i=(0,o.iv)(Qt||(Qt=on(["\n :host {\n display: block;\n height: 100%;\n padding: 1.5rem 1rem 2rem 0;\n overflow-y: auto;\n font-size: 1.4rem;\n box-sizing: border-box;\n }\n\n mark {\n padding: 0 .2rem;\n color: ",";\n background: ",";\n border: 1px solid ",';\n border-radius: 2px;\n }\n\n h3 {\n padding: 0;\n margin: 0 1rem 0 0;\n font-size: 2rem;\n }\n\n header {\n display: flex;\n align-items: center;\n padding: 0 2rem 0 0;\n }\n header p {\n padding: 0;\n margin: 0;\n font-size: 1.2rem;\n font-weight: bold;\n font-style: italic;\n }\n\n fieldset {\n padding: 0 0 1rem 0;\n border: none;\n }\n\n [type="checkbox"] {\n display: none;\n }\n\n label {\n display: block;\n text-align: center;\n }\n\n label.checkbox {\n padding-bottom: .5rem;\n font-size: 1.6rem;\n line-height: 150%;\n vertical-align: middle;\n }\n\n label.checkbox:after {\n display: inline-block;\n width: 14px;\n height: 14px;\n margin-left: .7rem;\n content: "";\n border-radius: 2px;\n }\n :checked + label.checkbox:after {\n background-image: url(\'','\');\n }\n\n label.checkbox[for="all_files"]:after {\n background: ',' 50% 50% no-repeat;\n border: 1px solid var(--primaryTextColor);\n }\n\n [type="search"] {\n color: var(--primaryTextColor);\n border: 1px solid var(--primaryTextColor);\n -webkit-appearance: textfield;\n width: 100%;\n height: 3rem;\n padding: 0 1.5rem;\n box-sizing: border-box;\n font: normal 1.6rem "Helvetica qNeue", Helvetica, Arial, sans-serif;\n border-radius: 1.5rem;\n background: transparent;\n }\n [type="search"]:focus {\n outline: none;\n }\n [type="search"]::-webkit-search-cancel-button {\n width: 18px;\n height: 18px;\n -webkit-appearance: none;\n appearance: none;\n -webkit-mask: url(\'',"') 0 0 no-repeat;\n mask: url('","') 0 0 no-repeat;\n -webkit-mask-size: 100%;\n mask-size: 100%;\n background: #fff;\n }\n\n p.page-num {\n font-weight: bold;\n padding-bottom: 0;\n }\n\n p.search-cta {\n text-align: center;\n }\n\n .results-container {\n padding-bottom: 2rem;\n }\n\n ul {\n padding: 0 0 2rem 0;\n margin: 0;\n list-style: none;\n }\n\n ul.show-image li {\n display: grid;\n }\n\n li {\n cursor: pointer;\n grid-template-columns: 30px 1fr;\n grid-gap: 0 .5rem;\n }\n\n li img {\n display: block;\n width: 100%;\n }\n\n li h4 {\n grid-column: 2 / 3;\n padding: 0 0 2rem 0;\n margin: 0;\n font-weight: normal;\n }\n\n li p {\n grid-column: 2 / 3;\n padding: 0 0 1.5rem 0;\n margin: 0;\n font-size: 1.2rem;\n }\n\n .loading {\n text-align: center;\n }\n\n .loading p {\n padding: 0 0 1rem 0;\n margin: 0;\n font-size: 1.2rem;\n }\n\n ia-activity-indicator {\n display: block;\n width: 40px;\n height: 40px;\n margin: 0 auto;\n }\n "])),e,t,n,Kt,r,en,en);return[tn,i]}}],(n=[{key:"updated",value:function(){this.focusOnInputIfNecessary()}},{key:"bindBookReaderListeners",value:function(){document.addEventListener("BookReader:SearchCallback",this.setResults.bind(this))}},{key:"focusOnInputIfNecessary",value:function(){this.results.length||this.shadowRoot.querySelector("input[type='search']").focus()}},{key:"setResults",value:function(e){var t=e.detail;this.results=t.results}},{key:"setQuery",value:function(e){this.query=e.currentTarget.value}},{key:"performSearch",value:function(e){e.preventDefault();var t=e.currentTarget.querySelector('input[type="search"]');t&&t.value&&this.dispatchEvent(new CustomEvent("bookSearchInitiated",{bubbles:!0,composed:!0,detail:{query:this.query}}))}},{key:"selectResult",value:function(){this.dispatchEvent(new CustomEvent("closeMenu",{bubbles:!0,composed:!0}))}},{key:"cancelSearch",value:function(){this.queryInProgress=!1,this.dispatchSearchCanceled()}},{key:"dispatchSearchCanceled",value:function(){this.dispatchEvent(new Event("bookSearchCanceled"))}},{key:"resultsCount",get:function(){var e=this.results.length;return e?(0,o.dy)(_t||(_t=on(["<p>("," result",")</p>"])),e,e>1?"s":""):r.Ld}},{key:"headerSection",get:function(){var e=(0,o.dy)($t||($t=on(["<header>\n <h3>Search inside</h3>\n ","\n </header>"])),this.resultsCount);return this.renderHeader?e:r.Ld}},{key:"searchMultipleControls",get:function(){var e=(0,o.dy)(Nt||(Nt=on(['\n <input name="all_files" id="all_files" type="checkbox" />\n <label class="checkbox" for="all_files">Search all files</label>\n '])));return this.renderSearchAllFiles?e:r.Ld}},{key:"loadingIndicator",get:function(){return(0,o.dy)(Ht||(Ht=on(['\n <div class="loading">\n <ia-activity-indicator mode="processing"></ia-activity-indicator>\n <p>Searching</p>\n <button class="ia-button external cancel-search" @click=',">Cancel</button>\n </div>\n "])),this.cancelSearch)}},{key:"resultsSet",get:function(){var e=this,t=this.displayResultImages?"show-image":"";return(0,o.dy)(Ft||(Ft=on(['\n <ul class="results ','">\n ',"\n </ul>\n "])),t,this.results.map((function(t){return(0,o.dy)(Zt||(Zt=on(["\n <book-search-result\n .match=","\n @resultSelected=","\n ></book-search-result>\n "])),t,e.selectResult)})))}},{key:"searchForm",get:function(){return(0,o.dy)(Wt||(Wt=on(['\n <form action="" method="get" @submit=',">\n <fieldset>\n ",'\n <input\n type="search"\n name="query"\n alt="Search inside this book."\n @keyup=',"\n .value=","\n />\n </fieldset>\n </form>\n "])),this.performSearch,this.searchMultipleControls,this.setQuery,this.query)}},{key:"setErrorMessage",get:function(){return(0,o.dy)(qt||(qt=on(['\n <p class="error-message">',"</p>\n "])),this.errorMessage)}},{key:"searchCTA",get:function(){return(0,o.dy)(Ut||(Ut=on(['<p class="search-cta"><em>Please enter text to search for</em></p>'])))}},{key:"render",value:function(){var e=!(this.queryInProgress||this.errorMessage||this.queryInProgress||this.results.length);return(0,o.dy)(Vt||(Vt=on(["\n ","\n ",'\n <div class="results-container">\n ',"\n ","\n ","\n ","\n </div>\n "])),this.headerSection,this.searchForm,this.queryInProgress?this.loadingIndicator:r.Ld,this.errorMessage?this.setErrorMessage:r.Ld,this.results.length?this.resultsSet:r.Ld,e?this.searchCTA:r.Ld)}}])&&rn(t.prototype,n),i&&rn(t,i),c}(o.oi);function pn(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function mn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vn(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}customElements.define("ia-book-search-results",fn);var bn,yn,gn,kn,wn,Cn,xn,Sn,Bn,On,In,zn={query:"",results:[],resultsCount:0,queryInProgress:!1,errorMessage:""},Dn=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},n=arguments.length>1?arguments[1]:void 0;mn(this,e),this.onBookSearchInitiated=this.onBookSearchInitiated.bind(this),this.onSearchStarted=this.onSearchStarted.bind(this),this.onSearchRequestError=this.onSearchRequestError.bind(this),this.onSearchResultsClicked=this.onSearchResultsClicked.bind(this),this.onSearchResultsChange=this.onSearchResultsChange.bind(this),this.onSearchResultsCleared=this.onSearchResultsCleared.bind(this),this.searchCanceledInMenu=this.searchCanceledInMenu.bind(this),this.bindEventListeners=this.bindEventListeners.bind(this),this.getMenuDetails=this.getMenuDetails.bind(this),this.getComponent=this.getComponent.bind(this),this.advanceToPage=this.advanceToPage.bind(this),this.updateMenu=this.updateMenu.bind(this),this.onSearchChange=t,this.bookreader=n,this.icon=(0,o.dy)(cn||(cn=pn(['<ia-icon icon="search" style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon>']))),this.label="Search inside",this.menuDetails=this.getMenuDetails(),this.id="search",this.component=this.getComponent(),this.bindEventListeners()}var t,n;return t=e,(n=[{key:"getMenuDetails",value:function(){var e=zn,t=e.resultsCount,n=e.query;if(e.queryInProgress||!n)return r.Ld;var i=1===t?"result":"results";return(0,o.dy)(dn||(dn=pn(["("," ",")"])),t,i)}},{key:"bindEventListeners",value:function(){var e=this;window.addEventListener("BookReader:SearchStarted",this.onSearchStarted),window.addEventListener("BookReader:SearchCallback",this.onSearchResultsChange),window.addEventListener("BookReader:SearchCallbackEmpty",(function(t){e.onSearchRequestError(t,"noResults")})),window.addEventListener("BookReader:SearchCallbackNotIndexed",(function(t){e.onSearchRequestError(t,"notIndexed")})),window.addEventListener("BookReader:SearchCallbackError",(function(t){e.onSearchRequestError(t)})),window.addEventListener("BookReader:SearchResultsCleared",(function(){e.onSearchResultsCleared()})),window.addEventListener("BookReader:SearchCanceled",(function(t){e.onSearchCanceled(t)}))}},{key:"onSearchCanceled",value:function(){zn={query:"",results:[],resultsCount:0,queryInProgress:!1,errorMessage:""},this.updateMenu({searchCanceled:!0})}},{key:"onSearchStarted",value:function(e){var t=e.detail.props.term,n=void 0===t?"":t;zn.query=n,zn.results=[],zn.resultsCount=0,zn.queryInProgress=!0,zn.errorMessage="",this.updateMenu()}},{key:"onBookSearchInitiated",value:function(e){var t=e.detail;zn.query=t.query,this.bookreader.search(zn.query)}},{key:"onSearchRequestError",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",r=e.detail.props,i=void 0===r?{}:r,a=i.instance,s=void 0===a?null:a;s&&(this.bookreader=s);var l={noResults:"0 results",notIndexed:"This book hasn't been indexed for searching yet. We've just started indexing it,\n so search should be available soon. Please try again later. Thanks!",default:"Sorry, there was an error with your search. Please try again."},c=null!==(t=l[n])&&void 0!==t?t:l.default;zn.results=[],zn.resultsCount=0,zn.queryInProgress=!1,zn.errorMessage=(0,o.dy)(un||(un=pn(['<p class="error">',"</p>"])),c),this.updateMenu()}},{key:"onSearchResultsChange",value:function(e){var t=e.detail.props,n=void 0===t?{}:t,o=n.instance,r=void 0===o?null:o,i=n.results,a=void 0===i?[]:i;r&&(this.bookreader=r);var s=a.matches||[],l=s.length,c=a.q;zn={results:s,resultsCount:l,query:c,queryInProgress:!1,errorMessage:""},this.updateMenu()}},{key:"searchCanceledInMenu",value:function(){var e;null===(e=this.bookreader)||void 0===e||e.cancelSearchRequest()}},{key:"onSearchResultsCleared",value:function(){var e,t;zn={query:"",results:[],resultsCount:0,queryInProgress:!1,errorMessage:""},this.updateMenu(),null===(e=this.bookreader)||void 0===e||null===(t=e.searchView)||void 0===t||t.clearSearchFieldAndResults()}},{key:"updateMenu",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.menuDetails=this.getMenuDetails(),this.component=this.getComponent(),this.onSearchChange(this.bookreader,e)}},{key:"getComponent",value:function(){var e=zn,t=e.query,n=e.results,r=e.queryInProgress,i=e.errorMessage;return(0,o.dy)(hn||(hn=pn(["\n <ia-book-search-results\n .query=","\n .results=","\n .errorMessage=","\n ?queryInProgress=","\n ?renderSearchAllFiles=","\n @resultSelected=","\n @bookSearchInitiated=","\n @bookSearchResultsCleared=","\n @bookSearchCanceled=","\n ></ia-book-search-results>\n "])),t,n,i,r,!1,this.onSearchResultsClicked,this.onBookSearchInitiated,this.onSearchResultsCleared,this.searchCanceledInMenu)}},{key:"onSearchResultsClicked",value:function(e){var t=e.detail.match.par[0].page;this.advanceToPage(t)}},{key:"advanceToPage",value:function(e){var t=this.bookreader.leafNumToIndex(e);this.bookreader._searchPluginGoToResult(t)}}])&&vn(t.prototype,n),e}();function Ln(e){return(Ln="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})(e)}function Tn(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function En(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function jn(e,t){return(jn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Mn(e,t){if(t&&("object"===Ln(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Pn(e){return(Pn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n(9601);var An,Rn,_n=function(e){!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}}),t&&jn(e,t)}(c,e);var t,n,i,a,s,l=(a=c,s=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=Pn(a);if(s){var n=Pn(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Mn(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.call(this)).downloads=[],e.expiration=0,e.renderHeader=!1,e.isBookProtected=!1,e}return t=c,i=[{key:"properties",get:function(){return{downloads:{type:Array},expiration:{type:Number},renderHeader:{type:Boolean},isBookProtected:{type:Boolean}}}},{key:"styles",get:function(){var e=(0,o.iv)(In||(In=Tn(["\n :host {\n display: block;\n height: 100%;\n padding: 1.5rem 0;\n overflow-y: auto;\n font-size: 1.4rem;\n box-sizing: border-box;\n }\n\n a.close ia-icon {\n --iconWidth: 18px;\n --iconHeight: 18px;\n }\n a.close {\n justify-self: end;\n }\n\n header {\n display: flex;\n align-items: center;\n padding: 0 2rem;\n }\n header p {\n padding: 0;\n margin: 0;\n font-size: 1.2rem;\n font-weight: bold;\n font-style: italic;\n }\n header div {\n display: flex;\n align-items: baseline;\n } \n\n h2 {\n font-size: 1.6rem;\n }\n\n h3 {\n padding: 0;\n margin: 0 1rem 0 0;\n font-size: 1.4rem;\n }\n\n ul {\n padding: 0;\n margin: 0;\n list-style: none;\n }\n\n p {\n margin: .3rem 0 0 0;\n }\n\n li,\n ul + p {\n padding-bottom: 1.2rem;\n font-size: 1.2rem;\n line-height: 140%;\n }\n "])));return[tn,e]}}],(n=[{key:"formatsCount",get:function(){var e=this.downloads.length;return e?(0,o.dy)(bn||(bn=Tn(["<p>"," format","</p>"])),e,e>1?"s":""):(0,o.dy)(yn||(yn=Tn([""])))}},{key:"loanExpiryMessage",get:function(){return this.expiration?(0,o.dy)(gn||(gn=Tn(["<h2>These files will expire in "," days.</h2>"])),this.expiration):(0,o.dy)(kn||(kn=Tn([""])))}},{key:"renderDownloadOptions",value:function(){return this.downloads.map((function(e){return(0,o.dy)(wn||(wn=Tn(['\n <li>\n <a class="ia-button link primary" href="','">Get ',"</a>\n ","\n </li>\n "])),e.url,e.type,e.note?(0,o.dy)(Cn||(Cn=Tn(["<p>","</p>"])),e.note):(0,o.dy)(xn||(xn=Tn([""]))))}))}},{key:"header",get:function(){return this.renderHeader?(0,o.dy)(Sn||(Sn=Tn(["\n <header>\n <h3>Downloadable files</h3>\n ","\n </header>\n "])),this.formatsCount):r.Ld}},{key:"accessProtectedBook",get:function(){return(0,o.dy)(Bn||(Bn=Tn(['\n <p>To access downloaded books, you need Adobe-compliant software on your device. The Internet Archive will administer this loan, but Adobe may also collect some information.</p>\n <a class="ia-button external primary" href="https://www.adobe.com/solutions/ebook/digital-editions/download.html" rel="noopener noreferrer" target="_blank">Install Adobe Digital Editions</a>\n '])))}},{key:"render",value:function(){return(0,o.dy)(On||(On=Tn(["\n ","\n ","\n <ul>","</ul>\n ","\n "])),this.header,this.loanExpiryMessage,this.renderDownloadOptions(),this.isBookProtected?this.accessProtectedBook:r.Ld)}}])&&En(t.prototype,n),i&&En(t,i),c}(o.oi);function $n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Nn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nn(e,t):void 0}}(e,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.")}()}function Nn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Hn(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Fn(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}customElements.define("ia-book-downloads",_n);var Zn={pdf:{type:"Encrypted Adobe PDF",url:"#",note:"PDF files contain high quality images of pages."},epub:{type:"Encrypted Adobe ePub",url:"#",note:"ePub files are smaller in size, but may contain errors."}},Wn={pdf:"PDF",epub:"ePub"},qn=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.icon=(0,o.dy)(An||(An=Hn(['<ia-icon icon="download" style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon>']))),this.label="Downloadable files",this.menuDetails="",this.downloads=[],this.id="downloads",this.component="",this.isBookProtected=t,this.computeAvailableTypes=this.computeAvailableTypes.bind(this),this.update=this.update.bind(this)}var t,n;return t=e,(n=[{key:"update",value:function(e){this.computeAvailableTypes(e),this.component=this.menu,this.component.isBookProtected=this.isBookProtected;var t=1===this.downloads.length?"":"s";this.menuDetails="(".concat(this.downloads.length," format").concat(t,")")}},{key:"computeAvailableTypes",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=t.reduce((function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=$n(n,2),r=o[0],i=void 0===r?"":r,a=o[1],s=void 0===a?"":a,l=i.toLowerCase(),c=Zn[l]||null;if(c){var d=e.isBookProtected?Zn[l].type:Wn[l],u=Object.assign({},c,{url:s,type:d});t.push(u)}return t}),[]);this.downloads=n}},{key:"menu",get:function(){return(0,o.dy)(Rn||(Rn=Hn(["<ia-book-downloads .downloads=","></ia-book-downloads>"])),this.downloads)}}])&&Fn(t.prototype,n),e}();function Un(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}n(9600),n(1532);var Vn,Gn,Xn,Yn,Jn,Qn,Kn,eo=function(e,t){var n=e.startNode.parentNode,o=void 0===t?e.endNode:t.startNode,i=n.insertBefore((0,r.IW)(),o);n.insertBefore((0,r.IW)(),o);var a=new r.nt(e.options);return a.insertAfterNode(i),a},to=function(e,t){return e.setValue(t),e.commit(),e},no=function(e,t,n){var o=e.startNode.parentNode,i=n?n.startNode:e.endNode,a=t.endNode.nextSibling;a!==i&&(0,r.V)(o,t.startNode,a,i)},oo=function(e){(0,r.r4)(e.startNode.parentNode,e.startNode,e.endNode.nextSibling)},ro=function(e,t,n){for(var o=new Map,r=t;r<=n;r++)o.set(e[r],r);return o},io=new WeakMap,ao=new WeakMap,so=(0,r.XM)((function(e,t,n){var o;return void 0===n?n=t:void 0!==t&&(o=t),function(t){if(!(t instanceof r.nt))throw new Error("repeat can only be used in text bindings");var i,a,s,l=io.get(t)||[],c=ao.get(t)||[],d=[],u=[],h=[],f=0,p=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Un(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Un(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,r=function(){};return{s:r,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:r}}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,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(e);try{for(p.s();!(i=p.n()).done;){var m=i.value;h[f]=o?o(m,f):f,u[f]=n(m,f),f++}}catch(e){p.e(e)}finally{p.f()}for(var v=0,b=l.length-1,y=0,g=u.length-1;v<=b&&y<=g;)if(null===l[v])v++;else if(null===l[b])b--;else if(c[v]===h[y])d[y]=to(l[v],u[y]),v++,y++;else if(c[b]===h[g])d[g]=to(l[b],u[g]),b--,g--;else if(c[v]===h[g])d[g]=to(l[v],u[g]),no(t,l[v],d[g+1]),v++,g--;else if(c[b]===h[y])d[y]=to(l[b],u[y]),no(t,l[b],l[v]),b--,y++;else if(void 0===a&&(a=ro(h,y,g),s=ro(c,v,b)),a.has(c[v]))if(a.has(c[b])){var k=s.get(h[y]),w=void 0!==k?l[k]:null;if(null===w){var C=eo(t,l[v]);to(C,u[y]),d[y]=C}else d[y]=to(w,u[y]),no(t,w,l[v]),l[k]=null;y++}else oo(l[b]),b--;else oo(l[v]),v++;for(;y<=g;){var x=eo(t,d[g+1]);to(x,u[y]),d[y++]=x}for(;v<=b;){var S=l[v++];null!==S&&oo(S)}io.set(t,d),ao.set(t,h)}}));class lo extends o.oi{static get styles(){return o.iv`
1152
+ `}};function he(e){return(he="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})(e)}var fe,pe,me,ve,be,ye,ge,ke,we,Ce,xe,Se,Be;function Oe(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Ie(e){return function(e){if(Array.isArray(e))return ze(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return ze(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ze(e,t):void 0}}(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.")}()}function ze(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function De(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Le(e,t){return(Le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Te(e,t){if(t&&("object"===he(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Ee(e){return(Ee=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}ne([(0,o.Cb)({type:String,reflect:!0})],ue.prototype,"mode",void 0),ne([(0,o.Cb)({type:Object})],ue.prototype,"customModalContent",void 0),ne([(0,o.Cb)({type:Object})],ue.prototype,"hostBridge",void 0),ne([(0,o.IO)("modal-template")],ue.prototype,"modalTemplate",void 0),ue=ne([(0,o.Mo)("modal-manager")],ue);var je=function(e){!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}}),t&&Le(e,t)}(c,e);var t,n,i,a,s,l=(a=c,s=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=Ee(a);if(s){var n=Ee(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Te(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.call(this)).baseHost="archive.org",e.item={},e.itemType="",e.menuOpened=!1,e.signedIn=!1,e.menuShortcuts=[],e.menuContents=[],e.viewportInFullscreen=!1,e.openMenu="",e.renderModalManager(),e}return t=c,i=[{key:"properties",get:function(){return{baseHost:{type:String},item:{type:Object,converter:function(e){return e?JSON.parse(atob(e)):{}}},itemType:{type:String},menuShortcuts:{type:Array,hasChanged:function(e,t){return e!==t}},menuOpened:{type:Boolean},menuContents:{type:Array},openMenu:{type:String},signedIn:{type:Boolean,converter:function(e){return"boolean"==typeof e?e:"true"===e}},viewportInFullscreen:{type:Boolean}}}},{key:"styles",get:function(){var e=(0,o.iv)(we||(we=Oe(["var(--menuWidth, 320px)"]))),t=(0,o.iv)(Ce||(Ce=Oe(["@media (min-width: 640px)"]))),n=(0,o.iv)(xe||(xe=Oe(["var(--animationTiming, 200ms)"]))),r=(0,o.iv)(Se||(Se=Oe(["transform "," ease-out"])),n);return(0,o.iv)(Be||(Be=Oe(["\n #frame {\n position: relative;\n overflow: hidden;\n color-scheme: dark;\n }\n\n #frame.fullscreen,\n #frame.fullscreen #reader {\n height: 100vh;\n }\n\n button {\n cursor: pointer;\n padding: 0;\n border: 0;\n }\n\n button:focus,\n button:active {\n outline: none;\n }\n\n .menu-and-reader {\n position: relative;\n }\n\n nav button {\n background: none;\n }\n\n nav .minimized {\n background: rgba(0, 0, 0, .7);\n border-bottom-right-radius: 5%;\n position: absolute;\n padding-top: .6rem;\n left: 0;\n width: 4rem;\n z-index: 2;\n }\n\n nav .minimized button {\n width: var(--iconWidth);\n height: var(--iconHeight);\n margin: auto;\n display: inline-flex;\n vertical-align: middle;\n -webkit-box-align: center;\n align-items: center;\n -webkit-box-pack: center;\n justify-content: center;\n width: 4rem;\n height: 4rem;\n }\n\n nav .minimized button.toggle-menu > * {\n border: 2px solid var(--iconStrokeColor);\n border-radius: var(--iconWidth);\n width: var(--iconWidth);\n height: var(--iconHeight);\n margin: auto;\n }\n\n #menu {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n z-index: 3;\n overflow: hidden;\n transform: translateX(-",");\n width: ",";\n transform: translateX(calc("," * -1));\n transition: ",";\n }\n\n #reader {\n position: relative;\n z-index: 1;\n transition: ",";\n transform: translateX(0);\n width: 100%;\n }\n\n .open #menu {\n width: ",";\n transform: translateX(0);\n transition: ",";\n }\n\n "," {\n .open #reader {\n transition: ",";\n transform: translateX(",");\n width: calc(100% - ",");\n }\n }\n\n #loading-indicator {\n display: none;\n }\n\n #loading-indicator.visible {\n display: block;\n }\n "])),e,e,e,r,r,e,r,t,r,e,e)}}],(n=[{key:"showItemNavigatorModal",value:function(e){var t=e.detail;this.modal.showModal({config:this.modalConfig,customModalContent:t.customModalContent})}},{key:"closeItemNavigatorModal",value:function(){this.modal.closeModal()}},{key:"manageViewportFullscreen",value:function(e){var t=e.detail.isFullScreen;this.viewportInFullscreen=t}},{key:"manageSideMenuEvents",value:function(e){var t=e.detail,n=t.action,o=void 0===n?"":n,r=t.menuId,i=void 0===r?"":r;if(i)switch(o){case"open":this.openShortcut(i);break;case"toggle":this.openMenu=i,this.toggleMenu();break;default:this.closeMenu()}}},{key:"toggleMenu",value:function(){this.menuOpened=!this.menuOpened}},{key:"closeMenu",value:function(){this.menuOpened=!1}},{key:"openShortcut",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.openMenu=e,this.menuOpened=!0}},{key:"setOpenMenu",value:function(e){var t=e.detail.id;this.openMenu=t===this.openMenu?"":t}},{key:"setMenuContents",value:function(e){var t=e.detail;this.menuContents=Ie(t)}},{key:"setMenuShortcuts",value:function(e){var t=e.detail;this.menuShortcuts=Ie(t)}},{key:"menuClass",get:function(){var e=this.menuOpened?"open":"",t=this.viewportInFullscreen?"fullscreen":"";return"".concat(e," ").concat(t)}},{key:"menuToggleButton",get:function(){return(0,o.dy)(fe||(fe=Oe(['\n <button class="toggle-menu" @click=','>\n <div>\n <ia-icon icon="ellipses" style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon>\n </div>\n </button>\n '])),this.toggleMenu.bind(this))}},{key:"menuSlider",get:function(){return(0,o.dy)(pe||(pe=Oe(['\n <div id="menu">\n <ia-menu-slider\n .menus=',"\n .open=","\n .selectedMenu=","\n @menuTypeSelected=","\n @menuSliderClosed=","\n ?manuallyHandleClose=","\n ?animateMenuOpen=","\n ></ia-menu-slider>\n </div>\n "])),this.menuContents,!0,this.openMenu,this.setOpenMenu,this.closeMenu,!0,!1)}},{key:"shortcuts",get:function(){var e=this,t=this.menuShortcuts.map((function(t){var n=t.icon,r=t.id;return(0,o.dy)(me||(me=Oe(['\n <button class="shortcut ','" @click="','">\n ',"\n </button>\n "])),r,(function(t){e.openShortcut(r)}),n)}));return(0,o.dy)(ve||(ve=Oe(['<div class="shortcuts">',"</div>"])),t)}},{key:"renderSideMenu",get:function(){return(0,o.dy)(be||(be=Oe(['\n <nav>\n <div class="minimized">\n ',"\n ","\n </div>\n ","\n </nav>\n "])),this.shortcuts,this.menuToggleButton,this.menuSlider)}},{key:"renderViewport",get:function(){return"bookreader"===this.itemType?(0,o.dy)(ye||(ye=Oe(["\n <book-navigator\n .baseHost=","\n .book=","\n ?signedIn=","\n ?sideMenuOpen=","\n @ViewportInFullScreen=","\n @updateSideMenu=","\n @menuUpdated=","\n @menuShortcutsUpdated=","\n @showItemNavigatorModal=","\n @closeItemNavigatorModal=",'\n >\n <div slot="bookreader">\n <slot name="bookreader"></slot>\n </div>\n </book-navigator>\n '])),this.baseHost,this.item,this.signedIn,this.menuOpened,this.manageViewportFullscreen,this.manageSideMenuEvents,this.setMenuContents,this.setMenuShortcuts,this.showItemNavigatorModal,this.closeItemNavigatorModal):(0,o.dy)(ge||(ge=Oe(['<div class="viewport"></div>'])))}},{key:"renderModalManager",value:function(){this.modal=document.createElement("modal-manager"),this.modal.setAttribute("id","item-navigator-modal"),this.modalConfig=new te,this.modalConfig.title="Delete Bookmark",this.modalConfig.headline="This bookmark contains a note. Deleting it will permanently delete the note. Are you sure?",this.modalConfig.headerColor="#194880",document.body.appendChild(this.modal)}},{key:"render",value:function(){var e=this.menuContents.length||this.menuShortcuts.length;return(0,o.dy)(ke||(ke=Oe(['\n <div id="frame" class=','>\n <slot name="item-nav-header"></slot>\n <div class="menu-and-reader">\n ','\n <div id="reader">\n ',"\n </div>\n </div>\n </div>\n "])),this.menuClass,e?this.renderSideMenu:r.Ld,this.renderViewport)}}])&&De(t.prototype,n),i&&De(t,i),c}(o.oi);customElements.define("ia-icon",ee),customElements.define("ia-menu-slider",p),customElements.define("item-navigator",je),n(7941),n(7327),n(561),n(9826),n(5827),n(4747),n(9653);var Me,Pe=[],Ae="ResizeObserver loop completed with undelivered notifications.";!function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"}(Me||(Me={}));var Re,_e,$e,Ne,He,Fe=function(e){return Object.freeze(e)},Ze=function(e,t){this.inlineSize=e,this.blockSize=t,Fe(this)},We=function(){function e(e,t,n,o){return this.x=e,this.y=t,this.width=n,this.height=o,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Fe(this)}return e.prototype.toJSON=function(){var e=this;return{x:e.x,y:e.y,top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.width,height:e.height}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),qe=function(e){return e instanceof SVGElement&&"getBBox"in e},Ue=function(e){if(qe(e)){var t=e.getBBox(),n=t.width,o=t.height;return!n&&!o}var r=e,i=r.offsetWidth,a=r.offsetHeight;return!(i||a||e.getClientRects().length)},Ve=function(e){var t,n;if(e instanceof Element)return!0;var o=null===(n=null===(t=e)||void 0===t?void 0:t.ownerDocument)||void 0===n?void 0:n.defaultView;return!!(o&&e instanceof o.Element)},Ge="undefined"!=typeof window?window:{},Xe=new WeakMap,Ye=/auto|scroll/,Je=/^tb|vertical/,Qe=/msie|trident/i.test(Ge.navigator&&Ge.navigator.userAgent),Ke=function(e){return parseFloat(e||"0")},et=function(e,t,n){return void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=!1),new Ze((n?t:e)||0,(n?e:t)||0)},tt=Fe({devicePixelContentBoxSize:et(),borderBoxSize:et(),contentBoxSize:et(),contentRect:new We(0,0,0,0)}),nt=function(e,t){if(void 0===t&&(t=!1),Xe.has(e)&&!t)return Xe.get(e);if(Ue(e))return Xe.set(e,tt),tt;var n=getComputedStyle(e),o=qe(e)&&e.ownerSVGElement&&e.getBBox(),r=!Qe&&"border-box"===n.boxSizing,i=Je.test(n.writingMode||""),a=!o&&Ye.test(n.overflowY||""),s=!o&&Ye.test(n.overflowX||""),l=o?0:Ke(n.paddingTop),c=o?0:Ke(n.paddingRight),d=o?0:Ke(n.paddingBottom),u=o?0:Ke(n.paddingLeft),h=o?0:Ke(n.borderTopWidth),f=o?0:Ke(n.borderRightWidth),p=o?0:Ke(n.borderBottomWidth),m=u+c,v=l+d,b=(o?0:Ke(n.borderLeftWidth))+f,y=h+p,g=s?e.offsetHeight-y-e.clientHeight:0,k=a?e.offsetWidth-b-e.clientWidth:0,w=r?m+b:0,C=r?v+y:0,x=o?o.width:Ke(n.width)-w-k,S=o?o.height:Ke(n.height)-C-g,B=x+m+k+b,O=S+v+g+y,I=Fe({devicePixelContentBoxSize:et(Math.round(x*devicePixelRatio),Math.round(S*devicePixelRatio),i),borderBoxSize:et(B,O,i),contentBoxSize:et(x,S,i),contentRect:new We(u,l,x,S)});return Xe.set(e,I),I},ot=function(e,t,n){var o=nt(e,n),r=o.borderBoxSize,i=o.contentBoxSize,a=o.devicePixelContentBoxSize;switch(t){case Me.DEVICE_PIXEL_CONTENT_BOX:return a;case Me.BORDER_BOX:return r;default:return i}},rt=function(e){var t=nt(e);this.target=e,this.contentRect=t.contentRect,this.borderBoxSize=Fe([t.borderBoxSize]),this.contentBoxSize=Fe([t.contentBoxSize]),this.devicePixelContentBoxSize=Fe([t.devicePixelContentBoxSize])},it=function(e){if(Ue(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},at=function(){var e=1/0,t=[];Pe.forEach((function(n){if(0!==n.activeTargets.length){var o=[];n.activeTargets.forEach((function(t){var n=new rt(t.target),r=it(t.target);o.push(n),t.lastReportedSize=ot(t.target,t.observedBox),r<e&&(e=r)})),t.push((function(){n.callback.call(n.observer,o,n.observer)})),n.activeTargets.splice(0,n.activeTargets.length)}}));for(var n=0,o=t;n<o.length;n++)(0,o[n])();return e},st=function(e){Pe.forEach((function(t){t.activeTargets.splice(0,t.activeTargets.length),t.skippedTargets.splice(0,t.skippedTargets.length),t.observationTargets.forEach((function(n){n.isActive()&&(it(n.target)>e?t.activeTargets.push(n):t.skippedTargets.push(n))}))}))},lt=[],ct=0,dt={attributes:!0,characterData:!0,childList:!0,subtree:!0},ut=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],ht=function(e){return void 0===e&&(e=0),Date.now()+e},ft=!1,pt=new(function(){function e(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return e.prototype.run=function(e){var t=this;if(void 0===e&&(e=250),!ft){ft=!0;var n,o=ht(e);n=function(){var n=!1;try{n=function(){var e,t=0;for(st(t);Pe.some((function(e){return e.activeTargets.length>0}));)t=at(),st(t);return Pe.some((function(e){return e.skippedTargets.length>0}))&&("function"==typeof ErrorEvent?e=new ErrorEvent("error",{message:Ae}):((e=document.createEvent("Event")).initEvent("error",!1,!1),e.message=Ae),window.dispatchEvent(e)),t>0}()}finally{if(ft=!1,e=o-ht(),!ct)return;n?t.run(1e3):e>0?t.run(e):t.start()}},function(e){if(!Re){var t=0,n=document.createTextNode("");new MutationObserver((function(){return lt.splice(0).forEach((function(e){return e()}))})).observe(n,{characterData:!0}),Re=function(){n.textContent=""+(t?t--:t++)}}lt.push(e),Re()}((function(){requestAnimationFrame(n)}))}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var e=this,t=function(){return e.observer&&e.observer.observe(document.body,dt)};document.body?t():Ge.addEventListener("DOMContentLoaded",t)},e.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),ut.forEach((function(t){return Ge.addEventListener(t,e.listener,!0)})))},e.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),ut.forEach((function(t){return Ge.removeEventListener(t,e.listener,!0)})),this.stopped=!0)},e}()),mt=function(e){!ct&&e>0&&pt.start(),!(ct+=e)&&pt.stop()},vt=function(){function e(e,t){this.target=e,this.observedBox=t||Me.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var e,t=ot(this.target,this.observedBox,!0);return e=this.target,qe(e)||function(e){switch(e.tagName){case"INPUT":if("image"!==e.type)break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(e)||"inline"!==getComputedStyle(e).display||(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),bt=function(e,t){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=t},yt=new WeakMap,gt=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},kt=function(){function e(){}return e.connect=function(e,t){var n=new bt(e,t);yt.set(e,n)},e.observe=function(e,t,n){var o=yt.get(e),r=0===o.observationTargets.length;gt(o.observationTargets,t)<0&&(r&&Pe.push(o),o.observationTargets.push(new vt(t,n&&n.box)),mt(1),pt.schedule())},e.unobserve=function(e,t){var n=yt.get(e),o=gt(n.observationTargets,t),r=1===n.observationTargets.length;o>=0&&(r&&Pe.splice(Pe.indexOf(n),1),n.observationTargets.splice(o,1),mt(-1))},e.disconnect=function(e){var t=this,n=yt.get(e);n.observationTargets.slice().forEach((function(n){return t.unobserve(e,n.target)})),n.activeTargets.splice(0,n.activeTargets.length)},e}(),wt=function(){function e(e){if(0===arguments.length)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if("function"!=typeof e)throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");kt.connect(this,e)}return e.prototype.observe=function(e,t){if(0===arguments.length)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Ve(e))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");kt.observe(this,e,t)},e.prototype.unobserve=function(e){if(0===arguments.length)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Ve(e))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");kt.unobserve(this,e)},e.prototype.disconnect=function(){kt.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),Ct=(n(4723),n(4603),n(9714),n(5306),n(3161),n(4129),n(7552)),xt=new WeakMap,St=(0,r.XM)((function(e){return function(t){if(!(t instanceof r.nt))throw new Error("unsafeHTML can only be used in text bindings");var n=xt.get(t);if(void 0===n||!(0,Ct.pt)(e)||e!==n.value||t.value!==n.fragment){var o=document.createElement("template");o.innerHTML=e;var i=document.importNode(o.content,!0);t.setValue(i),xt.set(t,{value:e,fragment:i})}}}));function Bt(e){return(Bt="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})(e)}function Ot(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function It(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function zt(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Dt(e,t){return(Dt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Lt(e,t){if(t&&("object"===Bt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Tt(e){return(Tt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Et,jt=function(e){!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}}),t&&Dt(e,t)}(c,e);var t,n,i,a,s,l=(a=c,s=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=Tt(a);if(s){var n=Tt(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Lt(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.call(this)).matchRegex=new RegExp("{{{(.+?)}}}","g"),e}return t=c,i=[{key:"properties",get:function(){return{match:{type:Object}}}}],(n=[{key:"createRenderRoot",value:function(){return this}},{key:"highlightedHit",value:function(e){return(0,o.dy)(_e||(_e=It(["\n <p>","</p>\n "])),St(e.replace(this.matchRegex,"<mark>$1</mark>")))}},{key:"resultSelected",value:function(){this.dispatchEvent(new CustomEvent("resultSelected",{bubbles:!0,composed:!0,detail:{match:this.match}}))}},{key:"render",value:function(){var e,t,n=this.match,i=n.par,a=(e=void 0===i?[]:i,t=1,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ot(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ot(e,t):void 0}}(e,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.")}())[0],s=void 0===a?{}:a,l=Number.isInteger(s.page)?(0,o.dy)($e||($e=It(['<p class="page-num">Page -',"-</p>"])),s.page):r.Ld,c=(0,o.dy)(Ne||(Ne=It(['<img src="','" />'])),n.cover);return(0,o.dy)(He||(He=It(["\n <li @click=",">\n ","\n <h4>","</h4>\n ","\n ","\n </li>\n "])),this.resultSelected,n.cover?c:r.Ld,n.title||r.Ld,l,this.highlightedHit(n.text))}}])&&zt(t.prototype,n),i&&zt(t,i),c}(o.oi);customElements.define("book-search-result",jt);var Mt,Pt,At,Rt,_t,$t,Nt,Ht,Ft,Zt,Wt,qt,Ut,Vt,Gt,Xt,Yt,Jt,Qt,Kt=(0,o.iv)(Et||(Mt=["data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEwIiB2aWV3Qm94PSIwIDAgMTMgMTAiIHdpZHRoPSIxMyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtNC4zMzMzMzMzMyAxMC00LjMzMzMzMzMzLTQuMTY2NjY2NjcgMS43MzMzMzMzMy0xLjY2NjY2NjY2IDIuNiAyLjUgNi45MzMzMzMzNy02LjY2NjY2NjY3IDEuNzMzMzMzMyAxLjY2NjY2NjY3eiIgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIi8+PC9zdmc+"],Pt||(Pt=Mt.slice(0)),Et=Object.freeze(Object.defineProperties(Mt,{raw:{value:Object.freeze(Pt)}})))),en=(0,o.iv)(At||(At=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNDAgNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgYXJpYS1sYWJlbGxlZGJ5PSJjbG9zZVRpdGxlSUQgY2xvc2VEZXNjSUQiPjxwYXRoIGQ9Ik0yOS4xOTIgMTAuODA4YTEuNSAxLjUgMCAwMTAgMi4xMkwyMi4xMjIgMjBsNy4wNyA3LjA3MmExLjUgMS41IDAgMDEtMi4xMiAyLjEyMWwtNy4wNzMtNy4wNy03LjA3IDcuMDdhMS41IDEuNSAwIDAxLTIuMTIxLTIuMTJsNy4wNy03LjA3My03LjA3LTcuMDdhMS41IDEuNSAwIDAxMi4xMi0yLjEyMUwyMCAxNy44NzhsNy4wNzItNy4wN2ExLjUgMS41IDAgMDEyLjEyMSAweiIgY2xhc3M9ImZpbGwtY29sb3IiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg=="]))),tn=(0,o.iv)(Rt||(Rt=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n .ia-button {\n min-height: 3rem;\n border: none;\n outline: none;\n cursor: pointer;\n color: var(--primaryTextColor);\n line-height: normal;\n border-radius: .4rem;\n text-align: center;\n vertical-align: middle;\n font-size: 1.4rem;\n display: inline-block;\n padding: .6rem 1.2rem;\n border: 1px solid transparent;\n\n white-space: nowrap;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -o-user-select: none;\n user-select: none;\n }\n\n .ia-button.link,\n .ia-button.external {\n min-height: unset;\n text-decoration: none;\n }\n\n .ia-button:disabled,\n .ia-button.disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n .ia-button.transparent {\n background-color: transparent;\n }\n \n .ia-button.slim {\n padding: 0;\n }\n\n .ia-button.primary {\n background-color: var(--primaryCTAFill);\n border-color: var(--primaryCTABorder);\n }\n\n .ia-button.cancel {\n background-color: var(--primaryErrorCTAFill);\n border-color: var(--primaryErrorCTABorder);\n }\n\n .ia-button.external {\n background: var(--secondaryCTAFill);\n border-color: var(--secondaryCTABorder);\n }\n"])));function nn(e){return(nn="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})(e)}function on(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function rn(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function an(e,t){return(an=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function sn(e,t){if(t&&("object"===nn(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function ln(e){return(ln=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var cn,dn,un,hn,fn=function(e){!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}}),t&&an(e,t)}(c,e);var t,n,i,a,s,l=(a=c,s=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=ln(a);if(s){var n=ln(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return sn(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.call(this)).results=[],e.query="",e.queryInProgress=!1,e.renderHeader=!1,e.renderSearchAllFields=!1,e.displayResultImages=!1,e.errorMessage="",e.bindBookReaderListeners(),e}return t=c,i=[{key:"properties",get:function(){return{results:{type:Array},query:{type:String},queryInProgress:{type:Boolean},renderHeader:{type:Boolean},renderSearchAllFiles:{type:Boolean},displayResultImages:{type:Boolean},errorMessage:{type:String}}}},{key:"styles",get:function(){var e=(0,o.iv)(Gt||(Gt=on(["var(--searchResultText, #adaedc)"]))),t=(0,o.iv)(Xt||(Xt=on(["var(--searchResultBg, #272958)"]))),n=(0,o.iv)(Yt||(Yt=on(["var(--searchResultBorder, #adaedc)"]))),r=(0,o.iv)(Jt||(Jt=on(["(--tertiaryBGColor, #333)"]))),i=(0,o.iv)(Qt||(Qt=on(["\n :host {\n display: block;\n height: 100%;\n padding: 1.5rem 1rem 2rem 0;\n overflow-y: auto;\n font-size: 1.4rem;\n box-sizing: border-box;\n }\n\n mark {\n padding: 0 .2rem;\n color: ",";\n background: ",";\n border: 1px solid ",';\n border-radius: 2px;\n }\n\n h3 {\n padding: 0;\n margin: 0 1rem 0 0;\n font-size: 2rem;\n }\n\n header {\n display: flex;\n align-items: center;\n padding: 0 2rem 0 0;\n }\n header p {\n padding: 0;\n margin: 0;\n font-size: 1.2rem;\n font-weight: bold;\n font-style: italic;\n }\n\n fieldset {\n padding: 0 0 1rem 0;\n border: none;\n }\n\n [type="checkbox"] {\n display: none;\n }\n\n label {\n display: block;\n text-align: center;\n }\n\n label.checkbox {\n padding-bottom: .5rem;\n font-size: 1.6rem;\n line-height: 150%;\n vertical-align: middle;\n }\n\n label.checkbox:after {\n display: inline-block;\n width: 14px;\n height: 14px;\n margin-left: .7rem;\n content: "";\n border-radius: 2px;\n }\n :checked + label.checkbox:after {\n background-image: url(\'','\');\n }\n\n label.checkbox[for="all_files"]:after {\n background: ',' 50% 50% no-repeat;\n border: 1px solid var(--primaryTextColor);\n }\n\n [type="search"] {\n color: var(--primaryTextColor);\n border: 1px solid var(--primaryTextColor);\n -webkit-appearance: textfield;\n width: 100%;\n height: 3rem;\n padding: 0 1.5rem;\n box-sizing: border-box;\n font: normal 1.6rem "Helvetica qNeue", Helvetica, Arial, sans-serif;\n border-radius: 1.5rem;\n background: transparent;\n }\n [type="search"]:focus {\n outline: none;\n }\n [type="search"]::-webkit-search-cancel-button {\n width: 18px;\n height: 18px;\n -webkit-appearance: none;\n appearance: none;\n -webkit-mask: url(\'',"') 0 0 no-repeat;\n mask: url('","') 0 0 no-repeat;\n -webkit-mask-size: 100%;\n mask-size: 100%;\n background: #fff;\n }\n\n p.page-num {\n font-weight: bold;\n padding-bottom: 0;\n }\n\n p.search-cta {\n text-align: center;\n }\n\n .results-container {\n padding-bottom: 2rem;\n }\n\n ul {\n padding: 0 0 2rem 0;\n margin: 0;\n list-style: none;\n }\n\n ul.show-image li {\n display: grid;\n }\n\n li {\n cursor: pointer;\n grid-template-columns: 30px 1fr;\n grid-gap: 0 .5rem;\n }\n\n li img {\n display: block;\n width: 100%;\n }\n\n li h4 {\n grid-column: 2 / 3;\n padding: 0 0 2rem 0;\n margin: 0;\n font-weight: normal;\n }\n\n li p {\n grid-column: 2 / 3;\n padding: 0 0 1.5rem 0;\n margin: 0;\n font-size: 1.2rem;\n }\n\n .loading {\n text-align: center;\n }\n\n .loading p {\n padding: 0 0 1rem 0;\n margin: 0;\n font-size: 1.2rem;\n }\n\n ia-activity-indicator {\n display: block;\n width: 40px;\n height: 40px;\n margin: 0 auto;\n }\n "])),e,t,n,Kt,r,en,en);return[tn,i]}}],(n=[{key:"updated",value:function(){this.focusOnInputIfNecessary()}},{key:"bindBookReaderListeners",value:function(){document.addEventListener("BookReader:SearchCallback",this.setResults.bind(this))}},{key:"focusOnInputIfNecessary",value:function(){this.results.length||this.shadowRoot.querySelector("input[type='search']").focus()}},{key:"setResults",value:function(e){var t=e.detail;this.results=t.results}},{key:"setQuery",value:function(e){this.query=e.currentTarget.value}},{key:"performSearch",value:function(e){e.preventDefault();var t=e.currentTarget.querySelector('input[type="search"]');t&&t.value&&this.dispatchEvent(new CustomEvent("bookSearchInitiated",{bubbles:!0,composed:!0,detail:{query:this.query}}))}},{key:"selectResult",value:function(){this.dispatchEvent(new CustomEvent("closeMenu",{bubbles:!0,composed:!0}))}},{key:"cancelSearch",value:function(){this.queryInProgress=!1,this.dispatchSearchCanceled()}},{key:"dispatchSearchCanceled",value:function(){this.dispatchEvent(new Event("bookSearchCanceled"))}},{key:"resultsCount",get:function(){var e=this.results.length;return e?(0,o.dy)(_t||(_t=on(["<p>("," result",")</p>"])),e,e>1?"s":""):r.Ld}},{key:"headerSection",get:function(){var e=(0,o.dy)($t||($t=on(["<header>\n <h3>Search inside</h3>\n ","\n </header>"])),this.resultsCount);return this.renderHeader?e:r.Ld}},{key:"searchMultipleControls",get:function(){var e=(0,o.dy)(Nt||(Nt=on(['\n <input name="all_files" id="all_files" type="checkbox" />\n <label class="checkbox" for="all_files">Search all files</label>\n '])));return this.renderSearchAllFiles?e:r.Ld}},{key:"loadingIndicator",get:function(){return(0,o.dy)(Ht||(Ht=on(['\n <div class="loading">\n <ia-activity-indicator mode="processing"></ia-activity-indicator>\n <p>Searching</p>\n <button class="ia-button external cancel-search" @click=',">Cancel</button>\n </div>\n "])),this.cancelSearch)}},{key:"resultsSet",get:function(){var e=this,t=this.displayResultImages?"show-image":"";return(0,o.dy)(Ft||(Ft=on(['\n <ul class="results ','">\n ',"\n </ul>\n "])),t,this.results.map((function(t){return(0,o.dy)(Zt||(Zt=on(["\n <book-search-result\n .match=","\n @resultSelected=","\n ></book-search-result>\n "])),t,e.selectResult)})))}},{key:"searchForm",get:function(){return(0,o.dy)(Wt||(Wt=on(['\n <form action="" method="get" @submit=',">\n <fieldset>\n ",'\n <input\n type="search"\n name="query"\n alt="Search inside this book."\n @keyup=',"\n .value=","\n />\n </fieldset>\n </form>\n "])),this.performSearch,this.searchMultipleControls,this.setQuery,this.query)}},{key:"setErrorMessage",get:function(){return(0,o.dy)(qt||(qt=on(['\n <p class="error-message">',"</p>\n "])),this.errorMessage)}},{key:"searchCTA",get:function(){return(0,o.dy)(Ut||(Ut=on(['<p class="search-cta"><em>Please enter text to search for</em></p>'])))}},{key:"render",value:function(){var e=!(this.queryInProgress||this.errorMessage||this.queryInProgress||this.results.length);return(0,o.dy)(Vt||(Vt=on(["\n ","\n ",'\n <div class="results-container">\n ',"\n ","\n ","\n ","\n </div>\n "])),this.headerSection,this.searchForm,this.queryInProgress?this.loadingIndicator:r.Ld,this.errorMessage?this.setErrorMessage:r.Ld,this.results.length?this.resultsSet:r.Ld,e?this.searchCTA:r.Ld)}}])&&rn(t.prototype,n),i&&rn(t,i),c}(o.oi);function pn(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function mn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vn(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}customElements.define("ia-book-search-results",fn);var bn,yn,gn,kn,wn,Cn,xn,Sn,Bn,On,In,zn={query:"",results:[],resultsCount:0,queryInProgress:!1,errorMessage:""},Dn=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},n=arguments.length>1?arguments[1]:void 0;mn(this,e),this.onBookSearchInitiated=this.onBookSearchInitiated.bind(this),this.onSearchStarted=this.onSearchStarted.bind(this),this.onSearchRequestError=this.onSearchRequestError.bind(this),this.onSearchResultsClicked=this.onSearchResultsClicked.bind(this),this.onSearchResultsChange=this.onSearchResultsChange.bind(this),this.onSearchResultsCleared=this.onSearchResultsCleared.bind(this),this.searchCanceledInMenu=this.searchCanceledInMenu.bind(this),this.bindEventListeners=this.bindEventListeners.bind(this),this.getMenuDetails=this.getMenuDetails.bind(this),this.getComponent=this.getComponent.bind(this),this.advanceToPage=this.advanceToPage.bind(this),this.updateMenu=this.updateMenu.bind(this),this.onSearchChange=t,this.bookreader=n,this.icon=(0,o.dy)(cn||(cn=pn(['<ia-icon icon="search" style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon>']))),this.label="Search inside",this.menuDetails=this.getMenuDetails(),this.id="search",this.component=this.getComponent(),this.bindEventListeners()}var t,n;return t=e,(n=[{key:"getMenuDetails",value:function(){var e=zn,t=e.resultsCount,n=e.query;if(e.queryInProgress||!n)return r.Ld;var i=1===t?"result":"results";return(0,o.dy)(dn||(dn=pn(["("," ",")"])),t,i)}},{key:"bindEventListeners",value:function(){var e=this;window.addEventListener("BookReader:SearchStarted",this.onSearchStarted),window.addEventListener("BookReader:SearchCallback",this.onSearchResultsChange),window.addEventListener("BookReader:SearchCallbackEmpty",(function(t){e.onSearchRequestError(t,"noResults")})),window.addEventListener("BookReader:SearchCallbackNotIndexed",(function(t){e.onSearchRequestError(t,"notIndexed")})),window.addEventListener("BookReader:SearchCallbackError",(function(t){e.onSearchRequestError(t)})),window.addEventListener("BookReader:SearchResultsCleared",(function(){e.onSearchResultsCleared()})),window.addEventListener("BookReader:SearchCanceled",(function(t){e.onSearchCanceled(t)}))}},{key:"onSearchCanceled",value:function(){zn={query:"",results:[],resultsCount:0,queryInProgress:!1,errorMessage:""},this.updateMenu({searchCanceled:!0})}},{key:"onSearchStarted",value:function(e){var t=e.detail.props.term,n=void 0===t?"":t;zn.query=n,zn.results=[],zn.resultsCount=0,zn.queryInProgress=!0,zn.errorMessage="",this.updateMenu()}},{key:"onBookSearchInitiated",value:function(e){var t=e.detail;zn.query=t.query,this.bookreader.search(zn.query)}},{key:"onSearchRequestError",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",r=e.detail.props,i=void 0===r?{}:r,a=i.instance,s=void 0===a?null:a;s&&(this.bookreader=s);var l={noResults:"0 results",notIndexed:"This book hasn't been indexed for searching yet. We've just started indexing it,\n so search should be available soon. Please try again later. Thanks!",default:"Sorry, there was an error with your search. Please try again."},c=null!==(t=l[n])&&void 0!==t?t:l.default;zn.results=[],zn.resultsCount=0,zn.queryInProgress=!1,zn.errorMessage=(0,o.dy)(un||(un=pn(['<p class="error">',"</p>"])),c),this.updateMenu()}},{key:"onSearchResultsChange",value:function(e){var t=e.detail.props,n=void 0===t?{}:t,o=n.instance,r=void 0===o?null:o,i=n.results,a=void 0===i?[]:i;r&&(this.bookreader=r);var s=a.matches||[],l=s.length,c=a.q;zn={results:s,resultsCount:l,query:c,queryInProgress:!1,errorMessage:""},this.updateMenu()}},{key:"searchCanceledInMenu",value:function(){var e;null===(e=this.bookreader)||void 0===e||e.cancelSearchRequest()}},{key:"onSearchResultsCleared",value:function(){var e,t;zn={query:"",results:[],resultsCount:0,queryInProgress:!1,errorMessage:""},this.updateMenu(),null===(e=this.bookreader)||void 0===e||null===(t=e.searchView)||void 0===t||t.clearSearchFieldAndResults()}},{key:"updateMenu",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.menuDetails=this.getMenuDetails(),this.component=this.getComponent(),this.onSearchChange(this.bookreader,e)}},{key:"getComponent",value:function(){var e=zn,t=e.query,n=e.results,r=e.queryInProgress,i=e.errorMessage;return(0,o.dy)(hn||(hn=pn(["\n <ia-book-search-results\n .query=","\n .results=","\n .errorMessage=","\n ?queryInProgress=","\n ?renderSearchAllFiles=","\n @resultSelected=","\n @bookSearchInitiated=","\n @bookSearchResultsCleared=","\n @bookSearchCanceled=","\n ></ia-book-search-results>\n "])),t,n,i,r,!1,this.onSearchResultsClicked,this.onBookSearchInitiated,this.onSearchResultsCleared,this.searchCanceledInMenu)}},{key:"onSearchResultsClicked",value:function(e){var t=e.detail.match.par[0].page;this.advanceToPage(t)}},{key:"advanceToPage",value:function(e){var t=this.bookreader.leafNumToIndex(e);this.bookreader._searchPluginGoToResult(t)}}])&&vn(t.prototype,n),e}();function Ln(e){return(Ln="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})(e)}function Tn(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function En(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function jn(e,t){return(jn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Mn(e,t){if(t&&("object"===Ln(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Pn(e){return(Pn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n(9601);var An,Rn,_n=function(e){!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}}),t&&jn(e,t)}(c,e);var t,n,i,a,s,l=(a=c,s=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=Pn(a);if(s){var n=Pn(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Mn(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.call(this)).downloads=[],e.expiration=0,e.renderHeader=!1,e.isBookProtected=!1,e}return t=c,i=[{key:"properties",get:function(){return{downloads:{type:Array},expiration:{type:Number},renderHeader:{type:Boolean},isBookProtected:{type:Boolean}}}},{key:"styles",get:function(){var e=(0,o.iv)(In||(In=Tn(["\n :host {\n display: block;\n height: 100%;\n padding: 1.5rem 0;\n overflow-y: auto;\n font-size: 1.4rem;\n box-sizing: border-box;\n }\n\n a.close ia-icon {\n --iconWidth: 18px;\n --iconHeight: 18px;\n }\n a.close {\n justify-self: end;\n }\n\n header {\n display: flex;\n align-items: center;\n padding: 0 2rem;\n }\n header p {\n padding: 0;\n margin: 0;\n font-size: 1.2rem;\n font-weight: bold;\n font-style: italic;\n }\n header div {\n display: flex;\n align-items: baseline;\n } \n\n h2 {\n font-size: 1.6rem;\n }\n\n h3 {\n padding: 0;\n margin: 0 1rem 0 0;\n font-size: 1.4rem;\n }\n\n ul {\n padding: 0;\n margin: 0;\n list-style: none;\n }\n\n p {\n margin: .3rem 0 0 0;\n }\n\n li,\n ul + p {\n padding-bottom: 1.2rem;\n font-size: 1.2rem;\n line-height: 140%;\n }\n "])));return[tn,e]}}],(n=[{key:"formatsCount",get:function(){var e=this.downloads.length;return e?(0,o.dy)(bn||(bn=Tn(["<p>"," format","</p>"])),e,e>1?"s":""):(0,o.dy)(yn||(yn=Tn([""])))}},{key:"loanExpiryMessage",get:function(){return this.expiration?(0,o.dy)(gn||(gn=Tn(["<h2>These files will expire in "," days.</h2>"])),this.expiration):(0,o.dy)(kn||(kn=Tn([""])))}},{key:"renderDownloadOptions",value:function(){return this.downloads.map((function(e){return(0,o.dy)(wn||(wn=Tn(['\n <li>\n <a class="ia-button link primary" href="','">Get ',"</a>\n ","\n </li>\n "])),e.url,e.type,e.note?(0,o.dy)(Cn||(Cn=Tn(["<p>","</p>"])),e.note):(0,o.dy)(xn||(xn=Tn([""]))))}))}},{key:"header",get:function(){return this.renderHeader?(0,o.dy)(Sn||(Sn=Tn(["\n <header>\n <h3>Downloadable files</h3>\n ","\n </header>\n "])),this.formatsCount):r.Ld}},{key:"accessProtectedBook",get:function(){return(0,o.dy)(Bn||(Bn=Tn(['\n <p>To access downloaded books, you need Adobe-compliant software on your device. The Internet Archive will administer this loan, but Adobe may also collect some information.</p>\n <a class="ia-button external primary" href="https://www.adobe.com/solutions/ebook/digital-editions/download.html" rel="noopener noreferrer" target="_blank">Install Adobe Digital Editions</a>\n '])))}},{key:"render",value:function(){return(0,o.dy)(On||(On=Tn(["\n ","\n ","\n <ul>","</ul>\n ","\n "])),this.header,this.loanExpiryMessage,this.renderDownloadOptions(),this.isBookProtected?this.accessProtectedBook:r.Ld)}}])&&En(t.prototype,n),i&&En(t,i),c}(o.oi);function $n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(e){s=!0,r=e}finally{try{a||null==n.return||n.return()}finally{if(s)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Nn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nn(e,t):void 0}}(e,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.")}()}function Nn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Hn(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Fn(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}customElements.define("ia-book-downloads",_n);var Zn={pdf:{type:"Encrypted Adobe PDF",url:"#",note:"PDF files contain high quality images of pages."},epub:{type:"Encrypted Adobe ePub",url:"#",note:"ePub files are smaller in size, but may contain errors."}},Wn={pdf:"PDF",epub:"ePub"},qn=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.icon=(0,o.dy)(An||(An=Hn(['<ia-icon icon="download" style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon>']))),this.label="Downloadable files",this.menuDetails="",this.downloads=[],this.id="downloads",this.component="",this.isBookProtected=t,this.computeAvailableTypes=this.computeAvailableTypes.bind(this),this.update=this.update.bind(this)}var t,n;return t=e,(n=[{key:"update",value:function(e){this.computeAvailableTypes(e),this.component=this.menu,this.component.isBookProtected=this.isBookProtected;var t=1===this.downloads.length?"":"s";this.menuDetails="(".concat(this.downloads.length," format").concat(t,")")}},{key:"computeAvailableTypes",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=t.reduce((function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=$n(n,2),r=o[0],i=void 0===r?"":r,a=o[1],s=void 0===a?"":a,l=i.toLowerCase(),c=Zn[l]||null;if(c){var d=e.isBookProtected?Zn[l].type:Wn[l],u=Object.assign({},c,{url:s,type:d});t.push(u)}return t}),[]);this.downloads=n}},{key:"menu",get:function(){return(0,o.dy)(Rn||(Rn=Hn(["<ia-book-downloads .downloads=","></ia-book-downloads>"])),this.downloads)}}])&&Fn(t.prototype,n),e}();function Un(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}n(9600),n(1532);var Vn,Gn,Xn,Yn,Jn,Qn,Kn,eo=function(e,t){var n=e.startNode.parentNode,o=void 0===t?e.endNode:t.startNode,i=n.insertBefore((0,r.IW)(),o);n.insertBefore((0,r.IW)(),o);var a=new r.nt(e.options);return a.insertAfterNode(i),a},to=function(e,t){return e.setValue(t),e.commit(),e},no=function(e,t,n){var o=e.startNode.parentNode,i=n?n.startNode:e.endNode,a=t.endNode.nextSibling;a!==i&&(0,r.V)(o,t.startNode,a,i)},oo=function(e){(0,r.r4)(e.startNode.parentNode,e.startNode,e.endNode.nextSibling)},ro=function(e,t,n){for(var o=new Map,r=t;r<=n;r++)o.set(e[r],r);return o},io=new WeakMap,ao=new WeakMap,so=(0,r.XM)((function(e,t,n){var o;return void 0===n?n=t:void 0!==t&&(o=t),function(t){if(!(t instanceof r.nt))throw new Error("repeat can only be used in text bindings");var i,a,s,l=io.get(t)||[],c=ao.get(t)||[],d=[],u=[],h=[],f=0,p=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Un(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Un(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,r=function(){};return{s:r,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:r}}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,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}(e);try{for(p.s();!(i=p.n()).done;){var m=i.value;h[f]=o?o(m,f):f,u[f]=n(m,f),f++}}catch(e){p.e(e)}finally{p.f()}for(var v=0,b=l.length-1,y=0,g=u.length-1;v<=b&&y<=g;)if(null===l[v])v++;else if(null===l[b])b--;else if(c[v]===h[y])d[y]=to(l[v],u[y]),v++,y++;else if(c[b]===h[g])d[g]=to(l[b],u[g]),b--,g--;else if(c[v]===h[g])d[g]=to(l[v],u[g]),no(t,l[v],d[g+1]),v++,g--;else if(c[b]===h[y])d[y]=to(l[b],u[y]),no(t,l[b],l[v]),b--,y++;else if(void 0===a&&(a=ro(h,y,g),s=ro(c,v,b)),a.has(c[v]))if(a.has(c[b])){var k=s.get(h[y]),w=void 0!==k?l[k]:null;if(null===w){var C=eo(t,l[v]);to(C,u[y]),d[y]=C}else d[y]=to(w,u[y]),no(t,w,l[v]),l[k]=null;y++}else oo(l[b]),b--;else oo(l[v]),v++;for(;y<=g;){var x=eo(t,d[g+1]);to(x,u[y]),d[y++]=x}for(;v<=b;){var S=l[v++];null!==S&&oo(S)}io.set(t,d),ao.set(t,h)}}));class lo extends o.oi{static get styles(){return o.iv`
1153
1153
  :host {
1154
1154
  width: var(--iconWidth, 'auto');
1155
1155
  height: var(--iconHeight, 'auto');
@@ -1175,7 +1175,7 @@
1175
1175
  .stroke-color {
1176
1176
  stroke: var(--iconStrokeColor);
1177
1177
  }
1178
- `}render(){return P}}function uo(e){return(uo="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})(e)}function ho(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function fo(e){return function(e){if(Array.isArray(e))return po(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return po(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?po(e,t):void 0}}(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.")}()}function po(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function mo(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function vo(e,t){return(vo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function bo(e,t){if(t&&("object"===uo(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function yo(e){return(yo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}customElements.define("ia-icon-magnify-plus",co);var go,ko,wo=function(e){return"visualAdjustment".concat(e)},Co={optionChange:wo("OptionChanged"),zoomIn:wo("ZoomIn"),zoomOut:wo("ZoomOut")},xo=function(e){!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}}),t&&vo(e,t)}(c,e);var t,n,i,a,s,l=(a=c,s=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=yo(a);if(s){var n=yo(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return bo(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.call(this)).activeCount=0,e.options=[],e.renderHeader=!1,e.showZoomControls=!0,e}return t=c,i=[{key:"properties",get:function(){return{activeCount:{type:Number},options:{type:Array},renderHeader:{type:Boolean},showZoomControls:{type:Boolean}}}},{key:"styles",get:function(){return(0,o.iv)(Kn||(Kn=ho(['\n :host {\n display: block;\n height: 100%;\n overflow-y: auto;\n font-size: 1.4rem;\n box-sizing: border-box;\n }\n\n header {\n display: flex;\n align-items: baseline;\n }\n\n h3 {\n padding: 0;\n margin: 0 1rem 0 0;\n font-size: 1.6rem;\n }\n\n header p {\n padding: 0;\n margin: 0;\n font-size: 1.2rem;\n font-weight: bold;\n font-style: italic;\n }\n\n ul {\n padding: 1rem 2rem 0 0;\n list-style: none;\n margin-top: 0;\n }\n\n [type="checkbox"] {\n display: none;\n }\n\n label {\n display: flex;\n justify-content: space-between;\n align-items: baseline;\n font-size: 1.4rem;\n font-weight: bold;\n line-height: 150%;\n vertical-align: middle;\n }\n\n .icon {\n display: inline-block;\n width: 14px;\n height: 14px;\n margin-left: .7rem;\n border: 1px solid var(--primaryTextColor);\n border-radius: 2px;\n background: var(--activeButtonBg) 50% 50% no-repeat;\n }\n :checked + .icon {\n background-image: url(\'',"');\n }\n\n .range {\n display: none;\n padding-top: .5rem;\n }\n .range.visible {\n display: flex;\n }\n\n .range p {\n margin-left: 1rem;\n }\n\n h4 {\n padding: 1rem 0;\n margin: 0;\n font-size: 1.4rem;\n }\n\n button {\n -webkit-appearance: none;\n appearance: none;\n border: none;\n border-radius: 0;\n background: transparent;\n outline: none;\n cursor: pointer;\n --iconFillColor: var(--primaryTextColor);\n --iconStrokeColor: var(--primaryTextColor);\n height: 4rem;\n width: 4rem;\n }\n\n button * {\n display: inline-block;\n }"])),Kt)}}],(n=[{key:"firstUpdated",value:function(){this.activeCount=this.activeOptions.length,this.emitOptionChangedEvent()}},{key:"activeOptions",get:function(){return this.options.reduce((function(e,t){return t.active?[].concat(fo(e),[t.id]):e}),[])}},{key:"prepareEventDetails",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return{options:this.options,activeCount:this.activeCount,changedOptionId:e}}},{key:"emitOptionChangedEvent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=this.prepareEventDetails(e);this.dispatchEvent(new CustomEvent(Co.optionChange,{bubbles:!0,composed:!0,detail:t}))}},{key:"emitZoomIn",value:function(){this.dispatchEvent(new CustomEvent(Co.zoomIn))}},{key:"emitZoomOut",value:function(){this.dispatchEvent(new CustomEvent(Co.zoomOut))}},{key:"changeActiveStateFor",value:function(e){var t=fo(this.options),n=t.find((function(t){return t.id===e}));n.active=!n.active,this.options=t,this.activeCount=this.activeOptions.length,this.emitOptionChangedEvent(n.id)}},{key:"setRangeValue",value:function(e,t){var n=fo(this.options);n.find((function(t){return t.id===e})).value=t,this.options=fo(n)}},{key:"rangeSlider",value:function(e){var t=this;return(0,o.dy)(Vn||(Vn=ho(["\n <div class=",'>\n <input\n type="range"\n name="','_range"\n min=',"\n max=","\n step=","\n .value=","\n @input=","\n @change=","\n />\n <p>","%</p>\n </div>\n "])),"range".concat(e.active?" visible":""),e.id,e.min||0,e.max||100,e.step||1,e.value,(function(n){return t.setRangeValue(e.id,n.target.value)}),(function(){return t.emitOptionChangedEvent()}),e.value)}},{key:"adjustmentCheckbox",value:function(e){var t=this,n="adjustment_".concat(e.id);return(0,o.dy)(Gn||(Gn=ho(['<li>\n <label for="','">\n <span class="name">','</span>\n <input\n type="checkbox"\n name="','"\n id="','"\n @change=',"\n ?checked=",'\n />\n <span class="icon"></span>\n </label>\n ',"\n </li>"])),n,e.name,n,n,(function(){return t.changeActiveStateFor(e.id)}),e.active,void 0!==e.value?this.rangeSlider(e):r.Ld)}},{key:"headerSection",get:function(){var e=this.activeCount?(0,o.dy)(Xn||(Xn=ho(["<p>("," active)</p>"])),this.activeCount):r.Ld,t=(0,o.dy)(Yn||(Yn=ho(["<header>\n <h3>Visual adjustments</h3>\n ","\n </header>"])),e);return this.renderHeader?t:r.Ld}},{key:"zoomControls",get:function(){return(0,o.dy)(Jn||(Jn=ho(['\n <h4>Zoom</h4>\n <button class="zoom_out" @click=',' title="zoom out">\n <ia-icon-magnify-minus></ia-icon-magnify-minus>\n </button>\n <button class="zoom_in" @click=',' title="zoom in">\n <ia-icon-magnify-plus></ia-icon-magnify-plus>\n </button>\n '])),this.emitZoomOut,this.emitZoomIn)}},{key:"render",value:function(){return(0,o.dy)(Qn||(Qn=ho(["\n ","\n <ul>\n ","\n </ul>\n ","\n "])),this.headerSection,so(this.options,(function(e){return e.id}),this.adjustmentCheckbox.bind(this)),this.showZoomControls?this.zoomControls:r.Ld)}}])&&mo(t.prototype,n),i&&mo(t,i),c}(o.oi);function So(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Bo(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Oo(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}customElements.define("ia-book-visual-adjustments",xo);var Io,zo,Do=[{id:"brightness",name:"Adjust brightness",active:!1,min:0,max:150,step:1,value:100},{id:"contrast",name:"Adjust contrast",active:!1,min:0,max:150,step:1,value:100},{id:"invert",name:"Inverted colors (dark mode)",active:!1},{id:"grayscale",name:"Grayscale",active:!1}],Lo=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var n=t.onOptionChange,r=void 0===n?function(){}:n,i=t.bookContainerSelector,a=t.bookreader;this.onOptionChange=r,this.bookContainerSelector=i,this.bookreader=a,this.onAdjustmentChange=this.onAdjustmentChange.bind(this),this.optionUpdateComplete=this.optionUpdateComplete.bind(this),this.updateOptionsCount=this.updateOptionsCount.bind(this),this.onZoomIn=this.onZoomIn.bind(this),this.onZoomOut=this.onZoomOut.bind(this),this.activeCount=0,this.icon=(0,o.dy)(go||(go=Bo(['<ia-icon icon="visualAdjustment" style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon>']))),this.label="Visual Adjustments",this.menuDetails=this.updateOptionsCount(),this.id="adjustment",this.component=(0,o.dy)(ko||(ko=Bo(["\n <ia-book-visual-adjustments\n .options=","\n @visualAdjustmentOptionChanged=","\n @visualAdjustmentZoomIn=","\n @visualAdjustmentZoomOut=","\n ></ia-book-visual-adjustments>\n "])),Do,this.onAdjustmentChange,this.onZoomIn,this.onZoomOut)}var t,n;return t=e,(n=[{key:"onZoomIn",value:function(){this.bookreader.zoom(1)}},{key:"onZoomOut",value:function(){this.bookreader.zoom()}},{key:"onAdjustmentChange",value:function(e){var t=e.detail,n={brightness:function(e){return"brightness(".concat(e,"%)")},contrast:function(e){return"contrast(".concat(e,"%)")},grayscale:function(){return"grayscale(100%)"},invert:function(){return"invert(100%)"}},o=t.options.reduce((function(e,t){var o,r="".concat(t.active?n[t.id](t.value):"");return r?[].concat(function(e){if(Array.isArray(e))return So(e)}(o=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(o)||function(e,t){if(e){if("string"==typeof e)return So(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?So(e,t):void 0}}(o)||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.")}(),[r]):e}),[]).join(" ");document.querySelector(this.bookContainerSelector).style.setProperty("filter",o),this.optionUpdateComplete(e)}},{key:"optionUpdateComplete",value:function(e){this.activeCount=e.detail.activeCount,this.updateOptionsCount(e),this.onOptionChange(e)}},{key:"updateOptionsCount",value:function(){this.menuDetails="(".concat(this.activeCount," active)")}}])&&Oo(t.prototype,n),e}();function To(e){return(To="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})(e)}function Eo(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function jo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mo(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Po(e,t){return(Po=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ao(e,t){if(t&&("object"===To(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Ro(e){return(Ro=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var _o,$o,No=function(e){!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}}),t&&Po(e,t)}(l,e);var t,n,r,i,a,s=(i=l,a=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=Ro(i);if(a){var n=Ro(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Ao(this,e)});function l(){return jo(this,l),s.apply(this,arguments)}return t=l,r=[{key:"styles",get:function(){return(0,o.iv)(zo||(zo=Eo(['\n div {\n display: flex;\n justify-content: center;\n padding-top: 2rem;\n }\n\n button {\n appearance: none;\n padding: 0.5rem 1rem;\n margin: 0 .5rem;\n box-sizing: border-box;\n font: 1.3rem "Helvetica Neue", Helvetica, Arial, sans-serif;\n color: var(--primaryTextColor);\n border: none;\n border-radius: 4px;\n cursor: pointer;\n background: var(--primaryCTAFill);\n }\n\n .delete {\n background: var(--primaryErrorCTAFill);\n }\n '])))}},{key:"properties",get:function(){return{cancelAction:{type:Function},deleteAction:{type:Function},pageID:{type:String}}}}],(n=[{key:"render",value:function(){var e=this;return(0,o.dy)(Io||(Io=Eo(['\n <div>\n <button class="delete" @click=',">Delete</button>\n <button @click=",">Cancel</button>\n </div>\n "])),(function(){return e.deleteAction({detail:{id:"".concat(e.pageID)}})}),(function(){return e.cancelAction()}))}}])&&Mo(t.prototype,n),r&&Mo(t,r),l}(o.oi);function Ho(e){return(Ho="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})(e)}function Fo(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Zo(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Wo(e,t){return(Wo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function qo(e,t){if(t&&("object"===Ho(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Uo(e){return(Uo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}customElements.define("delete-modal-actions",No);var Vo,Go=function(e){!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}}),t&&Wo(e,t)}(l,e);var t,n,r,i,a,s=(i=l,a=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=Uo(i);if(a){var n=Uo(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return qo(this,e)});function l(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(e=s.call(this)).state="hollow",e}return t=l,r=[{key:"styles",get:function(){return(0,o.iv)($o||($o=Fo(["\n button {\n -webkit-appearance: none;\n appearance: none;\n outline: 0;\n border: none;\n padding: 0;\n height: 4rem;\n width: 4rem;\n background: transparent;\n cursor: url('/images/bookreader/bookmark-add.png'), pointer;\n position: relative;\n }\n button > * {\n display: block;\n position: absolute;\n top: 0.2rem;\n }\n button.left > * {\n left: 0.2rem;\n }\n\n button.right > * {\n right: 0.2rem;\n }\n "])))}},{key:"properties",get:function(){return{side:{type:String},state:{type:String}}}}],(n=[{key:"handleClick",value:function(e){e.preventDefault(),this.dispatchEvent(new CustomEvent("bookmarkButtonClicked"))}},{key:"title",get:function(){return"".concat("hollow"===this.state?"Add":"Remove"," bookmark")}},{key:"render",value:function(){var e=this.side||"right";return(0,o.dy)(_o||(_o=Fo(["\n <button title="," @click="," class=",">\n <icon-bookmark state=","></icon-bookmark>\n </button>\n "])),this.title,this.handleClick,e,this.state)}}])&&Zo(t.prototype,n),r&&Zo(t,r),l}(o.oi);function Xo(e){return(Xo="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})(e)}function Yo(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Jo(e,t){return(Jo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Qo(e,t){if(t&&("object"===Xo(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Ko(e){return(Ko=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}customElements.define("bookmark-button",Go),n(5003),n(9337),n(6699),n(2023);var er,tr,nr,or,rr,ir,ar,sr,lr=function(e){!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}}),t&&Jo(e,t)}(l,e);var t,n,r,i,a,s=(i=l,a=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=Ko(i);if(a){var n=Ko(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Qo(this,e)});function l(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(e=s.call(this)).url="https://archive.org/account/login",e}return t=l,r=[{key:"properties",get:function(){return{url:{type:String}}}},{key:"styles",get:function(){return tn}}],(n=[{key:"render",value:function(){return(0,o.dy)(Vo||(Vo=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <p>A free account is required to save and access bookmarks.</p>\n <a class="ia-button link primary" href="','">Log in</a>\n '])),this.url)}}])&&Yo(t.prototype,n),r&&Yo(t,r),l}(o.oi);function cr(e){return(cr="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})(e)}function dr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function ur(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function hr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ur(Object(n),!0).forEach((function(t){fr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ur(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function fr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pr(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function mr(e,t){return(mr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function vr(e,t){if(t&&("object"===cr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function br(e){return(br=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}customElements.define("bookmarks-login",lr);var yr,gr={endpoint:"/services/bookmarks.php",headers:{"Content-Type":"application/json"},delete:function(e){return fetch("".concat(this.endpoint,"?identifier=").concat(this.identifier,"&page_num=").concat(e),{credentials:"same-origin",method:"DELETE",headers:this.headers})},get:function(e){return fetch("".concat(this.endpoint,"?identifier=").concat(this.identifier,"&page_num=").concat(e),{credentials:"same-origin",method:"GET",headers:this.headers})},getAll:function(){return fetch("".concat(this.endpoint,"?identifier=").concat(this.identifier),{credentials:"same-origin",method:"GET",headers:this.headers})},post:function(e){return this.sendBookmarkData(e,"POST")},put:function(e){return this.sendBookmarkData(e,"POST")},sendBookmarkData:function(e,t){var n={note:e.note,color:e.color};return fetch("".concat(this.endpoint,"?identifier=").concat(this.identifier,"&page_num=").concat(e.id),{credentials:"same-origin",method:t,headers:this.headers,body:JSON.stringify({notes:n})})}},kr=function(e){!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}}),t&&mr(e,t)}(c,e);var t,n,i,a,s,l=(a=c,s=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=br(a);if(s){var n=br(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return vr(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.call(this)).bookmarks=[],e.bookreader={},e.editedBookmark={},e.options={},e.displayMode="bookmarks",e.bookmarkColors=[{id:0,className:"red"},{id:1,className:"blue"},{id:2,className:"green"}],e.defaultColor=e.bookmarkColors[0],e.api=gr,e}return t=c,i=[{key:"properties",get:function(){return{activeBookmarkID:{type:String},bookmarks:{type:Array},bookreader:{type:Object},options:{type:Object},displayMode:{type:String},editedBookmark:{type:Object}}}},{key:"styles",get:function(){var e=(0,o.iv)(sr||(sr=dr(["\n .bookmarks {\n height: 100%;\n overflow: hidden;\n padding-bottom: 20px;\n }\n\n .list ia-bookmark-edit {\n display: none;\n }\n\n .edit ia-bookmarks-list {\n display: none;\n }\n "])));return[tn,e]}},{key:"formatPage",value:function(e){return isNaN(+e)?"(".concat(e.replace(/\D/g,""),")"):e}}],(n=[{key:"updated",value:function(){this.emitBookmarksChanged()}},{key:"setup",value:function(){var e=this;this.api.identifier=this.bookreader.bookId,this.fetchBookmarks().then((function(){return e.initializeBookmarks()})).catch((function(t){return e.displayMode="login"}))}},{key:"initializeBookmarks",value:function(){var e=this;this.displayMode="bookmarks",["3PageViewSelected"].forEach((function(t){window.addEventListener("BookReader:".concat(t),(function(t){setTimeout((function(){e.renderBookmarkButtons()}),100)}))})),["pageChanged","1PageViewSelected","2PageViewSelected"].forEach((function(t){window.addEventListener("BookReader:".concat(t),(function(t){setTimeout((function(){e.renderBookmarkButtons(),e.markActiveBookmark()}),100)}))})),["zoomOut","zoomIn","resize"].forEach((function(t){window.addEventListener("BookReader:".concat(t),(function(){e.bookreader.mode===e.bookreader.constModeThumb&&e.renderBookmarkButtons()}))})),this.renderBookmarkButtons(),this.markActiveBookmark(!0),this.emitBookmarksChanged()}},{key:"formatBookmark",value:function(e){var t=e.leafNum,n=void 0===t?"":t,o=e.notes,r=void 0===o?{}:o,i=r.note,a=void 0===i?"":i,s=r.color,l={note:a,color:this.getBookmarkColor(s)?s:this.defaultColor.id},d=c.formatPage(this.bookreader.getPageNum(n)),u=this.bookreader.getPageURI("".concat(n).replace(/\D/g,""),32);return hr(hr({},l),{},{id:n,leafNum:n,page:d,thumbnail:u})}},{key:"fetchBookmarks",value:function(){var e=this;return this.api.getAll().then((function(e){return e.json()})).then((function(t){var n=t.success,o=t.error,r=void 0===o?"Something happened while fetching bookmarks.":o,i=t.value,a=void 0===i?[]:i;if(!n)throw new Error("Failed to load bookmarks: ".concat(r));var s={};return Object.keys(a).forEach((function(t){var n=a[t],o=parseInt(t,10),r=e.formatBookmark(hr(hr({},n),{},{leafNum:o}));s[t]=r})),e.bookmarks=s,s}))}},{key:"emitBookmarksChanged",value:function(){this.dispatchEvent(new CustomEvent("bookmarksChanged",{bubbles:!0,composed:!0,detail:{bookmarks:this.bookmarks}}))}},{key:"emitBookmarkButtonClicked",value:function(){this.dispatchEvent(new CustomEvent("bookmarkButtonClicked",{bubbles:!0,composed:!0,detail:{editedBookmark:this.editedBookmark}}))}},{key:"bookmarkButtonClicked",value:function(e){this.getBookmark(e)?this.confirmDeletion(e):this.createBookmark(e)}},{key:"renderBookmarkButtons",value:function(){var e=this;this.bookreader.$(".BRpagecontainer").not(".BRemptypage").get().forEach((function(t){var n=t.querySelector(".bookmark-button");n&&n.remove();var i=+t.classList.value.match(/pagediv\d+/)[0].replace(/\D/g,""),a=e.getBookmark(i),s=a?"filled":"hollow";if(e.bookreader._models.book.getPage(i).isViewable){var l=document.createElement("div");["mousedown","mouseup"].forEach((function(e){l.addEventListener(e,(function(e){return e.stopPropagation()}))})),l.classList.add("bookmark-button",s),a&&l.classList.add(e.getBookmarkColor(a.color));var c="L"===t.getAttribute("data-side")&&e.bookreader.mode===e.bookreader.constMode2up?"left":"right";(0,r.sY)((0,o.dy)(er||(er=dr(["\n <bookmark-button\n @bookmarkButtonClicked=","\n state=","\n side=","\n ></bookmark-button>"])),(function(){return e.bookmarkButtonClicked(i)}),s,c),l),t.appendChild(l)}}))}},{key:"markActiveBookmark",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.bookreader,n=t.mode,o=t.constMode2up,r=t.constModeThumb,i=this.bookreader.currentIndex();if(n!==r){if(n===o){var a=this.bookreader.displayedIndices,s=a.includes(+this.activeBookmarkID);if(s)return}this.bookmarks[i]?this.activeBookmarkID=i:this.activeBookmarkID=""}else{var l=this.bookmarks[i];e&&l&&(this.activeBookmarkID=i)}}},{key:"bookmarkEdited",value:function(e){var t=e.detail,n=t.bookmark.id===this.editedBookmark.id;this.editedBookmark=n?{}:t.bookmark}},{key:"getBookmark",value:function(e){return this.bookmarks[e]}},{key:"getBookmarkColor",value:function(e){var t;return null===(t=this.bookmarkColors.find((function(t){return t.id===e})))||void 0===t?void 0:t.className}},{key:"addBookmark",value:function(){var e=this.bookreader.currentIndex();if(this.bookreader.mode===this.bookreader.constMode2up){var t=this.bookreader.displayedIndices;e=t[t.length-1]}this.createBookmark(e)}},{key:"createBookmark",value:function(e){var t=this.getBookmark(e);if(t)return this.bookmarkEdited({detail:{bookmark:t}}),void this.emitBookmarkButtonClicked();this.editedBookmark=this.formatBookmark({leafNum:e}),this.api.post(this.editedBookmark),this.bookmarks[e]=this.editedBookmark,this.activeBookmarkID=e,this.disableAddBookmarkButton=!0,this.renderBookmarkButtons(),this.emitBookmarkButtonClicked()}},{key:"bookmarkSelected",value:function(e){var t=e.detail.bookmark.leafNum;this.bookreader.jumpToPage("".concat(this.bookreader.getPageNum("".concat(t).replace(/\D/g,"")))),this.activeBookmarkID=t}},{key:"saveBookmark",value:function(e){var t=e.detail,n=this.bookmarks[t.bookmark.id];Object.assign(n,t.bookmark),this.api.put(n),this.editedBookmark={},this.renderBookmarkButtons()}},{key:"confirmDeletion",value:function(e){this.getBookmark(e).note?this.emitShowModal(e):this.deleteBookmark({detail:{id:"".concat(e)}})}},{key:"emitShowModal",value:function(e){var t=this;this.dispatchEvent(new CustomEvent("showItemNavigatorModal",{bubbles:!0,composed:!0,detail:{customModalContent:(0,o.dy)(tr||(tr=dr(["\n <delete-modal-actions\n .deleteAction=","\n .cancelAction=","\n .pageID=","\n ></delete-modal-actions>\n "])),(function(){return t.deleteBookmark({detail:{id:"".concat(e)}})}),(function(){return t.emitCloseModal()}),e)}}))}},{key:"emitCloseModal",value:function(){this.dispatchEvent(new CustomEvent("closeItemNavigatorModal",{bubbles:!0,composed:!0}))}},{key:"deleteBookmark",value:function(e){var t=e.detail,n=t.id,o=this.bookmarks;delete o[n],this.bookmarks=hr({},o),this.api.delete(t.id),this.editedBookmark={},this.emitCloseModal(),this.renderBookmarkButtons()}},{key:"loginClick",value:function(){var e=this.options.loginClicked;(void 0===e?function(){}:e)()}},{key:"shouldEnableAddBookmarkButton",get:function(){var e=this.bookreader.mode===this.bookreader.constMode2up?this.bookreader.displayedIndices[this.bookreader.displayedIndices.length-1]:this.bookreader.currentIndex();return!!this.getBookmark(e)}},{key:"allowAddingBookmark",get:function(){return this.bookreader.mode!==this.bookreader.constModeThumb}},{key:"addBookmarkButton",get:function(){return(0,o.dy)(nr||(nr=dr(['\n <button\n class="ia-button primary"\n ?disabled=',"\n @click=",">\n Add bookmark\n </button>\n "])),this.shouldEnableAddBookmarkButton,this.addBookmark)}},{key:"bookmarksList",get:function(){return(0,o.dy)(or||(or=dr(["\n <ia-bookmarks-list\n @bookmarkEdited=","\n @bookmarkSelected=","\n @saveBookmark=","\n @deleteBookmark=","\n .editedBookmark=","\n .bookmarks=","\n .activeBookmarkID=","\n .bookmarkColors=","\n .defaultBookmarkColor=",">\n </ia-bookmarks-list>\n "])),this.bookmarkEdited,this.bookmarkSelected,this.saveBookmark,this.deleteBookmark,this.editedBookmark,hr({},this.bookmarks),this.activeBookmarkID,this.bookmarkColors,this.defaultColor)}},{key:"render",value:function(){var e=this.options.loginUrl,t=(0,o.dy)(rr||(rr=dr(["\n ","\n ","\n "])),this.bookmarksList,this.allowAddingBookmark?this.addBookmarkButton:r.Ld);return(0,o.dy)(ir||(ir=dr(['\n <section class="bookmarks">\n ',"\n </section>\n "])),"login"===this.displayMode?(0,o.dy)(ar||(ar=dr(["<bookmarks-login @click="," .url=","></bookmarks-login>"])),this.loginClick,e):t)}}])&&pr(t.prototype,n),i&&pr(t,i),c}(o.oi);customElements.define("ia-bookmarks",kr);var wr,Cr,xr,Sr,Br,Or=(0,o.iv)(yr||(yr=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n .blue {\n --iconFillColor: var(--blueBookmarkColor, #0023f5);\n }\n\n .red {\n --iconFillColor: var(--redBookmarkColor, #eb3223);\n }\n\n .green {\n --iconFillColor: var(--greenBookmarkColor, #75ef4c);\n }\n"])));function Ir(e){return(Ir="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})(e)}function zr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Dr(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Lr(e,t){return(Lr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Tr(e,t){if(t&&("object"===Ir(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Er(e){return(Er=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var jr,Mr,Pr,Ar,Rr,_r,$r,Nr,Hr=function(e){!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}}),t&&Lr(e,t)}(c,e);var t,n,i,a,s,l=(a=c,s=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=Er(a);if(s){var n=Er(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Tr(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.call(this)).bookmark={},e.bookmarkColors=[],e.renderHeader=!1,e.showBookmark=!0,e}return t=c,i=[{key:"properties",get:function(){return{bookmark:{type:Object},bookmarkColors:{type:Array},renderHeader:{type:Boolean},showBookmark:{type:Boolean}}}},{key:"headerSection",get:function(){return(0,o.dy)(Sr||(Sr=zr(["<header>\n <h3>Edit Bookmark</h3>\n </header>"])))}},{key:"styles",get:function(){var e=(0,o.iv)(Br||(Br=zr(['\n :host {\n display: block;\n padding: 0 1rem 2rem 1rem;\n color: var(--primaryTextColor);\n }\n\n small {\n font-style: italic;\n }\n\n .bookmark {\n display: grid;\n grid-template-columns: 37px 1fr;\n grid-gap: 0 1rem;\n align-items: center;\n }\n\n h4 {\n margin: 0;\n font-size: 1.4rem;\n }\n\n fieldset {\n padding: 2rem 0 0 0;\n border: none;\n }\n\n label {\n display: block;\n font-weight: bold;\n }\n\n p {\n padding: 0;\n margin: .5rem 0;\n font-size: 1.2rem;\n line-height: 120%;\n }\n\n textarea {\n width: 100%;\n margin-bottom: 2rem;\n box-sizing: border-box;\n font: normal 1.4rem "Helvetica Neue", Helvetica, Arial, sans-serif;\n resize: vertical;\n }\n\n ul {\n display: grid;\n grid-template-columns: repeat(3, auto);\n grid-gap: 0 2rem;\n justify-content: start;\n padding: 1rem 0 0 0;\n margin: 0 0 2rem 0;\n list-style: none;\n }\n\n li input {\n display: none;\n }\n\n li label {\n display: block;\n min-width: 50px;\n padding-top: .4rem;\n text-align: center;\n border: 1px solid transparent;\n border-radius: 4px;\n cursor: pointer;\n }\n\n li input:checked + label {\n border-color: var(--primaryTextColor);\n }\n\n input[type="submit"] {\n background: var(--primaryCTAFill);\n border-color: var(--primaryCTABorder);\n }\n\n button {\n background: var(--primaryErrorCTAFill);\n border-color: var(--primaryErrorCTABorder);\n }\n\n .button {\n -webkit-appearance: none;\n appearance: none;\n padding: .5rem 1rem;\n box-sizing: border-box;\n color: var(--primaryTextColor);\n border: none;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .actions {\n display: grid;\n grid-template-columns: auto auto;\n grid-gap: 0 1rem;\n justify-items: stretch;\n }\n '])));return[tn,Or,e]}}],(n=[{key:"emitSaveEvent",value:function(e){e.preventDefault(),this.dispatchEvent(new CustomEvent("saveBookmark",{detail:{bookmark:this.bookmark}}))}},{key:"emitDeleteEvent",value:function(){this.dispatchEvent(new CustomEvent("deleteBookmark",{detail:{id:this.bookmark.id}}))}},{key:"emitColorChangedEvent",value:function(e){this.dispatchEvent(new CustomEvent("bookmarkColorChanged",{detail:{bookmarkId:this.bookmark.id,colorId:e}}))}},{key:"changeColorTo",value:function(e){this.bookmark.color=e,this.emitColorChangedEvent(e)}},{key:"updateNote",value:function(e){this.bookmark.note=e.currentTarget.value}},{key:"bookmarkColor",value:function(e){var t=this;return(0,o.dy)(wr||(wr=zr(['\n <li>\n <input type="radio" name="color" id="color_','" .value='," @change="," ?checked=",'>\n <label for="color_','">\n <icon-bookmark class=',"></icon-bookmark>\n </label>\n </li>\n "])),e.id,e.id,(function(){return t.changeColorTo(e.id)}),this.bookmark.color===e.id,e.id,e.className)}},{key:"bookmarkTemplate",get:function(){return(0,o.dy)(Cr||(Cr=zr(['\n <div class="bookmark">\n <img src='," />\n <h4>Page ","</h4>\n </div>\n "])),this.bookmark.thumbnail,this.bookmark.page)}},{key:"render",value:function(){return(0,o.dy)(xr||(xr=zr(["\n ","\n ",'\n <form action="" method="put" @submit=','>\n <fieldset>\n <label for="note">Note <small>(optional)</small></label>\n <textarea rows="4" cols="80" name="note" id="note" @change=',">",'</textarea>\n <label for="color">Bookmark color</label>\n <ul>\n ','\n </ul>\n <div class="actions">\n <button type="button" class="ia-button cancel" @click=','>Delete</button>\n <input class="ia-button" type="submit" value="Save">\n </div>\n </fieldset>\n </form>\n '])),this.renderHeader?c.headerSection:r.Ld,this.showBookmark?this.bookmarkTemplate:r.Ld,this.emitSaveEvent,this.updateNote,this.bookmark.note,so(this.bookmarkColors,(function(e){return e.id}),this.bookmarkColor.bind(this)),this.emitDeleteEvent)}}])&&Dr(t.prototype,n),i&&Dr(t,i),c}(o.oi);customElements.define("ia-bookmark-edit",Hr),n(2707);class Fr extends o.oi{static get styles(){return o.iv`
1178
+ `}render(){return P}}function uo(e){return(uo="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})(e)}function ho(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function fo(e){return function(e){if(Array.isArray(e))return po(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return po(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?po(e,t):void 0}}(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.")}()}function po(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function mo(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function vo(e,t){return(vo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function bo(e,t){if(t&&("object"===uo(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function yo(e){return(yo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}customElements.define("ia-icon-magnify-plus",co);var go,ko,wo=function(e){return"visualAdjustment".concat(e)},Co={optionChange:wo("OptionChanged"),zoomIn:wo("ZoomIn"),zoomOut:wo("ZoomOut")},xo=function(e){!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}}),t&&vo(e,t)}(c,e);var t,n,i,a,s,l=(a=c,s=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=yo(a);if(s){var n=yo(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return bo(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.call(this)).activeCount=0,e.options=[],e.renderHeader=!1,e.showZoomControls=!0,e}return t=c,i=[{key:"properties",get:function(){return{activeCount:{type:Number},options:{type:Array},renderHeader:{type:Boolean},showZoomControls:{type:Boolean}}}},{key:"styles",get:function(){return(0,o.iv)(Kn||(Kn=ho(['\n :host {\n display: block;\n height: 100%;\n overflow-y: auto;\n font-size: 1.4rem;\n box-sizing: border-box;\n }\n\n header {\n display: flex;\n align-items: baseline;\n }\n\n h3 {\n padding: 0;\n margin: 0 1rem 0 0;\n font-size: 1.6rem;\n }\n\n header p {\n padding: 0;\n margin: 0;\n font-size: 1.2rem;\n font-weight: bold;\n font-style: italic;\n }\n\n ul {\n padding: 1rem 2rem 0 0;\n list-style: none;\n margin-top: 0;\n }\n\n [type="checkbox"] {\n display: none;\n }\n\n label {\n display: flex;\n justify-content: space-between;\n align-items: baseline;\n font-size: 1.4rem;\n font-weight: bold;\n line-height: 150%;\n vertical-align: middle;\n }\n\n .icon {\n display: inline-block;\n width: 14px;\n height: 14px;\n margin-left: .7rem;\n border: 1px solid var(--primaryTextColor);\n border-radius: 2px;\n background: var(--activeButtonBg) 50% 50% no-repeat;\n }\n :checked + .icon {\n background-image: url(\'',"');\n }\n\n .range {\n display: none;\n padding-top: .5rem;\n }\n .range.visible {\n display: flex;\n }\n\n .range p {\n margin-left: 1rem;\n }\n\n h4 {\n padding: 1rem 0;\n margin: 0;\n font-size: 1.4rem;\n }\n\n button {\n -webkit-appearance: none;\n appearance: none;\n border: none;\n border-radius: 0;\n background: transparent;\n outline: none;\n cursor: pointer;\n --iconFillColor: var(--primaryTextColor);\n --iconStrokeColor: var(--primaryTextColor);\n height: 4rem;\n width: 4rem;\n }\n\n button * {\n display: inline-block;\n }"])),Kt)}}],(n=[{key:"firstUpdated",value:function(){this.activeCount=this.activeOptions.length,this.emitOptionChangedEvent()}},{key:"activeOptions",get:function(){return this.options.reduce((function(e,t){return t.active?[].concat(fo(e),[t.id]):e}),[])}},{key:"prepareEventDetails",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return{options:this.options,activeCount:this.activeCount,changedOptionId:e}}},{key:"emitOptionChangedEvent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=this.prepareEventDetails(e);this.dispatchEvent(new CustomEvent(Co.optionChange,{bubbles:!0,composed:!0,detail:t}))}},{key:"emitZoomIn",value:function(){this.dispatchEvent(new CustomEvent(Co.zoomIn))}},{key:"emitZoomOut",value:function(){this.dispatchEvent(new CustomEvent(Co.zoomOut))}},{key:"changeActiveStateFor",value:function(e){var t=fo(this.options),n=t.find((function(t){return t.id===e}));n.active=!n.active,this.options=t,this.activeCount=this.activeOptions.length,this.emitOptionChangedEvent(n.id)}},{key:"setRangeValue",value:function(e,t){var n=fo(this.options);n.find((function(t){return t.id===e})).value=t,this.options=fo(n)}},{key:"rangeSlider",value:function(e){var t=this;return(0,o.dy)(Vn||(Vn=ho(["\n <div class=",'>\n <input\n type="range"\n name="','_range"\n min=',"\n max=","\n step=","\n .value=","\n @input=","\n @change=","\n />\n <p>","%</p>\n </div>\n "])),"range".concat(e.active?" visible":""),e.id,e.min||0,e.max||100,e.step||1,e.value,(function(n){return t.setRangeValue(e.id,n.target.value)}),(function(){return t.emitOptionChangedEvent()}),e.value)}},{key:"adjustmentCheckbox",value:function(e){var t=this,n="adjustment_".concat(e.id);return(0,o.dy)(Gn||(Gn=ho(['<li>\n <label for="','">\n <span class="name">','</span>\n <input\n type="checkbox"\n name="','"\n id="','"\n @change=',"\n ?checked=",'\n />\n <span class="icon"></span>\n </label>\n ',"\n </li>"])),n,e.name,n,n,(function(){return t.changeActiveStateFor(e.id)}),e.active,void 0!==e.value?this.rangeSlider(e):r.Ld)}},{key:"headerSection",get:function(){var e=this.activeCount?(0,o.dy)(Xn||(Xn=ho(["<p>("," active)</p>"])),this.activeCount):r.Ld,t=(0,o.dy)(Yn||(Yn=ho(["<header>\n <h3>Visual adjustments</h3>\n ","\n </header>"])),e);return this.renderHeader?t:r.Ld}},{key:"zoomControls",get:function(){return(0,o.dy)(Jn||(Jn=ho(['\n <h4>Zoom</h4>\n <button class="zoom_out" @click=',' title="zoom out">\n <ia-icon-magnify-minus></ia-icon-magnify-minus>\n </button>\n <button class="zoom_in" @click=',' title="zoom in">\n <ia-icon-magnify-plus></ia-icon-magnify-plus>\n </button>\n '])),this.emitZoomOut,this.emitZoomIn)}},{key:"render",value:function(){return(0,o.dy)(Qn||(Qn=ho(["\n ","\n <ul>\n ","\n </ul>\n ","\n "])),this.headerSection,so(this.options,(function(e){return e.id}),this.adjustmentCheckbox.bind(this)),this.showZoomControls?this.zoomControls:r.Ld)}}])&&mo(t.prototype,n),i&&mo(t,i),c}(o.oi);function So(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Bo(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Oo(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}customElements.define("ia-book-visual-adjustments",xo);var Io,zo,Do=[{id:"brightness",name:"Adjust brightness",active:!1,min:0,max:150,step:1,value:100},{id:"contrast",name:"Adjust contrast",active:!1,min:0,max:150,step:1,value:100},{id:"invert",name:"Inverted colors (dark mode)",active:!1},{id:"grayscale",name:"Grayscale",active:!1}],Lo=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var n=t.onOptionChange,r=void 0===n?function(){}:n,i=t.bookContainerSelector,a=t.bookreader;this.onOptionChange=r,this.bookContainerSelector=i,this.bookreader=a,this.onAdjustmentChange=this.onAdjustmentChange.bind(this),this.optionUpdateComplete=this.optionUpdateComplete.bind(this),this.updateOptionsCount=this.updateOptionsCount.bind(this),this.onZoomIn=this.onZoomIn.bind(this),this.onZoomOut=this.onZoomOut.bind(this),this.activeCount=0,this.icon=(0,o.dy)(go||(go=Bo(['<ia-icon icon="visualAdjustment" style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon>']))),this.label="Visual Adjustments",this.menuDetails=this.updateOptionsCount(),this.id="adjustment",this.component=(0,o.dy)(ko||(ko=Bo(["\n <ia-book-visual-adjustments\n .options=","\n @visualAdjustmentOptionChanged=","\n @visualAdjustmentZoomIn=","\n @visualAdjustmentZoomOut=","\n ></ia-book-visual-adjustments>\n "])),Do,this.onAdjustmentChange,this.onZoomIn,this.onZoomOut)}var t,n;return t=e,(n=[{key:"onZoomIn",value:function(){this.bookreader.zoom(1)}},{key:"onZoomOut",value:function(){this.bookreader.zoom(-1)}},{key:"onAdjustmentChange",value:function(e){var t=e.detail,n={brightness:function(e){return"brightness(".concat(e,"%)")},contrast:function(e){return"contrast(".concat(e,"%)")},grayscale:function(){return"grayscale(100%)"},invert:function(){return"invert(100%)"}},o=t.options.reduce((function(e,t){var o,r="".concat(t.active?n[t.id](t.value):"");return r?[].concat(function(e){if(Array.isArray(e))return So(e)}(o=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(o)||function(e,t){if(e){if("string"==typeof e)return So(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?So(e,t):void 0}}(o)||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.")}(),[r]):e}),[]).join(" ");document.querySelector(this.bookContainerSelector).style.setProperty("filter",o),this.optionUpdateComplete(e)}},{key:"optionUpdateComplete",value:function(e){this.activeCount=e.detail.activeCount,this.updateOptionsCount(e),this.onOptionChange(e)}},{key:"updateOptionsCount",value:function(){this.menuDetails="(".concat(this.activeCount," active)")}}])&&Oo(t.prototype,n),e}();function To(e){return(To="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})(e)}function Eo(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function jo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mo(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Po(e,t){return(Po=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ao(e,t){if(t&&("object"===To(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Ro(e){return(Ro=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var _o,$o,No=function(e){!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}}),t&&Po(e,t)}(l,e);var t,n,r,i,a,s=(i=l,a=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=Ro(i);if(a){var n=Ro(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Ao(this,e)});function l(){return jo(this,l),s.apply(this,arguments)}return t=l,r=[{key:"styles",get:function(){return(0,o.iv)(zo||(zo=Eo(['\n div {\n display: flex;\n justify-content: center;\n padding-top: 2rem;\n }\n\n button {\n appearance: none;\n padding: 0.5rem 1rem;\n margin: 0 .5rem;\n box-sizing: border-box;\n font: 1.3rem "Helvetica Neue", Helvetica, Arial, sans-serif;\n color: var(--primaryTextColor);\n border: none;\n border-radius: 4px;\n cursor: pointer;\n background: var(--primaryCTAFill);\n }\n\n .delete {\n background: var(--primaryErrorCTAFill);\n }\n '])))}},{key:"properties",get:function(){return{cancelAction:{type:Function},deleteAction:{type:Function},pageID:{type:String}}}}],(n=[{key:"render",value:function(){var e=this;return(0,o.dy)(Io||(Io=Eo(['\n <div>\n <button class="delete" @click=',">Delete</button>\n <button @click=",">Cancel</button>\n </div>\n "])),(function(){return e.deleteAction({detail:{id:"".concat(e.pageID)}})}),(function(){return e.cancelAction()}))}}])&&Mo(t.prototype,n),r&&Mo(t,r),l}(o.oi);function Ho(e){return(Ho="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})(e)}function Fo(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Zo(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Wo(e,t){return(Wo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function qo(e,t){if(t&&("object"===Ho(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Uo(e){return(Uo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}customElements.define("delete-modal-actions",No);var Vo,Go=function(e){!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}}),t&&Wo(e,t)}(l,e);var t,n,r,i,a,s=(i=l,a=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=Uo(i);if(a){var n=Uo(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return qo(this,e)});function l(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(e=s.call(this)).state="hollow",e}return t=l,r=[{key:"styles",get:function(){return(0,o.iv)($o||($o=Fo(["\n button {\n -webkit-appearance: none;\n appearance: none;\n outline: 0;\n border: none;\n padding: 0;\n height: 4rem;\n width: 4rem;\n background: transparent;\n cursor: url('/images/bookreader/bookmark-add.png'), pointer;\n position: relative;\n }\n button > * {\n display: block;\n position: absolute;\n top: 0.2rem;\n }\n button.left > * {\n left: 0.2rem;\n }\n\n button.right > * {\n right: 0.2rem;\n }\n "])))}},{key:"properties",get:function(){return{side:{type:String},state:{type:String}}}}],(n=[{key:"handleClick",value:function(e){e.preventDefault(),this.dispatchEvent(new CustomEvent("bookmarkButtonClicked"))}},{key:"title",get:function(){return"".concat("hollow"===this.state?"Add":"Remove"," bookmark")}},{key:"render",value:function(){var e=this.side||"right";return(0,o.dy)(_o||(_o=Fo(["\n <button title="," @click="," class=",">\n <icon-bookmark state=","></icon-bookmark>\n </button>\n "])),this.title,this.handleClick,e,this.state)}}])&&Zo(t.prototype,n),r&&Zo(t,r),l}(o.oi);function Xo(e){return(Xo="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})(e)}function Yo(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Jo(e,t){return(Jo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Qo(e,t){if(t&&("object"===Xo(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Ko(e){return(Ko=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}customElements.define("bookmark-button",Go),n(5003),n(9337),n(6699),n(2023);var er,tr,nr,or,rr,ir,ar,sr,lr=function(e){!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}}),t&&Jo(e,t)}(l,e);var t,n,r,i,a,s=(i=l,a=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=Ko(i);if(a){var n=Ko(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Qo(this,e)});function l(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),(e=s.call(this)).url="https://archive.org/account/login",e}return t=l,r=[{key:"properties",get:function(){return{url:{type:String}}}},{key:"styles",get:function(){return tn}}],(n=[{key:"render",value:function(){return(0,o.dy)(Vo||(Vo=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <p>A free account is required to save and access bookmarks.</p>\n <a class="ia-button link primary" href="','">Log in</a>\n '])),this.url)}}])&&Yo(t.prototype,n),r&&Yo(t,r),l}(o.oi);function cr(e){return(cr="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})(e)}function dr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function ur(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function hr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ur(Object(n),!0).forEach((function(t){fr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ur(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function fr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pr(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function mr(e,t){return(mr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function vr(e,t){if(t&&("object"===cr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function br(e){return(br=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}customElements.define("bookmarks-login",lr);var yr,gr={endpoint:"/services/bookmarks.php",headers:{"Content-Type":"application/json"},delete:function(e){return fetch("".concat(this.endpoint,"?identifier=").concat(this.identifier,"&page_num=").concat(e),{credentials:"same-origin",method:"DELETE",headers:this.headers})},get:function(e){return fetch("".concat(this.endpoint,"?identifier=").concat(this.identifier,"&page_num=").concat(e),{credentials:"same-origin",method:"GET",headers:this.headers})},getAll:function(){return fetch("".concat(this.endpoint,"?identifier=").concat(this.identifier),{credentials:"same-origin",method:"GET",headers:this.headers})},post:function(e){return this.sendBookmarkData(e,"POST")},put:function(e){return this.sendBookmarkData(e,"POST")},sendBookmarkData:function(e,t){var n={note:e.note,color:e.color};return fetch("".concat(this.endpoint,"?identifier=").concat(this.identifier,"&page_num=").concat(e.id),{credentials:"same-origin",method:t,headers:this.headers,body:JSON.stringify({notes:n})})}},kr=function(e){!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}}),t&&mr(e,t)}(c,e);var t,n,i,a,s,l=(a=c,s=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=br(a);if(s){var n=br(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return vr(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.call(this)).bookmarks=[],e.bookreader={},e.editedBookmark={},e.options={},e.displayMode="bookmarks",e.bookmarkColors=[{id:0,className:"red"},{id:1,className:"blue"},{id:2,className:"green"}],e.defaultColor=e.bookmarkColors[0],e.api=gr,e}return t=c,i=[{key:"properties",get:function(){return{activeBookmarkID:{type:String},bookmarks:{type:Array},bookreader:{type:Object},options:{type:Object},displayMode:{type:String},editedBookmark:{type:Object}}}},{key:"styles",get:function(){var e=(0,o.iv)(sr||(sr=dr(["\n .bookmarks {\n height: 100%;\n overflow: hidden;\n padding-bottom: 20px;\n }\n\n .list ia-bookmark-edit {\n display: none;\n }\n\n .edit ia-bookmarks-list {\n display: none;\n }\n "])));return[tn,e]}},{key:"formatPage",value:function(e){return isNaN(+e)?"(".concat(e.replace(/\D/g,""),")"):e}}],(n=[{key:"updated",value:function(){this.emitBookmarksChanged()}},{key:"setup",value:function(){var e=this;this.api.identifier=this.bookreader.bookId,"login"!==this.displayMode&&this.fetchBookmarks().then((function(){return e.initializeBookmarks()})).catch((function(t){return e.displayMode="login"}))}},{key:"initializeBookmarks",value:function(){var e=this;this.displayMode="bookmarks",["3PageViewSelected"].forEach((function(t){window.addEventListener("BookReader:".concat(t),(function(t){setTimeout((function(){e.renderBookmarkButtons()}),100)}))})),["pageChanged","1PageViewSelected","2PageViewSelected"].forEach((function(t){window.addEventListener("BookReader:".concat(t),(function(t){setTimeout((function(){e.renderBookmarkButtons(),e.markActiveBookmark()}),100)}))})),["zoomOut","zoomIn","resize"].forEach((function(t){window.addEventListener("BookReader:".concat(t),(function(){e.bookreader.mode===e.bookreader.constModeThumb&&e.renderBookmarkButtons()}))})),this.renderBookmarkButtons(),this.markActiveBookmark(!0),this.emitBookmarksChanged()}},{key:"formatBookmark",value:function(e){var t=e.leafNum,n=void 0===t?"":t,o=e.notes,r=void 0===o?{}:o,i=r.note,a=void 0===i?"":i,s=r.color,l={note:a,color:this.getBookmarkColor(s)?s:this.defaultColor.id},d=c.formatPage(this.bookreader.getPageNum(n)),u=this.bookreader.getPageURI("".concat(n).replace(/\D/g,""),32);return hr(hr({},l),{},{id:n,leafNum:n,page:d,thumbnail:u})}},{key:"fetchBookmarks",value:function(){var e=this;return this.api.getAll().then((function(e){return e.json()})).then((function(t){var n=t.success,o=t.error,r=void 0===o?"Something happened while fetching bookmarks.":o,i=t.value,a=void 0===i?[]:i;if(!n)throw new Error("Failed to load bookmarks: ".concat(r));var s={};return Object.keys(a).forEach((function(t){var n=a[t],o=parseInt(t,10),r=e.formatBookmark(hr(hr({},n),{},{leafNum:o}));s[t]=r})),e.bookmarks=s,s}))}},{key:"emitBookmarksChanged",value:function(){this.dispatchEvent(new CustomEvent("bookmarksChanged",{bubbles:!0,composed:!0,detail:{bookmarks:this.bookmarks}}))}},{key:"emitBookmarkButtonClicked",value:function(){this.dispatchEvent(new CustomEvent("bookmarkButtonClicked",{bubbles:!0,composed:!0,detail:{editedBookmark:this.editedBookmark}}))}},{key:"bookmarkButtonClicked",value:function(e){this.getBookmark(e)?this.confirmDeletion(e):this.createBookmark(e)}},{key:"renderBookmarkButtons",value:function(){var e=this;this.bookreader.$(".BRpagecontainer").not(".BRemptypage").get().forEach((function(t){var n=t.querySelector(".bookmark-button");n&&n.remove();var i=+t.classList.value.match(/pagediv\d+/)[0].replace(/\D/g,""),a=e.getBookmark(i),s=a?"filled":"hollow";if(e.bookreader._models.book.getPage(i).isViewable){var l=document.createElement("div");["mousedown","mouseup"].forEach((function(e){l.addEventListener(e,(function(e){return e.stopPropagation()}))})),l.classList.add("bookmark-button",s),a&&l.classList.add(e.getBookmarkColor(a.color));var c="L"===t.getAttribute("data-side")&&e.bookreader.mode===e.bookreader.constMode2up?"left":"right";(0,r.sY)((0,o.dy)(er||(er=dr(["\n <bookmark-button\n @bookmarkButtonClicked=","\n state=","\n side=","\n ></bookmark-button>"])),(function(){return e.bookmarkButtonClicked(i)}),s,c),l),t.appendChild(l)}}))}},{key:"markActiveBookmark",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.bookreader,n=t.mode,o=t.constMode2up,r=t.constModeThumb,i=this.bookreader.currentIndex();if(n!==r){if(n===o){var a=this.bookreader.displayedIndices,s=a.includes(+this.activeBookmarkID);if(s)return}this.bookmarks[i]?this.activeBookmarkID=i:this.activeBookmarkID=""}else{var l=this.bookmarks[i];e&&l&&(this.activeBookmarkID=i)}}},{key:"bookmarkEdited",value:function(e){var t=e.detail,n=t.bookmark.id===this.editedBookmark.id;this.editedBookmark=n?{}:t.bookmark}},{key:"getBookmark",value:function(e){return this.bookmarks[e]}},{key:"getBookmarkColor",value:function(e){var t;return null===(t=this.bookmarkColors.find((function(t){return t.id===e})))||void 0===t?void 0:t.className}},{key:"addBookmark",value:function(){var e=this.bookreader.currentIndex();if(this.bookreader.mode===this.bookreader.constMode2up){var t=this.bookreader.displayedIndices;e=t[t.length-1]}this.createBookmark(e)}},{key:"createBookmark",value:function(e){var t=this.getBookmark(e);if(t)return this.bookmarkEdited({detail:{bookmark:t}}),void this.emitBookmarkButtonClicked();this.editedBookmark=this.formatBookmark({leafNum:e}),this.api.post(this.editedBookmark),this.bookmarks[e]=this.editedBookmark,this.activeBookmarkID=e,this.disableAddBookmarkButton=!0,this.renderBookmarkButtons(),this.emitBookmarkButtonClicked()}},{key:"bookmarkSelected",value:function(e){var t=e.detail.bookmark.leafNum;this.bookreader.jumpToPage("".concat(this.bookreader.getPageNum("".concat(t).replace(/\D/g,"")))),this.activeBookmarkID=t}},{key:"saveBookmark",value:function(e){var t=e.detail,n=this.bookmarks[t.bookmark.id];Object.assign(n,t.bookmark),this.api.put(n),this.editedBookmark={},this.renderBookmarkButtons()}},{key:"confirmDeletion",value:function(e){this.getBookmark(e).note?this.emitShowModal(e):this.deleteBookmark({detail:{id:"".concat(e)}})}},{key:"emitShowModal",value:function(e){var t=this;this.dispatchEvent(new CustomEvent("showItemNavigatorModal",{bubbles:!0,composed:!0,detail:{customModalContent:(0,o.dy)(tr||(tr=dr(["\n <delete-modal-actions\n .deleteAction=","\n .cancelAction=","\n .pageID=","\n ></delete-modal-actions>\n "])),(function(){return t.deleteBookmark({detail:{id:"".concat(e)}})}),(function(){return t.emitCloseModal()}),e)}}))}},{key:"emitCloseModal",value:function(){this.dispatchEvent(new CustomEvent("closeItemNavigatorModal",{bubbles:!0,composed:!0}))}},{key:"deleteBookmark",value:function(e){var t=e.detail,n=t.id,o=this.bookmarks;delete o[n],this.bookmarks=hr({},o),this.api.delete(t.id),this.editedBookmark={},this.emitCloseModal(),this.renderBookmarkButtons()}},{key:"loginClick",value:function(){var e=this.options.loginClicked;(void 0===e?function(){}:e)()}},{key:"shouldEnableAddBookmarkButton",get:function(){var e=this.bookreader.mode===this.bookreader.constMode2up?this.bookreader.displayedIndices[this.bookreader.displayedIndices.length-1]:this.bookreader.currentIndex();return!!this.getBookmark(e)}},{key:"allowAddingBookmark",get:function(){return this.bookreader.mode!==this.bookreader.constModeThumb}},{key:"addBookmarkButton",get:function(){return(0,o.dy)(nr||(nr=dr(['\n <button\n class="ia-button primary"\n ?disabled=',"\n @click=",">\n Add bookmark\n </button>\n "])),this.shouldEnableAddBookmarkButton,this.addBookmark)}},{key:"bookmarksList",get:function(){return(0,o.dy)(or||(or=dr(["\n <ia-bookmarks-list\n @bookmarkEdited=","\n @bookmarkSelected=","\n @saveBookmark=","\n @deleteBookmark=","\n .editedBookmark=","\n .bookmarks=","\n .activeBookmarkID=","\n .bookmarkColors=","\n .defaultBookmarkColor=",">\n </ia-bookmarks-list>\n "])),this.bookmarkEdited,this.bookmarkSelected,this.saveBookmark,this.deleteBookmark,this.editedBookmark,hr({},this.bookmarks),this.activeBookmarkID,this.bookmarkColors,this.defaultColor)}},{key:"render",value:function(){var e=this.options.loginUrl,t=(0,o.dy)(rr||(rr=dr(["\n ","\n ","\n "])),this.bookmarksList,this.allowAddingBookmark?this.addBookmarkButton:r.Ld);return(0,o.dy)(ir||(ir=dr(['\n <section class="bookmarks">\n ',"\n </section>\n "])),"login"===this.displayMode?(0,o.dy)(ar||(ar=dr(["<bookmarks-login @click="," .url=","></bookmarks-login>"])),this.loginClick,e):t)}}])&&pr(t.prototype,n),i&&pr(t,i),c}(o.oi);customElements.define("ia-bookmarks",kr);var wr,Cr,xr,Sr,Br,Or=(0,o.iv)(yr||(yr=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n .blue {\n --iconFillColor: var(--blueBookmarkColor, #0023f5);\n }\n\n .red {\n --iconFillColor: var(--redBookmarkColor, #eb3223);\n }\n\n .green {\n --iconFillColor: var(--greenBookmarkColor, #75ef4c);\n }\n"])));function Ir(e){return(Ir="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})(e)}function zr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Dr(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Lr(e,t){return(Lr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Tr(e,t){if(t&&("object"===Ir(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Er(e){return(Er=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var jr,Mr,Pr,Ar,Rr,_r,$r,Nr,Hr=function(e){!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}}),t&&Lr(e,t)}(c,e);var t,n,i,a,s,l=(a=c,s=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=Er(a);if(s){var n=Er(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Tr(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.call(this)).bookmark={},e.bookmarkColors=[],e.renderHeader=!1,e.showBookmark=!0,e}return t=c,i=[{key:"properties",get:function(){return{bookmark:{type:Object},bookmarkColors:{type:Array},renderHeader:{type:Boolean},showBookmark:{type:Boolean}}}},{key:"headerSection",get:function(){return(0,o.dy)(Sr||(Sr=zr(["<header>\n <h3>Edit Bookmark</h3>\n </header>"])))}},{key:"styles",get:function(){var e=(0,o.iv)(Br||(Br=zr(['\n :host {\n display: block;\n padding: 0 1rem 2rem 1rem;\n color: var(--primaryTextColor);\n }\n\n small {\n font-style: italic;\n }\n\n .bookmark {\n display: grid;\n grid-template-columns: 37px 1fr;\n grid-gap: 0 1rem;\n align-items: center;\n }\n\n h4 {\n margin: 0;\n font-size: 1.4rem;\n }\n\n fieldset {\n padding: 2rem 0 0 0;\n border: none;\n }\n\n label {\n display: block;\n font-weight: bold;\n }\n\n p {\n padding: 0;\n margin: .5rem 0;\n font-size: 1.2rem;\n line-height: 120%;\n }\n\n textarea {\n width: 100%;\n margin-bottom: 2rem;\n box-sizing: border-box;\n font: normal 1.4rem "Helvetica Neue", Helvetica, Arial, sans-serif;\n resize: vertical;\n }\n\n ul {\n display: grid;\n grid-template-columns: repeat(3, auto);\n grid-gap: 0 2rem;\n justify-content: start;\n padding: 1rem 0 0 0;\n margin: 0 0 2rem 0;\n list-style: none;\n }\n\n li input {\n display: none;\n }\n\n li label {\n display: block;\n min-width: 50px;\n padding-top: .4rem;\n text-align: center;\n border: 1px solid transparent;\n border-radius: 4px;\n cursor: pointer;\n }\n\n li input:checked + label {\n border-color: var(--primaryTextColor);\n }\n\n input[type="submit"] {\n background: var(--primaryCTAFill);\n border-color: var(--primaryCTABorder);\n }\n\n button {\n background: var(--primaryErrorCTAFill);\n border-color: var(--primaryErrorCTABorder);\n }\n\n .button {\n -webkit-appearance: none;\n appearance: none;\n padding: .5rem 1rem;\n box-sizing: border-box;\n color: var(--primaryTextColor);\n border: none;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .actions {\n display: grid;\n grid-template-columns: auto auto;\n grid-gap: 0 1rem;\n justify-items: stretch;\n }\n '])));return[tn,Or,e]}}],(n=[{key:"emitSaveEvent",value:function(e){e.preventDefault(),this.dispatchEvent(new CustomEvent("saveBookmark",{detail:{bookmark:this.bookmark}}))}},{key:"emitDeleteEvent",value:function(){this.dispatchEvent(new CustomEvent("deleteBookmark",{detail:{id:this.bookmark.id}}))}},{key:"emitColorChangedEvent",value:function(e){this.dispatchEvent(new CustomEvent("bookmarkColorChanged",{detail:{bookmarkId:this.bookmark.id,colorId:e}}))}},{key:"changeColorTo",value:function(e){this.bookmark.color=e,this.emitColorChangedEvent(e)}},{key:"updateNote",value:function(e){this.bookmark.note=e.currentTarget.value}},{key:"bookmarkColor",value:function(e){var t=this;return(0,o.dy)(wr||(wr=zr(['\n <li>\n <input type="radio" name="color" id="color_','" .value='," @change="," ?checked=",'>\n <label for="color_','">\n <icon-bookmark class=',"></icon-bookmark>\n </label>\n </li>\n "])),e.id,e.id,(function(){return t.changeColorTo(e.id)}),this.bookmark.color===e.id,e.id,e.className)}},{key:"bookmarkTemplate",get:function(){return(0,o.dy)(Cr||(Cr=zr(['\n <div class="bookmark">\n <img src='," />\n <h4>Page ","</h4>\n </div>\n "])),this.bookmark.thumbnail,this.bookmark.page)}},{key:"render",value:function(){return(0,o.dy)(xr||(xr=zr(["\n ","\n ",'\n <form action="" method="put" @submit=','>\n <fieldset>\n <label for="note">Note <small>(optional)</small></label>\n <textarea rows="4" cols="80" name="note" id="note" @change=',">",'</textarea>\n <label for="color">Bookmark color</label>\n <ul>\n ','\n </ul>\n <div class="actions">\n <button type="button" class="ia-button cancel" @click=','>Delete</button>\n <input class="ia-button" type="submit" value="Save">\n </div>\n </fieldset>\n </form>\n '])),this.renderHeader?c.headerSection:r.Ld,this.showBookmark?this.bookmarkTemplate:r.Ld,this.emitSaveEvent,this.updateNote,this.bookmark.note,so(this.bookmarkColors,(function(e){return e.id}),this.bookmarkColor.bind(this)),this.emitDeleteEvent)}}])&&Dr(t.prototype,n),i&&Dr(t,i),c}(o.oi);customElements.define("ia-bookmark-edit",Hr),n(2707);class Fr extends o.oi{static get styles(){return o.iv`
1179
1179
  :host {
1180
1180
  width: var(--iconWidth, 'auto');
1181
1181
  height: var(--iconHeight, 'auto');
@@ -1231,7 +1231,7 @@
1231
1231
  <div class=${this.state}>
1232
1232
  <svg height="24" viewBox="0 0 16 24" width="16" xmlns="http://www.w3.org/2000/svg" aria-labelledby="bookmarkTitleID bookmarDescID"><title id="bookmarkTitleID">Bookmark icon</title><desc id="bookmarkDescID">An outline of the shape of a bookmark</desc><path id="filled" d="m1 0h14c.5522847 0 1 .44771525 1 1v23l-8-5.4545455-8 5.4545455v-23c0-.55228475.44771525-1 1-1z" class="fill-color" fill-rule="evenodd"/><g class="fill-color" fill-rule="evenodd"><path id="hollow" d="m15 0c.5522847 0 1 .44771525 1 1v23l-8-5.4545455-8 5.4545455v-23c0-.55228475.44771525-1 1-1zm-2 2h-10c-.51283584 0-.93550716.38604019-.99327227.88337887l-.00672773.11662113v18l6-4.3181818 6 4.3181818v-18c0-.51283584-.3860402-.93550716-.8833789-.99327227z"/><path id="plus" d="m8.75 6v2.25h2.25v1.5h-2.25v2.25h-1.5v-2.25h-2.25v-1.5h2.25v-2.25z" fill-rule="nonzero"/><path id="minus" d="m11 8.25v1.5h-6v-1.5z" fill-rule="nonzero"/></g></svg>
1233
1233
  </div>
1234
- `}}function Qr(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}customElements.define("icon-bookmark",Jr);var Kr=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var r=Object.assign(this,t,{loginClicked:this.bookmarksLoginClicked});this.component=document.createElement("ia-bookmarks"),this.component.bookreader=n,this.component.options=r,this.bindEvents(),this.icon=(0,o.dy)(Xr||(Xr=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['<icon-bookmark state="hollow" style="--iconWidth: 16px; --iconHeight: 24px;"></icon-bookmark>']))),this.label="Bookmarks",this.id="bookmarks",this.component.setup(),this.updateMenu(this.component.bookmarks.length)}var t,n;return t=e,(n=[{key:"updateMenu",value:function(e){this.menuDetails="(".concat(e,")")}},{key:"bindEvents",value:function(){this.component.addEventListener("bookmarksChanged",this.bookmarksChanged.bind(this)),this.component.addEventListener("showItemNavigatorModal",this.showItemNavigatorModal),this.component.addEventListener("closeItemNavigatorModal",this.closeItemNavigatorModal)}},{key:"bookmarksChanged",value:function(e){var t=e.detail,n=Object.keys(t.bookmarks).length;this.updateMenu(n),this.onBookmarksChanged(t.bookmarks)}},{key:"bookmarksLoginClicked",value:function(){var e;window.archive_analytics&&(null===(e=window.archive_analytics)||void 0===e||e.send_event_no_sampling("BookReader","BookmarksLogin",window.location.path))}}])&&Qr(t.prototype,n),e}();function ei(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ti(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}n(189),n(3123);var ni=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.classes=new Set,this.changed=!1,this.element=t;var n,o=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return ei(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ei(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,r=function(){};return{s:r,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:r}}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,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}((t.getAttribute("class")||"").split(/\s+/));try{for(o.s();!(n=o.n()).done;){var r=n.value;this.classes.add(r)}}catch(e){o.e(e)}finally{o.f()}}var t,n;return t=e,(n=[{key:"add",value:function(e){this.classes.add(e),this.changed=!0}},{key:"remove",value:function(e){this.classes.delete(e),this.changed=!0}},{key:"commit",value:function(){if(this.changed){var e="";this.classes.forEach((function(t){return e+=t+" "})),this.element.setAttribute("class",e)}}}])&&ti(t.prototype,n),e}(),oi=new WeakMap,ri=(0,r.XM)((function(e){return function(t){if(!(t instanceof r._l)||t instanceof r.sL||"class"!==t.committer.name||t.committer.parts.length>1)throw new Error("The `classMap` directive must be used in the `class` attribute and must be the only part in the attribute.");var n=t.committer,o=n.element,i=oi.get(t);void 0===i&&(o.setAttribute("class",n.strings.join(" ")),oi.set(t,i=new Set));var a=o.classList||new ni(o);for(var s in i.forEach((function(t){t in e||(a.remove(t),i.delete(t))})),e){var l=e[s];l!=i.has(s)&&(l?(a.add(s),i.add(s)):(a.remove(s),i.delete(s)))}"function"==typeof a.commit&&a.commit()}}));class ii extends o.oi{static get styles(){return o.iv`
1234
+ `}}function Qr(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}customElements.define("icon-bookmark",Jr);var Kr=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var r=Object.assign(this,t,{loginClicked:this.bookmarksLoginClicked});this.component=document.createElement("ia-bookmarks"),this.component.bookreader=n,this.component.options=r,this.component.displayMode=this.component.options.displayMode,this.bindEvents(),this.icon=(0,o.dy)(Xr||(Xr=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['<icon-bookmark state="hollow" style="--iconWidth: 16px; --iconHeight: 24px;"></icon-bookmark>']))),this.label="Bookmarks",this.id="bookmarks",this.component.setup(),this.updateMenu(this.component.bookmarks.length)}var t,n;return t=e,(n=[{key:"updateMenu",value:function(e){this.menuDetails="(".concat(e,")")}},{key:"bindEvents",value:function(){this.component.addEventListener("bookmarksChanged",this.bookmarksChanged.bind(this)),this.component.addEventListener("showItemNavigatorModal",this.showItemNavigatorModal),this.component.addEventListener("closeItemNavigatorModal",this.closeItemNavigatorModal)}},{key:"bookmarksChanged",value:function(e){var t=e.detail,n=Object.keys(t.bookmarks).length;this.updateMenu(n),this.onBookmarksChanged(t.bookmarks)}},{key:"bookmarksLoginClicked",value:function(){var e;window.archive_analytics&&(null===(e=window.archive_analytics)||void 0===e||e.send_event_no_sampling("BookReader","BookmarksLogin",window.location.path))}}])&&Qr(t.prototype,n),e}();function ei(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function ti(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}n(189),n(3123);var ni=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.classes=new Set,this.changed=!1,this.element=t;var n,o=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return ei(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ei(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,r=function(){};return{s:r,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:r}}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,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}((t.getAttribute("class")||"").split(/\s+/));try{for(o.s();!(n=o.n()).done;){var r=n.value;this.classes.add(r)}}catch(e){o.e(e)}finally{o.f()}}var t,n;return t=e,(n=[{key:"add",value:function(e){this.classes.add(e),this.changed=!0}},{key:"remove",value:function(e){this.classes.delete(e),this.changed=!0}},{key:"commit",value:function(){if(this.changed){var e="";this.classes.forEach((function(t){return e+=t+" "})),this.element.setAttribute("class",e)}}}])&&ti(t.prototype,n),e}(),oi=new WeakMap,ri=(0,r.XM)((function(e){return function(t){if(!(t instanceof r._l)||t instanceof r.sL||"class"!==t.committer.name||t.committer.parts.length>1)throw new Error("The `classMap` directive must be used in the `class` attribute and must be the only part in the attribute.");var n=t.committer,o=n.element,i=oi.get(t);void 0===i&&(o.setAttribute("class",n.strings.join(" ")),oi.set(t,i=new Set));var a=o.classList||new ni(o);for(var s in i.forEach((function(t){t in e||(a.remove(t),i.delete(t))})),e){var l=e[s];l!=i.has(s)&&(l?(a.add(s),i.add(s)):(a.remove(s),i.delete(s)))}"function"==typeof a.commit&&a.commit()}}));class ii extends o.oi{static get styles(){return o.iv`
1235
1235
  :host {
1236
1236
  width: var(--iconWidth, 'auto');
1237
1237
  height: var(--iconHeight, 'auto');
@@ -1432,5 +1432,5 @@ small.visible {
1432
1432
  <p>Want more? <a href=${this.helpURL}>Advanced embedding details, examples, and help</a>!</p>
1433
1433
  </div>
1434
1434
  </ul>
1435
- `}}var ki,wi;function Ci(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function xi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Si(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}customElements.define("ia-sharing-options",gi);var Bi,Oi,Ii,zi,Di,Li,Ti,Ei,ji,Mi=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";xi(this,e);var a=t.identifier,s=t.creator,l=t.title,c=encodeURIComponent(i),d=i&&i!==a?"".concat(a,"/").concat(c):a;this.idPath=d,this.itemType=r;var u="Share this ".concat(this.reconcileItemType);this.icon=(0,o.dy)(ki||(ki=Ci(['<ia-icon icon="share" style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon>']))),this.label=u,this.id="share",this.component=(0,o.dy)(wi||(wi=Ci(['<ia-sharing-options\n identifier="','"\n type="book"\n creator="','"\n description="','"\n baseHost="','"\n ></ia-sharing-options>'])),d,s,l,n)}var t,n;return t=e,(n=[{key:"reconcileItemType",get:function(){return"bookreader"===this.itemType?"book":"item"}}])&&Si(t.prototype,n),e}(),Pi=(0,r.dy)(Bi||(Bi=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n<svg name="sort-desc" height="18" viewBox="0 0 18 18" width="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z" fill="#fff" fill-rule="nonzero"/><path d="m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z" fill="#fff" fill-rule="nonzero"/><path d="m10.3846154 11.0769231 2.7692308 5.5384615 2.7692307-5.5384615m-2.7692307 4.1538461v-13.15384612" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.661538"/></g></svg>\n']))),Ai=(0,r.dy)(Oi||(Oi=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n<svg name="sort-asc" height="18" viewBox="0 0 18 18" width="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z" fill="#fff" fill-rule="nonzero"/><path d="m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z" fill="#fff" fill-rule="nonzero"/><path d="m10.3846154 11.0769231 2.7692308 5.5384615 2.7692307-5.5384615m-2.7692307 4.1538461v-13.15384612" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.661538" transform="matrix(1 0 0 -1 0 18.692308)"/></g></svg>\n']))),Ri=(0,r.dy)(Ii||(Ii=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n<svg name="sort-neutral" height="18" viewBox="0 0 18 18" width="18" xmlns="http://www.w3.org/2000/svg"><g fill="#fff" fill-rule="evenodd"><path d="m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z" fill-rule="nonzero"/><path d="m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z" fill-rule="nonzero"/><circle cx="13" cy="9" r="2"/></g></svg>\n']))),_i=(0,r.dy)(zi||(zi=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" aria-labelledby="volumesTitleID volumesDescID">\n <title id="volumesTitleID">Volumes icon</title>\n <desc id="volumesDescID">Three books stacked on each other</desc>\n <g fill="#ffffff">\n <path fill="#ffffff" d="m9.83536396 0h10.07241114c.1725502.47117517.3378411.76385809.4958725.87804878.1295523.11419069.3199719.1998337.5712586.25692905.2512868.05709534.4704647.08564301.6575337.08564301h.2806036v15.24362526h-4.3355343v3.8106985h-4.44275v3.7250554h-12.01318261c-.27306495 0-.50313194-.085643-.69020098-.256929-.18706903-.1712861-.30936193-.3425721-.36687867-.5138581l-.06449694-.2785477v-14.2159091c0-.32815965.08627512-.5922949.25882537-.79240577.17255024-.20011086.34510049-.32150776.51765073-.36419068l.25882537-.0640244h3.36472977v-2.54767184c0-.31374722.08627513-.57067627.25882537-.77078714.17255025-.20011086.34510049-.32150776.51765074-.36419068l.25882536-.06402439h3.36472978v-2.56929047c0-.32815964.08627512-.5922949.25882537-.79240576.17255024-.20011087.34510049-.31430156.51765073-.34257207zm10.78355264 15.6294346v-13.53076498c-.2730649-.08536585-.4456152-.16380266-.5176507-.23531042-.1725502-.1424612-.2730649-.27078714-.3015441-.38497783v13.36031043h-9.87808272c0 .0144124-.02149898.0144124-.06449694 0-.04299795-.0144124-.08962561.006929-.13988296.0640244-.05025735.0570953-.07538603.1427383-.07538603.256929s.02149898.210643.06449694.289357c.04299795.078714.08599591.1322062.12899387.1604767l.06449693.0216187h10.71905571zm-10.2449613-2.4412417h7.98003v-11.60421286h-7.98003zm1.6827837-9.41990022h4.6153002c.1725502 0 .3199718.05349224.4422647.16047672s.1834393.23891353.1834393.39578714c0 .15687362-.0611464.28519956-.1834393.38497783s-.2697145.1496674-.4422647.1496674h-4.6153002c-.1725503 0-.3199719-.04988913-.4422647-.1496674-.1222929-.09977827-.1834394-.22810421-.1834394-.38497783 0-.15687361.0611465-.28880266.1834394-.39578714.1222928-.10698448.2697144-.16047672.4422647-.16047672zm-6.08197737 13.50997782h7.72120467v-.8131929h-3.79610541c-.27306495 0-.49950224-.085643-.67931188-.256929-.17980964-.1712861-.29847284-.3425721-.35598958-.5138581l-.06449694-.2785477v-10.02023282h-2.82530086zm6.77217827-11.36890243h3.2139578c.1295522 0 .240956.05709534.3342113.17128603.0932554.11419069.139883.24972284.139883.40659645 0 .15687362-.0466276.28880267-.139883.39578714-.0932553.10698448-.2046591.16047672-.3342113.16047672h-3.2139578c-.1295523 0-.2373264-.05349224-.3233223-.16047672-.0859959-.10698447-.1289938-.23891352-.1289938-.39578714 0-.15687361.0429979-.29240576.1289938-.40659645s.19377-.17128603.3233223-.17128603zm-11.15043132 15.11557653h7.69942646v-.7491685h-3.79610539c-.25854616 0-.48135376-.0892462-.66842279-.2677384-.18706904-.1784922-.30936193-.3605876-.36687868-.546286l-.06449694-.2569291v-10.04101994h-2.80352266zm14.62237682-4.5606985h-.8191949v2.1410754h-9.89986085s-.04299796.0285477-.12899387.085643c-.08599592.0570954-.12201369.1427384-.10805331.2569291 0 .1141907.01786928.210643.05360784.289357.03573856.0787139.07538603.125.1189424.138858l.06449694.0432373h10.71905575v-2.9542683zm-4.3991936 3.8106985h-.8191949v2.077051h-9.8563045c0 .0144124-.02149898.0144124-.06449694 0-.04299795-.0144125-.08962561.0105321-.13988296.0748337-.05025735.0643015-.07538603.1607538-.07538603.289357 0 .1141906.02149898.2070399.06449694.2785476.04299795.0715078.08599591.1141907.12899387.1280488l.06449693.0216186h10.69811519v-2.8686252z" />\n </g>\n </svg>\n'])));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})(e)}function Ni(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Hi(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Fi(e,t){return(Fi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Zi(e,t){if(t&&("object"===$i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Wi(e){return(Wi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var qi,Ui,Vi,Gi,Xi=function(e){!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}}),t&&Fi(e,t)}(c,e);var t,n,i,a,s,l=(a=c,s=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=Wi(a);if(s){var n=Wi(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Zi(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.call(this)).subPrefix="",e.hostUrl="",e.viewableFiles=[],e}return t=c,i=[{key:"properties",get:function(){return{subPrefix:{type:String},hostUrl:{type:String},viewableFiles:{type:Array}}}},{key:"styles",get:function(){return(0,o.iv)(ji||(ji=Ni(["\n :host {\n display: block;\n overflow-y: auto;\n box-sizing: border-box;\n color: var(--primaryTextColor);\n margin-top: 14px;\n margin-bottom: 2rem;\n --activeBorderWidth: 2px;\n }\n\n a {\n color: #ffffff;\n text-decoration: none\n }\n\n img {\n width: 35px;\n height: 45px;\n }\n\n ul {\n padding: 0;\n list-style: none;\n margin: var(--activeBorderWidth) 0.5rem 1rem 0;\n }\n\n ul > li:first-child .separator {\n display: none;\n }\n\n li {\n cursor: pointer;\n outline: none;\n position: relative;\n }\n\n li .content {\n padding: 2px 0 4px 2px;\n border: var(--activeBorderWidth) solid transparent;\n padding: .2rem 0 .4rem .2rem;\n }\n \n li .content.active {\n border: var(--activeBorderWidth) solid #538bc5;\n }\n\n small {\n font-style: italic;\n white-space: initial;\n }\n\n .container {\n display: flex;\n align-items: center;\n justify-content: center\n }\n\n .item-title {\n margin-block-start: 0em;\n margin-block-end: 0em;\n font-size: 14px;\n font-weight: bold;\n word-wrap: break-word;\n padding-left: 5px;\n }\n\n .separator {\n background-color: var(--secondaryBGColor);\n width: 98%;\n margin: 1px auto;\n height: 1px;\n }\n\n .text {\n padding-left: 10px;\n }\n\n .icon {\n display: inline-block;\n width: 14px;\n height: 14px;\n margin-left: .7rem;\n border: 1px solid var(--primaryTextColor);\n border-radius: 2px;\n background: var(--activeButtonBg) 50% 50% no-repeat;\n }\n\n "])))}}],(n=[{key:"firstUpdated",value:function(){var e=this.shadowRoot.querySelector(".content.active");setTimeout((function(){null!=e&&e.scrollIntoViewIfNeeded&&(null==e||e.scrollIntoViewIfNeeded(!0))}),350)}},{key:"volumeItemWithImageTitle",value:function(e){return(0,o.dy)(Di||(Di=Ni(['\n <li class="content active">\n <div class="separator"></div>\n <a class="container" href="',"",'">\n <div class="image">\n <img src="','">\n </div>\n <div class="text">\n <p class="item-title">',"</p>\n <small>by: ","</small>\n </div>\n </a>\n </li>\n "])),this.hostUrl,e.url_path,e.image,e.title,e.author)}},{key:"volumeItem",value:function(e){var t=this.subPrefix===e.file_subprefix?" active":"";return(0,o.dy)(Li||(Li=Ni(['\n <li>\n <div class="separator"></div>\n <div class="content','">\n <a href="https://',"",'">\n <p class="item-title">',"</p>\n </a>\n </div>\n </li>\n "])),t,this.hostUrl,e.url_path,e.title)}},{key:"volumesList",get:function(){var e=so(this.viewableFiles,(function(e){return null==e?void 0:e.file_prefix}),this.volumeItem.bind(this));return(0,o.dy)(Ti||(Ti=Ni(["\n <ul>\n ",'\n <div class="separator"></div> \n </ul>\n '])),e)}},{key:"render",value:function(){return(0,o.dy)(Ei||(Ei=Ni(["\n ","\n "])),this.viewableFiles.length?this.volumesList:r.Ld)}}])&&Hi(t.prototype,n),i&&Hi(t,i),c}(o.oi);function Yi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Ji(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Qi(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}customElements.define("viewable-files",Xi);var Ki=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.optionChange=r,this.component=document.createElement("viewable-files");var i=n.options.multipleBooksList.by_subprefix;this.viewableFiles=Object.keys(i).map((function(e){return i[e]})),this.volumeCount=Object.keys(i).length,this.component.subPrefix=n.options.subPrefix||"",this.component.hostUrl=t,this.component.viewableFiles=this.viewableFiles,this.id="volumes",this.label="Viewable files (".concat(this.volumeCount,")"),this.icon=(0,o.dy)(qi||(qi=Ji(["",""])),_i),this.sortOrderBy="orig_sort",this.sortVolumes("orig_sort")}var t,n;return t=e,(n=[{key:"sortButton",get:function(){var e=this;return{orig_sort:(0,o.dy)(Ui||(Ui=Ji(['\n <button class="sort-by neutral-icon" aria-label="Sort volumes in initial order" @click=',">","</button>\n "])),(function(){return e.sortVolumes("title_asc")}),Ri),title_asc:(0,o.dy)(Vi||(Vi=Ji(['\n <button class="sort-by asc-icon" aria-label="Sort volumes in ascending order" @click=',">","</button>\n "])),(function(){return e.sortVolumes("title_desc")}),Ai),title_desc:(0,o.dy)(Gi||(Gi=Ji(['\n <button class="sort-by desc-icon" aria-label="Sort volumes in descending order" @click=',">","</button>\n "])),(function(){return e.sortVolumes("orig_sort")}),Pi)}[this.sortOrderBy]}},{key:"sortVolumes",value:function(e){var t,n;t=this.viewableFiles.sort((function(t,n){return"orig_sort"===e?t.orig_sort-n.orig_sort:"title_asc"===e?t.title.localeCompare(n.title):n.title.localeCompare(t.title)})),this.sortOrderBy=e,this.component.viewableFiles=function(e){if(Array.isArray(e))return Yi(e)}(n=t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||function(e,t){if(e){if("string"==typeof e)return Yi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yi(e,t):void 0}}(n)||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.actionButton=this.sortButton,this.optionChange(this.bookreader),this.multipleFilesClicked(e)}},{key:"multipleFilesClicked",value:function(e){var t;window.archive_analytics&&(null===(t=window.archive_analytics)||void 0===t||t.send_event_no_sampling("BookReader","VolumesSort|".concat(e),window.location.path))}}])&&Qi(t.prototype,n),e}();function ea(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ta(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var na=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;ea(this,e),this.callback=t,this.threshhold=n,this.context=o,this.deferTimeout=void 0}var t,n;return t=e,(n=[{key:"execute",value:function(){clearTimeout(this.deferTimeout),this.deferTimeout=setTimeout(this.executeCallback.bind(this),this.threshhold)}},{key:"executeCallback",value:function(){this.callback.apply(this.context)}}])&&ta(t.prototype,n),e}();function oa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ra(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var ia=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#BookReader";oa(this,e),this.debounceTime=250,this.savedScrollY=0,this.savedScrollX=0,this.brSelector=t,this.setup=this.setup.bind(this),this.teardown=this.teardown.bind(this),this.resizeBookReaderContainer=this.resizeBookReaderContainer.bind(this),this.handleResizeEvent=this.handleResizeEvent.bind(this),this.handleBookReaderHeight=new na(this.resizeBookReaderContainer,this.debounceTime,this)}var t,n;return t=e,(n=[{key:"brDom",get:function(){return document.querySelector(this.brSelector)}},{key:"setup",value:function(e){this.bookreader=e,this.resizeBookReaderContainer(),window.addEventListener("resize",this.handleResizeEvent)}},{key:"teardown",value:function(){this.brDom.setAttribute("style",""),window.removeEventListener("resize",this.handleResizeEvent),window.scrollTo(this.savedScrollX,this.savedScrollY),this.savedScrollX=0,this.savedScrollY=0}},{key:"handleResizeEvent",value:function(){this.handleBookReaderHeight.execute()}},{key:"resizeBookReaderContainer",value:function(){var e,t=window,n=t.scrollX,o=t.scrollY;this.savedScrollX=n,this.savedScrollY=o,this.bookreader.updateBrClasses();var r=document.querySelector(".BookReaderMessage"),i=null!==(e=null==r?void 0:r.offsetHeight)&&void 0!==e?e:0,a=window.innerHeight,s="".concat(a-i,"px");this.brDom.style.height=s,this.brDom.style.top=i,window.scrollTo(0,0)}}])&&ra(t.prototype,n),e}();function aa(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var sa,la,ca,da,ua,ha=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metadata={},this.isRestricted=null}var t,n;return t=e,(n=[{key:"setMetadata",value:function(e){this.metadata=e}},{key:"setRestriction",value:function(e){this.isRestricted=e}}])&&aa(t.prototype,n),e}(),fa=(0,o.dy)(sa||(sa=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <svg\n height="100"\n viewBox="0 0 100 100"\n width="100"\n xmlns="http://www.w3.org/2000/svg"\n aria-labelledby="bookreader-loading"\n >\n <title id="bookreader-loading">Currently loading viewer.</title>\n <desc>Please wait while we load book reader.</desc>\n <g fill="#333" fill-rule="evenodd" class="book-icon">\n <g transform="matrix(1 0 0 -1 28 67.362264)">\n <path d="m44.71698 31.6981124v-29.99320678s-18.0956599.30735848-18.6322637-.7171698c-.0633962-.12226414-1.890566-.59207545-2.9745282-.59207545-1.3228302 0-3.5122641 0-4.1286791.74547168-.9707547 1.17452827-18.82811278.71660375-18.82811278.71660375v30.040754l1.83849052.7867924.29094339-28.48188608s15.94981097.15339622 17.09094297-1.10716978c.8145283-.90056602 4.997547-.91641507 5.3450942-.3526415.9611321 1.55716977 14.7101883 1.31716978 17.6077354 1.45981128l.3266038 28.22830118z"/>\n <path d="m40.1129424 33.5957539h-12.8337733c-1.8690565 0-3.1098112-.7545283-3.9299999-1.6279245v-26.70452764l1.2362264-.00792453c.4584906.72962262 3.0922641 1.39415091 3.0922641 1.39415091h10.1298111s1.0381131.01754717 1.5141509.47377357c.5643396.54056602.7913207 1.36981129.7913207 1.36981129z"/>\n <path d="m17.3354713 33.5957539h-12.8337733v-25.37660316s0-.75283017.49358489-1.14113205c.52867924-.41433961 1.3415094-.42849055 1.3415094-.42849055h10.59905631s2.2075471-.52698112 3.0928301-1.39415091l1.2.00792453v26.74245214c-.8201886.8581132-2.0530188 1.59-3.8932074 1.59"/>\n </g>\n <path\n class="ring"\n d="m17.8618849 11.6970233c18.5864635-15.59603144 45.6875867-15.59603102 64.2740497.000001 1.9271446 1.6170806 2.1785128 4.4902567.5614466 6.4174186-1.6170661 1.9271618-4.4902166 2.1785323-6.4173612.5614517-15.1996922-12.75416882-37.3625282-12.75416916-52.5622206-.000001-15.19969387 12.7541707-19.04823077 34.5805019-9.1273354 51.7641499 9.9208955 17.183646 30.7471499 24.7638499 49.3923323 17.9774983 18.6451823-6.7863521 29.7266014-25.9801026 26.2811129-45.5206248-.436848-2.4775114 1.2174186-4.8400696 3.6949079-5.2769215 2.4774893-.4368518 4.8400264 1.2174296 5.2768744 3.694941 4.2132065 23.8945096-9.3373563 47.3649806-32.137028 55.6634567-22.799672 8.2984758-48.2663986-.9707372-60.39785211-21.9832155-12.1314534-21.012481-7.42539173-47.7021198 11.16107351-63.2981544z"\n fill-rule="nonzero"\n />\n </g>\n </svg>\n'])));function pa(e){return(pa="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})(e)}function ma(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function va(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function ba(e,t){return(ba=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ya(e,t){if(t&&("object"===pa(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function ga(e){return(ga=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ka,wa,Ca=window.ResizeObserver||wt,xa="updateSideMenu",Sa=function(e){!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}}),t&&ba(e,t)}(c,e);var t,n,i,a,s,l=(a=c,s=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=ga(a);if(s){var n=ga(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return ya(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.call(this)).book={},e.pageContainerSelector=".BRcontainer",e.brWidth=0,e.bookReaderCannotLoad=!1,e.bookReaderLoaded=!1,e.bookreader=null,e.downloadableTypes=[],e.isAdmin=!1,e.lendingInitialized=!1,e.lendingStatus={},e.menuProviders={},e.menuShortcuts=[],e.sideMenuOpen=!1,e.signedIn=!1,e.fullscreenMgr=null,e.brResizeObserver=null,e.model=new ha,e.shortcutOrder=["volumes","search","bookmarks"],e}return t=c,i=[{key:"properties",get:function(){return{book:{type:Object},pageContainerSelector:{type:String},brWidth:{type:Number},bookReaderLoaded:{type:Boolean},bookreader:{type:Object},downloadableTypes:{type:Array},isAdmin:{type:Boolean},lendingInitialized:{type:Boolean},lendingStatus:{type:Object},menuProviders:{type:Object},menuShortcuts:{type:Array},sideMenuOpen:{type:Boolean},signedIn:{type:Boolean}}}},{key:"styles",get:function(){return(0,o.iv)(ua||(ua=ma(["\n #book-navigator.loading {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 30vh;\n }\n\n #book-navigator .book-loader {\n width: 30%;\n margin: auto;\n text-align: center;\n color: var(--primaryTextColor);\n }\n\n .book-loader {\n position: relative;\n }\n\n .book-loader svg {\n display: block;\n width: 60%;\n max-width: 100px;\n height: auto;\n margin: auto;\n }\n\n svg * {\n fill: var(--primaryTextColor);\n }\n\n svg .ring {\n animation: rotate 1.3s infinite linear;\n transform-origin: 50px 50px;\n transform-box: fill-box;\n display: block; // transform won't work on inline style\n }\n\n @keyframes rotate {\n 0% {\n transform: rotate(-360deg);\n }\n }\n "])))}}],(n=[{key:"firstUpdated",value:function(){this.model.setMetadata(this.book),this.bindEventListeners(),this.emitPostInit()}},{key:"updated",value:function(e){if(this.bookreader&&(!e.has("sideMenuOpen")||void 0!==e.get("sideMenuOpen"))){if(this.bookreader.animating)return;this.bookreader.resize()}}},{key:"emitPostInit",value:function(){var e;this.dispatchEvent(new CustomEvent("BrBookNav:".concat("PostInit"),{detail:{brSelector:null===(e=this.bookreader)||void 0===e?void 0:e.el},bubbles:!0,composed:!0}))}},{key:"initializeBookSubmenus",value:function(){var e=this,t=this.bookreader.options.protected;this.menuProviders={search:new Dn((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t&&(e.bookreader=t),e.updateMenuContents();var o=e.brWidth>=640;!o||null!=n&&n.searchCanceled||e.updateSideMenu("search","open")}),this.bookreader),downloads:new qn(t),visualAdjustments:new Lo({onOptionChange:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;n&&(e.bookreader=n),e.updateMenuContents()},bookContainerSelector:this.pageContainerSelector,bookreader:this.bookreader}),share:new Mi(this.book.metadata,this.baseHost,this.itemType,this.bookreader.options.subPrefix),bookmarks:new Kr(this.bookmarksOptions,this.bookreader)},this.bookreader.options.enableMultipleBooks&&(this.menuProviders.volumes=new Ki(this.baseHost,this.bookreader,(function(t){t&&(e.bookreader=t),e.updateMenuContents(),e.updateSideMenu("volumes","open")})),this.addMenuShortcut("volumes")),this.addMenuShortcut("search"),this.updateMenuContents()}},{key:"mainBRContainer",get:function(){return document.querySelector(this.bookreader.el)}},{key:"bookmarksOptions",get:function(){var e=this,t="referer=".concat(encodeURIComponent(location.href));return{loginUrl:"https://".concat(this.baseHost,"/account/login?").concat(t),displayMode:this.signedIn?"bookmarks":"login",showItemNavigatorModal:this.showItemNavigatorModal.bind(this),closeItemNavigatorModal:this.closeItemNavigatorModal.bind(this),onBookmarksChanged:function(t){var n=Object.keys(t).length?"add":"remove";e["".concat(n,"MenuShortcut")]("bookmarks"),e.updateMenuContents()}}}},{key:"updateSideMenu",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"open";if(e&&t){var n=new CustomEvent(xa,{detail:{menuId:e,action:t}});this.dispatchEvent(n)}}},{key:"updateMenuContents",value:function(){var e=this.menuProviders,t=e.search,n=e.downloads,o=e.visualAdjustments,r=e.share,i=e.bookmarks,a=[e.volumes,t,i,o,r].filter((function(e){return!!e}));this.shouldShowDownloadsMenu()&&(n.update(this.downloadableTypes),a.splice(1,0,n));var s=new CustomEvent("menuUpdated",{detail:a});this.dispatchEvent(s)}},{key:"shouldShowDownloadsMenu",value:function(){if(!1===this.model.isRestricted)return!0;if(this.isAdmin)return!0;var e=this.lendingStatus.user_loan_record,t=void 0===e?{}:e;return!Array.isArray(t)&&t.type&&"SESSION_LOAN"!==t.type}},{key:"addMenuShortcut",value:function(e){this.menuShortcuts.find((function(t){return t.id===e}))||(this.menuShortcuts.push(this.menuProviders[e]),this.sortMenuShortcuts(),this.emitMenuShortcutsUpdated())}},{key:"removeMenuShortcut",value:function(e){this.menuShortcuts=this.menuShortcuts.filter((function(t){return t.id!==e})),this.emitMenuShortcutsUpdated()}},{key:"sortMenuShortcuts",value:function(){var e=this;this.menuShortcuts=this.shortcutOrder.reduce((function(t,n){var o=e.menuShortcuts.find((function(e){return e.id===n}));return o&&t.push(o),t}),[])}},{key:"emitMenuShortcutsUpdated",value:function(){var e=new CustomEvent("menuShortcutsUpdated",{detail:this.menuShortcuts});this.dispatchEvent(e)}},{key:"bindEventListeners",value:function(){var e=this;window.addEventListener("BookReader:PostInit",(function(t){e.bookreader=t.detail.props,e.bookReaderLoaded=!0,e.bookReaderCannotLoad=!1,e.fullscreenMgr=new ia(e.bookreader.el),e.initializeBookSubmenus(),setTimeout((function(){return e.bookreader.resize()}),0),e.brResizeObserver=new Ca((function(t){return e.reactToBrResize(t)})),e.brResizeObserver.observe(e.mainBRContainer)})),window.addEventListener("BookReader:fullscreenToggled",(function(t){var n=t.detail.props,o=void 0===n?null:n;o&&(e.bookreader=o),e.manageFullScreenBehavior(t)}),{passive:!0}),window.addEventListener("BookReader:ToggleSearchMenu",(function(t){e.dispatchEvent(new CustomEvent(xa,{detail:{menuId:"search",action:"toggle"}}))})),window.addEventListener("LendingFlow:PostInit",(function(t){var n=t.detail,o=n.downloadTypesAvailable,r=n.lendingStatus,i=n.isAdmin,a=n.previewType;e.lendingInitialized=!0,e.downloadableTypes=o,e.lendingStatus=r,e.isAdmin=i,e.bookReaderCannotLoad="singlePagePreview"===a})),window.addEventListener("BRJSIA:PostInit",(function(t){var n=t.detail,o=n.isRestricted,r=n.downloadURLs;e.bookReaderLoaded=!0,e.downloadableTypes=r,e.model.setRestriction(o)}))}},{key:"reactToBrResize",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=this.brWidth,o=this.bookreader.animating;t.forEach((function(t){var n=t.contentRect;t.target===e.mainBRContainer&&(e.brWidth=n.width)})),setTimeout((function(){n&&!o&&e.bookreader.resize()}),0)}},{key:"manageFullScreenBehavior",value:function(){this.emitFullScreenState(),this.bookreader.isFullscreen()?this.fullscreenMgr.setup(this.bookreader):this.fullscreenMgr.teardown()}},{key:"emitFullScreenState",value:function(){var e=this.bookreader.isFullscreen(),t=new CustomEvent("ViewportInFullScreen",{detail:{isFullScreen:e}});this.dispatchEvent(t)}},{key:"emitShowItemNavigatorModal",value:function(e){this.dispatchEvent(new CustomEvent("showItemNavigatorModal",{detail:e.detail}))}},{key:"emitCloseItemNavigatorModal",value:function(){this.dispatchEvent(new CustomEvent("closeItemNavigatorModal"))}},{key:"showItemNavigatorModal",value:function(e){this.emitShowItemNavigatorModal(e)}},{key:"closeItemNavigatorModal",value:function(){this.emitCloseItemNavigatorModal()}},{key:"loader",get:function(){var e=(0,o.dy)(la||(la=ma(['\n <div class="book-loader">',"<div>\n <h3>Loading viewer</h3>\n "])),fa);return this.bookReaderLoaded?r.Ld:e}},{key:"loadingClass",get:function(){return this.bookReaderLoaded?"":"loading"}},{key:"itemImage",get:function(){var e="https://".concat(this.baseHost,"/services/img/").concat(this.book.metadata.identifier);return(0,o.dy)(ca||(ca=ma(['<img src="','" alt="cover image for ','">'])),e,this.book.metadata.identifier)}},{key:"render",value:function(){var e=this.bookReaderCannotLoad?this.itemImage:this.loader;return(0,o.dy)(da||(da=ma(['<div id="book-navigator" class="','">\n ','\n <slot name="bookreader"></slot>\n </div>\n '])),this.loadingClass,e)}}])&&va(t.prototype,n),i&&va(t,i),c}(o.oi);function Ba(e){return(Ba="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})(e)}function Oa(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Ia(e,t,n,o,r,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(o,r)}function za(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Da(e,t){return(Da=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function La(e,t){if(t&&("object"===Ba(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Ta(e){return(Ta=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}customElements.define("book-navigator",Sa);var Ea=function(e){!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}}),t&&Da(e,t)}(d,e);var t,n,r,i,a,s,l,c=(s=d,l=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=Ta(s);if(l){var n=Ta(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return La(this,e)});function d(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),(e=c.call(this)).base64Json="",e.baseHost="https://archive.org",e}return t=d,r=[{key:"properties",get:function(){return{base64Json:{type:String},baseHost:{type:String}}}},{key:"styles",get:function(){return(0,o.iv)(wa||(wa=Oa(["\n :host {\n display: block;\n --primaryBGColor: var(--black, #000);\n --secondaryBGColor: #222;\n --tertiaryBGColor: #333;\n --primaryTextColor: var(--white, #fff);\n --primaryCTAFill: #194880;\n --primaryCTABorder: #c5d1df;\n --secondaryCTAFill: #333;\n --secondaryCTABorder: #999;\n --primaryErrorCTAFill: #e51c26;\n --primaryErrorCTABorder: #f8c6c8;\n }\n\n .ia-bookreader {\n background-color: var(--primaryBGColor);\n position: relative;\n height: auto;\n }\n\n item-navigator {\n display: block;\n width: 100%;\n color: var(--primaryTextColor);\n --menuButtonLabelDisplay: block;\n --menuWidth: 320px;\n --menuSliderBg: var(--secondaryBGColor);\n --activeButtonBg: var(--tertiaryBGColor);\n --subpanelRightBorderColor: var(--secondaryCTABorder);\n --animationTiming: 100ms;\n --iconFillColor: var(--primaryTextColor);\n --iconStrokeColor: var(--primaryTextColor);\n --menuSliderHeaderIconHeight: 2rem;\n --menuSliderHeaderIconWidth: 2rem;\n --iconWidth: 2.4rem;\n --iconHeight: 2.4rem;\n --shareLinkColor: var(--primaryTextColor);\n --shareIconBorder: var(--primaryTextColor);\n --shareIconBg: var(--secondaryBGColor);\n --activityIndicatorLoadingDotColor: var(--primaryTextColor);\n --activityIndicatorLoadingRingColor: var(--primaryTextColor);\n }\n "])))}}],(n=[{key:"firstUpdated",value:function(){this.fetchData()}},{key:"fetchData",value:(i=regeneratorRuntime.mark((function e(){var t,n,o,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new URLSearchParams(location.search).get("ocaid"),e.next=3,fetch("".concat(this.baseHost,"/metadata/").concat(t));case 3:return n=e.sent,e.next=6,n.json();case 6:o=e.sent,r=btoa(JSON.stringify(o)),this.setBaseJSON(r);case 9:case"end":return e.stop()}}),e,this)})),a=function(){var e=this,t=arguments;return new Promise((function(n,o){var r=i.apply(e,t);function a(e){Ia(r,n,o,a,s,"next",e)}function s(e){Ia(r,n,o,a,s,"throw",e)}a(void 0)}))},function(){return a.apply(this,arguments)})},{key:"setBaseJSON",value:function(e){this.base64Json=e}},{key:"render",value:function(){return(0,o.dy)(ka||(ka=Oa(['\n <div class="ia-bookreader">\n <item-navigator\n itemType="bookreader"\n basehost=',"\n item=",'>\n <div slot="bookreader">\n <slot name="bookreader"></slot>\n </div>\n </item-navigator>\n </div>\n '])),this.baseHost,this.base64Json)}}])&&za(t.prototype,n),r&&za(t,r),d}(o.oi);window.customElements.define("ia-bookreader",Ea)},8730:function(e,t,n){var o=n(111),r=Math.floor;e.exports=function(e){return!o(e)&&isFinite(e)&&r(e)===e}},3161:function(e,t,n){n(2109)({target:"Number",stat:!0},{isInteger:n(8730)})},4723:function(e,t,n){"use strict";var o=n(7007),r=n(9670),i=n(7466),a=n(1340),s=n(4488),l=n(1530),c=n(7651);o("match",(function(e,t,n){return[function(t){var n=s(this),o=null==t?void 0:t[e];return void 0!==o?o.call(t,n):new RegExp(t)[e](a(n))},function(e){var o=r(this),s=a(e),d=n(t,o,s);if(d.done)return d.value;if(!o.global)return c(o,s);var u=o.unicode;o.lastIndex=0;for(var h,f=[],p=0;null!==(h=c(o,s));){var m=a(h[0]);f[p]=m,""===m&&(o.lastIndex=l(s,i(o.lastIndex),u)),p++}return 0===p?null:f}]}))},3774:function(e,t){!function(e){"use strict";function t(e,t,n,o){var r,i=!1,a=0;function s(){r&&clearTimeout(r)}function l(){for(var l=arguments.length,c=new Array(l),d=0;d<l;d++)c[d]=arguments[d];var u=this,h=Date.now()-a;function f(){a=Date.now(),n.apply(u,c)}function p(){r=void 0}i||(o&&!r&&f(),s(),void 0===o&&h>e?f():!0!==t&&(r=setTimeout(o?p:f,void 0===o?e-h:e)))}return"boolean"!=typeof t&&(o=n,n=t,t=void 0),l.cancel=function(){s(),i=!0},l}e.debounce=function(e,n,o){return void 0===o?t(e,n,!1):t(e,o,!1!==n)},e.throttle=t,Object.defineProperty(e,"__esModule",{value:!0})}(t)}},function(e){e(e.s=9903)}]);
1435
+ `}}var ki,wi;function Ci(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function xi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Si(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}customElements.define("ia-sharing-options",gi);var Bi,Oi,Ii,zi,Di,Li,Ti,Ei,ji,Mi=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";xi(this,e);var a=t.identifier,s=t.creator,l=t.title,c=encodeURIComponent(i),d=i&&i!==a?"".concat(a,"/").concat(c):a;this.idPath=d,this.itemType=r;var u="Share this ".concat(this.reconcileItemType);this.icon=(0,o.dy)(ki||(ki=Ci(['<ia-icon icon="share" style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon>']))),this.label=u,this.id="share",this.component=(0,o.dy)(wi||(wi=Ci(['<ia-sharing-options\n identifier="','"\n type="book"\n creator="','"\n description="','"\n baseHost="','"\n ></ia-sharing-options>'])),d,s,l,n)}var t,n;return t=e,(n=[{key:"reconcileItemType",get:function(){return"bookreader"===this.itemType?"book":"item"}}])&&Si(t.prototype,n),e}(),Pi=(0,r.dy)(Bi||(Bi=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n<svg name="sort-desc" height="18" viewBox="0 0 18 18" width="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z" fill="#fff" fill-rule="nonzero"/><path d="m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z" fill="#fff" fill-rule="nonzero"/><path d="m10.3846154 11.0769231 2.7692308 5.5384615 2.7692307-5.5384615m-2.7692307 4.1538461v-13.15384612" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.661538"/></g></svg>\n']))),Ai=(0,r.dy)(Oi||(Oi=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n<svg name="sort-asc" height="18" viewBox="0 0 18 18" width="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z" fill="#fff" fill-rule="nonzero"/><path d="m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z" fill="#fff" fill-rule="nonzero"/><path d="m10.3846154 11.0769231 2.7692308 5.5384615 2.7692307-5.5384615m-2.7692307 4.1538461v-13.15384612" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.661538" transform="matrix(1 0 0 -1 0 18.692308)"/></g></svg>\n']))),Ri=(0,r.dy)(Ii||(Ii=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n<svg name="sort-neutral" height="18" viewBox="0 0 18 18" width="18" xmlns="http://www.w3.org/2000/svg"><g fill="#fff" fill-rule="evenodd"><path d="m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z" fill-rule="nonzero"/><path d="m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z" fill-rule="nonzero"/><circle cx="13" cy="9" r="2"/></g></svg>\n']))),_i=(0,r.dy)(zi||(zi=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" aria-labelledby="volumesTitleID volumesDescID">\n <title id="volumesTitleID">Volumes icon</title>\n <desc id="volumesDescID">Three books stacked on each other</desc>\n <g fill="#ffffff">\n <path fill="#ffffff" d="m9.83536396 0h10.07241114c.1725502.47117517.3378411.76385809.4958725.87804878.1295523.11419069.3199719.1998337.5712586.25692905.2512868.05709534.4704647.08564301.6575337.08564301h.2806036v15.24362526h-4.3355343v3.8106985h-4.44275v3.7250554h-12.01318261c-.27306495 0-.50313194-.085643-.69020098-.256929-.18706903-.1712861-.30936193-.3425721-.36687867-.5138581l-.06449694-.2785477v-14.2159091c0-.32815965.08627512-.5922949.25882537-.79240577.17255024-.20011086.34510049-.32150776.51765073-.36419068l.25882537-.0640244h3.36472977v-2.54767184c0-.31374722.08627513-.57067627.25882537-.77078714.17255025-.20011086.34510049-.32150776.51765074-.36419068l.25882536-.06402439h3.36472978v-2.56929047c0-.32815964.08627512-.5922949.25882537-.79240576.17255024-.20011087.34510049-.31430156.51765073-.34257207zm10.78355264 15.6294346v-13.53076498c-.2730649-.08536585-.4456152-.16380266-.5176507-.23531042-.1725502-.1424612-.2730649-.27078714-.3015441-.38497783v13.36031043h-9.87808272c0 .0144124-.02149898.0144124-.06449694 0-.04299795-.0144124-.08962561.006929-.13988296.0640244-.05025735.0570953-.07538603.1427383-.07538603.256929s.02149898.210643.06449694.289357c.04299795.078714.08599591.1322062.12899387.1604767l.06449693.0216187h10.71905571zm-10.2449613-2.4412417h7.98003v-11.60421286h-7.98003zm1.6827837-9.41990022h4.6153002c.1725502 0 .3199718.05349224.4422647.16047672s.1834393.23891353.1834393.39578714c0 .15687362-.0611464.28519956-.1834393.38497783s-.2697145.1496674-.4422647.1496674h-4.6153002c-.1725503 0-.3199719-.04988913-.4422647-.1496674-.1222929-.09977827-.1834394-.22810421-.1834394-.38497783 0-.15687361.0611465-.28880266.1834394-.39578714.1222928-.10698448.2697144-.16047672.4422647-.16047672zm-6.08197737 13.50997782h7.72120467v-.8131929h-3.79610541c-.27306495 0-.49950224-.085643-.67931188-.256929-.17980964-.1712861-.29847284-.3425721-.35598958-.5138581l-.06449694-.2785477v-10.02023282h-2.82530086zm6.77217827-11.36890243h3.2139578c.1295522 0 .240956.05709534.3342113.17128603.0932554.11419069.139883.24972284.139883.40659645 0 .15687362-.0466276.28880267-.139883.39578714-.0932553.10698448-.2046591.16047672-.3342113.16047672h-3.2139578c-.1295523 0-.2373264-.05349224-.3233223-.16047672-.0859959-.10698447-.1289938-.23891352-.1289938-.39578714 0-.15687361.0429979-.29240576.1289938-.40659645s.19377-.17128603.3233223-.17128603zm-11.15043132 15.11557653h7.69942646v-.7491685h-3.79610539c-.25854616 0-.48135376-.0892462-.66842279-.2677384-.18706904-.1784922-.30936193-.3605876-.36687868-.546286l-.06449694-.2569291v-10.04101994h-2.80352266zm14.62237682-4.5606985h-.8191949v2.1410754h-9.89986085s-.04299796.0285477-.12899387.085643c-.08599592.0570954-.12201369.1427384-.10805331.2569291 0 .1141907.01786928.210643.05360784.289357.03573856.0787139.07538603.125.1189424.138858l.06449694.0432373h10.71905575v-2.9542683zm-4.3991936 3.8106985h-.8191949v2.077051h-9.8563045c0 .0144124-.02149898.0144124-.06449694 0-.04299795-.0144125-.08962561.0105321-.13988296.0748337-.05025735.0643015-.07538603.1607538-.07538603.289357 0 .1141906.02149898.2070399.06449694.2785476.04299795.0715078.08599591.1141907.12899387.1280488l.06449693.0216186h10.69811519v-2.8686252z" />\n </g>\n </svg>\n'])));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})(e)}function Ni(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Hi(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Fi(e,t){return(Fi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Zi(e,t){if(t&&("object"===$i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Wi(e){return(Wi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var qi,Ui,Vi,Gi,Xi=function(e){!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}}),t&&Fi(e,t)}(c,e);var t,n,i,a,s,l=(a=c,s=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=Wi(a);if(s){var n=Wi(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Zi(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.call(this)).subPrefix="",e.hostUrl="",e.viewableFiles=[],e}return t=c,i=[{key:"properties",get:function(){return{subPrefix:{type:String},hostUrl:{type:String},viewableFiles:{type:Array}}}},{key:"styles",get:function(){return(0,o.iv)(ji||(ji=Ni(["\n :host {\n display: block;\n overflow-y: auto;\n box-sizing: border-box;\n color: var(--primaryTextColor);\n margin-top: 14px;\n margin-bottom: 2rem;\n --activeBorderWidth: 2px;\n }\n\n a {\n color: #ffffff;\n text-decoration: none\n }\n\n img {\n width: 35px;\n height: 45px;\n }\n\n ul {\n padding: 0;\n list-style: none;\n margin: var(--activeBorderWidth) 0.5rem 1rem 0;\n }\n\n ul > li:first-child .separator {\n display: none;\n }\n\n li {\n cursor: pointer;\n outline: none;\n position: relative;\n }\n\n li .content {\n padding: 2px 0 4px 2px;\n border: var(--activeBorderWidth) solid transparent;\n padding: .2rem 0 .4rem .2rem;\n }\n \n li .content.active {\n border: var(--activeBorderWidth) solid #538bc5;\n }\n\n small {\n font-style: italic;\n white-space: initial;\n }\n\n .container {\n display: flex;\n align-items: center;\n justify-content: center\n }\n\n .item-title {\n margin-block-start: 0em;\n margin-block-end: 0em;\n font-size: 14px;\n font-weight: bold;\n word-wrap: break-word;\n padding-left: 5px;\n }\n\n .separator {\n background-color: var(--secondaryBGColor);\n width: 98%;\n margin: 1px auto;\n height: 1px;\n }\n\n .text {\n padding-left: 10px;\n }\n\n .icon {\n display: inline-block;\n width: 14px;\n height: 14px;\n margin-left: .7rem;\n border: 1px solid var(--primaryTextColor);\n border-radius: 2px;\n background: var(--activeButtonBg) 50% 50% no-repeat;\n }\n\n "])))}}],(n=[{key:"firstUpdated",value:function(){var e=this.shadowRoot.querySelector(".content.active");setTimeout((function(){null!=e&&e.scrollIntoViewIfNeeded&&(null==e||e.scrollIntoViewIfNeeded(!0))}),350)}},{key:"volumeItemWithImageTitle",value:function(e){return(0,o.dy)(Di||(Di=Ni(['\n <li class="content active">\n <div class="separator"></div>\n <a class="container" href="',"",'">\n <div class="image">\n <img src="','">\n </div>\n <div class="text">\n <p class="item-title">',"</p>\n <small>by: ","</small>\n </div>\n </a>\n </li>\n "])),this.hostUrl,e.url_path,e.image,e.title,e.author)}},{key:"volumeItem",value:function(e){var t=this.subPrefix===e.file_subprefix?" active":"";return(0,o.dy)(Li||(Li=Ni(['\n <li>\n <div class="separator"></div>\n <div class="content','">\n <a href="https://',"",'">\n <p class="item-title">',"</p>\n </a>\n </div>\n </li>\n "])),t,this.hostUrl,e.url_path,e.title)}},{key:"volumesList",get:function(){var e=so(this.viewableFiles,(function(e){return null==e?void 0:e.file_prefix}),this.volumeItem.bind(this));return(0,o.dy)(Ti||(Ti=Ni(["\n <ul>\n ",'\n <div class="separator"></div> \n </ul>\n '])),e)}},{key:"render",value:function(){return(0,o.dy)(Ei||(Ei=Ni(["\n ","\n "])),this.viewableFiles.length?this.volumesList:r.Ld)}}])&&Hi(t.prototype,n),i&&Hi(t,i),c}(o.oi);function Yi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Ji(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Qi(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}customElements.define("viewable-files",Xi);var Ki=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.optionChange=r,this.component=document.createElement("viewable-files");var i=n.options.multipleBooksList.by_subprefix;this.viewableFiles=Object.keys(i).map((function(e){return i[e]})),this.volumeCount=Object.keys(i).length,this.component.subPrefix=n.options.subPrefix||"",this.component.hostUrl=t,this.component.viewableFiles=this.viewableFiles,this.id="volumes",this.label="Viewable files (".concat(this.volumeCount,")"),this.icon=(0,o.dy)(qi||(qi=Ji(["",""])),_i),this.sortOrderBy="orig_sort",this.sortVolumes("orig_sort")}var t,n;return t=e,(n=[{key:"sortButton",get:function(){var e=this;return{orig_sort:(0,o.dy)(Ui||(Ui=Ji(['\n <button class="sort-by neutral-icon" aria-label="Sort volumes in initial order" @click=',">","</button>\n "])),(function(){return e.sortVolumes("title_asc")}),Ri),title_asc:(0,o.dy)(Vi||(Vi=Ji(['\n <button class="sort-by asc-icon" aria-label="Sort volumes in ascending order" @click=',">","</button>\n "])),(function(){return e.sortVolumes("title_desc")}),Ai),title_desc:(0,o.dy)(Gi||(Gi=Ji(['\n <button class="sort-by desc-icon" aria-label="Sort volumes in descending order" @click=',">","</button>\n "])),(function(){return e.sortVolumes("orig_sort")}),Pi)}[this.sortOrderBy]}},{key:"sortVolumes",value:function(e){var t,n;t=this.viewableFiles.sort((function(t,n){return"orig_sort"===e?t.orig_sort-n.orig_sort:"title_asc"===e?t.title.localeCompare(n.title):n.title.localeCompare(t.title)})),this.sortOrderBy=e,this.component.viewableFiles=function(e){if(Array.isArray(e))return Yi(e)}(n=t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||function(e,t){if(e){if("string"==typeof e)return Yi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yi(e,t):void 0}}(n)||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.actionButton=this.sortButton,this.optionChange(this.bookreader),this.multipleFilesClicked(e)}},{key:"multipleFilesClicked",value:function(e){var t;window.archive_analytics&&(null===(t=window.archive_analytics)||void 0===t||t.send_event_no_sampling("BookReader","VolumesSort|".concat(e),window.location.path))}}])&&Qi(t.prototype,n),e}();function ea(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ta(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var na=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;ea(this,e),this.callback=t,this.threshhold=n,this.context=o,this.deferTimeout=void 0}var t,n;return t=e,(n=[{key:"execute",value:function(){clearTimeout(this.deferTimeout),this.deferTimeout=setTimeout(this.executeCallback.bind(this),this.threshhold)}},{key:"executeCallback",value:function(){this.callback.apply(this.context)}}])&&ta(t.prototype,n),e}();function oa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ra(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var ia=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#BookReader";oa(this,e),this.debounceTime=250,this.savedScrollY=0,this.savedScrollX=0,this.brSelector=t,this.setup=this.setup.bind(this),this.teardown=this.teardown.bind(this),this.resizeBookReaderContainer=this.resizeBookReaderContainer.bind(this),this.handleResizeEvent=this.handleResizeEvent.bind(this),this.handleBookReaderHeight=new na(this.resizeBookReaderContainer,this.debounceTime,this)}var t,n;return t=e,(n=[{key:"brDom",get:function(){return document.querySelector(this.brSelector)}},{key:"setup",value:function(e){this.bookreader=e,this.resizeBookReaderContainer(),window.addEventListener("resize",this.handleResizeEvent)}},{key:"teardown",value:function(){this.brDom.setAttribute("style",""),window.removeEventListener("resize",this.handleResizeEvent),window.scrollTo(this.savedScrollX,this.savedScrollY),this.savedScrollX=0,this.savedScrollY=0}},{key:"handleResizeEvent",value:function(){this.handleBookReaderHeight.execute()}},{key:"resizeBookReaderContainer",value:function(){var e,t=window,n=t.scrollX,o=t.scrollY;this.savedScrollX=n,this.savedScrollY=o,this.bookreader.updateBrClasses();var r=document.querySelector(".BookReaderMessage"),i=null!==(e=null==r?void 0:r.offsetHeight)&&void 0!==e?e:0,a=window.innerHeight,s="".concat(a-i,"px");this.brDom.style.height=s,this.brDom.style.top=i,window.scrollTo(0,0)}}])&&ra(t.prototype,n),e}();function aa(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var sa,la,ca,da,ua,ha=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metadata={},this.isRestricted=null}var t,n;return t=e,(n=[{key:"setMetadata",value:function(e){this.metadata=e}},{key:"setRestriction",value:function(e){this.isRestricted=e}}])&&aa(t.prototype,n),e}(),fa=(0,o.dy)(sa||(sa=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <svg\n height="100"\n viewBox="0 0 100 100"\n width="100"\n xmlns="http://www.w3.org/2000/svg"\n aria-labelledby="bookreader-loading"\n >\n <title id="bookreader-loading">Currently loading viewer.</title>\n <desc>Please wait while we load book reader.</desc>\n <g fill="#333" fill-rule="evenodd" class="book-icon">\n <g transform="matrix(1 0 0 -1 28 67.362264)">\n <path d="m44.71698 31.6981124v-29.99320678s-18.0956599.30735848-18.6322637-.7171698c-.0633962-.12226414-1.890566-.59207545-2.9745282-.59207545-1.3228302 0-3.5122641 0-4.1286791.74547168-.9707547 1.17452827-18.82811278.71660375-18.82811278.71660375v30.040754l1.83849052.7867924.29094339-28.48188608s15.94981097.15339622 17.09094297-1.10716978c.8145283-.90056602 4.997547-.91641507 5.3450942-.3526415.9611321 1.55716977 14.7101883 1.31716978 17.6077354 1.45981128l.3266038 28.22830118z"/>\n <path d="m40.1129424 33.5957539h-12.8337733c-1.8690565 0-3.1098112-.7545283-3.9299999-1.6279245v-26.70452764l1.2362264-.00792453c.4584906.72962262 3.0922641 1.39415091 3.0922641 1.39415091h10.1298111s1.0381131.01754717 1.5141509.47377357c.5643396.54056602.7913207 1.36981129.7913207 1.36981129z"/>\n <path d="m17.3354713 33.5957539h-12.8337733v-25.37660316s0-.75283017.49358489-1.14113205c.52867924-.41433961 1.3415094-.42849055 1.3415094-.42849055h10.59905631s2.2075471-.52698112 3.0928301-1.39415091l1.2.00792453v26.74245214c-.8201886.8581132-2.0530188 1.59-3.8932074 1.59"/>\n </g>\n <path\n class="ring"\n d="m17.8618849 11.6970233c18.5864635-15.59603144 45.6875867-15.59603102 64.2740497.000001 1.9271446 1.6170806 2.1785128 4.4902567.5614466 6.4174186-1.6170661 1.9271618-4.4902166 2.1785323-6.4173612.5614517-15.1996922-12.75416882-37.3625282-12.75416916-52.5622206-.000001-15.19969387 12.7541707-19.04823077 34.5805019-9.1273354 51.7641499 9.9208955 17.183646 30.7471499 24.7638499 49.3923323 17.9774983 18.6451823-6.7863521 29.7266014-25.9801026 26.2811129-45.5206248-.436848-2.4775114 1.2174186-4.8400696 3.6949079-5.2769215 2.4774893-.4368518 4.8400264 1.2174296 5.2768744 3.694941 4.2132065 23.8945096-9.3373563 47.3649806-32.137028 55.6634567-22.799672 8.2984758-48.2663986-.9707372-60.39785211-21.9832155-12.1314534-21.012481-7.42539173-47.7021198 11.16107351-63.2981544z"\n fill-rule="nonzero"\n />\n </g>\n </svg>\n'])));function pa(e){return(pa="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})(e)}function ma(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function va(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function ba(e,t){return(ba=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ya(e,t){if(t&&("object"===pa(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function ga(e){return(ga=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ka,wa,Ca=window.ResizeObserver||wt,xa="updateSideMenu",Sa=function(e){!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}}),t&&ba(e,t)}(c,e);var t,n,i,a,s,l=(a=c,s=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=ga(a);if(s){var n=ga(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return ya(this,e)});function c(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(e=l.call(this)).book={},e.pageContainerSelector=".BRcontainer",e.brWidth=0,e.bookReaderCannotLoad=!1,e.bookReaderLoaded=!1,e.bookreader=null,e.downloadableTypes=[],e.isAdmin=!1,e.lendingInitialized=!1,e.lendingStatus={},e.menuProviders={},e.menuShortcuts=[],e.sideMenuOpen=!1,e.signedIn=!1,e.fullscreenMgr=null,e.brResizeObserver=null,e.model=new ha,e.shortcutOrder=["volumes","search","bookmarks"],e}return t=c,i=[{key:"properties",get:function(){return{book:{type:Object},pageContainerSelector:{type:String},brWidth:{type:Number},bookReaderLoaded:{type:Boolean},bookreader:{type:Object},downloadableTypes:{type:Array},isAdmin:{type:Boolean},lendingInitialized:{type:Boolean},lendingStatus:{type:Object},menuProviders:{type:Object},menuShortcuts:{type:Array},sideMenuOpen:{type:Boolean},signedIn:{type:Boolean}}}},{key:"styles",get:function(){return(0,o.iv)(ua||(ua=ma(["\n #book-navigator.loading {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 30vh;\n }\n\n #book-navigator .book-loader {\n width: 30%;\n margin: auto;\n text-align: center;\n color: var(--primaryTextColor);\n }\n\n .book-loader {\n position: relative;\n }\n\n .book-loader svg {\n display: block;\n width: 60%;\n max-width: 100px;\n height: auto;\n margin: auto;\n }\n\n svg * {\n fill: var(--primaryTextColor);\n }\n\n svg .ring {\n animation: rotate 1.3s infinite linear;\n transform-origin: 50px 50px;\n transform-box: fill-box;\n display: block; // transform won't work on inline style\n }\n\n @keyframes rotate {\n 0% {\n transform: rotate(-360deg);\n }\n }\n\n .cover-img {\n max-height: 300px;\n }\n "])))}}],(n=[{key:"firstUpdated",value:function(){this.model.setMetadata(this.book),this.bindEventListeners(),this.emitPostInit()}},{key:"updated",value:function(e){if(this.bookreader&&(!e.has("sideMenuOpen")||void 0!==e.get("sideMenuOpen"))){if(this.bookreader.animating)return;this.bookreader.resize()}}},{key:"emitPostInit",value:function(){var e;this.dispatchEvent(new CustomEvent("BrBookNav:".concat("PostInit"),{detail:{brSelector:null===(e=this.bookreader)||void 0===e?void 0:e.el},bubbles:!0,composed:!0}))}},{key:"initializeBookSubmenus",value:function(){var e=this,t=this.bookreader.options.protected;this.menuProviders={search:new Dn((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t&&(e.bookreader=t),e.updateMenuContents();var o=e.brWidth>=640;!o||null!=n&&n.searchCanceled||e.updateSideMenu("search","open")}),this.bookreader),downloads:new qn(t),visualAdjustments:new Lo({onOptionChange:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;n&&(e.bookreader=n),e.updateMenuContents()},bookContainerSelector:this.pageContainerSelector,bookreader:this.bookreader}),share:new Mi(this.book.metadata,this.baseHost,this.itemType,this.bookreader.options.subPrefix),bookmarks:new Kr(this.bookmarksOptions,this.bookreader)},this.bookreader.options.enableMultipleBooks&&(this.menuProviders.volumes=new Ki(this.baseHost,this.bookreader,(function(t){t&&(e.bookreader=t),e.updateMenuContents(),e.updateSideMenu("volumes","open")})),this.addMenuShortcut("volumes")),this.addMenuShortcut("search"),this.updateMenuContents()}},{key:"mainBRContainer",get:function(){return document.querySelector(this.bookreader.el)}},{key:"bookmarksOptions",get:function(){var e=this,t="referer=".concat(encodeURIComponent(location.href));return{loginUrl:"https://".concat(this.baseHost,"/account/login?").concat(t),displayMode:this.signedIn?"bookmarks":"login",showItemNavigatorModal:this.showItemNavigatorModal.bind(this),closeItemNavigatorModal:this.closeItemNavigatorModal.bind(this),onBookmarksChanged:function(t){var n=Object.keys(t).length?"add":"remove";e["".concat(n,"MenuShortcut")]("bookmarks"),e.updateMenuContents()}}}},{key:"updateSideMenu",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"open";if(e&&t){var n=new CustomEvent(xa,{detail:{menuId:e,action:t}});this.dispatchEvent(n)}}},{key:"updateMenuContents",value:function(){var e=this.menuProviders,t=e.search,n=e.downloads,o=e.visualAdjustments,r=e.share,i=e.bookmarks,a=[e.volumes,t,i,o,r].filter((function(e){return!!e}));this.shouldShowDownloadsMenu()&&(n.update(this.downloadableTypes),a.splice(1,0,n));var s=new CustomEvent("menuUpdated",{detail:a});this.dispatchEvent(s)}},{key:"shouldShowDownloadsMenu",value:function(){if(!1===this.model.isRestricted)return!0;if(this.isAdmin)return!0;var e=this.lendingStatus.user_loan_record,t=void 0===e?{}:e;return!Array.isArray(t)&&t.type&&"SESSION_LOAN"!==t.type}},{key:"addMenuShortcut",value:function(e){this.menuShortcuts.find((function(t){return t.id===e}))||(this.menuShortcuts.push(this.menuProviders[e]),this.sortMenuShortcuts(),this.emitMenuShortcutsUpdated())}},{key:"removeMenuShortcut",value:function(e){this.menuShortcuts=this.menuShortcuts.filter((function(t){return t.id!==e})),this.emitMenuShortcutsUpdated()}},{key:"sortMenuShortcuts",value:function(){var e=this;this.menuShortcuts=this.shortcutOrder.reduce((function(t,n){var o=e.menuShortcuts.find((function(e){return e.id===n}));return o&&t.push(o),t}),[])}},{key:"emitMenuShortcutsUpdated",value:function(){var e=new CustomEvent("menuShortcutsUpdated",{detail:this.menuShortcuts});this.dispatchEvent(e)}},{key:"bindEventListeners",value:function(){var e=this;window.addEventListener("BookReader:PostInit",(function(t){e.bookreader=t.detail.props,e.bookReaderLoaded=!0,e.bookReaderCannotLoad=!1,e.fullscreenMgr=new ia(e.bookreader.el),e.initializeBookSubmenus(),setTimeout((function(){return e.bookreader.resize()}),0),e.brResizeObserver=new Ca((function(t){return e.reactToBrResize(t)})),e.brResizeObserver.observe(e.mainBRContainer)})),window.addEventListener("BookReader:fullscreenToggled",(function(t){var n=t.detail.props,o=void 0===n?null:n;o&&(e.bookreader=o),e.manageFullScreenBehavior(t)}),{passive:!0}),window.addEventListener("BookReader:ToggleSearchMenu",(function(t){e.dispatchEvent(new CustomEvent(xa,{detail:{menuId:"search",action:"toggle"}}))})),window.addEventListener("LendingFlow:PostInit",(function(t){var n=t.detail,o=n.downloadTypesAvailable,r=n.lendingStatus,i=n.isAdmin,a=n.previewType;e.lendingInitialized=!0,e.downloadableTypes=o,e.lendingStatus=r,e.isAdmin=i,e.bookReaderCannotLoad="singlePagePreview"===a})),window.addEventListener("BRJSIA:PostInit",(function(t){var n=t.detail,o=n.isRestricted,r=n.downloadURLs;e.bookReaderLoaded=!0,e.downloadableTypes=r,e.model.setRestriction(o)}))}},{key:"reactToBrResize",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=this.brWidth,o=this.bookreader.animating;t.forEach((function(t){var n=t.contentRect;t.target===e.mainBRContainer&&(e.brWidth=n.width)})),setTimeout((function(){n&&!o&&e.bookreader.resize()}),0)}},{key:"manageFullScreenBehavior",value:function(){this.emitFullScreenState(),this.bookreader.isFullscreen()?this.fullscreenMgr.setup(this.bookreader):this.fullscreenMgr.teardown()}},{key:"emitFullScreenState",value:function(){var e=this.bookreader.isFullscreen(),t=new CustomEvent("ViewportInFullScreen",{detail:{isFullScreen:e}});this.dispatchEvent(t)}},{key:"emitShowItemNavigatorModal",value:function(e){this.dispatchEvent(new CustomEvent("showItemNavigatorModal",{detail:e.detail}))}},{key:"emitCloseItemNavigatorModal",value:function(){this.dispatchEvent(new CustomEvent("closeItemNavigatorModal"))}},{key:"showItemNavigatorModal",value:function(e){this.emitShowItemNavigatorModal(e)}},{key:"closeItemNavigatorModal",value:function(){this.emitCloseItemNavigatorModal()}},{key:"loader",get:function(){var e=(0,o.dy)(la||(la=ma(['\n <div class="book-loader">',"<div>\n <h3>Loading viewer</h3>\n "])),fa);return this.bookReaderLoaded?r.Ld:e}},{key:"loadingClass",get:function(){return this.bookReaderLoaded?"":"loading"}},{key:"itemImage",get:function(){var e="https://".concat(this.baseHost,"/services/img/").concat(this.book.metadata.identifier);return(0,o.dy)(ca||(ca=ma(['<img class="cover-img" src="','" alt="cover image for ','">'])),e,this.book.metadata.identifier)}},{key:"render",value:function(){var e=this.bookReaderCannotLoad?this.itemImage:this.loader;return(0,o.dy)(da||(da=ma(['<div id="book-navigator" class="','">\n ','\n <slot name="bookreader"></slot>\n </div>\n '])),this.loadingClass,e)}}])&&va(t.prototype,n),i&&va(t,i),c}(o.oi);function Ba(e){return(Ba="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})(e)}function Oa(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Ia(e,t,n,o,r,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(o,r)}function za(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function Da(e,t){return(Da=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function La(e,t){if(t&&("object"===Ba(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function Ta(e){return(Ta=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}customElements.define("book-navigator",Sa);var Ea=function(e){!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}}),t&&Da(e,t)}(d,e);var t,n,r,i,a,s,l,c=(s=d,l=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=Ta(s);if(l){var n=Ta(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return La(this,e)});function d(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d),(e=c.call(this)).base64Json="",e.baseHost="https://archive.org",e}return t=d,r=[{key:"properties",get:function(){return{base64Json:{type:String},baseHost:{type:String}}}},{key:"styles",get:function(){return(0,o.iv)(wa||(wa=Oa(["\n :host {\n display: block;\n --primaryBGColor: var(--black, #000);\n --secondaryBGColor: #222;\n --tertiaryBGColor: #333;\n --primaryTextColor: var(--white, #fff);\n --primaryCTAFill: #194880;\n --primaryCTABorder: #c5d1df;\n --secondaryCTAFill: #333;\n --secondaryCTABorder: #999;\n --primaryErrorCTAFill: #e51c26;\n --primaryErrorCTABorder: #f8c6c8;\n }\n\n .ia-bookreader {\n background-color: var(--primaryBGColor);\n position: relative;\n height: auto;\n }\n\n item-navigator {\n display: block;\n width: 100%;\n color: var(--primaryTextColor);\n --menuButtonLabelDisplay: block;\n --menuWidth: 320px;\n --menuSliderBg: var(--secondaryBGColor);\n --activeButtonBg: var(--tertiaryBGColor);\n --subpanelRightBorderColor: var(--secondaryCTABorder);\n --animationTiming: 100ms;\n --iconFillColor: var(--primaryTextColor);\n --iconStrokeColor: var(--primaryTextColor);\n --menuSliderHeaderIconHeight: 2rem;\n --menuSliderHeaderIconWidth: 2rem;\n --iconWidth: 2.4rem;\n --iconHeight: 2.4rem;\n --shareLinkColor: var(--primaryTextColor);\n --shareIconBorder: var(--primaryTextColor);\n --shareIconBg: var(--secondaryBGColor);\n --activityIndicatorLoadingDotColor: var(--primaryTextColor);\n --activityIndicatorLoadingRingColor: var(--primaryTextColor);\n }\n "])))}}],(n=[{key:"firstUpdated",value:function(){this.fetchData()}},{key:"fetchData",value:(i=regeneratorRuntime.mark((function e(){var t,n,o,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new URLSearchParams(location.search).get("ocaid"),e.next=3,fetch("".concat(this.baseHost,"/metadata/").concat(t));case 3:return n=e.sent,e.next=6,n.json();case 6:o=e.sent,r=btoa(JSON.stringify(o)),this.setBaseJSON(r);case 9:case"end":return e.stop()}}),e,this)})),a=function(){var e=this,t=arguments;return new Promise((function(n,o){var r=i.apply(e,t);function a(e){Ia(r,n,o,a,s,"next",e)}function s(e){Ia(r,n,o,a,s,"throw",e)}a(void 0)}))},function(){return a.apply(this,arguments)})},{key:"setBaseJSON",value:function(e){this.base64Json=e}},{key:"render",value:function(){return(0,o.dy)(ka||(ka=Oa(['\n <div class="ia-bookreader">\n <item-navigator\n itemType="bookreader"\n basehost=',"\n item=",'>\n <div slot="bookreader">\n <slot name="bookreader"></slot>\n </div>\n </item-navigator>\n </div>\n '])),this.baseHost,this.base64Json)}}])&&za(t.prototype,n),r&&za(t,r),d}(o.oi);window.customElements.define("ia-bookreader",Ea)},8730:function(e,t,n){var o=n(111),r=Math.floor;e.exports=function(e){return!o(e)&&isFinite(e)&&r(e)===e}},3161:function(e,t,n){n(2109)({target:"Number",stat:!0},{isInteger:n(8730)})},4723:function(e,t,n){"use strict";var o=n(7007),r=n(9670),i=n(7466),a=n(1340),s=n(4488),l=n(1530),c=n(7651);o("match",(function(e,t,n){return[function(t){var n=s(this),o=null==t?void 0:t[e];return void 0!==o?o.call(t,n):new RegExp(t)[e](a(n))},function(e){var o=r(this),s=a(e),d=n(t,o,s);if(d.done)return d.value;if(!o.global)return c(o,s);var u=o.unicode;o.lastIndex=0;for(var h,f=[],p=0;null!==(h=c(o,s));){var m=a(h[0]);f[p]=m,""===m&&(o.lastIndex=l(s,i(o.lastIndex),u)),p++}return 0===p?null:f}]}))},3774:function(e,t){!function(e){"use strict";function t(e,t,n,o){var r,i=!1,a=0;function s(){r&&clearTimeout(r)}function l(){for(var l=arguments.length,c=new Array(l),d=0;d<l;d++)c[d]=arguments[d];var u=this,h=Date.now()-a;function f(){a=Date.now(),n.apply(u,c)}function p(){r=void 0}i||(o&&!r&&f(),s(),void 0===o&&h>e?f():!0!==t&&(r=setTimeout(o?p:f,void 0===o?e-h:e)))}return"boolean"!=typeof t&&(o=n,n=t,t=void 0),l.cancel=function(){s(),i=!0},l}e.debounce=function(e,n,o){return void 0===o?t(e,n,!1):t(e,o,!1!==n)},e.throttle=t,Object.defineProperty(e,"__esModule",{value:!0})}(t)}},function(e){e(e.s=9903)}]);
1436
1436
  //# sourceMappingURL=bookreader-component-bundle.js.map