@kitware/vtk.js 20.1.4 → 20.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/Common/Core/Base64.d.ts +14 -2
  2. package/Common/Core/Base64.js +31 -2
  3. package/Common/Core/Math/index.js +1 -1
  4. package/Common/Core/Math.d.ts +168 -158
  5. package/Common/Core/Math.js +1 -1
  6. package/Common/Core/MatrixBuilder.js +39 -41
  7. package/Common/DataModel/Box.d.ts +73 -0
  8. package/Common/DataModel/ImageData.js +12 -14
  9. package/Common/Transform/LandmarkTransform.js +6 -7
  10. package/Filters/General/PaintFilter/PaintFilter.worker.js +8 -8
  11. package/Filters/General/PaintFilter.js +11 -11
  12. package/Filters/Sources/CubeSource.d.ts +7 -6
  13. package/Filters/Sources/PlaneSource.js +12 -13
  14. package/IO/Core/BinaryHelper.js +2 -4
  15. package/IO/Core/DataAccessHelper/HtmlDataAccessHelper.js +1 -1
  16. package/IO/Core/DataAccessHelper/HttpDataAccessHelper.js +1 -1
  17. package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.js +2 -2
  18. package/IO/Core/ZipMultiDataSetReader.js +1 -1
  19. package/IO/Core/ZipMultiDataSetWriter.js +1 -1
  20. package/IO/Geometry/STLWriter.js +4 -4
  21. package/IO/Misc/OBJReader.d.ts +9 -8
  22. package/IO/Misc/SkyboxReader.js +1 -1
  23. package/IO/XML/XMLReader.js +3 -4
  24. package/IO/XML/XMLWriter.js +5 -6
  25. package/Imaging/Core/ImageReslice.js +18 -19
  26. package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +27 -28
  27. package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +8 -9
  28. package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +14 -15
  29. package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +12 -13
  30. package/Interaction/Widgets/ImageCroppingRegionsWidget.js +5 -6
  31. package/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +1 -1
  32. package/Interaction/Widgets/PiecewiseGaussianWidget.js +2 -2
  33. package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation.js +8 -9
  34. package/Rendering/Core/Actor.js +3 -4
  35. package/Rendering/Core/AnnotatedCubeActor.d.ts +5 -6
  36. package/Rendering/Core/Camera.js +81 -84
  37. package/Rendering/Core/CellPicker.js +2 -2
  38. package/Rendering/Core/CubeAxesActor.js +37 -34
  39. package/Rendering/Core/Follower.js +20 -21
  40. package/Rendering/Core/Glyph3DMapper.js +30 -32
  41. package/Rendering/Core/ImageMapper.js +2 -2
  42. package/Rendering/Core/ImageSlice.js +5 -6
  43. package/Rendering/Core/Picker.d.ts +5 -5
  44. package/Rendering/Core/Picker.js +5 -6
  45. package/Rendering/Core/PixelSpaceCallbackMapper.js +3 -4
  46. package/Rendering/Core/Prop3D.js +24 -25
  47. package/Rendering/Core/Renderer.js +11 -12
  48. package/Rendering/Core/ScalarBarActor.js +37 -34
  49. package/Rendering/Core/Volume.js +3 -4
  50. package/Rendering/OpenGL/Actor.js +9 -10
  51. package/Rendering/OpenGL/Camera.js +8 -9
  52. package/Rendering/OpenGL/CellArrayBufferObject.js +6 -8
  53. package/Rendering/OpenGL/Glyph3DMapper.js +8 -9
  54. package/Rendering/OpenGL/ImageMapper.js +7 -7
  55. package/Rendering/OpenGL/ImageSlice.js +4 -4
  56. package/Rendering/OpenGL/PolyDataMapper.js +11 -13
  57. package/Rendering/OpenGL/RenderWindow.d.ts +21 -35
  58. package/Rendering/OpenGL/ShaderCache.js +1 -1
  59. package/Rendering/OpenGL/Skybox.js +4 -5
  60. package/Rendering/OpenGL/SphereMapper.js +2 -2
  61. package/Rendering/OpenGL/StickMapper.js +3 -4
  62. package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +1 -1
  63. package/Rendering/OpenGL/Volume.js +6 -7
  64. package/Rendering/OpenGL/VolumeMapper.js +47 -49
  65. package/Rendering/OpenGL/glsl/vtkPolyDataFS.glsl.js +1 -1
  66. package/Rendering/WebGPU/Actor.js +8 -8
  67. package/Rendering/WebGPU/Camera.js +8 -8
  68. package/Rendering/WebGPU/ImageMapper.js +18 -19
  69. package/Rendering/WebGPU/ImageSlice.js +9 -9
  70. package/Rendering/WebGPU/PolyDataMapper.js +3 -4
  71. package/Rendering/WebGPU/Renderer.js +6 -7
  72. package/Rendering/WebGPU/Volume.js +3 -3
  73. package/Rendering/WebGPU/VolumePassFSQ.js +10 -10
  74. package/ThirdParty/index.js +2 -2
  75. package/Widgets/Manipulators/TrackballManipulator.js +5 -6
  76. package/Widgets/Representations/ArrowHandleRepresentation.js +10 -12
  77. package/Widgets/Representations/CircleContextRepresentation.js +4 -5
  78. package/Widgets/Representations/RectangleContextRepresentation.js +3 -3
  79. package/Widgets/Widgets3D/EllipseWidget/behavior.js +5 -5
  80. package/Widgets/Widgets3D/ImageCroppingWidget/helpers.js +6 -8
  81. package/Widgets/Widgets3D/PaintWidget/behavior.js +2 -2
  82. package/Widgets/Widgets3D/ResliceCursorWidget.js +6 -7
  83. package/Widgets/Widgets3D/ShapeWidget/behavior.js +10 -10
  84. package/Widgets/Widgets3D/SplineWidget/behavior.js +5 -5
  85. package/_virtual/rollup-plugin-worker-loader__module_Sources/Filters/General/PaintFilter/PaintFilter.worker.js +1 -1
  86. package/_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +1 -1
  87. package/package.json +2 -2
  88. package/types.d.ts +1 -0
  89. package/vtk.js +2 -2
  90. package/_vendor/base64-js/index.js_commonjs-exports.js +0 -1
  91. package/_vendor/blueimp-md5/js/md5.js_commonjs-module.js +0 -3
  92. package/_vendor/define-properties/index.js_commonjs-proxy.js +0 -1
  93. package/_vendor/globalthis/implementation.browser.js_commonjs-module.js +0 -3
  94. package/_vendor/globalthis/implementation.browser.js_commonjs-proxy.js +0 -1
  95. package/_vendor/globalthis/polyfill.js_commonjs-proxy.js +0 -1
  96. package/_vendor/globalthis/shim.js_commonjs-proxy.js +0 -2
  97. package/_vendor/jszip/dist/jszip.min.js_commonjs-module.js +0 -3
  98. package/_vendor/object-keys/implementation.js_commonjs-proxy.js +0 -1
  99. package/_vendor/object-keys/index.js_commonjs-proxy.js +0 -1
  100. package/_vendor/object-keys/isArguments.js_commonjs-proxy.js +0 -1
  101. package/_vendor/seedrandom/lib/alea.js_commonjs-module.js +0 -3
  102. package/_vendor/seedrandom/lib/alea.js_commonjs-proxy.js +0 -1
  103. package/_vendor/seedrandom/lib/tychei.js_commonjs-module.js +0 -3
  104. package/_vendor/seedrandom/lib/tychei.js_commonjs-proxy.js +0 -1
  105. package/_vendor/seedrandom/lib/xor128.js_commonjs-module.js +0 -3
  106. package/_vendor/seedrandom/lib/xor128.js_commonjs-proxy.js +0 -1
  107. package/_vendor/seedrandom/lib/xor4096.js_commonjs-module.js +0 -3
  108. package/_vendor/seedrandom/lib/xor4096.js_commonjs-proxy.js +0 -1
  109. package/_vendor/seedrandom/lib/xorshift7.js_commonjs-module.js +0 -3
  110. package/_vendor/seedrandom/lib/xorshift7.js_commonjs-proxy.js +0 -1
  111. package/_vendor/seedrandom/lib/xorwow.js_commonjs-module.js +0 -3
  112. package/_vendor/seedrandom/lib/xorwow.js_commonjs-proxy.js +0 -1
  113. package/_vendor/seedrandom/seedrandom.js_commonjs-module.js +0 -3
  114. package/_vendor/seedrandom/seedrandom.js_commonjs-proxy.js +0 -1
  115. package/_vendor/webworker-promise/lib/register.js_commonjs-module.js +0 -3
  116. package/_vendor/webworker-promise/lib/tiny-emitter.js_commonjs-proxy.js +0 -1
  117. package/_vendor/webworker-promise/src/tiny-emitter.js_commonjs-proxy.js +0 -1
  118. package/_vendor/xmlbuilder2/lib/xmlbuilder2.min.js_commonjs-module.js +0 -3
  119. package/_virtual/_rollup_plugin_ignore_empty_module_placeholder_commonjs-proxy.js +0 -6
  120. package/_virtual/commonjsHelpers.js +0 -22
  121. package/_virtual/polyfill-node.buffer.js +0 -1971
  122. package/_virtual/polyfill-node.global.js +0 -5
  123. package/_virtual/rollup_plugin_ignore_empty_module_placeholder.js +0 -8
  124. package/vendor/base64-js/index.js +0 -72
  125. package/vendor/blueimp-md5/js/md5.js +0 -402
  126. package/vendor/d3-array/src/array.js +0 -1
  127. package/vendor/d3-array/src/ascending.js +0 -5
  128. package/vendor/d3-array/src/bin.js +0 -1
  129. package/vendor/d3-array/src/bisect.js +0 -10
  130. package/vendor/d3-array/src/bisector.js +0 -46
  131. package/vendor/d3-array/src/constant.js +0 -1
  132. package/vendor/d3-array/src/count.js +0 -1
  133. package/vendor/d3-array/src/cross.js +0 -1
  134. package/vendor/d3-array/src/cumsum.js +0 -1
  135. package/vendor/d3-array/src/descending.js +0 -1
  136. package/vendor/d3-array/src/deviation.js +0 -1
  137. package/vendor/d3-array/src/difference.js +0 -1
  138. package/vendor/d3-array/src/disjoint.js +0 -1
  139. package/vendor/d3-array/src/every.js +0 -1
  140. package/vendor/d3-array/src/extent.js +0 -1
  141. package/vendor/d3-array/src/filter.js +0 -1
  142. package/vendor/d3-array/src/fsum.js +0 -1
  143. package/vendor/d3-array/src/greatest.js +0 -1
  144. package/vendor/d3-array/src/greatestIndex.js +0 -1
  145. package/vendor/d3-array/src/group.js +0 -1
  146. package/vendor/d3-array/src/groupSort.js +0 -1
  147. package/vendor/d3-array/src/identity.js +0 -1
  148. package/vendor/d3-array/src/index.js +0 -1
  149. package/vendor/d3-array/src/intersection.js +0 -1
  150. package/vendor/d3-array/src/least.js +0 -1
  151. package/vendor/d3-array/src/leastIndex.js +0 -1
  152. package/vendor/d3-array/src/map.js +0 -1
  153. package/vendor/d3-array/src/max.js +0 -1
  154. package/vendor/d3-array/src/maxIndex.js +0 -1
  155. package/vendor/d3-array/src/mean.js +0 -1
  156. package/vendor/d3-array/src/median.js +0 -1
  157. package/vendor/d3-array/src/merge.js +0 -1
  158. package/vendor/d3-array/src/min.js +0 -1
  159. package/vendor/d3-array/src/minIndex.js +0 -1
  160. package/vendor/d3-array/src/mode.js +0 -1
  161. package/vendor/d3-array/src/nice.js +0 -1
  162. package/vendor/d3-array/src/number.js +0 -5
  163. package/vendor/d3-array/src/pairs.js +0 -1
  164. package/vendor/d3-array/src/permute.js +0 -1
  165. package/vendor/d3-array/src/quantile.js +0 -1
  166. package/vendor/d3-array/src/quickselect.js +0 -1
  167. package/vendor/d3-array/src/range.js +0 -1
  168. package/vendor/d3-array/src/reduce.js +0 -1
  169. package/vendor/d3-array/src/reverse.js +0 -1
  170. package/vendor/d3-array/src/scan.js +0 -1
  171. package/vendor/d3-array/src/set.js +0 -1
  172. package/vendor/d3-array/src/shuffle.js +0 -1
  173. package/vendor/d3-array/src/some.js +0 -1
  174. package/vendor/d3-array/src/sort.js +0 -1
  175. package/vendor/d3-array/src/subset.js +0 -1
  176. package/vendor/d3-array/src/sum.js +0 -1
  177. package/vendor/d3-array/src/superset.js +0 -1
  178. package/vendor/d3-array/src/threshold/freedmanDiaconis.js +0 -1
  179. package/vendor/d3-array/src/threshold/scott.js +0 -1
  180. package/vendor/d3-array/src/threshold/sturges.js +0 -1
  181. package/vendor/d3-array/src/ticks.js +0 -56
  182. package/vendor/d3-array/src/transpose.js +0 -1
  183. package/vendor/d3-array/src/union.js +0 -1
  184. package/vendor/d3-array/src/variance.js +0 -1
  185. package/vendor/d3-array/src/zip.js +0 -1
  186. package/vendor/d3-color/src/color.js +0 -373
  187. package/vendor/d3-color/src/cubehelix.js +0 -1
  188. package/vendor/d3-color/src/define.js +0 -12
  189. package/vendor/d3-color/src/index.js +0 -1
  190. package/vendor/d3-color/src/lab.js +0 -1
  191. package/vendor/d3-color/src/math.js +0 -1
  192. package/vendor/d3-format/src/defaultLocale.js +0 -20
  193. package/vendor/d3-format/src/exponent.js +0 -7
  194. package/vendor/d3-format/src/formatDecimal.js +0 -22
  195. package/vendor/d3-format/src/formatGroup.js +0 -20
  196. package/vendor/d3-format/src/formatNumerals.js +0 -9
  197. package/vendor/d3-format/src/formatPrefixAuto.js +0 -18
  198. package/vendor/d3-format/src/formatRounded.js +0 -13
  199. package/vendor/d3-format/src/formatSpecifier.js +0 -49
  200. package/vendor/d3-format/src/formatTrim.js +0 -13
  201. package/vendor/d3-format/src/formatTypes.js +0 -21
  202. package/vendor/d3-format/src/identity.js +0 -5
  203. package/vendor/d3-format/src/index.js +0 -1
  204. package/vendor/d3-format/src/locale.js +0 -150
  205. package/vendor/d3-format/src/precisionFixed.js +0 -7
  206. package/vendor/d3-format/src/precisionPrefix.js +0 -7
  207. package/vendor/d3-format/src/precisionRound.js +0 -8
  208. package/vendor/d3-interpolate/src/array.js +0 -19
  209. package/vendor/d3-interpolate/src/basis.js +0 -1
  210. package/vendor/d3-interpolate/src/basisClosed.js +0 -1
  211. package/vendor/d3-interpolate/src/color.js +0 -26
  212. package/vendor/d3-interpolate/src/constant.js +0 -3
  213. package/vendor/d3-interpolate/src/cubehelix.js +0 -1
  214. package/vendor/d3-interpolate/src/date.js +0 -8
  215. package/vendor/d3-interpolate/src/discrete.js +0 -1
  216. package/vendor/d3-interpolate/src/hcl.js +0 -1
  217. package/vendor/d3-interpolate/src/hsl.js +0 -1
  218. package/vendor/d3-interpolate/src/hue.js +0 -1
  219. package/vendor/d3-interpolate/src/index.js +0 -1
  220. package/vendor/d3-interpolate/src/lab.js +0 -1
  221. package/vendor/d3-interpolate/src/number.js +0 -7
  222. package/vendor/d3-interpolate/src/numberArray.js +0 -16
  223. package/vendor/d3-interpolate/src/object.js +0 -25
  224. package/vendor/d3-interpolate/src/piecewise.js +0 -1
  225. package/vendor/d3-interpolate/src/quantize.js +0 -1
  226. package/vendor/d3-interpolate/src/rgb.js +0 -26
  227. package/vendor/d3-interpolate/src/round.js +0 -7
  228. package/vendor/d3-interpolate/src/string.js +0 -66
  229. package/vendor/d3-interpolate/src/transform/decompose.js +0 -1
  230. package/vendor/d3-interpolate/src/transform/index.js +0 -1
  231. package/vendor/d3-interpolate/src/transform/parse.js +0 -1
  232. package/vendor/d3-interpolate/src/value.js +0 -24
  233. package/vendor/d3-interpolate/src/zoom.js +0 -1
  234. package/vendor/d3-scale/src/band.js +0 -1
  235. package/vendor/d3-scale/src/constant.js +0 -7
  236. package/vendor/d3-scale/src/continuous.js +0 -129
  237. package/vendor/d3-scale/src/diverging.js +0 -1
  238. package/vendor/d3-scale/src/identity.js +0 -1
  239. package/vendor/d3-scale/src/index.js +0 -1
  240. package/vendor/d3-scale/src/init.js +0 -10
  241. package/vendor/d3-scale/src/linear.js +0 -72
  242. package/vendor/d3-scale/src/log.js +0 -1
  243. package/vendor/d3-scale/src/nice.js +0 -1
  244. package/vendor/d3-scale/src/number.js +0 -5
  245. package/vendor/d3-scale/src/ordinal.js +0 -1
  246. package/vendor/d3-scale/src/pow.js +0 -1
  247. package/vendor/d3-scale/src/quantile.js +0 -1
  248. package/vendor/d3-scale/src/quantize.js +0 -1
  249. package/vendor/d3-scale/src/radial.js +0 -1
  250. package/vendor/d3-scale/src/sequential.js +0 -1
  251. package/vendor/d3-scale/src/sequentialQuantile.js +0 -1
  252. package/vendor/d3-scale/src/symlog.js +0 -1
  253. package/vendor/d3-scale/src/threshold.js +0 -1
  254. package/vendor/d3-scale/src/tickFormat.js +0 -35
  255. package/vendor/d3-scale/src/time.js +0 -1
  256. package/vendor/d3-scale/src/utcTime.js +0 -1
  257. package/vendor/d3-time/src/day.js +0 -1
  258. package/vendor/d3-time/src/duration.js +0 -1
  259. package/vendor/d3-time/src/hour.js +0 -1
  260. package/vendor/d3-time/src/index.js +0 -1
  261. package/vendor/d3-time/src/interval.js +0 -1
  262. package/vendor/d3-time/src/millisecond.js +0 -1
  263. package/vendor/d3-time/src/minute.js +0 -1
  264. package/vendor/d3-time/src/month.js +0 -1
  265. package/vendor/d3-time/src/second.js +0 -1
  266. package/vendor/d3-time/src/ticks.js +0 -1
  267. package/vendor/d3-time/src/utcDay.js +0 -1
  268. package/vendor/d3-time/src/utcHour.js +0 -1
  269. package/vendor/d3-time/src/utcMinute.js +0 -1
  270. package/vendor/d3-time/src/utcMonth.js +0 -1
  271. package/vendor/d3-time/src/utcWeek.js +0 -1
  272. package/vendor/d3-time/src/utcYear.js +0 -1
  273. package/vendor/d3-time/src/week.js +0 -1
  274. package/vendor/d3-time/src/year.js +0 -1
  275. package/vendor/d3-time-format/src/defaultLocale.js +0 -1
  276. package/vendor/d3-time-format/src/index.js +0 -1
  277. package/vendor/d3-time-format/src/isoFormat.js +0 -1
  278. package/vendor/d3-time-format/src/isoParse.js +0 -1
  279. package/vendor/d3-time-format/src/locale.js +0 -1
  280. package/vendor/define-properties/index.js +0 -60
  281. package/vendor/gl-matrix/esm/common.js +0 -30
  282. package/vendor/gl-matrix/esm/index.js +0 -1
  283. package/vendor/gl-matrix/esm/mat2.js +0 -1
  284. package/vendor/gl-matrix/esm/mat2d.js +0 -1
  285. package/vendor/gl-matrix/esm/mat3.js +0 -817
  286. package/vendor/gl-matrix/esm/mat4.js +0 -1868
  287. package/vendor/gl-matrix/esm/quat.js +0 -330
  288. package/vendor/gl-matrix/esm/quat2.js +0 -1
  289. package/vendor/gl-matrix/esm/vec2.js +0 -1
  290. package/vendor/gl-matrix/esm/vec3.js +0 -842
  291. package/vendor/gl-matrix/esm/vec4.js +0 -153
  292. package/vendor/globalthis/implementation.browser.js +0 -11
  293. package/vendor/globalthis/index.js +0 -25
  294. package/vendor/globalthis/polyfill.js +0 -14
  295. package/vendor/globalthis/shim.js +0 -25
  296. package/vendor/internmap/src/index.js +0 -1
  297. package/vendor/jszip/dist/jszip.min.js +0 -11
  298. package/vendor/object-keys/implementation.js +0 -124
  299. package/vendor/object-keys/index.js +0 -35
  300. package/vendor/object-keys/isArguments.js +0 -17
  301. package/vendor/pako/dist/pako.esm.mjs.js +0 -6707
  302. package/vendor/seedrandom/index.js +0 -77
  303. package/vendor/seedrandom/lib/alea.js +0 -117
  304. package/vendor/seedrandom/lib/tychei.js +0 -105
  305. package/vendor/seedrandom/lib/xor128.js +0 -84
  306. package/vendor/seedrandom/lib/xor4096.js +0 -150
  307. package/vendor/seedrandom/lib/xorshift7.js +0 -101
  308. package/vendor/seedrandom/lib/xorwow.js +0 -89
  309. package/vendor/seedrandom/seedrandom.js +0 -256
  310. package/vendor/webworker-promise/lib/register.js +0 -158
  311. package/vendor/webworker-promise/lib/tiny-emitter.js +0 -89
  312. package/vendor/webworker-promise/src/index.js +0 -110
  313. package/vendor/webworker-promise/src/tiny-emitter.js +0 -51
  314. package/vendor/xmlbuilder2/lib/xmlbuilder2.min.js +0 -13
@@ -1,89 +0,0 @@
1
- import { c as commonjsGlobal } from '../../../_virtual/commonjsHelpers.js';
2
- import { x as xorwow } from '../../../_vendor/seedrandom/lib/xorwow.js_commonjs-module.js';
3
-
4
- (function (module) {
5
- // A Javascript implementaion of the "xorwow" prng algorithm by
6
- // George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper
7
-
8
- (function(global, module, define) {
9
-
10
- function XorGen(seed) {
11
- var me = this, strseed = '';
12
-
13
- // Set up generator function.
14
- me.next = function() {
15
- var t = (me.x ^ (me.x >>> 2));
16
- me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v;
17
- return (me.d = (me.d + 362437 | 0)) +
18
- (me.v = (me.v ^ (me.v << 4)) ^ (t ^ (t << 1))) | 0;
19
- };
20
-
21
- me.x = 0;
22
- me.y = 0;
23
- me.z = 0;
24
- me.w = 0;
25
- me.v = 0;
26
-
27
- if (seed === (seed | 0)) {
28
- // Integer seed.
29
- me.x = seed;
30
- } else {
31
- // String seed.
32
- strseed += seed;
33
- }
34
-
35
- // Mix in string seed, then discard an initial batch of 64 values.
36
- for (var k = 0; k < strseed.length + 64; k++) {
37
- me.x ^= strseed.charCodeAt(k) | 0;
38
- if (k == strseed.length) {
39
- me.d = me.x << 10 ^ me.x >>> 4;
40
- }
41
- me.next();
42
- }
43
- }
44
-
45
- function copy(f, t) {
46
- t.x = f.x;
47
- t.y = f.y;
48
- t.z = f.z;
49
- t.w = f.w;
50
- t.v = f.v;
51
- t.d = f.d;
52
- return t;
53
- }
54
-
55
- function impl(seed, opts) {
56
- var xg = new XorGen(seed),
57
- state = opts && opts.state,
58
- prng = function() { return (xg.next() >>> 0) / 0x100000000; };
59
- prng.double = function() {
60
- do {
61
- var top = xg.next() >>> 11,
62
- bot = (xg.next() >>> 0) / 0x100000000,
63
- result = (top + bot) / (1 << 21);
64
- } while (result === 0);
65
- return result;
66
- };
67
- prng.int32 = xg.next;
68
- prng.quick = prng;
69
- if (state) {
70
- if (typeof(state) == 'object') copy(state, xg);
71
- prng.state = function() { return copy(xg, {}); };
72
- }
73
- return prng;
74
- }
75
-
76
- if (module && module.exports) {
77
- module.exports = impl;
78
- } else if (define && define.amd) {
79
- define(function() { return impl; });
80
- } else {
81
- this.xorwow = impl;
82
- }
83
-
84
- })(
85
- commonjsGlobal,
86
- module, // present in node.js
87
- (typeof undefined) == 'function' // present with an AMD loader
88
- );
89
- }(xorwow));
@@ -1,256 +0,0 @@
1
- import { c as commonjsGlobal } from '../../_virtual/commonjsHelpers.js';
2
- import { s as seedrandom } from '../../_vendor/seedrandom/seedrandom.js_commonjs-module.js';
3
- import { r as require$$0 } from '../../_virtual/_rollup_plugin_ignore_empty_module_placeholder_commonjs-proxy.js';
4
-
5
- /*
6
- Copyright 2019 David Bau.
7
-
8
- Permission is hereby granted, free of charge, to any person obtaining
9
- a copy of this software and associated documentation files (the
10
- "Software"), to deal in the Software without restriction, including
11
- without limitation the rights to use, copy, modify, merge, publish,
12
- distribute, sublicense, and/or sell copies of the Software, and to
13
- permit persons to whom the Software is furnished to do so, subject to
14
- the following conditions:
15
-
16
- The above copyright notice and this permission notice shall be
17
- included in all copies or substantial portions of the Software.
18
-
19
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
-
27
- */
28
-
29
- (function (module) {
30
- (function (global, pool, math) {
31
- //
32
- // The following constants are related to IEEE 754 limits.
33
- //
34
-
35
- var width = 256, // each RC4 output is 0 <= x < 256
36
- chunks = 6, // at least six RC4 outputs for each double
37
- digits = 52, // there are 52 significant digits in a double
38
- rngname = 'random', // rngname: name for Math.random and Math.seedrandom
39
- startdenom = math.pow(width, chunks),
40
- significance = math.pow(2, digits),
41
- overflow = significance * 2,
42
- mask = width - 1,
43
- nodecrypto; // node.js crypto module, initialized at the bottom.
44
-
45
- //
46
- // seedrandom()
47
- // This is the seedrandom function described above.
48
- //
49
- function seedrandom(seed, options, callback) {
50
- var key = [];
51
- options = (options == true) ? { entropy: true } : (options || {});
52
-
53
- // Flatten the seed string or build one from local entropy if needed.
54
- var shortseed = mixkey(flatten(
55
- options.entropy ? [seed, tostring(pool)] :
56
- (seed == null) ? autoseed() : seed, 3), key);
57
-
58
- // Use the seed to initialize an ARC4 generator.
59
- var arc4 = new ARC4(key);
60
-
61
- // This function returns a random double in [0, 1) that contains
62
- // randomness in every bit of the mantissa of the IEEE 754 value.
63
- var prng = function() {
64
- var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48
65
- d = startdenom, // and denominator d = 2 ^ 48.
66
- x = 0; // and no 'extra last byte'.
67
- while (n < significance) { // Fill up all significant digits by
68
- n = (n + x) * width; // shifting numerator and
69
- d *= width; // denominator and generating a
70
- x = arc4.g(1); // new least-significant-byte.
71
- }
72
- while (n >= overflow) { // To avoid rounding up, before adding
73
- n /= 2; // last byte, shift everything
74
- d /= 2; // right using integer math until
75
- x >>>= 1; // we have exactly the desired bits.
76
- }
77
- return (n + x) / d; // Form the number within [0, 1).
78
- };
79
-
80
- prng.int32 = function() { return arc4.g(4) | 0; };
81
- prng.quick = function() { return arc4.g(4) / 0x100000000; };
82
- prng.double = prng;
83
-
84
- // Mix the randomness into accumulated entropy.
85
- mixkey(tostring(arc4.S), pool);
86
-
87
- // Calling convention: what to return as a function of prng, seed, is_math.
88
- return (options.pass || callback ||
89
- function(prng, seed, is_math_call, state) {
90
- if (state) {
91
- // Load the arc4 state from the given state if it has an S array.
92
- if (state.S) { copy(state, arc4); }
93
- // Only provide the .state method if requested via options.state.
94
- prng.state = function() { return copy(arc4, {}); };
95
- }
96
-
97
- // If called as a method of Math (Math.seedrandom()), mutate
98
- // Math.random because that is how seedrandom.js has worked since v1.0.
99
- if (is_math_call) { math[rngname] = prng; return seed; }
100
-
101
- // Otherwise, it is a newer calling convention, so return the
102
- // prng directly.
103
- else return prng;
104
- })(
105
- prng,
106
- shortseed,
107
- 'global' in options ? options.global : (this == math),
108
- options.state);
109
- }
110
-
111
- //
112
- // ARC4
113
- //
114
- // An ARC4 implementation. The constructor takes a key in the form of
115
- // an array of at most (width) integers that should be 0 <= x < (width).
116
- //
117
- // The g(count) method returns a pseudorandom integer that concatenates
118
- // the next (count) outputs from ARC4. Its return value is a number x
119
- // that is in the range 0 <= x < (width ^ count).
120
- //
121
- function ARC4(key) {
122
- var t, keylen = key.length,
123
- me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];
124
-
125
- // The empty key [] is treated as [0].
126
- if (!keylen) { key = [keylen++]; }
127
-
128
- // Set up S using the standard key scheduling algorithm.
129
- while (i < width) {
130
- s[i] = i++;
131
- }
132
- for (i = 0; i < width; i++) {
133
- s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];
134
- s[j] = t;
135
- }
136
-
137
- // The "g" method returns the next (count) outputs as one number.
138
- (me.g = function(count) {
139
- // Using instance members instead of closure state nearly doubles speed.
140
- var t, r = 0,
141
- i = me.i, j = me.j, s = me.S;
142
- while (count--) {
143
- t = s[i = mask & (i + 1)];
144
- r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];
145
- }
146
- me.i = i; me.j = j;
147
- return r;
148
- // For robust unpredictability, the function call below automatically
149
- // discards an initial batch of values. This is called RC4-drop[256].
150
- // See http://google.com/search?q=rsa+fluhrer+response&btnI
151
- })(width);
152
- }
153
-
154
- //
155
- // copy()
156
- // Copies internal state of ARC4 to or from a plain object.
157
- //
158
- function copy(f, t) {
159
- t.i = f.i;
160
- t.j = f.j;
161
- t.S = f.S.slice();
162
- return t;
163
- }
164
- //
165
- // flatten()
166
- // Converts an object tree to nested arrays of strings.
167
- //
168
- function flatten(obj, depth) {
169
- var result = [], typ = (typeof obj), prop;
170
- if (depth && typ == 'object') {
171
- for (prop in obj) {
172
- try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}
173
- }
174
- }
175
- return (result.length ? result : typ == 'string' ? obj : obj + '\0');
176
- }
177
-
178
- //
179
- // mixkey()
180
- // Mixes a string seed into a key that is an array of integers, and
181
- // returns a shortened string seed that is equivalent to the result key.
182
- //
183
- function mixkey(seed, key) {
184
- var stringseed = seed + '', smear, j = 0;
185
- while (j < stringseed.length) {
186
- key[mask & j] =
187
- mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));
188
- }
189
- return tostring(key);
190
- }
191
-
192
- //
193
- // autoseed()
194
- // Returns an object for autoseeding, using window.crypto and Node crypto
195
- // module if available.
196
- //
197
- function autoseed() {
198
- try {
199
- var out;
200
- if (nodecrypto && (out = nodecrypto.randomBytes)) {
201
- // The use of 'out' to remember randomBytes makes tight minified code.
202
- out = out(width);
203
- } else {
204
- out = new Uint8Array(width);
205
- (global.crypto || global.msCrypto).getRandomValues(out);
206
- }
207
- return tostring(out);
208
- } catch (e) {
209
- var browser = global.navigator,
210
- plugins = browser && browser.plugins;
211
- return [+new Date, global, plugins, global.screen, tostring(pool)];
212
- }
213
- }
214
-
215
- //
216
- // tostring()
217
- // Converts an array of charcodes to a string
218
- //
219
- function tostring(a) {
220
- return String.fromCharCode.apply(0, a);
221
- }
222
-
223
- //
224
- // When seedrandom.js is loaded, we immediately mix a few bits
225
- // from the built-in RNG into the entropy pool. Because we do
226
- // not want to interfere with deterministic PRNG state later,
227
- // seedrandom will not call math.random on its own again after
228
- // initialization.
229
- //
230
- mixkey(math.random(), pool);
231
-
232
- //
233
- // Nodejs and AMD support: export the implementation as a module using
234
- // either convention.
235
- //
236
- if (module.exports) {
237
- module.exports = seedrandom;
238
- // When in node.js, try using crypto package for autoseeding.
239
- try {
240
- nodecrypto = require$$0;
241
- } catch (ex) {}
242
- } else {
243
- // When included as a plain script, set up Math.seedrandom global.
244
- math['seed' + rngname] = seedrandom;
245
- }
246
-
247
-
248
- // End anonymous scope, and pass initial values.
249
- })(
250
- // global: `self` in browsers (including strict mode and web workers),
251
- // otherwise `this` in Node and other environments
252
- (typeof self !== 'undefined') ? self : commonjsGlobal,
253
- [], // pool: entropy pool starts empty
254
- Math // math: package containing random, pow, and seedrandom
255
- );
256
- }(seedrandom));
@@ -1,158 +0,0 @@
1
- import { r as register } from '../../../_vendor/webworker-promise/lib/register.js_commonjs-module.js';
2
- import { t as tinyEmitter } from './tiny-emitter.js';
3
-
4
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
5
-
6
- var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
7
-
8
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
9
-
10
- function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
11
-
12
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
-
14
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
15
-
16
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
17
-
18
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
-
20
- var TinyEmitter = tinyEmitter;
21
-
22
- var MESSAGE_RESULT = 0;
23
- var MESSAGE_EVENT = 1;
24
-
25
- var RESULT_ERROR = 0;
26
- var RESULT_SUCCESS = 1;
27
-
28
- var DEFAULT_HANDLER = 'main';
29
-
30
- var isPromise = function isPromise(o) {
31
- return (typeof o === 'undefined' ? 'undefined' : _typeof(o)) === 'object' && o !== null && typeof o.then === 'function' && typeof o.catch === 'function';
32
- };
33
-
34
- function RegisterPromise(fn) {
35
- var handlers = _defineProperty({}, DEFAULT_HANDLER, fn);
36
- var sendPostMessage = self.postMessage.bind(self);
37
-
38
- var server = new (function (_TinyEmitter) {
39
- _inherits(WorkerRegister, _TinyEmitter);
40
-
41
- function WorkerRegister() {
42
- _classCallCheck(this, WorkerRegister);
43
-
44
- return _possibleConstructorReturn(this, (WorkerRegister.__proto__ || Object.getPrototypeOf(WorkerRegister)).apply(this, arguments));
45
- }
46
-
47
- _createClass(WorkerRegister, [{
48
- key: 'emit',
49
- value: function emit(eventName) {
50
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
51
- args[_key - 1] = arguments[_key];
52
- }
53
-
54
- if (args.length == 1 && args[0] instanceof TransferableResponse) {
55
- sendPostMessage({ eventName: eventName, args: args }, args[0].transferable);
56
- } else {
57
- sendPostMessage({ eventName: eventName, args: args });
58
- }
59
- return this;
60
- }
61
- }, {
62
- key: 'emitLocally',
63
- value: function emitLocally(eventName) {
64
- var _get2;
65
-
66
- for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
67
- args[_key2 - 1] = arguments[_key2];
68
- }
69
-
70
- (_get2 = _get(WorkerRegister.prototype.__proto__ || Object.getPrototypeOf(WorkerRegister.prototype), 'emit', this)).call.apply(_get2, [this, eventName].concat(args));
71
- }
72
- }, {
73
- key: 'operation',
74
- value: function operation(name, handler) {
75
- handlers[name] = handler;
76
- return this;
77
- }
78
- }]);
79
-
80
- return WorkerRegister;
81
- }(TinyEmitter))();
82
-
83
- var run = function run(messageId, payload, handlerName) {
84
-
85
- var onSuccess = function onSuccess(result) {
86
- if (result && result instanceof TransferableResponse) {
87
- sendResult(messageId, RESULT_SUCCESS, result.payload, result.transferable);
88
- } else {
89
- sendResult(messageId, RESULT_SUCCESS, result);
90
- }
91
- };
92
-
93
- var onError = function onError(e) {
94
- sendResult(messageId, RESULT_ERROR, {
95
- message: e.message,
96
- stack: e.stack
97
- });
98
- };
99
-
100
- try {
101
- var result = runFn(messageId, payload, handlerName);
102
- if (isPromise(result)) {
103
- result.then(onSuccess).catch(onError);
104
- } else {
105
- onSuccess(result);
106
- }
107
- } catch (e) {
108
- onError(e);
109
- }
110
- };
111
-
112
- var runFn = function runFn(messageId, payload, handlerName) {
113
- var handler = handlers[handlerName || DEFAULT_HANDLER];
114
- if (!handler) throw new Error('Not found handler for this request');
115
-
116
- return handler(payload, sendEvent.bind(null, messageId));
117
- };
118
-
119
- var sendResult = function sendResult(messageId, success, payload) {
120
- var transferable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
121
-
122
- sendPostMessage([MESSAGE_RESULT, messageId, success, payload], transferable);
123
- };
124
-
125
- var sendEvent = function sendEvent(messageId, eventName, payload) {
126
- if (!eventName) throw new Error('eventName is required');
127
-
128
- if (typeof eventName !== 'string') throw new Error('eventName should be string');
129
-
130
- sendPostMessage([MESSAGE_EVENT, messageId, eventName, payload]);
131
- };
132
-
133
- self.addEventListener('message', function (_ref) {
134
- var data = _ref.data;
135
-
136
- if (Array.isArray(data)) {
137
- run.apply(undefined, _toConsumableArray(data));
138
- } else if (data && data.eventName) {
139
- server.emitLocally.apply(server, [data.eventName].concat(_toConsumableArray(data.args)));
140
- }
141
- });
142
-
143
- return server;
144
- }
145
-
146
- var TransferableResponse = function TransferableResponse(payload, transferable) {
147
- _classCallCheck(this, TransferableResponse);
148
-
149
- this.payload = payload;
150
- this.transferable = transferable;
151
- };
152
-
153
- register.exports = RegisterPromise;
154
- register.exports.TransferableResponse = TransferableResponse;
155
-
156
- var registerWebworker = register.exports;
157
-
158
- export { registerWebworker as r };
@@ -1,89 +0,0 @@
1
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2
-
3
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
-
5
- var TinyEmitter = function () {
6
- function TinyEmitter() {
7
- _classCallCheck(this, TinyEmitter);
8
-
9
- Object.defineProperty(this, '__listeners', {
10
- value: {},
11
- enumerable: false,
12
- writable: false
13
- });
14
- }
15
-
16
- _createClass(TinyEmitter, [{
17
- key: 'emit',
18
- value: function emit(eventName) {
19
- if (!this.__listeners[eventName]) return this;
20
-
21
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
22
- args[_key - 1] = arguments[_key];
23
- }
24
-
25
- var _iteratorNormalCompletion = true;
26
- var _didIteratorError = false;
27
- var _iteratorError = undefined;
28
-
29
- try {
30
- for (var _iterator = this.__listeners[eventName][Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
31
- var handler = _step.value;
32
-
33
- handler.apply(undefined, args);
34
- }
35
- } catch (err) {
36
- _didIteratorError = true;
37
- _iteratorError = err;
38
- } finally {
39
- try {
40
- if (!_iteratorNormalCompletion && _iterator.return) {
41
- _iterator.return();
42
- }
43
- } finally {
44
- if (_didIteratorError) {
45
- throw _iteratorError;
46
- }
47
- }
48
- }
49
-
50
- return this;
51
- }
52
- }, {
53
- key: 'once',
54
- value: function once(eventName, handler) {
55
- var _this = this;
56
-
57
- var once = function once() {
58
- _this.off(eventName, once);
59
- handler.apply(undefined, arguments);
60
- };
61
-
62
- return this.on(eventName, once);
63
- }
64
- }, {
65
- key: 'on',
66
- value: function on(eventName, handler) {
67
- if (!this.__listeners[eventName]) this.__listeners[eventName] = [];
68
-
69
- this.__listeners[eventName].push(handler);
70
-
71
- return this;
72
- }
73
- }, {
74
- key: 'off',
75
- value: function off(eventName, handler) {
76
- if (handler) this.__listeners[eventName] = this.__listeners[eventName].filter(function (h) {
77
- return h !== handler;
78
- });else this.__listeners[eventName] = [];
79
-
80
- return this;
81
- }
82
- }]);
83
-
84
- return TinyEmitter;
85
- }();
86
-
87
- var tinyEmitter = TinyEmitter;
88
-
89
- export { tinyEmitter as t };
@@ -1,110 +0,0 @@
1
- import { t as tinyEmitter } from './tiny-emitter.js';
2
-
3
- const TinyEmitter = tinyEmitter;
4
-
5
- const MESSAGE_RESULT = 0;
6
- const MESSAGE_EVENT = 1;
7
- const RESULT_SUCCESS = 1;
8
-
9
- class Worker extends TinyEmitter {
10
- /**
11
- *
12
- * @param worker {Worker}
13
- */
14
- constructor(worker) {
15
- super();
16
-
17
- this._messageId = 1;
18
- this._messages = new Map();
19
-
20
- this._worker = worker;
21
- this._worker.onmessage = this._onMessage.bind(this);
22
- this._id = Math.ceil(Math.random() * 10000000);
23
- }
24
-
25
- terminate() {
26
- this._worker.terminate();
27
- }
28
-
29
- /**
30
- * return true if there is no unresolved jobs
31
- * @returns {boolean}
32
- */
33
- isFree() {
34
- return this._messages.size === 0;
35
- }
36
-
37
- jobsLength() {
38
- return this._messages.size;
39
- }
40
-
41
- /**
42
- * @param operationName string
43
- * @param data any
44
- * @param transferable array
45
- * @param onEvent function
46
- * @returns {Promise}
47
- */
48
- exec(operationName, data = null, transferable = [], onEvent) {
49
- return new Promise((res, rej) => {
50
- const messageId = this._messageId++;
51
- this._messages.set(messageId, [res, rej, onEvent]);
52
- this._worker.postMessage([messageId, data, operationName], transferable || []);
53
- });
54
- }
55
-
56
- /**
57
- *
58
- * @param data any
59
- * @param transferable array
60
- * @param onEvent function
61
- * @returns {Promise}
62
- */
63
- postMessage(data = null, transferable = [], onEvent) {
64
- return new Promise((res, rej) => {
65
- const messageId = this._messageId++;
66
- this._messages.set(messageId, [res, rej, onEvent]);
67
- this._worker.postMessage([messageId, data], transferable || []);
68
- });
69
- }
70
-
71
- emit(eventName, ...args) {
72
- this._worker.postMessage({eventName, args});
73
- }
74
-
75
- _onMessage(e) {
76
- //if we got usual event, just emit it locally
77
- if(!Array.isArray(e.data) && e.data.eventName) {
78
- return super.emit(e.data.eventName, ...e.data.args);
79
- }
80
-
81
- const [type, ...args] = e.data;
82
-
83
- if(type === MESSAGE_EVENT)
84
- this._onEvent(...args);
85
- else if(type === MESSAGE_RESULT)
86
- this._onResult(...args);
87
- else
88
- throw new Error(`Wrong message type '${type}'`);
89
- }
90
-
91
- _onResult(messageId, success, payload) {
92
- const [res, rej] = this._messages.get(messageId);
93
- this._messages.delete(messageId);
94
-
95
- return success === RESULT_SUCCESS ? res(payload) : rej(payload);
96
- }
97
-
98
- _onEvent(messageId, eventName, data) {
99
- const [,,onEvent] = this._messages.get(messageId);
100
-
101
- if(onEvent) {
102
- onEvent(eventName, data);
103
- }
104
- }
105
-
106
- }
107
-
108
- var src = Worker;
109
-
110
- export { src as s };