umwd-components 0.1.826 → 0.1.828

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 (440) hide show
  1. package/dist/cjs/node_modules/object-assign/index.js +2 -2
  2. package/dist/cjs/node_modules/prop-types/factoryWithTypeCheckers.js +1 -1
  3. package/dist/cjs/node_modules/prop-types/index.js +1 -1
  4. package/dist/cjs/node_modules/prop-types/node_modules/react-is/index.js +1 -1
  5. package/dist/cjs/node_modules/safe-buffer/index.js +1 -1
  6. package/dist/cjs/src/components/e-commerce/products/EditReturnStockForm.js +1 -1
  7. package/dist/cjs/src/components/logistics/report/ReportMakingComponent.js +1 -1
  8. package/dist/cjs/src/components/logistics/vendor/EditVendorForm.js +1 -1
  9. package/dist/cjs/src/data/actions/logistics/note/createNoteAction.js +1 -1
  10. package/dist/cjs/src/data/actions/logistics/report/createReportAction.js +1 -1
  11. package/dist/cjs/src/index.js +1 -1
  12. package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
  13. package/dist/esm/_virtual/index2.js +2 -2
  14. package/dist/esm/_virtual/index3.js +2 -2
  15. package/dist/esm/_virtual/index4.js +2 -2
  16. package/dist/esm/node_modules/object-assign/index.js +74 -69
  17. package/dist/esm/node_modules/prop-types/factoryWithTypeCheckers.js +2 -2
  18. package/dist/esm/node_modules/prop-types/index.js +1 -1
  19. package/dist/esm/node_modules/prop-types/node_modules/react-is/index.js +1 -1
  20. package/dist/esm/node_modules/safe-buffer/index.js +1 -1
  21. package/dist/esm/src/components/e-commerce/products/EditReturnStockForm.js +11 -22
  22. package/dist/esm/src/components/logistics/report/ReportMakingComponent.js +0 -1
  23. package/dist/esm/src/components/logistics/vendor/EditVendorForm.js +0 -1
  24. package/dist/esm/src/data/actions/logistics/note/createNoteAction.js +0 -2
  25. package/dist/esm/src/data/actions/logistics/report/createReportAction.js +0 -2
  26. package/dist/esm/src/index.js +0 -1
  27. package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
  28. package/dist/esm/types/data/actions/e-commerce/lead/contactFormAction.d.ts +1 -0
  29. package/dist/esm/types/index.d.ts +0 -3
  30. package/package.json +1 -1
  31. package/dist/cjs/_virtual/_commonjs-dynamic-modules.js +0 -6
  32. package/dist/cjs/_virtual/aes.js +0 -6
  33. package/dist/cjs/_virtual/b64.js +0 -6
  34. package/dist/cjs/_virtual/blowfish.js +0 -6
  35. package/dist/cjs/_virtual/cipher-core.js +0 -6
  36. package/dist/cjs/_virtual/clone.js +0 -6
  37. package/dist/cjs/_virtual/common.js +0 -6
  38. package/dist/cjs/_virtual/context.js +0 -6
  39. package/dist/cjs/_virtual/core2.js +0 -6
  40. package/dist/cjs/_virtual/decode.js +0 -6
  41. package/dist/cjs/_virtual/deflate.js +0 -6
  42. package/dist/cjs/_virtual/dictionary-browser.js +0 -6
  43. package/dist/cjs/_virtual/dictionary.js +0 -6
  44. package/dist/cjs/_virtual/en-us.js +0 -6
  45. package/dist/cjs/_virtual/enc-base64.js +0 -6
  46. package/dist/cjs/_virtual/enc-base64url.js +0 -6
  47. package/dist/cjs/_virtual/enc-utf16.js +0 -6
  48. package/dist/cjs/_virtual/events.js +0 -6
  49. package/dist/cjs/_virtual/evpkdf.js +0 -6
  50. package/dist/cjs/_virtual/format-hex.js +0 -6
  51. package/dist/cjs/_virtual/hmac.js +0 -6
  52. package/dist/cjs/_virtual/huffman.js +0 -6
  53. package/dist/cjs/_virtual/hyphen.js +0 -6
  54. package/dist/cjs/_virtual/index10.js +0 -6
  55. package/dist/cjs/_virtual/index5.js +0 -6
  56. package/dist/cjs/_virtual/index6.js +0 -6
  57. package/dist/cjs/_virtual/index7.js +0 -6
  58. package/dist/cjs/_virtual/index8.js +0 -6
  59. package/dist/cjs/_virtual/index9.js +0 -6
  60. package/dist/cjs/_virtual/inflate.js +0 -6
  61. package/dist/cjs/_virtual/inherits_browser.js +0 -6
  62. package/dist/cjs/_virtual/lib-typedarrays.js +0 -6
  63. package/dist/cjs/_virtual/md5.js +0 -6
  64. package/dist/cjs/_virtual/mode-cfb.js +0 -6
  65. package/dist/cjs/_virtual/mode-ctr-gladman.js +0 -6
  66. package/dist/cjs/_virtual/mode-ctr.js +0 -6
  67. package/dist/cjs/_virtual/mode-ecb.js +0 -6
  68. package/dist/cjs/_virtual/mode-ofb.js +0 -6
  69. package/dist/cjs/_virtual/pad-ansix923.js +0 -6
  70. package/dist/cjs/_virtual/pad-iso10126.js +0 -6
  71. package/dist/cjs/_virtual/pad-iso97971.js +0 -6
  72. package/dist/cjs/_virtual/pad-nopadding.js +0 -6
  73. package/dist/cjs/_virtual/pad-zeropadding.js +0 -6
  74. package/dist/cjs/_virtual/pbkdf2.js +0 -6
  75. package/dist/cjs/_virtual/prefix.js +0 -6
  76. package/dist/cjs/_virtual/rabbit-legacy.js +0 -6
  77. package/dist/cjs/_virtual/rabbit.js +0 -6
  78. package/dist/cjs/_virtual/rc4.js +0 -6
  79. package/dist/cjs/_virtual/ripemd160.js +0 -6
  80. package/dist/cjs/_virtual/scheduler.development.js +0 -6
  81. package/dist/cjs/_virtual/scheduler.production.js +0 -6
  82. package/dist/cjs/_virtual/sha1.js +0 -6
  83. package/dist/cjs/_virtual/sha224.js +0 -6
  84. package/dist/cjs/_virtual/sha256.js +0 -6
  85. package/dist/cjs/_virtual/sha3.js +0 -6
  86. package/dist/cjs/_virtual/sha384.js +0 -6
  87. package/dist/cjs/_virtual/sha512.js +0 -6
  88. package/dist/cjs/_virtual/streams.js +0 -6
  89. package/dist/cjs/_virtual/transform.js +0 -6
  90. package/dist/cjs/_virtual/trees.js +0 -6
  91. package/dist/cjs/_virtual/tripledes.js +0 -6
  92. package/dist/cjs/_virtual/x64-core.js +0 -6
  93. package/dist/cjs/node_modules/@react-pdf/fns/lib/index.js +0 -6
  94. package/dist/cjs/node_modules/@react-pdf/font/lib/index.browser.js +0 -6
  95. package/dist/cjs/node_modules/@react-pdf/image/lib/index.browser.js +0 -6
  96. package/dist/cjs/node_modules/@react-pdf/layout/lib/index.js +0 -6
  97. package/dist/cjs/node_modules/@react-pdf/pdfkit/lib/pdfkit.browser.js +0 -6
  98. package/dist/cjs/node_modules/@react-pdf/png-js/lib/png-js.browser.js +0 -6
  99. package/dist/cjs/node_modules/@react-pdf/primitives/lib/index.js +0 -6
  100. package/dist/cjs/node_modules/@react-pdf/reconciler/lib/index.js +0 -6
  101. package/dist/cjs/node_modules/@react-pdf/reconciler/lib/reconciler-23.js +0 -14
  102. package/dist/cjs/node_modules/@react-pdf/reconciler/lib/reconciler-31.js +0 -26
  103. package/dist/cjs/node_modules/@react-pdf/render/lib/index.js +0 -6
  104. package/dist/cjs/node_modules/@react-pdf/renderer/lib/react-pdf.browser.js +0 -6
  105. package/dist/cjs/node_modules/@react-pdf/stylesheet/lib/index.js +0 -6
  106. package/dist/cjs/node_modules/@react-pdf/textkit/lib/textkit.js +0 -13
  107. package/dist/cjs/node_modules/@swc/helpers/esm/_define_property.js +0 -6
  108. package/dist/cjs/node_modules/abs-svg-path/index.js +0 -6
  109. package/dist/cjs/node_modules/base64-js/index.js +0 -6
  110. package/dist/cjs/node_modules/bidi-js/dist/bidi.js +0 -6
  111. package/dist/cjs/node_modules/brotli/dec/bit_reader.js +0 -6
  112. package/dist/cjs/node_modules/brotli/dec/context.js +0 -6
  113. package/dist/cjs/node_modules/brotli/dec/decode.js +0 -6
  114. package/dist/cjs/node_modules/brotli/dec/dictionary-browser.js +0 -6
  115. package/dist/cjs/node_modules/brotli/dec/dictionary.bin.js +0 -6
  116. package/dist/cjs/node_modules/brotli/dec/dictionary.js +0 -6
  117. package/dist/cjs/node_modules/brotli/dec/huffman.js +0 -6
  118. package/dist/cjs/node_modules/brotli/dec/prefix.js +0 -6
  119. package/dist/cjs/node_modules/brotli/dec/streams.js +0 -6
  120. package/dist/cjs/node_modules/brotli/dec/transform.js +0 -6
  121. package/dist/cjs/node_modules/brotli/decompress.js +0 -6
  122. package/dist/cjs/node_modules/clone/clone.js +0 -6
  123. package/dist/cjs/node_modules/color-name/index.js +0 -6
  124. package/dist/cjs/node_modules/color-string/index.js +0 -6
  125. package/dist/cjs/node_modules/crypto-js/aes.js +0 -6
  126. package/dist/cjs/node_modules/crypto-js/blowfish.js +0 -6
  127. package/dist/cjs/node_modules/crypto-js/cipher-core.js +0 -6
  128. package/dist/cjs/node_modules/crypto-js/core.js +0 -6
  129. package/dist/cjs/node_modules/crypto-js/enc-base64.js +0 -6
  130. package/dist/cjs/node_modules/crypto-js/enc-base64url.js +0 -6
  131. package/dist/cjs/node_modules/crypto-js/enc-utf16.js +0 -6
  132. package/dist/cjs/node_modules/crypto-js/evpkdf.js +0 -6
  133. package/dist/cjs/node_modules/crypto-js/format-hex.js +0 -6
  134. package/dist/cjs/node_modules/crypto-js/hmac.js +0 -6
  135. package/dist/cjs/node_modules/crypto-js/index.js +0 -6
  136. package/dist/cjs/node_modules/crypto-js/lib-typedarrays.js +0 -6
  137. package/dist/cjs/node_modules/crypto-js/md5.js +0 -6
  138. package/dist/cjs/node_modules/crypto-js/mode-cfb.js +0 -6
  139. package/dist/cjs/node_modules/crypto-js/mode-ctr-gladman.js +0 -12
  140. package/dist/cjs/node_modules/crypto-js/mode-ctr.js +0 -6
  141. package/dist/cjs/node_modules/crypto-js/mode-ecb.js +0 -6
  142. package/dist/cjs/node_modules/crypto-js/mode-ofb.js +0 -6
  143. package/dist/cjs/node_modules/crypto-js/pad-ansix923.js +0 -6
  144. package/dist/cjs/node_modules/crypto-js/pad-iso10126.js +0 -6
  145. package/dist/cjs/node_modules/crypto-js/pad-iso97971.js +0 -6
  146. package/dist/cjs/node_modules/crypto-js/pad-nopadding.js +0 -6
  147. package/dist/cjs/node_modules/crypto-js/pad-zeropadding.js +0 -6
  148. package/dist/cjs/node_modules/crypto-js/pbkdf2.js +0 -6
  149. package/dist/cjs/node_modules/crypto-js/rabbit-legacy.js +0 -6
  150. package/dist/cjs/node_modules/crypto-js/rabbit.js +0 -6
  151. package/dist/cjs/node_modules/crypto-js/rc4.js +0 -6
  152. package/dist/cjs/node_modules/crypto-js/ripemd160.js +0 -17
  153. package/dist/cjs/node_modules/crypto-js/sha1.js +0 -6
  154. package/dist/cjs/node_modules/crypto-js/sha224.js +0 -6
  155. package/dist/cjs/node_modules/crypto-js/sha256.js +0 -6
  156. package/dist/cjs/node_modules/crypto-js/sha3.js +0 -6
  157. package/dist/cjs/node_modules/crypto-js/sha384.js +0 -6
  158. package/dist/cjs/node_modules/crypto-js/sha512.js +0 -6
  159. package/dist/cjs/node_modules/crypto-js/tripledes.js +0 -6
  160. package/dist/cjs/node_modules/crypto-js/x64-core.js +0 -6
  161. package/dist/cjs/node_modules/dfa/index.js +0 -6
  162. package/dist/cjs/node_modules/emoji-regex/index.js +0 -6
  163. package/dist/cjs/node_modules/events/events.js +0 -6
  164. package/dist/cjs/node_modules/fast-deep-equal/index.js +0 -6
  165. package/dist/cjs/node_modules/fontkit/dist/browser-module.js +0 -6
  166. package/dist/cjs/node_modules/hsl-to-hex/index.js +0 -6
  167. package/dist/cjs/node_modules/hsl-to-rgb-for-reals/converter.js +0 -6
  168. package/dist/cjs/node_modules/hyphen/hyphen.js +0 -6
  169. package/dist/cjs/node_modules/hyphen/patterns/en-us.js +0 -6
  170. package/dist/cjs/node_modules/inherits/inherits_browser.js +0 -6
  171. package/dist/cjs/node_modules/jay-peg/src/index.js +0 -6
  172. package/dist/cjs/node_modules/jay-peg/src/markers/dac.js +0 -6
  173. package/dist/cjs/node_modules/jay-peg/src/markers/dht.js +0 -6
  174. package/dist/cjs/node_modules/jay-peg/src/markers/dqt.js +0 -6
  175. package/dist/cjs/node_modules/jay-peg/src/markers/dri.js +0 -6
  176. package/dist/cjs/node_modules/jay-peg/src/markers/eoi.js +0 -6
  177. package/dist/cjs/node_modules/jay-peg/src/markers/exif.js +0 -6
  178. package/dist/cjs/node_modules/jay-peg/src/markers/jfif.js +0 -6
  179. package/dist/cjs/node_modules/jay-peg/src/markers/sof.js +0 -6
  180. package/dist/cjs/node_modules/jay-peg/src/markers/soi.js +0 -6
  181. package/dist/cjs/node_modules/jay-peg/src/markers/sos.js +0 -6
  182. package/dist/cjs/node_modules/jay-peg/src/markers/utils.js +0 -6
  183. package/dist/cjs/node_modules/linebreak/dist/module.js +0 -6
  184. package/dist/cjs/node_modules/linebreak/node_modules/base64-js/lib/b64.js +0 -6
  185. package/dist/cjs/node_modules/media-engine/src/index.js +0 -6
  186. package/dist/cjs/node_modules/media-engine/src/operators.js +0 -6
  187. package/dist/cjs/node_modules/media-engine/src/parser.js +0 -6
  188. package/dist/cjs/node_modules/media-engine/src/queries.js +0 -6
  189. package/dist/cjs/node_modules/normalize-svg-path/index.js +0 -6
  190. package/dist/cjs/node_modules/pako/lib/utils/common.js +0 -6
  191. package/dist/cjs/node_modules/pako/lib/zlib/adler32.js +0 -6
  192. package/dist/cjs/node_modules/pako/lib/zlib/constants.js +0 -6
  193. package/dist/cjs/node_modules/pako/lib/zlib/crc32.js +0 -6
  194. package/dist/cjs/node_modules/pako/lib/zlib/deflate.js +0 -6
  195. package/dist/cjs/node_modules/pako/lib/zlib/inffast.js +0 -6
  196. package/dist/cjs/node_modules/pako/lib/zlib/inflate.js +0 -6
  197. package/dist/cjs/node_modules/pako/lib/zlib/inftrees.js +0 -6
  198. package/dist/cjs/node_modules/pako/lib/zlib/messages.js +0 -6
  199. package/dist/cjs/node_modules/pako/lib/zlib/trees.js +0 -6
  200. package/dist/cjs/node_modules/pako/lib/zlib/zstream.js +0 -6
  201. package/dist/cjs/node_modules/parse-svg-path/index.js +0 -6
  202. package/dist/cjs/node_modules/postcss-value-parser/lib/parse.js +0 -6
  203. package/dist/cjs/node_modules/postcss-value-parser/lib/unit.js +0 -6
  204. package/dist/cjs/node_modules/queue/index.js +0 -6
  205. package/dist/cjs/node_modules/restructure/src/Array.js +0 -6
  206. package/dist/cjs/node_modules/restructure/src/Base.js +0 -6
  207. package/dist/cjs/node_modules/restructure/src/Bitfield.js +0 -6
  208. package/dist/cjs/node_modules/restructure/src/Buffer.js +0 -6
  209. package/dist/cjs/node_modules/restructure/src/DecodeStream.js +0 -6
  210. package/dist/cjs/node_modules/restructure/src/EncodeStream.js +0 -6
  211. package/dist/cjs/node_modules/restructure/src/LazyArray.js +0 -6
  212. package/dist/cjs/node_modules/restructure/src/Number.js +0 -6
  213. package/dist/cjs/node_modules/restructure/src/Optional.js +0 -6
  214. package/dist/cjs/node_modules/restructure/src/Pointer.js +0 -6
  215. package/dist/cjs/node_modules/restructure/src/Reserved.js +0 -6
  216. package/dist/cjs/node_modules/restructure/src/String.js +0 -6
  217. package/dist/cjs/node_modules/restructure/src/Struct.js +0 -6
  218. package/dist/cjs/node_modules/restructure/src/VersionedStruct.js +0 -6
  219. package/dist/cjs/node_modules/restructure/src/utils.js +0 -6
  220. package/dist/cjs/node_modules/scheduler/cjs/scheduler.development.js +0 -15
  221. package/dist/cjs/node_modules/scheduler/cjs/scheduler.production.js +0 -15
  222. package/dist/cjs/node_modules/scheduler/index.js +0 -6
  223. package/dist/cjs/node_modules/simple-swizzle/index.js +0 -6
  224. package/dist/cjs/node_modules/simple-swizzle/node_modules/is-arrayish/index.js +0 -6
  225. package/dist/cjs/node_modules/svg-arc-to-cubic-bezier/modules/index.js +0 -6
  226. package/dist/cjs/node_modules/tiny-inflate/index.js +0 -6
  227. package/dist/cjs/node_modules/tslib/tslib.es6.js +0 -6
  228. package/dist/cjs/node_modules/unicode-properties/dist/module.js +0 -6
  229. package/dist/cjs/node_modules/unicode-trie/index.js +0 -6
  230. package/dist/cjs/node_modules/unicode-trie/swap.js +0 -6
  231. package/dist/cjs/node_modules/yoga-layout/dist/binaries/yoga-wasm-base64-esm.js +0 -6
  232. package/dist/cjs/node_modules/yoga-layout/dist/src/generated/YGEnums.js +0 -6
  233. package/dist/cjs/node_modules/yoga-layout/dist/src/load.js +0 -6
  234. package/dist/cjs/node_modules/yoga-layout/dist/src/wrapAssembly.js +0 -6
  235. package/dist/cjs/src/components/e-commerce/invoice/InvoicePDF.js +0 -7
  236. package/dist/esm/_virtual/_commonjs-dynamic-modules.js +0 -11
  237. package/dist/esm/_virtual/aes.js +0 -9
  238. package/dist/esm/_virtual/b64.js +0 -9
  239. package/dist/esm/_virtual/blowfish.js +0 -9
  240. package/dist/esm/_virtual/cipher-core.js +0 -9
  241. package/dist/esm/_virtual/clone.js +0 -9
  242. package/dist/esm/_virtual/common.js +0 -9
  243. package/dist/esm/_virtual/context.js +0 -9
  244. package/dist/esm/_virtual/core2.js +0 -9
  245. package/dist/esm/_virtual/decode.js +0 -9
  246. package/dist/esm/_virtual/deflate.js +0 -9
  247. package/dist/esm/_virtual/dictionary-browser.js +0 -9
  248. package/dist/esm/_virtual/dictionary.js +0 -9
  249. package/dist/esm/_virtual/en-us.js +0 -9
  250. package/dist/esm/_virtual/enc-base64.js +0 -9
  251. package/dist/esm/_virtual/enc-base64url.js +0 -9
  252. package/dist/esm/_virtual/enc-utf16.js +0 -9
  253. package/dist/esm/_virtual/events.js +0 -9
  254. package/dist/esm/_virtual/evpkdf.js +0 -9
  255. package/dist/esm/_virtual/format-hex.js +0 -9
  256. package/dist/esm/_virtual/hmac.js +0 -9
  257. package/dist/esm/_virtual/huffman.js +0 -9
  258. package/dist/esm/_virtual/hyphen.js +0 -9
  259. package/dist/esm/_virtual/index10.js +0 -9
  260. package/dist/esm/_virtual/index5.js +0 -9
  261. package/dist/esm/_virtual/index6.js +0 -9
  262. package/dist/esm/_virtual/index7.js +0 -9
  263. package/dist/esm/_virtual/index8.js +0 -9
  264. package/dist/esm/_virtual/index9.js +0 -9
  265. package/dist/esm/_virtual/inflate.js +0 -9
  266. package/dist/esm/_virtual/inherits_browser.js +0 -9
  267. package/dist/esm/_virtual/lib-typedarrays.js +0 -9
  268. package/dist/esm/_virtual/md5.js +0 -9
  269. package/dist/esm/_virtual/mode-cfb.js +0 -9
  270. package/dist/esm/_virtual/mode-ctr-gladman.js +0 -9
  271. package/dist/esm/_virtual/mode-ctr.js +0 -9
  272. package/dist/esm/_virtual/mode-ecb.js +0 -9
  273. package/dist/esm/_virtual/mode-ofb.js +0 -9
  274. package/dist/esm/_virtual/pad-ansix923.js +0 -9
  275. package/dist/esm/_virtual/pad-iso10126.js +0 -9
  276. package/dist/esm/_virtual/pad-iso97971.js +0 -9
  277. package/dist/esm/_virtual/pad-nopadding.js +0 -9
  278. package/dist/esm/_virtual/pad-zeropadding.js +0 -9
  279. package/dist/esm/_virtual/pbkdf2.js +0 -9
  280. package/dist/esm/_virtual/prefix.js +0 -9
  281. package/dist/esm/_virtual/rabbit-legacy.js +0 -9
  282. package/dist/esm/_virtual/rabbit.js +0 -9
  283. package/dist/esm/_virtual/rc4.js +0 -9
  284. package/dist/esm/_virtual/ripemd160.js +0 -9
  285. package/dist/esm/_virtual/scheduler.development.js +0 -9
  286. package/dist/esm/_virtual/scheduler.production.js +0 -9
  287. package/dist/esm/_virtual/sha1.js +0 -9
  288. package/dist/esm/_virtual/sha224.js +0 -9
  289. package/dist/esm/_virtual/sha256.js +0 -9
  290. package/dist/esm/_virtual/sha3.js +0 -9
  291. package/dist/esm/_virtual/sha384.js +0 -9
  292. package/dist/esm/_virtual/sha512.js +0 -9
  293. package/dist/esm/_virtual/streams.js +0 -9
  294. package/dist/esm/_virtual/transform.js +0 -9
  295. package/dist/esm/_virtual/trees.js +0 -9
  296. package/dist/esm/_virtual/tripledes.js +0 -9
  297. package/dist/esm/_virtual/x64-core.js +0 -9
  298. package/dist/esm/node_modules/@react-pdf/fns/lib/index.js +0 -254
  299. package/dist/esm/node_modules/@react-pdf/font/lib/index.browser.js +0 -481
  300. package/dist/esm/node_modules/@react-pdf/image/lib/index.browser.js +0 -2217
  301. package/dist/esm/node_modules/@react-pdf/layout/lib/index.js +0 -2982
  302. package/dist/esm/node_modules/@react-pdf/pdfkit/lib/pdfkit.browser.js +0 -47429
  303. package/dist/esm/node_modules/@react-pdf/png-js/lib/png-js.browser.js +0 -12606
  304. package/dist/esm/node_modules/@react-pdf/primitives/lib/index.js +0 -37
  305. package/dist/esm/node_modules/@react-pdf/reconciler/lib/index.js +0 -16
  306. package/dist/esm/node_modules/@react-pdf/reconciler/lib/reconciler-23.js +0 -22
  307. package/dist/esm/node_modules/@react-pdf/reconciler/lib/reconciler-31.js +0 -30
  308. package/dist/esm/node_modules/@react-pdf/render/lib/index.js +0 -2081
  309. package/dist/esm/node_modules/@react-pdf/renderer/lib/react-pdf.browser.js +0 -472
  310. package/dist/esm/node_modules/@react-pdf/stylesheet/lib/index.js +0 -771
  311. package/dist/esm/node_modules/@react-pdf/textkit/lib/textkit.js +0 -2854
  312. package/dist/esm/node_modules/@swc/helpers/esm/_define_property.js +0 -15
  313. package/dist/esm/node_modules/abs-svg-path/index.js +0 -78
  314. package/dist/esm/node_modules/base64-js/index.js +0 -158
  315. package/dist/esm/node_modules/bidi-js/dist/bidi.js +0 -1008
  316. package/dist/esm/node_modules/brotli/dec/bit_reader.js +0 -132
  317. package/dist/esm/node_modules/brotli/dec/context.js +0 -255
  318. package/dist/esm/node_modules/brotli/dec/decode.js +0 -965
  319. package/dist/esm/node_modules/brotli/dec/dictionary-browser.js +0 -35
  320. package/dist/esm/node_modules/brotli/dec/dictionary.bin.js +0 -17
  321. package/dist/esm/node_modules/brotli/dec/dictionary.js +0 -54
  322. package/dist/esm/node_modules/brotli/dec/huffman.js +0 -133
  323. package/dist/esm/node_modules/brotli/dec/prefix.js +0 -70
  324. package/dist/esm/node_modules/brotli/dec/streams.js +0 -44
  325. package/dist/esm/node_modules/brotli/dec/transform.js +0 -264
  326. package/dist/esm/node_modules/brotli/decompress.js +0 -14
  327. package/dist/esm/node_modules/clone/clone.js +0 -272
  328. package/dist/esm/node_modules/color-name/index.js +0 -158
  329. package/dist/esm/node_modules/color-string/index.js +0 -259
  330. package/dist/esm/node_modules/crypto-js/aes.js +0 -251
  331. package/dist/esm/node_modules/crypto-js/blowfish.js +0 -488
  332. package/dist/esm/node_modules/crypto-js/cipher-core.js +0 -909
  333. package/dist/esm/node_modules/crypto-js/core.js +0 -820
  334. package/dist/esm/node_modules/crypto-js/enc-base64.js +0 -149
  335. package/dist/esm/node_modules/crypto-js/enc-base64url.js +0 -161
  336. package/dist/esm/node_modules/crypto-js/enc-utf16.js +0 -162
  337. package/dist/esm/node_modules/crypto-js/evpkdf.js +0 -149
  338. package/dist/esm/node_modules/crypto-js/format-hex.js +0 -80
  339. package/dist/esm/node_modules/crypto-js/hmac.js +0 -156
  340. package/dist/esm/node_modules/crypto-js/index.js +0 -61
  341. package/dist/esm/node_modules/crypto-js/lib-typedarrays.js +0 -89
  342. package/dist/esm/node_modules/crypto-js/md5.js +0 -277
  343. package/dist/esm/node_modules/crypto-js/mode-cfb.js +0 -94
  344. package/dist/esm/node_modules/crypto-js/mode-ctr-gladman.js +0 -130
  345. package/dist/esm/node_modules/crypto-js/mode-ctr.js +0 -72
  346. package/dist/esm/node_modules/crypto-js/mode-ecb.js +0 -54
  347. package/dist/esm/node_modules/crypto-js/mode-ofb.js +0 -68
  348. package/dist/esm/node_modules/crypto-js/pad-ansix923.js +0 -63
  349. package/dist/esm/node_modules/crypto-js/pad-iso10126.js +0 -58
  350. package/dist/esm/node_modules/crypto-js/pad-iso97971.js +0 -54
  351. package/dist/esm/node_modules/crypto-js/pad-nopadding.js +0 -44
  352. package/dist/esm/node_modules/crypto-js/pad-zeropadding.js +0 -61
  353. package/dist/esm/node_modules/crypto-js/pbkdf2.js +0 -160
  354. package/dist/esm/node_modules/crypto-js/rabbit-legacy.js +0 -207
  355. package/dist/esm/node_modules/crypto-js/rabbit.js +0 -209
  356. package/dist/esm/node_modules/crypto-js/rc4.js +0 -156
  357. package/dist/esm/node_modules/crypto-js/ripemd160.js +0 -280
  358. package/dist/esm/node_modules/crypto-js/sha1.js +0 -163
  359. package/dist/esm/node_modules/crypto-js/sha224.js +0 -94
  360. package/dist/esm/node_modules/crypto-js/sha256.js +0 -212
  361. package/dist/esm/node_modules/crypto-js/sha3.js +0 -340
  362. package/dist/esm/node_modules/crypto-js/sha384.js +0 -98
  363. package/dist/esm/node_modules/crypto-js/sha512.js +0 -340
  364. package/dist/esm/node_modules/crypto-js/tripledes.js +0 -796
  365. package/dist/esm/node_modules/crypto-js/x64-core.js +0 -317
  366. package/dist/esm/node_modules/dfa/index.js +0 -101
  367. package/dist/esm/node_modules/emoji-regex/index.js +0 -12
  368. package/dist/esm/node_modules/events/events.js +0 -485
  369. package/dist/esm/node_modules/fast-deep-equal/index.js +0 -56
  370. package/dist/esm/node_modules/fontkit/dist/browser-module.js +0 -13295
  371. package/dist/esm/node_modules/hsl-to-hex/index.js +0 -72
  372. package/dist/esm/node_modules/hsl-to-rgb-for-reals/converter.js +0 -66
  373. package/dist/esm/node_modules/hyphen/hyphen.js +0 -424
  374. package/dist/esm/node_modules/hyphen/patterns/en-us.js +0 -48
  375. package/dist/esm/node_modules/inherits/inherits_browser.js +0 -39
  376. package/dist/esm/node_modules/jay-peg/src/index.js +0 -68
  377. package/dist/esm/node_modules/jay-peg/src/markers/dac.js +0 -25
  378. package/dist/esm/node_modules/jay-peg/src/markers/dht.js +0 -52
  379. package/dist/esm/node_modules/jay-peg/src/markers/dqt.js +0 -26
  380. package/dist/esm/node_modules/jay-peg/src/markers/dri.js +0 -17
  381. package/dist/esm/node_modules/jay-peg/src/markers/eoi.js +0 -17
  382. package/dist/esm/node_modules/jay-peg/src/markers/exif.js +0 -327
  383. package/dist/esm/node_modules/jay-peg/src/markers/jfif.js +0 -24
  384. package/dist/esm/node_modules/jay-peg/src/markers/sof.js +0 -32
  385. package/dist/esm/node_modules/jay-peg/src/markers/soi.js +0 -11
  386. package/dist/esm/node_modules/jay-peg/src/markers/sos.js +0 -57
  387. package/dist/esm/node_modules/jay-peg/src/markers/utils.js +0 -71
  388. package/dist/esm/node_modules/linebreak/dist/module.js +0 -1340
  389. package/dist/esm/node_modules/linebreak/node_modules/base64-js/lib/b64.js +0 -137
  390. package/dist/esm/node_modules/media-engine/src/index.js +0 -26
  391. package/dist/esm/node_modules/media-engine/src/operators.js +0 -36
  392. package/dist/esm/node_modules/media-engine/src/parser.js +0 -147
  393. package/dist/esm/node_modules/media-engine/src/queries.js +0 -64
  394. package/dist/esm/node_modules/normalize-svg-path/index.js +0 -126
  395. package/dist/esm/node_modules/pako/lib/utils/common.js +0 -114
  396. package/dist/esm/node_modules/pako/lib/zlib/adler32.js +0 -57
  397. package/dist/esm/node_modules/pako/lib/zlib/constants.js +0 -78
  398. package/dist/esm/node_modules/pako/lib/zlib/crc32.js +0 -65
  399. package/dist/esm/node_modules/pako/lib/zlib/deflate.js +0 -1880
  400. package/dist/esm/node_modules/pako/lib/zlib/inffast.js +0 -351
  401. package/dist/esm/node_modules/pako/lib/zlib/inflate.js +0 -1557
  402. package/dist/esm/node_modules/pako/lib/zlib/inftrees.js +0 -352
  403. package/dist/esm/node_modules/pako/lib/zlib/messages.js +0 -38
  404. package/dist/esm/node_modules/pako/lib/zlib/trees.js +0 -1232
  405. package/dist/esm/node_modules/pako/lib/zlib/zstream.js +0 -57
  406. package/dist/esm/node_modules/parse-svg-path/index.js +0 -68
  407. package/dist/esm/node_modules/postcss-value-parser/lib/parse.js +0 -333
  408. package/dist/esm/node_modules/postcss-value-parser/lib/unit.js +0 -132
  409. package/dist/esm/node_modules/queue/index.js +0 -211
  410. package/dist/esm/node_modules/restructure/src/Array.js +0 -112
  411. package/dist/esm/node_modules/restructure/src/Base.js +0 -25
  412. package/dist/esm/node_modules/restructure/src/Bitfield.js +0 -47
  413. package/dist/esm/node_modules/restructure/src/Buffer.js +0 -44
  414. package/dist/esm/node_modules/restructure/src/DecodeStream.js +0 -93
  415. package/dist/esm/node_modules/restructure/src/EncodeStream.js +0 -137
  416. package/dist/esm/node_modules/restructure/src/LazyArray.js +0 -82
  417. package/dist/esm/node_modules/restructure/src/Number.js +0 -80
  418. package/dist/esm/node_modules/restructure/src/Optional.js +0 -52
  419. package/dist/esm/node_modules/restructure/src/Pointer.js +0 -175
  420. package/dist/esm/node_modules/restructure/src/Reserved.js +0 -31
  421. package/dist/esm/node_modules/restructure/src/String.js +0 -161
  422. package/dist/esm/node_modules/restructure/src/Struct.js +0 -121
  423. package/dist/esm/node_modules/restructure/src/VersionedStruct.js +0 -147
  424. package/dist/esm/node_modules/restructure/src/utils.js +0 -42
  425. package/dist/esm/node_modules/scheduler/cjs/scheduler.development.js +0 -382
  426. package/dist/esm/node_modules/scheduler/cjs/scheduler.production.js +0 -359
  427. package/dist/esm/node_modules/scheduler/index.js +0 -21
  428. package/dist/esm/node_modules/simple-swizzle/index.js +0 -40
  429. package/dist/esm/node_modules/simple-swizzle/node_modules/is-arrayish/index.js +0 -17
  430. package/dist/esm/node_modules/svg-arc-to-cubic-bezier/modules/index.js +0 -189
  431. package/dist/esm/node_modules/tiny-inflate/index.js +0 -387
  432. package/dist/esm/node_modules/tslib/tslib.es6.js +0 -36
  433. package/dist/esm/node_modules/unicode-properties/dist/module.js +0 -132
  434. package/dist/esm/node_modules/unicode-trie/index.js +0 -150
  435. package/dist/esm/node_modules/unicode-trie/swap.js +0 -33
  436. package/dist/esm/node_modules/yoga-layout/dist/binaries/yoga-wasm-base64-esm.js +0 -81
  437. package/dist/esm/node_modules/yoga-layout/dist/src/generated/YGEnums.js +0 -217
  438. package/dist/esm/node_modules/yoga-layout/dist/src/load.js +0 -24
  439. package/dist/esm/node_modules/yoga-layout/dist/src/wrapAssembly.js +0 -130
  440. package/dist/esm/src/components/e-commerce/invoice/InvoicePDF.js +0 -181
@@ -1,2217 +0,0 @@
1
- /*
2
- * UMWD-Components
3
- * @copyright Jelle Paulus
4
- * @license MIT
5
- */
6
-
7
- import PNG$1 from '../../png-js/lib/png-js.browser.js';
8
- import _JPEG from '../../../jay-peg/src/index.js';
9
-
10
- var global$1 = (typeof global !== "undefined" ? global :
11
- typeof self !== "undefined" ? self :
12
- typeof window !== "undefined" ? window : {});
13
-
14
- var lookup = [];
15
- var revLookup = [];
16
- var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
17
- var inited = false;
18
- function init () {
19
- inited = true;
20
- var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
21
- for (var i = 0, len = code.length; i < len; ++i) {
22
- lookup[i] = code[i];
23
- revLookup[code.charCodeAt(i)] = i;
24
- }
25
-
26
- revLookup['-'.charCodeAt(0)] = 62;
27
- revLookup['_'.charCodeAt(0)] = 63;
28
- }
29
-
30
- function toByteArray (b64) {
31
- if (!inited) {
32
- init();
33
- }
34
- var i, j, l, tmp, placeHolders, arr;
35
- var len = b64.length;
36
-
37
- if (len % 4 > 0) {
38
- throw new Error('Invalid string. Length must be a multiple of 4')
39
- }
40
-
41
- // the number of equal signs (place holders)
42
- // if there are two placeholders, than the two characters before it
43
- // represent one byte
44
- // if there is only one, then the three characters before it represent 2 bytes
45
- // this is just a cheap hack to not do indexOf twice
46
- placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0;
47
-
48
- // base64 is 4/3 + up to two characters of the original data
49
- arr = new Arr(len * 3 / 4 - placeHolders);
50
-
51
- // if there are placeholders, only get up to the last complete 4 chars
52
- l = placeHolders > 0 ? len - 4 : len;
53
-
54
- var L = 0;
55
-
56
- for (i = 0, j = 0; i < l; i += 4, j += 3) {
57
- tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)];
58
- arr[L++] = (tmp >> 16) & 0xFF;
59
- arr[L++] = (tmp >> 8) & 0xFF;
60
- arr[L++] = tmp & 0xFF;
61
- }
62
-
63
- if (placeHolders === 2) {
64
- tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4);
65
- arr[L++] = tmp & 0xFF;
66
- } else if (placeHolders === 1) {
67
- tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2);
68
- arr[L++] = (tmp >> 8) & 0xFF;
69
- arr[L++] = tmp & 0xFF;
70
- }
71
-
72
- return arr
73
- }
74
-
75
- function tripletToBase64 (num) {
76
- return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
77
- }
78
-
79
- function encodeChunk (uint8, start, end) {
80
- var tmp;
81
- var output = [];
82
- for (var i = start; i < end; i += 3) {
83
- tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]);
84
- output.push(tripletToBase64(tmp));
85
- }
86
- return output.join('')
87
- }
88
-
89
- function fromByteArray (uint8) {
90
- if (!inited) {
91
- init();
92
- }
93
- var tmp;
94
- var len = uint8.length;
95
- var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
96
- var output = '';
97
- var parts = [];
98
- var maxChunkLength = 16383; // must be multiple of 3
99
-
100
- // go through the array every three bytes, we'll deal with trailing stuff later
101
- for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
102
- parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)));
103
- }
104
-
105
- // pad the end with zeros, but make sure to not forget the extra bytes
106
- if (extraBytes === 1) {
107
- tmp = uint8[len - 1];
108
- output += lookup[tmp >> 2];
109
- output += lookup[(tmp << 4) & 0x3F];
110
- output += '==';
111
- } else if (extraBytes === 2) {
112
- tmp = (uint8[len - 2] << 8) + (uint8[len - 1]);
113
- output += lookup[tmp >> 10];
114
- output += lookup[(tmp >> 4) & 0x3F];
115
- output += lookup[(tmp << 2) & 0x3F];
116
- output += '=';
117
- }
118
-
119
- parts.push(output);
120
-
121
- return parts.join('')
122
- }
123
-
124
- function read (buffer, offset, isLE, mLen, nBytes) {
125
- var e, m;
126
- var eLen = nBytes * 8 - mLen - 1;
127
- var eMax = (1 << eLen) - 1;
128
- var eBias = eMax >> 1;
129
- var nBits = -7;
130
- var i = isLE ? (nBytes - 1) : 0;
131
- var d = isLE ? -1 : 1;
132
- var s = buffer[offset + i];
133
-
134
- i += d;
135
-
136
- e = s & ((1 << (-nBits)) - 1);
137
- s >>= (-nBits);
138
- nBits += eLen;
139
- for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
140
-
141
- m = e & ((1 << (-nBits)) - 1);
142
- e >>= (-nBits);
143
- nBits += mLen;
144
- for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
145
-
146
- if (e === 0) {
147
- e = 1 - eBias;
148
- } else if (e === eMax) {
149
- return m ? NaN : ((s ? -1 : 1) * Infinity)
150
- } else {
151
- m = m + Math.pow(2, mLen);
152
- e = e - eBias;
153
- }
154
- return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
155
- }
156
-
157
- function write (buffer, value, offset, isLE, mLen, nBytes) {
158
- var e, m, c;
159
- var eLen = nBytes * 8 - mLen - 1;
160
- var eMax = (1 << eLen) - 1;
161
- var eBias = eMax >> 1;
162
- var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0);
163
- var i = isLE ? 0 : (nBytes - 1);
164
- var d = isLE ? 1 : -1;
165
- var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
166
-
167
- value = Math.abs(value);
168
-
169
- if (isNaN(value) || value === Infinity) {
170
- m = isNaN(value) ? 1 : 0;
171
- e = eMax;
172
- } else {
173
- e = Math.floor(Math.log(value) / Math.LN2);
174
- if (value * (c = Math.pow(2, -e)) < 1) {
175
- e--;
176
- c *= 2;
177
- }
178
- if (e + eBias >= 1) {
179
- value += rt / c;
180
- } else {
181
- value += rt * Math.pow(2, 1 - eBias);
182
- }
183
- if (value * c >= 2) {
184
- e++;
185
- c /= 2;
186
- }
187
-
188
- if (e + eBias >= eMax) {
189
- m = 0;
190
- e = eMax;
191
- } else if (e + eBias >= 1) {
192
- m = (value * c - 1) * Math.pow(2, mLen);
193
- e = e + eBias;
194
- } else {
195
- m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
196
- e = 0;
197
- }
198
- }
199
-
200
- for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
201
-
202
- e = (e << mLen) | m;
203
- eLen += mLen;
204
- for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
205
-
206
- buffer[offset + i - d] |= s * 128;
207
- }
208
-
209
- var toString = {}.toString;
210
-
211
- var isArray = Array.isArray || function (arr) {
212
- return toString.call(arr) == '[object Array]';
213
- };
214
-
215
- /*!
216
- * The buffer module from node.js, for the browser.
217
- *
218
- * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
219
- * @license MIT
220
- */
221
- /* eslint-disable no-proto */
222
-
223
-
224
- var INSPECT_MAX_BYTES = 50;
225
-
226
- /**
227
- * If `Buffer.TYPED_ARRAY_SUPPORT`:
228
- * === true Use Uint8Array implementation (fastest)
229
- * === false Use Object implementation (most compatible, even IE6)
230
- *
231
- * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
232
- * Opera 11.6+, iOS 4.2+.
233
- *
234
- * Due to various browser bugs, sometimes the Object implementation will be used even
235
- * when the browser supports typed arrays.
236
- *
237
- * Note:
238
- *
239
- * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
240
- * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
241
- *
242
- * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
243
- *
244
- * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
245
- * incorrect length in some situations.
246
-
247
- * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
248
- * get the Object implementation, which is slower but behaves correctly.
249
- */
250
- Buffer.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined
251
- ? global$1.TYPED_ARRAY_SUPPORT
252
- : true;
253
-
254
- /*
255
- * Export kMaxLength after typed array support is determined.
256
- */
257
- kMaxLength();
258
-
259
- function kMaxLength () {
260
- return Buffer.TYPED_ARRAY_SUPPORT
261
- ? 0x7fffffff
262
- : 0x3fffffff
263
- }
264
-
265
- function createBuffer (that, length) {
266
- if (kMaxLength() < length) {
267
- throw new RangeError('Invalid typed array length')
268
- }
269
- if (Buffer.TYPED_ARRAY_SUPPORT) {
270
- // Return an augmented `Uint8Array` instance, for best performance
271
- that = new Uint8Array(length);
272
- that.__proto__ = Buffer.prototype;
273
- } else {
274
- // Fallback: Return an object instance of the Buffer class
275
- if (that === null) {
276
- that = new Buffer(length);
277
- }
278
- that.length = length;
279
- }
280
-
281
- return that
282
- }
283
-
284
- /**
285
- * The Buffer constructor returns instances of `Uint8Array` that have their
286
- * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
287
- * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
288
- * and the `Uint8Array` methods. Square bracket notation works as expected -- it
289
- * returns a single octet.
290
- *
291
- * The `Uint8Array` prototype remains unmodified.
292
- */
293
-
294
- function Buffer (arg, encodingOrOffset, length) {
295
- if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
296
- return new Buffer(arg, encodingOrOffset, length)
297
- }
298
-
299
- // Common case.
300
- if (typeof arg === 'number') {
301
- if (typeof encodingOrOffset === 'string') {
302
- throw new Error(
303
- 'If encoding is specified then the first argument must be a string'
304
- )
305
- }
306
- return allocUnsafe(this, arg)
307
- }
308
- return from(this, arg, encodingOrOffset, length)
309
- }
310
-
311
- Buffer.poolSize = 8192; // not used by this implementation
312
-
313
- // TODO: Legacy, not needed anymore. Remove in next major version.
314
- Buffer._augment = function (arr) {
315
- arr.__proto__ = Buffer.prototype;
316
- return arr
317
- };
318
-
319
- function from (that, value, encodingOrOffset, length) {
320
- if (typeof value === 'number') {
321
- throw new TypeError('"value" argument must not be a number')
322
- }
323
-
324
- if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
325
- return fromArrayBuffer(that, value, encodingOrOffset, length)
326
- }
327
-
328
- if (typeof value === 'string') {
329
- return fromString(that, value, encodingOrOffset)
330
- }
331
-
332
- return fromObject(that, value)
333
- }
334
-
335
- /**
336
- * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
337
- * if value is a number.
338
- * Buffer.from(str[, encoding])
339
- * Buffer.from(array)
340
- * Buffer.from(buffer)
341
- * Buffer.from(arrayBuffer[, byteOffset[, length]])
342
- **/
343
- Buffer.from = function (value, encodingOrOffset, length) {
344
- return from(null, value, encodingOrOffset, length)
345
- };
346
-
347
- if (Buffer.TYPED_ARRAY_SUPPORT) {
348
- Buffer.prototype.__proto__ = Uint8Array.prototype;
349
- Buffer.__proto__ = Uint8Array;
350
- if (typeof Symbol !== 'undefined' && Symbol.species &&
351
- Buffer[Symbol.species] === Buffer) ;
352
- }
353
-
354
- function assertSize (size) {
355
- if (typeof size !== 'number') {
356
- throw new TypeError('"size" argument must be a number')
357
- } else if (size < 0) {
358
- throw new RangeError('"size" argument must not be negative')
359
- }
360
- }
361
-
362
- function alloc (that, size, fill, encoding) {
363
- assertSize(size);
364
- if (size <= 0) {
365
- return createBuffer(that, size)
366
- }
367
- if (fill !== undefined) {
368
- // Only pay attention to encoding if it's a string. This
369
- // prevents accidentally sending in a number that would
370
- // be interpretted as a start offset.
371
- return typeof encoding === 'string'
372
- ? createBuffer(that, size).fill(fill, encoding)
373
- : createBuffer(that, size).fill(fill)
374
- }
375
- return createBuffer(that, size)
376
- }
377
-
378
- /**
379
- * Creates a new filled Buffer instance.
380
- * alloc(size[, fill[, encoding]])
381
- **/
382
- Buffer.alloc = function (size, fill, encoding) {
383
- return alloc(null, size, fill, encoding)
384
- };
385
-
386
- function allocUnsafe (that, size) {
387
- assertSize(size);
388
- that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
389
- if (!Buffer.TYPED_ARRAY_SUPPORT) {
390
- for (var i = 0; i < size; ++i) {
391
- that[i] = 0;
392
- }
393
- }
394
- return that
395
- }
396
-
397
- /**
398
- * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
399
- * */
400
- Buffer.allocUnsafe = function (size) {
401
- return allocUnsafe(null, size)
402
- };
403
- /**
404
- * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
405
- */
406
- Buffer.allocUnsafeSlow = function (size) {
407
- return allocUnsafe(null, size)
408
- };
409
-
410
- function fromString (that, string, encoding) {
411
- if (typeof encoding !== 'string' || encoding === '') {
412
- encoding = 'utf8';
413
- }
414
-
415
- if (!Buffer.isEncoding(encoding)) {
416
- throw new TypeError('"encoding" must be a valid string encoding')
417
- }
418
-
419
- var length = byteLength(string, encoding) | 0;
420
- that = createBuffer(that, length);
421
-
422
- var actual = that.write(string, encoding);
423
-
424
- if (actual !== length) {
425
- // Writing a hex string, for example, that contains invalid characters will
426
- // cause everything after the first invalid character to be ignored. (e.g.
427
- // 'abxxcd' will be treated as 'ab')
428
- that = that.slice(0, actual);
429
- }
430
-
431
- return that
432
- }
433
-
434
- function fromArrayLike (that, array) {
435
- var length = array.length < 0 ? 0 : checked(array.length) | 0;
436
- that = createBuffer(that, length);
437
- for (var i = 0; i < length; i += 1) {
438
- that[i] = array[i] & 255;
439
- }
440
- return that
441
- }
442
-
443
- function fromArrayBuffer (that, array, byteOffset, length) {
444
- array.byteLength; // this throws if `array` is not a valid ArrayBuffer
445
-
446
- if (byteOffset < 0 || array.byteLength < byteOffset) {
447
- throw new RangeError('\'offset\' is out of bounds')
448
- }
449
-
450
- if (array.byteLength < byteOffset + (length || 0)) {
451
- throw new RangeError('\'length\' is out of bounds')
452
- }
453
-
454
- if (byteOffset === undefined && length === undefined) {
455
- array = new Uint8Array(array);
456
- } else if (length === undefined) {
457
- array = new Uint8Array(array, byteOffset);
458
- } else {
459
- array = new Uint8Array(array, byteOffset, length);
460
- }
461
-
462
- if (Buffer.TYPED_ARRAY_SUPPORT) {
463
- // Return an augmented `Uint8Array` instance, for best performance
464
- that = array;
465
- that.__proto__ = Buffer.prototype;
466
- } else {
467
- // Fallback: Return an object instance of the Buffer class
468
- that = fromArrayLike(that, array);
469
- }
470
- return that
471
- }
472
-
473
- function fromObject (that, obj) {
474
- if (internalIsBuffer(obj)) {
475
- var len = checked(obj.length) | 0;
476
- that = createBuffer(that, len);
477
-
478
- if (that.length === 0) {
479
- return that
480
- }
481
-
482
- obj.copy(that, 0, 0, len);
483
- return that
484
- }
485
-
486
- if (obj) {
487
- if ((typeof ArrayBuffer !== 'undefined' &&
488
- obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
489
- if (typeof obj.length !== 'number' || isnan(obj.length)) {
490
- return createBuffer(that, 0)
491
- }
492
- return fromArrayLike(that, obj)
493
- }
494
-
495
- if (obj.type === 'Buffer' && isArray(obj.data)) {
496
- return fromArrayLike(that, obj.data)
497
- }
498
- }
499
-
500
- throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
501
- }
502
-
503
- function checked (length) {
504
- // Note: cannot use `length < kMaxLength()` here because that fails when
505
- // length is NaN (which is otherwise coerced to zero.)
506
- if (length >= kMaxLength()) {
507
- throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
508
- 'size: 0x' + kMaxLength().toString(16) + ' bytes')
509
- }
510
- return length | 0
511
- }
512
- Buffer.isBuffer = isBuffer$1;
513
- function internalIsBuffer (b) {
514
- return !!(b != null && b._isBuffer)
515
- }
516
-
517
- Buffer.compare = function compare (a, b) {
518
- if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
519
- throw new TypeError('Arguments must be Buffers')
520
- }
521
-
522
- if (a === b) return 0
523
-
524
- var x = a.length;
525
- var y = b.length;
526
-
527
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
528
- if (a[i] !== b[i]) {
529
- x = a[i];
530
- y = b[i];
531
- break
532
- }
533
- }
534
-
535
- if (x < y) return -1
536
- if (y < x) return 1
537
- return 0
538
- };
539
-
540
- Buffer.isEncoding = function isEncoding (encoding) {
541
- switch (String(encoding).toLowerCase()) {
542
- case 'hex':
543
- case 'utf8':
544
- case 'utf-8':
545
- case 'ascii':
546
- case 'latin1':
547
- case 'binary':
548
- case 'base64':
549
- case 'ucs2':
550
- case 'ucs-2':
551
- case 'utf16le':
552
- case 'utf-16le':
553
- return true
554
- default:
555
- return false
556
- }
557
- };
558
-
559
- Buffer.concat = function concat (list, length) {
560
- if (!isArray(list)) {
561
- throw new TypeError('"list" argument must be an Array of Buffers')
562
- }
563
-
564
- if (list.length === 0) {
565
- return Buffer.alloc(0)
566
- }
567
-
568
- var i;
569
- if (length === undefined) {
570
- length = 0;
571
- for (i = 0; i < list.length; ++i) {
572
- length += list[i].length;
573
- }
574
- }
575
-
576
- var buffer = Buffer.allocUnsafe(length);
577
- var pos = 0;
578
- for (i = 0; i < list.length; ++i) {
579
- var buf = list[i];
580
- if (!internalIsBuffer(buf)) {
581
- throw new TypeError('"list" argument must be an Array of Buffers')
582
- }
583
- buf.copy(buffer, pos);
584
- pos += buf.length;
585
- }
586
- return buffer
587
- };
588
-
589
- function byteLength (string, encoding) {
590
- if (internalIsBuffer(string)) {
591
- return string.length
592
- }
593
- if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
594
- (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
595
- return string.byteLength
596
- }
597
- if (typeof string !== 'string') {
598
- string = '' + string;
599
- }
600
-
601
- var len = string.length;
602
- if (len === 0) return 0
603
-
604
- // Use a for loop to avoid recursion
605
- var loweredCase = false;
606
- for (;;) {
607
- switch (encoding) {
608
- case 'ascii':
609
- case 'latin1':
610
- case 'binary':
611
- return len
612
- case 'utf8':
613
- case 'utf-8':
614
- case undefined:
615
- return utf8ToBytes(string).length
616
- case 'ucs2':
617
- case 'ucs-2':
618
- case 'utf16le':
619
- case 'utf-16le':
620
- return len * 2
621
- case 'hex':
622
- return len >>> 1
623
- case 'base64':
624
- return base64ToBytes(string).length
625
- default:
626
- if (loweredCase) return utf8ToBytes(string).length // assume utf8
627
- encoding = ('' + encoding).toLowerCase();
628
- loweredCase = true;
629
- }
630
- }
631
- }
632
- Buffer.byteLength = byteLength;
633
-
634
- function slowToString (encoding, start, end) {
635
- var loweredCase = false;
636
-
637
- // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
638
- // property of a typed array.
639
-
640
- // This behaves neither like String nor Uint8Array in that we set start/end
641
- // to their upper/lower bounds if the value passed is out of range.
642
- // undefined is handled specially as per ECMA-262 6th Edition,
643
- // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
644
- if (start === undefined || start < 0) {
645
- start = 0;
646
- }
647
- // Return early if start > this.length. Done here to prevent potential uint32
648
- // coercion fail below.
649
- if (start > this.length) {
650
- return ''
651
- }
652
-
653
- if (end === undefined || end > this.length) {
654
- end = this.length;
655
- }
656
-
657
- if (end <= 0) {
658
- return ''
659
- }
660
-
661
- // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
662
- end >>>= 0;
663
- start >>>= 0;
664
-
665
- if (end <= start) {
666
- return ''
667
- }
668
-
669
- if (!encoding) encoding = 'utf8';
670
-
671
- while (true) {
672
- switch (encoding) {
673
- case 'hex':
674
- return hexSlice(this, start, end)
675
-
676
- case 'utf8':
677
- case 'utf-8':
678
- return utf8Slice(this, start, end)
679
-
680
- case 'ascii':
681
- return asciiSlice(this, start, end)
682
-
683
- case 'latin1':
684
- case 'binary':
685
- return latin1Slice(this, start, end)
686
-
687
- case 'base64':
688
- return base64Slice(this, start, end)
689
-
690
- case 'ucs2':
691
- case 'ucs-2':
692
- case 'utf16le':
693
- case 'utf-16le':
694
- return utf16leSlice(this, start, end)
695
-
696
- default:
697
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
698
- encoding = (encoding + '').toLowerCase();
699
- loweredCase = true;
700
- }
701
- }
702
- }
703
-
704
- // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
705
- // Buffer instances.
706
- Buffer.prototype._isBuffer = true;
707
-
708
- function swap (b, n, m) {
709
- var i = b[n];
710
- b[n] = b[m];
711
- b[m] = i;
712
- }
713
-
714
- Buffer.prototype.swap16 = function swap16 () {
715
- var len = this.length;
716
- if (len % 2 !== 0) {
717
- throw new RangeError('Buffer size must be a multiple of 16-bits')
718
- }
719
- for (var i = 0; i < len; i += 2) {
720
- swap(this, i, i + 1);
721
- }
722
- return this
723
- };
724
-
725
- Buffer.prototype.swap32 = function swap32 () {
726
- var len = this.length;
727
- if (len % 4 !== 0) {
728
- throw new RangeError('Buffer size must be a multiple of 32-bits')
729
- }
730
- for (var i = 0; i < len; i += 4) {
731
- swap(this, i, i + 3);
732
- swap(this, i + 1, i + 2);
733
- }
734
- return this
735
- };
736
-
737
- Buffer.prototype.swap64 = function swap64 () {
738
- var len = this.length;
739
- if (len % 8 !== 0) {
740
- throw new RangeError('Buffer size must be a multiple of 64-bits')
741
- }
742
- for (var i = 0; i < len; i += 8) {
743
- swap(this, i, i + 7);
744
- swap(this, i + 1, i + 6);
745
- swap(this, i + 2, i + 5);
746
- swap(this, i + 3, i + 4);
747
- }
748
- return this
749
- };
750
-
751
- Buffer.prototype.toString = function toString () {
752
- var length = this.length | 0;
753
- if (length === 0) return ''
754
- if (arguments.length === 0) return utf8Slice(this, 0, length)
755
- return slowToString.apply(this, arguments)
756
- };
757
-
758
- Buffer.prototype.equals = function equals (b) {
759
- if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer')
760
- if (this === b) return true
761
- return Buffer.compare(this, b) === 0
762
- };
763
-
764
- Buffer.prototype.inspect = function inspect () {
765
- var str = '';
766
- var max = INSPECT_MAX_BYTES;
767
- if (this.length > 0) {
768
- str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
769
- if (this.length > max) str += ' ... ';
770
- }
771
- return '<Buffer ' + str + '>'
772
- };
773
-
774
- Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
775
- if (!internalIsBuffer(target)) {
776
- throw new TypeError('Argument must be a Buffer')
777
- }
778
-
779
- if (start === undefined) {
780
- start = 0;
781
- }
782
- if (end === undefined) {
783
- end = target ? target.length : 0;
784
- }
785
- if (thisStart === undefined) {
786
- thisStart = 0;
787
- }
788
- if (thisEnd === undefined) {
789
- thisEnd = this.length;
790
- }
791
-
792
- if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
793
- throw new RangeError('out of range index')
794
- }
795
-
796
- if (thisStart >= thisEnd && start >= end) {
797
- return 0
798
- }
799
- if (thisStart >= thisEnd) {
800
- return -1
801
- }
802
- if (start >= end) {
803
- return 1
804
- }
805
-
806
- start >>>= 0;
807
- end >>>= 0;
808
- thisStart >>>= 0;
809
- thisEnd >>>= 0;
810
-
811
- if (this === target) return 0
812
-
813
- var x = thisEnd - thisStart;
814
- var y = end - start;
815
- var len = Math.min(x, y);
816
-
817
- var thisCopy = this.slice(thisStart, thisEnd);
818
- var targetCopy = target.slice(start, end);
819
-
820
- for (var i = 0; i < len; ++i) {
821
- if (thisCopy[i] !== targetCopy[i]) {
822
- x = thisCopy[i];
823
- y = targetCopy[i];
824
- break
825
- }
826
- }
827
-
828
- if (x < y) return -1
829
- if (y < x) return 1
830
- return 0
831
- };
832
-
833
- // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
834
- // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
835
- //
836
- // Arguments:
837
- // - buffer - a Buffer to search
838
- // - val - a string, Buffer, or number
839
- // - byteOffset - an index into `buffer`; will be clamped to an int32
840
- // - encoding - an optional encoding, relevant is val is a string
841
- // - dir - true for indexOf, false for lastIndexOf
842
- function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
843
- // Empty buffer means no match
844
- if (buffer.length === 0) return -1
845
-
846
- // Normalize byteOffset
847
- if (typeof byteOffset === 'string') {
848
- encoding = byteOffset;
849
- byteOffset = 0;
850
- } else if (byteOffset > 0x7fffffff) {
851
- byteOffset = 0x7fffffff;
852
- } else if (byteOffset < -2147483648) {
853
- byteOffset = -2147483648;
854
- }
855
- byteOffset = +byteOffset; // Coerce to Number.
856
- if (isNaN(byteOffset)) {
857
- // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
858
- byteOffset = dir ? 0 : (buffer.length - 1);
859
- }
860
-
861
- // Normalize byteOffset: negative offsets start from the end of the buffer
862
- if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
863
- if (byteOffset >= buffer.length) {
864
- if (dir) return -1
865
- else byteOffset = buffer.length - 1;
866
- } else if (byteOffset < 0) {
867
- if (dir) byteOffset = 0;
868
- else return -1
869
- }
870
-
871
- // Normalize val
872
- if (typeof val === 'string') {
873
- val = Buffer.from(val, encoding);
874
- }
875
-
876
- // Finally, search either indexOf (if dir is true) or lastIndexOf
877
- if (internalIsBuffer(val)) {
878
- // Special case: looking for empty string/buffer always fails
879
- if (val.length === 0) {
880
- return -1
881
- }
882
- return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
883
- } else if (typeof val === 'number') {
884
- val = val & 0xFF; // Search for a byte value [0-255]
885
- if (Buffer.TYPED_ARRAY_SUPPORT &&
886
- typeof Uint8Array.prototype.indexOf === 'function') {
887
- if (dir) {
888
- return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
889
- } else {
890
- return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
891
- }
892
- }
893
- return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
894
- }
895
-
896
- throw new TypeError('val must be string, number or Buffer')
897
- }
898
-
899
- function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
900
- var indexSize = 1;
901
- var arrLength = arr.length;
902
- var valLength = val.length;
903
-
904
- if (encoding !== undefined) {
905
- encoding = String(encoding).toLowerCase();
906
- if (encoding === 'ucs2' || encoding === 'ucs-2' ||
907
- encoding === 'utf16le' || encoding === 'utf-16le') {
908
- if (arr.length < 2 || val.length < 2) {
909
- return -1
910
- }
911
- indexSize = 2;
912
- arrLength /= 2;
913
- valLength /= 2;
914
- byteOffset /= 2;
915
- }
916
- }
917
-
918
- function read (buf, i) {
919
- if (indexSize === 1) {
920
- return buf[i]
921
- } else {
922
- return buf.readUInt16BE(i * indexSize)
923
- }
924
- }
925
-
926
- var i;
927
- if (dir) {
928
- var foundIndex = -1;
929
- for (i = byteOffset; i < arrLength; i++) {
930
- if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
931
- if (foundIndex === -1) foundIndex = i;
932
- if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
933
- } else {
934
- if (foundIndex !== -1) i -= i - foundIndex;
935
- foundIndex = -1;
936
- }
937
- }
938
- } else {
939
- if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
940
- for (i = byteOffset; i >= 0; i--) {
941
- var found = true;
942
- for (var j = 0; j < valLength; j++) {
943
- if (read(arr, i + j) !== read(val, j)) {
944
- found = false;
945
- break
946
- }
947
- }
948
- if (found) return i
949
- }
950
- }
951
-
952
- return -1
953
- }
954
-
955
- Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
956
- return this.indexOf(val, byteOffset, encoding) !== -1
957
- };
958
-
959
- Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
960
- return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
961
- };
962
-
963
- Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
964
- return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
965
- };
966
-
967
- function hexWrite (buf, string, offset, length) {
968
- offset = Number(offset) || 0;
969
- var remaining = buf.length - offset;
970
- if (!length) {
971
- length = remaining;
972
- } else {
973
- length = Number(length);
974
- if (length > remaining) {
975
- length = remaining;
976
- }
977
- }
978
-
979
- // must be an even number of digits
980
- var strLen = string.length;
981
- if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
982
-
983
- if (length > strLen / 2) {
984
- length = strLen / 2;
985
- }
986
- for (var i = 0; i < length; ++i) {
987
- var parsed = parseInt(string.substr(i * 2, 2), 16);
988
- if (isNaN(parsed)) return i
989
- buf[offset + i] = parsed;
990
- }
991
- return i
992
- }
993
-
994
- function utf8Write (buf, string, offset, length) {
995
- return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
996
- }
997
-
998
- function asciiWrite (buf, string, offset, length) {
999
- return blitBuffer(asciiToBytes(string), buf, offset, length)
1000
- }
1001
-
1002
- function latin1Write (buf, string, offset, length) {
1003
- return asciiWrite(buf, string, offset, length)
1004
- }
1005
-
1006
- function base64Write (buf, string, offset, length) {
1007
- return blitBuffer(base64ToBytes(string), buf, offset, length)
1008
- }
1009
-
1010
- function ucs2Write (buf, string, offset, length) {
1011
- return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
1012
- }
1013
-
1014
- Buffer.prototype.write = function write (string, offset, length, encoding) {
1015
- // Buffer#write(string)
1016
- if (offset === undefined) {
1017
- encoding = 'utf8';
1018
- length = this.length;
1019
- offset = 0;
1020
- // Buffer#write(string, encoding)
1021
- } else if (length === undefined && typeof offset === 'string') {
1022
- encoding = offset;
1023
- length = this.length;
1024
- offset = 0;
1025
- // Buffer#write(string, offset[, length][, encoding])
1026
- } else if (isFinite(offset)) {
1027
- offset = offset | 0;
1028
- if (isFinite(length)) {
1029
- length = length | 0;
1030
- if (encoding === undefined) encoding = 'utf8';
1031
- } else {
1032
- encoding = length;
1033
- length = undefined;
1034
- }
1035
- // legacy write(string, encoding, offset, length) - remove in v0.13
1036
- } else {
1037
- throw new Error(
1038
- 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
1039
- )
1040
- }
1041
-
1042
- var remaining = this.length - offset;
1043
- if (length === undefined || length > remaining) length = remaining;
1044
-
1045
- if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
1046
- throw new RangeError('Attempt to write outside buffer bounds')
1047
- }
1048
-
1049
- if (!encoding) encoding = 'utf8';
1050
-
1051
- var loweredCase = false;
1052
- for (;;) {
1053
- switch (encoding) {
1054
- case 'hex':
1055
- return hexWrite(this, string, offset, length)
1056
-
1057
- case 'utf8':
1058
- case 'utf-8':
1059
- return utf8Write(this, string, offset, length)
1060
-
1061
- case 'ascii':
1062
- return asciiWrite(this, string, offset, length)
1063
-
1064
- case 'latin1':
1065
- case 'binary':
1066
- return latin1Write(this, string, offset, length)
1067
-
1068
- case 'base64':
1069
- // Warning: maxLength not taken into account in base64Write
1070
- return base64Write(this, string, offset, length)
1071
-
1072
- case 'ucs2':
1073
- case 'ucs-2':
1074
- case 'utf16le':
1075
- case 'utf-16le':
1076
- return ucs2Write(this, string, offset, length)
1077
-
1078
- default:
1079
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
1080
- encoding = ('' + encoding).toLowerCase();
1081
- loweredCase = true;
1082
- }
1083
- }
1084
- };
1085
-
1086
- Buffer.prototype.toJSON = function toJSON () {
1087
- return {
1088
- type: 'Buffer',
1089
- data: Array.prototype.slice.call(this._arr || this, 0)
1090
- }
1091
- };
1092
-
1093
- function base64Slice (buf, start, end) {
1094
- if (start === 0 && end === buf.length) {
1095
- return fromByteArray(buf)
1096
- } else {
1097
- return fromByteArray(buf.slice(start, end))
1098
- }
1099
- }
1100
-
1101
- function utf8Slice (buf, start, end) {
1102
- end = Math.min(buf.length, end);
1103
- var res = [];
1104
-
1105
- var i = start;
1106
- while (i < end) {
1107
- var firstByte = buf[i];
1108
- var codePoint = null;
1109
- var bytesPerSequence = (firstByte > 0xEF) ? 4
1110
- : (firstByte > 0xDF) ? 3
1111
- : (firstByte > 0xBF) ? 2
1112
- : 1;
1113
-
1114
- if (i + bytesPerSequence <= end) {
1115
- var secondByte, thirdByte, fourthByte, tempCodePoint;
1116
-
1117
- switch (bytesPerSequence) {
1118
- case 1:
1119
- if (firstByte < 0x80) {
1120
- codePoint = firstByte;
1121
- }
1122
- break
1123
- case 2:
1124
- secondByte = buf[i + 1];
1125
- if ((secondByte & 0xC0) === 0x80) {
1126
- tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);
1127
- if (tempCodePoint > 0x7F) {
1128
- codePoint = tempCodePoint;
1129
- }
1130
- }
1131
- break
1132
- case 3:
1133
- secondByte = buf[i + 1];
1134
- thirdByte = buf[i + 2];
1135
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
1136
- tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);
1137
- if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
1138
- codePoint = tempCodePoint;
1139
- }
1140
- }
1141
- break
1142
- case 4:
1143
- secondByte = buf[i + 1];
1144
- thirdByte = buf[i + 2];
1145
- fourthByte = buf[i + 3];
1146
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
1147
- tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);
1148
- if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
1149
- codePoint = tempCodePoint;
1150
- }
1151
- }
1152
- }
1153
- }
1154
-
1155
- if (codePoint === null) {
1156
- // we did not generate a valid codePoint so insert a
1157
- // replacement char (U+FFFD) and advance only 1 byte
1158
- codePoint = 0xFFFD;
1159
- bytesPerSequence = 1;
1160
- } else if (codePoint > 0xFFFF) {
1161
- // encode to utf16 (surrogate pair dance)
1162
- codePoint -= 0x10000;
1163
- res.push(codePoint >>> 10 & 0x3FF | 0xD800);
1164
- codePoint = 0xDC00 | codePoint & 0x3FF;
1165
- }
1166
-
1167
- res.push(codePoint);
1168
- i += bytesPerSequence;
1169
- }
1170
-
1171
- return decodeCodePointsArray(res)
1172
- }
1173
-
1174
- // Based on http://stackoverflow.com/a/22747272/680742, the browser with
1175
- // the lowest limit is Chrome, with 0x10000 args.
1176
- // We go 1 magnitude less, for safety
1177
- var MAX_ARGUMENTS_LENGTH = 0x1000;
1178
-
1179
- function decodeCodePointsArray (codePoints) {
1180
- var len = codePoints.length;
1181
- if (len <= MAX_ARGUMENTS_LENGTH) {
1182
- return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
1183
- }
1184
-
1185
- // Decode in chunks to avoid "call stack size exceeded".
1186
- var res = '';
1187
- var i = 0;
1188
- while (i < len) {
1189
- res += String.fromCharCode.apply(
1190
- String,
1191
- codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
1192
- );
1193
- }
1194
- return res
1195
- }
1196
-
1197
- function asciiSlice (buf, start, end) {
1198
- var ret = '';
1199
- end = Math.min(buf.length, end);
1200
-
1201
- for (var i = start; i < end; ++i) {
1202
- ret += String.fromCharCode(buf[i] & 0x7F);
1203
- }
1204
- return ret
1205
- }
1206
-
1207
- function latin1Slice (buf, start, end) {
1208
- var ret = '';
1209
- end = Math.min(buf.length, end);
1210
-
1211
- for (var i = start; i < end; ++i) {
1212
- ret += String.fromCharCode(buf[i]);
1213
- }
1214
- return ret
1215
- }
1216
-
1217
- function hexSlice (buf, start, end) {
1218
- var len = buf.length;
1219
-
1220
- if (!start || start < 0) start = 0;
1221
- if (!end || end < 0 || end > len) end = len;
1222
-
1223
- var out = '';
1224
- for (var i = start; i < end; ++i) {
1225
- out += toHex(buf[i]);
1226
- }
1227
- return out
1228
- }
1229
-
1230
- function utf16leSlice (buf, start, end) {
1231
- var bytes = buf.slice(start, end);
1232
- var res = '';
1233
- for (var i = 0; i < bytes.length; i += 2) {
1234
- res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
1235
- }
1236
- return res
1237
- }
1238
-
1239
- Buffer.prototype.slice = function slice (start, end) {
1240
- var len = this.length;
1241
- start = ~~start;
1242
- end = end === undefined ? len : ~~end;
1243
-
1244
- if (start < 0) {
1245
- start += len;
1246
- if (start < 0) start = 0;
1247
- } else if (start > len) {
1248
- start = len;
1249
- }
1250
-
1251
- if (end < 0) {
1252
- end += len;
1253
- if (end < 0) end = 0;
1254
- } else if (end > len) {
1255
- end = len;
1256
- }
1257
-
1258
- if (end < start) end = start;
1259
-
1260
- var newBuf;
1261
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1262
- newBuf = this.subarray(start, end);
1263
- newBuf.__proto__ = Buffer.prototype;
1264
- } else {
1265
- var sliceLen = end - start;
1266
- newBuf = new Buffer(sliceLen, undefined);
1267
- for (var i = 0; i < sliceLen; ++i) {
1268
- newBuf[i] = this[i + start];
1269
- }
1270
- }
1271
-
1272
- return newBuf
1273
- };
1274
-
1275
- /*
1276
- * Need to make sure that buffer isn't trying to write out of bounds.
1277
- */
1278
- function checkOffset (offset, ext, length) {
1279
- if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
1280
- if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
1281
- }
1282
-
1283
- Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
1284
- offset = offset | 0;
1285
- byteLength = byteLength | 0;
1286
- if (!noAssert) checkOffset(offset, byteLength, this.length);
1287
-
1288
- var val = this[offset];
1289
- var mul = 1;
1290
- var i = 0;
1291
- while (++i < byteLength && (mul *= 0x100)) {
1292
- val += this[offset + i] * mul;
1293
- }
1294
-
1295
- return val
1296
- };
1297
-
1298
- Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
1299
- offset = offset | 0;
1300
- byteLength = byteLength | 0;
1301
- if (!noAssert) {
1302
- checkOffset(offset, byteLength, this.length);
1303
- }
1304
-
1305
- var val = this[offset + --byteLength];
1306
- var mul = 1;
1307
- while (byteLength > 0 && (mul *= 0x100)) {
1308
- val += this[offset + --byteLength] * mul;
1309
- }
1310
-
1311
- return val
1312
- };
1313
-
1314
- Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
1315
- if (!noAssert) checkOffset(offset, 1, this.length);
1316
- return this[offset]
1317
- };
1318
-
1319
- Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
1320
- if (!noAssert) checkOffset(offset, 2, this.length);
1321
- return this[offset] | (this[offset + 1] << 8)
1322
- };
1323
-
1324
- Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
1325
- if (!noAssert) checkOffset(offset, 2, this.length);
1326
- return (this[offset] << 8) | this[offset + 1]
1327
- };
1328
-
1329
- Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
1330
- if (!noAssert) checkOffset(offset, 4, this.length);
1331
-
1332
- return ((this[offset]) |
1333
- (this[offset + 1] << 8) |
1334
- (this[offset + 2] << 16)) +
1335
- (this[offset + 3] * 0x1000000)
1336
- };
1337
-
1338
- Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
1339
- if (!noAssert) checkOffset(offset, 4, this.length);
1340
-
1341
- return (this[offset] * 0x1000000) +
1342
- ((this[offset + 1] << 16) |
1343
- (this[offset + 2] << 8) |
1344
- this[offset + 3])
1345
- };
1346
-
1347
- Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
1348
- offset = offset | 0;
1349
- byteLength = byteLength | 0;
1350
- if (!noAssert) checkOffset(offset, byteLength, this.length);
1351
-
1352
- var val = this[offset];
1353
- var mul = 1;
1354
- var i = 0;
1355
- while (++i < byteLength && (mul *= 0x100)) {
1356
- val += this[offset + i] * mul;
1357
- }
1358
- mul *= 0x80;
1359
-
1360
- if (val >= mul) val -= Math.pow(2, 8 * byteLength);
1361
-
1362
- return val
1363
- };
1364
-
1365
- Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
1366
- offset = offset | 0;
1367
- byteLength = byteLength | 0;
1368
- if (!noAssert) checkOffset(offset, byteLength, this.length);
1369
-
1370
- var i = byteLength;
1371
- var mul = 1;
1372
- var val = this[offset + --i];
1373
- while (i > 0 && (mul *= 0x100)) {
1374
- val += this[offset + --i] * mul;
1375
- }
1376
- mul *= 0x80;
1377
-
1378
- if (val >= mul) val -= Math.pow(2, 8 * byteLength);
1379
-
1380
- return val
1381
- };
1382
-
1383
- Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
1384
- if (!noAssert) checkOffset(offset, 1, this.length);
1385
- if (!(this[offset] & 0x80)) return (this[offset])
1386
- return ((0xff - this[offset] + 1) * -1)
1387
- };
1388
-
1389
- Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
1390
- if (!noAssert) checkOffset(offset, 2, this.length);
1391
- var val = this[offset] | (this[offset + 1] << 8);
1392
- return (val & 0x8000) ? val | 0xFFFF0000 : val
1393
- };
1394
-
1395
- Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
1396
- if (!noAssert) checkOffset(offset, 2, this.length);
1397
- var val = this[offset + 1] | (this[offset] << 8);
1398
- return (val & 0x8000) ? val | 0xFFFF0000 : val
1399
- };
1400
-
1401
- Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
1402
- if (!noAssert) checkOffset(offset, 4, this.length);
1403
-
1404
- return (this[offset]) |
1405
- (this[offset + 1] << 8) |
1406
- (this[offset + 2] << 16) |
1407
- (this[offset + 3] << 24)
1408
- };
1409
-
1410
- Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
1411
- if (!noAssert) checkOffset(offset, 4, this.length);
1412
-
1413
- return (this[offset] << 24) |
1414
- (this[offset + 1] << 16) |
1415
- (this[offset + 2] << 8) |
1416
- (this[offset + 3])
1417
- };
1418
-
1419
- Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
1420
- if (!noAssert) checkOffset(offset, 4, this.length);
1421
- return read(this, offset, true, 23, 4)
1422
- };
1423
-
1424
- Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
1425
- if (!noAssert) checkOffset(offset, 4, this.length);
1426
- return read(this, offset, false, 23, 4)
1427
- };
1428
-
1429
- Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
1430
- if (!noAssert) checkOffset(offset, 8, this.length);
1431
- return read(this, offset, true, 52, 8)
1432
- };
1433
-
1434
- Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
1435
- if (!noAssert) checkOffset(offset, 8, this.length);
1436
- return read(this, offset, false, 52, 8)
1437
- };
1438
-
1439
- function checkInt (buf, value, offset, ext, max, min) {
1440
- if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
1441
- if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
1442
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
1443
- }
1444
-
1445
- Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
1446
- value = +value;
1447
- offset = offset | 0;
1448
- byteLength = byteLength | 0;
1449
- if (!noAssert) {
1450
- var maxBytes = Math.pow(2, 8 * byteLength) - 1;
1451
- checkInt(this, value, offset, byteLength, maxBytes, 0);
1452
- }
1453
-
1454
- var mul = 1;
1455
- var i = 0;
1456
- this[offset] = value & 0xFF;
1457
- while (++i < byteLength && (mul *= 0x100)) {
1458
- this[offset + i] = (value / mul) & 0xFF;
1459
- }
1460
-
1461
- return offset + byteLength
1462
- };
1463
-
1464
- Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
1465
- value = +value;
1466
- offset = offset | 0;
1467
- byteLength = byteLength | 0;
1468
- if (!noAssert) {
1469
- var maxBytes = Math.pow(2, 8 * byteLength) - 1;
1470
- checkInt(this, value, offset, byteLength, maxBytes, 0);
1471
- }
1472
-
1473
- var i = byteLength - 1;
1474
- var mul = 1;
1475
- this[offset + i] = value & 0xFF;
1476
- while (--i >= 0 && (mul *= 0x100)) {
1477
- this[offset + i] = (value / mul) & 0xFF;
1478
- }
1479
-
1480
- return offset + byteLength
1481
- };
1482
-
1483
- Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
1484
- value = +value;
1485
- offset = offset | 0;
1486
- if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
1487
- if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
1488
- this[offset] = (value & 0xff);
1489
- return offset + 1
1490
- };
1491
-
1492
- function objectWriteUInt16 (buf, value, offset, littleEndian) {
1493
- if (value < 0) value = 0xffff + value + 1;
1494
- for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
1495
- buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
1496
- (littleEndian ? i : 1 - i) * 8;
1497
- }
1498
- }
1499
-
1500
- Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
1501
- value = +value;
1502
- offset = offset | 0;
1503
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
1504
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1505
- this[offset] = (value & 0xff);
1506
- this[offset + 1] = (value >>> 8);
1507
- } else {
1508
- objectWriteUInt16(this, value, offset, true);
1509
- }
1510
- return offset + 2
1511
- };
1512
-
1513
- Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
1514
- value = +value;
1515
- offset = offset | 0;
1516
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
1517
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1518
- this[offset] = (value >>> 8);
1519
- this[offset + 1] = (value & 0xff);
1520
- } else {
1521
- objectWriteUInt16(this, value, offset, false);
1522
- }
1523
- return offset + 2
1524
- };
1525
-
1526
- function objectWriteUInt32 (buf, value, offset, littleEndian) {
1527
- if (value < 0) value = 0xffffffff + value + 1;
1528
- for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
1529
- buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff;
1530
- }
1531
- }
1532
-
1533
- Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
1534
- value = +value;
1535
- offset = offset | 0;
1536
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
1537
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1538
- this[offset + 3] = (value >>> 24);
1539
- this[offset + 2] = (value >>> 16);
1540
- this[offset + 1] = (value >>> 8);
1541
- this[offset] = (value & 0xff);
1542
- } else {
1543
- objectWriteUInt32(this, value, offset, true);
1544
- }
1545
- return offset + 4
1546
- };
1547
-
1548
- Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
1549
- value = +value;
1550
- offset = offset | 0;
1551
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
1552
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1553
- this[offset] = (value >>> 24);
1554
- this[offset + 1] = (value >>> 16);
1555
- this[offset + 2] = (value >>> 8);
1556
- this[offset + 3] = (value & 0xff);
1557
- } else {
1558
- objectWriteUInt32(this, value, offset, false);
1559
- }
1560
- return offset + 4
1561
- };
1562
-
1563
- Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
1564
- value = +value;
1565
- offset = offset | 0;
1566
- if (!noAssert) {
1567
- var limit = Math.pow(2, 8 * byteLength - 1);
1568
-
1569
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
1570
- }
1571
-
1572
- var i = 0;
1573
- var mul = 1;
1574
- var sub = 0;
1575
- this[offset] = value & 0xFF;
1576
- while (++i < byteLength && (mul *= 0x100)) {
1577
- if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
1578
- sub = 1;
1579
- }
1580
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
1581
- }
1582
-
1583
- return offset + byteLength
1584
- };
1585
-
1586
- Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
1587
- value = +value;
1588
- offset = offset | 0;
1589
- if (!noAssert) {
1590
- var limit = Math.pow(2, 8 * byteLength - 1);
1591
-
1592
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
1593
- }
1594
-
1595
- var i = byteLength - 1;
1596
- var mul = 1;
1597
- var sub = 0;
1598
- this[offset + i] = value & 0xFF;
1599
- while (--i >= 0 && (mul *= 0x100)) {
1600
- if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
1601
- sub = 1;
1602
- }
1603
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
1604
- }
1605
-
1606
- return offset + byteLength
1607
- };
1608
-
1609
- Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
1610
- value = +value;
1611
- offset = offset | 0;
1612
- if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -128);
1613
- if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
1614
- if (value < 0) value = 0xff + value + 1;
1615
- this[offset] = (value & 0xff);
1616
- return offset + 1
1617
- };
1618
-
1619
- Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
1620
- value = +value;
1621
- offset = offset | 0;
1622
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768);
1623
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1624
- this[offset] = (value & 0xff);
1625
- this[offset + 1] = (value >>> 8);
1626
- } else {
1627
- objectWriteUInt16(this, value, offset, true);
1628
- }
1629
- return offset + 2
1630
- };
1631
-
1632
- Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
1633
- value = +value;
1634
- offset = offset | 0;
1635
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768);
1636
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1637
- this[offset] = (value >>> 8);
1638
- this[offset + 1] = (value & 0xff);
1639
- } else {
1640
- objectWriteUInt16(this, value, offset, false);
1641
- }
1642
- return offset + 2
1643
- };
1644
-
1645
- Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
1646
- value = +value;
1647
- offset = offset | 0;
1648
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648);
1649
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1650
- this[offset] = (value & 0xff);
1651
- this[offset + 1] = (value >>> 8);
1652
- this[offset + 2] = (value >>> 16);
1653
- this[offset + 3] = (value >>> 24);
1654
- } else {
1655
- objectWriteUInt32(this, value, offset, true);
1656
- }
1657
- return offset + 4
1658
- };
1659
-
1660
- Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
1661
- value = +value;
1662
- offset = offset | 0;
1663
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648);
1664
- if (value < 0) value = 0xffffffff + value + 1;
1665
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1666
- this[offset] = (value >>> 24);
1667
- this[offset + 1] = (value >>> 16);
1668
- this[offset + 2] = (value >>> 8);
1669
- this[offset + 3] = (value & 0xff);
1670
- } else {
1671
- objectWriteUInt32(this, value, offset, false);
1672
- }
1673
- return offset + 4
1674
- };
1675
-
1676
- function checkIEEE754 (buf, value, offset, ext, max, min) {
1677
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
1678
- if (offset < 0) throw new RangeError('Index out of range')
1679
- }
1680
-
1681
- function writeFloat (buf, value, offset, littleEndian, noAssert) {
1682
- if (!noAssert) {
1683
- checkIEEE754(buf, value, offset, 4);
1684
- }
1685
- write(buf, value, offset, littleEndian, 23, 4);
1686
- return offset + 4
1687
- }
1688
-
1689
- Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
1690
- return writeFloat(this, value, offset, true, noAssert)
1691
- };
1692
-
1693
- Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
1694
- return writeFloat(this, value, offset, false, noAssert)
1695
- };
1696
-
1697
- function writeDouble (buf, value, offset, littleEndian, noAssert) {
1698
- if (!noAssert) {
1699
- checkIEEE754(buf, value, offset, 8);
1700
- }
1701
- write(buf, value, offset, littleEndian, 52, 8);
1702
- return offset + 8
1703
- }
1704
-
1705
- Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
1706
- return writeDouble(this, value, offset, true, noAssert)
1707
- };
1708
-
1709
- Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
1710
- return writeDouble(this, value, offset, false, noAssert)
1711
- };
1712
-
1713
- // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
1714
- Buffer.prototype.copy = function copy (target, targetStart, start, end) {
1715
- if (!start) start = 0;
1716
- if (!end && end !== 0) end = this.length;
1717
- if (targetStart >= target.length) targetStart = target.length;
1718
- if (!targetStart) targetStart = 0;
1719
- if (end > 0 && end < start) end = start;
1720
-
1721
- // Copy 0 bytes; we're done
1722
- if (end === start) return 0
1723
- if (target.length === 0 || this.length === 0) return 0
1724
-
1725
- // Fatal error conditions
1726
- if (targetStart < 0) {
1727
- throw new RangeError('targetStart out of bounds')
1728
- }
1729
- if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
1730
- if (end < 0) throw new RangeError('sourceEnd out of bounds')
1731
-
1732
- // Are we oob?
1733
- if (end > this.length) end = this.length;
1734
- if (target.length - targetStart < end - start) {
1735
- end = target.length - targetStart + start;
1736
- }
1737
-
1738
- var len = end - start;
1739
- var i;
1740
-
1741
- if (this === target && start < targetStart && targetStart < end) {
1742
- // descending copy from end
1743
- for (i = len - 1; i >= 0; --i) {
1744
- target[i + targetStart] = this[i + start];
1745
- }
1746
- } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
1747
- // ascending copy from start
1748
- for (i = 0; i < len; ++i) {
1749
- target[i + targetStart] = this[i + start];
1750
- }
1751
- } else {
1752
- Uint8Array.prototype.set.call(
1753
- target,
1754
- this.subarray(start, start + len),
1755
- targetStart
1756
- );
1757
- }
1758
-
1759
- return len
1760
- };
1761
-
1762
- // Usage:
1763
- // buffer.fill(number[, offset[, end]])
1764
- // buffer.fill(buffer[, offset[, end]])
1765
- // buffer.fill(string[, offset[, end]][, encoding])
1766
- Buffer.prototype.fill = function fill (val, start, end, encoding) {
1767
- // Handle string cases:
1768
- if (typeof val === 'string') {
1769
- if (typeof start === 'string') {
1770
- encoding = start;
1771
- start = 0;
1772
- end = this.length;
1773
- } else if (typeof end === 'string') {
1774
- encoding = end;
1775
- end = this.length;
1776
- }
1777
- if (val.length === 1) {
1778
- var code = val.charCodeAt(0);
1779
- if (code < 256) {
1780
- val = code;
1781
- }
1782
- }
1783
- if (encoding !== undefined && typeof encoding !== 'string') {
1784
- throw new TypeError('encoding must be a string')
1785
- }
1786
- if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
1787
- throw new TypeError('Unknown encoding: ' + encoding)
1788
- }
1789
- } else if (typeof val === 'number') {
1790
- val = val & 255;
1791
- }
1792
-
1793
- // Invalid ranges are not set to a default, so can range check early.
1794
- if (start < 0 || this.length < start || this.length < end) {
1795
- throw new RangeError('Out of range index')
1796
- }
1797
-
1798
- if (end <= start) {
1799
- return this
1800
- }
1801
-
1802
- start = start >>> 0;
1803
- end = end === undefined ? this.length : end >>> 0;
1804
-
1805
- if (!val) val = 0;
1806
-
1807
- var i;
1808
- if (typeof val === 'number') {
1809
- for (i = start; i < end; ++i) {
1810
- this[i] = val;
1811
- }
1812
- } else {
1813
- var bytes = internalIsBuffer(val)
1814
- ? val
1815
- : utf8ToBytes(new Buffer(val, encoding).toString());
1816
- var len = bytes.length;
1817
- for (i = 0; i < end - start; ++i) {
1818
- this[i + start] = bytes[i % len];
1819
- }
1820
- }
1821
-
1822
- return this
1823
- };
1824
-
1825
- // HELPER FUNCTIONS
1826
- // ================
1827
-
1828
- var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
1829
-
1830
- function base64clean (str) {
1831
- // Node strips out invalid characters like \n and \t from the string, base64-js does not
1832
- str = stringtrim(str).replace(INVALID_BASE64_RE, '');
1833
- // Node converts strings with length < 2 to ''
1834
- if (str.length < 2) return ''
1835
- // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
1836
- while (str.length % 4 !== 0) {
1837
- str = str + '=';
1838
- }
1839
- return str
1840
- }
1841
-
1842
- function stringtrim (str) {
1843
- if (str.trim) return str.trim()
1844
- return str.replace(/^\s+|\s+$/g, '')
1845
- }
1846
-
1847
- function toHex (n) {
1848
- if (n < 16) return '0' + n.toString(16)
1849
- return n.toString(16)
1850
- }
1851
-
1852
- function utf8ToBytes (string, units) {
1853
- units = units || Infinity;
1854
- var codePoint;
1855
- var length = string.length;
1856
- var leadSurrogate = null;
1857
- var bytes = [];
1858
-
1859
- for (var i = 0; i < length; ++i) {
1860
- codePoint = string.charCodeAt(i);
1861
-
1862
- // is surrogate component
1863
- if (codePoint > 0xD7FF && codePoint < 0xE000) {
1864
- // last char was a lead
1865
- if (!leadSurrogate) {
1866
- // no lead yet
1867
- if (codePoint > 0xDBFF) {
1868
- // unexpected trail
1869
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
1870
- continue
1871
- } else if (i + 1 === length) {
1872
- // unpaired lead
1873
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
1874
- continue
1875
- }
1876
-
1877
- // valid lead
1878
- leadSurrogate = codePoint;
1879
-
1880
- continue
1881
- }
1882
-
1883
- // 2 leads in a row
1884
- if (codePoint < 0xDC00) {
1885
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
1886
- leadSurrogate = codePoint;
1887
- continue
1888
- }
1889
-
1890
- // valid surrogate pair
1891
- codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
1892
- } else if (leadSurrogate) {
1893
- // valid bmp char, but last char was a lead
1894
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
1895
- }
1896
-
1897
- leadSurrogate = null;
1898
-
1899
- // encode utf8
1900
- if (codePoint < 0x80) {
1901
- if ((units -= 1) < 0) break
1902
- bytes.push(codePoint);
1903
- } else if (codePoint < 0x800) {
1904
- if ((units -= 2) < 0) break
1905
- bytes.push(
1906
- codePoint >> 0x6 | 0xC0,
1907
- codePoint & 0x3F | 0x80
1908
- );
1909
- } else if (codePoint < 0x10000) {
1910
- if ((units -= 3) < 0) break
1911
- bytes.push(
1912
- codePoint >> 0xC | 0xE0,
1913
- codePoint >> 0x6 & 0x3F | 0x80,
1914
- codePoint & 0x3F | 0x80
1915
- );
1916
- } else if (codePoint < 0x110000) {
1917
- if ((units -= 4) < 0) break
1918
- bytes.push(
1919
- codePoint >> 0x12 | 0xF0,
1920
- codePoint >> 0xC & 0x3F | 0x80,
1921
- codePoint >> 0x6 & 0x3F | 0x80,
1922
- codePoint & 0x3F | 0x80
1923
- );
1924
- } else {
1925
- throw new Error('Invalid code point')
1926
- }
1927
- }
1928
-
1929
- return bytes
1930
- }
1931
-
1932
- function asciiToBytes (str) {
1933
- var byteArray = [];
1934
- for (var i = 0; i < str.length; ++i) {
1935
- // Node's code seems to be doing this and not & 0x7F..
1936
- byteArray.push(str.charCodeAt(i) & 0xFF);
1937
- }
1938
- return byteArray
1939
- }
1940
-
1941
- function utf16leToBytes (str, units) {
1942
- var c, hi, lo;
1943
- var byteArray = [];
1944
- for (var i = 0; i < str.length; ++i) {
1945
- if ((units -= 2) < 0) break
1946
-
1947
- c = str.charCodeAt(i);
1948
- hi = c >> 8;
1949
- lo = c % 256;
1950
- byteArray.push(lo);
1951
- byteArray.push(hi);
1952
- }
1953
-
1954
- return byteArray
1955
- }
1956
-
1957
-
1958
- function base64ToBytes (str) {
1959
- return toByteArray(base64clean(str))
1960
- }
1961
-
1962
- function blitBuffer (src, dst, offset, length) {
1963
- for (var i = 0; i < length; ++i) {
1964
- if ((i + offset >= dst.length) || (i >= src.length)) break
1965
- dst[i + offset] = src[i];
1966
- }
1967
- return i
1968
- }
1969
-
1970
- function isnan (val) {
1971
- return val !== val // eslint-disable-line no-self-compare
1972
- }
1973
-
1974
-
1975
- // the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
1976
- // The _isBuffer check is for Safari 5-7 support, because it's missing
1977
- // Object.prototype.constructor. Remove this eventually
1978
- function isBuffer$1(obj) {
1979
- return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj))
1980
- }
1981
-
1982
- function isFastBuffer (obj) {
1983
- return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
1984
- }
1985
-
1986
- // For Node v0.10 support. Remove this eventually.
1987
- function isSlowBuffer (obj) {
1988
- return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0))
1989
- }
1990
-
1991
- class PNG {
1992
- data;
1993
- width;
1994
- height;
1995
- format;
1996
- constructor(data) {
1997
- const png = new PNG$1(data);
1998
- this.data = data;
1999
- this.width = png.width;
2000
- this.height = png.height;
2001
- this.format = 'png';
2002
- }
2003
- static isValid(data) {
2004
- try {
2005
- return !!new PNG(data);
2006
- }
2007
- catch {
2008
- return false;
2009
- }
2010
- }
2011
- }
2012
-
2013
- class JPEG {
2014
- data;
2015
- width;
2016
- height;
2017
- format;
2018
- constructor(data) {
2019
- this.data = data;
2020
- this.format = 'jpeg';
2021
- this.width = 0;
2022
- this.height = 0;
2023
- if (data.readUInt16BE(0) !== 0xffd8) {
2024
- throw new Error('SOI not found in JPEG');
2025
- }
2026
- const markers = _JPEG.decode(this.data);
2027
- let orientation;
2028
- for (let i = 0; i < markers.length; i += 1) {
2029
- const marker = markers[i];
2030
- if (marker.name === 'EXIF' && marker.entries.orientation) {
2031
- orientation = marker.entries.orientation;
2032
- }
2033
- if (marker.name === 'SOF') {
2034
- this.width ||= marker.width;
2035
- this.height ||= marker.height;
2036
- }
2037
- }
2038
- if (orientation > 4) {
2039
- [this.width, this.height] = [this.height, this.width];
2040
- }
2041
- }
2042
- static isValid(data) {
2043
- return data && Buffer.isBuffer(data) && data.readUInt16BE(0) === 0xffd8;
2044
- }
2045
- }
2046
-
2047
- const createCache = ({ limit = 100 } = {}) => {
2048
- let cache = {};
2049
- let keys = [];
2050
- return {
2051
- get: (key) => (key ? cache[key] : null),
2052
- set: (key, value) => {
2053
- keys.push(key);
2054
- if (keys.length > limit) {
2055
- delete cache[keys.shift()];
2056
- }
2057
- cache[key] = value;
2058
- },
2059
- reset: () => {
2060
- cache = {};
2061
- keys = [];
2062
- },
2063
- length: () => keys.length,
2064
- };
2065
- };
2066
-
2067
- const IMAGE_CACHE = createCache({ limit: 30 });
2068
- const isBuffer = Buffer.isBuffer;
2069
- const isBlob = (src) => {
2070
- return typeof Blob !== 'undefined' && src instanceof Blob;
2071
- };
2072
- const isDataImageSrc = (src) => {
2073
- return 'data' in src;
2074
- };
2075
- const isBase64Src = (imageSrc) => 'uri' in imageSrc &&
2076
- /^data:image\/[a-zA-Z]*;base64,[^"]*/g.test(imageSrc.uri);
2077
- const fetchRemoteFile = async (src) => {
2078
- const { method = 'GET', headers, body, credentials } = src;
2079
- const response = await fetch(src.uri, {
2080
- method,
2081
- headers,
2082
- body,
2083
- credentials,
2084
- });
2085
- const buffer = await response.arrayBuffer();
2086
- return Buffer.from(buffer);
2087
- };
2088
- const isValidFormat = (format) => {
2089
- const lower = format.toLowerCase();
2090
- return lower === 'jpg' || lower === 'jpeg' || lower === 'png';
2091
- };
2092
- const guessFormat = (buffer) => {
2093
- let format;
2094
- if (JPEG.isValid(buffer)) {
2095
- format = 'jpg';
2096
- }
2097
- else if (PNG.isValid(buffer)) {
2098
- format = 'png';
2099
- }
2100
- return format;
2101
- };
2102
- function getImage(body, format) {
2103
- switch (format.toLowerCase()) {
2104
- case 'jpg':
2105
- case 'jpeg':
2106
- return new JPEG(body);
2107
- case 'png':
2108
- return new PNG(body);
2109
- default:
2110
- return null;
2111
- }
2112
- }
2113
- const resolveBase64Image = async ({ uri }) => {
2114
- const match = /^data:image\/([a-zA-Z]*);base64,([^"]*)/g.exec(uri);
2115
- if (!match)
2116
- throw new Error(`Invalid base64 image: ${uri}`);
2117
- const format = match[1];
2118
- const data = match[2];
2119
- if (!isValidFormat(format))
2120
- throw new Error(`Base64 image invalid format: ${format}`);
2121
- return getImage(Buffer.from(data, 'base64'), format);
2122
- };
2123
- const resolveImageFromData = async (src) => {
2124
- if (src.data && src.format) {
2125
- return getImage(src.data, src.format);
2126
- }
2127
- throw new Error(`Invalid data given for local file: ${JSON.stringify(src)}`);
2128
- };
2129
- const resolveBufferImage = async (buffer) => {
2130
- const format = guessFormat(buffer);
2131
- if (format) {
2132
- return getImage(buffer, format);
2133
- }
2134
- return null;
2135
- };
2136
- const resolveBlobImage = async (blob) => {
2137
- const { type } = blob;
2138
- if (!type || type === 'application/octet-stream') {
2139
- const arrayBuffer = await blob.arrayBuffer();
2140
- const buffer = Buffer.from(arrayBuffer);
2141
- return resolveBufferImage(buffer);
2142
- }
2143
- if (!type.startsWith('image/')) {
2144
- throw new Error(`Invalid blob type: ${type}`);
2145
- }
2146
- const format = type.replace('image/', '');
2147
- if (!isValidFormat(format)) {
2148
- throw new Error(`Invalid blob type: ${type}`);
2149
- }
2150
- const buffer = await blob.arrayBuffer();
2151
- return getImage(Buffer.from(buffer), format);
2152
- };
2153
- const getImageFormat = (body) => {
2154
- const isPng = body[0] === 137 &&
2155
- body[1] === 80 &&
2156
- body[2] === 78 &&
2157
- body[3] === 71 &&
2158
- body[4] === 13 &&
2159
- body[5] === 10 &&
2160
- body[6] === 26 &&
2161
- body[7] === 10;
2162
- const isJpg = body[0] === 255 && body[1] === 216 && body[2] === 255;
2163
- let extension = '';
2164
- if (isPng) {
2165
- extension = 'png';
2166
- }
2167
- else if (isJpg) {
2168
- extension = 'jpg';
2169
- }
2170
- else {
2171
- throw new Error('Not valid image extension');
2172
- }
2173
- return extension;
2174
- };
2175
- const resolveImageFromUrl = async (src) => {
2176
- const data = await fetchRemoteFile(src);
2177
- const format = getImageFormat(data);
2178
- return getImage(data, format);
2179
- };
2180
- const getCacheKey = (src) => {
2181
- if (isBlob(src) || isBuffer(src))
2182
- return null;
2183
- if (isDataImageSrc(src))
2184
- return src.data.toString();
2185
- return src.uri;
2186
- };
2187
- const resolveImage = (src, { cache = true } = {}) => {
2188
- let image;
2189
- const cacheKey = getCacheKey(src);
2190
- if (isBlob(src)) {
2191
- image = resolveBlobImage(src);
2192
- }
2193
- else if (isBuffer(src)) {
2194
- image = resolveBufferImage(src);
2195
- }
2196
- else if (cache && IMAGE_CACHE.get(cacheKey)) {
2197
- return IMAGE_CACHE.get(cacheKey);
2198
- }
2199
- else if (isBase64Src(src)) {
2200
- image = resolveBase64Image(src);
2201
- }
2202
- else if (isDataImageSrc(src)) {
2203
- image = resolveImageFromData(src);
2204
- }
2205
- else {
2206
- image = resolveImageFromUrl(src);
2207
- }
2208
- if (!image) {
2209
- throw new Error('Cannot resolve image');
2210
- }
2211
- if (cache && cacheKey) {
2212
- IMAGE_CACHE.set(cacheKey, image);
2213
- }
2214
- return image;
2215
- };
2216
-
2217
- export { resolveImage as default };