@kitware/vtk.js 19.2.13 → 19.3.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 (717) hide show
  1. package/Common/Core/Base64.js +1 -1
  2. package/Common/Core/CellArray.js +2 -3
  3. package/Common/Core/ClassHierarchy.js +1 -1
  4. package/Common/Core/DataArray/Constants.js +1 -2
  5. package/Common/Core/DataArray.js +3 -4
  6. package/Common/Core/Endian.js +1 -2
  7. package/Common/Core/ImageHelper.js +1 -1
  8. package/Common/Core/LookupTable.js +1 -2
  9. package/Common/Core/MatrixBuilder.js +1 -1
  10. package/Common/Core/Points.js +1 -2
  11. package/Common/Core/PriorityQueue.js +1 -2
  12. package/Common/Core/ProgressHandler.js +1 -2
  13. package/Common/Core/ScalarsToColors/Constants.js +1 -2
  14. package/Common/Core/ScalarsToColors.js +2 -3
  15. package/Common/Core/StringArray.js +1 -2
  16. package/Common/Core/URLExtract.js +1 -1
  17. package/Common/Core/VariantArray.js +1 -2
  18. package/Common/Core.js +1 -1
  19. package/Common/DataModel/BoundingBox.js +2 -3
  20. package/Common/DataModel/Box.js +2 -3
  21. package/Common/DataModel/CardinalSpline1D.js +1 -2
  22. package/Common/DataModel/Cell.js +1 -2
  23. package/Common/DataModel/CellLinks.js +26 -27
  24. package/Common/DataModel/CellTypes/Constants.js +1 -2
  25. package/Common/DataModel/CellTypes.js +2 -3
  26. package/Common/DataModel/Cone.js +1 -2
  27. package/Common/DataModel/Cylinder.js +2 -3
  28. package/Common/DataModel/DataSet/Constants.js +1 -2
  29. package/Common/DataModel/DataSet.js +2 -3
  30. package/Common/DataModel/DataSetAttributes/Constants.js +1 -2
  31. package/Common/DataModel/DataSetAttributes/FieldData.js +1 -2
  32. package/Common/DataModel/DataSetAttributes.js +2 -3
  33. package/Common/DataModel/ITKHelper.js +1 -1
  34. package/Common/DataModel/ImageData.js +1 -2
  35. package/Common/DataModel/ImplicitBoolean/Constants.js +1 -2
  36. package/Common/DataModel/ImplicitBoolean.js +2 -3
  37. package/Common/DataModel/KochanekSpline1D.js +1 -2
  38. package/Common/DataModel/Line/Constants.js +1 -2
  39. package/Common/DataModel/Line.js +2 -3
  40. package/Common/DataModel/Molecule.js +1 -2
  41. package/Common/DataModel/PiecewiseFunction.js +1 -2
  42. package/Common/DataModel/Plane.js +2 -3
  43. package/Common/DataModel/PointSet.js +1 -2
  44. package/Common/DataModel/PolyData/Constants.js +1 -2
  45. package/Common/DataModel/PolyData.js +1 -2
  46. package/Common/DataModel/Polygon.js +1 -2
  47. package/Common/DataModel/SelectionNode/Constants.js +1 -2
  48. package/Common/DataModel/SelectionNode.js +2 -3
  49. package/Common/DataModel/Sphere.js +2 -3
  50. package/Common/DataModel/Spline1D.js +1 -2
  51. package/Common/DataModel/Spline3D/Constants.js +1 -2
  52. package/Common/DataModel/Spline3D.js +1 -2
  53. package/Common/DataModel/StructuredData/Constants.js +1 -2
  54. package/Common/DataModel/StructuredData.js +2 -3
  55. package/Common/DataModel/Triangle.js +2 -3
  56. package/Common/DataModel.js +1 -1
  57. package/Common/System/MobileVR/headsets.js +1 -1
  58. package/Common/System/MobileVR.js +1 -1
  59. package/Common/System/TimerLog.js +1 -2
  60. package/Common/System.js +1 -1
  61. package/Common/Transform/LandmarkTransform/Constants.js +1 -2
  62. package/Common/Transform/LandmarkTransform.js +2 -3
  63. package/Common/Transform.js +1 -1
  64. package/Common/index.js +1 -1
  65. package/Filters/Core/Cutter.js +3 -4
  66. package/Filters/Core.js +1 -1
  67. package/Filters/Cornerstone/ImageDataToCornerstoneImage.js +1 -2
  68. package/Filters/Cornerstone.js +1 -1
  69. package/Filters/General/AppendPolyData.js +1 -2
  70. package/Filters/General/Calculator.js +2 -3
  71. package/Filters/General/ClosedPolyLineToSurfaceFilter.js +1 -2
  72. package/Filters/General/ImageCropFilter.js +1 -2
  73. package/Filters/General/ImageMarchingCubes/caseTable.js +1 -1
  74. package/Filters/General/ImageMarchingCubes.js +1 -2
  75. package/Filters/General/ImageMarchingSquares/caseTable.js +1 -1
  76. package/Filters/General/ImageMarchingSquares.js +1 -2
  77. package/Filters/General/ImageOutlineFilter.js +1 -2
  78. package/Filters/General/ImageSliceFilter.js +1 -2
  79. package/Filters/General/ImageStreamline.js +1 -2
  80. package/Filters/General/LineFilter.js +1 -2
  81. package/Filters/General/MoleculeToRepresentation.js +1 -2
  82. package/Filters/General/OutlineFilter.js +1 -2
  83. package/Filters/General/PaintFilter/PaintFilter.worker.js +3 -3
  84. package/Filters/General/PaintFilter.js +3 -4
  85. package/Filters/General/ScalarToRGBA.js +1 -2
  86. package/Filters/General/TriangleFilter.js +1 -2
  87. package/Filters/General/TubeFilter/Constants.js +1 -2
  88. package/Filters/General/TubeFilter.js +1 -2
  89. package/Filters/General/WarpScalar.js +1 -2
  90. package/Filters/General/WindowedSincPolyDataFilter.js +43 -44
  91. package/Filters/General.js +1 -1
  92. package/Filters/Sources/Arrow2DSource/Constants.js +1 -2
  93. package/Filters/Sources/Arrow2DSource.js +2 -3
  94. package/Filters/Sources/ArrowSource.js +1 -2
  95. package/Filters/Sources/CircleSource.js +2 -3
  96. package/Filters/Sources/ConcentricCylinderSource.js +1 -2
  97. package/Filters/Sources/ConeSource.js +1 -2
  98. package/Filters/Sources/CubeSource.js +1 -2
  99. package/Filters/Sources/Cursor3D.js +12 -13
  100. package/Filters/Sources/CylinderSource.js +1 -2
  101. package/Filters/Sources/ImageGridSource.js +1 -2
  102. package/Filters/Sources/LineSource.js +1 -2
  103. package/Filters/Sources/PlaneSource.js +1 -2
  104. package/Filters/Sources/PointSource.js +1 -2
  105. package/Filters/Sources/RTAnalyticSource.js +1 -2
  106. package/Filters/Sources/SLICSource.js +1 -2
  107. package/Filters/Sources/SphereSource.js +1 -2
  108. package/Filters/Sources/ViewFinderSource.js +1 -2
  109. package/Filters/Sources.js +1 -1
  110. package/Filters/Texture/TextureMapToPlane.js +1 -2
  111. package/Filters/Texture/TextureMapToSphere.js +1 -2
  112. package/Filters/Texture.js +1 -1
  113. package/Filters/index.js +1 -1
  114. package/IO/Core/BinaryHelper.js +1 -1
  115. package/IO/Core/DataAccessHelper/HtmlDataAccessHelper.js +1 -1
  116. package/IO/Core/DataAccessHelper/HttpDataAccessHelper.js +1 -1
  117. package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.js +3 -3
  118. package/IO/Core/DataAccessHelper/LiteHttpDataAccessHelper.js +1 -1
  119. package/IO/Core/DataAccessHelper.js +1 -2
  120. package/IO/Core/HttpDataSetReader.js +1 -2
  121. package/IO/Core/HttpDataSetSeriesReader.js +1 -2
  122. package/IO/Core/HttpSceneLoader.js +2 -3
  123. package/IO/Core/ImageStream/DefaultProtocol.js +1 -1
  124. package/IO/Core/ImageStream/ViewStream.js +1 -2
  125. package/IO/Core/ImageStream.js +1 -2
  126. package/IO/Core/ResourceLoader.js +1 -2
  127. package/IO/Core/Serializer/ArraySerializer.js +1 -2
  128. package/IO/Core/Serializer/FieldDataSerializer.js +1 -1
  129. package/IO/Core/Serializer/ImageDataSerializer.js +1 -1
  130. package/IO/Core/Serializer/PolyDataSerializer.js +1 -1
  131. package/IO/Core/Serializer.js +1 -1
  132. package/IO/Core/WSLinkClient.js +1 -2
  133. package/IO/Core/ZipMultiDataSetReader.js +3 -4
  134. package/IO/Core/ZipMultiDataSetWriter.js +3 -4
  135. package/IO/Core.js +1 -1
  136. package/IO/Geometry/DracoReader.js +1 -2
  137. package/IO/Geometry/PLYReader.js +1 -2
  138. package/IO/Geometry/STLReader.js +1 -2
  139. package/IO/Geometry/STLWriter/Constants.js +1 -2
  140. package/IO/Geometry/STLWriter.js +2 -3
  141. package/IO/Geometry.js +1 -1
  142. package/IO/Legacy/LegacyAsciiParser.js +1 -1
  143. package/IO/Legacy/PolyDataReader.js +1 -2
  144. package/IO/Legacy.js +1 -1
  145. package/IO/Misc/ElevationReader.js +1 -2
  146. package/IO/Misc/HttpDataSetLODsLoader.js +1 -2
  147. package/IO/Misc/ITKImageReader.js +1 -2
  148. package/IO/Misc/ITKPolyDataReader.js +1 -2
  149. package/IO/Misc/JSONNucleoReader.js +1 -2
  150. package/IO/Misc/JSONReader.js +1 -2
  151. package/IO/Misc/MTLReader.js +2 -3
  152. package/IO/Misc/OBJReader.js +1 -2
  153. package/IO/Misc/PDBReader.js +1 -2
  154. package/IO/Misc/SkyboxReader.js +3 -4
  155. package/IO/Misc.js +1 -1
  156. package/IO/XML/XMLImageDataReader.js +1 -2
  157. package/IO/XML/XMLImageDataWriter.js +2 -3
  158. package/IO/XML/XMLPolyDataReader.js +1 -2
  159. package/IO/XML/XMLPolyDataWriter.js +2 -3
  160. package/IO/XML/XMLReader.js +1 -2
  161. package/IO/XML/XMLWriter/Constants.js +1 -2
  162. package/IO/XML/XMLWriter.js +4 -4
  163. package/IO/XML.js +1 -1
  164. package/IO/index.js +1 -1
  165. package/Imaging/Core/AbstractImageInterpolator/Constants.js +1 -2
  166. package/Imaging/Core/AbstractImageInterpolator/InterpolationInfo.js +2 -3
  167. package/Imaging/Core/AbstractImageInterpolator.js +2 -3
  168. package/Imaging/Core/ImageInterpolator.js +2 -3
  169. package/Imaging/Core/ImagePointDataIterator.js +1 -2
  170. package/Imaging/Core/ImageReslice/Constants.js +1 -2
  171. package/Imaging/Core/ImageReslice.js +2 -3
  172. package/Imaging/Core.js +1 -1
  173. package/Imaging/Hybrid/SampleFunction.js +2 -3
  174. package/Imaging/Hybrid.js +1 -1
  175. package/Imaging/index.js +1 -1
  176. package/Interaction/Animations/TimeStepBasedAnimationHandler.js +2 -3
  177. package/Interaction/Manipulators/CompositeCameraManipulator.js +1 -2
  178. package/Interaction/Manipulators/CompositeGestureManipulator.js +1 -2
  179. package/Interaction/Manipulators/CompositeKeyboardManipulator.js +1 -2
  180. package/Interaction/Manipulators/CompositeMouseManipulator.js +1 -2
  181. package/Interaction/Manipulators/CompositeVRManipulator.js +1 -2
  182. package/Interaction/Manipulators/GestureCameraManipulator.js +1 -2
  183. package/Interaction/Manipulators/KeyboardCameraManipulator.js +1 -2
  184. package/Interaction/Manipulators/MouseBoxSelectorManipulator.js +3 -4
  185. package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +1 -2
  186. package/Interaction/Manipulators/MouseCameraSliceManipulator.js +1 -2
  187. package/Interaction/Manipulators/MouseCameraTrackballFirstPersonManipulator.js +1 -2
  188. package/Interaction/Manipulators/MouseCameraTrackballMultiRotateManipulator.js +1 -2
  189. package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.js +1 -2
  190. package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +1 -2
  191. package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +1 -2
  192. package/Interaction/Manipulators/MouseCameraTrackballZoomManipulator.js +1 -2
  193. package/Interaction/Manipulators/MouseCameraTrackballZoomToMouseManipulator.js +1 -2
  194. package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -2
  195. package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -2
  196. package/Interaction/Manipulators/MouseRangeManipulator.js +1 -2
  197. package/Interaction/Manipulators/VRButtonPanManipulator.js +1 -2
  198. package/Interaction/Manipulators.js +1 -1
  199. package/Interaction/Misc/DeviceOrientationToCamera.js +1 -1
  200. package/Interaction/Misc.js +1 -1
  201. package/Interaction/Style/InteractorStyleImage.js +1 -2
  202. package/Interaction/Style/InteractorStyleMPRSlice.js +1 -2
  203. package/Interaction/Style/InteractorStyleManipulator/Presets.js +1 -1
  204. package/Interaction/Style/InteractorStyleManipulator.js +2 -3
  205. package/Interaction/Style/InteractorStyleRemoteMouse.js +2 -3
  206. package/Interaction/Style/InteractorStyleTrackballCamera.js +1 -2
  207. package/Interaction/Style/InteractorStyleUnicam.js +1 -2
  208. package/Interaction/Style.js +1 -1
  209. package/Interaction/UI/CornerAnnotation.js +1 -2
  210. package/Interaction/UI/FPSMonitor.js +2 -3
  211. package/Interaction/UI/Icons.js +1 -1
  212. package/Interaction/UI/Slider/Constants.js +1 -2
  213. package/Interaction/UI/Slider.js +2 -3
  214. package/Interaction/UI/VolumeController.js +1 -2
  215. package/Interaction/UI.js +1 -1
  216. package/Interaction/Widgets/AbstractWidget.js +2 -3
  217. package/Interaction/Widgets/DistanceRepresentation.js +2 -3
  218. package/Interaction/Widgets/DistanceWidget.js +2 -3
  219. package/Interaction/Widgets/HandleRepresentation/Constants.js +1 -2
  220. package/Interaction/Widgets/HandleRepresentation.js +2 -3
  221. package/Interaction/Widgets/HandleWidget/Constants.js +1 -2
  222. package/Interaction/Widgets/HandleWidget.js +2 -3
  223. package/Interaction/Widgets/ImageCroppingRegionsRepresentation.js +1 -2
  224. package/Interaction/Widgets/ImageCroppingRegionsWidget/Constants.js +1 -1
  225. package/Interaction/Widgets/ImageCroppingRegionsWidget.js +2 -3
  226. package/Interaction/Widgets/LabelRepresentation/Constants.js +1 -2
  227. package/Interaction/Widgets/LabelRepresentation.js +3 -4
  228. package/Interaction/Widgets/LabelWidget.js +2 -3
  229. package/Interaction/Widgets/LineRepresentation/Constants.js +1 -2
  230. package/Interaction/Widgets/LineRepresentation.js +2 -3
  231. package/Interaction/Widgets/LineWidget/Constants.js +1 -2
  232. package/Interaction/Widgets/LineWidget.js +2 -3
  233. package/Interaction/Widgets/OrientationMarkerWidget/Constants.js +1 -1
  234. package/Interaction/Widgets/OrientationMarkerWidget.js +2 -3
  235. package/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +3 -3
  236. package/Interaction/Widgets/PiecewiseGaussianWidget.js +15 -16
  237. package/Interaction/Widgets/PointPlacer.js +1 -2
  238. package/Interaction/Widgets/ResliceCursor/ResliceCursor/Constants.js +1 -2
  239. package/Interaction/Widgets/ResliceCursor/ResliceCursor.js +2 -3
  240. package/Interaction/Widgets/ResliceCursor/ResliceCursorActor/Constants.js +1 -2
  241. package/Interaction/Widgets/ResliceCursor/ResliceCursorActor.js +2 -3
  242. package/Interaction/Widgets/ResliceCursor/ResliceCursorLineRepresentation.js +1 -2
  243. package/Interaction/Widgets/ResliceCursor/ResliceCursorPolyDataAlgorithm.js +2 -3
  244. package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation.js +1 -2
  245. package/Interaction/Widgets/ResliceCursor/ResliceCursorWidget/Constants.js +1 -2
  246. package/Interaction/Widgets/ResliceCursor/ResliceCursorWidget.js +2 -3
  247. package/Interaction/Widgets/SphereHandleRepresentation.js +2 -3
  248. package/Interaction/Widgets/WidgetRepresentation.js +1 -2
  249. package/Interaction/Widgets.js +1 -1
  250. package/Interaction/index.js +1 -1
  251. package/Proxy/Animation/AbstractAnimationProxy.js +1 -2
  252. package/Proxy/Animation/AnimationProxyManager.js +1 -2
  253. package/Proxy/Animation/TimeStepBasedAnimationHandlerProxy.js +1 -2
  254. package/Proxy/Core/AbstractRepresentationProxy.js +1 -1
  255. package/Proxy/Core/LookupTableProxy/Constants.js +1 -1
  256. package/Proxy/Core/LookupTableProxy.js +1 -2
  257. package/Proxy/Core/PiecewiseFunctionProxy/Constants.js +1 -1
  258. package/Proxy/Core/PiecewiseFunctionProxy.js +2 -3
  259. package/Proxy/Core/ProxyManager/core.js +2 -2
  260. package/Proxy/Core/ProxyManager/properties.js +2 -2
  261. package/Proxy/Core/ProxyManager/state.js +2 -2
  262. package/Proxy/Core/ProxyManager/view.js +1 -1
  263. package/Proxy/Core/ProxyManager.js +1 -2
  264. package/Proxy/Core/SourceProxy.js +1 -2
  265. package/Proxy/Core/View2DProxy.js +1 -2
  266. package/Proxy/Core/ViewProxy.js +4 -4
  267. package/Proxy/Core.js +1 -1
  268. package/Proxy/Representations/GeometryRepresentationProxy.js +1 -2
  269. package/Proxy/Representations/GlyphRepresentationProxy.js +1 -2
  270. package/Proxy/Representations/MoleculeRepresentationProxy.js +1 -2
  271. package/Proxy/Representations/SkyboxRepresentationProxy.js +1 -2
  272. package/Proxy/Representations/SliceRepresentationProxy.js +2 -3
  273. package/Proxy/Representations/SlicedGeometryRepresentationProxy.js +1 -2
  274. package/Proxy/Representations/VolumeRepresentationProxy.js +1 -2
  275. package/Proxy/Representations.js +1 -1
  276. package/Proxy/index.js +1 -1
  277. package/Rendering/Core/AbstractMapper.js +1 -2
  278. package/Rendering/Core/AbstractMapper3D.js +1 -2
  279. package/Rendering/Core/AbstractPicker.js +1 -2
  280. package/Rendering/Core/Actor.js +2 -3
  281. package/Rendering/Core/Actor2D.js +1 -2
  282. package/Rendering/Core/AnnotatedCubeActor/Presets.js +1 -1
  283. package/Rendering/Core/AnnotatedCubeActor.js +2 -3
  284. package/Rendering/Core/AxesActor.js +2 -3
  285. package/Rendering/Core/Camera.js +1 -2
  286. package/Rendering/Core/CellPicker.js +2 -3
  287. package/Rendering/Core/ColorTransferFunction/ColorMaps.js +1 -1
  288. package/Rendering/Core/ColorTransferFunction/ColorMapsLite.js +1 -1
  289. package/Rendering/Core/ColorTransferFunction/Constants.js +1 -2
  290. package/Rendering/Core/ColorTransferFunction.js +2 -3
  291. package/Rendering/Core/Coordinate/Constants.js +1 -2
  292. package/Rendering/Core/Coordinate.js +2 -3
  293. package/Rendering/Core/CubeAxesActor.js +2 -3
  294. package/Rendering/Core/Follower.js +2 -3
  295. package/Rendering/Core/Glyph3DMapper/Constants.js +1 -2
  296. package/Rendering/Core/Glyph3DMapper.js +2 -3
  297. package/Rendering/Core/HardwareSelector.js +1 -2
  298. package/Rendering/Core/ImageMapper/Constants.js +1 -2
  299. package/Rendering/Core/ImageMapper.js +2 -3
  300. package/Rendering/Core/ImageProperty/Constants.js +1 -2
  301. package/Rendering/Core/ImageProperty.js +1 -2
  302. package/Rendering/Core/ImageSlice.js +1 -2
  303. package/Rendering/Core/InteractorObserver.js +2 -3
  304. package/Rendering/Core/InteractorStyle/Constants.js +1 -2
  305. package/Rendering/Core/InteractorStyle.js +2 -3
  306. package/Rendering/Core/Light.js +1 -2
  307. package/Rendering/Core/Mapper/CoincidentTopologyHelper.js +1 -2
  308. package/Rendering/Core/Mapper/Constants.js +1 -2
  309. package/Rendering/Core/Mapper/Static.js +1 -2
  310. package/Rendering/Core/Mapper.js +2 -3
  311. package/Rendering/Core/Picker.js +2 -3
  312. package/Rendering/Core/PixelSpaceCallbackMapper.js +1 -2
  313. package/Rendering/Core/PointPicker.js +1 -9
  314. package/Rendering/Core/Prop.js +1 -2
  315. package/Rendering/Core/Prop3D.js +1 -2
  316. package/Rendering/Core/Property/Constants.js +1 -2
  317. package/Rendering/Core/Property.js +2 -3
  318. package/Rendering/Core/Property2D.js +1 -2
  319. package/Rendering/Core/RenderWindow.js +1 -2
  320. package/Rendering/Core/RenderWindowInteractor/Constants.js +1 -2
  321. package/Rendering/Core/RenderWindowInteractor.js +2 -3
  322. package/Rendering/Core/Renderer.js +2 -3
  323. package/Rendering/Core/ScalarBarActor.js +2 -3
  324. package/Rendering/Core/Skybox.js +1 -2
  325. package/Rendering/Core/SphereMapper.js +1 -2
  326. package/Rendering/Core/StickMapper.js +1 -2
  327. package/Rendering/Core/SurfaceLICInterface/Constants.js +1 -2
  328. package/Rendering/Core/SurfaceLICInterface.js +1 -2
  329. package/Rendering/Core/SurfaceLICMapper.js +1 -2
  330. package/Rendering/Core/Texture.js +1 -2
  331. package/Rendering/Core/Viewport.js +1 -2
  332. package/Rendering/Core/Volume.js +1 -2
  333. package/Rendering/Core/VolumeMapper/Constants.js +1 -2
  334. package/Rendering/Core/VolumeMapper.js +1 -2
  335. package/Rendering/Core/VolumeProperty/Constants.js +1 -2
  336. package/Rendering/Core/VolumeProperty.js +2 -3
  337. package/Rendering/Core.js +2 -2
  338. package/Rendering/Misc/CanvasView.js +1 -2
  339. package/Rendering/Misc/FullScreenRenderWindow.js +1 -2
  340. package/Rendering/Misc/GenericRenderWindow.js +1 -2
  341. package/Rendering/Misc/RemoteView.js +1 -2
  342. package/Rendering/Misc/RenderWindowWithControlBar.js +2 -3
  343. package/Rendering/Misc/SynchronizableRenderWindow/vtkObjectManager.js +2 -2
  344. package/Rendering/Misc/SynchronizableRenderWindow.js +3 -4
  345. package/Rendering/Misc/TextureLODsDownloader.js +1 -2
  346. package/Rendering/Misc.js +1 -1
  347. package/Rendering/OpenGL/Actor.js +2 -3
  348. package/Rendering/OpenGL/Actor2D.js +2 -3
  349. package/Rendering/OpenGL/BufferObject/Constants.js +1 -2
  350. package/Rendering/OpenGL/BufferObject.js +2 -3
  351. package/Rendering/OpenGL/Camera.js +2 -3
  352. package/Rendering/OpenGL/CellArrayBufferObject.js +2 -4
  353. package/Rendering/OpenGL/Convolution2DPass.js +1 -2
  354. package/Rendering/OpenGL/ForwardPass.js +1 -2
  355. package/Rendering/OpenGL/Framebuffer.js +2 -3
  356. package/Rendering/OpenGL/Glyph3DMapper.js +3 -4
  357. package/Rendering/OpenGL/HardwareSelector/Constants.js +1 -2
  358. package/Rendering/OpenGL/HardwareSelector.js +2 -3
  359. package/Rendering/OpenGL/Helper.js +1 -2
  360. package/Rendering/OpenGL/ImageMapper.js +2 -3
  361. package/Rendering/OpenGL/ImageSlice.js +2 -3
  362. package/Rendering/OpenGL/PixelSpaceCallbackMapper.js +1 -2
  363. package/Rendering/OpenGL/PolyDataMapper.js +2 -3
  364. package/Rendering/OpenGL/RadialDistortionPass.js +1 -2
  365. package/Rendering/OpenGL/RenderWindow.js +1 -2
  366. package/Rendering/OpenGL/Renderer.js +2 -3
  367. package/Rendering/OpenGL/ReplacementShaderMapper.js +1 -1
  368. package/Rendering/OpenGL/Shader.js +1 -2
  369. package/Rendering/OpenGL/ShaderCache.js +1 -2
  370. package/Rendering/OpenGL/ShaderProgram.js +1 -1
  371. package/Rendering/OpenGL/Skybox.js +2 -3
  372. package/Rendering/OpenGL/SphereMapper.js +2 -3
  373. package/Rendering/OpenGL/StickMapper.js +2 -3
  374. package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D/pingpong.js +1 -2
  375. package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D.js +1 -2
  376. package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +1 -2
  377. package/Rendering/OpenGL/SurfaceLIC/SurfaceLICMapper.js +3 -4
  378. package/Rendering/OpenGL/SurfaceLIC.js +1 -1
  379. package/Rendering/OpenGL/Texture/Constants.js +1 -2
  380. package/Rendering/OpenGL/Texture.js +3 -4
  381. package/Rendering/OpenGL/TextureUnitManager.js +1 -2
  382. package/Rendering/OpenGL/VertexArrayObject.js +1 -2
  383. package/Rendering/OpenGL/ViewNodeFactory.js +1 -2
  384. package/Rendering/OpenGL/Volume.js +2 -3
  385. package/Rendering/OpenGL/VolumeMapper.js +3 -4
  386. package/Rendering/OpenGL.js +1 -1
  387. package/Rendering/SceneGraph/RenderPass.js +1 -2
  388. package/Rendering/SceneGraph/RenderWindowViewNode.js +1 -2
  389. package/Rendering/SceneGraph/ViewNode.js +1 -1
  390. package/Rendering/SceneGraph/ViewNodeFactory.js +1 -2
  391. package/Rendering/SceneGraph.js +1 -1
  392. package/Rendering/WebGPU/Actor.js +1 -2
  393. package/Rendering/WebGPU/BindGroup.js +1 -2
  394. package/Rendering/WebGPU/Buffer.js +2 -3
  395. package/Rendering/WebGPU/BufferManager/Constants.js +1 -2
  396. package/Rendering/WebGPU/BufferManager.js +3 -4
  397. package/Rendering/WebGPU/Camera.js +1 -2
  398. package/Rendering/WebGPU/Device.js +2 -3
  399. package/Rendering/WebGPU/ForwardPass.js +1 -2
  400. package/Rendering/WebGPU/FullScreenQuad.js +1 -2
  401. package/Rendering/WebGPU/Glyph3DMapper.js +3 -4
  402. package/Rendering/WebGPU/HardwareSelectionPass.js +1 -2
  403. package/Rendering/WebGPU/HardwareSelector.js +1 -2
  404. package/Rendering/WebGPU/MapperHelper.js +1 -2
  405. package/Rendering/WebGPU/OpaquePass.js +2 -4
  406. package/Rendering/WebGPU/OrderIndependentTranslucentPass.js +1 -2
  407. package/Rendering/WebGPU/Pipeline.js +2 -3
  408. package/Rendering/WebGPU/PixelSpaceCallbackMapper.js +1 -2
  409. package/Rendering/WebGPU/PolyDataMapper.js +3 -4
  410. package/Rendering/WebGPU/RenderEncoder.js +2 -3
  411. package/Rendering/WebGPU/RenderWindow.js +11 -3
  412. package/Rendering/WebGPU/Renderer.js +2 -3
  413. package/Rendering/WebGPU/Sampler.js +1 -2
  414. package/Rendering/WebGPU/ShaderCache.js +1 -2
  415. package/Rendering/WebGPU/ShaderDescription.js +1 -2
  416. package/Rendering/WebGPU/ShaderModule.js +1 -1
  417. package/Rendering/WebGPU/SphereMapper.js +1 -2
  418. package/Rendering/WebGPU/StickMapper.js +1 -2
  419. package/Rendering/WebGPU/StorageBuffer.js +1 -2
  420. package/Rendering/WebGPU/Texture.js +2 -3
  421. package/Rendering/WebGPU/TextureManager.js +24 -7
  422. package/Rendering/WebGPU/TextureView.js +19 -4
  423. package/Rendering/WebGPU/Types.js +83 -42
  424. package/Rendering/WebGPU/UniformBuffer.js +1 -2
  425. package/Rendering/WebGPU/VertexInput.js +2 -3
  426. package/Rendering/WebGPU/ViewNodeFactory.js +1 -2
  427. package/Rendering/WebGPU/Volume.js +1 -2
  428. package/Rendering/WebGPU/VolumePass.js +2 -3
  429. package/Rendering/WebGPU/VolumePassFSQ.js +4 -4
  430. package/Rendering/WebGPU.js +1 -1
  431. package/Rendering/index.js +1 -1
  432. package/ThirdParty/index.js +2 -2
  433. package/Utilities/DataGenerator/convert-cli.js +10 -8
  434. package/Utilities/ExampleRunner/example-runner-cli.js +2 -1
  435. package/Utilities/ExampleRunner/template-config.js +8 -6
  436. package/Utilities/TestResults/TESTS-Chrome_Headless_93.0.4577.63_(Linux_x86_64).xml +1058 -1058
  437. package/Utilities/XMLConverter/xml2json-cli.js +5 -4
  438. package/Widgets/Core/AbstractWidget/Constants.js +1 -2
  439. package/Widgets/Core/AbstractWidget.js +1 -2
  440. package/Widgets/Core/AbstractWidgetFactory.js +2 -3
  441. package/Widgets/Core/StateBuilder/boundsMixin.js +1 -2
  442. package/Widgets/Core/StateBuilder/colorMixin.js +1 -2
  443. package/Widgets/Core/StateBuilder/cornerMixin.js +1 -2
  444. package/Widgets/Core/StateBuilder/directionMixin.js +1 -2
  445. package/Widgets/Core/StateBuilder/manipulatorMixin.js +1 -2
  446. package/Widgets/Core/StateBuilder/nameMixin.js +1 -2
  447. package/Widgets/Core/StateBuilder/orientationMixin.js +1 -2
  448. package/Widgets/Core/StateBuilder/originMixin.js +1 -2
  449. package/Widgets/Core/StateBuilder/scale1Mixin.js +1 -2
  450. package/Widgets/Core/StateBuilder/scale3Mixin.js +1 -2
  451. package/Widgets/Core/StateBuilder/shapeMixin.js +1 -2
  452. package/Widgets/Core/StateBuilder/textMixin.js +1 -2
  453. package/Widgets/Core/StateBuilder/visibleMixin.js +1 -2
  454. package/Widgets/Core/StateBuilder.js +1 -2
  455. package/Widgets/Core/WidgetManager/Constants.js +1 -2
  456. package/Widgets/Core/WidgetManager.js +1 -2
  457. package/Widgets/Core/WidgetState.js +1 -2
  458. package/Widgets/Core.js +1 -1
  459. package/Widgets/Manipulators/LineManipulator.js +1 -2
  460. package/Widgets/Manipulators/PlaneManipulator.js +1 -2
  461. package/Widgets/Manipulators/TrackballManipulator.js +1 -2
  462. package/Widgets/Manipulators.js +1 -1
  463. package/Widgets/Representations/ArrowHandleRepresentation.js +2 -3
  464. package/Widgets/Representations/CircleContextRepresentation.js +1 -2
  465. package/Widgets/Representations/ContextRepresentation.js +2 -3
  466. package/Widgets/Representations/ConvexFaceContextRepresentation.js +1 -2
  467. package/Widgets/Representations/CroppingOutlineRepresentation.js +1 -2
  468. package/Widgets/Representations/CubeHandleRepresentation.js +1 -2
  469. package/Widgets/Representations/HandleRepresentation.js +2 -3
  470. package/Widgets/Representations/ImplicitPlaneRepresentation.js +1 -2
  471. package/Widgets/Representations/OutlineContextRepresentation.js +1 -2
  472. package/Widgets/Representations/PolyLineRepresentation.js +2 -3
  473. package/Widgets/Representations/RectangleContextRepresentation.js +1 -2
  474. package/Widgets/Representations/ResliceCursorContextRepresentation.js +2 -3
  475. package/Widgets/Representations/SphereHandleRepresentation.js +1 -2
  476. package/Widgets/Representations/SplineContextRepresentation.js +1 -2
  477. package/Widgets/Representations/WidgetRepresentation/Constants.js +1 -2
  478. package/Widgets/Representations/WidgetRepresentation.js +1 -2
  479. package/Widgets/Representations.js +1 -1
  480. package/Widgets/SVG/SVGLandmarkRepresentation.js +2 -3
  481. package/Widgets/SVG/SVGRepresentation.js +3 -2
  482. package/Widgets/Widgets3D/AngleWidget/behavior.js +1 -1
  483. package/Widgets/Widgets3D/AngleWidget/state.js +1 -1
  484. package/Widgets/Widgets3D/AngleWidget.js +1 -2
  485. package/Widgets/Widgets3D/DistanceWidget/behavior.js +1 -1
  486. package/Widgets/Widgets3D/DistanceWidget/state.js +1 -1
  487. package/Widgets/Widgets3D/DistanceWidget.js +1 -2
  488. package/Widgets/Widgets3D/EllipseWidget/behavior.js +2 -2
  489. package/Widgets/Widgets3D/EllipseWidget/state.js +1 -1
  490. package/Widgets/Widgets3D/EllipseWidget.js +2 -3
  491. package/Widgets/Widgets3D/ImageCroppingWidget/behavior.js +1 -1
  492. package/Widgets/Widgets3D/ImageCroppingWidget/state.js +1 -1
  493. package/Widgets/Widgets3D/ImageCroppingWidget.js +1 -2
  494. package/Widgets/Widgets3D/ImplicitPlaneWidget.js +1 -2
  495. package/Widgets/Widgets3D/InteractiveOrientationWidget/behavior.js +2 -2
  496. package/Widgets/Widgets3D/InteractiveOrientationWidget/state.js +1 -2
  497. package/Widgets/Widgets3D/InteractiveOrientationWidget.js +1 -2
  498. package/Widgets/Widgets3D/LineWidget/Constants.js +1 -2
  499. package/Widgets/Widgets3D/LineWidget/behavior.js +2 -2
  500. package/Widgets/Widgets3D/LineWidget/state.js +1 -1
  501. package/Widgets/Widgets3D/LineWidget.js +1 -2
  502. package/Widgets/Widgets3D/PaintWidget.js +1 -2
  503. package/Widgets/Widgets3D/PolyLineWidget/behavior.js +1 -1
  504. package/Widgets/Widgets3D/PolyLineWidget/state.js +1 -1
  505. package/Widgets/Widgets3D/PolyLineWidget.js +1 -2
  506. package/Widgets/Widgets3D/RectangleWidget/behavior.js +2 -2
  507. package/Widgets/Widgets3D/RectangleWidget/state.js +1 -1
  508. package/Widgets/Widgets3D/RectangleWidget.js +2 -3
  509. package/Widgets/Widgets3D/ResliceCursorWidget/Constants.js +1 -2
  510. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
  511. package/Widgets/Widgets3D/ResliceCursorWidget/state.js +1 -1
  512. package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -2
  513. package/Widgets/Widgets3D/ShapeWidget/Constants.js +1 -2
  514. package/Widgets/Widgets3D/ShapeWidget/behavior.js +2 -2
  515. package/Widgets/Widgets3D/ShapeWidget.js +1 -2
  516. package/Widgets/Widgets3D/SplineWidget/behavior.js +1 -1
  517. package/Widgets/Widgets3D/SplineWidget/state.js +1 -1
  518. package/Widgets/Widgets3D/SplineWidget.js +1 -2
  519. package/Widgets/Widgets3D.js +1 -1
  520. package/Widgets/index.js +1 -1
  521. package/_vendor/base64-js/index.js_commonjs-exports +1 -0
  522. package/_vendor/blueimp-md5/js/md5.js_commonjs-module +3 -0
  523. package/_vendor/define-properties/index.js_commonjs-proxy +1 -1
  524. package/_vendor/globalthis/implementation.browser.js_commonjs-module +3 -0
  525. package/_vendor/globalthis/implementation.browser.js_commonjs-proxy +1 -1
  526. package/_vendor/globalthis/polyfill.js_commonjs-proxy +1 -1
  527. package/_vendor/globalthis/shim.js_commonjs-proxy +2 -1
  528. package/_vendor/jszip/dist/jszip.min.js_commonjs-module +3 -0
  529. package/_vendor/object-keys/implementation.js_commonjs-proxy +1 -1
  530. package/_vendor/object-keys/index.js_commonjs-proxy +1 -1
  531. package/_vendor/object-keys/isArguments.js_commonjs-proxy +1 -1
  532. package/_vendor/seedrandom/lib/alea.js_commonjs-module +3 -0
  533. package/_vendor/seedrandom/lib/alea.js_commonjs-proxy +1 -1
  534. package/_vendor/seedrandom/lib/tychei.js_commonjs-module +3 -0
  535. package/_vendor/seedrandom/lib/tychei.js_commonjs-proxy +1 -1
  536. package/_vendor/seedrandom/lib/xor128.js_commonjs-module +3 -0
  537. package/_vendor/seedrandom/lib/xor128.js_commonjs-proxy +1 -1
  538. package/_vendor/seedrandom/lib/xor4096.js_commonjs-module +3 -0
  539. package/_vendor/seedrandom/lib/xor4096.js_commonjs-proxy +1 -1
  540. package/_vendor/seedrandom/lib/xorshift7.js_commonjs-module +3 -0
  541. package/_vendor/seedrandom/lib/xorshift7.js_commonjs-proxy +1 -1
  542. package/_vendor/seedrandom/lib/xorwow.js_commonjs-module +3 -0
  543. package/_vendor/seedrandom/lib/xorwow.js_commonjs-proxy +1 -1
  544. package/_vendor/seedrandom/seedrandom.js_commonjs-module +3 -0
  545. package/_vendor/seedrandom/seedrandom.js_commonjs-proxy +1 -1
  546. package/_vendor/webworker-promise/lib/register.js_commonjs-module +3 -0
  547. package/_vendor/webworker-promise/lib/tiny-emitter.js_commonjs-proxy +1 -1
  548. package/_vendor/webworker-promise/src/tiny-emitter.js_commonjs-proxy +1 -0
  549. package/_vendor/xmlbuilder2/lib/xmlbuilder2.min.js_commonjs-module +3 -0
  550. package/_virtual/commonjsHelpers.js +3 -4
  551. package/_virtual/{polyfill-node_buffer.js → polyfill-node.buffer.js} +1 -1
  552. package/_virtual/{polyfill-node_global.js → polyfill-node.global.js} +0 -0
  553. package/_virtual/rollup-plugin-worker-loader__module_Sources/Filters/General/PaintFilter/PaintFilter.worker.js +1 -1
  554. package/_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js +1 -1
  555. package/macros.js +4 -5
  556. package/package.json +54 -55
  557. package/vendor/base64-js/index.js +1 -87
  558. package/vendor/blueimp-md5/js/md5.js +6 -3
  559. package/vendor/d3-array/src/ascending.js +1 -1
  560. package/vendor/d3-array/src/bisect.js +2 -1
  561. package/vendor/d3-array/src/bisector.js +21 -23
  562. package/vendor/d3-array/src/mode.js +1 -0
  563. package/vendor/d3-scale/src/continuous.js +2 -2
  564. package/vendor/d3-time/src/ticks.js +1 -0
  565. package/vendor/define-properties/index.js +2 -1
  566. package/vendor/globalthis/implementation.browser.js +4 -9
  567. package/vendor/globalthis/index.js +13 -6
  568. package/vendor/globalthis/polyfill.js +6 -3
  569. package/vendor/globalthis/shim.js +12 -9
  570. package/vendor/jszip/dist/jszip.min.js +11 -0
  571. package/vendor/object-keys/index.js +2 -2
  572. package/vendor/pako/dist/pako.esm.mjs +397 -388
  573. package/vendor/seedrandom/index.js +28 -21
  574. package/vendor/seedrandom/lib/alea.js +4 -5
  575. package/vendor/seedrandom/lib/tychei.js +4 -5
  576. package/vendor/seedrandom/lib/xor128.js +4 -5
  577. package/vendor/seedrandom/lib/xor4096.js +4 -5
  578. package/vendor/seedrandom/lib/xorshift7.js +4 -5
  579. package/vendor/seedrandom/lib/xorwow.js +4 -5
  580. package/vendor/seedrandom/seedrandom.js +4 -5
  581. package/vendor/webworker-promise/lib/register.js +14 -8
  582. package/vendor/webworker-promise/src/index.js +110 -0
  583. package/vendor/webworker-promise/src/tiny-emitter.js +51 -0
  584. package/vendor/xmlbuilder2/lib/xmlbuilder2.min.js +6 -7
  585. package/vtk.js +2 -3
  586. package/_vendor/base64-js/index.js_commonjs-proxy +0 -1
  587. package/_vendor/buffer/index.js_commonjs-proxy +0 -1
  588. package/_vendor/ieee754/index.js_commonjs-proxy +0 -1
  589. package/_vendor/immediate/lib/browser.js_commonjs-proxy +0 -1
  590. package/_vendor/inherits/inherits_browser.js_commonjs-proxy +0 -1
  591. package/_vendor/jszip/lib/base64.js_commonjs-proxy +0 -1
  592. package/_vendor/jszip/lib/compressedObject.js_commonjs-proxy +0 -1
  593. package/_vendor/jszip/lib/compressions.js_commonjs-proxy +0 -1
  594. package/_vendor/jszip/lib/crc32.js_commonjs-proxy +0 -1
  595. package/_vendor/jszip/lib/defaults.js_commonjs-proxy +0 -1
  596. package/_vendor/jszip/lib/external.js_commonjs-proxy +0 -1
  597. package/_vendor/jszip/lib/flate.js_commonjs-proxy +0 -1
  598. package/_vendor/jszip/lib/generate/ZipFileWorker.js_commonjs-proxy +0 -1
  599. package/_vendor/jszip/lib/generate/index.js_commonjs-proxy +0 -1
  600. package/_vendor/jszip/lib/load.js_commonjs-proxy +0 -1
  601. package/_vendor/jszip/lib/nodejs/NodejsStreamInputAdapter.js_commonjs-proxy +0 -1
  602. package/_vendor/jszip/lib/nodejs/NodejsStreamOutputAdapter.js_commonjs-proxy +0 -1
  603. package/_vendor/jszip/lib/nodejsUtils.js_commonjs-proxy +0 -1
  604. package/_vendor/jszip/lib/object.js_commonjs-proxy +0 -1
  605. package/_vendor/jszip/lib/readable-stream-browser.js_commonjs-proxy +0 -1
  606. package/_vendor/jszip/lib/reader/ArrayReader.js_commonjs-proxy +0 -1
  607. package/_vendor/jszip/lib/reader/DataReader.js_commonjs-proxy +0 -1
  608. package/_vendor/jszip/lib/reader/NodeBufferReader.js_commonjs-proxy +0 -1
  609. package/_vendor/jszip/lib/reader/StringReader.js_commonjs-proxy +0 -1
  610. package/_vendor/jszip/lib/reader/Uint8ArrayReader.js_commonjs-proxy +0 -1
  611. package/_vendor/jszip/lib/reader/readerFor.js_commonjs-proxy +0 -1
  612. package/_vendor/jszip/lib/signature.js_commonjs-proxy +0 -1
  613. package/_vendor/jszip/lib/stream/ConvertWorker.js_commonjs-proxy +0 -1
  614. package/_vendor/jszip/lib/stream/Crc32Probe.js_commonjs-proxy +0 -1
  615. package/_vendor/jszip/lib/stream/DataLengthProbe.js_commonjs-proxy +0 -1
  616. package/_vendor/jszip/lib/stream/DataWorker.js_commonjs-proxy +0 -1
  617. package/_vendor/jszip/lib/stream/GenericWorker.js_commonjs-proxy +0 -1
  618. package/_vendor/jszip/lib/stream/StreamHelper.js_commonjs-proxy +0 -1
  619. package/_vendor/jszip/lib/support.js_commonjs-proxy +0 -1
  620. package/_vendor/jszip/lib/utf8.js_commonjs-proxy +0 -1
  621. package/_vendor/jszip/lib/utils.js_commonjs-proxy +0 -1
  622. package/_vendor/jszip/lib/zipEntries.js_commonjs-proxy +0 -1
  623. package/_vendor/jszip/lib/zipEntry.js_commonjs-proxy +0 -1
  624. package/_vendor/jszip/lib/zipObject.js_commonjs-proxy +0 -1
  625. package/_vendor/jszip/node_modules/pako/index.js_commonjs-proxy +0 -1
  626. package/_vendor/jszip/node_modules/pako/lib/deflate.js_commonjs-proxy +0 -1
  627. package/_vendor/jszip/node_modules/pako/lib/inflate.js_commonjs-proxy +0 -1
  628. package/_vendor/jszip/node_modules/pako/lib/utils/common.js_commonjs-proxy +0 -1
  629. package/_vendor/jszip/node_modules/pako/lib/utils/strings.js_commonjs-proxy +0 -1
  630. package/_vendor/jszip/node_modules/pako/lib/zlib/adler32.js_commonjs-proxy +0 -1
  631. package/_vendor/jszip/node_modules/pako/lib/zlib/constants.js_commonjs-proxy +0 -1
  632. package/_vendor/jszip/node_modules/pako/lib/zlib/crc32.js_commonjs-proxy +0 -1
  633. package/_vendor/jszip/node_modules/pako/lib/zlib/deflate.js_commonjs-proxy +0 -1
  634. package/_vendor/jszip/node_modules/pako/lib/zlib/gzheader.js_commonjs-proxy +0 -1
  635. package/_vendor/jszip/node_modules/pako/lib/zlib/inffast.js_commonjs-proxy +0 -1
  636. package/_vendor/jszip/node_modules/pako/lib/zlib/inflate.js_commonjs-proxy +0 -1
  637. package/_vendor/jszip/node_modules/pako/lib/zlib/inftrees.js_commonjs-proxy +0 -1
  638. package/_vendor/jszip/node_modules/pako/lib/zlib/messages.js_commonjs-proxy +0 -1
  639. package/_vendor/jszip/node_modules/pako/lib/zlib/trees.js_commonjs-proxy +0 -1
  640. package/_vendor/jszip/node_modules/pako/lib/zlib/zstream.js_commonjs-proxy +0 -1
  641. package/_vendor/lie/lib/browser.js_commonjs-proxy +0 -1
  642. package/_vendor/safe-buffer/index.js_commonjs-proxy +0 -1
  643. package/_vendor/set-immediate-shim/index.js_commonjs-proxy +0 -1
  644. package/_vendor/util/support/isBufferBrowser.js_commonjs-proxy +0 -1
  645. package/_virtual/_polyfill-node_stream.js_commonjs-proxy.js +0 -6
  646. package/_virtual/polyfill-node__buffer_list.js +0 -59
  647. package/_virtual/polyfill-node__stream_duplex.js +0 -44
  648. package/_virtual/polyfill-node__stream_passthrough.js +0 -15
  649. package/_virtual/polyfill-node__stream_readable.js +0 -896
  650. package/_virtual/polyfill-node__stream_transform.js +0 -132
  651. package/_virtual/polyfill-node__stream_writable.js +0 -480
  652. package/_virtual/polyfill-node_process.js +0 -225
  653. package/_virtual/polyfill-node_stream.js +0 -120
  654. package/vendor/buffer/index.js +0 -2112
  655. package/vendor/events/events.js +0 -457
  656. package/vendor/ieee754/index.js +0 -92
  657. package/vendor/immediate/lib/browser.js +0 -72
  658. package/vendor/inherits/inherits_browser.js +0 -29
  659. package/vendor/jszip/lib/base64.js +0 -113
  660. package/vendor/jszip/lib/compressedObject.js +0 -74
  661. package/vendor/jszip/lib/compressions.js +0 -20
  662. package/vendor/jszip/lib/crc32.js +0 -77
  663. package/vendor/jszip/lib/defaults.js +0 -25
  664. package/vendor/jszip/lib/external.js +0 -22
  665. package/vendor/jszip/lib/flate.js +0 -96
  666. package/vendor/jszip/lib/generate/ZipFileWorker.js +0 -540
  667. package/vendor/jszip/lib/generate/index.js +0 -61
  668. package/vendor/jszip/lib/index.js +0 -58
  669. package/vendor/jszip/lib/load.js +0 -82
  670. package/vendor/jszip/lib/nodejs/NodejsStreamInputAdapter.js +0 -74
  671. package/vendor/jszip/lib/nodejs/NodejsStreamOutputAdapter.js +0 -45
  672. package/vendor/jszip/lib/nodejsUtils.js +0 -59
  673. package/vendor/jszip/lib/object.js +0 -389
  674. package/vendor/jszip/lib/readable-stream-browser.js +0 -14
  675. package/vendor/jszip/lib/reader/ArrayReader.js +0 -58
  676. package/vendor/jszip/lib/reader/DataReader.js +0 -117
  677. package/vendor/jszip/lib/reader/NodeBufferReader.js +0 -20
  678. package/vendor/jszip/lib/reader/StringReader.js +0 -39
  679. package/vendor/jszip/lib/reader/Uint8ArrayReader.js +0 -23
  680. package/vendor/jszip/lib/reader/readerFor.js +0 -28
  681. package/vendor/jszip/lib/signature.js +0 -17
  682. package/vendor/jszip/lib/stream/ConvertWorker.js +0 -26
  683. package/vendor/jszip/lib/stream/Crc32Probe.js +0 -24
  684. package/vendor/jszip/lib/stream/DataLengthProbe.js +0 -28
  685. package/vendor/jszip/lib/stream/DataWorker.js +0 -116
  686. package/vendor/jszip/lib/stream/GenericWorker.js +0 -263
  687. package/vendor/jszip/lib/stream/StreamHelper.js +0 -214
  688. package/vendor/jszip/lib/support.js +0 -45
  689. package/vendor/jszip/lib/utf8.js +0 -284
  690. package/vendor/jszip/lib/utils.js +0 -486
  691. package/vendor/jszip/lib/zipEntries.js +0 -257
  692. package/vendor/jszip/lib/zipEntry.js +0 -293
  693. package/vendor/jszip/lib/zipObject.js +0 -133
  694. package/vendor/jszip/node_modules/pako/index.js +0 -18
  695. package/vendor/jszip/node_modules/pako/lib/deflate.js +0 -406
  696. package/vendor/jszip/node_modules/pako/lib/inflate.js +0 -429
  697. package/vendor/jszip/node_modules/pako/lib/utils/common.js +0 -110
  698. package/vendor/jszip/node_modules/pako/lib/utils/strings.js +0 -192
  699. package/vendor/jszip/node_modules/pako/lib/zlib/adler32.js +0 -51
  700. package/vendor/jszip/node_modules/pako/lib/zlib/constants.js +0 -68
  701. package/vendor/jszip/node_modules/pako/lib/zlib/crc32.js +0 -59
  702. package/vendor/jszip/node_modules/pako/lib/zlib/deflate.js +0 -1892
  703. package/vendor/jszip/node_modules/pako/lib/zlib/gzheader.js +0 -58
  704. package/vendor/jszip/node_modules/pako/lib/zlib/inffast.js +0 -345
  705. package/vendor/jszip/node_modules/pako/lib/zlib/inflate.js +0 -1572
  706. package/vendor/jszip/node_modules/pako/lib/zlib/inftrees.js +0 -345
  707. package/vendor/jszip/node_modules/pako/lib/zlib/messages.js +0 -32
  708. package/vendor/jszip/node_modules/pako/lib/zlib/trees.js +0 -1232
  709. package/vendor/jszip/node_modules/pako/lib/zlib/zstream.js +0 -47
  710. package/vendor/lie/lib/browser.js +0 -274
  711. package/vendor/process/browser.js +0 -190
  712. package/vendor/safe-buffer/index.js +0 -69
  713. package/vendor/set-immediate-shim/index.js +0 -8
  714. package/vendor/string_decoder/lib/string_decoder.js +0 -276
  715. package/vendor/util/support/isBufferBrowser.js +0 -8
  716. package/vendor/util/util.js +0 -706
  717. package/vendor/webworker-promise/lib/index.js +0 -172
@@ -1,2112 +0,0 @@
1
- import { c as createCommonjsModule } from '../../_virtual/commonjsHelpers.js';
2
- import { b as base64Js } from '../base64-js/index.js';
3
- import { i as ieee754 } from '../ieee754/index.js';
4
-
5
- /*!
6
- * The buffer module from node.js, for the browser.
7
- *
8
- * @author Feross Aboukhadijeh <https://feross.org>
9
- * @license MIT
10
- */
11
-
12
- var buffer = createCommonjsModule(function (module, exports) {
13
-
14
-
15
-
16
- const customInspectSymbol =
17
- (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation
18
- ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
19
- : null;
20
-
21
- exports.Buffer = Buffer;
22
- exports.SlowBuffer = SlowBuffer;
23
- exports.INSPECT_MAX_BYTES = 50;
24
-
25
- const K_MAX_LENGTH = 0x7fffffff;
26
- exports.kMaxLength = K_MAX_LENGTH;
27
-
28
- /**
29
- * If `Buffer.TYPED_ARRAY_SUPPORT`:
30
- * === true Use Uint8Array implementation (fastest)
31
- * === false Print warning and recommend using `buffer` v4.x which has an Object
32
- * implementation (most compatible, even IE6)
33
- *
34
- * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
35
- * Opera 11.6+, iOS 4.2+.
36
- *
37
- * We report that the browser does not support typed arrays if the are not subclassable
38
- * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
39
- * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
40
- * for __proto__ and has a buggy typed array implementation.
41
- */
42
- Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();
43
-
44
- if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
45
- typeof console.error === 'function') {
46
- console.error(
47
- 'This browser lacks typed array (Uint8Array) support which is required by ' +
48
- '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
49
- );
50
- }
51
-
52
- function typedArraySupport () {
53
- // Can typed array instances can be augmented?
54
- try {
55
- const arr = new Uint8Array(1);
56
- const proto = { foo: function () { return 42 } };
57
- Object.setPrototypeOf(proto, Uint8Array.prototype);
58
- Object.setPrototypeOf(arr, proto);
59
- return arr.foo() === 42
60
- } catch (e) {
61
- return false
62
- }
63
- }
64
-
65
- Object.defineProperty(Buffer.prototype, 'parent', {
66
- enumerable: true,
67
- get: function () {
68
- if (!Buffer.isBuffer(this)) return undefined
69
- return this.buffer
70
- }
71
- });
72
-
73
- Object.defineProperty(Buffer.prototype, 'offset', {
74
- enumerable: true,
75
- get: function () {
76
- if (!Buffer.isBuffer(this)) return undefined
77
- return this.byteOffset
78
- }
79
- });
80
-
81
- function createBuffer (length) {
82
- if (length > K_MAX_LENGTH) {
83
- throw new RangeError('The value "' + length + '" is invalid for option "size"')
84
- }
85
- // Return an augmented `Uint8Array` instance
86
- const buf = new Uint8Array(length);
87
- Object.setPrototypeOf(buf, Buffer.prototype);
88
- return buf
89
- }
90
-
91
- /**
92
- * The Buffer constructor returns instances of `Uint8Array` that have their
93
- * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
94
- * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
95
- * and the `Uint8Array` methods. Square bracket notation works as expected -- it
96
- * returns a single octet.
97
- *
98
- * The `Uint8Array` prototype remains unmodified.
99
- */
100
-
101
- function Buffer (arg, encodingOrOffset, length) {
102
- // Common case.
103
- if (typeof arg === 'number') {
104
- if (typeof encodingOrOffset === 'string') {
105
- throw new TypeError(
106
- 'The "string" argument must be of type string. Received type number'
107
- )
108
- }
109
- return allocUnsafe(arg)
110
- }
111
- return from(arg, encodingOrOffset, length)
112
- }
113
-
114
- Buffer.poolSize = 8192; // not used by this implementation
115
-
116
- function from (value, encodingOrOffset, length) {
117
- if (typeof value === 'string') {
118
- return fromString(value, encodingOrOffset)
119
- }
120
-
121
- if (ArrayBuffer.isView(value)) {
122
- return fromArrayView(value)
123
- }
124
-
125
- if (value == null) {
126
- throw new TypeError(
127
- 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
128
- 'or Array-like Object. Received type ' + (typeof value)
129
- )
130
- }
131
-
132
- if (isInstance(value, ArrayBuffer) ||
133
- (value && isInstance(value.buffer, ArrayBuffer))) {
134
- return fromArrayBuffer(value, encodingOrOffset, length)
135
- }
136
-
137
- if (typeof SharedArrayBuffer !== 'undefined' &&
138
- (isInstance(value, SharedArrayBuffer) ||
139
- (value && isInstance(value.buffer, SharedArrayBuffer)))) {
140
- return fromArrayBuffer(value, encodingOrOffset, length)
141
- }
142
-
143
- if (typeof value === 'number') {
144
- throw new TypeError(
145
- 'The "value" argument must not be of type number. Received type number'
146
- )
147
- }
148
-
149
- const valueOf = value.valueOf && value.valueOf();
150
- if (valueOf != null && valueOf !== value) {
151
- return Buffer.from(valueOf, encodingOrOffset, length)
152
- }
153
-
154
- const b = fromObject(value);
155
- if (b) return b
156
-
157
- if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
158
- typeof value[Symbol.toPrimitive] === 'function') {
159
- return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)
160
- }
161
-
162
- throw new TypeError(
163
- 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
164
- 'or Array-like Object. Received type ' + (typeof value)
165
- )
166
- }
167
-
168
- /**
169
- * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
170
- * if value is a number.
171
- * Buffer.from(str[, encoding])
172
- * Buffer.from(array)
173
- * Buffer.from(buffer)
174
- * Buffer.from(arrayBuffer[, byteOffset[, length]])
175
- **/
176
- Buffer.from = function (value, encodingOrOffset, length) {
177
- return from(value, encodingOrOffset, length)
178
- };
179
-
180
- // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
181
- // https://github.com/feross/buffer/pull/148
182
- Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype);
183
- Object.setPrototypeOf(Buffer, Uint8Array);
184
-
185
- function assertSize (size) {
186
- if (typeof size !== 'number') {
187
- throw new TypeError('"size" argument must be of type number')
188
- } else if (size < 0) {
189
- throw new RangeError('The value "' + size + '" is invalid for option "size"')
190
- }
191
- }
192
-
193
- function alloc (size, fill, encoding) {
194
- assertSize(size);
195
- if (size <= 0) {
196
- return createBuffer(size)
197
- }
198
- if (fill !== undefined) {
199
- // Only pay attention to encoding if it's a string. This
200
- // prevents accidentally sending in a number that would
201
- // be interpreted as a start offset.
202
- return typeof encoding === 'string'
203
- ? createBuffer(size).fill(fill, encoding)
204
- : createBuffer(size).fill(fill)
205
- }
206
- return createBuffer(size)
207
- }
208
-
209
- /**
210
- * Creates a new filled Buffer instance.
211
- * alloc(size[, fill[, encoding]])
212
- **/
213
- Buffer.alloc = function (size, fill, encoding) {
214
- return alloc(size, fill, encoding)
215
- };
216
-
217
- function allocUnsafe (size) {
218
- assertSize(size);
219
- return createBuffer(size < 0 ? 0 : checked(size) | 0)
220
- }
221
-
222
- /**
223
- * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
224
- * */
225
- Buffer.allocUnsafe = function (size) {
226
- return allocUnsafe(size)
227
- };
228
- /**
229
- * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
230
- */
231
- Buffer.allocUnsafeSlow = function (size) {
232
- return allocUnsafe(size)
233
- };
234
-
235
- function fromString (string, encoding) {
236
- if (typeof encoding !== 'string' || encoding === '') {
237
- encoding = 'utf8';
238
- }
239
-
240
- if (!Buffer.isEncoding(encoding)) {
241
- throw new TypeError('Unknown encoding: ' + encoding)
242
- }
243
-
244
- const length = byteLength(string, encoding) | 0;
245
- let buf = createBuffer(length);
246
-
247
- const actual = buf.write(string, encoding);
248
-
249
- if (actual !== length) {
250
- // Writing a hex string, for example, that contains invalid characters will
251
- // cause everything after the first invalid character to be ignored. (e.g.
252
- // 'abxxcd' will be treated as 'ab')
253
- buf = buf.slice(0, actual);
254
- }
255
-
256
- return buf
257
- }
258
-
259
- function fromArrayLike (array) {
260
- const length = array.length < 0 ? 0 : checked(array.length) | 0;
261
- const buf = createBuffer(length);
262
- for (let i = 0; i < length; i += 1) {
263
- buf[i] = array[i] & 255;
264
- }
265
- return buf
266
- }
267
-
268
- function fromArrayView (arrayView) {
269
- if (isInstance(arrayView, Uint8Array)) {
270
- const copy = new Uint8Array(arrayView);
271
- return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)
272
- }
273
- return fromArrayLike(arrayView)
274
- }
275
-
276
- function fromArrayBuffer (array, byteOffset, length) {
277
- if (byteOffset < 0 || array.byteLength < byteOffset) {
278
- throw new RangeError('"offset" is outside of buffer bounds')
279
- }
280
-
281
- if (array.byteLength < byteOffset + (length || 0)) {
282
- throw new RangeError('"length" is outside of buffer bounds')
283
- }
284
-
285
- let buf;
286
- if (byteOffset === undefined && length === undefined) {
287
- buf = new Uint8Array(array);
288
- } else if (length === undefined) {
289
- buf = new Uint8Array(array, byteOffset);
290
- } else {
291
- buf = new Uint8Array(array, byteOffset, length);
292
- }
293
-
294
- // Return an augmented `Uint8Array` instance
295
- Object.setPrototypeOf(buf, Buffer.prototype);
296
-
297
- return buf
298
- }
299
-
300
- function fromObject (obj) {
301
- if (Buffer.isBuffer(obj)) {
302
- const len = checked(obj.length) | 0;
303
- const buf = createBuffer(len);
304
-
305
- if (buf.length === 0) {
306
- return buf
307
- }
308
-
309
- obj.copy(buf, 0, 0, len);
310
- return buf
311
- }
312
-
313
- if (obj.length !== undefined) {
314
- if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
315
- return createBuffer(0)
316
- }
317
- return fromArrayLike(obj)
318
- }
319
-
320
- if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
321
- return fromArrayLike(obj.data)
322
- }
323
- }
324
-
325
- function checked (length) {
326
- // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
327
- // length is NaN (which is otherwise coerced to zero.)
328
- if (length >= K_MAX_LENGTH) {
329
- throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
330
- 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
331
- }
332
- return length | 0
333
- }
334
-
335
- function SlowBuffer (length) {
336
- if (+length != length) { // eslint-disable-line eqeqeq
337
- length = 0;
338
- }
339
- return Buffer.alloc(+length)
340
- }
341
-
342
- Buffer.isBuffer = function isBuffer (b) {
343
- return b != null && b._isBuffer === true &&
344
- b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
345
- };
346
-
347
- Buffer.compare = function compare (a, b) {
348
- if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength);
349
- if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength);
350
- if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
351
- throw new TypeError(
352
- 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
353
- )
354
- }
355
-
356
- if (a === b) return 0
357
-
358
- let x = a.length;
359
- let y = b.length;
360
-
361
- for (let i = 0, len = Math.min(x, y); i < len; ++i) {
362
- if (a[i] !== b[i]) {
363
- x = a[i];
364
- y = b[i];
365
- break
366
- }
367
- }
368
-
369
- if (x < y) return -1
370
- if (y < x) return 1
371
- return 0
372
- };
373
-
374
- Buffer.isEncoding = function isEncoding (encoding) {
375
- switch (String(encoding).toLowerCase()) {
376
- case 'hex':
377
- case 'utf8':
378
- case 'utf-8':
379
- case 'ascii':
380
- case 'latin1':
381
- case 'binary':
382
- case 'base64':
383
- case 'ucs2':
384
- case 'ucs-2':
385
- case 'utf16le':
386
- case 'utf-16le':
387
- return true
388
- default:
389
- return false
390
- }
391
- };
392
-
393
- Buffer.concat = function concat (list, length) {
394
- if (!Array.isArray(list)) {
395
- throw new TypeError('"list" argument must be an Array of Buffers')
396
- }
397
-
398
- if (list.length === 0) {
399
- return Buffer.alloc(0)
400
- }
401
-
402
- let i;
403
- if (length === undefined) {
404
- length = 0;
405
- for (i = 0; i < list.length; ++i) {
406
- length += list[i].length;
407
- }
408
- }
409
-
410
- const buffer = Buffer.allocUnsafe(length);
411
- let pos = 0;
412
- for (i = 0; i < list.length; ++i) {
413
- let buf = list[i];
414
- if (isInstance(buf, Uint8Array)) {
415
- if (pos + buf.length > buffer.length) {
416
- if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf);
417
- buf.copy(buffer, pos);
418
- } else {
419
- Uint8Array.prototype.set.call(
420
- buffer,
421
- buf,
422
- pos
423
- );
424
- }
425
- } else if (!Buffer.isBuffer(buf)) {
426
- throw new TypeError('"list" argument must be an Array of Buffers')
427
- } else {
428
- buf.copy(buffer, pos);
429
- }
430
- pos += buf.length;
431
- }
432
- return buffer
433
- };
434
-
435
- function byteLength (string, encoding) {
436
- if (Buffer.isBuffer(string)) {
437
- return string.length
438
- }
439
- if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
440
- return string.byteLength
441
- }
442
- if (typeof string !== 'string') {
443
- throw new TypeError(
444
- 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
445
- 'Received type ' + typeof string
446
- )
447
- }
448
-
449
- const len = string.length;
450
- const mustMatch = (arguments.length > 2 && arguments[2] === true);
451
- if (!mustMatch && len === 0) return 0
452
-
453
- // Use a for loop to avoid recursion
454
- let loweredCase = false;
455
- for (;;) {
456
- switch (encoding) {
457
- case 'ascii':
458
- case 'latin1':
459
- case 'binary':
460
- return len
461
- case 'utf8':
462
- case 'utf-8':
463
- return utf8ToBytes(string).length
464
- case 'ucs2':
465
- case 'ucs-2':
466
- case 'utf16le':
467
- case 'utf-16le':
468
- return len * 2
469
- case 'hex':
470
- return len >>> 1
471
- case 'base64':
472
- return base64ToBytes(string).length
473
- default:
474
- if (loweredCase) {
475
- return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
476
- }
477
- encoding = ('' + encoding).toLowerCase();
478
- loweredCase = true;
479
- }
480
- }
481
- }
482
- Buffer.byteLength = byteLength;
483
-
484
- function slowToString (encoding, start, end) {
485
- let loweredCase = false;
486
-
487
- // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
488
- // property of a typed array.
489
-
490
- // This behaves neither like String nor Uint8Array in that we set start/end
491
- // to their upper/lower bounds if the value passed is out of range.
492
- // undefined is handled specially as per ECMA-262 6th Edition,
493
- // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
494
- if (start === undefined || start < 0) {
495
- start = 0;
496
- }
497
- // Return early if start > this.length. Done here to prevent potential uint32
498
- // coercion fail below.
499
- if (start > this.length) {
500
- return ''
501
- }
502
-
503
- if (end === undefined || end > this.length) {
504
- end = this.length;
505
- }
506
-
507
- if (end <= 0) {
508
- return ''
509
- }
510
-
511
- // Force coercion to uint32. This will also coerce falsey/NaN values to 0.
512
- end >>>= 0;
513
- start >>>= 0;
514
-
515
- if (end <= start) {
516
- return ''
517
- }
518
-
519
- if (!encoding) encoding = 'utf8';
520
-
521
- while (true) {
522
- switch (encoding) {
523
- case 'hex':
524
- return hexSlice(this, start, end)
525
-
526
- case 'utf8':
527
- case 'utf-8':
528
- return utf8Slice(this, start, end)
529
-
530
- case 'ascii':
531
- return asciiSlice(this, start, end)
532
-
533
- case 'latin1':
534
- case 'binary':
535
- return latin1Slice(this, start, end)
536
-
537
- case 'base64':
538
- return base64Slice(this, start, end)
539
-
540
- case 'ucs2':
541
- case 'ucs-2':
542
- case 'utf16le':
543
- case 'utf-16le':
544
- return utf16leSlice(this, start, end)
545
-
546
- default:
547
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
548
- encoding = (encoding + '').toLowerCase();
549
- loweredCase = true;
550
- }
551
- }
552
- }
553
-
554
- // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
555
- // to detect a Buffer instance. It's not possible to use `instanceof Buffer`
556
- // reliably in a browserify context because there could be multiple different
557
- // copies of the 'buffer' package in use. This method works even for Buffer
558
- // instances that were created from another copy of the `buffer` package.
559
- // See: https://github.com/feross/buffer/issues/154
560
- Buffer.prototype._isBuffer = true;
561
-
562
- function swap (b, n, m) {
563
- const i = b[n];
564
- b[n] = b[m];
565
- b[m] = i;
566
- }
567
-
568
- Buffer.prototype.swap16 = function swap16 () {
569
- const len = this.length;
570
- if (len % 2 !== 0) {
571
- throw new RangeError('Buffer size must be a multiple of 16-bits')
572
- }
573
- for (let i = 0; i < len; i += 2) {
574
- swap(this, i, i + 1);
575
- }
576
- return this
577
- };
578
-
579
- Buffer.prototype.swap32 = function swap32 () {
580
- const len = this.length;
581
- if (len % 4 !== 0) {
582
- throw new RangeError('Buffer size must be a multiple of 32-bits')
583
- }
584
- for (let i = 0; i < len; i += 4) {
585
- swap(this, i, i + 3);
586
- swap(this, i + 1, i + 2);
587
- }
588
- return this
589
- };
590
-
591
- Buffer.prototype.swap64 = function swap64 () {
592
- const len = this.length;
593
- if (len % 8 !== 0) {
594
- throw new RangeError('Buffer size must be a multiple of 64-bits')
595
- }
596
- for (let i = 0; i < len; i += 8) {
597
- swap(this, i, i + 7);
598
- swap(this, i + 1, i + 6);
599
- swap(this, i + 2, i + 5);
600
- swap(this, i + 3, i + 4);
601
- }
602
- return this
603
- };
604
-
605
- Buffer.prototype.toString = function toString () {
606
- const length = this.length;
607
- if (length === 0) return ''
608
- if (arguments.length === 0) return utf8Slice(this, 0, length)
609
- return slowToString.apply(this, arguments)
610
- };
611
-
612
- Buffer.prototype.toLocaleString = Buffer.prototype.toString;
613
-
614
- Buffer.prototype.equals = function equals (b) {
615
- if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
616
- if (this === b) return true
617
- return Buffer.compare(this, b) === 0
618
- };
619
-
620
- Buffer.prototype.inspect = function inspect () {
621
- let str = '';
622
- const max = exports.INSPECT_MAX_BYTES;
623
- str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();
624
- if (this.length > max) str += ' ... ';
625
- return '<Buffer ' + str + '>'
626
- };
627
- if (customInspectSymbol) {
628
- Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect;
629
- }
630
-
631
- Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
632
- if (isInstance(target, Uint8Array)) {
633
- target = Buffer.from(target, target.offset, target.byteLength);
634
- }
635
- if (!Buffer.isBuffer(target)) {
636
- throw new TypeError(
637
- 'The "target" argument must be one of type Buffer or Uint8Array. ' +
638
- 'Received type ' + (typeof target)
639
- )
640
- }
641
-
642
- if (start === undefined) {
643
- start = 0;
644
- }
645
- if (end === undefined) {
646
- end = target ? target.length : 0;
647
- }
648
- if (thisStart === undefined) {
649
- thisStart = 0;
650
- }
651
- if (thisEnd === undefined) {
652
- thisEnd = this.length;
653
- }
654
-
655
- if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
656
- throw new RangeError('out of range index')
657
- }
658
-
659
- if (thisStart >= thisEnd && start >= end) {
660
- return 0
661
- }
662
- if (thisStart >= thisEnd) {
663
- return -1
664
- }
665
- if (start >= end) {
666
- return 1
667
- }
668
-
669
- start >>>= 0;
670
- end >>>= 0;
671
- thisStart >>>= 0;
672
- thisEnd >>>= 0;
673
-
674
- if (this === target) return 0
675
-
676
- let x = thisEnd - thisStart;
677
- let y = end - start;
678
- const len = Math.min(x, y);
679
-
680
- const thisCopy = this.slice(thisStart, thisEnd);
681
- const targetCopy = target.slice(start, end);
682
-
683
- for (let i = 0; i < len; ++i) {
684
- if (thisCopy[i] !== targetCopy[i]) {
685
- x = thisCopy[i];
686
- y = targetCopy[i];
687
- break
688
- }
689
- }
690
-
691
- if (x < y) return -1
692
- if (y < x) return 1
693
- return 0
694
- };
695
-
696
- // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
697
- // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
698
- //
699
- // Arguments:
700
- // - buffer - a Buffer to search
701
- // - val - a string, Buffer, or number
702
- // - byteOffset - an index into `buffer`; will be clamped to an int32
703
- // - encoding - an optional encoding, relevant is val is a string
704
- // - dir - true for indexOf, false for lastIndexOf
705
- function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
706
- // Empty buffer means no match
707
- if (buffer.length === 0) return -1
708
-
709
- // Normalize byteOffset
710
- if (typeof byteOffset === 'string') {
711
- encoding = byteOffset;
712
- byteOffset = 0;
713
- } else if (byteOffset > 0x7fffffff) {
714
- byteOffset = 0x7fffffff;
715
- } else if (byteOffset < -0x80000000) {
716
- byteOffset = -0x80000000;
717
- }
718
- byteOffset = +byteOffset; // Coerce to Number.
719
- if (numberIsNaN(byteOffset)) {
720
- // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
721
- byteOffset = dir ? 0 : (buffer.length - 1);
722
- }
723
-
724
- // Normalize byteOffset: negative offsets start from the end of the buffer
725
- if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
726
- if (byteOffset >= buffer.length) {
727
- if (dir) return -1
728
- else byteOffset = buffer.length - 1;
729
- } else if (byteOffset < 0) {
730
- if (dir) byteOffset = 0;
731
- else return -1
732
- }
733
-
734
- // Normalize val
735
- if (typeof val === 'string') {
736
- val = Buffer.from(val, encoding);
737
- }
738
-
739
- // Finally, search either indexOf (if dir is true) or lastIndexOf
740
- if (Buffer.isBuffer(val)) {
741
- // Special case: looking for empty string/buffer always fails
742
- if (val.length === 0) {
743
- return -1
744
- }
745
- return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
746
- } else if (typeof val === 'number') {
747
- val = val & 0xFF; // Search for a byte value [0-255]
748
- if (typeof Uint8Array.prototype.indexOf === 'function') {
749
- if (dir) {
750
- return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
751
- } else {
752
- return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
753
- }
754
- }
755
- return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)
756
- }
757
-
758
- throw new TypeError('val must be string, number or Buffer')
759
- }
760
-
761
- function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
762
- let indexSize = 1;
763
- let arrLength = arr.length;
764
- let valLength = val.length;
765
-
766
- if (encoding !== undefined) {
767
- encoding = String(encoding).toLowerCase();
768
- if (encoding === 'ucs2' || encoding === 'ucs-2' ||
769
- encoding === 'utf16le' || encoding === 'utf-16le') {
770
- if (arr.length < 2 || val.length < 2) {
771
- return -1
772
- }
773
- indexSize = 2;
774
- arrLength /= 2;
775
- valLength /= 2;
776
- byteOffset /= 2;
777
- }
778
- }
779
-
780
- function read (buf, i) {
781
- if (indexSize === 1) {
782
- return buf[i]
783
- } else {
784
- return buf.readUInt16BE(i * indexSize)
785
- }
786
- }
787
-
788
- let i;
789
- if (dir) {
790
- let foundIndex = -1;
791
- for (i = byteOffset; i < arrLength; i++) {
792
- if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
793
- if (foundIndex === -1) foundIndex = i;
794
- if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
795
- } else {
796
- if (foundIndex !== -1) i -= i - foundIndex;
797
- foundIndex = -1;
798
- }
799
- }
800
- } else {
801
- if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
802
- for (i = byteOffset; i >= 0; i--) {
803
- let found = true;
804
- for (let j = 0; j < valLength; j++) {
805
- if (read(arr, i + j) !== read(val, j)) {
806
- found = false;
807
- break
808
- }
809
- }
810
- if (found) return i
811
- }
812
- }
813
-
814
- return -1
815
- }
816
-
817
- Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
818
- return this.indexOf(val, byteOffset, encoding) !== -1
819
- };
820
-
821
- Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
822
- return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
823
- };
824
-
825
- Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
826
- return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
827
- };
828
-
829
- function hexWrite (buf, string, offset, length) {
830
- offset = Number(offset) || 0;
831
- const remaining = buf.length - offset;
832
- if (!length) {
833
- length = remaining;
834
- } else {
835
- length = Number(length);
836
- if (length > remaining) {
837
- length = remaining;
838
- }
839
- }
840
-
841
- const strLen = string.length;
842
-
843
- if (length > strLen / 2) {
844
- length = strLen / 2;
845
- }
846
- let i;
847
- for (i = 0; i < length; ++i) {
848
- const parsed = parseInt(string.substr(i * 2, 2), 16);
849
- if (numberIsNaN(parsed)) return i
850
- buf[offset + i] = parsed;
851
- }
852
- return i
853
- }
854
-
855
- function utf8Write (buf, string, offset, length) {
856
- return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
857
- }
858
-
859
- function asciiWrite (buf, string, offset, length) {
860
- return blitBuffer(asciiToBytes(string), buf, offset, length)
861
- }
862
-
863
- function base64Write (buf, string, offset, length) {
864
- return blitBuffer(base64ToBytes(string), buf, offset, length)
865
- }
866
-
867
- function ucs2Write (buf, string, offset, length) {
868
- return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
869
- }
870
-
871
- Buffer.prototype.write = function write (string, offset, length, encoding) {
872
- // Buffer#write(string)
873
- if (offset === undefined) {
874
- encoding = 'utf8';
875
- length = this.length;
876
- offset = 0;
877
- // Buffer#write(string, encoding)
878
- } else if (length === undefined && typeof offset === 'string') {
879
- encoding = offset;
880
- length = this.length;
881
- offset = 0;
882
- // Buffer#write(string, offset[, length][, encoding])
883
- } else if (isFinite(offset)) {
884
- offset = offset >>> 0;
885
- if (isFinite(length)) {
886
- length = length >>> 0;
887
- if (encoding === undefined) encoding = 'utf8';
888
- } else {
889
- encoding = length;
890
- length = undefined;
891
- }
892
- } else {
893
- throw new Error(
894
- 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
895
- )
896
- }
897
-
898
- const remaining = this.length - offset;
899
- if (length === undefined || length > remaining) length = remaining;
900
-
901
- if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
902
- throw new RangeError('Attempt to write outside buffer bounds')
903
- }
904
-
905
- if (!encoding) encoding = 'utf8';
906
-
907
- let loweredCase = false;
908
- for (;;) {
909
- switch (encoding) {
910
- case 'hex':
911
- return hexWrite(this, string, offset, length)
912
-
913
- case 'utf8':
914
- case 'utf-8':
915
- return utf8Write(this, string, offset, length)
916
-
917
- case 'ascii':
918
- case 'latin1':
919
- case 'binary':
920
- return asciiWrite(this, string, offset, length)
921
-
922
- case 'base64':
923
- // Warning: maxLength not taken into account in base64Write
924
- return base64Write(this, string, offset, length)
925
-
926
- case 'ucs2':
927
- case 'ucs-2':
928
- case 'utf16le':
929
- case 'utf-16le':
930
- return ucs2Write(this, string, offset, length)
931
-
932
- default:
933
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
934
- encoding = ('' + encoding).toLowerCase();
935
- loweredCase = true;
936
- }
937
- }
938
- };
939
-
940
- Buffer.prototype.toJSON = function toJSON () {
941
- return {
942
- type: 'Buffer',
943
- data: Array.prototype.slice.call(this._arr || this, 0)
944
- }
945
- };
946
-
947
- function base64Slice (buf, start, end) {
948
- if (start === 0 && end === buf.length) {
949
- return base64Js.fromByteArray(buf)
950
- } else {
951
- return base64Js.fromByteArray(buf.slice(start, end))
952
- }
953
- }
954
-
955
- function utf8Slice (buf, start, end) {
956
- end = Math.min(buf.length, end);
957
- const res = [];
958
-
959
- let i = start;
960
- while (i < end) {
961
- const firstByte = buf[i];
962
- let codePoint = null;
963
- let bytesPerSequence = (firstByte > 0xEF)
964
- ? 4
965
- : (firstByte > 0xDF)
966
- ? 3
967
- : (firstByte > 0xBF)
968
- ? 2
969
- : 1;
970
-
971
- if (i + bytesPerSequence <= end) {
972
- let secondByte, thirdByte, fourthByte, tempCodePoint;
973
-
974
- switch (bytesPerSequence) {
975
- case 1:
976
- if (firstByte < 0x80) {
977
- codePoint = firstByte;
978
- }
979
- break
980
- case 2:
981
- secondByte = buf[i + 1];
982
- if ((secondByte & 0xC0) === 0x80) {
983
- tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);
984
- if (tempCodePoint > 0x7F) {
985
- codePoint = tempCodePoint;
986
- }
987
- }
988
- break
989
- case 3:
990
- secondByte = buf[i + 1];
991
- thirdByte = buf[i + 2];
992
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
993
- tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);
994
- if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
995
- codePoint = tempCodePoint;
996
- }
997
- }
998
- break
999
- case 4:
1000
- secondByte = buf[i + 1];
1001
- thirdByte = buf[i + 2];
1002
- fourthByte = buf[i + 3];
1003
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
1004
- tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);
1005
- if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
1006
- codePoint = tempCodePoint;
1007
- }
1008
- }
1009
- }
1010
- }
1011
-
1012
- if (codePoint === null) {
1013
- // we did not generate a valid codePoint so insert a
1014
- // replacement char (U+FFFD) and advance only 1 byte
1015
- codePoint = 0xFFFD;
1016
- bytesPerSequence = 1;
1017
- } else if (codePoint > 0xFFFF) {
1018
- // encode to utf16 (surrogate pair dance)
1019
- codePoint -= 0x10000;
1020
- res.push(codePoint >>> 10 & 0x3FF | 0xD800);
1021
- codePoint = 0xDC00 | codePoint & 0x3FF;
1022
- }
1023
-
1024
- res.push(codePoint);
1025
- i += bytesPerSequence;
1026
- }
1027
-
1028
- return decodeCodePointsArray(res)
1029
- }
1030
-
1031
- // Based on http://stackoverflow.com/a/22747272/680742, the browser with
1032
- // the lowest limit is Chrome, with 0x10000 args.
1033
- // We go 1 magnitude less, for safety
1034
- const MAX_ARGUMENTS_LENGTH = 0x1000;
1035
-
1036
- function decodeCodePointsArray (codePoints) {
1037
- const len = codePoints.length;
1038
- if (len <= MAX_ARGUMENTS_LENGTH) {
1039
- return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
1040
- }
1041
-
1042
- // Decode in chunks to avoid "call stack size exceeded".
1043
- let res = '';
1044
- let i = 0;
1045
- while (i < len) {
1046
- res += String.fromCharCode.apply(
1047
- String,
1048
- codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
1049
- );
1050
- }
1051
- return res
1052
- }
1053
-
1054
- function asciiSlice (buf, start, end) {
1055
- let ret = '';
1056
- end = Math.min(buf.length, end);
1057
-
1058
- for (let i = start; i < end; ++i) {
1059
- ret += String.fromCharCode(buf[i] & 0x7F);
1060
- }
1061
- return ret
1062
- }
1063
-
1064
- function latin1Slice (buf, start, end) {
1065
- let ret = '';
1066
- end = Math.min(buf.length, end);
1067
-
1068
- for (let i = start; i < end; ++i) {
1069
- ret += String.fromCharCode(buf[i]);
1070
- }
1071
- return ret
1072
- }
1073
-
1074
- function hexSlice (buf, start, end) {
1075
- const len = buf.length;
1076
-
1077
- if (!start || start < 0) start = 0;
1078
- if (!end || end < 0 || end > len) end = len;
1079
-
1080
- let out = '';
1081
- for (let i = start; i < end; ++i) {
1082
- out += hexSliceLookupTable[buf[i]];
1083
- }
1084
- return out
1085
- }
1086
-
1087
- function utf16leSlice (buf, start, end) {
1088
- const bytes = buf.slice(start, end);
1089
- let res = '';
1090
- // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
1091
- for (let i = 0; i < bytes.length - 1; i += 2) {
1092
- res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256));
1093
- }
1094
- return res
1095
- }
1096
-
1097
- Buffer.prototype.slice = function slice (start, end) {
1098
- const len = this.length;
1099
- start = ~~start;
1100
- end = end === undefined ? len : ~~end;
1101
-
1102
- if (start < 0) {
1103
- start += len;
1104
- if (start < 0) start = 0;
1105
- } else if (start > len) {
1106
- start = len;
1107
- }
1108
-
1109
- if (end < 0) {
1110
- end += len;
1111
- if (end < 0) end = 0;
1112
- } else if (end > len) {
1113
- end = len;
1114
- }
1115
-
1116
- if (end < start) end = start;
1117
-
1118
- const newBuf = this.subarray(start, end);
1119
- // Return an augmented `Uint8Array` instance
1120
- Object.setPrototypeOf(newBuf, Buffer.prototype);
1121
-
1122
- return newBuf
1123
- };
1124
-
1125
- /*
1126
- * Need to make sure that buffer isn't trying to write out of bounds.
1127
- */
1128
- function checkOffset (offset, ext, length) {
1129
- if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
1130
- if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
1131
- }
1132
-
1133
- Buffer.prototype.readUintLE =
1134
- Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
1135
- offset = offset >>> 0;
1136
- byteLength = byteLength >>> 0;
1137
- if (!noAssert) checkOffset(offset, byteLength, this.length);
1138
-
1139
- let val = this[offset];
1140
- let mul = 1;
1141
- let i = 0;
1142
- while (++i < byteLength && (mul *= 0x100)) {
1143
- val += this[offset + i] * mul;
1144
- }
1145
-
1146
- return val
1147
- };
1148
-
1149
- Buffer.prototype.readUintBE =
1150
- Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
1151
- offset = offset >>> 0;
1152
- byteLength = byteLength >>> 0;
1153
- if (!noAssert) {
1154
- checkOffset(offset, byteLength, this.length);
1155
- }
1156
-
1157
- let val = this[offset + --byteLength];
1158
- let mul = 1;
1159
- while (byteLength > 0 && (mul *= 0x100)) {
1160
- val += this[offset + --byteLength] * mul;
1161
- }
1162
-
1163
- return val
1164
- };
1165
-
1166
- Buffer.prototype.readUint8 =
1167
- Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
1168
- offset = offset >>> 0;
1169
- if (!noAssert) checkOffset(offset, 1, this.length);
1170
- return this[offset]
1171
- };
1172
-
1173
- Buffer.prototype.readUint16LE =
1174
- Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
1175
- offset = offset >>> 0;
1176
- if (!noAssert) checkOffset(offset, 2, this.length);
1177
- return this[offset] | (this[offset + 1] << 8)
1178
- };
1179
-
1180
- Buffer.prototype.readUint16BE =
1181
- Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
1182
- offset = offset >>> 0;
1183
- if (!noAssert) checkOffset(offset, 2, this.length);
1184
- return (this[offset] << 8) | this[offset + 1]
1185
- };
1186
-
1187
- Buffer.prototype.readUint32LE =
1188
- Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
1189
- offset = offset >>> 0;
1190
- if (!noAssert) checkOffset(offset, 4, this.length);
1191
-
1192
- return ((this[offset]) |
1193
- (this[offset + 1] << 8) |
1194
- (this[offset + 2] << 16)) +
1195
- (this[offset + 3] * 0x1000000)
1196
- };
1197
-
1198
- Buffer.prototype.readUint32BE =
1199
- Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
1200
- offset = offset >>> 0;
1201
- if (!noAssert) checkOffset(offset, 4, this.length);
1202
-
1203
- return (this[offset] * 0x1000000) +
1204
- ((this[offset + 1] << 16) |
1205
- (this[offset + 2] << 8) |
1206
- this[offset + 3])
1207
- };
1208
-
1209
- Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {
1210
- offset = offset >>> 0;
1211
- validateNumber(offset, 'offset');
1212
- const first = this[offset];
1213
- const last = this[offset + 7];
1214
- if (first === undefined || last === undefined) {
1215
- boundsError(offset, this.length - 8);
1216
- }
1217
-
1218
- const lo = first +
1219
- this[++offset] * 2 ** 8 +
1220
- this[++offset] * 2 ** 16 +
1221
- this[++offset] * 2 ** 24;
1222
-
1223
- const hi = this[++offset] +
1224
- this[++offset] * 2 ** 8 +
1225
- this[++offset] * 2 ** 16 +
1226
- last * 2 ** 24;
1227
-
1228
- return BigInt(lo) + (BigInt(hi) << BigInt(32))
1229
- });
1230
-
1231
- Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {
1232
- offset = offset >>> 0;
1233
- validateNumber(offset, 'offset');
1234
- const first = this[offset];
1235
- const last = this[offset + 7];
1236
- if (first === undefined || last === undefined) {
1237
- boundsError(offset, this.length - 8);
1238
- }
1239
-
1240
- const hi = first * 2 ** 24 +
1241
- this[++offset] * 2 ** 16 +
1242
- this[++offset] * 2 ** 8 +
1243
- this[++offset];
1244
-
1245
- const lo = this[++offset] * 2 ** 24 +
1246
- this[++offset] * 2 ** 16 +
1247
- this[++offset] * 2 ** 8 +
1248
- last;
1249
-
1250
- return (BigInt(hi) << BigInt(32)) + BigInt(lo)
1251
- });
1252
-
1253
- Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
1254
- offset = offset >>> 0;
1255
- byteLength = byteLength >>> 0;
1256
- if (!noAssert) checkOffset(offset, byteLength, this.length);
1257
-
1258
- let val = this[offset];
1259
- let mul = 1;
1260
- let i = 0;
1261
- while (++i < byteLength && (mul *= 0x100)) {
1262
- val += this[offset + i] * mul;
1263
- }
1264
- mul *= 0x80;
1265
-
1266
- if (val >= mul) val -= Math.pow(2, 8 * byteLength);
1267
-
1268
- return val
1269
- };
1270
-
1271
- Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
1272
- offset = offset >>> 0;
1273
- byteLength = byteLength >>> 0;
1274
- if (!noAssert) checkOffset(offset, byteLength, this.length);
1275
-
1276
- let i = byteLength;
1277
- let mul = 1;
1278
- let val = this[offset + --i];
1279
- while (i > 0 && (mul *= 0x100)) {
1280
- val += this[offset + --i] * mul;
1281
- }
1282
- mul *= 0x80;
1283
-
1284
- if (val >= mul) val -= Math.pow(2, 8 * byteLength);
1285
-
1286
- return val
1287
- };
1288
-
1289
- Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
1290
- offset = offset >>> 0;
1291
- if (!noAssert) checkOffset(offset, 1, this.length);
1292
- if (!(this[offset] & 0x80)) return (this[offset])
1293
- return ((0xff - this[offset] + 1) * -1)
1294
- };
1295
-
1296
- Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
1297
- offset = offset >>> 0;
1298
- if (!noAssert) checkOffset(offset, 2, this.length);
1299
- const val = this[offset] | (this[offset + 1] << 8);
1300
- return (val & 0x8000) ? val | 0xFFFF0000 : val
1301
- };
1302
-
1303
- Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
1304
- offset = offset >>> 0;
1305
- if (!noAssert) checkOffset(offset, 2, this.length);
1306
- const val = this[offset + 1] | (this[offset] << 8);
1307
- return (val & 0x8000) ? val | 0xFFFF0000 : val
1308
- };
1309
-
1310
- Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
1311
- offset = offset >>> 0;
1312
- if (!noAssert) checkOffset(offset, 4, this.length);
1313
-
1314
- return (this[offset]) |
1315
- (this[offset + 1] << 8) |
1316
- (this[offset + 2] << 16) |
1317
- (this[offset + 3] << 24)
1318
- };
1319
-
1320
- Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
1321
- offset = offset >>> 0;
1322
- if (!noAssert) checkOffset(offset, 4, this.length);
1323
-
1324
- return (this[offset] << 24) |
1325
- (this[offset + 1] << 16) |
1326
- (this[offset + 2] << 8) |
1327
- (this[offset + 3])
1328
- };
1329
-
1330
- Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {
1331
- offset = offset >>> 0;
1332
- validateNumber(offset, 'offset');
1333
- const first = this[offset];
1334
- const last = this[offset + 7];
1335
- if (first === undefined || last === undefined) {
1336
- boundsError(offset, this.length - 8);
1337
- }
1338
-
1339
- const val = this[offset + 4] +
1340
- this[offset + 5] * 2 ** 8 +
1341
- this[offset + 6] * 2 ** 16 +
1342
- (last << 24); // Overflow
1343
-
1344
- return (BigInt(val) << BigInt(32)) +
1345
- BigInt(first +
1346
- this[++offset] * 2 ** 8 +
1347
- this[++offset] * 2 ** 16 +
1348
- this[++offset] * 2 ** 24)
1349
- });
1350
-
1351
- Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {
1352
- offset = offset >>> 0;
1353
- validateNumber(offset, 'offset');
1354
- const first = this[offset];
1355
- const last = this[offset + 7];
1356
- if (first === undefined || last === undefined) {
1357
- boundsError(offset, this.length - 8);
1358
- }
1359
-
1360
- const val = (first << 24) + // Overflow
1361
- this[++offset] * 2 ** 16 +
1362
- this[++offset] * 2 ** 8 +
1363
- this[++offset];
1364
-
1365
- return (BigInt(val) << BigInt(32)) +
1366
- BigInt(this[++offset] * 2 ** 24 +
1367
- this[++offset] * 2 ** 16 +
1368
- this[++offset] * 2 ** 8 +
1369
- last)
1370
- });
1371
-
1372
- Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
1373
- offset = offset >>> 0;
1374
- if (!noAssert) checkOffset(offset, 4, this.length);
1375
- return ieee754.read(this, offset, true, 23, 4)
1376
- };
1377
-
1378
- Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
1379
- offset = offset >>> 0;
1380
- if (!noAssert) checkOffset(offset, 4, this.length);
1381
- return ieee754.read(this, offset, false, 23, 4)
1382
- };
1383
-
1384
- Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
1385
- offset = offset >>> 0;
1386
- if (!noAssert) checkOffset(offset, 8, this.length);
1387
- return ieee754.read(this, offset, true, 52, 8)
1388
- };
1389
-
1390
- Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
1391
- offset = offset >>> 0;
1392
- if (!noAssert) checkOffset(offset, 8, this.length);
1393
- return ieee754.read(this, offset, false, 52, 8)
1394
- };
1395
-
1396
- function checkInt (buf, value, offset, ext, max, min) {
1397
- if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
1398
- if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
1399
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
1400
- }
1401
-
1402
- Buffer.prototype.writeUintLE =
1403
- Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
1404
- value = +value;
1405
- offset = offset >>> 0;
1406
- byteLength = byteLength >>> 0;
1407
- if (!noAssert) {
1408
- const maxBytes = Math.pow(2, 8 * byteLength) - 1;
1409
- checkInt(this, value, offset, byteLength, maxBytes, 0);
1410
- }
1411
-
1412
- let mul = 1;
1413
- let i = 0;
1414
- this[offset] = value & 0xFF;
1415
- while (++i < byteLength && (mul *= 0x100)) {
1416
- this[offset + i] = (value / mul) & 0xFF;
1417
- }
1418
-
1419
- return offset + byteLength
1420
- };
1421
-
1422
- Buffer.prototype.writeUintBE =
1423
- Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
1424
- value = +value;
1425
- offset = offset >>> 0;
1426
- byteLength = byteLength >>> 0;
1427
- if (!noAssert) {
1428
- const maxBytes = Math.pow(2, 8 * byteLength) - 1;
1429
- checkInt(this, value, offset, byteLength, maxBytes, 0);
1430
- }
1431
-
1432
- let i = byteLength - 1;
1433
- let mul = 1;
1434
- this[offset + i] = value & 0xFF;
1435
- while (--i >= 0 && (mul *= 0x100)) {
1436
- this[offset + i] = (value / mul) & 0xFF;
1437
- }
1438
-
1439
- return offset + byteLength
1440
- };
1441
-
1442
- Buffer.prototype.writeUint8 =
1443
- Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
1444
- value = +value;
1445
- offset = offset >>> 0;
1446
- if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
1447
- this[offset] = (value & 0xff);
1448
- return offset + 1
1449
- };
1450
-
1451
- Buffer.prototype.writeUint16LE =
1452
- Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
1453
- value = +value;
1454
- offset = offset >>> 0;
1455
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
1456
- this[offset] = (value & 0xff);
1457
- this[offset + 1] = (value >>> 8);
1458
- return offset + 2
1459
- };
1460
-
1461
- Buffer.prototype.writeUint16BE =
1462
- Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
1463
- value = +value;
1464
- offset = offset >>> 0;
1465
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
1466
- this[offset] = (value >>> 8);
1467
- this[offset + 1] = (value & 0xff);
1468
- return offset + 2
1469
- };
1470
-
1471
- Buffer.prototype.writeUint32LE =
1472
- Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
1473
- value = +value;
1474
- offset = offset >>> 0;
1475
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
1476
- this[offset + 3] = (value >>> 24);
1477
- this[offset + 2] = (value >>> 16);
1478
- this[offset + 1] = (value >>> 8);
1479
- this[offset] = (value & 0xff);
1480
- return offset + 4
1481
- };
1482
-
1483
- Buffer.prototype.writeUint32BE =
1484
- Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
1485
- value = +value;
1486
- offset = offset >>> 0;
1487
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
1488
- this[offset] = (value >>> 24);
1489
- this[offset + 1] = (value >>> 16);
1490
- this[offset + 2] = (value >>> 8);
1491
- this[offset + 3] = (value & 0xff);
1492
- return offset + 4
1493
- };
1494
-
1495
- function wrtBigUInt64LE (buf, value, offset, min, max) {
1496
- checkIntBI(value, min, max, buf, offset, 7);
1497
-
1498
- let lo = Number(value & BigInt(0xffffffff));
1499
- buf[offset++] = lo;
1500
- lo = lo >> 8;
1501
- buf[offset++] = lo;
1502
- lo = lo >> 8;
1503
- buf[offset++] = lo;
1504
- lo = lo >> 8;
1505
- buf[offset++] = lo;
1506
- let hi = Number(value >> BigInt(32) & BigInt(0xffffffff));
1507
- buf[offset++] = hi;
1508
- hi = hi >> 8;
1509
- buf[offset++] = hi;
1510
- hi = hi >> 8;
1511
- buf[offset++] = hi;
1512
- hi = hi >> 8;
1513
- buf[offset++] = hi;
1514
- return offset
1515
- }
1516
-
1517
- function wrtBigUInt64BE (buf, value, offset, min, max) {
1518
- checkIntBI(value, min, max, buf, offset, 7);
1519
-
1520
- let lo = Number(value & BigInt(0xffffffff));
1521
- buf[offset + 7] = lo;
1522
- lo = lo >> 8;
1523
- buf[offset + 6] = lo;
1524
- lo = lo >> 8;
1525
- buf[offset + 5] = lo;
1526
- lo = lo >> 8;
1527
- buf[offset + 4] = lo;
1528
- let hi = Number(value >> BigInt(32) & BigInt(0xffffffff));
1529
- buf[offset + 3] = hi;
1530
- hi = hi >> 8;
1531
- buf[offset + 2] = hi;
1532
- hi = hi >> 8;
1533
- buf[offset + 1] = hi;
1534
- hi = hi >> 8;
1535
- buf[offset] = hi;
1536
- return offset + 8
1537
- }
1538
-
1539
- Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {
1540
- return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
1541
- });
1542
-
1543
- Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {
1544
- return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
1545
- });
1546
-
1547
- Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
1548
- value = +value;
1549
- offset = offset >>> 0;
1550
- if (!noAssert) {
1551
- const limit = Math.pow(2, (8 * byteLength) - 1);
1552
-
1553
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
1554
- }
1555
-
1556
- let i = 0;
1557
- let mul = 1;
1558
- let sub = 0;
1559
- this[offset] = value & 0xFF;
1560
- while (++i < byteLength && (mul *= 0x100)) {
1561
- if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
1562
- sub = 1;
1563
- }
1564
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
1565
- }
1566
-
1567
- return offset + byteLength
1568
- };
1569
-
1570
- Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
1571
- value = +value;
1572
- offset = offset >>> 0;
1573
- if (!noAssert) {
1574
- const limit = Math.pow(2, (8 * byteLength) - 1);
1575
-
1576
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
1577
- }
1578
-
1579
- let i = byteLength - 1;
1580
- let mul = 1;
1581
- let sub = 0;
1582
- this[offset + i] = value & 0xFF;
1583
- while (--i >= 0 && (mul *= 0x100)) {
1584
- if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
1585
- sub = 1;
1586
- }
1587
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
1588
- }
1589
-
1590
- return offset + byteLength
1591
- };
1592
-
1593
- Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
1594
- value = +value;
1595
- offset = offset >>> 0;
1596
- if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
1597
- if (value < 0) value = 0xff + value + 1;
1598
- this[offset] = (value & 0xff);
1599
- return offset + 1
1600
- };
1601
-
1602
- Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
1603
- value = +value;
1604
- offset = offset >>> 0;
1605
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
1606
- this[offset] = (value & 0xff);
1607
- this[offset + 1] = (value >>> 8);
1608
- return offset + 2
1609
- };
1610
-
1611
- Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
1612
- value = +value;
1613
- offset = offset >>> 0;
1614
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
1615
- this[offset] = (value >>> 8);
1616
- this[offset + 1] = (value & 0xff);
1617
- return offset + 2
1618
- };
1619
-
1620
- Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
1621
- value = +value;
1622
- offset = offset >>> 0;
1623
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
1624
- this[offset] = (value & 0xff);
1625
- this[offset + 1] = (value >>> 8);
1626
- this[offset + 2] = (value >>> 16);
1627
- this[offset + 3] = (value >>> 24);
1628
- return offset + 4
1629
- };
1630
-
1631
- Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
1632
- value = +value;
1633
- offset = offset >>> 0;
1634
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
1635
- if (value < 0) value = 0xffffffff + value + 1;
1636
- this[offset] = (value >>> 24);
1637
- this[offset + 1] = (value >>> 16);
1638
- this[offset + 2] = (value >>> 8);
1639
- this[offset + 3] = (value & 0xff);
1640
- return offset + 4
1641
- };
1642
-
1643
- Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {
1644
- return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
1645
- });
1646
-
1647
- Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {
1648
- return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
1649
- });
1650
-
1651
- function checkIEEE754 (buf, value, offset, ext, max, min) {
1652
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
1653
- if (offset < 0) throw new RangeError('Index out of range')
1654
- }
1655
-
1656
- function writeFloat (buf, value, offset, littleEndian, noAssert) {
1657
- value = +value;
1658
- offset = offset >>> 0;
1659
- if (!noAssert) {
1660
- checkIEEE754(buf, value, offset, 4);
1661
- }
1662
- ieee754.write(buf, value, offset, littleEndian, 23, 4);
1663
- return offset + 4
1664
- }
1665
-
1666
- Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
1667
- return writeFloat(this, value, offset, true, noAssert)
1668
- };
1669
-
1670
- Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
1671
- return writeFloat(this, value, offset, false, noAssert)
1672
- };
1673
-
1674
- function writeDouble (buf, value, offset, littleEndian, noAssert) {
1675
- value = +value;
1676
- offset = offset >>> 0;
1677
- if (!noAssert) {
1678
- checkIEEE754(buf, value, offset, 8);
1679
- }
1680
- ieee754.write(buf, value, offset, littleEndian, 52, 8);
1681
- return offset + 8
1682
- }
1683
-
1684
- Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
1685
- return writeDouble(this, value, offset, true, noAssert)
1686
- };
1687
-
1688
- Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
1689
- return writeDouble(this, value, offset, false, noAssert)
1690
- };
1691
-
1692
- // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
1693
- Buffer.prototype.copy = function copy (target, targetStart, start, end) {
1694
- if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
1695
- if (!start) start = 0;
1696
- if (!end && end !== 0) end = this.length;
1697
- if (targetStart >= target.length) targetStart = target.length;
1698
- if (!targetStart) targetStart = 0;
1699
- if (end > 0 && end < start) end = start;
1700
-
1701
- // Copy 0 bytes; we're done
1702
- if (end === start) return 0
1703
- if (target.length === 0 || this.length === 0) return 0
1704
-
1705
- // Fatal error conditions
1706
- if (targetStart < 0) {
1707
- throw new RangeError('targetStart out of bounds')
1708
- }
1709
- if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
1710
- if (end < 0) throw new RangeError('sourceEnd out of bounds')
1711
-
1712
- // Are we oob?
1713
- if (end > this.length) end = this.length;
1714
- if (target.length - targetStart < end - start) {
1715
- end = target.length - targetStart + start;
1716
- }
1717
-
1718
- const len = end - start;
1719
-
1720
- if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
1721
- // Use built-in when available, missing from IE11
1722
- this.copyWithin(targetStart, start, end);
1723
- } else {
1724
- Uint8Array.prototype.set.call(
1725
- target,
1726
- this.subarray(start, end),
1727
- targetStart
1728
- );
1729
- }
1730
-
1731
- return len
1732
- };
1733
-
1734
- // Usage:
1735
- // buffer.fill(number[, offset[, end]])
1736
- // buffer.fill(buffer[, offset[, end]])
1737
- // buffer.fill(string[, offset[, end]][, encoding])
1738
- Buffer.prototype.fill = function fill (val, start, end, encoding) {
1739
- // Handle string cases:
1740
- if (typeof val === 'string') {
1741
- if (typeof start === 'string') {
1742
- encoding = start;
1743
- start = 0;
1744
- end = this.length;
1745
- } else if (typeof end === 'string') {
1746
- encoding = end;
1747
- end = this.length;
1748
- }
1749
- if (encoding !== undefined && typeof encoding !== 'string') {
1750
- throw new TypeError('encoding must be a string')
1751
- }
1752
- if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
1753
- throw new TypeError('Unknown encoding: ' + encoding)
1754
- }
1755
- if (val.length === 1) {
1756
- const code = val.charCodeAt(0);
1757
- if ((encoding === 'utf8' && code < 128) ||
1758
- encoding === 'latin1') {
1759
- // Fast path: If `val` fits into a single byte, use that numeric value.
1760
- val = code;
1761
- }
1762
- }
1763
- } else if (typeof val === 'number') {
1764
- val = val & 255;
1765
- } else if (typeof val === 'boolean') {
1766
- val = Number(val);
1767
- }
1768
-
1769
- // Invalid ranges are not set to a default, so can range check early.
1770
- if (start < 0 || this.length < start || this.length < end) {
1771
- throw new RangeError('Out of range index')
1772
- }
1773
-
1774
- if (end <= start) {
1775
- return this
1776
- }
1777
-
1778
- start = start >>> 0;
1779
- end = end === undefined ? this.length : end >>> 0;
1780
-
1781
- if (!val) val = 0;
1782
-
1783
- let i;
1784
- if (typeof val === 'number') {
1785
- for (i = start; i < end; ++i) {
1786
- this[i] = val;
1787
- }
1788
- } else {
1789
- const bytes = Buffer.isBuffer(val)
1790
- ? val
1791
- : Buffer.from(val, encoding);
1792
- const len = bytes.length;
1793
- if (len === 0) {
1794
- throw new TypeError('The value "' + val +
1795
- '" is invalid for argument "value"')
1796
- }
1797
- for (i = 0; i < end - start; ++i) {
1798
- this[i + start] = bytes[i % len];
1799
- }
1800
- }
1801
-
1802
- return this
1803
- };
1804
-
1805
- // CUSTOM ERRORS
1806
- // =============
1807
-
1808
- // Simplified versions from Node, changed for Buffer-only usage
1809
- const errors = {};
1810
- function E (sym, getMessage, Base) {
1811
- errors[sym] = class NodeError extends Base {
1812
- constructor () {
1813
- super();
1814
-
1815
- Object.defineProperty(this, 'message', {
1816
- value: getMessage.apply(this, arguments),
1817
- writable: true,
1818
- configurable: true
1819
- });
1820
-
1821
- // Add the error code to the name to include it in the stack trace.
1822
- this.name = `${this.name} [${sym}]`;
1823
- // Access the stack to generate the error message including the error code
1824
- // from the name.
1825
- this.stack; // eslint-disable-line no-unused-expressions
1826
- // Reset the name to the actual name.
1827
- delete this.name;
1828
- }
1829
-
1830
- get code () {
1831
- return sym
1832
- }
1833
-
1834
- set code (value) {
1835
- Object.defineProperty(this, 'code', {
1836
- configurable: true,
1837
- enumerable: true,
1838
- value,
1839
- writable: true
1840
- });
1841
- }
1842
-
1843
- toString () {
1844
- return `${this.name} [${sym}]: ${this.message}`
1845
- }
1846
- };
1847
- }
1848
-
1849
- E('ERR_BUFFER_OUT_OF_BOUNDS',
1850
- function (name) {
1851
- if (name) {
1852
- return `${name} is outside of buffer bounds`
1853
- }
1854
-
1855
- return 'Attempt to access memory outside buffer bounds'
1856
- }, RangeError);
1857
- E('ERR_INVALID_ARG_TYPE',
1858
- function (name, actual) {
1859
- return `The "${name}" argument must be of type number. Received type ${typeof actual}`
1860
- }, TypeError);
1861
- E('ERR_OUT_OF_RANGE',
1862
- function (str, range, input) {
1863
- let msg = `The value of "${str}" is out of range.`;
1864
- let received = input;
1865
- if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
1866
- received = addNumericalSeparator(String(input));
1867
- } else if (typeof input === 'bigint') {
1868
- received = String(input);
1869
- if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
1870
- received = addNumericalSeparator(received);
1871
- }
1872
- received += 'n';
1873
- }
1874
- msg += ` It must be ${range}. Received ${received}`;
1875
- return msg
1876
- }, RangeError);
1877
-
1878
- function addNumericalSeparator (val) {
1879
- let res = '';
1880
- let i = val.length;
1881
- const start = val[0] === '-' ? 1 : 0;
1882
- for (; i >= start + 4; i -= 3) {
1883
- res = `_${val.slice(i - 3, i)}${res}`;
1884
- }
1885
- return `${val.slice(0, i)}${res}`
1886
- }
1887
-
1888
- // CHECK FUNCTIONS
1889
- // ===============
1890
-
1891
- function checkBounds (buf, offset, byteLength) {
1892
- validateNumber(offset, 'offset');
1893
- if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {
1894
- boundsError(offset, buf.length - (byteLength + 1));
1895
- }
1896
- }
1897
-
1898
- function checkIntBI (value, min, max, buf, offset, byteLength) {
1899
- if (value > max || value < min) {
1900
- const n = typeof min === 'bigint' ? 'n' : '';
1901
- let range;
1902
- if (byteLength > 3) {
1903
- if (min === 0 || min === BigInt(0)) {
1904
- range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`;
1905
- } else {
1906
- range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +
1907
- `${(byteLength + 1) * 8 - 1}${n}`;
1908
- }
1909
- } else {
1910
- range = `>= ${min}${n} and <= ${max}${n}`;
1911
- }
1912
- throw new errors.ERR_OUT_OF_RANGE('value', range, value)
1913
- }
1914
- checkBounds(buf, offset, byteLength);
1915
- }
1916
-
1917
- function validateNumber (value, name) {
1918
- if (typeof value !== 'number') {
1919
- throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)
1920
- }
1921
- }
1922
-
1923
- function boundsError (value, length, type) {
1924
- if (Math.floor(value) !== value) {
1925
- validateNumber(value, type);
1926
- throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)
1927
- }
1928
-
1929
- if (length < 0) {
1930
- throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()
1931
- }
1932
-
1933
- throw new errors.ERR_OUT_OF_RANGE(type || 'offset',
1934
- `>= ${type ? 1 : 0} and <= ${length}`,
1935
- value)
1936
- }
1937
-
1938
- // HELPER FUNCTIONS
1939
- // ================
1940
-
1941
- const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
1942
-
1943
- function base64clean (str) {
1944
- // Node takes equal signs as end of the Base64 encoding
1945
- str = str.split('=')[0];
1946
- // Node strips out invalid characters like \n and \t from the string, base64-js does not
1947
- str = str.trim().replace(INVALID_BASE64_RE, '');
1948
- // Node converts strings with length < 2 to ''
1949
- if (str.length < 2) return ''
1950
- // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
1951
- while (str.length % 4 !== 0) {
1952
- str = str + '=';
1953
- }
1954
- return str
1955
- }
1956
-
1957
- function utf8ToBytes (string, units) {
1958
- units = units || Infinity;
1959
- let codePoint;
1960
- const length = string.length;
1961
- let leadSurrogate = null;
1962
- const bytes = [];
1963
-
1964
- for (let i = 0; i < length; ++i) {
1965
- codePoint = string.charCodeAt(i);
1966
-
1967
- // is surrogate component
1968
- if (codePoint > 0xD7FF && codePoint < 0xE000) {
1969
- // last char was a lead
1970
- if (!leadSurrogate) {
1971
- // no lead yet
1972
- if (codePoint > 0xDBFF) {
1973
- // unexpected trail
1974
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
1975
- continue
1976
- } else if (i + 1 === length) {
1977
- // unpaired lead
1978
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
1979
- continue
1980
- }
1981
-
1982
- // valid lead
1983
- leadSurrogate = codePoint;
1984
-
1985
- continue
1986
- }
1987
-
1988
- // 2 leads in a row
1989
- if (codePoint < 0xDC00) {
1990
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
1991
- leadSurrogate = codePoint;
1992
- continue
1993
- }
1994
-
1995
- // valid surrogate pair
1996
- codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
1997
- } else if (leadSurrogate) {
1998
- // valid bmp char, but last char was a lead
1999
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
2000
- }
2001
-
2002
- leadSurrogate = null;
2003
-
2004
- // encode utf8
2005
- if (codePoint < 0x80) {
2006
- if ((units -= 1) < 0) break
2007
- bytes.push(codePoint);
2008
- } else if (codePoint < 0x800) {
2009
- if ((units -= 2) < 0) break
2010
- bytes.push(
2011
- codePoint >> 0x6 | 0xC0,
2012
- codePoint & 0x3F | 0x80
2013
- );
2014
- } else if (codePoint < 0x10000) {
2015
- if ((units -= 3) < 0) break
2016
- bytes.push(
2017
- codePoint >> 0xC | 0xE0,
2018
- codePoint >> 0x6 & 0x3F | 0x80,
2019
- codePoint & 0x3F | 0x80
2020
- );
2021
- } else if (codePoint < 0x110000) {
2022
- if ((units -= 4) < 0) break
2023
- bytes.push(
2024
- codePoint >> 0x12 | 0xF0,
2025
- codePoint >> 0xC & 0x3F | 0x80,
2026
- codePoint >> 0x6 & 0x3F | 0x80,
2027
- codePoint & 0x3F | 0x80
2028
- );
2029
- } else {
2030
- throw new Error('Invalid code point')
2031
- }
2032
- }
2033
-
2034
- return bytes
2035
- }
2036
-
2037
- function asciiToBytes (str) {
2038
- const byteArray = [];
2039
- for (let i = 0; i < str.length; ++i) {
2040
- // Node's code seems to be doing this and not & 0x7F..
2041
- byteArray.push(str.charCodeAt(i) & 0xFF);
2042
- }
2043
- return byteArray
2044
- }
2045
-
2046
- function utf16leToBytes (str, units) {
2047
- let c, hi, lo;
2048
- const byteArray = [];
2049
- for (let i = 0; i < str.length; ++i) {
2050
- if ((units -= 2) < 0) break
2051
-
2052
- c = str.charCodeAt(i);
2053
- hi = c >> 8;
2054
- lo = c % 256;
2055
- byteArray.push(lo);
2056
- byteArray.push(hi);
2057
- }
2058
-
2059
- return byteArray
2060
- }
2061
-
2062
- function base64ToBytes (str) {
2063
- return base64Js.toByteArray(base64clean(str))
2064
- }
2065
-
2066
- function blitBuffer (src, dst, offset, length) {
2067
- let i;
2068
- for (i = 0; i < length; ++i) {
2069
- if ((i + offset >= dst.length) || (i >= src.length)) break
2070
- dst[i + offset] = src[i];
2071
- }
2072
- return i
2073
- }
2074
-
2075
- // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
2076
- // the `instanceof` check but they should be treated as of that type.
2077
- // See: https://github.com/feross/buffer/issues/166
2078
- function isInstance (obj, type) {
2079
- return obj instanceof type ||
2080
- (obj != null && obj.constructor != null && obj.constructor.name != null &&
2081
- obj.constructor.name === type.name)
2082
- }
2083
- function numberIsNaN (obj) {
2084
- // For IE11 support
2085
- return obj !== obj // eslint-disable-line no-self-compare
2086
- }
2087
-
2088
- // Create lookup table for `toString('hex')`
2089
- // See: https://github.com/feross/buffer/issues/219
2090
- const hexSliceLookupTable = (function () {
2091
- const alphabet = '0123456789abcdef';
2092
- const table = new Array(256);
2093
- for (let i = 0; i < 16; ++i) {
2094
- const i16 = i * 16;
2095
- for (let j = 0; j < 16; ++j) {
2096
- table[i16 + j] = alphabet[i] + alphabet[j];
2097
- }
2098
- }
2099
- return table
2100
- })();
2101
-
2102
- // Return not function with Error if BigInt not supported
2103
- function defineBigIntMethod (fn) {
2104
- return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn
2105
- }
2106
-
2107
- function BufferBigIntNotDefined () {
2108
- throw new Error('BigInt not supported')
2109
- }
2110
- });
2111
-
2112
- export { buffer as b };