@visactor/react-vtable 1.14.4-alpha.5 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -347,64 +347,104 @@
347
347
  var eventemitter3Exports = eventemitter3.exports;
348
348
  var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
349
349
 
350
- const isType$2 = (value, type) => Object.prototype.toString.call(value) === `[object ${type}]`;
351
- var isType$3 = isType$2;
350
+ const isType = (value, type) => Object.prototype.toString.call(value) === `[object ${type}]`;
351
+ var isType$1 = isType;
352
+
353
+ const isBoolean = function (value) {
354
+ let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
355
+ return fuzzy ? "boolean" == typeof value : !0 === value || !1 === value || isType$1(value, "Boolean");
356
+ };
357
+ var isBoolean$1 = isBoolean;
352
358
 
353
- const isFunction$2 = value => "function" == typeof value;
354
- var isFunction$3 = isFunction$2;
359
+ const isFunction = value => "function" == typeof value;
360
+ var isFunction$1 = isFunction;
355
361
 
356
- const isNil$2 = value => null == value;
357
- var isNil$3 = isNil$2;
362
+ const isNil = value => null == value;
363
+ var isNil$1 = isNil;
358
364
 
359
- const isValid$2 = value => null != value;
360
- var isValid$3 = isValid$2;
365
+ const isValid = value => null != value;
366
+ var isValid$1 = isValid;
361
367
 
362
- const isObject$2 = value => {
368
+ const isObject = value => {
363
369
  const type = typeof value;
364
370
  return null !== value && "object" === type || "function" === type;
365
371
  };
366
- var isObject$3 = isObject$2;
372
+ var isObject$1 = isObject;
367
373
 
368
- const isObjectLike$2 = value => "object" == typeof value && null !== value;
369
- var isObjectLike$3 = isObjectLike$2;
374
+ const isObjectLike = value => "object" == typeof value && null !== value;
375
+ var isObjectLike$1 = isObjectLike;
370
376
 
371
- const isPlainObject$2 = function (value) {
372
- if (!isObjectLike$3(value) || !isType$3(value, "Object")) return !1;
377
+ const isPlainObject = function (value) {
378
+ if (!isObjectLike$1(value) || !isType$1(value, "Object")) return !1;
373
379
  if (null === Object.getPrototypeOf(value)) return !0;
374
380
  let proto = value;
375
381
  for (; null !== Object.getPrototypeOf(proto);) proto = Object.getPrototypeOf(proto);
376
382
  return Object.getPrototypeOf(value) === proto;
377
383
  };
378
- var isPlainObject$3 = isPlainObject$2;
384
+ var isPlainObject$1 = isPlainObject;
379
385
 
380
- const isString$2 = function (value) {
386
+ const isString = function (value) {
381
387
  let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
382
388
  const type = typeof value;
383
- return fuzzy ? "string" === type : "string" === type || isType$3(value, "String");
389
+ return fuzzy ? "string" === type : "string" === type || isType$1(value, "String");
384
390
  };
385
- var isString$3 = isString$2;
391
+ var isString$1 = isString;
386
392
 
387
- const isArray$2 = value => Array.isArray ? Array.isArray(value) : isType$3(value, "Array");
388
- var isArray$3 = isArray$2;
393
+ const isArray = value => Array.isArray ? Array.isArray(value) : isType$1(value, "Array");
394
+ var isArray$1 = isArray;
389
395
 
390
- const isArrayLike$2 = function (value) {
396
+ const isArrayLike = function (value) {
391
397
  return null !== value && "function" != typeof value && Number.isFinite(value.length);
392
398
  };
393
- var isArrayLike$3 = isArrayLike$2;
399
+ var isArrayLike$1 = isArrayLike;
394
400
 
395
- const isNumber$2 = function (value) {
401
+ const isNumber = function (value) {
396
402
  let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
397
403
  const type = typeof value;
398
- return fuzzy ? "number" === type : "number" === type || isType$3(value, "Number");
404
+ return fuzzy ? "number" === type : "number" === type || isType$1(value, "Number");
399
405
  };
400
- var isNumber$3 = isNumber$2;
406
+ var isNumber$1 = isNumber;
407
+
408
+ const isValidNumber = value => isNumber$1(value) && Number.isFinite(value);
409
+ var isValidNumber$1 = isValidNumber;
410
+
411
+ const isValidUrl = value => new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(value);
412
+ var isValidUrl$1 = isValidUrl;
413
+
414
+ const isBase64 = value => new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(value);
415
+ var isBase64$1 = isBase64;
416
+
417
+ const getType = value => ({}).toString.call(value).replace(/^\[object /, "").replace(/]$/, "");
418
+ var getType$1 = getType;
419
+
420
+ const objectProto = Object.prototype,
421
+ isPrototype = function (value) {
422
+ const Ctor = value && value.constructor;
423
+ return value === ("function" == typeof Ctor && Ctor.prototype || objectProto);
424
+ };
425
+ var isPrototype$1 = isPrototype;
426
+
427
+ const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
428
+ function isEmpty(value) {
429
+ if (isNil$1(value)) return !0;
430
+ if (isArrayLike$1(value)) return !value.length;
431
+ const type = getType$1(value);
432
+ if ("Map" === type || "Set" === type) return !value.size;
433
+ if (isPrototype$1(value)) return !Object.keys(value).length;
434
+ for (const key in value) if (hasOwnProperty$1.call(value, key)) return !1;
435
+ return !0;
436
+ }
437
+
438
+ const hasOwnProperty = Object.prototype.hasOwnProperty,
439
+ has = (object, key) => null != object && hasOwnProperty.call(object, key);
440
+ var has$1 = has;
401
441
 
402
- function baseMerge$1(target, source) {
442
+ function baseMerge(target, source) {
403
443
  let shallowArray = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
404
444
  let skipTargetArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
405
445
  if (source) {
406
446
  if (target === source) return;
407
- if (isValid$3(source) && "object" == typeof source) {
447
+ if (isValid$1(source) && "object" == typeof source) {
408
448
  const iterable = Object(source),
409
449
  props = [];
410
450
  for (const key in iterable) props.push(key);
@@ -414,51 +454,51 @@
414
454
  propIndex = -1;
415
455
  for (; length--;) {
416
456
  const key = props[++propIndex];
417
- !isValid$3(iterable[key]) || "object" != typeof iterable[key] || skipTargetArray && isArray$3(target[key]) ? assignMergeValue$1(target, key, iterable[key]) : baseMergeDeep$1(target, source, key, shallowArray, skipTargetArray);
457
+ !isValid$1(iterable[key]) || "object" != typeof iterable[key] || skipTargetArray && isArray$1(target[key]) ? assignMergeValue(target, key, iterable[key]) : baseMergeDeep(target, source, key, shallowArray, skipTargetArray);
418
458
  }
419
459
  }
420
460
  }
421
461
  }
422
- function baseMergeDeep$1(target, source, key) {
462
+ function baseMergeDeep(target, source, key) {
423
463
  let shallowArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
424
464
  let skipTargetArray = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
425
465
  const objValue = target[key],
426
466
  srcValue = source[key];
427
467
  let newValue = source[key],
428
468
  isCommon = !0;
429
- if (isArray$3(srcValue)) {
430
- if (shallowArray) newValue = [];else if (isArray$3(objValue)) newValue = objValue;else if (isArrayLike$3(objValue)) {
469
+ if (isArray$1(srcValue)) {
470
+ if (shallowArray) newValue = [];else if (isArray$1(objValue)) newValue = objValue;else if (isArrayLike$1(objValue)) {
431
471
  newValue = new Array(objValue.length);
432
472
  let index = -1;
433
473
  const length = objValue.length;
434
474
  for (; ++index < length;) newValue[index] = objValue[index];
435
475
  }
436
- } else isPlainObject$3(srcValue) ? (newValue = null != objValue ? objValue : {}, "function" != typeof objValue && "object" == typeof objValue || (newValue = {})) : isCommon = !1;
437
- isCommon && baseMerge$1(newValue, srcValue, shallowArray, skipTargetArray), assignMergeValue$1(target, key, newValue);
476
+ } else isPlainObject$1(srcValue) ? (newValue = null != objValue ? objValue : {}, "function" != typeof objValue && "object" == typeof objValue || (newValue = {})) : isCommon = !1;
477
+ isCommon && baseMerge(newValue, srcValue, shallowArray, skipTargetArray), assignMergeValue(target, key, newValue);
438
478
  }
439
- function assignMergeValue$1(target, key, value) {
440
- (void 0 !== value && !eq$1(target[key], value) || void 0 === value && !(key in target)) && (target[key] = value);
479
+ function assignMergeValue(target, key, value) {
480
+ (void 0 !== value && !eq(target[key], value) || void 0 === value && !(key in target)) && (target[key] = value);
441
481
  }
442
- function eq$1(value, other) {
482
+ function eq(value, other) {
443
483
  return value === other || Number.isNaN(value) && Number.isNaN(other);
444
484
  }
445
- function merge$1(target) {
485
+ function merge(target) {
446
486
  let sourceIndex = -1;
447
487
  const length = arguments.length <= 1 ? 0 : arguments.length - 1;
448
488
  for (; ++sourceIndex < length;) {
449
- baseMerge$1(target, sourceIndex + 1 < 1 || arguments.length <= sourceIndex + 1 ? undefined : arguments[sourceIndex + 1], !0);
489
+ baseMerge(target, sourceIndex + 1 < 1 || arguments.length <= sourceIndex + 1 ? undefined : arguments[sourceIndex + 1], !0);
450
490
  }
451
491
  return target;
452
492
  }
453
493
 
454
494
  function pickWithout(obj, keys) {
455
- if (!obj || !isPlainObject$3(obj)) return obj;
495
+ if (!obj || !isPlainObject$1(obj)) return obj;
456
496
  const result = {};
457
497
  return Object.keys(obj).forEach(k => {
458
498
  const v = obj[k];
459
499
  let match = !1;
460
500
  keys.forEach(itKey => {
461
- (isString$3(itKey) && itKey === k || itKey instanceof RegExp && k.match(itKey)) && (match = !0);
501
+ (isString$1(itKey) && itKey === k || itKey instanceof RegExp && k.match(itKey)) && (match = !0);
462
502
  }), match || (result[k] = v);
463
503
  }), result;
464
504
  }
@@ -475,14 +515,14 @@
475
515
  if (null == a || null == b) return !1;
476
516
  if (Number.isNaN(a) && Number.isNaN(b)) return !0;
477
517
  if (objToString(a) !== objToString(b)) return !1;
478
- if (isFunction$3(a)) return !!(null == options ? void 0 : options.skipFunction);
518
+ if (isFunction$1(a)) return !!(null == options ? void 0 : options.skipFunction);
479
519
  if ("object" != typeof a) return !1;
480
- if (isArray$3(a)) {
520
+ if (isArray$1(a)) {
481
521
  if (a.length !== b.length) return !1;
482
522
  for (let i = a.length - 1; i >= 0; i--) if (!isEqual(a[i], b[i], options)) return !1;
483
523
  return !0;
484
524
  }
485
- if (!isPlainObject$3(a)) return !1;
525
+ if (!isPlainObject$1(a)) return !1;
486
526
  const ka = objectKeys(a),
487
527
  kb = objectKeys(b);
488
528
  if (ka.length !== kb.length) return !1;
@@ -495,2087 +535,1880 @@
495
535
  return !0;
496
536
  }
497
537
 
498
- const calculateAnchorOfBounds$1 = (bounds, anchorType) => {
499
- const {
500
- x1: x1,
501
- x2: x2,
502
- y1: y1,
503
- y2: y2
504
- } = bounds,
505
- rectWidth = Math.abs(x2 - x1),
506
- rectHeight = Math.abs(y2 - y1);
507
- let anchorX = (x1 + x2) / 2,
508
- anchorY = (y1 + y2) / 2,
509
- sx = 0,
510
- sy = 0;
511
- switch (anchorType) {
512
- case "top":
513
- case "inside-top":
514
- sy = -.5;
515
- break;
516
- case "bottom":
517
- case "inside-bottom":
518
- sy = .5;
519
- break;
520
- case "left":
521
- case "inside-left":
522
- sx = -.5;
523
- break;
524
- case "right":
525
- case "inside-right":
526
- sx = .5;
527
- break;
528
- case "top-right":
529
- sx = .5, sy = -.5;
530
- break;
531
- case "top-left":
532
- sx = -.5, sy = -.5;
533
- break;
534
- case "bottom-right":
535
- sx = .5, sy = .5;
536
- break;
537
- case "bottom-left":
538
- sx = -.5, sy = .5;
539
- }
540
- return anchorX += sx * rectWidth, anchorY += sy * rectHeight, {
541
- x: anchorX,
542
- y: anchorY
543
- };
544
- };
538
+ function arrayEqual(a, b) {
539
+ if (!isArray$1(a) || !isArray$1(b)) return !1;
540
+ if (a.length !== b.length) return !1;
541
+ for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return !1;
542
+ return !0;
543
+ }
545
544
 
546
- const styleStringToObject$1 = function () {
547
- let styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
548
- const res = {};
549
- return styleStr.split(";").forEach(item => {
550
- if (item) {
551
- const arr = item.split(":");
552
- if (2 === arr.length) {
553
- const key = arr[0].trim(),
554
- value = arr[1].trim();
555
- key && value && (res[key] = value);
556
- }
545
+ const hasConsole = "undefined" != typeof console;
546
+ function log(method, level, input) {
547
+ const args = [level].concat([].slice.call(input));
548
+ hasConsole && console[method].apply(console, args);
549
+ }
550
+ var LoggerLevel;
551
+ !function (LoggerLevel) {
552
+ LoggerLevel[LoggerLevel.None = 0] = "None", LoggerLevel[LoggerLevel.Error = 1] = "Error", LoggerLevel[LoggerLevel.Warn = 2] = "Warn", LoggerLevel[LoggerLevel.Info = 3] = "Info", LoggerLevel[LoggerLevel.Debug = 4] = "Debug";
553
+ }(LoggerLevel || (LoggerLevel = {}));
554
+ class Logger {
555
+ static getInstance(level, method) {
556
+ return Logger._instance && isNumber$1(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
557
+ }
558
+ static setInstance(logger) {
559
+ return Logger._instance = logger;
560
+ }
561
+ static setInstanceLevel(level) {
562
+ Logger._instance ? Logger._instance.level(level) : Logger._instance = new Logger(level);
563
+ }
564
+ static clearInstance() {
565
+ Logger._instance = null;
566
+ }
567
+ constructor() {
568
+ let level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : LoggerLevel.None;
569
+ let method = arguments.length > 1 ? arguments[1] : undefined;
570
+ this._onErrorHandler = [], this._level = level, this._method = method;
571
+ }
572
+ addErrorHandler(handler) {
573
+ this._onErrorHandler.find(h => h === handler) || this._onErrorHandler.push(handler);
574
+ }
575
+ removeErrorHandler(handler) {
576
+ const index = this._onErrorHandler.findIndex(h => h === handler);
577
+ index < 0 || this._onErrorHandler.splice(index, 1);
578
+ }
579
+ callErrorHandler() {
580
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
581
+ args[_key] = arguments[_key];
557
582
  }
558
- }), res;
559
- };
583
+ this._onErrorHandler.forEach(h => h(...args));
584
+ }
585
+ canLogInfo() {
586
+ return this._level >= LoggerLevel.Info;
587
+ }
588
+ canLogDebug() {
589
+ return this._level >= LoggerLevel.Debug;
590
+ }
591
+ canLogError() {
592
+ return this._level >= LoggerLevel.Error;
593
+ }
594
+ canLogWarn() {
595
+ return this._level >= LoggerLevel.Warn;
596
+ }
597
+ level(levelValue) {
598
+ return arguments.length ? (this._level = +levelValue, this) : this._level;
599
+ }
600
+ error() {
601
+ var _a;
602
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
603
+ args[_key2] = arguments[_key2];
604
+ }
605
+ return this._level >= LoggerLevel.Error && (this._onErrorHandler.length ? this.callErrorHandler(...args) : log(null !== (_a = this._method) && void 0 !== _a ? _a : "error", "ERROR", args)), this;
606
+ }
607
+ warn() {
608
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
609
+ args[_key3] = arguments[_key3];
610
+ }
611
+ return this._level >= LoggerLevel.Warn && log(this._method || "warn", "WARN", args), this;
612
+ }
613
+ info() {
614
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
615
+ args[_key4] = arguments[_key4];
616
+ }
617
+ return this._level >= LoggerLevel.Info && log(this._method || "log", "INFO", args), this;
618
+ }
619
+ debug() {
620
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
621
+ args[_key5] = arguments[_key5];
622
+ }
623
+ return this._level >= LoggerLevel.Debug && log(this._method || "log", "DEBUG", args), this;
624
+ }
625
+ }
626
+ Logger._instance = null;
560
627
 
561
- var reactIs = {exports: {}};
628
+ const clamp = function (input, min, max) {
629
+ return input < min ? min : input > max ? max : input;
630
+ };
631
+ var clamp$1 = clamp;
562
632
 
563
- var reactIs_production_min = {};
633
+ const epsilon = 1e-12;
634
+ const pi = Math.PI;
635
+ const halfPi$1 = pi / 2;
636
+ const tau = 2 * pi;
637
+ const pi2 = 2 * Math.PI;
638
+ const abs = Math.abs;
639
+ const atan2 = Math.atan2;
640
+ const cos = Math.cos;
641
+ const max = Math.max;
642
+ const min = Math.min;
643
+ const sin = Math.sin;
644
+ const sqrt = Math.sqrt;
645
+ const pow = Math.pow;
646
+ function asin(x) {
647
+ return x >= 1 ? halfPi$1 : x <= -1 ? -halfPi$1 : Math.asin(x);
648
+ }
564
649
 
565
- /**
566
- * @license React
567
- * react-is.production.min.js
568
- *
569
- * Copyright (c) Facebook, Inc. and its affiliates.
570
- *
571
- * This source code is licensed under the MIT license found in the
572
- * LICENSE file in the root directory of this source tree.
573
- */
574
- var hasRequiredReactIs_production_min;
575
- function requireReactIs_production_min() {
576
- if (hasRequiredReactIs_production_min) return reactIs_production_min;
577
- hasRequiredReactIs_production_min = 1;
578
- var b = Symbol.for("react.element"),
579
- c = Symbol.for("react.portal"),
580
- d = Symbol.for("react.fragment"),
581
- e = Symbol.for("react.strict_mode"),
582
- f = Symbol.for("react.profiler"),
583
- g = Symbol.for("react.provider"),
584
- h = Symbol.for("react.context"),
585
- k = Symbol.for("react.server_context"),
586
- l = Symbol.for("react.forward_ref"),
587
- m = Symbol.for("react.suspense"),
588
- n = Symbol.for("react.suspense_list"),
589
- p = Symbol.for("react.memo"),
590
- q = Symbol.for("react.lazy"),
591
- t = Symbol.for("react.offscreen"),
592
- u;
593
- u = Symbol.for("react.module.reference");
594
- function v(a) {
595
- if ("object" === typeof a && null !== a) {
596
- var r = a.$$typeof;
597
- switch (r) {
598
- case b:
599
- switch (a = a.type, a) {
600
- case d:
601
- case f:
602
- case e:
603
- case m:
604
- case n:
605
- return a;
606
- default:
607
- switch (a = a && a.$$typeof, a) {
608
- case k:
609
- case h:
610
- case l:
611
- case q:
612
- case p:
613
- case g:
614
- return a;
615
- default:
616
- return r;
617
- }
618
- }
619
- case c:
620
- return r;
621
- }
622
- }
650
+ class Point {
651
+ constructor() {
652
+ let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
653
+ let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
654
+ let x1 = arguments.length > 2 ? arguments[2] : undefined;
655
+ let y1 = arguments.length > 3 ? arguments[3] : undefined;
656
+ this.x = 0, this.y = 0, this.x = x, this.y = y, this.x1 = x1, this.y1 = y1;
623
657
  }
624
- reactIs_production_min.ContextConsumer = h;
625
- reactIs_production_min.ContextProvider = g;
626
- reactIs_production_min.Element = b;
627
- reactIs_production_min.ForwardRef = l;
628
- reactIs_production_min.Fragment = d;
629
- reactIs_production_min.Lazy = q;
630
- reactIs_production_min.Memo = p;
631
- reactIs_production_min.Portal = c;
632
- reactIs_production_min.Profiler = f;
633
- reactIs_production_min.StrictMode = e;
634
- reactIs_production_min.Suspense = m;
635
- reactIs_production_min.SuspenseList = n;
636
- reactIs_production_min.isAsyncMode = function () {
637
- return !1;
638
- };
639
- reactIs_production_min.isConcurrentMode = function () {
640
- return !1;
641
- };
642
- reactIs_production_min.isContextConsumer = function (a) {
643
- return v(a) === h;
644
- };
645
- reactIs_production_min.isContextProvider = function (a) {
646
- return v(a) === g;
647
- };
648
- reactIs_production_min.isElement = function (a) {
649
- return "object" === typeof a && null !== a && a.$$typeof === b;
650
- };
651
- reactIs_production_min.isForwardRef = function (a) {
652
- return v(a) === l;
653
- };
654
- reactIs_production_min.isFragment = function (a) {
655
- return v(a) === d;
656
- };
657
- reactIs_production_min.isLazy = function (a) {
658
- return v(a) === q;
659
- };
660
- reactIs_production_min.isMemo = function (a) {
661
- return v(a) === p;
662
- };
663
- reactIs_production_min.isPortal = function (a) {
664
- return v(a) === c;
665
- };
666
- reactIs_production_min.isProfiler = function (a) {
667
- return v(a) === f;
668
- };
669
- reactIs_production_min.isStrictMode = function (a) {
670
- return v(a) === e;
658
+ clone() {
659
+ return new Point(this.x, this.y);
660
+ }
661
+ copyFrom(p) {
662
+ return this.x = p.x, this.y = p.y, this.x1 = p.x1, this.y1 = p.y1, this.defined = p.defined, this.context = p.context, this;
663
+ }
664
+ set(x, y) {
665
+ return this.x = x, this.y = y, this;
666
+ }
667
+ add(point) {
668
+ return isNumber$1(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
669
+ }
670
+ sub(point) {
671
+ return isNumber$1(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
672
+ }
673
+ multi(point) {
674
+ throw new Error("暂不支持");
675
+ }
676
+ div(point) {
677
+ throw new Error("暂不支持");
678
+ }
679
+ }
680
+ class PointService {
681
+ static distancePP(p1, p2) {
682
+ return sqrt(pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2));
683
+ }
684
+ static distanceNN(x, y, x1, y1) {
685
+ return sqrt(pow(x - x1, 2) + pow(y - y1, 2));
686
+ }
687
+ static distancePN(point, x, y) {
688
+ return sqrt(pow(x - point.x, 2) + pow(y - point.y, 2));
689
+ }
690
+ static pointAtPP(p1, p2, t) {
691
+ return new Point((p2.x - p1.x) * t + p1.x, (p2.y - p1.y) * t + p1.y);
692
+ }
693
+ }
694
+
695
+ function degreeToRadian(degree) {
696
+ return degree * (Math.PI / 180);
697
+ }
698
+ function radianToDegree(radian) {
699
+ return 180 * radian / Math.PI;
700
+ }
701
+ const clampRadian = function () {
702
+ let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
703
+ if (angle < 0) for (; angle < -tau;) angle += tau;else if (angle > 0) for (; angle > tau;) angle -= tau;
704
+ return angle;
705
+ };
706
+ const clampAngleByRadian = clampRadian;
707
+
708
+ var InnerBBox;
709
+ !function (InnerBBox) {
710
+ InnerBBox[InnerBBox.NONE = 0] = "NONE", InnerBBox[InnerBBox.BBOX1 = 1] = "BBOX1", InnerBBox[InnerBBox.BBOX2 = 2] = "BBOX2";
711
+ }(InnerBBox || (InnerBBox = {}));
712
+ function getProjectionRadius(checkAxis, axis) {
713
+ return Math.abs(axis[0] * checkAxis[0] + axis[1] * checkAxis[1]);
714
+ }
715
+ function rotatePoint(_ref, rad) {
716
+ let {
717
+ x: x,
718
+ y: y
719
+ } = _ref;
720
+ let origin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
721
+ x: 0,
722
+ y: 0
671
723
  };
672
- reactIs_production_min.isSuspense = function (a) {
673
- return v(a) === m;
724
+ return {
725
+ x: (x - origin.x) * Math.cos(rad) - (y - origin.y) * Math.sin(rad) + origin.x,
726
+ y: (x - origin.x) * Math.sin(rad) + (y - origin.y) * Math.cos(rad) + origin.y
674
727
  };
675
- reactIs_production_min.isSuspenseList = function (a) {
676
- return v(a) === n;
728
+ }
729
+ function getCenterPoint(box) {
730
+ return {
731
+ x: (box.x1 + box.x2) / 2,
732
+ y: (box.y1 + box.y2) / 2
677
733
  };
678
- reactIs_production_min.isValidElementType = function (a) {
679
- return "string" === typeof a || "function" === typeof a || a === d || a === f || a === e || a === m || a === n || a === t || "object" === typeof a && null !== a && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g || a.$$typeof === h || a.$$typeof === l || a.$$typeof === u || void 0 !== a.getModuleId) ? !0 : !1;
734
+ }
735
+ function toRect(box, isDeg) {
736
+ const deg = isDeg ? degreeToRadian(box.angle) : box.angle,
737
+ cp = getCenterPoint(box);
738
+ return [rotatePoint({
739
+ x: box.x1,
740
+ y: box.y1
741
+ }, deg, cp), rotatePoint({
742
+ x: box.x2,
743
+ y: box.y1
744
+ }, deg, cp), rotatePoint({
745
+ x: box.x2,
746
+ y: box.y2
747
+ }, deg, cp), rotatePoint({
748
+ x: box.x1,
749
+ y: box.y2
750
+ }, deg, cp)];
751
+ }
752
+ function isRotateAABBIntersect(box1, box2) {
753
+ let isDeg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
754
+ const rect1 = toRect(box1, isDeg),
755
+ rect2 = toRect(box2, isDeg),
756
+ vector = (start, end) => [end.x - start.x, end.y - start.y],
757
+ vp1p2 = vector(getCenterPoint(box1), getCenterPoint(box2)),
758
+ AB = vector(rect1[0], rect1[1]),
759
+ BC = vector(rect1[1], rect1[2]),
760
+ A1B1 = vector(rect2[0], rect2[1]),
761
+ B1C1 = vector(rect2[1], rect2[2]),
762
+ deg11 = isDeg ? degreeToRadian(box1.angle) : box1.angle;
763
+ let deg12 = isDeg ? degreeToRadian(90 - box1.angle) : box1.angle + halfPi$1;
764
+ const deg21 = isDeg ? degreeToRadian(box2.angle) : box2.angle;
765
+ let deg22 = isDeg ? degreeToRadian(90 - box2.angle) : box2.angle + halfPi$1;
766
+ deg12 > pi2 && (deg12 -= pi2), deg22 > pi2 && (deg22 -= pi2);
767
+ const isCover = (checkAxisRadius, deg, targetAxis1, targetAxis2) => {
768
+ const checkAxis = [Math.cos(deg), Math.sin(deg)];
769
+ return checkAxisRadius + (getProjectionRadius(checkAxis, targetAxis1) + getProjectionRadius(checkAxis, targetAxis2)) / 2 > getProjectionRadius(checkAxis, vp1p2);
680
770
  };
681
- reactIs_production_min.typeOf = v;
682
- return reactIs_production_min;
771
+ return isCover((box1.x2 - box1.x1) / 2, deg11, A1B1, B1C1) && isCover((box1.y2 - box1.y1) / 2, deg12, A1B1, B1C1) && isCover((box2.x2 - box2.x1) / 2, deg21, AB, BC) && isCover((box2.y2 - box2.y1) / 2, deg22, AB, BC);
683
772
  }
684
773
 
685
- {
686
- reactIs.exports = requireReactIs_production_min();
774
+ function getContextFont(text) {
775
+ let defaultAttr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
776
+ let fontSizeScale = arguments.length > 2 ? arguments[2] : undefined;
777
+ fontSizeScale || (fontSizeScale = 1);
778
+ const {
779
+ fontStyle = defaultAttr.fontStyle,
780
+ fontVariant = defaultAttr.fontVariant,
781
+ fontWeight = defaultAttr.fontWeight,
782
+ fontSize = defaultAttr.fontSize,
783
+ fontFamily = defaultAttr.fontFamily
784
+ } = text;
785
+ return (fontStyle ? fontStyle + " " : "") + (fontVariant ? fontVariant + " " : "") + (fontWeight ? fontWeight + " " : "") + fontSize * fontSizeScale + "px " + (fontFamily || "sans-serif");
687
786
  }
688
- var reactIsExports = reactIs.exports;
689
-
690
- const toArray = (children) => {
691
- let result = [];
692
- React.Children.forEach(children, child => {
693
- if (isNil$3(child)) {
694
- return;
695
- }
696
- if (reactIsExports.isFragment(child)) {
697
- result = result.concat(toArray(child.props.children));
698
- }
699
- else {
700
- result.push(child);
701
- }
702
- });
703
- return result;
704
- };
705
-
706
- const REACT_PRIVATE_PROPS = ['children', 'hooks', 'ref'];
707
787
 
708
- const EVENT_TYPE = {
709
- ...vtable.TABLE_EVENT_TYPE,
710
- ...vtable.PIVOT_TABLE_EVENT_TYPE,
711
- ...vtable.PIVOT_CHART_EVENT_TYPE
712
- };
713
- const TABLE_EVENTS = {
714
- onClickCell: EVENT_TYPE.CLICK_CELL,
715
- onDblClickCell: EVENT_TYPE.DBLCLICK_CELL,
716
- onMouseDownCell: EVENT_TYPE.MOUSEDOWN_CELL,
717
- onMouseUpCell: EVENT_TYPE.MOUSEUP_CELL,
718
- onSelectedCell: EVENT_TYPE.SELECTED_CELL,
719
- onSelectedClear: EVENT_TYPE.SELECTED_CLEAR,
720
- onKeyDown: EVENT_TYPE.KEYDOWN,
721
- onMouseEnterTable: EVENT_TYPE.MOUSEENTER_TABLE,
722
- onMouseLeaveTable: EVENT_TYPE.MOUSELEAVE_TABLE,
723
- onMouseDownTable: EVENT_TYPE.MOUSEDOWN_TABLE,
724
- onMouseMoveCell: EVENT_TYPE.MOUSEMOVE_CELL,
725
- onMouseMoveTable: EVENT_TYPE.MOUSEMOVE_TABLE,
726
- onMouseEnterCell: EVENT_TYPE.MOUSEENTER_CELL,
727
- onMouseLeaveCell: EVENT_TYPE.MOUSELEAVE_CELL,
728
- onContextMenuCell: EVENT_TYPE.CONTEXTMENU_CELL,
729
- onResizeColumn: EVENT_TYPE.RESIZE_COLUMN,
730
- onResizeColumnEnd: EVENT_TYPE.RESIZE_COLUMN_END,
731
- onResizeRow: EVENT_TYPE.RESIZE_ROW,
732
- onResizeRowEnd: EVENT_TYPE.RESIZE_ROW_END,
733
- onChangeHeaderPositionStart: EVENT_TYPE.CHANGE_HEADER_POSITION_START,
734
- onChangeHeaderPosition: EVENT_TYPE.CHANGE_HEADER_POSITION,
735
- onChangeHeaderPositionFail: EVENT_TYPE.CHANGE_HEADER_POSITION_FAIL,
736
- onSortClick: EVENT_TYPE.SORT_CLICK,
737
- onAfterSort: EVENT_TYPE.AFTER_SORT,
738
- onFreezeClick: EVENT_TYPE.FREEZE_CLICK,
739
- onScroll: EVENT_TYPE.SCROLL,
740
- onScrollHorizontalEnd: EVENT_TYPE.SCROLL_HORIZONTAL_END,
741
- onScrollVerticalEnd: EVENT_TYPE.SCROLL_VERTICAL_END,
742
- onDropdownMenuClick: EVENT_TYPE.DROPDOWN_MENU_CLICK,
743
- onMouseOverChartSymbol: EVENT_TYPE.MOUSEOVER_CHART_SYMBOL,
744
- onDragSelectEnd: EVENT_TYPE.DRAG_SELECT_END,
745
- onCopyData: EVENT_TYPE.COPY_DATA,
746
- onDropdownIconClick: EVENT_TYPE.DROPDOWN_ICON_CLICK,
747
- onDropdownMenuClear: EVENT_TYPE.DROPDOWN_MENU_CLEAR,
748
- onTreeHierarchyStateChange: EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE,
749
- onShowMenu: EVENT_TYPE.SHOW_MENU,
750
- onHideMenu: EVENT_TYPE.HIDE_MENU,
751
- onIconClick: EVENT_TYPE.ICON_CLICK,
752
- onLegendItemClick: EVENT_TYPE.LEGEND_ITEM_CLICK,
753
- onLegendItemHover: EVENT_TYPE.LEGEND_ITEM_HOVER,
754
- onLegendItemUnHover: EVENT_TYPE.LEGEND_ITEM_UNHOVER,
755
- onLegendChange: EVENT_TYPE.LEGEND_CHANGE,
756
- onMouseEnterAxis: EVENT_TYPE.MOUSEENTER_AXIS,
757
- onMouseLeaveAxis: EVENT_TYPE.MOUSELEAVE_AXIS,
758
- onCheckboxStateChange: EVENT_TYPE.CHECKBOX_STATE_CHANGE,
759
- onRadioStateChange: EVENT_TYPE.RADIO_STATE_CHANGE,
760
- onAfterRender: EVENT_TYPE.AFTER_RENDER,
761
- onInitialized: EVENT_TYPE.INITIALIZED,
762
- onChangeCellValue: EVENT_TYPE.CHANGE_CELL_VALUE,
763
- onDragFillHandleEnd: EVENT_TYPE.DRAG_FILL_HANDLE_END,
764
- onMousedownFillHandle: EVENT_TYPE.MOUSEDOWN_FILL_HANDLE,
765
- onDblclickFillHandle: EVENT_TYPE.DBLCLICK_FILL_HANDLE,
766
- onPivotSortClick: EVENT_TYPE.PIVOT_SORT_CLICK,
767
- onDrillMenuClick: EVENT_TYPE.DRILLMENU_CLICK,
768
- onVChartEventType: EVENT_TYPE.VCHART_EVENT_TYPE,
769
- onChangCellValue: EVENT_TYPE.CHANGE_CELL_VALUE
770
- };
771
- const TABLE_EVENTS_KEYS = Object.keys(TABLE_EVENTS);
772
- const findEventProps = (props, supportedEvents = TABLE_EVENTS) => {
773
- const result = {};
774
- Object.keys(props).forEach(key => {
775
- if (supportedEvents[key] && props[key]) {
776
- result[key] = props[key];
777
- }
778
- });
779
- return result;
780
- };
781
- const bindEventsToTable = (table, newProps, prevProps, supportedEvents = TABLE_EVENTS) => {
782
- if ((!newProps && !prevProps) || !table) {
783
- return false;
784
- }
785
- const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;
786
- const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;
787
- if (prevEventProps) {
788
- Object.keys(prevEventProps).forEach(eventKey => {
789
- if (!newEventProps ||
790
- !newEventProps[eventKey] ||
791
- newEventProps[eventKey] !== prevEventProps[eventKey]) {
792
- table.off(supportedEvents[eventKey], prevProps[eventKey]);
793
- }
794
- });
795
- }
796
- if (newEventProps) {
797
- Object.keys(newEventProps).forEach(eventKey => {
798
- if (!prevEventProps ||
799
- !prevEventProps[eventKey] ||
800
- prevEventProps[eventKey] !== newEventProps[eventKey]) {
801
- table.on(supportedEvents[eventKey], newEventProps[eventKey]);
802
- }
803
- });
804
- }
805
- return true;
788
+ const calculateAnchorOfBounds = (bounds, anchorType) => {
789
+ const {
790
+ x1: x1,
791
+ x2: x2,
792
+ y1: y1,
793
+ y2: y2
794
+ } = bounds,
795
+ rectWidth = Math.abs(x2 - x1),
796
+ rectHeight = Math.abs(y2 - y1);
797
+ let anchorX = (x1 + x2) / 2,
798
+ anchorY = (y1 + y2) / 2,
799
+ sx = 0,
800
+ sy = 0;
801
+ switch (anchorType) {
802
+ case "top":
803
+ case "inside-top":
804
+ sy = -.5;
805
+ break;
806
+ case "bottom":
807
+ case "inside-bottom":
808
+ sy = .5;
809
+ break;
810
+ case "left":
811
+ case "inside-left":
812
+ sx = -.5;
813
+ break;
814
+ case "right":
815
+ case "inside-right":
816
+ sx = .5;
817
+ break;
818
+ case "top-right":
819
+ sx = .5, sy = -.5;
820
+ break;
821
+ case "top-left":
822
+ sx = -.5, sy = -.5;
823
+ break;
824
+ case "bottom-right":
825
+ sx = .5, sy = .5;
826
+ break;
827
+ case "bottom-left":
828
+ sx = -.5, sy = .5;
829
+ }
830
+ return anchorX += sx * rectWidth, anchorY += sy * rectHeight, {
831
+ x: anchorX,
832
+ y: anchorY
833
+ };
806
834
  };
807
835
 
808
- class Generator {
809
- static GenAutoIncrementId() {
810
- return Generator.auto_increment_id++;
811
- }
836
+ function transformBoundsWithMatrix(out, bounds, matrix) {
837
+ const {
838
+ x1: x1,
839
+ y1: y1,
840
+ x2: x2,
841
+ y2: y2
842
+ } = bounds;
843
+ return matrix.onlyTranslate() ? (out !== bounds && out.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2), out.translate(matrix.e, matrix.f), bounds) : (out.clear(), out.add(matrix.a * x1 + matrix.c * y1 + matrix.e, matrix.b * x1 + matrix.d * y1 + matrix.f), out.add(matrix.a * x2 + matrix.c * y1 + matrix.e, matrix.b * x2 + matrix.d * y1 + matrix.f), out.add(matrix.a * x2 + matrix.c * y2 + matrix.e, matrix.b * x2 + matrix.d * y2 + matrix.f), out.add(matrix.a * x1 + matrix.c * y2 + matrix.e, matrix.b * x1 + matrix.d * y2 + matrix.f), bounds);
812
844
  }
813
- Generator.auto_increment_id = 0;
814
-
815
- class ContainerModule {
816
- constructor(registry) {
817
- this.id = Generator.GenAutoIncrementId(), this.registry = registry;
845
+ class Bounds {
846
+ constructor(bounds) {
847
+ bounds ? this.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2) : this.clear();
818
848
  }
819
- }
820
-
821
- const NAMED_TAG = "named";
822
- const INJECT_TAG = "inject";
823
- const MULTI_INJECT_TAG = "multi_inject";
824
- const TAGGED = "inversify:tagged";
825
- const PARAM_TYPES = "inversify:paramtypes";
826
-
827
- class Metadata {
828
- constructor(key, value) {
829
- this.key = key, this.value = value;
849
+ clone() {
850
+ return new Bounds(this);
830
851
  }
831
- toString() {
832
- return this.key === NAMED_TAG ? `named: ${String(this.value).toString()} ` : `tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`;
852
+ clear() {
853
+ return this.x1 = +Number.MAX_VALUE, this.y1 = +Number.MAX_VALUE, this.x2 = -Number.MAX_VALUE, this.y2 = -Number.MAX_VALUE, this;
833
854
  }
834
- }
835
-
836
- var Reflect$1 = (function (Reflect) {
837
- var target;
838
- return function (exporter) {
839
- const supportsSymbol = "function" == typeof Symbol,
840
- toPrimitiveSymbol = supportsSymbol && void 0 !== Symbol.toPrimitive ? Symbol.toPrimitive : "@@toPrimitive",
841
- functionPrototype = (Object.getPrototypeOf(Function)),
842
- _Map = ("object" == typeof process && process.env && process.env.REFLECT_METADATA_USE_MAP_POLYFILL, Map),
843
- Metadata = (new WeakMap());
844
- function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
845
- if (!IsObject(target)) throw new TypeError();
846
- return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
847
- }
848
- function hasMetadata(metadataKey, target, propertyKey) {
849
- if (!IsObject(target)) throw new TypeError();
850
- return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryHasMetadata(metadataKey, target, propertyKey);
851
- }
852
- function hasOwnMetadata(metadataKey, target, propertyKey) {
853
- if (!IsObject(target)) throw new TypeError();
854
- return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);
855
- }
856
- function getMetadata(metadataKey, target, propertyKey) {
857
- if (!IsObject(target)) throw new TypeError();
858
- return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryGetMetadata(metadataKey, target, propertyKey);
859
- }
860
- function GetOrCreateMetadataMap(O, P, Create) {
861
- let targetMetadata = Metadata.get(O);
862
- if (IsUndefined(targetMetadata)) {
863
- if (!Create) return;
864
- targetMetadata = new _Map(), Metadata.set(O, targetMetadata);
865
- }
866
- let metadataMap = targetMetadata.get(P);
867
- if (IsUndefined(metadataMap)) {
868
- if (!Create) return;
869
- metadataMap = new _Map(), targetMetadata.set(P, metadataMap);
870
- }
871
- return metadataMap;
872
- }
873
- function OrdinaryHasMetadata(MetadataKey, O, P) {
874
- if (OrdinaryHasOwnMetadata(MetadataKey, O, P)) return !0;
875
- const parent = OrdinaryGetPrototypeOf(O);
876
- return !IsNull(parent) && OrdinaryHasMetadata(MetadataKey, parent, P);
877
- }
878
- function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
879
- const metadataMap = GetOrCreateMetadataMap(O, P, !1);
880
- return !IsUndefined(metadataMap) && ToBoolean(metadataMap.has(MetadataKey));
881
- }
882
- function OrdinaryGetMetadata(MetadataKey, O, P) {
883
- if (OrdinaryHasOwnMetadata(MetadataKey, O, P)) return OrdinaryGetOwnMetadata(MetadataKey, O, P);
884
- const parent = OrdinaryGetPrototypeOf(O);
885
- return IsNull(parent) ? void 0 : OrdinaryGetMetadata(MetadataKey, parent, P);
886
- }
887
- function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
888
- const metadataMap = GetOrCreateMetadataMap(O, P, !1);
889
- if (!IsUndefined(metadataMap)) return metadataMap.get(MetadataKey);
890
- }
891
- function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
892
- GetOrCreateMetadataMap(O, P, !0).set(MetadataKey, MetadataValue);
893
- }
894
- function Type(x) {
895
- if (null === x) return 1;
896
- switch (typeof x) {
897
- case "undefined":
898
- return 0;
899
- case "boolean":
900
- return 2;
901
- case "string":
902
- return 3;
903
- case "symbol":
904
- return 4;
905
- case "number":
906
- return 5;
907
- case "object":
908
- return null === x ? 1 : 6;
909
- default:
910
- return 6;
911
- }
912
- }
913
- function IsUndefined(x) {
914
- return void 0 === x;
915
- }
916
- function IsNull(x) {
917
- return null === x;
918
- }
919
- function IsSymbol(x) {
920
- return "symbol" == typeof x;
921
- }
922
- function IsObject(x) {
923
- return "object" == typeof x ? null !== x : "function" == typeof x;
924
- }
925
- function ToPrimitive(input, PreferredType) {
926
- switch (Type(input)) {
927
- case 0:
928
- case 1:
929
- case 2:
930
- case 3:
931
- case 4:
932
- case 5:
933
- return input;
934
- }
935
- const hint = 3 === PreferredType ? "string" : 5 === PreferredType ? "number" : "default",
936
- exoticToPrim = GetMethod(input, toPrimitiveSymbol);
937
- if (void 0 !== exoticToPrim) {
938
- const result = exoticToPrim.call(input, hint);
939
- if (IsObject(result)) throw new TypeError();
940
- return result;
941
- }
942
- return OrdinaryToPrimitive(input, "default" === hint ? "number" : hint);
943
- }
944
- function OrdinaryToPrimitive(O, hint) {
945
- if ("string" === hint) {
946
- const toString_1 = O.toString;
947
- if (IsCallable(toString_1)) {
948
- const result = toString_1.call(O);
949
- if (!IsObject(result)) return result;
950
- }
951
- const valueOf = O.valueOf;
952
- if (IsCallable(valueOf)) {
953
- const result = valueOf.call(O);
954
- if (!IsObject(result)) return result;
955
- }
956
- } else {
957
- const valueOf = O.valueOf;
958
- if (IsCallable(valueOf)) {
959
- const result = valueOf.call(O);
960
- if (!IsObject(result)) return result;
961
- }
962
- const toString_2 = O.toString;
963
- if (IsCallable(toString_2)) {
964
- const result = toString_2.call(O);
965
- if (!IsObject(result)) return result;
966
- }
967
- }
968
- throw new TypeError();
969
- }
970
- function ToBoolean(argument) {
971
- return !!argument;
972
- }
973
- function ToString(argument) {
974
- return "" + argument;
975
- }
976
- function ToPropertyKey(argument) {
977
- const key = ToPrimitive(argument, 3);
978
- return IsSymbol(key) ? key : ToString(key);
979
- }
980
- function IsCallable(argument) {
981
- return "function" == typeof argument;
982
- }
983
- function GetMethod(V, P) {
984
- const func = V[P];
985
- if (null != func) {
986
- if (!IsCallable(func)) throw new TypeError();
987
- return func;
988
- }
989
- }
990
- function OrdinaryGetPrototypeOf(O) {
991
- const proto = Object.getPrototypeOf(O);
992
- if ("function" != typeof O || O === functionPrototype) return proto;
993
- if (proto !== functionPrototype) return proto;
994
- const prototype = O.prototype,
995
- prototypeProto = prototype && Object.getPrototypeOf(prototype);
996
- if (null == prototypeProto || prototypeProto === Object.prototype) return proto;
997
- const constructor = prototypeProto.constructor;
998
- return "function" != typeof constructor || constructor === O ? proto : constructor;
999
- }
1000
- exporter("defineMetadata", defineMetadata), exporter("hasMetadata", hasMetadata), exporter("hasOwnMetadata", hasOwnMetadata), exporter("getMetadata", getMetadata);
1001
- }((target = Reflect, function (key, value) {
1002
- "function" != typeof target[key] && Object.defineProperty(target, key, {
1003
- configurable: !0,
1004
- writable: !0,
1005
- value: value
1006
- });
1007
- })), Reflect;
1008
- })({});
1009
-
1010
- function _tagParameterOrProperty(metadataKey, annotationTarget, key, metadata) {
1011
- const metadatas = [metadata];
1012
- let paramsOrPropertiesMetadata = {};
1013
- Reflect$1.hasOwnMetadata(metadataKey, annotationTarget) && (paramsOrPropertiesMetadata = Reflect$1.getMetadata(metadataKey, annotationTarget));
1014
- let paramOrPropertyMetadata = paramsOrPropertiesMetadata[key];
1015
- void 0 === paramOrPropertyMetadata && (paramOrPropertyMetadata = []), paramOrPropertyMetadata.push(...metadatas), paramsOrPropertiesMetadata[key] = paramOrPropertyMetadata, Reflect$1.defineMetadata(metadataKey, paramsOrPropertiesMetadata, annotationTarget);
1016
- }
1017
- function tagParameter(annotationTarget, parameterName, parameterIndex, metadata) {
1018
- _tagParameterOrProperty(TAGGED, annotationTarget, parameterIndex.toString(), metadata);
1019
- }
1020
- function createTaggedDecorator(metadata) {
1021
- return (target, targetKey, indexOrPropertyDescriptor) => {
1022
- tagParameter(target, targetKey, indexOrPropertyDescriptor, metadata);
1023
- };
1024
- }
1025
- function injectBase(metadataKey) {
1026
- return serviceIdentifier => (target, targetKey, indexOrPropertyDescriptor) => createTaggedDecorator(new Metadata(metadataKey, serviceIdentifier))(target, targetKey, indexOrPropertyDescriptor);
1027
- }
1028
-
1029
- const inject = injectBase(INJECT_TAG);
1030
-
1031
- function injectable() {
1032
- return function (target) {
1033
- return Reflect$1.defineMetadata(PARAM_TYPES, null, target), target;
1034
- };
1035
- }
1036
-
1037
- function named(name) {
1038
- return createTaggedDecorator(new Metadata(NAMED_TAG, name));
1039
- }
1040
-
1041
- const BindingScopeEnum = {
1042
- Singleton: "Singleton",
1043
- Transient: "Transient"
1044
- },
1045
- BindingTypeEnum = {
1046
- ConstantValue: "ConstantValue",
1047
- Constructor: "Constructor",
1048
- DynamicValue: "DynamicValue",
1049
- Factory: "Factory",
1050
- Function: "Function",
1051
- Instance: "Instance",
1052
- Invalid: "Invalid",
1053
- Provider: "Provider"
1054
- };
1055
-
1056
- class Binding {
1057
- constructor(serviceIdentifier, scope) {
1058
- this.id = Generator.GenAutoIncrementId(), this.activated = !1, this.serviceIdentifier = serviceIdentifier, this.scope = scope, this.type = BindingTypeEnum.Invalid, this.constraint = request => !0, this.implementationType = null, this.cache = null, this.factory = null, this.provider = null, this.dynamicValue = null;
1059
- }
1060
- clone() {
1061
- const clone = new Binding(this.serviceIdentifier, this.scope);
1062
- return clone.activated = clone.scope === BindingScopeEnum.Singleton && this.activated, clone.implementationType = this.implementationType, clone.dynamicValue = this.dynamicValue, clone.scope = this.scope, clone.type = this.type, clone.provider = this.provider, clone.constraint = this.constraint, clone.cache = this.cache, clone;
855
+ empty() {
856
+ return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE;
1063
857
  }
1064
- }
1065
-
1066
- class MetadataReader {
1067
- getConstructorMetadata(constructorFunc) {
1068
- return {
1069
- compilerGeneratedMetadata: Reflect$1.getMetadata(PARAM_TYPES, constructorFunc),
1070
- userGeneratedMetadata: Reflect$1.getMetadata(TAGGED, constructorFunc) || {}
1071
- };
858
+ equals(b) {
859
+ return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2;
1072
860
  }
1073
- getPropertiesMetadata(constructorFunc) {
1074
- throw new Error("暂未实现");
861
+ setValue() {
862
+ let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
863
+ let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
864
+ let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
865
+ let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
866
+ return this.x1 = x1, this.y1 = y1, this.x2 = x2, this.y2 = y2, this;
1075
867
  }
1076
- }
1077
-
1078
- const taggedConstraint = key => value => {
1079
- const constraint = request => {
1080
- if (null == request) return !1;
1081
- if (request.key === key && request.value === value) return !0;
1082
- if (null == request.constructorArgsMetadata) return !1;
1083
- const constructorArgsMetadata = request.constructorArgsMetadata;
1084
- for (let i = 0; i < constructorArgsMetadata.length; i++) if (constructorArgsMetadata[i].key === key && constructorArgsMetadata[i].value === value) return !0;
1085
- return !1;
1086
- };
1087
- return constraint.metaData = new Metadata(key, value), constraint;
1088
- };
1089
- const namedConstraint = taggedConstraint(NAMED_TAG);
1090
-
1091
- class BindingInSyntax {
1092
- constructor(binding) {
1093
- this._binding = binding;
868
+ set() {
869
+ let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
870
+ let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
871
+ let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
872
+ let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
873
+ return x2 < x1 ? (this.x2 = x1, this.x1 = x2) : (this.x1 = x1, this.x2 = x2), y2 < y1 ? (this.y2 = y1, this.y1 = y2) : (this.y1 = y1, this.y2 = y2), this;
1094
874
  }
1095
- inRequestScope() {
1096
- throw new Error("暂未实现");
875
+ add() {
876
+ let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
877
+ let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
878
+ return x < this.x1 && (this.x1 = x), y < this.y1 && (this.y1 = y), x > this.x2 && (this.x2 = x), y > this.y2 && (this.y2 = y), this;
1097
879
  }
1098
- inSingletonScope() {
1099
- return this._binding.scope = BindingScopeEnum.Singleton, this;
880
+ expand() {
881
+ let d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
882
+ return isArray$1(d) ? (this.y1 -= d[0], this.x2 += d[1], this.y2 += d[2], this.x1 -= d[3]) : (this.x1 -= d, this.y1 -= d, this.x2 += d, this.y2 += d), this;
1100
883
  }
1101
- inTransientScope() {
1102
- return this._binding.scope = BindingScopeEnum.Transient, this;
884
+ round() {
885
+ return this.x1 = Math.floor(this.x1), this.y1 = Math.floor(this.y1), this.x2 = Math.ceil(this.x2), this.y2 = Math.ceil(this.y2), this;
1103
886
  }
1104
- whenTargetNamed(name) {
1105
- return this._binding.constraint = namedConstraint(name), this;
887
+ translate() {
888
+ let dx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
889
+ let dy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
890
+ return this.x1 += dx, this.x2 += dx, this.y1 += dy, this.y2 += dy, this;
1106
891
  }
1107
- }
1108
-
1109
- class BindingToSyntax {
1110
- constructor(binding) {
1111
- this._binding = binding;
892
+ rotate() {
893
+ let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
894
+ let x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
895
+ let y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
896
+ const p = this.rotatedPoints(angle, x, y);
897
+ return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]);
1112
898
  }
1113
- to(constructor) {
1114
- return this._binding.type = BindingTypeEnum.Instance, this._binding.implementationType = constructor, new BindingInSyntax(this._binding);
899
+ scale() {
900
+ let sx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
901
+ let sy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
902
+ let x = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
903
+ let y = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
904
+ const p = this.scalePoints(sx, sy, x, y);
905
+ return this.clear().add(p[0], p[1]).add(p[2], p[3]);
1115
906
  }
1116
- toSelf() {
1117
- const self = this._binding.serviceIdentifier;
1118
- return this.to(self);
907
+ union(b) {
908
+ return b.x1 < this.x1 && (this.x1 = b.x1), b.y1 < this.y1 && (this.y1 = b.y1), b.x2 > this.x2 && (this.x2 = b.x2), b.y2 > this.y2 && (this.y2 = b.y2), this;
1119
909
  }
1120
- toDynamicValue(func) {
1121
- return this._binding.type = BindingTypeEnum.DynamicValue, this._binding.cache = null, this._binding.dynamicValue = func, this._binding.implementationType = null, new BindingInSyntax(this._binding);
910
+ intersect(b) {
911
+ return b.x1 > this.x1 && (this.x1 = b.x1), b.y1 > this.y1 && (this.y1 = b.y1), b.x2 < this.x2 && (this.x2 = b.x2), b.y2 < this.y2 && (this.y2 = b.y2), this;
1122
912
  }
1123
- toConstantValue(value) {
1124
- return this._binding.type = BindingTypeEnum.ConstantValue, this._binding.cache = value, this._binding.dynamicValue = null, this._binding.implementationType = null, this._binding.scope = BindingScopeEnum.Singleton, new BindingInSyntax(this._binding);
913
+ encloses(b) {
914
+ return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2;
1125
915
  }
1126
- toFactory(factory) {
1127
- return this._binding.type = BindingTypeEnum.Factory, this._binding.factory = factory, this._binding.scope = BindingScopeEnum.Singleton, new BindingInSyntax(this._binding);
916
+ alignsWith(b) {
917
+ return b && (this.x1 === b.x1 || this.x2 === b.x2 || this.y1 === b.y1 || this.y2 === b.y2);
1128
918
  }
1129
- toService(service) {
1130
- this.toDynamicValue(context => context.container.get(service));
919
+ intersects(b) {
920
+ return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2);
1131
921
  }
1132
- }
1133
-
1134
- class Container {
1135
- constructor(containerOptions) {
1136
- const options = containerOptions || {};
1137
- options.defaultScope = options.defaultScope || BindingScopeEnum.Transient, this.options = options, this.id = Generator.GenAutoIncrementId(), this._bindingDictionary = new Map(), this._metadataReader = new MetadataReader();
922
+ contains() {
923
+ let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
924
+ let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
925
+ return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2);
1138
926
  }
1139
- load(module) {
1140
- const containerModuleHelpers = this._getContainerModuleHelpersFactory()(module.id);
1141
- module.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction);
927
+ containsPoint(p) {
928
+ return !(p.x < this.x1 || p.x > this.x2 || p.y < this.y1 || p.y > this.y2);
1142
929
  }
1143
- get(serviceIdentifier) {
1144
- const getArgs = this._getNotAllArgs(serviceIdentifier, !1);
1145
- return this._get(getArgs);
930
+ width() {
931
+ return this.empty() ? 0 : this.x2 - this.x1;
1146
932
  }
1147
- getAll(serviceIdentifier) {
1148
- const getArgs = this._getAllArgs(serviceIdentifier);
1149
- return this._get(getArgs);
933
+ height() {
934
+ return this.empty() ? 0 : this.y2 - this.y1;
1150
935
  }
1151
- getTagged(serviceIdentifier, key, value) {
1152
- const getArgs = this._getNotAllArgs(serviceIdentifier, !1, key, value);
1153
- return this._get(getArgs);
936
+ scaleX() {
937
+ let s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
938
+ return this.x1 *= s, this.x2 *= s, this;
1154
939
  }
1155
- getNamed(serviceIdentifier, named) {
1156
- return this.getTagged(serviceIdentifier, NAMED_TAG, named);
940
+ scaleY() {
941
+ let s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
942
+ return this.y1 *= s, this.y2 *= s, this;
1157
943
  }
1158
- isBound(serviceIdentifier) {
1159
- return this._bindingDictionary.has(serviceIdentifier);
944
+ transformWithMatrix(matrix) {
945
+ return transformBoundsWithMatrix(this, this, matrix), this;
1160
946
  }
1161
- bind(serviceIdentifier) {
1162
- const scope = this.options.defaultScope,
1163
- binding = new Binding(serviceIdentifier, scope),
1164
- list = this._bindingDictionary.get(serviceIdentifier) || [];
1165
- return list.push(binding), this._bindingDictionary.set(serviceIdentifier, list), new BindingToSyntax(binding);
947
+ copy(b) {
948
+ return this.x1 = b.x1, this.y1 = b.y1, this.x2 = b.x2, this.y2 = b.y2, this;
1166
949
  }
1167
- unbind(serviceIdentifier) {
1168
- this._bindingDictionary.delete(serviceIdentifier);
950
+ rotatedPoints(angle, x, y) {
951
+ const {
952
+ x1: x1,
953
+ y1: y1,
954
+ x2: x2,
955
+ y2: y2
956
+ } = this,
957
+ cos = Math.cos(angle),
958
+ sin = Math.sin(angle),
959
+ cx = x - x * cos + y * sin,
960
+ cy = y - x * sin - y * cos;
961
+ return [cos * x1 - sin * y1 + cx, sin * x1 + cos * y1 + cy, cos * x1 - sin * y2 + cx, sin * x1 + cos * y2 + cy, cos * x2 - sin * y1 + cx, sin * x2 + cos * y1 + cy, cos * x2 - sin * y2 + cx, sin * x2 + cos * y2 + cy];
1169
962
  }
1170
- rebind(serviceIdentifier) {
1171
- return this.unbind(serviceIdentifier), this.bind(serviceIdentifier);
963
+ scalePoints(sx, sy, x, y) {
964
+ const {
965
+ x1: x1,
966
+ y1: y1,
967
+ x2: x2,
968
+ y2: y2
969
+ } = this;
970
+ return [sx * x1 + (1 - sx) * x, sy * y1 + (1 - sy) * y, sx * x2 + (1 - sx) * x, sy * y2 + (1 - sy) * y];
1172
971
  }
1173
- _getContainerModuleHelpersFactory() {
1174
- const setModuleId = (bindingToSyntax, moduleId) => {
1175
- bindingToSyntax._binding.moduleId = moduleId;
1176
- },
1177
- getBindFunction = moduleId => serviceIdentifier => {
1178
- const bindingToSyntax = this.bind(serviceIdentifier);
1179
- return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
1180
- },
1181
- getUnbindFunction = () => serviceIdentifier => this.unbind(serviceIdentifier),
1182
- getIsboundFunction = () => serviceIdentifier => this.isBound(serviceIdentifier),
1183
- getRebindFunction = moduleId => serviceIdentifier => {
1184
- const bindingToSyntax = this.rebind(serviceIdentifier);
1185
- return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
1186
- };
1187
- return mId => ({
1188
- bindFunction: getBindFunction(mId),
1189
- isboundFunction: getIsboundFunction(),
1190
- rebindFunction: getRebindFunction(mId),
1191
- unbindFunction: getUnbindFunction(),
1192
- unbindAsyncFunction: serviceIdentifier => null
1193
- });
972
+ }
973
+ class AABBBounds extends Bounds {}
974
+ class OBBBounds extends Bounds {
975
+ constructor(bounds) {
976
+ let angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
977
+ var _a;
978
+ super(bounds), bounds && (this.angle = null !== (_a = bounds.angle) && void 0 !== _a ? _a : angle);
1194
979
  }
1195
- _getNotAllArgs(serviceIdentifier, isMultiInject, key, value) {
1196
- return {
1197
- avoidConstraints: !1,
1198
- isMultiInject: isMultiInject,
1199
- serviceIdentifier: serviceIdentifier,
1200
- key: key,
1201
- value: value
1202
- };
980
+ intersects(b) {
981
+ return isRotateAABBIntersect(this, b);
1203
982
  }
1204
- _getAllArgs(serviceIdentifier) {
1205
- return {
1206
- avoidConstraints: !0,
1207
- isMultiInject: !0,
1208
- serviceIdentifier: serviceIdentifier
1209
- };
983
+ setValue() {
984
+ let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
985
+ let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
986
+ let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
987
+ let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
988
+ let angle = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
989
+ return super.setValue(x1, y1, x2, y2), this.angle = angle, this;
1210
990
  }
1211
- _get(getArgs) {
1212
- const result = [];
1213
- return this._bindingDictionary.get(getArgs.serviceIdentifier).filter(b => b.constraint(getArgs)).forEach(binding => {
1214
- result.push(this._resolveFromBinding(binding));
1215
- }), getArgs.isMultiInject || 1 !== result.length ? result : result[0];
991
+ clone() {
992
+ return new OBBBounds(this);
1216
993
  }
1217
- _getChildRequest(binding) {
1218
- const constr = binding.implementationType,
1219
- {
1220
- userGeneratedMetadata: userGeneratedMetadata
1221
- } = this._metadataReader.getConstructorMetadata(constr),
1222
- keys = Object.keys(userGeneratedMetadata),
1223
- arr = [];
1224
- for (let i = 0; i < keys.length; i++) {
1225
- const constructorArgsMetadata = userGeneratedMetadata[i],
1226
- targetMetadataMap = {};
1227
- constructorArgsMetadata.forEach(md => {
1228
- targetMetadataMap[md.key] = md.value;
1229
- });
1230
- const metadata = {
1231
- inject: targetMetadataMap[INJECT_TAG],
1232
- multiInject: targetMetadataMap[MULTI_INJECT_TAG]
1233
- },
1234
- injectIdentifier = metadata.inject || metadata.multiInject,
1235
- target = {
1236
- serviceIdentifier: injectIdentifier,
1237
- constructorArgsMetadata: constructorArgsMetadata
1238
- },
1239
- request = {
1240
- injectIdentifier: injectIdentifier,
1241
- metadata: constructorArgsMetadata,
1242
- bindings: this._bindingDictionary.get(injectIdentifier).filter(b => b.constraint(target))
1243
- };
1244
- arr.push(request);
1245
- }
1246
- return arr;
994
+ }
995
+
996
+ class Matrix {
997
+ constructor() {
998
+ let a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
999
+ let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1000
+ let c = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1001
+ let d = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
1002
+ let e = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
1003
+ let f = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
1004
+ this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f;
1247
1005
  }
1248
- _resolveFromBinding(binding) {
1249
- const result = this._getResolvedFromBinding(binding);
1250
- return this._saveToScope(binding, result), result;
1006
+ equalToMatrix(m2) {
1007
+ return !(this.e !== m2.e || this.f !== m2.f || this.a !== m2.a || this.d !== m2.d || this.b !== m2.b || this.c !== m2.c);
1251
1008
  }
1252
- _getResolvedFromBinding(binding) {
1253
- let result;
1254
- switch (binding.type) {
1255
- case BindingTypeEnum.ConstantValue:
1256
- case BindingTypeEnum.Function:
1257
- result = binding.cache;
1258
- break;
1259
- case BindingTypeEnum.Instance:
1260
- result = this._resolveInstance(binding, binding.implementationType);
1261
- break;
1262
- default:
1263
- result = binding.dynamicValue({
1264
- container: this
1265
- });
1266
- }
1267
- return result;
1009
+ equalTo(a, b, c, d, e, f) {
1010
+ return !(this.e !== e || this.f !== f || this.a !== a || this.d !== d || this.b !== b || this.c !== c);
1268
1011
  }
1269
- _resolveInstance(binding, constr) {
1270
- if (binding.activated) return binding.cache;
1271
- const childRequests = this._getChildRequest(binding);
1272
- return this._createInstance(constr, childRequests);
1012
+ setValue(a, b, c, d, e, f) {
1013
+ return this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f, this;
1273
1014
  }
1274
- _createInstance(constr, childRequests) {
1275
- if (childRequests.length) {
1276
- return new constr(...this._resolveRequests(childRequests));
1277
- }
1278
- return new constr();
1015
+ reset() {
1016
+ return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this;
1279
1017
  }
1280
- _resolveRequests(childRequests) {
1281
- return childRequests.map(request => request.bindings.length > 1 ? request.bindings.map(binding => this._resolveFromBinding(binding)) : this._resolveFromBinding(request.bindings[0]));
1018
+ getInverse() {
1019
+ const a = this.a,
1020
+ b = this.b,
1021
+ c = this.c,
1022
+ d = this.d,
1023
+ e = this.e,
1024
+ f = this.f,
1025
+ m = new Matrix(),
1026
+ dt = a * d - b * c;
1027
+ return m.a = d / dt, m.b = -b / dt, m.c = -c / dt, m.d = a / dt, m.e = (c * f - d * e) / dt, m.f = -(a * f - b * e) / dt, m;
1282
1028
  }
1283
- _saveToScope(binding, result) {
1284
- binding.scope === BindingScopeEnum.Singleton && (binding.cache = result, binding.activated = !0);
1029
+ rotate(rad) {
1030
+ const c = Math.cos(rad),
1031
+ s = Math.sin(rad),
1032
+ m11 = this.a * c + this.c * s,
1033
+ m12 = this.b * c + this.d * s,
1034
+ m21 = this.a * -s + this.c * c,
1035
+ m22 = this.b * -s + this.d * c;
1036
+ return this.a = m11, this.b = m12, this.c = m21, this.d = m22, this;
1285
1037
  }
1286
- }
1287
-
1288
- const ContributionProvider = Symbol("ContributionProvider");
1289
- class ContributionProviderCache {
1290
- constructor(serviceIdentifier, container) {
1291
- this.serviceIdentifier = serviceIdentifier, this.container = container;
1038
+ rotateByCenter(rad, cx, cy) {
1039
+ const cos = Math.cos(rad),
1040
+ sin = Math.sin(rad),
1041
+ rotateM13 = (1 - cos) * cx + sin * cy,
1042
+ rotateM23 = (1 - cos) * cy - sin * cx,
1043
+ m11 = cos * this.a - sin * this.b,
1044
+ m21 = sin * this.a + cos * this.b,
1045
+ m12 = cos * this.c - sin * this.d,
1046
+ m22 = sin * this.c + cos * this.d,
1047
+ m13 = cos * this.e - sin * this.f + rotateM13,
1048
+ m23 = sin * this.e + cos * this.f + rotateM23;
1049
+ return this.a = m11, this.b = m21, this.c = m12, this.d = m22, this.e = m13, this.f = m23, this;
1292
1050
  }
1293
- getContributions() {
1294
- return this.caches || (this.caches = [], this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier))), this.caches;
1051
+ scale(sx, sy) {
1052
+ return this.a *= sx, this.b *= sx, this.c *= sy, this.d *= sy, this;
1295
1053
  }
1296
- }
1297
- function bindContributionProvider(bind, id) {
1298
- bind(ContributionProvider).toDynamicValue(_ref => {
1299
- let {
1300
- container: container
1301
- } = _ref;
1302
- return new ContributionProviderCache(id, container);
1303
- }).inSingletonScope().whenTargetNamed(id);
1304
- }
1305
-
1306
- class Hook {
1307
- constructor(args, name) {
1308
- this._args = args, this.name = name, this.taps = [];
1054
+ setScale(sx, sy) {
1055
+ return this.b = this.b / this.a * sx, this.c = this.c / this.d * sy, this.a = sx, this.d = sy, this;
1309
1056
  }
1310
- tap(options, fn) {
1311
- this._tap("sync", options, fn);
1057
+ transform(a, b, c, d, e, f) {
1058
+ return this.multiply(a, b, c, d, e, f), this;
1312
1059
  }
1313
- unTap(options, fn) {
1314
- const name = "string" == typeof options ? options.trim() : options.name;
1315
- name && (this.taps = this.taps.filter(tap => !(tap.name === name && (!fn || tap.fn === fn))));
1060
+ translate(x, y) {
1061
+ return this.e += this.a * x + this.c * y, this.f += this.b * x + this.d * y, this;
1316
1062
  }
1317
- _parseOptions(type, options, fn) {
1318
- let _options;
1319
- if ("string" == typeof options) _options = {
1320
- name: options.trim()
1321
- };else if ("object" != typeof options || null === options) throw new Error("Invalid tap options");
1322
- if ("string" != typeof _options.name || "" === _options.name) throw new Error("Missing name for tap");
1323
- return _options = Object.assign({
1324
- type: type,
1325
- fn: fn
1326
- }, _options), _options;
1063
+ transpose() {
1064
+ const {
1065
+ a: a,
1066
+ b: b,
1067
+ c: c,
1068
+ d: d,
1069
+ e: e,
1070
+ f: f
1071
+ } = this;
1072
+ return this.a = b, this.b = a, this.c = d, this.d = c, this.e = f, this.f = e, this;
1327
1073
  }
1328
- _tap(type, options, fn) {
1329
- this._insert(this._parseOptions(type, options, fn));
1074
+ multiply(a2, b2, c2, d2, e2, f2) {
1075
+ const a1 = this.a,
1076
+ b1 = this.b,
1077
+ c1 = this.c,
1078
+ d1 = this.d,
1079
+ m11 = a1 * a2 + c1 * b2,
1080
+ m12 = b1 * a2 + d1 * b2,
1081
+ m21 = a1 * c2 + c1 * d2,
1082
+ m22 = b1 * c2 + d1 * d2,
1083
+ dx = a1 * e2 + c1 * f2 + this.e,
1084
+ dy = b1 * e2 + d1 * f2 + this.f;
1085
+ return this.a = m11, this.b = m12, this.c = m21, this.d = m22, this.e = dx, this.f = dy, this;
1330
1086
  }
1331
- _insert(item) {
1332
- let before;
1333
- "string" == typeof item.before ? before = new Set([item.before]) : Array.isArray(item.before) && (before = new Set(item.before));
1334
- let stage = 0;
1335
- "number" == typeof item.stage && (stage = item.stage);
1336
- let i = this.taps.length;
1337
- for (; i > 0;) {
1338
- i--;
1339
- const x = this.taps[i];
1340
- this.taps[i + 1] = x;
1341
- const xStage = x.stage || 0;
1342
- if (before) {
1343
- if (before.has(x.name)) {
1344
- before.delete(x.name);
1345
- continue;
1346
- }
1347
- if (before.size > 0) continue;
1348
- }
1349
- if (!(xStage > stage)) {
1350
- i++;
1351
- break;
1352
- }
1353
- }
1354
- this.taps[i] = item;
1087
+ interpolate(m2, t) {
1088
+ const m = new Matrix();
1089
+ return m.a = this.a + (m2.a - this.a) * t, m.b = this.b + (m2.b - this.b) * t, m.c = this.c + (m2.c - this.c) * t, m.d = this.d + (m2.d - this.d) * t, m.e = this.e + (m2.e - this.e) * t, m.f = this.f + (m2.f - this.f) * t, m;
1355
1090
  }
1356
- }
1357
-
1358
- class SyncHook extends Hook {
1359
- call() {
1360
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1361
- args[_key] = arguments[_key];
1091
+ transformPoint(source, target) {
1092
+ const {
1093
+ a: a,
1094
+ b: b,
1095
+ c: c,
1096
+ d: d,
1097
+ e: e,
1098
+ f: f
1099
+ } = this,
1100
+ dt = a * d - b * c,
1101
+ nextA = d / dt,
1102
+ nextB = -b / dt,
1103
+ nextC = -c / dt,
1104
+ nextD = a / dt,
1105
+ nextE = (c * f - d * e) / dt,
1106
+ nextF = -(a * f - b * e) / dt,
1107
+ {
1108
+ x: x,
1109
+ y: y
1110
+ } = source;
1111
+ target.x = x * nextA + y * nextC + nextE, target.y = x * nextB + y * nextD + nextF;
1112
+ }
1113
+ onlyTranslate() {
1114
+ let scale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
1115
+ return this.a === scale && 0 === this.b && 0 === this.c && this.d === scale;
1116
+ }
1117
+ clone() {
1118
+ return new Matrix(this.a, this.b, this.c, this.d, this.e, this.f);
1119
+ }
1120
+ toTransformAttrs() {
1121
+ const a = this.a,
1122
+ b = this.b,
1123
+ c = this.c,
1124
+ d = this.d,
1125
+ delta = a * d - b * c,
1126
+ result = {
1127
+ x: this.e,
1128
+ y: this.f,
1129
+ rotateDeg: 0,
1130
+ scaleX: 0,
1131
+ scaleY: 0,
1132
+ skewX: 0,
1133
+ skewY: 0
1134
+ };
1135
+ if (0 !== a || 0 !== b) {
1136
+ const r = Math.sqrt(a * a + b * b);
1137
+ result.rotateDeg = b > 0 ? Math.acos(a / r) : -Math.acos(a / r), result.scaleX = r, result.scaleY = delta / r, result.skewX = (a * c + b * d) / delta, result.skewY = 0;
1138
+ } else if (0 !== c || 0 !== d) {
1139
+ const s = Math.sqrt(c * c + d * d);
1140
+ result.rotateDeg = Math.PI / 2 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s)), result.scaleX = delta / s, result.scaleY = s, result.skewX = 0, result.skewY = (a * c + b * d) / delta;
1362
1141
  }
1363
- this.taps.map(t => t.fn).forEach(cb => cb(...args));
1142
+ return result.rotateDeg = radianToDegree(result.rotateDeg), result;
1364
1143
  }
1365
1144
  }
1145
+ function normalTransform(out, origin, x, y, scaleX, scaleY, angle, rotateCenter) {
1146
+ const oa = origin.a,
1147
+ ob = origin.b,
1148
+ oc = origin.c,
1149
+ od = origin.d,
1150
+ oe = origin.e,
1151
+ of = origin.f,
1152
+ cosTheta = cos(angle),
1153
+ sinTheta = sin(angle);
1154
+ let rotateCenterX, rotateCenterY;
1155
+ rotateCenter ? (rotateCenterX = rotateCenter[0], rotateCenterY = rotateCenter[1]) : (rotateCenterX = x, rotateCenterY = y);
1156
+ const offsetX = rotateCenterX - x,
1157
+ offsetY = rotateCenterY - y,
1158
+ a1 = oa * cosTheta + oc * sinTheta,
1159
+ b1 = ob * cosTheta + od * sinTheta,
1160
+ c1 = oc * cosTheta - oa * sinTheta,
1161
+ d1 = od * cosTheta - ob * sinTheta;
1162
+ out.a = scaleX * a1, out.b = scaleX * b1, out.c = scaleY * c1, out.d = scaleY * d1, out.e = oe + oa * rotateCenterX + oc * rotateCenterY - a1 * offsetX - c1 * offsetY, out.f = of + ob * rotateCenterX + od * rotateCenterY - b1 * offsetX - d1 * offsetY;
1163
+ }
1366
1164
 
1367
- const EnvContribution = Symbol.for("EnvContribution");
1368
- const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
1369
-
1370
- var MeasureModeEnum;
1371
- !function (MeasureModeEnum) {
1372
- MeasureModeEnum[MeasureModeEnum.estimate = 0] = "estimate", MeasureModeEnum[MeasureModeEnum.actualBounding = 1] = "actualBounding", MeasureModeEnum[MeasureModeEnum.fontBounding = 2] = "fontBounding";
1373
- }(MeasureModeEnum || (MeasureModeEnum = {}));
1374
-
1375
- const isType = (value, type) => Object.prototype.toString.call(value) === `[object ${type}]`;
1376
- var isType$1 = isType;
1377
-
1378
- const isBoolean = function (value) {
1379
- let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
1380
- return fuzzy ? "boolean" == typeof value : !0 === value || !1 === value || isType$1(value, "Boolean");
1381
- };
1382
- var isBoolean$1 = isBoolean;
1383
-
1384
- const isFunction = value => "function" == typeof value;
1385
- var isFunction$1 = isFunction;
1386
-
1387
- const isNil = value => null == value;
1388
- var isNil$1 = isNil;
1389
-
1390
- const isValid = value => null != value;
1391
- var isValid$1 = isValid;
1392
-
1393
- const isObject = value => {
1394
- const type = typeof value;
1395
- return null !== value && "object" === type || "function" === type;
1396
- };
1397
- var isObject$1 = isObject;
1398
-
1399
- const isObjectLike = value => "object" == typeof value && null !== value;
1400
- var isObjectLike$1 = isObjectLike;
1401
-
1402
- const isPlainObject = function (value) {
1403
- if (!isObjectLike$1(value) || !isType$1(value, "Object")) return !1;
1404
- if (null === Object.getPrototypeOf(value)) return !0;
1405
- let proto = value;
1406
- for (; null !== Object.getPrototypeOf(proto);) proto = Object.getPrototypeOf(proto);
1407
- return Object.getPrototypeOf(value) === proto;
1408
- };
1409
- var isPlainObject$1 = isPlainObject;
1410
-
1411
- const isString = function (value) {
1412
- let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
1413
- const type = typeof value;
1414
- return fuzzy ? "string" === type : "string" === type || isType$1(value, "String");
1415
- };
1416
- var isString$1 = isString;
1417
-
1418
- const isArray = value => Array.isArray ? Array.isArray(value) : isType$1(value, "Array");
1419
- var isArray$1 = isArray;
1420
-
1421
- const isArrayLike = function (value) {
1422
- return null !== value && "function" != typeof value && Number.isFinite(value.length);
1423
- };
1424
- var isArrayLike$1 = isArrayLike;
1425
-
1426
- const isNumber = function (value) {
1427
- let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
1428
- const type = typeof value;
1429
- return fuzzy ? "number" === type : "number" === type || isType$1(value, "Number");
1430
- };
1431
- var isNumber$1 = isNumber;
1432
-
1433
- const isValidNumber = value => isNumber$1(value) && Number.isFinite(value);
1434
- var isValidNumber$1 = isValidNumber;
1435
-
1436
- const isValidUrl = value => new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(value);
1437
- var isValidUrl$1 = isValidUrl;
1438
-
1439
- const isBase64 = value => new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(value);
1440
- var isBase64$1 = isBase64;
1441
-
1442
- const getType = value => ({}).toString.call(value).replace(/^\[object /, "").replace(/]$/, "");
1443
- var getType$1 = getType;
1444
-
1445
- const objectProto = Object.prototype,
1446
- isPrototype = function (value) {
1447
- const Ctor = value && value.constructor;
1448
- return value === ("function" == typeof Ctor && Ctor.prototype || objectProto);
1165
+ function hslToRgb(h, s, l) {
1166
+ s /= 100, l /= 100;
1167
+ const c = (1 - Math.abs(2 * l - 1)) * s,
1168
+ x = c * (1 - Math.abs(h / 60 % 2 - 1)),
1169
+ m = l - c / 2;
1170
+ let r = 0,
1171
+ g = 0,
1172
+ b = 0;
1173
+ return 0 <= h && h < 60 ? (r = c, g = x, b = 0) : 60 <= h && h < 120 ? (r = x, g = c, b = 0) : 120 <= h && h < 180 ? (r = 0, g = c, b = x) : 180 <= h && h < 240 ? (r = 0, g = x, b = c) : 240 <= h && h < 300 ? (r = x, g = 0, b = c) : 300 <= h && h < 360 && (r = c, g = 0, b = x), r = Math.round(255 * (r + m)), g = Math.round(255 * (g + m)), b = Math.round(255 * (b + m)), {
1174
+ r: r,
1175
+ g: g,
1176
+ b: b
1449
1177
  };
1450
- var isPrototype$1 = isPrototype;
1178
+ }
1451
1179
 
1452
- const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
1453
- function isEmpty(value) {
1454
- if (isNil$1(value)) return !0;
1455
- if (isArrayLike$1(value)) return !value.length;
1456
- const type = getType$1(value);
1457
- if ("Map" === type || "Set" === type) return !value.size;
1458
- if (isPrototype$1(value)) return !Object.keys(value).length;
1459
- for (const key in value) if (hasOwnProperty$1.call(value, key)) return !1;
1460
- return !0;
1180
+ function rgbToHsl(r, g, b) {
1181
+ r /= 255, g /= 255, b /= 255;
1182
+ const cMin = Math.min(r, g, b),
1183
+ cMax = Math.max(r, g, b),
1184
+ delta = cMax - cMin;
1185
+ let h = 0,
1186
+ s = 0,
1187
+ l = 0;
1188
+ return h = 0 === delta ? 0 : cMax === r ? (g - b) / delta % 6 : cMax === g ? (b - r) / delta + 2 : (r - g) / delta + 4, h = Math.round(60 * h), h < 0 && (h += 360), l = (cMax + cMin) / 2, s = 0 === delta ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(100 * s).toFixed(1), l = +(100 * l).toFixed(1), {
1189
+ h: h,
1190
+ s: s,
1191
+ l: l
1192
+ };
1461
1193
  }
1462
1194
 
1463
- const hasOwnProperty = Object.prototype.hasOwnProperty,
1464
- has = (object, key) => null != object && hasOwnProperty.call(object, key);
1465
- var has$1 = has;
1466
-
1467
- function baseMerge(target, source) {
1468
- let shallowArray = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
1469
- let skipTargetArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
1470
- if (source) {
1471
- if (target === source) return;
1472
- if (isValid$1(source) && "object" == typeof source) {
1473
- const iterable = Object(source),
1474
- props = [];
1475
- for (const key in iterable) props.push(key);
1476
- let {
1477
- length: length
1478
- } = props,
1479
- propIndex = -1;
1480
- for (; length--;) {
1481
- const key = props[++propIndex];
1482
- !isValid$1(iterable[key]) || "object" != typeof iterable[key] || skipTargetArray && isArray$1(target[key]) ? assignMergeValue(target, key, iterable[key]) : baseMergeDeep(target, source, key, shallowArray, skipTargetArray);
1483
- }
1484
- }
1485
- }
1486
- }
1487
- function baseMergeDeep(target, source, key) {
1488
- let shallowArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
1489
- let skipTargetArray = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
1490
- const objValue = target[key],
1491
- srcValue = source[key];
1492
- let newValue = source[key],
1493
- isCommon = !0;
1494
- if (isArray$1(srcValue)) {
1495
- if (shallowArray) newValue = [];else if (isArray$1(objValue)) newValue = objValue;else if (isArrayLike$1(objValue)) {
1496
- newValue = new Array(objValue.length);
1497
- let index = -1;
1498
- const length = objValue.length;
1499
- for (; ++index < length;) newValue[index] = objValue[index];
1500
- }
1501
- } else isPlainObject$1(srcValue) ? (newValue = null != objValue ? objValue : {}, "function" != typeof objValue && "object" == typeof objValue || (newValue = {})) : isCommon = !1;
1502
- isCommon && baseMerge(newValue, srcValue, shallowArray, skipTargetArray), assignMergeValue(target, key, newValue);
1503
- }
1504
- function assignMergeValue(target, key, value) {
1505
- (void 0 !== value && !eq(target[key], value) || void 0 === value && !(key in target)) && (target[key] = value);
1195
+ const REG_HEX = /^#([0-9a-f]{3,8})$/,
1196
+ DEFAULT_COLORS_OPACITY = {
1197
+ transparent: 4294967040
1198
+ };
1199
+ const DEFAULT_COLORS = {
1200
+ aliceblue: 15792383,
1201
+ antiquewhite: 16444375,
1202
+ aqua: 65535,
1203
+ aquamarine: 8388564,
1204
+ azure: 15794175,
1205
+ beige: 16119260,
1206
+ bisque: 16770244,
1207
+ black: 0,
1208
+ blanchedalmond: 16772045,
1209
+ blue: 255,
1210
+ blueviolet: 9055202,
1211
+ brown: 10824234,
1212
+ burlywood: 14596231,
1213
+ cadetblue: 6266528,
1214
+ chartreuse: 8388352,
1215
+ chocolate: 13789470,
1216
+ coral: 16744272,
1217
+ cornflowerblue: 6591981,
1218
+ cornsilk: 16775388,
1219
+ crimson: 14423100,
1220
+ cyan: 65535,
1221
+ darkblue: 139,
1222
+ darkcyan: 35723,
1223
+ darkgoldenrod: 12092939,
1224
+ darkgray: 11119017,
1225
+ darkgreen: 25600,
1226
+ darkgrey: 11119017,
1227
+ darkkhaki: 12433259,
1228
+ darkmagenta: 9109643,
1229
+ darkolivegreen: 5597999,
1230
+ darkorange: 16747520,
1231
+ darkorchid: 10040012,
1232
+ darkred: 9109504,
1233
+ darksalmon: 15308410,
1234
+ darkseagreen: 9419919,
1235
+ darkslateblue: 4734347,
1236
+ darkslategray: 3100495,
1237
+ darkslategrey: 3100495,
1238
+ darkturquoise: 52945,
1239
+ darkviolet: 9699539,
1240
+ deeppink: 16716947,
1241
+ deepskyblue: 49151,
1242
+ dimgray: 6908265,
1243
+ dimgrey: 6908265,
1244
+ dodgerblue: 2003199,
1245
+ firebrick: 11674146,
1246
+ floralwhite: 16775920,
1247
+ forestgreen: 2263842,
1248
+ fuchsia: 16711935,
1249
+ gainsboro: 14474460,
1250
+ ghostwhite: 16316671,
1251
+ gold: 16766720,
1252
+ goldenrod: 14329120,
1253
+ gray: 8421504,
1254
+ green: 32768,
1255
+ greenyellow: 11403055,
1256
+ grey: 8421504,
1257
+ honeydew: 15794160,
1258
+ hotpink: 16738740,
1259
+ indianred: 13458524,
1260
+ indigo: 4915330,
1261
+ ivory: 16777200,
1262
+ khaki: 15787660,
1263
+ lavender: 15132410,
1264
+ lavenderblush: 16773365,
1265
+ lawngreen: 8190976,
1266
+ lemonchiffon: 16775885,
1267
+ lightblue: 11393254,
1268
+ lightcoral: 15761536,
1269
+ lightcyan: 14745599,
1270
+ lightgoldenrodyellow: 16448210,
1271
+ lightgray: 13882323,
1272
+ lightgreen: 9498256,
1273
+ lightgrey: 13882323,
1274
+ lightpink: 16758465,
1275
+ lightsalmon: 16752762,
1276
+ lightseagreen: 2142890,
1277
+ lightskyblue: 8900346,
1278
+ lightslategray: 7833753,
1279
+ lightslategrey: 7833753,
1280
+ lightsteelblue: 11584734,
1281
+ lightyellow: 16777184,
1282
+ lime: 65280,
1283
+ limegreen: 3329330,
1284
+ linen: 16445670,
1285
+ magenta: 16711935,
1286
+ maroon: 8388608,
1287
+ mediumaquamarine: 6737322,
1288
+ mediumblue: 205,
1289
+ mediumorchid: 12211667,
1290
+ mediumpurple: 9662683,
1291
+ mediumseagreen: 3978097,
1292
+ mediumslateblue: 8087790,
1293
+ mediumspringgreen: 64154,
1294
+ mediumturquoise: 4772300,
1295
+ mediumvioletred: 13047173,
1296
+ midnightblue: 1644912,
1297
+ mintcream: 16121850,
1298
+ mistyrose: 16770273,
1299
+ moccasin: 16770229,
1300
+ navajowhite: 16768685,
1301
+ navy: 128,
1302
+ oldlace: 16643558,
1303
+ olive: 8421376,
1304
+ olivedrab: 7048739,
1305
+ orange: 16753920,
1306
+ orangered: 16729344,
1307
+ orchid: 14315734,
1308
+ palegoldenrod: 15657130,
1309
+ palegreen: 10025880,
1310
+ paleturquoise: 11529966,
1311
+ palevioletred: 14381203,
1312
+ papayawhip: 16773077,
1313
+ peachpuff: 16767673,
1314
+ peru: 13468991,
1315
+ pink: 16761035,
1316
+ plum: 14524637,
1317
+ powderblue: 11591910,
1318
+ purple: 8388736,
1319
+ rebeccapurple: 6697881,
1320
+ red: 16711680,
1321
+ rosybrown: 12357519,
1322
+ royalblue: 4286945,
1323
+ saddlebrown: 9127187,
1324
+ salmon: 16416882,
1325
+ sandybrown: 16032864,
1326
+ seagreen: 3050327,
1327
+ seashell: 16774638,
1328
+ sienna: 10506797,
1329
+ silver: 12632256,
1330
+ skyblue: 8900331,
1331
+ slateblue: 6970061,
1332
+ slategray: 7372944,
1333
+ slategrey: 7372944,
1334
+ snow: 16775930,
1335
+ springgreen: 65407,
1336
+ steelblue: 4620980,
1337
+ tan: 13808780,
1338
+ teal: 32896,
1339
+ thistle: 14204888,
1340
+ tomato: 16737095,
1341
+ turquoise: 4251856,
1342
+ violet: 15631086,
1343
+ wheat: 16113331,
1344
+ white: 16777215,
1345
+ whitesmoke: 16119285,
1346
+ yellow: 16776960,
1347
+ yellowgreen: 10145074
1348
+ };
1349
+ function hex(value) {
1350
+ return ((value = Math.max(0, Math.min(255, Math.round(value) || 0))) < 16 ? "0" : "") + value.toString(16);
1506
1351
  }
1507
- function eq(value, other) {
1508
- return value === other || Number.isNaN(value) && Number.isNaN(other);
1352
+ function rgb(value) {
1353
+ return isNumber$1(value) ? new RGB(value >> 16, value >> 8 & 255, 255 & value, 1) : isArray$1(value) ? new RGB(value[0], value[1], value[2]) : new RGB(255, 255, 255);
1509
1354
  }
1510
- function merge(target) {
1511
- let sourceIndex = -1;
1512
- const length = arguments.length <= 1 ? 0 : arguments.length - 1;
1513
- for (; ++sourceIndex < length;) {
1514
- baseMerge(target, sourceIndex + 1 < 1 || arguments.length <= sourceIndex + 1 ? undefined : arguments[sourceIndex + 1], !0);
1515
- }
1516
- return target;
1355
+ function rgba(value) {
1356
+ return isNumber$1(value) ? new RGB(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : isArray$1(value) ? new RGB(value[0], value[1], value[2], value[3]) : new RGB(255, 255, 255, 1);
1517
1357
  }
1518
-
1519
- function arrayEqual(a, b) {
1520
- if (!isArray$1(a) || !isArray$1(b)) return !1;
1521
- if (a.length !== b.length) return !1;
1522
- for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return !1;
1523
- return !0;
1358
+ function SRGBToLinear(c) {
1359
+ return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
1524
1360
  }
1525
-
1526
- const hasConsole = "undefined" != typeof console;
1527
- function log(method, level, input) {
1528
- const args = [level].concat([].slice.call(input));
1529
- hasConsole && console[method].apply(console, args);
1361
+ function LinearToSRGB(c) {
1362
+ return c < .0031308 ? 12.92 * c : 1.055 * Math.pow(c, .41666) - .055;
1530
1363
  }
1531
- var LoggerLevel;
1532
- !function (LoggerLevel) {
1533
- LoggerLevel[LoggerLevel.None = 0] = "None", LoggerLevel[LoggerLevel.Error = 1] = "Error", LoggerLevel[LoggerLevel.Warn = 2] = "Warn", LoggerLevel[LoggerLevel.Info = 3] = "Info", LoggerLevel[LoggerLevel.Debug = 4] = "Debug";
1534
- }(LoggerLevel || (LoggerLevel = {}));
1535
- class Logger {
1536
- static getInstance(level, method) {
1537
- return Logger._instance && isNumber$1(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
1538
- }
1539
- static setInstance(logger) {
1540
- return Logger._instance = logger;
1541
- }
1542
- static setInstanceLevel(level) {
1543
- Logger._instance ? Logger._instance.level(level) : Logger._instance = new Logger(level);
1544
- }
1545
- static clearInstance() {
1546
- Logger._instance = null;
1364
+ const setHex = (formatValue, forceHex) => {
1365
+ const isHex = REG_HEX.exec(formatValue);
1366
+ if (forceHex || isHex) {
1367
+ const hex = parseInt(isHex[1], 16),
1368
+ hexLength = isHex[1].length;
1369
+ return 3 === hexLength ? new RGB((hex >> 8 & 15) + ((hex >> 8 & 15) << 4), (hex >> 4 & 15) + ((hex >> 4 & 15) << 4), (15 & hex) + ((15 & hex) << 4), 1) : 6 === hexLength ? rgb(hex) : 8 === hexLength ? new RGB(hex >> 24 & 255, hex >> 16 & 255, hex >> 8 & 255, (255 & hex) / 255) : null;
1547
1370
  }
1548
- constructor() {
1549
- let level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : LoggerLevel.None;
1550
- let method = arguments.length > 1 ? arguments[1] : undefined;
1551
- this._onErrorHandler = [], this._level = level, this._method = method;
1371
+ };
1372
+ class Color {
1373
+ static Brighter(source) {
1374
+ let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1375
+ return 1 === b ? source : new Color(source).brighter(b).toRGBA();
1552
1376
  }
1553
- addErrorHandler(handler) {
1554
- this._onErrorHandler.find(h => h === handler) || this._onErrorHandler.push(handler);
1377
+ static SetOpacity(source) {
1378
+ let o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1379
+ return 1 === o ? source : new Color(source).setOpacity(o).toRGBA();
1555
1380
  }
1556
- removeErrorHandler(handler) {
1557
- const index = this._onErrorHandler.findIndex(h => h === handler);
1558
- index < 0 || this._onErrorHandler.splice(index, 1);
1381
+ static getColorBrightness(source) {
1382
+ let model = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "hsl";
1383
+ const color = source instanceof Color ? source : new Color(source);
1384
+ switch (model) {
1385
+ case "hsv":
1386
+ default:
1387
+ return color.getHSVBrightness();
1388
+ case "hsl":
1389
+ return color.getHSLBrightness();
1390
+ case "lum":
1391
+ return color.getLuminance();
1392
+ case "lum2":
1393
+ return color.getLuminance2();
1394
+ case "lum3":
1395
+ return color.getLuminance3();
1396
+ }
1559
1397
  }
1560
- callErrorHandler() {
1561
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1562
- args[_key] = arguments[_key];
1398
+ static parseColorString(value) {
1399
+ if (isValid$1(DEFAULT_COLORS_OPACITY[value])) return rgba(DEFAULT_COLORS_OPACITY[value]);
1400
+ if (isValid$1(DEFAULT_COLORS[value])) return rgb(DEFAULT_COLORS[value]);
1401
+ const formatValue = `${value}`.trim().toLowerCase(),
1402
+ hexRes = setHex(formatValue);
1403
+ if (void 0 !== hexRes) return hexRes;
1404
+ if (/^(rgb|RGB|rgba|RGBA)/.test(formatValue)) {
1405
+ const aColor = formatValue.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g, "").split(",");
1406
+ return new RGB(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10), parseFloat(aColor[3]));
1407
+ }
1408
+ if (/^(hsl|HSL|hsla|HSLA)/.test(formatValue)) {
1409
+ const aColor = formatValue.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g, "").split(","),
1410
+ rgb = hslToRgb(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10));
1411
+ return new RGB(rgb.r, rgb.g, rgb.b, parseFloat(aColor[3]));
1563
1412
  }
1564
- this._onErrorHandler.forEach(h => h(...args));
1565
1413
  }
1566
- canLogInfo() {
1567
- return this._level >= LoggerLevel.Info;
1414
+ constructor(value) {
1415
+ const color = Color.parseColorString(value);
1416
+ color ? this.color = color : (this.color = new RGB(255, 255, 255));
1568
1417
  }
1569
- canLogDebug() {
1570
- return this._level >= LoggerLevel.Debug;
1418
+ toRGBA() {
1419
+ return this.color.formatRgb();
1571
1420
  }
1572
- canLogError() {
1573
- return this._level >= LoggerLevel.Error;
1421
+ toString() {
1422
+ return this.color.formatRgb();
1574
1423
  }
1575
- canLogWarn() {
1576
- return this._level >= LoggerLevel.Warn;
1424
+ toHex() {
1425
+ return this.color.formatHex();
1577
1426
  }
1578
- level(levelValue) {
1579
- return arguments.length ? (this._level = +levelValue, this) : this._level;
1427
+ toHsl() {
1428
+ return this.color.formatHsl();
1580
1429
  }
1581
- error() {
1582
- var _a;
1583
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1584
- args[_key2] = arguments[_key2];
1585
- }
1586
- return this._level >= LoggerLevel.Error && (this._onErrorHandler.length ? this.callErrorHandler(...args) : log(null !== (_a = this._method) && void 0 !== _a ? _a : "error", "ERROR", args)), this;
1430
+ brighter(k) {
1431
+ const {
1432
+ r: r,
1433
+ g: g,
1434
+ b: b
1435
+ } = this.color;
1436
+ return this.color.r = Math.max(0, Math.min(255, Math.floor(r * k))), this.color.g = Math.max(0, Math.min(255, Math.floor(g * k))), this.color.b = Math.max(0, Math.min(255, Math.floor(b * k))), this;
1587
1437
  }
1588
- warn() {
1589
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1590
- args[_key3] = arguments[_key3];
1591
- }
1592
- return this._level >= LoggerLevel.Warn && log(this._method || "warn", "WARN", args), this;
1438
+ add(color) {
1439
+ const {
1440
+ r: r,
1441
+ g: g,
1442
+ b: b
1443
+ } = this.color;
1444
+ return this.color.r += Math.min(255, r + color.color.r), this.color.g += Math.min(255, g + color.color.g), this.color.b += Math.min(255, b + color.color.b), this;
1593
1445
  }
1594
- info() {
1595
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
1596
- args[_key4] = arguments[_key4];
1597
- }
1598
- return this._level >= LoggerLevel.Info && log(this._method || "log", "INFO", args), this;
1446
+ sub(color) {
1447
+ return this.color.r = Math.max(0, this.color.r - color.color.r), this.color.g = Math.max(0, this.color.g - color.color.g), this.color.b = Math.max(0, this.color.b - color.color.b), this;
1599
1448
  }
1600
- debug() {
1601
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
1602
- args[_key5] = arguments[_key5];
1603
- }
1604
- return this._level >= LoggerLevel.Debug && log(this._method || "log", "DEBUG", args), this;
1449
+ multiply(color) {
1450
+ const {
1451
+ r: r,
1452
+ g: g,
1453
+ b: b
1454
+ } = this.color;
1455
+ return this.color.r = Math.max(0, Math.min(255, Math.floor(r * color.color.r))), this.color.g = Math.max(0, Math.min(255, Math.floor(g * color.color.g))), this.color.b = Math.max(0, Math.min(255, Math.floor(b * color.color.b))), this;
1605
1456
  }
1606
- }
1607
- Logger._instance = null;
1608
-
1609
- const clamp = function (input, min, max) {
1610
- return input < min ? min : input > max ? max : input;
1611
- };
1612
- var clamp$1 = clamp;
1613
-
1614
- const epsilon = 1e-12;
1615
- const pi = Math.PI;
1616
- const halfPi$1 = pi / 2;
1617
- const tau = 2 * pi;
1618
- const pi2 = 2 * Math.PI;
1619
- const abs = Math.abs;
1620
- const atan2 = Math.atan2;
1621
- const cos = Math.cos;
1622
- const max = Math.max;
1623
- const min = Math.min;
1624
- const sin = Math.sin;
1625
- const sqrt = Math.sqrt;
1626
- const pow = Math.pow;
1627
- function asin(x) {
1628
- return x >= 1 ? halfPi$1 : x <= -1 ? -halfPi$1 : Math.asin(x);
1629
- }
1630
-
1631
- class Point {
1632
- constructor() {
1633
- let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1634
- let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1635
- let x1 = arguments.length > 2 ? arguments[2] : undefined;
1636
- let y1 = arguments.length > 3 ? arguments[3] : undefined;
1637
- this.x = 0, this.y = 0, this.x = x, this.y = y, this.x1 = x1, this.y1 = y1;
1457
+ getHSVBrightness() {
1458
+ return Math.max(this.color.r, this.color.g, this.color.b) / 255;
1638
1459
  }
1639
- clone() {
1640
- return new Point(this.x, this.y);
1460
+ getHSLBrightness() {
1461
+ return .5 * (Math.max(this.color.r, this.color.g, this.color.b) / 255 + Math.min(this.color.r, this.color.g, this.color.b) / 255);
1641
1462
  }
1642
- copyFrom(p) {
1643
- return this.x = p.x, this.y = p.y, this.x1 = p.x1, this.y1 = p.y1, this.defined = p.defined, this.context = p.context, this;
1463
+ setHsl(h, s, l) {
1464
+ const opacity = this.color.opacity,
1465
+ hsl = rgbToHsl(this.color.r, this.color.g, this.color.b),
1466
+ rgb = hslToRgb(isNil$1(h) ? hsl.h : clamp$1(h, 0, 360), isNil$1(s) ? hsl.s : s >= 0 && s <= 1 ? 100 * s : s, isNil$1(l) ? hsl.l : l <= 1 && l >= 0 ? 100 * l : l);
1467
+ return this.color = new RGB(rgb.r, rgb.g, rgb.b, opacity), this;
1644
1468
  }
1645
- set(x, y) {
1646
- return this.x = x, this.y = y, this;
1469
+ setRGB(r, g, b) {
1470
+ return !isNil$1(r) && (this.color.r = r), !isNil$1(g) && (this.color.g = g), !isNil$1(b) && (this.color.b = b), this;
1647
1471
  }
1648
- add(point) {
1649
- return isNumber$1(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
1472
+ setHex(value) {
1473
+ const formatValue = `${value}`.trim().toLowerCase(),
1474
+ res = setHex(formatValue, !0);
1475
+ return null != res ? res : this;
1650
1476
  }
1651
- sub(point) {
1652
- return isNumber$1(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
1477
+ setColorName(name) {
1478
+ const hex = DEFAULT_COLORS[name.toLowerCase()];
1479
+ return void 0 !== hex ? this.setHex(hex) : (void 0), this;
1653
1480
  }
1654
- multi(point) {
1655
- throw new Error("暂不支持");
1481
+ setScalar(scalar) {
1482
+ return this.color.r = scalar, this.color.g = scalar, this.color.b = scalar, this;
1656
1483
  }
1657
- div(point) {
1658
- throw new Error("暂不支持");
1484
+ setOpacity() {
1485
+ let o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
1486
+ return this.color.opacity = o, this;
1659
1487
  }
1660
- }
1661
- class PointService {
1662
- static distancePP(p1, p2) {
1663
- return sqrt(pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2));
1488
+ getLuminance() {
1489
+ return (.2126 * this.color.r + .7152 * this.color.g + .0722 * this.color.b) / 255;
1664
1490
  }
1665
- static distanceNN(x, y, x1, y1) {
1666
- return sqrt(pow(x - x1, 2) + pow(y - y1, 2));
1491
+ getLuminance2() {
1492
+ return (.2627 * this.color.r + .678 * this.color.g + .0593 * this.color.b) / 255;
1667
1493
  }
1668
- static distancePN(point, x, y) {
1669
- return sqrt(pow(x - point.x, 2) + pow(y - point.y, 2));
1494
+ getLuminance3() {
1495
+ return (.299 * this.color.r + .587 * this.color.g + .114 * this.color.b) / 255;
1670
1496
  }
1671
- static pointAtPP(p1, p2, t) {
1672
- return new Point((p2.x - p1.x) * t + p1.x, (p2.y - p1.y) * t + p1.y);
1497
+ clone() {
1498
+ return new Color(this.color.toString());
1499
+ }
1500
+ copyGammaToLinear(color) {
1501
+ let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
1502
+ return this.color.r = Math.pow(color.color.r, gammaFactor), this.color.g = Math.pow(color.color.g, gammaFactor), this.color.b = Math.pow(color.color.b, gammaFactor), this;
1503
+ }
1504
+ copyLinearToGamma(color) {
1505
+ let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
1506
+ const safeInverse = gammaFactor > 0 ? 1 / gammaFactor : 1;
1507
+ return this.color.r = Math.pow(color.color.r, safeInverse), this.color.g = Math.pow(color.color.g, safeInverse), this.color.b = Math.pow(color.color.b, safeInverse), this;
1508
+ }
1509
+ convertGammaToLinear(gammaFactor) {
1510
+ return this.copyGammaToLinear(this, gammaFactor), this;
1511
+ }
1512
+ convertLinearToGamma(gammaFactor) {
1513
+ return this.copyLinearToGamma(this, gammaFactor), this;
1514
+ }
1515
+ copySRGBToLinear(color) {
1516
+ return this.color.r = SRGBToLinear(color.color.r), this.color.g = SRGBToLinear(color.color.g), this.color.b = SRGBToLinear(color.color.b), this;
1517
+ }
1518
+ copyLinearToSRGB(color) {
1519
+ return this.color.r = LinearToSRGB(color.color.r), this.color.g = LinearToSRGB(color.color.g), this.color.b = LinearToSRGB(color.color.b), this;
1520
+ }
1521
+ convertSRGBToLinear() {
1522
+ return this.copySRGBToLinear(this), this;
1523
+ }
1524
+ convertLinearToSRGB() {
1525
+ return this.copyLinearToSRGB(this), this;
1673
1526
  }
1674
1527
  }
1675
-
1676
- function degreeToRadian(degree) {
1677
- return degree * (Math.PI / 180);
1678
- }
1679
- function radianToDegree(radian) {
1680
- return 180 * radian / Math.PI;
1681
- }
1682
- const clampRadian = function () {
1683
- let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1684
- if (angle < 0) for (; angle < -tau;) angle += tau;else if (angle > 0) for (; angle > tau;) angle -= tau;
1685
- return angle;
1686
- };
1687
- const clampAngleByRadian = clampRadian;
1688
-
1689
- var InnerBBox;
1690
- !function (InnerBBox) {
1691
- InnerBBox[InnerBBox.NONE = 0] = "NONE", InnerBBox[InnerBBox.BBOX1 = 1] = "BBOX1", InnerBBox[InnerBBox.BBOX2 = 2] = "BBOX2";
1692
- }(InnerBBox || (InnerBBox = {}));
1693
- function getProjectionRadius(checkAxis, axis) {
1694
- return Math.abs(axis[0] * checkAxis[0] + axis[1] * checkAxis[1]);
1695
- }
1696
- function rotatePoint(_ref, rad) {
1697
- let {
1698
- x: x,
1699
- y: y
1700
- } = _ref;
1701
- let origin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
1702
- x: 0,
1703
- y: 0
1704
- };
1705
- return {
1706
- x: (x - origin.x) * Math.cos(rad) - (y - origin.y) * Math.sin(rad) + origin.x,
1707
- y: (x - origin.x) * Math.sin(rad) + (y - origin.y) * Math.cos(rad) + origin.y
1708
- };
1709
- }
1710
- function getCenterPoint(box) {
1711
- return {
1712
- x: (box.x1 + box.x2) / 2,
1713
- y: (box.y1 + box.y2) / 2
1714
- };
1715
- }
1716
- function toRect(box, isDeg) {
1717
- const deg = isDeg ? degreeToRadian(box.angle) : box.angle,
1718
- cp = getCenterPoint(box);
1719
- return [rotatePoint({
1720
- x: box.x1,
1721
- y: box.y1
1722
- }, deg, cp), rotatePoint({
1723
- x: box.x2,
1724
- y: box.y1
1725
- }, deg, cp), rotatePoint({
1726
- x: box.x2,
1727
- y: box.y2
1728
- }, deg, cp), rotatePoint({
1729
- x: box.x1,
1730
- y: box.y2
1731
- }, deg, cp)];
1732
- }
1733
- function isRotateAABBIntersect(box1, box2) {
1734
- let isDeg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
1735
- const rect1 = toRect(box1, isDeg),
1736
- rect2 = toRect(box2, isDeg),
1737
- vector = (start, end) => [end.x - start.x, end.y - start.y],
1738
- vp1p2 = vector(getCenterPoint(box1), getCenterPoint(box2)),
1739
- AB = vector(rect1[0], rect1[1]),
1740
- BC = vector(rect1[1], rect1[2]),
1741
- A1B1 = vector(rect2[0], rect2[1]),
1742
- B1C1 = vector(rect2[1], rect2[2]),
1743
- deg11 = isDeg ? degreeToRadian(box1.angle) : box1.angle;
1744
- let deg12 = isDeg ? degreeToRadian(90 - box1.angle) : box1.angle + halfPi$1;
1745
- const deg21 = isDeg ? degreeToRadian(box2.angle) : box2.angle;
1746
- let deg22 = isDeg ? degreeToRadian(90 - box2.angle) : box2.angle + halfPi$1;
1747
- deg12 > pi2 && (deg12 -= pi2), deg22 > pi2 && (deg22 -= pi2);
1748
- const isCover = (checkAxisRadius, deg, targetAxis1, targetAxis2) => {
1749
- const checkAxis = [Math.cos(deg), Math.sin(deg)];
1750
- return checkAxisRadius + (getProjectionRadius(checkAxis, targetAxis1) + getProjectionRadius(checkAxis, targetAxis2)) / 2 > getProjectionRadius(checkAxis, vp1p2);
1751
- };
1752
- return isCover((box1.x2 - box1.x1) / 2, deg11, A1B1, B1C1) && isCover((box1.y2 - box1.y1) / 2, deg12, A1B1, B1C1) && isCover((box2.x2 - box2.x1) / 2, deg21, AB, BC) && isCover((box2.y2 - box2.y1) / 2, deg22, AB, BC);
1753
- }
1754
-
1755
- function getContextFont(text) {
1756
- let defaultAttr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1757
- let fontSizeScale = arguments.length > 2 ? arguments[2] : undefined;
1758
- fontSizeScale || (fontSizeScale = 1);
1759
- const {
1760
- fontStyle = defaultAttr.fontStyle,
1761
- fontVariant = defaultAttr.fontVariant,
1762
- fontWeight = defaultAttr.fontWeight,
1763
- fontSize = defaultAttr.fontSize,
1764
- fontFamily = defaultAttr.fontFamily
1765
- } = text;
1766
- return (fontStyle ? fontStyle + " " : "") + (fontVariant ? fontVariant + " " : "") + (fontWeight ? fontWeight + " " : "") + fontSize * fontSizeScale + "px " + (fontFamily || "sans-serif");
1767
- }
1768
-
1769
- const calculateAnchorOfBounds = (bounds, anchorType) => {
1770
- const {
1771
- x1: x1,
1772
- x2: x2,
1773
- y1: y1,
1774
- y2: y2
1775
- } = bounds,
1776
- rectWidth = Math.abs(x2 - x1),
1777
- rectHeight = Math.abs(y2 - y1);
1778
- let anchorX = (x1 + x2) / 2,
1779
- anchorY = (y1 + y2) / 2,
1780
- sx = 0,
1781
- sy = 0;
1782
- switch (anchorType) {
1783
- case "top":
1784
- case "inside-top":
1785
- sy = -.5;
1786
- break;
1787
- case "bottom":
1788
- case "inside-bottom":
1789
- sy = .5;
1790
- break;
1791
- case "left":
1792
- case "inside-left":
1793
- sx = -.5;
1794
- break;
1795
- case "right":
1796
- case "inside-right":
1797
- sx = .5;
1798
- break;
1799
- case "top-right":
1800
- sx = .5, sy = -.5;
1801
- break;
1802
- case "top-left":
1803
- sx = -.5, sy = -.5;
1804
- break;
1805
- case "bottom-right":
1806
- sx = .5, sy = .5;
1807
- break;
1808
- case "bottom-left":
1809
- sx = -.5, sy = .5;
1810
- }
1811
- return anchorX += sx * rectWidth, anchorY += sy * rectHeight, {
1812
- x: anchorX,
1813
- y: anchorY
1814
- };
1815
- };
1816
-
1817
- function transformBoundsWithMatrix(out, bounds, matrix) {
1818
- const {
1819
- x1: x1,
1820
- y1: y1,
1821
- x2: x2,
1822
- y2: y2
1823
- } = bounds;
1824
- return matrix.onlyTranslate() ? (out !== bounds && out.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2), out.translate(matrix.e, matrix.f), bounds) : (out.clear(), out.add(matrix.a * x1 + matrix.c * y1 + matrix.e, matrix.b * x1 + matrix.d * y1 + matrix.f), out.add(matrix.a * x2 + matrix.c * y1 + matrix.e, matrix.b * x2 + matrix.d * y1 + matrix.f), out.add(matrix.a * x2 + matrix.c * y2 + matrix.e, matrix.b * x2 + matrix.d * y2 + matrix.f), out.add(matrix.a * x1 + matrix.c * y2 + matrix.e, matrix.b * x1 + matrix.d * y2 + matrix.f), bounds);
1825
- }
1826
- class Bounds {
1827
- constructor(bounds) {
1828
- bounds ? this.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2) : this.clear();
1829
- }
1830
- clone() {
1831
- return new Bounds(this);
1832
- }
1833
- clear() {
1834
- return this.x1 = +Number.MAX_VALUE, this.y1 = +Number.MAX_VALUE, this.x2 = -Number.MAX_VALUE, this.y2 = -Number.MAX_VALUE, this;
1835
- }
1836
- empty() {
1837
- return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE;
1838
- }
1839
- equals(b) {
1840
- return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2;
1841
- }
1842
- setValue() {
1843
- let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1844
- let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1845
- let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1846
- let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1847
- return this.x1 = x1, this.y1 = y1, this.x2 = x2, this.y2 = y2, this;
1848
- }
1849
- set() {
1850
- let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1851
- let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1852
- let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1853
- let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1854
- return x2 < x1 ? (this.x2 = x1, this.x1 = x2) : (this.x1 = x1, this.x2 = x2), y2 < y1 ? (this.y2 = y1, this.y1 = y2) : (this.y1 = y1, this.y2 = y2), this;
1855
- }
1856
- add() {
1857
- let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1858
- let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1859
- return x < this.x1 && (this.x1 = x), y < this.y1 && (this.y1 = y), x > this.x2 && (this.x2 = x), y > this.y2 && (this.y2 = y), this;
1860
- }
1861
- expand() {
1862
- let d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1863
- return isArray$1(d) ? (this.y1 -= d[0], this.x2 += d[1], this.y2 += d[2], this.x1 -= d[3]) : (this.x1 -= d, this.y1 -= d, this.x2 += d, this.y2 += d), this;
1864
- }
1865
- round() {
1866
- return this.x1 = Math.floor(this.x1), this.y1 = Math.floor(this.y1), this.x2 = Math.ceil(this.x2), this.y2 = Math.ceil(this.y2), this;
1867
- }
1868
- translate() {
1869
- let dx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1870
- let dy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1871
- return this.x1 += dx, this.x2 += dx, this.y1 += dy, this.y2 += dy, this;
1872
- }
1873
- rotate() {
1874
- let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1875
- let x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1876
- let y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1877
- const p = this.rotatedPoints(angle, x, y);
1878
- return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]);
1879
- }
1880
- scale() {
1881
- let sx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1882
- let sy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1883
- let x = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1884
- let y = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1885
- const p = this.scalePoints(sx, sy, x, y);
1886
- return this.clear().add(p[0], p[1]).add(p[2], p[3]);
1528
+ class RGB {
1529
+ constructor(r, g, b, opacity) {
1530
+ this.r = isNaN(+r) ? 255 : Math.max(0, Math.min(255, +r)), this.g = isNaN(+g) ? 255 : Math.max(0, Math.min(255, +g)), this.b = isNaN(+b) ? 255 : Math.max(0, Math.min(255, +b)), isValid$1(opacity) ? this.opacity = isNaN(+opacity) ? 1 : Math.max(0, Math.min(1, +opacity)) : this.opacity = 1;
1887
1531
  }
1888
- union(b) {
1889
- return b.x1 < this.x1 && (this.x1 = b.x1), b.y1 < this.y1 && (this.y1 = b.y1), b.x2 > this.x2 && (this.x2 = b.x2), b.y2 > this.y2 && (this.y2 = b.y2), this;
1532
+ formatHex() {
1533
+ return `#${hex(this.r) + hex(this.g) + hex(this.b) + (1 === this.opacity ? "" : hex(255 * this.opacity))}`;
1890
1534
  }
1891
- intersect(b) {
1892
- return b.x1 > this.x1 && (this.x1 = b.x1), b.y1 > this.y1 && (this.y1 = b.y1), b.x2 < this.x2 && (this.x2 = b.x2), b.y2 < this.y2 && (this.y2 = b.y2), this;
1535
+ formatRgb() {
1536
+ const opacity = this.opacity;
1537
+ return `${1 === opacity ? "rgb(" : "rgba("}${this.r},${this.g},${this.b}${1 === opacity ? ")" : `,${opacity})`}`;
1893
1538
  }
1894
- encloses(b) {
1895
- return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2;
1539
+ formatHsl() {
1540
+ const opacity = this.opacity,
1541
+ {
1542
+ h: h,
1543
+ s: s,
1544
+ l: l
1545
+ } = rgbToHsl(this.r, this.g, this.b);
1546
+ return `${1 === opacity ? "hsl(" : "hsla("}${h},${s}%,${l}%${1 === opacity ? ")" : `,${opacity})`}`;
1896
1547
  }
1897
- alignsWith(b) {
1898
- return b && (this.x1 === b.x1 || this.x2 === b.x2 || this.y1 === b.y1 || this.y2 === b.y2);
1548
+ toString() {
1549
+ return this.formatHex();
1899
1550
  }
1900
- intersects(b) {
1901
- return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2);
1551
+ }
1552
+
1553
+ function normalizePadding(padding) {
1554
+ if (isValidNumber$1(padding)) return [padding, padding, padding, padding];
1555
+ if (isArray$1(padding)) {
1556
+ const length = padding.length;
1557
+ if (1 === length) {
1558
+ const paddingValue = padding[0];
1559
+ return [paddingValue, paddingValue, paddingValue, paddingValue];
1560
+ }
1561
+ if (2 === length) {
1562
+ const [vertical, horizontal] = padding;
1563
+ return [vertical, horizontal, vertical, horizontal];
1564
+ }
1565
+ if (3 === length) {
1566
+ const [top, horizontal, bottom] = padding;
1567
+ return [top, horizontal, bottom, horizontal];
1568
+ }
1569
+ if (4 === length) return padding;
1902
1570
  }
1903
- contains() {
1904
- let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1905
- let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1906
- return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2);
1907
- }
1908
- containsPoint(p) {
1909
- return !(p.x < this.x1 || p.x > this.x2 || p.y < this.y1 || p.y > this.y2);
1910
- }
1911
- width() {
1912
- return this.empty() ? 0 : this.x2 - this.x1;
1913
- }
1914
- height() {
1915
- return this.empty() ? 0 : this.y2 - this.y1;
1916
- }
1917
- scaleX() {
1918
- let s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1919
- return this.x1 *= s, this.x2 *= s, this;
1920
- }
1921
- scaleY() {
1922
- let s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1923
- return this.y1 *= s, this.y2 *= s, this;
1924
- }
1925
- transformWithMatrix(matrix) {
1926
- return transformBoundsWithMatrix(this, this, matrix), this;
1927
- }
1928
- copy(b) {
1929
- return this.x1 = b.x1, this.y1 = b.y1, this.x2 = b.x2, this.y2 = b.y2, this;
1930
- }
1931
- rotatedPoints(angle, x, y) {
1932
- const {
1933
- x1: x1,
1934
- y1: y1,
1935
- x2: x2,
1936
- y2: y2
1937
- } = this,
1938
- cos = Math.cos(angle),
1939
- sin = Math.sin(angle),
1940
- cx = x - x * cos + y * sin,
1941
- cy = y - x * sin - y * cos;
1942
- return [cos * x1 - sin * y1 + cx, sin * x1 + cos * y1 + cy, cos * x1 - sin * y2 + cx, sin * x1 + cos * y2 + cy, cos * x2 - sin * y1 + cx, sin * x2 + cos * y1 + cy, cos * x2 - sin * y2 + cx, sin * x2 + cos * y2 + cy];
1943
- }
1944
- scalePoints(sx, sy, x, y) {
1945
- const {
1946
- x1: x1,
1947
- y1: y1,
1948
- x2: x2,
1949
- y2: y2
1950
- } = this;
1951
- return [sx * x1 + (1 - sx) * x, sy * y1 + (1 - sy) * y, sx * x2 + (1 - sx) * x, sy * y2 + (1 - sy) * y];
1952
- }
1953
- }
1954
- class AABBBounds extends Bounds {}
1955
- class OBBBounds extends Bounds {
1956
- constructor(bounds) {
1957
- let angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1958
- var _a;
1959
- super(bounds), bounds && (this.angle = null !== (_a = bounds.angle) && void 0 !== _a ? _a : angle);
1960
- }
1961
- intersects(b) {
1962
- return isRotateAABBIntersect(this, b);
1963
- }
1964
- setValue() {
1965
- let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1966
- let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1967
- let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1968
- let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1969
- let angle = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
1970
- return super.setValue(x1, y1, x2, y2), this.angle = angle, this;
1971
- }
1972
- clone() {
1973
- return new OBBBounds(this);
1571
+ if (isObject$1(padding)) {
1572
+ const {
1573
+ top = 0,
1574
+ right = 0,
1575
+ bottom = 0,
1576
+ left = 0
1577
+ } = padding;
1578
+ return [top, right, bottom, left];
1974
1579
  }
1580
+ return [0, 0, 0, 0];
1975
1581
  }
1976
1582
 
1977
- class Matrix {
1978
- constructor() {
1979
- let a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
1980
- let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1981
- let c = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1982
- let d = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
1983
- let e = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
1984
- let f = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
1985
- this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f;
1986
- }
1987
- equalToMatrix(m2) {
1988
- return !(this.e !== m2.e || this.f !== m2.f || this.a !== m2.a || this.d !== m2.d || this.b !== m2.b || this.c !== m2.c);
1989
- }
1990
- equalTo(a, b, c, d, e, f) {
1991
- return !(this.e !== e || this.f !== f || this.a !== a || this.d !== d || this.b !== b || this.c !== c);
1992
- }
1993
- setValue(a, b, c, d, e, f) {
1994
- return this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f, this;
1995
- }
1996
- reset() {
1997
- return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this;
1998
- }
1999
- getInverse() {
2000
- const a = this.a,
2001
- b = this.b,
2002
- c = this.c,
2003
- d = this.d,
2004
- e = this.e,
2005
- f = this.f,
2006
- m = new Matrix(),
2007
- dt = a * d - b * c;
2008
- return m.a = d / dt, m.b = -b / dt, m.c = -c / dt, m.d = a / dt, m.e = (c * f - d * e) / dt, m.f = -(a * f - b * e) / dt, m;
2009
- }
2010
- rotate(rad) {
2011
- const c = Math.cos(rad),
2012
- s = Math.sin(rad),
2013
- m11 = this.a * c + this.c * s,
2014
- m12 = this.b * c + this.d * s,
2015
- m21 = this.a * -s + this.c * c,
2016
- m22 = this.b * -s + this.d * c;
2017
- return this.a = m11, this.b = m12, this.c = m21, this.d = m22, this;
2018
- }
2019
- rotateByCenter(rad, cx, cy) {
2020
- const cos = Math.cos(rad),
2021
- sin = Math.sin(rad),
2022
- rotateM13 = (1 - cos) * cx + sin * cy,
2023
- rotateM23 = (1 - cos) * cy - sin * cx,
2024
- m11 = cos * this.a - sin * this.b,
2025
- m21 = sin * this.a + cos * this.b,
2026
- m12 = cos * this.c - sin * this.d,
2027
- m22 = sin * this.c + cos * this.d,
2028
- m13 = cos * this.e - sin * this.f + rotateM13,
2029
- m23 = sin * this.e + cos * this.f + rotateM23;
2030
- return this.a = m11, this.b = m21, this.c = m12, this.d = m22, this.e = m13, this.f = m23, this;
2031
- }
2032
- scale(sx, sy) {
2033
- return this.a *= sx, this.b *= sx, this.c *= sy, this.d *= sy, this;
2034
- }
2035
- setScale(sx, sy) {
2036
- return this.b = this.b / this.a * sx, this.c = this.c / this.d * sy, this.a = sx, this.d = sy, this;
2037
- }
2038
- transform(a, b, c, d, e, f) {
2039
- return this.multiply(a, b, c, d, e, f), this;
2040
- }
2041
- translate(x, y) {
2042
- return this.e += this.a * x + this.c * y, this.f += this.b * x + this.d * y, this;
2043
- }
2044
- transpose() {
2045
- const {
2046
- a: a,
2047
- b: b,
2048
- c: c,
2049
- d: d,
2050
- e: e,
2051
- f: f
2052
- } = this;
2053
- return this.a = b, this.b = a, this.c = d, this.d = c, this.e = f, this.f = e, this;
2054
- }
2055
- multiply(a2, b2, c2, d2, e2, f2) {
2056
- const a1 = this.a,
2057
- b1 = this.b,
2058
- c1 = this.c,
2059
- d1 = this.d,
2060
- m11 = a1 * a2 + c1 * b2,
2061
- m12 = b1 * a2 + d1 * b2,
2062
- m21 = a1 * c2 + c1 * d2,
2063
- m22 = b1 * c2 + d1 * d2,
2064
- dx = a1 * e2 + c1 * f2 + this.e,
2065
- dy = b1 * e2 + d1 * f2 + this.f;
2066
- return this.a = m11, this.b = m12, this.c = m21, this.d = m22, this.e = dx, this.f = dy, this;
2067
- }
2068
- interpolate(m2, t) {
2069
- const m = new Matrix();
2070
- return m.a = this.a + (m2.a - this.a) * t, m.b = this.b + (m2.b - this.b) * t, m.c = this.c + (m2.c - this.c) * t, m.d = this.d + (m2.d - this.d) * t, m.e = this.e + (m2.e - this.e) * t, m.f = this.f + (m2.f - this.f) * t, m;
2071
- }
2072
- transformPoint(source, target) {
2073
- const {
2074
- a: a,
2075
- b: b,
2076
- c: c,
2077
- d: d,
2078
- e: e,
2079
- f: f
2080
- } = this,
2081
- dt = a * d - b * c,
2082
- nextA = d / dt,
2083
- nextB = -b / dt,
2084
- nextC = -c / dt,
2085
- nextD = a / dt,
2086
- nextE = (c * f - d * e) / dt,
2087
- nextF = -(a * f - b * e) / dt,
2088
- {
2089
- x: x,
2090
- y: y
2091
- } = source;
2092
- target.x = x * nextA + y * nextC + nextE, target.y = x * nextB + y * nextD + nextF;
2093
- }
2094
- onlyTranslate() {
2095
- let scale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
2096
- return this.a === scale && 0 === this.b && 0 === this.c && this.d === scale;
2097
- }
2098
- clone() {
2099
- return new Matrix(this.a, this.b, this.c, this.d, this.e, this.f);
2100
- }
2101
- toTransformAttrs() {
2102
- const a = this.a,
2103
- b = this.b,
2104
- c = this.c,
2105
- d = this.d,
2106
- delta = a * d - b * c,
2107
- result = {
2108
- x: this.e,
2109
- y: this.f,
2110
- rotateDeg: 0,
2111
- scaleX: 0,
2112
- scaleY: 0,
2113
- skewX: 0,
2114
- skewY: 0
2115
- };
2116
- if (0 !== a || 0 !== b) {
2117
- const r = Math.sqrt(a * a + b * b);
2118
- result.rotateDeg = b > 0 ? Math.acos(a / r) : -Math.acos(a / r), result.scaleX = r, result.scaleY = delta / r, result.skewX = (a * c + b * d) / delta, result.skewY = 0;
2119
- } else if (0 !== c || 0 !== d) {
2120
- const s = Math.sqrt(c * c + d * d);
2121
- result.rotateDeg = Math.PI / 2 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s)), result.scaleX = delta / s, result.scaleY = s, result.skewX = 0, result.skewY = (a * c + b * d) / delta;
1583
+ const styleStringToObject = function () {
1584
+ let styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
1585
+ const res = {};
1586
+ return styleStr.split(";").forEach(item => {
1587
+ if (item) {
1588
+ const arr = item.split(":");
1589
+ if (2 === arr.length) {
1590
+ const key = arr[0].trim(),
1591
+ value = arr[1].trim();
1592
+ key && value && (res[key] = value);
1593
+ }
2122
1594
  }
2123
- return result.rotateDeg = radianToDegree(result.rotateDeg), result;
2124
- }
2125
- }
2126
- function normalTransform(out, origin, x, y, scaleX, scaleY, angle, rotateCenter) {
2127
- const oa = origin.a,
2128
- ob = origin.b,
2129
- oc = origin.c,
2130
- od = origin.d,
2131
- oe = origin.e,
2132
- of = origin.f,
2133
- cosTheta = cos(angle),
2134
- sinTheta = sin(angle);
2135
- let rotateCenterX, rotateCenterY;
2136
- rotateCenter ? (rotateCenterX = rotateCenter[0], rotateCenterY = rotateCenter[1]) : (rotateCenterX = x, rotateCenterY = y);
2137
- const offsetX = rotateCenterX - x,
2138
- offsetY = rotateCenterY - y,
2139
- a1 = oa * cosTheta + oc * sinTheta,
2140
- b1 = ob * cosTheta + od * sinTheta,
2141
- c1 = oc * cosTheta - oa * sinTheta,
2142
- d1 = od * cosTheta - ob * sinTheta;
2143
- out.a = scaleX * a1, out.b = scaleX * b1, out.c = scaleY * c1, out.d = scaleY * d1, out.e = oe + oa * rotateCenterX + oc * rotateCenterY - a1 * offsetX - c1 * offsetY, out.f = of + ob * rotateCenterX + od * rotateCenterY - b1 * offsetX - d1 * offsetY;
2144
- }
1595
+ }), res;
1596
+ };
1597
+ const lowerCamelCaseToMiddle = str => str.replace(/([A-Z])/g, "-$1").toLowerCase();
2145
1598
 
2146
- function hslToRgb(h, s, l) {
2147
- s /= 100, l /= 100;
2148
- const c = (1 - Math.abs(2 * l - 1)) * s,
2149
- x = c * (1 - Math.abs(h / 60 % 2 - 1)),
2150
- m = l - c / 2;
2151
- let r = 0,
2152
- g = 0,
2153
- b = 0;
2154
- return 0 <= h && h < 60 ? (r = c, g = x, b = 0) : 60 <= h && h < 120 ? (r = x, g = c, b = 0) : 120 <= h && h < 180 ? (r = 0, g = c, b = x) : 180 <= h && h < 240 ? (r = 0, g = x, b = c) : 240 <= h && h < 300 ? (r = x, g = 0, b = c) : 300 <= h && h < 360 && (r = c, g = 0, b = x), r = Math.round(255 * (r + m)), g = Math.round(255 * (g + m)), b = Math.round(255 * (b + m)), {
2155
- r: r,
2156
- g: g,
2157
- b: b
1599
+ var reactIs = {exports: {}};
1600
+
1601
+ var reactIs_production_min = {};
1602
+
1603
+ /**
1604
+ * @license React
1605
+ * react-is.production.min.js
1606
+ *
1607
+ * Copyright (c) Facebook, Inc. and its affiliates.
1608
+ *
1609
+ * This source code is licensed under the MIT license found in the
1610
+ * LICENSE file in the root directory of this source tree.
1611
+ */
1612
+ var hasRequiredReactIs_production_min;
1613
+ function requireReactIs_production_min() {
1614
+ if (hasRequiredReactIs_production_min) return reactIs_production_min;
1615
+ hasRequiredReactIs_production_min = 1;
1616
+ var b = Symbol.for("react.element"),
1617
+ c = Symbol.for("react.portal"),
1618
+ d = Symbol.for("react.fragment"),
1619
+ e = Symbol.for("react.strict_mode"),
1620
+ f = Symbol.for("react.profiler"),
1621
+ g = Symbol.for("react.provider"),
1622
+ h = Symbol.for("react.context"),
1623
+ k = Symbol.for("react.server_context"),
1624
+ l = Symbol.for("react.forward_ref"),
1625
+ m = Symbol.for("react.suspense"),
1626
+ n = Symbol.for("react.suspense_list"),
1627
+ p = Symbol.for("react.memo"),
1628
+ q = Symbol.for("react.lazy"),
1629
+ t = Symbol.for("react.offscreen"),
1630
+ u;
1631
+ u = Symbol.for("react.module.reference");
1632
+ function v(a) {
1633
+ if ("object" === typeof a && null !== a) {
1634
+ var r = a.$$typeof;
1635
+ switch (r) {
1636
+ case b:
1637
+ switch (a = a.type, a) {
1638
+ case d:
1639
+ case f:
1640
+ case e:
1641
+ case m:
1642
+ case n:
1643
+ return a;
1644
+ default:
1645
+ switch (a = a && a.$$typeof, a) {
1646
+ case k:
1647
+ case h:
1648
+ case l:
1649
+ case q:
1650
+ case p:
1651
+ case g:
1652
+ return a;
1653
+ default:
1654
+ return r;
1655
+ }
1656
+ }
1657
+ case c:
1658
+ return r;
1659
+ }
1660
+ }
1661
+ }
1662
+ reactIs_production_min.ContextConsumer = h;
1663
+ reactIs_production_min.ContextProvider = g;
1664
+ reactIs_production_min.Element = b;
1665
+ reactIs_production_min.ForwardRef = l;
1666
+ reactIs_production_min.Fragment = d;
1667
+ reactIs_production_min.Lazy = q;
1668
+ reactIs_production_min.Memo = p;
1669
+ reactIs_production_min.Portal = c;
1670
+ reactIs_production_min.Profiler = f;
1671
+ reactIs_production_min.StrictMode = e;
1672
+ reactIs_production_min.Suspense = m;
1673
+ reactIs_production_min.SuspenseList = n;
1674
+ reactIs_production_min.isAsyncMode = function () {
1675
+ return !1;
1676
+ };
1677
+ reactIs_production_min.isConcurrentMode = function () {
1678
+ return !1;
1679
+ };
1680
+ reactIs_production_min.isContextConsumer = function (a) {
1681
+ return v(a) === h;
1682
+ };
1683
+ reactIs_production_min.isContextProvider = function (a) {
1684
+ return v(a) === g;
1685
+ };
1686
+ reactIs_production_min.isElement = function (a) {
1687
+ return "object" === typeof a && null !== a && a.$$typeof === b;
1688
+ };
1689
+ reactIs_production_min.isForwardRef = function (a) {
1690
+ return v(a) === l;
2158
1691
  };
1692
+ reactIs_production_min.isFragment = function (a) {
1693
+ return v(a) === d;
1694
+ };
1695
+ reactIs_production_min.isLazy = function (a) {
1696
+ return v(a) === q;
1697
+ };
1698
+ reactIs_production_min.isMemo = function (a) {
1699
+ return v(a) === p;
1700
+ };
1701
+ reactIs_production_min.isPortal = function (a) {
1702
+ return v(a) === c;
1703
+ };
1704
+ reactIs_production_min.isProfiler = function (a) {
1705
+ return v(a) === f;
1706
+ };
1707
+ reactIs_production_min.isStrictMode = function (a) {
1708
+ return v(a) === e;
1709
+ };
1710
+ reactIs_production_min.isSuspense = function (a) {
1711
+ return v(a) === m;
1712
+ };
1713
+ reactIs_production_min.isSuspenseList = function (a) {
1714
+ return v(a) === n;
1715
+ };
1716
+ reactIs_production_min.isValidElementType = function (a) {
1717
+ return "string" === typeof a || "function" === typeof a || a === d || a === f || a === e || a === m || a === n || a === t || "object" === typeof a && null !== a && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g || a.$$typeof === h || a.$$typeof === l || a.$$typeof === u || void 0 !== a.getModuleId) ? !0 : !1;
1718
+ };
1719
+ reactIs_production_min.typeOf = v;
1720
+ return reactIs_production_min;
2159
1721
  }
2160
1722
 
2161
- function rgbToHsl(r, g, b) {
2162
- r /= 255, g /= 255, b /= 255;
2163
- const cMin = Math.min(r, g, b),
2164
- cMax = Math.max(r, g, b),
2165
- delta = cMax - cMin;
2166
- let h = 0,
2167
- s = 0,
2168
- l = 0;
2169
- return h = 0 === delta ? 0 : cMax === r ? (g - b) / delta % 6 : cMax === g ? (b - r) / delta + 2 : (r - g) / delta + 4, h = Math.round(60 * h), h < 0 && (h += 360), l = (cMax + cMin) / 2, s = 0 === delta ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(100 * s).toFixed(1), l = +(100 * l).toFixed(1), {
2170
- h: h,
2171
- s: s,
2172
- l: l
2173
- };
1723
+ {
1724
+ reactIs.exports = requireReactIs_production_min();
2174
1725
  }
1726
+ var reactIsExports = reactIs.exports;
2175
1727
 
2176
- const REG_HEX = /^#([0-9a-f]{3,8})$/,
2177
- DEFAULT_COLORS_OPACITY = {
2178
- transparent: 4294967040
2179
- };
2180
- const DEFAULT_COLORS = {
2181
- aliceblue: 15792383,
2182
- antiquewhite: 16444375,
2183
- aqua: 65535,
2184
- aquamarine: 8388564,
2185
- azure: 15794175,
2186
- beige: 16119260,
2187
- bisque: 16770244,
2188
- black: 0,
2189
- blanchedalmond: 16772045,
2190
- blue: 255,
2191
- blueviolet: 9055202,
2192
- brown: 10824234,
2193
- burlywood: 14596231,
2194
- cadetblue: 6266528,
2195
- chartreuse: 8388352,
2196
- chocolate: 13789470,
2197
- coral: 16744272,
2198
- cornflowerblue: 6591981,
2199
- cornsilk: 16775388,
2200
- crimson: 14423100,
2201
- cyan: 65535,
2202
- darkblue: 139,
2203
- darkcyan: 35723,
2204
- darkgoldenrod: 12092939,
2205
- darkgray: 11119017,
2206
- darkgreen: 25600,
2207
- darkgrey: 11119017,
2208
- darkkhaki: 12433259,
2209
- darkmagenta: 9109643,
2210
- darkolivegreen: 5597999,
2211
- darkorange: 16747520,
2212
- darkorchid: 10040012,
2213
- darkred: 9109504,
2214
- darksalmon: 15308410,
2215
- darkseagreen: 9419919,
2216
- darkslateblue: 4734347,
2217
- darkslategray: 3100495,
2218
- darkslategrey: 3100495,
2219
- darkturquoise: 52945,
2220
- darkviolet: 9699539,
2221
- deeppink: 16716947,
2222
- deepskyblue: 49151,
2223
- dimgray: 6908265,
2224
- dimgrey: 6908265,
2225
- dodgerblue: 2003199,
2226
- firebrick: 11674146,
2227
- floralwhite: 16775920,
2228
- forestgreen: 2263842,
2229
- fuchsia: 16711935,
2230
- gainsboro: 14474460,
2231
- ghostwhite: 16316671,
2232
- gold: 16766720,
2233
- goldenrod: 14329120,
2234
- gray: 8421504,
2235
- green: 32768,
2236
- greenyellow: 11403055,
2237
- grey: 8421504,
2238
- honeydew: 15794160,
2239
- hotpink: 16738740,
2240
- indianred: 13458524,
2241
- indigo: 4915330,
2242
- ivory: 16777200,
2243
- khaki: 15787660,
2244
- lavender: 15132410,
2245
- lavenderblush: 16773365,
2246
- lawngreen: 8190976,
2247
- lemonchiffon: 16775885,
2248
- lightblue: 11393254,
2249
- lightcoral: 15761536,
2250
- lightcyan: 14745599,
2251
- lightgoldenrodyellow: 16448210,
2252
- lightgray: 13882323,
2253
- lightgreen: 9498256,
2254
- lightgrey: 13882323,
2255
- lightpink: 16758465,
2256
- lightsalmon: 16752762,
2257
- lightseagreen: 2142890,
2258
- lightskyblue: 8900346,
2259
- lightslategray: 7833753,
2260
- lightslategrey: 7833753,
2261
- lightsteelblue: 11584734,
2262
- lightyellow: 16777184,
2263
- lime: 65280,
2264
- limegreen: 3329330,
2265
- linen: 16445670,
2266
- magenta: 16711935,
2267
- maroon: 8388608,
2268
- mediumaquamarine: 6737322,
2269
- mediumblue: 205,
2270
- mediumorchid: 12211667,
2271
- mediumpurple: 9662683,
2272
- mediumseagreen: 3978097,
2273
- mediumslateblue: 8087790,
2274
- mediumspringgreen: 64154,
2275
- mediumturquoise: 4772300,
2276
- mediumvioletred: 13047173,
2277
- midnightblue: 1644912,
2278
- mintcream: 16121850,
2279
- mistyrose: 16770273,
2280
- moccasin: 16770229,
2281
- navajowhite: 16768685,
2282
- navy: 128,
2283
- oldlace: 16643558,
2284
- olive: 8421376,
2285
- olivedrab: 7048739,
2286
- orange: 16753920,
2287
- orangered: 16729344,
2288
- orchid: 14315734,
2289
- palegoldenrod: 15657130,
2290
- palegreen: 10025880,
2291
- paleturquoise: 11529966,
2292
- palevioletred: 14381203,
2293
- papayawhip: 16773077,
2294
- peachpuff: 16767673,
2295
- peru: 13468991,
2296
- pink: 16761035,
2297
- plum: 14524637,
2298
- powderblue: 11591910,
2299
- purple: 8388736,
2300
- rebeccapurple: 6697881,
2301
- red: 16711680,
2302
- rosybrown: 12357519,
2303
- royalblue: 4286945,
2304
- saddlebrown: 9127187,
2305
- salmon: 16416882,
2306
- sandybrown: 16032864,
2307
- seagreen: 3050327,
2308
- seashell: 16774638,
2309
- sienna: 10506797,
2310
- silver: 12632256,
2311
- skyblue: 8900331,
2312
- slateblue: 6970061,
2313
- slategray: 7372944,
2314
- slategrey: 7372944,
2315
- snow: 16775930,
2316
- springgreen: 65407,
2317
- steelblue: 4620980,
2318
- tan: 13808780,
2319
- teal: 32896,
2320
- thistle: 14204888,
2321
- tomato: 16737095,
2322
- turquoise: 4251856,
2323
- violet: 15631086,
2324
- wheat: 16113331,
2325
- white: 16777215,
2326
- whitesmoke: 16119285,
2327
- yellow: 16776960,
2328
- yellowgreen: 10145074
1728
+ const toArray = (children) => {
1729
+ let result = [];
1730
+ React.Children.forEach(children, child => {
1731
+ if (isNil$1(child)) {
1732
+ return;
1733
+ }
1734
+ if (reactIsExports.isFragment(child)) {
1735
+ result = result.concat(toArray(child.props.children));
1736
+ }
1737
+ else {
1738
+ result.push(child);
1739
+ }
1740
+ });
1741
+ return result;
2329
1742
  };
2330
- function hex(value) {
2331
- return ((value = Math.max(0, Math.min(255, Math.round(value) || 0))) < 16 ? "0" : "") + value.toString(16);
1743
+
1744
+ const REACT_PRIVATE_PROPS = ['children', 'hooks', 'ref'];
1745
+
1746
+ const EVENT_TYPE = {
1747
+ ...vtable.TABLE_EVENT_TYPE,
1748
+ ...vtable.PIVOT_TABLE_EVENT_TYPE,
1749
+ ...vtable.PIVOT_CHART_EVENT_TYPE
1750
+ };
1751
+ const TABLE_EVENTS = {
1752
+ onClickCell: EVENT_TYPE.CLICK_CELL,
1753
+ onDblClickCell: EVENT_TYPE.DBLCLICK_CELL,
1754
+ onMouseDownCell: EVENT_TYPE.MOUSEDOWN_CELL,
1755
+ onMouseUpCell: EVENT_TYPE.MOUSEUP_CELL,
1756
+ onSelectedCell: EVENT_TYPE.SELECTED_CELL,
1757
+ onSelectedClear: EVENT_TYPE.SELECTED_CLEAR,
1758
+ onKeyDown: EVENT_TYPE.KEYDOWN,
1759
+ onMouseEnterTable: EVENT_TYPE.MOUSEENTER_TABLE,
1760
+ onMouseLeaveTable: EVENT_TYPE.MOUSELEAVE_TABLE,
1761
+ onMouseDownTable: EVENT_TYPE.MOUSEDOWN_TABLE,
1762
+ onMouseMoveCell: EVENT_TYPE.MOUSEMOVE_CELL,
1763
+ onMouseMoveTable: EVENT_TYPE.MOUSEMOVE_TABLE,
1764
+ onMouseEnterCell: EVENT_TYPE.MOUSEENTER_CELL,
1765
+ onMouseLeaveCell: EVENT_TYPE.MOUSELEAVE_CELL,
1766
+ onContextMenuCell: EVENT_TYPE.CONTEXTMENU_CELL,
1767
+ onResizeColumn: EVENT_TYPE.RESIZE_COLUMN,
1768
+ onResizeColumnEnd: EVENT_TYPE.RESIZE_COLUMN_END,
1769
+ onResizeRow: EVENT_TYPE.RESIZE_ROW,
1770
+ onResizeRowEnd: EVENT_TYPE.RESIZE_ROW_END,
1771
+ onChangeHeaderPositionStart: EVENT_TYPE.CHANGE_HEADER_POSITION_START,
1772
+ onChangeHeaderPosition: EVENT_TYPE.CHANGE_HEADER_POSITION,
1773
+ onChangeHeaderPositionFail: EVENT_TYPE.CHANGE_HEADER_POSITION_FAIL,
1774
+ onSortClick: EVENT_TYPE.SORT_CLICK,
1775
+ onAfterSort: EVENT_TYPE.AFTER_SORT,
1776
+ onFreezeClick: EVENT_TYPE.FREEZE_CLICK,
1777
+ onScroll: EVENT_TYPE.SCROLL,
1778
+ onScrollHorizontalEnd: EVENT_TYPE.SCROLL_HORIZONTAL_END,
1779
+ onScrollVerticalEnd: EVENT_TYPE.SCROLL_VERTICAL_END,
1780
+ onDropdownMenuClick: EVENT_TYPE.DROPDOWN_MENU_CLICK,
1781
+ onMouseOverChartSymbol: EVENT_TYPE.MOUSEOVER_CHART_SYMBOL,
1782
+ onDragSelectEnd: EVENT_TYPE.DRAG_SELECT_END,
1783
+ onCopyData: EVENT_TYPE.COPY_DATA,
1784
+ onDropdownIconClick: EVENT_TYPE.DROPDOWN_ICON_CLICK,
1785
+ onDropdownMenuClear: EVENT_TYPE.DROPDOWN_MENU_CLEAR,
1786
+ onTreeHierarchyStateChange: EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE,
1787
+ onShowMenu: EVENT_TYPE.SHOW_MENU,
1788
+ onHideMenu: EVENT_TYPE.HIDE_MENU,
1789
+ onIconClick: EVENT_TYPE.ICON_CLICK,
1790
+ onLegendItemClick: EVENT_TYPE.LEGEND_ITEM_CLICK,
1791
+ onLegendItemHover: EVENT_TYPE.LEGEND_ITEM_HOVER,
1792
+ onLegendItemUnHover: EVENT_TYPE.LEGEND_ITEM_UNHOVER,
1793
+ onLegendChange: EVENT_TYPE.LEGEND_CHANGE,
1794
+ onMouseEnterAxis: EVENT_TYPE.MOUSEENTER_AXIS,
1795
+ onMouseLeaveAxis: EVENT_TYPE.MOUSELEAVE_AXIS,
1796
+ onCheckboxStateChange: EVENT_TYPE.CHECKBOX_STATE_CHANGE,
1797
+ onRadioStateChange: EVENT_TYPE.RADIO_STATE_CHANGE,
1798
+ onAfterRender: EVENT_TYPE.AFTER_RENDER,
1799
+ onInitialized: EVENT_TYPE.INITIALIZED,
1800
+ onChangeCellValue: EVENT_TYPE.CHANGE_CELL_VALUE,
1801
+ onDragFillHandleEnd: EVENT_TYPE.DRAG_FILL_HANDLE_END,
1802
+ onMousedownFillHandle: EVENT_TYPE.MOUSEDOWN_FILL_HANDLE,
1803
+ onDblclickFillHandle: EVENT_TYPE.DBLCLICK_FILL_HANDLE,
1804
+ onPivotSortClick: EVENT_TYPE.PIVOT_SORT_CLICK,
1805
+ onDrillMenuClick: EVENT_TYPE.DRILLMENU_CLICK,
1806
+ onVChartEventType: EVENT_TYPE.VCHART_EVENT_TYPE,
1807
+ onChangCellValue: EVENT_TYPE.CHANGE_CELL_VALUE
1808
+ };
1809
+ const TABLE_EVENTS_KEYS = Object.keys(TABLE_EVENTS);
1810
+ const findEventProps = (props, supportedEvents = TABLE_EVENTS) => {
1811
+ const result = {};
1812
+ Object.keys(props).forEach(key => {
1813
+ if (supportedEvents[key] && props[key]) {
1814
+ result[key] = props[key];
1815
+ }
1816
+ });
1817
+ return result;
1818
+ };
1819
+ const bindEventsToTable = (table, newProps, prevProps, supportedEvents = TABLE_EVENTS) => {
1820
+ if ((!newProps && !prevProps) || !table) {
1821
+ return false;
1822
+ }
1823
+ const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;
1824
+ const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;
1825
+ if (prevEventProps) {
1826
+ Object.keys(prevEventProps).forEach(eventKey => {
1827
+ if (!newEventProps ||
1828
+ !newEventProps[eventKey] ||
1829
+ newEventProps[eventKey] !== prevEventProps[eventKey]) {
1830
+ table.off(supportedEvents[eventKey], prevProps[eventKey]);
1831
+ }
1832
+ });
1833
+ }
1834
+ if (newEventProps) {
1835
+ Object.keys(newEventProps).forEach(eventKey => {
1836
+ if (!prevEventProps ||
1837
+ !prevEventProps[eventKey] ||
1838
+ prevEventProps[eventKey] !== newEventProps[eventKey]) {
1839
+ table.on(supportedEvents[eventKey], newEventProps[eventKey]);
1840
+ }
1841
+ });
1842
+ }
1843
+ return true;
1844
+ };
1845
+
1846
+ class Generator {
1847
+ static GenAutoIncrementId() {
1848
+ return Generator.auto_increment_id++;
1849
+ }
1850
+ }
1851
+ Generator.auto_increment_id = 0;
1852
+
1853
+ class ContainerModule {
1854
+ constructor(registry) {
1855
+ this.id = Generator.GenAutoIncrementId(), this.registry = registry;
1856
+ }
1857
+ }
1858
+
1859
+ const NAMED_TAG = "named";
1860
+ const INJECT_TAG = "inject";
1861
+ const MULTI_INJECT_TAG = "multi_inject";
1862
+ const TAGGED = "inversify:tagged";
1863
+ const PARAM_TYPES = "inversify:paramtypes";
1864
+
1865
+ class Metadata {
1866
+ constructor(key, value) {
1867
+ this.key = key, this.value = value;
1868
+ }
1869
+ toString() {
1870
+ return this.key === NAMED_TAG ? `named: ${String(this.value).toString()} ` : `tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`;
1871
+ }
1872
+ }
1873
+
1874
+ var Reflect$1 = (function (Reflect) {
1875
+ var target;
1876
+ return function (exporter) {
1877
+ const supportsSymbol = "function" == typeof Symbol,
1878
+ toPrimitiveSymbol = supportsSymbol && void 0 !== Symbol.toPrimitive ? Symbol.toPrimitive : "@@toPrimitive",
1879
+ functionPrototype = (Object.getPrototypeOf(Function)),
1880
+ _Map = ("object" == typeof process && process.env && process.env.REFLECT_METADATA_USE_MAP_POLYFILL, Map),
1881
+ Metadata = (new WeakMap());
1882
+ function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
1883
+ if (!IsObject(target)) throw new TypeError();
1884
+ return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
1885
+ }
1886
+ function hasMetadata(metadataKey, target, propertyKey) {
1887
+ if (!IsObject(target)) throw new TypeError();
1888
+ return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryHasMetadata(metadataKey, target, propertyKey);
1889
+ }
1890
+ function hasOwnMetadata(metadataKey, target, propertyKey) {
1891
+ if (!IsObject(target)) throw new TypeError();
1892
+ return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);
1893
+ }
1894
+ function getMetadata(metadataKey, target, propertyKey) {
1895
+ if (!IsObject(target)) throw new TypeError();
1896
+ return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryGetMetadata(metadataKey, target, propertyKey);
1897
+ }
1898
+ function GetOrCreateMetadataMap(O, P, Create) {
1899
+ let targetMetadata = Metadata.get(O);
1900
+ if (IsUndefined(targetMetadata)) {
1901
+ if (!Create) return;
1902
+ targetMetadata = new _Map(), Metadata.set(O, targetMetadata);
1903
+ }
1904
+ let metadataMap = targetMetadata.get(P);
1905
+ if (IsUndefined(metadataMap)) {
1906
+ if (!Create) return;
1907
+ metadataMap = new _Map(), targetMetadata.set(P, metadataMap);
1908
+ }
1909
+ return metadataMap;
1910
+ }
1911
+ function OrdinaryHasMetadata(MetadataKey, O, P) {
1912
+ if (OrdinaryHasOwnMetadata(MetadataKey, O, P)) return !0;
1913
+ const parent = OrdinaryGetPrototypeOf(O);
1914
+ return !IsNull(parent) && OrdinaryHasMetadata(MetadataKey, parent, P);
1915
+ }
1916
+ function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
1917
+ const metadataMap = GetOrCreateMetadataMap(O, P, !1);
1918
+ return !IsUndefined(metadataMap) && ToBoolean(metadataMap.has(MetadataKey));
1919
+ }
1920
+ function OrdinaryGetMetadata(MetadataKey, O, P) {
1921
+ if (OrdinaryHasOwnMetadata(MetadataKey, O, P)) return OrdinaryGetOwnMetadata(MetadataKey, O, P);
1922
+ const parent = OrdinaryGetPrototypeOf(O);
1923
+ return IsNull(parent) ? void 0 : OrdinaryGetMetadata(MetadataKey, parent, P);
1924
+ }
1925
+ function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
1926
+ const metadataMap = GetOrCreateMetadataMap(O, P, !1);
1927
+ if (!IsUndefined(metadataMap)) return metadataMap.get(MetadataKey);
1928
+ }
1929
+ function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
1930
+ GetOrCreateMetadataMap(O, P, !0).set(MetadataKey, MetadataValue);
1931
+ }
1932
+ function Type(x) {
1933
+ if (null === x) return 1;
1934
+ switch (typeof x) {
1935
+ case "undefined":
1936
+ return 0;
1937
+ case "boolean":
1938
+ return 2;
1939
+ case "string":
1940
+ return 3;
1941
+ case "symbol":
1942
+ return 4;
1943
+ case "number":
1944
+ return 5;
1945
+ case "object":
1946
+ return null === x ? 1 : 6;
1947
+ default:
1948
+ return 6;
1949
+ }
1950
+ }
1951
+ function IsUndefined(x) {
1952
+ return void 0 === x;
1953
+ }
1954
+ function IsNull(x) {
1955
+ return null === x;
1956
+ }
1957
+ function IsSymbol(x) {
1958
+ return "symbol" == typeof x;
1959
+ }
1960
+ function IsObject(x) {
1961
+ return "object" == typeof x ? null !== x : "function" == typeof x;
1962
+ }
1963
+ function ToPrimitive(input, PreferredType) {
1964
+ switch (Type(input)) {
1965
+ case 0:
1966
+ case 1:
1967
+ case 2:
1968
+ case 3:
1969
+ case 4:
1970
+ case 5:
1971
+ return input;
1972
+ }
1973
+ const hint = 3 === PreferredType ? "string" : 5 === PreferredType ? "number" : "default",
1974
+ exoticToPrim = GetMethod(input, toPrimitiveSymbol);
1975
+ if (void 0 !== exoticToPrim) {
1976
+ const result = exoticToPrim.call(input, hint);
1977
+ if (IsObject(result)) throw new TypeError();
1978
+ return result;
1979
+ }
1980
+ return OrdinaryToPrimitive(input, "default" === hint ? "number" : hint);
1981
+ }
1982
+ function OrdinaryToPrimitive(O, hint) {
1983
+ if ("string" === hint) {
1984
+ const toString_1 = O.toString;
1985
+ if (IsCallable(toString_1)) {
1986
+ const result = toString_1.call(O);
1987
+ if (!IsObject(result)) return result;
1988
+ }
1989
+ const valueOf = O.valueOf;
1990
+ if (IsCallable(valueOf)) {
1991
+ const result = valueOf.call(O);
1992
+ if (!IsObject(result)) return result;
1993
+ }
1994
+ } else {
1995
+ const valueOf = O.valueOf;
1996
+ if (IsCallable(valueOf)) {
1997
+ const result = valueOf.call(O);
1998
+ if (!IsObject(result)) return result;
1999
+ }
2000
+ const toString_2 = O.toString;
2001
+ if (IsCallable(toString_2)) {
2002
+ const result = toString_2.call(O);
2003
+ if (!IsObject(result)) return result;
2004
+ }
2005
+ }
2006
+ throw new TypeError();
2007
+ }
2008
+ function ToBoolean(argument) {
2009
+ return !!argument;
2010
+ }
2011
+ function ToString(argument) {
2012
+ return "" + argument;
2013
+ }
2014
+ function ToPropertyKey(argument) {
2015
+ const key = ToPrimitive(argument, 3);
2016
+ return IsSymbol(key) ? key : ToString(key);
2017
+ }
2018
+ function IsCallable(argument) {
2019
+ return "function" == typeof argument;
2020
+ }
2021
+ function GetMethod(V, P) {
2022
+ const func = V[P];
2023
+ if (null != func) {
2024
+ if (!IsCallable(func)) throw new TypeError();
2025
+ return func;
2026
+ }
2027
+ }
2028
+ function OrdinaryGetPrototypeOf(O) {
2029
+ const proto = Object.getPrototypeOf(O);
2030
+ if ("function" != typeof O || O === functionPrototype) return proto;
2031
+ if (proto !== functionPrototype) return proto;
2032
+ const prototype = O.prototype,
2033
+ prototypeProto = prototype && Object.getPrototypeOf(prototype);
2034
+ if (null == prototypeProto || prototypeProto === Object.prototype) return proto;
2035
+ const constructor = prototypeProto.constructor;
2036
+ return "function" != typeof constructor || constructor === O ? proto : constructor;
2037
+ }
2038
+ exporter("defineMetadata", defineMetadata), exporter("hasMetadata", hasMetadata), exporter("hasOwnMetadata", hasOwnMetadata), exporter("getMetadata", getMetadata);
2039
+ }((target = Reflect, function (key, value) {
2040
+ "function" != typeof target[key] && Object.defineProperty(target, key, {
2041
+ configurable: !0,
2042
+ writable: !0,
2043
+ value: value
2044
+ });
2045
+ })), Reflect;
2046
+ })({});
2047
+
2048
+ function _tagParameterOrProperty(metadataKey, annotationTarget, key, metadata) {
2049
+ const metadatas = [metadata];
2050
+ let paramsOrPropertiesMetadata = {};
2051
+ Reflect$1.hasOwnMetadata(metadataKey, annotationTarget) && (paramsOrPropertiesMetadata = Reflect$1.getMetadata(metadataKey, annotationTarget));
2052
+ let paramOrPropertyMetadata = paramsOrPropertiesMetadata[key];
2053
+ void 0 === paramOrPropertyMetadata && (paramOrPropertyMetadata = []), paramOrPropertyMetadata.push(...metadatas), paramsOrPropertiesMetadata[key] = paramOrPropertyMetadata, Reflect$1.defineMetadata(metadataKey, paramsOrPropertiesMetadata, annotationTarget);
2332
2054
  }
2333
- function rgb(value) {
2334
- return isNumber$1(value) ? new RGB(value >> 16, value >> 8 & 255, 255 & value, 1) : isArray$1(value) ? new RGB(value[0], value[1], value[2]) : new RGB(255, 255, 255);
2055
+ function tagParameter(annotationTarget, parameterName, parameterIndex, metadata) {
2056
+ _tagParameterOrProperty(TAGGED, annotationTarget, parameterIndex.toString(), metadata);
2335
2057
  }
2336
- function rgba(value) {
2337
- return isNumber$1(value) ? new RGB(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : isArray$1(value) ? new RGB(value[0], value[1], value[2], value[3]) : new RGB(255, 255, 255, 1);
2058
+ function createTaggedDecorator(metadata) {
2059
+ return (target, targetKey, indexOrPropertyDescriptor) => {
2060
+ tagParameter(target, targetKey, indexOrPropertyDescriptor, metadata);
2061
+ };
2338
2062
  }
2339
- function SRGBToLinear(c) {
2340
- return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
2063
+ function injectBase(metadataKey) {
2064
+ return serviceIdentifier => (target, targetKey, indexOrPropertyDescriptor) => createTaggedDecorator(new Metadata(metadataKey, serviceIdentifier))(target, targetKey, indexOrPropertyDescriptor);
2341
2065
  }
2342
- function LinearToSRGB(c) {
2343
- return c < .0031308 ? 12.92 * c : 1.055 * Math.pow(c, .41666) - .055;
2066
+
2067
+ const inject = injectBase(INJECT_TAG);
2068
+
2069
+ function injectable() {
2070
+ return function (target) {
2071
+ return Reflect$1.defineMetadata(PARAM_TYPES, null, target), target;
2072
+ };
2344
2073
  }
2345
- const setHex = (formatValue, forceHex) => {
2346
- const isHex = REG_HEX.exec(formatValue);
2347
- if (forceHex || isHex) {
2348
- const hex = parseInt(isHex[1], 16),
2349
- hexLength = isHex[1].length;
2350
- return 3 === hexLength ? new RGB((hex >> 8 & 15) + ((hex >> 8 & 15) << 4), (hex >> 4 & 15) + ((hex >> 4 & 15) << 4), (15 & hex) + ((15 & hex) << 4), 1) : 6 === hexLength ? rgb(hex) : 8 === hexLength ? new RGB(hex >> 24 & 255, hex >> 16 & 255, hex >> 8 & 255, (255 & hex) / 255) : null;
2074
+
2075
+ function named(name) {
2076
+ return createTaggedDecorator(new Metadata(NAMED_TAG, name));
2077
+ }
2078
+
2079
+ const BindingScopeEnum = {
2080
+ Singleton: "Singleton",
2081
+ Transient: "Transient"
2082
+ },
2083
+ BindingTypeEnum = {
2084
+ ConstantValue: "ConstantValue",
2085
+ Constructor: "Constructor",
2086
+ DynamicValue: "DynamicValue",
2087
+ Factory: "Factory",
2088
+ Function: "Function",
2089
+ Instance: "Instance",
2090
+ Invalid: "Invalid",
2091
+ Provider: "Provider"
2092
+ };
2093
+
2094
+ class Binding {
2095
+ constructor(serviceIdentifier, scope) {
2096
+ this.id = Generator.GenAutoIncrementId(), this.activated = !1, this.serviceIdentifier = serviceIdentifier, this.scope = scope, this.type = BindingTypeEnum.Invalid, this.constraint = request => !0, this.implementationType = null, this.cache = null, this.factory = null, this.provider = null, this.dynamicValue = null;
2097
+ }
2098
+ clone() {
2099
+ const clone = new Binding(this.serviceIdentifier, this.scope);
2100
+ return clone.activated = clone.scope === BindingScopeEnum.Singleton && this.activated, clone.implementationType = this.implementationType, clone.dynamicValue = this.dynamicValue, clone.scope = this.scope, clone.type = this.type, clone.provider = this.provider, clone.constraint = this.constraint, clone.cache = this.cache, clone;
2101
+ }
2102
+ }
2103
+
2104
+ class MetadataReader {
2105
+ getConstructorMetadata(constructorFunc) {
2106
+ return {
2107
+ compilerGeneratedMetadata: Reflect$1.getMetadata(PARAM_TYPES, constructorFunc),
2108
+ userGeneratedMetadata: Reflect$1.getMetadata(TAGGED, constructorFunc) || {}
2109
+ };
2351
2110
  }
2111
+ getPropertiesMetadata(constructorFunc) {
2112
+ throw new Error("暂未实现");
2113
+ }
2114
+ }
2115
+
2116
+ const taggedConstraint = key => value => {
2117
+ const constraint = request => {
2118
+ if (null == request) return !1;
2119
+ if (request.key === key && request.value === value) return !0;
2120
+ if (null == request.constructorArgsMetadata) return !1;
2121
+ const constructorArgsMetadata = request.constructorArgsMetadata;
2122
+ for (let i = 0; i < constructorArgsMetadata.length; i++) if (constructorArgsMetadata[i].key === key && constructorArgsMetadata[i].value === value) return !0;
2123
+ return !1;
2124
+ };
2125
+ return constraint.metaData = new Metadata(key, value), constraint;
2352
2126
  };
2353
- class Color {
2354
- static Brighter(source) {
2355
- let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
2356
- return 1 === b ? source : new Color(source).brighter(b).toRGBA();
2127
+ const namedConstraint = taggedConstraint(NAMED_TAG);
2128
+
2129
+ class BindingInSyntax {
2130
+ constructor(binding) {
2131
+ this._binding = binding;
2357
2132
  }
2358
- static SetOpacity(source) {
2359
- let o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
2360
- return 1 === o ? source : new Color(source).setOpacity(o).toRGBA();
2133
+ inRequestScope() {
2134
+ throw new Error("暂未实现");
2361
2135
  }
2362
- static getColorBrightness(source) {
2363
- let model = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "hsl";
2364
- const color = source instanceof Color ? source : new Color(source);
2365
- switch (model) {
2366
- case "hsv":
2367
- default:
2368
- return color.getHSVBrightness();
2369
- case "hsl":
2370
- return color.getHSLBrightness();
2371
- case "lum":
2372
- return color.getLuminance();
2373
- case "lum2":
2374
- return color.getLuminance2();
2375
- case "lum3":
2376
- return color.getLuminance3();
2377
- }
2136
+ inSingletonScope() {
2137
+ return this._binding.scope = BindingScopeEnum.Singleton, this;
2378
2138
  }
2379
- static parseColorString(value) {
2380
- if (isValid$1(DEFAULT_COLORS_OPACITY[value])) return rgba(DEFAULT_COLORS_OPACITY[value]);
2381
- if (isValid$1(DEFAULT_COLORS[value])) return rgb(DEFAULT_COLORS[value]);
2382
- const formatValue = `${value}`.trim().toLowerCase(),
2383
- hexRes = setHex(formatValue);
2384
- if (void 0 !== hexRes) return hexRes;
2385
- if (/^(rgb|RGB|rgba|RGBA)/.test(formatValue)) {
2386
- const aColor = formatValue.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g, "").split(",");
2387
- return new RGB(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10), parseFloat(aColor[3]));
2388
- }
2389
- if (/^(hsl|HSL|hsla|HSLA)/.test(formatValue)) {
2390
- const aColor = formatValue.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g, "").split(","),
2391
- rgb = hslToRgb(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10));
2392
- return new RGB(rgb.r, rgb.g, rgb.b, parseFloat(aColor[3]));
2393
- }
2139
+ inTransientScope() {
2140
+ return this._binding.scope = BindingScopeEnum.Transient, this;
2394
2141
  }
2395
- constructor(value) {
2396
- const color = Color.parseColorString(value);
2397
- color ? this.color = color : (this.color = new RGB(255, 255, 255));
2142
+ whenTargetNamed(name) {
2143
+ return this._binding.constraint = namedConstraint(name), this;
2398
2144
  }
2399
- toRGBA() {
2400
- return this.color.formatRgb();
2145
+ }
2146
+
2147
+ class BindingToSyntax {
2148
+ constructor(binding) {
2149
+ this._binding = binding;
2401
2150
  }
2402
- toString() {
2403
- return this.color.formatRgb();
2151
+ to(constructor) {
2152
+ return this._binding.type = BindingTypeEnum.Instance, this._binding.implementationType = constructor, new BindingInSyntax(this._binding);
2404
2153
  }
2405
- toHex() {
2406
- return this.color.formatHex();
2154
+ toSelf() {
2155
+ const self = this._binding.serviceIdentifier;
2156
+ return this.to(self);
2407
2157
  }
2408
- toHsl() {
2409
- return this.color.formatHsl();
2158
+ toDynamicValue(func) {
2159
+ return this._binding.type = BindingTypeEnum.DynamicValue, this._binding.cache = null, this._binding.dynamicValue = func, this._binding.implementationType = null, new BindingInSyntax(this._binding);
2410
2160
  }
2411
- brighter(k) {
2412
- const {
2413
- r: r,
2414
- g: g,
2415
- b: b
2416
- } = this.color;
2417
- return this.color.r = Math.max(0, Math.min(255, Math.floor(r * k))), this.color.g = Math.max(0, Math.min(255, Math.floor(g * k))), this.color.b = Math.max(0, Math.min(255, Math.floor(b * k))), this;
2161
+ toConstantValue(value) {
2162
+ return this._binding.type = BindingTypeEnum.ConstantValue, this._binding.cache = value, this._binding.dynamicValue = null, this._binding.implementationType = null, this._binding.scope = BindingScopeEnum.Singleton, new BindingInSyntax(this._binding);
2418
2163
  }
2419
- add(color) {
2420
- const {
2421
- r: r,
2422
- g: g,
2423
- b: b
2424
- } = this.color;
2425
- return this.color.r += Math.min(255, r + color.color.r), this.color.g += Math.min(255, g + color.color.g), this.color.b += Math.min(255, b + color.color.b), this;
2164
+ toFactory(factory) {
2165
+ return this._binding.type = BindingTypeEnum.Factory, this._binding.factory = factory, this._binding.scope = BindingScopeEnum.Singleton, new BindingInSyntax(this._binding);
2426
2166
  }
2427
- sub(color) {
2428
- return this.color.r = Math.max(0, this.color.r - color.color.r), this.color.g = Math.max(0, this.color.g - color.color.g), this.color.b = Math.max(0, this.color.b - color.color.b), this;
2167
+ toService(service) {
2168
+ this.toDynamicValue(context => context.container.get(service));
2429
2169
  }
2430
- multiply(color) {
2431
- const {
2432
- r: r,
2433
- g: g,
2434
- b: b
2435
- } = this.color;
2436
- return this.color.r = Math.max(0, Math.min(255, Math.floor(r * color.color.r))), this.color.g = Math.max(0, Math.min(255, Math.floor(g * color.color.g))), this.color.b = Math.max(0, Math.min(255, Math.floor(b * color.color.b))), this;
2170
+ }
2171
+
2172
+ class Container {
2173
+ constructor(containerOptions) {
2174
+ const options = containerOptions || {};
2175
+ options.defaultScope = options.defaultScope || BindingScopeEnum.Transient, this.options = options, this.id = Generator.GenAutoIncrementId(), this._bindingDictionary = new Map(), this._metadataReader = new MetadataReader();
2437
2176
  }
2438
- getHSVBrightness() {
2439
- return Math.max(this.color.r, this.color.g, this.color.b) / 255;
2177
+ load(module) {
2178
+ const containerModuleHelpers = this._getContainerModuleHelpersFactory()(module.id);
2179
+ module.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction);
2440
2180
  }
2441
- getHSLBrightness() {
2442
- return .5 * (Math.max(this.color.r, this.color.g, this.color.b) / 255 + Math.min(this.color.r, this.color.g, this.color.b) / 255);
2181
+ get(serviceIdentifier) {
2182
+ const getArgs = this._getNotAllArgs(serviceIdentifier, !1);
2183
+ return this._get(getArgs);
2443
2184
  }
2444
- setHsl(h, s, l) {
2445
- const opacity = this.color.opacity,
2446
- hsl = rgbToHsl(this.color.r, this.color.g, this.color.b),
2447
- rgb = hslToRgb(isNil$1(h) ? hsl.h : clamp$1(h, 0, 360), isNil$1(s) ? hsl.s : s >= 0 && s <= 1 ? 100 * s : s, isNil$1(l) ? hsl.l : l <= 1 && l >= 0 ? 100 * l : l);
2448
- return this.color = new RGB(rgb.r, rgb.g, rgb.b, opacity), this;
2185
+ getAll(serviceIdentifier) {
2186
+ const getArgs = this._getAllArgs(serviceIdentifier);
2187
+ return this._get(getArgs);
2449
2188
  }
2450
- setRGB(r, g, b) {
2451
- return !isNil$1(r) && (this.color.r = r), !isNil$1(g) && (this.color.g = g), !isNil$1(b) && (this.color.b = b), this;
2189
+ getTagged(serviceIdentifier, key, value) {
2190
+ const getArgs = this._getNotAllArgs(serviceIdentifier, !1, key, value);
2191
+ return this._get(getArgs);
2452
2192
  }
2453
- setHex(value) {
2454
- const formatValue = `${value}`.trim().toLowerCase(),
2455
- res = setHex(formatValue, !0);
2456
- return null != res ? res : this;
2193
+ getNamed(serviceIdentifier, named) {
2194
+ return this.getTagged(serviceIdentifier, NAMED_TAG, named);
2457
2195
  }
2458
- setColorName(name) {
2459
- const hex = DEFAULT_COLORS[name.toLowerCase()];
2460
- return void 0 !== hex ? this.setHex(hex) : (void 0), this;
2196
+ isBound(serviceIdentifier) {
2197
+ return this._bindingDictionary.has(serviceIdentifier);
2461
2198
  }
2462
- setScalar(scalar) {
2463
- return this.color.r = scalar, this.color.g = scalar, this.color.b = scalar, this;
2199
+ bind(serviceIdentifier) {
2200
+ const scope = this.options.defaultScope,
2201
+ binding = new Binding(serviceIdentifier, scope),
2202
+ list = this._bindingDictionary.get(serviceIdentifier) || [];
2203
+ return list.push(binding), this._bindingDictionary.set(serviceIdentifier, list), new BindingToSyntax(binding);
2464
2204
  }
2465
- setOpacity() {
2466
- let o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
2467
- return this.color.opacity = o, this;
2205
+ unbind(serviceIdentifier) {
2206
+ this._bindingDictionary.delete(serviceIdentifier);
2207
+ }
2208
+ rebind(serviceIdentifier) {
2209
+ return this.unbind(serviceIdentifier), this.bind(serviceIdentifier);
2210
+ }
2211
+ _getContainerModuleHelpersFactory() {
2212
+ const setModuleId = (bindingToSyntax, moduleId) => {
2213
+ bindingToSyntax._binding.moduleId = moduleId;
2214
+ },
2215
+ getBindFunction = moduleId => serviceIdentifier => {
2216
+ const bindingToSyntax = this.bind(serviceIdentifier);
2217
+ return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
2218
+ },
2219
+ getUnbindFunction = () => serviceIdentifier => this.unbind(serviceIdentifier),
2220
+ getIsboundFunction = () => serviceIdentifier => this.isBound(serviceIdentifier),
2221
+ getRebindFunction = moduleId => serviceIdentifier => {
2222
+ const bindingToSyntax = this.rebind(serviceIdentifier);
2223
+ return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
2224
+ };
2225
+ return mId => ({
2226
+ bindFunction: getBindFunction(mId),
2227
+ isboundFunction: getIsboundFunction(),
2228
+ rebindFunction: getRebindFunction(mId),
2229
+ unbindFunction: getUnbindFunction(),
2230
+ unbindAsyncFunction: serviceIdentifier => null
2231
+ });
2468
2232
  }
2469
- getLuminance() {
2470
- return (.2126 * this.color.r + .7152 * this.color.g + .0722 * this.color.b) / 255;
2233
+ _getNotAllArgs(serviceIdentifier, isMultiInject, key, value) {
2234
+ return {
2235
+ avoidConstraints: !1,
2236
+ isMultiInject: isMultiInject,
2237
+ serviceIdentifier: serviceIdentifier,
2238
+ key: key,
2239
+ value: value
2240
+ };
2471
2241
  }
2472
- getLuminance2() {
2473
- return (.2627 * this.color.r + .678 * this.color.g + .0593 * this.color.b) / 255;
2242
+ _getAllArgs(serviceIdentifier) {
2243
+ return {
2244
+ avoidConstraints: !0,
2245
+ isMultiInject: !0,
2246
+ serviceIdentifier: serviceIdentifier
2247
+ };
2474
2248
  }
2475
- getLuminance3() {
2476
- return (.299 * this.color.r + .587 * this.color.g + .114 * this.color.b) / 255;
2249
+ _get(getArgs) {
2250
+ const result = [];
2251
+ return this._bindingDictionary.get(getArgs.serviceIdentifier).filter(b => b.constraint(getArgs)).forEach(binding => {
2252
+ result.push(this._resolveFromBinding(binding));
2253
+ }), getArgs.isMultiInject || 1 !== result.length ? result : result[0];
2477
2254
  }
2478
- clone() {
2479
- return new Color(this.color.toString());
2255
+ _getChildRequest(binding) {
2256
+ const constr = binding.implementationType,
2257
+ {
2258
+ userGeneratedMetadata: userGeneratedMetadata
2259
+ } = this._metadataReader.getConstructorMetadata(constr),
2260
+ keys = Object.keys(userGeneratedMetadata),
2261
+ arr = [];
2262
+ for (let i = 0; i < keys.length; i++) {
2263
+ const constructorArgsMetadata = userGeneratedMetadata[i],
2264
+ targetMetadataMap = {};
2265
+ constructorArgsMetadata.forEach(md => {
2266
+ targetMetadataMap[md.key] = md.value;
2267
+ });
2268
+ const metadata = {
2269
+ inject: targetMetadataMap[INJECT_TAG],
2270
+ multiInject: targetMetadataMap[MULTI_INJECT_TAG]
2271
+ },
2272
+ injectIdentifier = metadata.inject || metadata.multiInject,
2273
+ target = {
2274
+ serviceIdentifier: injectIdentifier,
2275
+ constructorArgsMetadata: constructorArgsMetadata
2276
+ },
2277
+ request = {
2278
+ injectIdentifier: injectIdentifier,
2279
+ metadata: constructorArgsMetadata,
2280
+ bindings: this._bindingDictionary.get(injectIdentifier).filter(b => b.constraint(target))
2281
+ };
2282
+ arr.push(request);
2283
+ }
2284
+ return arr;
2480
2285
  }
2481
- copyGammaToLinear(color) {
2482
- let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
2483
- return this.color.r = Math.pow(color.color.r, gammaFactor), this.color.g = Math.pow(color.color.g, gammaFactor), this.color.b = Math.pow(color.color.b, gammaFactor), this;
2286
+ _resolveFromBinding(binding) {
2287
+ const result = this._getResolvedFromBinding(binding);
2288
+ return this._saveToScope(binding, result), result;
2484
2289
  }
2485
- copyLinearToGamma(color) {
2486
- let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
2487
- const safeInverse = gammaFactor > 0 ? 1 / gammaFactor : 1;
2488
- return this.color.r = Math.pow(color.color.r, safeInverse), this.color.g = Math.pow(color.color.g, safeInverse), this.color.b = Math.pow(color.color.b, safeInverse), this;
2290
+ _getResolvedFromBinding(binding) {
2291
+ let result;
2292
+ switch (binding.type) {
2293
+ case BindingTypeEnum.ConstantValue:
2294
+ case BindingTypeEnum.Function:
2295
+ result = binding.cache;
2296
+ break;
2297
+ case BindingTypeEnum.Instance:
2298
+ result = this._resolveInstance(binding, binding.implementationType);
2299
+ break;
2300
+ default:
2301
+ result = binding.dynamicValue({
2302
+ container: this
2303
+ });
2304
+ }
2305
+ return result;
2489
2306
  }
2490
- convertGammaToLinear(gammaFactor) {
2491
- return this.copyGammaToLinear(this, gammaFactor), this;
2307
+ _resolveInstance(binding, constr) {
2308
+ if (binding.activated) return binding.cache;
2309
+ const childRequests = this._getChildRequest(binding);
2310
+ return this._createInstance(constr, childRequests);
2492
2311
  }
2493
- convertLinearToGamma(gammaFactor) {
2494
- return this.copyLinearToGamma(this, gammaFactor), this;
2312
+ _createInstance(constr, childRequests) {
2313
+ if (childRequests.length) {
2314
+ return new constr(...this._resolveRequests(childRequests));
2315
+ }
2316
+ return new constr();
2495
2317
  }
2496
- copySRGBToLinear(color) {
2497
- return this.color.r = SRGBToLinear(color.color.r), this.color.g = SRGBToLinear(color.color.g), this.color.b = SRGBToLinear(color.color.b), this;
2318
+ _resolveRequests(childRequests) {
2319
+ return childRequests.map(request => request.bindings.length > 1 ? request.bindings.map(binding => this._resolveFromBinding(binding)) : this._resolveFromBinding(request.bindings[0]));
2498
2320
  }
2499
- copyLinearToSRGB(color) {
2500
- return this.color.r = LinearToSRGB(color.color.r), this.color.g = LinearToSRGB(color.color.g), this.color.b = LinearToSRGB(color.color.b), this;
2321
+ _saveToScope(binding, result) {
2322
+ binding.scope === BindingScopeEnum.Singleton && (binding.cache = result, binding.activated = !0);
2501
2323
  }
2502
- convertSRGBToLinear() {
2503
- return this.copySRGBToLinear(this), this;
2324
+ }
2325
+
2326
+ const ContributionProvider = Symbol("ContributionProvider");
2327
+ class ContributionProviderCache {
2328
+ constructor(serviceIdentifier, container) {
2329
+ this.serviceIdentifier = serviceIdentifier, this.container = container;
2504
2330
  }
2505
- convertLinearToSRGB() {
2506
- return this.copyLinearToSRGB(this), this;
2331
+ getContributions() {
2332
+ return this.caches || (this.caches = [], this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier))), this.caches;
2507
2333
  }
2508
2334
  }
2509
- class RGB {
2510
- constructor(r, g, b, opacity) {
2511
- this.r = isNaN(+r) ? 255 : Math.max(0, Math.min(255, +r)), this.g = isNaN(+g) ? 255 : Math.max(0, Math.min(255, +g)), this.b = isNaN(+b) ? 255 : Math.max(0, Math.min(255, +b)), isValid$1(opacity) ? this.opacity = isNaN(+opacity) ? 1 : Math.max(0, Math.min(1, +opacity)) : this.opacity = 1;
2335
+ function bindContributionProvider(bind, id) {
2336
+ bind(ContributionProvider).toDynamicValue(_ref => {
2337
+ let {
2338
+ container: container
2339
+ } = _ref;
2340
+ return new ContributionProviderCache(id, container);
2341
+ }).inSingletonScope().whenTargetNamed(id);
2342
+ }
2343
+
2344
+ class Hook {
2345
+ constructor(args, name) {
2346
+ this._args = args, this.name = name, this.taps = [];
2512
2347
  }
2513
- formatHex() {
2514
- return `#${hex(this.r) + hex(this.g) + hex(this.b) + (1 === this.opacity ? "" : hex(255 * this.opacity))}`;
2348
+ tap(options, fn) {
2349
+ this._tap("sync", options, fn);
2515
2350
  }
2516
- formatRgb() {
2517
- const opacity = this.opacity;
2518
- return `${1 === opacity ? "rgb(" : "rgba("}${this.r},${this.g},${this.b}${1 === opacity ? ")" : `,${opacity})`}`;
2351
+ unTap(options, fn) {
2352
+ const name = "string" == typeof options ? options.trim() : options.name;
2353
+ name && (this.taps = this.taps.filter(tap => !(tap.name === name && (!fn || tap.fn === fn))));
2519
2354
  }
2520
- formatHsl() {
2521
- const opacity = this.opacity,
2522
- {
2523
- h: h,
2524
- s: s,
2525
- l: l
2526
- } = rgbToHsl(this.r, this.g, this.b);
2527
- return `${1 === opacity ? "hsl(" : "hsla("}${h},${s}%,${l}%${1 === opacity ? ")" : `,${opacity})`}`;
2355
+ _parseOptions(type, options, fn) {
2356
+ let _options;
2357
+ if ("string" == typeof options) _options = {
2358
+ name: options.trim()
2359
+ };else if ("object" != typeof options || null === options) throw new Error("Invalid tap options");
2360
+ if ("string" != typeof _options.name || "" === _options.name) throw new Error("Missing name for tap");
2361
+ return _options = Object.assign({
2362
+ type: type,
2363
+ fn: fn
2364
+ }, _options), _options;
2528
2365
  }
2529
- toString() {
2530
- return this.formatHex();
2366
+ _tap(type, options, fn) {
2367
+ this._insert(this._parseOptions(type, options, fn));
2368
+ }
2369
+ _insert(item) {
2370
+ let before;
2371
+ "string" == typeof item.before ? before = new Set([item.before]) : Array.isArray(item.before) && (before = new Set(item.before));
2372
+ let stage = 0;
2373
+ "number" == typeof item.stage && (stage = item.stage);
2374
+ let i = this.taps.length;
2375
+ for (; i > 0;) {
2376
+ i--;
2377
+ const x = this.taps[i];
2378
+ this.taps[i + 1] = x;
2379
+ const xStage = x.stage || 0;
2380
+ if (before) {
2381
+ if (before.has(x.name)) {
2382
+ before.delete(x.name);
2383
+ continue;
2384
+ }
2385
+ if (before.size > 0) continue;
2386
+ }
2387
+ if (!(xStage > stage)) {
2388
+ i++;
2389
+ break;
2390
+ }
2391
+ }
2392
+ this.taps[i] = item;
2531
2393
  }
2532
2394
  }
2533
2395
 
2534
- function normalizePadding(padding) {
2535
- if (isValidNumber$1(padding)) return [padding, padding, padding, padding];
2536
- if (isArray$1(padding)) {
2537
- const length = padding.length;
2538
- if (1 === length) {
2539
- const paddingValue = padding[0];
2540
- return [paddingValue, paddingValue, paddingValue, paddingValue];
2541
- }
2542
- if (2 === length) {
2543
- const [vertical, horizontal] = padding;
2544
- return [vertical, horizontal, vertical, horizontal];
2545
- }
2546
- if (3 === length) {
2547
- const [top, horizontal, bottom] = padding;
2548
- return [top, horizontal, bottom, horizontal];
2396
+ class SyncHook extends Hook {
2397
+ call() {
2398
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2399
+ args[_key] = arguments[_key];
2549
2400
  }
2550
- if (4 === length) return padding;
2551
- }
2552
- if (isObject$1(padding)) {
2553
- const {
2554
- top = 0,
2555
- right = 0,
2556
- bottom = 0,
2557
- left = 0
2558
- } = padding;
2559
- return [top, right, bottom, left];
2401
+ this.taps.map(t => t.fn).forEach(cb => cb(...args));
2560
2402
  }
2561
- return [0, 0, 0, 0];
2562
2403
  }
2563
2404
 
2564
- const styleStringToObject = function () {
2565
- let styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
2566
- const res = {};
2567
- return styleStr.split(";").forEach(item => {
2568
- if (item) {
2569
- const arr = item.split(":");
2570
- if (2 === arr.length) {
2571
- const key = arr[0].trim(),
2572
- value = arr[1].trim();
2573
- key && value && (res[key] = value);
2574
- }
2575
- }
2576
- }), res;
2577
- };
2578
- const lowerCamelCaseToMiddle = str => str.replace(/([A-Z])/g, "-$1").toLowerCase();
2405
+ const EnvContribution = Symbol.for("EnvContribution");
2406
+ const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
2407
+
2408
+ var MeasureModeEnum;
2409
+ !function (MeasureModeEnum) {
2410
+ MeasureModeEnum[MeasureModeEnum.estimate = 0] = "estimate", MeasureModeEnum[MeasureModeEnum.actualBounding = 1] = "actualBounding", MeasureModeEnum[MeasureModeEnum.fontBounding = 2] = "fontBounding";
2411
+ }(MeasureModeEnum || (MeasureModeEnum = {}));
2579
2412
 
2580
2413
  const circleThreshold = tau - 1e-8;
2581
2414
  class BoundsContext {
@@ -12627,7 +12460,7 @@
12627
12460
  if (!(element && ReactDOM && ReactDOM.createRoot)) {
12628
12461
  return;
12629
12462
  }
12630
- const id = isNil$3(react.id) ? `${graphic.id ?? graphic._uid}_react` : react.id;
12463
+ const id = isNil$1(react.id) ? `${graphic.id ?? graphic._uid}_react` : react.id;
12631
12464
  if (this.htmlMap && this.htmlMap[id] && container && container !== this.htmlMap[id].container) {
12632
12465
  this.removeElement(id);
12633
12466
  }
@@ -12690,7 +12523,7 @@
12690
12523
  let top = 0;
12691
12524
  const b = graphic.globalAABBBounds;
12692
12525
  let anchorType = options.anchorType;
12693
- if (isNil$3(anchorType)) {
12526
+ if (isNil$1(anchorType)) {
12694
12527
  anchorType = graphic.type === 'text' ? 'position' : 'boundsLeftTop';
12695
12528
  }
12696
12529
  if (anchorType === 'boundsLeftTop') {
@@ -12702,7 +12535,7 @@
12702
12535
  top = matrix.f;
12703
12536
  }
12704
12537
  else {
12705
- const anchor = calculateAnchorOfBounds$1(b, anchorType);
12538
+ const anchor = calculateAnchorOfBounds(b, anchorType);
12706
12539
  left = anchor.x;
12707
12540
  top = anchor.y;
12708
12541
  }
@@ -12718,17 +12551,17 @@
12718
12551
  ...this.getTransformOfText(graphic)
12719
12552
  };
12720
12553
  }
12721
- if (isFunction$3(options.style)) {
12554
+ if (isFunction$1(options.style)) {
12722
12555
  const userStyle = options.style({ top: offsetTop, left: offsetX, width: b.width(), height: b.height() }, graphic, wrapContainer);
12723
12556
  if (userStyle) {
12724
12557
  calculateStyle = { ...calculateStyle, ...userStyle };
12725
12558
  }
12726
12559
  }
12727
- else if (isObject$3(options.style)) {
12560
+ else if (isObject$1(options.style)) {
12728
12561
  calculateStyle = { ...calculateStyle, ...options.style };
12729
12562
  }
12730
- else if (isString$3(options.style) && options.style) {
12731
- calculateStyle = { ...calculateStyle, ...styleStringToObject$1(options.style) };
12563
+ else if (isString$1(options.style) && options.style) {
12564
+ calculateStyle = { ...calculateStyle, ...styleStringToObject(options.style) };
12732
12565
  }
12733
12566
  application.global.updateDom(wrapContainer, {
12734
12567
  width: options.width,
@@ -12815,7 +12648,7 @@
12815
12648
  }
12816
12649
  const { width, height, style } = params;
12817
12650
  if (style) {
12818
- if (isString$3(style)) {
12651
+ if (isString$1(style)) {
12819
12652
  dom.setAttribute('style', style);
12820
12653
  }
12821
12654
  else {
@@ -12857,7 +12690,7 @@
12857
12690
  toArray(props.children).map((child, index) => {
12858
12691
  const parseOption = child && child.type && child.type.parseOption;
12859
12692
  if (parseOption && child.props) {
12860
- const childProps = isNil$3(child.props.componentId)
12693
+ const childProps = isNil$1(child.props.componentId)
12861
12694
  ? {
12862
12695
  ...child.props,
12863
12696
  componentId: getComponentId(child, index)
@@ -18762,7 +18595,7 @@
18762
18595
  return graphic;
18763
18596
  }
18764
18597
  function isEventProp(key, props) {
18765
- return key.startsWith('on') && isFunction$3(props[key]);
18598
+ return key.startsWith('on') && isFunction$1(props[key]);
18766
18599
  }
18767
18600
  function bindEventsToGraphic(graphic, props) {
18768
18601
  for (const key in props) {
@@ -18782,7 +18615,7 @@
18782
18615
  graphic.addEventListener(REACT_TO_CANOPUS_EVENTS[propKey], newProps[propKey]);
18783
18616
  }
18784
18617
  }
18785
- const attribute = newProps.attribute ?? merge$1({}, newProps);
18618
+ const attribute = newProps.attribute ?? merge({}, newProps);
18786
18619
  graphic.initAttributes(attribute);
18787
18620
  if (graphic.type === 'image') {
18788
18621
  graphic.loadImage(attribute.image);
@@ -19044,7 +18877,7 @@
19044
18877
  styleTop = cellRect.top + dealWidthNumber(dy, cellRect.height) + cellRect.height + 'px';
19045
18878
  }
19046
18879
  }
19047
- const componentStyle = merge$1({}, style, {
18880
+ const componentStyle = merge({}, style, {
19048
18881
  position: 'absolute',
19049
18882
  zIndex: 1000,
19050
18883
  width: styleWidth,
@@ -19064,7 +18897,7 @@
19064
18897
  return { ...defaultProps };
19065
18898
  }, [defaultProps]);
19066
18899
  const props = React.useMemo(() => {
19067
- const mProps = merge$1({}, componentProps);
18900
+ const mProps = merge({}, componentProps);
19068
18901
  for (const propName in _defaultProps) {
19069
18902
  if (mProps[propName] === undefined) {
19070
18903
  mProps[propName] = _defaultProps[propName];
@@ -19075,7 +18908,7 @@
19075
18908
  return props;
19076
18909
  }
19077
18910
  function dealWidthNumber(value, refenceValue) {
19078
- if (isNumber$3(value)) {
18911
+ if (isNumber$1(value)) {
19079
18912
  return value;
19080
18913
  }
19081
18914
  if (typeof value === 'string' && value.endsWith('%')) {
@@ -19123,7 +18956,7 @@
19123
18956
  }
19124
18957
  };
19125
18958
  function ButtonComponent(baseProps, ref) {
19126
- const props = merge$1({}, defaultProps$6, baseProps);
18959
+ const props = merge({}, defaultProps$6, baseProps);
19127
18960
  const { disabled, onClick } = props;
19128
18961
  let buttonRef = React.useRef(null);
19129
18962
  buttonRef = ref ? ref : buttonRef;
@@ -19218,7 +19051,7 @@
19218
19051
  }
19219
19052
  };
19220
19053
  function LinkComponent(baseProps, ref) {
19221
- const props = merge$1({}, defaultProps$5, baseProps);
19054
+ const props = merge({}, defaultProps$5, baseProps);
19222
19055
  const { disabled, href, onClick } = props;
19223
19056
  let linkRef = React.useRef(null);
19224
19057
  linkRef = ref ? ref : linkRef;
@@ -19311,7 +19144,7 @@
19311
19144
  autoFixFontSize: true
19312
19145
  };
19313
19146
  function AvatarComponent(baseProps, ref) {
19314
- const props = merge$1({}, defaultProps$4, baseProps);
19147
+ const props = merge({}, defaultProps$4, baseProps);
19315
19148
  const { size, children, onClick } = props;
19316
19149
  let avatarRef = React.useRef(null);
19317
19150
  avatarRef = ref ? ref : avatarRef;
@@ -19319,7 +19152,7 @@
19319
19152
  onClick && onClick(event);
19320
19153
  }, [onClick]);
19321
19154
  const groupAttribute = getGroupAttribute(props);
19322
- if (isString$3(children)) {
19155
+ if (isString$1(children)) {
19323
19156
  const textAttribute = getTextAttribute(props);
19324
19157
  return (React.createElement(Group, { ref: avatarRef, attribute: groupAttribute, onClick: handleClick },
19325
19158
  React.createElement(Text, { attribute: textAttribute })));
@@ -19397,11 +19230,11 @@
19397
19230
  ...props.arrowStyle
19398
19231
  };
19399
19232
  return props.visible ? (React.createElement(React.Fragment, null,
19400
- React.createElement("div", { style: merge$1({}, defaultPoptipPanelStyle, props.panelStyle) }, props.content),
19233
+ React.createElement("div", { style: merge({}, defaultPoptipPanelStyle, props.panelStyle) }, props.content),
19401
19234
  React.createElement("div", { style: arrowStyle }))) : (React.createElement(React.Fragment, null));
19402
19235
  };
19403
19236
  function PopoverComponent(baseProps, ref) {
19404
- const props = merge$1({}, defaultProps$3, baseProps);
19237
+ const props = merge({}, defaultProps$3, baseProps);
19405
19238
  const { content, position, popupVisible, defaultPopupVisible, panelStyle, arrowStyle, children } = props;
19406
19239
  let popoverRef = React.useRef(null);
19407
19240
  popoverRef = ref ? ref : popoverRef;
@@ -19433,14 +19266,14 @@
19433
19266
  }
19434
19267
  };
19435
19268
  const groupMouseEnter = React.useCallback((event) => {
19436
- if (isValid$3(popupVisible)) {
19269
+ if (isValid$1(popupVisible)) {
19437
19270
  return;
19438
19271
  }
19439
19272
  setPopupOpen(true);
19440
19273
  event.currentTarget.stage.renderNextFrame();
19441
19274
  }, []);
19442
19275
  const groupMouseLeave = React.useCallback((event) => {
19443
- if (isValid$3(popupVisible)) {
19276
+ if (isValid$1(popupVisible)) {
19444
19277
  return;
19445
19278
  }
19446
19279
  setPopupOpen(false);
@@ -19617,7 +19450,7 @@
19617
19450
  }
19618
19451
  };
19619
19452
  function TagComponent(baseProps, ref) {
19620
- const props = merge$1({}, defaultProps$2, baseProps);
19453
+ const props = merge({}, defaultProps$2, baseProps);
19621
19454
  const { attribute, panelStyle, children, ...rest } = props;
19622
19455
  let tagRef = React.useRef(null);
19623
19456
  tagRef = ref ? ref : tagRef;
@@ -19634,7 +19467,7 @@
19634
19467
 
19635
19468
  const defaultProps$1 = {};
19636
19469
  function RadioComponent(baseProps, ref) {
19637
- const props = merge$1({}, defaultProps$1, baseProps);
19470
+ const props = merge({}, defaultProps$1, baseProps);
19638
19471
  const { textStyle, circleStyle, children, ...rest } = props;
19639
19472
  let radioRef = React.useRef(null);
19640
19473
  radioRef = ref ? ref : radioRef;
@@ -19663,7 +19496,7 @@
19663
19496
 
19664
19497
  const defaultProps = {};
19665
19498
  function CheckboxComponent(baseProps, ref) {
19666
- const props = merge$1({}, defaultProps, baseProps);
19499
+ const props = merge({}, defaultProps, baseProps);
19667
19500
  const { textStyle, boxStyle, iconStyle, children, ...rest } = props;
19668
19501
  let checkboxRef = React.useRef(null);
19669
19502
  checkboxRef = ref ? ref : checkboxRef;
@@ -19689,7 +19522,7 @@
19689
19522
  const Checkbox = React.forwardRef(CheckboxComponent);
19690
19523
  Checkbox.displayName = 'Checkbox';
19691
19524
 
19692
- const version = "1.14.4-alpha.5";
19525
+ const version = "1.15.0";
19693
19526
 
19694
19527
  Object.defineProperty(exports, 'register', {
19695
19528
  enumerable: true,