@internetarchive/bookreader 5.0.0-64 → 5.0.0-65
Sign up to get free protection for your applications and to get access to all the features.
- package/BookReader/BookReader.css +2 -1
- package/BookReader/BookReader.js +1 -1
- package/BookReader/BookReader.js.map +1 -1
- package/BookReader/ia-bookreader-bundle.js +2 -2
- package/BookReader/ia-bookreader-bundle.js.map +1 -1
- package/BookReader/plugins/plugin.search.js +1 -1
- package/BookReader/plugins/plugin.search.js.map +1 -1
- package/BookReader/plugins/plugin.tts.js +1 -1
- package/BookReader/plugins/plugin.tts.js.map +1 -1
- package/BookReader/plugins/plugin.url.js +1 -1
- package/BookReader/plugins/plugin.url.js.map +1 -1
- package/CHANGELOG.md +5 -0
- package/package.json +13 -13
- package/src/BookReader.js +0 -5
- package/src/BookReader/DebugConsole.js +0 -54
- package/tests/jest/BookReader/DebugConsole.test.js +0 -25
@@ -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){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)}]);
|
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},7045:function(t,e,r){var n=r(6339),o=r(3070);t.exports=function(t,e,r){return r.get&&n(r.get,e,{getter:!0}),r.set&&n(r.set,e,{setter:!0}),o.f(t,e,r)}},3197:function(t,e,r){"use strict";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),v=n("".toLowerCase),y=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,v=g;for(g&&d(e,"-");v<i;){var w=o;for(r=0;r<t.length;r++)(n=t[r])>=a&&n<w&&(w=n);var P=v+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(y(R+U%B))),S=c(U/B),k+=36}d(e,h(y(S))),m=b(l,P,v==g),l=0,v++}}l++,a++}return p(e,"")};t.exports=function(t){var e,r,n=[],o=g(m(v(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),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,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]+|[\u0000-\u0020]+$/g,ot=/[\t\n\r]/g,it=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},at={},st=d({},at,{" ":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}),ct=function(t,e){var r=v(t,0);return r>32&&r<127&&!p(e,t)?t:encodeURIComponent(t)},ht={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={},Ot={},Lt={},jt={},qt={},It={},Tt={},At={},Ft={},_t=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 _t(r,!0)),o=this.parse(a,null,n))throw L(o);(i=H(new B)).bindURL(this),this.searchParams=i}};_t.prototype={type:"URL",parse:function(t,e,r){var o,i,a,s,u,l=this,c=e||mt,h=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=C(t,nt,"")),t=C(t,ot,""),o=m(t);h<=o.length;){switch(i=o[h],c){case mt:if(!i||!A(G,i)){if(e)return W;c=vt;continue}f+=N(i),c=gt;break;case gt: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(ht,f)||"file"==f&&(l.includesCredentials()||null!==l.port)||"file"==l.scheme&&!l.host))return;if(l.scheme=f,e)return void(l.isSpecial()&&ht[l.scheme]==l.port&&(l.port=null));f="","file"==l.scheme?c=Ot:l.isSpecial()&&r&&r.scheme==l.scheme?c=yt:l.isSpecial()?c=St:"/"==o[h+1]?(c=bt,h++):(l.cannotBeABaseURL=!0,M(l.path,""),c=Tt)}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=Ft;break}c="file"==r.scheme?Ot:wt;continue;case yt:if("/"!=i||"/"!=o[h+1]){c=wt;continue}c=kt,h++;break;case bt:if("/"==i){c=Rt;break}c=It;continue;case wt: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=Pt;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=At;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=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="",c=Ft}break;case Pt:if(!l.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){l.username=r.username,l.password=r.password,l.host=r.host,l.port=r.port,c=It;continue}c=Rt}else c=kt;break;case St:if(c=kt,"/"!=i||"/"!=T(f,h+1))continue;h++;break;case kt:if("/"!=i&&"\\"!=i){c=Rt;continue}break;case Rt: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||y){var S=ct(P,lt);y?l.password+=S:l.username+=S}else y=!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=Ut}else f+=i;break;case Ut:case Bt:if(e&&"file"==l.scheme){c=jt;continue}if(":"!=i||v){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=qt,e)return;continue}"["==i?v=!0:"]"==i&&(v=!1),f+=i}else{if(""==f)return J;if(s=l.parseHost(f))return s;if(f="",c=Ht,e==Bt)return}break;case Ht: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===ht[l.scheme]?null:k,f=""}if(e)return;c=qt;continue}return Q}f+=i;break;case Ot:if(l.scheme="file","/"==i||"\\"==i)c=Lt;else{if(!r||"file"!=r.scheme){c=It;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=At;else{if("#"!=i){pt(F(g(o,h),""))||(l.host=r.host,l.path=g(r.path),l.shortenPath()),c=It;continue}l.host=r.host,l.path=g(r.path),l.query=r.query,l.fragment="",c=Ft}}break;case Lt:if("/"==i||"\\"==i){c=jt;break}r&&"file"==r.scheme&&!pt(F(g(o,h),""))&&(ft(r.path[0],!0)?M(l.path,r.path[0]):l.host=r.host),c=It;continue;case jt:if(i==n||"/"==i||"\\"==i||"?"==i||"#"==i){if(!e&&ft(f))c=It;else if(""==f){if(l.host="",e)return;c=qt}else{if(s=l.parseHost(f))return s;if("localhost"==l.host&&(l.host=""),e)return;f="",c=qt}continue}f+=i;break;case qt:if(l.isSpecial()){if(c=It,"/"!=i&&"\\"!=i)continue}else if(e||"?"!=i)if(e||"#"!=i){if(i!=n&&(c=It,"/"!=i))continue}else l.fragment="",c=Ft;else l.query="",c=At;break;case It: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,"")):dt(f)?"/"==i||"\\"==i&&l.isSpecial()||M(l.path,""):("file"==l.scheme&&!l.path.length&&ft(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=At):"#"==i&&(l.fragment="",c=Ft)}else f+=ct(i,ut);break;case Tt:"?"==i?(l.query="",c=At):"#"==i?(l.fragment="",c=Ft):i!=n&&(l.path[0]+=ct(i,at));break;case At:e||"#"!=i?i!=n&&("'"==i&&l.isSpecial()?l.query+="%27":l.query+="#"==i?"%23":ct(i,at)):(l.fragment="",c=Ft);break;case Ft:i!=n&&(l.fragment+=ct(i,st))}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=y(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+=ct(r[n],at);this.host=e}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return p(ht,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,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+=it(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 Et(t.path[0]).origin}catch(t){return"null"}return"file"!=t&&this.isSpecial()?t+"://"+it(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+=ct(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+=ct(e[r],lt)}},getHost:function(){var t=this.host,e=this.port;return null===t?"":null===e?it(t):it(t)+":"+e},setHost:function(t){this.cannotBeABaseURL||this.parse(t,Ut)},getHostname:function(){var t=this.host;return null===t?"":it(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,qt))},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 Et=function(t){var e=f(this,Mt),r=P(arguments.length,1)>1?arguments[1]:void 0,n=R(e,new _t(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())},Mt=Et.prototype,Ct=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(Mt,"href",Ct("serialize","setHref")),h(Mt,"origin",Ct("getOrigin")),h(Mt,"protocol",Ct("getProtocol","setProtocol")),h(Mt,"username",Ct("getUsername","setUsername")),h(Mt,"password",Ct("getPassword","setPassword")),h(Mt,"host",Ct("getHost","setHost")),h(Mt,"hostname",Ct("getHostname","setHostname")),h(Mt,"port",Ct("getPort","setPort")),h(Mt,"pathname",Ct("getPathname","setPathname")),h(Mt,"search",Ct("getSearch","setSearch")),h(Mt,"searchParams",Ct("getSearchParams")),h(Mt,"hash",Ct("getHash","setHash"))),c(Mt,"toJSON",(function(){return U(this).serialize()}),{enumerable:!0}),c(Mt,"toString",(function(){return U(this).serialize()}),{enumerable:!0}),O){var xt=O.createObjectURL,zt=O.revokeObjectURL;xt&&c(Et,"createObjectURL",u(xt,O)),zt&&c(Et,"revokeObjectURL",u(zt,O))}w(Et,"URL"),o({global:!0,constructor:!0,forced:!a,sham:!i},{URL:Et})},285:function(t,e,r){r(8789)}},function(t){t(t.s=1226)}]);
|
2
2
|
//# sourceMappingURL=plugin.url.js.map
|