From e9a3bbef744d063a132f518b70931087aa2b921d Mon Sep 17 00:00:00 2001 From: Alessandro Pellizzari Date: Mon, 6 Dec 2021 15:45:11 +0100 Subject: [PATCH] release v1.1.24 --- dist/js-file-downloader.js | 1054 ++++++++++++++++++++++++++-- dist/js-file-downloader.js.map | 2 +- dist/js-file-downloader.min.js | 6 +- dist/js-file-downloader.min.js.map | 2 +- 4 files changed, 1015 insertions(+), 49 deletions(-) diff --git a/dist/js-file-downloader.js b/dist/js-file-downloader.js index 56112df..bc290fb 100644 --- a/dist/js-file-downloader.js +++ b/dist/js-file-downloader.js @@ -96,6 +96,783 @@ return /******/ (function(modules) { // webpackBootstrap /************************************************************************/ /******/ ({ +/***/ "./node_modules/@babel/runtime/regenerator/index.js": +/*!**********************************************************!*\ + !*** ./node_modules/@babel/runtime/regenerator/index.js ***! + \**********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! regenerator-runtime */ "./node_modules/regenerator-runtime/runtime.js"); + + +/***/ }), + +/***/ "./node_modules/regenerator-runtime/runtime.js": +/*!*****************************************************!*\ + !*** ./node_modules/regenerator-runtime/runtime.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +var runtime = (function (exports) { + "use strict"; + + var Op = Object.prototype; + var hasOwn = Op.hasOwnProperty; + var undefined; // More compressible than void 0. + var $Symbol = typeof Symbol === "function" ? Symbol : {}; + var iteratorSymbol = $Symbol.iterator || "@@iterator"; + var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + + function define(obj, key, value) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + return obj[key]; + } + try { + // IE 8 has a broken Object.defineProperty that only works on DOM objects. + define({}, ""); + } catch (err) { + define = function(obj, key, value) { + return obj[key] = value; + }; + } + + function wrap(innerFn, outerFn, self, tryLocsList) { + // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; + var generator = Object.create(protoGenerator.prototype); + var context = new Context(tryLocsList || []); + + // The ._invoke method unifies the implementations of the .next, + // .throw, and .return methods. + generator._invoke = makeInvokeMethod(innerFn, self, context); + + return generator; + } + exports.wrap = wrap; + + // Try/catch helper to minimize deoptimizations. Returns a completion + // record like context.tryEntries[i].completion. This interface could + // have been (and was previously) designed to take a closure to be + // invoked without arguments, but in all the cases we care about we + // already have an existing method we want to call, so there's no need + // to create a new function object. We can even get away with assuming + // the method takes exactly one argument, since that happens to be true + // in every case, so we don't have to touch the arguments object. The + // only additional allocation required is the completion record, which + // has a stable shape and so hopefully should be cheap to allocate. + function tryCatch(fn, obj, arg) { + try { + return { type: "normal", arg: fn.call(obj, arg) }; + } catch (err) { + return { type: "throw", arg: err }; + } + } + + var GenStateSuspendedStart = "suspendedStart"; + var GenStateSuspendedYield = "suspendedYield"; + var GenStateExecuting = "executing"; + var GenStateCompleted = "completed"; + + // Returning this object from the innerFn has the same effect as + // breaking out of the dispatch switch statement. + var ContinueSentinel = {}; + + // Dummy constructor functions that we use as the .constructor and + // .constructor.prototype properties for functions that return Generator + // objects. For full spec compliance, you may wish to configure your + // minifier not to mangle the names of these two functions. + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + + // This is a polyfill for %IteratorPrototype% for environments that + // don't natively support it. + var IteratorPrototype = {}; + define(IteratorPrototype, iteratorSymbol, function () { + return this; + }); + + var getProto = Object.getPrototypeOf; + var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + if (NativeIteratorPrototype && + NativeIteratorPrototype !== Op && + hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { + // This environment has a native %IteratorPrototype%; use it instead + // of the polyfill. + IteratorPrototype = NativeIteratorPrototype; + } + + var Gp = GeneratorFunctionPrototype.prototype = + Generator.prototype = Object.create(IteratorPrototype); + GeneratorFunction.prototype = GeneratorFunctionPrototype; + define(Gp, "constructor", GeneratorFunctionPrototype); + define(GeneratorFunctionPrototype, "constructor", GeneratorFunction); + GeneratorFunction.displayName = define( + GeneratorFunctionPrototype, + toStringTagSymbol, + "GeneratorFunction" + ); + + // Helper for defining the .next, .throw, and .return methods of the + // Iterator interface in terms of a single ._invoke method. + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function(method) { + define(prototype, method, function(arg) { + return this._invoke(method, arg); + }); + }); + } + + exports.isGeneratorFunction = function(genFun) { + var ctor = typeof genFun === "function" && genFun.constructor; + return ctor + ? ctor === GeneratorFunction || + // For the native GeneratorFunction constructor, the best we can + // do is to check its .name property. + (ctor.displayName || ctor.name) === "GeneratorFunction" + : false; + }; + + exports.mark = function(genFun) { + if (Object.setPrototypeOf) { + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; + define(genFun, toStringTagSymbol, "GeneratorFunction"); + } + genFun.prototype = Object.create(Gp); + return genFun; + }; + + // Within the body of any async function, `await x` is transformed to + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test + // `hasOwn.call(value, "__await")` to determine if the yielded value is + // meant to be awaited. + exports.awrap = function(arg) { + return { __await: arg }; + }; + + function AsyncIterator(generator, PromiseImpl) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if (record.type === "throw") { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + if (value && + typeof value === "object" && + hasOwn.call(value, "__await")) { + return PromiseImpl.resolve(value.__await).then(function(value) { + invoke("next", value, resolve, reject); + }, function(err) { + invoke("throw", err, resolve, reject); + }); + } + + return PromiseImpl.resolve(value).then(function(unwrapped) { + // When a yielded Promise is resolved, its final value becomes + // the .value of the Promise<{value,done}> result for the + // current iteration. + result.value = unwrapped; + resolve(result); + }, function(error) { + // If a rejected Promise was yielded, throw the rejection back + // into the async generator function so it can be handled there. + return invoke("throw", error, resolve, reject); + }); + } + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new PromiseImpl(function(resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + + return previousPromise = + // If enqueue has been called before, then we want to wait until + // all previous Promises have been resolved before calling invoke, + // so that results are always delivered in the correct order. If + // enqueue has not been called before, then it is important to + // call invoke immediately, without waiting on a callback to fire, + // so that the async generator function has the opportunity to do + // any necessary setup in a predictable way. This predictability + // is why the Promise constructor synchronously invokes its + // executor callback, and why async functions synchronously + // execute code before the first await. Since we implement simple + // async functions in terms of async generators, it is especially + // important to get this right, even though it requires care. + previousPromise ? previousPromise.then( + callInvokeWithMethodAndArg, + // Avoid propagating failures to Promises returned by later + // invocations of the iterator. + callInvokeWithMethodAndArg + ) : callInvokeWithMethodAndArg(); + } + + // Define the unified helper method that is used to implement .next, + // .throw, and .return (see defineIteratorMethods). + this._invoke = enqueue; + } + + defineIteratorMethods(AsyncIterator.prototype); + define(AsyncIterator.prototype, asyncIteratorSymbol, function () { + return this; + }); + exports.AsyncIterator = AsyncIterator; + + // Note that simple async functions are implemented on top of + // AsyncIterator objects; they just return a Promise for the value of + // the final result produced by the iterator. + exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) { + if (PromiseImpl === void 0) PromiseImpl = Promise; + + var iter = new AsyncIterator( + wrap(innerFn, outerFn, self, tryLocsList), + PromiseImpl + ); + + return exports.isGeneratorFunction(outerFn) + ? iter // If outerFn is a generator, return the full iterator. + : iter.next().then(function(result) { + return result.done ? result.value : iter.next(); + }); + }; + + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error("Generator is already running"); + } + + if (state === GenStateCompleted) { + if (method === "throw") { + throw arg; + } + + // Be forgiving, per 25.3.3.3.3 of the spec: + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume + return doneResult(); + } + + context.method = method; + context.arg = arg; + + while (true) { + var delegate = context.delegate; + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; + } + } + + if (context.method === "next") { + // Setting context._sent for legacy support of Babel's + // function.sent implementation. + context.sent = context._sent = context.arg; + + } else if (context.method === "throw") { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw context.arg; + } + + context.dispatchException(context.arg); + + } else if (context.method === "return") { + context.abrupt("return", context.arg); + } + + state = GenStateExecuting; + + var record = tryCatch(innerFn, self, context); + if (record.type === "normal") { + // If an exception is thrown from innerFn, we leave state === + // GenStateExecuting and loop back for another invocation. + state = context.done + ? GenStateCompleted + : GenStateSuspendedYield; + + if (record.arg === ContinueSentinel) { + continue; + } + + return { + value: record.arg, + done: context.done + }; + + } else if (record.type === "throw") { + state = GenStateCompleted; + // Dispatch the exception by looping back around to the + // context.dispatchException(context.arg) call above. + context.method = "throw"; + context.arg = record.arg; + } + } + }; + } + + // Call delegate.iterator[context.method](context.arg) and handle the + // result, either by returning a { value, done } result from the + // delegate iterator, or by modifying context.method and context.arg, + // setting context.delegate to null, and returning the ContinueSentinel. + function maybeInvokeDelegate(delegate, context) { + var method = delegate.iterator[context.method]; + if (method === undefined) { + // A .throw or .return when the delegate iterator has no .throw + // method always terminates the yield* loop. + context.delegate = null; + + if (context.method === "throw") { + // Note: ["return"] must be used for ES3 parsing compatibility. + if (delegate.iterator["return"]) { + // If the delegate iterator has a return method, give it a + // chance to clean up. + context.method = "return"; + context.arg = undefined; + maybeInvokeDelegate(delegate, context); + + if (context.method === "throw") { + // If maybeInvokeDelegate(context) changed context.method from + // "return" to "throw", let that override the TypeError below. + return ContinueSentinel; + } + } + + context.method = "throw"; + context.arg = new TypeError( + "The iterator does not provide a 'throw' method"); + } + + return ContinueSentinel; + } + + var record = tryCatch(method, delegate.iterator, context.arg); + + if (record.type === "throw") { + context.method = "throw"; + context.arg = record.arg; + context.delegate = null; + return ContinueSentinel; + } + + var info = record.arg; + + if (! info) { + context.method = "throw"; + context.arg = new TypeError("iterator result is not an object"); + context.delegate = null; + return ContinueSentinel; + } + + if (info.done) { + // Assign the result of the finished delegate to the temporary + // variable specified by delegate.resultName (see delegateYield). + context[delegate.resultName] = info.value; + + // Resume execution at the desired location (see delegateYield). + context.next = delegate.nextLoc; + + // If context.method was "throw" but the delegate handled the + // exception, let the outer generator proceed normally. If + // context.method was "next", forget context.arg since it has been + // "consumed" by the delegate iterator. If context.method was + // "return", allow the original .return call to continue in the + // outer generator. + if (context.method !== "return") { + context.method = "next"; + context.arg = undefined; + } + + } else { + // Re-yield the result returned by the delegate method. + return info; + } + + // The delegate iterator is finished, so forget it and continue with + // the outer generator. + context.delegate = null; + return ContinueSentinel; + } + + // Define Generator.prototype.{next,throw,return} in terms of the + // unified ._invoke helper method. + defineIteratorMethods(Gp); + + define(Gp, toStringTagSymbol, "Generator"); + + // A Generator should always return itself as the iterator object when the + // @@iterator function is called on it. Some browsers' implementations of the + // iterator prototype chain incorrectly implement this, causing the Generator + // object to not be returned from this call. This ensures that doesn't happen. + // See https://github.com/facebook/regenerator/issues/274 for more details. + define(Gp, iteratorSymbol, function() { + return this; + }); + + define(Gp, "toString", function() { + return "[object Generator]"; + }); + + function pushTryEntry(locs) { + var entry = { tryLoc: locs[0] }; + + if (1 in locs) { + entry.catchLoc = locs[1]; + } + + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; + } + + this.tryEntries.push(entry); + } + + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal"; + delete record.arg; + entry.completion = record; + } + + function Context(tryLocsList) { + // The root entry object (effectively a try statement without a catch + // or a finally block) gives us a place to store values thrown from + // locations where there is no enclosing try statement. + this.tryEntries = [{ tryLoc: "root" }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + exports.keys = function(object) { + var keys = []; + for (var key in object) { + keys.push(key); + } + keys.reverse(); + + // Rather than returning an object with a next method, we keep + // things simple and return the next function itself. + return function next() { + while (keys.length) { + var key = keys.pop(); + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } + + // To avoid creating an additional object, we just hang the .value + // and .done properties off the next function object itself. This + // also ensures that the minifier will not anonymize the function. + next.done = true; + return next; + }; + }; + + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } + + if (typeof iterable.next === "function") { + return iterable; + } + + if (!isNaN(iterable.length)) { + var i = -1, next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; + } + } + + next.value = undefined; + next.done = true; + + return next; + }; + + return next.next = next; + } + } + + // Return an iterator with no values. + return { next: doneResult }; + } + exports.values = values; + + function doneResult() { + return { value: undefined, done: true }; + } + + Context.prototype = { + constructor: Context, + + reset: function(skipTempReset) { + this.prev = 0; + this.next = 0; + // Resetting context._sent for legacy support of Babel's + // function.sent implementation. + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + + this.method = "next"; + this.arg = undefined; + + this.tryEntries.forEach(resetTryEntry); + + if (!skipTempReset) { + for (var name in this) { + // Not sure about the optimal order of these conditions: + if (name.charAt(0) === "t" && + hasOwn.call(this, name) && + !isNaN(+name.slice(1))) { + this[name] = undefined; + } + } + } + }, + + stop: function() { + this.done = true; + + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + if (rootRecord.type === "throw") { + throw rootRecord.arg; + } + + return this.rval; + }, + + dispatchException: function(exception) { + if (this.done) { + throw exception; + } + + var context = this; + function handle(loc, caught) { + record.type = "throw"; + record.arg = exception; + context.next = loc; + + if (caught) { + // If the dispatched exception was caught by a catch block, + // then let that catch block handle the exception normally. + context.method = "next"; + context.arg = undefined; + } + + return !! caught; + } + + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; + + if (entry.tryLoc === "root") { + // Exception thrown outside of any try block that could handle + // it, so set the completion value of the entire function to + // throw the exception. + return handle("end"); + } + + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"); + var hasFinally = hasOwn.call(entry, "finallyLoc"); + + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } + + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else { + throw new Error("try statement without catch or finally"); + } + } + } + }, + + abrupt: function(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && + hasOwn.call(entry, "finallyLoc") && + this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } + + if (finallyEntry && + (type === "break" || + type === "continue") && + finallyEntry.tryLoc <= arg && + arg <= finallyEntry.finallyLoc) { + // Ignore the finally entry if control is not jumping to a + // location outside the try/catch block. + finallyEntry = null; + } + + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; + + if (finallyEntry) { + this.method = "next"; + this.next = finallyEntry.finallyLoc; + return ContinueSentinel; + } + + return this.complete(record); + }, + + complete: function(record, afterLoc) { + if (record.type === "throw") { + throw record.arg; + } + + if (record.type === "break" || + record.type === "continue") { + this.next = record.arg; + } else if (record.type === "return") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } else if (record.type === "normal" && afterLoc) { + this.next = afterLoc; + } + + return ContinueSentinel; + }, + + finish: function(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) { + this.complete(entry.completion, entry.afterLoc); + resetTryEntry(entry); + return ContinueSentinel; + } + } + }, + + "catch": function(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } + return thrown; + } + } + + // The context.catch method must only be called with a location + // argument that corresponds to a known catch block. + throw new Error("illegal catch attempt"); + }, + + delegateYield: function(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + + if (this.method === "next") { + // Deliberately forget the last sent value so that we don't + // accidentally pass it on to the delegate. + this.arg = undefined; + } + + return ContinueSentinel; + } + }; + + // Regardless of whether this script is executing as a CommonJS module + // or not, return the runtime object so that we can declare the variable + // regeneratorRuntime in the outer scope, which allows this module to be + // injected easily by `bin/regenerator --include-runtime script.js`. + return exports; + +}( + // If this script is executing as a CommonJS module, use module.exports + // as the regeneratorRuntime namespace. Otherwise create a new empty + // object. Either way, the resulting object will be used to initialize + // the regeneratorRuntime variable at the top of this file. + true ? module.exports : undefined +)); + +try { + regeneratorRuntime = runtime; +} catch (accidentalStrictMode) { + // This module should not be running in strict mode, so the above + // assignment should always work unless something is misconfigured. Just + // in case runtime.js accidentally runs in strict mode, in modern engines + // we can explicitly access globalThis. In older engines we can escape + // strict mode using a global Function call. This could conceivably fail + // if a Content Security Policy forbids using Function, but in that case + // the proper solution is to fix the accidental strict mode problem. If + // you've misconfigured your bundler to force strict mode and applied a + // CSP to forbid Function, and you're not willing to fix either of those + // problems, please detail your unique predicament in a GitHub issue. + if (typeof globalThis === "object") { + globalThis.regeneratorRuntime = runtime; + } else { + Function("r", "regeneratorRuntime = r")(runtime); + } +} + + +/***/ }), + /***/ "./src/exception.js": /*!**************************!*\ !*** ./src/exception.js ***! @@ -167,9 +944,12 @@ var downloadException = DownloadException; "use strict"; __webpack_require__.r(__webpack_exports__); -/* harmony import */ var _exception__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./exception */ "./src/exception.js"); +/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"); +/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _exception__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./exception */ "./src/exception.js"); +/* harmony import */ var _signatures__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./signatures */ "./src/signatures.js"); /*! - * JS File Downloader v 1.1.23 + * JS File Downloader v 1.1.24 * https://github.com/AleeeKoi/js-file-downloader * * Copyright Alessandro Pellizzari @@ -178,6 +958,12 @@ __webpack_require__.r(__webpack_exports__); */ + + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } @@ -185,6 +971,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + var DEFAULT_PARAMS = { timeout: 40000, headers: [], @@ -197,7 +984,8 @@ var DEFAULT_PARAMS = { }, contentType: 'application/x-www-form-urlencoded', body: null, - nativeFallbackOnError: false + nativeFallbackOnError: false, + contentTypeDetermination: false }; var JsFileDownloader = /*#__PURE__*/function () { @@ -214,6 +1002,7 @@ var JsFileDownloader = /*#__PURE__*/function () { this.params = Object.assign({}, DEFAULT_PARAMS, customParams); this.link = this.createLink(); this.request = null; + this.downloadedFile = null; if (this.params.autoStart) return this.downloadFile(); return this; } @@ -253,21 +1042,38 @@ var JsFileDownloader = /*#__PURE__*/function () { this.request = this.createRequest(); if (!this.params.url) { - return reject(new _exception__WEBPACK_IMPORTED_MODULE_0__["DownloadException"]('url param not defined!', this.request)); + return reject(new _exception__WEBPACK_IMPORTED_MODULE_1__["DownloadException"]('url param not defined!', this.request)); } - this.request.onload = function () { - if (parseInt(_this2.request.status, 10) !== 200) { - return reject(new _exception__WEBPACK_IMPORTED_MODULE_0__["DownloadException"]("status code [".concat(_this2.request.status, "]"), _this2.request)); - } - - _this2.startDownload(); - - return resolve(_this2); - }; + this.request.onload = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee() { + return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (!(parseInt(_this2.request.status, 10) !== 200)) { + _context.next = 2; + break; + } + + return _context.abrupt("return", reject(new _exception__WEBPACK_IMPORTED_MODULE_1__["DownloadException"]("status code [".concat(_this2.request.status, "]"), _this2.request))); + + case 2: + _context.next = 4; + return _this2.startDownload(); + + case 4: + return _context.abrupt("return", resolve(_this2)); + + case 5: + case "end": + return _context.stop(); + } + } + }, _callee); + })); this.request.ontimeout = function () { - reject(new _exception__WEBPACK_IMPORTED_MODULE_0__["DownloadException"]('request timeout', _this2.request)); + reject(new _exception__WEBPACK_IMPORTED_MODULE_1__["DownloadException"]('request timeout', _this2.request)); }; this.request.onerror = function () { @@ -275,7 +1081,7 @@ var JsFileDownloader = /*#__PURE__*/function () { fallback(); resolve(_this2); } else { - reject(new _exception__WEBPACK_IMPORTED_MODULE_0__["DownloadException"]('network error', _this2.request)); + reject(new _exception__WEBPACK_IMPORTED_MODULE_1__["DownloadException"]('network error', _this2.request)); } }; @@ -333,6 +1139,97 @@ var JsFileDownloader = /*#__PURE__*/function () { var extractedName = contentParts && contentParts.length >= 1 ? contentParts[1] : this.params.url.split('/').pop().split('?')[0]; return this.params.nameCallback(extractedName); } + }, { + key: "getContentTypeFromFileSignature", + value: function getContentTypeFromFileSignature(file) { + var signatures = Object.assign({}, _signatures__WEBPACK_IMPORTED_MODULE_2__["fileSignatures"], this.params.customFileSignatures); + return new Promise(function (resolve, reject) { + var reader = new FileReader(); + var first4BytesOfFile = file.slice(0, 4); + + reader.onloadend = function (evt) { + if (evt.target.readyState !== FileReader.DONE) { + reject(); + return; + } // Since an array buffer is just a generic way to represent a binary buffer + // we need to create a TypedArray, in this case an Uint8Array + + + var uint = new Uint8Array(evt.target.result); + var bytes = []; + uint.forEach(function (byte) { + // transform every byte to hexadecimal + bytes.push(byte.toString(16)); + }); + var hex = bytes.join('').toUpperCase(); + resolve(signatures[hex]); + }; + + reader.onerror = reject; // read first 4 bytes of sliced file as an array buffer + + reader.readAsArrayBuffer(first4BytesOfFile); + }); + } + }, { + key: "getContentTypeFromResponseHeader", + value: function getContentTypeFromResponseHeader() { + return this.request.getResponseHeader('content-type'); + } + }, { + key: "getContentType", + value: function getContentType(response) { + var _this3 = this; + + return new Promise( /*#__PURE__*/function () { + var _ref2 = _asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(resolve) { + var contentTypeDetermination, defaultContentType, headerContentType, signatureContentType, _headerContentType, _signatureContentType, _ref3, _signatureContentType2; + + return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + contentTypeDetermination = _this3.params.contentTypeDetermination; + defaultContentType = 'application/octet-stream'; + + if (contentTypeDetermination === 'header' || contentTypeDetermination === 'full') { + headerContentType = _this3.getContentTypeFromResponseHeader(); + } + + if (!(contentTypeDetermination === 'signature' || contentTypeDetermination === 'full')) { + _context2.next = 7; + break; + } + + _context2.next = 6; + return _this3.getContentTypeFromFileSignature(new Blob([response])); + + case 6: + signatureContentType = _context2.sent; + + case 7: + if (contentTypeDetermination === 'header') { + resolve((_headerContentType = headerContentType) !== null && _headerContentType !== void 0 ? _headerContentType : defaultContentType); + } else if (contentTypeDetermination === 'signature') { + resolve((_signatureContentType = signatureContentType) !== null && _signatureContentType !== void 0 ? _signatureContentType : defaultContentType); + } else if (contentTypeDetermination === 'full') { + resolve((_ref3 = (_signatureContentType2 = signatureContentType) !== null && _signatureContentType2 !== void 0 ? _signatureContentType2 : headerContentType) !== null && _ref3 !== void 0 ? _ref3 : defaultContentType); + } else { + resolve(defaultContentType); + } + + case 8: + case "end": + return _context2.stop(); + } + } + }, _callee2); + })); + + return function (_x) { + return _ref2.apply(this, arguments); + }; + }()); + } }, { key: "createLink", value: function createLink() { @@ -356,41 +1253,93 @@ var JsFileDownloader = /*#__PURE__*/function () { } }, { key: "getFile", - value: function getFile(response, fileName) { - var file = null; - var options = { - type: 'application/octet-stream' - }; - - try { - file = new File([response], fileName, options); - } catch (e) { - file = new Blob([response], options); - file.name = fileName; - file.lastModifiedDate = new Date(); + value: function () { + var _getFile = _asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(response, fileName) { + var type, file, options; + return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + _context3.next = 2; + return this.getContentType(response); + + case 2: + type = _context3.sent; + options = { + type: type + }; + + try { + file = new File([response], fileName, options); + } catch (e) { + file = new Blob([response], options); + file.name = fileName; + file.lastModifiedDate = new Date(); + } + + return _context3.abrupt("return", file); + + case 6: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + + function getFile(_x2, _x3) { + return _getFile.apply(this, arguments); } - return file; - } + return getFile; + }() }, { key: "startDownload", - value: function startDownload() { - var fileName = this.getFileName(); - var file = this.getFile(this.request.response, fileName); // native IE - - if ('msSaveOrOpenBlob' in window.navigator) { - return window.navigator.msSaveOrOpenBlob(file, fileName); + value: function () { + var _startDownload = _asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee4() { + var fileName, objectUrl; + return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + fileName = this.getFileName(); + _context4.next = 3; + return this.getFile(this.request.response, fileName); + + case 3: + this.downloadedFile = _context4.sent; + + if (!('msSaveOrOpenBlob' in window.navigator)) { + _context4.next = 6; + break; + } + + return _context4.abrupt("return", window.navigator.msSaveOrOpenBlob(this.downloadedFile, fileName)); + + case 6: + objectUrl = window.URL.createObjectURL(this.downloadedFile); + this.link.href = objectUrl; + this.link.download = fileName; + this.clickLink(); + setTimeout(function () { + (window.URL || window.webkitURL || window).revokeObjectURL(objectUrl); + }, 1000 * 40); + return _context4.abrupt("return", this.downloadedFile); + + case 12: + case "end": + return _context4.stop(); + } + } + }, _callee4, this); + })); + + function startDownload() { + return _startDownload.apply(this, arguments); } - var objectUrl = window.URL.createObjectURL(file); - this.link.href = objectUrl; - this.link.download = fileName; - this.clickLink(); - setTimeout(function () { - (window.URL || window.webkitURL || window).revokeObjectURL(objectUrl); - }, 1000 * 40); - return this; - } + return startDownload; + }() }]); return JsFileDownloader; @@ -398,6 +1347,23 @@ var JsFileDownloader = /*#__PURE__*/function () { /* harmony default export */ __webpack_exports__["default"] = (JsFileDownloader); +/***/ }), + +/***/ "./src/signatures.js": +/*!***************************!*\ + !*** ./src/signatures.js ***! + \***************************/ +/*! exports provided: fileSignatures */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fileSignatures", function() { return fileSignatures; }); +var fileSignatures = { + '89504E47': 'image/png', + '25504446': 'application/pdf' +}; + /***/ }) /******/ })["default"]; diff --git a/dist/js-file-downloader.js.map b/dist/js-file-downloader.js.map index 69d21ed..3b2dd6f 100644 --- a/dist/js-file-downloader.js.map +++ b/dist/js-file-downloader.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://jsFileDownloader/webpack/universalModuleDefinition","webpack://jsFileDownloader/webpack/bootstrap","webpack://jsFileDownloader/./src/exception.js","webpack://jsFileDownloader/./src/index.js"],"names":["DownloadException","message","request","name","Error","downloadException","DEFAULT_PARAMS","timeout","headers","forceDesktopMode","autoStart","withCredentials","method","nameCallback","contentType","body","nativeFallbackOnError","JsFileDownloader","customParams","params","Object","assign","link","createLink","downloadFile","Promise","resolve","reject","initDownload","fallback","target","href","url","clickLink","isMobile","createRequest","onload","parseInt","status","startDownload","ontimeout","onerror","send","test","navigator","userAgent","XMLHttpRequest","open","setRequestHeader","forEach","header","value","responseType","process","addEventListener","onloadstart","includeCredentials","filename","content","getResponseHeader","contentParts","replace","match","extractedName","length","split","pop","document","createElement","style","display","event","MouseEvent","e","createEvent","initMouseEvent","window","dispatchEvent","response","fileName","file","options","type","File","Blob","lastModifiedDate","Date","getFileName","getFile","msSaveOrOpenBlob","objectUrl","URL","createObjectURL","download","setTimeout","webkitURL","revokeObjectURL"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;QCVA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA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,IAAL,GAAY4E,QAAZ;AACAC,YAAI,CAACK,gBAAL,GAAwB,IAAIC,IAAJ,EAAxB;AACD;;AACD,aAAON,IAAP;AACD;;;WAED,yBAAiB;AACf,UAAID,QAAQ,GAAG,KAAKQ,WAAL,EAAf;AACA,UAAIP,IAAI,GAAG,KAAKQ,OAAL,CAAa,KAAKtF,OAAL,CAAa4E,QAA1B,EAAoCC,QAApC,CAAX,CAFe,CAIf;;AACA,UAAI,sBAAsBH,MAAM,CAAChC,SAAjC,EAA4C;AAC1C,eAAOgC,MAAM,CAAChC,SAAP,CAAiB6C,gBAAjB,CAAkCT,IAAlC,EAAwCD,QAAxC,CAAP;AACD;;AAED,UAAIW,SAAS,GAAGd,MAAM,CAACe,GAAP,CAAWC,eAAX,CAA2BZ,IAA3B,CAAhB;AAEA,WAAK1D,IAAL,CAAUS,IAAV,GAAiB2D,SAAjB;AACA,WAAKpE,IAAL,CAAUuE,QAAV,GAAqBd,QAArB;AACA,WAAK9C,SAAL;AAEA6D,gBAAU,CAAC,YAAM;AACf,SAAClB,MAAM,CAACe,GAAP,IAAcf,MAAM,CAACmB,SAArB,IAAkCnB,MAAnC,EAA2CoB,eAA3C,CAA2DN,SAA3D;AACD,OAFS,EAEP,OAAO,EAFA,CAAV;AAIA,aAAO,IAAP;AACD;;;;;;AAGYzE,+EAAf,E","file":"js-file-downloader.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"jsFileDownloader\"] = factory();\n\telse\n\t\troot[\"jsFileDownloader\"] = factory();\n})(this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.js\");\n","export class DownloadException extends Error {\n constructor (message, request) {\n super(`Downloader error: ${message}`);\n this.request = request;\n this.name = 'DownloadException';\n }\n};\n\n/**\n * @deprecated use DownloadException instead, it will be removed in next releases!\n */\nexport const downloadException = DownloadException;\n","/*!\n * JS File Downloader v ##package_version##\n * https://github.com/AleeeKoi/js-file-downloader\n *\n * Copyright Alessandro Pellizzari\n * Released under the MIT license\n * http://opensource.org/licenses/MIT\n */\n\n'use strict';\n\nimport { DownloadException } from './exception';\n\nconst DEFAULT_PARAMS = {\n timeout: 40000,\n headers: [],\n forceDesktopMode: false,\n autoStart: true,\n withCredentials: false,\n method: 'GET',\n nameCallback: name => name,\n contentType: 'application/x-www-form-urlencoded',\n body: null,\n nativeFallbackOnError: false\n};\n\nclass JsFileDownloader {\n\n /**\n * Create a new JsFileDownloader instance\n * You need to define a {String} \"url\" params and other\n * @param {Object} customParams\n */\n constructor (customParams = {}) {\n this.params = Object.assign({}, DEFAULT_PARAMS, customParams);\n this.link = this.createLink();\n this.request = null;\n\n if (this.params.autoStart) return this.downloadFile();\n\n return this;\n }\n\n start () {\n return this.downloadFile();\n }\n\n downloadFile () {\n return new Promise((resolve, reject) => {\n this.initDownload(resolve, reject);\n });\n }\n\n initDownload (resolve, reject) {\n\n const fallback = () => {\n this.link.target = '_blank';\n this.link.href = this.params.url;\n this.clickLink();\n };\n\n // fallback for old browsers\n if (!('download' in this.link) || this.isMobile()) {\n fallback();\n return resolve();\n }\n\n this.request = this.createRequest();\n\n if (!this.params.url) {\n return reject(new DownloadException('url param not defined!', this.request));\n }\n\n this.request.onload = () => {\n if (parseInt(this.request.status, 10) !== 200) {\n return reject(new DownloadException(`status code [${this.request.status}]`, this.request));\n }\n this.startDownload();\n return resolve(this);\n };\n\n this.request.ontimeout = () => {\n reject(new DownloadException('request timeout', this.request));\n };\n\n this.request.onerror = () => {\n if (this.params.nativeFallbackOnError) {\n fallback();\n resolve(this);\n } else {\n reject(new DownloadException('network error', this.request));\n }\n };\n\n this.request.send(this.params.body);\n\n return this;\n }\n\n isMobile () {\n return !this.params.forceDesktopMode &&\n /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);\n }\n\n createRequest () {\n let request = new XMLHttpRequest();\n\n request.open(this.params.method, this.params.url, true);\n if (this.params.contentType !== false) {\n request.setRequestHeader('Content-type', this.params.contentType);\n }\n this.params.headers.forEach(header => {\n request.setRequestHeader(header.name, header.value);\n });\n request.responseType = 'arraybuffer';\n if (this.params.process && typeof this.params.process === 'function') {\n request.addEventListener('progress', this.params.process);\n }\n if (this.params.onloadstart && typeof this.params.onloadstart === 'function') {\n request.onloadstart = this.params.onloadstart;\n }\n request.timeout = this.params.timeout;\n request.withCredentials = !!this.params.withCredentials || !!this.params.includeCredentials;\n return request;\n }\n\n getFileName () {\n // Forcing file name\n if (typeof this.params.filename === 'string') {\n return this.params.filename;\n }\n // Trying to get file name from response header\n let content = this.request.getResponseHeader('Content-Disposition');\n let contentParts = [];\n\n if (content) {\n contentParts = content.replace(/[\"']/g, '').match(/filename\\*?=([^;]+)/);\n }\n\n const extractedName = contentParts && contentParts.length >= 1 ?\n contentParts[1] :\n this.params.url.split('/').pop().split('?')[0];\n\n return this.params.nameCallback(extractedName);\n }\n\n createLink () {\n let link = document.createElement('a');\n\n link.style.display = 'none';\n return link;\n }\n\n clickLink () {\n let event;\n\n try {\n event = new MouseEvent('click');\n } catch (e) {\n event = document.createEvent('MouseEvent');\n event.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);\n }\n\n this.link.dispatchEvent(event);\n }\n\n getFile (response, fileName) {\n let file = null;\n let options = { type: 'application/octet-stream' };\n\n try {\n file = new File([response], fileName, options);\n } catch (e) {\n file = new Blob([response], options);\n file.name = fileName;\n file.lastModifiedDate = new Date();\n }\n return file;\n }\n\n startDownload () {\n let fileName = this.getFileName();\n let file = this.getFile(this.request.response, fileName);\n\n // native IE\n if ('msSaveOrOpenBlob' in window.navigator) {\n return window.navigator.msSaveOrOpenBlob(file, fileName);\n }\n\n let objectUrl = window.URL.createObjectURL(file);\n\n this.link.href = objectUrl;\n this.link.download = fileName;\n this.clickLink();\n\n setTimeout(() => {\n (window.URL || window.webkitURL || window).revokeObjectURL(objectUrl);\n }, 1000 * 40);\n\n return this;\n }\n}\n\nexport default JsFileDownloader;\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://jsFileDownloader/webpack/universalModuleDefinition","webpack://jsFileDownloader/webpack/bootstrap","webpack://jsFileDownloader/./node_modules/@babel/runtime/regenerator/index.js","webpack://jsFileDownloader/./node_modules/regenerator-runtime/runtime.js","webpack://jsFileDownloader/./src/exception.js","webpack://jsFileDownloader/./src/index.js","webpack://jsFileDownloader/./src/signatures.js"],"names":["DownloadException","message","request","name","Error","downloadException","DEFAULT_PARAMS","timeout","headers","forceDesktopMode","autoStart","withCredentials","method","nameCallback","contentType","body","nativeFallbackOnError","contentTypeDetermination","JsFileDownloader","customParams","params","Object","assign","link","createLink","downloadedFile","downloadFile","Promise","resolve","reject","initDownload","fallback","target","href","url","clickLink","isMobile","createRequest","onload","parseInt","status","startDownload","ontimeout","onerror","send","test","navigator","userAgent","XMLHttpRequest","open","setRequestHeader","forEach","header","value","responseType","process","addEventListener","onloadstart","includeCredentials","filename","content","getResponseHeader","contentParts","replace","match","extractedName","length","split","pop","file","signatures","fileSignatures","customFileSignatures","reader","FileReader","first4BytesOfFile","slice","onloadend","evt","readyState","DONE","uint","Uint8Array","result","bytes","byte","push","toString","hex","join","toUpperCase","readAsArrayBuffer","response","defaultContentType","headerContentType","getContentTypeFromResponseHeader","getContentTypeFromFileSignature","Blob","signatureContentType","document","createElement","style","display","event","MouseEvent","e","createEvent","initMouseEvent","window","dispatchEvent","fileName","getContentType","type","options","File","lastModifiedDate","Date","getFileName","getFile","msSaveOrOpenBlob","objectUrl","URL","createObjectURL","download","setTimeout","webkitURL","revokeObjectURL"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;QCVA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;AClFA,iBAAiB,mBAAO,CAAC,0EAAqB;;;;;;;;;;;;ACA9C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,aAAa;AACb,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd,KAAK;AACL,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,WAAW;AACX;;AAEA;AACA;AACA,wCAAwC,WAAW;AACnD;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA,2BAA2B;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;AAEA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oCAAoC,cAAc;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,iCAAiC,kBAAkB;AACnD;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA,GAAG;;AAEH;AACA,iBAAiB;;AAEjB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,iBAAiB;AACzC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,YAAY;AACZ;AACA;;AAEA;AACA,YAAY;AACZ;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,8CAA8C,QAAQ;AACtD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA,WAAW;AACX;AACA;AACA;;AAEA,WAAW;AACX;AACA;AACA;;AAEA,WAAW;AACX;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,8CAA8C,QAAQ;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA,KAAK;;AAEL;AACA,8CAA8C,QAAQ;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,8CAA8C,QAAQ;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,CAAC;AACD;AACA;AACA;AACA;AACA,EAAE,KAA0B,oBAAoB,SAAE;AAClD;;AAEA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjvBO,IAAMA,iBAAb;AAAA;;AAAA;;AACE,6BAAaC,OAAb,EAAsBC,OAAtB,EAA+B;AAAA;;AAAA;;AAC7B,0DAA2BD,OAA3B;AACA,UAAKC,OAAL,GAAeA,OAAf;AACA,UAAKC,IAAL,GAAY,mBAAZ;AAH6B;AAI9B;;AALH;AAAA,iCAAuCC,KAAv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jG,IAAL,CAAUoG,QAAV,GAAqBb,QAArB;AACA,qBAAK3E,SAAL;AAEAyF,0BAAU,CAAC,YAAM;AACf,mBAAChB,MAAM,CAACa,GAAP,IAAcb,MAAM,CAACiB,SAArB,IAAkCjB,MAAnC,EAA2CkB,eAA3C,CAA2DN,SAA3D;AACD,iBAFS,EAEP,OAAO,EAFA,CAAV;AAhBF,kDAoBS,KAAK/F,cApBd;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;;;AAyBaP,+EAAf,E;;;;;;;;;;;;AClRA;AAAA;AAAO,IAAMqD,cAAc,GAAG;AAC5B,cAAY,WADgB;AAE5B,cAAY;AAFgB,CAAvB,C","file":"js-file-downloader.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"jsFileDownloader\"] = factory();\n\telse\n\t\troot[\"jsFileDownloader\"] = factory();\n})(this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.js\");\n","module.exports = require(\"regenerator-runtime\");\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","export class DownloadException extends Error {\n constructor (message, request) {\n super(`Downloader error: ${message}`);\n this.request = request;\n this.name = 'DownloadException';\n }\n};\n\n/**\n * @deprecated use DownloadException instead, it will be removed in next releases!\n */\nexport const downloadException = DownloadException;\n","/*!\n * JS File Downloader v ##package_version##\n * https://github.com/AleeeKoi/js-file-downloader\n *\n * Copyright Alessandro Pellizzari\n * Released under the MIT license\n * http://opensource.org/licenses/MIT\n */\n\n'use strict';\n\nimport { DownloadException } from './exception';\nimport {fileSignatures} from './signatures';\n\nconst DEFAULT_PARAMS = {\n timeout: 40000,\n headers: [],\n forceDesktopMode: false,\n autoStart: true,\n withCredentials: false,\n method: 'GET',\n nameCallback: name => name,\n contentType: 'application/x-www-form-urlencoded',\n body: null,\n nativeFallbackOnError: false,\n contentTypeDetermination: false\n};\n\nclass JsFileDownloader {\n\n /**\n * Create a new JsFileDownloader instance\n * You need to define a {String} \"url\" params and other\n * @param {Object} customParams\n */\n constructor (customParams = {}) {\n this.params = Object.assign({}, DEFAULT_PARAMS, customParams);\n this.link = this.createLink();\n this.request = null;\n this.downloadedFile = null;\n\n if (this.params.autoStart) return this.downloadFile();\n\n return this;\n }\n\n start () {\n return this.downloadFile();\n }\n\n downloadFile () {\n return new Promise((resolve, reject) => {\n this.initDownload(resolve, reject);\n });\n }\n\n initDownload (resolve, reject) {\n\n const fallback = () => {\n this.link.target = '_blank';\n this.link.href = this.params.url;\n this.clickLink();\n };\n\n // fallback for old browsers\n if (!('download' in this.link) || this.isMobile()) {\n fallback();\n return resolve();\n }\n\n this.request = this.createRequest();\n\n if (!this.params.url) {\n return reject(new DownloadException('url param not defined!', this.request));\n }\n\n this.request.onload = async () => {\n if (parseInt(this.request.status, 10) !== 200) {\n return reject(new DownloadException(`status code [${this.request.status}]`, this.request));\n }\n await this.startDownload();\n return resolve(this);\n };\n\n this.request.ontimeout = () => {\n reject(new DownloadException('request timeout', this.request));\n };\n\n this.request.onerror = () => {\n if (this.params.nativeFallbackOnError) {\n fallback();\n resolve(this);\n } else {\n reject(new DownloadException('network error', this.request));\n }\n };\n\n this.request.send(this.params.body);\n\n return this;\n }\n\n isMobile () {\n return !this.params.forceDesktopMode &&\n /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);\n }\n\n createRequest () {\n let request = new XMLHttpRequest();\n\n request.open(this.params.method, this.params.url, true);\n if (this.params.contentType !== false) {\n request.setRequestHeader('Content-type', this.params.contentType);\n }\n this.params.headers.forEach(header => {\n request.setRequestHeader(header.name, header.value);\n });\n request.responseType = 'arraybuffer';\n if (this.params.process && typeof this.params.process === 'function') {\n request.addEventListener('progress', this.params.process);\n }\n if (this.params.onloadstart && typeof this.params.onloadstart === 'function') {\n request.onloadstart = this.params.onloadstart;\n }\n request.timeout = this.params.timeout;\n request.withCredentials = !!this.params.withCredentials || !!this.params.includeCredentials;\n return request;\n }\n\n getFileName () {\n // Forcing file name\n if (typeof this.params.filename === 'string') {\n return this.params.filename;\n }\n // Trying to get file name from response header\n let content = this.request.getResponseHeader('Content-Disposition');\n let contentParts = [];\n\n if (content) {\n contentParts = content.replace(/[\"']/g, '').match(/filename\\*?=([^;]+)/);\n }\n\n const extractedName = contentParts && contentParts.length >= 1 ?\n contentParts[1] :\n this.params.url.split('/').pop().split('?')[0];\n\n return this.params.nameCallback(extractedName);\n }\n\n getContentTypeFromFileSignature (file) {\n const signatures = Object.assign({}, fileSignatures, this.params.customFileSignatures);\n\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n const first4BytesOfFile = file.slice(0, 4);\n\n reader.onloadend = (evt) => {\n if (evt.target.readyState !== FileReader.DONE) {\n reject();\n return;\n }\n // Since an array buffer is just a generic way to represent a binary buffer\n // we need to create a TypedArray, in this case an Uint8Array\n const uint = new Uint8Array(evt.target.result);\n const bytes = [];\n\n uint.forEach((byte) => {\n // transform every byte to hexadecimal\n bytes.push(byte.toString(16));\n });\n\n const hex = bytes.join('').toUpperCase();\n resolve(signatures[hex]);\n };\n\n reader.onerror = reject;\n\n // read first 4 bytes of sliced file as an array buffer\n reader.readAsArrayBuffer(first4BytesOfFile);\n });\n }\n\n getContentTypeFromResponseHeader () {\n return this.request.getResponseHeader('content-type');\n }\n\n getContentType (response) {\n return new Promise(async (resolve) => {\n const { contentTypeDetermination } = this.params;\n const defaultContentType = 'application/octet-stream';\n let headerContentType;\n let signatureContentType;\n\n if (contentTypeDetermination === 'header' || contentTypeDetermination === 'full') {\n headerContentType = this.getContentTypeFromResponseHeader();\n }\n\n if (contentTypeDetermination === 'signature' || contentTypeDetermination === 'full') {\n signatureContentType = await this.getContentTypeFromFileSignature(new Blob([response]));\n }\n\n if (contentTypeDetermination === 'header') {\n resolve(headerContentType ?? defaultContentType);\n } else if (contentTypeDetermination === 'signature') {\n resolve(signatureContentType ?? defaultContentType);\n } else if (contentTypeDetermination === 'full') {\n resolve(signatureContentType ?? headerContentType ?? defaultContentType);\n } else {\n resolve(defaultContentType);\n }\n });\n }\n\n createLink () {\n let link = document.createElement('a');\n\n link.style.display = 'none';\n return link;\n }\n\n clickLink () {\n let event;\n\n try {\n event = new MouseEvent('click');\n } catch (e) {\n event = document.createEvent('MouseEvent');\n event.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);\n }\n\n this.link.dispatchEvent(event);\n }\n\n async getFile (response, fileName) {\n const type = await this.getContentType(response);\n let file;\n let options = { type };\n\n try {\n file = new File([response], fileName, options);\n } catch (e) {\n file = new Blob([response], options);\n file.name = fileName;\n file.lastModifiedDate = new Date();\n }\n\n return file;\n }\n\n async startDownload () {\n const fileName = this.getFileName();\n\n this.downloadedFile = await this.getFile(this.request.response, fileName);\n\n // native IE\n if ('msSaveOrOpenBlob' in window.navigator) {\n return window.navigator.msSaveOrOpenBlob(this.downloadedFile, fileName);\n }\n\n let objectUrl = window.URL.createObjectURL(this.downloadedFile);\n\n this.link.href = objectUrl;\n this.link.download = fileName;\n this.clickLink();\n\n setTimeout(() => {\n (window.URL || window.webkitURL || window).revokeObjectURL(objectUrl);\n }, 1000 * 40);\n\n return this.downloadedFile;\n }\n\n}\n\nexport default JsFileDownloader;\n","export const fileSignatures = {\n '89504E47': 'image/png',\n '25504446': 'application/pdf'\n};\n"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/js-file-downloader.min.js b/dist/js-file-downloader.min.js index ab0867c..b33bd10 100644 --- a/dist/js-file-downloader.min.js +++ b/dist/js-file-downloader.min.js @@ -1,11 +1,11 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.jsFileDownloader=t():e.jsFileDownloader=t()}(this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function i(e){var t="function"==typeof Map?new Map:void 0;return(i=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return a(e,arguments,c(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),s(r,e)})(e)}function a(e,t,n){return(a=u()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&s(o,n.prototype),o}).apply(null,arguments)}function u(){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(e){return!1}}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n.r(t);var l=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(i,e);var t,n,r=(t=i,n=u(),function(){var e,r=c(t);if(n){var i=c(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return o(this,e)});function i(e,t){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(n=r.call(this,"Downloader error: ".concat(e))).request=t,n.name="DownloadException",n}return i}(i(Error)); +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.jsFileDownloader=e():t.jsFileDownloader=e()}(this,(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=2)}([function(t,e,r){t.exports=r(1)},function(t,e,r){var n=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new E(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return L()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=b(a,r);if(u){if(u===l)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}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 l={};function f(){}function p(){}function h(){}var d={};u(d,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==e&&r.call(v,o)&&(d=v);var m=h.prototype=f.prototype=Object.create(d);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function g(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function k(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 x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function O(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),l}},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;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},function(t,e,r){"use strict";r.r(e);var n=r(0),o=r.n(n);function i(t){return(i="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 a(t,e){if(e&&("object"===i(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 u(t){var e="function"==typeof Map?new Map:void 0;return(u=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return c(t,arguments,f(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),l(n,t)})(t)}function c(t,e,r){return(c=s()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&l(o,r.prototype),o}).apply(null,arguments)}function s(){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 l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}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}}),e&&l(t,e)}(o,t);var e,r,n=(e=o,r=s(),function(){var t,n=f(e);if(r){var o=f(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return a(this,t)});function o(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(r=n.call(this,"Downloader error: ".concat(t))).request=e,r.name="DownloadException",r}return o}(u(Error)),h={"89504E47":"image/png",25504446:"application/pdf"}; /*! - * JS File Downloader v 1.1.23 + * JS File Downloader v 1.1.24 * https://github.com/AleeeKoi/js-file-downloader * * Copyright Alessandro Pellizzari * Released under the MIT license * http://opensource.org/licenses/MIT */ -function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};return f(this,e),this.params=Object.assign({},d,t),this.link=this.createLink(),this.request=null,this.params.autoStart?this.downloadFile():this}var t,n,r;return t=e,(n=[{key:"start",value:function(){return this.downloadFile()}},{key:"downloadFile",value:function(){var e=this;return new Promise((function(t,n){e.initDownload(t,n)}))}},{key:"initDownload",value:function(e,t){var n=this,r=function(){n.link.target="_blank",n.link.href=n.params.url,n.clickLink()};return!("download"in this.link)||this.isMobile()?(r(),e()):(this.request=this.createRequest(),this.params.url?(this.request.onload=function(){return 200!==parseInt(n.request.status,10)?t(new l("status code [".concat(n.request.status,"]"),n.request)):(n.startDownload(),e(n))},this.request.ontimeout=function(){t(new l("request timeout",n.request))},this.request.onerror=function(){n.params.nativeFallbackOnError?(r(),e(n)):t(new l("network error",n.request))},this.request.send(this.params.body),this):t(new l("url param not defined!",this.request)))}},{key:"isMobile",value:function(){return!this.params.forceDesktopMode&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}},{key:"createRequest",value:function(){var e=new XMLHttpRequest;return e.open(this.params.method,this.params.url,!0),!1!==this.params.contentType&&e.setRequestHeader("Content-type",this.params.contentType),this.params.headers.forEach((function(t){e.setRequestHeader(t.name,t.value)})),e.responseType="arraybuffer",this.params.process&&"function"==typeof this.params.process&&e.addEventListener("progress",this.params.process),this.params.onloadstart&&"function"==typeof this.params.onloadstart&&(e.onloadstart=this.params.onloadstart),e.timeout=this.params.timeout,e.withCredentials=!!this.params.withCredentials||!!this.params.includeCredentials,e}},{key:"getFileName",value:function(){if("string"==typeof this.params.filename)return this.params.filename;var e=this.request.getResponseHeader("Content-Disposition"),t=[];e&&(t=e.replace(/["']/g,"").match(/filename\*?=([^;]+)/));var n=t&&t.length>=1?t[1]:this.params.url.split("/").pop().split("?")[0];return this.params.nameCallback(n)}},{key:"createLink",value:function(){var e=document.createElement("a");return e.style.display="none",e}},{key:"clickLink",value:function(){var e;try{e=new MouseEvent("click")}catch(t){(e=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null)}this.link.dispatchEvent(e)}},{key:"getFile",value:function(e,t){var n=null,r={type:"application/octet-stream"};try{n=new File([e],t,r)}catch(o){(n=new Blob([e],r)).name=t,n.lastModifiedDate=new Date}return n}},{key:"startDownload",value:function(){var e=this.getFileName(),t=this.getFile(this.request.response,e);if("msSaveOrOpenBlob"in window.navigator)return window.navigator.msSaveOrOpenBlob(t,e);var n=window.URL.createObjectURL(t);return this.link.href=n,this.link.download=e,this.clickLink(),setTimeout((function(){(window.URL||window.webkitURL||window).revokeObjectURL(n)}),4e4),this}}])&&p(t.prototype,n),r&&p(t,r),e}();t.default=h}]).default})); +function d(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function y(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){d(i,n,o,a,u,"next",t)}function u(t){d(i,n,o,a,u,"throw",t)}a(void 0)}))}}function v(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};return v(this,t),this.params=Object.assign({},w,e),this.link=this.createLink(),this.request=null,this.downloadedFile=null,this.params.autoStart?this.downloadFile():this}var e,r,n,i,a;return e=t,(r=[{key:"start",value:function(){return this.downloadFile()}},{key:"downloadFile",value:function(){var t=this;return new Promise((function(e,r){t.initDownload(e,r)}))}},{key:"initDownload",value:function(t,e){var r=this,n=function(){r.link.target="_blank",r.link.href=r.params.url,r.clickLink()};return!("download"in this.link)||this.isMobile()?(n(),t()):(this.request=this.createRequest(),this.params.url?(this.request.onload=y(o.a.mark((function n(){return o.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(200===parseInt(r.request.status,10)){n.next=2;break}return n.abrupt("return",e(new p("status code [".concat(r.request.status,"]"),r.request)));case 2:return n.next=4,r.startDownload();case 4:return n.abrupt("return",t(r));case 5:case"end":return n.stop()}}),n)}))),this.request.ontimeout=function(){e(new p("request timeout",r.request))},this.request.onerror=function(){r.params.nativeFallbackOnError?(n(),t(r)):e(new p("network error",r.request))},this.request.send(this.params.body),this):e(new p("url param not defined!",this.request)))}},{key:"isMobile",value:function(){return!this.params.forceDesktopMode&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}},{key:"createRequest",value:function(){var t=new XMLHttpRequest;return t.open(this.params.method,this.params.url,!0),!1!==this.params.contentType&&t.setRequestHeader("Content-type",this.params.contentType),this.params.headers.forEach((function(e){t.setRequestHeader(e.name,e.value)})),t.responseType="arraybuffer",this.params.process&&"function"==typeof this.params.process&&t.addEventListener("progress",this.params.process),this.params.onloadstart&&"function"==typeof this.params.onloadstart&&(t.onloadstart=this.params.onloadstart),t.timeout=this.params.timeout,t.withCredentials=!!this.params.withCredentials||!!this.params.includeCredentials,t}},{key:"getFileName",value:function(){if("string"==typeof this.params.filename)return this.params.filename;var t=this.request.getResponseHeader("Content-Disposition"),e=[];t&&(e=t.replace(/["']/g,"").match(/filename\*?=([^;]+)/));var r=e&&e.length>=1?e[1]:this.params.url.split("/").pop().split("?")[0];return this.params.nameCallback(r)}},{key:"getContentTypeFromFileSignature",value:function(t){var e=Object.assign({},h,this.params.customFileSignatures);return new Promise((function(r,n){var o=new FileReader,i=t.slice(0,4);o.onloadend=function(t){if(t.target.readyState===FileReader.DONE){var o=new Uint8Array(t.target.result),i=[];o.forEach((function(t){i.push(t.toString(16))}));var a=i.join("").toUpperCase();r(e[a])}else n()},o.onerror=n,o.readAsArrayBuffer(i)}))}},{key:"getContentTypeFromResponseHeader",value:function(){return this.request.getResponseHeader("content-type")}},{key:"getContentType",value:function(t){var e=this;return new Promise(function(){var r=y(o.a.mark((function r(n){var i,a,u,c,s,l,f,p;return o.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(i=e.params.contentTypeDetermination,a="application/octet-stream","header"!==i&&"full"!==i||(u=e.getContentTypeFromResponseHeader()),"signature"!==i&&"full"!==i){r.next=7;break}return r.next=6,e.getContentTypeFromFileSignature(new Blob([t]));case 6:c=r.sent;case 7:n("header"===i?null!==(s=u)&&void 0!==s?s:a:"signature"===i?null!==(l=c)&&void 0!==l?l:a:"full"===i&&null!==(f=null!==(p=c)&&void 0!==p?p:u)&&void 0!==f?f:a);case 8:case"end":return r.stop()}}),r)})));return function(t){return r.apply(this,arguments)}}())}},{key:"createLink",value:function(){var t=document.createElement("a");return t.style.display="none",t}},{key:"clickLink",value:function(){var t;try{t=new MouseEvent("click")}catch(e){(t=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null)}this.link.dispatchEvent(t)}},{key:"getFile",value:(a=y(o.a.mark((function t(e,r){var n,i,a;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getContentType(e);case 2:n=t.sent,a={type:n};try{i=new File([e],r,a)}catch(t){(i=new Blob([e],a)).name=r,i.lastModifiedDate=new Date}return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t,this)}))),function(t,e){return a.apply(this,arguments)})},{key:"startDownload",value:(i=y(o.a.mark((function t(){var e,r;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.getFileName(),t.next=3,this.getFile(this.request.response,e);case 3:if(this.downloadedFile=t.sent,!("msSaveOrOpenBlob"in window.navigator)){t.next=6;break}return t.abrupt("return",window.navigator.msSaveOrOpenBlob(this.downloadedFile,e));case 6:return r=window.URL.createObjectURL(this.downloadedFile),this.link.href=r,this.link.download=e,this.clickLink(),setTimeout((function(){(window.URL||window.webkitURL||window).revokeObjectURL(r)}),4e4),t.abrupt("return",this.downloadedFile);case 12:case"end":return t.stop()}}),t,this)}))),function(){return i.apply(this,arguments)})}])&&m(e.prototype,r),n&&m(e,n),t}();e.default=g}]).default})); //# sourceMappingURL=js-file-downloader.min.js.map \ No newline at end of file diff --git a/dist/js-file-downloader.min.js.map b/dist/js-file-downloader.min.js.map index 7130b85..589b1e2 100644 --- a/dist/js-file-downloader.min.js.map +++ b/dist/js-file-downloader.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://jsFileDownloader/webpack/universalModuleDefinition","webpack://jsFileDownloader/webpack/bootstrap","webpack://jsFileDownloader/./src/exception.js","webpack://jsFileDownloader/./src/index.js"],"names":["root","factory","exports","module","define","amd","this","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","DownloadException","message","request","Error","DEFAULT_PARAMS","timeout","headers","forceDesktopMode","autoStart","withCredentials","method","nameCallback","contentType","body","nativeFallbackOnError","JsFileDownloader","customParams","params","assign","link","createLink","downloadFile","Promise","resolve","reject","initDownload","fallback","target","href","url","clickLink","isMobile","createRequest","onload","parseInt","status","startDownload","ontimeout","onerror","send","test","navigator","userAgent","XMLHttpRequest","open","setRequestHeader","forEach","header","responseType","process","addEventListener","onloadstart","includeCredentials","filename","content","getResponseHeader","contentParts","replace","match","extractedName","length","split","pop","document","createElement","style","display","event","MouseEvent","e","createEvent","initMouseEvent","window","dispatchEvent","response","fileName","file","options","type","File","Blob","lastModifiedDate","Date","getFileName","getFile","msSaveOrOpenBlob","objectUrl","URL","createObjectURL","download","setTimeout","webkitURL","revokeObjectURL"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAA0B,iBAAID,IAE9BD,EAAuB,iBAAIC,IAR7B,CASGK,MAAM,WACT,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUP,QAGnC,IAAIC,EAASI,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHT,QAAS,IAUV,OANAU,EAAQH,GAAUI,KAAKV,EAAOD,QAASC,EAAQA,EAAOD,QAASM,GAG/DL,EAAOQ,GAAI,EAGJR,EAAOD,QA0Df,OArDAM,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,EAAoBQ,EAAI,SAASd,EAASe,EAAMC,GAC3CV,EAAoBW,EAAEjB,EAASe,IAClCG,OAAOC,eAAenB,EAASe,EAAM,CAAEK,YAAY,E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AAM,EAAMC,OAAQ,EAAG,EAAG,EAAG,EAAG,GAAG,GAAO,GAAO,GAAO,EAAO,EAAG,MAGlG5G,KAAKuD,KAAKsD,cAAcN,K,qBAG1B,SAASO,EAAUC,GACjB,IAAIC,EAAO,KACPC,EAAU,CAAEC,KAAM,4BAEtB,IACEF,EAAO,IAAIG,KAAK,CAACL,GAAWC,EAAUE,GACtC,MAAOR,IACPO,EAAO,IAAII,KAAK,CAACN,GAAWG,IACvBtG,KAAOoG,EACZC,EAAKK,iBAAmB,IAAIC,KAE9B,OAAON,I,2BAGT,WACE,IAAID,EAAW/G,KAAKuH,cAChBP,EAAOhH,KAAKwH,QAAQxH,KAAKsC,QAAQwE,SAAUC,GAG/C,GAAI,qBAAsBH,OAAO/B,UAC/B,OAAO+B,OAAO/B,UAAU4C,iBAAiBT,EAAMD,GAGjD,IAAIW,EAAYd,OAAOe,IAAIC,gBAAgBZ,GAU3C,OARAhH,KAAKuD,KAAKS,KAAO0D,EACjB1H,KAAKuD,KAAKsE,SAAWd,EACrB/G,KAAKkE,YAEL4D,YAAW,YACRlB,OAAOe,KAAOf,OAAOmB,WAAanB,QAAQoB,gBAAgBN,KAC1D,KAEI1H,U,gCAIImD,e","file":"js-file-downloader.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"jsFileDownloader\"] = factory();\n\telse\n\t\troot[\"jsFileDownloader\"] = factory();\n})(this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","export class DownloadException extends Error {\n constructor (message, request) {\n super(`Downloader error: ${message}`);\n this.request = request;\n this.name = 'DownloadException';\n }\n};\n\n/**\n * @deprecated use DownloadException instead, it will be removed in next releases!\n */\nexport const downloadException = DownloadException;\n","/*!\n * JS File Downloader v ##package_version##\n * https://github.com/AleeeKoi/js-file-downloader\n *\n * Copyright Alessandro Pellizzari\n * Released under the MIT license\n * http://opensource.org/licenses/MIT\n */\n\n'use strict';\n\nimport { DownloadException } from './exception';\n\nconst DEFAULT_PARAMS = {\n timeout: 40000,\n headers: [],\n forceDesktopMode: false,\n autoStart: true,\n withCredentials: false,\n method: 'GET',\n nameCallback: name => name,\n contentType: 'application/x-www-form-urlencoded',\n body: null,\n nativeFallbackOnError: false\n};\n\nclass JsFileDownloader {\n\n /**\n * Create a new JsFileDownloader instance\n * You need to define a {String} \"url\" params and other\n * @param {Object} customParams\n */\n constructor (customParams = {}) {\n this.params = Object.assign({}, DEFAULT_PARAMS, customParams);\n this.link = this.createLink();\n this.request = null;\n\n if (this.params.autoStart) return this.downloadFile();\n\n return this;\n }\n\n start () {\n return this.downloadFile();\n }\n\n downloadFile () {\n return new Promise((resolve, reject) => {\n this.initDownload(resolve, reject);\n });\n }\n\n initDownload (resolve, reject) {\n\n const fallback = () => {\n this.link.target = '_blank';\n this.link.href = this.params.url;\n this.clickLink();\n };\n\n // fallback for old browsers\n if (!('download' in this.link) || this.isMobile()) {\n fallback();\n return resolve();\n }\n\n this.request = this.createRequest();\n\n if (!this.params.url) {\n return reject(new DownloadException('url param not defined!', this.request));\n }\n\n this.request.onload = () => {\n if (parseInt(this.request.status, 10) !== 200) {\n return reject(new DownloadException(`status code [${this.request.status}]`, this.request));\n }\n this.startDownload();\n return resolve(this);\n };\n\n this.request.ontimeout = () => {\n reject(new DownloadException('request timeout', this.request));\n };\n\n this.request.onerror = () => {\n if (this.params.nativeFallbackOnError) {\n fallback();\n resolve(this);\n } else {\n reject(new DownloadException('network error', this.request));\n }\n };\n\n this.request.send(this.params.body);\n\n return this;\n }\n\n isMobile () {\n return !this.params.forceDesktopMode &&\n /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);\n }\n\n createRequest () {\n let request = new XMLHttpRequest();\n\n request.open(this.params.method, this.params.url, true);\n if (this.params.contentType !== false) {\n request.setRequestHeader('Content-type', this.params.contentType);\n }\n this.params.headers.forEach(header => {\n request.setRequestHeader(header.name, header.value);\n });\n request.responseType = 'arraybuffer';\n if (this.params.process && typeof this.params.process === 'function') {\n request.addEventListener('progress', this.params.process);\n }\n if (this.params.onloadstart && typeof this.params.onloadstart === 'function') {\n request.onloadstart = this.params.onloadstart;\n }\n request.timeout = this.params.timeout;\n request.withCredentials = !!this.params.withCredentials || !!this.params.includeCredentials;\n return request;\n }\n\n getFileName () {\n // Forcing file name\n if (typeof this.params.filename === 'string') {\n return this.params.filename;\n }\n // Trying to get file name from response header\n let content = this.request.getResponseHeader('Content-Disposition');\n let contentParts = [];\n\n if (content) {\n contentParts = content.replace(/[\"']/g, '').match(/filename\\*?=([^;]+)/);\n }\n\n const extractedName = contentParts && contentParts.length >= 1 ?\n contentParts[1] :\n this.params.url.split('/').pop().split('?')[0];\n\n return this.params.nameCallback(extractedName);\n }\n\n createLink () {\n let link = document.createElement('a');\n\n link.style.display = 'none';\n return link;\n }\n\n clickLink () {\n let event;\n\n try {\n event = new MouseEvent('click');\n } catch (e) {\n event = document.createEvent('MouseEvent');\n event.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);\n }\n\n this.link.dispatchEvent(event);\n }\n\n getFile (response, fileName) {\n let file = null;\n let options = { type: 'application/octet-stream' };\n\n try {\n file = new File([response], fileName, options);\n } catch (e) {\n file = new Blob([response], options);\n file.name = fileName;\n file.lastModifiedDate = new Date();\n }\n return file;\n }\n\n startDownload () {\n let fileName = this.getFileName();\n let file = this.getFile(this.request.response, fileName);\n\n // native IE\n if ('msSaveOrOpenBlob' in window.navigator) {\n return window.navigator.msSaveOrOpenBlob(file, fileName);\n }\n\n let objectUrl = window.URL.createObjectURL(file);\n\n this.link.href = objectUrl;\n this.link.download = fileName;\n this.clickLink();\n\n setTimeout(() => {\n (window.URL || window.webkitURL || window).revokeObjectURL(objectUrl);\n }, 1000 * 40);\n\n return this;\n }\n}\n\nexport default JsFileDownloader;\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://jsFileDownloader/webpack/universalModuleDefinition","webpack://jsFileDownloader/webpack/bootstrap","webpack://jsFileDownloader/./node_modules/@babel/runtime/regenerator/index.js","webpack://jsFileDownloader/./node_modules/regenerator-runtime/runtime.js","webpack://jsFileDownloader/./src/exception.js","webpack://jsFileDownloader/./src/signatures.js","webpack://jsFileDownloader/./src/index.js"],"names":["root","factory","exports","module","define","amd","this","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","runtime","Op","hasOwn","$Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","obj","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","context","Context","_invoke","state","method","arg","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","type","done","makeInvokeMethod","fn","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","PromiseImpl","previousPromise","callInvokeWithMethodAndArg","resolve","reject","invoke","result","__await","then","unwrapped","error","undefined","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","displayName","isGeneratorFunction","genFun","ctor","constructor","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","regeneratorRuntime","accidentalStrictMode","globalThis","Function","DownloadException","message","request","fileSignatures","DEFAULT_PARAMS","timeout","headers","forceDesktopMode","autoStart","withCredentials","nameCallback","contentType","body","nativeFallbackOnError","contentTypeDetermination","JsFileDownloader","customParams","params","assign","link","createLink","downloadedFile","downloadFile","initDownload","fallback","target","href","url","clickLink","isMobile","createRequest","onload","a","parseInt","status","startDownload","ontimeout","onerror","send","test","navigator","userAgent","XMLHttpRequest","open","setRequestHeader","header","responseType","process","addEventListener","onloadstart","includeCredentials","filename","content","getResponseHeader","contentParts","replace","match","extractedName","split","file","signatures","customFileSignatures","reader","FileReader","first4BytesOfFile","onloadend","evt","readyState","DONE","uint","Uint8Array","bytes","byte","toString","hex","join","toUpperCase","readAsArrayBuffer","response","defaultContentType","headerContentType","getContentTypeFromResponseHeader","getContentTypeFromFileSignature","Blob","signatureContentType","document","createElement","style","display","event","MouseEvent","e","createEvent","initMouseEvent","window","dispatchEvent","fileName","getContentType","options","File","lastModifiedDate","Date","getFileName","getFile","msSaveOrOpenBlob","objectUrl","URL","createObjectURL","download","setTimeout","webkitURL","revokeObjectURL"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAA0B,iBAAID,IAE9BD,EAAuB,iBAAIC,IAR7B,CASGK,MAAM,WACT,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EA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,OAAOgB,WAAahB,QAAQiB,gBAAgBN,KAC1D,KAlBL,kBAoBSzQ,KAAKqL,gBApBd,iD,gFAyBaN,e","file":"js-file-downloader.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"jsFileDownloader\"] = factory();\n\telse\n\t\troot[\"jsFileDownloader\"] = factory();\n})(this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n","module.exports = require(\"regenerator-runtime\");\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","export class DownloadException extends Error {\n constructor (message, request) {\n super(`Downloader error: ${message}`);\n this.request = request;\n this.name = 'DownloadException';\n }\n};\n\n/**\n * @deprecated use DownloadException instead, it will be removed in next releases!\n */\nexport const downloadException = DownloadException;\n","export const fileSignatures = {\n '89504E47': 'image/png',\n '25504446': 'application/pdf'\n};\n","/*!\n * JS File Downloader v ##package_version##\n * https://github.com/AleeeKoi/js-file-downloader\n *\n * Copyright Alessandro Pellizzari\n * Released under the MIT license\n * http://opensource.org/licenses/MIT\n */\n\n'use strict';\n\nimport { DownloadException } from './exception';\nimport {fileSignatures} from './signatures';\n\nconst DEFAULT_PARAMS = {\n timeout: 40000,\n headers: [],\n forceDesktopMode: false,\n autoStart: true,\n withCredentials: false,\n method: 'GET',\n nameCallback: name => name,\n contentType: 'application/x-www-form-urlencoded',\n body: null,\n nativeFallbackOnError: false,\n contentTypeDetermination: false\n};\n\nclass JsFileDownloader {\n\n /**\n * Create a new JsFileDownloader instance\n * You need to define a {String} \"url\" params and other\n * @param {Object} customParams\n */\n constructor (customParams = {}) {\n this.params = Object.assign({}, DEFAULT_PARAMS, customParams);\n this.link = this.createLink();\n this.request = null;\n this.downloadedFile = null;\n\n if (this.params.autoStart) return this.downloadFile();\n\n return this;\n }\n\n start () {\n return this.downloadFile();\n }\n\n downloadFile () {\n return new Promise((resolve, reject) => {\n this.initDownload(resolve, reject);\n });\n }\n\n initDownload (resolve, reject) {\n\n const fallback = () => {\n this.link.target = '_blank';\n this.link.href = this.params.url;\n this.clickLink();\n };\n\n // fallback for old browsers\n if (!('download' in this.link) || this.isMobile()) {\n fallback();\n return resolve();\n }\n\n this.request = this.createRequest();\n\n if (!this.params.url) {\n return reject(new DownloadException('url param not defined!', this.request));\n }\n\n this.request.onload = async () => {\n if (parseInt(this.request.status, 10) !== 200) {\n return reject(new DownloadException(`status code [${this.request.status}]`, this.request));\n }\n await this.startDownload();\n return resolve(this);\n };\n\n this.request.ontimeout = () => {\n reject(new DownloadException('request timeout', this.request));\n };\n\n this.request.onerror = () => {\n if (this.params.nativeFallbackOnError) {\n fallback();\n resolve(this);\n } else {\n reject(new DownloadException('network error', this.request));\n }\n };\n\n this.request.send(this.params.body);\n\n return this;\n }\n\n isMobile () {\n return !this.params.forceDesktopMode &&\n /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);\n }\n\n createRequest () {\n let request = new XMLHttpRequest();\n\n request.open(this.params.method, this.params.url, true);\n if (this.params.contentType !== false) {\n request.setRequestHeader('Content-type', this.params.contentType);\n }\n this.params.headers.forEach(header => {\n request.setRequestHeader(header.name, header.value);\n });\n request.responseType = 'arraybuffer';\n if (this.params.process && typeof this.params.process === 'function') {\n request.addEventListener('progress', this.params.process);\n }\n if (this.params.onloadstart && typeof this.params.onloadstart === 'function') {\n request.onloadstart = this.params.onloadstart;\n }\n request.timeout = this.params.timeout;\n request.withCredentials = !!this.params.withCredentials || !!this.params.includeCredentials;\n return request;\n }\n\n getFileName () {\n // Forcing file name\n if (typeof this.params.filename === 'string') {\n return this.params.filename;\n }\n // Trying to get file name from response header\n let content = this.request.getResponseHeader('Content-Disposition');\n let contentParts = [];\n\n if (content) {\n contentParts = content.replace(/[\"']/g, '').match(/filename\\*?=([^;]+)/);\n }\n\n const extractedName = contentParts && contentParts.length >= 1 ?\n contentParts[1] :\n this.params.url.split('/').pop().split('?')[0];\n\n return this.params.nameCallback(extractedName);\n }\n\n getContentTypeFromFileSignature (file) {\n const signatures = Object.assign({}, fileSignatures, this.params.customFileSignatures);\n\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n const first4BytesOfFile = file.slice(0, 4);\n\n reader.onloadend = (evt) => {\n if (evt.target.readyState !== FileReader.DONE) {\n reject();\n return;\n }\n // Since an array buffer is just a generic way to represent a binary buffer\n // we need to create a TypedArray, in this case an Uint8Array\n const uint = new Uint8Array(evt.target.result);\n const bytes = [];\n\n uint.forEach((byte) => {\n // transform every byte to hexadecimal\n bytes.push(byte.toString(16));\n });\n\n const hex = bytes.join('').toUpperCase();\n resolve(signatures[hex]);\n };\n\n reader.onerror = reject;\n\n // read first 4 bytes of sliced file as an array buffer\n reader.readAsArrayBuffer(first4BytesOfFile);\n });\n }\n\n getContentTypeFromResponseHeader () {\n return this.request.getResponseHeader('content-type');\n }\n\n getContentType (response) {\n return new Promise(async (resolve) => {\n const { contentTypeDetermination } = this.params;\n const defaultContentType = 'application/octet-stream';\n let headerContentType;\n let signatureContentType;\n\n if (contentTypeDetermination === 'header' || contentTypeDetermination === 'full') {\n headerContentType = this.getContentTypeFromResponseHeader();\n }\n\n if (contentTypeDetermination === 'signature' || contentTypeDetermination === 'full') {\n signatureContentType = await this.getContentTypeFromFileSignature(new Blob([response]));\n }\n\n if (contentTypeDetermination === 'header') {\n resolve(headerContentType ?? defaultContentType);\n } else if (contentTypeDetermination === 'signature') {\n resolve(signatureContentType ?? defaultContentType);\n } else if (contentTypeDetermination === 'full') {\n resolve(signatureContentType ?? headerContentType ?? defaultContentType);\n } else {\n resolve(defaultContentType);\n }\n });\n }\n\n createLink () {\n let link = document.createElement('a');\n\n link.style.display = 'none';\n return link;\n }\n\n clickLink () {\n let event;\n\n try {\n event = new MouseEvent('click');\n } catch (e) {\n event = document.createEvent('MouseEvent');\n event.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);\n }\n\n this.link.dispatchEvent(event);\n }\n\n async getFile (response, fileName) {\n const type = await this.getContentType(response);\n let file;\n let options = { type };\n\n try {\n file = new File([response], fileName, options);\n } catch (e) {\n file = new Blob([response], options);\n file.name = fileName;\n file.lastModifiedDate = new Date();\n }\n\n return file;\n }\n\n async startDownload () {\n const fileName = this.getFileName();\n\n this.downloadedFile = await this.getFile(this.request.response, fileName);\n\n // native IE\n if ('msSaveOrOpenBlob' in window.navigator) {\n return window.navigator.msSaveOrOpenBlob(this.downloadedFile, fileName);\n }\n\n let objectUrl = window.URL.createObjectURL(this.downloadedFile);\n\n this.link.href = objectUrl;\n this.link.download = fileName;\n this.clickLink();\n\n setTimeout(() => {\n (window.URL || window.webkitURL || window).revokeObjectURL(objectUrl);\n }, 1000 * 40);\n\n return this.downloadedFile;\n }\n\n}\n\nexport default JsFileDownloader;\n"],"sourceRoot":""} \ No newline at end of file