diff --git a/dist/html2pdf.bundle.js b/dist/html2pdf.bundle.js index 468b442..095f4c9 100644 --- a/dist/html2pdf.bundle.js +++ b/dist/html2pdf.bundle.js @@ -1,6 +1,6 @@ /*! - * html2pdf.js v0.10.1 - * Copyright (c) 2021 Erik Koopmans + * html2pdf.js v0.10.2 + * Copyright (c) 2024 Erik Koopmans * Released under the MIT License. */ (function webpackUniversalModuleDefinition(root, factory) { @@ -16,25639 +16,13837 @@ return /******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/array/from.js": -/*!**************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/array/from.js ***! - \**************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ "./src/plugin/hyperlinks.js": +/*!**********************************!*\ + !*** ./src/plugin/hyperlinks.js ***! + \**********************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/array/from */ "./node_modules/core-js-pure/stable/array/from.js"); +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.object.to-string.js */ "./node_modules/core-js/modules/es.object.to-string.js"); +/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var core_js_modules_es_string_link_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.string.link.js */ "./node_modules/core-js/modules/es.string.link.js"); +/* harmony import */ var core_js_modules_es_string_link_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_link_js__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var core_js_modules_esnext_async_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/esnext.async-iterator.for-each.js */ "./node_modules/core-js/modules/esnext.async-iterator.for-each.js"); +/* harmony import */ var core_js_modules_esnext_async_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_async_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/esnext.iterator.constructor.js */ "./node_modules/core-js/modules/esnext.iterator.constructor.js"); +/* harmony import */ var core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/esnext.iterator.for-each.js */ "./node_modules/core-js/modules/esnext.iterator.for-each.js"); +/* harmony import */ var core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ "./node_modules/core-js/modules/web.dom-collections.for-each.js"); +/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _worker_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../worker.js */ "./src/worker.js"); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils.js */ "./src/utils.js"); -/***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/array/is-array.js": -/*!******************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/array/is-array.js ***! - \******************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/array/is-array */ "./node_modules/core-js-pure/stable/array/is-array.js"); -/***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/date/now.js": -/*!************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/date/now.js ***! - \************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/date/now */ "./node_modules/core-js-pure/stable/date/now.js"); -/***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/bind.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/bind.js ***! - \*****************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/instance/bind */ "./node_modules/core-js-pure/stable/instance/bind.js"); +// Add hyperlink functionality to the PDF creation. -/***/ }), +// Main link array, and refs to original functions. +var linkInfo = []; +var orig = { + toContainer: _worker_js__WEBPACK_IMPORTED_MODULE_6__["default"].prototype.toContainer, + toPdf: _worker_js__WEBPACK_IMPORTED_MODULE_6__["default"].prototype.toPdf +}; +_worker_js__WEBPACK_IMPORTED_MODULE_6__["default"].prototype.toContainer = function toContainer() { + return orig.toContainer.call(this).then(function toContainer_hyperlink() { + // Retrieve hyperlink info if the option is enabled. + if (this.opt.enableLinks) { + // Find all anchor tags and get the container's bounds for reference. + var container = this.prop.container; + var links = container.querySelectorAll('a'); + var containerRect = (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.unitConvert)(container.getBoundingClientRect(), this.prop.pageSize.k); + linkInfo = []; -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/concat.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/concat.js ***! - \*******************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Loop through each anchor tag. + Array.prototype.forEach.call(links, function (link) { + // Treat each client rect as a separate link (for text-wrapping). + var clientRects = link.getClientRects(); + for (var i = 0; i < clientRects.length; i++) { + var clientRect = (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.unitConvert)(clientRects[i], this.prop.pageSize.k); + clientRect.left -= containerRect.left; + clientRect.top -= containerRect.top; + var page = Math.floor(clientRect.top / this.prop.pageSize.inner.height) + 1; + var top = this.opt.margin[0] + clientRect.top % this.prop.pageSize.inner.height; + var left = this.opt.margin[1] + clientRect.left; + linkInfo.push({ + page: page, + top: top, + left: left, + clientRect: clientRect, + link: link + }); + } + }, this); + } + }); +}; +_worker_js__WEBPACK_IMPORTED_MODULE_6__["default"].prototype.toPdf = function toPdf() { + return orig.toPdf.call(this).then(function toPdf_hyperlink() { + // Add hyperlinks if the option is enabled. + if (this.opt.enableLinks) { + // Attach each anchor tag based on info from toContainer(). + linkInfo.forEach(function (l) { + this.prop.pdf.setPage(l.page); + this.prop.pdf.link(l.left, l.top, l.clientRect.width, l.clientRect.height, { + url: l.link.href + }); + }, this); -module.exports = __webpack_require__(/*! core-js-pure/stable/instance/concat */ "./node_modules/core-js-pure/stable/instance/concat.js"); + // Reset the active page of the PDF to the final page. + var nPages = this.prop.pdf.internal.getNumberOfPages(); + this.prop.pdf.setPage(nPages); + } + }); +}; /***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/every.js": -/*!******************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/every.js ***! - \******************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ "./src/plugin/jspdf-plugin.js": +/*!************************************!*\ + !*** ./src/plugin/jspdf-plugin.js ***! + \************************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/instance/every */ "./node_modules/core-js-pure/stable/instance/every.js"); +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.symbol.js */ "./node_modules/core-js/modules/es.symbol.js"); +/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.symbol.description.js */ "./node_modules/core-js/modules/es.symbol.description.js"); +/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ "./node_modules/core-js/modules/es.symbol.iterator.js"); +/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es.array.iterator.js */ "./node_modules/core-js/modules/es.array.iterator.js"); +/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es.object.to-string.js */ "./node_modules/core-js/modules/es.object.to-string.js"); +/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/es.string.iterator.js */ "./node_modules/core-js/modules/es.string.iterator.js"); +/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ "./node_modules/core-js/modules/web.dom-collections.iterator.js"); +/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var jspdf__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! jspdf */ "./node_modules/jspdf/dist/jspdf.es.min.js"); -/***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/fill.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/fill.js ***! - \*****************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/instance/fill */ "./node_modules/core-js-pure/stable/instance/fill.js"); -/***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/filter.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/filter.js ***! - \*******************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/instance/filter */ "./node_modules/core-js-pure/stable/instance/filter.js"); -/***/ }), +function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } +// Import dependencies. -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/for-each.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/for-each.js ***! - \*********************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/instance/for-each */ "./node_modules/core-js-pure/stable/instance/for-each.js"); +// Get dimensions of a PDF page, as determined by jsPDF. +jspdf__WEBPACK_IMPORTED_MODULE_7__.jsPDF.getPageSize = function (orientation, unit, format) { + // Decode options object + if (_typeof(orientation) === 'object') { + var options = orientation; + orientation = options.orientation; + unit = options.unit || unit; + format = options.format || format; + } -/***/ }), + // Default options + unit = unit || 'mm'; + format = format || 'a4'; + orientation = ('' + (orientation || 'P')).toLowerCase(); + var format_as_string = ('' + format).toLowerCase(); -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/includes.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/includes.js ***! - \*********************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Size in pt of various paper formats + var pageFormats = { + 'a0': [2383.94, 3370.39], + 'a1': [1683.78, 2383.94], + 'a2': [1190.55, 1683.78], + 'a3': [841.89, 1190.55], + 'a4': [595.28, 841.89], + 'a5': [419.53, 595.28], + 'a6': [297.64, 419.53], + 'a7': [209.76, 297.64], + 'a8': [147.40, 209.76], + 'a9': [104.88, 147.40], + 'a10': [73.70, 104.88], + 'b0': [2834.65, 4008.19], + 'b1': [2004.09, 2834.65], + 'b2': [1417.32, 2004.09], + 'b3': [1000.63, 1417.32], + 'b4': [708.66, 1000.63], + 'b5': [498.90, 708.66], + 'b6': [354.33, 498.90], + 'b7': [249.45, 354.33], + 'b8': [175.75, 249.45], + 'b9': [124.72, 175.75], + 'b10': [87.87, 124.72], + 'c0': [2599.37, 3676.54], + 'c1': [1836.85, 2599.37], + 'c2': [1298.27, 1836.85], + 'c3': [918.43, 1298.27], + 'c4': [649.13, 918.43], + 'c5': [459.21, 649.13], + 'c6': [323.15, 459.21], + 'c7': [229.61, 323.15], + 'c8': [161.57, 229.61], + 'c9': [113.39, 161.57], + 'c10': [79.37, 113.39], + 'dl': [311.81, 623.62], + 'letter': [612, 792], + 'government-letter': [576, 756], + 'legal': [612, 1008], + 'junior-legal': [576, 360], + 'ledger': [1224, 792], + 'tabloid': [792, 1224], + 'credit-card': [153, 243] + }; -module.exports = __webpack_require__(/*! core-js-pure/stable/instance/includes */ "./node_modules/core-js-pure/stable/instance/includes.js"); + // Unit conversion + switch (unit) { + case 'pt': + var k = 1; + break; + case 'mm': + var k = 72 / 25.4; + break; + case 'cm': + var k = 72 / 2.54; + break; + case 'in': + var k = 72; + break; + case 'px': + var k = 72 / 96; + break; + case 'pc': + var k = 12; + break; + case 'em': + var k = 12; + break; + case 'ex': + var k = 6; + break; + default: + throw 'Invalid unit: ' + unit; + } -/***/ }), + // Dimensions are stored as user units and converted to points on output + if (pageFormats.hasOwnProperty(format_as_string)) { + var pageHeight = pageFormats[format_as_string][1] / k; + var pageWidth = pageFormats[format_as_string][0] / k; + } else { + try { + var pageHeight = format[1]; + var pageWidth = format[0]; + } catch (err) { + throw new Error('Invalid format: ' + format); + } + } -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/index-of.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/index-of.js ***! - \*********************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Handle page orientation + if (orientation === 'p' || orientation === 'portrait') { + orientation = 'p'; + if (pageWidth > pageHeight) { + var tmp = pageWidth; + pageWidth = pageHeight; + pageHeight = tmp; + } + } else if (orientation === 'l' || orientation === 'landscape') { + orientation = 'l'; + if (pageHeight > pageWidth) { + var tmp = pageWidth; + pageWidth = pageHeight; + pageHeight = tmp; + } + } else { + throw 'Invalid orientation: ' + orientation; + } -module.exports = __webpack_require__(/*! core-js-pure/stable/instance/index-of */ "./node_modules/core-js-pure/stable/instance/index-of.js"); + // Return information (k is the unit conversion ratio from pts) + var info = { + 'width': pageWidth, + 'height': pageHeight, + 'unit': unit, + 'k': k + }; + return info; +}; +/* harmony default export */ __webpack_exports__["default"] = (jspdf__WEBPACK_IMPORTED_MODULE_7__.jsPDF); /***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/map.js": -/*!****************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/map.js ***! - \****************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/***/ "./src/plugin/pagebreaks.js": +/*!**********************************!*\ + !*** ./src/plugin/pagebreaks.js ***! + \**********************************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/instance/map */ "./node_modules/core-js-pure/stable/instance/map.js"); +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.concat.js */ "./node_modules/core-js/modules/es.array.concat.js"); +/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var core_js_modules_es_array_join_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.array.join.js */ "./node_modules/core-js/modules/es.array.join.js"); +/* harmony import */ var core_js_modules_es_array_join_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_join_js__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.array.slice.js */ "./node_modules/core-js/modules/es.array.slice.js"); +/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es.object.keys.js */ "./node_modules/core-js/modules/es.object.keys.js"); +/* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es.object.to-string.js */ "./node_modules/core-js/modules/es.object.to-string.js"); +/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var core_js_modules_esnext_async_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/esnext.async-iterator.for-each.js */ "./node_modules/core-js/modules/esnext.async-iterator.for-each.js"); +/* harmony import */ var core_js_modules_esnext_async_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_async_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/esnext.iterator.constructor.js */ "./node_modules/core-js/modules/esnext.iterator.constructor.js"); +/* harmony import */ var core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! core-js/modules/esnext.iterator.for-each.js */ "./node_modules/core-js/modules/esnext.iterator.for-each.js"); +/* harmony import */ var core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_7__); +/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ "./node_modules/core-js/modules/web.dom-collections.for-each.js"); +/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_8__); +/* harmony import */ var _worker_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../worker.js */ "./src/worker.js"); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utils.js */ "./src/utils.js"); -/***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/reduce.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/reduce.js ***! - \*******************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/instance/reduce */ "./node_modules/core-js-pure/stable/instance/reduce.js"); -/***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/reverse.js": -/*!********************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/reverse.js ***! - \********************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/instance/reverse */ "./node_modules/core-js-pure/stable/instance/reverse.js"); -/***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/slice.js": -/*!******************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/slice.js ***! - \******************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/instance/slice */ "./node_modules/core-js-pure/stable/instance/slice.js"); -/***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/some.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/some.js ***! - \*****************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/instance/some */ "./node_modules/core-js-pure/stable/instance/some.js"); +/* Pagebreak plugin: -/***/ }), + Adds page-break functionality to the html2pdf library. Page-breaks can be + enabled by CSS styles, set on individual elements using selectors, or + avoided from breaking inside all elements. -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/starts-with.js": -/*!************************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/starts-with.js ***! - \************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -module.exports = __webpack_require__(/*! core-js-pure/stable/instance/starts-with */ "./node_modules/core-js-pure/stable/instance/starts-with.js"); - -/***/ }), - -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/trim.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/trim.js ***! - \*****************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -module.exports = __webpack_require__(/*! core-js-pure/stable/instance/trim */ "./node_modules/core-js-pure/stable/instance/trim.js"); - -/***/ }), + Options on the `opt.pagebreak` object: -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/instance/values.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/instance/values.js ***! - \*******************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + mode: String or array of strings: 'avoid-all', 'css', and/or 'legacy' + Default: ['css', 'legacy'] -module.exports = __webpack_require__(/*! core-js-pure/stable/instance/values */ "./node_modules/core-js-pure/stable/instance/values.js"); + before: String or array of CSS selectors for which to add page-breaks + before each element. Can be a specific element with an ID + ('#myID'), all elements of a type (e.g. 'img'), all of a class + ('.myClass'), or even '*' to match every element. -/***/ }), + after: Like 'before', but adds a page-break immediately after the element. -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/map.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/map.js ***! - \*******************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + avoid: Like 'before', but avoids page-breaks on these elements. You can + enable this feature on every element using the 'avoid-all' mode. +*/ -module.exports = __webpack_require__(/*! core-js-pure/stable/map */ "./node_modules/core-js-pure/stable/map/index.js"); +// Refs to original functions. +var orig = { + toContainer: _worker_js__WEBPACK_IMPORTED_MODULE_9__["default"].prototype.toContainer +}; -/***/ }), +// Add pagebreak default options to the Worker template. +_worker_js__WEBPACK_IMPORTED_MODULE_9__["default"].template.opt.pagebreak = { + mode: ['css', 'legacy'], + before: [], + after: [], + avoid: [] +}; +_worker_js__WEBPACK_IMPORTED_MODULE_9__["default"].prototype.toContainer = function toContainer() { + return orig.toContainer.call(this).then(function toContainer_pagebreak() { + // Setup root element and inner page height. + var root = this.prop.container; + var pxPageHeight = this.prop.pageSize.inner.px.height; -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/object/define-properties.js": -/*!****************************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/object/define-properties.js ***! - \****************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Check all requested modes. + var modeSrc = [].concat(this.opt.pagebreak.mode); + var mode = { + avoidAll: modeSrc.indexOf('avoid-all') !== -1, + css: modeSrc.indexOf('css') !== -1, + legacy: modeSrc.indexOf('legacy') !== -1 + }; -module.exports = __webpack_require__(/*! core-js-pure/stable/object/define-properties */ "./node_modules/core-js-pure/stable/object/define-properties.js"); + // Get arrays of all explicitly requested elements. + var select = {}; + var self = this; + ['before', 'after', 'avoid'].forEach(function (key) { + var all = mode.avoidAll && key === 'avoid'; + select[key] = all ? [] : [].concat(self.opt.pagebreak[key] || []); + if (select[key].length > 0) { + select[key] = Array.prototype.slice.call(root.querySelectorAll(select[key].join(', '))); + } + }); -/***/ }), + // Get all legacy page-break elements. + var legacyEls = root.querySelectorAll('.html2pdf__page-break'); + legacyEls = Array.prototype.slice.call(legacyEls); -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/object/define-property.js": -/*!**************************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/object/define-property.js ***! - \**************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Loop through all elements. + var els = root.querySelectorAll('*'); + Array.prototype.forEach.call(els, function pagebreak_loop(el) { + // Setup pagebreak rules based on legacy and avoidAll modes. + var rules = { + before: false, + after: mode.legacy && legacyEls.indexOf(el) !== -1, + avoid: mode.avoidAll + }; -module.exports = __webpack_require__(/*! core-js-pure/stable/object/define-property */ "./node_modules/core-js-pure/stable/object/define-property.js"); + // Add rules for css mode. + if (mode.css) { + // TODO: Check if this is valid with iFrames. + var style = window.getComputedStyle(el); + // TODO: Handle 'left' and 'right' correctly. + // TODO: Add support for 'avoid' on breakBefore/After. + var breakOpt = ['always', 'page', 'left', 'right']; + var avoidOpt = ['avoid', 'avoid-page']; + rules = { + before: rules.before || breakOpt.indexOf(style.breakBefore || style.pageBreakBefore) !== -1, + after: rules.after || breakOpt.indexOf(style.breakAfter || style.pageBreakAfter) !== -1, + avoid: rules.avoid || avoidOpt.indexOf(style.breakInside || style.pageBreakInside) !== -1 + }; + } -/***/ }), + // Add rules for explicit requests. + Object.keys(rules).forEach(function (key) { + rules[key] = rules[key] || select[key].indexOf(el) !== -1; + }); -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor.js": -/*!**************************************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor.js ***! - \**************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Get element position on the screen. + // TODO: Subtract the top of the container from clientRect.top/bottom? + var clientRect = el.getBoundingClientRect(); -module.exports = __webpack_require__(/*! core-js-pure/stable/object/get-own-property-descriptor */ "./node_modules/core-js-pure/stable/object/get-own-property-descriptor.js"); + // Avoid: Check if a break happens mid-element. + if (rules.avoid && !rules.before) { + var startPage = Math.floor(clientRect.top / pxPageHeight); + var endPage = Math.floor(clientRect.bottom / pxPageHeight); + var nPages = Math.abs(clientRect.bottom - clientRect.top) / pxPageHeight; -/***/ }), + // Turn on rules.before if the el is broken and is at most one page long. + if (endPage !== startPage && nPages <= 1) { + rules.before = true; + } + } -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors.js": -/*!***************************************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors.js ***! - \***************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Before: Create a padding div to push the element to the next page. + if (rules.before) { + var pad = (0,_utils_js__WEBPACK_IMPORTED_MODULE_10__.createElement)('div', { + style: { + display: 'block', + height: pxPageHeight - clientRect.top % pxPageHeight + 'px' + } + }); + el.parentNode.insertBefore(pad, el); + } -module.exports = __webpack_require__(/*! core-js-pure/stable/object/get-own-property-descriptors */ "./node_modules/core-js-pure/stable/object/get-own-property-descriptors.js"); + // After: Create a padding div to fill the remaining page. + if (rules.after) { + var pad = (0,_utils_js__WEBPACK_IMPORTED_MODULE_10__.createElement)('div', { + style: { + display: 'block', + height: pxPageHeight - clientRect.bottom % pxPageHeight + 'px' + } + }); + el.parentNode.insertBefore(pad, el.nextSibling); + } + }); + }); +}; /***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols.js": -/*!***********************************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols.js ***! - \***********************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -module.exports = __webpack_require__(/*! core-js-pure/stable/object/get-own-property-symbols */ "./node_modules/core-js-pure/stable/object/get-own-property-symbols.js"); +/***/ "./src/utils.js": +/*!**********************!*\ + !*** ./src/utils.js ***! + \**********************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { -/***/ }), +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ cloneNode: function() { return /* binding */ cloneNode; }, +/* harmony export */ createElement: function() { return /* binding */ createElement; }, +/* harmony export */ objType: function() { return /* binding */ objType; }, +/* harmony export */ toPx: function() { return /* binding */ toPx; }, +/* harmony export */ unitConvert: function() { return /* binding */ unitConvert; } +/* harmony export */ }); +/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.symbol.js */ "./node_modules/core-js/modules/es.symbol.js"); +/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.symbol.description.js */ "./node_modules/core-js/modules/es.symbol.description.js"); +/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ "./node_modules/core-js/modules/es.symbol.iterator.js"); +/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es.array.iterator.js */ "./node_modules/core-js/modules/es.array.iterator.js"); +/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es.number.constructor.js */ "./node_modules/core-js/modules/es.number.constructor.js"); +/* harmony import */ var core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/es.object.to-string.js */ "./node_modules/core-js/modules/es.object.to-string.js"); +/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/es.string.iterator.js */ "./node_modules/core-js/modules/es.string.iterator.js"); +/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ "./node_modules/core-js/modules/web.dom-collections.iterator.js"); +/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_7__); -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/object/keys.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/object/keys.js ***! - \***************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/object/keys */ "./node_modules/core-js-pure/stable/object/keys.js"); -/***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/parse-float.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/parse-float.js ***! - \***************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/parse-float */ "./node_modules/core-js-pure/stable/parse-float.js"); -/***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/parse-int.js": -/*!*************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/parse-int.js ***! - \*************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/parse-int */ "./node_modules/core-js-pure/stable/parse-int.js"); +function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } +// Determine the type of a variable/object. +var objType = function objType(obj) { + var type = _typeof(obj); + if (type === 'undefined') return 'undefined';else if (type === 'string' || obj instanceof String) return 'string';else if (type === 'number' || obj instanceof Number) return 'number';else if (type === 'function' || obj instanceof Function) return 'function';else if (!!obj && obj.constructor === Array) return 'array';else if (obj && obj.nodeType === 1) return 'element';else if (type === 'object') return 'object';else return 'unknown'; +}; -/***/ }), +// Create an HTML element with optional className, innerHTML, and style. +var createElement = function createElement(tagName, opt) { + var el = document.createElement(tagName); + if (opt.className) el.className = opt.className; + if (opt.innerHTML) { + el.innerHTML = opt.innerHTML; + var scripts = el.getElementsByTagName('script'); + for (var i = scripts.length; i-- > 0; null) { + scripts[i].parentNode.removeChild(scripts[i]); + } + } + for (var key in opt.style) { + el.style[key] = opt.style[key]; + } + return el; +}; -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/promise.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/promise.js ***! - \***********************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +// Deep-clone a node and preserve contents/properties. +var cloneNode = function cloneNode(node, javascriptEnabled) { + // Recursively clone the node. + var clone = node.nodeType === 3 ? document.createTextNode(node.nodeValue) : node.cloneNode(false); + for (var child = node.firstChild; child; child = child.nextSibling) { + if (javascriptEnabled === true || child.nodeType !== 1 || child.nodeName !== 'SCRIPT') { + clone.appendChild(cloneNode(child, javascriptEnabled)); + } + } + if (node.nodeType === 1) { + // Preserve contents/properties of special nodes. + if (node.nodeName === 'CANVAS') { + clone.width = node.width; + clone.height = node.height; + clone.getContext('2d').drawImage(node, 0, 0); + } else if (node.nodeName === 'TEXTAREA' || node.nodeName === 'SELECT') { + clone.value = node.value; + } -module.exports = __webpack_require__(/*! core-js-pure/stable/promise */ "./node_modules/core-js-pure/stable/promise/index.js"); + // Preserve the node's scroll position when it loads. + clone.addEventListener('load', function () { + clone.scrollTop = node.scrollTop; + clone.scrollLeft = node.scrollLeft; + }, true); + } -/***/ }), + // Return the cloned node. + return clone; +}; -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/reflect/apply.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/reflect/apply.js ***! - \*****************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +// Convert units from px using the conversion value 'k' from jsPDF. +var unitConvert = function unitConvert(obj, k) { + if (objType(obj) === 'number') { + return obj * 72 / 96 / k; + } else { + var newObj = {}; + for (var key in obj) { + newObj[key] = obj[key] * 72 / 96 / k; + } + return newObj; + } +}; -module.exports = __webpack_require__(/*! core-js-pure/stable/reflect/apply */ "./node_modules/core-js-pure/stable/reflect/apply.js"); +// Convert units to px using the conversion value 'k' from jsPDF. +var toPx = function toPx(val, k) { + return Math.floor(val * k / 72 * 96); +}; /***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/reflect/construct.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/reflect/construct.js ***! - \*********************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -module.exports = __webpack_require__(/*! core-js-pure/stable/reflect/construct */ "./node_modules/core-js-pure/stable/reflect/construct.js"); +/***/ "./src/worker.js": +/*!***********************!*\ + !*** ./src/worker.js ***! + \***********************/ +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { -/***/ }), +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.concat.js */ "./node_modules/core-js/modules/es.array.concat.js"); +/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.array.map.js */ "./node_modules/core-js/modules/es.array.map.js"); +/* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.function.name.js */ "./node_modules/core-js/modules/es.function.name.js"); +/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var core_js_modules_es_json_stringify_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es.json.stringify.js */ "./node_modules/core-js/modules/es.json.stringify.js"); +/* harmony import */ var core_js_modules_es_json_stringify_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_json_stringify_js__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var core_js_modules_es_object_assign_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es.object.assign.js */ "./node_modules/core-js/modules/es.object.assign.js"); +/* harmony import */ var core_js_modules_es_object_assign_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_assign_js__WEBPACK_IMPORTED_MODULE_4__); +/* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/es.object.keys.js */ "./node_modules/core-js/modules/es.object.keys.js"); +/* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/es.object.to-string.js */ "./node_modules/core-js/modules/es.object.to-string.js"); +/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_6__); +/* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ "./node_modules/core-js/modules/es.regexp.to-string.js"); +/* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_7__); +/* harmony import */ var core_js_modules_esnext_async_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! core-js/modules/esnext.async-iterator.for-each.js */ "./node_modules/core-js/modules/esnext.async-iterator.for-each.js"); +/* harmony import */ var core_js_modules_esnext_async_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_async_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_8__); +/* harmony import */ var core_js_modules_esnext_async_iterator_map_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! core-js/modules/esnext.async-iterator.map.js */ "./node_modules/core-js/modules/esnext.async-iterator.map.js"); +/* harmony import */ var core_js_modules_esnext_async_iterator_map_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_async_iterator_map_js__WEBPACK_IMPORTED_MODULE_9__); +/* harmony import */ var core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! core-js/modules/esnext.iterator.constructor.js */ "./node_modules/core-js/modules/esnext.iterator.constructor.js"); +/* harmony import */ var core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_constructor_js__WEBPACK_IMPORTED_MODULE_10__); +/* harmony import */ var core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! core-js/modules/esnext.iterator.for-each.js */ "./node_modules/core-js/modules/esnext.iterator.for-each.js"); +/* harmony import */ var core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_for_each_js__WEBPACK_IMPORTED_MODULE_11__); +/* harmony import */ var core_js_modules_esnext_iterator_map_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! core-js/modules/esnext.iterator.map.js */ "./node_modules/core-js/modules/esnext.iterator.map.js"); +/* harmony import */ var core_js_modules_esnext_iterator_map_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_esnext_iterator_map_js__WEBPACK_IMPORTED_MODULE_12__); +/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ "./node_modules/core-js/modules/web.dom-collections.for-each.js"); +/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_13__); +/* harmony import */ var jspdf__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! jspdf */ "./node_modules/jspdf/dist/jspdf.es.min.js"); +/* harmony import */ var html2canvas_pro__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! html2canvas-pro */ "./node_modules/html2canvas-pro/dist/html2canvas-pro.js"); +/* harmony import */ var html2canvas_pro__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(html2canvas_pro__WEBPACK_IMPORTED_MODULE_15__); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./utils.js */ "./src/utils.js"); +/* harmony import */ var es6_promise__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js"); +/* harmony import */ var es6_promise__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(es6_promise__WEBPACK_IMPORTED_MODULE_17__); -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/reflect/delete-property.js": -/*!***************************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/reflect/delete-property.js ***! - \***************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/reflect/delete-property */ "./node_modules/core-js-pure/stable/reflect/delete-property.js"); -/***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/reflect/get-prototype-of.js": -/*!****************************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/reflect/get-prototype-of.js ***! - \****************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/reflect/get-prototype-of */ "./node_modules/core-js-pure/stable/reflect/get-prototype-of.js"); -/***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js-stable/symbol.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js-stable/symbol.js ***! - \**********************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/stable/symbol */ "./node_modules/core-js-pure/stable/symbol/index.js"); -/***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js/array/from.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js/array/from.js ***! - \*******************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/features/array/from */ "./node_modules/core-js-pure/features/array/from.js"); -/***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/core-js/array/is-array.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js/array/is-array.js ***! - \***********************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/features/array/is-array */ "./node_modules/core-js-pure/features/array/is-array.js"); -/***/ }), +// import * as html2canvas from 'html2canvas'; -/***/ "./node_modules/@babel/runtime-corejs3/core-js/get-iterator-method.js": -/*!****************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js/get-iterator-method.js ***! - \****************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -module.exports = __webpack_require__(/*! core-js-pure/features/get-iterator-method */ "./node_modules/core-js-pure/features/get-iterator-method.js"); -/***/ }), +var Promise = (es6_promise__WEBPACK_IMPORTED_MODULE_17___default().Promise); -/***/ "./node_modules/@babel/runtime-corejs3/core-js/get-iterator.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js/get-iterator.js ***! - \*********************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/* ----- CONSTRUCTOR ----- */ -module.exports = __webpack_require__(/*! core-js-pure/features/get-iterator */ "./node_modules/core-js-pure/features/get-iterator.js"); +var Worker = function Worker(opt) { + // Create the root parent for the proto chain, and the starting Worker. + var root = Object.assign(Worker.convert(Promise.resolve()), JSON.parse(JSON.stringify(Worker.template))); + var self = Worker.convert(Promise.resolve(), root); -/***/ }), + // Set progress, optional settings, and return. + self = self.setProgress(1, Worker, 1, [Worker]); + self = self.set(opt); + return self; +}; -/***/ "./node_modules/@babel/runtime-corejs3/core-js/instance/slice.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js/instance/slice.js ***! - \***********************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +// Boilerplate for subclassing Promise. +Worker.prototype = Object.create(Promise.prototype); +Worker.prototype.constructor = Worker; -module.exports = __webpack_require__(/*! core-js-pure/features/instance/slice */ "./node_modules/core-js-pure/features/instance/slice.js"); +// Converts/casts promises into Workers. +Worker.convert = function convert(promise, inherit) { + // Uses prototypal inheritance to receive changes made to ancestors' properties. + promise.__proto__ = inherit || Worker.prototype; + return promise; +}; +Worker.template = { + prop: { + src: null, + container: null, + overlay: null, + canvas: null, + img: null, + pdf: null, + pageSize: null + }, + progress: { + val: 0, + state: null, + n: 0, + stack: [] + }, + opt: { + filename: 'file.pdf', + margin: [0, 0, 0, 0], + image: { + type: 'jpeg', + quality: 0.95 + }, + enableLinks: true, + html2canvas: {}, + jsPDF: {} + } +}; -/***/ }), +/* ----- FROM / TO ----- */ -/***/ "./node_modules/@babel/runtime-corejs3/core-js/object/create.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js/object/create.js ***! - \**********************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +Worker.prototype.from = function from(src, type) { + function getType(src) { + switch ((0,_utils_js__WEBPACK_IMPORTED_MODULE_16__.objType)(src)) { + case 'string': + return 'string'; + case 'element': + return src.nodeName.toLowerCase === 'canvas' ? 'canvas' : 'element'; + default: + return 'unknown'; + } + } + return this.then(function from_main() { + type = type || getType(src); + switch (type) { + case 'string': + return this.set({ + src: (0,_utils_js__WEBPACK_IMPORTED_MODULE_16__.createElement)('div', { + innerHTML: src + }) + }); + case 'element': + return this.set({ + src: src + }); + case 'canvas': + return this.set({ + canvas: src + }); + case 'img': + return this.set({ + img: src + }); + default: + return this.error('Unknown source type.'); + } + }); +}; +Worker.prototype.to = function to(target) { + // Route the 'to' request to the appropriate method. + switch (target) { + case 'container': + return this.toContainer(); + case 'canvas': + return this.toCanvas(); + case 'img': + return this.toImg(); + case 'pdf': + return this.toPdf(); + default: + return this.error('Invalid target.'); + } +}; +Worker.prototype.toContainer = function toContainer() { + // Set up function prerequisites. + var prereqs = [function checkSrc() { + return this.prop.src || this.error('Cannot duplicate - no source HTML.'); + }, function checkPageSize() { + return this.prop.pageSize || this.setPageSize(); + }]; + return this.thenList(prereqs).then(function toContainer_main() { + // Define the CSS styles for the container and its overlay parent. + var overlayCSS = { + position: 'fixed', + overflow: 'hidden', + zIndex: 1000, + left: 0, + right: 0, + bottom: 0, + top: 0, + backgroundColor: 'rgba(0,0,0,0.8)' + }; + var containerCSS = { + position: 'absolute', + width: this.prop.pageSize.inner.width + this.prop.pageSize.unit, + left: 0, + right: 0, + top: 0, + height: 'auto', + margin: 'auto', + backgroundColor: 'white' + }; -module.exports = __webpack_require__(/*! core-js-pure/features/object/create */ "./node_modules/core-js-pure/features/object/create.js"); + // Set the overlay to hidden (could be changed in the future to provide a print preview). + overlayCSS.opacity = 0; -/***/ }), + // Create and attach the elements. + var source = (0,_utils_js__WEBPACK_IMPORTED_MODULE_16__.cloneNode)(this.prop.src, this.opt.html2canvas.javascriptEnabled); + this.prop.overlay = (0,_utils_js__WEBPACK_IMPORTED_MODULE_16__.createElement)('div', { + className: 'html2pdf__overlay', + style: overlayCSS + }); + this.prop.container = (0,_utils_js__WEBPACK_IMPORTED_MODULE_16__.createElement)('div', { + className: 'html2pdf__container', + style: containerCSS + }); + this.prop.container.appendChild(source); + this.prop.overlay.appendChild(this.prop.container); + document.body.appendChild(this.prop.overlay); + }); +}; +Worker.prototype.toCanvas = function toCanvas() { + // Set up function prerequisites. + var prereqs = [function checkContainer() { + return document.body.contains(this.prop.container) || this.toContainer(); + }]; -/***/ "./node_modules/@babel/runtime-corejs3/core-js/object/define-property.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js/object/define-property.js ***! - \*******************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Fulfill prereqs then create the canvas. + return this.thenList(prereqs).then(function toCanvas_main() { + // Handle old-fashioned 'onrendered' argument. + var options = Object.assign({}, this.opt.html2canvas); + delete options.onrendered; + return html2canvas_pro__WEBPACK_IMPORTED_MODULE_15__(this.prop.container, options); + }).then(function toCanvas_post(canvas) { + // Handle old-fashioned 'onrendered' argument. + var onRendered = this.opt.html2canvas.onrendered || function () {}; + onRendered(canvas); + this.prop.canvas = canvas; + document.body.removeChild(this.prop.overlay); + }); +}; +Worker.prototype.toImg = function toImg() { + // Set up function prerequisites. + var prereqs = [function checkCanvas() { + return this.prop.canvas || this.toCanvas(); + }]; -module.exports = __webpack_require__(/*! core-js-pure/features/object/define-property */ "./node_modules/core-js-pure/features/object/define-property.js"); + // Fulfill prereqs then create the image. + return this.thenList(prereqs).then(function toImg_main() { + var imgData = this.prop.canvas.toDataURL('image/' + this.opt.image.type, this.opt.image.quality); + this.prop.img = document.createElement('img'); + this.prop.img.src = imgData; + }); +}; +Worker.prototype.toPdf = function toPdf() { + // Set up function prerequisites. + var prereqs = [function checkCanvas() { + return this.prop.canvas || this.toCanvas(); + }]; -/***/ }), + // Fulfill prereqs then create the image. + return this.thenList(prereqs).then(function toPdf_main() { + // Create local copies of frequently used properties. + var canvas = this.prop.canvas; + var opt = this.opt; -/***/ "./node_modules/@babel/runtime-corejs3/core-js/object/get-own-property-descriptor.js": -/*!*******************************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js/object/get-own-property-descriptor.js ***! - \*******************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Calculate the number of pages. + var pxFullHeight = canvas.height; + var pxPageHeight = Math.floor(canvas.width * this.prop.pageSize.inner.ratio); + var nPages = Math.ceil(pxFullHeight / pxPageHeight); -module.exports = __webpack_require__(/*! core-js-pure/features/object/get-own-property-descriptor */ "./node_modules/core-js-pure/features/object/get-own-property-descriptor.js"); + // Define pageHeight separately so it can be trimmed on the final page. + var pageHeight = this.prop.pageSize.inner.height; -/***/ }), + // Create a one-page canvas to split up the full image. + var pageCanvas = document.createElement('canvas'); + var pageCtx = pageCanvas.getContext('2d'); + pageCanvas.width = canvas.width; + pageCanvas.height = pxPageHeight; -/***/ "./node_modules/@babel/runtime-corejs3/core-js/object/get-prototype-of.js": -/*!********************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js/object/get-prototype-of.js ***! - \********************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Initialize the PDF. + this.prop.pdf = this.prop.pdf || new jspdf__WEBPACK_IMPORTED_MODULE_14__.jsPDF(opt.jsPDF); + for (var page = 0; page < nPages; page++) { + // Trim the final page to reduce file size. + if (page === nPages - 1 && pxFullHeight % pxPageHeight !== 0) { + pageCanvas.height = pxFullHeight % pxPageHeight; + pageHeight = pageCanvas.height * this.prop.pageSize.inner.width / pageCanvas.width; + } -module.exports = __webpack_require__(/*! core-js-pure/features/object/get-prototype-of */ "./node_modules/core-js-pure/features/object/get-prototype-of.js"); + // Display the page. + var w = pageCanvas.width; + var h = pageCanvas.height; + pageCtx.fillStyle = 'white'; + pageCtx.fillRect(0, 0, w, h); + pageCtx.drawImage(canvas, 0, page * pxPageHeight, w, h, 0, 0, w, h); -/***/ }), + // Add the page to the PDF. + if (page) this.prop.pdf.addPage(); + var imgData = pageCanvas.toDataURL('image/' + opt.image.type, opt.image.quality); + this.prop.pdf.addImage(imgData, opt.image.type, opt.margin[1], opt.margin[0], this.prop.pageSize.inner.width, pageHeight); + } + }); +}; -/***/ "./node_modules/@babel/runtime-corejs3/core-js/object/set-prototype-of.js": -/*!********************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js/object/set-prototype-of.js ***! - \********************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/* ----- OUTPUT / SAVE ----- */ -module.exports = __webpack_require__(/*! core-js-pure/features/object/set-prototype-of */ "./node_modules/core-js-pure/features/object/set-prototype-of.js"); +Worker.prototype.output = function output(type, options, src) { + // Redirect requests to the correct function (outputPdf / outputImg). + src = src || 'pdf'; + if (src.toLowerCase() === 'img' || src.toLowerCase() === 'image') { + return this.outputImg(type, options); + } else { + return this.outputPdf(type, options); + } +}; +Worker.prototype.outputPdf = function outputPdf(type, options) { + // Set up function prerequisites. + var prereqs = [function checkPdf() { + return this.prop.pdf || this.toPdf(); + }]; -/***/ }), + // Fulfill prereqs then perform the appropriate output. + return this.thenList(prereqs).then(function outputPdf_main() { + /* Currently implemented output types: + * https://rawgit.com/MrRio/jsPDF/master/docs/jspdf.js.html#line992 + * save(options), arraybuffer, blob, bloburi/bloburl, + * datauristring/dataurlstring, dataurlnewwindow, datauri/dataurl + */ + return this.prop.pdf.output(type, options); + }); +}; +Worker.prototype.outputImg = function outputImg(type, options) { + // Set up function prerequisites. + var prereqs = [function checkImg() { + return this.prop.img || this.toImg(); + }]; -/***/ "./node_modules/@babel/runtime-corejs3/core-js/promise.js": -/*!****************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js/promise.js ***! - \****************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Fulfill prereqs then perform the appropriate output. + return this.thenList(prereqs).then(function outputImg_main() { + switch (type) { + case undefined: + case 'img': + return this.prop.img; + case 'datauristring': + case 'dataurlstring': + return this.prop.img.src; + case 'datauri': + case 'dataurl': + return document.location.href = this.prop.img.src; + default: + throw 'Image output type "' + type + '" is not supported.'; + } + }); +}; +Worker.prototype.save = function save(filename) { + // Set up function prerequisites. + var prereqs = [function checkPdf() { + return this.prop.pdf || this.toPdf(); + }]; -module.exports = __webpack_require__(/*! core-js-pure/features/promise */ "./node_modules/core-js-pure/features/promise/index.js"); + // Fulfill prereqs, update the filename (if provided), and save the PDF. + return this.thenList(prereqs).set(filename ? { + filename: filename + } : null).then(function save_main() { + this.prop.pdf.save(this.opt.filename); + }); +}; -/***/ }), - -/***/ "./node_modules/@babel/runtime-corejs3/core-js/reflect/get.js": -/*!********************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js/reflect/get.js ***! - \********************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { +/* ----- SET / GET ----- */ -module.exports = __webpack_require__(/*! core-js-pure/features/reflect/get */ "./node_modules/core-js-pure/features/reflect/get.js"); +Worker.prototype.set = function set(opt) { + // TODO: Implement ordered pairs? -/***/ }), + // Silently ignore invalid or empty input. + if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_16__.objType)(opt) !== 'object') { + return this; + } -/***/ "./node_modules/@babel/runtime-corejs3/core-js/symbol.js": -/*!***************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js/symbol.js ***! - \***************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Build an array of setter functions to queue. + var fns = Object.keys(opt || {}).map(function (key) { + switch (key) { + case 'margin': + return this.setMargin.bind(this, opt.margin); + case 'jsPDF': + return function set_jsPDF() { + this.opt.jsPDF = opt.jsPDF; + return this.setPageSize(); + }; + case 'pageSize': + return this.setPageSize.bind(this, opt.pageSize); + default: + if (key in Worker.template.prop) { + // Set pre-defined properties in prop. + return function set_prop() { + this.prop[key] = opt[key]; + }; + } else { + // Set any other properties in opt. + return function set_opt() { + this.opt[key] = opt[key]; + }; + } + } + }, this); -module.exports = __webpack_require__(/*! core-js-pure/features/symbol */ "./node_modules/core-js-pure/features/symbol/index.js"); + // Set properties within the promise chain. + return this.then(function set_main() { + return this.thenList(fns); + }); +}; +Worker.prototype.get = function get(key, cbk) { + return this.then(function get_main() { + // Fetch the requested property, either as a predefined prop or in opt. + var val = key in Worker.template.prop ? this.prop[key] : this.opt[key]; + return cbk ? cbk(val) : val; + }); +}; +Worker.prototype.setMargin = function setMargin(margin) { + return this.then(function setMargin_main() { + // Parse the margin property: [top, left, bottom, right]. + switch ((0,_utils_js__WEBPACK_IMPORTED_MODULE_16__.objType)(margin)) { + case 'number': + margin = [margin, margin, margin, margin]; + case 'array': + if (margin.length === 2) { + margin = [margin[0], margin[1], margin[0], margin[1]]; + } + if (margin.length === 4) { + break; + } + default: + return this.error('Invalid margin array.'); + } -/***/ }), + // Set the margin property, then update pageSize. + this.opt.margin = margin; + }).then(this.setPageSize); +}; +Worker.prototype.setPageSize = function setPageSize(pageSize) { + return this.then(function setPageSize_main() { + // Retrieve page-size based on jsPDF settings, if not explicitly provided. + pageSize = pageSize || jspdf__WEBPACK_IMPORTED_MODULE_14__.jsPDF.getPageSize(this.opt.jsPDF); -/***/ "./node_modules/@babel/runtime-corejs3/core-js/symbol/iterator.js": -/*!************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/core-js/symbol/iterator.js ***! - \************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + // Add 'inner' field if not present. + if (!pageSize.hasOwnProperty('inner')) { + pageSize.inner = { + width: pageSize.width - this.opt.margin[1] - this.opt.margin[3], + height: pageSize.height - this.opt.margin[0] - this.opt.margin[2] + }; + pageSize.inner.px = { + width: (0,_utils_js__WEBPACK_IMPORTED_MODULE_16__.toPx)(pageSize.inner.width, pageSize.k), + height: (0,_utils_js__WEBPACK_IMPORTED_MODULE_16__.toPx)(pageSize.inner.height, pageSize.k) + }; + pageSize.inner.ratio = pageSize.inner.height / pageSize.inner.width; + } -module.exports = __webpack_require__(/*! core-js-pure/features/symbol/iterator */ "./node_modules/core-js-pure/features/symbol/iterator.js"); + // Attach pageSize to this. + this.prop.pageSize = pageSize; + }); +}; +Worker.prototype.setProgress = function setProgress(val, state, n, stack) { + // Immediately update all progress values. + if (val != null) this.progress.val = val; + if (state != null) this.progress.state = state; + if (n != null) this.progress.n = n; + if (stack != null) this.progress.stack = stack; + this.progress.ratio = this.progress.val / this.progress.state; -/***/ }), + // Return this for command chaining. + return this; +}; +Worker.prototype.updateProgress = function updateProgress(val, state, n, stack) { + // Immediately update all progress values, using setProgress. + return this.setProgress(val ? this.progress.val + val : null, state ? state : null, n ? this.progress.n + n : null, stack ? this.progress.stack.concat(stack) : null); +}; -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/arrayLikeToArray.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/arrayLikeToArray.js ***! - \*****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/* ----- PROMISE MAPPING ----- */ -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _arrayLikeToArray; } -/* harmony export */ }); -function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) len = arr.length; +Worker.prototype.then = function then(onFulfilled, onRejected) { + // Wrap `this` for encapsulation. + var self = this; + return this.thenCore(onFulfilled, onRejected, function then_main(onFulfilled, onRejected) { + // Update progress while queuing, calling, and resolving `then`. + self.updateProgress(null, null, 1, [onFulfilled]); + return Promise.prototype.then.call(this, function then_pre(val) { + self.updateProgress(null, onFulfilled); + return val; + }).then(onFulfilled, onRejected).then(function then_post(val) { + self.updateProgress(1); + return val; + }); + }); +}; +Worker.prototype.thenCore = function thenCore(onFulfilled, onRejected, thenBase) { + // Handle optional thenBase parameter. + thenBase = thenBase || Promise.prototype.then; - for (var i = 0, arr2 = new Array(len); i < len; i++) { - arr2[i] = arr[i]; + // Wrap `this` for encapsulation and bind it to the promise handlers. + var self = this; + if (onFulfilled) { + onFulfilled = onFulfilled.bind(self); + } + if (onRejected) { + onRejected = onRejected.bind(self); } - return arr2; -} + // Cast self into a Promise to avoid polyfills recursively defining `then`. + var isNative = Promise.toString().indexOf('[native code]') !== -1 && Promise.name === 'Promise'; + var selfPromise = isNative ? self : Worker.convert(Object.assign({}, self), Promise.prototype); -/***/ }), + // Return the promise, after casting it into a Worker and preserving props. + var returnVal = thenBase.call(selfPromise, onFulfilled, onRejected); + return Worker.convert(returnVal, self.__proto__); +}; +Worker.prototype.thenExternal = function thenExternal(onFulfilled, onRejected) { + // Call `then` and return a standard promise (exits the Worker chain). + return Promise.prototype.then.call(this, onFulfilled, onRejected); +}; +Worker.prototype.thenList = function thenList(fns) { + // Queue a series of promise 'factories' into the promise chain. + var self = this; + fns.forEach(function thenList_forEach(fn) { + self = self.thenCore(fn); + }); + return self; +}; +Worker.prototype['catch'] = function (onRejected) { + // Bind `this` to the promise handler, call `catch`, and return a Worker. + if (onRejected) { + onRejected = onRejected.bind(this); + } + var returnVal = Promise.prototype['catch'].call(this, onRejected); + return Worker.convert(returnVal, this); +}; +Worker.prototype.catchExternal = function catchExternal(onRejected) { + // Call `catch` and return a standard promise (exits the Worker chain). + return Promise.prototype['catch'].call(this, onRejected); +}; +Worker.prototype.error = function error(msg) { + // Throw the error in the Promise chain. + return this.then(function error_main() { + throw new Error(msg); + }); +}; -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/arrayWithHoles.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/arrayWithHoles.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/* ----- ALIASES ----- */ -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _arrayWithHoles; } -/* harmony export */ }); -/* harmony import */ var _babel_runtime_corejs3_core_js_array_is_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/array/is-array */ "./node_modules/@babel/runtime-corejs3/core-js/array/is-array.js"); +Worker.prototype.using = Worker.prototype.set; +Worker.prototype.saveAs = Worker.prototype.save; +Worker.prototype.export = Worker.prototype.output; +Worker.prototype.run = Worker.prototype.then; -function _arrayWithHoles(arr) { - if (_babel_runtime_corejs3_core_js_array_is_array__WEBPACK_IMPORTED_MODULE_0__(arr)) return arr; -} +/* ----- FINISHING ----- */ + +// Expose the Worker class. +/* harmony default export */ __webpack_exports__["default"] = (Worker); /***/ }), -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/arrayWithoutHoles.js": -/*!******************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/arrayWithoutHoles.js ***! - \******************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { +/***/ "./node_modules/dompurify/dist/purify.js": +/*!***********************************************!*\ + !*** ./node_modules/dompurify/dist/purify.js ***! + \***********************************************/ +/***/ (function(module) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _arrayWithoutHoles; } -/* harmony export */ }); -/* harmony import */ var _babel_runtime_corejs3_core_js_array_is_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/array/is-array */ "./node_modules/@babel/runtime-corejs3/core-js/array/is-array.js"); -/* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime-corejs3/helpers/esm/arrayLikeToArray.js"); +/*! @license DOMPurify 2.4.9 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.9/LICENSE */ +(function (global, factory) { + true ? module.exports = factory() : + 0; +})(this, (function () { 'use strict'; -function _arrayWithoutHoles(arr) { - if (_babel_runtime_corejs3_core_js_array_is_array__WEBPACK_IMPORTED_MODULE_0__(arr)) return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_1__.default)(arr); -} + function _typeof(obj) { + "@babel/helpers - typeof"; -/***/ }), + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); + } -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/assertThisInitialized.js": -/*!**********************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/assertThisInitialized.js ***! - \**********************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _assertThisInitialized; } -/* harmony export */ }); -function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return _setPrototypeOf(o, p); } - return self; -} + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; -/***/ }), + try { + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + return true; + } catch (e) { + return false; + } + } -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/asyncToGenerator.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/asyncToGenerator.js ***! - \*****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + function _construct(Parent, args, Class) { + if (_isNativeReflectConstruct()) { + _construct = Reflect.construct; + } else { + _construct = function _construct(Parent, args, Class) { + var a = [null]; + a.push.apply(a, args); + var Constructor = Function.bind.apply(Parent, a); + var instance = new Constructor(); + if (Class) _setPrototypeOf(instance, Class.prototype); + return instance; + }; + } -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _asyncToGenerator; } -/* harmony export */ }); -/* harmony import */ var _babel_runtime_corejs3_core_js_promise__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/promise */ "./node_modules/@babel/runtime-corejs3/core-js/promise.js"); + return _construct.apply(null, arguments); + } + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { - try { - var info = gen[key](arg); - var value = info.value; - } catch (error) { - reject(error); - return; + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - if (info.done) { - resolve(value); - } else { - _babel_runtime_corejs3_core_js_promise__WEBPACK_IMPORTED_MODULE_0__.resolve(value).then(_next, _throw); + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } -} -function _asyncToGenerator(fn) { - return function () { - var self = this, - args = arguments; - return new _babel_runtime_corejs3_core_js_promise__WEBPACK_IMPORTED_MODULE_0__(function (resolve, reject) { - var gen = fn.apply(self, args); + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } - function _next(value) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); - } + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; - function _throw(err) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); - } + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; - _next(undefined); - }); - }; -} + return arr2; + } -/***/ }), - -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/classCallCheck.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/classCallCheck.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _classCallCheck; } -/* harmony export */ }); -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -} - -/***/ }), - -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/createClass.js": -/*!************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/createClass.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _createClass; } -/* harmony export */ }); -/* harmony import */ var _babel_runtime_corejs3_core_js_object_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/object/define-property */ "./node_modules/@babel/runtime-corejs3/core-js/object/define-property.js"); + var hasOwnProperty = Object.hasOwnProperty, + setPrototypeOf = Object.setPrototypeOf, + isFrozen = Object.isFrozen, + getPrototypeOf = Object.getPrototypeOf, + getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + var freeze = Object.freeze, + seal = Object.seal, + create = Object.create; // eslint-disable-line import/no-mutable-exports -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; + var _ref = typeof Reflect !== 'undefined' && Reflect, + apply = _ref.apply, + construct = _ref.construct; - _babel_runtime_corejs3_core_js_object_define_property__WEBPACK_IMPORTED_MODULE_0__(target, descriptor.key, descriptor); + if (!apply) { + apply = function apply(fun, thisValue, args) { + return fun.apply(thisValue, args); + }; } -} -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; -} + if (!freeze) { + freeze = function freeze(x) { + return x; + }; + } -/***/ }), + if (!seal) { + seal = function seal(x) { + return x; + }; + } -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/defineProperty.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/defineProperty.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + if (!construct) { + construct = function construct(Func, args) { + return _construct(Func, _toConsumableArray(args)); + }; + } -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _defineProperty; } -/* harmony export */ }); -/* harmony import */ var _babel_runtime_corejs3_core_js_object_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/object/define-property */ "./node_modules/@babel/runtime-corejs3/core-js/object/define-property.js"); + var arrayForEach = unapply(Array.prototype.forEach); + var arrayPop = unapply(Array.prototype.pop); + var arrayPush = unapply(Array.prototype.push); + var stringToLowerCase = unapply(String.prototype.toLowerCase); + var stringToString = unapply(String.prototype.toString); + var stringMatch = unapply(String.prototype.match); + var stringReplace = unapply(String.prototype.replace); + var stringIndexOf = unapply(String.prototype.indexOf); + var stringTrim = unapply(String.prototype.trim); + var regExpTest = unapply(RegExp.prototype.test); + var typeErrorCreate = unconstruct(TypeError); + function unapply(func) { + return function (thisArg) { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } -function _defineProperty(obj, key, value) { - if (key in obj) { - _babel_runtime_corejs3_core_js_object_define_property__WEBPACK_IMPORTED_MODULE_0__(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; + return apply(func, thisArg, args); + }; } + function unconstruct(func) { + return function () { + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } - return obj; -} + return construct(func, args); + }; + } + /* Add properties to a lookup table */ -/***/ }), + function addToSet(set, array, transformCaseFunc) { + var _transformCaseFunc; -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/get.js": -/*!****************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/get.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + transformCaseFunc = (_transformCaseFunc = transformCaseFunc) !== null && _transformCaseFunc !== void 0 ? _transformCaseFunc : stringToLowerCase; -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _get; } -/* harmony export */ }); -/* harmony import */ var _babel_runtime_corejs3_core_js_reflect_get__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/reflect/get */ "./node_modules/@babel/runtime-corejs3/core-js/reflect/get.js"); -/* harmony import */ var _babel_runtime_corejs3_core_js_object_get_own_property_descriptor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/object/get-own-property-descriptor */ "./node_modules/@babel/runtime-corejs3/core-js/object/get-own-property-descriptor.js"); -/* harmony import */ var _superPropBase_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./superPropBase.js */ "./node_modules/@babel/runtime-corejs3/helpers/esm/superPropBase.js"); + if (setPrototypeOf) { + // Make 'in' and truthy checks like Boolean(set.constructor) + // independent of any properties defined on Object.prototype. + // Prevent prototype setters from intercepting set as a this value. + setPrototypeOf(set, null); + } + var l = array.length; + while (l--) { + var element = array[l]; -function _get(target, property, receiver) { - if (typeof Reflect !== "undefined" && _babel_runtime_corejs3_core_js_reflect_get__WEBPACK_IMPORTED_MODULE_0__) { - _get = _babel_runtime_corejs3_core_js_reflect_get__WEBPACK_IMPORTED_MODULE_0__; - } else { - _get = function _get(target, property, receiver) { - var base = (0,_superPropBase_js__WEBPACK_IMPORTED_MODULE_2__.default)(target, property); - if (!base) return; + if (typeof element === 'string') { + var lcElement = transformCaseFunc(element); - var desc = _babel_runtime_corejs3_core_js_object_get_own_property_descriptor__WEBPACK_IMPORTED_MODULE_1__(base, property); + if (lcElement !== element) { + // Config presets (e.g. tags.js, attrs.js) are immutable. + if (!isFrozen(array)) { + array[l] = lcElement; + } - if (desc.get) { - return desc.get.call(receiver); + element = lcElement; + } } - return desc.value; - }; - } - - return _get(target, property, receiver || target); -} + set[element] = true; + } -/***/ }), + return set; + } + /* Shallow clone an object */ -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/getPrototypeOf.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/getPrototypeOf.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + function clone(object) { + var newObject = create(null); + var property; -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _getPrototypeOf; } -/* harmony export */ }); -/* harmony import */ var _babel_runtime_corejs3_core_js_object_set_prototype_of__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/object/set-prototype-of */ "./node_modules/@babel/runtime-corejs3/core-js/object/set-prototype-of.js"); -/* harmony import */ var _babel_runtime_corejs3_core_js_object_get_prototype_of__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/object/get-prototype-of */ "./node_modules/@babel/runtime-corejs3/core-js/object/get-prototype-of.js"); + for (property in object) { + if (apply(hasOwnProperty, object, [property]) === true) { + newObject[property] = object[property]; + } + } + return newObject; + } + /* IE10 doesn't support __lookupGetter__ so lets' + * simulate it. It also automatically checks + * if the prop is function or getter and behaves + * accordingly. */ -function _getPrototypeOf(o) { - _getPrototypeOf = _babel_runtime_corejs3_core_js_object_set_prototype_of__WEBPACK_IMPORTED_MODULE_0__ ? _babel_runtime_corejs3_core_js_object_get_prototype_of__WEBPACK_IMPORTED_MODULE_1__ : function _getPrototypeOf(o) { - return o.__proto__ || _babel_runtime_corejs3_core_js_object_get_prototype_of__WEBPACK_IMPORTED_MODULE_1__(o); - }; - return _getPrototypeOf(o); -} + function lookupGetter(object, prop) { + while (object !== null) { + var desc = getOwnPropertyDescriptor(object, prop); -/***/ }), + if (desc) { + if (desc.get) { + return unapply(desc.get); + } -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/inherits.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/inherits.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + if (typeof desc.value === 'function') { + return unapply(desc.value); + } + } -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _inherits; } -/* harmony export */ }); -/* harmony import */ var _babel_runtime_corejs3_core_js_object_create__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/object/create */ "./node_modules/@babel/runtime-corejs3/core-js/object/create.js"); -/* harmony import */ var _setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setPrototypeOf.js */ "./node_modules/@babel/runtime-corejs3/helpers/esm/setPrototypeOf.js"); + object = getPrototypeOf(object); + } + function fallbackValue(element) { + console.warn('fallback value for', element); + return null; + } -function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); + return fallbackValue; } - subClass.prototype = _babel_runtime_corejs3_core_js_object_create__WEBPACK_IMPORTED_MODULE_0__(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - if (superClass) (0,_setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_1__.default)(subClass, superClass); -} - -/***/ }), + var html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/iterableToArray.js": -/*!****************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/iterableToArray.js ***! - \****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + var svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']); + var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default. + // We still need to know them so that we can do namespace + // checks properly in case one wants to add them to + // allow-list. -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _iterableToArray; } -/* harmony export */ }); -/* harmony import */ var _babel_runtime_corejs3_core_js_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/symbol */ "./node_modules/@babel/runtime-corejs3/core-js/symbol.js"); -/* harmony import */ var _babel_runtime_corejs3_core_js_get_iterator_method__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/get-iterator-method */ "./node_modules/@babel/runtime-corejs3/core-js/get-iterator-method.js"); -/* harmony import */ var _babel_runtime_corejs3_core_js_array_from__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/array/from */ "./node_modules/@babel/runtime-corejs3/core-js/array/from.js"); + var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'fedropshadow', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']); + var mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover']); // Similarly to SVG, we want to know all MathML elements, + // even those that we disallow by default. + var mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']); + var text = freeze(['#text']); + var html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']); + var svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']); + var mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']); + var xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']); -function _iterableToArray(iter) { - if (typeof _babel_runtime_corejs3_core_js_symbol__WEBPACK_IMPORTED_MODULE_0__ !== "undefined" && _babel_runtime_corejs3_core_js_get_iterator_method__WEBPACK_IMPORTED_MODULE_1__(iter) != null || iter["@@iterator"] != null) return _babel_runtime_corejs3_core_js_array_from__WEBPACK_IMPORTED_MODULE_2__(iter); -} + var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode -/***/ }), + var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm); + var TMPLIT_EXPR = seal(/\${[\w\W]*}/gm); + var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/iterableToArrayLimit.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/iterableToArrayLimit.js ***! - \*********************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _iterableToArrayLimit; } -/* harmony export */ }); -/* harmony import */ var _babel_runtime_corejs3_core_js_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/symbol */ "./node_modules/@babel/runtime-corejs3/core-js/symbol.js"); -/* harmony import */ var _babel_runtime_corejs3_core_js_get_iterator_method__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/get-iterator-method */ "./node_modules/@babel/runtime-corejs3/core-js/get-iterator-method.js"); + var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape + ); + var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); + var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex + ); + var DOCTYPE_NAME = seal(/^html$/i); + var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i); + var getGlobal = function getGlobal() { + return typeof window === 'undefined' ? null : window; + }; + /** + * Creates a no-op policy for internal use only. + * Don't export this function outside this module! + * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory. + * @param {Document} document The document object (to determine policy name suffix) + * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types + * are not supported). + */ -function _iterableToArrayLimit(arr, i) { - var _i = arr == null ? null : typeof _babel_runtime_corejs3_core_js_symbol__WEBPACK_IMPORTED_MODULE_0__ !== "undefined" && _babel_runtime_corejs3_core_js_get_iterator_method__WEBPACK_IMPORTED_MODULE_1__(arr) || arr["@@iterator"]; - if (_i == null) return; - var _arr = []; - var _n = true; - var _d = false; + var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) { + if (_typeof(trustedTypes) !== 'object' || typeof trustedTypes.createPolicy !== 'function') { + return null; + } // Allow the callers to control the unique policy name + // by adding a data-tt-policy-suffix to the script element with the DOMPurify. + // Policy creation with duplicate names throws in Trusted Types. - var _s, _e; - try { - for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); + var suffix = null; + var ATTR_NAME = 'data-tt-policy-suffix'; - if (i && _arr.length === i) break; + if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) { + suffix = document.currentScript.getAttribute(ATTR_NAME); } - } catch (err) { - _d = true; - _e = err; - } finally { + + var policyName = 'dompurify' + (suffix ? '#' + suffix : ''); + try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; + return trustedTypes.createPolicy(policyName, { + createHTML: function createHTML(html) { + return html; + }, + createScriptURL: function createScriptURL(scriptUrl) { + return scriptUrl; + } + }); + } catch (_) { + // Policy creation failed (most likely another DOMPurify script has + // already run). Skip creating the policy, as this will only cause errors + // if TT are enforced. + console.warn('TrustedTypes policy ' + policyName + ' could not be created.'); + return null; } - } - - return _arr; -} + }; -/***/ }), + function createDOMPurify() { + var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal(); -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/nonIterableRest.js": -/*!****************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/nonIterableRest.js ***! - \****************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + var DOMPurify = function DOMPurify(root) { + return createDOMPurify(root); + }; + /** + * Version label, exposed for easier checks + * if DOMPurify is up to date or not + */ -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _nonIterableRest; } -/* harmony export */ }); -function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -/***/ }), + DOMPurify.version = '2.4.9'; + /** + * Array of elements that DOMPurify removed during sanitation. + * Empty if nothing was removed. + */ -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/nonIterableSpread.js": -/*!******************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/nonIterableSpread.js ***! - \******************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + DOMPurify.removed = []; -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _nonIterableSpread; } -/* harmony export */ }); -function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} + if (!window || !window.document || window.document.nodeType !== 9) { + // Not running in a browser, provide a factory function + // so that you can pass your own Window + DOMPurify.isSupported = false; + return DOMPurify; + } -/***/ }), + var originalDocument = window.document; + var document = window.document; + var DocumentFragment = window.DocumentFragment, + HTMLTemplateElement = window.HTMLTemplateElement, + Node = window.Node, + Element = window.Element, + NodeFilter = window.NodeFilter, + _window$NamedNodeMap = window.NamedNodeMap, + NamedNodeMap = _window$NamedNodeMap === void 0 ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap, + HTMLFormElement = window.HTMLFormElement, + DOMParser = window.DOMParser, + trustedTypes = window.trustedTypes; + var ElementPrototype = Element.prototype; + var cloneNode = lookupGetter(ElementPrototype, 'cloneNode'); + var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling'); + var getChildNodes = lookupGetter(ElementPrototype, 'childNodes'); + var getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a + // new document created via createHTMLDocument. As per the spec + // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries) + // a new empty registry is used when creating a template contents owner + // document, so we use that as our parent document to ensure nothing + // is inherited. -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn.js": -/*!**************************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn.js ***! - \**************************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + if (typeof HTMLTemplateElement === 'function') { + var template = document.createElement('template'); -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _possibleConstructorReturn; } -/* harmony export */ }); -/* harmony import */ var _babel_runtime_corejs3_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime-corejs3/helpers/typeof */ "./node_modules/@babel/runtime-corejs3/helpers/esm/typeof.js"); -/* harmony import */ var _assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assertThisInitialized.js */ "./node_modules/@babel/runtime-corejs3/helpers/esm/assertThisInitialized.js"); + if (template.content && template.content.ownerDocument) { + document = template.content.ownerDocument; + } + } + var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument); -function _possibleConstructorReturn(self, call) { - if (call && ((0,_babel_runtime_corejs3_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__.default)(call) === "object" || typeof call === "function")) { - return call; - } + var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : ''; + var _document = document, + implementation = _document.implementation, + createNodeIterator = _document.createNodeIterator, + createDocumentFragment = _document.createDocumentFragment, + getElementsByTagName = _document.getElementsByTagName; + var importNode = originalDocument.importNode; + var documentMode = {}; - return (0,_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_1__.default)(self); -} + try { + documentMode = clone(document).documentMode ? document.documentMode : {}; + } catch (_) {} -/***/ }), + var hooks = {}; + /** + * Expose whether this browser supports running the full DOMPurify. + */ -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/setPrototypeOf.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/setPrototypeOf.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined && documentMode !== 9; + var MUSTACHE_EXPR$1 = MUSTACHE_EXPR, + ERB_EXPR$1 = ERB_EXPR, + TMPLIT_EXPR$1 = TMPLIT_EXPR, + DATA_ATTR$1 = DATA_ATTR, + ARIA_ATTR$1 = ARIA_ATTR, + IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, + ATTR_WHITESPACE$1 = ATTR_WHITESPACE, + CUSTOM_ELEMENT$1 = CUSTOM_ELEMENT; + var IS_ALLOWED_URI$1 = IS_ALLOWED_URI; + /** + * We consider the elements and attributes below to be safe. Ideally + * don't add any new ones but feel free to remove unwanted ones. + */ -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _setPrototypeOf; } -/* harmony export */ }); -/* harmony import */ var _babel_runtime_corejs3_core_js_object_set_prototype_of__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/object/set-prototype-of */ "./node_modules/@babel/runtime-corejs3/core-js/object/set-prototype-of.js"); + /* allowed element names */ -function _setPrototypeOf(o, p) { - _setPrototypeOf = _babel_runtime_corejs3_core_js_object_set_prototype_of__WEBPACK_IMPORTED_MODULE_0__ || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; + var ALLOWED_TAGS = null; + var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(svgFilters), _toConsumableArray(mathMl$1), _toConsumableArray(text))); + /* Allowed attribute names */ - return _setPrototypeOf(o, p); -} + var ALLOWED_ATTR = null; + var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml))); + /* + * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements. + * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements) + * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list) + * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`. + */ -/***/ }), + var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, { + tagNameCheck: { + writable: true, + configurable: false, + enumerable: true, + value: null + }, + attributeNameCheck: { + writable: true, + configurable: false, + enumerable: true, + value: null + }, + allowCustomizedBuiltInElements: { + writable: true, + configurable: false, + enumerable: true, + value: false + } + })); + /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */ -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/slicedToArray.js": -/*!**************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/slicedToArray.js ***! - \**************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + var FORBID_TAGS = null; + /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */ -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _slicedToArray; } -/* harmony export */ }); -/* harmony import */ var _arrayWithHoles_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayWithHoles.js */ "./node_modules/@babel/runtime-corejs3/helpers/esm/arrayWithHoles.js"); -/* harmony import */ var _iterableToArrayLimit_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iterableToArrayLimit.js */ "./node_modules/@babel/runtime-corejs3/helpers/esm/iterableToArrayLimit.js"); -/* harmony import */ var _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime-corejs3/helpers/esm/unsupportedIterableToArray.js"); -/* harmony import */ var _nonIterableRest_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./nonIterableRest.js */ "./node_modules/@babel/runtime-corejs3/helpers/esm/nonIterableRest.js"); + var FORBID_ATTR = null; + /* Decide if ARIA attributes are okay */ + var ALLOW_ARIA_ATTR = true; + /* Decide if custom data attributes are okay */ + var ALLOW_DATA_ATTR = true; + /* Decide if unknown protocols are okay */ + var ALLOW_UNKNOWN_PROTOCOLS = false; + /* Decide if self-closing tags in attributes are allowed. + * Usually removed due to a mXSS issue in jQuery 3.0 */ -function _slicedToArray(arr, i) { - return (0,_arrayWithHoles_js__WEBPACK_IMPORTED_MODULE_0__.default)(arr) || (0,_iterableToArrayLimit_js__WEBPACK_IMPORTED_MODULE_1__.default)(arr, i) || (0,_unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__.default)(arr, i) || (0,_nonIterableRest_js__WEBPACK_IMPORTED_MODULE_3__.default)(); -} + var ALLOW_SELF_CLOSE_IN_ATTR = true; + /* Output should be safe for common template engines. + * This means, DOMPurify removes data attributes, mustaches and ERB + */ -/***/ }), + var SAFE_FOR_TEMPLATES = false; + /* Decide if document with ... should be returned */ -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/superPropBase.js": -/*!**************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/superPropBase.js ***! - \**************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + var WHOLE_DOCUMENT = false; + /* Track whether config is already set on this instance of DOMPurify. */ -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _superPropBase; } -/* harmony export */ }); -/* harmony import */ var _getPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getPrototypeOf.js */ "./node_modules/@babel/runtime-corejs3/helpers/esm/getPrototypeOf.js"); + var SET_CONFIG = false; + /* Decide if all elements (e.g. style, script) must be children of + * document.body. By default, browsers might move them to document.head */ -function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = (0,_getPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__.default)(object); - if (object === null) break; - } + var FORCE_BODY = false; + /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html + * string (or a TrustedHTML object if Trusted Types are supported). + * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead + */ - return object; -} + var RETURN_DOM = false; + /* Decide if a DOM `DocumentFragment` should be returned, instead of a html + * string (or a TrustedHTML object if Trusted Types are supported) */ -/***/ }), + var RETURN_DOM_FRAGMENT = false; + /* Try to return a Trusted Type object instead of a string, return a string in + * case Trusted Types are not supported */ -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/toConsumableArray.js": -/*!******************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/toConsumableArray.js ***! - \******************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + var RETURN_TRUSTED_TYPE = false; + /* Output should be free from DOM clobbering attacks? + * This sanitizes markups named with colliding, clobberable built-in DOM APIs. + */ -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _toConsumableArray; } -/* harmony export */ }); -/* harmony import */ var _arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayWithoutHoles.js */ "./node_modules/@babel/runtime-corejs3/helpers/esm/arrayWithoutHoles.js"); -/* harmony import */ var _iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iterableToArray.js */ "./node_modules/@babel/runtime-corejs3/helpers/esm/iterableToArray.js"); -/* harmony import */ var _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime-corejs3/helpers/esm/unsupportedIterableToArray.js"); -/* harmony import */ var _nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./nonIterableSpread.js */ "./node_modules/@babel/runtime-corejs3/helpers/esm/nonIterableSpread.js"); + var SANITIZE_DOM = true; + /* Achieve full DOM Clobbering protection by isolating the namespace of named + * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules. + * + * HTML/DOM spec rules that enable DOM Clobbering: + * - Named Access on Window (§7.3.3) + * - DOM Tree Accessors (§3.1.5) + * - Form Element Parent-Child Relations (§4.10.3) + * - Iframe srcdoc / Nested WindowProxies (§4.8.5) + * - HTMLCollection (§4.2.10.2) + * + * Namespace isolation is implemented by prefixing `id` and `name` attributes + * with a constant string, i.e., `user-content-` + */ + var SANITIZE_NAMED_PROPS = false; + var SANITIZE_NAMED_PROPS_PREFIX = 'user-content-'; + /* Keep element content when removing element? */ + var KEEP_CONTENT = true; + /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead + * of importing it into a new Document and returning a sanitized copy */ + var IN_PLACE = false; + /* Allow usage of profiles like html, svg and mathMl */ -function _toConsumableArray(arr) { - return (0,_arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__.default)(arr) || (0,_iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__.default)(arr) || (0,_unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__.default)(arr) || (0,_nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__.default)(); -} + var USE_PROFILES = {}; + /* Tags to ignore content of when KEEP_CONTENT is true */ -/***/ }), + var FORBID_CONTENTS = null; + var DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']); + /* Tags that are safe for data: URIs */ -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/typeof.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/typeof.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + var DATA_URI_TAGS = null; + var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']); + /* Attributes safe for values like "javascript:" */ -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _typeof; } -/* harmony export */ }); -/* harmony import */ var _babel_runtime_corejs3_core_js_symbol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/symbol */ "./node_modules/@babel/runtime-corejs3/core-js/symbol.js"); -/* harmony import */ var _babel_runtime_corejs3_core_js_symbol_iterator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/symbol/iterator */ "./node_modules/@babel/runtime-corejs3/core-js/symbol/iterator.js"); + var URI_SAFE_ATTRIBUTES = null; + var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']); + var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML'; + var SVG_NAMESPACE = 'http://www.w3.org/2000/svg'; + var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'; + /* Document namespace */ + var NAMESPACE = HTML_NAMESPACE; + var IS_EMPTY_INPUT = false; + /* Allowed XHTML+XML namespaces */ -function _typeof(obj) { - "@babel/helpers - typeof"; + var ALLOWED_NAMESPACES = null; + var DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString); + /* Parsing of strict XHTML documents */ - if (typeof _babel_runtime_corejs3_core_js_symbol__WEBPACK_IMPORTED_MODULE_0__ === "function" && typeof _babel_runtime_corejs3_core_js_symbol_iterator__WEBPACK_IMPORTED_MODULE_1__ === "symbol") { - _typeof = function _typeof(obj) { - return typeof obj; - }; - } else { - _typeof = function _typeof(obj) { - return obj && typeof _babel_runtime_corejs3_core_js_symbol__WEBPACK_IMPORTED_MODULE_0__ === "function" && obj.constructor === _babel_runtime_corejs3_core_js_symbol__WEBPACK_IMPORTED_MODULE_0__ && obj !== _babel_runtime_corejs3_core_js_symbol__WEBPACK_IMPORTED_MODULE_0__.prototype ? "symbol" : typeof obj; - }; - } + var PARSER_MEDIA_TYPE; + var SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html']; + var DEFAULT_PARSER_MEDIA_TYPE = 'text/html'; + var transformCaseFunc; + /* Keep a reference to config to pass to hooks */ - return _typeof(obj); -} + var CONFIG = null; + /* Ideally, do not touch anything below this line */ -/***/ }), + /* ______________________________________________ */ -/***/ "./node_modules/@babel/runtime-corejs3/helpers/esm/unsupportedIterableToArray.js": -/*!***************************************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/helpers/esm/unsupportedIterableToArray.js ***! - \***************************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { + var formElement = document.createElement('form'); -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ _unsupportedIterableToArray; } -/* harmony export */ }); -/* harmony import */ var _babel_runtime_corejs3_core_js_instance_slice__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/instance/slice */ "./node_modules/@babel/runtime-corejs3/core-js/instance/slice.js"); -/* harmony import */ var _babel_runtime_corejs3_core_js_array_from__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime-corejs3/core-js/array/from */ "./node_modules/@babel/runtime-corejs3/core-js/array/from.js"); -/* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime-corejs3/helpers/esm/arrayLikeToArray.js"); + var isRegexOrFunction = function isRegexOrFunction(testValue) { + return testValue instanceof RegExp || testValue instanceof Function; + }; + /** + * _parseConfig + * + * @param {Object} cfg optional config literal + */ + // eslint-disable-next-line complexity + var _parseConfig = function _parseConfig(cfg) { + if (CONFIG && CONFIG === cfg) { + return; + } + /* Shield configuration object from tampering */ -function _unsupportedIterableToArray(o, minLen) { - var _context; - if (!o) return; - if (typeof o === "string") return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_2__.default)(o, minLen); + if (!cfg || _typeof(cfg) !== 'object') { + cfg = {}; + } + /* Shield configuration object from prototype pollution */ - var n = _babel_runtime_corejs3_core_js_instance_slice__WEBPACK_IMPORTED_MODULE_0__(_context = Object.prototype.toString.call(o)).call(_context, 8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return _babel_runtime_corejs3_core_js_array_from__WEBPACK_IMPORTED_MODULE_1__(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_2__.default)(o, minLen); -} + cfg = clone(cfg); + PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes + SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is. -/***/ }), + transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase; + /* Set configuration parameters */ -/***/ "./node_modules/@babel/runtime-corejs3/regenerator/index.js": -/*!******************************************************************!*\ - !*** ./node_modules/@babel/runtime-corejs3/regenerator/index.js ***! - \******************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS; + ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR; + ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES; + URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent + cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent + transformCaseFunc // eslint-disable-line indent + ) // eslint-disable-line indent + : DEFAULT_URI_SAFE_ATTRIBUTES; + DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent + cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent + transformCaseFunc // eslint-disable-line indent + ) // eslint-disable-line indent + : DEFAULT_DATA_URI_TAGS; + FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS; + FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {}; + FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {}; + USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false; + ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true -module.exports = __webpack_require__(/*! regenerator-runtime */ "./node_modules/regenerator-runtime/runtime.js"); + ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true + ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false -/***/ }), + ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true -/***/ "./src/plugin/hyperlinks.js": -/*!**********************************!*\ - !*** ./src/plugin/hyperlinks.js ***! - \**********************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ "./node_modules/core-js/modules/web.dom-collections.for-each.js"); -/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var core_js_modules_es_string_link_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.string.link.js */ "./node_modules/core-js/modules/es.string.link.js"); -/* harmony import */ var core_js_modules_es_string_link_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_link_js__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _worker_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../worker.js */ "./src/worker.js"); -/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils.js */ "./src/utils.js"); + WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false + RETURN_DOM = cfg.RETURN_DOM || false; // Default false + RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false - // Add hyperlink functionality to the PDF creation. -// Main link array, and refs to original functions. + RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false -var linkInfo = []; -var orig = { - toContainer: _worker_js__WEBPACK_IMPORTED_MODULE_2__.default.prototype.toContainer, - toPdf: _worker_js__WEBPACK_IMPORTED_MODULE_2__.default.prototype.toPdf -}; + FORCE_BODY = cfg.FORCE_BODY || false; // Default false -_worker_js__WEBPACK_IMPORTED_MODULE_2__.default.prototype.toContainer = function toContainer() { - return orig.toContainer.call(this).then(function toContainer_hyperlink() { - // Retrieve hyperlink info if the option is enabled. - if (this.opt.enableLinks) { - // Find all anchor tags and get the container's bounds for reference. - var container = this.prop.container; - var links = container.querySelectorAll('a'); - var containerRect = (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.unitConvert)(container.getBoundingClientRect(), this.prop.pageSize.k); - linkInfo = []; // Loop through each anchor tag. + SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true - Array.prototype.forEach.call(links, function (link) { - // Treat each client rect as a separate link (for text-wrapping). - var clientRects = link.getClientRects(); + SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false - for (var i = 0; i < clientRects.length; i++) { - var clientRect = (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.unitConvert)(clientRects[i], this.prop.pageSize.k); - clientRect.left -= containerRect.left; - clientRect.top -= containerRect.top; - var page = Math.floor(clientRect.top / this.prop.pageSize.inner.height) + 1; - var top = this.opt.margin[0] + clientRect.top % this.prop.pageSize.inner.height; - var left = this.opt.margin[1] + clientRect.left; - linkInfo.push({ - page: page, - top: top, - left: left, - clientRect: clientRect, - link: link - }); - } - }, this); - } - }); -}; + KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true -_worker_js__WEBPACK_IMPORTED_MODULE_2__.default.prototype.toPdf = function toPdf() { - return orig.toPdf.call(this).then(function toPdf_hyperlink() { - // Add hyperlinks if the option is enabled. - if (this.opt.enableLinks) { - // Attach each anchor tag based on info from toContainer(). - linkInfo.forEach(function (l) { - this.prop.pdf.setPage(l.page); - this.prop.pdf.link(l.left, l.top, l.clientRect.width, l.clientRect.height, { - url: l.link.href - }); - }, this); // Reset the active page of the PDF to the final page. + IN_PLACE = cfg.IN_PLACE || false; // Default false - var nPages = this.prop.pdf.internal.getNumberOfPages(); - this.prop.pdf.setPage(nPages); - } - }); -}; + IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$1; + NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE; + CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {}; -/***/ }), + if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) { + CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck; + } -/***/ "./src/plugin/jspdf-plugin.js": -/*!************************************!*\ - !*** ./src/plugin/jspdf-plugin.js ***! - \************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) { + CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck; + } -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.symbol.js */ "./node_modules/core-js/modules/es.symbol.js"); -/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.symbol.description.js */ "./node_modules/core-js/modules/es.symbol.description.js"); -/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.object.to-string.js */ "./node_modules/core-js/modules/es.object.to-string.js"); -/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ "./node_modules/core-js/modules/es.symbol.iterator.js"); -/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es.array.iterator.js */ "./node_modules/core-js/modules/es.array.iterator.js"); -/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/es.string.iterator.js */ "./node_modules/core-js/modules/es.string.iterator.js"); -/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ "./node_modules/core-js/modules/web.dom-collections.iterator.js"); -/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var jspdf__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! jspdf */ "./node_modules/jspdf/dist/jspdf.es.min.js"); + if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') { + CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements; + } + if (SAFE_FOR_TEMPLATES) { + ALLOW_DATA_ATTR = false; + } + if (RETURN_DOM_FRAGMENT) { + RETURN_DOM = true; + } + /* Parse profile info */ + if (USE_PROFILES) { + ALLOWED_TAGS = addToSet({}, _toConsumableArray(text)); + ALLOWED_ATTR = []; + if (USE_PROFILES.html === true) { + addToSet(ALLOWED_TAGS, html$1); + addToSet(ALLOWED_ATTR, html); + } + if (USE_PROFILES.svg === true) { + addToSet(ALLOWED_TAGS, svg$1); + addToSet(ALLOWED_ATTR, svg); + addToSet(ALLOWED_ATTR, xml); + } + if (USE_PROFILES.svgFilters === true) { + addToSet(ALLOWED_TAGS, svgFilters); + addToSet(ALLOWED_ATTR, svg); + addToSet(ALLOWED_ATTR, xml); + } -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + if (USE_PROFILES.mathMl === true) { + addToSet(ALLOWED_TAGS, mathMl$1); + addToSet(ALLOWED_ATTR, mathMl); + addToSet(ALLOWED_ATTR, xml); + } + } + /* Merge configuration parameters */ -// Import dependencies. - // Get dimensions of a PDF page, as determined by jsPDF. -jspdf__WEBPACK_IMPORTED_MODULE_7__.jsPDF.getPageSize = function (orientation, unit, format) { - // Decode options object - if (_typeof(orientation) === 'object') { - var options = orientation; - orientation = options.orientation; - unit = options.unit || unit; - format = options.format || format; - } // Default options + if (cfg.ADD_TAGS) { + if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { + ALLOWED_TAGS = clone(ALLOWED_TAGS); + } + addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc); + } - unit = unit || 'mm'; - format = format || 'a4'; - orientation = ('' + (orientation || 'P')).toLowerCase(); - var format_as_string = ('' + format).toLowerCase(); // Size in pt of various paper formats + if (cfg.ADD_ATTR) { + if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { + ALLOWED_ATTR = clone(ALLOWED_ATTR); + } - var pageFormats = { - 'a0': [2383.94, 3370.39], - 'a1': [1683.78, 2383.94], - 'a2': [1190.55, 1683.78], - 'a3': [841.89, 1190.55], - 'a4': [595.28, 841.89], - 'a5': [419.53, 595.28], - 'a6': [297.64, 419.53], - 'a7': [209.76, 297.64], - 'a8': [147.40, 209.76], - 'a9': [104.88, 147.40], - 'a10': [73.70, 104.88], - 'b0': [2834.65, 4008.19], - 'b1': [2004.09, 2834.65], - 'b2': [1417.32, 2004.09], - 'b3': [1000.63, 1417.32], - 'b4': [708.66, 1000.63], - 'b5': [498.90, 708.66], - 'b6': [354.33, 498.90], - 'b7': [249.45, 354.33], - 'b8': [175.75, 249.45], - 'b9': [124.72, 175.75], - 'b10': [87.87, 124.72], - 'c0': [2599.37, 3676.54], - 'c1': [1836.85, 2599.37], - 'c2': [1298.27, 1836.85], - 'c3': [918.43, 1298.27], - 'c4': [649.13, 918.43], - 'c5': [459.21, 649.13], - 'c6': [323.15, 459.21], - 'c7': [229.61, 323.15], - 'c8': [161.57, 229.61], - 'c9': [113.39, 161.57], - 'c10': [79.37, 113.39], - 'dl': [311.81, 623.62], - 'letter': [612, 792], - 'government-letter': [576, 756], - 'legal': [612, 1008], - 'junior-legal': [576, 360], - 'ledger': [1224, 792], - 'tabloid': [792, 1224], - 'credit-card': [153, 243] - }; // Unit conversion + addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc); + } - switch (unit) { - case 'pt': - var k = 1; - break; + if (cfg.ADD_URI_SAFE_ATTR) { + addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc); + } - case 'mm': - var k = 72 / 25.4; - break; + if (cfg.FORBID_CONTENTS) { + if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) { + FORBID_CONTENTS = clone(FORBID_CONTENTS); + } - case 'cm': - var k = 72 / 2.54; - break; + addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc); + } + /* Add #text in case KEEP_CONTENT is set to true */ - case 'in': - var k = 72; - break; - case 'px': - var k = 72 / 96; - break; + if (KEEP_CONTENT) { + ALLOWED_TAGS['#text'] = true; + } + /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */ - case 'pc': - var k = 12; - break; - case 'em': - var k = 12; - break; + if (WHOLE_DOCUMENT) { + addToSet(ALLOWED_TAGS, ['html', 'head', 'body']); + } + /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */ - case 'ex': - var k = 6; - break; - default: - throw 'Invalid unit: ' + unit; - } // Dimensions are stored as user units and converted to points on output + if (ALLOWED_TAGS.table) { + addToSet(ALLOWED_TAGS, ['tbody']); + delete FORBID_TAGS.tbody; + } // Prevent further manipulation of configuration. + // Not available in IE8, Safari 5, etc. - if (pageFormats.hasOwnProperty(format_as_string)) { - var pageHeight = pageFormats[format_as_string][1] / k; - var pageWidth = pageFormats[format_as_string][0] / k; - } else { - try { - var pageHeight = format[1]; - var pageWidth = format[0]; - } catch (err) { - throw new Error('Invalid format: ' + format); - } - } // Handle page orientation + if (freeze) { + freeze(cfg); + } + CONFIG = cfg; + }; - if (orientation === 'p' || orientation === 'portrait') { - orientation = 'p'; + var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']); + var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML + // namespace. We need to specify them explicitly + // so that they don't get erroneously deleted from + // HTML namespace. - if (pageWidth > pageHeight) { - var tmp = pageWidth; - pageWidth = pageHeight; - pageHeight = tmp; - } - } else if (orientation === 'l' || orientation === 'landscape') { - orientation = 'l'; + var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']); + /* Keep track of all possible SVG and MathML tags + * so that we can perform the namespace checks + * correctly. */ - if (pageHeight > pageWidth) { - var tmp = pageWidth; - pageWidth = pageHeight; - pageHeight = tmp; - } - } else { - throw 'Invalid orientation: ' + orientation; - } // Return information (k is the unit conversion ratio from pts) + var ALL_SVG_TAGS = addToSet({}, svg$1); + addToSet(ALL_SVG_TAGS, svgFilters); + addToSet(ALL_SVG_TAGS, svgDisallowed); + var ALL_MATHML_TAGS = addToSet({}, mathMl$1); + addToSet(ALL_MATHML_TAGS, mathMlDisallowed); + /** + * + * + * @param {Element} element a DOM element whose namespace is being checked + * @returns {boolean} Return false if the element has a + * namespace that a spec-compliant parser would never + * return. Return true otherwise. + */ + var _checkValidNamespace = function _checkValidNamespace(element) { + var parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode + // can be null. We just simulate parent in this case. - var info = { - 'width': pageWidth, - 'height': pageHeight, - 'unit': unit, - 'k': k - }; - return info; -}; + if (!parent || !parent.tagName) { + parent = { + namespaceURI: NAMESPACE, + tagName: 'template' + }; + } -/* harmony default export */ __webpack_exports__["default"] = (jspdf__WEBPACK_IMPORTED_MODULE_7__.jsPDF); + var tagName = stringToLowerCase(element.tagName); + var parentTagName = stringToLowerCase(parent.tagName); -/***/ }), + if (!ALLOWED_NAMESPACES[element.namespaceURI]) { + return false; + } -/***/ "./src/plugin/pagebreaks.js": -/*!**********************************!*\ - !*** ./src/plugin/pagebreaks.js ***! - \**********************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + if (element.namespaceURI === SVG_NAMESPACE) { + // The only way to switch from HTML namespace to SVG + // is via . If it happens via any other tag, then + // it should be killed. + if (parent.namespaceURI === HTML_NAMESPACE) { + return tagName === 'svg'; + } // The only way to switch from MathML to SVG is via` + // svg if parent is either or MathML + // text integration points. -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.concat.js */ "./node_modules/core-js/modules/es.array.concat.js"); -/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.array.slice.js */ "./node_modules/core-js/modules/es.array.slice.js"); -/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var core_js_modules_es_array_join_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.array.join.js */ "./node_modules/core-js/modules/es.array.join.js"); -/* harmony import */ var core_js_modules_es_array_join_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_join_js__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ "./node_modules/core-js/modules/web.dom-collections.for-each.js"); -/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es.object.keys.js */ "./node_modules/core-js/modules/es.object.keys.js"); -/* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _worker_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../worker.js */ "./src/worker.js"); -/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils.js */ "./src/utils.js"); + if (parent.namespaceURI === MATHML_NAMESPACE) { + return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]); + } // We only allow elements that are defined in SVG + // spec. All others are disallowed in SVG namespace. + return Boolean(ALL_SVG_TAGS[tagName]); + } + if (element.namespaceURI === MATHML_NAMESPACE) { + // The only way to switch from HTML namespace to MathML + // is via . If it happens via any other tag, then + // it should be killed. + if (parent.namespaceURI === HTML_NAMESPACE) { + return tagName === 'math'; + } // The only way to switch from SVG to MathML is via + // and HTML integration points + if (parent.namespaceURI === SVG_NAMESPACE) { + return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName]; + } // We only allow elements that are defined in MathML + // spec. All others are disallowed in MathML namespace. -/* Pagebreak plugin: - Adds page-break functionality to the html2pdf library. Page-breaks can be - enabled by CSS styles, set on individual elements using selectors, or - avoided from breaking inside all elements. + return Boolean(ALL_MATHML_TAGS[tagName]); + } - Options on the `opt.pagebreak` object: + if (element.namespaceURI === HTML_NAMESPACE) { + // The only way to switch from SVG to HTML is via + // HTML integration points, and from MathML to HTML + // is via MathML text integration points + if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) { + return false; + } - mode: String or array of strings: 'avoid-all', 'css', and/or 'legacy' - Default: ['css', 'legacy'] + if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) { + return false; + } // We disallow tags that are specific for MathML + // or SVG and should never appear in HTML namespace - before: String or array of CSS selectors for which to add page-breaks - before each element. Can be a specific element with an ID - ('#myID'), all elements of a type (e.g. 'img'), all of a class - ('.myClass'), or even '*' to match every element. - after: Like 'before', but adds a page-break immediately after the element. + return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]); + } // For XHTML and XML documents that support custom namespaces - avoid: Like 'before', but avoids page-breaks on these elements. You can - enable this feature on every element using the 'avoid-all' mode. -*/ -// Refs to original functions. -var orig = { - toContainer: _worker_js__WEBPACK_IMPORTED_MODULE_5__.default.prototype.toContainer -}; // Add pagebreak default options to the Worker template. + if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) { + return true; + } // The code should never reach this place (this means + // that the element somehow got namespace that is not + // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES). + // Return false just in case. -_worker_js__WEBPACK_IMPORTED_MODULE_5__.default.template.opt.pagebreak = { - mode: ['css', 'legacy'], - before: [], - after: [], - avoid: [] -}; -_worker_js__WEBPACK_IMPORTED_MODULE_5__.default.prototype.toContainer = function toContainer() { - return orig.toContainer.call(this).then(function toContainer_pagebreak() { - // Setup root element and inner page height. - var root = this.prop.container; - var pxPageHeight = this.prop.pageSize.inner.px.height; // Check all requested modes. + return false; + }; + /** + * _forceRemove + * + * @param {Node} node a DOM node + */ - var modeSrc = [].concat(this.opt.pagebreak.mode); - var mode = { - avoidAll: modeSrc.indexOf('avoid-all') !== -1, - css: modeSrc.indexOf('css') !== -1, - legacy: modeSrc.indexOf('legacy') !== -1 - }; // Get arrays of all explicitly requested elements. - var select = {}; - var self = this; - ['before', 'after', 'avoid'].forEach(function (key) { - var all = mode.avoidAll && key === 'avoid'; - select[key] = all ? [] : [].concat(self.opt.pagebreak[key] || []); + var _forceRemove = function _forceRemove(node) { + arrayPush(DOMPurify.removed, { + element: node + }); - if (select[key].length > 0) { - select[key] = Array.prototype.slice.call(root.querySelectorAll(select[key].join(', '))); + try { + // eslint-disable-next-line unicorn/prefer-dom-node-remove + node.parentNode.removeChild(node); + } catch (_) { + try { + node.outerHTML = emptyHTML; + } catch (_) { + node.remove(); + } } - }); // Get all legacy page-break elements. + }; + /** + * _removeAttribute + * + * @param {String} name an Attribute name + * @param {Node} node a DOM node + */ - var legacyEls = root.querySelectorAll('.html2pdf__page-break'); - legacyEls = Array.prototype.slice.call(legacyEls); // Loop through all elements. - var els = root.querySelectorAll('*'); - Array.prototype.forEach.call(els, function pagebreak_loop(el) { - // Setup pagebreak rules based on legacy and avoidAll modes. - var rules = { - before: false, - after: mode.legacy && legacyEls.indexOf(el) !== -1, - avoid: mode.avoidAll - }; // Add rules for css mode. + var _removeAttribute = function _removeAttribute(name, node) { + try { + arrayPush(DOMPurify.removed, { + attribute: node.getAttributeNode(name), + from: node + }); + } catch (_) { + arrayPush(DOMPurify.removed, { + attribute: null, + from: node + }); + } - if (mode.css) { - // TODO: Check if this is valid with iFrames. - var style = window.getComputedStyle(el); // TODO: Handle 'left' and 'right' correctly. - // TODO: Add support for 'avoid' on breakBefore/After. + node.removeAttribute(name); // We void attribute values for unremovable "is"" attributes - var breakOpt = ['always', 'page', 'left', 'right']; - var avoidOpt = ['avoid', 'avoid-page']; - rules = { - before: rules.before || breakOpt.indexOf(style.breakBefore || style.pageBreakBefore) !== -1, - after: rules.after || breakOpt.indexOf(style.breakAfter || style.pageBreakAfter) !== -1, - avoid: rules.avoid || avoidOpt.indexOf(style.breakInside || style.pageBreakInside) !== -1 - }; - } // Add rules for explicit requests. + if (name === 'is' && !ALLOWED_ATTR[name]) { + if (RETURN_DOM || RETURN_DOM_FRAGMENT) { + try { + _forceRemove(node); + } catch (_) {} + } else { + try { + node.setAttribute(name, ''); + } catch (_) {} + } + } + }; + /** + * _initDocument + * + * @param {String} dirty a string of dirty markup + * @return {Document} a DOM, filled with the dirty markup + */ - Object.keys(rules).forEach(function (key) { - rules[key] = rules[key] || select[key].indexOf(el) !== -1; - }); // Get element position on the screen. - // TODO: Subtract the top of the container from clientRect.top/bottom? + var _initDocument = function _initDocument(dirty) { + /* Create a HTML document */ + var doc; + var leadingWhitespace; - var clientRect = el.getBoundingClientRect(); // Avoid: Check if a break happens mid-element. + if (FORCE_BODY) { + dirty = '' + dirty; + } else { + /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */ + var matches = stringMatch(dirty, /^[\r\n\t ]+/); + leadingWhitespace = matches && matches[0]; + } - if (rules.avoid && !rules.before) { - var startPage = Math.floor(clientRect.top / pxPageHeight); - var endPage = Math.floor(clientRect.bottom / pxPageHeight); - var nPages = Math.abs(clientRect.bottom - clientRect.top) / pxPageHeight; // Turn on rules.before if the el is broken and is at most one page long. + if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) { + // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict) + dirty = '' + dirty + ''; + } - if (endPage !== startPage && nPages <= 1) { - rules.before = true; - } - } // Before: Create a padding div to push the element to the next page. + var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; + /* + * Use the DOMParser API by default, fallback later if needs be + * DOMParser not work for svg when has multiple root element. + */ + if (NAMESPACE === HTML_NAMESPACE) { + try { + doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE); + } catch (_) {} + } + /* Use createHTMLDocument in case DOMParser is not available */ - if (rules.before) { - var pad = (0,_utils_js__WEBPACK_IMPORTED_MODULE_6__.createElement)('div', { - style: { - display: 'block', - height: pxPageHeight - clientRect.top % pxPageHeight + 'px' - } - }); - el.parentNode.insertBefore(pad, el); - } // After: Create a padding div to fill the remaining page. + if (!doc || !doc.documentElement) { + doc = implementation.createDocument(NAMESPACE, 'template', null); - if (rules.after) { - var pad = (0,_utils_js__WEBPACK_IMPORTED_MODULE_6__.createElement)('div', { - style: { - display: 'block', - height: pxPageHeight - clientRect.bottom % pxPageHeight + 'px' - } - }); - el.parentNode.insertBefore(pad, el.nextSibling); + try { + doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload; + } catch (_) {// Syntax error if dirtyPayload is invalid xml + } } - }); - }); -}; - -/***/ }), - -/***/ "./src/utils.js": -/*!**********************!*\ - !*** ./src/utils.js ***! - \**********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "objType": function() { return /* binding */ objType; }, -/* harmony export */ "createElement": function() { return /* binding */ createElement; }, -/* harmony export */ "cloneNode": function() { return /* binding */ cloneNode; }, -/* harmony export */ "unitConvert": function() { return /* binding */ unitConvert; }, -/* harmony export */ "toPx": function() { return /* binding */ toPx; } -/* harmony export */ }); -/* harmony import */ var core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.number.constructor.js */ "./node_modules/core-js/modules/es.number.constructor.js"); -/* harmony import */ var core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.symbol.js */ "./node_modules/core-js/modules/es.symbol.js"); -/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.symbol.description.js */ "./node_modules/core-js/modules/es.symbol.description.js"); -/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es.object.to-string.js */ "./node_modules/core-js/modules/es.object.to-string.js"); -/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ "./node_modules/core-js/modules/es.symbol.iterator.js"); -/* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/es.array.iterator.js */ "./node_modules/core-js/modules/es.array.iterator.js"); -/* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/es.string.iterator.js */ "./node_modules/core-js/modules/es.string.iterator.js"); -/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ "./node_modules/core-js/modules/web.dom-collections.iterator.js"); -/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_7__); + var body = doc.body || doc.documentElement; + if (dirty && leadingWhitespace) { + body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null); + } + /* Work on whole document or just its body */ + if (NAMESPACE === HTML_NAMESPACE) { + return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0]; + } + return WHOLE_DOCUMENT ? doc.documentElement : body; + }; + /** + * _createIterator + * + * @param {Document} root document/fragment to create iterator for + * @return {Iterator} iterator instance + */ + var _createIterator = function _createIterator(root) { + return createNodeIterator.call(root.ownerDocument || root, root, // eslint-disable-next-line no-bitwise + NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null, false); + }; + /** + * _isClobbered + * + * @param {Node} elm element to check for clobbering attacks + * @return {Boolean} true if clobbered, false if safe + */ -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + var _isClobbered = function _isClobbered(elm) { + return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function'); + }; + /** + * _isNode + * + * @param {Node} obj object to check whether it's a DOM node + * @return {Boolean} true is object is a DOM node + */ -// Determine the type of a variable/object. -var objType = function objType(obj) { - var type = _typeof(obj); - if (type === 'undefined') return 'undefined';else if (type === 'string' || obj instanceof String) return 'string';else if (type === 'number' || obj instanceof Number) return 'number';else if (type === 'function' || obj instanceof Function) return 'function';else if (!!obj && obj.constructor === Array) return 'array';else if (obj && obj.nodeType === 1) return 'element';else if (type === 'object') return 'object';else return 'unknown'; -}; // Create an HTML element with optional className, innerHTML, and style. + var _isNode = function _isNode(object) { + return _typeof(Node) === 'object' ? object instanceof Node : object && _typeof(object) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'; + }; + /** + * _executeHook + * Execute user configurable hooks + * + * @param {String} entryPoint Name of the hook's entry point + * @param {Node} currentNode node to work on with the hook + * @param {Object} data additional hook parameters + */ -var createElement = function createElement(tagName, opt) { - var el = document.createElement(tagName); - if (opt.className) el.className = opt.className; - if (opt.innerHTML) { - el.innerHTML = opt.innerHTML; - var scripts = el.getElementsByTagName('script'); + var _executeHook = function _executeHook(entryPoint, currentNode, data) { + if (!hooks[entryPoint]) { + return; + } - for (var i = scripts.length; i-- > 0; null) { - scripts[i].parentNode.removeChild(scripts[i]); - } - } + arrayForEach(hooks[entryPoint], function (hook) { + hook.call(DOMPurify, currentNode, data, CONFIG); + }); + }; + /** + * _sanitizeElements + * + * @protect nodeName + * @protect textContent + * @protect removeChild + * + * @param {Node} currentNode to check for permission to exist + * @return {Boolean} true if node was killed, false if left alive + */ - for (var key in opt.style) { - el.style[key] = opt.style[key]; - } - return el; -}; // Deep-clone a node and preserve contents/properties. + var _sanitizeElements = function _sanitizeElements(currentNode) { + var content; + /* Execute a hook if present */ -var cloneNode = function cloneNode(node, javascriptEnabled) { - // Recursively clone the node. - var clone = node.nodeType === 3 ? document.createTextNode(node.nodeValue) : node.cloneNode(false); + _executeHook('beforeSanitizeElements', currentNode, null); + /* Check if element is clobbered or can clobber */ - for (var child = node.firstChild; child; child = child.nextSibling) { - if (javascriptEnabled === true || child.nodeType !== 1 || child.nodeName !== 'SCRIPT') { - clone.appendChild(cloneNode(child, javascriptEnabled)); - } - } - if (node.nodeType === 1) { - // Preserve contents/properties of special nodes. - if (node.nodeName === 'CANVAS') { - clone.width = node.width; - clone.height = node.height; - clone.getContext('2d').drawImage(node, 0, 0); - } else if (node.nodeName === 'TEXTAREA' || node.nodeName === 'SELECT') { - clone.value = node.value; - } // Preserve the node's scroll position when it loads. + if (_isClobbered(currentNode)) { + _forceRemove(currentNode); + return true; + } + /* Check if tagname contains Unicode */ - clone.addEventListener('load', function () { - clone.scrollTop = node.scrollTop; - clone.scrollLeft = node.scrollLeft; - }, true); - } // Return the cloned node. + if (regExpTest(/[\u0080-\uFFFF]/, currentNode.nodeName)) { + _forceRemove(currentNode); - return clone; -}; // Convert units from px using the conversion value 'k' from jsPDF. + return true; + } + /* Now let's check the element's type and name */ -var unitConvert = function unitConvert(obj, k) { - if (objType(obj) === 'number') { - return obj * 72 / 96 / k; - } else { - var newObj = {}; - for (var key in obj) { - newObj[key] = obj[key] * 72 / 96 / k; - } + var tagName = transformCaseFunc(currentNode.nodeName); + /* Execute a hook if present */ - return newObj; - } -}; // Convert units to px using the conversion value 'k' from jsPDF. + _executeHook('uponSanitizeElement', currentNode, { + tagName: tagName, + allowedTags: ALLOWED_TAGS + }); + /* Detect mXSS attempts abusing namespace confusion */ -var toPx = function toPx(val, k) { - return Math.floor(val * k / 72 * 96); -}; -/***/ }), + if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) { + _forceRemove(currentNode); -/***/ "./src/worker.js": -/*!***********************!*\ - !*** ./src/worker.js ***! - \***********************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { + return true; + } + /* Mitigate a problem with templates inside select */ -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var core_js_modules_es_object_assign_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.object.assign.js */ "./node_modules/core-js/modules/es.object.assign.js"); -/* harmony import */ var core_js_modules_es_object_assign_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_assign_js__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.array.map.js */ "./node_modules/core-js/modules/es.array.map.js"); -/* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.object.keys.js */ "./node_modules/core-js/modules/es.object.keys.js"); -/* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es.array.concat.js */ "./node_modules/core-js/modules/es.array.concat.js"); -/* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es.object.to-string.js */ "./node_modules/core-js/modules/es.object.to-string.js"); -/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ "./node_modules/core-js/modules/es.regexp.to-string.js"); -/* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/es.function.name.js */ "./node_modules/core-js/modules/es.function.name.js"); -/* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ "./node_modules/core-js/modules/web.dom-collections.for-each.js"); -/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var jspdf__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! jspdf */ "./node_modules/jspdf/dist/jspdf.es.min.js"); -/* harmony import */ var html2canvas__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! html2canvas */ "./node_modules/html2canvas/dist/html2canvas.js"); -/* harmony import */ var html2canvas__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(html2canvas__WEBPACK_IMPORTED_MODULE_9__); -/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils.js */ "./src/utils.js"); -/* harmony import */ var es6_promise__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js"); -/* harmony import */ var es6_promise__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(es6_promise__WEBPACK_IMPORTED_MODULE_11__); + if (tagName === 'select' && regExpTest(/