Ignore:
Timestamp:
12/12/24 17:06:06 (5 weeks ago)
Author:
stefan toskovski <stefantoska84@…>
Branches:
main
Parents:
d565449
Message:

Pred finalna verzija

Location:
imaps-frontend/node_modules/konva
Files:
68 edited

Legend:

Unmodified
Added
Removed
  • imaps-frontend/node_modules/konva/konva.js

    rd565449 r0c6b92a  
    66
    77  /*
    8    * Konva JavaScript Framework v9.3.14
     8   * Konva JavaScript Framework v9.3.16
    99   * http://konvajs.org/
    1010   * Licensed under the MIT
    11    * Date: Tue Jul 16 2024
     11   * Date: Mon Oct 21 2024
    1212   *
    1313   * Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
     
    3636  const Konva$2 = {
    3737      _global: glob,
    38       version: '9.3.14',
     38      version: '9.3.16',
    3939      isBrowser: detectBrowser(),
    4040      isUnminified: /param/.test(function (param) { }.toString()),
     
    250250       */
    251251      point(point) {
    252           var m = this.m;
     252          const m = this.m;
    253253          return {
    254254              x: m[0] * point.x + m[2] * point.y + m[4],
     
    292292       */
    293293      rotate(rad) {
    294           var c = Math.cos(rad);
    295           var s = Math.sin(rad);
    296           var m11 = this.m[0] * c + this.m[2] * s;
    297           var m12 = this.m[1] * c + this.m[3] * s;
    298           var m21 = this.m[0] * -s + this.m[2] * c;
    299           var m22 = this.m[1] * -s + this.m[3] * c;
     294          const c = Math.cos(rad);
     295          const s = Math.sin(rad);
     296          const m11 = this.m[0] * c + this.m[2] * s;
     297          const m12 = this.m[1] * c + this.m[3] * s;
     298          const m21 = this.m[0] * -s + this.m[2] * c;
     299          const m22 = this.m[1] * -s + this.m[3] * c;
    300300          this.m[0] = m11;
    301301          this.m[1] = m12;
     
    325325       */
    326326      skew(sx, sy) {
    327           var m11 = this.m[0] + this.m[2] * sy;
    328           var m12 = this.m[1] + this.m[3] * sy;
    329           var m21 = this.m[2] + this.m[0] * sx;
    330           var m22 = this.m[3] + this.m[1] * sx;
     327          const m11 = this.m[0] + this.m[2] * sy;
     328          const m12 = this.m[1] + this.m[3] * sy;
     329          const m21 = this.m[2] + this.m[0] * sx;
     330          const m22 = this.m[3] + this.m[1] * sx;
    331331          this.m[0] = m11;
    332332          this.m[1] = m12;
     
    343343       */
    344344      multiply(matrix) {
    345           var m11 = this.m[0] * matrix.m[0] + this.m[2] * matrix.m[1];
    346           var m12 = this.m[1] * matrix.m[0] + this.m[3] * matrix.m[1];
    347           var m21 = this.m[0] * matrix.m[2] + this.m[2] * matrix.m[3];
    348           var m22 = this.m[1] * matrix.m[2] + this.m[3] * matrix.m[3];
    349           var dx = this.m[0] * matrix.m[4] + this.m[2] * matrix.m[5] + this.m[4];
    350           var dy = this.m[1] * matrix.m[4] + this.m[3] * matrix.m[5] + this.m[5];
     345          const m11 = this.m[0] * matrix.m[0] + this.m[2] * matrix.m[1];
     346          const m12 = this.m[1] * matrix.m[0] + this.m[3] * matrix.m[1];
     347          const m21 = this.m[0] * matrix.m[2] + this.m[2] * matrix.m[3];
     348          const m22 = this.m[1] * matrix.m[2] + this.m[3] * matrix.m[3];
     349          const dx = this.m[0] * matrix.m[4] + this.m[2] * matrix.m[5] + this.m[4];
     350          const dy = this.m[1] * matrix.m[4] + this.m[3] * matrix.m[5] + this.m[5];
    351351          this.m[0] = m11;
    352352          this.m[1] = m12;
     
    364364       */
    365365      invert() {
    366           var d = 1 / (this.m[0] * this.m[3] - this.m[1] * this.m[2]);
    367           var m0 = this.m[3] * d;
    368           var m1 = -this.m[1] * d;
    369           var m2 = -this.m[2] * d;
    370           var m3 = this.m[0] * d;
    371           var m4 = d * (this.m[2] * this.m[5] - this.m[3] * this.m[4]);
    372           var m5 = d * (this.m[1] * this.m[4] - this.m[0] * this.m[5]);
     366          const d = 1 / (this.m[0] * this.m[3] - this.m[1] * this.m[2]);
     367          const m0 = this.m[3] * d;
     368          const m1 = -this.m[1] * d;
     369          const m2 = -this.m[2] * d;
     370          const m3 = this.m[0] * d;
     371          const m4 = d * (this.m[2] * this.m[5] - this.m[3] * this.m[4]);
     372          const m5 = d * (this.m[1] * this.m[4] - this.m[0] * this.m[5]);
    373373          this.m[0] = m0;
    374374          this.m[1] = m1;
     
    394394       */
    395395      decompose() {
    396           var a = this.m[0];
    397           var b = this.m[1];
    398           var c = this.m[2];
    399           var d = this.m[3];
    400           var e = this.m[4];
    401           var f = this.m[5];
    402           var delta = a * d - b * c;
    403           let result = {
     396          const a = this.m[0];
     397          const b = this.m[1];
     398          const c = this.m[2];
     399          const d = this.m[3];
     400          const e = this.m[4];
     401          const f = this.m[5];
     402          const delta = a * d - b * c;
     403          const result = {
    404404              x: e,
    405405              y: f,
     
    412412          // Apply the QR-like decomposition.
    413413          if (a != 0 || b != 0) {
    414               var r = Math.sqrt(a * a + b * b);
     414              const r = Math.sqrt(a * a + b * b);
    415415              result.rotation = b > 0 ? Math.acos(a / r) : -Math.acos(a / r);
    416416              result.scaleX = r;
     
    420420          }
    421421          else if (c != 0 || d != 0) {
    422               var s = Math.sqrt(c * c + d * d);
     422              const s = Math.sqrt(c * c + d * d);
    423423              result.rotation =
    424424                  Math.PI / 2 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s));
     
    434434  }
    435435  // CONSTANTS
    436   var OBJECT_ARRAY = '[object Array]', OBJECT_NUMBER = '[object Number]', OBJECT_STRING = '[object String]', OBJECT_BOOLEAN = '[object Boolean]', PI_OVER_DEG180 = Math.PI / 180, DEG180_OVER_PI = 180 / Math.PI, HASH$1 = '#', EMPTY_STRING$1 = '', ZERO = '0', KONVA_WARNING = 'Konva warning: ', KONVA_ERROR = 'Konva error: ', RGB_PAREN = 'rgb(', COLORS = {
     436  let OBJECT_ARRAY = '[object Array]', OBJECT_NUMBER = '[object Number]', OBJECT_STRING = '[object String]', OBJECT_BOOLEAN = '[object Boolean]', PI_OVER_DEG180 = Math.PI / 180, DEG180_OVER_PI = 180 / Math.PI, HASH$1 = '#', EMPTY_STRING$1 = '', ZERO = '0', KONVA_WARNING = 'Konva warning: ', KONVA_ERROR = 'Konva error: ', RGB_PAREN = 'rgb(', COLORS = {
    437437      aliceblue: [240, 248, 255],
    438438      antiquewhite: [250, 235, 215],
     
    628628              return false;
    629629          }
    630           var firstChar = selector[0];
     630          const firstChar = selector[0];
    631631          return (firstChar === '#' ||
    632632              firstChar === '.' ||
     
    659659      },
    660660      createCanvasElement() {
    661           var canvas = document.createElement('canvas');
     661          const canvas = document.createElement('canvas');
    662662          // on some environments canvas.style is readonly
    663663          try {
     
    683683      _urlToImage(url, callback) {
    684684          // if arg is a string, then it's a data url
    685           var imageObj = Util.createImageElement();
     685          const imageObj = Util.createImageElement();
    686686          imageObj.onload = function () {
    687687              callback(imageObj);
     
    694694      _hexToRgb(hex) {
    695695          hex = hex.replace(HASH$1, EMPTY_STRING$1);
    696           var bigint = parseInt(hex, 16);
     696          const bigint = parseInt(hex, 16);
    697697          return {
    698698              r: (bigint >> 16) & 255,
     
    709709       */
    710710      getRandomColor() {
    711           var randColor = ((Math.random() * 0xffffff) << 0).toString(16);
     711          let randColor = ((Math.random() * 0xffffff) << 0).toString(16);
    712712          while (randColor.length < 6) {
    713713              randColor = ZERO + randColor;
     
    727727       */
    728728      getRGB(color) {
    729           var rgb;
     729          let rgb;
    730730          // color string
    731731          if (color in COLORS) {
     
    774774      // Parse named css color. Like "green"
    775775      _namedColorToRBA(str) {
    776           var c = COLORS[str.toLowerCase()];
     776          const c = COLORS[str.toLowerCase()];
    777777          if (!c) {
    778778              return null;
     
    789789          if (str.indexOf('rgb(') === 0) {
    790790              str = str.match(/rgb\(([^)]+)\)/)[1];
    791               var parts = str.split(/ *, */).map(Number);
     791              const parts = str.split(/ *, */).map(Number);
    792792              return {
    793793                  r: parts[0],
     
    802802          if (str.indexOf('rgba(') === 0) {
    803803              str = str.match(/rgba\(([^)]+)\)/)[1];
    804               var parts = str.split(/ *, */).map((n, index) => {
     804              const parts = str.split(/ *, */).map((n, index) => {
    805805                  if (n.slice(-1) === '%') {
    806806                      return index === 3 ? parseInt(n) / 100 : (parseInt(n) / 100) * 255;
     
    935935      },
    936936      cloneObject(obj) {
    937           var retObj = {};
    938           for (var key in obj) {
     937          const retObj = {};
     938          for (const key in obj) {
    939939              if (this._isPlainObject(obj[key])) {
    940940                  retObj[key] = this.cloneObject(obj[key]);
     
    985985      },
    986986      each(obj, func) {
    987           for (var key in obj) {
     987          for (const key in obj) {
    988988              func(key, obj[key]);
    989989          }
     
    993993      },
    994994      _getProjectionToSegment(x1, y1, x2, y2, x3, y3) {
    995           var x, y, dist;
    996           var pd2 = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
     995          let x, y, dist;
     996          const pd2 = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
    997997          if (pd2 == 0) {
    998998              x = x1;
     
    10011001          }
    10021002          else {
    1003               var u = ((x3 - x1) * (x2 - x1) + (y3 - y1) * (y2 - y1)) / pd2;
     1003              const u = ((x3 - x1) * (x2 - x1) + (y3 - y1) * (y2 - y1)) / pd2;
    10041004              if (u < 0) {
    10051005                  x = x1;
     
    10231023      // line might be closed
    10241024      _getProjectionToLine(pt, line, isClosed) {
    1025           var pc = Util.cloneObject(pt);
    1026           var dist = Number.MAX_VALUE;
     1025          const pc = Util.cloneObject(pt);
     1026          let dist = Number.MAX_VALUE;
    10271027          line.forEach(function (p1, i) {
    10281028              if (!isClosed && i === line.length - 1) {
    10291029                  return;
    10301030              }
    1031               var p2 = line[(i + 1) % line.length];
    1032               var proj = Util._getProjectionToSegment(p1.x, p1.y, p2.x, p2.y, pt.x, pt.y);
    1033               var px = proj[0], py = proj[1], pdist = proj[2];
     1031              const p2 = line[(i + 1) % line.length];
     1032              const proj = Util._getProjectionToSegment(p1.x, p1.y, p2.x, p2.y, pt.x, pt.y);
     1033              const px = proj[0], py = proj[1], pdist = proj[2];
    10341034              if (pdist < dist) {
    10351035                  pc.x = px;
     
    10411041      },
    10421042      _prepareArrayForTween(startArray, endArray, isClosed) {
    1043           var n, start = [], end = [];
     1043          let n, start = [], end = [];
    10441044          if (startArray.length > endArray.length) {
    1045               var temp = endArray;
     1045              const temp = endArray;
    10461046              endArray = startArray;
    10471047              startArray = temp;
     
    10591059              });
    10601060          }
    1061           var newStart = [];
     1061          const newStart = [];
    10621062          end.forEach(function (point) {
    1063               var pr = Util._getProjectionToLine(point, start, isClosed);
     1063              const pr = Util._getProjectionToLine(point, start, isClosed);
    10641064              newStart.push(pr.x);
    10651065              newStart.push(pr.y);
     
    10681068      },
    10691069      _prepareToStringify(obj) {
    1070           var desc;
     1070          let desc;
    10711071          obj.visitedByCircularReferenceRemoval = true;
    1072           for (var key in obj) {
     1072          for (const key in obj) {
    10731073              if (!(obj.hasOwnProperty(key) && obj[key] && typeof obj[key] == 'object')) {
    10741074                  continue;
     
    10981098      // very simplified version of Object.assign
    10991099      _assign(target, source) {
    1100           for (var key in source) {
     1100          for (const key in source) {
    11011101              target[key] = source[key];
    11021102          }
     
    11871187      if (Konva$2.isUnminified) {
    11881188          return function (val, attr) {
    1189               let isNumber = Util._isNumber(val);
    1190               let isValidArray = Util._isArray(val) && val.length == noOfElements;
     1189              const isNumber = Util._isNumber(val);
     1190              const isValidArray = Util._isArray(val) && val.length == noOfElements;
    11911191              if (!isNumber && !isValidArray) {
    11921192                  Util.warn(_formatValue(val) +
     
    12041204      if (Konva$2.isUnminified) {
    12051205          return function (val, attr) {
    1206               var isNumber = Util._isNumber(val);
    1207               var isAuto = val === 'auto';
     1206              const isNumber = Util._isNumber(val);
     1207              const isAuto = val === 'auto';
    12081208              if (!(isNumber || isAuto)) {
    12091209                  Util.warn(_formatValue(val) +
     
    12781278      if (Konva$2.isUnminified) {
    12791279          return function (val, attr) {
    1280               var isBool = val === true || val === false;
     1280              const isBool = val === true || val === false;
    12811281              if (!isBool) {
    12821282                  Util.warn(_formatValue(val) +
     
    13081308  }
    13091309
    1310   var GET = 'get', SET$1 = 'set';
     1310  const GET = 'get', SET$1 = 'set';
    13111311  const Factory = {
    13121312      addGetterSetter(constructor, attr, def, validator, after) {
     
    13161316      },
    13171317      addGetter(constructor, attr, def) {
    1318           var method = GET + Util._capitalize(attr);
     1318          const method = GET + Util._capitalize(attr);
    13191319          constructor.prototype[method] =
    13201320              constructor.prototype[method] ||
    13211321                  function () {
    1322                       var val = this.attrs[attr];
     1322                      const val = this.attrs[attr];
    13231323                      return val === undefined ? def : val;
    13241324                  };
    13251325      },
    13261326      addSetter(constructor, attr, validator, after) {
    1327           var method = SET$1 + Util._capitalize(attr);
     1327          const method = SET$1 + Util._capitalize(attr);
    13281328          if (!constructor.prototype[method]) {
    13291329              Factory.overWriteSetter(constructor, attr, validator, after);
     
    13311331      },
    13321332      overWriteSetter(constructor, attr, validator, after) {
    1333           var method = SET$1 + Util._capitalize(attr);
     1333          const method = SET$1 + Util._capitalize(attr);
    13341334          constructor.prototype[method] = function (val) {
    13351335              if (validator && val !== undefined && val !== null) {
     
    13441344      },
    13451345      addComponentsGetterSetter(constructor, attr, components, validator, after) {
    1346           var len = components.length, capitalize = Util._capitalize, getter = GET + capitalize(attr), setter = SET$1 + capitalize(attr), n, component;
     1346          let len = components.length, capitalize = Util._capitalize, getter = GET + capitalize(attr), setter = SET$1 + capitalize(attr), n, component;
    13471347          // getter
    13481348          constructor.prototype[getter] = function () {
    1349               var ret = {};
     1349              const ret = {};
    13501350              for (n = 0; n < len; n++) {
    13511351                  component = components[n];
     
    13541354              return ret;
    13551355          };
    1356           var basicValidator = getComponentValidator(components);
     1356          const basicValidator = getComponentValidator(components);
    13571357          // setter
    13581358          constructor.prototype[setter] = function (val) {
    1359               var oldVal = this.attrs[attr], key;
     1359              let oldVal = this.attrs[attr], key;
    13601360              if (validator) {
    13611361                  val = validator.call(this, val);
     
    13841384      },
    13851385      addOverloadedGetterSetter(constructor, attr) {
    1386           var capitalizedAttr = Util._capitalize(attr), setter = SET$1 + capitalizedAttr, getter = GET + capitalizedAttr;
     1386          const capitalizedAttr = Util._capitalize(attr), setter = SET$1 + capitalizedAttr, getter = GET + capitalizedAttr;
    13871387          constructor.prototype[attr] = function () {
    13881388              // setting
     
    13971397      addDeprecatedGetterSetter(constructor, attr, def, validator) {
    13981398          Util.error('Adding deprecated ' + attr);
    1399           var method = GET + Util._capitalize(attr);
    1400           var message = attr +
     1399          const method = GET + Util._capitalize(attr);
     1400          const message = attr +
    14011401              ' property is deprecated and will be removed soon. Look at Konva change log for more information.';
    14021402          constructor.prototype[method] = function () {
    14031403              Util.error(message);
    1404               var val = this.attrs[attr];
     1404              const val = this.attrs[attr];
    14051405              return val === undefined ? def : val;
    14061406          };
     
    14121412      backCompat(constructor, methods) {
    14131413          Util.each(methods, function (oldMethodName, newMethodName) {
    1414               var method = constructor.prototype[newMethodName];
    1415               var oldGetter = GET + Util._capitalize(oldMethodName);
    1416               var oldSetter = SET$1 + Util._capitalize(oldMethodName);
     1414              const method = constructor.prototype[newMethodName];
     1415              const oldGetter = GET + Util._capitalize(oldMethodName);
     1416              const oldSetter = SET$1 + Util._capitalize(oldMethodName);
    14171417              function deprecated() {
    14181418                  method.apply(this, arguments);
     
    14341434
    14351435  function simplifyArray(arr) {
    1436       var retArr = [], len = arr.length, util = Util, n, val;
     1436      let retArr = [], len = arr.length, util = Util, n, val;
    14371437      for (n = 0; n < len; n++) {
    14381438          val = arr[n];
     
    14471447      return retArr;
    14481448  }
    1449   var COMMA = ',', OPEN_PAREN = '(', CLOSE_PAREN = ')', OPEN_PAREN_BRACKET = '([', CLOSE_BRACKET_PAREN = '])', SEMICOLON = ';', DOUBLE_PAREN = '()',
     1449  const COMMA = ',', OPEN_PAREN = '(', CLOSE_PAREN = ')', OPEN_PAREN_BRACKET = '([', CLOSE_BRACKET_PAREN = '])', SEMICOLON = ';', DOUBLE_PAREN = '()',
    14501450  // EMPTY_STRING = '',
    14511451  EQUALS = '=',
     
    14851485      'translate',
    14861486  ];
    1487   var CONTEXT_PROPERTIES = [
     1487  const CONTEXT_PROPERTIES = [
    14881488      'fillStyle',
    14891489      'strokeStyle',
     
    15821582      }
    15831583      getTrace(relaxed, rounded) {
    1584           var traceArr = this.traceArr, len = traceArr.length, str = '', n, trace, method, args;
     1584          let traceArr = this.traceArr, len = traceArr.length, str = '', n, trace, method, args;
    15851585          for (n = 0; n < len; n++) {
    15861586              trace = traceArr[n];
     
    16201620      }
    16211621      _trace(str) {
    1622           var traceArr = this.traceArr, len;
     1622          let traceArr = this.traceArr, len;
    16231623          traceArr.push(str);
    16241624          len = traceArr.length;
     
    16331633       */
    16341634      reset() {
    1635           var pixelRatio = this.getCanvas().getPixelRatio();
     1635          const pixelRatio = this.getCanvas().getPixelRatio();
    16361636          this.setTransform(1 * pixelRatio, 0, 0, 1 * pixelRatio, 0, 0);
    16371637      }
     
    16561656       */
    16571657      clear(bounds) {
    1658           var canvas = this.getCanvas();
     1658          const canvas = this.getCanvas();
    16591659          if (bounds) {
    16601660              this.clearRect(bounds.x || 0, bounds.y || 0, bounds.width || 0, bounds.height || 0);
     
    16711671      }
    16721672      _applyOpacity(shape) {
    1673           var absOpacity = shape.getAbsoluteOpacity();
     1673          const absOpacity = shape.getAbsoluteOpacity();
    16741674          if (absOpacity !== 1) {
    16751675              this.setAttr('globalAlpha', absOpacity);
     
    17431743       */
    17441744      createImageData(width, height) {
    1745           var a = arguments;
     1745          const a = arguments;
    17461746          if (a.length === 2) {
    17471747              return this._context.createImageData(width, height);
     
    17821782      drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) {
    17831783          // this._context.drawImage(...arguments);
    1784           var a = arguments, _context = this._context;
     1784          const a = arguments, _context = this._context;
    17851785          if (a.length === 3) {
    17861786              _context.drawImage(image, sx, sy);
     
    20152015      }
    20162016      _enableTrace() {
    2017           var that = this, len = CONTEXT_METHODS.length, origSetter = this.setAttr, n, args;
     2017          let that = this, len = CONTEXT_METHODS.length, origSetter = this.setAttr, n, args;
    20182018          // to prevent creating scope function at each loop
    2019           var func = function (methodName) {
    2020               var origMethod = that[methodName], ret;
     2019          const func = function (methodName) {
     2020              let origMethod = that[methodName], ret;
    20212021              that[methodName] = function () {
    20222022                  args = simplifyArray(Array.prototype.slice.call(arguments, 0));
     
    20362036          that.setAttr = function () {
    20372037              origSetter.apply(that, arguments);
    2038               var prop = arguments[0];
    2039               var val = arguments[1];
     2038              const prop = arguments[0];
     2039              let val = arguments[1];
    20402040              if (prop === 'shadowOffsetX' ||
    20412041                  prop === 'shadowOffsetY' ||
     
    20512051      _applyGlobalCompositeOperation(node) {
    20522052          const op = node.attrs.globalCompositeOperation;
    2053           var def = !op || op === 'source-over';
     2053          const def = !op || op === 'source-over';
    20542054          if (!def) {
    20552055              this.setAttr('globalCompositeOperation', op);
     
    20752075      }
    20762076      _fillColor(shape) {
    2077           var fill = shape.fill();
     2077          const fill = shape.fill();
    20782078          this.setAttr('fillStyle', fill);
    20792079          shape._fillFunc(this);
     
    20842084      }
    20852085      _fillLinearGradient(shape) {
    2086           var grd = shape._getLinearGradient();
     2086          const grd = shape._getLinearGradient();
    20872087          if (grd) {
    20882088              this.setAttr('fillStyle', grd);
     
    21372137          if (colorStops) {
    21382138              // build color stops
    2139               for (var n = 0; n < colorStops.length; n += 2) {
     2139              for (let n = 0; n < colorStops.length; n += 2) {
    21402140                  grd.addColorStop(colorStops[n], colorStops[n + 1]);
    21412141              }
     
    21442144      }
    21452145      _stroke(shape) {
    2146           var dash = shape.dash(),
     2146          const dash = shape.dash(),
    21472147          // ignore strokeScaleEnabled for Text
    21482148          strokeScaleEnabled = shape.getStrokeScaleEnabled();
     
    21502150              if (!strokeScaleEnabled) {
    21512151                  this.save();
    2152                   var pixelRatio = this.getCanvas().getPixelRatio();
     2152                  const pixelRatio = this.getCanvas().getPixelRatio();
    21532153                  this.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
    21542154              }
     
    21622162                  this.setAttr('shadowColor', 'rgba(0,0,0,0)');
    21632163              }
    2164               var hasLinearGradient = shape.getStrokeLinearGradientColorStops();
     2164              const hasLinearGradient = shape.getStrokeLinearGradientColorStops();
    21652165              if (hasLinearGradient) {
    21662166                  this._strokeLinearGradient(shape);
     
    21772177      _applyShadow(shape) {
    21782178          var _a, _b, _c;
    2179           var color = (_a = shape.getShadowRGBA()) !== null && _a !== void 0 ? _a : 'black', blur = (_b = shape.getShadowBlur()) !== null && _b !== void 0 ? _b : 5, offset = (_c = shape.getShadowOffset()) !== null && _c !== void 0 ? _c : {
     2179          const color = (_a = shape.getShadowRGBA()) !== null && _a !== void 0 ? _a : 'black', blur = (_b = shape.getShadowBlur()) !== null && _b !== void 0 ? _b : 5, offset = (_c = shape.getShadowOffset()) !== null && _c !== void 0 ? _c : {
    21802180              x: 0,
    21812181              y: 0,
     
    22112211              if (!strokeScaleEnabled) {
    22122212                  this.save();
    2213                   var pixelRatio = this.getCanvas().getPixelRatio();
     2213                  const pixelRatio = this.getCanvas().getPixelRatio();
    22142214                  this.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
    22152215              }
    22162216              this._applyLineCap(shape);
    2217               var hitStrokeWidth = shape.hitStrokeWidth();
    2218               var strokeWidth = hitStrokeWidth === 'auto' ? shape.strokeWidth() : hitStrokeWidth;
     2217              const hitStrokeWidth = shape.hitStrokeWidth();
     2218              const strokeWidth = hitStrokeWidth === 'auto' ? shape.strokeWidth() : hitStrokeWidth;
    22192219              this.setAttr('lineWidth', strokeWidth);
    22202220              this.setAttr('strokeStyle', shape.colorKey);
     
    22282228
    22292229  // calculate pixel ratio
    2230   var _pixelRatio;
     2230  let _pixelRatio;
    22312231  function getDevicePixelRatio() {
    22322232      if (_pixelRatio) {
    22332233          return _pixelRatio;
    22342234      }
    2235       var canvas = Util.createCanvasElement();
    2236       var context = canvas.getContext('2d');
     2235      const canvas = Util.createCanvasElement();
     2236      const context = canvas.getContext('2d');
    22372237      _pixelRatio = (function () {
    2238           var devicePixelRatio = Konva$2._global.devicePixelRatio || 1, backingStoreRatio = context.webkitBackingStorePixelRatio ||
     2238          const devicePixelRatio = Konva$2._global.devicePixelRatio || 1, backingStoreRatio = context.webkitBackingStorePixelRatio ||
    22392239              context.mozBackingStorePixelRatio ||
    22402240              context.msBackingStorePixelRatio ||
     
    22642264          this.height = 0;
    22652265          this.isCache = false;
    2266           var conf = config || {};
    2267           var pixelRatio = conf.pixelRatio || Konva$2.pixelRatio || getDevicePixelRatio();
     2266          const conf = config || {};
     2267          const pixelRatio = conf.pixelRatio || Konva$2.pixelRatio || getDevicePixelRatio();
    22682268          this.pixelRatio = pixelRatio;
    22692269          this._canvas = Util.createCanvasElement();
     
    22902290      }
    22912291      setPixelRatio(pixelRatio) {
    2292           var previousRatio = this.pixelRatio;
     2292          const previousRatio = this.pixelRatio;
    22932293          this.pixelRatio = pixelRatio;
    22942294          this.setSize(this.getWidth() / previousRatio, this.getHeight() / previousRatio);
     
    22982298          this.width = this._canvas.width = width * this.pixelRatio;
    22992299          this._canvas.style.width = width + 'px';
    2300           var pixelRatio = this.pixelRatio, _context = this.getContext()._context;
     2300          const pixelRatio = this.pixelRatio, _context = this.getContext()._context;
    23012301          _context.scale(pixelRatio, pixelRatio);
    23022302      }
     
    23052305          this.height = this._canvas.height = height * this.pixelRatio;
    23062306          this._canvas.style.height = height + 'px';
    2307           var pixelRatio = this.pixelRatio, _context = this.getContext()._context;
     2307          const pixelRatio = this.pixelRatio, _context = this.getContext()._context;
    23082308          _context.scale(pixelRatio, pixelRatio);
    23092309      }
     
    23862386  const DD = {
    23872387      get isDragging() {
    2388           var flag = false;
     2388          let flag = false;
    23892389          DD._dragElements.forEach((elem) => {
    23902390              if (elem.dragStatus === 'dragging') {
     
    23972397      get node() {
    23982398          // return first dragging node
    2399           var node;
     2399          let node;
    24002400          DD._dragElements.forEach((elem) => {
    24012401              node = elem.node;
     
    24232423              }
    24242424              if (elem.dragStatus !== 'dragging') {
    2425                   var dragDistance = node.dragDistance();
    2426                   var distance = Math.max(Math.abs(pos.x - elem.startPointerPos.x), Math.abs(pos.y - elem.startPointerPos.y));
     2425                  const dragDistance = node.dragDistance();
     2426                  const distance = Math.max(Math.abs(pos.x - elem.startPointerPos.x), Math.abs(pos.y - elem.startPointerPos.y));
    24272427                  if (distance < dragDistance) {
    24282428                      return;
     
    25012501      window.addEventListener('mouseup', DD._endDragBefore, true);
    25022502      window.addEventListener('touchend', DD._endDragBefore, true);
     2503      // add touchcancel to fix this: https://github.com/konvajs/konva/issues/1843
     2504      window.addEventListener('touchcancel', DD._endDragBefore, true);
    25032505      window.addEventListener('mousemove', DD._drag);
    25042506      window.addEventListener('touchmove', DD._drag);
    25052507      window.addEventListener('mouseup', DD._endDragAfter, false);
    25062508      window.addEventListener('touchend', DD._endDragAfter, false);
     2509      window.addEventListener('touchcancel', DD._endDragAfter, false);
    25072510  }
    25082511
    25092512  // CONSTANTS
    2510   var ABSOLUTE_OPACITY = 'absoluteOpacity', ALL_LISTENERS = 'allEventListeners', ABSOLUTE_TRANSFORM = 'absoluteTransform', ABSOLUTE_SCALE = 'absoluteScale', CANVAS = 'canvas', CHANGE = 'Change', CHILDREN = 'children', KONVA = 'konva', LISTENING = 'listening', MOUSEENTER$1 = 'mouseenter', MOUSELEAVE$1 = 'mouseleave', SET = 'set', SHAPE = 'Shape', SPACE$1 = ' ', STAGE$1 = 'stage', TRANSFORM = 'transform', UPPER_STAGE = 'Stage', VISIBLE = 'visible', TRANSFORM_CHANGE_STR$1 = [
     2513  const ABSOLUTE_OPACITY = 'absoluteOpacity', ALL_LISTENERS = 'allEventListeners', ABSOLUTE_TRANSFORM = 'absoluteTransform', ABSOLUTE_SCALE = 'absoluteScale', CANVAS = 'canvas', CHANGE = 'Change', CHILDREN = 'children', KONVA = 'konva', LISTENING = 'listening', MOUSEENTER$1 = 'mouseenter', MOUSELEAVE$1 = 'mouseleave', SET = 'set', SHAPE = 'Shape', SPACE$1 = ' ', STAGE$1 = 'stage', TRANSFORM = 'transform', UPPER_STAGE = 'Stage', VISIBLE = 'visible', TRANSFORM_CHANGE_STR$1 = [
    25112514      'xChange.konva',
    25122515      'yChange.konva',
     
    25912594      }
    25922595      _getCache(attr, privateGetter) {
    2593           var cache = this._cache.get(attr);
     2596          let cache = this._cache.get(attr);
    25942597          // for transform the cache can be NOT empty
    25952598          // but we still need to recalculate it if it is dirty
    2596           var isTransform = attr === TRANSFORM || attr === ABSOLUTE_TRANSFORM;
    2597           var invalid = cache === undefined || (isTransform && cache.dirty === true);
     2599          const isTransform = attr === TRANSFORM || attr === ABSOLUTE_TRANSFORM;
     2600          const invalid = cache === undefined || (isTransform && cache.dirty === true);
    25982601          // if not cached, we need to set it using the private getter method.
    25992602          if (invalid) {
     
    26932696       */
    26942697      cache(config) {
    2695           var conf = config || {};
    2696           var rect = {};
     2698          const conf = config || {};
     2699          let rect = {};
    26972700          // don't call getClientRect if we have all attributes
    26982701          // it means call it only if have one undefined
     
    27062709              });
    27072710          }
    2708           var width = Math.ceil(conf.width || rect.width), height = Math.ceil(conf.height || rect.height), pixelRatio = conf.pixelRatio, x = conf.x === undefined ? Math.floor(rect.x) : conf.x, y = conf.y === undefined ? Math.floor(rect.y) : conf.y, offset = conf.offset || 0, drawBorder = conf.drawBorder || false, hitCanvasPixelRatio = conf.hitCanvasPixelRatio || 1;
     2711          let width = Math.ceil(conf.width || rect.width), height = Math.ceil(conf.height || rect.height), pixelRatio = conf.pixelRatio, x = conf.x === undefined ? Math.floor(rect.x) : conf.x, y = conf.y === undefined ? Math.floor(rect.y) : conf.y, offset = conf.offset || 0, drawBorder = conf.drawBorder || false, hitCanvasPixelRatio = conf.hitCanvasPixelRatio || 1;
    27092712          if (!width || !height) {
    27102713              Util.error('Can not cache the node. Width or height of the node equals 0. Caching is skipped.');
     
    27292732          // }
    27302733          // console.log({ x, y, width, height }, rect);
    2731           var cachedSceneCanvas = new SceneCanvas({
     2734          const cachedSceneCanvas = new SceneCanvas({
    27322735              pixelRatio: pixelRatio,
    27332736              width: width,
     
    28372840      }
    28382841      _transformedRect(rect, top) {
    2839           var points = [
     2842          const points = [
    28402843              { x: rect.x, y: rect.y },
    28412844              { x: rect.x + rect.width, y: rect.y },
     
    28432846              { x: rect.x, y: rect.y + rect.height },
    28442847          ];
    2845           var minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
    2846           var trans = this.getAbsoluteTransform(top);
     2848          let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
     2849          const trans = this.getAbsoluteTransform(top);
    28472850          points.forEach(function (point) {
    2848               var transformed = trans.point(point);
     2851              const transformed = trans.point(point);
    28492852              if (minX === undefined) {
    28502853                  minX = maxX = transformed.x;
     
    28692872          const canvasCache = this._getCanvasCache();
    28702873          context.translate(canvasCache.x, canvasCache.y);
    2871           var cacheCanvas = this._getCachedSceneCanvas();
    2872           var ratio = cacheCanvas.pixelRatio;
     2874          const cacheCanvas = this._getCachedSceneCanvas();
     2875          const ratio = cacheCanvas.pixelRatio;
    28732876          context.drawImage(cacheCanvas._canvas, 0, 0, cacheCanvas.width / ratio, cacheCanvas.height / ratio);
    28742877          context.restore();
    28752878      }
    28762879      _drawCachedHitCanvas(context) {
    2877           var canvasCache = this._getCanvasCache(), hitCanvas = canvasCache.hit;
     2880          const canvasCache = this._getCanvasCache(), hitCanvas = canvasCache.hit;
    28782881          context.save();
    28792882          context.translate(canvasCache.x, canvasCache.y);
     
    28822885      }
    28832886      _getCachedSceneCanvas() {
    2884           var filters = this.filters(), cachedCanvas = this._getCanvasCache(), sceneCanvas = cachedCanvas.scene, filterCanvas = cachedCanvas.filter, filterContext = filterCanvas.getContext(), len, imageData, n, filter;
     2887          let filters = this.filters(), cachedCanvas = this._getCanvasCache(), sceneCanvas = cachedCanvas.scene, filterCanvas = cachedCanvas.filter, filterContext = filterCanvas.getContext(), len, imageData, n, filter;
    28852888          if (filters) {
    28862889              if (!this._filterUpToDate) {
    2887                   var ratio = sceneCanvas.pixelRatio;
     2890                  const ratio = sceneCanvas.pixelRatio;
    28882891                  filterCanvas.setSize(sceneCanvas.width / sceneCanvas.pixelRatio, sceneCanvas.height / sceneCanvas.pixelRatio);
    28892892                  try {
     
    29832986              return this._delegate.apply(this, arguments);
    29842987          }
    2985           var events = evtStr.split(SPACE$1), len = events.length, n, event, parts, baseEvent, name;
     2988          let events = evtStr.split(SPACE$1), len = events.length, n, event, parts, baseEvent, name;
    29862989          /*
    29872990           * loop through types and attach event listeners to
     
    30273030       */
    30283031      off(evtStr, callback) {
    3029           var events = (evtStr || '').split(SPACE$1), len = events.length, n, t, event, parts, baseEvent, name;
     3032          let events = (evtStr || '').split(SPACE$1), len = events.length, n, t, event, parts, baseEvent, name;
    30303033          this._cache && this._cache.delete(ALL_LISTENERS);
    30313034          if (!evtStr) {
     
    30553058      // some event aliases for third party integration like HammerJS
    30563059      dispatchEvent(evt) {
    3057           var e = {
     3060          const e = {
    30583061              target: this,
    30593062              type: evt.type,
     
    30763079      // like node.on
    30773080      _delegate(event, selector, handler) {
    3078           var stopNode = this;
     3081          const stopNode = this;
    30793082          this.on(event, function (evt) {
    3080               var targets = evt.target.findAncestors(selector, true, stopNode);
    3081               for (var i = 0; i < targets.length; i++) {
     3083              const targets = evt.target.findAncestors(selector, true, stopNode);
     3084              for (let i = 0; i < targets.length; i++) {
    30823085                  evt = Util.cloneObject(evt);
    30833086                  evt.currentTarget = targets[i];
     
    31163119          // traversal must be cleared when removing a node
    31173120          this._clearCaches();
    3118           var parent = this.getParent();
     3121          const parent = this.getParent();
    31193122          if (parent && parent.children) {
    31203123              parent.children.splice(this.index, 1);
     
    31463149       */
    31473150      getAttr(attr) {
    3148           var method = 'get' + Util._capitalize(attr);
     3151          const method = 'get' + Util._capitalize(attr);
    31493152          if (Util._isFunction(this[method])) {
    31503153              return this[method]();
     
    31643167       */
    31653168      getAncestors() {
    3166           var parent = this.getParent(), ancestors = [];
     3169          let parent = this.getParent(), ancestors = [];
    31673170          while (parent) {
    31683171              ancestors.push(parent);
     
    31943197      setAttrs(config) {
    31953198          this._batchTransformChanges(() => {
    3196               var key, method;
     3199              let key, method;
    31973200              if (!config) {
    31983201                  return this;
     
    32803283              return this._isVisible(top) && this._isListening(top);
    32813284          }
    3282           var layer = this.getLayer();
    3283           var layerUnderDrag = false;
     3285          const layer = this.getLayer();
     3286          let layerUnderDrag = false;
    32843287          DD._dragElements.forEach((elem) => {
    32853288              if (elem.dragStatus !== 'dragging') {
     
    32933296              }
    32943297          });
    3295           var dragSkip = !skipDragCheck &&
     3298          const dragSkip = !skipDragCheck &&
    32963299              !Konva$2.hitOnDragEnabled &&
    32973300              (layerUnderDrag || Konva$2.isTransforming());
     
    33293332       */
    33303333      getAbsoluteZIndex() {
    3331           var depth = this.getDepth(), that = this, index = 0, nodes, len, n, child;
     3334          let depth = this.getDepth(), that = this, index = 0, nodes, len, n, child;
    33323335          function addChildren(children) {
    33333336              nodes = [];
     
    33623365       */
    33633366      getDepth() {
    3364           var depth = 0, parent = this.parent;
     3367          let depth = 0, parent = this.parent;
    33653368          while (parent) {
    33663369              depth++;
     
    34143417          }
    34153418          // get pointer (say mouse or touch) position
    3416           var pos = stage.getPointerPosition();
     3419          const pos = stage.getPointerPosition();
    34173420          if (!pos) {
    34183421              return null;
    34193422          }
    3420           var transform = this.getAbsoluteTransform().copy();
     3423          const transform = this.getAbsoluteTransform().copy();
    34213424          // to detect relative position we need to invert transform
    34223425          transform.invert();
     
    34543457              top = true;
    34553458          }
    3456           var absoluteMatrix = this.getAbsoluteTransform(top).getMatrix(), absoluteTransform = new Transform(), offset = this.offset();
     3459          const absoluteMatrix = this.getAbsoluteTransform(top).getMatrix(), absoluteTransform = new Transform(), offset = this.offset();
    34573460          // clone the matrix array
    34583461          absoluteTransform.m = absoluteMatrix.slice();
     
    34673470          // important, use non cached value
    34683471          this._clearCache(TRANSFORM);
    3469           var it = this._getAbsoluteTransform().copy();
     3472          const it = this._getAbsoluteTransform().copy();
    34703473          it.invert();
    34713474          it.translate(pos.x, pos.y);
     
    34813484      }
    34823485      _setTransform(trans) {
    3483           var key;
     3486          let key;
    34843487          for (key in trans) {
    34853488              this.attrs[key] = trans[key];
     
    34893492      }
    34903493      _clearTransform() {
    3491           var trans = {
     3494          const trans = {
    34923495              x: this.x(),
    34933496              y: this.y(),
     
    35283531       */
    35293532      move(change) {
    3530           var changeX = change.x, changeY = change.y, x = this.x(), y = this.y();
     3533          let changeX = change.x, changeY = change.y, x = this.x(), y = this.y();
    35313534          if (changeX !== undefined) {
    35323535              x += changeX;
     
    35393542      }
    35403543      _eachAncestorReverse(func, top) {
    3541           var family = [], parent = this.getParent(), len, n;
     3544          let family = [], parent = this.getParent(), len, n;
    35423545          // if top node is defined, and this node is top node,
    35433546          // there's no need to build a family tree.  just execute
     
    35793582              return false;
    35803583          }
    3581           var index = this.index, len = this.parent.getChildren().length;
     3584          const index = this.index, len = this.parent.getChildren().length;
    35823585          if (index < len - 1) {
    35833586              this.parent.children.splice(index, 1);
     
    35993602              return false;
    36003603          }
    3601           var index = this.index, len = this.parent.getChildren().length;
     3604          const index = this.index, len = this.parent.getChildren().length;
    36023605          if (index < len - 1) {
    36033606              this.parent.children.splice(index, 1);
     
    36193622              return false;
    36203623          }
    3621           var index = this.index;
     3624          const index = this.index;
    36223625          if (index > 0) {
    36233626              this.parent.children.splice(index, 1);
     
    36393642              return false;
    36403643          }
    3641           var index = this.index;
     3644          const index = this.index;
    36423645          if (index > 0) {
    36433646              this.parent.children.splice(index, 1);
     
    36603663                  '.');
    36613664          }
    3662           var index = this.index;
     3665          const index = this.index;
    36633666          this.parent.children.splice(index, 1);
    36643667          this.parent.children.splice(zIndex, 0, this);
     
    36763679      }
    36773680      _getAbsoluteOpacity() {
    3678           var absOpacity = this.opacity();
    3679           var parent = this.getParent();
     3681          let absOpacity = this.opacity();
     3682          const parent = this.getParent();
    36803683          if (parent && !parent._isUnderCache) {
    36813684              absOpacity *= parent.getAbsoluteOpacity();
     
    37083711       */
    37093712      toObject() {
    3710           var attrs = this.getAttrs(), key, val, getter, defaultValue, nonPlainObject;
     3713          let attrs = this.getAttrs(), key, val, getter, defaultValue, nonPlainObject;
    37113714          const obj = {
    37123715              attrs: {},
     
    37653768       */
    37663769      findAncestors(selector, includeSelf, stopNode) {
    3767           var res = [];
     3770          const res = [];
    37683771          if (includeSelf && this._isMatch(selector)) {
    37693772              res.push(this);
    37703773          }
    3771           var ancestor = this.parent;
     3774          let ancestor = this.parent;
    37723775          while (ancestor) {
    37733776              if (ancestor === stopNode) {
     
    38073810              return selector(this);
    38083811          }
    3809           var selectorArr = selector.replace(/ /g, '').split(','), len = selectorArr.length, n, sel;
     3812          let selectorArr = selector.replace(/ /g, '').split(','), len = selectorArr.length, n, sel;
    38103813          for (n = 0; n < len; n++) {
    38113814              sel = selectorArr[n];
     
    38423845       */
    38433846      getLayer() {
    3844           var parent = this.getParent();
     3847          const parent = this.getParent();
    38453848          return parent ? parent.getLayer() : null;
    38463849      }
     
    38553858      }
    38563859      _getStage() {
    3857           var parent = this.getParent();
     3860          const parent = this.getParent();
    38583861          if (parent) {
    38593862              return parent.getStage();
     
    39173920      }
    39183921      _getAbsoluteTransform(top) {
    3919           var at;
     3922          let at;
    39203923          // we we need position relative to an ancestor, we will iterate for all
    39213924          if (top) {
     
    39233926              // start with stage and traverse downwards to self
    39243927              this._eachAncestorReverse(function (node) {
    3925                   var transformsEnabled = node.transformsEnabled();
     3928                  const transformsEnabled = node.transformsEnabled();
    39263929                  if (transformsEnabled === 'all') {
    39273930                      at.multiply(node.getTransform());
     
    39433946                  at.reset();
    39443947              }
    3945               var transformsEnabled = this.transformsEnabled();
     3948              const transformsEnabled = this.transformsEnabled();
    39463949              if (transformsEnabled === 'all') {
    39473950                  at.multiply(this.getTransform());
     
    39733976          // because it use cache transform
    39743977          // this is special logic for caching with some shapes with shadow
    3975           var parent = this;
     3978          let parent = this;
    39763979          while (parent) {
    39773980              if (parent._isUnderCache) {
     
    40184021      _getTransform() {
    40194022          var _a, _b;
    4020           var m = this._cache.get(TRANSFORM) || new Transform();
     4023          const m = this._cache.get(TRANSFORM) || new Transform();
    40214024          m.reset();
    40224025          // I was trying to use attributes directly here
    40234026          // but it doesn't work for Transformer well
    40244027          // because it overwrite x,y getters
    4025           var x = this.x(), y = this.y(), rotation = Konva$2.getAngle(this.rotation()), scaleX = (_a = this.attrs.scaleX) !== null && _a !== void 0 ? _a : 1, scaleY = (_b = this.attrs.scaleY) !== null && _b !== void 0 ? _b : 1, skewX = this.attrs.skewX || 0, skewY = this.attrs.skewY || 0, offsetX = this.attrs.offsetX || 0, offsetY = this.attrs.offsetY || 0;
     4028          const x = this.x(), y = this.y(), rotation = Konva$2.getAngle(this.rotation()), scaleX = (_a = this.attrs.scaleX) !== null && _a !== void 0 ? _a : 1, scaleY = (_b = this.attrs.scaleY) !== null && _b !== void 0 ? _b : 1, skewX = this.attrs.skewX || 0, skewY = this.attrs.skewY || 0, offsetX = this.attrs.offsetX || 0, offsetY = this.attrs.offsetY || 0;
    40264029          if (x !== 0 || y !== 0) {
    40274030              m.translate(x, y);
     
    40614064      clone(obj) {
    40624065          // instantiate new node
    4063           var attrs = Util.cloneObject(this.attrs), key, allListeners, len, n, listener;
     4066          let attrs = Util.cloneObject(this.attrs), key, allListeners, len, n, listener;
    40644067          // apply attr overrides
    40654068          for (key in obj) {
    40664069              attrs[key] = obj[key];
    40674070          }
    4068           var node = new this.constructor(attrs);
     4071          const node = new this.constructor(attrs);
    40694072          // copy over listeners
    40704073          for (key in this.eventListeners) {
     
    40904093      _toKonvaCanvas(config) {
    40914094          config = config || {};
    4092           var box = this.getClientRect();
    4093           var stage = this.getStage(), x = config.x !== undefined ? config.x : Math.floor(box.x), y = config.y !== undefined ? config.y : Math.floor(box.y), pixelRatio = config.pixelRatio || 1, canvas = new SceneCanvas({
     4095          const box = this.getClientRect();
     4096          const stage = this.getStage(), x = config.x !== undefined ? config.x : Math.floor(box.x), y = config.y !== undefined ? config.y : Math.floor(box.y), pixelRatio = config.pixelRatio || 1, canvas = new SceneCanvas({
    40944097              width: config.width || Math.ceil(box.width) || (stage ? stage.width() : 0),
    40954098              height: config.height ||
     
    41634166      toDataURL(config) {
    41644167          config = config || {};
    4165           var mimeType = config.mimeType || null, quality = config.quality || null;
    4166           var url = this._toKonvaCanvas(config).toDataURL(mimeType, quality);
     4168          const mimeType = config.mimeType || null, quality = config.quality || null;
     4169          const url = this._toKonvaCanvas(config).toDataURL(mimeType, quality);
    41674170          if (config.callback) {
    41684171              config.callback(url);
     
    42964299      }
    42974300      _off(type, name, callback) {
    4298           var evtListeners = this.eventListeners[type], i, evtName, handler;
     4301          let evtListeners = this.eventListeners[type], i, evtName, handler;
    42994302          for (i = 0; i < evtListeners.length; i++) {
    43004303              evtName = evtListeners[i].name;
     
    43354338      addName(name) {
    43364339          if (!this.hasName(name)) {
    4337               var oldName = this.name();
    4338               var newName = oldName ? oldName + ' ' + name : name;
     4340              const oldName = this.name();
     4341              const newName = oldName ? oldName + ' ' + name : name;
    43394342              this.name(newName);
    43404343          }
     
    43624365          }
    43634366          // if name is '' the "names" will be [''], so I added extra check above
    4364           var names = (fullName || '').split(/\s/g);
     4367          const names = (fullName || '').split(/\s/g);
    43654368          return names.indexOf(name) !== -1;
    43664369      }
     
    43784381       */
    43794382      removeName(name) {
    4380           var names = (this.name() || '').split(/\s/g);
    4381           var index = names.indexOf(name);
     4383          const names = (this.name() || '').split(/\s/g);
     4384          const index = names.indexOf(name);
    43824385          if (index !== -1) {
    43834386              names.splice(index, 1);
     
    43974400       */
    43984401      setAttr(attr, val) {
    4399           var func = this[SET + Util._capitalize(attr)];
     4402          const func = this[SET + Util._capitalize(attr)];
    44004403          if (Util._isFunction(func)) {
    44014404              func.call(this, val);
     
    44144417      }
    44154418      _setAttr(key, val) {
    4416           var oldVal = this.attrs[key];
     4419          const oldVal = this.attrs[key];
    44174420          if (oldVal === val && !Util.isObject(val)) {
    44184421              return;
     
    44304433      }
    44314434      _setComponentAttr(key, component, val) {
    4432           var oldVal;
     4435          let oldVal;
    44334436          if (val !== undefined) {
    44344437              oldVal = this.attrs[key];
     
    44454448              evt.target = this;
    44464449          }
    4447           var shouldStop = (eventType === MOUSEENTER$1 || eventType === MOUSELEAVE$1) &&
     4450          const shouldStop = (eventType === MOUSEENTER$1 || eventType === MOUSELEAVE$1) &&
    44484451              ((compareShape &&
    44494452                  (this === compareShape ||
     
    44534456              this._fire(eventType, evt);
    44544457              // simulate event bubbling
    4455               var stopBubble = (eventType === MOUSEENTER$1 || eventType === MOUSELEAVE$1) &&
     4458              const stopBubble = (eventType === MOUSEENTER$1 || eventType === MOUSELEAVE$1) &&
    44564459                  compareShape &&
    44574460                  compareShape.isAncestorOf &&
     
    45224525      // drag & drop
    45234526      _createDragElement(evt) {
    4524           var pointerId = evt ? evt.pointerId : undefined;
    4525           var stage = this.getStage();
    4526           var ap = this.getAbsolutePosition();
     4527          const pointerId = evt ? evt.pointerId : undefined;
     4528          const stage = this.getStage();
     4529          const ap = this.getAbsolutePosition();
    45274530          if (!stage) {
    45284531              return;
    45294532          }
    4530           var pos = stage._getPointerById(pointerId) ||
     4533          const pos = stage._getPointerById(pointerId) ||
    45314534              stage._changedPointerPositions[0] ||
    45324535              ap;
     
    45664569              return;
    45674570          }
    4568           var newNodePos = {
     4571          let newNodePos = {
    45694572              x: pos.x - elem.offset.x,
    45704573              y: pos.y - elem.offset.y,
    45714574          };
    4572           var dbf = this.dragBoundFunc();
     4575          const dbf = this.dragBoundFunc();
    45734576          if (dbf !== undefined) {
    45744577              const bounded = dbf.call(this, newNodePos, evt);
     
    46174620          this._dragCleanup();
    46184621          this.on('mousedown.konva touchstart.konva', function (evt) {
    4619               var shouldCheckButton = evt.evt['button'] !== undefined;
    4620               var canDrag = !shouldCheckButton || Konva$2.dragButtons.indexOf(evt.evt['button']) >= 0;
     4622              const shouldCheckButton = evt.evt['button'] !== undefined;
     4623              const canDrag = !shouldCheckButton || Konva$2.dragButtons.indexOf(evt.evt['button']) >= 0;
    46214624              if (!canDrag) {
    46224625                  return;
     
    46254628                  return;
    46264629              }
    4627               var hasDraggingChild = false;
     4630              let hasDraggingChild = false;
    46284631              DD._dragElements.forEach((elem) => {
    46294632                  if (this.isAncestorOf(elem.node)) {
     
    46504653               * drag and drop mode
    46514654               */
    4652               var stage = this.getStage();
     4655              const stage = this.getStage();
    46534656              if (!stage) {
    46544657                  return;
     
    47174720      }
    47184721      static _createNode(obj, container) {
    4719           var className = Node.prototype.getClassName.call(obj), children = obj.children, no, len, n;
     4722          let className = Node.prototype.getClassName.call(obj), children = obj.children, no, len, n;
    47204723          // if container was passed in, add it to attrs
    47214724          if (container) {
     
    53295332          }
    53305333          const children = this.children || [];
    5331           var results = [];
     5334          const results = [];
    53325335          children.forEach(function (child) {
    53335336              if (filterFunc(child)) {
     
    54005403          }
    54015404          if (children.length > 1) {
    5402               for (var i = 0; i < children.length; i++) {
     5405              for (let i = 0; i < children.length; i++) {
    54035406                  this.add(children[i]);
    54045407              }
     
    54935496       */
    54945497      findOne(selector) {
    5495           var result = this._generalFind(selector, true);
     5498          const result = this._generalFind(selector, true);
    54965499          return result.length > 0 ? result[0] : undefined;
    54975500      }
    54985501      _generalFind(selector, findOne) {
    5499           var retArr = [];
     5502          const retArr = [];
    55005503          this._descendants((node) => {
    55015504              const valid = node._isMatch(selector);
     
    55305533      // extenders
    55315534      toObject() {
    5532           var obj = Node.prototype.toObject.call(this);
     5535          const obj = Node.prototype.toObject.call(this);
    55335536          obj.children = [];
    55345537          this.getChildren().forEach((child) => {
     
    55455548       */
    55465549      isAncestorOf(node) {
    5547           var parent = node.getParent();
     5550          let parent = node.getParent();
    55485551          while (parent) {
    55495552              if (parent._id === this._id) {
     
    55565559      clone(obj) {
    55575560          // call super method
    5558           var node = Node.prototype.clone.call(this, obj);
     5561          const node = Node.prototype.clone.call(this, obj);
    55595562          this.getChildren().forEach(function (no) {
    55605563              node.add(no.clone());
     
    55765579       */
    55775580      getAllIntersections(pos) {
    5578           var arr = [];
     5581          const arr = [];
    55795582          this.find('Shape').forEach((shape) => {
    55805583              if (shape.isVisible() && shape.intersects(pos)) {
     
    56045607      }
    56055608      drawScene(can, top, bufferCanvas) {
    5606           var layer = this.getLayer(), canvas = can || (layer && layer.getCanvas()), context = canvas && canvas.getContext(), cachedCanvas = this._getCanvasCache(), cachedSceneCanvas = cachedCanvas && cachedCanvas.scene;
    5607           var caching = canvas && canvas.isCache;
     5609          const layer = this.getLayer(), canvas = can || (layer && layer.getCanvas()), context = canvas && canvas.getContext(), cachedCanvas = this._getCanvasCache(), cachedSceneCanvas = cachedCanvas && cachedCanvas.scene;
     5610          const caching = canvas && canvas.isCache;
    56085611          if (!this.isVisible() && !caching) {
    56095612              return this;
     
    56115614          if (cachedSceneCanvas) {
    56125615              context.save();
    5613               var m = this.getAbsoluteTransform(top).getMatrix();
     5616              const m = this.getAbsoluteTransform(top).getMatrix();
    56145617              context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
    56155618              this._drawCachedSceneCanvas(context);
     
    56255628              return this;
    56265629          }
    5627           var layer = this.getLayer(), canvas = can || (layer && layer.hitCanvas), context = canvas && canvas.getContext(), cachedCanvas = this._getCanvasCache(), cachedHitCanvas = cachedCanvas && cachedCanvas.hit;
     5630          const layer = this.getLayer(), canvas = can || (layer && layer.hitCanvas), context = canvas && canvas.getContext(), cachedCanvas = this._getCanvasCache(), cachedHitCanvas = cachedCanvas && cachedCanvas.hit;
    56285631          if (cachedHitCanvas) {
    56295632              context.save();
    5630               var m = this.getAbsoluteTransform(top).getMatrix();
     5633              const m = this.getAbsoluteTransform(top).getMatrix();
    56315634              context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
    56325635              this._drawCachedHitCanvas(context);
     
    56405643      _drawChildren(drawMethod, canvas, top, bufferCanvas) {
    56415644          var _a;
    5642           var context = canvas && canvas.getContext(), clipWidth = this.clipWidth(), clipHeight = this.clipHeight(), clipFunc = this.clipFunc(), hasClip = (typeof clipWidth === 'number' && typeof clipHeight === 'number') ||
     5645          const context = canvas && canvas.getContext(), clipWidth = this.clipWidth(), clipHeight = this.clipHeight(), clipFunc = this.clipFunc(), hasClip = (typeof clipWidth === 'number' && typeof clipHeight === 'number') ||
    56435646              clipFunc;
    56445647          const selfCache = top === this;
    56455648          if (hasClip) {
    56465649              context.save();
    5647               var transform = this.getAbsoluteTransform(top);
    5648               var m = transform.getMatrix();
     5650              const transform = this.getAbsoluteTransform(top);
     5651              let m = transform.getMatrix();
    56495652              context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
    56505653              context.beginPath();
     
    56545657              }
    56555658              else {
    5656                   var clipX = this.clipX();
    5657                   var clipY = this.clipY();
     5659                  const clipX = this.clipX();
     5660                  const clipY = this.clipY();
    56585661                  context.rect(clipX || 0, clipY || 0, clipWidth, clipHeight);
    56595662              }
     
    56625665              context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
    56635666          }
    5664           var hasComposition = !selfCache &&
     5667          const hasComposition = !selfCache &&
    56655668              this.globalCompositeOperation() !== 'source-over' &&
    56665669              drawMethod === 'drawScene';
     
    56815684      getClientRect(config = {}) {
    56825685          var _a;
    5683           var skipTransform = config.skipTransform;
    5684           var relativeTo = config.relativeTo;
    5685           var minX, minY, maxX, maxY;
    5686           var selfRect = {
     5686          const skipTransform = config.skipTransform;
     5687          const relativeTo = config.relativeTo;
     5688          let minX, minY, maxX, maxY;
     5689          let selfRect = {
    56875690              x: Infinity,
    56885691              y: Infinity,
     
    56905693              height: 0,
    56915694          };
    5692           var that = this;
     5695          const that = this;
    56935696          (_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {
    56945697              // skip invisible children
     
    56965699                  return;
    56975700              }
    5698               var rect = child.getClientRect({
     5701              const rect = child.getClientRect({
    56995702                  relativeTo: that,
    57005703                  skipShadow: config.skipShadow,
     
    57205723          });
    57215724          // if child is group we need to make sure it has visible shapes inside
    5722           var shapes = this.find('Shape');
    5723           var hasVisible = false;
    5724           for (var i = 0; i < shapes.length; i++) {
    5725               var shape = shapes[i];
     5725          const shapes = this.find('Shape');
     5726          let hasVisible = false;
     5727          for (let i = 0; i < shapes.length; i++) {
     5728              const shape = shapes[i];
    57265729              if (shape._isVisible(this)) {
    57275730                  hasVisible = true;
     
    58975900
    58985901  // CONSTANTS
    5899   var STAGE = 'Stage', STRING = 'string', PX = 'px', MOUSEOUT = 'mouseout', MOUSELEAVE = 'mouseleave', MOUSEOVER = 'mouseover', MOUSEENTER = 'mouseenter', MOUSEMOVE = 'mousemove', MOUSEDOWN = 'mousedown', MOUSEUP = 'mouseup', POINTERMOVE = 'pointermove', POINTERDOWN = 'pointerdown', POINTERUP = 'pointerup', POINTERCANCEL = 'pointercancel', LOSTPOINTERCAPTURE = 'lostpointercapture', POINTEROUT = 'pointerout', POINTERLEAVE = 'pointerleave', POINTEROVER = 'pointerover', POINTERENTER = 'pointerenter', CONTEXTMENU = 'contextmenu', TOUCHSTART = 'touchstart', TOUCHEND = 'touchend', TOUCHMOVE = 'touchmove', TOUCHCANCEL = 'touchcancel', WHEEL = 'wheel', MAX_LAYERS_NUMBER = 5, EVENTS = [
     5902  const STAGE = 'Stage', STRING = 'string', PX = 'px', MOUSEOUT = 'mouseout', MOUSELEAVE = 'mouseleave', MOUSEOVER = 'mouseover', MOUSEENTER = 'mouseenter', MOUSEMOVE = 'mousemove', MOUSEDOWN = 'mousedown', MOUSEUP = 'mouseup', POINTERMOVE = 'pointermove', POINTERDOWN = 'pointerdown', POINTERUP = 'pointerup', POINTERCANCEL = 'pointercancel', LOSTPOINTERCAPTURE = 'lostpointercapture', POINTEROUT = 'pointerout', POINTERLEAVE = 'pointerleave', POINTEROVER = 'pointerover', POINTERENTER = 'pointerenter', CONTEXTMENU = 'contextmenu', TOUCHSTART = 'touchstart', TOUCHEND = 'touchend', TOUCHMOVE = 'touchmove', TOUCHCANCEL = 'touchcancel', WHEEL = 'wheel', MAX_LAYERS_NUMBER = 5, EVENTS = [
    59005903      [MOUSEENTER, '_pointerenter'],
    59015904      [MOUSEDOWN, '_pointerdown'],
     
    60566059          if (typeof container === STRING) {
    60576060              if (container.charAt(0) === '.') {
    6058                   var className = container.slice(1);
     6061                  const className = container.slice(1);
    60596062                  container = document.getElementsByClassName(className)[0];
    60606063              }
     
    60916094       */
    60926095      clear() {
    6093           var layers = this.children, len = layers.length, n;
     6096          let layers = this.children, len = layers.length, n;
    60946097          for (n = 0; n < len; n++) {
    60956098              layers[n].clear();
     
    61076110      destroy() {
    61086111          super.destroy();
    6109           var content = this.content;
     6112          const content = this.content;
    61106113          if (content && Util._isInDocument(content)) {
    61116114              this.container().removeChild(content);
    61126115          }
    6113           var index = stages.indexOf(this);
     6116          const index = stages.indexOf(this);
    61146117          if (index > -1) {
    61156118              stages.splice(index, 1);
     
    61556158          config.width = config.width || this.width();
    61566159          config.height = config.height || this.height();
    6157           var canvas = new SceneCanvas({
     6160          const canvas = new SceneCanvas({
    61586161              width: config.width,
    61596162              height: config.height,
    61606163              pixelRatio: config.pixelRatio || 1,
    61616164          });
    6162           var _context = canvas.getContext()._context;
    6163           var layers = this.children;
     6165          const _context = canvas.getContext()._context;
     6166          const layers = this.children;
    61646167          if (config.x || config.y) {
    61656168              _context.translate(-1 * config.x, -1 * config.y);
     
    61696172                  return;
    61706173              }
    6171               var layerCanvas = layer._toKonvaCanvas(config);
     6174              const layerCanvas = layer._toKonvaCanvas(config);
    61726175              _context.drawImage(layerCanvas._canvas, config.x, config.y, layerCanvas.getWidth() / layerCanvas.getPixelRatio(), layerCanvas.getHeight() / layerCanvas.getPixelRatio());
    61736176          });
     
    61916194              return null;
    61926195          }
    6193           var layers = this.children, len = layers.length, end = len - 1, n;
     6196          let layers = this.children, len = layers.length, end = len - 1, n;
    61946197          for (n = end; n >= 0; n--) {
    61956198              const shape = layers[n].getIntersection(pos);
     
    62016204      }
    62026205      _resizeDOM() {
    6203           var width = this.width();
    6204           var height = this.height();
     6206          const width = this.width();
     6207          const height = this.height();
    62056208          if (this.content) {
    62066209              // set content dimensions
     
    62186221      add(layer, ...rest) {
    62196222          if (arguments.length > 1) {
    6220               for (var i = 0; i < arguments.length; i++) {
     6223              for (let i = 0; i < arguments.length; i++) {
    62216224                  this.add(arguments[i]);
    62226225              }
     
    62246227          }
    62256228          super.add(layer);
    6226           var length = this.children.length;
     6229          const length = this.children.length;
    62276230          if (length > MAX_LAYERS_NUMBER) {
    62286231              Util.warn('The stage has ' +
     
    63086311          }
    63096312          this.setPointersPositions(evt);
    6310           var targetShape = this._getTargetShape(eventType);
    6311           var eventsEnabled = !(Konva$2.isDragging() || Konva$2.isTransforming()) || Konva$2.hitOnDragEnabled;
     6313          const targetShape = this._getTargetShape(eventType);
     6314          const eventsEnabled = !(Konva$2.isDragging() || Konva$2.isTransforming()) || Konva$2.hitOnDragEnabled;
    63126315          if (targetShape && eventsEnabled) {
    63136316              targetShape._fireAndBubble(events.pointerout, { evt: evt });
     
    63426345          }
    63436346          this.setPointersPositions(evt);
    6344           var triggeredOnShape = false;
     6347          let triggeredOnShape = false;
    63456348          this._changedPointerPositions.forEach((pos) => {
    6346               var shape = this.getIntersection(pos);
     6349              const shape = this.getIntersection(pos);
    63476350              DD.justDragged = false;
    63486351              // probably we are staring a click
     
    63906393          }
    63916394          this.setPointersPositions(evt);
    6392           var eventsEnabled = !(Konva$2.isDragging() || Konva$2.isTransforming()) || Konva$2.hitOnDragEnabled;
     6395          const eventsEnabled = !(Konva$2.isDragging() || Konva$2.isTransforming()) || Konva$2.hitOnDragEnabled;
    63936396          if (!eventsEnabled) {
    63946397              return;
    63956398          }
    6396           var processedShapesIds = {};
     6399          const processedShapesIds = {};
    63976400          let triggeredOnShape = false;
    6398           var targetShape = this._getTargetShape(eventType);
     6401          const targetShape = this._getTargetShape(eventType);
    63996402          this._changedPointerPositions.forEach((pos) => {
    64006403              const shape = (getCapturedShape(pos.id) ||
     
    64026405              const pointerId = pos.id;
    64036406              const event = { evt: evt, pointerId };
    6404               var differentTarget = targetShape !== shape;
     6407              const differentTarget = targetShape !== shape;
    64056408              if (differentTarget && targetShape) {
    64066409                  targetShape._fireAndBubble(events.pointerout, { ...event }, shape);
     
    64526455          const clickStartShape = this[eventType + 'ClickStartShape'];
    64536456          const clickEndShape = this[eventType + 'ClickEndShape'];
    6454           var processedShapesIds = {};
     6457          const processedShapesIds = {};
    64556458          let triggeredOnShape = false;
    64566459          this._changedPointerPositions.forEach((pos) => {
     
    65336536      _contextmenu(evt) {
    65346537          this.setPointersPositions(evt);
    6535           var shape = this.getIntersection(this.getPointerPosition());
     6538          const shape = this.getIntersection(this.getPointerPosition());
    65366539          if (shape && shape.isListening()) {
    65376540              shape._fireAndBubble(CONTEXTMENU, { evt: evt });
     
    65476550      _wheel(evt) {
    65486551          this.setPointersPositions(evt);
    6549           var shape = this.getIntersection(this.getPointerPosition());
     6552          const shape = this.getIntersection(this.getPointerPosition());
    65506553          if (shape && shape.isListening()) {
    65516554              shape._fireAndBubble(WHEEL, { evt: evt });
     
    65866589       */
    65876590      setPointersPositions(evt) {
    6588           var contentPosition = this._getContentPosition(), x = null, y = null;
     6591          let contentPosition = this._getContentPosition(), x = null, y = null;
    65896592          evt = evt ? evt : window.event;
    65906593          // touch events
     
    66366639              };
    66376640          }
    6638           var rect = this.content.getBoundingClientRect();
     6641          const rect = this.content.getBoundingClientRect();
    66396642          return {
    66406643              top: rect.top,
     
    66596662              return;
    66606663          }
    6661           var container = this.container();
     6664          const container = this.container();
    66626665          if (!container) {
    66636666              throw 'Stage has no container. A container is required.';
     
    67236726  }
    67246727
    6725   var HAS_SHADOW = 'hasShadow';
    6726   var SHADOW_RGBA = 'shadowRGBA';
    6727   var patternImage = 'patternImage';
    6728   var linearGradient = 'linearGradient';
    6729   var radialGradient = 'radialGradient';
     6728  const HAS_SHADOW = 'hasShadow';
     6729  const SHADOW_RGBA = 'shadowRGBA';
     6730  const patternImage = 'patternImage';
     6731  const linearGradient = 'linearGradient';
     6732  const radialGradient = 'radialGradient';
    67306733  let dummyContext$1;
    67316734  function getDummyContext$1() {
     
    69296932      __getFillPattern() {
    69306933          if (this.fillPatternImage()) {
    6931               var ctx = getDummyContext$1();
     6934              const ctx = getDummyContext$1();
    69326935              const pattern = ctx.createPattern(this.fillPatternImage(), this.fillPatternRepeat() || 'repeat');
    69336936              if (pattern && pattern.setTransform) {
     
    69576960      }
    69586961      __getLinearGradient() {
    6959           var colorStops = this.fillLinearGradientColorStops();
     6962          const colorStops = this.fillLinearGradientColorStops();
    69606963          if (colorStops) {
    6961               var ctx = getDummyContext$1();
    6962               var start = this.fillLinearGradientStartPoint();
    6963               var end = this.fillLinearGradientEndPoint();
    6964               var grd = ctx.createLinearGradient(start.x, start.y, end.x, end.y);
     6964              const ctx = getDummyContext$1();
     6965              const start = this.fillLinearGradientStartPoint();
     6966              const end = this.fillLinearGradientEndPoint();
     6967              const grd = ctx.createLinearGradient(start.x, start.y, end.x, end.y);
    69656968              // build color stops
    6966               for (var n = 0; n < colorStops.length; n += 2) {
     6969              for (let n = 0; n < colorStops.length; n += 2) {
    69676970                  grd.addColorStop(colorStops[n], colorStops[n + 1]);
    69686971              }
     
    69746977      }
    69756978      __getRadialGradient() {
    6976           var colorStops = this.fillRadialGradientColorStops();
     6979          const colorStops = this.fillRadialGradientColorStops();
    69776980          if (colorStops) {
    6978               var ctx = getDummyContext$1();
    6979               var start = this.fillRadialGradientStartPoint();
    6980               var end = this.fillRadialGradientEndPoint();
    6981               var grd = ctx.createRadialGradient(start.x, start.y, this.fillRadialGradientStartRadius(), end.x, end.y, this.fillRadialGradientEndRadius());
     6981              const ctx = getDummyContext$1();
     6982              const start = this.fillRadialGradientStartPoint();
     6983              const end = this.fillRadialGradientEndPoint();
     6984              const grd = ctx.createRadialGradient(start.x, start.y, this.fillRadialGradientStartRadius(), end.x, end.y, this.fillRadialGradientEndRadius());
    69826985              // build color stops
    6983               for (var n = 0; n < colorStops.length; n += 2) {
     6986              for (let n = 0; n < colorStops.length; n += 2) {
    69846987                  grd.addColorStop(colorStops[n], colorStops[n + 1]);
    69856988              }
     
    69946997              return;
    69956998          }
    6996           var rgba = Util.colorToRGBA(this.shadowColor());
     6999          const rgba = Util.colorToRGBA(this.shadowColor());
    69977000          if (rgba) {
    69987001              return ('rgba(' +
     
    70777080       */
    70787081      intersects(point) {
    7079           var stage = this.getStage();
     7082          const stage = this.getStage();
    70807083          if (!stage) {
    70817084              return false;
     
    71497152       */
    71507153      getSelfRect() {
    7151           var size = this.size();
     7154          const size = this.size();
    71527155          return {
    71537156              x: this._centroid ? -size.width / 2 : 0,
     
    72057208          // 2 - when we are caching current
    72067209          // 3 - when node is cached and we need to draw it into layer
    7207           var layer = this.getLayer();
    7208           var canvas = can || layer.getCanvas(), context = canvas.getContext(), cachedCanvas = this._getCanvasCache(), drawFunc = this.getSceneFunc(), hasShadow = this.hasShadow(), stage, bufferContext;
    7209           var skipBuffer = canvas.isCache;
    7210           var cachingSelf = top === this;
     7210          const layer = this.getLayer();
     7211          let canvas = can || layer.getCanvas(), context = canvas.getContext(), cachedCanvas = this._getCanvasCache(), drawFunc = this.getSceneFunc(), hasShadow = this.hasShadow(), stage, bufferContext;
     7212          const skipBuffer = canvas.isCache;
     7213          const cachingSelf = top === this;
    72117214          if (!this.isVisible() && !cachingSelf) {
    72127215              return this;
     
    72157218          if (cachedCanvas) {
    72167219              context.save();
    7217               var m = this.getAbsoluteTransform(top).getMatrix();
     7220              const m = this.getAbsoluteTransform(top).getMatrix();
    72187221              context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
    72197222              this._drawCachedSceneCanvas(context);
     
    72387241              drawFunc.call(this, bufferContext, this);
    72397242              bufferContext.restore();
    7240               var ratio = bc.pixelRatio;
     7243              const ratio = bc.pixelRatio;
    72417244              if (hasShadow) {
    72427245                  context._applyShadow(this);
     
    72667269              return this;
    72677270          }
    7268           var layer = this.getLayer(), canvas = can || layer.hitCanvas, context = canvas && canvas.getContext(), drawFunc = this.hitFunc() || this.sceneFunc(), cachedCanvas = this._getCanvasCache(), cachedHitCanvas = cachedCanvas && cachedCanvas.hit;
     7271          const layer = this.getLayer(), canvas = can || layer.hitCanvas, context = canvas && canvas.getContext(), drawFunc = this.hitFunc() || this.sceneFunc(), cachedCanvas = this._getCanvasCache(), cachedHitCanvas = cachedCanvas && cachedCanvas.hit;
    72697272          if (!this.colorKey) {
    72707273              Util.warn('Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()');
     
    72727275          if (cachedHitCanvas) {
    72737276              context.save();
    7274               var m = this.getAbsoluteTransform(top).getMatrix();
     7277              const m = this.getAbsoluteTransform(top).getMatrix();
    72757278              context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
    72767279              this._drawCachedHitCanvas(context);
     
    72857288          const selfCache = this === top;
    72867289          if (!selfCache) {
    7287               var o = this.getAbsoluteTransform(top).getMatrix();
     7290              const o = this.getAbsoluteTransform(top).getMatrix();
    72887291              context.transform(o[0], o[1], o[2], o[3], o[4], o[5]);
    72897292          }
     
    73057308       */
    73067309      drawHitFromCache(alphaThreshold = 0) {
    7307           var cachedCanvas = this._getCanvasCache(), sceneCanvas = this._getCachedSceneCanvas(), hitCanvas = cachedCanvas.hit, hitContext = hitCanvas.getContext(), hitWidth = hitCanvas.getWidth(), hitHeight = hitCanvas.getHeight(), hitImageData, hitData, len, rgbColorKey, i, alpha;
     7310          let cachedCanvas = this._getCanvasCache(), sceneCanvas = this._getCachedSceneCanvas(), hitCanvas = cachedCanvas.hit, hitContext = hitCanvas.getContext(), hitWidth = hitCanvas.getWidth(), hitHeight = hitCanvas.getHeight(), hitImageData, hitData, len, rgbColorKey, i, alpha;
    73087311          hitContext.clear();
    73097312          hitContext.drawImage(sceneCanvas._canvas, 0, 0, hitWidth, hitHeight);
     
    83698372
    83708373  // constants
    8371   var HASH = '#', BEFORE_DRAW = 'beforeDraw', DRAW = 'draw',
     8374  const HASH = '#', BEFORE_DRAW = 'beforeDraw', DRAW = 'draw',
    83728375  /*
    83738376   * 2 - 3 - 4
     
    84848487      setZIndex(index) {
    84858488          super.setZIndex(index);
    8486           var stage = this.getStage();
     8489          const stage = this.getStage();
    84878490          if (stage && stage.content) {
    84888491              stage.content.removeChild(this.getNativeCanvasElement());
     
    84988501      moveToTop() {
    84998502          Node.prototype.moveToTop.call(this);
    8500           var stage = this.getStage();
     8503          const stage = this.getStage();
    85018504          if (stage && stage.content) {
    85028505              stage.content.removeChild(this.getNativeCanvasElement());
     
    85068509      }
    85078510      moveUp() {
    8508           var moved = Node.prototype.moveUp.call(this);
     8511          const moved = Node.prototype.moveUp.call(this);
    85098512          if (!moved) {
    85108513              return false;
    85118514          }
    8512           var stage = this.getStage();
     8515          const stage = this.getStage();
    85138516          if (!stage || !stage.content) {
    85148517              return false;
     
    85268529      moveDown() {
    85278530          if (Node.prototype.moveDown.call(this)) {
    8528               var stage = this.getStage();
     8531              const stage = this.getStage();
    85298532              if (stage) {
    8530                   var children = stage.children;
     8533                  const children = stage.children;
    85318534                  if (stage.content) {
    85328535                      stage.content.removeChild(this.getNativeCanvasElement());
     
    85418544      moveToBottom() {
    85428545          if (Node.prototype.moveToBottom.call(this)) {
    8543               var stage = this.getStage();
     8546              const stage = this.getStage();
    85448547              if (stage) {
    8545                   var children = stage.children;
     8548                  const children = stage.children;
    85468549                  if (stage.content) {
    85478550                      stage.content.removeChild(this.getNativeCanvasElement());
     
    85578560      }
    85588561      remove() {
    8559           var _canvas = this.getNativeCanvasElement();
     8562          const _canvas = this.getNativeCanvasElement();
    85608563          Node.prototype.remove.call(this);
    85618564          if (_canvas && _canvas.parentNode && Util._isInDocument(_canvas)) {
     
    85748577      }
    85758578      _validateAdd(child) {
    8576           var type = child.getType();
     8579          const type = child.getType();
    85778580          if (type !== 'Group' && type !== 'Shape') {
    85788581              Util.throw('You may only add groups and shapes to a layer.');
     
    86718674          // in some cases antialiased area may be bigger than 1px
    86728675          // it is possible if we will cache node, then scale it a lot
    8673           var spiralSearchDistance = 1;
    8674           var continueSearch = false;
     8676          let spiralSearchDistance = 1;
     8677          let continueSearch = false;
    86758678          while (true) {
    86768679              for (let i = 0; i < INTERSECTION_OFFSETS_LEN; i++) {
     
    87288731      }
    87298732      drawScene(can, top) {
    8730           var layer = this.getLayer(), canvas = can || (layer && layer.getCanvas());
     8733          const layer = this.getLayer(), canvas = can || (layer && layer.getCanvas());
    87318734          this._fire(BEFORE_DRAW, {
    87328735              node: this,
     
    87428745      }
    87438746      drawHit(can, top) {
    8744           var layer = this.getLayer(), canvas = can || (layer && layer.hitCanvas);
     8747          const layer = this.getLayer(), canvas = can || (layer && layer.hitCanvas);
    87458748          if (layer && layer.clearBeforeDraw()) {
    87468749              layer.getHitCanvas().getContext().clear();
     
    87868789              return;
    87878790          }
    8788           var parent = this.parent;
    8789           var added = !!this.hitCanvas._canvas.parentNode;
     8791          const parent = this.parent;
     8792          const added = !!this.hitCanvas._canvas.parentNode;
    87908793          if (added) {
    87918794              parent.content.removeChild(this.hitCanvas._canvas);
     
    89248927  class Group extends Container {
    89258928      _validateAdd(child) {
    8926           var type = child.getType();
     8929          const type = child.getType();
    89278930          if (type !== 'Group' && type !== 'Shape') {
    89288931              Util.throw('You may only add groups and shapes to groups.');
     
    91219124              }
    91229125          }
    9123           for (let key in layerHash) {
     9126          for (const key in layerHash) {
    91249127              if (!layerHash.hasOwnProperty(key)) {
    91259128                  continue;
     
    91499152  Animation.animRunning = false;
    91509153
    9151   var blacklist = {
     9154  let blacklist = {
    91529155      node: 1,
    91539156      duration: 1,
     
    91759178      }
    91769179      fire(str) {
    9177           var handler = this[str];
     9180          const handler = this[str];
    91789181          if (handler) {
    91799182              handler();
     
    92549257      }
    92559258      onEnterFrame() {
    9256           var t = this.getTimer() - this._startTime;
     9259          const t = this.getTimer() - this._startTime;
    92579260          if (this.state === PLAYING) {
    92589261              this.setTime(t);
     
    92989301  class Tween {
    92999302      constructor(config) {
    9300           var that = this, node = config.node, nodeId = node._id, duration, easing = config.easing || Easings.Linear, yoyo = !!config.yoyo, key;
     9303          let that = this, node = config.node, nodeId = node._id, duration, easing = config.easing || Easings.Linear, yoyo = !!config.yoyo, key;
    93019304          if (typeof config.duration === 'undefined') {
    93029305              duration = 0.3;
     
    93119314          this.node = node;
    93129315          this._id = idCounter++;
    9313           var layers = node.getLayer() ||
     9316          const layers = node.getLayer() ||
    93149317              (node instanceof Konva$2['Stage'] ? node.getLayers() : null);
    93159318          if (!layers) {
     
    93469349      }
    93479350      _addAttr(key, end) {
    9348           var node = this.node, nodeId = node._id, start, diff, tweenId, n, len, trueEnd, trueStart, endRGBA;
     9351          let node = this.node, nodeId = node._id, start, diff, tweenId, n, len, trueEnd, trueStart, endRGBA;
    93499352          // remove conflict from tween map if it exists
    93509353          tweenId = Tween.tweens[nodeId][key];
     
    93779380                      }
    93789381                      else {
    9379                           var startRGBA = Util.colorToRGBA(start[n]);
     9382                          const startRGBA = Util.colorToRGBA(start[n]);
    93809383                          endRGBA = Util.colorToRGBA(end[n]);
    93819384                          start[n] = startRGBA;
     
    94189421      }
    94199422      _tweenFunc(i) {
    9420           var node = this.node, attrs = Tween.attrs[node._id][this._id], key, attr, start, diff, newVal, n, len, end;
     9423          let node = this.node, attrs = Tween.attrs[node._id][this._id], key, attr, start, diff, newVal, n, len, end;
    94219424          for (key in attrs) {
    94229425              attr = attrs[key];
     
    94829485          };
    94839486          this.tween.onFinish = () => {
    9484               var node = this.node;
     9487              const node = this.node;
    94859488              // after tweening  points of line we need to set original end
    9486               var attrs = Tween.attrs[node._id][this._id];
     9489              const attrs = Tween.attrs[node._id][this._id];
    94879490              if (attrs.points && attrs.points.trueEnd) {
    94889491                  node.setAttr('points', attrs.points.trueEnd);
     
    94939496          };
    94949497          this.tween.onReset = () => {
    9495               var node = this.node;
     9498              const node = this.node;
    94969499              // after tweening  points of line we need to set original start
    9497               var attrs = Tween.attrs[node._id][this._id];
     9500              const attrs = Tween.attrs[node._id][this._id];
    94989501              if (attrs.points && attrs.points.trueStart) {
    94999502                  node.points(attrs.points.trueStart);
     
    95769579       */
    95779580      destroy() {
    9578           var nodeId = this.node._id, thisId = this._id, attrs = Tween.tweens[nodeId], key;
     9581          let nodeId = this.node._id, thisId = this._id, attrs = Tween.tweens[nodeId], key;
    95799582          this.pause();
    95809583          for (key in attrs) {
     
    96019604   */
    96029605  Node.prototype.to = function (params) {
    9603       var onFinish = params.onFinish;
     9606      const onFinish = params.onFinish;
    96049607      params.node = this;
    96059608      params.onFinish = function () {
     
    96099612          }
    96109613      };
    9611       var tween = new Tween(params);
     9614      const tween = new Tween(params);
    96129615      tween.play();
    96139616  };
     
    96279630       */
    96289631      BackEaseIn(t, b, c, d) {
    9629           var s = 1.70158;
     9632          const s = 1.70158;
    96309633          return c * (t /= d) * t * ((s + 1) * t - s) + b;
    96319634      },
     
    96369639       */
    96379640      BackEaseOut(t, b, c, d) {
    9638           var s = 1.70158;
     9641          const s = 1.70158;
    96399642          return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
    96409643      },
     
    96459648       */
    96469649      BackEaseInOut(t, b, c, d) {
    9647           var s = 1.70158;
     9650          let s = 1.70158;
    96489651          if ((t /= d / 2) < 1) {
    96499652              return (c / 2) * (t * t * (((s *= 1.525) + 1) * t - s)) + b;
     
    96589661      ElasticEaseIn(t, b, c, d, a, p) {
    96599662          // added s = 0
    9660           var s = 0;
     9663          let s = 0;
    96619664          if (t === 0) {
    96629665              return b;
     
    96869689      ElasticEaseOut(t, b, c, d, a, p) {
    96879690          // added s = 0
    9688           var s = 0;
     9691          let s = 0;
    96899692          if (t === 0) {
    96909693              return b;
     
    97149717      ElasticEaseInOut(t, b, c, d, a, p) {
    97159718          // added s = 0
    9716           var s = 0;
     9719          let s = 0;
    97179720          if (t === 0) {
    97189721              return b;
     
    99689971  class Arc extends Shape {
    99699972      _sceneFunc(context) {
    9970           var angle = Konva$2.getAngle(this.angle()), clockwise = this.clockwise();
     9973          const angle = Konva$2.getAngle(this.angle()), clockwise = this.clockwise();
    99719974          context.beginPath();
    99729975          context.arc(0, 0, this.outerRadius(), 0, angle, clockwise);
     
    1007410077
    1007510078  function getControlPoints(x0, y0, x1, y1, x2, y2, t) {
    10076       var d01 = Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2)), d12 = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)), fa = (t * d01) / (d01 + d12), fb = (t * d12) / (d01 + d12), p1x = x1 - fa * (x2 - x0), p1y = y1 - fa * (y2 - y0), p2x = x1 + fb * (x2 - x0), p2y = y1 + fb * (y2 - y0);
     10079      const d01 = Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2)), d12 = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)), fa = (t * d01) / (d01 + d12), fb = (t * d12) / (d01 + d12), p1x = x1 - fa * (x2 - x0), p1y = y1 - fa * (y2 - y0), p2x = x1 + fb * (x2 - x0), p2y = y1 + fb * (y2 - y0);
    1007710080      return [p1x, p1y, p2x, p2y];
    1007810081  }
    1007910082  function expandPoints(p, tension) {
    10080       var len = p.length, allPoints = [], n, cp;
    10081       for (n = 2; n < len - 2; n += 2) {
    10082           cp = getControlPoints(p[n - 2], p[n - 1], p[n], p[n + 1], p[n + 2], p[n + 3], tension);
     10083      const len = p.length, allPoints = [];
     10084      for (let n = 2; n < len - 2; n += 2) {
     10085          const cp = getControlPoints(p[n - 2], p[n - 1], p[n], p[n + 1], p[n + 2], p[n + 3], tension);
    1008310086          if (isNaN(cp[0])) {
    1008410087              continue;
     
    1019610199      }
    1019710200      _sceneFunc(context) {
    10198           var points = this.points(), length = points.length, tension = this.tension(), closed = this.closed(), bezier = this.bezier(), tp, len, n;
     10201          let points = this.points(), length = points.length, tension = this.tension(), closed = this.closed(), bezier = this.bezier(), tp, len, n;
    1019910202          if (!length) {
    1020010203              return;
     
    1025210255      }
    1025310256      _getTensionPointsClosed() {
    10254           var p = this.points(), len = p.length, tension = this.tension(), firstControlPoints = getControlPoints(p[len - 2], p[len - 1], p[0], p[1], p[2], p[3], tension), lastControlPoints = getControlPoints(p[len - 4], p[len - 3], p[len - 2], p[len - 1], p[0], p[1], tension), middle = expandPoints(p, tension), tp = [firstControlPoints[2], firstControlPoints[3]]
     10257          const p = this.points(), len = p.length, tension = this.tension(), firstControlPoints = getControlPoints(p[len - 2], p[len - 1], p[0], p[1], p[2], p[3], tension), lastControlPoints = getControlPoints(p[len - 4], p[len - 3], p[len - 2], p[len - 1], p[0], p[1], tension), middle = expandPoints(p, tension), tp = [firstControlPoints[2], firstControlPoints[3]]
    1025510258              .concat(middle)
    1025610259              .concat([
     
    1027610279      // overload size detection
    1027710280      getSelfRect() {
    10278           var points = this.points();
     10281          let points = this.points();
    1027910282          if (points.length < 4) {
    1028010283              return {
     
    1029710300              points = this.points();
    1029810301          }
    10299           var minX = points[0];
    10300           var maxX = points[0];
    10301           var minY = points[1];
    10302           var maxY = points[1];
    10303           var x, y;
    10304           for (var i = 0; i < points.length / 2; i++) {
     10302          let minX = points[0];
     10303          let maxX = points[0];
     10304          let minY = points[1];
     10305          let maxY = points[1];
     10306          let x, y;
     10307          for (let i = 0; i < points.length / 2; i++) {
    1030510308              x = points[i * 2];
    1030610309              y = points[i * 2 + 1];
     
    1107511078  const binomialCoefficients = [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1]];
    1107611079  const getCubicArcLength = (xs, ys, t) => {
    11077       let z;
    1107811080      let sum;
    1107911081      let correctedT;
     
    1108211084          }*/
    1108311085      const n = 20;
    11084       z = t / 2;
     11086      const z = t / 2;
    1108511087      sum = 0;
    1108611088      for (let i = 0; i < n; i++) {
     
    1129211294      }
    1129311295      _sceneFunc(context) {
    11294           var ca = this.dataArray;
     11296          const ca = this.dataArray;
    1129511297          // context position
    1129611298          context.beginPath();
    11297           var isClosed = false;
    11298           for (var n = 0; n < ca.length; n++) {
    11299               var c = ca[n].command;
    11300               var p = ca[n].points;
     11299          let isClosed = false;
     11300          for (let n = 0; n < ca.length; n++) {
     11301              const c = ca[n].command;
     11302              const p = ca[n].points;
    1130111303              switch (c) {
    1130211304                  case 'L':
     
    1133911341      }
    1134011342      getSelfRect() {
    11341           var points = [];
     11343          let points = [];
    1134211344          this.dataArray.forEach(function (data) {
    1134311345              if (data.command === 'A') {
    1134411346                  // Approximates by breaking curve into line segments
    11345                   var start = data.points[4];
     11347                  const start = data.points[4];
    1134611348                  // 4 = theta
    11347                   var dTheta = data.points[5];
     11349                  const dTheta = data.points[5];
    1134811350                  // 5 = dTheta
    11349                   var end = data.points[4] + dTheta;
    11350                   var inc = Math.PI / 180.0;
     11351                  const end = data.points[4] + dTheta;
     11352                  let inc = Math.PI / 180.0;
    1135111353                  // 1 degree resolution
    1135211354                  if (Math.abs(start - end) < inc) {
     
    1138011382              }
    1138111383          });
    11382           var minX = points[0];
    11383           var maxX = points[0];
    11384           var minY = points[1];
    11385           var maxY = points[1];
    11386           var x, y;
    11387           for (var i = 0; i < points.length / 2; i++) {
     11384          let minX = points[0];
     11385          let maxX = points[0];
     11386          let minY = points[1];
     11387          let maxY = points[1];
     11388          let x, y;
     11389          for (let i = 0; i < points.length / 2; i++) {
    1138811390              x = points[i * 2];
    1138911391              y = points[i * 2 + 1];
     
    1143311435      static getPathLength(dataArray) {
    1143411436          let pathLength = 0;
    11435           for (var i = 0; i < dataArray.length; ++i) {
     11437          for (let i = 0; i < dataArray.length; ++i) {
    1143611438              pathLength += dataArray[i].pathLength;
    1143711439          }
     
    1143911441      }
    1144011442      static getPointAtLengthOfDataArray(length, dataArray) {
    11441           var point, i = 0, ii = dataArray.length;
     11443          let points, i = 0, ii = dataArray.length;
    1144211444          if (!ii) {
    1144311445              return null;
     
    1144811450          }
    1144911451          if (i === ii) {
    11450               point = dataArray[i - 1].points.slice(-2);
     11452              points = dataArray[i - 1].points.slice(-2);
    1145111453              return {
    11452                   x: point[0],
    11453                   y: point[1],
     11454                  x: points[0],
     11455                  y: points[1],
    1145411456              };
    1145511457          }
    1145611458          if (length < 0.01) {
    11457               point = dataArray[i].points.slice(0, 2);
     11459              points = dataArray[i].points.slice(0, 2);
    1145811460              return {
    11459                   x: point[0],
    11460                   y: point[1],
     11461                  x: points[0],
     11462                  y: points[1],
    1146111463              };
    1146211464          }
    11463           var cp = dataArray[i];
    11464           var p = cp.points;
     11465          const cp = dataArray[i];
     11466          const p = cp.points;
    1146511467          switch (cp.command) {
    1146611468              case 'L':
     
    1152011522              return (1 - t) * (1 - t) * (1 - t);
    1152111523          }
    11522           var x = P4x * CB1(pct) + P3x * CB2(pct) + P2x * CB3(pct) + P1x * CB4(pct);
    11523           var y = P4y * CB1(pct) + P3y * CB2(pct) + P2y * CB3(pct) + P1y * CB4(pct);
     11524          const x = P4x * CB1(pct) + P3x * CB2(pct) + P2x * CB3(pct) + P1x * CB4(pct);
     11525          const y = P4y * CB1(pct) + P3y * CB2(pct) + P2y * CB3(pct) + P1y * CB4(pct);
    1152411526          return {
    1152511527              x: x,
     
    1153711539              return (1 - t) * (1 - t);
    1153811540          }
    11539           var x = P3x * QB1(pct) + P2x * QB2(pct) + P1x * QB3(pct);
    11540           var y = P3y * QB1(pct) + P2y * QB2(pct) + P1y * QB3(pct);
     11541          const x = P3x * QB1(pct) + P2x * QB2(pct) + P1x * QB3(pct);
     11542          const y = P3y * QB1(pct) + P2y * QB2(pct) + P1y * QB3(pct);
    1154111543          return {
    1154211544              x: x,
     
    1154511547      }
    1154611548      static getPointOnEllipticalArc(cx, cy, rx, ry, theta, psi) {
    11547           var cosPsi = Math.cos(psi), sinPsi = Math.sin(psi);
    11548           var pt = {
     11549          const cosPsi = Math.cos(psi), sinPsi = Math.sin(psi);
     11550          const pt = {
    1154911551              x: rx * Math.cos(theta),
    1155011552              y: ry * Math.sin(theta),
     
    1158811590          }
    1158911591          // command string
    11590           var cs = data;
     11592          let cs = data;
    1159111593          // command chars
    11592           var cc = [
     11594          const cc = [
    1159311595              'm',
    1159411596              'M',
     
    1161911621          }
    1162011622          // create array
    11621           var arr = cs.split('|');
    11622           var ca = [];
    11623           var coords = [];
     11623          const arr = cs.split('|');
     11624          const ca = [];
     11625          const coords = [];
    1162411626          // init context point
    11625           var cpx = 0;
    11626           var cpy = 0;
    11627           var re = /([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;
    11628           var match;
     11627          let cpx = 0;
     11628          let cpy = 0;
     11629          const re = /([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;
     11630          let match;
    1162911631          for (n = 1; n < arr.length; n++) {
    11630               var str = arr[n];
    11631               var c = str.charAt(0);
     11632              let str = arr[n];
     11633              let c = str.charAt(0);
    1163211634              str = str.slice(1);
    1163311635              coords.length = 0;
     
    1163811640              //   coords.push(match[0]);
    1163911641              // }
    11640               var p = [];
    11641               for (var j = 0, jlen = coords.length; j < jlen; j++) {
     11642              const p = [];
     11643              for (let j = 0, jlen = coords.length; j < jlen; j++) {
    1164211644                  // extra case for merged flags
    1164311645                  if (coords[j] === '00') {
     
    1164511647                      continue;
    1164611648                  }
    11647                   var parsed = parseFloat(coords[j]);
     11649                  const parsed = parseFloat(coords[j]);
    1164811650                  if (!isNaN(parsed)) {
    1164911651                      p.push(parsed);
     
    1165811660                      break;
    1165911661                  }
    11660                   var cmd = '';
    11661                   var points = [];
    11662                   var startX = cpx, startY = cpy;
     11662                  let cmd = '';
     11663                  let points = [];
     11664                  const startX = cpx, startY = cpy;
    1166311665                  // Move var from within the switch to up here (jshint)
    1166411666                  var prevCmd, ctlPtx, ctlPty; // Ss, Tt
     
    1168811690                          // to the the first point of the path (if any).
    1168911691                          if (ca.length > 2 && ca[ca.length - 1].command === 'z') {
    11690                               for (var idx = ca.length - 2; idx >= 0; idx--) {
     11692                              for (let idx = ca.length - 2; idx >= 0; idx--) {
    1169111693                                  if (ca[idx].command === 'M') {
    1169211694                                      cpx = ca[idx].points[0] + dx;
     
    1185711859      }
    1185811860      static calcLength(x, y, cmd, points) {
    11859           var len, p1, p2, t;
    11860           var path = Path;
     11861          let len, p1, p2, t;
     11862          const path = Path;
    1186111863          switch (cmd) {
    1186211864              case 'L':
     
    1190511907      static convertEndpointToCenterParameterization(x1, y1, x2, y2, fa, fs, rx, ry, psiDeg) {
    1190611908          // Derived from: http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes
    11907           var psi = psiDeg * (Math.PI / 180.0);
    11908           var xp = (Math.cos(psi) * (x1 - x2)) / 2.0 + (Math.sin(psi) * (y1 - y2)) / 2.0;
    11909           var yp = (-1 * Math.sin(psi) * (x1 - x2)) / 2.0 +
     11909          const psi = psiDeg * (Math.PI / 180.0);
     11910          const xp = (Math.cos(psi) * (x1 - x2)) / 2.0 + (Math.sin(psi) * (y1 - y2)) / 2.0;
     11911          const yp = (-1 * Math.sin(psi) * (x1 - x2)) / 2.0 +
    1191011912              (Math.cos(psi) * (y1 - y2)) / 2.0;
    11911           var lambda = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);
     11913          const lambda = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);
    1191211914          if (lambda > 1) {
    1191311915              rx *= Math.sqrt(lambda);
    1191411916              ry *= Math.sqrt(lambda);
    1191511917          }
    11916           var f = Math.sqrt((rx * rx * (ry * ry) - rx * rx * (yp * yp) - ry * ry * (xp * xp)) /
     11918          let f = Math.sqrt((rx * rx * (ry * ry) - rx * rx * (yp * yp) - ry * ry * (xp * xp)) /
    1191711919              (rx * rx * (yp * yp) + ry * ry * (xp * xp)));
    1191811920          if (fa === fs) {
     
    1192211924              f = 0;
    1192311925          }
    11924           var cxp = (f * rx * yp) / ry;
    11925           var cyp = (f * -ry * xp) / rx;
    11926           var cx = (x1 + x2) / 2.0 + Math.cos(psi) * cxp - Math.sin(psi) * cyp;
    11927           var cy = (y1 + y2) / 2.0 + Math.sin(psi) * cxp + Math.cos(psi) * cyp;
    11928           var vMag = function (v) {
     11926          const cxp = (f * rx * yp) / ry;
     11927          const cyp = (f * -ry * xp) / rx;
     11928          const cx = (x1 + x2) / 2.0 + Math.cos(psi) * cxp - Math.sin(psi) * cyp;
     11929          const cy = (y1 + y2) / 2.0 + Math.sin(psi) * cxp + Math.cos(psi) * cyp;
     11930          const vMag = function (v) {
    1192911931              return Math.sqrt(v[0] * v[0] + v[1] * v[1]);
    1193011932          };
    11931           var vRatio = function (u, v) {
     11933          const vRatio = function (u, v) {
    1193211934              return (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v));
    1193311935          };
    11934           var vAngle = function (u, v) {
     11936          const vAngle = function (u, v) {
    1193511937              return (u[0] * v[1] < u[1] * v[0] ? -1 : 1) * Math.acos(vRatio(u, v));
    1193611938          };
    11937           var theta = vAngle([1, 0], [(xp - cxp) / rx, (yp - cyp) / ry]);
    11938           var u = [(xp - cxp) / rx, (yp - cyp) / ry];
    11939           var v = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry];
    11940           var dTheta = vAngle(u, v);
     11939          const theta = vAngle([1, 0], [(xp - cxp) / rx, (yp - cyp) / ry]);
     11940          const u = [(xp - cxp) / rx, (yp - cyp) / ry];
     11941          const v = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry];
     11942          let dTheta = vAngle(u, v);
    1194111943          if (vRatio(u, v) <= -1) {
    1194211944              dTheta = Math.PI;
     
    1207412076      _sceneFunc(ctx) {
    1207512077          super._sceneFunc(ctx);
    12076           var PI2 = Math.PI * 2;
    12077           var points = this.points();
    12078           var tp = points;
    12079           var fromTension = this.tension() !== 0 && points.length > 4;
     12078          const PI2 = Math.PI * 2;
     12079          const points = this.points();
     12080          let tp = points;
     12081          const fromTension = this.tension() !== 0 && points.length > 4;
    1208012082          if (fromTension) {
    1208112083              tp = this.getTensionPoints();
    1208212084          }
    12083           var length = this.pointerLength();
    12084           var n = points.length;
    12085           var dx, dy;
     12085          const length = this.pointerLength();
     12086          const n = points.length;
     12087          let dx, dy;
    1208612088          if (fromTension) {
    1208712089              const lp = [
     
    1210212104              dy = points[n - 1] - points[n - 3];
    1210312105          }
    12104           var radians = (Math.atan2(dy, dx) + PI2) % PI2;
    12105           var width = this.pointerWidth();
     12106          const radians = (Math.atan2(dy, dx) + PI2) % PI2;
     12107          const width = this.pointerWidth();
    1210612108          if (this.pointerAtEnding()) {
    1210712109              ctx.save();
     
    1214012142          // here is a tricky part
    1214112143          // we need to disable dash for arrow pointers
    12142           var isDashEnabled = this.dashEnabled();
     12144          const isDashEnabled = this.dashEnabled();
    1214312145          if (isDashEnabled) {
    1214412146              // manually disable dash for head
     
    1245012452  class Ellipse extends Shape {
    1245112453      _sceneFunc(context) {
    12452           var rx = this.radiusX(), ry = this.radiusY();
     12454          const rx = this.radiusX(), ry = this.radiusY();
    1245312455          context.beginPath();
    1245412456          context.save();
     
    1269712699      }
    1269812700      _hitFunc(context) {
    12699           var width = this.width(), height = this.height(), cornerRadius = this.cornerRadius();
     12701          const width = this.width(), height = this.height(), cornerRadius = this.cornerRadius();
    1270012702          context.beginPath();
    1270112703          if (!cornerRadius) {
     
    1273112733       */
    1273212734      static fromURL(url, callback, onError = null) {
    12733           var img = Util.createImageElement();
     12735          const img = Util.createImageElement();
    1273412736          img.onload = function () {
    12735               var image = new Image({
     12737              const image = new Image({
    1273612738                  image: img,
    1273712739              });
     
    1285812860
    1285912861  // constants
    12860   var ATTR_CHANGE_LIST$2 = [
     12862  const ATTR_CHANGE_LIST$2 = [
    1286112863      'fontFamily',
    1286212864      'fontSize',
     
    1295912961      }
    1296012962      _addListeners(text) {
    12961           var that = this, n;
    12962           var func = function () {
     12963          let that = this, n;
     12964          const func = function () {
    1296312965              that._sync();
    1296412966          };
     
    1297512977      }
    1297612978      _sync() {
    12977           var text = this.getText(), tag = this.getTag(), width, height, pointerDirection, pointerWidth, x, y, pointerHeight;
     12979          let text = this.getText(), tag = this.getTag(), width, height, pointerDirection, pointerWidth, x, y, pointerHeight;
    1297812980          if (text && tag) {
    1297912981              width = text.width();
     
    1303113033  class Tag extends Shape {
    1303213034      _sceneFunc(context) {
    13033           var width = this.width(), height = this.height(), pointerDirection = this.pointerDirection(), pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), cornerRadius = this.cornerRadius();
     13035          const width = this.width(), height = this.height(), pointerDirection = this.pointerDirection(), pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), cornerRadius = this.cornerRadius();
    1303413036          let topLeft = 0;
    1303513037          let topRight = 0;
     
    1308313085      }
    1308413086      getSelfRect() {
    13085           var x = 0, y = 0, pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), direction = this.pointerDirection(), width = this.width(), height = this.height();
     13087          let x = 0, y = 0, pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), direction = this.pointerDirection(), width = this.width(), height = this.height();
    1308613088          if (direction === UP) {
    1308713089              y -= pointerHeight;
     
    1324613248  class Rect extends Shape {
    1324713249      _sceneFunc(context) {
    13248           var cornerRadius = this.cornerRadius(), width = this.width(), height = this.height();
     13250          const cornerRadius = this.cornerRadius(), width = this.width(), height = this.height();
    1324913251          context.beginPath();
    1325013252          if (!cornerRadius) {
     
    1337813380          context.beginPath();
    1337913381          context.moveTo(points[0].x, points[0].y);
    13380           for (var n = 1; n < points.length; n++) {
     13382          for (let n = 1; n < points.length; n++) {
    1338113383              context.lineTo(points[n].x, points[n].y);
    1338213384          }
     
    1338813390          const radius = this.attrs.radius || 0;
    1338913391          const points = [];
    13390           for (var n = 0; n < sides; n++) {
     13392          for (let n = 0; n < sides; n++) {
    1339113393              points.push({
    1339213394                  x: radius * Math.sin((n * 2 * Math.PI) / sides),
     
    1339813400      getSelfRect() {
    1339913401          const points = this._getPoints();
    13400           var minX = points[0].x;
    13401           var maxX = points[0].y;
    13402           var minY = points[0].x;
    13403           var maxY = points[0].y;
     13402          let minX = points[0].x;
     13403          let maxX = points[0].y;
     13404          let minY = points[0].x;
     13405          let maxY = points[0].y;
    1340413406          points.forEach((point) => {
    1340513407              minX = Math.min(minX, point.x);
     
    1346113463  Factory.addGetterSetter(RegularPolygon, 'sides', 0, getNumberValidator());
    1346213464
    13463   var PIx2 = Math.PI * 2;
     13465  const PIx2 = Math.PI * 2;
    1346413466  /**
    1346513467   * Ring constructor
     
    1373313735          this.anim = new Animation(() => {
    1373413736              // if we don't need to redraw layer we should return false
    13735               var updated = this._updated;
     13737              const updated = this._updated;
    1373613738              this._updated = false;
    1373713739              return updated;
     
    1375413756      }
    1375513757      _sceneFunc(context) {
    13756           var anim = this.animation(), index = this.frameIndex(), ix4 = index * 4, set = this.animations()[anim], offsets = this.frameOffsets(), x = set[ix4 + 0], y = set[ix4 + 1], width = set[ix4 + 2], height = set[ix4 + 3], image = this.image();
     13758          const anim = this.animation(), index = this.frameIndex(), ix4 = index * 4, set = this.animations()[anim], offsets = this.frameOffsets(), x = set[ix4 + 0], y = set[ix4 + 1], width = set[ix4 + 2], height = set[ix4 + 3], image = this.image();
    1375713759          if (this.hasFill() || this.hasStroke()) {
    1375813760              context.beginPath();
     
    1376313765          if (image) {
    1376413766              if (offsets) {
    13765                   var offset = offsets[anim], ix2 = index * 2;
     13767                  const offset = offsets[anim], ix2 = index * 2;
    1376613768                  context.drawImage(image, x, y, width, height, offset[ix2 + 0], offset[ix2 + 1], width, height);
    1376713769              }
     
    1377213774      }
    1377313775      _hitFunc(context) {
    13774           var anim = this.animation(), index = this.frameIndex(), ix4 = index * 4, set = this.animations()[anim], offsets = this.frameOffsets(), width = set[ix4 + 2], height = set[ix4 + 3];
     13776          const anim = this.animation(), index = this.frameIndex(), ix4 = index * 4, set = this.animations()[anim], offsets = this.frameOffsets(), width = set[ix4 + 2], height = set[ix4 + 3];
    1377513777          context.beginPath();
    1377613778          if (offsets) {
    13777               var offset = offsets[anim];
    13778               var ix2 = index * 2;
     13779              const offset = offsets[anim];
     13780              const ix2 = index * 2;
    1377913781              context.rect(offset[ix2 + 0], offset[ix2 + 1], width, height);
    1378013782          }
     
    1378913791      }
    1379013792      _setInterval() {
    13791           var that = this;
     13793          const that = this;
    1379213794          this.interval = setInterval(function () {
    1379313795              that._updateIndex();
     
    1380313805              return;
    1380413806          }
    13805           var layer = this.getLayer();
     13807          const layer = this.getLayer();
    1380613808          /*
    1380713809           * animation object has no executable function because
     
    1383313835      }
    1383413836      _updateIndex() {
    13835           var index = this.frameIndex(), animation = this.animation(), animations = this.animations(), anim = animations[animation], len = anim.length / 4;
     13837          const index = this.frameIndex(), animation = this.animation(), animations = this.animations(), anim = animations[animation], len = anim.length / 4;
    1383613838          if (index < len - 1) {
    1383713839              this.frameIndex(index + 1);
     
    1407214074  class Star extends Shape {
    1407314075      _sceneFunc(context) {
    14074           var innerRadius = this.innerRadius(), outerRadius = this.outerRadius(), numPoints = this.numPoints();
     14076          const innerRadius = this.innerRadius(), outerRadius = this.outerRadius(), numPoints = this.numPoints();
    1407514077          context.beginPath();
    1407614078          context.moveTo(0, 0 - outerRadius);
    14077           for (var n = 1; n < numPoints * 2; n++) {
    14078               var radius = n % 2 === 0 ? outerRadius : innerRadius;
    14079               var x = radius * Math.sin((n * Math.PI) / numPoints);
    14080               var y = -1 * radius * Math.cos((n * Math.PI) / numPoints);
     14079          for (let n = 1; n < numPoints * 2; n++) {
     14080              const radius = n % 2 === 0 ? outerRadius : innerRadius;
     14081              const x = radius * Math.sin((n * Math.PI) / numPoints);
     14082              const y = -1 * radius * Math.cos((n * Math.PI) / numPoints);
    1408114083              context.lineTo(x, y);
    1408214084          }
     
    1414514147
    1414614148  function stringToArray(string) {
    14147       // we need to use `Array.from` because it can split unicode string correctly
    14148       // we also can use some regexp magic from lodash:
    14149       // https://github.com/lodash/lodash/blob/fb1f99d9d90ad177560d771bc5953a435b2dc119/lodash.toarray/index.js#L256
    14150       // but I decided it is too much code for that small fix
    14151       return Array.from(string);
     14149      // Use Unicode-aware splitting
     14150      return [...string].reduce((acc, char, index, array) => {
     14151          // Handle emoji sequences (including ZWJ sequences)
     14152          if (/\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?(?:\u200D\p{Emoji_Presentation})+/u.test(char)) {
     14153              acc.push(char);
     14154          }
     14155          // Handle regional indicator symbols (flags)
     14156          else if (/\p{Regional_Indicator}{2}/u.test(char + (array[index + 1] || ''))) {
     14157              acc.push(char + array[index + 1]);
     14158          }
     14159          // Handle Indic scripts and other combining characters
     14160          else if (index > 0 && /\p{Mn}|\p{Me}|\p{Mc}/u.test(char)) {
     14161              acc[acc.length - 1] += char;
     14162          }
     14163          // Handle other characters
     14164          else {
     14165              acc.push(char);
     14166          }
     14167          return acc;
     14168      }, []);
    1415214169  }
    1415314170  // constants
    14154   var AUTO = 'auto',
     14171  const AUTO = 'auto',
    1415514172  //CANVAS = 'canvas',
    1415614173  CENTER = 'center', INHERIT = 'inherit', JUSTIFY = 'justify', CHANGE_KONVA = 'Change.konva', CONTEXT_2D = '2d', DASH = '-', LEFT = 'left', TEXT = 'text', TEXT_UPPER = 'Text', TOP = 'top', BOTTOM = 'bottom', MIDDLE = 'middle', NORMAL$1 = 'normal', PX_SPACE = 'px ', SPACE = ' ', RIGHT = 'right', RTL = 'rtl', WORD = 'word', CHAR = 'char', NONE = 'none', ELLIPSIS = '…', ATTR_CHANGE_LIST$1 = [
     
    1418714204          .join(', ');
    1418814205  }
    14189   var dummyContext;
     14206  let dummyContext;
    1419014207  function getDummyContext() {
    1419114208      if (dummyContext) {
     
    1432114338          this._partialTextY = 0;
    1432214339          // update text data for certain attr changes
    14323           for (var n = 0; n < attrChangeListLen; n++) {
     14340          for (let n = 0; n < attrChangeListLen; n++) {
    1432414341              this.on(ATTR_CHANGE_LIST$1[n] + CHANGE_KONVA, this._setTextData);
    1432514342          }
     
    1432714344      }
    1432814345      _sceneFunc(context) {
    14329           var textArr = this.textArr, textArrLen = textArr.length;
     14346          const textArr = this.textArr, textArrLen = textArr.length;
    1433014347          if (!this.text()) {
    1433114348              return;
    1433214349          }
    14333           var padding = this.padding(), fontSize = this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, verticalAlign = this.verticalAlign(), direction = this.direction(), alignY = 0, align = this.align(), totalWidth = this.getWidth(), letterSpacing = this.letterSpacing(), fill = this.fill(), textDecoration = this.textDecoration(), shouldUnderline = textDecoration.indexOf('underline') !== -1, shouldLineThrough = textDecoration.indexOf('line-through') !== -1, n;
     14350          let padding = this.padding(), fontSize = this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, verticalAlign = this.verticalAlign(), direction = this.direction(), alignY = 0, align = this.align(), totalWidth = this.getWidth(), letterSpacing = this.letterSpacing(), fill = this.fill(), textDecoration = this.textDecoration(), shouldUnderline = textDecoration.indexOf('underline') !== -1, shouldLineThrough = textDecoration.indexOf('line-through') !== -1, n;
    1433414351          direction = direction === INHERIT ? context.direction : direction;
    14335           var translateY = lineHeightPx / 2;
    14336           var baseline = MIDDLE;
     14352          let translateY = lineHeightPx / 2;
     14353          let baseline = MIDDLE;
    1433714354          if (Konva$2._fixTextRendering) {
    14338               var metrics = this.measureSize('M'); // Use a sample character to get the ascent
     14355              const metrics = this.measureSize('M'); // Use a sample character to get the ascent
    1433914356              baseline = 'alphabetic';
    1434014357              translateY =
     
    1437414391                  context.save();
    1437514392                  context.beginPath();
    14376                   let yOffset = Konva$2._fixTextRendering
     14393                  const yOffset = Konva$2._fixTextRendering
    1437714394                      ? Math.round(fontSize / 4)
    1437814395                      : Math.round(fontSize / 2);
     
    1439614413                  context.save();
    1439714414                  context.beginPath();
    14398                   let yOffset = Konva$2._fixTextRendering ? -Math.round(fontSize / 4) : 0;
     14415                  const yOffset = Konva$2._fixTextRendering ? -Math.round(fontSize / 4) : 0;
    1439914416                  context.moveTo(lineTranslateX, translateY + lineTranslateY + yOffset);
    1440014417                  spacesNumber = text.split(' ').length - 1;
     
    1441714434                  //   var words = text.split(' ');
    1441814435                  spacesNumber = text.split(' ').length - 1;
    14419                   var array = stringToArray(text);
    14420                   for (var li = 0; li < array.length; li++) {
    14421                       var letter = array[li];
     14436                  const array = stringToArray(text);
     14437                  for (let li = 0; li < array.length; li++) {
     14438                      const letter = array[li];
    1442214439                      // skip justify for the last line
    1442314440                      if (letter === ' ' && !lastLine && align === JUSTIFY) {
     
    1445114468      }
    1445214469      _hitFunc(context) {
    14453           var width = this.getWidth(), height = this.getHeight();
     14470          const width = this.getWidth(), height = this.getHeight();
    1445414471          context.beginPath();
    1445514472          context.rect(0, 0, width, height);
     
    1445814475      }
    1445914476      setText(text) {
    14460           var str = Util._isString(text)
     14477          const str = Util._isString(text)
    1446114478              ? text
    1446214479              : text === null || text === undefined
     
    1446714484      }
    1446814485      getWidth() {
    14469           var isAuto = this.attrs.width === AUTO || this.attrs.width === undefined;
     14486          const isAuto = this.attrs.width === AUTO || this.attrs.width === undefined;
    1447014487          return isAuto ? this.getTextWidth() + this.padding() * 2 : this.attrs.width;
    1447114488      }
    1447214489      getHeight() {
    14473           var isAuto = this.attrs.height === AUTO || this.attrs.height === undefined;
     14490          const isAuto = this.attrs.height === AUTO || this.attrs.height === undefined;
    1447414491          return isAuto
    1447514492              ? this.fontSize() * this.textArr.length * this.lineHeight() +
     
    1449514512       * @method
    1449614513       * @name Konva.Text#measureSize
    14497        * @param {String} [text] text to measure
    14498        * @returns {Object} { width , height} of measured text
     14514       * @param {String} text text to measure
     14515       * @returns {Object} { width , height } of measured text
    1449914516       */
    1450014517      measureSize(text) {
    1450114518          var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
    14502           var _context = getDummyContext(), fontSize = this.fontSize(), metrics;
     14519          let _context = getDummyContext(), fontSize = this.fontSize(), metrics;
    1450314520          _context.save();
    1450414521          _context.font = this._getContextFont();
     
    1453814555              line = line.trim();
    1453914556          }
    14540           var width = this._getTextWidth(line);
     14557          const width = this._getTextWidth(line);
    1454114558          return this.textArr.push({
    1454214559              text: line,
     
    1454614563      }
    1454714564      _getTextWidth(text) {
    14548           var letterSpacing = this.letterSpacing();
    14549           var length = text.length;
     14565          const letterSpacing = this.letterSpacing();
     14566          const length = text.length;
    1455014567          return (getDummyContext().measureText(text).width +
    1455114568              (length ? letterSpacing * (length - 1) : 0));
    1455214569      }
    1455314570      _setTextData() {
    14554           var lines = this.text().split('\n'), fontSize = +this.fontSize(), textWidth = 0, lineHeightPx = this.lineHeight() * fontSize, width = this.attrs.width, height = this.attrs.height, fixedWidth = width !== AUTO && width !== undefined, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxWidth = width - padding * 2, maxHeightPx = height - padding * 2, currentHeightPx = 0, wrap = this.wrap(),
     14571          let lines = this.text().split('\n'), fontSize = +this.fontSize(), textWidth = 0, lineHeightPx = this.lineHeight() * fontSize, width = this.attrs.width, height = this.attrs.height, fixedWidth = width !== AUTO && width !== undefined, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxWidth = width - padding * 2, maxHeightPx = height - padding * 2, currentHeightPx = 0, wrap = this.wrap(),
    1455514572          // align = this.align(),
    1455614573          shouldWrap = wrap !== NONE, wrapAtWord = wrap !== CHAR && shouldWrap, shouldAddEllipsis = this.ellipsis();
    1455714574          this.textArr = [];
    1455814575          getDummyContext().font = this._getContextFont();
    14559           var additionalWidth = shouldAddEllipsis ? this._getTextWidth(ELLIPSIS) : 0;
    14560           for (var i = 0, max = lines.length; i < max; ++i) {
    14561               var line = lines[i];
    14562               var lineWidth = this._getTextWidth(line);
     14576          const additionalWidth = shouldAddEllipsis ? this._getTextWidth(ELLIPSIS) : 0;
     14577          for (let i = 0, max = lines.length; i < max; ++i) {
     14578              let line = lines[i];
     14579              let lineWidth = this._getTextWidth(line);
    1456314580              if (fixedWidth && lineWidth > maxWidth) {
    1456414581                  /*
     
    1457114588                       * that would fit in the specified width
    1457214589                       */
    14573                       var low = 0, high = line.length, match = '', matchWidth = 0;
     14590                      let low = 0, high = line.length, match = '', matchWidth = 0;
    1457414591                      while (low < high) {
    14575                           var mid = (low + high) >>> 1, substr = line.slice(0, mid + 1), substrWidth = this._getTextWidth(substr) + additionalWidth;
     14592                          const mid = (low + high) >>> 1, substr = line.slice(0, mid + 1), substrWidth = this._getTextWidth(substr) + additionalWidth;
    1457614593                          if (substrWidth <= maxWidth) {
    1457714594                              low = mid + 1;
     
    1459314610                              // try to find a space or dash where wrapping could be done
    1459414611                              var wrapIndex;
    14595                               var nextChar = line[match.length];
    14596                               var nextIsSpaceOrDash = nextChar === SPACE || nextChar === DASH;
     14612                              const nextChar = line[match.length];
     14613                              const nextIsSpaceOrDash = nextChar === SPACE || nextChar === DASH;
    1459714614                              if (nextIsSpaceOrDash && matchWidth <= maxWidth) {
    1459814615                                  wrapIndex = match.length;
     
    1461614633                          textWidth = Math.max(textWidth, matchWidth);
    1461714634                          currentHeightPx += lineHeightPx;
    14618                           var shouldHandleEllipsis = this._shouldHandleEllipsis(currentHeightPx);
     14635                          const shouldHandleEllipsis = this._shouldHandleEllipsis(currentHeightPx);
    1461914636                          if (shouldHandleEllipsis) {
    1462014637                              this._tryToAddEllipsisToLastLine();
     
    1467714694       */
    1467814695      _shouldHandleEllipsis(currentHeightPx) {
    14679           var fontSize = +this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, height = this.attrs.height, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxHeightPx = height - padding * 2, wrap = this.wrap(), shouldWrap = wrap !== NONE;
     14696          const fontSize = +this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, height = this.attrs.height, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxHeightPx = height - padding * 2, wrap = this.wrap(), shouldWrap = wrap !== NONE;
    1468014697          return (!shouldWrap ||
    1468114698              (fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx));
    1468214699      }
    1468314700      _tryToAddEllipsisToLastLine() {
    14684           var width = this.attrs.width, fixedWidth = width !== AUTO && width !== undefined, padding = this.padding(), maxWidth = width - padding * 2, shouldAddEllipsis = this.ellipsis();
    14685           var lastLine = this.textArr[this.textArr.length - 1];
     14701          const width = this.attrs.width, fixedWidth = width !== AUTO && width !== undefined, padding = this.padding(), maxWidth = width - padding * 2, shouldAddEllipsis = this.ellipsis();
     14702          const lastLine = this.textArr[this.textArr.length - 1];
    1468614703          if (!lastLine || !shouldAddEllipsis) {
    1468714704              return;
    1468814705          }
    1468914706          if (fixedWidth) {
    14690               var haveSpace = this._getTextWidth(lastLine.text + ELLIPSIS) < maxWidth;
     14707              const haveSpace = this._getTextWidth(lastLine.text + ELLIPSIS) < maxWidth;
    1469114708              if (!haveSpace) {
    1469214709                  lastLine.text = lastLine.text.slice(0, lastLine.text.length - 3);
     
    1496214979  Factory.addGetterSetter(Text, 'textDecoration', '');
    1496314980
    14964   var EMPTY_STRING = '', NORMAL = 'normal';
     14981  const EMPTY_STRING = '', NORMAL = 'normal';
    1496514982  function _fillFunc(context) {
    1496614983      context.fillText(this.partialText, 0, 0);
     
    1512415141          context.setAttr('textAlign', 'left');
    1512515142          context.save();
    15126           var textDecoration = this.textDecoration();
    15127           var fill = this.fill();
    15128           var fontSize = this.fontSize();
    15129           var glyphInfo = this.glyphInfo;
     15143          const textDecoration = this.textDecoration();
     15144          const fill = this.fill();
     15145          const fontSize = this.fontSize();
     15146          const glyphInfo = this.glyphInfo;
    1513015147          if (textDecoration === 'underline') {
    1513115148              context.beginPath();
    1513215149          }
    15133           for (var i = 0; i < glyphInfo.length; i++) {
     15150          for (let i = 0; i < glyphInfo.length; i++) {
    1513415151              context.save();
    15135               var p0 = glyphInfo[i].p0;
     15152              const p0 = glyphInfo[i].p0;
    1513615153              context.translate(p0.x, p0.y);
    1513715154              context.rotate(glyphInfo[i].rotation);
     
    1516315180      _hitFunc(context) {
    1516415181          context.beginPath();
    15165           var glyphInfo = this.glyphInfo;
     15182          const glyphInfo = this.glyphInfo;
    1516615183          if (glyphInfo.length >= 1) {
    15167               var p0 = glyphInfo[0].p0;
     15184              const p0 = glyphInfo[0].p0;
    1516815185              context.moveTo(p0.x, p0.y);
    1516915186          }
    15170           for (var i = 0; i < glyphInfo.length; i++) {
    15171               var p1 = glyphInfo[i].p1;
     15187          for (let i = 0; i < glyphInfo.length; i++) {
     15188              const p1 = glyphInfo[i].p1;
    1517215189              context.lineTo(p1.x, p1.y);
    1517315190          }
     
    1519515212      }
    1519615213      _getTextSize(text) {
    15197           var dummyCanvas = this.dummyCanvas;
    15198           var _context = dummyCanvas.getContext('2d');
     15214          const dummyCanvas = this.dummyCanvas;
     15215          const _context = dummyCanvas.getContext('2d');
    1519915216          _context.save();
    1520015217          _context.font = this._getContextFont();
    15201           var metrics = _context.measureText(text);
     15218          const metrics = _context.measureText(text);
    1520215219          _context.restore();
    1520315220          return {
     
    1523315250          // 4. Add glyph width to the offsetToGlyph and repeat
    1523415251          let offsetToGlyph = offset;
    15235           for (var i = 0; i < charArr.length; i++) {
     15252          for (let i = 0; i < charArr.length; i++) {
    1523615253              const charStartPoint = this._getPointAtLength(offsetToGlyph);
    1523715254              if (!charStartPoint)
     
    1528115298              };
    1528215299          }
    15283           var points = [];
     15300          const points = [];
    1528415301          this.glyphInfo.forEach(function (info) {
    1528515302              points.push(info.p0.x);
     
    1528815305              points.push(info.p1.y);
    1528915306          });
    15290           var minX = points[0] || 0;
    15291           var maxX = points[0] || 0;
    15292           var minY = points[1] || 0;
    15293           var maxY = points[1] || 0;
    15294           var x, y;
    15295           for (var i = 0; i < points.length / 2; i++) {
     15307          let minX = points[0] || 0;
     15308          let maxX = points[0] || 0;
     15309          let minY = points[1] || 0;
     15310          let maxY = points[1] || 0;
     15311          let x, y;
     15312          for (let i = 0; i < points.length / 2; i++) {
    1529615313              x = points[i * 2];
    1529715314              y = points[i * 2 + 1];
     
    1530115318              maxY = Math.max(maxY, y);
    1530215319          }
    15303           var fontSize = this.fontSize();
     15320          const fontSize = this.fontSize();
    1530415321          return {
    1530515322              x: minX - fontSize / 2,
     
    1548415501  Factory.addGetterSetter(TextPath, 'kerningFunc', null);
    1548515502
    15486   var EVENTS_NAME = 'tr-konva';
    15487   var ATTR_CHANGE_LIST = [
     15503  const EVENTS_NAME = 'tr-konva';
     15504  const ATTR_CHANGE_LIST = [
    1548815505      'resizeEnabledChange',
    1548915506      'rotateAnchorOffsetChange',
     
    1550415521      .map((e) => e + `.${EVENTS_NAME}`)
    1550515522      .join(' ');
    15506   var NODES_RECT = 'nodesRect';
    15507   var TRANSFORM_CHANGE_STR = [
     15523  const NODES_RECT = 'nodesRect';
     15524  const TRANSFORM_CHANGE_STR = [
    1550815525      'widthChange',
    1550915526      'heightChange',
     
    1551815535      'strokeWidthChange',
    1551915536  ];
    15520   var ANGLES = {
     15537  const ANGLES = {
    1552115538      'top-left': -45,
    1552215539      'top-center': 0,
     
    1553415551      }
    1553515552      rad += Util.degToRad(ANGLES[anchorName] || 0);
    15536       var angle = ((Util.radToDeg(rad) % 360) + 360) % 360;
     15553      const angle = ((Util.radToDeg(rad) % 360) + 360) % 360;
    1553715554      if (Util._inRange(angle, 315 + 22.5, 360) || Util._inRange(angle, 0, 22.5)) {
    1553815555          // TOP
     
    1557315590      }
    1557415591  }
    15575   var ANCHORS_NAMES = [
     15592  const ANCHORS_NAMES = [
    1557615593      'top-left',
    1557715594      'top-center',
     
    1558315600      'bottom-right',
    1558415601  ];
    15585   var MAX_SAFE_INTEGER = 100000000;
     15602  const MAX_SAFE_INTEGER = 100000000;
    1558615603  function getCenter(shape) {
    1558715604      return {
     
    1574515762          // we may need it if we set node in initial props
    1574615763          // so elements are not defined yet
    15747           var elementsCreated = !!this.findOne('.top-left');
     15764          const elementsCreated = !!this.findOne('.top-left');
    1574815765          if (elementsCreated) {
    1574915766              this.update();
     
    1584015857      // return absolute rotated bounding rectangle
    1584115858      __getNodeShape(node, rot = this.rotation(), relative) {
    15842           var rect = node.getClientRect({
     15859          const rect = node.getClientRect({
    1584315860              skipTransform: true,
    1584415861              skipShadow: true,
    1584515862              skipStroke: this.ignoreStroke(),
    1584615863          });
    15847           var absScale = node.getAbsoluteScale(relative);
    15848           var absPos = node.getAbsolutePosition(relative);
    15849           var dx = rect.x * absScale.x - node.offsetX() * absScale.x;
    15850           var dy = rect.y * absScale.y - node.offsetY() * absScale.y;
     15864          const absScale = node.getAbsoluteScale(relative);
     15865          const absPos = node.getAbsolutePosition(relative);
     15866          const dx = rect.x * absScale.x - node.offsetX() * absScale.x;
     15867          const dy = rect.y * absScale.y - node.offsetY() * absScale.y;
    1585115868          const rotation = (Konva$2.getAngle(node.getAbsoluteRotation()) + Math.PI * 2) %
    1585215869              (Math.PI * 2);
     
    1586515882      // returns box + rotation of all shapes
    1586615883      __getNodeRect() {
    15867           var node = this.getNode();
     15884          const node = this.getNode();
    1586815885          if (!node) {
    1586915886              return {
     
    1588215899                  skipStroke: this.ignoreStroke(),
    1588315900              });
    15884               var points = [
     15901              const points = [
    1588515902                  { x: box.x, y: box.y },
    1588615903                  { x: box.x + box.width, y: box.y },
     
    1588815905                  { x: box.x, y: box.y + box.height },
    1588915906              ];
    15890               var trans = node.getAbsoluteTransform();
     15907              const trans = node.getAbsoluteTransform();
    1589115908              points.forEach(function (point) {
    15892                   var transformed = trans.point(point);
     15909                  const transformed = trans.point(point);
    1589315910                  totalPoints.push(transformed);
    1589415911              });
     
    1589615913          const tr = new Transform();
    1589715914          tr.rotate(-Konva$2.getAngle(this.rotation()));
    15898           var minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
     15915          let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
    1589915916          totalPoints.forEach(function (point) {
    15900               var transformed = tr.point(point);
     15917              const transformed = tr.point(point);
    1590115918              if (minX === undefined) {
    1590215919                  minX = maxX = transformed.x;
     
    1594615963      }
    1594715964      _createAnchor(name) {
    15948           var anchor = new Rect({
     15965          const anchor = new Rect({
    1594915966              stroke: 'rgb(0, 161, 255)',
    1595015967              fill: 'white',
     
    1595715974              hitStrokeWidth: TOUCH_DEVICE ? 10 : 'auto',
    1595815975          });
    15959           var self = this;
     15976          const self = this;
    1596015977          anchor.on('mousedown touchstart', function (e) {
    1596115978              self._handleMouseDown(e);
     
    1597015987          // add hover styling
    1597115988          anchor.on('mouseenter', () => {
    15972               var rad = Konva$2.getAngle(this.rotation());
    15973               var rotateCursor = this.rotateAnchorCursor();
    15974               var cursor = getCursor(name, rad, rotateCursor);
     15989              const rad = Konva$2.getAngle(this.rotation());
     15990              const rotateCursor = this.rotateAnchorCursor();
     15991              const cursor = getCursor(name, rad, rotateCursor);
    1597515992              anchor.getStage().content &&
    1597615993                  (anchor.getStage().content.style.cursor = cursor);
     
    1598516002      }
    1598616003      _createBack() {
    15987           var back = new Shape({
     16004          const back = new Shape({
    1598816005              name: 'back',
    1598916006              width: 0,
     
    1599116008              draggable: true,
    1599216009              sceneFunc(ctx, shape) {
    15993                   var tr = shape.getParent();
    15994                   var padding = tr.padding();
     16010                  const tr = shape.getParent();
     16011                  const padding = tr.padding();
    1599516012                  ctx.beginPath();
    1599616013                  ctx.rect(-padding, -padding, shape.width() + padding * 2, shape.height() + padding * 2);
     
    1600516022                      return;
    1600616023                  }
    16007                   var padding = this.padding();
     16024                  const padding = this.padding();
    1600816025                  ctx.beginPath();
    1600916026                  ctx.rect(-padding, -padding, shape.width() + padding * 2, shape.height() + padding * 2);
     
    1603716054          }
    1603816055          this._movingAnchorName = e.target.name().split(' ')[0];
    16039           var attrs = this._getNodeRect();
    16040           var width = attrs.width;
    16041           var height = attrs.height;
    16042           var hypotenuse = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
     16056          const attrs = this._getNodeRect();
     16057          const width = attrs.width;
     16058          const height = attrs.height;
     16059          const hypotenuse = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
    1604316060          this.sin = Math.abs(height / hypotenuse);
    1604416061          this.cos = Math.abs(width / hypotenuse);
     
    1605016067          }
    1605116068          this._transforming = true;
    16052           var ap = e.target.getAbsolutePosition();
    16053           var pos = e.target.getStage().getPointerPosition();
     16069          const ap = e.target.getAbsolutePosition();
     16070          const pos = e.target.getStage().getPointerPosition();
    1605416071          this._anchorDragOffset = {
    1605516072              x: pos.x - ap.x,
     
    1606316080      }
    1606416081      _handleMouseMove(e) {
    16065           var x, y, newHypotenuse;
    16066           var anchorNode = this.findOne('.' + this._movingAnchorName);
    16067           var stage = anchorNode.getStage();
     16082          let x, y, newHypotenuse;
     16083          const anchorNode = this.findOne('.' + this._movingAnchorName);
     16084          const stage = anchorNode.getStage();
    1606816085          stage.setPointersPositions(e);
    1606916086          const pp = stage.getPointerPosition();
     
    1608416101          // rotater is working very differently, so do it first
    1608516102          if (this._movingAnchorName === 'rotater') {
    16086               var attrs = this._getNodeRect();
     16103              const attrs = this._getNodeRect();
    1608716104              x = anchorNode.x() - attrs.width / 2;
    1608816105              y = -anchorNode.y() + attrs.height / 2;
     
    1609216109                  delta -= Math.PI;
    1609316110              }
    16094               var oldRotation = Konva$2.getAngle(this.rotation());
     16111              const oldRotation = Konva$2.getAngle(this.rotation());
    1609516112              const newRotation = oldRotation + delta;
    1609616113              const tol = Konva$2.getAngle(this.rotationSnapTolerance());
     
    1610116118              return;
    1610216119          }
    16103           var shiftBehavior = this.shiftBehavior();
    16104           var keepProportion;
     16120          const shiftBehavior = this.shiftBehavior();
     16121          let keepProportion;
    1610516122          if (shiftBehavior === 'inverted') {
    1610616123              keepProportion = this.keepRatio() && !e.shiftKey;
     
    1622116238          var centeredScaling = this.centeredScaling() || e.altKey;
    1622216239          if (centeredScaling) {
    16223               var topLeft = this.findOne('.top-left');
    16224               var bottomRight = this.findOne('.bottom-right');
    16225               var topOffsetX = topLeft.x();
    16226               var topOffsetY = topLeft.y();
    16227               var bottomOffsetX = this.getWidth() - bottomRight.x();
    16228               var bottomOffsetY = this.getHeight() - bottomRight.y();
     16240              const topLeft = this.findOne('.top-left');
     16241              const bottomRight = this.findOne('.bottom-right');
     16242              const topOffsetX = topLeft.x();
     16243              const topOffsetY = topLeft.y();
     16244              const bottomOffsetX = this.getWidth() - bottomRight.x();
     16245              const bottomOffsetY = this.getHeight() - bottomRight.y();
    1622916246              bottomRight.move({
    1623016247                  x: -topOffsetX,
     
    1623616253              });
    1623716254          }
    16238           var absPos = this.findOne('.top-left').getAbsolutePosition();
     16255          const absPos = this.findOne('.top-left').getAbsolutePosition();
    1623916256          x = absPos.x;
    1624016257          y = absPos.y;
    16241           var width = this.findOne('.bottom-right').x() - this.findOne('.top-left').x();
    16242           var height = this.findOne('.bottom-right').y() - this.findOne('.top-left').y();
     16258          const width = this.findOne('.bottom-right').x() - this.findOne('.top-left').x();
     16259          const height = this.findOne('.bottom-right').y() - this.findOne('.top-left').y();
    1624316260          this._fitNodesInto({
    1624416261              x: x,
     
    1626516282                  window.removeEventListener('touchend', this._handleMouseUp, true);
    1626616283              }
    16267               var node = this.getNode();
     16284              const node = this.getNode();
    1626816285              activeTransformersCount--;
    1626916286              this._fire('transformend', { evt: e, target: node });
     
    1628216299      }
    1628316300      _fitNodesInto(newAttrs, evt) {
    16284           var oldAttrs = this._getNodeRect();
     16301          const oldAttrs = this._getNodeRect();
    1628516302          const minSize = 1;
    1628616303          if (Util._inRange(newAttrs.width, -this.padding() * 2 - minSize, minSize)) {
     
    1629216309              return;
    1629316310          }
    16294           var t = new Transform();
     16311          const t = new Transform();
    1629516312          t.rotate(Konva$2.getAngle(this.rotation()));
    1629616313          if (this._movingAnchorName &&
     
    1643216449      update() {
    1643316450          var _a;
    16434           var attrs = this._getNodeRect();
     16451          const attrs = this._getNodeRect();
    1643516452          this.rotation(Util._getRotation(attrs.rotation));
    16436           var width = attrs.width;
    16437           var height = attrs.height;
    16438           var enabledAnchors = this.enabledAnchors();
    16439           var resizeEnabled = this.resizeEnabled();
    16440           var padding = this.padding();
    16441           var anchorSize = this.anchorSize();
     16453          const width = attrs.width;
     16454          const height = attrs.height;
     16455          const enabledAnchors = this.enabledAnchors();
     16456          const resizeEnabled = this.resizeEnabled();
     16457          const padding = this.padding();
     16458          const anchorSize = this.anchorSize();
    1644216459          const anchors = this.find('._anchor');
    1644316460          anchors.forEach((node) => {
     
    1654616563          if (this._transforming) {
    1654716564              this._removeEvents();
    16548               var anchorNode = this.findOne('.' + this._movingAnchorName);
     16565              const anchorNode = this.findOne('.' + this._movingAnchorName);
    1654916566              if (anchorNode) {
    1655016567                  anchorNode.stopDrag();
     
    1656816585      // overwrite clone to NOT use method from Container
    1656916586      clone(obj) {
    16570           var node = Node.prototype.clone.call(this, obj);
     16587          const node = Node.prototype.clone.call(this, obj);
    1657116588          return node;
    1657216589      }
     
    1726617283      this.next = null;
    1726717284  }
    17268   var mul_table = [
     17285  const mul_table = [
    1726917286      512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292,
    1727017287      512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292,
     
    1728517302      289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259,
    1728617303  ];
    17287   var shg_table = [
     17304  const shg_table = [
    1728817305      9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17,
    1728917306      17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19,
     
    1730217319  ];
    1730317320  function filterGaussBlurRGBA(imageData, radius) {
    17304       var pixels = imageData.data, width = imageData.width, height = imageData.height;
    17305       var x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum, a_sum, r_out_sum, g_out_sum, b_out_sum, a_out_sum, r_in_sum, g_in_sum, b_in_sum, a_in_sum, pr, pg, pb, pa, rbs;
    17306       var div = radius + radius + 1, widthMinus1 = width - 1, heightMinus1 = height - 1, radiusPlus1 = radius + 1, sumFactor = (radiusPlus1 * (radiusPlus1 + 1)) / 2, stackStart = new BlurStack(), stackEnd = null, stack = stackStart, stackIn = null, stackOut = null, mul_sum = mul_table[radius], shg_sum = shg_table[radius];
     17321      const pixels = imageData.data, width = imageData.width, height = imageData.height;
     17322      let x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum, a_sum, r_out_sum, g_out_sum, b_out_sum, a_out_sum, r_in_sum, g_in_sum, b_in_sum, a_in_sum, pr, pg, pb, pa, rbs;
     17323      let div = radius + radius + 1, widthMinus1 = width - 1, heightMinus1 = height - 1, radiusPlus1 = radius + 1, sumFactor = (radiusPlus1 * (radiusPlus1 + 1)) / 2, stackStart = new BlurStack(), stackEnd = null, stack = stackStart, stackIn = null, stackOut = null, mul_sum = mul_table[radius], shg_sum = shg_table[radius];
    1730717324      for (i = 1; i < div; i++) {
    1730817325          stack = stack.next = new BlurStack();
     
    1749517512   */
    1749617513  const Blur = function Blur(imageData) {
    17497       var radius = Math.round(this.blurRadius());
     17514      const radius = Math.round(this.blurRadius());
    1749817515      if (radius > 0) {
    1749917516          filterGaussBlurRGBA(imageData, radius);
     
    1752017537   */
    1752117538  const Brighten = function (imageData) {
    17522       var brightness = this.brightness() * 255, data = imageData.data, len = data.length, i;
     17539      let brightness = this.brightness() * 255, data = imageData.data, len = data.length, i;
    1752317540      for (i = 0; i < len; i += 4) {
    1752417541          // red
     
    1755217569   */
    1755317570  const Contrast = function (imageData) {
    17554       var adjust = Math.pow((this.contrast() + 100) / 100, 2);
    17555       var data = imageData.data, nPixels = data.length, red = 150, green = 150, blue = 150, i;
     17571      const adjust = Math.pow((this.contrast() + 100) / 100, 2);
     17572      let data = imageData.data, nPixels = data.length, red = 150, green = 150, blue = 150, i;
    1755617573      for (i = 0; i < nPixels; i += 4) {
    1755717574          red = data[i];
     
    1761517632      // a max value of greyLevel yields a white emboss, and the min value yields a black
    1761617633      // emboss.  Therefore, I changed greyLevel to whiteLevel
    17617       var strength = this.embossStrength() * 10, greyLevel = this.embossWhiteLevel() * 255, direction = this.embossDirection(), blend = this.embossBlend(), dirY = 0, dirX = 0, data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4, y = h;
     17634      let strength = this.embossStrength() * 10, greyLevel = this.embossWhiteLevel() * 255, direction = this.embossDirection(), blend = this.embossBlend(), dirY = 0, dirX = 0, data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4, y = h;
    1761817635      switch (direction) {
    1761917636          case 'top-left':
     
    1765317670      }
    1765417671      do {
    17655           var offsetY = (y - 1) * w4;
    17656           var otherY = dirY;
     17672          const offsetY = (y - 1) * w4;
     17673          let otherY = dirY;
    1765717674          if (y + otherY < 1) {
    1765817675              otherY = 0;
     
    1766117678              otherY = 0;
    1766217679          }
    17663           var offsetYOther = (y - 1 + otherY) * w * 4;
    17664           var x = w;
     17680          const offsetYOther = (y - 1 + otherY) * w * 4;
     17681          let x = w;
    1766517682          do {
    17666               var offset = offsetY + (x - 1) * 4;
    17667               var otherX = dirX;
     17683              const offset = offsetY + (x - 1) * 4;
     17684              let otherX = dirX;
    1766817685              if (x + otherX < 1) {
    1766917686                  otherX = 0;
     
    1767217689                  otherX = 0;
    1767317690              }
    17674               var offsetOther = offsetYOther + (x - 1 + otherX) * 4;
    17675               var dR = data[offset] - data[offsetOther];
    17676               var dG = data[offset + 1] - data[offsetOther + 1];
    17677               var dB = data[offset + 2] - data[offsetOther + 2];
    17678               var dif = dR;
    17679               var absDif = dif > 0 ? dif : -dif;
    17680               var absG = dG > 0 ? dG : -dG;
    17681               var absB = dB > 0 ? dB : -dB;
     17691              const offsetOther = offsetYOther + (x - 1 + otherX) * 4;
     17692              const dR = data[offset] - data[offsetOther];
     17693              const dG = data[offset + 1] - data[offsetOther + 1];
     17694              const dB = data[offset + 2] - data[offsetOther + 2];
     17695              let dif = dR;
     17696              const absDif = dif > 0 ? dif : -dif;
     17697              const absG = dG > 0 ? dG : -dG;
     17698              const absB = dB > 0 ? dB : -dB;
    1768217699              if (absG > absDif) {
    1768317700                  dif = dG;
     
    1768817705              dif *= strength;
    1768917706              if (blend) {
    17690                   var r = data[offset] + dif;
    17691                   var g = data[offset + 1] + dif;
    17692                   var b = data[offset + 2] + dif;
     17707                  const r = data[offset] + dif;
     17708                  const g = data[offset + 1] + dif;
     17709                  const b = data[offset + 2] + dif;
    1769317710                  data[offset] = r > 255 ? 255 : r < 0 ? 0 : r;
    1769417711                  data[offset + 1] = g > 255 ? 255 : g < 0 ? 0 : g;
     
    1769617713              }
    1769717714              else {
    17698                   var grey = greyLevel - dif;
     17715                  let grey = greyLevel - dif;
    1769917716                  if (grey < 0) {
    1770017717                      grey = 0;
     
    1774417761  function remap(fromValue, fromMin, fromMax, toMin, toMax) {
    1774517762      // Compute the range of the data
    17746       var fromRange = fromMax - fromMin, toRange = toMax - toMin, toValue;
     17763      let fromRange = fromMax - fromMin, toRange = toMax - toMin, toValue;
    1774717764      // If either range is 0, then the value can only be mapped to 1 value
    1774817765      if (fromRange === 0) {
     
    1777217789   */
    1777317790  const Enhance = function (imageData) {
    17774       var data = imageData.data, nSubPixels = data.length, rMin = data[0], rMax = rMin, r, gMin = data[1], gMax = gMin, g, bMin = data[2], bMax = bMin, b, i;
     17791      let data = imageData.data, nSubPixels = data.length, rMin = data[0], rMax = rMin, r, gMin = data[1], gMax = gMin, g, bMin = data[2], bMax = bMin, b, i;
    1777517792      // If we are not enhancing anything - don't do any computation
    17776       var enhanceAmount = this.enhance();
     17793      const enhanceAmount = this.enhance();
    1777717794      if (enhanceAmount === 0) {
    1777817795          return;
     
    1781817835          bMin = 0;
    1781917836      }
    17820       var rMid, rGoalMax, rGoalMin, gMid, gGoalMax, gGoalMin, bMid, bGoalMax, bGoalMin;
     17837      let rMid, rGoalMax, rGoalMin, gMid, gGoalMax, gGoalMin, bMid, bGoalMax, bGoalMin;
    1782117838      // If the enhancement is positive - stretch the histogram
    1782217839      if (enhanceAmount > 0) {
     
    1786717884   */
    1786817885  const Grayscale = function (imageData) {
    17869       var data = imageData.data, len = data.length, i, brightness;
     17886      let data = imageData.data, len = data.length, i, brightness;
    1787017887      for (i = 0; i < len; i += 4) {
    1787117888          brightness = 0.34 * data[i] + 0.5 * data[i + 1] + 0.16 * data[i + 2];
     
    1791417931   */
    1791517932  const HSL = function (imageData) {
    17916       var data = imageData.data, nPixels = data.length, v = 1, s = Math.pow(2, this.saturation()), h = Math.abs(this.hue() + 360) % 360, l = this.luminance() * 127, i;
     17933      let data = imageData.data, nPixels = data.length, v = 1, s = Math.pow(2, this.saturation()), h = Math.abs(this.hue() + 360) % 360, l = this.luminance() * 127, i;
    1791717934      // Basis for the technique used:
    1791817935      // http://beesbuzz.biz/code/hsv_color_transforms.php
     
    1792617943      //[ .299V-.300vsu+1.25vsw    .587V-.588vsu-1.05vsw    .114V+.886vsu-.203vsw ] [B]
    1792717944      // Precompute the values in the matrix:
    17928       var vsu = v * s * Math.cos((h * Math.PI) / 180), vsw = v * s * Math.sin((h * Math.PI) / 180);
     17945      const vsu = v * s * Math.cos((h * Math.PI) / 180), vsw = v * s * Math.sin((h * Math.PI) / 180);
    1792917946      // (result spot)(source spot)
    17930       var rr = 0.299 * v + 0.701 * vsu + 0.167 * vsw, rg = 0.587 * v - 0.587 * vsu + 0.33 * vsw, rb = 0.114 * v - 0.114 * vsu - 0.497 * vsw;
    17931       var gr = 0.299 * v - 0.299 * vsu - 0.328 * vsw, gg = 0.587 * v + 0.413 * vsu + 0.035 * vsw, gb = 0.114 * v - 0.114 * vsu + 0.293 * vsw;
    17932       var br = 0.299 * v - 0.3 * vsu + 1.25 * vsw, bg = 0.587 * v - 0.586 * vsu - 1.05 * vsw, bb = 0.114 * v + 0.886 * vsu - 0.2 * vsw;
    17933       var r, g, b, a;
     17947      const rr = 0.299 * v + 0.701 * vsu + 0.167 * vsw, rg = 0.587 * v - 0.587 * vsu + 0.33 * vsw, rb = 0.114 * v - 0.114 * vsu - 0.497 * vsw;
     17948      const gr = 0.299 * v - 0.299 * vsu - 0.328 * vsw, gg = 0.587 * v + 0.413 * vsu + 0.035 * vsw, gb = 0.114 * v - 0.114 * vsu + 0.293 * vsw;
     17949      const br = 0.299 * v - 0.3 * vsu + 1.25 * vsw, bg = 0.587 * v - 0.586 * vsu - 1.05 * vsw, bb = 0.114 * v + 0.886 * vsu - 0.2 * vsw;
     17950      let r, g, b, a;
    1793417951      for (i = 0; i < nPixels; i += 4) {
    1793517952          r = data[i + 0];
     
    1795617973   */
    1795717974  const HSV = function (imageData) {
    17958       var data = imageData.data, nPixels = data.length, v = Math.pow(2, this.value()), s = Math.pow(2, this.saturation()), h = Math.abs(this.hue() + 360) % 360, i;
     17975      const data = imageData.data, nPixels = data.length, v = Math.pow(2, this.value()), s = Math.pow(2, this.saturation()), h = Math.abs(this.hue() + 360) % 360;
    1795917976      // Basis for the technique used:
    1796017977      // http://beesbuzz.biz/code/hsv_color_transforms.php
     
    1796817985      //[ .299V-.300vsu+1.25vsw    .587V-.588vsu-1.05vsw    .114V+.886vsu-.203vsw ] [B]
    1796917986      // Precompute the values in the matrix:
    17970       var vsu = v * s * Math.cos((h * Math.PI) / 180), vsw = v * s * Math.sin((h * Math.PI) / 180);
     17987      const vsu = v * s * Math.cos((h * Math.PI) / 180), vsw = v * s * Math.sin((h * Math.PI) / 180);
    1797117988      // (result spot)(source spot)
    17972       var rr = 0.299 * v + 0.701 * vsu + 0.167 * vsw, rg = 0.587 * v - 0.587 * vsu + 0.33 * vsw, rb = 0.114 * v - 0.114 * vsu - 0.497 * vsw;
    17973       var gr = 0.299 * v - 0.299 * vsu - 0.328 * vsw, gg = 0.587 * v + 0.413 * vsu + 0.035 * vsw, gb = 0.114 * v - 0.114 * vsu + 0.293 * vsw;
    17974       var br = 0.299 * v - 0.3 * vsu + 1.25 * vsw, bg = 0.587 * v - 0.586 * vsu - 1.05 * vsw, bb = 0.114 * v + 0.886 * vsu - 0.2 * vsw;
    17975       var r, g, b, a;
    17976       for (i = 0; i < nPixels; i += 4) {
     17989      const rr = 0.299 * v + 0.701 * vsu + 0.167 * vsw, rg = 0.587 * v - 0.587 * vsu + 0.33 * vsw, rb = 0.114 * v - 0.114 * vsu - 0.497 * vsw;
     17990      const gr = 0.299 * v - 0.299 * vsu - 0.328 * vsw, gg = 0.587 * v + 0.413 * vsu + 0.035 * vsw, gb = 0.114 * v - 0.114 * vsu + 0.293 * vsw;
     17991      const br = 0.299 * v - 0.3 * vsu + 1.25 * vsw, bg = 0.587 * v - 0.586 * vsu - 1.05 * vsw, bb = 0.114 * v + 0.886 * vsu - 0.2 * vsw;
     17992      let r, g, b, a;
     17993      for (let i = 0; i < nPixels; i += 4) {
    1797717994          r = data[i + 0];
    1797817995          g = data[i + 1];
     
    1802018037   */
    1802118038  const Invert = function (imageData) {
    18022       var data = imageData.data, len = data.length, i;
     18039      let data = imageData.data, len = data.length, i;
    1802318040      for (i = 0; i < len; i += 4) {
    1802418041          // red
     
    1804618063   *  default is in the middle
    1804718064   */
    18048   var ToPolar = function (src, dst, opt) {
    18049       var srcPixels = src.data, dstPixels = dst.data, xSize = src.width, ySize = src.height, xMid = opt.polarCenterX || xSize / 2, yMid = opt.polarCenterY || ySize / 2, i, x, y, r = 0, g = 0, b = 0, a = 0;
     18065  const ToPolar = function (src, dst, opt) {
     18066      let srcPixels = src.data, dstPixels = dst.data, xSize = src.width, ySize = src.height, xMid = opt.polarCenterX || xSize / 2, yMid = opt.polarCenterY || ySize / 2, i, x, y, r = 0, g = 0, b = 0, a = 0;
    1805018067      // Find the largest radius
    18051       var rad, rMax = Math.sqrt(xMid * xMid + yMid * yMid);
     18068      let rad, rMax = Math.sqrt(xMid * xMid + yMid * yMid);
    1805218069      x = xSize - xMid;
    1805318070      y = ySize - yMid;
     
    1805518072      rMax = rad > rMax ? rad : rMax;
    1805618073      // We'll be uisng y as the radius, and x as the angle (theta=t)
    18057       var rSize = ySize, tSize = xSize, radius, theta;
     18074      let rSize = ySize, tSize = xSize, radius, theta;
    1805818075      // We want to cover all angles (0-360) and we need to convert to
    1805918076      // radians (*PI/180)
    18060       var conversion = ((360 / tSize) * Math.PI) / 180, sin, cos;
     18077      let conversion = ((360 / tSize) * Math.PI) / 180, sin, cos;
    1806118078      // var x1, x2, x1i, x2i, y1, y2, y1i, y2i, scale;
    1806218079      for (theta = 0; theta < tSize; theta += 1) {
     
    1809718114   *  0 is no rotation, 360 degrees is a full rotation
    1809818115   */
    18099   var FromPolar = function (src, dst, opt) {
    18100       var srcPixels = src.data, dstPixels = dst.data, xSize = src.width, ySize = src.height, xMid = opt.polarCenterX || xSize / 2, yMid = opt.polarCenterY || ySize / 2, i, x, y, dx, dy, r = 0, g = 0, b = 0, a = 0;
     18116  const FromPolar = function (src, dst, opt) {
     18117      let srcPixels = src.data, dstPixels = dst.data, xSize = src.width, ySize = src.height, xMid = opt.polarCenterX || xSize / 2, yMid = opt.polarCenterY || ySize / 2, i, x, y, dx, dy, r = 0, g = 0, b = 0, a = 0;
    1810118118      // Find the largest radius
    18102       var rad, rMax = Math.sqrt(xMid * xMid + yMid * yMid);
     18119      let rad, rMax = Math.sqrt(xMid * xMid + yMid * yMid);
    1810318120      x = xSize - xMid;
    1810418121      y = ySize - yMid;
     
    1810618123      rMax = rad > rMax ? rad : rMax;
    1810718124      // We'll be uisng x as the radius, and y as the angle (theta=t)
    18108       var rSize = ySize, tSize = xSize, radius, theta, phaseShift = 0;
     18125      let rSize = ySize, tSize = xSize, radius, theta, phaseShift = 0;
    1810918126      // We need to convert to degrees and we need to make sure
    1811018127      // it's between (0-360)
    1811118128      // var conversion = tSize/360*180/Math.PI;
    1811218129      //var conversion = tSize/360*180/Math.PI;
    18113       var x1, y1;
     18130      let x1, y1;
    1811418131      for (x = 0; x < xSize; x += 1) {
    1811518132          for (y = 0; y < ySize; y += 1) {
     
    1815118168   */
    1815218169  const Kaleidoscope = function (imageData) {
    18153       var xSize = imageData.width, ySize = imageData.height;
    18154       var x, y, xoff, i, r, g, b, a, srcPos, dstPos;
    18155       var power = Math.round(this.kaleidoscopePower());
    18156       var angle = Math.round(this.kaleidoscopeAngle());
    18157       var offset = Math.floor((xSize * (angle % 360)) / 360);
     18170      const xSize = imageData.width, ySize = imageData.height;
     18171      let x, y, xoff, i, r, g, b, a, srcPos, dstPos;
     18172      let power = Math.round(this.kaleidoscopePower());
     18173      const angle = Math.round(this.kaleidoscopeAngle());
     18174      const offset = Math.floor((xSize * (angle % 360)) / 360);
    1815818175      if (power < 1) {
    1815918176          return;
    1816018177      }
    1816118178      // Work with our shared buffer canvas
    18162       var tempCanvas = Util.createCanvasElement();
     18179      const tempCanvas = Util.createCanvasElement();
    1816318180      tempCanvas.width = xSize;
    1816418181      tempCanvas.height = ySize;
    18165       var scratchData = tempCanvas
     18182      const scratchData = tempCanvas
    1816618183          .getContext('2d')
    1816718184          .getImageData(0, 0, xSize, ySize);
     
    1817418191      // Determine how big each section will be, if it's too small
    1817518192      // make it bigger
    18176       var minSectionSize = xSize / Math.pow(2, power);
     18193      let minSectionSize = xSize / Math.pow(2, power);
    1817718194      while (minSectionSize <= 8) {
    1817818195          minSectionSize = minSectionSize * 2;
     
    1818018197      }
    1818118198      minSectionSize = Math.ceil(minSectionSize);
    18182       var sectionSize = minSectionSize;
     18199      let sectionSize = minSectionSize;
    1818318200      // Copy the offset region to 0
    1818418201      // Depending on the size of filter and location of the offset we may need
    1818518202      // to copy the section backwards to prevent it from rewriting itself
    18186       var xStart = 0, xEnd = sectionSize, xDelta = 1;
     18203      let xStart = 0, xEnd = sectionSize, xDelta = 1;
    1818718204      if (offset + minSectionSize > xSize) {
    1818818205          xStart = sectionSize;
     
    1824518262
    1824618263  function pixelAt(idata, x, y) {
    18247       var idx = (y * idata.width + x) * 4;
    18248       var d = [];
     18264      let idx = (y * idata.width + x) * 4;
     18265      const d = [];
    1824918266      d.push(idata.data[idx++], idata.data[idx++], idata.data[idx++], idata.data[idx++]);
    1825018267      return d;
     
    1825618273  }
    1825718274  function rgbMean(pTab) {
    18258       var m = [0, 0, 0];
    18259       for (var i = 0; i < pTab.length; i++) {
     18275      const m = [0, 0, 0];
     18276      for (let i = 0; i < pTab.length; i++) {
    1826018277          m[0] += pTab[i][0];
    1826118278          m[1] += pTab[i][1];
     
    1826818285  }
    1826918286  function backgroundMask(idata, threshold) {
    18270       var rgbv_no = pixelAt(idata, 0, 0);
    18271       var rgbv_ne = pixelAt(idata, idata.width - 1, 0);
    18272       var rgbv_so = pixelAt(idata, 0, idata.height - 1);
    18273       var rgbv_se = pixelAt(idata, idata.width - 1, idata.height - 1);
    18274       var thres = threshold || 10;
     18287      const rgbv_no = pixelAt(idata, 0, 0);
     18288      const rgbv_ne = pixelAt(idata, idata.width - 1, 0);
     18289      const rgbv_so = pixelAt(idata, 0, idata.height - 1);
     18290      const rgbv_se = pixelAt(idata, idata.width - 1, idata.height - 1);
     18291      const thres = threshold || 10;
    1827518292      if (rgbDistance(rgbv_no, rgbv_ne) < thres &&
    1827618293          rgbDistance(rgbv_ne, rgbv_se) < thres &&
     
    1827818295          rgbDistance(rgbv_so, rgbv_no) < thres) {
    1827918296          // Mean color
    18280           var mean = rgbMean([rgbv_ne, rgbv_no, rgbv_se, rgbv_so]);
     18297          const mean = rgbMean([rgbv_ne, rgbv_no, rgbv_se, rgbv_so]);
    1828118298          // Mask based on color distance
    18282           var mask = [];
    18283           for (var i = 0; i < idata.width * idata.height; i++) {
    18284               var d = rgbDistance(mean, [
     18299          const mask = [];
     18300          for (let i = 0; i < idata.width * idata.height; i++) {
     18301              const d = rgbDistance(mean, [
    1828518302                  idata.data[i * 4],
    1828618303                  idata.data[i * 4 + 1],
     
    1829318310  }
    1829418311  function applyMask(idata, mask) {
    18295       for (var i = 0; i < idata.width * idata.height; i++) {
     18312      for (let i = 0; i < idata.width * idata.height; i++) {
    1829618313          idata.data[4 * i + 3] = mask[i];
    1829718314      }
    1829818315  }
    1829918316  function erodeMask(mask, sw, sh) {
    18300       var weights = [1, 1, 1, 1, 0, 1, 1, 1, 1];
    18301       var side = Math.round(Math.sqrt(weights.length));
    18302       var halfSide = Math.floor(side / 2);
    18303       var maskResult = [];
    18304       for (var y = 0; y < sh; y++) {
    18305           for (var x = 0; x < sw; x++) {
    18306               var so = y * sw + x;
    18307               var a = 0;
    18308               for (var cy = 0; cy < side; cy++) {
    18309                   for (var cx = 0; cx < side; cx++) {
    18310                       var scy = y + cy - halfSide;
    18311                       var scx = x + cx - halfSide;
     18317      const weights = [1, 1, 1, 1, 0, 1, 1, 1, 1];
     18318      const side = Math.round(Math.sqrt(weights.length));
     18319      const halfSide = Math.floor(side / 2);
     18320      const maskResult = [];
     18321      for (let y = 0; y < sh; y++) {
     18322          for (let x = 0; x < sw; x++) {
     18323              const so = y * sw + x;
     18324              let a = 0;
     18325              for (let cy = 0; cy < side; cy++) {
     18326                  for (let cx = 0; cx < side; cx++) {
     18327                      const scy = y + cy - halfSide;
     18328                      const scx = x + cx - halfSide;
    1831218329                      if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) {
    18313                           var srcOff = scy * sw + scx;
    18314                           var wt = weights[cy * side + cx];
     18330                          const srcOff = scy * sw + scx;
     18331                          const wt = weights[cy * side + cx];
    1831518332                          a += mask[srcOff] * wt;
    1831618333                      }
     
    1832318340  }
    1832418341  function dilateMask(mask, sw, sh) {
    18325       var weights = [1, 1, 1, 1, 1, 1, 1, 1, 1];
    18326       var side = Math.round(Math.sqrt(weights.length));
    18327       var halfSide = Math.floor(side / 2);
    18328       var maskResult = [];
    18329       for (var y = 0; y < sh; y++) {
    18330           for (var x = 0; x < sw; x++) {
    18331               var so = y * sw + x;
    18332               var a = 0;
    18333               for (var cy = 0; cy < side; cy++) {
    18334                   for (var cx = 0; cx < side; cx++) {
    18335                       var scy = y + cy - halfSide;
    18336                       var scx = x + cx - halfSide;
     18342      const weights = [1, 1, 1, 1, 1, 1, 1, 1, 1];
     18343      const side = Math.round(Math.sqrt(weights.length));
     18344      const halfSide = Math.floor(side / 2);
     18345      const maskResult = [];
     18346      for (let y = 0; y < sh; y++) {
     18347          for (let x = 0; x < sw; x++) {
     18348              const so = y * sw + x;
     18349              let a = 0;
     18350              for (let cy = 0; cy < side; cy++) {
     18351                  for (let cx = 0; cx < side; cx++) {
     18352                      const scy = y + cy - halfSide;
     18353                      const scx = x + cx - halfSide;
    1833718354                      if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) {
    18338                           var srcOff = scy * sw + scx;
    18339                           var wt = weights[cy * side + cx];
     18355                          const srcOff = scy * sw + scx;
     18356                          const wt = weights[cy * side + cx];
    1834018357                          a += mask[srcOff] * wt;
    1834118358                      }
     
    1834818365  }
    1834918366  function smoothEdgeMask(mask, sw, sh) {
    18350       var weights = [1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9];
    18351       var side = Math.round(Math.sqrt(weights.length));
    18352       var halfSide = Math.floor(side / 2);
    18353       var maskResult = [];
    18354       for (var y = 0; y < sh; y++) {
    18355           for (var x = 0; x < sw; x++) {
    18356               var so = y * sw + x;
    18357               var a = 0;
    18358               for (var cy = 0; cy < side; cy++) {
    18359                   for (var cx = 0; cx < side; cx++) {
    18360                       var scy = y + cy - halfSide;
    18361                       var scx = x + cx - halfSide;
     18367      const weights = [1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9];
     18368      const side = Math.round(Math.sqrt(weights.length));
     18369      const halfSide = Math.floor(side / 2);
     18370      const maskResult = [];
     18371      for (let y = 0; y < sh; y++) {
     18372          for (let x = 0; x < sw; x++) {
     18373              const so = y * sw + x;
     18374              let a = 0;
     18375              for (let cy = 0; cy < side; cy++) {
     18376                  for (let cx = 0; cx < side; cx++) {
     18377                      const scy = y + cy - halfSide;
     18378                      const scx = x + cx - halfSide;
    1836218379                      if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) {
    18363                           var srcOff = scy * sw + scx;
    18364                           var wt = weights[cy * side + cx];
     18380                          const srcOff = scy * sw + scx;
     18381                          const wt = weights[cy * side + cx];
    1836518382                          a += mask[srcOff] * wt;
    1836618383                      }
     
    1838518402  const Mask = function (imageData) {
    1838618403      // Detect pixels close to the background color
    18387       var threshold = this.threshold(), mask = backgroundMask(imageData, threshold);
     18404      let threshold = this.threshold(), mask = backgroundMask(imageData, threshold);
    1838818405      if (mask) {
    1838918406          // Erode
     
    1841318430   */
    1841418431  const Noise = function (imageData) {
    18415       var amount = this.noise() * 255, data = imageData.data, nPixels = data.length, half = amount / 2, i;
    18416       for (i = 0; i < nPixels; i += 4) {
     18432      const amount = this.noise() * 255, data = imageData.data, nPixels = data.length, half = amount / 2;
     18433      for (let i = 0; i < nPixels; i += 4) {
    1841718434          data[i + 0] += half - 2 * half * Math.random();
    1841818435          data[i + 1] += half - 2 * half * Math.random();
     
    1842918446   */
    1843018447
    18431   /*eslint-disable max-depth */
    1843218448  /**
    1843318449   * Pixelate Filter. Averages groups of pixels and redraws
     
    1844418460   */
    1844518461  const Pixelate = function (imageData) {
    18446       var pixelSize = Math.ceil(this.pixelSize()), width = imageData.width, height = imageData.height, x, y, i,
     18462      let pixelSize = Math.ceil(this.pixelSize()), width = imageData.width, height = imageData.height, x, y, i,
    1844718463      //pixelsPerBin = pixelSize * pixelSize,
    1844818464      red, green, blue, alpha, nBinsX = Math.ceil(width / pixelSize), nBinsY = Math.ceil(height / pixelSize), xBinStart, xBinEnd, yBinStart, yBinEnd, xBin, yBin, pixelsInBin, data = imageData.data;
     
    1853018546  const Posterize = function (imageData) {
    1853118547      // level must be between 1 and 255
    18532       var levels = Math.round(this.levels() * 254) + 1, data = imageData.data, len = data.length, scale = 255 / levels, i;
     18548      let levels = Math.round(this.levels() * 254) + 1, data = imageData.data, len = data.length, scale = 255 / levels, i;
    1853318549      for (i = 0; i < len; i += 1) {
    1853418550          data[i] = Math.floor(data[i] / scale) * scale;
     
    1855818574   */
    1855918575  const RGB = function (imageData) {
    18560       var data = imageData.data, nPixels = data.length, red = this.red(), green = this.green(), blue = this.blue(), i, brightness;
     18576      let data = imageData.data, nPixels = data.length, red = this.red(), green = this.green(), blue = this.blue(), i, brightness;
    1856118577      for (i = 0; i < nPixels; i += 4) {
    1856218578          brightness =
     
    1863318649   */
    1863418650  const RGBA = function (imageData) {
    18635       var data = imageData.data, nPixels = data.length, red = this.red(), green = this.green(), blue = this.blue(), alpha = this.alpha(), i, ia;
    18636       for (i = 0; i < nPixels; i += 4) {
    18637           ia = 1 - alpha;
     18651      const data = imageData.data, nPixels = data.length, red = this.red(), green = this.green(), blue = this.blue(), alpha = this.alpha();
     18652      for (let i = 0; i < nPixels; i += 4) {
     18653          const ia = 1 - alpha;
    1863818654          data[i] = red * alpha + data[i] * ia; // r
    1863918655          data[i + 1] = green * alpha + data[i + 1] * ia; // g
     
    1872218738   */
    1872318739  const Sepia = function (imageData) {
    18724       var data = imageData.data, nPixels = data.length, i, r, g, b;
     18740      let data = imageData.data, nPixels = data.length, i, r, g, b;
    1872518741      for (i = 0; i < nPixels; i += 4) {
    1872618742          r = data[i + 0];
     
    1874718763   */
    1874818764  const Solarize = function (imageData) {
    18749       var data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4, y = h;
     18765      const data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4;
     18766      let y = h;
    1875018767      do {
    18751           var offsetY = (y - 1) * w4;
    18752           var x = w;
     18768          const offsetY = (y - 1) * w4;
     18769          let x = w;
    1875318770          do {
    18754               var offset = offsetY + (x - 1) * 4;
    18755               var r = data[offset];
    18756               var g = data[offset + 1];
    18757               var b = data[offset + 2];
     18771              const offset = offsetY + (x - 1) * 4;
     18772              let r = data[offset];
     18773              let g = data[offset + 1];
     18774              let b = data[offset + 2];
    1875818775              if (r > 127) {
    1875918776                  r = 255 - r;
     
    1878718804   */
    1878818805  const Threshold = function (imageData) {
    18789       var level = this.threshold() * 255, data = imageData.data, len = data.length, i;
    18790       for (i = 0; i < len; i += 1) {
     18806      const level = this.threshold() * 255, data = imageData.data, len = data.length;
     18807      for (let i = 0; i < len; i += 1) {
    1879118808          data[i] = data[i] < level ? 0 : 255;
    1879218809      }
  • imaps-frontend/node_modules/konva/konva.min.js

    rd565449 r0c6b92a  
    11!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Konva=e()}(this,(function(){"use strict";
    22/*
    3    * Konva JavaScript Framework v9.3.14
     3   * Konva JavaScript Framework v9.3.16
    44   * http://konvajs.org/
    55   * Licensed under the MIT
    6    * Date: Tue Jul 16 2024
     6   * Date: Mon Oct 21 2024
    77   *
    88   * Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
     
    1010   *
    1111   * @license
    12    */const t=Math.PI/180;const e="undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{},i={_global:e,version:"9.3.14",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),isUnminified:/param/.test(function(t){}.toString()),dblClickWindow:400,getAngle:e=>i.angleDeg?e*t:e,enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_fixTextRendering:!1,pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging:()=>i.DD.isDragging,isTransforming(){var t;return null===(t=i.Transformer)||void 0===t?void 0:t.isTransforming()},isDragReady:()=>!!i.DD.node,releaseCanvasOnDestroy:!0,document:e.document,_injectGlobal(t){e.Konva=t}},r=t=>{i[t.prototype.getClassName()]=t};i._injectGlobal(i);class a{constructor(t=[1,0,0,1,0,0]){this.dirty=!1,this.m=t&&t.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new a(this.m)}copyInto(t){t.m[0]=this.m[0],t.m[1]=this.m[1],t.m[2]=this.m[2],t.m[3]=this.m[3],t.m[4]=this.m[4],t.m[5]=this.m[5]}point(t){var e=this.m;return{x:e[0]*t.x+e[2]*t.y+e[4],y:e[1]*t.x+e[3]*t.y+e[5]}}translate(t,e){return this.m[4]+=this.m[0]*t+this.m[2]*e,this.m[5]+=this.m[1]*t+this.m[3]*e,this}scale(t,e){return this.m[0]*=t,this.m[1]*=t,this.m[2]*=e,this.m[3]*=e,this}rotate(t){var e=Math.cos(t),i=Math.sin(t),r=this.m[0]*e+this.m[2]*i,a=this.m[1]*e+this.m[3]*i,n=this.m[0]*-i+this.m[2]*e,s=this.m[1]*-i+this.m[3]*e;return this.m[0]=r,this.m[1]=a,this.m[2]=n,this.m[3]=s,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(t,e){var i=this.m[0]+this.m[2]*e,r=this.m[1]+this.m[3]*e,a=this.m[2]+this.m[0]*t,n=this.m[3]+this.m[1]*t;return this.m[0]=i,this.m[1]=r,this.m[2]=a,this.m[3]=n,this}multiply(t){var e=this.m[0]*t.m[0]+this.m[2]*t.m[1],i=this.m[1]*t.m[0]+this.m[3]*t.m[1],r=this.m[0]*t.m[2]+this.m[2]*t.m[3],a=this.m[1]*t.m[2]+this.m[3]*t.m[3],n=this.m[0]*t.m[4]+this.m[2]*t.m[5]+this.m[4],s=this.m[1]*t.m[4]+this.m[3]*t.m[5]+this.m[5];return this.m[0]=e,this.m[1]=i,this.m[2]=r,this.m[3]=a,this.m[4]=n,this.m[5]=s,this}invert(){var t=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),e=this.m[3]*t,i=-this.m[1]*t,r=-this.m[2]*t,a=this.m[0]*t,n=t*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),s=t*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=e,this.m[1]=i,this.m[2]=r,this.m[3]=a,this.m[4]=n,this.m[5]=s,this}getMatrix(){return this.m}decompose(){var t=this.m[0],e=this.m[1],i=this.m[2],r=this.m[3],a=t*r-e*i;let n={x:this.m[4],y:this.m[5],rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!=t||0!=e){var s=Math.sqrt(t*t+e*e);n.rotation=e>0?Math.acos(t/s):-Math.acos(t/s),n.scaleX=s,n.scaleY=a/s,n.skewX=(t*i+e*r)/a,n.skewY=0}else if(0!=i||0!=r){var o=Math.sqrt(i*i+r*r);n.rotation=Math.PI/2-(r>0?Math.acos(-i/o):-Math.acos(i/o)),n.scaleX=a/o,n.scaleY=o,n.skewX=0,n.skewY=(t*i+e*r)/a}return n.rotation=g._getRotation(n.rotation),n}}var n=Math.PI/180,s=180/Math.PI,o="Konva error: ",h={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},l=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,d=[];const c="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||function(t){setTimeout(t,60)},g={_isElement:t=>!(!t||1!=t.nodeType),_isFunction:t=>!!(t&&t.constructor&&t.call&&t.apply),_isPlainObject:t=>!!t&&t.constructor===Object,_isArray:t=>"[object Array]"===Object.prototype.toString.call(t),_isNumber:t=>"[object Number]"===Object.prototype.toString.call(t)&&!isNaN(t)&&isFinite(t),_isString:t=>"[object String]"===Object.prototype.toString.call(t),_isBoolean:t=>"[object Boolean]"===Object.prototype.toString.call(t),isObject:t=>t instanceof Object,isValidSelector(t){if("string"!=typeof t)return!1;var e=t[0];return"#"===e||"."===e||e===e.toUpperCase()},_sign:t=>0===t||t>0?1:-1,requestAnimFrame(t){d.push(t),1===d.length&&c((function(){const t=d;d=[],t.forEach((function(t){t()}))}))},createCanvasElement(){var t=document.createElement("canvas");try{t.style=t.style||{}}catch(t){}return t},createImageElement:()=>document.createElement("img"),_isInDocument(t){for(;t=t.parentNode;)if(t==document)return!0;return!1},_urlToImage(t,e){var i=g.createImageElement();i.onload=function(){e(i)},i.src=t},_rgbToHex:(t,e,i)=>((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1),_hexToRgb(t){t=t.replace("#","");var e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:255&e}},getRandomColor(){for(var t=(16777215*Math.random()|0).toString(16);t.length<6;)t="0"+t;return"#"+t},getRGB(t){var e;return t in h?{r:(e=h[t])[0],g:e[1],b:e[2]}:"#"===t[0]?this._hexToRgb(t.substring(1)):"rgb("===t.substr(0,4)?(e=l.exec(t.replace(/ /g,"")),{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)}):{r:0,g:0,b:0}},colorToRGBA:t=>(t=t||"black",g._namedColorToRBA(t)||g._hex3ColorToRGBA(t)||g._hex4ColorToRGBA(t)||g._hex6ColorToRGBA(t)||g._hex8ColorToRGBA(t)||g._rgbColorToRGBA(t)||g._rgbaColorToRGBA(t)||g._hslColorToRGBA(t)),_namedColorToRBA(t){var e=h[t.toLowerCase()];return e?{r:e[0],g:e[1],b:e[2],a:1}:null},_rgbColorToRGBA(t){if(0===t.indexOf("rgb(")){var e=(t=t.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:1}}},_rgbaColorToRGBA(t){if(0===t.indexOf("rgba(")){var e=(t=t.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map(((t,e)=>"%"===t.slice(-1)?3===e?parseInt(t)/100:parseInt(t)/100*255:Number(t)));return{r:e[0],g:e[1],b:e[2],a:e[3]}}},_hex8ColorToRGBA(t){if("#"===t[0]&&9===t.length)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:parseInt(t.slice(7,9),16)/255}},_hex6ColorToRGBA(t){if("#"===t[0]&&7===t.length)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:1}},_hex4ColorToRGBA(t){if("#"===t[0]&&5===t.length)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:parseInt(t[4]+t[4],16)/255}},_hex3ColorToRGBA(t){if("#"===t[0]&&4===t.length)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:1}},_hslColorToRGBA(t){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(t)){const[e,...i]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t),r=Number(i[0])/360,a=Number(i[1])/100,n=Number(i[2])/100;let s,o,h;if(0===a)return h=255*n,{r:Math.round(h),g:Math.round(h),b:Math.round(h),a:1};s=n<.5?n*(1+a):n+a-n*a;const l=2*n-s,d=[0,0,0];for(let t=0;t<3;t++)o=r+1/3*-(t-1),o<0&&o++,o>1&&o--,h=6*o<1?l+6*(s-l)*o:2*o<1?s:3*o<2?l+(s-l)*(2/3-o)*6:l,d[t]=255*h;return{r:Math.round(d[0]),g:Math.round(d[1]),b:Math.round(d[2]),a:1}}},haveIntersection:(t,e)=>!(e.x>t.x+t.width||e.x+e.width<t.x||e.y>t.y+t.height||e.y+e.height<t.y),cloneObject(t){var e={};for(var i in t)this._isPlainObject(t[i])?e[i]=this.cloneObject(t[i]):this._isArray(t[i])?e[i]=this.cloneArray(t[i]):e[i]=t[i];return e},cloneArray:t=>t.slice(0),degToRad:t=>t*n,radToDeg:t=>t*s,_degToRad:t=>(g.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),g.degToRad(t)),_radToDeg:t=>(g.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),g.radToDeg(t)),_getRotation:t=>i.angleDeg?g.radToDeg(t):t,_capitalize:t=>t.charAt(0).toUpperCase()+t.slice(1),throw(t){throw new Error(o+t)},error(t){console.error(o+t)},warn(t){i.showWarnings&&console.warn("Konva warning: "+t)},each(t,e){for(var i in t)e(i,t[i])},_inRange:(t,e,i)=>e<=t&&t<i,_getProjectionToSegment(t,e,i,r,a,n){var s,o,h,l=(t-i)*(t-i)+(e-r)*(e-r);if(0==l)s=t,o=e,h=(a-i)*(a-i)+(n-r)*(n-r);else{var d=((a-t)*(i-t)+(n-e)*(r-e))/l;d<0?(s=t,o=e,h=(t-a)*(t-a)+(e-n)*(e-n)):d>1?(s=i,o=r,h=(i-a)*(i-a)+(r-n)*(r-n)):h=((s=t+d*(i-t))-a)*(s-a)+((o=e+d*(r-e))-n)*(o-n)}return[s,o,h]},_getProjectionToLine(t,e,i){var r=g.cloneObject(t),a=Number.MAX_VALUE;return e.forEach((function(n,s){if(i||s!==e.length-1){var o=e[(s+1)%e.length],h=g._getProjectionToSegment(n.x,n.y,o.x,o.y,t.x,t.y),l=h[0],d=h[1],c=h[2];c<a&&(r.x=l,r.y=d,a=c)}})),r},_prepareArrayForTween(t,e,i){var r,a=[],n=[];if(t.length>e.length){var s=e;e=t,t=s}for(r=0;r<t.length;r+=2)a.push({x:t[r],y:t[r+1]});for(r=0;r<e.length;r+=2)n.push({x:e[r],y:e[r+1]});var o=[];return n.forEach((function(t){var e=g._getProjectionToLine(t,a,i);o.push(e.x),o.push(e.y)})),o},_prepareToStringify(t){var e;for(var i in t.visitedByCircularReferenceRemoval=!0,t)if(t.hasOwnProperty(i)&&t[i]&&"object"==typeof t[i])if(e=Object.getOwnPropertyDescriptor(t,i),t[i].visitedByCircularReferenceRemoval||g._isElement(t[i])){if(!e.configurable)return null;delete t[i]}else if(null===g._prepareToStringify(t[i])){if(!e.configurable)return null;delete t[i]}return delete t.visitedByCircularReferenceRemoval,t},_assign(t,e){for(var i in e)t[i]=e[i];return t},_getFirstPointerId:t=>t.touches?t.changedTouches[0].identifier:t.pointerId||999,releaseCanvas(...t){i.releaseCanvasOnDestroy&&t.forEach((t=>{t.width=0,t.height=0}))},drawRoundedRectPath(t,e,i,r){let a=0,n=0,s=0,o=0;"number"==typeof r?a=n=s=o=Math.min(r,e/2,i/2):(a=Math.min(r[0]||0,e/2,i/2),n=Math.min(r[1]||0,e/2,i/2),o=Math.min(r[2]||0,e/2,i/2),s=Math.min(r[3]||0,e/2,i/2)),t.moveTo(a,0),t.lineTo(e-n,0),t.arc(e-n,n,n,3*Math.PI/2,0,!1),t.lineTo(e,i-o),t.arc(e-o,i-o,o,0,Math.PI/2,!1),t.lineTo(s,i),t.arc(s,i-s,s,Math.PI/2,Math.PI,!1),t.lineTo(0,a),t.arc(a,a,a,Math.PI,3*Math.PI/2,!1)}};function u(t){return g._isString(t)?'"'+t+'"':"[object Number]"===Object.prototype.toString.call(t)||g._isBoolean(t)?t:Object.prototype.toString.call(t)}function f(t){return t>255?255:t<0?0:Math.round(t)}function p(){if(i.isUnminified)return function(t,e){return g._isNumber(t)||g.warn(u(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function v(t){if(i.isUnminified)return function(e,i){let r=g._isNumber(e),a=g._isArray(e)&&e.length==t;return r||a||g.warn(u(e)+' is a not valid value for "'+i+'" attribute. The value should be a number or Array<number>('+t+")"),e}}function m(){if(i.isUnminified)return function(t,e){return g._isNumber(t)||"auto"===t||g.warn(u(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function _(){if(i.isUnminified)return function(t,e){return g._isString(t)||g.warn(u(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function y(){if(i.isUnminified)return function(t,e){const i=g._isString(t),r="[object CanvasGradient]"===Object.prototype.toString.call(t)||t&&t.addColorStop;return i||r||g.warn(u(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function x(){if(i.isUnminified)return function(t,e){return!0===t||!1===t||g.warn(u(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}var b="get",S="set";const w={addGetterSetter(t,e,i,r,a){w.addGetter(t,e,i),w.addSetter(t,e,r,a),w.addOverloadedGetterSetter(t,e)},addGetter(t,e,i){var r=b+g._capitalize(e);t.prototype[r]=t.prototype[r]||function(){var t=this.attrs[e];return void 0===t?i:t}},addSetter(t,e,i,r){var a=S+g._capitalize(e);t.prototype[a]||w.overWriteSetter(t,e,i,r)},overWriteSetter(t,e,i,r){var a=S+g._capitalize(e);t.prototype[a]=function(t){return i&&null!=t&&(t=i.call(this,t,e)),this._setAttr(e,t),r&&r.call(this),this}},addComponentsGetterSetter(t,e,r,a,n){var s,o,h=r.length,l=g._capitalize,d=b+l(e),c=S+l(e);t.prototype[d]=function(){var t={};for(s=0;s<h;s++)t[o=r[s]]=this.getAttr(e+l(o));return t};var f=function(t){if(i.isUnminified)return function(e,i){return null==e||g.isObject(e)||g.warn(u(e)+' is a not valid value for "'+i+'" attribute. The value should be an object with properties '+t),e}}(r);t.prototype[c]=function(t){var i,s=this.attrs[e];for(i in a&&(t=a.call(this,t)),f&&f.call(this,t,e),t)t.hasOwnProperty(i)&&this._setAttr(e+l(i),t[i]);return t||r.forEach((t=>{this._setAttr(e+l(t),void 0)})),this._fireChangeEvent(e,s,t),n&&n.call(this),this},w.addOverloadedGetterSetter(t,e)},addOverloadedGetterSetter(t,e){var i=g._capitalize(e),r=S+i,a=b+i;t.prototype[e]=function(){return arguments.length?(this[r](arguments[0]),this):this[a]()}},addDeprecatedGetterSetter(t,e,i,r){g.error("Adding deprecated "+e);var a=b+g._capitalize(e),n=e+" property is deprecated and will be removed soon. Look at Konva change log for more information.";t.prototype[a]=function(){g.error(n);var t=this.attrs[e];return void 0===t?i:t},w.addSetter(t,e,r,(function(){g.error(n)})),w.addOverloadedGetterSetter(t,e)},backCompat(t,e){g.each(e,(function(e,i){var r=t.prototype[i],a=b+g._capitalize(e),n=S+g._capitalize(e);function s(){r.apply(this,arguments),g.error('"'+e+'" method is deprecated and will be removed soon. Use ""'+i+'" instead.')}t.prototype[e]=s,t.prototype[a]=s,t.prototype[n]=s}))},afterSetFilter(){this._filterUpToDate=!1}};var C=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","roundRect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"];class P{constructor(t){this.canvas=t,i.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(t){t.fillEnabled()&&this._fill(t)}_fill(t){}strokeShape(t){t.hasStroke()&&this._stroke(t)}_stroke(t){}fillStrokeShape(t){t.attrs.fillAfterStrokeEnabled?(this.strokeShape(t),this.fillShape(t)):(this.fillShape(t),this.strokeShape(t))}getTrace(t,e){var i,r,a,n,s=this.traceArr,o=s.length,h="";for(i=0;i<o;i++)(a=(r=s[i]).method)?(n=r.args,h+=a,t?h+="()":g._isArray(n[0])?h+="(["+n.join(",")+"])":(e&&(n=n.map((t=>"number"==typeof t?Math.floor(t):t))),h+="("+n.join(",")+")")):(h+=r.property,t||(h+="="+r.val)),h+=";";return h}clearTrace(){this.traceArr=[]}_trace(t){var e=this.traceArr;e.push(t),e.length>=100&&e.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var e=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,e.getWidth()/e.pixelRatio,e.getHeight()/e.pixelRatio)}_applyLineCap(t){const e=t.attrs.lineCap;e&&this.setAttr("lineCap",e)}_applyOpacity(t){var e=t.getAbsoluteOpacity();1!==e&&this.setAttr("globalAlpha",e)}_applyLineJoin(t){const e=t.attrs.lineJoin;e&&this.setAttr("lineJoin",e)}setAttr(t,e){this._context[t]=e}arc(t,e,i,r,a,n){this._context.arc(t,e,i,r,a,n)}arcTo(t,e,i,r,a){this._context.arcTo(t,e,i,r,a)}beginPath(){this._context.beginPath()}bezierCurveTo(t,e,i,r,a,n){this._context.bezierCurveTo(t,e,i,r,a,n)}clearRect(t,e,i,r){this._context.clearRect(t,e,i,r)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,e){var i=arguments;return 2===i.length?this._context.createImageData(t,e):1===i.length?this._context.createImageData(t):void 0}createLinearGradient(t,e,i,r){return this._context.createLinearGradient(t,e,i,r)}createPattern(t,e){return this._context.createPattern(t,e)}createRadialGradient(t,e,i,r,a,n){return this._context.createRadialGradient(t,e,i,r,a,n)}drawImage(t,e,i,r,a,n,s,o,h){var l=arguments,d=this._context;3===l.length?d.drawImage(t,e,i):5===l.length?d.drawImage(t,e,i,r,a):9===l.length&&d.drawImage(t,e,i,r,a,n,s,o,h)}ellipse(t,e,i,r,a,n,s,o){this._context.ellipse(t,e,i,r,a,n,s,o)}isPointInPath(t,e,i,r){return i?this._context.isPointInPath(i,t,e,r):this._context.isPointInPath(t,e,r)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,e,i,r){this._context.fillRect(t,e,i,r)}strokeRect(t,e,i,r){this._context.strokeRect(t,e,i,r)}fillText(t,e,i,r){r?this._context.fillText(t,e,i,r):this._context.fillText(t,e,i)}measureText(t){return this._context.measureText(t)}getImageData(t,e,i,r){return this._context.getImageData(t,e,i,r)}lineTo(t,e){this._context.lineTo(t,e)}moveTo(t,e){this._context.moveTo(t,e)}rect(t,e,i,r){this._context.rect(t,e,i,r)}roundRect(t,e,i,r,a){this._context.roundRect(t,e,i,r,a)}putImageData(t,e,i){this._context.putImageData(t,e,i)}quadraticCurveTo(t,e,i,r){this._context.quadraticCurveTo(t,e,i,r)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,e){this._context.scale(t,e)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,e,i,r,a,n){this._context.setTransform(t,e,i,r,a,n)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,e,i,r){this._context.strokeText(t,e,i,r)}transform(t,e,i,r,a,n){this._context.transform(t,e,i,r,a,n)}translate(t,e){this._context.translate(t,e)}_enableTrace(){var t,e,i=this,r=C.length,a=this.setAttr,n=function(t){var r,a=i[t];i[t]=function(){return e=function(t){var e,i,r=[],a=t.length,n=g;for(e=0;e<a;e++)i=t[e],n._isNumber(i)?i=Math.round(1e3*i)/1e3:n._isString(i)||(i+=""),r.push(i);return r}(Array.prototype.slice.call(arguments,0)),r=a.apply(i,arguments),i._trace({method:t,args:e}),r}};for(t=0;t<r;t++)n(C[t]);i.setAttr=function(){a.apply(i,arguments);var t=arguments[0],e=arguments[1];"shadowOffsetX"!==t&&"shadowOffsetY"!==t&&"shadowBlur"!==t||(e/=this.canvas.getPixelRatio()),i._trace({property:t,val:e})}}_applyGlobalCompositeOperation(t){const e=t.attrs.globalCompositeOperation;!e||"source-over"===e||this.setAttr("globalCompositeOperation",e)}}["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"].forEach((function(t){Object.defineProperty(P.prototype,t,{get(){return this._context[t]},set(e){this._context[t]=e}})}));class k extends P{constructor(t,{willReadFrequently:e=!1}={}){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:e})}_fillColor(t){var e=t.fill();this.setAttr("fillStyle",e),t._fillFunc(this)}_fillPattern(t){this.setAttr("fillStyle",t._getFillPattern()),t._fillFunc(this)}_fillLinearGradient(t){var e=t._getLinearGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fillRadialGradient(t){const e=t._getRadialGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fill(t){const e=t.fill(),i=t.getFillPriority();if(e&&"color"===i)return void this._fillColor(t);const r=t.getFillPatternImage();if(r&&"pattern"===i)return void this._fillPattern(t);const a=t.getFillLinearGradientColorStops();if(a&&"linear-gradient"===i)return void this._fillLinearGradient(t);const n=t.getFillRadialGradientColorStops();n&&"radial-gradient"===i?this._fillRadialGradient(t):e?this._fillColor(t):r?this._fillPattern(t):a?this._fillLinearGradient(t):n&&this._fillRadialGradient(t)}_strokeLinearGradient(t){const e=t.getStrokeLinearGradientStartPoint(),i=t.getStrokeLinearGradientEndPoint(),r=t.getStrokeLinearGradientColorStops(),a=this.createLinearGradient(e.x,e.y,i.x,i.y);if(r){for(var n=0;n<r.length;n+=2)a.addColorStop(r[n],r[n+1]);this.setAttr("strokeStyle",a)}}_stroke(t){var e=t.dash(),i=t.getStrokeScaleEnabled();if(t.hasStroke()){if(!i){this.save();var r=this.getCanvas().getPixelRatio();this.setTransform(r,0,0,r,0,0)}this._applyLineCap(t),e&&t.dashEnabled()&&(this.setLineDash(e),this.setAttr("lineDashOffset",t.dashOffset())),this.setAttr("lineWidth",t.strokeWidth()),t.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),t.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(t):this.setAttr("strokeStyle",t.stroke()),t._strokeFunc(this),i||this.restore()}}_applyShadow(t){var e,i,r,a=null!==(e=t.getShadowRGBA())&&void 0!==e?e:"black",n=null!==(i=t.getShadowBlur())&&void 0!==i?i:5,s=null!==(r=t.getShadowOffset())&&void 0!==r?r:{x:0,y:0},o=t.getAbsoluteScale(),h=this.canvas.getPixelRatio(),l=o.x*h,d=o.y*h;this.setAttr("shadowColor",a),this.setAttr("shadowBlur",n*Math.min(Math.abs(l),Math.abs(d))),this.setAttr("shadowOffsetX",s.x*l),this.setAttr("shadowOffsetY",s.y*d)}}class A extends P{constructor(t){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:!0})}_fill(t){this.save(),this.setAttr("fillStyle",t.colorKey),t._fillFuncHit(this),this.restore()}strokeShape(t){t.hasHitStroke()&&this._stroke(t)}_stroke(t){if(t.hasHitStroke()){const a=t.getStrokeScaleEnabled();if(!a){this.save();var e=this.getCanvas().getPixelRatio();this.setTransform(e,0,0,e,0,0)}this._applyLineCap(t);var i=t.hitStrokeWidth(),r="auto"===i?t.strokeWidth():i;this.setAttr("lineWidth",r),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),a||this.restore()}}}var T;class M{constructor(t){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var e=(t||{}).pixelRatio||i.pixelRatio||function(){if(T)return T;var t=g.createCanvasElement(),e=t.getContext("2d");return T=(i._global.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1),g.releaseCanvas(t),T}();this.pixelRatio=e,this._canvas=g.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(t){var e=this.pixelRatio;this.pixelRatio=t,this.setSize(this.getWidth()/e,this.getHeight()/e)}setWidth(t){this.width=this._canvas.width=t*this.pixelRatio,this._canvas.style.width=t+"px";var e=this.pixelRatio;this.getContext()._context.scale(e,e)}setHeight(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";var e=this.pixelRatio;this.getContext()._context.scale(e,e)}getWidth(){return this.width}getHeight(){return this.height}setSize(t,e){this.setWidth(t||0),this.setHeight(e||0)}toDataURL(t,e){try{return this._canvas.toDataURL(t,e)}catch(t){try{return this._canvas.toDataURL()}catch(t){return g.error("Unable to get data URL. "+t.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}w.addGetterSetter(M,"pixelRatio",void 0,p());class G extends M{constructor(t={width:0,height:0,willReadFrequently:!1}){super(t),this.context=new k(this,{willReadFrequently:t.willReadFrequently}),this.setSize(t.width,t.height)}}class R extends M{constructor(t={width:0,height:0}){super(t),this.hitCanvas=!0,this.context=new A(this),this.setSize(t.width,t.height)}}const E={get isDragging(){var t=!1;return E._dragElements.forEach((e=>{"dragging"===e.dragStatus&&(t=!0)})),t},justDragged:!1,get node(){var t;return E._dragElements.forEach((e=>{t=e.node})),t},_dragElements:new Map,_drag(t){const e=[];E._dragElements.forEach(((i,r)=>{const{node:a}=i,n=a.getStage();n.setPointersPositions(t),void 0===i.pointerId&&(i.pointerId=g._getFirstPointerId(t));const s=n._changedPointerPositions.find((t=>t.id===i.pointerId));if(s){if("dragging"!==i.dragStatus){var o=a.dragDistance();if(Math.max(Math.abs(s.x-i.startPointerPos.x),Math.abs(s.y-i.startPointerPos.y))<o)return;if(a.startDrag({evt:t}),!a.isDragging())return}a._setDragPosition(t,i),e.push(a)}})),e.forEach((e=>{e.fire("dragmove",{type:"dragmove",target:e,evt:t},!0)}))},_endDragBefore(t){const e=[];E._dragElements.forEach((r=>{const{node:a}=r,n=a.getStage();t&&n.setPointersPositions(t);if(!n._changedPointerPositions.find((t=>t.id===r.pointerId)))return;"dragging"!==r.dragStatus&&"stopped"!==r.dragStatus||(E.justDragged=!0,i._mouseListenClick=!1,i._touchListenClick=!1,i._pointerListenClick=!1,r.dragStatus="stopped");const s=r.node.getLayer()||r.node instanceof i.Stage&&r.node;s&&-1===e.indexOf(s)&&e.push(s)})),e.forEach((t=>{t.draw()}))},_endDragAfter(t){E._dragElements.forEach(((e,i)=>{"stopped"===e.dragStatus&&e.node.fire("dragend",{type:"dragend",target:e.node,evt:t},!0),"dragging"!==e.dragStatus&&E._dragElements.delete(i)}))}};i.isBrowser&&(window.addEventListener("mouseup",E._endDragBefore,!0),window.addEventListener("touchend",E._endDragBefore,!0),window.addEventListener("mousemove",E._drag),window.addEventListener("touchmove",E._drag),window.addEventListener("mouseup",E._endDragAfter,!1),window.addEventListener("touchend",E._endDragAfter,!1));var D="absoluteOpacity",L="allEventListeners",O="absoluteTransform",I="absoluteScale",F="canvas",B="listening",N="mouseenter",H="mouseleave",W="Shape",z=" ",Y="stage",X="transform",q="visible",j=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(z);let U=1;class V{constructor(t){this._id=U++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){t!==X&&t!==O||!this._cache.get(t)?t?this._cache.delete(t):this._cache.clear():this._cache.get(t).dirty=!0}_getCache(t,e){var i=this._cache.get(t);return(void 0===i||(t===X||t===O)&&!0===i.dirty)&&(i=e.call(this),this._cache.set(t,i)),i}_calculate(t,e,i){if(!this._attachedDepsListeners.get(t)){const i=e.map((t=>t+"Change.konva")).join(z);this.on(i,(()=>{this._clearCache(t)})),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,i)}_getCanvasCache(){return this._cache.get(F)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===O&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(F)){const{scene:t,filter:e,hit:i}=this._cache.get(F);g.releaseCanvas(t,e,i),this._cache.delete(F)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var e=t||{},i={};void 0!==e.x&&void 0!==e.y&&void 0!==e.width&&void 0!==e.height||(i=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));var r=Math.ceil(e.width||i.width),a=Math.ceil(e.height||i.height),n=e.pixelRatio,s=void 0===e.x?Math.floor(i.x):e.x,o=void 0===e.y?Math.floor(i.y):e.y,h=e.offset||0,l=e.drawBorder||!1,d=e.hitCanvasPixelRatio||1;if(!r||!a)return void g.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");const c=Math.abs(Math.round(i.x)-s)>.5?1:0,u=Math.abs(Math.round(i.y)-o)>.5?1:0;s-=h,o-=h;var f=new G({pixelRatio:n,width:r+=2*h+c,height:a+=2*h+u}),p=new G({pixelRatio:n,width:0,height:0,willReadFrequently:!0}),v=new R({pixelRatio:d,width:r,height:a}),m=f.getContext(),_=v.getContext();return v.isCache=!0,f.isCache=!0,this._cache.delete(F),this._filterUpToDate=!1,!1===e.imageSmoothingEnabled&&(f.getContext()._context.imageSmoothingEnabled=!1,p.getContext()._context.imageSmoothingEnabled=!1),m.save(),_.save(),m.translate(-s,-o),_.translate(-s,-o),this._isUnderCache=!0,this._clearSelfAndDescendantCache(D),this._clearSelfAndDescendantCache(I),this.drawScene(f,this),this.drawHit(v,this),this._isUnderCache=!1,m.restore(),_.restore(),l&&(m.save(),m.beginPath(),m.rect(0,0,r,a),m.closePath(),m.setAttr("strokeStyle","red"),m.setAttr("lineWidth",5),m.stroke(),m.restore()),this._cache.set(F,{scene:f,filter:p,hit:v,x:s,y:o}),this._requestDraw(),this}isCached(){return this._cache.has(F)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,e){var i=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],r=1/0,a=1/0,n=-1/0,s=-1/0,o=this.getAbsoluteTransform(e);return i.forEach((function(t){var e=o.point(t);void 0===r&&(r=n=e.x,a=s=e.y),r=Math.min(r,e.x),a=Math.min(a,e.y),n=Math.max(n,e.x),s=Math.max(s,e.y)})),{x:r,y:a,width:n-r,height:s-a}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const e=this._getCanvasCache();t.translate(e.x,e.y);var i=this._getCachedSceneCanvas(),r=i.pixelRatio;t.drawImage(i._canvas,0,0,i.width/r,i.height/r),t.restore()}_drawCachedHitCanvas(t){var e=this._getCanvasCache(),i=e.hit;t.save(),t.translate(e.x,e.y),t.drawImage(i._canvas,0,0,i.width/i.pixelRatio,i.height/i.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t,e,i,r,a=this.filters(),n=this._getCanvasCache(),s=n.scene,o=n.filter,h=o.getContext();if(a){if(!this._filterUpToDate){var l=s.pixelRatio;o.setSize(s.width/s.pixelRatio,s.height/s.pixelRatio);try{for(t=a.length,h.clear(),h.drawImage(s._canvas,0,0,s.getWidth()/l,s.getHeight()/l),e=h.getImageData(0,0,o.getWidth(),o.getHeight()),i=0;i<t;i++)"function"==typeof(r=a[i])?(r.call(this,e),h.putImageData(e,0,0)):g.error("Filter should be type of function, but got "+typeof r+" instead. Please check correct filters")}catch(t){g.error("Unable to apply filter. "+t.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return o}return s}on(t,e){if(this._cache&&this._cache.delete(L),3===arguments.length)return this._delegate.apply(this,arguments);var i,r,a,n,s=t.split(z),o=s.length;for(i=0;i<o;i++)a=(r=s[i].split("."))[0],n=r[1]||"",this.eventListeners[a]||(this.eventListeners[a]=[]),this.eventListeners[a].push({name:n,handler:e});return this}off(t,e){var i,r,a,n,s,o=(t||"").split(z),h=o.length;if(this._cache&&this._cache.delete(L),!t)for(r in this.eventListeners)this._off(r);for(i=0;i<h;i++)if(n=(a=o[i].split("."))[0],s=a[1],n)this.eventListeners[n]&&this._off(n,s,e);else for(r in this.eventListeners)this._off(r,s,e);return this}dispatchEvent(t){var e={target:this,type:t.type,evt:t};return this.fire(t.type,e),this}addEventListener(t,e){return this.on(t,(function(t){e.call(this,t.evt)})),this}removeEventListener(t){return this.off(t),this}_delegate(t,e,i){var r=this;this.on(t,(function(t){for(var a=t.target.findAncestors(e,!0,r),n=0;n<a.length;n++)(t=g.cloneObject(t)).currentTarget=a[n],i.call(a[n],t)}))}remove(){return this.isDragging()&&this.stopDrag(),E._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(O),this._clearSelfAndDescendantCache(D),this._clearSelfAndDescendantCache(I),this._clearSelfAndDescendantCache(Y),this._clearSelfAndDescendantCache(q),this._clearSelfAndDescendantCache(B)}_remove(){this._clearCaches();var t=this.getParent();t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(t){var e="get"+g._capitalize(t);return g._isFunction(this[e])?this[e]():this.attrs[t]}getAncestors(){for(var t=this.getParent(),e=[];t;)e.push(t),t=t.getParent();return e}getAttrs(){return this.attrs||{}}setAttrs(t){return this._batchTransformChanges((()=>{var e,i;if(!t)return this;for(e in t)"children"!==e&&(i="set"+g._capitalize(e),g._isFunction(this[i])?this[i](t[e]):this._setAttr(e,t[e]))})),this}isListening(){return this._getCache(B,this._isListening)}_isListening(t){if(!this.listening())return!1;const e=this.getParent();return!e||e===t||this===t||e._isListening(t)}isVisible(){return this._getCache(q,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const e=this.getParent();return!e||e===t||this===t||e._isVisible(t)}shouldDrawHit(t,e=!1){if(t)return this._isVisible(t)&&this._isListening(t);var r=this.getLayer(),a=!1;E._dragElements.forEach((t=>{"dragging"===t.dragStatus&&("Stage"===t.node.nodeType||t.node.getLayer()===r)&&(a=!0)}));var n=!e&&!i.hitOnDragEnabled&&(a||i.isTransforming());return this.isListening()&&this.isVisible()&&!n}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t,e,i,r,a=this.getDepth(),n=this,s=0;const o=this.getStage();return"Stage"!==n.nodeType&&o&&function o(h){for(t=[],e=h.length,i=0;i<e;i++)r=h[i],s++,r.nodeType!==W&&(t=t.concat(r.getChildren().slice())),r._id===n._id&&(i=e);t.length>0&&t[0].getDepth()<=a&&o(t)}(o.getChildren()),s}getDepth(){for(var t=0,e=this.parent;e;)t++,e=e.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(X),this._clearSelfAndDescendantCache(O)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges((()=>{this.x(t.x),this.y(t.y)})),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const t=this.getStage();if(!t)return null;var e=t.getPointerPosition();if(!e)return null;var i=this.getAbsoluteTransform().copy();return i.invert(),i.point(e)}getAbsolutePosition(t){let e=!1,i=this.parent;for(;i;){if(i.isCached()){e=!0;break}i=i.parent}e&&!t&&(t=!0);var r=this.getAbsoluteTransform(t).getMatrix(),n=new a,s=this.offset();return n.m=r.slice(),n.translate(s.x,s.y),n.getTranslation()}setAbsolutePosition(t){const{x:e,y:i,...r}=this._clearTransform();this.attrs.x=e,this.attrs.y=i,this._clearCache(X);var a=this._getAbsoluteTransform().copy();return a.invert(),a.translate(t.x,t.y),t={x:this.attrs.x+a.getTranslation().x,y:this.attrs.y+a.getTranslation().y},this._setTransform(r),this.setPosition({x:t.x,y:t.y}),this._clearCache(X),this._clearSelfAndDescendantCache(O),this}_setTransform(t){var e;for(e in t)this.attrs[e]=t[e]}_clearTransform(){var t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){var e=t.x,i=t.y,r=this.x(),a=this.y();return void 0!==e&&(r+=e),void 0!==i&&(a+=i),this.setPosition({x:r,y:a}),this}_eachAncestorReverse(t,e){var i,r,a=[],n=this.getParent();if(!e||e._id!==this._id){for(a.unshift(this);n&&(!e||n._id!==e._id);)a.unshift(n),n=n.parent;for(i=a.length,r=0;r<i;r++)t(a[r])}}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return g.warn("Node has no parent. moveToTop function is ignored."),!1;var t=this.index;return t<this.parent.getChildren().length-1&&(this.parent.children.splice(t,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0)}moveUp(){if(!this.parent)return g.warn("Node has no parent. moveUp function is ignored."),!1;var t=this.index;return t<this.parent.getChildren().length-1&&(this.parent.children.splice(t,1),this.parent.children.splice(t+1,0,this),this.parent._setChildrenIndices(),!0)}moveDown(){if(!this.parent)return g.warn("Node has no parent. moveDown function is ignored."),!1;var t=this.index;return t>0&&(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0)}moveToBottom(){if(!this.parent)return g.warn("Node has no parent. moveToBottom function is ignored."),!1;var t=this.index;return t>0&&(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0)}setZIndex(t){if(!this.parent)return g.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&g.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var e=this.index;return this.parent.children.splice(e,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(D,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),e=this.getParent();return e&&!e._isUnderCache&&(t*=e.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t,e,i,r,a=this.getAttrs();const n={attrs:{},className:this.getClassName()};for(t in a)e=a[t],g.isObject(e)&&!g._isPlainObject(e)&&!g._isArray(e)||(i="function"==typeof this[t]&&this[t],delete a[t],r=i?i.call(this):null,a[t]=e,r!==e&&(n.attrs[t]=e));return g._prepareToStringify(n)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,e,i){var r=[];e&&this._isMatch(t)&&r.push(this);for(var a=this.parent;a;){if(a===i)return r;a._isMatch(t)&&r.push(a),a=a.parent}return r}isAncestorOf(t){return!1}findAncestor(t,e,i){return this.findAncestors(t,e,i)[0]}_isMatch(t){if(!t)return!1;if("function"==typeof t)return t(this);var e,i,r=t.replace(/ /g,"").split(","),a=r.length;for(e=0;e<a;e++)if(i=r[e],g.isValidSelector(i)||(g.warn('Selector "'+i+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),g.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),g.warn("Konva is awesome, right?")),"#"===i.charAt(0)){if(this.id()===i.slice(1))return!0}else if("."===i.charAt(0)){if(this.hasName(i.slice(1)))return!0}else if(this.className===i||this.nodeType===i)return!0;return!1}getLayer(){var t=this.getParent();return t?t.getLayer():null}getStage(){return this._getCache(Y,this._getStage)}_getStage(){var t=this.getParent();return t?t.getStage():null}fire(t,e={},i){return e.target=e.target||this,i?this._fireAndBubble(t,e):this._fire(t,e),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache(O,this._getAbsoluteTransform)}_getAbsoluteTransform(t){var e;if(t)return e=new a,this._eachAncestorReverse((function(t){var i=t.transformsEnabled();"all"===i?e.multiply(t.getTransform()):"position"===i&&e.translate(t.x()-t.offsetX(),t.y()-t.offsetY())}),t),e;e=this._cache.get(O)||new a,this.parent?this.parent.getAbsoluteTransform().copyInto(e):e.reset();var i=this.transformsEnabled();if("all"===i)e.multiply(this.getTransform());else if("position"===i){const t=this.attrs.x||0,i=this.attrs.y||0,r=this.attrs.offsetX||0,a=this.attrs.offsetY||0;e.translate(t-r,i-a)}return e.dirty=!1,e}getAbsoluteScale(t){for(var e=this;e;)e._isUnderCache&&(t=e),e=e.getParent();const i=this.getAbsoluteTransform(t).decompose();return{x:i.scaleX,y:i.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(X,this._getTransform)}_getTransform(){var t,e,r=this._cache.get(X)||new a;r.reset();var n=this.x(),s=this.y(),o=i.getAngle(this.rotation()),h=null!==(t=this.attrs.scaleX)&&void 0!==t?t:1,l=null!==(e=this.attrs.scaleY)&&void 0!==e?e:1,d=this.attrs.skewX||0,c=this.attrs.skewY||0,g=this.attrs.offsetX||0,u=this.attrs.offsetY||0;return 0===n&&0===s||r.translate(n,s),0!==o&&r.rotate(o),0===d&&0===c||r.skew(d,c),1===h&&1===l||r.scale(h,l),0===g&&0===u||r.translate(-1*g,-1*u),r.dirty=!1,r}clone(t){var e,i,r,a,n,s=g.cloneObject(this.attrs);for(e in t)s[e]=t[e];var o=new this.constructor(s);for(e in this.eventListeners)for(r=(i=this.eventListeners[e]).length,a=0;a<r;a++)(n=i[a]).name.indexOf("konva")<0&&(o.eventListeners[e]||(o.eventListeners[e]=[]),o.eventListeners[e].push(n));return o}_toKonvaCanvas(t){t=t||{};var e=this.getClientRect(),i=this.getStage(),r=void 0!==t.x?t.x:Math.floor(e.x),a=void 0!==t.y?t.y:Math.floor(e.y),n=t.pixelRatio||1,s=new G({width:t.width||Math.ceil(e.width)||(i?i.width():0),height:t.height||Math.ceil(e.height)||(i?i.height():0),pixelRatio:n}),o=s.getContext();const h=new G({width:s.width/s.pixelRatio+Math.abs(r),height:s.height/s.pixelRatio+Math.abs(a),pixelRatio:s.pixelRatio});return!1===t.imageSmoothingEnabled&&(o._context.imageSmoothingEnabled=!1),o.save(),(r||a)&&o.translate(-1*r,-1*a),this.drawScene(s,void 0,h),o.restore(),s}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){var e=(t=t||{}).mimeType||null,i=t.quality||null,r=this._toKonvaCanvas(t).toDataURL(e,i);return t.callback&&t.callback(r),r}toImage(t){return new Promise(((e,i)=>{try{const i=null==t?void 0:t.callback;i&&delete t.callback,g._urlToImage(this.toDataURL(t),(function(t){e(t),null==i||i(t)}))}catch(t){i(t)}}))}toBlob(t){return new Promise(((e,i)=>{try{const i=null==t?void 0:t.callback;i&&delete t.callback,this.toCanvas(t).toBlob((t=>{e(t),null==i||i(t)}),null==t?void 0:t.mimeType,null==t?void 0:t.quality)}catch(t){i(t)}}))}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():i.dragDistance}_off(t,e,i){var r,a,n,s=this.eventListeners[t];for(r=0;r<s.length;r++)if(a=s[r].name,n=s[r].handler,!("konva"===a&&"konva"!==e||e&&a!==e||i&&i!==n)){if(s.splice(r,1),0===s.length){delete this.eventListeners[t];break}r--}}_fireChangeEvent(t,e,i){this._fire(t+"Change",{oldVal:e,newVal:i})}addName(t){if(!this.hasName(t)){var e=this.name(),i=e?e+" "+t:t;this.name(i)}return this}hasName(t){if(!t)return!1;const e=this.name();return!!e&&-1!==(e||"").split(/\s/g).indexOf(t)}removeName(t){var e=(this.name()||"").split(/\s/g),i=e.indexOf(t);return-1!==i&&(e.splice(i,1),this.name(e.join(" "))),this}setAttr(t,e){var i=this["set"+g._capitalize(t)];return g._isFunction(i)?i.call(this,e):this._setAttr(t,e),this}_requestDraw(){if(i.autoDrawEnabled){const t=this.getLayer()||this.getStage();null==t||t.batchDraw()}}_setAttr(t,e){var i=this.attrs[t];(i!==e||g.isObject(e))&&(null==e?delete this.attrs[t]:this.attrs[t]=e,this._shouldFireChangeEvents&&this._fireChangeEvent(t,i,e),this._requestDraw())}_setComponentAttr(t,e,i){var r;void 0!==i&&((r=this.attrs[t])||(this.attrs[t]=this.getAttr(t)),this.attrs[t][e]=i,this._fireChangeEvent(t,r,i))}_fireAndBubble(t,e,i){if(e&&this.nodeType===W&&(e.target=this),!((t===N||t===H)&&(i&&(this===i||this.isAncestorOf&&this.isAncestorOf(i))||"Stage"===this.nodeType&&!i))){this._fire(t,e);var r=(t===N||t===H)&&i&&i.isAncestorOf&&i.isAncestorOf(this)&&!i.isAncestorOf(this.parent);(e&&!e.cancelBubble||!e)&&this.parent&&this.parent.isListening()&&!r&&(i&&i.parent?this._fireAndBubble.call(this.parent,t,e,i):this._fireAndBubble.call(this.parent,t,e))}}_getProtoListeners(t){var e,i,r;const a=null!==(e=this._cache.get(L))&&void 0!==e?e:{};let n=null==a?void 0:a[t];if(void 0===n){n=[];let e=Object.getPrototypeOf(this);for(;e;){const a=null!==(r=null===(i=e.eventListeners)||void 0===i?void 0:i[t])&&void 0!==r?r:[];n.push(...a),e=Object.getPrototypeOf(e)}a[t]=n,this._cache.set(L,a)}return n}_fire(t,e){(e=e||{}).currentTarget=this,e.type=t;const i=this._getProtoListeners(t);if(i)for(var r=0;r<i.length;r++)i[r].handler.call(this,e);const a=this.eventListeners[t];if(a)for(r=0;r<a.length;r++)a[r].handler.call(this,e)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){var e=t?t.pointerId:void 0,i=this.getStage(),r=this.getAbsolutePosition();if(i){var a=i._getPointerById(e)||i._changedPointerPositions[0]||r;E._dragElements.set(this._id,{node:this,startPointerPos:a,offset:{x:a.x-r.x,y:a.y-r.y},dragStatus:"ready",pointerId:e})}}startDrag(t,e=!0){E._dragElements.has(this._id)||this._createDragElement(t);E._dragElements.get(this._id).dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:t&&t.evt},e)}_setDragPosition(t,e){const i=this.getStage()._getPointerById(e.pointerId);if(i){var r={x:i.x-e.offset.x,y:i.y-e.offset.y},a=this.dragBoundFunc();if(void 0!==a){const e=a.call(this,r,t);e?r=e:g.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}this._lastPos&&this._lastPos.x===r.x&&this._lastPos.y===r.y||(this.setAbsolutePosition(r),this._requestDraw()),this._lastPos=r}}stopDrag(t){const e=E._dragElements.get(this._id);e&&(e.dragStatus="stopped"),E._endDragBefore(t),E._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=E._dragElements.get(this._id);return!!t&&"dragging"===t.dragStatus}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",(function(t){if((!(void 0!==t.evt.button)||i.dragButtons.indexOf(t.evt.button)>=0)&&!this.isDragging()){var e=!1;E._dragElements.forEach((t=>{this.isAncestorOf(t.node)&&(e=!0)})),e||this._createDragElement(t)}}))}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const t=E._dragElements.get(this._id),e=t&&"dragging"===t.dragStatus,i=t&&"ready"===t.dragStatus;e?this.stopDrag():i&&E._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const e=this.getStage();if(!e)return!1;const i={x:-t.x,y:-t.y,width:e.width()+2*t.x,height:e.height()+2*t.y};return g.haveIntersection(i,this.getClientRect())}static create(t,e){return g._isString(t)&&(t=JSON.parse(t)),this._createNode(t,e)}static _createNode(t,e){var r,a,n,s=V.prototype.getClassName.call(t),o=t.children;e&&(t.attrs.container=e),i[s]||(g.warn('Can not find a node with class name "'+s+'". Fallback to "Shape".'),s="Shape");if(r=new(0,i[s])(t.attrs),o)for(a=o.length,n=0;n<a;n++)r.add(V._createNode(o[n]));return r}}V.prototype.nodeType="Node",V.prototype._attrsAffectingSize=[],V.prototype.eventListeners={},V.prototype.on.call(V.prototype,j,(function(){this._batchingTransformChange?this._needClearTransformCache=!0:(this._clearCache(X),this._clearSelfAndDescendantCache(O))})),V.prototype.on.call(V.prototype,"visibleChange.konva",(function(){this._clearSelfAndDescendantCache(q)})),V.prototype.on.call(V.prototype,"listeningChange.konva",(function(){this._clearSelfAndDescendantCache(B)})),V.prototype.on.call(V.prototype,"opacityChange.konva",(function(){this._clearSelfAndDescendantCache(D)}));const K=w.addGetterSetter;K(V,"zIndex"),K(V,"absolutePosition"),K(V,"position"),K(V,"x",0,p()),K(V,"y",0,p()),K(V,"globalCompositeOperation","source-over",_()),K(V,"opacity",1,p()),K(V,"name","",_()),K(V,"id","",_()),K(V,"rotation",0,p()),w.addComponentsGetterSetter(V,"scale",["x","y"]),K(V,"scaleX",1,p()),K(V,"scaleY",1,p()),w.addComponentsGetterSetter(V,"skew",["x","y"]),K(V,"skewX",0,p()),K(V,"skewY",0,p()),w.addComponentsGetterSetter(V,"offset",["x","y"]),K(V,"offsetX",0,p()),K(V,"offsetY",0,p()),K(V,"dragDistance",null,p()),K(V,"width",0,p()),K(V,"height",0,p()),K(V,"listening",!0,x()),K(V,"preventDefault",!0,x()),K(V,"filters",null,(function(t){return this._filterUpToDate=!1,t})),K(V,"visible",!0,x()),K(V,"transformsEnabled","all",_()),K(V,"size"),K(V,"dragBoundFunc"),K(V,"draggable",!1,x()),w.backCompat(V,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});class Q extends V{constructor(){super(...arguments),this.children=[]}getChildren(t){if(!t)return this.children||[];const e=this.children||[];var i=[];return e.forEach((function(e){t(e)&&i.push(e)})),i}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach((t=>{t.parent=null,t.index=0,t.remove()})),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach((t=>{t.parent=null,t.index=0,t.destroy()})),this.children=[],this._requestDraw(),this}add(...t){if(0===t.length)return this;if(t.length>1){for(var e=0;e<t.length;e++)this.add(t[e]);return this}const i=t[0];return i.getParent()?(i.moveTo(this),this):(this._validateAdd(i),i.index=this.getChildren().length,i.parent=this,i._clearCaches(),this.getChildren().push(i),this._fire("add",{child:i}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(t){return this._generalFind(t,!1)}findOne(t){var e=this._generalFind(t,!0);return e.length>0?e[0]:void 0}_generalFind(t,e){var i=[];return this._descendants((r=>{const a=r._isMatch(t);return a&&i.push(r),!(!a||!e)})),i}_descendants(t){let e=!1;const i=this.getChildren();for(const r of i){if(e=t(r),e)return!0;if(r.hasChildren()&&(e=r._descendants(t),e))return!0}return!1}toObject(){var t=V.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach((e=>{t.children.push(e.toObject())})),t}isAncestorOf(t){for(var e=t.getParent();e;){if(e._id===this._id)return!0;e=e.getParent()}return!1}clone(t){var e=V.prototype.clone.call(this,t);return this.getChildren().forEach((function(t){e.add(t.clone())})),e}getAllIntersections(t){var e=[];return this.find("Shape").forEach((i=>{i.isVisible()&&i.intersects(t)&&e.push(i)})),e}_clearSelfAndDescendantCache(t){var e;super._clearSelfAndDescendantCache(t),this.isCached()||null===(e=this.children)||void 0===e||e.forEach((function(e){e._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;null===(t=this.children)||void 0===t||t.forEach((function(t,e){t.index=e})),this._requestDraw()}drawScene(t,e,i){var r=this.getLayer(),a=t||r&&r.getCanvas(),n=a&&a.getContext(),s=this._getCanvasCache(),o=s&&s.scene,h=a&&a.isCache;if(!this.isVisible()&&!h)return this;if(o){n.save();var l=this.getAbsoluteTransform(e).getMatrix();n.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedSceneCanvas(n),n.restore()}else this._drawChildren("drawScene",a,e,i);return this}drawHit(t,e){if(!this.shouldDrawHit(e))return this;var i=this.getLayer(),r=t||i&&i.hitCanvas,a=r&&r.getContext(),n=this._getCanvasCache();if(n&&n.hit){a.save();var s=this.getAbsoluteTransform(e).getMatrix();a.transform(s[0],s[1],s[2],s[3],s[4],s[5]),this._drawCachedHitCanvas(a),a.restore()}else this._drawChildren("drawHit",r,e);return this}_drawChildren(t,e,i,r){var a,n=e&&e.getContext(),s=this.clipWidth(),o=this.clipHeight(),h=this.clipFunc(),l="number"==typeof s&&"number"==typeof o||h;const d=i===this;if(l){n.save();var c=this.getAbsoluteTransform(i),g=c.getMatrix();let t;if(n.transform(g[0],g[1],g[2],g[3],g[4],g[5]),n.beginPath(),h)t=h.call(this,n,this);else{var u=this.clipX(),f=this.clipY();n.rect(u||0,f||0,s,o)}n.clip.apply(n,t),g=c.copy().invert().getMatrix(),n.transform(g[0],g[1],g[2],g[3],g[4],g[5])}var p=!d&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===t;p&&(n.save(),n._applyGlobalCompositeOperation(this)),null===(a=this.children)||void 0===a||a.forEach((function(a){a[t](e,i,r)})),p&&n.restore(),l&&n.restore()}getClientRect(t={}){var e,i,r,a,n,s=t.skipTransform,o=t.relativeTo,h={x:1/0,y:1/0,width:0,height:0},l=this;null===(e=this.children)||void 0===e||e.forEach((function(e){if(e.visible()){var s=e.getClientRect({relativeTo:l,skipShadow:t.skipShadow,skipStroke:t.skipStroke});0===s.width&&0===s.height||(void 0===i?(i=s.x,r=s.y,a=s.x+s.width,n=s.y+s.height):(i=Math.min(i,s.x),r=Math.min(r,s.y),a=Math.max(a,s.x+s.width),n=Math.max(n,s.y+s.height)))}}));for(var d=this.find("Shape"),c=!1,g=0;g<d.length;g++){if(d[g]._isVisible(this)){c=!0;break}}return h=c&&void 0!==i?{x:i,y:r,width:a-i,height:n-r}:{x:0,y:0,width:0,height:0},s?h:this._transformedRect(h,o)}}w.addComponentsGetterSetter(Q,"clip",["x","y","width","height"]),w.addGetterSetter(Q,"clipX",void 0,p()),w.addGetterSetter(Q,"clipY",void 0,p()),w.addGetterSetter(Q,"clipWidth",void 0,p()),w.addGetterSetter(Q,"clipHeight",void 0,p()),w.addGetterSetter(Q,"clipFunc");const J=new Map,$=void 0!==i._global.PointerEvent;function Z(t){return J.get(t)}function tt(t){return{evt:t,pointerId:t.pointerId}}function et(t,e){return J.get(t)===e}function it(t,e){rt(t);e.getStage()&&(J.set(t,e),$&&e._fire("gotpointercapture",tt(new PointerEvent("gotpointercapture"))))}function rt(t,e){const i=J.get(t);if(!i)return;const r=i.getStage();r&&r.content,J.delete(t),$&&i._fire("lostpointercapture",tt(new PointerEvent("lostpointercapture")))}var at="mouseleave",nt="mouseover",st="mouseenter",ot="mousemove",ht="mousedown",lt="mouseup",dt="pointermove",ct="pointerdown",gt="pointerup",ut="pointercancel",ft="pointerout",pt="pointerleave",vt="pointerover",mt="pointerenter",_t="contextmenu",yt="touchstart",xt="touchend",bt="touchmove",St="touchcancel",wt="wheel",Ct=[[st,"_pointerenter"],[ht,"_pointerdown"],[ot,"_pointermove"],[lt,"_pointerup"],[at,"_pointerleave"],[yt,"_pointerdown"],[bt,"_pointermove"],[xt,"_pointerup"],[St,"_pointercancel"],[nt,"_pointerover"],[wt,"_wheel"],[_t,"_contextmenu"],[ct,"_pointerdown"],[dt,"_pointermove"],[gt,"_pointerup"],[ut,"_pointercancel"],["lostpointercapture","_lostpointercapture"]];const Pt={mouse:{[ft]:"mouseout",[pt]:at,[vt]:nt,[mt]:st,[dt]:ot,[ct]:ht,[gt]:lt,[ut]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[ft]:"touchout",[pt]:"touchleave",[vt]:"touchover",[mt]:"touchenter",[dt]:bt,[ct]:yt,[gt]:xt,[ut]:St,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[ft]:ft,[pt]:pt,[vt]:vt,[mt]:mt,[dt]:dt,[ct]:ct,[gt]:gt,[ut]:ut,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},kt=t=>t.indexOf("pointer")>=0?"pointer":t.indexOf("touch")>=0?"touch":"mouse",At=t=>{const e=kt(t);return"pointer"===e?i.pointerEventsEnabled&&Pt.pointer:"touch"===e?Pt.touch:"mouse"===e?Pt.mouse:void 0};function Tt(t={}){return(t.clipFunc||t.clipWidth||t.clipHeight)&&g.warn("Stage does not support clipping. Please use clip for Layers or Groups."),t}const Mt=[];class Gt extends Q{constructor(t){super(Tt(t)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),Mt.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",(()=>{Tt(this.attrs)})),this._checkVisibility()}_validateAdd(t){const e="Layer"===t.getType(),i="FastLayer"===t.getType();e||i||g.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const t=this.visible()?"":"none";this.content.style.display=t}setContainer(t){if("string"==typeof t){if("."===t.charAt(0)){var e=t.slice(1);t=document.getElementsByClassName(e)[0]}else{var i;i="#"!==t.charAt(0)?t:t.slice(1),t=document.getElementById(i)}if(!t)throw"Can not find container in document with id "+i}return this._setAttr("container",t),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),t.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var t,e=this.children,i=e.length;for(t=0;t<i;t++)e[t].clear();return this}clone(t){return t||(t={}),t.container="undefined"!=typeof document&&document.createElement("div"),Q.prototype.clone.call(this,t)}destroy(){super.destroy();var t=this.content;t&&g._isInDocument(t)&&this.container().removeChild(t);var e=Mt.indexOf(this);return e>-1&&Mt.splice(e,1),g.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const t=this._pointerPositions[0]||this._changedPointerPositions[0];return t?{x:t.x,y:t.y}:(g.warn("Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);"),null)}_getPointerById(t){return this._pointerPositions.find((e=>e.id===t))}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(t){(t=t||{}).x=t.x||0,t.y=t.y||0,t.width=t.width||this.width(),t.height=t.height||this.height();var e=new G({width:t.width,height:t.height,pixelRatio:t.pixelRatio||1}),i=e.getContext()._context,r=this.children;return(t.x||t.y)&&i.translate(-1*t.x,-1*t.y),r.forEach((function(e){if(e.isVisible()){var r=e._toKonvaCanvas(t);i.drawImage(r._canvas,t.x,t.y,r.getWidth()/r.getPixelRatio(),r.getHeight()/r.getPixelRatio())}})),e}getIntersection(t){if(!t)return null;var e,i=this.children;for(e=i.length-1;e>=0;e--){const r=i[e].getIntersection(t);if(r)return r}return null}_resizeDOM(){var t=this.width(),e=this.height();this.content&&(this.content.style.width=t+"px",this.content.style.height=e+"px"),this.bufferCanvas.setSize(t,e),this.bufferHitCanvas.setSize(t,e),this.children.forEach((i=>{i.setSize({width:t,height:e}),i.draw()}))}add(t,...e){if(arguments.length>1){for(var r=0;r<arguments.length;r++)this.add(arguments[r]);return this}super.add(t);var a=this.children.length;return a>5&&g.warn("The stage has "+a+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),t.setSize({width:this.width(),height:this.height()}),t.draw(),i.isBrowser&&this.content.appendChild(t.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(t){return et(t,this)}setPointerCapture(t){it(t,this)}releaseCapture(t){rt(t)}getLayers(){return this.children}_bindContentEvents(){i.isBrowser&&Ct.forEach((([t,e])=>{this.content.addEventListener(t,(t=>{this[e](t)}),{passive:!1})}))}_pointerenter(t){this.setPointersPositions(t);const e=At(t.type);e&&this._fire(e.pointerenter,{evt:t,target:this,currentTarget:this})}_pointerover(t){this.setPointersPositions(t);const e=At(t.type);e&&this._fire(e.pointerover,{evt:t,target:this,currentTarget:this})}_getTargetShape(t){let e=this[t+"targetShape"];return e&&!e.getStage()&&(e=null),e}_pointerleave(t){const e=At(t.type),r=kt(t.type);if(e){this.setPointersPositions(t);var a=this._getTargetShape(r),n=!(i.isDragging()||i.isTransforming())||i.hitOnDragEnabled;a&&n?(a._fireAndBubble(e.pointerout,{evt:t}),a._fireAndBubble(e.pointerleave,{evt:t}),this._fire(e.pointerleave,{evt:t,target:this,currentTarget:this}),this[r+"targetShape"]=null):n&&(this._fire(e.pointerleave,{evt:t,target:this,currentTarget:this}),this._fire(e.pointerout,{evt:t,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}}_pointerdown(t){const e=At(t.type),r=kt(t.type);if(e){this.setPointersPositions(t);var a=!1;this._changedPointerPositions.forEach((n=>{var s=this.getIntersection(n);if(E.justDragged=!1,i["_"+r+"ListenClick"]=!0,!s||!s.isListening())return void(this[r+"ClickStartShape"]=void 0);i.capturePointerEventsEnabled&&s.setPointerCapture(n.id),this[r+"ClickStartShape"]=s,s._fireAndBubble(e.pointerdown,{evt:t,pointerId:n.id}),a=!0;const o=t.type.indexOf("touch")>=0;s.preventDefault()&&t.cancelable&&o&&t.preventDefault()})),a||this._fire(e.pointerdown,{evt:t,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(t){const e=At(t.type),r=kt(t.type);if(!e)return;if(i.isDragging()&&E.node.preventDefault()&&t.cancelable&&t.preventDefault(),this.setPointersPositions(t),!(!(i.isDragging()||i.isTransforming())||i.hitOnDragEnabled))return;var a={};let n=!1;var s=this._getTargetShape(r);this._changedPointerPositions.forEach((i=>{const o=Z(i.id)||this.getIntersection(i),h=i.id,l={evt:t,pointerId:h};var d=s!==o;if(d&&s&&(s._fireAndBubble(e.pointerout,{...l},o),s._fireAndBubble(e.pointerleave,{...l},o)),o){if(a[o._id])return;a[o._id]=!0}o&&o.isListening()?(n=!0,d&&(o._fireAndBubble(e.pointerover,{...l},s),o._fireAndBubble(e.pointerenter,{...l},s),this[r+"targetShape"]=o),o._fireAndBubble(e.pointermove,{...l})):s&&(this._fire(e.pointerover,{evt:t,target:this,currentTarget:this,pointerId:h}),this[r+"targetShape"]=null)})),n||this._fire(e.pointermove,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(t){const e=At(t.type),r=kt(t.type);if(!e)return;this.setPointersPositions(t);const a=this[r+"ClickStartShape"],n=this[r+"ClickEndShape"];var s={};let o=!1;this._changedPointerPositions.forEach((h=>{const l=Z(h.id)||this.getIntersection(h);if(l){if(l.releaseCapture(h.id),s[l._id])return;s[l._id]=!0}const d=h.id,c={evt:t,pointerId:d};let g=!1;i["_"+r+"InDblClickWindow"]?(g=!0,clearTimeout(this[r+"DblTimeout"])):E.justDragged||(i["_"+r+"InDblClickWindow"]=!0,clearTimeout(this[r+"DblTimeout"])),this[r+"DblTimeout"]=setTimeout((function(){i["_"+r+"InDblClickWindow"]=!1}),i.dblClickWindow),l&&l.isListening()?(o=!0,this[r+"ClickEndShape"]=l,l._fireAndBubble(e.pointerup,{...c}),i["_"+r+"ListenClick"]&&a&&a===l&&(l._fireAndBubble(e.pointerclick,{...c}),g&&n&&n===l&&l._fireAndBubble(e.pointerdblclick,{...c}))):(this[r+"ClickEndShape"]=null,i["_"+r+"ListenClick"]&&this._fire(e.pointerclick,{evt:t,target:this,currentTarget:this,pointerId:d}),g&&this._fire(e.pointerdblclick,{evt:t,target:this,currentTarget:this,pointerId:d}))})),o||this._fire(e.pointerup,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i["_"+r+"ListenClick"]=!1,t.cancelable&&"touch"!==r&&t.preventDefault()}_contextmenu(t){this.setPointersPositions(t);var e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble(_t,{evt:t}):this._fire(_t,{evt:t,target:this,currentTarget:this})}_wheel(t){this.setPointersPositions(t);var e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble(wt,{evt:t}):this._fire(wt,{evt:t,target:this,currentTarget:this})}_pointercancel(t){this.setPointersPositions(t);const e=Z(t.pointerId)||this.getIntersection(this.getPointerPosition());e&&e._fireAndBubble(gt,tt(t)),rt(t.pointerId)}_lostpointercapture(t){rt(t.pointerId)}setPointersPositions(t){var e=this._getContentPosition(),i=null,r=null;void 0!==(t=t||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(t.touches,(t=>{this._pointerPositions.push({id:t.identifier,x:(t.clientX-e.left)/e.scaleX,y:(t.clientY-e.top)/e.scaleY})})),Array.prototype.forEach.call(t.changedTouches||t.touches,(t=>{this._changedPointerPositions.push({id:t.identifier,x:(t.clientX-e.left)/e.scaleX,y:(t.clientY-e.top)/e.scaleY})}))):(i=(t.clientX-e.left)/e.scaleX,r=(t.clientY-e.top)/e.scaleY,this.pointerPos={x:i,y:r},this._pointerPositions=[{x:i,y:r,id:g._getFirstPointerId(t)}],this._changedPointerPositions=[{x:i,y:r,id:g._getFirstPointerId(t)}])}_setPointerPosition(t){g.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(t)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var t=this.content.getBoundingClientRect();return{top:t.top,left:t.left,scaleX:t.width/this.content.clientWidth||1,scaleY:t.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new G({width:this.width(),height:this.height()}),this.bufferHitCanvas=new R({pixelRatio:1,width:this.width(),height:this.height()}),i.isBrowser){var t=this.container();if(!t)throw"Stage has no container. A container is required.";t.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),t.appendChild(this.content),this._resizeDOM()}}cache(){return g.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach((function(t){t.batchDraw()})),this}}Gt.prototype.nodeType="Stage",r(Gt),w.addGetterSetter(Gt,"container"),i.isBrowser&&document.addEventListener("visibilitychange",(()=>{Mt.forEach((t=>{t.batchDraw()}))}));var Rt="hasShadow",Et="shadowRGBA",Dt="patternImage",Lt="linearGradient",Ot="radialGradient";let It;function Ft(){return It||(It=g.createCanvasElement().getContext("2d"),It)}const Bt={};class Nt extends V{constructor(t){let e;for(super(t);e=g.getRandomColor(),!e||e in Bt;);this.colorKey=e,Bt[e]=this}getContext(){return g.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return g.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(Rt,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(Dt,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const t=Ft().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(t&&t.setTransform){const e=new a;e.translate(this.fillPatternX(),this.fillPatternY()),e.rotate(i.getAngle(this.fillPatternRotation())),e.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),e.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const r=e.getMatrix(),n="undefined"==typeof DOMMatrix?{a:r[0],b:r[1],c:r[2],d:r[3],e:r[4],f:r[5]}:new DOMMatrix(r);t.setTransform(n)}return t}}_getLinearGradient(){return this._getCache(Lt,this.__getLinearGradient)}__getLinearGradient(){var t=this.fillLinearGradientColorStops();if(t){for(var e=Ft(),i=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),a=e.createLinearGradient(i.x,i.y,r.x,r.y),n=0;n<t.length;n+=2)a.addColorStop(t[n],t[n+1]);return a}}_getRadialGradient(){return this._getCache(Ot,this.__getRadialGradient)}__getRadialGradient(){var t=this.fillRadialGradientColorStops();if(t){for(var e=Ft(),i=this.fillRadialGradientStartPoint(),r=this.fillRadialGradientEndPoint(),a=e.createRadialGradient(i.x,i.y,this.fillRadialGradientStartRadius(),r.x,r.y,this.fillRadialGradientEndRadius()),n=0;n<t.length;n+=2)a.addColorStop(t[n],t[n+1]);return a}}getShadowRGBA(){return this._getCache(Et,this._getShadowRGBA)}_getShadowRGBA(){if(this.hasShadow()){var t=g.colorToRGBA(this.shadowColor());return t?"rgba("+t.r+","+t.g+","+t.b+","+t.a*(this.shadowOpacity()||1)+")":void 0}}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],(()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops())))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],(()=>this.strokeEnabled()&&this.strokeWidth()&&!(!this.stroke()&&!this.strokeLinearGradientColorStops())))}hasHitStroke(){const t=this.hitStrokeWidth();return"auto"===t?this.hasStroke():this.strokeEnabled()&&!!t}intersects(t){var e=this.getStage();if(!e)return!1;const i=e.bufferHitCanvas;i.getContext().clear(),this.drawHit(i,void 0,!0);return i.context.getImageData(Math.round(t.x),Math.round(t.y),1,1).data[3]>0}destroy(){return V.prototype.destroy.call(this),delete Bt[this.colorKey],delete this.colorKey,this}_useBufferCanvas(t){var e;if(!(null===(e=this.attrs.perfectDrawEnabled)||void 0===e||e))return!1;const i=t||this.hasFill(),r=this.hasStroke(),a=1!==this.getAbsoluteOpacity();if(i&&r&&a)return!0;const n=this.hasShadow(),s=this.shadowForStrokeEnabled();return!!(i&&r&&n&&s)}setStrokeHitEnabled(t){g.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),t?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){var t=this.size();return{x:this._centroid?-t.width/2:0,y:this._centroid?-t.height/2:0,width:t.width,height:t.height}}getClientRect(t={}){let e=!1,i=this.getParent();for(;i;){if(i.isCached()){e=!0;break}i=i.getParent()}const r=t.skipTransform,a=t.relativeTo||e&&this.getStage()||void 0,n=this.getSelfRect(),s=!t.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,o=n.width+s,h=n.height+s,l=!t.skipShadow&&this.hasShadow(),d=l?this.shadowOffsetX():0,c=l?this.shadowOffsetY():0,g=o+Math.abs(d),u=h+Math.abs(c),f=l&&this.shadowBlur()||0,p={width:g+2*f,height:u+2*f,x:-(s/2+f)+Math.min(d,0)+n.x,y:-(s/2+f)+Math.min(c,0)+n.y};return r?p:this._transformedRect(p,a)}drawScene(t,e,i){var r,a,n=this.getLayer(),s=t||n.getCanvas(),o=s.getContext(),h=this._getCanvasCache(),l=this.getSceneFunc(),d=this.hasShadow(),c=s.isCache,g=e===this;if(!this.isVisible()&&!g)return this;if(h){o.save();var u=this.getAbsoluteTransform(e).getMatrix();return o.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(o),o.restore(),this}if(!l)return this;if(o.save(),this._useBufferCanvas()&&!c){r=this.getStage();const t=i||r.bufferCanvas;(a=t.getContext()).clear(),a.save(),a._applyLineJoin(this);var f=this.getAbsoluteTransform(e).getMatrix();a.transform(f[0],f[1],f[2],f[3],f[4],f[5]),l.call(this,a,this),a.restore();var p=t.pixelRatio;d&&o._applyShadow(this),o._applyOpacity(this),o._applyGlobalCompositeOperation(this),o.drawImage(t._canvas,0,0,t.width/p,t.height/p)}else{if(o._applyLineJoin(this),!g){f=this.getAbsoluteTransform(e).getMatrix();o.transform(f[0],f[1],f[2],f[3],f[4],f[5]),o._applyOpacity(this),o._applyGlobalCompositeOperation(this)}d&&o._applyShadow(this),l.call(this,o,this)}return o.restore(),this}drawHit(t,e,i=!1){if(!this.shouldDrawHit(e,i))return this;var r=this.getLayer(),a=t||r.hitCanvas,n=a&&a.getContext(),s=this.hitFunc()||this.sceneFunc(),o=this._getCanvasCache(),h=o&&o.hit;if(this.colorKey||g.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),h){n.save();var l=this.getAbsoluteTransform(e).getMatrix();return n.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(n),n.restore(),this}if(!s)return this;n.save(),n._applyLineJoin(this);if(!(this===e)){var d=this.getAbsoluteTransform(e).getMatrix();n.transform(d[0],d[1],d[2],d[3],d[4],d[5])}return s.call(this,n,this),n.restore(),this}drawHitFromCache(t=0){var e,i,r,a,n,s=this._getCanvasCache(),o=this._getCachedSceneCanvas(),h=s.hit,l=h.getContext(),d=h.getWidth(),c=h.getHeight();l.clear(),l.drawImage(o._canvas,0,0,d,c);try{for(r=(i=(e=l.getImageData(0,0,d,c)).data).length,a=g._hexToRgb(this.colorKey),n=0;n<r;n+=4)i[n+3]>t?(i[n]=a.r,i[n+1]=a.g,i[n+2]=a.b,i[n+3]=255):i[n+3]=0;l.putImageData(e,0,0)}catch(t){g.error("Unable to draw hit graph from cached scene canvas. "+t.message)}return this}hasPointerCapture(t){return et(t,this)}setPointerCapture(t){it(t,this)}releaseCapture(t){rt(t)}}Nt.prototype._fillFunc=function(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()},Nt.prototype._strokeFunc=function(t){t.stroke()},Nt.prototype._fillFuncHit=function(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()},Nt.prototype._strokeFuncHit=function(t){t.stroke()},Nt.prototype._centroid=!1,Nt.prototype.nodeType="Shape",r(Nt),Nt.prototype.eventListeners={},Nt.prototype.on.call(Nt.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(Rt)})),Nt.prototype.on.call(Nt.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(Et)})),Nt.prototype.on.call(Nt.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",(function(){this._clearCache(Dt)})),Nt.prototype.on.call(Nt.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",(function(){this._clearCache(Lt)})),Nt.prototype.on.call(Nt.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",(function(){this._clearCache(Ot)})),w.addGetterSetter(Nt,"stroke",void 0,y()),w.addGetterSetter(Nt,"strokeWidth",2,p()),w.addGetterSetter(Nt,"fillAfterStrokeEnabled",!1),w.addGetterSetter(Nt,"hitStrokeWidth","auto",m()),w.addGetterSetter(Nt,"strokeHitEnabled",!0,x()),w.addGetterSetter(Nt,"perfectDrawEnabled",!0,x()),w.addGetterSetter(Nt,"shadowForStrokeEnabled",!0,x()),w.addGetterSetter(Nt,"lineJoin"),w.addGetterSetter(Nt,"lineCap"),w.addGetterSetter(Nt,"sceneFunc"),w.addGetterSetter(Nt,"hitFunc"),w.addGetterSetter(Nt,"dash"),w.addGetterSetter(Nt,"dashOffset",0,p()),w.addGetterSetter(Nt,"shadowColor",void 0,_()),w.addGetterSetter(Nt,"shadowBlur",0,p()),w.addGetterSetter(Nt,"shadowOpacity",1,p()),w.addComponentsGetterSetter(Nt,"shadowOffset",["x","y"]),w.addGetterSetter(Nt,"shadowOffsetX",0,p()),w.addGetterSetter(Nt,"shadowOffsetY",0,p()),w.addGetterSetter(Nt,"fillPatternImage"),w.addGetterSetter(Nt,"fill",void 0,y()),w.addGetterSetter(Nt,"fillPatternX",0,p()),w.addGetterSetter(Nt,"fillPatternY",0,p()),w.addGetterSetter(Nt,"fillLinearGradientColorStops"),w.addGetterSetter(Nt,"strokeLinearGradientColorStops"),w.addGetterSetter(Nt,"fillRadialGradientStartRadius",0),w.addGetterSetter(Nt,"fillRadialGradientEndRadius",0),w.addGetterSetter(Nt,"fillRadialGradientColorStops"),w.addGetterSetter(Nt,"fillPatternRepeat","repeat"),w.addGetterSetter(Nt,"fillEnabled",!0),w.addGetterSetter(Nt,"strokeEnabled",!0),w.addGetterSetter(Nt,"shadowEnabled",!0),w.addGetterSetter(Nt,"dashEnabled",!0),w.addGetterSetter(Nt,"strokeScaleEnabled",!0),w.addGetterSetter(Nt,"fillPriority","color"),w.addComponentsGetterSetter(Nt,"fillPatternOffset",["x","y"]),w.addGetterSetter(Nt,"fillPatternOffsetX",0,p()),w.addGetterSetter(Nt,"fillPatternOffsetY",0,p()),w.addComponentsGetterSetter(Nt,"fillPatternScale",["x","y"]),w.addGetterSetter(Nt,"fillPatternScaleX",1,p()),w.addGetterSetter(Nt,"fillPatternScaleY",1,p()),w.addComponentsGetterSetter(Nt,"fillLinearGradientStartPoint",["x","y"]),w.addComponentsGetterSetter(Nt,"strokeLinearGradientStartPoint",["x","y"]),w.addGetterSetter(Nt,"fillLinearGradientStartPointX",0),w.addGetterSetter(Nt,"strokeLinearGradientStartPointX",0),w.addGetterSetter(Nt,"fillLinearGradientStartPointY",0),w.addGetterSetter(Nt,"strokeLinearGradientStartPointY",0),w.addComponentsGetterSetter(Nt,"fillLinearGradientEndPoint",["x","y"]),w.addComponentsGetterSetter(Nt,"strokeLinearGradientEndPoint",["x","y"]),w.addGetterSetter(Nt,"fillLinearGradientEndPointX",0),w.addGetterSetter(Nt,"strokeLinearGradientEndPointX",0),w.addGetterSetter(Nt,"fillLinearGradientEndPointY",0),w.addGetterSetter(Nt,"strokeLinearGradientEndPointY",0),w.addComponentsGetterSetter(Nt,"fillRadialGradientStartPoint",["x","y"]),w.addGetterSetter(Nt,"fillRadialGradientStartPointX",0),w.addGetterSetter(Nt,"fillRadialGradientStartPointY",0),w.addComponentsGetterSetter(Nt,"fillRadialGradientEndPoint",["x","y"]),w.addGetterSetter(Nt,"fillRadialGradientEndPointX",0),w.addGetterSetter(Nt,"fillRadialGradientEndPointY",0),w.addGetterSetter(Nt,"fillPatternRotation",0),w.addGetterSetter(Nt,"fillRule",void 0,_()),w.backCompat(Nt,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var Ht=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],Wt=Ht.length;class zt extends Q{constructor(t){super(t),this.canvas=new G,this.hitCanvas=new R({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),t<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[t+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){V.prototype.moveToTop.call(this);var t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!V.prototype.moveUp.call(this))return!1;var t=this.getStage();return!(!t||!t.content)&&(t.content.removeChild(this.getNativeCanvasElement()),this.index<t.children.length-1?t.content.insertBefore(this.getNativeCanvasElement(),t.children[this.index+1].getCanvas()._canvas):t.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(V.prototype.moveDown.call(this)){var t=this.getStage();if(t){var e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(V.prototype.moveToBottom.call(this)){var t=this.getStage();if(t){var e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){var t=this.getNativeCanvasElement();return V.prototype.remove.call(this),t&&t.parentNode&&g._isInDocument(t)&&t.parentNode.removeChild(t),this}getStage(){return this.parent}setSize({width:t,height:e}){return this.canvas.setSize(t,e),this.hitCanvas.setSize(t,e),this._setSmoothEnabled(),this}_validateAdd(t){var e=t.getType();"Group"!==e&&"Shape"!==e&&g.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(t){return(t=t||{}).width=t.width||this.getWidth(),t.height=t.height||this.getHeight(),t.x=void 0!==t.x?t.x:this.x(),t.y=void 0!==t.y?t.y:this.y(),V.prototype._toKonvaCanvas.call(this,t)}_checkVisibility(){const t=this.visible();this.canvas._canvas.style.display=t?"block":"none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){g.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){g.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,g.requestAnimFrame((()=>{this.draw(),this._waitingForDraw=!1}))),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var e=1,i=!1;;){for(let r=0;r<Wt;r++){const a=Ht[r],n=this._getIntersection({x:t.x+a.x*e,y:t.y+a.y*e}),s=n.shape;if(s)return s;if(i=!!n.antialiased,!n.antialiased)break}if(!i)return null;e+=1}}_getIntersection(t){const e=this.hitCanvas.pixelRatio,i=this.hitCanvas.context.getImageData(Math.round(t.x*e),Math.round(t.y*e),1,1).data,r=i[3];if(255===r){const t=g._rgbToHex(i[0],i[1],i[2]),e=Bt["#"+t];return e?{shape:e}:{antialiased:!0}}return r>0?{antialiased:!0}:{}}drawScene(t,e){var i=this.getLayer(),r=t||i&&i.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),Q.prototype.drawScene.call(this,r,e),this._fire("draw",{node:this}),this}drawHit(t,e){var i=this.getLayer(),r=t||i&&i.hitCanvas;return i&&i.clearBeforeDraw()&&i.getHitCanvas().getContext().clear(),Q.prototype.drawHit.call(this,r,e),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){g.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return g.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(this.parent&&this.parent.content){var t=this.parent;!!this.hitCanvas._canvas.parentNode?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}destroy(){return g.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}zt.prototype.nodeType="Layer",r(zt),w.addGetterSetter(zt,"imageSmoothingEnabled",!0),w.addGetterSetter(zt,"clearBeforeDraw",!0),w.addGetterSetter(zt,"hitGraphEnabled",!0,x());class Yt extends zt{constructor(t){super(t),this.listening(!1),g.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}Yt.prototype.nodeType="FastLayer",r(Yt);class Xt extends Q{_validateAdd(t){var e=t.getType();"Group"!==e&&"Shape"!==e&&g.throw("You may only add groups and shapes to groups.")}}Xt.prototype.nodeType="Group",r(Xt);const qt=e.performance&&e.performance.now?function(){return e.performance.now()}:function(){return(new Date).getTime()};class jt{constructor(t,e){this.id=jt.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:qt(),frameRate:0},this.func=t,this.setLayers(e)}setLayers(t){let e=[];return t&&(e=Array.isArray(t)?t:[t]),this.layers=e,this}getLayers(){return this.layers}addLayer(t){const e=this.layers,i=e.length;for(let r=0;r<i;r++)if(e[r]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){const t=jt.animations,e=t.length;for(let i=0;i<e;i++)if(t[i].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=qt(),jt._addAnimation(this),this}stop(){return jt._removeAnimation(this),this}_updateFrameObject(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(t){this.animations.push(t),this._handleAnimation()}static _removeAnimation(t){const e=t.id,i=this.animations,r=i.length;for(let t=0;t<r;t++)if(i[t].id===e){this.animations.splice(t,1);break}}static _runFrames(){const t={},e=this.animations;for(let i=0;i<e.length;i++){const r=e[i],a=r.layers,n=r.func;r._updateFrameObject(qt());const s=a.length;let o;if(o=!n||!1!==n.call(r,r.frame),o)for(let e=0;e<s;e++){const i=a[e];void 0!==i._id&&(t[i._id]=i)}}for(let e in t)t.hasOwnProperty(e)&&t[e].batchDraw()}static _animationLoop(){const t=jt;t.animations.length?(t._runFrames(),g.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,g.requestAnimFrame(this._animationLoop))}}jt.animations=[],jt.animIdCounter=0,jt.animRunning=!1;var Ut={node:1,duration:1,easing:1,onFinish:1,yoyo:1},Vt=0,Kt=["fill","stroke","shadowColor"];class Qt{constructor(t,e,i,r,a,n,s){this.prop=t,this.propFunc=e,this.begin=r,this._pos=r,this.duration=n,this._change=0,this.prevPos=0,this.yoyo=s,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=i,this._change=a-this.begin,this.pause()}fire(t){var e=this[t];e&&e()}setTime(t){t>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():t<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=t,this.update())}getTime(){return this._time}setPosition(t){this.prevPos=this._pos,this.propFunc(t),this._pos=t}getPosition(t){return void 0===t&&(t=this._time),this.func(t,this.begin,this._change,this.duration)}play(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=3,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(t){this.pause(),this._time=t,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var t=this.getTimer()-this._startTime;2===this.state?this.setTime(t):3===this.state&&this.setTime(this.duration-t)}pause(){this.state=1,this.fire("onPause")}getTimer(){return(new Date).getTime()}}class Jt{constructor(t){var e,r,a=this,n=t.node,s=n._id,o=t.easing||$t.Linear,h=!!t.yoyo;e=void 0===t.duration?.3:0===t.duration?.001:t.duration,this.node=n,this._id=Vt++;var l=n.getLayer()||(n instanceof i.Stage?n.getLayers():null);for(r in l||g.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new jt((function(){a.tween.onEnterFrame()}),l),this.tween=new Qt(r,(function(t){a._tweenFunc(t)}),o,0,1,1e3*e,h),this._addListeners(),Jt.attrs[s]||(Jt.attrs[s]={}),Jt.attrs[s][this._id]||(Jt.attrs[s][this._id]={}),Jt.tweens[s]||(Jt.tweens[s]={}),t)void 0===Ut[r]&&this._addAttr(r,t[r]);this.reset(),this.onFinish=t.onFinish,this.onReset=t.onReset,this.onUpdate=t.onUpdate}_addAttr(t,e){var i,r,a,n,s,o,h,l,d=this.node,c=d._id;if((a=Jt.tweens[c][t])&&delete Jt.attrs[c][a][t],i=d.getAttr(t),g._isArray(e))if(r=[],s=Math.max(e.length,i.length),"points"===t&&e.length!==i.length&&(e.length>i.length?(h=i,i=g._prepareArrayForTween(i,e,d.closed())):(o=e,e=g._prepareArrayForTween(e,i,d.closed()))),0===t.indexOf("fill"))for(n=0;n<s;n++)if(n%2==0)r.push(e[n]-i[n]);else{var u=g.colorToRGBA(i[n]);l=g.colorToRGBA(e[n]),i[n]=u,r.push({r:l.r-u.r,g:l.g-u.g,b:l.b-u.b,a:l.a-u.a})}else for(n=0;n<s;n++)r.push(e[n]-i[n]);else-1!==Kt.indexOf(t)?(i=g.colorToRGBA(i),r={r:(l=g.colorToRGBA(e)).r-i.r,g:l.g-i.g,b:l.b-i.b,a:l.a-i.a}):r=e-i;Jt.attrs[c][this._id][t]={start:i,diff:r,end:e,trueEnd:o,trueStart:h},Jt.tweens[c][t]=this._id}_tweenFunc(t){var e,i,r,a,n,s,o,h,l=this.node,d=Jt.attrs[l._id][this._id];for(e in d){if(r=(i=d[e]).start,a=i.diff,h=i.end,g._isArray(r))if(n=[],o=Math.max(r.length,h.length),0===e.indexOf("fill"))for(s=0;s<o;s++)s%2==0?n.push((r[s]||0)+a[s]*t):n.push("rgba("+Math.round(r[s].r+a[s].r*t)+","+Math.round(r[s].g+a[s].g*t)+","+Math.round(r[s].b+a[s].b*t)+","+(r[s].a+a[s].a*t)+")");else for(s=0;s<o;s++)n.push((r[s]||0)+a[s]*t);else n=-1!==Kt.indexOf(e)?"rgba("+Math.round(r.r+a.r*t)+","+Math.round(r.g+a.g*t)+","+Math.round(r.b+a.b*t)+","+(r.a+a.a*t)+")":r+a*t;l.setAttr(e,n)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var t=this.node,e=Jt.attrs[t._id][this._id];e.points&&e.points.trueEnd&&t.setAttr("points",e.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var t=this.node,e=Jt.attrs[t._id][this._id];e.points&&e.points.trueStart&&t.points(e.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(t){return this.tween.seek(1e3*t),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var t,e=this.node._id,i=this._id,r=Jt.tweens[e];for(t in this.pause(),r)delete Jt.tweens[e][t];delete Jt.attrs[e][i]}}Jt.attrs={},Jt.tweens={},V.prototype.to=function(t){var e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()},new Jt(t).play()};const $t={BackEaseIn(t,e,i,r){var a=1.70158;return i*(t/=r)*t*((a+1)*t-a)+e},BackEaseOut(t,e,i,r){var a=1.70158;return i*((t=t/r-1)*t*((a+1)*t+a)+1)+e},BackEaseInOut(t,e,i,r){var a=1.70158;return(t/=r/2)<1?i/2*(t*t*((1+(a*=1.525))*t-a))+e:i/2*((t-=2)*t*((1+(a*=1.525))*t+a)+2)+e},ElasticEaseIn(t,e,i,r,a,n){var s=0;return 0===t?e:1==(t/=r)?e+i:(n||(n=.3*r),!a||a<Math.abs(i)?(a=i,s=n/4):s=n/(2*Math.PI)*Math.asin(i/a),-a*Math.pow(2,10*(t-=1))*Math.sin((t*r-s)*(2*Math.PI)/n)+e)},ElasticEaseOut(t,e,i,r,a,n){var s=0;return 0===t?e:1==(t/=r)?e+i:(n||(n=.3*r),!a||a<Math.abs(i)?(a=i,s=n/4):s=n/(2*Math.PI)*Math.asin(i/a),a*Math.pow(2,-10*t)*Math.sin((t*r-s)*(2*Math.PI)/n)+i+e)},ElasticEaseInOut(t,e,i,r,a,n){var s=0;return 0===t?e:2==(t/=r/2)?e+i:(n||(n=r*(.3*1.5)),!a||a<Math.abs(i)?(a=i,s=n/4):s=n/(2*Math.PI)*Math.asin(i/a),t<1?a*Math.pow(2,10*(t-=1))*Math.sin((t*r-s)*(2*Math.PI)/n)*-.5+e:a*Math.pow(2,-10*(t-=1))*Math.sin((t*r-s)*(2*Math.PI)/n)*.5+i+e)},BounceEaseOut:(t,e,i,r)=>(t/=r)<1/2.75?i*(7.5625*t*t)+e:t<2/2.75?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e,BounceEaseIn:(t,e,i,r)=>i-$t.BounceEaseOut(r-t,0,i,r)+e,BounceEaseInOut:(t,e,i,r)=>t<r/2?.5*$t.BounceEaseIn(2*t,0,i,r)+e:.5*$t.BounceEaseOut(2*t-r,0,i,r)+.5*i+e,EaseIn:(t,e,i,r)=>i*(t/=r)*t+e,EaseOut:(t,e,i,r)=>-i*(t/=r)*(t-2)+e,EaseInOut:(t,e,i,r)=>(t/=r/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e,StrongEaseIn:(t,e,i,r)=>i*(t/=r)*t*t*t*t+e,StrongEaseOut:(t,e,i,r)=>i*((t=t/r-1)*t*t*t*t+1)+e,StrongEaseInOut:(t,e,i,r)=>(t/=r/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e,Linear:(t,e,i,r)=>i*t/r+e},Zt=g._assign(i,{Util:g,Transform:a,Node:V,Container:Q,Stage:Gt,stages:Mt,Layer:zt,FastLayer:Yt,Group:Xt,DD:E,Shape:Nt,shapes:Bt,Animation:jt,Tween:Jt,Easings:$t,Context:P,Canvas:M});class te extends Nt{_sceneFunc(t){var e=i.getAngle(this.angle()),r=this.clockwise();t.beginPath(),t.arc(0,0,this.outerRadius(),0,e,r),t.arc(0,0,this.innerRadius(),e,0,!r),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}getSelfRect(){const t=this.innerRadius(),e=this.outerRadius(),r=this.clockwise(),a=i.getAngle(r?360-this.angle():this.angle()),n=Math.cos(Math.min(a,Math.PI)),s=Math.sin(Math.min(Math.max(Math.PI,a),3*Math.PI/2)),o=Math.sin(Math.min(a,Math.PI/2)),h=n*(n>0?t:e),l=s*(s>0?t:e),d=o*(o>0?e:t);return{x:h,y:r?-1*d:l,width:1*e-h,height:d-l}}}function ee(t,e,i,r,a,n,s){var o=Math.sqrt(Math.pow(i-t,2)+Math.pow(r-e,2)),h=Math.sqrt(Math.pow(a-i,2)+Math.pow(n-r,2)),l=s*o/(o+h),d=s*h/(o+h);return[i-l*(a-t),r-l*(n-e),i+d*(a-t),r+d*(n-e)]}function ie(t,e){var i,r,a=t.length,n=[];for(i=2;i<a-2;i+=2)r=ee(t[i-2],t[i-1],t[i],t[i+1],t[i+2],t[i+3],e),isNaN(r[0])||(n.push(r[0]),n.push(r[1]),n.push(t[i]),n.push(t[i+1]),n.push(r[2]),n.push(r[3]));return n}te.prototype._centroid=!0,te.prototype.className="Arc",te.prototype._attrsAffectingSize=["innerRadius","outerRadius"],r(te),w.addGetterSetter(te,"innerRadius",0,p()),w.addGetterSetter(te,"outerRadius",0,p()),w.addGetterSetter(te,"angle",0,p()),w.addGetterSetter(te,"clockwise",!1,x());class re extends Nt{constructor(t){super(t),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",(function(){this._clearCache("tensionPoints")}))}_sceneFunc(t){var e,i,r,a=this.points(),n=a.length,s=this.tension(),o=this.closed(),h=this.bezier();if(n){if(t.beginPath(),t.moveTo(a[0],a[1]),0!==s&&n>4){for(i=(e=this.getTensionPoints()).length,r=o?0:4,o||t.quadraticCurveTo(e[0],e[1],e[2],e[3]);r<i-2;)t.bezierCurveTo(e[r++],e[r++],e[r++],e[r++],e[r++],e[r++]);o||t.quadraticCurveTo(e[i-2],e[i-1],a[n-2],a[n-1])}else if(h)for(r=2;r<n;)t.bezierCurveTo(a[r++],a[r++],a[r++],a[r++],a[r++],a[r++]);else for(r=2;r<n;r+=2)t.lineTo(a[r],a[r+1]);o?(t.closePath(),t.fillStrokeShape(this)):t.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():ie(this.points(),this.tension())}_getTensionPointsClosed(){var t=this.points(),e=t.length,i=this.tension(),r=ee(t[e-2],t[e-1],t[0],t[1],t[2],t[3],i),a=ee(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],i),n=ie(t,i);return[r[2],r[3]].concat(n).concat([a[0],a[1],t[e-2],t[e-1],a[2],a[3],r[0],r[1],t[0],t[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){var t=this.points();if(t.length<4)return{x:t[0]||0,y:t[1]||0,width:0,height:0};for(var e,i,r=(t=0!==this.tension()?[t[0],t[1],...this._getTensionPoints(),t[t.length-2],t[t.length-1]]:this.points())[0],a=t[0],n=t[1],s=t[1],o=0;o<t.length/2;o++)e=t[2*o],i=t[2*o+1],r=Math.min(r,e),a=Math.max(a,e),n=Math.min(n,i),s=Math.max(s,i);return{x:r,y:n,width:a-r,height:s-n}}}re.prototype.className="Line",re.prototype._attrsAffectingSize=["points","bezier","tension"],r(re),w.addGetterSetter(re,"closed",!1),w.addGetterSetter(re,"bezier",!1),w.addGetterSetter(re,"tension",0,p()),w.addGetterSetter(re,"points",[],function(){if(i.isUnminified)return function(t,e){const i=Int8Array?Object.getPrototypeOf(Int8Array):null;return i&&t instanceof i||(g._isArray(t)?t.forEach((function(t){g._isNumber(t)||g.warn('"'+e+'" attribute has non numeric element '+t+". Make sure that all elements are numbers.")})):g.warn(u(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}());const ae=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],ne=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],se=[[1],[1,1],[1,2,1],[1,3,3,1]],oe=(t,e,i)=>{let r,a,n;r=i/2,a=0;for(let i=0;i<20;i++)n=r*ae[20][i]+r,a+=ne[20][i]*le(t,e,n);return r*a},he=(t,e,i)=>{void 0===i&&(i=1);const r=t[0]-2*t[1]+t[2],a=e[0]-2*e[1]+e[2],n=2*t[1]-2*t[0],s=2*e[1]-2*e[0],o=4*(r*r+a*a),h=4*(r*n+a*s),l=n*n+s*s;if(0===o)return i*Math.sqrt(Math.pow(t[2]-t[0],2)+Math.pow(e[2]-e[0],2));const d=h/(2*o),c=i+d,g=l/o-d*d,u=c*c+g>0?Math.sqrt(c*c+g):0,f=d*d+g>0?Math.sqrt(d*d+g):0,p=d+Math.sqrt(d*d+g)!==0?g*Math.log(Math.abs((c+u)/(d+f))):0;return Math.sqrt(o)/2*(c*u-d*f+p)};function le(t,e,i){const r=de(1,i,t),a=de(1,i,e),n=r*r+a*a;return Math.sqrt(n)}const de=(t,e,i)=>{const r=i.length-1;let a,n;if(0===r)return 0;if(0===t){n=0;for(let t=0;t<=r;t++)n+=se[r][t]*Math.pow(1-e,r-t)*Math.pow(e,t)*i[t];return n}a=new Array(r);for(let t=0;t<r;t++)a[t]=r*(i[t+1]-i[t]);return de(t-1,e,a)},ce=(t,e,i)=>{let r=1,a=t/e,n=(t-i(a))/e,s=0;for(;r>.001;){const o=i(a+n),h=Math.abs(t-o)/e;if(h<r)r=h,a+=n;else{const s=i(a-n),o=Math.abs(t-s)/e;o<r?(r=o,a-=n):n/=2}if(s++,s>500)break}return a};class ge extends Nt{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",(function(){this._readDataAttribute()}))}_readDataAttribute(){this.dataArray=ge.parsePathData(this.data()),this.pathLength=ge.getPathLength(this.dataArray)}_sceneFunc(t){var e=this.dataArray;t.beginPath();for(var i=!1,r=0;r<e.length;r++){var a=e[r].command,n=e[r].points;switch(a){case"L":t.lineTo(n[0],n[1]);break;case"M":t.moveTo(n[0],n[1]);break;case"C":t.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5]);break;case"Q":t.quadraticCurveTo(n[0],n[1],n[2],n[3]);break;case"A":var s=n[0],o=n[1],h=n[2],l=n[3],d=n[4],c=n[5],g=n[6],u=n[7],f=h>l?h:l,p=h>l?1:h/l,v=h>l?l/h:1;t.translate(s,o),t.rotate(g),t.scale(p,v),t.arc(0,0,f,d,d+c,1-u),t.scale(1/p,1/v),t.rotate(-g),t.translate(-s,-o);break;case"z":i=!0,t.closePath()}}i||this.hasFill()?t.fillStrokeShape(this):t.strokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach((function(e){if("A"===e.command){var i=e.points[4],r=e.points[5],a=e.points[4]+r,n=Math.PI/180;if(Math.abs(i-a)<n&&(n=Math.abs(i-a)),r<0)for(let r=i-n;r>a;r-=n){const i=ge.getPointOnEllipticalArc(e.points[0],e.points[1],e.points[2],e.points[3],r,0);t.push(i.x,i.y)}else for(let r=i+n;r<a;r+=n){const i=ge.getPointOnEllipticalArc(e.points[0],e.points[1],e.points[2],e.points[3],r,0);t.push(i.x,i.y)}}else if("C"===e.command)for(let i=0;i<=1;i+=.01){const r=ge.getPointOnCubicBezier(i,e.start.x,e.start.y,e.points[0],e.points[1],e.points[2],e.points[3],e.points[4],e.points[5]);t.push(r.x,r.y)}else t=t.concat(e.points)}));for(var e,i,r=t[0],a=t[0],n=t[1],s=t[1],o=0;o<t.length/2;o++)e=t[2*o],i=t[2*o+1],isNaN(e)||(r=Math.min(r,e),a=Math.max(a,e)),isNaN(i)||(n=Math.min(n,i),s=Math.max(s,i));return{x:r,y:n,width:a-r,height:s-n}}getLength(){return this.pathLength}getPointAtLength(t){return ge.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(t,e,i,r){return Math.sqrt((i-t)*(i-t)+(r-e)*(r-e))}static getPathLength(t){let e=0;for(var i=0;i<t.length;++i)e+=t[i].pathLength;return e}static getPointAtLengthOfDataArray(t,e){var i,r=0,a=e.length;if(!a)return null;for(;r<a&&t>e[r].pathLength;)t-=e[r].pathLength,++r;if(r===a)return{x:(i=e[r-1].points.slice(-2))[0],y:i[1]};if(t<.01)return{x:(i=e[r].points.slice(0,2))[0],y:i[1]};var n=e[r],s=n.points;switch(n.command){case"L":return ge.getPointOnLine(t,n.start.x,n.start.y,s[0],s[1]);case"C":return ge.getPointOnCubicBezier(ce(t,ge.getPathLength(e),(t=>oe([n.start.x,s[0],s[2],s[4]],[n.start.y,s[1],s[3],s[5]],t))),n.start.x,n.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case"Q":return ge.getPointOnQuadraticBezier(ce(t,ge.getPathLength(e),(t=>he([n.start.x,s[0],s[2]],[n.start.y,s[1],s[3]],t))),n.start.x,n.start.y,s[0],s[1],s[2],s[3]);case"A":var o=s[0],h=s[1],l=s[2],d=s[3],c=s[4],g=s[5],u=s[6];return c+=g*t/n.pathLength,ge.getPointOnEllipticalArc(o,h,l,d,c,u)}return null}static getPointOnLine(t,e,i,r,a,n,s){n=null!=n?n:e,s=null!=s?s:i;const o=this.getLineLength(e,i,r,a);if(o<1e-10)return{x:e,y:i};if(r===e)return{x:n,y:s+(a>i?t:-t)};const h=(a-i)/(r-e),l=Math.sqrt(t*t/(1+h*h))*(r<e?-1:1),d=h*l;if(Math.abs(s-i-h*(n-e))<1e-10)return{x:n+l,y:s+d};const c=((n-e)*(r-e)+(s-i)*(a-i))/(o*o),g=e+c*(r-e),u=i+c*(a-i),f=this.getLineLength(n,s,g,u),p=Math.sqrt(t*t-f*f),v=Math.sqrt(p*p/(1+h*h))*(r<e?-1:1);return{x:g+v,y:u+h*v}}static getPointOnCubicBezier(t,e,i,r,a,n,s,o,h){function l(t){return t*t*t}function d(t){return 3*t*t*(1-t)}function c(t){return 3*t*(1-t)*(1-t)}function g(t){return(1-t)*(1-t)*(1-t)}return{x:o*l(t)+n*d(t)+r*c(t)+e*g(t),y:h*l(t)+s*d(t)+a*c(t)+i*g(t)}}static getPointOnQuadraticBezier(t,e,i,r,a,n,s){function o(t){return t*t}function h(t){return 2*t*(1-t)}function l(t){return(1-t)*(1-t)}return{x:n*o(t)+r*h(t)+e*l(t),y:s*o(t)+a*h(t)+i*l(t)}}static getPointOnEllipticalArc(t,e,i,r,a,n){var s=Math.cos(n),o=Math.sin(n),h=i*Math.cos(a),l=r*Math.sin(a);return{x:t+(h*s-l*o),y:e+(h*o+l*s)}}static parsePathData(t){if(!t)return[];var e=t,i=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];e=e.replace(new RegExp(" ","g"),",");for(var r=0;r<i.length;r++)e=e.replace(new RegExp(i[r],"g"),"|"+i[r]);var a,n=e.split("|"),s=[],o=[],h=0,l=0,d=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;for(r=1;r<n.length;r++){var c=n[r],g=c.charAt(0);for(c=c.slice(1),o.length=0;a=d.exec(c);)o.push(a[0]);for(var u=[],f=0,p=o.length;f<p;f++)if("00"!==o[f]){var v=parseFloat(o[f]);isNaN(v)?u.push(0):u.push(v)}else u.push(0,0);for(;u.length>0&&!isNaN(u[0]);){var m,_,y,x,b,S,w,C,P,k,A="",T=[],M=h,G=l;switch(g){case"l":h+=u.shift(),l+=u.shift(),A="L",T.push(h,l);break;case"L":h=u.shift(),l=u.shift(),T.push(h,l);break;case"m":var R=u.shift(),E=u.shift();if(h+=R,l+=E,A="M",s.length>2&&"z"===s[s.length-1].command)for(var D=s.length-2;D>=0;D--)if("M"===s[D].command){h=s[D].points[0]+R,l=s[D].points[1]+E;break}T.push(h,l),g="l";break;case"M":h=u.shift(),l=u.shift(),A="M",T.push(h,l),g="L";break;case"h":h+=u.shift(),A="L",T.push(h,l);break;case"H":h=u.shift(),A="L",T.push(h,l);break;case"v":l+=u.shift(),A="L",T.push(h,l);break;case"V":l=u.shift(),A="L",T.push(h,l);break;case"C":T.push(u.shift(),u.shift(),u.shift(),u.shift()),h=u.shift(),l=u.shift(),T.push(h,l);break;case"c":T.push(h+u.shift(),l+u.shift(),h+u.shift(),l+u.shift()),h+=u.shift(),l+=u.shift(),A="C",T.push(h,l);break;case"S":_=h,y=l,"C"===(m=s[s.length-1]).command&&(_=h+(h-m.points[2]),y=l+(l-m.points[3])),T.push(_,y,u.shift(),u.shift()),h=u.shift(),l=u.shift(),A="C",T.push(h,l);break;case"s":_=h,y=l,"C"===(m=s[s.length-1]).command&&(_=h+(h-m.points[2]),y=l+(l-m.points[3])),T.push(_,y,h+u.shift(),l+u.shift()),h+=u.shift(),l+=u.shift(),A="C",T.push(h,l);break;case"Q":T.push(u.shift(),u.shift()),h=u.shift(),l=u.shift(),T.push(h,l);break;case"q":T.push(h+u.shift(),l+u.shift()),h+=u.shift(),l+=u.shift(),A="Q",T.push(h,l);break;case"T":_=h,y=l,"Q"===(m=s[s.length-1]).command&&(_=h+(h-m.points[0]),y=l+(l-m.points[1])),h=u.shift(),l=u.shift(),A="Q",T.push(_,y,h,l);break;case"t":_=h,y=l,"Q"===(m=s[s.length-1]).command&&(_=h+(h-m.points[0]),y=l+(l-m.points[1])),h+=u.shift(),l+=u.shift(),A="Q",T.push(_,y,h,l);break;case"A":x=u.shift(),b=u.shift(),S=u.shift(),w=u.shift(),C=u.shift(),P=h,k=l,h=u.shift(),l=u.shift(),A="A",T=this.convertEndpointToCenterParameterization(P,k,h,l,w,C,x,b,S);break;case"a":x=u.shift(),b=u.shift(),S=u.shift(),w=u.shift(),C=u.shift(),P=h,k=l,h+=u.shift(),l+=u.shift(),A="A",T=this.convertEndpointToCenterParameterization(P,k,h,l,w,C,x,b,S)}s.push({command:A||g,points:T,start:{x:M,y:G},pathLength:this.calcLength(M,G,A||g,T)})}"z"!==g&&"Z"!==g||s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(t,e,i,r){var a,n,s,o,h=ge;switch(i){case"L":return h.getLineLength(t,e,r[0],r[1]);case"C":return oe([t,r[0],r[2],r[4]],[e,r[1],r[3],r[5]],1);case"Q":return he([t,r[0],r[2]],[e,r[1],r[3]],1);case"A":a=0;var l=r[4],d=r[5],c=r[4]+d,g=Math.PI/180;if(Math.abs(l-c)<g&&(g=Math.abs(l-c)),n=h.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],l,0),d<0)for(o=l-g;o>c;o-=g)s=h.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],o,0),a+=h.getLineLength(n.x,n.y,s.x,s.y),n=s;else for(o=l+g;o<c;o+=g)s=h.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],o,0),a+=h.getLineLength(n.x,n.y,s.x,s.y),n=s;return s=h.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],c,0),a+=h.getLineLength(n.x,n.y,s.x,s.y)}return 0}static convertEndpointToCenterParameterization(t,e,i,r,a,n,s,o,h){var l=h*(Math.PI/180),d=Math.cos(l)*(t-i)/2+Math.sin(l)*(e-r)/2,c=-1*Math.sin(l)*(t-i)/2+Math.cos(l)*(e-r)/2,g=d*d/(s*s)+c*c/(o*o);g>1&&(s*=Math.sqrt(g),o*=Math.sqrt(g));var u=Math.sqrt((s*s*(o*o)-s*s*(c*c)-o*o*(d*d))/(s*s*(c*c)+o*o*(d*d)));a===n&&(u*=-1),isNaN(u)&&(u=0);var f=u*s*c/o,p=u*-o*d/s,v=(t+i)/2+Math.cos(l)*f-Math.sin(l)*p,m=(e+r)/2+Math.sin(l)*f+Math.cos(l)*p,_=function(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])},y=function(t,e){return(t[0]*e[0]+t[1]*e[1])/(_(t)*_(e))},x=function(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(y(t,e))},b=x([1,0],[(d-f)/s,(c-p)/o]),S=[(d-f)/s,(c-p)/o],w=[(-1*d-f)/s,(-1*c-p)/o],C=x(S,w);return y(S,w)<=-1&&(C=Math.PI),y(S,w)>=1&&(C=0),0===n&&C>0&&(C-=2*Math.PI),1===n&&C<0&&(C+=2*Math.PI),[v,m,s,o,b,C,l,n]}}ge.prototype.className="Path",ge.prototype._attrsAffectingSize=["data"],r(ge),w.addGetterSetter(ge,"data");class ue extends re{_sceneFunc(t){super._sceneFunc(t);var e=2*Math.PI,i=this.points(),r=i,a=0!==this.tension()&&i.length>4;a&&(r=this.getTensionPoints());var n,s,o=this.pointerLength(),h=i.length;if(a){const t=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],i[h-2],i[h-1]],e=ge.calcLength(r[r.length-4],r[r.length-3],"C",t),a=ge.getPointOnQuadraticBezier(Math.min(1,1-o/e),t[0],t[1],t[2],t[3],t[4],t[5]);n=i[h-2]-a.x,s=i[h-1]-a.y}else n=i[h-2]-i[h-4],s=i[h-1]-i[h-3];var l=(Math.atan2(s,n)+e)%e,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(i[h-2],i[h-1]),t.rotate(l),t.moveTo(0,0),t.lineTo(-o,d/2),t.lineTo(-o,-d/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(i[0],i[1]),a?(n=(r[0]+r[2])/2-i[0],s=(r[1]+r[3])/2-i[1]):(n=i[2]-i[0],s=i[3]-i[1]),t.rotate((Math.atan2(-s,-n)+e)%e),t.moveTo(0,0),t.lineTo(-o,d/2),t.lineTo(-o,-d/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){var e=this.dashEnabled();e&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),e&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),e=this.pointerWidth()/2;return{x:t.x-e,y:t.y-e,width:t.width+2*e,height:t.height+2*e}}}ue.prototype.className="Arrow",r(ue),w.addGetterSetter(ue,"pointerLength",10,p()),w.addGetterSetter(ue,"pointerWidth",10,p()),w.addGetterSetter(ue,"pointerAtBeginning",!1),w.addGetterSetter(ue,"pointerAtEnding",!0);class fe extends Nt{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,2*Math.PI,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}}fe.prototype._centroid=!0,fe.prototype.className="Circle",fe.prototype._attrsAffectingSize=["radius"],r(fe),w.addGetterSetter(fe,"radius",0,p());class pe extends Nt{_sceneFunc(t){var e=this.radiusX(),i=this.radiusY();t.beginPath(),t.save(),e!==i&&t.scale(1,i/e),t.arc(0,0,e,0,2*Math.PI,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.radiusX()}getHeight(){return 2*this.radiusY()}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}pe.prototype.className="Ellipse",pe.prototype._centroid=!0,pe.prototype._attrsAffectingSize=["radiusX","radiusY"],r(pe),w.addComponentsGetterSetter(pe,"radius",["x","y"]),w.addGetterSetter(pe,"radiusX",0,p()),w.addGetterSetter(pe,"radiusY",0,p());class ve extends Nt{constructor(t){super(t),this.on("imageChange.konva",(()=>{this._setImageLoad()})),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&4===t.readyState||t&&t.addEventListener&&t.addEventListener("load",(()=>{this._requestDraw()}))}_useBufferCanvas(){const t=!!this.cornerRadius(),e=this.hasShadow();return!(!t||!e)||super._useBufferCanvas(!0)}_sceneFunc(t){const e=this.getWidth(),i=this.getHeight(),r=this.cornerRadius(),a=this.attrs.image;let n;if(a){const t=this.attrs.cropWidth,r=this.attrs.cropHeight;n=t&&r?[a,this.cropX(),this.cropY(),t,r,0,0,e,i]:[a,0,0,e,i]}(this.hasFill()||this.hasStroke()||r)&&(t.beginPath(),r?g.drawRoundedRectPath(t,e,i,r):t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)),a&&(r&&t.clip(),t.drawImage.apply(t,n))}_hitFunc(t){var e=this.width(),i=this.height(),r=this.cornerRadius();t.beginPath(),r?g.drawRoundedRectPath(t,e,i,r):t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,e;return null!==(t=this.attrs.width)&&void 0!==t?t:null===(e=this.image())||void 0===e?void 0:e.width}getHeight(){var t,e;return null!==(t=this.attrs.height)&&void 0!==t?t:null===(e=this.image())||void 0===e?void 0:e.height}static fromURL(t,e,i=null){var r=g.createImageElement();r.onload=function(){var t=new ve({image:r});e(t)},r.onerror=i,r.crossOrigin="Anonymous",r.src=t}}ve.prototype.className="Image",r(ve),w.addGetterSetter(ve,"cornerRadius",0,v(4)),w.addGetterSetter(ve,"image"),w.addComponentsGetterSetter(ve,"crop",["x","y","width","height"]),w.addGetterSetter(ve,"cropX",0,p()),w.addGetterSetter(ve,"cropY",0,p()),w.addGetterSetter(ve,"cropWidth",0,p()),w.addGetterSetter(ve,"cropHeight",0,p());var me=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],_e="up",ye="right",xe="down",be="left",Se=me.length;class we extends Xt{constructor(t){super(t),this.on("add.konva",(function(t){this._addListeners(t.child),this._sync()}))}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var e,i=this,r=function(){i._sync()};for(e=0;e<Se;e++)t.on(me[e]+"Change.konva",r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){var t,e,i,r,a,n,s,o=this.getText(),h=this.getTag();if(o&&h){switch(t=o.width(),e=o.height(),i=h.pointerDirection(),r=h.pointerWidth(),s=h.pointerHeight(),a=0,n=0,i){case _e:a=t/2,n=-1*s;break;case ye:a=t+r,n=e/2;break;case xe:a=t/2,n=e+s;break;case be:a=-1*r,n=e/2}h.setAttrs({x:-1*a,y:-1*n,width:t,height:e}),o.setAttrs({x:-1*a,y:-1*n})}}}we.prototype.className="Label",r(we);class Ce extends Nt{_sceneFunc(t){var e=this.width(),i=this.height(),r=this.pointerDirection(),a=this.pointerWidth(),n=this.pointerHeight(),s=this.cornerRadius();let o=0,h=0,l=0,d=0;"number"==typeof s?o=h=l=d=Math.min(s,e/2,i/2):(o=Math.min(s[0]||0,e/2,i/2),h=Math.min(s[1]||0,e/2,i/2),d=Math.min(s[2]||0,e/2,i/2),l=Math.min(s[3]||0,e/2,i/2)),t.beginPath(),t.moveTo(o,0),r===_e&&(t.lineTo((e-a)/2,0),t.lineTo(e/2,-1*n),t.lineTo((e+a)/2,0)),t.lineTo(e-h,0),t.arc(e-h,h,h,3*Math.PI/2,0,!1),r===ye&&(t.lineTo(e,(i-n)/2),t.lineTo(e+a,i/2),t.lineTo(e,(i+n)/2)),t.lineTo(e,i-d),t.arc(e-d,i-d,d,0,Math.PI/2,!1),r===xe&&(t.lineTo((e+a)/2,i),t.lineTo(e/2,i+n),t.lineTo((e-a)/2,i)),t.lineTo(l,i),t.arc(l,i-l,l,Math.PI/2,Math.PI,!1),r===be&&(t.lineTo(0,(i+n)/2),t.lineTo(-1*a,i/2),t.lineTo(0,(i-n)/2)),t.lineTo(0,o),t.arc(o,o,o,Math.PI,3*Math.PI/2,!1),t.closePath(),t.fillStrokeShape(this)}getSelfRect(){var t=0,e=0,i=this.pointerWidth(),r=this.pointerHeight(),a=this.pointerDirection(),n=this.width(),s=this.height();return a===_e?(e-=r,s+=r):a===xe?s+=r:a===be?(t-=1.5*i,n+=i):a===ye&&(n+=1.5*i),{x:t,y:e,width:n,height:s}}}Ce.prototype.className="Tag",r(Ce),w.addGetterSetter(Ce,"pointerDirection","none"),w.addGetterSetter(Ce,"pointerWidth",0,p()),w.addGetterSetter(Ce,"pointerHeight",0,p()),w.addGetterSetter(Ce,"cornerRadius",0,v(4));class Pe extends Nt{_sceneFunc(t){var e=this.cornerRadius(),i=this.width(),r=this.height();t.beginPath(),e?g.drawRoundedRectPath(t,i,r,e):t.rect(0,0,i,r),t.closePath(),t.fillStrokeShape(this)}}Pe.prototype.className="Rect",r(Pe),w.addGetterSetter(Pe,"cornerRadius",0,v(4));class ke extends Nt{_sceneFunc(t){const e=this._getPoints();t.beginPath(),t.moveTo(e[0].x,e[0].y);for(var i=1;i<e.length;i++)t.lineTo(e[i].x,e[i].y);t.closePath(),t.fillStrokeShape(this)}_getPoints(){const t=this.attrs.sides,e=this.attrs.radius||0,i=[];for(var r=0;r<t;r++)i.push({x:e*Math.sin(2*r*Math.PI/t),y:-1*e*Math.cos(2*r*Math.PI/t)});return i}getSelfRect(){const t=this._getPoints();var e=t[0].x,i=t[0].y,r=t[0].x,a=t[0].y;return t.forEach((t=>{e=Math.min(e,t.x),i=Math.max(i,t.x),r=Math.min(r,t.y),a=Math.max(a,t.y)})),{x:e,y:r,width:i-e,height:a-r}}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}ke.prototype.className="RegularPolygon",ke.prototype._centroid=!0,ke.prototype._attrsAffectingSize=["radius"],r(ke),w.addGetterSetter(ke,"radius",0,p()),w.addGetterSetter(ke,"sides",0,p());var Ae=2*Math.PI;class Te extends Nt{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,Ae,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),Ae,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}Te.prototype.className="Ring",Te.prototype._centroid=!0,Te.prototype._attrsAffectingSize=["innerRadius","outerRadius"],r(Te),w.addGetterSetter(Te,"innerRadius",0,p()),w.addGetterSetter(Te,"outerRadius",0,p());class Me extends Nt{constructor(t){super(t),this._updated=!0,this.anim=new jt((()=>{var t=this._updated;return this._updated=!1,t})),this.on("animationChange.konva",(function(){this.frameIndex(0)})),this.on("frameIndexChange.konva",(function(){this._updated=!0})),this.on("frameRateChange.konva",(function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())}))}_sceneFunc(t){var e=this.animation(),i=this.frameIndex(),r=4*i,a=this.animations()[e],n=this.frameOffsets(),s=a[r+0],o=a[r+1],h=a[r+2],l=a[r+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,h,l),t.closePath(),t.fillStrokeShape(this)),d)if(n){var c=n[e],g=2*i;t.drawImage(d,s,o,h,l,c[g+0],c[g+1],h,l)}else t.drawImage(d,s,o,h,l,0,0,h,l)}_hitFunc(t){var e=this.animation(),i=this.frameIndex(),r=4*i,a=this.animations()[e],n=this.frameOffsets(),s=a[r+2],o=a[r+3];if(t.beginPath(),n){var h=n[e],l=2*i;t.rect(h[l+0],h[l+1],s,o)}else t.rect(0,0,s,o);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval((function(){t._updateIndex()}),1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),e=this.animation();t<this.animations()[e].length/4-1?this.frameIndex(t+1):this.frameIndex(0)}}Me.prototype.className="Sprite",r(Me),w.addGetterSetter(Me,"animation"),w.addGetterSetter(Me,"animations"),w.addGetterSetter(Me,"frameOffsets"),w.addGetterSetter(Me,"image"),w.addGetterSetter(Me,"frameIndex",0,p()),w.addGetterSetter(Me,"frameRate",17,p()),w.backCompat(Me,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});class Ge extends Nt{_sceneFunc(t){var e=this.innerRadius(),i=this.outerRadius(),r=this.numPoints();t.beginPath(),t.moveTo(0,0-i);for(var a=1;a<2*r;a++){var n=a%2==0?i:e,s=n*Math.sin(a*Math.PI/r),o=-1*n*Math.cos(a*Math.PI/r);t.lineTo(s,o)}t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}function Re(t){return Array.from(t)}Ge.prototype.className="Star",Ge.prototype._centroid=!0,Ge.prototype._attrsAffectingSize=["innerRadius","outerRadius"],r(Ge),w.addGetterSetter(Ge,"numPoints",5,p()),w.addGetterSetter(Ge,"innerRadius",0,p()),w.addGetterSetter(Ge,"outerRadius",0,p());var Ee,De="auto",Le="inherit",Oe="justify",Ie="left",Fe="middle",Be="normal",Ne=" ",He="none",We=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],ze=We.length;function Ye(){return Ee||(Ee=g.createCanvasElement().getContext("2d"))}class Xe extends Nt{constructor(t){super(function(t){return(t=t||{}).fillLinearGradientColorStops||t.fillRadialGradientColorStops||t.fillPatternImage||(t.fill=t.fill||"black"),t}(t)),this._partialTextX=0,this._partialTextY=0;for(var e=0;e<ze;e++)this.on(We[e]+"Change.konva",this._setTextData);this._setTextData()}_sceneFunc(t){var e=this.textArr,r=e.length;if(this.text()){var a,n=this.padding(),s=this.fontSize(),o=this.lineHeight()*s,h=this.verticalAlign(),l=this.direction(),d=0,c=this.align(),g=this.getWidth(),u=this.letterSpacing(),f=this.fill(),p=this.textDecoration(),v=-1!==p.indexOf("underline"),m=-1!==p.indexOf("line-through");l=l===Le?t.direction:l;var _=o/2,y=Fe;if(i._fixTextRendering){var x=this.measureSize("M");y="alphabetic",_=(x.fontBoundingBoxAscent-x.fontBoundingBoxDescent)/2+o/2}var b=0,S=0;for("rtl"===l&&t.setAttr("direction",l),t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",y),t.setAttr("textAlign",Ie),h===Fe?d=(this.getHeight()-r*o-2*n)/2:"bottom"===h&&(d=this.getHeight()-r*o-2*n),t.translate(n,d+n),a=0;a<r;a++){b=0,S=0;var w,C,P,k=e[a],A=k.text,T=k.width,M=k.lastInParagraph;if(t.save(),"right"===c?b+=g-T-2*n:"center"===c&&(b+=(g-T-2*n)/2),v){t.save(),t.beginPath();const e=b,r=_+S+(i._fixTextRendering?Math.round(s/4):Math.round(s/2));t.moveTo(e,r),C=0===(w=A.split(" ").length-1),P=c!==Oe||M?T:g-2*n,t.lineTo(e+Math.round(P),r),t.lineWidth=s/15;const a=this._getLinearGradient();t.strokeStyle=a||f,t.stroke(),t.restore()}if(m){t.save(),t.beginPath();let e=i._fixTextRendering?-Math.round(s/4):0;t.moveTo(b,_+S+e),C=0===(w=A.split(" ").length-1),P=c===Oe&&M&&!C?g-2*n:T,t.lineTo(b+Math.round(P),_+S+e),t.lineWidth=s/15;const r=this._getLinearGradient();t.strokeStyle=r||f,t.stroke(),t.restore()}if("rtl"===l||0===u&&c!==Oe)0!==u&&t.setAttr("letterSpacing",`${u}px`),this._partialTextX=b,this._partialTextY=_+S,this._partialText=A,t.fillStrokeShape(this);else{w=A.split(" ").length-1;for(var G=Re(A),R=0;R<G.length;R++){var E=G[R];" "!==E||M||c!==Oe||(b+=(g-2*n-T)/w),this._partialTextX=b,this._partialTextY=_+S,this._partialText=E,t.fillStrokeShape(this),b+=this.measureSize(E).width+u}}t.restore(),r>1&&(_+=o)}}}_hitFunc(t){var e=this.getWidth(),i=this.getHeight();t.beginPath(),t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)}setText(t){var e=g._isString(t)?t:null==t?"":t+"";return this._setAttr("text",e),this}getWidth(){return this.attrs.width===De||void 0===this.attrs.width?this.getTextWidth()+2*this.padding():this.attrs.width}getHeight(){return this.attrs.height===De||void 0===this.attrs.height?this.fontSize()*this.textArr.length*this.lineHeight()+2*this.padding():this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return g.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var e,i,r,a,n,s,o,h,l,d,c,g,u=Ye(),f=this.fontSize();u.save(),u.font=this._getContextFont(),g=u.measureText(t),u.restore();const p=f/100;return{actualBoundingBoxAscent:null!==(e=g.actualBoundingBoxAscent)&&void 0!==e?e:71.58203125*p,actualBoundingBoxDescent:null!==(i=g.actualBoundingBoxDescent)&&void 0!==i?i:0,actualBoundingBoxLeft:null!==(r=g.actualBoundingBoxLeft)&&void 0!==r?r:-7.421875*p,actualBoundingBoxRight:null!==(a=g.actualBoundingBoxRight)&&void 0!==a?a:75.732421875*p,alphabeticBaseline:null!==(n=g.alphabeticBaseline)&&void 0!==n?n:0,emHeightAscent:null!==(s=g.emHeightAscent)&&void 0!==s?s:100*p,emHeightDescent:null!==(o=g.emHeightDescent)&&void 0!==o?o:-20*p,fontBoundingBoxAscent:null!==(h=g.fontBoundingBoxAscent)&&void 0!==h?h:91*p,fontBoundingBoxDescent:null!==(l=g.fontBoundingBoxDescent)&&void 0!==l?l:21*p,hangingBaseline:null!==(d=g.hangingBaseline)&&void 0!==d?d:72.80000305175781*p,ideographicBaseline:null!==(c=g.ideographicBaseline)&&void 0!==c?c:-21*p,width:g.width,height:f}}_getContextFont(){return this.fontStyle()+Ne+this.fontVariant()+Ne+(this.fontSize()+"px ")+this.fontFamily().split(",").map((t=>{const e=(t=t.trim()).indexOf(" ")>=0,i=t.indexOf('"')>=0||t.indexOf("'")>=0;return e&&!i&&(t=`"${t}"`),t})).join(", ")}_addTextLine(t){this.align()===Oe&&(t=t.trim());var e=this._getTextWidth(t);return this.textArr.push({text:t,width:e,lastInParagraph:!1})}_getTextWidth(t){var e=this.letterSpacing(),i=t.length;return Ye().measureText(t).width+(i?e*(i-1):0)}_setTextData(){var t=this.text().split("\n"),e=+this.fontSize(),i=0,r=this.lineHeight()*e,a=this.attrs.width,n=this.attrs.height,s=a!==De&&void 0!==a,o=n!==De&&void 0!==n,h=this.padding(),l=a-2*h,d=n-2*h,c=0,g=this.wrap(),u="char"!==g&&g!==He,f=this.ellipsis();this.textArr=[],Ye().font=this._getContextFont();for(var p=f?this._getTextWidth("…"):0,v=0,m=t.length;v<m;++v){var _=t[v],y=this._getTextWidth(_);if(s&&y>l)for(;_.length>0;){for(var x=0,b=_.length,S="",w=0;x<b;){var C=x+b>>>1,P=_.slice(0,C+1),k=this._getTextWidth(P)+p;k<=l?(x=C+1,S=P,w=k):b=C}if(!S)break;if(u){var A,T=_[S.length];(A=(T===Ne||"-"===T)&&w<=l?S.length:Math.max(S.lastIndexOf(Ne),S.lastIndexOf("-"))+1)>0&&(x=A,S=S.slice(0,x),w=this._getTextWidth(S))}if(S=S.trimRight(),this._addTextLine(S),i=Math.max(i,w),c+=r,this._shouldHandleEllipsis(c)){this._tryToAddEllipsisToLastLine();break}if((_=(_=_.slice(x)).trimLeft()).length>0&&(y=this._getTextWidth(_))<=l){this._addTextLine(_),c+=r,i=Math.max(i,y);break}}else this._addTextLine(_),c+=r,i=Math.max(i,y),this._shouldHandleEllipsis(c)&&v<m-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),o&&c+r>d)break}this.textHeight=e,this.textWidth=i}_shouldHandleEllipsis(t){var e=+this.fontSize(),i=this.lineHeight()*e,r=this.attrs.height,a=r!==De&&void 0!==r,n=r-2*this.padding();return!(this.wrap()!==He)||a&&t+i>n}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,e=t!==De&&void 0!==t,i=t-2*this.padding(),r=this.ellipsis(),a=this.textArr[this.textArr.length-1];if(a&&r){if(e)this._getTextWidth(a.text+"…")<i||(a.text=a.text.slice(0,a.text.length-3));this.textArr.splice(this.textArr.length-1,1),this._addTextLine(a.text+"…")}}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const t=-1!==this.textDecoration().indexOf("underline")||-1!==this.textDecoration().indexOf("line-through"),e=this.hasShadow();return!(!t||!e)||super._useBufferCanvas()}}Xe.prototype._fillFunc=function(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)},Xe.prototype._strokeFunc=function(t){t.setAttr("miterLimit",2),t.strokeText(this._partialText,this._partialTextX,this._partialTextY)},Xe.prototype.className="Text",Xe.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],r(Xe),w.overWriteSetter(Xe,"width",m()),w.overWriteSetter(Xe,"height",m()),w.addGetterSetter(Xe,"direction",Le),w.addGetterSetter(Xe,"fontFamily","Arial"),w.addGetterSetter(Xe,"fontSize",12,p()),w.addGetterSetter(Xe,"fontStyle",Be),w.addGetterSetter(Xe,"fontVariant",Be),w.addGetterSetter(Xe,"padding",0,p()),w.addGetterSetter(Xe,"align",Ie),w.addGetterSetter(Xe,"verticalAlign","top"),w.addGetterSetter(Xe,"lineHeight",1,p()),w.addGetterSetter(Xe,"wrap","word"),w.addGetterSetter(Xe,"ellipsis",!1,x()),w.addGetterSetter(Xe,"letterSpacing",0,p()),w.addGetterSetter(Xe,"text","",_()),w.addGetterSetter(Xe,"textDecoration","");var qe="normal";function je(t){t.fillText(this.partialText,0,0)}function Ue(t){t.strokeText(this.partialText,0,0)}class Ve extends Nt{constructor(t){super(t),this.dummyCanvas=g.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",(function(){this._readDataAttribute(),this._setTextData()})),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return ge.getPathLength(this.dataArray)}_getPointAtLength(t){if(!this.attrs.data)return null;return t-1>this.pathLength?null:ge.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=ge.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var e=this.textDecoration(),i=this.fill(),r=this.fontSize(),a=this.glyphInfo;"underline"===e&&t.beginPath();for(var n=0;n<a.length;n++){t.save();var s=a[n].p0;t.translate(s.x,s.y),t.rotate(a[n].rotation),this.partialText=a[n].text,t.fillStrokeShape(this),"underline"===e&&(0===n&&t.moveTo(0,r/2+1),t.lineTo(r,r/2+1)),t.restore()}"underline"===e&&(t.strokeStyle=i,t.lineWidth=r/20,t.stroke()),t.restore()}_hitFunc(t){t.beginPath();var e=this.glyphInfo;if(e.length>=1){var i=e[0].p0;t.moveTo(i.x,i.y)}for(var r=0;r<e.length;r++){var a=e[r].p1;t.lineTo(a.x,a.y)}t.setAttr("lineWidth",this.fontSize()),t.setAttr("strokeStyle",this.colorKey),t.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return g.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(t){return Xe.prototype.setText.call(this,t)}_getContextFont(){return Xe.prototype._getContextFont.call(this)}_getTextSize(t){var e=this.dummyCanvas.getContext("2d");e.save(),e.font=this._getContextFont();var i=e.measureText(t);return e.restore(),{width:i.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const{width:t,height:e}=this._getTextSize(this.attrs.text);if(this.textWidth=t,this.textHeight=e,this.glyphInfo=[],!this.attrs.data)return null;const i=this.letterSpacing(),r=this.align(),a=this.kerningFunc(),n=Math.max(this.textWidth+((this.attrs.text||"").length-1)*i,0);let s=0;"center"===r&&(s=Math.max(0,this.pathLength/2-n/2)),"right"===r&&(s=Math.max(0,this.pathLength-n));const o=Re(this.text());let h=s;for(var l=0;l<o.length;l++){const t=this._getPointAtLength(h);if(!t)return;let e=this._getTextSize(o[l]).width+i;if(" "===o[l]&&"justify"===r){const t=this.text().split(" ").length-1;e+=(this.pathLength-n)/t}const s=this._getPointAtLength(h+e);if(!s)return;const d=ge.getLineLength(t.x,t.y,s.x,s.y);let c=0;if(a)try{c=a(o[l-1],o[l])*this.fontSize()}catch(t){c=0}t.x+=c,s.x+=c,this.textWidth+=c;const g=ge.getPointOnLine(c+d/2,t.x,t.y,s.x,s.y),u=Math.atan2(s.y-t.y,s.x-t.x);this.glyphInfo.push({transposeX:g.x,transposeY:g.y,text:o[l],rotation:u,p0:t,p1:s}),h+=e}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};var t=[];this.glyphInfo.forEach((function(e){t.push(e.p0.x),t.push(e.p0.y),t.push(e.p1.x),t.push(e.p1.y)}));for(var e,i,r=t[0]||0,a=t[0]||0,n=t[1]||0,s=t[1]||0,o=0;o<t.length/2;o++)e=t[2*o],i=t[2*o+1],r=Math.min(r,e),a=Math.max(a,e),n=Math.min(n,i),s=Math.max(s,i);var h=this.fontSize();return{x:r-h/2,y:n-h/2,width:a-r+h,height:s-n+h}}destroy(){return g.releaseCanvas(this.dummyCanvas),super.destroy()}}Ve.prototype._fillFunc=je,Ve.prototype._strokeFunc=Ue,Ve.prototype._fillFuncHit=je,Ve.prototype._strokeFuncHit=Ue,Ve.prototype.className="TextPath",Ve.prototype._attrsAffectingSize=["text","fontSize","data"],r(Ve),w.addGetterSetter(Ve,"data"),w.addGetterSetter(Ve,"fontFamily","Arial"),w.addGetterSetter(Ve,"fontSize",12,p()),w.addGetterSetter(Ve,"fontStyle",qe),w.addGetterSetter(Ve,"align","left"),w.addGetterSetter(Ve,"letterSpacing",0,p()),w.addGetterSetter(Ve,"textBaseline","middle"),w.addGetterSetter(Ve,"fontVariant",qe),w.addGetterSetter(Ve,"text",""),w.addGetterSetter(Ve,"textDecoration",null),w.addGetterSetter(Ve,"kerningFunc",null);var Ke="tr-konva",Qe=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map((t=>t+`.${Ke}`)).join(" "),Je="nodesRect",$e=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],Ze={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const ti="ontouchstart"in i._global;var ei=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function ii(t,e,i){const r=i.x+(t.x-i.x)*Math.cos(e)-(t.y-i.y)*Math.sin(e),a=i.y+(t.x-i.x)*Math.sin(e)+(t.y-i.y)*Math.cos(e);return{...t,rotation:t.rotation+e,x:r,y:a}}function ri(t,e){const i=function(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}(t);return ii(t,e,i)}let ai=0;class ni extends Xt{constructor(t){super(t),this._movingAnchorName=null,this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(Qe,this.update),this.getNode()&&this.update()}attachTo(t){return this.setNode(t),this}setNode(t){return g.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([t])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return Ke+this._id}setNodes(t=[]){this._nodes&&this._nodes.length&&this.detach();const e=t.filter((t=>!t.isAncestorOf(this)||(g.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1)));return this._nodes=t=e,1===t.length&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach((t=>{const e=()=>{1===this.nodes().length&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),this._transforming||this.isDragging()||this.update()},i=t._attrsAffectingSize.map((t=>t+"Change."+this._getEventNamespace())).join(" ");t.on(i,e),t.on($e.map((t=>t+`.${this._getEventNamespace()}`)).join(" "),e),t.on(`absoluteTransformChange.${this._getEventNamespace()}`,e),this._proxyDrag(t)})),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(t){let e;t.on(`dragstart.${this._getEventNamespace()}`,(i=>{e=t.getAbsolutePosition(),this.isDragging()||t===this.findOne(".back")||this.startDrag(i,!1)})),t.on(`dragmove.${this._getEventNamespace()}`,(i=>{if(!e)return;const r=t.getAbsolutePosition(),a=r.x-e.x,n=r.y-e.y;this.nodes().forEach((e=>{if(e===t)return;if(e.isDragging())return;const r=e.getAbsolutePosition();e.setAbsolutePosition({x:r.x+a,y:r.y+n}),e.startDrag(i)})),e=null}))}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach((t=>{t.off("."+this._getEventNamespace())})),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(Je),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(Je,this.__getNodeRect)}__getNodeShape(t,e=this.rotation(),r){var a=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),n=t.getAbsoluteScale(r),s=t.getAbsolutePosition(r),o=a.x*n.x-t.offsetX()*n.x,h=a.y*n.y-t.offsetY()*n.y;const l=(i.getAngle(t.getAbsoluteRotation())+2*Math.PI)%(2*Math.PI);return ii({x:s.x+o*Math.cos(l)+h*Math.sin(-l),y:s.y+h*Math.cos(l)+o*Math.sin(l),width:a.width*n.x,height:a.height*n.y,rotation:l},-i.getAngle(e),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const t=[];this.nodes().map((e=>{const i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var r=[{x:i.x,y:i.y},{x:i.x+i.width,y:i.y},{x:i.x+i.width,y:i.y+i.height},{x:i.x,y:i.y+i.height}],a=e.getAbsoluteTransform();r.forEach((function(e){var i=a.point(e);t.push(i)}))}));const e=new a;e.rotate(-i.getAngle(this.rotation()));var r=1/0,n=1/0,s=-1/0,o=-1/0;t.forEach((function(t){var i=e.point(t);void 0===r&&(r=s=i.x,n=o=i.y),r=Math.min(r,i.x),n=Math.min(n,i.y),s=Math.max(s,i.x),o=Math.max(o,i.y)})),e.invert();const h=e.point({x:r,y:n});return{x:h.x,y:h.y,width:s-r,height:o-n,rotation:i.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),ei.forEach((t=>{this._createAnchor(t)})),this._createAnchor("rotater")}_createAnchor(t){var e=new Pe({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:ti?10:"auto"}),r=this;e.on("mousedown touchstart",(function(t){r._handleMouseDown(t)})),e.on("dragstart",(t=>{e.stopDrag(),t.cancelBubble=!0})),e.on("dragend",(t=>{t.cancelBubble=!0})),e.on("mouseenter",(()=>{var r=i.getAngle(this.rotation()),a=this.rotateAnchorCursor(),n=function(t,e,i){if("rotater"===t)return i;e+=g.degToRad(Ze[t]||0);var r=(g.radToDeg(e)%360+360)%360;return g._inRange(r,337.5,360)||g._inRange(r,0,22.5)?"ns-resize":g._inRange(r,22.5,67.5)?"nesw-resize":g._inRange(r,67.5,112.5)?"ew-resize":g._inRange(r,112.5,157.5)?"nwse-resize":g._inRange(r,157.5,202.5)?"ns-resize":g._inRange(r,202.5,247.5)?"nesw-resize":g._inRange(r,247.5,292.5)?"ew-resize":g._inRange(r,292.5,337.5)?"nwse-resize":(g.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}(t,r,a);e.getStage().content&&(e.getStage().content.style.cursor=n),this._cursorChange=!0})),e.on("mouseout",(()=>{e.getStage().content&&(e.getStage().content.style.cursor=""),this._cursorChange=!1})),this.add(e)}_createBack(){var t=new Nt({name:"back",width:0,height:0,draggable:!0,sceneFunc(t,e){var i=e.getParent(),r=i.padding();t.beginPath(),t.rect(-r,-r,e.width()+2*r,e.height()+2*r),t.moveTo(e.width()/2,-r),i.rotateEnabled()&&i.rotateLineVisible()&&t.lineTo(e.width()/2,-i.rotateAnchorOffset()*g._sign(e.height())-r),t.fillStrokeShape(e)},hitFunc:(t,e)=>{if(this.shouldOverdrawWholeArea()){var i=this.padding();t.beginPath(),t.rect(-i,-i,e.width()+2*i,e.height()+2*i),t.fillStrokeShape(e)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",(t=>{t.cancelBubble=!0})),t.on("dragmove",(t=>{t.cancelBubble=!0})),t.on("dragend",(t=>{t.cancelBubble=!0})),this.on("dragmove",(t=>{this.update()}))}_handleMouseDown(t){if(!this._transforming){this._movingAnchorName=t.target.name().split(" ")[0];var e=this._getNodeRect(),i=e.width,r=e.height,a=Math.sqrt(Math.pow(i,2)+Math.pow(r,2));this.sin=Math.abs(r/a),this.cos=Math.abs(i/a),"undefined"!=typeof window&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var n=t.target.getAbsolutePosition(),s=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-n.x,y:s.y-n.y},ai++,this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach((e=>{e._fire("transformstart",{evt:t.evt,target:e})}))}}_handleMouseMove(t){var e,r,a,n=this.findOne("."+this._movingAnchorName),s=n.getStage();s.setPointersPositions(t);const o=s.getPointerPosition();let h={x:o.x-this._anchorDragOffset.x,y:o.y-this._anchorDragOffset.y};const l=n.getAbsolutePosition();this.anchorDragBoundFunc()&&(h=this.anchorDragBoundFunc()(l,h,t)),n.setAbsolutePosition(h);const d=n.getAbsolutePosition();if(l.x!==d.x||l.y!==d.y)if("rotater"!==this._movingAnchorName){var c,g=this.shiftBehavior();c="inverted"===g?this.keepRatio()&&!t.shiftKey:"none"===g?this.keepRatio():this.keepRatio()||t.shiftKey;var u=this.centeredScaling()||t.altKey;if("top-left"===this._movingAnchorName){if(c){var f=u?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};a=Math.sqrt(Math.pow(f.x-n.x(),2)+Math.pow(f.y-n.y(),2));var p=this.findOne(".top-left").x()>f.x?-1:1,v=this.findOne(".top-left").y()>f.y?-1:1;e=a*this.cos*p,r=a*this.sin*v,this.findOne(".top-left").x(f.x-e),this.findOne(".top-left").y(f.y-r)}}else if("top-center"===this._movingAnchorName)this.findOne(".top-left").y(n.y());else if("top-right"===this._movingAnchorName){if(c){f=u?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};a=Math.sqrt(Math.pow(n.x()-f.x,2)+Math.pow(f.y-n.y(),2));p=this.findOne(".top-right").x()<f.x?-1:1,v=this.findOne(".top-right").y()>f.y?-1:1;e=a*this.cos*p,r=a*this.sin*v,this.findOne(".top-right").x(f.x+e),this.findOne(".top-right").y(f.y-r)}var m=n.position();this.findOne(".top-left").y(m.y),this.findOne(".bottom-right").x(m.x)}else if("middle-left"===this._movingAnchorName)this.findOne(".top-left").x(n.x());else if("middle-right"===this._movingAnchorName)this.findOne(".bottom-right").x(n.x());else if("bottom-left"===this._movingAnchorName){if(c){f=u?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};a=Math.sqrt(Math.pow(f.x-n.x(),2)+Math.pow(n.y()-f.y,2));p=f.x<n.x()?-1:1,v=n.y()<f.y?-1:1;e=a*this.cos*p,r=a*this.sin*v,n.x(f.x-e),n.y(f.y+r)}m=n.position(),this.findOne(".top-left").x(m.x),this.findOne(".bottom-right").y(m.y)}else if("bottom-center"===this._movingAnchorName)this.findOne(".bottom-right").y(n.y());else if("bottom-right"===this._movingAnchorName){if(c){f=u?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};a=Math.sqrt(Math.pow(n.x()-f.x,2)+Math.pow(n.y()-f.y,2));p=this.findOne(".bottom-right").x()<f.x?-1:1,v=this.findOne(".bottom-right").y()<f.y?-1:1;e=a*this.cos*p,r=a*this.sin*v,this.findOne(".bottom-right").x(f.x+e),this.findOne(".bottom-right").y(f.y+r)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(u=this.centeredScaling()||t.altKey){var _=this.findOne(".top-left"),y=this.findOne(".bottom-right"),x=_.x(),b=_.y(),S=this.getWidth()-y.x(),w=this.getHeight()-y.y();y.move({x:-x,y:-b}),_.move({x:S,y:w})}var C=this.findOne(".top-left").getAbsolutePosition();e=C.x,r=C.y;var P=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),k=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:e,y:r,width:P,height:k,rotation:i.getAngle(this.rotation())},t)}else{var A=this._getNodeRect();e=n.x()-A.width/2,r=-n.y()+A.height/2;let a=Math.atan2(-r,e)+Math.PI/2;A.height<0&&(a-=Math.PI);const s=i.getAngle(this.rotation())+a,o=i.getAngle(this.rotationSnapTolerance()),h=ri(A,function(t,e,r){let a=e;for(let n=0;n<t.length;n++){const s=i.getAngle(t[n]),o=Math.abs(s-e)%(2*Math.PI);Math.min(o,2*Math.PI-o)<r&&(a=s)}return a}(this.rotationSnaps(),s,o)-A.rotation);this._fitNodesInto(h,t)}}_handleMouseUp(t){this._removeEvents(t)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(t){var e;if(this._transforming){this._transforming=!1,"undefined"!=typeof window&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));var i=this.getNode();ai--,this._fire("transformend",{evt:t,target:i}),null===(e=this.getLayer())||void 0===e||e.batchDraw(),i&&this._nodes.forEach((e=>{var i;e._fire("transformend",{evt:t,target:e}),null===(i=e.getLayer())||void 0===i||i.batchDraw()})),this._movingAnchorName=null}}_fitNodesInto(t,e){var r=this._getNodeRect();if(g._inRange(t.width,2*-this.padding()-1,1))return void this.update();if(g._inRange(t.height,2*-this.padding()-1,1))return void this.update();var n=new a;if(n.rotate(i.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const e=n.point({x:2*-this.padding(),y:0});t.x+=e.x,t.y+=e.y,t.width+=2*this.padding(),this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=e.x,this._anchorDragOffset.y-=e.y}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const e=n.point({x:2*this.padding(),y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=e.x,this._anchorDragOffset.y-=e.y,t.width+=2*this.padding()}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const e=n.point({x:0,y:2*-this.padding()});t.x+=e.x,t.y+=e.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=e.x,this._anchorDragOffset.y-=e.y,t.height+=2*this.padding()}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const e=n.point({x:0,y:2*this.padding()});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=e.x,this._anchorDragOffset.y-=e.y,t.height+=2*this.padding()}if(this.boundBoxFunc()){const e=this.boundBoxFunc()(r,t);e?t=e:g.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const s=1e7,o=new a;o.translate(r.x,r.y),o.rotate(r.rotation),o.scale(r.width/s,r.height/s);const h=new a,l=t.width/s,d=t.height/s;!1===this.flipEnabled()?(h.translate(t.x,t.y),h.rotate(t.rotation),h.translate(t.width<0?t.width:0,t.height<0?t.height:0),h.scale(Math.abs(l),Math.abs(d))):(h.translate(t.x,t.y),h.rotate(t.rotation),h.scale(l,d));const c=h.multiply(o.invert());this._nodes.forEach((t=>{var e;const i=t.getParent().getAbsoluteTransform(),r=t.getTransform().copy();r.translate(t.offsetX(),t.offsetY());const n=new a;n.multiply(i.copy().invert()).multiply(c).multiply(i).multiply(r);const s=n.decompose();t.setAttrs(s),null===(e=t.getLayer())||void 0===e||e.batchDraw()})),this.rotation(g._getRotation(t.rotation)),this._nodes.forEach((t=>{this._fire("transform",{evt:e,target:t}),t._fire("transform",{evt:e,target:t})})),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,e){this.findOne(t).setAttrs(e)}update(){var t,e=this._getNodeRect();this.rotation(g._getRotation(e.rotation));var i=e.width,r=e.height,a=this.enabledAnchors(),n=this.resizeEnabled(),s=this.padding(),o=this.anchorSize();const h=this.find("._anchor");h.forEach((t=>{t.setAttrs({width:o,height:o,offsetX:o/2,offsetY:o/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})})),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:o/2+s,offsetY:o/2+s,visible:n&&a.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:i/2,y:0,offsetY:o/2+s,visible:n&&a.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:i,y:0,offsetX:o/2-s,offsetY:o/2+s,visible:n&&a.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:o/2+s,visible:n&&a.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:i,y:r/2,offsetX:o/2-s,visible:n&&a.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:o/2+s,offsetY:o/2-s,visible:n&&a.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:i/2,y:r,offsetY:o/2-s,visible:n&&a.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:i,y:r,offsetX:o/2-s,offsetY:o/2-s,visible:n&&a.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:i/2,y:-this.rotateAnchorOffset()*g._sign(r)-s,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:i,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const l=this.anchorStyleFunc();l&&h.forEach((t=>{l(t)})),null===(t=this.getLayer())||void 0===t||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),Xt.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return V.prototype.toObject.call(this)}clone(t){return V.prototype.clone.call(this,t)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}ni.isTransforming=()=>ai>0,ni.prototype.className="Transformer",r(ni),w.addGetterSetter(ni,"enabledAnchors",ei,(function(t){return t instanceof Array||g.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach((function(t){-1===ei.indexOf(t)&&g.warn("Unknown anchor name: "+t+". Available names are: "+ei.join(", "))})),t||[]})),w.addGetterSetter(ni,"flipEnabled",!0,x()),w.addGetterSetter(ni,"resizeEnabled",!0),w.addGetterSetter(ni,"anchorSize",10,p()),w.addGetterSetter(ni,"rotateEnabled",!0),w.addGetterSetter(ni,"rotateLineVisible",!0),w.addGetterSetter(ni,"rotationSnaps",[]),w.addGetterSetter(ni,"rotateAnchorOffset",50,p()),w.addGetterSetter(ni,"rotateAnchorCursor","crosshair"),w.addGetterSetter(ni,"rotationSnapTolerance",5,p()),w.addGetterSetter(ni,"borderEnabled",!0),w.addGetterSetter(ni,"anchorStroke","rgb(0, 161, 255)"),w.addGetterSetter(ni,"anchorStrokeWidth",1,p()),w.addGetterSetter(ni,"anchorFill","white"),w.addGetterSetter(ni,"anchorCornerRadius",0,p()),w.addGetterSetter(ni,"borderStroke","rgb(0, 161, 255)"),w.addGetterSetter(ni,"borderStrokeWidth",1,p()),w.addGetterSetter(ni,"borderDash"),w.addGetterSetter(ni,"keepRatio",!0),w.addGetterSetter(ni,"shiftBehavior","default"),w.addGetterSetter(ni,"centeredScaling",!1),w.addGetterSetter(ni,"ignoreStroke",!1),w.addGetterSetter(ni,"padding",0,p()),w.addGetterSetter(ni,"node"),w.addGetterSetter(ni,"nodes"),w.addGetterSetter(ni,"boundBoxFunc"),w.addGetterSetter(ni,"anchorDragBoundFunc"),w.addGetterSetter(ni,"anchorStyleFunc"),w.addGetterSetter(ni,"shouldOverdrawWholeArea",!1),w.addGetterSetter(ni,"useSingleNodeRotation",!0),w.backCompat(ni,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class si extends Nt{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,i.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}function oi(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}si.prototype.className="Wedge",si.prototype._centroid=!0,si.prototype._attrsAffectingSize=["radius"],r(si),w.addGetterSetter(si,"radius",0,p()),w.addGetterSetter(si,"angle",0,p()),w.addGetterSetter(si,"clockwise",!1),w.backCompat(si,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var hi=[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],li=[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];w.addGetterSetter(V,"blurRadius",0,p(),w.afterSetFilter);w.addGetterSetter(V,"brightness",0,p(),w.afterSetFilter);w.addGetterSetter(V,"contrast",0,p(),w.afterSetFilter);function di(t,e,i,r,a){var n=i-e,s=a-r;return 0===n?r+s/2:0===s?r:s*((t-e)/n)+r}w.addGetterSetter(V,"embossStrength",.5,p(),w.afterSetFilter),w.addGetterSetter(V,"embossWhiteLevel",.5,p(),w.afterSetFilter),w.addGetterSetter(V,"embossDirection","top-left",null,w.afterSetFilter),w.addGetterSetter(V,"embossBlend",!1,null,w.afterSetFilter);w.addGetterSetter(V,"enhance",0,p(),w.afterSetFilter);w.addGetterSetter(V,"hue",0,p(),w.afterSetFilter),w.addGetterSetter(V,"saturation",0,p(),w.afterSetFilter),w.addGetterSetter(V,"luminance",0,p(),w.afterSetFilter);w.addGetterSetter(V,"hue",0,p(),w.afterSetFilter),w.addGetterSetter(V,"saturation",0,p(),w.afterSetFilter),w.addGetterSetter(V,"value",0,p(),w.afterSetFilter);function ci(t,e,i){var r=4*(i*t.width+e),a=[];return a.push(t.data[r++],t.data[r++],t.data[r++],t.data[r++]),a}function gi(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2))}w.addGetterSetter(V,"kaleidoscopePower",2,p(),w.afterSetFilter),w.addGetterSetter(V,"kaleidoscopeAngle",0,p(),w.afterSetFilter);w.addGetterSetter(V,"threshold",0,p(),w.afterSetFilter);w.addGetterSetter(V,"noise",.2,p(),w.afterSetFilter);w.addGetterSetter(V,"pixelSize",8,p(),w.afterSetFilter);w.addGetterSetter(V,"levels",.5,p(),w.afterSetFilter);w.addGetterSetter(V,"red",0,(function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)})),w.addGetterSetter(V,"green",0,(function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)})),w.addGetterSetter(V,"blue",0,f,w.afterSetFilter);w.addGetterSetter(V,"red",0,(function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)})),w.addGetterSetter(V,"green",0,(function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)})),w.addGetterSetter(V,"blue",0,f,w.afterSetFilter),w.addGetterSetter(V,"alpha",1,(function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t}));w.addGetterSetter(V,"threshold",.5,p(),w.afterSetFilter);return Zt.Util._assign(Zt,{Arc:te,Arrow:ue,Circle:fe,Ellipse:pe,Image:ve,Label:we,Tag:Ce,Line:re,Path:ge,Rect:Pe,RegularPolygon:ke,Ring:Te,Sprite:Me,Star:Ge,Text:Xe,TextPath:Ve,Transformer:ni,Wedge:si,Filters:{Blur:function(t){var e=Math.round(this.blurRadius());e>0&&function(t,e){var i,r,a,n,s,o,h,l,d,c,g,u,f,p,v,m,_,y,x,b,S,w,C,P,k=t.data,A=t.width,T=t.height,M=e+e+1,G=A-1,R=T-1,E=e+1,D=E*(E+1)/2,L=new oi,O=null,I=L,F=null,B=null,N=hi[e],H=li[e];for(a=1;a<M;a++)I=I.next=new oi,a===E&&(O=I);for(I.next=L,h=o=0,r=0;r<T;r++){for(m=_=y=x=l=d=c=g=0,u=E*(b=k[o]),f=E*(S=k[o+1]),p=E*(w=k[o+2]),v=E*(C=k[o+3]),l+=D*b,d+=D*S,c+=D*w,g+=D*C,I=L,a=0;a<E;a++)I.r=b,I.g=S,I.b=w,I.a=C,I=I.next;for(a=1;a<E;a++)n=o+((G<a?G:a)<<2),l+=(I.r=b=k[n])*(P=E-a),d+=(I.g=S=k[n+1])*P,c+=(I.b=w=k[n+2])*P,g+=(I.a=C=k[n+3])*P,m+=b,_+=S,y+=w,x+=C,I=I.next;for(F=L,B=O,i=0;i<A;i++)k[o+3]=C=g*N>>H,0!==C?(C=255/C,k[o]=(l*N>>H)*C,k[o+1]=(d*N>>H)*C,k[o+2]=(c*N>>H)*C):k[o]=k[o+1]=k[o+2]=0,l-=u,d-=f,c-=p,g-=v,u-=F.r,f-=F.g,p-=F.b,v-=F.a,n=h+((n=i+e+1)<G?n:G)<<2,l+=m+=F.r=k[n],d+=_+=F.g=k[n+1],c+=y+=F.b=k[n+2],g+=x+=F.a=k[n+3],F=F.next,u+=b=B.r,f+=S=B.g,p+=w=B.b,v+=C=B.a,m-=b,_-=S,y-=w,x-=C,B=B.next,o+=4;h+=A}for(i=0;i<A;i++){for(_=y=x=m=d=c=g=l=0,u=E*(b=k[o=i<<2]),f=E*(S=k[o+1]),p=E*(w=k[o+2]),v=E*(C=k[o+3]),l+=D*b,d+=D*S,c+=D*w,g+=D*C,I=L,a=0;a<E;a++)I.r=b,I.g=S,I.b=w,I.a=C,I=I.next;for(s=A,a=1;a<=e;a++)o=s+i<<2,l+=(I.r=b=k[o])*(P=E-a),d+=(I.g=S=k[o+1])*P,c+=(I.b=w=k[o+2])*P,g+=(I.a=C=k[o+3])*P,m+=b,_+=S,y+=w,x+=C,I=I.next,a<R&&(s+=A);for(o=i,F=L,B=O,r=0;r<T;r++)k[3+(n=o<<2)]=C=g*N>>H,C>0?(C=255/C,k[n]=(l*N>>H)*C,k[n+1]=(d*N>>H)*C,k[n+2]=(c*N>>H)*C):k[n]=k[n+1]=k[n+2]=0,l-=u,d-=f,c-=p,g-=v,u-=F.r,f-=F.g,p-=F.b,v-=F.a,n=i+((n=r+E)<R?n:R)*A<<2,l+=m+=F.r=k[n],d+=_+=F.g=k[n+1],c+=y+=F.b=k[n+2],g+=x+=F.a=k[n+3],F=F.next,u+=b=B.r,f+=S=B.g,p+=w=B.b,v+=C=B.a,m-=b,_-=S,y-=w,x-=C,B=B.next,o+=A}}(t,e)},Brighten:function(t){var e,i=255*this.brightness(),r=t.data,a=r.length;for(e=0;e<a;e+=4)r[e]+=i,r[e+1]+=i,r[e+2]+=i},Contrast:function(t){var e,i=Math.pow((this.contrast()+100)/100,2),r=t.data,a=r.length,n=150,s=150,o=150;for(e=0;e<a;e+=4)n=r[e],s=r[e+1],o=r[e+2],n/=255,n-=.5,n*=i,n+=.5,s/=255,s-=.5,s*=i,s+=.5,o/=255,o-=.5,o*=i,o+=.5,n=(n*=255)<0?0:n>255?255:n,s=(s*=255)<0?0:s>255?255:s,o=(o*=255)<0?0:o>255?255:o,r[e]=n,r[e+1]=s,r[e+2]=o},Emboss:function(t){var e=10*this.embossStrength(),i=255*this.embossWhiteLevel(),r=this.embossDirection(),a=this.embossBlend(),n=0,s=0,o=t.data,h=t.width,l=t.height,d=4*h,c=l;switch(r){case"top-left":n=-1,s=-1;break;case"top":n=-1,s=0;break;case"top-right":n=-1,s=1;break;case"right":n=0,s=1;break;case"bottom-right":n=1,s=1;break;case"bottom":n=1,s=0;break;case"bottom-left":n=1,s=-1;break;case"left":n=0,s=-1;break;default:g.error("Unknown emboss direction: "+r)}do{var u=(c-1)*d,f=n;c+f<1&&(f=0),c+f>l&&(f=0);var p=(c-1+f)*h*4,v=h;do{var m=u+4*(v-1),_=s;v+_<1&&(_=0),v+_>h&&(_=0);var y=p+4*(v-1+_),x=o[m]-o[y],b=o[m+1]-o[y+1],S=o[m+2]-o[y+2],w=x,C=w>0?w:-w;if((b>0?b:-b)>C&&(w=b),(S>0?S:-S)>C&&(w=S),w*=e,a){var P=o[m]+w,k=o[m+1]+w,A=o[m+2]+w;o[m]=P>255?255:P<0?0:P,o[m+1]=k>255?255:k<0?0:k,o[m+2]=A>255?255:A<0?0:A}else{var T=i-w;T<0?T=0:T>255&&(T=255),o[m]=o[m+1]=o[m+2]=T}}while(--v)}while(--c)},Enhance:function(t){var e,i,r,a,n=t.data,s=n.length,o=n[0],h=o,l=n[1],d=l,c=n[2],g=c,u=this.enhance();if(0!==u){for(a=0;a<s;a+=4)(e=n[a+0])<o?o=e:e>h&&(h=e),(i=n[a+1])<l?l=i:i>d&&(d=i),(r=n[a+2])<c?c=r:r>g&&(g=r);var f,p,v,m,_,y,x,b,S;for(h===o&&(h=255,o=0),d===l&&(d=255,l=0),g===c&&(g=255,c=0),u>0?(p=h+u*(255-h),v=o-u*(o-0),_=d+u*(255-d),y=l-u*(l-0),b=g+u*(255-g),S=c-u*(c-0)):(p=h+u*(h-(f=.5*(h+o))),v=o+u*(o-f),_=d+u*(d-(m=.5*(d+l))),y=l+u*(l-m),b=g+u*(g-(x=.5*(g+c))),S=c+u*(c-x)),a=0;a<s;a+=4)n[a+0]=di(n[a+0],o,h,v,p),n[a+1]=di(n[a+1],l,d,y,_),n[a+2]=di(n[a+2],c,g,S,b)}},Grayscale:function(t){var e,i,r=t.data,a=r.length;for(e=0;e<a;e+=4)i=.34*r[e]+.5*r[e+1]+.16*r[e+2],r[e]=i,r[e+1]=i,r[e+2]=i},HSL:function(t){var e,i,r,a,n,s=t.data,o=s.length,h=Math.pow(2,this.saturation()),l=Math.abs(this.hue()+360)%360,d=127*this.luminance(),c=1*h*Math.cos(l*Math.PI/180),g=1*h*Math.sin(l*Math.PI/180),u=.299+.701*c+.167*g,f=.587-.587*c+.33*g,p=.114-.114*c-.497*g,v=.299-.299*c-.328*g,m=.587+.413*c+.035*g,_=.114-.114*c+.293*g,y=.299-.3*c+1.25*g,x=.587-.586*c-1.05*g,b=.114+.886*c-.2*g;for(e=0;e<o;e+=4)i=s[e+0],r=s[e+1],a=s[e+2],n=s[e+3],s[e+0]=u*i+f*r+p*a+d,s[e+1]=v*i+m*r+_*a+d,s[e+2]=y*i+x*r+b*a+d,s[e+3]=n},HSV:function(t){var e,i,r,a,n,s=t.data,o=s.length,h=Math.pow(2,this.value()),l=Math.pow(2,this.saturation()),d=Math.abs(this.hue()+360)%360,c=h*l*Math.cos(d*Math.PI/180),g=h*l*Math.sin(d*Math.PI/180),u=.299*h+.701*c+.167*g,f=.587*h-.587*c+.33*g,p=.114*h-.114*c-.497*g,v=.299*h-.299*c-.328*g,m=.587*h+.413*c+.035*g,_=.114*h-.114*c+.293*g,y=.299*h-.3*c+1.25*g,x=.587*h-.586*c-1.05*g,b=.114*h+.886*c-.2*g;for(e=0;e<o;e+=4)i=s[e+0],r=s[e+1],a=s[e+2],n=s[e+3],s[e+0]=u*i+f*r+p*a,s[e+1]=v*i+m*r+_*a,s[e+2]=y*i+x*r+b*a,s[e+3]=n},Invert:function(t){var e,i=t.data,r=i.length;for(e=0;e<r;e+=4)i[e]=255-i[e],i[e+1]=255-i[e+1],i[e+2]=255-i[e+2]},Kaleidoscope:function(t){var e,i,r,a,n,s,o,h,l,d=t.width,c=t.height,u=Math.round(this.kaleidoscopePower()),f=Math.round(this.kaleidoscopeAngle()),p=Math.floor(d*(f%360)/360);if(!(u<1)){var v=g.createCanvasElement();v.width=d,v.height=c;var m=v.getContext("2d").getImageData(0,0,d,c);g.releaseCanvas(v),function(t,e,i){var r,a,n,s,o=t.data,h=e.data,l=t.width,d=t.height,c=i.polarCenterX||l/2,g=i.polarCenterY||d/2,u=0,f=0,p=0,v=0,m=Math.sqrt(c*c+g*g);a=l-c,n=d-g,m=(s=Math.sqrt(a*a+n*n))>m?s:m;var _,y,x,b,S=d,w=l,C=360/w*Math.PI/180;for(y=0;y<w;y+=1)for(x=Math.sin(y*C),b=Math.cos(y*C),_=0;_<S;_+=1)a=Math.floor(c+m*_/S*b),u=o[0+(r=4*((n=Math.floor(g+m*_/S*x))*l+a))],f=o[r+1],p=o[r+2],v=o[r+3],h[0+(r=4*(y+_*l))]=u,h[r+1]=f,h[r+2]=p,h[r+3]=v}(t,m,{polarCenterX:d/2,polarCenterY:c/2});for(var _=d/Math.pow(2,u);_<=8;)_*=2,u-=1;var y=_=Math.ceil(_),x=0,b=y,S=1;for(p+_>d&&(x=y,b=0,S=-1),i=0;i<c;i+=1)for(e=x;e!==b;e+=S)h=4*(d*i+Math.round(e+p)%d),a=m.data[h+0],n=m.data[h+1],s=m.data[h+2],o=m.data[h+3],l=4*(d*i+e),m.data[l+0]=a,m.data[l+1]=n,m.data[l+2]=s,m.data[l+3]=o;for(i=0;i<c;i+=1)for(y=Math.floor(_),r=0;r<u;r+=1){for(e=0;e<y+1;e+=1)h=4*(d*i+e),a=m.data[h+0],n=m.data[h+1],s=m.data[h+2],o=m.data[h+3],l=4*(d*i+2*y-e-1),m.data[l+0]=a,m.data[l+1]=n,m.data[l+2]=s,m.data[l+3]=o;y*=2}!function(t,e,i){var r,a,n,s,o,h,l=t.data,d=e.data,c=t.width,g=t.height,u=i.polarCenterX||c/2,f=i.polarCenterY||g/2,p=0,v=0,m=0,_=0,y=Math.sqrt(u*u+f*f);a=c-u,n=g-f,y=(h=Math.sqrt(a*a+n*n))>y?h:y;var x,b,S,w=g,C=c;for(a=0;a<c;a+=1)for(n=0;n<g;n+=1)s=a-u,o=n-f,x=Math.sqrt(s*s+o*o)*w/y,b=(b=(180*Math.atan2(o,s)/Math.PI+360+0)%360)*C/360,S=Math.floor(b),p=l[0+(r=4*(Math.floor(x)*c+S))],v=l[r+1],m=l[r+2],_=l[r+3],d[0+(r=4*(n*c+a))]=p,d[r+1]=v,d[r+2]=m,d[r+3]=_}(m,t,{polarRotation:0})}},Mask:function(t){var e=function(t,e){var i=ci(t,0,0),r=ci(t,t.width-1,0),a=ci(t,0,t.height-1),n=ci(t,t.width-1,t.height-1),s=e||10;if(gi(i,r)<s&&gi(r,n)<s&&gi(n,a)<s&&gi(a,i)<s){for(var o=function(t){for(var e=[0,0,0],i=0;i<t.length;i++)e[0]+=t[i][0],e[1]+=t[i][1],e[2]+=t[i][2];return e[0]/=t.length,e[1]/=t.length,e[2]/=t.length,e}([r,i,n,a]),h=[],l=0;l<t.width*t.height;l++){var d=gi(o,[t.data[4*l],t.data[4*l+1],t.data[4*l+2]]);h[l]=d<s?0:255}return h}}(t,this.threshold());return e&&function(t,e){for(var i=0;i<t.width*t.height;i++)t.data[4*i+3]=e[i]}(t,e=function(t,e,i){for(var r=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],a=Math.round(Math.sqrt(r.length)),n=Math.floor(a/2),s=[],o=0;o<i;o++)for(var h=0;h<e;h++){for(var l=o*e+h,d=0,c=0;c<a;c++)for(var g=0;g<a;g++){var u=o+c-n,f=h+g-n;if(u>=0&&u<i&&f>=0&&f<e){var p=r[c*a+g];d+=t[u*e+f]*p}}s[l]=d}return s}(e=function(t,e,i){for(var r=[1,1,1,1,1,1,1,1,1],a=Math.round(Math.sqrt(r.length)),n=Math.floor(a/2),s=[],o=0;o<i;o++)for(var h=0;h<e;h++){for(var l=o*e+h,d=0,c=0;c<a;c++)for(var g=0;g<a;g++){var u=o+c-n,f=h+g-n;if(u>=0&&u<i&&f>=0&&f<e){var p=r[c*a+g];d+=t[u*e+f]*p}}s[l]=d>=1020?255:0}return s}(e=function(t,e,i){for(var r=[1,1,1,1,0,1,1,1,1],a=Math.round(Math.sqrt(r.length)),n=Math.floor(a/2),s=[],o=0;o<i;o++)for(var h=0;h<e;h++){for(var l=o*e+h,d=0,c=0;c<a;c++)for(var g=0;g<a;g++){var u=o+c-n,f=h+g-n;if(u>=0&&u<i&&f>=0&&f<e){var p=r[c*a+g];d+=t[u*e+f]*p}}s[l]=2040===d?255:0}return s}(e,t.width,t.height),t.width,t.height),t.width,t.height)),t},Noise:function(t){var e,i=255*this.noise(),r=t.data,a=r.length,n=i/2;for(e=0;e<a;e+=4)r[e+0]+=n-2*n*Math.random(),r[e+1]+=n-2*n*Math.random(),r[e+2]+=n-2*n*Math.random()},Pixelate:function(t){var e,i,r,a,n,s,o,h,l,d,c,u,f,p,v=Math.ceil(this.pixelSize()),m=t.width,_=t.height,y=Math.ceil(m/v),x=Math.ceil(_/v),b=t.data;if(v<=0)g.error("pixelSize value can not be <= 0");else for(u=0;u<y;u+=1)for(f=0;f<x;f+=1){for(a=0,n=0,s=0,o=0,l=(h=u*v)+v,c=(d=f*v)+v,p=0,e=h;e<l;e+=1)if(!(e>=m))for(i=d;i<c;i+=1)i>=_||(a+=b[(r=4*(m*i+e))+0],n+=b[r+1],s+=b[r+2],o+=b[r+3],p+=1);for(a/=p,n/=p,s/=p,o/=p,e=h;e<l;e+=1)if(!(e>=m))for(i=d;i<c;i+=1)i>=_||(b[(r=4*(m*i+e))+0]=a,b[r+1]=n,b[r+2]=s,b[r+3]=o)}},Posterize:function(t){var e,i=Math.round(254*this.levels())+1,r=t.data,a=r.length,n=255/i;for(e=0;e<a;e+=1)r[e]=Math.floor(r[e]/n)*n},RGB:function(t){var e,i,r=t.data,a=r.length,n=this.red(),s=this.green(),o=this.blue();for(e=0;e<a;e+=4)i=(.34*r[e]+.5*r[e+1]+.16*r[e+2])/255,r[e]=i*n,r[e+1]=i*s,r[e+2]=i*o,r[e+3]=r[e+3]},RGBA:function(t){var e,i,r=t.data,a=r.length,n=this.red(),s=this.green(),o=this.blue(),h=this.alpha();for(e=0;e<a;e+=4)i=1-h,r[e]=n*h+r[e]*i,r[e+1]=s*h+r[e+1]*i,r[e+2]=o*h+r[e+2]*i},Sepia:function(t){var e,i,r,a,n=t.data,s=n.length;for(e=0;e<s;e+=4)i=n[e+0],r=n[e+1],a=n[e+2],n[e+0]=Math.min(255,.393*i+.769*r+.189*a),n[e+1]=Math.min(255,.349*i+.686*r+.168*a),n[e+2]=Math.min(255,.272*i+.534*r+.131*a)},Solarize:function(t){var e=t.data,i=t.width,r=4*i,a=t.height;do{var n=(a-1)*r,s=i;do{var o=n+4*(s-1),h=e[o],l=e[o+1],d=e[o+2];h>127&&(h=255-h),l>127&&(l=255-l),d>127&&(d=255-d),e[o]=h,e[o+1]=l,e[o+2]=d}while(--s)}while(--a)},Threshold:function(t){var e,i=255*this.threshold(),r=t.data,a=r.length;for(e=0;e<a;e+=1)r[e]=r[e]<i?0:255}}})}));
     12   */const t=Math.PI/180;const e="undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:{},i={_global:e,version:"9.3.16",isBrowser:"undefined"!=typeof window&&("[object Window]"==={}.toString.call(window)||"[object global]"==={}.toString.call(window)),isUnminified:/param/.test(function(t){}.toString()),dblClickWindow:400,getAngle:e=>i.angleDeg?e*t:e,enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_fixTextRendering:!1,pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging:()=>i.DD.isDragging,isTransforming(){var t;return null===(t=i.Transformer)||void 0===t?void 0:t.isTransforming()},isDragReady:()=>!!i.DD.node,releaseCanvasOnDestroy:!0,document:e.document,_injectGlobal(t){e.Konva=t}},n=t=>{i[t.prototype.getClassName()]=t};i._injectGlobal(i);class s{constructor(t=[1,0,0,1,0,0]){this.dirty=!1,this.m=t&&t.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new s(this.m)}copyInto(t){t.m[0]=this.m[0],t.m[1]=this.m[1],t.m[2]=this.m[2],t.m[3]=this.m[3],t.m[4]=this.m[4],t.m[5]=this.m[5]}point(t){const e=this.m;return{x:e[0]*t.x+e[2]*t.y+e[4],y:e[1]*t.x+e[3]*t.y+e[5]}}translate(t,e){return this.m[4]+=this.m[0]*t+this.m[2]*e,this.m[5]+=this.m[1]*t+this.m[3]*e,this}scale(t,e){return this.m[0]*=t,this.m[1]*=t,this.m[2]*=e,this.m[3]*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.m[0]*e+this.m[2]*i,s=this.m[1]*e+this.m[3]*i,r=this.m[0]*-i+this.m[2]*e,a=this.m[1]*-i+this.m[3]*e;return this.m[0]=n,this.m[1]=s,this.m[2]=r,this.m[3]=a,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(t,e){const i=this.m[0]+this.m[2]*e,n=this.m[1]+this.m[3]*e,s=this.m[2]+this.m[0]*t,r=this.m[3]+this.m[1]*t;return this.m[0]=i,this.m[1]=n,this.m[2]=s,this.m[3]=r,this}multiply(t){const e=this.m[0]*t.m[0]+this.m[2]*t.m[1],i=this.m[1]*t.m[0]+this.m[3]*t.m[1],n=this.m[0]*t.m[2]+this.m[2]*t.m[3],s=this.m[1]*t.m[2]+this.m[3]*t.m[3],r=this.m[0]*t.m[4]+this.m[2]*t.m[5]+this.m[4],a=this.m[1]*t.m[4]+this.m[3]*t.m[5]+this.m[5];return this.m[0]=e,this.m[1]=i,this.m[2]=n,this.m[3]=s,this.m[4]=r,this.m[5]=a,this}invert(){const t=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),e=this.m[3]*t,i=-this.m[1]*t,n=-this.m[2]*t,s=this.m[0]*t,r=t*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),a=t*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=e,this.m[1]=i,this.m[2]=n,this.m[3]=s,this.m[4]=r,this.m[5]=a,this}getMatrix(){return this.m}decompose(){const t=this.m[0],e=this.m[1],i=this.m[2],n=this.m[3],s=t*n-e*i,r={x:this.m[4],y:this.m[5],rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!=t||0!=e){const a=Math.sqrt(t*t+e*e);r.rotation=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=s/a,r.skewX=(t*i+e*n)/s,r.skewY=0}else if(0!=i||0!=n){const a=Math.sqrt(i*i+n*n);r.rotation=Math.PI/2-(n>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=s/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*n)/s}return r.rotation=g._getRotation(r.rotation),r}}let r=Math.PI/180,a=180/Math.PI,o="Konva error: ",h={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},l=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,d=[];const c="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||function(t){setTimeout(t,60)},g={_isElement:t=>!(!t||1!=t.nodeType),_isFunction:t=>!!(t&&t.constructor&&t.call&&t.apply),_isPlainObject:t=>!!t&&t.constructor===Object,_isArray:t=>"[object Array]"===Object.prototype.toString.call(t),_isNumber:t=>"[object Number]"===Object.prototype.toString.call(t)&&!isNaN(t)&&isFinite(t),_isString:t=>"[object String]"===Object.prototype.toString.call(t),_isBoolean:t=>"[object Boolean]"===Object.prototype.toString.call(t),isObject:t=>t instanceof Object,isValidSelector(t){if("string"!=typeof t)return!1;const e=t[0];return"#"===e||"."===e||e===e.toUpperCase()},_sign:t=>0===t||t>0?1:-1,requestAnimFrame(t){d.push(t),1===d.length&&c((function(){const t=d;d=[],t.forEach((function(t){t()}))}))},createCanvasElement(){const t=document.createElement("canvas");try{t.style=t.style||{}}catch(t){}return t},createImageElement:()=>document.createElement("img"),_isInDocument(t){for(;t=t.parentNode;)if(t==document)return!0;return!1},_urlToImage(t,e){const i=g.createImageElement();i.onload=function(){e(i)},i.src=t},_rgbToHex:(t,e,i)=>((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1),_hexToRgb(t){t=t.replace("#","");const e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:255&e}},getRandomColor(){let t=(16777215*Math.random()|0).toString(16);for(;t.length<6;)t="0"+t;return"#"+t},getRGB(t){let e;return t in h?(e=h[t],{r:e[0],g:e[1],b:e[2]}):"#"===t[0]?this._hexToRgb(t.substring(1)):"rgb("===t.substr(0,4)?(e=l.exec(t.replace(/ /g,"")),{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)}):{r:0,g:0,b:0}},colorToRGBA:t=>(t=t||"black",g._namedColorToRBA(t)||g._hex3ColorToRGBA(t)||g._hex4ColorToRGBA(t)||g._hex6ColorToRGBA(t)||g._hex8ColorToRGBA(t)||g._rgbColorToRGBA(t)||g._rgbaColorToRGBA(t)||g._hslColorToRGBA(t)),_namedColorToRBA(t){const e=h[t.toLowerCase()];return e?{r:e[0],g:e[1],b:e[2],a:1}:null},_rgbColorToRGBA(t){if(0===t.indexOf("rgb(")){const e=(t=t.match(/rgb\(([^)]+)\)/)[1]).split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:1}}},_rgbaColorToRGBA(t){if(0===t.indexOf("rgba(")){const e=(t=t.match(/rgba\(([^)]+)\)/)[1]).split(/ *, */).map(((t,e)=>"%"===t.slice(-1)?3===e?parseInt(t)/100:parseInt(t)/100*255:Number(t)));return{r:e[0],g:e[1],b:e[2],a:e[3]}}},_hex8ColorToRGBA(t){if("#"===t[0]&&9===t.length)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:parseInt(t.slice(7,9),16)/255}},_hex6ColorToRGBA(t){if("#"===t[0]&&7===t.length)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:1}},_hex4ColorToRGBA(t){if("#"===t[0]&&5===t.length)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:parseInt(t[4]+t[4],16)/255}},_hex3ColorToRGBA(t){if("#"===t[0]&&4===t.length)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:1}},_hslColorToRGBA(t){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(t)){const[e,...i]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t),n=Number(i[0])/360,s=Number(i[1])/100,r=Number(i[2])/100;let a,o,h;if(0===s)return h=255*r,{r:Math.round(h),g:Math.round(h),b:Math.round(h),a:1};a=r<.5?r*(1+s):r+s-r*s;const l=2*r-a,d=[0,0,0];for(let t=0;t<3;t++)o=n+1/3*-(t-1),o<0&&o++,o>1&&o--,h=6*o<1?l+6*(a-l)*o:2*o<1?a:3*o<2?l+(a-l)*(2/3-o)*6:l,d[t]=255*h;return{r:Math.round(d[0]),g:Math.round(d[1]),b:Math.round(d[2]),a:1}}},haveIntersection:(t,e)=>!(e.x>t.x+t.width||e.x+e.width<t.x||e.y>t.y+t.height||e.y+e.height<t.y),cloneObject(t){const e={};for(const i in t)this._isPlainObject(t[i])?e[i]=this.cloneObject(t[i]):this._isArray(t[i])?e[i]=this.cloneArray(t[i]):e[i]=t[i];return e},cloneArray:t=>t.slice(0),degToRad:t=>t*r,radToDeg:t=>t*a,_degToRad:t=>(g.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),g.degToRad(t)),_radToDeg:t=>(g.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),g.radToDeg(t)),_getRotation:t=>i.angleDeg?g.radToDeg(t):t,_capitalize:t=>t.charAt(0).toUpperCase()+t.slice(1),throw(t){throw new Error(o+t)},error(t){console.error(o+t)},warn(t){i.showWarnings&&console.warn("Konva warning: "+t)},each(t,e){for(const i in t)e(i,t[i])},_inRange:(t,e,i)=>e<=t&&t<i,_getProjectionToSegment(t,e,i,n,s,r){let a,o,h;const l=(t-i)*(t-i)+(e-n)*(e-n);if(0==l)a=t,o=e,h=(s-i)*(s-i)+(r-n)*(r-n);else{const d=((s-t)*(i-t)+(r-e)*(n-e))/l;d<0?(a=t,o=e,h=(t-s)*(t-s)+(e-r)*(e-r)):d>1?(a=i,o=n,h=(i-s)*(i-s)+(n-r)*(n-r)):(a=t+d*(i-t),o=e+d*(n-e),h=(a-s)*(a-s)+(o-r)*(o-r))}return[a,o,h]},_getProjectionToLine(t,e,i){const n=g.cloneObject(t);let s=Number.MAX_VALUE;return e.forEach((function(r,a){if(!i&&a===e.length-1)return;const o=e[(a+1)%e.length],h=g._getProjectionToSegment(r.x,r.y,o.x,o.y,t.x,t.y),l=h[0],d=h[1],c=h[2];c<s&&(n.x=l,n.y=d,s=c)})),n},_prepareArrayForTween(t,e,i){let n,s=[],r=[];if(t.length>e.length){const i=e;e=t,t=i}for(n=0;n<t.length;n+=2)s.push({x:t[n],y:t[n+1]});for(n=0;n<e.length;n+=2)r.push({x:e[n],y:e[n+1]});const a=[];return r.forEach((function(t){const e=g._getProjectionToLine(t,s,i);a.push(e.x),a.push(e.y)})),a},_prepareToStringify(t){let e;t.visitedByCircularReferenceRemoval=!0;for(const i in t)if(t.hasOwnProperty(i)&&t[i]&&"object"==typeof t[i])if(e=Object.getOwnPropertyDescriptor(t,i),t[i].visitedByCircularReferenceRemoval||g._isElement(t[i])){if(!e.configurable)return null;delete t[i]}else if(null===g._prepareToStringify(t[i])){if(!e.configurable)return null;delete t[i]}return delete t.visitedByCircularReferenceRemoval,t},_assign(t,e){for(const i in e)t[i]=e[i];return t},_getFirstPointerId:t=>t.touches?t.changedTouches[0].identifier:t.pointerId||999,releaseCanvas(...t){i.releaseCanvasOnDestroy&&t.forEach((t=>{t.width=0,t.height=0}))},drawRoundedRectPath(t,e,i,n){let s=0,r=0,a=0,o=0;"number"==typeof n?s=r=a=o=Math.min(n,e/2,i/2):(s=Math.min(n[0]||0,e/2,i/2),r=Math.min(n[1]||0,e/2,i/2),o=Math.min(n[2]||0,e/2,i/2),a=Math.min(n[3]||0,e/2,i/2)),t.moveTo(s,0),t.lineTo(e-r,0),t.arc(e-r,r,r,3*Math.PI/2,0,!1),t.lineTo(e,i-o),t.arc(e-o,i-o,o,0,Math.PI/2,!1),t.lineTo(a,i),t.arc(a,i-a,a,Math.PI/2,Math.PI,!1),t.lineTo(0,s),t.arc(s,s,s,Math.PI,3*Math.PI/2,!1)}};function u(t){return g._isString(t)?'"'+t+'"':"[object Number]"===Object.prototype.toString.call(t)||g._isBoolean(t)?t:Object.prototype.toString.call(t)}function f(t){return t>255?255:t<0?0:Math.round(t)}function p(){if(i.isUnminified)return function(t,e){return g._isNumber(t)||g.warn(u(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function m(t){if(i.isUnminified)return function(e,i){const n=g._isNumber(e),s=g._isArray(e)&&e.length==t;return n||s||g.warn(u(e)+' is a not valid value for "'+i+'" attribute. The value should be a number or Array<number>('+t+")"),e}}function _(){if(i.isUnminified)return function(t,e){return g._isNumber(t)||"auto"===t||g.warn(u(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function y(){if(i.isUnminified)return function(t,e){return g._isString(t)||g.warn(u(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function v(){if(i.isUnminified)return function(t,e){const i=g._isString(t),n="[object CanvasGradient]"===Object.prototype.toString.call(t)||t&&t.addColorStop;return i||n||g.warn(u(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function x(){if(i.isUnminified)return function(t,e){return!0===t||!1===t||g.warn(u(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}const b="get",S="set",w={addGetterSetter(t,e,i,n,s){w.addGetter(t,e,i),w.addSetter(t,e,n,s),w.addOverloadedGetterSetter(t,e)},addGetter(t,e,i){const n=b+g._capitalize(e);t.prototype[n]=t.prototype[n]||function(){const t=this.attrs[e];return void 0===t?i:t}},addSetter(t,e,i,n){const s=S+g._capitalize(e);t.prototype[s]||w.overWriteSetter(t,e,i,n)},overWriteSetter(t,e,i,n){const s=S+g._capitalize(e);t.prototype[s]=function(t){return i&&null!=t&&(t=i.call(this,t,e)),this._setAttr(e,t),n&&n.call(this),this}},addComponentsGetterSetter(t,e,n,s,r){let a,o,h=n.length,l=g._capitalize,d=b+l(e),c=S+l(e);t.prototype[d]=function(){const t={};for(a=0;a<h;a++)o=n[a],t[o]=this.getAttr(e+l(o));return t};const f=function(t){if(i.isUnminified)return function(e,i){return null==e||g.isObject(e)||g.warn(u(e)+' is a not valid value for "'+i+'" attribute. The value should be an object with properties '+t),e}}(n);t.prototype[c]=function(t){let i,a=this.attrs[e];for(i in s&&(t=s.call(this,t)),f&&f.call(this,t,e),t)t.hasOwnProperty(i)&&this._setAttr(e+l(i),t[i]);return t||n.forEach((t=>{this._setAttr(e+l(t),void 0)})),this._fireChangeEvent(e,a,t),r&&r.call(this),this},w.addOverloadedGetterSetter(t,e)},addOverloadedGetterSetter(t,e){const i=g._capitalize(e),n=S+i,s=b+i;t.prototype[e]=function(){return arguments.length?(this[n](arguments[0]),this):this[s]()}},addDeprecatedGetterSetter(t,e,i,n){g.error("Adding deprecated "+e);const s=b+g._capitalize(e),r=e+" property is deprecated and will be removed soon. Look at Konva change log for more information.";t.prototype[s]=function(){g.error(r);const t=this.attrs[e];return void 0===t?i:t},w.addSetter(t,e,n,(function(){g.error(r)})),w.addOverloadedGetterSetter(t,e)},backCompat(t,e){g.each(e,(function(e,i){const n=t.prototype[i],s=b+g._capitalize(e),r=S+g._capitalize(e);function a(){n.apply(this,arguments),g.error('"'+e+'" method is deprecated and will be removed soon. Use ""'+i+'" instead.')}t.prototype[e]=a,t.prototype[s]=a,t.prototype[r]=a}))},afterSetFilter(){this._filterUpToDate=!1}};const C=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","roundRect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"];class P{constructor(t){this.canvas=t,i.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(t){t.fillEnabled()&&this._fill(t)}_fill(t){}strokeShape(t){t.hasStroke()&&this._stroke(t)}_stroke(t){}fillStrokeShape(t){t.attrs.fillAfterStrokeEnabled?(this.strokeShape(t),this.fillShape(t)):(this.fillShape(t),this.strokeShape(t))}getTrace(t,e){let i,n,s,r,a=this.traceArr,o=a.length,h="";for(i=0;i<o;i++)n=a[i],s=n.method,s?(r=n.args,h+=s,t?h+="()":g._isArray(r[0])?h+="(["+r.join(",")+"])":(e&&(r=r.map((t=>"number"==typeof t?Math.floor(t):t))),h+="("+r.join(",")+")")):(h+=n.property,t||(h+="="+n.val)),h+=";";return h}clearTrace(){this.traceArr=[]}_trace(t){let e,i=this.traceArr;i.push(t),e=i.length,e>=100&&i.shift()}reset(){const t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){const e=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,e.getWidth()/e.pixelRatio,e.getHeight()/e.pixelRatio)}_applyLineCap(t){const e=t.attrs.lineCap;e&&this.setAttr("lineCap",e)}_applyOpacity(t){const e=t.getAbsoluteOpacity();1!==e&&this.setAttr("globalAlpha",e)}_applyLineJoin(t){const e=t.attrs.lineJoin;e&&this.setAttr("lineJoin",e)}setAttr(t,e){this._context[t]=e}arc(t,e,i,n,s,r){this._context.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this._context.arcTo(t,e,i,n,s)}beginPath(){this._context.beginPath()}bezierCurveTo(t,e,i,n,s,r){this._context.bezierCurveTo(t,e,i,n,s,r)}clearRect(t,e,i,n){this._context.clearRect(t,e,i,n)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,e){const i=arguments;return 2===i.length?this._context.createImageData(t,e):1===i.length?this._context.createImageData(t):void 0}createLinearGradient(t,e,i,n){return this._context.createLinearGradient(t,e,i,n)}createPattern(t,e){return this._context.createPattern(t,e)}createRadialGradient(t,e,i,n,s,r){return this._context.createRadialGradient(t,e,i,n,s,r)}drawImage(t,e,i,n,s,r,a,o,h){const l=arguments,d=this._context;3===l.length?d.drawImage(t,e,i):5===l.length?d.drawImage(t,e,i,n,s):9===l.length&&d.drawImage(t,e,i,n,s,r,a,o,h)}ellipse(t,e,i,n,s,r,a,o){this._context.ellipse(t,e,i,n,s,r,a,o)}isPointInPath(t,e,i,n){return i?this._context.isPointInPath(i,t,e,n):this._context.isPointInPath(t,e,n)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,e,i,n){this._context.fillRect(t,e,i,n)}strokeRect(t,e,i,n){this._context.strokeRect(t,e,i,n)}fillText(t,e,i,n){n?this._context.fillText(t,e,i,n):this._context.fillText(t,e,i)}measureText(t){return this._context.measureText(t)}getImageData(t,e,i,n){return this._context.getImageData(t,e,i,n)}lineTo(t,e){this._context.lineTo(t,e)}moveTo(t,e){this._context.moveTo(t,e)}rect(t,e,i,n){this._context.rect(t,e,i,n)}roundRect(t,e,i,n,s){this._context.roundRect(t,e,i,n,s)}putImageData(t,e,i){this._context.putImageData(t,e,i)}quadraticCurveTo(t,e,i,n){this._context.quadraticCurveTo(t,e,i,n)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,e){this._context.scale(t,e)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,e,i,n,s,r){this._context.setTransform(t,e,i,n,s,r)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,e,i,n){this._context.strokeText(t,e,i,n)}transform(t,e,i,n,s,r){this._context.transform(t,e,i,n,s,r)}translate(t,e){this._context.translate(t,e)}_enableTrace(){let t,e,i=this,n=C.length,s=this.setAttr;const r=function(t){let n,s=i[t];i[t]=function(){return e=function(t){let e,i,n=[],s=t.length,r=g;for(e=0;e<s;e++)i=t[e],r._isNumber(i)?i=Math.round(1e3*i)/1e3:r._isString(i)||(i+=""),n.push(i);return n}(Array.prototype.slice.call(arguments,0)),n=s.apply(i,arguments),i._trace({method:t,args:e}),n}};for(t=0;t<n;t++)r(C[t]);i.setAttr=function(){s.apply(i,arguments);const t=arguments[0];let e=arguments[1];"shadowOffsetX"!==t&&"shadowOffsetY"!==t&&"shadowBlur"!==t||(e/=this.canvas.getPixelRatio()),i._trace({property:t,val:e})}}_applyGlobalCompositeOperation(t){const e=t.attrs.globalCompositeOperation;!e||"source-over"===e||this.setAttr("globalCompositeOperation",e)}}["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled"].forEach((function(t){Object.defineProperty(P.prototype,t,{get(){return this._context[t]},set(e){this._context[t]=e}})}));class k extends P{constructor(t,{willReadFrequently:e=!1}={}){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:e})}_fillColor(t){const e=t.fill();this.setAttr("fillStyle",e),t._fillFunc(this)}_fillPattern(t){this.setAttr("fillStyle",t._getFillPattern()),t._fillFunc(this)}_fillLinearGradient(t){const e=t._getLinearGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fillRadialGradient(t){const e=t._getRadialGradient();e&&(this.setAttr("fillStyle",e),t._fillFunc(this))}_fill(t){const e=t.fill(),i=t.getFillPriority();if(e&&"color"===i)return void this._fillColor(t);const n=t.getFillPatternImage();if(n&&"pattern"===i)return void this._fillPattern(t);const s=t.getFillLinearGradientColorStops();if(s&&"linear-gradient"===i)return void this._fillLinearGradient(t);const r=t.getFillRadialGradientColorStops();r&&"radial-gradient"===i?this._fillRadialGradient(t):e?this._fillColor(t):n?this._fillPattern(t):s?this._fillLinearGradient(t):r&&this._fillRadialGradient(t)}_strokeLinearGradient(t){const e=t.getStrokeLinearGradientStartPoint(),i=t.getStrokeLinearGradientEndPoint(),n=t.getStrokeLinearGradientColorStops(),s=this.createLinearGradient(e.x,e.y,i.x,i.y);if(n){for(let t=0;t<n.length;t+=2)s.addColorStop(n[t],n[t+1]);this.setAttr("strokeStyle",s)}}_stroke(t){const e=t.dash(),i=t.getStrokeScaleEnabled();if(t.hasStroke()){if(!i){this.save();const t=this.getCanvas().getPixelRatio();this.setTransform(t,0,0,t,0,0)}this._applyLineCap(t),e&&t.dashEnabled()&&(this.setLineDash(e),this.setAttr("lineDashOffset",t.dashOffset())),this.setAttr("lineWidth",t.strokeWidth()),t.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)");t.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(t):this.setAttr("strokeStyle",t.stroke()),t._strokeFunc(this),i||this.restore()}}_applyShadow(t){var e,i,n;const s=null!==(e=t.getShadowRGBA())&&void 0!==e?e:"black",r=null!==(i=t.getShadowBlur())&&void 0!==i?i:5,a=null!==(n=t.getShadowOffset())&&void 0!==n?n:{x:0,y:0},o=t.getAbsoluteScale(),h=this.canvas.getPixelRatio(),l=o.x*h,d=o.y*h;this.setAttr("shadowColor",s),this.setAttr("shadowBlur",r*Math.min(Math.abs(l),Math.abs(d))),this.setAttr("shadowOffsetX",a.x*l),this.setAttr("shadowOffsetY",a.y*d)}}class A extends P{constructor(t){super(t),this._context=t._canvas.getContext("2d",{willReadFrequently:!0})}_fill(t){this.save(),this.setAttr("fillStyle",t.colorKey),t._fillFuncHit(this),this.restore()}strokeShape(t){t.hasHitStroke()&&this._stroke(t)}_stroke(t){if(t.hasHitStroke()){const e=t.getStrokeScaleEnabled();if(!e){this.save();const t=this.getCanvas().getPixelRatio();this.setTransform(t,0,0,t,0,0)}this._applyLineCap(t);const i=t.hitStrokeWidth(),n="auto"===i?t.strokeWidth():i;this.setAttr("lineWidth",n),this.setAttr("strokeStyle",t.colorKey),t._strokeFuncHit(this),e||this.restore()}}}let T;class M{constructor(t){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const e=(t||{}).pixelRatio||i.pixelRatio||function(){if(T)return T;const t=g.createCanvasElement(),e=t.getContext("2d");return T=(i._global.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1),g.releaseCanvas(t),T}();this.pixelRatio=e,this._canvas=g.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(t){const e=this.pixelRatio;this.pixelRatio=t,this.setSize(this.getWidth()/e,this.getHeight()/e)}setWidth(t){this.width=this._canvas.width=t*this.pixelRatio,this._canvas.style.width=t+"px";const e=this.pixelRatio;this.getContext()._context.scale(e,e)}setHeight(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";const e=this.pixelRatio;this.getContext()._context.scale(e,e)}getWidth(){return this.width}getHeight(){return this.height}setSize(t,e){this.setWidth(t||0),this.setHeight(e||0)}toDataURL(t,e){try{return this._canvas.toDataURL(t,e)}catch(t){try{return this._canvas.toDataURL()}catch(t){return g.error("Unable to get data URL. "+t.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}w.addGetterSetter(M,"pixelRatio",void 0,p());class G extends M{constructor(t={width:0,height:0,willReadFrequently:!1}){super(t),this.context=new k(this,{willReadFrequently:t.willReadFrequently}),this.setSize(t.width,t.height)}}class R extends M{constructor(t={width:0,height:0}){super(t),this.hitCanvas=!0,this.context=new A(this),this.setSize(t.width,t.height)}}const E={get isDragging(){let t=!1;return E._dragElements.forEach((e=>{"dragging"===e.dragStatus&&(t=!0)})),t},justDragged:!1,get node(){let t;return E._dragElements.forEach((e=>{t=e.node})),t},_dragElements:new Map,_drag(t){const e=[];E._dragElements.forEach(((i,n)=>{const{node:s}=i,r=s.getStage();r.setPointersPositions(t),void 0===i.pointerId&&(i.pointerId=g._getFirstPointerId(t));const a=r._changedPointerPositions.find((t=>t.id===i.pointerId));if(a){if("dragging"!==i.dragStatus){const e=s.dragDistance();if(Math.max(Math.abs(a.x-i.startPointerPos.x),Math.abs(a.y-i.startPointerPos.y))<e)return;if(s.startDrag({evt:t}),!s.isDragging())return}s._setDragPosition(t,i),e.push(s)}})),e.forEach((e=>{e.fire("dragmove",{type:"dragmove",target:e,evt:t},!0)}))},_endDragBefore(t){const e=[];E._dragElements.forEach((n=>{const{node:s}=n,r=s.getStage();t&&r.setPointersPositions(t);if(!r._changedPointerPositions.find((t=>t.id===n.pointerId)))return;"dragging"!==n.dragStatus&&"stopped"!==n.dragStatus||(E.justDragged=!0,i._mouseListenClick=!1,i._touchListenClick=!1,i._pointerListenClick=!1,n.dragStatus="stopped");const a=n.node.getLayer()||n.node instanceof i.Stage&&n.node;a&&-1===e.indexOf(a)&&e.push(a)})),e.forEach((t=>{t.draw()}))},_endDragAfter(t){E._dragElements.forEach(((e,i)=>{"stopped"===e.dragStatus&&e.node.fire("dragend",{type:"dragend",target:e.node,evt:t},!0),"dragging"!==e.dragStatus&&E._dragElements.delete(i)}))}};i.isBrowser&&(window.addEventListener("mouseup",E._endDragBefore,!0),window.addEventListener("touchend",E._endDragBefore,!0),window.addEventListener("touchcancel",E._endDragBefore,!0),window.addEventListener("mousemove",E._drag),window.addEventListener("touchmove",E._drag),window.addEventListener("mouseup",E._endDragAfter,!1),window.addEventListener("touchend",E._endDragAfter,!1),window.addEventListener("touchcancel",E._endDragAfter,!1));const D="absoluteOpacity",L="allEventListeners",I="absoluteTransform",O="absoluteScale",F="canvas",B="listening",N="mouseenter",H="mouseleave",W="Shape",z=" ",Y="stage",X="transform",j="visible",q=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(z);let U=1;class V{constructor(t){this._id=U++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){t!==X&&t!==I||!this._cache.get(t)?t?this._cache.delete(t):this._cache.clear():this._cache.get(t).dirty=!0}_getCache(t,e){let i=this._cache.get(t);return(void 0===i||(t===X||t===I)&&!0===i.dirty)&&(i=e.call(this),this._cache.set(t,i)),i}_calculate(t,e,i){if(!this._attachedDepsListeners.get(t)){const i=e.map((t=>t+"Change.konva")).join(z);this.on(i,(()=>{this._clearCache(t)})),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,i)}_getCanvasCache(){return this._cache.get(F)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===I&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(F)){const{scene:t,filter:e,hit:i}=this._cache.get(F);g.releaseCanvas(t,e,i),this._cache.delete(F)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){const e=t||{};let i={};void 0!==e.x&&void 0!==e.y&&void 0!==e.width&&void 0!==e.height||(i=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let n=Math.ceil(e.width||i.width),s=Math.ceil(e.height||i.height),r=e.pixelRatio,a=void 0===e.x?Math.floor(i.x):e.x,o=void 0===e.y?Math.floor(i.y):e.y,h=e.offset||0,l=e.drawBorder||!1,d=e.hitCanvasPixelRatio||1;if(!n||!s)return void g.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");n+=2*h+(Math.abs(Math.round(i.x)-a)>.5?1:0),s+=2*h+(Math.abs(Math.round(i.y)-o)>.5?1:0),a-=h,o-=h;const c=new G({pixelRatio:r,width:n,height:s}),u=new G({pixelRatio:r,width:0,height:0,willReadFrequently:!0}),f=new R({pixelRatio:d,width:n,height:s}),p=c.getContext(),m=f.getContext();return f.isCache=!0,c.isCache=!0,this._cache.delete(F),this._filterUpToDate=!1,!1===e.imageSmoothingEnabled&&(c.getContext()._context.imageSmoothingEnabled=!1,u.getContext()._context.imageSmoothingEnabled=!1),p.save(),m.save(),p.translate(-a,-o),m.translate(-a,-o),this._isUnderCache=!0,this._clearSelfAndDescendantCache(D),this._clearSelfAndDescendantCache(O),this.drawScene(c,this),this.drawHit(f,this),this._isUnderCache=!1,p.restore(),m.restore(),l&&(p.save(),p.beginPath(),p.rect(0,0,n,s),p.closePath(),p.setAttr("strokeStyle","red"),p.setAttr("lineWidth",5),p.stroke(),p.restore()),this._cache.set(F,{scene:c,filter:u,hit:f,x:a,y:o}),this._requestDraw(),this}isCached(){return this._cache.has(F)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,e){const i=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}];let n=1/0,s=1/0,r=-1/0,a=-1/0;const o=this.getAbsoluteTransform(e);return i.forEach((function(t){const e=o.point(t);void 0===n&&(n=r=e.x,s=a=e.y),n=Math.min(n,e.x),s=Math.min(s,e.y),r=Math.max(r,e.x),a=Math.max(a,e.y)})),{x:n,y:s,width:r-n,height:a-s}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const e=this._getCanvasCache();t.translate(e.x,e.y);const i=this._getCachedSceneCanvas(),n=i.pixelRatio;t.drawImage(i._canvas,0,0,i.width/n,i.height/n),t.restore()}_drawCachedHitCanvas(t){const e=this._getCanvasCache(),i=e.hit;t.save(),t.translate(e.x,e.y),t.drawImage(i._canvas,0,0,i.width/i.pixelRatio,i.height/i.pixelRatio),t.restore()}_getCachedSceneCanvas(){let t,e,i,n,s=this.filters(),r=this._getCanvasCache(),a=r.scene,o=r.filter,h=o.getContext();if(s){if(!this._filterUpToDate){const r=a.pixelRatio;o.setSize(a.width/a.pixelRatio,a.height/a.pixelRatio);try{for(t=s.length,h.clear(),h.drawImage(a._canvas,0,0,a.getWidth()/r,a.getHeight()/r),e=h.getImageData(0,0,o.getWidth(),o.getHeight()),i=0;i<t;i++)n=s[i],"function"==typeof n?(n.call(this,e),h.putImageData(e,0,0)):g.error("Filter should be type of function, but got "+typeof n+" instead. Please check correct filters")}catch(t){g.error("Unable to apply filter. "+t.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}this._filterUpToDate=!0}return o}return a}on(t,e){if(this._cache&&this._cache.delete(L),3===arguments.length)return this._delegate.apply(this,arguments);let i,n,s,r,a,o=t.split(z),h=o.length;for(i=0;i<h;i++)n=o[i],s=n.split("."),r=s[0],a=s[1]||"",this.eventListeners[r]||(this.eventListeners[r]=[]),this.eventListeners[r].push({name:a,handler:e});return this}off(t,e){let i,n,s,r,a,o,h=(t||"").split(z),l=h.length;if(this._cache&&this._cache.delete(L),!t)for(n in this.eventListeners)this._off(n);for(i=0;i<l;i++)if(s=h[i],r=s.split("."),a=r[0],o=r[1],a)this.eventListeners[a]&&this._off(a,o,e);else for(n in this.eventListeners)this._off(n,o,e);return this}dispatchEvent(t){const e={target:this,type:t.type,evt:t};return this.fire(t.type,e),this}addEventListener(t,e){return this.on(t,(function(t){e.call(this,t.evt)})),this}removeEventListener(t){return this.off(t),this}_delegate(t,e,i){const n=this;this.on(t,(function(t){const s=t.target.findAncestors(e,!0,n);for(let e=0;e<s.length;e++)(t=g.cloneObject(t)).currentTarget=s[e],i.call(s[e],t)}))}remove(){return this.isDragging()&&this.stopDrag(),E._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(I),this._clearSelfAndDescendantCache(D),this._clearSelfAndDescendantCache(O),this._clearSelfAndDescendantCache(Y),this._clearSelfAndDescendantCache(j),this._clearSelfAndDescendantCache(B)}_remove(){this._clearCaches();const t=this.getParent();t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(t){const e="get"+g._capitalize(t);return g._isFunction(this[e])?this[e]():this.attrs[t]}getAncestors(){let t=this.getParent(),e=[];for(;t;)e.push(t),t=t.getParent();return e}getAttrs(){return this.attrs||{}}setAttrs(t){return this._batchTransformChanges((()=>{let e,i;if(!t)return this;for(e in t)"children"!==e&&(i="set"+g._capitalize(e),g._isFunction(this[i])?this[i](t[e]):this._setAttr(e,t[e]))})),this}isListening(){return this._getCache(B,this._isListening)}_isListening(t){if(!this.listening())return!1;const e=this.getParent();return!e||e===t||this===t||e._isListening(t)}isVisible(){return this._getCache(j,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const e=this.getParent();return!e||e===t||this===t||e._isVisible(t)}shouldDrawHit(t,e=!1){if(t)return this._isVisible(t)&&this._isListening(t);const n=this.getLayer();let s=!1;E._dragElements.forEach((t=>{"dragging"===t.dragStatus&&("Stage"===t.node.nodeType||t.node.getLayer()===n)&&(s=!0)}));const r=!e&&!i.hitOnDragEnabled&&(s||i.isTransforming());return this.isListening()&&this.isVisible()&&!r}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let t,e,i,n,s=this.getDepth(),r=this,a=0;const o=this.getStage();return"Stage"!==r.nodeType&&o&&function o(h){for(t=[],e=h.length,i=0;i<e;i++)n=h[i],a++,n.nodeType!==W&&(t=t.concat(n.getChildren().slice())),n._id===r._id&&(i=e);t.length>0&&t[0].getDepth()<=s&&o(t)}(o.getChildren()),a}getDepth(){let t=0,e=this.parent;for(;e;)t++,e=e.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(X),this._clearSelfAndDescendantCache(I)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges((()=>{this.x(t.x),this.y(t.y)})),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const t=this.getStage();if(!t)return null;const e=t.getPointerPosition();if(!e)return null;const i=this.getAbsoluteTransform().copy();return i.invert(),i.point(e)}getAbsolutePosition(t){let e=!1,i=this.parent;for(;i;){if(i.isCached()){e=!0;break}i=i.parent}e&&!t&&(t=!0);const n=this.getAbsoluteTransform(t).getMatrix(),r=new s,a=this.offset();return r.m=n.slice(),r.translate(a.x,a.y),r.getTranslation()}setAbsolutePosition(t){const{x:e,y:i,...n}=this._clearTransform();this.attrs.x=e,this.attrs.y=i,this._clearCache(X);const s=this._getAbsoluteTransform().copy();return s.invert(),s.translate(t.x,t.y),t={x:this.attrs.x+s.getTranslation().x,y:this.attrs.y+s.getTranslation().y},this._setTransform(n),this.setPosition({x:t.x,y:t.y}),this._clearCache(X),this._clearSelfAndDescendantCache(I),this}_setTransform(t){let e;for(e in t)this.attrs[e]=t[e]}_clearTransform(){const t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){let e=t.x,i=t.y,n=this.x(),s=this.y();return void 0!==e&&(n+=e),void 0!==i&&(s+=i),this.setPosition({x:n,y:s}),this}_eachAncestorReverse(t,e){let i,n,s=[],r=this.getParent();if(!e||e._id!==this._id){for(s.unshift(this);r&&(!e||r._id!==e._id);)s.unshift(r),r=r.parent;for(i=s.length,n=0;n<i;n++)t(s[n])}}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return g.warn("Node has no parent. moveToTop function is ignored."),!1;const t=this.index;return t<this.parent.getChildren().length-1&&(this.parent.children.splice(t,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0)}moveUp(){if(!this.parent)return g.warn("Node has no parent. moveUp function is ignored."),!1;const t=this.index;return t<this.parent.getChildren().length-1&&(this.parent.children.splice(t,1),this.parent.children.splice(t+1,0,this),this.parent._setChildrenIndices(),!0)}moveDown(){if(!this.parent)return g.warn("Node has no parent. moveDown function is ignored."),!1;const t=this.index;return t>0&&(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0)}moveToBottom(){if(!this.parent)return g.warn("Node has no parent. moveToBottom function is ignored."),!1;const t=this.index;return t>0&&(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0)}setZIndex(t){if(!this.parent)return g.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&g.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");const e=this.index;return this.parent.children.splice(e,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(D,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let t=this.opacity();const e=this.getParent();return e&&!e._isUnderCache&&(t*=e.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){let t,e,i,n,s,r=this.getAttrs();const a={attrs:{},className:this.getClassName()};for(t in r)e=r[t],s=g.isObject(e)&&!g._isPlainObject(e)&&!g._isArray(e),s||(i="function"==typeof this[t]&&this[t],delete r[t],n=i?i.call(this):null,r[t]=e,n!==e&&(a.attrs[t]=e));return g._prepareToStringify(a)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,e,i){const n=[];e&&this._isMatch(t)&&n.push(this);let s=this.parent;for(;s;){if(s===i)return n;s._isMatch(t)&&n.push(s),s=s.parent}return n}isAncestorOf(t){return!1}findAncestor(t,e,i){return this.findAncestors(t,e,i)[0]}_isMatch(t){if(!t)return!1;if("function"==typeof t)return t(this);let e,i,n=t.replace(/ /g,"").split(","),s=n.length;for(e=0;e<s;e++)if(i=n[e],g.isValidSelector(i)||(g.warn('Selector "'+i+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),g.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),g.warn("Konva is awesome, right?")),"#"===i.charAt(0)){if(this.id()===i.slice(1))return!0}else if("."===i.charAt(0)){if(this.hasName(i.slice(1)))return!0}else if(this.className===i||this.nodeType===i)return!0;return!1}getLayer(){const t=this.getParent();return t?t.getLayer():null}getStage(){return this._getCache(Y,this._getStage)}_getStage(){const t=this.getParent();return t?t.getStage():null}fire(t,e={},i){return e.target=e.target||this,i?this._fireAndBubble(t,e):this._fire(t,e),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache(I,this._getAbsoluteTransform)}_getAbsoluteTransform(t){let e;if(t)return e=new s,this._eachAncestorReverse((function(t){const i=t.transformsEnabled();"all"===i?e.multiply(t.getTransform()):"position"===i&&e.translate(t.x()-t.offsetX(),t.y()-t.offsetY())}),t),e;{e=this._cache.get(I)||new s,this.parent?this.parent.getAbsoluteTransform().copyInto(e):e.reset();const t=this.transformsEnabled();if("all"===t)e.multiply(this.getTransform());else if("position"===t){const t=this.attrs.x||0,i=this.attrs.y||0,n=this.attrs.offsetX||0,s=this.attrs.offsetY||0;e.translate(t-n,i-s)}return e.dirty=!1,e}}getAbsoluteScale(t){let e=this;for(;e;)e._isUnderCache&&(t=e),e=e.getParent();const i=this.getAbsoluteTransform(t).decompose();return{x:i.scaleX,y:i.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(X,this._getTransform)}_getTransform(){var t,e;const n=this._cache.get(X)||new s;n.reset();const r=this.x(),a=this.y(),o=i.getAngle(this.rotation()),h=null!==(t=this.attrs.scaleX)&&void 0!==t?t:1,l=null!==(e=this.attrs.scaleY)&&void 0!==e?e:1,d=this.attrs.skewX||0,c=this.attrs.skewY||0,g=this.attrs.offsetX||0,u=this.attrs.offsetY||0;return 0===r&&0===a||n.translate(r,a),0!==o&&n.rotate(o),0===d&&0===c||n.skew(d,c),1===h&&1===l||n.scale(h,l),0===g&&0===u||n.translate(-1*g,-1*u),n.dirty=!1,n}clone(t){let e,i,n,s,r,a=g.cloneObject(this.attrs);for(e in t)a[e]=t[e];const o=new this.constructor(a);for(e in this.eventListeners)for(i=this.eventListeners[e],n=i.length,s=0;s<n;s++)r=i[s],r.name.indexOf("konva")<0&&(o.eventListeners[e]||(o.eventListeners[e]=[]),o.eventListeners[e].push(r));return o}_toKonvaCanvas(t){t=t||{};const e=this.getClientRect(),i=this.getStage(),n=void 0!==t.x?t.x:Math.floor(e.x),s=void 0!==t.y?t.y:Math.floor(e.y),r=t.pixelRatio||1,a=new G({width:t.width||Math.ceil(e.width)||(i?i.width():0),height:t.height||Math.ceil(e.height)||(i?i.height():0),pixelRatio:r}),o=a.getContext(),h=new G({width:a.width/a.pixelRatio+Math.abs(n),height:a.height/a.pixelRatio+Math.abs(s),pixelRatio:a.pixelRatio});return!1===t.imageSmoothingEnabled&&(o._context.imageSmoothingEnabled=!1),o.save(),(n||s)&&o.translate(-1*n,-1*s),this.drawScene(a,void 0,h),o.restore(),a}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){const e=(t=t||{}).mimeType||null,i=t.quality||null,n=this._toKonvaCanvas(t).toDataURL(e,i);return t.callback&&t.callback(n),n}toImage(t){return new Promise(((e,i)=>{try{const i=null==t?void 0:t.callback;i&&delete t.callback,g._urlToImage(this.toDataURL(t),(function(t){e(t),null==i||i(t)}))}catch(t){i(t)}}))}toBlob(t){return new Promise(((e,i)=>{try{const i=null==t?void 0:t.callback;i&&delete t.callback,this.toCanvas(t).toBlob((t=>{e(t),null==i||i(t)}),null==t?void 0:t.mimeType,null==t?void 0:t.quality)}catch(t){i(t)}}))}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return void 0!==this.attrs.dragDistance?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():i.dragDistance}_off(t,e,i){let n,s,r,a=this.eventListeners[t];for(n=0;n<a.length;n++)if(s=a[n].name,r=a[n].handler,!("konva"===s&&"konva"!==e||e&&s!==e||i&&i!==r)){if(a.splice(n,1),0===a.length){delete this.eventListeners[t];break}n--}}_fireChangeEvent(t,e,i){this._fire(t+"Change",{oldVal:e,newVal:i})}addName(t){if(!this.hasName(t)){const e=this.name(),i=e?e+" "+t:t;this.name(i)}return this}hasName(t){if(!t)return!1;const e=this.name();if(!e)return!1;return-1!==(e||"").split(/\s/g).indexOf(t)}removeName(t){const e=(this.name()||"").split(/\s/g),i=e.indexOf(t);return-1!==i&&(e.splice(i,1),this.name(e.join(" "))),this}setAttr(t,e){const i=this["set"+g._capitalize(t)];return g._isFunction(i)?i.call(this,e):this._setAttr(t,e),this}_requestDraw(){if(i.autoDrawEnabled){const t=this.getLayer()||this.getStage();null==t||t.batchDraw()}}_setAttr(t,e){const i=this.attrs[t];(i!==e||g.isObject(e))&&(null==e?delete this.attrs[t]:this.attrs[t]=e,this._shouldFireChangeEvents&&this._fireChangeEvent(t,i,e),this._requestDraw())}_setComponentAttr(t,e,i){let n;void 0!==i&&(n=this.attrs[t],n||(this.attrs[t]=this.getAttr(t)),this.attrs[t][e]=i,this._fireChangeEvent(t,n,i))}_fireAndBubble(t,e,i){e&&this.nodeType===W&&(e.target=this);if(!((t===N||t===H)&&(i&&(this===i||this.isAncestorOf&&this.isAncestorOf(i))||"Stage"===this.nodeType&&!i))){this._fire(t,e);const n=(t===N||t===H)&&i&&i.isAncestorOf&&i.isAncestorOf(this)&&!i.isAncestorOf(this.parent);(e&&!e.cancelBubble||!e)&&this.parent&&this.parent.isListening()&&!n&&(i&&i.parent?this._fireAndBubble.call(this.parent,t,e,i):this._fireAndBubble.call(this.parent,t,e))}}_getProtoListeners(t){var e,i,n;const s=null!==(e=this._cache.get(L))&&void 0!==e?e:{};let r=null==s?void 0:s[t];if(void 0===r){r=[];let e=Object.getPrototypeOf(this);for(;e;){const s=null!==(n=null===(i=e.eventListeners)||void 0===i?void 0:i[t])&&void 0!==n?n:[];r.push(...s),e=Object.getPrototypeOf(e)}s[t]=r,this._cache.set(L,s)}return r}_fire(t,e){(e=e||{}).currentTarget=this,e.type=t;const i=this._getProtoListeners(t);if(i)for(var n=0;n<i.length;n++)i[n].handler.call(this,e);const s=this.eventListeners[t];if(s)for(n=0;n<s.length;n++)s[n].handler.call(this,e)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){const e=t?t.pointerId:void 0,i=this.getStage(),n=this.getAbsolutePosition();if(!i)return;const s=i._getPointerById(e)||i._changedPointerPositions[0]||n;E._dragElements.set(this._id,{node:this,startPointerPos:s,offset:{x:s.x-n.x,y:s.y-n.y},dragStatus:"ready",pointerId:e})}startDrag(t,e=!0){E._dragElements.has(this._id)||this._createDragElement(t);E._dragElements.get(this._id).dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:t&&t.evt},e)}_setDragPosition(t,e){const i=this.getStage()._getPointerById(e.pointerId);if(!i)return;let n={x:i.x-e.offset.x,y:i.y-e.offset.y};const s=this.dragBoundFunc();if(void 0!==s){const e=s.call(this,n,t);e?n=e:g.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}this._lastPos&&this._lastPos.x===n.x&&this._lastPos.y===n.y||(this.setAbsolutePosition(n),this._requestDraw()),this._lastPos=n}stopDrag(t){const e=E._dragElements.get(this._id);e&&(e.dragStatus="stopped"),E._endDragBefore(t),E._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=E._dragElements.get(this._id);return!!t&&"dragging"===t.dragStatus}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",(function(t){if(!(!(void 0!==t.evt.button)||i.dragButtons.indexOf(t.evt.button)>=0))return;if(this.isDragging())return;let e=!1;E._dragElements.forEach((t=>{this.isAncestorOf(t.node)&&(e=!0)})),e||this._createDragElement(t)}))}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();if(!this.getStage())return;const t=E._dragElements.get(this._id),e=t&&"dragging"===t.dragStatus,i=t&&"ready"===t.dragStatus;e?this.stopDrag():i&&E._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const e=this.getStage();if(!e)return!1;const i={x:-t.x,y:-t.y,width:e.width()+2*t.x,height:e.height()+2*t.y};return g.haveIntersection(i,this.getClientRect())}static create(t,e){return g._isString(t)&&(t=JSON.parse(t)),this._createNode(t,e)}static _createNode(t,e){let n,s,r,a=V.prototype.getClassName.call(t),o=t.children;e&&(t.attrs.container=e),i[a]||(g.warn('Can not find a node with class name "'+a+'". Fallback to "Shape".'),a="Shape");if(n=new(0,i[a])(t.attrs),o)for(s=o.length,r=0;r<s;r++)n.add(V._createNode(o[r]));return n}}V.prototype.nodeType="Node",V.prototype._attrsAffectingSize=[],V.prototype.eventListeners={},V.prototype.on.call(V.prototype,q,(function(){this._batchingTransformChange?this._needClearTransformCache=!0:(this._clearCache(X),this._clearSelfAndDescendantCache(I))})),V.prototype.on.call(V.prototype,"visibleChange.konva",(function(){this._clearSelfAndDescendantCache(j)})),V.prototype.on.call(V.prototype,"listeningChange.konva",(function(){this._clearSelfAndDescendantCache(B)})),V.prototype.on.call(V.prototype,"opacityChange.konva",(function(){this._clearSelfAndDescendantCache(D)}));const K=w.addGetterSetter;K(V,"zIndex"),K(V,"absolutePosition"),K(V,"position"),K(V,"x",0,p()),K(V,"y",0,p()),K(V,"globalCompositeOperation","source-over",y()),K(V,"opacity",1,p()),K(V,"name","",y()),K(V,"id","",y()),K(V,"rotation",0,p()),w.addComponentsGetterSetter(V,"scale",["x","y"]),K(V,"scaleX",1,p()),K(V,"scaleY",1,p()),w.addComponentsGetterSetter(V,"skew",["x","y"]),K(V,"skewX",0,p()),K(V,"skewY",0,p()),w.addComponentsGetterSetter(V,"offset",["x","y"]),K(V,"offsetX",0,p()),K(V,"offsetY",0,p()),K(V,"dragDistance",null,p()),K(V,"width",0,p()),K(V,"height",0,p()),K(V,"listening",!0,x()),K(V,"preventDefault",!0,x()),K(V,"filters",null,(function(t){return this._filterUpToDate=!1,t})),K(V,"visible",!0,x()),K(V,"transformsEnabled","all",y()),K(V,"size"),K(V,"dragBoundFunc"),K(V,"draggable",!1,x()),w.backCompat(V,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});class Q extends V{constructor(){super(...arguments),this.children=[]}getChildren(t){if(!t)return this.children||[];const e=this.children||[],i=[];return e.forEach((function(e){t(e)&&i.push(e)})),i}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach((t=>{t.parent=null,t.index=0,t.remove()})),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach((t=>{t.parent=null,t.index=0,t.destroy()})),this.children=[],this._requestDraw(),this}add(...t){if(0===t.length)return this;if(t.length>1){for(let e=0;e<t.length;e++)this.add(t[e]);return this}const e=t[0];return e.getParent()?(e.moveTo(this),this):(this._validateAdd(e),e.index=this.getChildren().length,e.parent=this,e._clearCaches(),this.getChildren().push(e),this._fire("add",{child:e}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(t){return this._generalFind(t,!1)}findOne(t){const e=this._generalFind(t,!0);return e.length>0?e[0]:void 0}_generalFind(t,e){const i=[];return this._descendants((n=>{const s=n._isMatch(t);return s&&i.push(n),!(!s||!e)})),i}_descendants(t){let e=!1;const i=this.getChildren();for(const n of i){if(e=t(n),e)return!0;if(n.hasChildren()&&(e=n._descendants(t),e))return!0}return!1}toObject(){const t=V.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach((e=>{t.children.push(e.toObject())})),t}isAncestorOf(t){let e=t.getParent();for(;e;){if(e._id===this._id)return!0;e=e.getParent()}return!1}clone(t){const e=V.prototype.clone.call(this,t);return this.getChildren().forEach((function(t){e.add(t.clone())})),e}getAllIntersections(t){const e=[];return this.find("Shape").forEach((i=>{i.isVisible()&&i.intersects(t)&&e.push(i)})),e}_clearSelfAndDescendantCache(t){var e;super._clearSelfAndDescendantCache(t),this.isCached()||null===(e=this.children)||void 0===e||e.forEach((function(e){e._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;null===(t=this.children)||void 0===t||t.forEach((function(t,e){t.index=e})),this._requestDraw()}drawScene(t,e,i){const n=this.getLayer(),s=t||n&&n.getCanvas(),r=s&&s.getContext(),a=this._getCanvasCache(),o=a&&a.scene,h=s&&s.isCache;if(!this.isVisible()&&!h)return this;if(o){r.save();const t=this.getAbsoluteTransform(e).getMatrix();r.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedSceneCanvas(r),r.restore()}else this._drawChildren("drawScene",s,e,i);return this}drawHit(t,e){if(!this.shouldDrawHit(e))return this;const i=this.getLayer(),n=t||i&&i.hitCanvas,s=n&&n.getContext(),r=this._getCanvasCache();if(r&&r.hit){s.save();const t=this.getAbsoluteTransform(e).getMatrix();s.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedHitCanvas(s),s.restore()}else this._drawChildren("drawHit",n,e);return this}_drawChildren(t,e,i,n){var s;const r=e&&e.getContext(),a=this.clipWidth(),o=this.clipHeight(),h=this.clipFunc(),l="number"==typeof a&&"number"==typeof o||h,d=i===this;if(l){r.save();const t=this.getAbsoluteTransform(i);let e,n=t.getMatrix();if(r.transform(n[0],n[1],n[2],n[3],n[4],n[5]),r.beginPath(),h)e=h.call(this,r,this);else{const t=this.clipX(),e=this.clipY();r.rect(t||0,e||0,a,o)}r.clip.apply(r,e),n=t.copy().invert().getMatrix(),r.transform(n[0],n[1],n[2],n[3],n[4],n[5])}const c=!d&&"source-over"!==this.globalCompositeOperation()&&"drawScene"===t;c&&(r.save(),r._applyGlobalCompositeOperation(this)),null===(s=this.children)||void 0===s||s.forEach((function(s){s[t](e,i,n)})),c&&r.restore(),l&&r.restore()}getClientRect(t={}){var e;const i=t.skipTransform,n=t.relativeTo;let s,r,a,o,h={x:1/0,y:1/0,width:0,height:0};const l=this;null===(e=this.children)||void 0===e||e.forEach((function(e){if(!e.visible())return;const i=e.getClientRect({relativeTo:l,skipShadow:t.skipShadow,skipStroke:t.skipStroke});0===i.width&&0===i.height||(void 0===s?(s=i.x,r=i.y,a=i.x+i.width,o=i.y+i.height):(s=Math.min(s,i.x),r=Math.min(r,i.y),a=Math.max(a,i.x+i.width),o=Math.max(o,i.y+i.height)))}));const d=this.find("Shape");let c=!1;for(let t=0;t<d.length;t++){if(d[t]._isVisible(this)){c=!0;break}}return h=c&&void 0!==s?{x:s,y:r,width:a-s,height:o-r}:{x:0,y:0,width:0,height:0},i?h:this._transformedRect(h,n)}}w.addComponentsGetterSetter(Q,"clip",["x","y","width","height"]),w.addGetterSetter(Q,"clipX",void 0,p()),w.addGetterSetter(Q,"clipY",void 0,p()),w.addGetterSetter(Q,"clipWidth",void 0,p()),w.addGetterSetter(Q,"clipHeight",void 0,p()),w.addGetterSetter(Q,"clipFunc");const J=new Map,$=void 0!==i._global.PointerEvent;function Z(t){return J.get(t)}function tt(t){return{evt:t,pointerId:t.pointerId}}function et(t,e){return J.get(t)===e}function it(t,e){nt(t);e.getStage()&&(J.set(t,e),$&&e._fire("gotpointercapture",tt(new PointerEvent("gotpointercapture"))))}function nt(t,e){const i=J.get(t);if(!i)return;const n=i.getStage();n&&n.content,J.delete(t),$&&i._fire("lostpointercapture",tt(new PointerEvent("lostpointercapture")))}const st="mouseleave",rt="mouseover",at="mouseenter",ot="mousemove",ht="mousedown",lt="mouseup",dt="pointermove",ct="pointerdown",gt="pointerup",ut="pointercancel",ft="pointerout",pt="pointerleave",mt="pointerover",_t="pointerenter",yt="contextmenu",vt="touchstart",xt="touchend",bt="touchmove",St="touchcancel",wt="wheel",Ct=[[at,"_pointerenter"],[ht,"_pointerdown"],[ot,"_pointermove"],[lt,"_pointerup"],[st,"_pointerleave"],[vt,"_pointerdown"],[bt,"_pointermove"],[xt,"_pointerup"],[St,"_pointercancel"],[rt,"_pointerover"],[wt,"_wheel"],[yt,"_contextmenu"],[ct,"_pointerdown"],[dt,"_pointermove"],[gt,"_pointerup"],[ut,"_pointercancel"],["lostpointercapture","_lostpointercapture"]],Pt={mouse:{[ft]:"mouseout",[pt]:st,[mt]:rt,[_t]:at,[dt]:ot,[ct]:ht,[gt]:lt,[ut]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[ft]:"touchout",[pt]:"touchleave",[mt]:"touchover",[_t]:"touchenter",[dt]:bt,[ct]:vt,[gt]:xt,[ut]:St,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[ft]:ft,[pt]:pt,[mt]:mt,[_t]:_t,[dt]:dt,[ct]:ct,[gt]:gt,[ut]:ut,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},kt=t=>t.indexOf("pointer")>=0?"pointer":t.indexOf("touch")>=0?"touch":"mouse",At=t=>{const e=kt(t);return"pointer"===e?i.pointerEventsEnabled&&Pt.pointer:"touch"===e?Pt.touch:"mouse"===e?Pt.mouse:void 0};function Tt(t={}){return(t.clipFunc||t.clipWidth||t.clipHeight)&&g.warn("Stage does not support clipping. Please use clip for Layers or Groups."),t}const Mt=[];class Gt extends Q{constructor(t){super(Tt(t)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),Mt.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",(()=>{Tt(this.attrs)})),this._checkVisibility()}_validateAdd(t){const e="Layer"===t.getType(),i="FastLayer"===t.getType();e||i||g.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const t=this.visible()?"":"none";this.content.style.display=t}setContainer(t){if("string"==typeof t){if("."===t.charAt(0)){const e=t.slice(1);t=document.getElementsByClassName(e)[0]}else{var e;e="#"!==t.charAt(0)?t:t.slice(1),t=document.getElementById(e)}if(!t)throw"Can not find container in document with id "+e}return this._setAttr("container",t),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),t.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){let t,e=this.children,i=e.length;for(t=0;t<i;t++)e[t].clear();return this}clone(t){return t||(t={}),t.container="undefined"!=typeof document&&document.createElement("div"),Q.prototype.clone.call(this,t)}destroy(){super.destroy();const t=this.content;t&&g._isInDocument(t)&&this.container().removeChild(t);const e=Mt.indexOf(this);return e>-1&&Mt.splice(e,1),g.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const t=this._pointerPositions[0]||this._changedPointerPositions[0];return t?{x:t.x,y:t.y}:(g.warn("Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);"),null)}_getPointerById(t){return this._pointerPositions.find((e=>e.id===t))}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(t){(t=t||{}).x=t.x||0,t.y=t.y||0,t.width=t.width||this.width(),t.height=t.height||this.height();const e=new G({width:t.width,height:t.height,pixelRatio:t.pixelRatio||1}),i=e.getContext()._context,n=this.children;return(t.x||t.y)&&i.translate(-1*t.x,-1*t.y),n.forEach((function(e){if(!e.isVisible())return;const n=e._toKonvaCanvas(t);i.drawImage(n._canvas,t.x,t.y,n.getWidth()/n.getPixelRatio(),n.getHeight()/n.getPixelRatio())})),e}getIntersection(t){if(!t)return null;let e,i=this.children;for(e=i.length-1;e>=0;e--){const n=i[e].getIntersection(t);if(n)return n}return null}_resizeDOM(){const t=this.width(),e=this.height();this.content&&(this.content.style.width=t+"px",this.content.style.height=e+"px"),this.bufferCanvas.setSize(t,e),this.bufferHitCanvas.setSize(t,e),this.children.forEach((i=>{i.setSize({width:t,height:e}),i.draw()}))}add(t,...e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}super.add(t);const n=this.children.length;return n>5&&g.warn("The stage has "+n+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),t.setSize({width:this.width(),height:this.height()}),t.draw(),i.isBrowser&&this.content.appendChild(t.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(t){return et(t,this)}setPointerCapture(t){it(t,this)}releaseCapture(t){nt(t)}getLayers(){return this.children}_bindContentEvents(){i.isBrowser&&Ct.forEach((([t,e])=>{this.content.addEventListener(t,(t=>{this[e](t)}),{passive:!1})}))}_pointerenter(t){this.setPointersPositions(t);const e=At(t.type);e&&this._fire(e.pointerenter,{evt:t,target:this,currentTarget:this})}_pointerover(t){this.setPointersPositions(t);const e=At(t.type);e&&this._fire(e.pointerover,{evt:t,target:this,currentTarget:this})}_getTargetShape(t){let e=this[t+"targetShape"];return e&&!e.getStage()&&(e=null),e}_pointerleave(t){const e=At(t.type),n=kt(t.type);if(!e)return;this.setPointersPositions(t);const s=this._getTargetShape(n),r=!(i.isDragging()||i.isTransforming())||i.hitOnDragEnabled;s&&r?(s._fireAndBubble(e.pointerout,{evt:t}),s._fireAndBubble(e.pointerleave,{evt:t}),this._fire(e.pointerleave,{evt:t,target:this,currentTarget:this}),this[n+"targetShape"]=null):r&&(this._fire(e.pointerleave,{evt:t,target:this,currentTarget:this}),this._fire(e.pointerout,{evt:t,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(t){const e=At(t.type),n=kt(t.type);if(!e)return;this.setPointersPositions(t);let s=!1;this._changedPointerPositions.forEach((r=>{const a=this.getIntersection(r);if(E.justDragged=!1,i["_"+n+"ListenClick"]=!0,!a||!a.isListening())return void(this[n+"ClickStartShape"]=void 0);i.capturePointerEventsEnabled&&a.setPointerCapture(r.id),this[n+"ClickStartShape"]=a,a._fireAndBubble(e.pointerdown,{evt:t,pointerId:r.id}),s=!0;const o=t.type.indexOf("touch")>=0;a.preventDefault()&&t.cancelable&&o&&t.preventDefault()})),s||this._fire(e.pointerdown,{evt:t,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(t){const e=At(t.type),n=kt(t.type);if(!e)return;i.isDragging()&&E.node.preventDefault()&&t.cancelable&&t.preventDefault(),this.setPointersPositions(t);if(!(!(i.isDragging()||i.isTransforming())||i.hitOnDragEnabled))return;const s={};let r=!1;const a=this._getTargetShape(n);this._changedPointerPositions.forEach((i=>{const o=Z(i.id)||this.getIntersection(i),h=i.id,l={evt:t,pointerId:h},d=a!==o;if(d&&a&&(a._fireAndBubble(e.pointerout,{...l},o),a._fireAndBubble(e.pointerleave,{...l},o)),o){if(s[o._id])return;s[o._id]=!0}o&&o.isListening()?(r=!0,d&&(o._fireAndBubble(e.pointerover,{...l},a),o._fireAndBubble(e.pointerenter,{...l},a),this[n+"targetShape"]=o),o._fireAndBubble(e.pointermove,{...l})):a&&(this._fire(e.pointerover,{evt:t,target:this,currentTarget:this,pointerId:h}),this[n+"targetShape"]=null)})),r||this._fire(e.pointermove,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(t){const e=At(t.type),n=kt(t.type);if(!e)return;this.setPointersPositions(t);const s=this[n+"ClickStartShape"],r=this[n+"ClickEndShape"],a={};let o=!1;this._changedPointerPositions.forEach((h=>{const l=Z(h.id)||this.getIntersection(h);if(l){if(l.releaseCapture(h.id),a[l._id])return;a[l._id]=!0}const d=h.id,c={evt:t,pointerId:d};let g=!1;i["_"+n+"InDblClickWindow"]?(g=!0,clearTimeout(this[n+"DblTimeout"])):E.justDragged||(i["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout((function(){i["_"+n+"InDblClickWindow"]=!1}),i.dblClickWindow),l&&l.isListening()?(o=!0,this[n+"ClickEndShape"]=l,l._fireAndBubble(e.pointerup,{...c}),i["_"+n+"ListenClick"]&&s&&s===l&&(l._fireAndBubble(e.pointerclick,{...c}),g&&r&&r===l&&l._fireAndBubble(e.pointerdblclick,{...c}))):(this[n+"ClickEndShape"]=null,i["_"+n+"ListenClick"]&&this._fire(e.pointerclick,{evt:t,target:this,currentTarget:this,pointerId:d}),g&&this._fire(e.pointerdblclick,{evt:t,target:this,currentTarget:this,pointerId:d}))})),o||this._fire(e.pointerup,{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i["_"+n+"ListenClick"]=!1,t.cancelable&&"touch"!==n&&t.preventDefault()}_contextmenu(t){this.setPointersPositions(t);const e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble(yt,{evt:t}):this._fire(yt,{evt:t,target:this,currentTarget:this})}_wheel(t){this.setPointersPositions(t);const e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble(wt,{evt:t}):this._fire(wt,{evt:t,target:this,currentTarget:this})}_pointercancel(t){this.setPointersPositions(t);const e=Z(t.pointerId)||this.getIntersection(this.getPointerPosition());e&&e._fireAndBubble(gt,tt(t)),nt(t.pointerId)}_lostpointercapture(t){nt(t.pointerId)}setPointersPositions(t){let e=this._getContentPosition(),i=null,n=null;void 0!==(t=t||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(t.touches,(t=>{this._pointerPositions.push({id:t.identifier,x:(t.clientX-e.left)/e.scaleX,y:(t.clientY-e.top)/e.scaleY})})),Array.prototype.forEach.call(t.changedTouches||t.touches,(t=>{this._changedPointerPositions.push({id:t.identifier,x:(t.clientX-e.left)/e.scaleX,y:(t.clientY-e.top)/e.scaleY})}))):(i=(t.clientX-e.left)/e.scaleX,n=(t.clientY-e.top)/e.scaleY,this.pointerPos={x:i,y:n},this._pointerPositions=[{x:i,y:n,id:g._getFirstPointerId(t)}],this._changedPointerPositions=[{x:i,y:n,id:g._getFirstPointerId(t)}])}_setPointerPosition(t){g.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(t)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const t=this.content.getBoundingClientRect();return{top:t.top,left:t.left,scaleX:t.width/this.content.clientWidth||1,scaleY:t.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new G({width:this.width(),height:this.height()}),this.bufferHitCanvas=new R({pixelRatio:1,width:this.width(),height:this.height()}),!i.isBrowser)return;const t=this.container();if(!t)throw"Stage has no container. A container is required.";t.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),t.appendChild(this.content),this._resizeDOM()}cache(){return g.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach((function(t){t.batchDraw()})),this}}Gt.prototype.nodeType="Stage",n(Gt),w.addGetterSetter(Gt,"container"),i.isBrowser&&document.addEventListener("visibilitychange",(()=>{Mt.forEach((t=>{t.batchDraw()}))}));const Rt="hasShadow",Et="shadowRGBA",Dt="patternImage",Lt="linearGradient",It="radialGradient";let Ot;function Ft(){return Ot||(Ot=g.createCanvasElement().getContext("2d"),Ot)}const Bt={};class Nt extends V{constructor(t){let e;for(super(t);e=g.getRandomColor(),!e||e in Bt;);this.colorKey=e,Bt[e]=this}getContext(){return g.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return g.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(Rt,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(Dt,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const t=Ft().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(t&&t.setTransform){const e=new s;e.translate(this.fillPatternX(),this.fillPatternY()),e.rotate(i.getAngle(this.fillPatternRotation())),e.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),e.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const n=e.getMatrix(),r="undefined"==typeof DOMMatrix?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);t.setTransform(r)}return t}}_getLinearGradient(){return this._getCache(Lt,this.__getLinearGradient)}__getLinearGradient(){const t=this.fillLinearGradientColorStops();if(t){const e=Ft(),i=this.fillLinearGradientStartPoint(),n=this.fillLinearGradientEndPoint(),s=e.createLinearGradient(i.x,i.y,n.x,n.y);for(let e=0;e<t.length;e+=2)s.addColorStop(t[e],t[e+1]);return s}}_getRadialGradient(){return this._getCache(It,this.__getRadialGradient)}__getRadialGradient(){const t=this.fillRadialGradientColorStops();if(t){const e=Ft(),i=this.fillRadialGradientStartPoint(),n=this.fillRadialGradientEndPoint(),s=e.createRadialGradient(i.x,i.y,this.fillRadialGradientStartRadius(),n.x,n.y,this.fillRadialGradientEndRadius());for(let e=0;e<t.length;e+=2)s.addColorStop(t[e],t[e+1]);return s}}getShadowRGBA(){return this._getCache(Et,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const t=g.colorToRGBA(this.shadowColor());return t?"rgba("+t.r+","+t.g+","+t.b+","+t.a*(this.shadowOpacity()||1)+")":void 0}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],(()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops())))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],(()=>this.strokeEnabled()&&this.strokeWidth()&&!(!this.stroke()&&!this.strokeLinearGradientColorStops())))}hasHitStroke(){const t=this.hitStrokeWidth();return"auto"===t?this.hasStroke():this.strokeEnabled()&&!!t}intersects(t){const e=this.getStage();if(!e)return!1;const i=e.bufferHitCanvas;i.getContext().clear(),this.drawHit(i,void 0,!0);return i.context.getImageData(Math.round(t.x),Math.round(t.y),1,1).data[3]>0}destroy(){return V.prototype.destroy.call(this),delete Bt[this.colorKey],delete this.colorKey,this}_useBufferCanvas(t){var e;if(!(null===(e=this.attrs.perfectDrawEnabled)||void 0===e||e))return!1;const i=t||this.hasFill(),n=this.hasStroke(),s=1!==this.getAbsoluteOpacity();if(i&&n&&s)return!0;const r=this.hasShadow(),a=this.shadowForStrokeEnabled();return!!(i&&n&&r&&a)}setStrokeHitEnabled(t){g.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),t?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){const t=this.size();return{x:this._centroid?-t.width/2:0,y:this._centroid?-t.height/2:0,width:t.width,height:t.height}}getClientRect(t={}){let e=!1,i=this.getParent();for(;i;){if(i.isCached()){e=!0;break}i=i.getParent()}const n=t.skipTransform,s=t.relativeTo||e&&this.getStage()||void 0,r=this.getSelfRect(),a=!t.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,o=r.width+a,h=r.height+a,l=!t.skipShadow&&this.hasShadow(),d=l?this.shadowOffsetX():0,c=l?this.shadowOffsetY():0,g=o+Math.abs(d),u=h+Math.abs(c),f=l&&this.shadowBlur()||0,p={width:g+2*f,height:u+2*f,x:-(a/2+f)+Math.min(d,0)+r.x,y:-(a/2+f)+Math.min(c,0)+r.y};return n?p:this._transformedRect(p,s)}drawScene(t,e,i){const n=this.getLayer();let s,r,a=t||n.getCanvas(),o=a.getContext(),h=this._getCanvasCache(),l=this.getSceneFunc(),d=this.hasShadow();const c=a.isCache,g=e===this;if(!this.isVisible()&&!g)return this;if(h){o.save();const t=this.getAbsoluteTransform(e).getMatrix();return o.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedSceneCanvas(o),o.restore(),this}if(!l)return this;if(o.save(),this._useBufferCanvas()&&!c){s=this.getStage();const t=i||s.bufferCanvas;r=t.getContext(),r.clear(),r.save(),r._applyLineJoin(this);var u=this.getAbsoluteTransform(e).getMatrix();r.transform(u[0],u[1],u[2],u[3],u[4],u[5]),l.call(this,r,this),r.restore();const n=t.pixelRatio;d&&o._applyShadow(this),o._applyOpacity(this),o._applyGlobalCompositeOperation(this),o.drawImage(t._canvas,0,0,t.width/n,t.height/n)}else{if(o._applyLineJoin(this),!g){u=this.getAbsoluteTransform(e).getMatrix();o.transform(u[0],u[1],u[2],u[3],u[4],u[5]),o._applyOpacity(this),o._applyGlobalCompositeOperation(this)}d&&o._applyShadow(this),l.call(this,o,this)}return o.restore(),this}drawHit(t,e,i=!1){if(!this.shouldDrawHit(e,i))return this;const n=this.getLayer(),s=t||n.hitCanvas,r=s&&s.getContext(),a=this.hitFunc()||this.sceneFunc(),o=this._getCanvasCache(),h=o&&o.hit;if(this.colorKey||g.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),h){r.save();const t=this.getAbsoluteTransform(e).getMatrix();return r.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedHitCanvas(r),r.restore(),this}if(!a)return this;r.save(),r._applyLineJoin(this);if(!(this===e)){const t=this.getAbsoluteTransform(e).getMatrix();r.transform(t[0],t[1],t[2],t[3],t[4],t[5])}return a.call(this,r,this),r.restore(),this}drawHitFromCache(t=0){let e,i,n,s,r,a,o=this._getCanvasCache(),h=this._getCachedSceneCanvas(),l=o.hit,d=l.getContext(),c=l.getWidth(),u=l.getHeight();d.clear(),d.drawImage(h._canvas,0,0,c,u);try{for(e=d.getImageData(0,0,c,u),i=e.data,n=i.length,s=g._hexToRgb(this.colorKey),r=0;r<n;r+=4)a=i[r+3],a>t?(i[r]=s.r,i[r+1]=s.g,i[r+2]=s.b,i[r+3]=255):i[r+3]=0;d.putImageData(e,0,0)}catch(t){g.error("Unable to draw hit graph from cached scene canvas. "+t.message)}return this}hasPointerCapture(t){return et(t,this)}setPointerCapture(t){it(t,this)}releaseCapture(t){nt(t)}}Nt.prototype._fillFunc=function(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()},Nt.prototype._strokeFunc=function(t){t.stroke()},Nt.prototype._fillFuncHit=function(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()},Nt.prototype._strokeFuncHit=function(t){t.stroke()},Nt.prototype._centroid=!1,Nt.prototype.nodeType="Shape",n(Nt),Nt.prototype.eventListeners={},Nt.prototype.on.call(Nt.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(Rt)})),Nt.prototype.on.call(Nt.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",(function(){this._clearCache(Et)})),Nt.prototype.on.call(Nt.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",(function(){this._clearCache(Dt)})),Nt.prototype.on.call(Nt.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",(function(){this._clearCache(Lt)})),Nt.prototype.on.call(Nt.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",(function(){this._clearCache(It)})),w.addGetterSetter(Nt,"stroke",void 0,v()),w.addGetterSetter(Nt,"strokeWidth",2,p()),w.addGetterSetter(Nt,"fillAfterStrokeEnabled",!1),w.addGetterSetter(Nt,"hitStrokeWidth","auto",_()),w.addGetterSetter(Nt,"strokeHitEnabled",!0,x()),w.addGetterSetter(Nt,"perfectDrawEnabled",!0,x()),w.addGetterSetter(Nt,"shadowForStrokeEnabled",!0,x()),w.addGetterSetter(Nt,"lineJoin"),w.addGetterSetter(Nt,"lineCap"),w.addGetterSetter(Nt,"sceneFunc"),w.addGetterSetter(Nt,"hitFunc"),w.addGetterSetter(Nt,"dash"),w.addGetterSetter(Nt,"dashOffset",0,p()),w.addGetterSetter(Nt,"shadowColor",void 0,y()),w.addGetterSetter(Nt,"shadowBlur",0,p()),w.addGetterSetter(Nt,"shadowOpacity",1,p()),w.addComponentsGetterSetter(Nt,"shadowOffset",["x","y"]),w.addGetterSetter(Nt,"shadowOffsetX",0,p()),w.addGetterSetter(Nt,"shadowOffsetY",0,p()),w.addGetterSetter(Nt,"fillPatternImage"),w.addGetterSetter(Nt,"fill",void 0,v()),w.addGetterSetter(Nt,"fillPatternX",0,p()),w.addGetterSetter(Nt,"fillPatternY",0,p()),w.addGetterSetter(Nt,"fillLinearGradientColorStops"),w.addGetterSetter(Nt,"strokeLinearGradientColorStops"),w.addGetterSetter(Nt,"fillRadialGradientStartRadius",0),w.addGetterSetter(Nt,"fillRadialGradientEndRadius",0),w.addGetterSetter(Nt,"fillRadialGradientColorStops"),w.addGetterSetter(Nt,"fillPatternRepeat","repeat"),w.addGetterSetter(Nt,"fillEnabled",!0),w.addGetterSetter(Nt,"strokeEnabled",!0),w.addGetterSetter(Nt,"shadowEnabled",!0),w.addGetterSetter(Nt,"dashEnabled",!0),w.addGetterSetter(Nt,"strokeScaleEnabled",!0),w.addGetterSetter(Nt,"fillPriority","color"),w.addComponentsGetterSetter(Nt,"fillPatternOffset",["x","y"]),w.addGetterSetter(Nt,"fillPatternOffsetX",0,p()),w.addGetterSetter(Nt,"fillPatternOffsetY",0,p()),w.addComponentsGetterSetter(Nt,"fillPatternScale",["x","y"]),w.addGetterSetter(Nt,"fillPatternScaleX",1,p()),w.addGetterSetter(Nt,"fillPatternScaleY",1,p()),w.addComponentsGetterSetter(Nt,"fillLinearGradientStartPoint",["x","y"]),w.addComponentsGetterSetter(Nt,"strokeLinearGradientStartPoint",["x","y"]),w.addGetterSetter(Nt,"fillLinearGradientStartPointX",0),w.addGetterSetter(Nt,"strokeLinearGradientStartPointX",0),w.addGetterSetter(Nt,"fillLinearGradientStartPointY",0),w.addGetterSetter(Nt,"strokeLinearGradientStartPointY",0),w.addComponentsGetterSetter(Nt,"fillLinearGradientEndPoint",["x","y"]),w.addComponentsGetterSetter(Nt,"strokeLinearGradientEndPoint",["x","y"]),w.addGetterSetter(Nt,"fillLinearGradientEndPointX",0),w.addGetterSetter(Nt,"strokeLinearGradientEndPointX",0),w.addGetterSetter(Nt,"fillLinearGradientEndPointY",0),w.addGetterSetter(Nt,"strokeLinearGradientEndPointY",0),w.addComponentsGetterSetter(Nt,"fillRadialGradientStartPoint",["x","y"]),w.addGetterSetter(Nt,"fillRadialGradientStartPointX",0),w.addGetterSetter(Nt,"fillRadialGradientStartPointY",0),w.addComponentsGetterSetter(Nt,"fillRadialGradientEndPoint",["x","y"]),w.addGetterSetter(Nt,"fillRadialGradientEndPointX",0),w.addGetterSetter(Nt,"fillRadialGradientEndPointY",0),w.addGetterSetter(Nt,"fillPatternRotation",0),w.addGetterSetter(Nt,"fillRule",void 0,y()),w.backCompat(Nt,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});const Ht=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],Wt=Ht.length;class zt extends Q{constructor(t){super(t),this.canvas=new G,this.hitCanvas=new R({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);const e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),t<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[t+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){V.prototype.moveToTop.call(this);const t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!V.prototype.moveUp.call(this))return!1;const t=this.getStage();return!(!t||!t.content)&&(t.content.removeChild(this.getNativeCanvasElement()),this.index<t.children.length-1?t.content.insertBefore(this.getNativeCanvasElement(),t.children[this.index+1].getCanvas()._canvas):t.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(V.prototype.moveDown.call(this)){const t=this.getStage();if(t){const e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(V.prototype.moveToBottom.call(this)){const t=this.getStage();if(t){const e=t.children;t.content&&(t.content.removeChild(this.getNativeCanvasElement()),t.content.insertBefore(this.getNativeCanvasElement(),e[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){const t=this.getNativeCanvasElement();return V.prototype.remove.call(this),t&&t.parentNode&&g._isInDocument(t)&&t.parentNode.removeChild(t),this}getStage(){return this.parent}setSize({width:t,height:e}){return this.canvas.setSize(t,e),this.hitCanvas.setSize(t,e),this._setSmoothEnabled(),this}_validateAdd(t){const e=t.getType();"Group"!==e&&"Shape"!==e&&g.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(t){return(t=t||{}).width=t.width||this.getWidth(),t.height=t.height||this.getHeight(),t.x=void 0!==t.x?t.x:this.x(),t.y=void 0!==t.y?t.y:this.y(),V.prototype._toKonvaCanvas.call(this,t)}_checkVisibility(){const t=this.visible();this.canvas._canvas.style.display=t?"block":"none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){g.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){g.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,g.requestAnimFrame((()=>{this.draw(),this._waitingForDraw=!1}))),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;let e=1,i=!1;for(;;){for(let n=0;n<Wt;n++){const s=Ht[n],r=this._getIntersection({x:t.x+s.x*e,y:t.y+s.y*e}),a=r.shape;if(a)return a;if(i=!!r.antialiased,!r.antialiased)break}if(!i)return null;e+=1}}_getIntersection(t){const e=this.hitCanvas.pixelRatio,i=this.hitCanvas.context.getImageData(Math.round(t.x*e),Math.round(t.y*e),1,1).data,n=i[3];if(255===n){const t=g._rgbToHex(i[0],i[1],i[2]),e=Bt["#"+t];return e?{shape:e}:{antialiased:!0}}return n>0?{antialiased:!0}:{}}drawScene(t,e){const i=this.getLayer(),n=t||i&&i.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&n.getContext().clear(),Q.prototype.drawScene.call(this,n,e),this._fire("draw",{node:this}),this}drawHit(t,e){const i=this.getLayer(),n=t||i&&i.hitCanvas;return i&&i.clearBeforeDraw()&&i.getHitCanvas().getContext().clear(),Q.prototype.drawHit.call(this,n,e),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){g.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return g.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const t=this.parent;!!this.hitCanvas._canvas.parentNode?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}destroy(){return g.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}zt.prototype.nodeType="Layer",n(zt),w.addGetterSetter(zt,"imageSmoothingEnabled",!0),w.addGetterSetter(zt,"clearBeforeDraw",!0),w.addGetterSetter(zt,"hitGraphEnabled",!0,x());class Yt extends zt{constructor(t){super(t),this.listening(!1),g.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}Yt.prototype.nodeType="FastLayer",n(Yt);class Xt extends Q{_validateAdd(t){const e=t.getType();"Group"!==e&&"Shape"!==e&&g.throw("You may only add groups and shapes to groups.")}}Xt.prototype.nodeType="Group",n(Xt);const jt=e.performance&&e.performance.now?function(){return e.performance.now()}:function(){return(new Date).getTime()};class qt{constructor(t,e){this.id=qt.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:jt(),frameRate:0},this.func=t,this.setLayers(e)}setLayers(t){let e=[];return t&&(e=Array.isArray(t)?t:[t]),this.layers=e,this}getLayers(){return this.layers}addLayer(t){const e=this.layers,i=e.length;for(let n=0;n<i;n++)if(e[n]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){const t=qt.animations,e=t.length;for(let i=0;i<e;i++)if(t[i].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=jt(),qt._addAnimation(this),this}stop(){return qt._removeAnimation(this),this}_updateFrameObject(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(t){this.animations.push(t),this._handleAnimation()}static _removeAnimation(t){const e=t.id,i=this.animations,n=i.length;for(let t=0;t<n;t++)if(i[t].id===e){this.animations.splice(t,1);break}}static _runFrames(){const t={},e=this.animations;for(let i=0;i<e.length;i++){const n=e[i],s=n.layers,r=n.func;n._updateFrameObject(jt());const a=s.length;let o;if(o=!r||!1!==r.call(n,n.frame),o)for(let e=0;e<a;e++){const i=s[e];void 0!==i._id&&(t[i._id]=i)}}for(const e in t)t.hasOwnProperty(e)&&t[e].batchDraw()}static _animationLoop(){const t=qt;t.animations.length?(t._runFrames(),g.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,g.requestAnimFrame(this._animationLoop))}}qt.animations=[],qt.animIdCounter=0,qt.animRunning=!1;let Ut={node:1,duration:1,easing:1,onFinish:1,yoyo:1},Vt=0,Kt=["fill","stroke","shadowColor"];class Qt{constructor(t,e,i,n,s,r,a){this.prop=t,this.propFunc=e,this.begin=n,this._pos=n,this.duration=r,this._change=0,this.prevPos=0,this.yoyo=a,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=i,this._change=s-this.begin,this.pause()}fire(t){const e=this[t];e&&e()}setTime(t){t>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():t<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=t,this.update())}getTime(){return this._time}setPosition(t){this.prevPos=this._pos,this.propFunc(t),this._pos=t}getPosition(t){return void 0===t&&(t=this._time),this.func(t,this.begin,this._change,this.duration)}play(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=3,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(t){this.pause(),this._time=t,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const t=this.getTimer()-this._startTime;2===this.state?this.setTime(t):3===this.state&&this.setTime(this.duration-t)}pause(){this.state=1,this.fire("onPause")}getTimer(){return(new Date).getTime()}}class Jt{constructor(t){let e,n,s=this,r=t.node,a=r._id,o=t.easing||$t.Linear,h=!!t.yoyo;e=void 0===t.duration?.3:0===t.duration?.001:t.duration,this.node=r,this._id=Vt++;const l=r.getLayer()||(r instanceof i.Stage?r.getLayers():null);for(n in l||g.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new qt((function(){s.tween.onEnterFrame()}),l),this.tween=new Qt(n,(function(t){s._tweenFunc(t)}),o,0,1,1e3*e,h),this._addListeners(),Jt.attrs[a]||(Jt.attrs[a]={}),Jt.attrs[a][this._id]||(Jt.attrs[a][this._id]={}),Jt.tweens[a]||(Jt.tweens[a]={}),t)void 0===Ut[n]&&this._addAttr(n,t[n]);this.reset(),this.onFinish=t.onFinish,this.onReset=t.onReset,this.onUpdate=t.onUpdate}_addAttr(t,e){let i,n,s,r,a,o,h,l,d=this.node,c=d._id;if(s=Jt.tweens[c][t],s&&delete Jt.attrs[c][s][t],i=d.getAttr(t),g._isArray(e))if(n=[],a=Math.max(e.length,i.length),"points"===t&&e.length!==i.length&&(e.length>i.length?(h=i,i=g._prepareArrayForTween(i,e,d.closed())):(o=e,e=g._prepareArrayForTween(e,i,d.closed()))),0===t.indexOf("fill"))for(r=0;r<a;r++)if(r%2==0)n.push(e[r]-i[r]);else{const t=g.colorToRGBA(i[r]);l=g.colorToRGBA(e[r]),i[r]=t,n.push({r:l.r-t.r,g:l.g-t.g,b:l.b-t.b,a:l.a-t.a})}else for(r=0;r<a;r++)n.push(e[r]-i[r]);else-1!==Kt.indexOf(t)?(i=g.colorToRGBA(i),l=g.colorToRGBA(e),n={r:l.r-i.r,g:l.g-i.g,b:l.b-i.b,a:l.a-i.a}):n=e-i;Jt.attrs[c][this._id][t]={start:i,diff:n,end:e,trueEnd:o,trueStart:h},Jt.tweens[c][t]=this._id}_tweenFunc(t){let e,i,n,s,r,a,o,h,l=this.node,d=Jt.attrs[l._id][this._id];for(e in d){if(i=d[e],n=i.start,s=i.diff,h=i.end,g._isArray(n))if(r=[],o=Math.max(n.length,h.length),0===e.indexOf("fill"))for(a=0;a<o;a++)a%2==0?r.push((n[a]||0)+s[a]*t):r.push("rgba("+Math.round(n[a].r+s[a].r*t)+","+Math.round(n[a].g+s[a].g*t)+","+Math.round(n[a].b+s[a].b*t)+","+(n[a].a+s[a].a*t)+")");else for(a=0;a<o;a++)r.push((n[a]||0)+s[a]*t);else r=-1!==Kt.indexOf(e)?"rgba("+Math.round(n.r+s.r*t)+","+Math.round(n.g+s.g*t)+","+Math.round(n.b+s.b*t)+","+(n.a+s.a*t)+")":n+s*t;l.setAttr(e,r)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const t=this.node,e=Jt.attrs[t._id][this._id];e.points&&e.points.trueEnd&&t.setAttr("points",e.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const t=this.node,e=Jt.attrs[t._id][this._id];e.points&&e.points.trueStart&&t.points(e.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(t){return this.tween.seek(1e3*t),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){let t,e=this.node._id,i=this._id,n=Jt.tweens[e];for(t in this.pause(),n)delete Jt.tweens[e][t];delete Jt.attrs[e][i]}}Jt.attrs={},Jt.tweens={},V.prototype.to=function(t){const e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()};new Jt(t).play()};const $t={BackEaseIn(t,e,i,n){const s=1.70158;return i*(t/=n)*t*((s+1)*t-s)+e},BackEaseOut(t,e,i,n){const s=1.70158;return i*((t=t/n-1)*t*((s+1)*t+s)+1)+e},BackEaseInOut(t,e,i,n){let s=1.70158;return(t/=n/2)<1?i/2*(t*t*((1+(s*=1.525))*t-s))+e:i/2*((t-=2)*t*((1+(s*=1.525))*t+s)+2)+e},ElasticEaseIn(t,e,i,n,s,r){let a=0;return 0===t?e:1==(t/=n)?e+i:(r||(r=.3*n),!s||s<Math.abs(i)?(s=i,a=r/4):a=r/(2*Math.PI)*Math.asin(i/s),-s*Math.pow(2,10*(t-=1))*Math.sin((t*n-a)*(2*Math.PI)/r)+e)},ElasticEaseOut(t,e,i,n,s,r){let a=0;return 0===t?e:1==(t/=n)?e+i:(r||(r=.3*n),!s||s<Math.abs(i)?(s=i,a=r/4):a=r/(2*Math.PI)*Math.asin(i/s),s*Math.pow(2,-10*t)*Math.sin((t*n-a)*(2*Math.PI)/r)+i+e)},ElasticEaseInOut(t,e,i,n,s,r){let a=0;return 0===t?e:2==(t/=n/2)?e+i:(r||(r=n*(.3*1.5)),!s||s<Math.abs(i)?(s=i,a=r/4):a=r/(2*Math.PI)*Math.asin(i/s),t<1?s*Math.pow(2,10*(t-=1))*Math.sin((t*n-a)*(2*Math.PI)/r)*-.5+e:s*Math.pow(2,-10*(t-=1))*Math.sin((t*n-a)*(2*Math.PI)/r)*.5+i+e)},BounceEaseOut:(t,e,i,n)=>(t/=n)<1/2.75?i*(7.5625*t*t)+e:t<2/2.75?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e,BounceEaseIn:(t,e,i,n)=>i-$t.BounceEaseOut(n-t,0,i,n)+e,BounceEaseInOut:(t,e,i,n)=>t<n/2?.5*$t.BounceEaseIn(2*t,0,i,n)+e:.5*$t.BounceEaseOut(2*t-n,0,i,n)+.5*i+e,EaseIn:(t,e,i,n)=>i*(t/=n)*t+e,EaseOut:(t,e,i,n)=>-i*(t/=n)*(t-2)+e,EaseInOut:(t,e,i,n)=>(t/=n/2)<1?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e,StrongEaseIn:(t,e,i,n)=>i*(t/=n)*t*t*t*t+e,StrongEaseOut:(t,e,i,n)=>i*((t=t/n-1)*t*t*t*t+1)+e,StrongEaseInOut:(t,e,i,n)=>(t/=n/2)<1?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e,Linear:(t,e,i,n)=>i*t/n+e},Zt=g._assign(i,{Util:g,Transform:s,Node:V,Container:Q,Stage:Gt,stages:Mt,Layer:zt,FastLayer:Yt,Group:Xt,DD:E,Shape:Nt,shapes:Bt,Animation:qt,Tween:Jt,Easings:$t,Context:P,Canvas:M});class te extends Nt{_sceneFunc(t){const e=i.getAngle(this.angle()),n=this.clockwise();t.beginPath(),t.arc(0,0,this.outerRadius(),0,e,n),t.arc(0,0,this.innerRadius(),e,0,!n),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}getSelfRect(){const t=this.innerRadius(),e=this.outerRadius(),n=this.clockwise(),s=i.getAngle(n?360-this.angle():this.angle()),r=Math.cos(Math.min(s,Math.PI)),a=Math.sin(Math.min(Math.max(Math.PI,s),3*Math.PI/2)),o=Math.sin(Math.min(s,Math.PI/2)),h=r*(r>0?t:e),l=a*(a>0?t:e),d=o*(o>0?e:t);return{x:h,y:n?-1*d:l,width:1*e-h,height:d-l}}}function ee(t,e,i,n,s,r,a){const o=Math.sqrt(Math.pow(i-t,2)+Math.pow(n-e,2)),h=Math.sqrt(Math.pow(s-i,2)+Math.pow(r-n,2)),l=a*o/(o+h),d=a*h/(o+h);return[i-l*(s-t),n-l*(r-e),i+d*(s-t),n+d*(r-e)]}function ie(t,e){const i=t.length,n=[];for(let s=2;s<i-2;s+=2){const i=ee(t[s-2],t[s-1],t[s],t[s+1],t[s+2],t[s+3],e);isNaN(i[0])||(n.push(i[0]),n.push(i[1]),n.push(t[s]),n.push(t[s+1]),n.push(i[2]),n.push(i[3]))}return n}te.prototype._centroid=!0,te.prototype.className="Arc",te.prototype._attrsAffectingSize=["innerRadius","outerRadius"],n(te),w.addGetterSetter(te,"innerRadius",0,p()),w.addGetterSetter(te,"outerRadius",0,p()),w.addGetterSetter(te,"angle",0,p()),w.addGetterSetter(te,"clockwise",!1,x());class ne extends Nt{constructor(t){super(t),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",(function(){this._clearCache("tensionPoints")}))}_sceneFunc(t){let e,i,n,s=this.points(),r=s.length,a=this.tension(),o=this.closed(),h=this.bezier();if(r){if(t.beginPath(),t.moveTo(s[0],s[1]),0!==a&&r>4){for(e=this.getTensionPoints(),i=e.length,n=o?0:4,o||t.quadraticCurveTo(e[0],e[1],e[2],e[3]);n<i-2;)t.bezierCurveTo(e[n++],e[n++],e[n++],e[n++],e[n++],e[n++]);o||t.quadraticCurveTo(e[i-2],e[i-1],s[r-2],s[r-1])}else if(h)for(n=2;n<r;)t.bezierCurveTo(s[n++],s[n++],s[n++],s[n++],s[n++],s[n++]);else for(n=2;n<r;n+=2)t.lineTo(s[n],s[n+1]);o?(t.closePath(),t.fillStrokeShape(this)):t.strokeShape(this)}}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():ie(this.points(),this.tension())}_getTensionPointsClosed(){const t=this.points(),e=t.length,i=this.tension(),n=ee(t[e-2],t[e-1],t[0],t[1],t[2],t[3],i),s=ee(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],i),r=ie(t,i);return[n[2],n[3]].concat(r).concat([s[0],s[1],t[e-2],t[e-1],s[2],s[3],n[0],n[1],t[0],t[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let t=this.points();if(t.length<4)return{x:t[0]||0,y:t[1]||0,width:0,height:0};t=0!==this.tension()?[t[0],t[1],...this._getTensionPoints(),t[t.length-2],t[t.length-1]]:this.points();let e,i,n=t[0],s=t[0],r=t[1],a=t[1];for(let o=0;o<t.length/2;o++)e=t[2*o],i=t[2*o+1],n=Math.min(n,e),s=Math.max(s,e),r=Math.min(r,i),a=Math.max(a,i);return{x:n,y:r,width:s-n,height:a-r}}}ne.prototype.className="Line",ne.prototype._attrsAffectingSize=["points","bezier","tension"],n(ne),w.addGetterSetter(ne,"closed",!1),w.addGetterSetter(ne,"bezier",!1),w.addGetterSetter(ne,"tension",0,p()),w.addGetterSetter(ne,"points",[],function(){if(i.isUnminified)return function(t,e){const i=Int8Array?Object.getPrototypeOf(Int8Array):null;return i&&t instanceof i||(g._isArray(t)?t.forEach((function(t){g._isNumber(t)||g.warn('"'+e+'" attribute has non numeric element '+t+". Make sure that all elements are numbers.")})):g.warn(u(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}());const se=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],re=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],ae=[[1],[1,1],[1,2,1],[1,3,3,1]],oe=(t,e,i)=>{let n,s;const r=i/2;n=0;for(let i=0;i<20;i++)s=r*se[20][i]+r,n+=re[20][i]*le(t,e,s);return r*n},he=(t,e,i)=>{void 0===i&&(i=1);const n=t[0]-2*t[1]+t[2],s=e[0]-2*e[1]+e[2],r=2*t[1]-2*t[0],a=2*e[1]-2*e[0],o=4*(n*n+s*s),h=4*(n*r+s*a),l=r*r+a*a;if(0===o)return i*Math.sqrt(Math.pow(t[2]-t[0],2)+Math.pow(e[2]-e[0],2));const d=h/(2*o),c=i+d,g=l/o-d*d,u=c*c+g>0?Math.sqrt(c*c+g):0,f=d*d+g>0?Math.sqrt(d*d+g):0,p=d+Math.sqrt(d*d+g)!==0?g*Math.log(Math.abs((c+u)/(d+f))):0;return Math.sqrt(o)/2*(c*u-d*f+p)};function le(t,e,i){const n=de(1,i,t),s=de(1,i,e),r=n*n+s*s;return Math.sqrt(r)}const de=(t,e,i)=>{const n=i.length-1;let s,r;if(0===n)return 0;if(0===t){r=0;for(let t=0;t<=n;t++)r+=ae[n][t]*Math.pow(1-e,n-t)*Math.pow(e,t)*i[t];return r}s=new Array(n);for(let t=0;t<n;t++)s[t]=n*(i[t+1]-i[t]);return de(t-1,e,s)},ce=(t,e,i)=>{let n=1,s=t/e,r=(t-i(s))/e,a=0;for(;n>.001;){const o=i(s+r),h=Math.abs(t-o)/e;if(h<n)n=h,s+=r;else{const a=i(s-r),o=Math.abs(t-a)/e;o<n?(n=o,s-=r):r/=2}if(a++,a>500)break}return s};class ge extends Nt{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",(function(){this._readDataAttribute()}))}_readDataAttribute(){this.dataArray=ge.parsePathData(this.data()),this.pathLength=ge.getPathLength(this.dataArray)}_sceneFunc(t){const e=this.dataArray;t.beginPath();let i=!1;for(let f=0;f<e.length;f++){const p=e[f].command,m=e[f].points;switch(p){case"L":t.lineTo(m[0],m[1]);break;case"M":t.moveTo(m[0],m[1]);break;case"C":t.bezierCurveTo(m[0],m[1],m[2],m[3],m[4],m[5]);break;case"Q":t.quadraticCurveTo(m[0],m[1],m[2],m[3]);break;case"A":var n=m[0],s=m[1],r=m[2],a=m[3],o=m[4],h=m[5],l=m[6],d=m[7],c=r>a?r:a,g=r>a?1:r/a,u=r>a?a/r:1;t.translate(n,s),t.rotate(l),t.scale(g,u),t.arc(0,0,c,o,o+h,1-d),t.scale(1/g,1/u),t.rotate(-l),t.translate(-n,-s);break;case"z":i=!0,t.closePath()}}i||this.hasFill()?t.fillStrokeShape(this):t.strokeShape(this)}getSelfRect(){let t=[];this.dataArray.forEach((function(e){if("A"===e.command){const i=e.points[4],n=e.points[5],s=e.points[4]+n;let r=Math.PI/180;if(Math.abs(i-s)<r&&(r=Math.abs(i-s)),n<0)for(let n=i-r;n>s;n-=r){const i=ge.getPointOnEllipticalArc(e.points[0],e.points[1],e.points[2],e.points[3],n,0);t.push(i.x,i.y)}else for(let n=i+r;n<s;n+=r){const i=ge.getPointOnEllipticalArc(e.points[0],e.points[1],e.points[2],e.points[3],n,0);t.push(i.x,i.y)}}else if("C"===e.command)for(let i=0;i<=1;i+=.01){const n=ge.getPointOnCubicBezier(i,e.start.x,e.start.y,e.points[0],e.points[1],e.points[2],e.points[3],e.points[4],e.points[5]);t.push(n.x,n.y)}else t=t.concat(e.points)}));let e,i,n=t[0],s=t[0],r=t[1],a=t[1];for(let o=0;o<t.length/2;o++)e=t[2*o],i=t[2*o+1],isNaN(e)||(n=Math.min(n,e),s=Math.max(s,e)),isNaN(i)||(r=Math.min(r,i),a=Math.max(a,i));return{x:n,y:r,width:s-n,height:a-r}}getLength(){return this.pathLength}getPointAtLength(t){return ge.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(t,e,i,n){return Math.sqrt((i-t)*(i-t)+(n-e)*(n-e))}static getPathLength(t){let e=0;for(let i=0;i<t.length;++i)e+=t[i].pathLength;return e}static getPointAtLengthOfDataArray(t,e){let i,n=0,s=e.length;if(!s)return null;for(;n<s&&t>e[n].pathLength;)t-=e[n].pathLength,++n;if(n===s)return i=e[n-1].points.slice(-2),{x:i[0],y:i[1]};if(t<.01)return i=e[n].points.slice(0,2),{x:i[0],y:i[1]};const r=e[n],a=r.points;switch(r.command){case"L":return ge.getPointOnLine(t,r.start.x,r.start.y,a[0],a[1]);case"C":return ge.getPointOnCubicBezier(ce(t,ge.getPathLength(e),(t=>oe([r.start.x,a[0],a[2],a[4]],[r.start.y,a[1],a[3],a[5]],t))),r.start.x,r.start.y,a[0],a[1],a[2],a[3],a[4],a[5]);case"Q":return ge.getPointOnQuadraticBezier(ce(t,ge.getPathLength(e),(t=>he([r.start.x,a[0],a[2]],[r.start.y,a[1],a[3]],t))),r.start.x,r.start.y,a[0],a[1],a[2],a[3]);case"A":var o=a[0],h=a[1],l=a[2],d=a[3],c=a[4],g=a[5],u=a[6];return c+=g*t/r.pathLength,ge.getPointOnEllipticalArc(o,h,l,d,c,u)}return null}static getPointOnLine(t,e,i,n,s,r,a){r=null!=r?r:e,a=null!=a?a:i;const o=this.getLineLength(e,i,n,s);if(o<1e-10)return{x:e,y:i};if(n===e)return{x:r,y:a+(s>i?t:-t)};const h=(s-i)/(n-e),l=Math.sqrt(t*t/(1+h*h))*(n<e?-1:1),d=h*l;if(Math.abs(a-i-h*(r-e))<1e-10)return{x:r+l,y:a+d};const c=((r-e)*(n-e)+(a-i)*(s-i))/(o*o),g=e+c*(n-e),u=i+c*(s-i),f=this.getLineLength(r,a,g,u),p=Math.sqrt(t*t-f*f),m=Math.sqrt(p*p/(1+h*h))*(n<e?-1:1);return{x:g+m,y:u+h*m}}static getPointOnCubicBezier(t,e,i,n,s,r,a,o,h){function l(t){return t*t*t}function d(t){return 3*t*t*(1-t)}function c(t){return 3*t*(1-t)*(1-t)}function g(t){return(1-t)*(1-t)*(1-t)}return{x:o*l(t)+r*d(t)+n*c(t)+e*g(t),y:h*l(t)+a*d(t)+s*c(t)+i*g(t)}}static getPointOnQuadraticBezier(t,e,i,n,s,r,a){function o(t){return t*t}function h(t){return 2*t*(1-t)}function l(t){return(1-t)*(1-t)}return{x:r*o(t)+n*h(t)+e*l(t),y:a*o(t)+s*h(t)+i*l(t)}}static getPointOnEllipticalArc(t,e,i,n,s,r){const a=Math.cos(r),o=Math.sin(r),h=i*Math.cos(s),l=n*Math.sin(s);return{x:t+(h*a-l*o),y:e+(h*o+l*a)}}static parsePathData(t){if(!t)return[];let e=t;const i=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];e=e.replace(new RegExp(" ","g"),",");for(var n=0;n<i.length;n++)e=e.replace(new RegExp(i[n],"g"),"|"+i[n]);const s=e.split("|"),r=[],a=[];let o=0,h=0;const l=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let d;for(n=1;n<s.length;n++){let t=s[n],e=t.charAt(0);for(t=t.slice(1),a.length=0;d=l.exec(t);)a.push(d[0]);const i=[];for(let t=0,e=a.length;t<e;t++){if("00"===a[t]){i.push(0,0);continue}const e=parseFloat(a[t]);isNaN(e)?i.push(0):i.push(e)}for(;i.length>0&&!isNaN(i[0]);){let t="",n=[];const s=o,a=h;var c,g,u,f,p,m,_,y,v,x;switch(e){case"l":o+=i.shift(),h+=i.shift(),t="L",n.push(o,h);break;case"L":o=i.shift(),h=i.shift(),n.push(o,h);break;case"m":var b=i.shift(),S=i.shift();if(o+=b,h+=S,t="M",r.length>2&&"z"===r[r.length-1].command)for(let t=r.length-2;t>=0;t--)if("M"===r[t].command){o=r[t].points[0]+b,h=r[t].points[1]+S;break}n.push(o,h),e="l";break;case"M":o=i.shift(),h=i.shift(),t="M",n.push(o,h),e="L";break;case"h":o+=i.shift(),t="L",n.push(o,h);break;case"H":o=i.shift(),t="L",n.push(o,h);break;case"v":h+=i.shift(),t="L",n.push(o,h);break;case"V":h=i.shift(),t="L",n.push(o,h);break;case"C":n.push(i.shift(),i.shift(),i.shift(),i.shift()),o=i.shift(),h=i.shift(),n.push(o,h);break;case"c":n.push(o+i.shift(),h+i.shift(),o+i.shift(),h+i.shift()),o+=i.shift(),h+=i.shift(),t="C",n.push(o,h);break;case"S":g=o,u=h,"C"===(c=r[r.length-1]).command&&(g=o+(o-c.points[2]),u=h+(h-c.points[3])),n.push(g,u,i.shift(),i.shift()),o=i.shift(),h=i.shift(),t="C",n.push(o,h);break;case"s":g=o,u=h,"C"===(c=r[r.length-1]).command&&(g=o+(o-c.points[2]),u=h+(h-c.points[3])),n.push(g,u,o+i.shift(),h+i.shift()),o+=i.shift(),h+=i.shift(),t="C",n.push(o,h);break;case"Q":n.push(i.shift(),i.shift()),o=i.shift(),h=i.shift(),n.push(o,h);break;case"q":n.push(o+i.shift(),h+i.shift()),o+=i.shift(),h+=i.shift(),t="Q",n.push(o,h);break;case"T":g=o,u=h,"Q"===(c=r[r.length-1]).command&&(g=o+(o-c.points[0]),u=h+(h-c.points[1])),o=i.shift(),h=i.shift(),t="Q",n.push(g,u,o,h);break;case"t":g=o,u=h,"Q"===(c=r[r.length-1]).command&&(g=o+(o-c.points[0]),u=h+(h-c.points[1])),o+=i.shift(),h+=i.shift(),t="Q",n.push(g,u,o,h);break;case"A":f=i.shift(),p=i.shift(),m=i.shift(),_=i.shift(),y=i.shift(),v=o,x=h,o=i.shift(),h=i.shift(),t="A",n=this.convertEndpointToCenterParameterization(v,x,o,h,_,y,f,p,m);break;case"a":f=i.shift(),p=i.shift(),m=i.shift(),_=i.shift(),y=i.shift(),v=o,x=h,o+=i.shift(),h+=i.shift(),t="A",n=this.convertEndpointToCenterParameterization(v,x,o,h,_,y,f,p,m)}r.push({command:t||e,points:n,start:{x:s,y:a},pathLength:this.calcLength(s,a,t||e,n)})}"z"!==e&&"Z"!==e||r.push({command:"z",points:[],start:void 0,pathLength:0})}return r}static calcLength(t,e,i,n){let s,r,a,o;const h=ge;switch(i){case"L":return h.getLineLength(t,e,n[0],n[1]);case"C":return oe([t,n[0],n[2],n[4]],[e,n[1],n[3],n[5]],1);case"Q":return he([t,n[0],n[2]],[e,n[1],n[3]],1);case"A":s=0;var l=n[4],d=n[5],c=n[4]+d,g=Math.PI/180;if(Math.abs(l-c)<g&&(g=Math.abs(l-c)),r=h.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],l,0),d<0)for(o=l-g;o>c;o-=g)a=h.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],o,0),s+=h.getLineLength(r.x,r.y,a.x,a.y),r=a;else for(o=l+g;o<c;o+=g)a=h.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],o,0),s+=h.getLineLength(r.x,r.y,a.x,a.y),r=a;return a=h.getPointOnEllipticalArc(n[0],n[1],n[2],n[3],c,0),s+=h.getLineLength(r.x,r.y,a.x,a.y),s}return 0}static convertEndpointToCenterParameterization(t,e,i,n,s,r,a,o,h){const l=h*(Math.PI/180),d=Math.cos(l)*(t-i)/2+Math.sin(l)*(e-n)/2,c=-1*Math.sin(l)*(t-i)/2+Math.cos(l)*(e-n)/2,g=d*d/(a*a)+c*c/(o*o);g>1&&(a*=Math.sqrt(g),o*=Math.sqrt(g));let u=Math.sqrt((a*a*(o*o)-a*a*(c*c)-o*o*(d*d))/(a*a*(c*c)+o*o*(d*d)));s===r&&(u*=-1),isNaN(u)&&(u=0);const f=u*a*c/o,p=u*-o*d/a,m=(t+i)/2+Math.cos(l)*f-Math.sin(l)*p,_=(e+n)/2+Math.sin(l)*f+Math.cos(l)*p,y=function(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])},v=function(t,e){return(t[0]*e[0]+t[1]*e[1])/(y(t)*y(e))},x=function(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(v(t,e))},b=x([1,0],[(d-f)/a,(c-p)/o]),S=[(d-f)/a,(c-p)/o],w=[(-1*d-f)/a,(-1*c-p)/o];let C=x(S,w);return v(S,w)<=-1&&(C=Math.PI),v(S,w)>=1&&(C=0),0===r&&C>0&&(C-=2*Math.PI),1===r&&C<0&&(C+=2*Math.PI),[m,_,a,o,b,C,l,r]}}ge.prototype.className="Path",ge.prototype._attrsAffectingSize=["data"],n(ge),w.addGetterSetter(ge,"data");class ue extends ne{_sceneFunc(t){super._sceneFunc(t);const e=2*Math.PI,i=this.points();let n=i;const s=0!==this.tension()&&i.length>4;s&&(n=this.getTensionPoints());const r=this.pointerLength(),a=i.length;let o,h;if(s){const t=[n[n.length-4],n[n.length-3],n[n.length-2],n[n.length-1],i[a-2],i[a-1]],e=ge.calcLength(n[n.length-4],n[n.length-3],"C",t),s=ge.getPointOnQuadraticBezier(Math.min(1,1-r/e),t[0],t[1],t[2],t[3],t[4],t[5]);o=i[a-2]-s.x,h=i[a-1]-s.y}else o=i[a-2]-i[a-4],h=i[a-1]-i[a-3];const l=(Math.atan2(h,o)+e)%e,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(i[a-2],i[a-1]),t.rotate(l),t.moveTo(0,0),t.lineTo(-r,d/2),t.lineTo(-r,-d/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(i[0],i[1]),s?(o=(n[0]+n[2])/2-i[0],h=(n[1]+n[3])/2-i[1]):(o=i[2]-i[0],h=i[3]-i[1]),t.rotate((Math.atan2(-h,-o)+e)%e),t.moveTo(0,0),t.lineTo(-r,d/2),t.lineTo(-r,-d/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){const e=this.dashEnabled();e&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),e&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),e=this.pointerWidth()/2;return{x:t.x-e,y:t.y-e,width:t.width+2*e,height:t.height+2*e}}}ue.prototype.className="Arrow",n(ue),w.addGetterSetter(ue,"pointerLength",10,p()),w.addGetterSetter(ue,"pointerWidth",10,p()),w.addGetterSetter(ue,"pointerAtBeginning",!1),w.addGetterSetter(ue,"pointerAtEnding",!0);class fe extends Nt{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,2*Math.PI,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}}fe.prototype._centroid=!0,fe.prototype.className="Circle",fe.prototype._attrsAffectingSize=["radius"],n(fe),w.addGetterSetter(fe,"radius",0,p());class pe extends Nt{_sceneFunc(t){const e=this.radiusX(),i=this.radiusY();t.beginPath(),t.save(),e!==i&&t.scale(1,i/e),t.arc(0,0,e,0,2*Math.PI,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.radiusX()}getHeight(){return 2*this.radiusY()}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}pe.prototype.className="Ellipse",pe.prototype._centroid=!0,pe.prototype._attrsAffectingSize=["radiusX","radiusY"],n(pe),w.addComponentsGetterSetter(pe,"radius",["x","y"]),w.addGetterSetter(pe,"radiusX",0,p()),w.addGetterSetter(pe,"radiusY",0,p());class me extends Nt{constructor(t){super(t),this.on("imageChange.konva",(()=>{this._setImageLoad()})),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&4===t.readyState||t&&t.addEventListener&&t.addEventListener("load",(()=>{this._requestDraw()}))}_useBufferCanvas(){const t=!!this.cornerRadius(),e=this.hasShadow();return!(!t||!e)||super._useBufferCanvas(!0)}_sceneFunc(t){const e=this.getWidth(),i=this.getHeight(),n=this.cornerRadius(),s=this.attrs.image;let r;if(s){const t=this.attrs.cropWidth,n=this.attrs.cropHeight;r=t&&n?[s,this.cropX(),this.cropY(),t,n,0,0,e,i]:[s,0,0,e,i]}(this.hasFill()||this.hasStroke()||n)&&(t.beginPath(),n?g.drawRoundedRectPath(t,e,i,n):t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)),s&&(n&&t.clip(),t.drawImage.apply(t,r))}_hitFunc(t){const e=this.width(),i=this.height(),n=this.cornerRadius();t.beginPath(),n?g.drawRoundedRectPath(t,e,i,n):t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,e;return null!==(t=this.attrs.width)&&void 0!==t?t:null===(e=this.image())||void 0===e?void 0:e.width}getHeight(){var t,e;return null!==(t=this.attrs.height)&&void 0!==t?t:null===(e=this.image())||void 0===e?void 0:e.height}static fromURL(t,e,i=null){const n=g.createImageElement();n.onload=function(){const t=new me({image:n});e(t)},n.onerror=i,n.crossOrigin="Anonymous",n.src=t}}me.prototype.className="Image",n(me),w.addGetterSetter(me,"cornerRadius",0,m(4)),w.addGetterSetter(me,"image"),w.addComponentsGetterSetter(me,"crop",["x","y","width","height"]),w.addGetterSetter(me,"cropX",0,p()),w.addGetterSetter(me,"cropY",0,p()),w.addGetterSetter(me,"cropWidth",0,p()),w.addGetterSetter(me,"cropHeight",0,p());const _e=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],ye="up",ve="right",xe="down",be="left",Se=_e.length;class we extends Xt{constructor(t){super(t),this.on("add.konva",(function(t){this._addListeners(t.child),this._sync()}))}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){let e,i=this;const n=function(){i._sync()};for(e=0;e<Se;e++)t.on(_e[e]+"Change.konva",n)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let t,e,i,n,s,r,a,o=this.getText(),h=this.getTag();if(o&&h){switch(t=o.width(),e=o.height(),i=h.pointerDirection(),n=h.pointerWidth(),a=h.pointerHeight(),s=0,r=0,i){case ye:s=t/2,r=-1*a;break;case ve:s=t+n,r=e/2;break;case xe:s=t/2,r=e+a;break;case be:s=-1*n,r=e/2}h.setAttrs({x:-1*s,y:-1*r,width:t,height:e}),o.setAttrs({x:-1*s,y:-1*r})}}}we.prototype.className="Label",n(we);class Ce extends Nt{_sceneFunc(t){const e=this.width(),i=this.height(),n=this.pointerDirection(),s=this.pointerWidth(),r=this.pointerHeight(),a=this.cornerRadius();let o=0,h=0,l=0,d=0;"number"==typeof a?o=h=l=d=Math.min(a,e/2,i/2):(o=Math.min(a[0]||0,e/2,i/2),h=Math.min(a[1]||0,e/2,i/2),d=Math.min(a[2]||0,e/2,i/2),l=Math.min(a[3]||0,e/2,i/2)),t.beginPath(),t.moveTo(o,0),n===ye&&(t.lineTo((e-s)/2,0),t.lineTo(e/2,-1*r),t.lineTo((e+s)/2,0)),t.lineTo(e-h,0),t.arc(e-h,h,h,3*Math.PI/2,0,!1),n===ve&&(t.lineTo(e,(i-r)/2),t.lineTo(e+s,i/2),t.lineTo(e,(i+r)/2)),t.lineTo(e,i-d),t.arc(e-d,i-d,d,0,Math.PI/2,!1),n===xe&&(t.lineTo((e+s)/2,i),t.lineTo(e/2,i+r),t.lineTo((e-s)/2,i)),t.lineTo(l,i),t.arc(l,i-l,l,Math.PI/2,Math.PI,!1),n===be&&(t.lineTo(0,(i+r)/2),t.lineTo(-1*s,i/2),t.lineTo(0,(i-r)/2)),t.lineTo(0,o),t.arc(o,o,o,Math.PI,3*Math.PI/2,!1),t.closePath(),t.fillStrokeShape(this)}getSelfRect(){let t=0,e=0,i=this.pointerWidth(),n=this.pointerHeight(),s=this.pointerDirection(),r=this.width(),a=this.height();return s===ye?(e-=n,a+=n):s===xe?a+=n:s===be?(t-=1.5*i,r+=i):s===ve&&(r+=1.5*i),{x:t,y:e,width:r,height:a}}}Ce.prototype.className="Tag",n(Ce),w.addGetterSetter(Ce,"pointerDirection","none"),w.addGetterSetter(Ce,"pointerWidth",0,p()),w.addGetterSetter(Ce,"pointerHeight",0,p()),w.addGetterSetter(Ce,"cornerRadius",0,m(4));class Pe extends Nt{_sceneFunc(t){const e=this.cornerRadius(),i=this.width(),n=this.height();t.beginPath(),e?g.drawRoundedRectPath(t,i,n,e):t.rect(0,0,i,n),t.closePath(),t.fillStrokeShape(this)}}Pe.prototype.className="Rect",n(Pe),w.addGetterSetter(Pe,"cornerRadius",0,m(4));class ke extends Nt{_sceneFunc(t){const e=this._getPoints();t.beginPath(),t.moveTo(e[0].x,e[0].y);for(let i=1;i<e.length;i++)t.lineTo(e[i].x,e[i].y);t.closePath(),t.fillStrokeShape(this)}_getPoints(){const t=this.attrs.sides,e=this.attrs.radius||0,i=[];for(let n=0;n<t;n++)i.push({x:e*Math.sin(2*n*Math.PI/t),y:-1*e*Math.cos(2*n*Math.PI/t)});return i}getSelfRect(){const t=this._getPoints();let e=t[0].x,i=t[0].y,n=t[0].x,s=t[0].y;return t.forEach((t=>{e=Math.min(e,t.x),i=Math.max(i,t.x),n=Math.min(n,t.y),s=Math.max(s,t.y)})),{x:e,y:n,width:i-e,height:s-n}}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}ke.prototype.className="RegularPolygon",ke.prototype._centroid=!0,ke.prototype._attrsAffectingSize=["radius"],n(ke),w.addGetterSetter(ke,"radius",0,p()),w.addGetterSetter(ke,"sides",0,p());const Ae=2*Math.PI;class Te extends Nt{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,Ae,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),Ae,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}Te.prototype.className="Ring",Te.prototype._centroid=!0,Te.prototype._attrsAffectingSize=["innerRadius","outerRadius"],n(Te),w.addGetterSetter(Te,"innerRadius",0,p()),w.addGetterSetter(Te,"outerRadius",0,p());class Me extends Nt{constructor(t){super(t),this._updated=!0,this.anim=new qt((()=>{const t=this._updated;return this._updated=!1,t})),this.on("animationChange.konva",(function(){this.frameIndex(0)})),this.on("frameIndexChange.konva",(function(){this._updated=!0})),this.on("frameRateChange.konva",(function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())}))}_sceneFunc(t){const e=this.animation(),i=this.frameIndex(),n=4*i,s=this.animations()[e],r=this.frameOffsets(),a=s[n+0],o=s[n+1],h=s[n+2],l=s[n+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,h,l),t.closePath(),t.fillStrokeShape(this)),d)if(r){const n=r[e],s=2*i;t.drawImage(d,a,o,h,l,n[s+0],n[s+1],h,l)}else t.drawImage(d,a,o,h,l,0,0,h,l)}_hitFunc(t){const e=this.animation(),i=this.frameIndex(),n=4*i,s=this.animations()[e],r=this.frameOffsets(),a=s[n+2],o=s[n+3];if(t.beginPath(),r){const n=r[e],s=2*i;t.rect(n[s+0],n[s+1],a,o)}else t.rect(0,0,a,o);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const t=this;this.interval=setInterval((function(){t._updateIndex()}),1e3/this.frameRate())}start(){if(this.isRunning())return;const t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const t=this.frameIndex(),e=this.animation();t<this.animations()[e].length/4-1?this.frameIndex(t+1):this.frameIndex(0)}}Me.prototype.className="Sprite",n(Me),w.addGetterSetter(Me,"animation"),w.addGetterSetter(Me,"animations"),w.addGetterSetter(Me,"frameOffsets"),w.addGetterSetter(Me,"image"),w.addGetterSetter(Me,"frameIndex",0,p()),w.addGetterSetter(Me,"frameRate",17,p()),w.backCompat(Me,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});class Ge extends Nt{_sceneFunc(t){const e=this.innerRadius(),i=this.outerRadius(),n=this.numPoints();t.beginPath(),t.moveTo(0,0-i);for(let s=1;s<2*n;s++){const r=s%2==0?i:e,a=r*Math.sin(s*Math.PI/n),o=-1*r*Math.cos(s*Math.PI/n);t.lineTo(a,o)}t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.outerRadius()}getHeight(){return 2*this.outerRadius()}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}function Re(t){return[...t].reduce(((t,e,i,n)=>(/\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?(?:\u200D\p{Emoji_Presentation})+/u.test(e)?t.push(e):/\p{Regional_Indicator}{2}/u.test(e+(n[i+1]||""))?t.push(e+n[i+1]):i>0&&/\p{Mn}|\p{Me}|\p{Mc}/u.test(e)?t[t.length-1]+=e:t.push(e),t)),[])}Ge.prototype.className="Star",Ge.prototype._centroid=!0,Ge.prototype._attrsAffectingSize=["innerRadius","outerRadius"],n(Ge),w.addGetterSetter(Ge,"numPoints",5,p()),w.addGetterSetter(Ge,"innerRadius",0,p()),w.addGetterSetter(Ge,"outerRadius",0,p());const Ee="auto",De="inherit",Le="justify",Ie="left",Oe="middle",Fe="normal",Be=" ",Ne="none",He=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],We=He.length;let ze;function Ye(){return ze||(ze=g.createCanvasElement().getContext("2d"),ze)}class Xe extends Nt{constructor(t){super(function(t){return(t=t||{}).fillLinearGradientColorStops||t.fillRadialGradientColorStops||t.fillPatternImage||(t.fill=t.fill||"black"),t}(t)),this._partialTextX=0,this._partialTextY=0;for(let t=0;t<We;t++)this.on(He[t]+"Change.konva",this._setTextData);this._setTextData()}_sceneFunc(t){const e=this.textArr,n=e.length;if(!this.text())return;let s,r=this.padding(),a=this.fontSize(),o=this.lineHeight()*a,h=this.verticalAlign(),l=this.direction(),d=0,c=this.align(),g=this.getWidth(),u=this.letterSpacing(),f=this.fill(),p=this.textDecoration(),m=-1!==p.indexOf("underline"),_=-1!==p.indexOf("line-through");l=l===De?t.direction:l;let y=o/2,v=Oe;if(i._fixTextRendering){const t=this.measureSize("M");v="alphabetic",y=(t.fontBoundingBoxAscent-t.fontBoundingBoxDescent)/2+o/2}var x=0,b=0;for("rtl"===l&&t.setAttr("direction",l),t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",v),t.setAttr("textAlign",Ie),h===Oe?d=(this.getHeight()-n*o-2*r)/2:"bottom"===h&&(d=this.getHeight()-n*o-2*r),t.translate(r,d+r),s=0;s<n;s++){x=0,b=0;var S,w,C,P=e[s],k=P.text,A=P.width,T=P.lastInParagraph;if(t.save(),"right"===c?x+=g-A-2*r:"center"===c&&(x+=(g-A-2*r)/2),m){t.save(),t.beginPath();const e=x,n=y+b+(i._fixTextRendering?Math.round(a/4):Math.round(a/2));t.moveTo(e,n),w=0===(S=k.split(" ").length-1),C=c!==Le||T?A:g-2*r,t.lineTo(e+Math.round(C),n),t.lineWidth=a/15;const s=this._getLinearGradient();t.strokeStyle=s||f,t.stroke(),t.restore()}if(_){t.save(),t.beginPath();const e=i._fixTextRendering?-Math.round(a/4):0;t.moveTo(x,y+b+e),w=0===(S=k.split(" ").length-1),C=c===Le&&T&&!w?g-2*r:A,t.lineTo(x+Math.round(C),y+b+e),t.lineWidth=a/15;const n=this._getLinearGradient();t.strokeStyle=n||f,t.stroke(),t.restore()}if("rtl"===l||0===u&&c!==Le)0!==u&&t.setAttr("letterSpacing",`${u}px`),this._partialTextX=x,this._partialTextY=y+b,this._partialText=k,t.fillStrokeShape(this);else{S=k.split(" ").length-1;const e=Re(k);for(let i=0;i<e.length;i++){const n=e[i];" "!==n||T||c!==Le||(x+=(g-2*r-A)/S),this._partialTextX=x,this._partialTextY=y+b,this._partialText=n,t.fillStrokeShape(this),x+=this.measureSize(n).width+u}}t.restore(),n>1&&(y+=o)}}_hitFunc(t){const e=this.getWidth(),i=this.getHeight();t.beginPath(),t.rect(0,0,e,i),t.closePath(),t.fillStrokeShape(this)}setText(t){const e=g._isString(t)?t:null==t?"":t+"";return this._setAttr("text",e),this}getWidth(){return this.attrs.width===Ee||void 0===this.attrs.width?this.getTextWidth()+2*this.padding():this.attrs.width}getHeight(){return this.attrs.height===Ee||void 0===this.attrs.height?this.fontSize()*this.textArr.length*this.lineHeight()+2*this.padding():this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return g.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var e,i,n,s,r,a,o,h,l,d,c;let g,u=Ye(),f=this.fontSize();u.save(),u.font=this._getContextFont(),g=u.measureText(t),u.restore();const p=f/100;return{actualBoundingBoxAscent:null!==(e=g.actualBoundingBoxAscent)&&void 0!==e?e:71.58203125*p,actualBoundingBoxDescent:null!==(i=g.actualBoundingBoxDescent)&&void 0!==i?i:0,actualBoundingBoxLeft:null!==(n=g.actualBoundingBoxLeft)&&void 0!==n?n:-7.421875*p,actualBoundingBoxRight:null!==(s=g.actualBoundingBoxRight)&&void 0!==s?s:75.732421875*p,alphabeticBaseline:null!==(r=g.alphabeticBaseline)&&void 0!==r?r:0,emHeightAscent:null!==(a=g.emHeightAscent)&&void 0!==a?a:100*p,emHeightDescent:null!==(o=g.emHeightDescent)&&void 0!==o?o:-20*p,fontBoundingBoxAscent:null!==(h=g.fontBoundingBoxAscent)&&void 0!==h?h:91*p,fontBoundingBoxDescent:null!==(l=g.fontBoundingBoxDescent)&&void 0!==l?l:21*p,hangingBaseline:null!==(d=g.hangingBaseline)&&void 0!==d?d:72.80000305175781*p,ideographicBaseline:null!==(c=g.ideographicBaseline)&&void 0!==c?c:-21*p,width:g.width,height:f}}_getContextFont(){return this.fontStyle()+Be+this.fontVariant()+Be+(this.fontSize()+"px ")+this.fontFamily().split(",").map((t=>{const e=(t=t.trim()).indexOf(" ")>=0,i=t.indexOf('"')>=0||t.indexOf("'")>=0;return e&&!i&&(t=`"${t}"`),t})).join(", ")}_addTextLine(t){this.align()===Le&&(t=t.trim());const e=this._getTextWidth(t);return this.textArr.push({text:t,width:e,lastInParagraph:!1})}_getTextWidth(t){const e=this.letterSpacing(),i=t.length;return Ye().measureText(t).width+(i?e*(i-1):0)}_setTextData(){let t=this.text().split("\n"),e=+this.fontSize(),i=0,n=this.lineHeight()*e,s=this.attrs.width,r=this.attrs.height,a=s!==Ee&&void 0!==s,o=r!==Ee&&void 0!==r,h=this.padding(),l=s-2*h,d=r-2*h,c=0,g=this.wrap(),u="char"!==g&&g!==Ne,f=this.ellipsis();this.textArr=[],Ye().font=this._getContextFont();const p=f?this._getTextWidth("…"):0;for(let e=0,s=t.length;e<s;++e){let r=t[e],h=this._getTextWidth(r);if(a&&h>l)for(;r.length>0;){let t=0,e=r.length,s="",a=0;for(;t<e;){const i=t+e>>>1,n=r.slice(0,i+1),o=this._getTextWidth(n)+p;o<=l?(t=i+1,s=n,a=o):e=i}if(!s)break;if(u){var m;const e=r[s.length];(m=(e===Be||"-"===e)&&a<=l?s.length:Math.max(s.lastIndexOf(Be),s.lastIndexOf("-"))+1)>0&&(t=m,s=s.slice(0,t),a=this._getTextWidth(s))}s=s.trimRight(),this._addTextLine(s),i=Math.max(i,a),c+=n;if(this._shouldHandleEllipsis(c)){this._tryToAddEllipsisToLastLine();break}if(r=r.slice(t),r=r.trimLeft(),r.length>0&&(h=this._getTextWidth(r),h<=l)){this._addTextLine(r),c+=n,i=Math.max(i,h);break}}else this._addTextLine(r),c+=n,i=Math.max(i,h),this._shouldHandleEllipsis(c)&&e<s-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),o&&c+n>d)break}this.textHeight=e,this.textWidth=i}_shouldHandleEllipsis(t){const e=+this.fontSize(),i=this.lineHeight()*e,n=this.attrs.height,s=n!==Ee&&void 0!==n,r=n-2*this.padding();return!(this.wrap()!==Ne)||s&&t+i>r}_tryToAddEllipsisToLastLine(){const t=this.attrs.width,e=t!==Ee&&void 0!==t,i=t-2*this.padding(),n=this.ellipsis(),s=this.textArr[this.textArr.length-1];if(s&&n){if(e){this._getTextWidth(s.text+"…")<i||(s.text=s.text.slice(0,s.text.length-3))}this.textArr.splice(this.textArr.length-1,1),this._addTextLine(s.text+"…")}}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const t=-1!==this.textDecoration().indexOf("underline")||-1!==this.textDecoration().indexOf("line-through"),e=this.hasShadow();return!(!t||!e)||super._useBufferCanvas()}}Xe.prototype._fillFunc=function(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)},Xe.prototype._strokeFunc=function(t){t.setAttr("miterLimit",2),t.strokeText(this._partialText,this._partialTextX,this._partialTextY)},Xe.prototype.className="Text",Xe.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],n(Xe),w.overWriteSetter(Xe,"width",_()),w.overWriteSetter(Xe,"height",_()),w.addGetterSetter(Xe,"direction",De),w.addGetterSetter(Xe,"fontFamily","Arial"),w.addGetterSetter(Xe,"fontSize",12,p()),w.addGetterSetter(Xe,"fontStyle",Fe),w.addGetterSetter(Xe,"fontVariant",Fe),w.addGetterSetter(Xe,"padding",0,p()),w.addGetterSetter(Xe,"align",Ie),w.addGetterSetter(Xe,"verticalAlign","top"),w.addGetterSetter(Xe,"lineHeight",1,p()),w.addGetterSetter(Xe,"wrap","word"),w.addGetterSetter(Xe,"ellipsis",!1,x()),w.addGetterSetter(Xe,"letterSpacing",0,p()),w.addGetterSetter(Xe,"text","",y()),w.addGetterSetter(Xe,"textDecoration","");const je="normal";function qe(t){t.fillText(this.partialText,0,0)}function Ue(t){t.strokeText(this.partialText,0,0)}class Ve extends Nt{constructor(t){super(t),this.dummyCanvas=g.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",(function(){this._readDataAttribute(),this._setTextData()})),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return ge.getPathLength(this.dataArray)}_getPointAtLength(t){if(!this.attrs.data)return null;return t-1>this.pathLength?null:ge.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=ge.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();const e=this.textDecoration(),i=this.fill(),n=this.fontSize(),s=this.glyphInfo;"underline"===e&&t.beginPath();for(let i=0;i<s.length;i++){t.save();const r=s[i].p0;t.translate(r.x,r.y),t.rotate(s[i].rotation),this.partialText=s[i].text,t.fillStrokeShape(this),"underline"===e&&(0===i&&t.moveTo(0,n/2+1),t.lineTo(n,n/2+1)),t.restore()}"underline"===e&&(t.strokeStyle=i,t.lineWidth=n/20,t.stroke()),t.restore()}_hitFunc(t){t.beginPath();const e=this.glyphInfo;if(e.length>=1){const i=e[0].p0;t.moveTo(i.x,i.y)}for(let i=0;i<e.length;i++){const n=e[i].p1;t.lineTo(n.x,n.y)}t.setAttr("lineWidth",this.fontSize()),t.setAttr("strokeStyle",this.colorKey),t.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return g.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(t){return Xe.prototype.setText.call(this,t)}_getContextFont(){return Xe.prototype._getContextFont.call(this)}_getTextSize(t){const e=this.dummyCanvas.getContext("2d");e.save(),e.font=this._getContextFont();const i=e.measureText(t);return e.restore(),{width:i.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const{width:t,height:e}=this._getTextSize(this.attrs.text);if(this.textWidth=t,this.textHeight=e,this.glyphInfo=[],!this.attrs.data)return null;const i=this.letterSpacing(),n=this.align(),s=this.kerningFunc(),r=Math.max(this.textWidth+((this.attrs.text||"").length-1)*i,0);let a=0;"center"===n&&(a=Math.max(0,this.pathLength/2-r/2)),"right"===n&&(a=Math.max(0,this.pathLength-r));const o=Re(this.text());let h=a;for(let t=0;t<o.length;t++){const e=this._getPointAtLength(h);if(!e)return;let a=this._getTextSize(o[t]).width+i;if(" "===o[t]&&"justify"===n){const t=this.text().split(" ").length-1;a+=(this.pathLength-r)/t}const l=this._getPointAtLength(h+a);if(!l)return;const d=ge.getLineLength(e.x,e.y,l.x,l.y);let c=0;if(s)try{c=s(o[t-1],o[t])*this.fontSize()}catch(t){c=0}e.x+=c,l.x+=c,this.textWidth+=c;const g=ge.getPointOnLine(c+d/2,e.x,e.y,l.x,l.y),u=Math.atan2(l.y-e.y,l.x-e.x);this.glyphInfo.push({transposeX:g.x,transposeY:g.y,text:o[t],rotation:u,p0:e,p1:l}),h+=a}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};const t=[];this.glyphInfo.forEach((function(e){t.push(e.p0.x),t.push(e.p0.y),t.push(e.p1.x),t.push(e.p1.y)}));let e,i,n=t[0]||0,s=t[0]||0,r=t[1]||0,a=t[1]||0;for(let o=0;o<t.length/2;o++)e=t[2*o],i=t[2*o+1],n=Math.min(n,e),s=Math.max(s,e),r=Math.min(r,i),a=Math.max(a,i);const o=this.fontSize();return{x:n-o/2,y:r-o/2,width:s-n+o,height:a-r+o}}destroy(){return g.releaseCanvas(this.dummyCanvas),super.destroy()}}Ve.prototype._fillFunc=qe,Ve.prototype._strokeFunc=Ue,Ve.prototype._fillFuncHit=qe,Ve.prototype._strokeFuncHit=Ue,Ve.prototype.className="TextPath",Ve.prototype._attrsAffectingSize=["text","fontSize","data"],n(Ve),w.addGetterSetter(Ve,"data"),w.addGetterSetter(Ve,"fontFamily","Arial"),w.addGetterSetter(Ve,"fontSize",12,p()),w.addGetterSetter(Ve,"fontStyle",je),w.addGetterSetter(Ve,"align","left"),w.addGetterSetter(Ve,"letterSpacing",0,p()),w.addGetterSetter(Ve,"textBaseline","middle"),w.addGetterSetter(Ve,"fontVariant",je),w.addGetterSetter(Ve,"text",""),w.addGetterSetter(Ve,"textDecoration",null),w.addGetterSetter(Ve,"kerningFunc",null);const Ke="tr-konva",Qe=["resizeEnabledChange","rotateAnchorOffsetChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map((t=>t+`.${Ke}`)).join(" "),Je="nodesRect",$e=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],Ze={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},ti="ontouchstart"in i._global;const ei=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function ii(t,e,i){const n=i.x+(t.x-i.x)*Math.cos(e)-(t.y-i.y)*Math.sin(e),s=i.y+(t.x-i.x)*Math.sin(e)+(t.y-i.y)*Math.cos(e);return{...t,rotation:t.rotation+e,x:n,y:s}}function ni(t,e){const i=function(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}(t);return ii(t,e,i)}let si=0;class ri extends Xt{constructor(t){super(t),this._movingAnchorName=null,this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(Qe,this.update),this.getNode()&&this.update()}attachTo(t){return this.setNode(t),this}setNode(t){return g.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([t])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return Ke+this._id}setNodes(t=[]){this._nodes&&this._nodes.length&&this.detach();const e=t.filter((t=>!t.isAncestorOf(this)||(g.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1)));this._nodes=t=e,1===t.length&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach((t=>{const e=()=>{1===this.nodes().length&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),this._transforming||this.isDragging()||this.update()},i=t._attrsAffectingSize.map((t=>t+"Change."+this._getEventNamespace())).join(" ");t.on(i,e),t.on($e.map((t=>t+`.${this._getEventNamespace()}`)).join(" "),e),t.on(`absoluteTransformChange.${this._getEventNamespace()}`,e),this._proxyDrag(t)})),this._resetTransformCache();return!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(t){let e;t.on(`dragstart.${this._getEventNamespace()}`,(i=>{e=t.getAbsolutePosition(),this.isDragging()||t===this.findOne(".back")||this.startDrag(i,!1)})),t.on(`dragmove.${this._getEventNamespace()}`,(i=>{if(!e)return;const n=t.getAbsolutePosition(),s=n.x-e.x,r=n.y-e.y;this.nodes().forEach((e=>{if(e===t)return;if(e.isDragging())return;const n=e.getAbsolutePosition();e.setAbsolutePosition({x:n.x+s,y:n.y+r}),e.startDrag(i)})),e=null}))}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach((t=>{t.off("."+this._getEventNamespace())})),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(Je),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(Je,this.__getNodeRect)}__getNodeShape(t,e=this.rotation(),n){const s=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),r=t.getAbsoluteScale(n),a=t.getAbsolutePosition(n),o=s.x*r.x-t.offsetX()*r.x,h=s.y*r.y-t.offsetY()*r.y,l=(i.getAngle(t.getAbsoluteRotation())+2*Math.PI)%(2*Math.PI);return ii({x:a.x+o*Math.cos(l)+h*Math.sin(-l),y:a.y+h*Math.cos(l)+o*Math.sin(l),width:s.width*r.x,height:s.height*r.y,rotation:l},-i.getAngle(e),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const t=[];this.nodes().map((e=>{const i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),n=[{x:i.x,y:i.y},{x:i.x+i.width,y:i.y},{x:i.x+i.width,y:i.y+i.height},{x:i.x,y:i.y+i.height}],s=e.getAbsoluteTransform();n.forEach((function(e){const i=s.point(e);t.push(i)}))}));const e=new s;e.rotate(-i.getAngle(this.rotation()));let n=1/0,r=1/0,a=-1/0,o=-1/0;t.forEach((function(t){const i=e.point(t);void 0===n&&(n=a=i.x,r=o=i.y),n=Math.min(n,i.x),r=Math.min(r,i.y),a=Math.max(a,i.x),o=Math.max(o,i.y)})),e.invert();const h=e.point({x:n,y:r});return{x:h.x,y:h.y,width:a-n,height:o-r,rotation:i.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),ei.forEach((t=>{this._createAnchor(t)})),this._createAnchor("rotater")}_createAnchor(t){const e=new Pe({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:ti?10:"auto"}),n=this;e.on("mousedown touchstart",(function(t){n._handleMouseDown(t)})),e.on("dragstart",(t=>{e.stopDrag(),t.cancelBubble=!0})),e.on("dragend",(t=>{t.cancelBubble=!0})),e.on("mouseenter",(()=>{const n=i.getAngle(this.rotation()),s=this.rotateAnchorCursor(),r=function(t,e,i){if("rotater"===t)return i;e+=g.degToRad(Ze[t]||0);const n=(g.radToDeg(e)%360+360)%360;return g._inRange(n,337.5,360)||g._inRange(n,0,22.5)?"ns-resize":g._inRange(n,22.5,67.5)?"nesw-resize":g._inRange(n,67.5,112.5)?"ew-resize":g._inRange(n,112.5,157.5)?"nwse-resize":g._inRange(n,157.5,202.5)?"ns-resize":g._inRange(n,202.5,247.5)?"nesw-resize":g._inRange(n,247.5,292.5)?"ew-resize":g._inRange(n,292.5,337.5)?"nwse-resize":(g.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}(t,n,s);e.getStage().content&&(e.getStage().content.style.cursor=r),this._cursorChange=!0})),e.on("mouseout",(()=>{e.getStage().content&&(e.getStage().content.style.cursor=""),this._cursorChange=!1})),this.add(e)}_createBack(){const t=new Nt({name:"back",width:0,height:0,draggable:!0,sceneFunc(t,e){const i=e.getParent(),n=i.padding();t.beginPath(),t.rect(-n,-n,e.width()+2*n,e.height()+2*n),t.moveTo(e.width()/2,-n),i.rotateEnabled()&&i.rotateLineVisible()&&t.lineTo(e.width()/2,-i.rotateAnchorOffset()*g._sign(e.height())-n),t.fillStrokeShape(e)},hitFunc:(t,e)=>{if(!this.shouldOverdrawWholeArea())return;const i=this.padding();t.beginPath(),t.rect(-i,-i,e.width()+2*i,e.height()+2*i),t.fillStrokeShape(e)}});this.add(t),this._proxyDrag(t),t.on("dragstart",(t=>{t.cancelBubble=!0})),t.on("dragmove",(t=>{t.cancelBubble=!0})),t.on("dragend",(t=>{t.cancelBubble=!0})),this.on("dragmove",(t=>{this.update()}))}_handleMouseDown(t){if(this._transforming)return;this._movingAnchorName=t.target.name().split(" ")[0];const e=this._getNodeRect(),i=e.width,n=e.height,s=Math.sqrt(Math.pow(i,2)+Math.pow(n,2));this.sin=Math.abs(n/s),this.cos=Math.abs(i/s),"undefined"!=typeof window&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const r=t.target.getAbsolutePosition(),a=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:a.x-r.x,y:a.y-r.y},si++,this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach((e=>{e._fire("transformstart",{evt:t.evt,target:e})}))}_handleMouseMove(t){let e,n,s;const r=this.findOne("."+this._movingAnchorName),a=r.getStage();a.setPointersPositions(t);const o=a.getPointerPosition();let h={x:o.x-this._anchorDragOffset.x,y:o.y-this._anchorDragOffset.y};const l=r.getAbsolutePosition();this.anchorDragBoundFunc()&&(h=this.anchorDragBoundFunc()(l,h,t)),r.setAbsolutePosition(h);const d=r.getAbsolutePosition();if(l.x===d.x&&l.y===d.y)return;if("rotater"===this._movingAnchorName){const s=this._getNodeRect();e=r.x()-s.width/2,n=-r.y()+s.height/2;let a=Math.atan2(-n,e)+Math.PI/2;s.height<0&&(a-=Math.PI);const o=i.getAngle(this.rotation())+a,h=i.getAngle(this.rotationSnapTolerance()),l=function(t,e,n){let s=e;for(let r=0;r<t.length;r++){const a=i.getAngle(t[r]),o=Math.abs(a-e)%(2*Math.PI);Math.min(o,2*Math.PI-o)<n&&(s=a)}return s}(this.rotationSnaps(),o,h),d=ni(s,l-s.rotation);return void this._fitNodesInto(d,t)}const c=this.shiftBehavior();let g;g="inverted"===c?this.keepRatio()&&!t.shiftKey:"none"===c?this.keepRatio():this.keepRatio()||t.shiftKey;var u=this.centeredScaling()||t.altKey;if("top-left"===this._movingAnchorName){if(g){var f=u?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};s=Math.sqrt(Math.pow(f.x-r.x(),2)+Math.pow(f.y-r.y(),2));var p=this.findOne(".top-left").x()>f.x?-1:1,m=this.findOne(".top-left").y()>f.y?-1:1;e=s*this.cos*p,n=s*this.sin*m,this.findOne(".top-left").x(f.x-e),this.findOne(".top-left").y(f.y-n)}}else if("top-center"===this._movingAnchorName)this.findOne(".top-left").y(r.y());else if("top-right"===this._movingAnchorName){if(g){f=u?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};s=Math.sqrt(Math.pow(r.x()-f.x,2)+Math.pow(f.y-r.y(),2));p=this.findOne(".top-right").x()<f.x?-1:1,m=this.findOne(".top-right").y()>f.y?-1:1;e=s*this.cos*p,n=s*this.sin*m,this.findOne(".top-right").x(f.x+e),this.findOne(".top-right").y(f.y-n)}var _=r.position();this.findOne(".top-left").y(_.y),this.findOne(".bottom-right").x(_.x)}else if("middle-left"===this._movingAnchorName)this.findOne(".top-left").x(r.x());else if("middle-right"===this._movingAnchorName)this.findOne(".bottom-right").x(r.x());else if("bottom-left"===this._movingAnchorName){if(g){f=u?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};s=Math.sqrt(Math.pow(f.x-r.x(),2)+Math.pow(r.y()-f.y,2));p=f.x<r.x()?-1:1,m=r.y()<f.y?-1:1;e=s*this.cos*p,n=s*this.sin*m,r.x(f.x-e),r.y(f.y+n)}_=r.position(),this.findOne(".top-left").x(_.x),this.findOne(".bottom-right").y(_.y)}else if("bottom-center"===this._movingAnchorName)this.findOne(".bottom-right").y(r.y());else if("bottom-right"===this._movingAnchorName){if(g){f=u?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};s=Math.sqrt(Math.pow(r.x()-f.x,2)+Math.pow(r.y()-f.y,2));p=this.findOne(".bottom-right").x()<f.x?-1:1,m=this.findOne(".bottom-right").y()<f.y?-1:1;e=s*this.cos*p,n=s*this.sin*m,this.findOne(".bottom-right").x(f.x+e),this.findOne(".bottom-right").y(f.y+n)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(u=this.centeredScaling()||t.altKey){const t=this.findOne(".top-left"),e=this.findOne(".bottom-right"),i=t.x(),n=t.y(),s=this.getWidth()-e.x(),r=this.getHeight()-e.y();e.move({x:-i,y:-n}),t.move({x:s,y:r})}const y=this.findOne(".top-left").getAbsolutePosition();e=y.x,n=y.y;const v=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),x=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:e,y:n,width:v,height:x,rotation:i.getAngle(this.rotation())},t)}_handleMouseUp(t){this._removeEvents(t)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(t){var e;if(this._transforming){this._transforming=!1,"undefined"!=typeof window&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));const i=this.getNode();si--,this._fire("transformend",{evt:t,target:i}),null===(e=this.getLayer())||void 0===e||e.batchDraw(),i&&this._nodes.forEach((e=>{var i;e._fire("transformend",{evt:t,target:e}),null===(i=e.getLayer())||void 0===i||i.batchDraw()})),this._movingAnchorName=null}}_fitNodesInto(t,e){const n=this._getNodeRect();if(g._inRange(t.width,2*-this.padding()-1,1))return void this.update();if(g._inRange(t.height,2*-this.padding()-1,1))return void this.update();const r=new s;if(r.rotate(i.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const e=r.point({x:2*-this.padding(),y:0});t.x+=e.x,t.y+=e.y,t.width+=2*this.padding(),this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=e.x,this._anchorDragOffset.y-=e.y}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const e=r.point({x:2*this.padding(),y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=e.x,this._anchorDragOffset.y-=e.y,t.width+=2*this.padding()}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const e=r.point({x:0,y:2*-this.padding()});t.x+=e.x,t.y+=e.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=e.x,this._anchorDragOffset.y-=e.y,t.height+=2*this.padding()}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const e=r.point({x:0,y:2*this.padding()});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=e.x,this._anchorDragOffset.y-=e.y,t.height+=2*this.padding()}if(this.boundBoxFunc()){const e=this.boundBoxFunc()(n,t);e?t=e:g.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const a=1e7,o=new s;o.translate(n.x,n.y),o.rotate(n.rotation),o.scale(n.width/a,n.height/a);const h=new s,l=t.width/a,d=t.height/a;!1===this.flipEnabled()?(h.translate(t.x,t.y),h.rotate(t.rotation),h.translate(t.width<0?t.width:0,t.height<0?t.height:0),h.scale(Math.abs(l),Math.abs(d))):(h.translate(t.x,t.y),h.rotate(t.rotation),h.scale(l,d));const c=h.multiply(o.invert());this._nodes.forEach((t=>{var e;const i=t.getParent().getAbsoluteTransform(),n=t.getTransform().copy();n.translate(t.offsetX(),t.offsetY());const r=new s;r.multiply(i.copy().invert()).multiply(c).multiply(i).multiply(n);const a=r.decompose();t.setAttrs(a),null===(e=t.getLayer())||void 0===e||e.batchDraw()})),this.rotation(g._getRotation(t.rotation)),this._nodes.forEach((t=>{this._fire("transform",{evt:e,target:t}),t._fire("transform",{evt:e,target:t})})),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,e){this.findOne(t).setAttrs(e)}update(){var t;const e=this._getNodeRect();this.rotation(g._getRotation(e.rotation));const i=e.width,n=e.height,s=this.enabledAnchors(),r=this.resizeEnabled(),a=this.padding(),o=this.anchorSize(),h=this.find("._anchor");h.forEach((t=>{t.setAttrs({width:o,height:o,offsetX:o/2,offsetY:o/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})})),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:o/2+a,offsetY:o/2+a,visible:r&&s.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:i/2,y:0,offsetY:o/2+a,visible:r&&s.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:i,y:0,offsetX:o/2-a,offsetY:o/2+a,visible:r&&s.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:n/2,offsetX:o/2+a,visible:r&&s.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:i,y:n/2,offsetX:o/2-a,visible:r&&s.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:n,offsetX:o/2+a,offsetY:o/2-a,visible:r&&s.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:i/2,y:n,offsetY:o/2-a,visible:r&&s.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:i,y:n,offsetX:o/2-a,offsetY:o/2-a,visible:r&&s.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:i/2,y:-this.rotateAnchorOffset()*g._sign(n)-a,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:i,height:n,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const l=this.anchorStyleFunc();l&&h.forEach((t=>{l(t)})),null===(t=this.getLayer())||void 0===t||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),Xt.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return V.prototype.toObject.call(this)}clone(t){return V.prototype.clone.call(this,t)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}ri.isTransforming=()=>si>0,ri.prototype.className="Transformer",n(ri),w.addGetterSetter(ri,"enabledAnchors",ei,(function(t){return t instanceof Array||g.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach((function(t){-1===ei.indexOf(t)&&g.warn("Unknown anchor name: "+t+". Available names are: "+ei.join(", "))})),t||[]})),w.addGetterSetter(ri,"flipEnabled",!0,x()),w.addGetterSetter(ri,"resizeEnabled",!0),w.addGetterSetter(ri,"anchorSize",10,p()),w.addGetterSetter(ri,"rotateEnabled",!0),w.addGetterSetter(ri,"rotateLineVisible",!0),w.addGetterSetter(ri,"rotationSnaps",[]),w.addGetterSetter(ri,"rotateAnchorOffset",50,p()),w.addGetterSetter(ri,"rotateAnchorCursor","crosshair"),w.addGetterSetter(ri,"rotationSnapTolerance",5,p()),w.addGetterSetter(ri,"borderEnabled",!0),w.addGetterSetter(ri,"anchorStroke","rgb(0, 161, 255)"),w.addGetterSetter(ri,"anchorStrokeWidth",1,p()),w.addGetterSetter(ri,"anchorFill","white"),w.addGetterSetter(ri,"anchorCornerRadius",0,p()),w.addGetterSetter(ri,"borderStroke","rgb(0, 161, 255)"),w.addGetterSetter(ri,"borderStrokeWidth",1,p()),w.addGetterSetter(ri,"borderDash"),w.addGetterSetter(ri,"keepRatio",!0),w.addGetterSetter(ri,"shiftBehavior","default"),w.addGetterSetter(ri,"centeredScaling",!1),w.addGetterSetter(ri,"ignoreStroke",!1),w.addGetterSetter(ri,"padding",0,p()),w.addGetterSetter(ri,"node"),w.addGetterSetter(ri,"nodes"),w.addGetterSetter(ri,"boundBoxFunc"),w.addGetterSetter(ri,"anchorDragBoundFunc"),w.addGetterSetter(ri,"anchorStyleFunc"),w.addGetterSetter(ri,"shouldOverdrawWholeArea",!1),w.addGetterSetter(ri,"useSingleNodeRotation",!0),w.backCompat(ri,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class ai extends Nt{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,i.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return 2*this.radius()}getHeight(){return 2*this.radius()}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}function oi(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}ai.prototype.className="Wedge",ai.prototype._centroid=!0,ai.prototype._attrsAffectingSize=["radius"],n(ai),w.addGetterSetter(ai,"radius",0,p()),w.addGetterSetter(ai,"angle",0,p()),w.addGetterSetter(ai,"clockwise",!1),w.backCompat(ai,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});const hi=[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],li=[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];w.addGetterSetter(V,"blurRadius",0,p(),w.afterSetFilter);w.addGetterSetter(V,"brightness",0,p(),w.afterSetFilter);w.addGetterSetter(V,"contrast",0,p(),w.afterSetFilter);function di(t,e,i,n,s){let r,a=i-e,o=s-n;return 0===a?n+o/2:0===o?n:(r=(t-e)/a,r=o*r+n,r)}w.addGetterSetter(V,"embossStrength",.5,p(),w.afterSetFilter),w.addGetterSetter(V,"embossWhiteLevel",.5,p(),w.afterSetFilter),w.addGetterSetter(V,"embossDirection","top-left",null,w.afterSetFilter),w.addGetterSetter(V,"embossBlend",!1,null,w.afterSetFilter);w.addGetterSetter(V,"enhance",0,p(),w.afterSetFilter);w.addGetterSetter(V,"hue",0,p(),w.afterSetFilter),w.addGetterSetter(V,"saturation",0,p(),w.afterSetFilter),w.addGetterSetter(V,"luminance",0,p(),w.afterSetFilter);w.addGetterSetter(V,"hue",0,p(),w.afterSetFilter),w.addGetterSetter(V,"saturation",0,p(),w.afterSetFilter),w.addGetterSetter(V,"value",0,p(),w.afterSetFilter);function ci(t,e,i){let n=4*(i*t.width+e);const s=[];return s.push(t.data[n++],t.data[n++],t.data[n++],t.data[n++]),s}function gi(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2))}w.addGetterSetter(V,"kaleidoscopePower",2,p(),w.afterSetFilter),w.addGetterSetter(V,"kaleidoscopeAngle",0,p(),w.afterSetFilter);w.addGetterSetter(V,"threshold",0,p(),w.afterSetFilter);w.addGetterSetter(V,"noise",.2,p(),w.afterSetFilter);w.addGetterSetter(V,"pixelSize",8,p(),w.afterSetFilter);w.addGetterSetter(V,"levels",.5,p(),w.afterSetFilter);w.addGetterSetter(V,"red",0,(function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)})),w.addGetterSetter(V,"green",0,(function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)})),w.addGetterSetter(V,"blue",0,f,w.afterSetFilter);w.addGetterSetter(V,"red",0,(function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)})),w.addGetterSetter(V,"green",0,(function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)})),w.addGetterSetter(V,"blue",0,f,w.afterSetFilter),w.addGetterSetter(V,"alpha",1,(function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t}));w.addGetterSetter(V,"threshold",.5,p(),w.afterSetFilter);return Zt.Util._assign(Zt,{Arc:te,Arrow:ue,Circle:fe,Ellipse:pe,Image:me,Label:we,Tag:Ce,Line:ne,Path:ge,Rect:Pe,RegularPolygon:ke,Ring:Te,Sprite:Me,Star:Ge,Text:Xe,TextPath:Ve,Transformer:ri,Wedge:ai,Filters:{Blur:function(t){const e=Math.round(this.blurRadius());e>0&&function(t,e){const i=t.data,n=t.width,s=t.height;let r,a,o,h,l,d,c,g,u,f,p,m,_,y,v,x,b,S,w,C,P,k,A,T,M=e+e+1,G=n-1,R=s-1,E=e+1,D=E*(E+1)/2,L=new oi,I=null,O=L,F=null,B=null,N=hi[e],H=li[e];for(o=1;o<M;o++)O=O.next=new oi,o===E&&(I=O);for(O.next=L,c=d=0,a=0;a<s;a++){for(x=b=S=w=g=u=f=p=0,m=E*(C=i[d]),_=E*(P=i[d+1]),y=E*(k=i[d+2]),v=E*(A=i[d+3]),g+=D*C,u+=D*P,f+=D*k,p+=D*A,O=L,o=0;o<E;o++)O.r=C,O.g=P,O.b=k,O.a=A,O=O.next;for(o=1;o<E;o++)h=d+((G<o?G:o)<<2),g+=(O.r=C=i[h])*(T=E-o),u+=(O.g=P=i[h+1])*T,f+=(O.b=k=i[h+2])*T,p+=(O.a=A=i[h+3])*T,x+=C,b+=P,S+=k,w+=A,O=O.next;for(F=L,B=I,r=0;r<n;r++)i[d+3]=A=p*N>>H,0!==A?(A=255/A,i[d]=(g*N>>H)*A,i[d+1]=(u*N>>H)*A,i[d+2]=(f*N>>H)*A):i[d]=i[d+1]=i[d+2]=0,g-=m,u-=_,f-=y,p-=v,m-=F.r,_-=F.g,y-=F.b,v-=F.a,h=c+((h=r+e+1)<G?h:G)<<2,x+=F.r=i[h],b+=F.g=i[h+1],S+=F.b=i[h+2],w+=F.a=i[h+3],g+=x,u+=b,f+=S,p+=w,F=F.next,m+=C=B.r,_+=P=B.g,y+=k=B.b,v+=A=B.a,x-=C,b-=P,S-=k,w-=A,B=B.next,d+=4;c+=n}for(r=0;r<n;r++){for(b=S=w=x=u=f=p=g=0,d=r<<2,m=E*(C=i[d]),_=E*(P=i[d+1]),y=E*(k=i[d+2]),v=E*(A=i[d+3]),g+=D*C,u+=D*P,f+=D*k,p+=D*A,O=L,o=0;o<E;o++)O.r=C,O.g=P,O.b=k,O.a=A,O=O.next;for(l=n,o=1;o<=e;o++)d=l+r<<2,g+=(O.r=C=i[d])*(T=E-o),u+=(O.g=P=i[d+1])*T,f+=(O.b=k=i[d+2])*T,p+=(O.a=A=i[d+3])*T,x+=C,b+=P,S+=k,w+=A,O=O.next,o<R&&(l+=n);for(d=r,F=L,B=I,a=0;a<s;a++)h=d<<2,i[h+3]=A=p*N>>H,A>0?(A=255/A,i[h]=(g*N>>H)*A,i[h+1]=(u*N>>H)*A,i[h+2]=(f*N>>H)*A):i[h]=i[h+1]=i[h+2]=0,g-=m,u-=_,f-=y,p-=v,m-=F.r,_-=F.g,y-=F.b,v-=F.a,h=r+((h=a+E)<R?h:R)*n<<2,g+=x+=F.r=i[h],u+=b+=F.g=i[h+1],f+=S+=F.b=i[h+2],p+=w+=F.a=i[h+3],F=F.next,m+=C=B.r,_+=P=B.g,y+=k=B.b,v+=A=B.a,x-=C,b-=P,S-=k,w-=A,B=B.next,d+=n}}(t,e)},Brighten:function(t){let e,i=255*this.brightness(),n=t.data,s=n.length;for(e=0;e<s;e+=4)n[e]+=i,n[e+1]+=i,n[e+2]+=i},Contrast:function(t){const e=Math.pow((this.contrast()+100)/100,2);let i,n=t.data,s=n.length,r=150,a=150,o=150;for(i=0;i<s;i+=4)r=n[i],a=n[i+1],o=n[i+2],r/=255,r-=.5,r*=e,r+=.5,r*=255,a/=255,a-=.5,a*=e,a+=.5,a*=255,o/=255,o-=.5,o*=e,o+=.5,o*=255,r=r<0?0:r>255?255:r,a=a<0?0:a>255?255:a,o=o<0?0:o>255?255:o,n[i]=r,n[i+1]=a,n[i+2]=o},Emboss:function(t){let e=10*this.embossStrength(),i=255*this.embossWhiteLevel(),n=this.embossDirection(),s=this.embossBlend(),r=0,a=0,o=t.data,h=t.width,l=t.height,d=4*h,c=l;switch(n){case"top-left":r=-1,a=-1;break;case"top":r=-1,a=0;break;case"top-right":r=-1,a=1;break;case"right":r=0,a=1;break;case"bottom-right":r=1,a=1;break;case"bottom":r=1,a=0;break;case"bottom-left":r=1,a=-1;break;case"left":r=0,a=-1;break;default:g.error("Unknown emboss direction: "+n)}do{const t=(c-1)*d;let n=r;c+n<1&&(n=0),c+n>l&&(n=0);const g=(c-1+n)*h*4;let u=h;do{const n=t+4*(u-1);let r=a;u+r<1&&(r=0),u+r>h&&(r=0);const l=g+4*(u-1+r),d=o[n]-o[l],c=o[n+1]-o[l+1],f=o[n+2]-o[l+2];let p=d;const m=p>0?p:-p;if((c>0?c:-c)>m&&(p=c),(f>0?f:-f)>m&&(p=f),p*=e,s){const t=o[n]+p,e=o[n+1]+p,i=o[n+2]+p;o[n]=t>255?255:t<0?0:t,o[n+1]=e>255?255:e<0?0:e,o[n+2]=i>255?255:i<0?0:i}else{let t=i-p;t<0?t=0:t>255&&(t=255),o[n]=o[n+1]=o[n+2]=t}}while(--u)}while(--c)},Enhance:function(t){let e,i,n,s,r=t.data,a=r.length,o=r[0],h=o,l=r[1],d=l,c=r[2],g=c;const u=this.enhance();if(0===u)return;for(s=0;s<a;s+=4)e=r[s+0],e<o?o=e:e>h&&(h=e),i=r[s+1],i<l?l=i:i>d&&(d=i),n=r[s+2],n<c?c=n:n>g&&(g=n);let f,p,m,_,y,v,x,b,S;for(h===o&&(h=255,o=0),d===l&&(d=255,l=0),g===c&&(g=255,c=0),u>0?(p=h+u*(255-h),m=o-u*(o-0),y=d+u*(255-d),v=l-u*(l-0),b=g+u*(255-g),S=c-u*(c-0)):(f=.5*(h+o),p=h+u*(h-f),m=o+u*(o-f),_=.5*(d+l),y=d+u*(d-_),v=l+u*(l-_),x=.5*(g+c),b=g+u*(g-x),S=c+u*(c-x)),s=0;s<a;s+=4)r[s+0]=di(r[s+0],o,h,m,p),r[s+1]=di(r[s+1],l,d,v,y),r[s+2]=di(r[s+2],c,g,S,b)},Grayscale:function(t){let e,i,n=t.data,s=n.length;for(e=0;e<s;e+=4)i=.34*n[e]+.5*n[e+1]+.16*n[e+2],n[e]=i,n[e+1]=i,n[e+2]=i},HSL:function(t){let e,i=t.data,n=i.length,s=Math.pow(2,this.saturation()),r=Math.abs(this.hue()+360)%360,a=127*this.luminance();const o=1*s*Math.cos(r*Math.PI/180),h=1*s*Math.sin(r*Math.PI/180),l=.299+.701*o+.167*h,d=.587-.587*o+.33*h,c=.114-.114*o-.497*h,g=.299-.299*o-.328*h,u=.587+.413*o+.035*h,f=.114-.114*o+.293*h,p=.299-.3*o+1.25*h,m=.587-.586*o-1.05*h,_=.114+.886*o-.2*h;let y,v,x,b;for(e=0;e<n;e+=4)y=i[e+0],v=i[e+1],x=i[e+2],b=i[e+3],i[e+0]=l*y+d*v+c*x+a,i[e+1]=g*y+u*v+f*x+a,i[e+2]=p*y+m*v+_*x+a,i[e+3]=b},HSV:function(t){const e=t.data,i=e.length,n=Math.pow(2,this.value()),s=Math.pow(2,this.saturation()),r=Math.abs(this.hue()+360)%360,a=n*s*Math.cos(r*Math.PI/180),o=n*s*Math.sin(r*Math.PI/180),h=.299*n+.701*a+.167*o,l=.587*n-.587*a+.33*o,d=.114*n-.114*a-.497*o,c=.299*n-.299*a-.328*o,g=.587*n+.413*a+.035*o,u=.114*n-.114*a+.293*o,f=.299*n-.3*a+1.25*o,p=.587*n-.586*a-1.05*o,m=.114*n+.886*a-.2*o;let _,y,v,x;for(let t=0;t<i;t+=4)_=e[t+0],y=e[t+1],v=e[t+2],x=e[t+3],e[t+0]=h*_+l*y+d*v,e[t+1]=c*_+g*y+u*v,e[t+2]=f*_+p*y+m*v,e[t+3]=x},Invert:function(t){let e,i=t.data,n=i.length;for(e=0;e<n;e+=4)i[e]=255-i[e],i[e+1]=255-i[e+1],i[e+2]=255-i[e+2]},Kaleidoscope:function(t){const e=t.width,i=t.height;let n,s,r,a,o,h,l,d,c,u,f=Math.round(this.kaleidoscopePower());const p=Math.round(this.kaleidoscopeAngle()),m=Math.floor(e*(p%360)/360);if(f<1)return;const _=g.createCanvasElement();_.width=e,_.height=i;const y=_.getContext("2d").getImageData(0,0,e,i);g.releaseCanvas(_),function(t,e,i){let n,s,r,a,o=t.data,h=e.data,l=t.width,d=t.height,c=i.polarCenterX||l/2,g=i.polarCenterY||d/2,u=0,f=0,p=0,m=0,_=Math.sqrt(c*c+g*g);s=l-c,r=d-g,a=Math.sqrt(s*s+r*r),_=a>_?a:_;let y,v,x,b,S=d,w=l,C=360/w*Math.PI/180;for(v=0;v<w;v+=1)for(x=Math.sin(v*C),b=Math.cos(v*C),y=0;y<S;y+=1)s=Math.floor(c+_*y/S*b),r=Math.floor(g+_*y/S*x),n=4*(r*l+s),u=o[n+0],f=o[n+1],p=o[n+2],m=o[n+3],n=4*(v+y*l),h[n+0]=u,h[n+1]=f,h[n+2]=p,h[n+3]=m}(t,y,{polarCenterX:e/2,polarCenterY:i/2});let v=e/Math.pow(2,f);for(;v<=8;)v*=2,f-=1;v=Math.ceil(v);let x=v,b=0,S=x,w=1;for(m+v>e&&(b=x,S=0,w=-1),s=0;s<i;s+=1)for(n=b;n!==S;n+=w)r=Math.round(n+m)%e,c=4*(e*s+r),o=y.data[c+0],h=y.data[c+1],l=y.data[c+2],d=y.data[c+3],u=4*(e*s+n),y.data[u+0]=o,y.data[u+1]=h,y.data[u+2]=l,y.data[u+3]=d;for(s=0;s<i;s+=1)for(x=Math.floor(v),a=0;a<f;a+=1){for(n=0;n<x+1;n+=1)c=4*(e*s+n),o=y.data[c+0],h=y.data[c+1],l=y.data[c+2],d=y.data[c+3],u=4*(e*s+2*x-n-1),y.data[u+0]=o,y.data[u+1]=h,y.data[u+2]=l,y.data[u+3]=d;x*=2}!function(t,e,i){let n,s,r,a,o,h,l=t.data,d=e.data,c=t.width,g=t.height,u=i.polarCenterX||c/2,f=i.polarCenterY||g/2,p=0,m=0,_=0,y=0,v=Math.sqrt(u*u+f*f);s=c-u,r=g-f,h=Math.sqrt(s*s+r*r),v=h>v?h:v;let x,b,S,w,C=g,P=c;for(s=0;s<c;s+=1)for(r=0;r<g;r+=1)a=s-u,o=r-f,x=Math.sqrt(a*a+o*o)*C/v,b=(180*Math.atan2(o,a)/Math.PI+360+0)%360,b=b*P/360,S=Math.floor(b),w=Math.floor(x),n=4*(w*c+S),p=l[n+0],m=l[n+1],_=l[n+2],y=l[n+3],n=4*(r*c+s),d[n+0]=p,d[n+1]=m,d[n+2]=_,d[n+3]=y}(y,t,{polarRotation:0})},Mask:function(t){let e=function(t,e){const i=ci(t,0,0),n=ci(t,t.width-1,0),s=ci(t,0,t.height-1),r=ci(t,t.width-1,t.height-1),a=e||10;if(gi(i,n)<a&&gi(n,r)<a&&gi(r,s)<a&&gi(s,i)<a){const e=function(t){const e=[0,0,0];for(let i=0;i<t.length;i++)e[0]+=t[i][0],e[1]+=t[i][1],e[2]+=t[i][2];return e[0]/=t.length,e[1]/=t.length,e[2]/=t.length,e}([n,i,r,s]),o=[];for(let i=0;i<t.width*t.height;i++){const n=gi(e,[t.data[4*i],t.data[4*i+1],t.data[4*i+2]]);o[i]=n<a?0:255}return o}}(t,this.threshold());return e&&(e=function(t,e,i){const n=[1,1,1,1,0,1,1,1,1],s=Math.round(Math.sqrt(n.length)),r=Math.floor(s/2),a=[];for(let o=0;o<i;o++)for(let h=0;h<e;h++){const l=o*e+h;let d=0;for(let a=0;a<s;a++)for(let l=0;l<s;l++){const c=o+a-r,g=h+l-r;if(c>=0&&c<i&&g>=0&&g<e){const i=n[a*s+l];d+=t[c*e+g]*i}}a[l]=2040===d?255:0}return a}(e,t.width,t.height),e=function(t,e,i){const n=[1,1,1,1,1,1,1,1,1],s=Math.round(Math.sqrt(n.length)),r=Math.floor(s/2),a=[];for(let o=0;o<i;o++)for(let h=0;h<e;h++){const l=o*e+h;let d=0;for(let a=0;a<s;a++)for(let l=0;l<s;l++){const c=o+a-r,g=h+l-r;if(c>=0&&c<i&&g>=0&&g<e){const i=n[a*s+l];d+=t[c*e+g]*i}}a[l]=d>=1020?255:0}return a}(e,t.width,t.height),e=function(t,e,i){const n=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],s=Math.round(Math.sqrt(n.length)),r=Math.floor(s/2),a=[];for(let o=0;o<i;o++)for(let h=0;h<e;h++){const l=o*e+h;let d=0;for(let a=0;a<s;a++)for(let l=0;l<s;l++){const c=o+a-r,g=h+l-r;if(c>=0&&c<i&&g>=0&&g<e){const i=n[a*s+l];d+=t[c*e+g]*i}}a[l]=d}return a}(e,t.width,t.height),function(t,e){for(let i=0;i<t.width*t.height;i++)t.data[4*i+3]=e[i]}(t,e)),t},Noise:function(t){const e=255*this.noise(),i=t.data,n=i.length,s=e/2;for(let t=0;t<n;t+=4)i[t+0]+=s-2*s*Math.random(),i[t+1]+=s-2*s*Math.random(),i[t+2]+=s-2*s*Math.random()},Pixelate:function(t){let e,i,n,s,r,a,o,h,l,d,c,u,f,p,m=Math.ceil(this.pixelSize()),_=t.width,y=t.height,v=Math.ceil(_/m),x=Math.ceil(y/m),b=t.data;if(m<=0)g.error("pixelSize value can not be <= 0");else for(u=0;u<v;u+=1)for(f=0;f<x;f+=1){for(s=0,r=0,a=0,o=0,h=u*m,l=h+m,d=f*m,c=d+m,p=0,e=h;e<l;e+=1)if(!(e>=_))for(i=d;i<c;i+=1)i>=y||(n=4*(_*i+e),s+=b[n+0],r+=b[n+1],a+=b[n+2],o+=b[n+3],p+=1);for(s/=p,r/=p,a/=p,o/=p,e=h;e<l;e+=1)if(!(e>=_))for(i=d;i<c;i+=1)i>=y||(n=4*(_*i+e),b[n+0]=s,b[n+1]=r,b[n+2]=a,b[n+3]=o)}},Posterize:function(t){let e,i=Math.round(254*this.levels())+1,n=t.data,s=n.length,r=255/i;for(e=0;e<s;e+=1)n[e]=Math.floor(n[e]/r)*r},RGB:function(t){let e,i,n=t.data,s=n.length,r=this.red(),a=this.green(),o=this.blue();for(e=0;e<s;e+=4)i=(.34*n[e]+.5*n[e+1]+.16*n[e+2])/255,n[e]=i*r,n[e+1]=i*a,n[e+2]=i*o,n[e+3]=n[e+3]},RGBA:function(t){const e=t.data,i=e.length,n=this.red(),s=this.green(),r=this.blue(),a=this.alpha();for(let t=0;t<i;t+=4){const i=1-a;e[t]=n*a+e[t]*i,e[t+1]=s*a+e[t+1]*i,e[t+2]=r*a+e[t+2]*i}},Sepia:function(t){let e,i,n,s,r=t.data,a=r.length;for(e=0;e<a;e+=4)i=r[e+0],n=r[e+1],s=r[e+2],r[e+0]=Math.min(255,.393*i+.769*n+.189*s),r[e+1]=Math.min(255,.349*i+.686*n+.168*s),r[e+2]=Math.min(255,.272*i+.534*n+.131*s)},Solarize:function(t){const e=t.data,i=t.width,n=4*i;let s=t.height;do{const t=(s-1)*n;let r=i;do{const i=t+4*(r-1);let n=e[i],s=e[i+1],a=e[i+2];n>127&&(n=255-n),s>127&&(s=255-s),a>127&&(a=255-a),e[i]=n,e[i+1]=s,e[i+2]=a}while(--r)}while(--s)},Threshold:function(t){const e=255*this.threshold(),i=t.data,n=i.length;for(let t=0;t<n;t+=1)i[t]=i[t]<e?0:255}}})}));
  • imaps-frontend/node_modules/konva/lib/Animation.js

    rd565449 r0c6b92a  
    117117            }
    118118        }
    119         for (let key in layerHash) {
     119        for (const key in layerHash) {
    120120            if (!layerHash.hasOwnProperty(key)) {
    121121                continue;
  • imaps-frontend/node_modules/konva/lib/BezierFunctions.js

    rd565449 r0c6b92a  
    688688exports.binomialCoefficients = [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1]];
    689689const getCubicArcLength = (xs, ys, t) => {
    690     let z;
    691690    let sum;
    692691    let correctedT;
    693692    const n = 20;
    694     z = t / 2;
     693    const z = t / 2;
    695694    sum = 0;
    696695    for (let i = 0; i < n; i++) {
  • imaps-frontend/node_modules/konva/lib/Canvas.js

    rd565449 r0c6b92a  
    77const Factory_1 = require("./Factory");
    88const Validators_1 = require("./Validators");
    9 var _pixelRatio;
     9let _pixelRatio;
    1010function getDevicePixelRatio() {
    1111    if (_pixelRatio) {
    1212        return _pixelRatio;
    1313    }
    14     var canvas = Util_1.Util.createCanvasElement();
    15     var context = canvas.getContext('2d');
     14    const canvas = Util_1.Util.createCanvasElement();
     15    const context = canvas.getContext('2d');
    1616    _pixelRatio = (function () {
    17         var devicePixelRatio = Global_1.Konva._global.devicePixelRatio || 1, backingStoreRatio = context.webkitBackingStorePixelRatio ||
     17        const devicePixelRatio = Global_1.Konva._global.devicePixelRatio || 1, backingStoreRatio = context.webkitBackingStorePixelRatio ||
    1818            context.mozBackingStorePixelRatio ||
    1919            context.msBackingStorePixelRatio ||
     
    3232        this.height = 0;
    3333        this.isCache = false;
    34         var conf = config || {};
    35         var pixelRatio = conf.pixelRatio || Global_1.Konva.pixelRatio || getDevicePixelRatio();
     34        const conf = config || {};
     35        const pixelRatio = conf.pixelRatio || Global_1.Konva.pixelRatio || getDevicePixelRatio();
    3636        this.pixelRatio = pixelRatio;
    3737        this._canvas = Util_1.Util.createCanvasElement();
     
    5151    }
    5252    setPixelRatio(pixelRatio) {
    53         var previousRatio = this.pixelRatio;
     53        const previousRatio = this.pixelRatio;
    5454        this.pixelRatio = pixelRatio;
    5555        this.setSize(this.getWidth() / previousRatio, this.getHeight() / previousRatio);
     
    5858        this.width = this._canvas.width = width * this.pixelRatio;
    5959        this._canvas.style.width = width + 'px';
    60         var pixelRatio = this.pixelRatio, _context = this.getContext()._context;
     60        const pixelRatio = this.pixelRatio, _context = this.getContext()._context;
    6161        _context.scale(pixelRatio, pixelRatio);
    6262    }
     
    6464        this.height = this._canvas.height = height * this.pixelRatio;
    6565        this._canvas.style.height = height + 'px';
    66         var pixelRatio = this.pixelRatio, _context = this.getContext()._context;
     66        const pixelRatio = this.pixelRatio, _context = this.getContext()._context;
    6767        _context.scale(pixelRatio, pixelRatio);
    6868    }
  • imaps-frontend/node_modules/konva/lib/Container.d.ts

    rd565449 r0c6b92a  
    2929        attrs: any;
    3030        className: string;
    31         children?: any[] | undefined;
     31        children?: Array<any>;
    3232    };
    3333    isAncestorOf(node: Node): boolean;
  • imaps-frontend/node_modules/konva/lib/Container.js

    rd565449 r0c6b92a  
    1515        }
    1616        const children = this.children || [];
    17         var results = [];
     17        const results = [];
    1818        children.forEach(function (child) {
    1919            if (filterFunc(child)) {
     
    5151        }
    5252        if (children.length > 1) {
    53             for (var i = 0; i < children.length; i++) {
     53            for (let i = 0; i < children.length; i++) {
    5454                this.add(children[i]);
    5555            }
     
    8383    }
    8484    findOne(selector) {
    85         var result = this._generalFind(selector, true);
     85        const result = this._generalFind(selector, true);
    8686        return result.length > 0 ? result[0] : undefined;
    8787    }
    8888    _generalFind(selector, findOne) {
    89         var retArr = [];
     89        const retArr = [];
    9090        this._descendants((node) => {
    9191            const valid = node._isMatch(selector);
     
    119119    }
    120120    toObject() {
    121         var obj = Node_1.Node.prototype.toObject.call(this);
     121        const obj = Node_1.Node.prototype.toObject.call(this);
    122122        obj.children = [];
    123123        this.getChildren().forEach((child) => {
     
    127127    }
    128128    isAncestorOf(node) {
    129         var parent = node.getParent();
     129        let parent = node.getParent();
    130130        while (parent) {
    131131            if (parent._id === this._id) {
     
    137137    }
    138138    clone(obj) {
    139         var node = Node_1.Node.prototype.clone.call(this, obj);
     139        const node = Node_1.Node.prototype.clone.call(this, obj);
    140140        this.getChildren().forEach(function (no) {
    141141            node.add(no.clone());
     
    144144    }
    145145    getAllIntersections(pos) {
    146         var arr = [];
     146        const arr = [];
    147147        this.find('Shape').forEach((shape) => {
    148148            if (shape.isVisible() && shape.intersects(pos)) {
     
    170170    }
    171171    drawScene(can, top, bufferCanvas) {
    172         var layer = this.getLayer(), canvas = can || (layer && layer.getCanvas()), context = canvas && canvas.getContext(), cachedCanvas = this._getCanvasCache(), cachedSceneCanvas = cachedCanvas && cachedCanvas.scene;
    173         var caching = canvas && canvas.isCache;
     172        const layer = this.getLayer(), canvas = can || (layer && layer.getCanvas()), context = canvas && canvas.getContext(), cachedCanvas = this._getCanvasCache(), cachedSceneCanvas = cachedCanvas && cachedCanvas.scene;
     173        const caching = canvas && canvas.isCache;
    174174        if (!this.isVisible() && !caching) {
    175175            return this;
     
    177177        if (cachedSceneCanvas) {
    178178            context.save();
    179             var m = this.getAbsoluteTransform(top).getMatrix();
     179            const m = this.getAbsoluteTransform(top).getMatrix();
    180180            context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
    181181            this._drawCachedSceneCanvas(context);
     
    191191            return this;
    192192        }
    193         var layer = this.getLayer(), canvas = can || (layer && layer.hitCanvas), context = canvas && canvas.getContext(), cachedCanvas = this._getCanvasCache(), cachedHitCanvas = cachedCanvas && cachedCanvas.hit;
     193        const layer = this.getLayer(), canvas = can || (layer && layer.hitCanvas), context = canvas && canvas.getContext(), cachedCanvas = this._getCanvasCache(), cachedHitCanvas = cachedCanvas && cachedCanvas.hit;
    194194        if (cachedHitCanvas) {
    195195            context.save();
    196             var m = this.getAbsoluteTransform(top).getMatrix();
     196            const m = this.getAbsoluteTransform(top).getMatrix();
    197197            context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
    198198            this._drawCachedHitCanvas(context);
     
    206206    _drawChildren(drawMethod, canvas, top, bufferCanvas) {
    207207        var _a;
    208         var context = canvas && canvas.getContext(), clipWidth = this.clipWidth(), clipHeight = this.clipHeight(), clipFunc = this.clipFunc(), hasClip = (typeof clipWidth === 'number' && typeof clipHeight === 'number') ||
     208        const context = canvas && canvas.getContext(), clipWidth = this.clipWidth(), clipHeight = this.clipHeight(), clipFunc = this.clipFunc(), hasClip = (typeof clipWidth === 'number' && typeof clipHeight === 'number') ||
    209209            clipFunc;
    210210        const selfCache = top === this;
    211211        if (hasClip) {
    212212            context.save();
    213             var transform = this.getAbsoluteTransform(top);
    214             var m = transform.getMatrix();
     213            const transform = this.getAbsoluteTransform(top);
     214            let m = transform.getMatrix();
    215215            context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
    216216            context.beginPath();
     
    220220            }
    221221            else {
    222                 var clipX = this.clipX();
    223                 var clipY = this.clipY();
     222                const clipX = this.clipX();
     223                const clipY = this.clipY();
    224224                context.rect(clipX || 0, clipY || 0, clipWidth, clipHeight);
    225225            }
     
    228228            context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
    229229        }
    230         var hasComposition = !selfCache &&
     230        const hasComposition = !selfCache &&
    231231            this.globalCompositeOperation() !== 'source-over' &&
    232232            drawMethod === 'drawScene';
     
    247247    getClientRect(config = {}) {
    248248        var _a;
    249         var skipTransform = config.skipTransform;
    250         var relativeTo = config.relativeTo;
    251         var minX, minY, maxX, maxY;
    252         var selfRect = {
     249        const skipTransform = config.skipTransform;
     250        const relativeTo = config.relativeTo;
     251        let minX, minY, maxX, maxY;
     252        let selfRect = {
    253253            x: Infinity,
    254254            y: Infinity,
     
    256256            height: 0,
    257257        };
    258         var that = this;
     258        const that = this;
    259259        (_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {
    260260            if (!child.visible()) {
    261261                return;
    262262            }
    263             var rect = child.getClientRect({
     263            const rect = child.getClientRect({
    264264                relativeTo: that,
    265265                skipShadow: config.skipShadow,
     
    282282            }
    283283        });
    284         var shapes = this.find('Shape');
    285         var hasVisible = false;
    286         for (var i = 0; i < shapes.length; i++) {
    287             var shape = shapes[i];
     284        const shapes = this.find('Shape');
     285        let hasVisible = false;
     286        for (let i = 0; i < shapes.length; i++) {
     287            const shape = shapes[i];
    288288            if (shape._isVisible(this)) {
    289289                hasVisible = true;
  • imaps-frontend/node_modules/konva/lib/Context.d.ts

    rd565449 r0c6b92a  
    33import { IRect } from './types.js';
    44import type { Node } from './Node.js';
    5 declare var CONTEXT_PROPERTIES: readonly ["fillStyle", "strokeStyle", "shadowColor", "shadowBlur", "shadowOffsetX", "shadowOffsetY", "letterSpacing", "lineCap", "lineDashOffset", "lineJoin", "lineWidth", "miterLimit", "direction", "font", "textAlign", "textBaseline", "globalAlpha", "globalCompositeOperation", "imageSmoothingEnabled"];
     5declare const CONTEXT_PROPERTIES: readonly ["fillStyle", "strokeStyle", "shadowColor", "shadowBlur", "shadowOffsetX", "shadowOffsetY", "letterSpacing", "lineCap", "lineDashOffset", "lineJoin", "lineWidth", "miterLimit", "direction", "font", "textAlign", "textBaseline", "globalAlpha", "globalCompositeOperation", "imageSmoothingEnabled"];
    66interface ExtendedCanvasRenderingContext2D extends CanvasRenderingContext2D {
    77    letterSpacing: string;
     
    1010    canvas: Canvas;
    1111    _context: CanvasRenderingContext2D;
    12     traceArr: Array<String>;
     12    traceArr: Array<string>;
    1313    constructor(canvas: Canvas);
    1414    fillShape(shape: Shape): void;
  • imaps-frontend/node_modules/konva/lib/Context.js

    rd565449 r0c6b92a  
    55const Global_1 = require("./Global");
    66function simplifyArray(arr) {
    7     var retArr = [], len = arr.length, util = Util_1.Util, n, val;
     7    let retArr = [], len = arr.length, util = Util_1.Util, n, val;
    88    for (n = 0; n < len; n++) {
    99        val = arr[n];
     
    1818    return retArr;
    1919}
    20 var COMMA = ',', OPEN_PAREN = '(', CLOSE_PAREN = ')', OPEN_PAREN_BRACKET = '([', CLOSE_BRACKET_PAREN = '])', SEMICOLON = ';', DOUBLE_PAREN = '()', EQUALS = '=', CONTEXT_METHODS = [
     20const COMMA = ',', OPEN_PAREN = '(', CLOSE_PAREN = ')', OPEN_PAREN_BRACKET = '([', CLOSE_BRACKET_PAREN = '])', SEMICOLON = ';', DOUBLE_PAREN = '()', EQUALS = '=', CONTEXT_METHODS = [
    2121    'arc',
    2222    'arcTo',
     
    5252    'translate',
    5353];
    54 var CONTEXT_PROPERTIES = [
     54const CONTEXT_PROPERTIES = [
    5555    'fillStyle',
    5656    'strokeStyle',
     
    107107    }
    108108    getTrace(relaxed, rounded) {
    109         var traceArr = this.traceArr, len = traceArr.length, str = '', n, trace, method, args;
     109        let traceArr = this.traceArr, len = traceArr.length, str = '', n, trace, method, args;
    110110        for (n = 0; n < len; n++) {
    111111            trace = traceArr[n];
     
    143143    }
    144144    _trace(str) {
    145         var traceArr = this.traceArr, len;
     145        let traceArr = this.traceArr, len;
    146146        traceArr.push(str);
    147147        len = traceArr.length;
     
    151151    }
    152152    reset() {
    153         var pixelRatio = this.getCanvas().getPixelRatio();
     153        const pixelRatio = this.getCanvas().getPixelRatio();
    154154        this.setTransform(1 * pixelRatio, 0, 0, 1 * pixelRatio, 0, 0);
    155155    }
     
    158158    }
    159159    clear(bounds) {
    160         var canvas = this.getCanvas();
     160        const canvas = this.getCanvas();
    161161        if (bounds) {
    162162            this.clearRect(bounds.x || 0, bounds.y || 0, bounds.width || 0, bounds.height || 0);
     
    173173    }
    174174    _applyOpacity(shape) {
    175         var absOpacity = shape.getAbsoluteOpacity();
     175        const absOpacity = shape.getAbsoluteOpacity();
    176176        if (absOpacity !== 1) {
    177177            this.setAttr('globalAlpha', absOpacity);
     
    209209    }
    210210    createImageData(width, height) {
    211         var a = arguments;
     211        const a = arguments;
    212212        if (a.length === 2) {
    213213            return this._context.createImageData(width, height);
     
    227227    }
    228228    drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) {
    229         var a = arguments, _context = this._context;
     229        const a = arguments, _context = this._context;
    230230        if (a.length === 3) {
    231231            _context.drawImage(image, sx, sy);
     
    335335    }
    336336    _enableTrace() {
    337         var that = this, len = CONTEXT_METHODS.length, origSetter = this.setAttr, n, args;
    338         var func = function (methodName) {
    339             var origMethod = that[methodName], ret;
     337        let that = this, len = CONTEXT_METHODS.length, origSetter = this.setAttr, n, args;
     338        const func = function (methodName) {
     339            let origMethod = that[methodName], ret;
    340340            that[methodName] = function () {
    341341                args = simplifyArray(Array.prototype.slice.call(arguments, 0));
     
    353353        that.setAttr = function () {
    354354            origSetter.apply(that, arguments);
    355             var prop = arguments[0];
    356             var val = arguments[1];
     355            const prop = arguments[0];
     356            let val = arguments[1];
    357357            if (prop === 'shadowOffsetX' ||
    358358                prop === 'shadowOffsetY' ||
     
    368368    _applyGlobalCompositeOperation(node) {
    369369        const op = node.attrs.globalCompositeOperation;
    370         var def = !op || op === 'source-over';
     370        const def = !op || op === 'source-over';
    371371        if (!def) {
    372372            this.setAttr('globalCompositeOperation', op);
     
    393393    }
    394394    _fillColor(shape) {
    395         var fill = shape.fill();
     395        const fill = shape.fill();
    396396        this.setAttr('fillStyle', fill);
    397397        shape._fillFunc(this);
     
    402402    }
    403403    _fillLinearGradient(shape) {
    404         var grd = shape._getLinearGradient();
     404        const grd = shape._getLinearGradient();
    405405        if (grd) {
    406406            this.setAttr('fillStyle', grd);
     
    452452        const start = shape.getStrokeLinearGradientStartPoint(), end = shape.getStrokeLinearGradientEndPoint(), colorStops = shape.getStrokeLinearGradientColorStops(), grd = this.createLinearGradient(start.x, start.y, end.x, end.y);
    453453        if (colorStops) {
    454             for (var n = 0; n < colorStops.length; n += 2) {
     454            for (let n = 0; n < colorStops.length; n += 2) {
    455455                grd.addColorStop(colorStops[n], colorStops[n + 1]);
    456456            }
     
    459459    }
    460460    _stroke(shape) {
    461         var dash = shape.dash(), strokeScaleEnabled = shape.getStrokeScaleEnabled();
     461        const dash = shape.dash(), strokeScaleEnabled = shape.getStrokeScaleEnabled();
    462462        if (shape.hasStroke()) {
    463463            if (!strokeScaleEnabled) {
    464464                this.save();
    465                 var pixelRatio = this.getCanvas().getPixelRatio();
     465                const pixelRatio = this.getCanvas().getPixelRatio();
    466466                this.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
    467467            }
     
    475475                this.setAttr('shadowColor', 'rgba(0,0,0,0)');
    476476            }
    477             var hasLinearGradient = shape.getStrokeLinearGradientColorStops();
     477            const hasLinearGradient = shape.getStrokeLinearGradientColorStops();
    478478            if (hasLinearGradient) {
    479479                this._strokeLinearGradient(shape);
     
    490490    _applyShadow(shape) {
    491491        var _a, _b, _c;
    492         var color = (_a = shape.getShadowRGBA()) !== null && _a !== void 0 ? _a : 'black', blur = (_b = shape.getShadowBlur()) !== null && _b !== void 0 ? _b : 5, offset = (_c = shape.getShadowOffset()) !== null && _c !== void 0 ? _c : {
     492        const color = (_a = shape.getShadowRGBA()) !== null && _a !== void 0 ? _a : 'black', blur = (_b = shape.getShadowBlur()) !== null && _b !== void 0 ? _b : 5, offset = (_c = shape.getShadowOffset()) !== null && _c !== void 0 ? _c : {
    493493            x: 0,
    494494            y: 0,
     
    524524            if (!strokeScaleEnabled) {
    525525                this.save();
    526                 var pixelRatio = this.getCanvas().getPixelRatio();
     526                const pixelRatio = this.getCanvas().getPixelRatio();
    527527                this.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
    528528            }
    529529            this._applyLineCap(shape);
    530             var hitStrokeWidth = shape.hitStrokeWidth();
    531             var strokeWidth = hitStrokeWidth === 'auto' ? shape.strokeWidth() : hitStrokeWidth;
     530            const hitStrokeWidth = shape.hitStrokeWidth();
     531            const strokeWidth = hitStrokeWidth === 'auto' ? shape.strokeWidth() : hitStrokeWidth;
    532532            this.setAttr('lineWidth', strokeWidth);
    533533            this.setAttr('strokeStyle', shape.colorKey);
  • imaps-frontend/node_modules/konva/lib/DragAndDrop.d.ts

    rd565449 r0c6b92a  
    99        startPointerPos: Vector2d;
    1010        offset: Vector2d;
    11         pointerId?: number | undefined;
    12         dragStatus: 'ready' | 'dragging' | 'stopped';
     11        pointerId?: number;
     12        dragStatus: "ready" | "dragging" | "stopped";
    1313    }>;
    1414    _drag(evt: any): void;
  • imaps-frontend/node_modules/konva/lib/DragAndDrop.js

    rd565449 r0c6b92a  
    66exports.DD = {
    77    get isDragging() {
    8         var flag = false;
     8        let flag = false;
    99        exports.DD._dragElements.forEach((elem) => {
    1010            if (elem.dragStatus === 'dragging') {
     
    1616    justDragged: false,
    1717    get node() {
    18         var node;
     18        let node;
    1919        exports.DD._dragElements.forEach((elem) => {
    2020            node = elem.node;
     
    3737            }
    3838            if (elem.dragStatus !== 'dragging') {
    39                 var dragDistance = node.dragDistance();
    40                 var distance = Math.max(Math.abs(pos.x - elem.startPointerPos.x), Math.abs(pos.y - elem.startPointerPos.y));
     39                const dragDistance = node.dragDistance();
     40                const distance = Math.max(Math.abs(pos.x - elem.startPointerPos.x), Math.abs(pos.y - elem.startPointerPos.y));
    4141                if (distance < dragDistance) {
    4242                    return;
     
    105105    window.addEventListener('mouseup', exports.DD._endDragBefore, true);
    106106    window.addEventListener('touchend', exports.DD._endDragBefore, true);
     107    window.addEventListener('touchcancel', exports.DD._endDragBefore, true);
    107108    window.addEventListener('mousemove', exports.DD._drag);
    108109    window.addEventListener('touchmove', exports.DD._drag);
    109110    window.addEventListener('mouseup', exports.DD._endDragAfter, false);
    110111    window.addEventListener('touchend', exports.DD._endDragAfter, false);
     112    window.addEventListener('touchcancel', exports.DD._endDragAfter, false);
    111113}
  • imaps-frontend/node_modules/konva/lib/Factory.js

    rd565449 r0c6b92a  
    44const Util_1 = require("./Util");
    55const Validators_1 = require("./Validators");
    6 var GET = 'get', SET = 'set';
     6const GET = 'get', SET = 'set';
    77exports.Factory = {
    88    addGetterSetter(constructor, attr, def, validator, after) {
     
    1212    },
    1313    addGetter(constructor, attr, def) {
    14         var method = GET + Util_1.Util._capitalize(attr);
     14        const method = GET + Util_1.Util._capitalize(attr);
    1515        constructor.prototype[method] =
    1616            constructor.prototype[method] ||
    1717                function () {
    18                     var val = this.attrs[attr];
     18                    const val = this.attrs[attr];
    1919                    return val === undefined ? def : val;
    2020                };
    2121    },
    2222    addSetter(constructor, attr, validator, after) {
    23         var method = SET + Util_1.Util._capitalize(attr);
     23        const method = SET + Util_1.Util._capitalize(attr);
    2424        if (!constructor.prototype[method]) {
    2525            exports.Factory.overWriteSetter(constructor, attr, validator, after);
     
    2727    },
    2828    overWriteSetter(constructor, attr, validator, after) {
    29         var method = SET + Util_1.Util._capitalize(attr);
     29        const method = SET + Util_1.Util._capitalize(attr);
    3030        constructor.prototype[method] = function (val) {
    3131            if (validator && val !== undefined && val !== null) {
     
    4040    },
    4141    addComponentsGetterSetter(constructor, attr, components, validator, after) {
    42         var len = components.length, capitalize = Util_1.Util._capitalize, getter = GET + capitalize(attr), setter = SET + capitalize(attr), n, component;
     42        let len = components.length, capitalize = Util_1.Util._capitalize, getter = GET + capitalize(attr), setter = SET + capitalize(attr), n, component;
    4343        constructor.prototype[getter] = function () {
    44             var ret = {};
     44            const ret = {};
    4545            for (n = 0; n < len; n++) {
    4646                component = components[n];
     
    4949            return ret;
    5050        };
    51         var basicValidator = (0, Validators_1.getComponentValidator)(components);
     51        const basicValidator = (0, Validators_1.getComponentValidator)(components);
    5252        constructor.prototype[setter] = function (val) {
    53             var oldVal = this.attrs[attr], key;
     53            let oldVal = this.attrs[attr], key;
    5454            if (validator) {
    5555                val = validator.call(this, val);
     
    7878    },
    7979    addOverloadedGetterSetter(constructor, attr) {
    80         var capitalizedAttr = Util_1.Util._capitalize(attr), setter = SET + capitalizedAttr, getter = GET + capitalizedAttr;
     80        const capitalizedAttr = Util_1.Util._capitalize(attr), setter = SET + capitalizedAttr, getter = GET + capitalizedAttr;
    8181        constructor.prototype[attr] = function () {
    8282            if (arguments.length) {
     
    8989    addDeprecatedGetterSetter(constructor, attr, def, validator) {
    9090        Util_1.Util.error('Adding deprecated ' + attr);
    91         var method = GET + Util_1.Util._capitalize(attr);
    92         var message = attr +
     91        const method = GET + Util_1.Util._capitalize(attr);
     92        const message = attr +
    9393            ' property is deprecated and will be removed soon. Look at Konva change log for more information.';
    9494        constructor.prototype[method] = function () {
    9595            Util_1.Util.error(message);
    96             var val = this.attrs[attr];
     96            const val = this.attrs[attr];
    9797            return val === undefined ? def : val;
    9898        };
     
    104104    backCompat(constructor, methods) {
    105105        Util_1.Util.each(methods, function (oldMethodName, newMethodName) {
    106             var method = constructor.prototype[newMethodName];
    107             var oldGetter = GET + Util_1.Util._capitalize(oldMethodName);
    108             var oldSetter = SET + Util_1.Util._capitalize(oldMethodName);
     106            const method = constructor.prototype[newMethodName];
     107            const oldGetter = GET + Util_1.Util._capitalize(oldMethodName);
     108            const oldSetter = SET + Util_1.Util._capitalize(oldMethodName);
    109109            function deprecated() {
    110110                method.apply(this, arguments);
  • imaps-frontend/node_modules/konva/lib/Global.js

    rd565449 r0c6b92a  
    1717exports.Konva = {
    1818    _global: exports.glob,
    19     version: '9.3.14',
     19    version: '9.3.16',
    2020    isBrowser: detectBrowser(),
    2121    isUnminified: /param/.test(function (param) { }.toString()),
  • imaps-frontend/node_modules/konva/lib/Group.js

    rd565449 r0c6b92a  
    77class Group extends Container_1.Container {
    88    _validateAdd(child) {
    9         var type = child.getType();
     9        const type = child.getType();
    1010        if (type !== 'Group' && type !== 'Shape') {
    1111            Util_1.Util.throw('You may only add groups and shapes to groups.');
  • imaps-frontend/node_modules/konva/lib/Layer.js

    rd565449 r0c6b92a  
    1010const Shape_1 = require("./Shape");
    1111const Global_1 = require("./Global");
    12 var HASH = '#', BEFORE_DRAW = 'beforeDraw', DRAW = 'draw', INTERSECTION_OFFSETS = [
     12const HASH = '#', BEFORE_DRAW = 'beforeDraw', DRAW = 'draw', INTERSECTION_OFFSETS = [
    1313    { x: 0, y: 0 },
    1414    { x: -1, y: -1 },
     
    5353    setZIndex(index) {
    5454        super.setZIndex(index);
    55         var stage = this.getStage();
     55        const stage = this.getStage();
    5656        if (stage && stage.content) {
    5757            stage.content.removeChild(this.getNativeCanvasElement());
     
    6767    moveToTop() {
    6868        Node_1.Node.prototype.moveToTop.call(this);
    69         var stage = this.getStage();
     69        const stage = this.getStage();
    7070        if (stage && stage.content) {
    7171            stage.content.removeChild(this.getNativeCanvasElement());
     
    7575    }
    7676    moveUp() {
    77         var moved = Node_1.Node.prototype.moveUp.call(this);
     77        const moved = Node_1.Node.prototype.moveUp.call(this);
    7878        if (!moved) {
    7979            return false;
    8080        }
    81         var stage = this.getStage();
     81        const stage = this.getStage();
    8282        if (!stage || !stage.content) {
    8383            return false;
     
    9494    moveDown() {
    9595        if (Node_1.Node.prototype.moveDown.call(this)) {
    96             var stage = this.getStage();
     96            const stage = this.getStage();
    9797            if (stage) {
    98                 var children = stage.children;
     98                const children = stage.children;
    9999                if (stage.content) {
    100100                    stage.content.removeChild(this.getNativeCanvasElement());
     
    108108    moveToBottom() {
    109109        if (Node_1.Node.prototype.moveToBottom.call(this)) {
    110             var stage = this.getStage();
     110            const stage = this.getStage();
    111111            if (stage) {
    112                 var children = stage.children;
     112                const children = stage.children;
    113113                if (stage.content) {
    114114                    stage.content.removeChild(this.getNativeCanvasElement());
     
    124124    }
    125125    remove() {
    126         var _canvas = this.getNativeCanvasElement();
     126        const _canvas = this.getNativeCanvasElement();
    127127        Node_1.Node.prototype.remove.call(this);
    128128        if (_canvas && _canvas.parentNode && Util_1.Util._isInDocument(_canvas)) {
     
    141141    }
    142142    _validateAdd(child) {
    143         var type = child.getType();
     143        const type = child.getType();
    144144        if (type !== 'Group' && type !== 'Shape') {
    145145            Util_1.Util.throw('You may only add groups and shapes to a layer.');
     
    197197            return null;
    198198        }
    199         var spiralSearchDistance = 1;
    200         var continueSearch = false;
     199        let spiralSearchDistance = 1;
     200        let continueSearch = false;
    201201        while (true) {
    202202            for (let i = 0; i < INTERSECTION_OFFSETS_LEN; i++) {
     
    247247    }
    248248    drawScene(can, top) {
    249         var layer = this.getLayer(), canvas = can || (layer && layer.getCanvas());
     249        const layer = this.getLayer(), canvas = can || (layer && layer.getCanvas());
    250250        this._fire(BEFORE_DRAW, {
    251251            node: this,
     
    261261    }
    262262    drawHit(can, top) {
    263         var layer = this.getLayer(), canvas = can || (layer && layer.hitCanvas);
     263        const layer = this.getLayer(), canvas = can || (layer && layer.hitCanvas);
    264264        if (layer && layer.clearBeforeDraw()) {
    265265            layer.getHitCanvas().getContext().clear();
     
    288288            return;
    289289        }
    290         var parent = this.parent;
    291         var added = !!this.hitCanvas._canvas.parentNode;
     290        const parent = this.parent;
     291        const added = !!this.hitCanvas._canvas.parentNode;
    292292        if (added) {
    293293            parent.content.removeChild(this.hitCanvas._canvas);
  • imaps-frontend/node_modules/konva/lib/Node.d.ts

    rd565449 r0c6b92a  
    4040    [index: string]: any;
    4141};
    42 export interface KonvaEventObject<EventType> {
     42export interface KonvaEventObject<EventType, This = Node> {
    4343    type: string;
    4444    target: Shape | Stage;
    4545    evt: EventType;
    4646    pointerId: number;
    47     currentTarget: Node;
     47    currentTarget: This;
    4848    cancelBubble: boolean;
    4949    child?: Node;
    5050}
    51 export type KonvaEventListener<This, EventType> = (this: This, ev: KonvaEventObject<EventType>) => void;
     51export type KonvaEventListener<This, EventType> = (this: This, ev: KonvaEventObject<EventType, This>) => void;
    5252export declare abstract class Node<Config extends NodeConfig = NodeConfig> {
    5353    _id: number;
     
    181181        attrs: Config & Record<string, any>;
    182182        className: string;
    183         children?: any[] | undefined;
     183        children?: Array<any>;
    184184    };
    185185    toJSON(): string;
     
    320320    transformsEnabled: GetSet<string, this>;
    321321    visible: GetSet<boolean, this>;
    322     width: number;
     322    width: GetSet<number, this>;
    323323    height: GetSet<number, this>;
    324324    x: GetSet<number, this>;
  • imaps-frontend/node_modules/konva/lib/Node.js

    rd565449 r0c6b92a  
    88const DragAndDrop_1 = require("./DragAndDrop");
    99const Validators_1 = require("./Validators");
    10 var ABSOLUTE_OPACITY = 'absoluteOpacity', ALL_LISTENERS = 'allEventListeners', ABSOLUTE_TRANSFORM = 'absoluteTransform', ABSOLUTE_SCALE = 'absoluteScale', CANVAS = 'canvas', CHANGE = 'Change', CHILDREN = 'children', KONVA = 'konva', LISTENING = 'listening', MOUSEENTER = 'mouseenter', MOUSELEAVE = 'mouseleave', NAME = 'name', SET = 'set', SHAPE = 'Shape', SPACE = ' ', STAGE = 'stage', TRANSFORM = 'transform', UPPER_STAGE = 'Stage', VISIBLE = 'visible', TRANSFORM_CHANGE_STR = [
     10const ABSOLUTE_OPACITY = 'absoluteOpacity', ALL_LISTENERS = 'allEventListeners', ABSOLUTE_TRANSFORM = 'absoluteTransform', ABSOLUTE_SCALE = 'absoluteScale', CANVAS = 'canvas', CHANGE = 'Change', CHILDREN = 'children', KONVA = 'konva', LISTENING = 'listening', MOUSEENTER = 'mouseenter', MOUSELEAVE = 'mouseleave', NAME = 'name', SET = 'set', SHAPE = 'Shape', SPACE = ' ', STAGE = 'stage', TRANSFORM = 'transform', UPPER_STAGE = 'Stage', VISIBLE = 'visible', TRANSFORM_CHANGE_STR = [
    1111    'xChange.konva',
    1212    'yChange.konva',
     
    5757    }
    5858    _getCache(attr, privateGetter) {
    59         var cache = this._cache.get(attr);
    60         var isTransform = attr === TRANSFORM || attr === ABSOLUTE_TRANSFORM;
    61         var invalid = cache === undefined || (isTransform && cache.dirty === true);
     59        let cache = this._cache.get(attr);
     60        const isTransform = attr === TRANSFORM || attr === ABSOLUTE_TRANSFORM;
     61        const invalid = cache === undefined || (isTransform && cache.dirty === true);
    6262        if (invalid) {
    6363            cache = privateGetter.call(this);
     
    9696    }
    9797    cache(config) {
    98         var conf = config || {};
    99         var rect = {};
     98        const conf = config || {};
     99        let rect = {};
    100100        if (conf.x === undefined ||
    101101            conf.y === undefined ||
     
    107107            });
    108108        }
    109         var width = Math.ceil(conf.width || rect.width), height = Math.ceil(conf.height || rect.height), pixelRatio = conf.pixelRatio, x = conf.x === undefined ? Math.floor(rect.x) : conf.x, y = conf.y === undefined ? Math.floor(rect.y) : conf.y, offset = conf.offset || 0, drawBorder = conf.drawBorder || false, hitCanvasPixelRatio = conf.hitCanvasPixelRatio || 1;
     109        let width = Math.ceil(conf.width || rect.width), height = Math.ceil(conf.height || rect.height), pixelRatio = conf.pixelRatio, x = conf.x === undefined ? Math.floor(rect.x) : conf.x, y = conf.y === undefined ? Math.floor(rect.y) : conf.y, offset = conf.offset || 0, drawBorder = conf.drawBorder || false, hitCanvasPixelRatio = conf.hitCanvasPixelRatio || 1;
    110110        if (!width || !height) {
    111111            Util_1.Util.error('Can not cache the node. Width or height of the node equals 0. Caching is skipped.');
     
    118118        x -= offset;
    119119        y -= offset;
    120         var cachedSceneCanvas = new Canvas_1.SceneCanvas({
     120        const cachedSceneCanvas = new Canvas_1.SceneCanvas({
    121121            pixelRatio: pixelRatio,
    122122            width: width,
     
    179179    }
    180180    _transformedRect(rect, top) {
    181         var points = [
     181        const points = [
    182182            { x: rect.x, y: rect.y },
    183183            { x: rect.x + rect.width, y: rect.y },
     
    185185            { x: rect.x, y: rect.y + rect.height },
    186186        ];
    187         var minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
    188         var trans = this.getAbsoluteTransform(top);
     187        let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
     188        const trans = this.getAbsoluteTransform(top);
    189189        points.forEach(function (point) {
    190             var transformed = trans.point(point);
     190            const transformed = trans.point(point);
    191191            if (minX === undefined) {
    192192                minX = maxX = transformed.x;
     
    211211        const canvasCache = this._getCanvasCache();
    212212        context.translate(canvasCache.x, canvasCache.y);
    213         var cacheCanvas = this._getCachedSceneCanvas();
    214         var ratio = cacheCanvas.pixelRatio;
     213        const cacheCanvas = this._getCachedSceneCanvas();
     214        const ratio = cacheCanvas.pixelRatio;
    215215        context.drawImage(cacheCanvas._canvas, 0, 0, cacheCanvas.width / ratio, cacheCanvas.height / ratio);
    216216        context.restore();
    217217    }
    218218    _drawCachedHitCanvas(context) {
    219         var canvasCache = this._getCanvasCache(), hitCanvas = canvasCache.hit;
     219        const canvasCache = this._getCanvasCache(), hitCanvas = canvasCache.hit;
    220220        context.save();
    221221        context.translate(canvasCache.x, canvasCache.y);
     
    224224    }
    225225    _getCachedSceneCanvas() {
    226         var filters = this.filters(), cachedCanvas = this._getCanvasCache(), sceneCanvas = cachedCanvas.scene, filterCanvas = cachedCanvas.filter, filterContext = filterCanvas.getContext(), len, imageData, n, filter;
     226        let filters = this.filters(), cachedCanvas = this._getCanvasCache(), sceneCanvas = cachedCanvas.scene, filterCanvas = cachedCanvas.filter, filterContext = filterCanvas.getContext(), len, imageData, n, filter;
    227227        if (filters) {
    228228            if (!this._filterUpToDate) {
    229                 var ratio = sceneCanvas.pixelRatio;
     229                const ratio = sceneCanvas.pixelRatio;
    230230                filterCanvas.setSize(sceneCanvas.width / sceneCanvas.pixelRatio, sceneCanvas.height / sceneCanvas.pixelRatio);
    231231                try {
     
    262262            return this._delegate.apply(this, arguments);
    263263        }
    264         var events = evtStr.split(SPACE), len = events.length, n, event, parts, baseEvent, name;
     264        let events = evtStr.split(SPACE), len = events.length, n, event, parts, baseEvent, name;
    265265        for (n = 0; n < len; n++) {
    266266            event = events[n];
     
    279279    }
    280280    off(evtStr, callback) {
    281         var events = (evtStr || '').split(SPACE), len = events.length, n, t, event, parts, baseEvent, name;
     281        let events = (evtStr || '').split(SPACE), len = events.length, n, t, event, parts, baseEvent, name;
    282282        this._cache && this._cache.delete(ALL_LISTENERS);
    283283        if (!evtStr) {
     
    305305    }
    306306    dispatchEvent(evt) {
    307         var e = {
     307        const e = {
    308308            target: this,
    309309            type: evt.type,
     
    324324    }
    325325    _delegate(event, selector, handler) {
    326         var stopNode = this;
     326        const stopNode = this;
    327327        this.on(event, function (evt) {
    328             var targets = evt.target.findAncestors(selector, true, stopNode);
    329             for (var i = 0; i < targets.length; i++) {
     328            const targets = evt.target.findAncestors(selector, true, stopNode);
     329            for (let i = 0; i < targets.length; i++) {
    330330                evt = Util_1.Util.cloneObject(evt);
    331331                evt.currentTarget = targets[i];
     
    352352    _remove() {
    353353        this._clearCaches();
    354         var parent = this.getParent();
     354        const parent = this.getParent();
    355355        if (parent && parent.children) {
    356356            parent.children.splice(this.index, 1);
     
    365365    }
    366366    getAttr(attr) {
    367         var method = 'get' + Util_1.Util._capitalize(attr);
     367        const method = 'get' + Util_1.Util._capitalize(attr);
    368368        if (Util_1.Util._isFunction(this[method])) {
    369369            return this[method]();
     
    372372    }
    373373    getAncestors() {
    374         var parent = this.getParent(), ancestors = [];
     374        let parent = this.getParent(), ancestors = [];
    375375        while (parent) {
    376376            ancestors.push(parent);
     
    384384    setAttrs(config) {
    385385        this._batchTransformChanges(() => {
    386             var key, method;
     386            let key, method;
    387387            if (!config) {
    388388                return this;
     
    439439            return this._isVisible(top) && this._isListening(top);
    440440        }
    441         var layer = this.getLayer();
    442         var layerUnderDrag = false;
     441        const layer = this.getLayer();
     442        let layerUnderDrag = false;
    443443        DragAndDrop_1.DD._dragElements.forEach((elem) => {
    444444            if (elem.dragStatus !== 'dragging') {
     
    452452            }
    453453        });
    454         var dragSkip = !skipDragCheck &&
     454        const dragSkip = !skipDragCheck &&
    455455            !Global_1.Konva.hitOnDragEnabled &&
    456456            (layerUnderDrag || Global_1.Konva.isTransforming());
     
    469469    }
    470470    getAbsoluteZIndex() {
    471         var depth = this.getDepth(), that = this, index = 0, nodes, len, n, child;
     471        let depth = this.getDepth(), that = this, index = 0, nodes, len, n, child;
    472472        function addChildren(children) {
    473473            nodes = [];
     
    494494    }
    495495    getDepth() {
    496         var depth = 0, parent = this.parent;
     496        let depth = 0, parent = this.parent;
    497497        while (parent) {
    498498            depth++;
     
    529529            return null;
    530530        }
    531         var pos = stage.getPointerPosition();
     531        const pos = stage.getPointerPosition();
    532532        if (!pos) {
    533533            return null;
    534534        }
    535         var transform = this.getAbsoluteTransform().copy();
     535        const transform = this.getAbsoluteTransform().copy();
    536536        transform.invert();
    537537        return transform.point(pos);
     
    550550            top = true;
    551551        }
    552         var absoluteMatrix = this.getAbsoluteTransform(top).getMatrix(), absoluteTransform = new Util_1.Transform(), offset = this.offset();
     552        const absoluteMatrix = this.getAbsoluteTransform(top).getMatrix(), absoluteTransform = new Util_1.Transform(), offset = this.offset();
    553553        absoluteTransform.m = absoluteMatrix.slice();
    554554        absoluteTransform.translate(offset.x, offset.y);
     
    560560        this.attrs.y = y;
    561561        this._clearCache(TRANSFORM);
    562         var it = this._getAbsoluteTransform().copy();
     562        const it = this._getAbsoluteTransform().copy();
    563563        it.invert();
    564564        it.translate(pos.x, pos.y);
     
    574574    }
    575575    _setTransform(trans) {
    576         var key;
     576        let key;
    577577        for (key in trans) {
    578578            this.attrs[key] = trans[key];
     
    580580    }
    581581    _clearTransform() {
    582         var trans = {
     582        const trans = {
    583583            x: this.x(),
    584584            y: this.y(),
     
    603603    }
    604604    move(change) {
    605         var changeX = change.x, changeY = change.y, x = this.x(), y = this.y();
     605        let changeX = change.x, changeY = change.y, x = this.x(), y = this.y();
    606606        if (changeX !== undefined) {
    607607            x += changeX;
     
    614614    }
    615615    _eachAncestorReverse(func, top) {
    616         var family = [], parent = this.getParent(), len, n;
     616        let family = [], parent = this.getParent(), len, n;
    617617        if (top && top._id === this._id) {
    618618            return;
     
    637637            return false;
    638638        }
    639         var index = this.index, len = this.parent.getChildren().length;
     639        const index = this.index, len = this.parent.getChildren().length;
    640640        if (index < len - 1) {
    641641            this.parent.children.splice(index, 1);
     
    651651            return false;
    652652        }
    653         var index = this.index, len = this.parent.getChildren().length;
     653        const index = this.index, len = this.parent.getChildren().length;
    654654        if (index < len - 1) {
    655655            this.parent.children.splice(index, 1);
     
    665665            return false;
    666666        }
    667         var index = this.index;
     667        const index = this.index;
    668668        if (index > 0) {
    669669            this.parent.children.splice(index, 1);
     
    679679            return false;
    680680        }
    681         var index = this.index;
     681        const index = this.index;
    682682        if (index > 0) {
    683683            this.parent.children.splice(index, 1);
     
    700700                '.');
    701701        }
    702         var index = this.index;
     702        const index = this.index;
    703703        this.parent.children.splice(index, 1);
    704704        this.parent.children.splice(zIndex, 0, this);
     
    710710    }
    711711    _getAbsoluteOpacity() {
    712         var absOpacity = this.opacity();
    713         var parent = this.getParent();
     712        let absOpacity = this.opacity();
     713        const parent = this.getParent();
    714714        if (parent && !parent._isUnderCache) {
    715715            absOpacity *= parent.getAbsoluteOpacity();
     
    725725    }
    726726    toObject() {
    727         var attrs = this.getAttrs(), key, val, getter, defaultValue, nonPlainObject;
     727        let attrs = this.getAttrs(), key, val, getter, defaultValue, nonPlainObject;
    728728        const obj = {
    729729            attrs: {},
     
    754754    }
    755755    findAncestors(selector, includeSelf, stopNode) {
    756         var res = [];
     756        const res = [];
    757757        if (includeSelf && this._isMatch(selector)) {
    758758            res.push(this);
    759759        }
    760         var ancestor = this.parent;
     760        let ancestor = this.parent;
    761761        while (ancestor) {
    762762            if (ancestor === stopNode) {
     
    783783            return selector(this);
    784784        }
    785         var selectorArr = selector.replace(/ /g, '').split(','), len = selectorArr.length, n, sel;
     785        let selectorArr = selector.replace(/ /g, '').split(','), len = selectorArr.length, n, sel;
    786786        for (n = 0; n < len; n++) {
    787787            sel = selectorArr[n];
     
    810810    }
    811811    getLayer() {
    812         var parent = this.getParent();
     812        const parent = this.getParent();
    813813        return parent ? parent.getLayer() : null;
    814814    }
     
    817817    }
    818818    _getStage() {
    819         var parent = this.getParent();
     819        const parent = this.getParent();
    820820        if (parent) {
    821821            return parent.getStage();
     
    844844    }
    845845    _getAbsoluteTransform(top) {
    846         var at;
     846        let at;
    847847        if (top) {
    848848            at = new Util_1.Transform();
    849849            this._eachAncestorReverse(function (node) {
    850                 var transformsEnabled = node.transformsEnabled();
     850                const transformsEnabled = node.transformsEnabled();
    851851                if (transformsEnabled === 'all') {
    852852                    at.multiply(node.getTransform());
     
    866866                at.reset();
    867867            }
    868             var transformsEnabled = this.transformsEnabled();
     868            const transformsEnabled = this.transformsEnabled();
    869869            if (transformsEnabled === 'all') {
    870870                at.multiply(this.getTransform());
     
    882882    }
    883883    getAbsoluteScale(top) {
    884         var parent = this;
     884        let parent = this;
    885885        while (parent) {
    886886            if (parent._isUnderCache) {
     
    904904    _getTransform() {
    905905        var _a, _b;
    906         var m = this._cache.get(TRANSFORM) || new Util_1.Transform();
     906        const m = this._cache.get(TRANSFORM) || new Util_1.Transform();
    907907        m.reset();
    908         var x = this.x(), y = this.y(), rotation = Global_1.Konva.getAngle(this.rotation()), scaleX = (_a = this.attrs.scaleX) !== null && _a !== void 0 ? _a : 1, scaleY = (_b = this.attrs.scaleY) !== null && _b !== void 0 ? _b : 1, skewX = this.attrs.skewX || 0, skewY = this.attrs.skewY || 0, offsetX = this.attrs.offsetX || 0, offsetY = this.attrs.offsetY || 0;
     908        const x = this.x(), y = this.y(), rotation = Global_1.Konva.getAngle(this.rotation()), scaleX = (_a = this.attrs.scaleX) !== null && _a !== void 0 ? _a : 1, scaleY = (_b = this.attrs.scaleY) !== null && _b !== void 0 ? _b : 1, skewX = this.attrs.skewX || 0, skewY = this.attrs.skewY || 0, offsetX = this.attrs.offsetX || 0, offsetY = this.attrs.offsetY || 0;
    909909        if (x !== 0 || y !== 0) {
    910910            m.translate(x, y);
     
    926926    }
    927927    clone(obj) {
    928         var attrs = Util_1.Util.cloneObject(this.attrs), key, allListeners, len, n, listener;
     928        let attrs = Util_1.Util.cloneObject(this.attrs), key, allListeners, len, n, listener;
    929929        for (key in obj) {
    930930            attrs[key] = obj[key];
    931931        }
    932         var node = new this.constructor(attrs);
     932        const node = new this.constructor(attrs);
    933933        for (key in this.eventListeners) {
    934934            allListeners = this.eventListeners[key];
     
    948948    _toKonvaCanvas(config) {
    949949        config = config || {};
    950         var box = this.getClientRect();
    951         var stage = this.getStage(), x = config.x !== undefined ? config.x : Math.floor(box.x), y = config.y !== undefined ? config.y : Math.floor(box.y), pixelRatio = config.pixelRatio || 1, canvas = new Canvas_1.SceneCanvas({
     950        const box = this.getClientRect();
     951        const stage = this.getStage(), x = config.x !== undefined ? config.x : Math.floor(box.x), y = config.y !== undefined ? config.y : Math.floor(box.y), pixelRatio = config.pixelRatio || 1, canvas = new Canvas_1.SceneCanvas({
    952952            width: config.width || Math.ceil(box.width) || (stage ? stage.width() : 0),
    953953            height: config.height ||
     
    977977    toDataURL(config) {
    978978        config = config || {};
    979         var mimeType = config.mimeType || null, quality = config.quality || null;
    980         var url = this._toKonvaCanvas(config).toDataURL(mimeType, quality);
     979        const mimeType = config.mimeType || null, quality = config.quality || null;
     980        const url = this._toKonvaCanvas(config).toDataURL(mimeType, quality);
    981981        if (config.callback) {
    982982            config.callback(url);
     
    10451045    }
    10461046    _off(type, name, callback) {
    1047         var evtListeners = this.eventListeners[type], i, evtName, handler;
     1047        let evtListeners = this.eventListeners[type], i, evtName, handler;
    10481048        for (i = 0; i < evtListeners.length; i++) {
    10491049            evtName = evtListeners[i].name;
     
    10691069    addName(name) {
    10701070        if (!this.hasName(name)) {
    1071             var oldName = this.name();
    1072             var newName = oldName ? oldName + ' ' + name : name;
     1071            const oldName = this.name();
     1072            const newName = oldName ? oldName + ' ' + name : name;
    10731073            this.name(newName);
    10741074        }
     
    10831083            return false;
    10841084        }
    1085         var names = (fullName || '').split(/\s/g);
     1085        const names = (fullName || '').split(/\s/g);
    10861086        return names.indexOf(name) !== -1;
    10871087    }
    10881088    removeName(name) {
    1089         var names = (this.name() || '').split(/\s/g);
    1090         var index = names.indexOf(name);
     1089        const names = (this.name() || '').split(/\s/g);
     1090        const index = names.indexOf(name);
    10911091        if (index !== -1) {
    10921092            names.splice(index, 1);
     
    10961096    }
    10971097    setAttr(attr, val) {
    1098         var func = this[SET + Util_1.Util._capitalize(attr)];
     1098        const func = this[SET + Util_1.Util._capitalize(attr)];
    10991099        if (Util_1.Util._isFunction(func)) {
    11001100            func.call(this, val);
     
    11121112    }
    11131113    _setAttr(key, val) {
    1114         var oldVal = this.attrs[key];
     1114        const oldVal = this.attrs[key];
    11151115        if (oldVal === val && !Util_1.Util.isObject(val)) {
    11161116            return;
     
    11281128    }
    11291129    _setComponentAttr(key, component, val) {
    1130         var oldVal;
     1130        let oldVal;
    11311131        if (val !== undefined) {
    11321132            oldVal = this.attrs[key];
     
    11421142            evt.target = this;
    11431143        }
    1144         var shouldStop = (eventType === MOUSEENTER || eventType === MOUSELEAVE) &&
     1144        const shouldStop = (eventType === MOUSEENTER || eventType === MOUSELEAVE) &&
    11451145            ((compareShape &&
    11461146                (this === compareShape ||
     
    11491149        if (!shouldStop) {
    11501150            this._fire(eventType, evt);
    1151             var stopBubble = (eventType === MOUSEENTER || eventType === MOUSELEAVE) &&
     1151            const stopBubble = (eventType === MOUSEENTER || eventType === MOUSELEAVE) &&
    11521152                compareShape &&
    11531153                compareShape.isAncestorOf &&
     
    12071207    }
    12081208    _createDragElement(evt) {
    1209         var pointerId = evt ? evt.pointerId : undefined;
    1210         var stage = this.getStage();
    1211         var ap = this.getAbsolutePosition();
     1209        const pointerId = evt ? evt.pointerId : undefined;
     1210        const stage = this.getStage();
     1211        const ap = this.getAbsolutePosition();
    12121212        if (!stage) {
    12131213            return;
    12141214        }
    1215         var pos = stage._getPointerById(pointerId) ||
     1215        const pos = stage._getPointerById(pointerId) ||
    12161216            stage._changedPointerPositions[0] ||
    12171217            ap;
     
    12441244            return;
    12451245        }
    1246         var newNodePos = {
     1246        let newNodePos = {
    12471247            x: pos.x - elem.offset.x,
    12481248            y: pos.y - elem.offset.y,
    12491249        };
    1250         var dbf = this.dragBoundFunc();
     1250        const dbf = this.dragBoundFunc();
    12511251        if (dbf !== undefined) {
    12521252            const bounded = dbf.call(this, newNodePos, evt);
     
    12851285        this._dragCleanup();
    12861286        this.on('mousedown.konva touchstart.konva', function (evt) {
    1287             var shouldCheckButton = evt.evt['button'] !== undefined;
    1288             var canDrag = !shouldCheckButton || Global_1.Konva.dragButtons.indexOf(evt.evt['button']) >= 0;
     1287            const shouldCheckButton = evt.evt['button'] !== undefined;
     1288            const canDrag = !shouldCheckButton || Global_1.Konva.dragButtons.indexOf(evt.evt['button']) >= 0;
    12891289            if (!canDrag) {
    12901290                return;
     
    12931293                return;
    12941294            }
    1295             var hasDraggingChild = false;
     1295            let hasDraggingChild = false;
    12961296            DragAndDrop_1.DD._dragElements.forEach((elem) => {
    12971297                if (this.isAncestorOf(elem.node)) {
     
    13101310        else {
    13111311            this._dragCleanup();
    1312             var stage = this.getStage();
     1312            const stage = this.getStage();
    13131313            if (!stage) {
    13141314                return;
     
    13491349    }
    13501350    static _createNode(obj, container) {
    1351         var className = Node.prototype.getClassName.call(obj), children = obj.children, no, len, n;
     1351        let className = Node.prototype.getClassName.call(obj), children = obj.children, no, len, n;
    13521352        if (container) {
    13531353            obj.attrs.container = container;
  • imaps-frontend/node_modules/konva/lib/PointerEvents.js

    rd565449 r0c6b92a  
    11"use strict";
    22Object.defineProperty(exports, "__esModule", { value: true });
    3 exports.releaseCapture = exports.setPointerCapture = exports.hasPointerCapture = exports.createEvent = exports.getCapturedShape = void 0;
     3exports.getCapturedShape = getCapturedShape;
     4exports.createEvent = createEvent;
     5exports.hasPointerCapture = hasPointerCapture;
     6exports.setPointerCapture = setPointerCapture;
     7exports.releaseCapture = releaseCapture;
    48const Global_1 = require("./Global");
    59const Captures = new Map();
     
    812    return Captures.get(pointerId);
    913}
    10 exports.getCapturedShape = getCapturedShape;
    1114function createEvent(evt) {
    1215    return {
     
    1518    };
    1619}
    17 exports.createEvent = createEvent;
    1820function hasPointerCapture(pointerId, shape) {
    1921    return Captures.get(pointerId) === shape;
    2022}
    21 exports.hasPointerCapture = hasPointerCapture;
    2223function setPointerCapture(pointerId, shape) {
    2324    releaseCapture(pointerId);
     
    3031    }
    3132}
    32 exports.setPointerCapture = setPointerCapture;
    3333function releaseCapture(pointerId, target) {
    3434    const shape = Captures.get(pointerId);
     
    4343    }
    4444}
    45 exports.releaseCapture = releaseCapture;
  • imaps-frontend/node_modules/konva/lib/Shape.js

    rd565449 r0c6b92a  
    99const Global_2 = require("./Global");
    1010const PointerEvents = require("./PointerEvents");
    11 var HAS_SHADOW = 'hasShadow';
    12 var SHADOW_RGBA = 'shadowRGBA';
    13 var patternImage = 'patternImage';
    14 var linearGradient = 'linearGradient';
    15 var radialGradient = 'radialGradient';
     11const HAS_SHADOW = 'hasShadow';
     12const SHADOW_RGBA = 'shadowRGBA';
     13const patternImage = 'patternImage';
     14const linearGradient = 'linearGradient';
     15const radialGradient = 'radialGradient';
    1616let dummyContext;
    1717function getDummyContext() {
     
    105105    __getFillPattern() {
    106106        if (this.fillPatternImage()) {
    107             var ctx = getDummyContext();
     107            const ctx = getDummyContext();
    108108            const pattern = ctx.createPattern(this.fillPatternImage(), this.fillPatternRepeat() || 'repeat');
    109109            if (pattern && pattern.setTransform) {
     
    133133    }
    134134    __getLinearGradient() {
    135         var colorStops = this.fillLinearGradientColorStops();
     135        const colorStops = this.fillLinearGradientColorStops();
    136136        if (colorStops) {
    137             var ctx = getDummyContext();
    138             var start = this.fillLinearGradientStartPoint();
    139             var end = this.fillLinearGradientEndPoint();
    140             var grd = ctx.createLinearGradient(start.x, start.y, end.x, end.y);
    141             for (var n = 0; n < colorStops.length; n += 2) {
     137            const ctx = getDummyContext();
     138            const start = this.fillLinearGradientStartPoint();
     139            const end = this.fillLinearGradientEndPoint();
     140            const grd = ctx.createLinearGradient(start.x, start.y, end.x, end.y);
     141            for (let n = 0; n < colorStops.length; n += 2) {
    142142                grd.addColorStop(colorStops[n], colorStops[n + 1]);
    143143            }
     
    149149    }
    150150    __getRadialGradient() {
    151         var colorStops = this.fillRadialGradientColorStops();
     151        const colorStops = this.fillRadialGradientColorStops();
    152152        if (colorStops) {
    153             var ctx = getDummyContext();
    154             var start = this.fillRadialGradientStartPoint();
    155             var end = this.fillRadialGradientEndPoint();
    156             var grd = ctx.createRadialGradient(start.x, start.y, this.fillRadialGradientStartRadius(), end.x, end.y, this.fillRadialGradientEndRadius());
    157             for (var n = 0; n < colorStops.length; n += 2) {
     153            const ctx = getDummyContext();
     154            const start = this.fillRadialGradientStartPoint();
     155            const end = this.fillRadialGradientEndPoint();
     156            const grd = ctx.createRadialGradient(start.x, start.y, this.fillRadialGradientStartRadius(), end.x, end.y, this.fillRadialGradientEndRadius());
     157            for (let n = 0; n < colorStops.length; n += 2) {
    158158                grd.addColorStop(colorStops[n], colorStops[n + 1]);
    159159            }
     
    168168            return;
    169169        }
    170         var rgba = Util_1.Util.colorToRGBA(this.shadowColor());
     170        const rgba = Util_1.Util.colorToRGBA(this.shadowColor());
    171171        if (rgba) {
    172172            return ('rgba(' +
     
    216216    }
    217217    intersects(point) {
    218         var stage = this.getStage();
     218        const stage = this.getStage();
    219219        if (!stage) {
    220220            return false;
     
    269269    }
    270270    getSelfRect() {
    271         var size = this.size();
     271        const size = this.size();
    272272        return {
    273273            x: this._centroid ? -size.width / 2 : 0,
     
    318318    }
    319319    drawScene(can, top, bufferCanvas) {
    320         var layer = this.getLayer();
    321         var canvas = can || layer.getCanvas(), context = canvas.getContext(), cachedCanvas = this._getCanvasCache(), drawFunc = this.getSceneFunc(), hasShadow = this.hasShadow(), stage, bufferContext;
    322         var skipBuffer = canvas.isCache;
    323         var cachingSelf = top === this;
     320        const layer = this.getLayer();
     321        let canvas = can || layer.getCanvas(), context = canvas.getContext(), cachedCanvas = this._getCanvasCache(), drawFunc = this.getSceneFunc(), hasShadow = this.hasShadow(), stage, bufferContext;
     322        const skipBuffer = canvas.isCache;
     323        const cachingSelf = top === this;
    324324        if (!this.isVisible() && !cachingSelf) {
    325325            return this;
     
    327327        if (cachedCanvas) {
    328328            context.save();
    329             var m = this.getAbsoluteTransform(top).getMatrix();
     329            const m = this.getAbsoluteTransform(top).getMatrix();
    330330            context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
    331331            this._drawCachedSceneCanvas(context);
     
    348348            drawFunc.call(this, bufferContext, this);
    349349            bufferContext.restore();
    350             var ratio = bc.pixelRatio;
     350            const ratio = bc.pixelRatio;
    351351            if (hasShadow) {
    352352                context._applyShadow(this);
     
    376376            return this;
    377377        }
    378         var layer = this.getLayer(), canvas = can || layer.hitCanvas, context = canvas && canvas.getContext(), drawFunc = this.hitFunc() || this.sceneFunc(), cachedCanvas = this._getCanvasCache(), cachedHitCanvas = cachedCanvas && cachedCanvas.hit;
     378        const layer = this.getLayer(), canvas = can || layer.hitCanvas, context = canvas && canvas.getContext(), drawFunc = this.hitFunc() || this.sceneFunc(), cachedCanvas = this._getCanvasCache(), cachedHitCanvas = cachedCanvas && cachedCanvas.hit;
    379379        if (!this.colorKey) {
    380380            Util_1.Util.warn('Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()');
     
    382382        if (cachedHitCanvas) {
    383383            context.save();
    384             var m = this.getAbsoluteTransform(top).getMatrix();
     384            const m = this.getAbsoluteTransform(top).getMatrix();
    385385            context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
    386386            this._drawCachedHitCanvas(context);
     
    395395        const selfCache = this === top;
    396396        if (!selfCache) {
    397             var o = this.getAbsoluteTransform(top).getMatrix();
     397            const o = this.getAbsoluteTransform(top).getMatrix();
    398398            context.transform(o[0], o[1], o[2], o[3], o[4], o[5]);
    399399        }
     
    403403    }
    404404    drawHitFromCache(alphaThreshold = 0) {
    405         var cachedCanvas = this._getCanvasCache(), sceneCanvas = this._getCachedSceneCanvas(), hitCanvas = cachedCanvas.hit, hitContext = hitCanvas.getContext(), hitWidth = hitCanvas.getWidth(), hitHeight = hitCanvas.getHeight(), hitImageData, hitData, len, rgbColorKey, i, alpha;
     405        let cachedCanvas = this._getCanvasCache(), sceneCanvas = this._getCachedSceneCanvas(), hitCanvas = cachedCanvas.hit, hitContext = hitCanvas.getContext(), hitWidth = hitCanvas.getWidth(), hitHeight = hitCanvas.getHeight(), hitImageData, hitData, len, rgbColorKey, i, alpha;
    406406        hitContext.clear();
    407407        hitContext.drawImage(sceneCanvas._canvas, 0, 0, hitWidth, hitHeight);
  • imaps-frontend/node_modules/konva/lib/Stage.d.ts

    rd565449 r0c6b92a  
    55import { Layer } from './Layer.js';
    66export interface StageConfig extends ContainerConfig {
    7     container: HTMLDivElement | string;
     7    container?: HTMLDivElement | string;
    88}
    99export declare const stages: Stage[];
     
    4141    getPointerPosition(): Vector2d | null;
    4242    _getPointerById(id?: number): (Vector2d & {
    43         id?: number | undefined;
     43        id?: number;
    4444    }) | undefined;
    4545    getPointersPositions(): (Vector2d & {
    46         id?: number | undefined;
     46        id?: number;
    4747    })[];
    4848    getStage(): this;
  • imaps-frontend/node_modules/konva/lib/Stage.js

    rd565449 r0c6b92a  
    1010const Global_2 = require("./Global");
    1111const PointerEvents = require("./PointerEvents");
    12 var STAGE = 'Stage', STRING = 'string', PX = 'px', MOUSEOUT = 'mouseout', MOUSELEAVE = 'mouseleave', MOUSEOVER = 'mouseover', MOUSEENTER = 'mouseenter', MOUSEMOVE = 'mousemove', MOUSEDOWN = 'mousedown', MOUSEUP = 'mouseup', POINTERMOVE = 'pointermove', POINTERDOWN = 'pointerdown', POINTERUP = 'pointerup', POINTERCANCEL = 'pointercancel', LOSTPOINTERCAPTURE = 'lostpointercapture', POINTEROUT = 'pointerout', POINTERLEAVE = 'pointerleave', POINTEROVER = 'pointerover', POINTERENTER = 'pointerenter', CONTEXTMENU = 'contextmenu', TOUCHSTART = 'touchstart', TOUCHEND = 'touchend', TOUCHMOVE = 'touchmove', TOUCHCANCEL = 'touchcancel', WHEEL = 'wheel', MAX_LAYERS_NUMBER = 5, EVENTS = [
     12const STAGE = 'Stage', STRING = 'string', PX = 'px', MOUSEOUT = 'mouseout', MOUSELEAVE = 'mouseleave', MOUSEOVER = 'mouseover', MOUSEENTER = 'mouseenter', MOUSEMOVE = 'mousemove', MOUSEDOWN = 'mousedown', MOUSEUP = 'mouseup', POINTERMOVE = 'pointermove', POINTERDOWN = 'pointerdown', POINTERUP = 'pointerup', POINTERCANCEL = 'pointercancel', LOSTPOINTERCAPTURE = 'lostpointercapture', POINTEROUT = 'pointerout', POINTERLEAVE = 'pointerleave', POINTEROVER = 'pointerover', POINTERENTER = 'pointerenter', CONTEXTMENU = 'contextmenu', TOUCHSTART = 'touchstart', TOUCHEND = 'touchend', TOUCHMOVE = 'touchmove', TOUCHCANCEL = 'touchcancel', WHEEL = 'wheel', MAX_LAYERS_NUMBER = 5, EVENTS = [
    1313    [MOUSEENTER, '_pointerenter'],
    1414    [MOUSEDOWN, '_pointerdown'],
     
    129129        if (typeof container === STRING) {
    130130            if (container.charAt(0) === '.') {
    131                 var className = container.slice(1);
     131                const className = container.slice(1);
    132132                container = document.getElementsByClassName(className)[0];
    133133            }
     
    159159    }
    160160    clear() {
    161         var layers = this.children, len = layers.length, n;
     161        let layers = this.children, len = layers.length, n;
    162162        for (n = 0; n < len; n++) {
    163163            layers[n].clear();
     
    175175    destroy() {
    176176        super.destroy();
    177         var content = this.content;
     177        const content = this.content;
    178178        if (content && Util_1.Util._isInDocument(content)) {
    179179            this.container().removeChild(content);
    180180        }
    181         var index = exports.stages.indexOf(this);
     181        const index = exports.stages.indexOf(this);
    182182        if (index > -1) {
    183183            exports.stages.splice(index, 1);
     
    215215        config.width = config.width || this.width();
    216216        config.height = config.height || this.height();
    217         var canvas = new Canvas_1.SceneCanvas({
     217        const canvas = new Canvas_1.SceneCanvas({
    218218            width: config.width,
    219219            height: config.height,
    220220            pixelRatio: config.pixelRatio || 1,
    221221        });
    222         var _context = canvas.getContext()._context;
    223         var layers = this.children;
     222        const _context = canvas.getContext()._context;
     223        const layers = this.children;
    224224        if (config.x || config.y) {
    225225            _context.translate(-1 * config.x, -1 * config.y);
     
    229229                return;
    230230            }
    231             var layerCanvas = layer._toKonvaCanvas(config);
     231            const layerCanvas = layer._toKonvaCanvas(config);
    232232            _context.drawImage(layerCanvas._canvas, config.x, config.y, layerCanvas.getWidth() / layerCanvas.getPixelRatio(), layerCanvas.getHeight() / layerCanvas.getPixelRatio());
    233233        });
     
    238238            return null;
    239239        }
    240         var layers = this.children, len = layers.length, end = len - 1, n;
     240        let layers = this.children, len = layers.length, end = len - 1, n;
    241241        for (n = end; n >= 0; n--) {
    242242            const shape = layers[n].getIntersection(pos);
     
    248248    }
    249249    _resizeDOM() {
    250         var width = this.width();
    251         var height = this.height();
     250        const width = this.width();
     251        const height = this.height();
    252252        if (this.content) {
    253253            this.content.style.width = width + PX;
     
    263263    add(layer, ...rest) {
    264264        if (arguments.length > 1) {
    265             for (var i = 0; i < arguments.length; i++) {
     265            for (let i = 0; i < arguments.length; i++) {
    266266                this.add(arguments[i]);
    267267            }
     
    269269        }
    270270        super.add(layer);
    271         var length = this.children.length;
     271        const length = this.children.length;
    272272        if (length > MAX_LAYERS_NUMBER) {
    273273            Util_1.Util.warn('The stage has ' +
     
    346346        }
    347347        this.setPointersPositions(evt);
    348         var targetShape = this._getTargetShape(eventType);
    349         var eventsEnabled = !(Global_1.Konva.isDragging() || Global_1.Konva.isTransforming()) || Global_1.Konva.hitOnDragEnabled;
     348        const targetShape = this._getTargetShape(eventType);
     349        const eventsEnabled = !(Global_1.Konva.isDragging() || Global_1.Konva.isTransforming()) || Global_1.Konva.hitOnDragEnabled;
    350350        if (targetShape && eventsEnabled) {
    351351            targetShape._fireAndBubble(events.pointerout, { evt: evt });
     
    380380        }
    381381        this.setPointersPositions(evt);
    382         var triggeredOnShape = false;
     382        let triggeredOnShape = false;
    383383        this._changedPointerPositions.forEach((pos) => {
    384             var shape = this.getIntersection(pos);
     384            const shape = this.getIntersection(pos);
    385385            DragAndDrop_1.DD.justDragged = false;
    386386            Global_1.Konva['_' + eventType + 'ListenClick'] = true;
     
    422422        }
    423423        this.setPointersPositions(evt);
    424         var eventsEnabled = !(Global_1.Konva.isDragging() || Global_1.Konva.isTransforming()) || Global_1.Konva.hitOnDragEnabled;
     424        const eventsEnabled = !(Global_1.Konva.isDragging() || Global_1.Konva.isTransforming()) || Global_1.Konva.hitOnDragEnabled;
    425425        if (!eventsEnabled) {
    426426            return;
    427427        }
    428         var processedShapesIds = {};
     428        const processedShapesIds = {};
    429429        let triggeredOnShape = false;
    430         var targetShape = this._getTargetShape(eventType);
     430        const targetShape = this._getTargetShape(eventType);
    431431        this._changedPointerPositions.forEach((pos) => {
    432432            const shape = (PointerEvents.getCapturedShape(pos.id) ||
     
    434434            const pointerId = pos.id;
    435435            const event = { evt: evt, pointerId };
    436             var differentTarget = targetShape !== shape;
     436            const differentTarget = targetShape !== shape;
    437437            if (differentTarget && targetShape) {
    438438                targetShape._fireAndBubble(events.pointerout, { ...event }, shape);
     
    484484        const clickStartShape = this[eventType + 'ClickStartShape'];
    485485        const clickEndShape = this[eventType + 'ClickEndShape'];
    486         var processedShapesIds = {};
     486        const processedShapesIds = {};
    487487        let triggeredOnShape = false;
    488488        this._changedPointerPositions.forEach((pos) => {
     
    558558    _contextmenu(evt) {
    559559        this.setPointersPositions(evt);
    560         var shape = this.getIntersection(this.getPointerPosition());
     560        const shape = this.getIntersection(this.getPointerPosition());
    561561        if (shape && shape.isListening()) {
    562562            shape._fireAndBubble(CONTEXTMENU, { evt: evt });
     
    572572    _wheel(evt) {
    573573        this.setPointersPositions(evt);
    574         var shape = this.getIntersection(this.getPointerPosition());
     574        const shape = this.getIntersection(this.getPointerPosition());
    575575        if (shape && shape.isListening()) {
    576576            shape._fireAndBubble(WHEEL, { evt: evt });
     
    597597    }
    598598    setPointersPositions(evt) {
    599         var contentPosition = this._getContentPosition(), x = null, y = null;
     599        let contentPosition = this._getContentPosition(), x = null, y = null;
    600600        evt = evt ? evt : window.event;
    601601        if (evt.touches !== undefined) {
     
    643643            };
    644644        }
    645         var rect = this.content.getBoundingClientRect();
     645        const rect = this.content.getBoundingClientRect();
    646646        return {
    647647            top: rect.top,
     
    664664            return;
    665665        }
    666         var container = this.container();
     666        const container = this.container();
    667667        if (!container) {
    668668            throw 'Stage has no container. A container is required.';
  • imaps-frontend/node_modules/konva/lib/Tween.js

    rd565449 r0c6b92a  
    66const Node_1 = require("./Node");
    77const Global_1 = require("./Global");
    8 var blacklist = {
     8let blacklist = {
    99    node: 1,
    1010    duration: 1,
     
    3232    }
    3333    fire(str) {
    34         var handler = this[str];
     34        const handler = this[str];
    3535        if (handler) {
    3636            handler();
     
    111111    }
    112112    onEnterFrame() {
    113         var t = this.getTimer() - this._startTime;
     113        const t = this.getTimer() - this._startTime;
    114114        if (this.state === PLAYING) {
    115115            this.setTime(t);
     
    129129class Tween {
    130130    constructor(config) {
    131         var that = this, node = config.node, nodeId = node._id, duration, easing = config.easing || exports.Easings.Linear, yoyo = !!config.yoyo, key;
     131        let that = this, node = config.node, nodeId = node._id, duration, easing = config.easing || exports.Easings.Linear, yoyo = !!config.yoyo, key;
    132132        if (typeof config.duration === 'undefined') {
    133133            duration = 0.3;
     
    141141        this.node = node;
    142142        this._id = idCounter++;
    143         var layers = node.getLayer() ||
     143        const layers = node.getLayer() ||
    144144            (node instanceof Global_1.Konva['Stage'] ? node.getLayers() : null);
    145145        if (!layers) {
     
    173173    }
    174174    _addAttr(key, end) {
    175         var node = this.node, nodeId = node._id, start, diff, tweenId, n, len, trueEnd, trueStart, endRGBA;
     175        let node = this.node, nodeId = node._id, start, diff, tweenId, n, len, trueEnd, trueStart, endRGBA;
    176176        tweenId = Tween.tweens[nodeId][key];
    177177        if (tweenId) {
     
    198198                    }
    199199                    else {
    200                         var startRGBA = Util_1.Util.colorToRGBA(start[n]);
     200                        const startRGBA = Util_1.Util.colorToRGBA(start[n]);
    201201                        endRGBA = Util_1.Util.colorToRGBA(end[n]);
    202202                        start[n] = startRGBA;
     
    239239    }
    240240    _tweenFunc(i) {
    241         var node = this.node, attrs = Tween.attrs[node._id][this._id], key, attr, start, diff, newVal, n, len, end;
     241        let node = this.node, attrs = Tween.attrs[node._id][this._id], key, attr, start, diff, newVal, n, len, end;
    242242        for (key in attrs) {
    243243            attr = attrs[key];
     
    301301        };
    302302        this.tween.onFinish = () => {
    303             var node = this.node;
    304             var attrs = Tween.attrs[node._id][this._id];
     303            const node = this.node;
     304            const attrs = Tween.attrs[node._id][this._id];
    305305            if (attrs.points && attrs.points.trueEnd) {
    306306                node.setAttr('points', attrs.points.trueEnd);
     
    311311        };
    312312        this.tween.onReset = () => {
    313             var node = this.node;
    314             var attrs = Tween.attrs[node._id][this._id];
     313            const node = this.node;
     314            const attrs = Tween.attrs[node._id][this._id];
    315315            if (attrs.points && attrs.points.trueStart) {
    316316                node.points(attrs.points.trueStart);
     
    351351    }
    352352    destroy() {
    353         var nodeId = this.node._id, thisId = this._id, attrs = Tween.tweens[nodeId], key;
     353        let nodeId = this.node._id, thisId = this._id, attrs = Tween.tweens[nodeId], key;
    354354        this.pause();
    355355        for (key in attrs) {
     
    363363Tween.tweens = {};
    364364Node_1.Node.prototype.to = function (params) {
    365     var onFinish = params.onFinish;
     365    const onFinish = params.onFinish;
    366366    params.node = this;
    367367    params.onFinish = function () {
     
    371371        }
    372372    };
    373     var tween = new Tween(params);
     373    const tween = new Tween(params);
    374374    tween.play();
    375375};
    376376exports.Easings = {
    377377    BackEaseIn(t, b, c, d) {
    378         var s = 1.70158;
     378        const s = 1.70158;
    379379        return c * (t /= d) * t * ((s + 1) * t - s) + b;
    380380    },
    381381    BackEaseOut(t, b, c, d) {
    382         var s = 1.70158;
     382        const s = 1.70158;
    383383        return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
    384384    },
    385385    BackEaseInOut(t, b, c, d) {
    386         var s = 1.70158;
     386        let s = 1.70158;
    387387        if ((t /= d / 2) < 1) {
    388388            return (c / 2) * (t * t * (((s *= 1.525) + 1) * t - s)) + b;
     
    391391    },
    392392    ElasticEaseIn(t, b, c, d, a, p) {
    393         var s = 0;
     393        let s = 0;
    394394        if (t === 0) {
    395395            return b;
     
    413413    },
    414414    ElasticEaseOut(t, b, c, d, a, p) {
    415         var s = 0;
     415        let s = 0;
    416416        if (t === 0) {
    417417            return b;
     
    435435    },
    436436    ElasticEaseInOut(t, b, c, d, a, p) {
    437         var s = 0;
     437        let s = 0;
    438438        if (t === 0) {
    439439            return b;
  • imaps-frontend/node_modules/konva/lib/Util.d.ts

    rd565449 r0c6b92a  
    3737    _isFunction(obj: any): boolean;
    3838    _isPlainObject(obj: any): boolean;
    39     _isArray(obj: any): obj is any[];
     39    _isArray(obj: any): obj is Array<any>;
    4040    _isNumber(obj: any): obj is number;
    4141    _isString(obj: any): obj is string;
    4242    _isBoolean(obj: any): obj is boolean;
    43     isObject(val: any): val is Object;
     43    isObject(val: any): val is object;
    4444    isValidSelector(selector: any): boolean;
    4545    _sign(number: number): 1 | -1;
     
    119119    error(str: string): void;
    120120    warn(str: string): void;
    121     each(obj: Object, func: Function): void;
     121    each(obj: object, func: Function): void;
    122122    _inRange(val: number, left: number, right: number): boolean;
    123123    _getProjectionToSegment(x1: any, y1: any, x2: any, y2: any, x3: any, y3: any): any[];
     
    125125    _prepareArrayForTween(startArray: any, endArray: any, isClosed: any): number[];
    126126    _prepareToStringify<T>(obj: any): T | null;
    127     _assign<T_1, U>(target: T_1, source: U): T_1 & U;
     127    _assign<T, U>(target: T, source: U): T & U;
    128128    _getFirstPointerId(evt: any): any;
    129129    releaseCanvas(...canvases: HTMLCanvasElement[]): void;
  • imaps-frontend/node_modules/konva/lib/Util.js

    rd565449 r0c6b92a  
    2828    }
    2929    point(point) {
    30         var m = this.m;
     30        const m = this.m;
    3131        return {
    3232            x: m[0] * point.x + m[2] * point.y + m[4],
     
    4747    }
    4848    rotate(rad) {
    49         var c = Math.cos(rad);
    50         var s = Math.sin(rad);
    51         var m11 = this.m[0] * c + this.m[2] * s;
    52         var m12 = this.m[1] * c + this.m[3] * s;
    53         var m21 = this.m[0] * -s + this.m[2] * c;
    54         var m22 = this.m[1] * -s + this.m[3] * c;
     49        const c = Math.cos(rad);
     50        const s = Math.sin(rad);
     51        const m11 = this.m[0] * c + this.m[2] * s;
     52        const m12 = this.m[1] * c + this.m[3] * s;
     53        const m21 = this.m[0] * -s + this.m[2] * c;
     54        const m22 = this.m[1] * -s + this.m[3] * c;
    5555        this.m[0] = m11;
    5656        this.m[1] = m12;
     
    6666    }
    6767    skew(sx, sy) {
    68         var m11 = this.m[0] + this.m[2] * sy;
    69         var m12 = this.m[1] + this.m[3] * sy;
    70         var m21 = this.m[2] + this.m[0] * sx;
    71         var m22 = this.m[3] + this.m[1] * sx;
     68        const m11 = this.m[0] + this.m[2] * sy;
     69        const m12 = this.m[1] + this.m[3] * sy;
     70        const m21 = this.m[2] + this.m[0] * sx;
     71        const m22 = this.m[3] + this.m[1] * sx;
    7272        this.m[0] = m11;
    7373        this.m[1] = m12;
     
    7777    }
    7878    multiply(matrix) {
    79         var m11 = this.m[0] * matrix.m[0] + this.m[2] * matrix.m[1];
    80         var m12 = this.m[1] * matrix.m[0] + this.m[3] * matrix.m[1];
    81         var m21 = this.m[0] * matrix.m[2] + this.m[2] * matrix.m[3];
    82         var m22 = this.m[1] * matrix.m[2] + this.m[3] * matrix.m[3];
    83         var dx = this.m[0] * matrix.m[4] + this.m[2] * matrix.m[5] + this.m[4];
    84         var dy = this.m[1] * matrix.m[4] + this.m[3] * matrix.m[5] + this.m[5];
     79        const m11 = this.m[0] * matrix.m[0] + this.m[2] * matrix.m[1];
     80        const m12 = this.m[1] * matrix.m[0] + this.m[3] * matrix.m[1];
     81        const m21 = this.m[0] * matrix.m[2] + this.m[2] * matrix.m[3];
     82        const m22 = this.m[1] * matrix.m[2] + this.m[3] * matrix.m[3];
     83        const dx = this.m[0] * matrix.m[4] + this.m[2] * matrix.m[5] + this.m[4];
     84        const dy = this.m[1] * matrix.m[4] + this.m[3] * matrix.m[5] + this.m[5];
    8585        this.m[0] = m11;
    8686        this.m[1] = m12;
     
    9292    }
    9393    invert() {
    94         var d = 1 / (this.m[0] * this.m[3] - this.m[1] * this.m[2]);
    95         var m0 = this.m[3] * d;
    96         var m1 = -this.m[1] * d;
    97         var m2 = -this.m[2] * d;
    98         var m3 = this.m[0] * d;
    99         var m4 = d * (this.m[2] * this.m[5] - this.m[3] * this.m[4]);
    100         var m5 = d * (this.m[1] * this.m[4] - this.m[0] * this.m[5]);
     94        const d = 1 / (this.m[0] * this.m[3] - this.m[1] * this.m[2]);
     95        const m0 = this.m[3] * d;
     96        const m1 = -this.m[1] * d;
     97        const m2 = -this.m[2] * d;
     98        const m3 = this.m[0] * d;
     99        const m4 = d * (this.m[2] * this.m[5] - this.m[3] * this.m[4]);
     100        const m5 = d * (this.m[1] * this.m[4] - this.m[0] * this.m[5]);
    101101        this.m[0] = m0;
    102102        this.m[1] = m1;
     
    111111    }
    112112    decompose() {
    113         var a = this.m[0];
    114         var b = this.m[1];
    115         var c = this.m[2];
    116         var d = this.m[3];
    117         var e = this.m[4];
    118         var f = this.m[5];
    119         var delta = a * d - b * c;
    120         let result = {
     113        const a = this.m[0];
     114        const b = this.m[1];
     115        const c = this.m[2];
     116        const d = this.m[3];
     117        const e = this.m[4];
     118        const f = this.m[5];
     119        const delta = a * d - b * c;
     120        const result = {
    121121            x: e,
    122122            y: f,
     
    128128        };
    129129        if (a != 0 || b != 0) {
    130             var r = Math.sqrt(a * a + b * b);
     130            const r = Math.sqrt(a * a + b * b);
    131131            result.rotation = b > 0 ? Math.acos(a / r) : -Math.acos(a / r);
    132132            result.scaleX = r;
     
    136136        }
    137137        else if (c != 0 || d != 0) {
    138             var s = Math.sqrt(c * c + d * d);
     138            const s = Math.sqrt(c * c + d * d);
    139139            result.rotation =
    140140                Math.PI / 2 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s));
     
    151151}
    152152exports.Transform = Transform;
    153 var OBJECT_ARRAY = '[object Array]', OBJECT_NUMBER = '[object Number]', OBJECT_STRING = '[object String]', OBJECT_BOOLEAN = '[object Boolean]', PI_OVER_DEG180 = Math.PI / 180, DEG180_OVER_PI = 180 / Math.PI, HASH = '#', EMPTY_STRING = '', ZERO = '0', KONVA_WARNING = 'Konva warning: ', KONVA_ERROR = 'Konva error: ', RGB_PAREN = 'rgb(', COLORS = {
     153let OBJECT_ARRAY = '[object Array]', OBJECT_NUMBER = '[object Number]', OBJECT_STRING = '[object String]', OBJECT_BOOLEAN = '[object Boolean]', PI_OVER_DEG180 = Math.PI / 180, DEG180_OVER_PI = 180 / Math.PI, HASH = '#', EMPTY_STRING = '', ZERO = '0', KONVA_WARNING = 'Konva warning: ', KONVA_ERROR = 'Konva error: ', RGB_PAREN = 'rgb(', COLORS = {
    154154    aliceblue: [240, 248, 255],
    155155    antiquewhite: [250, 235, 215],
     
    337337            return false;
    338338        }
    339         var firstChar = selector[0];
     339        const firstChar = selector[0];
    340340        return (firstChar === '#' ||
    341341            firstChar === '.' ||
     
    366366    },
    367367    createCanvasElement() {
    368         var canvas = document.createElement('canvas');
     368        const canvas = document.createElement('canvas');
    369369        try {
    370370            canvas.style = canvas.style || {};
     
    385385    },
    386386    _urlToImage(url, callback) {
    387         var imageObj = exports.Util.createImageElement();
     387        const imageObj = exports.Util.createImageElement();
    388388        imageObj.onload = function () {
    389389            callback(imageObj);
     
    396396    _hexToRgb(hex) {
    397397        hex = hex.replace(HASH, EMPTY_STRING);
    398         var bigint = parseInt(hex, 16);
     398        const bigint = parseInt(hex, 16);
    399399        return {
    400400            r: (bigint >> 16) & 255,
     
    404404    },
    405405    getRandomColor() {
    406         var randColor = ((Math.random() * 0xffffff) << 0).toString(16);
     406        let randColor = ((Math.random() * 0xffffff) << 0).toString(16);
    407407        while (randColor.length < 6) {
    408408            randColor = ZERO + randColor;
     
    411411    },
    412412    getRGB(color) {
    413         var rgb;
     413        let rgb;
    414414        if (color in COLORS) {
    415415            rgb = COLORS[color];
     
    451451    },
    452452    _namedColorToRBA(str) {
    453         var c = COLORS[str.toLowerCase()];
     453        const c = COLORS[str.toLowerCase()];
    454454        if (!c) {
    455455            return null;
     
    465465        if (str.indexOf('rgb(') === 0) {
    466466            str = str.match(/rgb\(([^)]+)\)/)[1];
    467             var parts = str.split(/ *, */).map(Number);
     467            const parts = str.split(/ *, */).map(Number);
    468468            return {
    469469                r: parts[0],
     
    477477        if (str.indexOf('rgba(') === 0) {
    478478            str = str.match(/rgba\(([^)]+)\)/)[1];
    479             var parts = str.split(/ *, */).map((n, index) => {
     479            const parts = str.split(/ *, */).map((n, index) => {
    480480                if (n.slice(-1) === '%') {
    481481                    return index === 3 ? parseInt(n) / 100 : (parseInt(n) / 100) * 255;
     
    594594    },
    595595    cloneObject(obj) {
    596         var retObj = {};
    597         for (var key in obj) {
     596        const retObj = {};
     597        for (const key in obj) {
    598598            if (this._isPlainObject(obj[key])) {
    599599                retObj[key] = this.cloneObject(obj[key]);
     
    644644    },
    645645    each(obj, func) {
    646         for (var key in obj) {
     646        for (const key in obj) {
    647647            func(key, obj[key]);
    648648        }
     
    652652    },
    653653    _getProjectionToSegment(x1, y1, x2, y2, x3, y3) {
    654         var x, y, dist;
    655         var pd2 = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
     654        let x, y, dist;
     655        const pd2 = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
    656656        if (pd2 == 0) {
    657657            x = x1;
     
    660660        }
    661661        else {
    662             var u = ((x3 - x1) * (x2 - x1) + (y3 - y1) * (y2 - y1)) / pd2;
     662            const u = ((x3 - x1) * (x2 - x1) + (y3 - y1) * (y2 - y1)) / pd2;
    663663            if (u < 0) {
    664664                x = x1;
     
    680680    },
    681681    _getProjectionToLine(pt, line, isClosed) {
    682         var pc = exports.Util.cloneObject(pt);
    683         var dist = Number.MAX_VALUE;
     682        const pc = exports.Util.cloneObject(pt);
     683        let dist = Number.MAX_VALUE;
    684684        line.forEach(function (p1, i) {
    685685            if (!isClosed && i === line.length - 1) {
    686686                return;
    687687            }
    688             var p2 = line[(i + 1) % line.length];
    689             var proj = exports.Util._getProjectionToSegment(p1.x, p1.y, p2.x, p2.y, pt.x, pt.y);
    690             var px = proj[0], py = proj[1], pdist = proj[2];
     688            const p2 = line[(i + 1) % line.length];
     689            const proj = exports.Util._getProjectionToSegment(p1.x, p1.y, p2.x, p2.y, pt.x, pt.y);
     690            const px = proj[0], py = proj[1], pdist = proj[2];
    691691            if (pdist < dist) {
    692692                pc.x = px;
     
    698698    },
    699699    _prepareArrayForTween(startArray, endArray, isClosed) {
    700         var n, start = [], end = [];
     700        let n, start = [], end = [];
    701701        if (startArray.length > endArray.length) {
    702             var temp = endArray;
     702            const temp = endArray;
    703703            endArray = startArray;
    704704            startArray = temp;
     
    716716            });
    717717        }
    718         var newStart = [];
     718        const newStart = [];
    719719        end.forEach(function (point) {
    720             var pr = exports.Util._getProjectionToLine(point, start, isClosed);
     720            const pr = exports.Util._getProjectionToLine(point, start, isClosed);
    721721            newStart.push(pr.x);
    722722            newStart.push(pr.y);
     
    725725    },
    726726    _prepareToStringify(obj) {
    727         var desc;
     727        let desc;
    728728        obj.visitedByCircularReferenceRemoval = true;
    729         for (var key in obj) {
     729        for (const key in obj) {
    730730            if (!(obj.hasOwnProperty(key) && obj[key] && typeof obj[key] == 'object')) {
    731731                continue;
     
    754754    },
    755755    _assign(target, source) {
    756         for (var key in source) {
     756        for (const key in source) {
    757757            target[key] = source[key];
    758758        }
  • imaps-frontend/node_modules/konva/lib/Validators.js

    rd565449 r0c6b92a  
    11"use strict";
    22Object.defineProperty(exports, "__esModule", { value: true });
    3 exports.getComponentValidator = exports.getBooleanValidator = exports.getNumberArrayValidator = exports.getFunctionValidator = exports.getStringOrGradientValidator = exports.getStringValidator = exports.getNumberOrAutoValidator = exports.getNumberOrArrayOfNumbersValidator = exports.getNumberValidator = exports.alphaComponent = exports.RGBComponent = void 0;
     3exports.RGBComponent = RGBComponent;
     4exports.alphaComponent = alphaComponent;
     5exports.getNumberValidator = getNumberValidator;
     6exports.getNumberOrArrayOfNumbersValidator = getNumberOrArrayOfNumbersValidator;
     7exports.getNumberOrAutoValidator = getNumberOrAutoValidator;
     8exports.getStringValidator = getStringValidator;
     9exports.getStringOrGradientValidator = getStringOrGradientValidator;
     10exports.getFunctionValidator = getFunctionValidator;
     11exports.getNumberArrayValidator = getNumberArrayValidator;
     12exports.getBooleanValidator = getBooleanValidator;
     13exports.getComponentValidator = getComponentValidator;
    414const Global_1 = require("./Global");
    515const Util_1 = require("./Util");
     
    2535    return Math.round(val);
    2636}
    27 exports.RGBComponent = RGBComponent;
    2837function alphaComponent(val) {
    2938    if (val > 1) {
     
    3544    return val;
    3645}
    37 exports.alphaComponent = alphaComponent;
    3846function getNumberValidator() {
    3947    if (Global_1.Konva.isUnminified) {
     
    4957    }
    5058}
    51 exports.getNumberValidator = getNumberValidator;
    5259function getNumberOrArrayOfNumbersValidator(noOfElements) {
    5360    if (Global_1.Konva.isUnminified) {
    5461        return function (val, attr) {
    55             let isNumber = Util_1.Util._isNumber(val);
    56             let isValidArray = Util_1.Util._isArray(val) && val.length == noOfElements;
     62            const isNumber = Util_1.Util._isNumber(val);
     63            const isValidArray = Util_1.Util._isArray(val) && val.length == noOfElements;
    5764            if (!isNumber && !isValidArray) {
    5865                Util_1.Util.warn(_formatValue(val) +
     
    6774    }
    6875}
    69 exports.getNumberOrArrayOfNumbersValidator = getNumberOrArrayOfNumbersValidator;
    7076function getNumberOrAutoValidator() {
    7177    if (Global_1.Konva.isUnminified) {
    7278        return function (val, attr) {
    73             var isNumber = Util_1.Util._isNumber(val);
    74             var isAuto = val === 'auto';
     79            const isNumber = Util_1.Util._isNumber(val);
     80            const isAuto = val === 'auto';
    7581            if (!(isNumber || isAuto)) {
    7682                Util_1.Util.warn(_formatValue(val) +
     
    8389    }
    8490}
    85 exports.getNumberOrAutoValidator = getNumberOrAutoValidator;
    8691function getStringValidator() {
    8792    if (Global_1.Konva.isUnminified) {
     
    97102    }
    98103}
    99 exports.getStringValidator = getStringValidator;
    100104function getStringOrGradientValidator() {
    101105    if (Global_1.Konva.isUnminified) {
     
    114118    }
    115119}
    116 exports.getStringOrGradientValidator = getStringOrGradientValidator;
    117120function getFunctionValidator() {
    118121    if (Global_1.Konva.isUnminified) {
     
    128131    }
    129132}
    130 exports.getFunctionValidator = getFunctionValidator;
    131133function getNumberArrayValidator() {
    132134    if (Global_1.Konva.isUnminified) {
     
    157159    }
    158160}
    159 exports.getNumberArrayValidator = getNumberArrayValidator;
    160161function getBooleanValidator() {
    161162    if (Global_1.Konva.isUnminified) {
    162163        return function (val, attr) {
    163             var isBool = val === true || val === false;
     164            const isBool = val === true || val === false;
    164165            if (!isBool) {
    165166                Util_1.Util.warn(_formatValue(val) +
     
    172173    }
    173174}
    174 exports.getBooleanValidator = getBooleanValidator;
    175175function getComponentValidator(components) {
    176176    if (Global_1.Konva.isUnminified) {
     
    190190    }
    191191}
    192 exports.getComponentValidator = getComponentValidator;
  • imaps-frontend/node_modules/konva/lib/_CoreInternals.d.ts

    rd565449 r0c6b92a  
    4949        _isFunction(obj: any): boolean;
    5050        _isPlainObject(obj: any): boolean;
    51         _isArray(obj: any): obj is any[];
     51        _isArray(obj: any): obj is Array<any>;
    5252        _isNumber(obj: any): obj is number;
    5353        _isString(obj: any): obj is string;
    5454        _isBoolean(obj: any): obj is boolean;
    55         isObject(val: any): val is Object;
     55        isObject(val: any): val is object;
    5656        isValidSelector(selector: any): boolean;
    5757        _sign(number: number): 1 | -1;
     
    121121        haveIntersection(r1: import("./types").IRect, r2: import("./types.js").IRect): boolean;
    122122        cloneObject<Any>(obj: Any): Any;
    123         cloneArray(arr: any[]): any[];
     123        cloneArray(arr: Array<any>): any[];
    124124        degToRad(deg: number): number;
    125125        radToDeg(rad: number): number;
     
    131131        error(str: string): void;
    132132        warn(str: string): void;
    133         each(obj: Object, func: Function): void;
     133        each(obj: object, func: Function): void;
    134134        _inRange(val: number, left: number, right: number): boolean;
    135135        _getProjectionToSegment(x1: any, y1: any, x2: any, y2: any, x3: any, y3: any): any[];
    136         _getProjectionToLine(pt: import("./types").Vector2d, line: import("./types").Vector2d[], isClosed: boolean): import("./types.js").Vector2d;
     136        _getProjectionToLine(pt: import("./types").Vector2d, line: Array<import("./types").Vector2d>, isClosed: boolean): import("./types.js").Vector2d;
    137137        _prepareArrayForTween(startArray: any, endArray: any, isClosed: any): number[];
    138138        _prepareToStringify<T>(obj: any): T | null;
    139         _assign<T_1, U>(target: T_1, source: U): T_1 & U;
     139        _assign<T, U>(target: T, source: U): T & U;
    140140        _getFirstPointerId(evt: any): any;
    141141        releaseCanvas(...canvases: HTMLCanvasElement[]): void;
     
    155155        readonly node: Node<import("./Node.js").NodeConfig> | undefined;
    156156        _dragElements: Map<number, {
    157             node: Node<import("./Node.js").NodeConfig>;
     157            node: Node;
    158158            startPointerPos: import("./types.js").Vector2d;
    159159            offset: import("./types.js").Vector2d;
    160             pointerId?: number | undefined;
     160            pointerId?: number;
    161161            dragStatus: "ready" | "dragging" | "stopped";
    162162        }>;
  • imaps-frontend/node_modules/konva/lib/_FullInternals.d.ts

    rd565449 r0c6b92a  
    5454        _isFunction(obj: any): boolean;
    5555        _isPlainObject(obj: any): boolean;
    56         _isArray(obj: any): obj is any[];
     56        _isArray(obj: any): obj is Array<any>;
    5757        _isNumber(obj: any): obj is number;
    5858        _isString(obj: any): obj is string;
    5959        _isBoolean(obj: any): obj is boolean;
    60         isObject(val: any): val is Object;
     60        isObject(val: any): val is object;
    6161        isValidSelector(selector: any): boolean;
    6262        _sign(number: number): 1 | -1;
     
    126126        haveIntersection(r1: import("./types").IRect, r2: import("./types.js").IRect): boolean;
    127127        cloneObject<Any>(obj: Any): Any;
    128         cloneArray(arr: any[]): any[];
     128        cloneArray(arr: Array<any>): any[];
    129129        degToRad(deg: number): number;
    130130        radToDeg(rad: number): number;
     
    136136        error(str: string): void;
    137137        warn(str: string): void;
    138         each(obj: Object, func: Function): void;
     138        each(obj: object, func: Function): void;
    139139        _inRange(val: number, left: number, right: number): boolean;
    140140        _getProjectionToSegment(x1: any, y1: any, x2: any, y2: any, x3: any, y3: any): any[];
    141         _getProjectionToLine(pt: import("./types").Vector2d, line: import("./types").Vector2d[], isClosed: boolean): import("./types.js").Vector2d;
     141        _getProjectionToLine(pt: import("./types").Vector2d, line: Array<import("./types").Vector2d>, isClosed: boolean): import("./types.js").Vector2d;
    142142        _prepareArrayForTween(startArray: any, endArray: any, isClosed: any): number[];
    143143        _prepareToStringify<T>(obj: any): T | null;
    144         _assign<T_1, U>(target: T_1, source: U): T_1 & U;
     144        _assign<T, U>(target: T, source: U): T & U;
    145145        _getFirstPointerId(evt: any): any;
    146146        releaseCanvas(...canvases: HTMLCanvasElement[]): void;
     
    160160        readonly node: import("./Node").Node<import("./Node.js").NodeConfig> | undefined;
    161161        _dragElements: Map<number, {
    162             node: import("./Node").Node<import("./Node.js").NodeConfig>;
     162            node: import("./Node.js").Node;
    163163            startPointerPos: import("./types.js").Vector2d;
    164164            offset: import("./types.js").Vector2d;
    165             pointerId?: number | undefined;
     165            pointerId?: number;
    166166            dragStatus: "ready" | "dragging" | "stopped";
    167167        }>;
  • imaps-frontend/node_modules/konva/lib/filters/Blur.js

    rd565449 r0c6b92a  
    1212    this.next = null;
    1313}
    14 var mul_table = [
     14const mul_table = [
    1515    512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292,
    1616    512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292,
     
    3131    289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259,
    3232];
    33 var shg_table = [
     33const shg_table = [
    3434    9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17,
    3535    17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19,
     
    4848];
    4949function filterGaussBlurRGBA(imageData, radius) {
    50     var pixels = imageData.data, width = imageData.width, height = imageData.height;
    51     var x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum, a_sum, r_out_sum, g_out_sum, b_out_sum, a_out_sum, r_in_sum, g_in_sum, b_in_sum, a_in_sum, pr, pg, pb, pa, rbs;
    52     var div = radius + radius + 1, widthMinus1 = width - 1, heightMinus1 = height - 1, radiusPlus1 = radius + 1, sumFactor = (radiusPlus1 * (radiusPlus1 + 1)) / 2, stackStart = new BlurStack(), stackEnd = null, stack = stackStart, stackIn = null, stackOut = null, mul_sum = mul_table[radius], shg_sum = shg_table[radius];
     50    const pixels = imageData.data, width = imageData.width, height = imageData.height;
     51    let x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum, a_sum, r_out_sum, g_out_sum, b_out_sum, a_out_sum, r_in_sum, g_in_sum, b_in_sum, a_in_sum, pr, pg, pb, pa, rbs;
     52    let div = radius + radius + 1, widthMinus1 = width - 1, heightMinus1 = height - 1, radiusPlus1 = radius + 1, sumFactor = (radiusPlus1 * (radiusPlus1 + 1)) / 2, stackStart = new BlurStack(), stackEnd = null, stack = stackStart, stackIn = null, stackOut = null, mul_sum = mul_table[radius], shg_sum = shg_table[radius];
    5353    for (i = 1; i < div; i++) {
    5454        stack = stack.next = new BlurStack();
     
    230230}
    231231const Blur = function Blur(imageData) {
    232     var radius = Math.round(this.blurRadius());
     232    const radius = Math.round(this.blurRadius());
    233233    if (radius > 0) {
    234234        filterGaussBlurRGBA(imageData, radius);
  • imaps-frontend/node_modules/konva/lib/filters/Brighten.js

    rd565449 r0c6b92a  
    66const Validators_1 = require("../Validators");
    77const Brighten = function (imageData) {
    8     var brightness = this.brightness() * 255, data = imageData.data, len = data.length, i;
     8    let brightness = this.brightness() * 255, data = imageData.data, len = data.length, i;
    99    for (i = 0; i < len; i += 4) {
    1010        data[i] += brightness;
  • imaps-frontend/node_modules/konva/lib/filters/Contrast.js

    rd565449 r0c6b92a  
    66const Validators_1 = require("../Validators");
    77const Contrast = function (imageData) {
    8     var adjust = Math.pow((this.contrast() + 100) / 100, 2);
    9     var data = imageData.data, nPixels = data.length, red = 150, green = 150, blue = 150, i;
     8    const adjust = Math.pow((this.contrast() + 100) / 100, 2);
     9    let data = imageData.data, nPixels = data.length, red = 150, green = 150, blue = 150, i;
    1010    for (i = 0; i < nPixels; i += 4) {
    1111        red = data[i];
  • imaps-frontend/node_modules/konva/lib/filters/Emboss.js

    rd565449 r0c6b92a  
    77const Validators_1 = require("../Validators");
    88const Emboss = function (imageData) {
    9     var strength = this.embossStrength() * 10, greyLevel = this.embossWhiteLevel() * 255, direction = this.embossDirection(), blend = this.embossBlend(), dirY = 0, dirX = 0, data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4, y = h;
     9    let strength = this.embossStrength() * 10, greyLevel = this.embossWhiteLevel() * 255, direction = this.embossDirection(), blend = this.embossBlend(), dirY = 0, dirX = 0, data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4, y = h;
    1010    switch (direction) {
    1111        case 'top-left':
     
    4545    }
    4646    do {
    47         var offsetY = (y - 1) * w4;
    48         var otherY = dirY;
     47        const offsetY = (y - 1) * w4;
     48        let otherY = dirY;
    4949        if (y + otherY < 1) {
    5050            otherY = 0;
     
    5353            otherY = 0;
    5454        }
    55         var offsetYOther = (y - 1 + otherY) * w * 4;
    56         var x = w;
     55        const offsetYOther = (y - 1 + otherY) * w * 4;
     56        let x = w;
    5757        do {
    58             var offset = offsetY + (x - 1) * 4;
    59             var otherX = dirX;
     58            const offset = offsetY + (x - 1) * 4;
     59            let otherX = dirX;
    6060            if (x + otherX < 1) {
    6161                otherX = 0;
     
    6464                otherX = 0;
    6565            }
    66             var offsetOther = offsetYOther + (x - 1 + otherX) * 4;
    67             var dR = data[offset] - data[offsetOther];
    68             var dG = data[offset + 1] - data[offsetOther + 1];
    69             var dB = data[offset + 2] - data[offsetOther + 2];
    70             var dif = dR;
    71             var absDif = dif > 0 ? dif : -dif;
    72             var absG = dG > 0 ? dG : -dG;
    73             var absB = dB > 0 ? dB : -dB;
     66            const offsetOther = offsetYOther + (x - 1 + otherX) * 4;
     67            const dR = data[offset] - data[offsetOther];
     68            const dG = data[offset + 1] - data[offsetOther + 1];
     69            const dB = data[offset + 2] - data[offsetOther + 2];
     70            let dif = dR;
     71            const absDif = dif > 0 ? dif : -dif;
     72            const absG = dG > 0 ? dG : -dG;
     73            const absB = dB > 0 ? dB : -dB;
    7474            if (absG > absDif) {
    7575                dif = dG;
     
    8080            dif *= strength;
    8181            if (blend) {
    82                 var r = data[offset] + dif;
    83                 var g = data[offset + 1] + dif;
    84                 var b = data[offset + 2] + dif;
     82                const r = data[offset] + dif;
     83                const g = data[offset + 1] + dif;
     84                const b = data[offset + 2] + dif;
    8585                data[offset] = r > 255 ? 255 : r < 0 ? 0 : r;
    8686                data[offset + 1] = g > 255 ? 255 : g < 0 ? 0 : g;
     
    8888            }
    8989            else {
    90                 var grey = greyLevel - dif;
     90                let grey = greyLevel - dif;
    9191                if (grey < 0) {
    9292                    grey = 0;
  • imaps-frontend/node_modules/konva/lib/filters/Enhance.js

    rd565449 r0c6b92a  
    66const Validators_1 = require("../Validators");
    77function remap(fromValue, fromMin, fromMax, toMin, toMax) {
    8     var fromRange = fromMax - fromMin, toRange = toMax - toMin, toValue;
     8    let fromRange = fromMax - fromMin, toRange = toMax - toMin, toValue;
    99    if (fromRange === 0) {
    1010        return toMin + toRange / 2;
     
    1818}
    1919const Enhance = function (imageData) {
    20     var data = imageData.data, nSubPixels = data.length, rMin = data[0], rMax = rMin, r, gMin = data[1], gMax = gMin, g, bMin = data[2], bMax = bMin, b, i;
    21     var enhanceAmount = this.enhance();
     20    let data = imageData.data, nSubPixels = data.length, rMin = data[0], rMax = rMin, r, gMin = data[1], gMax = gMin, g, bMin = data[2], bMax = bMin, b, i;
     21    const enhanceAmount = this.enhance();
    2222    if (enhanceAmount === 0) {
    2323        return;
     
    5858        bMin = 0;
    5959    }
    60     var rMid, rGoalMax, rGoalMin, gMid, gGoalMax, gGoalMin, bMid, bGoalMax, bGoalMin;
     60    let rMid, rGoalMax, rGoalMin, gMid, gGoalMax, gGoalMin, bMid, bGoalMax, bGoalMin;
    6161    if (enhanceAmount > 0) {
    6262        rGoalMax = rMax + enhanceAmount * (255 - rMax);
  • imaps-frontend/node_modules/konva/lib/filters/Grayscale.js

    rd565449 r0c6b92a  
    33exports.Grayscale = void 0;
    44const Grayscale = function (imageData) {
    5     var data = imageData.data, len = data.length, i, brightness;
     5    let data = imageData.data, len = data.length, i, brightness;
    66    for (i = 0; i < len; i += 4) {
    77        brightness = 0.34 * data[i] + 0.5 * data[i + 1] + 0.16 * data[i + 2];
  • imaps-frontend/node_modules/konva/lib/filters/HSL.js

    rd565449 r0c6b92a  
    99Factory_1.Factory.addGetterSetter(Node_1.Node, 'luminance', 0, (0, Validators_1.getNumberValidator)(), Factory_1.Factory.afterSetFilter);
    1010const HSL = function (imageData) {
    11     var data = imageData.data, nPixels = data.length, v = 1, s = Math.pow(2, this.saturation()), h = Math.abs(this.hue() + 360) % 360, l = this.luminance() * 127, i;
    12     var vsu = v * s * Math.cos((h * Math.PI) / 180), vsw = v * s * Math.sin((h * Math.PI) / 180);
    13     var rr = 0.299 * v + 0.701 * vsu + 0.167 * vsw, rg = 0.587 * v - 0.587 * vsu + 0.33 * vsw, rb = 0.114 * v - 0.114 * vsu - 0.497 * vsw;
    14     var gr = 0.299 * v - 0.299 * vsu - 0.328 * vsw, gg = 0.587 * v + 0.413 * vsu + 0.035 * vsw, gb = 0.114 * v - 0.114 * vsu + 0.293 * vsw;
    15     var br = 0.299 * v - 0.3 * vsu + 1.25 * vsw, bg = 0.587 * v - 0.586 * vsu - 1.05 * vsw, bb = 0.114 * v + 0.886 * vsu - 0.2 * vsw;
    16     var r, g, b, a;
     11    let data = imageData.data, nPixels = data.length, v = 1, s = Math.pow(2, this.saturation()), h = Math.abs(this.hue() + 360) % 360, l = this.luminance() * 127, i;
     12    const vsu = v * s * Math.cos((h * Math.PI) / 180), vsw = v * s * Math.sin((h * Math.PI) / 180);
     13    const rr = 0.299 * v + 0.701 * vsu + 0.167 * vsw, rg = 0.587 * v - 0.587 * vsu + 0.33 * vsw, rb = 0.114 * v - 0.114 * vsu - 0.497 * vsw;
     14    const gr = 0.299 * v - 0.299 * vsu - 0.328 * vsw, gg = 0.587 * v + 0.413 * vsu + 0.035 * vsw, gb = 0.114 * v - 0.114 * vsu + 0.293 * vsw;
     15    const br = 0.299 * v - 0.3 * vsu + 1.25 * vsw, bg = 0.587 * v - 0.586 * vsu - 1.05 * vsw, bb = 0.114 * v + 0.886 * vsu - 0.2 * vsw;
     16    let r, g, b, a;
    1717    for (i = 0; i < nPixels; i += 4) {
    1818        r = data[i + 0];
  • imaps-frontend/node_modules/konva/lib/filters/HSV.js

    rd565449 r0c6b92a  
    66const Validators_1 = require("../Validators");
    77const HSV = function (imageData) {
    8     var data = imageData.data, nPixels = data.length, v = Math.pow(2, this.value()), s = Math.pow(2, this.saturation()), h = Math.abs(this.hue() + 360) % 360, i;
    9     var vsu = v * s * Math.cos((h * Math.PI) / 180), vsw = v * s * Math.sin((h * Math.PI) / 180);
    10     var rr = 0.299 * v + 0.701 * vsu + 0.167 * vsw, rg = 0.587 * v - 0.587 * vsu + 0.33 * vsw, rb = 0.114 * v - 0.114 * vsu - 0.497 * vsw;
    11     var gr = 0.299 * v - 0.299 * vsu - 0.328 * vsw, gg = 0.587 * v + 0.413 * vsu + 0.035 * vsw, gb = 0.114 * v - 0.114 * vsu + 0.293 * vsw;
    12     var br = 0.299 * v - 0.3 * vsu + 1.25 * vsw, bg = 0.587 * v - 0.586 * vsu - 1.05 * vsw, bb = 0.114 * v + 0.886 * vsu - 0.2 * vsw;
    13     var r, g, b, a;
    14     for (i = 0; i < nPixels; i += 4) {
     8    const data = imageData.data, nPixels = data.length, v = Math.pow(2, this.value()), s = Math.pow(2, this.saturation()), h = Math.abs(this.hue() + 360) % 360;
     9    const vsu = v * s * Math.cos((h * Math.PI) / 180), vsw = v * s * Math.sin((h * Math.PI) / 180);
     10    const rr = 0.299 * v + 0.701 * vsu + 0.167 * vsw, rg = 0.587 * v - 0.587 * vsu + 0.33 * vsw, rb = 0.114 * v - 0.114 * vsu - 0.497 * vsw;
     11    const gr = 0.299 * v - 0.299 * vsu - 0.328 * vsw, gg = 0.587 * v + 0.413 * vsu + 0.035 * vsw, gb = 0.114 * v - 0.114 * vsu + 0.293 * vsw;
     12    const br = 0.299 * v - 0.3 * vsu + 1.25 * vsw, bg = 0.587 * v - 0.586 * vsu - 1.05 * vsw, bb = 0.114 * v + 0.886 * vsu - 0.2 * vsw;
     13    let r, g, b, a;
     14    for (let i = 0; i < nPixels; i += 4) {
    1515        r = data[i + 0];
    1616        g = data[i + 1];
  • imaps-frontend/node_modules/konva/lib/filters/Invert.js

    rd565449 r0c6b92a  
    33exports.Invert = void 0;
    44const Invert = function (imageData) {
    5     var data = imageData.data, len = data.length, i;
     5    let data = imageData.data, len = data.length, i;
    66    for (i = 0; i < len; i += 4) {
    77        data[i] = 255 - data[i];
  • imaps-frontend/node_modules/konva/lib/filters/Kaleidoscope.js

    rd565449 r0c6b92a  
    66const Util_1 = require("../Util");
    77const Validators_1 = require("../Validators");
    8 var ToPolar = function (src, dst, opt) {
    9     var srcPixels = src.data, dstPixels = dst.data, xSize = src.width, ySize = src.height, xMid = opt.polarCenterX || xSize / 2, yMid = opt.polarCenterY || ySize / 2, i, x, y, r = 0, g = 0, b = 0, a = 0;
    10     var rad, rMax = Math.sqrt(xMid * xMid + yMid * yMid);
     8const ToPolar = function (src, dst, opt) {
     9    let srcPixels = src.data, dstPixels = dst.data, xSize = src.width, ySize = src.height, xMid = opt.polarCenterX || xSize / 2, yMid = opt.polarCenterY || ySize / 2, i, x, y, r = 0, g = 0, b = 0, a = 0;
     10    let rad, rMax = Math.sqrt(xMid * xMid + yMid * yMid);
    1111    x = xSize - xMid;
    1212    y = ySize - yMid;
    1313    rad = Math.sqrt(x * x + y * y);
    1414    rMax = rad > rMax ? rad : rMax;
    15     var rSize = ySize, tSize = xSize, radius, theta;
    16     var conversion = ((360 / tSize) * Math.PI) / 180, sin, cos;
     15    let rSize = ySize, tSize = xSize, radius, theta;
     16    let conversion = ((360 / tSize) * Math.PI) / 180, sin, cos;
    1717    for (theta = 0; theta < tSize; theta += 1) {
    1818        sin = Math.sin(theta * conversion);
     
    3434    }
    3535};
    36 var FromPolar = function (src, dst, opt) {
    37     var srcPixels = src.data, dstPixels = dst.data, xSize = src.width, ySize = src.height, xMid = opt.polarCenterX || xSize / 2, yMid = opt.polarCenterY || ySize / 2, i, x, y, dx, dy, r = 0, g = 0, b = 0, a = 0;
    38     var rad, rMax = Math.sqrt(xMid * xMid + yMid * yMid);
     36const FromPolar = function (src, dst, opt) {
     37    let srcPixels = src.data, dstPixels = dst.data, xSize = src.width, ySize = src.height, xMid = opt.polarCenterX || xSize / 2, yMid = opt.polarCenterY || ySize / 2, i, x, y, dx, dy, r = 0, g = 0, b = 0, a = 0;
     38    let rad, rMax = Math.sqrt(xMid * xMid + yMid * yMid);
    3939    x = xSize - xMid;
    4040    y = ySize - yMid;
    4141    rad = Math.sqrt(x * x + y * y);
    4242    rMax = rad > rMax ? rad : rMax;
    43     var rSize = ySize, tSize = xSize, radius, theta, phaseShift = opt.polarRotation || 0;
    44     var x1, y1;
     43    let rSize = ySize, tSize = xSize, radius, theta, phaseShift = opt.polarRotation || 0;
     44    let x1, y1;
    4545    for (x = 0; x < xSize; x += 1) {
    4646        for (y = 0; y < ySize; y += 1) {
     
    6666};
    6767const Kaleidoscope = function (imageData) {
    68     var xSize = imageData.width, ySize = imageData.height;
    69     var x, y, xoff, i, r, g, b, a, srcPos, dstPos;
    70     var power = Math.round(this.kaleidoscopePower());
    71     var angle = Math.round(this.kaleidoscopeAngle());
    72     var offset = Math.floor((xSize * (angle % 360)) / 360);
     68    const xSize = imageData.width, ySize = imageData.height;
     69    let x, y, xoff, i, r, g, b, a, srcPos, dstPos;
     70    let power = Math.round(this.kaleidoscopePower());
     71    const angle = Math.round(this.kaleidoscopeAngle());
     72    const offset = Math.floor((xSize * (angle % 360)) / 360);
    7373    if (power < 1) {
    7474        return;
    7575    }
    76     var tempCanvas = Util_1.Util.createCanvasElement();
     76    const tempCanvas = Util_1.Util.createCanvasElement();
    7777    tempCanvas.width = xSize;
    7878    tempCanvas.height = ySize;
    79     var scratchData = tempCanvas
     79    const scratchData = tempCanvas
    8080        .getContext('2d')
    8181        .getImageData(0, 0, xSize, ySize);
     
    8585        polarCenterY: ySize / 2,
    8686    });
    87     var minSectionSize = xSize / Math.pow(2, power);
     87    let minSectionSize = xSize / Math.pow(2, power);
    8888    while (minSectionSize <= 8) {
    8989        minSectionSize = minSectionSize * 2;
     
    9191    }
    9292    minSectionSize = Math.ceil(minSectionSize);
    93     var sectionSize = minSectionSize;
    94     var xStart = 0, xEnd = sectionSize, xDelta = 1;
     93    let sectionSize = minSectionSize;
     94    let xStart = 0, xEnd = sectionSize, xDelta = 1;
    9595    if (offset + minSectionSize > xSize) {
    9696        xStart = sectionSize;
  • imaps-frontend/node_modules/konva/lib/filters/Mask.js

    rd565449 r0c6b92a  
    66const Validators_1 = require("../Validators");
    77function pixelAt(idata, x, y) {
    8     var idx = (y * idata.width + x) * 4;
    9     var d = [];
     8    let idx = (y * idata.width + x) * 4;
     9    const d = [];
    1010    d.push(idata.data[idx++], idata.data[idx++], idata.data[idx++], idata.data[idx++]);
    1111    return d;
     
    1717}
    1818function rgbMean(pTab) {
    19     var m = [0, 0, 0];
    20     for (var i = 0; i < pTab.length; i++) {
     19    const m = [0, 0, 0];
     20    for (let i = 0; i < pTab.length; i++) {
    2121        m[0] += pTab[i][0];
    2222        m[1] += pTab[i][1];
     
    2929}
    3030function backgroundMask(idata, threshold) {
    31     var rgbv_no = pixelAt(idata, 0, 0);
    32     var rgbv_ne = pixelAt(idata, idata.width - 1, 0);
    33     var rgbv_so = pixelAt(idata, 0, idata.height - 1);
    34     var rgbv_se = pixelAt(idata, idata.width - 1, idata.height - 1);
    35     var thres = threshold || 10;
     31    const rgbv_no = pixelAt(idata, 0, 0);
     32    const rgbv_ne = pixelAt(idata, idata.width - 1, 0);
     33    const rgbv_so = pixelAt(idata, 0, idata.height - 1);
     34    const rgbv_se = pixelAt(idata, idata.width - 1, idata.height - 1);
     35    const thres = threshold || 10;
    3636    if (rgbDistance(rgbv_no, rgbv_ne) < thres &&
    3737        rgbDistance(rgbv_ne, rgbv_se) < thres &&
    3838        rgbDistance(rgbv_se, rgbv_so) < thres &&
    3939        rgbDistance(rgbv_so, rgbv_no) < thres) {
    40         var mean = rgbMean([rgbv_ne, rgbv_no, rgbv_se, rgbv_so]);
    41         var mask = [];
    42         for (var i = 0; i < idata.width * idata.height; i++) {
    43             var d = rgbDistance(mean, [
     40        const mean = rgbMean([rgbv_ne, rgbv_no, rgbv_se, rgbv_so]);
     41        const mask = [];
     42        for (let i = 0; i < idata.width * idata.height; i++) {
     43            const d = rgbDistance(mean, [
    4444                idata.data[i * 4],
    4545                idata.data[i * 4 + 1],
     
    5252}
    5353function applyMask(idata, mask) {
    54     for (var i = 0; i < idata.width * idata.height; i++) {
     54    for (let i = 0; i < idata.width * idata.height; i++) {
    5555        idata.data[4 * i + 3] = mask[i];
    5656    }
    5757}
    5858function erodeMask(mask, sw, sh) {
    59     var weights = [1, 1, 1, 1, 0, 1, 1, 1, 1];
    60     var side = Math.round(Math.sqrt(weights.length));
    61     var halfSide = Math.floor(side / 2);
    62     var maskResult = [];
    63     for (var y = 0; y < sh; y++) {
    64         for (var x = 0; x < sw; x++) {
    65             var so = y * sw + x;
    66             var a = 0;
    67             for (var cy = 0; cy < side; cy++) {
    68                 for (var cx = 0; cx < side; cx++) {
    69                     var scy = y + cy - halfSide;
    70                     var scx = x + cx - halfSide;
     59    const weights = [1, 1, 1, 1, 0, 1, 1, 1, 1];
     60    const side = Math.round(Math.sqrt(weights.length));
     61    const halfSide = Math.floor(side / 2);
     62    const maskResult = [];
     63    for (let y = 0; y < sh; y++) {
     64        for (let x = 0; x < sw; x++) {
     65            const so = y * sw + x;
     66            let a = 0;
     67            for (let cy = 0; cy < side; cy++) {
     68                for (let cx = 0; cx < side; cx++) {
     69                    const scy = y + cy - halfSide;
     70                    const scx = x + cx - halfSide;
    7171                    if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) {
    72                         var srcOff = scy * sw + scx;
    73                         var wt = weights[cy * side + cx];
     72                        const srcOff = scy * sw + scx;
     73                        const wt = weights[cy * side + cx];
    7474                        a += mask[srcOff] * wt;
    7575                    }
     
    8282}
    8383function dilateMask(mask, sw, sh) {
    84     var weights = [1, 1, 1, 1, 1, 1, 1, 1, 1];
    85     var side = Math.round(Math.sqrt(weights.length));
    86     var halfSide = Math.floor(side / 2);
    87     var maskResult = [];
    88     for (var y = 0; y < sh; y++) {
    89         for (var x = 0; x < sw; x++) {
    90             var so = y * sw + x;
    91             var a = 0;
    92             for (var cy = 0; cy < side; cy++) {
    93                 for (var cx = 0; cx < side; cx++) {
    94                     var scy = y + cy - halfSide;
    95                     var scx = x + cx - halfSide;
     84    const weights = [1, 1, 1, 1, 1, 1, 1, 1, 1];
     85    const side = Math.round(Math.sqrt(weights.length));
     86    const halfSide = Math.floor(side / 2);
     87    const maskResult = [];
     88    for (let y = 0; y < sh; y++) {
     89        for (let x = 0; x < sw; x++) {
     90            const so = y * sw + x;
     91            let a = 0;
     92            for (let cy = 0; cy < side; cy++) {
     93                for (let cx = 0; cx < side; cx++) {
     94                    const scy = y + cy - halfSide;
     95                    const scx = x + cx - halfSide;
    9696                    if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) {
    97                         var srcOff = scy * sw + scx;
    98                         var wt = weights[cy * side + cx];
     97                        const srcOff = scy * sw + scx;
     98                        const wt = weights[cy * side + cx];
    9999                        a += mask[srcOff] * wt;
    100100                    }
     
    107107}
    108108function smoothEdgeMask(mask, sw, sh) {
    109     var weights = [1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9];
    110     var side = Math.round(Math.sqrt(weights.length));
    111     var halfSide = Math.floor(side / 2);
    112     var maskResult = [];
    113     for (var y = 0; y < sh; y++) {
    114         for (var x = 0; x < sw; x++) {
    115             var so = y * sw + x;
    116             var a = 0;
    117             for (var cy = 0; cy < side; cy++) {
    118                 for (var cx = 0; cx < side; cx++) {
    119                     var scy = y + cy - halfSide;
    120                     var scx = x + cx - halfSide;
     109    const weights = [1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9];
     110    const side = Math.round(Math.sqrt(weights.length));
     111    const halfSide = Math.floor(side / 2);
     112    const maskResult = [];
     113    for (let y = 0; y < sh; y++) {
     114        for (let x = 0; x < sw; x++) {
     115            const so = y * sw + x;
     116            let a = 0;
     117            for (let cy = 0; cy < side; cy++) {
     118                for (let cx = 0; cx < side; cx++) {
     119                    const scy = y + cy - halfSide;
     120                    const scx = x + cx - halfSide;
    121121                    if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) {
    122                         var srcOff = scy * sw + scx;
    123                         var wt = weights[cy * side + cx];
     122                        const srcOff = scy * sw + scx;
     123                        const wt = weights[cy * side + cx];
    124124                        a += mask[srcOff] * wt;
    125125                    }
     
    132132}
    133133const Mask = function (imageData) {
    134     var threshold = this.threshold(), mask = backgroundMask(imageData, threshold);
     134    let threshold = this.threshold(), mask = backgroundMask(imageData, threshold);
    135135    if (mask) {
    136136        mask = erodeMask(mask, imageData.width, imageData.height);
  • imaps-frontend/node_modules/konva/lib/filters/Noise.js

    rd565449 r0c6b92a  
    66const Validators_1 = require("../Validators");
    77const Noise = function (imageData) {
    8     var amount = this.noise() * 255, data = imageData.data, nPixels = data.length, half = amount / 2, i;
    9     for (i = 0; i < nPixels; i += 4) {
     8    const amount = this.noise() * 255, data = imageData.data, nPixels = data.length, half = amount / 2;
     9    for (let i = 0; i < nPixels; i += 4) {
    1010        data[i + 0] += half - 2 * half * Math.random();
    1111        data[i + 1] += half - 2 * half * Math.random();
  • imaps-frontend/node_modules/konva/lib/filters/Pixelate.js

    rd565449 r0c6b92a  
    77const Validators_1 = require("../Validators");
    88const Pixelate = function (imageData) {
    9     var pixelSize = Math.ceil(this.pixelSize()), width = imageData.width, height = imageData.height, x, y, i, red, green, blue, alpha, nBinsX = Math.ceil(width / pixelSize), nBinsY = Math.ceil(height / pixelSize), xBinStart, xBinEnd, yBinStart, yBinEnd, xBin, yBin, pixelsInBin, data = imageData.data;
     9    let pixelSize = Math.ceil(this.pixelSize()), width = imageData.width, height = imageData.height, x, y, i, red, green, blue, alpha, nBinsX = Math.ceil(width / pixelSize), nBinsY = Math.ceil(height / pixelSize), xBinStart, xBinEnd, yBinStart, yBinEnd, xBin, yBin, pixelsInBin, data = imageData.data;
    1010    if (pixelSize <= 0) {
    1111        Util_1.Util.error('pixelSize value can not be <= 0');
  • imaps-frontend/node_modules/konva/lib/filters/Posterize.js

    rd565449 r0c6b92a  
    66const Validators_1 = require("../Validators");
    77const Posterize = function (imageData) {
    8     var levels = Math.round(this.levels() * 254) + 1, data = imageData.data, len = data.length, scale = 255 / levels, i;
     8    let levels = Math.round(this.levels() * 254) + 1, data = imageData.data, len = data.length, scale = 255 / levels, i;
    99    for (i = 0; i < len; i += 1) {
    1010        data[i] = Math.floor(data[i] / scale) * scale;
  • imaps-frontend/node_modules/konva/lib/filters/RGB.js

    rd565449 r0c6b92a  
    66const Validators_1 = require("../Validators");
    77const RGB = function (imageData) {
    8     var data = imageData.data, nPixels = data.length, red = this.red(), green = this.green(), blue = this.blue(), i, brightness;
     8    let data = imageData.data, nPixels = data.length, red = this.red(), green = this.green(), blue = this.blue(), i, brightness;
    99    for (i = 0; i < nPixels; i += 4) {
    1010        brightness =
  • imaps-frontend/node_modules/konva/lib/filters/RGBA.js

    rd565449 r0c6b92a  
    66const Validators_1 = require("../Validators");
    77const RGBA = function (imageData) {
    8     var data = imageData.data, nPixels = data.length, red = this.red(), green = this.green(), blue = this.blue(), alpha = this.alpha(), i, ia;
    9     for (i = 0; i < nPixels; i += 4) {
    10         ia = 1 - alpha;
     8    const data = imageData.data, nPixels = data.length, red = this.red(), green = this.green(), blue = this.blue(), alpha = this.alpha();
     9    for (let i = 0; i < nPixels; i += 4) {
     10        const ia = 1 - alpha;
    1111        data[i] = red * alpha + data[i] * ia;
    1212        data[i + 1] = green * alpha + data[i + 1] * ia;
  • imaps-frontend/node_modules/konva/lib/filters/Sepia.js

    rd565449 r0c6b92a  
    33exports.Sepia = void 0;
    44const Sepia = function (imageData) {
    5     var data = imageData.data, nPixels = data.length, i, r, g, b;
     5    let data = imageData.data, nPixels = data.length, i, r, g, b;
    66    for (i = 0; i < nPixels; i += 4) {
    77        r = data[i + 0];
  • imaps-frontend/node_modules/konva/lib/filters/Solarize.js

    rd565449 r0c6b92a  
    33exports.Solarize = void 0;
    44const Solarize = function (imageData) {
    5     var data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4, y = h;
     5    const data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4;
     6    let y = h;
    67    do {
    7         var offsetY = (y - 1) * w4;
    8         var x = w;
     8        const offsetY = (y - 1) * w4;
     9        let x = w;
    910        do {
    10             var offset = offsetY + (x - 1) * 4;
    11             var r = data[offset];
    12             var g = data[offset + 1];
    13             var b = data[offset + 2];
     11            const offset = offsetY + (x - 1) * 4;
     12            let r = data[offset];
     13            let g = data[offset + 1];
     14            let b = data[offset + 2];
    1415            if (r > 127) {
    1516                r = 255 - r;
  • imaps-frontend/node_modules/konva/lib/filters/Threshold.js

    rd565449 r0c6b92a  
    66const Validators_1 = require("../Validators");
    77const Threshold = function (imageData) {
    8     var level = this.threshold() * 255, data = imageData.data, len = data.length, i;
    9     for (i = 0; i < len; i += 1) {
     8    const level = this.threshold() * 255, data = imageData.data, len = data.length;
     9    for (let i = 0; i < len; i += 1) {
    1010        data[i] = data[i] < level ? 0 : 255;
    1111    }
  • imaps-frontend/node_modules/konva/lib/shapes/Arc.js

    rd565449 r0c6b92a  
    99class Arc extends Shape_1.Shape {
    1010    _sceneFunc(context) {
    11         var angle = Global_1.Konva.getAngle(this.angle()), clockwise = this.clockwise();
     11        const angle = Global_1.Konva.getAngle(this.angle()), clockwise = this.clockwise();
    1212        context.beginPath();
    1313        context.arc(0, 0, this.outerRadius(), 0, angle, clockwise);
  • imaps-frontend/node_modules/konva/lib/shapes/Arrow.js

    rd565449 r0c6b92a  
    1010    _sceneFunc(ctx) {
    1111        super._sceneFunc(ctx);
    12         var PI2 = Math.PI * 2;
    13         var points = this.points();
    14         var tp = points;
    15         var fromTension = this.tension() !== 0 && points.length > 4;
     12        const PI2 = Math.PI * 2;
     13        const points = this.points();
     14        let tp = points;
     15        const fromTension = this.tension() !== 0 && points.length > 4;
    1616        if (fromTension) {
    1717            tp = this.getTensionPoints();
    1818        }
    19         var length = this.pointerLength();
    20         var n = points.length;
    21         var dx, dy;
     19        const length = this.pointerLength();
     20        const n = points.length;
     21        let dx, dy;
    2222        if (fromTension) {
    2323            const lp = [
     
    3838            dy = points[n - 1] - points[n - 3];
    3939        }
    40         var radians = (Math.atan2(dy, dx) + PI2) % PI2;
    41         var width = this.pointerWidth();
     40        const radians = (Math.atan2(dy, dx) + PI2) % PI2;
     41        const width = this.pointerWidth();
    4242        if (this.pointerAtEnding()) {
    4343            ctx.save();
     
    7474    }
    7575    __fillStroke(ctx) {
    76         var isDashEnabled = this.dashEnabled();
     76        const isDashEnabled = this.dashEnabled();
    7777        if (isDashEnabled) {
    7878            this.attrs.dashEnabled = false;
  • imaps-frontend/node_modules/konva/lib/shapes/Ellipse.js

    rd565449 r0c6b92a  
    88class Ellipse extends Shape_1.Shape {
    99    _sceneFunc(context) {
    10         var rx = this.radiusX(), ry = this.radiusY();
     10        const rx = this.radiusX(), ry = this.radiusY();
    1111        context.beginPath();
    1212        context.save();
  • imaps-frontend/node_modules/konva/lib/shapes/Image.js

    rd565449 r0c6b92a  
    7979    }
    8080    _hitFunc(context) {
    81         var width = this.width(), height = this.height(), cornerRadius = this.cornerRadius();
     81        const width = this.width(), height = this.height(), cornerRadius = this.cornerRadius();
    8282        context.beginPath();
    8383        if (!cornerRadius) {
     
    9999    }
    100100    static fromURL(url, callback, onError = null) {
    101         var img = Util_1.Util.createImageElement();
     101        const img = Util_1.Util.createImageElement();
    102102        img.onload = function () {
    103             var image = new Image({
     103            const image = new Image({
    104104                image: img,
    105105            });
  • imaps-frontend/node_modules/konva/lib/shapes/Label.d.ts

    rd565449 r0c6b92a  
    3030        height: number;
    3131    };
    32     pointerDirection: GetSet<'left' | 'top' | 'right' | 'bottom', this>;
     32    pointerDirection: GetSet<'left' | 'top' | 'right' | 'bottom' | 'up' | 'down', this>;
    3333    pointerWidth: GetSet<number, this>;
    3434    pointerHeight: GetSet<number, this>;
  • imaps-frontend/node_modules/konva/lib/shapes/Label.js

    rd565449 r0c6b92a  
    77const Validators_1 = require("../Validators");
    88const Global_1 = require("../Global");
    9 var ATTR_CHANGE_LIST = [
     9const ATTR_CHANGE_LIST = [
    1010    'fontFamily',
    1111    'fontSize',
     
    3535    }
    3636    _addListeners(text) {
    37         var that = this, n;
    38         var func = function () {
     37        let that = this, n;
     38        const func = function () {
    3939            that._sync();
    4040        };
     
    5050    }
    5151    _sync() {
    52         var text = this.getText(), tag = this.getTag(), width, height, pointerDirection, pointerWidth, x, y, pointerHeight;
     52        let text = this.getText(), tag = this.getTag(), width, height, pointerDirection, pointerWidth, x, y, pointerHeight;
    5353        if (text && tag) {
    5454            width = text.width();
     
    9595class Tag extends Shape_1.Shape {
    9696    _sceneFunc(context) {
    97         var width = this.width(), height = this.height(), pointerDirection = this.pointerDirection(), pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), cornerRadius = this.cornerRadius();
     97        const width = this.width(), height = this.height(), pointerDirection = this.pointerDirection(), pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), cornerRadius = this.cornerRadius();
    9898        let topLeft = 0;
    9999        let topRight = 0;
     
    147147    }
    148148    getSelfRect() {
    149         var x = 0, y = 0, pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), direction = this.pointerDirection(), width = this.width(), height = this.height();
     149        let x = 0, y = 0, pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), direction = this.pointerDirection(), width = this.width(), height = this.height();
    150150        if (direction === UP) {
    151151            y -= pointerHeight;
  • imaps-frontend/node_modules/konva/lib/shapes/Line.d.ts

    rd565449 r0c6b92a  
    11import { Shape, ShapeConfig } from '../Shape.js';
     2import { Context } from '../Context.js';
    23import { GetSet } from '../types.js';
    3 import { Context } from '../Context.js';
    44export interface LineConfig extends ShapeConfig {
    55    points?: number[] | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
  • imaps-frontend/node_modules/konva/lib/shapes/Line.js

    rd565449 r0c6b92a  
    33exports.Line = void 0;
    44const Factory_1 = require("../Factory");
     5const Global_1 = require("../Global");
    56const Shape_1 = require("../Shape");
    67const Validators_1 = require("../Validators");
    7 const Global_1 = require("../Global");
    88function getControlPoints(x0, y0, x1, y1, x2, y2, t) {
    9     var d01 = Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2)), d12 = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)), fa = (t * d01) / (d01 + d12), fb = (t * d12) / (d01 + d12), p1x = x1 - fa * (x2 - x0), p1y = y1 - fa * (y2 - y0), p2x = x1 + fb * (x2 - x0), p2y = y1 + fb * (y2 - y0);
     9    const d01 = Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2)), d12 = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)), fa = (t * d01) / (d01 + d12), fb = (t * d12) / (d01 + d12), p1x = x1 - fa * (x2 - x0), p1y = y1 - fa * (y2 - y0), p2x = x1 + fb * (x2 - x0), p2y = y1 + fb * (y2 - y0);
    1010    return [p1x, p1y, p2x, p2y];
    1111}
    1212function expandPoints(p, tension) {
    13     var len = p.length, allPoints = [], n, cp;
    14     for (n = 2; n < len - 2; n += 2) {
    15         cp = getControlPoints(p[n - 2], p[n - 1], p[n], p[n + 1], p[n + 2], p[n + 3], tension);
     13    const len = p.length, allPoints = [];
     14    for (let n = 2; n < len - 2; n += 2) {
     15        const cp = getControlPoints(p[n - 2], p[n - 1], p[n], p[n + 1], p[n + 2], p[n + 3], tension);
    1616        if (isNaN(cp[0])) {
    1717            continue;
     
    3434    }
    3535    _sceneFunc(context) {
    36         var points = this.points(), length = points.length, tension = this.tension(), closed = this.closed(), bezier = this.bezier(), tp, len, n;
     36        let points = this.points(), length = points.length, tension = this.tension(), closed = this.closed(), bezier = this.bezier(), tp, len, n;
    3737        if (!length) {
    3838            return;
     
    8585    }
    8686    _getTensionPointsClosed() {
    87         var p = this.points(), len = p.length, tension = this.tension(), firstControlPoints = getControlPoints(p[len - 2], p[len - 1], p[0], p[1], p[2], p[3], tension), lastControlPoints = getControlPoints(p[len - 4], p[len - 3], p[len - 2], p[len - 1], p[0], p[1], tension), middle = expandPoints(p, tension), tp = [firstControlPoints[2], firstControlPoints[3]]
     87        const p = this.points(), len = p.length, tension = this.tension(), firstControlPoints = getControlPoints(p[len - 2], p[len - 1], p[0], p[1], p[2], p[3], tension), lastControlPoints = getControlPoints(p[len - 4], p[len - 3], p[len - 2], p[len - 1], p[0], p[1], tension), middle = expandPoints(p, tension), tp = [firstControlPoints[2], firstControlPoints[3]]
    8888            .concat(middle)
    8989            .concat([
     
    108108    }
    109109    getSelfRect() {
    110         var points = this.points();
     110        let points = this.points();
    111111        if (points.length < 4) {
    112112            return {
     
    129129            points = this.points();
    130130        }
    131         var minX = points[0];
    132         var maxX = points[0];
    133         var minY = points[1];
    134         var maxY = points[1];
    135         var x, y;
    136         for (var i = 0; i < points.length / 2; i++) {
     131        let minX = points[0];
     132        let maxX = points[0];
     133        let minY = points[1];
     134        let maxY = points[1];
     135        let x, y;
     136        for (let i = 0; i < points.length / 2; i++) {
    137137            x = points[i * 2];
    138138            y = points[i * 2 + 1];
  • imaps-frontend/node_modules/konva/lib/shapes/Path.d.ts

    rd565449 r0c6b92a  
    1818    getLength(): number;
    1919    getPointAtLength(length: any): {
    20         x: any;
    21         y: any;
     20        x: number;
     21        y: number;
    2222    } | null;
    2323    data: GetSet<string, this>;
    2424    static getLineLength(x1: any, y1: any, x2: any, y2: any): number;
    2525    static getPathLength(dataArray: PathSegment[]): number;
    26     static getPointAtLengthOfDataArray(length: number, dataArray: any): {
    27         x: any;
    28         y: any;
     26    static getPointAtLengthOfDataArray(length: number, dataArray: PathSegment[]): {
     27        x: number;
     28        y: number;
    2929    } | null;
    30     static getPointOnLine(dist: any, P1x: any, P1y: any, P2x: any, P2y: any, fromX?: any, fromY?: any): {
    31         x: any;
    32         y: any;
     30    static getPointOnLine(dist: number, P1x: number, P1y: number, P2x: number, P2y: number, fromX?: number, fromY?: number): {
     31        x: number;
     32        y: number;
    3333    };
    3434    static getPointOnCubicBezier(pct: any, P1x: any, P1y: any, P2x: any, P2y: any, P3x: any, P3y: any, P4x: any, P4y: any): {
  • imaps-frontend/node_modules/konva/lib/shapes/Path.js

    rd565449 r0c6b92a  
    2121    }
    2222    _sceneFunc(context) {
    23         var ca = this.dataArray;
     23        const ca = this.dataArray;
    2424        context.beginPath();
    25         var isClosed = false;
    26         for (var n = 0; n < ca.length; n++) {
    27             var c = ca[n].command;
    28             var p = ca[n].points;
     25        let isClosed = false;
     26        for (let n = 0; n < ca.length; n++) {
     27            const c = ca[n].command;
     28            const p = ca[n].points;
    2929            switch (c) {
    3030                case 'L':
     
    6767    }
    6868    getSelfRect() {
    69         var points = [];
     69        let points = [];
    7070        this.dataArray.forEach(function (data) {
    7171            if (data.command === 'A') {
    72                 var start = data.points[4];
    73                 var dTheta = data.points[5];
    74                 var end = data.points[4] + dTheta;
    75                 var inc = Math.PI / 180.0;
     72                const start = data.points[4];
     73                const dTheta = data.points[5];
     74                const end = data.points[4] + dTheta;
     75                let inc = Math.PI / 180.0;
    7676                if (Math.abs(start - end) < inc) {
    7777                    inc = Math.abs(start - end);
     
    100100            }
    101101        });
    102         var minX = points[0];
    103         var maxX = points[0];
    104         var minY = points[1];
    105         var maxY = points[1];
    106         var x, y;
    107         for (var i = 0; i < points.length / 2; i++) {
     102        let minX = points[0];
     103        let maxX = points[0];
     104        let minY = points[1];
     105        let maxY = points[1];
     106        let x, y;
     107        for (let i = 0; i < points.length / 2; i++) {
    108108            x = points[i * 2];
    109109            y = points[i * 2 + 1];
     
    135135    static getPathLength(dataArray) {
    136136        let pathLength = 0;
    137         for (var i = 0; i < dataArray.length; ++i) {
     137        for (let i = 0; i < dataArray.length; ++i) {
    138138            pathLength += dataArray[i].pathLength;
    139139        }
     
    141141    }
    142142    static getPointAtLengthOfDataArray(length, dataArray) {
    143         var point, i = 0, ii = dataArray.length;
     143        let points, i = 0, ii = dataArray.length;
    144144        if (!ii) {
    145145            return null;
     
    150150        }
    151151        if (i === ii) {
    152             point = dataArray[i - 1].points.slice(-2);
     152            points = dataArray[i - 1].points.slice(-2);
    153153            return {
    154                 x: point[0],
    155                 y: point[1],
     154                x: points[0],
     155                y: points[1],
    156156            };
    157157        }
    158158        if (length < 0.01) {
    159             point = dataArray[i].points.slice(0, 2);
     159            points = dataArray[i].points.slice(0, 2);
    160160            return {
    161                 x: point[0],
    162                 y: point[1],
     161                x: points[0],
     162                y: points[1],
    163163            };
    164164        }
    165         var cp = dataArray[i];
    166         var p = cp.points;
     165        const cp = dataArray[i];
     166        const p = cp.points;
    167167        switch (cp.command) {
    168168            case 'L':
     
    221221            return (1 - t) * (1 - t) * (1 - t);
    222222        }
    223         var x = P4x * CB1(pct) + P3x * CB2(pct) + P2x * CB3(pct) + P1x * CB4(pct);
    224         var y = P4y * CB1(pct) + P3y * CB2(pct) + P2y * CB3(pct) + P1y * CB4(pct);
     223        const x = P4x * CB1(pct) + P3x * CB2(pct) + P2x * CB3(pct) + P1x * CB4(pct);
     224        const y = P4y * CB1(pct) + P3y * CB2(pct) + P2y * CB3(pct) + P1y * CB4(pct);
    225225        return {
    226226            x: x,
     
    238238            return (1 - t) * (1 - t);
    239239        }
    240         var x = P3x * QB1(pct) + P2x * QB2(pct) + P1x * QB3(pct);
    241         var y = P3y * QB1(pct) + P2y * QB2(pct) + P1y * QB3(pct);
     240        const x = P3x * QB1(pct) + P2x * QB2(pct) + P1x * QB3(pct);
     241        const y = P3y * QB1(pct) + P2y * QB2(pct) + P1y * QB3(pct);
    242242        return {
    243243            x: x,
     
    246246    }
    247247    static getPointOnEllipticalArc(cx, cy, rx, ry, theta, psi) {
    248         var cosPsi = Math.cos(psi), sinPsi = Math.sin(psi);
    249         var pt = {
     248        const cosPsi = Math.cos(psi), sinPsi = Math.sin(psi);
     249        const pt = {
    250250            x: rx * Math.cos(theta),
    251251            y: ry * Math.sin(theta),
     
    260260            return [];
    261261        }
    262         var cs = data;
    263         var cc = [
     262        let cs = data;
     263        const cc = [
    264264            'm',
    265265            'M',
     
    287287            cs = cs.replace(new RegExp(cc[n], 'g'), '|' + cc[n]);
    288288        }
    289         var arr = cs.split('|');
    290         var ca = [];
    291         var coords = [];
    292         var cpx = 0;
    293         var cpy = 0;
    294         var re = /([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;
    295         var match;
     289        const arr = cs.split('|');
     290        const ca = [];
     291        const coords = [];
     292        let cpx = 0;
     293        let cpy = 0;
     294        const re = /([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;
     295        let match;
    296296        for (n = 1; n < arr.length; n++) {
    297             var str = arr[n];
    298             var c = str.charAt(0);
     297            let str = arr[n];
     298            let c = str.charAt(0);
    299299            str = str.slice(1);
    300300            coords.length = 0;
     
    302302                coords.push(match[0]);
    303303            }
    304             var p = [];
    305             for (var j = 0, jlen = coords.length; j < jlen; j++) {
     304            const p = [];
     305            for (let j = 0, jlen = coords.length; j < jlen; j++) {
    306306                if (coords[j] === '00') {
    307307                    p.push(0, 0);
    308308                    continue;
    309309                }
    310                 var parsed = parseFloat(coords[j]);
     310                const parsed = parseFloat(coords[j]);
    311311                if (!isNaN(parsed)) {
    312312                    p.push(parsed);
     
    320320                    break;
    321321                }
    322                 var cmd = '';
    323                 var points = [];
    324                 var startX = cpx, startY = cpy;
     322                let cmd = '';
     323                let points = [];
     324                const startX = cpx, startY = cpy;
    325325                var prevCmd, ctlPtx, ctlPty;
    326326                var rx, ry, psi, fa, fs, x1, y1;
     
    344344                        cmd = 'M';
    345345                        if (ca.length > 2 && ca[ca.length - 1].command === 'z') {
    346                             for (var idx = ca.length - 2; idx >= 0; idx--) {
     346                            for (let idx = ca.length - 2; idx >= 0; idx--) {
    347347                                if (ca[idx].command === 'M') {
    348348                                    cpx = ca[idx].points[0] + dx;
     
    511511    }
    512512    static calcLength(x, y, cmd, points) {
    513         var len, p1, p2, t;
    514         var path = Path;
     513        let len, p1, p2, t;
     514        const path = Path;
    515515        switch (cmd) {
    516516            case 'L':
     
    551551    }
    552552    static convertEndpointToCenterParameterization(x1, y1, x2, y2, fa, fs, rx, ry, psiDeg) {
    553         var psi = psiDeg * (Math.PI / 180.0);
    554         var xp = (Math.cos(psi) * (x1 - x2)) / 2.0 + (Math.sin(psi) * (y1 - y2)) / 2.0;
    555         var yp = (-1 * Math.sin(psi) * (x1 - x2)) / 2.0 +
     553        const psi = psiDeg * (Math.PI / 180.0);
     554        const xp = (Math.cos(psi) * (x1 - x2)) / 2.0 + (Math.sin(psi) * (y1 - y2)) / 2.0;
     555        const yp = (-1 * Math.sin(psi) * (x1 - x2)) / 2.0 +
    556556            (Math.cos(psi) * (y1 - y2)) / 2.0;
    557         var lambda = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);
     557        const lambda = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);
    558558        if (lambda > 1) {
    559559            rx *= Math.sqrt(lambda);
    560560            ry *= Math.sqrt(lambda);
    561561        }
    562         var f = Math.sqrt((rx * rx * (ry * ry) - rx * rx * (yp * yp) - ry * ry * (xp * xp)) /
     562        let f = Math.sqrt((rx * rx * (ry * ry) - rx * rx * (yp * yp) - ry * ry * (xp * xp)) /
    563563            (rx * rx * (yp * yp) + ry * ry * (xp * xp)));
    564564        if (fa === fs) {
     
    568568            f = 0;
    569569        }
    570         var cxp = (f * rx * yp) / ry;
    571         var cyp = (f * -ry * xp) / rx;
    572         var cx = (x1 + x2) / 2.0 + Math.cos(psi) * cxp - Math.sin(psi) * cyp;
    573         var cy = (y1 + y2) / 2.0 + Math.sin(psi) * cxp + Math.cos(psi) * cyp;
    574         var vMag = function (v) {
     570        const cxp = (f * rx * yp) / ry;
     571        const cyp = (f * -ry * xp) / rx;
     572        const cx = (x1 + x2) / 2.0 + Math.cos(psi) * cxp - Math.sin(psi) * cyp;
     573        const cy = (y1 + y2) / 2.0 + Math.sin(psi) * cxp + Math.cos(psi) * cyp;
     574        const vMag = function (v) {
    575575            return Math.sqrt(v[0] * v[0] + v[1] * v[1]);
    576576        };
    577         var vRatio = function (u, v) {
     577        const vRatio = function (u, v) {
    578578            return (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v));
    579579        };
    580         var vAngle = function (u, v) {
     580        const vAngle = function (u, v) {
    581581            return (u[0] * v[1] < u[1] * v[0] ? -1 : 1) * Math.acos(vRatio(u, v));
    582582        };
    583         var theta = vAngle([1, 0], [(xp - cxp) / rx, (yp - cyp) / ry]);
    584         var u = [(xp - cxp) / rx, (yp - cyp) / ry];
    585         var v = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry];
    586         var dTheta = vAngle(u, v);
     583        const theta = vAngle([1, 0], [(xp - cxp) / rx, (yp - cyp) / ry]);
     584        const u = [(xp - cxp) / rx, (yp - cyp) / ry];
     585        const v = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry];
     586        let dTheta = vAngle(u, v);
    587587        if (vRatio(u, v) <= -1) {
    588588            dTheta = Math.PI;
  • imaps-frontend/node_modules/konva/lib/shapes/Rect.js

    rd565449 r0c6b92a  
    99class Rect extends Shape_1.Shape {
    1010    _sceneFunc(context) {
    11         var cornerRadius = this.cornerRadius(), width = this.width(), height = this.height();
     11        const cornerRadius = this.cornerRadius(), width = this.width(), height = this.height();
    1212        context.beginPath();
    1313        if (!cornerRadius) {
  • imaps-frontend/node_modules/konva/lib/shapes/RegularPolygon.js

    rd565449 r0c6b92a  
    1111        context.beginPath();
    1212        context.moveTo(points[0].x, points[0].y);
    13         for (var n = 1; n < points.length; n++) {
     13        for (let n = 1; n < points.length; n++) {
    1414            context.lineTo(points[n].x, points[n].y);
    1515        }
     
    2121        const radius = this.attrs.radius || 0;
    2222        const points = [];
    23         for (var n = 0; n < sides; n++) {
     23        for (let n = 0; n < sides; n++) {
    2424            points.push({
    2525                x: radius * Math.sin((n * 2 * Math.PI) / sides),
     
    3131    getSelfRect() {
    3232        const points = this._getPoints();
    33         var minX = points[0].x;
    34         var maxX = points[0].y;
    35         var minY = points[0].x;
    36         var maxY = points[0].y;
     33        let minX = points[0].x;
     34        let maxX = points[0].y;
     35        let minY = points[0].x;
     36        let maxY = points[0].y;
    3737        points.forEach((point) => {
    3838            minX = Math.min(minX, point.x);
  • imaps-frontend/node_modules/konva/lib/shapes/Ring.js

    rd565449 r0c6b92a  
    66const Validators_1 = require("../Validators");
    77const Global_1 = require("../Global");
    8 var PIx2 = Math.PI * 2;
     8const PIx2 = Math.PI * 2;
    99class Ring extends Shape_1.Shape {
    1010    _sceneFunc(context) {
  • imaps-frontend/node_modules/konva/lib/shapes/Sprite.js

    rd565449 r0c6b92a  
    1212        this._updated = true;
    1313        this.anim = new Animation_1.Animation(() => {
    14             var updated = this._updated;
     14            const updated = this._updated;
    1515            this._updated = false;
    1616            return updated;
     
    3131    }
    3232    _sceneFunc(context) {
    33         var anim = this.animation(), index = this.frameIndex(), ix4 = index * 4, set = this.animations()[anim], offsets = this.frameOffsets(), x = set[ix4 + 0], y = set[ix4 + 1], width = set[ix4 + 2], height = set[ix4 + 3], image = this.image();
     33        const anim = this.animation(), index = this.frameIndex(), ix4 = index * 4, set = this.animations()[anim], offsets = this.frameOffsets(), x = set[ix4 + 0], y = set[ix4 + 1], width = set[ix4 + 2], height = set[ix4 + 3], image = this.image();
    3434        if (this.hasFill() || this.hasStroke()) {
    3535            context.beginPath();
     
    4040        if (image) {
    4141            if (offsets) {
    42                 var offset = offsets[anim], ix2 = index * 2;
     42                const offset = offsets[anim], ix2 = index * 2;
    4343                context.drawImage(image, x, y, width, height, offset[ix2 + 0], offset[ix2 + 1], width, height);
    4444            }
     
    4949    }
    5050    _hitFunc(context) {
    51         var anim = this.animation(), index = this.frameIndex(), ix4 = index * 4, set = this.animations()[anim], offsets = this.frameOffsets(), width = set[ix4 + 2], height = set[ix4 + 3];
     51        const anim = this.animation(), index = this.frameIndex(), ix4 = index * 4, set = this.animations()[anim], offsets = this.frameOffsets(), width = set[ix4 + 2], height = set[ix4 + 3];
    5252        context.beginPath();
    5353        if (offsets) {
    54             var offset = offsets[anim];
    55             var ix2 = index * 2;
     54            const offset = offsets[anim];
     55            const ix2 = index * 2;
    5656            context.rect(offset[ix2 + 0], offset[ix2 + 1], width, height);
    5757        }
     
    6666    }
    6767    _setInterval() {
    68         var that = this;
     68        const that = this;
    6969        this.interval = setInterval(function () {
    7070            that._updateIndex();
     
    7575            return;
    7676        }
    77         var layer = this.getLayer();
     77        const layer = this.getLayer();
    7878        this.anim.setLayers(layer);
    7979        this._setInterval();
     
    8888    }
    8989    _updateIndex() {
    90         var index = this.frameIndex(), animation = this.animation(), animations = this.animations(), anim = animations[animation], len = anim.length / 4;
     90        const index = this.frameIndex(), animation = this.animation(), animations = this.animations(), anim = animations[animation], len = anim.length / 4;
    9191        if (index < len - 1) {
    9292            this.frameIndex(index + 1);
  • imaps-frontend/node_modules/konva/lib/shapes/Star.js

    rd565449 r0c6b92a  
    88class Star extends Shape_1.Shape {
    99    _sceneFunc(context) {
    10         var innerRadius = this.innerRadius(), outerRadius = this.outerRadius(), numPoints = this.numPoints();
     10        const innerRadius = this.innerRadius(), outerRadius = this.outerRadius(), numPoints = this.numPoints();
    1111        context.beginPath();
    1212        context.moveTo(0, 0 - outerRadius);
    13         for (var n = 1; n < numPoints * 2; n++) {
    14             var radius = n % 2 === 0 ? outerRadius : innerRadius;
    15             var x = radius * Math.sin((n * Math.PI) / numPoints);
    16             var y = -1 * radius * Math.cos((n * Math.PI) / numPoints);
     13        for (let n = 1; n < numPoints * 2; n++) {
     14            const radius = n % 2 === 0 ? outerRadius : innerRadius;
     15            const x = radius * Math.sin((n * Math.PI) / numPoints);
     16            const y = -1 * radius * Math.cos((n * Math.PI) / numPoints);
    1717            context.lineTo(x, y);
    1818        }
  • imaps-frontend/node_modules/konva/lib/shapes/Text.d.ts

    rd565449 r0c6b92a  
    3838    getTextWidth(): number;
    3939    getTextHeight(): number;
    40     measureSize(text: any): {
    41         actualBoundingBoxAscent: any;
    42         actualBoundingBoxDescent: any;
    43         actualBoundingBoxLeft: any;
    44         actualBoundingBoxRight: any;
    45         alphabeticBaseline: any;
    46         emHeightAscent: any;
    47         emHeightDescent: any;
    48         fontBoundingBoxAscent: any;
    49         fontBoundingBoxDescent: any;
    50         hangingBaseline: any;
    51         ideographicBaseline: any;
    52         width: any;
     40    measureSize(text: string): {
     41        actualBoundingBoxAscent: number;
     42        actualBoundingBoxDescent: number;
     43        actualBoundingBoxLeft: number;
     44        actualBoundingBoxRight: number;
     45        alphabeticBaseline: number;
     46        emHeightAscent: number;
     47        emHeightDescent: number;
     48        fontBoundingBoxAscent: number;
     49        fontBoundingBoxDescent: number;
     50        hangingBaseline: number;
     51        ideographicBaseline: number;
     52        width: number;
    5353        height: number;
    5454    };
  • imaps-frontend/node_modules/konva/lib/shapes/Text.js

    rd565449 r0c6b92a  
    11"use strict";
    22Object.defineProperty(exports, "__esModule", { value: true });
    3 exports.Text = exports.stringToArray = void 0;
     3exports.Text = void 0;
     4exports.stringToArray = stringToArray;
    45const Util_1 = require("../Util");
    56const Factory_1 = require("../Factory");
     
    910const Global_2 = require("../Global");
    1011function stringToArray(string) {
    11     return Array.from(string);
    12 }
    13 exports.stringToArray = stringToArray;
    14 var AUTO = 'auto', CENTER = 'center', INHERIT = 'inherit', JUSTIFY = 'justify', CHANGE_KONVA = 'Change.konva', CONTEXT_2D = '2d', DASH = '-', LEFT = 'left', LTR = 'ltr', TEXT = 'text', TEXT_UPPER = 'Text', TOP = 'top', BOTTOM = 'bottom', MIDDLE = 'middle', NORMAL = 'normal', PX_SPACE = 'px ', SPACE = ' ', RIGHT = 'right', RTL = 'rtl', WORD = 'word', CHAR = 'char', NONE = 'none', ELLIPSIS = '…', ATTR_CHANGE_LIST = [
     12    return [...string].reduce((acc, char, index, array) => {
     13        if (/\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?(?:\u200D\p{Emoji_Presentation})+/u.test(char)) {
     14            acc.push(char);
     15        }
     16        else if (/\p{Regional_Indicator}{2}/u.test(char + (array[index + 1] || ''))) {
     17            acc.push(char + array[index + 1]);
     18        }
     19        else if (index > 0 && /\p{Mn}|\p{Me}|\p{Mc}/u.test(char)) {
     20            acc[acc.length - 1] += char;
     21        }
     22        else {
     23            acc.push(char);
     24        }
     25        return acc;
     26    }, []);
     27}
     28const AUTO = 'auto', CENTER = 'center', INHERIT = 'inherit', JUSTIFY = 'justify', CHANGE_KONVA = 'Change.konva', CONTEXT_2D = '2d', DASH = '-', LEFT = 'left', TEXT = 'text', TEXT_UPPER = 'Text', TOP = 'top', BOTTOM = 'bottom', MIDDLE = 'middle', NORMAL = 'normal', PX_SPACE = 'px ', SPACE = ' ', RIGHT = 'right', RTL = 'rtl', WORD = 'word', CHAR = 'char', NONE = 'none', ELLIPSIS = '…', ATTR_CHANGE_LIST = [
    1529    'direction',
    1630    'fontFamily',
     
    4357        .join(', ');
    4458}
    45 var dummyContext;
     59let dummyContext;
    4660function getDummyContext() {
    4761    if (dummyContext) {
     
    7286        this._partialTextX = 0;
    7387        this._partialTextY = 0;
    74         for (var n = 0; n < attrChangeListLen; n++) {
     88        for (let n = 0; n < attrChangeListLen; n++) {
    7589            this.on(ATTR_CHANGE_LIST[n] + CHANGE_KONVA, this._setTextData);
    7690        }
     
    7892    }
    7993    _sceneFunc(context) {
    80         var textArr = this.textArr, textArrLen = textArr.length;
     94        const textArr = this.textArr, textArrLen = textArr.length;
    8195        if (!this.text()) {
    8296            return;
    8397        }
    84         var padding = this.padding(), fontSize = this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, verticalAlign = this.verticalAlign(), direction = this.direction(), alignY = 0, align = this.align(), totalWidth = this.getWidth(), letterSpacing = this.letterSpacing(), fill = this.fill(), textDecoration = this.textDecoration(), shouldUnderline = textDecoration.indexOf('underline') !== -1, shouldLineThrough = textDecoration.indexOf('line-through') !== -1, n;
     98        let padding = this.padding(), fontSize = this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, verticalAlign = this.verticalAlign(), direction = this.direction(), alignY = 0, align = this.align(), totalWidth = this.getWidth(), letterSpacing = this.letterSpacing(), fill = this.fill(), textDecoration = this.textDecoration(), shouldUnderline = textDecoration.indexOf('underline') !== -1, shouldLineThrough = textDecoration.indexOf('line-through') !== -1, n;
    8599        direction = direction === INHERIT ? context.direction : direction;
    86         var translateY = lineHeightPx / 2;
    87         var baseline = MIDDLE;
     100        let translateY = lineHeightPx / 2;
     101        let baseline = MIDDLE;
    88102        if (Global_1.Konva._fixTextRendering) {
    89             var metrics = this.measureSize('M');
     103            const metrics = this.measureSize('M');
    90104            baseline = 'alphabetic';
    91105            translateY =
     
    122136                context.save();
    123137                context.beginPath();
    124                 let yOffset = Global_1.Konva._fixTextRendering
     138                const yOffset = Global_1.Konva._fixTextRendering
    125139                    ? Math.round(fontSize / 4)
    126140                    : Math.round(fontSize / 2);
     
    142156                context.save();
    143157                context.beginPath();
    144                 let yOffset = Global_1.Konva._fixTextRendering ? -Math.round(fontSize / 4) : 0;
     158                const yOffset = Global_1.Konva._fixTextRendering ? -Math.round(fontSize / 4) : 0;
    145159                context.moveTo(lineTranslateX, translateY + lineTranslateY + yOffset);
    146160                spacesNumber = text.split(' ').length - 1;
     
    159173            if (direction !== RTL && (letterSpacing !== 0 || align === JUSTIFY)) {
    160174                spacesNumber = text.split(' ').length - 1;
    161                 var array = stringToArray(text);
    162                 for (var li = 0; li < array.length; li++) {
    163                     var letter = array[li];
     175                const array = stringToArray(text);
     176                for (let li = 0; li < array.length; li++) {
     177                    const letter = array[li];
    164178                    if (letter === ' ' && !lastLine && align === JUSTIFY) {
    165179                        lineTranslateX += (totalWidth - padding * 2 - width) / spacesNumber;
     
    188202    }
    189203    _hitFunc(context) {
    190         var width = this.getWidth(), height = this.getHeight();
     204        const width = this.getWidth(), height = this.getHeight();
    191205        context.beginPath();
    192206        context.rect(0, 0, width, height);
     
    195209    }
    196210    setText(text) {
    197         var str = Util_1.Util._isString(text)
     211        const str = Util_1.Util._isString(text)
    198212            ? text
    199213            : text === null || text === undefined
     
    204218    }
    205219    getWidth() {
    206         var isAuto = this.attrs.width === AUTO || this.attrs.width === undefined;
     220        const isAuto = this.attrs.width === AUTO || this.attrs.width === undefined;
    207221        return isAuto ? this.getTextWidth() + this.padding() * 2 : this.attrs.width;
    208222    }
    209223    getHeight() {
    210         var isAuto = this.attrs.height === AUTO || this.attrs.height === undefined;
     224        const isAuto = this.attrs.height === AUTO || this.attrs.height === undefined;
    211225        return isAuto
    212226            ? this.fontSize() * this.textArr.length * this.lineHeight() +
     
    223237    measureSize(text) {
    224238        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
    225         var _context = getDummyContext(), fontSize = this.fontSize(), metrics;
     239        let _context = getDummyContext(), fontSize = this.fontSize(), metrics;
    226240        _context.save();
    227241        _context.font = this._getContextFont();
     
    258272            line = line.trim();
    259273        }
    260         var width = this._getTextWidth(line);
     274        const width = this._getTextWidth(line);
    261275        return this.textArr.push({
    262276            text: line,
     
    266280    }
    267281    _getTextWidth(text) {
    268         var letterSpacing = this.letterSpacing();
    269         var length = text.length;
     282        const letterSpacing = this.letterSpacing();
     283        const length = text.length;
    270284        return (getDummyContext().measureText(text).width +
    271285            (length ? letterSpacing * (length - 1) : 0));
    272286    }
    273287    _setTextData() {
    274         var lines = this.text().split('\n'), fontSize = +this.fontSize(), textWidth = 0, lineHeightPx = this.lineHeight() * fontSize, width = this.attrs.width, height = this.attrs.height, fixedWidth = width !== AUTO && width !== undefined, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxWidth = width - padding * 2, maxHeightPx = height - padding * 2, currentHeightPx = 0, wrap = this.wrap(), shouldWrap = wrap !== NONE, wrapAtWord = wrap !== CHAR && shouldWrap, shouldAddEllipsis = this.ellipsis();
     288        let lines = this.text().split('\n'), fontSize = +this.fontSize(), textWidth = 0, lineHeightPx = this.lineHeight() * fontSize, width = this.attrs.width, height = this.attrs.height, fixedWidth = width !== AUTO && width !== undefined, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxWidth = width - padding * 2, maxHeightPx = height - padding * 2, currentHeightPx = 0, wrap = this.wrap(), shouldWrap = wrap !== NONE, wrapAtWord = wrap !== CHAR && shouldWrap, shouldAddEllipsis = this.ellipsis();
    275289        this.textArr = [];
    276290        getDummyContext().font = this._getContextFont();
    277         var additionalWidth = shouldAddEllipsis ? this._getTextWidth(ELLIPSIS) : 0;
    278         for (var i = 0, max = lines.length; i < max; ++i) {
    279             var line = lines[i];
    280             var lineWidth = this._getTextWidth(line);
     291        const additionalWidth = shouldAddEllipsis ? this._getTextWidth(ELLIPSIS) : 0;
     292        for (let i = 0, max = lines.length; i < max; ++i) {
     293            let line = lines[i];
     294            let lineWidth = this._getTextWidth(line);
    281295            if (fixedWidth && lineWidth > maxWidth) {
    282296                while (line.length > 0) {
    283                     var low = 0, high = line.length, match = '', matchWidth = 0;
     297                    let low = 0, high = line.length, match = '', matchWidth = 0;
    284298                    while (low < high) {
    285                         var mid = (low + high) >>> 1, substr = line.slice(0, mid + 1), substrWidth = this._getTextWidth(substr) + additionalWidth;
     299                        const mid = (low + high) >>> 1, substr = line.slice(0, mid + 1), substrWidth = this._getTextWidth(substr) + additionalWidth;
    286300                        if (substrWidth <= maxWidth) {
    287301                            low = mid + 1;
     
    296310                        if (wrapAtWord) {
    297311                            var wrapIndex;
    298                             var nextChar = line[match.length];
    299                             var nextIsSpaceOrDash = nextChar === SPACE || nextChar === DASH;
     312                            const nextChar = line[match.length];
     313                            const nextIsSpaceOrDash = nextChar === SPACE || nextChar === DASH;
    300314                            if (nextIsSpaceOrDash && matchWidth <= maxWidth) {
    301315                                wrapIndex = match.length;
     
    316330                        textWidth = Math.max(textWidth, matchWidth);
    317331                        currentHeightPx += lineHeightPx;
    318                         var shouldHandleEllipsis = this._shouldHandleEllipsis(currentHeightPx);
     332                        const shouldHandleEllipsis = this._shouldHandleEllipsis(currentHeightPx);
    319333                        if (shouldHandleEllipsis) {
    320334                            this._tryToAddEllipsisToLastLine();
     
    357371    }
    358372    _shouldHandleEllipsis(currentHeightPx) {
    359         var fontSize = +this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, height = this.attrs.height, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxHeightPx = height - padding * 2, wrap = this.wrap(), shouldWrap = wrap !== NONE;
     373        const fontSize = +this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, height = this.attrs.height, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxHeightPx = height - padding * 2, wrap = this.wrap(), shouldWrap = wrap !== NONE;
    360374        return (!shouldWrap ||
    361375            (fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx));
    362376    }
    363377    _tryToAddEllipsisToLastLine() {
    364         var width = this.attrs.width, fixedWidth = width !== AUTO && width !== undefined, padding = this.padding(), maxWidth = width - padding * 2, shouldAddEllipsis = this.ellipsis();
    365         var lastLine = this.textArr[this.textArr.length - 1];
     378        const width = this.attrs.width, fixedWidth = width !== AUTO && width !== undefined, padding = this.padding(), maxWidth = width - padding * 2, shouldAddEllipsis = this.ellipsis();
     379        const lastLine = this.textArr[this.textArr.length - 1];
    366380        if (!lastLine || !shouldAddEllipsis) {
    367381            return;
    368382        }
    369383        if (fixedWidth) {
    370             var haveSpace = this._getTextWidth(lastLine.text + ELLIPSIS) < maxWidth;
     384            const haveSpace = this._getTextWidth(lastLine.text + ELLIPSIS) < maxWidth;
    371385            if (!haveSpace) {
    372386                lastLine.text = lastLine.text.slice(0, lastLine.text.length - 3);
  • imaps-frontend/node_modules/konva/lib/shapes/TextPath.d.ts

    rd565449 r0c6b92a  
    2929    _getTextPathLength(): number;
    3030    _getPointAtLength(length: number): {
    31         x: any;
    32         y: any;
     31        x: number;
     32        y: number;
    3333    } | null;
    3434    _readDataAttribute(): void;
  • imaps-frontend/node_modules/konva/lib/shapes/TextPath.js

    rd565449 r0c6b92a  
    99const Validators_1 = require("../Validators");
    1010const Global_1 = require("../Global");
    11 var EMPTY_STRING = '', NORMAL = 'normal';
     11const EMPTY_STRING = '', NORMAL = 'normal';
    1212function _fillFunc(context) {
    1313    context.fillText(this.partialText, 0, 0);
     
    5151        context.setAttr('textAlign', 'left');
    5252        context.save();
    53         var textDecoration = this.textDecoration();
    54         var fill = this.fill();
    55         var fontSize = this.fontSize();
    56         var glyphInfo = this.glyphInfo;
     53        const textDecoration = this.textDecoration();
     54        const fill = this.fill();
     55        const fontSize = this.fontSize();
     56        const glyphInfo = this.glyphInfo;
    5757        if (textDecoration === 'underline') {
    5858            context.beginPath();
    5959        }
    60         for (var i = 0; i < glyphInfo.length; i++) {
     60        for (let i = 0; i < glyphInfo.length; i++) {
    6161            context.save();
    62             var p0 = glyphInfo[i].p0;
     62            const p0 = glyphInfo[i].p0;
    6363            context.translate(p0.x, p0.y);
    6464            context.rotate(glyphInfo[i].rotation);
     
    8282    _hitFunc(context) {
    8383        context.beginPath();
    84         var glyphInfo = this.glyphInfo;
     84        const glyphInfo = this.glyphInfo;
    8585        if (glyphInfo.length >= 1) {
    86             var p0 = glyphInfo[0].p0;
     86            const p0 = glyphInfo[0].p0;
    8787            context.moveTo(p0.x, p0.y);
    8888        }
    89         for (var i = 0; i < glyphInfo.length; i++) {
    90             var p1 = glyphInfo[i].p1;
     89        for (let i = 0; i < glyphInfo.length; i++) {
     90            const p1 = glyphInfo[i].p1;
    9191            context.lineTo(p1.x, p1.y);
    9292        }
     
    109109    }
    110110    _getTextSize(text) {
    111         var dummyCanvas = this.dummyCanvas;
    112         var _context = dummyCanvas.getContext('2d');
     111        const dummyCanvas = this.dummyCanvas;
     112        const _context = dummyCanvas.getContext('2d');
    113113        _context.save();
    114114        _context.font = this._getContextFont();
    115         var metrics = _context.measureText(text);
     115        const metrics = _context.measureText(text);
    116116        _context.restore();
    117117        return {
     
    141141        const charArr = (0, Text_1.stringToArray)(this.text());
    142142        let offsetToGlyph = offset;
    143         for (var i = 0; i < charArr.length; i++) {
     143        for (let i = 0; i < charArr.length; i++) {
    144144            const charStartPoint = this._getPointAtLength(offsetToGlyph);
    145145            if (!charStartPoint)
     
    188188            };
    189189        }
    190         var points = [];
     190        const points = [];
    191191        this.glyphInfo.forEach(function (info) {
    192192            points.push(info.p0.x);
     
    195195            points.push(info.p1.y);
    196196        });
    197         var minX = points[0] || 0;
    198         var maxX = points[0] || 0;
    199         var minY = points[1] || 0;
    200         var maxY = points[1] || 0;
    201         var x, y;
    202         for (var i = 0; i < points.length / 2; i++) {
     197        let minX = points[0] || 0;
     198        let maxX = points[0] || 0;
     199        let minY = points[1] || 0;
     200        let maxY = points[1] || 0;
     201        let x, y;
     202        for (let i = 0; i < points.length / 2; i++) {
    203203            x = points[i * 2];
    204204            y = points[i * 2 + 1];
     
    208208            maxY = Math.max(maxY, y);
    209209        }
    210         var fontSize = this.fontSize();
     210        const fontSize = this.fontSize();
    211211        return {
    212212            x: minX - fontSize / 2,
  • imaps-frontend/node_modules/konva/lib/shapes/Transformer.d.ts

    rd565449 r0c6b92a  
    9595        attrs: any;
    9696        className: string;
    97         children?: any[] | undefined;
     97        children?: Array<any>;
    9898    };
    9999    clone(obj?: any): this;
  • imaps-frontend/node_modules/konva/lib/shapes/Transformer.js

    rd565449 r0c6b92a  
    1111const Validators_1 = require("../Validators");
    1212const Global_2 = require("../Global");
    13 var EVENTS_NAME = 'tr-konva';
    14 var ATTR_CHANGE_LIST = [
     13const EVENTS_NAME = 'tr-konva';
     14const ATTR_CHANGE_LIST = [
    1515    'resizeEnabledChange',
    1616    'rotateAnchorOffsetChange',
     
    3131    .map((e) => e + `.${EVENTS_NAME}`)
    3232    .join(' ');
    33 var NODES_RECT = 'nodesRect';
    34 var TRANSFORM_CHANGE_STR = [
     33const NODES_RECT = 'nodesRect';
     34const TRANSFORM_CHANGE_STR = [
    3535    'widthChange',
    3636    'heightChange',
     
    4545    'strokeWidthChange',
    4646];
    47 var ANGLES = {
     47const ANGLES = {
    4848    'top-left': -45,
    4949    'top-center': 0,
     
    6161    }
    6262    rad += Util_1.Util.degToRad(ANGLES[anchorName] || 0);
    63     var angle = ((Util_1.Util.radToDeg(rad) % 360) + 360) % 360;
     63    const angle = ((Util_1.Util.radToDeg(rad) % 360) + 360) % 360;
    6464    if (Util_1.Util._inRange(angle, 315 + 22.5, 360) || Util_1.Util._inRange(angle, 0, 22.5)) {
    6565        return 'ns-resize';
     
    9191    }
    9292}
    93 var ANCHORS_NAMES = [
     93const ANCHORS_NAMES = [
    9494    'top-left',
    9595    'top-center',
     
    101101    'bottom-right',
    102102];
    103 var MAX_SAFE_INTEGER = 100000000;
     103const MAX_SAFE_INTEGER = 100000000;
    104104function getCenter(shape) {
    105105    return {
     
    208208        });
    209209        this._resetTransformCache();
    210         var elementsCreated = !!this.findOne('.top-left');
     210        const elementsCreated = !!this.findOne('.top-left');
    211211        if (elementsCreated) {
    212212            this.update();
     
    270270    }
    271271    __getNodeShape(node, rot = this.rotation(), relative) {
    272         var rect = node.getClientRect({
     272        const rect = node.getClientRect({
    273273            skipTransform: true,
    274274            skipShadow: true,
    275275            skipStroke: this.ignoreStroke(),
    276276        });
    277         var absScale = node.getAbsoluteScale(relative);
    278         var absPos = node.getAbsolutePosition(relative);
    279         var dx = rect.x * absScale.x - node.offsetX() * absScale.x;
    280         var dy = rect.y * absScale.y - node.offsetY() * absScale.y;
     277        const absScale = node.getAbsoluteScale(relative);
     278        const absPos = node.getAbsolutePosition(relative);
     279        const dx = rect.x * absScale.x - node.offsetX() * absScale.x;
     280        const dy = rect.y * absScale.y - node.offsetY() * absScale.y;
    281281        const rotation = (Global_1.Konva.getAngle(node.getAbsoluteRotation()) + Math.PI * 2) %
    282282            (Math.PI * 2);
     
    294294    }
    295295    __getNodeRect() {
    296         var node = this.getNode();
     296        const node = this.getNode();
    297297        if (!node) {
    298298            return {
     
    311311                skipStroke: this.ignoreStroke(),
    312312            });
    313             var points = [
     313            const points = [
    314314                { x: box.x, y: box.y },
    315315                { x: box.x + box.width, y: box.y },
     
    317317                { x: box.x, y: box.y + box.height },
    318318            ];
    319             var trans = node.getAbsoluteTransform();
     319            const trans = node.getAbsoluteTransform();
    320320            points.forEach(function (point) {
    321                 var transformed = trans.point(point);
     321                const transformed = trans.point(point);
    322322                totalPoints.push(transformed);
    323323            });
     
    325325        const tr = new Util_1.Transform();
    326326        tr.rotate(-Global_1.Konva.getAngle(this.rotation()));
    327         var minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
     327        let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
    328328        totalPoints.forEach(function (point) {
    329             var transformed = tr.point(point);
     329            const transformed = tr.point(point);
    330330            if (minX === undefined) {
    331331                minX = maxX = transformed.x;
     
    367367    }
    368368    _createAnchor(name) {
    369         var anchor = new Rect_1.Rect({
     369        const anchor = new Rect_1.Rect({
    370370            stroke: 'rgb(0, 161, 255)',
    371371            fill: 'white',
     
    376376            hitStrokeWidth: TOUCH_DEVICE ? 10 : 'auto',
    377377        });
    378         var self = this;
     378        const self = this;
    379379        anchor.on('mousedown touchstart', function (e) {
    380380            self._handleMouseDown(e);
     
    388388        });
    389389        anchor.on('mouseenter', () => {
    390             var rad = Global_1.Konva.getAngle(this.rotation());
    391             var rotateCursor = this.rotateAnchorCursor();
    392             var cursor = getCursor(name, rad, rotateCursor);
     390            const rad = Global_1.Konva.getAngle(this.rotation());
     391            const rotateCursor = this.rotateAnchorCursor();
     392            const cursor = getCursor(name, rad, rotateCursor);
    393393            anchor.getStage().content &&
    394394                (anchor.getStage().content.style.cursor = cursor);
     
    403403    }
    404404    _createBack() {
    405         var back = new Shape_1.Shape({
     405        const back = new Shape_1.Shape({
    406406            name: 'back',
    407407            width: 0,
     
    409409            draggable: true,
    410410            sceneFunc(ctx, shape) {
    411                 var tr = shape.getParent();
    412                 var padding = tr.padding();
     411                const tr = shape.getParent();
     412                const padding = tr.padding();
    413413                ctx.beginPath();
    414414                ctx.rect(-padding, -padding, shape.width() + padding * 2, shape.height() + padding * 2);
     
    423423                    return;
    424424                }
    425                 var padding = this.padding();
     425                const padding = this.padding();
    426426                ctx.beginPath();
    427427                ctx.rect(-padding, -padding, shape.width() + padding * 2, shape.height() + padding * 2);
     
    449449        }
    450450        this._movingAnchorName = e.target.name().split(' ')[0];
    451         var attrs = this._getNodeRect();
    452         var width = attrs.width;
    453         var height = attrs.height;
    454         var hypotenuse = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
     451        const attrs = this._getNodeRect();
     452        const width = attrs.width;
     453        const height = attrs.height;
     454        const hypotenuse = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
    455455        this.sin = Math.abs(height / hypotenuse);
    456456        this.cos = Math.abs(width / hypotenuse);
     
    462462        }
    463463        this._transforming = true;
    464         var ap = e.target.getAbsolutePosition();
    465         var pos = e.target.getStage().getPointerPosition();
     464        const ap = e.target.getAbsolutePosition();
     465        const pos = e.target.getStage().getPointerPosition();
    466466        this._anchorDragOffset = {
    467467            x: pos.x - ap.x,
     
    475475    }
    476476    _handleMouseMove(e) {
    477         var x, y, newHypotenuse;
    478         var anchorNode = this.findOne('.' + this._movingAnchorName);
    479         var stage = anchorNode.getStage();
     477        let x, y, newHypotenuse;
     478        const anchorNode = this.findOne('.' + this._movingAnchorName);
     479        const stage = anchorNode.getStage();
    480480        stage.setPointersPositions(e);
    481481        const pp = stage.getPointerPosition();
     
    494494        }
    495495        if (this._movingAnchorName === 'rotater') {
    496             var attrs = this._getNodeRect();
     496            const attrs = this._getNodeRect();
    497497            x = anchorNode.x() - attrs.width / 2;
    498498            y = -anchorNode.y() + attrs.height / 2;
     
    501501                delta -= Math.PI;
    502502            }
    503             var oldRotation = Global_1.Konva.getAngle(this.rotation());
     503            const oldRotation = Global_1.Konva.getAngle(this.rotation());
    504504            const newRotation = oldRotation + delta;
    505505            const tol = Global_1.Konva.getAngle(this.rotationSnapTolerance());
     
    510510            return;
    511511        }
    512         var shiftBehavior = this.shiftBehavior();
    513         var keepProportion;
     512        const shiftBehavior = this.shiftBehavior();
     513        let keepProportion;
    514514        if (shiftBehavior === 'inverted') {
    515515            keepProportion = this.keepRatio() && !e.shiftKey;
     
    630630        var centeredScaling = this.centeredScaling() || e.altKey;
    631631        if (centeredScaling) {
    632             var topLeft = this.findOne('.top-left');
    633             var bottomRight = this.findOne('.bottom-right');
    634             var topOffsetX = topLeft.x();
    635             var topOffsetY = topLeft.y();
    636             var bottomOffsetX = this.getWidth() - bottomRight.x();
    637             var bottomOffsetY = this.getHeight() - bottomRight.y();
     632            const topLeft = this.findOne('.top-left');
     633            const bottomRight = this.findOne('.bottom-right');
     634            const topOffsetX = topLeft.x();
     635            const topOffsetY = topLeft.y();
     636            const bottomOffsetX = this.getWidth() - bottomRight.x();
     637            const bottomOffsetY = this.getHeight() - bottomRight.y();
    638638            bottomRight.move({
    639639                x: -topOffsetX,
     
    645645            });
    646646        }
    647         var absPos = this.findOne('.top-left').getAbsolutePosition();
     647        const absPos = this.findOne('.top-left').getAbsolutePosition();
    648648        x = absPos.x;
    649649        y = absPos.y;
    650         var width = this.findOne('.bottom-right').x() - this.findOne('.top-left').x();
    651         var height = this.findOne('.bottom-right').y() - this.findOne('.top-left').y();
     650        const width = this.findOne('.bottom-right').x() - this.findOne('.top-left').x();
     651        const height = this.findOne('.bottom-right').y() - this.findOne('.top-left').y();
    652652        this._fitNodesInto({
    653653            x: x,
     
    674674                window.removeEventListener('touchend', this._handleMouseUp, true);
    675675            }
    676             var node = this.getNode();
     676            const node = this.getNode();
    677677            activeTransformersCount--;
    678678            this._fire('transformend', { evt: e, target: node });
     
    689689    }
    690690    _fitNodesInto(newAttrs, evt) {
    691         var oldAttrs = this._getNodeRect();
     691        const oldAttrs = this._getNodeRect();
    692692        const minSize = 1;
    693693        if (Util_1.Util._inRange(newAttrs.width, -this.padding() * 2 - minSize, minSize)) {
     
    699699            return;
    700700        }
    701         var t = new Util_1.Transform();
     701        const t = new Util_1.Transform();
    702702        t.rotate(Global_1.Konva.getAngle(this.rotation()));
    703703        if (this._movingAnchorName &&
     
    816816    update() {
    817817        var _a;
    818         var attrs = this._getNodeRect();
     818        const attrs = this._getNodeRect();
    819819        this.rotation(Util_1.Util._getRotation(attrs.rotation));
    820         var width = attrs.width;
    821         var height = attrs.height;
    822         var enabledAnchors = this.enabledAnchors();
    823         var resizeEnabled = this.resizeEnabled();
    824         var padding = this.padding();
    825         var anchorSize = this.anchorSize();
     820        const width = attrs.width;
     821        const height = attrs.height;
     822        const enabledAnchors = this.enabledAnchors();
     823        const resizeEnabled = this.resizeEnabled();
     824        const padding = this.padding();
     825        const anchorSize = this.anchorSize();
    826826        const anchors = this.find('._anchor');
    827827        anchors.forEach((node) => {
     
    918918        if (this._transforming) {
    919919            this._removeEvents();
    920             var anchorNode = this.findOne('.' + this._movingAnchorName);
     920            const anchorNode = this.findOne('.' + this._movingAnchorName);
    921921            if (anchorNode) {
    922922                anchorNode.stopDrag();
     
    937937    }
    938938    clone(obj) {
    939         var node = Node_1.Node.prototype.clone.call(this, obj);
     939        const node = Node_1.Node.prototype.clone.call(this, obj);
    940940        return node;
    941941    }
  • imaps-frontend/node_modules/konva/package.json

    rd565449 r0c6b92a  
    11{
    22  "name": "konva",
    3   "version": "9.3.14",
     3  "version": "9.3.16",
    44  "author": "Anton Lavrenov",
    55  "files": [
     
    2121    "test:build": "parcel build ./test/unit-tests.html --dist-dir ./test-build --target none --public-url ./ --no-source-maps",
    2222    "test:browser": "npm run test:build && mocha-headless-chrome -f ./test-build/unit-tests.html -a disable-web-security",
    23     "test:watch": "rm -rf ./.parcel-cache && parcel serve ./test/unit-tests.html ./test/manual-tests.html ./test/sandbox.html ./test/text-paths.html ./test/bunnies.html",
     23    "test:watch": "rm -rf ./.parcel-cache && PARCEL_WORKERS=0  parcel serve ./test/unit-tests.html ./test/manual-tests.html ./test/sandbox.html ./test/text-paths.html ./test/bunnies.html",
    2424    "test:node": "ts-mocha -r ./test/node-global-setup.mjs -p ./test/tsconfig.json test/unit/**/*.ts --exit && npm run test:import",
    2525    "tsc": "tsc --removeComments",
     
    8282    "process": "^0.11.10",
    8383    "rollup": "^4.9.1",
    84     "rollup-plugin-commonjs": "^10.1.0",
    85     "rollup-plugin-node-resolve": "^5.2.0",
    86     "rollup-plugin-sourcemaps": "^0.6.3",
    8784    "rollup-plugin-typescript2": "^0.36.0",
    8885    "size-limit": "^11.0.1",
Note: See TracChangeset for help on using the changeset viewer.