@antv/g-canvas 1.2.2 → 1.2.3
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/Canvas2DContextService.d.ts +2 -1
- package/dist/Canvas2DContextService.d.ts.map +1 -1
- package/dist/index.esm.js +30 -0
- package/dist/index.js +30 -0
- package/dist/index.umd.js +59 -26
- package/dist/index.umd.min.js +7 -7
- package/package.json +8 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CanvasLike } from '@antv/g';
|
|
1
|
+
import type { CanvasLike, DataURLOptions } from '@antv/g';
|
|
2
2
|
import { ContextService } from '@antv/g';
|
|
3
3
|
export declare class Canvas2DContextService implements ContextService<CanvasRenderingContext2D> {
|
|
4
4
|
private $container;
|
|
@@ -14,5 +14,6 @@ export declare class Canvas2DContextService implements ContextService<CanvasRend
|
|
|
14
14
|
destroy(): void;
|
|
15
15
|
resize(width: number, height: number): void;
|
|
16
16
|
applyCursorStyle(cursor: string): void;
|
|
17
|
+
toDataURL(options?: Partial<DataURLOptions>): Promise<string>;
|
|
17
18
|
}
|
|
18
19
|
//# sourceMappingURL=Canvas2DContextService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Canvas2DContextService.d.ts","sourceRoot":"","sources":["../src/Canvas2DContextService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Canvas2DContextService.d.ts","sourceRoot":"","sources":["../src/Canvas2DContextService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAEL,cAAc,EAMf,MAAM,SAAS,CAAC;AAEjB,qBACa,sBAAuB,YAAW,cAAc,CAAC,wBAAwB,CAAC;IACrF,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,OAAO,CAAsE;IAGrF,OAAO,CAAC,YAAY,CAAe;IAE7B,IAAI;IAoCV,UAAU;IAIV,aAAa;IAIb,MAAM;IAIN,qBAAqB;IAMrB,OAAO;IASP,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAgBpC,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAMzB,SAAS,CAAC,OAAO,GAAE,OAAO,CAAC,cAAc,CAAM;CAItD"}
|
package/dist/index.esm.js
CHANGED
|
@@ -531,6 +531,36 @@ var Canvas2DContextService = /*#__PURE__*/function () {
|
|
|
531
531
|
}
|
|
532
532
|
};
|
|
533
533
|
|
|
534
|
+
_proto.toDataURL = /*#__PURE__*/function () {
|
|
535
|
+
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
|
|
536
|
+
var _options, type, encoderOptions;
|
|
537
|
+
|
|
538
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
539
|
+
while (1) {
|
|
540
|
+
switch (_context2.prev = _context2.next) {
|
|
541
|
+
case 0:
|
|
542
|
+
if (options === void 0) {
|
|
543
|
+
options = {};
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
_options = options, type = _options.type, encoderOptions = _options.encoderOptions;
|
|
547
|
+
return _context2.abrupt("return", this.context.canvas.toDataURL(type, encoderOptions));
|
|
548
|
+
|
|
549
|
+
case 3:
|
|
550
|
+
case "end":
|
|
551
|
+
return _context2.stop();
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}, _callee2, this);
|
|
555
|
+
}));
|
|
556
|
+
|
|
557
|
+
function toDataURL(_x) {
|
|
558
|
+
return _toDataURL.apply(this, arguments);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
return toDataURL;
|
|
562
|
+
}();
|
|
563
|
+
|
|
534
564
|
return Canvas2DContextService;
|
|
535
565
|
}();
|
|
536
566
|
|
package/dist/index.js
CHANGED
|
@@ -550,6 +550,36 @@ var Canvas2DContextService = /*#__PURE__*/function () {
|
|
|
550
550
|
}
|
|
551
551
|
};
|
|
552
552
|
|
|
553
|
+
_proto.toDataURL = /*#__PURE__*/function () {
|
|
554
|
+
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
|
|
555
|
+
var _options, type, encoderOptions;
|
|
556
|
+
|
|
557
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
558
|
+
while (1) {
|
|
559
|
+
switch (_context2.prev = _context2.next) {
|
|
560
|
+
case 0:
|
|
561
|
+
if (options === void 0) {
|
|
562
|
+
options = {};
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
_options = options, type = _options.type, encoderOptions = _options.encoderOptions;
|
|
566
|
+
return _context2.abrupt("return", this.context.canvas.toDataURL(type, encoderOptions));
|
|
567
|
+
|
|
568
|
+
case 3:
|
|
569
|
+
case "end":
|
|
570
|
+
return _context2.stop();
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}, _callee2, this);
|
|
574
|
+
}));
|
|
575
|
+
|
|
576
|
+
function toDataURL(_x) {
|
|
577
|
+
return _toDataURL.apply(this, arguments);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
return toDataURL;
|
|
581
|
+
}();
|
|
582
|
+
|
|
553
583
|
return Canvas2DContextService;
|
|
554
584
|
}();
|
|
555
585
|
|
package/dist/index.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@antv/g')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', '@antv/g'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.G = global.G || {}, global.G.
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.G = global.G || {}, global.G.ImageExporter = {}), global.window.G));
|
|
5
5
|
}(this, (function (exports, g) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _regeneratorRuntime() {
|
|
@@ -441,6 +441,10 @@
|
|
|
441
441
|
}
|
|
442
442
|
|
|
443
443
|
function generatePath$3(context, parsedStyle) {
|
|
444
|
+
var _parsedStyle$defX = parsedStyle.defX,
|
|
445
|
+
defX = _parsedStyle$defX === void 0 ? 0 : _parsedStyle$defX,
|
|
446
|
+
_parsedStyle$defY = parsedStyle.defY,
|
|
447
|
+
defY = _parsedStyle$defY === void 0 ? 0 : _parsedStyle$defY;
|
|
444
448
|
var _parsedStyle$path = parsedStyle.path,
|
|
445
449
|
curve = _parsedStyle$path.curve,
|
|
446
450
|
zCommandIndexes = _parsedStyle$path.zCommandIndexes;
|
|
@@ -451,17 +455,16 @@
|
|
|
451
455
|
});
|
|
452
456
|
|
|
453
457
|
for (var i = 0; i < path.length; i++) {
|
|
454
|
-
var params = path[i];
|
|
455
|
-
|
|
456
|
-
var command = params[0]; // V,H,S,T 都在前面被转换成标准形式
|
|
458
|
+
var params = path[i];
|
|
459
|
+
var command = params[0];
|
|
457
460
|
|
|
458
461
|
switch (command) {
|
|
459
462
|
case 'M':
|
|
460
|
-
context.moveTo(params[1], params[2]);
|
|
463
|
+
context.moveTo(params[1] - defX, params[2] - defY);
|
|
461
464
|
break;
|
|
462
465
|
|
|
463
466
|
case 'C':
|
|
464
|
-
context.bezierCurveTo(params[1], params[2], params[3], params[4], params[5], params[6]);
|
|
467
|
+
context.bezierCurveTo(params[1] - defX, params[2] - defY, params[3] - defX, params[4] - defY, params[5] - defX, params[6] - defY);
|
|
465
468
|
break;
|
|
466
469
|
// @ts-ignore
|
|
467
470
|
|
|
@@ -473,34 +476,42 @@
|
|
|
473
476
|
}
|
|
474
477
|
|
|
475
478
|
function generatePath$4(context, parsedStyle) {
|
|
479
|
+
var _parsedStyle$defX = parsedStyle.defX,
|
|
480
|
+
defX = _parsedStyle$defX === void 0 ? 0 : _parsedStyle$defX,
|
|
481
|
+
_parsedStyle$defY = parsedStyle.defY,
|
|
482
|
+
defY = _parsedStyle$defY === void 0 ? 0 : _parsedStyle$defY;
|
|
476
483
|
var points = parsedStyle.points.points;
|
|
477
484
|
var length = points.length;
|
|
478
|
-
var x1 = points[0][0];
|
|
479
|
-
var y1 = points[0][1];
|
|
480
|
-
var x2 = points[length - 1][0];
|
|
481
|
-
var y2 = points[length - 1][1];
|
|
485
|
+
var x1 = points[0][0] - defX;
|
|
486
|
+
var y1 = points[0][1] - defY;
|
|
487
|
+
var x2 = points[length - 1][0] - defX;
|
|
488
|
+
var y2 = points[length - 1][1] - defY;
|
|
482
489
|
context.moveTo(x1, y1);
|
|
483
490
|
|
|
484
491
|
for (var i = 0; i < length - 1; i++) {
|
|
485
492
|
var point = points[i];
|
|
486
|
-
context.lineTo(point[0], point[1]);
|
|
493
|
+
context.lineTo(point[0] - defX, point[1] - defY);
|
|
487
494
|
}
|
|
488
495
|
|
|
489
496
|
context.lineTo(x2, y2);
|
|
490
497
|
}
|
|
491
498
|
|
|
492
499
|
function generatePath$5(context, parsedStyle) {
|
|
500
|
+
var _parsedStyle$defX = parsedStyle.defX,
|
|
501
|
+
defX = _parsedStyle$defX === void 0 ? 0 : _parsedStyle$defX,
|
|
502
|
+
_parsedStyle$defY = parsedStyle.defY,
|
|
503
|
+
defY = _parsedStyle$defY === void 0 ? 0 : _parsedStyle$defY;
|
|
493
504
|
var points = parsedStyle.points.points;
|
|
494
505
|
var length = points.length;
|
|
495
|
-
var x1 = points[0][0];
|
|
496
|
-
var y1 = points[0][1];
|
|
497
|
-
var x2 = points[length - 1][0];
|
|
498
|
-
var y2 = points[length - 1][1];
|
|
506
|
+
var x1 = points[0][0] - defX;
|
|
507
|
+
var y1 = points[0][1] - defY;
|
|
508
|
+
var x2 = points[length - 1][0] - defX;
|
|
509
|
+
var y2 = points[length - 1][1] - defY;
|
|
499
510
|
context.moveTo(x1, y1);
|
|
500
511
|
|
|
501
512
|
for (var i = 0; i < length - 1; i++) {
|
|
502
513
|
var point = points[i];
|
|
503
|
-
context.lineTo(point[0], point[1]);
|
|
514
|
+
context.lineTo(point[0] - defX, point[1] - defY);
|
|
504
515
|
}
|
|
505
516
|
|
|
506
517
|
context.lineTo(x2, y2);
|
|
@@ -5544,16 +5555,8 @@
|
|
|
5544
5555
|
var bounds = object.getGeometryBounds();
|
|
5545
5556
|
var width = bounds && bounds.halfExtents[0] * 2 || 0;
|
|
5546
5557
|
var height = bounds && bounds.halfExtents[1] * 2 || 0;
|
|
5547
|
-
var
|
|
5548
|
-
var
|
|
5549
|
-
|
|
5550
|
-
if (object.nodeName === g.Shape.POLYLINE || object.nodeName === g.Shape.POLYGON || object.nodeName === g.Shape.PATH) {
|
|
5551
|
-
defX = object.parsedStyle.defX;
|
|
5552
|
-
defY = object.parsedStyle.defY;
|
|
5553
|
-
}
|
|
5554
|
-
|
|
5555
|
-
var tx = -((anchor && anchor[0].value || 0) * width + defX);
|
|
5556
|
-
var ty = -((anchor && anchor[1].value || 0) * height + defY);
|
|
5558
|
+
var tx = -((anchor && anchor[0].value || 0) * width);
|
|
5559
|
+
var ty = -((anchor && anchor[1].value || 0) * height);
|
|
5557
5560
|
|
|
5558
5561
|
if (tx !== 0 || ty !== 0) {
|
|
5559
5562
|
// apply anchor, use true size, not include stroke,
|
|
@@ -7019,6 +7022,36 @@
|
|
|
7019
7022
|
}
|
|
7020
7023
|
};
|
|
7021
7024
|
|
|
7025
|
+
_proto.toDataURL = /*#__PURE__*/function () {
|
|
7026
|
+
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
|
|
7027
|
+
var _options, type, encoderOptions;
|
|
7028
|
+
|
|
7029
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
7030
|
+
while (1) {
|
|
7031
|
+
switch (_context2.prev = _context2.next) {
|
|
7032
|
+
case 0:
|
|
7033
|
+
if (options === void 0) {
|
|
7034
|
+
options = {};
|
|
7035
|
+
}
|
|
7036
|
+
|
|
7037
|
+
_options = options, type = _options.type, encoderOptions = _options.encoderOptions;
|
|
7038
|
+
return _context2.abrupt("return", this.context.canvas.toDataURL(type, encoderOptions));
|
|
7039
|
+
|
|
7040
|
+
case 3:
|
|
7041
|
+
case "end":
|
|
7042
|
+
return _context2.stop();
|
|
7043
|
+
}
|
|
7044
|
+
}
|
|
7045
|
+
}, _callee2, this);
|
|
7046
|
+
}));
|
|
7047
|
+
|
|
7048
|
+
function toDataURL(_x) {
|
|
7049
|
+
return _toDataURL.apply(this, arguments);
|
|
7050
|
+
}
|
|
7051
|
+
|
|
7052
|
+
return toDataURL;
|
|
7053
|
+
}();
|
|
7054
|
+
|
|
7022
7055
|
return Canvas2DContextService;
|
|
7023
7056
|
}();
|
|
7024
7057
|
|
package/dist/index.umd.min.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@antv/g")):"function"==typeof define&&define.amd?define(["exports","@antv/g"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@antv/g")):"function"==typeof define&&define.amd?define(["exports","@antv/g"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.ImageExporter={}),t.window.G)}(this,(function(t,e){"use strict";function r(){
|
|
2
2
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
3
|
-
r=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=Object.create((e&&e.prototype instanceof f?e:f).prototype),i=new P(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return C()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=b(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),o}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var h={};function f(){}function v(){}function d(){}var p={};u(p,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(S([])));g&&g!==e&&n.call(g,i)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(o,i,a,c){var u=l(t[o],t,i);if("throw"!==u.type){var s=u.arg,h=s.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(h).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function S(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:C}}function C(){return{value:void 0,done:!0}}return v.prototype=d,u(m,"constructor",d),u(d,"constructor",v),v.displayName=u(d,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},w(x.prototype),u(x.prototype,a,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(m),u(m,c,"Generator"),u(m,i,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(this.prev>=i.tryLoc){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return r(i.catchLoc,!0);if(i.finallyLoc>this.prev)return r(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(this.prev>=o.tryLoc&&n.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function n(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}var i=e.Syringe.defineToken("PathGeneratorFactory"),a=e.Syringe.defineToken("PathGenerator");function c(t,e){var r=e.r;t.arc(r.value,r.value,r.value,0,2*Math.PI,!1)}function u(t,e){var r=e.rx.value,n=e.ry.value;if(t.ellipse)t.ellipse(r,n,r,n,0,0,2*Math.PI,!1);else{var o=r>n?r:n,i=r>n?1:r/n,a=r>n?n/r:1;t.save(),t.scale(i,a),t.arc(0,0,o,0,2*Math.PI)}}function s(t,e){var r=e.x2,n=e.y2,o=e.defX,i=void 0===o?0:o,a=e.defY,c=void 0===a?0:a;t.moveTo(e.x1.value-i,e.y1.value-c),t.lineTo(r.value-i,n.value-c)}function l(t,e){var r=e.path,n=r.zCommandIndexes,o=[].concat(r.curve);n.forEach((function(t,e){o.splice(t+e,1,["Z"])}));for(var i=0;o.length>i;i++){var a=o[i];switch(a[0]){case"M":t.moveTo(a[1],a[2]);break;case"C":t.bezierCurveTo(a[1],a[2],a[3],a[4],a[5],a[6]);break;case"Z":t.closePath()}}}function h(t,e){var r=e.points.points,n=r.length,o=r[n-1][0],i=r[n-1][1];t.moveTo(r[0][0],r[0][1]);for(var a=0;n-1>a;a++){var c=r[a];t.lineTo(c[0],c[1])}t.lineTo(o,i)}function f(t,e){var r=e.points.points,n=r.length,o=r[n-1][0],i=r[n-1][1];t.moveTo(r[0][0],r[0][1]);for(var a=0;n-1>a;a++){var c=r[a];t.lineTo(c[0],c[1])}t.lineTo(o,i)}function v(t,r){var n=r.radius,o=r.width,i=r.height,a=o.value,c=i.value;if(n&&n.some((function(t){return 0!==t.value}))){var u=o.value>0?1:-1,s=i.value>0?1:-1,l=u+s===0,h=n.map((function(t){return e.clamp(t.value,0,Math.min(Math.abs(a)/2,Math.abs(c)/2))})),f=h[0],v=h[1],d=h[2],p=h[3];t.moveTo(u*f,0),t.lineTo(a-u*v,0),0!==v&&t.arc(a-u*v,s*v,v,-s*Math.PI/2,u>0?0:Math.PI,l),t.lineTo(a,c-s*d),0!==d&&t.arc(a-u*d,c-s*d,d,u>0?0:Math.PI,s>0?Math.PI/2:1.5*Math.PI,l),t.lineTo(u*p,c),0!==p&&t.arc(u*p,c-s*p,p,s>0?Math.PI/2:-Math.PI/2,u>0?Math.PI:0,l),t.lineTo(0,s*f),0!==f&&t.arc(u*f,s*f,f,u>0?Math.PI:0,s>0?1.5*Math.PI:Math.PI/2,l)}else t.rect(0,0,a,c)}var d=e.Module((function(t){t({token:{token:a,named:e.Shape.CIRCLE},useValue:c}),t({token:{token:a,named:e.Shape.ELLIPSE},useValue:u}),t({token:{token:a,named:e.Shape.RECT},useValue:v}),t({token:{token:a,named:e.Shape.LINE},useValue:s}),t({token:{token:a,named:e.Shape.POLYLINE},useValue:f}),t({token:{token:a,named:e.Shape.POLYGON},useValue:h}),t({token:{token:a,named:e.Shape.PATH},useValue:l}),t({token:i,useFactory:function(t){return function(e){return t.container.isBoundNamed(a,e)?t.container.getNamed(a,e):null}}})})),p=function(){function t(){this.name="canvas-path-generator"}var e=t.prototype;return e.init=function(t){t.load(d,!0)},e.destroy=function(t){t.unload(d)},t}(),y=Object.freeze({__proto__:null,PathGenerator:a,PathGeneratorFactory:i,Plugin:p});function g(t,e,r,n){var o,i=arguments.length,a=3>i?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(3>i?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a}function m(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function w(){
|
|
3
|
+
r=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=Object.create((e&&e.prototype instanceof f?e:f).prototype),i=new P(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return C()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=b(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),o}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var h={};function f(){}function v(){}function d(){}var p={};u(p,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(k([])));g&&g!==e&&n.call(g,i)&&(p=g);var m=d.prototype=f.prototype=Object.create(p);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(o,i,a,c){var u=l(t[o],t,i);if("throw"!==u.type){var s=u.arg,h=s.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(h).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,h;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function k(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:C}}function C(){return{value:void 0,done:!0}}return v.prototype=d,u(m,"constructor",d),u(d,"constructor",v),v.displayName=u(d,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},w(x.prototype),u(x.prototype,a,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(m),u(m,c,"Generator"),u(m,i,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=k,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(this.prev>=i.tryLoc){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return r(i.catchLoc,!0);if(i.finallyLoc>this.prev)return r(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(this.prev>=o.tryLoc&&n.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function n(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function c(t){n(a,o,i,c,u,"next",t)}function u(t){n(a,o,i,c,u,"throw",t)}c(void 0)}))}}function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}var a=e.Syringe.defineToken("PathGeneratorFactory"),c=e.Syringe.defineToken("PathGenerator");function u(t,e){var r=e.r;t.arc(r.value,r.value,r.value,0,2*Math.PI,!1)}function s(t,e){var r=e.rx.value,n=e.ry.value;if(t.ellipse)t.ellipse(r,n,r,n,0,0,2*Math.PI,!1);else{var o=r>n?r:n,i=r>n?1:r/n,a=r>n?n/r:1;t.save(),t.scale(i,a),t.arc(0,0,o,0,2*Math.PI)}}function l(t,e){var r=e.x2,n=e.y2,o=e.defX,i=void 0===o?0:o,a=e.defY,c=void 0===a?0:a;t.moveTo(e.x1.value-i,e.y1.value-c),t.lineTo(r.value-i,n.value-c)}function h(t,e){var r=e.defX,n=void 0===r?0:r,o=e.defY,i=void 0===o?0:o,a=e.path,c=a.zCommandIndexes,u=[].concat(a.curve);c.forEach((function(t,e){u.splice(t+e,1,["Z"])}));for(var s=0;u.length>s;s++){var l=u[s];switch(l[0]){case"M":t.moveTo(l[1]-n,l[2]-i);break;case"C":t.bezierCurveTo(l[1]-n,l[2]-i,l[3]-n,l[4]-i,l[5]-n,l[6]-i);break;case"Z":t.closePath()}}}function f(t,e){var r=e.defX,n=void 0===r?0:r,o=e.defY,i=void 0===o?0:o,a=e.points.points,c=a.length,u=a[c-1][0]-n,s=a[c-1][1]-i;t.moveTo(a[0][0]-n,a[0][1]-i);for(var l=0;c-1>l;l++){var h=a[l];t.lineTo(h[0]-n,h[1]-i)}t.lineTo(u,s)}function v(t,e){var r=e.defX,n=void 0===r?0:r,o=e.defY,i=void 0===o?0:o,a=e.points.points,c=a.length,u=a[c-1][0]-n,s=a[c-1][1]-i;t.moveTo(a[0][0]-n,a[0][1]-i);for(var l=0;c-1>l;l++){var h=a[l];t.lineTo(h[0]-n,h[1]-i)}t.lineTo(u,s)}function d(t,r){var n=r.radius,o=r.width,i=r.height,a=o.value,c=i.value;if(n&&n.some((function(t){return 0!==t.value}))){var u=o.value>0?1:-1,s=i.value>0?1:-1,l=u+s===0,h=n.map((function(t){return e.clamp(t.value,0,Math.min(Math.abs(a)/2,Math.abs(c)/2))})),f=h[0],v=h[1],d=h[2],p=h[3];t.moveTo(u*f,0),t.lineTo(a-u*v,0),0!==v&&t.arc(a-u*v,s*v,v,-s*Math.PI/2,u>0?0:Math.PI,l),t.lineTo(a,c-s*d),0!==d&&t.arc(a-u*d,c-s*d,d,u>0?0:Math.PI,s>0?Math.PI/2:1.5*Math.PI,l),t.lineTo(u*p,c),0!==p&&t.arc(u*p,c-s*p,p,s>0?Math.PI/2:-Math.PI/2,u>0?Math.PI:0,l),t.lineTo(0,s*f),0!==f&&t.arc(u*f,s*f,f,u>0?Math.PI:0,s>0?1.5*Math.PI:Math.PI/2,l)}else t.rect(0,0,a,c)}var p=e.Module((function(t){t({token:{token:c,named:e.Shape.CIRCLE},useValue:u}),t({token:{token:c,named:e.Shape.ELLIPSE},useValue:s}),t({token:{token:c,named:e.Shape.RECT},useValue:d}),t({token:{token:c,named:e.Shape.LINE},useValue:l}),t({token:{token:c,named:e.Shape.POLYLINE},useValue:v}),t({token:{token:c,named:e.Shape.POLYGON},useValue:f}),t({token:{token:c,named:e.Shape.PATH},useValue:h}),t({token:a,useFactory:function(t){return function(e){return t.container.isBoundNamed(c,e)?t.container.getNamed(c,e):null}}})})),y=function(){function t(){this.name="canvas-path-generator"}var e=t.prototype;return e.init=function(t){t.load(p,!0)},e.destroy=function(t){t.unload(p)},t}(),g=Object.freeze({__proto__:null,PathGenerator:c,PathGeneratorFactory:a,Plugin:y});function m(t,e,r,n){var o,i=arguments.length,a=3>i?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(3>i?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a}function w(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function x(){
|
|
4
4
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
5
|
-
w=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=Object.create((e&&e.prototype instanceof h?e:h).prototype),i=new P(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return C()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=b(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),o}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function h(){}function f(){}function v(){}var d={};c(d,o,(function(){return this}));var p=Object.getPrototypeOf,y=p&&p(p(S([])));y&&y!==e&&r.call(y,o)&&(d=y);var g=v.prototype=h.prototype=Object.create(d);function m(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function n(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:C}}function C(){return{value:void 0,done:!0}}return f.prototype=v,c(g,"constructor",v),c(v,"constructor",f),f.displayName=c(v,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(x.prototype),c(x.prototype,i,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(g),c(g,a,"Generator"),c(g,o,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function x(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var b="undefined"!=typeof Float32Array?Float32Array:Array;function E(){var t=new b(9);return b!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function L(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3],c=e[4],u=e[5],s=e[6],l=e[7],h=e[8],f=r[0],v=r[1],d=r[2],p=r[3],y=r[4],g=r[5],m=r[6],w=r[7],x=r[8];return t[0]=f*n+v*a+d*s,t[1]=f*o+v*c+d*l,t[2]=f*i+v*u+d*h,t[3]=p*n+y*a+g*s,t[4]=p*o+y*c+g*l,t[5]=p*i+y*u+g*h,t[6]=m*n+w*a+x*s,t[7]=m*o+w*c+x*l,t[8]=m*i+w*u+x*h,t}function P(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=-r,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function S(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function C(){var t=new b(16);return b!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function k(){var t=new b(3);return b!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function O(t,e,r){var n=new b(3);return n[0]=t,n[1]=e,n[2]=r,n}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var N;N=k();function T(t,e){var r=new b(2);return r[0]=t,r[1]=e,r}function j(t,e,r){var n=e[0],o=e[1];return t[0]=r[0]*n+r[3]*o+r[6],t[1]=r[1]*n+r[4]*o+r[7],t}!function(){var t,e=(t=new b(2),b!=Float32Array&&(t[0]=0,t[1]=0),t)}();var M,A,_=e.Syringe.defineToken("PointInPathPicker"),R=(M=function(){function t(){var t=this;this.displayObjectPool=void 0,this.canvasConfig=void 0,this.offscreenCanvas=void 0,this.rBush=void 0,this.pathGeneratorFactory=void 0,this.pathGeneratorFactoryCache={},this.pointInPathPickerFactory=void 0,this.isHit=function(r,n,o){var i,a,c,u,s,l,h,f,v,d,p,y,g,m,w,x,b,E,L,P,S,N,T,j,M,A,_,R,G,F,I,B=t.pointInPathPickerFactory(r.nodeName);if(B){var D=(i=C(),(I=(L=(c=(a=o)[0])*(f=a[5])-(u=a[1])*(h=a[4]))*(F=(g=a[10])*(E=a[15])-(m=a[11])*(b=a[14]))-(P=c*(v=a[6])-(s=a[2])*h)*(G=(y=a[9])*E-m*(x=a[13]))+(S=c*(d=a[7])-(l=a[3])*h)*(R=y*b-g*x)+(N=u*v-s*f)*(_=(p=a[8])*E-m*(w=a[12]))-(T=u*d-l*f)*(A=p*b-g*w)+(j=s*d-l*v)*(M=p*x-y*w))?(i[0]=(f*F-v*G+d*R)*(I=1/I),i[1]=(s*G-u*F-l*R)*I,i[2]=(x*j-b*T+E*N)*I,i[3]=(g*T-y*j-m*N)*I,i[4]=(v*_-h*F-d*A)*I,i[5]=(c*F-s*_+l*A)*I,i[6]=(b*S-w*j-E*P)*I,i[7]=(p*j-g*S+m*P)*I,i[8]=(h*G-f*_+d*M)*I,i[9]=(u*_-c*G-l*M)*I,i[10]=(w*T-x*S+E*L)*I,i[11]=(y*S-p*T-m*L)*I,i[12]=(f*A-h*R-v*M)*I,i[13]=(c*R-u*A+s*M)*I,i[14]=(x*P-w*N-b*L)*I,i[15]=(p*N-y*P+g*L)*I,i):null),Y=function(t,e,r){var n=e[0],o=e[1],i=e[2],a=r[3]*n+r[7]*o+r[11]*i+r[15];return t[0]=(r[0]*n+r[4]*o+r[8]*i+r[12])/(a=a||1),t[1]=(r[1]*n+r[5]*o+r[9]*i+r[13])/a,t[2]=(r[2]*n+r[6]*o+r[10]*i+r[14])/a,t}(k(),O(n[0],n[1],0),D),$=r.getGeometryBounds().halfExtents,H=r.parsedStyle.anchor;if(Y[0]+=(H&&H[0].value||0)*$[0]*2,Y[1]+=(H&&H[1].value||0)*$[1]*2,B(r,new e.Point(Y[0],Y[1]),t.isPointInPath))return!0}return!1},this.isPointInPath=function(e,r){var n=t.offscreenCanvas.getOrCreateContext(t.canvasConfig.offscreenCanvas);void 0===t.pathGeneratorFactoryCache[e.nodeName]&&(t.pathGeneratorFactoryCache[e.nodeName]=t.pathGeneratorFactory(e.nodeName));var o=t.pathGeneratorFactoryCache[e.nodeName];return o&&o(n,e.parsedStyle),n.isPointInPath(r.x,r.y)}}return t.prototype.apply=function(t){var e=this;t.hooks.pick.tapPromise(A.tag,function(){var t,r=(t=w().mark((function t(r){var n,o,i,a,c,u,s,l,h,f,v,d,p;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=r.topmost,i=O((o=r.position).x,o.y,0),a=e.rBush.search({minX:i[0],minY:i[1],maxX:i[0],maxY:i[1]}),c=a.map((function(t){return t.id})),u=[],a.forEach((function(t){var r=e.displayObjectPool.getByEntity(t.id);if(r.isVisible()&&!r.isCulled()&&r.isInteractive()){if(r.parentNode&&-1===c.indexOf(r.parentNode.entity))return;u.push(r)}})),u.sort((function(t,e){return e.sortable.renderOrder-t.sortable.renderOrder})),s=[],l=0,h=u;case 9:if(l>=h.length){t.next=25;break}if(d=(v=(f=h[l]).parsedStyle.clipPath)||f,p=f.getWorldTransform(),v&&(y=C(),g=p,m=v.getLocalTransform(),w=void 0,x=void 0,b=void 0,E=void 0,L=void 0,P=void 0,S=void 0,k=void 0,N=void 0,T=void 0,j=void 0,M=void 0,A=void 0,_=void 0,R=void 0,G=void 0,F=void 0,I=void 0,B=void 0,D=void 0,x=g[1],b=g[2],E=g[3],P=g[5],S=g[6],k=g[7],T=g[9],j=g[10],M=g[11],_=g[13],R=g[14],G=g[15],y[0]=(F=m[0])*(w=g[0])+(I=m[1])*(L=g[4])+(B=m[2])*(N=g[8])+(D=m[3])*(A=g[12]),y[1]=F*x+I*P+B*T+D*_,y[2]=F*b+I*S+B*j+D*R,y[3]=F*E+I*k+B*M+D*G,y[4]=(F=m[4])*w+(I=m[5])*L+(B=m[6])*N+(D=m[7])*A,y[5]=F*x+I*P+B*T+D*_,y[6]=F*b+I*S+B*j+D*R,y[7]=F*E+I*k+B*M+D*G,y[8]=(F=m[8])*w+(I=m[9])*L+(B=m[10])*N+(D=m[11])*A,y[9]=F*x+I*P+B*T+D*_,y[10]=F*b+I*S+B*j+D*R,y[11]=F*E+I*k+B*M+D*G,y[12]=(F=m[12])*w+(I=m[13])*L+(B=m[14])*N+(D=m[15])*A,y[13]=F*x+I*P+B*T+D*_,y[14]=F*b+I*S+B*j+D*R,y[15]=F*E+I*k+B*M+D*G,p=y),!e.isHit(d,i,p)){t.next=22;break}if(!n){t.next=21;break}return r.picked=[f],t.abrupt("return",r);case 21:s.push(f);case 22:l++,t.next=9;break;case 25:return r.picked=s,t.abrupt("return",r);case 27:case"end":return t.stop()}var y,g,m,w,x,b,E,L,P,S,k,N,T,j,M,A,_,R,G,F,I,B,D}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){x(i,n,o,a,c,"next",t)}function c(t){x(i,n,o,a,c,"throw",t)}a(void 0)}))});return function(t){return r.apply(this,arguments)}}())},t}(),M.tag="CanvasPicker",A=M);function G(t,e,r,n){var o=t-r,i=e-n;return Math.sqrt(o*o+i*i)}function F(t,e){return.001>Math.abs(t-e)}function I(t,e){var r=Math.min.apply(Math,t),n=Math.min.apply(Math,e);return{x:r,y:n,width:Math.max.apply(Math,t)-r,height:Math.max.apply(Math,e)-n}}function B(t){return(t+2*Math.PI)%(2*Math.PI)}g([e.inject(e.DisplayObjectPool),m("design:type",e.DisplayObjectPool)],R.prototype,"displayObjectPool",void 0),g([e.inject(e.CanvasConfig),m("design:type",Object)],R.prototype,"canvasConfig",void 0),g([e.inject(e.OffscreenCanvasCreator),m("design:type",e.OffscreenCanvasCreator)],R.prototype,"offscreenCanvas",void 0),g([e.inject(e.RBushRoot),m("design:type",e.RBush)],R.prototype,"rBush",void 0),g([e.inject(i),m("design:type",Function)],R.prototype,"pathGeneratorFactory",void 0),g([e.inject(_),m("design:type",Function)],R.prototype,"pointInPathPickerFactory",void 0),R=A=g([e.singleton({contrib:e.RenderingPluginContribution})],R);var D=function(t,e,r,n,o){return{x:(1-o)*t+o*r,y:(1-o)*e+o*n}},Y=function(t,e,r,n,o,i){var a=[r-t,n-e];if(function(t,e){return t[0]===e[0]&&t[1]===e[1]}(a,[0,0]))return Math.sqrt((o-t)*(o-t)+(i-e)*(i-e));var c=[-a[1],a[0]];return function(t,e){var r=e[0],n=e[1],o=r*r+n*n;o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o}(c,c),Math.abs(function(t,e){return t[0]*e[0]+t[1]*e[1]}([o-t,i-e],c))};function $(t,e,r,n,o,i){var a=-1,c=1/0,u=[r,n],s=20;i&&i>200&&(s=i/10);for(var l=1/s,h=l/10,f=0;s>=f;f++){var v=f*l,d=[o.apply(void 0,t.concat([v])),o.apply(void 0,e.concat([v]))],p=G(u[0],u[1],d[0],d[1]);c>p&&(a=v,c=p)}if(0===a)return{x:t[0],y:e[0]};if(1===a){var y=t.length;return{x:t[y-1],y:e[y-1]}}c=1/0;for(var g=0;32>g&&1e-4<=h;g++){var m=a-h,w=a+h,x=[o.apply(void 0,t.concat([m])),o.apply(void 0,e.concat([m]))],b=G(u[0],u[1],x[0],x[1]);if(m>=0&&c>b)a=m,c=b;else{var E=[o.apply(void 0,t.concat([w])),o.apply(void 0,e.concat([w]))],L=G(u[0],u[1],E[0],E[1]);1>=w&&c>L?(a=w,c=L):h*=.5}}return{x:o.apply(void 0,t.concat([a])),y:o.apply(void 0,e.concat([a]))}}function H(t,e,r,n){var o=1-n;return o*o*t+2*n*o*e+n*n*r}function W(t,e,r){var n=t+r-2*e;if(F(n,0))return[.5];var o=(t-e)/n;return o>1||0>o?[]:[o]}function U(t,e,r,n){return 2*(1-n)*(e-t)+2*n*(r-e)}function X(t,e,r,n,o,i,a){var c=H(t,r,o,a),u=H(e,n,i,a),s=D(t,e,r,n,a),l=D(r,n,o,i,a);return[[t,e,s.x,s.y,c,u],[c,u,l.x,l.y,o,i]]}function q(t,e,r,n,o,i,a){if(0===a)return(G(t,e,r,n)+G(r,n,o,i)+G(t,e,o,i))/2;var c=X(t,e,r,n,o,i,.5),u=c[0],s=c[1];return u.push(a-1),s.push(a-1),q.apply(void 0,u)+q.apply(void 0,s)}var z={box:function(t,e,r,n,o,i){var a=W(t,r,o)[0],c=W(e,n,i)[0],u=[t,o],s=[e,i];return void 0!==a&&u.push(H(t,r,o,a)),void 0!==c&&s.push(H(e,n,i,c)),I(u,s)},length:function(t,e,r,n,o,i){return q(t,e,r,n,o,i,3)},nearestPoint:function(t,e,r,n,o,i,a,c){return $([t,r,o],[e,n,i],a,c,H)},pointDistance:function(t,e,r,n,o,i,a,c){var u=this.nearestPoint(t,e,r,n,o,i,a,c);return G(u.x,u.y,a,c)},interpolationAt:H,pointAt:function(t,e,r,n,o,i,a){return{x:H(t,r,o,a),y:H(e,n,i,a)}},divide:function(t,e,r,n,o,i,a){return X(t,e,r,n,o,i,a)},tangentAngle:function(t,e,r,n,o,i,a){var c=U(t,r,o,a),u=U(e,n,i,a);return B(Math.atan2(u,c))}};function V(t,e,r,n,o){var i=1-o;return i*i*i*t+3*e*o*i*i+3*r*o*o*i+n*o*o*o}function Q(t,e,r,n,o){var i=1-o;return 3*(i*i*(e-t)+2*i*o*(r-e)+o*o*(n-r))}function J(t,e,r,n){var o,i,a,c=-3*t+9*e-9*r+3*n,u=6*t-12*e+6*r,s=3*e-3*t,l=[];if(F(c,0))F(u,0)||0>(o=-s/u)||o>1||l.push(o);else{var h=u*u-4*c*s;F(h,0)?l.push(-u/(2*c)):h>0&&(i=(-u-(a=Math.sqrt(h)))/(2*c),0>(o=(-u+a)/(2*c))||o>1||l.push(o),0>i||i>1||l.push(i))}return l}function K(t,e,r,n,o,i,a,c,u){var s=V(t,r,o,a,u),l=V(e,n,i,c,u),h=D(t,e,r,n,u),f=D(r,n,o,i,u),v=D(o,i,a,c,u),d=D(h.x,h.y,f.x,f.y,u),p=D(f.x,f.y,v.x,v.y,u);return[[t,e,h.x,h.y,d.x,d.y,s,l],[s,l,p.x,p.y,v.x,v.y,a,c]]}function Z(t,e,r,n,o,i,a,c,u){if(0===u)return function(t,e){for(var r=0,n=t.length,o=0;n>o;o++)r+=G(t[o],e[o],t[(o+1)%n],e[(o+1)%n]);return r/2}([t,r,o,a],[e,n,i,c]);var s=K(t,e,r,n,o,i,a,c,.5),l=[].concat(s[0],[u-1]),h=[].concat(s[1],[u-1]);return Z.apply(void 0,l)+Z.apply(void 0,h)}var tt={extrema:J,box:function(t,e,r,n,o,i,a,c){for(var u=[t,a],s=[e,c],l=J(t,r,o,a),h=J(e,n,i,c),f=0;l.length>f;f++)u.push(V(t,r,o,a,l[f]));for(var v=0;h.length>v;v++)s.push(V(e,n,i,c,h[v]));return I(u,s)},length:function(t,e,r,n,o,i,a,c){return Z(t,e,r,n,o,i,a,c,3)},nearestPoint:function(t,e,r,n,o,i,a,c,u,s,l){return $([t,r,o,a],[e,n,i,c],u,s,V,l)},pointDistance:function(t,e,r,n,o,i,a,c,u,s,l){var h=this.nearestPoint(t,e,r,n,o,i,a,c,u,s,l);return G(h.x,h.y,u,s)},interpolationAt:V,pointAt:function(t,e,r,n,o,i,a,c,u){return{x:V(t,r,o,a,u),y:V(e,n,i,c,u)}},divide:function(t,e,r,n,o,i,a,c,u){return K(t,e,r,n,o,i,a,c,u)},tangentAngle:function(t,e,r,n,o,i,a,c,u){var s=Q(t,r,o,a,u),l=Q(e,n,i,c,u);return B(Math.atan2(l,s))}};function et(t,e,r,n){var o=t-r,i=e-n;return Math.sqrt(o*o+i*i)}function rt(t,e,r,n,o,i){return!(t>o||o>t+r||e>i||i>e+n)}function nt(t,e,r,n,o,i,a,c){var u=(Math.atan2(c-e,a-t)+2*Math.PI)%(2*Math.PI);if(n>u||u>o)return!1;var s={x:t+r*Math.cos(u),y:e+r*Math.sin(u)};return et(s.x,s.y,a,c)<=i/2}function ot(t,e,r,n,o,i,a){var c=Math.min(t,r),u=Math.max(t,r),s=Math.min(e,n),l=Math.max(e,n),h=o/2;return!(c-h>i||i>u+h||s-h>a||a>l+h)&&Y(t,e,r,n,i,a)<=o/2}function it(t,e,r,n,o){var i=t.length;if(2>i)return!1;for(var a=0;i-1>a;a++){if(ot(t[a][0],t[a][1],t[a+1][0],t[a+1][1],e,r,n))return!0}if(o){var c=t[0],u=t[i-1];if(ot(c[0],c[1],u[0],u[1],e,r,n))return!0}return!1}function at(t){return 1e-6>Math.abs(t)?0:0>t?-1:1}function ct(t,e,r){return!((r[0]-t[0])*(e[1]-t[1])!=(e[0]-t[0])*(r[1]-t[1])||Math.min(t[0],e[0])>r[0]||r[0]>Math.max(t[0],e[0])||Math.min(t[1],e[1])>r[1]||r[1]>Math.max(t[1],e[1]))}function ut(t,e,r){var n=!1,o=t.length;if(2>=o)return!1;for(var i=0;o>i;i++){var a=t[i],c=t[(i+1)%o];if(ct(a,c,[e,r]))return!0;at(a[1]-r)>0!=at(c[1]-r)>0&&0>at(e-(r-a[1])*(a[0]-c[0])/(a[1]-c[1])-a[0])&&(n=!n)}return n}function st(t,e,r){for(var n=!1,o=0;t.length>o;o++){if(n=ut(t[o],e,r))break}return n}function lt(t,e){var r=t.parsedStyle,n=r.fill,o=r.stroke,i=r.lineWidth,a=r.increasedLineWidthForHitTesting,c=r.clipPathTargets,u=r.r.value,s=((i&&i.value||0)+(a&&a.value||0))/2,l=et(u,u,e.x,e.y),h=n&&!n.isNone,f=o&&!o.isNone;return h&&f||!!(null==c?void 0:c.length)?u+s>=l:h?u>=l:!!f&&(l>=u-s&&u+s>=l)}function ht(t,e,r,n){return t/(r*r)+e/(n*n)}function ft(t,e){var r=e.x,n=e.y,o=t.parsedStyle,i=o.fill,a=o.stroke,c=o.lineWidth,u=o.clipPathTargets,s=i&&!i.isNone,l=a&&!a.isNone,h=o.rx.value,f=o.ry.value,v=(((null==c?void 0:c.value)||0)+o.increasedLineWidthForHitTesting.value)/2,d=(r-h)*(r-h),p=(n-f)*(n-f);return s&&l||!!(null==u?void 0:u.length)?1>=ht(d,p,h+v,f+v):s?1>=ht(d,p,h,f):!!l&&(ht(d,p,h-v,f-v)>=1&&1>=ht(d,p,h+v,f+v))}function vt(t,e){var r=t.parsedStyle,n=r.defX,o=r.defY;return ot(r.x1.value,r.y1.value,r.x2.value,r.y2.value,r.lineWidth.value+r.increasedLineWidthForHitTesting.value,e.x+(void 0===n?0:n),e.y+(void 0===o?0:o))}function dt(t,e,r){var n=t.parsedStyle,o=n.stroke,i=n.fill,a=n.defX,c=void 0===a?0:a,u=n.defY,s=void 0===u?0:u,l=n.clipPathTargets,h=n.path,f=i&&!i.isNone,v=h.hasArc,d=h.polylines,p=h.polygons,y=!!(null==l?void 0:l.length),g=!1;return(o&&!o.isNone||y)&&(g=function(t,e,r,n,o,i,a){for(var c,u,s=!1,l=e/2,h=0;t.length>h;h++){var f=t[h],v=f.currentPoint,d=f.params,p=f.prePoint,y=f.box;if(!y||rt(y.x-l,y.y-l,y.width+e,y.height+e,r,n)){switch(f.command){case"L":case"Z":s=ot(p[0],p[1],v[0],v[1],e,r,n);break;case"Q":s=e/2>=z.pointDistance(p[0],p[1],d[1],d[2],d[3],d[4],r,n);break;case"C":s=e/2>=tt.pointDistance(p[0],p[1],d[1],d[2],d[3],d[4],d[5],d[6],r,n,o);break;case"A":var g=f.arcParams,m=g.rx,w=g.ry,x=g.startAngle,b=g.endAngle,C=g.xRotation,k=m>w?m:w,O=m>w?1:m/w,N=m>w?w/m:1,M=(u=[-g.cx,-g.cy],(c=E())[0]=1,c[1]=0,c[2]=0,c[3]=0,c[4]=1,c[5]=0,c[6]=u[0],c[7]=u[1],c[8]=1,c);L(M,P(E(),-C),M),L(M,S(E(),[1/O,1/N]),M);var A=T(r,n);s=nt(0,0,k,x,b,e,(A=j(A,A,M))[0],A[1])}if(s)break}}return s}(h.segments,n.lineWidth.value+n.increasedLineWidthForHitTesting.value,e.x+c,e.y+s,h.totalLength)),g||!f&&!y||(g=v?r(t,e):st(p,e.x+c,e.y+s)||st(d,e.x+c,e.y+s)),g}function pt(t,e){var r=t.parsedStyle,n=r.stroke,o=r.fill,i=r.points,a=r.defX,c=void 0===a?0:a,u=r.defY,s=void 0===u?0:u,l=r.clipPathTargets,h=!!(null==l?void 0:l.length),f=o&&!o.isNone,v=!1;return(n&&!n.isNone||h)&&(v=it(i.points,r.lineWidth.value+r.increasedLineWidthForHitTesting.value,e.x+c,e.y+s,!0)),v||!f&&!h||(v=ut(i.points,e.x+c,e.y+s)),v}function yt(t,e){var r=t.parsedStyle,n=r.stroke,o=r.lineWidth,i=r.defX,a=r.defY,c=r.clipPathTargets;return!((!n||n.isNone)&&!(null==c?void 0:c.length)||!o)&&it(r.points.points,o.value+r.increasedLineWidthForHitTesting.value,e.x+(void 0===i?0:i),e.y+(void 0===a?0:a),!1)}function gt(t,r,n){var o=t.parsedStyle,i=o.radius,a=o.fill,c=o.stroke,u=o.lineWidth,s=o.increasedLineWidthForHitTesting,l=o.width,h=o.height,f=o.clipPathTargets,v=!!(null==f?void 0:f.length),d=a&&!a.isNone,p=c&&!c.isNone,y=i&&i.some((function(t){return 0!==t.value})),g=l.unit,m=h.unit,w=0,x=0;g!==e.UnitType.kNumber&&g!==e.UnitType.kPixels||(w=l.value),m!==e.UnitType.kNumber&&m!==e.UnitType.kPixels||(x=h.value);var b=u.value+s.value;if(y){var E=!1;return(p||v)&&(E=function(t,e,r,n,o,i,a,c){var u=o[0],s=o[1],l=o[2],h=o[3];return ot(t+u,e,t+r-s,e,i,a,c)||ot(t+r,e+s,t+r,e+n-l,i,a,c)||ot(t+r-l,e+n,t+h,e+n,i,a,c)||ot(t,e+n-h,t,e+u,i,a,c)||nt(t+r-s,e+s,s,1.5*Math.PI,2*Math.PI,i,a,c)||nt(t+r-l,e+n-l,l,0,.5*Math.PI,i,a,c)||nt(t+h,e+n-h,h,.5*Math.PI,Math.PI,i,a,c)||nt(t+u,e+u,u,Math.PI,1.5*Math.PI,i,a,c)}(0,0,w,x,i.map((function(t){return e.clamp(t.value,0,Math.min(Math.abs(w)/2,Math.abs(x)/2))})),b,r.x,r.y)),E||!d&&!v||(E=n(t,r)),E}var L=b/2;return d&&p||v?rt(0-L,0-L,w+L,x+L,r.x,r.y):d?rt(0,0,w,x,r.x,r.y):!!p&&function(t,e,r,n,o,i,a){var c=o/2;return rt(t-c,e-c,r,o,i,a)||rt(t+r-c,e-c,o,n,i,a)||rt(t+c,e+n-c,r,o,i,a)||rt(t-c,e+c,o,n,i,a)}(0,0,w,x,b,r.x,r.y)}var mt,wt,xt=e.Module((function(t){t({token:_,useFactory:function(t){return function(t){return t===e.Shape.CIRCLE?lt:t===e.Shape.ELLIPSE?ft:t===e.Shape.RECT?gt:t===e.Shape.LINE?vt:t===e.Shape.POLYLINE?yt:t===e.Shape.POLYGON?pt:t===e.Shape.PATH?dt:t===e.Shape.IMAGE||t===e.Shape.TEXT?function(){return!0}:null}}}),t(R)})),bt=function(){function t(){this.name="canvas-picker"}var e=t.prototype;return e.init=function(t){t.load(xt,!0)},e.destroy=function(t){t.unload(xt)},t}(),Et=Object.freeze({__proto__:null,Plugin:bt}),Lt=function(){function t(){this.imageCache={},this.gradientCache={},this.patternCache={},this.canvasConfig=void 0}var r=t.prototype;return r.getImageSync=function(t,e){return this.imageCache[t]||this.getOrCreateImage(t).then((function(){e&&e()})),this.imageCache[t]},r.getOrCreateImage=function(t){var r=this;if(this.imageCache[t])return Promise.resolve(this.imageCache[t]);var n=this.canvasConfig.createImage;return new Promise((function(o,i){var a;n?a=n(t):e.isBrowser&&(a=new window.Image),a&&(a.onload=function(){o(a)},a.onerror=function(t){i(t)},a.crossOrigin="Anonymous",a.src=t,r.imageCache[t]=a)}))},r.getOrCreatePatternSync=function(t,r,n){var o=this.generatePatternKey(t);if(o&&this.patternCache[o])return this.patternCache[o];var i,a=t.image,c=t.repetition,u=(i=e.isString(a)?this.getImageSync(a,n):a)&&r.createPattern(i,c);return o&&u&&(this.patternCache[o]=u),u},r.getOrCreateGradient=function(t,r){var n=this.generateGradientKey(t),o=t.type,i=t.steps,a=t.width,c=t.height,u=t.cx,s=t.cy;if(this.gradientCache[n])return this.gradientCache[n];var l=null;if(o===e.GradientType.LinearGradient){var h=e.computeLinearGradient(a,c,t.angle);l=r.createLinearGradient(h.x1,h.y1,h.x2,h.y2)}else if(o===e.GradientType.RadialGradient){var f=e.computeRadialGradient(a,c,u,s),v=f.x,d=f.y;l=r.createRadialGradient(v,d,0,v,d,f.r)}return l&&(i.forEach((function(t){var e;null===(e=l)||void 0===e||e.addColorStop(t[0],t[1])})),this.gradientCache[n]=l),this.gradientCache[n]},r.generateGradientKey=function(t){return"gradient-"+t.type+"-"+(t.angle||0)+"-"+(t.cx||0)+"-"+(t.cy||0)+"-"+t.width+"-"+t.height+"-"+t.steps.map((function(t){return t.join("")})).join("-")},r.generatePatternKey=function(t){var r=t.image,n=t.repetition;if(e.isString(r))return"pattern-"+r+"-"+n},t}();function Pt(){
|
|
5
|
+
x=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=Object.create((e&&e.prototype instanceof h?e:h).prototype),i=new P(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return C()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=b(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),o}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function h(){}function f(){}function v(){}var d={};c(d,o,(function(){return this}));var p=Object.getPrototypeOf,y=p&&p(p(k([])));y&&y!==e&&r.call(y,o)&&(d=y);var g=v.prototype=h.prototype=Object.create(d);function m(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function n(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function k(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:C}}function C(){return{value:void 0,done:!0}}return f.prototype=v,c(g,"constructor",v),c(v,"constructor",f),f.displayName=c(v,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(w.prototype),c(w.prototype,i,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(g),c(g,a,"Generator"),c(g,o,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=k,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function b(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var E="undefined"!=typeof Float32Array?Float32Array:Array;function L(){var t=new E(9);return E!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function P(t,e,r){var n=e[0],o=e[1],i=e[2],a=e[3],c=e[4],u=e[5],s=e[6],l=e[7],h=e[8],f=r[0],v=r[1],d=r[2],p=r[3],y=r[4],g=r[5],m=r[6],w=r[7],x=r[8];return t[0]=f*n+v*a+d*s,t[1]=f*o+v*c+d*l,t[2]=f*i+v*u+d*h,t[3]=p*n+y*a+g*s,t[4]=p*o+y*c+g*l,t[5]=p*i+y*u+g*h,t[6]=m*n+w*a+x*s,t[7]=m*o+w*c+x*l,t[8]=m*i+w*u+x*h,t}function k(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=-r,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function C(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function S(){var t=new E(16);return E!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function O(){var t=new E(3);return E!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function T(t,e,r){var n=new E(3);return n[0]=t,n[1]=e,n[2]=r,n}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var N;N=O();function j(t,e){var r=new E(2);return r[0]=t,r[1]=e,r}function M(t,e,r){var n=e[0],o=e[1];return t[0]=r[0]*n+r[3]*o+r[6],t[1]=r[1]*n+r[4]*o+r[7],t}!function(){var t,e=(t=new E(2),E!=Float32Array&&(t[0]=0,t[1]=0),t)}();var A,_,R=e.Syringe.defineToken("PointInPathPicker"),G=(A=function(){function t(){var t=this;this.displayObjectPool=void 0,this.canvasConfig=void 0,this.offscreenCanvas=void 0,this.rBush=void 0,this.pathGeneratorFactory=void 0,this.pathGeneratorFactoryCache={},this.pointInPathPickerFactory=void 0,this.isHit=function(r,n,o){var i,a,c,u,s,l,h,f,v,d,p,y,g,m,w,x,b,E,L,P,k,C,N,j,M,A,_,R,G,F,I,B=t.pointInPathPickerFactory(r.nodeName);if(B){var D=(i=S(),(I=(L=(c=(a=o)[0])*(f=a[5])-(u=a[1])*(h=a[4]))*(F=(g=a[10])*(E=a[15])-(m=a[11])*(b=a[14]))-(P=c*(v=a[6])-(s=a[2])*h)*(G=(y=a[9])*E-m*(x=a[13]))+(k=c*(d=a[7])-(l=a[3])*h)*(R=y*b-g*x)+(C=u*v-s*f)*(_=(p=a[8])*E-m*(w=a[12]))-(N=u*d-l*f)*(A=p*b-g*w)+(j=s*d-l*v)*(M=p*x-y*w))?(i[0]=(f*F-v*G+d*R)*(I=1/I),i[1]=(s*G-u*F-l*R)*I,i[2]=(x*j-b*N+E*C)*I,i[3]=(g*N-y*j-m*C)*I,i[4]=(v*_-h*F-d*A)*I,i[5]=(c*F-s*_+l*A)*I,i[6]=(b*k-w*j-E*P)*I,i[7]=(p*j-g*k+m*P)*I,i[8]=(h*G-f*_+d*M)*I,i[9]=(u*_-c*G-l*M)*I,i[10]=(w*N-x*k+E*L)*I,i[11]=(y*k-p*N-m*L)*I,i[12]=(f*A-h*R-v*M)*I,i[13]=(c*R-u*A+s*M)*I,i[14]=(x*P-w*C-b*L)*I,i[15]=(p*C-y*P+g*L)*I,i):null),Y=function(t,e,r){var n=e[0],o=e[1],i=e[2],a=r[3]*n+r[7]*o+r[11]*i+r[15];return t[0]=(r[0]*n+r[4]*o+r[8]*i+r[12])/(a=a||1),t[1]=(r[1]*n+r[5]*o+r[9]*i+r[13])/a,t[2]=(r[2]*n+r[6]*o+r[10]*i+r[14])/a,t}(O(),T(n[0],n[1],0),D),$=r.getGeometryBounds().halfExtents,H=r.parsedStyle.anchor;if(Y[0]+=(H&&H[0].value||0)*$[0]*2,Y[1]+=(H&&H[1].value||0)*$[1]*2,B(r,new e.Point(Y[0],Y[1]),t.isPointInPath))return!0}return!1},this.isPointInPath=function(e,r){var n=t.offscreenCanvas.getOrCreateContext(t.canvasConfig.offscreenCanvas);void 0===t.pathGeneratorFactoryCache[e.nodeName]&&(t.pathGeneratorFactoryCache[e.nodeName]=t.pathGeneratorFactory(e.nodeName));var o=t.pathGeneratorFactoryCache[e.nodeName];return o&&o(n,e.parsedStyle),n.isPointInPath(r.x,r.y)}}return t.prototype.apply=function(t){var e=this;t.hooks.pick.tapPromise(_.tag,function(){var t,r=(t=x().mark((function t(r){var n,o,i,a,c,u,s,l,h,f,v,d,p;return x().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=r.topmost,i=T((o=r.position).x,o.y,0),a=e.rBush.search({minX:i[0],minY:i[1],maxX:i[0],maxY:i[1]}),c=a.map((function(t){return t.id})),u=[],a.forEach((function(t){var r=e.displayObjectPool.getByEntity(t.id);if(r.isVisible()&&!r.isCulled()&&r.isInteractive()){if(r.parentNode&&-1===c.indexOf(r.parentNode.entity))return;u.push(r)}})),u.sort((function(t,e){return e.sortable.renderOrder-t.sortable.renderOrder})),s=[],l=0,h=u;case 9:if(l>=h.length){t.next=25;break}if(d=(v=(f=h[l]).parsedStyle.clipPath)||f,p=f.getWorldTransform(),v&&(y=S(),g=p,m=v.getLocalTransform(),w=void 0,x=void 0,b=void 0,E=void 0,L=void 0,P=void 0,k=void 0,C=void 0,O=void 0,N=void 0,j=void 0,M=void 0,A=void 0,_=void 0,R=void 0,G=void 0,F=void 0,I=void 0,B=void 0,D=void 0,x=g[1],b=g[2],E=g[3],P=g[5],k=g[6],C=g[7],N=g[9],j=g[10],M=g[11],_=g[13],R=g[14],G=g[15],y[0]=(F=m[0])*(w=g[0])+(I=m[1])*(L=g[4])+(B=m[2])*(O=g[8])+(D=m[3])*(A=g[12]),y[1]=F*x+I*P+B*N+D*_,y[2]=F*b+I*k+B*j+D*R,y[3]=F*E+I*C+B*M+D*G,y[4]=(F=m[4])*w+(I=m[5])*L+(B=m[6])*O+(D=m[7])*A,y[5]=F*x+I*P+B*N+D*_,y[6]=F*b+I*k+B*j+D*R,y[7]=F*E+I*C+B*M+D*G,y[8]=(F=m[8])*w+(I=m[9])*L+(B=m[10])*O+(D=m[11])*A,y[9]=F*x+I*P+B*N+D*_,y[10]=F*b+I*k+B*j+D*R,y[11]=F*E+I*C+B*M+D*G,y[12]=(F=m[12])*w+(I=m[13])*L+(B=m[14])*O+(D=m[15])*A,y[13]=F*x+I*P+B*N+D*_,y[14]=F*b+I*k+B*j+D*R,y[15]=F*E+I*C+B*M+D*G,p=y),!e.isHit(d,i,p)){t.next=22;break}if(!n){t.next=21;break}return r.picked=[f],t.abrupt("return",r);case 21:s.push(f);case 22:l++,t.next=9;break;case 25:return r.picked=s,t.abrupt("return",r);case 27:case"end":return t.stop()}var y,g,m,w,x,b,E,L,P,k,C,O,N,j,M,A,_,R,G,F,I,B,D}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){b(i,n,o,a,c,"next",t)}function c(t){b(i,n,o,a,c,"throw",t)}a(void 0)}))});return function(t){return r.apply(this,arguments)}}())},t}(),A.tag="CanvasPicker",_=A);function F(t,e,r,n){var o=t-r,i=e-n;return Math.sqrt(o*o+i*i)}function I(t,e){return.001>Math.abs(t-e)}function B(t,e){var r=Math.min.apply(Math,t),n=Math.min.apply(Math,e);return{x:r,y:n,width:Math.max.apply(Math,t)-r,height:Math.max.apply(Math,e)-n}}function D(t){return(t+2*Math.PI)%(2*Math.PI)}m([e.inject(e.DisplayObjectPool),w("design:type",e.DisplayObjectPool)],G.prototype,"displayObjectPool",void 0),m([e.inject(e.CanvasConfig),w("design:type",Object)],G.prototype,"canvasConfig",void 0),m([e.inject(e.OffscreenCanvasCreator),w("design:type",e.OffscreenCanvasCreator)],G.prototype,"offscreenCanvas",void 0),m([e.inject(e.RBushRoot),w("design:type",e.RBush)],G.prototype,"rBush",void 0),m([e.inject(a),w("design:type",Function)],G.prototype,"pathGeneratorFactory",void 0),m([e.inject(R),w("design:type",Function)],G.prototype,"pointInPathPickerFactory",void 0),G=_=m([e.singleton({contrib:e.RenderingPluginContribution})],G);var Y=function(t,e,r,n,o){return{x:(1-o)*t+o*r,y:(1-o)*e+o*n}},$=function(t,e,r,n,o,i){var a=[r-t,n-e];if(function(t,e){return t[0]===e[0]&&t[1]===e[1]}(a,[0,0]))return Math.sqrt((o-t)*(o-t)+(i-e)*(i-e));var c=[-a[1],a[0]];return function(t,e){var r=e[0],n=e[1],o=r*r+n*n;o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o}(c,c),Math.abs(function(t,e){return t[0]*e[0]+t[1]*e[1]}([o-t,i-e],c))};function H(t,e,r,n,o,i){var a=-1,c=1/0,u=[r,n],s=20;i&&i>200&&(s=i/10);for(var l=1/s,h=l/10,f=0;s>=f;f++){var v=f*l,d=[o.apply(void 0,t.concat([v])),o.apply(void 0,e.concat([v]))],p=F(u[0],u[1],d[0],d[1]);c>p&&(a=v,c=p)}if(0===a)return{x:t[0],y:e[0]};if(1===a){var y=t.length;return{x:t[y-1],y:e[y-1]}}c=1/0;for(var g=0;32>g&&1e-4<=h;g++){var m=a-h,w=a+h,x=[o.apply(void 0,t.concat([m])),o.apply(void 0,e.concat([m]))],b=F(u[0],u[1],x[0],x[1]);if(m>=0&&c>b)a=m,c=b;else{var E=[o.apply(void 0,t.concat([w])),o.apply(void 0,e.concat([w]))],L=F(u[0],u[1],E[0],E[1]);1>=w&&c>L?(a=w,c=L):h*=.5}}return{x:o.apply(void 0,t.concat([a])),y:o.apply(void 0,e.concat([a]))}}function W(t,e,r,n){var o=1-n;return o*o*t+2*n*o*e+n*n*r}function U(t,e,r){var n=t+r-2*e;if(I(n,0))return[.5];var o=(t-e)/n;return o>1||0>o?[]:[o]}function X(t,e,r,n){return 2*(1-n)*(e-t)+2*n*(r-e)}function q(t,e,r,n,o,i,a){var c=W(t,r,o,a),u=W(e,n,i,a),s=Y(t,e,r,n,a),l=Y(r,n,o,i,a);return[[t,e,s.x,s.y,c,u],[c,u,l.x,l.y,o,i]]}function z(t,e,r,n,o,i,a){if(0===a)return(F(t,e,r,n)+F(r,n,o,i)+F(t,e,o,i))/2;var c=q(t,e,r,n,o,i,.5),u=c[0],s=c[1];return u.push(a-1),s.push(a-1),z.apply(void 0,u)+z.apply(void 0,s)}var V={box:function(t,e,r,n,o,i){var a=U(t,r,o)[0],c=U(e,n,i)[0],u=[t,o],s=[e,i];return void 0!==a&&u.push(W(t,r,o,a)),void 0!==c&&s.push(W(e,n,i,c)),B(u,s)},length:function(t,e,r,n,o,i){return z(t,e,r,n,o,i,3)},nearestPoint:function(t,e,r,n,o,i,a,c){return H([t,r,o],[e,n,i],a,c,W)},pointDistance:function(t,e,r,n,o,i,a,c){var u=this.nearestPoint(t,e,r,n,o,i,a,c);return F(u.x,u.y,a,c)},interpolationAt:W,pointAt:function(t,e,r,n,o,i,a){return{x:W(t,r,o,a),y:W(e,n,i,a)}},divide:function(t,e,r,n,o,i,a){return q(t,e,r,n,o,i,a)},tangentAngle:function(t,e,r,n,o,i,a){var c=X(t,r,o,a),u=X(e,n,i,a);return D(Math.atan2(u,c))}};function Q(t,e,r,n,o){var i=1-o;return i*i*i*t+3*e*o*i*i+3*r*o*o*i+n*o*o*o}function J(t,e,r,n,o){var i=1-o;return 3*(i*i*(e-t)+2*i*o*(r-e)+o*o*(n-r))}function K(t,e,r,n){var o,i,a,c=-3*t+9*e-9*r+3*n,u=6*t-12*e+6*r,s=3*e-3*t,l=[];if(I(c,0))I(u,0)||0>(o=-s/u)||o>1||l.push(o);else{var h=u*u-4*c*s;I(h,0)?l.push(-u/(2*c)):h>0&&(i=(-u-(a=Math.sqrt(h)))/(2*c),0>(o=(-u+a)/(2*c))||o>1||l.push(o),0>i||i>1||l.push(i))}return l}function Z(t,e,r,n,o,i,a,c,u){var s=Q(t,r,o,a,u),l=Q(e,n,i,c,u),h=Y(t,e,r,n,u),f=Y(r,n,o,i,u),v=Y(o,i,a,c,u),d=Y(h.x,h.y,f.x,f.y,u),p=Y(f.x,f.y,v.x,v.y,u);return[[t,e,h.x,h.y,d.x,d.y,s,l],[s,l,p.x,p.y,v.x,v.y,a,c]]}function tt(t,e,r,n,o,i,a,c,u){if(0===u)return function(t,e){for(var r=0,n=t.length,o=0;n>o;o++)r+=F(t[o],e[o],t[(o+1)%n],e[(o+1)%n]);return r/2}([t,r,o,a],[e,n,i,c]);var s=Z(t,e,r,n,o,i,a,c,.5),l=[].concat(s[0],[u-1]),h=[].concat(s[1],[u-1]);return tt.apply(void 0,l)+tt.apply(void 0,h)}var et={extrema:K,box:function(t,e,r,n,o,i,a,c){for(var u=[t,a],s=[e,c],l=K(t,r,o,a),h=K(e,n,i,c),f=0;l.length>f;f++)u.push(Q(t,r,o,a,l[f]));for(var v=0;h.length>v;v++)s.push(Q(e,n,i,c,h[v]));return B(u,s)},length:function(t,e,r,n,o,i,a,c){return tt(t,e,r,n,o,i,a,c,3)},nearestPoint:function(t,e,r,n,o,i,a,c,u,s,l){return H([t,r,o,a],[e,n,i,c],u,s,Q,l)},pointDistance:function(t,e,r,n,o,i,a,c,u,s,l){var h=this.nearestPoint(t,e,r,n,o,i,a,c,u,s,l);return F(h.x,h.y,u,s)},interpolationAt:Q,pointAt:function(t,e,r,n,o,i,a,c,u){return{x:Q(t,r,o,a,u),y:Q(e,n,i,c,u)}},divide:function(t,e,r,n,o,i,a,c,u){return Z(t,e,r,n,o,i,a,c,u)},tangentAngle:function(t,e,r,n,o,i,a,c,u){var s=J(t,r,o,a,u),l=J(e,n,i,c,u);return D(Math.atan2(l,s))}};function rt(t,e,r,n){var o=t-r,i=e-n;return Math.sqrt(o*o+i*i)}function nt(t,e,r,n,o,i){return!(t>o||o>t+r||e>i||i>e+n)}function ot(t,e,r,n,o,i,a,c){var u=(Math.atan2(c-e,a-t)+2*Math.PI)%(2*Math.PI);if(n>u||u>o)return!1;var s={x:t+r*Math.cos(u),y:e+r*Math.sin(u)};return rt(s.x,s.y,a,c)<=i/2}function it(t,e,r,n,o,i,a){var c=Math.min(t,r),u=Math.max(t,r),s=Math.min(e,n),l=Math.max(e,n),h=o/2;return!(c-h>i||i>u+h||s-h>a||a>l+h)&&$(t,e,r,n,i,a)<=o/2}function at(t,e,r,n,o){var i=t.length;if(2>i)return!1;for(var a=0;i-1>a;a++){if(it(t[a][0],t[a][1],t[a+1][0],t[a+1][1],e,r,n))return!0}if(o){var c=t[0],u=t[i-1];if(it(c[0],c[1],u[0],u[1],e,r,n))return!0}return!1}function ct(t){return 1e-6>Math.abs(t)?0:0>t?-1:1}function ut(t,e,r){return!((r[0]-t[0])*(e[1]-t[1])!=(e[0]-t[0])*(r[1]-t[1])||Math.min(t[0],e[0])>r[0]||r[0]>Math.max(t[0],e[0])||Math.min(t[1],e[1])>r[1]||r[1]>Math.max(t[1],e[1]))}function st(t,e,r){var n=!1,o=t.length;if(2>=o)return!1;for(var i=0;o>i;i++){var a=t[i],c=t[(i+1)%o];if(ut(a,c,[e,r]))return!0;ct(a[1]-r)>0!=ct(c[1]-r)>0&&0>ct(e-(r-a[1])*(a[0]-c[0])/(a[1]-c[1])-a[0])&&(n=!n)}return n}function lt(t,e,r){for(var n=!1,o=0;t.length>o;o++){if(n=st(t[o],e,r))break}return n}function ht(t,e){var r=t.parsedStyle,n=r.fill,o=r.stroke,i=r.lineWidth,a=r.increasedLineWidthForHitTesting,c=r.clipPathTargets,u=r.r.value,s=((i&&i.value||0)+(a&&a.value||0))/2,l=rt(u,u,e.x,e.y),h=n&&!n.isNone,f=o&&!o.isNone;return h&&f||!!(null==c?void 0:c.length)?u+s>=l:h?u>=l:!!f&&(l>=u-s&&u+s>=l)}function ft(t,e,r,n){return t/(r*r)+e/(n*n)}function vt(t,e){var r=e.x,n=e.y,o=t.parsedStyle,i=o.fill,a=o.stroke,c=o.lineWidth,u=o.clipPathTargets,s=i&&!i.isNone,l=a&&!a.isNone,h=o.rx.value,f=o.ry.value,v=(((null==c?void 0:c.value)||0)+o.increasedLineWidthForHitTesting.value)/2,d=(r-h)*(r-h),p=(n-f)*(n-f);return s&&l||!!(null==u?void 0:u.length)?1>=ft(d,p,h+v,f+v):s?1>=ft(d,p,h,f):!!l&&(ft(d,p,h-v,f-v)>=1&&1>=ft(d,p,h+v,f+v))}function dt(t,e){var r=t.parsedStyle,n=r.defX,o=r.defY;return it(r.x1.value,r.y1.value,r.x2.value,r.y2.value,r.lineWidth.value+r.increasedLineWidthForHitTesting.value,e.x+(void 0===n?0:n),e.y+(void 0===o?0:o))}function pt(t,e,r){var n=t.parsedStyle,o=n.stroke,i=n.fill,a=n.defX,c=void 0===a?0:a,u=n.defY,s=void 0===u?0:u,l=n.clipPathTargets,h=n.path,f=i&&!i.isNone,v=h.hasArc,d=h.polylines,p=h.polygons,y=!!(null==l?void 0:l.length),g=!1;return(o&&!o.isNone||y)&&(g=function(t,e,r,n,o,i,a){for(var c,u,s=!1,l=e/2,h=0;t.length>h;h++){var f=t[h],v=f.currentPoint,d=f.params,p=f.prePoint,y=f.box;if(!y||nt(y.x-l,y.y-l,y.width+e,y.height+e,r,n)){switch(f.command){case"L":case"Z":s=it(p[0],p[1],v[0],v[1],e,r,n);break;case"Q":s=e/2>=V.pointDistance(p[0],p[1],d[1],d[2],d[3],d[4],r,n);break;case"C":s=e/2>=et.pointDistance(p[0],p[1],d[1],d[2],d[3],d[4],d[5],d[6],r,n,o);break;case"A":var g=f.arcParams,m=g.rx,w=g.ry,x=g.startAngle,b=g.endAngle,E=g.xRotation,S=m>w?m:w,O=m>w?1:m/w,T=m>w?w/m:1,N=(u=[-g.cx,-g.cy],(c=L())[0]=1,c[1]=0,c[2]=0,c[3]=0,c[4]=1,c[5]=0,c[6]=u[0],c[7]=u[1],c[8]=1,c);P(N,k(L(),-E),N),P(N,C(L(),[1/O,1/T]),N);var A=j(r,n);s=ot(0,0,S,x,b,e,(A=M(A,A,N))[0],A[1])}if(s)break}}return s}(h.segments,n.lineWidth.value+n.increasedLineWidthForHitTesting.value,e.x+c,e.y+s,h.totalLength)),g||!f&&!y||(g=v?r(t,e):lt(p,e.x+c,e.y+s)||lt(d,e.x+c,e.y+s)),g}function yt(t,e){var r=t.parsedStyle,n=r.stroke,o=r.fill,i=r.points,a=r.defX,c=void 0===a?0:a,u=r.defY,s=void 0===u?0:u,l=r.clipPathTargets,h=!!(null==l?void 0:l.length),f=o&&!o.isNone,v=!1;return(n&&!n.isNone||h)&&(v=at(i.points,r.lineWidth.value+r.increasedLineWidthForHitTesting.value,e.x+c,e.y+s,!0)),v||!f&&!h||(v=st(i.points,e.x+c,e.y+s)),v}function gt(t,e){var r=t.parsedStyle,n=r.stroke,o=r.lineWidth,i=r.defX,a=r.defY,c=r.clipPathTargets;return!((!n||n.isNone)&&!(null==c?void 0:c.length)||!o)&&at(r.points.points,o.value+r.increasedLineWidthForHitTesting.value,e.x+(void 0===i?0:i),e.y+(void 0===a?0:a),!1)}function mt(t,r,n){var o=t.parsedStyle,i=o.radius,a=o.fill,c=o.stroke,u=o.lineWidth,s=o.increasedLineWidthForHitTesting,l=o.width,h=o.height,f=o.clipPathTargets,v=!!(null==f?void 0:f.length),d=a&&!a.isNone,p=c&&!c.isNone,y=i&&i.some((function(t){return 0!==t.value})),g=l.unit,m=h.unit,w=0,x=0;g!==e.UnitType.kNumber&&g!==e.UnitType.kPixels||(w=l.value),m!==e.UnitType.kNumber&&m!==e.UnitType.kPixels||(x=h.value);var b=u.value+s.value;if(y){var E=!1;return(p||v)&&(E=function(t,e,r,n,o,i,a,c){var u=o[0],s=o[1],l=o[2],h=o[3];return it(t+u,e,t+r-s,e,i,a,c)||it(t+r,e+s,t+r,e+n-l,i,a,c)||it(t+r-l,e+n,t+h,e+n,i,a,c)||it(t,e+n-h,t,e+u,i,a,c)||ot(t+r-s,e+s,s,1.5*Math.PI,2*Math.PI,i,a,c)||ot(t+r-l,e+n-l,l,0,.5*Math.PI,i,a,c)||ot(t+h,e+n-h,h,.5*Math.PI,Math.PI,i,a,c)||ot(t+u,e+u,u,Math.PI,1.5*Math.PI,i,a,c)}(0,0,w,x,i.map((function(t){return e.clamp(t.value,0,Math.min(Math.abs(w)/2,Math.abs(x)/2))})),b,r.x,r.y)),E||!d&&!v||(E=n(t,r)),E}var L=b/2;return d&&p||v?nt(0-L,0-L,w+L,x+L,r.x,r.y):d?nt(0,0,w,x,r.x,r.y):!!p&&function(t,e,r,n,o,i,a){var c=o/2;return nt(t-c,e-c,r,o,i,a)||nt(t+r-c,e-c,o,n,i,a)||nt(t+c,e+n-c,r,o,i,a)||nt(t-c,e+c,o,n,i,a)}(0,0,w,x,b,r.x,r.y)}var wt,xt,bt=e.Module((function(t){t({token:R,useFactory:function(t){return function(t){return t===e.Shape.CIRCLE?ht:t===e.Shape.ELLIPSE?vt:t===e.Shape.RECT?mt:t===e.Shape.LINE?dt:t===e.Shape.POLYLINE?gt:t===e.Shape.POLYGON?yt:t===e.Shape.PATH?pt:t===e.Shape.IMAGE||t===e.Shape.TEXT?function(){return!0}:null}}}),t(G)})),Et=function(){function t(){this.name="canvas-picker"}var e=t.prototype;return e.init=function(t){t.load(bt,!0)},e.destroy=function(t){t.unload(bt)},t}(),Lt=Object.freeze({__proto__:null,Plugin:Et}),Pt=function(){function t(){this.imageCache={},this.gradientCache={},this.patternCache={},this.canvasConfig=void 0}var r=t.prototype;return r.getImageSync=function(t,e){return this.imageCache[t]||this.getOrCreateImage(t).then((function(){e&&e()})),this.imageCache[t]},r.getOrCreateImage=function(t){var r=this;if(this.imageCache[t])return Promise.resolve(this.imageCache[t]);var n=this.canvasConfig.createImage;return new Promise((function(o,i){var a;n?a=n(t):e.isBrowser&&(a=new window.Image),a&&(a.onload=function(){o(a)},a.onerror=function(t){i(t)},a.crossOrigin="Anonymous",a.src=t,r.imageCache[t]=a)}))},r.getOrCreatePatternSync=function(t,r,n){var o=this.generatePatternKey(t);if(o&&this.patternCache[o])return this.patternCache[o];var i,a=t.image,c=t.repetition,u=(i=e.isString(a)?this.getImageSync(a,n):a)&&r.createPattern(i,c);return o&&u&&(this.patternCache[o]=u),u},r.getOrCreateGradient=function(t,r){var n=this.generateGradientKey(t),o=t.type,i=t.steps,a=t.width,c=t.height,u=t.cx,s=t.cy;if(this.gradientCache[n])return this.gradientCache[n];var l=null;if(o===e.GradientType.LinearGradient){var h=e.computeLinearGradient(a,c,t.angle);l=r.createLinearGradient(h.x1,h.y1,h.x2,h.y2)}else if(o===e.GradientType.RadialGradient){var f=e.computeRadialGradient(a,c,u,s),v=f.x,d=f.y;l=r.createRadialGradient(v,d,0,v,d,f.r)}return l&&(i.forEach((function(t){var e;null===(e=l)||void 0===e||e.addColorStop(t[0],t[1])})),this.gradientCache[n]=l),this.gradientCache[n]},r.generateGradientKey=function(t){return"gradient-"+t.type+"-"+(t.angle||0)+"-"+(t.cx||0)+"-"+(t.cy||0)+"-"+t.width+"-"+t.height+"-"+t.steps.map((function(t){return t.join("")})).join("-")},r.generatePatternKey=function(t){var r=t.image,n=t.repetition;if(e.isString(r))return"pattern-"+r+"-"+n},t}();function kt(){
|
|
6
6
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
7
|
-
|
|
7
|
+
kt=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=Object.create((e&&e.prototype instanceof h?e:h).prototype),i=new L(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return k()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),o}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function h(){}function f(){}function v(){}var d={};c(d,o,(function(){return this}));var p=Object.getPrototypeOf,y=p&&p(p(P([])));y&&y!==e&&r.call(y,o)&&(d=y);var g=v.prototype=h.prototype=Object.create(d);function m(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function n(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function P(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:k}}function k(){return{value:void 0,done:!0}}return f.prototype=v,c(g,"constructor",v),c(v,"constructor",f),f.displayName=c(v,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(w.prototype),c(w.prototype,i,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(g),c(g,a,"Generator"),c(g,o,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=P,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function Ct(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function St(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){Ct(i,n,o,a,c,"next",t)}function c(t){Ct(i,n,o,a,c,"throw",t)}a(void 0)}))}}m([e.inject(e.CanvasConfig),w("design:type",Object)],Pt.prototype,"canvasConfig",void 0),Pt=m([e.singleton()],Pt);var Ot=(wt=function(){function t(){this.imagePool=void 0,this.renderingContext=void 0}return t.prototype.apply=function(t){var r=this,n=function(n){var o=n.target;if(o.nodeName===e.Shape.IMAGE){var i=o.attributes.img;e.isString(i)&&r.imagePool.getImageSync(i,(function(){o.renderable.dirty=!0,t.dirtify()}))}},o=function(n){var o=n.target,i=n.newValue;o.nodeName===e.Shape.IMAGE&&"img"===n.attrName&&e.isString(i)&&r.imagePool.getOrCreateImage(i).then((function(){o.renderable.dirty=!0,t.dirtify()}))};t.hooks.init.tapPromise(xt.tag,St(kt().mark((function t(){return kt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r.renderingContext.root.addEventListener(e.ElementEvent.MOUNTED,n),r.renderingContext.root.addEventListener(e.ElementEvent.ATTR_MODIFIED,o);case 2:case"end":return t.stop()}}),t)})))),t.hooks.destroy.tap(xt.tag,(function(){r.renderingContext.root.removeEventListener(e.ElementEvent.MOUNTED,n),r.renderingContext.root.removeEventListener(e.ElementEvent.ATTR_MODIFIED,o)}))},t}(),wt.tag="LoadImage",xt=wt);m([e.inject(Pt),w("design:type",Pt)],Ot.prototype,"imagePool",void 0),m([e.inject(e.RenderingContext),w("design:type",Object)],Ot.prototype,"renderingContext",void 0),Ot=xt=m([e.singleton({contrib:e.RenderingPluginContribution})],Ot);var Tt=e.Module((function(t){t(Pt),t(Ot)})),Nt=function(){function t(){this.name="image-loader"}var e=t.prototype;return e.init=function(t){t.load(Tt,!0)},e.destroy=function(t){t.unload(Tt)},t}(),jt=Object.freeze({__proto__:null,get ImagePool(){return Pt},Plugin:Nt});function Mt(){
|
|
8
8
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
9
|
-
jt=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=Object.create((e&&e.prototype instanceof h?e:h).prototype),i=new L(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return S()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),o}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function h(){}function f(){}function v(){}var d={};c(d,o,(function(){return this}));var p=Object.getPrototypeOf,y=p&&p(p(P([])));y&&y!==e&&r.call(y,o)&&(d=y);var g=v.prototype=h.prototype=Object.create(d);function m(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function n(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function P(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:S}}function S(){return{value:void 0,done:!0}}return f.prototype=v,c(g,"constructor",v),c(v,"constructor",f),f.displayName=c(v,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(w.prototype),c(w.prototype,i,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(g),c(g,a,"Generator"),c(g,o,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=P,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function Mt(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function At(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){Mt(i,n,o,a,c,"next",t)}function c(t){Mt(i,n,o,a,c,"throw",t)}a(void 0)}))}}function _t(){return _t=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},_t.apply(this,arguments)}function Rt(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Gt(t,e)}function Gt(t,e){return Gt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Gt(t,e)}var Ft="undefined"!=typeof Float32Array?Float32Array:Array;function It(t,e){var r=e[4],n=e[5],o=e[6],i=e[8],a=e[9],c=e[10];return t[0]=Math.hypot(e[0],e[1],e[2]),t[1]=Math.hypot(r,n,o),t[2]=Math.hypot(i,a,c),t}function Bt(){var t=new Ft(3);return Ft!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Dt(t,e,r){var n=new Ft(3);return n[0]=t,n[1]=e,n[2]=r,n}function Yt(t,e,r){var n=e[0],o=e[1],i=e[2],a=r[0],c=r[1],u=r[2];return t[0]=o*u-i*c,t[1]=i*a-n*u,t[2]=n*c-o*a,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var $t=function(t){return Math.hypot(t[0],t[1],t[2])};!function(){var t=Bt()}();!function(){var t,e=(t=new Ft(4),Ft!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();function Ht(){var t=new Ft(4);return Ft!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Wt(t,e,r,n){var o,i,a,c,u,s=e[0],l=e[1],h=e[2],f=e[3],v=r[0],d=r[1],p=r[2],y=r[3];return 0>(i=s*v+l*d+h*p+f*y)&&(i=-i,v=-v,d=-d,p=-p,y=-y),1-i>1e-6?(o=Math.acos(i),a=Math.sin(o),c=Math.sin((1-n)*o)/a,u=Math.sin(n*o)/a):(c=1-n,u=n),t[0]=c*s+u*v,t[1]=c*l+u*d,t[2]=c*h+u*p,t[3]=c*f+u*y,t}var Ut,Xt,qt,zt,Vt,Qt,Jt,Kt=function(t,e){var r=e[0],n=e[1],o=e[2],i=e[3],a=r*r+n*n+o*o+i*i;return a>0&&(a=1/Math.sqrt(a)),t[0]=r*a,t[1]=n*a,t[2]=o*a,t[3]=i*a,t},Zt=(Ut=Bt(),Xt=Dt(1,0,0),qt=Dt(0,1,0),zt=Ht(),Vt=Ht(),Qt=new Ft(9),Ft!=Float32Array&&(Qt[1]=0,Qt[2]=0,Qt[3]=0,Qt[5]=0,Qt[6]=0,Qt[7]=0),Qt[0]=1,Qt[4]=1,Qt[8]=1,Jt=Qt,e.Syringe.defineToken("StyleRendererFactory")),te=e.Syringe.defineToken("CircleRenderer",{multiple:!1}),ee=e.Syringe.defineToken("EllipseRenderer",{multiple:!1}),re=e.Syringe.defineToken("RectRenderer",{multiple:!1}),ne=e.Syringe.defineToken("LineRenderer",{multiple:!1}),oe=e.Syringe.defineToken("PolylineRenderer",{multiple:!1}),ie=e.Syringe.defineToken("PolygonRenderer",{multiple:!1}),ae=e.Syringe.defineToken("PathRenderer",{multiple:!1}),ce=e.Syringe.defineToken("TextRenderer",{multiple:!1}),ue=e.Syringe.defineToken("ImageRenderer",{multiple:!1}),se=function(){function t(){this.imagePool=void 0}return t.prototype.render=function(t,r){var n,o=r.img,i=r.width.value,a=r.height.value;if(e.isString(o)?n=this.imagePool.getImageSync(o):(i||(i=o.width),a||(a=o.height),n=o),n)try{t.drawImage(n,0,0,i,a)}catch(t){}},t}();g([e.inject(Lt),m("design:type",Lt)],se.prototype,"imagePool",void 0),se=g([e.singleton({token:ue})],se);var le=function(){function t(){}var r=t.prototype;return r.render=function(t,r,n){var o=r.lineWidth,i=r.textAlign,a=r.textBaseline,c=r.lineJoin,u=r.miterLimit,s=void 0===u?0:u,l=r.letterSpacing,h=void 0===l?0:l,f=r.stroke,v=r.fill,d=r.fillOpacity,p=r.strokeOpacity,y=r.opacity,g=r.metrics,m=r.dx,w=r.dy,x=g.lines,b=g.height,E=g.lineHeight,L=g.lineMetrics;t.font=g.font,t.lineWidth=o.value,t.textAlign=i.value,t.textBaseline=a.value,t.lineJoin=c.value,t.miterLimit=s;var P=0;"middle"===a.value?P=-b/2-E/2:"bottom"===a.value||"alphabetic"===a.value||"ideographic"===a.value?P=-b:"top"!==a.value&&"hanging"!==a.value||(P=-E);var S=0;m&&m.unit===e.UnitType.kPixels&&(S+=m.value),w&&w.unit===e.UnitType.kPixels&&(P+=w.value);for(var C=0;x.length>C;C++){var k=o.value/2+S;P+=E,!e.isNil(f)&&!f.isNone&&o&&o.value&&this.drawLetterSpacing(t,x[C],L[C],i.value,k,P,h,d.value,p.value,y.value,!0),e.isNil(v)||this.drawLetterSpacing(t,x[C],L[C],i.value,k,P,h,d.value,p.value,y.value)}},r.drawLetterSpacing=function(t,e,r,n,o,i,a,c,u,s,l){if(void 0===l&&(l=!1),0!==a){var h=t.textAlign;t.textAlign="left";var f=o;"center"===n?f=o-r.width/2:"right"!==n&&"end"!==n||(f=o-r.width);for(var v=Array.from(e),d=t.measureText(e).width,p=0,y=0;v.length>y;++y){var g=v[y];l?this.strokeText(t,g,f,i,u):this.fillText(t,g,f,i,c,s),f+=d-(p=t.measureText(e.substring(y+1)).width)+a,d=p}t.textAlign=h}else l?this.strokeText(t,e,o,i,u):this.fillText(t,e,o,i,c,s)},r.fillText=function(t,r,n,o,i,a){var c,u=!e.isNil(i)&&1!==i;u&&(c=t.globalAlpha,t.globalAlpha=i*a),t.fillText(r,n,o),u&&(t.globalAlpha=c)},r.strokeText=function(t,r,n,o,i){var a,c=!e.isNil(i)&&1!==i;c&&(a=t.globalAlpha,t.globalAlpha=i),t.strokeText(r,n,o),c&&(t.globalAlpha=a)},t}();le=g([e.singleton({token:ce})],le);var he=function(){function t(){this.imagePool=void 0}var r=t.prototype;return r.render=function(t,r,n,o){var i=r.fill,a=r.opacity,c=r.fillOpacity,u=r.stroke,s=r.strokeOpacity,l=r.lineWidth,h=r.lineCap,f=r.lineJoin,v=r.shadowColor,d=r.filter,p=r.miterLimit,y=!e.isNil(i)&&!i.isNone,g=!e.isNil(u)&&!u.isNone,m=0===i.alpha;if(y&&(e.isNil(c)||1===c.value?this.fill(t,n,i,o):(t.globalAlpha=c.value,this.fill(t,n,i,o),t.globalAlpha=a.value)),g&&l&&l.value>0){var w,x,b;!e.isNil(s)&&1!==s.value&&(t.globalAlpha=s.value),t.lineWidth=l.value,e.isNil(p)||(t.miterLimit=p),e.isNil(h)||(t.lineCap=h.value),e.isNil(f)||(t.lineJoin=f.value);var E=!e.isNil(v),L=!e.isNil(d);E&&(x=t.shadowColor,e.isNil(w=t.shadowBlur)||(t.shadowColor="transparent",t.shadowBlur=0)),L&&!e.isNil(b=t.filter)&&b.indexOf("drop-shadow")>-1&&(t.filter=b.replace(/drop-shadow\([^)]*\)/,"").trim()||"none");var P=y&&!m;P&&this.stroke(t,n,u,o),E&&(t.shadowColor=x,t.shadowBlur=w),L&&(t.filter=b),P||this.stroke(t,n,u,o)}},r.fill=function(t,r,n,o){var i=this;Array.isArray(n)?n.forEach((function(e){t.fillStyle=i.getColor(e,r,t),t.fill()})):(e.isPattern(n)&&(t.fillStyle=this.getPattern(n,r,t,o)),t.fill())},r.stroke=function(t,r,n,o){var i=this;Array.isArray(n)?n.forEach((function(e){t.strokeStyle=i.getColor(e,r,t),t.stroke()})):(e.isPattern(n)&&(t.strokeStyle=this.getPattern(n,r,t,o)),t.stroke())},r.getPattern=function(t,e,r,n){return this.imagePool.getOrCreatePatternSync(t,r,(function(){e.renderable.dirty=!0,n.dirtify()}))},r.getColor=function(t,r,n){var o;if(t.type===e.GradientType.LinearGradient||t.type===e.GradientType.RadialGradient){var i=r.getGeometryBounds();o=this.imagePool.getOrCreateGradient(_t({type:t.type},t.value,{width:i&&2*i.halfExtents[0]||1,height:i&&2*i.halfExtents[1]||1}),n)}return o},t}();g([e.inject(Lt),m("design:type",Lt)],he.prototype,"imagePool",void 0);var fe=function(t){function e(){return t.apply(this,arguments)||this}return Rt(e,t),e}(he=g([e.singleton()],he));fe=g([e.singleton({token:re})],fe);var ve=function(t){function e(){return t.apply(this,arguments)||this}return Rt(e,t),e}(he);ve=g([e.singleton({token:te})],ve);var de=function(t){function e(){return t.apply(this,arguments)||this}return Rt(e,t),e}(he);de=g([e.singleton({token:ee})],de);var pe=function(t){function e(){return t.apply(this,arguments)||this}return Rt(e,t),e}(he);pe=g([e.singleton({token:ne})],pe);var ye=function(t){function e(){return t.apply(this,arguments)||this}return Rt(e,t),e}(he);ye=g([e.singleton({token:oe})],ye);var ge=function(t){function e(){return t.apply(this,arguments)||this}return Rt(e,t),e}(he);ge=g([e.singleton({token:ie})],ge);var me,we,xe=function(t){function e(){return t.apply(this,arguments)||this}return Rt(e,t),e}(he);xe=g([e.singleton({token:ae})],xe);var be=(me=function(){function t(){this.canvasConfig=void 0,this.camera=void 0,this.contextService=void 0,this.renderingContext=void 0,this.pathGeneratorFactory=void 0,this.pathGeneratorFactoryCache={},this.styleRendererFactory=void 0,this.styleRendererFactoryCache={},this.displayObjectPool=void 0,this.rBush=void 0,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.tmpVec3=Bt(),this.tmpMat4=function(){var t=new Ft(16);return Ft!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}()}var r=t.prototype;return r.apply=function(t){var r=this,n=function(t){var e=t.target.rBushNode;e.aabb&&r.removedRBushNodeAABBs.push(e.aabb)},o=function(t){var e=t.target.rBushNode;e.aabb&&r.removedRBushNodeAABBs.push(e.aabb)};t.hooks.init.tapPromise(we.tag,At(jt().mark((function t(){var i,a,c,u;return jt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r.renderingContext.root.addEventListener(e.ElementEvent.UNMOUNTED,n),r.renderingContext.root.addEventListener(e.ElementEvent.CULLED,o),a=(i=r.canvasConfig).width,c=i.height,u=r.contextService.getContext(),r.clearRect(u,0,0,a,c);case 5:case"end":return t.stop()}}),t)})))),t.hooks.destroy.tap(we.tag,(function(){r.renderingContext.root.removeEventListener(e.ElementEvent.UNMOUNTED,n),r.renderingContext.root.removeEventListener(e.ElementEvent.CULLED,o)})),t.hooks.beginFrame.tap(we.tag,(function(){var t=r.contextService.getContext(),e=r.canvasConfig,n=e.width,o=e.height;r.clearFullScreen=r.shouldClearFullScreen(),t&&(t.save(),r.clearFullScreen&&r.clearRect(t,0,0,n,o),r.applyTransform(t,r.camera.getOrthoMatrix()))})),t.hooks.endFrame.tap(we.tag,(function(){var n=r.contextService.getContext();if(r.clearFullScreen);else{var o=r.safeMergeAABB.apply(r,[r.mergeDirtyAABBs(r.renderQueue)].concat(r.removedRBushNodeAABBs.map((function(t){var r=t.minX,n=t.minY,o=t.maxX,i=t.maxY,a=new e.AABB;return a.setMinMax(Dt(r,n,0),Dt(o,i,0)),a}))));if(r.removedRBushNodeAABBs=[],e.AABB.isEmpty(o))return void(r.renderQueue=[]);var i=r.convertAABB2Rect(o),a=i.x,c=i.y,u=i.width,s=i.height;r.clearRect(n,a,c,u,s),n.beginPath(),n.rect(a,c,u,s),n.clip(),r.searchDirtyObjects(o).sort((function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder})).forEach((function(e){e&&e.isVisible()&&!e.isCulled()&&r.renderDisplayObject(e,t)})),r.renderQueue.forEach((function(t){r.saveDirtyAABB(t)})),r.renderQueue=[]}r.restoreStack.forEach((function(t){n.restore()})),r.restoreStack=[],r.clearFullScreen=!1,n.restore()})),t.hooks.render.tap(we.tag,(function(e){r.clearFullScreen?e.isVisible()&&!e.isCulled()&&r.renderDisplayObject(e,t):r.renderQueue.push(e)}))},r.clearRect=function(t,e,r,n,o){t.clearRect(e,r,n,o);var i=this.canvasConfig.background;i&&(t.fillStyle=i,t.fillRect(e,r,n,o))},r.renderDisplayObject=function(t,r){for(var n=this.contextService.getContext(),o=this.restoreStack[this.restoreStack.length-1];o&&t.parentNode!==o;)n.restore(),this.restoreStack.pop(),o=this.restoreStack[this.restoreStack.length-1];var i=t.nodeName;void 0===this.styleRendererFactoryCache[i]&&(this.styleRendererFactoryCache[i]=this.styleRendererFactory(i));var a=this.styleRendererFactoryCache[i];n.save(),this.applyTransform(n,t.getLocalTransform());var c=t.style.clipPath;if(c){n.save(),this.applyTransform(n,c.getLocalTransform()),void 0===this.pathGeneratorFactoryCache[c.nodeName]&&(this.pathGeneratorFactoryCache[c.nodeName]=this.pathGeneratorFactory(c.nodeName));var u=this.pathGeneratorFactoryCache[c.nodeName];u&&(this.useAnchor(n,c),n.beginPath(),u(n,c.parsedStyle),n.closePath()),n.restore(),n.clip()}n.save(),this.applyAttributesToContext(n,t),this.useAnchor(n,t),void 0===this.pathGeneratorFactoryCache[t.nodeName]&&(this.pathGeneratorFactoryCache[t.nodeName]=this.pathGeneratorFactory(t.nodeName));var s=this.pathGeneratorFactoryCache[t.nodeName];s&&(n.beginPath(),s(n,t.parsedStyle),t.nodeName!==e.Shape.LINE&&t.nodeName!==e.Shape.PATH&&t.nodeName!==e.Shape.POLYLINE&&n.closePath()),a&&a.render(n,t.parsedStyle,t,r),n.restore(),t.renderable.dirty=!1,this.restoreStack.push(t)},r.shouldClearFullScreen=function(){return!this.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering||this.renderingContext.renderReasons.has(e.RenderReason.CAMERA_CHANGED)},r.convertAABB2Rect=function(t){var e=t.getMin(),r=t.getMax(),n=Math.floor(e[0]),o=Math.floor(e[1]);return{x:n,y:o,width:Math.ceil(r[0])-n,height:Math.ceil(r[1])-o}},r.mergeDirtyAABBs=function(t){var r=new e.AABB;return t.forEach((function(t){var e=t.getRenderBounds();r.add(e);var n=t.renderable.dirtyRenderBounds;n&&r.add(n)})),r},r.searchDirtyObjects=function(t){var e=this,r=t.getMin(),n=r[0],o=r[1],i=t.getMax();return this.rBush.search({minX:n,minY:o,maxX:i[0],maxY:i[1]}).map((function(t){return e.displayObjectPool.getByEntity(t.id)}))},r.saveDirtyAABB=function(t){var r=t.renderable;r.dirtyRenderBounds||(r.dirtyRenderBounds=new e.AABB);var n=t.getRenderBounds();n&&r.dirtyRenderBounds.update(n.center,n.halfExtents)},r.applyTransform=function(t,r){var n=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}(Bt(),r),o=n[0],i=n[1],a=It(Bt(),r),c=a[0],u=a[1],s=function(t,e){var r=new Ft(3);It(r,e);var n=1/r[0],o=1/r[1],i=1/r[2],a=e[0]*n,c=e[1]*o,u=e[2]*i,s=e[4]*n,l=e[5]*o,h=e[6]*i,f=e[8]*n,v=e[9]*o,d=e[10]*i,p=a+l+d,y=0;return p>0?(y=2*Math.sqrt(p+1),t[3]=.25*y,t[0]=(h-v)/y,t[1]=(f-u)/y,t[2]=(c-s)/y):a>l&&a>d?(y=2*Math.sqrt(1+a-l-d),t[3]=(h-v)/y,t[0]=.25*y,t[1]=(c+s)/y,t[2]=(f+u)/y):l>d?(y=2*Math.sqrt(1+l-a-d),t[3]=(f-u)/y,t[0]=(c+s)/y,t[1]=.25*y,t[2]=(h+v)/y):(y=2*Math.sqrt(1+d-a-l),t[3]=(c-s)/y,t[0]=(f+u)/y,t[1]=(h+v)/y,t[2]=.25*y),t}(Ht(),r),l=e.getEuler(Bt(),s),h=e.fromRotationTranslationScale(l[0]||l[2],o,i,c,u);t.transform(h[0],h[1],h[3],h[4],h[6],h[7])},r.applyAttributesToContext=function(t,r){var n=r.parsedStyle,o=n.stroke,i=n.fill,a=n.opacity,c=n.lineDash,u=n.lineDashOffset,s=n.filter,l=n.shadowColor,h=n.shadowBlur,f=n.shadowOffsetX,v=n.shadowOffsetY;c&&Array.isArray(c)&&t.setLineDash(c.map((function(t){return t.value}))),e.isNil(u)||(t.lineDashOffset=u.value),e.isNil(a)||(t.globalAlpha*=a.value),e.isNil(o)||Array.isArray(o)||o.isNone||(t.strokeStyle=r.attributes.stroke),e.isNil(i)||Array.isArray(i)||i.isNone||(t.fillStyle=r.attributes.fill),e.isNil(s)||(t.filter=r.style.filter),e.isNil(l)||(t.shadowColor=l.toString(),t.shadowBlur=h&&h.value||0,t.shadowOffsetX=f&&f.value||0,t.shadowOffsetY=v&&v.value||0)},r.useAnchor=function(t,r){var n=(r.parsedStyle||{}).anchor,o=r.getGeometryBounds(),i=0,a=0;r.nodeName!==e.Shape.POLYLINE&&r.nodeName!==e.Shape.POLYGON&&r.nodeName!==e.Shape.PATH||(i=r.parsedStyle.defX,a=r.parsedStyle.defY);var c=-((n&&n[0].value||0)*(o&&2*o.halfExtents[0]||0)+i),u=-((n&&n[1].value||0)*(o&&2*o.halfExtents[1]||0)+a);0===c&&0===u||t.translate(c,u)},r.safeMergeAABB=function(){for(var t=new e.AABB,r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];return n.forEach((function(e){t.add(e)})),t},t}(),me.tag="CanvasRenderer",we=me);g([e.inject(e.CanvasConfig),m("design:type",Object)],be.prototype,"canvasConfig",void 0),g([e.inject(e.DefaultCamera),m("design:type",e.Camera)],be.prototype,"camera",void 0),g([e.inject(e.ContextService),m("design:type",Object)],be.prototype,"contextService",void 0),g([e.inject(e.RenderingContext),m("design:type",Object)],be.prototype,"renderingContext",void 0),g([e.inject(i),m("design:type",Function)],be.prototype,"pathGeneratorFactory",void 0),g([e.inject(Zt),m("design:type",Function)],be.prototype,"styleRendererFactory",void 0),g([e.inject(e.DisplayObjectPool),m("design:type",e.DisplayObjectPool)],be.prototype,"displayObjectPool",void 0),g([e.inject(e.RBushRoot),m("design:type",e.RBush)],be.prototype,"rBush",void 0),be=we=g([e.singleton({contrib:e.RenderingPluginContribution})],be);var Ee,Le,Pe=e.Module((function(t){var r;t(ve),t(de),t(fe),t(se),t(le),t(pe),t(ye),t(ge),t(xe);var n=((r={})[e.Shape.CIRCLE]=te,r[e.Shape.ELLIPSE]=ee,r[e.Shape.RECT]=re,r[e.Shape.IMAGE]=ue,r[e.Shape.TEXT]=ce,r[e.Shape.LINE]=ne,r[e.Shape.POLYLINE]=oe,r[e.Shape.POLYGON]=ie,r[e.Shape.PATH]=ae,r);t({token:Zt,useFactory:function(t){return function(e){var r=n[e];return r&&t.container.isBound(r)?t.container.get(r):null}}}),t(be)})),Se=function(){function t(){this.name="canvas-renderer"}var e=t.prototype;return e.init=function(t){t.load(Pe,!0)},e.destroy=function(t){t.unload(Pe)},t}(),Ce=Object.freeze({__proto__:null,get CircleRenderer(){return ve},CircleRendererContribution:te,get EllipseRenderer(){return de},EllipseRendererContribution:ee,get ImageRenderer(){return se},ImageRendererContribution:ue,get LineRenderer(){return pe},LineRendererContribution:ne,get PathRenderer(){return xe},PathRendererContribution:ae,Plugin:Se,get PolygonRenderer(){return ge},PolygonRendererContribution:ie,get PolylineRenderer(){return ye},PolylineRendererContribution:oe,get RectRenderer(){return fe},RectRendererContribution:re,StyleRendererFactory:Zt,get TextRenderer(){return le},TextRendererContribution:ce});function ke(){
|
|
9
|
+
Mt=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=Object.create((e&&e.prototype instanceof h?e:h).prototype),i=new L(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return k()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),o}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function h(){}function f(){}function v(){}var d={};c(d,o,(function(){return this}));var p=Object.getPrototypeOf,y=p&&p(p(P([])));y&&y!==e&&r.call(y,o)&&(d=y);var g=v.prototype=h.prototype=Object.create(d);function m(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function n(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function P(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:k}}function k(){return{value:void 0,done:!0}}return f.prototype=v,c(g,"constructor",v),c(v,"constructor",f),f.displayName=c(v,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(w.prototype),c(w.prototype,i,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(g),c(g,a,"Generator"),c(g,o,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=P,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function At(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function _t(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){At(i,n,o,a,c,"next",t)}function c(t){At(i,n,o,a,c,"throw",t)}a(void 0)}))}}function Rt(){return Rt=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Rt.apply(this,arguments)}function Gt(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Ft(t,e)}function Ft(t,e){return Ft=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ft(t,e)}var It="undefined"!=typeof Float32Array?Float32Array:Array;function Bt(t,e){var r=e[4],n=e[5],o=e[6],i=e[8],a=e[9],c=e[10];return t[0]=Math.hypot(e[0],e[1],e[2]),t[1]=Math.hypot(r,n,o),t[2]=Math.hypot(i,a,c),t}function Dt(){var t=new It(3);return It!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Yt(t,e,r){var n=new It(3);return n[0]=t,n[1]=e,n[2]=r,n}function $t(t,e,r){var n=e[0],o=e[1],i=e[2],a=r[0],c=r[1],u=r[2];return t[0]=o*u-i*c,t[1]=i*a-n*u,t[2]=n*c-o*a,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var Ht=function(t){return Math.hypot(t[0],t[1],t[2])};!function(){var t=Dt()}();!function(){var t,e=(t=new It(4),It!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();function Wt(){var t=new It(4);return It!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Ut(t,e,r,n){var o,i,a,c,u,s=e[0],l=e[1],h=e[2],f=e[3],v=r[0],d=r[1],p=r[2],y=r[3];return 0>(i=s*v+l*d+h*p+f*y)&&(i=-i,v=-v,d=-d,p=-p,y=-y),1-i>1e-6?(o=Math.acos(i),a=Math.sin(o),c=Math.sin((1-n)*o)/a,u=Math.sin(n*o)/a):(c=1-n,u=n),t[0]=c*s+u*v,t[1]=c*l+u*d,t[2]=c*h+u*p,t[3]=c*f+u*y,t}var Xt,qt,zt,Vt,Qt,Jt,Kt,Zt=function(t,e){var r=e[0],n=e[1],o=e[2],i=e[3],a=r*r+n*n+o*o+i*i;return a>0&&(a=1/Math.sqrt(a)),t[0]=r*a,t[1]=n*a,t[2]=o*a,t[3]=i*a,t},te=(Xt=Dt(),qt=Yt(1,0,0),zt=Yt(0,1,0),Vt=Wt(),Qt=Wt(),Jt=new It(9),It!=Float32Array&&(Jt[1]=0,Jt[2]=0,Jt[3]=0,Jt[5]=0,Jt[6]=0,Jt[7]=0),Jt[0]=1,Jt[4]=1,Jt[8]=1,Kt=Jt,e.Syringe.defineToken("StyleRendererFactory")),ee=e.Syringe.defineToken("CircleRenderer",{multiple:!1}),re=e.Syringe.defineToken("EllipseRenderer",{multiple:!1}),ne=e.Syringe.defineToken("RectRenderer",{multiple:!1}),oe=e.Syringe.defineToken("LineRenderer",{multiple:!1}),ie=e.Syringe.defineToken("PolylineRenderer",{multiple:!1}),ae=e.Syringe.defineToken("PolygonRenderer",{multiple:!1}),ce=e.Syringe.defineToken("PathRenderer",{multiple:!1}),ue=e.Syringe.defineToken("TextRenderer",{multiple:!1}),se=e.Syringe.defineToken("ImageRenderer",{multiple:!1}),le=function(){function t(){this.imagePool=void 0}return t.prototype.render=function(t,r){var n,o=r.img,i=r.width.value,a=r.height.value;if(e.isString(o)?n=this.imagePool.getImageSync(o):(i||(i=o.width),a||(a=o.height),n=o),n)try{t.drawImage(n,0,0,i,a)}catch(t){}},t}();m([e.inject(Pt),w("design:type",Pt)],le.prototype,"imagePool",void 0),le=m([e.singleton({token:se})],le);var he=function(){function t(){}var r=t.prototype;return r.render=function(t,r,n){var o=r.lineWidth,i=r.textAlign,a=r.textBaseline,c=r.lineJoin,u=r.miterLimit,s=void 0===u?0:u,l=r.letterSpacing,h=void 0===l?0:l,f=r.stroke,v=r.fill,d=r.fillOpacity,p=r.strokeOpacity,y=r.opacity,g=r.metrics,m=r.dx,w=r.dy,x=g.lines,b=g.height,E=g.lineHeight,L=g.lineMetrics;t.font=g.font,t.lineWidth=o.value,t.textAlign=i.value,t.textBaseline=a.value,t.lineJoin=c.value,t.miterLimit=s;var P=0;"middle"===a.value?P=-b/2-E/2:"bottom"===a.value||"alphabetic"===a.value||"ideographic"===a.value?P=-b:"top"!==a.value&&"hanging"!==a.value||(P=-E);var k=0;m&&m.unit===e.UnitType.kPixels&&(k+=m.value),w&&w.unit===e.UnitType.kPixels&&(P+=w.value);for(var C=0;x.length>C;C++){var S=o.value/2+k;P+=E,!e.isNil(f)&&!f.isNone&&o&&o.value&&this.drawLetterSpacing(t,x[C],L[C],i.value,S,P,h,d.value,p.value,y.value,!0),e.isNil(v)||this.drawLetterSpacing(t,x[C],L[C],i.value,S,P,h,d.value,p.value,y.value)}},r.drawLetterSpacing=function(t,e,r,n,o,i,a,c,u,s,l){if(void 0===l&&(l=!1),0!==a){var h=t.textAlign;t.textAlign="left";var f=o;"center"===n?f=o-r.width/2:"right"!==n&&"end"!==n||(f=o-r.width);for(var v=Array.from(e),d=t.measureText(e).width,p=0,y=0;v.length>y;++y){var g=v[y];l?this.strokeText(t,g,f,i,u):this.fillText(t,g,f,i,c,s),f+=d-(p=t.measureText(e.substring(y+1)).width)+a,d=p}t.textAlign=h}else l?this.strokeText(t,e,o,i,u):this.fillText(t,e,o,i,c,s)},r.fillText=function(t,r,n,o,i,a){var c,u=!e.isNil(i)&&1!==i;u&&(c=t.globalAlpha,t.globalAlpha=i*a),t.fillText(r,n,o),u&&(t.globalAlpha=c)},r.strokeText=function(t,r,n,o,i){var a,c=!e.isNil(i)&&1!==i;c&&(a=t.globalAlpha,t.globalAlpha=i),t.strokeText(r,n,o),c&&(t.globalAlpha=a)},t}();he=m([e.singleton({token:ue})],he);var fe=function(){function t(){this.imagePool=void 0}var r=t.prototype;return r.render=function(t,r,n,o){var i=r.fill,a=r.opacity,c=r.fillOpacity,u=r.stroke,s=r.strokeOpacity,l=r.lineWidth,h=r.lineCap,f=r.lineJoin,v=r.shadowColor,d=r.filter,p=r.miterLimit,y=!e.isNil(i)&&!i.isNone,g=!e.isNil(u)&&!u.isNone,m=0===i.alpha;if(y&&(e.isNil(c)||1===c.value?this.fill(t,n,i,o):(t.globalAlpha=c.value,this.fill(t,n,i,o),t.globalAlpha=a.value)),g&&l&&l.value>0){var w,x,b;!e.isNil(s)&&1!==s.value&&(t.globalAlpha=s.value),t.lineWidth=l.value,e.isNil(p)||(t.miterLimit=p),e.isNil(h)||(t.lineCap=h.value),e.isNil(f)||(t.lineJoin=f.value);var E=!e.isNil(v),L=!e.isNil(d);E&&(x=t.shadowColor,e.isNil(w=t.shadowBlur)||(t.shadowColor="transparent",t.shadowBlur=0)),L&&!e.isNil(b=t.filter)&&b.indexOf("drop-shadow")>-1&&(t.filter=b.replace(/drop-shadow\([^)]*\)/,"").trim()||"none");var P=y&&!m;P&&this.stroke(t,n,u,o),E&&(t.shadowColor=x,t.shadowBlur=w),L&&(t.filter=b),P||this.stroke(t,n,u,o)}},r.fill=function(t,r,n,o){var i=this;Array.isArray(n)?n.forEach((function(e){t.fillStyle=i.getColor(e,r,t),t.fill()})):(e.isPattern(n)&&(t.fillStyle=this.getPattern(n,r,t,o)),t.fill())},r.stroke=function(t,r,n,o){var i=this;Array.isArray(n)?n.forEach((function(e){t.strokeStyle=i.getColor(e,r,t),t.stroke()})):(e.isPattern(n)&&(t.strokeStyle=this.getPattern(n,r,t,o)),t.stroke())},r.getPattern=function(t,e,r,n){return this.imagePool.getOrCreatePatternSync(t,r,(function(){e.renderable.dirty=!0,n.dirtify()}))},r.getColor=function(t,r,n){var o;if(t.type===e.GradientType.LinearGradient||t.type===e.GradientType.RadialGradient){var i=r.getGeometryBounds();o=this.imagePool.getOrCreateGradient(Rt({type:t.type},t.value,{width:i&&2*i.halfExtents[0]||1,height:i&&2*i.halfExtents[1]||1}),n)}return o},t}();m([e.inject(Pt),w("design:type",Pt)],fe.prototype,"imagePool",void 0);var ve=function(t){function e(){return t.apply(this,arguments)||this}return Gt(e,t),e}(fe=m([e.singleton()],fe));ve=m([e.singleton({token:ne})],ve);var de=function(t){function e(){return t.apply(this,arguments)||this}return Gt(e,t),e}(fe);de=m([e.singleton({token:ee})],de);var pe=function(t){function e(){return t.apply(this,arguments)||this}return Gt(e,t),e}(fe);pe=m([e.singleton({token:re})],pe);var ye=function(t){function e(){return t.apply(this,arguments)||this}return Gt(e,t),e}(fe);ye=m([e.singleton({token:oe})],ye);var ge=function(t){function e(){return t.apply(this,arguments)||this}return Gt(e,t),e}(fe);ge=m([e.singleton({token:ie})],ge);var me=function(t){function e(){return t.apply(this,arguments)||this}return Gt(e,t),e}(fe);me=m([e.singleton({token:ae})],me);var we,xe,be=function(t){function e(){return t.apply(this,arguments)||this}return Gt(e,t),e}(fe);be=m([e.singleton({token:ce})],be);var Ee=(we=function(){function t(){this.canvasConfig=void 0,this.camera=void 0,this.contextService=void 0,this.renderingContext=void 0,this.pathGeneratorFactory=void 0,this.pathGeneratorFactoryCache={},this.styleRendererFactory=void 0,this.styleRendererFactoryCache={},this.displayObjectPool=void 0,this.rBush=void 0,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.tmpVec3=Dt(),this.tmpMat4=function(){var t=new It(16);return It!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}()}var r=t.prototype;return r.apply=function(t){var r=this,n=function(t){var e=t.target.rBushNode;e.aabb&&r.removedRBushNodeAABBs.push(e.aabb)},o=function(t){var e=t.target.rBushNode;e.aabb&&r.removedRBushNodeAABBs.push(e.aabb)};t.hooks.init.tapPromise(xe.tag,_t(Mt().mark((function t(){var i,a,c,u;return Mt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r.renderingContext.root.addEventListener(e.ElementEvent.UNMOUNTED,n),r.renderingContext.root.addEventListener(e.ElementEvent.CULLED,o),a=(i=r.canvasConfig).width,c=i.height,u=r.contextService.getContext(),r.clearRect(u,0,0,a,c);case 5:case"end":return t.stop()}}),t)})))),t.hooks.destroy.tap(xe.tag,(function(){r.renderingContext.root.removeEventListener(e.ElementEvent.UNMOUNTED,n),r.renderingContext.root.removeEventListener(e.ElementEvent.CULLED,o)})),t.hooks.beginFrame.tap(xe.tag,(function(){var t=r.contextService.getContext(),e=r.canvasConfig,n=e.width,o=e.height;r.clearFullScreen=r.shouldClearFullScreen(),t&&(t.save(),r.clearFullScreen&&r.clearRect(t,0,0,n,o),r.applyTransform(t,r.camera.getOrthoMatrix()))})),t.hooks.endFrame.tap(xe.tag,(function(){var n=r.contextService.getContext();if(r.clearFullScreen);else{var o=r.safeMergeAABB.apply(r,[r.mergeDirtyAABBs(r.renderQueue)].concat(r.removedRBushNodeAABBs.map((function(t){var r=t.minX,n=t.minY,o=t.maxX,i=t.maxY,a=new e.AABB;return a.setMinMax(Yt(r,n,0),Yt(o,i,0)),a}))));if(r.removedRBushNodeAABBs=[],e.AABB.isEmpty(o))return void(r.renderQueue=[]);var i=r.convertAABB2Rect(o),a=i.x,c=i.y,u=i.width,s=i.height;r.clearRect(n,a,c,u,s),n.beginPath(),n.rect(a,c,u,s),n.clip(),r.searchDirtyObjects(o).sort((function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder})).forEach((function(e){e&&e.isVisible()&&!e.isCulled()&&r.renderDisplayObject(e,t)})),r.renderQueue.forEach((function(t){r.saveDirtyAABB(t)})),r.renderQueue=[]}r.restoreStack.forEach((function(t){n.restore()})),r.restoreStack=[],r.clearFullScreen=!1,n.restore()})),t.hooks.render.tap(xe.tag,(function(e){r.clearFullScreen?e.isVisible()&&!e.isCulled()&&r.renderDisplayObject(e,t):r.renderQueue.push(e)}))},r.clearRect=function(t,e,r,n,o){t.clearRect(e,r,n,o);var i=this.canvasConfig.background;i&&(t.fillStyle=i,t.fillRect(e,r,n,o))},r.renderDisplayObject=function(t,r){for(var n=this.contextService.getContext(),o=this.restoreStack[this.restoreStack.length-1];o&&t.parentNode!==o;)n.restore(),this.restoreStack.pop(),o=this.restoreStack[this.restoreStack.length-1];var i=t.nodeName;void 0===this.styleRendererFactoryCache[i]&&(this.styleRendererFactoryCache[i]=this.styleRendererFactory(i));var a=this.styleRendererFactoryCache[i];n.save(),this.applyTransform(n,t.getLocalTransform());var c=t.style.clipPath;if(c){n.save(),this.applyTransform(n,c.getLocalTransform()),void 0===this.pathGeneratorFactoryCache[c.nodeName]&&(this.pathGeneratorFactoryCache[c.nodeName]=this.pathGeneratorFactory(c.nodeName));var u=this.pathGeneratorFactoryCache[c.nodeName];u&&(this.useAnchor(n,c),n.beginPath(),u(n,c.parsedStyle),n.closePath()),n.restore(),n.clip()}n.save(),this.applyAttributesToContext(n,t),this.useAnchor(n,t),void 0===this.pathGeneratorFactoryCache[t.nodeName]&&(this.pathGeneratorFactoryCache[t.nodeName]=this.pathGeneratorFactory(t.nodeName));var s=this.pathGeneratorFactoryCache[t.nodeName];s&&(n.beginPath(),s(n,t.parsedStyle),t.nodeName!==e.Shape.LINE&&t.nodeName!==e.Shape.PATH&&t.nodeName!==e.Shape.POLYLINE&&n.closePath()),a&&a.render(n,t.parsedStyle,t,r),n.restore(),t.renderable.dirty=!1,this.restoreStack.push(t)},r.shouldClearFullScreen=function(){return!this.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering||this.renderingContext.renderReasons.has(e.RenderReason.CAMERA_CHANGED)},r.convertAABB2Rect=function(t){var e=t.getMin(),r=t.getMax(),n=Math.floor(e[0]),o=Math.floor(e[1]);return{x:n,y:o,width:Math.ceil(r[0])-n,height:Math.ceil(r[1])-o}},r.mergeDirtyAABBs=function(t){var r=new e.AABB;return t.forEach((function(t){var e=t.getRenderBounds();r.add(e);var n=t.renderable.dirtyRenderBounds;n&&r.add(n)})),r},r.searchDirtyObjects=function(t){var e=this,r=t.getMin(),n=r[0],o=r[1],i=t.getMax();return this.rBush.search({minX:n,minY:o,maxX:i[0],maxY:i[1]}).map((function(t){return e.displayObjectPool.getByEntity(t.id)}))},r.saveDirtyAABB=function(t){var r=t.renderable;r.dirtyRenderBounds||(r.dirtyRenderBounds=new e.AABB);var n=t.getRenderBounds();n&&r.dirtyRenderBounds.update(n.center,n.halfExtents)},r.applyTransform=function(t,r){var n=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}(Dt(),r),o=n[0],i=n[1],a=Bt(Dt(),r),c=a[0],u=a[1],s=function(t,e){var r=new It(3);Bt(r,e);var n=1/r[0],o=1/r[1],i=1/r[2],a=e[0]*n,c=e[1]*o,u=e[2]*i,s=e[4]*n,l=e[5]*o,h=e[6]*i,f=e[8]*n,v=e[9]*o,d=e[10]*i,p=a+l+d,y=0;return p>0?(y=2*Math.sqrt(p+1),t[3]=.25*y,t[0]=(h-v)/y,t[1]=(f-u)/y,t[2]=(c-s)/y):a>l&&a>d?(y=2*Math.sqrt(1+a-l-d),t[3]=(h-v)/y,t[0]=.25*y,t[1]=(c+s)/y,t[2]=(f+u)/y):l>d?(y=2*Math.sqrt(1+l-a-d),t[3]=(f-u)/y,t[0]=(c+s)/y,t[1]=.25*y,t[2]=(h+v)/y):(y=2*Math.sqrt(1+d-a-l),t[3]=(c-s)/y,t[0]=(f+u)/y,t[1]=(h+v)/y,t[2]=.25*y),t}(Wt(),r),l=e.getEuler(Dt(),s),h=e.fromRotationTranslationScale(l[0]||l[2],o,i,c,u);t.transform(h[0],h[1],h[3],h[4],h[6],h[7])},r.applyAttributesToContext=function(t,r){var n=r.parsedStyle,o=n.stroke,i=n.fill,a=n.opacity,c=n.lineDash,u=n.lineDashOffset,s=n.filter,l=n.shadowColor,h=n.shadowBlur,f=n.shadowOffsetX,v=n.shadowOffsetY;c&&Array.isArray(c)&&t.setLineDash(c.map((function(t){return t.value}))),e.isNil(u)||(t.lineDashOffset=u.value),e.isNil(a)||(t.globalAlpha*=a.value),e.isNil(o)||Array.isArray(o)||o.isNone||(t.strokeStyle=r.attributes.stroke),e.isNil(i)||Array.isArray(i)||i.isNone||(t.fillStyle=r.attributes.fill),e.isNil(s)||(t.filter=r.style.filter),e.isNil(l)||(t.shadowColor=l.toString(),t.shadowBlur=h&&h.value||0,t.shadowOffsetX=f&&f.value||0,t.shadowOffsetY=v&&v.value||0)},r.useAnchor=function(t,e){var r=(e.parsedStyle||{}).anchor,n=e.getGeometryBounds(),o=-(r&&r[0].value||0)*(n&&2*n.halfExtents[0]||0),i=-(r&&r[1].value||0)*(n&&2*n.halfExtents[1]||0);0===o&&0===i||t.translate(o,i)},r.safeMergeAABB=function(){for(var t=new e.AABB,r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];return n.forEach((function(e){t.add(e)})),t},t}(),we.tag="CanvasRenderer",xe=we);m([e.inject(e.CanvasConfig),w("design:type",Object)],Ee.prototype,"canvasConfig",void 0),m([e.inject(e.DefaultCamera),w("design:type",e.Camera)],Ee.prototype,"camera",void 0),m([e.inject(e.ContextService),w("design:type",Object)],Ee.prototype,"contextService",void 0),m([e.inject(e.RenderingContext),w("design:type",Object)],Ee.prototype,"renderingContext",void 0),m([e.inject(a),w("design:type",Function)],Ee.prototype,"pathGeneratorFactory",void 0),m([e.inject(te),w("design:type",Function)],Ee.prototype,"styleRendererFactory",void 0),m([e.inject(e.DisplayObjectPool),w("design:type",e.DisplayObjectPool)],Ee.prototype,"displayObjectPool",void 0),m([e.inject(e.RBushRoot),w("design:type",e.RBush)],Ee.prototype,"rBush",void 0),Ee=xe=m([e.singleton({contrib:e.RenderingPluginContribution})],Ee);var Le,Pe,ke=e.Module((function(t){var r;t(de),t(pe),t(ve),t(le),t(he),t(ye),t(ge),t(me),t(be);var n=((r={})[e.Shape.CIRCLE]=ee,r[e.Shape.ELLIPSE]=re,r[e.Shape.RECT]=ne,r[e.Shape.IMAGE]=se,r[e.Shape.TEXT]=ue,r[e.Shape.LINE]=oe,r[e.Shape.POLYLINE]=ie,r[e.Shape.POLYGON]=ae,r[e.Shape.PATH]=ce,r);t({token:te,useFactory:function(t){return function(e){var r=n[e];return r&&t.container.isBound(r)?t.container.get(r):null}}}),t(Ee)})),Ce=function(){function t(){this.name="canvas-renderer"}var e=t.prototype;return e.init=function(t){t.load(ke,!0)},e.destroy=function(t){t.unload(ke)},t}(),Se=Object.freeze({__proto__:null,get CircleRenderer(){return de},CircleRendererContribution:ee,get EllipseRenderer(){return pe},EllipseRendererContribution:re,get ImageRenderer(){return le},ImageRendererContribution:se,get LineRenderer(){return ye},LineRendererContribution:oe,get PathRenderer(){return be},PathRendererContribution:ce,Plugin:Ce,get PolygonRenderer(){return me},PolygonRendererContribution:ae,get PolylineRenderer(){return ge},PolylineRendererContribution:ie,get RectRenderer(){return ve},RectRendererContribution:ne,StyleRendererFactory:te,get TextRenderer(){return he},TextRendererContribution:ue});function Oe(){
|
|
10
10
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
11
|
-
|
|
11
|
+
Oe=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=Object.create((e&&e.prototype instanceof h?e:h).prototype),i=new L(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return k()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),o}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function h(){}function f(){}function v(){}var d={};c(d,o,(function(){return this}));var p=Object.getPrototypeOf,y=p&&p(p(P([])));y&&y!==e&&r.call(y,o)&&(d=y);var g=v.prototype=h.prototype=Object.create(d);function m(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function n(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function P(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:k}}function k(){return{value:void 0,done:!0}}return f.prototype=v,c(g,"constructor",v),c(v,"constructor",f),f.displayName=c(v,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(w.prototype),c(w.prototype,i,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(g),c(g,a,"Generator"),c(g,o,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=P,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function Te(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function Ne(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){Te(i,n,o,a,c,"next",t)}function c(t){Te(i,n,o,a,c,"throw",t)}a(void 0)}))}}var je=(Le=function(){function t(){this.contextService=void 0,this.renderingContext=void 0}return t.prototype.apply=function(t){var e=this,r=this.renderingContext.root.ownerDocument.defaultView,n=function(e){t.hooks.pointerMove.call(e)},o=function(e){t.hooks.pointerUp.call(e)},i=function(e){t.hooks.pointerDown.call(e)},a=function(e){t.hooks.pointerOver.call(e)},c=function(e){t.hooks.pointerOut.call(e)},u=function(e){t.hooks.pointerCancel.call(e)},s=function(e){t.hooks.pointerWheel.call(e)},l=function(t){globalThis.document.addEventListener("pointermove",n,!0),t.addEventListener("pointerdown",i,!0),t.addEventListener("pointerleave",c,!0),t.addEventListener("pointerover",a,!0),globalThis.addEventListener("pointerup",o,!0)},h=function(t){t.addEventListener("touchstart",i,!0),t.addEventListener("touchend",o,!0),t.addEventListener("touchmove",n,!0),t.addEventListener("touchcancel",u,!0)},f=function(t){globalThis.document.addEventListener("mousemove",n,!0),t.addEventListener("mousedown",i,!0),t.addEventListener("mouseout",c,!0),t.addEventListener("mouseover",a,!0),globalThis.addEventListener("mouseup",o,!0)};t.hooks.init.tapPromise(Pe.tag,Ne(Oe().mark((function t(){var n;return Oe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e.contextService.getDomElement(),globalThis.navigator.msPointerEnabled?(n.style.msContentZooming="none",n.style.msTouchAction="none"):r.supportsPointerEvents&&(n.style.touchAction="none"),r.supportsPointerEvents?l(n):f(n),r.supportsTouchEvents&&h(n),n.addEventListener("wheel",s,{passive:!0,capture:!0});case 5:case"end":return t.stop()}}),t)})))),t.hooks.destroy.tap(Pe.tag,(function(){var t=e.contextService.getDomElement();r.supportsPointerEvents?function(t){globalThis.document.removeEventListener("pointermove",n,!0),t.removeEventListener("pointerdown",i,!0),t.removeEventListener("pointerleave",c,!0),t.removeEventListener("pointerover",a,!0),globalThis.removeEventListener("pointerup",o,!0)}(t):function(t){globalThis.document.removeEventListener("mousemove",n,!0),t.removeEventListener("mousedown",i,!0),t.removeEventListener("mouseout",c,!0),t.removeEventListener("mouseover",a,!0),globalThis.removeEventListener("mouseup",o,!0)}(t),r.supportsTouchEvents&&function(t){t.removeEventListener("touchstart",i,!0),t.removeEventListener("touchend",o,!0),t.removeEventListener("touchmove",n,!0)}(t),t.removeEventListener("wheel",s,!0)}))},t}(),Le.tag="DOMInteraction",Pe=Le);m([e.inject(e.ContextService),w("design:type",Object)],je.prototype,"contextService",void 0),m([e.inject(e.RenderingContext),w("design:type",Object)],je.prototype,"renderingContext",void 0),je=Pe=m([e.singleton({contrib:e.RenderingPluginContribution})],je);var Me,Ae,_e=e.Module((function(t){t(je)})),Re=function(){function t(){this.name="dom-interaction"}var e=t.prototype;return e.init=function(t){t.load(_e,!0)},e.destroy=function(t){t.unload(_e)},t}(),Ge=Object.freeze({__proto__:null,Plugin:Re});function Fe(){
|
|
12
12
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
13
|
-
Ge=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=Object.create((e&&e.prototype instanceof h?e:h).prototype),i=new L(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return S()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),o}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function h(){}function f(){}function v(){}var d={};c(d,o,(function(){return this}));var p=Object.getPrototypeOf,y=p&&p(p(P([])));y&&y!==e&&r.call(y,o)&&(d=y);var g=v.prototype=h.prototype=Object.create(d);function m(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function n(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function P(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:S}}function S(){return{value:void 0,done:!0}}return f.prototype=v,c(g,"constructor",v),c(v,"constructor",f),f.displayName=c(v,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(w.prototype),c(w.prototype,i,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(g),c(g,a,"Generator"),c(g,o,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=P,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function Fe(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function Ie(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){Fe(i,n,o,a,c,"next",t)}function c(t){Fe(i,n,o,a,c,"throw",t)}a(void 0)}))}}var Be=(je=function(){function t(){this.contextService=void 0,this.renderingContext=void 0,this.canvasConfig=void 0,this.$camera=void 0}var r=t.prototype;return r.apply=function(t){var r=this,n=function(t){var n=t.target;if(n.nodeName===e.Shape.HTML){var o=r.getOrCreateEl(n),i=n.ownerDocument.documentElement.attributes;Object.keys(i).forEach((function(t){o.style[t]=i[t]})),Object.keys(n.attributes).forEach((function(t){r.updateAttribute(t,n)}))}},o=function(t){var n=t.target;if(n.nodeName===e.Shape.HTML){var o=r.getId(n),i=r.contextService.getDomElement().parentNode;if(i){var a=i.querySelector("#"+o);a&&i.removeChild(a)}}},i=function(t){var n=t.target;n.nodeName===e.Shape.HTML&&r.updateAttribute(t.attrName,n)};t.hooks.init.tapPromise(Me.tag,Ie(Ge().mark((function t(){return Ge().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r.renderingContext.root.addEventListener(e.ElementEvent.MOUNTED,n),r.renderingContext.root.addEventListener(e.ElementEvent.UNMOUNTED,o),r.renderingContext.root.addEventListener(e.ElementEvent.ATTR_MODIFIED,i);case 3:case"end":return t.stop()}}),t)})))),t.hooks.destroy.tap(Me.tag,(function(){r.renderingContext.root.removeEventListener(e.ElementEvent.MOUNTED,n),r.renderingContext.root.removeEventListener(e.ElementEvent.UNMOUNTED,o),r.renderingContext.root.removeEventListener(e.ElementEvent.ATTR_MODIFIED,i)}))},r.getId=function(t){return t.id||"g-html-"+t.entity},r.getOrCreateEl=function(t){var e=this.canvasConfig.document,r=this.getId(t),n=this.contextService.getDomElement().parentNode;if(n){var o=n.querySelector("#"+r);if(!o){o=(e||document).createElement("div"),t.parsedStyle.$el=o,o.id=r,t.name&&o.setAttribute("name",t.name),t.className&&(o.className=t.className),n.appendChild(o),o.style.position="absolute",o.style.left="0",o.style.top="0",o.style["will-change"]="transform";var i=t.getWorldTransform();o.style.transform="matrix("+[i[0],i[1],i[4],i[5],i[12],i[13]].join(",")+")"}return o}return null},r.updateAttribute=function(t,r){var n=this.getOrCreateEl(r);switch(t){case"innerHTML":var o=r.parsedStyle.innerHTML;e.isString(o)?n.innerHTML=o:(n.innerHTML="",n.appendChild(o));break;case"modelMatrix":case"transformOrigin":var i=r.parsedStyle.transformOrigin;n.style["transform-origin"]=i[0].value+" "+i[1].value;var a=r.getWorldTransform();n.style.transform="matrix("+[a[0],a[1],a[4],a[5],a[12],a[13]].join(",")+")";break;case"width":var c=r.computedStyleMap().get("width");n.style.width=c.toString();break;case"height":var u=r.computedStyleMap().get("height");n.style.height=u.toString();break;case"zIndex":n.style["z-index"]=""+r.parsedStyle.zIndex.value;break;case"visibility":n.style.visibility=r.parsedStyle.visibility.value;break;case"pointerEvents":n.style.pointerEvents=r.parsedStyle.pointerEvents.value;break;case"opacity":n.style.opacity=""+r.parsedStyle.opacity.value;break;case"fill":var s=r.parsedStyle.fill,l="";s instanceof e.CSSRGB?l=s.isNone?"transparent":r.getAttribute("fill"):Array.isArray(s)?l=r.getAttribute("fill"):e.isPattern(s),n.style.background=l;break;case"stroke":var h=r.parsedStyle.stroke,f="";h instanceof e.CSSRGB?f=h.isNone?"transparent":r.getAttribute("stroke"):Array.isArray(h)?f=r.getAttribute("stroke"):e.isPattern(h),n.style["border-color"]=f,n.style["border-style"]="solid";break;case"lineWidth":n.style["border-width"]=(r.parsedStyle.lineWidth.value||0)+"px";break;case"lineDash":n.style["border-style"]="dashed";break;case"filter":n.style.filter=r.parsedStyle.filter}},t}(),je.tag="HTMLRendering",Me=je);g([e.inject(e.ContextService),m("design:type",Object)],Be.prototype,"contextService",void 0),g([e.inject(e.RenderingContext),m("design:type",Object)],Be.prototype,"renderingContext",void 0),g([e.inject(e.CanvasConfig),m("design:type",Object)],Be.prototype,"canvasConfig",void 0),Be=Me=g([e.singleton({contrib:e.RenderingPluginContribution})],Be);var De=e.Module((function(t){t(Be)})),Ye=function(){function t(){this.name="html-renderer"}var e=t.prototype;return e.init=function(t){t.load(De,!0)},e.destroy=function(t){t.unload(De)},t}(),$e=Object.freeze({__proto__:null,Plugin:Ye}),He=function(){function t(){this.$container=void 0,this.$canvas=void 0,this.dpr=void 0,this.context=void 0,this.canvasConfig=void 0}var o=t.prototype;return o.init=function(){var t,o=(t=r().mark((function t(){var n,o,i,a,c,u;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=(n=this.canvasConfig).container,a=n.devicePixelRatio,(i=n.canvas)?(this.$canvas=i,o&&i.parentElement!==o&&o.appendChild(i),this.$container=i.parentElement,this.canvasConfig.container=this.$container):o&&(this.$container=e.isString(o)?document.getElementById(o):o,this.$container&&(c=document.createElement("canvas"),this.$container.appendChild(c),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=c)),this.context=this.$canvas.getContext("2d"),u=1>(u=a||e.isBrowser&&window.devicePixelRatio||1)?1:Math.ceil(u),this.dpr=u,this.resize(this.canvasConfig.width,this.canvasConfig.height);case 7:case"end":return t.stop()}}),t,this)})),function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function c(t){n(a,o,i,c,u,"next",t)}function u(t){n(a,o,i,c,u,"throw",t)}c(void 0)}))});return function(){return o.apply(this,arguments)}}(),o.getContext=function(){return this.context},o.getDomElement=function(){return this.$canvas},o.getDPR=function(){return this.dpr},o.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},o.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},o.resize=function(t,r){if(this.$canvas){this.$canvas.width=this.dpr*t,this.$canvas.height=this.dpr*r,e.setDOMSize(this.$canvas,t,r);var n=this.getDPR();this.context.scale(n,n)}},o.applyCursorStyle=function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)},t}();g([e.inject(e.CanvasConfig),m("design:type",Object)],He.prototype,"canvasConfig",void 0),He=g([e.singleton({token:e.ContextService})],He);var We=e.Module((function(t){t(He)})),Ue=function(){function t(){this.name="canvas-context-register"}var e=t.prototype;return e.init=function(t){t.load(We,!0)},e.destroy=function(t){t.unload(We)},t}(),Xe=function(t){var e,r;function n(e){var r;return(r=t.call(this,e)||this).registerPlugin(new Ue),r.registerPlugin(new Nt),r.registerPlugin(new p),r.registerPlugin(new Se),r.registerPlugin(new _e),r.registerPlugin(new bt),r.registerPlugin(new Ye),r}return r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,o(e,r),n}(e.AbstractRenderer);t.CanvasPathGenerator=y,t.CanvasPicker=Et,t.CanvasRenderer=Ce,t.DomInteraction=Re,t.HTMLRenderer=$e,t.ImageLoader=Tt,t.Renderer=Xe,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
13
|
+
Fe=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=Object.create((e&&e.prototype instanceof h?e:h).prototype),i=new L(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return k()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),o}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function h(){}function f(){}function v(){}var d={};c(d,o,(function(){return this}));var p=Object.getPrototypeOf,y=p&&p(p(P([])));y&&y!==e&&r.call(y,o)&&(d=y);var g=v.prototype=h.prototype=Object.create(d);function m(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function n(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function P(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:k}}function k(){return{value:void 0,done:!0}}return f.prototype=v,c(g,"constructor",v),c(v,"constructor",f),f.displayName=c(v,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,a,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},m(w.prototype),c(w.prototype,i,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(g),c(g,a,"Generator"),c(g,o,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=P,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:P(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function Ie(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function Be(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){Ie(i,n,o,a,c,"next",t)}function c(t){Ie(i,n,o,a,c,"throw",t)}a(void 0)}))}}var De=(Me=function(){function t(){this.contextService=void 0,this.renderingContext=void 0,this.canvasConfig=void 0,this.$camera=void 0}var r=t.prototype;return r.apply=function(t){var r=this,n=function(t){var n=t.target;if(n.nodeName===e.Shape.HTML){var o=r.getOrCreateEl(n),i=n.ownerDocument.documentElement.attributes;Object.keys(i).forEach((function(t){o.style[t]=i[t]})),Object.keys(n.attributes).forEach((function(t){r.updateAttribute(t,n)}))}},o=function(t){var n=t.target;if(n.nodeName===e.Shape.HTML){var o=r.getId(n),i=r.contextService.getDomElement().parentNode;if(i){var a=i.querySelector("#"+o);a&&i.removeChild(a)}}},i=function(t){var n=t.target;n.nodeName===e.Shape.HTML&&r.updateAttribute(t.attrName,n)};t.hooks.init.tapPromise(Ae.tag,Be(Fe().mark((function t(){return Fe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r.renderingContext.root.addEventListener(e.ElementEvent.MOUNTED,n),r.renderingContext.root.addEventListener(e.ElementEvent.UNMOUNTED,o),r.renderingContext.root.addEventListener(e.ElementEvent.ATTR_MODIFIED,i);case 3:case"end":return t.stop()}}),t)})))),t.hooks.destroy.tap(Ae.tag,(function(){r.renderingContext.root.removeEventListener(e.ElementEvent.MOUNTED,n),r.renderingContext.root.removeEventListener(e.ElementEvent.UNMOUNTED,o),r.renderingContext.root.removeEventListener(e.ElementEvent.ATTR_MODIFIED,i)}))},r.getId=function(t){return t.id||"g-html-"+t.entity},r.getOrCreateEl=function(t){var e=this.canvasConfig.document,r=this.getId(t),n=this.contextService.getDomElement().parentNode;if(n){var o=n.querySelector("#"+r);if(!o){o=(e||document).createElement("div"),t.parsedStyle.$el=o,o.id=r,t.name&&o.setAttribute("name",t.name),t.className&&(o.className=t.className),n.appendChild(o),o.style.position="absolute",o.style.left="0",o.style.top="0",o.style["will-change"]="transform";var i=t.getWorldTransform();o.style.transform="matrix("+[i[0],i[1],i[4],i[5],i[12],i[13]].join(",")+")"}return o}return null},r.updateAttribute=function(t,r){var n=this.getOrCreateEl(r);switch(t){case"innerHTML":var o=r.parsedStyle.innerHTML;e.isString(o)?n.innerHTML=o:(n.innerHTML="",n.appendChild(o));break;case"modelMatrix":case"transformOrigin":var i=r.parsedStyle.transformOrigin;n.style["transform-origin"]=i[0].value+" "+i[1].value;var a=r.getWorldTransform();n.style.transform="matrix("+[a[0],a[1],a[4],a[5],a[12],a[13]].join(",")+")";break;case"width":var c=r.computedStyleMap().get("width");n.style.width=c.toString();break;case"height":var u=r.computedStyleMap().get("height");n.style.height=u.toString();break;case"zIndex":n.style["z-index"]=""+r.parsedStyle.zIndex.value;break;case"visibility":n.style.visibility=r.parsedStyle.visibility.value;break;case"pointerEvents":n.style.pointerEvents=r.parsedStyle.pointerEvents.value;break;case"opacity":n.style.opacity=""+r.parsedStyle.opacity.value;break;case"fill":var s=r.parsedStyle.fill,l="";s instanceof e.CSSRGB?l=s.isNone?"transparent":r.getAttribute("fill"):Array.isArray(s)?l=r.getAttribute("fill"):e.isPattern(s),n.style.background=l;break;case"stroke":var h=r.parsedStyle.stroke,f="";h instanceof e.CSSRGB?f=h.isNone?"transparent":r.getAttribute("stroke"):Array.isArray(h)?f=r.getAttribute("stroke"):e.isPattern(h),n.style["border-color"]=f,n.style["border-style"]="solid";break;case"lineWidth":n.style["border-width"]=(r.parsedStyle.lineWidth.value||0)+"px";break;case"lineDash":n.style["border-style"]="dashed";break;case"filter":n.style.filter=r.parsedStyle.filter}},t}(),Me.tag="HTMLRendering",Ae=Me);m([e.inject(e.ContextService),w("design:type",Object)],De.prototype,"contextService",void 0),m([e.inject(e.RenderingContext),w("design:type",Object)],De.prototype,"renderingContext",void 0),m([e.inject(e.CanvasConfig),w("design:type",Object)],De.prototype,"canvasConfig",void 0),De=Ae=m([e.singleton({contrib:e.RenderingPluginContribution})],De);var Ye=e.Module((function(t){t(De)})),$e=function(){function t(){this.name="html-renderer"}var e=t.prototype;return e.init=function(t){t.load(Ye,!0)},e.destroy=function(t){t.unload(Ye)},t}(),He=Object.freeze({__proto__:null,Plugin:$e}),We=function(){function t(){this.$container=void 0,this.$canvas=void 0,this.dpr=void 0,this.context=void 0,this.canvasConfig=void 0}var n=t.prototype;return n.init=function(){var t=o(r().mark((function t(){var n,o,i,a,c,u;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=(n=this.canvasConfig).container,a=n.devicePixelRatio,(i=n.canvas)?(this.$canvas=i,o&&i.parentElement!==o&&o.appendChild(i),this.$container=i.parentElement,this.canvasConfig.container=this.$container):o&&(this.$container=e.isString(o)?document.getElementById(o):o,this.$container&&(c=document.createElement("canvas"),this.$container.appendChild(c),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=c)),this.context=this.$canvas.getContext("2d"),u=1>(u=a||e.isBrowser&&window.devicePixelRatio||1)?1:Math.ceil(u),this.dpr=u,this.resize(this.canvasConfig.width,this.canvasConfig.height);case 7:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),n.getContext=function(){return this.context},n.getDomElement=function(){return this.$canvas},n.getDPR=function(){return this.dpr},n.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},n.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},n.resize=function(t,r){if(this.$canvas){this.$canvas.width=this.dpr*t,this.$canvas.height=this.dpr*r,e.setDOMSize(this.$canvas,t,r);var n=this.getDPR();this.context.scale(n,n)}},n.applyCursorStyle=function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)},n.toDataURL=function(){var t=o(r().mark((function t(e){var n;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e={}),t.abrupt("return",this.context.canvas.toDataURL((n=e).type,n.encoderOptions));case 3:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),t}();m([e.inject(e.CanvasConfig),w("design:type",Object)],We.prototype,"canvasConfig",void 0),We=m([e.singleton({token:e.ContextService})],We);var Ue=e.Module((function(t){t(We)})),Xe=function(){function t(){this.name="canvas-context-register"}var e=t.prototype;return e.init=function(t){t.load(Ue,!0)},e.destroy=function(t){t.unload(Ue)},t}(),qe=function(t){var e,r;function n(e){var r;return(r=t.call(this,e)||this).registerPlugin(new Xe),r.registerPlugin(new Nt),r.registerPlugin(new y),r.registerPlugin(new Ce),r.registerPlugin(new Re),r.registerPlugin(new Et),r.registerPlugin(new $e),r}return r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,i(e,r),n}(e.AbstractRenderer);t.CanvasPathGenerator=g,t.CanvasPicker=Lt,t.CanvasRenderer=Se,t.DomInteraction=Ge,t.HTMLRenderer=He,t.ImageLoader=jt,t.Renderer=qe,Object.defineProperty(t,"__esModule",{value:!0})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/g-canvas",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "A renderer implemented by Canvas 2D API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antv",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"README.md"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@antv/g-plugin-canvas-path-generator": "^0.1.
|
|
34
|
-
"@antv/g-plugin-canvas-picker": "^1.2.
|
|
35
|
-
"@antv/g-plugin-canvas-renderer": "^1.2.
|
|
36
|
-
"@antv/g-plugin-dom-interaction": "^1.2.
|
|
37
|
-
"@antv/g-plugin-html-renderer": "^1.2.
|
|
38
|
-
"@antv/g-plugin-image-loader": "^0.1.
|
|
33
|
+
"@antv/g-plugin-canvas-path-generator": "^0.1.3",
|
|
34
|
+
"@antv/g-plugin-canvas-picker": "^1.2.3",
|
|
35
|
+
"@antv/g-plugin-canvas-renderer": "^1.2.3",
|
|
36
|
+
"@antv/g-plugin-dom-interaction": "^1.2.3",
|
|
37
|
+
"@antv/g-plugin-html-renderer": "^1.2.3",
|
|
38
|
+
"@antv/g-plugin-image-loader": "^0.1.3",
|
|
39
39
|
"tslib": "^2.3.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "e83fa4cd73c6c22a60988c072275d2a191067b87"
|
|
52
52
|
}
|