@antv/g-canvas 1.9.13 → 1.9.15

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.
package/dist/index.umd.js CHANGED
@@ -400,238 +400,614 @@
400
400
  return _setPrototypeOf(o, p);
401
401
  }
402
402
 
403
- var toString = {}.toString;
404
- var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
405
-
406
- // isFinite,
407
- var isNil = function (value) {
408
- /**
409
- * isNil(null) => true
410
- * isNil() => true
411
- */
412
- return value === null || value === undefined;
413
- };
403
+ /**
404
+ * Common utilities
405
+ * @module glMatrix
406
+ */
407
+ var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;
408
+ if (!Math.hypot) Math.hypot = function () {
409
+ var y = 0,
410
+ i = arguments.length;
414
411
 
415
- var isString = (function (str) {
416
- return isType(str, 'String');
417
- });
412
+ while (i--) {
413
+ y += arguments[i] * arguments[i];
414
+ }
418
415
 
419
- var clamp = function (a, min, max) {
420
- if (a < min) {
421
- return min;
422
- }
423
- else if (a > max) {
424
- return max;
425
- }
426
- return a;
416
+ return Math.sqrt(y);
427
417
  };
428
418
 
429
- function _inheritsLoose$1(subClass, superClass) {
430
- subClass.prototype = Object.create(superClass.prototype);
431
- subClass.prototype.constructor = subClass;
419
+ /**
420
+ * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied.
421
+ * @module mat4
422
+ */
432
423
 
433
- _setPrototypeOf$1(subClass, superClass);
434
- }
424
+ /**
425
+ * Creates a new identity mat4
426
+ *
427
+ * @returns {mat4} a new 4x4 matrix
428
+ */
435
429
 
436
- function _setPrototypeOf$1(o, p) {
437
- _setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
438
- o.__proto__ = p;
439
- return o;
440
- };
441
- return _setPrototypeOf$1(o, p);
442
- }
430
+ function create() {
431
+ var out = new ARRAY_TYPE(16);
443
432
 
444
- function generatePath(context, parsedStyle) {
445
- var r = parsedStyle.r;
446
- context.arc(r, r, r, 0, Math.PI * 2, false);
447
- }
433
+ if (ARRAY_TYPE != Float32Array) {
434
+ out[1] = 0;
435
+ out[2] = 0;
436
+ out[3] = 0;
437
+ out[4] = 0;
438
+ out[6] = 0;
439
+ out[7] = 0;
440
+ out[8] = 0;
441
+ out[9] = 0;
442
+ out[11] = 0;
443
+ out[12] = 0;
444
+ out[13] = 0;
445
+ out[14] = 0;
446
+ }
448
447
 
449
- function generatePath$1(context, parsedStyle) {
450
- var rxInPixels = parsedStyle.rx,
451
- ryInPixels = parsedStyle.ry;
452
- var rx = rxInPixels;
453
- var ry = ryInPixels; // @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/ellipse
448
+ out[0] = 1;
449
+ out[5] = 1;
450
+ out[10] = 1;
451
+ out[15] = 1;
452
+ return out;
453
+ }
454
+ /**
455
+ * Copy the values from one mat4 to another
456
+ *
457
+ * @param {mat4} out the receiving matrix
458
+ * @param {ReadonlyMat4} a the source matrix
459
+ * @returns {mat4} out
460
+ */
454
461
 
455
- if (context.ellipse) {
456
- context.ellipse(rx, ry, rx, ry, 0, 0, Math.PI * 2, false);
457
- } else {
458
- // 如果不支持,则使用圆来绘制,进行变形
459
- var r = rx > ry ? rx : ry;
460
- var scaleX = rx > ry ? 1 : rx / ry;
461
- var scaleY = rx > ry ? ry / rx : 1;
462
- context.save();
463
- context.scale(scaleX, scaleY);
464
- context.arc(0, 0, r, 0, Math.PI * 2);
465
- }
462
+ function copy(out, a) {
463
+ out[0] = a[0];
464
+ out[1] = a[1];
465
+ out[2] = a[2];
466
+ out[3] = a[3];
467
+ out[4] = a[4];
468
+ out[5] = a[5];
469
+ out[6] = a[6];
470
+ out[7] = a[7];
471
+ out[8] = a[8];
472
+ out[9] = a[9];
473
+ out[10] = a[10];
474
+ out[11] = a[11];
475
+ out[12] = a[12];
476
+ out[13] = a[13];
477
+ out[14] = a[14];
478
+ out[15] = a[15];
479
+ return out;
466
480
  }
481
+ /**
482
+ * Inverts a mat4
483
+ *
484
+ * @param {mat4} out the receiving matrix
485
+ * @param {ReadonlyMat4} a the source matrix
486
+ * @returns {mat4} out
487
+ */
467
488
 
468
- function generatePath$2(context, parsedStyle) {
469
- var x1 = parsedStyle.x1,
470
- y1 = parsedStyle.y1,
471
- x2 = parsedStyle.x2,
472
- y2 = parsedStyle.y2,
473
- _parsedStyle$defX = parsedStyle.defX,
474
- defX = _parsedStyle$defX === void 0 ? 0 : _parsedStyle$defX,
475
- _parsedStyle$defY = parsedStyle.defY,
476
- defY = _parsedStyle$defY === void 0 ? 0 : _parsedStyle$defY,
477
- markerStart = parsedStyle.markerStart,
478
- markerEnd = parsedStyle.markerEnd,
479
- markerStartOffset = parsedStyle.markerStartOffset,
480
- markerEndOffset = parsedStyle.markerEndOffset;
481
- var startOffsetX = 0;
482
- var startOffsetY = 0;
483
- var endOffsetX = 0;
484
- var endOffsetY = 0;
485
- var rad = 0;
486
- var x;
487
- var y;
489
+ function invert(out, a) {
490
+ var a00 = a[0],
491
+ a01 = a[1],
492
+ a02 = a[2],
493
+ a03 = a[3];
494
+ var a10 = a[4],
495
+ a11 = a[5],
496
+ a12 = a[6],
497
+ a13 = a[7];
498
+ var a20 = a[8],
499
+ a21 = a[9],
500
+ a22 = a[10],
501
+ a23 = a[11];
502
+ var a30 = a[12],
503
+ a31 = a[13],
504
+ a32 = a[14],
505
+ a33 = a[15];
506
+ var b00 = a00 * a11 - a01 * a10;
507
+ var b01 = a00 * a12 - a02 * a10;
508
+ var b02 = a00 * a13 - a03 * a10;
509
+ var b03 = a01 * a12 - a02 * a11;
510
+ var b04 = a01 * a13 - a03 * a11;
511
+ var b05 = a02 * a13 - a03 * a12;
512
+ var b06 = a20 * a31 - a21 * a30;
513
+ var b07 = a20 * a32 - a22 * a30;
514
+ var b08 = a20 * a33 - a23 * a30;
515
+ var b09 = a21 * a32 - a22 * a31;
516
+ var b10 = a21 * a33 - a23 * a31;
517
+ var b11 = a22 * a33 - a23 * a32; // Calculate the determinant
488
518
 
489
- if (markerStart && markerStart instanceof gLite.DisplayObject && markerStartOffset) {
490
- x = x2 - x1;
491
- y = y2 - y1;
492
- rad = Math.atan2(y, x);
493
- startOffsetX = Math.cos(rad) * (markerStartOffset || 0);
494
- startOffsetY = Math.sin(rad) * (markerStartOffset || 0);
495
- }
519
+ var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
496
520
 
497
- if (markerEnd && markerEnd instanceof gLite.DisplayObject && markerEndOffset) {
498
- x = x1 - x2;
499
- y = y1 - y2;
500
- rad = Math.atan2(y, x);
501
- endOffsetX = Math.cos(rad) * (markerEndOffset || 0);
502
- endOffsetY = Math.sin(rad) * (markerEndOffset || 0);
521
+ if (!det) {
522
+ return null;
503
523
  }
504
524
 
505
- context.moveTo(x1 - defX + startOffsetX, y1 - defY + startOffsetY);
506
- context.lineTo(x2 - defX + endOffsetX, y2 - defY + endOffsetY);
525
+ det = 1.0 / det;
526
+ out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
527
+ out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
528
+ out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
529
+ out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;
530
+ out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
531
+ out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
532
+ out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
533
+ out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;
534
+ out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
535
+ out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
536
+ out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
537
+ out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;
538
+ out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;
539
+ out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;
540
+ out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;
541
+ out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;
542
+ return out;
507
543
  }
544
+ /**
545
+ * Multiplies two mat4s
546
+ *
547
+ * @param {mat4} out the receiving matrix
548
+ * @param {ReadonlyMat4} a the first operand
549
+ * @param {ReadonlyMat4} b the second operand
550
+ * @returns {mat4} out
551
+ */
508
552
 
509
- function generatePath$3(context, parsedStyle) {
510
- var _parsedStyle$defX = parsedStyle.defX,
511
- defX = _parsedStyle$defX === void 0 ? 0 : _parsedStyle$defX,
512
- _parsedStyle$defY = parsedStyle.defY,
513
- defY = _parsedStyle$defY === void 0 ? 0 : _parsedStyle$defY,
514
- markerStart = parsedStyle.markerStart,
515
- markerEnd = parsedStyle.markerEnd,
516
- markerStartOffset = parsedStyle.markerStartOffset,
517
- markerEndOffset = parsedStyle.markerEndOffset;
518
- var _parsedStyle$path = parsedStyle.path,
519
- curve = _parsedStyle$path.curve,
520
- zCommandIndexes = _parsedStyle$path.zCommandIndexes;
521
- var path = [].concat(curve);
522
- zCommandIndexes.forEach(function (zIndex, index) {
523
- // @ts-ignore
524
- path.splice(zIndex + index + 1, 0, ['Z']);
525
- }); // @ts-ignore
553
+ function multiply(out, a, b) {
554
+ var a00 = a[0],
555
+ a01 = a[1],
556
+ a02 = a[2],
557
+ a03 = a[3];
558
+ var a10 = a[4],
559
+ a11 = a[5],
560
+ a12 = a[6],
561
+ a13 = a[7];
562
+ var a20 = a[8],
563
+ a21 = a[9],
564
+ a22 = a[10],
565
+ a23 = a[11];
566
+ var a30 = a[12],
567
+ a31 = a[13],
568
+ a32 = a[14],
569
+ a33 = a[15]; // Cache only the current line of the second matrix
526
570
 
527
- var isClosed = path.length && path[path.length - 1][0] === 'Z';
528
- var startOffsetX = 0;
529
- var startOffsetY = 0;
530
- var endOffsetX = 0;
531
- var endOffsetY = 0;
532
- var rad = 0;
533
- var x;
534
- var y;
571
+ var b0 = b[0],
572
+ b1 = b[1],
573
+ b2 = b[2],
574
+ b3 = b[3];
575
+ out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
576
+ out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
577
+ out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
578
+ out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
579
+ b0 = b[4];
580
+ b1 = b[5];
581
+ b2 = b[6];
582
+ b3 = b[7];
583
+ out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
584
+ out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
585
+ out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
586
+ out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
587
+ b0 = b[8];
588
+ b1 = b[9];
589
+ b2 = b[10];
590
+ b3 = b[11];
591
+ out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
592
+ out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
593
+ out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
594
+ out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
595
+ b0 = b[12];
596
+ b1 = b[13];
597
+ b2 = b[14];
598
+ b3 = b[15];
599
+ out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
600
+ out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
601
+ out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
602
+ out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
603
+ return out;
604
+ }
605
+ /**
606
+ * Translate a mat4 by the given vector
607
+ *
608
+ * @param {mat4} out the receiving matrix
609
+ * @param {ReadonlyMat4} a the matrix to translate
610
+ * @param {ReadonlyVec3} v vector to translate by
611
+ * @returns {mat4} out
612
+ */
613
+
614
+ function translate(out, a, v) {
615
+ var x = v[0],
616
+ y = v[1],
617
+ z = v[2];
618
+ var a00, a01, a02, a03;
619
+ var a10, a11, a12, a13;
620
+ var a20, a21, a22, a23;
621
+
622
+ if (a === out) {
623
+ out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];
624
+ out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];
625
+ out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];
626
+ out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];
627
+ } else {
628
+ a00 = a[0];
629
+ a01 = a[1];
630
+ a02 = a[2];
631
+ a03 = a[3];
632
+ a10 = a[4];
633
+ a11 = a[5];
634
+ a12 = a[6];
635
+ a13 = a[7];
636
+ a20 = a[8];
637
+ a21 = a[9];
638
+ a22 = a[10];
639
+ a23 = a[11];
640
+ out[0] = a00;
641
+ out[1] = a01;
642
+ out[2] = a02;
643
+ out[3] = a03;
644
+ out[4] = a10;
645
+ out[5] = a11;
646
+ out[6] = a12;
647
+ out[7] = a13;
648
+ out[8] = a20;
649
+ out[9] = a21;
650
+ out[10] = a22;
651
+ out[11] = a23;
652
+ out[12] = a00 * x + a10 * y + a20 * z + a[12];
653
+ out[13] = a01 * x + a11 * y + a21 * z + a[13];
654
+ out[14] = a02 * x + a12 * y + a22 * z + a[14];
655
+ out[15] = a03 * x + a13 * y + a23 * z + a[15];
656
+ }
657
+
658
+ return out;
659
+ }
660
+ /**
661
+ * Creates a matrix from a vector scaling
662
+ * This is equivalent to (but much faster than):
663
+ *
664
+ * mat4.identity(dest);
665
+ * mat4.scale(dest, dest, vec);
666
+ *
667
+ * @param {mat4} out mat4 receiving operation result
668
+ * @param {ReadonlyVec3} v Scaling vector
669
+ * @returns {mat4} out
670
+ */
671
+
672
+ function fromScaling(out, v) {
673
+ out[0] = v[0];
674
+ out[1] = 0;
675
+ out[2] = 0;
676
+ out[3] = 0;
677
+ out[4] = 0;
678
+ out[5] = v[1];
679
+ out[6] = 0;
680
+ out[7] = 0;
681
+ out[8] = 0;
682
+ out[9] = 0;
683
+ out[10] = v[2];
684
+ out[11] = 0;
685
+ out[12] = 0;
686
+ out[13] = 0;
687
+ out[14] = 0;
688
+ out[15] = 1;
689
+ return out;
690
+ }
691
+
692
+ /**
693
+ * 3 Dimensional Vector
694
+ * @module vec3
695
+ */
696
+
697
+ /**
698
+ * Creates a new, empty vec3
699
+ *
700
+ * @returns {vec3} a new 3D vector
701
+ */
702
+
703
+ function create$1() {
704
+ var out = new ARRAY_TYPE(3);
705
+
706
+ if (ARRAY_TYPE != Float32Array) {
707
+ out[0] = 0;
708
+ out[1] = 0;
709
+ out[2] = 0;
710
+ }
711
+
712
+ return out;
713
+ }
714
+ /**
715
+ * Creates a new vec3 initialized with the given values
716
+ *
717
+ * @param {Number} x X component
718
+ * @param {Number} y Y component
719
+ * @param {Number} z Z component
720
+ * @returns {vec3} a new 3D vector
721
+ */
722
+
723
+ function fromValues(x, y, z) {
724
+ var out = new ARRAY_TYPE(3);
725
+ out[0] = x;
726
+ out[1] = y;
727
+ out[2] = z;
728
+ return out;
729
+ }
730
+ /**
731
+ * Set the components of a vec3 to the given values
732
+ *
733
+ * @param {vec3} out the receiving vector
734
+ * @param {Number} x X component
735
+ * @param {Number} y Y component
736
+ * @param {Number} z Z component
737
+ * @returns {vec3} out
738
+ */
739
+
740
+ function set(out, x, y, z) {
741
+ out[0] = x;
742
+ out[1] = y;
743
+ out[2] = z;
744
+ return out;
745
+ }
746
+ /**
747
+ * Transforms the vec3 with a mat4.
748
+ * 4th vector component is implicitly '1'
749
+ *
750
+ * @param {vec3} out the receiving vector
751
+ * @param {ReadonlyVec3} a the vector to transform
752
+ * @param {ReadonlyMat4} m matrix to transform with
753
+ * @returns {vec3} out
754
+ */
755
+
756
+ function transformMat4(out, a, m) {
757
+ var x = a[0],
758
+ y = a[1],
759
+ z = a[2];
760
+ var w = m[3] * x + m[7] * y + m[11] * z + m[15];
761
+ w = w || 1.0;
762
+ out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
763
+ out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
764
+ out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
765
+ return out;
766
+ }
767
+ /**
768
+ * Transforms the vec3 with a mat3.
769
+ *
770
+ * @param {vec3} out the receiving vector
771
+ * @param {ReadonlyVec3} a the vector to transform
772
+ * @param {ReadonlyMat3} m the 3x3 matrix to transform with
773
+ * @returns {vec3} out
774
+ */
775
+
776
+ function transformMat3(out, a, m) {
777
+ var x = a[0],
778
+ y = a[1],
779
+ z = a[2];
780
+ out[0] = x * m[0] + y * m[3] + z * m[6];
781
+ out[1] = x * m[1] + y * m[4] + z * m[7];
782
+ out[2] = x * m[2] + y * m[5] + z * m[8];
783
+ return out;
784
+ }
785
+ /**
786
+ * Perform some operation over an array of vec3s.
787
+ *
788
+ * @param {Array} a the array of vectors to iterate over
789
+ * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
790
+ * @param {Number} offset Number of elements to skip at the beginning of the array
791
+ * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
792
+ * @param {Function} fn Function to call for each vector in the array
793
+ * @param {Object} [arg] additional argument to pass to fn
794
+ * @returns {Array} a
795
+ * @function
796
+ */
797
+
798
+ var forEach = function () {
799
+ var vec = create$1();
800
+ return function (a, stride, offset, count, fn, arg) {
801
+ var i, l;
802
+
803
+ if (!stride) {
804
+ stride = 3;
805
+ }
806
+
807
+ if (!offset) {
808
+ offset = 0;
809
+ }
810
+
811
+ if (count) {
812
+ l = Math.min(count * stride + offset, a.length);
813
+ } else {
814
+ l = a.length;
815
+ }
816
+
817
+ for (i = offset; i < l; i += stride) {
818
+ vec[0] = a[i];
819
+ vec[1] = a[i + 1];
820
+ vec[2] = a[i + 2];
821
+ fn(vec, vec, arg);
822
+ a[i] = vec[0];
823
+ a[i + 1] = vec[1];
824
+ a[i + 2] = vec[2];
825
+ }
826
+
827
+ return a;
828
+ };
829
+ }();
830
+
831
+ /**
832
+ * 2 Dimensional Vector
833
+ * @module vec2
834
+ */
835
+
836
+ /**
837
+ * Creates a new, empty vec2
838
+ *
839
+ * @returns {vec2} a new 2D vector
840
+ */
841
+
842
+ function create$2() {
843
+ var out = new ARRAY_TYPE(2);
844
+
845
+ if (ARRAY_TYPE != Float32Array) {
846
+ out[0] = 0;
847
+ out[1] = 0;
848
+ }
849
+
850
+ return out;
851
+ }
852
+ /**
853
+ * Normalize a vec2
854
+ *
855
+ * @param {vec2} out the receiving vector
856
+ * @param {ReadonlyVec2} a vector to normalize
857
+ * @returns {vec2} out
858
+ */
859
+
860
+ function normalize(out, a) {
861
+ var x = a[0],
862
+ y = a[1];
863
+ var len = x * x + y * y;
864
+
865
+ if (len > 0) {
866
+ //TODO: evaluate use of glm_invsqrt here?
867
+ len = 1 / Math.sqrt(len);
868
+ }
869
+
870
+ out[0] = a[0] * len;
871
+ out[1] = a[1] * len;
872
+ return out;
873
+ }
874
+ /**
875
+ * Calculates the dot product of two vec2's
876
+ *
877
+ * @param {ReadonlyVec2} a the first operand
878
+ * @param {ReadonlyVec2} b the second operand
879
+ * @returns {Number} dot product of a and b
880
+ */
881
+
882
+ function dot(a, b) {
883
+ return a[0] * b[0] + a[1] * b[1];
884
+ }
885
+ /**
886
+ * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)
887
+ *
888
+ * @param {ReadonlyVec2} a The first vector.
889
+ * @param {ReadonlyVec2} b The second vector.
890
+ * @returns {Boolean} True if the vectors are equal, false otherwise.
891
+ */
535
892
 
536
- if (markerStart && markerStart instanceof gLite.DisplayObject && markerStartOffset) {
537
- var _markerStart$parentNo = markerStart.parentNode.getStartTangent(),
538
- p1 = _markerStart$parentNo[0],
539
- p2 = _markerStart$parentNo[1];
893
+ function exactEquals(a, b) {
894
+ return a[0] === b[0] && a[1] === b[1];
895
+ }
896
+ /**
897
+ * Perform some operation over an array of vec2s.
898
+ *
899
+ * @param {Array} a the array of vectors to iterate over
900
+ * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed
901
+ * @param {Number} offset Number of elements to skip at the beginning of the array
902
+ * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array
903
+ * @param {Function} fn Function to call for each vector in the array
904
+ * @param {Object} [arg] additional argument to pass to fn
905
+ * @returns {Array} a
906
+ * @function
907
+ */
540
908
 
541
- x = p1[0] - p2[0];
542
- y = p1[1] - p2[1];
543
- rad = Math.atan2(y, x);
544
- startOffsetX = Math.cos(rad) * (markerStartOffset || 0);
545
- startOffsetY = Math.sin(rad) * (markerStartOffset || 0);
546
- }
909
+ var forEach$1 = function () {
910
+ var vec = create$2();
911
+ return function (a, stride, offset, count, fn, arg) {
912
+ var i, l;
547
913
 
548
- if (markerEnd && markerEnd instanceof gLite.DisplayObject && markerEndOffset) {
549
- var _markerEnd$parentNode = markerEnd.parentNode.getEndTangent(),
550
- _p = _markerEnd$parentNode[0],
551
- _p2 = _markerEnd$parentNode[1];
914
+ if (!stride) {
915
+ stride = 2;
916
+ }
552
917
 
553
- x = _p[0] - _p2[0];
554
- y = _p[1] - _p2[1];
555
- rad = Math.atan2(y, x);
556
- endOffsetX = Math.cos(rad) * (markerEndOffset || 0);
557
- endOffsetY = Math.sin(rad) * (markerEndOffset || 0);
558
- }
918
+ if (!offset) {
919
+ offset = 0;
920
+ }
559
921
 
560
- for (var i = 0; i < path.length; i++) {
561
- var params = path[i];
562
- var command = params[0];
922
+ if (count) {
923
+ l = Math.min(count * stride + offset, a.length);
924
+ } else {
925
+ l = a.length;
926
+ }
563
927
 
564
- switch (command) {
565
- case 'M':
566
- context.moveTo(params[1] - defX + startOffsetX, params[2] - defY + startOffsetY);
567
- break;
928
+ for (i = offset; i < l; i += stride) {
929
+ vec[0] = a[i];
930
+ vec[1] = a[i + 1];
931
+ fn(vec, vec, arg);
932
+ a[i] = vec[0];
933
+ a[i + 1] = vec[1];
934
+ }
568
935
 
569
- case 'C':
570
- // the last C command
571
- var offsetX = i === path.length - (isClosed ? 2 : 1) ? endOffsetX : 0;
572
- var offsetY = i === path.length - (isClosed ? 2 : 1) ? endOffsetY : 0;
573
- context.bezierCurveTo(params[1] - defX, params[2] - defY, params[3] - defX, params[4] - defY, params[5] - defX + offsetX, params[6] - defY + offsetY);
574
- break;
575
- // @ts-ignore
936
+ return a;
937
+ };
938
+ }();
576
939
 
577
- case 'Z':
578
- context.closePath();
579
- break;
940
+ var toString = {}.toString;
941
+ var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
942
+
943
+ // isFinite,
944
+ var isNil = function (value) {
945
+ /**
946
+ * isNil(null) => true
947
+ * isNil() => true
948
+ */
949
+ return value === null || value === undefined;
950
+ };
951
+
952
+ var isString = (function (str) {
953
+ return isType(str, 'String');
954
+ });
955
+
956
+ var clamp = function (a, min, max) {
957
+ if (a < min) {
958
+ return min;
580
959
  }
581
- }
582
- }
960
+ else if (a > max) {
961
+ return max;
962
+ }
963
+ return a;
964
+ };
583
965
 
584
- function generatePath$4(context, parsedStyle) {
585
- var _parsedStyle$defX = parsedStyle.defX,
586
- defX = _parsedStyle$defX === void 0 ? 0 : _parsedStyle$defX,
587
- _parsedStyle$defY = parsedStyle.defY,
588
- defY = _parsedStyle$defY === void 0 ? 0 : _parsedStyle$defY,
589
- markerStart = parsedStyle.markerStart,
590
- markerEnd = parsedStyle.markerEnd,
591
- markerStartOffset = parsedStyle.markerStartOffset,
592
- markerEndOffset = parsedStyle.markerEndOffset;
593
- var points = parsedStyle.points.points;
594
- var length = points.length;
595
- var x1 = points[0][0] - defX;
596
- var y1 = points[0][1] - defY;
597
- var x2 = points[length - 1][0] - defX;
598
- var y2 = points[length - 1][1] - defY;
599
- var startOffsetX = 0;
600
- var startOffsetY = 0;
601
- var endOffsetX = 0;
602
- var endOffsetY = 0;
603
- var rad = 0;
604
- var x;
605
- var y;
966
+ function _inheritsLoose$1(subClass, superClass) {
967
+ subClass.prototype = Object.create(superClass.prototype);
968
+ subClass.prototype.constructor = subClass;
606
969
 
607
- if (markerStart && markerStart instanceof gLite.DisplayObject && markerStartOffset) {
608
- x = points[1][0] - points[0][0];
609
- y = points[1][1] - points[0][1];
610
- rad = Math.atan2(y, x);
611
- startOffsetX = Math.cos(rad) * (markerStartOffset || 0);
612
- startOffsetY = Math.sin(rad) * (markerStartOffset || 0);
613
- }
970
+ _setPrototypeOf$1(subClass, superClass);
971
+ }
614
972
 
615
- if (markerEnd && markerEnd instanceof gLite.DisplayObject && markerEndOffset) {
616
- x = points[length - 1][0] - points[0][0];
617
- y = points[length - 1][1] - points[0][1];
618
- rad = Math.atan2(y, x);
619
- endOffsetX = Math.cos(rad) * (markerEndOffset || 0);
620
- endOffsetY = Math.sin(rad) * (markerEndOffset || 0);
621
- }
973
+ function _setPrototypeOf$1(o, p) {
974
+ _setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
975
+ o.__proto__ = p;
976
+ return o;
977
+ };
978
+ return _setPrototypeOf$1(o, p);
979
+ }
622
980
 
623
- context.moveTo(x1 + (startOffsetX || endOffsetX), y1 + (startOffsetY || endOffsetY));
981
+ function generatePath(context, parsedStyle) {
982
+ var r = parsedStyle.r;
983
+ context.arc(r, r, r, 0, Math.PI * 2, false);
984
+ }
624
985
 
625
- for (var i = 1; i < length - 1; i++) {
626
- var point = points[i];
627
- context.lineTo(point[0] - defX, point[1] - defY);
628
- }
986
+ function generatePath$1(context, parsedStyle) {
987
+ var rxInPixels = parsedStyle.rx,
988
+ ryInPixels = parsedStyle.ry;
989
+ var rx = rxInPixels;
990
+ var ry = ryInPixels; // @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/ellipse
629
991
 
630
- context.lineTo(x2, y2);
992
+ if (context.ellipse) {
993
+ context.ellipse(rx, ry, rx, ry, 0, 0, Math.PI * 2, false);
994
+ } else {
995
+ // 如果不支持,则使用圆来绘制,进行变形
996
+ var r = rx > ry ? rx : ry;
997
+ var scaleX = rx > ry ? 1 : rx / ry;
998
+ var scaleY = rx > ry ? ry / rx : 1;
999
+ context.save();
1000
+ context.scale(scaleX, scaleY);
1001
+ context.arc(0, 0, r, 0, Math.PI * 2);
1002
+ }
631
1003
  }
632
1004
 
633
- function generatePath$5(context, parsedStyle) {
634
- var _parsedStyle$defX = parsedStyle.defX,
1005
+ function generatePath$2(context, parsedStyle) {
1006
+ var x1 = parsedStyle.x1,
1007
+ y1 = parsedStyle.y1,
1008
+ x2 = parsedStyle.x2,
1009
+ y2 = parsedStyle.y2,
1010
+ _parsedStyle$defX = parsedStyle.defX,
635
1011
  defX = _parsedStyle$defX === void 0 ? 0 : _parsedStyle$defX,
636
1012
  _parsedStyle$defY = parsedStyle.defY,
637
1013
  defY = _parsedStyle$defY === void 0 ? 0 : _parsedStyle$defY,
@@ -639,12 +1015,6 @@
639
1015
  markerEnd = parsedStyle.markerEnd,
640
1016
  markerStartOffset = parsedStyle.markerStartOffset,
641
1017
  markerEndOffset = parsedStyle.markerEndOffset;
642
- var points = parsedStyle.points.points;
643
- var length = points.length;
644
- var x1 = points[0][0] - defX;
645
- var y1 = points[0][1] - defY;
646
- var x2 = points[length - 1][0] - defX;
647
- var y2 = points[length - 1][1] - defY;
648
1018
  var startOffsetX = 0;
649
1019
  var startOffsetY = 0;
650
1020
  var endOffsetX = 0;
@@ -654,935 +1024,786 @@
654
1024
  var y;
655
1025
 
656
1026
  if (markerStart && markerStart instanceof gLite.DisplayObject && markerStartOffset) {
657
- x = points[1][0] - points[0][0];
658
- y = points[1][1] - points[0][1];
1027
+ x = x2 - x1;
1028
+ y = y2 - y1;
659
1029
  rad = Math.atan2(y, x);
660
1030
  startOffsetX = Math.cos(rad) * (markerStartOffset || 0);
661
1031
  startOffsetY = Math.sin(rad) * (markerStartOffset || 0);
662
1032
  }
663
1033
 
664
- if (markerEnd && markerEnd instanceof gLite.DisplayObject && markerEndOffset) {
665
- x = points[length - 2][0] - points[length - 1][0];
666
- y = points[length - 2][1] - points[length - 1][1];
667
- rad = Math.atan2(y, x);
668
- endOffsetX = Math.cos(rad) * (markerEndOffset || 0);
669
- endOffsetY = Math.sin(rad) * (markerEndOffset || 0);
670
- }
671
-
672
- context.moveTo(x1 + startOffsetX, y1 + startOffsetY);
673
-
674
- for (var i = 1; i < length - 1; i++) {
675
- var point = points[i];
676
- context.lineTo(point[0] - defX, point[1] - defY);
677
- }
678
-
679
- context.lineTo(x2 + endOffsetX, y2 + endOffsetY);
680
- }
681
-
682
- function generatePath$6(context, parsedStyle) {
683
- var radius = parsedStyle.radius,
684
- width = parsedStyle.width,
685
- height = parsedStyle.height;
686
- var w = width;
687
- var h = height;
688
- var hasRadius = radius && radius.some(function (r) {
689
- return r !== 0;
690
- });
691
-
692
- if (!hasRadius) {
693
- // Canvas support negative width/height of rect
694
- context.rect(0, 0, w, h);
695
- } else {
696
- var signX = width > 0 ? 1 : -1;
697
- var signY = height > 0 ? 1 : -1;
698
- var sweepFlag = signX + signY === 0;
699
-
700
- var _radius$map = radius.map(function (r) {
701
- return clamp(r, 0, Math.min(Math.abs(w) / 2, Math.abs(h) / 2));
702
- }),
703
- tlr = _radius$map[0],
704
- trr = _radius$map[1],
705
- brr = _radius$map[2],
706
- blr = _radius$map[3];
707
-
708
- context.moveTo(signX * tlr, 0);
709
- context.lineTo(w - signX * trr, 0);
710
-
711
- if (trr !== 0) {
712
- context.arc(w - signX * trr, signY * trr, trr, -signY * Math.PI / 2, signX > 0 ? 0 : Math.PI, sweepFlag);
713
- }
714
-
715
- context.lineTo(w, h - signY * brr);
716
-
717
- if (brr !== 0) {
718
- context.arc(w - signX * brr, h - signY * brr, brr, signX > 0 ? 0 : Math.PI, signY > 0 ? Math.PI / 2 : 1.5 * Math.PI, sweepFlag);
719
- }
720
-
721
- context.lineTo(signX * blr, h);
722
-
723
- if (blr !== 0) {
724
- context.arc(signX * blr, h - signY * blr, blr, signY > 0 ? Math.PI / 2 : -Math.PI / 2, signX > 0 ? Math.PI : 0, sweepFlag);
725
- }
726
-
727
- context.lineTo(0, signY * tlr);
728
-
729
- if (tlr !== 0) {
730
- context.arc(signX * tlr, signY * tlr, tlr, signX > 0 ? Math.PI : 0, signY > 0 ? Math.PI * 1.5 : Math.PI / 2, sweepFlag);
731
- }
1034
+ if (markerEnd && markerEnd instanceof gLite.DisplayObject && markerEndOffset) {
1035
+ x = x1 - x2;
1036
+ y = y1 - y2;
1037
+ rad = Math.atan2(y, x);
1038
+ endOffsetX = Math.cos(rad) * (markerEndOffset || 0);
1039
+ endOffsetY = Math.sin(rad) * (markerEndOffset || 0);
732
1040
  }
733
- }
734
1041
 
735
- var Plugin = /*#__PURE__*/function (_AbstractRendererPlug) {
736
- _inheritsLoose$1(Plugin, _AbstractRendererPlug);
1042
+ context.moveTo(x1 - defX + startOffsetX, y1 - defY + startOffsetY);
1043
+ context.lineTo(x2 - defX + endOffsetX, y2 - defY + endOffsetY);
1044
+ }
737
1045
 
738
- function Plugin() {
739
- var _this;
1046
+ function generatePath$3(context, parsedStyle) {
1047
+ var _parsedStyle$defX = parsedStyle.defX,
1048
+ defX = _parsedStyle$defX === void 0 ? 0 : _parsedStyle$defX,
1049
+ _parsedStyle$defY = parsedStyle.defY,
1050
+ defY = _parsedStyle$defY === void 0 ? 0 : _parsedStyle$defY,
1051
+ markerStart = parsedStyle.markerStart,
1052
+ markerEnd = parsedStyle.markerEnd,
1053
+ markerStartOffset = parsedStyle.markerStartOffset,
1054
+ markerEndOffset = parsedStyle.markerEndOffset;
1055
+ var _parsedStyle$path = parsedStyle.path,
1056
+ absolutePath = _parsedStyle$path.absolutePath,
1057
+ segments = _parsedStyle$path.segments;
1058
+ var startOffsetX = 0;
1059
+ var startOffsetY = 0;
1060
+ var endOffsetX = 0;
1061
+ var endOffsetY = 0;
1062
+ var rad = 0;
1063
+ var x;
1064
+ var y;
740
1065
 
741
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
742
- args[_key] = arguments[_key];
743
- }
1066
+ if (markerStart && markerStart instanceof gLite.DisplayObject && markerStartOffset) {
1067
+ var _markerStart$parentNo = markerStart.parentNode.getStartTangent(),
1068
+ p1 = _markerStart$parentNo[0],
1069
+ p2 = _markerStart$parentNo[1];
744
1070
 
745
- _this = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
746
- _this.name = 'canvas-path-generator';
747
- return _this;
1071
+ x = p1[0] - p2[0];
1072
+ y = p1[1] - p2[1];
1073
+ rad = Math.atan2(y, x);
1074
+ startOffsetX = Math.cos(rad) * (markerStartOffset || 0);
1075
+ startOffsetY = Math.sin(rad) * (markerStartOffset || 0);
748
1076
  }
749
1077
 
750
- var _proto = Plugin.prototype;
751
-
752
- _proto.init = function init() {
753
- var _pathGeneratorFactory;
1078
+ if (markerEnd && markerEnd instanceof gLite.DisplayObject && markerEndOffset) {
1079
+ var _markerEnd$parentNode = markerEnd.parentNode.getEndTangent(),
1080
+ _p = _markerEnd$parentNode[0],
1081
+ _p2 = _markerEnd$parentNode[1];
754
1082
 
755
- var pathGeneratorFactory = (_pathGeneratorFactory = {}, _pathGeneratorFactory[gLite.Shape.CIRCLE] = generatePath, _pathGeneratorFactory[gLite.Shape.ELLIPSE] = generatePath$1, _pathGeneratorFactory[gLite.Shape.RECT] = generatePath$6, _pathGeneratorFactory[gLite.Shape.LINE] = generatePath$2, _pathGeneratorFactory[gLite.Shape.POLYLINE] = generatePath$5, _pathGeneratorFactory[gLite.Shape.POLYGON] = generatePath$4, _pathGeneratorFactory[gLite.Shape.PATH] = generatePath$3, _pathGeneratorFactory[gLite.Shape.TEXT] = undefined, _pathGeneratorFactory[gLite.Shape.GROUP] = undefined, _pathGeneratorFactory[gLite.Shape.IMAGE] = undefined, _pathGeneratorFactory[gLite.Shape.HTML] = undefined, _pathGeneratorFactory[gLite.Shape.MESH] = undefined, _pathGeneratorFactory); // @ts-ignore
1083
+ x = _p[0] - _p2[0];
1084
+ y = _p[1] - _p2[1];
1085
+ rad = Math.atan2(y, x);
1086
+ endOffsetX = Math.cos(rad) * (markerEndOffset || 0);
1087
+ endOffsetY = Math.sin(rad) * (markerEndOffset || 0);
1088
+ }
756
1089
 
757
- this.context.pathGeneratorFactory = pathGeneratorFactory;
758
- };
1090
+ for (var i = 0; i < absolutePath.length; i++) {
1091
+ var params = absolutePath[i];
1092
+ var command = params[0];
1093
+ var nextSegment = absolutePath[i + 1];
1094
+ var useStartOffset = i === 0 && startOffsetX !== 0 && startOffsetY !== 0;
1095
+ var useEndOffset = (i === absolutePath.length - 1 || nextSegment && (nextSegment[0] === 'M' || nextSegment[0] === 'Z')) && endOffsetX !== 0 && endOffsetY !== 0;
759
1096
 
760
- _proto.destroy = function destroy() {
761
- // @ts-ignore
762
- delete this.context.pathGeneratorFactory;
763
- };
1097
+ switch (command) {
1098
+ case 'M':
1099
+ // Use start marker offset
1100
+ if (useStartOffset) {
1101
+ context.moveTo(params[1] - defX + startOffsetX, params[2] - defY + startOffsetY);
1102
+ context.lineTo(params[1] - defX, params[2] - defY);
1103
+ } else {
1104
+ context.moveTo(params[1] - defX, params[2] - defY);
1105
+ }
764
1106
 
765
- return Plugin;
766
- }(gLite.AbstractRendererPlugin);
1107
+ break;
767
1108
 
768
- var index_esm = /*#__PURE__*/Object.freeze({
769
- __proto__: null,
770
- Plugin: Plugin
771
- });
1109
+ case 'L':
1110
+ if (useEndOffset) {
1111
+ context.lineTo(params[1] - defX + endOffsetX, params[2] - defY + endOffsetY);
1112
+ } else {
1113
+ context.lineTo(params[1] - defX, params[2] - defY);
1114
+ }
772
1115
 
773
- function _regeneratorRuntime$1() {
774
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
775
- _regeneratorRuntime$1 = function _regeneratorRuntime() {
776
- return exports;
777
- };
1116
+ break;
778
1117
 
779
- var exports = {},
780
- Op = Object.prototype,
781
- hasOwn = Op.hasOwnProperty,
782
- $Symbol = "function" == typeof Symbol ? Symbol : {},
783
- iteratorSymbol = $Symbol.iterator || "@@iterator",
784
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
785
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
1118
+ case 'Q':
1119
+ context.quadraticCurveTo(params[1] - defX, params[2] - defY, params[3] - defX, params[4] - defY);
786
1120
 
787
- function define(obj, key, value) {
788
- return Object.defineProperty(obj, key, {
789
- value: value,
790
- enumerable: !0,
791
- configurable: !0,
792
- writable: !0
793
- }), obj[key];
794
- }
1121
+ if (useEndOffset) {
1122
+ context.lineTo(params[3] - defX + endOffsetX, params[4] - defY + endOffsetY);
1123
+ }
795
1124
 
796
- try {
797
- define({}, "");
798
- } catch (err) {
799
- define = function define(obj, key, value) {
800
- return obj[key] = value;
801
- };
802
- }
1125
+ break;
803
1126
 
804
- function wrap(innerFn, outerFn, self, tryLocsList) {
805
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
806
- generator = Object.create(protoGenerator.prototype),
807
- context = new Context(tryLocsList || []);
808
- return generator._invoke = function (innerFn, self, context) {
809
- var state = "suspendedStart";
810
- return function (method, arg) {
811
- if ("executing" === state) throw new Error("Generator is already running");
1127
+ case 'C':
1128
+ context.bezierCurveTo(params[1] - defX, params[2] - defY, params[3] - defX, params[4] - defY, params[5] - defX, params[6] - defY);
812
1129
 
813
- if ("completed" === state) {
814
- if ("throw" === method) throw arg;
815
- return doneResult();
1130
+ if (useEndOffset) {
1131
+ context.lineTo(params[5] - defX + endOffsetX, params[6] - defY + endOffsetY);
816
1132
  }
817
1133
 
818
- for (context.method = method, context.arg = arg;;) {
819
- var delegate = context.delegate;
820
-
821
- if (delegate) {
822
- var delegateResult = maybeInvokeDelegate(delegate, context);
1134
+ break;
823
1135
 
824
- if (delegateResult) {
825
- if (delegateResult === ContinueSentinel) continue;
826
- return delegateResult;
827
- }
1136
+ case 'A':
1137
+ {
1138
+ var arcParams = segments[i].arcParams;
1139
+ var cx = arcParams.cx,
1140
+ cy = arcParams.cy,
1141
+ rx = arcParams.rx,
1142
+ ry = arcParams.ry,
1143
+ startAngle = arcParams.startAngle,
1144
+ endAngle = arcParams.endAngle,
1145
+ xRotation = arcParams.xRotation,
1146
+ sweepFlag = arcParams.sweepFlag; // @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/ellipse
1147
+
1148
+ if (context.ellipse) {
1149
+ context.ellipse(cx - defX, cy - defY, rx, ry, xRotation, startAngle, endAngle, !!(1 - sweepFlag));
1150
+ } else {
1151
+ // @see https://stackoverflow.com/a/47494351
1152
+ var r = rx > ry ? rx : ry;
1153
+ var scaleX = rx > ry ? 1 : rx / ry;
1154
+ var scaleY = rx > ry ? ry / rx : 1;
1155
+ context.translate(cx - defX, cy - defY);
1156
+ context.rotate(xRotation);
1157
+ context.scale(scaleX, scaleY);
1158
+ context.arc(0, 0, r, startAngle, endAngle, !!(1 - sweepFlag));
1159
+ context.scale(1 / scaleX, 1 / scaleY);
1160
+ context.rotate(-xRotation);
1161
+ context.translate(-(cx - defX), -(cy - defY));
828
1162
  }
829
1163
 
830
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
831
- if ("suspendedStart" === state) throw state = "completed", context.arg;
832
- context.dispatchException(context.arg);
833
- } else "return" === context.method && context.abrupt("return", context.arg);
834
- state = "executing";
835
- var record = tryCatch(innerFn, self, context);
836
-
837
- if ("normal" === record.type) {
838
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
839
- return {
840
- value: record.arg,
841
- done: context.done
842
- };
1164
+ if (useEndOffset) {
1165
+ context.lineTo(params[6] - defX + endOffsetX, params[7] - defY + endOffsetY);
843
1166
  }
844
1167
 
845
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
1168
+ break;
846
1169
  }
847
- };
848
- }(innerFn, self, context), generator;
849
- }
850
-
851
- function tryCatch(fn, obj, arg) {
852
- try {
853
- return {
854
- type: "normal",
855
- arg: fn.call(obj, arg)
856
- };
857
- } catch (err) {
858
- return {
859
- type: "throw",
860
- arg: err
861
- };
862
- }
863
- }
864
-
865
- exports.wrap = wrap;
866
- var ContinueSentinel = {};
867
-
868
- function Generator() {}
869
-
870
- function GeneratorFunction() {}
871
-
872
- function GeneratorFunctionPrototype() {}
873
-
874
- var IteratorPrototype = {};
875
- define(IteratorPrototype, iteratorSymbol, function () {
876
- return this;
877
- });
878
- var getProto = Object.getPrototypeOf,
879
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
880
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
881
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
882
-
883
- function defineIteratorMethods(prototype) {
884
- ["next", "throw", "return"].forEach(function (method) {
885
- define(prototype, method, function (arg) {
886
- return this._invoke(method, arg);
887
- });
888
- });
889
- }
890
-
891
- function AsyncIterator(generator, PromiseImpl) {
892
- function invoke(method, arg, resolve, reject) {
893
- var record = tryCatch(generator[method], generator, arg);
894
-
895
- if ("throw" !== record.type) {
896
- var result = record.arg,
897
- value = result.value;
898
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
899
- invoke("next", value, resolve, reject);
900
- }, function (err) {
901
- invoke("throw", err, resolve, reject);
902
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
903
- result.value = unwrapped, resolve(result);
904
- }, function (error) {
905
- return invoke("throw", error, resolve, reject);
906
- });
907
- }
908
1170
 
909
- reject(record.arg);
1171
+ case 'Z':
1172
+ context.closePath();
1173
+ break;
910
1174
  }
911
-
912
- var previousPromise;
913
-
914
- this._invoke = function (method, arg) {
915
- function callInvokeWithMethodAndArg() {
916
- return new PromiseImpl(function (resolve, reject) {
917
- invoke(method, arg, resolve, reject);
918
- });
919
- }
920
-
921
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
922
- };
923
1175
  }
1176
+ }
924
1177
 
925
- function maybeInvokeDelegate(delegate, context) {
926
- var method = delegate.iterator[context.method];
927
-
928
- if (undefined === method) {
929
- if (context.delegate = null, "throw" === context.method) {
930
- if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
931
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
932
- }
933
-
934
- return ContinueSentinel;
935
- }
1178
+ function generatePath$4(context, parsedStyle) {
1179
+ var _parsedStyle$defX = parsedStyle.defX,
1180
+ defX = _parsedStyle$defX === void 0 ? 0 : _parsedStyle$defX,
1181
+ _parsedStyle$defY = parsedStyle.defY,
1182
+ defY = _parsedStyle$defY === void 0 ? 0 : _parsedStyle$defY,
1183
+ markerStart = parsedStyle.markerStart,
1184
+ markerEnd = parsedStyle.markerEnd,
1185
+ markerStartOffset = parsedStyle.markerStartOffset,
1186
+ markerEndOffset = parsedStyle.markerEndOffset;
1187
+ var points = parsedStyle.points.points;
1188
+ var length = points.length;
1189
+ var x1 = points[0][0] - defX;
1190
+ var y1 = points[0][1] - defY;
1191
+ var x2 = points[length - 1][0] - defX;
1192
+ var y2 = points[length - 1][1] - defY;
1193
+ var startOffsetX = 0;
1194
+ var startOffsetY = 0;
1195
+ var endOffsetX = 0;
1196
+ var endOffsetY = 0;
1197
+ var rad = 0;
1198
+ var x;
1199
+ var y;
936
1200
 
937
- var record = tryCatch(method, delegate.iterator, context.arg);
938
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
939
- var info = record.arg;
940
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
1201
+ if (markerStart && markerStart instanceof gLite.DisplayObject && markerStartOffset) {
1202
+ x = points[1][0] - points[0][0];
1203
+ y = points[1][1] - points[0][1];
1204
+ rad = Math.atan2(y, x);
1205
+ startOffsetX = Math.cos(rad) * (markerStartOffset || 0);
1206
+ startOffsetY = Math.sin(rad) * (markerStartOffset || 0);
941
1207
  }
942
1208
 
943
- function pushTryEntry(locs) {
944
- var entry = {
945
- tryLoc: locs[0]
946
- };
947
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
1209
+ if (markerEnd && markerEnd instanceof gLite.DisplayObject && markerEndOffset) {
1210
+ x = points[length - 1][0] - points[0][0];
1211
+ y = points[length - 1][1] - points[0][1];
1212
+ rad = Math.atan2(y, x);
1213
+ endOffsetX = Math.cos(rad) * (markerEndOffset || 0);
1214
+ endOffsetY = Math.sin(rad) * (markerEndOffset || 0);
948
1215
  }
949
1216
 
950
- function resetTryEntry(entry) {
951
- var record = entry.completion || {};
952
- record.type = "normal", delete record.arg, entry.completion = record;
953
- }
1217
+ context.moveTo(x1 + (startOffsetX || endOffsetX), y1 + (startOffsetY || endOffsetY));
954
1218
 
955
- function Context(tryLocsList) {
956
- this.tryEntries = [{
957
- tryLoc: "root"
958
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
1219
+ for (var i = 1; i < length - 1; i++) {
1220
+ var point = points[i];
1221
+ context.lineTo(point[0] - defX, point[1] - defY);
959
1222
  }
960
1223
 
961
- function values(iterable) {
962
- if (iterable) {
963
- var iteratorMethod = iterable[iteratorSymbol];
964
- if (iteratorMethod) return iteratorMethod.call(iterable);
965
- if ("function" == typeof iterable.next) return iterable;
966
-
967
- if (!isNaN(iterable.length)) {
968
- var i = -1,
969
- next = function next() {
970
- for (; ++i < iterable.length;) {
971
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
972
- }
1224
+ context.lineTo(x2, y2);
1225
+ }
973
1226
 
974
- return next.value = undefined, next.done = !0, next;
975
- };
1227
+ function generatePath$5(context, parsedStyle) {
1228
+ var _parsedStyle$defX = parsedStyle.defX,
1229
+ defX = _parsedStyle$defX === void 0 ? 0 : _parsedStyle$defX,
1230
+ _parsedStyle$defY = parsedStyle.defY,
1231
+ defY = _parsedStyle$defY === void 0 ? 0 : _parsedStyle$defY,
1232
+ markerStart = parsedStyle.markerStart,
1233
+ markerEnd = parsedStyle.markerEnd,
1234
+ markerStartOffset = parsedStyle.markerStartOffset,
1235
+ markerEndOffset = parsedStyle.markerEndOffset;
1236
+ var points = parsedStyle.points.points;
1237
+ var length = points.length;
1238
+ var x1 = points[0][0] - defX;
1239
+ var y1 = points[0][1] - defY;
1240
+ var x2 = points[length - 1][0] - defX;
1241
+ var y2 = points[length - 1][1] - defY;
1242
+ var startOffsetX = 0;
1243
+ var startOffsetY = 0;
1244
+ var endOffsetX = 0;
1245
+ var endOffsetY = 0;
1246
+ var rad = 0;
1247
+ var x;
1248
+ var y;
976
1249
 
977
- return next.next = next;
978
- }
979
- }
1250
+ if (markerStart && markerStart instanceof gLite.DisplayObject && markerStartOffset) {
1251
+ x = points[1][0] - points[0][0];
1252
+ y = points[1][1] - points[0][1];
1253
+ rad = Math.atan2(y, x);
1254
+ startOffsetX = Math.cos(rad) * (markerStartOffset || 0);
1255
+ startOffsetY = Math.sin(rad) * (markerStartOffset || 0);
1256
+ }
980
1257
 
981
- return {
982
- next: doneResult
983
- };
1258
+ if (markerEnd && markerEnd instanceof gLite.DisplayObject && markerEndOffset) {
1259
+ x = points[length - 2][0] - points[length - 1][0];
1260
+ y = points[length - 2][1] - points[length - 1][1];
1261
+ rad = Math.atan2(y, x);
1262
+ endOffsetX = Math.cos(rad) * (markerEndOffset || 0);
1263
+ endOffsetY = Math.sin(rad) * (markerEndOffset || 0);
984
1264
  }
985
1265
 
986
- function doneResult() {
987
- return {
988
- value: undefined,
989
- done: !0
990
- };
1266
+ context.moveTo(x1 + startOffsetX, y1 + startOffsetY);
1267
+
1268
+ for (var i = 1; i < length - 1; i++) {
1269
+ var point = points[i];
1270
+ context.lineTo(point[0] - defX, point[1] - defY);
991
1271
  }
992
1272
 
993
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
994
- var ctor = "function" == typeof genFun && genFun.constructor;
995
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
996
- }, exports.mark = function (genFun) {
997
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
998
- }, exports.awrap = function (arg) {
999
- return {
1000
- __await: arg
1001
- };
1002
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
1003
- return this;
1004
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
1005
- void 0 === PromiseImpl && (PromiseImpl = Promise);
1006
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
1007
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
1008
- return result.done ? result.value : iter.next();
1009
- });
1010
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
1011
- return this;
1012
- }), define(Gp, "toString", function () {
1013
- return "[object Generator]";
1014
- }), exports.keys = function (object) {
1015
- var keys = [];
1273
+ context.lineTo(x2 + endOffsetX, y2 + endOffsetY);
1274
+ }
1016
1275
 
1017
- for (var key in object) {
1018
- keys.push(key);
1019
- }
1276
+ function generatePath$6(context, parsedStyle) {
1277
+ var radius = parsedStyle.radius,
1278
+ width = parsedStyle.width,
1279
+ height = parsedStyle.height;
1280
+ var w = width;
1281
+ var h = height;
1282
+ var hasRadius = radius && radius.some(function (r) {
1283
+ return r !== 0;
1284
+ });
1020
1285
 
1021
- return keys.reverse(), function next() {
1022
- for (; keys.length;) {
1023
- var key = keys.pop();
1024
- if (key in object) return next.value = key, next.done = !1, next;
1025
- }
1286
+ if (!hasRadius) {
1287
+ // Canvas support negative width/height of rect
1288
+ context.rect(0, 0, w, h);
1289
+ } else {
1290
+ var signX = width > 0 ? 1 : -1;
1291
+ var signY = height > 0 ? 1 : -1;
1292
+ var sweepFlag = signX + signY === 0;
1026
1293
 
1027
- return next.done = !0, next;
1028
- };
1029
- }, exports.values = values, Context.prototype = {
1030
- constructor: Context,
1031
- reset: function reset(skipTempReset) {
1032
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
1033
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
1034
- }
1035
- },
1036
- stop: function stop() {
1037
- this.done = !0;
1038
- var rootRecord = this.tryEntries[0].completion;
1039
- if ("throw" === rootRecord.type) throw rootRecord.arg;
1040
- return this.rval;
1041
- },
1042
- dispatchException: function dispatchException(exception) {
1043
- if (this.done) throw exception;
1044
- var context = this;
1294
+ var _radius$map = radius.map(function (r) {
1295
+ return clamp(r, 0, Math.min(Math.abs(w) / 2, Math.abs(h) / 2));
1296
+ }),
1297
+ tlr = _radius$map[0],
1298
+ trr = _radius$map[1],
1299
+ brr = _radius$map[2],
1300
+ blr = _radius$map[3];
1045
1301
 
1046
- function handle(loc, caught) {
1047
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
1048
- }
1302
+ context.moveTo(signX * tlr, 0);
1303
+ context.lineTo(w - signX * trr, 0);
1049
1304
 
1050
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1051
- var entry = this.tryEntries[i],
1052
- record = entry.completion;
1053
- if ("root" === entry.tryLoc) return handle("end");
1305
+ if (trr !== 0) {
1306
+ context.arc(w - signX * trr, signY * trr, trr, -signY * Math.PI / 2, signX > 0 ? 0 : Math.PI, sweepFlag);
1307
+ }
1054
1308
 
1055
- if (entry.tryLoc <= this.prev) {
1056
- var hasCatch = hasOwn.call(entry, "catchLoc"),
1057
- hasFinally = hasOwn.call(entry, "finallyLoc");
1309
+ context.lineTo(w, h - signY * brr);
1058
1310
 
1059
- if (hasCatch && hasFinally) {
1060
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
1061
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
1062
- } else if (hasCatch) {
1063
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
1064
- } else {
1065
- if (!hasFinally) throw new Error("try statement without catch or finally");
1066
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
1067
- }
1068
- }
1069
- }
1070
- },
1071
- abrupt: function abrupt(type, arg) {
1072
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1073
- var entry = this.tryEntries[i];
1311
+ if (brr !== 0) {
1312
+ context.arc(w - signX * brr, h - signY * brr, brr, signX > 0 ? 0 : Math.PI, signY > 0 ? Math.PI / 2 : 1.5 * Math.PI, sweepFlag);
1313
+ }
1074
1314
 
1075
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
1076
- var finallyEntry = entry;
1077
- break;
1078
- }
1079
- }
1315
+ context.lineTo(signX * blr, h);
1080
1316
 
1081
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
1082
- var record = finallyEntry ? finallyEntry.completion : {};
1083
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
1084
- },
1085
- complete: function complete(record, afterLoc) {
1086
- if ("throw" === record.type) throw record.arg;
1087
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
1088
- },
1089
- finish: function finish(finallyLoc) {
1090
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1091
- var entry = this.tryEntries[i];
1092
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
1093
- }
1094
- },
1095
- catch: function _catch(tryLoc) {
1096
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1097
- var entry = this.tryEntries[i];
1317
+ if (blr !== 0) {
1318
+ context.arc(signX * blr, h - signY * blr, blr, signY > 0 ? Math.PI / 2 : -Math.PI / 2, signX > 0 ? Math.PI : 0, sweepFlag);
1319
+ }
1098
1320
 
1099
- if (entry.tryLoc === tryLoc) {
1100
- var record = entry.completion;
1321
+ context.lineTo(0, signY * tlr);
1101
1322
 
1102
- if ("throw" === record.type) {
1103
- var thrown = record.arg;
1104
- resetTryEntry(entry);
1105
- }
1323
+ if (tlr !== 0) {
1324
+ context.arc(signX * tlr, signY * tlr, tlr, signX > 0 ? Math.PI : 0, signY > 0 ? Math.PI * 1.5 : Math.PI / 2, sweepFlag);
1325
+ }
1326
+ }
1327
+ }
1106
1328
 
1107
- return thrown;
1108
- }
1109
- }
1329
+ var Plugin = /*#__PURE__*/function (_AbstractRendererPlug) {
1330
+ _inheritsLoose$1(Plugin, _AbstractRendererPlug);
1110
1331
 
1111
- throw new Error("illegal catch attempt");
1112
- },
1113
- delegateYield: function delegateYield(iterable, resultName, nextLoc) {
1114
- return this.delegate = {
1115
- iterator: values(iterable),
1116
- resultName: resultName,
1117
- nextLoc: nextLoc
1118
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
1332
+ function Plugin() {
1333
+ var _this;
1334
+
1335
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1336
+ args[_key] = arguments[_key];
1119
1337
  }
1120
- }, exports;
1121
- }
1122
1338
 
1123
- function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
1124
- try {
1125
- var info = gen[key](arg);
1126
- var value = info.value;
1127
- } catch (error) {
1128
- reject(error);
1129
- return;
1339
+ _this = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
1340
+ _this.name = 'canvas-path-generator';
1341
+ return _this;
1130
1342
  }
1131
1343
 
1132
- if (info.done) {
1133
- resolve(value);
1134
- } else {
1135
- Promise.resolve(value).then(_next, _throw);
1136
- }
1137
- }
1344
+ var _proto = Plugin.prototype;
1138
1345
 
1139
- function _asyncToGenerator$1(fn) {
1140
- return function () {
1141
- var self = this,
1142
- args = arguments;
1143
- return new Promise(function (resolve, reject) {
1144
- var gen = fn.apply(self, args);
1346
+ _proto.init = function init() {
1347
+ var _pathGeneratorFactory;
1145
1348
 
1146
- function _next(value) {
1147
- asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
1148
- }
1349
+ var pathGeneratorFactory = (_pathGeneratorFactory = {}, _pathGeneratorFactory[gLite.Shape.CIRCLE] = generatePath, _pathGeneratorFactory[gLite.Shape.ELLIPSE] = generatePath$1, _pathGeneratorFactory[gLite.Shape.RECT] = generatePath$6, _pathGeneratorFactory[gLite.Shape.LINE] = generatePath$2, _pathGeneratorFactory[gLite.Shape.POLYLINE] = generatePath$5, _pathGeneratorFactory[gLite.Shape.POLYGON] = generatePath$4, _pathGeneratorFactory[gLite.Shape.PATH] = generatePath$3, _pathGeneratorFactory[gLite.Shape.TEXT] = undefined, _pathGeneratorFactory[gLite.Shape.GROUP] = undefined, _pathGeneratorFactory[gLite.Shape.IMAGE] = undefined, _pathGeneratorFactory[gLite.Shape.HTML] = undefined, _pathGeneratorFactory[gLite.Shape.MESH] = undefined, _pathGeneratorFactory); // @ts-ignore
1149
1350
 
1150
- function _throw(err) {
1151
- asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
1152
- }
1351
+ this.context.pathGeneratorFactory = pathGeneratorFactory;
1352
+ };
1153
1353
 
1154
- _next(undefined);
1155
- });
1354
+ _proto.destroy = function destroy() {
1355
+ // @ts-ignore
1356
+ delete this.context.pathGeneratorFactory;
1156
1357
  };
1157
- }
1158
1358
 
1159
- function _inheritsLoose$2(subClass, superClass) {
1160
- subClass.prototype = Object.create(superClass.prototype);
1161
- subClass.prototype.constructor = subClass;
1359
+ return Plugin;
1360
+ }(gLite.AbstractRendererPlugin);
1162
1361
 
1163
- _setPrototypeOf$2(subClass, superClass);
1164
- }
1362
+ var index_esm = /*#__PURE__*/Object.freeze({
1363
+ __proto__: null,
1364
+ Plugin: Plugin
1365
+ });
1165
1366
 
1166
- function _setPrototypeOf$2(o, p) {
1167
- _setPrototypeOf$2 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
1168
- o.__proto__ = p;
1169
- return o;
1367
+ function _regeneratorRuntime$1() {
1368
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
1369
+ _regeneratorRuntime$1 = function _regeneratorRuntime() {
1370
+ return exports;
1170
1371
  };
1171
- return _setPrototypeOf$2(o, p);
1172
- }
1173
1372
 
1174
- function _unsupportedIterableToArray(o, minLen) {
1175
- if (!o) return;
1176
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
1177
- var n = Object.prototype.toString.call(o).slice(8, -1);
1178
- if (n === "Object" && o.constructor) n = o.constructor.name;
1179
- if (n === "Map" || n === "Set") return Array.from(o);
1180
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
1181
- }
1373
+ var exports = {},
1374
+ Op = Object.prototype,
1375
+ hasOwn = Op.hasOwnProperty,
1376
+ $Symbol = "function" == typeof Symbol ? Symbol : {},
1377
+ iteratorSymbol = $Symbol.iterator || "@@iterator",
1378
+ asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
1379
+ toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
1182
1380
 
1183
- function _arrayLikeToArray(arr, len) {
1184
- if (len == null || len > arr.length) len = arr.length;
1381
+ function define(obj, key, value) {
1382
+ return Object.defineProperty(obj, key, {
1383
+ value: value,
1384
+ enumerable: !0,
1385
+ configurable: !0,
1386
+ writable: !0
1387
+ }), obj[key];
1388
+ }
1185
1389
 
1186
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
1187
- arr2[i] = arr[i];
1390
+ try {
1391
+ define({}, "");
1392
+ } catch (err) {
1393
+ define = function define(obj, key, value) {
1394
+ return obj[key] = value;
1395
+ };
1188
1396
  }
1189
1397
 
1190
- return arr2;
1191
- }
1398
+ function wrap(innerFn, outerFn, self, tryLocsList) {
1399
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
1400
+ generator = Object.create(protoGenerator.prototype),
1401
+ context = new Context(tryLocsList || []);
1402
+ return generator._invoke = function (innerFn, self, context) {
1403
+ var state = "suspendedStart";
1404
+ return function (method, arg) {
1405
+ if ("executing" === state) throw new Error("Generator is already running");
1192
1406
 
1193
- function _createForOfIteratorHelperLoose(o, allowArrayLike) {
1194
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
1195
- if (it) return (it = it.call(o)).next.bind(it);
1407
+ if ("completed" === state) {
1408
+ if ("throw" === method) throw arg;
1409
+ return doneResult();
1410
+ }
1196
1411
 
1197
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
1198
- if (it) o = it;
1199
- var i = 0;
1200
- return function () {
1201
- if (i >= o.length) return {
1202
- done: true
1203
- };
1204
- return {
1205
- done: false,
1206
- value: o[i++]
1207
- };
1208
- };
1209
- }
1412
+ for (context.method = method, context.arg = arg;;) {
1413
+ var delegate = context.delegate;
1210
1414
 
1211
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1212
- }
1213
- /**
1214
- * Common utilities
1215
- * @module glMatrix
1216
- */
1415
+ if (delegate) {
1416
+ var delegateResult = maybeInvokeDelegate(delegate, context);
1217
1417
 
1418
+ if (delegateResult) {
1419
+ if (delegateResult === ContinueSentinel) continue;
1420
+ return delegateResult;
1421
+ }
1422
+ }
1218
1423
 
1219
- var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;
1220
- if (!Math.hypot) Math.hypot = function () {
1221
- var y = 0,
1222
- i = arguments.length;
1424
+ if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
1425
+ if ("suspendedStart" === state) throw state = "completed", context.arg;
1426
+ context.dispatchException(context.arg);
1427
+ } else "return" === context.method && context.abrupt("return", context.arg);
1428
+ state = "executing";
1429
+ var record = tryCatch(innerFn, self, context);
1223
1430
 
1224
- while (i--) {
1225
- y += arguments[i] * arguments[i];
1431
+ if ("normal" === record.type) {
1432
+ if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
1433
+ return {
1434
+ value: record.arg,
1435
+ done: context.done
1436
+ };
1437
+ }
1438
+
1439
+ "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
1440
+ }
1441
+ };
1442
+ }(innerFn, self, context), generator;
1226
1443
  }
1227
1444
 
1228
- return Math.sqrt(y);
1229
- };
1230
- /**
1231
- * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied.
1232
- * @module mat4
1233
- */
1445
+ function tryCatch(fn, obj, arg) {
1446
+ try {
1447
+ return {
1448
+ type: "normal",
1449
+ arg: fn.call(obj, arg)
1450
+ };
1451
+ } catch (err) {
1452
+ return {
1453
+ type: "throw",
1454
+ arg: err
1455
+ };
1456
+ }
1457
+ }
1234
1458
 
1235
- /**
1236
- * Creates a new identity mat4
1237
- *
1238
- * @returns {mat4} a new 4x4 matrix
1239
- */
1459
+ exports.wrap = wrap;
1460
+ var ContinueSentinel = {};
1240
1461
 
1241
- function create() {
1242
- var out = new ARRAY_TYPE(16);
1462
+ function Generator() {}
1243
1463
 
1244
- if (ARRAY_TYPE != Float32Array) {
1245
- out[1] = 0;
1246
- out[2] = 0;
1247
- out[3] = 0;
1248
- out[4] = 0;
1249
- out[6] = 0;
1250
- out[7] = 0;
1251
- out[8] = 0;
1252
- out[9] = 0;
1253
- out[11] = 0;
1254
- out[12] = 0;
1255
- out[13] = 0;
1256
- out[14] = 0;
1257
- }
1464
+ function GeneratorFunction() {}
1258
1465
 
1259
- out[0] = 1;
1260
- out[5] = 1;
1261
- out[10] = 1;
1262
- out[15] = 1;
1263
- return out;
1264
- }
1265
- /**
1266
- * Inverts a mat4
1267
- *
1268
- * @param {mat4} out the receiving matrix
1269
- * @param {ReadonlyMat4} a the source matrix
1270
- * @returns {mat4} out
1271
- */
1466
+ function GeneratorFunctionPrototype() {}
1467
+
1468
+ var IteratorPrototype = {};
1469
+ define(IteratorPrototype, iteratorSymbol, function () {
1470
+ return this;
1471
+ });
1472
+ var getProto = Object.getPrototypeOf,
1473
+ NativeIteratorPrototype = getProto && getProto(getProto(values([])));
1474
+ NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
1475
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
1476
+
1477
+ function defineIteratorMethods(prototype) {
1478
+ ["next", "throw", "return"].forEach(function (method) {
1479
+ define(prototype, method, function (arg) {
1480
+ return this._invoke(method, arg);
1481
+ });
1482
+ });
1483
+ }
1272
1484
 
1485
+ function AsyncIterator(generator, PromiseImpl) {
1486
+ function invoke(method, arg, resolve, reject) {
1487
+ var record = tryCatch(generator[method], generator, arg);
1273
1488
 
1274
- function invert(out, a) {
1275
- var a00 = a[0],
1276
- a01 = a[1],
1277
- a02 = a[2],
1278
- a03 = a[3];
1279
- var a10 = a[4],
1280
- a11 = a[5],
1281
- a12 = a[6],
1282
- a13 = a[7];
1283
- var a20 = a[8],
1284
- a21 = a[9],
1285
- a22 = a[10],
1286
- a23 = a[11];
1287
- var a30 = a[12],
1288
- a31 = a[13],
1289
- a32 = a[14],
1290
- a33 = a[15];
1291
- var b00 = a00 * a11 - a01 * a10;
1292
- var b01 = a00 * a12 - a02 * a10;
1293
- var b02 = a00 * a13 - a03 * a10;
1294
- var b03 = a01 * a12 - a02 * a11;
1295
- var b04 = a01 * a13 - a03 * a11;
1296
- var b05 = a02 * a13 - a03 * a12;
1297
- var b06 = a20 * a31 - a21 * a30;
1298
- var b07 = a20 * a32 - a22 * a30;
1299
- var b08 = a20 * a33 - a23 * a30;
1300
- var b09 = a21 * a32 - a22 * a31;
1301
- var b10 = a21 * a33 - a23 * a31;
1302
- var b11 = a22 * a33 - a23 * a32; // Calculate the determinant
1489
+ if ("throw" !== record.type) {
1490
+ var result = record.arg,
1491
+ value = result.value;
1492
+ return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
1493
+ invoke("next", value, resolve, reject);
1494
+ }, function (err) {
1495
+ invoke("throw", err, resolve, reject);
1496
+ }) : PromiseImpl.resolve(value).then(function (unwrapped) {
1497
+ result.value = unwrapped, resolve(result);
1498
+ }, function (error) {
1499
+ return invoke("throw", error, resolve, reject);
1500
+ });
1501
+ }
1303
1502
 
1304
- var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
1503
+ reject(record.arg);
1504
+ }
1305
1505
 
1306
- if (!det) {
1307
- return null;
1506
+ var previousPromise;
1507
+
1508
+ this._invoke = function (method, arg) {
1509
+ function callInvokeWithMethodAndArg() {
1510
+ return new PromiseImpl(function (resolve, reject) {
1511
+ invoke(method, arg, resolve, reject);
1512
+ });
1513
+ }
1514
+
1515
+ return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
1516
+ };
1308
1517
  }
1309
1518
 
1310
- det = 1.0 / det;
1311
- out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
1312
- out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
1313
- out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
1314
- out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;
1315
- out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
1316
- out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
1317
- out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
1318
- out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;
1319
- out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
1320
- out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
1321
- out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
1322
- out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;
1323
- out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;
1324
- out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;
1325
- out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;
1326
- out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;
1327
- return out;
1328
- }
1329
- /**
1330
- * 3 Dimensional Vector
1331
- * @module vec3
1332
- */
1519
+ function maybeInvokeDelegate(delegate, context) {
1520
+ var method = delegate.iterator[context.method];
1333
1521
 
1334
- /**
1335
- * Creates a new, empty vec3
1336
- *
1337
- * @returns {vec3} a new 3D vector
1338
- */
1522
+ if (undefined === method) {
1523
+ if (context.delegate = null, "throw" === context.method) {
1524
+ if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
1525
+ context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
1526
+ }
1339
1527
 
1528
+ return ContinueSentinel;
1529
+ }
1340
1530
 
1341
- function create$1() {
1342
- var out = new ARRAY_TYPE(3);
1531
+ var record = tryCatch(method, delegate.iterator, context.arg);
1532
+ if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
1533
+ var info = record.arg;
1534
+ return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
1535
+ }
1343
1536
 
1344
- if (ARRAY_TYPE != Float32Array) {
1345
- out[0] = 0;
1346
- out[1] = 0;
1347
- out[2] = 0;
1537
+ function pushTryEntry(locs) {
1538
+ var entry = {
1539
+ tryLoc: locs[0]
1540
+ };
1541
+ 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
1348
1542
  }
1349
1543
 
1350
- return out;
1351
- }
1352
- /**
1353
- * Creates a new vec3 initialized with the given values
1354
- *
1355
- * @param {Number} x X component
1356
- * @param {Number} y Y component
1357
- * @param {Number} z Z component
1358
- * @returns {vec3} a new 3D vector
1359
- */
1544
+ function resetTryEntry(entry) {
1545
+ var record = entry.completion || {};
1546
+ record.type = "normal", delete record.arg, entry.completion = record;
1547
+ }
1360
1548
 
1549
+ function Context(tryLocsList) {
1550
+ this.tryEntries = [{
1551
+ tryLoc: "root"
1552
+ }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
1553
+ }
1361
1554
 
1362
- function fromValues(x, y, z) {
1363
- var out = new ARRAY_TYPE(3);
1364
- out[0] = x;
1365
- out[1] = y;
1366
- out[2] = z;
1367
- return out;
1368
- }
1369
- /**
1370
- * Set the components of a vec3 to the given values
1371
- *
1372
- * @param {vec3} out the receiving vector
1373
- * @param {Number} x X component
1374
- * @param {Number} y Y component
1375
- * @param {Number} z Z component
1376
- * @returns {vec3} out
1377
- */
1555
+ function values(iterable) {
1556
+ if (iterable) {
1557
+ var iteratorMethod = iterable[iteratorSymbol];
1558
+ if (iteratorMethod) return iteratorMethod.call(iterable);
1559
+ if ("function" == typeof iterable.next) return iterable;
1378
1560
 
1561
+ if (!isNaN(iterable.length)) {
1562
+ var i = -1,
1563
+ next = function next() {
1564
+ for (; ++i < iterable.length;) {
1565
+ if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
1566
+ }
1379
1567
 
1380
- function set(out, x, y, z) {
1381
- out[0] = x;
1382
- out[1] = y;
1383
- out[2] = z;
1384
- return out;
1385
- }
1386
- /**
1387
- * Transforms the vec3 with a mat4.
1388
- * 4th vector component is implicitly '1'
1389
- *
1390
- * @param {vec3} out the receiving vector
1391
- * @param {ReadonlyVec3} a the vector to transform
1392
- * @param {ReadonlyMat4} m matrix to transform with
1393
- * @returns {vec3} out
1394
- */
1568
+ return next.value = undefined, next.done = !0, next;
1569
+ };
1395
1570
 
1571
+ return next.next = next;
1572
+ }
1573
+ }
1396
1574
 
1397
- function transformMat4(out, a, m) {
1398
- var x = a[0],
1399
- y = a[1],
1400
- z = a[2];
1401
- var w = m[3] * x + m[7] * y + m[11] * z + m[15];
1402
- w = w || 1.0;
1403
- out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
1404
- out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
1405
- out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
1406
- return out;
1407
- }
1408
- /**
1409
- * Transforms the vec3 with a mat3.
1410
- *
1411
- * @param {vec3} out the receiving vector
1412
- * @param {ReadonlyVec3} a the vector to transform
1413
- * @param {ReadonlyMat3} m the 3x3 matrix to transform with
1414
- * @returns {vec3} out
1415
- */
1575
+ return {
1576
+ next: doneResult
1577
+ };
1578
+ }
1416
1579
 
1580
+ function doneResult() {
1581
+ return {
1582
+ value: undefined,
1583
+ done: !0
1584
+ };
1585
+ }
1417
1586
 
1418
- function transformMat3(out, a, m) {
1419
- var x = a[0],
1420
- y = a[1],
1421
- z = a[2];
1422
- out[0] = x * m[0] + y * m[3] + z * m[6];
1423
- out[1] = x * m[1] + y * m[4] + z * m[7];
1424
- out[2] = x * m[2] + y * m[5] + z * m[8];
1425
- return out;
1426
- }
1427
- /**
1428
- * Perform some operation over an array of vec3s.
1429
- *
1430
- * @param {Array} a the array of vectors to iterate over
1431
- * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
1432
- * @param {Number} offset Number of elements to skip at the beginning of the array
1433
- * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
1434
- * @param {Function} fn Function to call for each vector in the array
1435
- * @param {Object} [arg] additional argument to pass to fn
1436
- * @returns {Array} a
1437
- * @function
1438
- */
1587
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
1588
+ var ctor = "function" == typeof genFun && genFun.constructor;
1589
+ return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
1590
+ }, exports.mark = function (genFun) {
1591
+ return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
1592
+ }, exports.awrap = function (arg) {
1593
+ return {
1594
+ __await: arg
1595
+ };
1596
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
1597
+ return this;
1598
+ }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
1599
+ void 0 === PromiseImpl && (PromiseImpl = Promise);
1600
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
1601
+ return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
1602
+ return result.done ? result.value : iter.next();
1603
+ });
1604
+ }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
1605
+ return this;
1606
+ }), define(Gp, "toString", function () {
1607
+ return "[object Generator]";
1608
+ }), exports.keys = function (object) {
1609
+ var keys = [];
1610
+
1611
+ for (var key in object) {
1612
+ keys.push(key);
1613
+ }
1439
1614
 
1615
+ return keys.reverse(), function next() {
1616
+ for (; keys.length;) {
1617
+ var key = keys.pop();
1618
+ if (key in object) return next.value = key, next.done = !1, next;
1619
+ }
1440
1620
 
1441
- var forEach = function () {
1442
- var vec = create$1();
1443
- return function (a, stride, offset, count, fn, arg) {
1444
- var i, l;
1621
+ return next.done = !0, next;
1622
+ };
1623
+ }, exports.values = values, Context.prototype = {
1624
+ constructor: Context,
1625
+ reset: function reset(skipTempReset) {
1626
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
1627
+ "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
1628
+ }
1629
+ },
1630
+ stop: function stop() {
1631
+ this.done = !0;
1632
+ var rootRecord = this.tryEntries[0].completion;
1633
+ if ("throw" === rootRecord.type) throw rootRecord.arg;
1634
+ return this.rval;
1635
+ },
1636
+ dispatchException: function dispatchException(exception) {
1637
+ if (this.done) throw exception;
1638
+ var context = this;
1445
1639
 
1446
- if (!stride) {
1447
- stride = 3;
1448
- }
1640
+ function handle(loc, caught) {
1641
+ return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
1642
+ }
1449
1643
 
1450
- if (!offset) {
1451
- offset = 0;
1452
- }
1644
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1645
+ var entry = this.tryEntries[i],
1646
+ record = entry.completion;
1647
+ if ("root" === entry.tryLoc) return handle("end");
1453
1648
 
1454
- if (count) {
1455
- l = Math.min(count * stride + offset, a.length);
1456
- } else {
1457
- l = a.length;
1458
- }
1649
+ if (entry.tryLoc <= this.prev) {
1650
+ var hasCatch = hasOwn.call(entry, "catchLoc"),
1651
+ hasFinally = hasOwn.call(entry, "finallyLoc");
1459
1652
 
1460
- for (i = offset; i < l; i += stride) {
1461
- vec[0] = a[i];
1462
- vec[1] = a[i + 1];
1463
- vec[2] = a[i + 2];
1464
- fn(vec, vec, arg);
1465
- a[i] = vec[0];
1466
- a[i + 1] = vec[1];
1467
- a[i + 2] = vec[2];
1468
- }
1653
+ if (hasCatch && hasFinally) {
1654
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
1655
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
1656
+ } else if (hasCatch) {
1657
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
1658
+ } else {
1659
+ if (!hasFinally) throw new Error("try statement without catch or finally");
1660
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
1661
+ }
1662
+ }
1663
+ }
1664
+ },
1665
+ abrupt: function abrupt(type, arg) {
1666
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1667
+ var entry = this.tryEntries[i];
1469
1668
 
1470
- return a;
1471
- };
1472
- }();
1473
- /**
1474
- * 2 Dimensional Vector
1475
- * @module vec2
1476
- */
1669
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
1670
+ var finallyEntry = entry;
1671
+ break;
1672
+ }
1673
+ }
1477
1674
 
1478
- /**
1479
- * Creates a new, empty vec2
1480
- *
1481
- * @returns {vec2} a new 2D vector
1482
- */
1675
+ finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
1676
+ var record = finallyEntry ? finallyEntry.completion : {};
1677
+ return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
1678
+ },
1679
+ complete: function complete(record, afterLoc) {
1680
+ if ("throw" === record.type) throw record.arg;
1681
+ return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
1682
+ },
1683
+ finish: function finish(finallyLoc) {
1684
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1685
+ var entry = this.tryEntries[i];
1686
+ if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
1687
+ }
1688
+ },
1689
+ catch: function _catch(tryLoc) {
1690
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1691
+ var entry = this.tryEntries[i];
1483
1692
 
1693
+ if (entry.tryLoc === tryLoc) {
1694
+ var record = entry.completion;
1484
1695
 
1485
- function create$2() {
1486
- var out = new ARRAY_TYPE(2);
1696
+ if ("throw" === record.type) {
1697
+ var thrown = record.arg;
1698
+ resetTryEntry(entry);
1699
+ }
1487
1700
 
1488
- if (ARRAY_TYPE != Float32Array) {
1489
- out[0] = 0;
1490
- out[1] = 0;
1701
+ return thrown;
1702
+ }
1703
+ }
1704
+
1705
+ throw new Error("illegal catch attempt");
1706
+ },
1707
+ delegateYield: function delegateYield(iterable, resultName, nextLoc) {
1708
+ return this.delegate = {
1709
+ iterator: values(iterable),
1710
+ resultName: resultName,
1711
+ nextLoc: nextLoc
1712
+ }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
1713
+ }
1714
+ }, exports;
1715
+ }
1716
+
1717
+ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
1718
+ try {
1719
+ var info = gen[key](arg);
1720
+ var value = info.value;
1721
+ } catch (error) {
1722
+ reject(error);
1723
+ return;
1491
1724
  }
1492
1725
 
1493
- return out;
1726
+ if (info.done) {
1727
+ resolve(value);
1728
+ } else {
1729
+ Promise.resolve(value).then(_next, _throw);
1730
+ }
1494
1731
  }
1495
- /**
1496
- * Normalize a vec2
1497
- *
1498
- * @param {vec2} out the receiving vector
1499
- * @param {ReadonlyVec2} a vector to normalize
1500
- * @returns {vec2} out
1501
- */
1502
1732
 
1733
+ function _asyncToGenerator$1(fn) {
1734
+ return function () {
1735
+ var self = this,
1736
+ args = arguments;
1737
+ return new Promise(function (resolve, reject) {
1738
+ var gen = fn.apply(self, args);
1503
1739
 
1504
- function normalize(out, a) {
1505
- var x = a[0],
1506
- y = a[1];
1507
- var len = x * x + y * y;
1740
+ function _next(value) {
1741
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
1742
+ }
1508
1743
 
1509
- if (len > 0) {
1510
- //TODO: evaluate use of glm_invsqrt here?
1511
- len = 1 / Math.sqrt(len);
1512
- }
1744
+ function _throw(err) {
1745
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
1746
+ }
1513
1747
 
1514
- out[0] = a[0] * len;
1515
- out[1] = a[1] * len;
1516
- return out;
1748
+ _next(undefined);
1749
+ });
1750
+ };
1517
1751
  }
1518
- /**
1519
- * Calculates the dot product of two vec2's
1520
- *
1521
- * @param {ReadonlyVec2} a the first operand
1522
- * @param {ReadonlyVec2} b the second operand
1523
- * @returns {Number} dot product of a and b
1524
- */
1525
1752
 
1753
+ function _inheritsLoose$2(subClass, superClass) {
1754
+ subClass.prototype = Object.create(superClass.prototype);
1755
+ subClass.prototype.constructor = subClass;
1526
1756
 
1527
- function dot(a, b) {
1528
- return a[0] * b[0] + a[1] * b[1];
1757
+ _setPrototypeOf$2(subClass, superClass);
1529
1758
  }
1530
- /**
1531
- * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)
1532
- *
1533
- * @param {ReadonlyVec2} a The first vector.
1534
- * @param {ReadonlyVec2} b The second vector.
1535
- * @returns {Boolean} True if the vectors are equal, false otherwise.
1536
- */
1537
1759
 
1538
-
1539
- function exactEquals(a, b) {
1540
- return a[0] === b[0] && a[1] === b[1];
1760
+ function _setPrototypeOf$2(o, p) {
1761
+ _setPrototypeOf$2 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
1762
+ o.__proto__ = p;
1763
+ return o;
1764
+ };
1765
+ return _setPrototypeOf$2(o, p);
1541
1766
  }
1542
- /**
1543
- * Perform some operation over an array of vec2s.
1544
- *
1545
- * @param {Array} a the array of vectors to iterate over
1546
- * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed
1547
- * @param {Number} offset Number of elements to skip at the beginning of the array
1548
- * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array
1549
- * @param {Function} fn Function to call for each vector in the array
1550
- * @param {Object} [arg] additional argument to pass to fn
1551
- * @returns {Array} a
1552
- * @function
1553
- */
1554
1767
 
1768
+ function _unsupportedIterableToArray(o, minLen) {
1769
+ if (!o) return;
1770
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
1771
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1772
+ if (n === "Object" && o.constructor) n = o.constructor.name;
1773
+ if (n === "Map" || n === "Set") return Array.from(o);
1774
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
1775
+ }
1555
1776
 
1556
- var forEach$1 = function () {
1557
- var vec = create$2();
1558
- return function (a, stride, offset, count, fn, arg) {
1559
- var i, l;
1777
+ function _arrayLikeToArray(arr, len) {
1778
+ if (len == null || len > arr.length) len = arr.length;
1560
1779
 
1561
- if (!stride) {
1562
- stride = 2;
1563
- }
1780
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
1781
+ arr2[i] = arr[i];
1782
+ }
1564
1783
 
1565
- if (!offset) {
1566
- offset = 0;
1567
- }
1784
+ return arr2;
1785
+ }
1568
1786
 
1569
- if (count) {
1570
- l = Math.min(count * stride + offset, a.length);
1571
- } else {
1572
- l = a.length;
1573
- }
1787
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
1788
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
1789
+ if (it) return (it = it.call(o)).next.bind(it);
1574
1790
 
1575
- for (i = offset; i < l; i += stride) {
1576
- vec[0] = a[i];
1577
- vec[1] = a[i + 1];
1578
- fn(vec, vec, arg);
1579
- a[i] = vec[0];
1580
- a[i + 1] = vec[1];
1581
- }
1791
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
1792
+ if (it) o = it;
1793
+ var i = 0;
1794
+ return function () {
1795
+ if (i >= o.length) return {
1796
+ done: true
1797
+ };
1798
+ return {
1799
+ done: false,
1800
+ value: o[i++]
1801
+ };
1802
+ };
1803
+ }
1582
1804
 
1583
- return a;
1584
- };
1585
- }();
1805
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1806
+ }
1586
1807
 
1587
1808
  var tmpVec3a = create$1();
1588
1809
  var tmpVec3b = create$1();
@@ -1603,7 +1824,7 @@
1603
1824
  this.pathGeneratorFactory = void 0;
1604
1825
  this.pointInPathPickerFactory = void 0;
1605
1826
 
1606
- this.isHit = function (displayObject, position, worldTransform) {
1827
+ this.isHit = function (displayObject, position, worldTransform, isClipPath) {
1607
1828
  // use picker for current shape's type
1608
1829
  var pick = _this.pointInPathPickerFactory[displayObject.nodeName];
1609
1830
 
@@ -1620,7 +1841,7 @@
1620
1841
  localPosition[0] += (anchor && anchor[0] || 0) * halfExtents[0] * 2;
1621
1842
  localPosition[1] += (anchor && anchor[1] || 0) * halfExtents[1] * 2;
1622
1843
 
1623
- if (pick(displayObject, new gLite.Point(localPosition[0], localPosition[1]), _this.isPointInPath)) {
1844
+ if (pick(displayObject, new gLite.Point(localPosition[0], localPosition[1]), isClipPath, _this.isPointInPath)) {
1624
1845
  return true;
1625
1846
  }
1626
1847
  }
@@ -1698,7 +1919,7 @@
1698
1919
  for (var _iterator = _createForOfIteratorHelperLoose(hitTestList), _step; !(_step = _iterator()).done;) {
1699
1920
  var displayObject = _step.value;
1700
1921
  var worldTransform = displayObject.getWorldTransform();
1701
- var isHitOriginShape = this.isHit(displayObject, position, worldTransform);
1922
+ var isHitOriginShape = this.isHit(displayObject, position, worldTransform, false);
1702
1923
 
1703
1924
  if (isHitOriginShape) {
1704
1925
  // should look up in the ancestor node
@@ -1706,7 +1927,7 @@
1706
1927
 
1707
1928
  if (clipped) {
1708
1929
  var clipPath = clipped.parsedStyle.clipPath;
1709
- var isHitClipPath = this.isHit(clipPath, position, clipPath.getWorldTransform());
1930
+ var isHitClipPath = this.isHit(clipPath, position, clipPath.getWorldTransform(), true);
1710
1931
 
1711
1932
  if (isHitClipPath) {
1712
1933
  if (topmost) {
@@ -2219,10 +2440,9 @@
2219
2440
 
2220
2441
  function inArc(cx, cy, r, startAngle, endAngle, lineWidth, x, y) {
2221
2442
  var angle = (Math.atan2(y - cy, x - cx) + Math.PI * 2) % (Math.PI * 2); // 转换到 0 - 2 * Math.PI 之间
2222
-
2223
- if (angle < startAngle || angle > endAngle) {
2224
- return false;
2225
- }
2443
+ // if (angle < startAngle || angle > endAngle) {
2444
+ // return false;
2445
+ // }
2226
2446
 
2227
2447
  var point = {
2228
2448
  x: cx + r * Math.cos(angle),
@@ -2342,18 +2562,16 @@
2342
2562
  return isHit;
2343
2563
  }
2344
2564
 
2345
- function isPointInPath(displayObject, position) {
2565
+ function isPointInPath(displayObject, position, isClipPath) {
2346
2566
  var _displayObject$parsed = displayObject.parsedStyle,
2347
2567
  r = _displayObject$parsed.r,
2348
2568
  fill = _displayObject$parsed.fill,
2349
2569
  stroke = _displayObject$parsed.stroke,
2350
2570
  lineWidth = _displayObject$parsed.lineWidth,
2351
2571
  increasedLineWidthForHitTesting = _displayObject$parsed.increasedLineWidthForHitTesting,
2352
- clipPathTargets = _displayObject$parsed.clipPathTargets,
2353
2572
  pointerEvents = _displayObject$parsed.pointerEvents;
2354
2573
  var halfLineWidth = ((lineWidth || 0) + (increasedLineWidthForHitTesting || 0)) / 2;
2355
2574
  var absDistance = distance$1(r, r, position.x, position.y);
2356
- var isClipPath = !!(clipPathTargets === null || clipPathTargets === void 0 ? void 0 : clipPathTargets.length);
2357
2575
 
2358
2576
  var _isFillOrStrokeAffect = gLite.isFillOrStrokeAffected(pointerEvents, fill, stroke),
2359
2577
  hasFill = _isFillOrStrokeAffect[0],
@@ -2378,9 +2596,7 @@
2378
2596
  return squareX / (rx * rx) + squareY / (ry * ry);
2379
2597
  }
2380
2598
 
2381
- function isPointInPath$1(displayObject, _ref) {
2382
- var x = _ref.x,
2383
- y = _ref.y;
2599
+ function isPointInPath$1(displayObject, position, isClipPath) {
2384
2600
  var _displayObject$parsed = displayObject.parsedStyle,
2385
2601
  rx = _displayObject$parsed.rx,
2386
2602
  ry = _displayObject$parsed.ry,
@@ -2388,9 +2604,9 @@
2388
2604
  stroke = _displayObject$parsed.stroke,
2389
2605
  lineWidth = _displayObject$parsed.lineWidth,
2390
2606
  increasedLineWidthForHitTesting = _displayObject$parsed.increasedLineWidthForHitTesting,
2391
- clipPathTargets = _displayObject$parsed.clipPathTargets,
2392
2607
  pointerEvents = _displayObject$parsed.pointerEvents;
2393
- var isClipPath = !!(clipPathTargets === null || clipPathTargets === void 0 ? void 0 : clipPathTargets.length);
2608
+ var x = position.x,
2609
+ y = position.y;
2394
2610
 
2395
2611
  var _isFillOrStrokeAffect = gLite.isFillOrStrokeAffected(pointerEvents, fill, stroke),
2396
2612
  hasFill = _isFillOrStrokeAffect[0],
@@ -2415,7 +2631,7 @@
2415
2631
  return false;
2416
2632
  }
2417
2633
 
2418
- function isPointInPath$2(displayObject, position) {
2634
+ function isPointInPath$2(displayObject, position, isClipPath) {
2419
2635
  var _displayObject$parsed = displayObject.parsedStyle,
2420
2636
  x1 = _displayObject$parsed.x1,
2421
2637
  y1 = _displayObject$parsed.y1,
@@ -2427,11 +2643,9 @@
2427
2643
  x = _displayObject$parsed2 === void 0 ? 0 : _displayObject$parsed2,
2428
2644
  _displayObject$parsed3 = _displayObject$parsed.defY,
2429
2645
  y = _displayObject$parsed3 === void 0 ? 0 : _displayObject$parsed3,
2430
- clipPathTargets = _displayObject$parsed.clipPathTargets,
2431
2646
  pointerEvents = _displayObject$parsed.pointerEvents,
2432
2647
  fill = _displayObject$parsed.fill,
2433
- stroke = _displayObject$parsed.stroke;
2434
- var isClipPath = !!(clipPathTargets === null || clipPathTargets === void 0 ? void 0 : clipPathTargets.length); // eslint-disable-next-line @typescript-eslint/no-unused-vars
2648
+ stroke = _displayObject$parsed.stroke; // eslint-disable-next-line @typescript-eslint/no-unused-vars
2435
2649
 
2436
2650
  var _isFillOrStrokeAffect = gLite.isFillOrStrokeAffected(pointerEvents, fill, stroke),
2437
2651
  _ = _isFillOrStrokeAffect[0],
@@ -2505,7 +2719,7 @@
2505
2719
  return isHit;
2506
2720
  }
2507
2721
 
2508
- function isPointInPath$3(displayObject, position, isPointInPath) {
2722
+ function isPointInPath$3(displayObject, position, isClipPath, isPointInPath) {
2509
2723
  var _displayObject$parsed = displayObject.parsedStyle,
2510
2724
  lineWidth = _displayObject$parsed.lineWidth,
2511
2725
  increasedLineWidthForHitTesting = _displayObject$parsed.increasedLineWidthForHitTesting,
@@ -2515,7 +2729,6 @@
2515
2729
  x = _displayObject$parsed2 === void 0 ? 0 : _displayObject$parsed2,
2516
2730
  _displayObject$parsed3 = _displayObject$parsed.defY,
2517
2731
  y = _displayObject$parsed3 === void 0 ? 0 : _displayObject$parsed3,
2518
- clipPathTargets = _displayObject$parsed.clipPathTargets,
2519
2732
  path = _displayObject$parsed.path,
2520
2733
  pointerEvents = _displayObject$parsed.pointerEvents;
2521
2734
 
@@ -2528,7 +2741,6 @@
2528
2741
  polylines = path.polylines,
2529
2742
  polygons = path.polygons;
2530
2743
  var totalLength = gLite.getOrCalculatePathTotalLength(displayObject);
2531
- var isClipPath = !!(clipPathTargets === null || clipPathTargets === void 0 ? void 0 : clipPathTargets.length);
2532
2744
  var isHit = false;
2533
2745
 
2534
2746
  if (hasFill || isClipPath) {
@@ -2570,7 +2782,7 @@
2570
2782
  return isHit;
2571
2783
  }
2572
2784
 
2573
- function isPointInPath$4(displayObject, position) {
2785
+ function isPointInPath$4(displayObject, position, isClipPath) {
2574
2786
  var _displayObject$parsed = displayObject.parsedStyle,
2575
2787
  stroke = _displayObject$parsed.stroke,
2576
2788
  fill = _displayObject$parsed.fill,
@@ -2581,9 +2793,7 @@
2581
2793
  x = _displayObject$parsed2 === void 0 ? 0 : _displayObject$parsed2,
2582
2794
  _displayObject$parsed3 = _displayObject$parsed.defY,
2583
2795
  y = _displayObject$parsed3 === void 0 ? 0 : _displayObject$parsed3,
2584
- clipPathTargets = _displayObject$parsed.clipPathTargets,
2585
2796
  pointerEvents = _displayObject$parsed.pointerEvents;
2586
- var isClipPath = !!(clipPathTargets === null || clipPathTargets === void 0 ? void 0 : clipPathTargets.length);
2587
2797
 
2588
2798
  var _isFillOrStrokeAffect = gLite.isFillOrStrokeAffected(pointerEvents, fill, stroke),
2589
2799
  hasFill = _isFillOrStrokeAffect[0],
@@ -2602,7 +2812,7 @@
2602
2812
  return isHit;
2603
2813
  }
2604
2814
 
2605
- function isPointInPath$5(displayObject, position) {
2815
+ function isPointInPath$5(displayObject, position, isClipPath) {
2606
2816
  var _displayObject$parsed = displayObject.parsedStyle,
2607
2817
  lineWidth = _displayObject$parsed.lineWidth,
2608
2818
  increasedLineWidthForHitTesting = _displayObject$parsed.increasedLineWidthForHitTesting,
@@ -2611,14 +2821,11 @@
2611
2821
  x = _displayObject$parsed2 === void 0 ? 0 : _displayObject$parsed2,
2612
2822
  _displayObject$parsed3 = _displayObject$parsed.defY,
2613
2823
  y = _displayObject$parsed3 === void 0 ? 0 : _displayObject$parsed3,
2614
- clipPathTargets = _displayObject$parsed.clipPathTargets,
2615
2824
  pointerEvents = _displayObject$parsed.pointerEvents,
2616
2825
  fill = _displayObject$parsed.fill,
2617
2826
  stroke = _displayObject$parsed.stroke;
2618
- var isClipPath = !!(clipPathTargets === null || clipPathTargets === void 0 ? void 0 : clipPathTargets.length); // eslint-disable-next-line @typescript-eslint/no-unused-vars
2619
2827
 
2620
2828
  var _isFillOrStrokeAffect = gLite.isFillOrStrokeAffected(pointerEvents, fill, stroke),
2621
- _ = _isFillOrStrokeAffect[0],
2622
2829
  hasStroke = _isFillOrStrokeAffect[1];
2623
2830
 
2624
2831
  if (!hasStroke && !isClipPath || !lineWidth) {
@@ -2628,7 +2835,7 @@
2628
2835
  return inPolyline(points.points, (lineWidth || 0) + (increasedLineWidthForHitTesting || 0), position.x + x, position.y + y, false);
2629
2836
  }
2630
2837
 
2631
- function isPointInPath$6(displayObject, position, isPointInPath) {
2838
+ function isPointInPath$6(displayObject, position, isClipPath, isPointInPath) {
2632
2839
  var _displayObject$parsed = displayObject.parsedStyle,
2633
2840
  radius = _displayObject$parsed.radius,
2634
2841
  fill = _displayObject$parsed.fill,
@@ -2637,9 +2844,7 @@
2637
2844
  increasedLineWidthForHitTesting = _displayObject$parsed.increasedLineWidthForHitTesting,
2638
2845
  width = _displayObject$parsed.width,
2639
2846
  height = _displayObject$parsed.height,
2640
- clipPathTargets = _displayObject$parsed.clipPathTargets,
2641
2847
  pointerEvents = _displayObject$parsed.pointerEvents;
2642
- var isClipPath = !!(clipPathTargets === null || clipPathTargets === void 0 ? void 0 : clipPathTargets.length);
2643
2848
 
2644
2849
  var _isFillOrStrokeAffect = gLite.isFillOrStrokeAffected(pointerEvents, fill, stroke),
2645
2850
  hasFill = _isFillOrStrokeAffect[0],
@@ -2910,589 +3115,251 @@
2910
3115
 
2911
3116
  function pushTryEntry(locs) {
2912
3117
  var entry = {
2913
- tryLoc: locs[0]
2914
- };
2915
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
2916
- }
2917
-
2918
- function resetTryEntry(entry) {
2919
- var record = entry.completion || {};
2920
- record.type = "normal", delete record.arg, entry.completion = record;
2921
- }
2922
-
2923
- function Context(tryLocsList) {
2924
- this.tryEntries = [{
2925
- tryLoc: "root"
2926
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
2927
- }
2928
-
2929
- function values(iterable) {
2930
- if (iterable) {
2931
- var iteratorMethod = iterable[iteratorSymbol];
2932
- if (iteratorMethod) return iteratorMethod.call(iterable);
2933
- if ("function" == typeof iterable.next) return iterable;
2934
-
2935
- if (!isNaN(iterable.length)) {
2936
- var i = -1,
2937
- next = function next() {
2938
- for (; ++i < iterable.length;) {
2939
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
2940
- }
2941
-
2942
- return next.value = undefined, next.done = !0, next;
2943
- };
2944
-
2945
- return next.next = next;
2946
- }
2947
- }
2948
-
2949
- return {
2950
- next: doneResult
2951
- };
2952
- }
2953
-
2954
- function doneResult() {
2955
- return {
2956
- value: undefined,
2957
- done: !0
2958
- };
2959
- }
2960
-
2961
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
2962
- var ctor = "function" == typeof genFun && genFun.constructor;
2963
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
2964
- }, exports.mark = function (genFun) {
2965
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
2966
- }, exports.awrap = function (arg) {
2967
- return {
2968
- __await: arg
2969
- };
2970
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
2971
- return this;
2972
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
2973
- void 0 === PromiseImpl && (PromiseImpl = Promise);
2974
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
2975
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
2976
- return result.done ? result.value : iter.next();
2977
- });
2978
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
2979
- return this;
2980
- }), define(Gp, "toString", function () {
2981
- return "[object Generator]";
2982
- }), exports.keys = function (object) {
2983
- var keys = [];
2984
-
2985
- for (var key in object) {
2986
- keys.push(key);
2987
- }
2988
-
2989
- return keys.reverse(), function next() {
2990
- for (; keys.length;) {
2991
- var key = keys.pop();
2992
- if (key in object) return next.value = key, next.done = !1, next;
2993
- }
2994
-
2995
- return next.done = !0, next;
2996
- };
2997
- }, exports.values = values, Context.prototype = {
2998
- constructor: Context,
2999
- reset: function reset(skipTempReset) {
3000
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
3001
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
3002
- }
3003
- },
3004
- stop: function stop() {
3005
- this.done = !0;
3006
- var rootRecord = this.tryEntries[0].completion;
3007
- if ("throw" === rootRecord.type) throw rootRecord.arg;
3008
- return this.rval;
3009
- },
3010
- dispatchException: function dispatchException(exception) {
3011
- if (this.done) throw exception;
3012
- var context = this;
3013
-
3014
- function handle(loc, caught) {
3015
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
3016
- }
3017
-
3018
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3019
- var entry = this.tryEntries[i],
3020
- record = entry.completion;
3021
- if ("root" === entry.tryLoc) return handle("end");
3022
-
3023
- if (entry.tryLoc <= this.prev) {
3024
- var hasCatch = hasOwn.call(entry, "catchLoc"),
3025
- hasFinally = hasOwn.call(entry, "finallyLoc");
3026
-
3027
- if (hasCatch && hasFinally) {
3028
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
3029
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
3030
- } else if (hasCatch) {
3031
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
3032
- } else {
3033
- if (!hasFinally) throw new Error("try statement without catch or finally");
3034
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
3035
- }
3036
- }
3037
- }
3038
- },
3039
- abrupt: function abrupt(type, arg) {
3040
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3041
- var entry = this.tryEntries[i];
3042
-
3043
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
3044
- var finallyEntry = entry;
3045
- break;
3046
- }
3047
- }
3048
-
3049
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
3050
- var record = finallyEntry ? finallyEntry.completion : {};
3051
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
3052
- },
3053
- complete: function complete(record, afterLoc) {
3054
- if ("throw" === record.type) throw record.arg;
3055
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
3056
- },
3057
- finish: function finish(finallyLoc) {
3058
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3059
- var entry = this.tryEntries[i];
3060
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
3061
- }
3062
- },
3063
- catch: function _catch(tryLoc) {
3064
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3065
- var entry = this.tryEntries[i];
3066
-
3067
- if (entry.tryLoc === tryLoc) {
3068
- var record = entry.completion;
3069
-
3070
- if ("throw" === record.type) {
3071
- var thrown = record.arg;
3072
- resetTryEntry(entry);
3073
- }
3074
-
3075
- return thrown;
3076
- }
3077
- }
3078
-
3079
- throw new Error("illegal catch attempt");
3080
- },
3081
- delegateYield: function delegateYield(iterable, resultName, nextLoc) {
3082
- return this.delegate = {
3083
- iterator: values(iterable),
3084
- resultName: resultName,
3085
- nextLoc: nextLoc
3086
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
3087
- }
3088
- }, exports;
3089
- }
3090
-
3091
- function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
3092
- try {
3093
- var info = gen[key](arg);
3094
- var value = info.value;
3095
- } catch (error) {
3096
- reject(error);
3097
- return;
3098
- }
3099
-
3100
- if (info.done) {
3101
- resolve(value);
3102
- } else {
3103
- Promise.resolve(value).then(_next, _throw);
3104
- }
3105
- }
3106
-
3107
- function _asyncToGenerator$2(fn) {
3108
- return function () {
3109
- var self = this,
3110
- args = arguments;
3111
- return new Promise(function (resolve, reject) {
3112
- var gen = fn.apply(self, args);
3113
-
3114
- function _next(value) {
3115
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
3116
- }
3117
-
3118
- function _throw(err) {
3119
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
3120
- }
3121
-
3122
- _next(undefined);
3123
- });
3124
- };
3125
- }
3126
-
3127
- function _extends() {
3128
- _extends = Object.assign ? Object.assign.bind() : function (target) {
3129
- for (var i = 1; i < arguments.length; i++) {
3130
- var source = arguments[i];
3131
-
3132
- for (var key in source) {
3133
- if (Object.prototype.hasOwnProperty.call(source, key)) {
3134
- target[key] = source[key];
3135
- }
3136
- }
3137
- }
3118
+ tryLoc: locs[0]
3119
+ };
3120
+ 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
3121
+ }
3138
3122
 
3139
- return target;
3140
- };
3141
- return _extends.apply(this, arguments);
3142
- }
3123
+ function resetTryEntry(entry) {
3124
+ var record = entry.completion || {};
3125
+ record.type = "normal", delete record.arg, entry.completion = record;
3126
+ }
3143
3127
 
3144
- function _inheritsLoose$3(subClass, superClass) {
3145
- subClass.prototype = Object.create(superClass.prototype);
3146
- subClass.prototype.constructor = subClass;
3128
+ function Context(tryLocsList) {
3129
+ this.tryEntries = [{
3130
+ tryLoc: "root"
3131
+ }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
3132
+ }
3147
3133
 
3148
- _setPrototypeOf$3(subClass, superClass);
3149
- }
3134
+ function values(iterable) {
3135
+ if (iterable) {
3136
+ var iteratorMethod = iterable[iteratorSymbol];
3137
+ if (iteratorMethod) return iteratorMethod.call(iterable);
3138
+ if ("function" == typeof iterable.next) return iterable;
3150
3139
 
3151
- function _setPrototypeOf$3(o, p) {
3152
- _setPrototypeOf$3 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
3153
- o.__proto__ = p;
3154
- return o;
3155
- };
3156
- return _setPrototypeOf$3(o, p);
3157
- }
3158
- /**
3159
- * Common utilities
3160
- * @module glMatrix
3161
- */
3140
+ if (!isNaN(iterable.length)) {
3141
+ var i = -1,
3142
+ next = function next() {
3143
+ for (; ++i < iterable.length;) {
3144
+ if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
3145
+ }
3162
3146
 
3147
+ return next.value = undefined, next.done = !0, next;
3148
+ };
3163
3149
 
3164
- var ARRAY_TYPE$1 = typeof Float32Array !== 'undefined' ? Float32Array : Array;
3165
- if (!Math.hypot) Math.hypot = function () {
3166
- var y = 0,
3167
- i = arguments.length;
3150
+ return next.next = next;
3151
+ }
3152
+ }
3168
3153
 
3169
- while (i--) {
3170
- y += arguments[i] * arguments[i];
3154
+ return {
3155
+ next: doneResult
3156
+ };
3171
3157
  }
3172
3158
 
3173
- return Math.sqrt(y);
3174
- };
3175
- /**
3176
- * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied.
3177
- * @module mat4
3178
- */
3179
-
3180
- /**
3181
- * Creates a new identity mat4
3182
- *
3183
- * @returns {mat4} a new 4x4 matrix
3184
- */
3159
+ function doneResult() {
3160
+ return {
3161
+ value: undefined,
3162
+ done: !0
3163
+ };
3164
+ }
3185
3165
 
3186
- function create$3() {
3187
- var out = new ARRAY_TYPE$1(16);
3166
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
3167
+ var ctor = "function" == typeof genFun && genFun.constructor;
3168
+ return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
3169
+ }, exports.mark = function (genFun) {
3170
+ return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
3171
+ }, exports.awrap = function (arg) {
3172
+ return {
3173
+ __await: arg
3174
+ };
3175
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
3176
+ return this;
3177
+ }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
3178
+ void 0 === PromiseImpl && (PromiseImpl = Promise);
3179
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
3180
+ return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
3181
+ return result.done ? result.value : iter.next();
3182
+ });
3183
+ }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
3184
+ return this;
3185
+ }), define(Gp, "toString", function () {
3186
+ return "[object Generator]";
3187
+ }), exports.keys = function (object) {
3188
+ var keys = [];
3188
3189
 
3189
- if (ARRAY_TYPE$1 != Float32Array) {
3190
- out[1] = 0;
3191
- out[2] = 0;
3192
- out[3] = 0;
3193
- out[4] = 0;
3194
- out[6] = 0;
3195
- out[7] = 0;
3196
- out[8] = 0;
3197
- out[9] = 0;
3198
- out[11] = 0;
3199
- out[12] = 0;
3200
- out[13] = 0;
3201
- out[14] = 0;
3202
- }
3190
+ for (var key in object) {
3191
+ keys.push(key);
3192
+ }
3203
3193
 
3204
- out[0] = 1;
3205
- out[5] = 1;
3206
- out[10] = 1;
3207
- out[15] = 1;
3208
- return out;
3209
- }
3210
- /**
3211
- * Copy the values from one mat4 to another
3212
- *
3213
- * @param {mat4} out the receiving matrix
3214
- * @param {ReadonlyMat4} a the source matrix
3215
- * @returns {mat4} out
3216
- */
3194
+ return keys.reverse(), function next() {
3195
+ for (; keys.length;) {
3196
+ var key = keys.pop();
3197
+ if (key in object) return next.value = key, next.done = !1, next;
3198
+ }
3217
3199
 
3200
+ return next.done = !0, next;
3201
+ };
3202
+ }, exports.values = values, Context.prototype = {
3203
+ constructor: Context,
3204
+ reset: function reset(skipTempReset) {
3205
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
3206
+ "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
3207
+ }
3208
+ },
3209
+ stop: function stop() {
3210
+ this.done = !0;
3211
+ var rootRecord = this.tryEntries[0].completion;
3212
+ if ("throw" === rootRecord.type) throw rootRecord.arg;
3213
+ return this.rval;
3214
+ },
3215
+ dispatchException: function dispatchException(exception) {
3216
+ if (this.done) throw exception;
3217
+ var context = this;
3218
3218
 
3219
- function copy(out, a) {
3220
- out[0] = a[0];
3221
- out[1] = a[1];
3222
- out[2] = a[2];
3223
- out[3] = a[3];
3224
- out[4] = a[4];
3225
- out[5] = a[5];
3226
- out[6] = a[6];
3227
- out[7] = a[7];
3228
- out[8] = a[8];
3229
- out[9] = a[9];
3230
- out[10] = a[10];
3231
- out[11] = a[11];
3232
- out[12] = a[12];
3233
- out[13] = a[13];
3234
- out[14] = a[14];
3235
- out[15] = a[15];
3236
- return out;
3237
- }
3238
- /**
3239
- * Multiplies two mat4s
3240
- *
3241
- * @param {mat4} out the receiving matrix
3242
- * @param {ReadonlyMat4} a the first operand
3243
- * @param {ReadonlyMat4} b the second operand
3244
- * @returns {mat4} out
3245
- */
3219
+ function handle(loc, caught) {
3220
+ return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
3221
+ }
3246
3222
 
3223
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3224
+ var entry = this.tryEntries[i],
3225
+ record = entry.completion;
3226
+ if ("root" === entry.tryLoc) return handle("end");
3247
3227
 
3248
- function multiply(out, a, b) {
3249
- var a00 = a[0],
3250
- a01 = a[1],
3251
- a02 = a[2],
3252
- a03 = a[3];
3253
- var a10 = a[4],
3254
- a11 = a[5],
3255
- a12 = a[6],
3256
- a13 = a[7];
3257
- var a20 = a[8],
3258
- a21 = a[9],
3259
- a22 = a[10],
3260
- a23 = a[11];
3261
- var a30 = a[12],
3262
- a31 = a[13],
3263
- a32 = a[14],
3264
- a33 = a[15]; // Cache only the current line of the second matrix
3228
+ if (entry.tryLoc <= this.prev) {
3229
+ var hasCatch = hasOwn.call(entry, "catchLoc"),
3230
+ hasFinally = hasOwn.call(entry, "finallyLoc");
3265
3231
 
3266
- var b0 = b[0],
3267
- b1 = b[1],
3268
- b2 = b[2],
3269
- b3 = b[3];
3270
- out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
3271
- out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
3272
- out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
3273
- out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
3274
- b0 = b[4];
3275
- b1 = b[5];
3276
- b2 = b[6];
3277
- b3 = b[7];
3278
- out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
3279
- out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
3280
- out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
3281
- out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
3282
- b0 = b[8];
3283
- b1 = b[9];
3284
- b2 = b[10];
3285
- b3 = b[11];
3286
- out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
3287
- out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
3288
- out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
3289
- out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
3290
- b0 = b[12];
3291
- b1 = b[13];
3292
- b2 = b[14];
3293
- b3 = b[15];
3294
- out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;
3295
- out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;
3296
- out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;
3297
- out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
3298
- return out;
3299
- }
3300
- /**
3301
- * Translate a mat4 by the given vector
3302
- *
3303
- * @param {mat4} out the receiving matrix
3304
- * @param {ReadonlyMat4} a the matrix to translate
3305
- * @param {ReadonlyVec3} v vector to translate by
3306
- * @returns {mat4} out
3307
- */
3232
+ if (hasCatch && hasFinally) {
3233
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
3234
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
3235
+ } else if (hasCatch) {
3236
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
3237
+ } else {
3238
+ if (!hasFinally) throw new Error("try statement without catch or finally");
3239
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
3240
+ }
3241
+ }
3242
+ }
3243
+ },
3244
+ abrupt: function abrupt(type, arg) {
3245
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3246
+ var entry = this.tryEntries[i];
3308
3247
 
3248
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
3249
+ var finallyEntry = entry;
3250
+ break;
3251
+ }
3252
+ }
3309
3253
 
3310
- function translate(out, a, v) {
3311
- var x = v[0],
3312
- y = v[1],
3313
- z = v[2];
3314
- var a00, a01, a02, a03;
3315
- var a10, a11, a12, a13;
3316
- var a20, a21, a22, a23;
3254
+ finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
3255
+ var record = finallyEntry ? finallyEntry.completion : {};
3256
+ return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
3257
+ },
3258
+ complete: function complete(record, afterLoc) {
3259
+ if ("throw" === record.type) throw record.arg;
3260
+ return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
3261
+ },
3262
+ finish: function finish(finallyLoc) {
3263
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3264
+ var entry = this.tryEntries[i];
3265
+ if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
3266
+ }
3267
+ },
3268
+ catch: function _catch(tryLoc) {
3269
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
3270
+ var entry = this.tryEntries[i];
3317
3271
 
3318
- if (a === out) {
3319
- out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];
3320
- out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];
3321
- out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];
3322
- out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];
3323
- } else {
3324
- a00 = a[0];
3325
- a01 = a[1];
3326
- a02 = a[2];
3327
- a03 = a[3];
3328
- a10 = a[4];
3329
- a11 = a[5];
3330
- a12 = a[6];
3331
- a13 = a[7];
3332
- a20 = a[8];
3333
- a21 = a[9];
3334
- a22 = a[10];
3335
- a23 = a[11];
3336
- out[0] = a00;
3337
- out[1] = a01;
3338
- out[2] = a02;
3339
- out[3] = a03;
3340
- out[4] = a10;
3341
- out[5] = a11;
3342
- out[6] = a12;
3343
- out[7] = a13;
3344
- out[8] = a20;
3345
- out[9] = a21;
3346
- out[10] = a22;
3347
- out[11] = a23;
3348
- out[12] = a00 * x + a10 * y + a20 * z + a[12];
3349
- out[13] = a01 * x + a11 * y + a21 * z + a[13];
3350
- out[14] = a02 * x + a12 * y + a22 * z + a[14];
3351
- out[15] = a03 * x + a13 * y + a23 * z + a[15];
3352
- }
3272
+ if (entry.tryLoc === tryLoc) {
3273
+ var record = entry.completion;
3353
3274
 
3354
- return out;
3355
- }
3356
- /**
3357
- * Creates a matrix from a vector scaling
3358
- * This is equivalent to (but much faster than):
3359
- *
3360
- * mat4.identity(dest);
3361
- * mat4.scale(dest, dest, vec);
3362
- *
3363
- * @param {mat4} out mat4 receiving operation result
3364
- * @param {ReadonlyVec3} v Scaling vector
3365
- * @returns {mat4} out
3366
- */
3275
+ if ("throw" === record.type) {
3276
+ var thrown = record.arg;
3277
+ resetTryEntry(entry);
3278
+ }
3367
3279
 
3280
+ return thrown;
3281
+ }
3282
+ }
3368
3283
 
3369
- function fromScaling(out, v) {
3370
- out[0] = v[0];
3371
- out[1] = 0;
3372
- out[2] = 0;
3373
- out[3] = 0;
3374
- out[4] = 0;
3375
- out[5] = v[1];
3376
- out[6] = 0;
3377
- out[7] = 0;
3378
- out[8] = 0;
3379
- out[9] = 0;
3380
- out[10] = v[2];
3381
- out[11] = 0;
3382
- out[12] = 0;
3383
- out[13] = 0;
3384
- out[14] = 0;
3385
- out[15] = 1;
3386
- return out;
3284
+ throw new Error("illegal catch attempt");
3285
+ },
3286
+ delegateYield: function delegateYield(iterable, resultName, nextLoc) {
3287
+ return this.delegate = {
3288
+ iterator: values(iterable),
3289
+ resultName: resultName,
3290
+ nextLoc: nextLoc
3291
+ }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
3292
+ }
3293
+ }, exports;
3387
3294
  }
3388
- /**
3389
- * 3 Dimensional Vector
3390
- * @module vec3
3391
- */
3392
-
3393
- /**
3394
- * Creates a new, empty vec3
3395
- *
3396
- * @returns {vec3} a new 3D vector
3397
- */
3398
-
3399
3295
 
3400
- function create$1$1() {
3401
- var out = new ARRAY_TYPE$1(3);
3402
-
3403
- if (ARRAY_TYPE$1 != Float32Array) {
3404
- out[0] = 0;
3405
- out[1] = 0;
3406
- out[2] = 0;
3296
+ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
3297
+ try {
3298
+ var info = gen[key](arg);
3299
+ var value = info.value;
3300
+ } catch (error) {
3301
+ reject(error);
3302
+ return;
3407
3303
  }
3408
3304
 
3409
- return out;
3305
+ if (info.done) {
3306
+ resolve(value);
3307
+ } else {
3308
+ Promise.resolve(value).then(_next, _throw);
3309
+ }
3410
3310
  }
3411
- /**
3412
- * Creates a new vec3 initialized with the given values
3413
- *
3414
- * @param {Number} x X component
3415
- * @param {Number} y Y component
3416
- * @param {Number} z Z component
3417
- * @returns {vec3} a new 3D vector
3418
- */
3419
3311
 
3312
+ function _asyncToGenerator$2(fn) {
3313
+ return function () {
3314
+ var self = this,
3315
+ args = arguments;
3316
+ return new Promise(function (resolve, reject) {
3317
+ var gen = fn.apply(self, args);
3420
3318
 
3421
- function fromValues$1(x, y, z) {
3422
- var out = new ARRAY_TYPE$1(3);
3423
- out[0] = x;
3424
- out[1] = y;
3425
- out[2] = z;
3426
- return out;
3427
- }
3428
- /**
3429
- * Transforms the vec3 with a mat4.
3430
- * 4th vector component is implicitly '1'
3431
- *
3432
- * @param {vec3} out the receiving vector
3433
- * @param {ReadonlyVec3} a the vector to transform
3434
- * @param {ReadonlyMat4} m matrix to transform with
3435
- * @returns {vec3} out
3436
- */
3319
+ function _next(value) {
3320
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
3321
+ }
3437
3322
 
3323
+ function _throw(err) {
3324
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
3325
+ }
3438
3326
 
3439
- function transformMat4$1(out, a, m) {
3440
- var x = a[0],
3441
- y = a[1],
3442
- z = a[2];
3443
- var w = m[3] * x + m[7] * y + m[11] * z + m[15];
3444
- w = w || 1.0;
3445
- out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
3446
- out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
3447
- out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
3448
- return out;
3327
+ _next(undefined);
3328
+ });
3329
+ };
3449
3330
  }
3450
- /**
3451
- * Perform some operation over an array of vec3s.
3452
- *
3453
- * @param {Array} a the array of vectors to iterate over
3454
- * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
3455
- * @param {Number} offset Number of elements to skip at the beginning of the array
3456
- * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
3457
- * @param {Function} fn Function to call for each vector in the array
3458
- * @param {Object} [arg] additional argument to pass to fn
3459
- * @returns {Array} a
3460
- * @function
3461
- */
3462
-
3463
3331
 
3464
- var forEach$2 = function () {
3465
- var vec = create$1$1();
3466
- return function (a, stride, offset, count, fn, arg) {
3467
- var i, l;
3332
+ function _extends() {
3333
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
3334
+ for (var i = 1; i < arguments.length; i++) {
3335
+ var source = arguments[i];
3468
3336
 
3469
- if (!stride) {
3470
- stride = 3;
3337
+ for (var key in source) {
3338
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
3339
+ target[key] = source[key];
3340
+ }
3341
+ }
3471
3342
  }
3472
3343
 
3473
- if (!offset) {
3474
- offset = 0;
3475
- }
3344
+ return target;
3345
+ };
3346
+ return _extends.apply(this, arguments);
3347
+ }
3476
3348
 
3477
- if (count) {
3478
- l = Math.min(count * stride + offset, a.length);
3479
- } else {
3480
- l = a.length;
3481
- }
3349
+ function _inheritsLoose$3(subClass, superClass) {
3350
+ subClass.prototype = Object.create(superClass.prototype);
3351
+ subClass.prototype.constructor = subClass;
3482
3352
 
3483
- for (i = offset; i < l; i += stride) {
3484
- vec[0] = a[i];
3485
- vec[1] = a[i + 1];
3486
- vec[2] = a[i + 2];
3487
- fn(vec, vec, arg);
3488
- a[i] = vec[0];
3489
- a[i + 1] = vec[1];
3490
- a[i + 2] = vec[2];
3491
- }
3353
+ _setPrototypeOf$3(subClass, superClass);
3354
+ }
3492
3355
 
3493
- return a;
3356
+ function _setPrototypeOf$3(o, p) {
3357
+ _setPrototypeOf$3 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
3358
+ o.__proto__ = p;
3359
+ return o;
3494
3360
  };
3495
- }();
3361
+ return _setPrototypeOf$3(o, p);
3362
+ }
3496
3363
  /**
3497
3364
  * support 2 modes in rendering:
3498
3365
  * * immediate
@@ -3513,13 +3380,13 @@
3513
3380
  this.renderQueue = [];
3514
3381
  this.restoreStack = [];
3515
3382
  this.clearFullScreen = false;
3516
- this.vpMatrix = create$3();
3517
- this.dprMatrix = create$3();
3518
- this.tmpMat4 = create$3();
3519
- this.vec3a = create$1$1();
3520
- this.vec3b = create$1$1();
3521
- this.vec3c = create$1$1();
3522
- this.vec3d = create$1$1();
3383
+ this.vpMatrix = create();
3384
+ this.dprMatrix = create();
3385
+ this.tmpMat4 = create();
3386
+ this.vec3a = create$1();
3387
+ this.vec3b = create$1();
3388
+ this.vec3c = create$1();
3389
+ this.vec3d = create$1();
3523
3390
  this.canvasRendererPluginOptions = canvasRendererPluginOptions;
3524
3391
  }
3525
3392
 
@@ -3635,7 +3502,7 @@
3635
3502
  var context = contextService.getContext(); // clear & clip dirty rectangle
3636
3503
 
3637
3504
  var dpr = contextService.getDPR();
3638
- fromScaling(_this.dprMatrix, fromValues$1(dpr, dpr, 1));
3505
+ fromScaling(_this.dprMatrix, fromValues(dpr, dpr, 1));
3639
3506
  multiply(_this.vpMatrix, _this.dprMatrix, camera.getOrthoMatrix());
3640
3507
 
3641
3508
  if (_this.clearFullScreen) {
@@ -3648,7 +3515,7 @@
3648
3515
  maxX = _ref2.maxX,
3649
3516
  maxY = _ref2.maxY;
3650
3517
  var aabb = new gLite.AABB();
3651
- aabb.setMinMax(fromValues$1(minX, minY, 0), fromValues$1(maxX, maxY, 0));
3518
+ aabb.setMinMax(fromValues(minX, minY, 0), fromValues(maxX, maxY, 0));
3652
3519
  return aabb;
3653
3520
  })));
3654
3521
 
@@ -3665,10 +3532,10 @@
3665
3532
  y = dirtyRect.y,
3666
3533
  width = dirtyRect.width,
3667
3534
  height = dirtyRect.height;
3668
- var tl = transformMat4$1(_this.vec3a, fromValues$1(x, y, 0), _this.vpMatrix);
3669
- var tr = transformMat4$1(_this.vec3b, fromValues$1(x + width, y, 0), _this.vpMatrix);
3670
- var bl = transformMat4$1(_this.vec3c, fromValues$1(x, y + height, 0), _this.vpMatrix);
3671
- var br = transformMat4$1(_this.vec3d, fromValues$1(x + width, y + height, 0), _this.vpMatrix);
3535
+ var tl = transformMat4(_this.vec3a, fromValues(x, y, 0), _this.vpMatrix);
3536
+ var tr = transformMat4(_this.vec3b, fromValues(x + width, y, 0), _this.vpMatrix);
3537
+ var bl = transformMat4(_this.vec3c, fromValues(x, y + height, 0), _this.vpMatrix);
3538
+ var br = transformMat4(_this.vec3d, fromValues(x + width, y + height, 0), _this.vpMatrix);
3672
3539
  var minx = Math.min(tl[0], tr[0], br[0], bl[0]);
3673
3540
  var miny = Math.min(tl[1], tr[1], br[1], bl[1]);
3674
3541
  var maxx = Math.max(tl[0], tr[0], br[0], bl[0]);
@@ -6530,13 +6397,6 @@
6530
6397
  Plugin: Plugin$5
6531
6398
  });
6532
6399
 
6533
- var toString$1 = {}.toString;
6534
- var isType$1 = function (value, type) { return toString$1.call(value) === '[object ' + type + ']'; };
6535
-
6536
- var isString$1 = (function (str) {
6537
- return isType$1(str, 'String');
6538
- });
6539
-
6540
6400
  var Canvas2DContextService = /*#__PURE__*/function () {
6541
6401
  function Canvas2DContextService(context) {
6542
6402
  this.$container = void 0;
@@ -6572,7 +6432,7 @@
6572
6432
  this.canvasConfig.container = this.$container;
6573
6433
  } else if (container) {
6574
6434
  // create container
6575
- this.$container = isString$1(container) ? document.getElementById(container) : container;
6435
+ this.$container = isString(container) ? document.getElementById(container) : container;
6576
6436
 
6577
6437
  if (this.$container) {
6578
6438
  // create canvas