x-cnhis-editor
Version:
``` npm install ```
1,357 lines (1,123 loc) • 416 kB
JavaScript
((typeof self !== 'undefined' ? self : this)["webpackChunkhoeditor"] = (typeof self !== 'undefined' ? self : this)["webpackChunkhoeditor"] || []).push([[652],{
/***/ 4653:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
AElement: function() { return /* binding */ AElement; },
AnimateColorElement: function() { return /* binding */ AnimateColorElement; },
AnimateElement: function() { return /* binding */ AnimateElement; },
AnimateTransformElement: function() { return /* binding */ AnimateTransformElement; },
BoundingBox: function() { return /* binding */ BoundingBox; },
CB1: function() { return /* binding */ CB1; },
CB2: function() { return /* binding */ CB2; },
CB3: function() { return /* binding */ CB3; },
CB4: function() { return /* binding */ CB4; },
Canvg: function() { return /* binding */ Canvg; },
CircleElement: function() { return /* binding */ CircleElement; },
ClipPathElement: function() { return /* binding */ ClipPathElement; },
DefsElement: function() { return /* binding */ DefsElement; },
DescElement: function() { return /* binding */ DescElement; },
Document: function() { return /* binding */ Document; },
Element: function() { return /* binding */ Element; },
EllipseElement: function() { return /* binding */ EllipseElement; },
FeColorMatrixElement: function() { return /* binding */ FeColorMatrixElement; },
FeCompositeElement: function() { return /* binding */ FeCompositeElement; },
FeDropShadowElement: function() { return /* binding */ FeDropShadowElement; },
FeGaussianBlurElement: function() { return /* binding */ FeGaussianBlurElement; },
FeMorphologyElement: function() { return /* binding */ FeMorphologyElement; },
FilterElement: function() { return /* binding */ FilterElement; },
Font: function() { return /* binding */ Font; },
FontElement: function() { return /* binding */ FontElement; },
FontFaceElement: function() { return /* binding */ FontFaceElement; },
GElement: function() { return /* binding */ GElement; },
GlyphElement: function() { return /* binding */ GlyphElement; },
GradientElement: function() { return /* binding */ GradientElement; },
ImageElement: function() { return /* binding */ ImageElement; },
LineElement: function() { return /* binding */ LineElement; },
LinearGradientElement: function() { return /* binding */ LinearGradientElement; },
MarkerElement: function() { return /* binding */ MarkerElement; },
MaskElement: function() { return /* binding */ MaskElement; },
Matrix: function() { return /* binding */ Matrix; },
MissingGlyphElement: function() { return /* binding */ MissingGlyphElement; },
Mouse: function() { return /* binding */ Mouse; },
PSEUDO_ZERO: function() { return /* binding */ PSEUDO_ZERO; },
Parser: function() { return /* binding */ Parser; },
PathElement: function() { return /* binding */ PathElement; },
PathParser: function() { return /* binding */ PathParser; },
PatternElement: function() { return /* binding */ PatternElement; },
Point: function() { return /* binding */ Point; },
PolygonElement: function() { return /* binding */ PolygonElement; },
PolylineElement: function() { return /* binding */ PolylineElement; },
Property: function() { return /* binding */ Property; },
QB1: function() { return /* binding */ QB1; },
QB2: function() { return /* binding */ QB2; },
QB3: function() { return /* binding */ QB3; },
RadialGradientElement: function() { return /* binding */ RadialGradientElement; },
RectElement: function() { return /* binding */ RectElement; },
RenderedElement: function() { return /* binding */ RenderedElement; },
Rotate: function() { return /* binding */ Rotate; },
SVGElement: function() { return /* binding */ SVGElement; },
SVGFontLoader: function() { return /* binding */ SVGFontLoader; },
Scale: function() { return /* binding */ Scale; },
Screen: function() { return /* binding */ Screen; },
Skew: function() { return /* binding */ Skew; },
SkewX: function() { return /* binding */ SkewX; },
SkewY: function() { return /* binding */ SkewY; },
StopElement: function() { return /* binding */ StopElement; },
StyleElement: function() { return /* binding */ StyleElement; },
SymbolElement: function() { return /* binding */ SymbolElement; },
TRefElement: function() { return /* binding */ TRefElement; },
TSpanElement: function() { return /* binding */ TSpanElement; },
TextElement: function() { return /* binding */ TextElement; },
TextPathElement: function() { return /* binding */ TextPathElement; },
TitleElement: function() { return /* binding */ TitleElement; },
Transform: function() { return /* binding */ Transform; },
Translate: function() { return /* binding */ Translate; },
UnknownElement: function() { return /* binding */ UnknownElement; },
UseElement: function() { return /* binding */ UseElement; },
ViewPort: function() { return /* binding */ ViewPort; },
compressSpaces: function() { return /* binding */ compressSpaces; },
"default": function() { return /* binding */ index_es; },
getSelectorSpecificity: function() { return /* binding */ getSelectorSpecificity; },
normalizeAttributeName: function() { return /* binding */ normalizeAttributeName; },
normalizeColor: function() { return /* binding */ normalizeColor; },
parseExternalUrl: function() { return /* binding */ parseExternalUrl; },
presets: function() { return /* binding */ index; },
toNumbers: function() { return /* binding */ toNumbers; },
trimLeft: function() { return /* binding */ trimLeft; },
trimRight: function() { return /* binding */ trimRight; },
vectorMagnitude: function() { return /* binding */ vectorMagnitude; },
vectorsAngle: function() { return /* binding */ vectorsAngle; },
vectorsRatio: function() { return /* binding */ vectorsRatio; }
});
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.array.map.js
var es_array_map = __webpack_require__(44936);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.regexp.exec.js
var es_regexp_exec = __webpack_require__(39458);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.string.match.js
var es_string_match = __webpack_require__(98694);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.string.replace.js
var es_string_replace = __webpack_require__(63887);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.string.starts-with.js
var es_string_starts_with = __webpack_require__(81910);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.array.join.js
var es_array_join = __webpack_require__(33408);
// EXTERNAL MODULE: ./node_modules/.store/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 3 modules
var slicedToArray = __webpack_require__(80634);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.symbol.js
var es_symbol = __webpack_require__(5560);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.array.filter.js
var es_array_filter = __webpack_require__(93813);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.array.for-each.js
var es_array_for_each = __webpack_require__(50270);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.object.get-own-property-descriptor.js
var es_object_get_own_property_descriptor = __webpack_require__(34877);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.object.get-own-property-descriptors.js
var es_object_get_own_property_descriptors = __webpack_require__(69928);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.object.keys.js
var es_object_keys = __webpack_require__(69874);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/web.dom-collections.for-each.js
var web_dom_collections_for_each = __webpack_require__(16544);
// EXTERNAL MODULE: ./node_modules/.store/@babel+runtime@7.22.6/node_modules/@babel/runtime/regenerator/index.js
var regenerator = __webpack_require__(16809);
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
// EXTERNAL MODULE: ./node_modules/.store/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(11268);
// EXTERNAL MODULE: ./node_modules/.store/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/defineProperty.js
var defineProperty = __webpack_require__(27370);
// EXTERNAL MODULE: ./node_modules/.store/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/classCallCheck.js
var classCallCheck = __webpack_require__(49664);
// EXTERNAL MODULE: ./node_modules/.store/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/createClass.js
var createClass = __webpack_require__(69744);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.array.concat.js
var es_array_concat = __webpack_require__(42793);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.array.every.js
var es_array_every = __webpack_require__(53048);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.array.reduce.js
var es_array_reduce = __webpack_require__(33462);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.object.to-string.js
var es_object_to_string = __webpack_require__(39801);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.promise.js
var es_promise = __webpack_require__(55859);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.string.split.js
var es_string_split = __webpack_require__(29934);
// EXTERNAL MODULE: ./node_modules/.store/raf@3.4.1/node_modules/raf/index.js
var raf = __webpack_require__(50222);
var raf_default = /*#__PURE__*/__webpack_require__.n(raf);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.function.name.js
var es_function_name = __webpack_require__(28539);
// EXTERNAL MODULE: ./node_modules/.store/rgbcolor@1.0.1/node_modules/rgbcolor/index.js
var rgbcolor = __webpack_require__(66781);
var rgbcolor_default = /*#__PURE__*/__webpack_require__.n(rgbcolor);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.reflect.construct.js
var es_reflect_construct = __webpack_require__(92268);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.regexp.to-string.js
var es_regexp_to_string = __webpack_require__(80849);
// EXTERNAL MODULE: ./node_modules/.store/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
var possibleConstructorReturn = __webpack_require__(73921);
// EXTERNAL MODULE: ./node_modules/.store/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
var getPrototypeOf = __webpack_require__(64460);
// EXTERNAL MODULE: ./node_modules/.store/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules
var inherits = __webpack_require__(78514);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.array.from.js
var es_array_from = __webpack_require__(93827);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.array.includes.js
var es_array_includes = __webpack_require__(19993);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.array.some.js
var es_array_some = __webpack_require__(50030);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.string.includes.js
var es_string_includes = __webpack_require__(85878);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.string.iterator.js
var es_string_iterator = __webpack_require__(47554);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.string.trim.js
var es_string_trim = __webpack_require__(78447);
// EXTERNAL MODULE: ./node_modules/.store/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 3 modules
var toConsumableArray = __webpack_require__(20564);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.array.index-of.js
var es_array_index_of = __webpack_require__(26275);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.array.reverse.js
var es_array_reverse = __webpack_require__(29130);
// EXTERNAL MODULE: ./node_modules/.store/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/get.js + 1 modules
var get = __webpack_require__(3840);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.number.constructor.js
var es_number_constructor = __webpack_require__(64523);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.array.fill.js
var es_array_fill = __webpack_require__(93641);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.reflect.delete-property.js
var es_reflect_delete_property = __webpack_require__(51880);
// EXTERNAL MODULE: ./node_modules/.store/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
var assertThisInitialized = __webpack_require__(13020);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.array.iterator.js
var es_array_iterator = __webpack_require__(63365);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/web.dom-collections.iterator.js
var web_dom_collections_iterator = __webpack_require__(85219);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.symbol.description.js
var es_symbol_description = __webpack_require__(20256);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.symbol.iterator.js
var es_symbol_iterator = __webpack_require__(46722);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.array.slice.js
var es_array_slice = __webpack_require__(35265);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.map.js
var es_map = __webpack_require__(17085);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.reflect.apply.js
var es_reflect_apply = __webpack_require__(82925);
// EXTERNAL MODULE: ./node_modules/.store/core-js@3.31.1/node_modules/core-js/modules/es.reflect.get-prototype-of.js
var es_reflect_get_prototype_of = __webpack_require__(41665);
;// CONCATENATED MODULE: ./node_modules/.store/stackblur-canvas@2.6.0/node_modules/stackblur-canvas/dist/stackblur-es.js
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
return typeof obj;
};
} else {
_typeof = function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
/* eslint-disable no-bitwise -- used for calculations */
/* eslint-disable unicorn/prefer-query-selector -- aiming at
backward-compatibility */
/**
* StackBlur - a fast almost Gaussian Blur For Canvas
*
* In case you find this class useful - especially in commercial projects -
* I am not totally unhappy for a small donation to my PayPal account
* mario@quasimondo.de
*
* Or support me on flattr:
* {@link https://flattr.com/thing/72791/StackBlur-a-fast-almost-Gaussian-Blur-Effect-for-CanvasJavascript}.
*
* @module StackBlur
* @author Mario Klingemann
* Contact: mario@quasimondo.com
* Website: {@link http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html}
* Twitter: @quasimondo
*
* @copyright (c) 2010 Mario Klingemann
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
var mulTable = [512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292, 512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292, 273, 512, 482, 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, 259, 496, 475, 456, 437, 420, 404, 388, 374, 360, 347, 335, 323, 312, 302, 292, 282, 273, 265, 512, 497, 482, 468, 454, 441, 428, 417, 405, 394, 383, 373, 364, 354, 345, 337, 328, 320, 312, 305, 298, 291, 284, 278, 271, 265, 259, 507, 496, 485, 475, 465, 456, 446, 437, 428, 420, 412, 404, 396, 388, 381, 374, 367, 360, 354, 347, 341, 335, 329, 323, 318, 312, 307, 302, 297, 292, 287, 282, 278, 273, 269, 265, 261, 512, 505, 497, 489, 482, 475, 468, 461, 454, 447, 441, 435, 428, 422, 417, 411, 405, 399, 394, 389, 383, 378, 373, 368, 364, 359, 354, 350, 345, 341, 337, 332, 328, 324, 320, 316, 312, 309, 305, 301, 298, 294, 291, 287, 284, 281, 278, 274, 271, 268, 265, 262, 259, 257, 507, 501, 496, 491, 485, 480, 475, 470, 465, 460, 456, 451, 446, 442, 437, 433, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 388, 385, 381, 377, 374, 370, 367, 363, 360, 357, 354, 350, 347, 344, 341, 338, 335, 332, 329, 326, 323, 320, 318, 315, 312, 310, 307, 304, 302, 299, 297, 294, 292, 289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259];
var shgTable = [9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24];
/**
* @param {string|HTMLImageElement} img
* @param {string|HTMLCanvasElement} canvas
* @param {Float} radius
* @param {boolean} blurAlphaChannel
* @param {boolean} useOffset
* @param {boolean} skipStyles
* @returns {undefined}
*/
function processImage(img, canvas, radius, blurAlphaChannel, useOffset, skipStyles) {
if (typeof img === 'string') {
img = document.getElementById(img);
}
if (!img || !('naturalWidth' in img)) {
return;
}
var dimensionType = useOffset ? 'offset' : 'natural';
var w = img[dimensionType + 'Width'];
var h = img[dimensionType + 'Height'];
if (typeof canvas === 'string') {
canvas = document.getElementById(canvas);
}
if (!canvas || !('getContext' in canvas)) {
return;
}
if (!skipStyles) {
canvas.style.width = w + 'px';
canvas.style.height = h + 'px';
}
canvas.width = w;
canvas.height = h;
var context = canvas.getContext('2d');
context.clearRect(0, 0, w, h);
context.drawImage(img, 0, 0, img.naturalWidth, img.naturalHeight, 0, 0, w, h);
if (isNaN(radius) || radius < 1) {
return;
}
if (blurAlphaChannel) {
processCanvasRGBA(canvas, 0, 0, w, h, radius);
} else {
processCanvasRGB(canvas, 0, 0, w, h, radius);
}
}
/**
* @param {string|HTMLCanvasElement} canvas
* @param {Integer} topX
* @param {Integer} topY
* @param {Integer} width
* @param {Integer} height
* @throws {Error|TypeError}
* @returns {ImageData} See {@link https://html.spec.whatwg.org/multipage/canvas.html#imagedata}
*/
function getImageDataFromCanvas(canvas, topX, topY, width, height) {
if (typeof canvas === 'string') {
canvas = document.getElementById(canvas);
}
if (!canvas || _typeof(canvas) !== 'object' || !('getContext' in canvas)) {
throw new TypeError('Expecting canvas with `getContext` method ' + 'in processCanvasRGB(A) calls!');
}
var context = canvas.getContext('2d');
try {
return context.getImageData(topX, topY, width, height);
} catch (e) {
throw new Error('unable to access image data: ' + e);
}
}
/**
* @param {HTMLCanvasElement} canvas
* @param {Integer} topX
* @param {Integer} topY
* @param {Integer} width
* @param {Integer} height
* @param {Float} radius
* @returns {undefined}
*/
function processCanvasRGBA(canvas, topX, topY, width, height, radius) {
if (isNaN(radius) || radius < 1) {
return;
}
radius |= 0;
var imageData = getImageDataFromCanvas(canvas, topX, topY, width, height);
imageData = processImageDataRGBA(imageData, topX, topY, width, height, radius);
canvas.getContext('2d').putImageData(imageData, topX, topY);
}
/**
* @param {ImageData} imageData
* @param {Integer} topX
* @param {Integer} topY
* @param {Integer} width
* @param {Integer} height
* @param {Float} radius
* @returns {ImageData}
*/
function processImageDataRGBA(imageData, topX, topY, width, height, radius) {
var pixels = imageData.data;
var div = 2 * radius + 1; // const w4 = width << 2;
var widthMinus1 = width - 1;
var heightMinus1 = height - 1;
var radiusPlus1 = radius + 1;
var sumFactor = radiusPlus1 * (radiusPlus1 + 1) / 2;
var stackStart = new BlurStack();
var stack = stackStart;
var stackEnd;
for (var i = 1; i < div; i++) {
stack = stack.next = new BlurStack();
if (i === radiusPlus1) {
stackEnd = stack;
}
}
stack.next = stackStart;
var stackIn = null,
stackOut = null,
yw = 0,
yi = 0;
var mulSum = mulTable[radius];
var shgSum = shgTable[radius];
for (var y = 0; y < height; y++) {
stack = stackStart;
var pr = pixels[yi],
pg = pixels[yi + 1],
pb = pixels[yi + 2],
pa = pixels[yi + 3];
for (var _i = 0; _i < radiusPlus1; _i++) {
stack.r = pr;
stack.g = pg;
stack.b = pb;
stack.a = pa;
stack = stack.next;
}
var rInSum = 0,
gInSum = 0,
bInSum = 0,
aInSum = 0,
rOutSum = radiusPlus1 * pr,
gOutSum = radiusPlus1 * pg,
bOutSum = radiusPlus1 * pb,
aOutSum = radiusPlus1 * pa,
rSum = sumFactor * pr,
gSum = sumFactor * pg,
bSum = sumFactor * pb,
aSum = sumFactor * pa;
for (var _i2 = 1; _i2 < radiusPlus1; _i2++) {
var p = yi + ((widthMinus1 < _i2 ? widthMinus1 : _i2) << 2);
var r = pixels[p],
g = pixels[p + 1],
b = pixels[p + 2],
a = pixels[p + 3];
var rbs = radiusPlus1 - _i2;
rSum += (stack.r = r) * rbs;
gSum += (stack.g = g) * rbs;
bSum += (stack.b = b) * rbs;
aSum += (stack.a = a) * rbs;
rInSum += r;
gInSum += g;
bInSum += b;
aInSum += a;
stack = stack.next;
}
stackIn = stackStart;
stackOut = stackEnd;
for (var x = 0; x < width; x++) {
var paInitial = aSum * mulSum >> shgSum;
pixels[yi + 3] = paInitial;
if (paInitial !== 0) {
var _a2 = 255 / paInitial;
pixels[yi] = (rSum * mulSum >> shgSum) * _a2;
pixels[yi + 1] = (gSum * mulSum >> shgSum) * _a2;
pixels[yi + 2] = (bSum * mulSum >> shgSum) * _a2;
} else {
pixels[yi] = pixels[yi + 1] = pixels[yi + 2] = 0;
}
rSum -= rOutSum;
gSum -= gOutSum;
bSum -= bOutSum;
aSum -= aOutSum;
rOutSum -= stackIn.r;
gOutSum -= stackIn.g;
bOutSum -= stackIn.b;
aOutSum -= stackIn.a;
var _p = x + radius + 1;
_p = yw + (_p < widthMinus1 ? _p : widthMinus1) << 2;
rInSum += stackIn.r = pixels[_p];
gInSum += stackIn.g = pixels[_p + 1];
bInSum += stackIn.b = pixels[_p + 2];
aInSum += stackIn.a = pixels[_p + 3];
rSum += rInSum;
gSum += gInSum;
bSum += bInSum;
aSum += aInSum;
stackIn = stackIn.next;
var _stackOut = stackOut,
_r = _stackOut.r,
_g = _stackOut.g,
_b = _stackOut.b,
_a = _stackOut.a;
rOutSum += _r;
gOutSum += _g;
bOutSum += _b;
aOutSum += _a;
rInSum -= _r;
gInSum -= _g;
bInSum -= _b;
aInSum -= _a;
stackOut = stackOut.next;
yi += 4;
}
yw += width;
}
for (var _x = 0; _x < width; _x++) {
yi = _x << 2;
var _pr = pixels[yi],
_pg = pixels[yi + 1],
_pb = pixels[yi + 2],
_pa = pixels[yi + 3],
_rOutSum = radiusPlus1 * _pr,
_gOutSum = radiusPlus1 * _pg,
_bOutSum = radiusPlus1 * _pb,
_aOutSum = radiusPlus1 * _pa,
_rSum = sumFactor * _pr,
_gSum = sumFactor * _pg,
_bSum = sumFactor * _pb,
_aSum = sumFactor * _pa;
stack = stackStart;
for (var _i3 = 0; _i3 < radiusPlus1; _i3++) {
stack.r = _pr;
stack.g = _pg;
stack.b = _pb;
stack.a = _pa;
stack = stack.next;
}
var yp = width;
var _gInSum = 0,
_bInSum = 0,
_aInSum = 0,
_rInSum = 0;
for (var _i4 = 1; _i4 <= radius; _i4++) {
yi = yp + _x << 2;
var _rbs = radiusPlus1 - _i4;
_rSum += (stack.r = _pr = pixels[yi]) * _rbs;
_gSum += (stack.g = _pg = pixels[yi + 1]) * _rbs;
_bSum += (stack.b = _pb = pixels[yi + 2]) * _rbs;
_aSum += (stack.a = _pa = pixels[yi + 3]) * _rbs;
_rInSum += _pr;
_gInSum += _pg;
_bInSum += _pb;
_aInSum += _pa;
stack = stack.next;
if (_i4 < heightMinus1) {
yp += width;
}
}
yi = _x;
stackIn = stackStart;
stackOut = stackEnd;
for (var _y = 0; _y < height; _y++) {
var _p2 = yi << 2;
pixels[_p2 + 3] = _pa = _aSum * mulSum >> shgSum;
if (_pa > 0) {
_pa = 255 / _pa;
pixels[_p2] = (_rSum * mulSum >> shgSum) * _pa;
pixels[_p2 + 1] = (_gSum * mulSum >> shgSum) * _pa;
pixels[_p2 + 2] = (_bSum * mulSum >> shgSum) * _pa;
} else {
pixels[_p2] = pixels[_p2 + 1] = pixels[_p2 + 2] = 0;
}
_rSum -= _rOutSum;
_gSum -= _gOutSum;
_bSum -= _bOutSum;
_aSum -= _aOutSum;
_rOutSum -= stackIn.r;
_gOutSum -= stackIn.g;
_bOutSum -= stackIn.b;
_aOutSum -= stackIn.a;
_p2 = _x + ((_p2 = _y + radiusPlus1) < heightMinus1 ? _p2 : heightMinus1) * width << 2;
_rSum += _rInSum += stackIn.r = pixels[_p2];
_gSum += _gInSum += stackIn.g = pixels[_p2 + 1];
_bSum += _bInSum += stackIn.b = pixels[_p2 + 2];
_aSum += _aInSum += stackIn.a = pixels[_p2 + 3];
stackIn = stackIn.next;
_rOutSum += _pr = stackOut.r;
_gOutSum += _pg = stackOut.g;
_bOutSum += _pb = stackOut.b;
_aOutSum += _pa = stackOut.a;
_rInSum -= _pr;
_gInSum -= _pg;
_bInSum -= _pb;
_aInSum -= _pa;
stackOut = stackOut.next;
yi += width;
}
}
return imageData;
}
/**
* @param {HTMLCanvasElement} canvas
* @param {Integer} topX
* @param {Integer} topY
* @param {Integer} width
* @param {Integer} height
* @param {Float} radius
* @returns {undefined}
*/
function processCanvasRGB(canvas, topX, topY, width, height, radius) {
if (isNaN(radius) || radius < 1) {
return;
}
radius |= 0;
var imageData = getImageDataFromCanvas(canvas, topX, topY, width, height);
imageData = processImageDataRGB(imageData, topX, topY, width, height, radius);
canvas.getContext('2d').putImageData(imageData, topX, topY);
}
/**
* @param {ImageData} imageData
* @param {Integer} topX
* @param {Integer} topY
* @param {Integer} width
* @param {Integer} height
* @param {Float} radius
* @returns {ImageData}
*/
function processImageDataRGB(imageData, topX, topY, width, height, radius) {
var pixels = imageData.data;
var div = 2 * radius + 1; // const w4 = width << 2;
var widthMinus1 = width - 1;
var heightMinus1 = height - 1;
var radiusPlus1 = radius + 1;
var sumFactor = radiusPlus1 * (radiusPlus1 + 1) / 2;
var stackStart = new BlurStack();
var stack = stackStart;
var stackEnd;
for (var i = 1; i < div; i++) {
stack = stack.next = new BlurStack();
if (i === radiusPlus1) {
stackEnd = stack;
}
}
stack.next = stackStart;
var stackIn = null;
var stackOut = null;
var mulSum = mulTable[radius];
var shgSum = shgTable[radius];
var p, rbs;
var yw = 0,
yi = 0;
for (var y = 0; y < height; y++) {
var pr = pixels[yi],
pg = pixels[yi + 1],
pb = pixels[yi + 2],
rOutSum = radiusPlus1 * pr,
gOutSum = radiusPlus1 * pg,
bOutSum = radiusPlus1 * pb,
rSum = sumFactor * pr,
gSum = sumFactor * pg,
bSum = sumFactor * pb;
stack = stackStart;
for (var _i5 = 0; _i5 < radiusPlus1; _i5++) {
stack.r = pr;
stack.g = pg;
stack.b = pb;
stack = stack.next;
}
var rInSum = 0,
gInSum = 0,
bInSum = 0;
for (var _i6 = 1; _i6 < radiusPlus1; _i6++) {
p = yi + ((widthMinus1 < _i6 ? widthMinus1 : _i6) << 2);
rSum += (stack.r = pr = pixels[p]) * (rbs = radiusPlus1 - _i6);
gSum += (stack.g = pg = pixels[p + 1]) * rbs;
bSum += (stack.b = pb = pixels[p + 2]) * rbs;
rInSum += pr;
gInSum += pg;
bInSum += pb;
stack = stack.next;
}
stackIn = stackStart;
stackOut = stackEnd;
for (var x = 0; x < width; x++) {
pixels[yi] = rSum * mulSum >> shgSum;
pixels[yi + 1] = gSum * mulSum >> shgSum;
pixels[yi + 2] = bSum * mulSum >> shgSum;
rSum -= rOutSum;
gSum -= gOutSum;
bSum -= bOutSum;
rOutSum -= stackIn.r;
gOutSum -= stackIn.g;
bOutSum -= stackIn.b;
p = yw + ((p = x + radius + 1) < widthMinus1 ? p : widthMinus1) << 2;
rInSum += stackIn.r = pixels[p];
gInSum += stackIn.g = pixels[p + 1];
bInSum += stackIn.b = pixels[p + 2];
rSum += rInSum;
gSum += gInSum;
bSum += bInSum;
stackIn = stackIn.next;
rOutSum += pr = stackOut.r;
gOutSum += pg = stackOut.g;
bOutSum += pb = stackOut.b;
rInSum -= pr;
gInSum -= pg;
bInSum -= pb;
stackOut = stackOut.next;
yi += 4;
}
yw += width;
}
for (var _x2 = 0; _x2 < width; _x2++) {
yi = _x2 << 2;
var _pr2 = pixels[yi],
_pg2 = pixels[yi + 1],
_pb2 = pixels[yi + 2],
_rOutSum2 = radiusPlus1 * _pr2,
_gOutSum2 = radiusPlus1 * _pg2,
_bOutSum2 = radiusPlus1 * _pb2,
_rSum2 = sumFactor * _pr2,
_gSum2 = sumFactor * _pg2,
_bSum2 = sumFactor * _pb2;
stack = stackStart;
for (var _i7 = 0; _i7 < radiusPlus1; _i7++) {
stack.r = _pr2;
stack.g = _pg2;
stack.b = _pb2;
stack = stack.next;
}
var _rInSum2 = 0,
_gInSum2 = 0,
_bInSum2 = 0;
for (var _i8 = 1, yp = width; _i8 <= radius; _i8++) {
yi = yp + _x2 << 2;
_rSum2 += (stack.r = _pr2 = pixels[yi]) * (rbs = radiusPlus1 - _i8);
_gSum2 += (stack.g = _pg2 = pixels[yi + 1]) * rbs;
_bSum2 += (stack.b = _pb2 = pixels[yi + 2]) * rbs;
_rInSum2 += _pr2;
_gInSum2 += _pg2;
_bInSum2 += _pb2;
stack = stack.next;
if (_i8 < heightMinus1) {
yp += width;
}
}
yi = _x2;
stackIn = stackStart;
stackOut = stackEnd;
for (var _y2 = 0; _y2 < height; _y2++) {
p = yi << 2;
pixels[p] = _rSum2 * mulSum >> shgSum;
pixels[p + 1] = _gSum2 * mulSum >> shgSum;
pixels[p + 2] = _bSum2 * mulSum >> shgSum;
_rSum2 -= _rOutSum2;
_gSum2 -= _gOutSum2;
_bSum2 -= _bOutSum2;
_rOutSum2 -= stackIn.r;
_gOutSum2 -= stackIn.g;
_bOutSum2 -= stackIn.b;
p = _x2 + ((p = _y2 + radiusPlus1) < heightMinus1 ? p : heightMinus1) * width << 2;
_rSum2 += _rInSum2 += stackIn.r = pixels[p];
_gSum2 += _gInSum2 += stackIn.g = pixels[p + 1];
_bSum2 += _bInSum2 += stackIn.b = pixels[p + 2];
stackIn = stackIn.next;
_rOutSum2 += _pr2 = stackOut.r;
_gOutSum2 += _pg2 = stackOut.g;
_bOutSum2 += _pb2 = stackOut.b;
_rInSum2 -= _pr2;
_gInSum2 -= _pg2;
_bInSum2 -= _pb2;
stackOut = stackOut.next;
yi += width;
}
}
return imageData;
}
/**
*
*/
var BlurStack =
/**
* Set properties.
*/
function BlurStack() {
_classCallCheck(this, BlurStack);
this.r = 0;
this.g = 0;
this.b = 0;
this.a = 0;
this.next = null;
};
;// CONCATENATED MODULE: ./node_modules/.store/canvg@3.0.6/node_modules/canvg/lib/index.es.js
/**
* HTML-safe compress white-spaces.
* @param str - String to compress.
*/
function compressSpaces(str) {
return str.replace(/(?!\u3000)\s+/gm, ' ');
}
/**
* HTML-safe left trim.
* @param str - String to trim.
*/
function trimLeft(str) {
return str.replace(/^[\n \t]+/, '');
}
/**
* HTML-safe right trim.
* @param str - String to trim.
*/
function trimRight(str) {
return str.replace(/[\n \t]+$/, '');
}
/**
* String to numbers array.
* @param str - Numbers string.
*/
function toNumbers(str) {
var matches = (str || '').match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm) || [];
return matches.map(parseFloat);
} // Microsoft Edge fix
var allUppercase = /^[A-Z-]+$/;
/**
* Normalize attribute name.
* @param name - Attribute name.
*/
function normalizeAttributeName(name) {
if (allUppercase.test(name)) {
return name.toLowerCase();
}
return name;
}
/**
* Parse external URL.
* @param url - CSS url string.
*/
function parseExternalUrl(url) {
// single quotes [2]
// v double quotes [3]
// v v no quotes [4]
// v v v
var urlMatch = url.match(/url\(('([^']+)'|"([^"]+)"|([^'"\)]+))\)/) || [];
return urlMatch[2] || urlMatch[3] || urlMatch[4];
}
/**
* Transform floats to integers in rgb colors.
* @param color - Color to normalize.
*/
function normalizeColor(color) {
if (!color.startsWith('rgb')) {
return color;
}
var rgbParts = 3;
var normalizedColor = color.replace(/\d+(\.\d+)?/g, function (num, isFloat) {
return rgbParts-- && isFloat ? String(Math.round(parseFloat(num))) : num;
});
return normalizedColor;
}
// slightly modified version of https://github.com/keeganstreet/specificity/blob/master/specificity.js
var attributeRegex = /(\[[^\]]+\])/g;
var idRegex = /(#[^\s\+>~\.\[:]+)/g;
var classRegex = /(\.[^\s\+>~\.\[:]+)/g;
var pseudoElementRegex = /(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi;
var pseudoClassWithBracketsRegex = /(:[\w-]+\([^\)]*\))/gi;
var pseudoClassRegex = /(:[^\s\+>~\.\[:]+)/g;
var elementRegex = /([^\s\+>~\.\[:]+)/g;
function findSelectorMatch(selector, regex) {
var matches = selector.match(regex);
if (!matches) {
return [selector, 0];
}
return [selector.replace(regex, ' '), matches.length];
}
/**
* Measure selector specificity.
* @param selector - Selector to measure.
*/
function getSelectorSpecificity(selector) {
var specificity = [0, 0, 0];
var currentSelector = selector.replace(/:not\(([^\)]*)\)/g, ' $1 ').replace(/{[\s\S]*/gm, ' ');
var delta = 0;
var _findSelectorMatch = findSelectorMatch(currentSelector, attributeRegex);
var _findSelectorMatch2 = (0,slicedToArray/* default */.Z)(_findSelectorMatch, 2);
currentSelector = _findSelectorMatch2[0];
delta = _findSelectorMatch2[1];
specificity[1] += delta;
var _findSelectorMatch3 = findSelectorMatch(currentSelector, idRegex);
var _findSelectorMatch4 = (0,slicedToArray/* default */.Z)(_findSelectorMatch3, 2);
currentSelector = _findSelectorMatch4[0];
delta = _findSelectorMatch4[1];
specificity[0] += delta;
var _findSelectorMatch5 = findSelectorMatch(currentSelector, classRegex);
var _findSelectorMatch6 = (0,slicedToArray/* default */.Z)(_findSelectorMatch5, 2);
currentSelector = _findSelectorMatch6[0];
delta = _findSelectorMatch6[1];
specificity[1] += delta;
var _findSelectorMatch7 = findSelectorMatch(currentSelector, pseudoElementRegex);
var _findSelectorMatch8 = (0,slicedToArray/* default */.Z)(_findSelectorMatch7, 2);
currentSelector = _findSelectorMatch8[0];
delta = _findSelectorMatch8[1];
specificity[2] += delta;
var _findSelectorMatch9 = findSelectorMatch(currentSelector, pseudoClassWithBracketsRegex);
var _findSelectorMatch10 = (0,slicedToArray/* default */.Z)(_findSelectorMatch9, 2);
currentSelector = _findSelectorMatch10[0];
delta = _findSelectorMatch10[1];
specificity[1] += delta;
var _findSelectorMatch11 = findSelectorMatch(currentSelector, pseudoClassRegex);
var _findSelectorMatch12 = (0,slicedToArray/* default */.Z)(_findSelectorMatch11, 2);
currentSelector = _findSelectorMatch12[0];
delta = _findSelectorMatch12[1];
specificity[1] += delta;
currentSelector = currentSelector.replace(/[\*\s\+>~]/g, ' ').replace(/[#\.]/g, ' ');
var _findSelectorMatch13 = findSelectorMatch(currentSelector, elementRegex);
var _findSelectorMatch14 = (0,slicedToArray/* default */.Z)(_findSelectorMatch13, 2);
currentSelector = _findSelectorMatch14[0];
delta = _findSelectorMatch14[1];
// lgtm [js/useless-assignment-to-local]
specificity[2] += delta;
return specificity.join('');
}
var PSEUDO_ZERO = .00000001;
/**
* Vector magnitude.
*/
function vectorMagnitude(v) {
return Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2));
}
/**
* Ratio between two vectors.
*/
function vectorsRatio(u, v) {
return (u[0] * v[0] + u[1] * v[1]) / (vectorMagnitude(u) * vectorMagnitude(v));
}
/**
* Angle between two vectors.
*/
function vectorsAngle(u, v) {
return (u[0] * v[1] < u[1] * v[0] ? -1 : 1) * Math.acos(vectorsRatio(u, v));
}
function CB1(t) {
return t * t * t;
}
function CB2(t) {
return 3 * t * t * (1 - t);
}
function CB3(t) {
return 3 * t * (1 - t) * (1 - t);
}
function CB4(t) {
return (1 - t) * (1 - t) * (1 - t);
}
function QB1(t) {
return t * t;
}
function QB2(t) {
return 2 * t * (1 - t);
}
function QB3(t) {
return (1 - t) * (1 - t);
}
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var runtime_1 = createCommonjsModule(function (module) {
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var runtime = function (exports) {
var Op = Object.prototype;
var hasOwn = Op.hasOwnProperty;
var undefined$1; // More compressible than void 0.
var $Symbol = typeof Symbol === "function" ? Symbol : {};
var iteratorSymbol = $Symbol.iterator || "@@iterator";
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function wrap(innerFn, outerFn, self, tryLocsList) {
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
var generator = Object.create(protoGenerator.prototype);
var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
// .throw, and .return methods.
generator._invoke = makeInvokeMethod(innerFn, self, context);
return generator;
}
exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
// record like context.tryEntries[i].completion. This interface could
// have been (and was previously) designed to take a closure to be
// invoked without arguments, but in all the cases we care about we
// already have an existing method we want to call, so there's no need
// to create a new function object. We can even get away with assuming
// the method takes exactly one argument, since that happens to be true
// in every case, so we don't have to touch the arguments object. The
// only additional allocation required is the completion record, which
// has a stable shape and so hopefully should be cheap to allocate.
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
var GenStateSuspendedStart = "suspendedStart";
var GenStateSuspendedYield = "suspendedYield";
var GenStateExecuting = "executing";
var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
// breaking out of the dispatch switch statement.
var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
// .constructor.prototype properties for functions that return Generator
// objects. For full spec compliance, you may wish to configure your
// minifier not to mangle the names of these two functions.
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
// don't natively support it.
var IteratorPrototype = {};
IteratorPrototype[iteratorSymbol] = function () {
return this;
};
var getProto = Object.getPrototypeOf;
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
// This environment has a native %IteratorPrototype%; use it instead
// of the polyfill.
IteratorPrototype = NativeIteratorPrototype;
}
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
GeneratorFunctionPrototype.constructor = GeneratorFunction;
GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; // Helper for defining the .next, .throw, and .return methods of the
// Iterator interface in terms of a single ._invoke method.
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function (method) {
prototype[method] = function (arg) {
return this._invoke(method, arg);
};
});
}
exports.isGeneratorFunction = function (genFun) {
var ctor = typeof genFun === "function" && genFun.constructor;
return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
// do is to check its .name property.
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
};
exports.mark = function (genFun) {
if (Object.setPrototypeOf) {
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
} else {
genFun.__proto__ = GeneratorFunctionPrototype;
if (!(toStringTagSymbol in genFun)) {
genFun[toStringTagSymbol] = "GeneratorFunction";
}
}
genFun.prototype = Object.create(Gp);
return genFun;
}; // Within the body of any async function, `await x` is transformed to
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
// `hasOwn.call(value, "__await")` to determine if the yielded value is
// meant to be awaited.
exports.awrap = function (arg) {
return {
__await: arg
};
};
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if (record.type === "throw") {
reject(record.arg);
} else {
var result = record.arg;
var value = result.value;
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
return PromiseImpl.resolve(value.__await).then(function (value) {
invoke("next", value, resolve, reject);
}, function (err) {
invoke("throw", err, resolve, reject);
});
}
return PromiseImpl.resolve(value).then(function (unwrapped) {
// When a yielded Promise is resolved, its final value becomes
// the .value of the Promise<{value,done}> result for the
// current iteration.
result.value = unwrapped;
resolve(result);
}, function (error) {
// If a rejected Promise was yielded, throw the rejection back
// into the async generator function so it can be handled there.
return invoke("throw", error, resolve, reject);
});
}
}
var previousPromise;
function enqueue(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function (resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = // If enqueue has been called before, then we want to wait until
// all previous Promises have been resolved before calling invoke,
// so that results are always delivered in the correct order. If
// enqueue has not been called before, then it is important to
// call invoke immediately, without waiting on a callback to fire,
// so that the async generator function has the opportunity to do
// any necessary setup in a predictable way. This predictability
// is why the Promise constructor synchronously invokes its
// executor callback, and why async functions synchronously
// execute code before the first await. Since we implement simple
// async functions in terms of async generators, it is especially
// important to get this right, even though it requires care.
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
// invocations of the iterator.
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
} // Define the unified helper method that is used to implement .next,
// .throw, and .return (see defineIteratorMethods).
this._invoke = enqueue;
}
defineIteratorMethods(AsyncIterator.prototype);
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
return this;
};
exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
// AsyncIterator objects; they just return a Promise for the value of
// the final result produced by the iterator.
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
if (PromiseImpl === void 0) PromiseImpl = Promise;
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
: iter.next().then(function (result) {
return result.done ? result.value : iter.next();
});
};
function makeInvokeMethod(innerFn, self, context) {
var state = GenStateSuspendedStart;
return function invoke(method, arg) {
if (state === GenStateExecuting) {
throw new Error("Generator is already running");
}
if (state === GenStateCompleted) {
if (method === "throw") {
throw arg;
} // Be forgiving, per 25.3.3.3.3 of the spec:
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
return doneResult();
}
context.method = method;
context.arg = arg;
while (true) {
v