@loaders.gl/polyfills 4.0.0-beta.1 → 4.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/dist/buffer/btoa.node.d.ts.map +1 -0
  2. package/dist/buffer/btoa.node.js.map +1 -0
  3. package/dist/buffer/to-array-buffer.node.d.ts.map +1 -0
  4. package/dist/buffer/to-array-buffer.node.js.map +1 -0
  5. package/dist/crypto/node-hash.d.ts +28 -0
  6. package/dist/crypto/node-hash.d.ts.map +1 -0
  7. package/dist/crypto/node-hash.js +56 -0
  8. package/dist/crypto/node-hash.js.map +1 -0
  9. package/dist/dist.dev.js +43 -0
  10. package/dist/{node/fetch/utils/decode-data-uri.node.d.ts → fetch/decode-data-uri.d.ts} +1 -1
  11. package/dist/fetch/decode-data-uri.d.ts.map +1 -0
  12. package/dist/{esm/node/fetch/utils/decode-data-uri.node.js → fetch/decode-data-uri.js} +3 -3
  13. package/dist/fetch/decode-data-uri.js.map +1 -0
  14. package/dist/{node/fetch/fetch.node.d.ts → fetch/fetch-polyfill.d.ts} +2 -2
  15. package/dist/fetch/fetch-polyfill.d.ts.map +1 -0
  16. package/dist/{esm/node/fetch/fetch.node.js → fetch/fetch-polyfill.js} +4 -4
  17. package/dist/fetch/fetch-polyfill.js.map +1 -0
  18. package/dist/{node/fetch/headers.node.d.ts → fetch/headers-polyfill.d.ts} +1 -1
  19. package/dist/{node/fetch/headers.node.d.ts.map → fetch/headers-polyfill.d.ts.map} +1 -1
  20. package/dist/{esm/node/fetch/headers.node.js → fetch/headers-polyfill.js} +3 -4
  21. package/dist/fetch/headers-polyfill.js.map +1 -0
  22. package/dist/{node/fetch/response.node.d.ts → fetch/response-polyfill.d.ts} +2 -2
  23. package/dist/{node/fetch/response.node.d.ts.map → fetch/response-polyfill.d.ts.map} +1 -1
  24. package/dist/{esm/node/fetch/response.node.js → fetch/response-polyfill.js} +14 -15
  25. package/dist/fetch/response-polyfill.js.map +1 -0
  26. package/dist/file/blob-stream-controller.d.ts.map +1 -0
  27. package/dist/{esm/node/file → file}/blob-stream-controller.js +3 -4
  28. package/dist/file/blob-stream-controller.js.map +1 -0
  29. package/dist/file/blob-stream.d.ts.map +1 -0
  30. package/dist/{esm/node/file → file}/blob-stream.js +3 -4
  31. package/dist/file/blob-stream.js.map +1 -0
  32. package/dist/file/blob.d.ts.map +1 -0
  33. package/dist/{esm/node/file → file}/blob.js +4 -5
  34. package/dist/file/blob.js.map +1 -0
  35. package/dist/file/file-reader.d.ts.map +1 -0
  36. package/dist/file/file-reader.js +59 -0
  37. package/dist/file/file-reader.js.map +1 -0
  38. package/dist/{node/file → file}/file.d.ts +1 -2
  39. package/dist/file/file.d.ts.map +1 -0
  40. package/dist/{esm/node/file → file}/file.js +4 -6
  41. package/dist/file/file.js.map +1 -0
  42. package/dist/file/install-blob-polyfills.d.ts +9 -0
  43. package/dist/file/install-blob-polyfills.d.ts.map +1 -0
  44. package/dist/file/install-blob-polyfills.js +9 -0
  45. package/dist/file/install-blob-polyfills.js.map +1 -0
  46. package/dist/file/install-file-polyfills.d.ts +3 -0
  47. package/dist/file/install-file-polyfills.d.ts.map +1 -0
  48. package/dist/file/install-file-polyfills.js +13 -0
  49. package/dist/file/install-file-polyfills.js.map +1 -0
  50. package/dist/file/readable-stream.d.ts.map +1 -0
  51. package/dist/{esm/node/file → file}/readable-stream.js +1 -1
  52. package/dist/file/readable-stream.js.map +1 -0
  53. package/dist/filesystems/fetch-node.d.ts +8 -0
  54. package/dist/filesystems/fetch-node.d.ts.map +1 -0
  55. package/dist/filesystems/fetch-node.js +77 -0
  56. package/dist/filesystems/fetch-node.js.map +1 -0
  57. package/dist/filesystems/node-file.d.ts +13 -0
  58. package/dist/filesystems/node-file.d.ts.map +1 -0
  59. package/dist/filesystems/node-file.js +72 -0
  60. package/dist/filesystems/node-file.js.map +1 -0
  61. package/dist/filesystems/node-filesystem.d.ts +19 -0
  62. package/dist/filesystems/node-filesystem.d.ts.map +1 -0
  63. package/dist/filesystems/node-filesystem.js +40 -0
  64. package/dist/filesystems/node-filesystem.js.map +1 -0
  65. package/dist/{node/fetch/utils → filesystems}/stream-utils.node.d.ts +8 -1
  66. package/dist/filesystems/stream-utils.node.d.ts.map +1 -0
  67. package/dist/{esm/node/fetch/utils → filesystems}/stream-utils.node.js +24 -2
  68. package/dist/filesystems/stream-utils.node.js.map +1 -0
  69. package/dist/images/encode-image.node.d.ts.map +1 -0
  70. package/dist/{esm/node/images → images}/encode-image.node.js +1 -1
  71. package/dist/images/encode-image.node.js.map +1 -0
  72. package/dist/images/parse-image.node.d.ts.map +1 -0
  73. package/dist/images/parse-image.node.js.map +1 -0
  74. package/dist/index.browser.d.ts +4 -0
  75. package/dist/index.browser.d.ts.map +1 -0
  76. package/dist/index.browser.js +6 -0
  77. package/dist/index.browser.js.map +1 -0
  78. package/dist/index.cjs +33 -0
  79. package/dist/index.d.ts +4 -3
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +56 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/libs/encoding-indexes-asian.js +2 -0
  84. package/dist/libs/encoding-indexes-asian.js.map +1 -0
  85. package/dist/streams/make-node-stream.d.ts +11 -0
  86. package/dist/streams/make-node-stream.d.ts.map +1 -0
  87. package/dist/streams/make-node-stream.js +56 -0
  88. package/dist/streams/make-node-stream.js.map +1 -0
  89. package/dist/text-encoder/encoding-indexes.d.ts.map +1 -0
  90. package/dist/{esm/lib → text-encoder}/encoding-indexes.js.map +1 -1
  91. package/dist/{lib/encoding.d.ts → text-encoder/text-encoder.d.ts} +1 -1
  92. package/dist/text-encoder/text-encoder.d.ts.map +1 -0
  93. package/dist/{esm/lib/encoding.js → text-encoder/text-encoder.js} +7 -7
  94. package/dist/text-encoder/text-encoder.js.map +1 -0
  95. package/dist/utils/assert.js +6 -0
  96. package/dist/utils/assert.js.map +1 -0
  97. package/dist/utils/is-browser.d.ts +2 -0
  98. package/dist/utils/is-browser.d.ts.map +1 -0
  99. package/dist/utils/is-browser.js +2 -0
  100. package/dist/utils/is-browser.js.map +1 -0
  101. package/package.json +20 -70
  102. package/src/crypto/node-hash.ts +71 -0
  103. package/src/{node/fetch/fetch.node.ts → fetch/fetch-polyfill.ts} +3 -3
  104. package/src/{node/fetch/response.node.ts → fetch/response-polyfill.ts} +6 -6
  105. package/src/{node/file → file}/file.ts +1 -2
  106. package/src/file/install-blob-polyfills.ts +13 -0
  107. package/src/file/install-file-polyfills.ts +20 -0
  108. package/src/{node/file → file}/readable-stream.ts +1 -1
  109. package/src/filesystems/fetch-node.ts +96 -0
  110. package/src/filesystems/node-file.ts +137 -0
  111. package/src/filesystems/node-filesystem.ts +52 -0
  112. package/src/{node/fetch/utils → filesystems}/stream-utils.node.ts +42 -3
  113. package/src/index.browser.ts +10 -0
  114. package/src/index.ts +76 -50
  115. package/src/streams/make-node-stream.ts +74 -0
  116. package/src/{lib/encoding.ts → text-encoder/text-encoder.ts} +7 -7
  117. package/src/utils/is-browser.ts +6 -0
  118. package/dist/bundle.d.ts +0 -2
  119. package/dist/bundle.d.ts.map +0 -1
  120. package/dist/dist.min.js +0 -1792
  121. package/dist/es5/bundle.js +0 -6
  122. package/dist/es5/bundle.js.map +0 -1
  123. package/dist/es5/index.js +0 -72
  124. package/dist/es5/index.js.map +0 -1
  125. package/dist/es5/lib/encoding-indexes.js +0 -37
  126. package/dist/es5/lib/encoding-indexes.js.map +0 -1
  127. package/dist/es5/lib/encoding.js +0 -1214
  128. package/dist/es5/lib/encoding.js.map +0 -1
  129. package/dist/es5/libs/encoding-indexes-asian.js +0 -13
  130. package/dist/es5/node/buffer/btoa.node.js +0 -14
  131. package/dist/es5/node/buffer/btoa.node.js.map +0 -1
  132. package/dist/es5/node/buffer/to-array-buffer.node.js +0 -14
  133. package/dist/es5/node/buffer/to-array-buffer.node.js.map +0 -1
  134. package/dist/es5/node/fetch/fetch.node.js +0 -193
  135. package/dist/es5/node/fetch/fetch.node.js.map +0 -1
  136. package/dist/es5/node/fetch/headers.node.js +0 -151
  137. package/dist/es5/node/fetch/headers.node.js.map +0 -1
  138. package/dist/es5/node/fetch/response.node.js +0 -182
  139. package/dist/es5/node/fetch/response.node.js.map +0 -1
  140. package/dist/es5/node/fetch/utils/decode-data-uri.node.js +0 -58
  141. package/dist/es5/node/fetch/utils/decode-data-uri.node.js.map +0 -1
  142. package/dist/es5/node/fetch/utils/stream-utils.node.js +0 -92
  143. package/dist/es5/node/fetch/utils/stream-utils.node.js.map +0 -1
  144. package/dist/es5/node/file/blob-stream-controller.js +0 -90
  145. package/dist/es5/node/file/blob-stream-controller.js.map +0 -1
  146. package/dist/es5/node/file/blob-stream.js +0 -64
  147. package/dist/es5/node/file/blob-stream.js.map +0 -1
  148. package/dist/es5/node/file/blob.js +0 -212
  149. package/dist/es5/node/file/blob.js.map +0 -1
  150. package/dist/es5/node/file/file-reader.js +0 -153
  151. package/dist/es5/node/file/file-reader.js.map +0 -1
  152. package/dist/es5/node/file/file.js +0 -44
  153. package/dist/es5/node/file/file.js.map +0 -1
  154. package/dist/es5/node/file/install-file-polyfills.js +0 -22
  155. package/dist/es5/node/file/install-file-polyfills.js.map +0 -1
  156. package/dist/es5/node/file/readable-stream.js +0 -27
  157. package/dist/es5/node/file/readable-stream.js.map +0 -1
  158. package/dist/es5/node/images/encode-image.node.js +0 -30
  159. package/dist/es5/node/images/encode-image.node.js.map +0 -1
  160. package/dist/es5/node/images/parse-image.node.js +0 -64
  161. package/dist/es5/node/images/parse-image.node.js.map +0 -1
  162. package/dist/es5/promise/all-settled.js +0 -28
  163. package/dist/es5/promise/all-settled.js.map +0 -1
  164. package/dist/es5/utils/assert.js +0 -12
  165. package/dist/es5/utils/assert.js.map +0 -1
  166. package/dist/es5/utils/globals.js +0 -18
  167. package/dist/es5/utils/globals.js.map +0 -1
  168. package/dist/esm/bundle.js +0 -4
  169. package/dist/esm/bundle.js.map +0 -1
  170. package/dist/esm/index.js +0 -46
  171. package/dist/esm/index.js.map +0 -1
  172. package/dist/esm/lib/encoding.js.map +0 -1
  173. package/dist/esm/libs/encoding-indexes-asian.js +0 -13
  174. package/dist/esm/node/buffer/btoa.node.js.map +0 -1
  175. package/dist/esm/node/buffer/to-array-buffer.node.js.map +0 -1
  176. package/dist/esm/node/fetch/fetch.node.js.map +0 -1
  177. package/dist/esm/node/fetch/headers.node.js.map +0 -1
  178. package/dist/esm/node/fetch/response.node.js.map +0 -1
  179. package/dist/esm/node/fetch/utils/decode-data-uri.node.js.map +0 -1
  180. package/dist/esm/node/fetch/utils/stream-utils.node.js.map +0 -1
  181. package/dist/esm/node/file/blob-stream-controller.js.map +0 -1
  182. package/dist/esm/node/file/blob-stream.js.map +0 -1
  183. package/dist/esm/node/file/blob.js.map +0 -1
  184. package/dist/esm/node/file/file-reader.js +0 -60
  185. package/dist/esm/node/file/file-reader.js.map +0 -1
  186. package/dist/esm/node/file/file.js.map +0 -1
  187. package/dist/esm/node/file/install-file-polyfills.js +0 -16
  188. package/dist/esm/node/file/install-file-polyfills.js.map +0 -1
  189. package/dist/esm/node/file/readable-stream.js.map +0 -1
  190. package/dist/esm/node/images/encode-image.node.js.map +0 -1
  191. package/dist/esm/node/images/parse-image.node.js.map +0 -1
  192. package/dist/esm/promise/all-settled.js +0 -19
  193. package/dist/esm/promise/all-settled.js.map +0 -1
  194. package/dist/esm/utils/assert.js +0 -6
  195. package/dist/esm/utils/assert.js.map +0 -1
  196. package/dist/esm/utils/globals.js +0 -9
  197. package/dist/esm/utils/globals.js.map +0 -1
  198. package/dist/lib/encoding-indexes.d.ts.map +0 -1
  199. package/dist/lib/encoding.d.ts.map +0 -1
  200. package/dist/node/buffer/btoa.node.d.ts.map +0 -1
  201. package/dist/node/buffer/to-array-buffer.node.d.ts.map +0 -1
  202. package/dist/node/fetch/fetch.node.d.ts.map +0 -1
  203. package/dist/node/fetch/utils/decode-data-uri.node.d.ts.map +0 -1
  204. package/dist/node/fetch/utils/stream-utils.node.d.ts.map +0 -1
  205. package/dist/node/file/blob-stream-controller.d.ts.map +0 -1
  206. package/dist/node/file/blob-stream.d.ts.map +0 -1
  207. package/dist/node/file/blob.d.ts.map +0 -1
  208. package/dist/node/file/file-reader.d.ts.map +0 -1
  209. package/dist/node/file/file.d.ts.map +0 -1
  210. package/dist/node/file/install-file-polyfills.d.ts +0 -2
  211. package/dist/node/file/install-file-polyfills.d.ts.map +0 -1
  212. package/dist/node/file/readable-stream.d.ts.map +0 -1
  213. package/dist/node/images/encode-image.node.d.ts.map +0 -1
  214. package/dist/node/images/parse-image.node.d.ts.map +0 -1
  215. package/dist/promise/all-settled.d.ts +0 -10
  216. package/dist/promise/all-settled.d.ts.map +0 -1
  217. package/dist/utils/globals.d.ts +0 -4
  218. package/dist/utils/globals.d.ts.map +0 -1
  219. package/src/bundle.ts +0 -4
  220. package/src/node/file/install-file-polyfills.ts +0 -27
  221. package/src/promise/all-settled.ts +0 -21
  222. package/src/utils/globals.ts +0 -37
  223. /package/dist/{node/buffer → buffer}/btoa.node.d.ts +0 -0
  224. /package/dist/{esm/node/buffer → buffer}/btoa.node.js +0 -0
  225. /package/dist/{node/buffer → buffer}/to-array-buffer.node.d.ts +0 -0
  226. /package/dist/{esm/node/buffer → buffer}/to-array-buffer.node.js +0 -0
  227. /package/dist/{node/file → file}/blob-stream-controller.d.ts +0 -0
  228. /package/dist/{node/file → file}/blob-stream.d.ts +0 -0
  229. /package/dist/{node/file → file}/blob.d.ts +0 -0
  230. /package/dist/{node/file → file}/file-reader.d.ts +0 -0
  231. /package/dist/{node/file → file}/readable-stream.d.ts +0 -0
  232. /package/dist/{node/images → images}/encode-image.node.d.ts +0 -0
  233. /package/dist/{node/images → images}/parse-image.node.d.ts +0 -0
  234. /package/dist/{esm/node/images → images}/parse-image.node.js +0 -0
  235. /package/dist/{lib → text-encoder}/encoding-indexes.d.ts +0 -0
  236. /package/dist/{esm/lib → text-encoder}/encoding-indexes.js +0 -0
  237. /package/src/{node/buffer → buffer}/btoa.node.ts +0 -0
  238. /package/src/{node/buffer → buffer}/to-array-buffer.node.ts +0 -0
  239. /package/src/{node/fetch/utils/decode-data-uri.node.ts → fetch/decode-data-uri.ts} +0 -0
  240. /package/src/{node/fetch/headers.node.ts → fetch/headers-polyfill.ts} +0 -0
  241. /package/src/{node/file → file}/blob-stream-controller.ts +0 -0
  242. /package/src/{node/file → file}/blob-stream.ts +0 -0
  243. /package/src/{node/file → file}/blob.ts +0 -0
  244. /package/src/{node/file → file}/file-reader.ts +0 -0
  245. /package/src/{node/images → images}/encode-image.node.ts +0 -0
  246. /package/src/{node/images → images}/parse-image.node.ts +0 -0
  247. /package/src/{lib → text-encoder}/encoding-indexes.ts +0 -0
@@ -1,153 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.FileReaderPolyfill = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
12
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
- var _btoa = require("../buffer/btoa.node");
14
- var FileReaderPolyfill = function () {
15
- function FileReaderPolyfill() {
16
- (0, _classCallCheck2.default)(this, FileReaderPolyfill);
17
- (0, _defineProperty2.default)(this, "onload", void 0);
18
- (0, _defineProperty2.default)(this, "onabort", void 0);
19
- (0, _defineProperty2.default)(this, "onerror", void 0);
20
- (0, _defineProperty2.default)(this, "error", void 0);
21
- (0, _defineProperty2.default)(this, "onloadstart", void 0);
22
- (0, _defineProperty2.default)(this, "onloadend", void 0);
23
- (0, _defineProperty2.default)(this, "onprogress", void 0);
24
- (0, _defineProperty2.default)(this, "readyState", void 0);
25
- (0, _defineProperty2.default)(this, "result", void 0);
26
- (0, _defineProperty2.default)(this, "DONE", void 0);
27
- (0, _defineProperty2.default)(this, "EMPTY", void 0);
28
- (0, _defineProperty2.default)(this, "LOADING", void 0);
29
- (0, _defineProperty2.default)(this, "addEventListener", void 0);
30
- (0, _defineProperty2.default)(this, "removeEventListener", void 0);
31
- (0, _defineProperty2.default)(this, "dispatchEvent", void 0);
32
- this.onload = null;
33
- }
34
- (0, _createClass2.default)(FileReaderPolyfill, [{
35
- key: "abort",
36
- value: function abort() {
37
- return;
38
- }
39
- }, {
40
- key: "readAsArrayBuffer",
41
- value: function () {
42
- var _readAsArrayBuffer = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(blob) {
43
- var arrayBuffer;
44
- return _regenerator.default.wrap(function _callee$(_context) {
45
- while (1) switch (_context.prev = _context.next) {
46
- case 0:
47
- _context.next = 2;
48
- return blob.arrayBuffer();
49
- case 2:
50
- arrayBuffer = _context.sent;
51
- if (this.onload) {
52
- this.onload({
53
- target: {
54
- result: arrayBuffer
55
- }
56
- });
57
- }
58
- case 4:
59
- case "end":
60
- return _context.stop();
61
- }
62
- }, _callee, this);
63
- }));
64
- function readAsArrayBuffer(_x) {
65
- return _readAsArrayBuffer.apply(this, arguments);
66
- }
67
- return readAsArrayBuffer;
68
- }()
69
- }, {
70
- key: "readAsBinaryString",
71
- value: function () {
72
- var _readAsBinaryString = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(blob) {
73
- return _regenerator.default.wrap(function _callee2$(_context2) {
74
- while (1) switch (_context2.prev = _context2.next) {
75
- case 0:
76
- throw Error('Not implemented');
77
- case 1:
78
- case "end":
79
- return _context2.stop();
80
- }
81
- }, _callee2);
82
- }));
83
- function readAsBinaryString(_x2) {
84
- return _readAsBinaryString.apply(this, arguments);
85
- }
86
- return readAsBinaryString;
87
- }()
88
- }, {
89
- key: "readAsDataURL",
90
- value: function () {
91
- var _readAsDataURL = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3(blob) {
92
- var text, dataUrl;
93
- return _regenerator.default.wrap(function _callee3$(_context3) {
94
- while (1) switch (_context3.prev = _context3.next) {
95
- case 0:
96
- _context3.next = 2;
97
- return blob.text();
98
- case 2:
99
- text = _context3.sent;
100
- dataUrl = "data://;base64,".concat((0, _btoa.atob)(text));
101
- if (this.onload) {
102
- this.onload({
103
- target: {
104
- result: dataUrl
105
- }
106
- });
107
- }
108
- case 5:
109
- case "end":
110
- return _context3.stop();
111
- }
112
- }, _callee3, this);
113
- }));
114
- function readAsDataURL(_x3) {
115
- return _readAsDataURL.apply(this, arguments);
116
- }
117
- return readAsDataURL;
118
- }()
119
- }, {
120
- key: "readAsText",
121
- value: function () {
122
- var _readAsText = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee4(blob) {
123
- var text;
124
- return _regenerator.default.wrap(function _callee4$(_context4) {
125
- while (1) switch (_context4.prev = _context4.next) {
126
- case 0:
127
- _context4.next = 2;
128
- return blob.text();
129
- case 2:
130
- text = _context4.sent;
131
- if (this.onload) {
132
- this.onload({
133
- target: {
134
- result: text
135
- }
136
- });
137
- }
138
- case 4:
139
- case "end":
140
- return _context4.stop();
141
- }
142
- }, _callee4, this);
143
- }));
144
- function readAsText(_x4) {
145
- return _readAsText.apply(this, arguments);
146
- }
147
- return readAsText;
148
- }()
149
- }]);
150
- return FileReaderPolyfill;
151
- }();
152
- exports.FileReaderPolyfill = FileReaderPolyfill;
153
- //# sourceMappingURL=file-reader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-reader.js","names":["_btoa","require","FileReaderPolyfill","_classCallCheck2","default","_defineProperty2","onload","_createClass2","key","value","abort","_readAsArrayBuffer","_asyncToGenerator2","_regenerator","mark","_callee","blob","arrayBuffer","wrap","_callee$","_context","prev","next","sent","target","result","stop","readAsArrayBuffer","_x","apply","arguments","_readAsBinaryString","_callee2","_callee2$","_context2","Error","readAsBinaryString","_x2","_readAsDataURL","_callee3","text","dataUrl","_callee3$","_context3","concat","atob","readAsDataURL","_x3","_readAsText","_callee4","_callee4$","_context4","readAsText","_x4","exports"],"sources":["../../../../src/node/file/file-reader.ts"],"sourcesContent":["import {atob} from '../buffer/btoa.node';\n\nexport class FileReaderPolyfill implements FileReader {\n // onload: ({result: any}) => void;\n onload;\n onabort;\n onerror;\n error;\n onloadstart;\n onloadend;\n onprogress;\n\n readyState;\n result;\n DONE;\n EMPTY;\n LOADING;\n addEventListener;\n removeEventListener;\n dispatchEvent;\n\n constructor() {\n this.onload = null;\n }\n\n abort(): void {\n return;\n }\n\n async readAsArrayBuffer(blob: Blob): Promise<void> {\n const arrayBuffer = await blob.arrayBuffer();\n if (this.onload) {\n this.onload({target: {result: arrayBuffer}});\n }\n }\n\n async readAsBinaryString(blob) {\n throw Error('Not implemented');\n }\n\n async readAsDataURL(blob) {\n const text = await blob.text();\n const dataUrl = `data://;base64,${atob(text)}`;\n if (this.onload) {\n this.onload({target: {result: dataUrl}});\n }\n }\n\n async readAsText(blob) {\n const text = await blob.text();\n if (this.onload) {\n this.onload({target: {result: text}});\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAAyC,IAE5BC,kBAAkB;EAmB7B,SAAAA,mBAAA,EAAc;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAF,kBAAA;IAAA,IAAAG,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAA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AAU,IAAA,CAED,SAAAmC,SAAiBjC,IAAI;QAAA,IAAAwB,IAAA;QAAA,OAAA3B,YAAA,CAAAT,OAAA,CAAAc,IAAA,UAAAgC,UAAAC,SAAA;UAAA,kBAAAA,SAAA,CAAA9B,IAAA,GAAA8B,SAAA,CAAA7B,IAAA;YAAA;cAAA6B,SAAA,CAAA7B,IAAA;cAAA,OACAN,IAAI,CAACwB,IAAI,CAAC,CAAC;YAAA;cAAxBA,IAAI,GAAAW,SAAA,CAAA5B,IAAA;cACV,IAAI,IAAI,CAACjB,MAAM,EAAE;gBACf,IAAI,CAACA,MAAM,CAAC;kBAACkB,MAAM,EAAE;oBAACC,MAAM,EAAEe;kBAAI;gBAAC,CAAC,CAAC;cACvC;YAAC;YAAA;cAAA,OAAAW,SAAA,CAAAzB,IAAA;UAAA;QAAA,GAAAuB,QAAA;MAAA,CACF;MAAA,SAAAG,WAAAC,GAAA;QAAA,OAAAL,WAAA,CAAAnB,KAAA,OAAAC,SAAA;MAAA;MAAA,OAAAsB,UAAA;IAAA;EAAA;EAAA,OAAAlD,kBAAA;AAAA;AAAAoD,OAAA,CAAApD,kBAAA,GAAAA,kBAAA"}
@@ -1,44 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.FilePolyfill = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
11
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
- var _blob = require("./blob");
16
- var _Symbol$toStringTag;
17
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
18
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
19
- _Symbol$toStringTag = Symbol.toStringTag;
20
- var FilePolyfill = function (_BlobPolyfill) {
21
- (0, _inherits2.default)(FilePolyfill, _BlobPolyfill);
22
- var _super = _createSuper(FilePolyfill);
23
- function FilePolyfill(init, name) {
24
- var _this;
25
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
26
- (0, _classCallCheck2.default)(this, FilePolyfill);
27
- _this = _super.call(this, init, options);
28
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "name", '');
29
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "webkitRelativePath", '');
30
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "lastModified", void 0);
31
- _this.name = String(name).replace(/\//g, ':');
32
- _this.lastModified = (options === null || options === void 0 ? void 0 : options.lastModified) || Date.now();
33
- return _this;
34
- }
35
- (0, _createClass2.default)(FilePolyfill, [{
36
- key: _Symbol$toStringTag,
37
- get: function get() {
38
- return 'File';
39
- }
40
- }]);
41
- return FilePolyfill;
42
- }(_blob.BlobPolyfill);
43
- exports.FilePolyfill = FilePolyfill;
44
- //# sourceMappingURL=file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.js","names":["_blob","require","_Symbol$toStringTag","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","prototype","valueOf","call","e","Symbol","toStringTag","FilePolyfill","_BlobPolyfill","_inherits2","_super","init","name","_this","options","length","undefined","_classCallCheck2","_defineProperty2","_assertThisInitialized2","String","replace","lastModified","Date","now","_createClass2","key","get","BlobPolyfill","exports"],"sources":["../../../../src/node/file/file.ts"],"sourcesContent":["// Forked from @gozala's web-file under MIT license https://github.com/Gozala/web-file\nimport {BlobPolyfill} from './blob';\n\n/**\n * Forked from @gozala's web-file under MIT license\n * @see https://github.com/Gozala/web-file\n */\n// @ts-ignore\nexport class FilePolyfill extends BlobPolyfill {\n // implements File {\n // public API\n /** The name of the file referenced by the File object. */\n name: string = '';\n /** The path the URL of the File is relative to. */\n webkitRelativePath: string = '';\n\n /**\n * Returns the last modified time of the file, in millisecond since the UNIX\n * epoch (January 1st, 1970 at Midnight).\n */\n lastModified: number;\n\n /**\n * @param init\n * @param name - A USVString representing the file name or the path\n * to the file.\n * @param [options]\n */\n constructor(init: BlobPart[], name: string, options: FilePropertyBag = {}) {\n super(init, options);\n // Per File API spec https://w3c.github.io/FileAPI/#file-constructor\n // Every \"/\" character of file name must be replaced with a \":\".\n /** @private */\n this.name = String(name).replace(/\\//g, ':');\n /** @private */\n this.lastModified = options?.lastModified || Date.now();\n }\n\n get [Symbol.toStringTag]() {\n return 'File';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAAoC,IAAAC,mBAAA;AAAA,SAAAC,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAN,OAAA,GAAAO,MAAA,MAAAN,yBAAA,QAAAO,SAAA,OAAAH,gBAAA,CAAAC,OAAA,Q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AAO,CAAC,KAAK,EAAE,GAAG,CAAC;IAE5CR,KAAA,CAAKS,YAAY,GAAG,CAAAR,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEQ,YAAY,KAAIC,IAAI,CAACC,GAAG,CAAC,CAAC;IAAC,OAAAX,KAAA;EAC1D;EAAC,IAAAY,aAAA,CAAApC,OAAA,EAAAkB,YAAA;IAAAmB,GAAA,EAAA7C,mBAAA;IAAA8C,GAAA,EAED,SAAAA,IAAA,EAA2B;MACzB,OAAO,MAAM;IACf;EAAC;EAAA,OAAApB,YAAA;AAAA,EAhC+BqB,kBAAY;AAAAC,OAAA,CAAAtB,YAAA,GAAAA,YAAA"}
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.installFilePolyfills = installFilePolyfills;
7
- var _blob = require("./blob");
8
- var _fileReader = require("./file-reader");
9
- var _file = require("./file");
10
- function installFilePolyfills() {
11
- if (typeof ReadableStream === 'undefined' && global) {}
12
- if (typeof Blob === 'undefined' && global) {
13
- global.Blob = _blob.BlobPolyfill;
14
- }
15
- if (typeof FileReader === 'undefined' && global) {
16
- global.FileReader = _fileReader.FileReaderPolyfill;
17
- }
18
- if (typeof File === 'undefined' && global) {
19
- global.File = _file.FilePolyfill;
20
- }
21
- }
22
- //# sourceMappingURL=install-file-polyfills.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install-file-polyfills.js","names":["_blob","require","_fileReader","_file","installFilePolyfills","ReadableStream","global","Blob","BlobPolyfill","FileReader","FileReaderPolyfill","File","FilePolyfill"],"sources":["../../../../src/node/file/install-file-polyfills.ts"],"sourcesContent":["// import {ReadableStreamPolyfill} from './readable-stream';\nimport {BlobPolyfill} from './blob';\nimport {FileReaderPolyfill} from './file-reader';\nimport {FilePolyfill} from './file';\n\nexport function installFilePolyfills() {\n if (typeof ReadableStream === 'undefined' && global) {\n // @ts-ignore;\n // global.ReadableStream = ReadableStreamPolyfill;\n }\n\n if (typeof Blob === 'undefined' && global) {\n // @ts-ignore;\n global.Blob = BlobPolyfill;\n }\n\n if (typeof FileReader === 'undefined' && global) {\n // @ts-ignore;\n global.FileReader = FileReaderPolyfill;\n }\n\n // Install minimal Node.js File polyfill\n if (typeof File === 'undefined' && global) {\n // @ts-ignore;\n global.File = FilePolyfill;\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAEO,SAASG,oBAAoBA,CAAA,EAAG;EACrC,IAAI,OAAOC,cAAc,KAAK,WAAW,IAAIC,MAAM,EAAE,CAGrD;EAEA,IAAI,OAAOC,IAAI,KAAK,WAAW,IAAID,MAAM,EAAE;IAEzCA,MAAM,CAACC,IAAI,GAAGC,kBAAY;EAC5B;EAEA,IAAI,OAAOC,UAAU,KAAK,WAAW,IAAIH,MAAM,EAAE;IAE/CA,MAAM,CAACG,UAAU,GAAGC,8BAAkB;EACxC;EAGA,IAAI,OAAOC,IAAI,KAAK,WAAW,IAAIL,MAAM,EAAE;IAEzCA,MAAM,CAACK,IAAI,GAAGC,kBAAY;EAC5B;AACF"}
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.ReadableStreamPolyfill = void 0;
8
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
9
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
11
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
13
- var _webStreamsPolyfill = require("web-streams-polyfill");
14
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
15
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16
- delete global.ReadableStream;
17
- var ReadableStreamPolyfill = function (_WSPReadableStream) {
18
- (0, _inherits2.default)(ReadableStreamPolyfill, _WSPReadableStream);
19
- var _super = _createSuper(ReadableStreamPolyfill);
20
- function ReadableStreamPolyfill() {
21
- (0, _classCallCheck2.default)(this, ReadableStreamPolyfill);
22
- return _super.apply(this, arguments);
23
- }
24
- return (0, _createClass2.default)(ReadableStreamPolyfill);
25
- }(_webStreamsPolyfill.ReadableStream);
26
- exports.ReadableStreamPolyfill = ReadableStreamPolyfill;
27
- //# sourceMappingURL=readable-stream.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"readable-stream.js","names":["_webStreamsPolyfill","require","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","prototype","valueOf","call","e","global","ReadableStream","ReadableStreamPolyfill","_WSPReadableStream","_inherits2","_super","_classCallCheck2","_createClass2","WSPReadableStream","exports"],"sources":["../../../../src/node/file/readable-stream.ts"],"sourcesContent":["import {ReadableStream as WSPReadableStream} from 'web-streams-polyfill';\n\n// Want a polyfill, but please don't install it\n// @ts-ignore\ndelete global.ReadableStream;\n\n// @ts-ignore\nexport class ReadableStreamPolyfill<T> extends WSPReadableStream<T> implements ReadableStream {}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAAyE,SAAAC,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAN,OAAA,GAAAO,MAAA,MAAAN,yBAAA,QAAAO,SAAA,OAAAH,gBAAA,CAAAC,OAAA,QAAAG,WAAA,EAAAF,MAAA,GAAAG,OAAA,CAAAC,SAAA,CAAAP,KAAA,EAAAQ,SAAA,EAAAJ,SAAA,YAAAD,MAAA,GAAAH,KAAA,CAAAS,KAAA,OAAAD,SAAA,gBAAAE,2BAAA,CAAAR,OAAA,QAAAC,MAAA;AAAA,SAAAL,0BAAA,eAAAQ,OAAA,qBAAAA,OAAA,CAAAC,SAAA,oBAAAD,OAAA,CAAAC,SAAA,CAAAI,IAAA,2BAAAC,KAAA,oCAAAC,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAV,OAAA,CAAAC,SAAA,CAAAM,OAAA,8CAAAI,CAAA;AAIzE,OAAOC,MAAM,CAACC,cAAc;AAAC,IAGhBC,sBAAsB,aAAAC,kBAAA;EAAA,IAAAC,UAAA,CAAApB,OAAA,EAAAkB,sBAAA,EAAAC,kBAAA;EAAA,IAAAE,MAAA,GAAA5B,YAAA,CAAAyB,sBAAA;EAAA,SAAAA,uBAAA;IAAA,IAAAI,gBAAA,CAAAtB,OAAA,QAAAkB,sBAAA;IAAA,OAAAG,MAAA,CAAAd,KAAA,OAAAD,SAAA;EAAA;EAAA,WAAAiB,aAAA,CAAAvB,OAAA,EAAAkB,sBAAA;AAAA,EAAYM,kCAAiB;AAAAC,OAAA,CAAAP,sBAAA,GAAAA,sBAAA"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.encodeImageNode = encodeImageNode;
8
- exports.encodeImageToStreamNode = encodeImageToStreamNode;
9
- var _savePixels = _interopRequireDefault(require("save-pixels"));
10
- var _ndarray = _interopRequireDefault(require("ndarray"));
11
- var _toArrayBuffer = require("../buffer/to-array-buffer.node");
12
- function encodeImageToStreamNode(image, options) {
13
- var type = options.type ? options.type.replace('image/', '') : 'jpeg';
14
- var pixels = (0, _ndarray.default)(image.data, [image.width, image.height, 4], [4, image.width * 4, 1], 0);
15
- return (0, _savePixels.default)(pixels, type, options);
16
- }
17
- function encodeImageNode(image, options) {
18
- var imageStream = encodeImageToStreamNode(image, options);
19
- return new Promise(function (resolve) {
20
- var buffers = [];
21
- imageStream.on('data', function (buffer) {
22
- return buffers.push(buffer);
23
- });
24
- imageStream.on('end', function () {
25
- var buffer = Buffer.concat(buffers);
26
- resolve((0, _toArrayBuffer.bufferToArrayBuffer)(buffer));
27
- });
28
- });
29
- }
30
- //# sourceMappingURL=encode-image.node.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encode-image.node.js","names":["_savePixels","_interopRequireDefault","require","_ndarray","_toArrayBuffer","encodeImageToStreamNode","image","options","type","replace","pixels","ndarray","data","width","height","savePixels","encodeImageNode","imageStream","Promise","resolve","buffers","on","buffer","push","Buffer","concat","bufferToArrayBuffer"],"sources":["../../../../src/node/images/encode-image.node.ts"],"sourcesContent":["// Use stackgl modules for DOM-less reading and writing of images\n\nimport savePixels from 'save-pixels';\nimport ndarray from 'ndarray';\nimport {bufferToArrayBuffer} from '../buffer/to-array-buffer.node';\n\n/**\n * Returns data bytes representing a compressed image in PNG or JPG format,\n * This data can be saved using file system (f) methods or\n * used in a request.\n * @param image to save\n * @param options\n * @param options.type='png' - png, jpg or image/png, image/jpg are valid\n * @param options.dataURI - Whether to include a data URI header\n * @return {*} bytes\n */\nexport function encodeImageToStreamNode(\n image: {data: any; width: number; height: number},\n options: {type?: string; dataURI?: string}\n) {\n // Support MIME type strings\n const type = options.type ? options.type.replace('image/', '') : 'jpeg';\n const pixels = ndarray(image.data, [image.width, image.height, 4], [4, image.width * 4, 1], 0);\n\n // Note: savePixels returns a stream\n return savePixels(pixels, type, options);\n}\n\nexport function encodeImageNode(image, options) {\n const imageStream = encodeImageToStreamNode(image, options);\n\n return new Promise((resolve) => {\n const buffers: any[] = [];\n imageStream.on('data', (buffer) => buffers.push(buffer));\n // TODO - convert to arraybuffer?\n imageStream.on('end', () => {\n const buffer = Buffer.concat(buffers);\n resolve(bufferToArrayBuffer(buffer));\n });\n });\n}\n"],"mappings":";;;;;;;;AAEA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAYO,SAASG,uBAAuBA,CACrCC,KAAiD,EACjDC,OAA0C,EAC1C;EAEA,IAAMC,IAAI,GAAGD,OAAO,CAACC,IAAI,GAAGD,OAAO,CAACC,IAAI,CAACC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,GAAG,MAAM;EACvE,IAAMC,MAAM,GAAG,IAAAC,gBAAO,EAACL,KAAK,CAACM,IAAI,EAAE,CAACN,KAAK,CAACO,KAAK,EAAEP,KAAK,CAACQ,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAER,KAAK,CAACO,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;EAG9F,OAAO,IAAAE,mBAAU,EAACL,MAAM,EAAEF,IAAI,EAAED,OAAO,CAAC;AAC1C;AAEO,SAASS,eAAeA,CAACV,KAAK,EAAEC,OAAO,EAAE;EAC9C,IAAMU,WAAW,GAAGZ,uBAAuB,CAACC,KAAK,EAAEC,OAAO,CAAC;EAE3D,OAAO,IAAIW,OAAO,CAAC,UAACC,OAAO,EAAK;IAC9B,IAAMC,OAAc,GAAG,EAAE;IACzBH,WAAW,CAACI,EAAE,CAAC,MAAM,EAAE,UAACC,MAAM;MAAA,OAAKF,OAAO,CAACG,IAAI,CAACD,MAAM,CAAC;IAAA,EAAC;IAExDL,WAAW,CAACI,EAAE,CAAC,KAAK,EAAE,YAAM;MAC1B,IAAMC,MAAM,GAAGE,MAAM,CAACC,MAAM,CAACL,OAAO,CAAC;MACrCD,OAAO,CAAC,IAAAO,kCAAmB,EAACJ,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ"}
@@ -1,64 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.NODE_FORMAT_SUPPORT = void 0;
8
- exports.parseImageNode = parseImageNode;
9
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
- var _getPixels = _interopRequireDefault(require("get-pixels"));
13
- var NODE_FORMAT_SUPPORT = ['image/png', 'image/jpeg', 'image/gif'];
14
- exports.NODE_FORMAT_SUPPORT = NODE_FORMAT_SUPPORT;
15
- function parseImageNode(_x, _x2) {
16
- return _parseImageNode.apply(this, arguments);
17
- }
18
- function _parseImageNode() {
19
- _parseImageNode = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(arrayBuffer, mimeType) {
20
- var buffer, ndarray;
21
- return _regenerator.default.wrap(function _callee$(_context) {
22
- while (1) switch (_context.prev = _context.next) {
23
- case 0:
24
- if (mimeType) {
25
- _context.next = 2;
26
- break;
27
- }
28
- throw new Error('MIMEType is required to parse image under Node.js');
29
- case 2:
30
- buffer = arrayBuffer instanceof Buffer ? arrayBuffer : Buffer.from(arrayBuffer);
31
- _context.next = 5;
32
- return getPixelsAsync(buffer, mimeType);
33
- case 5:
34
- ndarray = _context.sent;
35
- return _context.abrupt("return", ndarray);
36
- case 7:
37
- case "end":
38
- return _context.stop();
39
- }
40
- }, _callee);
41
- }));
42
- return _parseImageNode.apply(this, arguments);
43
- }
44
- function getPixelsAsync(buffer, mimeType) {
45
- return new Promise(function (resolve) {
46
- return (0, _getPixels.default)(buffer, mimeType, function (err, ndarray) {
47
- if (err) {
48
- throw err;
49
- }
50
- var shape = (0, _toConsumableArray2.default)(ndarray.shape);
51
- var layers = ndarray.shape.length === 4 ? ndarray.shape.shift() : 1;
52
- var data = ndarray.data instanceof Buffer ? new Uint8Array(ndarray.data) : ndarray.data;
53
- resolve({
54
- shape: shape,
55
- data: data,
56
- width: ndarray.shape[0],
57
- height: ndarray.shape[1],
58
- components: ndarray.shape[2],
59
- layers: layers ? [layers] : []
60
- });
61
- });
62
- });
63
- }
64
- //# sourceMappingURL=parse-image.node.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-image.node.js","names":["_getPixels","_interopRequireDefault","require","NODE_FORMAT_SUPPORT","exports","parseImageNode","_x","_x2","_parseImageNode","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","arrayBuffer","mimeType","buffer","ndarray","wrap","_callee$","_context","prev","next","Error","Buffer","from","getPixelsAsync","sent","abrupt","stop","Promise","resolve","getPixels","err","shape","_toConsumableArray2","layers","length","shift","data","Uint8Array","width","height","components"],"sources":["../../../../src/node/images/parse-image.node.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport getPixels from 'get-pixels';\n\n/** Declares which image format mime types this loader polyfill supports */\nexport const NODE_FORMAT_SUPPORT = ['image/png', 'image/jpeg', 'image/gif'];\n\n// Note: These types are also defined in @loaders.gl/images and need to be kept in sync\ntype NDArray = {\n shape: number[];\n data: Uint8Array;\n width: number;\n height: number;\n components: number;\n layers: number[];\n};\n\nexport async function parseImageNode(arrayBuffer: ArrayBuffer, mimeType: string): Promise<NDArray> {\n if (!mimeType) {\n throw new Error('MIMEType is required to parse image under Node.js');\n }\n\n const buffer = arrayBuffer instanceof Buffer ? arrayBuffer : Buffer.from(arrayBuffer);\n const ndarray = await getPixelsAsync(buffer, mimeType);\n return ndarray;\n}\n\n// TODO - check if getPixels callback is asynchronous if provided with buffer input\n// if not, parseImage can be a sync function\nfunction getPixelsAsync(buffer: Buffer, mimeType: string): Promise<NDArray> {\n return new Promise<NDArray>((resolve) =>\n getPixels(buffer, mimeType, (err, ndarray) => {\n if (err) {\n throw err;\n }\n\n const shape = [...ndarray.shape];\n const layers = ndarray.shape.length === 4 ? ndarray.shape.shift() : 1;\n const data = ndarray.data instanceof Buffer ? new Uint8Array(ndarray.data) : ndarray.data;\n\n // extract width/height etc\n resolve({\n shape,\n data,\n width: ndarray.shape[0],\n height: ndarray.shape[1],\n components: ndarray.shape[2],\n // TODO - error\n layers: layers ? [layers] : []\n });\n })\n );\n}\n"],"mappings":";;;;;;;;;;;AAEA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGO,IAAMC,mBAAmB,GAAG,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,CAAC;AAACC,OAAA,CAAAD,mBAAA,GAAAA,mBAAA;AAAA,SAYtDE,cAAcA,CAAAC,EAAA,EAAAC,GAAA;EAAA,OAAAC,eAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,gBAAA;EAAAA,eAAA,OAAAG,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAA7B,SAAAC,QAA8BC,WAAwB,EAAEC,QAAgB;IAAA,IAAAC,MAAA,EAAAC,OAAA;IAAA,OAAAN,YAAA,CAAAD,OAAA,CAAAQ,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAAA,IACxEP,QAAQ;YAAAK,QAAA,CAAAE,IAAA;YAAA;UAAA;UAAA,MACL,IAAIC,KAAK,CAAC,mDAAmD,CAAC;QAAA;UAGhEP,MAAM,GAAGF,WAAW,YAAYU,MAAM,GAAGV,WAAW,GAAGU,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GAAG;MAC9B,CAAC,CAAC;IACJ,CAAC,CAAC;EAAA,CACJ,CAAC;AACH"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.REJECTED_STATUS = exports.FULFILLED_STATUS = void 0;
7
- exports.allSettled = allSettled;
8
- var REJECTED_STATUS = 'rejected';
9
- exports.REJECTED_STATUS = REJECTED_STATUS;
10
- var FULFILLED_STATUS = 'fulfilled';
11
- exports.FULFILLED_STATUS = FULFILLED_STATUS;
12
- function allSettled(promises) {
13
- var mappedPromises = promises.map(function (promise) {
14
- return promise.then(function (value) {
15
- return {
16
- status: FULFILLED_STATUS,
17
- value: value
18
- };
19
- }).catch(function (reason) {
20
- return {
21
- status: REJECTED_STATUS,
22
- reason: reason
23
- };
24
- });
25
- });
26
- return Promise.all(mappedPromises);
27
- }
28
- //# sourceMappingURL=all-settled.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"all-settled.js","names":["REJECTED_STATUS","exports","FULFILLED_STATUS","allSettled","promises","mappedPromises","map","promise","then","value","status","catch","reason","Promise","all"],"sources":["../../../src/promise/all-settled.ts"],"sourcesContent":["export const REJECTED_STATUS = 'rejected';\nexport const FULFILLED_STATUS = 'fulfilled';\n\n/**\n * Handle list of promises and return all values regardless of results.\n * Polyfill for Promise.allSettled() method.\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled\n * @param promises\n */\nexport function allSettled(promises: Promise<any>[]): Promise<any> {\n const mappedPromises = promises.map((promise) => {\n return promise\n .then((value) => {\n return {status: FULFILLED_STATUS, value};\n })\n .catch((reason) => {\n return {status: REJECTED_STATUS, reason};\n });\n });\n return Promise.all(mappedPromises);\n}\n"],"mappings":";;;;;;;AAAO,IAAMA,eAAe,GAAG,UAAU;AAACC,OAAA,CAAAD,eAAA,GAAAA,eAAA;AACnC,IAAME,gBAAgB,GAAG,WAAW;AAACD,OAAA,CAAAC,gBAAA,GAAAA,gBAAA;AAQrC,SAASC,UAAUA,CAACC,QAAwB,EAAgB;EACjE,IAAMC,cAAc,GAAGD,QAAQ,CAACE,GAAG,CAAC,UAACC,OAAO,EAAK;IAC/C,OAAOA,OAAO,CACXC,IAAI,CAAC,UAACC,KAAK,EAAK;MACf,OAAO;QAACC,MAAM,EAAER,gBAAgB;QAAEO,KAAK,EAALA;MAAK,CAAC;IAC1C,CAAC,CAAC,CACDE,KAAK,CAAC,UAACC,MAAM,EAAK;MACjB,OAAO;QAACF,MAAM,EAAEV,eAAe;QAAEY,MAAM,EAANA;MAAM,CAAC;IAC1C,CAAC,CAAC;EACN,CAAC,CAAC;EACF,OAAOC,OAAO,CAACC,GAAG,CAACT,cAAc,CAAC;AACpC"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.assert = assert;
7
- function assert(condition, message) {
8
- if (!condition) {
9
- throw new Error("@loaders.gl/polyfills assertion ".concat(message));
10
- }
11
- }
12
- //# sourceMappingURL=assert.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assert.js","names":["assert","condition","message","Error","concat"],"sources":["../../../src/utils/assert.ts"],"sourcesContent":["export function assert(condition: any, message?: string): void {\n if (!condition) {\n throw new Error(`@loaders.gl/polyfills assertion ${message}`);\n }\n}\n"],"mappings":";;;;;;AAAO,SAASA,MAAMA,CAACC,SAAc,EAAEC,OAAgB,EAAQ;EAC7D,IAAI,CAACD,SAAS,EAAE;IACd,MAAM,IAAIE,KAAK,oCAAAC,MAAA,CAAoCF,OAAO,CAAE,CAAC;EAC/D;AACF"}
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.isBrowser = exports.global = void 0;
8
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
- var isBrowser = (typeof process === "undefined" ? "undefined" : (0, _typeof2.default)(process)) !== 'object' || String(process) !== '[object process]' || process.browser;
10
- exports.isBrowser = isBrowser;
11
- var globals = {
12
- self: typeof self !== 'undefined' && self,
13
- window: typeof window !== 'undefined' && window,
14
- global: typeof global !== 'undefined' && global
15
- };
16
- var global_ = globals.global || globals.self || globals.window;
17
- exports.global = global_;
18
- //# sourceMappingURL=globals.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"globals.js","names":["isBrowser","process","_typeof2","default","String","browser","exports","globals","self","window","global","global_"],"sources":["../../../src/utils/globals.ts"],"sourcesContent":["// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n// Purpose: include this in your module to avoids adding dependencies on\n// micro modules like 'global' and 'is-browser';\n\n/* eslint-disable no-restricted-globals */\nconst isBrowser: boolean =\n // @ts-ignore process.browser\n typeof process !== 'object' || String(process) !== '[object process]' || process.browser;\n\nconst globals = {\n self: typeof self !== 'undefined' && self,\n window: typeof window !== 'undefined' && window,\n global: typeof global !== 'undefined' && global\n};\n\nconst global_: object = (globals.global || globals.self || globals.window) as object;\n\nexport {isBrowser, global_ as global};\n"],"mappings":";;;;;;;;AAwBA,IAAMA,SAAkB,GAEtB,QAAOC,OAAO,qCAAAC,QAAA,CAAAC,OAAA,EAAPF,OAAO,OAAK,QAAQ,IAAIG,MAAM,CAACH,OAAO,CAAC,KAAK,kBAAkB,IAAIA,OAAO,CAACI,OAAO;AAACC,OAAA,CAAAN,SAAA,GAAAA,SAAA;AAE3F,IAAMO,OAAO,GAAG;EACdC,IAAI,EAAE,OAAOA,IAAI,KAAK,WAAW,IAAIA,IAAI;EACzCC,MAAM,EAAE,OAAOA,MAAM,KAAK,WAAW,IAAIA,MAAM;EAC/CC,MAAM,EAAE,OAAOA,MAAM,KAAK,WAAW,IAAIA;AAC3C,CAAC;AAED,IAAMC,OAAe,GAAIJ,OAAO,CAACG,MAAM,IAAIH,OAAO,CAACC,IAAI,IAAID,OAAO,CAACE,MAAiB;AAACH,OAAA,CAAAI,MAAA,GAAAC,OAAA"}
@@ -1,4 +0,0 @@
1
- const moduleExports = require('./index');
2
- globalThis.loaders = globalThis.loaders || {};
3
- module.exports = Object.assign(globalThis.loaders, moduleExports);
4
- //# sourceMappingURL=bundle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundle.js","names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"sources":["../../src/bundle.ts"],"sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"mappings":"AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAS,CAAC;AACxCC,UAAU,CAACC,OAAO,GAAGD,UAAU,CAACC,OAAO,IAAI,CAAC,CAAC;AAC7CC,MAAM,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAACL,UAAU,CAACC,OAAO,EAAEH,aAAa,CAAC"}
package/dist/esm/index.js DELETED
@@ -1,46 +0,0 @@
1
- import { isBrowser, global } from './utils/globals';
2
- import { TextDecoder, TextEncoder } from './lib/encoding';
3
- import { allSettled } from './promise/all-settled';
4
- import * as base64 from './node/buffer/btoa.node';
5
- import { Headers as HeadersNode } from './node/fetch/headers.node';
6
- import { Response as ResponseNode } from './node/fetch/response.node';
7
- import { fetchNode } from './node/fetch/fetch.node';
8
- import { encodeImageNode } from './node/images/encode-image.node';
9
- import { parseImageNode, NODE_FORMAT_SUPPORT } from './node/images/parse-image.node';
10
- export { FileReaderPolyfill } from './node/file/file-reader';
11
- export { FilePolyfill } from './node/file/file';
12
- export { installFilePolyfills } from './node/file/install-file-polyfills';
13
- const installTextEncoder = !isBrowser || !('TextEncoder' in global);
14
- if (installTextEncoder) {
15
- global['TextEncoder'] = TextEncoder;
16
- }
17
- const installTextDecoder = !isBrowser || !('TextDecoder' in global);
18
- if (installTextDecoder) {
19
- global['TextDecoder'] = TextDecoder;
20
- }
21
- if (!isBrowser && !('atob' in global) && base64.atob) {
22
- global['atob'] = base64.atob;
23
- }
24
- if (!isBrowser && !('btoa' in global) && base64.btoa) {
25
- global['btoa'] = base64.btoa;
26
- }
27
- if (!isBrowser && !('Headers' in global) && HeadersNode) {
28
- global['Headers'] = HeadersNode;
29
- }
30
- if (!isBrowser && !('Response' in global) && ResponseNode) {
31
- global['Response'] = ResponseNode;
32
- }
33
- if (!isBrowser && !('fetch' in global) && fetchNode) {
34
- global['fetch'] = fetchNode;
35
- }
36
- if (!isBrowser && !('_encodeImageNode' in global) && encodeImageNode) {
37
- global['_encodeImageNode'] = encodeImageNode;
38
- }
39
- if (!isBrowser && !('_parseImageNode' in global) && parseImageNode) {
40
- global['_parseImageNode'] = parseImageNode;
41
- global['_imageFormatsNode'] = NODE_FORMAT_SUPPORT;
42
- }
43
- if (!('allSettled' in Promise)) {
44
- Promise.allSettled = allSettled;
45
- }
46
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["isBrowser","global","TextDecoder","TextEncoder","allSettled","base64","Headers","HeadersNode","Response","ResponseNode","fetchNode","encodeImageNode","parseImageNode","NODE_FORMAT_SUPPORT","FileReaderPolyfill","FilePolyfill","installFilePolyfills","installTextEncoder","installTextDecoder","atob","btoa","Promise"],"sources":["../../src/index.ts"],"sourcesContent":["/* eslint-disable dot-notation */\nimport {isBrowser, global} from './utils/globals';\n\nimport {TextDecoder, TextEncoder} from './lib/encoding';\nimport {allSettled} from './promise/all-settled';\n\n// Node specific\nimport * as base64 from './node/buffer/btoa.node';\n\nimport {Headers as HeadersNode} from './node/fetch/headers.node';\nimport {Response as ResponseNode} from './node/fetch/response.node';\nimport {fetchNode as fetchNode} from './node/fetch/fetch.node';\n\nimport {encodeImageNode} from './node/images/encode-image.node';\nimport {parseImageNode, NODE_FORMAT_SUPPORT} from './node/images/parse-image.node';\n\n// export {ReadableStreamPolyfill} from './node/file/readable-stream';\n// export {BlobPolyfill} from './node/file/blob';\nexport {FileReaderPolyfill} from './node/file/file-reader';\nexport {FilePolyfill} from './node/file/file';\nexport {installFilePolyfills} from './node/file/install-file-polyfills';\n\n// POLYFILLS: TextEncoder, TextDecoder\n// - Recent Node versions have these classes but virtually no encodings unless special build.\n// - Browser: Edge, IE11 do not have these\n\nconst installTextEncoder = !isBrowser || !('TextEncoder' in global);\nif (installTextEncoder) {\n global['TextEncoder'] = TextEncoder;\n}\n\nconst installTextDecoder = !isBrowser || !('TextDecoder' in global);\nif (installTextDecoder) {\n global['TextDecoder'] = TextDecoder;\n}\n\n// POLYFILLS: btoa, atob\n// - Node: Yes\n// - Browser: No\n\nif (!isBrowser && !('atob' in global) && base64.atob) {\n global['atob'] = base64.atob;\n}\nif (!isBrowser && !('btoa' in global) && base64.btoa) {\n global['btoa'] = base64.btoa;\n}\n\n// DEPRECATED POLYFILL:\n// - Node v18+: No, not needed\n// - Node v16 and lower: Yes\n// - Browsers (evergreen): Not needed.\n// - IE11: No. This polyfill is node only, install external polyfill\n\nif (!isBrowser && !('Headers' in global) && HeadersNode) {\n global['Headers'] = HeadersNode;\n}\n\nif (!isBrowser && !('Response' in global) && ResponseNode) {\n global['Response'] = ResponseNode;\n}\n\nif (!isBrowser && !('fetch' in global) && fetchNode) {\n global['fetch'] = fetchNode;\n}\n\n// NODE IMAGE FUNCTIONS:\n// These are not official polyfills but used by the @loaders.gl/images module if installed\n// TODO - is there an appropriate Image API we could polyfill using an adapter?\n\nif (!isBrowser && !('_encodeImageNode' in global) && encodeImageNode) {\n global['_encodeImageNode'] = encodeImageNode;\n}\n\nif (!isBrowser && !('_parseImageNode' in global) && parseImageNode) {\n global['_parseImageNode'] = parseImageNode;\n global['_imageFormatsNode'] = NODE_FORMAT_SUPPORT;\n}\n\nif (!('allSettled' in Promise)) {\n // @ts-ignore\n Promise.allSettled = allSettled;\n}\n"],"mappings":"AACA,SAAQA,SAAS,EAAEC,MAAM,QAAO,iBAAiB;AAEjD,SAAQC,WAAW,EAAEC,WAAW,QAAO,gBAAgB;AACvD,SAAQC,UAAU,QAAO,uBAAuB;AAGhD,OAAO,KAAKC,MAAM,MAAM,yBAAyB;AAEjD,SAAQC,OAAO,IAAIC,WAAW,QAAO,2BAA2B;AAChE,SAAQC,QAAQ,IAAIC,YAAY,QAAO,4BAA4B;AACnE,SAAQC,SAAsB,QAAO,yBAAyB;AAE9D,SAAQC,eAAe,QAAO,iCAAiC;AAC/D,SAAQC,cAAc,EAAEC,mBAAmB,QAAO,gCAAgC;AAIlF,SAAQC,kBAAkB,QAAO,yBAAyB;AAC1D,SAAQC,YAAY,QAAO,kBAAkB;AAC7C,SAAQC,oBAAoB,QAAO,oCAAoC;AAMvE,MAAMC,kBAAkB,GAAG,CAACjB,SAAS,IAAI,EAAE,aAAa,IAAIC,MAAM,CAAC;AACnE,IAAIgB,kBAAkB,EAAE;EACtBhB,MAAM,CAAC,aAAa,CAAC,GAAGE,WAAW;AACrC;AAEA,MAAMe,kBAAkB,GAAG,CAAClB,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