asteroid/bibi/extensions/extractor/on-the-fly.bibi-zip-loader.js
2023-12-27 22:39:56 -08:00

1 line
No EOL
14 KiB
JavaScript

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.LSZL=e():t.LSZL=e()}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){t.exports=r(2)},function(t,e,r){var n=function(t){"use strict";var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r,n){var o=e&&e.prototype instanceof y?e:y,a=Object.create(o.prototype),i=new O(n||[]);return a._invoke=function(t,e,r){var n=f;return function(o,a){if(n===h)throw new Error("Generator is already running");if(n===p){if("throw"===o)throw a;return A()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var u=T(i,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var c=s(t,e,r);if("normal"===c.type){if(n=r.done?p:l,c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=p,r.method="throw",r.arg=c.arg)}}}(t,r,i),a}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var f="suspendedStart",l="suspendedYield",h="executing",p="completed",v={};function y(){}function g(){}function d(){}var m={};m[a]=function(){return this};var w=Object.getPrototypeOf,b=w&&w(w(_([])));b&&b!==r&&n.call(b,a)&&(m=b);var k=d.prototype=y.prototype=Object.create(m);function x(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function E(t){var e;this._invoke=function(r,o){function a(){return new Promise(function(e,a){!function e(r,o,a,i){var u=s(t[r],t,o);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&n.call(f,"__await")?Promise.resolve(f.__await).then(function(t){e("next",t,a,i)},function(t){e("throw",t,a,i)}):Promise.resolve(f).then(function(t){c.value=t,a(c)},function(t){return e("throw",t,a,i)})}i(u.arg)}(r,o,e,a)})}return e=e?e.then(a,a):a()}}function T(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,T(t,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=s(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function D(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function _(t){if(t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}return{next:A}}function A(){return{value:e,done:!0}}return g.prototype=k.constructor=d,d.constructor=g,d[u]=g.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u in t||(t[u]="GeneratorFunction")),t.prototype=Object.create(k),t},t.awrap=function(t){return{__await:t}},x(E.prototype),E.prototype[i]=function(){return this},t.AsyncIterator=E,t.async=function(e,r,n,o){var a=new E(c(e,r,n,o));return t.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next()})},x(k),k[u]="Generator",k[a]=function(){return this},k.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=_,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(D),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return u.type="throw",u.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,v):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),D(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;D(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:_(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},function(t,e,r){"use strict";r.r(e);var n,o;r(1);function a(){var t,e,r=new Promise(function(r,n){t=r,e=n});return r.status=n.PENDING,r.attachPromise=function(o){o.then(function(e){r.status=n.RESOLVED,t(e)},function(t){r.status=n.REJECTED,e(t)})},r.attachMessage=function(o){var a=o.error,i=o.payload;a?(r.status=n.REJECTED,e(i)):(r.status=n.RESOLVED,t(i))},r}function i(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 u(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}!function(t){t[t.PENDING=0]="PENDING",t[t.RESOLVED=1]="RESOLVED",t[t.REJECTED=2]="REJECTED"}(n||(n={})),function(t){t.INIT="INIT",t.GET_DATA="GET_DATA",t.ABORT_DATA="ABORT_DATA",t.UPDATE_STATE="UPDATE_STATE"}(o||(o={}));var c=function(){function t(e){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.params=e,u(this,"resolvers",void 0),u(this,"worker",void 0),u(this,"onFallback",void 0),u(this,"onmessage",function(t){var e=t.data,n=e.type;if(n===o.INIT)r.resolvers.init.attachMessage(e);else if(n===o.GET_DATA){var a=e.meta,i=r.resolvers.getData[a];i&&i.attachMessage(e)}else n===o.UPDATE_STATE&&r.onFallback&&r.onFallback()}),u(this,"terminate",function(){Object.keys(r.resolvers.getData).forEach(r.abort),r.worker.terminate()});var n=a();this.resolvers={init:n,getData:{}},this.worker=new Worker(e.worker||"lszlw.js"),this.worker.onmessage=this.onmessage,this.worker.postMessage({type:o.INIT,payload:e})}var e,r,n;return e=t,(r=[{key:"getState",value:function(){return this.resolvers.init}},{key:"getBuffer",value:function(t){var e=this,r=this.resolvers.getData[t];if(r)return r;var n=a();return this.resolvers.getData[t]=n,this.worker.postMessage({type:o.GET_DATA,payload:t}),n.then(function(){delete e.resolvers.getData[t]},function(){delete e.resolvers.getData[t]}),n}},{key:"getExistsBuffer",value:function(t){var e=this.resolvers.getData[t];if(e)return e}},{key:"getPendingCount",value:function(){return Object.keys(this.resolvers.getData).length}},{key:"abort",value:function(t){this.resolvers.getData[t]&&this.worker.postMessage({type:o.ABORT_DATA,payload:t})}}])&&i(e.prototype,r),n&&i(e,n),t}();function s(){return!!document.uniqueID}function f(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function l(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){f(a,n,o,i,u,"next",t)}function u(t){f(a,n,o,i,u,"throw",t)}i(void 0)})}}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 p(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.d(e,"default",function(){return y});var v=4,y=function(){function t(e){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.params=e,p(this,"url",void 0),p(this,"debug",void 0),p(this,"setupWorkers",void 0),p(this,"prefetching",void 0),p(this,"prefetchAll",function(){if(r.prefetching)return r.prefetching;var t=l(regeneratorRuntime.mark(function t(){var e,n,o,a,i,u,c;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.getEntryNames();case 2:e=t.sent,n=!0,o=!1,a=void 0,t.prev=6,i=e[Symbol.iterator]();case 8:if(n=(u=i.next()).done){t.next=15;break}return c=u.value,t.next=12,r.getBuffer(c);case 12:n=!0,t.next=8;break;case 15:t.next=21;break;case 17:t.prev=17,t.t0=t.catch(6),o=!0,a=t.t0;case 21:t.prev=21,t.prev=22,n||null==i.return||i.return();case 24:if(t.prev=24,!o){t.next=27;break}throw a;case 27:return t.finish(24);case 28:return t.finish(21);case 29:case"end":return t.stop()}},t,null,[[6,17,21,29],[22,,24,28]])}))();return t.catch(function(){return r.prefetching=void 0}),r.prefetching=t}),p(this,"abort",function(){var t=l(regeneratorRuntime.mark(function t(e){var n,o;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.setupWorkers;case 2:for(n=t.sent,o=0;o<n.length;o++)n[o].abort(e);case 4:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),p(this,"getEntryNames",l(regeneratorRuntime.mark(function t(){var e,n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r.throwIfAbort(),t.next=3,r.setupWorkers;case 3:return e=t.sent,t.next=6,e[0].getState();case 6:return n=t.sent,t.abrupt("return",n.entryNames);case 8:case"end":return t.stop()}},t)}))),p(this,"getBuffer",function(){var t=l(regeneratorRuntime.mark(function t(e){var n,o,a,i,u;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r.throwIfAbort(),t.next=3,r.setupWorkers;case 3:n=t.sent,o=0;case 5:if(!(o<n.length)){t.next=13;break}if(a=n[o],!(i=a.getExistsBuffer(e))){t.next=10;break}return t.abrupt("return",i);case 10:o++,t.next=5;break;case 13:return t.next=15,r.getMostFreeWorker();case 15:return u=t.sent,t.abrupt("return",u.getBuffer(e));case 17:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}());var n=new URL(e.url,window.location.href).href;this.url=n,this.throwIfAbort(),this.setupWorkers=l(regeneratorRuntime.mark(function t(){var n,o,a,i,u;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=new c({url:r.url,worker:r.params.worker,noUseCache:s(),forceInMemoryCache:r.params.forceInMemoryCache,forceKeepCache:r.params.forceKeepCache}),t.next=3,n.getState();case 3:if(!t.sent.fallback){t.next=6;break}return t.abrupt("return",[n]);case 6:for(n.onFallback=function(){return r.fallback(n)},o=[n],a=e.multiply&&Math.max(e.multiply,1)||v,i=function(t){var e=new c({url:r.url,worker:r.params.worker,noUseCache:s(),forceKeepCache:!0});e.onFallback=function(){return r.fallback(e)},o.push(e)},u=1;u<a;u++)i();return t.abrupt("return",o);case 12:case"end":return t.stop()}},t)}))()}var e,r,n;return e=t,(r=[{key:"getMostFreeWorker",value:function(){var t=l(regeneratorRuntime.mark(function t(){var e,r,n,o,a,i,u;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.setupWorkers;case 2:for(e=t.sent,r=Number.POSITIVE_INFINITY,n=e[0],o=0,a=0;a<e.length;a++)i=e[a],u=i.getPendingCount(),r>u&&(r=u,n=i),o=Math.max(o,u);return t.abrupt("return",n);case 8:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()},{key:"throwIfAbort",value:function(){}},{key:"fallback",value:function(t){this.setupWorkers=this.setupWorkers.then(function(e){return e.filter(function(e){return e!==t})}).then(function(t){return t.forEach(function(t){return t.terminate()})}).then(function(){return[t]})}}])&&h(e.prototype,r),n&&h(e,n),t}()}]).default});