@visactor/react-vtable 1.17.1-alpha.8 → 1.17.1-alpha.9

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,2101 +535,1884 @@
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
- onSwitchStateChange: EVENT_TYPE.SWITCH_STATE_CHANGE,
761
- onAfterRender: EVENT_TYPE.AFTER_RENDER,
762
- onInitialized: EVENT_TYPE.INITIALIZED,
763
- onChangeCellValue: EVENT_TYPE.CHANGE_CELL_VALUE,
764
- onDragFillHandleEnd: EVENT_TYPE.DRAG_FILL_HANDLE_END,
765
- onMousedownFillHandle: EVENT_TYPE.MOUSEDOWN_FILL_HANDLE,
766
- onDblclickFillHandle: EVENT_TYPE.DBLCLICK_FILL_HANDLE,
767
- onPivotSortClick: EVENT_TYPE.PIVOT_SORT_CLICK,
768
- onDrillMenuClick: EVENT_TYPE.DRILLMENU_CLICK,
769
- onVChartEventType: EVENT_TYPE.VCHART_EVENT_TYPE,
770
- onChangCellValue: EVENT_TYPE.CHANGE_CELL_VALUE,
771
- onEmptyTipClick: EVENT_TYPE.EMPTY_TIP_CLICK,
772
- onEmptyTipDblClick: EVENT_TYPE.EMPTY_TIP_DBLCLICK,
773
- onButtonClick: EVENT_TYPE.BUTTON_CLICK
774
- };
775
- const TABLE_EVENTS_KEYS = Object.keys(TABLE_EVENTS);
776
- const findEventProps = (props, supportedEvents = TABLE_EVENTS) => {
777
- const result = {};
778
- Object.keys(props).forEach(key => {
779
- if (supportedEvents[key] && props[key]) {
780
- result[key] = props[key];
781
- }
782
- });
783
- return result;
784
- };
785
- const bindEventsToTable = (table, newProps, prevProps, supportedEvents = TABLE_EVENTS) => {
786
- if ((!newProps && !prevProps) || !table) {
787
- return false;
788
- }
789
- const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;
790
- const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;
791
- if (prevEventProps) {
792
- Object.keys(prevEventProps).forEach(eventKey => {
793
- if (!newEventProps ||
794
- !newEventProps[eventKey] ||
795
- newEventProps[eventKey] !== prevEventProps[eventKey]) {
796
- table.off(supportedEvents[eventKey], prevProps[eventKey]);
797
- }
798
- });
799
- }
800
- if (newEventProps) {
801
- Object.keys(newEventProps).forEach(eventKey => {
802
- if (!prevEventProps ||
803
- !prevEventProps[eventKey] ||
804
- prevEventProps[eventKey] !== newEventProps[eventKey]) {
805
- table.on(supportedEvents[eventKey], newEventProps[eventKey]);
806
- }
807
- });
808
- }
809
- 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
+ };
810
834
  };
811
835
 
812
- class Generator {
813
- static GenAutoIncrementId() {
814
- return Generator.auto_increment_id++;
815
- }
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);
816
844
  }
817
- Generator.auto_increment_id = 0;
818
-
819
- class ContainerModule {
820
- constructor(registry) {
821
- 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();
822
848
  }
823
- }
824
-
825
- const NAMED_TAG = "named";
826
- const INJECT_TAG = "inject";
827
- const MULTI_INJECT_TAG = "multi_inject";
828
- const TAGGED = "inversify:tagged";
829
- const PARAM_TYPES = "inversify:paramtypes";
830
-
831
- class Metadata {
832
- constructor(key, value) {
833
- this.key = key, this.value = value;
849
+ clone() {
850
+ return new Bounds(this);
834
851
  }
835
- toString() {
836
- 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;
837
854
  }
838
- }
839
-
840
- var Reflect$1 = (function (Reflect) {
841
- var target;
842
- return function (exporter) {
843
- const supportsSymbol = "function" == typeof Symbol,
844
- toPrimitiveSymbol = supportsSymbol && void 0 !== Symbol.toPrimitive ? Symbol.toPrimitive : "@@toPrimitive",
845
- functionPrototype = (Object.getPrototypeOf(Function)),
846
- _Map = ("object" == typeof process && process.env && process.env.REFLECT_METADATA_USE_MAP_POLYFILL, Map),
847
- Metadata = (new WeakMap());
848
- function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
849
- if (!IsObject(target)) throw new TypeError();
850
- return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
851
- }
852
- function hasMetadata(metadataKey, target, propertyKey) {
853
- if (!IsObject(target)) throw new TypeError();
854
- return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryHasMetadata(metadataKey, target, propertyKey);
855
- }
856
- function hasOwnMetadata(metadataKey, target, propertyKey) {
857
- if (!IsObject(target)) throw new TypeError();
858
- return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);
859
- }
860
- function getMetadata(metadataKey, target, propertyKey) {
861
- if (!IsObject(target)) throw new TypeError();
862
- return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryGetMetadata(metadataKey, target, propertyKey);
863
- }
864
- function GetOrCreateMetadataMap(O, P, Create) {
865
- let targetMetadata = Metadata.get(O);
866
- if (IsUndefined(targetMetadata)) {
867
- if (!Create) return;
868
- targetMetadata = new _Map(), Metadata.set(O, targetMetadata);
869
- }
870
- let metadataMap = targetMetadata.get(P);
871
- if (IsUndefined(metadataMap)) {
872
- if (!Create) return;
873
- metadataMap = new _Map(), targetMetadata.set(P, metadataMap);
874
- }
875
- return metadataMap;
876
- }
877
- function OrdinaryHasMetadata(MetadataKey, O, P) {
878
- if (OrdinaryHasOwnMetadata(MetadataKey, O, P)) return !0;
879
- const parent = OrdinaryGetPrototypeOf(O);
880
- return !IsNull(parent) && OrdinaryHasMetadata(MetadataKey, parent, P);
881
- }
882
- function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
883
- const metadataMap = GetOrCreateMetadataMap(O, P, !1);
884
- return !IsUndefined(metadataMap) && ToBoolean(metadataMap.has(MetadataKey));
885
- }
886
- function OrdinaryGetMetadata(MetadataKey, O, P) {
887
- if (OrdinaryHasOwnMetadata(MetadataKey, O, P)) return OrdinaryGetOwnMetadata(MetadataKey, O, P);
888
- const parent = OrdinaryGetPrototypeOf(O);
889
- return IsNull(parent) ? void 0 : OrdinaryGetMetadata(MetadataKey, parent, P);
890
- }
891
- function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
892
- const metadataMap = GetOrCreateMetadataMap(O, P, !1);
893
- if (!IsUndefined(metadataMap)) return metadataMap.get(MetadataKey);
894
- }
895
- function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
896
- GetOrCreateMetadataMap(O, P, !0).set(MetadataKey, MetadataValue);
897
- }
898
- function Type(x) {
899
- if (null === x) return 1;
900
- switch (typeof x) {
901
- case "undefined":
902
- return 0;
903
- case "boolean":
904
- return 2;
905
- case "string":
906
- return 3;
907
- case "symbol":
908
- return 4;
909
- case "number":
910
- return 5;
911
- case "object":
912
- return null === x ? 1 : 6;
913
- default:
914
- return 6;
915
- }
916
- }
917
- function IsUndefined(x) {
918
- return void 0 === x;
919
- }
920
- function IsNull(x) {
921
- return null === x;
922
- }
923
- function IsSymbol(x) {
924
- return "symbol" == typeof x;
925
- }
926
- function IsObject(x) {
927
- return "object" == typeof x ? null !== x : "function" == typeof x;
928
- }
929
- function ToPrimitive(input, PreferredType) {
930
- switch (Type(input)) {
931
- case 0:
932
- case 1:
933
- case 2:
934
- case 3:
935
- case 4:
936
- case 5:
937
- return input;
938
- }
939
- const hint = 3 === PreferredType ? "string" : 5 === PreferredType ? "number" : "default",
940
- exoticToPrim = GetMethod(input, toPrimitiveSymbol);
941
- if (void 0 !== exoticToPrim) {
942
- const result = exoticToPrim.call(input, hint);
943
- if (IsObject(result)) throw new TypeError();
944
- return result;
945
- }
946
- return OrdinaryToPrimitive(input, "default" === hint ? "number" : hint);
947
- }
948
- function OrdinaryToPrimitive(O, hint) {
949
- if ("string" === hint) {
950
- const toString_1 = O.toString;
951
- if (IsCallable(toString_1)) {
952
- const result = toString_1.call(O);
953
- if (!IsObject(result)) return result;
954
- }
955
- const valueOf = O.valueOf;
956
- if (IsCallable(valueOf)) {
957
- const result = valueOf.call(O);
958
- if (!IsObject(result)) return result;
959
- }
960
- } else {
961
- const valueOf = O.valueOf;
962
- if (IsCallable(valueOf)) {
963
- const result = valueOf.call(O);
964
- if (!IsObject(result)) return result;
965
- }
966
- const toString_2 = O.toString;
967
- if (IsCallable(toString_2)) {
968
- const result = toString_2.call(O);
969
- if (!IsObject(result)) return result;
970
- }
971
- }
972
- throw new TypeError();
973
- }
974
- function ToBoolean(argument) {
975
- return !!argument;
976
- }
977
- function ToString(argument) {
978
- return "" + argument;
979
- }
980
- function ToPropertyKey(argument) {
981
- const key = ToPrimitive(argument, 3);
982
- return IsSymbol(key) ? key : ToString(key);
983
- }
984
- function IsCallable(argument) {
985
- return "function" == typeof argument;
986
- }
987
- function GetMethod(V, P) {
988
- const func = V[P];
989
- if (null != func) {
990
- if (!IsCallable(func)) throw new TypeError();
991
- return func;
992
- }
993
- }
994
- function OrdinaryGetPrototypeOf(O) {
995
- const proto = Object.getPrototypeOf(O);
996
- if ("function" != typeof O || O === functionPrototype) return proto;
997
- if (proto !== functionPrototype) return proto;
998
- const prototype = O.prototype,
999
- prototypeProto = prototype && Object.getPrototypeOf(prototype);
1000
- if (null == prototypeProto || prototypeProto === Object.prototype) return proto;
1001
- const constructor = prototypeProto.constructor;
1002
- return "function" != typeof constructor || constructor === O ? proto : constructor;
1003
- }
1004
- exporter("defineMetadata", defineMetadata), exporter("hasMetadata", hasMetadata), exporter("hasOwnMetadata", hasOwnMetadata), exporter("getMetadata", getMetadata);
1005
- }((target = Reflect, function (key, value) {
1006
- "function" != typeof target[key] && Object.defineProperty(target, key, {
1007
- configurable: !0,
1008
- writable: !0,
1009
- value: value
1010
- });
1011
- })), Reflect;
1012
- })({});
1013
-
1014
- function _tagParameterOrProperty(metadataKey, annotationTarget, key, metadata) {
1015
- const metadatas = [metadata];
1016
- let paramsOrPropertiesMetadata = {};
1017
- Reflect$1.hasOwnMetadata(metadataKey, annotationTarget) && (paramsOrPropertiesMetadata = Reflect$1.getMetadata(metadataKey, annotationTarget));
1018
- let paramOrPropertyMetadata = paramsOrPropertiesMetadata[key];
1019
- void 0 === paramOrPropertyMetadata && (paramOrPropertyMetadata = []), paramOrPropertyMetadata.push(...metadatas), paramsOrPropertiesMetadata[key] = paramOrPropertyMetadata, Reflect$1.defineMetadata(metadataKey, paramsOrPropertiesMetadata, annotationTarget);
1020
- }
1021
- function tagParameter(annotationTarget, parameterName, parameterIndex, metadata) {
1022
- _tagParameterOrProperty(TAGGED, annotationTarget, parameterIndex.toString(), metadata);
1023
- }
1024
- function createTaggedDecorator(metadata) {
1025
- return (target, targetKey, indexOrPropertyDescriptor) => {
1026
- tagParameter(target, targetKey, indexOrPropertyDescriptor, metadata);
1027
- };
1028
- }
1029
- function injectBase(metadataKey) {
1030
- return serviceIdentifier => (target, targetKey, indexOrPropertyDescriptor) => createTaggedDecorator(new Metadata(metadataKey, serviceIdentifier))(target, targetKey, indexOrPropertyDescriptor);
1031
- }
1032
-
1033
- const inject = injectBase(INJECT_TAG);
1034
-
1035
- function injectable() {
1036
- return function (target) {
1037
- return Reflect$1.defineMetadata(PARAM_TYPES, null, target), target;
1038
- };
1039
- }
1040
-
1041
- function named(name) {
1042
- return createTaggedDecorator(new Metadata(NAMED_TAG, name));
1043
- }
1044
-
1045
- const BindingScopeEnum = {
1046
- Singleton: "Singleton",
1047
- Transient: "Transient"
1048
- },
1049
- BindingTypeEnum = {
1050
- ConstantValue: "ConstantValue",
1051
- Constructor: "Constructor",
1052
- DynamicValue: "DynamicValue",
1053
- Factory: "Factory",
1054
- Function: "Function",
1055
- Instance: "Instance",
1056
- Invalid: "Invalid",
1057
- Provider: "Provider"
1058
- };
1059
-
1060
- class Binding {
1061
- constructor(serviceIdentifier, scope) {
1062
- 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;
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
- clone() {
1065
- const clone = new Binding(this.serviceIdentifier, this.scope);
1066
- 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;
858
+ equals(b) {
859
+ return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2;
1067
860
  }
1068
- }
1069
-
1070
- class MetadataReader {
1071
- getConstructorMetadata(constructorFunc) {
1072
- return {
1073
- compilerGeneratedMetadata: Reflect$1.getMetadata(PARAM_TYPES, constructorFunc),
1074
- userGeneratedMetadata: Reflect$1.getMetadata(TAGGED, constructorFunc) || {}
1075
- };
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;
1076
867
  }
1077
- getPropertiesMetadata(constructorFunc) {
1078
- throw new Error("暂未实现");
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;
1079
874
  }
1080
- }
1081
-
1082
- const taggedConstraint = key => value => {
1083
- const constraint = request => {
1084
- if (null == request) return !1;
1085
- if (request.key === key && request.value === value) return !0;
1086
- if (null == request.constructorArgsMetadata) return !1;
1087
- const constructorArgsMetadata = request.constructorArgsMetadata;
1088
- for (let i = 0; i < constructorArgsMetadata.length; i++) if (constructorArgsMetadata[i].key === key && constructorArgsMetadata[i].value === value) return !0;
1089
- return !1;
1090
- };
1091
- return constraint.metaData = new Metadata(key, value), constraint;
1092
- };
1093
- const namedConstraint = taggedConstraint(NAMED_TAG);
1094
-
1095
- class BindingInSyntax {
1096
- constructor(binding) {
1097
- this._binding = binding;
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;
1098
879
  }
1099
- inRequestScope() {
1100
- throw new Error("暂未实现");
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;
1101
883
  }
1102
- inSingletonScope() {
1103
- return this._binding.scope = BindingScopeEnum.Singleton, 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;
1104
886
  }
1105
- inTransientScope() {
1106
- return this._binding.scope = BindingScopeEnum.Transient, 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;
1107
891
  }
1108
- whenTargetNamed(name) {
1109
- return this._binding.constraint = namedConstraint(name), this;
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]);
1110
898
  }
1111
- }
1112
-
1113
- class BindingToSyntax {
1114
- constructor(binding) {
1115
- this._binding = 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]);
1116
906
  }
1117
- to(constructor) {
1118
- return this._binding.type = BindingTypeEnum.Instance, this._binding.implementationType = constructor, new BindingInSyntax(this._binding);
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
- toSelf() {
1121
- const self = this._binding.serviceIdentifier;
1122
- return this.to(self);
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;
1123
912
  }
1124
- toDynamicValue(func) {
1125
- return this._binding.type = BindingTypeEnum.DynamicValue, this._binding.cache = null, this._binding.dynamicValue = func, this._binding.implementationType = null, 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;
1126
915
  }
1127
- toConstantValue(value) {
1128
- 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);
916
+ alignsWith(b) {
917
+ return b && (this.x1 === b.x1 || this.x2 === b.x2 || this.y1 === b.y1 || this.y2 === b.y2);
1129
918
  }
1130
- toFactory(factory) {
1131
- return this._binding.type = BindingTypeEnum.Factory, this._binding.factory = factory, this._binding.scope = BindingScopeEnum.Singleton, new BindingInSyntax(this._binding);
919
+ intersects(b) {
920
+ return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2);
1132
921
  }
1133
- toService(service) {
1134
- this.toDynamicValue(context => context.container.get(service));
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);
1135
926
  }
1136
- }
1137
-
1138
- class Container {
1139
- constructor(containerOptions) {
1140
- const options = containerOptions || {};
1141
- options.defaultScope = options.defaultScope || BindingScopeEnum.Transient, this.options = options, this.id = Generator.GenAutoIncrementId(), this._bindingDictionary = new Map(), this._metadataReader = new MetadataReader();
927
+ containsPoint(p) {
928
+ return !(p.x < this.x1 || p.x > this.x2 || p.y < this.y1 || p.y > this.y2);
1142
929
  }
1143
- load(module) {
1144
- const containerModuleHelpers = this._getContainerModuleHelpersFactory()(module.id);
1145
- module.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction);
930
+ width() {
931
+ return this.empty() ? 0 : this.x2 - this.x1;
1146
932
  }
1147
- get(serviceIdentifier) {
1148
- const getArgs = this._getNotAllArgs(serviceIdentifier, !1);
1149
- return this._get(getArgs);
933
+ height() {
934
+ return this.empty() ? 0 : this.y2 - this.y1;
1150
935
  }
1151
- getAll(serviceIdentifier) {
1152
- const getArgs = this._getAllArgs(serviceIdentifier);
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
- getTagged(serviceIdentifier, key, value) {
1156
- const getArgs = this._getNotAllArgs(serviceIdentifier, !1, key, value);
1157
- return this._get(getArgs);
940
+ scaleY() {
941
+ let s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
942
+ return this.y1 *= s, this.y2 *= s, this;
1158
943
  }
1159
- getNamed(serviceIdentifier, named) {
1160
- return this.getTagged(serviceIdentifier, NAMED_TAG, named);
944
+ transformWithMatrix(matrix) {
945
+ return transformBoundsWithMatrix(this, this, matrix), this;
1161
946
  }
1162
- isBound(serviceIdentifier) {
1163
- return this._bindingDictionary.has(serviceIdentifier);
947
+ copy(b) {
948
+ return this.x1 = b.x1, this.y1 = b.y1, this.x2 = b.x2, this.y2 = b.y2, this;
1164
949
  }
1165
- bind(serviceIdentifier) {
1166
- const scope = this.options.defaultScope,
1167
- binding = new Binding(serviceIdentifier, scope),
1168
- list = this._bindingDictionary.get(serviceIdentifier) || [];
1169
- return list.push(binding), this._bindingDictionary.set(serviceIdentifier, list), new BindingToSyntax(binding);
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];
1170
962
  }
1171
- unbind(serviceIdentifier) {
1172
- this._bindingDictionary.delete(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];
1173
971
  }
1174
- rebind(serviceIdentifier) {
1175
- return this.unbind(serviceIdentifier), this.bind(serviceIdentifier);
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);
1176
979
  }
1177
- _getContainerModuleHelpersFactory() {
1178
- const setModuleId = (bindingToSyntax, moduleId) => {
1179
- bindingToSyntax._binding.moduleId = moduleId;
1180
- },
1181
- getBindFunction = moduleId => serviceIdentifier => {
1182
- const bindingToSyntax = this.bind(serviceIdentifier);
1183
- return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
1184
- },
1185
- getUnbindFunction = () => serviceIdentifier => this.unbind(serviceIdentifier),
1186
- getIsboundFunction = () => serviceIdentifier => this.isBound(serviceIdentifier),
1187
- getRebindFunction = moduleId => serviceIdentifier => {
1188
- const bindingToSyntax = this.rebind(serviceIdentifier);
1189
- return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
1190
- };
1191
- return mId => ({
1192
- bindFunction: getBindFunction(mId),
1193
- isboundFunction: getIsboundFunction(),
1194
- rebindFunction: getRebindFunction(mId),
1195
- unbindFunction: getUnbindFunction(),
1196
- unbindAsyncFunction: serviceIdentifier => null
1197
- });
980
+ intersects(b) {
981
+ return isRotateAABBIntersect(this, b);
1198
982
  }
1199
- _getNotAllArgs(serviceIdentifier, isMultiInject, key, value) {
1200
- return {
1201
- avoidConstraints: !1,
1202
- isMultiInject: isMultiInject,
1203
- serviceIdentifier: serviceIdentifier,
1204
- key: key,
1205
- value: value
1206
- };
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;
1207
990
  }
1208
- _getAllArgs(serviceIdentifier) {
1209
- return {
1210
- avoidConstraints: !0,
1211
- isMultiInject: !0,
1212
- serviceIdentifier: serviceIdentifier
1213
- };
991
+ clone() {
992
+ return new OBBBounds(this);
1214
993
  }
1215
- _get(getArgs) {
1216
- const result = [];
1217
- return this._bindingDictionary.get(getArgs.serviceIdentifier).filter(b => b.constraint(getArgs)).forEach(binding => {
1218
- result.push(this._resolveFromBinding(binding));
1219
- }), getArgs.isMultiInject || 1 !== result.length ? result : result[0];
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;
1220
1005
  }
1221
- _getChildRequest(binding) {
1222
- const constr = binding.implementationType,
1223
- {
1224
- userGeneratedMetadata: userGeneratedMetadata
1225
- } = this._metadataReader.getConstructorMetadata(constr),
1226
- keys = Object.keys(userGeneratedMetadata),
1227
- arr = [];
1228
- for (let i = 0; i < keys.length; i++) {
1229
- const constructorArgsMetadata = userGeneratedMetadata[i],
1230
- targetMetadataMap = {};
1231
- constructorArgsMetadata.forEach(md => {
1232
- targetMetadataMap[md.key] = md.value;
1233
- });
1234
- const metadata = {
1235
- inject: targetMetadataMap[INJECT_TAG],
1236
- multiInject: targetMetadataMap[MULTI_INJECT_TAG]
1237
- },
1238
- injectIdentifier = metadata.inject || metadata.multiInject,
1239
- target = {
1240
- serviceIdentifier: injectIdentifier,
1241
- constructorArgsMetadata: constructorArgsMetadata
1242
- },
1243
- request = {
1244
- injectIdentifier: injectIdentifier,
1245
- metadata: constructorArgsMetadata,
1246
- bindings: this._bindingDictionary.get(injectIdentifier).filter(b => b.constraint(target))
1247
- };
1248
- arr.push(request);
1249
- }
1250
- return arr;
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
- _resolveFromBinding(binding) {
1253
- const result = this._getResolvedFromBinding(binding);
1254
- return this._saveToScope(binding, result), 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);
1255
1011
  }
1256
- _getResolvedFromBinding(binding) {
1257
- let result;
1258
- switch (binding.type) {
1259
- case BindingTypeEnum.ConstantValue:
1260
- case BindingTypeEnum.Function:
1261
- result = binding.cache;
1262
- break;
1263
- case BindingTypeEnum.Instance:
1264
- result = this._resolveInstance(binding, binding.implementationType);
1265
- break;
1266
- default:
1267
- result = binding.dynamicValue({
1268
- container: this
1269
- });
1270
- }
1271
- return result;
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;
1272
1014
  }
1273
- _resolveInstance(binding, constr) {
1274
- if (binding.activated) return binding.cache;
1275
- const childRequests = this._getChildRequest(binding);
1276
- return this._createInstance(constr, childRequests);
1015
+ reset() {
1016
+ return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this;
1277
1017
  }
1278
- _createInstance(constr, childRequests) {
1279
- if (childRequests.length) {
1280
- return new constr(...this._resolveRequests(childRequests));
1281
- }
1282
- return new constr();
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;
1283
1028
  }
1284
- _resolveRequests(childRequests) {
1285
- return childRequests.map(request => request.bindings.length > 1 ? request.bindings.map(binding => this._resolveFromBinding(binding)) : this._resolveFromBinding(request.bindings[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;
1286
1037
  }
1287
- _saveToScope(binding, result) {
1288
- binding.scope === BindingScopeEnum.Singleton && (binding.cache = result, binding.activated = !0);
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;
1289
1050
  }
1290
- }
1291
-
1292
- const ContributionProvider = Symbol("ContributionProvider");
1293
- class ContributionProviderCache {
1294
- constructor(serviceIdentifier, container) {
1295
- this.serviceIdentifier = serviceIdentifier, this.container = container;
1051
+ scale(sx, sy) {
1052
+ return this.a *= sx, this.b *= sx, this.c *= sy, this.d *= sy, this;
1296
1053
  }
1297
- getContributions() {
1298
- return this.caches || (this.caches = [], this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier))), this.caches;
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;
1299
1056
  }
1300
- }
1301
- function bindContributionProvider(bind, id) {
1302
- bind(ContributionProvider).toDynamicValue(_ref => {
1303
- let {
1304
- container: container
1305
- } = _ref;
1306
- return new ContributionProviderCache(id, container);
1307
- }).inSingletonScope().whenTargetNamed(id);
1308
- }
1309
-
1310
- class Hook {
1311
- constructor(args, name) {
1312
- this._args = args, this.name = name, this.taps = [];
1057
+ transform(a, b, c, d, e, f) {
1058
+ return this.multiply(a, b, c, d, e, f), this;
1313
1059
  }
1314
- tap(options, fn) {
1315
- this._tap("sync", options, 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
- unTap(options, fn) {
1318
- const name = "string" == typeof options ? options.trim() : options.name;
1319
- name && (this.taps = this.taps.filter(tap => !(tap.name === name && (!fn || tap.fn === fn))));
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;
1320
1073
  }
1321
- _parseOptions(type, options, fn) {
1322
- let _options;
1323
- if ("string" == typeof options) _options = {
1324
- name: options.trim()
1325
- };else if ("object" != typeof options || null === options) throw new Error("Invalid tap options");
1326
- if ("string" != typeof _options.name || "" === _options.name) throw new Error("Missing name for tap");
1327
- return _options = Object.assign({
1328
- type: type,
1329
- fn: fn
1330
- }, _options), _options;
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;
1331
1086
  }
1332
- _tap(type, options, fn) {
1333
- this._insert(this._parseOptions(type, options, fn));
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;
1334
1090
  }
1335
- _insert(item) {
1336
- let before;
1337
- "string" == typeof item.before ? before = new Set([item.before]) : Array.isArray(item.before) && (before = new Set(item.before));
1338
- let stage = 0;
1339
- "number" == typeof item.stage && (stage = item.stage);
1340
- let i = this.taps.length;
1341
- for (; i > 0;) {
1342
- i--;
1343
- const x = this.taps[i];
1344
- this.taps[i + 1] = x;
1345
- const xStage = x.stage || 0;
1346
- if (before) {
1347
- if (before.has(x.name)) {
1348
- before.delete(x.name);
1349
- continue;
1350
- }
1351
- if (before.size > 0) continue;
1352
- }
1353
- if (!(xStage > stage)) {
1354
- i++;
1355
- break;
1356
- }
1357
- }
1358
- this.taps[i] = item;
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;
1359
1112
  }
1360
- }
1361
-
1362
- class SyncHook extends Hook {
1363
- call() {
1364
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1365
- args[_key] = arguments[_key];
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;
1366
1141
  }
1367
- this.taps.map(t => t.fn).forEach(cb => cb(...args));
1142
+ return result.rotateDeg = radianToDegree(result.rotateDeg), result;
1368
1143
  }
1369
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
+ }
1370
1164
 
1371
- const EnvContribution = Symbol.for("EnvContribution");
1372
- 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";
1373
-
1374
- var MeasureModeEnum;
1375
- !function (MeasureModeEnum) {
1376
- MeasureModeEnum[MeasureModeEnum.estimate = 0] = "estimate", MeasureModeEnum[MeasureModeEnum.actualBounding = 1] = "actualBounding", MeasureModeEnum[MeasureModeEnum.fontBounding = 2] = "fontBounding";
1377
- }(MeasureModeEnum || (MeasureModeEnum = {}));
1378
-
1379
- const isType = (value, type) => Object.prototype.toString.call(value) === `[object ${type}]`;
1380
- var isType$1 = isType;
1381
-
1382
- const isBoolean = function (value) {
1383
- let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
1384
- return fuzzy ? "boolean" == typeof value : !0 === value || !1 === value || isType$1(value, "Boolean");
1385
- };
1386
- var isBoolean$1 = isBoolean;
1387
-
1388
- const isFunction = value => "function" == typeof value;
1389
- var isFunction$1 = isFunction;
1390
-
1391
- const isNil = value => null == value;
1392
- var isNil$1 = isNil;
1393
-
1394
- const isValid = value => null != value;
1395
- var isValid$1 = isValid;
1396
-
1397
- const isObject = value => {
1398
- const type = typeof value;
1399
- return null !== value && "object" === type || "function" === type;
1400
- };
1401
- var isObject$1 = isObject;
1402
-
1403
- const isObjectLike = value => "object" == typeof value && null !== value;
1404
- var isObjectLike$1 = isObjectLike;
1405
-
1406
- const isPlainObject = function (value) {
1407
- if (!isObjectLike$1(value) || !isType$1(value, "Object")) return !1;
1408
- if (null === Object.getPrototypeOf(value)) return !0;
1409
- let proto = value;
1410
- for (; null !== Object.getPrototypeOf(proto);) proto = Object.getPrototypeOf(proto);
1411
- return Object.getPrototypeOf(value) === proto;
1412
- };
1413
- var isPlainObject$1 = isPlainObject;
1414
-
1415
- const isString = function (value) {
1416
- let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
1417
- const type = typeof value;
1418
- return fuzzy ? "string" === type : "string" === type || isType$1(value, "String");
1419
- };
1420
- var isString$1 = isString;
1421
-
1422
- const isArray = value => Array.isArray ? Array.isArray(value) : isType$1(value, "Array");
1423
- var isArray$1 = isArray;
1424
-
1425
- const isArrayLike = function (value) {
1426
- return null !== value && "function" != typeof value && Number.isFinite(value.length);
1427
- };
1428
- var isArrayLike$1 = isArrayLike;
1429
-
1430
- const isNumber = function (value) {
1431
- let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
1432
- const type = typeof value;
1433
- return fuzzy ? "number" === type : "number" === type || isType$1(value, "Number");
1434
- };
1435
- var isNumber$1 = isNumber;
1436
-
1437
- const isValidNumber = value => isNumber$1(value) && Number.isFinite(value);
1438
- var isValidNumber$1 = isValidNumber;
1439
-
1440
- const isValidUrl = value => new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(value);
1441
- var isValidUrl$1 = isValidUrl;
1442
-
1443
- 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);
1444
- var isBase64$1 = isBase64;
1445
-
1446
- const getType = value => ({}).toString.call(value).replace(/^\[object /, "").replace(/]$/, "");
1447
- var getType$1 = getType;
1448
-
1449
- const objectProto = Object.prototype,
1450
- isPrototype = function (value) {
1451
- const Ctor = value && value.constructor;
1452
- 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
1453
1177
  };
1454
- var isPrototype$1 = isPrototype;
1178
+ }
1455
1179
 
1456
- const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
1457
- function isEmpty(value) {
1458
- if (isNil$1(value)) return !0;
1459
- if (isArrayLike$1(value)) return !value.length;
1460
- const type = getType$1(value);
1461
- if ("Map" === type || "Set" === type) return !value.size;
1462
- if (isPrototype$1(value)) return !Object.keys(value).length;
1463
- for (const key in value) if (hasOwnProperty$1.call(value, key)) return !1;
1464
- 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
+ };
1465
1193
  }
1466
1194
 
1467
- const hasOwnProperty = Object.prototype.hasOwnProperty,
1468
- has = (object, key) => null != object && hasOwnProperty.call(object, key);
1469
- var has$1 = has;
1470
-
1471
- function baseMerge(target, source) {
1472
- let shallowArray = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
1473
- let skipTargetArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
1474
- if (source) {
1475
- if (target === source) return;
1476
- if (isValid$1(source) && "object" == typeof source) {
1477
- const iterable = Object(source),
1478
- props = [];
1479
- for (const key in iterable) props.push(key);
1480
- let {
1481
- length: length
1482
- } = props,
1483
- propIndex = -1;
1484
- for (; length--;) {
1485
- const key = props[++propIndex];
1486
- !isValid$1(iterable[key]) || "object" != typeof iterable[key] || skipTargetArray && isArray$1(target[key]) ? assignMergeValue(target, key, iterable[key]) : baseMergeDeep(target, source, key, shallowArray, skipTargetArray);
1487
- }
1488
- }
1489
- }
1490
- }
1491
- function baseMergeDeep(target, source, key) {
1492
- let shallowArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
1493
- let skipTargetArray = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
1494
- const objValue = target[key],
1495
- srcValue = source[key];
1496
- let newValue = source[key],
1497
- isCommon = !0;
1498
- if (isArray$1(srcValue)) {
1499
- if (shallowArray) newValue = [];else if (isArray$1(objValue)) newValue = objValue;else if (isArrayLike$1(objValue)) {
1500
- newValue = new Array(objValue.length);
1501
- let index = -1;
1502
- const length = objValue.length;
1503
- for (; ++index < length;) newValue[index] = objValue[index];
1504
- }
1505
- } else isPlainObject$1(srcValue) ? (newValue = null != objValue ? objValue : {}, "function" != typeof objValue && "object" == typeof objValue || (newValue = {})) : isCommon = !1;
1506
- isCommon && baseMerge(newValue, srcValue, shallowArray, skipTargetArray), assignMergeValue(target, key, newValue);
1507
- }
1508
- function assignMergeValue(target, key, value) {
1509
- (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);
1510
1351
  }
1511
- function eq(value, other) {
1512
- 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);
1513
1354
  }
1514
- function merge(target) {
1515
- let sourceIndex = -1;
1516
- const length = arguments.length <= 1 ? 0 : arguments.length - 1;
1517
- for (; ++sourceIndex < length;) {
1518
- baseMerge(target, sourceIndex + 1 < 1 || arguments.length <= sourceIndex + 1 ? undefined : arguments[sourceIndex + 1], !0);
1519
- }
1520
- 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);
1521
1357
  }
1522
-
1523
- function arrayEqual(a, b) {
1524
- if (!isArray$1(a) || !isArray$1(b)) return !1;
1525
- if (a.length !== b.length) return !1;
1526
- for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return !1;
1527
- return !0;
1358
+ function SRGBToLinear(c) {
1359
+ return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
1528
1360
  }
1529
-
1530
- const hasConsole = "undefined" != typeof console;
1531
- function log(method, level, input) {
1532
- const args = [level].concat([].slice.call(input));
1533
- hasConsole && console[method].apply(console, args);
1361
+ function LinearToSRGB(c) {
1362
+ return c < .0031308 ? 12.92 * c : 1.055 * Math.pow(c, .41666) - .055;
1534
1363
  }
1535
- var LoggerLevel;
1536
- !function (LoggerLevel) {
1537
- 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";
1538
- }(LoggerLevel || (LoggerLevel = {}));
1539
- class Logger {
1540
- static getInstance(level, method) {
1541
- return Logger._instance && isNumber$1(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
1542
- }
1543
- static setInstance(logger) {
1544
- return Logger._instance = logger;
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;
1545
1370
  }
1546
- static setInstanceLevel(level) {
1547
- Logger._instance ? Logger._instance.level(level) : Logger._instance = new Logger(level);
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();
1548
1376
  }
1549
- static clearInstance() {
1550
- Logger._instance = null;
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();
1551
1380
  }
1552
- constructor() {
1553
- let level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : LoggerLevel.None;
1554
- let method = arguments.length > 1 ? arguments[1] : undefined;
1555
- this._onErrorHandler = [], this._level = level, this._method = method;
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
+ }
1556
1397
  }
1557
- addErrorHandler(handler) {
1558
- this._onErrorHandler.find(h => h === handler) || this._onErrorHandler.push(handler);
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]));
1412
+ }
1559
1413
  }
1560
- removeErrorHandler(handler) {
1561
- const index = this._onErrorHandler.findIndex(h => h === handler);
1562
- index < 0 || this._onErrorHandler.splice(index, 1);
1414
+ constructor(value) {
1415
+ const color = Color.parseColorString(value);
1416
+ color ? this.color = color : (this.color = new RGB(255, 255, 255));
1563
1417
  }
1564
- callErrorHandler() {
1565
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1566
- args[_key] = arguments[_key];
1567
- }
1568
- this._onErrorHandler.forEach(h => h(...args));
1418
+ toRGBA() {
1419
+ return this.color.formatRgb();
1569
1420
  }
1570
- canLogInfo() {
1571
- return this._level >= LoggerLevel.Info;
1421
+ toString() {
1422
+ return this.color.formatRgb();
1572
1423
  }
1573
- canLogDebug() {
1574
- return this._level >= LoggerLevel.Debug;
1424
+ toHex() {
1425
+ return this.color.formatHex();
1575
1426
  }
1576
- canLogError() {
1577
- return this._level >= LoggerLevel.Error;
1427
+ toHsl() {
1428
+ return this.color.formatHsl();
1578
1429
  }
1579
- canLogWarn() {
1580
- return this._level >= LoggerLevel.Warn;
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;
1581
1437
  }
1582
- level(levelValue) {
1583
- return arguments.length ? (this._level = +levelValue, this) : this._level;
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;
1584
1445
  }
1585
- error() {
1586
- var _a;
1587
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1588
- args[_key2] = arguments[_key2];
1589
- }
1590
- return this._level >= LoggerLevel.Error && (this._onErrorHandler.length ? this.callErrorHandler(...args) : log(null !== (_a = this._method) && void 0 !== _a ? _a : "error", "ERROR", 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;
1591
1448
  }
1592
- warn() {
1593
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1594
- args[_key3] = arguments[_key3];
1595
- }
1596
- return this._level >= LoggerLevel.Warn && log(this._method || "warn", "WARN", 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;
1597
1456
  }
1598
- info() {
1599
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
1600
- args[_key4] = arguments[_key4];
1601
- }
1602
- return this._level >= LoggerLevel.Info && log(this._method || "log", "INFO", args), this;
1457
+ getHSVBrightness() {
1458
+ return Math.max(this.color.r, this.color.g, this.color.b) / 255;
1603
1459
  }
1604
- debug() {
1605
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
1606
- args[_key5] = arguments[_key5];
1607
- }
1608
- return this._level >= LoggerLevel.Debug && log(this._method || "log", "DEBUG", args), this;
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);
1609
1462
  }
1610
- }
1611
- Logger._instance = null;
1612
-
1613
- const clamp = function (input, min, max) {
1614
- return input < min ? min : input > max ? max : input;
1615
- };
1616
- var clamp$1 = clamp;
1617
-
1618
- const epsilon = 1e-12;
1619
- const pi = Math.PI;
1620
- const halfPi$1 = pi / 2;
1621
- const tau = 2 * pi;
1622
- const pi2 = 2 * Math.PI;
1623
- const abs = Math.abs;
1624
- const atan2 = Math.atan2;
1625
- const cos = Math.cos;
1626
- const max = Math.max;
1627
- const min = Math.min;
1628
- const sin = Math.sin;
1629
- const sqrt = Math.sqrt;
1630
- const pow = Math.pow;
1631
- function asin(x) {
1632
- return x >= 1 ? halfPi$1 : x <= -1 ? -halfPi$1 : Math.asin(x);
1633
- }
1634
-
1635
- class Point {
1636
- constructor() {
1637
- let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1638
- let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1639
- let x1 = arguments.length > 2 ? arguments[2] : undefined;
1640
- let y1 = arguments.length > 3 ? arguments[3] : undefined;
1641
- this.x = 0, this.y = 0, this.x = x, this.y = y, this.x1 = x1, this.y1 = y1;
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;
1642
1468
  }
1643
- clone() {
1644
- return new Point(this.x, this.y);
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;
1645
1471
  }
1646
- copyFrom(p) {
1647
- 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;
1472
+ setHex(value) {
1473
+ const formatValue = `${value}`.trim().toLowerCase(),
1474
+ res = setHex(formatValue, !0);
1475
+ return null != res ? res : this;
1648
1476
  }
1649
- set(x, y) {
1650
- return this.x = x, this.y = y, this;
1477
+ setColorName(name) {
1478
+ const hex = DEFAULT_COLORS[name.toLowerCase()];
1479
+ return void 0 !== hex ? this.setHex(hex) : (void 0), this;
1651
1480
  }
1652
- add(point) {
1653
- return isNumber$1(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
1481
+ setScalar(scalar) {
1482
+ return this.color.r = scalar, this.color.g = scalar, this.color.b = scalar, this;
1654
1483
  }
1655
- sub(point) {
1656
- return isNumber$1(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
1484
+ setOpacity() {
1485
+ let o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
1486
+ return this.color.opacity = o, this;
1657
1487
  }
1658
- multi(point) {
1659
- throw new Error("暂不支持");
1488
+ getLuminance() {
1489
+ return (.2126 * this.color.r + .7152 * this.color.g + .0722 * this.color.b) / 255;
1660
1490
  }
1661
- div(point) {
1662
- throw new Error("暂不支持");
1491
+ getLuminance2() {
1492
+ return (.2627 * this.color.r + .678 * this.color.g + .0593 * this.color.b) / 255;
1663
1493
  }
1664
- }
1665
- class PointService {
1666
- static distancePP(p1, p2) {
1667
- return sqrt(pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2));
1494
+ getLuminance3() {
1495
+ return (.299 * this.color.r + .587 * this.color.g + .114 * this.color.b) / 255;
1668
1496
  }
1669
- static distanceNN(x, y, x1, y1) {
1670
- return sqrt(pow(x - x1, 2) + pow(y - y1, 2));
1497
+ clone() {
1498
+ return new Color(this.color.toString());
1671
1499
  }
1672
- static distancePN(point, x, y) {
1673
- return sqrt(pow(x - point.x, 2) + pow(y - point.y, 2));
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;
1674
1503
  }
1675
- static pointAtPP(p1, p2, t) {
1676
- return new Point((p2.x - p1.x) * t + p1.x, (p2.y - p1.y) * t + p1.y);
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;
1677
1526
  }
1678
1527
  }
1679
-
1680
- function degreeToRadian(degree) {
1681
- return degree * (Math.PI / 180);
1682
- }
1683
- function radianToDegree(radian) {
1684
- return 180 * radian / Math.PI;
1685
- }
1686
- const clampRadian = function () {
1687
- let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1688
- if (angle < 0) for (; angle < -tau;) angle += tau;else if (angle > 0) for (; angle > tau;) angle -= tau;
1689
- return angle;
1690
- };
1691
- const clampAngleByRadian = clampRadian;
1692
-
1693
- var InnerBBox;
1694
- !function (InnerBBox) {
1695
- InnerBBox[InnerBBox.NONE = 0] = "NONE", InnerBBox[InnerBBox.BBOX1 = 1] = "BBOX1", InnerBBox[InnerBBox.BBOX2 = 2] = "BBOX2";
1696
- }(InnerBBox || (InnerBBox = {}));
1697
- function getProjectionRadius(checkAxis, axis) {
1698
- return Math.abs(axis[0] * checkAxis[0] + axis[1] * checkAxis[1]);
1699
- }
1700
- function rotatePoint(_ref, rad) {
1701
- let {
1702
- x: x,
1703
- y: y
1704
- } = _ref;
1705
- let origin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
1706
- x: 0,
1707
- y: 0
1708
- };
1709
- return {
1710
- x: (x - origin.x) * Math.cos(rad) - (y - origin.y) * Math.sin(rad) + origin.x,
1711
- y: (x - origin.x) * Math.sin(rad) + (y - origin.y) * Math.cos(rad) + origin.y
1712
- };
1713
- }
1714
- function getCenterPoint(box) {
1715
- return {
1716
- x: (box.x1 + box.x2) / 2,
1717
- y: (box.y1 + box.y2) / 2
1718
- };
1719
- }
1720
- function toRect(box, isDeg) {
1721
- const deg = isDeg ? degreeToRadian(box.angle) : box.angle,
1722
- cp = getCenterPoint(box);
1723
- return [rotatePoint({
1724
- x: box.x1,
1725
- y: box.y1
1726
- }, deg, cp), rotatePoint({
1727
- x: box.x2,
1728
- y: box.y1
1729
- }, deg, cp), rotatePoint({
1730
- x: box.x2,
1731
- y: box.y2
1732
- }, deg, cp), rotatePoint({
1733
- x: box.x1,
1734
- y: box.y2
1735
- }, deg, cp)];
1736
- }
1737
- function isRotateAABBIntersect(box1, box2) {
1738
- let isDeg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
1739
- const rect1 = toRect(box1, isDeg),
1740
- rect2 = toRect(box2, isDeg),
1741
- vector = (start, end) => [end.x - start.x, end.y - start.y],
1742
- vp1p2 = vector(getCenterPoint(box1), getCenterPoint(box2)),
1743
- AB = vector(rect1[0], rect1[1]),
1744
- BC = vector(rect1[1], rect1[2]),
1745
- A1B1 = vector(rect2[0], rect2[1]),
1746
- B1C1 = vector(rect2[1], rect2[2]),
1747
- deg11 = isDeg ? degreeToRadian(box1.angle) : box1.angle;
1748
- let deg12 = isDeg ? degreeToRadian(90 - box1.angle) : box1.angle + halfPi$1;
1749
- const deg21 = isDeg ? degreeToRadian(box2.angle) : box2.angle;
1750
- let deg22 = isDeg ? degreeToRadian(90 - box2.angle) : box2.angle + halfPi$1;
1751
- deg12 > pi2 && (deg12 -= pi2), deg22 > pi2 && (deg22 -= pi2);
1752
- const isCover = (checkAxisRadius, deg, targetAxis1, targetAxis2) => {
1753
- const checkAxis = [Math.cos(deg), Math.sin(deg)];
1754
- return checkAxisRadius + (getProjectionRadius(checkAxis, targetAxis1) + getProjectionRadius(checkAxis, targetAxis2)) / 2 > getProjectionRadius(checkAxis, vp1p2);
1755
- };
1756
- 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);
1757
- }
1758
-
1759
- function getContextFont(text) {
1760
- let defaultAttr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1761
- let fontSizeScale = arguments.length > 2 ? arguments[2] : undefined;
1762
- fontSizeScale || (fontSizeScale = 1);
1763
- const {
1764
- fontStyle = defaultAttr.fontStyle,
1765
- fontVariant = defaultAttr.fontVariant,
1766
- fontWeight = defaultAttr.fontWeight,
1767
- fontSize = defaultAttr.fontSize,
1768
- fontFamily = defaultAttr.fontFamily
1769
- } = text;
1770
- return (fontStyle ? fontStyle + " " : "") + (fontVariant ? fontVariant + " " : "") + (fontWeight ? fontWeight + " " : "") + fontSize * fontSizeScale + "px " + (fontFamily || "sans-serif");
1771
- }
1772
-
1773
- const calculateAnchorOfBounds = (bounds, anchorType) => {
1774
- const {
1775
- x1: x1,
1776
- x2: x2,
1777
- y1: y1,
1778
- y2: y2
1779
- } = bounds,
1780
- rectWidth = Math.abs(x2 - x1),
1781
- rectHeight = Math.abs(y2 - y1);
1782
- let anchorX = (x1 + x2) / 2,
1783
- anchorY = (y1 + y2) / 2,
1784
- sx = 0,
1785
- sy = 0;
1786
- switch (anchorType) {
1787
- case "top":
1788
- case "inside-top":
1789
- sy = -.5;
1790
- break;
1791
- case "bottom":
1792
- case "inside-bottom":
1793
- sy = .5;
1794
- break;
1795
- case "left":
1796
- case "inside-left":
1797
- sx = -.5;
1798
- break;
1799
- case "right":
1800
- case "inside-right":
1801
- sx = .5;
1802
- break;
1803
- case "top-right":
1804
- sx = .5, sy = -.5;
1805
- break;
1806
- case "top-left":
1807
- sx = -.5, sy = -.5;
1808
- break;
1809
- case "bottom-right":
1810
- sx = .5, sy = .5;
1811
- break;
1812
- case "bottom-left":
1813
- sx = -.5, sy = .5;
1814
- }
1815
- return anchorX += sx * rectWidth, anchorY += sy * rectHeight, {
1816
- x: anchorX,
1817
- y: anchorY
1818
- };
1819
- };
1820
-
1821
- function transformBoundsWithMatrix(out, bounds, matrix) {
1822
- const {
1823
- x1: x1,
1824
- y1: y1,
1825
- x2: x2,
1826
- y2: y2
1827
- } = bounds;
1828
- 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);
1829
- }
1830
- class Bounds {
1831
- constructor(bounds) {
1832
- bounds ? this.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2) : this.clear();
1833
- }
1834
- clone() {
1835
- return new Bounds(this);
1836
- }
1837
- clear() {
1838
- return this.x1 = +Number.MAX_VALUE, this.y1 = +Number.MAX_VALUE, this.x2 = -Number.MAX_VALUE, this.y2 = -Number.MAX_VALUE, this;
1839
- }
1840
- empty() {
1841
- return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE;
1842
- }
1843
- equals(b) {
1844
- return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2;
1845
- }
1846
- setValue() {
1847
- let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1848
- let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1849
- let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1850
- let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1851
- return this.x1 = x1, this.y1 = y1, this.x2 = x2, this.y2 = y2, this;
1852
- }
1853
- set() {
1854
- let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1855
- let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1856
- let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1857
- let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1858
- 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;
1859
- }
1860
- add() {
1861
- let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1862
- let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1863
- 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;
1864
- }
1865
- expand() {
1866
- let d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1867
- 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;
1868
- }
1869
- round() {
1870
- 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;
1871
- }
1872
- translate() {
1873
- let dx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1874
- let dy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1875
- return this.x1 += dx, this.x2 += dx, this.y1 += dy, this.y2 += dy, this;
1876
- }
1877
- rotate() {
1878
- let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1879
- let x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1880
- let y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1881
- const p = this.rotatedPoints(angle, x, y);
1882
- return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]);
1883
- }
1884
- scale() {
1885
- let sx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1886
- let sy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1887
- let x = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1888
- let y = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1889
- const p = this.scalePoints(sx, sy, x, y);
1890
- 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;
1891
1531
  }
1892
- union(b) {
1893
- 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))}`;
1894
1534
  }
1895
- intersect(b) {
1896
- 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})`}`;
1897
1538
  }
1898
- encloses(b) {
1899
- 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})`}`;
1900
1547
  }
1901
- alignsWith(b) {
1902
- return b && (this.x1 === b.x1 || this.x2 === b.x2 || this.y1 === b.y1 || this.y2 === b.y2);
1548
+ toString() {
1549
+ return this.formatHex();
1903
1550
  }
1904
- intersects(b) {
1905
- 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;
1906
1570
  }
1907
- contains() {
1908
- let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1909
- let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1910
- return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2);
1911
- }
1912
- containsPoint(p) {
1913
- return !(p.x < this.x1 || p.x > this.x2 || p.y < this.y1 || p.y > this.y2);
1914
- }
1915
- width() {
1916
- return this.empty() ? 0 : this.x2 - this.x1;
1917
- }
1918
- height() {
1919
- return this.empty() ? 0 : this.y2 - this.y1;
1920
- }
1921
- scaleX() {
1922
- let s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1923
- return this.x1 *= s, this.x2 *= s, this;
1924
- }
1925
- scaleY() {
1926
- let s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1927
- return this.y1 *= s, this.y2 *= s, this;
1928
- }
1929
- transformWithMatrix(matrix) {
1930
- return transformBoundsWithMatrix(this, this, matrix), this;
1931
- }
1932
- copy(b) {
1933
- return this.x1 = b.x1, this.y1 = b.y1, this.x2 = b.x2, this.y2 = b.y2, this;
1934
- }
1935
- rotatedPoints(angle, x, y) {
1936
- const {
1937
- x1: x1,
1938
- y1: y1,
1939
- x2: x2,
1940
- y2: y2
1941
- } = this,
1942
- cos = Math.cos(angle),
1943
- sin = Math.sin(angle),
1944
- cx = x - x * cos + y * sin,
1945
- cy = y - x * sin - y * cos;
1946
- 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];
1947
- }
1948
- scalePoints(sx, sy, x, y) {
1949
- const {
1950
- x1: x1,
1951
- y1: y1,
1952
- x2: x2,
1953
- y2: y2
1954
- } = this;
1955
- return [sx * x1 + (1 - sx) * x, sy * y1 + (1 - sy) * y, sx * x2 + (1 - sx) * x, sy * y2 + (1 - sy) * y];
1956
- }
1957
- }
1958
- class AABBBounds extends Bounds {}
1959
- class OBBBounds extends Bounds {
1960
- constructor(bounds) {
1961
- let angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1962
- var _a;
1963
- super(bounds), bounds && (this.angle = null !== (_a = bounds.angle) && void 0 !== _a ? _a : angle);
1964
- }
1965
- intersects(b) {
1966
- return isRotateAABBIntersect(this, b);
1967
- }
1968
- setValue() {
1969
- let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1970
- let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1971
- let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1972
- let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1973
- let angle = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
1974
- return super.setValue(x1, y1, x2, y2), this.angle = angle, this;
1975
- }
1976
- clone() {
1977
- 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];
1978
1579
  }
1580
+ return [0, 0, 0, 0];
1979
1581
  }
1980
1582
 
1981
- class Matrix {
1982
- constructor() {
1983
- let a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
1984
- let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1985
- let c = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1986
- let d = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
1987
- let e = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
1988
- let f = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
1989
- this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f;
1990
- }
1991
- equalToMatrix(m2) {
1992
- 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);
1993
- }
1994
- equalTo(a, b, c, d, e, f) {
1995
- return !(this.e !== e || this.f !== f || this.a !== a || this.d !== d || this.b !== b || this.c !== c);
1996
- }
1997
- setValue(a, b, c, d, e, f) {
1998
- return this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f, this;
1999
- }
2000
- reset() {
2001
- return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this;
2002
- }
2003
- getInverse() {
2004
- const a = this.a,
2005
- b = this.b,
2006
- c = this.c,
2007
- d = this.d,
2008
- e = this.e,
2009
- f = this.f,
2010
- m = new Matrix(),
2011
- dt = a * d - b * c;
2012
- 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;
2013
- }
2014
- rotate(rad) {
2015
- const c = Math.cos(rad),
2016
- s = Math.sin(rad),
2017
- m11 = this.a * c + this.c * s,
2018
- m12 = this.b * c + this.d * s,
2019
- m21 = this.a * -s + this.c * c,
2020
- m22 = this.b * -s + this.d * c;
2021
- return this.a = m11, this.b = m12, this.c = m21, this.d = m22, this;
2022
- }
2023
- rotateByCenter(rad, cx, cy) {
2024
- const cos = Math.cos(rad),
2025
- sin = Math.sin(rad),
2026
- rotateM13 = (1 - cos) * cx + sin * cy,
2027
- rotateM23 = (1 - cos) * cy - sin * cx,
2028
- m11 = cos * this.a - sin * this.b,
2029
- m21 = sin * this.a + cos * this.b,
2030
- m12 = cos * this.c - sin * this.d,
2031
- m22 = sin * this.c + cos * this.d,
2032
- m13 = cos * this.e - sin * this.f + rotateM13,
2033
- m23 = sin * this.e + cos * this.f + rotateM23;
2034
- return this.a = m11, this.b = m21, this.c = m12, this.d = m22, this.e = m13, this.f = m23, this;
2035
- }
2036
- scale(sx, sy) {
2037
- return this.a *= sx, this.b *= sx, this.c *= sy, this.d *= sy, this;
2038
- }
2039
- setScale(sx, sy) {
2040
- return this.b = this.b / this.a * sx, this.c = this.c / this.d * sy, this.a = sx, this.d = sy, this;
2041
- }
2042
- transform(a, b, c, d, e, f) {
2043
- return this.multiply(a, b, c, d, e, f), this;
2044
- }
2045
- translate(x, y) {
2046
- return this.e += this.a * x + this.c * y, this.f += this.b * x + this.d * y, this;
2047
- }
2048
- transpose() {
2049
- const {
2050
- a: a,
2051
- b: b,
2052
- c: c,
2053
- d: d,
2054
- e: e,
2055
- f: f
2056
- } = this;
2057
- return this.a = b, this.b = a, this.c = d, this.d = c, this.e = f, this.f = e, this;
2058
- }
2059
- multiply(a2, b2, c2, d2, e2, f2) {
2060
- const a1 = this.a,
2061
- b1 = this.b,
2062
- c1 = this.c,
2063
- d1 = this.d,
2064
- m11 = a1 * a2 + c1 * b2,
2065
- m12 = b1 * a2 + d1 * b2,
2066
- m21 = a1 * c2 + c1 * d2,
2067
- m22 = b1 * c2 + d1 * d2,
2068
- dx = a1 * e2 + c1 * f2 + this.e,
2069
- dy = b1 * e2 + d1 * f2 + this.f;
2070
- return this.a = m11, this.b = m12, this.c = m21, this.d = m22, this.e = dx, this.f = dy, this;
2071
- }
2072
- interpolate(m2, t) {
2073
- const m = new Matrix();
2074
- 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;
2075
- }
2076
- transformPoint(source, target) {
2077
- const {
2078
- a: a,
2079
- b: b,
2080
- c: c,
2081
- d: d,
2082
- e: e,
2083
- f: f
2084
- } = this,
2085
- dt = a * d - b * c,
2086
- nextA = d / dt,
2087
- nextB = -b / dt,
2088
- nextC = -c / dt,
2089
- nextD = a / dt,
2090
- nextE = (c * f - d * e) / dt,
2091
- nextF = -(a * f - b * e) / dt,
2092
- {
2093
- x: x,
2094
- y: y
2095
- } = source;
2096
- target.x = x * nextA + y * nextC + nextE, target.y = x * nextB + y * nextD + nextF;
2097
- }
2098
- onlyTranslate() {
2099
- let scale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
2100
- return this.a === scale && 0 === this.b && 0 === this.c && this.d === scale;
2101
- }
2102
- clone() {
2103
- return new Matrix(this.a, this.b, this.c, this.d, this.e, this.f);
2104
- }
2105
- toTransformAttrs() {
2106
- const a = this.a,
2107
- b = this.b,
2108
- c = this.c,
2109
- d = this.d,
2110
- delta = a * d - b * c,
2111
- result = {
2112
- x: this.e,
2113
- y: this.f,
2114
- rotateDeg: 0,
2115
- scaleX: 0,
2116
- scaleY: 0,
2117
- skewX: 0,
2118
- skewY: 0
2119
- };
2120
- if (0 !== a || 0 !== b) {
2121
- const r = Math.sqrt(a * a + b * b);
2122
- 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;
2123
- } else if (0 !== c || 0 !== d) {
2124
- const s = Math.sqrt(c * c + d * d);
2125
- 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
+ }
2126
1594
  }
2127
- return result.rotateDeg = radianToDegree(result.rotateDeg), result;
2128
- }
2129
- }
2130
- function normalTransform(out, origin, x, y, scaleX, scaleY, angle, rotateCenter) {
2131
- const oa = origin.a,
2132
- ob = origin.b,
2133
- oc = origin.c,
2134
- od = origin.d,
2135
- oe = origin.e,
2136
- of = origin.f,
2137
- cosTheta = cos(angle),
2138
- sinTheta = sin(angle);
2139
- let rotateCenterX, rotateCenterY;
2140
- rotateCenter ? (rotateCenterX = rotateCenter[0], rotateCenterY = rotateCenter[1]) : (rotateCenterX = x, rotateCenterY = y);
2141
- const offsetX = rotateCenterX - x,
2142
- offsetY = rotateCenterY - y,
2143
- a1 = oa * cosTheta + oc * sinTheta,
2144
- b1 = ob * cosTheta + od * sinTheta,
2145
- c1 = oc * cosTheta - oa * sinTheta,
2146
- d1 = od * cosTheta - ob * sinTheta;
2147
- 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;
2148
- }
1595
+ }), res;
1596
+ };
1597
+ const lowerCamelCaseToMiddle = str => str.replace(/([A-Z])/g, "-$1").toLowerCase();
2149
1598
 
2150
- function hslToRgb(h, s, l) {
2151
- s /= 100, l /= 100;
2152
- const c = (1 - Math.abs(2 * l - 1)) * s,
2153
- x = c * (1 - Math.abs(h / 60 % 2 - 1)),
2154
- m = l - c / 2;
2155
- let r = 0,
2156
- g = 0,
2157
- b = 0;
2158
- 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)), {
2159
- r: r,
2160
- g: g,
2161
- 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;
2162
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;
2163
1721
  }
2164
1722
 
2165
- function rgbToHsl(r, g, b) {
2166
- r /= 255, g /= 255, b /= 255;
2167
- const cMin = Math.min(r, g, b),
2168
- cMax = Math.max(r, g, b),
2169
- delta = cMax - cMin;
2170
- let h = 0,
2171
- s = 0,
2172
- l = 0;
2173
- 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), {
2174
- h: h,
2175
- s: s,
2176
- l: l
2177
- };
1723
+ {
1724
+ reactIs.exports = requireReactIs_production_min();
2178
1725
  }
1726
+ var reactIsExports = reactIs.exports;
2179
1727
 
2180
- const REG_HEX = /^#([0-9a-f]{3,8})$/,
2181
- DEFAULT_COLORS_OPACITY = {
2182
- transparent: 4294967040
2183
- };
2184
- const DEFAULT_COLORS = {
2185
- aliceblue: 15792383,
2186
- antiquewhite: 16444375,
2187
- aqua: 65535,
2188
- aquamarine: 8388564,
2189
- azure: 15794175,
2190
- beige: 16119260,
2191
- bisque: 16770244,
2192
- black: 0,
2193
- blanchedalmond: 16772045,
2194
- blue: 255,
2195
- blueviolet: 9055202,
2196
- brown: 10824234,
2197
- burlywood: 14596231,
2198
- cadetblue: 6266528,
2199
- chartreuse: 8388352,
2200
- chocolate: 13789470,
2201
- coral: 16744272,
2202
- cornflowerblue: 6591981,
2203
- cornsilk: 16775388,
2204
- crimson: 14423100,
2205
- cyan: 65535,
2206
- darkblue: 139,
2207
- darkcyan: 35723,
2208
- darkgoldenrod: 12092939,
2209
- darkgray: 11119017,
2210
- darkgreen: 25600,
2211
- darkgrey: 11119017,
2212
- darkkhaki: 12433259,
2213
- darkmagenta: 9109643,
2214
- darkolivegreen: 5597999,
2215
- darkorange: 16747520,
2216
- darkorchid: 10040012,
2217
- darkred: 9109504,
2218
- darksalmon: 15308410,
2219
- darkseagreen: 9419919,
2220
- darkslateblue: 4734347,
2221
- darkslategray: 3100495,
2222
- darkslategrey: 3100495,
2223
- darkturquoise: 52945,
2224
- darkviolet: 9699539,
2225
- deeppink: 16716947,
2226
- deepskyblue: 49151,
2227
- dimgray: 6908265,
2228
- dimgrey: 6908265,
2229
- dodgerblue: 2003199,
2230
- firebrick: 11674146,
2231
- floralwhite: 16775920,
2232
- forestgreen: 2263842,
2233
- fuchsia: 16711935,
2234
- gainsboro: 14474460,
2235
- ghostwhite: 16316671,
2236
- gold: 16766720,
2237
- goldenrod: 14329120,
2238
- gray: 8421504,
2239
- green: 32768,
2240
- greenyellow: 11403055,
2241
- grey: 8421504,
2242
- honeydew: 15794160,
2243
- hotpink: 16738740,
2244
- indianred: 13458524,
2245
- indigo: 4915330,
2246
- ivory: 16777200,
2247
- khaki: 15787660,
2248
- lavender: 15132410,
2249
- lavenderblush: 16773365,
2250
- lawngreen: 8190976,
2251
- lemonchiffon: 16775885,
2252
- lightblue: 11393254,
2253
- lightcoral: 15761536,
2254
- lightcyan: 14745599,
2255
- lightgoldenrodyellow: 16448210,
2256
- lightgray: 13882323,
2257
- lightgreen: 9498256,
2258
- lightgrey: 13882323,
2259
- lightpink: 16758465,
2260
- lightsalmon: 16752762,
2261
- lightseagreen: 2142890,
2262
- lightskyblue: 8900346,
2263
- lightslategray: 7833753,
2264
- lightslategrey: 7833753,
2265
- lightsteelblue: 11584734,
2266
- lightyellow: 16777184,
2267
- lime: 65280,
2268
- limegreen: 3329330,
2269
- linen: 16445670,
2270
- magenta: 16711935,
2271
- maroon: 8388608,
2272
- mediumaquamarine: 6737322,
2273
- mediumblue: 205,
2274
- mediumorchid: 12211667,
2275
- mediumpurple: 9662683,
2276
- mediumseagreen: 3978097,
2277
- mediumslateblue: 8087790,
2278
- mediumspringgreen: 64154,
2279
- mediumturquoise: 4772300,
2280
- mediumvioletred: 13047173,
2281
- midnightblue: 1644912,
2282
- mintcream: 16121850,
2283
- mistyrose: 16770273,
2284
- moccasin: 16770229,
2285
- navajowhite: 16768685,
2286
- navy: 128,
2287
- oldlace: 16643558,
2288
- olive: 8421376,
2289
- olivedrab: 7048739,
2290
- orange: 16753920,
2291
- orangered: 16729344,
2292
- orchid: 14315734,
2293
- palegoldenrod: 15657130,
2294
- palegreen: 10025880,
2295
- paleturquoise: 11529966,
2296
- palevioletred: 14381203,
2297
- papayawhip: 16773077,
2298
- peachpuff: 16767673,
2299
- peru: 13468991,
2300
- pink: 16761035,
2301
- plum: 14524637,
2302
- powderblue: 11591910,
2303
- purple: 8388736,
2304
- rebeccapurple: 6697881,
2305
- red: 16711680,
2306
- rosybrown: 12357519,
2307
- royalblue: 4286945,
2308
- saddlebrown: 9127187,
2309
- salmon: 16416882,
2310
- sandybrown: 16032864,
2311
- seagreen: 3050327,
2312
- seashell: 16774638,
2313
- sienna: 10506797,
2314
- silver: 12632256,
2315
- skyblue: 8900331,
2316
- slateblue: 6970061,
2317
- slategray: 7372944,
2318
- slategrey: 7372944,
2319
- snow: 16775930,
2320
- springgreen: 65407,
2321
- steelblue: 4620980,
2322
- tan: 13808780,
2323
- teal: 32896,
2324
- thistle: 14204888,
2325
- tomato: 16737095,
2326
- turquoise: 4251856,
2327
- violet: 15631086,
2328
- wheat: 16113331,
2329
- white: 16777215,
2330
- whitesmoke: 16119285,
2331
- yellow: 16776960,
2332
- 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;
2333
1742
  };
2334
- function hex(value) {
2335
- 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
+ onSwitchStateChange: EVENT_TYPE.SWITCH_STATE_CHANGE,
1799
+ onAfterRender: EVENT_TYPE.AFTER_RENDER,
1800
+ onInitialized: EVENT_TYPE.INITIALIZED,
1801
+ onChangeCellValue: EVENT_TYPE.CHANGE_CELL_VALUE,
1802
+ onDragFillHandleEnd: EVENT_TYPE.DRAG_FILL_HANDLE_END,
1803
+ onMousedownFillHandle: EVENT_TYPE.MOUSEDOWN_FILL_HANDLE,
1804
+ onDblclickFillHandle: EVENT_TYPE.DBLCLICK_FILL_HANDLE,
1805
+ onPivotSortClick: EVENT_TYPE.PIVOT_SORT_CLICK,
1806
+ onDrillMenuClick: EVENT_TYPE.DRILLMENU_CLICK,
1807
+ onVChartEventType: EVENT_TYPE.VCHART_EVENT_TYPE,
1808
+ onChangCellValue: EVENT_TYPE.CHANGE_CELL_VALUE,
1809
+ onEmptyTipClick: EVENT_TYPE.EMPTY_TIP_CLICK,
1810
+ onEmptyTipDblClick: EVENT_TYPE.EMPTY_TIP_DBLCLICK,
1811
+ onButtonClick: EVENT_TYPE.BUTTON_CLICK
1812
+ };
1813
+ const TABLE_EVENTS_KEYS = Object.keys(TABLE_EVENTS);
1814
+ const findEventProps = (props, supportedEvents = TABLE_EVENTS) => {
1815
+ const result = {};
1816
+ Object.keys(props).forEach(key => {
1817
+ if (supportedEvents[key] && props[key]) {
1818
+ result[key] = props[key];
1819
+ }
1820
+ });
1821
+ return result;
1822
+ };
1823
+ const bindEventsToTable = (table, newProps, prevProps, supportedEvents = TABLE_EVENTS) => {
1824
+ if ((!newProps && !prevProps) || !table) {
1825
+ return false;
1826
+ }
1827
+ const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;
1828
+ const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;
1829
+ if (prevEventProps) {
1830
+ Object.keys(prevEventProps).forEach(eventKey => {
1831
+ if (!newEventProps ||
1832
+ !newEventProps[eventKey] ||
1833
+ newEventProps[eventKey] !== prevEventProps[eventKey]) {
1834
+ table.off(supportedEvents[eventKey], prevProps[eventKey]);
1835
+ }
1836
+ });
1837
+ }
1838
+ if (newEventProps) {
1839
+ Object.keys(newEventProps).forEach(eventKey => {
1840
+ if (!prevEventProps ||
1841
+ !prevEventProps[eventKey] ||
1842
+ prevEventProps[eventKey] !== newEventProps[eventKey]) {
1843
+ table.on(supportedEvents[eventKey], newEventProps[eventKey]);
1844
+ }
1845
+ });
1846
+ }
1847
+ return true;
1848
+ };
1849
+
1850
+ class Generator {
1851
+ static GenAutoIncrementId() {
1852
+ return Generator.auto_increment_id++;
1853
+ }
1854
+ }
1855
+ Generator.auto_increment_id = 0;
1856
+
1857
+ class ContainerModule {
1858
+ constructor(registry) {
1859
+ this.id = Generator.GenAutoIncrementId(), this.registry = registry;
1860
+ }
1861
+ }
1862
+
1863
+ const NAMED_TAG = "named";
1864
+ const INJECT_TAG = "inject";
1865
+ const MULTI_INJECT_TAG = "multi_inject";
1866
+ const TAGGED = "inversify:tagged";
1867
+ const PARAM_TYPES = "inversify:paramtypes";
1868
+
1869
+ class Metadata {
1870
+ constructor(key, value) {
1871
+ this.key = key, this.value = value;
1872
+ }
1873
+ toString() {
1874
+ return this.key === NAMED_TAG ? `named: ${String(this.value).toString()} ` : `tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`;
1875
+ }
1876
+ }
1877
+
1878
+ var Reflect$1 = (function (Reflect) {
1879
+ var target;
1880
+ return function (exporter) {
1881
+ const supportsSymbol = "function" == typeof Symbol,
1882
+ toPrimitiveSymbol = supportsSymbol && void 0 !== Symbol.toPrimitive ? Symbol.toPrimitive : "@@toPrimitive",
1883
+ functionPrototype = (Object.getPrototypeOf(Function)),
1884
+ _Map = ("object" == typeof process && process.env && process.env.REFLECT_METADATA_USE_MAP_POLYFILL, Map),
1885
+ Metadata = (new WeakMap());
1886
+ function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
1887
+ if (!IsObject(target)) throw new TypeError();
1888
+ return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
1889
+ }
1890
+ function hasMetadata(metadataKey, target, propertyKey) {
1891
+ if (!IsObject(target)) throw new TypeError();
1892
+ return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryHasMetadata(metadataKey, target, propertyKey);
1893
+ }
1894
+ function hasOwnMetadata(metadataKey, target, propertyKey) {
1895
+ if (!IsObject(target)) throw new TypeError();
1896
+ return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);
1897
+ }
1898
+ function getMetadata(metadataKey, target, propertyKey) {
1899
+ if (!IsObject(target)) throw new TypeError();
1900
+ return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryGetMetadata(metadataKey, target, propertyKey);
1901
+ }
1902
+ function GetOrCreateMetadataMap(O, P, Create) {
1903
+ let targetMetadata = Metadata.get(O);
1904
+ if (IsUndefined(targetMetadata)) {
1905
+ if (!Create) return;
1906
+ targetMetadata = new _Map(), Metadata.set(O, targetMetadata);
1907
+ }
1908
+ let metadataMap = targetMetadata.get(P);
1909
+ if (IsUndefined(metadataMap)) {
1910
+ if (!Create) return;
1911
+ metadataMap = new _Map(), targetMetadata.set(P, metadataMap);
1912
+ }
1913
+ return metadataMap;
1914
+ }
1915
+ function OrdinaryHasMetadata(MetadataKey, O, P) {
1916
+ if (OrdinaryHasOwnMetadata(MetadataKey, O, P)) return !0;
1917
+ const parent = OrdinaryGetPrototypeOf(O);
1918
+ return !IsNull(parent) && OrdinaryHasMetadata(MetadataKey, parent, P);
1919
+ }
1920
+ function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
1921
+ const metadataMap = GetOrCreateMetadataMap(O, P, !1);
1922
+ return !IsUndefined(metadataMap) && ToBoolean(metadataMap.has(MetadataKey));
1923
+ }
1924
+ function OrdinaryGetMetadata(MetadataKey, O, P) {
1925
+ if (OrdinaryHasOwnMetadata(MetadataKey, O, P)) return OrdinaryGetOwnMetadata(MetadataKey, O, P);
1926
+ const parent = OrdinaryGetPrototypeOf(O);
1927
+ return IsNull(parent) ? void 0 : OrdinaryGetMetadata(MetadataKey, parent, P);
1928
+ }
1929
+ function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
1930
+ const metadataMap = GetOrCreateMetadataMap(O, P, !1);
1931
+ if (!IsUndefined(metadataMap)) return metadataMap.get(MetadataKey);
1932
+ }
1933
+ function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
1934
+ GetOrCreateMetadataMap(O, P, !0).set(MetadataKey, MetadataValue);
1935
+ }
1936
+ function Type(x) {
1937
+ if (null === x) return 1;
1938
+ switch (typeof x) {
1939
+ case "undefined":
1940
+ return 0;
1941
+ case "boolean":
1942
+ return 2;
1943
+ case "string":
1944
+ return 3;
1945
+ case "symbol":
1946
+ return 4;
1947
+ case "number":
1948
+ return 5;
1949
+ case "object":
1950
+ return null === x ? 1 : 6;
1951
+ default:
1952
+ return 6;
1953
+ }
1954
+ }
1955
+ function IsUndefined(x) {
1956
+ return void 0 === x;
1957
+ }
1958
+ function IsNull(x) {
1959
+ return null === x;
1960
+ }
1961
+ function IsSymbol(x) {
1962
+ return "symbol" == typeof x;
1963
+ }
1964
+ function IsObject(x) {
1965
+ return "object" == typeof x ? null !== x : "function" == typeof x;
1966
+ }
1967
+ function ToPrimitive(input, PreferredType) {
1968
+ switch (Type(input)) {
1969
+ case 0:
1970
+ case 1:
1971
+ case 2:
1972
+ case 3:
1973
+ case 4:
1974
+ case 5:
1975
+ return input;
1976
+ }
1977
+ const hint = 3 === PreferredType ? "string" : 5 === PreferredType ? "number" : "default",
1978
+ exoticToPrim = GetMethod(input, toPrimitiveSymbol);
1979
+ if (void 0 !== exoticToPrim) {
1980
+ const result = exoticToPrim.call(input, hint);
1981
+ if (IsObject(result)) throw new TypeError();
1982
+ return result;
1983
+ }
1984
+ return OrdinaryToPrimitive(input, "default" === hint ? "number" : hint);
1985
+ }
1986
+ function OrdinaryToPrimitive(O, hint) {
1987
+ if ("string" === hint) {
1988
+ const toString_1 = O.toString;
1989
+ if (IsCallable(toString_1)) {
1990
+ const result = toString_1.call(O);
1991
+ if (!IsObject(result)) return result;
1992
+ }
1993
+ const valueOf = O.valueOf;
1994
+ if (IsCallable(valueOf)) {
1995
+ const result = valueOf.call(O);
1996
+ if (!IsObject(result)) return result;
1997
+ }
1998
+ } else {
1999
+ const valueOf = O.valueOf;
2000
+ if (IsCallable(valueOf)) {
2001
+ const result = valueOf.call(O);
2002
+ if (!IsObject(result)) return result;
2003
+ }
2004
+ const toString_2 = O.toString;
2005
+ if (IsCallable(toString_2)) {
2006
+ const result = toString_2.call(O);
2007
+ if (!IsObject(result)) return result;
2008
+ }
2009
+ }
2010
+ throw new TypeError();
2011
+ }
2012
+ function ToBoolean(argument) {
2013
+ return !!argument;
2014
+ }
2015
+ function ToString(argument) {
2016
+ return "" + argument;
2017
+ }
2018
+ function ToPropertyKey(argument) {
2019
+ const key = ToPrimitive(argument, 3);
2020
+ return IsSymbol(key) ? key : ToString(key);
2021
+ }
2022
+ function IsCallable(argument) {
2023
+ return "function" == typeof argument;
2024
+ }
2025
+ function GetMethod(V, P) {
2026
+ const func = V[P];
2027
+ if (null != func) {
2028
+ if (!IsCallable(func)) throw new TypeError();
2029
+ return func;
2030
+ }
2031
+ }
2032
+ function OrdinaryGetPrototypeOf(O) {
2033
+ const proto = Object.getPrototypeOf(O);
2034
+ if ("function" != typeof O || O === functionPrototype) return proto;
2035
+ if (proto !== functionPrototype) return proto;
2036
+ const prototype = O.prototype,
2037
+ prototypeProto = prototype && Object.getPrototypeOf(prototype);
2038
+ if (null == prototypeProto || prototypeProto === Object.prototype) return proto;
2039
+ const constructor = prototypeProto.constructor;
2040
+ return "function" != typeof constructor || constructor === O ? proto : constructor;
2041
+ }
2042
+ exporter("defineMetadata", defineMetadata), exporter("hasMetadata", hasMetadata), exporter("hasOwnMetadata", hasOwnMetadata), exporter("getMetadata", getMetadata);
2043
+ }((target = Reflect, function (key, value) {
2044
+ "function" != typeof target[key] && Object.defineProperty(target, key, {
2045
+ configurable: !0,
2046
+ writable: !0,
2047
+ value: value
2048
+ });
2049
+ })), Reflect;
2050
+ })({});
2051
+
2052
+ function _tagParameterOrProperty(metadataKey, annotationTarget, key, metadata) {
2053
+ const metadatas = [metadata];
2054
+ let paramsOrPropertiesMetadata = {};
2055
+ Reflect$1.hasOwnMetadata(metadataKey, annotationTarget) && (paramsOrPropertiesMetadata = Reflect$1.getMetadata(metadataKey, annotationTarget));
2056
+ let paramOrPropertyMetadata = paramsOrPropertiesMetadata[key];
2057
+ void 0 === paramOrPropertyMetadata && (paramOrPropertyMetadata = []), paramOrPropertyMetadata.push(...metadatas), paramsOrPropertiesMetadata[key] = paramOrPropertyMetadata, Reflect$1.defineMetadata(metadataKey, paramsOrPropertiesMetadata, annotationTarget);
2336
2058
  }
2337
- function rgb(value) {
2338
- 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);
2059
+ function tagParameter(annotationTarget, parameterName, parameterIndex, metadata) {
2060
+ _tagParameterOrProperty(TAGGED, annotationTarget, parameterIndex.toString(), metadata);
2339
2061
  }
2340
- function rgba(value) {
2341
- 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);
2062
+ function createTaggedDecorator(metadata) {
2063
+ return (target, targetKey, indexOrPropertyDescriptor) => {
2064
+ tagParameter(target, targetKey, indexOrPropertyDescriptor, metadata);
2065
+ };
2342
2066
  }
2343
- function SRGBToLinear(c) {
2344
- return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
2067
+ function injectBase(metadataKey) {
2068
+ return serviceIdentifier => (target, targetKey, indexOrPropertyDescriptor) => createTaggedDecorator(new Metadata(metadataKey, serviceIdentifier))(target, targetKey, indexOrPropertyDescriptor);
2345
2069
  }
2346
- function LinearToSRGB(c) {
2347
- return c < .0031308 ? 12.92 * c : 1.055 * Math.pow(c, .41666) - .055;
2070
+
2071
+ const inject = injectBase(INJECT_TAG);
2072
+
2073
+ function injectable() {
2074
+ return function (target) {
2075
+ return Reflect$1.defineMetadata(PARAM_TYPES, null, target), target;
2076
+ };
2348
2077
  }
2349
- const setHex = (formatValue, forceHex) => {
2350
- const isHex = REG_HEX.exec(formatValue);
2351
- if (forceHex || isHex) {
2352
- const hex = parseInt(isHex[1], 16),
2353
- hexLength = isHex[1].length;
2354
- 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;
2078
+
2079
+ function named(name) {
2080
+ return createTaggedDecorator(new Metadata(NAMED_TAG, name));
2081
+ }
2082
+
2083
+ const BindingScopeEnum = {
2084
+ Singleton: "Singleton",
2085
+ Transient: "Transient"
2086
+ },
2087
+ BindingTypeEnum = {
2088
+ ConstantValue: "ConstantValue",
2089
+ Constructor: "Constructor",
2090
+ DynamicValue: "DynamicValue",
2091
+ Factory: "Factory",
2092
+ Function: "Function",
2093
+ Instance: "Instance",
2094
+ Invalid: "Invalid",
2095
+ Provider: "Provider"
2096
+ };
2097
+
2098
+ class Binding {
2099
+ constructor(serviceIdentifier, scope) {
2100
+ 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;
2355
2101
  }
2102
+ clone() {
2103
+ const clone = new Binding(this.serviceIdentifier, this.scope);
2104
+ 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;
2105
+ }
2106
+ }
2107
+
2108
+ class MetadataReader {
2109
+ getConstructorMetadata(constructorFunc) {
2110
+ return {
2111
+ compilerGeneratedMetadata: Reflect$1.getMetadata(PARAM_TYPES, constructorFunc),
2112
+ userGeneratedMetadata: Reflect$1.getMetadata(TAGGED, constructorFunc) || {}
2113
+ };
2114
+ }
2115
+ getPropertiesMetadata(constructorFunc) {
2116
+ throw new Error("暂未实现");
2117
+ }
2118
+ }
2119
+
2120
+ const taggedConstraint = key => value => {
2121
+ const constraint = request => {
2122
+ if (null == request) return !1;
2123
+ if (request.key === key && request.value === value) return !0;
2124
+ if (null == request.constructorArgsMetadata) return !1;
2125
+ const constructorArgsMetadata = request.constructorArgsMetadata;
2126
+ for (let i = 0; i < constructorArgsMetadata.length; i++) if (constructorArgsMetadata[i].key === key && constructorArgsMetadata[i].value === value) return !0;
2127
+ return !1;
2128
+ };
2129
+ return constraint.metaData = new Metadata(key, value), constraint;
2356
2130
  };
2357
- class Color {
2358
- static Brighter(source) {
2359
- let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
2360
- return 1 === b ? source : new Color(source).brighter(b).toRGBA();
2131
+ const namedConstraint = taggedConstraint(NAMED_TAG);
2132
+
2133
+ class BindingInSyntax {
2134
+ constructor(binding) {
2135
+ this._binding = binding;
2361
2136
  }
2362
- static SetOpacity(source) {
2363
- let o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
2364
- return 1 === o ? source : new Color(source).setOpacity(o).toRGBA();
2137
+ inRequestScope() {
2138
+ throw new Error("暂未实现");
2365
2139
  }
2366
- static getColorBrightness(source) {
2367
- let model = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "hsl";
2368
- const color = source instanceof Color ? source : new Color(source);
2369
- switch (model) {
2370
- case "hsv":
2371
- default:
2372
- return color.getHSVBrightness();
2373
- case "hsl":
2374
- return color.getHSLBrightness();
2375
- case "lum":
2376
- return color.getLuminance();
2377
- case "lum2":
2378
- return color.getLuminance2();
2379
- case "lum3":
2380
- return color.getLuminance3();
2381
- case "wcag":
2382
- return color.getLuminanceWCAG();
2383
- }
2140
+ inSingletonScope() {
2141
+ return this._binding.scope = BindingScopeEnum.Singleton, this;
2384
2142
  }
2385
- static parseColorString(value) {
2386
- if (isValid$1(DEFAULT_COLORS_OPACITY[value])) return rgba(DEFAULT_COLORS_OPACITY[value]);
2387
- if (isValid$1(DEFAULT_COLORS[value])) return rgb(DEFAULT_COLORS[value]);
2388
- const formatValue = `${value}`.trim().toLowerCase(),
2389
- hexRes = setHex(formatValue);
2390
- if (void 0 !== hexRes) return hexRes;
2391
- if (/^(rgb|RGB|rgba|RGBA)/.test(formatValue)) {
2392
- const aColor = formatValue.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g, "").split(",");
2393
- return new RGB(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10), parseFloat(aColor[3]));
2394
- }
2395
- if (/^(hsl|HSL|hsla|HSLA)/.test(formatValue)) {
2396
- const aColor = formatValue.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g, "").split(","),
2397
- rgb = hslToRgb(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10));
2398
- return new RGB(rgb.r, rgb.g, rgb.b, parseFloat(aColor[3]));
2399
- }
2143
+ inTransientScope() {
2144
+ return this._binding.scope = BindingScopeEnum.Transient, this;
2400
2145
  }
2401
- constructor(value) {
2402
- const color = Color.parseColorString(value);
2403
- color ? this.color = color : (this.color = new RGB(255, 255, 255));
2146
+ whenTargetNamed(name) {
2147
+ return this._binding.constraint = namedConstraint(name), this;
2404
2148
  }
2405
- toRGBA() {
2406
- return this.color.formatRgb();
2149
+ }
2150
+
2151
+ class BindingToSyntax {
2152
+ constructor(binding) {
2153
+ this._binding = binding;
2407
2154
  }
2408
- toString() {
2409
- return this.color.formatRgb();
2155
+ to(constructor) {
2156
+ return this._binding.type = BindingTypeEnum.Instance, this._binding.implementationType = constructor, new BindingInSyntax(this._binding);
2410
2157
  }
2411
- toHex() {
2412
- return this.color.formatHex();
2158
+ toSelf() {
2159
+ const self = this._binding.serviceIdentifier;
2160
+ return this.to(self);
2413
2161
  }
2414
- toHsl() {
2415
- return this.color.formatHsl();
2162
+ toDynamicValue(func) {
2163
+ return this._binding.type = BindingTypeEnum.DynamicValue, this._binding.cache = null, this._binding.dynamicValue = func, this._binding.implementationType = null, new BindingInSyntax(this._binding);
2416
2164
  }
2417
- brighter(k) {
2418
- const {
2419
- r: r,
2420
- g: g,
2421
- b: b
2422
- } = this.color;
2423
- 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;
2165
+ toConstantValue(value) {
2166
+ 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);
2424
2167
  }
2425
- add(color) {
2426
- const {
2427
- r: r,
2428
- g: g,
2429
- b: b
2430
- } = this.color;
2431
- 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;
2168
+ toFactory(factory) {
2169
+ return this._binding.type = BindingTypeEnum.Factory, this._binding.factory = factory, this._binding.scope = BindingScopeEnum.Singleton, new BindingInSyntax(this._binding);
2432
2170
  }
2433
- sub(color) {
2434
- 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;
2171
+ toService(service) {
2172
+ this.toDynamicValue(context => context.container.get(service));
2435
2173
  }
2436
- multiply(color) {
2437
- const {
2438
- r: r,
2439
- g: g,
2440
- b: b
2441
- } = this.color;
2442
- 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;
2174
+ }
2175
+
2176
+ class Container {
2177
+ constructor(containerOptions) {
2178
+ const options = containerOptions || {};
2179
+ options.defaultScope = options.defaultScope || BindingScopeEnum.Transient, this.options = options, this.id = Generator.GenAutoIncrementId(), this._bindingDictionary = new Map(), this._metadataReader = new MetadataReader();
2443
2180
  }
2444
- getHSVBrightness() {
2445
- return Math.max(this.color.r, this.color.g, this.color.b) / 255;
2181
+ load(module) {
2182
+ const containerModuleHelpers = this._getContainerModuleHelpersFactory()(module.id);
2183
+ module.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction);
2446
2184
  }
2447
- getHSLBrightness() {
2448
- 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);
2185
+ get(serviceIdentifier) {
2186
+ const getArgs = this._getNotAllArgs(serviceIdentifier, !1);
2187
+ return this._get(getArgs);
2449
2188
  }
2450
- setHsl(h, s, l) {
2451
- const opacity = this.color.opacity,
2452
- hsl = rgbToHsl(this.color.r, this.color.g, this.color.b),
2453
- 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);
2454
- return this.color = new RGB(rgb.r, rgb.g, rgb.b, opacity), this;
2189
+ getAll(serviceIdentifier) {
2190
+ const getArgs = this._getAllArgs(serviceIdentifier);
2191
+ return this._get(getArgs);
2455
2192
  }
2456
- setRGB(r, g, b) {
2457
- return !isNil$1(r) && (this.color.r = r), !isNil$1(g) && (this.color.g = g), !isNil$1(b) && (this.color.b = b), this;
2193
+ getTagged(serviceIdentifier, key, value) {
2194
+ const getArgs = this._getNotAllArgs(serviceIdentifier, !1, key, value);
2195
+ return this._get(getArgs);
2458
2196
  }
2459
- setHex(value) {
2460
- const formatValue = `${value}`.trim().toLowerCase(),
2461
- res = setHex(formatValue, !0);
2462
- return null != res ? res : this;
2197
+ getNamed(serviceIdentifier, named) {
2198
+ return this.getTagged(serviceIdentifier, NAMED_TAG, named);
2463
2199
  }
2464
- setColorName(name) {
2465
- const hex = DEFAULT_COLORS[name.toLowerCase()];
2466
- return void 0 !== hex ? this.setHex(hex) : (void 0), this;
2200
+ isBound(serviceIdentifier) {
2201
+ return this._bindingDictionary.has(serviceIdentifier);
2467
2202
  }
2468
- setScalar(scalar) {
2469
- return this.color.r = scalar, this.color.g = scalar, this.color.b = scalar, this;
2203
+ bind(serviceIdentifier) {
2204
+ const scope = this.options.defaultScope,
2205
+ binding = new Binding(serviceIdentifier, scope),
2206
+ list = this._bindingDictionary.get(serviceIdentifier) || [];
2207
+ return list.push(binding), this._bindingDictionary.set(serviceIdentifier, list), new BindingToSyntax(binding);
2470
2208
  }
2471
- setOpacity() {
2472
- let o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
2473
- return this.color.opacity = o, this;
2209
+ unbind(serviceIdentifier) {
2210
+ this._bindingDictionary.delete(serviceIdentifier);
2474
2211
  }
2475
- getLuminance() {
2476
- return (.2126 * this.color.r + .7152 * this.color.g + .0722 * this.color.b) / 255;
2212
+ rebind(serviceIdentifier) {
2213
+ return this.unbind(serviceIdentifier), this.bind(serviceIdentifier);
2214
+ }
2215
+ _getContainerModuleHelpersFactory() {
2216
+ const setModuleId = (bindingToSyntax, moduleId) => {
2217
+ bindingToSyntax._binding.moduleId = moduleId;
2218
+ },
2219
+ getBindFunction = moduleId => serviceIdentifier => {
2220
+ const bindingToSyntax = this.bind(serviceIdentifier);
2221
+ return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
2222
+ },
2223
+ getUnbindFunction = () => serviceIdentifier => this.unbind(serviceIdentifier),
2224
+ getIsboundFunction = () => serviceIdentifier => this.isBound(serviceIdentifier),
2225
+ getRebindFunction = moduleId => serviceIdentifier => {
2226
+ const bindingToSyntax = this.rebind(serviceIdentifier);
2227
+ return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
2228
+ };
2229
+ return mId => ({
2230
+ bindFunction: getBindFunction(mId),
2231
+ isboundFunction: getIsboundFunction(),
2232
+ rebindFunction: getRebindFunction(mId),
2233
+ unbindFunction: getUnbindFunction(),
2234
+ unbindAsyncFunction: serviceIdentifier => null
2235
+ });
2477
2236
  }
2478
- getLuminance2() {
2479
- return (.2627 * this.color.r + .678 * this.color.g + .0593 * this.color.b) / 255;
2237
+ _getNotAllArgs(serviceIdentifier, isMultiInject, key, value) {
2238
+ return {
2239
+ avoidConstraints: !1,
2240
+ isMultiInject: isMultiInject,
2241
+ serviceIdentifier: serviceIdentifier,
2242
+ key: key,
2243
+ value: value
2244
+ };
2480
2245
  }
2481
- getLuminance3() {
2482
- return (.299 * this.color.r + .587 * this.color.g + .114 * this.color.b) / 255;
2246
+ _getAllArgs(serviceIdentifier) {
2247
+ return {
2248
+ avoidConstraints: !0,
2249
+ isMultiInject: !0,
2250
+ serviceIdentifier: serviceIdentifier
2251
+ };
2483
2252
  }
2484
- getLuminanceWCAG() {
2485
- const RsRGB = this.color.r / 255,
2486
- GsRGB = this.color.g / 255,
2487
- BsRGB = this.color.b / 255;
2488
- let R, G, B;
2489
- R = RsRGB <= .03928 ? RsRGB / 12.92 : Math.pow((RsRGB + .055) / 1.055, 2.4), G = GsRGB <= .03928 ? GsRGB / 12.92 : Math.pow((GsRGB + .055) / 1.055, 2.4), B = BsRGB <= .03928 ? BsRGB / 12.92 : Math.pow((BsRGB + .055) / 1.055, 2.4);
2490
- return .2126 * R + .7152 * G + .0722 * B;
2253
+ _get(getArgs) {
2254
+ const result = [];
2255
+ return this._bindingDictionary.get(getArgs.serviceIdentifier).filter(b => b.constraint(getArgs)).forEach(binding => {
2256
+ result.push(this._resolveFromBinding(binding));
2257
+ }), getArgs.isMultiInject || 1 !== result.length ? result : result[0];
2491
2258
  }
2492
- clone() {
2493
- return new Color(this.color.toString());
2259
+ _getChildRequest(binding) {
2260
+ const constr = binding.implementationType,
2261
+ {
2262
+ userGeneratedMetadata: userGeneratedMetadata
2263
+ } = this._metadataReader.getConstructorMetadata(constr),
2264
+ keys = Object.keys(userGeneratedMetadata),
2265
+ arr = [];
2266
+ for (let i = 0; i < keys.length; i++) {
2267
+ const constructorArgsMetadata = userGeneratedMetadata[i],
2268
+ targetMetadataMap = {};
2269
+ constructorArgsMetadata.forEach(md => {
2270
+ targetMetadataMap[md.key] = md.value;
2271
+ });
2272
+ const metadata = {
2273
+ inject: targetMetadataMap[INJECT_TAG],
2274
+ multiInject: targetMetadataMap[MULTI_INJECT_TAG]
2275
+ },
2276
+ injectIdentifier = metadata.inject || metadata.multiInject,
2277
+ target = {
2278
+ serviceIdentifier: injectIdentifier,
2279
+ constructorArgsMetadata: constructorArgsMetadata
2280
+ },
2281
+ request = {
2282
+ injectIdentifier: injectIdentifier,
2283
+ metadata: constructorArgsMetadata,
2284
+ bindings: this._bindingDictionary.get(injectIdentifier).filter(b => b.constraint(target))
2285
+ };
2286
+ arr.push(request);
2287
+ }
2288
+ return arr;
2494
2289
  }
2495
- copyGammaToLinear(color) {
2496
- let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
2497
- 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;
2290
+ _resolveFromBinding(binding) {
2291
+ const result = this._getResolvedFromBinding(binding);
2292
+ return this._saveToScope(binding, result), result;
2498
2293
  }
2499
- copyLinearToGamma(color) {
2500
- let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
2501
- const safeInverse = gammaFactor > 0 ? 1 / gammaFactor : 1;
2502
- 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;
2294
+ _getResolvedFromBinding(binding) {
2295
+ let result;
2296
+ switch (binding.type) {
2297
+ case BindingTypeEnum.ConstantValue:
2298
+ case BindingTypeEnum.Function:
2299
+ result = binding.cache;
2300
+ break;
2301
+ case BindingTypeEnum.Instance:
2302
+ result = this._resolveInstance(binding, binding.implementationType);
2303
+ break;
2304
+ default:
2305
+ result = binding.dynamicValue({
2306
+ container: this
2307
+ });
2308
+ }
2309
+ return result;
2503
2310
  }
2504
- convertGammaToLinear(gammaFactor) {
2505
- return this.copyGammaToLinear(this, gammaFactor), this;
2311
+ _resolveInstance(binding, constr) {
2312
+ if (binding.activated) return binding.cache;
2313
+ const childRequests = this._getChildRequest(binding);
2314
+ return this._createInstance(constr, childRequests);
2506
2315
  }
2507
- convertLinearToGamma(gammaFactor) {
2508
- return this.copyLinearToGamma(this, gammaFactor), this;
2316
+ _createInstance(constr, childRequests) {
2317
+ if (childRequests.length) {
2318
+ return new constr(...this._resolveRequests(childRequests));
2319
+ }
2320
+ return new constr();
2509
2321
  }
2510
- copySRGBToLinear(color) {
2511
- return this.color.r = SRGBToLinear(color.color.r), this.color.g = SRGBToLinear(color.color.g), this.color.b = SRGBToLinear(color.color.b), this;
2322
+ _resolveRequests(childRequests) {
2323
+ return childRequests.map(request => request.bindings.length > 1 ? request.bindings.map(binding => this._resolveFromBinding(binding)) : this._resolveFromBinding(request.bindings[0]));
2512
2324
  }
2513
- copyLinearToSRGB(color) {
2514
- return this.color.r = LinearToSRGB(color.color.r), this.color.g = LinearToSRGB(color.color.g), this.color.b = LinearToSRGB(color.color.b), this;
2325
+ _saveToScope(binding, result) {
2326
+ binding.scope === BindingScopeEnum.Singleton && (binding.cache = result, binding.activated = !0);
2515
2327
  }
2516
- convertSRGBToLinear() {
2517
- return this.copySRGBToLinear(this), this;
2328
+ }
2329
+
2330
+ const ContributionProvider = Symbol("ContributionProvider");
2331
+ class ContributionProviderCache {
2332
+ constructor(serviceIdentifier, container) {
2333
+ this.serviceIdentifier = serviceIdentifier, this.container = container;
2518
2334
  }
2519
- convertLinearToSRGB() {
2520
- return this.copyLinearToSRGB(this), this;
2335
+ getContributions() {
2336
+ return this.caches || (this.caches = [], this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier))), this.caches;
2521
2337
  }
2522
2338
  }
2523
- class RGB {
2524
- constructor(r, g, b, opacity) {
2525
- 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;
2339
+ function bindContributionProvider(bind, id) {
2340
+ bind(ContributionProvider).toDynamicValue(_ref => {
2341
+ let {
2342
+ container: container
2343
+ } = _ref;
2344
+ return new ContributionProviderCache(id, container);
2345
+ }).inSingletonScope().whenTargetNamed(id);
2346
+ }
2347
+
2348
+ class Hook {
2349
+ constructor(args, name) {
2350
+ this._args = args, this.name = name, this.taps = [];
2526
2351
  }
2527
- formatHex() {
2528
- return `#${hex(this.r) + hex(this.g) + hex(this.b) + (1 === this.opacity ? "" : hex(255 * this.opacity))}`;
2352
+ tap(options, fn) {
2353
+ this._tap("sync", options, fn);
2529
2354
  }
2530
- formatRgb() {
2531
- const opacity = this.opacity;
2532
- return `${1 === opacity ? "rgb(" : "rgba("}${this.r},${this.g},${this.b}${1 === opacity ? ")" : `,${opacity})`}`;
2355
+ unTap(options, fn) {
2356
+ const name = "string" == typeof options ? options.trim() : options.name;
2357
+ name && (this.taps = this.taps.filter(tap => !(tap.name === name && (!fn || tap.fn === fn))));
2533
2358
  }
2534
- formatHsl() {
2535
- const opacity = this.opacity,
2536
- {
2537
- h: h,
2538
- s: s,
2539
- l: l
2540
- } = rgbToHsl(this.r, this.g, this.b);
2541
- return `${1 === opacity ? "hsl(" : "hsla("}${h},${s}%,${l}%${1 === opacity ? ")" : `,${opacity})`}`;
2359
+ _parseOptions(type, options, fn) {
2360
+ let _options;
2361
+ if ("string" == typeof options) _options = {
2362
+ name: options.trim()
2363
+ };else if ("object" != typeof options || null === options) throw new Error("Invalid tap options");
2364
+ if ("string" != typeof _options.name || "" === _options.name) throw new Error("Missing name for tap");
2365
+ return _options = Object.assign({
2366
+ type: type,
2367
+ fn: fn
2368
+ }, _options), _options;
2542
2369
  }
2543
- toString() {
2544
- return this.formatHex();
2370
+ _tap(type, options, fn) {
2371
+ this._insert(this._parseOptions(type, options, fn));
2372
+ }
2373
+ _insert(item) {
2374
+ let before;
2375
+ "string" == typeof item.before ? before = new Set([item.before]) : Array.isArray(item.before) && (before = new Set(item.before));
2376
+ let stage = 0;
2377
+ "number" == typeof item.stage && (stage = item.stage);
2378
+ let i = this.taps.length;
2379
+ for (; i > 0;) {
2380
+ i--;
2381
+ const x = this.taps[i];
2382
+ this.taps[i + 1] = x;
2383
+ const xStage = x.stage || 0;
2384
+ if (before) {
2385
+ if (before.has(x.name)) {
2386
+ before.delete(x.name);
2387
+ continue;
2388
+ }
2389
+ if (before.size > 0) continue;
2390
+ }
2391
+ if (!(xStage > stage)) {
2392
+ i++;
2393
+ break;
2394
+ }
2395
+ }
2396
+ this.taps[i] = item;
2545
2397
  }
2546
2398
  }
2547
2399
 
2548
- function normalizePadding(padding) {
2549
- if (isValidNumber$1(padding)) return [padding, padding, padding, padding];
2550
- if (isArray$1(padding)) {
2551
- const length = padding.length;
2552
- if (1 === length) {
2553
- const paddingValue = padding[0];
2554
- return [paddingValue, paddingValue, paddingValue, paddingValue];
2555
- }
2556
- if (2 === length) {
2557
- const [vertical, horizontal] = padding;
2558
- return [vertical, horizontal, vertical, horizontal];
2559
- }
2560
- if (3 === length) {
2561
- const [top, horizontal, bottom] = padding;
2562
- return [top, horizontal, bottom, horizontal];
2400
+ class SyncHook extends Hook {
2401
+ call() {
2402
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2403
+ args[_key] = arguments[_key];
2563
2404
  }
2564
- if (4 === length) return padding;
2565
- }
2566
- if (isObject$1(padding)) {
2567
- const {
2568
- top = 0,
2569
- right = 0,
2570
- bottom = 0,
2571
- left = 0
2572
- } = padding;
2573
- return [top, right, bottom, left];
2405
+ this.taps.map(t => t.fn).forEach(cb => cb(...args));
2574
2406
  }
2575
- return [0, 0, 0, 0];
2576
2407
  }
2577
2408
 
2578
- const styleStringToObject = function () {
2579
- let styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
2580
- const res = {};
2581
- return styleStr.split(";").forEach(item => {
2582
- if (item) {
2583
- const arr = item.split(":");
2584
- if (2 === arr.length) {
2585
- const key = arr[0].trim(),
2586
- value = arr[1].trim();
2587
- key && value && (res[key] = value);
2588
- }
2589
- }
2590
- }), res;
2591
- };
2592
- const lowerCamelCaseToMiddle = str => str.replace(/([A-Z])/g, "-$1").toLowerCase();
2409
+ const EnvContribution = Symbol.for("EnvContribution");
2410
+ 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";
2411
+
2412
+ var MeasureModeEnum;
2413
+ !function (MeasureModeEnum) {
2414
+ MeasureModeEnum[MeasureModeEnum.estimate = 0] = "estimate", MeasureModeEnum[MeasureModeEnum.actualBounding = 1] = "actualBounding", MeasureModeEnum[MeasureModeEnum.fontBounding = 2] = "fontBounding";
2415
+ }(MeasureModeEnum || (MeasureModeEnum = {}));
2593
2416
 
2594
2417
  const circleThreshold = tau - 1e-8;
2595
2418
  class BoundsContext {
@@ -12641,7 +12464,7 @@
12641
12464
  if (!(element && ReactDOM && (ReactDOM.createRoot || ReactDOM.render))) {
12642
12465
  return;
12643
12466
  }
12644
- const id = isNil$3(react.id) ? `${graphic.id ?? graphic._uid}_react` : react.id;
12467
+ const id = isNil$1(react.id) ? `${graphic.id ?? graphic._uid}_react` : react.id;
12645
12468
  if (this.htmlMap && this.htmlMap[id] && container && container !== this.htmlMap[id].container) {
12646
12469
  this.removeElement(id);
12647
12470
  }
@@ -12727,7 +12550,7 @@
12727
12550
  let top = 0;
12728
12551
  const b = graphic.globalAABBBounds;
12729
12552
  let anchorType = options.anchorType;
12730
- if (isNil$3(anchorType)) {
12553
+ if (isNil$1(anchorType)) {
12731
12554
  anchorType = graphic.type === 'text' ? 'position' : 'boundsLeftTop';
12732
12555
  }
12733
12556
  if (anchorType === 'boundsLeftTop') {
@@ -12739,7 +12562,7 @@
12739
12562
  top = matrix.f;
12740
12563
  }
12741
12564
  else {
12742
- const anchor = calculateAnchorOfBounds$1(b, anchorType);
12565
+ const anchor = calculateAnchorOfBounds(b, anchorType);
12743
12566
  left = anchor.x;
12744
12567
  top = anchor.y;
12745
12568
  }
@@ -12755,17 +12578,17 @@
12755
12578
  ...this.getTransformOfText(graphic)
12756
12579
  };
12757
12580
  }
12758
- if (isFunction$3(options.style)) {
12581
+ if (isFunction$1(options.style)) {
12759
12582
  const userStyle = options.style({ top: offsetTop, left: offsetX, width: b.width(), height: b.height() }, graphic, wrapContainer);
12760
12583
  if (userStyle) {
12761
12584
  calculateStyle = { ...calculateStyle, ...userStyle };
12762
12585
  }
12763
12586
  }
12764
- else if (isObject$3(options.style)) {
12587
+ else if (isObject$1(options.style)) {
12765
12588
  calculateStyle = { ...calculateStyle, ...options.style };
12766
12589
  }
12767
- else if (isString$3(options.style) && options.style) {
12768
- calculateStyle = { ...calculateStyle, ...styleStringToObject$1(options.style) };
12590
+ else if (isString$1(options.style) && options.style) {
12591
+ calculateStyle = { ...calculateStyle, ...styleStringToObject(options.style) };
12769
12592
  }
12770
12593
  application.global.updateDom(wrapContainer, {
12771
12594
  width: options.width,
@@ -12865,7 +12688,7 @@
12865
12688
  }
12866
12689
  const { width, height, style } = params;
12867
12690
  if (style) {
12868
- if (isString$3(style)) {
12691
+ if (isString$1(style)) {
12869
12692
  dom.setAttribute('style', style);
12870
12693
  }
12871
12694
  else {
@@ -12907,7 +12730,7 @@
12907
12730
  toArray(props.children).map((child, index) => {
12908
12731
  const parseOption = child && child.type && child.type.parseOption;
12909
12732
  if (parseOption && child.props) {
12910
- const childProps = isNil$3(child.props.componentId)
12733
+ const childProps = isNil$1(child.props.componentId)
12911
12734
  ? {
12912
12735
  ...child.props,
12913
12736
  componentId: getComponentId(child, index)
@@ -18812,7 +18635,7 @@
18812
18635
  return graphic;
18813
18636
  }
18814
18637
  function isEventProp(key, props) {
18815
- return key.startsWith('on') && isFunction$3(props[key]);
18638
+ return key.startsWith('on') && isFunction$1(props[key]);
18816
18639
  }
18817
18640
  function bindEventsToGraphic(graphic, props) {
18818
18641
  for (const key in props) {
@@ -18832,7 +18655,7 @@
18832
18655
  graphic.addEventListener(REACT_TO_CANOPUS_EVENTS[propKey], newProps[propKey]);
18833
18656
  }
18834
18657
  }
18835
- const attribute = newProps.attribute ?? merge$1({}, newProps);
18658
+ const attribute = newProps.attribute ?? merge({}, newProps);
18836
18659
  graphic.initAttributes(attribute);
18837
18660
  if (graphic.type === 'image') {
18838
18661
  graphic.loadImage(attribute.image);
@@ -19094,7 +18917,7 @@
19094
18917
  styleTop = cellRect.top + dealWidthNumber(dy, cellRect.height) + cellRect.height + 'px';
19095
18918
  }
19096
18919
  }
19097
- const componentStyle = merge$1({}, style, {
18920
+ const componentStyle = merge({}, style, {
19098
18921
  position: 'absolute',
19099
18922
  zIndex: 1000,
19100
18923
  width: styleWidth,
@@ -19114,7 +18937,7 @@
19114
18937
  return { ...defaultProps };
19115
18938
  }, [defaultProps]);
19116
18939
  const props = React.useMemo(() => {
19117
- const mProps = merge$1({}, componentProps);
18940
+ const mProps = merge({}, componentProps);
19118
18941
  for (const propName in _defaultProps) {
19119
18942
  if (mProps[propName] === undefined) {
19120
18943
  mProps[propName] = _defaultProps[propName];
@@ -19125,7 +18948,7 @@
19125
18948
  return props;
19126
18949
  }
19127
18950
  function dealWidthNumber(value, refenceValue) {
19128
- if (isNumber$3(value)) {
18951
+ if (isNumber$1(value)) {
19129
18952
  return value;
19130
18953
  }
19131
18954
  if (typeof value === 'string' && value.endsWith('%')) {
@@ -19173,7 +18996,7 @@
19173
18996
  }
19174
18997
  };
19175
18998
  function ButtonComponent(baseProps, ref) {
19176
- const props = merge$1({}, defaultProps$6, baseProps);
18999
+ const props = merge({}, defaultProps$6, baseProps);
19177
19000
  const { disabled, onClick } = props;
19178
19001
  let buttonRef = React.useRef(null);
19179
19002
  buttonRef = ref ? ref : buttonRef;
@@ -19268,7 +19091,7 @@
19268
19091
  }
19269
19092
  };
19270
19093
  function LinkComponent(baseProps, ref) {
19271
- const props = merge$1({}, defaultProps$5, baseProps);
19094
+ const props = merge({}, defaultProps$5, baseProps);
19272
19095
  const { disabled, href, onClick } = props;
19273
19096
  let linkRef = React.useRef(null);
19274
19097
  linkRef = ref ? ref : linkRef;
@@ -19361,7 +19184,7 @@
19361
19184
  autoFixFontSize: true
19362
19185
  };
19363
19186
  function AvatarComponent(baseProps, ref) {
19364
- const props = merge$1({}, defaultProps$4, baseProps);
19187
+ const props = merge({}, defaultProps$4, baseProps);
19365
19188
  const { size, children, onClick } = props;
19366
19189
  let avatarRef = React.useRef(null);
19367
19190
  avatarRef = ref ? ref : avatarRef;
@@ -19369,7 +19192,7 @@
19369
19192
  onClick && onClick(event);
19370
19193
  }, [onClick]);
19371
19194
  const groupAttribute = getGroupAttribute(props);
19372
- if (isString$3(children)) {
19195
+ if (isString$1(children)) {
19373
19196
  const textAttribute = getTextAttribute(props);
19374
19197
  return (React.createElement(Group, { ref: avatarRef, attribute: groupAttribute, onClick: handleClick },
19375
19198
  React.createElement(Text, { attribute: textAttribute })));
@@ -19447,11 +19270,11 @@
19447
19270
  ...props.arrowStyle
19448
19271
  };
19449
19272
  return props.visible ? (React.createElement(React.Fragment, null,
19450
- React.createElement("div", { style: merge$1({}, defaultPoptipPanelStyle, props.panelStyle) }, props.content),
19273
+ React.createElement("div", { style: merge({}, defaultPoptipPanelStyle, props.panelStyle) }, props.content),
19451
19274
  React.createElement("div", { style: arrowStyle }))) : (React.createElement(React.Fragment, null));
19452
19275
  };
19453
19276
  function PopoverComponent(baseProps, ref) {
19454
- const props = merge$1({}, defaultProps$3, baseProps);
19277
+ const props = merge({}, defaultProps$3, baseProps);
19455
19278
  const { content, position, popupVisible, defaultPopupVisible, panelStyle, arrowStyle, children } = props;
19456
19279
  let popoverRef = React.useRef(null);
19457
19280
  popoverRef = ref ? ref : popoverRef;
@@ -19483,14 +19306,14 @@
19483
19306
  }
19484
19307
  };
19485
19308
  const groupMouseEnter = React.useCallback((event) => {
19486
- if (isValid$3(popupVisible)) {
19309
+ if (isValid$1(popupVisible)) {
19487
19310
  return;
19488
19311
  }
19489
19312
  setPopupOpen(true);
19490
19313
  event.currentTarget.stage.renderNextFrame();
19491
19314
  }, []);
19492
19315
  const groupMouseLeave = React.useCallback((event) => {
19493
- if (isValid$3(popupVisible)) {
19316
+ if (isValid$1(popupVisible)) {
19494
19317
  return;
19495
19318
  }
19496
19319
  setPopupOpen(false);
@@ -19667,7 +19490,7 @@
19667
19490
  }
19668
19491
  };
19669
19492
  function TagComponent(baseProps, ref) {
19670
- const props = merge$1({}, defaultProps$2, baseProps);
19493
+ const props = merge({}, defaultProps$2, baseProps);
19671
19494
  const { attribute, panelStyle, children, ...rest } = props;
19672
19495
  let tagRef = React.useRef(null);
19673
19496
  tagRef = ref ? ref : tagRef;
@@ -19684,7 +19507,7 @@
19684
19507
 
19685
19508
  const defaultProps$1 = {};
19686
19509
  function RadioComponent(baseProps, ref) {
19687
- const props = merge$1({}, defaultProps$1, baseProps);
19510
+ const props = merge({}, defaultProps$1, baseProps);
19688
19511
  const { textStyle, circleStyle, children, ...rest } = props;
19689
19512
  let radioRef = React.useRef(null);
19690
19513
  radioRef = ref ? ref : radioRef;
@@ -19713,7 +19536,7 @@
19713
19536
 
19714
19537
  const defaultProps = {};
19715
19538
  function CheckboxComponent(baseProps, ref) {
19716
- const props = merge$1({}, defaultProps, baseProps);
19539
+ const props = merge({}, defaultProps, baseProps);
19717
19540
  const { textStyle, boxStyle, iconStyle, children, ...rest } = props;
19718
19541
  let checkboxRef = React.useRef(null);
19719
19542
  checkboxRef = ref ? ref : checkboxRef;
@@ -19739,7 +19562,7 @@
19739
19562
  const Checkbox = React.forwardRef(CheckboxComponent);
19740
19563
  Checkbox.displayName = 'Checkbox';
19741
19564
 
19742
- const version = "1.17.1-alpha.8";
19565
+ const version = "1.17.1-alpha.9";
19743
19566
 
19744
19567
  Object.defineProperty(exports, 'register', {
19745
19568
  enumerable: true,