@internetarchive/bookreader 5.0.0-63 → 5.0.0-64

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. package/.github/workflows/node.js.yml +1 -0
  2. package/BookReader/BookReader.css +45 -58
  3. package/BookReader/BookReader.js +1 -1
  4. package/BookReader/BookReader.js.LICENSE.txt +2 -0
  5. package/BookReader/BookReader.js.map +1 -1
  6. package/BookReader/ia-bookreader-bundle.js +95 -95
  7. package/BookReader/ia-bookreader-bundle.js.LICENSE.txt +2 -0
  8. package/BookReader/ia-bookreader-bundle.js.map +1 -1
  9. package/BookReader/icons/1up.svg +1 -1
  10. package/BookReader/icons/2up.svg +1 -1
  11. package/BookReader/icons/advance.svg +1 -1
  12. package/BookReader/icons/chevron-right.svg +1 -1
  13. package/BookReader/icons/close-circle-dark.svg +1 -1
  14. package/BookReader/icons/close-circle.svg +1 -1
  15. package/BookReader/icons/fullscreen.svg +1 -1
  16. package/BookReader/icons/fullscreen_exit.svg +1 -1
  17. package/BookReader/icons/hamburger.svg +1 -1
  18. package/BookReader/icons/left-arrow.svg +1 -1
  19. package/BookReader/icons/magnify-minus.svg +1 -1
  20. package/BookReader/icons/magnify-plus.svg +1 -1
  21. package/BookReader/icons/magnify.svg +1 -1
  22. package/BookReader/icons/pause.svg +1 -1
  23. package/BookReader/icons/play.svg +1 -1
  24. package/BookReader/icons/playback-speed.svg +1 -1
  25. package/BookReader/icons/read-aloud.svg +1 -1
  26. package/BookReader/icons/review.svg +1 -1
  27. package/BookReader/icons/thumbnails.svg +1 -1
  28. package/BookReader/icons/voice.svg +1 -1
  29. package/BookReader/icons/volume-full.svg +1 -1
  30. package/BookReader/images/BRicons.svg +3 -3
  31. package/BookReader/images/books_graphic.svg +1 -1
  32. package/BookReader/images/icon_book.svg +1 -1
  33. package/BookReader/images/icon_bookmark.svg +1 -1
  34. package/BookReader/images/icon_gear.svg +1 -1
  35. package/BookReader/images/icon_hamburger.svg +1 -1
  36. package/BookReader/images/icon_home.svg +1 -1
  37. package/BookReader/images/icon_info.svg +1 -1
  38. package/BookReader/images/icon_one_page.svg +1 -1
  39. package/BookReader/images/icon_pause.svg +1 -1
  40. package/BookReader/images/icon_play.svg +1 -1
  41. package/BookReader/images/icon_search_button.svg +1 -1
  42. package/BookReader/images/icon_share.svg +1 -1
  43. package/BookReader/images/icon_skip-ahead.svg +1 -1
  44. package/BookReader/images/icon_skip-back.svg +1 -1
  45. package/BookReader/images/icon_speaker.svg +1 -1
  46. package/BookReader/images/icon_speaker_open.svg +1 -1
  47. package/BookReader/images/icon_thumbnails.svg +1 -1
  48. package/BookReader/images/icon_toc.svg +1 -1
  49. package/BookReader/images/icon_two_pages.svg +1 -1
  50. package/BookReader/images/marker_chap-off.svg +1 -1
  51. package/BookReader/images/marker_chap-on.svg +1 -1
  52. package/BookReader/images/marker_srch-on.svg +1 -1
  53. package/BookReader/jquery-3.js +1 -1
  54. package/BookReader/plugins/plugin.archive_analytics.js +1 -1
  55. package/BookReader/plugins/plugin.archive_analytics.js.map +1 -1
  56. package/BookReader/plugins/plugin.autoplay.js +1 -1
  57. package/BookReader/plugins/plugin.autoplay.js.map +1 -1
  58. package/BookReader/plugins/plugin.chapters.js +2 -1
  59. package/BookReader/plugins/plugin.chapters.js.LICENSE.txt +1 -0
  60. package/BookReader/plugins/plugin.chapters.js.map +1 -1
  61. package/BookReader/plugins/plugin.iframe.js.map +1 -1
  62. package/BookReader/plugins/plugin.mobile_nav.js +1 -1
  63. package/BookReader/plugins/plugin.mobile_nav.js.map +1 -1
  64. package/BookReader/plugins/plugin.resume.js +1 -1
  65. package/BookReader/plugins/plugin.resume.js.map +1 -1
  66. package/BookReader/plugins/plugin.search.js +2 -1
  67. package/BookReader/plugins/plugin.search.js.LICENSE.txt +1 -0
  68. package/BookReader/plugins/plugin.search.js.map +1 -1
  69. package/BookReader/plugins/plugin.text_selection.js +2 -1
  70. package/BookReader/plugins/plugin.text_selection.js.LICENSE.txt +1 -0
  71. package/BookReader/plugins/plugin.text_selection.js.map +1 -1
  72. package/BookReader/plugins/plugin.tts.js +1 -1
  73. package/BookReader/plugins/plugin.tts.js.LICENSE.txt +2 -0
  74. package/BookReader/plugins/plugin.tts.js.map +1 -1
  75. package/BookReader/plugins/plugin.url.js +1 -1
  76. package/BookReader/plugins/plugin.url.js.map +1 -1
  77. package/BookReader/plugins/plugin.vendor-fullscreen.js +1 -1
  78. package/BookReader/plugins/plugin.vendor-fullscreen.js.map +1 -1
  79. package/BookReader/webcomponents-bundle.js +1 -1
  80. package/BookReader/webcomponents-bundle.js.map +1 -1
  81. package/CHANGELOG.md +5 -0
  82. package/babel.config.js +5 -4
  83. package/netlify.toml +4 -0
  84. package/package.json +15 -15
  85. package/src/BookNavigator/search/search-results.js +1 -7
  86. package/src/BookReader/utils.js +10 -0
  87. package/src/css/_BRnav.scss +2 -2
  88. package/src/css/_BRsearch.scss +38 -10
  89. package/src/plugins/search/plugin.search.js +14 -21
  90. package/src/plugins/search/utils.js +43 -0
  91. package/src/plugins/search/view.js +11 -24
  92. package/tests/e2e/helpers/desktopSearch.js +3 -3
  93. package/tests/jest/BookNavigator/search/search-results.test.js +6 -1
  94. package/tests/jest/BookReader/utils.test.js +12 -0
  95. package/tests/jest/plugins/search/plugin.search.test.js +2 -39
  96. package/tests/jest/plugins/search/plugin.search.view.test.js +5 -0
  97. package/tests/jest/plugins/search/utils.js +25 -0
  98. package/tests/jest/plugins/search/utils.test.js +29 -0
@@ -1,2 +1,2 @@
1
- (self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[336],{1226:function(t,e,r){"use strict";function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}r(5827),r(1539),r(4916),r(5306),r(2222),r(6992),r(8783),r(3948),r(1637),r(489),r(2419),r(4819),r(5003),r(2526),r(1817),r(2165),r(4747),r(7941),r(9826),r(8309),r(9600),r(1249),r(7327),r(9714),r(285),r(8559),r(4723),r(3123),r(9720),r(3210),r(4765),r(7042),r(1038);var i,s=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,t),this.bookReaderOptions=e,this.urlSchema=[{name:"page",position:"path",default:"n0"},{name:"mode",position:"path",default:"2up"},{name:"search",position:"path",deprecated_for:"q"},{name:"q",position:"query_param"},{name:"sort",position:"query_param"},{name:"view",position:"query_param"},{name:"admin",position:"query_param"}],this.urlState={},this.urlMode=this.bookReaderOptions.urlMode||"hash",this.urlHistoryBasePath=this.bookReaderOptions.urlHistoryBasePath||"/",this.urlLocationPollId=null,this.oldLocationHash=null,this.oldUserHash=null}var e,r;return e=t,(r=[{key:"urlStateToUrlString",value:function(t){var e=this,r=new URLSearchParams,n={};Object.keys(t).forEach((function(o){var a,i,s,u,l=e.urlSchema.find((function(t){return t.name===o}));null!==(a=l)&&void 0!==a&&a.deprecated_for&&(l=e.urlSchema.find((function(t){return t.name===l.deprecated_for}))),"path"==(null===(i=l)||void 0===i?void 0:i.position)?n[null===(s=l)||void 0===s?void 0:s.name]=t[o]:r.append((null===(u=l)||void 0===u?void 0:u.name)||o,t[o])}));var o=this.urlSchema.filter((function(t){return"path"==t.position})).map((function(t){return n[t.name]?"".concat(t.name,"/").concat(n[t.name]):""})).join("/"),a="".concat(o.replace(/\/+/g,"/").replace(/\/+$/,"")),i="".concat(a,"?").concat(r.toString());return r.toString()?i:"".concat(a)}},{key:"urlStringToUrlState",value:function(t){var e={},r=new URL(t,"http://example.com"),o=Object.fromEntries(r.searchParams.entries()),a=r.pathname.match(/[^\\/]+\/[^\\/]+/g),i=a?Object.fromEntries(a.map((function(t){return t.split("/")}))):{},s=function(t,e){return Object.keys(t).some((function(t){return t==e}))};return this.urlSchema.filter((function(t){return"path"==t.position})).forEach((function(t){var r=s(i,t.name);s(t,"deprecated_for")&&r?e[t.deprecated_for]=i[t.name]:r&&(e[t.name]=i[t.name])})),Object.entries(o).forEach((function(t){var r,o,a=(o=2,function(t){if(Array.isArray(t))return t}(r=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a=[],i=!0,s=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(a.push(n.value),!e||a.length!==e);i=!0);}catch(t){s=!0,o=t}finally{try{i||null==r.return||r.return()}finally{if(s)throw o}}return a}}(r,o)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(r,o)||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.")}()),i=a[0],s=a[1];e[i]=s})),e}},{key:"setUrlParam",value:function(t,e){this.urlState[t]=e,this.pushToAddressBar()}},{key:"removeUrlParam",value:function(t){delete this.urlState[t],this.pushToAddressBar()}},{key:"getUrlParam",value:function(t){return this.urlState[t]}},{key:"pushToAddressBar",value:function(){var t=this.urlStateToUrlString(this.urlState),e="/"!==t?t:"";if("history"==this.urlMode)if(window.history&&window.history.replaceState){var r="".concat(this.urlHistoryBasePath).concat(e).trim().replace(/(\/+)/g,"/");try{window.history.replaceState({},null,r)}catch(t){this.urlMode="hash"}}else this.options.urlMode="hash";"hash"==this.urlMode&&window.location.replace("#"+e),this.oldLocationHash=t}},{key:"listenForHashChanges",value:function(){var t=this;this.oldLocationHash=window.location.hash.substr(1),this.urlLocationPollId&&(clearInterval(this.urlLocationPollId),this.urlLocationPollId=null),this.urlLocationPollId=setInterval((function(){var e=window.location.hash.substr(1);e!=t.oldLocationHash&&(t.urlState=t.urlStringToUrlState(e))}),500)}},{key:"pullFromAddressBar",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location,e="history"===this.urlMode?t.pathname.substr(this.urlHistoryBasePath.length)+t.search:t.hash.substr(1);this.urlState=this.urlStringToUrlState(e)}}])&&a(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function c(){return(c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=f(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}}).apply(this,arguments)}function f(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=m(t)););return t}function p(t,e){return(p=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function d(t,e){if(e&&("object"===u(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function m(t){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r(3609).extend(BookReader.defaultOptions,{enableUrlPlugin:!0,bookId:"",defaults:null,updateWindowTitle:!1,urlMode:"hash",urlHistoryBasePath:"/",urlTrackedParams:["page","search","mode","region","highlight","view"],urlTrackIndex0:!1}),BookReader.prototype.setup=(i=BookReader.prototype.setup,function(t){i.call(this,t),this.bookId=t.bookId,this.defaults=t.defaults,this.locationPollId=null,this.oldLocationHash=null,this.oldUserHash=null}),BookReader.prototype.init=function(t){return function(){var e=this;this.options.enableUrlPlugin&&(this.bind(BookReader.eventNames.PostInit,(function(){var t=e.options,r=t.updateWindowTitle,n=t.urlMode;r&&(document.title=e.shortTitle(e.bookTitle,50)),"hash"===n&&e.urlStartLocationPolling()})),this.bind(BookReader.eventNames.fragmentChange,this.urlUpdateFragment.bind(this))),t.call(this)}}(BookReader.prototype.init),BookReader.prototype.shortTitle=function(t){return this.bookTitle.length<t?this.bookTitle:"".concat(this.bookTitle.substr(0,t-3),"...")},BookReader.prototype.urlStartLocationPolling=function(){var t=this;this.oldLocationHash=this.urlReadFragment(),this.locationPollId&&(clearInterval(this.locationPollId),this.locationPollId=null),this.locationPollId=setInterval((function(){var e=t.urlReadFragment();if(e!=t.oldLocationHash&&e!=t.oldUserHash){var r=t.paramsFromFragment(e),n=function(){return t.updateFromParams(r)};t.trigger(BookReader.eventNames.stop),t.animating?(t.autoStop&&t.autoStop(),t.animationFinishedCallback=n):n(),t.oldUserHash=e}}),500)},BookReader.prototype.urlUpdateFragment=function(){var t=this.paramsFromCurrent(),e=this.options,r=e.urlTrackIndex0,n=e.urlTrackedParams;r||void 0===t.index||0!==t.index||(delete t.index,delete t.page);var o=n.reduce((function(e,r){return r in t&&(e[r]=t[r]),e}),{}),a=this.fragmentFromParams(o,this.options.urlMode),i=this.urlReadFragment(),s=this.getLocationSearch(),u=this.queryStringFromParams(o,s,this.options.urlMode);if(i!==a||s!==u){if("history"===this.options.urlMode)if(window.history&&window.history.replaceState){var l=this.options.urlHistoryBasePath.replace(/\/+$/,""),h=""===a?"":"/".concat(a),c="".concat(l).concat(h).concat(u);try{window.history.replaceState({},null,c),this.oldLocationHash=a+u}catch(t){this.options.urlMode="hash"}}else this.options.urlMode="hash";if("hash"===this.options.urlMode){var f=this.urlParamsFiltersOnlySearch(this.readQueryString());window.location.replace("#"+a+f),this.oldLocationHash=a+f}}},BookReader.prototype.urlParamsFiltersOnlySearch=function(t){var e=new URLSearchParams(t);return e.has("q")?"?".concat(new URLSearchParams({q:e.get("q")})):""},BookReader.prototype.urlReadFragment=function(){var t=this.options,e=t.urlMode,r=t.urlHistoryBasePath;return"history"===e?window.location.pathname.substr(r.length):window.location.hash.substr(1)},BookReader.prototype.urlReadHashFragment=function(){return window.location.hash.substr(1)};var g=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e)}(i,BookReader);var e,r,n,o,a=(n=i,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=m(n);if(o){var r=m(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return d(this,t)});function i(){return l(this,i),a.apply(this,arguments)}return e=i,(r=[{key:"init",value:function(){var t=this;this.options.enableUrlPlugin&&(this.urlPlugin=new s(this.options),this.bind(BookReader.eventNames.PostInit,(function(){"hash"===t.options.urlMode&&t.urlPlugin.listenForHashChanges()}))),c(m(i.prototype),"init",this).call(this)}}])&&h(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),i}();window.BookReader=g},3197:function(t,e,r){"use strict";var n=r(7854),o=r(1702),a=2147483647,i=/[^\0-\u007E]/,s=/[.\u3002\uFF0E\uFF61]/g,u="Overflow: input needs wider integers to process",l=n.RangeError,h=o(s.exec),c=Math.floor,f=String.fromCharCode,p=o("".charCodeAt),d=o([].join),m=o([].push),g=o("".replace),v=o("".split),y=o("".toLowerCase),b=function(t){return t+22+75*(t<26)},w=function(t,e,r){var n=0;for(t=r?c(t/700):t>>1,t+=c(t/e);t>455;)t=c(t/35),n+=36;return c(n+36*t/(t+38))},P=function(t){var e,r,n=[],o=(t=function(t){for(var e=[],r=0,n=t.length;r<n;){var o=p(t,r++);if(o>=55296&&o<=56319&&r<n){var a=p(t,r++);56320==(64512&a)?m(e,((1023&o)<<10)+(1023&a)+65536):(m(e,o),r--)}else m(e,o)}return e}(t)).length,i=128,s=0,h=72;for(e=0;e<t.length;e++)(r=t[e])<128&&m(n,f(r));var g=n.length,v=g;for(g&&m(n,"-");v<o;){var y=a;for(e=0;e<t.length;e++)(r=t[e])>=i&&r<y&&(y=r);var P=v+1;if(y-i>c((a-s)/P))throw l(u);for(s+=(y-i)*P,i=y,e=0;e<t.length;e++){if((r=t[e])<i&&++s>a)throw l(u);if(r==i){for(var S=s,k=36;;){var R=k<=h?1:k>=h+26?26:k-h;if(S<R)break;var U=S-R,B=36-R;m(n,f(b(R+U%B))),S=c(U/B),k+=36}m(n,f(b(S))),h=w(s,P,v==g),s=0,v++}}s++,i++}return d(n,"")};t.exports=function(t){var e,r,n=[],o=v(g(y(t),s,"."),".");for(e=0;e<o.length;e++)r=o[e],m(n,h(i,r)?"xn--"+P(r):r);return d(n,".")}},6091:function(t,e,r){var n=r(6530).PROPER,o=r(7293),a=r(1361);t.exports=function(t){return o((function(){return!!a[t]()||"​…᠎"!=="​…᠎"[t]()||n&&a[t].name!==t}))}},9720:function(t,e,r){var n=r(2109),o=r(4699).entries;n({target:"Object",stat:!0},{entries:function(t){return o(t)}})},8559:function(t,e,r){var n=r(2109),o=r(408),a=r(6135);n({target:"Object",stat:!0},{fromEntries:function(t){var e={};return o(t,(function(t,r){a(e,t,r)}),{AS_ENTRIES:!0}),e}})},3210:function(t,e,r){"use strict";var n=r(2109),o=r(3111).trim;n({target:"String",proto:!0,forced:r(6091)("trim")},{trim:function(){return o(this)}})},8789:function(t,e,r){"use strict";r(8783);var n,o=r(2109),a=r(9781),i=r(590),s=r(7854),u=r(9974),l=r(1702),h=r(6048).f,c=r(1320),f=r(5787),p=r(2597),d=r(1574),m=r(8457),g=r(1589),v=r(8710).codeAt,y=r(3197),b=r(1340),w=r(8003),P=r(8053),S=r(5556),k=r(9909),R=k.set,U=k.getterFor("URL"),B=S.URLSearchParams,H=S.getState,L=s.URL,O=s.TypeError,q=s.parseInt,j=Math.floor,I=Math.pow,T=l("".charAt),A=l(/./.exec),F=l([].join),_=l(1..toString),M=l([].pop),C=l([].push),E=l("".replace),x=l([].shift),z=l("".split),$=l("".slice),N=l("".toLowerCase),D=l([].unshift),W="Invalid scheme",J="Invalid host",Q="Invalid port",G=/[a-z]/i,K=/[\d+-.a-z]/i,V=/\d/,X=/^0x/i,Y=/^[0-7]+$/,Z=/^\d+$/,tt=/^[\da-f]+$/i,et=/[\0\t\n\r #%/:<>?@[\\\]^|]/,rt=/[\0\t\n\r #/:<>?@[\\\]^|]/,nt=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,ot=/[\t\n\r]/g,at=function(t){var e,r,n,o;if("number"==typeof t){for(e=[],r=0;r<4;r++)D(e,t%256),t=j(t/256);return F(e,".")}if("object"==typeof t){for(e="",n=function(t){for(var e=null,r=1,n=null,o=0,a=0;a<8;a++)0!==t[a]?(o>r&&(e=n,r=o),n=null,o=0):(null===n&&(n=a),++o);return o>r&&(e=n,r=o),e}(t),r=0;r<8;r++)o&&0===t[r]||(o&&(o=!1),n===r?(e+=r?":":"::",o=!0):(e+=_(t[r],16),r<7&&(e+=":")));return"["+e+"]"}return t},it={},st=d({},it,{" ":1,'"':1,"<":1,">":1,"`":1}),ut=d({},st,{"#":1,"?":1,"{":1,"}":1}),lt=d({},ut,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),ht=function(t,e){var r=v(t,0);return r>32&&r<127&&!p(e,t)?t:encodeURIComponent(t)},ct={ftp:21,file:null,http:80,https:443,ws:80,wss:443},ft=function(t,e){var r;return 2==t.length&&A(G,T(t,0))&&(":"==(r=T(t,1))||!e&&"|"==r)},pt=function(t){var e;return t.length>1&&ft($(t,0,2))&&(2==t.length||"/"===(e=T(t,2))||"\\"===e||"?"===e||"#"===e)},dt=function(t){return"."===t||"%2e"===N(t)},mt={},gt={},vt={},yt={},bt={},wt={},Pt={},St={},kt={},Rt={},Ut={},Bt={},Ht={},Lt={},Ot={},qt={},jt={},It={},Tt={},At={},Ft={},_t=function(t,e,r){var n,o,a,i=b(t);if(e){if(o=this.parse(i))throw O(o);this.searchParams=null}else{if(void 0!==r&&(n=new _t(r,!0)),o=this.parse(i,null,n))throw O(o);(a=H(new B)).bindURL(this),this.searchParams=a}};_t.prototype={type:"URL",parse:function(t,e,r){var o,a,i,s,u,l=this,h=e||mt,c=0,f="",d=!1,v=!1,y=!1;for(t=b(t),e||(l.scheme="",l.username="",l.password="",l.host=null,l.port=null,l.path=[],l.query=null,l.fragment=null,l.cannotBeABaseURL=!1,t=E(t,nt,"")),t=E(t,ot,""),o=m(t);c<=o.length;){switch(a=o[c],h){case mt:if(!a||!A(G,a)){if(e)return W;h=vt;continue}f+=N(a),h=gt;break;case gt:if(a&&(A(K,a)||"+"==a||"-"==a||"."==a))f+=N(a);else{if(":"!=a){if(e)return W;f="",h=vt,c=0;continue}if(e&&(l.isSpecial()!=p(ct,f)||"file"==f&&(l.includesCredentials()||null!==l.port)||"file"==l.scheme&&!l.host))return;if(l.scheme=f,e)return void(l.isSpecial()&&ct[l.scheme]==l.port&&(l.port=null));f="","file"==l.scheme?h=Lt:l.isSpecial()&&r&&r.scheme==l.scheme?h=yt:l.isSpecial()?h=St:"/"==o[c+1]?(h=bt,c++):(l.cannotBeABaseURL=!0,C(l.path,""),h=Tt)}break;case vt:if(!r||r.cannotBeABaseURL&&"#"!=a)return W;if(r.cannotBeABaseURL&&"#"==a){l.scheme=r.scheme,l.path=g(r.path),l.query=r.query,l.fragment="",l.cannotBeABaseURL=!0,h=Ft;break}h="file"==r.scheme?Lt:wt;continue;case yt:if("/"!=a||"/"!=o[c+1]){h=wt;continue}h=kt,c++;break;case bt:if("/"==a){h=Rt;break}h=It;continue;case wt:if(l.scheme=r.scheme,a==n)l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,l.path=g(r.path),l.query=r.query;else if("/"==a||"\\"==a&&l.isSpecial())h=Pt;else if("?"==a)l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,l.path=g(r.path),l.query="",h=At;else{if("#"!=a){l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,l.path=g(r.path),l.path.length--,h=It;continue}l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,l.path=g(r.path),l.query=r.query,l.fragment="",h=Ft}break;case Pt:if(!l.isSpecial()||"/"!=a&&"\\"!=a){if("/"!=a){l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,h=It;continue}h=Rt}else h=kt;break;case St:if(h=kt,"/"!=a||"/"!=T(f,c+1))continue;c++;break;case kt:if("/"!=a&&"\\"!=a){h=Rt;continue}break;case Rt:if("@"==a){d&&(f="%40"+f),d=!0,i=m(f);for(var w=0;w<i.length;w++){var P=i[w];if(":"!=P||y){var S=ht(P,lt);y?l.password+=S:l.username+=S}else y=!0}f=""}else if(a==n||"/"==a||"?"==a||"#"==a||"\\"==a&&l.isSpecial()){if(d&&""==f)return"Invalid authority";c-=m(f).length+1,f="",h=Ut}else f+=a;break;case Ut:case Bt:if(e&&"file"==l.scheme){h=qt;continue}if(":"!=a||v){if(a==n||"/"==a||"?"==a||"#"==a||"\\"==a&&l.isSpecial()){if(l.isSpecial()&&""==f)return J;if(e&&""==f&&(l.includesCredentials()||null!==l.port))return;if(s=l.parseHost(f))return s;if(f="",h=jt,e)return;continue}"["==a?v=!0:"]"==a&&(v=!1),f+=a}else{if(""==f)return J;if(s=l.parseHost(f))return s;if(f="",h=Ht,e==Bt)return}break;case Ht:if(!A(V,a)){if(a==n||"/"==a||"?"==a||"#"==a||"\\"==a&&l.isSpecial()||e){if(""!=f){var k=q(f,10);if(k>65535)return Q;l.port=l.isSpecial()&&k===ct[l.scheme]?null:k,f=""}if(e)return;h=jt;continue}return Q}f+=a;break;case Lt:if(l.scheme="file","/"==a||"\\"==a)h=Ot;else{if(!r||"file"!=r.scheme){h=It;continue}if(a==n)l.host=r.host,l.path=g(r.path),l.query=r.query;else if("?"==a)l.host=r.host,l.path=g(r.path),l.query="",h=At;else{if("#"!=a){pt(F(g(o,c),""))||(l.host=r.host,l.path=g(r.path),l.shortenPath()),h=It;continue}l.host=r.host,l.path=g(r.path),l.query=r.query,l.fragment="",h=Ft}}break;case Ot:if("/"==a||"\\"==a){h=qt;break}r&&"file"==r.scheme&&!pt(F(g(o,c),""))&&(ft(r.path[0],!0)?C(l.path,r.path[0]):l.host=r.host),h=It;continue;case qt:if(a==n||"/"==a||"\\"==a||"?"==a||"#"==a){if(!e&&ft(f))h=It;else if(""==f){if(l.host="",e)return;h=jt}else{if(s=l.parseHost(f))return s;if("localhost"==l.host&&(l.host=""),e)return;f="",h=jt}continue}f+=a;break;case jt:if(l.isSpecial()){if(h=It,"/"!=a&&"\\"!=a)continue}else if(e||"?"!=a)if(e||"#"!=a){if(a!=n&&(h=It,"/"!=a))continue}else l.fragment="",h=Ft;else l.query="",h=At;break;case It:if(a==n||"/"==a||"\\"==a&&l.isSpecial()||!e&&("?"==a||"#"==a)){if(".."===(u=N(u=f))||"%2e."===u||".%2e"===u||"%2e%2e"===u?(l.shortenPath(),"/"==a||"\\"==a&&l.isSpecial()||C(l.path,"")):dt(f)?"/"==a||"\\"==a&&l.isSpecial()||C(l.path,""):("file"==l.scheme&&!l.path.length&&ft(f)&&(l.host&&(l.host=""),f=T(f,0)+":"),C(l.path,f)),f="","file"==l.scheme&&(a==n||"?"==a||"#"==a))for(;l.path.length>1&&""===l.path[0];)x(l.path);"?"==a?(l.query="",h=At):"#"==a&&(l.fragment="",h=Ft)}else f+=ht(a,ut);break;case Tt:"?"==a?(l.query="",h=At):"#"==a?(l.fragment="",h=Ft):a!=n&&(l.path[0]+=ht(a,it));break;case At:e||"#"!=a?a!=n&&("'"==a&&l.isSpecial()?l.query+="%27":l.query+="#"==a?"%23":ht(a,it)):(l.fragment="",h=Ft);break;case Ft:a!=n&&(l.fragment+=ht(a,st))}c++}},parseHost:function(t){var e,r,n;if("["==T(t,0)){if("]"!=T(t,t.length-1))return J;if(!(e=function(t){var e,r,n,o,a,i,s,u=[0,0,0,0,0,0,0,0],l=0,h=null,c=0,f=function(){return T(t,c)};if(":"==f()){if(":"!=T(t,1))return;c+=2,h=++l}for(;f();){if(8==l)return;if(":"!=f()){for(e=r=0;r<4&&A(tt,f());)e=16*e+q(f(),16),c++,r++;if("."==f()){if(0==r)return;if(c-=r,l>6)return;for(n=0;f();){if(o=null,n>0){if(!("."==f()&&n<4))return;c++}if(!A(V,f()))return;for(;A(V,f());){if(a=q(f(),10),null===o)o=a;else{if(0==o)return;o=10*o+a}if(o>255)return;c++}u[l]=256*u[l]+o,2!=++n&&4!=n||l++}if(4!=n)return;break}if(":"==f()){if(c++,!f())return}else if(f())return;u[l++]=e}else{if(null!==h)return;c++,h=++l}}if(null!==h)for(i=l-h,l=7;0!=l&&i>0;)s=u[l],u[l--]=u[h+i-1],u[h+--i]=s;else if(8!=l)return;return u}($(t,1,-1))))return J;this.host=e}else if(this.isSpecial()){if(t=y(t),A(et,t))return J;if(null===(e=function(t){var e,r,n,o,a,i,s,u=z(t,".");if(u.length&&""==u[u.length-1]&&u.length--,(e=u.length)>4)return t;for(r=[],n=0;n<e;n++){if(""==(o=u[n]))return t;if(a=10,o.length>1&&"0"==T(o,0)&&(a=A(X,o)?16:8,o=$(o,8==a?1:2)),""===o)i=0;else{if(!A(10==a?Z:8==a?Y:tt,o))return t;i=q(o,a)}C(r,i)}for(n=0;n<e;n++)if(i=r[n],n==e-1){if(i>=I(256,5-e))return null}else if(i>255)return null;for(s=M(r),n=0;n<r.length;n++)s+=r[n]*I(256,3-n);return s}(t)))return J;this.host=e}else{if(A(rt,t))return J;for(e="",r=m(t),n=0;n<r.length;n++)e+=ht(r[n],it);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return p(ct,this.scheme)},shortenPath:function(){var t=this.path,e=t.length;!e||"file"==this.scheme&&1==e&&ft(t[0],!0)||t.length--},serialize:function(){var t=this,e=t.scheme,r=t.username,n=t.password,o=t.host,a=t.port,i=t.path,s=t.query,u=t.fragment,l=e+":";return null!==o?(l+="//",t.includesCredentials()&&(l+=r+(n?":"+n:"")+"@"),l+=at(o),null!==a&&(l+=":"+a)):"file"==e&&(l+="//"),l+=t.cannotBeABaseURL?i[0]:i.length?"/"+F(i,"/"):"",null!==s&&(l+="?"+s),null!==u&&(l+="#"+u),l},setHref:function(t){var e=this.parse(t);if(e)throw O(e);this.searchParams.update()},getOrigin:function(){var t=this.scheme,e=this.port;if("blob"==t)try{return new Mt(t.path[0]).origin}catch(t){return"null"}return"file"!=t&&this.isSpecial()?t+"://"+at(this.host)+(null!==e?":"+e:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(t){this.parse(b(t)+":",mt)},getUsername:function(){return this.username},setUsername:function(t){var e=m(b(t));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<e.length;r++)this.username+=ht(e[r],lt)}},getPassword:function(){return this.password},setPassword:function(t){var e=m(b(t));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<e.length;r++)this.password+=ht(e[r],lt)}},getHost:function(){var t=this.host,e=this.port;return null===t?"":null===e?at(t):at(t)+":"+e},setHost:function(t){this.cannotBeABaseURL||this.parse(t,Ut)},getHostname:function(){var t=this.host;return null===t?"":at(t)},setHostname:function(t){this.cannotBeABaseURL||this.parse(t,Bt)},getPort:function(){var t=this.port;return null===t?"":b(t)},setPort:function(t){this.cannotHaveUsernamePasswordPort()||(""==(t=b(t))?this.port=null:this.parse(t,Ht))},getPathname:function(){var t=this.path;return this.cannotBeABaseURL?t[0]:t.length?"/"+F(t,"/"):""},setPathname:function(t){this.cannotBeABaseURL||(this.path=[],this.parse(t,jt))},getSearch:function(){var t=this.query;return t?"?"+t:""},setSearch:function(t){""==(t=b(t))?this.query=null:("?"==T(t,0)&&(t=$(t,1)),this.query="",this.parse(t,At)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var t=this.fragment;return t?"#"+t:""},setHash:function(t){""!=(t=b(t))?("#"==T(t,0)&&(t=$(t,1)),this.fragment="",this.parse(t,Ft)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var Mt=function(t){var e=f(this,Ct),r=P(arguments.length,1)>1?arguments[1]:void 0,n=R(e,new _t(t,!1,r));a||(e.href=n.serialize(),e.origin=n.getOrigin(),e.protocol=n.getProtocol(),e.username=n.getUsername(),e.password=n.getPassword(),e.host=n.getHost(),e.hostname=n.getHostname(),e.port=n.getPort(),e.pathname=n.getPathname(),e.search=n.getSearch(),e.searchParams=n.getSearchParams(),e.hash=n.getHash())},Ct=Mt.prototype,Et=function(t,e){return{get:function(){return U(this)[t]()},set:e&&function(t){return U(this)[e](t)},configurable:!0,enumerable:!0}};if(a&&h(Ct,{href:Et("serialize","setHref"),origin:Et("getOrigin"),protocol:Et("getProtocol","setProtocol"),username:Et("getUsername","setUsername"),password:Et("getPassword","setPassword"),host:Et("getHost","setHost"),hostname:Et("getHostname","setHostname"),port:Et("getPort","setPort"),pathname:Et("getPathname","setPathname"),search:Et("getSearch","setSearch"),searchParams:Et("getSearchParams"),hash:Et("getHash","setHash")}),c(Ct,"toJSON",(function(){return U(this).serialize()}),{enumerable:!0}),c(Ct,"toString",(function(){return U(this).serialize()}),{enumerable:!0}),L){var xt=L.createObjectURL,zt=L.revokeObjectURL;xt&&c(Mt,"createObjectURL",u(xt,L)),zt&&c(Mt,"revokeObjectURL",u(zt,L))}w(Mt,"URL"),o({global:!0,forced:!i,sham:!a},{URL:Mt})},285:function(t,e,r){r(8789)}},function(t){t(t.s=1226)}]);
1
+ (self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[336],{1226:function(t,e,r){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(void 0,i=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(o.key),"symbol"===n(i)?i:String(i)),o)}var i}r(5827),r(1539),r(4916),r(5306),r(2222),r(6992),r(8783),r(3948),r(1637),r(489),r(2419),r(4819),r(5003),r(6649),r(6078),r(2526),r(1817),r(9653),r(2165),r(4747),r(7941),r(9826),r(8309),r(9600),r(1249),r(7327),r(9714),r(285),r(8559),r(4723),r(9720),r(3210),r(4765),r(7042),r(1038);var a,s=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.bookReaderOptions=e,this.urlSchema=[{name:"page",position:"path",default:"n0"},{name:"mode",position:"path",default:"2up"},{name:"search",position:"path",deprecated_for:"q"},{name:"q",position:"query_param"},{name:"sort",position:"query_param"},{name:"view",position:"query_param"},{name:"admin",position:"query_param"}],this.urlState={},this.urlMode=this.bookReaderOptions.urlMode||"hash",this.urlHistoryBasePath=this.bookReaderOptions.urlHistoryBasePath||"/",this.urlLocationPollId=null,this.oldLocationHash=null,this.oldUserHash=null}var e,r;return e=t,r=[{key:"urlStateToUrlString",value:function(t){var e=this,r=new URLSearchParams,n={};Object.keys(t).forEach((function(o){var i,a,s,u,l=e.urlSchema.find((function(t){return t.name===o}));null!==(i=l)&&void 0!==i&&i.deprecated_for&&(l=e.urlSchema.find((function(t){return t.name===l.deprecated_for}))),"path"==(null===(a=l)||void 0===a?void 0:a.position)?n[null===(s=l)||void 0===s?void 0:s.name]=t[o]:r.append((null===(u=l)||void 0===u?void 0:u.name)||o,t[o])}));var o=this.urlSchema.filter((function(t){return"path"==t.position})).map((function(t){return n[t.name]?"".concat(t.name,"/").concat(n[t.name]):""})).join("/"),i="".concat(o.replace(/\/+/g,"/").replace(/\/+$/,"")),a="".concat(i,"?").concat(r.toString());return r.toString()?a:"".concat(i)}},{key:"urlStringToUrlState",value:function(t){var e={},r=new URL(t,"http://example.com"),n=Object.fromEntries(r.searchParams.entries()),i=r.pathname.match(/[^\\/]+\/[^\\/]+/g),a=i?Object.fromEntries(i.map((function(t){return t.split("/")}))):{},s=function(t,e){return Object.keys(t).some((function(t){return t==e}))};return this.urlSchema.filter((function(t){return"path"==t.position})).forEach((function(t){var r=s(a,t.name);s(t,"deprecated_for")&&r?e[t.deprecated_for]=a[t.name]:r&&(e[t.name]=a[t.name])})),Object.entries(n).forEach((function(t){var r,n,i=(n=2,function(t){if(Array.isArray(t))return t}(r=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(r,n)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(r,n)||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.")}()),a=i[0],s=i[1];e[a]=s})),e}},{key:"setUrlParam",value:function(t,e){this.urlState[t]=e,this.pushToAddressBar()}},{key:"removeUrlParam",value:function(t){delete this.urlState[t],this.pushToAddressBar()}},{key:"getUrlParam",value:function(t){return this.urlState[t]}},{key:"pushToAddressBar",value:function(){var t=this.urlStateToUrlString(this.urlState),e="/"!==t?t:"";if("history"==this.urlMode)if(window.history&&window.history.replaceState){var r="".concat(this.urlHistoryBasePath).concat(e).trim().replace(/(\/+)/g,"/");try{window.history.replaceState({},null,r)}catch(t){this.urlMode="hash"}}else this.options.urlMode="hash";"hash"==this.urlMode&&window.location.replace("#"+e),this.oldLocationHash=t}},{key:"listenForHashChanges",value:function(){var t=this;this.oldLocationHash=window.location.hash.substr(1),this.urlLocationPollId&&(clearInterval(this.urlLocationPollId),this.urlLocationPollId=null),this.urlLocationPollId=setInterval((function(){var e=window.location.hash.substr(1);e!=t.oldLocationHash&&(t.urlState=t.urlStringToUrlState(e))}),500)}},{key:"pullFromAddressBar",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location,e="history"===this.urlMode?t.pathname.substr(this.urlHistoryBasePath.length)+t.search:t.hash.substr(1);this.urlState=this.urlStringToUrlState(e)}}],r&&i(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}function l(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,(void 0,o=function(t,e){if("object"!==u(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==u(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(n.key),"symbol"===u(o)?o:String(o)),n)}var o}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=f(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}},c.apply(this,arguments)}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}r(5311).extend(BookReader.defaultOptions,{enableUrlPlugin:!0,bookId:"",defaults:null,updateWindowTitle:!1,urlMode:"hash",urlHistoryBasePath:"/",urlTrackedParams:["page","search","mode","region","highlight","view"],urlTrackIndex0:!1}),BookReader.prototype.setup=(a=BookReader.prototype.setup,function(t){a.call(this,t),this.bookId=t.bookId,this.defaults=t.defaults,this.locationPollId=null,this.oldLocationHash=null,this.oldUserHash=null}),BookReader.prototype.init=function(t){return function(){var e=this;this.options.enableUrlPlugin&&(this.bind(BookReader.eventNames.PostInit,(function(){var t=e.options,r=t.updateWindowTitle,n=t.urlMode;r&&(document.title=e.shortTitle(e.bookTitle,50)),"hash"===n&&e.urlStartLocationPolling()})),this.bind(BookReader.eventNames.fragmentChange,this.urlUpdateFragment.bind(this))),t.call(this)}}(BookReader.prototype.init),BookReader.prototype.shortTitle=function(t){return this.bookTitle.length<t?this.bookTitle:"".concat(this.bookTitle.substr(0,t-3),"...")},BookReader.prototype.urlStartLocationPolling=function(){var t=this;this.oldLocationHash=this.urlReadFragment(),this.locationPollId&&(clearInterval(this.locationPollId),this.locationPollId=null),this.locationPollId=setInterval((function(){var e=t.urlReadFragment();if(e!=t.oldLocationHash&&e!=t.oldUserHash){var r=t.paramsFromFragment(e),n=function(){return t.updateFromParams(r)};t.trigger(BookReader.eventNames.stop),t.animating?(t.autoStop&&t.autoStop(),t.animationFinishedCallback=n):n(),t.oldUserHash=e}}),500)},BookReader.prototype.urlUpdateFragment=function(){var t=this.paramsFromCurrent(),e=this.options,r=e.urlTrackIndex0,n=e.urlTrackedParams;r||void 0===t.index||0!==t.index||(delete t.index,delete t.page);var o=n.reduce((function(e,r){return r in t&&(e[r]=t[r]),e}),{}),i=this.fragmentFromParams(o,this.options.urlMode),a=this.urlReadFragment(),s=this.getLocationSearch(),u=this.queryStringFromParams(o,s,this.options.urlMode);if(a!==i||s!==u){if("history"===this.options.urlMode)if(window.history&&window.history.replaceState){var l=this.options.urlHistoryBasePath.replace(/\/+$/,""),c=""===i?"":"/".concat(i),h="".concat(l).concat(c).concat(u);try{window.history.replaceState({},null,h),this.oldLocationHash=i+u}catch(t){this.options.urlMode="hash"}}else this.options.urlMode="hash";if("hash"===this.options.urlMode){var f=this.urlParamsFiltersOnlySearch(this.readQueryString());window.location.replace("#"+i+f),this.oldLocationHash=i+f}}},BookReader.prototype.urlParamsFiltersOnlySearch=function(t){var e=new URLSearchParams(t);return e.has("q")?"?".concat(new URLSearchParams({q:e.get("q")})):""},BookReader.prototype.urlReadFragment=function(){var t=this.options,e=t.urlMode,r=t.urlHistoryBasePath;return"history"===e?window.location.pathname.substr(r.length):window.location.hash.substr(1)},BookReader.prototype.urlReadHashFragment=function(){return window.location.hash.substr(1)};var p=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}(a,BookReader);var e,r,n,o,i=(n=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=f(n);if(o){var r=f(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===u(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function a(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),i.apply(this,arguments)}return e=a,(r=[{key:"init",value:function(){var t=this;this.options.enableUrlPlugin&&(this.urlPlugin=new s(this.options),this.bind(BookReader.eventNames.PostInit,(function(){"hash"===t.options.urlMode&&t.urlPlugin.listenForHashChanges()}))),c(f(a.prototype),"init",this).call(this)}}])&&l(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}();window.BookReader=p},3197:function(t,e,r){var n=r(1702),o=2147483647,i=/[^\0-\u007E]/,a=/[.\u3002\uFF0E\uFF61]/g,s="Overflow: input needs wider integers to process",u=RangeError,l=n(a.exec),c=Math.floor,h=String.fromCharCode,f=n("".charCodeAt),p=n([].join),d=n([].push),m=n("".replace),g=n("".split),y=n("".toLowerCase),v=function(t){return t+22+75*(t<26)},b=function(t,e,r){var n=0;for(t=r?c(t/700):t>>1,t+=c(t/e);t>455;)t=c(t/35),n+=36;return c(n+36*t/(t+38))},w=function(t){var e=[];t=function(t){for(var e=[],r=0,n=t.length;r<n;){var o=f(t,r++);if(o>=55296&&o<=56319&&r<n){var i=f(t,r++);56320==(64512&i)?d(e,((1023&o)<<10)+(1023&i)+65536):(d(e,o),r--)}else d(e,o)}return e}(t);var r,n,i=t.length,a=128,l=0,m=72;for(r=0;r<t.length;r++)(n=t[r])<128&&d(e,h(n));var g=e.length,y=g;for(g&&d(e,"-");y<i;){var w=o;for(r=0;r<t.length;r++)(n=t[r])>=a&&n<w&&(w=n);var P=y+1;if(w-a>c((o-l)/P))throw u(s);for(l+=(w-a)*P,a=w,r=0;r<t.length;r++){if((n=t[r])<a&&++l>o)throw u(s);if(n==a){for(var S=l,k=36;;){var R=k<=m?1:k>=m+26?26:k-m;if(S<R)break;var U=S-R,B=36-R;d(e,h(v(R+U%B))),S=c(U/B),k+=36}d(e,h(v(S))),m=b(l,P,y==g),l=0,y++}}l++,a++}return p(e,"")};t.exports=function(t){var e,r,n=[],o=g(m(y(t),a,"."),".");for(e=0;e<o.length;e++)r=o[e],d(n,l(i,r)?"xn--"+w(r):r);return p(n,".")}},6091:function(t,e,r){var n=r(6530).PROPER,o=r(7293),i=r(1361);t.exports=function(t){return o((function(){return!!i[t]()||"​…᠎"!=="​…᠎"[t]()||n&&i[t].name!==t}))}},9720:function(t,e,r){var n=r(2109),o=r(4699).entries;n({target:"Object",stat:!0},{entries:function(t){return o(t)}})},8559:function(t,e,r){var n=r(2109),o=r(408),i=r(6135);n({target:"Object",stat:!0},{fromEntries:function(t){var e={};return o(t,(function(t,r){i(e,t,r)}),{AS_ENTRIES:!0}),e}})},3210:function(t,e,r){"use strict";var n=r(2109),o=r(3111).trim;n({target:"String",proto:!0,forced:r(6091)("trim")},{trim:function(){return o(this)}})},8789:function(t,e,r){"use strict";r(8783);var n,o=r(2109),i=r(9781),a=r(5143),s=r(7854),u=r(9974),l=r(1702),c=r(8052),h=r(7045),f=r(5787),p=r(2597),d=r(1574),m=r(8457),g=r(1589),y=r(8710).codeAt,v=r(3197),b=r(1340),w=r(8003),P=r(8053),S=r(5556),k=r(9909),R=k.set,U=k.getterFor("URL"),B=S.URLSearchParams,H=S.getState,O=s.URL,L=s.TypeError,j=s.parseInt,q=Math.floor,I=Math.pow,T=l("".charAt),A=l(/./.exec),F=l([].join),_=l(1..toString),E=l([].pop),M=l([].push),C=l("".replace),x=l([].shift),z=l("".split),$=l("".slice),N=l("".toLowerCase),D=l([].unshift),W="Invalid scheme",J="Invalid host",Q="Invalid port",G=/[a-z]/i,K=/[\d+-.a-z]/i,V=/\d/,X=/^0x/i,Y=/^[0-7]+$/,Z=/^\d+$/,tt=/^[\da-f]+$/i,et=/[\0\t\n\r #%/:<>?@[\\\]^|]/,rt=/[\0\t\n\r #/:<>?@[\\\]^|]/,nt=/^[\u0000-\u0020]+/,ot=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,it=/[\t\n\r]/g,at=function(t){var e,r,n,o;if("number"==typeof t){for(e=[],r=0;r<4;r++)D(e,t%256),t=q(t/256);return F(e,".")}if("object"==typeof t){for(e="",n=function(t){for(var e=null,r=1,n=null,o=0,i=0;i<8;i++)0!==t[i]?(o>r&&(e=n,r=o),n=null,o=0):(null===n&&(n=i),++o);return o>r&&(e=n,r=o),e}(t),r=0;r<8;r++)o&&0===t[r]||(o&&(o=!1),n===r?(e+=r?":":"::",o=!0):(e+=_(t[r],16),r<7&&(e+=":")));return"["+e+"]"}return t},st={},ut=d({},st,{" ":1,'"':1,"<":1,">":1,"`":1}),lt=d({},ut,{"#":1,"?":1,"{":1,"}":1}),ct=d({},lt,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),ht=function(t,e){var r=y(t,0);return r>32&&r<127&&!p(e,t)?t:encodeURIComponent(t)},ft={ftp:21,file:null,http:80,https:443,ws:80,wss:443},pt=function(t,e){var r;return 2==t.length&&A(G,T(t,0))&&(":"==(r=T(t,1))||!e&&"|"==r)},dt=function(t){var e;return t.length>1&&pt($(t,0,2))&&(2==t.length||"/"===(e=T(t,2))||"\\"===e||"?"===e||"#"===e)},mt=function(t){return"."===t||"%2e"===N(t)},gt={},yt={},vt={},bt={},wt={},Pt={},St={},kt={},Rt={},Ut={},Bt={},Ht={},Ot={},Lt={},jt={},qt={},It={},Tt={},At={},Ft={},_t={},Et=function(t,e,r){var n,o,i,a=b(t);if(e){if(o=this.parse(a))throw L(o);this.searchParams=null}else{if(void 0!==r&&(n=new Et(r,!0)),o=this.parse(a,null,n))throw L(o);(i=H(new B)).bindURL(this),this.searchParams=i}};Et.prototype={type:"URL",parse:function(t,e,r){var o,i,a,s,u,l=this,c=e||gt,h=0,f="",d=!1,y=!1,v=!1;for(t=b(t),e||(l.scheme="",l.username="",l.password="",l.host=null,l.port=null,l.path=[],l.query=null,l.fragment=null,l.cannotBeABaseURL=!1,t=C(t,nt,""),t=C(t,ot,"$1")),t=C(t,it,""),o=m(t);h<=o.length;){switch(i=o[h],c){case gt:if(!i||!A(G,i)){if(e)return W;c=vt;continue}f+=N(i),c=yt;break;case yt:if(i&&(A(K,i)||"+"==i||"-"==i||"."==i))f+=N(i);else{if(":"!=i){if(e)return W;f="",c=vt,h=0;continue}if(e&&(l.isSpecial()!=p(ft,f)||"file"==f&&(l.includesCredentials()||null!==l.port)||"file"==l.scheme&&!l.host))return;if(l.scheme=f,e)return void(l.isSpecial()&&ft[l.scheme]==l.port&&(l.port=null));f="","file"==l.scheme?c=Lt:l.isSpecial()&&r&&r.scheme==l.scheme?c=bt:l.isSpecial()?c=kt:"/"==o[h+1]?(c=wt,h++):(l.cannotBeABaseURL=!0,M(l.path,""),c=At)}break;case vt:if(!r||r.cannotBeABaseURL&&"#"!=i)return W;if(r.cannotBeABaseURL&&"#"==i){l.scheme=r.scheme,l.path=g(r.path),l.query=r.query,l.fragment="",l.cannotBeABaseURL=!0,c=_t;break}c="file"==r.scheme?Lt:Pt;continue;case bt:if("/"!=i||"/"!=o[h+1]){c=Pt;continue}c=Rt,h++;break;case wt:if("/"==i){c=Ut;break}c=Tt;continue;case Pt:if(l.scheme=r.scheme,i==n)l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,l.path=g(r.path),l.query=r.query;else if("/"==i||"\\"==i&&l.isSpecial())c=St;else if("?"==i)l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,l.path=g(r.path),l.query="",c=Ft;else{if("#"!=i){l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,l.path=g(r.path),l.path.length--,c=Tt;continue}l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,l.path=g(r.path),l.query=r.query,l.fragment="",c=_t}break;case St:if(!l.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,c=Tt;continue}c=Ut}else c=Rt;break;case kt:if(c=Rt,"/"!=i||"/"!=T(f,h+1))continue;h++;break;case Rt:if("/"!=i&&"\\"!=i){c=Ut;continue}break;case Ut:if("@"==i){d&&(f="%40"+f),d=!0,a=m(f);for(var w=0;w<a.length;w++){var P=a[w];if(":"!=P||v){var S=ht(P,ct);v?l.password+=S:l.username+=S}else v=!0}f=""}else if(i==n||"/"==i||"?"==i||"#"==i||"\\"==i&&l.isSpecial()){if(d&&""==f)return"Invalid authority";h-=m(f).length+1,f="",c=Bt}else f+=i;break;case Bt:case Ht:if(e&&"file"==l.scheme){c=qt;continue}if(":"!=i||y){if(i==n||"/"==i||"?"==i||"#"==i||"\\"==i&&l.isSpecial()){if(l.isSpecial()&&""==f)return J;if(e&&""==f&&(l.includesCredentials()||null!==l.port))return;if(s=l.parseHost(f))return s;if(f="",c=It,e)return;continue}"["==i?y=!0:"]"==i&&(y=!1),f+=i}else{if(""==f)return J;if(s=l.parseHost(f))return s;if(f="",c=Ot,e==Ht)return}break;case Ot:if(!A(V,i)){if(i==n||"/"==i||"?"==i||"#"==i||"\\"==i&&l.isSpecial()||e){if(""!=f){var k=j(f,10);if(k>65535)return Q;l.port=l.isSpecial()&&k===ft[l.scheme]?null:k,f=""}if(e)return;c=It;continue}return Q}f+=i;break;case Lt:if(l.scheme="file","/"==i||"\\"==i)c=jt;else{if(!r||"file"!=r.scheme){c=Tt;continue}if(i==n)l.host=r.host,l.path=g(r.path),l.query=r.query;else if("?"==i)l.host=r.host,l.path=g(r.path),l.query="",c=Ft;else{if("#"!=i){dt(F(g(o,h),""))||(l.host=r.host,l.path=g(r.path),l.shortenPath()),c=Tt;continue}l.host=r.host,l.path=g(r.path),l.query=r.query,l.fragment="",c=_t}}break;case jt:if("/"==i||"\\"==i){c=qt;break}r&&"file"==r.scheme&&!dt(F(g(o,h),""))&&(pt(r.path[0],!0)?M(l.path,r.path[0]):l.host=r.host),c=Tt;continue;case qt:if(i==n||"/"==i||"\\"==i||"?"==i||"#"==i){if(!e&&pt(f))c=Tt;else if(""==f){if(l.host="",e)return;c=It}else{if(s=l.parseHost(f))return s;if("localhost"==l.host&&(l.host=""),e)return;f="",c=It}continue}f+=i;break;case It:if(l.isSpecial()){if(c=Tt,"/"!=i&&"\\"!=i)continue}else if(e||"?"!=i)if(e||"#"!=i){if(i!=n&&(c=Tt,"/"!=i))continue}else l.fragment="",c=_t;else l.query="",c=Ft;break;case Tt:if(i==n||"/"==i||"\\"==i&&l.isSpecial()||!e&&("?"==i||"#"==i)){if(".."===(u=N(u=f))||"%2e."===u||".%2e"===u||"%2e%2e"===u?(l.shortenPath(),"/"==i||"\\"==i&&l.isSpecial()||M(l.path,"")):mt(f)?"/"==i||"\\"==i&&l.isSpecial()||M(l.path,""):("file"==l.scheme&&!l.path.length&&pt(f)&&(l.host&&(l.host=""),f=T(f,0)+":"),M(l.path,f)),f="","file"==l.scheme&&(i==n||"?"==i||"#"==i))for(;l.path.length>1&&""===l.path[0];)x(l.path);"?"==i?(l.query="",c=Ft):"#"==i&&(l.fragment="",c=_t)}else f+=ht(i,lt);break;case At:"?"==i?(l.query="",c=Ft):"#"==i?(l.fragment="",c=_t):i!=n&&(l.path[0]+=ht(i,st));break;case Ft:e||"#"!=i?i!=n&&("'"==i&&l.isSpecial()?l.query+="%27":l.query+="#"==i?"%23":ht(i,st)):(l.fragment="",c=_t);break;case _t:i!=n&&(l.fragment+=ht(i,ut))}h++}},parseHost:function(t){var e,r,n;if("["==T(t,0)){if("]"!=T(t,t.length-1))return J;if(e=function(t){var e,r,n,o,i,a,s,u=[0,0,0,0,0,0,0,0],l=0,c=null,h=0,f=function(){return T(t,h)};if(":"==f()){if(":"!=T(t,1))return;h+=2,c=++l}for(;f();){if(8==l)return;if(":"!=f()){for(e=r=0;r<4&&A(tt,f());)e=16*e+j(f(),16),h++,r++;if("."==f()){if(0==r)return;if(h-=r,l>6)return;for(n=0;f();){if(o=null,n>0){if(!("."==f()&&n<4))return;h++}if(!A(V,f()))return;for(;A(V,f());){if(i=j(f(),10),null===o)o=i;else{if(0==o)return;o=10*o+i}if(o>255)return;h++}u[l]=256*u[l]+o,2!=++n&&4!=n||l++}if(4!=n)return;break}if(":"==f()){if(h++,!f())return}else if(f())return;u[l++]=e}else{if(null!==c)return;h++,c=++l}}if(null!==c)for(a=l-c,l=7;0!=l&&a>0;)s=u[l],u[l--]=u[c+a-1],u[c+--a]=s;else if(8!=l)return;return u}($(t,1,-1)),!e)return J;this.host=e}else if(this.isSpecial()){if(t=v(t),A(et,t))return J;if(e=function(t){var e,r,n,o,i,a,s,u=z(t,".");if(u.length&&""==u[u.length-1]&&u.length--,(e=u.length)>4)return t;for(r=[],n=0;n<e;n++){if(""==(o=u[n]))return t;if(i=10,o.length>1&&"0"==T(o,0)&&(i=A(X,o)?16:8,o=$(o,8==i?1:2)),""===o)a=0;else{if(!A(10==i?Z:8==i?Y:tt,o))return t;a=j(o,i)}M(r,a)}for(n=0;n<e;n++)if(a=r[n],n==e-1){if(a>=I(256,5-e))return null}else if(a>255)return null;for(s=E(r),n=0;n<r.length;n++)s+=r[n]*I(256,3-n);return s}(t),null===e)return J;this.host=e}else{if(A(rt,t))return J;for(e="",r=m(t),n=0;n<r.length;n++)e+=ht(r[n],st);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return p(ft,this.scheme)},shortenPath:function(){var t=this.path,e=t.length;!e||"file"==this.scheme&&1==e&&pt(t[0],!0)||t.length--},serialize:function(){var t=this,e=t.scheme,r=t.username,n=t.password,o=t.host,i=t.port,a=t.path,s=t.query,u=t.fragment,l=e+":";return null!==o?(l+="//",t.includesCredentials()&&(l+=r+(n?":"+n:"")+"@"),l+=at(o),null!==i&&(l+=":"+i)):"file"==e&&(l+="//"),l+=t.cannotBeABaseURL?a[0]:a.length?"/"+F(a,"/"):"",null!==s&&(l+="?"+s),null!==u&&(l+="#"+u),l},setHref:function(t){var e=this.parse(t);if(e)throw L(e);this.searchParams.update()},getOrigin:function(){var t=this.scheme,e=this.port;if("blob"==t)try{return new Mt(t.path[0]).origin}catch(t){return"null"}return"file"!=t&&this.isSpecial()?t+"://"+at(this.host)+(null!==e?":"+e:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(t){this.parse(b(t)+":",gt)},getUsername:function(){return this.username},setUsername:function(t){var e=m(b(t));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<e.length;r++)this.username+=ht(e[r],ct)}},getPassword:function(){return this.password},setPassword:function(t){var e=m(b(t));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<e.length;r++)this.password+=ht(e[r],ct)}},getHost:function(){var t=this.host,e=this.port;return null===t?"":null===e?at(t):at(t)+":"+e},setHost:function(t){this.cannotBeABaseURL||this.parse(t,Bt)},getHostname:function(){var t=this.host;return null===t?"":at(t)},setHostname:function(t){this.cannotBeABaseURL||this.parse(t,Ht)},getPort:function(){var t=this.port;return null===t?"":b(t)},setPort:function(t){this.cannotHaveUsernamePasswordPort()||(""==(t=b(t))?this.port=null:this.parse(t,Ot))},getPathname:function(){var t=this.path;return this.cannotBeABaseURL?t[0]:t.length?"/"+F(t,"/"):""},setPathname:function(t){this.cannotBeABaseURL||(this.path=[],this.parse(t,It))},getSearch:function(){var t=this.query;return t?"?"+t:""},setSearch:function(t){""==(t=b(t))?this.query=null:("?"==T(t,0)&&(t=$(t,1)),this.query="",this.parse(t,Ft)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var t=this.fragment;return t?"#"+t:""},setHash:function(t){""!=(t=b(t))?("#"==T(t,0)&&(t=$(t,1)),this.fragment="",this.parse(t,_t)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var Mt=function(t){var e=f(this,Ct),r=P(arguments.length,1)>1?arguments[1]:void 0,n=R(e,new Et(t,!1,r));i||(e.href=n.serialize(),e.origin=n.getOrigin(),e.protocol=n.getProtocol(),e.username=n.getUsername(),e.password=n.getPassword(),e.host=n.getHost(),e.hostname=n.getHostname(),e.port=n.getPort(),e.pathname=n.getPathname(),e.search=n.getSearch(),e.searchParams=n.getSearchParams(),e.hash=n.getHash())},Ct=Mt.prototype,xt=function(t,e){return{get:function(){return U(this)[t]()},set:e&&function(t){return U(this)[e](t)},configurable:!0,enumerable:!0}};if(i&&(h(Ct,"href",xt("serialize","setHref")),h(Ct,"origin",xt("getOrigin")),h(Ct,"protocol",xt("getProtocol","setProtocol")),h(Ct,"username",xt("getUsername","setUsername")),h(Ct,"password",xt("getPassword","setPassword")),h(Ct,"host",xt("getHost","setHost")),h(Ct,"hostname",xt("getHostname","setHostname")),h(Ct,"port",xt("getPort","setPort")),h(Ct,"pathname",xt("getPathname","setPathname")),h(Ct,"search",xt("getSearch","setSearch")),h(Ct,"searchParams",xt("getSearchParams")),h(Ct,"hash",xt("getHash","setHash"))),c(Ct,"toJSON",(function(){return U(this).serialize()}),{enumerable:!0}),c(Ct,"toString",(function(){return U(this).serialize()}),{enumerable:!0}),O){var zt=O.createObjectURL,$t=O.revokeObjectURL;zt&&c(Mt,"createObjectURL",u(zt,O)),$t&&c(Mt,"revokeObjectURL",u($t,O))}w(Mt,"URL"),o({global:!0,constructor:!0,forced:!a,sham:!i},{URL:Mt})},285:function(t,e,r){r(8789)}},function(t){t(t.s=1226)}]);
2
2
  //# sourceMappingURL=plugin.url.js.map