@ohif/app 3.0.0 → 3.5.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 (125) hide show
  1. package/dist/151.bundle.07bac9172580a60fae7a.js +2579 -0
  2. package/dist/192.bundle.62be5f0ef9705a485071.js +894 -0
  3. package/dist/199.bundle.2286f24cf0a068e7f50c.js +480 -0
  4. package/dist/205.bundle.39e6c847d618ad2b1b7a.js +62 -0
  5. package/dist/208.bundle.23748a85dfdc79c05d3a.js +864 -0
  6. package/dist/270.bundle.abbdb5348274bae3e8bc.js +23906 -0
  7. package/dist/283.bundle.33f99a75a5e2d9333da2.js +2939 -0
  8. package/dist/295.bundle.5105ce962be15c92484d.js +48 -0
  9. package/dist/331.bundle.7ac7b142d249d14fd99e.js +73034 -0
  10. package/dist/351.bundle.c5d7279ef42e30f61e08.js +1471 -0
  11. package/dist/351.css +3 -0
  12. package/dist/36785fbd89b0e17f6099.wasm +0 -0
  13. package/dist/381.bundle.0905e683605fcbc0895f.js +1009 -0
  14. package/dist/404.bundle.0f7a500421f246153d89.js +706 -0
  15. package/dist/50.bundle.4cb103cd20f5ffccf927.js +324 -0
  16. package/dist/5004fdc02f329ce53b69.wasm +0 -0
  17. package/dist/531.bundle.1bc152c87c7e2e987d2b.js +5935 -0
  18. package/dist/55.bundle.a5a215e13a8511f7aee7.js +685 -0
  19. package/dist/55.css +3 -0
  20. package/dist/569.bundle.d147c0aa0604f8ea2094.js +514 -0
  21. package/dist/581.bundle.646c89c5c3e3ee096363.js +508 -0
  22. package/dist/606.bundle.5d876f5f3dd8287f0a28.js +4939 -0
  23. package/dist/610.min.worker.js +2 -0
  24. package/dist/610.min.worker.js.map +1 -0
  25. package/dist/616.bundle.bec4736d8c9513e62856.js +686 -0
  26. package/dist/62ab5d58a2bea7b5a1dc.wasm +0 -0
  27. package/dist/642.bundle.030d908e22c8ff5611f3.js +169 -0
  28. package/dist/65916ef3def695744bda.wasm +0 -0
  29. package/dist/664.bundle.4792c88ae0d6d4b5ed13.js +901 -0
  30. package/dist/707.bundle.0a74aa3e61ed002eb3c6.js +9049 -0
  31. package/dist/707.css +1 -0
  32. package/dist/728.bundle.d13856835357400fef82.js +26221 -0
  33. package/dist/744.bundle.53b07e48e07a11e920ac.js +2355 -0
  34. package/dist/75788f12450d4c5ed494.wasm +0 -0
  35. package/dist/75a0c2dfe07b824c7d21.wasm +0 -0
  36. package/dist/780.bundle.f60ac1906e0ae080dee8.js +4769 -0
  37. package/dist/790.bundle.b4df2c5d78a2a565b150.js +454 -0
  38. package/dist/799.bundle.3fff638815e355b0bdfd.js +271 -0
  39. package/dist/806.css +1 -0
  40. package/dist/82.bundle.a24015533196e05d190e.js +6104 -0
  41. package/dist/917.bundle.a094ae9e9de6df4119ae.js +196 -0
  42. package/dist/926.bundle.dbc9d0e591cb9217fda2.js +72552 -0
  43. package/dist/935.bundle.deeffff0e4f7b528e3c3.js +1849 -0
  44. package/dist/945.min.worker.js +2 -0
  45. package/dist/945.min.worker.js.map +1 -0
  46. package/dist/953.bundle.c14d9eb6400f697019ee.js +449 -0
  47. package/dist/973.bundle.4100cf103686b64938d1.js +261 -0
  48. package/dist/976.bundle.2720eb892514e1818018.js +2725 -0
  49. package/dist/984.bundle.157fc66ea5040e1364af.js +1842 -0
  50. package/dist/_headers +6 -0
  51. package/dist/_redirects +6 -0
  52. package/dist/app-config.js +215 -0
  53. package/dist/app.bundle.253eeb2a7ee986e89c50.js +154621 -0
  54. package/dist/app.bundle.css +21 -0
  55. package/dist/assets/android-chrome-144x144.png +0 -0
  56. package/dist/assets/android-chrome-192x192.png +0 -0
  57. package/dist/assets/android-chrome-256x256.png +0 -0
  58. package/dist/assets/android-chrome-36x36.png +0 -0
  59. package/dist/assets/android-chrome-384x384.png +0 -0
  60. package/dist/assets/android-chrome-48x48.png +0 -0
  61. package/dist/assets/android-chrome-512x512.png +0 -0
  62. package/dist/assets/android-chrome-72x72.png +0 -0
  63. package/dist/assets/android-chrome-96x96.png +0 -0
  64. package/dist/assets/apple-touch-icon-1024x1024.png +0 -0
  65. package/dist/assets/apple-touch-icon-114x114.png +0 -0
  66. package/dist/assets/apple-touch-icon-120x120.png +0 -0
  67. package/dist/assets/apple-touch-icon-144x144.png +0 -0
  68. package/dist/assets/apple-touch-icon-152x152.png +0 -0
  69. package/dist/assets/apple-touch-icon-167x167.png +0 -0
  70. package/dist/assets/apple-touch-icon-180x180.png +0 -0
  71. package/dist/assets/apple-touch-icon-57x57.png +0 -0
  72. package/dist/assets/apple-touch-icon-60x60.png +0 -0
  73. package/dist/assets/apple-touch-icon-72x72.png +0 -0
  74. package/dist/assets/apple-touch-icon-76x76.png +0 -0
  75. package/dist/assets/apple-touch-icon-precomposed.png +0 -0
  76. package/dist/assets/apple-touch-icon.png +0 -0
  77. package/dist/assets/apple-touch-startup-image-1182x2208.png +0 -0
  78. package/dist/assets/apple-touch-startup-image-1242x2148.png +0 -0
  79. package/dist/assets/apple-touch-startup-image-1496x2048.png +0 -0
  80. package/dist/assets/apple-touch-startup-image-1536x2008.png +0 -0
  81. package/dist/assets/apple-touch-startup-image-320x460.png +0 -0
  82. package/dist/assets/apple-touch-startup-image-640x1096.png +0 -0
  83. package/dist/assets/apple-touch-startup-image-640x920.png +0 -0
  84. package/dist/assets/apple-touch-startup-image-748x1024.png +0 -0
  85. package/dist/assets/apple-touch-startup-image-750x1294.png +0 -0
  86. package/dist/assets/apple-touch-startup-image-768x1004.png +0 -0
  87. package/dist/assets/browserconfig.xml +12 -0
  88. package/dist/assets/coast-228x228.png +0 -0
  89. package/dist/assets/favicon-16x16.png +0 -0
  90. package/dist/assets/favicon-32x32.png +0 -0
  91. package/dist/assets/favicon.ico +0 -0
  92. package/dist/assets/firefox_app_128x128.png +0 -0
  93. package/dist/assets/firefox_app_512x512.png +0 -0
  94. package/dist/assets/firefox_app_60x60.png +0 -0
  95. package/dist/assets/manifest.webapp +14 -0
  96. package/dist/assets/mstile-144x144.png +0 -0
  97. package/dist/assets/mstile-150x150.png +0 -0
  98. package/dist/assets/mstile-310x150.png +0 -0
  99. package/dist/assets/mstile-310x310.png +0 -0
  100. package/dist/assets/mstile-70x70.png +0 -0
  101. package/dist/assets/yandex-browser-50x50.png +0 -0
  102. package/dist/assets/yandex-browser-manifest.json +9 -0
  103. package/dist/b6b803111e2d06a825bd.wasm +0 -0
  104. package/dist/c22b37c3488e1d6c3aa4.wasm +0 -0
  105. package/dist/cornerstoneDICOMImageLoader.min.js +2 -0
  106. package/dist/cornerstoneDICOMImageLoader.min.js.map +1 -0
  107. package/dist/dicom-microscopy-viewer.bundle.aa60bdf008c32c39cfd7.js +12 -0
  108. package/dist/dicomMicroscopyViewer.min.js +3 -0
  109. package/dist/dicomMicroscopyViewer.min.js.LICENSE.txt +29 -0
  110. package/dist/es6-shim.min.js +12 -0
  111. package/dist/google.js +75 -0
  112. package/dist/index.html +1 -0
  113. package/dist/index.worker.ea71efba2ce63c499055.worker.js +2 -0
  114. package/dist/index.worker.ea71efba2ce63c499055.worker.js.map +1 -0
  115. package/dist/index.worker.min.worker.js +2 -0
  116. package/dist/index.worker.min.worker.js.map +1 -0
  117. package/dist/init-service-worker.js +59 -0
  118. package/dist/manifest.json +59 -0
  119. package/dist/ohif-logo-light.svg +15 -0
  120. package/dist/ohif-logo.svg +15 -0
  121. package/dist/oidc-client.min.js +46 -0
  122. package/dist/polyfill.min.js +1 -0
  123. package/dist/silent-refresh.html +16 -0
  124. package/dist/sw.js +56 -0
  125. package/package.json +24 -23
@@ -0,0 +1,4769 @@
1
+ "use strict";
2
+ (globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[780],{
3
+
4
+ /***/ 92780:
5
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
6
+
7
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8
+ /* harmony export */ "ZP": () => (/* reexport safe */ _Math_index_js__WEBPACK_IMPORTED_MODULE_5__.f)
9
+ /* harmony export */ });
10
+ /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(92577);
11
+ /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(21930);
12
+ /* harmony import */ var seedrandom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(11381);
13
+ /* harmony import */ var seedrandom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(seedrandom__WEBPACK_IMPORTED_MODULE_2__);
14
+ /* harmony import */ var _macros_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(91924);
15
+ /* harmony import */ var _Math_Constants_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(69329);
16
+ /* harmony import */ var _Math_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(43739);
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+ /***/ }),
26
+
27
+ /***/ 69329:
28
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
29
+
30
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
31
+ /* harmony export */ "B0": () => (/* binding */ VTK_SMALL_NUMBER),
32
+ /* harmony export */ "Ib": () => (/* binding */ EPSILON),
33
+ /* harmony export */ "Wd": () => (/* binding */ IDENTITY),
34
+ /* harmony export */ "qt": () => (/* binding */ IDENTITY_3X3)
35
+ /* harmony export */ });
36
+ /* unused harmony export default */
37
+ var IDENTITY = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
38
+ var IDENTITY_3X3 = [1, 0, 0, 0, 1, 0, 0, 0, 1];
39
+ var EPSILON = 1e-6;
40
+ var VTK_SMALL_NUMBER = 1.0e-12;
41
+ var Constants = {
42
+ IDENTITY: IDENTITY,
43
+ IDENTITY_3X3: IDENTITY_3X3,
44
+ EPSILON: EPSILON,
45
+ VTK_SMALL_NUMBER: VTK_SMALL_NUMBER
46
+ };
47
+
48
+
49
+
50
+
51
+ /***/ }),
52
+
53
+ /***/ 43739:
54
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
55
+
56
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
57
+ /* harmony export */ "A": () => (/* binding */ degreesFromRadians),
58
+ /* harmony export */ "C": () => (/* binding */ clampValue),
59
+ /* harmony export */ "F": () => (/* binding */ isInf),
60
+ /* harmony export */ "G": () => (/* binding */ rgb2hsv),
61
+ /* harmony export */ "H": () => (/* binding */ rgb2lab),
62
+ /* harmony export */ "I": () => (/* binding */ lab2rgb),
63
+ /* harmony export */ "J": () => (/* binding */ floor),
64
+ /* harmony export */ "K": () => (/* binding */ round),
65
+ /* harmony export */ "L": () => (/* binding */ normalize2D),
66
+ /* harmony export */ "M": () => (/* binding */ nearestPowerOfTwo),
67
+ /* harmony export */ "N": () => (/* binding */ createUninitializedBounds),
68
+ /* harmony export */ "O": () => (/* binding */ multiply3x3_vect3),
69
+ /* harmony export */ "P": () => (/* binding */ areBoundsInitialized),
70
+ /* harmony export */ "Q": () => (/* binding */ isPowerOfTwo),
71
+ /* harmony export */ "a": () => (/* binding */ areMatricesEqual),
72
+ /* harmony export */ "b": () => (/* binding */ roundVector),
73
+ /* harmony export */ "c": () => (/* binding */ clampVector),
74
+ /* harmony export */ "d": () => (/* binding */ dot),
75
+ /* harmony export */ "e": () => (/* binding */ distance2BetweenPoints),
76
+ /* harmony export */ "f": () => (/* binding */ vtkMath),
77
+ /* harmony export */ "g": () => (/* binding */ solveLinearSystem),
78
+ /* harmony export */ "h": () => (/* binding */ hsv2rgb),
79
+ /* harmony export */ "i": () => (/* binding */ isNan),
80
+ /* harmony export */ "j": () => (/* binding */ cross),
81
+ /* harmony export */ "k": () => (/* binding */ add),
82
+ /* harmony export */ "l": () => (/* binding */ normalize),
83
+ /* harmony export */ "m": () => (/* binding */ multiplyAccumulate),
84
+ /* harmony export */ "n": () => (/* binding */ norm),
85
+ /* harmony export */ "o": () => (/* binding */ determinant2x2),
86
+ /* harmony export */ "r": () => (/* binding */ radiansFromDegrees),
87
+ /* harmony export */ "s": () => (/* binding */ subtract),
88
+ /* harmony export */ "u": () => (/* binding */ uninitializeBounds)
89
+ /* harmony export */ });
90
+ /* unused harmony exports $, B, D, E, R, S, T, U, V, W, X, Y, Z, _, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE, aF, aG, aH, aI, aJ, aK, aL, aM, aN, aO, aP, aQ, aR, aS, aT, aU, aV, aW, aX, aY, aZ, a_, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar, as, at, au, av, aw, ax, ay, az, p, q, t, v, w, x, y, z */
91
+ /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(92577);
92
+ /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(21930);
93
+ /* harmony import */ var seedrandom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(11381);
94
+ /* harmony import */ var seedrandom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(seedrandom__WEBPACK_IMPORTED_MODULE_2__);
95
+ /* harmony import */ var _macros_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(91924);
96
+ /* harmony import */ var _Constants_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(69329);
97
+
98
+
99
+
100
+
101
+
102
+
103
+ var vtkErrorMacro = _macros_js__WEBPACK_IMPORTED_MODULE_3__["default"].vtkErrorMacro,
104
+ vtkWarningMacro = _macros_js__WEBPACK_IMPORTED_MODULE_3__["default"].vtkWarningMacro; // ----------------------------------------------------------------------------
105
+
106
+ /* eslint-disable camelcase */
107
+
108
+ /* eslint-disable no-cond-assign */
109
+
110
+ /* eslint-disable no-bitwise */
111
+
112
+ /* eslint-disable no-multi-assign */
113
+ // ----------------------------------------------------------------------------
114
+
115
+ var randomSeedValue = 0;
116
+ var VTK_MAX_ROTATIONS = 20;
117
+
118
+ function notImplemented(method) {
119
+ return function () {
120
+ return vtkErrorMacro("vtkMath::".concat(method, " - NOT IMPLEMENTED"));
121
+ };
122
+ } // Swap rows for n by n matrix
123
+
124
+
125
+ function swapRowsMatrix_nxn(matrix, n, row1, row2) {
126
+ var tmp;
127
+
128
+ for (var i = 0; i < n; i++) {
129
+ tmp = matrix[row1 * n + i];
130
+ matrix[row1 * n + i] = matrix[row2 * n + i];
131
+ matrix[row2 * n + i] = tmp;
132
+ }
133
+ } // Swap columns for n by n matrix
134
+
135
+
136
+ function swapColumnsMatrix_nxn(matrix, n, column1, column2) {
137
+ var tmp;
138
+
139
+ for (var i = 0; i < n; i++) {
140
+ tmp = matrix[i * n + column1];
141
+ matrix[i * n + column1] = matrix[i * n + column2];
142
+ matrix[i * n + column2] = tmp;
143
+ }
144
+ } // ----------------------------------------------------------------------------
145
+ // Global methods
146
+ // ----------------------------------------------------------------------------
147
+
148
+
149
+ function createArray() {
150
+ var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 3;
151
+ // faster than Array.from and/or while loop
152
+ var res = Array(size);
153
+
154
+ for (var i = 0; i < size; ++i) {
155
+ res[i] = 0;
156
+ }
157
+
158
+ return res;
159
+ }
160
+ var Pi = function Pi() {
161
+ return Math.PI;
162
+ };
163
+ function radiansFromDegrees(deg) {
164
+ return deg / 180 * Math.PI;
165
+ }
166
+ function degreesFromRadians(rad) {
167
+ return rad * 180 / Math.PI;
168
+ }
169
+ var round = Math.round,
170
+ floor = Math.floor,
171
+ ceil = Math.ceil,
172
+ min = Math.min,
173
+ max = Math.max;
174
+ function arrayMin(arr) {
175
+ var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
176
+ var stride = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
177
+ var minValue = Infinity;
178
+
179
+ for (var i = offset, len = arr.length; i < len; i += stride) {
180
+ if (arr[i] < minValue) {
181
+ minValue = arr[i];
182
+ }
183
+ }
184
+
185
+ return minValue;
186
+ }
187
+ function arrayMax(arr) {
188
+ var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
189
+ var stride = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
190
+ var maxValue = -Infinity;
191
+
192
+ for (var i = offset, len = arr.length; i < len; i += stride) {
193
+ if (maxValue < arr[i]) {
194
+ maxValue = arr[i];
195
+ }
196
+ }
197
+
198
+ return maxValue;
199
+ }
200
+ function arrayRange(arr) {
201
+ var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
202
+ var stride = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
203
+ var minValue = Infinity;
204
+ var maxValue = -Infinity;
205
+
206
+ for (var i = offset, len = arr.length; i < len; i += stride) {
207
+ if (arr[i] < minValue) {
208
+ minValue = arr[i];
209
+ }
210
+
211
+ if (maxValue < arr[i]) {
212
+ maxValue = arr[i];
213
+ }
214
+ }
215
+
216
+ return [minValue, maxValue];
217
+ }
218
+ var ceilLog2 = notImplemented('ceilLog2');
219
+ var factorial = notImplemented('factorial');
220
+ function nearestPowerOfTwo(xi) {
221
+ var v = 1;
222
+
223
+ while (v < xi) {
224
+ v *= 2;
225
+ }
226
+
227
+ return v;
228
+ }
229
+ function isPowerOfTwo(x) {
230
+ return x === nearestPowerOfTwo(x);
231
+ }
232
+ function binomial(m, n) {
233
+ var r = 1;
234
+
235
+ for (var i = 1; i <= n; ++i) {
236
+ r *= (m - i + 1) / i;
237
+ }
238
+
239
+ return Math.floor(r);
240
+ }
241
+ function beginCombination(m, n) {
242
+ if (m < n) {
243
+ return 0;
244
+ }
245
+
246
+ var r = createArray(n);
247
+
248
+ for (var i = 0; i < n; ++i) {
249
+ r[i] = i;
250
+ }
251
+
252
+ return r;
253
+ }
254
+ function nextCombination(m, n, r) {
255
+ var status = 0;
256
+
257
+ for (var i = n - 1; i >= 0; --i) {
258
+ if (r[i] < m - n + i) {
259
+ var j = r[i] + 1;
260
+
261
+ while (i < n) {
262
+ r[i++] = j++;
263
+ }
264
+
265
+ status = 1;
266
+ break;
267
+ }
268
+ }
269
+
270
+ return status;
271
+ }
272
+ function randomSeed(seed) {
273
+ seedrandom__WEBPACK_IMPORTED_MODULE_2___default()("".concat(seed), {
274
+ global: true
275
+ });
276
+ randomSeedValue = seed;
277
+ }
278
+ function getSeed() {
279
+ return randomSeedValue;
280
+ }
281
+ function random() {
282
+ var minValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
283
+ var maxValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
284
+ var delta = maxValue - minValue;
285
+ return minValue + delta * Math.random();
286
+ }
287
+ var gaussian = notImplemented('gaussian'); // Vect3 operations
288
+
289
+ function add(a, b, out) {
290
+ out[0] = a[0] + b[0];
291
+ out[1] = a[1] + b[1];
292
+ out[2] = a[2] + b[2];
293
+ return out;
294
+ }
295
+ function subtract(a, b, out) {
296
+ out[0] = a[0] - b[0];
297
+ out[1] = a[1] - b[1];
298
+ out[2] = a[2] - b[2];
299
+ return out;
300
+ }
301
+ function multiplyScalar(vec, scalar) {
302
+ vec[0] *= scalar;
303
+ vec[1] *= scalar;
304
+ vec[2] *= scalar;
305
+ return vec;
306
+ }
307
+ function multiplyScalar2D(vec, scalar) {
308
+ vec[0] *= scalar;
309
+ vec[1] *= scalar;
310
+ return vec;
311
+ }
312
+ function multiplyAccumulate(a, b, scalar, out) {
313
+ out[0] = a[0] + b[0] * scalar;
314
+ out[1] = a[1] + b[1] * scalar;
315
+ out[2] = a[2] + b[2] * scalar;
316
+ return out;
317
+ }
318
+ function multiplyAccumulate2D(a, b, scalar, out) {
319
+ out[0] = a[0] + b[0] * scalar;
320
+ out[1] = a[1] + b[1] * scalar;
321
+ return out;
322
+ }
323
+ function dot(x, y) {
324
+ return x[0] * y[0] + x[1] * y[1] + x[2] * y[2];
325
+ }
326
+ function outer(x, y, out_3x3) {
327
+ out_3x3[0] = x[0] * y[0];
328
+ out_3x3[1] = x[0] * y[1];
329
+ out_3x3[2] = x[0] * y[2];
330
+ out_3x3[3] = x[1] * y[0];
331
+ out_3x3[4] = x[1] * y[1];
332
+ out_3x3[5] = x[1] * y[2];
333
+ out_3x3[6] = x[2] * y[0];
334
+ out_3x3[7] = x[2] * y[1];
335
+ out_3x3[8] = x[2] * y[2];
336
+ }
337
+ function cross(x, y, out) {
338
+ var Zx = x[1] * y[2] - x[2] * y[1];
339
+ var Zy = x[2] * y[0] - x[0] * y[2];
340
+ var Zz = x[0] * y[1] - x[1] * y[0];
341
+ out[0] = Zx;
342
+ out[1] = Zy;
343
+ out[2] = Zz;
344
+ return out;
345
+ }
346
+ function norm(x) {
347
+ var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
348
+
349
+ switch (n) {
350
+ case 1:
351
+ return Math.abs(x);
352
+
353
+ case 2:
354
+ return Math.sqrt(x[0] * x[0] + x[1] * x[1]);
355
+
356
+ case 3:
357
+ return Math.sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
358
+
359
+ default:
360
+ {
361
+ var sum = 0;
362
+
363
+ for (var i = 0; i < n; i++) {
364
+ sum += x[i] * x[i];
365
+ }
366
+
367
+ return Math.sqrt(sum);
368
+ }
369
+ }
370
+ }
371
+ function normalize(x) {
372
+ var den = norm(x);
373
+
374
+ if (den !== 0.0) {
375
+ x[0] /= den;
376
+ x[1] /= den;
377
+ x[2] /= den;
378
+ }
379
+
380
+ return den;
381
+ }
382
+ function perpendiculars(x, y, z, theta) {
383
+ var x2 = x[0] * x[0];
384
+ var y2 = x[1] * x[1];
385
+ var z2 = x[2] * x[2];
386
+ var r = Math.sqrt(x2 + y2 + z2);
387
+ var dx;
388
+ var dy;
389
+ var dz; // transpose the vector to avoid divide-by-zero error
390
+
391
+ if (x2 > y2 && x2 > z2) {
392
+ dx = 0;
393
+ dy = 1;
394
+ dz = 2;
395
+ } else if (y2 > z2) {
396
+ dx = 1;
397
+ dy = 2;
398
+ dz = 0;
399
+ } else {
400
+ dx = 2;
401
+ dy = 0;
402
+ dz = 1;
403
+ }
404
+
405
+ var a = x[dx] / r;
406
+ var b = x[dy] / r;
407
+ var c = x[dz] / r;
408
+ var tmp = Math.sqrt(a * a + c * c);
409
+
410
+ if (theta !== 0) {
411
+ var sintheta = Math.sin(theta);
412
+ var costheta = Math.cos(theta);
413
+
414
+ if (y) {
415
+ y[dx] = (c * costheta - a * b * sintheta) / tmp;
416
+ y[dy] = sintheta * tmp;
417
+ y[dz] = (-(a * costheta) - b * c * sintheta) / tmp;
418
+ }
419
+
420
+ if (z) {
421
+ z[dx] = (-(c * sintheta) - a * b * costheta) / tmp;
422
+ z[dy] = costheta * tmp;
423
+ z[dz] = (a * sintheta - b * c * costheta) / tmp;
424
+ }
425
+ } else {
426
+ if (y) {
427
+ y[dx] = c / tmp;
428
+ y[dy] = 0;
429
+ y[dz] = -a / tmp;
430
+ }
431
+
432
+ if (z) {
433
+ z[dx] = -a * b / tmp;
434
+ z[dy] = tmp;
435
+ z[dz] = -b * c / tmp;
436
+ }
437
+ }
438
+ }
439
+ function projectVector(a, b, projection) {
440
+ var bSquared = dot(b, b);
441
+
442
+ if (bSquared === 0) {
443
+ projection[0] = 0;
444
+ projection[1] = 0;
445
+ projection[2] = 0;
446
+ return false;
447
+ }
448
+
449
+ var scale = dot(a, b) / bSquared;
450
+
451
+ for (var i = 0; i < 3; i++) {
452
+ projection[i] = b[i];
453
+ }
454
+
455
+ multiplyScalar(projection, scale);
456
+ return true;
457
+ }
458
+ function dot2D(x, y) {
459
+ return x[0] * y[0] + x[1] * y[1];
460
+ }
461
+ function projectVector2D(a, b, projection) {
462
+ var bSquared = dot2D(b, b);
463
+
464
+ if (bSquared === 0) {
465
+ projection[0] = 0;
466
+ projection[1] = 0;
467
+ return false;
468
+ }
469
+
470
+ var scale = dot2D(a, b) / bSquared;
471
+
472
+ for (var i = 0; i < 2; i++) {
473
+ projection[i] = b[i];
474
+ }
475
+
476
+ multiplyScalar2D(projection, scale);
477
+ return true;
478
+ }
479
+ function distance2BetweenPoints(x, y) {
480
+ return (x[0] - y[0]) * (x[0] - y[0]) + (x[1] - y[1]) * (x[1] - y[1]) + (x[2] - y[2]) * (x[2] - y[2]);
481
+ }
482
+ function angleBetweenVectors(v1, v2) {
483
+ var crossVect = [0, 0, 0];
484
+ cross(v1, v2, crossVect);
485
+ return Math.atan2(norm(crossVect), dot(v1, v2));
486
+ }
487
+ function signedAngleBetweenVectors(v1, v2, vN) {
488
+ var crossVect = [0, 0, 0];
489
+ cross(v1, v2, crossVect);
490
+ var angle = Math.atan2(norm(crossVect), dot(v1, v2));
491
+ return dot(crossVect, vN) >= 0 ? angle : -angle;
492
+ }
493
+ function gaussianAmplitude(mean, variance, position) {
494
+ var distanceFromMean = Math.abs(mean - position);
495
+ return 1 / Math.sqrt(2 * Math.PI * variance) * Math.exp(-Math.pow(distanceFromMean, 2) / (2 * variance));
496
+ }
497
+ function gaussianWeight(mean, variance, position) {
498
+ var distanceFromMean = Math.abs(mean - position);
499
+ return Math.exp(-Math.pow(distanceFromMean, 2) / (2 * variance));
500
+ }
501
+ function outer2D(x, y, out_2x2) {
502
+ out_2x2[0] = x[0] * y[0];
503
+ out_2x2[1] = x[0] * y[1];
504
+ out_2x2[2] = x[1] * y[0];
505
+ out_2x2[3] = x[1] * y[1];
506
+ }
507
+ function norm2D(x2D) {
508
+ return Math.sqrt(x2D[0] * x2D[0] + x2D[1] * x2D[1]);
509
+ }
510
+ function normalize2D(x) {
511
+ var den = norm2D(x);
512
+
513
+ if (den !== 0.0) {
514
+ x[0] /= den;
515
+ x[1] /= den;
516
+ }
517
+
518
+ return den;
519
+ }
520
+ function rowsToMat4(row0, row1, row2, row3, mat) {
521
+ for (var i = 0; i < 4; i++) {
522
+ mat[i] = row0[i];
523
+ mat[4 + i] = row1[i];
524
+ mat[8 + i] = row2[i];
525
+ mat[12 + i] = row3[i];
526
+ }
527
+
528
+ return mat;
529
+ }
530
+ function columnsToMat4(column0, column1, column2, column3, mat) {
531
+ for (var i = 0; i < 4; i++) {
532
+ mat[4 * i] = column0[i];
533
+ mat[4 * i + 1] = column1[i];
534
+ mat[4 * i + 2] = column2[i];
535
+ mat[4 * i + 3] = column3[i];
536
+ }
537
+
538
+ return mat;
539
+ }
540
+ function rowsToMat3(row0, row1, row2, mat) {
541
+ for (var i = 0; i < 3; i++) {
542
+ mat[i] = row0[i];
543
+ mat[3 + i] = row1[i];
544
+ mat[6 + i] = row2[i];
545
+ }
546
+
547
+ return mat;
548
+ }
549
+ function columnsToMat3(column0, column1, column2, mat) {
550
+ for (var i = 0; i < 3; i++) {
551
+ mat[3 * i] = column0[i];
552
+ mat[3 * i + 1] = column1[i];
553
+ mat[3 * i + 2] = column2[i];
554
+ }
555
+
556
+ return mat;
557
+ }
558
+ function determinant2x2() {
559
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
560
+ args[_key] = arguments[_key];
561
+ }
562
+
563
+ if (args.length === 2) {
564
+ return args[0][0] * args[1][1] - args[1][0] * args[0][1];
565
+ }
566
+
567
+ if (args.length === 4) {
568
+ return args[0] * args[3] - args[1] * args[2];
569
+ }
570
+
571
+ return Number.NaN;
572
+ }
573
+ function LUFactor3x3(mat_3x3, index_3) {
574
+ var maxI;
575
+ var tmp;
576
+ var largest;
577
+ var scale = [0, 0, 0]; // Loop over rows to get implicit scaling information
578
+
579
+ for (var i = 0; i < 3; i++) {
580
+ largest = Math.abs(mat_3x3[i * 3]);
581
+
582
+ if ((tmp = Math.abs(mat_3x3[i * 3 + 1])) > largest) {
583
+ largest = tmp;
584
+ }
585
+
586
+ if ((tmp = Math.abs(mat_3x3[i * 3 + 2])) > largest) {
587
+ largest = tmp;
588
+ }
589
+
590
+ scale[i] = 1 / largest;
591
+ } // Loop over all columns using Crout's method
592
+ // first column
593
+
594
+
595
+ largest = scale[0] * Math.abs(mat_3x3[0]);
596
+ maxI = 0;
597
+
598
+ if ((tmp = scale[1] * Math.abs(mat_3x3[3])) >= largest) {
599
+ largest = tmp;
600
+ maxI = 1;
601
+ }
602
+
603
+ if ((tmp = scale[2] * Math.abs(mat_3x3[6])) >= largest) {
604
+ maxI = 2;
605
+ }
606
+
607
+ if (maxI !== 0) {
608
+ swapRowsMatrix_nxn(mat_3x3, 3, maxI, 0);
609
+ scale[maxI] = scale[0];
610
+ }
611
+
612
+ index_3[0] = maxI;
613
+ mat_3x3[3] /= mat_3x3[0];
614
+ mat_3x3[6] /= mat_3x3[0]; // second column
615
+
616
+ mat_3x3[4] -= mat_3x3[3] * mat_3x3[1];
617
+ mat_3x3[7] -= mat_3x3[6] * mat_3x3[1];
618
+ largest = scale[1] * Math.abs(mat_3x3[4]);
619
+ maxI = 1;
620
+
621
+ if ((tmp = scale[2] * Math.abs(mat_3x3[7])) >= largest) {
622
+ maxI = 2;
623
+ swapRowsMatrix_nxn(mat_3x3, 3, 1, 2);
624
+ scale[2] = scale[1];
625
+ }
626
+
627
+ index_3[1] = maxI;
628
+ mat_3x3[7] /= mat_3x3[4]; // third column
629
+
630
+ mat_3x3[5] -= mat_3x3[3] * mat_3x3[2];
631
+ mat_3x3[8] -= mat_3x3[6] * mat_3x3[2] + mat_3x3[7] * mat_3x3[5];
632
+ index_3[2] = 2;
633
+ }
634
+ function LUSolve3x3(mat_3x3, index_3, x_3) {
635
+ // forward substitution
636
+ var sum = x_3[index_3[0]];
637
+ x_3[index_3[0]] = x_3[0];
638
+ x_3[0] = sum;
639
+ sum = x_3[index_3[1]];
640
+ x_3[index_3[1]] = x_3[1];
641
+ x_3[1] = sum - mat_3x3[3] * x_3[0];
642
+ sum = x_3[index_3[2]];
643
+ x_3[index_3[2]] = x_3[2];
644
+ x_3[2] = sum - mat_3x3[6] * x_3[0] - mat_3x3[7] * x_3[1]; // back substitution
645
+
646
+ x_3[2] /= mat_3x3[8];
647
+ x_3[1] = (x_3[1] - mat_3x3[5] * x_3[2]) / mat_3x3[4];
648
+ x_3[0] = (x_3[0] - mat_3x3[1] * x_3[1] - mat_3x3[2] * x_3[2]) / mat_3x3[0];
649
+ }
650
+ function linearSolve3x3(mat_3x3, x_3, y_3) {
651
+ var a1 = mat_3x3[0];
652
+ var b1 = mat_3x3[1];
653
+ var c1 = mat_3x3[2];
654
+ var a2 = mat_3x3[3];
655
+ var b2 = mat_3x3[4];
656
+ var c2 = mat_3x3[5];
657
+ var a3 = mat_3x3[6];
658
+ var b3 = mat_3x3[7];
659
+ var c3 = mat_3x3[8]; // Compute the adjoint
660
+
661
+ var d1 = +determinant2x2(b2, b3, c2, c3);
662
+ var d2 = -determinant2x2(a2, a3, c2, c3);
663
+ var d3 = +determinant2x2(a2, a3, b2, b3);
664
+ var e1 = -determinant2x2(b1, b3, c1, c3);
665
+ var e2 = +determinant2x2(a1, a3, c1, c3);
666
+ var e3 = -determinant2x2(a1, a3, b1, b3);
667
+ var f1 = +determinant2x2(b1, b2, c1, c2);
668
+ var f2 = -determinant2x2(a1, a2, c1, c2);
669
+ var f3 = +determinant2x2(a1, a2, b1, b2); // Compute the determinant
670
+
671
+ var det = a1 * d1 + b1 * d2 + c1 * d3; // Multiply by the adjoint
672
+
673
+ var v1 = d1 * x_3[0] + e1 * x_3[1] + f1 * x_3[2];
674
+ var v2 = d2 * x_3[0] + e2 * x_3[1] + f2 * x_3[2];
675
+ var v3 = d3 * x_3[0] + e3 * x_3[1] + f3 * x_3[2]; // Divide by the determinant
676
+
677
+ y_3[0] = v1 / det;
678
+ y_3[1] = v2 / det;
679
+ y_3[2] = v3 / det;
680
+ }
681
+ function multiply3x3_vect3(mat_3x3, in_3, out_3) {
682
+ var x = mat_3x3[0] * in_3[0] + mat_3x3[1] * in_3[1] + mat_3x3[2] * in_3[2];
683
+ var y = mat_3x3[3] * in_3[0] + mat_3x3[4] * in_3[1] + mat_3x3[5] * in_3[2];
684
+ var z = mat_3x3[6] * in_3[0] + mat_3x3[7] * in_3[1] + mat_3x3[8] * in_3[2];
685
+ out_3[0] = x;
686
+ out_3[1] = y;
687
+ out_3[2] = z;
688
+ }
689
+ function multiply3x3_mat3(a_3x3, b_3x3, out_3x3) {
690
+ var copyA = (0,_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(a_3x3);
691
+
692
+ var copyB = (0,_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(b_3x3);
693
+
694
+ for (var i = 0; i < 3; i++) {
695
+ out_3x3[i] = copyA[0] * copyB[i] + copyA[1] * copyB[i + 3] + copyA[2] * copyB[i + 6];
696
+ out_3x3[i + 3] = copyA[3] * copyB[i] + copyA[4] * copyB[i + 3] + copyA[5] * copyB[i + 6];
697
+ out_3x3[i + 6] = copyA[6] * copyB[i] + copyA[7] * copyB[i + 3] + copyA[8] * copyB[i + 6];
698
+ }
699
+ }
700
+ function multiplyMatrix(a, b, rowA, colA, rowB, colB, out_rowXcol) {
701
+ // we need colA == rowB
702
+ if (colA !== rowB) {
703
+ vtkErrorMacro('Number of columns of A must match number of rows of B.');
704
+ } // If a or b is used to store the result, copying them is required
705
+
706
+
707
+ var copyA = (0,_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(a);
708
+
709
+ var copyB = (0,_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(b); // output matrix is rowA*colB
710
+ // output row
711
+
712
+
713
+ for (var i = 0; i < rowA; i++) {
714
+ // output col
715
+ for (var j = 0; j < colB; j++) {
716
+ out_rowXcol[i * colB + j] = 0; // sum for this point
717
+
718
+ for (var k = 0; k < colA; k++) {
719
+ out_rowXcol[i * colB + j] += copyA[i * colA + k] * copyB[j + colB * k];
720
+ }
721
+ }
722
+ }
723
+ }
724
+ function transpose3x3(in_3x3, outT_3x3) {
725
+ var tmp; // off-diagonal elements
726
+
727
+ tmp = in_3x3[3];
728
+ outT_3x3[3] = in_3x3[1];
729
+ outT_3x3[1] = tmp;
730
+ tmp = in_3x3[6];
731
+ outT_3x3[6] = in_3x3[2];
732
+ outT_3x3[2] = tmp;
733
+ tmp = in_3x3[7];
734
+ outT_3x3[7] = in_3x3[5];
735
+ outT_3x3[5] = tmp; // on-diagonal elements
736
+
737
+ outT_3x3[0] = in_3x3[0];
738
+ outT_3x3[4] = in_3x3[4];
739
+ outT_3x3[8] = in_3x3[8];
740
+ }
741
+ function invert3x3(in_3x3, outI_3x3) {
742
+ var a1 = in_3x3[0];
743
+ var b1 = in_3x3[1];
744
+ var c1 = in_3x3[2];
745
+ var a2 = in_3x3[3];
746
+ var b2 = in_3x3[4];
747
+ var c2 = in_3x3[5];
748
+ var a3 = in_3x3[6];
749
+ var b3 = in_3x3[7];
750
+ var c3 = in_3x3[8]; // Compute the adjoint
751
+
752
+ var d1 = +determinant2x2(b2, b3, c2, c3);
753
+ var d2 = -determinant2x2(a2, a3, c2, c3);
754
+ var d3 = +determinant2x2(a2, a3, b2, b3);
755
+ var e1 = -determinant2x2(b1, b3, c1, c3);
756
+ var e2 = +determinant2x2(a1, a3, c1, c3);
757
+ var e3 = -determinant2x2(a1, a3, b1, b3);
758
+ var f1 = +determinant2x2(b1, b2, c1, c2);
759
+ var f2 = -determinant2x2(a1, a2, c1, c2);
760
+ var f3 = +determinant2x2(a1, a2, b1, b2); // Divide by the determinant
761
+
762
+ var det = a1 * d1 + b1 * d2 + c1 * d3;
763
+
764
+ if (det === 0) {
765
+ vtkWarningMacro('Matrix has 0 determinant');
766
+ }
767
+
768
+ outI_3x3[0] = d1 / det;
769
+ outI_3x3[3] = d2 / det;
770
+ outI_3x3[6] = d3 / det;
771
+ outI_3x3[1] = e1 / det;
772
+ outI_3x3[4] = e2 / det;
773
+ outI_3x3[7] = e3 / det;
774
+ outI_3x3[2] = f1 / det;
775
+ outI_3x3[5] = f2 / det;
776
+ outI_3x3[8] = f3 / det;
777
+ }
778
+ function determinant3x3(mat_3x3) {
779
+ return mat_3x3[0] * mat_3x3[4] * mat_3x3[8] + mat_3x3[3] * mat_3x3[7] * mat_3x3[2] + mat_3x3[6] * mat_3x3[1] * mat_3x3[5] - mat_3x3[0] * mat_3x3[7] * mat_3x3[5] - mat_3x3[3] * mat_3x3[1] * mat_3x3[8] - mat_3x3[6] * mat_3x3[4] * mat_3x3[2];
780
+ }
781
+ /**
782
+ * Returns true if elements of both arrays are equals.
783
+ * @param {Array} a an array of numbers (vector, point, matrix...)
784
+ * @param {Array} b an array of numbers (vector, point, matrix...)
785
+ * @param {Number} eps tolerance
786
+ */
787
+
788
+ function areEquals(a, b) {
789
+ var eps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _Constants_js__WEBPACK_IMPORTED_MODULE_4__/* .EPSILON */ .Ib;
790
+
791
+ if (a.length !== b.length) {
792
+ return false;
793
+ }
794
+
795
+ function isEqual(element, index) {
796
+ return Math.abs(element - b[index]) <= eps;
797
+ }
798
+
799
+ return a.every(isEqual);
800
+ }
801
+ var areMatricesEqual = areEquals;
802
+ function identity3x3(mat_3x3) {
803
+ for (var i = 0; i < 3; i++) {
804
+ /* eslint-disable-next-line no-multi-assign */
805
+ mat_3x3[i * 3] = mat_3x3[i * 3 + 1] = mat_3x3[i * 3 + 2] = 0;
806
+ mat_3x3[i * 3 + i] = 1;
807
+ }
808
+ }
809
+ function identity(n, mat) {
810
+ for (var i = 0; i < n; i++) {
811
+ for (var j = 0; j < n; j++) {
812
+ mat[i * n + j] = 0;
813
+ }
814
+
815
+ mat[i * n + i] = 1;
816
+ }
817
+
818
+ return mat;
819
+ }
820
+ function isIdentity(mat) {
821
+ var eps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _Constants_js__WEBPACK_IMPORTED_MODULE_4__/* .EPSILON */ .Ib;
822
+ return areMatricesEqual(mat, _Constants_js__WEBPACK_IMPORTED_MODULE_4__/* .IDENTITY */ .Wd, eps);
823
+ }
824
+ function isIdentity3x3(mat) {
825
+ var eps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _Constants_js__WEBPACK_IMPORTED_MODULE_4__/* .EPSILON */ .Ib;
826
+ return areMatricesEqual(mat, _Constants_js__WEBPACK_IMPORTED_MODULE_4__/* .IDENTITY_3X3 */ .qt, eps);
827
+ }
828
+ function quaternionToMatrix3x3(quat_4, mat_3x3) {
829
+ var ww = quat_4[0] * quat_4[0];
830
+ var wx = quat_4[0] * quat_4[1];
831
+ var wy = quat_4[0] * quat_4[2];
832
+ var wz = quat_4[0] * quat_4[3];
833
+ var xx = quat_4[1] * quat_4[1];
834
+ var yy = quat_4[2] * quat_4[2];
835
+ var zz = quat_4[3] * quat_4[3];
836
+ var xy = quat_4[1] * quat_4[2];
837
+ var xz = quat_4[1] * quat_4[3];
838
+ var yz = quat_4[2] * quat_4[3];
839
+ var rr = xx + yy + zz; // normalization factor, just in case quaternion was not normalized
840
+
841
+ var f = 1 / (ww + rr);
842
+ var s = (ww - rr) * f;
843
+ f *= 2;
844
+ mat_3x3[0] = xx * f + s;
845
+ mat_3x3[3] = (xy + wz) * f;
846
+ mat_3x3[6] = (xz - wy) * f;
847
+ mat_3x3[1] = (xy - wz) * f;
848
+ mat_3x3[4] = yy * f + s;
849
+ mat_3x3[7] = (yz + wx) * f;
850
+ mat_3x3[2] = (xz + wy) * f;
851
+ mat_3x3[5] = (yz - wx) * f;
852
+ mat_3x3[8] = zz * f + s;
853
+ }
854
+ function roundNumber(num) {
855
+ var digits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
856
+
857
+ if (!"".concat(num).includes('e')) {
858
+ return +"".concat(Math.round("".concat(num, "e+").concat(digits)), "e-").concat(digits);
859
+ }
860
+
861
+ var arr = "".concat(num).split('e');
862
+ var sig = '';
863
+
864
+ if (+arr[1] + digits > 0) {
865
+ sig = '+';
866
+ }
867
+
868
+ return +"".concat(Math.round("".concat(+arr[0], "e").concat(sig).concat(+arr[1] + digits)), "e-").concat(digits);
869
+ }
870
+ function roundVector(vector) {
871
+ var out = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
872
+ var digits = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
873
+ out[0] = roundNumber(vector[0], digits);
874
+ out[1] = roundNumber(vector[1], digits);
875
+ out[2] = roundNumber(vector[2], digits);
876
+ return out;
877
+ }
878
+ function jacobiN(a, n, w, v) {
879
+ var i;
880
+ var j;
881
+ var k;
882
+ var iq;
883
+ var ip;
884
+ var numPos;
885
+ var tresh;
886
+ var theta;
887
+ var t;
888
+ var tau;
889
+ var sm;
890
+ var s;
891
+ var h;
892
+ var g;
893
+ var c;
894
+ var tmp;
895
+ var b = createArray(n);
896
+ var z = createArray(n);
897
+
898
+ var vtkROTATE = function vtkROTATE(aa, ii, jj) {
899
+ g = aa[ii];
900
+ h = aa[jj];
901
+ aa[ii] = g - s * (h + g * tau);
902
+ aa[jj] = h + s * (g - h * tau);
903
+ }; // initialize
904
+
905
+
906
+ identity(n, v);
907
+
908
+ for (ip = 0; ip < n; ip++) {
909
+ b[ip] = w[ip] = a[ip + ip * n];
910
+ z[ip] = 0.0;
911
+ } // begin rotation sequence
912
+
913
+
914
+ for (i = 0; i < VTK_MAX_ROTATIONS; i++) {
915
+ sm = 0.0;
916
+
917
+ for (ip = 0; ip < n - 1; ip++) {
918
+ for (iq = ip + 1; iq < n; iq++) {
919
+ sm += Math.abs(a[ip * n + iq]);
920
+ }
921
+ }
922
+
923
+ if (sm === 0.0) {
924
+ break;
925
+ } // first 3 sweeps
926
+
927
+
928
+ if (i < 3) {
929
+ tresh = 0.2 * sm / (n * n);
930
+ } else {
931
+ tresh = 0.0;
932
+ }
933
+
934
+ for (ip = 0; ip < n - 1; ip++) {
935
+ for (iq = ip + 1; iq < n; iq++) {
936
+ g = 100.0 * Math.abs(a[ip * n + iq]); // after 4 sweeps
937
+
938
+ if (i > 3 && Math.abs(w[ip]) + g === Math.abs(w[ip]) && Math.abs(w[iq]) + g === Math.abs(w[iq])) {
939
+ a[ip * n + iq] = 0.0;
940
+ } else if (Math.abs(a[ip * n + iq]) > tresh) {
941
+ h = w[iq] - w[ip];
942
+
943
+ if (Math.abs(h) + g === Math.abs(h)) {
944
+ t = a[ip * n + iq] / h;
945
+ } else {
946
+ theta = 0.5 * h / a[ip * n + iq];
947
+ t = 1.0 / (Math.abs(theta) + Math.sqrt(1.0 + theta * theta));
948
+
949
+ if (theta < 0.0) {
950
+ t = -t;
951
+ }
952
+ }
953
+
954
+ c = 1.0 / Math.sqrt(1 + t * t);
955
+ s = t * c;
956
+ tau = s / (1.0 + c);
957
+ h = t * a[ip * n + iq];
958
+ z[ip] -= h;
959
+ z[iq] += h;
960
+ w[ip] -= h;
961
+ w[iq] += h;
962
+ a[ip * n + iq] = 0.0; // ip already shifted left by 1 unit
963
+
964
+ for (j = 0; j <= ip - 1; j++) {
965
+ vtkROTATE(a, j * n + ip, j * n + iq);
966
+ } // ip and iq already shifted left by 1 unit
967
+
968
+
969
+ for (j = ip + 1; j <= iq - 1; j++) {
970
+ vtkROTATE(a, ip * n + j, j * n + iq);
971
+ } // iq already shifted left by 1 unit
972
+
973
+
974
+ for (j = iq + 1; j < n; j++) {
975
+ vtkROTATE(a, ip * n + j, iq * n + j);
976
+ }
977
+
978
+ for (j = 0; j < n; j++) {
979
+ vtkROTATE(v, j * n + ip, j * n + iq);
980
+ }
981
+ }
982
+ }
983
+ }
984
+
985
+ for (ip = 0; ip < n; ip++) {
986
+ b[ip] += z[ip];
987
+ w[ip] = b[ip];
988
+ z[ip] = 0.0;
989
+ }
990
+ } // this is NEVER called
991
+
992
+
993
+ if (i >= VTK_MAX_ROTATIONS) {
994
+ vtkWarningMacro('vtkMath::Jacobi: Error extracting eigenfunctions');
995
+ return 0;
996
+ } // sort eigenfunctions: these changes do not affect accuracy
997
+
998
+
999
+ for (j = 0; j < n - 1; j++) {
1000
+ // boundary incorrect
1001
+ k = j;
1002
+ tmp = w[k];
1003
+
1004
+ for (i = j + 1; i < n; i++) {
1005
+ // boundary incorrect, shifted already
1006
+ if (w[i] >= tmp || Math.abs(w[i] - tmp) < _Constants_js__WEBPACK_IMPORTED_MODULE_4__/* .VTK_SMALL_NUMBER */ .B0) {
1007
+ // why exchange if same?
1008
+ k = i;
1009
+ tmp = w[k];
1010
+ }
1011
+ }
1012
+
1013
+ if (k !== j) {
1014
+ w[k] = w[j];
1015
+ w[j] = tmp;
1016
+ swapColumnsMatrix_nxn(v, n, j, k);
1017
+ }
1018
+ } // ensure eigenvector consistency (i.e., Jacobi can compute vectors that
1019
+ // are negative of one another (.707,.707,0) and (-.707,-.707,0). This can
1020
+ // reek havoc in hyperstreamline/other stuff. We will select the most
1021
+ // positive eigenvector.
1022
+
1023
+
1024
+ var ceil_half_n = (n >> 1) + (n & 1);
1025
+
1026
+ for (numPos = 0, i = 0; i < n * n; i++) {
1027
+ if (v[i] >= 0.0) {
1028
+ numPos++;
1029
+ }
1030
+ } // if ( numPos < ceil(double(n)/double(2.0)) )
1031
+
1032
+
1033
+ if (numPos < ceil_half_n) {
1034
+ for (i = 0; i < n; i++) {
1035
+ v[i * n + j] *= -1.0;
1036
+ }
1037
+ }
1038
+
1039
+ return 1;
1040
+ }
1041
+ function matrix3x3ToQuaternion(mat_3x3, quat_4) {
1042
+ var tmp = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; // on-diagonal elements
1043
+
1044
+ tmp[0] = mat_3x3[0] + mat_3x3[4] + mat_3x3[8];
1045
+ tmp[5] = mat_3x3[0] - mat_3x3[4] - mat_3x3[8];
1046
+ tmp[10] = -mat_3x3[0] + mat_3x3[4] - mat_3x3[8];
1047
+ tmp[15] = -mat_3x3[0] - mat_3x3[4] + mat_3x3[8]; // off-diagonal elements
1048
+
1049
+ tmp[1] = tmp[4] = mat_3x3[7] - mat_3x3[5];
1050
+ tmp[2] = tmp[8] = mat_3x3[2] - mat_3x3[6];
1051
+ tmp[3] = tmp[12] = mat_3x3[3] - mat_3x3[1];
1052
+ tmp[6] = tmp[9] = mat_3x3[3] + mat_3x3[1];
1053
+ tmp[7] = tmp[13] = mat_3x3[2] + mat_3x3[6];
1054
+ tmp[11] = tmp[14] = mat_3x3[7] + mat_3x3[5];
1055
+ var eigenvectors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
1056
+ var eigenvalues = [0, 0, 0, 0]; // convert into format that JacobiN can use,
1057
+ // then use Jacobi to find eigenvalues and eigenvectors
1058
+ // tmp is copied because jacobiN may modify it
1059
+
1060
+ var NTemp = [].concat(tmp);
1061
+ jacobiN(NTemp, 4, eigenvalues, eigenvectors); // the first eigenvector is the one we want
1062
+
1063
+ quat_4[0] = eigenvectors[0];
1064
+ quat_4[1] = eigenvectors[4];
1065
+ quat_4[2] = eigenvectors[8];
1066
+ quat_4[3] = eigenvectors[12];
1067
+ }
1068
+ function multiplyQuaternion(quat_1, quat_2, quat_out) {
1069
+ var ww = quat_1[0] * quat_2[0];
1070
+ var wx = quat_1[0] * quat_2[1];
1071
+ var wy = quat_1[0] * quat_2[2];
1072
+ var wz = quat_1[0] * quat_2[3];
1073
+ var xw = quat_1[1] * quat_2[0];
1074
+ var xx = quat_1[1] * quat_2[1];
1075
+ var xy = quat_1[1] * quat_2[2];
1076
+ var xz = quat_1[1] * quat_2[3];
1077
+ var yw = quat_1[2] * quat_2[0];
1078
+ var yx = quat_1[2] * quat_2[1];
1079
+ var yy = quat_1[2] * quat_2[2];
1080
+ var yz = quat_1[2] * quat_2[3];
1081
+ var zw = quat_1[3] * quat_2[0];
1082
+ var zx = quat_1[3] * quat_2[1];
1083
+ var zy = quat_1[3] * quat_2[2];
1084
+ var zz = quat_1[3] * quat_2[3];
1085
+ quat_out[0] = ww - xx - yy - zz;
1086
+ quat_out[1] = wx + xw + yz - zy;
1087
+ quat_out[2] = wy - xz + yw + zx;
1088
+ quat_out[3] = wz + xy - yx + zw;
1089
+ }
1090
+ function orthogonalize3x3(a_3x3, out_3x3) {
1091
+ // copy the matrix
1092
+ for (var i = 0; i < 9; i++) {
1093
+ out_3x3[i] = a_3x3[i];
1094
+ } // Pivot the matrix to improve accuracy
1095
+
1096
+
1097
+ var scale = createArray(3);
1098
+ var index = createArray(3);
1099
+ var largest; // Loop over rows to get implicit scaling information
1100
+
1101
+ for (var _i = 0; _i < 3; _i++) {
1102
+ var _x = Math.abs(out_3x3[_i * 3]);
1103
+
1104
+ var _x2 = Math.abs(out_3x3[_i * 3 + 1]);
1105
+
1106
+ var _x3 = Math.abs(out_3x3[_i * 3 + 2]);
1107
+
1108
+ largest = _x2 > _x ? _x2 : _x;
1109
+ largest = _x3 > largest ? _x3 : largest;
1110
+ scale[_i] = 1;
1111
+
1112
+ if (largest !== 0) {
1113
+ scale[_i] /= largest;
1114
+ }
1115
+ } // first column
1116
+
1117
+
1118
+ var x1 = Math.abs(out_3x3[0]) * scale[0];
1119
+ var x2 = Math.abs(out_3x3[3]) * scale[1];
1120
+ var x3 = Math.abs(out_3x3[6]) * scale[2];
1121
+ index[0] = 0;
1122
+ largest = x1;
1123
+
1124
+ if (x2 >= largest) {
1125
+ largest = x2;
1126
+ index[0] = 1;
1127
+ }
1128
+
1129
+ if (x3 >= largest) {
1130
+ index[0] = 2;
1131
+ }
1132
+
1133
+ if (index[0] !== 0) {
1134
+ // swap vectors
1135
+ swapColumnsMatrix_nxn(out_3x3, 3, index[0], 0);
1136
+ scale[index[0]] = scale[0];
1137
+ } // second column
1138
+
1139
+
1140
+ var y2 = Math.abs(out_3x3[4]) * scale[1];
1141
+ var y3 = Math.abs(out_3x3[7]) * scale[2];
1142
+ index[1] = 1;
1143
+ largest = y2;
1144
+
1145
+ if (y3 >= largest) {
1146
+ index[1] = 2; // swap vectors
1147
+
1148
+ swapColumnsMatrix_nxn(out_3x3, 3, 1, 2);
1149
+ } // third column
1150
+
1151
+
1152
+ index[2] = 2; // A quaternion can only describe a pure rotation, not
1153
+ // a rotation with a flip, therefore the flip must be
1154
+ // removed before the matrix is converted to a quaternion.
1155
+
1156
+ var flip = 0;
1157
+
1158
+ if (determinant3x3(out_3x3) < 0) {
1159
+ flip = 1;
1160
+
1161
+ for (var _i2 = 0; _i2 < 9; _i2++) {
1162
+ out_3x3[_i2] = -out_3x3[_i2];
1163
+ }
1164
+ } // Do orthogonalization using a quaternion intermediate
1165
+ // (this, essentially, does the orthogonalization via
1166
+ // diagonalization of an appropriately constructed symmetric
1167
+ // 4x4 matrix rather than by doing SVD of the 3x3 matrix)
1168
+
1169
+
1170
+ var quat = createArray(4);
1171
+ matrix3x3ToQuaternion(out_3x3, quat);
1172
+ quaternionToMatrix3x3(quat, out_3x3); // Put the flip back into the orthogonalized matrix.
1173
+
1174
+ if (flip) {
1175
+ for (var _i3 = 0; _i3 < 9; _i3++) {
1176
+ out_3x3[_i3] = -out_3x3[_i3];
1177
+ }
1178
+ } // Undo the pivoting
1179
+
1180
+
1181
+ if (index[1] !== 1) {
1182
+ swapColumnsMatrix_nxn(out_3x3, 3, index[1], 1);
1183
+ }
1184
+
1185
+ if (index[0] !== 0) {
1186
+ swapColumnsMatrix_nxn(out_3x3, 3, index[0], 0);
1187
+ }
1188
+ }
1189
+ function diagonalize3x3(a_3x3, w_3, v_3x3) {
1190
+ var i;
1191
+ var j;
1192
+ var k;
1193
+ var maxI;
1194
+ var tmp;
1195
+ var maxVal; // a is copied because jacobiN may modify it
1196
+
1197
+ var copyA = (0,_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(a_3x3); // diagonalize using Jacobi
1198
+
1199
+
1200
+ jacobiN(copyA, 3, w_3, v_3x3); // if all the eigenvalues are the same, return identity matrix
1201
+
1202
+ if (w_3[0] === w_3[1] && w_3[0] === w_3[2]) {
1203
+ identity3x3(v_3x3);
1204
+ return;
1205
+ } // transpose temporarily, it makes it easier to sort the eigenvectors
1206
+
1207
+
1208
+ transpose3x3(v_3x3, v_3x3); // if two eigenvalues are the same, re-orthogonalize to optimally line
1209
+ // up the eigenvectors with the x, y, and z axes
1210
+
1211
+ for (i = 0; i < 3; i++) {
1212
+ // two eigenvalues are the same
1213
+ if (w_3[(i + 1) % 3] === w_3[(i + 2) % 3]) {
1214
+ // find maximum element of the independent eigenvector
1215
+ maxVal = Math.abs(v_3x3[i * 3]);
1216
+ maxI = 0;
1217
+
1218
+ for (j = 1; j < 3; j++) {
1219
+ if (maxVal < (tmp = Math.abs(v_3x3[i * 3 + j]))) {
1220
+ maxVal = tmp;
1221
+ maxI = j;
1222
+ }
1223
+ } // swap the eigenvector into its proper position
1224
+
1225
+
1226
+ if (maxI !== i) {
1227
+ tmp = w_3[maxI];
1228
+ w_3[maxI] = w_3[i];
1229
+ w_3[i] = tmp;
1230
+ swapRowsMatrix_nxn(v_3x3, 3, i, maxI);
1231
+ } // maximum element of eigenvector should be positive
1232
+
1233
+
1234
+ if (v_3x3[maxI * 3 + maxI] < 0) {
1235
+ v_3x3[maxI * 3] = -v_3x3[maxI * 3];
1236
+ v_3x3[maxI * 3 + 1] = -v_3x3[maxI * 3 + 1];
1237
+ v_3x3[maxI * 3 + 2] = -v_3x3[maxI * 3 + 2];
1238
+ } // re-orthogonalize the other two eigenvectors
1239
+
1240
+
1241
+ j = (maxI + 1) % 3;
1242
+ k = (maxI + 2) % 3;
1243
+ v_3x3[j * 3] = 0.0;
1244
+ v_3x3[j * 3 + 1] = 0.0;
1245
+ v_3x3[j * 3 + 2] = 0.0;
1246
+ v_3x3[j * 3 + j] = 1.0;
1247
+ var vectTmp1 = cross([v_3x3[maxI * 3], v_3x3[maxI * 3 + 1], v_3x3[maxI * 3 + 2]], [v_3x3[j * 3], v_3x3[j * 3 + 1], v_3x3[j * 3 + 2]], []);
1248
+ normalize(vectTmp1);
1249
+ var vectTmp2 = cross(vectTmp1, [v_3x3[maxI * 3], v_3x3[maxI * 3 + 1], v_3x3[maxI * 3 + 2]], []);
1250
+
1251
+ for (var t = 0; t < 3; t++) {
1252
+ v_3x3[k * 3 + t] = vectTmp1[t];
1253
+ v_3x3[j * 3 + t] = vectTmp2[t];
1254
+ } // transpose vectors back to columns
1255
+
1256
+
1257
+ transpose3x3(v_3x3, v_3x3);
1258
+ return;
1259
+ }
1260
+ } // the three eigenvalues are different, just sort the eigenvectors
1261
+ // to align them with the x, y, and z axes
1262
+ // find the vector with the largest x element, make that vector
1263
+ // the first vector
1264
+
1265
+
1266
+ maxVal = Math.abs(v_3x3[0]);
1267
+ maxI = 0;
1268
+
1269
+ for (i = 1; i < 3; i++) {
1270
+ if (maxVal < (tmp = Math.abs(v_3x3[i * 3]))) {
1271
+ maxVal = tmp;
1272
+ maxI = i;
1273
+ }
1274
+ } // swap eigenvalue and eigenvector
1275
+
1276
+
1277
+ if (maxI !== 0) {
1278
+ var eigenValTmp = w_3[maxI];
1279
+ w_3[maxI] = w_3[0];
1280
+ w_3[0] = eigenValTmp;
1281
+ swapRowsMatrix_nxn(v_3x3, 3, maxI, 0);
1282
+ } // do the same for the y element
1283
+
1284
+
1285
+ if (Math.abs(v_3x3[4]) < Math.abs(v_3x3[7])) {
1286
+ var _eigenValTmp = w_3[2];
1287
+ w_3[2] = w_3[1];
1288
+ w_3[1] = _eigenValTmp;
1289
+ swapRowsMatrix_nxn(v_3x3, 3, 1, 2);
1290
+ } // ensure that the sign of the eigenvectors is correct
1291
+
1292
+
1293
+ for (i = 0; i < 2; i++) {
1294
+ if (v_3x3[i * 3 + i] < 0) {
1295
+ v_3x3[i * 3] = -v_3x3[i * 3];
1296
+ v_3x3[i * 3 + 1] = -v_3x3[i * 3 + 1];
1297
+ v_3x3[i * 3 + 2] = -v_3x3[i * 3 + 2];
1298
+ }
1299
+ } // set sign of final eigenvector to ensure that determinant is positive
1300
+
1301
+
1302
+ if (determinant3x3(v_3x3) < 0) {
1303
+ v_3x3[6] = -v_3x3[6];
1304
+ v_3x3[7] = -v_3x3[7];
1305
+ v_3x3[8] = -v_3x3[8];
1306
+ } // transpose the eigenvectors back again
1307
+
1308
+
1309
+ transpose3x3(v_3x3, v_3x3);
1310
+ }
1311
+ function singularValueDecomposition3x3(a_3x3, u_3x3, w_3, vT_3x3) {
1312
+ var i; // copy so that A can be used for U or VT without risk
1313
+
1314
+ var B = (0,_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(a_3x3); // temporarily flip if determinant is negative
1315
+
1316
+
1317
+ var d = determinant3x3(B);
1318
+
1319
+ if (d < 0) {
1320
+ for (i = 0; i < 9; i++) {
1321
+ B[i] = -B[i];
1322
+ }
1323
+ } // orthogonalize, diagonalize, etc.
1324
+
1325
+
1326
+ orthogonalize3x3(B, u_3x3);
1327
+ transpose3x3(B, B);
1328
+ multiply3x3_mat3(B, u_3x3, vT_3x3);
1329
+ diagonalize3x3(vT_3x3, w_3, vT_3x3);
1330
+ multiply3x3_mat3(u_3x3, vT_3x3, u_3x3);
1331
+ transpose3x3(vT_3x3, vT_3x3); // re-create the flip
1332
+
1333
+ if (d < 0) {
1334
+ w_3[0] = -w_3[0];
1335
+ w_3[1] = -w_3[1];
1336
+ w_3[2] = -w_3[2];
1337
+ }
1338
+ }
1339
+ /**
1340
+ * Factor linear equations Ax = b using LU decomposition A = LU. Output factorization LU is in matrix A.
1341
+ * @param {Matrix} A square matrix
1342
+ * @param {Number} index integer array of pivot indices index[0->n-1]
1343
+ * @param {Number} size matrix size
1344
+ */
1345
+
1346
+ function luFactorLinearSystem(A, index, size) {
1347
+ var i;
1348
+ var j;
1349
+ var k;
1350
+ var largest;
1351
+ var maxI = 0;
1352
+ var sum;
1353
+ var temp1;
1354
+ var temp2;
1355
+ var scale = createArray(size); //
1356
+ // Loop over rows to get implicit scaling information
1357
+ //
1358
+
1359
+ for (i = 0; i < size; i++) {
1360
+ for (largest = 0.0, j = 0; j < size; j++) {
1361
+ if ((temp2 = Math.abs(A[i * size + j])) > largest) {
1362
+ largest = temp2;
1363
+ }
1364
+ }
1365
+
1366
+ if (largest === 0.0) {
1367
+ vtkWarningMacro('Unable to factor linear system');
1368
+ return 0;
1369
+ }
1370
+
1371
+ scale[i] = 1.0 / largest;
1372
+ } //
1373
+ // Loop over all columns using Crout's method
1374
+ //
1375
+
1376
+
1377
+ for (j = 0; j < size; j++) {
1378
+ for (i = 0; i < j; i++) {
1379
+ sum = A[i * size + j];
1380
+
1381
+ for (k = 0; k < i; k++) {
1382
+ sum -= A[i * size + k] * A[k * size + j];
1383
+ }
1384
+
1385
+ A[i * size + j] = sum;
1386
+ } //
1387
+ // Begin search for largest pivot element
1388
+ //
1389
+
1390
+
1391
+ for (largest = 0.0, i = j; i < size; i++) {
1392
+ sum = A[i * size + j];
1393
+
1394
+ for (k = 0; k < j; k++) {
1395
+ sum -= A[i * size + k] * A[k * size + j];
1396
+ }
1397
+
1398
+ A[i * size + j] = sum;
1399
+
1400
+ if ((temp1 = scale[i] * Math.abs(sum)) >= largest) {
1401
+ largest = temp1;
1402
+ maxI = i;
1403
+ }
1404
+ } //
1405
+ // Check for row interchange
1406
+ //
1407
+
1408
+
1409
+ if (j !== maxI) {
1410
+ for (k = 0; k < size; k++) {
1411
+ temp1 = A[maxI * size + k];
1412
+ A[maxI * size + k] = A[j * size + k];
1413
+ A[j * size + k] = temp1;
1414
+ }
1415
+
1416
+ scale[maxI] = scale[j];
1417
+ } //
1418
+ // Divide by pivot element and perform elimination
1419
+ //
1420
+
1421
+
1422
+ index[j] = maxI;
1423
+
1424
+ if (Math.abs(A[j * size + j]) <= _Constants_js__WEBPACK_IMPORTED_MODULE_4__/* .VTK_SMALL_NUMBER */ .B0) {
1425
+ vtkWarningMacro('Unable to factor linear system');
1426
+ return 0;
1427
+ }
1428
+
1429
+ if (j !== size - 1) {
1430
+ temp1 = 1.0 / A[j * size + j];
1431
+
1432
+ for (i = j + 1; i < size; i++) {
1433
+ A[i * size + j] *= temp1;
1434
+ }
1435
+ }
1436
+ }
1437
+
1438
+ return 1;
1439
+ }
1440
+ function luSolveLinearSystem(A, index, x, size) {
1441
+ var i;
1442
+ var j;
1443
+ var ii;
1444
+ var idx;
1445
+ var sum; //
1446
+ // Proceed with forward and backsubstitution for L and U
1447
+ // matrices. First, forward substitution.
1448
+ //
1449
+
1450
+ for (ii = -1, i = 0; i < size; i++) {
1451
+ idx = index[i];
1452
+ sum = x[idx];
1453
+ x[idx] = x[i];
1454
+
1455
+ if (ii >= 0) {
1456
+ for (j = ii; j <= i - 1; j++) {
1457
+ sum -= A[i * size + j] * x[j];
1458
+ }
1459
+ } else if (sum !== 0.0) {
1460
+ ii = i;
1461
+ }
1462
+
1463
+ x[i] = sum;
1464
+ } //
1465
+ // Now, back substitution
1466
+ //
1467
+
1468
+
1469
+ for (i = size - 1; i >= 0; i--) {
1470
+ sum = x[i];
1471
+
1472
+ for (j = i + 1; j < size; j++) {
1473
+ sum -= A[i * size + j] * x[j];
1474
+ }
1475
+
1476
+ x[i] = sum / A[i * size + i];
1477
+ }
1478
+ }
1479
+ function solveLinearSystem(A, x, size) {
1480
+ // if we solving something simple, just solve it
1481
+ if (size === 2) {
1482
+ var y = createArray(2);
1483
+ var det = determinant2x2(A[0], A[1], A[2], A[3]);
1484
+
1485
+ if (det === 0.0) {
1486
+ // Unable to solve linear system
1487
+ return 0;
1488
+ }
1489
+
1490
+ y[0] = (A[3] * x[0] - A[1] * x[1]) / det;
1491
+ y[1] = (-(A[2] * x[0]) + A[0] * x[1]) / det;
1492
+ x[0] = y[0];
1493
+ x[1] = y[1];
1494
+ return 1;
1495
+ }
1496
+
1497
+ if (size === 1) {
1498
+ if (A[0] === 0.0) {
1499
+ // Unable to solve linear system
1500
+ return 0;
1501
+ }
1502
+
1503
+ x[0] /= A[0];
1504
+ return 1;
1505
+ } //
1506
+ // System of equations is not trivial, use Crout's method
1507
+ //
1508
+ // Check on allocation of working vectors
1509
+
1510
+
1511
+ var index = createArray(size); // Factor and solve matrix
1512
+
1513
+ if (luFactorLinearSystem(A, index, size) === 0) {
1514
+ return 0;
1515
+ }
1516
+
1517
+ luSolveLinearSystem(A, index, x, size);
1518
+ return 1;
1519
+ } // Note that A is modified during the inversion !
1520
+
1521
+ function invertMatrix(A, AI, size) {
1522
+ var index = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
1523
+ var column = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
1524
+ var tmp1Size = index || createArray(size);
1525
+ var tmp2Size = column || createArray(size); // Factor matrix; then begin solving for inverse one column at a time.
1526
+ // Note: tmp1Size returned value is used later, tmp2Size is just working
1527
+ // memory whose values are not used in LUSolveLinearSystem
1528
+
1529
+ if (luFactorLinearSystem(A, tmp1Size, size) === 0) {
1530
+ return null;
1531
+ }
1532
+
1533
+ for (var j = 0; j < size; j++) {
1534
+ for (var i = 0; i < size; i++) {
1535
+ tmp2Size[i] = 0.0;
1536
+ }
1537
+
1538
+ tmp2Size[j] = 1.0;
1539
+ luSolveLinearSystem(A, tmp1Size, tmp2Size, size);
1540
+
1541
+ for (var _i4 = 0; _i4 < size; _i4++) {
1542
+ AI[_i4 * size + j] = tmp2Size[_i4];
1543
+ }
1544
+ }
1545
+
1546
+ return AI;
1547
+ }
1548
+ function estimateMatrixCondition(A, size) {
1549
+ var minValue = +Number.MAX_VALUE;
1550
+ var maxValue = -Number.MAX_VALUE; // find the maximum value
1551
+
1552
+ for (var i = 0; i < size; i++) {
1553
+ for (var j = i; j < size; j++) {
1554
+ if (Math.abs(A[i * size + j]) > maxValue) {
1555
+ maxValue = Math.abs(A[i * size + j]);
1556
+ }
1557
+ }
1558
+ } // find the minimum diagonal value
1559
+
1560
+
1561
+ for (var _i5 = 0; _i5 < size; _i5++) {
1562
+ if (Math.abs(A[_i5 * size + _i5]) < minValue) {
1563
+ minValue = Math.abs(A[_i5 * size + _i5]);
1564
+ }
1565
+ }
1566
+
1567
+ if (minValue === 0.0) {
1568
+ return Number.MAX_VALUE;
1569
+ }
1570
+
1571
+ return maxValue / minValue;
1572
+ }
1573
+ function jacobi(a_3x3, w, v) {
1574
+ return jacobiN(a_3x3, 3, w, v);
1575
+ }
1576
+ function solveHomogeneousLeastSquares(numberOfSamples, xt, xOrder, mt) {
1577
+ // check dimensional consistency
1578
+ if (numberOfSamples < xOrder) {
1579
+ vtkWarningMacro('Insufficient number of samples. Underdetermined.');
1580
+ return 0;
1581
+ }
1582
+
1583
+ var i;
1584
+ var j;
1585
+ var k; // set up intermediate variables
1586
+ // Allocate matrix to hold X times transpose of X
1587
+
1588
+ var XXt = createArray(xOrder * xOrder); // size x by x
1589
+ // Allocate the array of eigenvalues and eigenvectors
1590
+
1591
+ var eigenvals = createArray(xOrder);
1592
+ var eigenvecs = createArray(xOrder * xOrder); // Calculate XXt upper half only, due to symmetry
1593
+
1594
+ for (k = 0; k < numberOfSamples; k++) {
1595
+ for (i = 0; i < xOrder; i++) {
1596
+ for (j = i; j < xOrder; j++) {
1597
+ XXt[i * xOrder + j] += xt[k * xOrder + i] * xt[k * xOrder + j];
1598
+ }
1599
+ }
1600
+ } // now fill in the lower half of the XXt matrix
1601
+
1602
+
1603
+ for (i = 0; i < xOrder; i++) {
1604
+ for (j = 0; j < i; j++) {
1605
+ XXt[i * xOrder + j] = XXt[j * xOrder + i];
1606
+ }
1607
+ } // Compute the eigenvectors and eigenvalues
1608
+
1609
+
1610
+ jacobiN(XXt, xOrder, eigenvals, eigenvecs); // Smallest eigenval is at the end of the list (xOrder-1), and solution is
1611
+ // corresponding eigenvec.
1612
+
1613
+ for (i = 0; i < xOrder; i++) {
1614
+ mt[i] = eigenvecs[i * xOrder + xOrder - 1];
1615
+ }
1616
+
1617
+ return 1;
1618
+ }
1619
+ function solveLeastSquares(numberOfSamples, xt, xOrder, yt, yOrder, mt) {
1620
+ var checkHomogeneous = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : true;
1621
+
1622
+ // check dimensional consistency
1623
+ if (numberOfSamples < xOrder || numberOfSamples < yOrder) {
1624
+ vtkWarningMacro('Insufficient number of samples. Underdetermined.');
1625
+ return 0;
1626
+ }
1627
+
1628
+ var homogenFlags = createArray(yOrder);
1629
+ var allHomogeneous = 1;
1630
+ var hmt;
1631
+ var homogRC = 0;
1632
+ var i;
1633
+ var j;
1634
+ var k;
1635
+ var someHomogeneous = 0; // Ok, first init some flags check and see if all the systems are homogeneous
1636
+
1637
+ if (checkHomogeneous) {
1638
+ // If Y' is zero, it's a homogeneous system and can't be solved via
1639
+ // the pseudoinverse method. Detect this case, warn the user, and
1640
+ // invoke SolveHomogeneousLeastSquares instead. Note that it doesn't
1641
+ // really make much sense for yOrder to be greater than one in this case,
1642
+ // since that's just yOrder occurrences of a 0 vector on the RHS, but
1643
+ // we allow it anyway. N
1644
+ // Initialize homogeneous flags on a per-right-hand-side basis
1645
+ for (j = 0; j < yOrder; j++) {
1646
+ homogenFlags[j] = 1;
1647
+ }
1648
+
1649
+ for (i = 0; i < numberOfSamples; i++) {
1650
+ for (j = 0; j < yOrder; j++) {
1651
+ if (Math.abs(yt[i * yOrder + j]) > _Constants_js__WEBPACK_IMPORTED_MODULE_4__/* .VTK_SMALL_NUMBER */ .B0) {
1652
+ allHomogeneous = 0;
1653
+ homogenFlags[j] = 0;
1654
+ }
1655
+ }
1656
+ } // If we've got one system, and it's homogeneous, do it and bail out quickly.
1657
+
1658
+
1659
+ if (allHomogeneous && yOrder === 1) {
1660
+ vtkWarningMacro('Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()');
1661
+ return solveHomogeneousLeastSquares(numberOfSamples, xt, xOrder, mt);
1662
+ } // Ok, we've got more than one system of equations.
1663
+ // Figure out if we need to calculate the homogeneous equation solution for
1664
+ // any of them.
1665
+
1666
+
1667
+ if (allHomogeneous) {
1668
+ someHomogeneous = 1;
1669
+ } else {
1670
+ for (j = 0; j < yOrder; j++) {
1671
+ if (homogenFlags[j]) {
1672
+ someHomogeneous = 1;
1673
+ }
1674
+ }
1675
+ }
1676
+ } // If necessary, solve the homogeneous problem
1677
+
1678
+
1679
+ if (someHomogeneous) {
1680
+ // hmt is the homogeneous equation version of mt, the general solution.
1681
+ // hmt should be xOrder x yOrder, but since we are solving only the homogeneous part, here it is xOrder x 1
1682
+ hmt = createArray(xOrder); // Ok, solve the homogeneous problem
1683
+
1684
+ homogRC = solveHomogeneousLeastSquares(numberOfSamples, xt, xOrder, hmt);
1685
+ } // set up intermediate variables
1686
+
1687
+
1688
+ var XXt = createArray(xOrder * xOrder); // size x by x
1689
+
1690
+ var XXtI = createArray(xOrder * xOrder); // size x by x
1691
+
1692
+ var XYt = createArray(xOrder * yOrder); // size x by y
1693
+ // first find the pseudoinverse matrix
1694
+
1695
+ for (k = 0; k < numberOfSamples; k++) {
1696
+ for (i = 0; i < xOrder; i++) {
1697
+ // first calculate the XXt matrix, only do the upper half (symmetrical)
1698
+ for (j = i; j < xOrder; j++) {
1699
+ XXt[i * xOrder + j] += xt[k * xOrder + i] * xt[k * xOrder + j];
1700
+ } // now calculate the XYt matrix
1701
+
1702
+
1703
+ for (j = 0; j < yOrder; j++) {
1704
+ XYt[i * yOrder + j] += xt[k * xOrder + i] * yt[k * yOrder + j];
1705
+ }
1706
+ }
1707
+ } // now fill in the lower half of the XXt matrix
1708
+
1709
+
1710
+ for (i = 0; i < xOrder; i++) {
1711
+ for (j = 0; j < i; j++) {
1712
+ XXt[i * xOrder + j] = XXt[j * xOrder + i];
1713
+ }
1714
+ }
1715
+
1716
+ var successFlag = invertMatrix(XXt, XXtI, xOrder); // next get the inverse of XXt
1717
+
1718
+ if (successFlag) {
1719
+ for (i = 0; i < xOrder; i++) {
1720
+ for (j = 0; j < yOrder; j++) {
1721
+ mt[i * yOrder + j] = 0.0;
1722
+
1723
+ for (k = 0; k < xOrder; k++) {
1724
+ mt[i * yOrder + j] += XXtI[i * xOrder + k] * XYt[k * yOrder + j];
1725
+ }
1726
+ }
1727
+ }
1728
+ } // Fix up any of the solutions that correspond to the homogeneous equation
1729
+ // problem.
1730
+
1731
+
1732
+ if (someHomogeneous) {
1733
+ for (j = 0; j < yOrder; j++) {
1734
+ if (homogenFlags[j]) {
1735
+ // Fix this one
1736
+ for (i = 0; i < xOrder; i++) {
1737
+ mt[i * yOrder + j] = hmt[i * yOrder];
1738
+ }
1739
+ }
1740
+ }
1741
+ }
1742
+
1743
+ if (someHomogeneous) {
1744
+ return homogRC && successFlag;
1745
+ }
1746
+
1747
+ return successFlag;
1748
+ }
1749
+ function hex2float(hexStr) {
1750
+ var outFloatArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0.5, 1];
1751
+
1752
+ switch (hexStr.length) {
1753
+ case 3:
1754
+ // abc => #aabbcc
1755
+ outFloatArray[0] = parseInt(hexStr[0], 16) * 17 / 255;
1756
+ outFloatArray[1] = parseInt(hexStr[1], 16) * 17 / 255;
1757
+ outFloatArray[2] = parseInt(hexStr[2], 16) * 17 / 255;
1758
+ return outFloatArray;
1759
+
1760
+ case 4:
1761
+ // #abc => #aabbcc
1762
+ outFloatArray[0] = parseInt(hexStr[1], 16) * 17 / 255;
1763
+ outFloatArray[1] = parseInt(hexStr[2], 16) * 17 / 255;
1764
+ outFloatArray[2] = parseInt(hexStr[3], 16) * 17 / 255;
1765
+ return outFloatArray;
1766
+
1767
+ case 6:
1768
+ // ab01df => #ab01df
1769
+ outFloatArray[0] = parseInt(hexStr.substr(0, 2), 16) / 255;
1770
+ outFloatArray[1] = parseInt(hexStr.substr(2, 2), 16) / 255;
1771
+ outFloatArray[2] = parseInt(hexStr.substr(4, 2), 16) / 255;
1772
+ return outFloatArray;
1773
+
1774
+ case 7:
1775
+ // #ab01df
1776
+ outFloatArray[0] = parseInt(hexStr.substr(1, 2), 16) / 255;
1777
+ outFloatArray[1] = parseInt(hexStr.substr(3, 2), 16) / 255;
1778
+ outFloatArray[2] = parseInt(hexStr.substr(5, 2), 16) / 255;
1779
+ return outFloatArray;
1780
+
1781
+ case 9:
1782
+ // #ab01df00
1783
+ outFloatArray[0] = parseInt(hexStr.substr(1, 2), 16) / 255;
1784
+ outFloatArray[1] = parseInt(hexStr.substr(3, 2), 16) / 255;
1785
+ outFloatArray[2] = parseInt(hexStr.substr(5, 2), 16) / 255;
1786
+ outFloatArray[3] = parseInt(hexStr.substr(7, 2), 16) / 255;
1787
+ return outFloatArray;
1788
+
1789
+ default:
1790
+ return outFloatArray;
1791
+ }
1792
+ }
1793
+ function rgb2hsv(rgb, hsv) {
1794
+ var h;
1795
+ var s;
1796
+
1797
+ var _rgb = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(rgb, 3),
1798
+ r = _rgb[0],
1799
+ g = _rgb[1],
1800
+ b = _rgb[2];
1801
+
1802
+ var onethird = 1.0 / 3.0;
1803
+ var onesixth = 1.0 / 6.0;
1804
+ var twothird = 2.0 / 3.0;
1805
+ var cmax = r;
1806
+ var cmin = r;
1807
+
1808
+ if (g > cmax) {
1809
+ cmax = g;
1810
+ } else if (g < cmin) {
1811
+ cmin = g;
1812
+ }
1813
+
1814
+ if (b > cmax) {
1815
+ cmax = b;
1816
+ } else if (b < cmin) {
1817
+ cmin = b;
1818
+ }
1819
+
1820
+ var v = cmax;
1821
+
1822
+ if (v > 0.0) {
1823
+ s = (cmax - cmin) / cmax;
1824
+ } else {
1825
+ s = 0.0;
1826
+ }
1827
+
1828
+ if (s > 0) {
1829
+ if (r === cmax) {
1830
+ h = onesixth * (g - b) / (cmax - cmin);
1831
+ } else if (g === cmax) {
1832
+ h = onethird + onesixth * (b - r) / (cmax - cmin);
1833
+ } else {
1834
+ h = twothird + onesixth * (r - g) / (cmax - cmin);
1835
+ }
1836
+
1837
+ if (h < 0.0) {
1838
+ h += 1.0;
1839
+ }
1840
+ } else {
1841
+ h = 0.0;
1842
+ } // Set the values back to the array
1843
+
1844
+
1845
+ hsv[0] = h;
1846
+ hsv[1] = s;
1847
+ hsv[2] = v;
1848
+ }
1849
+ function hsv2rgb(hsv, rgb) {
1850
+ var _hsv = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(hsv, 3),
1851
+ h = _hsv[0],
1852
+ s = _hsv[1],
1853
+ v = _hsv[2];
1854
+
1855
+ var onethird = 1.0 / 3.0;
1856
+ var onesixth = 1.0 / 6.0;
1857
+ var twothird = 2.0 / 3.0;
1858
+ var fivesixth = 5.0 / 6.0;
1859
+ var r;
1860
+ var g;
1861
+ var b; // compute RGB from HSV
1862
+
1863
+ if (h > onesixth && h <= onethird) {
1864
+ // green/red
1865
+ g = 1.0;
1866
+ r = (onethird - h) / onesixth;
1867
+ b = 0.0;
1868
+ } else if (h > onethird && h <= 0.5) {
1869
+ // green/blue
1870
+ g = 1.0;
1871
+ b = (h - onethird) / onesixth;
1872
+ r = 0.0;
1873
+ } else if (h > 0.5 && h <= twothird) {
1874
+ // blue/green
1875
+ b = 1.0;
1876
+ g = (twothird - h) / onesixth;
1877
+ r = 0.0;
1878
+ } else if (h > twothird && h <= fivesixth) {
1879
+ // blue/red
1880
+ b = 1.0;
1881
+ r = (h - twothird) / onesixth;
1882
+ g = 0.0;
1883
+ } else if (h > fivesixth && h <= 1.0) {
1884
+ // red/blue
1885
+ r = 1.0;
1886
+ b = (1.0 - h) / onesixth;
1887
+ g = 0.0;
1888
+ } else {
1889
+ // red/green
1890
+ r = 1.0;
1891
+ g = h / onesixth;
1892
+ b = 0.0;
1893
+ } // add Saturation to the equation.
1894
+
1895
+
1896
+ r = s * r + (1.0 - s);
1897
+ g = s * g + (1.0 - s);
1898
+ b = s * b + (1.0 - s);
1899
+ r *= v;
1900
+ g *= v;
1901
+ b *= v; // Assign back to the array
1902
+
1903
+ rgb[0] = r;
1904
+ rgb[1] = g;
1905
+ rgb[2] = b;
1906
+ }
1907
+ function lab2xyz(lab, xyz) {
1908
+ // LAB to XYZ
1909
+ var _lab = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(lab, 3),
1910
+ L = _lab[0],
1911
+ a = _lab[1],
1912
+ b = _lab[2];
1913
+
1914
+ var var_Y = (L + 16) / 116;
1915
+ var var_X = a / 500 + var_Y;
1916
+ var var_Z = var_Y - b / 200;
1917
+
1918
+ if (Math.pow(var_Y, 3) > 0.008856) {
1919
+ var_Y = Math.pow(var_Y, 3);
1920
+ } else {
1921
+ var_Y = (var_Y - 16.0 / 116.0) / 7.787;
1922
+ }
1923
+
1924
+ if (Math.pow(var_X, 3) > 0.008856) {
1925
+ var_X = Math.pow(var_X, 3);
1926
+ } else {
1927
+ var_X = (var_X - 16.0 / 116.0) / 7.787;
1928
+ }
1929
+
1930
+ if (Math.pow(var_Z, 3) > 0.008856) {
1931
+ var_Z = Math.pow(var_Z, 3);
1932
+ } else {
1933
+ var_Z = (var_Z - 16.0 / 116.0) / 7.787;
1934
+ }
1935
+
1936
+ var ref_X = 0.9505;
1937
+ var ref_Y = 1.0;
1938
+ var ref_Z = 1.089;
1939
+ xyz[0] = ref_X * var_X; // ref_X = 0.9505 Observer= 2 deg Illuminant= D65
1940
+
1941
+ xyz[1] = ref_Y * var_Y; // ref_Y = 1.000
1942
+
1943
+ xyz[2] = ref_Z * var_Z; // ref_Z = 1.089
1944
+ }
1945
+ function xyz2lab(xyz, lab) {
1946
+ var _xyz = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(xyz, 3),
1947
+ x = _xyz[0],
1948
+ y = _xyz[1],
1949
+ z = _xyz[2];
1950
+
1951
+ var ref_X = 0.9505;
1952
+ var ref_Y = 1.0;
1953
+ var ref_Z = 1.089;
1954
+ var var_X = x / ref_X; // ref_X = 0.9505 Observer= 2 deg, Illuminant= D65
1955
+
1956
+ var var_Y = y / ref_Y; // ref_Y = 1.000
1957
+
1958
+ var var_Z = z / ref_Z; // ref_Z = 1.089
1959
+
1960
+ if (var_X > 0.008856) var_X = Math.pow(var_X, 1.0 / 3.0);else var_X = 7.787 * var_X + 16.0 / 116.0;
1961
+ if (var_Y > 0.008856) var_Y = Math.pow(var_Y, 1.0 / 3.0);else var_Y = 7.787 * var_Y + 16.0 / 116.0;
1962
+ if (var_Z > 0.008856) var_Z = Math.pow(var_Z, 1.0 / 3.0);else var_Z = 7.787 * var_Z + 16.0 / 116.0;
1963
+ lab[0] = 116 * var_Y - 16;
1964
+ lab[1] = 500 * (var_X - var_Y);
1965
+ lab[2] = 200 * (var_Y - var_Z);
1966
+ }
1967
+ function xyz2rgb(xyz, rgb) {
1968
+ var _xyz2 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(xyz, 3),
1969
+ x = _xyz2[0],
1970
+ y = _xyz2[1],
1971
+ z = _xyz2[2];
1972
+
1973
+ var r = x * 3.2406 + y * -1.5372 + z * -0.4986;
1974
+ var g = x * -0.9689 + y * 1.8758 + z * 0.0415;
1975
+ var b = x * 0.0557 + y * -0.204 + z * 1.057; // The following performs a "gamma correction" specified by the sRGB color
1976
+ // space. sRGB is defined by a canonical definition of a display monitor and
1977
+ // has been standardized by the International Electrotechnical Commission (IEC
1978
+ // 61966-2-1). The nonlinearity of the correction is designed to make the
1979
+ // colors more perceptually uniform. This color space has been adopted by
1980
+ // several applications including Adobe Photoshop and Microsoft Windows color
1981
+ // management. OpenGL is agnostic on its RGB color space, but it is reasonable
1982
+ // to assume it is close to this one.
1983
+
1984
+ if (r > 0.0031308) r = 1.055 * Math.pow(r, 1 / 2.4) - 0.055;else r *= 12.92;
1985
+ if (g > 0.0031308) g = 1.055 * Math.pow(g, 1 / 2.4) - 0.055;else g *= 12.92;
1986
+ if (b > 0.0031308) b = 1.055 * Math.pow(b, 1 / 2.4) - 0.055;else b *= 12.92; // Clip colors. ideally we would do something that is perceptually closest
1987
+ // (since we can see colors outside of the display gamut), but this seems to
1988
+ // work well enough.
1989
+
1990
+ var maxVal = r;
1991
+ if (maxVal < g) maxVal = g;
1992
+ if (maxVal < b) maxVal = b;
1993
+
1994
+ if (maxVal > 1.0) {
1995
+ r /= maxVal;
1996
+ g /= maxVal;
1997
+ b /= maxVal;
1998
+ }
1999
+
2000
+ if (r < 0) r = 0;
2001
+ if (g < 0) g = 0;
2002
+ if (b < 0) b = 0; // Push values back to array
2003
+
2004
+ rgb[0] = r;
2005
+ rgb[1] = g;
2006
+ rgb[2] = b;
2007
+ }
2008
+ function rgb2xyz(rgb, xyz) {
2009
+ var _rgb2 = (0,_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(rgb, 3),
2010
+ r = _rgb2[0],
2011
+ g = _rgb2[1],
2012
+ b = _rgb2[2]; // The following performs a "gamma correction" specified by the sRGB color
2013
+ // space. sRGB is defined by a canonical definition of a display monitor and
2014
+ // has been standardized by the International Electrotechnical Commission (IEC
2015
+ // 61966-2-1). The nonlinearity of the correction is designed to make the
2016
+ // colors more perceptually uniform. This color space has been adopted by
2017
+ // several applications including Adobe Photoshop and Microsoft Windows color
2018
+ // management. OpenGL is agnostic on its RGB color space, but it is reasonable
2019
+ // to assume it is close to this one.
2020
+
2021
+
2022
+ if (r > 0.04045) r = Math.pow((r + 0.055) / 1.055, 2.4);else r /= 12.92;
2023
+ if (g > 0.04045) g = Math.pow((g + 0.055) / 1.055, 2.4);else g /= 12.92;
2024
+ if (b > 0.04045) b = Math.pow((b + 0.055) / 1.055, 2.4);else b /= 12.92; // Observer. = 2 deg, Illuminant = D65
2025
+
2026
+ xyz[0] = r * 0.4124 + g * 0.3576 + b * 0.1805;
2027
+ xyz[1] = r * 0.2126 + g * 0.7152 + b * 0.0722;
2028
+ xyz[2] = r * 0.0193 + g * 0.1192 + b * 0.9505;
2029
+ }
2030
+ function rgb2lab(rgb, lab) {
2031
+ var xyz = [0, 0, 0];
2032
+ rgb2xyz(rgb, xyz);
2033
+ xyz2lab(xyz, lab);
2034
+ }
2035
+ function lab2rgb(lab, rgb) {
2036
+ var xyz = [0, 0, 0];
2037
+ lab2xyz(lab, xyz);
2038
+ xyz2rgb(xyz, rgb);
2039
+ }
2040
+ function uninitializeBounds(bounds) {
2041
+ bounds[0] = 1.0;
2042
+ bounds[1] = -1.0;
2043
+ bounds[2] = 1.0;
2044
+ bounds[3] = -1.0;
2045
+ bounds[4] = 1.0;
2046
+ bounds[5] = -1.0;
2047
+ return bounds;
2048
+ }
2049
+ function areBoundsInitialized(bounds) {
2050
+ return !(bounds[1] - bounds[0] < 0.0);
2051
+ }
2052
+ /**
2053
+ * @deprecated please use vtkBoundingBox.addPoints(vtkBoundingBox.reset([]), points)
2054
+ */
2055
+
2056
+ function computeBoundsFromPoints(point1, point2, bounds) {
2057
+ bounds[0] = Math.min(point1[0], point2[0]);
2058
+ bounds[1] = Math.max(point1[0], point2[0]);
2059
+ bounds[2] = Math.min(point1[1], point2[1]);
2060
+ bounds[3] = Math.max(point1[1], point2[1]);
2061
+ bounds[4] = Math.min(point1[2], point2[2]);
2062
+ bounds[5] = Math.max(point1[2], point2[2]);
2063
+ return bounds;
2064
+ }
2065
+ function clampValue(value, minValue, maxValue) {
2066
+ if (value < minValue) {
2067
+ return minValue;
2068
+ }
2069
+
2070
+ if (value > maxValue) {
2071
+ return maxValue;
2072
+ }
2073
+
2074
+ return value;
2075
+ }
2076
+ function clampVector(vector, minVector, maxVector) {
2077
+ var out = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [0, 0, 0];
2078
+ out[0] = clampValue(vector[0], minVector[0], maxVector[0]);
2079
+ out[1] = clampValue(vector[1], minVector[1], maxVector[1]);
2080
+ out[2] = clampValue(vector[2], minVector[2], maxVector[2]);
2081
+ return out;
2082
+ }
2083
+ function clampAndNormalizeValue(value, range) {
2084
+ var result = 0;
2085
+
2086
+ if (range[0] !== range[1]) {
2087
+ // clamp
2088
+ if (value < range[0]) {
2089
+ result = range[0];
2090
+ } else if (value > range[1]) {
2091
+ result = range[1];
2092
+ } else {
2093
+ result = value;
2094
+ } // normalize
2095
+
2096
+
2097
+ result = (result - range[0]) / (range[1] - range[0]);
2098
+ }
2099
+
2100
+ return result;
2101
+ }
2102
+ var getScalarTypeFittingRange = notImplemented('GetScalarTypeFittingRange');
2103
+ var getAdjustedScalarRange = notImplemented('GetAdjustedScalarRange');
2104
+ function extentIsWithinOtherExtent(extent1, extent2) {
2105
+ if (!extent1 || !extent2) {
2106
+ return 0;
2107
+ }
2108
+
2109
+ for (var i = 0; i < 6; i += 2) {
2110
+ if (extent1[i] < extent2[i] || extent1[i] > extent2[i + 1] || extent1[i + 1] < extent2[i] || extent1[i + 1] > extent2[i + 1]) {
2111
+ return 0;
2112
+ }
2113
+ }
2114
+
2115
+ return 1;
2116
+ }
2117
+ function boundsIsWithinOtherBounds(bounds1_6, bounds2_6, delta_3) {
2118
+ if (!bounds1_6 || !bounds2_6) {
2119
+ return 0;
2120
+ }
2121
+
2122
+ for (var i = 0; i < 6; i += 2) {
2123
+ if (bounds1_6[i] + delta_3[i / 2] < bounds2_6[i] || bounds1_6[i] - delta_3[i / 2] > bounds2_6[i + 1] || bounds1_6[i + 1] + delta_3[i / 2] < bounds2_6[i] || bounds1_6[i + 1] - delta_3[i / 2] > bounds2_6[i + 1]) {
2124
+ return 0;
2125
+ }
2126
+ }
2127
+
2128
+ return 1;
2129
+ }
2130
+ function pointIsWithinBounds(point_3, bounds_6, delta_3) {
2131
+ if (!point_3 || !bounds_6 || !delta_3) {
2132
+ return 0;
2133
+ }
2134
+
2135
+ for (var i = 0; i < 3; i++) {
2136
+ if (point_3[i] + delta_3[i] < bounds_6[2 * i] || point_3[i] - delta_3[i] > bounds_6[2 * i + 1]) {
2137
+ return 0;
2138
+ }
2139
+ }
2140
+
2141
+ return 1;
2142
+ }
2143
+ function solve3PointCircle(p1, p2, p3, center) {
2144
+ var v21 = createArray(3);
2145
+ var v32 = createArray(3);
2146
+ var v13 = createArray(3);
2147
+ var v12 = createArray(3);
2148
+ var v23 = createArray(3);
2149
+ var v31 = createArray(3);
2150
+
2151
+ for (var i = 0; i < 3; ++i) {
2152
+ v21[i] = p1[i] - p2[i];
2153
+ v32[i] = p2[i] - p3[i];
2154
+ v13[i] = p3[i] - p1[i];
2155
+ v12[i] = -v21[i];
2156
+ v23[i] = -v32[i];
2157
+ v31[i] = -v13[i];
2158
+ }
2159
+
2160
+ var norm12 = norm(v12);
2161
+ var norm23 = norm(v23);
2162
+ var norm13 = norm(v13);
2163
+ var crossv21v32 = createArray(3);
2164
+ cross(v21, v32, crossv21v32);
2165
+ var normCross = norm(crossv21v32);
2166
+ var radius = norm12 * norm23 * norm13 / (2 * normCross);
2167
+ var normCross22 = 2 * normCross * normCross;
2168
+ var alpha = norm23 * norm23 * dot(v21, v31) / normCross22;
2169
+ var beta = norm13 * norm13 * dot(v12, v32) / normCross22;
2170
+ var gamma = norm12 * norm12 * dot(v13, v23) / normCross22;
2171
+
2172
+ for (var _i6 = 0; _i6 < 3; ++_i6) {
2173
+ center[_i6] = alpha * p1[_i6] + beta * p2[_i6] + gamma * p3[_i6];
2174
+ }
2175
+
2176
+ return radius;
2177
+ }
2178
+ var inf = Infinity;
2179
+ var negInf = -Infinity;
2180
+ var isInf = function isInf(value) {
2181
+ return !Number.isFinite(value);
2182
+ };
2183
+ var isFinite = Number.isFinite,
2184
+ isNaN = Number.isNaN;
2185
+ var isNan = isNaN; // JavaScript - add-on ----------------------
2186
+
2187
+ function createUninitializedBounds() {
2188
+ return [].concat([Number.MAX_VALUE, -Number.MAX_VALUE, // X
2189
+ Number.MAX_VALUE, -Number.MAX_VALUE, // Y
2190
+ Number.MAX_VALUE, -Number.MAX_VALUE // Z
2191
+ ]);
2192
+ }
2193
+ function getMajorAxisIndex(vector) {
2194
+ var maxValue = -1;
2195
+ var axisIndex = -1;
2196
+
2197
+ for (var i = 0; i < vector.length; i++) {
2198
+ var value = Math.abs(vector[i]);
2199
+
2200
+ if (value > maxValue) {
2201
+ axisIndex = i;
2202
+ maxValue = value;
2203
+ }
2204
+ }
2205
+
2206
+ return axisIndex;
2207
+ }
2208
+ function floatToHex2(value) {
2209
+ var integer = Math.floor(value * 255);
2210
+
2211
+ if (integer > 15) {
2212
+ return integer.toString(16);
2213
+ }
2214
+
2215
+ return "0".concat(integer.toString(16));
2216
+ }
2217
+ function floatRGB2HexCode(rgbArray) {
2218
+ var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '#';
2219
+ return "".concat(prefix).concat(rgbArray.map(floatToHex2).join(''));
2220
+ }
2221
+
2222
+ function floatToChar(f) {
2223
+ return Math.round(f * 255);
2224
+ }
2225
+
2226
+ function float2CssRGBA(rgbArray) {
2227
+ if (rgbArray.length === 3) {
2228
+ return "rgb(".concat(rgbArray.map(floatToChar).join(', '), ")");
2229
+ }
2230
+
2231
+ return "rgba(".concat(floatToChar(rgbArray[0] || 0), ", ").concat(floatToChar(rgbArray[1] || 0), ", ").concat(floatToChar(rgbArray[2] || 0), ", ").concat(rgbArray[3] || 0, ")");
2232
+ } // ----------------------------------------------------------------------------
2233
+ // Only Static API
2234
+ // ----------------------------------------------------------------------------
2235
+
2236
+ var vtkMath = {
2237
+ Pi: Pi,
2238
+ radiansFromDegrees: radiansFromDegrees,
2239
+ degreesFromRadians: degreesFromRadians,
2240
+ round: round,
2241
+ floor: floor,
2242
+ ceil: ceil,
2243
+ ceilLog2: ceilLog2,
2244
+ min: min,
2245
+ max: max,
2246
+ arrayMin: arrayMin,
2247
+ arrayMax: arrayMax,
2248
+ arrayRange: arrayRange,
2249
+ isPowerOfTwo: isPowerOfTwo,
2250
+ nearestPowerOfTwo: nearestPowerOfTwo,
2251
+ factorial: factorial,
2252
+ binomial: binomial,
2253
+ beginCombination: beginCombination,
2254
+ nextCombination: nextCombination,
2255
+ randomSeed: randomSeed,
2256
+ getSeed: getSeed,
2257
+ random: random,
2258
+ gaussian: gaussian,
2259
+ add: add,
2260
+ subtract: subtract,
2261
+ multiplyScalar: multiplyScalar,
2262
+ multiplyScalar2D: multiplyScalar2D,
2263
+ multiplyAccumulate: multiplyAccumulate,
2264
+ multiplyAccumulate2D: multiplyAccumulate2D,
2265
+ dot: dot,
2266
+ outer: outer,
2267
+ cross: cross,
2268
+ norm: norm,
2269
+ normalize: normalize,
2270
+ perpendiculars: perpendiculars,
2271
+ projectVector: projectVector,
2272
+ projectVector2D: projectVector2D,
2273
+ distance2BetweenPoints: distance2BetweenPoints,
2274
+ angleBetweenVectors: angleBetweenVectors,
2275
+ gaussianAmplitude: gaussianAmplitude,
2276
+ gaussianWeight: gaussianWeight,
2277
+ dot2D: dot2D,
2278
+ outer2D: outer2D,
2279
+ norm2D: norm2D,
2280
+ normalize2D: normalize2D,
2281
+ determinant2x2: determinant2x2,
2282
+ LUFactor3x3: LUFactor3x3,
2283
+ LUSolve3x3: LUSolve3x3,
2284
+ linearSolve3x3: linearSolve3x3,
2285
+ multiply3x3_vect3: multiply3x3_vect3,
2286
+ multiply3x3_mat3: multiply3x3_mat3,
2287
+ multiplyMatrix: multiplyMatrix,
2288
+ transpose3x3: transpose3x3,
2289
+ invert3x3: invert3x3,
2290
+ identity3x3: identity3x3,
2291
+ identity: identity,
2292
+ isIdentity: isIdentity,
2293
+ isIdentity3x3: isIdentity3x3,
2294
+ determinant3x3: determinant3x3,
2295
+ quaternionToMatrix3x3: quaternionToMatrix3x3,
2296
+ areEquals: areEquals,
2297
+ areMatricesEqual: areMatricesEqual,
2298
+ roundNumber: roundNumber,
2299
+ roundVector: roundVector,
2300
+ matrix3x3ToQuaternion: matrix3x3ToQuaternion,
2301
+ multiplyQuaternion: multiplyQuaternion,
2302
+ orthogonalize3x3: orthogonalize3x3,
2303
+ diagonalize3x3: diagonalize3x3,
2304
+ singularValueDecomposition3x3: singularValueDecomposition3x3,
2305
+ solveLinearSystem: solveLinearSystem,
2306
+ invertMatrix: invertMatrix,
2307
+ luFactorLinearSystem: luFactorLinearSystem,
2308
+ luSolveLinearSystem: luSolveLinearSystem,
2309
+ estimateMatrixCondition: estimateMatrixCondition,
2310
+ jacobi: jacobi,
2311
+ jacobiN: jacobiN,
2312
+ solveHomogeneousLeastSquares: solveHomogeneousLeastSquares,
2313
+ solveLeastSquares: solveLeastSquares,
2314
+ hex2float: hex2float,
2315
+ rgb2hsv: rgb2hsv,
2316
+ hsv2rgb: hsv2rgb,
2317
+ lab2xyz: lab2xyz,
2318
+ xyz2lab: xyz2lab,
2319
+ xyz2rgb: xyz2rgb,
2320
+ rgb2xyz: rgb2xyz,
2321
+ rgb2lab: rgb2lab,
2322
+ lab2rgb: lab2rgb,
2323
+ uninitializeBounds: uninitializeBounds,
2324
+ areBoundsInitialized: areBoundsInitialized,
2325
+ computeBoundsFromPoints: computeBoundsFromPoints,
2326
+ clampValue: clampValue,
2327
+ clampVector: clampVector,
2328
+ clampAndNormalizeValue: clampAndNormalizeValue,
2329
+ getScalarTypeFittingRange: getScalarTypeFittingRange,
2330
+ getAdjustedScalarRange: getAdjustedScalarRange,
2331
+ extentIsWithinOtherExtent: extentIsWithinOtherExtent,
2332
+ boundsIsWithinOtherBounds: boundsIsWithinOtherBounds,
2333
+ pointIsWithinBounds: pointIsWithinBounds,
2334
+ solve3PointCircle: solve3PointCircle,
2335
+ inf: inf,
2336
+ negInf: negInf,
2337
+ isInf: isInf,
2338
+ isNan: isNaN,
2339
+ isNaN: isNaN,
2340
+ isFinite: isFinite,
2341
+ // JS add-on
2342
+ createUninitializedBounds: createUninitializedBounds,
2343
+ getMajorAxisIndex: getMajorAxisIndex,
2344
+ floatToHex2: floatToHex2,
2345
+ floatRGB2HexCode: floatRGB2HexCode,
2346
+ float2CssRGBA: float2CssRGBA
2347
+ };
2348
+
2349
+ var vtkMath$1 = /*#__PURE__*/Object.freeze({
2350
+ __proto__: null,
2351
+ createArray: createArray,
2352
+ Pi: Pi,
2353
+ radiansFromDegrees: radiansFromDegrees,
2354
+ degreesFromRadians: degreesFromRadians,
2355
+ round: round,
2356
+ floor: floor,
2357
+ ceil: ceil,
2358
+ min: min,
2359
+ max: max,
2360
+ arrayMin: arrayMin,
2361
+ arrayMax: arrayMax,
2362
+ arrayRange: arrayRange,
2363
+ ceilLog2: ceilLog2,
2364
+ factorial: factorial,
2365
+ nearestPowerOfTwo: nearestPowerOfTwo,
2366
+ isPowerOfTwo: isPowerOfTwo,
2367
+ binomial: binomial,
2368
+ beginCombination: beginCombination,
2369
+ nextCombination: nextCombination,
2370
+ randomSeed: randomSeed,
2371
+ getSeed: getSeed,
2372
+ random: random,
2373
+ gaussian: gaussian,
2374
+ add: add,
2375
+ subtract: subtract,
2376
+ multiplyScalar: multiplyScalar,
2377
+ multiplyScalar2D: multiplyScalar2D,
2378
+ multiplyAccumulate: multiplyAccumulate,
2379
+ multiplyAccumulate2D: multiplyAccumulate2D,
2380
+ dot: dot,
2381
+ outer: outer,
2382
+ cross: cross,
2383
+ norm: norm,
2384
+ normalize: normalize,
2385
+ perpendiculars: perpendiculars,
2386
+ projectVector: projectVector,
2387
+ dot2D: dot2D,
2388
+ projectVector2D: projectVector2D,
2389
+ distance2BetweenPoints: distance2BetweenPoints,
2390
+ angleBetweenVectors: angleBetweenVectors,
2391
+ signedAngleBetweenVectors: signedAngleBetweenVectors,
2392
+ gaussianAmplitude: gaussianAmplitude,
2393
+ gaussianWeight: gaussianWeight,
2394
+ outer2D: outer2D,
2395
+ norm2D: norm2D,
2396
+ normalize2D: normalize2D,
2397
+ rowsToMat4: rowsToMat4,
2398
+ columnsToMat4: columnsToMat4,
2399
+ rowsToMat3: rowsToMat3,
2400
+ columnsToMat3: columnsToMat3,
2401
+ determinant2x2: determinant2x2,
2402
+ LUFactor3x3: LUFactor3x3,
2403
+ LUSolve3x3: LUSolve3x3,
2404
+ linearSolve3x3: linearSolve3x3,
2405
+ multiply3x3_vect3: multiply3x3_vect3,
2406
+ multiply3x3_mat3: multiply3x3_mat3,
2407
+ multiplyMatrix: multiplyMatrix,
2408
+ transpose3x3: transpose3x3,
2409
+ invert3x3: invert3x3,
2410
+ determinant3x3: determinant3x3,
2411
+ areEquals: areEquals,
2412
+ areMatricesEqual: areMatricesEqual,
2413
+ identity3x3: identity3x3,
2414
+ identity: identity,
2415
+ isIdentity: isIdentity,
2416
+ isIdentity3x3: isIdentity3x3,
2417
+ quaternionToMatrix3x3: quaternionToMatrix3x3,
2418
+ roundNumber: roundNumber,
2419
+ roundVector: roundVector,
2420
+ jacobiN: jacobiN,
2421
+ matrix3x3ToQuaternion: matrix3x3ToQuaternion,
2422
+ multiplyQuaternion: multiplyQuaternion,
2423
+ orthogonalize3x3: orthogonalize3x3,
2424
+ diagonalize3x3: diagonalize3x3,
2425
+ singularValueDecomposition3x3: singularValueDecomposition3x3,
2426
+ luFactorLinearSystem: luFactorLinearSystem,
2427
+ luSolveLinearSystem: luSolveLinearSystem,
2428
+ solveLinearSystem: solveLinearSystem,
2429
+ invertMatrix: invertMatrix,
2430
+ estimateMatrixCondition: estimateMatrixCondition,
2431
+ jacobi: jacobi,
2432
+ solveHomogeneousLeastSquares: solveHomogeneousLeastSquares,
2433
+ solveLeastSquares: solveLeastSquares,
2434
+ hex2float: hex2float,
2435
+ rgb2hsv: rgb2hsv,
2436
+ hsv2rgb: hsv2rgb,
2437
+ lab2xyz: lab2xyz,
2438
+ xyz2lab: xyz2lab,
2439
+ xyz2rgb: xyz2rgb,
2440
+ rgb2xyz: rgb2xyz,
2441
+ rgb2lab: rgb2lab,
2442
+ lab2rgb: lab2rgb,
2443
+ uninitializeBounds: uninitializeBounds,
2444
+ areBoundsInitialized: areBoundsInitialized,
2445
+ computeBoundsFromPoints: computeBoundsFromPoints,
2446
+ clampValue: clampValue,
2447
+ clampVector: clampVector,
2448
+ clampAndNormalizeValue: clampAndNormalizeValue,
2449
+ getScalarTypeFittingRange: getScalarTypeFittingRange,
2450
+ getAdjustedScalarRange: getAdjustedScalarRange,
2451
+ extentIsWithinOtherExtent: extentIsWithinOtherExtent,
2452
+ boundsIsWithinOtherBounds: boundsIsWithinOtherBounds,
2453
+ pointIsWithinBounds: pointIsWithinBounds,
2454
+ solve3PointCircle: solve3PointCircle,
2455
+ inf: inf,
2456
+ negInf: negInf,
2457
+ isInf: isInf,
2458
+ isFinite: isFinite,
2459
+ isNaN: isNaN,
2460
+ isNan: isNan,
2461
+ createUninitializedBounds: createUninitializedBounds,
2462
+ getMajorAxisIndex: getMajorAxisIndex,
2463
+ floatToHex2: floatToHex2,
2464
+ floatRGB2HexCode: floatRGB2HexCode,
2465
+ float2CssRGBA: float2CssRGBA,
2466
+ 'default': vtkMath
2467
+ });
2468
+
2469
+
2470
+
2471
+
2472
+ /***/ }),
2473
+
2474
+ /***/ 91924:
2475
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2476
+
2477
+
2478
+ // EXPORTS
2479
+ __webpack_require__.d(__webpack_exports__, {
2480
+ "Uw": () => (/* binding */ algo),
2481
+ "tS": () => (/* binding */ chain),
2482
+ "default": () => (/* binding */ macro),
2483
+ "U2": () => (/* binding */ get),
2484
+ "c$": () => (/* binding */ getArray),
2485
+ "B6": () => (/* binding */ moveToProtected),
2486
+ "WL": () => (/* binding */ newInstance),
2487
+ "B5": () => (/* binding */ newTypedArray),
2488
+ "MR": () => (/* binding */ newTypedArrayFrom),
2489
+ "j6": () => (/* binding */ obj),
2490
+ "t8": () => (/* binding */ set),
2491
+ "g2": () => (/* binding */ setGet),
2492
+ "DV": () => (/* binding */ setGetArray),
2493
+ "eR": () => (/* binding */ vtkDebugMacro),
2494
+ "E0": () => (/* binding */ vtkErrorMacro),
2495
+ "t7": () => (/* binding */ vtkWarningMacro)
2496
+ });
2497
+
2498
+ // UNUSED EXPORTS: EVENT_ABORT, TYPED_ARRAYS, VOID, _capitalize, capitalize, debounce, event, formatBytesToProperUnit, formatNumbersWithThousandSeparator, isVtkObject, keystore, measurePromiseExecution, normalizeWheel, proxy, proxyPropertyMapping, proxyPropertyState, setArray, setImmediateVTK, setLoggerFunction, throttle, traverseInstanceTree, uncapitalize, vtkInfoMacro, vtkLogMacro, vtkOnceErrorMacro
2499
+
2500
+ // EXTERNAL MODULE: ../../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 3 modules
2501
+ var slicedToArray = __webpack_require__(92577);
2502
+ // EXTERNAL MODULE: ../../../node_modules/@babel/runtime/helpers/esm/typeof.js
2503
+ var esm_typeof = __webpack_require__(36655);
2504
+ // EXTERNAL MODULE: ../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
2505
+ var defineProperty = __webpack_require__(47169);
2506
+ // EXTERNAL MODULE: ../../../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 3 modules
2507
+ var toConsumableArray = __webpack_require__(21930);
2508
+ // EXTERNAL MODULE: ../../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
2509
+ var setPrototypeOf = __webpack_require__(45901);
2510
+ ;// CONCATENATED MODULE: ../../../node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js
2511
+ function _isNativeReflectConstruct() {
2512
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
2513
+ if (Reflect.construct.sham) return false;
2514
+ if (typeof Proxy === "function") return true;
2515
+ try {
2516
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
2517
+ return true;
2518
+ } catch (e) {
2519
+ return false;
2520
+ }
2521
+ }
2522
+ ;// CONCATENATED MODULE: ../../../node_modules/@babel/runtime/helpers/esm/construct.js
2523
+
2524
+
2525
+ function _construct(Parent, args, Class) {
2526
+ if (_isNativeReflectConstruct()) {
2527
+ _construct = Reflect.construct.bind();
2528
+ } else {
2529
+ _construct = function _construct(Parent, args, Class) {
2530
+ var a = [null];
2531
+ a.push.apply(a, args);
2532
+ var Constructor = Function.bind.apply(Parent, a);
2533
+ var instance = new Constructor();
2534
+ if (Class) (0,setPrototypeOf/* default */.Z)(instance, Class.prototype);
2535
+ return instance;
2536
+ };
2537
+ }
2538
+ return _construct.apply(null, arguments);
2539
+ }
2540
+ // EXTERNAL MODULE: ../../../node_modules/fast-deep-equal/index.js
2541
+ var fast_deep_equal = __webpack_require__(39507);
2542
+ var fast_deep_equal_default = /*#__PURE__*/__webpack_require__.n(fast_deep_equal);
2543
+ // EXTERNAL MODULE: ../../../node_modules/@kitware/vtk.js/vtk.js
2544
+ var vtk = __webpack_require__(88095);
2545
+ // EXTERNAL MODULE: ../../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js
2546
+ var classCallCheck = __webpack_require__(8821);
2547
+ // EXTERNAL MODULE: ../../../node_modules/@babel/runtime/helpers/esm/createClass.js
2548
+ var createClass = __webpack_require__(85169);
2549
+ // EXTERNAL MODULE: ../../../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
2550
+ var getPrototypeOf = __webpack_require__(2312);
2551
+ ;// CONCATENATED MODULE: ../../../node_modules/@babel/runtime/helpers/esm/superPropBase.js
2552
+
2553
+ function _superPropBase(object, property) {
2554
+ while (!Object.prototype.hasOwnProperty.call(object, property)) {
2555
+ object = (0,getPrototypeOf/* default */.Z)(object);
2556
+ if (object === null) break;
2557
+ }
2558
+ return object;
2559
+ }
2560
+ ;// CONCATENATED MODULE: ../../../node_modules/@babel/runtime/helpers/esm/get.js
2561
+
2562
+ function _get() {
2563
+ if (typeof Reflect !== "undefined" && Reflect.get) {
2564
+ _get = Reflect.get.bind();
2565
+ } else {
2566
+ _get = function _get(target, property, receiver) {
2567
+ var base = _superPropBase(target, property);
2568
+ if (!base) return;
2569
+ var desc = Object.getOwnPropertyDescriptor(base, property);
2570
+ if (desc.get) {
2571
+ return desc.get.call(arguments.length < 3 ? target : receiver);
2572
+ }
2573
+ return desc.value;
2574
+ };
2575
+ }
2576
+ return _get.apply(this, arguments);
2577
+ }
2578
+ // EXTERNAL MODULE: ../../../node_modules/@babel/runtime/helpers/esm/inherits.js
2579
+ var inherits = __webpack_require__(82248);
2580
+ // EXTERNAL MODULE: ../../../node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
2581
+ var possibleConstructorReturn = __webpack_require__(17245);
2582
+ ;// CONCATENATED MODULE: ../../../node_modules/@babel/runtime/helpers/esm/isNativeFunction.js
2583
+ function _isNativeFunction(fn) {
2584
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
2585
+ }
2586
+ ;// CONCATENATED MODULE: ../../../node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
2587
+
2588
+
2589
+
2590
+
2591
+ function _wrapNativeSuper(Class) {
2592
+ var _cache = typeof Map === "function" ? new Map() : undefined;
2593
+ _wrapNativeSuper = function _wrapNativeSuper(Class) {
2594
+ if (Class === null || !_isNativeFunction(Class)) return Class;
2595
+ if (typeof Class !== "function") {
2596
+ throw new TypeError("Super expression must either be null or a function");
2597
+ }
2598
+ if (typeof _cache !== "undefined") {
2599
+ if (_cache.has(Class)) return _cache.get(Class);
2600
+ _cache.set(Class, Wrapper);
2601
+ }
2602
+ function Wrapper() {
2603
+ return _construct(Class, arguments, (0,getPrototypeOf/* default */.Z)(this).constructor);
2604
+ }
2605
+ Wrapper.prototype = Object.create(Class.prototype, {
2606
+ constructor: {
2607
+ value: Wrapper,
2608
+ enumerable: false,
2609
+ writable: true,
2610
+ configurable: true
2611
+ }
2612
+ });
2613
+ return (0,setPrototypeOf/* default */.Z)(Wrapper, Class);
2614
+ };
2615
+ return _wrapNativeSuper(Class);
2616
+ }
2617
+ ;// CONCATENATED MODULE: ../../../node_modules/@kitware/vtk.js/Common/Core/ClassHierarchy.js
2618
+
2619
+
2620
+
2621
+
2622
+
2623
+
2624
+
2625
+
2626
+ function _createSuper(Derived) { var hasNativeReflectConstruct = ClassHierarchy_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0,getPrototypeOf/* default */.Z)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0,getPrototypeOf/* default */.Z)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0,possibleConstructorReturn/* default */.Z)(this, result); }; }
2627
+
2628
+ function ClassHierarchy_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
2629
+
2630
+ /* eslint-disable prefer-rest-params */
2631
+ var ClassHierarchy = /*#__PURE__*/function (_Array) {
2632
+ (0,inherits/* default */.Z)(ClassHierarchy, _Array);
2633
+
2634
+ var _super = _createSuper(ClassHierarchy);
2635
+
2636
+ function ClassHierarchy() {
2637
+ (0,classCallCheck/* default */.Z)(this, ClassHierarchy);
2638
+
2639
+ return _super.apply(this, arguments);
2640
+ }
2641
+
2642
+ (0,createClass/* default */.Z)(ClassHierarchy, [{
2643
+ key: "push",
2644
+ value: function push() {
2645
+ for (var i = 0; i < arguments.length; i++) {
2646
+ if (!this.includes(arguments[i])) {
2647
+ _get((0,getPrototypeOf/* default */.Z)(ClassHierarchy.prototype), "push", this).call(this, arguments[i]);
2648
+ }
2649
+ }
2650
+
2651
+ return this.length;
2652
+ }
2653
+ }]);
2654
+
2655
+ return ClassHierarchy;
2656
+ }( /*#__PURE__*/_wrapNativeSuper(Array));
2657
+
2658
+
2659
+
2660
+ ;// CONCATENATED MODULE: ../../../node_modules/@kitware/vtk.js/macros.js
2661
+
2662
+
2663
+
2664
+
2665
+
2666
+
2667
+
2668
+
2669
+
2670
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2671
+
2672
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0,defineProperty/* default */.Z)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2673
+ var globalMTime = 0;
2674
+ var VOID = Symbol('void');
2675
+
2676
+ function getCurrentGlobalMTime() {
2677
+ return globalMTime;
2678
+ } // ----------------------------------------------------------------------------
2679
+ // Logging function calls
2680
+ // ----------------------------------------------------------------------------
2681
+
2682
+ /* eslint-disable no-prototype-builtins */
2683
+
2684
+
2685
+ var fakeConsole = {};
2686
+
2687
+ function noOp() {}
2688
+
2689
+ var consoleMethods = ['log', 'debug', 'info', 'warn', 'error', 'time', 'timeEnd', 'group', 'groupEnd'];
2690
+ consoleMethods.forEach(function (methodName) {
2691
+ fakeConsole[methodName] = noOp;
2692
+ });
2693
+ vtk/* vtkGlobal.console */.I.console = console.hasOwnProperty('log') ? console : fakeConsole;
2694
+ var loggerFunctions = {
2695
+ debug: noOp,
2696
+ // Don't print debug by default
2697
+ error: vtk/* vtkGlobal.console.error */.I.console.error || noOp,
2698
+ info: vtk/* vtkGlobal.console.info */.I.console.info || noOp,
2699
+ log: vtk/* vtkGlobal.console.log */.I.console.log || noOp,
2700
+ warn: vtk/* vtkGlobal.console.warn */.I.console.warn || noOp
2701
+ };
2702
+ function setLoggerFunction(name, fn) {
2703
+ if (loggerFunctions[name]) {
2704
+ loggerFunctions[name] = fn || noOp;
2705
+ }
2706
+ }
2707
+ function vtkLogMacro() {
2708
+ loggerFunctions.log.apply(loggerFunctions, arguments);
2709
+ }
2710
+ function vtkInfoMacro() {
2711
+ loggerFunctions.info.apply(loggerFunctions, arguments);
2712
+ }
2713
+ function vtkDebugMacro() {
2714
+ loggerFunctions.debug.apply(loggerFunctions, arguments);
2715
+ }
2716
+ function vtkErrorMacro() {
2717
+ loggerFunctions.error.apply(loggerFunctions, arguments);
2718
+ }
2719
+ function vtkWarningMacro() {
2720
+ loggerFunctions.warn.apply(loggerFunctions, arguments);
2721
+ }
2722
+ var ERROR_ONCE_MAP = {};
2723
+ function vtkOnceErrorMacro(str) {
2724
+ if (!ERROR_ONCE_MAP[str]) {
2725
+ loggerFunctions.error(str);
2726
+ ERROR_ONCE_MAP[str] = true;
2727
+ }
2728
+ } // ----------------------------------------------------------------------------
2729
+ // TypedArray
2730
+ // ----------------------------------------------------------------------------
2731
+
2732
+ var TYPED_ARRAYS = Object.create(null);
2733
+ TYPED_ARRAYS.Float32Array = Float32Array;
2734
+ TYPED_ARRAYS.Float64Array = Float64Array;
2735
+ TYPED_ARRAYS.Uint8Array = Uint8Array;
2736
+ TYPED_ARRAYS.Int8Array = Int8Array;
2737
+ TYPED_ARRAYS.Uint16Array = Uint16Array;
2738
+ TYPED_ARRAYS.Int16Array = Int16Array;
2739
+ TYPED_ARRAYS.Uint32Array = Uint32Array;
2740
+ TYPED_ARRAYS.Int32Array = Int32Array;
2741
+ TYPED_ARRAYS.Uint8ClampedArray = Uint8ClampedArray;
2742
+
2743
+ try {
2744
+ TYPED_ARRAYS.BigInt64Array = BigInt64Array;
2745
+ TYPED_ARRAYS.BigUint64Array = BigUint64Array;
2746
+ } catch (_unused) {// ignore
2747
+ }
2748
+
2749
+ function newTypedArray(type) {
2750
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2751
+ args[_key - 1] = arguments[_key];
2752
+ }
2753
+
2754
+ return _construct(TYPED_ARRAYS[type] || Float64Array, args);
2755
+ }
2756
+ function newTypedArrayFrom(type) {
2757
+ var _ref;
2758
+
2759
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2760
+ args[_key2 - 1] = arguments[_key2];
2761
+ }
2762
+
2763
+ return (_ref = TYPED_ARRAYS[type] || Float64Array).from.apply(_ref, args);
2764
+ } // ----------------------------------------------------------------------------
2765
+ // capitilize provided string
2766
+ // ----------------------------------------------------------------------------
2767
+
2768
+ function capitalize(str) {
2769
+ return str.charAt(0).toUpperCase() + str.slice(1);
2770
+ }
2771
+ function _capitalize(str) {
2772
+ return capitalize(str[0] === '_' ? str.slice(1) : str);
2773
+ }
2774
+ function uncapitalize(str) {
2775
+ return str.charAt(0).toLowerCase() + str.slice(1);
2776
+ } // ----------------------------------------------------------------------------
2777
+ // Convert byte size into a well formatted string
2778
+ // ----------------------------------------------------------------------------
2779
+
2780
+ function formatBytesToProperUnit(size) {
2781
+ var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
2782
+ var chunkSize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1000;
2783
+ var units = ['TB', 'GB', 'MB', 'KB'];
2784
+ var value = Number(size);
2785
+ var currentUnit = 'B';
2786
+
2787
+ while (value > chunkSize) {
2788
+ value /= chunkSize;
2789
+ currentUnit = units.pop();
2790
+ }
2791
+
2792
+ return "".concat(value.toFixed(precision), " ").concat(currentUnit);
2793
+ } // ----------------------------------------------------------------------------
2794
+ // Convert thousand number with proper separator
2795
+ // ----------------------------------------------------------------------------
2796
+
2797
+ function formatNumbersWithThousandSeparator(n) {
2798
+ var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' ';
2799
+ var sections = [];
2800
+ var size = n;
2801
+
2802
+ while (size > 1000) {
2803
+ sections.push("000".concat(size % 1000).slice(-3));
2804
+ size = Math.floor(size / 1000);
2805
+ }
2806
+
2807
+ if (size > 0) {
2808
+ sections.push(size);
2809
+ }
2810
+
2811
+ sections.reverse();
2812
+ return sections.join(separator);
2813
+ } // ----------------------------------------------------------------------------
2814
+ // Array helper
2815
+ // ----------------------------------------------------------------------------
2816
+
2817
+ function safeArrays(model) {
2818
+ Object.keys(model).forEach(function (key) {
2819
+ if (Array.isArray(model[key])) {
2820
+ model[key] = [].concat(model[key]);
2821
+ }
2822
+ });
2823
+ } // ----------------------------------------------------------------------------
2824
+ // shallow equals
2825
+ // ----------------------------------------------------------------------------
2826
+
2827
+
2828
+ function shallowEquals(a, b) {
2829
+ if (a === b) {
2830
+ return true;
2831
+ }
2832
+
2833
+ if (Array.isArray(a) && Array.isArray(b)) {
2834
+ if (a.length !== b.length) {
2835
+ return false;
2836
+ }
2837
+
2838
+ for (var i = 0; i < a.length; i++) {
2839
+ if (a[i] !== b[i]) {
2840
+ return false;
2841
+ }
2842
+ }
2843
+
2844
+ return true;
2845
+ }
2846
+
2847
+ return false;
2848
+ } // ----------------------------------------------------------------------------
2849
+
2850
+
2851
+ function enumToString(e, value) {
2852
+ return Object.keys(e).find(function (key) {
2853
+ return e[key] === value;
2854
+ });
2855
+ }
2856
+
2857
+ function getStateArrayMapFunc(item) {
2858
+ if (item && item.isA) {
2859
+ return item.getState();
2860
+ }
2861
+
2862
+ return item;
2863
+ } // ----------------------------------------------------------------------------
2864
+ // setImmediate
2865
+ // ----------------------------------------------------------------------------
2866
+
2867
+
2868
+ function setImmediateVTK(fn) {
2869
+ setTimeout(fn, 0);
2870
+ } // ----------------------------------------------------------------------------
2871
+ // measurePromiseExecution
2872
+ //
2873
+ // Measures the time it takes for a promise to finish from
2874
+ // the time this function is invoked.
2875
+ // The callback receives the time it took for the promise to resolve or reject.
2876
+ // ----------------------------------------------------------------------------
2877
+
2878
+ function measurePromiseExecution(promise, callback) {
2879
+ var start = performance.now();
2880
+ promise.finally(function () {
2881
+ var delta = performance.now() - start;
2882
+ callback(delta);
2883
+ });
2884
+ } // ----------------------------------------------------------------------------
2885
+ // vtkObject: modified(), onModified(callback), delete()
2886
+ // ----------------------------------------------------------------------------
2887
+
2888
+ function obj() {
2889
+ var publicAPI = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2890
+ var model = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2891
+ // Ensure each instance as a unique ref of array
2892
+ safeArrays(model);
2893
+ var callbacks = [];
2894
+
2895
+ if (!Number.isInteger(model.mtime)) {
2896
+ model.mtime = ++globalMTime;
2897
+ }
2898
+
2899
+ if (!('classHierarchy' in model)) {
2900
+ model.classHierarchy = new ClassHierarchy('vtkObject');
2901
+ } else if (!(model.classHierarchy instanceof ClassHierarchy)) {
2902
+ var hierarchy = new ClassHierarchy();
2903
+
2904
+ for (var i = 0; i < model.classHierarchy.length; i++) {
2905
+ hierarchy.push(model.classHierarchy[i]);
2906
+ }
2907
+
2908
+ model.classHierarchy = hierarchy;
2909
+ }
2910
+
2911
+ function off(index) {
2912
+ callbacks[index] = null;
2913
+ }
2914
+
2915
+ function on(index) {
2916
+ function unsubscribe() {
2917
+ off(index);
2918
+ }
2919
+
2920
+ return Object.freeze({
2921
+ unsubscribe: unsubscribe
2922
+ });
2923
+ }
2924
+
2925
+ publicAPI.isDeleted = function () {
2926
+ return !!model.deleted;
2927
+ };
2928
+
2929
+ publicAPI.modified = function (otherMTime) {
2930
+ if (model.deleted) {
2931
+ vtkErrorMacro('instance deleted - cannot call any method');
2932
+ return;
2933
+ }
2934
+
2935
+ if (otherMTime && otherMTime < publicAPI.getMTime()) {
2936
+ return;
2937
+ }
2938
+
2939
+ model.mtime = ++globalMTime;
2940
+ callbacks.forEach(function (callback) {
2941
+ return callback && callback(publicAPI);
2942
+ });
2943
+ };
2944
+
2945
+ publicAPI.onModified = function (callback) {
2946
+ if (model.deleted) {
2947
+ vtkErrorMacro('instance deleted - cannot call any method');
2948
+ return null;
2949
+ }
2950
+
2951
+ var index = callbacks.length;
2952
+ callbacks.push(callback);
2953
+ return on(index);
2954
+ };
2955
+
2956
+ publicAPI.getMTime = function () {
2957
+ return model.mtime;
2958
+ };
2959
+
2960
+ publicAPI.isA = function (className) {
2961
+ var count = model.classHierarchy.length; // we go backwards as that is more likely for
2962
+ // early termination
2963
+
2964
+ while (count--) {
2965
+ if (model.classHierarchy[count] === className) {
2966
+ return true;
2967
+ }
2968
+ }
2969
+
2970
+ return false;
2971
+ };
2972
+
2973
+ publicAPI.getClassName = function () {
2974
+ var depth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
2975
+ return model.classHierarchy[model.classHierarchy.length - 1 - depth];
2976
+ };
2977
+
2978
+ publicAPI.set = function () {
2979
+ var map = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2980
+ var noWarning = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2981
+ var noFunction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2982
+ var ret = false;
2983
+ Object.keys(map).forEach(function (name) {
2984
+ var fn = noFunction ? null : publicAPI["set".concat(capitalize(name))];
2985
+
2986
+ if (fn && Array.isArray(map[name]) && fn.length > 1) {
2987
+ ret = fn.apply(void 0, (0,toConsumableArray/* default */.Z)(map[name])) || ret;
2988
+ } else if (fn) {
2989
+ ret = fn(map[name]) || ret;
2990
+ } else {
2991
+ // Set data on model directly
2992
+ if (['mtime'].indexOf(name) === -1 && !noWarning) {
2993
+ vtkWarningMacro("Warning: Set value to model directly ".concat(name, ", ").concat(map[name]));
2994
+ }
2995
+
2996
+ ret = model[name] !== map[name] || ret;
2997
+ model[name] = map[name];
2998
+ }
2999
+ });
3000
+ return ret;
3001
+ };
3002
+
3003
+ publicAPI.get = function () {
3004
+ for (var _len3 = arguments.length, list = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
3005
+ list[_key3] = arguments[_key3];
3006
+ }
3007
+
3008
+ if (!list.length) {
3009
+ return model;
3010
+ }
3011
+
3012
+ var subset = {};
3013
+ list.forEach(function (name) {
3014
+ subset[name] = model[name];
3015
+ });
3016
+ return subset;
3017
+ };
3018
+
3019
+ publicAPI.getReferenceByName = function (val) {
3020
+ return model[val];
3021
+ };
3022
+
3023
+ publicAPI.delete = function () {
3024
+ Object.keys(model).forEach(function (field) {
3025
+ return delete model[field];
3026
+ });
3027
+ callbacks.forEach(function (el, index) {
3028
+ return off(index);
3029
+ }); // Flag the instance being deleted
3030
+
3031
+ model.deleted = true;
3032
+ }; // Add serialization support
3033
+
3034
+
3035
+ publicAPI.getState = function () {
3036
+ if (model.deleted) {
3037
+ return null;
3038
+ }
3039
+
3040
+ var jsonArchive = _objectSpread(_objectSpread({}, model), {}, {
3041
+ vtkClass: publicAPI.getClassName()
3042
+ }); // Convert every vtkObject to its serializable form
3043
+
3044
+
3045
+ Object.keys(jsonArchive).forEach(function (keyName) {
3046
+ if (jsonArchive[keyName] === null || jsonArchive[keyName] === undefined || keyName[0] === '_' // protected members start with _
3047
+ ) {
3048
+ delete jsonArchive[keyName];
3049
+ } else if (jsonArchive[keyName].isA) {
3050
+ jsonArchive[keyName] = jsonArchive[keyName].getState();
3051
+ } else if (Array.isArray(jsonArchive[keyName])) {
3052
+ jsonArchive[keyName] = jsonArchive[keyName].map(getStateArrayMapFunc);
3053
+ }
3054
+ }); // Sort resulting object by key name
3055
+
3056
+ var sortedObj = {};
3057
+ Object.keys(jsonArchive).sort().forEach(function (name) {
3058
+ sortedObj[name] = jsonArchive[name];
3059
+ }); // Remove mtime
3060
+
3061
+ if (sortedObj.mtime) {
3062
+ delete sortedObj.mtime;
3063
+ }
3064
+
3065
+ return sortedObj;
3066
+ }; // Add shallowCopy(otherInstance) support
3067
+
3068
+
3069
+ publicAPI.shallowCopy = function (other) {
3070
+ var debug = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3071
+
3072
+ if (other.getClassName() !== publicAPI.getClassName()) {
3073
+ throw new Error("Cannot ShallowCopy ".concat(other.getClassName(), " into ").concat(publicAPI.getClassName()));
3074
+ }
3075
+
3076
+ var otherModel = other.get();
3077
+ var keyList = Object.keys(model).sort();
3078
+ var otherKeyList = Object.keys(otherModel).sort();
3079
+ otherKeyList.forEach(function (key) {
3080
+ var keyIdx = keyList.indexOf(key);
3081
+
3082
+ if (keyIdx === -1) {
3083
+ if (debug) {
3084
+ vtkDebugMacro("add ".concat(key, " in shallowCopy"));
3085
+ }
3086
+ } else {
3087
+ keyList.splice(keyIdx, 1);
3088
+ }
3089
+
3090
+ model[key] = otherModel[key];
3091
+ });
3092
+
3093
+ if (keyList.length && debug) {
3094
+ vtkDebugMacro("Untouched keys: ".concat(keyList.join(', ')));
3095
+ }
3096
+
3097
+ publicAPI.modified();
3098
+ }; // This function will get called when one invoke JSON.stringify(vtkObject)
3099
+ // JSON.stringify will only stringify the return value of this function
3100
+
3101
+
3102
+ publicAPI.toJSON = function vtkObjToJSON() {
3103
+ return publicAPI.getState();
3104
+ }; // Allow usage as decorator
3105
+
3106
+
3107
+ return publicAPI;
3108
+ } // ----------------------------------------------------------------------------
3109
+ // getXXX: add getters
3110
+ // ----------------------------------------------------------------------------
3111
+
3112
+ var objectGetterMap = {
3113
+ object: function object(publicAPI, model, field) {
3114
+ return function getter() {
3115
+ return _objectSpread({}, model[field.name]);
3116
+ };
3117
+ }
3118
+ };
3119
+ function get(publicAPI, model, fieldNames) {
3120
+ fieldNames.forEach(function (field) {
3121
+ if ((0,esm_typeof/* default */.Z)(field) === 'object') {
3122
+ var getter = objectGetterMap[field.type];
3123
+
3124
+ if (getter) {
3125
+ publicAPI["get".concat(_capitalize(field.name))] = getter(publicAPI, model, field);
3126
+ } else {
3127
+ publicAPI["get".concat(_capitalize(field.name))] = function () {
3128
+ return model[field.name];
3129
+ };
3130
+ }
3131
+ } else {
3132
+ publicAPI["get".concat(_capitalize(field))] = function () {
3133
+ return model[field];
3134
+ };
3135
+ }
3136
+ });
3137
+ } // ----------------------------------------------------------------------------
3138
+ // setXXX: add setters
3139
+ // ----------------------------------------------------------------------------
3140
+
3141
+ var objectSetterMap = {
3142
+ enum: function _enum(publicAPI, model, field) {
3143
+ var onChanged = "_on".concat(_capitalize(field.name), "Changed");
3144
+ return function (value) {
3145
+ if (typeof value === 'string') {
3146
+ if (field.enum[value] !== undefined) {
3147
+ if (model[field.name] !== field.enum[value]) {
3148
+ model[field.name] = field.enum[value];
3149
+ publicAPI.modified();
3150
+ return true;
3151
+ }
3152
+
3153
+ return false;
3154
+ }
3155
+
3156
+ vtkErrorMacro("Set Enum with invalid argument ".concat(field, ", ").concat(value));
3157
+ throw new RangeError('Set Enum with invalid string argument');
3158
+ }
3159
+
3160
+ if (typeof value === 'number') {
3161
+ if (model[field.name] !== value) {
3162
+ if (Object.keys(field.enum).map(function (key) {
3163
+ return field.enum[key];
3164
+ }).indexOf(value) !== -1) {
3165
+ var _model$onChanged;
3166
+
3167
+ var previousValue = model[field.name];
3168
+ model[field.name] = value;
3169
+ (_model$onChanged = model[onChanged]) === null || _model$onChanged === void 0 ? void 0 : _model$onChanged.call(model, publicAPI, model, value, previousValue);
3170
+ publicAPI.modified();
3171
+ return true;
3172
+ }
3173
+
3174
+ vtkErrorMacro("Set Enum outside numeric range ".concat(field, ", ").concat(value));
3175
+ throw new RangeError('Set Enum outside numeric range');
3176
+ }
3177
+
3178
+ return false;
3179
+ }
3180
+
3181
+ vtkErrorMacro("Set Enum with invalid argument (String/Number) ".concat(field, ", ").concat(value));
3182
+ throw new TypeError('Set Enum with invalid argument (String/Number)');
3183
+ };
3184
+ },
3185
+ object: function object(publicAPI, model, field) {
3186
+ var onChanged = "_on".concat(_capitalize(field.name), "Changed");
3187
+ return function (value) {
3188
+ if (!fast_deep_equal_default()(model[field.name], value)) {
3189
+ var _model$onChanged2;
3190
+
3191
+ var previousValue = model[field.name];
3192
+ model[field.name] = value;
3193
+ (_model$onChanged2 = model[onChanged]) === null || _model$onChanged2 === void 0 ? void 0 : _model$onChanged2.call(model, publicAPI, model, value, previousValue);
3194
+ publicAPI.modified();
3195
+ return true;
3196
+ }
3197
+
3198
+ return false;
3199
+ };
3200
+ }
3201
+ };
3202
+
3203
+ function findSetter(field) {
3204
+ if ((0,esm_typeof/* default */.Z)(field) === 'object') {
3205
+ var fn = objectSetterMap[field.type];
3206
+
3207
+ if (fn) {
3208
+ return function (publicAPI, model) {
3209
+ return fn(publicAPI, model, field);
3210
+ };
3211
+ }
3212
+
3213
+ vtkErrorMacro("No setter for field ".concat(field));
3214
+ throw new TypeError('No setter for field');
3215
+ }
3216
+
3217
+ return function getSetter(publicAPI, model) {
3218
+ var onChanged = "_on".concat(_capitalize(field), "Changed");
3219
+ return function setter(value) {
3220
+ if (model.deleted) {
3221
+ vtkErrorMacro('instance deleted - cannot call any method');
3222
+ return false;
3223
+ }
3224
+
3225
+ if (model[field] !== value) {
3226
+ var _model$onChanged3;
3227
+
3228
+ var previousValue = model[field.name];
3229
+ model[field] = value;
3230
+ (_model$onChanged3 = model[onChanged]) === null || _model$onChanged3 === void 0 ? void 0 : _model$onChanged3.call(model, publicAPI, model, value, previousValue);
3231
+ publicAPI.modified();
3232
+ return true;
3233
+ }
3234
+
3235
+ return false;
3236
+ };
3237
+ };
3238
+ }
3239
+
3240
+ function set(publicAPI, model, fields) {
3241
+ fields.forEach(function (field) {
3242
+ if ((0,esm_typeof/* default */.Z)(field) === 'object') {
3243
+ publicAPI["set".concat(_capitalize(field.name))] = findSetter(field)(publicAPI, model);
3244
+ } else {
3245
+ publicAPI["set".concat(_capitalize(field))] = findSetter(field)(publicAPI, model);
3246
+ }
3247
+ });
3248
+ } // ----------------------------------------------------------------------------
3249
+ // set/get XXX: add both setters and getters
3250
+ // ----------------------------------------------------------------------------
3251
+
3252
+ function setGet(publicAPI, model, fieldNames) {
3253
+ get(publicAPI, model, fieldNames);
3254
+ set(publicAPI, model, fieldNames);
3255
+ } // ----------------------------------------------------------------------------
3256
+ // getXXX: add getters for object of type array with copy to be safe
3257
+ // getXXXByReference: add getters for object of type array without copy
3258
+ // ----------------------------------------------------------------------------
3259
+
3260
+ function getArray(publicAPI, model, fieldNames) {
3261
+ fieldNames.forEach(function (field) {
3262
+ publicAPI["get".concat(_capitalize(field))] = function () {
3263
+ return model[field] ? Array.from(model[field]) : model[field];
3264
+ };
3265
+
3266
+ publicAPI["get".concat(_capitalize(field), "ByReference")] = function () {
3267
+ return model[field];
3268
+ };
3269
+ });
3270
+ } // ----------------------------------------------------------------------------
3271
+ // setXXX: add setter for object of type array
3272
+ // if 'defaultVal' is supplied, shorter arrays will be padded to 'size' with 'defaultVal'
3273
+ // set...From: fast path to copy the content of an array to the current one without call to modified.
3274
+ // ----------------------------------------------------------------------------
3275
+
3276
+ function setArray(publicAPI, model, fieldNames, size) {
3277
+ var defaultVal = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : undefined;
3278
+ fieldNames.forEach(function (field) {
3279
+ if (model[field] && size && model[field].length !== size) {
3280
+ throw new RangeError("Invalid initial number of values for array (".concat(field, ")"));
3281
+ }
3282
+
3283
+ var onChanged = "_on".concat(_capitalize(field), "Changed");
3284
+
3285
+ publicAPI["set".concat(_capitalize(field))] = function () {
3286
+ if (model.deleted) {
3287
+ vtkErrorMacro('instance deleted - cannot call any method');
3288
+ return false;
3289
+ }
3290
+
3291
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
3292
+ args[_key4] = arguments[_key4];
3293
+ }
3294
+
3295
+ var array = args;
3296
+ var changeDetected;
3297
+ var needCopy = false; // allow null or an array to be passed as a single arg.
3298
+
3299
+ if (array.length === 1 && (array[0] == null || array[0].length >= 0)) {
3300
+ /* eslint-disable prefer-destructuring */
3301
+ array = array[0];
3302
+ /* eslint-enable prefer-destructuring */
3303
+
3304
+ needCopy = true;
3305
+ }
3306
+
3307
+ if (array == null) {
3308
+ changeDetected = model[field] !== array;
3309
+ } else {
3310
+ if (size && array.length !== size) {
3311
+ if (array.length < size && defaultVal !== undefined) {
3312
+ array = Array.from(array);
3313
+ needCopy = false;
3314
+
3315
+ while (array.length < size) {
3316
+ array.push(defaultVal);
3317
+ }
3318
+ } else {
3319
+ throw new RangeError("Invalid number of values for array setter (".concat(field, ")"));
3320
+ }
3321
+ }
3322
+
3323
+ changeDetected = model[field] == null || model[field].length !== array.length;
3324
+
3325
+ for (var i = 0; !changeDetected && i < array.length; ++i) {
3326
+ changeDetected = model[field][i] !== array[i];
3327
+ }
3328
+
3329
+ if (changeDetected && needCopy) {
3330
+ array = Array.from(array);
3331
+ }
3332
+ }
3333
+
3334
+ if (changeDetected) {
3335
+ var _model$onChanged4;
3336
+
3337
+ var previousValue = model[field.name];
3338
+ model[field] = array;
3339
+ (_model$onChanged4 = model[onChanged]) === null || _model$onChanged4 === void 0 ? void 0 : _model$onChanged4.call(model, publicAPI, model, array, previousValue);
3340
+ publicAPI.modified();
3341
+ }
3342
+
3343
+ return changeDetected;
3344
+ };
3345
+
3346
+ publicAPI["set".concat(_capitalize(field), "From")] = function (otherArray) {
3347
+ var target = model[field];
3348
+ otherArray.forEach(function (v, i) {
3349
+ target[i] = v;
3350
+ });
3351
+ };
3352
+ });
3353
+ } // ----------------------------------------------------------------------------
3354
+ // set/get XXX: add setter and getter for object of type array
3355
+ // ----------------------------------------------------------------------------
3356
+
3357
+ function setGetArray(publicAPI, model, fieldNames, size) {
3358
+ var defaultVal = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : undefined;
3359
+ getArray(publicAPI, model, fieldNames);
3360
+ setArray(publicAPI, model, fieldNames, size, defaultVal);
3361
+ }
3362
+ function moveToProtected(publicAPI, model, fieldNames) {
3363
+ for (var i = 0; i < fieldNames.length; i++) {
3364
+ var fieldName = fieldNames[i];
3365
+
3366
+ if (model[fieldName] !== undefined) {
3367
+ model["_".concat(fieldName)] = model[fieldName];
3368
+ delete model[fieldName];
3369
+ }
3370
+ }
3371
+ } // ----------------------------------------------------------------------------
3372
+ // vtkAlgorithm: setInputData(), setInputConnection(), getOutputData(), getOutputPort()
3373
+ // ----------------------------------------------------------------------------
3374
+
3375
+ function algo(publicAPI, model, numberOfInputs, numberOfOutputs) {
3376
+ if (model.inputData) {
3377
+ model.inputData = model.inputData.map(vtk/* default */.Z);
3378
+ } else {
3379
+ model.inputData = [];
3380
+ }
3381
+
3382
+ if (model.inputConnection) {
3383
+ model.inputConnection = model.inputConnection.map(vtk/* default */.Z);
3384
+ } else {
3385
+ model.inputConnection = [];
3386
+ }
3387
+
3388
+ if (model.output) {
3389
+ model.output = model.output.map(vtk/* default */.Z);
3390
+ } else {
3391
+ model.output = [];
3392
+ }
3393
+
3394
+ if (model.inputArrayToProcess) {
3395
+ model.inputArrayToProcess = model.inputArrayToProcess.map(vtk/* default */.Z);
3396
+ } else {
3397
+ model.inputArrayToProcess = [];
3398
+ } // Cache the argument for later manipulation
3399
+
3400
+
3401
+ model.numberOfInputs = numberOfInputs; // Methods
3402
+
3403
+ function setInputData(dataset) {
3404
+ var port = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3405
+
3406
+ if (model.deleted) {
3407
+ vtkErrorMacro('instance deleted - cannot call any method');
3408
+ return;
3409
+ }
3410
+
3411
+ if (port >= model.numberOfInputs) {
3412
+ vtkErrorMacro("algorithm ".concat(publicAPI.getClassName(), " only has ").concat(model.numberOfInputs, " input ports. To add more input ports, use addInputData()"));
3413
+ return;
3414
+ }
3415
+
3416
+ if (model.inputData[port] !== dataset || model.inputConnection[port]) {
3417
+ model.inputData[port] = dataset;
3418
+ model.inputConnection[port] = null;
3419
+
3420
+ if (publicAPI.modified) {
3421
+ publicAPI.modified();
3422
+ }
3423
+ }
3424
+ }
3425
+
3426
+ function getInputData() {
3427
+ var port = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
3428
+
3429
+ if (model.inputConnection[port]) {
3430
+ model.inputData[port] = model.inputConnection[port]();
3431
+ }
3432
+
3433
+ return model.inputData[port];
3434
+ }
3435
+
3436
+ function setInputConnection(outputPort) {
3437
+ var port = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3438
+
3439
+ if (model.deleted) {
3440
+ vtkErrorMacro('instance deleted - cannot call any method');
3441
+ return;
3442
+ }
3443
+
3444
+ if (port >= model.numberOfInputs) {
3445
+ var msg = "algorithm ".concat(publicAPI.getClassName(), " only has ");
3446
+ msg += "".concat(model.numberOfInputs);
3447
+ msg += ' input ports. To add more input ports, use addInputConnection()';
3448
+ vtkErrorMacro(msg);
3449
+ return;
3450
+ }
3451
+
3452
+ model.inputData[port] = null;
3453
+ model.inputConnection[port] = outputPort;
3454
+ }
3455
+
3456
+ function getInputConnection() {
3457
+ var port = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
3458
+ return model.inputConnection[port];
3459
+ }
3460
+
3461
+ function getPortToFill() {
3462
+ var portToFill = model.numberOfInputs;
3463
+
3464
+ while (portToFill && !model.inputData[portToFill - 1] && !model.inputConnection[portToFill - 1]) {
3465
+ portToFill--;
3466
+ }
3467
+
3468
+ if (portToFill === model.numberOfInputs) {
3469
+ model.numberOfInputs++;
3470
+ }
3471
+
3472
+ return portToFill;
3473
+ }
3474
+
3475
+ function addInputConnection(outputPort) {
3476
+ if (model.deleted) {
3477
+ vtkErrorMacro('instance deleted - cannot call any method');
3478
+ return;
3479
+ }
3480
+
3481
+ setInputConnection(outputPort, getPortToFill());
3482
+ }
3483
+
3484
+ function addInputData(dataset) {
3485
+ if (model.deleted) {
3486
+ vtkErrorMacro('instance deleted - cannot call any method');
3487
+ return;
3488
+ }
3489
+
3490
+ setInputData(dataset, getPortToFill());
3491
+ }
3492
+
3493
+ function getOutputData() {
3494
+ var port = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
3495
+
3496
+ if (model.deleted) {
3497
+ vtkErrorMacro('instance deleted - cannot call any method');
3498
+ return null;
3499
+ }
3500
+
3501
+ if (publicAPI.shouldUpdate()) {
3502
+ publicAPI.update();
3503
+ }
3504
+
3505
+ return model.output[port];
3506
+ }
3507
+
3508
+ publicAPI.shouldUpdate = function () {
3509
+ var localMTime = publicAPI.getMTime();
3510
+ var minOutputMTime = Infinity;
3511
+ var count = numberOfOutputs;
3512
+
3513
+ while (count--) {
3514
+ if (!model.output[count] || model.output[count].isDeleted()) {
3515
+ return true;
3516
+ }
3517
+
3518
+ var mt = model.output[count].getMTime();
3519
+
3520
+ if (mt < localMTime) {
3521
+ return true;
3522
+ }
3523
+
3524
+ if (mt < minOutputMTime) {
3525
+ minOutputMTime = mt;
3526
+ }
3527
+ }
3528
+
3529
+ count = model.numberOfInputs;
3530
+
3531
+ while (count--) {
3532
+ var _model$inputConnectio, _publicAPI$getInputDa;
3533
+
3534
+ if ((_model$inputConnectio = model.inputConnection[count]) !== null && _model$inputConnectio !== void 0 && _model$inputConnectio.filter.shouldUpdate() || ((_publicAPI$getInputDa = publicAPI.getInputData(count)) === null || _publicAPI$getInputDa === void 0 ? void 0 : _publicAPI$getInputDa.getMTime()) > minOutputMTime) {
3535
+ return true;
3536
+ }
3537
+ }
3538
+
3539
+ return false;
3540
+ };
3541
+
3542
+ function getOutputPort() {
3543
+ var port = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
3544
+
3545
+ var outputPortAccess = function outputPortAccess() {
3546
+ return getOutputData(port);
3547
+ }; // Add reference to filter
3548
+
3549
+
3550
+ outputPortAccess.filter = publicAPI;
3551
+ return outputPortAccess;
3552
+ } // Handle input if needed
3553
+
3554
+
3555
+ if (model.numberOfInputs) {
3556
+ // Reserve inputs
3557
+ var count = model.numberOfInputs;
3558
+
3559
+ while (count--) {
3560
+ model.inputData.push(null);
3561
+ model.inputConnection.push(null);
3562
+ } // Expose public methods
3563
+
3564
+
3565
+ publicAPI.setInputData = setInputData;
3566
+ publicAPI.setInputConnection = setInputConnection;
3567
+ publicAPI.addInputData = addInputData;
3568
+ publicAPI.addInputConnection = addInputConnection;
3569
+ publicAPI.getInputData = getInputData;
3570
+ publicAPI.getInputConnection = getInputConnection;
3571
+ }
3572
+
3573
+ if (numberOfOutputs) {
3574
+ publicAPI.getOutputData = getOutputData;
3575
+ publicAPI.getOutputPort = getOutputPort;
3576
+ }
3577
+
3578
+ publicAPI.update = function () {
3579
+ var ins = [];
3580
+
3581
+ if (model.numberOfInputs) {
3582
+ var _count = 0;
3583
+
3584
+ while (_count < model.numberOfInputs) {
3585
+ ins[_count] = publicAPI.getInputData(_count);
3586
+ _count++;
3587
+ }
3588
+ }
3589
+
3590
+ if (publicAPI.shouldUpdate() && publicAPI.requestData) {
3591
+ publicAPI.requestData(ins, model.output);
3592
+ }
3593
+ };
3594
+
3595
+ publicAPI.getNumberOfInputPorts = function () {
3596
+ return model.numberOfInputs;
3597
+ };
3598
+
3599
+ publicAPI.getNumberOfOutputPorts = function () {
3600
+ return numberOfOutputs || model.output.length;
3601
+ };
3602
+
3603
+ publicAPI.getInputArrayToProcess = function (inputPort) {
3604
+ var arrayDesc = model.inputArrayToProcess[inputPort];
3605
+ var ds = model.inputData[inputPort];
3606
+
3607
+ if (arrayDesc && ds) {
3608
+ return ds["get".concat(arrayDesc.fieldAssociation)]().getArray(arrayDesc.arrayName);
3609
+ }
3610
+
3611
+ return null;
3612
+ };
3613
+
3614
+ publicAPI.setInputArrayToProcess = function (inputPort, arrayName, fieldAssociation) {
3615
+ var attributeType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'Scalars';
3616
+
3617
+ while (model.inputArrayToProcess.length < inputPort) {
3618
+ model.inputArrayToProcess.push(null);
3619
+ }
3620
+
3621
+ model.inputArrayToProcess[inputPort] = {
3622
+ arrayName: arrayName,
3623
+ fieldAssociation: fieldAssociation,
3624
+ attributeType: attributeType
3625
+ };
3626
+ };
3627
+ } // ----------------------------------------------------------------------------
3628
+ // Event handling: onXXX(callback), invokeXXX(args...)
3629
+ // ----------------------------------------------------------------------------
3630
+
3631
+ var EVENT_ABORT = Symbol('Event abort');
3632
+ function macros_event(publicAPI, model, eventName) {
3633
+ var callbacks = [];
3634
+ var previousDelete = publicAPI.delete;
3635
+ var curCallbackID = 1;
3636
+
3637
+ function off(callbackID) {
3638
+ for (var i = 0; i < callbacks.length; ++i) {
3639
+ var _callbacks$i = (0,slicedToArray/* default */.Z)(callbacks[i], 1),
3640
+ cbID = _callbacks$i[0];
3641
+
3642
+ if (cbID === callbackID) {
3643
+ callbacks.splice(i, 1);
3644
+ return;
3645
+ }
3646
+ }
3647
+ }
3648
+
3649
+ function on(callbackID) {
3650
+ function unsubscribe() {
3651
+ off(callbackID);
3652
+ }
3653
+
3654
+ return Object.freeze({
3655
+ unsubscribe: unsubscribe
3656
+ });
3657
+ }
3658
+
3659
+ function invoke() {
3660
+ var _arguments = arguments;
3661
+
3662
+ if (model.deleted) {
3663
+ vtkErrorMacro('instance deleted - cannot call any method');
3664
+ return;
3665
+ }
3666
+ /* eslint-disable prefer-rest-params */
3667
+ // Go through a copy of the callbacks array in case new callbacks
3668
+ // get prepended within previous callbacks
3669
+
3670
+
3671
+ var currentCallbacks = callbacks.slice();
3672
+
3673
+ var _loop = function _loop(index) {
3674
+ var _currentCallbacks$ind = (0,slicedToArray/* default */.Z)(currentCallbacks[index], 3),
3675
+ cb = _currentCallbacks$ind[1],
3676
+ priority = _currentCallbacks$ind[2];
3677
+
3678
+ if (!cb) {
3679
+ return "continue"; // eslint-disable-line
3680
+ }
3681
+
3682
+ if (priority < 0) {
3683
+ setTimeout(function () {
3684
+ return cb.apply(publicAPI, _arguments);
3685
+ }, 1 - priority);
3686
+ } else {
3687
+ // Abort only if the callback explicitly returns false
3688
+ var continueNext = cb.apply(publicAPI, _arguments);
3689
+
3690
+ if (continueNext === EVENT_ABORT) {
3691
+ return "break";
3692
+ }
3693
+ }
3694
+ };
3695
+
3696
+ for (var index = 0; index < currentCallbacks.length; ++index) {
3697
+ var _ret = _loop(index);
3698
+
3699
+ if (_ret === "continue") continue;
3700
+ if (_ret === "break") break;
3701
+ }
3702
+ /* eslint-enable prefer-rest-params */
3703
+
3704
+ }
3705
+
3706
+ publicAPI["invoke".concat(_capitalize(eventName))] = invoke;
3707
+
3708
+ publicAPI["on".concat(_capitalize(eventName))] = function (callback) {
3709
+ var priority = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.0;
3710
+
3711
+ if (!callback.apply) {
3712
+ console.error("Invalid callback for event ".concat(eventName));
3713
+ return null;
3714
+ }
3715
+
3716
+ if (model.deleted) {
3717
+ vtkErrorMacro('instance deleted - cannot call any method');
3718
+ return null;
3719
+ }
3720
+
3721
+ var callbackID = curCallbackID++;
3722
+ callbacks.push([callbackID, callback, priority]);
3723
+ callbacks.sort(function (cb1, cb2) {
3724
+ return cb2[2] - cb1[2];
3725
+ });
3726
+ return on(callbackID);
3727
+ };
3728
+
3729
+ publicAPI.delete = function () {
3730
+ previousDelete();
3731
+ callbacks.forEach(function (_ref2) {
3732
+ var _ref3 = (0,slicedToArray/* default */.Z)(_ref2, 1),
3733
+ cbID = _ref3[0];
3734
+
3735
+ return off(cbID);
3736
+ });
3737
+ };
3738
+ } // ----------------------------------------------------------------------------
3739
+ // newInstance
3740
+ // ----------------------------------------------------------------------------
3741
+
3742
+ function newInstance(extend, className) {
3743
+ var constructor = function constructor() {
3744
+ var initialValues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3745
+ var model = {};
3746
+ var publicAPI = {};
3747
+ extend(publicAPI, model, initialValues);
3748
+ return Object.freeze(publicAPI);
3749
+ }; // Register constructor to factory
3750
+
3751
+
3752
+ if (className) {
3753
+ vtk/* default.register */.Z.register(className, constructor);
3754
+ }
3755
+
3756
+ return constructor;
3757
+ } // ----------------------------------------------------------------------------
3758
+ // Chain function calls
3759
+ // ----------------------------------------------------------------------------
3760
+
3761
+ function chain() {
3762
+ for (var _len5 = arguments.length, fn = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
3763
+ fn[_key5] = arguments[_key5];
3764
+ }
3765
+
3766
+ return function () {
3767
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
3768
+ args[_key6] = arguments[_key6];
3769
+ }
3770
+
3771
+ return fn.filter(function (i) {
3772
+ return !!i;
3773
+ }).map(function (i) {
3774
+ return i.apply(void 0, args);
3775
+ });
3776
+ };
3777
+ } // ----------------------------------------------------------------------------
3778
+ // Some utility methods for vtk objects
3779
+ // ----------------------------------------------------------------------------
3780
+
3781
+ function isVtkObject(instance) {
3782
+ return instance && instance.isA && instance.isA('vtkObject');
3783
+ }
3784
+ function traverseInstanceTree(instance, extractFunction) {
3785
+ var accumulator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
3786
+ var visitedInstances = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
3787
+
3788
+ if (isVtkObject(instance)) {
3789
+ if (visitedInstances.indexOf(instance) >= 0) {
3790
+ // avoid cycles
3791
+ return accumulator;
3792
+ }
3793
+
3794
+ visitedInstances.push(instance);
3795
+ var result = extractFunction(instance);
3796
+
3797
+ if (result !== undefined) {
3798
+ accumulator.push(result);
3799
+ } // Now go through this instance's model
3800
+
3801
+
3802
+ var model = instance.get();
3803
+ Object.keys(model).forEach(function (key) {
3804
+ var modelObj = model[key];
3805
+
3806
+ if (Array.isArray(modelObj)) {
3807
+ modelObj.forEach(function (subObj) {
3808
+ traverseInstanceTree(subObj, extractFunction, accumulator, visitedInstances);
3809
+ });
3810
+ } else {
3811
+ traverseInstanceTree(modelObj, extractFunction, accumulator, visitedInstances);
3812
+ }
3813
+ });
3814
+ }
3815
+
3816
+ return accumulator;
3817
+ } // ----------------------------------------------------------------------------
3818
+ // Returns a function, that, as long as it continues to be invoked, will not
3819
+ // be triggered. The function will be called after it stops being called for
3820
+ // N milliseconds. If `immediate` is passed, trigger the function on the
3821
+ // leading edge, instead of the trailing.
3822
+
3823
+ function debounce(func, wait, immediate) {
3824
+ var _this = this;
3825
+
3826
+ var timeout;
3827
+
3828
+ var debounced = function debounced() {
3829
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
3830
+ args[_key7] = arguments[_key7];
3831
+ }
3832
+
3833
+ var context = _this;
3834
+
3835
+ var later = function later() {
3836
+ timeout = null;
3837
+
3838
+ if (!immediate) {
3839
+ func.apply(context, args);
3840
+ }
3841
+ };
3842
+
3843
+ var callNow = immediate && !timeout;
3844
+ clearTimeout(timeout);
3845
+ timeout = setTimeout(later, wait);
3846
+
3847
+ if (callNow) {
3848
+ func.apply(context, args);
3849
+ }
3850
+ };
3851
+
3852
+ debounced.cancel = function () {
3853
+ return clearTimeout(timeout);
3854
+ };
3855
+
3856
+ return debounced;
3857
+ } // ----------------------------------------------------------------------------
3858
+ // Creates a throttled function that only invokes `func` at most once per
3859
+ // every `wait` milliseconds.
3860
+
3861
+ function throttle(callback, delay) {
3862
+ var isThrottled = false;
3863
+ var argsToUse = null;
3864
+
3865
+ function next() {
3866
+ isThrottled = false;
3867
+
3868
+ if (argsToUse !== null) {
3869
+ wrapper.apply(void 0, (0,toConsumableArray/* default */.Z)(argsToUse)); // eslint-disable-line
3870
+
3871
+ argsToUse = null;
3872
+ }
3873
+ }
3874
+
3875
+ function wrapper() {
3876
+ for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
3877
+ args[_key8] = arguments[_key8];
3878
+ }
3879
+
3880
+ if (isThrottled) {
3881
+ argsToUse = args;
3882
+ return;
3883
+ }
3884
+
3885
+ isThrottled = true;
3886
+ callback.apply(void 0, args);
3887
+ setTimeout(next, delay);
3888
+ }
3889
+
3890
+ return wrapper;
3891
+ } // ----------------------------------------------------------------------------
3892
+ // keystore(publicAPI, model, initialKeystore)
3893
+ //
3894
+ // - initialKeystore: Initial keystore. This can be either a Map or an
3895
+ // object.
3896
+ //
3897
+ // Generated API
3898
+ // setKey(key, value) : mixed (returns value)
3899
+ // getKey(key) : mixed
3900
+ // getAllKeys() : [mixed]
3901
+ // deleteKey(key) : Boolean
3902
+ // ----------------------------------------------------------------------------
3903
+
3904
+ function keystore(publicAPI, model) {
3905
+ var initialKeystore = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
3906
+ model.keystore = Object.assign(model.keystore || {}, initialKeystore);
3907
+
3908
+ publicAPI.setKey = function (key, value) {
3909
+ model.keystore[key] = value;
3910
+ };
3911
+
3912
+ publicAPI.getKey = function (key) {
3913
+ return model.keystore[key];
3914
+ };
3915
+
3916
+ publicAPI.getAllKeys = function () {
3917
+ return Object.keys(model.keystore);
3918
+ };
3919
+
3920
+ publicAPI.deleteKey = function (key) {
3921
+ return delete model.keystore[key];
3922
+ };
3923
+
3924
+ publicAPI.clearKeystore = function () {
3925
+ return publicAPI.getAllKeys().forEach(function (key) {
3926
+ return delete model.keystore[key];
3927
+ });
3928
+ };
3929
+ } // ----------------------------------------------------------------------------
3930
+ // proxy(publicAPI, model, sectionName, propertyUI)
3931
+ //
3932
+ // - sectionName: Name of the section for UI
3933
+ // - propertyUI: List of props with their UI description
3934
+ //
3935
+ // Generated API
3936
+ // getProxyId() : String
3937
+ // listProxyProperties() : [string]
3938
+ // updateProxyProperty(name, prop)
3939
+ // getProxySection() => List of properties for UI generation
3940
+ // ----------------------------------------------------------------------------
3941
+
3942
+ var nextProxyId = 1;
3943
+ var ROOT_GROUP_NAME = '__root__';
3944
+ function proxy(publicAPI, model) {
3945
+ // Proxies are keystores
3946
+ keystore(publicAPI, model);
3947
+ var parentDelete = publicAPI.delete; // getProxyId
3948
+
3949
+ model.proxyId = "".concat(nextProxyId++); // ui handling
3950
+
3951
+ model.ui = JSON.parse(JSON.stringify(model.ui || [])); // deep copy
3952
+
3953
+ get(publicAPI, model, ['proxyId', 'proxyGroup', 'proxyName']);
3954
+ setGet(publicAPI, model, ['proxyManager']); // group properties
3955
+
3956
+ var propertyMap = {};
3957
+ var groupChildrenNames = {};
3958
+
3959
+ function registerProperties(descriptionList, currentGroupName) {
3960
+ if (!groupChildrenNames[currentGroupName]) {
3961
+ groupChildrenNames[currentGroupName] = [];
3962
+ }
3963
+
3964
+ var childrenNames = groupChildrenNames[currentGroupName];
3965
+
3966
+ for (var i = 0; i < descriptionList.length; i++) {
3967
+ childrenNames.push(descriptionList[i].name);
3968
+ propertyMap[descriptionList[i].name] = descriptionList[i];
3969
+
3970
+ if (descriptionList[i].children && descriptionList[i].children.length) {
3971
+ registerProperties(descriptionList[i].children, descriptionList[i].name);
3972
+ }
3973
+ }
3974
+ }
3975
+
3976
+ registerProperties(model.ui, ROOT_GROUP_NAME);
3977
+
3978
+ publicAPI.updateUI = function (ui) {
3979
+ model.ui = JSON.parse(JSON.stringify(ui || [])); // deep copy
3980
+
3981
+ Object.keys(propertyMap).forEach(function (k) {
3982
+ return delete propertyMap[k];
3983
+ });
3984
+ Object.keys(groupChildrenNames).forEach(function (k) {
3985
+ return delete groupChildrenNames[k];
3986
+ });
3987
+ registerProperties(model.ui, ROOT_GROUP_NAME);
3988
+ publicAPI.modified();
3989
+ };
3990
+
3991
+ function listProxyProperties() {
3992
+ var gName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ROOT_GROUP_NAME;
3993
+ return groupChildrenNames[gName];
3994
+ }
3995
+
3996
+ publicAPI.updateProxyProperty = function (propertyName, propUI) {
3997
+ var prop = propertyMap[propertyName];
3998
+
3999
+ if (prop) {
4000
+ Object.assign(prop, propUI);
4001
+ } else {
4002
+ propertyMap[propertyName] = _objectSpread({}, propUI);
4003
+ }
4004
+ };
4005
+
4006
+ publicAPI.activate = function () {
4007
+ if (model.proxyManager) {
4008
+ var setActiveMethod = "setActive".concat(_capitalize(publicAPI.getProxyGroup().slice(0, -1)));
4009
+
4010
+ if (model.proxyManager[setActiveMethod]) {
4011
+ model.proxyManager[setActiveMethod](publicAPI);
4012
+ }
4013
+ }
4014
+ }; // property link
4015
+
4016
+
4017
+ model.propertyLinkSubscribers = {};
4018
+
4019
+ publicAPI.registerPropertyLinkForGC = function (otherLink, type) {
4020
+ if (!(type in model.propertyLinkSubscribers)) {
4021
+ model.propertyLinkSubscribers[type] = [];
4022
+ }
4023
+
4024
+ model.propertyLinkSubscribers[type].push(otherLink);
4025
+ };
4026
+
4027
+ publicAPI.gcPropertyLinks = function (type) {
4028
+ var subscribers = model.propertyLinkSubscribers[type] || [];
4029
+
4030
+ while (subscribers.length) {
4031
+ subscribers.pop().unbind(publicAPI);
4032
+ }
4033
+ };
4034
+
4035
+ model.propertyLinkMap = {};
4036
+
4037
+ publicAPI.getPropertyLink = function (id) {
4038
+ var persistent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
4039
+
4040
+ if (model.propertyLinkMap[id]) {
4041
+ return model.propertyLinkMap[id];
4042
+ }
4043
+
4044
+ var value = null;
4045
+ var links = [];
4046
+ var count = 0;
4047
+ var updateInProgress = false;
4048
+
4049
+ function update(source) {
4050
+ var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
4051
+
4052
+ if (updateInProgress) {
4053
+ return null;
4054
+ }
4055
+
4056
+ var needUpdate = [];
4057
+ var sourceLink = null;
4058
+ count = links.length;
4059
+
4060
+ while (count--) {
4061
+ var link = links[count];
4062
+
4063
+ if (link.instance === source) {
4064
+ sourceLink = link;
4065
+ } else {
4066
+ needUpdate.push(link);
4067
+ }
4068
+ }
4069
+
4070
+ if (!sourceLink) {
4071
+ return null;
4072
+ }
4073
+
4074
+ var newValue = sourceLink.instance["get".concat(_capitalize(sourceLink.propertyName))]();
4075
+
4076
+ if (!shallowEquals(newValue, value) || force) {
4077
+ value = newValue;
4078
+ updateInProgress = true;
4079
+
4080
+ while (needUpdate.length) {
4081
+ var linkToUpdate = needUpdate.pop();
4082
+ linkToUpdate.instance.set((0,defineProperty/* default */.Z)({}, linkToUpdate.propertyName, value));
4083
+ }
4084
+
4085
+ updateInProgress = false;
4086
+ }
4087
+
4088
+ if (model.propertyLinkMap[id].persistent) {
4089
+ model.propertyLinkMap[id].value = newValue;
4090
+ }
4091
+
4092
+ return newValue;
4093
+ }
4094
+
4095
+ function unbind(instance, propertyName) {
4096
+ var indexToDelete = [];
4097
+ count = links.length;
4098
+
4099
+ while (count--) {
4100
+ var link = links[count];
4101
+
4102
+ if (link.instance === instance && (link.propertyName === propertyName || propertyName === undefined)) {
4103
+ link.subscription.unsubscribe();
4104
+ indexToDelete.push(count);
4105
+ }
4106
+ }
4107
+
4108
+ while (indexToDelete.length) {
4109
+ links.splice(indexToDelete.pop(), 1);
4110
+ }
4111
+ }
4112
+
4113
+ function bind(instance, propertyName) {
4114
+ var updateMe = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
4115
+ var subscription = instance.onModified(update);
4116
+ var other = links[0];
4117
+ links.push({
4118
+ instance: instance,
4119
+ propertyName: propertyName,
4120
+ subscription: subscription
4121
+ });
4122
+
4123
+ if (updateMe) {
4124
+ if (model.propertyLinkMap[id].persistent && model.propertyLinkMap[id].value !== undefined) {
4125
+ instance.set((0,defineProperty/* default */.Z)({}, propertyName, model.propertyLinkMap[id].value));
4126
+ } else if (other) {
4127
+ update(other.instance, true);
4128
+ }
4129
+ }
4130
+
4131
+ return {
4132
+ unsubscribe: function unsubscribe() {
4133
+ return unbind(instance, propertyName);
4134
+ }
4135
+ };
4136
+ }
4137
+
4138
+ function unsubscribe() {
4139
+ while (links.length) {
4140
+ links.pop().subscription.unsubscribe();
4141
+ }
4142
+ }
4143
+
4144
+ var linkHandler = {
4145
+ bind: bind,
4146
+ unbind: unbind,
4147
+ unsubscribe: unsubscribe,
4148
+ persistent: persistent
4149
+ };
4150
+ model.propertyLinkMap[id] = linkHandler;
4151
+ return linkHandler;
4152
+ }; // extract values
4153
+
4154
+
4155
+ function getProperties() {
4156
+ var groupName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ROOT_GROUP_NAME;
4157
+ var values = [];
4158
+ var id = model.proxyId;
4159
+ var propertyNames = listProxyProperties(groupName) || [];
4160
+
4161
+ for (var i = 0; i < propertyNames.length; i++) {
4162
+ var name = propertyNames[i];
4163
+ var method = publicAPI["get".concat(_capitalize(name))];
4164
+ var value = method ? method() : undefined;
4165
+ var prop = {
4166
+ id: id,
4167
+ name: name,
4168
+ value: value
4169
+ };
4170
+ var children = getProperties(name);
4171
+
4172
+ if (children.length) {
4173
+ prop.children = children;
4174
+ }
4175
+
4176
+ values.push(prop);
4177
+ }
4178
+
4179
+ return values;
4180
+ }
4181
+
4182
+ publicAPI.listPropertyNames = function () {
4183
+ return getProperties().map(function (p) {
4184
+ return p.name;
4185
+ });
4186
+ };
4187
+
4188
+ publicAPI.getPropertyByName = function (name) {
4189
+ return getProperties().find(function (p) {
4190
+ return p.name === name;
4191
+ });
4192
+ };
4193
+
4194
+ publicAPI.getPropertyDomainByName = function (name) {
4195
+ return (propertyMap[name] || {}).domain;
4196
+ }; // ui section
4197
+
4198
+
4199
+ publicAPI.getProxySection = function () {
4200
+ return {
4201
+ id: model.proxyId,
4202
+ name: model.proxyGroup,
4203
+ ui: model.ui,
4204
+ properties: getProperties()
4205
+ };
4206
+ }; // free resources
4207
+
4208
+
4209
+ publicAPI.delete = function () {
4210
+ var list = Object.keys(model.propertyLinkMap);
4211
+ var count = list.length;
4212
+
4213
+ while (count--) {
4214
+ model.propertyLinkMap[list[count]].unsubscribe();
4215
+ }
4216
+
4217
+ Object.keys(model.propertyLinkSubscribers).forEach(publicAPI.gcPropertyLinks);
4218
+ parentDelete();
4219
+ }; // @todo fix infinite recursion due to active source
4220
+
4221
+
4222
+ publicAPI.getState = function () {
4223
+ return null;
4224
+ };
4225
+
4226
+ function registerLinks() {
4227
+ // Allow dynamic registration of links at the application level
4228
+ if (model.links) {
4229
+ for (var i = 0; i < model.links.length; i++) {
4230
+ var _model$links$i = model.links[i],
4231
+ link = _model$links$i.link,
4232
+ property = _model$links$i.property,
4233
+ persistent = _model$links$i.persistent,
4234
+ updateOnBind = _model$links$i.updateOnBind,
4235
+ type = _model$links$i.type;
4236
+
4237
+ if (type === 'application') {
4238
+ var sLink = model.proxyManager.getPropertyLink(link, persistent);
4239
+ publicAPI.registerPropertyLinkForGC(sLink, 'application');
4240
+ sLink.bind(publicAPI, property, updateOnBind);
4241
+ }
4242
+ }
4243
+ }
4244
+ }
4245
+
4246
+ setImmediateVTK(registerLinks);
4247
+ } // ----------------------------------------------------------------------------
4248
+ // proxyPropertyMapping(publicAPI, model, map)
4249
+ //
4250
+ // map = {
4251
+ // opacity: { modelKey: 'property', property: 'opacity' },
4252
+ // }
4253
+ //
4254
+ // Generated API:
4255
+ // Elevate set/get methods from internal object stored in the model to current one
4256
+ // ----------------------------------------------------------------------------
4257
+
4258
+ function proxyPropertyMapping(publicAPI, model, map) {
4259
+ var parentDelete = publicAPI.delete;
4260
+ var subscriptions = [];
4261
+ var propertyNames = Object.keys(map);
4262
+ var count = propertyNames.length;
4263
+
4264
+ while (count--) {
4265
+ var propertyName = propertyNames[count];
4266
+ var _map$propertyName = map[propertyName],
4267
+ modelKey = _map$propertyName.modelKey,
4268
+ property = _map$propertyName.property,
4269
+ _map$propertyName$mod = _map$propertyName.modified,
4270
+ modified = _map$propertyName$mod === void 0 ? true : _map$propertyName$mod;
4271
+
4272
+ var methodSrc = _capitalize(property);
4273
+
4274
+ var methodDst = _capitalize(propertyName);
4275
+
4276
+ publicAPI["get".concat(methodDst)] = model[modelKey]["get".concat(methodSrc)];
4277
+ publicAPI["set".concat(methodDst)] = model[modelKey]["set".concat(methodSrc)];
4278
+
4279
+ if (modified) {
4280
+ subscriptions.push(model[modelKey].onModified(publicAPI.modified));
4281
+ }
4282
+ }
4283
+
4284
+ publicAPI.delete = function () {
4285
+ while (subscriptions.length) {
4286
+ subscriptions.pop().unsubscribe();
4287
+ }
4288
+
4289
+ parentDelete();
4290
+ };
4291
+ } // ----------------------------------------------------------------------------
4292
+ // proxyPropertyState(publicAPI, model, state, defaults)
4293
+ //
4294
+ // state = {
4295
+ // representation: {
4296
+ // 'Surface with edges': { property: { edgeVisibility: true, representation: 2 } },
4297
+ // Surface: { property: { edgeVisibility: false, representation: 2 } },
4298
+ // Wireframe: { property: { edgeVisibility: false, representation: 1 } },
4299
+ // Points: { property: { edgeVisibility: false, representation: 0 } },
4300
+ // },
4301
+ // }
4302
+ //
4303
+ // defaults = {
4304
+ // representation: 'Surface',
4305
+ // }
4306
+ //
4307
+ // Generated API
4308
+ // get / set Representation ( string ) => push state to various internal objects
4309
+ // ----------------------------------------------------------------------------
4310
+
4311
+ function proxyPropertyState(publicAPI, model) {
4312
+ var state = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
4313
+ var defaults = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
4314
+ model.this = publicAPI;
4315
+
4316
+ function applyState(map) {
4317
+ var modelKeys = Object.keys(map);
4318
+ var count = modelKeys.length;
4319
+
4320
+ while (count--) {
4321
+ var modelKey = modelKeys[count];
4322
+ model[modelKey].set(map[modelKey]);
4323
+ }
4324
+ }
4325
+
4326
+ var modelKeys = Object.keys(defaults);
4327
+ var count = modelKeys.length;
4328
+
4329
+ var _loop2 = function _loop2() {
4330
+ // Add default
4331
+ var key = modelKeys[count];
4332
+ model[key] = defaults[key]; // Add set method
4333
+
4334
+ var mapping = state[key];
4335
+
4336
+ publicAPI["set".concat(_capitalize(key))] = function (value) {
4337
+ if (value !== model[key]) {
4338
+ model[key] = value;
4339
+ var propValues = mapping[value];
4340
+ applyState(propValues);
4341
+ publicAPI.modified();
4342
+ }
4343
+ };
4344
+ };
4345
+
4346
+ while (count--) {
4347
+ _loop2();
4348
+ } // Add getter
4349
+
4350
+
4351
+ if (modelKeys.length) {
4352
+ get(publicAPI, model, modelKeys);
4353
+ }
4354
+ } // ----------------------------------------------------------------------------
4355
+ // From : https://github.com/facebookarchive/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js
4356
+ //
4357
+ //
4358
+ // Copyright (c) 2015, Facebook, Inc.
4359
+ // All rights reserved.
4360
+ //
4361
+ // This source code is licensed under the BSD-style license found in the
4362
+ // LICENSE file in the root directory of this source tree. An additional grant
4363
+ // of patent rights can be found in the PATENTS file in the same directory.
4364
+ //
4365
+ //
4366
+ // Mouse wheel (and 2-finger trackpad) support on the web sucks. It is
4367
+ // complicated, thus this doc is long and (hopefully) detailed enough to answer
4368
+ // your questions.
4369
+ //
4370
+ // If you need to react to the mouse wheel in a predictable way, this code is
4371
+ // like your bestest friend.// hugs//
4372
+ //
4373
+ // As of today, there are 4 DOM event types you can listen to:
4374
+ //
4375
+ // 'wheel' -- Chrome(31+), FF(17+), IE(9+)
4376
+ // 'mousewheel' -- Chrome, IE(6+), Opera, Safari
4377
+ // 'MozMousePixelScroll' -- FF(3.5 only!) (2010-2013) -- don't bother!
4378
+ // 'DOMMouseScroll' -- FF(0.9.7+) since 2003
4379
+ //
4380
+ // So what to do? The is the best:
4381
+ //
4382
+ // normalizeWheel.getEventType();
4383
+ //
4384
+ // In your event callback, use this code to get sane interpretation of the
4385
+ // deltas. This code will return an object with properties:
4386
+ //
4387
+ // spinX -- normalized spin speed (use for zoom) - x plane
4388
+ // spinY -- " - y plane
4389
+ // pixelX -- normalized distance (to pixels) - x plane
4390
+ // pixelY -- " - y plane
4391
+ //
4392
+ // Wheel values are provided by the browser assuming you are using the wheel to
4393
+ // scroll a web page by a number of lines or pixels (or pages). Values can vary
4394
+ // significantly on different platforms and browsers, forgetting that you can
4395
+ // scroll at different speeds. Some devices (like trackpads) emit more events
4396
+ // at smaller increments with fine granularity, and some emit massive jumps with
4397
+ // linear speed or acceleration.
4398
+ //
4399
+ // This code does its best to normalize the deltas for you:
4400
+ //
4401
+ // - spin is trying to normalize how far the wheel was spun (or trackpad
4402
+ // dragged). This is super useful for zoom support where you want to
4403
+ // throw away the chunky scroll steps on the PC and make those equal to
4404
+ // the slow and smooth tiny steps on the Mac. Key data: This code tries to
4405
+ // resolve a single slow step on a wheel to 1.
4406
+ //
4407
+ // - pixel is normalizing the desired scroll delta in pixel units. You'll
4408
+ // get the crazy differences between browsers, but at least it'll be in
4409
+ // pixels!
4410
+ //
4411
+ // - positive value indicates scrolling DOWN/RIGHT, negative UP/LEFT. This
4412
+ // should translate to positive value zooming IN, negative zooming OUT.
4413
+ // This matches the newer 'wheel' event.
4414
+ //
4415
+ // Why are there spinX, spinY (or pixels)?
4416
+ //
4417
+ // - spinX is a 2-finger side drag on the trackpad, and a shift + wheel turn
4418
+ // with a mouse. It results in side-scrolling in the browser by default.
4419
+ //
4420
+ // - spinY is what you expect -- it's the classic axis of a mouse wheel.
4421
+ //
4422
+ // - I dropped spinZ/pixelZ. It is supported by the DOM 3 'wheel' event and
4423
+ // probably is by browsers in conjunction with fancy 3D controllers .. but
4424
+ // you know.
4425
+ //
4426
+ // Implementation info:
4427
+ //
4428
+ // Examples of 'wheel' event if you scroll slowly (down) by one step with an
4429
+ // average mouse:
4430
+ //
4431
+ // OS X + Chrome (mouse) - 4 pixel delta (wheelDelta -120)
4432
+ // OS X + Safari (mouse) - N/A pixel delta (wheelDelta -12)
4433
+ // OS X + Firefox (mouse) - 0.1 line delta (wheelDelta N/A)
4434
+ // Win8 + Chrome (mouse) - 100 pixel delta (wheelDelta -120)
4435
+ // Win8 + Firefox (mouse) - 3 line delta (wheelDelta -120)
4436
+ //
4437
+ // On the trackpad:
4438
+ //
4439
+ // OS X + Chrome (trackpad) - 2 pixel delta (wheelDelta -6)
4440
+ // OS X + Firefox (trackpad) - 1 pixel delta (wheelDelta N/A)
4441
+ //
4442
+ // On other/older browsers.. it's more complicated as there can be multiple and
4443
+ // also missing delta values.
4444
+ //
4445
+ // The 'wheel' event is more standard:
4446
+ //
4447
+ // http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents
4448
+ //
4449
+ // The basics is that it includes a unit, deltaMode (pixels, lines, pages), and
4450
+ // deltaX, deltaY and deltaZ. Some browsers provide other values to maintain
4451
+ // backward compatibility with older events. Those other values help us
4452
+ // better normalize spin speed. Example of what the browsers provide:
4453
+ //
4454
+ // | event.wheelDelta | event.detail
4455
+ // ------------------+------------------+--------------
4456
+ // Safari v5/OS X | -120 | 0
4457
+ // Safari v5/Win7 | -120 | 0
4458
+ // Chrome v17/OS X | -120 | 0
4459
+ // Chrome v17/Win7 | -120 | 0
4460
+ // IE9/Win7 | -120 | undefined
4461
+ // Firefox v4/OS X | undefined | 1
4462
+ // Firefox v4/Win7 | undefined | 3
4463
+ //
4464
+ // ----------------------------------------------------------------------------
4465
+ // Reasonable defaults
4466
+
4467
+ var PIXEL_STEP = 10;
4468
+ var LINE_HEIGHT = 40;
4469
+ var PAGE_HEIGHT = 800;
4470
+ function normalizeWheel(wheelEvent) {
4471
+ var sX = 0; // spinX
4472
+
4473
+ var sY = 0; // spinY
4474
+
4475
+ var pX = 0; // pixelX
4476
+
4477
+ var pY = 0; // pixelY
4478
+ // Legacy
4479
+
4480
+ if ('detail' in wheelEvent) {
4481
+ sY = wheelEvent.detail;
4482
+ }
4483
+
4484
+ if ('wheelDelta' in wheelEvent) {
4485
+ sY = -wheelEvent.wheelDelta / 120;
4486
+ }
4487
+
4488
+ if ('wheelDeltaY' in wheelEvent) {
4489
+ sY = -wheelEvent.wheelDeltaY / 120;
4490
+ }
4491
+
4492
+ if ('wheelDeltaX' in wheelEvent) {
4493
+ sX = -wheelEvent.wheelDeltaX / 120;
4494
+ } // side scrolling on FF with DOMMouseScroll
4495
+
4496
+
4497
+ if ('axis' in wheelEvent && wheelEvent.axis === wheelEvent.HORIZONTAL_AXIS) {
4498
+ sX = sY;
4499
+ sY = 0;
4500
+ }
4501
+
4502
+ pX = sX * PIXEL_STEP;
4503
+ pY = sY * PIXEL_STEP;
4504
+
4505
+ if ('deltaY' in wheelEvent) {
4506
+ pY = wheelEvent.deltaY;
4507
+ }
4508
+
4509
+ if ('deltaX' in wheelEvent) {
4510
+ pX = wheelEvent.deltaX;
4511
+ }
4512
+
4513
+ if ((pX || pY) && wheelEvent.deltaMode) {
4514
+ if (wheelEvent.deltaMode === 1) {
4515
+ // delta in LINE units
4516
+ pX *= LINE_HEIGHT;
4517
+ pY *= LINE_HEIGHT;
4518
+ } else {
4519
+ // delta in PAGE units
4520
+ pX *= PAGE_HEIGHT;
4521
+ pY *= PAGE_HEIGHT;
4522
+ }
4523
+ } // Fall-back if spin cannot be determined
4524
+
4525
+
4526
+ if (pX && !sX) {
4527
+ sX = pX < 1 ? -1 : 1;
4528
+ }
4529
+
4530
+ if (pY && !sY) {
4531
+ sY = pY < 1 ? -1 : 1;
4532
+ }
4533
+
4534
+ return {
4535
+ spinX: sX,
4536
+ spinY: sY,
4537
+ pixelX: pX,
4538
+ pixelY: pY
4539
+ };
4540
+ } // ----------------------------------------------------------------------------
4541
+ // Default export
4542
+ // ----------------------------------------------------------------------------
4543
+
4544
+ var macro = {
4545
+ algo: algo,
4546
+ capitalize: capitalize,
4547
+ chain: chain,
4548
+ debounce: debounce,
4549
+ enumToString: enumToString,
4550
+ event: macros_event,
4551
+ EVENT_ABORT: EVENT_ABORT,
4552
+ formatBytesToProperUnit: formatBytesToProperUnit,
4553
+ formatNumbersWithThousandSeparator: formatNumbersWithThousandSeparator,
4554
+ get: get,
4555
+ getArray: getArray,
4556
+ getCurrentGlobalMTime: getCurrentGlobalMTime,
4557
+ getStateArrayMapFunc: getStateArrayMapFunc,
4558
+ isVtkObject: isVtkObject,
4559
+ keystore: keystore,
4560
+ measurePromiseExecution: measurePromiseExecution,
4561
+ moveToProtected: moveToProtected,
4562
+ newInstance: newInstance,
4563
+ newTypedArray: newTypedArray,
4564
+ newTypedArrayFrom: newTypedArrayFrom,
4565
+ normalizeWheel: normalizeWheel,
4566
+ obj: obj,
4567
+ proxy: proxy,
4568
+ proxyPropertyMapping: proxyPropertyMapping,
4569
+ proxyPropertyState: proxyPropertyState,
4570
+ safeArrays: safeArrays,
4571
+ set: set,
4572
+ setArray: setArray,
4573
+ setGet: setGet,
4574
+ setGetArray: setGetArray,
4575
+ setImmediate: setImmediateVTK,
4576
+ setLoggerFunction: setLoggerFunction,
4577
+ throttle: throttle,
4578
+ traverseInstanceTree: traverseInstanceTree,
4579
+ TYPED_ARRAYS: TYPED_ARRAYS,
4580
+ // deprecated todo remove on breaking API revision
4581
+ uncapitalize: uncapitalize,
4582
+ VOID: VOID,
4583
+ vtkDebugMacro: vtkDebugMacro,
4584
+ vtkErrorMacro: vtkErrorMacro,
4585
+ vtkInfoMacro: vtkInfoMacro,
4586
+ vtkLogMacro: vtkLogMacro,
4587
+ vtkOnceErrorMacro: vtkOnceErrorMacro,
4588
+ vtkWarningMacro: vtkWarningMacro
4589
+ };
4590
+
4591
+
4592
+
4593
+
4594
+ /***/ }),
4595
+
4596
+ /***/ 88095:
4597
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4598
+
4599
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4600
+ /* harmony export */ "I": () => (/* binding */ vtkGlobal),
4601
+ /* harmony export */ "Z": () => (/* binding */ vtk)
4602
+ /* harmony export */ });
4603
+ /* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(36655);
4604
+ /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(47169);
4605
+ /* harmony import */ var globalthis__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(61651);
4606
+ /* harmony import */ var globalthis__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(globalthis__WEBPACK_IMPORTED_MODULE_2__);
4607
+
4608
+
4609
+
4610
+
4611
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4612
+
4613
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4614
+ var vtkGlobal = globalthis__WEBPACK_IMPORTED_MODULE_2___default()(); // returns native globalThis if compliant
4615
+
4616
+ var factoryMapping = {
4617
+ vtkObject: function vtkObject() {
4618
+ return null;
4619
+ }
4620
+ };
4621
+ function vtk(obj) {
4622
+ if (obj === null || obj === undefined) {
4623
+ return obj;
4624
+ }
4625
+
4626
+ if (obj.isA) {
4627
+ return obj;
4628
+ }
4629
+
4630
+ if (!obj.vtkClass) {
4631
+ if (vtkGlobal.console && vtkGlobal.console.error) {
4632
+ vtkGlobal.console.error('Invalid VTK object');
4633
+ }
4634
+
4635
+ return null;
4636
+ }
4637
+
4638
+ var constructor = factoryMapping[obj.vtkClass];
4639
+
4640
+ if (!constructor) {
4641
+ if (vtkGlobal.console && vtkGlobal.console.error) {
4642
+ vtkGlobal.console.error("No vtk class found for Object of type ".concat(obj.vtkClass));
4643
+ }
4644
+
4645
+ return null;
4646
+ } // Shallow copy object
4647
+
4648
+
4649
+ var model = _objectSpread({}, obj); // Convert into vtkObject any nested key
4650
+
4651
+
4652
+ Object.keys(model).forEach(function (keyName) {
4653
+ if (model[keyName] && (0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(model[keyName]) === 'object' && model[keyName].vtkClass) {
4654
+ model[keyName] = vtk(model[keyName]);
4655
+ }
4656
+ }); // Return the root
4657
+
4658
+ var newInst = constructor(model);
4659
+
4660
+ if (newInst && newInst.modified) {
4661
+ newInst.modified();
4662
+ }
4663
+
4664
+ return newInst;
4665
+ }
4666
+
4667
+ function register(vtkClassName, constructor) {
4668
+ factoryMapping[vtkClassName] = constructor;
4669
+ } // Nest register method under the vtk function
4670
+
4671
+
4672
+ vtk.register = register;
4673
+
4674
+
4675
+
4676
+
4677
+ /***/ }),
4678
+
4679
+ /***/ 13629:
4680
+ /***/ ((module) => {
4681
+
4682
+ /* eslint no-negated-condition: 0, no-new-func: 0 */
4683
+
4684
+
4685
+
4686
+ if (typeof self !== 'undefined') {
4687
+ module.exports = self;
4688
+ } else if (typeof window !== 'undefined') {
4689
+ module.exports = window;
4690
+ } else {
4691
+ module.exports = Function('return this')();
4692
+ }
4693
+
4694
+
4695
+ /***/ }),
4696
+
4697
+ /***/ 61651:
4698
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4699
+
4700
+
4701
+
4702
+ var defineProperties = __webpack_require__(26506);
4703
+
4704
+ var implementation = __webpack_require__(13629);
4705
+ var getPolyfill = __webpack_require__(83916);
4706
+ var shim = __webpack_require__(53082);
4707
+
4708
+ var polyfill = getPolyfill();
4709
+
4710
+ var getGlobal = function () { return polyfill; };
4711
+
4712
+ defineProperties(getGlobal, {
4713
+ getPolyfill: getPolyfill,
4714
+ implementation: implementation,
4715
+ shim: shim
4716
+ });
4717
+
4718
+ module.exports = getGlobal;
4719
+
4720
+
4721
+ /***/ }),
4722
+
4723
+ /***/ 83916:
4724
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4725
+
4726
+
4727
+
4728
+ var implementation = __webpack_require__(13629);
4729
+
4730
+ module.exports = function getPolyfill() {
4731
+ if (typeof __webpack_require__.g !== 'object' || !__webpack_require__.g || __webpack_require__.g.Math !== Math || __webpack_require__.g.Array !== Array) {
4732
+ return implementation;
4733
+ }
4734
+ return __webpack_require__.g;
4735
+ };
4736
+
4737
+
4738
+ /***/ }),
4739
+
4740
+ /***/ 53082:
4741
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4742
+
4743
+
4744
+
4745
+ var define = __webpack_require__(26506);
4746
+ var getPolyfill = __webpack_require__(83916);
4747
+
4748
+ module.exports = function shimGlobal() {
4749
+ var polyfill = getPolyfill();
4750
+ if (define.supportsDescriptors) {
4751
+ var descriptor = Object.getOwnPropertyDescriptor(polyfill, 'globalThis');
4752
+ if (!descriptor || (descriptor.configurable && (descriptor.enumerable || !descriptor.writable || globalThis !== polyfill))) { // eslint-disable-line max-len
4753
+ Object.defineProperty(polyfill, 'globalThis', {
4754
+ configurable: true,
4755
+ enumerable: false,
4756
+ value: polyfill,
4757
+ writable: true
4758
+ });
4759
+ }
4760
+ } else if (typeof globalThis !== 'object' || globalThis !== polyfill) {
4761
+ polyfill.globalThis = polyfill;
4762
+ }
4763
+ return polyfill;
4764
+ };
4765
+
4766
+
4767
+ /***/ })
4768
+
4769
+ }]);