@visactor/vrender 0.14.2 → 0.15.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/cjs/animate/default-ticker.js +1 -1
  2. package/cjs/animate/default-ticker.js.map +1 -1
  3. package/cjs/core/contributions/env/base-contribution.d.ts +5 -1
  4. package/cjs/core/contributions/env/base-contribution.js +10 -1
  5. package/cjs/core/contributions/env/base-contribution.js.map +1 -1
  6. package/cjs/core/contributions/env/browser-contribution.d.ts +5 -2
  7. package/cjs/core/contributions/env/browser-contribution.js +47 -0
  8. package/cjs/core/contributions/env/browser-contribution.js.map +1 -1
  9. package/cjs/core/global.d.ts +5 -1
  10. package/cjs/core/global.js +9 -0
  11. package/cjs/core/global.js.map +1 -1
  12. package/cjs/core/stage.d.ts +4 -0
  13. package/cjs/core/stage.js +11 -2
  14. package/cjs/core/stage.js.map +1 -1
  15. package/cjs/graphic/builtin-symbol/arrow2-down.d.ts +12 -0
  16. package/cjs/graphic/builtin-symbol/arrow2-down.js +30 -0
  17. package/cjs/graphic/builtin-symbol/arrow2-down.js.map +1 -0
  18. package/cjs/graphic/builtin-symbol/arrow2-left.js +1 -1
  19. package/cjs/graphic/builtin-symbol/arrow2-left.js.map +1 -1
  20. package/cjs/graphic/builtin-symbol/arrow2-right.js +1 -1
  21. package/cjs/graphic/builtin-symbol/arrow2-right.js.map +1 -1
  22. package/cjs/graphic/builtin-symbol/arrow2-up.d.ts +12 -0
  23. package/cjs/graphic/builtin-symbol/arrow2-up.js +30 -0
  24. package/cjs/graphic/builtin-symbol/arrow2-up.js.map +1 -0
  25. package/cjs/graphic/builtin-symbol/close.d.ts +13 -0
  26. package/cjs/graphic/builtin-symbol/close.js +33 -0
  27. package/cjs/graphic/builtin-symbol/close.js.map +1 -0
  28. package/cjs/graphic/builtin-symbol/index.d.ts +1 -1
  29. package/cjs/graphic/builtin-symbol/index.js +2 -2
  30. package/cjs/graphic/builtin-symbol/index.js.map +1 -1
  31. package/cjs/graphic/builtin-symbol/line-h.d.ts +13 -0
  32. package/cjs/graphic/builtin-symbol/line-h.js +32 -0
  33. package/cjs/graphic/builtin-symbol/line-h.js.map +1 -0
  34. package/cjs/graphic/builtin-symbol/line-v.d.ts +13 -0
  35. package/cjs/graphic/builtin-symbol/line-v.js +32 -0
  36. package/cjs/graphic/builtin-symbol/line-v.js.map +1 -0
  37. package/cjs/graphic/builtin-symbol/utils.d.ts +13 -5
  38. package/cjs/graphic/builtin-symbol/utils.js +23 -9
  39. package/cjs/graphic/builtin-symbol/utils.js.map +1 -1
  40. package/cjs/graphic/config.js +2 -1
  41. package/cjs/graphic/config.js.map +1 -1
  42. package/cjs/graphic/constants.d.ts +22 -0
  43. package/cjs/graphic/constants.js +20 -2
  44. package/cjs/graphic/constants.js.map +1 -1
  45. package/cjs/graphic/symbol.d.ts +2 -1
  46. package/cjs/graphic/symbol.js +27 -4
  47. package/cjs/graphic/symbol.js.map +1 -1
  48. package/cjs/index.d.ts +2 -1
  49. package/cjs/index.js +2 -2
  50. package/cjs/index.js.map +1 -1
  51. package/cjs/interface/global.d.ts +13 -1
  52. package/cjs/interface/global.js.map +1 -1
  53. package/cjs/interface/graphic/symbol.d.ts +3 -2
  54. package/cjs/interface/graphic/symbol.js.map +1 -1
  55. package/cjs/interface/graphic.d.ts +14 -0
  56. package/cjs/interface/graphic.js.map +1 -1
  57. package/cjs/interface/render.d.ts +1 -0
  58. package/cjs/interface/render.js.map +1 -1
  59. package/cjs/interface/stage.d.ts +2 -0
  60. package/cjs/interface/stage.js.map +1 -1
  61. package/cjs/jsx/graphicType.d.ts +72 -0
  62. package/cjs/jsx/graphicType.js +120 -0
  63. package/cjs/jsx/graphicType.js.map +1 -0
  64. package/cjs/jsx/index.d.ts +2 -0
  65. package/cjs/jsx/index.js +21 -0
  66. package/cjs/jsx/index.js.map +1 -0
  67. package/cjs/jsx/jsx-classic.d.ts +5 -0
  68. package/cjs/jsx/jsx-classic.js +46 -0
  69. package/cjs/jsx/jsx-classic.js.map +1 -0
  70. package/cjs/picker/contributions/canvas-picker/symbol-picker.js +4 -2
  71. package/cjs/picker/contributions/canvas-picker/symbol-picker.js.map +1 -1
  72. package/cjs/picker/pick-interceptor.js +2 -3
  73. package/cjs/picker/pick-interceptor.js.map +1 -1
  74. package/cjs/plugins/builtin-plugin/html-attribute-plugin.d.ts +13 -0
  75. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +75 -0
  76. package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -0
  77. package/cjs/render/contributions/render/draw-contribution.d.ts +3 -1
  78. package/cjs/render/contributions/render/draw-contribution.js +3 -1
  79. package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
  80. package/cjs/render/contributions/render/symbol-render.js +12 -5
  81. package/cjs/render/contributions/render/symbol-render.js.map +1 -1
  82. package/cjs/render/render-service.js +3 -1
  83. package/cjs/render/render-service.js.map +1 -1
  84. package/dist/index.js +3186 -354
  85. package/dist/index.min.js +1 -1
  86. package/es/animate/default-ticker.js +1 -1
  87. package/es/animate/default-ticker.js.map +1 -1
  88. package/es/core/contributions/env/base-contribution.d.ts +5 -1
  89. package/es/core/contributions/env/base-contribution.js +11 -0
  90. package/es/core/contributions/env/base-contribution.js.map +1 -1
  91. package/es/core/contributions/env/browser-contribution.d.ts +5 -2
  92. package/es/core/contributions/env/browser-contribution.js +48 -1
  93. package/es/core/contributions/env/browser-contribution.js.map +1 -1
  94. package/es/core/global.d.ts +5 -1
  95. package/es/core/global.js +9 -0
  96. package/es/core/global.js.map +1 -1
  97. package/es/core/stage.d.ts +4 -0
  98. package/es/core/stage.js +12 -1
  99. package/es/core/stage.js.map +1 -1
  100. package/es/graphic/builtin-symbol/arrow2-down.d.ts +12 -0
  101. package/es/graphic/builtin-symbol/arrow2-down.js +24 -0
  102. package/es/graphic/builtin-symbol/arrow2-down.js.map +1 -0
  103. package/es/graphic/builtin-symbol/arrow2-left.js +1 -1
  104. package/es/graphic/builtin-symbol/arrow2-left.js.map +1 -1
  105. package/es/graphic/builtin-symbol/arrow2-right.js +1 -1
  106. package/es/graphic/builtin-symbol/arrow2-right.js.map +1 -1
  107. package/es/graphic/builtin-symbol/arrow2-up.d.ts +12 -0
  108. package/es/graphic/builtin-symbol/arrow2-up.js +24 -0
  109. package/es/graphic/builtin-symbol/arrow2-up.js.map +1 -0
  110. package/es/graphic/builtin-symbol/close.d.ts +13 -0
  111. package/es/graphic/builtin-symbol/close.js +27 -0
  112. package/es/graphic/builtin-symbol/close.js.map +1 -0
  113. package/es/graphic/builtin-symbol/index.d.ts +1 -1
  114. package/es/graphic/builtin-symbol/index.js +11 -1
  115. package/es/graphic/builtin-symbol/index.js.map +1 -1
  116. package/es/graphic/builtin-symbol/line-h.d.ts +13 -0
  117. package/es/graphic/builtin-symbol/line-h.js +26 -0
  118. package/es/graphic/builtin-symbol/line-h.js.map +1 -0
  119. package/es/graphic/builtin-symbol/line-v.d.ts +13 -0
  120. package/es/graphic/builtin-symbol/line-v.js +26 -0
  121. package/es/graphic/builtin-symbol/line-v.js.map +1 -0
  122. package/es/graphic/builtin-symbol/utils.d.ts +13 -5
  123. package/es/graphic/builtin-symbol/utils.js +25 -7
  124. package/es/graphic/builtin-symbol/utils.js.map +1 -1
  125. package/es/graphic/config.js +2 -1
  126. package/es/graphic/config.js.map +1 -1
  127. package/es/graphic/constants.d.ts +22 -0
  128. package/es/graphic/constants.js +26 -0
  129. package/es/graphic/constants.js.map +1 -1
  130. package/es/graphic/symbol.d.ts +2 -1
  131. package/es/graphic/symbol.js +28 -1
  132. package/es/graphic/symbol.js.map +1 -1
  133. package/es/index.d.ts +2 -1
  134. package/es/index.js +3 -1
  135. package/es/index.js.map +1 -1
  136. package/es/interface/global.d.ts +13 -1
  137. package/es/interface/global.js.map +1 -1
  138. package/es/interface/graphic/symbol.d.ts +3 -2
  139. package/es/interface/graphic/symbol.js.map +1 -1
  140. package/es/interface/graphic.d.ts +14 -0
  141. package/es/interface/graphic.js.map +1 -1
  142. package/es/interface/render.d.ts +1 -0
  143. package/es/interface/render.js.map +1 -1
  144. package/es/interface/stage.d.ts +2 -0
  145. package/es/interface/stage.js.map +1 -1
  146. package/es/jsx/graphicType.d.ts +72 -0
  147. package/es/jsx/graphicType.js +112 -0
  148. package/es/jsx/graphicType.js.map +1 -0
  149. package/es/jsx/index.d.ts +2 -0
  150. package/es/jsx/index.js +4 -0
  151. package/es/jsx/index.js.map +1 -0
  152. package/es/jsx/jsx-classic.d.ts +5 -0
  153. package/es/jsx/jsx-classic.js +40 -0
  154. package/es/jsx/jsx-classic.js.map +1 -0
  155. package/es/picker/contributions/canvas-picker/symbol-picker.js +6 -1
  156. package/es/picker/contributions/canvas-picker/symbol-picker.js.map +1 -1
  157. package/es/picker/pick-interceptor.js +2 -3
  158. package/es/picker/pick-interceptor.js.map +1 -1
  159. package/es/plugins/builtin-plugin/html-attribute-plugin.d.ts +13 -0
  160. package/es/plugins/builtin-plugin/html-attribute-plugin.js +71 -0
  161. package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -0
  162. package/es/render/contributions/render/draw-contribution.d.ts +3 -1
  163. package/es/render/contributions/render/draw-contribution.js +4 -0
  164. package/es/render/contributions/render/draw-contribution.js.map +1 -1
  165. package/es/render/contributions/render/symbol-render.js +12 -5
  166. package/es/render/contributions/render/symbol-render.js.map +1 -1
  167. package/es/render/render-service.js +3 -1
  168. package/es/render/render-service.js.map +1 -1
  169. package/es/tsconfig.tsbuildinfo +1 -1
  170. package/package.json +6 -5
package/dist/index.js CHANGED
@@ -10,6 +10,33 @@
10
10
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
11
11
  }
12
12
 
13
+ function _iterableToArrayLimit(arr, i) {
14
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
15
+ if (null != _i) {
16
+ var _s,
17
+ _e,
18
+ _x,
19
+ _r,
20
+ _arr = [],
21
+ _n = !0,
22
+ _d = !1;
23
+ try {
24
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
25
+ if (Object(_i) !== _i) return;
26
+ _n = !1;
27
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
28
+ } catch (err) {
29
+ _d = !0, _e = err;
30
+ } finally {
31
+ try {
32
+ if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
33
+ } finally {
34
+ if (_d) throw _e;
35
+ }
36
+ }
37
+ return _arr;
38
+ }
39
+ }
13
40
  function _typeof(obj) {
14
41
  "@babel/helpers - typeof";
15
42
 
@@ -41,6 +68,20 @@
41
68
  });
42
69
  return Constructor;
43
70
  }
71
+ function _defineProperty(obj, key, value) {
72
+ key = _toPropertyKey(key);
73
+ if (key in obj) {
74
+ Object.defineProperty(obj, key, {
75
+ value: value,
76
+ enumerable: true,
77
+ configurable: true,
78
+ writable: true
79
+ });
80
+ } else {
81
+ obj[key] = value;
82
+ }
83
+ return obj;
84
+ }
44
85
  function _inherits(subClass, superClass) {
45
86
  if (typeof superClass !== "function" && superClass !== null) {
46
87
  throw new TypeError("Super expression must either be null or a function");
@@ -109,6 +150,28 @@
109
150
  return _possibleConstructorReturn(this, result);
110
151
  };
111
152
  }
153
+ function _slicedToArray(arr, i) {
154
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
155
+ }
156
+ function _arrayWithHoles(arr) {
157
+ if (Array.isArray(arr)) return arr;
158
+ }
159
+ function _unsupportedIterableToArray(o, minLen) {
160
+ if (!o) return;
161
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
162
+ var n = Object.prototype.toString.call(o).slice(8, -1);
163
+ if (n === "Object" && o.constructor) n = o.constructor.name;
164
+ if (n === "Map" || n === "Set") return Array.from(o);
165
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
166
+ }
167
+ function _arrayLikeToArray(arr, len) {
168
+ if (len == null || len > arr.length) len = arr.length;
169
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
170
+ return arr2;
171
+ }
172
+ function _nonIterableRest() {
173
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
174
+ }
112
175
  function _toPrimitive(input, hint) {
113
176
  if (typeof input !== "object" || input === null) return input;
114
177
  var prim = input[Symbol.toPrimitive];
@@ -3649,7 +3712,7 @@
3649
3712
  return Array.isArray(object) && object.some(isPromise);
3650
3713
  }
3651
3714
 
3652
- var __awaiter$4 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
3715
+ var __awaiter$3 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
3653
3716
  function adopt(value) {
3654
3717
  return value instanceof P ? value : new P(function (resolve) {
3655
3718
  resolve(value);
@@ -3794,7 +3857,7 @@
3794
3857
  }
3795
3858
  };
3796
3859
  var _saveAsyncResultToSingletonScope = function _saveAsyncResultToSingletonScope(binding, asyncResult) {
3797
- return __awaiter$4(void 0, void 0, void 0, function () {
3860
+ return __awaiter$3(void 0, void 0, void 0, function () {
3798
3861
  var result, ex_1;
3799
3862
  return __generator$3(this, function (_a) {
3800
3863
  switch (_a.label) {
@@ -3882,7 +3945,7 @@
3882
3945
  };
3883
3946
  return __assign$1.apply(this, arguments);
3884
3947
  };
3885
- var __awaiter$3 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
3948
+ var __awaiter$2 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
3886
3949
  function adopt(value) {
3887
3950
  return value instanceof P ? value : new P(function (resolve) {
3888
3951
  resolve(value);
@@ -4055,7 +4118,7 @@
4055
4118
  return instance;
4056
4119
  }
4057
4120
  function createInstanceWithInjectionsAsync(args) {
4058
- return __awaiter$3(this, void 0, void 0, function () {
4121
+ return __awaiter$2(this, void 0, void 0, function () {
4059
4122
  var constructorInjections, propertyInjections;
4060
4123
  return __generator$2(this, function (_a) {
4061
4124
  switch (_a.label) {
@@ -4075,7 +4138,7 @@
4075
4138
  });
4076
4139
  }
4077
4140
  function possiblyWaitInjections(possiblePromiseinjections) {
4078
- return __awaiter$3(this, void 0, void 0, function () {
4141
+ return __awaiter$2(this, void 0, void 0, function () {
4079
4142
  var injections, _i, possiblePromiseinjections_1, injection;
4080
4143
  return __generator$2(this, function (_a) {
4081
4144
  injections = [];
@@ -4138,7 +4201,7 @@
4138
4201
  }
4139
4202
  }
4140
4203
 
4141
- var __awaiter$2 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
4204
+ var __awaiter$1 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
4142
4205
  function adopt(value) {
4143
4206
  return value instanceof P ? value : new P(function (resolve) {
4144
4207
  resolve(value);
@@ -4364,7 +4427,7 @@
4364
4427
  return result;
4365
4428
  };
4366
4429
  var _activateContainerAsync = function _activateContainerAsync(activationsIterator, context, resultPromise) {
4367
- return __awaiter$2(void 0, void 0, void 0, function () {
4430
+ return __awaiter$1(void 0, void 0, void 0, function () {
4368
4431
  var result, activation;
4369
4432
  return __generator$1(this, function (_a) {
4370
4433
  switch (_a.label) {
@@ -4978,7 +5041,7 @@
4978
5041
  };
4979
5042
  return __assign.apply(this, arguments);
4980
5043
  };
4981
- var __awaiter$1 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
5044
+ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
4982
5045
  function adopt(value) {
4983
5046
  return value instanceof P ? value : new P(function (resolve) {
4984
5047
  resolve(value);
@@ -5177,7 +5240,7 @@
5177
5240
  for (var _i = 0; _i < arguments.length; _i++) {
5178
5241
  modules[_i] = arguments[_i];
5179
5242
  }
5180
- return __awaiter$1(this, void 0, void 0, function () {
5243
+ return __awaiter(this, void 0, void 0, function () {
5181
5244
  var getHelpers, _a, modules_2, currentModule, containerModuleHelpers;
5182
5245
  return __generator(this, function (_b) {
5183
5246
  switch (_b.label) {
@@ -5219,7 +5282,7 @@
5219
5282
  for (var _i = 0; _i < arguments.length; _i++) {
5220
5283
  modules[_i] = arguments[_i];
5221
5284
  }
5222
- return __awaiter$1(this, void 0, void 0, function () {
5285
+ return __awaiter(this, void 0, void 0, function () {
5223
5286
  var _a, modules_3, module_1, deactivations;
5224
5287
  return __generator(this, function (_b) {
5225
5288
  switch (_b.label) {
@@ -5255,7 +5318,7 @@
5255
5318
  return this.bind(serviceIdentifier);
5256
5319
  };
5257
5320
  Container.prototype.rebindAsync = function (serviceIdentifier) {
5258
- return __awaiter$1(this, void 0, void 0, function () {
5321
+ return __awaiter(this, void 0, void 0, function () {
5259
5322
  return __generator(this, function (_a) {
5260
5323
  switch (_a.label) {
5261
5324
  case 0:
@@ -5275,7 +5338,7 @@
5275
5338
  this._removeServiceFromDictionary(serviceIdentifier);
5276
5339
  };
5277
5340
  Container.prototype.unbindAsync = function (serviceIdentifier) {
5278
- return __awaiter$1(this, void 0, void 0, function () {
5341
+ return __awaiter(this, void 0, void 0, function () {
5279
5342
  var bindings;
5280
5343
  return __generator(this, function (_a) {
5281
5344
  switch (_a.label) {
@@ -5301,7 +5364,7 @@
5301
5364
  this._bindingDictionary = new Lookup();
5302
5365
  };
5303
5366
  Container.prototype.unbindAllAsync = function () {
5304
- return __awaiter$1(this, void 0, void 0, function () {
5367
+ return __awaiter(this, void 0, void 0, function () {
5305
5368
  var promises;
5306
5369
  var _this = this;
5307
5370
  return __generator(this, function (_a) {
@@ -5390,7 +5453,7 @@
5390
5453
  return this._getButThrowIfAsync(getArgs);
5391
5454
  };
5392
5455
  Container.prototype.getAsync = function (serviceIdentifier) {
5393
- return __awaiter$1(this, void 0, void 0, function () {
5456
+ return __awaiter(this, void 0, void 0, function () {
5394
5457
  var getArgs;
5395
5458
  return __generator(this, function (_a) {
5396
5459
  getArgs = this._getNotAllArgs(serviceIdentifier, false);
@@ -5403,7 +5466,7 @@
5403
5466
  return this._getButThrowIfAsync(getArgs);
5404
5467
  };
5405
5468
  Container.prototype.getTaggedAsync = function (serviceIdentifier, key, value) {
5406
- return __awaiter$1(this, void 0, void 0, function () {
5469
+ return __awaiter(this, void 0, void 0, function () {
5407
5470
  var getArgs;
5408
5471
  return __generator(this, function (_a) {
5409
5472
  getArgs = this._getNotAllArgs(serviceIdentifier, false, key, value);
@@ -5487,7 +5550,7 @@
5487
5550
  }
5488
5551
  };
5489
5552
  Container.prototype._handleDeactivationError = function (asyncResult, constructor) {
5490
- return __awaiter$1(this, void 0, void 0, function () {
5553
+ return __awaiter(this, void 0, void 0, function () {
5491
5554
  var ex_1;
5492
5555
  return __generator(this, function (_a) {
5493
5556
  switch (_a.label) {
@@ -5520,7 +5583,7 @@
5520
5583
  }
5521
5584
  };
5522
5585
  Container.prototype._deactivateContainerAsync = function (instance, deactivationsIterator) {
5523
- return __awaiter$1(this, void 0, void 0, function () {
5586
+ return __awaiter(this, void 0, void 0, function () {
5524
5587
  var deactivation;
5525
5588
  return __generator(this, function (_a) {
5526
5589
  switch (_a.label) {
@@ -5673,7 +5736,7 @@
5673
5736
  }
5674
5737
  };
5675
5738
  Container.prototype._deactivateSingletonsAsync = function (bindings) {
5676
- return __awaiter$1(this, void 0, void 0, function () {
5739
+ return __awaiter(this, void 0, void 0, function () {
5677
5740
  var _this = this;
5678
5741
  return __generator(this, function (_a) {
5679
5742
  switch (_a.label) {
@@ -5696,7 +5759,7 @@
5696
5759
  }
5697
5760
  };
5698
5761
  Container.prototype._propagateContainerDeactivationThenBindingAndPreDestroyAsync = function (binding, instance, constructor) {
5699
- return __awaiter$1(this, void 0, void 0, function () {
5762
+ return __awaiter(this, void 0, void 0, function () {
5700
5763
  return __generator(this, function (_a) {
5701
5764
  switch (_a.label) {
5702
5765
  case 0:
@@ -5736,7 +5799,7 @@
5736
5799
  return this._preDestroy(constructor, instance);
5737
5800
  };
5738
5801
  Container.prototype._bindingDeactivationAndPreDestroyAsync = function (binding, instance, constructor) {
5739
- return __awaiter$1(this, void 0, void 0, function () {
5802
+ return __awaiter(this, void 0, void 0, function () {
5740
5803
  return __generator(this, function (_a) {
5741
5804
  switch (_a.label) {
5742
5805
  case 0:
@@ -5907,33 +5970,6 @@
5907
5970
  function __metadata(metadataKey, metadataValue) {
5908
5971
  if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
5909
5972
  }
5910
- function __awaiter(thisArg, _arguments, P, generator) {
5911
- function adopt(value) {
5912
- return value instanceof P ? value : new P(function (resolve) {
5913
- resolve(value);
5914
- });
5915
- }
5916
- return new (P || (P = Promise))(function (resolve, reject) {
5917
- function fulfilled(value) {
5918
- try {
5919
- step(generator.next(value));
5920
- } catch (e) {
5921
- reject(e);
5922
- }
5923
- }
5924
- function rejected(value) {
5925
- try {
5926
- step(generator["throw"](value));
5927
- } catch (e) {
5928
- reject(e);
5929
- }
5930
- }
5931
- function step(result) {
5932
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
5933
- }
5934
- step((generator = generator.apply(thisArg, _arguments || [])).next());
5935
- });
5936
- }
5937
5973
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
5938
5974
  var e = new Error(message);
5939
5975
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
@@ -6268,6 +6304,24 @@
6268
6304
  }
6269
6305
  return this._env === 'browser' && /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent);
6270
6306
  }
6307
+ getNativeAABBBounds(dom) {
6308
+ if (!this._env) {
6309
+ this.setEnv('browser');
6310
+ }
6311
+ return this.envContribution.getNativeAABBBounds(dom);
6312
+ }
6313
+ removeDom(dom) {
6314
+ if (!this._env) {
6315
+ this.setEnv('browser');
6316
+ }
6317
+ return this.envContribution.removeDom(dom);
6318
+ }
6319
+ createDom(params) {
6320
+ if (!this._env) {
6321
+ this.setEnv('browser');
6322
+ }
6323
+ return this.envContribution.createDom(params);
6324
+ }
6271
6325
  };
6272
6326
  exports.DefaultGlobal = __decorate([
6273
6327
  injectable(),
@@ -9233,7 +9287,11 @@
9233
9287
  strokeBoundsBuffer: 2,
9234
9288
  stroke: false
9235
9289
  };
9236
- const DefaultStrokeStyle = Object.assign({ outerBorder: Object.assign(Object.assign({}, commonStroke), { distance: 0 }), innerBorder: Object.assign(Object.assign({}, commonStroke), { distance: 0 }) }, commonStroke);
9290
+ const DefaultStrokeStyle = {
9291
+ outerBorder: { ...commonStroke, distance: 0 },
9292
+ innerBorder: { ...commonStroke, distance: 0 },
9293
+ ...commonStroke
9294
+ };
9237
9295
  const DefaultTextStyle = {
9238
9296
  text: '',
9239
9297
  maxLineWidth: Infinity,
@@ -9253,14 +9311,42 @@
9253
9311
  direction: 'horizontal',
9254
9312
  wordBreak: 'break-all'
9255
9313
  };
9256
- const DefaultStyle = Object.assign(Object.assign(Object.assign({ opacity: 1, background: null, texture: null, textureColor: 'black', textureSize: 10, texturePadding: 2, backgroundMode: 0, blur: 0, cursor: null }, DefaultFillStyle), DefaultStrokeStyle), DefaultLayout);
9314
+ const DefaultStyle = {
9315
+ opacity: 1,
9316
+ background: null,
9317
+ texture: null,
9318
+ textureColor: 'black',
9319
+ textureSize: 10,
9320
+ texturePadding: 2,
9321
+ backgroundMode: 0,
9322
+ blur: 0,
9323
+ cursor: null,
9324
+ html: null,
9325
+ ...DefaultFillStyle,
9326
+ ...DefaultStrokeStyle,
9327
+ ...DefaultLayout
9328
+ };
9257
9329
  const DefaultConnectAttribute = {
9258
9330
  connectedType: 'none',
9259
9331
  connectedStyle: {},
9260
9332
  connectedX: NaN,
9261
9333
  connectedY: NaN
9262
9334
  };
9263
- const DefaultAttribute = Object.assign(Object.assign({ strokeSeg: null, pickable: true, childrenPickable: true, visible: true, zIndex: 0, layout: null, boundsPadding: 0, pickMode: 'accurate', customPickShape: null, boundsMode: 'accurate', keepDirIn3d: true }, DefaultStyle), DefaultTransform);
9335
+ const DefaultAttribute = {
9336
+ strokeSeg: null,
9337
+ pickable: true,
9338
+ childrenPickable: true,
9339
+ visible: true,
9340
+ zIndex: 0,
9341
+ layout: null,
9342
+ boundsPadding: 0,
9343
+ pickMode: 'accurate',
9344
+ customPickShape: null,
9345
+ boundsMode: 'accurate',
9346
+ keepDirIn3d: true,
9347
+ ...DefaultStyle,
9348
+ ...DefaultTransform
9349
+ };
9264
9350
  function addAttributeToPrototype(obj, c, keys) {
9265
9351
  keys.forEach(key => {
9266
9352
  c.prototype[key] = obj[key];
@@ -9269,23 +9355,145 @@
9269
9355
  function rewriteProto(obj, c) {
9270
9356
  Object.setPrototypeOf(obj, c);
9271
9357
  }
9272
- const DefaultArcAttribute = Object.assign(Object.assign({}, DefaultAttribute), { startAngle: 0, endAngle: pi2, innerRadius: 0, outerRadius: 1, cornerRadius: 0, padRadius: 0, padAngle: 0, cap: false, forceShowCap: false });
9273
- const DefaultAreaAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultConnectAttribute), { points: [], segments: [], curveType: 'linear', clipRange: 1 });
9274
- const DefaultCircleAttribute = Object.assign(Object.assign({}, DefaultAttribute), { radius: 1, startAngle: 0, endAngle: pi2 });
9275
- const DefaultGroupAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, cornerRadius: 0, path: [], clip: false, visibleAll: true, display: 'relative', flexDirection: 'row', flexWrap: 'wrap', justifyContent: 'flex-start', alignItems: 'flex-start', alignContent: 'flex-start' });
9276
- const DefaultGlyphAttribute = Object.assign(Object.assign({}, DefaultAttribute), { path: '', width: 0, height: 0, cornerRadius: 0, clip: false });
9277
- const DefaultLineAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultConnectAttribute), { points: [], segments: [], curveType: 'linear', clipRange: 1, clipRangeByDimension: 'default' });
9278
- const DefaultPathAttribute = Object.assign(Object.assign({}, DefaultAttribute), { path: new CustomPath2D(), customPath: () => {
9358
+ const DefaultArcAttribute = {
9359
+ ...DefaultAttribute,
9360
+ startAngle: 0,
9361
+ endAngle: pi2,
9362
+ innerRadius: 0,
9363
+ outerRadius: 1,
9364
+ cornerRadius: 0,
9365
+ padRadius: 0,
9366
+ padAngle: 0,
9367
+ cap: false,
9368
+ forceShowCap: false
9369
+ };
9370
+ const DefaultAreaAttribute = {
9371
+ ...DefaultAttribute,
9372
+ ...DefaultConnectAttribute,
9373
+ points: [],
9374
+ segments: [],
9375
+ curveType: 'linear',
9376
+ clipRange: 1
9377
+ };
9378
+ const DefaultCircleAttribute = {
9379
+ ...DefaultAttribute,
9380
+ radius: 1,
9381
+ startAngle: 0,
9382
+ endAngle: pi2
9383
+ };
9384
+ const DefaultGroupAttribute = {
9385
+ ...DefaultAttribute,
9386
+ width: 0,
9387
+ height: 0,
9388
+ cornerRadius: 0,
9389
+ path: [],
9390
+ clip: false,
9391
+ visibleAll: true,
9392
+ display: 'relative',
9393
+ flexDirection: 'row',
9394
+ flexWrap: 'wrap',
9395
+ justifyContent: 'flex-start',
9396
+ alignItems: 'flex-start',
9397
+ alignContent: 'flex-start'
9398
+ };
9399
+ const DefaultGlyphAttribute = {
9400
+ ...DefaultAttribute,
9401
+ path: '',
9402
+ width: 0,
9403
+ height: 0,
9404
+ cornerRadius: 0,
9405
+ clip: false
9406
+ };
9407
+ const DefaultLineAttribute = {
9408
+ ...DefaultAttribute,
9409
+ ...DefaultConnectAttribute,
9410
+ points: [],
9411
+ segments: [],
9412
+ curveType: 'linear',
9413
+ clipRange: 1,
9414
+ clipRangeByDimension: 'default'
9415
+ };
9416
+ const DefaultPathAttribute = {
9417
+ ...DefaultAttribute,
9418
+ path: new CustomPath2D(),
9419
+ customPath: () => {
9279
9420
  console.warn('空函数');
9280
- } });
9281
- const DefaultPolygonAttribute = Object.assign(Object.assign({}, DefaultAttribute), { points: [], cornerRadius: 0 });
9282
- const DefaultRectAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, strokeBoundsBuffer: 0, cornerRadius: 0 });
9283
- const DefaultRect3dAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, cornerRadius: 0, length: 0 });
9284
- const DefaultSymbolAttribute = Object.assign(Object.assign({}, DefaultAttribute), { symbolType: 'circle', size: 10, keepDirIn3d: true });
9285
- const DefaultTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), { strokeBoundsBuffer: 0, keepDirIn3d: true });
9286
- const DefaultRichTextAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 300, height: 300, ellipsis: true, wordBreak: 'break-word', verticalDirection: 'top', textAlign: 'left', textBaseline: 'top', layoutDirection: 'horizontal', textConfig: [], maxHeight: undefined, maxWidth: undefined, singleLine: false });
9287
- const DefaultImageAttribute = Object.assign(Object.assign({ repeatX: 'no-repeat', repeatY: 'no-repeat', image: '', width: 0, height: 0 }, DefaultAttribute), { fill: true });
9288
- const DefaultRichTextIconAttribute = Object.assign(Object.assign({}, DefaultImageAttribute), { backgroundShowMode: 'never', backgroundWidth: 0, backgroundHeight: 0, textAlign: 'left', textBaseline: 'middle', direction: 'horizontal', margin: 0, id: '', width: 20, height: 20, backgroundFill: 'rgba(101, 117, 168, 0.1)', backgroundFillOpacity: 1, backgroundStroke: false, backgroundStrokeOpacity: 1, backgroundRadius: 4, opacity: 1 });
9421
+ }
9422
+ };
9423
+ const DefaultPolygonAttribute = {
9424
+ ...DefaultAttribute,
9425
+ points: [],
9426
+ cornerRadius: 0
9427
+ };
9428
+ const DefaultRectAttribute = {
9429
+ ...DefaultAttribute,
9430
+ width: 0,
9431
+ height: 0,
9432
+ strokeBoundsBuffer: 0,
9433
+ cornerRadius: 0
9434
+ };
9435
+ const DefaultRect3dAttribute = {
9436
+ ...DefaultAttribute,
9437
+ width: 0,
9438
+ height: 0,
9439
+ cornerRadius: 0,
9440
+ length: 0
9441
+ };
9442
+ const DefaultSymbolAttribute = {
9443
+ ...DefaultAttribute,
9444
+ symbolType: 'circle',
9445
+ size: 10,
9446
+ keepDirIn3d: true
9447
+ };
9448
+ const DefaultTextAttribute = {
9449
+ ...DefaultAttribute,
9450
+ ...DefaultTextStyle,
9451
+ strokeBoundsBuffer: 0,
9452
+ keepDirIn3d: true
9453
+ };
9454
+ const DefaultRichTextAttribute = {
9455
+ ...DefaultAttribute,
9456
+ width: 300,
9457
+ height: 300,
9458
+ ellipsis: true,
9459
+ wordBreak: 'break-word',
9460
+ verticalDirection: 'top',
9461
+ textAlign: 'left',
9462
+ textBaseline: 'top',
9463
+ layoutDirection: 'horizontal',
9464
+ textConfig: [],
9465
+ maxHeight: undefined,
9466
+ maxWidth: undefined,
9467
+ singleLine: false
9468
+ };
9469
+ const DefaultImageAttribute = {
9470
+ repeatX: 'no-repeat',
9471
+ repeatY: 'no-repeat',
9472
+ image: '',
9473
+ width: 0,
9474
+ height: 0,
9475
+ ...DefaultAttribute,
9476
+ fill: true
9477
+ };
9478
+ const DefaultRichTextIconAttribute = {
9479
+ ...DefaultImageAttribute,
9480
+ backgroundShowMode: 'never',
9481
+ backgroundWidth: 0,
9482
+ backgroundHeight: 0,
9483
+ textAlign: 'left',
9484
+ textBaseline: 'middle',
9485
+ direction: 'horizontal',
9486
+ margin: 0,
9487
+ id: '',
9488
+ width: 20,
9489
+ height: 20,
9490
+ backgroundFill: 'rgba(101, 117, 168, 0.1)',
9491
+ backgroundFillOpacity: 1,
9492
+ backgroundStroke: false,
9493
+ backgroundStrokeOpacity: 1,
9494
+ backgroundRadius: 4,
9495
+ opacity: 1
9496
+ };
9289
9497
 
9290
9498
  class Application {
9291
9499
  }
@@ -9535,7 +9743,7 @@
9535
9743
  clipedData.width = this.measureTextWidth(clipedData.str, options);
9536
9744
  }
9537
9745
  }
9538
- out.push(Object.assign(Object.assign({}, verticalList[i]), { text: clipedData.str, width: clipedData.width }));
9746
+ out.push({ ...verticalList[i], text: clipedData.str, width: clipedData.width });
9539
9747
  length += clipedData.width;
9540
9748
  }
9541
9749
  return {
@@ -10420,10 +10628,16 @@
10420
10628
  }
10421
10629
  createTextMeasureInstance(textSpec, option, getCanvasForMeasure) {
10422
10630
  this.configure(this.global, this.global.env);
10423
- return new TextMeasure(Object.assign({ defaultFontParams: {
10631
+ return new TextMeasure({
10632
+ defaultFontParams: {
10424
10633
  fontFamily: DefaultTextStyle.fontFamily,
10425
10634
  fontSize: DefaultTextStyle.fontSize
10426
- }, getCanvasForMeasure: getCanvasForMeasure || (() => this.canvas), getTextBounds: undefined, specialCharSet: '-/: .,@%\'"~' + TextMeasure.ALPHABET_CHAR_SET + TextMeasure.ALPHABET_CHAR_SET.toUpperCase() }, (option !== null && option !== void 0 ? option : {})), textSpec);
10635
+ },
10636
+ getCanvasForMeasure: getCanvasForMeasure || (() => this.canvas),
10637
+ getTextBounds: undefined,
10638
+ specialCharSet: '-/: .,@%\'"~' + TextMeasure.ALPHABET_CHAR_SET + TextMeasure.ALPHABET_CHAR_SET.toUpperCase(),
10639
+ ...(option !== null && option !== void 0 ? option : {})
10640
+ }, textSpec);
10427
10641
  }
10428
10642
  };
10429
10643
  exports.DefaultGraphicUtil = __decorate([
@@ -10800,37 +11014,35 @@
10800
11014
  }
10801
11015
  }
10802
11016
  }
10803
- forEachChildrenAsync(cb, reverse = false) {
10804
- return __awaiter(this, void 0, void 0, function* () {
10805
- if (reverse) {
10806
- let child = this._lastChild;
10807
- let i = 0;
10808
- while (child) {
10809
- let breakTag = cb(child, i++);
10810
- if (breakTag.then) {
10811
- breakTag = yield breakTag;
10812
- }
10813
- if (breakTag) {
10814
- return;
10815
- }
10816
- child = child._prev;
11017
+ async forEachChildrenAsync(cb, reverse = false) {
11018
+ if (reverse) {
11019
+ let child = this._lastChild;
11020
+ let i = 0;
11021
+ while (child) {
11022
+ let breakTag = cb(child, i++);
11023
+ if (breakTag.then) {
11024
+ breakTag = await breakTag;
10817
11025
  }
11026
+ if (breakTag) {
11027
+ return;
11028
+ }
11029
+ child = child._prev;
10818
11030
  }
10819
- else {
10820
- let child = this._firstChild;
10821
- let i = 0;
10822
- while (child) {
10823
- let breakTag = cb(child, i++);
10824
- if (breakTag.then) {
10825
- breakTag = yield breakTag;
10826
- }
10827
- if (breakTag) {
10828
- return;
10829
- }
10830
- child = child._next;
11031
+ }
11032
+ else {
11033
+ let child = this._firstChild;
11034
+ let i = 0;
11035
+ while (child) {
11036
+ let breakTag = cb(child, i++);
11037
+ if (breakTag.then) {
11038
+ breakTag = await breakTag;
10831
11039
  }
11040
+ if (breakTag) {
11041
+ return;
11042
+ }
11043
+ child = child._next;
10832
11044
  }
10833
- });
11045
+ }
10834
11046
  }
10835
11047
  forEach(cb) {
10836
11048
  return this.forEachChildren(cb);
@@ -14521,7 +14733,16 @@
14521
14733
  var _a;
14522
14734
  const root = this.target.attachShadow();
14523
14735
  const height = this.target.AABBBounds.height();
14524
- const rect = application.graphicService.creator.rect(Object.assign(Object.assign({ height: height, fill: '#bcdeff', shadowBlur: 30, shadowColor: '#bcdeff' }, (_a = this.params) === null || _a === void 0 ? void 0 : _a.attribute), { x: 0, y: 0, width: 0 }));
14736
+ const rect = application.graphicService.creator.rect({
14737
+ height: height,
14738
+ fill: '#bcdeff',
14739
+ shadowBlur: 30,
14740
+ shadowColor: '#bcdeff',
14741
+ ...(_a = this.params) === null || _a === void 0 ? void 0 : _a.attribute,
14742
+ x: 0,
14743
+ y: 0,
14744
+ width: 0
14745
+ });
14525
14746
  this.rect = rect;
14526
14747
  root.add(rect);
14527
14748
  }
@@ -16284,7 +16505,10 @@
16284
16505
  if (fromGradient !== toGradient) {
16285
16506
  const gradient = (fromGradient ? from : to);
16286
16507
  const pure = (fromGradient ? to : from);
16287
- const gradientFromPure = Object.assign(Object.assign({}, gradient), { stops: gradient.stops.map(v => (Object.assign(Object.assign({}, v), { color: colorArrayToString(pure) }))) });
16508
+ const gradientFromPure = {
16509
+ ...gradient,
16510
+ stops: gradient.stops.map(v => ({ ...v, color: colorArrayToString(pure) }))
16511
+ };
16288
16512
  return fromGradient
16289
16513
  ? interpolateColor(gradient, gradientFromPure, ratio, alphaChannel, cb)
16290
16514
  : interpolateColor(gradientFromPure, gradient, ratio, alphaChannel, cb);
@@ -17870,33 +18094,31 @@
17870
18094
  function incrementalAddTo(group, graphic) {
17871
18095
  group.incrementalAppendChild(graphic);
17872
18096
  }
17873
- function waitForAllSubLayers(stage) {
17874
- return __awaiter(this, void 0, void 0, function* () {
17875
- const promiseList = [];
17876
- const layers = stage.getChildren();
17877
- yield new Promise(resolve => {
17878
- application.global.getRequestAnimationFrame()(() => {
17879
- resolve(null);
17880
- });
18097
+ async function waitForAllSubLayers(stage) {
18098
+ const promiseList = [];
18099
+ const layers = stage.getChildren();
18100
+ await new Promise(resolve => {
18101
+ application.global.getRequestAnimationFrame()(() => {
18102
+ resolve(null);
17881
18103
  });
17882
- layers.forEach(l => {
17883
- if (l.subLayers.size) {
17884
- l.subLayers.forEach(sl => {
17885
- if (sl.drawContribution && sl.drawContribution.hooks && sl.drawContribution.rendering) {
17886
- promiseList.push(new Promise(resolve => {
17887
- sl.drawContribution.hooks.completeDraw.tap('outWait', () => {
17888
- sl.drawContribution.hooks.completeDraw.taps = sl.drawContribution.hooks.completeDraw.taps.filter(i => {
17889
- return i.name !== 'outWait';
17890
- });
17891
- resolve(null);
18104
+ });
18105
+ layers.forEach(l => {
18106
+ if (l.subLayers.size) {
18107
+ l.subLayers.forEach(sl => {
18108
+ if (sl.drawContribution && sl.drawContribution.hooks && sl.drawContribution.rendering) {
18109
+ promiseList.push(new Promise(resolve => {
18110
+ sl.drawContribution.hooks.completeDraw.tap('outWait', () => {
18111
+ sl.drawContribution.hooks.completeDraw.taps = sl.drawContribution.hooks.completeDraw.taps.filter(i => {
18112
+ return i.name !== 'outWait';
17892
18113
  });
17893
- }));
17894
- }
17895
- });
17896
- }
17897
- });
17898
- yield Promise.all(promiseList);
18114
+ resolve(null);
18115
+ });
18116
+ }));
18117
+ }
18118
+ });
18119
+ }
17899
18120
  });
18121
+ await Promise.all(promiseList);
17900
18122
  }
17901
18123
  function boundStroke(bounds, halfW, miter, pad = 0) {
17902
18124
  bounds.expand(halfW + (pad / 2 + (miter ? miterAdjustment(miter, halfW) : 0)));
@@ -17990,6 +18212,28 @@
17990
18212
  const TEXT_NUMBER_TYPE = genNumberType();
17991
18213
  const GraphicService = Symbol.for('GraphicService');
17992
18214
  const GraphicCreator = Symbol.for('GraphicCreator');
18215
+ const SVG_ATTRIBUTE_MAP = {
18216
+ 'stroke-linecap': 'lineCap',
18217
+ 'stroke-linejoin': 'lineJoin',
18218
+ 'stroke-dasharray': 'lineDash',
18219
+ 'stroke-dashoffset': 'lineDashOffset',
18220
+ 'stroke-width': 'lineWidth',
18221
+ 'fill-opacity': 'fillOpacity',
18222
+ 'stroke-opacity': 'strokeOpacity'
18223
+ };
18224
+ const SVG_ATTRIBUTE_MAP_KEYS = Object.keys(SVG_ATTRIBUTE_MAP);
18225
+ const SVG_PARSE_ATTRIBUTE_MAP = {
18226
+ '@_stroke-linecap': 'lineCap',
18227
+ '@_stroke-linejoin': 'lineJoin',
18228
+ '@_stroke-dasharray': 'lineDash',
18229
+ '@_stroke-dashoffset': 'lineDashOffset',
18230
+ '@_stroke-width': 'lineWidth',
18231
+ '@_fill-opacity': 'fillOpacity',
18232
+ '@_stroke-opacity': 'strokeOpacity',
18233
+ '@_stroke': 'stroke',
18234
+ '@_fill': 'fill'
18235
+ };
18236
+ const SVG_PARSE_ATTRIBUTE_MAP_KEYS = Object.keys(SVG_PARSE_ATTRIBUTE_MAP);
17993
18237
 
17994
18238
  exports.GroupUpdateAABBBoundsMode = void 0;
17995
18239
  (function (GroupUpdateAABBBoundsMode) {
@@ -18240,7 +18484,7 @@
18240
18484
  return graphic;
18241
18485
  }
18242
18486
  clone() {
18243
- return new Group(Object.assign({}, this.attribute));
18487
+ return new Group({ ...this.attribute });
18244
18488
  }
18245
18489
  }
18246
18490
 
@@ -18370,7 +18614,17 @@
18370
18614
  combineTo(target, params) {
18371
18615
  var _a;
18372
18616
  if (this.offscreen) {
18373
- this.layerHandler.drawTo(target, [this], Object.assign({ background: (_a = params.background) !== null && _a !== void 0 ? _a : this.background, renderService: params.renderService, x: this.stage.x, y: this.stage.y, width: this.viewWidth, height: this.viewHeight, stage: this.stage, layer: this }, params));
18617
+ this.layerHandler.drawTo(target, [this], {
18618
+ background: (_a = params.background) !== null && _a !== void 0 ? _a : this.background,
18619
+ renderService: params.renderService,
18620
+ x: this.stage.x,
18621
+ y: this.stage.y,
18622
+ width: this.viewWidth,
18623
+ height: this.viewHeight,
18624
+ stage: this.stage,
18625
+ layer: this,
18626
+ ...params
18627
+ });
18374
18628
  this.afterDrawCbs.forEach(c => c(this));
18375
18629
  }
18376
18630
  }
@@ -18385,7 +18639,17 @@
18385
18639
  }
18386
18640
  drawTo(target, params) {
18387
18641
  var _a;
18388
- this.layerHandler.drawTo(target, [this], Object.assign({ background: (_a = params.background) !== null && _a !== void 0 ? _a : this.background, renderService: params.renderService, x: this.stage.x, y: this.stage.y, width: this.viewWidth, height: this.viewHeight, stage: this.stage, layer: this }, params));
18642
+ this.layerHandler.drawTo(target, [this], {
18643
+ background: (_a = params.background) !== null && _a !== void 0 ? _a : this.background,
18644
+ renderService: params.renderService,
18645
+ x: this.stage.x,
18646
+ y: this.stage.y,
18647
+ width: this.viewWidth,
18648
+ height: this.viewHeight,
18649
+ stage: this.stage,
18650
+ layer: this,
18651
+ ...params
18652
+ });
18389
18653
  this.afterDrawCbs.forEach(c => c(this));
18390
18654
  }
18391
18655
  }
@@ -18407,7 +18671,10 @@
18407
18671
  }
18408
18672
  createLayer(stage, options = { main: false }) {
18409
18673
  this.tryInit();
18410
- const layer = new Layer(stage, this.global, stage.window, Object.assign(Object.assign({}, options), { virtual: this.staticLayerCountInEnv === 0 }));
18674
+ const layer = new Layer(stage, this.global, stage.window, {
18675
+ ...options,
18676
+ virtual: this.staticLayerCountInEnv === 0
18677
+ });
18411
18678
  const stageLayers = this.layerMap.get(stage) || [];
18412
18679
  stageLayers.push(layer);
18413
18680
  this.layerMap.set(stage, stageLayers);
@@ -19496,7 +19763,7 @@
19496
19763
  return path;
19497
19764
  }
19498
19765
  clone() {
19499
- return new Circle(Object.assign({}, this.attribute));
19766
+ return new Circle({ ...this.attribute });
19500
19767
  }
19501
19768
  }
19502
19769
 
@@ -20021,7 +20288,7 @@
20021
20288
  return false;
20022
20289
  }
20023
20290
  clone() {
20024
- return new Text(Object.assign({}, this.attribute));
20291
+ return new Text({ ...this.attribute });
20025
20292
  }
20026
20293
  }
20027
20294
 
@@ -20562,7 +20829,7 @@
20562
20829
  class Arrow2LeftSymbol {
20563
20830
  constructor() {
20564
20831
  this.type = 'arrow2Left';
20565
- this.pathStr = 'M 0.25 -0.5 L -0.25 0 l 0.5 0.5';
20832
+ this.pathStr = 'M 0.25 -0.5 L -0.25 0 l 0.25 0.5';
20566
20833
  }
20567
20834
  draw(ctx, size, transX, transY) {
20568
20835
  const r = size / 4;
@@ -20592,7 +20859,7 @@
20592
20859
  class Arrow2RightSymbol {
20593
20860
  constructor() {
20594
20861
  this.type = 'arrow2Right';
20595
- this.pathStr = 'M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5';
20862
+ this.pathStr = 'M -0.25 -0.5 l 0.25 0 l -0.25 0.5';
20596
20863
  }
20597
20864
  draw(ctx, size, transX, transY) {
20598
20865
  const r = size / 4;
@@ -20612,6 +20879,164 @@
20612
20879
  }
20613
20880
  var arrow2Right$1 = new Arrow2RightSymbol();
20614
20881
 
20882
+ function arrow2Up(ctx, r, transX, transY) {
20883
+ const r2 = r * 2;
20884
+ ctx.moveTo(transX - r2, transY + r);
20885
+ ctx.lineTo(transX, transY - r);
20886
+ ctx.lineTo(transX + r2, transY + r);
20887
+ return true;
20888
+ }
20889
+ class Arrow2UpSymbol {
20890
+ constructor() {
20891
+ this.type = 'arrow2Up';
20892
+ this.pathStr = 'M -0.5 0.25 L 0 -0.25 l 0.5 0.25';
20893
+ }
20894
+ draw(ctx, size, transX, transY) {
20895
+ const r = size / 4;
20896
+ return arrow2Up(ctx, r, transX, transY);
20897
+ }
20898
+ drawOffset(ctx, size, transX, transY, offset) {
20899
+ const r = size / 4 + offset;
20900
+ return arrow2Up(ctx, r, transX, transY);
20901
+ }
20902
+ bounds(size, bounds) {
20903
+ const r = size / 2;
20904
+ bounds.x1 = -r;
20905
+ bounds.x2 = r;
20906
+ bounds.y1 = -r;
20907
+ bounds.y2 = r;
20908
+ }
20909
+ }
20910
+ var arrow2Up$1 = new Arrow2UpSymbol();
20911
+
20912
+ function arrow2Down(ctx, r, transX, transY) {
20913
+ const r2 = r * 2;
20914
+ ctx.moveTo(transX - r2, transY - r);
20915
+ ctx.lineTo(transX, transY + r);
20916
+ ctx.lineTo(transX + r2, transY - r);
20917
+ return true;
20918
+ }
20919
+ class Arrow2DownSymbol {
20920
+ constructor() {
20921
+ this.type = 'arrow2Down';
20922
+ this.pathStr = 'M -0.5 -0.25 L 0 0.25 l 0.5 -0.25';
20923
+ }
20924
+ draw(ctx, size, transX, transY) {
20925
+ const r = size / 4;
20926
+ return arrow2Down(ctx, r, transX, transY);
20927
+ }
20928
+ drawOffset(ctx, size, transX, transY, offset) {
20929
+ const r = size / 4 + offset;
20930
+ return arrow2Down(ctx, r, transX, transY);
20931
+ }
20932
+ bounds(size, bounds) {
20933
+ const r = size / 2;
20934
+ bounds.x1 = -r;
20935
+ bounds.x2 = r;
20936
+ bounds.y1 = -r;
20937
+ bounds.y2 = r;
20938
+ }
20939
+ }
20940
+ var arrow2Down$1 = new Arrow2DownSymbol();
20941
+
20942
+ function lineV(ctx, r, x, y, z) {
20943
+ ctx.moveTo(x, y - r);
20944
+ ctx.lineTo(x, y + r);
20945
+ return true;
20946
+ }
20947
+ class LineVSymbol {
20948
+ constructor() {
20949
+ this.type = 'lineV';
20950
+ this.pathStr = 'M0,-0.5L0,0.5';
20951
+ }
20952
+ draw(ctx, size, x, y, z) {
20953
+ const r = size / 2;
20954
+ return lineV(ctx, r, x, y);
20955
+ }
20956
+ drawOffset(ctx, size, x, y, offset, z) {
20957
+ const r = size / 2 + offset;
20958
+ return lineV(ctx, r, x, y);
20959
+ }
20960
+ drawToSvgPath(size, x, y, z) {
20961
+ const r = size / 2;
20962
+ return `M ${x}, ${y - r} L ${x},${y + r}`;
20963
+ }
20964
+ bounds(size, bounds) {
20965
+ const r = size / 2;
20966
+ bounds.x1 = -r;
20967
+ bounds.x2 = r;
20968
+ bounds.y1 = -r;
20969
+ bounds.y2 = r;
20970
+ }
20971
+ }
20972
+ var lineV$1 = new LineVSymbol();
20973
+
20974
+ function lineH(ctx, r, x, y, z) {
20975
+ ctx.moveTo(x - r, y);
20976
+ ctx.lineTo(x + r, y);
20977
+ return true;
20978
+ }
20979
+ class LineHSymbol {
20980
+ constructor() {
20981
+ this.type = 'lineH';
20982
+ this.pathStr = 'M-0.5,0L0.5,0';
20983
+ }
20984
+ draw(ctx, size, x, y, z) {
20985
+ const r = size / 2;
20986
+ return lineH(ctx, r, x, y);
20987
+ }
20988
+ drawOffset(ctx, size, x, y, offset, z) {
20989
+ const r = size / 2 + offset;
20990
+ return lineH(ctx, r, x, y);
20991
+ }
20992
+ drawToSvgPath(size, x, y, z) {
20993
+ const r = size / 2;
20994
+ return `M ${x - r}, ${y} L ${x + r},${y}`;
20995
+ }
20996
+ bounds(size, bounds) {
20997
+ const r = size / 2;
20998
+ bounds.x1 = -r;
20999
+ bounds.x2 = r;
21000
+ bounds.y1 = -r;
21001
+ bounds.y2 = r;
21002
+ }
21003
+ }
21004
+ var lineH$1 = new LineHSymbol();
21005
+
21006
+ function close(ctx, r, x, y, z) {
21007
+ ctx.moveTo(x - r, y - r);
21008
+ ctx.lineTo(x + r, y + r);
21009
+ ctx.moveTo(x + r, y - r);
21010
+ ctx.lineTo(x - r, y + r);
21011
+ return true;
21012
+ }
21013
+ class CloseSymbol {
21014
+ constructor() {
21015
+ this.type = 'close';
21016
+ this.pathStr = 'M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5';
21017
+ }
21018
+ draw(ctx, size, x, y, z) {
21019
+ const r = size / 2;
21020
+ return close(ctx, r, x, y);
21021
+ }
21022
+ drawOffset(ctx, size, x, y, offset, z) {
21023
+ const r = size / 2 + offset;
21024
+ return close(ctx, r, x, y);
21025
+ }
21026
+ drawToSvgPath(size, x, y, z) {
21027
+ const r = size / 2;
21028
+ return `M ${x - r}, ${y - r} L ${x + r},${y + r} M ${x + r}, ${y - r} L ${x - r},${y + r}`;
21029
+ }
21030
+ bounds(size, bounds) {
21031
+ const r = size / 2;
21032
+ bounds.x1 = -r;
21033
+ bounds.x2 = r;
21034
+ bounds.y1 = -r;
21035
+ bounds.y2 = r;
21036
+ }
21037
+ }
21038
+ var close$1 = new CloseSymbol();
21039
+
20615
21040
  function rect(ctx, size, x, y) {
20616
21041
  ctx.rect(x - size[0] / 2, y - size[1] / 2, size[0], size[1]);
20617
21042
  return false;
@@ -20641,21 +21066,64 @@
20641
21066
  }
20642
21067
  var rect$1 = new RectSymbol();
20643
21068
 
21069
+ const tempBounds = new AABBBounds();
20644
21070
  class CustomSymbolClass {
20645
- constructor(type, path) {
21071
+ constructor(type, path, isSvg = false) {
20646
21072
  this.pathStr = '';
20647
21073
  this.type = type;
20648
- this.path = path;
21074
+ if (isArray(path)) {
21075
+ this.svgCache = path;
21076
+ }
21077
+ else {
21078
+ this.path = path;
21079
+ }
21080
+ this.isSvg = isSvg;
20649
21081
  }
20650
- drawOffset(ctx, size, x, y, offset) {
21082
+ drawOffset(ctx, size, x, y, offset, z, cb) {
21083
+ if (this.isSvg) {
21084
+ if (!this.svgCache) {
21085
+ return false;
21086
+ }
21087
+ this.svgCache.forEach(item => {
21088
+ ctx.beginPath();
21089
+ renderCommandList(item.path.commandList, ctx, x, y, size, size);
21090
+ cb && cb(item.path, item.attribute);
21091
+ });
21092
+ return false;
21093
+ }
20651
21094
  renderCommandList(this.path.commandList, ctx, x, y, size + offset, size + offset);
20652
21095
  return false;
20653
21096
  }
20654
- draw(ctx, size, x, y) {
21097
+ draw(ctx, size, x, y, z, cb) {
21098
+ if (this.isSvg) {
21099
+ if (!this.svgCache) {
21100
+ return false;
21101
+ }
21102
+ this.svgCache.forEach(item => {
21103
+ ctx.beginPath();
21104
+ renderCommandList(item.path.commandList, ctx, x, y, size, size);
21105
+ cb && cb(item.path, item.attribute);
21106
+ });
21107
+ return false;
21108
+ }
20655
21109
  renderCommandList(this.path.commandList, ctx, x, y, size, size);
20656
21110
  return false;
20657
21111
  }
20658
21112
  bounds(size, bounds) {
21113
+ if (this.isSvg) {
21114
+ if (!this.svgCache) {
21115
+ return;
21116
+ }
21117
+ bounds.clear();
21118
+ this.svgCache.forEach(({ path }) => {
21119
+ tempBounds.x1 = path.bounds.x1 * size;
21120
+ tempBounds.y1 = path.bounds.y1 * size;
21121
+ tempBounds.x2 = path.bounds.x2 * size;
21122
+ tempBounds.y2 = path.bounds.y2 * size;
21123
+ bounds.union(tempBounds);
21124
+ });
21125
+ return;
21126
+ }
20659
21127
  if (!this.path.bounds) {
20660
21128
  return;
20661
21129
  }
@@ -20684,13 +21152,1892 @@
20684
21152
  triangleDown,
20685
21153
  arrow2Left$1,
20686
21154
  arrow2Right$1,
20687
- rect$1
21155
+ arrow2Up$1,
21156
+ arrow2Down$1,
21157
+ rect$1,
21158
+ lineV$1,
21159
+ lineH$1,
21160
+ close$1
20688
21161
  ];
20689
21162
  const builtinSymbolsMap = {};
20690
21163
  builtinSymbols.forEach(symbol => {
20691
21164
  builtinSymbolsMap[symbol.type] = symbol;
20692
21165
  });
20693
21166
 
21167
+ var validator$2 = {};
21168
+
21169
+ var util$3 = {};
21170
+
21171
+ (function (exports) {
21172
+
21173
+ var nameStartChar = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
21174
+ var nameChar = nameStartChar + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
21175
+ var nameRegexp = '[' + nameStartChar + '][' + nameChar + ']*';
21176
+ var regexName = new RegExp('^' + nameRegexp + '$');
21177
+ var getAllMatches = function getAllMatches(string, regex) {
21178
+ var matches = [];
21179
+ var match = regex.exec(string);
21180
+ while (match) {
21181
+ var allmatches = [];
21182
+ allmatches.startIndex = regex.lastIndex - match[0].length;
21183
+ var len = match.length;
21184
+ for (var index = 0; index < len; index++) {
21185
+ allmatches.push(match[index]);
21186
+ }
21187
+ matches.push(allmatches);
21188
+ match = regex.exec(string);
21189
+ }
21190
+ return matches;
21191
+ };
21192
+ var isName = function isName(string) {
21193
+ var match = regexName.exec(string);
21194
+ return !(match === null || typeof match === 'undefined');
21195
+ };
21196
+ exports.isExist = function (v) {
21197
+ return typeof v !== 'undefined';
21198
+ };
21199
+ exports.isEmptyObject = function (obj) {
21200
+ return Object.keys(obj).length === 0;
21201
+ };
21202
+
21203
+ /**
21204
+ * Copy all the properties of a into b.
21205
+ * @param {*} target
21206
+ * @param {*} a
21207
+ */
21208
+ exports.merge = function (target, a, arrayMode) {
21209
+ if (a) {
21210
+ var keys = Object.keys(a); // will return an array of own properties
21211
+ var len = keys.length; //don't make it inline
21212
+ for (var i = 0; i < len; i++) {
21213
+ if (arrayMode === 'strict') {
21214
+ target[keys[i]] = [a[keys[i]]];
21215
+ } else {
21216
+ target[keys[i]] = a[keys[i]];
21217
+ }
21218
+ }
21219
+ }
21220
+ };
21221
+ /* exports.merge =function (b,a){
21222
+ return Object.assign(b,a);
21223
+ } */
21224
+
21225
+ exports.getValue = function (v) {
21226
+ if (exports.isExist(v)) {
21227
+ return v;
21228
+ } else {
21229
+ return '';
21230
+ }
21231
+ };
21232
+
21233
+ // const fakeCall = function(a) {return a;};
21234
+ // const fakeCallNoReturn = function() {};
21235
+
21236
+ exports.isName = isName;
21237
+ exports.getAllMatches = getAllMatches;
21238
+ exports.nameRegexp = nameRegexp;
21239
+ })(util$3);
21240
+
21241
+ var util$2 = util$3;
21242
+ var defaultOptions$2 = {
21243
+ allowBooleanAttributes: false,
21244
+ //A tag can have attributes without any value
21245
+ unpairedTags: []
21246
+ };
21247
+
21248
+ //const tagsPattern = new RegExp("<\\/?([\\w:\\-_\.]+)\\s*\/?>","g");
21249
+ validator$2.validate = function (xmlData, options) {
21250
+ options = Object.assign({}, defaultOptions$2, options);
21251
+
21252
+ //xmlData = xmlData.replace(/(\r\n|\n|\r)/gm,"");//make it single line
21253
+ //xmlData = xmlData.replace(/(^\s*<\?xml.*?\?>)/g,"");//Remove XML starting tag
21254
+ //xmlData = xmlData.replace(/(<!DOCTYPE[\s\w\"\.\/\-\:]+(\[.*\])*\s*>)/g,"");//Remove DOCTYPE
21255
+ var tags = [];
21256
+ var tagFound = false;
21257
+
21258
+ //indicates that the root tag has been closed (aka. depth 0 has been reached)
21259
+ var reachedRoot = false;
21260
+ if (xmlData[0] === "\uFEFF") {
21261
+ // check for byte order mark (BOM)
21262
+ xmlData = xmlData.substr(1);
21263
+ }
21264
+ for (var i = 0; i < xmlData.length; i++) {
21265
+ if (xmlData[i] === '<' && xmlData[i + 1] === '?') {
21266
+ i += 2;
21267
+ i = readPI(xmlData, i);
21268
+ if (i.err) return i;
21269
+ } else if (xmlData[i] === '<') {
21270
+ //starting of tag
21271
+ //read until you reach to '>' avoiding any '>' in attribute value
21272
+ var tagStartPos = i;
21273
+ i++;
21274
+ if (xmlData[i] === '!') {
21275
+ i = readCommentAndCDATA(xmlData, i);
21276
+ continue;
21277
+ } else {
21278
+ var closingTag = false;
21279
+ if (xmlData[i] === '/') {
21280
+ //closing tag
21281
+ closingTag = true;
21282
+ i++;
21283
+ }
21284
+ //read tagname
21285
+ var tagName = '';
21286
+ for (; i < xmlData.length && xmlData[i] !== '>' && xmlData[i] !== ' ' && xmlData[i] !== '\t' && xmlData[i] !== '\n' && xmlData[i] !== '\r'; i++) {
21287
+ tagName += xmlData[i];
21288
+ }
21289
+ tagName = tagName.trim();
21290
+ //console.log(tagName);
21291
+
21292
+ if (tagName[tagName.length - 1] === '/') {
21293
+ //self closing tag without attributes
21294
+ tagName = tagName.substring(0, tagName.length - 1);
21295
+ //continue;
21296
+ i--;
21297
+ }
21298
+ if (!validateTagName(tagName)) {
21299
+ var msg = void 0;
21300
+ if (tagName.trim().length === 0) {
21301
+ msg = "Invalid space after '<'.";
21302
+ } else {
21303
+ msg = "Tag '" + tagName + "' is an invalid name.";
21304
+ }
21305
+ return getErrorObject('InvalidTag', msg, getLineNumberForPosition(xmlData, i));
21306
+ }
21307
+ var result = readAttributeStr(xmlData, i);
21308
+ if (result === false) {
21309
+ return getErrorObject('InvalidAttr', "Attributes for '" + tagName + "' have open quote.", getLineNumberForPosition(xmlData, i));
21310
+ }
21311
+ var attrStr = result.value;
21312
+ i = result.index;
21313
+ if (attrStr[attrStr.length - 1] === '/') {
21314
+ //self closing tag
21315
+ var attrStrStart = i - attrStr.length;
21316
+ attrStr = attrStr.substring(0, attrStr.length - 1);
21317
+ var isValid = validateAttributeString(attrStr, options);
21318
+ if (isValid === true) {
21319
+ tagFound = true;
21320
+ //continue; //text may presents after self closing tag
21321
+ } else {
21322
+ //the result from the nested function returns the position of the error within the attribute
21323
+ //in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute
21324
+ //this gives us the absolute index in the entire xml, which we can use to find the line at last
21325
+ return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line));
21326
+ }
21327
+ } else if (closingTag) {
21328
+ if (!result.tagClosed) {
21329
+ return getErrorObject('InvalidTag', "Closing tag '" + tagName + "' doesn't have proper closing.", getLineNumberForPosition(xmlData, i));
21330
+ } else if (attrStr.trim().length > 0) {
21331
+ return getErrorObject('InvalidTag', "Closing tag '" + tagName + "' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos));
21332
+ } else {
21333
+ var otg = tags.pop();
21334
+ if (tagName !== otg.tagName) {
21335
+ var openPos = getLineNumberForPosition(xmlData, otg.tagStartPos);
21336
+ return getErrorObject('InvalidTag', "Expected closing tag '" + otg.tagName + "' (opened in line " + openPos.line + ", col " + openPos.col + ") instead of closing tag '" + tagName + "'.", getLineNumberForPosition(xmlData, tagStartPos));
21337
+ }
21338
+
21339
+ //when there are no more tags, we reached the root level.
21340
+ if (tags.length == 0) {
21341
+ reachedRoot = true;
21342
+ }
21343
+ }
21344
+ } else {
21345
+ var _isValid = validateAttributeString(attrStr, options);
21346
+ if (_isValid !== true) {
21347
+ //the result from the nested function returns the position of the error within the attribute
21348
+ //in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute
21349
+ //this gives us the absolute index in the entire xml, which we can use to find the line at last
21350
+ return getErrorObject(_isValid.err.code, _isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + _isValid.err.line));
21351
+ }
21352
+
21353
+ //if the root level has been reached before ...
21354
+ if (reachedRoot === true) {
21355
+ return getErrorObject('InvalidXml', 'Multiple possible root nodes found.', getLineNumberForPosition(xmlData, i));
21356
+ } else if (options.unpairedTags.indexOf(tagName) !== -1) ; else {
21357
+ tags.push({
21358
+ tagName: tagName,
21359
+ tagStartPos: tagStartPos
21360
+ });
21361
+ }
21362
+ tagFound = true;
21363
+ }
21364
+
21365
+ //skip tag text value
21366
+ //It may include comments and CDATA value
21367
+ for (i++; i < xmlData.length; i++) {
21368
+ if (xmlData[i] === '<') {
21369
+ if (xmlData[i + 1] === '!') {
21370
+ //comment or CADATA
21371
+ i++;
21372
+ i = readCommentAndCDATA(xmlData, i);
21373
+ continue;
21374
+ } else if (xmlData[i + 1] === '?') {
21375
+ i = readPI(xmlData, ++i);
21376
+ if (i.err) return i;
21377
+ } else {
21378
+ break;
21379
+ }
21380
+ } else if (xmlData[i] === '&') {
21381
+ var afterAmp = validateAmpersand(xmlData, i);
21382
+ if (afterAmp == -1) return getErrorObject('InvalidChar', "char '&' is not expected.", getLineNumberForPosition(xmlData, i));
21383
+ i = afterAmp;
21384
+ } else {
21385
+ if (reachedRoot === true && !isWhiteSpace(xmlData[i])) {
21386
+ return getErrorObject('InvalidXml', "Extra text at the end", getLineNumberForPosition(xmlData, i));
21387
+ }
21388
+ }
21389
+ } //end of reading tag text value
21390
+ if (xmlData[i] === '<') {
21391
+ i--;
21392
+ }
21393
+ }
21394
+ } else {
21395
+ if (isWhiteSpace(xmlData[i])) {
21396
+ continue;
21397
+ }
21398
+ return getErrorObject('InvalidChar', "char '" + xmlData[i] + "' is not expected.", getLineNumberForPosition(xmlData, i));
21399
+ }
21400
+ }
21401
+ if (!tagFound) {
21402
+ return getErrorObject('InvalidXml', 'Start tag expected.', 1);
21403
+ } else if (tags.length == 1) {
21404
+ return getErrorObject('InvalidTag', "Unclosed tag '" + tags[0].tagName + "'.", getLineNumberForPosition(xmlData, tags[0].tagStartPos));
21405
+ } else if (tags.length > 0) {
21406
+ return getErrorObject('InvalidXml', "Invalid '" + JSON.stringify(tags.map(function (t) {
21407
+ return t.tagName;
21408
+ }), null, 4).replace(/\r?\n/g, '') + "' found.", {
21409
+ line: 1,
21410
+ col: 1
21411
+ });
21412
+ }
21413
+ return true;
21414
+ };
21415
+ function isWhiteSpace(_char) {
21416
+ return _char === ' ' || _char === '\t' || _char === '\n' || _char === '\r';
21417
+ }
21418
+ /**
21419
+ * Read Processing insstructions and skip
21420
+ * @param {*} xmlData
21421
+ * @param {*} i
21422
+ */
21423
+ function readPI(xmlData, i) {
21424
+ var start = i;
21425
+ for (; i < xmlData.length; i++) {
21426
+ if (xmlData[i] == '?' || xmlData[i] == ' ') {
21427
+ //tagname
21428
+ var tagname = xmlData.substr(start, i - start);
21429
+ if (i > 5 && tagname === 'xml') {
21430
+ return getErrorObject('InvalidXml', 'XML declaration allowed only at the start of the document.', getLineNumberForPosition(xmlData, i));
21431
+ } else if (xmlData[i] == '?' && xmlData[i + 1] == '>') {
21432
+ //check if valid attribut string
21433
+ i++;
21434
+ break;
21435
+ } else {
21436
+ continue;
21437
+ }
21438
+ }
21439
+ }
21440
+ return i;
21441
+ }
21442
+ function readCommentAndCDATA(xmlData, i) {
21443
+ if (xmlData.length > i + 5 && xmlData[i + 1] === '-' && xmlData[i + 2] === '-') {
21444
+ //comment
21445
+ for (i += 3; i < xmlData.length; i++) {
21446
+ if (xmlData[i] === '-' && xmlData[i + 1] === '-' && xmlData[i + 2] === '>') {
21447
+ i += 2;
21448
+ break;
21449
+ }
21450
+ }
21451
+ } else if (xmlData.length > i + 8 && xmlData[i + 1] === 'D' && xmlData[i + 2] === 'O' && xmlData[i + 3] === 'C' && xmlData[i + 4] === 'T' && xmlData[i + 5] === 'Y' && xmlData[i + 6] === 'P' && xmlData[i + 7] === 'E') {
21452
+ var angleBracketsCount = 1;
21453
+ for (i += 8; i < xmlData.length; i++) {
21454
+ if (xmlData[i] === '<') {
21455
+ angleBracketsCount++;
21456
+ } else if (xmlData[i] === '>') {
21457
+ angleBracketsCount--;
21458
+ if (angleBracketsCount === 0) {
21459
+ break;
21460
+ }
21461
+ }
21462
+ }
21463
+ } else if (xmlData.length > i + 9 && xmlData[i + 1] === '[' && xmlData[i + 2] === 'C' && xmlData[i + 3] === 'D' && xmlData[i + 4] === 'A' && xmlData[i + 5] === 'T' && xmlData[i + 6] === 'A' && xmlData[i + 7] === '[') {
21464
+ for (i += 8; i < xmlData.length; i++) {
21465
+ if (xmlData[i] === ']' && xmlData[i + 1] === ']' && xmlData[i + 2] === '>') {
21466
+ i += 2;
21467
+ break;
21468
+ }
21469
+ }
21470
+ }
21471
+ return i;
21472
+ }
21473
+ var doubleQuote = '"';
21474
+ var singleQuote = "'";
21475
+
21476
+ /**
21477
+ * Keep reading xmlData until '<' is found outside the attribute value.
21478
+ * @param {string} xmlData
21479
+ * @param {number} i
21480
+ */
21481
+ function readAttributeStr(xmlData, i) {
21482
+ var attrStr = '';
21483
+ var startChar = '';
21484
+ var tagClosed = false;
21485
+ for (; i < xmlData.length; i++) {
21486
+ if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) {
21487
+ if (startChar === '') {
21488
+ startChar = xmlData[i];
21489
+ } else if (startChar !== xmlData[i]) ; else {
21490
+ startChar = '';
21491
+ }
21492
+ } else if (xmlData[i] === '>') {
21493
+ if (startChar === '') {
21494
+ tagClosed = true;
21495
+ break;
21496
+ }
21497
+ }
21498
+ attrStr += xmlData[i];
21499
+ }
21500
+ if (startChar !== '') {
21501
+ return false;
21502
+ }
21503
+ return {
21504
+ value: attrStr,
21505
+ index: i,
21506
+ tagClosed: tagClosed
21507
+ };
21508
+ }
21509
+
21510
+ /**
21511
+ * Select all the attributes whether valid or invalid.
21512
+ */
21513
+ var validAttrStrRegxp = new RegExp('(\\s*)([^\\s=]+)(\\s*=)?(\\s*([\'"])(([\\s\\S])*?)\\5)?', 'g');
21514
+
21515
+ //attr, ="sd", a="amit's", a="sd"b="saf", ab cd=""
21516
+
21517
+ function validateAttributeString(attrStr, options) {
21518
+ //console.log("start:"+attrStr+":end");
21519
+
21520
+ //if(attrStr.trim().length === 0) return true; //empty string
21521
+
21522
+ var matches = util$2.getAllMatches(attrStr, validAttrStrRegxp);
21523
+ var attrNames = {};
21524
+ for (var i = 0; i < matches.length; i++) {
21525
+ if (matches[i][1].length === 0) {
21526
+ //nospace before attribute name: a="sd"b="saf"
21527
+ return getErrorObject('InvalidAttr', "Attribute '" + matches[i][2] + "' has no space in starting.", getPositionFromMatch(matches[i]));
21528
+ } else if (matches[i][3] !== undefined && matches[i][4] === undefined) {
21529
+ return getErrorObject('InvalidAttr', "Attribute '" + matches[i][2] + "' is without value.", getPositionFromMatch(matches[i]));
21530
+ } else if (matches[i][3] === undefined && !options.allowBooleanAttributes) {
21531
+ //independent attribute: ab
21532
+ return getErrorObject('InvalidAttr', "boolean attribute '" + matches[i][2] + "' is not allowed.", getPositionFromMatch(matches[i]));
21533
+ }
21534
+ /* else if(matches[i][6] === undefined){//attribute without value: ab=
21535
+ return { err: { code:"InvalidAttr",msg:"attribute " + matches[i][2] + " has no value assigned."}};
21536
+ } */
21537
+ var attrName = matches[i][2];
21538
+ if (!validateAttrName(attrName)) {
21539
+ return getErrorObject('InvalidAttr', "Attribute '" + attrName + "' is an invalid name.", getPositionFromMatch(matches[i]));
21540
+ }
21541
+ if (!attrNames.hasOwnProperty(attrName)) {
21542
+ //check for duplicate attribute.
21543
+ attrNames[attrName] = 1;
21544
+ } else {
21545
+ return getErrorObject('InvalidAttr', "Attribute '" + attrName + "' is repeated.", getPositionFromMatch(matches[i]));
21546
+ }
21547
+ }
21548
+ return true;
21549
+ }
21550
+ function validateNumberAmpersand(xmlData, i) {
21551
+ var re = /\d/;
21552
+ if (xmlData[i] === 'x') {
21553
+ i++;
21554
+ re = /[\da-fA-F]/;
21555
+ }
21556
+ for (; i < xmlData.length; i++) {
21557
+ if (xmlData[i] === ';') return i;
21558
+ if (!xmlData[i].match(re)) break;
21559
+ }
21560
+ return -1;
21561
+ }
21562
+ function validateAmpersand(xmlData, i) {
21563
+ // https://www.w3.org/TR/xml/#dt-charref
21564
+ i++;
21565
+ if (xmlData[i] === ';') return -1;
21566
+ if (xmlData[i] === '#') {
21567
+ i++;
21568
+ return validateNumberAmpersand(xmlData, i);
21569
+ }
21570
+ var count = 0;
21571
+ for (; i < xmlData.length; i++, count++) {
21572
+ if (xmlData[i].match(/\w/) && count < 20) continue;
21573
+ if (xmlData[i] === ';') break;
21574
+ return -1;
21575
+ }
21576
+ return i;
21577
+ }
21578
+ function getErrorObject(code, message, lineNumber) {
21579
+ return {
21580
+ err: {
21581
+ code: code,
21582
+ msg: message,
21583
+ line: lineNumber.line || lineNumber,
21584
+ col: lineNumber.col
21585
+ }
21586
+ };
21587
+ }
21588
+ function validateAttrName(attrName) {
21589
+ return util$2.isName(attrName);
21590
+ }
21591
+
21592
+ // const startsWithXML = /^xml/i;
21593
+
21594
+ function validateTagName(tagname) {
21595
+ return util$2.isName(tagname) /* && !tagname.match(startsWithXML) */;
21596
+ }
21597
+
21598
+ //this function returns the line number for the character at the given index
21599
+ function getLineNumberForPosition(xmlData, index) {
21600
+ var lines = xmlData.substring(0, index).split(/\r?\n/);
21601
+ return {
21602
+ line: lines.length,
21603
+ // column number is last line's length + 1, because column numbering starts at 1:
21604
+ col: lines[lines.length - 1].length + 1
21605
+ };
21606
+ }
21607
+
21608
+ //this function returns the position of the first character of match within attrStr
21609
+ function getPositionFromMatch(match) {
21610
+ return match.startIndex + match[1].length;
21611
+ }
21612
+
21613
+ var OptionsBuilder = {};
21614
+
21615
+ var defaultOptions$1 = {
21616
+ preserveOrder: false,
21617
+ attributeNamePrefix: '@_',
21618
+ attributesGroupName: false,
21619
+ textNodeName: '#text',
21620
+ ignoreAttributes: true,
21621
+ removeNSPrefix: false,
21622
+ // remove NS from tag name or attribute name if true
21623
+ allowBooleanAttributes: false,
21624
+ //a tag can have attributes without any value
21625
+ //ignoreRootElement : false,
21626
+ parseTagValue: true,
21627
+ parseAttributeValue: false,
21628
+ trimValues: true,
21629
+ //Trim string values of tag and attributes
21630
+ cdataPropName: false,
21631
+ numberParseOptions: {
21632
+ hex: true,
21633
+ leadingZeros: true,
21634
+ eNotation: true
21635
+ },
21636
+ tagValueProcessor: function tagValueProcessor(tagName, val) {
21637
+ return val;
21638
+ },
21639
+ attributeValueProcessor: function attributeValueProcessor(attrName, val) {
21640
+ return val;
21641
+ },
21642
+ stopNodes: [],
21643
+ //nested tags will not be parsed even for errors
21644
+ alwaysCreateTextNode: false,
21645
+ isArray: function isArray() {
21646
+ return false;
21647
+ },
21648
+ commentPropName: false,
21649
+ unpairedTags: [],
21650
+ processEntities: true,
21651
+ htmlEntities: false,
21652
+ ignoreDeclaration: false,
21653
+ ignorePiTags: false,
21654
+ transformTagName: false,
21655
+ transformAttributeName: false,
21656
+ updateTag: function updateTag(tagName, jPath, attrs) {
21657
+ return tagName;
21658
+ }
21659
+ // skipEmptyListItem: false
21660
+ };
21661
+
21662
+ var buildOptions$1 = function buildOptions(options) {
21663
+ return Object.assign({}, defaultOptions$1, options);
21664
+ };
21665
+ OptionsBuilder.buildOptions = buildOptions$1;
21666
+ OptionsBuilder.defaultOptions = defaultOptions$1;
21667
+
21668
+ var XmlNode = /*#__PURE__*/function () {
21669
+ function XmlNode(tagname) {
21670
+ _classCallCheck(this, XmlNode);
21671
+ this.tagname = tagname;
21672
+ this.child = []; //nested tags, text, cdata, comments in order
21673
+ this[":@"] = {}; //attributes map
21674
+ }
21675
+ _createClass(XmlNode, [{
21676
+ key: "add",
21677
+ value: function add(key, val) {
21678
+ // this.child.push( {name : key, val: val, isCdata: isCdata });
21679
+ if (key === "__proto__") key = "#__proto__";
21680
+ this.child.push(_defineProperty({}, key, val));
21681
+ }
21682
+ }, {
21683
+ key: "addChild",
21684
+ value: function addChild(node) {
21685
+ if (node.tagname === "__proto__") node.tagname = "#__proto__";
21686
+ if (node[":@"] && Object.keys(node[":@"]).length > 0) {
21687
+ var _this$child$push2;
21688
+ this.child.push((_this$child$push2 = {}, _defineProperty(_this$child$push2, node.tagname, node.child), _defineProperty(_this$child$push2, ":@", node[":@"]), _this$child$push2));
21689
+ } else {
21690
+ this.child.push(_defineProperty({}, node.tagname, node.child));
21691
+ }
21692
+ }
21693
+ }]);
21694
+ return XmlNode;
21695
+ }();
21696
+ var xmlNode$1 = XmlNode;
21697
+
21698
+ var util$1 = util$3;
21699
+
21700
+ //TODO: handle comments
21701
+ function readDocType$1(xmlData, i) {
21702
+ var entities = {};
21703
+ if (xmlData[i + 3] === 'O' && xmlData[i + 4] === 'C' && xmlData[i + 5] === 'T' && xmlData[i + 6] === 'Y' && xmlData[i + 7] === 'P' && xmlData[i + 8] === 'E') {
21704
+ i = i + 9;
21705
+ var angleBracketsCount = 1;
21706
+ var hasBody = false,
21707
+ comment = false;
21708
+ var exp = "";
21709
+ for (; i < xmlData.length; i++) {
21710
+ if (xmlData[i] === '<' && !comment) {
21711
+ //Determine the tag type
21712
+ if (hasBody && isEntity(xmlData, i)) {
21713
+ i += 7;
21714
+ var _readEntityExp = readEntityExp(xmlData, i + 1);
21715
+ var _readEntityExp2 = _slicedToArray(_readEntityExp, 3);
21716
+ entityName = _readEntityExp2[0];
21717
+ val = _readEntityExp2[1];
21718
+ i = _readEntityExp2[2];
21719
+ if (val.indexOf("&") === -1)
21720
+ //Parameter entities are not supported
21721
+ entities[validateEntityName(entityName)] = {
21722
+ regx: RegExp("&".concat(entityName, ";"), "g"),
21723
+ val: val
21724
+ };
21725
+ } else if (hasBody && isElement(xmlData, i)) i += 8; //Not supported
21726
+ else if (hasBody && isAttlist(xmlData, i)) i += 8; //Not supported
21727
+ else if (hasBody && isNotation(xmlData, i)) i += 9; //Not supported
21728
+ else if (isComment) comment = true;else throw new Error("Invalid DOCTYPE");
21729
+ angleBracketsCount++;
21730
+ exp = "";
21731
+ } else if (xmlData[i] === '>') {
21732
+ //Read tag content
21733
+ if (comment) {
21734
+ if (xmlData[i - 1] === "-" && xmlData[i - 2] === "-") {
21735
+ comment = false;
21736
+ angleBracketsCount--;
21737
+ }
21738
+ } else {
21739
+ angleBracketsCount--;
21740
+ }
21741
+ if (angleBracketsCount === 0) {
21742
+ break;
21743
+ }
21744
+ } else if (xmlData[i] === '[') {
21745
+ hasBody = true;
21746
+ } else {
21747
+ exp += xmlData[i];
21748
+ }
21749
+ }
21750
+ if (angleBracketsCount !== 0) {
21751
+ throw new Error("Unclosed DOCTYPE");
21752
+ }
21753
+ } else {
21754
+ throw new Error("Invalid Tag instead of DOCTYPE");
21755
+ }
21756
+ return {
21757
+ entities: entities,
21758
+ i: i
21759
+ };
21760
+ }
21761
+ function readEntityExp(xmlData, i) {
21762
+ //External entities are not supported
21763
+ // <!ENTITY ext SYSTEM "http://normal-website.com" >
21764
+
21765
+ //Parameter entities are not supported
21766
+ // <!ENTITY entityname "&anotherElement;">
21767
+
21768
+ //Internal entities are supported
21769
+ // <!ENTITY entityname "replacement text">
21770
+
21771
+ //read EntityName
21772
+ var entityName = "";
21773
+ for (; i < xmlData.length && xmlData[i] !== "'" && xmlData[i] !== '"'; i++) {
21774
+ // if(xmlData[i] === " ") continue;
21775
+ // else
21776
+ entityName += xmlData[i];
21777
+ }
21778
+ entityName = entityName.trim();
21779
+ if (entityName.indexOf(" ") !== -1) throw new Error("External entites are not supported");
21780
+
21781
+ //read Entity Value
21782
+ var startChar = xmlData[i++];
21783
+ var val = "";
21784
+ for (; i < xmlData.length && xmlData[i] !== startChar; i++) {
21785
+ val += xmlData[i];
21786
+ }
21787
+ return [entityName, val, i];
21788
+ }
21789
+ function isComment(xmlData, i) {
21790
+ if (xmlData[i + 1] === '!' && xmlData[i + 2] === '-' && xmlData[i + 3] === '-') return true;
21791
+ return false;
21792
+ }
21793
+ function isEntity(xmlData, i) {
21794
+ if (xmlData[i + 1] === '!' && xmlData[i + 2] === 'E' && xmlData[i + 3] === 'N' && xmlData[i + 4] === 'T' && xmlData[i + 5] === 'I' && xmlData[i + 6] === 'T' && xmlData[i + 7] === 'Y') return true;
21795
+ return false;
21796
+ }
21797
+ function isElement(xmlData, i) {
21798
+ if (xmlData[i + 1] === '!' && xmlData[i + 2] === 'E' && xmlData[i + 3] === 'L' && xmlData[i + 4] === 'E' && xmlData[i + 5] === 'M' && xmlData[i + 6] === 'E' && xmlData[i + 7] === 'N' && xmlData[i + 8] === 'T') return true;
21799
+ return false;
21800
+ }
21801
+ function isAttlist(xmlData, i) {
21802
+ if (xmlData[i + 1] === '!' && xmlData[i + 2] === 'A' && xmlData[i + 3] === 'T' && xmlData[i + 4] === 'T' && xmlData[i + 5] === 'L' && xmlData[i + 6] === 'I' && xmlData[i + 7] === 'S' && xmlData[i + 8] === 'T') return true;
21803
+ return false;
21804
+ }
21805
+ function isNotation(xmlData, i) {
21806
+ if (xmlData[i + 1] === '!' && xmlData[i + 2] === 'N' && xmlData[i + 3] === 'O' && xmlData[i + 4] === 'T' && xmlData[i + 5] === 'A' && xmlData[i + 6] === 'T' && xmlData[i + 7] === 'I' && xmlData[i + 8] === 'O' && xmlData[i + 9] === 'N') return true;
21807
+ return false;
21808
+ }
21809
+ function validateEntityName(name) {
21810
+ if (util$1.isName(name)) return name;else throw new Error("Invalid entity name ".concat(name));
21811
+ }
21812
+ var DocTypeReader = readDocType$1;
21813
+
21814
+ var hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
21815
+ var numRegex = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;
21816
+ // const octRegex = /0x[a-z0-9]+/;
21817
+ // const binRegex = /0x[a-z0-9]+/;
21818
+
21819
+ //polyfill
21820
+ if (!Number.parseInt && window.parseInt) {
21821
+ Number.parseInt = window.parseInt;
21822
+ }
21823
+ if (!Number.parseFloat && window.parseFloat) {
21824
+ Number.parseFloat = window.parseFloat;
21825
+ }
21826
+ var consider = {
21827
+ hex: true,
21828
+ leadingZeros: true,
21829
+ decimalPoint: "\.",
21830
+ eNotation: true
21831
+ //skipLike: /regex/
21832
+ };
21833
+
21834
+ function toNumber$1(str) {
21835
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
21836
+ // const options = Object.assign({}, consider);
21837
+ // if(opt.leadingZeros === false){
21838
+ // options.leadingZeros = false;
21839
+ // }else if(opt.hex === false){
21840
+ // options.hex = false;
21841
+ // }
21842
+
21843
+ options = Object.assign({}, consider, options);
21844
+ if (!str || typeof str !== "string") return str;
21845
+ var trimmedStr = str.trim();
21846
+ // if(trimmedStr === "0.0") return 0;
21847
+ // else if(trimmedStr === "+0.0") return 0;
21848
+ // else if(trimmedStr === "-0.0") return -0;
21849
+
21850
+ if (options.skipLike !== undefined && options.skipLike.test(trimmedStr)) return str;else if (options.hex && hexRegex.test(trimmedStr)) {
21851
+ return Number.parseInt(trimmedStr, 16);
21852
+ // } else if (options.parseOct && octRegex.test(str)) {
21853
+ // return Number.parseInt(val, 8);
21854
+ // }else if (options.parseBin && binRegex.test(str)) {
21855
+ // return Number.parseInt(val, 2);
21856
+ } else {
21857
+ //separate negative sign, leading zeros, and rest number
21858
+ var match = numRegex.exec(trimmedStr);
21859
+ if (match) {
21860
+ var sign = match[1];
21861
+ var leadingZeros = match[2];
21862
+ var numTrimmedByZeros = trimZeros(match[3]); //complete num without leading zeros
21863
+ //trim ending zeros for floating number
21864
+
21865
+ var eNotation = match[4] || match[6];
21866
+ if (!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str; //-0123
21867
+ else if (!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str; //0123
21868
+ else {
21869
+ //no leading zeros or leading zeros are allowed
21870
+ var num = Number(trimmedStr);
21871
+ var numStr = "" + num;
21872
+ if (numStr.search(/[eE]/) !== -1) {
21873
+ //given number is long and parsed to eNotation
21874
+ if (options.eNotation) return num;else return str;
21875
+ } else if (eNotation) {
21876
+ //given number has enotation
21877
+ if (options.eNotation) return num;else return str;
21878
+ } else if (trimmedStr.indexOf(".") !== -1) {
21879
+ //floating number
21880
+ // const decimalPart = match[5].substr(1);
21881
+ // const intPart = trimmedStr.substr(0,trimmedStr.indexOf("."));
21882
+
21883
+ // const p = numStr.indexOf(".");
21884
+ // const givenIntPart = numStr.substr(0,p);
21885
+ // const givenDecPart = numStr.substr(p+1);
21886
+ if (numStr === "0" && numTrimmedByZeros === "") return num; //0.0
21887
+ else if (numStr === numTrimmedByZeros) return num; //0.456. 0.79000
21888
+ else if (sign && numStr === "-" + numTrimmedByZeros) return num;else return str;
21889
+ }
21890
+ if (leadingZeros) {
21891
+ // if(numTrimmedByZeros === numStr){
21892
+ // if(options.leadingZeros) return num;
21893
+ // else return str;
21894
+ // }else return str;
21895
+ if (numTrimmedByZeros === numStr) return num;else if (sign + numTrimmedByZeros === numStr) return num;else return str;
21896
+ }
21897
+ if (trimmedStr === numStr) return num;else if (trimmedStr === sign + numStr) return num;
21898
+ // else{
21899
+ // //number with +/- sign
21900
+ // trimmedStr.test(/[-+][0-9]);
21901
+
21902
+ // }
21903
+ return str;
21904
+ }
21905
+ // else if(!eNotation && trimmedStr && trimmedStr !== Number(trimmedStr) ) return str;
21906
+ } else {
21907
+ //non-numeric string
21908
+ return str;
21909
+ }
21910
+ }
21911
+ }
21912
+
21913
+ /**
21914
+ *
21915
+ * @param {string} numStr without leading zeros
21916
+ * @returns
21917
+ */
21918
+ function trimZeros(numStr) {
21919
+ if (numStr && numStr.indexOf(".") !== -1) {
21920
+ //float
21921
+ numStr = numStr.replace(/0+$/, ""); //remove ending zeros
21922
+ if (numStr === ".") numStr = "0";else if (numStr[0] === ".") numStr = "0" + numStr;else if (numStr[numStr.length - 1] === ".") numStr = numStr.substr(0, numStr.length - 1);
21923
+ return numStr;
21924
+ }
21925
+ return numStr;
21926
+ }
21927
+ var strnum = toNumber$1;
21928
+
21929
+ ///@ts-check
21930
+
21931
+ var util = util$3;
21932
+ var xmlNode = xmlNode$1;
21933
+ var readDocType = DocTypeReader;
21934
+ var toNumber = strnum;
21935
+ '<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)'.replace(/NAME/g, util.nameRegexp);
21936
+
21937
+ //const tagsRegx = new RegExp("<(\\/?[\\w:\\-\._]+)([^>]*)>(\\s*"+cdataRegx+")*([^<]+)?","g");
21938
+ //const tagsRegx = new RegExp("<(\\/?)((\\w*:)?([\\w:\\-\._]+))([^>]*)>([^<]*)("+cdataRegx+"([^<]*))*([^<]+)?","g");
21939
+ var OrderedObjParser$1 = /*#__PURE__*/_createClass(function OrderedObjParser(options) {
21940
+ _classCallCheck(this, OrderedObjParser);
21941
+ this.options = options;
21942
+ this.currentNode = null;
21943
+ this.tagsNodeStack = [];
21944
+ this.docTypeEntities = {};
21945
+ this.lastEntities = {
21946
+ "apos": {
21947
+ regex: /&(apos|#39|#x27);/g,
21948
+ val: "'"
21949
+ },
21950
+ "gt": {
21951
+ regex: /&(gt|#62|#x3E);/g,
21952
+ val: ">"
21953
+ },
21954
+ "lt": {
21955
+ regex: /&(lt|#60|#x3C);/g,
21956
+ val: "<"
21957
+ },
21958
+ "quot": {
21959
+ regex: /&(quot|#34|#x22);/g,
21960
+ val: "\""
21961
+ }
21962
+ };
21963
+ this.ampEntity = {
21964
+ regex: /&(amp|#38|#x26);/g,
21965
+ val: "&"
21966
+ };
21967
+ this.htmlEntities = {
21968
+ "space": {
21969
+ regex: /&(nbsp|#160);/g,
21970
+ val: " "
21971
+ },
21972
+ // "lt" : { regex: /&(lt|#60);/g, val: "<" },
21973
+ // "gt" : { regex: /&(gt|#62);/g, val: ">" },
21974
+ // "amp" : { regex: /&(amp|#38);/g, val: "&" },
21975
+ // "quot" : { regex: /&(quot|#34);/g, val: "\"" },
21976
+ // "apos" : { regex: /&(apos|#39);/g, val: "'" },
21977
+ "cent": {
21978
+ regex: /&(cent|#162);/g,
21979
+ val: "¢"
21980
+ },
21981
+ "pound": {
21982
+ regex: /&(pound|#163);/g,
21983
+ val: "£"
21984
+ },
21985
+ "yen": {
21986
+ regex: /&(yen|#165);/g,
21987
+ val: "¥"
21988
+ },
21989
+ "euro": {
21990
+ regex: /&(euro|#8364);/g,
21991
+ val: "€"
21992
+ },
21993
+ "copyright": {
21994
+ regex: /&(copy|#169);/g,
21995
+ val: "©"
21996
+ },
21997
+ "reg": {
21998
+ regex: /&(reg|#174);/g,
21999
+ val: "®"
22000
+ },
22001
+ "inr": {
22002
+ regex: /&(inr|#8377);/g,
22003
+ val: "₹"
22004
+ }
22005
+ };
22006
+ this.addExternalEntities = addExternalEntities;
22007
+ this.parseXml = parseXml;
22008
+ this.parseTextData = parseTextData;
22009
+ this.resolveNameSpace = resolveNameSpace;
22010
+ this.buildAttributesMap = buildAttributesMap;
22011
+ this.isItStopNode = isItStopNode;
22012
+ this.replaceEntitiesValue = replaceEntitiesValue$1;
22013
+ this.readStopNodeData = readStopNodeData;
22014
+ this.saveTextToParentTag = saveTextToParentTag;
22015
+ this.addChild = addChild;
22016
+ });
22017
+ function addExternalEntities(externalEntities) {
22018
+ var entKeys = Object.keys(externalEntities);
22019
+ for (var i = 0; i < entKeys.length; i++) {
22020
+ var ent = entKeys[i];
22021
+ this.lastEntities[ent] = {
22022
+ regex: new RegExp("&" + ent + ";", "g"),
22023
+ val: externalEntities[ent]
22024
+ };
22025
+ }
22026
+ }
22027
+
22028
+ /**
22029
+ * @param {string} val
22030
+ * @param {string} tagName
22031
+ * @param {string} jPath
22032
+ * @param {boolean} dontTrim
22033
+ * @param {boolean} hasAttributes
22034
+ * @param {boolean} isLeafNode
22035
+ * @param {boolean} escapeEntities
22036
+ */
22037
+ function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) {
22038
+ if (val !== undefined) {
22039
+ if (this.options.trimValues && !dontTrim) {
22040
+ val = val.trim();
22041
+ }
22042
+ if (val.length > 0) {
22043
+ if (!escapeEntities) val = this.replaceEntitiesValue(val);
22044
+ var newval = this.options.tagValueProcessor(tagName, val, jPath, hasAttributes, isLeafNode);
22045
+ if (newval === null || newval === undefined) {
22046
+ //don't parse
22047
+ return val;
22048
+ } else if (_typeof(newval) !== _typeof(val) || newval !== val) {
22049
+ //overwrite
22050
+ return newval;
22051
+ } else if (this.options.trimValues) {
22052
+ return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions);
22053
+ } else {
22054
+ var trimmedVal = val.trim();
22055
+ if (trimmedVal === val) {
22056
+ return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions);
22057
+ } else {
22058
+ return val;
22059
+ }
22060
+ }
22061
+ }
22062
+ }
22063
+ }
22064
+ function resolveNameSpace(tagname) {
22065
+ if (this.options.removeNSPrefix) {
22066
+ var tags = tagname.split(':');
22067
+ var prefix = tagname.charAt(0) === '/' ? '/' : '';
22068
+ if (tags[0] === 'xmlns') {
22069
+ return '';
22070
+ }
22071
+ if (tags.length === 2) {
22072
+ tagname = prefix + tags[1];
22073
+ }
22074
+ }
22075
+ return tagname;
22076
+ }
22077
+
22078
+ //TODO: change regex to capture NS
22079
+ //const attrsRegx = new RegExp("([\\w\\-\\.\\:]+)\\s*=\\s*(['\"])((.|\n)*?)\\2","gm");
22080
+ var attrsRegx = new RegExp('([^\\s=]+)\\s*(=\\s*([\'"])([\\s\\S]*?)\\3)?', 'gm');
22081
+ function buildAttributesMap(attrStr, jPath, tagName) {
22082
+ if (!this.options.ignoreAttributes && typeof attrStr === 'string') {
22083
+ // attrStr = attrStr.replace(/\r?\n/g, ' ');
22084
+ //attrStr = attrStr || attrStr.trim();
22085
+
22086
+ var matches = util.getAllMatches(attrStr, attrsRegx);
22087
+ var len = matches.length; //don't make it inline
22088
+ var attrs = {};
22089
+ for (var i = 0; i < len; i++) {
22090
+ var attrName = this.resolveNameSpace(matches[i][1]);
22091
+ var oldVal = matches[i][4];
22092
+ var aName = this.options.attributeNamePrefix + attrName;
22093
+ if (attrName.length) {
22094
+ if (this.options.transformAttributeName) {
22095
+ aName = this.options.transformAttributeName(aName);
22096
+ }
22097
+ if (aName === "__proto__") aName = "#__proto__";
22098
+ if (oldVal !== undefined) {
22099
+ if (this.options.trimValues) {
22100
+ oldVal = oldVal.trim();
22101
+ }
22102
+ oldVal = this.replaceEntitiesValue(oldVal);
22103
+ var newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath);
22104
+ if (newVal === null || newVal === undefined) {
22105
+ //don't parse
22106
+ attrs[aName] = oldVal;
22107
+ } else if (_typeof(newVal) !== _typeof(oldVal) || newVal !== oldVal) {
22108
+ //overwrite
22109
+ attrs[aName] = newVal;
22110
+ } else {
22111
+ //parse
22112
+ attrs[aName] = parseValue(oldVal, this.options.parseAttributeValue, this.options.numberParseOptions);
22113
+ }
22114
+ } else if (this.options.allowBooleanAttributes) {
22115
+ attrs[aName] = true;
22116
+ }
22117
+ }
22118
+ }
22119
+ if (!Object.keys(attrs).length) {
22120
+ return;
22121
+ }
22122
+ if (this.options.attributesGroupName) {
22123
+ var attrCollection = {};
22124
+ attrCollection[this.options.attributesGroupName] = attrs;
22125
+ return attrCollection;
22126
+ }
22127
+ return attrs;
22128
+ }
22129
+ }
22130
+ var parseXml = function parseXml(xmlData) {
22131
+ xmlData = xmlData.replace(/\r\n?/g, "\n"); //TODO: remove this line
22132
+ var xmlObj = new xmlNode('!xml');
22133
+ var currentNode = xmlObj;
22134
+ var textData = "";
22135
+ var jPath = "";
22136
+ for (var i = 0; i < xmlData.length; i++) {
22137
+ //for each char in XML data
22138
+ var ch = xmlData[i];
22139
+ if (ch === '<') {
22140
+ // const nextIndex = i+1;
22141
+ // const _2ndChar = xmlData[nextIndex];
22142
+ if (xmlData[i + 1] === '/') {
22143
+ //Closing Tag
22144
+ var closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed.");
22145
+ var tagName = xmlData.substring(i + 2, closeIndex).trim();
22146
+ if (this.options.removeNSPrefix) {
22147
+ var colonIndex = tagName.indexOf(":");
22148
+ if (colonIndex !== -1) {
22149
+ tagName = tagName.substr(colonIndex + 1);
22150
+ }
22151
+ }
22152
+ if (this.options.transformTagName) {
22153
+ tagName = this.options.transformTagName(tagName);
22154
+ }
22155
+ if (currentNode) {
22156
+ textData = this.saveTextToParentTag(textData, currentNode, jPath);
22157
+ }
22158
+
22159
+ //check if last tag of nested tag was unpaired tag
22160
+ var lastTagName = jPath.substring(jPath.lastIndexOf(".") + 1);
22161
+ if (tagName && this.options.unpairedTags.indexOf(tagName) !== -1) {
22162
+ throw new Error("Unpaired tag can not be used as closing tag: </".concat(tagName, ">"));
22163
+ }
22164
+ var propIndex = 0;
22165
+ if (lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1) {
22166
+ propIndex = jPath.lastIndexOf('.', jPath.lastIndexOf('.') - 1);
22167
+ this.tagsNodeStack.pop();
22168
+ } else {
22169
+ propIndex = jPath.lastIndexOf(".");
22170
+ }
22171
+ jPath = jPath.substring(0, propIndex);
22172
+ currentNode = this.tagsNodeStack.pop(); //avoid recursion, set the parent tag scope
22173
+ textData = "";
22174
+ i = closeIndex;
22175
+ } else if (xmlData[i + 1] === '?') {
22176
+ var tagData = readTagExp(xmlData, i, false, "?>");
22177
+ if (!tagData) throw new Error("Pi Tag is not closed.");
22178
+ textData = this.saveTextToParentTag(textData, currentNode, jPath);
22179
+ if (this.options.ignoreDeclaration && tagData.tagName === "?xml" || this.options.ignorePiTags) ; else {
22180
+ var childNode = new xmlNode(tagData.tagName);
22181
+ childNode.add(this.options.textNodeName, "");
22182
+ if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) {
22183
+ childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName);
22184
+ }
22185
+ this.addChild(currentNode, childNode, jPath);
22186
+ }
22187
+ i = tagData.closeIndex + 1;
22188
+ } else if (xmlData.substr(i + 1, 3) === '!--') {
22189
+ var endIndex = findClosingIndex(xmlData, "-->", i + 4, "Comment is not closed.");
22190
+ if (this.options.commentPropName) {
22191
+ var comment = xmlData.substring(i + 4, endIndex - 2);
22192
+ textData = this.saveTextToParentTag(textData, currentNode, jPath);
22193
+ currentNode.add(this.options.commentPropName, [_defineProperty({}, this.options.textNodeName, comment)]);
22194
+ }
22195
+ i = endIndex;
22196
+ } else if (xmlData.substr(i + 1, 2) === '!D') {
22197
+ var result = readDocType(xmlData, i);
22198
+ this.docTypeEntities = result.entities;
22199
+ i = result.i;
22200
+ } else if (xmlData.substr(i + 1, 2) === '![') {
22201
+ var _closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
22202
+ var tagExp = xmlData.substring(i + 9, _closeIndex);
22203
+ textData = this.saveTextToParentTag(textData, currentNode, jPath);
22204
+
22205
+ //cdata should be set even if it is 0 length string
22206
+ if (this.options.cdataPropName) {
22207
+ // let val = this.parseTextData(tagExp, this.options.cdataPropName, jPath + "." + this.options.cdataPropName, true, false, true);
22208
+ // if(!val) val = "";
22209
+ currentNode.add(this.options.cdataPropName, [_defineProperty({}, this.options.textNodeName, tagExp)]);
22210
+ } else {
22211
+ var val = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true);
22212
+ if (val == undefined) val = "";
22213
+ currentNode.add(this.options.textNodeName, val);
22214
+ }
22215
+ i = _closeIndex + 2;
22216
+ } else {
22217
+ //Opening tag
22218
+ var _result = readTagExp(xmlData, i, this.options.removeNSPrefix);
22219
+ var _tagName = _result.tagName;
22220
+ var _tagExp = _result.tagExp;
22221
+ var attrExpPresent = _result.attrExpPresent;
22222
+ var _closeIndex2 = _result.closeIndex;
22223
+ if (this.options.transformTagName) {
22224
+ _tagName = this.options.transformTagName(_tagName);
22225
+ }
22226
+
22227
+ //save text as child node
22228
+ if (currentNode && textData) {
22229
+ if (currentNode.tagname !== '!xml') {
22230
+ //when nested tag is found
22231
+ textData = this.saveTextToParentTag(textData, currentNode, jPath, false);
22232
+ }
22233
+ }
22234
+
22235
+ //check if last tag was unpaired tag
22236
+ var lastTag = currentNode;
22237
+ if (lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1) {
22238
+ currentNode = this.tagsNodeStack.pop();
22239
+ jPath = jPath.substring(0, jPath.lastIndexOf("."));
22240
+ }
22241
+ if (_tagName !== xmlObj.tagname) {
22242
+ jPath += jPath ? "." + _tagName : _tagName;
22243
+ }
22244
+ if (this.isItStopNode(this.options.stopNodes, jPath, _tagName)) {
22245
+ //TODO: namespace
22246
+ var tagContent = "";
22247
+ //self-closing tag
22248
+ if (_tagExp.length > 0 && _tagExp.lastIndexOf("/") === _tagExp.length - 1) {
22249
+ i = _result.closeIndex;
22250
+ }
22251
+ //unpaired tag
22252
+ else if (this.options.unpairedTags.indexOf(_tagName) !== -1) {
22253
+ i = _result.closeIndex;
22254
+ }
22255
+ //normal tag
22256
+ else {
22257
+ //read until closing tag is found
22258
+ var _result2 = this.readStopNodeData(xmlData, _tagName, _closeIndex2 + 1);
22259
+ if (!_result2) throw new Error("Unexpected end of ".concat(_tagName));
22260
+ i = _result2.i;
22261
+ tagContent = _result2.tagContent;
22262
+ }
22263
+ var _childNode = new xmlNode(_tagName);
22264
+ if (_tagName !== _tagExp && attrExpPresent) {
22265
+ _childNode[":@"] = this.buildAttributesMap(_tagExp, jPath, _tagName);
22266
+ }
22267
+ if (tagContent) {
22268
+ tagContent = this.parseTextData(tagContent, _tagName, jPath, true, attrExpPresent, true, true);
22269
+ }
22270
+ jPath = jPath.substr(0, jPath.lastIndexOf("."));
22271
+ _childNode.add(this.options.textNodeName, tagContent);
22272
+ this.addChild(currentNode, _childNode, jPath);
22273
+ } else {
22274
+ //selfClosing tag
22275
+ if (_tagExp.length > 0 && _tagExp.lastIndexOf("/") === _tagExp.length - 1) {
22276
+ if (_tagName[_tagName.length - 1] === "/") {
22277
+ //remove trailing '/'
22278
+ _tagName = _tagName.substr(0, _tagName.length - 1);
22279
+ jPath = jPath.substr(0, jPath.length - 1);
22280
+ _tagExp = _tagName;
22281
+ } else {
22282
+ _tagExp = _tagExp.substr(0, _tagExp.length - 1);
22283
+ }
22284
+ if (this.options.transformTagName) {
22285
+ _tagName = this.options.transformTagName(_tagName);
22286
+ }
22287
+ var _childNode2 = new xmlNode(_tagName);
22288
+ if (_tagName !== _tagExp && attrExpPresent) {
22289
+ _childNode2[":@"] = this.buildAttributesMap(_tagExp, jPath, _tagName);
22290
+ }
22291
+ this.addChild(currentNode, _childNode2, jPath);
22292
+ jPath = jPath.substr(0, jPath.lastIndexOf("."));
22293
+ }
22294
+ //opening tag
22295
+ else {
22296
+ var _childNode3 = new xmlNode(_tagName);
22297
+ this.tagsNodeStack.push(currentNode);
22298
+ if (_tagName !== _tagExp && attrExpPresent) {
22299
+ _childNode3[":@"] = this.buildAttributesMap(_tagExp, jPath, _tagName);
22300
+ }
22301
+ this.addChild(currentNode, _childNode3, jPath);
22302
+ currentNode = _childNode3;
22303
+ }
22304
+ textData = "";
22305
+ i = _closeIndex2;
22306
+ }
22307
+ }
22308
+ } else {
22309
+ textData += xmlData[i];
22310
+ }
22311
+ }
22312
+ return xmlObj.child;
22313
+ };
22314
+ function addChild(currentNode, childNode, jPath) {
22315
+ var result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]);
22316
+ if (result === false) ; else if (typeof result === "string") {
22317
+ childNode.tagname = result;
22318
+ currentNode.addChild(childNode);
22319
+ } else {
22320
+ currentNode.addChild(childNode);
22321
+ }
22322
+ }
22323
+ var replaceEntitiesValue$1 = function replaceEntitiesValue(val) {
22324
+ if (this.options.processEntities) {
22325
+ for (var entityName in this.docTypeEntities) {
22326
+ var entity = this.docTypeEntities[entityName];
22327
+ val = val.replace(entity.regx, entity.val);
22328
+ }
22329
+ for (var _entityName in this.lastEntities) {
22330
+ var _entity = this.lastEntities[_entityName];
22331
+ val = val.replace(_entity.regex, _entity.val);
22332
+ }
22333
+ if (this.options.htmlEntities) {
22334
+ for (var _entityName2 in this.htmlEntities) {
22335
+ var _entity2 = this.htmlEntities[_entityName2];
22336
+ val = val.replace(_entity2.regex, _entity2.val);
22337
+ }
22338
+ }
22339
+ val = val.replace(this.ampEntity.regex, this.ampEntity.val);
22340
+ }
22341
+ return val;
22342
+ };
22343
+ function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
22344
+ if (textData) {
22345
+ //store previously collected data as textNode
22346
+ if (isLeafNode === undefined) isLeafNode = Object.keys(currentNode.child).length === 0;
22347
+ textData = this.parseTextData(textData, currentNode.tagname, jPath, false, currentNode[":@"] ? Object.keys(currentNode[":@"]).length !== 0 : false, isLeafNode);
22348
+ if (textData !== undefined && textData !== "") currentNode.add(this.options.textNodeName, textData);
22349
+ textData = "";
22350
+ }
22351
+ return textData;
22352
+ }
22353
+
22354
+ //TODO: use jPath to simplify the logic
22355
+ /**
22356
+ *
22357
+ * @param {string[]} stopNodes
22358
+ * @param {string} jPath
22359
+ * @param {string} currentTagName
22360
+ */
22361
+ function isItStopNode(stopNodes, jPath, currentTagName) {
22362
+ var allNodesExp = "*." + currentTagName;
22363
+ for (var stopNodePath in stopNodes) {
22364
+ var stopNodeExp = stopNodes[stopNodePath];
22365
+ if (allNodesExp === stopNodeExp || jPath === stopNodeExp) return true;
22366
+ }
22367
+ return false;
22368
+ }
22369
+
22370
+ /**
22371
+ * Returns the tag Expression and where it is ending handling single-double quotes situation
22372
+ * @param {string} xmlData
22373
+ * @param {number} i starting index
22374
+ * @returns
22375
+ */
22376
+ function tagExpWithClosingIndex(xmlData, i) {
22377
+ var closingChar = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ">";
22378
+ var attrBoundary;
22379
+ var tagExp = "";
22380
+ for (var index = i; index < xmlData.length; index++) {
22381
+ var ch = xmlData[index];
22382
+ if (attrBoundary) {
22383
+ if (ch === attrBoundary) attrBoundary = ""; //reset
22384
+ } else if (ch === '"' || ch === "'") {
22385
+ attrBoundary = ch;
22386
+ } else if (ch === closingChar[0]) {
22387
+ if (closingChar[1]) {
22388
+ if (xmlData[index + 1] === closingChar[1]) {
22389
+ return {
22390
+ data: tagExp,
22391
+ index: index
22392
+ };
22393
+ }
22394
+ } else {
22395
+ return {
22396
+ data: tagExp,
22397
+ index: index
22398
+ };
22399
+ }
22400
+ } else if (ch === '\t') {
22401
+ ch = " ";
22402
+ }
22403
+ tagExp += ch;
22404
+ }
22405
+ }
22406
+ function findClosingIndex(xmlData, str, i, errMsg) {
22407
+ var closingIndex = xmlData.indexOf(str, i);
22408
+ if (closingIndex === -1) {
22409
+ throw new Error(errMsg);
22410
+ } else {
22411
+ return closingIndex + str.length - 1;
22412
+ }
22413
+ }
22414
+ function readTagExp(xmlData, i, removeNSPrefix) {
22415
+ var closingChar = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ">";
22416
+ var result = tagExpWithClosingIndex(xmlData, i + 1, closingChar);
22417
+ if (!result) return;
22418
+ var tagExp = result.data;
22419
+ var closeIndex = result.index;
22420
+ var separatorIndex = tagExp.search(/\s/);
22421
+ var tagName = tagExp;
22422
+ var attrExpPresent = true;
22423
+ if (separatorIndex !== -1) {
22424
+ //separate tag name and attributes expression
22425
+ tagName = tagExp.substr(0, separatorIndex).replace(/\s\s*$/, '');
22426
+ tagExp = tagExp.substr(separatorIndex + 1);
22427
+ }
22428
+ if (removeNSPrefix) {
22429
+ var colonIndex = tagName.indexOf(":");
22430
+ if (colonIndex !== -1) {
22431
+ tagName = tagName.substr(colonIndex + 1);
22432
+ attrExpPresent = tagName !== result.data.substr(colonIndex + 1);
22433
+ }
22434
+ }
22435
+ return {
22436
+ tagName: tagName,
22437
+ tagExp: tagExp,
22438
+ closeIndex: closeIndex,
22439
+ attrExpPresent: attrExpPresent
22440
+ };
22441
+ }
22442
+ /**
22443
+ * find paired tag for a stop node
22444
+ * @param {string} xmlData
22445
+ * @param {string} tagName
22446
+ * @param {number} i
22447
+ */
22448
+ function readStopNodeData(xmlData, tagName, i) {
22449
+ var startIndex = i;
22450
+ // Starting at 1 since we already have an open tag
22451
+ var openTagCount = 1;
22452
+ for (; i < xmlData.length; i++) {
22453
+ if (xmlData[i] === "<") {
22454
+ if (xmlData[i + 1] === "/") {
22455
+ //close tag
22456
+ var closeIndex = findClosingIndex(xmlData, ">", i, "".concat(tagName, " is not closed"));
22457
+ var closeTagName = xmlData.substring(i + 2, closeIndex).trim();
22458
+ if (closeTagName === tagName) {
22459
+ openTagCount--;
22460
+ if (openTagCount === 0) {
22461
+ return {
22462
+ tagContent: xmlData.substring(startIndex, i),
22463
+ i: closeIndex
22464
+ };
22465
+ }
22466
+ }
22467
+ i = closeIndex;
22468
+ } else if (xmlData[i + 1] === '?') {
22469
+ var _closeIndex3 = findClosingIndex(xmlData, "?>", i + 1, "StopNode is not closed.");
22470
+ i = _closeIndex3;
22471
+ } else if (xmlData.substr(i + 1, 3) === '!--') {
22472
+ var _closeIndex4 = findClosingIndex(xmlData, "-->", i + 3, "StopNode is not closed.");
22473
+ i = _closeIndex4;
22474
+ } else if (xmlData.substr(i + 1, 2) === '![') {
22475
+ var _closeIndex5 = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2;
22476
+ i = _closeIndex5;
22477
+ } else {
22478
+ var tagData = readTagExp(xmlData, i, '>');
22479
+ if (tagData) {
22480
+ var openTagName = tagData && tagData.tagName;
22481
+ if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length - 1] !== "/") {
22482
+ openTagCount++;
22483
+ }
22484
+ i = tagData.closeIndex;
22485
+ }
22486
+ }
22487
+ }
22488
+ } //end for loop
22489
+ }
22490
+
22491
+ function parseValue(val, shouldParse, options) {
22492
+ if (shouldParse && typeof val === 'string') {
22493
+ //console.log(options)
22494
+ var newval = val.trim();
22495
+ if (newval === 'true') return true;else if (newval === 'false') return false;else return toNumber(val, options);
22496
+ } else {
22497
+ if (util.isExist(val)) {
22498
+ return val;
22499
+ } else {
22500
+ return '';
22501
+ }
22502
+ }
22503
+ }
22504
+ var OrderedObjParser_1 = OrderedObjParser$1;
22505
+
22506
+ var node2json = {};
22507
+
22508
+ /**
22509
+ *
22510
+ * @param {array} node
22511
+ * @param {any} options
22512
+ * @returns
22513
+ */
22514
+ function prettify$1(node, options) {
22515
+ return compress(node, options);
22516
+ }
22517
+
22518
+ /**
22519
+ *
22520
+ * @param {array} arr
22521
+ * @param {object} options
22522
+ * @param {string} jPath
22523
+ * @returns object
22524
+ */
22525
+ function compress(arr, options, jPath) {
22526
+ var text;
22527
+ var compressedObj = {};
22528
+ for (var i = 0; i < arr.length; i++) {
22529
+ var tagObj = arr[i];
22530
+ var property = propName$1(tagObj);
22531
+ var newJpath = "";
22532
+ if (jPath === undefined) newJpath = property;else newJpath = jPath + "." + property;
22533
+ if (property === options.textNodeName) {
22534
+ if (text === undefined) text = tagObj[property];else text += "" + tagObj[property];
22535
+ } else if (property === undefined) {
22536
+ continue;
22537
+ } else if (tagObj[property]) {
22538
+ var val = compress(tagObj[property], options, newJpath);
22539
+ var isLeaf = isLeafTag(val, options);
22540
+ if (tagObj[":@"]) {
22541
+ assignAttributes(val, tagObj[":@"], newJpath, options);
22542
+ } else if (Object.keys(val).length === 1 && val[options.textNodeName] !== undefined && !options.alwaysCreateTextNode) {
22543
+ val = val[options.textNodeName];
22544
+ } else if (Object.keys(val).length === 0) {
22545
+ if (options.alwaysCreateTextNode) val[options.textNodeName] = "";else val = "";
22546
+ }
22547
+ if (compressedObj[property] !== undefined && compressedObj.hasOwnProperty(property)) {
22548
+ if (!Array.isArray(compressedObj[property])) {
22549
+ compressedObj[property] = [compressedObj[property]];
22550
+ }
22551
+ compressedObj[property].push(val);
22552
+ } else {
22553
+ //TODO: if a node is not an array, then check if it should be an array
22554
+ //also determine if it is a leaf node
22555
+ if (options.isArray(property, newJpath, isLeaf)) {
22556
+ compressedObj[property] = [val];
22557
+ } else {
22558
+ compressedObj[property] = val;
22559
+ }
22560
+ }
22561
+ }
22562
+ }
22563
+ // if(text && text.length > 0) compressedObj[options.textNodeName] = text;
22564
+ if (typeof text === "string") {
22565
+ if (text.length > 0) compressedObj[options.textNodeName] = text;
22566
+ } else if (text !== undefined) compressedObj[options.textNodeName] = text;
22567
+ return compressedObj;
22568
+ }
22569
+ function propName$1(obj) {
22570
+ var keys = Object.keys(obj);
22571
+ for (var i = 0; i < keys.length; i++) {
22572
+ var key = keys[i];
22573
+ if (key !== ":@") return key;
22574
+ }
22575
+ }
22576
+ function assignAttributes(obj, attrMap, jpath, options) {
22577
+ if (attrMap) {
22578
+ var keys = Object.keys(attrMap);
22579
+ var len = keys.length; //don't make it inline
22580
+ for (var i = 0; i < len; i++) {
22581
+ var atrrName = keys[i];
22582
+ if (options.isArray(atrrName, jpath + "." + atrrName, true, true)) {
22583
+ obj[atrrName] = [attrMap[atrrName]];
22584
+ } else {
22585
+ obj[atrrName] = attrMap[atrrName];
22586
+ }
22587
+ }
22588
+ }
22589
+ }
22590
+ function isLeafTag(obj, options) {
22591
+ var textNodeName = options.textNodeName;
22592
+ var propCount = Object.keys(obj).length;
22593
+ if (propCount === 0) {
22594
+ return true;
22595
+ }
22596
+ if (propCount === 1 && (obj[textNodeName] || typeof obj[textNodeName] === "boolean" || obj[textNodeName] === 0)) {
22597
+ return true;
22598
+ }
22599
+ return false;
22600
+ }
22601
+ node2json.prettify = prettify$1;
22602
+
22603
+ var buildOptions = OptionsBuilder.buildOptions;
22604
+ var OrderedObjParser = OrderedObjParser_1;
22605
+ var prettify = node2json.prettify;
22606
+ var validator$1 = validator$2;
22607
+ var XMLParser$1 = /*#__PURE__*/function () {
22608
+ function XMLParser(options) {
22609
+ _classCallCheck(this, XMLParser);
22610
+ this.externalEntities = {};
22611
+ this.options = buildOptions(options);
22612
+ }
22613
+ /**
22614
+ * Parse XML dats to JS object
22615
+ * @param {string|Buffer} xmlData
22616
+ * @param {boolean|Object} validationOption
22617
+ */
22618
+ _createClass(XMLParser, [{
22619
+ key: "parse",
22620
+ value: function parse(xmlData, validationOption) {
22621
+ if (typeof xmlData === "string") ; else if (xmlData.toString) {
22622
+ xmlData = xmlData.toString();
22623
+ } else {
22624
+ throw new Error("XML data is accepted in String or Bytes[] form.");
22625
+ }
22626
+ if (validationOption) {
22627
+ if (validationOption === true) validationOption = {}; //validate with default options
22628
+
22629
+ var result = validator$1.validate(xmlData, validationOption);
22630
+ if (result !== true) {
22631
+ throw Error("".concat(result.err.msg, ":").concat(result.err.line, ":").concat(result.err.col));
22632
+ }
22633
+ }
22634
+ var orderedObjParser = new OrderedObjParser(this.options);
22635
+ orderedObjParser.addExternalEntities(this.externalEntities);
22636
+ var orderedResult = orderedObjParser.parseXml(xmlData);
22637
+ if (this.options.preserveOrder || orderedResult === undefined) return orderedResult;else return prettify(orderedResult, this.options);
22638
+ }
22639
+
22640
+ /**
22641
+ * Add Entity which is not by default supported by this library
22642
+ * @param {string} key
22643
+ * @param {string} value
22644
+ */
22645
+ }, {
22646
+ key: "addEntity",
22647
+ value: function addEntity(key, value) {
22648
+ if (value.indexOf("&") !== -1) {
22649
+ throw new Error("Entity value can't have '&'");
22650
+ } else if (key.indexOf("&") !== -1 || key.indexOf(";") !== -1) {
22651
+ throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");
22652
+ } else if (value === "&") {
22653
+ throw new Error("An entity with value '&' is not permitted");
22654
+ } else {
22655
+ this.externalEntities[key] = value;
22656
+ }
22657
+ }
22658
+ }]);
22659
+ return XMLParser;
22660
+ }();
22661
+ var XMLParser_1 = XMLParser$1;
22662
+
22663
+ var EOL = "\n";
22664
+
22665
+ /**
22666
+ *
22667
+ * @param {array} jArray
22668
+ * @param {any} options
22669
+ * @returns
22670
+ */
22671
+ function toXml(jArray, options) {
22672
+ var indentation = "";
22673
+ if (options.format && options.indentBy.length > 0) {
22674
+ indentation = EOL;
22675
+ }
22676
+ return arrToStr(jArray, options, "", indentation);
22677
+ }
22678
+ function arrToStr(arr, options, jPath, indentation) {
22679
+ var xmlStr = "";
22680
+ var isPreviousElementTag = false;
22681
+ for (var i = 0; i < arr.length; i++) {
22682
+ var tagObj = arr[i];
22683
+ var tagName = propName(tagObj);
22684
+ var newJPath = "";
22685
+ if (jPath.length === 0) newJPath = tagName;else newJPath = "".concat(jPath, ".").concat(tagName);
22686
+ if (tagName === options.textNodeName) {
22687
+ var tagText = tagObj[tagName];
22688
+ if (!isStopNode(newJPath, options)) {
22689
+ tagText = options.tagValueProcessor(tagName, tagText);
22690
+ tagText = replaceEntitiesValue(tagText, options);
22691
+ }
22692
+ if (isPreviousElementTag) {
22693
+ xmlStr += indentation;
22694
+ }
22695
+ xmlStr += tagText;
22696
+ isPreviousElementTag = false;
22697
+ continue;
22698
+ } else if (tagName === options.cdataPropName) {
22699
+ if (isPreviousElementTag) {
22700
+ xmlStr += indentation;
22701
+ }
22702
+ xmlStr += "<![CDATA[".concat(tagObj[tagName][0][options.textNodeName], "]]>");
22703
+ isPreviousElementTag = false;
22704
+ continue;
22705
+ } else if (tagName === options.commentPropName) {
22706
+ xmlStr += indentation + "<!--".concat(tagObj[tagName][0][options.textNodeName], "-->");
22707
+ isPreviousElementTag = true;
22708
+ continue;
22709
+ } else if (tagName[0] === "?") {
22710
+ var _attStr = attr_to_str(tagObj[":@"], options);
22711
+ var tempInd = tagName === "?xml" ? "" : indentation;
22712
+ var piTextNodeName = tagObj[tagName][0][options.textNodeName];
22713
+ piTextNodeName = piTextNodeName.length !== 0 ? " " + piTextNodeName : ""; //remove extra spacing
22714
+ xmlStr += tempInd + "<".concat(tagName).concat(piTextNodeName).concat(_attStr, "?>");
22715
+ isPreviousElementTag = true;
22716
+ continue;
22717
+ }
22718
+ var newIdentation = indentation;
22719
+ if (newIdentation !== "") {
22720
+ newIdentation += options.indentBy;
22721
+ }
22722
+ var attStr = attr_to_str(tagObj[":@"], options);
22723
+ var tagStart = indentation + "<".concat(tagName).concat(attStr);
22724
+ var tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation);
22725
+ if (options.unpairedTags.indexOf(tagName) !== -1) {
22726
+ if (options.suppressUnpairedNode) xmlStr += tagStart + ">";else xmlStr += tagStart + "/>";
22727
+ } else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) {
22728
+ xmlStr += tagStart + "/>";
22729
+ } else if (tagValue && tagValue.endsWith(">")) {
22730
+ xmlStr += tagStart + ">".concat(tagValue).concat(indentation, "</").concat(tagName, ">");
22731
+ } else {
22732
+ xmlStr += tagStart + ">";
22733
+ if (tagValue && indentation !== "" && (tagValue.includes("/>") || tagValue.includes("</"))) {
22734
+ xmlStr += indentation + options.indentBy + tagValue + indentation;
22735
+ } else {
22736
+ xmlStr += tagValue;
22737
+ }
22738
+ xmlStr += "</".concat(tagName, ">");
22739
+ }
22740
+ isPreviousElementTag = true;
22741
+ }
22742
+ return xmlStr;
22743
+ }
22744
+ function propName(obj) {
22745
+ var keys = Object.keys(obj);
22746
+ for (var i = 0; i < keys.length; i++) {
22747
+ var key = keys[i];
22748
+ if (key !== ":@") return key;
22749
+ }
22750
+ }
22751
+ function attr_to_str(attrMap, options) {
22752
+ var attrStr = "";
22753
+ if (attrMap && !options.ignoreAttributes) {
22754
+ for (var attr in attrMap) {
22755
+ var attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
22756
+ attrVal = replaceEntitiesValue(attrVal, options);
22757
+ if (attrVal === true && options.suppressBooleanAttributes) {
22758
+ attrStr += " ".concat(attr.substr(options.attributeNamePrefix.length));
22759
+ } else {
22760
+ attrStr += " ".concat(attr.substr(options.attributeNamePrefix.length), "=\"").concat(attrVal, "\"");
22761
+ }
22762
+ }
22763
+ }
22764
+ return attrStr;
22765
+ }
22766
+ function isStopNode(jPath, options) {
22767
+ jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1);
22768
+ var tagName = jPath.substr(jPath.lastIndexOf(".") + 1);
22769
+ for (var index in options.stopNodes) {
22770
+ if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName) return true;
22771
+ }
22772
+ return false;
22773
+ }
22774
+ function replaceEntitiesValue(textValue, options) {
22775
+ if (textValue && textValue.length > 0 && options.processEntities) {
22776
+ for (var i = 0; i < options.entities.length; i++) {
22777
+ var entity = options.entities[i];
22778
+ textValue = textValue.replace(entity.regex, entity.val);
22779
+ }
22780
+ }
22781
+ return textValue;
22782
+ }
22783
+ var orderedJs2Xml = toXml;
22784
+
22785
+ //parse Empty Node as self closing node
22786
+ var buildFromOrderedJs = orderedJs2Xml;
22787
+ var defaultOptions = {
22788
+ attributeNamePrefix: '@_',
22789
+ attributesGroupName: false,
22790
+ textNodeName: '#text',
22791
+ ignoreAttributes: true,
22792
+ cdataPropName: false,
22793
+ format: false,
22794
+ indentBy: ' ',
22795
+ suppressEmptyNode: false,
22796
+ suppressUnpairedNode: true,
22797
+ suppressBooleanAttributes: true,
22798
+ tagValueProcessor: function tagValueProcessor(key, a) {
22799
+ return a;
22800
+ },
22801
+ attributeValueProcessor: function attributeValueProcessor(attrName, a) {
22802
+ return a;
22803
+ },
22804
+ preserveOrder: false,
22805
+ commentPropName: false,
22806
+ unpairedTags: [],
22807
+ entities: [{
22808
+ regex: new RegExp("&", "g"),
22809
+ val: "&amp;"
22810
+ },
22811
+ //it must be on top
22812
+ {
22813
+ regex: new RegExp(">", "g"),
22814
+ val: "&gt;"
22815
+ }, {
22816
+ regex: new RegExp("<", "g"),
22817
+ val: "&lt;"
22818
+ }, {
22819
+ regex: new RegExp("\'", "g"),
22820
+ val: "&apos;"
22821
+ }, {
22822
+ regex: new RegExp("\"", "g"),
22823
+ val: "&quot;"
22824
+ }],
22825
+ processEntities: true,
22826
+ stopNodes: [],
22827
+ // transformTagName: false,
22828
+ // transformAttributeName: false,
22829
+ oneListGroup: false
22830
+ };
22831
+ function Builder(options) {
22832
+ this.options = Object.assign({}, defaultOptions, options);
22833
+ if (this.options.ignoreAttributes || this.options.attributesGroupName) {
22834
+ this.isAttribute = function /*a*/
22835
+ () {
22836
+ return false;
22837
+ };
22838
+ } else {
22839
+ this.attrPrefixLen = this.options.attributeNamePrefix.length;
22840
+ this.isAttribute = isAttribute;
22841
+ }
22842
+ this.processTextOrObjNode = processTextOrObjNode;
22843
+ if (this.options.format) {
22844
+ this.indentate = indentate;
22845
+ this.tagEndChar = '>\n';
22846
+ this.newLine = '\n';
22847
+ } else {
22848
+ this.indentate = function () {
22849
+ return '';
22850
+ };
22851
+ this.tagEndChar = '>';
22852
+ this.newLine = '';
22853
+ }
22854
+ }
22855
+ Builder.prototype.build = function (jObj) {
22856
+ if (this.options.preserveOrder) {
22857
+ return buildFromOrderedJs(jObj, this.options);
22858
+ } else {
22859
+ if (Array.isArray(jObj) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1) {
22860
+ jObj = _defineProperty({}, this.options.arrayNodeName, jObj);
22861
+ }
22862
+ return this.j2x(jObj, 0).val;
22863
+ }
22864
+ };
22865
+ Builder.prototype.j2x = function (jObj, level) {
22866
+ var attrStr = '';
22867
+ var val = '';
22868
+ for (var key in jObj) {
22869
+ if (typeof jObj[key] === 'undefined') {
22870
+ // supress undefined node only if it is not an attribute
22871
+ if (this.isAttribute(key)) {
22872
+ val += '';
22873
+ }
22874
+ } else if (jObj[key] === null) {
22875
+ // null attribute should be ignored by the attribute list, but should not cause the tag closing
22876
+ if (this.isAttribute(key)) {
22877
+ val += '';
22878
+ } else if (key[0] === '?') {
22879
+ val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;
22880
+ } else {
22881
+ val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
22882
+ }
22883
+ // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
22884
+ } else if (jObj[key] instanceof Date) {
22885
+ val += this.buildTextValNode(jObj[key], key, '', level);
22886
+ } else if (_typeof(jObj[key]) !== 'object') {
22887
+ //premitive type
22888
+ var attr = this.isAttribute(key);
22889
+ if (attr) {
22890
+ attrStr += this.buildAttrPairStr(attr, '' + jObj[key]);
22891
+ } else {
22892
+ //tag value
22893
+ if (key === this.options.textNodeName) {
22894
+ var newval = this.options.tagValueProcessor(key, '' + jObj[key]);
22895
+ val += this.replaceEntitiesValue(newval);
22896
+ } else {
22897
+ val += this.buildTextValNode(jObj[key], key, '', level);
22898
+ }
22899
+ }
22900
+ } else if (Array.isArray(jObj[key])) {
22901
+ //repeated nodes
22902
+ var arrLen = jObj[key].length;
22903
+ var listTagVal = "";
22904
+ for (var j = 0; j < arrLen; j++) {
22905
+ var item = jObj[key][j];
22906
+ if (typeof item === 'undefined') ; else if (item === null) {
22907
+ if (key[0] === "?") val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;else val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
22908
+ // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
22909
+ } else if (_typeof(item) === 'object') {
22910
+ if (this.options.oneListGroup) {
22911
+ listTagVal += this.j2x(item, level + 1).val;
22912
+ } else {
22913
+ listTagVal += this.processTextOrObjNode(item, key, level);
22914
+ }
22915
+ } else {
22916
+ listTagVal += this.buildTextValNode(item, key, '', level);
22917
+ }
22918
+ }
22919
+ if (this.options.oneListGroup) {
22920
+ listTagVal = this.buildObjectNode(listTagVal, key, '', level);
22921
+ }
22922
+ val += listTagVal;
22923
+ } else {
22924
+ //nested node
22925
+ if (this.options.attributesGroupName && key === this.options.attributesGroupName) {
22926
+ var Ks = Object.keys(jObj[key]);
22927
+ var L = Ks.length;
22928
+ for (var _j = 0; _j < L; _j++) {
22929
+ attrStr += this.buildAttrPairStr(Ks[_j], '' + jObj[key][Ks[_j]]);
22930
+ }
22931
+ } else {
22932
+ val += this.processTextOrObjNode(jObj[key], key, level);
22933
+ }
22934
+ }
22935
+ }
22936
+ return {
22937
+ attrStr: attrStr,
22938
+ val: val
22939
+ };
22940
+ };
22941
+ Builder.prototype.buildAttrPairStr = function (attrName, val) {
22942
+ val = this.options.attributeValueProcessor(attrName, '' + val);
22943
+ val = this.replaceEntitiesValue(val);
22944
+ if (this.options.suppressBooleanAttributes && val === "true") {
22945
+ return ' ' + attrName;
22946
+ } else return ' ' + attrName + '="' + val + '"';
22947
+ };
22948
+ function processTextOrObjNode(object, key, level) {
22949
+ var result = this.j2x(object, level + 1);
22950
+ if (object[this.options.textNodeName] !== undefined && Object.keys(object).length === 1) {
22951
+ return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level);
22952
+ } else {
22953
+ return this.buildObjectNode(result.val, key, result.attrStr, level);
22954
+ }
22955
+ }
22956
+ Builder.prototype.buildObjectNode = function (val, key, attrStr, level) {
22957
+ if (val === "") {
22958
+ if (key[0] === "?") return this.indentate(level) + '<' + key + attrStr + '?' + this.tagEndChar;else {
22959
+ return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;
22960
+ }
22961
+ } else {
22962
+ var tagEndExp = '</' + key + this.tagEndChar;
22963
+ var piClosingChar = "";
22964
+ if (key[0] === "?") {
22965
+ piClosingChar = "?";
22966
+ tagEndExp = "";
22967
+ }
22968
+
22969
+ // attrStr is an empty string in case the attribute came as undefined or null
22970
+ if ((attrStr || attrStr === '') && val.indexOf('<') === -1) {
22971
+ return this.indentate(level) + '<' + key + attrStr + piClosingChar + '>' + val + tagEndExp;
22972
+ } else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) {
22973
+ return this.indentate(level) + "<!--".concat(val, "-->") + this.newLine;
22974
+ } else {
22975
+ return this.indentate(level) + '<' + key + attrStr + piClosingChar + this.tagEndChar + val + this.indentate(level) + tagEndExp;
22976
+ }
22977
+ }
22978
+ };
22979
+ Builder.prototype.closeTag = function (key) {
22980
+ var closeTag = "";
22981
+ if (this.options.unpairedTags.indexOf(key) !== -1) {
22982
+ //unpaired
22983
+ if (!this.options.suppressUnpairedNode) closeTag = "/";
22984
+ } else if (this.options.suppressEmptyNode) {
22985
+ //empty
22986
+ closeTag = "/";
22987
+ } else {
22988
+ closeTag = "></".concat(key);
22989
+ }
22990
+ return closeTag;
22991
+ };
22992
+
22993
+ Builder.prototype.buildTextValNode = function (val, key, attrStr, level) {
22994
+ if (this.options.cdataPropName !== false && key === this.options.cdataPropName) {
22995
+ return this.indentate(level) + "<![CDATA[".concat(val, "]]>") + this.newLine;
22996
+ } else if (this.options.commentPropName !== false && key === this.options.commentPropName) {
22997
+ return this.indentate(level) + "<!--".concat(val, "-->") + this.newLine;
22998
+ } else if (key[0] === "?") {
22999
+ //PI tag
23000
+ return this.indentate(level) + '<' + key + attrStr + '?' + this.tagEndChar;
23001
+ } else {
23002
+ var textValue = this.options.tagValueProcessor(key, val);
23003
+ textValue = this.replaceEntitiesValue(textValue);
23004
+ if (textValue === '') {
23005
+ return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;
23006
+ } else {
23007
+ return this.indentate(level) + '<' + key + attrStr + '>' + textValue + '</' + key + this.tagEndChar;
23008
+ }
23009
+ }
23010
+ };
23011
+ Builder.prototype.replaceEntitiesValue = function (textValue) {
23012
+ if (textValue && textValue.length > 0 && this.options.processEntities) {
23013
+ for (var i = 0; i < this.options.entities.length; i++) {
23014
+ var entity = this.options.entities[i];
23015
+ textValue = textValue.replace(entity.regex, entity.val);
23016
+ }
23017
+ }
23018
+ return textValue;
23019
+ };
23020
+ function indentate(level) {
23021
+ return this.options.indentBy.repeat(level);
23022
+ }
23023
+ function isAttribute(name /*, options*/) {
23024
+ if (name.startsWith(this.options.attributeNamePrefix) && name !== this.options.textNodeName) {
23025
+ return name.substr(this.attrPrefixLen);
23026
+ } else {
23027
+ return false;
23028
+ }
23029
+ }
23030
+ var json2xml = Builder;
23031
+
23032
+ var validator = validator$2;
23033
+ var XMLParser = XMLParser_1;
23034
+ var XMLBuilder = json2xml;
23035
+ var fxp = {
23036
+ XMLParser: XMLParser,
23037
+ XMLValidator: validator,
23038
+ XMLBuilder: XMLBuilder
23039
+ };
23040
+
20694
23041
  const SYMBOL_UPDATE_TAG_KEY = ['symbolType', 'size', ...GRAPHIC_UPDATE_TAG_KEY];
20695
23042
  let Symbol$1 = class Symbol extends Graphic {
20696
23043
  constructor(params = { symbolType: 'circle' }) {
@@ -20725,6 +23072,43 @@
20725
23072
  this._parsedPath = path;
20726
23073
  return path;
20727
23074
  }
23075
+ const isSvg = fxp.XMLValidator.validate(symbolType, {
23076
+ allowBooleanAttributes: true
23077
+ });
23078
+ if (isSvg === true) {
23079
+ const parser = new fxp.XMLParser({ ignoreAttributes: false });
23080
+ const { svg } = parser.parse(symbolType);
23081
+ if (!svg) {
23082
+ return null;
23083
+ }
23084
+ const path = isArray(svg.path) ? svg.path : [svg.path];
23085
+ const b = new AABBBounds();
23086
+ const cacheList = [];
23087
+ path.forEach((item) => {
23088
+ const cache = new CustomPath2D().fromString(item['@_d']);
23089
+ const attribute = {
23090
+ fill: 'black'
23091
+ };
23092
+ SVG_PARSE_ATTRIBUTE_MAP_KEYS.forEach(k => {
23093
+ if (item[k]) {
23094
+ attribute[SVG_PARSE_ATTRIBUTE_MAP[k]] = item[k];
23095
+ }
23096
+ });
23097
+ cacheList.push({
23098
+ path: cache,
23099
+ attribute
23100
+ });
23101
+ b.union(cache.bounds);
23102
+ });
23103
+ const width = b.width();
23104
+ const height = b.height();
23105
+ const maxWH = max(width, height);
23106
+ const scale = 1 / maxWH;
23107
+ cacheList.forEach(cache => cache.path.transform(0, 0, scale, scale));
23108
+ this._parsedPath = new CustomSymbolClass(symbolType, cacheList, true);
23109
+ Symbol.userSymbolMap[symbolType] = this._parsedPath;
23110
+ return this._parsedPath;
23111
+ }
20728
23112
  const cache = new CustomPath2D().fromString(symbolType);
20729
23113
  const width = cache.bounds.width();
20730
23114
  const height = cache.bounds.height();
@@ -20784,7 +23168,7 @@
20784
23168
  : new CustomPath2D().fromString(symbolInstance.pathStr, x, y, formattedSize[0], formattedSize[1]);
20785
23169
  }
20786
23170
  clone() {
20787
- return new Symbol(Object.assign({}, this.attribute));
23171
+ return new Symbol({ ...this.attribute });
20788
23172
  }
20789
23173
  };
20790
23174
  Symbol$1.userSymbolMap = {};
@@ -20890,7 +23274,7 @@
20890
23274
  return path;
20891
23275
  }
20892
23276
  clone() {
20893
- return new Line(Object.assign({}, this.attribute));
23277
+ return new Line({ ...this.attribute });
20894
23278
  }
20895
23279
  };
20896
23280
 
@@ -20958,7 +23342,7 @@
20958
23342
  return path;
20959
23343
  }
20960
23344
  clone() {
20961
- return new Rect(Object.assign({}, this.attribute));
23345
+ return new Rect({ ...this.attribute });
20962
23346
  }
20963
23347
  }
20964
23348
 
@@ -21170,7 +23554,7 @@
21170
23554
  this.currentStates = [];
21171
23555
  }
21172
23556
  clone() {
21173
- const glyph = new Glyph(Object.assign({}, this.attribute));
23557
+ const glyph = new Glyph({ ...this.attribute });
21174
23558
  glyph.setSubGraphic(this.subGraphic.map(g => g.clone()));
21175
23559
  return glyph;
21176
23560
  }
@@ -21724,7 +24108,7 @@
21724
24108
  return false;
21725
24109
  }
21726
24110
  clone() {
21727
- return new Image(Object.assign({}, this.attribute));
24111
+ return new Image({ ...this.attribute });
21728
24112
  }
21729
24113
  }
21730
24114
 
@@ -22282,7 +24666,7 @@
22282
24666
  this._frameCache = frame;
22283
24667
  }
22284
24668
  clone() {
22285
- return new RichText(Object.assign({}, this.attribute));
24669
+ return new RichText({ ...this.attribute });
22286
24670
  }
22287
24671
  setStage(stage, layer) {
22288
24672
  super.setStage(stage, layer);
@@ -22426,7 +24810,7 @@
22426
24810
  return new CustomPath2D().fromCustomPath2D(this.getParsedPathShape(), x, y);
22427
24811
  }
22428
24812
  clone() {
22429
- return new Path(Object.assign({}, this.attribute));
24813
+ return new Path({ ...this.attribute });
22430
24814
  }
22431
24815
  }
22432
24816
 
@@ -22540,7 +24924,7 @@
22540
24924
  return path;
22541
24925
  }
22542
24926
  clone() {
22543
- return new Area(Object.assign({}, this.attribute));
24927
+ return new Area({ ...this.attribute });
22544
24928
  }
22545
24929
  }
22546
24930
 
@@ -22742,7 +25126,7 @@
22742
25126
  return path;
22743
25127
  }
22744
25128
  clone() {
22745
- return new Arc(Object.assign({}, this.attribute));
25129
+ return new Arc({ ...this.attribute });
22746
25130
  }
22747
25131
  }
22748
25132
 
@@ -22839,7 +25223,7 @@
22839
25223
  return path;
22840
25224
  }
22841
25225
  clone() {
22842
- return new Polygon(Object.assign({}, this.attribute));
25226
+ return new Polygon({ ...this.attribute });
22843
25227
  }
22844
25228
  }
22845
25229
 
@@ -25762,13 +28146,51 @@
25762
28146
  const p = context.project(x, y, z);
25763
28147
  const camera = context.camera;
25764
28148
  context.camera = null;
25765
- if (parsedPath.draw(context, size, p.x, p.y) === false) {
28149
+ if (parsedPath.draw(context, size, p.x, p.y, undefined, (p, a) => {
28150
+ if (a.fill) {
28151
+ if (fillCb) {
28152
+ fillCb(context, symbol.attribute, symbolAttribute);
28153
+ }
28154
+ else {
28155
+ context.setCommonStyle(symbol, a, originX - x, originY - y);
28156
+ context.fill();
28157
+ }
28158
+ }
28159
+ if (a.stroke) {
28160
+ if (strokeCb) {
28161
+ strokeCb(context, symbol.attribute, symbolAttribute);
28162
+ }
28163
+ else {
28164
+ context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY);
28165
+ context.stroke();
28166
+ }
28167
+ }
28168
+ }) === false) {
25766
28169
  context.closePath();
25767
28170
  }
25768
28171
  context.camera = camera;
25769
28172
  }
25770
28173
  else {
25771
- if (parsedPath.draw(context, size, x, y, z) === false) {
28174
+ if (parsedPath.draw(context, size, x, y, z, (p, a) => {
28175
+ if (a.fill) {
28176
+ if (fillCb) {
28177
+ fillCb(context, symbol.attribute, symbolAttribute);
28178
+ }
28179
+ else {
28180
+ context.setCommonStyle(symbol, a, originX - x, originY - y);
28181
+ context.fill();
28182
+ }
28183
+ }
28184
+ if (a.stroke) {
28185
+ if (strokeCb) {
28186
+ strokeCb(context, symbol.attribute, symbolAttribute);
28187
+ }
28188
+ else {
28189
+ context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY);
28190
+ context.stroke();
28191
+ }
28192
+ }
28193
+ }) === false) {
25772
28194
  context.closePath();
25773
28195
  }
25774
28196
  }
@@ -25782,7 +28204,7 @@
25782
28204
  }
25783
28205
  });
25784
28206
  context.setShadowStyle && context.setShadowStyle(symbol, symbol.attribute, symbolAttribute);
25785
- if (doFill) {
28207
+ if (doFill && !parsedPath.isSvg) {
25786
28208
  if (fillCb) {
25787
28209
  fillCb(context, symbol.attribute, symbolAttribute);
25788
28210
  }
@@ -25791,7 +28213,7 @@
25791
28213
  context.fill();
25792
28214
  }
25793
28215
  }
25794
- if (doStroke) {
28216
+ if (doStroke && !parsedPath.isSvg) {
25795
28217
  if (strokeCb) {
25796
28218
  strokeCb(context, symbol.attribute, symbolAttribute);
25797
28219
  }
@@ -26548,7 +28970,10 @@
26548
28970
  }
26549
28971
  allocate(data) {
26550
28972
  if (!this.pools.length) {
26551
- return wrapCanvas(Object.assign({ nativeCanvas: application.global.createCanvas(data) }, data));
28973
+ return wrapCanvas({
28974
+ nativeCanvas: application.global.createCanvas(data),
28975
+ ...data
28976
+ });
26552
28977
  }
26553
28978
  const m = this.pools.pop();
26554
28979
  m.resize(data.width, data.height);
@@ -26562,7 +28987,10 @@
26562
28987
  height: canvas.height / canvas.dpr,
26563
28988
  dpr: canvas.dpr
26564
28989
  };
26565
- return wrapCanvas(Object.assign({ nativeCanvas: application.global.createCanvas(data) }, data));
28990
+ return wrapCanvas({
28991
+ nativeCanvas: application.global.createCanvas(data),
28992
+ ...data
28993
+ });
26566
28994
  }
26567
28995
  const m = this.pools.pop();
26568
28996
  m.width = canvas.width;
@@ -27268,9 +29696,10 @@
27268
29696
  return;
27269
29697
  }
27270
29698
  draw(params) {
27271
- this.drawContribution.draw(this, Object.assign({}, this.drawParams));
29699
+ this.drawContribution.draw(this, { ...this.drawParams });
27272
29700
  }
27273
29701
  afterDraw(params) {
29702
+ this.drawContribution.afterDraw && this.drawContribution.afterDraw(this, { ...this.drawParams });
27274
29703
  return;
27275
29704
  }
27276
29705
  render(groups, params) {
@@ -27353,10 +29782,8 @@
27353
29782
  graphic.forEachChildren(cb, reverse);
27354
29783
  }
27355
29784
  }
27356
- function foreachAsync(graphic, defaultZIndex, cb, reverse = false) {
27357
- return __awaiter(this, void 0, void 0, function* () {
27358
- yield graphic.forEachChildrenAsync(cb, reverse);
27359
- });
29785
+ async function foreachAsync(graphic, defaultZIndex, cb, reverse = false) {
29786
+ await graphic.forEachChildrenAsync(cb, reverse);
27360
29787
  }
27361
29788
  function findNextGraphic(graphic, id, defaultZIndex, reverse = false) {
27362
29789
  const childMap = {};
@@ -27534,10 +29961,10 @@
27534
29961
  result = pickerService.pickGroup(graphic, point, params.parentMatrix, pickParams);
27535
29962
  }
27536
29963
  context.camera = null;
27537
- context.restore();
27538
29964
  pickParams.in3dInterceptor = false;
27539
29965
  return result;
27540
29966
  }
29967
+ context.restore();
27541
29968
  return null;
27542
29969
  }
27543
29970
  initCanvasCtx(context) {
@@ -27964,12 +30391,12 @@
27964
30391
  }
27965
30392
  class OrthoCamera {
27966
30393
  set params(params) {
27967
- this._params = Object.assign({}, params);
30394
+ this._params = { ...params };
27968
30395
  this._projectionMatrixCached = this.forceGetProjectionMatrix();
27969
30396
  this._viewMatrixCached = this.forceGetViewMatrix();
27970
30397
  }
27971
30398
  get params() {
27972
- return Object.assign({}, this._params);
30399
+ return { ...this._params };
27973
30400
  }
27974
30401
  constructor(params) {
27975
30402
  this.params = params;
@@ -28183,9 +30610,9 @@
28183
30610
  }
28184
30611
  }
28185
30612
  constructor(canvas, dpr) {
28186
- this.fillAttributes = Object.assign(Object.assign({}, DefaultFillStyle), { opacity: 1 });
28187
- this.strokeAttributes = Object.assign(Object.assign({}, DefaultStrokeStyle), { opacity: 1 });
28188
- this.textAttributes = Object.assign(Object.assign({}, DefaultTextStyle), { opacity: 1 });
30613
+ this.fillAttributes = { ...DefaultFillStyle, opacity: 1 };
30614
+ this.strokeAttributes = { ...DefaultStrokeStyle, opacity: 1 };
30615
+ this.textAttributes = { ...DefaultTextStyle, opacity: 1 };
28189
30616
  this._clearShadowStyle = false;
28190
30617
  this._clearFilterStyle = false;
28191
30618
  const context = canvas.nativeCanvas.getContext('2d');
@@ -29520,6 +31947,15 @@
29520
31947
  service.setActiveEnvContribution(this);
29521
31948
  }
29522
31949
  }
31950
+ getNativeAABBBounds(dom) {
31951
+ return new AABBBounds();
31952
+ }
31953
+ removeDom(dom) {
31954
+ return false;
31955
+ }
31956
+ createDom(params) {
31957
+ return null;
31958
+ }
29523
31959
  getDynamicCanvasCount() {
29524
31960
  return 999;
29525
31961
  }
@@ -29586,6 +32022,29 @@
29586
32022
  injectable()
29587
32023
  ], exports.BaseEnvContribution);
29588
32024
 
32025
+ class DynamicB {
32026
+ get x1() {
32027
+ return this.dom.getBoundingClientRect().left;
32028
+ }
32029
+ get x2() {
32030
+ return this.dom.getBoundingClientRect().right;
32031
+ }
32032
+ get y1() {
32033
+ return this.dom.getBoundingClientRect().top;
32034
+ }
32035
+ get y2() {
32036
+ return this.dom.getBoundingClientRect().bottom;
32037
+ }
32038
+ get width() {
32039
+ return this.dom.getBoundingClientRect().width;
32040
+ }
32041
+ get height() {
32042
+ return this.dom.getBoundingClientRect().height;
32043
+ }
32044
+ constructor(dom) {
32045
+ this.dom = dom;
32046
+ }
32047
+ }
29589
32048
  function createImageElement$1(src, isSvg = false) {
29590
32049
  const img = document.createElement('img');
29591
32050
  img.crossOrigin = 'anonymous';
@@ -29646,6 +32105,48 @@
29646
32105
  y: nativeEvent.offsetY
29647
32106
  };
29648
32107
  }
32108
+ getNativeAABBBounds(_dom) {
32109
+ let dom = _dom;
32110
+ if (typeof _dom === 'string') {
32111
+ dom = new DOMParser().parseFromString(_dom, 'text/xml').firstChild;
32112
+ }
32113
+ if (dom.getBoundingClientRect) {
32114
+ const b = dom.getBoundingClientRect();
32115
+ return new DynamicB(b);
32116
+ }
32117
+ return new AABBBounds();
32118
+ }
32119
+ removeDom(dom) {
32120
+ dom.parentElement.removeChild(dom);
32121
+ return true;
32122
+ }
32123
+ createDom(params) {
32124
+ const { tagName = 'div', width, height, style, parent } = params;
32125
+ const element = document.createElement(tagName);
32126
+ if (style) {
32127
+ if (isString(style)) {
32128
+ element.setAttribute('style', style);
32129
+ }
32130
+ else {
32131
+ Object.keys(style).forEach(k => {
32132
+ element.setAttribute(k, style[k]);
32133
+ });
32134
+ }
32135
+ }
32136
+ if (width != null) {
32137
+ element.style.width = `${width}px`;
32138
+ }
32139
+ if (height != null) {
32140
+ element.style.height = `${height}px`;
32141
+ }
32142
+ if (parent) {
32143
+ const pd = isString(parent) ? this.getElementById(parent) : parent;
32144
+ if (pd && pd.appendChild) {
32145
+ pd.appendChild(element);
32146
+ }
32147
+ }
32148
+ return element;
32149
+ }
29649
32150
  loadImage(url) {
29650
32151
  const imagePromise = createImageElement$1(url, false);
29651
32152
  return imagePromise
@@ -30316,30 +32817,28 @@
30316
32817
  injectable()
30317
32818
  ], NodeEnvContribution);
30318
32819
 
30319
- function makeUpCanvas(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList) {
30320
- return __awaiter(this, void 0, void 0, function* () {
30321
- const dpr = wx.getSystemInfoSync().pixelRatio;
30322
- for (let i = 0; i < canvasIdLists.length; i++) {
30323
- const id = canvasIdLists[i];
30324
- yield new Promise(resolve => {
30325
- wx.createSelectorQuery()
30326
- .select(`#${id}`)
30327
- .fields({ node: true, size: true })
30328
- .exec((res) => {
30329
- const canvas = res[0].node;
30330
- const width = res[0].width;
30331
- const height = res[0].height;
30332
- canvas.width = width * dpr;
30333
- canvas.height = height * dpr;
30334
- canvasMap.set(id, canvas);
30335
- if (i >= freeCanvasIdx) {
30336
- freeCanvasList.push(canvas);
30337
- }
30338
- resolve(null);
30339
- });
32820
+ async function makeUpCanvas(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList) {
32821
+ const dpr = wx.getSystemInfoSync().pixelRatio;
32822
+ for (let i = 0; i < canvasIdLists.length; i++) {
32823
+ const id = canvasIdLists[i];
32824
+ await new Promise(resolve => {
32825
+ wx.createSelectorQuery()
32826
+ .select(`#${id}`)
32827
+ .fields({ node: true, size: true })
32828
+ .exec((res) => {
32829
+ const canvas = res[0].node;
32830
+ const width = res[0].width;
32831
+ const height = res[0].height;
32832
+ canvas.width = width * dpr;
32833
+ canvas.height = height * dpr;
32834
+ canvasMap.set(id, canvas);
32835
+ if (i >= freeCanvasIdx) {
32836
+ freeCanvasList.push(canvas);
32837
+ }
32838
+ resolve(null);
30340
32839
  });
30341
- }
30342
- });
32840
+ });
32841
+ }
30343
32842
  }
30344
32843
  let WxEnvContribution = class WxEnvContribution extends exports.BaseEnvContribution {
30345
32844
  constructor() {
@@ -31335,14 +33834,22 @@
31335
33834
  }
31336
33835
  if (event.changedTouches.length > 0) {
31337
33836
  event.changedTouches.forEach((d, i) => {
31338
- event.changedTouches[i] = Object.assign(Object.assign({}, event.changedTouches[i]), { offsetX: d.x, offsetY: d.y });
33837
+ event.changedTouches[i] = {
33838
+ ...event.changedTouches[i],
33839
+ offsetX: d.x,
33840
+ offsetY: d.y
33841
+ };
31339
33842
  });
31340
33843
  event.offsetX = event.changedTouches[0].offsetX;
31341
33844
  event.offsetY = event.changedTouches[0].offsetY;
31342
33845
  }
31343
33846
  if (event.touches.length > 0) {
31344
33847
  event.touches.forEach((d, i) => {
31345
- event.touches[i] = Object.assign(Object.assign({}, event.touches[i]), { offsetX: d.x, offsetY: d.y });
33848
+ event.touches[i] = {
33849
+ ...event.touches[i],
33850
+ offsetX: d.x,
33851
+ offsetY: d.y
33852
+ };
31346
33853
  });
31347
33854
  }
31348
33855
  event.preventDefault = () => {
@@ -32436,7 +34943,12 @@
32436
34943
  this.canvas.applyPosition();
32437
34944
  }
32438
34945
  }
32439
- params.renderService.render(group, Object.assign(Object.assign({ context: this.context, clear: (_a = params.background) !== null && _a !== void 0 ? _a : '#ffffff' }, params), userParams));
34946
+ params.renderService.render(group, {
34947
+ context: this.context,
34948
+ clear: (_a = params.background) !== null && _a !== void 0 ? _a : '#ffffff',
34949
+ ...params,
34950
+ ...userParams
34951
+ });
32440
34952
  }
32441
34953
  merge(layerHandlers) {
32442
34954
  layerHandlers.forEach(l => {
@@ -32451,7 +34963,11 @@
32451
34963
  drawTo(target, group, params) {
32452
34964
  var _a;
32453
34965
  const context = target.getContext();
32454
- params.renderService.render(group, Object.assign(Object.assign({ context }, params), { clear: params.clear ? (_a = params.background) !== null && _a !== void 0 ? _a : '#fff' : undefined }));
34966
+ params.renderService.render(group, {
34967
+ context,
34968
+ ...params,
34969
+ clear: params.clear ? (_a = params.background) !== null && _a !== void 0 ? _a : '#fff' : undefined
34970
+ });
32455
34971
  return;
32456
34972
  }
32457
34973
  getContext() {
@@ -32499,7 +35015,13 @@
32499
35015
  }
32500
35016
  render(group, params) {
32501
35017
  var _a;
32502
- params.renderService.render(group, Object.assign(Object.assign({ context: this.context }, params), { x: 0, y: 0, clear: (_a = params.background) !== null && _a !== void 0 ? _a : '#ffffff' }));
35018
+ params.renderService.render(group, {
35019
+ context: this.context,
35020
+ ...params,
35021
+ x: 0,
35022
+ y: 0,
35023
+ clear: (_a = params.background) !== null && _a !== void 0 ? _a : '#ffffff'
35024
+ });
32503
35025
  }
32504
35026
  prepare(dirtyBounds, params) {
32505
35027
  return;
@@ -32870,7 +35392,15 @@
32870
35392
  const idc = incrementalLayer.drawContribution || container.get(IncrementalDrawContribution);
32871
35393
  idc.dirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);
32872
35394
  idc.backupDirtyBounds.setValue(-Infinity, -Infinity, Infinity, Infinity);
32873
- idc.draw(this.currentRenderService, Object.assign(Object.assign({}, drawContext), { drawContribution: idc, clear: 'transparent', layer: incrementalLayer.layer, context: incrementalContext, startAtId: group._uid, break: false }));
35395
+ idc.draw(this.currentRenderService, {
35396
+ ...drawContext,
35397
+ drawContribution: idc,
35398
+ clear: 'transparent',
35399
+ layer: incrementalLayer.layer,
35400
+ context: incrementalContext,
35401
+ startAtId: group._uid,
35402
+ break: false
35403
+ });
32874
35404
  incrementalLayer.drawContribution = idc;
32875
35405
  const nextGraphic = this._findNextGraphic(group);
32876
35406
  if (nextGraphic) {
@@ -32887,7 +35417,15 @@
32887
35417
  subLayers.set(nextGraphic._uid, afterLayer);
32888
35418
  }
32889
35419
  const afterContext = afterLayer.layer.getNativeHandler().getContext();
32890
- this.draw(this.currentRenderService, Object.assign(Object.assign({}, drawContext), { drawContribution: idc, clear: 'transparent', layer: afterLayer.layer, context: afterContext, startAtId: nextGraphic._uid, break: false }));
35420
+ this.draw(this.currentRenderService, {
35421
+ ...drawContext,
35422
+ drawContribution: idc,
35423
+ clear: 'transparent',
35424
+ layer: afterLayer.layer,
35425
+ context: afterContext,
35426
+ startAtId: nextGraphic._uid,
35427
+ break: false
35428
+ });
32891
35429
  }
32892
35430
  }
32893
35431
  }
@@ -32962,7 +35500,14 @@
32962
35500
  context.fillRect(x, y, width, height);
32963
35501
  }
32964
35502
  }
35503
+ afterDraw(renderService, drawParams) {
35504
+ return;
35505
+ }
32965
35506
  };
35507
+ __decorate([
35508
+ inject(VGlobal),
35509
+ __metadata("design:type", Object)
35510
+ ], DefaultDrawContribution.prototype, "global", void 0);
32966
35511
  __decorate([
32967
35512
  postConstruct(),
32968
35513
  __metadata("design:type", Function),
@@ -33282,178 +35827,164 @@
33282
35827
  this.defaultRenderMap.set(this.lineRender.numberType, this.lineRender);
33283
35828
  this.defaultRenderMap.set(this.areaRender.numberType, this.areaRender);
33284
35829
  }
33285
- draw(renderService, drawContext) {
33286
- return __awaiter(this, void 0, void 0, function* () {
33287
- if (this.checkingForDrawPromise) {
33288
- return;
33289
- }
33290
- this.lastRenderService = renderService;
33291
- this.lastDrawContext = drawContext;
33292
- this.checkingForDrawPromise = this.checkForDraw(drawContext);
33293
- const skipDraw = yield this.checkingForDrawPromise;
33294
- this.checkingForDrawPromise = null;
33295
- if (skipDraw) {
33296
- return;
33297
- }
33298
- this.currentRenderService = renderService;
33299
- const { context, x = 0, y = 0 } = drawContext;
33300
- if (!context) {
33301
- return;
33302
- }
33303
- context.inuse = true;
33304
- context.clearMatrix();
33305
- context.setTransformForCurrent(true);
33306
- context.save();
33307
- drawContext.restartIncremental && this.clearScreen(this.currentRenderService, context, drawContext);
33308
- context.translate(x, y, true);
33309
- context.save();
33310
- renderService.renderTreeRoots
33311
- .sort((a, b) => {
33312
- var _a, _b;
33313
- return ((_a = a.attribute.zIndex) !== null && _a !== void 0 ? _a : DefaultAttribute.zIndex) - ((_b = b.attribute.zIndex) !== null && _b !== void 0 ? _b : DefaultAttribute.zIndex);
33314
- })
33315
- .forEach(group => {
33316
- this.renderGroup(group, drawContext);
33317
- });
33318
- this.hooks.completeDraw.tap('top-draw', () => {
33319
- context.restore();
33320
- context.restore();
33321
- context.draw();
33322
- context.inuse = false;
33323
- this.rendering = false;
33324
- });
33325
- });
33326
- }
33327
- _increaseRender(group, drawContext) {
33328
- return __awaiter(this, void 0, void 0, function* () {
33329
- this.rendering = true;
33330
- yield this._renderIncrementalGroup(group, drawContext);
35830
+ async draw(renderService, drawContext) {
35831
+ if (this.checkingForDrawPromise) {
35832
+ return;
35833
+ }
35834
+ this.lastRenderService = renderService;
35835
+ this.lastDrawContext = drawContext;
35836
+ this.checkingForDrawPromise = this.checkForDraw(drawContext);
35837
+ const skipDraw = await this.checkingForDrawPromise;
35838
+ this.checkingForDrawPromise = null;
35839
+ if (skipDraw) {
33331
35840
  return;
35841
+ }
35842
+ this.currentRenderService = renderService;
35843
+ const { context, x = 0, y = 0 } = drawContext;
35844
+ if (!context) {
35845
+ return;
35846
+ }
35847
+ context.inuse = true;
35848
+ context.clearMatrix();
35849
+ context.setTransformForCurrent(true);
35850
+ context.save();
35851
+ drawContext.restartIncremental && this.clearScreen(this.currentRenderService, context, drawContext);
35852
+ context.translate(x, y, true);
35853
+ context.save();
35854
+ renderService.renderTreeRoots
35855
+ .sort((a, b) => {
35856
+ var _a, _b;
35857
+ return ((_a = a.attribute.zIndex) !== null && _a !== void 0 ? _a : DefaultAttribute.zIndex) - ((_b = b.attribute.zIndex) !== null && _b !== void 0 ? _b : DefaultAttribute.zIndex);
35858
+ })
35859
+ .forEach(group => {
35860
+ this.renderGroup(group, drawContext);
33332
35861
  });
35862
+ this.hooks.completeDraw.tap('top-draw', () => {
35863
+ context.restore();
35864
+ context.restore();
35865
+ context.draw();
35866
+ context.inuse = false;
35867
+ this.rendering = false;
35868
+ });
35869
+ }
35870
+ async _increaseRender(group, drawContext) {
35871
+ this.rendering = true;
35872
+ await this._renderIncrementalGroup(group, drawContext);
35873
+ return;
33333
35874
  }
33334
- _renderIncrementalGroup(group, drawContext) {
33335
- return __awaiter(this, void 0, void 0, function* () {
33336
- this.count = group.count;
33337
- yield new Promise(resolve => {
33338
- this.renderItem(group, drawContext, {
33339
- drawingCb: () => __awaiter(this, void 0, void 0, function* () {
33340
- if (group.count === 2) {
33341
- const graphic = group.getChildAt(0);
33342
- if (graphic.incremental && graphic.attribute.segments) {
33343
- if (!graphic.incrementalAt) {
33344
- graphic.incrementalAt = 0;
33345
- }
33346
- while (graphic.incrementalAt < graphic.attribute.segments.length) {
33347
- drawContext.multiGraphicOptions = {
33348
- startAtIdx: graphic.incrementalAt,
33349
- length: graphic.incremental
33350
- };
33351
- this.renderItem(graphic, drawContext);
33352
- graphic.incrementalAt += graphic.incremental;
33353
- yield this.waitToNextFrame();
33354
- }
35875
+ async _renderIncrementalGroup(group, drawContext) {
35876
+ this.count = group.count;
35877
+ await new Promise(resolve => {
35878
+ this.renderItem(group, drawContext, {
35879
+ drawingCb: async () => {
35880
+ if (group.count === 2) {
35881
+ const graphic = group.getChildAt(0);
35882
+ if (graphic.incremental && graphic.attribute.segments) {
35883
+ if (!graphic.incrementalAt) {
35884
+ graphic.incrementalAt = 0;
33355
35885
  }
33356
- else {
35886
+ while (graphic.incrementalAt < graphic.attribute.segments.length) {
35887
+ drawContext.multiGraphicOptions = {
35888
+ startAtIdx: graphic.incrementalAt,
35889
+ length: graphic.incremental
35890
+ };
33357
35891
  this.renderItem(graphic, drawContext);
35892
+ graphic.incrementalAt += graphic.incremental;
35893
+ await this.waitToNextFrame();
33358
35894
  }
33359
- resolve(false);
33360
- return;
33361
35895
  }
33362
- yield foreachAsync(group, DefaultAttribute.zIndex, (item, i) => {
33363
- if (this.status === STATUS.STOP) {
33364
- return true;
33365
- }
33366
- if (item.isContainer) {
33367
- return false;
33368
- }
33369
- if (i < this.currentIdx) {
33370
- return false;
33371
- }
33372
- const frameTail = this.currFrameStartAt + group.incremental;
33373
- if (i < frameTail) {
33374
- this.currentIdx = i + 1;
33375
- this.renderItem(item, drawContext);
33376
- }
33377
- if (i === frameTail - 1) {
33378
- this.currFrameStartAt = this.currentIdx;
33379
- return this.waitToNextFrame();
33380
- }
33381
- return false;
33382
- });
35896
+ else {
35897
+ this.renderItem(graphic, drawContext);
35898
+ }
33383
35899
  resolve(false);
33384
- })
33385
- });
35900
+ return;
35901
+ }
35902
+ await foreachAsync(group, DefaultAttribute.zIndex, (item, i) => {
35903
+ if (this.status === STATUS.STOP) {
35904
+ return true;
35905
+ }
35906
+ if (item.isContainer) {
35907
+ return false;
35908
+ }
35909
+ if (i < this.currentIdx) {
35910
+ return false;
35911
+ }
35912
+ const frameTail = this.currFrameStartAt + group.incremental;
35913
+ if (i < frameTail) {
35914
+ this.currentIdx = i + 1;
35915
+ this.renderItem(item, drawContext);
35916
+ }
35917
+ if (i === frameTail - 1) {
35918
+ this.currFrameStartAt = this.currentIdx;
35919
+ return this.waitToNextFrame();
35920
+ }
35921
+ return false;
35922
+ });
35923
+ resolve(false);
35924
+ }
33386
35925
  });
33387
- this.hooks.completeDraw.call();
33388
35926
  });
35927
+ this.hooks.completeDraw.call();
33389
35928
  }
33390
- waitToNextFrame() {
33391
- return __awaiter(this, void 0, void 0, function* () {
33392
- return new Promise(resolve => {
33393
- this.global.getRequestAnimationFrame()(() => {
33394
- resolve(false);
33395
- });
35929
+ async waitToNextFrame() {
35930
+ return new Promise(resolve => {
35931
+ this.global.getRequestAnimationFrame()(() => {
35932
+ resolve(false);
33396
35933
  });
33397
35934
  });
33398
35935
  }
33399
- checkForDraw(drawContext) {
33400
- return __awaiter(this, void 0, void 0, function* () {
33401
- let skip = this.rendering;
33402
- if (drawContext.restartIncremental) {
33403
- skip = false;
33404
- yield this.forceStop();
33405
- this.resetToInit();
33406
- }
33407
- return skip;
33408
- });
35936
+ async checkForDraw(drawContext) {
35937
+ let skip = this.rendering;
35938
+ if (drawContext.restartIncremental) {
35939
+ skip = false;
35940
+ await this.forceStop();
35941
+ this.resetToInit();
35942
+ }
35943
+ return skip;
33409
35944
  }
33410
- forceStop() {
33411
- return __awaiter(this, void 0, void 0, function* () {
33412
- if (this.rendering) {
33413
- this.status = STATUS.STOP;
33414
- yield new Promise(resolve => {
33415
- this.hooks.completeDraw.tap('stopCb', () => {
33416
- this.status = STATUS.NORMAL;
33417
- this.hooks.completeDraw.taps = this.hooks.completeDraw.taps.filter(item => {
33418
- return item.name !== 'stopCb';
33419
- });
33420
- resolve(false);
35945
+ async forceStop() {
35946
+ if (this.rendering) {
35947
+ this.status = STATUS.STOP;
35948
+ await new Promise(resolve => {
35949
+ this.hooks.completeDraw.tap('stopCb', () => {
35950
+ this.status = STATUS.NORMAL;
35951
+ this.hooks.completeDraw.taps = this.hooks.completeDraw.taps.filter(item => {
35952
+ return item.name !== 'stopCb';
33421
35953
  });
35954
+ resolve(false);
33422
35955
  });
33423
- }
33424
- });
35956
+ });
35957
+ }
33425
35958
  }
33426
35959
  resetToInit() {
33427
35960
  this.currFrameStartAt = 0;
33428
35961
  this.currentIdx = 0;
33429
35962
  }
33430
- renderGroup(group, drawContext) {
33431
- return __awaiter(this, void 0, void 0, function* () {
33432
- if (drawContext.break || group.attribute.visibleAll === false) {
33433
- return;
33434
- }
33435
- if (group.incremental && drawContext.startAtId === group._uid) {
33436
- yield this._increaseRender(group, drawContext);
33437
- drawContext.break = true;
33438
- return;
33439
- }
33440
- yield new Promise(resolve => {
33441
- this.renderItem(group, drawContext, {
33442
- drawingCb: () => __awaiter(this, void 0, void 0, function* () {
33443
- yield foreachAsync(group, DefaultAttribute.zIndex, (item) => __awaiter(this, void 0, void 0, function* () {
33444
- if (drawContext.break) {
33445
- return;
33446
- }
33447
- if (item.isContainer) {
33448
- yield this.renderGroup(item, drawContext);
33449
- }
33450
- else {
33451
- return;
33452
- }
33453
- }));
33454
- resolve(false);
33455
- })
33456
- });
35963
+ async renderGroup(group, drawContext) {
35964
+ if (drawContext.break || group.attribute.visibleAll === false) {
35965
+ return;
35966
+ }
35967
+ if (group.incremental && drawContext.startAtId === group._uid) {
35968
+ await this._increaseRender(group, drawContext);
35969
+ drawContext.break = true;
35970
+ return;
35971
+ }
35972
+ await new Promise(resolve => {
35973
+ this.renderItem(group, drawContext, {
35974
+ drawingCb: async () => {
35975
+ await foreachAsync(group, DefaultAttribute.zIndex, async (item) => {
35976
+ if (drawContext.break) {
35977
+ return;
35978
+ }
35979
+ if (item.isContainer) {
35980
+ await this.renderGroup(item, drawContext);
35981
+ }
35982
+ else {
35983
+ return;
35984
+ }
35985
+ });
35986
+ resolve(false);
35987
+ }
33457
35988
  });
33458
35989
  });
33459
35990
  }
@@ -34727,6 +37258,7 @@
34727
37258
  __metadata("design:paramtypes", [Object])
34728
37259
  ], DefaultCanvasPathPicker);
34729
37260
 
37261
+ createRect({});
34730
37262
  let DefaultCanvasSymbolPicker = class DefaultCanvasSymbolPicker extends BasePicker {
34731
37263
  constructor(canvasRenderer) {
34732
37264
  super();
@@ -34739,11 +37271,12 @@
34739
37271
  if (!pickContext) {
34740
37272
  return false;
34741
37273
  }
37274
+ const parsedPath = symbol.getParsedPath();
34742
37275
  if (!pickContext.camera) {
34743
37276
  if (!symbol.AABBBounds.containsPoint(point)) {
34744
37277
  return false;
34745
37278
  }
34746
- if (symbol.attribute.pickMode === 'imprecise') {
37279
+ if (parsedPath.isSvg || symbol.attribute.pickMode === 'imprecise') {
34747
37280
  return true;
34748
37281
  }
34749
37282
  }
@@ -35996,8 +38529,20 @@
35996
38529
  if (!subLayer || !subLayer.drawContribution) {
35997
38530
  return;
35998
38531
  }
35999
- subLayer.drawContribution.draw(stage.renderService, Object.assign({ x: stage.x, y: stage.y, width: layer.viewWidth, height: layer.viewHeight, stage,
36000
- layer, clear: 'transparent', renderService: stage.renderService, updateBounds: false, startAtId: group._uid, context: subLayer.layer.getNativeHandler().getContext() }, this.nextUserParams));
38532
+ subLayer.drawContribution.draw(stage.renderService, {
38533
+ x: stage.x,
38534
+ y: stage.y,
38535
+ width: layer.viewWidth,
38536
+ height: layer.viewHeight,
38537
+ stage,
38538
+ layer,
38539
+ clear: 'transparent',
38540
+ renderService: stage.renderService,
38541
+ updateBounds: false,
38542
+ startAtId: group._uid,
38543
+ context: subLayer.layer.getNativeHandler().getContext(),
38544
+ ...this.nextUserParams
38545
+ });
36001
38546
  });
36002
38547
  this.nextUserParams = {};
36003
38548
  this.nextFrameRenderGroupSet.clear();
@@ -36005,6 +38550,111 @@
36005
38550
  }
36006
38551
  }
36007
38552
 
38553
+ class HtmlAttributePlugin {
38554
+ constructor() {
38555
+ this.name = 'HtmlAttributePlugin';
38556
+ this.activeEvent = 'onRegister';
38557
+ this._uid = Generator.GenAutoIncrementId();
38558
+ this.key = this.name + this._uid;
38559
+ }
38560
+ activate(context) {
38561
+ this.pluginService = context;
38562
+ context.stage.hooks.afterRender.tap(this.key, stage => {
38563
+ if (!(stage && stage === this.pluginService.stage)) {
38564
+ return;
38565
+ }
38566
+ this.drawHTML(context.stage.renderService);
38567
+ });
38568
+ }
38569
+ deactivate(context) {
38570
+ context.stage.hooks.afterRender.taps = context.stage.hooks.afterRender.taps.filter(item => {
38571
+ return item.name !== this.key;
38572
+ });
38573
+ }
38574
+ drawHTML(renderService) {
38575
+ if (application.global.env === 'browser') {
38576
+ renderService.renderTreeRoots
38577
+ .sort((a, b) => {
38578
+ var _a, _b;
38579
+ return ((_a = a.attribute.zIndex) !== null && _a !== void 0 ? _a : DefaultAttribute.zIndex) - ((_b = b.attribute.zIndex) !== null && _b !== void 0 ? _b : DefaultAttribute.zIndex);
38580
+ })
38581
+ .forEach(group => {
38582
+ this.renderGroupHTML(group);
38583
+ });
38584
+ }
38585
+ }
38586
+ renderGroupHTML(group) {
38587
+ this.renderGraphicHTML(group);
38588
+ group.forEachChildren((g) => {
38589
+ this.renderGraphicHTML(g);
38590
+ });
38591
+ }
38592
+ renderGraphicHTML(graphic) {
38593
+ const { html } = graphic.attribute;
38594
+ if (!html) {
38595
+ return;
38596
+ }
38597
+ const stage = graphic.stage;
38598
+ if (!stage) {
38599
+ return;
38600
+ }
38601
+ const { dom, container, width, height, style, anchorType = 'boundsLeftTop' } = html;
38602
+ if (!graphic.bindDom) {
38603
+ graphic.bindDom = new Map();
38604
+ }
38605
+ const lastDom = graphic.bindDom.get(dom);
38606
+ if (lastDom && !(container && container !== lastDom.container)) {
38607
+ return;
38608
+ }
38609
+ graphic.bindDom.forEach(({ wrapGroup }) => {
38610
+ application.global.removeDom(wrapGroup);
38611
+ });
38612
+ let nativeDom;
38613
+ if (typeof dom === 'string') {
38614
+ nativeDom = new DOMParser().parseFromString(dom, 'text/xml').firstChild;
38615
+ }
38616
+ else {
38617
+ nativeDom = dom;
38618
+ }
38619
+ let nativeContainer;
38620
+ const _container = container || (stage.params.enableHtmlAttribute === true ? null : stage.params.enableHtmlAttribute);
38621
+ if (_container) {
38622
+ if (typeof _container === 'string') {
38623
+ nativeContainer = application.global.getElementById(_container);
38624
+ }
38625
+ else {
38626
+ nativeContainer = _container;
38627
+ }
38628
+ }
38629
+ else {
38630
+ nativeContainer = graphic.stage.window.getContainer();
38631
+ }
38632
+ const wrapGroup = application.global.createDom({ tagName: 'div', width, height, style, parent: nativeContainer });
38633
+ if (wrapGroup) {
38634
+ wrapGroup.appendChild(nativeDom);
38635
+ graphic.bindDom.set(dom, { dom: nativeDom, container, wrapGroup: wrapGroup });
38636
+ }
38637
+ wrapGroup.style.pointerEvents = 'none';
38638
+ if (!wrapGroup.style.position) {
38639
+ wrapGroup.style.position = 'absolute';
38640
+ }
38641
+ let left = 0;
38642
+ let top = 0;
38643
+ if (anchorType === 'position') {
38644
+ const matrix = graphic.transMatrix;
38645
+ left = matrix.e;
38646
+ top = matrix.f;
38647
+ }
38648
+ else {
38649
+ const b = graphic.AABBBounds;
38650
+ left = b.x1;
38651
+ top = b.y1;
38652
+ }
38653
+ wrapGroup.style.left = `${left}px`;
38654
+ wrapGroup.style.top = `${top}px`;
38655
+ }
38656
+ }
38657
+
36008
38658
  const globalBounds = new AABBBounds();
36009
38659
  class DirtyBoundsPlugin {
36010
38660
  constructor() {
@@ -36310,8 +38960,8 @@
36310
38960
 
36311
38961
  const defaultTicker = new DefaultTicker();
36312
38962
  defaultTicker.addTimeline(defaultTimeline);
36313
- const TICKER_FPS = 60;
36314
- defaultTicker.setFPS(TICKER_FPS);
38963
+ const DEFAULT_TICKER_FPS = 60;
38964
+ defaultTicker.setFPS(DEFAULT_TICKER_FPS);
36315
38965
 
36316
38966
  class DirectionalLight {
36317
38967
  constructor(dir, color, ambient = 0.8) {
@@ -36420,6 +39070,7 @@
36420
39070
  this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage));
36421
39071
  this._afterNextRenderCbs = null;
36422
39072
  };
39073
+ this.params = params;
36423
39074
  this.theme = new Theme();
36424
39075
  this.hooks = {
36425
39076
  beforeRender: new SyncHook(['stage']),
@@ -36485,6 +39136,9 @@
36485
39136
  if (params.disableDirtyBounds === false) {
36486
39137
  this.enableDirtyBounds();
36487
39138
  }
39139
+ if (params.enableHtmlAttribute) {
39140
+ this.enableHtmlAttribute(params.enableHtmlAttribute);
39141
+ }
36488
39142
  params.enableLayout && this.enableLayout();
36489
39143
  this.hooks.beforeRender.tap('constructor', this.beforeRender);
36490
39144
  this.hooks.afterRender.tap('constructor', this.afterRender);
@@ -36495,13 +39149,16 @@
36495
39149
  }
36496
39150
  get3dOptions(options) {
36497
39151
  const { center = { x: this.width / 2, y: this.height / 2, z: 0, dx: 0, dy: 0, dz: 0 }, light = {}, alpha = 0, beta = 0, camera, fieldRatio = 1, fieldDepth } = options;
36498
- return Object.assign(Object.assign({}, options), { center,
39152
+ return {
39153
+ ...options,
39154
+ center,
36499
39155
  light,
36500
39156
  alpha,
36501
39157
  beta,
36502
39158
  camera,
36503
39159
  fieldRatio,
36504
- fieldDepth });
39160
+ fieldDepth
39161
+ };
36505
39162
  }
36506
39163
  set3dOptions(options) {
36507
39164
  var _a, _b, _c, _d, _e, _f;
@@ -36643,6 +39300,22 @@
36643
39300
  plugin.deactivate(this.pluginService);
36644
39301
  });
36645
39302
  }
39303
+ enableHtmlAttribute(container) {
39304
+ if (this.htmlAttribute) {
39305
+ return;
39306
+ }
39307
+ this.htmlAttribute = container;
39308
+ this.pluginService.register(new HtmlAttributePlugin());
39309
+ }
39310
+ disableHtmlAttribute() {
39311
+ if (!this.htmlAttribute) {
39312
+ return;
39313
+ }
39314
+ this.htmlAttribute = false;
39315
+ this.pluginService.findPluginsByName('HtmlAttributePlugin').forEach(plugin => {
39316
+ plugin.deactivate(this.pluginService);
39317
+ });
39318
+ }
36646
39319
  tryUpdateAABBBounds() {
36647
39320
  const viewBox = this._viewBox;
36648
39321
  this._AABBBounds.setValue(viewBox.x1, viewBox.y1, viewBox.x2, viewBox.y2);
@@ -36688,7 +39361,7 @@
36688
39361
  renderService: this.renderService,
36689
39362
  background: layer === this.defaultLayer ? this.background : undefined,
36690
39363
  updateBounds: !!this.dirtyBounds
36691
- }, Object.assign({ renderStyle: this.renderStyle }, params));
39364
+ }, { renderStyle: this.renderStyle, ...params });
36692
39365
  });
36693
39366
  this.combineLayersToWindow();
36694
39367
  this.nextFrameRenderLayerSet.clear();
@@ -36731,7 +39404,7 @@
36731
39404
  renderService: this.renderService,
36732
39405
  background: layer === this.defaultLayer ? this.background : undefined,
36733
39406
  updateBounds: !!this.dirtyBounds
36734
- }, Object.assign({ renderStyle: this.renderStyle }, (this.lastRenderparams || {})));
39407
+ }, { renderStyle: this.renderStyle, ...(this.lastRenderparams || {}) });
36735
39408
  }
36736
39409
  });
36737
39410
  this.combineLayersToWindow();
@@ -36759,7 +39432,7 @@
36759
39432
  this.forEachChildren(c => {
36760
39433
  c.resizeView(w, h);
36761
39434
  });
36762
- this.camera && (this.camera.params = Object.assign(Object.assign({}, this.camera.params), { right: this.width, bottom: this.height }));
39435
+ this.camera && (this.camera.params = { ...this.camera.params, right: this.width, bottom: this.height });
36763
39436
  rerender && this.render();
36764
39437
  }
36765
39438
  setViewBox(x, y, w, h, rerender) {
@@ -36835,7 +39508,13 @@
36835
39508
  }
36836
39509
  renderTo(window, params) {
36837
39510
  this.forEachChildren((layer, i) => {
36838
- layer.drawTo(window, Object.assign(Object.assign({}, params), { renderService: this.renderService, background: layer === this.defaultLayer ? this.background : undefined, clear: i === 0, updateBounds: !!this.dirtyBounds }));
39511
+ layer.drawTo(window, {
39512
+ ...params,
39513
+ renderService: this.renderService,
39514
+ background: layer === this.defaultLayer ? this.background : undefined,
39515
+ clear: i === 0,
39516
+ updateBounds: !!this.dirtyBounds
39517
+ });
36839
39518
  });
36840
39519
  }
36841
39520
  renderToNewWindow(fullImage = true) {
@@ -36908,7 +39587,137 @@
36908
39587
  'rect'
36909
39588
  ];
36910
39589
 
36911
- const version = "0.14.2";
39590
+ const REACT_TO_CANOPUS_EVENTS = {
39591
+ onPointerDown: 'pointerdown',
39592
+ onPointerUp: 'pointerup',
39593
+ onPointerUpOutside: 'pointerupoutside',
39594
+ onPointerTap: 'pointertap',
39595
+ onPointerOver: 'pointerover',
39596
+ onPointerMove: 'pointermove',
39597
+ onPointerEnter: 'pointerenter',
39598
+ onPointerLeave: 'pointerleave',
39599
+ onPointerOut: 'pointerout',
39600
+ onMouseDown: 'mousedown',
39601
+ onMouseUp: 'mouseup',
39602
+ onMouseUpOutside: 'mouseupoutside',
39603
+ onMouseMove: 'mousemove',
39604
+ onMouseOver: 'mouseover',
39605
+ onMouseOut: 'mouseout',
39606
+ onMouseEnter: 'mouseenter',
39607
+ onMouseLeave: 'mouseleave',
39608
+ onPinch: 'pinch',
39609
+ onPinchStart: 'pinchstart',
39610
+ onPinchEnd: 'pinchend',
39611
+ onPan: 'pan',
39612
+ onPanStart: 'panstart',
39613
+ onPanEnd: 'panend',
39614
+ onDrag: 'drag',
39615
+ onDragStart: 'dragstart',
39616
+ onDragEnter: 'dragenter',
39617
+ onDragLeave: 'dragleave',
39618
+ onDragOver: 'dragover',
39619
+ onDragEnd: 'dragend',
39620
+ onRightDown: 'rightdown',
39621
+ onRightUp: 'rightup',
39622
+ onRightUpOutside: 'rightupoutside',
39623
+ onTouchStart: 'touchstart',
39624
+ onTouchEnd: 'touchend',
39625
+ onTouchEndOutside: 'touchendoutside',
39626
+ onTouchMove: 'touchmove',
39627
+ onTouchCancel: 'touchcancel',
39628
+ onPress: 'press',
39629
+ onPressUp: 'pressup',
39630
+ onPressEnd: 'pressend',
39631
+ onSwipe: 'swipe',
39632
+ onDrop: 'drop',
39633
+ onWeel: 'wheel',
39634
+ onClick: 'click',
39635
+ onDblClick: 'dblclick'
39636
+ };
39637
+ const REACT_TO_CANOPUS_EVENTS_LIST = Object.keys(REACT_TO_CANOPUS_EVENTS);
39638
+ function VArc(params) {
39639
+ return createArc(params ? params.attribute : {});
39640
+ }
39641
+ function VArc3d(params) {
39642
+ return createArc3d(params ? params.attribute : {});
39643
+ }
39644
+ function VArea(params) {
39645
+ return createArea(params ? params.attribute : {});
39646
+ }
39647
+ function VCircle(params) {
39648
+ return createCircle(params ? params.attribute : {});
39649
+ }
39650
+ function VGroup(params) {
39651
+ return createGroup(params ? params.attribute : {});
39652
+ }
39653
+ function VGlyph(params) {
39654
+ return createGlyph(params ? params.attribute : {});
39655
+ }
39656
+ function VImage(params) {
39657
+ return createImage(params ? params.attribute : {});
39658
+ }
39659
+ function VLine(params) {
39660
+ return createLine(params ? params.attribute : {});
39661
+ }
39662
+ function VPath(params) {
39663
+ return createPath(params ? params.attribute : {});
39664
+ }
39665
+ function VPolygon(params) {
39666
+ return createPolygon(params ? params.attribute : {});
39667
+ }
39668
+ function VPyramid3d(params) {
39669
+ return createPyramid3d(params ? params.attribute : {});
39670
+ }
39671
+ function VRect(params) {
39672
+ return createRect(params ? params.attribute : {});
39673
+ }
39674
+ function VRect3d(params) {
39675
+ return createRect3d(params ? params.attribute : {});
39676
+ }
39677
+ function VSymbol(params) {
39678
+ return createSymbol(params ? params.attribute : {});
39679
+ }
39680
+ function VText(params) {
39681
+ return createText(params ? params.attribute : {});
39682
+ }
39683
+
39684
+ function jsx(type, config, ...children) {
39685
+ const { key, attribute, ...props } = config || {};
39686
+ let c = type;
39687
+ if (isString(type)) {
39688
+ c = graphicCreator[type];
39689
+ }
39690
+ let childrenList = [];
39691
+ if (children.length) {
39692
+ childrenList = children.length === 1 ? children[0] : children;
39693
+ }
39694
+ const g = c.prototype.type ? new c(attribute) : c(config);
39695
+ if (childrenList && isArray(childrenList)) {
39696
+ childrenList.forEach((c) => {
39697
+ g.add(c);
39698
+ });
39699
+ }
39700
+ else {
39701
+ g.add(childrenList);
39702
+ }
39703
+ Object.keys(props).forEach(k => {
39704
+ const en = REACT_TO_CANOPUS_EVENTS[k];
39705
+ if (en) {
39706
+ g.on(en, props[k]);
39707
+ }
39708
+ });
39709
+ return g;
39710
+ }
39711
+ class Fragment {
39712
+ constructor() {
39713
+ this.children = [];
39714
+ }
39715
+ add(g) {
39716
+ this.children.push(g);
39717
+ }
39718
+ }
39719
+
39720
+ const version = "0.15.0-alpha.0";
36912
39721
 
36913
39722
  exports.ACustomAnimate = ACustomAnimate;
36914
39723
  exports.ARC3D_NUMBER_TYPE = ARC3D_NUMBER_TYPE;
@@ -36988,6 +39797,7 @@
36988
39797
  exports.FederatedMouseEvent = FederatedMouseEvent;
36989
39798
  exports.FederatedPointerEvent = FederatedPointerEvent;
36990
39799
  exports.FederatedWheelEvent = FederatedWheelEvent;
39800
+ exports.Fragment = Fragment;
36991
39801
  exports.GLYPH_NUMBER_TYPE = GLYPH_NUMBER_TYPE;
36992
39802
  exports.GRAPHIC_UPDATE_TAG_KEY = GRAPHIC_UPDATE_TAG_KEY;
36993
39803
  exports.GROUP_NUMBER_TYPE = GROUP_NUMBER_TYPE;
@@ -37048,6 +39858,8 @@
37048
39858
  exports.Pyramid3d = Pyramid3d;
37049
39859
  exports.Pyramid3dRender = Pyramid3dRender;
37050
39860
  exports.RAFTickHandler = RAFTickHandler;
39861
+ exports.REACT_TO_CANOPUS_EVENTS = REACT_TO_CANOPUS_EVENTS;
39862
+ exports.REACT_TO_CANOPUS_EVENTS_LIST = REACT_TO_CANOPUS_EVENTS_LIST;
37051
39863
  exports.RECT3D_NUMBER_TYPE = RECT3D_NUMBER_TYPE;
37052
39864
  exports.RECT_NUMBER_TYPE = RECT_NUMBER_TYPE;
37053
39865
  exports.RICHTEXT_NUMBER_TYPE = RICHTEXT_NUMBER_TYPE;
@@ -37064,6 +39876,10 @@
37064
39876
  exports.RichText = RichText;
37065
39877
  exports.RichTextRender = RichTextRender;
37066
39878
  exports.RotateBySphereAnimate = RotateBySphereAnimate;
39879
+ exports.SVG_ATTRIBUTE_MAP = SVG_ATTRIBUTE_MAP;
39880
+ exports.SVG_ATTRIBUTE_MAP_KEYS = SVG_ATTRIBUTE_MAP_KEYS;
39881
+ exports.SVG_PARSE_ATTRIBUTE_MAP = SVG_PARSE_ATTRIBUTE_MAP;
39882
+ exports.SVG_PARSE_ATTRIBUTE_MAP_KEYS = SVG_PARSE_ATTRIBUTE_MAP_KEYS;
37067
39883
  exports.SYMBOL_NUMBER_TYPE = SYMBOL_NUMBER_TYPE;
37068
39884
  exports.SegContext = SegContext;
37069
39885
  exports.Stage = Stage;
@@ -37081,6 +39897,21 @@
37081
39897
  exports.Theme = Theme;
37082
39898
  exports.TimeOutTickHandler = TimeOutTickHandler;
37083
39899
  exports.TransformUtil = TransformUtil;
39900
+ exports.VArc = VArc;
39901
+ exports.VArc3d = VArc3d;
39902
+ exports.VArea = VArea;
39903
+ exports.VCircle = VCircle;
39904
+ exports.VGlyph = VGlyph;
39905
+ exports.VGroup = VGroup;
39906
+ exports.VImage = VImage;
39907
+ exports.VLine = VLine;
39908
+ exports.VPath = VPath;
39909
+ exports.VPolygon = VPolygon;
39910
+ exports.VPyramid3d = VPyramid3d;
39911
+ exports.VRect = VRect;
39912
+ exports.VRect3d = VRect3d;
39913
+ exports.VSymbol = VSymbol;
39914
+ exports.VText = VText;
37084
39915
  exports.VWindow = VWindow;
37085
39916
  exports.WindowHandlerContribution = WindowHandlerContribution;
37086
39917
  exports.addArcToBezierPath = addArcToBezierPath$1;
@@ -37172,6 +40003,7 @@
37172
40003
  exports.incrementalAddTo = incrementalAddTo;
37173
40004
  exports.intersect = intersect;
37174
40005
  exports.isTransformKey = isTransformKey;
40006
+ exports.jsx = jsx;
37175
40007
  exports.layerService = layerService;
37176
40008
  exports.loadFeishuContributions = loadFeishuContributions;
37177
40009
  exports.loadTaroContributions = loadTaroContributions;