text: !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.DownZip=r():e.DownZip=r()}(window,(function(){return function(e){var r={};function n(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(1&r&&(e=n(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(n.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)n.d(t,o,function(r){return e[r]}.bind(null,o));return t},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="",n(n.s=0)}([function(e,r,n){"use strict";n.r(r);var t=function(){function e(){var r=Error.call(this,"ServiceWorker is not supported.");return Object.setPrototypeOf(r,e.prototype),r}return e.prototype=Object.create(Error.prototype),e}(),o=n.p+"downzip-sw.js";function i(e,r){var n=o,i=r;return"function"==typeof e?n=e(n):i=e,"serviceWorker"in navigator?navigator.serviceWorker.register(n,i):Promise.reject(new t)}function a(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function u(e,r,n,t,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?r(c):Promise.resolve(c).then(t,o)}function c(e){return function(){var r=this,n=arguments;return new Promise((function(t,o){var i=e.apply(r,n);function a(e){u(i,t,o,a,c,"next",e)}function c(e){u(i,t,o,a,c,"throw",e)}a(void 0)}))}}function s(e,r){for(var n=0;n<r.length;n++){var t=r[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}var f=new function e(r){var n=this;!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"error",(function(e){console.error("[".concat(n.name,"] ").concat(e))})),a(this,"log",(function(e){})),this.name=r}("DownZip-Main"),p=function(){function e(){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this.worker=null}var r,n,t,o,a;return r=e,(n=[{key:"register",value:(a=c(regeneratorRuntime.mark((function e(){var r,n,t,o=this,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>0&&void 0!==a[0]?a[0]:{},n=function(e){return e},t=r.mapScriptUrl||n,e.next=5,i(t,{scope:"./".concat("downzip","/")}).then((function(e){f.log("[DownZip] Service worker registered successfully:",e),o.worker=e.installing||e.active})).catch((function(e){f.error("[DownZip] Service workers not loaded:",e)}));case 5:setInterval(c(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o.sendMessage("TICK");case 1:case"end":return e.stop()}}),e)}))),5e3);case 6:case"end":return e.stop()}}),e)}))),function(){return a.apply(this,arguments)})},{key:"sendMessage",value:function(e,r,n){this.worker.postMessage({command:e,data:r},n?[n]:void 0)}},{key:"downzip",value:(o=c(regeneratorRuntime.mark((function e(r,n,t){var o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.worker){e.next=3;break}return f.error("[DownZip] No service worker registered!"),e.abrupt("return");case 3:return e.abrupt("return",new Promise((function(e,i){var a=new MessageChannel;a.port1.addEventListener("message",(function(){return e("".concat("downzip","/download-").concat(r))})),a.port1.start(),o.sendMessage("INITIALIZE",{id:r,files:t,name:n},a.port2),setTimeout(i,5e3)})));case 4:case"end":return e.stop()}}),e,this)}))),function(e,r,n){return o.apply(this,arguments)})}])&&s(r.prototype,n),t&&s(r,t),e}();r.default=p}])}));