@internetarchive/bookreader 5.0.0-81 → 5.0.0-83

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. package/.eslintrc.js +9 -9
  2. package/.github/workflows/node.js.yml +9 -7
  3. package/BookReader/BookReader.css +2 -2
  4. package/BookReader/BookReader.js +1 -1
  5. package/BookReader/BookReader.js.map +1 -1
  6. package/BookReader/ia-bookreader-bundle.js +32 -32
  7. package/BookReader/ia-bookreader-bundle.js.map +1 -1
  8. package/BookReader/images/unviewable_page.png +0 -0
  9. package/BookReader/plugins/plugin.archive_analytics.js.map +1 -1
  10. package/BookReader/plugins/plugin.autoplay.js.map +1 -1
  11. package/BookReader/plugins/plugin.chapters.js +1 -1
  12. package/BookReader/plugins/plugin.chapters.js.map +1 -1
  13. package/BookReader/plugins/plugin.iframe.js.map +1 -1
  14. package/BookReader/plugins/plugin.iiif.js +1 -1
  15. package/BookReader/plugins/plugin.iiif.js.map +1 -1
  16. package/BookReader/plugins/plugin.search.js +1 -1
  17. package/BookReader/plugins/plugin.search.js.map +1 -1
  18. package/BookReader/plugins/plugin.text_selection.js +1 -1
  19. package/BookReader/plugins/plugin.text_selection.js.map +1 -1
  20. package/BookReader/plugins/plugin.tts.js +1 -1
  21. package/BookReader/plugins/plugin.tts.js.map +1 -1
  22. package/BookReader/plugins/plugin.url.js +1 -1
  23. package/BookReader/plugins/plugin.url.js.map +1 -1
  24. package/BookReader/plugins/plugin.vendor-fullscreen.js.map +1 -1
  25. package/BookReaderDemo/IADemoBr.js +10 -3
  26. package/BookReaderDemo/demo-iiif.html +1 -1
  27. package/BookReaderDemo/demo-internetarchive.html +1 -1
  28. package/BookReaderDemo/demo-preview-pages.html +524 -524
  29. package/CHANGELOG.md +15 -0
  30. package/babel.config.js +5 -5
  31. package/package.json +16 -18
  32. package/renovate.json +1 -1
  33. package/src/BookNavigator/book-navigator.js +8 -8
  34. package/src/BookNavigator/bookmarks/bookmarks-loginCTA.js +1 -1
  35. package/src/BookNavigator/bookmarks/bookmarks-provider.js +1 -1
  36. package/src/BookNavigator/bookmarks/ia-bookmarks.js +1 -1
  37. package/src/BookNavigator/downloads/downloads.js +1 -1
  38. package/src/BookNavigator/search/search-provider.js +2 -2
  39. package/src/BookNavigator/search/search-results.js +1 -1
  40. package/src/BookNavigator/sharing.js +1 -1
  41. package/src/BookNavigator/viewable-files.js +1 -1
  42. package/src/BookNavigator/visual-adjustments/visual-adjustments.js +3 -3
  43. package/src/BookReader/BookModel.js +12 -7
  44. package/src/BookReader/DragScrollable.js +2 -2
  45. package/src/BookReader/ModeSmoothZoom.js +5 -5
  46. package/src/BookReader/ModeThumb.js +2 -2
  47. package/src/BookReader/Navbar/Navbar.js +4 -4
  48. package/src/BookReader/ReduceSet.js +2 -2
  49. package/src/BookReader/Toolbar/Toolbar.js +4 -4
  50. package/src/BookReader/options.js +19 -10
  51. package/src/BookReader/utils/classes.js +1 -1
  52. package/src/BookReader.js +12 -12
  53. package/src/assets/images/unviewable_page.png +0 -0
  54. package/src/css/_BRicon.scss +8 -2
  55. package/src/ia-bookreader/ia-bookreader.js +1 -1
  56. package/src/plugins/plugin.archive_analytics.js +1 -1
  57. package/src/plugins/plugin.autoplay.js +2 -2
  58. package/src/plugins/plugin.chapters.js +3 -3
  59. package/src/plugins/plugin.iframe.js +1 -1
  60. package/src/plugins/plugin.iiif.js +9 -5
  61. package/src/plugins/plugin.text_selection.js +2 -2
  62. package/src/plugins/plugin.vendor-fullscreen.js +3 -3
  63. package/src/plugins/search/plugin.search.js +16 -11
  64. package/src/plugins/search/view.js +4 -1
  65. package/src/plugins/tts/AbstractTTSEngine.js +1 -1
  66. package/src/plugins/tts/FestivalTTSEngine.js +3 -3
  67. package/src/plugins/tts/PageChunk.js +2 -2
  68. package/src/plugins/tts/WebTTSEngine.js +1 -1
  69. package/src/plugins/tts/plugin.tts.js +1 -1
  70. package/src/plugins/tts/utils.js +1 -1
  71. package/src/plugins/url/plugin.url.js +1 -1
  72. package/tests/e2e/helpers/mockSearch.js +13 -13
  73. package/tests/jest/BookNavigator/book-navigator.test.js +27 -27
  74. package/tests/jest/BookNavigator/downloads/downloads-provider.test.js +5 -5
  75. package/tests/jest/BookNavigator/downloads/downloads.test.js +3 -3
  76. package/tests/jest/BookNavigator/search/search-provider.test.js +15 -15
  77. package/tests/jest/BookNavigator/search/search-results.test.js +1 -1
  78. package/tests/jest/BookNavigator/sharing/sharing-provider.test.js +5 -5
  79. package/tests/jest/BookNavigator/viewable-files/viewable-files-provider.test.js +8 -8
  80. package/tests/jest/BookReader/BookReaderPublicFunctions.test.js +3 -3
  81. package/tests/jest/BookReader/Mode1UpLit.test.js +2 -2
  82. package/tests/jest/BookReader/Mode2UpLit.test.js +3 -3
  83. package/tests/jest/BookReader/ModeSmoothZoom.test.js +4 -4
  84. package/tests/jest/BookReader/Navbar/Navbar.test.js +16 -16
  85. package/tests/jest/BookReader/Toolbar/Toolbar.test.js +1 -1
  86. package/tests/jest/BookReader.keyboard.test.js +1 -1
  87. package/tests/jest/BookReader.options.test.js +1 -1
  88. package/tests/jest/BookReader.test.js +4 -4
  89. package/tests/jest/plugins/plugin.chapters.test.js +3 -3
  90. package/tests/jest/plugins/plugin.iframe.test.js +2 -2
  91. package/tests/jest/plugins/plugin.text_selection.test.js +1 -1
  92. package/tests/jest/plugins/search/plugin.search.view.test.js +6 -6
  93. package/tests/jest/plugins/search/utils.js +3 -3
  94. package/tests/jest/plugins/tts/AbstractTTSEngine.test.js +1 -1
  95. package/tests/jest/plugins/tts/WebTTSEngine.test.js +2 -2
  96. package/tests/jest/plugins/url/UrlPlugin.test.js +2 -2
  97. package/tests/jest/plugins/url/plugin.url.test.js +6 -6
  98. package/webpack.config.js +6 -6
@@ -905,7 +905,7 @@
905
905
  small.visible {
906
906
  opacity: 1;
907
907
  }
908
- `}};o([(0,s.MZ)({type:String})],ce.prototype,"baseHost",void 0),o([(0,s.MZ)({type:String})],ce.prototype,"creator",void 0),o([(0,s.MZ)({type:String})],ce.prototype,"description",void 0),o([(0,s.MZ)({type:Boolean})],ce.prototype,"embedOptionsVisible",void 0),o([(0,s.MZ)({type:String})],ce.prototype,"identifier",void 0),o([(0,s.MZ)({type:Array})],ce.prototype,"sharingOptions",void 0),o([(0,s.MZ)({type:String})],ce.prototype,"type",void 0),o([(0,s.MZ)({type:Boolean})],ce.prototype,"renderHeader",void 0),o([(0,s.MZ)({type:String})],ce.prototype,"fileSubPrefix",void 0),ce=o([(0,s.EM)("iaux-in-share-panel")],ce),n(6033);var ue=n(6681),de=n(1091),he=ue.ge.I,pe=function(){return document.createComment("")},fe=function(e,t,n){var r,o=e._$AA.parentNode,i=void 0===t?e._$AB:t._$AA;if(void 0===n){var a=o.insertBefore(pe(),i),s=o.insertBefore(pe(),i);n=new he(a,s,e,e.options)}else{var l,c=n._$AB.nextSibling,u=n._$AM,d=u!==e;if(d&&(null===(r=n._$AQ)||void 0===r||r.call(n,e),n._$AM=e,void 0!==n._$AP&&(l=e._$AU)!==u._$AU&&n._$AP(l)),c!==i||d)for(var h=n._$AA;h!==c;){var p=h.nextSibling;o.insertBefore(h,i),h=p}}return n},me=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;return e._$AI(t,n),e},ve={},ye=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ve;return e._$AH=t},be=function(e){var t;null===(t=e._$AP)||void 0===t||t.call(e,!1,!0);for(var n=e._$AA,r=e._$AB.nextSibling;n!==r;){var o=n.nextSibling;n.remove(),n=o}};function ge(e){return ge="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},ge(e)}function ke(e,t){if(e){if("string"==typeof e)return we(e,t);var n={}.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)?we(e,t):void 0}}function we(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Se(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ce(r.key),r)}}function Ce(e){var t=function(e,t){if("object"!=ge(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=ge(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ge(t)?t:t+""}function xe(e,t,n){return t=Be(t),function(e,t){if(t&&("object"==ge(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Oe(e)}(e,je()?Reflect.construct(t,n||[],Be(e).constructor):t.apply(e,n))}function Oe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function je(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(je=function(){return!!e})()}function Be(e){return Be=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Be(e)}function Ee(e,t){return Ee=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ee(e,t)}var Le=function(e,t,n){for(var r=new Map,o=t;o<=n;o++)r.set(e[o],o);return r},Pe=(0,de.u$)(function(e){function t(e){var n;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=xe(this,t,[e]),e.type!==de.OA.CHILD)throw Error("repeat() can only be used in text expressions");return Oe(n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ee(e,t)}(t,e),function(e,t,n){return t&&Se(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"ct",value:function(e,t,n){var r;void 0===n?n=t:void 0!==t&&(r=t);var o,i=[],a=[],s=0,l=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=ke(e))){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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(l.s();!(o=l.n()).done;){var c=o.value;i[s]=r?r(c,s):s,a[s]=n(c,s),s++}}catch(e){l.e(e)}finally{l.f()}return{values:a,keys:i}}},{key:"render",value:function(e,t,n){return this.ct(e,t,n).values}},{key:"update",value:function(e,t){var n,r=function(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 r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||ke(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.")}()}(t,3),o=r[0],i=r[1],a=r[2],s=function(e){return e._$AH}(e),l=this.ct(o,i,a),c=l.values,u=l.keys;if(!Array.isArray(s))return this.ut=u,c;for(var d,h,p=null!==(n=this.ut)&&void 0!==n?n:this.ut=[],f=[],m=0,v=s.length-1,y=0,b=c.length-1;m<=v&&y<=b;)if(null===s[m])m++;else if(null===s[v])v--;else if(p[m]===u[y])f[y]=me(s[m],c[y]),m++,y++;else if(p[v]===u[b])f[b]=me(s[v],c[b]),v--,b--;else if(p[m]===u[b])f[b]=me(s[m],c[b]),fe(e,f[b+1],s[m]),m++,b--;else if(p[v]===u[y])f[y]=me(s[v],c[y]),fe(e,s[m],s[v]),v--,y++;else if(void 0===d&&(d=Le(u,y,b),h=Le(p,m,v)),d.has(p[m]))if(d.has(p[v])){var g=h.get(u[y]),k=void 0!==g?s[g]:null;if(null===k){var w=fe(e,s[m]);me(w,c[y]),f[y]=w}else f[y]=me(k,c[y]),fe(e,s[m],k),s[g]=null;y++}else be(s[v]),v--;else be(s[m]),m++;for(;y<=b;){var S=fe(e,f[b+1]);me(S,c[y]),f[y++]=S}for(;m<=v;){var C=s[m++];null!==C&&be(C)}return this.ut=u,ye(e,f),ue.c0}}])}(de.WL));const Me=r.qy`
908
+ `}};o([(0,s.MZ)({type:String})],ce.prototype,"baseHost",void 0),o([(0,s.MZ)({type:String})],ce.prototype,"creator",void 0),o([(0,s.MZ)({type:String})],ce.prototype,"description",void 0),o([(0,s.MZ)({type:Boolean})],ce.prototype,"embedOptionsVisible",void 0),o([(0,s.MZ)({type:String})],ce.prototype,"identifier",void 0),o([(0,s.MZ)({type:Array})],ce.prototype,"sharingOptions",void 0),o([(0,s.MZ)({type:String})],ce.prototype,"type",void 0),o([(0,s.MZ)({type:Boolean})],ce.prototype,"renderHeader",void 0),o([(0,s.MZ)({type:String})],ce.prototype,"fileSubPrefix",void 0),ce=o([(0,s.EM)("iaux-in-share-panel")],ce),n(6033);var ue=n(6681),de=n(1091),he=ue.ge.I,pe=function(){return document.createComment("")},fe=function(e,t,n){var r,o=e._$AA.parentNode,i=void 0===t?e._$AB:t._$AA;if(void 0===n){var a=o.insertBefore(pe(),i),s=o.insertBefore(pe(),i);n=new he(a,s,e,e.options)}else{var l,c=n._$AB.nextSibling,u=n._$AM,d=u!==e;if(d&&(null===(r=n._$AQ)||void 0===r||r.call(n,e),n._$AM=e,void 0!==n._$AP&&(l=e._$AU)!==u._$AU&&n._$AP(l)),c!==i||d)for(var h=n._$AA;h!==c;){var p=h.nextSibling;o.insertBefore(h,i),h=p}}return n},me=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;return e._$AI(t,n),e},ve={},ye=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ve;return e._$AH=t},be=function(e){var t;null===(t=e._$AP)||void 0===t||t.call(e,!1,!0);for(var n=e._$AA,r=e._$AB.nextSibling;n!==r;){var o=n.nextSibling;n.remove(),n=o}};function ge(e){return ge="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},ge(e)}function ke(e,t){if(e){if("string"==typeof e)return we(e,t);var n={}.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)?we(e,t):void 0}}function we(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Se(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ce(r.key),r)}}function Ce(e){var t=function(e,t){if("object"!=ge(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=ge(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ge(t)?t:t+""}function xe(e,t,n){return t=je(t),function(e,t){if(t&&("object"==ge(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)}(e,Oe()?Reflect.construct(t,n||[],je(e).constructor):t.apply(e,n))}function Oe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Oe=function(){return!!e})()}function je(e){return je=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},je(e)}function Be(e,t){return Be=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Be(e,t)}var Ee=function(e,t,n){for(var r=new Map,o=t;o<=n;o++)r.set(e[o],o);return r},Le=(0,de.u$)(function(e){function t(e){var n;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=xe(this,t,[e]),e.type!==de.OA.CHILD)throw Error("repeat() can only be used in text expressions");return n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Be(e,t)}(t,e),function(e,t,n){return t&&Se(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"ct",value:function(e,t,n){var r;void 0===n?n=t:void 0!==t&&(r=t);var o,i=[],a=[],s=0,l=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=ke(e))){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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(l.s();!(o=l.n()).done;){var c=o.value;i[s]=r?r(c,s):s,a[s]=n(c,s),s++}}catch(e){l.e(e)}finally{l.f()}return{values:a,keys:i}}},{key:"render",value:function(e,t,n){return this.ct(e,t,n).values}},{key:"update",value:function(e,t){var n,r=function(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 r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||ke(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.")}()}(t,3),o=r[0],i=r[1],a=r[2],s=function(e){return e._$AH}(e),l=this.ct(o,i,a),c=l.values,u=l.keys;if(!Array.isArray(s))return this.ut=u,c;for(var d,h,p=null!==(n=this.ut)&&void 0!==n?n:this.ut=[],f=[],m=0,v=s.length-1,y=0,b=c.length-1;m<=v&&y<=b;)if(null===s[m])m++;else if(null===s[v])v--;else if(p[m]===u[y])f[y]=me(s[m],c[y]),m++,y++;else if(p[v]===u[b])f[b]=me(s[v],c[b]),v--,b--;else if(p[m]===u[b])f[b]=me(s[m],c[b]),fe(e,f[b+1],s[m]),m++,b--;else if(p[v]===u[y])f[y]=me(s[v],c[y]),fe(e,s[m],s[v]),v--,y++;else if(void 0===d&&(d=Ee(u,y,b),h=Ee(p,m,v)),d.has(p[m]))if(d.has(p[v])){var g=h.get(u[y]),k=void 0!==g?s[g]:null;if(null===k){var w=fe(e,s[m]);me(w,c[y]),f[y]=w}else f[y]=me(k,c[y]),fe(e,s[m],k),s[g]=null;y++}else be(s[v]),v--;else be(s[m]),m++;for(;y<=b;){var S=fe(e,f[b+1]);me(S,c[y]),f[y++]=S}for(;m<=v;){var C=s[m++];null!==C&&be(C)}return this.ut=u,ye(e,f),ue.c0}}])}(de.WL));const Pe=r.qy`
909
909
  <svg
910
910
  name="sort-asc"
911
911
  height="18"
@@ -934,7 +934,7 @@
934
934
  />
935
935
  </g>
936
936
  </svg>
937
- `,Ae=r.qy`
937
+ `,Me=r.qy`
938
938
  <svg
939
939
  name="sort-desc"
940
940
  height="18"
@@ -962,7 +962,7 @@
962
962
  />
963
963
  </g>
964
964
  </svg>
965
- `,Ie=r.qy`
965
+ `,Ae=r.qy`
966
966
  <svg
967
967
  name="sort-neutral"
968
968
  height="18"
@@ -982,7 +982,7 @@
982
982
  <circle cx="13" cy="9" r="2" />
983
983
  </g>
984
984
  </svg>
985
- `,ze=r.qy`
985
+ `,Ie=r.qy`
986
986
  <svg
987
987
  height="24"
988
988
  viewBox="0 0 24 24"
@@ -998,13 +998,13 @@
998
998
  />
999
999
  </g>
1000
1000
  </svg>
1001
- `;let Te=class extends r.WF{constructor(){super(...arguments),this.fileListRaw=[],this.fileListSorted=[],this.sortOrderBy="default"}render(){return r.qy`<div class="sort-multi-file-list">${this.sortButton}</div>`}get sortButton(){return{default:r.qy`
1001
+ `;let ze=class extends r.WF{constructor(){super(...arguments),this.fileListRaw=[],this.fileListSorted=[],this.sortOrderBy="default"}render(){return r.qy`<div class="sort-multi-file-list">${this.sortButton}</div>`}get sortButton(){return{default:r.qy`
1002
1002
  <button
1003
1003
  class="sort-by neutral-icon"
1004
1004
  aria-label="Sort volumes in initial order"
1005
1005
  @click=${()=>this.sortVolumes("title_asc")}
1006
1006
  >
1007
- ${Ie}
1007
+ ${Ae}
1008
1008
  </button>
1009
1009
  `,title_asc:r.qy`
1010
1010
  <button
@@ -1012,7 +1012,7 @@
1012
1012
  aria-label="Sort volumes in ascending order"
1013
1013
  @click=${()=>this.sortVolumes("title_desc")}
1014
1014
  >
1015
- ${Me}
1015
+ ${Pe}
1016
1016
  </button>
1017
1017
  `,title_desc:r.qy`
1018
1018
  <button
@@ -1020,7 +1020,7 @@
1020
1020
  aria-label="Sort volumes in descending order"
1021
1021
  @click=${()=>this.sortVolumes("default")}
1022
1022
  >
1023
- ${Ae}
1023
+ ${Me}
1024
1024
  </button>
1025
1025
  `}[this.sortOrderBy]}sortVolumes(e){this.sortOrderBy=e;let t=[];t=this.fileListRaw.sort(((t,n)=>"title_asc"===e?t.title.localeCompare(n.title):"title_desc"===e?n.title.localeCompare(t.title):t.orig_sort-n.orig_sort)),this.dispatchEvent(new CustomEvent("fileListSorted",{detail:{sortType:e,sortedFiles:t},bubbles:!0,composed:!0})),this.fileListSorted=t}static get styles(){return r.AH`
1026
1026
  button.sort-by {
@@ -1030,7 +1030,7 @@
1030
1030
  --iconWidth: var(--menuSliderHeaderIconWidth);
1031
1031
  --iconHeight: var(--menuSliderHeaderIconHeight);
1032
1032
  }
1033
- `}};o([(0,s.MZ)({type:Array})],Te.prototype,"fileListRaw",void 0),o([(0,s.MZ)({type:Array})],Te.prototype,"fileListSorted",void 0),o([(0,s.MZ)({type:String,reflect:!0})],Te.prototype,"sortOrderBy",void 0),Te=o([(0,s.EM)("iaux-in-sort-files-button")],Te);let De=class extends r.WF{constructor(){super(...arguments),this.baseHost="archive.org",this.sortOrderBy="default",this.subPrefix="",this.fileList=[],this.addSortToUrl=!1}firstUpdated(){const e=this.shadowRoot.querySelector(".content.active");setTimeout((()=>{(null==e?void 0:e.scrollIntoViewIfNeeded)?null==e||e.scrollIntoViewIfNeeded(!0):null==e||e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}),350)}volumeItemWithImageTitle(e){const t=this.fileUrl(e);return r.qy`
1033
+ `}};o([(0,s.MZ)({type:Array})],ze.prototype,"fileListRaw",void 0),o([(0,s.MZ)({type:Array})],ze.prototype,"fileListSorted",void 0),o([(0,s.MZ)({type:String,reflect:!0})],ze.prototype,"sortOrderBy",void 0),ze=o([(0,s.EM)("iaux-in-sort-files-button")],ze);let Te=class extends r.WF{constructor(){super(...arguments),this.baseHost="archive.org",this.sortOrderBy="default",this.subPrefix="",this.fileList=[],this.addSortToUrl=!1}firstUpdated(){const e=this.shadowRoot.querySelector(".content.active");setTimeout((()=>{(null==e?void 0:e.scrollIntoViewIfNeeded)?null==e||e.scrollIntoViewIfNeeded(!0):null==e||e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}),350)}volumeItemWithImageTitle(e){const t=this.fileUrl(e);return r.qy`
1034
1034
  <li class="content active">
1035
1035
  <div class="separator"></div>
1036
1036
  <a class="container" href="${t}">
@@ -1056,7 +1056,7 @@
1056
1056
  </a>
1057
1057
  </div>
1058
1058
  </li>
1059
- `}get fileListTemplate(){const e=Pe(this.fileList,(e=>null==e?void 0:e.file_prefix),this.fileLi.bind(this));return r.qy`
1059
+ `}get fileListTemplate(){const e=Le(this.fileList,(e=>null==e?void 0:e.file_prefix),this.fileLi.bind(this));return r.qy`
1060
1060
  <ul>
1061
1061
  ${e}
1062
1062
  <div class="separator"></div>
@@ -1170,7 +1170,7 @@
1170
1170
  width: 1px;
1171
1171
  overflow: hidden;
1172
1172
  }
1173
- `}};o([(0,s.MZ)({type:String})],De.prototype,"baseHost",void 0),o([(0,s.MZ)({type:String})],De.prototype,"sortOrderBy",void 0),o([(0,s.MZ)({type:String})],De.prototype,"subPrefix",void 0),o([(0,s.MZ)({type:Array})],De.prototype,"fileList",void 0),o([(0,s.MZ)({type:Boolean,reflect:!0})],De.prototype,"addSortToUrl",void 0),De=o([(0,s.EM)("iaux-in-viewable-files-panel")],De),n(3851),n(1278),n(3500),n(8706),n(2008),n(113),n(2712),n(4554),n(9085),n(9432),n(1761),n(5746);class _e{constructor(e){var t,n,r,o,i,a,s;this.title=null==e?void 0:e.title,this.subtitle=null==e?void 0:e.subtitle,this.headline=null==e?void 0:e.headline,this.message=null==e?void 0:e.message,this.headerColor=null!==(t=null==e?void 0:e.headerColor)&&void 0!==t?t:"#55A183",this.bodyColor=null!==(n=null==e?void 0:e.bodyColor)&&void 0!==n?n:"#f5f5f7",this.showProcessingIndicator=null!==(r=null==e?void 0:e.showProcessingIndicator)&&void 0!==r&&r,this.processingImageMode=null!==(o=null==e?void 0:e.processingImageMode)&&void 0!==o?o:"complete",this.showCloseButton=null===(i=null==e?void 0:e.showCloseButton)||void 0===i||i,this.showHeaderLogo=null===(a=null==e?void 0:e.showHeaderLogo)||void 0===a||a,this.closeOnBackdropClick=null===(s=null==e?void 0:e.closeOnBackdropClick)||void 0===s||s}}const $e=Object.freeze({processing:"processing",complete:"complete"});class He extends r.WF{static get properties(){return{mode:{type:String}}}constructor(){super(),this.mode=$e.processing}render(){return r.qy`
1173
+ `}};o([(0,s.MZ)({type:String})],Te.prototype,"baseHost",void 0),o([(0,s.MZ)({type:String})],Te.prototype,"sortOrderBy",void 0),o([(0,s.MZ)({type:String})],Te.prototype,"subPrefix",void 0),o([(0,s.MZ)({type:Array})],Te.prototype,"fileList",void 0),o([(0,s.MZ)({type:Boolean,reflect:!0})],Te.prototype,"addSortToUrl",void 0),Te=o([(0,s.EM)("iaux-in-viewable-files-panel")],Te),n(3851),n(1278),n(3500),n(8706),n(2008),n(113),n(2712),n(4554),n(9085),n(9432),n(1761),n(5746);class De{constructor(e){var t,n,r,o,i,a,s;this.title=null==e?void 0:e.title,this.subtitle=null==e?void 0:e.subtitle,this.headline=null==e?void 0:e.headline,this.message=null==e?void 0:e.message,this.headerColor=null!==(t=null==e?void 0:e.headerColor)&&void 0!==t?t:"#55A183",this.bodyColor=null!==(n=null==e?void 0:e.bodyColor)&&void 0!==n?n:"#f5f5f7",this.showProcessingIndicator=null!==(r=null==e?void 0:e.showProcessingIndicator)&&void 0!==r&&r,this.processingImageMode=null!==(o=null==e?void 0:e.processingImageMode)&&void 0!==o?o:"complete",this.showCloseButton=null===(i=null==e?void 0:e.showCloseButton)||void 0===i||i,this.showHeaderLogo=null===(a=null==e?void 0:e.showHeaderLogo)||void 0===a||a,this.closeOnBackdropClick=null===(s=null==e?void 0:e.closeOnBackdropClick)||void 0===s||s}}const _e=Object.freeze({processing:"processing",complete:"complete"});class $e extends r.WF{static get properties(){return{mode:{type:String}}}constructor(){super(),this.mode=_e.processing}render(){return r.qy`
1174
1174
  <div class="${this.mode}">
1175
1175
  <svg
1176
1176
  viewBox="0 0 120 120"
@@ -1304,7 +1304,7 @@
1304
1304
  opacity: 0;
1305
1305
  }
1306
1306
  }
1307
- `}}window.customElements.define("ia-activity-indicator",He);var qe=r.qy`
1307
+ `}}window.customElements.define("ia-activity-indicator",$e);var He=r.qy`
1308
1308
  <svg
1309
1309
  viewBox="0 0 40 40"
1310
1310
  version="1.1"
@@ -1315,7 +1315,7 @@
1315
1315
  <desc id="closeDescID">A line drawing of an X</desc>
1316
1316
  <path d="m29.1923882 10.8076118c.5857864.5857865.5857864 1.535534 0 2.1213204l-7.0711162 7.0703398 7.0711162 7.0717958c.5857864.5857864.5857864 1.5355339 0 2.1213204-.5857865.5857864-1.535534.5857864-2.1213204 0l-7.0717958-7.0711162-7.0703398 7.0711162c-.5857864.5857864-1.5355339.5857864-2.1213204 0-.5857864-.5857865-.5857864-1.535534 0-2.1213204l7.0706602-7.0717958-7.0706602-7.0703398c-.5857864-.5857864-.5857864-1.5355339 0-2.1213204.5857865-.5857864 1.535534-.5857864 2.1213204 0l7.0703398 7.0706602 7.0717958-7.0706602c.5857864-.5857864 1.5355339-.5857864 2.1213204 0z" class="fill-color" fill-rule="evenodd"/>
1317
1317
  </svg>
1318
- `,Re=r.qy`
1318
+ `,qe=r.qy`
1319
1319
  <svg
1320
1320
  class="ia-logo"
1321
1321
  viewBox="0 0 27 30"
@@ -1334,12 +1334,12 @@
1334
1334
  </g>
1335
1335
  </g>
1336
1336
  </svg>
1337
- `;let Fe=class extends r.WF{constructor(){super(...arguments),this.config=new _e}render(){return r.qy`
1337
+ `;let Re=class extends r.WF{constructor(){super(...arguments),this.config=new De}render(){return r.qy`
1338
1338
  <div class="modal-wrapper">
1339
1339
  <div class="modal-container">
1340
1340
  <header style="background-color: ${this.config.headerColor}">
1341
1341
  ${this.config.showCloseButton?this.closeButtonTemplate:""}
1342
- ${this.config.showHeaderLogo?r.qy`<div class="logo-icon">${Re}</div>`:r.s6}
1342
+ ${this.config.showHeaderLogo?r.qy`<div class="logo-icon">${qe}</div>`:r.s6}
1343
1343
  ${this.config.title?r.qy`<h1 class="title">${this.config.title}</h1>`:""}
1344
1344
  ${this.config.subtitle?r.qy`<h2 class="subtitle">${this.config.subtitle}</h2>`:""}
1345
1345
  </header>
@@ -1372,7 +1372,7 @@
1372
1372
  tabindex="0"
1373
1373
  @click=${this.handleCloseButton}
1374
1374
  >
1375
- ${qe}
1375
+ ${He}
1376
1376
  </button>
1377
1377
  `}static get styles(){const e=r.AH`var(--modalLogoSize, 6.5rem)`,t=r.AH`var(--processingImageSize, 7.5rem)`,n=r.AH`var(--modalCornerRadius, 1rem)`,o=r.AH`var(--modalBorder, 2px solid black)`,i=r.AH`var(--modalBottomMargin, 2.5rem)`,a=r.AH`var(--modalTopMargin, 5rem)`,s=r.AH`var(--modalHeaderBottomPadding, 0.5em)`,l=r.AH`var(--modalBottomPadding, 2rem)`,c=r.AH`var(--modalScrollOffset, 5px)`,u=r.AH`var(--modalTitleFontSize, 1.8rem)`,d=r.AH`var(--modalSubtitleFontSize, 1.4rem)`,h=r.AH`var(--modalHeadlineFontSize, 1.6rem)`,p=r.AH`var(--modalMessageFontSize, 1.4rem)`,f=r.AH`var(--modalTitleLineHeight, normal)`,m=r.AH`var(--modalSubtitleLineHeight, normal)`,v=r.AH`var(--modalHeadlineLineHeight, normal)`,y=r.AH`var(--modalMessageLineHeight, normal)`;return r.AH`
1378
1378
  .processing-logo {
@@ -1524,7 +1524,7 @@
1524
1524
  clip: rect(0, 0, 0, 0);
1525
1525
  border: 0;
1526
1526
  }
1527
- `}};var Ne;o([(0,s.MZ)({type:Object})],Fe.prototype,"config",void 0),Fe=o([(0,s.EM)("modal-template")],Fe),function(e){e.Open="open",e.Closed="closed"}(Ne||(Ne={}));class Ze{constructor(e){this.windowResizeThrottler=function(e,t,n){var r,o=n||{},i=o.noTrailing,a=void 0!==i&&i,s=o.noLeading,l=void 0!==s&&s,c=o.debounceMode,u=void 0===c?void 0:c,d=!1,h=0;function p(){r&&clearTimeout(r)}function f(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];var s=this,c=Date.now()-h;function f(){h=Date.now(),t.apply(s,o)}function m(){r=void 0}d||(l||!u||r||f(),p(),void 0===u&&c>e?l?(h=Date.now(),a||(r=setTimeout(u?m:f,e))):f():!0!==a&&(r=setTimeout(u?m:f,void 0===u?e-c:e)))}return f.cancel=function(e){var t=(e||{}).upcomingOnly,n=void 0!==t&&t;p(),d=!n},f}(100,this.updateModalContainerHeight,{noLeading:!1,noTrailing:!1}).bind(this),this.modalManager=e}handleModeChange(e){switch(e){case Ne.Open:this.startResizeListener(),this.stopDocumentScroll();break;case Ne.Closed:this.stopResizeListener(),this.resumeDocumentScroll()}}updateModalContainerHeight(){this.modalManager.style.setProperty("--containerHeight",`${window.innerHeight}px`)}stopDocumentScroll(){document.body.classList.add("modal-manager-open")}resumeDocumentScroll(){document.body.classList.remove("modal-manager-open")}startResizeListener(){window.addEventListener("resize",this.windowResizeThrottler)}stopResizeListener(){window.removeEventListener("resize",this.windowResizeThrottler)}}let We=class extends r.WF{constructor(){super(...arguments),this.mode=Ne.Closed,this.hostBridge=new Ze(this),this.closeOnBackdropClick=!0}render(){return r.qy`
1527
+ `}};var Fe;o([(0,s.MZ)({type:Object})],Re.prototype,"config",void 0),Re=o([(0,s.EM)("modal-template")],Re),function(e){e.Open="open",e.Closed="closed"}(Fe||(Fe={}));class Ne{constructor(e){this.windowResizeThrottler=function(e,t,n){var r,o=n||{},i=o.noTrailing,a=void 0!==i&&i,s=o.noLeading,l=void 0!==s&&s,c=o.debounceMode,u=void 0===c?void 0:c,d=!1,h=0;function p(){r&&clearTimeout(r)}function f(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];var s=this,c=Date.now()-h;function f(){h=Date.now(),t.apply(s,o)}function m(){r=void 0}d||(l||!u||r||f(),p(),void 0===u&&c>e?l?(h=Date.now(),a||(r=setTimeout(u?m:f,e))):f():!0!==a&&(r=setTimeout(u?m:f,void 0===u?e-c:e)))}return f.cancel=function(e){var t=(e||{}).upcomingOnly,n=void 0!==t&&t;p(),d=!n},f}(100,this.updateModalContainerHeight,{noLeading:!1,noTrailing:!1}).bind(this),this.modalManager=e}handleModeChange(e){switch(e){case Fe.Open:this.startResizeListener(),this.stopDocumentScroll();break;case Fe.Closed:this.stopResizeListener(),this.resumeDocumentScroll()}}updateModalContainerHeight(){this.modalManager.style.setProperty("--containerHeight",`${window.innerHeight}px`)}stopDocumentScroll(){document.body.classList.add("modal-manager-open")}resumeDocumentScroll(){document.body.classList.remove("modal-manager-open")}startResizeListener(){window.addEventListener("resize",this.windowResizeThrottler)}stopResizeListener(){window.removeEventListener("resize",this.windowResizeThrottler)}}let Ze=class extends r.WF{constructor(){super(...arguments),this.mode=Fe.Closed,this.hostBridge=new Ne(this),this.closeOnBackdropClick=!0}render(){return r.qy`
1528
1528
  <div class="container">
1529
1529
  <div class="backdrop" @click=${this.backdropClicked}></div>
1530
1530
  <modal-template
@@ -1534,7 +1534,7 @@
1534
1534
  ${this.customModalContent}
1535
1535
  </modal-template>
1536
1536
  </div>
1537
- `}getMode(){return this.mode}closeModal(){this.mode=Ne.Closed}callUserClosedModalCallback(){const e=this.userClosedModalCallback;this.userClosedModalCallback=void 0,e&&e()}showModal(e){return t=this,n=void 0,o=function*(){this.closeOnBackdropClick=e.config.closeOnBackdropClick,this.userClosedModalCallback=e.userClosedModalCallback,this.modalTemplate.config=e.config,this.customModalContent=e.customModalContent,this.mode=Ne.Open,yield this.modalTemplate.updateComplete,this.modalTemplate.focus()},new((r=void 0)||(r=Promise))((function(e,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(a,s)}l((o=o.apply(t,n||[])).next())}));var t,n,r,o}updated(e){e.has("mode")&&this.handleModeChange()}backdropClicked(){this.closeOnBackdropClick&&(this.closeModal(),this.callUserClosedModalCallback())}handleModeChange(){this.hostBridge.handleModeChange(this.mode),this.emitModeChangeEvent()}emitModeChangeEvent(){const e=new CustomEvent("modeChanged",{detail:{mode:this.mode}});this.dispatchEvent(e)}closeButtonPressed(){this.closeModal(),this.callUserClosedModalCallback()}static get styles(){const e=r.AH`var(--modalBackdropColor, rgba(10, 10, 10, 0.9))`,t=r.AH`var(--modalBackdropZindex, 1000)`,n=r.AH`var(--modalWidth, 32rem)`,o=r.AH`var(--modalMaxWidth, 95%)`,i=r.AH`var(--modalZindex, 2000)`;return r.AH`
1537
+ `}getMode(){return this.mode}closeModal(){this.mode=Fe.Closed}callUserClosedModalCallback(){const e=this.userClosedModalCallback;this.userClosedModalCallback=void 0,e&&e()}showModal(e){return t=this,n=void 0,o=function*(){this.closeOnBackdropClick=e.config.closeOnBackdropClick,this.userClosedModalCallback=e.userClosedModalCallback,this.modalTemplate.config=e.config,this.customModalContent=e.customModalContent,this.mode=Fe.Open,yield this.modalTemplate.updateComplete,this.modalTemplate.focus()},new((r=void 0)||(r=Promise))((function(e,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(a,s)}l((o=o.apply(t,n||[])).next())}));var t,n,r,o}updated(e){e.has("mode")&&this.handleModeChange()}backdropClicked(){this.closeOnBackdropClick&&(this.closeModal(),this.callUserClosedModalCallback())}handleModeChange(){this.hostBridge.handleModeChange(this.mode),this.emitModeChangeEvent()}emitModeChangeEvent(){const e=new CustomEvent("modeChanged",{detail:{mode:this.mode}});this.dispatchEvent(e)}closeButtonPressed(){this.closeModal(),this.callUserClosedModalCallback()}static get styles(){const e=r.AH`var(--modalBackdropColor, rgba(10, 10, 10, 0.9))`,t=r.AH`var(--modalBackdropZindex, 1000)`,n=r.AH`var(--modalWidth, 32rem)`,o=r.AH`var(--modalMaxWidth, 95%)`,i=r.AH`var(--modalZindex, 2000)`;return r.AH`
1538
1538
  .container {
1539
1539
  width: 100%;
1540
1540
  height: 100%;
@@ -1560,7 +1560,7 @@
1560
1560
  width: ${n};
1561
1561
  max-width: ${o};
1562
1562
  }
1563
- `}};o([(0,s.MZ)({type:String,reflect:!0})],We.prototype,"mode",void 0),o([(0,s.MZ)({type:Object})],We.prototype,"customModalContent",void 0),o([(0,s.MZ)({type:Object})],We.prototype,"hostBridge",void 0),o([(0,s.P)("modal-template")],We.prototype,"modalTemplate",void 0),We=o([(0,s.EM)("modal-manager")],We);var Ue=r.qy`
1563
+ `}};o([(0,s.MZ)({type:String,reflect:!0})],Ze.prototype,"mode",void 0),o([(0,s.MZ)({type:Object})],Ze.prototype,"customModalContent",void 0),o([(0,s.MZ)({type:Object})],Ze.prototype,"hostBridge",void 0),o([(0,s.P)("modal-template")],Ze.prototype,"modalTemplate",void 0),Ze=o([(0,s.EM)("modal-manager")],Ze);var We=r.qy`
1564
1564
  <svg
1565
1565
  viewBox="0 0 100 100"
1566
1566
  xmlns="http://www.w3.org/2000/svg"
@@ -1573,7 +1573,7 @@
1573
1573
  fill="none"
1574
1574
  d="m17.0555551 41.3194459c0-12.7430552 10.3541664-23.1027772 23.0847216-23.1027772 12.7166664 0 23.0777773 10.359722 23.0777773 23.1027772 0 12.7361108-10.3611109 23.0986106-23.0777773 23.0986106-12.7305552 0-23.0847216-10.3624998-23.0847216-23.0986106zm-17.24305512 0c0 22.2916661 18.04583292 40.3472213 40.32777672 40.3472213 8.9208332 0 17.145833-2.9319449 23.8194439-7.8527776l24.1513883 24.0777771c1.2125 1.1402778 2.8430555 1.8430556 4.6374999 1.8430556 3.7444443 0 6.7805554-3.0361111 6.7805554-6.7791665 0-2.0652778-.9222222-3.9069444-2.3736111-5.1499999l-23.718055-23.7458328c4.4152777-6.4791665 7.0152776-14.3055552 7.0152776-22.7402772 0-22.2791661-18.0458328-40.34861006-40.312499-40.34861006-22.2819438 0-40.32777672 18.06944396-40.32777672 40.34861006z" />
1575
1575
  </svg>
1576
- `;class Ve extends r.WF{static get styles(){return r.AH`
1576
+ `;class Ue extends r.WF{static get styles(){return r.AH`
1577
1577
  :host {
1578
1578
  width: var(--iconWidth, 'auto');
1579
1579
  height: var(--iconHeight, 'auto');
@@ -1586,7 +1586,7 @@
1586
1586
  .stroke-color {
1587
1587
  stroke: var(--iconStrokeColor);
1588
1588
  }
1589
- `}render(){return Ue}}function Ge(e){return Ge="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},Ge(e)}function Ye(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Je(r.key),r)}}function Je(e){var t=function(e,t){if("object"!=Ge(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ge(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ge(t)?t:t+""}function Xe(e,t,n){return t=et(t),function(e,t){if(t&&("object"==Ge(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Qe(e)}(e,Ke()?Reflect.construct(t,n||[],et(e).constructor):t.apply(e,n))}function Qe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ke(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ke=function(){return!!e})()}function et(e){return et=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},et(e)}function tt(e,t){return tt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},tt(e,t)}customElements.define("ia-icon-search",Ve),n(2062);var nt=function(e){function t(e){var n;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=Xe(this,t,[e])).et=ue.s6,e.type!==de.OA.CHILD)throw Error(n.constructor.directiveName+"() can only be used in child bindings");return Qe(n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&tt(e,t)}(t,e),function(e,t,n){return t&&Ye(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"render",value:function(e){if(e===ue.s6||null==e)return this.ft=void 0,this.et=e;if(e===ue.c0)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.et)return this.ft;this.et=e;var t=[e];return t.raw=t,this.ft={_$litType$:this.constructor.resultType,strings:t,values:[]}}}])}(de.WL);nt.directiveName="unsafeHTML",nt.resultType=1;var rt,ot,it,at,st,lt,ct,ut,dt,ht,pt,ft,mt,vt,yt,bt,gt,kt,wt,St,Ct,xt=(0,de.u$)(nt),Ot=(0,r.AH)(rt||(it=["data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEwIiB2aWV3Qm94PSIwIDAgMTMgMTAiIHdpZHRoPSIxMyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtNC4zMzMzMzMzMyAxMC00LjMzMzMzMzMzLTQuMTY2NjY2NjcgMS43MzMzMzMzMy0xLjY2NjY2NjY2IDIuNiAyLjUgNi45MzMzMzMzNy02LjY2NjY2NjY3IDEuNzMzMzMzMyAxLjY2NjY2NjY3eiIgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIi8+PC9zdmc+"],at||(at=it.slice(0)),rt=Object.freeze(Object.defineProperties(it,{raw:{value:Object.freeze(at)}})))),jt=(0,r.AH)(ot||(ot=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=="]))),Bt=(0,r.AH)(st||(st=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 font-family: inherit;\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 Et(e){return Et="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},Et(e)}function Lt(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Pt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Mt(r.key),r)}}function Mt(e){var t=function(e,t){if("object"!=Et(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Et(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Et(t)?t:t+""}function At(e,t,n){return t=zt(t),function(e,t){if(t&&("object"==Et(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)}(e,It()?Reflect.construct(t,n||[],zt(e).constructor):t.apply(e,n))}function It(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(It=function(){return!!e})()}function zt(e){return zt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},zt(e)}function Tt(e,t){return Tt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Tt(e,t)}var Dt,_t,$t,Ht,qt=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=At(this,t)).results=[],e.query="",e.queryInProgress=!1,e.renderHeader=!1,e.renderSearchAllFields=!1,e.displayResultImages=!1,e.errorMessage="",e.bindBookReaderListeners(),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Tt(e,t)}(t,e),function(e,t,n){return t&&Pt(e.prototype,t),n&&Pt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{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,this.query||this.cancelSearch()}},{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(e){this.dispatchEvent(new CustomEvent("resultSelected",{bubbles:!0,composed:!0,detail:{match:e}})),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,r.qy)(lt||(lt=Lt(["<p>("," result",")</p>"])),e,e>1?"s":""):r.s6}},{key:"headerSection",get:function(){var e=(0,r.qy)(ct||(ct=Lt(["<header>\n <h3>Search inside</h3>\n ","\n </header>"])),this.resultsCount);return this.renderHeader?e:r.s6}},{key:"searchMultipleControls",get:function(){var e=(0,r.qy)(ut||(ut=Lt(['\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.s6}},{key:"loadingIndicator",get:function(){return(0,r.qy)(dt||(dt=Lt(['\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,r.qy)(ht||(ht=Lt(['\n <ul class="results ','">\n ',"\n </ul>\n "])),t,this.results.map((function(t){return(0,r.qy)(pt||(pt=Lt(["\n <li @click=",">\n ","\n <h4>",'</h4>\n <p class="page-num">Page ',"</p>\n <p>","</p>\n </li>\n "])),e.selectResult.bind(e,t),t.cover?(0,r.qy)(ft||(ft=Lt(['<img src="','" />'])),t.cover):r.s6,t.title||r.s6,t.displayPageNumber,xt(t.html))})))}},{key:"searchForm",get:function(){return(0,r.qy)(mt||(mt=Lt(['\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 @search=","\n .value=","\n />\n </fieldset>\n </form>\n "])),this.performSearch,this.searchMultipleControls,this.setQuery,this.setQuery,this.query)}},{key:"setErrorMessage",get:function(){return(0,r.qy)(vt||(vt=Lt(['\n <p class="error-message">',"</p>\n "])),this.errorMessage)}},{key:"searchCTA",get:function(){return(0,r.qy)(yt||(yt=Lt(['<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,r.qy)(bt||(bt=Lt(["\n ","\n ",'\n <div class="results-container">\n ',"\n ","\n ","\n ","\n </div>\n "])),this.headerSection,this.searchForm,this.queryInProgress?this.loadingIndicator:r.s6,this.errorMessage?this.setErrorMessage:r.s6,this.results.length?this.resultsSet:r.s6,e?this.searchCTA:r.s6)}}],[{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,r.AH)(gt||(gt=Lt(["var(--searchResultText, #adaedc)"]))),t=(0,r.AH)(kt||(kt=Lt(["var(--searchResultBg, #272958)"]))),n=(0,r.AH)(wt||(wt=Lt(["var(--searchResultBorder, #adaedc)"]))),o=(0,r.AH)(St||(St=Lt(["(--tertiaryBGColor, #333)"]))),i=(0,r.AH)(Ct||(Ct=Lt(["\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,Ot,o,jt,jt);return[Bt,i]}}])}(r.WF);function Rt(e){return Rt="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},Rt(e)}function Ft(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Nt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Zt(r.key),r)}}function Zt(e){var t=function(e,t){if("object"!=Rt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Rt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Rt(t)?t:t+""}customElements.define("ia-book-search-results",qt);var Wt,Ut,Vt,Gt,Yt,Jt,Xt,Qt,Kt,en,tn,nn,rn={query:"",results:[],resultsCount:0,queryInProgress:!1,errorMessage:""},on=function(){return function(e,t,n){return t&&Nt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t){var n=t.onProviderChange,o=t.bookreader;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(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.updateMenu=this.updateMenu.bind(this),this.onProviderChange=n,this.bookreader=o,this.icon=(0,r.qy)(Dt||(Dt=Ft(['<ia-icon-search style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon-search>']))),this.label="Search inside",this.menuDetails=this.getMenuDetails(),this.id="search",this.component=this.getComponent(),this.bindEventListeners()}),[{key:"getMenuDetails",value:function(){var e=rn,t=e.resultsCount,n=e.query;if(e.queryInProgress||!n)return r.s6;var o=1===t?"result":"results";return(0,r.qy)(_t||(_t=Ft(["("," ",")"])),t,o)}},{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(){rn={query:"",results:[],resultsCount:0,queryInProgress:!1,errorMessage:""},this.updateMenu({searchCanceled:!0}),this.bookreader.urlPlugin&&this.updateSearchInUrl()}},{key:"onSearchStarted",value:function(e){var t=e.detail.props,n=t.term,r=void 0===n?"":n,o=t.instance;o&&(this.bookreader=o),rn.query=r,rn.results=[],rn.resultsCount=0,rn.queryInProgress=!0,rn.errorMessage="",this.updateMenu()}},{key:"onBookSearchInitiated",value:function(e){var t=e.detail;rn.query=t.query,this.bookreader.search(rn.query)}},{key:"onSearchRequestError",value:function(e){var t,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",i=e.detail.props,a=(void 0===i?{}: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[o])&&void 0!==t?t:l.default;rn.query=(null==s||null===(n=s.searchResults)||void 0===n?void 0:n.q)||"",rn.results=[],rn.resultsCount=0,rn.queryInProgress=!1,rn.errorMessage=(0,r.qy)($t||($t=Ft(['<p class="error">',"</p>"])),c),this.updateMenu()}},{key:"onSearchResultsChange",value:function(e){var t=e.detail.props,n=void 0===t?{}:t,r=n.instance,o=void 0===r?null:r,i=n.results,a=void 0===i?[]:i;o&&(this.bookreader=o);var s=a.matches||[],l=s.length,c=a.q;rn={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;rn={query:"",results:[],resultsCount:0,queryInProgress:!1,errorMessage:""},this.updateMenu({openMenu:!1}),null===(e=this.bookreader)||void 0===e||null===(e=e.searchView)||void 0===e||e.clearSearchFieldAndResults(!1),this.bookreader.urlPlugin&&this.updateSearchInUrl()}},{key:"updateSearchInUrl",value:function(){this.bookreader.urlPlugin&&(this.bookreader.urlPlugin.pullFromAddressBar(),rn.query?this.bookreader.urlPlugin.setUrlParam("q",rn.query):this.bookreader.urlPlugin.removeUrlParam("q"))}},{key:"updateMenu",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.menuDetails=this.getMenuDetails(),this.component=this.getComponent(),this.onProviderChange(this.bookreader,e)}},{key:"getComponent",value:function(){var e=rn,t=e.query,n=e.results,o=e.queryInProgress,i=e.errorMessage;return(0,r.qy)(Ht||(Ht=Ft(["\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,o,!1,this.onSearchResultsClicked,this.onBookSearchInitiated,this.onSearchResultsCleared,this.searchCanceledInMenu)}},{key:"onSearchResultsClicked",value:function(e){var t=e.detail;this.bookreader._searchPluginGoToResult(t.match.matchIndex)}}])}(),an=r.qy`
1589
+ `}render(){return We}}function Ve(e){return Ve="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},Ve(e)}function Ge(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ye(r.key),r)}}function Ye(e){var t=function(e,t){if("object"!=Ve(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ve(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ve(t)?t:t+""}function Je(e,t,n){return t=Qe(t),function(e,t){if(t&&("object"==Ve(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)}(e,Xe()?Reflect.construct(t,n||[],Qe(e).constructor):t.apply(e,n))}function Xe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Xe=function(){return!!e})()}function Qe(e){return Qe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Qe(e)}function Ke(e,t){return Ke=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ke(e,t)}customElements.define("ia-icon-search",Ue),n(2062);var et=function(e){function t(e){var n;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=Je(this,t,[e])).et=ue.s6,e.type!==de.OA.CHILD)throw Error(n.constructor.directiveName+"() can only be used in child bindings");return n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ke(e,t)}(t,e),function(e,t,n){return t&&Ge(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"render",value:function(e){if(e===ue.s6||null==e)return this.ft=void 0,this.et=e;if(e===ue.c0)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.et)return this.ft;this.et=e;var t=[e];return t.raw=t,this.ft={_$litType$:this.constructor.resultType,strings:t,values:[]}}}])}(de.WL);et.directiveName="unsafeHTML",et.resultType=1;var tt,nt,rt,ot,it,at,st,lt,ct,ut,dt,ht,pt,ft,mt,vt,yt,bt,gt,kt,wt,St=(0,de.u$)(et),Ct=(0,r.AH)(tt||(rt=["data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEwIiB2aWV3Qm94PSIwIDAgMTMgMTAiIHdpZHRoPSIxMyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtNC4zMzMzMzMzMyAxMC00LjMzMzMzMzMzLTQuMTY2NjY2NjcgMS43MzMzMzMzMy0xLjY2NjY2NjY2IDIuNiAyLjUgNi45MzMzMzMzNy02LjY2NjY2NjY3IDEuNzMzMzMzMyAxLjY2NjY2NjY3eiIgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIi8+PC9zdmc+"],ot||(ot=rt.slice(0)),tt=Object.freeze(Object.defineProperties(rt,{raw:{value:Object.freeze(ot)}})))),xt=(0,r.AH)(nt||(nt=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=="]))),Ot=(0,r.AH)(it||(it=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 font-family: inherit;\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 jt(e){return jt="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},jt(e)}function Bt(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Et(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Lt(r.key),r)}}function Lt(e){var t=function(e,t){if("object"!=jt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=jt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==jt(t)?t:t+""}function Pt(e,t,n){return t=At(t),function(e,t){if(t&&("object"==jt(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)}(e,Mt()?Reflect.construct(t,n||[],At(e).constructor):t.apply(e,n))}function Mt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Mt=function(){return!!e})()}function At(e){return At=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},At(e)}function It(e,t){return It=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},It(e,t)}var zt,Tt,Dt,_t,$t=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Pt(this,t)).results=[],e.query="",e.queryInProgress=!1,e.renderHeader=!1,e.renderSearchAllFiles=!1,e.displayResultImages=!1,e.errorMessage="",e.bindBookReaderListeners(),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&It(e,t)}(t,e),function(e,t,n){return t&&Et(e.prototype,t),n&&Et(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{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,this.query||this.cancelSearch()}},{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(e){this.dispatchEvent(new CustomEvent("resultSelected",{bubbles:!0,composed:!0,detail:{match:e}})),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,r.qy)(at||(at=Bt(["<p>("," result",")</p>"])),e,e>1?"s":""):r.s6}},{key:"headerSection",get:function(){var e=(0,r.qy)(st||(st=Bt(["<header>\n <h3>Search inside</h3>\n ","\n </header>"])),this.resultsCount);return this.renderHeader?e:r.s6}},{key:"searchMultipleControls",get:function(){var e=(0,r.qy)(lt||(lt=Bt(['\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.s6}},{key:"loadingIndicator",get:function(){return(0,r.qy)(ct||(ct=Bt(['\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,r.qy)(ut||(ut=Bt(['\n <ul class="results ','">\n ',"\n </ul>\n "])),t,this.results.map((function(t){return(0,r.qy)(dt||(dt=Bt(["\n <li @click=",">\n ","\n <h4>",'</h4>\n <p class="page-num">Page ',"</p>\n <p>","</p>\n </li>\n "])),e.selectResult.bind(e,t),t.cover?(0,r.qy)(ht||(ht=Bt(['<img src="','" />'])),t.cover):r.s6,t.title||r.s6,t.displayPageNumber,St(t.html))})))}},{key:"searchForm",get:function(){return(0,r.qy)(pt||(pt=Bt(['\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 @search=","\n .value=","\n />\n </fieldset>\n </form>\n "])),this.performSearch,this.searchMultipleControls,this.setQuery,this.setQuery,this.query)}},{key:"setErrorMessage",get:function(){return(0,r.qy)(ft||(ft=Bt(['\n <p class="error-message">',"</p>\n "])),this.errorMessage)}},{key:"searchCTA",get:function(){return(0,r.qy)(mt||(mt=Bt(['<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,r.qy)(vt||(vt=Bt(["\n ","\n ",'\n <div class="results-container">\n ',"\n ","\n ","\n ","\n </div>\n "])),this.headerSection,this.searchForm,this.queryInProgress?this.loadingIndicator:r.s6,this.errorMessage?this.setErrorMessage:r.s6,this.results.length?this.resultsSet:r.s6,e?this.searchCTA:r.s6)}}],[{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,r.AH)(yt||(yt=Bt(["var(--searchResultText, #adaedc)"]))),t=(0,r.AH)(bt||(bt=Bt(["var(--searchResultBg, #272958)"]))),n=(0,r.AH)(gt||(gt=Bt(["var(--searchResultBorder, #adaedc)"]))),o=(0,r.AH)(kt||(kt=Bt(["(--tertiaryBGColor, #333)"]))),i=(0,r.AH)(wt||(wt=Bt(["\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,Ct,o,xt,xt);return[Ot,i]}}])}(r.WF);function Ht(e){return Ht="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},Ht(e)}function qt(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Rt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ft(r.key),r)}}function Ft(e){var t=function(e,t){if("object"!=Ht(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ht(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ht(t)?t:t+""}customElements.define("ia-book-search-results",$t);var Nt,Zt,Wt,Ut,Vt,Gt,Yt,Jt,Xt,Qt,Kt,en,tn={query:"",results:[],resultsCount:0,queryInProgress:!1,errorMessage:""},nn=function(){return function(e,t,n){return t&&Rt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t){var n=t.onProviderChange,o=t.bookreader;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(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.updateMenu=this.updateMenu.bind(this),this.onProviderChange=n,this.bookreader=o,this.icon=(0,r.qy)(zt||(zt=qt(['<ia-icon-search style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon-search>']))),this.label="Search inside",this.menuDetails=this.getMenuDetails(),this.id="search",this.component=this.getComponent(),this.bindEventListeners()}),[{key:"getMenuDetails",value:function(){var e=tn,t=e.resultsCount,n=e.query;if(e.queryInProgress||!n)return r.s6;var o=1===t?"result":"results";return(0,r.qy)(Tt||(Tt=qt(["("," ",")"])),t,o)}},{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(){tn={query:"",results:[],resultsCount:0,queryInProgress:!1,errorMessage:""},this.updateMenu({searchCanceled:!0}),this.bookreader.urlPlugin&&this.updateSearchInUrl()}},{key:"onSearchStarted",value:function(e){var t=e.detail.props,n=t.term,r=void 0===n?"":n,o=t.instance;o&&(this.bookreader=o),tn.query=r,tn.results=[],tn.resultsCount=0,tn.queryInProgress=!0,tn.errorMessage="",this.updateMenu()}},{key:"onBookSearchInitiated",value:function(e){var t=e.detail;tn.query=t.query,this.bookreader.search(tn.query)}},{key:"onSearchRequestError",value:function(e){var t,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",i=e.detail.props,a=(void 0===i?{}: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[o])&&void 0!==t?t:l.default;tn.query=(null==s||null===(n=s.searchResults)||void 0===n?void 0:n.q)||"",tn.results=[],tn.resultsCount=0,tn.queryInProgress=!1,tn.errorMessage=(0,r.qy)(Dt||(Dt=qt(['<p class="error">',"</p>"])),c),this.updateMenu()}},{key:"onSearchResultsChange",value:function(e){var t=e.detail.props,n=void 0===t?{}:t,r=n.instance,o=void 0===r?null:r,i=n.results,a=void 0===i?[]:i;o&&(this.bookreader=o);var s=a.matches||[],l=s.length,c=a.q;tn={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;tn={query:"",results:[],resultsCount:0,queryInProgress:!1,errorMessage:""},this.updateMenu({openMenu:!1}),null===(e=this.bookreader)||void 0===e||null===(e=e.searchView)||void 0===e||e.clearSearchFieldAndResults(!1),this.bookreader.urlPlugin&&this.updateSearchInUrl()}},{key:"updateSearchInUrl",value:function(){this.bookreader.urlPlugin&&(this.bookreader.urlPlugin.pullFromAddressBar(),tn.query?this.bookreader.urlPlugin.setUrlParam("q",tn.query):this.bookreader.urlPlugin.removeUrlParam("q"))}},{key:"updateMenu",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.menuDetails=this.getMenuDetails(),this.component=this.getComponent(),this.onProviderChange(this.bookreader,e)}},{key:"getComponent",value:function(){var e=tn,t=e.query,n=e.results,o=e.queryInProgress,i=e.errorMessage;return(0,r.qy)(_t||(_t=qt(["\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,o,!1,this.onSearchResultsClicked,this.onBookSearchInitiated,this.onSearchResultsCleared,this.searchCanceledInMenu)}},{key:"onSearchResultsClicked",value:function(e){var t=e.detail;this.bookreader._searchPluginGoToResult(t.match.matchIndex)}}])}(),rn=r.qy`
1590
1590
  <svg
1591
1591
  viewBox="0 0 100 100"
1592
1592
  xmlns="http://www.w3.org/2000/svg"
@@ -1599,7 +1599,7 @@
1599
1599
  <path d="m50 80 33.3333333-43.3333333h-20v-36.6666667h-26.6666666v36.6666667h-20zm50 20v-13.3333333h-100v13.3333333z"/>
1600
1600
  </g>
1601
1601
  </svg>
1602
- `;class sn extends r.WF{static get styles(){return r.AH`
1602
+ `;class on extends r.WF{static get styles(){return r.AH`
1603
1603
  :host {
1604
1604
  width: var(--iconWidth, 'auto');
1605
1605
  height: var(--iconHeight, 'auto');
@@ -1612,7 +1612,7 @@
1612
1612
  .stroke-color {
1613
1613
  stroke: var(--iconStrokeColor);
1614
1614
  }
1615
- `}render(){return an}}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},ln(e)}function cn(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function un(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,dn(r.key),r)}}function dn(e){var t=function(e,t){if("object"!=ln(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=ln(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ln(t)?t:t+""}function hn(e,t,n){return t=fn(t),function(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)}(e,pn()?Reflect.construct(t,n||[],fn(e).constructor):t.apply(e,n))}function pn(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(pn=function(){return!!e})()}function fn(e){return fn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},fn(e)}function mn(e,t){return mn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},mn(e,t)}customElements.define("ia-icon-dl",sn);var vn,yn,bn=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=hn(this,t)).downloads=[],e.expiration=0,e.renderHeader=!1,e.isBookProtected=!1,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&mn(e,t)}(t,e),function(e,t,n){return t&&un(e.prototype,t),n&&un(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"formatsCount",get:function(){var e=this.downloads.length;return e?(0,r.qy)(Wt||(Wt=cn(["<p>"," format","</p>"])),e,e>1?"s":""):(0,r.qy)(Ut||(Ut=cn([""])))}},{key:"loanExpiryMessage",get:function(){return this.expiration?(0,r.qy)(Vt||(Vt=cn(["<h2>These files will expire in "," days.</h2>"])),this.expiration):(0,r.qy)(Gt||(Gt=cn([""])))}},{key:"renderDownloadOptions",value:function(){return this.downloads.map((function(e){return(0,r.qy)(Yt||(Yt=cn(['\n <li>\n <a class="ia-button link primary" href="','">Get ',"</a>\n ","\n </li>\n "])),e.url,e.type,e.note?(0,r.qy)(Jt||(Jt=cn(["<p>","</p>"])),e.note):(0,r.qy)(Xt||(Xt=cn([""]))))}))}},{key:"hasLCPOption",get:function(){var e=/^(LCP)/g;return this.downloads.some((function(t){var n;return null===(n=t.type)||void 0===n?void 0:n.match(e)}))}},{key:"header",get:function(){return this.renderHeader?(0,r.qy)(Qt||(Qt=cn(["\n <header>\n <h3>Downloadable files</h3>\n ","\n </header>\n "])),this.formatsCount):r.s6}},{key:"accessProtectedBook",get:function(){return(0,r.qy)(Kt||(Kt=cn(['\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:"installSimplyEAldikoThoriumMsg",get:function(){return(0,r.qy)(en||(en=cn(['\n <p>For LCP downloads, make sure you have SimplyE or Aldiko Next installed on mobile or Thorium on desktop.</p>\n <ul>\n <li><a href="https://librarysimplified.org/simplye/" rel="noopener noreferrer nofollow" target="_blank">Install SimplyE</a></li>\n <li><a href="https://www.demarque.com/en-aldiko" rel="noopener noreferrer nofollow" target="_blank">Install Aldiko</a></li>\n <li><a href="https://www.edrlab.org/software/thorium-reader/" rel="noopener noreferrer nofollow" target="_blank">Install Thorium</a></li>\n </ul>\n '])))}},{key:"render",value:function(){return(0,r.qy)(tn||(tn=cn(["\n ","\n ","\n <ul>","</ul>\n ","\n "])),this.header,this.loanExpiryMessage,this.renderDownloadOptions(),this.hasLCPOption?this.installSimplyEAldikoThoriumMsg:this.isBookProtected?this.accessProtectedBook:r.s6)}}],[{key:"properties",get:function(){return{downloads:{type:Array},expiration:{type:Number},renderHeader:{type:Boolean},isBookProtected:{type:Boolean}}}},{key:"styles",get:function(){var e=(0,r.AH)(nn||(nn=cn(["\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[Bt,e]}}])}(r.WF);function gn(e){return gn="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},gn(e)}function kn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function wn(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Sn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Cn(r.key),r)}}function Cn(e){var t=function(e,t){if("object"!=gn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=gn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==gn(t)?t:t+""}customElements.define("ia-book-downloads",bn);var xn={pdf:{type:"Encrypted Adobe PDF",url:"#",note:"PDF files contain high quality images of pages."},lcppdf:{type:"Get LCP PDF",url:"#",note:"PDF files contain high quality images of pages."},lcpepub:{type:"Get LCP ePub",url:"#",note:"ePub files are smaller in size, but may contain errors."},epub:{type:"Encrypted Adobe ePub",url:"#",note:"ePub files are smaller in size, but may contain errors."}},On={pdf:"PDF",epub:"ePub",lcppdf:"LCP PDF",lcpepub:"LCP ePub"},jn=function(){return function(e,t,n){return t&&Sn(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t){var n,o=t.bookreader;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.icon=(0,r.qy)(vn||(vn=wn(['<ia-icon-dl style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon-dl>']))),this.label="Downloadable files",this.menuDetails="",this.downloads=[],this.id="downloads",this.component="",this.isBookProtected=(null==o||null===(n=o.options)||void 0===n?void 0:n.isProtected)||!1}),[{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]:[]).reduce((function(t){var n=function(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 r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return kn(e,t);var n={}.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)?kn(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.")}()}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],2),r=n[0],o=void 0===r?"":r,i=n[1],a=void 0===i?"":i,s=o.toLowerCase(),l=xn[s]||null;if(l){var c=e.isBookProtected?xn[s].type:On[s],u=Object.assign({},l,{url:a,type:c});t.push(u)}return t}),[]);this.downloads=t}},{key:"menu",get:function(){return(0,r.qy)(yn||(yn=wn(["<ia-book-downloads .downloads=","></ia-book-downloads>"])),this.downloads)}}])}(),Bn=(n(8598),r.qy`
1615
+ `}render(){return rn}}function an(e){return an="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},an(e)}function sn(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function ln(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,cn(r.key),r)}}function cn(e){var t=function(e,t){if("object"!=an(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=an(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==an(t)?t:t+""}function un(e,t,n){return t=hn(t),function(e,t){if(t&&("object"==an(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)}(e,dn()?Reflect.construct(t,n||[],hn(e).constructor):t.apply(e,n))}function dn(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(dn=function(){return!!e})()}function hn(e){return hn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},hn(e)}function pn(e,t){return pn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},pn(e,t)}customElements.define("ia-icon-dl",on);var fn,mn,vn=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=un(this,t)).downloads=[],e.expiration=0,e.renderHeader=!1,e.isBookProtected=!1,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&pn(e,t)}(t,e),function(e,t,n){return t&&ln(e.prototype,t),n&&ln(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"formatsCount",get:function(){var e=this.downloads.length;return e?(0,r.qy)(Nt||(Nt=sn(["<p>"," format","</p>"])),e,e>1?"s":""):(0,r.qy)(Zt||(Zt=sn([""])))}},{key:"loanExpiryMessage",get:function(){return this.expiration?(0,r.qy)(Wt||(Wt=sn(["<h2>These files will expire in "," days.</h2>"])),this.expiration):(0,r.qy)(Ut||(Ut=sn([""])))}},{key:"renderDownloadOptions",value:function(){return this.downloads.map((function(e){return(0,r.qy)(Vt||(Vt=sn(['\n <li>\n <a class="ia-button link primary" href="','">Get ',"</a>\n ","\n </li>\n "])),e.url,e.type,e.note?(0,r.qy)(Gt||(Gt=sn(["<p>","</p>"])),e.note):(0,r.qy)(Yt||(Yt=sn([""]))))}))}},{key:"hasLCPOption",get:function(){var e=/^(LCP)/g;return this.downloads.some((function(t){var n;return null===(n=t.type)||void 0===n?void 0:n.match(e)}))}},{key:"header",get:function(){return this.renderHeader?(0,r.qy)(Jt||(Jt=sn(["\n <header>\n <h3>Downloadable files</h3>\n ","\n </header>\n "])),this.formatsCount):r.s6}},{key:"accessProtectedBook",get:function(){return(0,r.qy)(Xt||(Xt=sn(['\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:"installSimplyEAldikoThoriumMsg",get:function(){return(0,r.qy)(Qt||(Qt=sn(['\n <p>For LCP downloads, make sure you have SimplyE or Aldiko Next installed on mobile or Thorium on desktop.</p>\n <ul>\n <li><a href="https://librarysimplified.org/simplye/" rel="noopener noreferrer nofollow" target="_blank">Install SimplyE</a></li>\n <li><a href="https://www.demarque.com/en-aldiko" rel="noopener noreferrer nofollow" target="_blank">Install Aldiko</a></li>\n <li><a href="https://thorium.edrlab.org/" rel="noopener noreferrer nofollow" target="_blank">Install Thorium</a></li>\n </ul>\n '])))}},{key:"render",value:function(){return(0,r.qy)(Kt||(Kt=sn(["\n ","\n ","\n <ul>","</ul>\n ","\n "])),this.header,this.loanExpiryMessage,this.renderDownloadOptions(),this.hasLCPOption?this.installSimplyEAldikoThoriumMsg:this.isBookProtected?this.accessProtectedBook:r.s6)}}],[{key:"properties",get:function(){return{downloads:{type:Array},expiration:{type:Number},renderHeader:{type:Boolean},isBookProtected:{type:Boolean}}}},{key:"styles",get:function(){var e=(0,r.AH)(en||(en=sn(["\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[Ot,e]}}])}(r.WF);function yn(e){return yn="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},yn(e)}function bn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function gn(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function kn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,wn(r.key),r)}}function wn(e){var t=function(e,t){if("object"!=yn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=yn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==yn(t)?t:t+""}customElements.define("ia-book-downloads",vn);var Sn={pdf:{type:"Encrypted Adobe PDF",url:"#",note:"PDF files contain high quality images of pages."},lcppdf:{type:"Get LCP PDF",url:"#",note:"PDF files contain high quality images of pages."},lcpepub:{type:"Get LCP ePub",url:"#",note:"ePub files are smaller in size, but may contain errors."},epub:{type:"Encrypted Adobe ePub",url:"#",note:"ePub files are smaller in size, but may contain errors."}},Cn={pdf:"PDF",epub:"ePub",lcppdf:"LCP PDF",lcpepub:"LCP ePub"},xn=function(){return function(e,t,n){return t&&kn(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t){var n,o=t.bookreader;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.icon=(0,r.qy)(fn||(fn=gn(['<ia-icon-dl style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon-dl>']))),this.label="Downloadable files",this.menuDetails="",this.downloads=[],this.id="downloads",this.component="",this.isBookProtected=(null==o||null===(n=o.options)||void 0===n?void 0:n.isProtected)||!1}),[{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]:[]).reduce((function(t){var n=function(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 r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return bn(e,t);var n={}.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)?bn(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.")}()}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],2),r=n[0],o=void 0===r?"":r,i=n[1],a=void 0===i?"":i,s=o.toLowerCase(),l=Sn[s]||null;if(l){var c=e.isBookProtected?Sn[s].type:Cn[s],u=Object.assign({},l,{url:a,type:c});t.push(u)}return t}),[]);this.downloads=t}},{key:"menu",get:function(){return(0,r.qy)(mn||(mn=gn(["<ia-book-downloads .downloads=","></ia-book-downloads>"])),this.downloads)}}])}(),On=(n(8598),r.qy`
1616
1616
  <svg
1617
1617
  viewBox="0 0 24 24"
1618
1618
  xmlns="http://www.w3.org/2000/svg"
@@ -1622,7 +1622,7 @@
1622
1622
  <desc id="visualAdjustmentDescID">A circle with its left hemisphere filled</desc>
1623
1623
  <path class="fill-color" d="m12 0c6.627417 0 12 5.372583 12 12s-5.372583 12-12 12-12-5.372583-12-12 5.372583-12 12-12zm0 2v20l.2664041-.0034797c5.399703-.1412166 9.7335959-4.562751 9.7335959-9.9965203 0-5.5228475-4.4771525-10-10-10z" fill-rule="evenodd" />
1624
1624
  </svg>
1625
- `);class En extends r.WF{static get styles(){return r.AH`
1625
+ `);class jn extends r.WF{static get styles(){return r.AH`
1626
1626
  :host {
1627
1627
  width: var(--iconWidth, 'auto');
1628
1628
  height: var(--iconHeight, 'auto');
@@ -1635,7 +1635,7 @@
1635
1635
  .stroke-color {
1636
1636
  stroke: var(--iconStrokeColor);
1637
1637
  }
1638
- `}render(){return Bn}}customElements.define("ia-icon-visual-adjustment",En);var Ln=r.qy`
1638
+ `}render(){return On}}customElements.define("ia-icon-visual-adjustment",jn);var Bn=r.qy`
1639
1639
  <svg
1640
1640
  viewBox="0 0 100 100"
1641
1641
  xmlns="http://www.w3.org/2000/svg"
@@ -1651,7 +1651,7 @@
1651
1651
  <path d="m2.3239824 87.3815869 25.8938394-23.8143095c-4.5929593-6.6937643-6.889439-14.1059452-6.889439-22.2365428 0-7.1360431 1.7567382-13.7186647 5.2702146-19.7478649 3.5134763-6.0292002 8.2852035-10.8003118 14.3151815-14.31333499 6.029978-3.51302314 12.6134488-5.26953471 19.7504125-5.26953471s13.7204346 1.75651157 19.7504126 5.26953471c6.029978 3.51302319 10.8017051 8.28413479 14.3151815 14.31333499 3.5134763 6.0292002 5.2702145 12.6118218 5.2702145 19.7478649s-1.7567382 13.7324143-5.2702145 19.7891137c-3.5134764 6.0566994-8.2852035 10.8415607-14.3151815 14.3545838-6.029978 3.5130232-12.6134489 5.2695347-19.7504126 5.2695347-8.5762743 0-16.3217363-2.5723212-23.2363861-7.7169637l-26.3063807 24.2302349c-1.27200216 1.1618413-2.76631826 1.742762-4.48294825 1.742762-1.826641 0-3.38971397-.6496687-4.68921892-1.949006s-1.94925743-2.8622087-1.94925743-4.688614c0-1.9364022.7746608-3.5955208 2.3239824-4.9773557zm58.3436469-19.9162976c7.1919692 0 13.3331041-2.5585716 18.4234048-7.6757149s7.635451-11.2712357 7.635451-18.4622772-2.5451503-13.3313843-7.635451-18.4210284-11.2314356-7.6344661-18.4234048-7.6344661-13.3331042 2.544822-18.4234049 7.6344661-7.635451 11.2299869-7.635451 18.4210284 2.5451503 13.3451339 7.635451 18.4622772 11.2314357 7.6757149 18.4234049 7.6757149zm-14.9374313-21.3256316h31.2878163v-9.5422233h-31.2878163z"/>
1652
1652
  </g>
1653
1653
  </svg>
1654
- `;class Pn extends r.WF{static get styles(){return r.AH`
1654
+ `;class En extends r.WF{static get styles(){return r.AH`
1655
1655
  :host {
1656
1656
  width: var(--iconWidth, 'auto');
1657
1657
  height: var(--iconHeight, 'auto');
@@ -1664,7 +1664,7 @@
1664
1664
  .stroke-color {
1665
1665
  stroke: var(--iconStrokeColor);
1666
1666
  }
1667
- `}render(){return Ln}}customElements.define("ia-icon-magnify-minus",Pn);var Mn,An,In,zn,Tn,Dn,_n,$n=r.qy`
1667
+ `}render(){return Bn}}customElements.define("ia-icon-magnify-minus",En);var Ln,Pn,Mn,An,In,zn,Tn,Dn=r.qy`
1668
1668
  <svg
1669
1669
  viewBox="0 0 100 100"
1670
1670
  xmlns="http://www.w3.org/2000/svg"
@@ -1680,7 +1680,7 @@
1680
1680
  <path d="m2.40305276 87.4017263 25.81133064-23.7730295c-4.5356618-6.5723551-6.8034928-14.000283-6.8034928-22.2837838 0-7.1236734 1.7429868-13.6948847 5.2289603-19.7136338 3.4859736-6.0187491 8.2577006-10.7953163 14.3151813-14.32970144 6.0574806-3.53438517 12.6547027-5.30157776 19.7916662-5.30157776 10.8429591 0 20.0964884 3.85236545 27.760588 11.5570964 7.6640996 7.7047309 11.4950036 16.9684802 11.4927136 27.791248 0 10.8799585-3.8309059 20.1574336-11.4927136 27.8324254-7.6618077 7.6749917-16.915337 11.5124876-27.760588 11.5124876-8.6312796 0-16.431747-2.5678624-23.4014021-7.7035871l-26.1413636 24.188234c-1.21699671 1.2147305-2.73881553 1.8220957-4.56545649 1.8220957s-3.3897139-.6485425-4.68921882-1.9456276c-1.29950493-1.297085-1.94925739-2.8572473-1.94925739-4.6804867 0-1.8781426.80216353-3.5343852 2.4064906-4.9687279zm58.34020784-19.878343c7.1369635 0 13.264347-2.5678623 18.3821503-7.7035871 5.1178034-5.1357247 7.676705-11.2928753 7.676705-18.4714518s-2.5589016-13.3082755-7.676705-18.3890972c-5.1178033-5.0808217-11.2451868-7.6212325-18.3821503-7.6212325-7.2469746 0-13.4156121 2.5404108-18.5059127 7.6212325s-7.6354509 11.2105207-7.6354509 18.3890972 2.5589016 13.3357271 7.676705 18.4714518c5.1178033 5.1357248 11.2726895 7.7035871 18.4646586 7.7035871zm-13.3594607-21.8685793h10.206958v10.1879511h7.2194718v-10.1879511h10.206958v-7.206028h-10.206958v-10.187951h-7.2194718v10.187951h-10.206958z"/>
1681
1681
  </g>
1682
1682
  </svg>
1683
- `;class Hn extends r.WF{static get styles(){return r.AH`
1683
+ `;class _n extends r.WF{static get styles(){return r.AH`
1684
1684
  :host {
1685
1685
  width: var(--iconWidth, 'auto');
1686
1686
  height: var(--iconHeight, 'auto');
@@ -1693,9 +1693,9 @@
1693
1693
  .stroke-color {
1694
1694
  stroke: var(--iconStrokeColor);
1695
1695
  }
1696
- `}render(){return $n}}function qn(e){return qn="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},qn(e)}function Rn(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Fn(e){return function(e){if(Array.isArray(e))return Nn(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 Nn(e,t);var n={}.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)||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 Nn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Zn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Wn(r.key),r)}}function Wn(e){var t=function(e,t){if("object"!=qn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=qn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==qn(t)?t:t+""}function Un(e,t,n){return t=Gn(t),function(e,t){if(t&&("object"==qn(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)}(e,Vn()?Reflect.construct(t,n||[],Gn(e).constructor):t.apply(e,n))}function Vn(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Vn=function(){return!!e})()}function Gn(e){return Gn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Gn(e)}function Yn(e,t){return Yn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Yn(e,t)}customElements.define("ia-icon-magnify-plus",Hn);var Jn,Xn,Qn=function(e){return"visualAdjustment".concat(e)},Kn={optionChange:Qn("OptionChanged"),zoomIn:Qn("ZoomIn"),zoomOut:Qn("ZoomOut")},er=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Un(this,t)).activeCount=0,e.options=[],e.renderHeader=!1,e.showZoomControls=!0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Yn(e,t)}(t,e),function(e,t,n){return t&&Zn(e.prototype,t),n&&Zn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{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(Fn(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(Kn.optionChange,{bubbles:!0,composed:!0,detail:t}))}},{key:"emitZoomIn",value:function(){this.dispatchEvent(new CustomEvent(Kn.zoomIn))}},{key:"emitZoomOut",value:function(){this.dispatchEvent(new CustomEvent(Kn.zoomOut))}},{key:"changeActiveStateFor",value:function(e){var t=Fn(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=Fn(this.options);n.find((function(t){return t.id===e})).value=t,this.options=Fn(n)}},{key:"rangeSlider",value:function(e){var t=this;return(0,r.qy)(Mn||(Mn=Rn(["\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,r.qy)(An||(An=Rn(['<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.s6)}},{key:"headerSection",get:function(){var e=this.activeCount?(0,r.qy)(In||(In=Rn(["<p>("," active)</p>"])),this.activeCount):r.s6,t=(0,r.qy)(zn||(zn=Rn(["<header>\n <h3>Visual adjustments</h3>\n ","\n </header>"])),e);return this.renderHeader?t:r.s6}},{key:"zoomControls",get:function(){return(0,r.qy)(Tn||(Tn=Rn(['\n <h4>Adjust 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,r.qy)(Dn||(Dn=Rn(["\n ","\n <ul>\n ","\n </ul>\n ","\n "])),this.headerSection,Pe(this.options,(function(e){return e.id}),this.adjustmentCheckbox.bind(this)),this.showZoomControls?this.zoomControls:r.s6)}}],[{key:"properties",get:function(){return{activeCount:{type:Number},options:{type:Array},renderHeader:{type:Boolean},showZoomControls:{type:Boolean}}}},{key:"styles",get:function(){return(0,r.AH)(_n||(_n=Rn(['\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 }"])),Ot)}}])}(r.WF);function tr(e){return tr="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},tr(e)}function nr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function rr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function or(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ir(r.key),r)}}function ir(e){var t=function(e,t){if("object"!=tr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=tr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==tr(t)?t:t+""}customElements.define("ia-book-visual-adjustments",er);var ar,sr,lr=[{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:"Invert colors (dark mode)",active:!1},{id:"grayscale",name:"Convert to grayscale",active:!1}],cr=function(){return function(e,t,n){return t&&or(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}((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.onProviderChange,o=t.bookreader;this.onProviderChange=n,this.bookContainer=o.refs.$brContainer,this.bookreader=o,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,r.qy)(Jn||(Jn=rr(['<ia-icon-visual-adjustment style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon-visual-adjustment>']))),this.label="Visual Adjustments",this.menuDetails=this.updateOptionsCount(),this.id="adjustment",this.component=(0,r.qy)(Xn||(Xn=rr(["\n <ia-book-visual-adjustments\n .options=","\n @visualAdjustmentOptionChanged=","\n @visualAdjustmentZoomIn=","\n @visualAdjustmentZoomOut=","\n ></ia-book-visual-adjustments>\n "])),lr,this.onAdjustmentChange,this.onZoomIn,this.onZoomOut)}),[{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%)"}},r=t.options.reduce((function(e,t){var r="".concat(t.active?n[t.id](t.value):"");return r?[].concat(function(e){return function(e){if(Array.isArray(e))return nr(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 nr(e,t);var n={}.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)?nr(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.")}()}(e),[r]):e}),[]).join(" ");this.bookContainer.css("filter",r),this.optionUpdateComplete(e)}},{key:"optionUpdateComplete",value:function(e){this.activeCount=e.detail.activeCount,this.updateOptionsCount(e),this.onProviderChange()}},{key:"updateOptionsCount",value:function(){this.menuDetails="(".concat(this.activeCount," active)")}}])}();function ur(e){return ur="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},ur(e)}function dr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function hr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,pr(r.key),r)}}function pr(e){var t=function(e,t){if("object"!=ur(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=ur(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ur(t)?t:t+""}function fr(e,t,n){return t=vr(t),function(e,t){if(t&&("object"==ur(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)}(e,mr()?Reflect.construct(t,n||[],vr(e).constructor):t.apply(e,n))}function mr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(mr=function(){return!!e})()}function vr(e){return vr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},vr(e)}function yr(e,t){return yr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},yr(e,t)}var br,gr,kr=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),fr(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&yr(e,t)}(t,e),function(e,t,n){return t&&hr(e.prototype,t),n&&hr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"render",value:function(){var e=this;return(0,r.qy)(ar||(ar=dr(['\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()}))}}],[{key:"styles",get:function(){return(0,r.AH)(sr||(sr=dr(['\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}}}}])}(r.WF);function wr(e){return wr="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},wr(e)}function Sr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Cr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,xr(r.key),r)}}function xr(e){var t=function(e,t){if("object"!=wr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=wr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==wr(t)?t:t+""}function Or(e,t,n){return t=Br(t),function(e,t){if(t&&("object"==wr(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)}(e,jr()?Reflect.construct(t,n||[],Br(e).constructor):t.apply(e,n))}function jr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(jr=function(){return!!e})()}function Br(e){return Br=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Br(e)}function Er(e,t){return Er=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Er(e,t)}customElements.define("delete-modal-actions",kr);var Lr,Pr=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Or(this,t)).state="hollow",e.side=void 0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Er(e,t)}(t,e),function(e,t,n){return t&&Cr(e.prototype,t),n&&Cr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{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,r.qy)(br||(br=Sr(["\n <button title="," @click="," class=",">\n <icon-bookmark state=","></icon-bookmark>\n </button>\n "])),this.title,this.handleClick,e,this.state)}}],[{key:"styles",get:function(){return(0,r.AH)(gr||(gr=Sr(["\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(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 0 16 24' width='16'%3E%3Cg fill='%23333' fill-rule='evenodd'%3E%3Cpath 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'/%3E%3Cpath d='m8.75 6v2.25h2.25v1.5h-2.25v2.25h-1.5v-2.25h-2.25v-1.5h2.25v-2.25z' fill-rule='nonzero'/%3E%3C/g%3E%3C/svg%3E\"), 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}}}}])}(r.WF);function Mr(e){return Mr="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},Mr(e)}function Ar(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ir(r.key),r)}}function Ir(e){var t=function(e,t){if("object"!=Mr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Mr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Mr(t)?t:t+""}function zr(e,t,n){return t=Dr(t),function(e,t){if(t&&("object"==Mr(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)}(e,Tr()?Reflect.construct(t,n||[],Dr(e).constructor):t.apply(e,n))}function Tr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Tr=function(){return!!e})()}function Dr(e){return Dr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Dr(e)}function _r(e,t){return _r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_r(e,t)}customElements.define("bookmark-button",Pr),n(6412),n(8125),n(4423),n(4490),n(739),n(8940),n(4731),n(479),n(3362),n(1699),n(5440);var $r,Hr,qr,Rr,Fr,Nr,Zr,Wr,Ur,Vr=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=zr(this,t)).url="https://archive.org/account/login",e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_r(e,t)}(t,e),function(e,t,n){return t&&Ar(e.prototype,t),n&&Ar(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"render",value:function(){return(0,r.qy)(Lr||(Lr=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)}}],[{key:"properties",get:function(){return{url:{type:String}}}},{key:"styles",get:function(){return Bt}}])}(r.WF);function Gr(e){return Gr="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},Gr(e)}function Yr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Jr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Xr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jr(Object(n),!0).forEach((function(t){Qr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Qr(e,t,n){return(t=ro(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kr(){Kr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var i=t&&t.prototype instanceof y?t:y,a=Object.create(i.prototype),s=new P(r||[]);return o(a,"_invoke",{value:j(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var h="suspendedStart",p="suspendedYield",f="executing",m="completed",v={};function y(){}function b(){}function g(){}var k={};c(k,a,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(M([])));S&&S!==n&&r.call(S,a)&&(k=S);var C=g.prototype=y.prototype=Object.create(k);function x(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,i,a,s){var l=d(e[o],e,i);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==Gr(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return i=i?i.then(o,o):o()}})}function j(t,n,r){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var l=B(s,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=f;var c=d(t,n,r);if("normal"===c.type){if(o=r.done?m:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=m,r.method="throw",r.arg=c.arg)}}}function B(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,B(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=d(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(Gr(t)+" is not iterable")}return b.prototype=g,o(C,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:b,configurable:!0}),b.displayName=c(g,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,c(e,l,"GeneratorFunction")),e.prototype=Object.create(C),e},t.awrap=function(e){return{__await:e}},x(O.prototype),c(O.prototype,s,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new O(u(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(C),c(C,l,"Generator"),c(C,a,(function(){return this})),c(C,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return s.type="throw",s.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function eo(e,t,n,r,o,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(r,o)}function to(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){eo(i,r,o,a,s,"next",e)}function s(e){eo(i,r,o,a,s,"throw",e)}a(void 0)}))}}function no(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ro(r.key),r)}}function ro(e){var t=function(e,t){if("object"!=Gr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Gr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Gr(t)?t:t+""}function oo(e,t,n){return t=ao(t),function(e,t){if(t&&("object"==Gr(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)}(e,io()?Reflect.construct(t,n||[],ao(e).constructor):t.apply(e,n))}function io(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(io=function(){return!!e})()}function ao(e){return ao=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ao(e)}function so(e,t){return so=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},so(e,t)}customElements.define("bookmarks-login",Vr);var lo,co={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})})}},uo=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=oo(this,t)).bookmarks=[],e.bookreader={},e.editedBookmark={},e.modal=void 0,e.loginOptions={loginClicked:function(){},loginUrl:""},e.displayMode="bookmarks",e.bookmarkColors=[{id:0,className:"red"},{id:1,className:"blue"},{id:2,className:"green"}],e.defaultColor=e.bookmarkColors[0],e.api=co,e.deleteModalConfig=new _e({title:"Delete Bookmark",headline:"This bookmark contains a note. Deleting it will permanently delete the note. Are you sure?",headerColor:"#194880"}),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&so(e,t)}(t,e),function(e,t,n){return t&&no(e.prototype,t),n&&no(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"updated",value:function(e){e.has("displayMode")&&this.updateDisplay(),this.emitBookmarksChanged()}},{key:"setup",value:function(){this.api.identifier=this.getIdentifier(),"login"!==this.displayMode&&(this.fetchUserBookmarks(),this.setBREventListeners())}},{key:"getIdentifier",value:function(){return this.bookreader.bookId!==this.bookreader.subPrefix?"".concat(this.bookreader.bookId,"/").concat(this.bookreader.subPrefix):this.bookreader.bookId}},{key:"updateDisplay",value:function(){"bookmarks"===this.displayMode&&this.fetchUserBookmarks()}},{key:"fetchUserBookmarks",value:(o=to(Kr().mark((function e(){return Kr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.api.identifier){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.fetchBookmarks();case 4:this.initializeBookmarks();case 5:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"setBREventListeners",value:function(){var e=this;["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.renderBookmarkButtons()}))}))}},{key:"initializeBookmarks",value:function(){this.renderBookmarkButtons(),this.markActiveBookmark(!0),this.emitBookmarksChanged()}},{key:"formatBookmark",value:function(e){var n=e.leafNum,r=void 0===n?"":n,o=e.notes,i=void 0===o?{}:o,a=i.note,s=void 0===a?"":a,l=i.color,c={note:s,color:this.getBookmarkColor(l)?l:this.defaultColor.id},u=t.formatPage(this.bookreader.book.getPageNum(r)),d=this.bookreader.book.getPageURI("".concat(r).replace(/\D/g,""),32);return Xr(Xr({},c),{},{id:r,leafNum:r,page:u,thumbnail:d})}},{key:"fetchBookmarks",value:(n=to(Kr().mark((function e(){var t,n,r,o,i,a,s,l,c,u,d=this;return Kr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.api.getAll().then((function(e){return e.text()}));case 2:t=e.sent;try{n=JSON.parse(t)}catch(e){n={error:e.message}}return o=(r=n).success,i=r.error,a=void 0===i?"Something happened while fetching bookmarks.":i,s=r.value,l=void 0===s?[]:s,o||null===(c=console)||void 0===c||c.warn("Error fetching bookmarks",a),u={},Object.keys(l).forEach((function(e){var t=l[e],n=parseInt(e,10),r=d.formatBookmark(Xr(Xr({},t),{},{leafNum:n}));u[e]=r})),this.bookmarks=u,e.abrupt("return",u);case 10:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{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 o=+t.classList.value.match(/pagediv\d+/)[0].replace(/\D/g,""),i=e.getBookmark(o),a=i?"filled":"hollow";if(e.bookreader.book.getPage(o).isViewable){var s=document.createElement("div");["mousedown","mouseup"].forEach((function(e){s.addEventListener(e,(function(e){return e.stopPropagation()}))})),s.classList.add("bookmark-button",a),i&&s.classList.add(e.getBookmarkColor(i.color));var l="L"===t.getAttribute("data-side")&&e.bookreader.mode===e.bookreader.constMode2up?"left":"right";(0,r.XX)((0,r.qy)($r||($r=Yr(["\n <bookmark-button\n @bookmarkButtonClicked=","\n state=","\n side=","\n ></bookmark-button>"])),(function(){return e.bookmarkButtonClicked(o)}),a,l),s),t.appendChild(s)}}))}},{key:"markActiveBookmark",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.bookreader,n=t.mode,r=t.constMode2up,o=t.constModeThumb,i=this.bookreader.currentIndex();if(n!==o){if(n===r&&this.bookreader.displayedIndices.includes(+this.activeBookmarkID))return;this.bookmarks[i]?this.activeBookmarkID=i:this.activeBookmarkID=""}else{var a=this.bookmarks[i];e&&a&&(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.book.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.displayDeletionModal(e):this.deleteBookmark({detail:{id:"".concat(e)}})}},{key:"displayDeletionModal",value:function(e){var t=this,n=(0,r.qy)(Hr||(Hr=Yr(["\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.modal.closeModal()}),e);this.modal.showModal({config:this.deleteModalConfig,customModalContent:n})}},{key:"deleteBookmark",value:function(e){var t=e.detail,n=t.id,r=this.bookmarks;delete r[n],this.bookmarks=Xr({},r),this.api.delete(t.id),this.editedBookmark={},this.modal.closeModal(),this.renderBookmarkButtons()}},{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,r.qy)(qr||(qr=Yr(['\n <button\n class="ia-button primary"\n tabindex="-1"\n ?disabled=',"\n @click=",">\n Add bookmark\n </button>\n "])),this.shouldEnableAddBookmarkButton,this.addBookmark)}},{key:"bookmarksList",get:function(){return(0,r.qy)(Rr||(Rr=Yr(["\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,Xr({},this.bookmarks),this.activeBookmarkID,this.bookmarkColors,this.defaultColor)}},{key:"bookmarkHelperMessage",get:function(){return(0,r.qy)(Fr||(Fr=Yr(["<p>Please use 1up or 2up view modes to add bookmark.</p>"])))}},{key:"render",value:function(){var e=this,t=(0,r.qy)(Nr||(Nr=Yr(["\n ","\n ","\n "])),this.bookmarksList,this.allowAddingBookmark?this.addBookmarkButton:this.bookmarkHelperMessage);return(0,r.qy)(Zr||(Zr=Yr(['\n <section class="bookmarks">\n ',"\n </section>\n "])),"login"===this.displayMode?(0,r.qy)(Wr||(Wr=Yr(["<bookmarks-login\n @click=","\n .url=","></bookmarks-login>"])),(function(){return e.loginOptions.loginClicked()}),this.loginOptions.loginUrl):t)}}],[{key:"properties",get:function(){return{activeBookmarkID:{type:String},bookmarks:{type:Array},bookreader:{type:Object},displayMode:{type:String},editedBookmark:{type:Object},deleteModalConfig:{type:Object},modal:{attribute:!1},loginOptions:{type:Object,attribute:!1}}}},{key:"styles",get:function(){var e=(0,r.AH)(Ur||(Ur=Yr(["\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[Bt,e]}},{key:"formatPage",value:function(e){return isNaN(+e)?"(".concat(e.replace(/\D/g,""),")"):e}}]);var n,o}(r.WF);customElements.define("ia-bookmarks",uo);var ho,po,fo,mo,vo,yo=(0,r.AH)(lo||(lo=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 bo(e){return bo="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},bo(e)}function go(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function ko(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,wo(r.key),r)}}function wo(e){var t=function(e,t){if("object"!=bo(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=bo(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==bo(t)?t:t+""}function So(e,t,n){return t=xo(t),function(e,t){if(t&&("object"==bo(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)}(e,Co()?Reflect.construct(t,n||[],xo(e).constructor):t.apply(e,n))}function Co(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Co=function(){return!!e})()}function xo(e){return xo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},xo(e)}function Oo(e,t){return Oo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Oo(e,t)}var jo=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=So(this,t)).bookmark={},e.bookmarkColors=[],e.renderHeader=!1,e.showBookmark=!0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Oo(e,t)}(t,e),function(e,t,n){return t&&ko(e.prototype,t),n&&ko(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{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,r.qy)(ho||(ho=go(['\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,r.qy)(po||(po=go(['\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,r.qy)(fo||(fo=go(["\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?t.headerSection:r.s6,this.showBookmark?this.bookmarkTemplate:r.s6,this.emitSaveEvent,this.updateNote,this.bookmark.note,Pe(this.bookmarkColors,(function(e){return e.id}),this.bookmarkColor.bind(this)),this.emitDeleteEvent)}}],[{key:"properties",get:function(){return{bookmark:{type:Object},bookmarkColors:{type:Array},renderHeader:{type:Boolean},showBookmark:{type:Boolean}}}},{key:"headerSection",get:function(){return(0,r.qy)(mo||(mo=go(["<header>\n <h3>Edit Bookmark</h3>\n </header>"])))}},{key:"styles",get:function(){var e=(0,r.AH)(vo||(vo=go(['\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[Bt,yo,e]}}])}(r.WF);customElements.define("ia-bookmark-edit",jo),n(6910);var Bo,Eo,Lo,Po,Mo,Ao,Io,zo,To=r.qy`
1696
+ `}render(){return Dn}}function $n(e){return $n="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},$n(e)}function Hn(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function qn(e){return function(e){if(Array.isArray(e))return Rn(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 Rn(e,t);var n={}.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)?Rn(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 Rn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Fn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Nn(r.key),r)}}function Nn(e){var t=function(e,t){if("object"!=$n(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=$n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==$n(t)?t:t+""}function Zn(e,t,n){return t=Un(t),function(e,t){if(t&&("object"==$n(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)}(e,Wn()?Reflect.construct(t,n||[],Un(e).constructor):t.apply(e,n))}function Wn(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Wn=function(){return!!e})()}function Un(e){return Un=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Un(e)}function Vn(e,t){return Vn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Vn(e,t)}customElements.define("ia-icon-magnify-plus",_n);var Gn,Yn,Jn=function(e){return"visualAdjustment".concat(e)},Xn={optionChange:Jn("OptionChanged"),zoomIn:Jn("ZoomIn"),zoomOut:Jn("ZoomOut")},Qn=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Zn(this,t)).activeCount=0,e.options=[],e.renderHeader=!1,e.showZoomControls=!0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Vn(e,t)}(t,e),function(e,t,n){return t&&Fn(e.prototype,t),n&&Fn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{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(qn(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(Xn.optionChange,{bubbles:!0,composed:!0,detail:t}))}},{key:"emitZoomIn",value:function(){this.dispatchEvent(new CustomEvent(Xn.zoomIn))}},{key:"emitZoomOut",value:function(){this.dispatchEvent(new CustomEvent(Xn.zoomOut))}},{key:"changeActiveStateFor",value:function(e){var t=qn(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=qn(this.options);n.find((function(t){return t.id===e})).value=t,this.options=qn(n)}},{key:"rangeSlider",value:function(e){var t=this;return(0,r.qy)(Ln||(Ln=Hn(["\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,r.qy)(Pn||(Pn=Hn(['<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.s6)}},{key:"headerSection",get:function(){var e=this.activeCount?(0,r.qy)(Mn||(Mn=Hn(["<p>("," active)</p>"])),this.activeCount):r.s6,t=(0,r.qy)(An||(An=Hn(["<header>\n <h3>Visual adjustments</h3>\n ","\n </header>"])),e);return this.renderHeader?t:r.s6}},{key:"zoomControls",get:function(){return(0,r.qy)(In||(In=Hn(['\n <h4>Adjust 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,r.qy)(zn||(zn=Hn(["\n ","\n <ul>\n ","\n </ul>\n ","\n "])),this.headerSection,Le(this.options,(function(e){return e.id}),this.adjustmentCheckbox.bind(this)),this.showZoomControls?this.zoomControls:r.s6)}}],[{key:"properties",get:function(){return{activeCount:{type:Number},options:{type:Array},renderHeader:{type:Boolean},showZoomControls:{type:Boolean}}}},{key:"styles",get:function(){return(0,r.AH)(Tn||(Tn=Hn(['\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 }"])),Ct)}}])}(r.WF);function Kn(e){return Kn="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},Kn(e)}function er(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function tr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function nr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,rr(r.key),r)}}function rr(e){var t=function(e,t){if("object"!=Kn(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Kn(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Kn(t)?t:t+""}customElements.define("ia-book-visual-adjustments",Qn);var or,ir,ar=[{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:"Invert colors (dark mode)",active:!1},{id:"grayscale",name:"Convert to grayscale",active:!1}],sr=function(){return function(e,t,n){return t&&nr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}((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.onProviderChange,o=t.bookreader;this.onProviderChange=n,this.bookContainer=o.refs.$brContainer,this.bookreader=o,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,r.qy)(Gn||(Gn=tr(['<ia-icon-visual-adjustment style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon-visual-adjustment>']))),this.label="Visual Adjustments",this.menuDetails=this.updateOptionsCount(),this.id="adjustment",this.component=(0,r.qy)(Yn||(Yn=tr(["\n <ia-book-visual-adjustments\n .options=","\n @visualAdjustmentOptionChanged=","\n @visualAdjustmentZoomIn=","\n @visualAdjustmentZoomOut=","\n ></ia-book-visual-adjustments>\n "])),ar,this.onAdjustmentChange,this.onZoomIn,this.onZoomOut)}),[{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%)"}},r=t.options.reduce((function(e,t){var r="".concat(t.active?n[t.id](t.value):"");return r?[].concat(function(e){return function(e){if(Array.isArray(e))return er(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 er(e,t);var n={}.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)?er(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.")}()}(e),[r]):e}),[]).join(" ");this.bookContainer.css("filter",r),this.optionUpdateComplete(e)}},{key:"optionUpdateComplete",value:function(e){this.activeCount=e.detail.activeCount,this.updateOptionsCount(e),this.onProviderChange()}},{key:"updateOptionsCount",value:function(){this.menuDetails="(".concat(this.activeCount," active)")}}])}();function lr(e){return lr="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},lr(e)}function cr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function ur(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,dr(r.key),r)}}function dr(e){var t=function(e,t){if("object"!=lr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=lr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==lr(t)?t:t+""}function hr(e,t,n){return t=fr(t),function(e,t){if(t&&("object"==lr(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)}(e,pr()?Reflect.construct(t,n||[],fr(e).constructor):t.apply(e,n))}function pr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(pr=function(){return!!e})()}function fr(e){return fr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},fr(e)}function mr(e,t){return mr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},mr(e,t)}var vr,yr,br=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),hr(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&mr(e,t)}(t,e),function(e,t,n){return t&&ur(e.prototype,t),n&&ur(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"render",value:function(){var e=this;return(0,r.qy)(or||(or=cr(['\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()}))}}],[{key:"styles",get:function(){return(0,r.AH)(ir||(ir=cr(['\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}}}}])}(r.WF);function gr(e){return gr="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},gr(e)}function kr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function wr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Sr(r.key),r)}}function Sr(e){var t=function(e,t){if("object"!=gr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=gr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==gr(t)?t:t+""}function Cr(e,t,n){return t=Or(t),function(e,t){if(t&&("object"==gr(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)}(e,xr()?Reflect.construct(t,n||[],Or(e).constructor):t.apply(e,n))}function xr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(xr=function(){return!!e})()}function Or(e){return Or=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Or(e)}function jr(e,t){return jr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},jr(e,t)}customElements.define("delete-modal-actions",br);var Br,Er=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Cr(this,t)).state="hollow",e.side=void 0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&jr(e,t)}(t,e),function(e,t,n){return t&&wr(e.prototype,t),n&&wr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{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,r.qy)(vr||(vr=kr(["\n <button title="," @click="," class=",">\n <icon-bookmark state=","></icon-bookmark>\n </button>\n "])),this.title,this.handleClick,e,this.state)}}],[{key:"styles",get:function(){return(0,r.AH)(yr||(yr=kr(["\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(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 0 16 24' width='16'%3E%3Cg fill='%23333' fill-rule='evenodd'%3E%3Cpath 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'/%3E%3Cpath d='m8.75 6v2.25h2.25v1.5h-2.25v2.25h-1.5v-2.25h-2.25v-1.5h2.25v-2.25z' fill-rule='nonzero'/%3E%3C/g%3E%3C/svg%3E\"), 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}}}}])}(r.WF);function Lr(e){return Lr="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},Lr(e)}function Pr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Mr(r.key),r)}}function Mr(e){var t=function(e,t){if("object"!=Lr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Lr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Lr(t)?t:t+""}function Ar(e,t,n){return t=zr(t),function(e,t){if(t&&("object"==Lr(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)}(e,Ir()?Reflect.construct(t,n||[],zr(e).constructor):t.apply(e,n))}function Ir(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ir=function(){return!!e})()}function zr(e){return zr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},zr(e)}function Tr(e,t){return Tr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Tr(e,t)}customElements.define("bookmark-button",Er),n(6412),n(8125),n(4423),n(4490),n(739),n(8940),n(4731),n(479),n(3362),n(1699),n(5440);var Dr,_r,$r,Hr,qr,Rr,Fr,Nr,Zr,Wr=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Ar(this,t)).url="https://archive.org/account/login",e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Tr(e,t)}(t,e),function(e,t,n){return t&&Pr(e.prototype,t),n&&Pr(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"render",value:function(){return(0,r.qy)(Br||(Br=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)}}],[{key:"properties",get:function(){return{url:{type:String}}}},{key:"styles",get:function(){return Ot}}])}(r.WF);function Ur(e){return Ur="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},Ur(e)}function Vr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Gr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Yr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Gr(Object(n),!0).forEach((function(t){Jr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Jr(e,t,n){return(t=to(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xr(){Xr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var i=t&&t.prototype instanceof y?t:y,a=Object.create(i.prototype),s=new P(r||[]);return o(a,"_invoke",{value:j(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var h="suspendedStart",p="suspendedYield",f="executing",m="completed",v={};function y(){}function b(){}function g(){}var k={};c(k,a,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(M([])));S&&S!==n&&r.call(S,a)&&(k=S);var C=g.prototype=y.prototype=Object.create(k);function x(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,i,a,s){var l=d(e[o],e,i);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==Ur(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return i=i?i.then(o,o):o()}})}function j(t,n,r){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var l=B(s,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=f;var c=d(t,n,r);if("normal"===c.type){if(o=r.done?m:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=m,r.method="throw",r.arg=c.arg)}}}function B(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,B(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=d(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(Ur(t)+" is not iterable")}return b.prototype=g,o(C,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:b,configurable:!0}),b.displayName=c(g,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,c(e,l,"GeneratorFunction")),e.prototype=Object.create(C),e},t.awrap=function(e){return{__await:e}},x(O.prototype),c(O.prototype,s,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new O(u(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(C),c(C,l,"Generator"),c(C,a,(function(){return this})),c(C,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return s.type="throw",s.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function Qr(e,t,n,r,o,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(r,o)}function Kr(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){Qr(i,r,o,a,s,"next",e)}function s(e){Qr(i,r,o,a,s,"throw",e)}a(void 0)}))}}function eo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,to(r.key),r)}}function to(e){var t=function(e,t){if("object"!=Ur(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ur(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ur(t)?t:t+""}function no(e,t,n){return t=oo(t),function(e,t){if(t&&("object"==Ur(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)}(e,ro()?Reflect.construct(t,n||[],oo(e).constructor):t.apply(e,n))}function ro(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ro=function(){return!!e})()}function oo(e){return oo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},oo(e)}function io(e,t){return io=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},io(e,t)}customElements.define("bookmarks-login",Wr);var ao,so={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})})}},lo=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=no(this,t)).bookmarks=[],e.bookreader={},e.editedBookmark={},e.modal=void 0,e.loginOptions={loginClicked:function(){},loginUrl:""},e.displayMode="bookmarks",e.bookmarkColors=[{id:0,className:"red"},{id:1,className:"blue"},{id:2,className:"green"}],e.defaultColor=e.bookmarkColors[0],e.api=so,e.deleteModalConfig=new De({title:"Delete Bookmark",headline:"This bookmark contains a note. Deleting it will permanently delete the note. Are you sure?",headerColor:"#194880"}),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&io(e,t)}(t,e),function(e,t,n){return t&&eo(e.prototype,t),n&&eo(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"updated",value:function(e){e.has("displayMode")&&this.updateDisplay(),this.emitBookmarksChanged()}},{key:"setup",value:function(){this.api.identifier=this.getIdentifier(),"login"!==this.displayMode&&(this.fetchUserBookmarks(),this.setBREventListeners())}},{key:"getIdentifier",value:function(){return this.bookreader.bookId!==this.bookreader.subPrefix?"".concat(this.bookreader.bookId,"/").concat(this.bookreader.subPrefix):this.bookreader.bookId}},{key:"updateDisplay",value:function(){"bookmarks"===this.displayMode&&this.fetchUserBookmarks()}},{key:"fetchUserBookmarks",value:(o=Kr(Xr().mark((function e(){return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.api.identifier){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.fetchBookmarks();case 4:this.initializeBookmarks();case 5:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"setBREventListeners",value:function(){var e=this;["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.renderBookmarkButtons()}))}))}},{key:"initializeBookmarks",value:function(){this.renderBookmarkButtons(),this.markActiveBookmark(!0),this.emitBookmarksChanged()}},{key:"formatBookmark",value:function(e){var n=e.leafNum,r=void 0===n?"":n,o=e.notes,i=void 0===o?{}:o,a=i.note,s=void 0===a?"":a,l=i.color,c={note:s,color:this.getBookmarkColor(l)?l:this.defaultColor.id},u=t.formatPage(this.bookreader.book.getPageNum(r)),d=this.bookreader.book.getPageURI("".concat(r).replace(/\D/g,""),32);return Yr(Yr({},c),{},{id:r,leafNum:r,page:u,thumbnail:d})}},{key:"fetchBookmarks",value:(n=Kr(Xr().mark((function e(){var t,n,r,o,i,a,s,l,c,u,d=this;return Xr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.api.getAll().then((function(e){return e.text()}));case 2:t=e.sent;try{n=JSON.parse(t)}catch(e){n={error:e.message}}return o=(r=n).success,i=r.error,a=void 0===i?"Something happened while fetching bookmarks.":i,s=r.value,l=void 0===s?[]:s,o||null===(c=console)||void 0===c||c.warn("Error fetching bookmarks",a),u={},Object.keys(l).forEach((function(e){var t=l[e],n=parseInt(e,10),r=d.formatBookmark(Yr(Yr({},t),{},{leafNum:n}));u[e]=r})),this.bookmarks=u,e.abrupt("return",u);case 10:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{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 o=+t.classList.value.match(/pagediv\d+/)[0].replace(/\D/g,""),i=e.getBookmark(o),a=i?"filled":"hollow";if(e.bookreader.book.getPage(o).isViewable){var s=document.createElement("div");["mousedown","mouseup"].forEach((function(e){s.addEventListener(e,(function(e){return e.stopPropagation()}))})),s.classList.add("bookmark-button",a),i&&s.classList.add(e.getBookmarkColor(i.color));var l="L"===t.getAttribute("data-side")&&e.bookreader.mode===e.bookreader.constMode2up?"left":"right";(0,r.XX)((0,r.qy)(Dr||(Dr=Vr(["\n <bookmark-button\n @bookmarkButtonClicked=","\n state=","\n side=","\n ></bookmark-button>"])),(function(){return e.bookmarkButtonClicked(o)}),a,l),s),t.appendChild(s)}}))}},{key:"markActiveBookmark",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.bookreader,n=t.mode,r=t.constMode2up,o=t.constModeThumb,i=this.bookreader.currentIndex();if(n!==o){if(n===r&&this.bookreader.displayedIndices.includes(+this.activeBookmarkID))return;this.bookmarks[i]?this.activeBookmarkID=i:this.activeBookmarkID=""}else{var a=this.bookmarks[i];e&&a&&(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.book.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.displayDeletionModal(e):this.deleteBookmark({detail:{id:"".concat(e)}})}},{key:"displayDeletionModal",value:function(e){var t=this,n=(0,r.qy)(_r||(_r=Vr(["\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.modal.closeModal()}),e);this.modal.showModal({config:this.deleteModalConfig,customModalContent:n})}},{key:"deleteBookmark",value:function(e){var t=e.detail,n=t.id,r=this.bookmarks;delete r[n],this.bookmarks=Yr({},r),this.api.delete(t.id),this.editedBookmark={},this.modal.closeModal(),this.renderBookmarkButtons()}},{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,r.qy)($r||($r=Vr(['\n <button\n class="ia-button primary"\n tabindex="-1"\n ?disabled=',"\n @click=",">\n Add bookmark\n </button>\n "])),this.shouldEnableAddBookmarkButton,this.addBookmark)}},{key:"bookmarksList",get:function(){return(0,r.qy)(Hr||(Hr=Vr(["\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,Yr({},this.bookmarks),this.activeBookmarkID,this.bookmarkColors,this.defaultColor)}},{key:"bookmarkHelperMessage",get:function(){return(0,r.qy)(qr||(qr=Vr(["<p>Please use 1up or 2up view modes to add bookmark.</p>"])))}},{key:"render",value:function(){var e=this,t=(0,r.qy)(Rr||(Rr=Vr(["\n ","\n ","\n "])),this.bookmarksList,this.allowAddingBookmark?this.addBookmarkButton:this.bookmarkHelperMessage);return(0,r.qy)(Fr||(Fr=Vr(['\n <section class="bookmarks">\n ',"\n </section>\n "])),"login"===this.displayMode?(0,r.qy)(Nr||(Nr=Vr(["<bookmarks-login\n @click=","\n .url=","></bookmarks-login>"])),(function(){return e.loginOptions.loginClicked()}),this.loginOptions.loginUrl):t)}}],[{key:"properties",get:function(){return{activeBookmarkID:{type:String},bookmarks:{type:Array},bookreader:{type:Object},displayMode:{type:String},editedBookmark:{type:Object},deleteModalConfig:{type:Object},modal:{attribute:!1},loginOptions:{type:Object,attribute:!1}}}},{key:"styles",get:function(){var e=(0,r.AH)(Zr||(Zr=Vr(["\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[Ot,e]}},{key:"formatPage",value:function(e){return isNaN(+e)?"(".concat(e.replace(/\D/g,""),")"):e}}]);var n,o}(r.WF);customElements.define("ia-bookmarks",lo);var co,uo,ho,po,fo,mo=(0,r.AH)(ao||(ao=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 vo(e){return vo="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},vo(e)}function yo(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function bo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,go(r.key),r)}}function go(e){var t=function(e,t){if("object"!=vo(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=vo(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==vo(t)?t:t+""}function ko(e,t,n){return t=So(t),function(e,t){if(t&&("object"==vo(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)}(e,wo()?Reflect.construct(t,n||[],So(e).constructor):t.apply(e,n))}function wo(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(wo=function(){return!!e})()}function So(e){return So=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},So(e)}function Co(e,t){return Co=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Co(e,t)}var xo=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=ko(this,t)).bookmark={},e.bookmarkColors=[],e.renderHeader=!1,e.showBookmark=!0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Co(e,t)}(t,e),function(e,t,n){return t&&bo(e.prototype,t),n&&bo(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{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,r.qy)(co||(co=yo(['\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,r.qy)(uo||(uo=yo(['\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,r.qy)(ho||(ho=yo(["\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?t.headerSection:r.s6,this.showBookmark?this.bookmarkTemplate:r.s6,this.emitSaveEvent,this.updateNote,this.bookmark.note,Le(this.bookmarkColors,(function(e){return e.id}),this.bookmarkColor.bind(this)),this.emitDeleteEvent)}}],[{key:"properties",get:function(){return{bookmark:{type:Object},bookmarkColors:{type:Array},renderHeader:{type:Boolean},showBookmark:{type:Boolean}}}},{key:"headerSection",get:function(){return(0,r.qy)(po||(po=yo(["<header>\n <h3>Edit Bookmark</h3>\n </header>"])))}},{key:"styles",get:function(){var e=(0,r.AH)(fo||(fo=yo(['\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[Ot,mo,e]}}])}(r.WF);customElements.define("ia-bookmark-edit",xo),n(6910);var Oo,jo,Bo,Eo,Lo,Po,Mo,Ao,Io=r.qy`
1697
1697
  <svg height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg" aria-labelledby="editPencilTitleID editPencilDescID"><title id="editPencilTitleID">Pencil icon</title><desc id="editPencilDescID">An illustration of a pencil, used to represent an edit action</desc><path class="fill-color" d="m15.6111048 9.3708338-9.52237183 9.5222966-5.14363353 1.0897111c-.42296707.0896082-.83849202-.1806298-.92810097-.6035935-.02266463-.1069795-.02266463-.2175207 0-.3245001l1.08971974-5.1435929 9.52237189-9.52229656zm-10.89310224 5.9110366-2.78094924-.5403869-.67567462 3.166657.83033407.8303275 3.16668096-.6756703zm14.82724244-12.05935921c.6114418.61143705.6055516 1.6086709-.0131615 2.22737904l-2.2405581 2.24054036-4.9820147-4.98197536 2.2405581-2.24054036c.618713-.61870814 1.6159506-.62460252 2.2273925-.01316547z" fill-rule="evenodd"/></svg>
1698
- `;class Do extends r.WF{static get styles(){return r.AH`
1698
+ `;class zo extends r.WF{static get styles(){return r.AH`
1699
1699
  :host {
1700
1700
  width: var(--iconWidth, 'auto');
1701
1701
  height: var(--iconHeight, 'auto');
@@ -1708,7 +1708,7 @@
1708
1708
  .stroke-color {
1709
1709
  stroke: var(--iconStrokeColor);
1710
1710
  }
1711
- `}render(){return To}}function _o(e){return _o="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},_o(e)}function $o(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Ho(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,qo(r.key),r)}}function qo(e){var t=function(e,t){if("object"!=_o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=_o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_o(t)?t:t+""}function Ro(e,t,n){return t=No(t),function(e,t){if(t&&("object"==_o(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)}(e,Fo()?Reflect.construct(t,n||[],No(e).constructor):t.apply(e,n))}function Fo(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Fo=function(){return!!e})()}function No(e){return No=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},No(e)}function Zo(e,t){return Zo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Zo(e,t)}customElements.define("ia-icon-edit-pencil",Do);var Wo,Uo=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Ro(this,t)).activeBookmarkID=void 0,e.bookmarkColors=[],e.defaultBookmarkColor={},e.bookmarks={},e.editedBookmark={},e.renderHeader=!1,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Zo(e,t)}(t,e),function(e,t,n){return t&&Ho(e.prototype,t),n&&Ho(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"emitEditEvent",value:function(e,t){this.dispatchEvent(new CustomEvent("bookmarkEdited",{detail:{bookmark:t}}))}},{key:"emitSelectedEvent",value:function(e){this.activeBookmarkID=e.id,this.dispatchEvent(new CustomEvent("bookmarkSelected",{detail:{bookmark:e}}))}},{key:"emitSaveBookmark",value:function(e){this.dispatchEvent(new CustomEvent("saveBookmark",{detail:{bookmark:e}}))}},{key:"emitDeleteBookmark",value:function(e){this.dispatchEvent(new CustomEvent("deleteBookmark",{detail:{id:e}}))}},{key:"emitBookmarkColorChanged",value:function(e){var t=e.detail,n=t.bookmarkId,r=t.colorId;this.dispatchEvent(new CustomEvent("bookmarkColorChanged",{detail:{bookmarkId:n,colorId:r}}))}},{key:"emitAddBookmark",value:function(){this.dispatchEvent(new CustomEvent("addBookmark"))}},{key:"editBookmark",value:function(e,t){this.emitEditEvent(e,t),this.editedBookmark=this.editedBookmark===t?{}:t}},{key:"saveBookmark",value:function(e){var t=e.detail.bookmark;this.editedBookmark={},this.emitSaveBookmark(t)}},{key:"deleteBookmark",value:function(e){var t=e.detail.id;this.editedBookmark={},this.emitDeleteBookmark(t)}},{key:"bookmarkColorInfo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.bookmarkColors.find((function(t){return(null==t?void 0:t.id)===e}))}},{key:"bookmarkItem",value:function(e){var t=this,n=this.editedBookmark.id===e.id,o=this.bookmarkColorInfo(e.color).className,i=e.id===this.activeBookmarkID?"active":"";return(0,r.qy)(Bo||(Bo=$o(["\n <li\n @click=",'\n tabindex="0"\n data-pageIndex=','\n >\n <div class="separator"></div>\n <div class="content ','">\n <button\n class="edit"\n @click=','\n title="Edit this bookmark"\n >\n <ia-icon-edit-pencil></ia-icon-edit-pencil>\n </button>\n <h4>\n <icon-bookmark class=',"></icon-bookmark>\n <span> Page ","</span>\n </h4>\n ","\n ","\n </div>\n </li>\n "])),(function(){return t.emitSelectedEvent(e)}),e.id,i,(function(n){return t.editBookmark(n,e)}),o,e.page,!n&&e.note?(0,r.qy)(Eo||(Eo=$o(["<p>","</p>"])),e.note):r.s6,n?this.editBookmarkComponent:r.s6)}},{key:"editBookmarkComponent",get:function(){return(0,r.qy)(Lo||(Lo=$o(["\n <ia-bookmark-edit\n .bookmark=","\n .bookmarkColors=","\n .defaultBookmarkColor=","\n .showBookmark=","\n @saveBookmark=","\n @deleteBookmark=","\n @bookmarkColorChanged=","\n ></ia-bookmark-edit>\n "])),this.editedBookmark,this.bookmarkColors,this.defaultBookmarkColor,!1,this.saveBookmark,this.deleteBookmark,this.emitBookmarkColorChanged)}},{key:"sortBookmarks",value:function(){var e=this;return Object.keys(this.bookmarks).sort((function(e,t){return+e>+t?1:+e<+t?-1:0})).map((function(t){return e.bookmarks[t]}))}},{key:"bookmarksCount",get:function(){var e=this.bookmarks.length;return(0,r.qy)(Po||(Po=$o(["<small>(",")</small>"])),e)}},{key:"headerSection",get:function(){return(0,r.qy)(Mo||(Mo=$o(["<header>\n <h3>\n Bookmarks\n ","\n </h3>\n </header>"])),this.bookmarks.length?this.bookmarksCount:r.s6)}},{key:"bookmarkslist",get:function(){var e=this.sortBookmarks(),t=Pe(e,(function(e){return null==e?void 0:e.id}),this.bookmarkItem.bind(this));return(0,r.qy)(Ao||(Ao=$o(["\n <ul>\n ",'\n <div class="separator"></div>\n </ul>\n '])),t)}},{key:"render",value:function(){return(0,r.qy)(Io||(Io=$o(["\n ","\n ","\n "])),this.renderHeader?this.headerSection:r.s6,Object.keys(this.bookmarks).length?this.bookmarkslist:r.s6)}}],[{key:"properties",get:function(){return{activeBookmarkID:{type:Number},bookmarkColors:{type:Array},defaultBookmarkColor:{type:Object},bookmarks:{type:Object},editedBookmark:{type:Object},renderHeader:{type:Boolean}}}},{key:"styles",get:function(){return[(0,r.AH)(zo||(zo=$o(["\n :host {\n display: block;\n overflow-y: auto;\n box-sizing: border-box;\n color: var(--primaryTextColor);\n margin-bottom: 2rem;\n --activeBorderWidth: 2px;\n }\n\n icon-bookmark {\n width: 16px;\n height: 24px;\n }\n\n .separator {\n background-color: var(--secondaryBGColor);\n width: 98%;\n margin: 1px auto;\n height: 1px;\n }\n\n small {\n font-style: italic;\n }\n\n h4 {\n margin: 0;\n font-size: 1.4rem;\n }\n h4 * {\n display: inline-block;\n }\n h4 icon-bookmark {\n vertical-align: bottom;\n }\n h4 span {\n vertical-align: top;\n padding-top: 1%;\n }\n\n p {\n padding: 0;\n margin: 5px 0 0 0;\n width: 98%;\n overflow-wrap: break-word;\n }\n\n ia-bookmark-edit {\n margin: 5px 5px 3px 6px;\n }\n\n ul {\n padding: 0;\n list-style: none;\n margin: var(--activeBorderWidth) 0.5rem 1rem 0;\n }\n ul > li:first-child .separator {\n display: none;\n }\n li {\n cursor: pointer;\n outline: none;\n position: relative;\n }\n li .content {\n padding: 2px 0 4px 2px;\n border: var(--activeBorderWidth) solid transparent;\n padding: .2rem 0 .4rem .2rem;\n }\n li .content.active {\n border: var(--activeBorderWidth) solid #538bc5;\n }\n li button.edit {\n padding: 5px 2px 0 0;\n background: transparent;\n cursor: pointer;\n height: 40px;\n width: 40px;\n position: absolute;\n right: 2px;\n top: 2px;\n text-align: right;\n -webkit-appearance: none;\n appearance: none;\n outline: none;\n box-sizing: border-box;\n border: none;\n }\n li button.edit > * {\n display: block;\n height: 100%;\n width: 100%;\n }\n "]))),yo]}}])}(r.WF);customElements.define("ia-bookmarks-list",Uo);class Vo extends r.WF{static get styles(){return r.AH`
1711
+ `}render(){return Io}}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},To(e)}function Do(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function _o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,$o(r.key),r)}}function $o(e){var t=function(e,t){if("object"!=To(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=To(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==To(t)?t:t+""}function Ho(e,t,n){return t=Ro(t),function(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)}(e,qo()?Reflect.construct(t,n||[],Ro(e).constructor):t.apply(e,n))}function qo(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(qo=function(){return!!e})()}function Ro(e){return Ro=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ro(e)}function Fo(e,t){return Fo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Fo(e,t)}customElements.define("ia-icon-edit-pencil",zo);var No,Zo=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Ho(this,t)).activeBookmarkID=void 0,e.bookmarkColors=[],e.defaultBookmarkColor={},e.bookmarks={},e.editedBookmark={},e.renderHeader=!1,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Fo(e,t)}(t,e),function(e,t,n){return t&&_o(e.prototype,t),n&&_o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"emitEditEvent",value:function(e,t){this.dispatchEvent(new CustomEvent("bookmarkEdited",{detail:{bookmark:t}}))}},{key:"emitSelectedEvent",value:function(e){this.activeBookmarkID=e.id,this.dispatchEvent(new CustomEvent("bookmarkSelected",{detail:{bookmark:e}}))}},{key:"emitSaveBookmark",value:function(e){this.dispatchEvent(new CustomEvent("saveBookmark",{detail:{bookmark:e}}))}},{key:"emitDeleteBookmark",value:function(e){this.dispatchEvent(new CustomEvent("deleteBookmark",{detail:{id:e}}))}},{key:"emitBookmarkColorChanged",value:function(e){var t=e.detail,n=t.bookmarkId,r=t.colorId;this.dispatchEvent(new CustomEvent("bookmarkColorChanged",{detail:{bookmarkId:n,colorId:r}}))}},{key:"emitAddBookmark",value:function(){this.dispatchEvent(new CustomEvent("addBookmark"))}},{key:"editBookmark",value:function(e,t){this.emitEditEvent(e,t),this.editedBookmark=this.editedBookmark===t?{}:t}},{key:"saveBookmark",value:function(e){var t=e.detail.bookmark;this.editedBookmark={},this.emitSaveBookmark(t)}},{key:"deleteBookmark",value:function(e){var t=e.detail.id;this.editedBookmark={},this.emitDeleteBookmark(t)}},{key:"bookmarkColorInfo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.bookmarkColors.find((function(t){return(null==t?void 0:t.id)===e}))}},{key:"bookmarkItem",value:function(e){var t=this,n=this.editedBookmark.id===e.id,o=this.bookmarkColorInfo(e.color).className,i=e.id===this.activeBookmarkID?"active":"";return(0,r.qy)(Oo||(Oo=Do(["\n <li\n @click=",'\n tabindex="0"\n data-pageIndex=','\n >\n <div class="separator"></div>\n <div class="content ','">\n <button\n class="edit"\n @click=','\n title="Edit this bookmark"\n >\n <ia-icon-edit-pencil></ia-icon-edit-pencil>\n </button>\n <h4>\n <icon-bookmark class=',"></icon-bookmark>\n <span> Page ","</span>\n </h4>\n ","\n ","\n </div>\n </li>\n "])),(function(){return t.emitSelectedEvent(e)}),e.id,i,(function(n){return t.editBookmark(n,e)}),o,e.page,!n&&e.note?(0,r.qy)(jo||(jo=Do(["<p>","</p>"])),e.note):r.s6,n?this.editBookmarkComponent:r.s6)}},{key:"editBookmarkComponent",get:function(){return(0,r.qy)(Bo||(Bo=Do(["\n <ia-bookmark-edit\n .bookmark=","\n .bookmarkColors=","\n .defaultBookmarkColor=","\n .showBookmark=","\n @saveBookmark=","\n @deleteBookmark=","\n @bookmarkColorChanged=","\n ></ia-bookmark-edit>\n "])),this.editedBookmark,this.bookmarkColors,this.defaultBookmarkColor,!1,this.saveBookmark,this.deleteBookmark,this.emitBookmarkColorChanged)}},{key:"sortBookmarks",value:function(){var e=this;return Object.keys(this.bookmarks).sort((function(e,t){return+e>+t?1:+e<+t?-1:0})).map((function(t){return e.bookmarks[t]}))}},{key:"bookmarksCount",get:function(){var e=this.bookmarks.length;return(0,r.qy)(Eo||(Eo=Do(["<small>(",")</small>"])),e)}},{key:"headerSection",get:function(){return(0,r.qy)(Lo||(Lo=Do(["<header>\n <h3>\n Bookmarks\n ","\n </h3>\n </header>"])),this.bookmarks.length?this.bookmarksCount:r.s6)}},{key:"bookmarkslist",get:function(){var e=this.sortBookmarks(),t=Le(e,(function(e){return null==e?void 0:e.id}),this.bookmarkItem.bind(this));return(0,r.qy)(Po||(Po=Do(["\n <ul>\n ",'\n <div class="separator"></div>\n </ul>\n '])),t)}},{key:"render",value:function(){return(0,r.qy)(Mo||(Mo=Do(["\n ","\n ","\n "])),this.renderHeader?this.headerSection:r.s6,Object.keys(this.bookmarks).length?this.bookmarkslist:r.s6)}}],[{key:"properties",get:function(){return{activeBookmarkID:{type:Number},bookmarkColors:{type:Array},defaultBookmarkColor:{type:Object},bookmarks:{type:Object},editedBookmark:{type:Object},renderHeader:{type:Boolean}}}},{key:"styles",get:function(){return[(0,r.AH)(Ao||(Ao=Do(["\n :host {\n display: block;\n overflow-y: auto;\n box-sizing: border-box;\n color: var(--primaryTextColor);\n margin-bottom: 2rem;\n --activeBorderWidth: 2px;\n }\n\n icon-bookmark {\n width: 16px;\n height: 24px;\n }\n\n .separator {\n background-color: var(--secondaryBGColor);\n width: 98%;\n margin: 1px auto;\n height: 1px;\n }\n\n small {\n font-style: italic;\n }\n\n h4 {\n margin: 0;\n font-size: 1.4rem;\n }\n h4 * {\n display: inline-block;\n }\n h4 icon-bookmark {\n vertical-align: bottom;\n }\n h4 span {\n vertical-align: top;\n padding-top: 1%;\n }\n\n p {\n padding: 0;\n margin: 5px 0 0 0;\n width: 98%;\n overflow-wrap: break-word;\n }\n\n ia-bookmark-edit {\n margin: 5px 5px 3px 6px;\n }\n\n ul {\n padding: 0;\n list-style: none;\n margin: var(--activeBorderWidth) 0.5rem 1rem 0;\n }\n ul > li:first-child .separator {\n display: none;\n }\n li {\n cursor: pointer;\n outline: none;\n position: relative;\n }\n li .content {\n padding: 2px 0 4px 2px;\n border: var(--activeBorderWidth) solid transparent;\n padding: .2rem 0 .4rem .2rem;\n }\n li .content.active {\n border: var(--activeBorderWidth) solid #538bc5;\n }\n li button.edit {\n padding: 5px 2px 0 0;\n background: transparent;\n cursor: pointer;\n height: 40px;\n width: 40px;\n position: absolute;\n right: 2px;\n top: 2px;\n text-align: right;\n -webkit-appearance: none;\n appearance: none;\n outline: none;\n box-sizing: border-box;\n border: none;\n }\n li button.edit > * {\n display: block;\n height: 100%;\n width: 100%;\n }\n "]))),mo]}}])}(r.WF);customElements.define("ia-bookmarks-list",Zo);class Wo extends r.WF{static get styles(){return r.AH`
1712
1712
  :host {
1713
1713
  width: var(--iconWidth, 'auto');
1714
1714
  height: var(--iconHeight, 'auto');
@@ -1778,5 +1778,5 @@
1778
1778
  </g>
1779
1779
  </svg>
1780
1780
  </div>
1781
- `}}function Go(e){return Go="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},Go(e)}function Yo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Jo(r.key),r)}}function Jo(e){var t=function(e,t){if("object"!=Go(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Go(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Go(t)?t:t+""}window.customElements.define("icon-bookmark",Vo);var Xo,Qo,Ko=function(){return function(e,t,n){return t&&Yo(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}((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.baseHost,o=t.signedIn,i=t.bookreader,a=t.modal,s=t.onProviderChange,l="referer=".concat(encodeURIComponent(location.href)),c="https://".concat(n,"/account/login?").concat(l);this.component=document.createElement("ia-bookmarks"),this.component.bookreader=i,this.component.displayMode=o?"bookmarks":"login",this.component.modal=a,this.component.loginOptions={loginClicked:this.bookmarksLoginClicked,loginUrl:c},this.bindEvents(),this.icon=(0,r.qy)(Wo||(Wo=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.onProviderChange=s,this.component.setup(),this.updateMenu(this.component.bookmarks.length)}),[{key:"updateMenu",value:function(e){this.menuDetails="(".concat(e,")")}},{key:"bindEvents",value:function(){this.component.addEventListener("bookmarksChanged",this.bookmarksChanged.bind(this))}},{key:"bookmarksChanged",value:function(e){var t=e.detail,n=Object.keys(t.bookmarks).length;this.updateMenu(n),this.onProviderChange(t.bookmarks,t.showSidePanel)}},{key:"bookmarksLoginClicked",value:function(){var e;null===(e=window.archive_analytics)||void 0===e||e.send_event_no_sampling("BookReader","BookmarksLogin",window.location.path)}}])}();function ei(e){return ei="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},ei(e)}function ti(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function ni(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,oi(r.key),r)}}function ri(e,t,n){return t&&ni(e.prototype,t),n&&ni(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function oi(e){var t=function(e,t){if("object"!=ei(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=ei(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ei(t)?t:t+""}var ii,ai=ri((function e(t){var n=t.item,o=t.baseHost,i=t.bookreader;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var a=null==n?void 0:n.metadata,s=a.identifier,l=a.creator,c=a.title,u=Array.isArray(l)?l[0]:l,d=i.options.subPrefix||"";this.icon=(0,r.qy)(Xo||(Xo=ti(["",""])),le),this.label="Share this book",this.id="share",this.component=(0,r.qy)(Qo||(Qo=ti(["<iaux-in-share-panel\n .identifier=","\n .type=","\n .creator=","\n .description=","\n .baseHost=","\n .fileSubPrefix=","\n ></iaux-in-share-panel>"])),s,"book",u,c,o,d)}));function si(e){return si="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},si(e)}function li(){li=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var i=t&&t.prototype instanceof y?t:y,a=Object.create(i.prototype),s=new P(r||[]);return o(a,"_invoke",{value:j(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var h="suspendedStart",p="suspendedYield",f="executing",m="completed",v={};function y(){}function b(){}function g(){}var k={};c(k,a,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(M([])));S&&S!==n&&r.call(S,a)&&(k=S);var C=g.prototype=y.prototype=Object.create(k);function x(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,i,a,s){var l=d(e[o],e,i);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==si(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return i=i?i.then(o,o):o()}})}function j(t,n,r){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var l=B(s,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=f;var c=d(t,n,r);if("normal"===c.type){if(o=r.done?m:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=m,r.method="throw",r.arg=c.arg)}}}function B(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,B(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=d(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(si(t)+" is not iterable")}return b.prototype=g,o(C,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:b,configurable:!0}),b.displayName=c(g,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,c(e,l,"GeneratorFunction")),e.prototype=Object.create(C),e},t.awrap=function(e){return{__await:e}},x(O.prototype),c(O.prototype,s,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new O(u(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(C),c(C,l,"Generator"),c(C,a,(function(){return this})),c(C,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return s.type="throw",s.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function ci(e,t,n,r,o,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(r,o)}function ui(e){return function(e){if(Array.isArray(e))return di(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 di(e,t);var n={}.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)?di(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 di(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function hi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,pi(r.key),r)}}function pi(e){var t=function(e,t){if("object"!=si(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=si(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==si(t)?t:t+""}var fi,mi,vi,yi,bi,gi,ki,wi="default",Si=function(){return function(e,t,n){return t&&hi(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t){var n=this,o=t.baseHost,i=t.bookreader,a=t.onProviderChange;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.bookreader=i,this.onProviderChange=a,this.baseHost=o;var s=i.options.multipleBooksList.by_subprefix;if(this.viewableFiles=Object.keys(s).map((function(e){return s[e]})),this.volumeCount=Object.keys(s).length,this.id="volumes",this.label="Viewable files (".concat(this.volumeCount,")"),this.icon=(0,r.qy)(ii||(ii=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["",""])),ze),this.sortOrderBy=wi,this.component=document.createElement("iaux-in-viewable-files-panel"),this.component.addSortToUrl=!0,this.component.subPrefix=i.options.subPrefix||"",this.component.baseHost=o,this.component.fileList=ui(this.viewableFiles),this.sortFilesComponent=document.createElement("iaux-in-sort-files-button"),this.sortFilesComponent.fileListRaw=this.viewableFiles,this.sortFilesComponent.addEventListener("fileListSorted",(function(e){return n.handleFileListSorted(e)})),this.actionButton=this.sortFilesComponent,this.bookreader.urlPlugin){this.bookreader.urlPlugin.pullFromAddressBar();var l=this.bookreader.urlPlugin.getUrlParam("sort");"title_asc"!==l&&"title_desc"!==l||(this.sortOrderBy=l)}this.sortFilesComponent.sortVolumes(this.sortOrderBy),this.onProviderChange(this.bookreader)}),[{key:"handleFileListSorted",value:(e=li().mark((function e(t){var n,r,o;return li().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.detail,r=n.sortType,o=n.sortedFiles,this.viewableFiles=o,this.sortOrderBy=r,this.component.fileList=ui(this.viewableFiles),e.next=6,this.component.updateComplete;case 6:this.bookreader.urlPlugin&&(this.bookreader.urlPlugin.pullFromAddressBar(),this.sortOrderBy!==wi?this.bookreader.urlPlugin.setUrlParam("sort",this.sortOrderBy):this.bookreader.urlPlugin.removeUrlParam("sort")),this.onProviderChange(this.bookreader),this.multipleFilesClicked(this.sortOrderBy);case 9:case"end":return e.stop()}}),e,this)})),t=function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){ci(i,r,o,a,s,"next",e)}function s(e){ci(i,r,o,a,s,"throw",e)}a(void 0)}))},function(e){return t.apply(this,arguments)})},{key:"multipleFilesClicked",value:function(e){var t;null===(t=window.archive_analytics)||void 0===t||t.send_event("BookReader","VolumesSort|".concat(e),window.location.path)}}]);var e,t}(),Ci=(0,r.JW)(fi||(fi=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <svg class="ia-logo" width="27" height="30" viewBox="0 0 27 30" xmlns="http://www.w3.org/2000/svg" aria-labelledby="logoTitleID logoDescID">\n <title id="logoTitleID">Internet Archive logo</title>\n <desc id="logoDescID">A line drawing of the Internet Archive headquarters building façade.</desc>\n <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <mask id="mask-2" fill="white">\n <path d="M26.6666667,28.6046512 L26.6666667,30 L0,30 L0.000283687943,28.6046512 L26.6666667,28.6046512 Z M25.6140351,26.5116279 L25.6140351,28.255814 L1.05263158,28.255814 L1.05263158,26.5116279 L25.6140351,26.5116279 Z M3.62469203,7.6744186 L3.91746909,7.82153285 L4.0639977,10.1739544 L4.21052632,13.9963932 L4.21052632,17.6725617 L4.0639977,22.255044 L4.03962296,25.3421929 L3.62469203,25.4651163 L2.16024641,25.4651163 L1.72094074,25.3421929 L1.55031755,22.255044 L1.40350877,17.6970339 L1.40350877,14.0211467 L1.55031755,10.1739544 L1.68423854,7.80887484 L1.98962322,7.6744186 L3.62469203,7.6744186 Z M24.6774869,7.6744186 L24.9706026,7.82153285 L25.1168803,10.1739544 L25.2631579,13.9963932 L25.2631579,17.6725617 L25.1168803,22.255044 L25.0927809,25.3421929 L24.6774869,25.4651163 L23.2130291,25.4651163 L22.7736357,25.3421929 L22.602418,22.255044 L22.4561404,17.6970339 L22.4561404,14.0211467 L22.602418,10.1739544 L22.7369262,7.80887484 L23.0420916,7.6744186 L24.6774869,7.6744186 Z M9.94042303,7.6744186 L10.2332293,7.82153285 L10.3797725,10.1739544 L10.5263158,13.9963932 L10.5263158,17.6725617 L10.3797725,22.255044 L10.3556756,25.3421929 L9.94042303,25.4651163 L8.47583122,25.4651163 L8.0362015,25.3421929 L7.86556129,22.255044 L7.71929825,17.6970339 L7.71929825,14.0211467 L7.86556129,10.1739544 L8.00005604,7.80887484 L8.30491081,7.6744186 L9.94042303,7.6744186 Z M18.0105985,7.6744186 L18.3034047,7.82153285 L18.449948,10.1739544 L18.5964912,13.9963932 L18.5964912,17.6725617 L18.449948,22.255044 L18.425851,25.3421929 L18.0105985,25.4651163 L16.5460067,25.4651163 L16.1066571,25.3421929 L15.9357367,22.255044 L15.7894737,17.6970339 L15.7894737,14.0211467 L15.9357367,10.1739544 L16.0702315,7.80887484 L16.3753664,7.6744186 L18.0105985,7.6744186 Z M25.6140351,4.53488372 L25.6140351,6.97674419 L1.05263158,6.97674419 L1.05263158,4.53488372 L25.6140351,4.53488372 Z M13.0806755,0 L25.9649123,2.93331338 L25.4484139,3.8372093 L0.771925248,3.8372093 L0,3.1041615 L13.0806755,0 Z" id="path-1"></path>\n </mask>\n <use fill="#FFFFFF" xlink:href="#path-1"></use>\n <g mask="url(#mask-2)" fill="#FFFFFF">\n <path d="M0,0 L26.6666667,0 L26.6666667,30 L0,30 L0,0 Z" id="swatch"></path>\n </g>\n </g>\n </svg>\n'])));function xi(e){return xi="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},xi(e)}function Oi(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function ji(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Bi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ji(Object(n),!0).forEach((function(t){Ei(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ji(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ei(e,t,n){return(t=Pi(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Li(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Pi(r.key),r)}}function Pi(e){var t=function(e,t){if("object"!=xi(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=xi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==xi(t)?t:t+""}function Mi(e,t,n){return t=Ii(t),function(e,t){if(t&&("object"==xi(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)}(e,Ai()?Reflect.construct(t,n||[],Ii(e).constructor):t.apply(e,n))}function Ai(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ai=function(){return!!e})()}function Ii(e){return Ii=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ii(e)}function zi(e,t){return zi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},zi(e,t)}var Ti,Di,_i="updateSideMenu",$i=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Mi(this,t)).itemMD=void 0,e.loaded=!1,e.bookReaderCannotLoad=!1,e.bookReaderLoaded=!1,e.bookreader=null,e.bookIsRestricted=!1,e.downloadableTypes=[],e.isAdmin=!1,e.lendingInitialized=!1,e.lendingStatus={},e.menuProviders={},e.menuShortcuts=[],e.signedIn=!1,e.modal=void 0,e.sharedObserver=void 0,e.fullscreenBranding=Ci,e.sharedObserverHandler=void 0,e.brWidth=0,e.brHeight=0,e.shortcutOrder=["fullscreen","volumes","chapters","search","bookmarks"],e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&zi(e,t)}(t,e),function(e,t,n){return t&&Li(e.prototype,t),n&&Li(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"disconnectedCallback",value:function(){this.sharedObserver.removeObserver({target:this.mainBRContainer,handler:this.sharedObserverHandler})}},{key:"firstUpdated",value:function(){this.bindEventListeners(),this.emitPostInit(),this.loaded=!0}},{key:"updated",value:function(e){this.bookreader&&this.itemMD&&this.bookReaderLoaded&&((e.has("loaded")&&this.loaded||e.has("itemMD")||e.has("bookreader")||e.has("signedIn")||e.has("isAdmin")||e.has("modal"))&&this.initializeBookSubmenus(),e.has("sharedObserver")&&this.bookreader&&(this.loadSharedObserver(),this.initializeBookSubmenus()),e.has("downloadableTypes")&&this.initializeBookSubmenus())}},{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:"baseProviderConfig",get:function(){return{baseHost:this.baseHost,modal:this.modal,sharedObserver:this.sharedObserver,bookreader:this.bookreader,item:this.itemMD,signedIn:this.signedIn,isAdmin:this.isAdmin,onProviderChange:function(){}}}},{key:"isWideEnoughToOpenMenu",get:function(){return this.brWidth>=640}},{key:"initializeBookSubmenus",value:function(){var e=this,t={visualAdjustments:new cr(Bi(Bi({},this.baseProviderConfig),{},{onProviderChange:function(){e.updateMenuContents()}}))};this.baseProviderConfig.item&&(t.share=new ai(this.baseProviderConfig)),this.shouldShowDownloadsMenu()&&(t.downloads=new jn(this.baseProviderConfig)),this.bookreader.options.enableSearch&&(t.search=new on(Bi(Bi({},this.baseProviderConfig),{},{onProviderChange: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(),!1!==n.openMenu&&(!e.isWideEnoughToOpenMenu||null!=n&&n.searchCanceled||setTimeout((function(){e.updateSideMenu("search","open")}),0))}}))),this.bookreader.options.enableBookmarks&&(t.bookmarks=new Ko(Bi(Bi({},this.baseProviderConfig),{},{onProviderChange:function(t){var n=Object.keys(t).length?"add":"remove";e["".concat(n,"MenuShortcut")]("bookmarks"),e.updateMenuContents()}}))),this.bookreader.options.enableMultipleBooks&&(t.volumes=new Si(Bi(Bi({},this.baseProviderConfig),{},{onProviderChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;t&&(e.bookreader=t),e.updateMenuContents(),e.isWideEnoughToOpenMenu&&setTimeout((function(){e.updateSideMenu("volumes","open")}))}}))),Object.assign(this.menuProviders,t),this.addMenuShortcut("search"),this.addMenuShortcut("volumes"),this.updateMenuContents()}},{key:"mainBRContainer",get:function(){var e;return document.querySelector(null===(e=this.bookreader)||void 0===e?void 0:e.el)}},{key:"addFullscreenShortcut",value:function(){var e={icon:this.fullscreenShortcut,id:"fullscreen"};this.menuShortcuts.push(e),this.sortMenuShortcuts(),this.emitMenuShortcutsUpdated()}},{key:"deleteFullscreenShortcut",value:function(){var e=this.menuShortcuts.filter((function(e){return"fullscreen"!==e.id}));this.menuShortcuts=e,this.sortMenuShortcuts(),this.emitMenuShortcutsUpdated()}},{key:"closeFullscreen",value:function(){this.bookreader.exitFullScreen()}},{key:"fullscreenShortcut",get:function(){var e=this;return(0,r.qy)(mi||(mi=Oi(["\n <button\n @click=",'\n title="Exit fullscreen view"\n >',"</button>\n "])),(function(){return e.closeFullscreen()}),this.fullscreenBranding)}},{key:"updateSideMenu",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(e){var t=new CustomEvent(_i,{detail:{menuId:e,action:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"open"}});this.dispatchEvent(t)}}},{key:"updateMenuContents",value:function(){var e=this.menuProviders,t=e.search,n=e.downloads,r=e.visualAdjustments,o=e.share,i=e.bookmarks,a=[e.volumes,e.chapters,t,i,r,o].filter((function(e){return!!e}));this.shouldShowDownloadsMenu()&&(null==n||n.update(this.downloadableTypes),a.splice(-2,0,n));var s=new CustomEvent("menuUpdated",{detail:a});this.dispatchEvent(s)}},{key:"shouldShowDownloadsMenu",value:function(){if(!this.downloadableTypes.length)return!1;if(!1===this.bookIsRestricted)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.menuProviders[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 r=e.menuShortcuts.find((function(e){return e.id===n}));return r&&t.push(r),t}),[])}},{key:"emitMenuShortcutsUpdated",value:function(){var e=new CustomEvent("menuShortcutsUpdated",{detail:this.menuShortcuts});this.dispatchEvent(e)}},{key:"emitLoadingStatusUpdate",value:function(e){var t=new CustomEvent("loadingStateUpdated",{detail:{loaded:e}});this.dispatchEvent(t)}},{key:"bindEventListeners",value:function(){var e=this;window.addEventListener("BookReader:PostInit",(function(t){e.bookreader=t.detail.props,e.bookreader.shell=e,e.bookReaderLoaded=!0,e.bookReaderCannotLoad=!1,e.emitLoadingStatusUpdate(!0),e.loadSharedObserver(),setTimeout((function(){e.bookreader.resize()}),0)})),window.addEventListener("BookReader:fullscreenToggled",(function(t){var n=t.detail.props,r=void 0===n?null:n;r&&(e.bookreader=r),e.manageFullScreenBehavior()}),{passive:!0}),window.addEventListener("BookReader:ToggleSearchMenu",(function(t){e.dispatchEvent(new CustomEvent(_i,{detail:{menuId:"search",action:"toggle"}}))})),window.addEventListener("LendingFlow:PostInit",(function(t){var n=t.detail,r=n.downloadTypesAvailable,o=n.lendingStatus,i=n.isAdmin,a=n.previewType;e.lendingInitialized=!0,e.downloadableTypes=r,e.lendingStatus=o,e.isAdmin=i,e.bookReaderCannotLoad="singlePagePreview"===a,e.emitLoadingStatusUpdate(!0)})),window.addEventListener("BRJSIA:PostInit",(function(t){var n=t.detail,r=n.isRestricted,o=n.downloadURLs;e.bookReaderLoaded=!0,e.downloadableTypes=o,e.bookIsRestricted=r})),window.addEventListener("contextmenu",(function(t){return e.manageContextMenuVisibility(t)}),{capture:!0})}},{key:"manageContextMenuVisibility",value:function(e){var t,n;if(null===(t=window.archive_analytics)||void 0===t||t.send_event("BookReader","contextmenu-".concat(this.bookIsRestricted?"restricted":"unrestricted"),null===(n=e.target)||void 0===n||null===(n=n.classList)||void 0===n?void 0:n.value),this.bookIsRestricted&&e.target.classList.value.match(/BRscreen|BRpageimage/g))return e.preventDefault(),!1}},{key:"loadSharedObserver",value:function(){var e;this.sharedObserverHandler={handleResize:this.handleResize.bind(this)},null===(e=this.sharedObserver)||void 0===e||e.addObserver({target:this.mainBRContainer,handler:this.sharedObserverHandler})}},{key:"handleResize",value:function(e){var t=e.contentRect,n=e.target,r=this.brWidth,o=this.brHeight,i=this.bookreader.animating;n===this.mainBRContainer&&(this.brWidth=t.width,this.brHeight=t.height),!r&&this.brWidth&&this.initializeBookSubmenus();var a,s=r!==this.brWidth,l=o!==this.brHeight;i||!s&&!l||null===(a=this.bookreader)||void 0===a||a.resize()}},{key:"manageFullScreenBehavior",value:function(){this.emitFullScreenState(),this.bookreader.options.enableFSLogoShortcut&&(this.bookreader.isFullscreen()?this.addFullscreenShortcut():this.deleteFullscreenShortcut())}},{key:"emitFullScreenState",value:function(){var e=this.bookreader.isFullscreen(),t=new CustomEvent("ViewportInFullScreen",{detail:{isFullScreen:e}});this.dispatchEvent(t)}},{key:"itemImage",get:function(){var e,t=null===(e=this.itemMD)||void 0===e?void 0:e.metadata.identifier,n="https://".concat(this.baseHost,"/services/img/").concat(t);return(0,r.qy)(vi||(vi=Oi(['<img class="cover-img" src=',' alt="cover image for ','">'])),n,t)}},{key:"placeholder",get:function(){return(0,r.qy)(yi||(yi=Oi(['<div class="placeholder">',"</div>"])),this.itemImage)}},{key:"render",value:function(){return(0,r.qy)(bi||(bi=Oi(['<div id="book-navigator__root">\n ',"\n ","\n </div>\n "])),this.bookReaderCannotLoad?this.placeholder:r.s6,this.bookReaderCannotLoad?r.s6:(0,r.qy)(gi||(gi=Oi(['<slot name="main"></slot>']))))}}],[{key:"properties",get:function(){return{itemMD:{type:Object},bookReaderLoaded:{type:Boolean},bookreader:{type:Object},bookIsRestricted:{type:Boolean},downloadableTypes:{type:Array},isAdmin:{type:Boolean},lendingInitialized:{type:Boolean},lendingStatus:{type:Object},menuProviders:{type:Object},menuShortcuts:{type:Array},signedIn:{type:Boolean},loaded:{type:Boolean},sharedObserver:{type:Object,attribute:!1},modal:{type:Object,attribute:!1},fullscreenBranding:{type:Object}}}},{key:"styles",get:function(){return(0,r.AH)(ki||(ki=Oi(["\n :host,\n #book-navigator__root,\n slot,\n slot > * {\n display: block;\n height: inherit;\n width: inherit;\n }\n .placeholder {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n margin: 5%;\n }\n .cover-img {\n max-height: 300px;\n }\n "])))}}])}(r.WF);customElements.define("book-navigator",$i);class Hi{constructor(){this.resizeObserver=new ResizeObserver((e=>{window.requestAnimationFrame((()=>{for(const t of e){const e=this.resizeHandlers.get(t.target);null==e||e.forEach((e=>{e.handleResize(t)}))}}))})),this.resizeHandlers=new Map}shutdown(){this.resizeHandlers.forEach(((e,t)=>{this.resizeObserver.unobserve(t)})),this.resizeHandlers.clear()}addObserver(e){var t;const n=null!==(t=this.resizeHandlers.get(e.target))&&void 0!==t?t:new Set;n.add(e.handler),this.resizeHandlers.set(e.target,n),this.resizeObserver.observe(e.target,e.options)}removeObserver(e){const t=this.resizeHandlers.get(e.target);t&&(t.delete(e.handler),0===t.size&&(this.resizeObserver.unobserve(e.target),this.resizeHandlers.delete(e.target)))}}function qi(e){return qi="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},qi(e)}function Ri(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function Fi(e){return function(e){if(Array.isArray(e))return Ni(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 Ni(e,t);var n={}.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)?Ni(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 Ni(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Zi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Wi(r.key),r)}}function Wi(e){var t=function(e,t){if("object"!=qi(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=qi(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==qi(t)?t:t+""}function Ui(e,t,n){return t=Gi(t),function(e,t){if(t&&("object"==qi(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)}(e,Vi()?Reflect.construct(t,n||[],Gi(e).constructor):t.apply(e,n))}function Vi(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Vi=function(){return!!e})()}function Gi(e){return Gi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Gi(e)}function Yi(e,t){return Yi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Yi(e,t)}var Ji=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Ui(this,t)).item=void 0,e.bookreader=void 0,e.baseHost="archive.org",e.fullscreen=!1,e.signedIn=!1,e.modal=void 0,e.sharedObserver=void 0,e.loaded=!1,e.menuShortcuts=[],e.menuContents=[],e.openMenuName="",e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Yi(e,t)}(t,e),function(e,t,n){return t&&Zi(e.prototype,t),n&&Zi(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"updated",value:function(){this.modal||this.setModalManager(),this.sharedObserver||(this.sharedObserver=new Hi)}},{key:"itemNav",get:function(){return this.shadowRoot.querySelector("iaux-item-navigator")}},{key:"setModalManager",value:function(){var e=document.querySelector("modal-manager");e||(e=document.createElement("modal-manager"),document.body.appendChild(e)),this.modal=e}},{key:"manageFullscreen",value:function(e){var t=!!e.detail.isFullScreen;this.fullscreen=t,this.dispatchEvent(new CustomEvent("fullscreenStateUpdated",{detail:{fullscreen:t}}))}},{key:"loadingStateUpdated",value:function(e){var t=e.detail.loaded;this.loaded=t||null,this.dispatchEvent(new CustomEvent("loadingStateUpdated",{detail:{loaded:t}}))}},{key:"setMenuShortcuts",value:function(e){this.menuShortcuts=Fi(e.detail)}},{key:"setMenuContents",value:function(e){var t=Fi(e.detail);this.menuContents=t}},{key:"manageSideMenuEvents",value:function(e){var t,n=e.detail,r=n.menuId,o=n.action;if(r)if(this.openMenuName=r,"open"===o)null===(t=this.itemNav)||void 0===t||t.openShortcut(r);else if("toggle"===o){var i;null===(i=this.itemNav)||void 0===i||i.toggleMenu()}}},{key:"render",value:function(){return(0,r.qy)(Ti||(Ti=Ri(['\n <div class="main-component">\n <iaux-item-navigator\n ?viewportInFullscreen=',"\n .basehost=","\n .item=","\n .modal=","\n .loaded=","\n .sharedObserver=","\n ?signedIn=","\n .menuShortcuts=","\n .menuContents=","\n .openMenu=",'\n >\n <div slot="header">\n <slot name="header"></slot>\n </div>\n <div slot="main">\n <book-navigator\n .modal=',"\n .baseHost=","\n .itemMD=","\n ?signedIn=","\n ?sideMenuOpen=","\n .sharedObserver=","\n @ViewportInFullScreen=","\n @loadingStateUpdated=","\n @updateSideMenu=","\n @menuUpdated=","\n @menuShortcutsUpdated=",'\n >\n <div slot="main">\n <slot name="main"></slot>\n </div>\n </book-navigator>\n </div>\n </iaux-item-navigator>\n </div>\n '])),this.fullscreen,this.baseHost,this.item,this.modal,this.loaded,this.sharedObserver,this.signedIn,this.menuShortcuts,this.menuContents,this.openMenuName,this.modal,this.baseHost,this.item,this.signedIn,this.menuOpened,this.sharedObserver,this.manageFullscreen,this.loadingStateUpdated,this.manageSideMenuEvents,this.setMenuContents,this.setMenuShortcuts)}}],[{key:"properties",get:function(){return{item:{type:Object},baseHost:{type:String},signedIn:{type:Boolean},fullscreen:{type:Boolean,reflect:!0,attribute:!0},sharedObserver:{type:Object,attribute:!1},modal:{type:Object,attribute:!1},loaded:{type:Boolean},menuShortcuts:{type:Array},menuContents:{type:Array}}}},{key:"styles",get:function(){return(0,r.AH)(Di||(Di=Ri(['\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 background-color: var(--primaryBGColor);\n position: relative;\n }\n\n :host([fullscreen]),\n iaux-item-navigator[viewportinfullscreen] {\n position: fixed;\n inset: 0;\n height: 100%;\n min-height: unset;\n }\n\n .main-component {\n height: 100%;\n width: 100%;\n min-height: inherit;\n }\n\n div[slot="header"],\n div[slot="main"] {\n display: flex;\n width: 100%;\n }\n\n slot {\n display: block;\n flex: 1;\n }\n\n iaux-item-navigator {\n min-height: var(--br-height, inherit);\n height: var(--br-height, inherit);\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 '])))}}])}(r.WF);window.customElements.define("ia-bookreader",Ji)}},function(e){e(e.s=4497)}]);
1781
+ `}}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},Uo(e)}function Vo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Go(r.key),r)}}function Go(e){var t=function(e,t){if("object"!=Uo(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Uo(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Uo(t)?t:t+""}window.customElements.define("icon-bookmark",Wo);var Yo,Jo,Xo=function(){return function(e,t,n){return t&&Vo(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}((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.baseHost,o=t.signedIn,i=t.bookreader,a=t.modal,s=t.onProviderChange,l="referer=".concat(encodeURIComponent(location.href)),c="https://".concat(n,"/account/login?").concat(l);this.component=document.createElement("ia-bookmarks"),this.component.bookreader=i,this.component.displayMode=o?"bookmarks":"login",this.component.modal=a,this.component.loginOptions={loginClicked:this.bookmarksLoginClicked,loginUrl:c},this.bindEvents(),this.icon=(0,r.qy)(No||(No=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.onProviderChange=s,this.component.setup(),this.updateMenu(this.component.bookmarks.length)}),[{key:"updateMenu",value:function(e){this.menuDetails="(".concat(e,")")}},{key:"bindEvents",value:function(){this.component.addEventListener("bookmarksChanged",this.bookmarksChanged.bind(this))}},{key:"bookmarksChanged",value:function(e){var t=e.detail,n=Object.keys(t.bookmarks).length;this.updateMenu(n),this.onProviderChange(t.bookmarks,t.showSidePanel)}},{key:"bookmarksLoginClicked",value:function(){var e;null===(e=window.archive_analytics)||void 0===e||e.send_event_no_sampling("BookReader","BookmarksLogin",window.location.path)}}])}();function Qo(e){return Qo="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},Qo(e)}function Ko(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function ei(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ni(r.key),r)}}function ti(e,t,n){return t&&ei(e.prototype,t),n&&ei(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function ni(e){var t=function(e,t){if("object"!=Qo(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Qo(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Qo(t)?t:t+""}var ri,oi=ti((function e(t){var n=t.item,o=t.baseHost,i=t.bookreader;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var a=null==n?void 0:n.metadata,s=a.identifier,l=a.creator,c=a.title,u=Array.isArray(l)?l[0]:l,d=i.options.subPrefix||"";this.icon=(0,r.qy)(Yo||(Yo=Ko(["",""])),le),this.label="Share this book",this.id="share",this.component=(0,r.qy)(Jo||(Jo=Ko(["<iaux-in-share-panel\n .identifier=","\n .type=","\n .creator=","\n .description=","\n .baseHost=","\n .fileSubPrefix=","\n ></iaux-in-share-panel>"])),s,"book",u,c,o,d)}));function ii(e){return ii="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},ii(e)}function ai(){ai=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var i=t&&t.prototype instanceof y?t:y,a=Object.create(i.prototype),s=new P(r||[]);return o(a,"_invoke",{value:j(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var h="suspendedStart",p="suspendedYield",f="executing",m="completed",v={};function y(){}function b(){}function g(){}var k={};c(k,a,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(M([])));S&&S!==n&&r.call(S,a)&&(k=S);var C=g.prototype=y.prototype=Object.create(k);function x(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,i,a,s){var l=d(e[o],e,i);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==ii(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return i=i?i.then(o,o):o()}})}function j(t,n,r){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var l=B(s,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=f;var c=d(t,n,r);if("normal"===c.type){if(o=r.done?m:p,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=m,r.method="throw",r.arg=c.arg)}}}function B(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,B(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var i=d(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,v;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(ii(t)+" is not iterable")}return b.prototype=g,o(C,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:b,configurable:!0}),b.displayName=c(g,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,c(e,l,"GeneratorFunction")),e.prototype=Object.create(C),e},t.awrap=function(e){return{__await:e}},x(O.prototype),c(O.prototype,s,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new O(u(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(C),c(C,l,"Generator"),c(C,a,(function(){return this})),c(C,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return s.type="throw",s.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function si(e,t,n,r,o,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(r,o)}function li(e){return function(e){if(Array.isArray(e))return ci(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 ci(e,t);var n={}.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)?ci(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 ci(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ui(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,di(r.key),r)}}function di(e){var t=function(e,t){if("object"!=ii(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=ii(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ii(t)?t:t+""}var hi,pi,fi,mi,vi,yi,bi,gi="default",ki=function(){return function(e,t,n){return t&&ui(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t){var n=this,o=t.baseHost,i=t.bookreader,a=t.onProviderChange;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.bookreader=i,this.onProviderChange=a,this.baseHost=o;var s=i.options.multipleBooksList.by_subprefix;if(this.viewableFiles=Object.keys(s).map((function(e){return s[e]})),this.volumeCount=Object.keys(s).length,this.id="volumes",this.label="Viewable files (".concat(this.volumeCount,")"),this.icon=(0,r.qy)(ri||(ri=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["",""])),Ie),this.sortOrderBy=gi,this.component=document.createElement("iaux-in-viewable-files-panel"),this.component.addSortToUrl=!0,this.component.subPrefix=i.options.subPrefix||"",this.component.baseHost=o,this.component.fileList=li(this.viewableFiles),this.sortFilesComponent=document.createElement("iaux-in-sort-files-button"),this.sortFilesComponent.fileListRaw=this.viewableFiles,this.sortFilesComponent.addEventListener("fileListSorted",(function(e){return n.handleFileListSorted(e)})),this.actionButton=this.sortFilesComponent,this.bookreader.urlPlugin){this.bookreader.urlPlugin.pullFromAddressBar();var l=this.bookreader.urlPlugin.getUrlParam("sort");"title_asc"!==l&&"title_desc"!==l||(this.sortOrderBy=l)}this.sortFilesComponent.sortVolumes(this.sortOrderBy),this.onProviderChange(this.bookreader)}),[{key:"handleFileListSorted",value:(e=ai().mark((function e(t){var n,r,o;return ai().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.detail,r=n.sortType,o=n.sortedFiles,this.viewableFiles=o,this.sortOrderBy=r,this.component.fileList=li(this.viewableFiles),e.next=6,this.component.updateComplete;case 6:this.bookreader.urlPlugin&&(this.bookreader.urlPlugin.pullFromAddressBar(),this.sortOrderBy!==gi?this.bookreader.urlPlugin.setUrlParam("sort",this.sortOrderBy):this.bookreader.urlPlugin.removeUrlParam("sort")),this.onProviderChange(this.bookreader),this.multipleFilesClicked(this.sortOrderBy);case 9:case"end":return e.stop()}}),e,this)})),t=function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){si(i,r,o,a,s,"next",e)}function s(e){si(i,r,o,a,s,"throw",e)}a(void 0)}))},function(e){return t.apply(this,arguments)})},{key:"multipleFilesClicked",value:function(e){var t;null===(t=window.archive_analytics)||void 0===t||t.send_event("BookReader","VolumesSort|".concat(e),window.location.path)}}]);var e,t}(),wi=(0,r.JW)(hi||(hi=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n <svg class="ia-logo" width="27" height="30" viewBox="0 0 27 30" xmlns="http://www.w3.org/2000/svg" aria-labelledby="logoTitleID logoDescID">\n <title id="logoTitleID">Internet Archive logo</title>\n <desc id="logoDescID">A line drawing of the Internet Archive headquarters building façade.</desc>\n <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <mask id="mask-2" fill="white">\n <path d="M26.6666667,28.6046512 L26.6666667,30 L0,30 L0.000283687943,28.6046512 L26.6666667,28.6046512 Z M25.6140351,26.5116279 L25.6140351,28.255814 L1.05263158,28.255814 L1.05263158,26.5116279 L25.6140351,26.5116279 Z M3.62469203,7.6744186 L3.91746909,7.82153285 L4.0639977,10.1739544 L4.21052632,13.9963932 L4.21052632,17.6725617 L4.0639977,22.255044 L4.03962296,25.3421929 L3.62469203,25.4651163 L2.16024641,25.4651163 L1.72094074,25.3421929 L1.55031755,22.255044 L1.40350877,17.6970339 L1.40350877,14.0211467 L1.55031755,10.1739544 L1.68423854,7.80887484 L1.98962322,7.6744186 L3.62469203,7.6744186 Z M24.6774869,7.6744186 L24.9706026,7.82153285 L25.1168803,10.1739544 L25.2631579,13.9963932 L25.2631579,17.6725617 L25.1168803,22.255044 L25.0927809,25.3421929 L24.6774869,25.4651163 L23.2130291,25.4651163 L22.7736357,25.3421929 L22.602418,22.255044 L22.4561404,17.6970339 L22.4561404,14.0211467 L22.602418,10.1739544 L22.7369262,7.80887484 L23.0420916,7.6744186 L24.6774869,7.6744186 Z M9.94042303,7.6744186 L10.2332293,7.82153285 L10.3797725,10.1739544 L10.5263158,13.9963932 L10.5263158,17.6725617 L10.3797725,22.255044 L10.3556756,25.3421929 L9.94042303,25.4651163 L8.47583122,25.4651163 L8.0362015,25.3421929 L7.86556129,22.255044 L7.71929825,17.6970339 L7.71929825,14.0211467 L7.86556129,10.1739544 L8.00005604,7.80887484 L8.30491081,7.6744186 L9.94042303,7.6744186 Z M18.0105985,7.6744186 L18.3034047,7.82153285 L18.449948,10.1739544 L18.5964912,13.9963932 L18.5964912,17.6725617 L18.449948,22.255044 L18.425851,25.3421929 L18.0105985,25.4651163 L16.5460067,25.4651163 L16.1066571,25.3421929 L15.9357367,22.255044 L15.7894737,17.6970339 L15.7894737,14.0211467 L15.9357367,10.1739544 L16.0702315,7.80887484 L16.3753664,7.6744186 L18.0105985,7.6744186 Z M25.6140351,4.53488372 L25.6140351,6.97674419 L1.05263158,6.97674419 L1.05263158,4.53488372 L25.6140351,4.53488372 Z M13.0806755,0 L25.9649123,2.93331338 L25.4484139,3.8372093 L0.771925248,3.8372093 L0,3.1041615 L13.0806755,0 Z" id="path-1"></path>\n </mask>\n <use fill="#FFFFFF" xlink:href="#path-1"></use>\n <g mask="url(#mask-2)" fill="#FFFFFF">\n <path d="M0,0 L26.6666667,0 L26.6666667,30 L0,30 L0,0 Z" id="swatch"></path>\n </g>\n </g>\n </svg>\n'])));function Si(e){return Si="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},Si(e)}function Ci(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function xi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Oi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xi(Object(n),!0).forEach((function(t){ji(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xi(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ji(e,t,n){return(t=Ei(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ei(r.key),r)}}function Ei(e){var t=function(e,t){if("object"!=Si(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Si(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Si(t)?t:t+""}function Li(e,t,n){return t=Mi(t),function(e,t){if(t&&("object"==Si(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)}(e,Pi()?Reflect.construct(t,n||[],Mi(e).constructor):t.apply(e,n))}function Pi(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Pi=function(){return!!e})()}function Mi(e){return Mi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Mi(e)}function Ai(e,t){return Ai=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ai(e,t)}var Ii,zi,Ti="updateSideMenu",Di=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Li(this,t)).itemMD=void 0,e.loaded=!1,e.bookReaderCannotLoad=!1,e.bookReaderLoaded=!1,e.bookreader=null,e.bookIsRestricted=!1,e.downloadableTypes=[],e.isAdmin=!1,e.lendingInitialized=!1,e.lendingStatus={},e.menuProviders={},e.menuShortcuts=[],e.signedIn=!1,e.modal=void 0,e.sharedObserver=void 0,e.fullscreenBranding=wi,e.sharedObserverHandler=void 0,e.brWidth=0,e.brHeight=0,e.shortcutOrder=["fullscreen","volumes","chapters","search","bookmarks"],e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ai(e,t)}(t,e),function(e,t,n){return t&&Bi(e.prototype,t),n&&Bi(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"disconnectedCallback",value:function(){this.sharedObserver.removeObserver({target:this.mainBRContainer,handler:this.sharedObserverHandler})}},{key:"firstUpdated",value:function(){this.bindEventListeners(),this.emitPostInit(),this.loaded=!0}},{key:"updated",value:function(e){this.bookreader&&this.itemMD&&this.bookReaderLoaded&&((e.has("loaded")&&this.loaded||e.has("itemMD")||e.has("bookreader")||e.has("signedIn")||e.has("isAdmin")||e.has("modal"))&&this.initializeBookSubmenus(),e.has("sharedObserver")&&this.bookreader&&(this.loadSharedObserver(),this.initializeBookSubmenus()),e.has("downloadableTypes")&&this.initializeBookSubmenus())}},{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:"baseProviderConfig",get:function(){return{baseHost:this.baseHost,modal:this.modal,sharedObserver:this.sharedObserver,bookreader:this.bookreader,item:this.itemMD,signedIn:this.signedIn,isAdmin:this.isAdmin,onProviderChange:function(){}}}},{key:"isWideEnoughToOpenMenu",get:function(){return this.brWidth>=640}},{key:"initializeBookSubmenus",value:function(){var e=this,t={visualAdjustments:new sr(Oi(Oi({},this.baseProviderConfig),{},{onProviderChange:function(){e.updateMenuContents()}}))};this.baseProviderConfig.item&&(t.share=new oi(this.baseProviderConfig)),this.shouldShowDownloadsMenu()&&(t.downloads=new xn(this.baseProviderConfig)),this.bookreader.options.enableSearch&&(t.search=new nn(Oi(Oi({},this.baseProviderConfig),{},{onProviderChange: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(),!1!==n.openMenu&&(!e.isWideEnoughToOpenMenu||null!=n&&n.searchCanceled||setTimeout((function(){e.updateSideMenu("search","open")}),0))}}))),this.bookreader.options.enableBookmarks&&(t.bookmarks=new Xo(Oi(Oi({},this.baseProviderConfig),{},{onProviderChange:function(t){var n=Object.keys(t).length?"add":"remove";e["".concat(n,"MenuShortcut")]("bookmarks"),e.updateMenuContents()}}))),this.bookreader.options.enableMultipleBooks&&(t.volumes=new ki(Oi(Oi({},this.baseProviderConfig),{},{onProviderChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;t&&(e.bookreader=t),e.updateMenuContents(),e.isWideEnoughToOpenMenu&&setTimeout((function(){e.updateSideMenu("volumes","open")}))}}))),Object.assign(this.menuProviders,t),this.addMenuShortcut("search"),this.addMenuShortcut("volumes"),this.updateMenuContents()}},{key:"mainBRContainer",get:function(){var e;return document.querySelector(null===(e=this.bookreader)||void 0===e?void 0:e.el)}},{key:"addFullscreenShortcut",value:function(){var e={icon:this.fullscreenShortcut,id:"fullscreen"};this.menuShortcuts.push(e),this.sortMenuShortcuts(),this.emitMenuShortcutsUpdated()}},{key:"deleteFullscreenShortcut",value:function(){var e=this.menuShortcuts.filter((function(e){return"fullscreen"!==e.id}));this.menuShortcuts=e,this.sortMenuShortcuts(),this.emitMenuShortcutsUpdated()}},{key:"closeFullscreen",value:function(){this.bookreader.exitFullScreen()}},{key:"fullscreenShortcut",get:function(){var e=this;return(0,r.qy)(pi||(pi=Ci(["\n <button\n @click=",'\n title="Exit fullscreen view"\n >',"</button>\n "])),(function(){return e.closeFullscreen()}),this.fullscreenBranding)}},{key:"updateSideMenu",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(e){var t=new CustomEvent(Ti,{detail:{menuId:e,action:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"open"}});this.dispatchEvent(t)}}},{key:"updateMenuContents",value:function(){var e=this.menuProviders,t=e.search,n=e.downloads,r=e.visualAdjustments,o=e.share,i=e.bookmarks,a=[e.volumes,e.chapters,t,i,r,o].filter((function(e){return!!e}));this.shouldShowDownloadsMenu()&&(null==n||n.update(this.downloadableTypes),a.splice(-2,0,n));var s=new CustomEvent("menuUpdated",{detail:a});this.dispatchEvent(s)}},{key:"shouldShowDownloadsMenu",value:function(){if(!this.downloadableTypes.length)return!1;if(!1===this.bookIsRestricted)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.menuProviders[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 r=e.menuShortcuts.find((function(e){return e.id===n}));return r&&t.push(r),t}),[])}},{key:"emitMenuShortcutsUpdated",value:function(){var e=new CustomEvent("menuShortcutsUpdated",{detail:this.menuShortcuts});this.dispatchEvent(e)}},{key:"emitLoadingStatusUpdate",value:function(e){var t=new CustomEvent("loadingStateUpdated",{detail:{loaded:e}});this.dispatchEvent(t)}},{key:"bindEventListeners",value:function(){var e=this;window.addEventListener("BookReader:PostInit",(function(t){e.bookreader=t.detail.props,e.bookreader.shell=e,e.bookReaderLoaded=!0,e.bookReaderCannotLoad=!1,e.emitLoadingStatusUpdate(!0),e.loadSharedObserver(),setTimeout((function(){e.bookreader.resize()}),0)})),window.addEventListener("BookReader:fullscreenToggled",(function(t){var n=t.detail.props,r=void 0===n?null:n;r&&(e.bookreader=r),e.manageFullScreenBehavior()}),{passive:!0}),window.addEventListener("BookReader:ToggleSearchMenu",(function(t){e.dispatchEvent(new CustomEvent(Ti,{detail:{menuId:"search",action:"toggle"}}))})),window.addEventListener("LendingFlow:PostInit",(function(t){var n=t.detail,r=n.downloadTypesAvailable,o=n.lendingStatus,i=n.isAdmin,a=n.previewType;e.lendingInitialized=!0,e.downloadableTypes=r,e.lendingStatus=o,e.isAdmin=i,e.bookReaderCannotLoad="singlePagePreview"===a,e.emitLoadingStatusUpdate(!0)})),window.addEventListener("BRJSIA:PostInit",(function(t){var n=t.detail,r=n.isRestricted,o=n.downloadURLs;e.bookReaderLoaded=!0,e.downloadableTypes=o,e.bookIsRestricted=r})),window.addEventListener("contextmenu",(function(t){return e.manageContextMenuVisibility(t)}),{capture:!0})}},{key:"manageContextMenuVisibility",value:function(e){var t,n;if(null===(t=window.archive_analytics)||void 0===t||t.send_event("BookReader","contextmenu-".concat(this.bookIsRestricted?"restricted":"unrestricted"),null===(n=e.target)||void 0===n||null===(n=n.classList)||void 0===n?void 0:n.value),this.bookIsRestricted&&e.target.classList.value.match(/BRscreen|BRpageimage/g))return e.preventDefault(),!1}},{key:"loadSharedObserver",value:function(){var e;this.sharedObserverHandler={handleResize:this.handleResize.bind(this)},null===(e=this.sharedObserver)||void 0===e||e.addObserver({target:this.mainBRContainer,handler:this.sharedObserverHandler})}},{key:"handleResize",value:function(e){var t=e.contentRect,n=e.target,r=this.brWidth,o=this.brHeight,i=this.bookreader.animating;n===this.mainBRContainer&&(this.brWidth=t.width,this.brHeight=t.height),!r&&this.brWidth&&this.initializeBookSubmenus();var a,s=r!==this.brWidth,l=o!==this.brHeight;i||!s&&!l||null===(a=this.bookreader)||void 0===a||a.resize()}},{key:"manageFullScreenBehavior",value:function(){this.emitFullScreenState(),this.bookreader.options.enableFSLogoShortcut&&(this.bookreader.isFullscreen()?this.addFullscreenShortcut():this.deleteFullscreenShortcut())}},{key:"emitFullScreenState",value:function(){var e=this.bookreader.isFullscreen(),t=new CustomEvent("ViewportInFullScreen",{detail:{isFullScreen:e}});this.dispatchEvent(t)}},{key:"itemImage",get:function(){var e,t=null===(e=this.itemMD)||void 0===e?void 0:e.metadata.identifier,n="https://".concat(this.baseHost,"/services/img/").concat(t);return(0,r.qy)(fi||(fi=Ci(['<img class="cover-img" src=',' alt="cover image for ','">'])),n,t)}},{key:"placeholder",get:function(){return(0,r.qy)(mi||(mi=Ci(['<div class="placeholder">',"</div>"])),this.itemImage)}},{key:"render",value:function(){return(0,r.qy)(vi||(vi=Ci(['<div id="book-navigator__root">\n ',"\n ","\n </div>\n "])),this.bookReaderCannotLoad?this.placeholder:r.s6,this.bookReaderCannotLoad?r.s6:(0,r.qy)(yi||(yi=Ci(['<slot name="main"></slot>']))))}}],[{key:"properties",get:function(){return{itemMD:{type:Object},bookReaderLoaded:{type:Boolean},bookreader:{type:Object},bookIsRestricted:{type:Boolean},downloadableTypes:{type:Array},isAdmin:{type:Boolean},lendingInitialized:{type:Boolean},lendingStatus:{type:Object},menuProviders:{type:Object},menuShortcuts:{type:Array},signedIn:{type:Boolean},loaded:{type:Boolean},sharedObserver:{type:Object,attribute:!1},modal:{type:Object,attribute:!1},fullscreenBranding:{type:Object}}}},{key:"styles",get:function(){return(0,r.AH)(bi||(bi=Ci(["\n :host,\n #book-navigator__root,\n slot,\n slot > * {\n display: block;\n height: inherit;\n width: inherit;\n }\n .placeholder {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n margin: 5%;\n }\n .cover-img {\n max-height: 300px;\n }\n "])))}}])}(r.WF);customElements.define("book-navigator",Di);class _i{constructor(){this.resizeObserver=new ResizeObserver((e=>{window.requestAnimationFrame((()=>{for(const t of e){const e=this.resizeHandlers.get(t.target);null==e||e.forEach((e=>{e.handleResize(t)}))}}))})),this.resizeHandlers=new Map}shutdown(){this.resizeHandlers.forEach(((e,t)=>{this.resizeObserver.unobserve(t)})),this.resizeHandlers.clear()}addObserver(e){var t;const n=null!==(t=this.resizeHandlers.get(e.target))&&void 0!==t?t:new Set;n.add(e.handler),this.resizeHandlers.set(e.target,n),this.resizeObserver.observe(e.target,e.options)}removeObserver(e){const t=this.resizeHandlers.get(e.target);t&&(t.delete(e.handler),0===t.size&&(this.resizeObserver.unobserve(e.target),this.resizeHandlers.delete(e.target)))}}function $i(e){return $i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$i(e)}function Hi(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function qi(e){return function(e){if(Array.isArray(e))return Ri(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 Ri(e,t);var n={}.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)?Ri(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 Ri(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Fi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ni(r.key),r)}}function Ni(e){var t=function(e,t){if("object"!=$i(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=$i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==$i(t)?t:t+""}function Zi(e,t,n){return t=Ui(t),function(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)}(e,Wi()?Reflect.construct(t,n||[],Ui(e).constructor):t.apply(e,n))}function Wi(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Wi=function(){return!!e})()}function Ui(e){return Ui=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ui(e)}function Vi(e,t){return Vi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Vi(e,t)}var Gi=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Zi(this,t)).item=void 0,e.bookreader=void 0,e.baseHost="archive.org",e.fullscreen=!1,e.signedIn=!1,e.modal=void 0,e.sharedObserver=void 0,e.loaded=!1,e.menuShortcuts=[],e.menuContents=[],e.openMenuName="",e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Vi(e,t)}(t,e),function(e,t,n){return t&&Fi(e.prototype,t),n&&Fi(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"updated",value:function(){this.modal||this.setModalManager(),this.sharedObserver||(this.sharedObserver=new _i)}},{key:"itemNav",get:function(){return this.shadowRoot.querySelector("iaux-item-navigator")}},{key:"setModalManager",value:function(){var e=document.querySelector("modal-manager");e||(e=document.createElement("modal-manager"),document.body.appendChild(e)),this.modal=e}},{key:"manageFullscreen",value:function(e){var t=!!e.detail.isFullScreen;this.fullscreen=t,this.dispatchEvent(new CustomEvent("fullscreenStateUpdated",{detail:{fullscreen:t}}))}},{key:"loadingStateUpdated",value:function(e){var t=e.detail.loaded;this.loaded=t||null,this.dispatchEvent(new CustomEvent("loadingStateUpdated",{detail:{loaded:t}}))}},{key:"setMenuShortcuts",value:function(e){this.menuShortcuts=qi(e.detail)}},{key:"setMenuContents",value:function(e){var t=qi(e.detail);this.menuContents=t}},{key:"manageSideMenuEvents",value:function(e){var t,n=e.detail,r=n.menuId,o=n.action;if(r)if(this.openMenuName=r,"open"===o)null===(t=this.itemNav)||void 0===t||t.openShortcut(r);else if("toggle"===o){var i;null===(i=this.itemNav)||void 0===i||i.toggleMenu()}}},{key:"render",value:function(){return(0,r.qy)(Ii||(Ii=Hi(['\n <div class="main-component">\n <iaux-item-navigator\n ?viewportInFullscreen=',"\n .basehost=","\n .item=","\n .modal=","\n .loaded=","\n .sharedObserver=","\n ?signedIn=","\n .menuShortcuts=","\n .menuContents=","\n .openMenu=",'\n >\n <div slot="header">\n <slot name="header"></slot>\n </div>\n <div slot="main">\n <book-navigator\n .modal=',"\n .baseHost=","\n .itemMD=","\n ?signedIn=","\n ?sideMenuOpen=","\n .sharedObserver=","\n @ViewportInFullScreen=","\n @loadingStateUpdated=","\n @updateSideMenu=","\n @menuUpdated=","\n @menuShortcutsUpdated=",'\n >\n <div slot="main">\n <slot name="main"></slot>\n </div>\n </book-navigator>\n </div>\n </iaux-item-navigator>\n </div>\n '])),this.fullscreen,this.baseHost,this.item,this.modal,this.loaded,this.sharedObserver,this.signedIn,this.menuShortcuts,this.menuContents,this.openMenuName,this.modal,this.baseHost,this.item,this.signedIn,this.menuOpened,this.sharedObserver,this.manageFullscreen,this.loadingStateUpdated,this.manageSideMenuEvents,this.setMenuContents,this.setMenuShortcuts)}}],[{key:"properties",get:function(){return{item:{type:Object},baseHost:{type:String},signedIn:{type:Boolean},fullscreen:{type:Boolean,reflect:!0,attribute:!0},sharedObserver:{type:Object,attribute:!1},modal:{type:Object,attribute:!1},loaded:{type:Boolean},menuShortcuts:{type:Array},menuContents:{type:Array}}}},{key:"styles",get:function(){return(0,r.AH)(zi||(zi=Hi(['\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 background-color: var(--primaryBGColor);\n position: relative;\n }\n\n :host([fullscreen]),\n iaux-item-navigator[viewportinfullscreen] {\n position: fixed;\n inset: 0;\n height: 100%;\n min-height: unset;\n }\n\n .main-component {\n height: 100%;\n width: 100%;\n min-height: inherit;\n }\n\n div[slot="header"],\n div[slot="main"] {\n display: flex;\n width: 100%;\n }\n\n slot {\n display: block;\n flex: 1;\n }\n\n iaux-item-navigator {\n min-height: var(--br-height, inherit);\n height: var(--br-height, inherit);\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 '])))}}])}(r.WF);window.customElements.define("ia-bookreader",Gi)}},function(e){e(e.s=4497)}]);
1782
1782
  //# sourceMappingURL=ia-bookreader-bundle.js.map