@loaders.gl/core 4.0.0-beta.2 → 4.0.0-beta.4

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 (403) hide show
  1. package/dist/core-addons/write-file-browser.d.ts.map +1 -0
  2. package/dist/core-addons/write-file-browser.js.map +1 -0
  3. package/dist/{dist.min.js → dist.dev.js} +1477 -1920
  4. package/dist/index.cjs +1576 -0
  5. package/dist/{src/index.d.ts → index.d.ts} +2 -5
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +28 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/iterators/batch-iterators/timed-batch-iterator.d.ts.map +1 -0
  10. package/dist/iterators/batch-iterators/timed-batch-iterator.js.map +1 -0
  11. package/dist/iterators/make-iterator/make-array-buffer-iterator.d.ts.map +1 -0
  12. package/dist/iterators/make-iterator/make-array-buffer-iterator.js.map +1 -0
  13. package/dist/iterators/make-iterator/make-blob-iterator.d.ts.map +1 -0
  14. package/dist/iterators/make-iterator/make-blob-iterator.js.map +1 -0
  15. package/dist/iterators/make-iterator/make-iterator.d.ts.map +1 -0
  16. package/dist/{esm/iterators → iterators}/make-iterator/make-iterator.js +5 -5
  17. package/dist/iterators/make-iterator/make-iterator.js.map +1 -0
  18. package/dist/iterators/make-iterator/make-stream-iterator.d.ts.map +1 -0
  19. package/dist/iterators/make-iterator/make-stream-iterator.js.map +1 -0
  20. package/dist/iterators/make-iterator/make-string-iterator.d.ts.map +1 -0
  21. package/dist/iterators/make-iterator/make-string-iterator.js.map +1 -0
  22. package/dist/{src/iterators/make-stream/make-dom-stream.d.ts → iterators/make-stream/make-stream.d.ts} +1 -1
  23. package/dist/iterators/make-stream/make-stream.d.ts.map +1 -0
  24. package/dist/{esm/iterators/make-stream/make-dom-stream.js → iterators/make-stream/make-stream.js} +4 -1
  25. package/dist/iterators/make-stream/make-stream.js.map +1 -0
  26. package/dist/javascript-utils/is-type.d.ts.map +1 -0
  27. package/dist/javascript-utils/is-type.js.map +1 -0
  28. package/dist/lib/api/encode-table.d.ts.map +1 -0
  29. package/dist/{esm/lib → lib}/api/encode-table.js +1 -1
  30. package/dist/lib/api/encode-table.js.map +1 -0
  31. package/dist/lib/api/encode.d.ts.map +1 -0
  32. package/dist/{esm/lib → lib}/api/encode.js +8 -8
  33. package/dist/lib/api/encode.js.map +1 -0
  34. package/dist/lib/api/load-in-batches.d.ts.map +1 -0
  35. package/dist/{esm/lib → lib}/api/load-in-batches.js +3 -3
  36. package/dist/lib/api/load-in-batches.js.map +1 -0
  37. package/dist/lib/api/load.d.ts.map +1 -0
  38. package/dist/{esm/lib → lib}/api/load.js +4 -4
  39. package/dist/{es5/lib → lib}/api/load.js.map +1 -1
  40. package/dist/lib/api/loader-options.d.ts.map +1 -0
  41. package/dist/lib/api/loader-options.js +3 -0
  42. package/dist/lib/api/loader-options.js.map +1 -0
  43. package/dist/lib/api/parse-in-batches.d.ts.map +1 -0
  44. package/dist/{esm/lib → lib}/api/parse-in-batches.js +7 -7
  45. package/dist/lib/api/parse-in-batches.js.map +1 -0
  46. package/dist/lib/api/parse-sync.d.ts.map +1 -0
  47. package/dist/{esm/lib → lib}/api/parse-sync.js +7 -7
  48. package/dist/lib/api/parse-sync.js.map +1 -0
  49. package/dist/lib/api/parse.d.ts.map +1 -0
  50. package/dist/{esm/lib → lib}/api/parse.js +8 -8
  51. package/dist/lib/api/parse.js.map +1 -0
  52. package/dist/lib/api/register-loaders.d.ts.map +1 -0
  53. package/dist/{esm/lib → lib}/api/register-loaders.js +2 -2
  54. package/dist/lib/api/register-loaders.js.map +1 -0
  55. package/dist/lib/api/select-loader.d.ts.map +1 -0
  56. package/dist/{esm/lib → lib}/api/select-loader.js +16 -16
  57. package/dist/lib/api/select-loader.js.map +1 -0
  58. package/dist/lib/common.d.ts.map +1 -0
  59. package/dist/lib/common.js.map +1 -0
  60. package/dist/lib/fetch/fetch-error-message.d.ts.map +1 -0
  61. package/dist/{esm/lib → lib}/fetch/fetch-error-message.js +2 -2
  62. package/dist/lib/fetch/fetch-error-message.js.map +1 -0
  63. package/dist/lib/fetch/fetch-file.d.ts.map +1 -0
  64. package/dist/{esm/lib → lib}/fetch/fetch-file.js +7 -4
  65. package/dist/lib/fetch/fetch-file.js.map +1 -0
  66. package/dist/{src/lib → lib}/fetch/read-array-buffer.d.ts +1 -1
  67. package/dist/lib/fetch/read-array-buffer.d.ts.map +1 -0
  68. package/dist/{esm/lib → lib}/fetch/read-array-buffer.js +0 -4
  69. package/dist/lib/fetch/read-array-buffer.js.map +1 -0
  70. package/dist/{src/lib → lib}/filesystems/browser-filesystem.d.ts +2 -15
  71. package/dist/lib/filesystems/browser-filesystem.d.ts.map +1 -0
  72. package/dist/{esm/lib → lib}/filesystems/browser-filesystem.js +7 -20
  73. package/dist/lib/filesystems/browser-filesystem.js.map +1 -0
  74. package/dist/lib/filesystems/read-array-buffer.d.ts.map +1 -0
  75. package/dist/lib/filesystems/read-array-buffer.js.map +1 -0
  76. package/dist/{src/lib → lib}/init.d.ts.map +1 -1
  77. package/dist/lib/init.js +11 -0
  78. package/dist/lib/init.js.map +1 -0
  79. package/dist/lib/loader-utils/check-errors.d.ts.map +1 -0
  80. package/dist/{esm/lib → lib}/loader-utils/check-errors.js +4 -4
  81. package/dist/lib/loader-utils/check-errors.js.map +1 -0
  82. package/dist/lib/loader-utils/get-data.d.ts.map +1 -0
  83. package/dist/{esm/lib → lib}/loader-utils/get-data.js +3 -3
  84. package/dist/lib/loader-utils/get-data.js.map +1 -0
  85. package/dist/lib/loader-utils/get-fetch-function.d.ts.map +1 -0
  86. package/dist/{esm/lib → lib}/loader-utils/get-fetch-function.js +3 -3
  87. package/dist/lib/loader-utils/get-fetch-function.js.map +1 -0
  88. package/dist/lib/loader-utils/loader-context.d.ts.map +1 -0
  89. package/dist/{esm/lib → lib}/loader-utils/loader-context.js +2 -2
  90. package/dist/lib/loader-utils/loader-context.js.map +1 -0
  91. package/dist/lib/loader-utils/loggers.d.ts.map +1 -0
  92. package/dist/{esm/lib → lib}/loader-utils/loggers.js +1 -2
  93. package/dist/lib/loader-utils/loggers.js.map +1 -0
  94. package/dist/lib/loader-utils/normalize-loader.d.ts.map +1 -0
  95. package/dist/lib/loader-utils/normalize-loader.js.map +1 -0
  96. package/dist/lib/loader-utils/option-defaults.d.ts.map +1 -0
  97. package/dist/{esm/lib → lib}/loader-utils/option-defaults.js +1 -1
  98. package/dist/lib/loader-utils/option-defaults.js.map +1 -0
  99. package/dist/{src/lib → lib}/loader-utils/option-utils.d.ts +1 -1
  100. package/dist/lib/loader-utils/option-utils.d.ts.map +1 -0
  101. package/dist/{esm/lib → lib}/loader-utils/option-utils.js +8 -8
  102. package/dist/lib/loader-utils/option-utils.js.map +1 -0
  103. package/dist/lib/progress/fetch-progress.d.ts.map +1 -0
  104. package/dist/lib/progress/fetch-progress.js.map +1 -0
  105. package/dist/lib/utils/log.d.ts.map +1 -0
  106. package/dist/lib/utils/log.js.map +1 -0
  107. package/dist/lib/utils/mime-type-utils.d.ts.map +1 -0
  108. package/dist/lib/utils/mime-type-utils.js.map +1 -0
  109. package/dist/lib/utils/resource-utils.d.ts.map +1 -0
  110. package/dist/{esm/lib → lib}/utils/resource-utils.js +3 -3
  111. package/dist/lib/utils/resource-utils.js.map +1 -0
  112. package/dist/lib/utils/response-utils.d.ts.map +1 -0
  113. package/dist/{esm/lib → lib}/utils/response-utils.js +9 -9
  114. package/dist/lib/utils/response-utils.js.map +1 -0
  115. package/dist/lib/utils/url-utils.d.ts.map +1 -0
  116. package/dist/lib/utils/url-utils.js.map +1 -0
  117. package/dist/null-loader.d.ts.map +1 -0
  118. package/dist/{esm/null-loader.js → null-loader.js} +1 -1
  119. package/dist/null-loader.js.map +1 -0
  120. package/dist/null-worker-node.js +21 -27
  121. package/dist/null-worker.js +14 -3
  122. package/dist/workers/null-worker.d.ts.map +1 -0
  123. package/dist/{esm/workers → workers}/null-worker.js +1 -1
  124. package/dist/workers/null-worker.js.map +1 -0
  125. package/package.json +17 -15
  126. package/src/core-addons/write-file-browser.ts +4 -4
  127. package/src/index.ts +7 -5
  128. package/src/iterators/make-stream/{make-dom-stream.ts → make-stream.ts} +4 -0
  129. package/src/lib/api/encode.ts +3 -3
  130. package/src/lib/fetch/fetch-file.ts +7 -3
  131. package/src/lib/fetch/read-array-buffer.ts +2 -6
  132. package/src/lib/filesystems/browser-filesystem.ts +19 -18
  133. package/src/lib/loader-utils/option-utils.ts +1 -1
  134. package/dist/es5/bundle.js +0 -6
  135. package/dist/es5/bundle.js.map +0 -1
  136. package/dist/es5/core-addons/write-file-browser.js +0 -2
  137. package/dist/es5/core-addons/write-file-browser.js.map +0 -1
  138. package/dist/es5/index.js +0 -382
  139. package/dist/es5/index.js.map +0 -1
  140. package/dist/es5/iterators/batch-iterators/timed-batch-iterator.js +0 -94
  141. package/dist/es5/iterators/batch-iterators/timed-batch-iterator.js.map +0 -1
  142. package/dist/es5/iterators/make-iterator/make-array-buffer-iterator.js +0 -42
  143. package/dist/es5/iterators/make-iterator/make-array-buffer-iterator.js.map +0 -1
  144. package/dist/es5/iterators/make-iterator/make-blob-iterator.js +0 -47
  145. package/dist/es5/iterators/make-iterator/make-blob-iterator.js.map +0 -1
  146. package/dist/es5/iterators/make-iterator/make-iterator.js +0 -31
  147. package/dist/es5/iterators/make-iterator/make-iterator.js.map +0 -1
  148. package/dist/es5/iterators/make-iterator/make-stream-iterator.js +0 -133
  149. package/dist/es5/iterators/make-iterator/make-stream-iterator.js.map +0 -1
  150. package/dist/es5/iterators/make-iterator/make-string-iterator.js +0 -38
  151. package/dist/es5/iterators/make-iterator/make-string-iterator.js.map +0 -1
  152. package/dist/es5/iterators/make-stream/make-dom-stream.js +0 -67
  153. package/dist/es5/iterators/make-stream/make-dom-stream.js.map +0 -1
  154. package/dist/es5/iterators/make-stream/make-node-stream.js +0 -168
  155. package/dist/es5/iterators/make-stream/make-node-stream.js.map +0 -1
  156. package/dist/es5/javascript-utils/is-type.js +0 -79
  157. package/dist/es5/javascript-utils/is-type.js.map +0 -1
  158. package/dist/es5/lib/api/encode-table.js +0 -161
  159. package/dist/es5/lib/api/encode-table.js.map +0 -1
  160. package/dist/es5/lib/api/encode.js +0 -254
  161. package/dist/es5/lib/api/encode.js.map +0 -1
  162. package/dist/es5/lib/api/load-in-batches.js +0 -92
  163. package/dist/es5/lib/api/load-in-batches.js.map +0 -1
  164. package/dist/es5/lib/api/load.js +0 -76
  165. package/dist/es5/lib/api/loader-options.js +0 -19
  166. package/dist/es5/lib/api/loader-options.js.map +0 -1
  167. package/dist/es5/lib/api/parse-in-batches.js +0 -276
  168. package/dist/es5/lib/api/parse-in-batches.js.map +0 -1
  169. package/dist/es5/lib/api/parse-sync.js +0 -49
  170. package/dist/es5/lib/api/parse-sync.js.map +0 -1
  171. package/dist/es5/lib/api/parse.js +0 -142
  172. package/dist/es5/lib/api/parse.js.map +0 -1
  173. package/dist/es5/lib/api/register-loaders.js +0 -50
  174. package/dist/es5/lib/api/register-loaders.js.map +0 -1
  175. package/dist/es5/lib/api/save.js +0 -42
  176. package/dist/es5/lib/api/save.js.map +0 -1
  177. package/dist/es5/lib/api/select-loader.js +0 -304
  178. package/dist/es5/lib/api/select-loader.js.map +0 -1
  179. package/dist/es5/lib/common.js +0 -2
  180. package/dist/es5/lib/common.js.map +0 -1
  181. package/dist/es5/lib/fetch/fetch-error-message.js +0 -56
  182. package/dist/es5/lib/fetch/fetch-error-message.js.map +0 -1
  183. package/dist/es5/lib/fetch/fetch-file.js +0 -65
  184. package/dist/es5/lib/fetch/fetch-file.js.map +0 -1
  185. package/dist/es5/lib/fetch/fetch-file.node.js +0 -86
  186. package/dist/es5/lib/fetch/fetch-file.node.js.map +0 -1
  187. package/dist/es5/lib/fetch/read-array-buffer.js +0 -76
  188. package/dist/es5/lib/fetch/read-array-buffer.js.map +0 -1
  189. package/dist/es5/lib/fetch/read-file.js +0 -20
  190. package/dist/es5/lib/fetch/read-file.js.map +0 -1
  191. package/dist/es5/lib/fetch/write-file.js +0 -48
  192. package/dist/es5/lib/fetch/write-file.js.map +0 -1
  193. package/dist/es5/lib/filesystems/browser-filesystem.js +0 -249
  194. package/dist/es5/lib/filesystems/browser-filesystem.js.map +0 -1
  195. package/dist/es5/lib/filesystems/read-array-buffer.js +0 -41
  196. package/dist/es5/lib/filesystems/read-array-buffer.js.map +0 -1
  197. package/dist/es5/lib/init.js +0 -18
  198. package/dist/es5/lib/init.js.map +0 -1
  199. package/dist/es5/lib/loader-utils/check-errors.js +0 -57
  200. package/dist/es5/lib/loader-utils/check-errors.js.map +0 -1
  201. package/dist/es5/lib/loader-utils/get-data.js +0 -237
  202. package/dist/es5/lib/loader-utils/get-data.js.map +0 -1
  203. package/dist/es5/lib/loader-utils/get-fetch-function.js +0 -26
  204. package/dist/es5/lib/loader-utils/get-fetch-function.js.map +0 -1
  205. package/dist/es5/lib/loader-utils/loader-context.js +0 -49
  206. package/dist/es5/lib/loader-utils/loader-context.js.map +0 -1
  207. package/dist/es5/lib/loader-utils/loggers.js +0 -90
  208. package/dist/es5/lib/loader-utils/loggers.js.map +0 -1
  209. package/dist/es5/lib/loader-utils/normalize-loader.js +0 -44
  210. package/dist/es5/lib/loader-utils/normalize-loader.js.map +0 -1
  211. package/dist/es5/lib/loader-utils/option-defaults.js +0 -48
  212. package/dist/es5/lib/loader-utils/option-defaults.js.map +0 -1
  213. package/dist/es5/lib/loader-utils/option-utils.js +0 -131
  214. package/dist/es5/lib/loader-utils/option-utils.js.map +0 -1
  215. package/dist/es5/lib/progress/fetch-progress.js +0 -134
  216. package/dist/es5/lib/progress/fetch-progress.js.map +0 -1
  217. package/dist/es5/lib/utils/log.js +0 -12
  218. package/dist/es5/lib/utils/log.js.map +0 -1
  219. package/dist/es5/lib/utils/mime-type-utils.js +0 -24
  220. package/dist/es5/lib/utils/mime-type-utils.js.map +0 -1
  221. package/dist/es5/lib/utils/resource-utils.js +0 -62
  222. package/dist/es5/lib/utils/resource-utils.js.map +0 -1
  223. package/dist/es5/lib/utils/response-utils.js +0 -197
  224. package/dist/es5/lib/utils/response-utils.js.map +0 -1
  225. package/dist/es5/lib/utils/url-utils.js +0 -16
  226. package/dist/es5/lib/utils/url-utils.js.map +0 -1
  227. package/dist/es5/null-loader.js +0 -131
  228. package/dist/es5/null-loader.js.map +0 -1
  229. package/dist/es5/workers/null-worker.js +0 -6
  230. package/dist/es5/workers/null-worker.js.map +0 -1
  231. package/dist/esm/bundle.js +0 -4
  232. package/dist/esm/bundle.js.map +0 -1
  233. package/dist/esm/core-addons/README.md +0 -1
  234. package/dist/esm/core-addons/write-file-browser.js.map +0 -1
  235. package/dist/esm/index.js +0 -31
  236. package/dist/esm/index.js.map +0 -1
  237. package/dist/esm/iterators/batch-iterators/timed-batch-iterator.js.map +0 -1
  238. package/dist/esm/iterators/make-iterator/make-array-buffer-iterator.js.map +0 -1
  239. package/dist/esm/iterators/make-iterator/make-blob-iterator.js.map +0 -1
  240. package/dist/esm/iterators/make-iterator/make-iterator.js.map +0 -1
  241. package/dist/esm/iterators/make-iterator/make-stream-iterator.js.map +0 -1
  242. package/dist/esm/iterators/make-iterator/make-string-iterator.js.map +0 -1
  243. package/dist/esm/iterators/make-stream/make-dom-stream.js.map +0 -1
  244. package/dist/esm/iterators/make-stream/make-node-stream.js +0 -57
  245. package/dist/esm/iterators/make-stream/make-node-stream.js.map +0 -1
  246. package/dist/esm/javascript-utils/is-type.js.map +0 -1
  247. package/dist/esm/lib/api/encode-table.js.map +0 -1
  248. package/dist/esm/lib/api/encode.js.map +0 -1
  249. package/dist/esm/lib/api/load-in-batches.js.map +0 -1
  250. package/dist/esm/lib/api/load.js.map +0 -1
  251. package/dist/esm/lib/api/loader-options.js +0 -3
  252. package/dist/esm/lib/api/loader-options.js.map +0 -1
  253. package/dist/esm/lib/api/parse-in-batches.js.map +0 -1
  254. package/dist/esm/lib/api/parse-sync.js.map +0 -1
  255. package/dist/esm/lib/api/parse.js.map +0 -1
  256. package/dist/esm/lib/api/register-loaders.js.map +0 -1
  257. package/dist/esm/lib/api/save.js +0 -11
  258. package/dist/esm/lib/api/save.js.map +0 -1
  259. package/dist/esm/lib/api/select-loader.js.map +0 -1
  260. package/dist/esm/lib/common.js.map +0 -1
  261. package/dist/esm/lib/fetch/fetch-error-message.js.map +0 -1
  262. package/dist/esm/lib/fetch/fetch-file.js.map +0 -1
  263. package/dist/esm/lib/fetch/fetch-file.node.js +0 -54
  264. package/dist/esm/lib/fetch/fetch-file.node.js.map +0 -1
  265. package/dist/esm/lib/fetch/read-array-buffer.js.map +0 -1
  266. package/dist/esm/lib/fetch/read-file.js +0 -15
  267. package/dist/esm/lib/fetch/read-file.js.map +0 -1
  268. package/dist/esm/lib/fetch/write-file.js +0 -21
  269. package/dist/esm/lib/fetch/write-file.js.map +0 -1
  270. package/dist/esm/lib/filesystems/browser-filesystem.js.map +0 -1
  271. package/dist/esm/lib/filesystems/read-array-buffer.js.map +0 -1
  272. package/dist/esm/lib/init.js +0 -11
  273. package/dist/esm/lib/init.js.map +0 -1
  274. package/dist/esm/lib/loader-utils/check-errors.js.map +0 -1
  275. package/dist/esm/lib/loader-utils/get-data.js.map +0 -1
  276. package/dist/esm/lib/loader-utils/get-fetch-function.js.map +0 -1
  277. package/dist/esm/lib/loader-utils/loader-context.js.map +0 -1
  278. package/dist/esm/lib/loader-utils/loggers.js.map +0 -1
  279. package/dist/esm/lib/loader-utils/normalize-loader.js.map +0 -1
  280. package/dist/esm/lib/loader-utils/option-defaults.js.map +0 -1
  281. package/dist/esm/lib/loader-utils/option-utils.js.map +0 -1
  282. package/dist/esm/lib/progress/fetch-progress.js.map +0 -1
  283. package/dist/esm/lib/utils/log.js.map +0 -1
  284. package/dist/esm/lib/utils/mime-type-utils.js.map +0 -1
  285. package/dist/esm/lib/utils/resource-utils.js.map +0 -1
  286. package/dist/esm/lib/utils/response-utils.js.map +0 -1
  287. package/dist/esm/lib/utils/url-utils.js.map +0 -1
  288. package/dist/esm/null-loader.js.map +0 -1
  289. package/dist/esm/workers/null-worker.js.map +0 -1
  290. package/dist/src/bundle.d.ts +0 -2
  291. package/dist/src/bundle.d.ts.map +0 -1
  292. package/dist/src/core-addons/write-file-browser.d.ts.map +0 -1
  293. package/dist/src/index.d.ts.map +0 -1
  294. package/dist/src/iterators/batch-iterators/timed-batch-iterator.d.ts.map +0 -1
  295. package/dist/src/iterators/make-iterator/make-array-buffer-iterator.d.ts.map +0 -1
  296. package/dist/src/iterators/make-iterator/make-blob-iterator.d.ts.map +0 -1
  297. package/dist/src/iterators/make-iterator/make-iterator.d.ts.map +0 -1
  298. package/dist/src/iterators/make-iterator/make-stream-iterator.d.ts.map +0 -1
  299. package/dist/src/iterators/make-iterator/make-string-iterator.d.ts.map +0 -1
  300. package/dist/src/iterators/make-stream/make-dom-stream.d.ts.map +0 -1
  301. package/dist/src/iterators/make-stream/make-node-stream.d.ts +0 -11
  302. package/dist/src/iterators/make-stream/make-node-stream.d.ts.map +0 -1
  303. package/dist/src/javascript-utils/is-type.d.ts.map +0 -1
  304. package/dist/src/lib/api/encode-table.d.ts.map +0 -1
  305. package/dist/src/lib/api/encode.d.ts.map +0 -1
  306. package/dist/src/lib/api/load-in-batches.d.ts.map +0 -1
  307. package/dist/src/lib/api/load.d.ts.map +0 -1
  308. package/dist/src/lib/api/loader-options.d.ts.map +0 -1
  309. package/dist/src/lib/api/parse-in-batches.d.ts.map +0 -1
  310. package/dist/src/lib/api/parse-sync.d.ts.map +0 -1
  311. package/dist/src/lib/api/parse.d.ts.map +0 -1
  312. package/dist/src/lib/api/register-loaders.d.ts.map +0 -1
  313. package/dist/src/lib/api/save.d.ts +0 -4
  314. package/dist/src/lib/api/save.d.ts.map +0 -1
  315. package/dist/src/lib/api/select-loader.d.ts.map +0 -1
  316. package/dist/src/lib/common.d.ts.map +0 -1
  317. package/dist/src/lib/fetch/fetch-error-message.d.ts.map +0 -1
  318. package/dist/src/lib/fetch/fetch-file.d.ts.map +0 -1
  319. package/dist/src/lib/fetch/fetch-file.node.d.ts +0 -8
  320. package/dist/src/lib/fetch/fetch-file.node.d.ts.map +0 -1
  321. package/dist/src/lib/fetch/read-array-buffer.d.ts.map +0 -1
  322. package/dist/src/lib/fetch/read-file.d.ts +0 -5
  323. package/dist/src/lib/fetch/read-file.d.ts.map +0 -1
  324. package/dist/src/lib/fetch/write-file.d.ts +0 -3
  325. package/dist/src/lib/fetch/write-file.d.ts.map +0 -1
  326. package/dist/src/lib/filesystems/browser-filesystem.d.ts.map +0 -1
  327. package/dist/src/lib/filesystems/read-array-buffer.d.ts.map +0 -1
  328. package/dist/src/lib/loader-utils/check-errors.d.ts.map +0 -1
  329. package/dist/src/lib/loader-utils/get-data.d.ts.map +0 -1
  330. package/dist/src/lib/loader-utils/get-fetch-function.d.ts.map +0 -1
  331. package/dist/src/lib/loader-utils/loader-context.d.ts.map +0 -1
  332. package/dist/src/lib/loader-utils/loggers.d.ts.map +0 -1
  333. package/dist/src/lib/loader-utils/normalize-loader.d.ts.map +0 -1
  334. package/dist/src/lib/loader-utils/option-defaults.d.ts.map +0 -1
  335. package/dist/src/lib/loader-utils/option-utils.d.ts.map +0 -1
  336. package/dist/src/lib/progress/fetch-progress.d.ts.map +0 -1
  337. package/dist/src/lib/utils/log.d.ts.map +0 -1
  338. package/dist/src/lib/utils/mime-type-utils.d.ts.map +0 -1
  339. package/dist/src/lib/utils/resource-utils.d.ts.map +0 -1
  340. package/dist/src/lib/utils/response-utils.d.ts.map +0 -1
  341. package/dist/src/lib/utils/url-utils.d.ts.map +0 -1
  342. package/dist/src/null-loader.d.ts.map +0 -1
  343. package/dist/src/workers/null-worker.d.ts.map +0 -1
  344. package/dist/tsconfig.tsbuildinfo +0 -1
  345. package/src/bundle.ts +0 -4
  346. package/src/iterators/make-stream/make-node-stream.ts +0 -74
  347. package/src/lib/api/save.ts +0 -13
  348. package/src/lib/fetch/fetch-file.node.ts +0 -61
  349. package/src/lib/fetch/read-file.ts +0 -31
  350. package/src/lib/fetch/write-file.ts +0 -27
  351. /package/dist/{es5/core-addons → core-addons}/README.md +0 -0
  352. /package/dist/{src/core-addons → core-addons}/write-file-browser.d.ts +0 -0
  353. /package/dist/{esm/core-addons → core-addons}/write-file-browser.js +0 -0
  354. /package/dist/{src/iterators → iterators}/batch-iterators/timed-batch-iterator.d.ts +0 -0
  355. /package/dist/{esm/iterators → iterators}/batch-iterators/timed-batch-iterator.js +0 -0
  356. /package/dist/{src/iterators → iterators}/make-iterator/make-array-buffer-iterator.d.ts +0 -0
  357. /package/dist/{esm/iterators → iterators}/make-iterator/make-array-buffer-iterator.js +0 -0
  358. /package/dist/{src/iterators → iterators}/make-iterator/make-blob-iterator.d.ts +0 -0
  359. /package/dist/{esm/iterators → iterators}/make-iterator/make-blob-iterator.js +0 -0
  360. /package/dist/{src/iterators → iterators}/make-iterator/make-iterator.d.ts +0 -0
  361. /package/dist/{src/iterators → iterators}/make-iterator/make-stream-iterator.d.ts +0 -0
  362. /package/dist/{esm/iterators → iterators}/make-iterator/make-stream-iterator.js +0 -0
  363. /package/dist/{src/iterators → iterators}/make-iterator/make-string-iterator.d.ts +0 -0
  364. /package/dist/{esm/iterators → iterators}/make-iterator/make-string-iterator.js +0 -0
  365. /package/dist/{src/javascript-utils → javascript-utils}/is-type.d.ts +0 -0
  366. /package/dist/{esm/javascript-utils → javascript-utils}/is-type.js +0 -0
  367. /package/dist/{src/lib → lib}/api/encode-table.d.ts +0 -0
  368. /package/dist/{src/lib → lib}/api/encode.d.ts +0 -0
  369. /package/dist/{src/lib → lib}/api/load-in-batches.d.ts +0 -0
  370. /package/dist/{src/lib → lib}/api/load.d.ts +0 -0
  371. /package/dist/{src/lib → lib}/api/loader-options.d.ts +0 -0
  372. /package/dist/{src/lib → lib}/api/parse-in-batches.d.ts +0 -0
  373. /package/dist/{src/lib → lib}/api/parse-sync.d.ts +0 -0
  374. /package/dist/{src/lib → lib}/api/parse.d.ts +0 -0
  375. /package/dist/{src/lib → lib}/api/register-loaders.d.ts +0 -0
  376. /package/dist/{src/lib → lib}/api/select-loader.d.ts +0 -0
  377. /package/dist/{src/lib → lib}/common.d.ts +0 -0
  378. /package/dist/{esm/lib → lib}/common.js +0 -0
  379. /package/dist/{src/lib → lib}/fetch/fetch-error-message.d.ts +0 -0
  380. /package/dist/{src/lib → lib}/fetch/fetch-file.d.ts +0 -0
  381. /package/dist/{src/lib → lib}/filesystems/read-array-buffer.d.ts +0 -0
  382. /package/dist/{esm/lib → lib}/filesystems/read-array-buffer.js +0 -0
  383. /package/dist/{src/lib → lib}/init.d.ts +0 -0
  384. /package/dist/{src/lib → lib}/loader-utils/check-errors.d.ts +0 -0
  385. /package/dist/{src/lib → lib}/loader-utils/get-data.d.ts +0 -0
  386. /package/dist/{src/lib → lib}/loader-utils/get-fetch-function.d.ts +0 -0
  387. /package/dist/{src/lib → lib}/loader-utils/loader-context.d.ts +0 -0
  388. /package/dist/{src/lib → lib}/loader-utils/loggers.d.ts +0 -0
  389. /package/dist/{src/lib → lib}/loader-utils/normalize-loader.d.ts +0 -0
  390. /package/dist/{esm/lib → lib}/loader-utils/normalize-loader.js +0 -0
  391. /package/dist/{src/lib → lib}/loader-utils/option-defaults.d.ts +0 -0
  392. /package/dist/{src/lib → lib}/progress/fetch-progress.d.ts +0 -0
  393. /package/dist/{esm/lib → lib}/progress/fetch-progress.js +0 -0
  394. /package/dist/{src/lib → lib}/utils/log.d.ts +0 -0
  395. /package/dist/{esm/lib → lib}/utils/log.js +0 -0
  396. /package/dist/{src/lib → lib}/utils/mime-type-utils.d.ts +0 -0
  397. /package/dist/{esm/lib → lib}/utils/mime-type-utils.js +0 -0
  398. /package/dist/{src/lib → lib}/utils/resource-utils.d.ts +0 -0
  399. /package/dist/{src/lib → lib}/utils/response-utils.d.ts +0 -0
  400. /package/dist/{src/lib → lib}/utils/url-utils.d.ts +0 -0
  401. /package/dist/{esm/lib → lib}/utils/url-utils.js +0 -0
  402. /package/dist/{src/null-loader.d.ts → null-loader.d.ts} +0 -0
  403. /package/dist/{src/workers → workers}/null-worker.d.ts +0 -0
@@ -1,33 +1,87 @@
1
- (() => {
2
- var __create = Object.create;
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if (typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory();
4
+ else if (typeof define === 'function' && define.amd) define([], factory);
5
+ else if (typeof exports === 'object') exports['loader'] = factory();
6
+ else root['loader'] = factory();})(globalThis, function () {
7
+ "use strict";
8
+ var __exports__ = (() => {
3
9
  var __defProp = Object.defineProperty;
4
10
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
11
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
9
- var __esm = (fn, res) => function __init() {
10
- return fn && (res = (0, fn[Object.keys(fn)[0]])(fn = 0)), res;
11
- };
12
- var __commonJS = (cb, mod) => function __require() {
13
- return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
14
- };
15
13
  var __export = (target, all) => {
16
- __markAsModule(target);
17
14
  for (var name in all)
18
15
  __defProp(target, name, { get: all[name], enumerable: true });
19
16
  };
20
- var __reExport = (target, module, desc) => {
21
- if (module && typeof module === "object" || typeof module === "function") {
22
- for (let key of __getOwnPropNames(module))
23
- if (!__hasOwnProp.call(target, key) && key !== "default")
24
- __defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") {
19
+ for (let key of __getOwnPropNames(from))
20
+ if (!__hasOwnProp.call(to, key) && key !== except)
21
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
22
  }
26
- return target;
27
- };
28
- var __toModule = (module) => {
29
- return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
23
+ return to;
30
24
  };
25
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
+
27
+ // src/index.ts
28
+ var src_exports = {};
29
+ __export(src_exports, {
30
+ JSONLoader: () => JSONLoader,
31
+ NullLoader: () => NullLoader,
32
+ NullWorkerLoader: () => NullWorkerLoader,
33
+ RequestScheduler: () => RequestScheduler,
34
+ _BrowserFileSystem: () => BrowserFileSystem,
35
+ _fetchProgress: () => fetchProgress,
36
+ _unregisterLoaders: () => _unregisterLoaders,
37
+ assert: () => assert,
38
+ concatenateArrayBuffersAsync: () => concatenateArrayBuffersAsync,
39
+ document: () => document_,
40
+ encode: () => encode,
41
+ encodeInBatches: () => encodeInBatches,
42
+ encodeSync: () => encodeSync,
43
+ encodeTable: () => encodeTable,
44
+ encodeTableAsText: () => encodeTableAsText,
45
+ encodeTableInBatches: () => encodeTableInBatches,
46
+ encodeText: () => encodeText,
47
+ encodeTextSync: () => encodeTextSync,
48
+ encodeURLtoURL: () => encodeURLtoURL,
49
+ fetchFile: () => fetchFile,
50
+ forEach: () => forEach,
51
+ getLoaderOptions: () => getGlobalLoaderOptions,
52
+ getPathPrefix: () => getPathPrefix,
53
+ global: () => global_,
54
+ isAsyncIterable: () => isAsyncIterable,
55
+ isBrowser: () => isBrowser,
56
+ isIterable: () => isIterable,
57
+ isIterator: () => isIterator,
58
+ isPromise: () => isPromise,
59
+ isPureObject: () => isPureObject,
60
+ isReadableStream: () => isReadableStream,
61
+ isResponse: () => isResponse,
62
+ isWorker: () => isWorker,
63
+ isWritableStream: () => isWritableStream,
64
+ load: () => load,
65
+ loadInBatches: () => loadInBatches,
66
+ makeIterator: () => makeIterator,
67
+ makeLineIterator: () => makeLineIterator,
68
+ makeNumberedLineIterator: () => makeNumberedLineIterator,
69
+ makeStream: () => makeStream,
70
+ makeTextDecoderIterator: () => makeTextDecoderIterator,
71
+ makeTextEncoderIterator: () => makeTextEncoderIterator,
72
+ parse: () => parse,
73
+ parseInBatches: () => parseInBatches,
74
+ parseSync: () => parseSync,
75
+ readArrayBuffer: () => readArrayBuffer,
76
+ registerLoaders: () => registerLoaders,
77
+ resolvePath: () => resolvePath,
78
+ selectLoader: () => selectLoader,
79
+ selectLoaderSync: () => selectLoaderSync,
80
+ self: () => self_,
81
+ setLoaderOptions: () => setGlobalOptions,
82
+ setPathPrefix: () => setPathPrefix,
83
+ window: () => window_
84
+ });
31
85
 
32
86
  // ../loader-utils/src/lib/env-utils/assert.ts
33
87
  function assert(condition, message) {
@@ -35,38 +89,31 @@
35
89
  throw new Error(message || "loader assertion failed.");
36
90
  }
37
91
  }
38
- var init_assert = __esm({
39
- "../loader-utils/src/lib/env-utils/assert.ts"() {
40
- }
41
- });
42
92
 
43
93
  // ../loader-utils/src/lib/env-utils/globals.ts
44
- var globals, self_, window_, global_, document_, isBrowser, isWorker, matches, nodeVersion;
45
- var init_globals = __esm({
46
- "../loader-utils/src/lib/env-utils/globals.ts"() {
47
- globals = {
48
- self: typeof self !== "undefined" && self,
49
- window: typeof window !== "undefined" && window,
50
- global: typeof global !== "undefined" && global,
51
- document: typeof document !== "undefined" && document
52
- };
53
- self_ = globals.self || globals.window || globals.global || {};
54
- window_ = globals.window || globals.self || globals.global || {};
55
- global_ = globals.global || globals.self || globals.window || {};
56
- document_ = globals.document || {};
57
- isBrowser = Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser);
58
- isWorker = typeof importScripts === "function";
59
- matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
60
- nodeVersion = matches && parseFloat(matches[1]) || 0;
61
- }
62
- });
94
+ var globals = {
95
+ self: typeof self !== "undefined" && self,
96
+ window: typeof window !== "undefined" && window,
97
+ global: typeof global !== "undefined" && global,
98
+ document: typeof document !== "undefined" && document
99
+ };
100
+ var self_ = globals.self || globals.window || globals.global || {};
101
+ var window_ = globals.window || globals.self || globals.global || {};
102
+ var global_ = globals.global || globals.self || globals.window || {};
103
+ var document_ = globals.document || {};
104
+ var isBrowser = Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser);
105
+ var isWorker = typeof importScripts === "function";
106
+ var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
107
+ var nodeVersion = matches && parseFloat(matches[1]) || 0;
63
108
 
64
109
  // ../loader-utils/src/lib/option-utils/merge-loader-options.ts
65
110
  function mergeLoaderOptions(baseOptions, newOptions) {
66
111
  return mergeOptionsRecursively(baseOptions || {}, newOptions);
67
112
  }
68
113
  function mergeOptionsRecursively(baseOptions, newOptions) {
69
- const options = { ...baseOptions };
114
+ const options = {
115
+ ...baseOptions
116
+ };
70
117
  for (const [key, newValue] of Object.entries(newOptions)) {
71
118
  if (newValue && typeof newValue === "object" && !Array.isArray(newValue)) {
72
119
  options[key] = mergeOptionsRecursively(options[key] || {}, newOptions[key]);
@@ -76,12 +123,9 @@
76
123
  }
77
124
  return options;
78
125
  }
79
- var init_merge_loader_options = __esm({
80
- "../loader-utils/src/lib/option-utils/merge-loader-options.ts"() {
81
- }
82
- });
83
126
 
84
127
  // ../worker-utils/src/lib/env-utils/version.ts
128
+ var NPM_TAG = "beta";
85
129
  function getVersion() {
86
130
  if (!globalThis._loadersgl_?.version) {
87
131
  globalThis._loadersgl_ = globalThis._loadersgl_ || {};
@@ -94,13 +138,7 @@
94
138
  }
95
139
  return globalThis._loadersgl_.version;
96
140
  }
97
- var NPM_TAG, VERSION;
98
- var init_version = __esm({
99
- "../worker-utils/src/lib/env-utils/version.ts"() {
100
- NPM_TAG = "beta";
101
- VERSION = getVersion();
102
- }
103
- });
141
+ var VERSION = getVersion();
104
142
 
105
143
  // ../worker-utils/src/lib/env-utils/assert.ts
106
144
  function assert2(condition, message) {
@@ -108,84 +146,65 @@
108
146
  throw new Error(message || "loaders.gl assertion failed.");
109
147
  }
110
148
  }
111
- var init_assert2 = __esm({
112
- "../worker-utils/src/lib/env-utils/assert.ts"() {
113
- }
114
- });
115
149
 
116
150
  // ../worker-utils/src/lib/env-utils/globals.ts
117
- var globals2, self_2, window_2, global_2, document_2, isBrowser2, isMobile, matches2, nodeVersion2;
118
- var init_globals2 = __esm({
119
- "../worker-utils/src/lib/env-utils/globals.ts"() {
120
- globals2 = {
121
- self: typeof self !== "undefined" && self,
122
- window: typeof window !== "undefined" && window,
123
- global: typeof global !== "undefined" && global,
124
- document: typeof document !== "undefined" && document
125
- };
126
- self_2 = globals2.self || globals2.window || globals2.global || {};
127
- window_2 = globals2.window || globals2.self || globals2.global || {};
128
- global_2 = globals2.global || globals2.self || globals2.window || {};
129
- document_2 = globals2.document || {};
130
- isBrowser2 = typeof process !== "object" || String(process) !== "[object process]" || process.browser;
131
- isMobile = typeof window !== "undefined" && typeof window.orientation !== "undefined";
132
- matches2 = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
133
- nodeVersion2 = matches2 && parseFloat(matches2[1]) || 0;
134
- }
135
- });
151
+ var globals2 = {
152
+ self: typeof self !== "undefined" && self,
153
+ window: typeof window !== "undefined" && window,
154
+ global: typeof global !== "undefined" && global,
155
+ document: typeof document !== "undefined" && document
156
+ };
157
+ var self_2 = globals2.self || globals2.window || globals2.global || {};
158
+ var window_2 = globals2.window || globals2.self || globals2.global || {};
159
+ var global_2 = globals2.global || globals2.self || globals2.window || {};
160
+ var document_2 = globals2.document || {};
161
+ var isBrowser2 = typeof process !== "object" || String(process) !== "[object process]" || process.browser;
162
+ var isMobile = typeof window !== "undefined" && typeof window.orientation !== "undefined";
163
+ var matches2 = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
164
+ var nodeVersion2 = matches2 && parseFloat(matches2[1]) || 0;
136
165
 
137
166
  // ../worker-utils/src/lib/worker-farm/worker-job.ts
138
- var WorkerJob;
139
- var init_worker_job = __esm({
140
- "../worker-utils/src/lib/worker-farm/worker-job.ts"() {
141
- init_assert2();
142
- WorkerJob = class {
143
- constructor(jobName, workerThread) {
144
- this.isRunning = true;
145
- this._resolve = () => {
146
- };
147
- this._reject = () => {
148
- };
149
- this.name = jobName;
150
- this.workerThread = workerThread;
151
- this.result = new Promise((resolve2, reject) => {
152
- this._resolve = resolve2;
153
- this._reject = reject;
154
- });
155
- }
156
- postMessage(type, payload) {
157
- this.workerThread.postMessage({
158
- source: "loaders.gl",
159
- type,
160
- payload
161
- });
162
- }
163
- done(value) {
164
- assert2(this.isRunning);
165
- this.isRunning = false;
166
- this._resolve(value);
167
- }
168
- error(error) {
169
- assert2(this.isRunning);
170
- this.isRunning = false;
171
- this._reject(error);
172
- }
173
- };
167
+ var WorkerJob = class {
168
+ isRunning = true;
169
+ _resolve = () => {
170
+ };
171
+ _reject = () => {
172
+ };
173
+ constructor(jobName, workerThread) {
174
+ this.name = jobName;
175
+ this.workerThread = workerThread;
176
+ this.result = new Promise((resolve2, reject) => {
177
+ this._resolve = resolve2;
178
+ this._reject = reject;
179
+ });
174
180
  }
175
- });
181
+ postMessage(type, payload) {
182
+ this.workerThread.postMessage({
183
+ source: "loaders.gl",
184
+ type,
185
+ payload
186
+ });
187
+ }
188
+ done(value) {
189
+ assert2(this.isRunning);
190
+ this.isRunning = false;
191
+ this._resolve(value);
192
+ }
193
+ error(error) {
194
+ assert2(this.isRunning);
195
+ this.isRunning = false;
196
+ this._reject(error);
197
+ }
198
+ };
176
199
 
177
200
  // ../worker-utils/src/lib/node/worker_threads-browser.ts
178
- var Worker2;
179
- var init_worker_threads_browser = __esm({
180
- "../worker-utils/src/lib/node/worker_threads-browser.ts"() {
181
- Worker2 = class {
182
- terminate() {
183
- }
184
- };
201
+ var Worker2 = class {
202
+ terminate() {
185
203
  }
186
- });
204
+ };
187
205
 
188
206
  // ../worker-utils/src/lib/worker-utils/get-loadable-worker-url.ts
207
+ var workerURLCache = /* @__PURE__ */ new Map();
189
208
  function getLoadableWorkerURL(props) {
190
209
  assert2(props.source && !props.url || !props.source && props.url);
191
210
  let workerURL = workerURLCache.get(props.source || props.url);
@@ -210,7 +229,9 @@
210
229
  return getLoadableWorkerURLFromSource(workerSource);
211
230
  }
212
231
  function getLoadableWorkerURLFromSource(workerSource) {
213
- const blob = new Blob([workerSource], { type: "application/javascript" });
232
+ const blob = new Blob([workerSource], {
233
+ type: "application/javascript"
234
+ });
214
235
  return URL.createObjectURL(blob);
215
236
  }
216
237
  function buildScriptSource(workerUrl) {
@@ -221,17 +242,10 @@
221
242
  throw error;
222
243
  }`;
223
244
  }
224
- var workerURLCache;
225
- var init_get_loadable_worker_url = __esm({
226
- "../worker-utils/src/lib/worker-utils/get-loadable-worker-url.ts"() {
227
- init_assert2();
228
- workerURLCache = new Map();
229
- }
230
- });
231
245
 
232
246
  // ../worker-utils/src/lib/worker-utils/get-transfer-list.ts
233
247
  function getTransferList(object, recursive = true, transfers) {
234
- const transfersSet = transfers || new Set();
248
+ const transfersSet = transfers || /* @__PURE__ */ new Set();
235
249
  if (!object) {
236
250
  } else if (isTransferable(object)) {
237
251
  transfersSet.add(object);
@@ -279,283 +293,290 @@
279
293
  });
280
294
  return clone;
281
295
  }
282
- var init_get_transfer_list = __esm({
283
- "../worker-utils/src/lib/worker-utils/get-transfer-list.ts"() {
284
- }
285
- });
286
296
 
287
297
  // ../worker-utils/src/lib/worker-farm/worker-thread.ts
288
- var NOOP, WorkerThread;
289
- var init_worker_thread = __esm({
290
- "../worker-utils/src/lib/worker-farm/worker-thread.ts"() {
291
- init_worker_threads_browser();
292
- init_globals2();
293
- init_assert2();
294
- init_get_loadable_worker_url();
295
- init_get_transfer_list();
296
- NOOP = () => {
297
- };
298
- WorkerThread = class {
299
- constructor(props) {
300
- this.terminated = false;
301
- this._loadableURL = "";
302
- const { name, source, url } = props;
303
- assert2(source || url);
304
- this.name = name;
305
- this.source = source;
306
- this.url = url;
307
- this.onMessage = NOOP;
308
- this.onError = (error) => console.log(error);
309
- this.worker = isBrowser2 ? this._createBrowserWorker() : this._createNodeWorker();
310
- }
311
- static isSupported() {
312
- return typeof Worker !== "undefined" && isBrowser2 || typeof Worker2 !== "undefined" && !isBrowser2;
313
- }
314
- destroy() {
315
- this.onMessage = NOOP;
316
- this.onError = NOOP;
317
- this.worker.terminate();
318
- this.terminated = true;
319
- }
320
- get isRunning() {
321
- return Boolean(this.onMessage);
322
- }
323
- postMessage(data, transferList) {
324
- transferList = transferList || getTransferList(data);
325
- this.worker.postMessage(data, transferList);
326
- }
327
- _getErrorFromErrorEvent(event) {
328
- let message = "Failed to load ";
329
- message += `worker ${this.name} from ${this.url}. `;
330
- if (event.message) {
331
- message += `${event.message} in `;
332
- }
333
- if (event.lineno) {
334
- message += `:${event.lineno}:${event.colno}`;
335
- }
336
- return new Error(message);
337
- }
338
- _createBrowserWorker() {
339
- this._loadableURL = getLoadableWorkerURL({ source: this.source, url: this.url });
340
- const worker = new Worker(this._loadableURL, { name: this.name });
341
- worker.onmessage = (event) => {
342
- if (!event.data) {
343
- this.onError(new Error("No data received"));
344
- } else {
345
- this.onMessage(event.data);
346
- }
347
- };
348
- worker.onerror = (error) => {
349
- this.onError(this._getErrorFromErrorEvent(error));
350
- this.terminated = true;
351
- };
352
- worker.onmessageerror = (event) => console.error(event);
353
- return worker;
354
- }
355
- _createNodeWorker() {
356
- let worker;
357
- if (this.url) {
358
- const absolute = this.url.includes(":/") || this.url.startsWith("/");
359
- const url = absolute ? this.url : `./${this.url}`;
360
- worker = new Worker2(url, { eval: false });
361
- } else if (this.source) {
362
- worker = new Worker2(this.source, { eval: true });
363
- } else {
364
- throw new Error("no worker");
365
- }
366
- worker.on("message", (data) => {
367
- this.onMessage(data);
368
- });
369
- worker.on("error", (error) => {
370
- this.onError(error);
371
- });
372
- worker.on("exit", (code) => {
373
- });
374
- return worker;
298
+ var NOOP = () => {
299
+ };
300
+ var WorkerThread = class {
301
+ terminated = false;
302
+ _loadableURL = "";
303
+ static isSupported() {
304
+ return typeof Worker !== "undefined" && isBrowser2 || typeof Worker2 !== "undefined" && !isBrowser2;
305
+ }
306
+ constructor(props) {
307
+ const {
308
+ name,
309
+ source,
310
+ url
311
+ } = props;
312
+ assert2(source || url);
313
+ this.name = name;
314
+ this.source = source;
315
+ this.url = url;
316
+ this.onMessage = NOOP;
317
+ this.onError = (error) => console.log(error);
318
+ this.worker = isBrowser2 ? this._createBrowserWorker() : this._createNodeWorker();
319
+ }
320
+ destroy() {
321
+ this.onMessage = NOOP;
322
+ this.onError = NOOP;
323
+ this.worker.terminate();
324
+ this.terminated = true;
325
+ }
326
+ get isRunning() {
327
+ return Boolean(this.onMessage);
328
+ }
329
+ postMessage(data, transferList) {
330
+ transferList = transferList || getTransferList(data);
331
+ this.worker.postMessage(data, transferList);
332
+ }
333
+ _getErrorFromErrorEvent(event) {
334
+ let message = "Failed to load ";
335
+ message += `worker ${this.name} from ${this.url}. `;
336
+ if (event.message) {
337
+ message += `${event.message} in `;
338
+ }
339
+ if (event.lineno) {
340
+ message += `:${event.lineno}:${event.colno}`;
341
+ }
342
+ return new Error(message);
343
+ }
344
+ _createBrowserWorker() {
345
+ this._loadableURL = getLoadableWorkerURL({
346
+ source: this.source,
347
+ url: this.url
348
+ });
349
+ const worker = new Worker(this._loadableURL, {
350
+ name: this.name
351
+ });
352
+ worker.onmessage = (event) => {
353
+ if (!event.data) {
354
+ this.onError(new Error("No data received"));
355
+ } else {
356
+ this.onMessage(event.data);
375
357
  }
376
358
  };
359
+ worker.onerror = (error) => {
360
+ this.onError(this._getErrorFromErrorEvent(error));
361
+ this.terminated = true;
362
+ };
363
+ worker.onmessageerror = (event) => console.error(event);
364
+ return worker;
365
+ }
366
+ _createNodeWorker() {
367
+ let worker;
368
+ if (this.url) {
369
+ const absolute = this.url.includes(":/") || this.url.startsWith("/");
370
+ const url = absolute ? this.url : `./${this.url}`;
371
+ worker = new Worker2(url, {
372
+ eval: false
373
+ });
374
+ } else if (this.source) {
375
+ worker = new Worker2(this.source, {
376
+ eval: true
377
+ });
378
+ } else {
379
+ throw new Error("no worker");
380
+ }
381
+ worker.on("message", (data) => {
382
+ this.onMessage(data);
383
+ });
384
+ worker.on("error", (error) => {
385
+ this.onError(error);
386
+ });
387
+ worker.on("exit", (code) => {
388
+ });
389
+ return worker;
377
390
  }
378
- });
391
+ };
379
392
 
380
393
  // ../worker-utils/src/lib/worker-farm/worker-pool.ts
381
- var WorkerPool;
382
- var init_worker_pool = __esm({
383
- "../worker-utils/src/lib/worker-farm/worker-pool.ts"() {
384
- init_globals2();
385
- init_worker_thread();
386
- init_worker_job();
387
- WorkerPool = class {
388
- constructor(props) {
389
- this.name = "unnamed";
390
- this.maxConcurrency = 1;
391
- this.maxMobileConcurrency = 1;
392
- this.onDebug = () => {
393
- };
394
- this.reuseWorkers = true;
395
- this.props = {};
396
- this.jobQueue = [];
397
- this.idleQueue = [];
398
- this.count = 0;
399
- this.isDestroyed = false;
400
- this.source = props.source;
401
- this.url = props.url;
402
- this.setProps(props);
403
- }
404
- static isSupported() {
405
- return WorkerThread.isSupported();
406
- }
407
- destroy() {
408
- this.idleQueue.forEach((worker) => worker.destroy());
409
- this.isDestroyed = true;
410
- }
411
- setProps(props) {
412
- this.props = { ...this.props, ...props };
413
- if (props.name !== void 0) {
414
- this.name = props.name;
415
- }
416
- if (props.maxConcurrency !== void 0) {
417
- this.maxConcurrency = props.maxConcurrency;
418
- }
419
- if (props.maxMobileConcurrency !== void 0) {
420
- this.maxMobileConcurrency = props.maxMobileConcurrency;
421
- }
422
- if (props.reuseWorkers !== void 0) {
423
- this.reuseWorkers = props.reuseWorkers;
424
- }
425
- if (props.onDebug !== void 0) {
426
- this.onDebug = props.onDebug;
427
- }
428
- }
429
- async startJob(name, onMessage3 = (job, type, data) => job.done(data), onError = (job, error) => job.error(error)) {
430
- const startPromise = new Promise((onStart) => {
431
- this.jobQueue.push({ name, onMessage: onMessage3, onError, onStart });
432
- return this;
433
- });
434
- this._startQueuedJob();
435
- return await startPromise;
436
- }
437
- async _startQueuedJob() {
438
- if (!this.jobQueue.length) {
439
- return;
440
- }
441
- const workerThread = this._getAvailableWorker();
442
- if (!workerThread) {
443
- return;
444
- }
445
- const queuedJob = this.jobQueue.shift();
446
- if (queuedJob) {
447
- this.onDebug({
448
- message: "Starting job",
449
- name: queuedJob.name,
450
- workerThread,
451
- backlog: this.jobQueue.length
452
- });
453
- const job = new WorkerJob(queuedJob.name, workerThread);
454
- workerThread.onMessage = (data) => queuedJob.onMessage(job, data.type, data.payload);
455
- workerThread.onError = (error) => queuedJob.onError(job, error);
456
- queuedJob.onStart(job);
457
- try {
458
- await job.result;
459
- } finally {
460
- this.returnWorkerToQueue(workerThread);
461
- }
462
- }
463
- }
464
- returnWorkerToQueue(worker) {
465
- const shouldDestroyWorker = !isBrowser2 || this.isDestroyed || !this.reuseWorkers || this.count > this._getMaxConcurrency();
466
- if (shouldDestroyWorker) {
467
- worker.destroy();
468
- this.count--;
469
- } else {
470
- this.idleQueue.push(worker);
471
- }
472
- if (!this.isDestroyed) {
473
- this._startQueuedJob();
474
- }
475
- }
476
- _getAvailableWorker() {
477
- if (this.idleQueue.length > 0) {
478
- return this.idleQueue.shift() || null;
479
- }
480
- if (this.count < this._getMaxConcurrency()) {
481
- this.count++;
482
- const name = `${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;
483
- return new WorkerThread({ name, source: this.source, url: this.url });
484
- }
485
- return null;
486
- }
487
- _getMaxConcurrency() {
488
- return isMobile ? this.maxMobileConcurrency : this.maxConcurrency;
489
- }
394
+ var WorkerPool = class {
395
+ name = "unnamed";
396
+ maxConcurrency = 1;
397
+ maxMobileConcurrency = 1;
398
+ onDebug = () => {
399
+ };
400
+ reuseWorkers = true;
401
+ props = {};
402
+ jobQueue = [];
403
+ idleQueue = [];
404
+ count = 0;
405
+ isDestroyed = false;
406
+ static isSupported() {
407
+ return WorkerThread.isSupported();
408
+ }
409
+ constructor(props) {
410
+ this.source = props.source;
411
+ this.url = props.url;
412
+ this.setProps(props);
413
+ }
414
+ destroy() {
415
+ this.idleQueue.forEach((worker) => worker.destroy());
416
+ this.isDestroyed = true;
417
+ }
418
+ setProps(props) {
419
+ this.props = {
420
+ ...this.props,
421
+ ...props
490
422
  };
423
+ if (props.name !== void 0) {
424
+ this.name = props.name;
425
+ }
426
+ if (props.maxConcurrency !== void 0) {
427
+ this.maxConcurrency = props.maxConcurrency;
428
+ }
429
+ if (props.maxMobileConcurrency !== void 0) {
430
+ this.maxMobileConcurrency = props.maxMobileConcurrency;
431
+ }
432
+ if (props.reuseWorkers !== void 0) {
433
+ this.reuseWorkers = props.reuseWorkers;
434
+ }
435
+ if (props.onDebug !== void 0) {
436
+ this.onDebug = props.onDebug;
437
+ }
491
438
  }
492
- });
439
+ async startJob(name, onMessage3 = (job, type, data) => job.done(data), onError = (job, error) => job.error(error)) {
440
+ const startPromise = new Promise((onStart) => {
441
+ this.jobQueue.push({
442
+ name,
443
+ onMessage: onMessage3,
444
+ onError,
445
+ onStart
446
+ });
447
+ return this;
448
+ });
449
+ this._startQueuedJob();
450
+ return await startPromise;
451
+ }
452
+ async _startQueuedJob() {
453
+ if (!this.jobQueue.length) {
454
+ return;
455
+ }
456
+ const workerThread = this._getAvailableWorker();
457
+ if (!workerThread) {
458
+ return;
459
+ }
460
+ const queuedJob = this.jobQueue.shift();
461
+ if (queuedJob) {
462
+ this.onDebug({
463
+ message: "Starting job",
464
+ name: queuedJob.name,
465
+ workerThread,
466
+ backlog: this.jobQueue.length
467
+ });
468
+ const job = new WorkerJob(queuedJob.name, workerThread);
469
+ workerThread.onMessage = (data) => queuedJob.onMessage(job, data.type, data.payload);
470
+ workerThread.onError = (error) => queuedJob.onError(job, error);
471
+ queuedJob.onStart(job);
472
+ try {
473
+ await job.result;
474
+ } catch (error) {
475
+ console.error(`Worker exception: ${error}`);
476
+ } finally {
477
+ this.returnWorkerToQueue(workerThread);
478
+ }
479
+ }
480
+ }
481
+ returnWorkerToQueue(worker) {
482
+ const shouldDestroyWorker = !isBrowser2 || this.isDestroyed || !this.reuseWorkers || this.count > this._getMaxConcurrency();
483
+ if (shouldDestroyWorker) {
484
+ worker.destroy();
485
+ this.count--;
486
+ } else {
487
+ this.idleQueue.push(worker);
488
+ }
489
+ if (!this.isDestroyed) {
490
+ this._startQueuedJob();
491
+ }
492
+ }
493
+ _getAvailableWorker() {
494
+ if (this.idleQueue.length > 0) {
495
+ return this.idleQueue.shift() || null;
496
+ }
497
+ if (this.count < this._getMaxConcurrency()) {
498
+ this.count++;
499
+ const name = `${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;
500
+ return new WorkerThread({
501
+ name,
502
+ source: this.source,
503
+ url: this.url
504
+ });
505
+ }
506
+ return null;
507
+ }
508
+ _getMaxConcurrency() {
509
+ return isMobile ? this.maxMobileConcurrency : this.maxConcurrency;
510
+ }
511
+ };
493
512
 
494
513
  // ../worker-utils/src/lib/worker-farm/worker-farm.ts
495
- var DEFAULT_PROPS, WorkerFarm;
496
- var init_worker_farm = __esm({
497
- "../worker-utils/src/lib/worker-farm/worker-farm.ts"() {
498
- init_worker_pool();
499
- init_worker_thread();
500
- DEFAULT_PROPS = {
501
- maxConcurrency: 3,
502
- maxMobileConcurrency: 1,
503
- reuseWorkers: true,
504
- onDebug: () => {
505
- }
514
+ var DEFAULT_PROPS = {
515
+ maxConcurrency: 3,
516
+ maxMobileConcurrency: 1,
517
+ reuseWorkers: true,
518
+ onDebug: () => {
519
+ }
520
+ };
521
+ var WorkerFarm = class {
522
+ workerPools = /* @__PURE__ */ new Map();
523
+ static isSupported() {
524
+ return WorkerThread.isSupported();
525
+ }
526
+ static getWorkerFarm(props = {}) {
527
+ WorkerFarm._workerFarm = WorkerFarm._workerFarm || new WorkerFarm({});
528
+ WorkerFarm._workerFarm.setProps(props);
529
+ return WorkerFarm._workerFarm;
530
+ }
531
+ constructor(props) {
532
+ this.props = {
533
+ ...DEFAULT_PROPS
506
534
  };
507
- WorkerFarm = class {
508
- constructor(props) {
509
- this.workerPools = new Map();
510
- this.props = { ...DEFAULT_PROPS };
511
- this.setProps(props);
512
- this.workerPools = new Map();
513
- }
514
- static isSupported() {
515
- return WorkerThread.isSupported();
516
- }
517
- static getWorkerFarm(props = {}) {
518
- WorkerFarm._workerFarm = WorkerFarm._workerFarm || new WorkerFarm({});
519
- WorkerFarm._workerFarm.setProps(props);
520
- return WorkerFarm._workerFarm;
521
- }
522
- destroy() {
523
- for (const workerPool of this.workerPools.values()) {
524
- workerPool.destroy();
525
- }
526
- this.workerPools = new Map();
527
- }
528
- setProps(props) {
529
- this.props = { ...this.props, ...props };
530
- for (const workerPool of this.workerPools.values()) {
531
- workerPool.setProps(this._getWorkerPoolProps());
532
- }
533
- }
534
- getWorkerPool(options) {
535
- const { name, source, url } = options;
536
- let workerPool = this.workerPools.get(name);
537
- if (!workerPool) {
538
- workerPool = new WorkerPool({
539
- name,
540
- source,
541
- url
542
- });
543
- workerPool.setProps(this._getWorkerPoolProps());
544
- this.workerPools.set(name, workerPool);
545
- }
546
- return workerPool;
547
- }
548
- _getWorkerPoolProps() {
549
- return {
550
- maxConcurrency: this.props.maxConcurrency,
551
- maxMobileConcurrency: this.props.maxMobileConcurrency,
552
- reuseWorkers: this.props.reuseWorkers,
553
- onDebug: this.props.onDebug
554
- };
555
- }
535
+ this.setProps(props);
536
+ this.workerPools = /* @__PURE__ */ new Map();
537
+ }
538
+ destroy() {
539
+ for (const workerPool of this.workerPools.values()) {
540
+ workerPool.destroy();
541
+ }
542
+ this.workerPools = /* @__PURE__ */ new Map();
543
+ }
544
+ setProps(props) {
545
+ this.props = {
546
+ ...this.props,
547
+ ...props
556
548
  };
549
+ for (const workerPool of this.workerPools.values()) {
550
+ workerPool.setProps(this._getWorkerPoolProps());
551
+ }
557
552
  }
558
- });
553
+ getWorkerPool(options) {
554
+ const {
555
+ name,
556
+ source,
557
+ url
558
+ } = options;
559
+ let workerPool = this.workerPools.get(name);
560
+ if (!workerPool) {
561
+ workerPool = new WorkerPool({
562
+ name,
563
+ source,
564
+ url
565
+ });
566
+ workerPool.setProps(this._getWorkerPoolProps());
567
+ this.workerPools.set(name, workerPool);
568
+ }
569
+ return workerPool;
570
+ }
571
+ _getWorkerPoolProps() {
572
+ return {
573
+ maxConcurrency: this.props.maxConcurrency,
574
+ maxMobileConcurrency: this.props.maxMobileConcurrency,
575
+ reuseWorkers: this.props.reuseWorkers,
576
+ onDebug: this.props.onDebug
577
+ };
578
+ }
579
+ };
559
580
 
560
581
  // ../worker-utils/src/lib/worker-api/get-worker-url.ts
561
582
  function getWorkerName(worker) {
@@ -583,20 +604,18 @@
583
604
  assert2(url);
584
605
  return url;
585
606
  }
586
- var init_get_worker_url = __esm({
587
- "../worker-utils/src/lib/worker-api/get-worker-url.ts"() {
588
- init_assert2();
589
- init_globals2();
590
- init_version();
591
- }
592
- });
593
607
 
594
608
  // ../worker-utils/src/lib/worker-api/process-on-worker.ts
595
609
  async function processOnWorker(worker, data, options = {}, context = {}) {
596
610
  const name = getWorkerName(worker);
597
611
  const workerFarm = WorkerFarm.getWorkerFarm(options);
598
- const { source } = options;
599
- const workerPoolProps = { name, source };
612
+ const {
613
+ source
614
+ } = options;
615
+ const workerPoolProps = {
616
+ name,
617
+ source
618
+ };
600
619
  if (!source) {
601
620
  workerPoolProps.url = getWorkerURL(worker, options);
602
621
  }
@@ -604,7 +623,10 @@
604
623
  const jobName = options.jobName || worker.name;
605
624
  const job = await workerPool.startJob(jobName, onMessage.bind(null, context));
606
625
  const transferableOptions = getTransferListForWriter(options);
607
- job.postMessage("process", { input: data, options: transferableOptions });
626
+ job.postMessage("process", {
627
+ input: data,
628
+ options: transferableOptions
629
+ });
608
630
  const result = await job.result;
609
631
  return result.result;
610
632
  }
@@ -617,30 +639,36 @@
617
639
  job.error(new Error(payload.error));
618
640
  break;
619
641
  case "process":
620
- const { id, input, options } = payload;
642
+ const {
643
+ id,
644
+ input,
645
+ options
646
+ } = payload;
621
647
  try {
622
648
  if (!context.process) {
623
- job.postMessage("error", { id, error: "Worker not set up to process on main thread" });
649
+ job.postMessage("error", {
650
+ id,
651
+ error: "Worker not set up to process on main thread"
652
+ });
624
653
  return;
625
654
  }
626
655
  const result = await context.process(input, options);
627
- job.postMessage("done", { id, result });
656
+ job.postMessage("done", {
657
+ id,
658
+ result
659
+ });
628
660
  } catch (error) {
629
661
  const message = error instanceof Error ? error.message : "unknown error";
630
- job.postMessage("error", { id, error: message });
662
+ job.postMessage("error", {
663
+ id,
664
+ error: message
665
+ });
631
666
  }
632
667
  break;
633
668
  default:
634
669
  console.warn(`process-on-worker: unknown message ${type}`);
635
670
  }
636
671
  }
637
- var init_process_on_worker = __esm({
638
- "../worker-utils/src/lib/worker-api/process-on-worker.ts"() {
639
- init_worker_farm();
640
- init_get_worker_url();
641
- init_get_transfer_list();
642
- }
643
- });
644
672
 
645
673
  // ../worker-utils/src/lib/worker-api/validate-worker-version.ts
646
674
  function validateWorkerVersion(worker, coreVersion = VERSION) {
@@ -651,24 +679,6 @@
651
679
  }
652
680
  return true;
653
681
  }
654
- var init_validate_worker_version = __esm({
655
- "../worker-utils/src/lib/worker-api/validate-worker-version.ts"() {
656
- init_assert2();
657
- init_version();
658
- }
659
- });
660
-
661
- // ../worker-utils/src/index.ts
662
- var init_src = __esm({
663
- "../worker-utils/src/index.ts"() {
664
- init_assert2();
665
- init_globals2();
666
- init_worker_farm();
667
- init_process_on_worker();
668
- init_get_worker_url();
669
- init_validate_worker_version();
670
- }
671
- });
672
682
 
673
683
  // ../loader-utils/src/lib/worker-loader-utils/parse-with-worker.ts
674
684
  function canParseWithWorker(loader, options) {
@@ -684,7 +694,10 @@
684
694
  const name = loader.id;
685
695
  const url = getWorkerURL(loader, options);
686
696
  const workerFarm = WorkerFarm.getWorkerFarm(options);
687
- const workerPool = workerFarm.getWorkerPool({ name, url });
697
+ const workerPool = workerFarm.getWorkerPool({
698
+ name,
699
+ url
700
+ });
688
701
  options = JSON.parse(JSON.stringify(options));
689
702
  context = JSON.parse(JSON.stringify(context || {}));
690
703
  const job = await workerPool.startJob("process-on-worker", onMessage2.bind(null, parseOnMainThread));
@@ -705,25 +718,29 @@
705
718
  job.error(new Error(payload.error));
706
719
  break;
707
720
  case "process":
708
- const { id, input, options } = payload;
721
+ const {
722
+ id,
723
+ input,
724
+ options
725
+ } = payload;
709
726
  try {
710
727
  const result = await parseOnMainThread(input, options);
711
- job.postMessage("done", { id, result });
728
+ job.postMessage("done", {
729
+ id,
730
+ result
731
+ });
712
732
  } catch (error) {
713
733
  const message = error instanceof Error ? error.message : "unknown error";
714
- job.postMessage("error", { id, error: message });
734
+ job.postMessage("error", {
735
+ id,
736
+ error: message
737
+ });
715
738
  }
716
739
  break;
717
740
  default:
718
741
  console.warn(`parse-with-worker unknown message ${type}`);
719
742
  }
720
743
  }
721
- var init_parse_with_worker = __esm({
722
- "../loader-utils/src/lib/worker-loader-utils/parse-with-worker.ts"() {
723
- init_src();
724
- init_src();
725
- }
726
- });
727
744
 
728
745
  // ../loader-utils/src/lib/worker-loader-utils/encode-with-worker.ts
729
746
  function canEncodeWithWorker(writer, options) {
@@ -735,12 +752,6 @@
735
752
  }
736
753
  return writer.worker && options?.worker;
737
754
  }
738
- var init_encode_with_worker = __esm({
739
- "../loader-utils/src/lib/worker-loader-utils/encode-with-worker.ts"() {
740
- init_src();
741
- init_globals();
742
- }
743
- });
744
755
 
745
756
  // ../loader-utils/src/lib/binary-utils/array-buffer-utils.ts
746
757
  function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
@@ -768,16 +779,14 @@
768
779
  }
769
780
  return result.buffer;
770
781
  }
771
- var init_array_buffer_utils = __esm({
772
- "../loader-utils/src/lib/binary-utils/array-buffer-utils.ts"() {
773
- }
774
- });
775
782
 
776
783
  // ../loader-utils/src/lib/iterators/text-iterators.ts
777
784
  async function* makeTextDecoderIterator(arrayBufferIterator, options = {}) {
778
785
  const textDecoder = new TextDecoder(void 0, options);
779
786
  for await (const arrayBuffer of arrayBufferIterator) {
780
- yield typeof arrayBuffer === "string" ? arrayBuffer : textDecoder.decode(arrayBuffer, { stream: true });
787
+ yield typeof arrayBuffer === "string" ? arrayBuffer : textDecoder.decode(arrayBuffer, {
788
+ stream: true
789
+ });
781
790
  }
782
791
  }
783
792
  async function* makeTextEncoderIterator(textIterator) {
@@ -804,19 +813,21 @@
804
813
  async function* makeNumberedLineIterator(lineIterator) {
805
814
  let counter = 1;
806
815
  for await (const line of lineIterator) {
807
- yield { counter, line };
816
+ yield {
817
+ counter,
818
+ line
819
+ };
808
820
  counter++;
809
821
  }
810
822
  }
811
- var init_text_iterators = __esm({
812
- "../loader-utils/src/lib/iterators/text-iterators.ts"() {
813
- }
814
- });
815
823
 
816
824
  // ../loader-utils/src/lib/iterators/async-iteration.ts
817
825
  async function forEach(iterator, visitor) {
818
826
  while (true) {
819
- const { done, value } = await iterator.next();
827
+ const {
828
+ done,
829
+ value
830
+ } = await iterator.next();
820
831
  if (done) {
821
832
  iterator.return();
822
833
  return;
@@ -834,25 +845,16 @@
834
845
  }
835
846
  return concatenateArrayBuffers(...arrayBuffers);
836
847
  }
837
- var init_async_iteration = __esm({
838
- "../loader-utils/src/lib/iterators/async-iteration.ts"() {
839
- init_array_buffer_utils();
840
- }
841
- });
842
848
 
843
849
  // ../../node_modules/@babel/runtime/helpers/esm/typeof.js
844
850
  function _typeof(obj) {
845
851
  "@babel/helpers - typeof";
846
- return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
852
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
847
853
  return typeof obj2;
848
854
  } : function(obj2) {
849
- return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
855
+ return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
850
856
  }, _typeof(obj);
851
857
  }
852
- var init_typeof = __esm({
853
- "../../node_modules/@babel/runtime/helpers/esm/typeof.js"() {
854
- }
855
- });
856
858
 
857
859
  // ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
858
860
  function _toPrimitive(input, hint) {
@@ -867,23 +869,12 @@
867
869
  }
868
870
  return (hint === "string" ? String : Number)(input);
869
871
  }
870
- var init_toPrimitive = __esm({
871
- "../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js"() {
872
- init_typeof();
873
- }
874
- });
875
872
 
876
873
  // ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
877
874
  function _toPropertyKey(arg) {
878
875
  var key = _toPrimitive(arg, "string");
879
876
  return _typeof(key) === "symbol" ? key : String(key);
880
877
  }
881
- var init_toPropertyKey = __esm({
882
- "../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js"() {
883
- init_typeof();
884
- init_toPrimitive();
885
- }
886
- });
887
878
 
888
879
  // ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
889
880
  function _defineProperty(obj, key, value) {
@@ -900,11 +891,6 @@
900
891
  }
901
892
  return obj;
902
893
  }
903
- var init_defineProperty = __esm({
904
- "../../node_modules/@babel/runtime/helpers/esm/defineProperty.js"() {
905
- init_toPropertyKey();
906
- }
907
- });
908
894
 
909
895
  // ../loader-utils/node_modules/@probe.gl/stats/dist/utils/hi-res-timestamp.js
910
896
  function getHiResTimestamp() {
@@ -919,316 +905,303 @@
919
905
  }
920
906
  return timestamp;
921
907
  }
922
- var init_hi_res_timestamp = __esm({
923
- "../loader-utils/node_modules/@probe.gl/stats/dist/utils/hi-res-timestamp.js"() {
924
- }
925
- });
926
908
 
927
909
  // ../loader-utils/node_modules/@probe.gl/stats/dist/lib/stat.js
928
- var Stat;
929
- var init_stat = __esm({
930
- "../loader-utils/node_modules/@probe.gl/stats/dist/lib/stat.js"() {
931
- init_defineProperty();
932
- init_hi_res_timestamp();
933
- Stat = class {
934
- constructor(name, type) {
935
- _defineProperty(this, "name", void 0);
936
- _defineProperty(this, "type", void 0);
937
- _defineProperty(this, "sampleSize", 1);
938
- _defineProperty(this, "time", 0);
939
- _defineProperty(this, "count", 0);
940
- _defineProperty(this, "samples", 0);
941
- _defineProperty(this, "lastTiming", 0);
942
- _defineProperty(this, "lastSampleTime", 0);
943
- _defineProperty(this, "lastSampleCount", 0);
944
- _defineProperty(this, "_count", 0);
945
- _defineProperty(this, "_time", 0);
946
- _defineProperty(this, "_samples", 0);
947
- _defineProperty(this, "_startTime", 0);
948
- _defineProperty(this, "_timerPending", false);
949
- this.name = name;
950
- this.type = type;
951
- this.reset();
952
- }
953
- reset() {
954
- this.time = 0;
955
- this.count = 0;
956
- this.samples = 0;
957
- this.lastTiming = 0;
958
- this.lastSampleTime = 0;
959
- this.lastSampleCount = 0;
960
- this._count = 0;
961
- this._time = 0;
962
- this._samples = 0;
963
- this._startTime = 0;
964
- this._timerPending = false;
965
- return this;
966
- }
967
- setSampleSize(samples) {
968
- this.sampleSize = samples;
969
- return this;
970
- }
971
- incrementCount() {
972
- this.addCount(1);
973
- return this;
974
- }
975
- decrementCount() {
976
- this.subtractCount(1);
977
- return this;
978
- }
979
- addCount(value) {
980
- this._count += value;
981
- this._samples++;
982
- this._checkSampling();
983
- return this;
984
- }
985
- subtractCount(value) {
986
- this._count -= value;
987
- this._samples++;
988
- this._checkSampling();
989
- return this;
990
- }
991
- addTime(time) {
992
- this._time += time;
993
- this.lastTiming = time;
994
- this._samples++;
995
- this._checkSampling();
996
- return this;
997
- }
998
- timeStart() {
999
- this._startTime = getHiResTimestamp();
1000
- this._timerPending = true;
1001
- return this;
1002
- }
1003
- timeEnd() {
1004
- if (!this._timerPending) {
1005
- return this;
1006
- }
1007
- this.addTime(getHiResTimestamp() - this._startTime);
1008
- this._timerPending = false;
1009
- this._checkSampling();
1010
- return this;
1011
- }
1012
- getSampleAverageCount() {
1013
- return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0;
1014
- }
1015
- getSampleAverageTime() {
1016
- return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;
1017
- }
1018
- getSampleHz() {
1019
- return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1e3) : 0;
1020
- }
1021
- getAverageCount() {
1022
- return this.samples > 0 ? this.count / this.samples : 0;
1023
- }
1024
- getAverageTime() {
1025
- return this.samples > 0 ? this.time / this.samples : 0;
1026
- }
1027
- getHz() {
1028
- return this.time > 0 ? this.samples / (this.time / 1e3) : 0;
1029
- }
1030
- _checkSampling() {
1031
- if (this._samples === this.sampleSize) {
1032
- this.lastSampleTime = this._time;
1033
- this.lastSampleCount = this._count;
1034
- this.count += this._count;
1035
- this.time += this._time;
1036
- this.samples += this._samples;
1037
- this._time = 0;
1038
- this._count = 0;
1039
- this._samples = 0;
1040
- }
1041
- }
1042
- };
910
+ var Stat = class {
911
+ constructor(name, type) {
912
+ _defineProperty(this, "name", void 0);
913
+ _defineProperty(this, "type", void 0);
914
+ _defineProperty(this, "sampleSize", 1);
915
+ _defineProperty(this, "time", 0);
916
+ _defineProperty(this, "count", 0);
917
+ _defineProperty(this, "samples", 0);
918
+ _defineProperty(this, "lastTiming", 0);
919
+ _defineProperty(this, "lastSampleTime", 0);
920
+ _defineProperty(this, "lastSampleCount", 0);
921
+ _defineProperty(this, "_count", 0);
922
+ _defineProperty(this, "_time", 0);
923
+ _defineProperty(this, "_samples", 0);
924
+ _defineProperty(this, "_startTime", 0);
925
+ _defineProperty(this, "_timerPending", false);
926
+ this.name = name;
927
+ this.type = type;
928
+ this.reset();
929
+ }
930
+ reset() {
931
+ this.time = 0;
932
+ this.count = 0;
933
+ this.samples = 0;
934
+ this.lastTiming = 0;
935
+ this.lastSampleTime = 0;
936
+ this.lastSampleCount = 0;
937
+ this._count = 0;
938
+ this._time = 0;
939
+ this._samples = 0;
940
+ this._startTime = 0;
941
+ this._timerPending = false;
942
+ return this;
943
+ }
944
+ setSampleSize(samples) {
945
+ this.sampleSize = samples;
946
+ return this;
947
+ }
948
+ incrementCount() {
949
+ this.addCount(1);
950
+ return this;
951
+ }
952
+ decrementCount() {
953
+ this.subtractCount(1);
954
+ return this;
955
+ }
956
+ addCount(value) {
957
+ this._count += value;
958
+ this._samples++;
959
+ this._checkSampling();
960
+ return this;
961
+ }
962
+ subtractCount(value) {
963
+ this._count -= value;
964
+ this._samples++;
965
+ this._checkSampling();
966
+ return this;
967
+ }
968
+ addTime(time) {
969
+ this._time += time;
970
+ this.lastTiming = time;
971
+ this._samples++;
972
+ this._checkSampling();
973
+ return this;
974
+ }
975
+ timeStart() {
976
+ this._startTime = getHiResTimestamp();
977
+ this._timerPending = true;
978
+ return this;
979
+ }
980
+ timeEnd() {
981
+ if (!this._timerPending) {
982
+ return this;
983
+ }
984
+ this.addTime(getHiResTimestamp() - this._startTime);
985
+ this._timerPending = false;
986
+ this._checkSampling();
987
+ return this;
988
+ }
989
+ getSampleAverageCount() {
990
+ return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0;
991
+ }
992
+ getSampleAverageTime() {
993
+ return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;
994
+ }
995
+ getSampleHz() {
996
+ return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1e3) : 0;
997
+ }
998
+ getAverageCount() {
999
+ return this.samples > 0 ? this.count / this.samples : 0;
1000
+ }
1001
+ getAverageTime() {
1002
+ return this.samples > 0 ? this.time / this.samples : 0;
1003
+ }
1004
+ getHz() {
1005
+ return this.time > 0 ? this.samples / (this.time / 1e3) : 0;
1006
+ }
1007
+ _checkSampling() {
1008
+ if (this._samples === this.sampleSize) {
1009
+ this.lastSampleTime = this._time;
1010
+ this.lastSampleCount = this._count;
1011
+ this.count += this._count;
1012
+ this.time += this._time;
1013
+ this.samples += this._samples;
1014
+ this._time = 0;
1015
+ this._count = 0;
1016
+ this._samples = 0;
1017
+ }
1043
1018
  }
1044
- });
1019
+ };
1045
1020
 
1046
1021
  // ../loader-utils/node_modules/@probe.gl/stats/dist/lib/stats.js
1047
- var Stats;
1048
- var init_stats = __esm({
1049
- "../loader-utils/node_modules/@probe.gl/stats/dist/lib/stats.js"() {
1050
- init_defineProperty();
1051
- init_stat();
1052
- Stats = class {
1053
- constructor(options) {
1054
- _defineProperty(this, "id", void 0);
1055
- _defineProperty(this, "stats", {});
1056
- this.id = options.id;
1057
- this.stats = {};
1058
- this._initializeStats(options.stats);
1059
- Object.seal(this);
1060
- }
1061
- get(name) {
1062
- let type = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "count";
1063
- return this._getOrCreate({
1064
- name,
1065
- type
1066
- });
1067
- }
1068
- get size() {
1069
- return Object.keys(this.stats).length;
1070
- }
1071
- reset() {
1072
- for (const stat of Object.values(this.stats)) {
1073
- stat.reset();
1074
- }
1075
- return this;
1076
- }
1077
- forEach(fn) {
1078
- for (const stat of Object.values(this.stats)) {
1079
- fn(stat);
1080
- }
1081
- }
1082
- getTable() {
1083
- const table = {};
1084
- this.forEach((stat) => {
1085
- table[stat.name] = {
1086
- time: stat.time || 0,
1087
- count: stat.count || 0,
1088
- average: stat.getAverageTime() || 0,
1089
- hz: stat.getHz() || 0
1090
- };
1091
- });
1092
- return table;
1093
- }
1094
- _initializeStats() {
1095
- let stats = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
1096
- stats.forEach((stat) => this._getOrCreate(stat));
1097
- }
1098
- _getOrCreate(stat) {
1099
- const {
1100
- name,
1101
- type
1102
- } = stat;
1103
- let result = this.stats[name];
1104
- if (!result) {
1105
- if (stat instanceof Stat) {
1106
- result = stat;
1107
- } else {
1108
- result = new Stat(name, type);
1109
- }
1110
- this.stats[name] = result;
1111
- }
1112
- return result;
1113
- }
1114
- };
1022
+ var Stats = class {
1023
+ constructor(options) {
1024
+ _defineProperty(this, "id", void 0);
1025
+ _defineProperty(this, "stats", {});
1026
+ this.id = options.id;
1027
+ this.stats = {};
1028
+ this._initializeStats(options.stats);
1029
+ Object.seal(this);
1030
+ }
1031
+ get(name) {
1032
+ let type = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "count";
1033
+ return this._getOrCreate({
1034
+ name,
1035
+ type
1036
+ });
1115
1037
  }
1116
- });
1117
-
1118
- // ../loader-utils/node_modules/@probe.gl/stats/dist/index.js
1119
- var init_dist = __esm({
1120
- "../loader-utils/node_modules/@probe.gl/stats/dist/index.js"() {
1121
- init_stats();
1122
- init_stat();
1123
- init_hi_res_timestamp();
1038
+ get size() {
1039
+ return Object.keys(this.stats).length;
1124
1040
  }
1125
- });
1041
+ reset() {
1042
+ for (const stat of Object.values(this.stats)) {
1043
+ stat.reset();
1044
+ }
1045
+ return this;
1046
+ }
1047
+ forEach(fn) {
1048
+ for (const stat of Object.values(this.stats)) {
1049
+ fn(stat);
1050
+ }
1051
+ }
1052
+ getTable() {
1053
+ const table = {};
1054
+ this.forEach((stat) => {
1055
+ table[stat.name] = {
1056
+ time: stat.time || 0,
1057
+ count: stat.count || 0,
1058
+ average: stat.getAverageTime() || 0,
1059
+ hz: stat.getHz() || 0
1060
+ };
1061
+ });
1062
+ return table;
1063
+ }
1064
+ _initializeStats() {
1065
+ let stats = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
1066
+ stats.forEach((stat) => this._getOrCreate(stat));
1067
+ }
1068
+ _getOrCreate(stat) {
1069
+ const {
1070
+ name,
1071
+ type
1072
+ } = stat;
1073
+ let result = this.stats[name];
1074
+ if (!result) {
1075
+ if (stat instanceof Stat) {
1076
+ result = stat;
1077
+ } else {
1078
+ result = new Stat(name, type);
1079
+ }
1080
+ this.stats[name] = result;
1081
+ }
1082
+ return result;
1083
+ }
1084
+ };
1126
1085
 
1127
1086
  // ../loader-utils/src/lib/request-utils/request-scheduler.ts
1128
- var STAT_QUEUED_REQUESTS, STAT_ACTIVE_REQUESTS, STAT_CANCELLED_REQUESTS, STAT_QUEUED_REQUESTS_EVER, STAT_ACTIVE_REQUESTS_EVER, DEFAULT_PROPS2, RequestScheduler;
1129
- var init_request_scheduler = __esm({
1130
- "../loader-utils/src/lib/request-utils/request-scheduler.ts"() {
1131
- init_dist();
1132
- STAT_QUEUED_REQUESTS = "Queued Requests";
1133
- STAT_ACTIVE_REQUESTS = "Active Requests";
1134
- STAT_CANCELLED_REQUESTS = "Cancelled Requests";
1135
- STAT_QUEUED_REQUESTS_EVER = "Queued Requests Ever";
1136
- STAT_ACTIVE_REQUESTS_EVER = "Active Requests Ever";
1137
- DEFAULT_PROPS2 = {
1138
- id: "request-scheduler",
1139
- throttleRequests: true,
1140
- maxRequests: 6
1087
+ var STAT_QUEUED_REQUESTS = "Queued Requests";
1088
+ var STAT_ACTIVE_REQUESTS = "Active Requests";
1089
+ var STAT_CANCELLED_REQUESTS = "Cancelled Requests";
1090
+ var STAT_QUEUED_REQUESTS_EVER = "Queued Requests Ever";
1091
+ var STAT_ACTIVE_REQUESTS_EVER = "Active Requests Ever";
1092
+ var DEFAULT_PROPS2 = {
1093
+ id: "request-scheduler",
1094
+ throttleRequests: true,
1095
+ maxRequests: 6
1096
+ };
1097
+ var RequestScheduler = class {
1098
+ activeRequestCount = 0;
1099
+ requestQueue = [];
1100
+ requestMap = /* @__PURE__ */ new Map();
1101
+ deferredUpdate = null;
1102
+ constructor(props = {}) {
1103
+ this.props = {
1104
+ ...DEFAULT_PROPS2,
1105
+ ...props
1141
1106
  };
1142
- RequestScheduler = class {
1143
- constructor(props = {}) {
1144
- this.activeRequestCount = 0;
1145
- this.requestQueue = [];
1146
- this.requestMap = new Map();
1147
- this.deferredUpdate = null;
1148
- this.props = { ...DEFAULT_PROPS2, ...props };
1149
- this.stats = new Stats({ id: this.props.id });
1150
- this.stats.get(STAT_QUEUED_REQUESTS);
1151
- this.stats.get(STAT_ACTIVE_REQUESTS);
1152
- this.stats.get(STAT_CANCELLED_REQUESTS);
1153
- this.stats.get(STAT_QUEUED_REQUESTS_EVER);
1154
- this.stats.get(STAT_ACTIVE_REQUESTS_EVER);
1155
- }
1156
- scheduleRequest(handle, getPriority = () => 0) {
1157
- if (!this.props.throttleRequests) {
1158
- return Promise.resolve({ done: () => {
1159
- } });
1160
- }
1161
- if (this.requestMap.has(handle)) {
1162
- return this.requestMap.get(handle);
1107
+ this.stats = new Stats({
1108
+ id: this.props.id
1109
+ });
1110
+ this.stats.get(STAT_QUEUED_REQUESTS);
1111
+ this.stats.get(STAT_ACTIVE_REQUESTS);
1112
+ this.stats.get(STAT_CANCELLED_REQUESTS);
1113
+ this.stats.get(STAT_QUEUED_REQUESTS_EVER);
1114
+ this.stats.get(STAT_ACTIVE_REQUESTS_EVER);
1115
+ }
1116
+ scheduleRequest(handle, getPriority = () => 0) {
1117
+ if (!this.props.throttleRequests) {
1118
+ return Promise.resolve({
1119
+ done: () => {
1163
1120
  }
1164
- const request = { handle, priority: 0, getPriority };
1165
- const promise = new Promise((resolve2) => {
1166
- request.resolve = resolve2;
1167
- return request;
1168
- });
1169
- this.requestQueue.push(request);
1170
- this.requestMap.set(handle, promise);
1121
+ });
1122
+ }
1123
+ if (this.requestMap.has(handle)) {
1124
+ return this.requestMap.get(handle);
1125
+ }
1126
+ const request = {
1127
+ handle,
1128
+ priority: 0,
1129
+ getPriority
1130
+ };
1131
+ const promise = new Promise((resolve2) => {
1132
+ request.resolve = resolve2;
1133
+ return request;
1134
+ });
1135
+ this.requestQueue.push(request);
1136
+ this.requestMap.set(handle, promise);
1137
+ this._issueNewRequests();
1138
+ return promise;
1139
+ }
1140
+ _issueRequest(request) {
1141
+ const {
1142
+ handle,
1143
+ resolve: resolve2
1144
+ } = request;
1145
+ let isDone = false;
1146
+ const done = () => {
1147
+ if (!isDone) {
1148
+ isDone = true;
1149
+ this.requestMap.delete(handle);
1150
+ this.activeRequestCount--;
1171
1151
  this._issueNewRequests();
1172
- return promise;
1173
1152
  }
1174
- _issueRequest(request) {
1175
- const { handle, resolve: resolve2 } = request;
1176
- let isDone = false;
1177
- const done = () => {
1178
- if (!isDone) {
1179
- isDone = true;
1180
- this.requestMap.delete(handle);
1181
- this.activeRequestCount--;
1182
- this._issueNewRequests();
1183
- }
1184
- };
1185
- this.activeRequestCount++;
1186
- return resolve2 ? resolve2({ done }) : Promise.resolve({ done });
1187
- }
1188
- _issueNewRequests() {
1189
- if (!this.deferredUpdate) {
1190
- this.deferredUpdate = setTimeout(() => this._issueNewRequestsAsync(), 0);
1191
- }
1192
- }
1193
- _issueNewRequestsAsync() {
1194
- this.deferredUpdate = null;
1195
- const freeSlots = Math.max(this.props.maxRequests - this.activeRequestCount, 0);
1196
- if (freeSlots === 0) {
1197
- return;
1198
- }
1199
- this._updateAllRequests();
1200
- for (let i = 0; i < freeSlots; ++i) {
1201
- const request = this.requestQueue.shift();
1202
- if (request) {
1203
- this._issueRequest(request);
1204
- }
1205
- }
1206
- }
1207
- _updateAllRequests() {
1208
- const requestQueue = this.requestQueue;
1209
- for (let i = 0; i < requestQueue.length; ++i) {
1210
- const request = requestQueue[i];
1211
- if (!this._updateRequest(request)) {
1212
- requestQueue.splice(i, 1);
1213
- this.requestMap.delete(request.handle);
1214
- i--;
1215
- }
1216
- }
1217
- requestQueue.sort((a, b) => a.priority - b.priority);
1153
+ };
1154
+ this.activeRequestCount++;
1155
+ return resolve2 ? resolve2({
1156
+ done
1157
+ }) : Promise.resolve({
1158
+ done
1159
+ });
1160
+ }
1161
+ _issueNewRequests() {
1162
+ if (!this.deferredUpdate) {
1163
+ this.deferredUpdate = setTimeout(() => this._issueNewRequestsAsync(), 0);
1164
+ }
1165
+ }
1166
+ _issueNewRequestsAsync() {
1167
+ this.deferredUpdate = null;
1168
+ const freeSlots = Math.max(this.props.maxRequests - this.activeRequestCount, 0);
1169
+ if (freeSlots === 0) {
1170
+ return;
1171
+ }
1172
+ this._updateAllRequests();
1173
+ for (let i = 0; i < freeSlots; ++i) {
1174
+ const request = this.requestQueue.shift();
1175
+ if (request) {
1176
+ this._issueRequest(request);
1218
1177
  }
1219
- _updateRequest(request) {
1220
- request.priority = request.getPriority(request.handle);
1221
- if (request.priority < 0) {
1222
- request.resolve(null);
1223
- return false;
1224
- }
1225
- return true;
1178
+ }
1179
+ }
1180
+ _updateAllRequests() {
1181
+ const requestQueue = this.requestQueue;
1182
+ for (let i = 0; i < requestQueue.length; ++i) {
1183
+ const request = requestQueue[i];
1184
+ if (!this._updateRequest(request)) {
1185
+ requestQueue.splice(i, 1);
1186
+ this.requestMap.delete(request.handle);
1187
+ i--;
1226
1188
  }
1227
- };
1189
+ }
1190
+ requestQueue.sort((a, b) => a.priority - b.priority);
1228
1191
  }
1229
- });
1192
+ _updateRequest(request) {
1193
+ request.priority = request.getPriority(request.handle);
1194
+ if (request.priority < 0) {
1195
+ request.resolve(null);
1196
+ return false;
1197
+ }
1198
+ return true;
1199
+ }
1200
+ };
1230
1201
 
1231
1202
  // ../loader-utils/src/lib/path-utils/file-aliases.ts
1203
+ var pathPrefix = "";
1204
+ var fileAliases = {};
1232
1205
  function setPathPrefix(prefix) {
1233
1206
  pathPrefix = prefix;
1234
1207
  }
@@ -1247,57 +1220,35 @@
1247
1220
  }
1248
1221
  return filename2;
1249
1222
  }
1250
- var pathPrefix, fileAliases;
1251
- var init_file_aliases = __esm({
1252
- "../loader-utils/src/lib/path-utils/file-aliases.ts"() {
1253
- pathPrefix = "";
1254
- fileAliases = {};
1255
- }
1256
- });
1257
1223
 
1258
1224
  // ../loader-utils/src/json-loader.ts
1225
+ var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
1226
+ var JSONLoader = {
1227
+ name: "JSON",
1228
+ id: "json",
1229
+ module: "json",
1230
+ version: VERSION2,
1231
+ extensions: ["json", "geojson"],
1232
+ mimeTypes: ["application/json"],
1233
+ category: "json",
1234
+ text: true,
1235
+ parseTextSync,
1236
+ parse: async (arrayBuffer) => parseTextSync(new TextDecoder().decode(arrayBuffer)),
1237
+ options: {}
1238
+ };
1259
1239
  function parseTextSync(text) {
1260
1240
  return JSON.parse(text);
1261
1241
  }
1262
- var VERSION2, JSONLoader;
1263
- var init_json_loader = __esm({
1264
- "../loader-utils/src/json-loader.ts"() {
1265
- VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
1266
- JSONLoader = {
1267
- name: "JSON",
1268
- id: "json",
1269
- module: "json",
1270
- version: VERSION2,
1271
- extensions: ["json", "geojson"],
1272
- mimeTypes: ["application/json"],
1273
- category: "json",
1274
- text: true,
1275
- parseTextSync,
1276
- parse: async (arrayBuffer) => parseTextSync(new TextDecoder().decode(arrayBuffer)),
1277
- options: {}
1278
- };
1279
- }
1280
- });
1281
1242
 
1282
1243
  // ../loader-utils/src/lib/node/buffer.browser.ts
1283
1244
  function toArrayBuffer(buffer) {
1284
1245
  return buffer;
1285
1246
  }
1286
- function toBuffer(binaryData) {
1287
- throw new Error("Buffer not supported in browser");
1288
- }
1289
- var init_buffer_browser = __esm({
1290
- "../loader-utils/src/lib/node/buffer.browser.ts"() {
1291
- }
1292
- });
1293
1247
 
1294
1248
  // ../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts
1295
1249
  function isBuffer(value) {
1296
1250
  return value && typeof value === "object" && value.isBuffer;
1297
1251
  }
1298
- function toBuffer2(data) {
1299
- return toBuffer ? toBuffer(data) : data;
1300
- }
1301
1252
  function toArrayBuffer2(data) {
1302
1253
  if (isBuffer(data)) {
1303
1254
  return toArrayBuffer(data);
@@ -1321,10 +1272,14 @@
1321
1272
  }
1322
1273
  throw new Error("toArrayBuffer");
1323
1274
  }
1324
- var init_memory_conversion_utils = __esm({
1325
- "../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts"() {
1326
- init_buffer_browser();
1327
- }
1275
+
1276
+ // ../loader-utils/src/lib/path-utils/path.ts
1277
+ var path_exports = {};
1278
+ __export(path_exports, {
1279
+ dirname: () => dirname,
1280
+ filename: () => filename,
1281
+ join: () => join,
1282
+ resolve: () => resolve
1328
1283
  });
1329
1284
 
1330
1285
  // ../loader-utils/src/lib/path-utils/get-cwd.ts
@@ -1335,19 +1290,8 @@
1335
1290
  const pathname = window.location?.pathname;
1336
1291
  return pathname?.slice(0, pathname.lastIndexOf("/") + 1) || "";
1337
1292
  }
1338
- var init_get_cwd = __esm({
1339
- "../loader-utils/src/lib/path-utils/get-cwd.ts"() {
1340
- }
1341
- });
1342
1293
 
1343
1294
  // ../loader-utils/src/lib/path-utils/path.ts
1344
- var path_exports = {};
1345
- __export(path_exports, {
1346
- dirname: () => dirname,
1347
- filename: () => filename,
1348
- join: () => join,
1349
- resolve: () => resolve
1350
- });
1351
1295
  function filename(url) {
1352
1296
  const slashIndex = url ? url.lastIndexOf("/") : -1;
1353
1297
  return slashIndex >= 0 ? url.substr(slashIndex + 1) : "";
@@ -1401,6 +1345,8 @@
1401
1345
  }
1402
1346
  return ".";
1403
1347
  }
1348
+ var SLASH = 47;
1349
+ var DOT = 46;
1404
1350
  function normalizeStringPosix(path, allowAboveRoot) {
1405
1351
  let res = "";
1406
1352
  let lastSlash = -1;
@@ -1469,72 +1415,80 @@
1469
1415
  }
1470
1416
  return res;
1471
1417
  }
1472
- var SLASH, DOT;
1473
- var init_path = __esm({
1474
- "../loader-utils/src/lib/path-utils/path.ts"() {
1475
- init_get_cwd();
1476
- SLASH = 47;
1477
- DOT = 46;
1478
- }
1479
- });
1480
1418
 
1481
- // ../loader-utils/src/lib/node/fs.browser.ts
1482
- var fs_browser_exports = {};
1483
- __export(fs_browser_exports, {
1484
- isSupported: () => isSupported
1485
- });
1486
- var isSupported;
1487
- var init_fs_browser = __esm({
1488
- "../loader-utils/src/lib/node/fs.browser.ts"() {
1489
- isSupported = false;
1419
+ // ../loader-utils/src/lib/files/blob-file.ts
1420
+ var BlobFile = class {
1421
+ constructor(blob) {
1422
+ this.handle = blob instanceof ArrayBuffer ? new Blob([blob]) : blob;
1423
+ this.size = blob instanceof ArrayBuffer ? blob.byteLength : blob.size;
1424
+ this.bigsize = BigInt(this.size);
1425
+ this.url = blob instanceof File ? blob.name : "";
1490
1426
  }
1491
- });
1427
+ async close() {
1428
+ }
1429
+ async stat() {
1430
+ return {
1431
+ size: this.handle.size,
1432
+ bigsize: BigInt(this.handle.size),
1433
+ isDirectory: false
1434
+ };
1435
+ }
1436
+ async read(start, length) {
1437
+ const arrayBuffer = await this.handle.slice(start, start + length).arrayBuffer();
1438
+ return arrayBuffer;
1439
+ }
1440
+ };
1492
1441
 
1493
- // ../loader-utils/src/index.ts
1494
- var init_src2 = __esm({
1495
- "../loader-utils/src/index.ts"() {
1496
- init_assert();
1497
- init_globals();
1498
- init_merge_loader_options();
1499
- init_parse_with_worker();
1500
- init_encode_with_worker();
1501
- init_array_buffer_utils();
1502
- init_text_iterators();
1503
- init_async_iteration();
1504
- init_request_scheduler();
1505
- init_file_aliases();
1506
- init_json_loader();
1507
- init_memory_conversion_utils();
1508
- init_path();
1509
- init_fs_browser();
1442
+ // ../loader-utils/src/lib/files/node-file-facade.ts
1443
+ var NOT_IMPLEMENTED = new Error("Not implemented");
1444
+ var NodeFileFacade = class {
1445
+ size = 0;
1446
+ bigsize = 0n;
1447
+ url = "";
1448
+ constructor(url, flags, mode) {
1449
+ if (globalThis.loaders?.NodeFile) {
1450
+ return new globalThis.loaders.NodeFile(url, flags, mode);
1451
+ }
1452
+ if (isBrowser) {
1453
+ throw new Error("Can't instantiate NodeFile in browser.");
1454
+ }
1455
+ throw new Error("Can't instantiate NodeFile. Make sure to import @loaders.gl/polyfills first.");
1510
1456
  }
1511
- });
1457
+ async read(start, end) {
1458
+ throw NOT_IMPLEMENTED;
1459
+ }
1460
+ async write(arrayBuffer, offset, length) {
1461
+ throw NOT_IMPLEMENTED;
1462
+ }
1463
+ async stat() {
1464
+ throw NOT_IMPLEMENTED;
1465
+ }
1466
+ async close() {
1467
+ }
1468
+ };
1512
1469
 
1513
1470
  // src/javascript-utils/is-type.ts
1514
- var isBoolean, isFunction, isObject, isPureObject, isPromise, isIterable, isAsyncIterable, isIterator, isResponse, isBlob, isBuffer2, isWritableDOMStream, isReadableDOMStream, isWritableNodeStream, isReadableNodeStream, isReadableStream, isWritableStream;
1515
- var init_is_type = __esm({
1516
- "src/javascript-utils/is-type.ts"() {
1517
- isBoolean = (x) => typeof x === "boolean";
1518
- isFunction = (x) => typeof x === "function";
1519
- isObject = (x) => x !== null && typeof x === "object";
1520
- isPureObject = (x) => isObject(x) && x.constructor === {}.constructor;
1521
- isPromise = (x) => isObject(x) && isFunction(x.then);
1522
- isIterable = (x) => Boolean(x) && typeof x[Symbol.iterator] === "function";
1523
- isAsyncIterable = (x) => x && typeof x[Symbol.asyncIterator] === "function";
1524
- isIterator = (x) => x && isFunction(x.next);
1525
- isResponse = (x) => typeof Response !== "undefined" && x instanceof Response || x && x.arrayBuffer && x.text && x.json;
1526
- isBlob = (x) => typeof Blob !== "undefined" && x instanceof Blob;
1527
- isBuffer2 = (x) => x && typeof x === "object" && x.isBuffer;
1528
- isWritableDOMStream = (x) => isObject(x) && isFunction(x.abort) && isFunction(x.getWriter);
1529
- isReadableDOMStream = (x) => typeof ReadableStream !== "undefined" && x instanceof ReadableStream || isObject(x) && isFunction(x.tee) && isFunction(x.cancel) && isFunction(x.getReader);
1530
- isWritableNodeStream = (x) => isObject(x) && isFunction(x.end) && isFunction(x.write) && isBoolean(x.writable);
1531
- isReadableNodeStream = (x) => isObject(x) && isFunction(x.read) && isFunction(x.pipe) && isBoolean(x.readable);
1532
- isReadableStream = (x) => isReadableDOMStream(x) || isReadableNodeStream(x);
1533
- isWritableStream = (x) => isWritableDOMStream(x) || isWritableNodeStream(x);
1534
- }
1535
- });
1471
+ var isBoolean = (x) => typeof x === "boolean";
1472
+ var isFunction = (x) => typeof x === "function";
1473
+ var isObject = (x) => x !== null && typeof x === "object";
1474
+ var isPureObject = (x) => isObject(x) && x.constructor === {}.constructor;
1475
+ var isPromise = (x) => isObject(x) && isFunction(x.then);
1476
+ var isIterable = (x) => Boolean(x) && typeof x[Symbol.iterator] === "function";
1477
+ var isAsyncIterable = (x) => x && typeof x[Symbol.asyncIterator] === "function";
1478
+ var isIterator = (x) => x && isFunction(x.next);
1479
+ var isResponse = (x) => typeof Response !== "undefined" && x instanceof Response || x && x.arrayBuffer && x.text && x.json;
1480
+ var isBlob = (x) => typeof Blob !== "undefined" && x instanceof Blob;
1481
+ var isBuffer2 = (x) => x && typeof x === "object" && x.isBuffer;
1482
+ var isWritableDOMStream = (x) => isObject(x) && isFunction(x.abort) && isFunction(x.getWriter);
1483
+ var isReadableDOMStream = (x) => typeof ReadableStream !== "undefined" && x instanceof ReadableStream || isObject(x) && isFunction(x.tee) && isFunction(x.cancel) && isFunction(x.getReader);
1484
+ var isWritableNodeStream = (x) => isObject(x) && isFunction(x.end) && isFunction(x.write) && isBoolean(x.writable);
1485
+ var isReadableNodeStream = (x) => isObject(x) && isFunction(x.read) && isFunction(x.pipe) && isBoolean(x.readable);
1486
+ var isReadableStream = (x) => isReadableDOMStream(x) || isReadableNodeStream(x);
1487
+ var isWritableStream = (x) => isWritableDOMStream(x) || isWritableNodeStream(x);
1536
1488
 
1537
1489
  // src/lib/utils/mime-type-utils.ts
1490
+ var DATA_URL_PATTERN = /^data:([-\w.]+\/[-\w.+]+)(;|,)/;
1491
+ var MIME_TYPE_PATTERN = /^([-\w.]+\/[-\w.+]+)/;
1538
1492
  function parseMIMEType(mimeString) {
1539
1493
  const matches3 = MIME_TYPE_PATTERN.exec(mimeString);
1540
1494
  if (matches3) {
@@ -1549,15 +1503,9 @@
1549
1503
  }
1550
1504
  return "";
1551
1505
  }
1552
- var DATA_URL_PATTERN, MIME_TYPE_PATTERN;
1553
- var init_mime_type_utils = __esm({
1554
- "src/lib/utils/mime-type-utils.ts"() {
1555
- DATA_URL_PATTERN = /^data:([-\w.]+\/[-\w.+]+)(;|,)/;
1556
- MIME_TYPE_PATTERN = /^([-\w.]+\/[-\w.+]+)/;
1557
- }
1558
- });
1559
1506
 
1560
1507
  // src/lib/utils/url-utils.ts
1508
+ var QUERY_STRING_PATTERN = /\?.*/;
1561
1509
  function extractQueryString(url) {
1562
1510
  const matches3 = url.match(QUERY_STRING_PATTERN);
1563
1511
  return matches3 && matches3[0];
@@ -1565,12 +1513,6 @@
1565
1513
  function stripQueryString(url) {
1566
1514
  return url.replace(QUERY_STRING_PATTERN, "");
1567
1515
  }
1568
- var QUERY_STRING_PATTERN;
1569
- var init_url_utils = __esm({
1570
- "src/lib/utils/url-utils.ts"() {
1571
- QUERY_STRING_PATTERN = /\?.*/;
1572
- }
1573
- });
1574
1516
 
1575
1517
  // src/lib/utils/resource-utils.ts
1576
1518
  function getResourceUrl(resource) {
@@ -1623,13 +1565,6 @@
1623
1565
  }
1624
1566
  return -1;
1625
1567
  }
1626
- var init_resource_utils = __esm({
1627
- "src/lib/utils/resource-utils.ts"() {
1628
- init_is_type();
1629
- init_mime_type_utils();
1630
- init_url_utils();
1631
- }
1632
- });
1633
1568
 
1634
1569
  // src/lib/utils/response-utils.ts
1635
1570
  async function makeResponse(resource) {
@@ -1653,8 +1588,12 @@
1653
1588
  if (typeof resource === "string") {
1654
1589
  resource = new TextEncoder().encode(resource);
1655
1590
  }
1656
- const response = new Response(resource, { headers });
1657
- Object.defineProperty(response, "url", { value: url });
1591
+ const response = new Response(resource, {
1592
+ headers
1593
+ });
1594
+ Object.defineProperty(response, "url", {
1595
+ value: url
1596
+ });
1658
1597
  return response;
1659
1598
  }
1660
1599
  async function checkResponse(response) {
@@ -1705,18 +1644,6 @@
1705
1644
  }
1706
1645
  return btoa(binary);
1707
1646
  }
1708
- var init_response_utils = __esm({
1709
- "src/lib/utils/response-utils.ts"() {
1710
- init_is_type();
1711
- init_resource_utils();
1712
- }
1713
- });
1714
-
1715
- // (disabled):src/lib/fetch/fetch-file.node
1716
- var require_fetch_file = __commonJS({
1717
- "(disabled):src/lib/fetch/fetch-file.node"() {
1718
- }
1719
- });
1720
1647
 
1721
1648
  // src/lib/fetch/fetch-file.ts
1722
1649
  function isNodePath(url) {
@@ -1731,27 +1658,18 @@
1731
1658
  async function fetchFile(urlOrData, fetchOptions) {
1732
1659
  if (typeof urlOrData === "string") {
1733
1660
  const url = resolvePath(urlOrData);
1734
- if (isNodePath(url) && node2?.fetchFileNode) {
1735
- return node2.fetchFileNode(url, fetchOptions);
1661
+ if (isNodePath(url)) {
1662
+ if (globalThis.loaders?.fetchNode) {
1663
+ return globalThis.loaders?.fetchNode(url, fetchOptions);
1664
+ }
1736
1665
  }
1737
1666
  return await fetch(url, fetchOptions);
1738
1667
  }
1739
1668
  return await makeResponse(urlOrData);
1740
1669
  }
1741
- var node2;
1742
- var init_fetch_file = __esm({
1743
- "src/lib/fetch/fetch-file.ts"() {
1744
- init_src2();
1745
- init_response_utils();
1746
- node2 = __toModule(require_fetch_file());
1747
- }
1748
- });
1749
1670
 
1750
1671
  // src/lib/fetch/read-array-buffer.ts
1751
1672
  async function readArrayBuffer(file, start, length) {
1752
- if (typeof file === "number") {
1753
- return await fs_browser_exports._readToArrayBuffer(file, start, length);
1754
- }
1755
1673
  if (!(file instanceof Blob)) {
1756
1674
  file = new Blob([file]);
1757
1675
  }
@@ -1766,52 +1684,6 @@
1766
1684
  fileReader.readAsArrayBuffer(blob);
1767
1685
  });
1768
1686
  }
1769
- var init_read_array_buffer = __esm({
1770
- "src/lib/fetch/read-array-buffer.ts"() {
1771
- init_src2();
1772
- }
1773
- });
1774
-
1775
- // src/lib/fetch/read-file.ts
1776
- function readFileSync(url, options = {}) {
1777
- url = resolvePath(url);
1778
- if (!isBrowser) {
1779
- const buffer = fs_browser_exports.readFileSync(url, options);
1780
- return typeof buffer !== "string" ? toArrayBuffer2(buffer) : buffer;
1781
- }
1782
- if (!options.nothrow) {
1783
- assert(false);
1784
- }
1785
- return null;
1786
- }
1787
- var init_read_file = __esm({
1788
- "src/lib/fetch/read-file.ts"() {
1789
- init_src2();
1790
- init_src2();
1791
- }
1792
- });
1793
-
1794
- // src/lib/fetch/write-file.ts
1795
- async function writeFile(filePath, arrayBufferOrString, options) {
1796
- filePath = resolvePath(filePath);
1797
- if (!isBrowser) {
1798
- await fs_browser_exports.writeFile(filePath, toBuffer2(arrayBufferOrString), { flag: "w" });
1799
- }
1800
- assert(false);
1801
- }
1802
- function writeFileSync(filePath, arrayBufferOrString, options) {
1803
- filePath = resolvePath(filePath);
1804
- if (!isBrowser) {
1805
- fs_browser_exports.writeFileSync(filePath, toBuffer2(arrayBufferOrString), { flag: "w" });
1806
- }
1807
- assert(false);
1808
- }
1809
- var init_write_file = __esm({
1810
- "src/lib/fetch/write-file.ts"() {
1811
- init_src2();
1812
- init_src2();
1813
- }
1814
- });
1815
1687
 
1816
1688
  // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-electron.js
1817
1689
  function isElectron(mockUserAgent) {
@@ -1828,53 +1700,24 @@
1828
1700
  }
1829
1701
  return false;
1830
1702
  }
1831
- var init_is_electron = __esm({
1832
- "../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-electron.js"() {
1833
- }
1834
- });
1835
1703
 
1836
1704
  // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-browser.js
1837
1705
  function isBrowser3() {
1838
1706
  const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
1839
1707
  return !isNode || isElectron();
1840
1708
  }
1841
- var init_is_browser = __esm({
1842
- "../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-browser.js"() {
1843
- init_is_electron();
1844
- }
1845
- });
1846
1709
 
1847
1710
  // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/globals.js
1848
- var self_3, window_3, document_3, process_, console_, navigator_;
1849
- var init_globals3 = __esm({
1850
- "../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/globals.js"() {
1851
- self_3 = globalThis.self || globalThis.window || globalThis.global;
1852
- window_3 = globalThis.window || globalThis.self || globalThis.global;
1853
- document_3 = globalThis.document || {};
1854
- process_ = globalThis.process || {};
1855
- console_ = globalThis.console;
1856
- navigator_ = globalThis.navigator || {};
1857
- }
1858
- });
1711
+ var self_3 = globalThis.self || globalThis.window || globalThis.global;
1712
+ var window_3 = globalThis.window || globalThis.self || globalThis.global;
1713
+ var document_3 = globalThis.document || {};
1714
+ var process_ = globalThis.process || {};
1715
+ var console_ = globalThis.console;
1716
+ var navigator_ = globalThis.navigator || {};
1859
1717
 
1860
1718
  // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js
1861
- var VERSION3, isBrowser4;
1862
- var init_globals4 = __esm({
1863
- "../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js"() {
1864
- init_is_browser();
1865
- VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
1866
- isBrowser4 = isBrowser3();
1867
- }
1868
- });
1869
-
1870
- // ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/index.js
1871
- var init_dist2 = __esm({
1872
- "../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/index.js"() {
1873
- init_globals4();
1874
- init_globals3();
1875
- init_is_browser();
1876
- }
1877
- });
1719
+ var VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
1720
+ var isBrowser4 = isBrowser3();
1878
1721
 
1879
1722
  // ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
1880
1723
  function getStorage(type) {
@@ -1888,43 +1731,37 @@
1888
1731
  return null;
1889
1732
  }
1890
1733
  }
1891
- var LocalStorage;
1892
- var init_local_storage = __esm({
1893
- "../../node_modules/@probe.gl/log/dist/utils/local-storage.js"() {
1894
- init_defineProperty();
1895
- LocalStorage = class {
1896
- constructor(id, defaultConfig) {
1897
- let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
1898
- _defineProperty(this, "storage", void 0);
1899
- _defineProperty(this, "id", void 0);
1900
- _defineProperty(this, "config", void 0);
1901
- this.storage = getStorage(type);
1902
- this.id = id;
1903
- this.config = defaultConfig;
1904
- this._loadConfiguration();
1905
- }
1906
- getConfiguration() {
1907
- return this.config;
1908
- }
1909
- setConfiguration(configuration) {
1910
- Object.assign(this.config, configuration);
1911
- if (this.storage) {
1912
- const serialized = JSON.stringify(this.config);
1913
- this.storage.setItem(this.id, serialized);
1914
- }
1915
- }
1916
- _loadConfiguration() {
1917
- let configuration = {};
1918
- if (this.storage) {
1919
- const serializedConfiguration = this.storage.getItem(this.id);
1920
- configuration = serializedConfiguration ? JSON.parse(serializedConfiguration) : {};
1921
- }
1922
- Object.assign(this.config, configuration);
1923
- return this;
1924
- }
1925
- };
1734
+ var LocalStorage = class {
1735
+ constructor(id, defaultConfig) {
1736
+ let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
1737
+ _defineProperty(this, "storage", void 0);
1738
+ _defineProperty(this, "id", void 0);
1739
+ _defineProperty(this, "config", void 0);
1740
+ this.storage = getStorage(type);
1741
+ this.id = id;
1742
+ this.config = defaultConfig;
1743
+ this._loadConfiguration();
1744
+ }
1745
+ getConfiguration() {
1746
+ return this.config;
1747
+ }
1748
+ setConfiguration(configuration) {
1749
+ Object.assign(this.config, configuration);
1750
+ if (this.storage) {
1751
+ const serialized = JSON.stringify(this.config);
1752
+ this.storage.setItem(this.id, serialized);
1753
+ }
1926
1754
  }
1927
- });
1755
+ _loadConfiguration() {
1756
+ let configuration = {};
1757
+ if (this.storage) {
1758
+ const serializedConfiguration = this.storage.getItem(this.id);
1759
+ configuration = serializedConfiguration ? JSON.parse(serializedConfiguration) : {};
1760
+ }
1761
+ Object.assign(this.config, configuration);
1762
+ return this;
1763
+ }
1764
+ };
1928
1765
 
1929
1766
  // ../../node_modules/@probe.gl/log/dist/utils/formatters.js
1930
1767
  function formatTime(ms) {
@@ -1956,12 +1793,28 @@
1956
1793
  const style = ["font-size:1px;", "padding:".concat(Math.floor(height / 2), "px ").concat(Math.floor(width / 2), "px;"), "line-height:".concat(height, "px;"), "background:url(".concat(imageUrl, ");"), "background-size:".concat(width, "px ").concat(height, "px;"), "color:transparent;"].join("");
1957
1794
  return ["".concat(message, " %c+"), style];
1958
1795
  }
1959
- var init_formatters = __esm({
1960
- "../../node_modules/@probe.gl/log/dist/utils/formatters.js"() {
1961
- }
1962
- });
1963
1796
 
1964
1797
  // ../../node_modules/@probe.gl/log/dist/utils/color.js
1798
+ var COLOR;
1799
+ (function(COLOR2) {
1800
+ COLOR2[COLOR2["BLACK"] = 30] = "BLACK";
1801
+ COLOR2[COLOR2["RED"] = 31] = "RED";
1802
+ COLOR2[COLOR2["GREEN"] = 32] = "GREEN";
1803
+ COLOR2[COLOR2["YELLOW"] = 33] = "YELLOW";
1804
+ COLOR2[COLOR2["BLUE"] = 34] = "BLUE";
1805
+ COLOR2[COLOR2["MAGENTA"] = 35] = "MAGENTA";
1806
+ COLOR2[COLOR2["CYAN"] = 36] = "CYAN";
1807
+ COLOR2[COLOR2["WHITE"] = 37] = "WHITE";
1808
+ COLOR2[COLOR2["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
1809
+ COLOR2[COLOR2["BRIGHT_RED"] = 91] = "BRIGHT_RED";
1810
+ COLOR2[COLOR2["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
1811
+ COLOR2[COLOR2["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
1812
+ COLOR2[COLOR2["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
1813
+ COLOR2[COLOR2["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
1814
+ COLOR2[COLOR2["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
1815
+ COLOR2[COLOR2["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
1816
+ })(COLOR || (COLOR = {}));
1817
+ var BACKGROUND_INCREMENT = 10;
1965
1818
  function getColor(color) {
1966
1819
  if (typeof color !== "string") {
1967
1820
  return color;
@@ -1973,40 +1826,15 @@
1973
1826
  if (!isBrowser3 && typeof string === "string") {
1974
1827
  if (color) {
1975
1828
  const colorCode = getColor(color);
1976
- string = "[".concat(colorCode, "m").concat(string, "");
1829
+ string = "\x1B[".concat(colorCode, "m").concat(string, "\x1B[39m");
1977
1830
  }
1978
1831
  if (background) {
1979
1832
  const colorCode = getColor(background);
1980
- string = "[".concat(colorCode + BACKGROUND_INCREMENT, "m").concat(string, "");
1833
+ string = "\x1B[".concat(colorCode + BACKGROUND_INCREMENT, "m").concat(string, "\x1B[49m");
1981
1834
  }
1982
1835
  }
1983
1836
  return string;
1984
1837
  }
1985
- var COLOR, BACKGROUND_INCREMENT;
1986
- var init_color = __esm({
1987
- "../../node_modules/@probe.gl/log/dist/utils/color.js"() {
1988
- init_dist2();
1989
- (function(COLOR2) {
1990
- COLOR2[COLOR2["BLACK"] = 30] = "BLACK";
1991
- COLOR2[COLOR2["RED"] = 31] = "RED";
1992
- COLOR2[COLOR2["GREEN"] = 32] = "GREEN";
1993
- COLOR2[COLOR2["YELLOW"] = 33] = "YELLOW";
1994
- COLOR2[COLOR2["BLUE"] = 34] = "BLUE";
1995
- COLOR2[COLOR2["MAGENTA"] = 35] = "MAGENTA";
1996
- COLOR2[COLOR2["CYAN"] = 36] = "CYAN";
1997
- COLOR2[COLOR2["WHITE"] = 37] = "WHITE";
1998
- COLOR2[COLOR2["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
1999
- COLOR2[COLOR2["BRIGHT_RED"] = 91] = "BRIGHT_RED";
2000
- COLOR2[COLOR2["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
2001
- COLOR2[COLOR2["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
2002
- COLOR2[COLOR2["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
2003
- COLOR2[COLOR2["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
2004
- COLOR2[COLOR2["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
2005
- COLOR2[COLOR2["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
2006
- })(COLOR || (COLOR = {}));
2007
- BACKGROUND_INCREMENT = 10;
2008
- }
2009
- });
2010
1838
 
2011
1839
  // ../../node_modules/@probe.gl/log/dist/utils/autobind.js
2012
1840
  function autobind(obj) {
@@ -2023,10 +1851,6 @@
2023
1851
  }
2024
1852
  }
2025
1853
  }
2026
- var init_autobind = __esm({
2027
- "../../node_modules/@probe.gl/log/dist/utils/autobind.js"() {
2028
- }
2029
- });
2030
1854
 
2031
1855
  // ../../node_modules/@probe.gl/log/dist/utils/assert.js
2032
1856
  function assert3(condition, message) {
@@ -2034,10 +1858,6 @@
2034
1858
  throw new Error(message || "Assertion failed");
2035
1859
  }
2036
1860
  }
2037
- var init_assert3 = __esm({
2038
- "../../node_modules/@probe.gl/log/dist/utils/assert.js"() {
2039
- }
2040
- });
2041
1861
 
2042
1862
  // ../../node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js
2043
1863
  function getHiResTimestamp2() {
@@ -2054,15 +1874,237 @@
2054
1874
  }
2055
1875
  return timestamp;
2056
1876
  }
2057
- var init_hi_res_timestamp2 = __esm({
2058
- "../../node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js"() {
2059
- init_dist2();
2060
- }
2061
- });
2062
1877
 
2063
1878
  // ../../node_modules/@probe.gl/log/dist/log.js
1879
+ var originalConsole = {
1880
+ debug: isBrowser3() ? console.debug || console.log : console.log,
1881
+ log: console.log,
1882
+ info: console.info,
1883
+ warn: console.warn,
1884
+ error: console.error
1885
+ };
1886
+ var DEFAULT_LOG_CONFIGURATION = {
1887
+ enabled: true,
1888
+ level: 0
1889
+ };
2064
1890
  function noop() {
2065
1891
  }
1892
+ var cache = {};
1893
+ var ONCE = {
1894
+ once: true
1895
+ };
1896
+ var Log = class {
1897
+ constructor() {
1898
+ let {
1899
+ id
1900
+ } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
1901
+ id: ""
1902
+ };
1903
+ _defineProperty(this, "id", void 0);
1904
+ _defineProperty(this, "VERSION", VERSION3);
1905
+ _defineProperty(this, "_startTs", getHiResTimestamp2());
1906
+ _defineProperty(this, "_deltaTs", getHiResTimestamp2());
1907
+ _defineProperty(this, "_storage", void 0);
1908
+ _defineProperty(this, "userData", {});
1909
+ _defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
1910
+ this.id = id;
1911
+ this.userData = {};
1912
+ this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_LOG_CONFIGURATION);
1913
+ this.timeStamp("".concat(this.id, " started"));
1914
+ autobind(this);
1915
+ Object.seal(this);
1916
+ }
1917
+ set level(newLevel) {
1918
+ this.setLevel(newLevel);
1919
+ }
1920
+ get level() {
1921
+ return this.getLevel();
1922
+ }
1923
+ isEnabled() {
1924
+ return this._storage.config.enabled;
1925
+ }
1926
+ getLevel() {
1927
+ return this._storage.config.level;
1928
+ }
1929
+ getTotal() {
1930
+ return Number((getHiResTimestamp2() - this._startTs).toPrecision(10));
1931
+ }
1932
+ getDelta() {
1933
+ return Number((getHiResTimestamp2() - this._deltaTs).toPrecision(10));
1934
+ }
1935
+ set priority(newPriority) {
1936
+ this.level = newPriority;
1937
+ }
1938
+ get priority() {
1939
+ return this.level;
1940
+ }
1941
+ getPriority() {
1942
+ return this.level;
1943
+ }
1944
+ enable() {
1945
+ let enabled = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
1946
+ this._storage.setConfiguration({
1947
+ enabled
1948
+ });
1949
+ return this;
1950
+ }
1951
+ setLevel(level) {
1952
+ this._storage.setConfiguration({
1953
+ level
1954
+ });
1955
+ return this;
1956
+ }
1957
+ get(setting) {
1958
+ return this._storage.config[setting];
1959
+ }
1960
+ set(setting, value) {
1961
+ this._storage.setConfiguration({
1962
+ [setting]: value
1963
+ });
1964
+ }
1965
+ settings() {
1966
+ if (console.table) {
1967
+ console.table(this._storage.config);
1968
+ } else {
1969
+ console.log(this._storage.config);
1970
+ }
1971
+ }
1972
+ assert(condition, message) {
1973
+ assert3(condition, message);
1974
+ }
1975
+ warn(message) {
1976
+ return this._getLogFunction(0, message, originalConsole.warn, arguments, ONCE);
1977
+ }
1978
+ error(message) {
1979
+ return this._getLogFunction(0, message, originalConsole.error, arguments);
1980
+ }
1981
+ deprecated(oldUsage, newUsage) {
1982
+ return this.warn("`".concat(oldUsage, "` is deprecated and will be removed in a later version. Use `").concat(newUsage, "` instead"));
1983
+ }
1984
+ removed(oldUsage, newUsage) {
1985
+ return this.error("`".concat(oldUsage, "` has been removed. Use `").concat(newUsage, "` instead"));
1986
+ }
1987
+ probe(logLevel, message) {
1988
+ return this._getLogFunction(logLevel, message, originalConsole.log, arguments, {
1989
+ time: true,
1990
+ once: true
1991
+ });
1992
+ }
1993
+ log(logLevel, message) {
1994
+ return this._getLogFunction(logLevel, message, originalConsole.debug, arguments);
1995
+ }
1996
+ info(logLevel, message) {
1997
+ return this._getLogFunction(logLevel, message, console.info, arguments);
1998
+ }
1999
+ once(logLevel, message) {
2000
+ return this._getLogFunction(logLevel, message, originalConsole.debug || originalConsole.info, arguments, ONCE);
2001
+ }
2002
+ table(logLevel, table, columns) {
2003
+ if (table) {
2004
+ return this._getLogFunction(logLevel, table, console.table || noop, columns && [columns], {
2005
+ tag: getTableHeader(table)
2006
+ });
2007
+ }
2008
+ return noop;
2009
+ }
2010
+ image(_ref) {
2011
+ let {
2012
+ logLevel,
2013
+ priority,
2014
+ image,
2015
+ message = "",
2016
+ scale = 1
2017
+ } = _ref;
2018
+ if (!this._shouldLog(logLevel || priority)) {
2019
+ return noop;
2020
+ }
2021
+ return isBrowser3() ? logImageInBrowser({
2022
+ image,
2023
+ message,
2024
+ scale
2025
+ }) : logImageInNode({
2026
+ image,
2027
+ message,
2028
+ scale
2029
+ });
2030
+ }
2031
+ time(logLevel, message) {
2032
+ return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
2033
+ }
2034
+ timeEnd(logLevel, message) {
2035
+ return this._getLogFunction(logLevel, message, console.timeEnd ? console.timeEnd : console.info);
2036
+ }
2037
+ timeStamp(logLevel, message) {
2038
+ return this._getLogFunction(logLevel, message, console.timeStamp || noop);
2039
+ }
2040
+ group(logLevel, message) {
2041
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
2042
+ collapsed: false
2043
+ };
2044
+ const options = normalizeArguments({
2045
+ logLevel,
2046
+ message,
2047
+ opts
2048
+ });
2049
+ const {
2050
+ collapsed
2051
+ } = opts;
2052
+ options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
2053
+ return this._getLogFunction(options);
2054
+ }
2055
+ groupCollapsed(logLevel, message) {
2056
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2057
+ return this.group(logLevel, message, Object.assign({}, opts, {
2058
+ collapsed: true
2059
+ }));
2060
+ }
2061
+ groupEnd(logLevel) {
2062
+ return this._getLogFunction(logLevel, "", console.groupEnd || noop);
2063
+ }
2064
+ withGroup(logLevel, message, func) {
2065
+ this.group(logLevel, message)();
2066
+ try {
2067
+ func();
2068
+ } finally {
2069
+ this.groupEnd(logLevel)();
2070
+ }
2071
+ }
2072
+ trace() {
2073
+ if (console.trace) {
2074
+ console.trace();
2075
+ }
2076
+ }
2077
+ _shouldLog(logLevel) {
2078
+ return this.isEnabled() && this.getLevel() >= normalizeLogLevel(logLevel);
2079
+ }
2080
+ _getLogFunction(logLevel, message, method, args, opts) {
2081
+ if (this._shouldLog(logLevel)) {
2082
+ opts = normalizeArguments({
2083
+ logLevel,
2084
+ message,
2085
+ args,
2086
+ opts
2087
+ });
2088
+ method = method || opts.method;
2089
+ assert3(method);
2090
+ opts.total = this.getTotal();
2091
+ opts.delta = this.getDelta();
2092
+ this._deltaTs = getHiResTimestamp2();
2093
+ const tag = opts.tag || opts.message;
2094
+ if (opts.once && tag) {
2095
+ if (!cache[tag]) {
2096
+ cache[tag] = getHiResTimestamp2();
2097
+ } else {
2098
+ return noop;
2099
+ }
2100
+ }
2101
+ message = decorateMessage(this.id, opts.message, opts);
2102
+ return method.bind(console, message, ...opts.args);
2103
+ }
2104
+ return noop;
2105
+ }
2106
+ };
2107
+ _defineProperty(Log, "VERSION", VERSION3);
2066
2108
  function normalizeLogLevel(logLevel) {
2067
2109
  if (!logLevel) {
2068
2110
  return 0;
@@ -2114,410 +2156,156 @@
2114
2156
  }
2115
2157
  function decorateMessage(id, message, opts) {
2116
2158
  if (typeof message === "string") {
2117
- const time = opts.time ? leftPad(formatTime(opts.total)) : "";
2118
- message = opts.time ? "".concat(id, ": ").concat(time, " ").concat(message) : "".concat(id, ": ").concat(message);
2119
- message = addColor(message, opts.color, opts.background);
2120
- }
2121
- return message;
2122
- }
2123
- function logImageInNode(_ref2) {
2124
- let {
2125
- image,
2126
- message = "",
2127
- scale = 1
2128
- } = _ref2;
2129
- console.warn("removed");
2130
- return noop;
2131
- }
2132
- function logImageInBrowser(_ref3) {
2133
- let {
2134
- image,
2135
- message = "",
2136
- scale = 1
2137
- } = _ref3;
2138
- if (typeof image === "string") {
2139
- const img = new Image();
2140
- img.onload = () => {
2141
- const args = formatImage(img, message, scale);
2142
- console.log(...args);
2143
- };
2144
- img.src = image;
2145
- return noop;
2146
- }
2147
- const element = image.nodeName || "";
2148
- if (element.toLowerCase() === "img") {
2149
- console.log(...formatImage(image, message, scale));
2150
- return noop;
2151
- }
2152
- if (element.toLowerCase() === "canvas") {
2153
- const img = new Image();
2154
- img.onload = () => console.log(...formatImage(img, message, scale));
2155
- img.src = image.toDataURL();
2156
- return noop;
2157
- }
2158
- return noop;
2159
- }
2160
- function getTableHeader(table) {
2161
- for (const key in table) {
2162
- for (const title in table[key]) {
2163
- return title || "untitled";
2164
- }
2165
- }
2166
- return "empty";
2167
- }
2168
- var originalConsole, DEFAULT_LOG_CONFIGURATION, cache, ONCE, Log;
2169
- var init_log = __esm({
2170
- "../../node_modules/@probe.gl/log/dist/log.js"() {
2171
- init_defineProperty();
2172
- init_dist2();
2173
- init_local_storage();
2174
- init_formatters();
2175
- init_color();
2176
- init_autobind();
2177
- init_assert3();
2178
- init_hi_res_timestamp2();
2179
- originalConsole = {
2180
- debug: isBrowser3() ? console.debug || console.log : console.log,
2181
- log: console.log,
2182
- info: console.info,
2183
- warn: console.warn,
2184
- error: console.error
2185
- };
2186
- DEFAULT_LOG_CONFIGURATION = {
2187
- enabled: true,
2188
- level: 0
2189
- };
2190
- cache = {};
2191
- ONCE = {
2192
- once: true
2193
- };
2194
- Log = class {
2195
- constructor() {
2196
- let {
2197
- id
2198
- } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
2199
- id: ""
2200
- };
2201
- _defineProperty(this, "id", void 0);
2202
- _defineProperty(this, "VERSION", VERSION3);
2203
- _defineProperty(this, "_startTs", getHiResTimestamp2());
2204
- _defineProperty(this, "_deltaTs", getHiResTimestamp2());
2205
- _defineProperty(this, "_storage", void 0);
2206
- _defineProperty(this, "userData", {});
2207
- _defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
2208
- this.id = id;
2209
- this.userData = {};
2210
- this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_LOG_CONFIGURATION);
2211
- this.timeStamp("".concat(this.id, " started"));
2212
- autobind(this);
2213
- Object.seal(this);
2214
- }
2215
- set level(newLevel) {
2216
- this.setLevel(newLevel);
2217
- }
2218
- get level() {
2219
- return this.getLevel();
2220
- }
2221
- isEnabled() {
2222
- return this._storage.config.enabled;
2223
- }
2224
- getLevel() {
2225
- return this._storage.config.level;
2226
- }
2227
- getTotal() {
2228
- return Number((getHiResTimestamp2() - this._startTs).toPrecision(10));
2229
- }
2230
- getDelta() {
2231
- return Number((getHiResTimestamp2() - this._deltaTs).toPrecision(10));
2232
- }
2233
- set priority(newPriority) {
2234
- this.level = newPriority;
2235
- }
2236
- get priority() {
2237
- return this.level;
2238
- }
2239
- getPriority() {
2240
- return this.level;
2241
- }
2242
- enable() {
2243
- let enabled = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
2244
- this._storage.setConfiguration({
2245
- enabled
2246
- });
2247
- return this;
2248
- }
2249
- setLevel(level) {
2250
- this._storage.setConfiguration({
2251
- level
2252
- });
2253
- return this;
2254
- }
2255
- get(setting) {
2256
- return this._storage.config[setting];
2257
- }
2258
- set(setting, value) {
2259
- this._storage.setConfiguration({
2260
- [setting]: value
2261
- });
2262
- }
2263
- settings() {
2264
- if (console.table) {
2265
- console.table(this._storage.config);
2266
- } else {
2267
- console.log(this._storage.config);
2268
- }
2269
- }
2270
- assert(condition, message) {
2271
- assert3(condition, message);
2272
- }
2273
- warn(message) {
2274
- return this._getLogFunction(0, message, originalConsole.warn, arguments, ONCE);
2275
- }
2276
- error(message) {
2277
- return this._getLogFunction(0, message, originalConsole.error, arguments);
2278
- }
2279
- deprecated(oldUsage, newUsage) {
2280
- return this.warn("`".concat(oldUsage, "` is deprecated and will be removed in a later version. Use `").concat(newUsage, "` instead"));
2281
- }
2282
- removed(oldUsage, newUsage) {
2283
- return this.error("`".concat(oldUsage, "` has been removed. Use `").concat(newUsage, "` instead"));
2284
- }
2285
- probe(logLevel, message) {
2286
- return this._getLogFunction(logLevel, message, originalConsole.log, arguments, {
2287
- time: true,
2288
- once: true
2289
- });
2290
- }
2291
- log(logLevel, message) {
2292
- return this._getLogFunction(logLevel, message, originalConsole.debug, arguments);
2293
- }
2294
- info(logLevel, message) {
2295
- return this._getLogFunction(logLevel, message, console.info, arguments);
2296
- }
2297
- once(logLevel, message) {
2298
- return this._getLogFunction(logLevel, message, originalConsole.debug || originalConsole.info, arguments, ONCE);
2299
- }
2300
- table(logLevel, table, columns) {
2301
- if (table) {
2302
- return this._getLogFunction(logLevel, table, console.table || noop, columns && [columns], {
2303
- tag: getTableHeader(table)
2304
- });
2305
- }
2306
- return noop;
2307
- }
2308
- image(_ref) {
2309
- let {
2310
- logLevel,
2311
- priority,
2312
- image,
2313
- message = "",
2314
- scale = 1
2315
- } = _ref;
2316
- if (!this._shouldLog(logLevel || priority)) {
2317
- return noop;
2318
- }
2319
- return isBrowser3() ? logImageInBrowser({
2320
- image,
2321
- message,
2322
- scale
2323
- }) : logImageInNode({
2324
- image,
2325
- message,
2326
- scale
2327
- });
2328
- }
2329
- time(logLevel, message) {
2330
- return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
2331
- }
2332
- timeEnd(logLevel, message) {
2333
- return this._getLogFunction(logLevel, message, console.timeEnd ? console.timeEnd : console.info);
2334
- }
2335
- timeStamp(logLevel, message) {
2336
- return this._getLogFunction(logLevel, message, console.timeStamp || noop);
2337
- }
2338
- group(logLevel, message) {
2339
- let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
2340
- collapsed: false
2341
- };
2342
- const options = normalizeArguments({
2343
- logLevel,
2344
- message,
2345
- opts
2346
- });
2347
- const {
2348
- collapsed
2349
- } = opts;
2350
- options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
2351
- return this._getLogFunction(options);
2352
- }
2353
- groupCollapsed(logLevel, message) {
2354
- let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2355
- return this.group(logLevel, message, Object.assign({}, opts, {
2356
- collapsed: true
2357
- }));
2358
- }
2359
- groupEnd(logLevel) {
2360
- return this._getLogFunction(logLevel, "", console.groupEnd || noop);
2361
- }
2362
- withGroup(logLevel, message, func) {
2363
- this.group(logLevel, message)();
2364
- try {
2365
- func();
2366
- } finally {
2367
- this.groupEnd(logLevel)();
2368
- }
2369
- }
2370
- trace() {
2371
- if (console.trace) {
2372
- console.trace();
2373
- }
2374
- }
2375
- _shouldLog(logLevel) {
2376
- return this.isEnabled() && this.getLevel() >= normalizeLogLevel(logLevel);
2377
- }
2378
- _getLogFunction(logLevel, message, method, args, opts) {
2379
- if (this._shouldLog(logLevel)) {
2380
- opts = normalizeArguments({
2381
- logLevel,
2382
- message,
2383
- args,
2384
- opts
2385
- });
2386
- method = method || opts.method;
2387
- assert3(method);
2388
- opts.total = this.getTotal();
2389
- opts.delta = this.getDelta();
2390
- this._deltaTs = getHiResTimestamp2();
2391
- const tag = opts.tag || opts.message;
2392
- if (opts.once && tag) {
2393
- if (!cache[tag]) {
2394
- cache[tag] = getHiResTimestamp2();
2395
- } else {
2396
- return noop;
2397
- }
2398
- }
2399
- message = decorateMessage(this.id, opts.message, opts);
2400
- return method.bind(console, message, ...opts.args);
2401
- }
2402
- return noop;
2403
- }
2159
+ const time = opts.time ? leftPad(formatTime(opts.total)) : "";
2160
+ message = opts.time ? "".concat(id, ": ").concat(time, " ").concat(message) : "".concat(id, ": ").concat(message);
2161
+ message = addColor(message, opts.color, opts.background);
2162
+ }
2163
+ return message;
2164
+ }
2165
+ function logImageInNode(_ref2) {
2166
+ let {
2167
+ image,
2168
+ message = "",
2169
+ scale = 1
2170
+ } = _ref2;
2171
+ console.warn("removed");
2172
+ return noop;
2173
+ }
2174
+ function logImageInBrowser(_ref3) {
2175
+ let {
2176
+ image,
2177
+ message = "",
2178
+ scale = 1
2179
+ } = _ref3;
2180
+ if (typeof image === "string") {
2181
+ const img = new Image();
2182
+ img.onload = () => {
2183
+ const args = formatImage(img, message, scale);
2184
+ console.log(...args);
2404
2185
  };
2405
- _defineProperty(Log, "VERSION", VERSION3);
2186
+ img.src = image;
2187
+ return noop;
2406
2188
  }
2407
- });
2189
+ const element = image.nodeName || "";
2190
+ if (element.toLowerCase() === "img") {
2191
+ console.log(...formatImage(image, message, scale));
2192
+ return noop;
2193
+ }
2194
+ if (element.toLowerCase() === "canvas") {
2195
+ const img = new Image();
2196
+ img.onload = () => console.log(...formatImage(img, message, scale));
2197
+ img.src = image.toDataURL();
2198
+ return noop;
2199
+ }
2200
+ return noop;
2201
+ }
2202
+ function getTableHeader(table) {
2203
+ for (const key in table) {
2204
+ for (const title in table[key]) {
2205
+ return title || "untitled";
2206
+ }
2207
+ }
2208
+ return "empty";
2209
+ }
2408
2210
 
2409
2211
  // ../../node_modules/@probe.gl/log/dist/index.js
2410
- var dist_default;
2411
- var init_dist3 = __esm({
2412
- "../../node_modules/@probe.gl/log/dist/index.js"() {
2413
- init_log();
2414
- init_log();
2415
- dist_default = new Log({
2416
- id: "@probe.gl/log"
2417
- });
2418
- }
2212
+ var dist_default = new Log({
2213
+ id: "@probe.gl/log"
2419
2214
  });
2420
2215
 
2421
2216
  // src/lib/loader-utils/loggers.ts
2422
- var probeLog, NullLog, ConsoleLog;
2423
- var init_loggers = __esm({
2424
- "src/lib/loader-utils/loggers.ts"() {
2425
- init_dist3();
2426
- probeLog = new Log({ id: "loaders.gl" });
2427
- NullLog = class {
2428
- log() {
2429
- return () => {
2430
- };
2431
- }
2432
- info() {
2433
- return () => {
2434
- };
2435
- }
2436
- warn() {
2437
- return () => {
2438
- };
2439
- }
2440
- error() {
2441
- return () => {
2442
- };
2443
- }
2217
+ var probeLog = new Log({
2218
+ id: "loaders.gl"
2219
+ });
2220
+ var NullLog = class {
2221
+ log() {
2222
+ return () => {
2444
2223
  };
2445
- ConsoleLog = class {
2446
- constructor() {
2447
- this.console = console;
2448
- }
2449
- log(...args) {
2450
- return this.console.log.bind(this.console, ...args);
2451
- }
2452
- info(...args) {
2453
- return this.console.info.bind(this.console, ...args);
2454
- }
2455
- warn(...args) {
2456
- return this.console.warn.bind(this.console, ...args);
2457
- }
2458
- error(...args) {
2459
- return this.console.error.bind(this.console, ...args);
2460
- }
2224
+ }
2225
+ info() {
2226
+ return () => {
2461
2227
  };
2462
2228
  }
2463
- });
2464
-
2465
- // src/lib/loader-utils/option-defaults.ts
2466
- var DEFAULT_LOADER_OPTIONS, REMOVED_LOADER_OPTIONS;
2467
- var init_option_defaults = __esm({
2468
- "src/lib/loader-utils/option-defaults.ts"() {
2469
- init_src2();
2470
- init_loggers();
2471
- DEFAULT_LOADER_OPTIONS = {
2472
- fetch: null,
2473
- mimeType: void 0,
2474
- nothrow: false,
2475
- log: new ConsoleLog(),
2476
- useLocalLibraries: false,
2477
- CDN: "https://unpkg.com/@loaders.gl",
2478
- worker: true,
2479
- maxConcurrency: 3,
2480
- maxMobileConcurrency: 1,
2481
- reuseWorkers: isBrowser,
2482
- _nodeWorkers: false,
2483
- _workerType: "",
2484
- limit: 0,
2485
- _limitMB: 0,
2486
- batchSize: "auto",
2487
- batchDebounceMs: 0,
2488
- metadata: false,
2489
- transforms: []
2229
+ warn() {
2230
+ return () => {
2490
2231
  };
2491
- REMOVED_LOADER_OPTIONS = {
2492
- throws: "nothrow",
2493
- dataType: "(no longer used)",
2494
- uri: "baseUri",
2495
- method: "fetch.method",
2496
- headers: "fetch.headers",
2497
- body: "fetch.body",
2498
- mode: "fetch.mode",
2499
- credentials: "fetch.credentials",
2500
- cache: "fetch.cache",
2501
- redirect: "fetch.redirect",
2502
- referrer: "fetch.referrer",
2503
- referrerPolicy: "fetch.referrerPolicy",
2504
- integrity: "fetch.integrity",
2505
- keepalive: "fetch.keepalive",
2506
- signal: "fetch.signal"
2232
+ }
2233
+ error() {
2234
+ return () => {
2507
2235
  };
2508
2236
  }
2509
- });
2237
+ };
2238
+ var ConsoleLog = class {
2239
+ constructor() {
2240
+ this.console = console;
2241
+ }
2242
+ log(...args) {
2243
+ return this.console.log.bind(this.console, ...args);
2244
+ }
2245
+ info(...args) {
2246
+ return this.console.info.bind(this.console, ...args);
2247
+ }
2248
+ warn(...args) {
2249
+ return this.console.warn.bind(this.console, ...args);
2250
+ }
2251
+ error(...args) {
2252
+ return this.console.error.bind(this.console, ...args);
2253
+ }
2254
+ };
2255
+
2256
+ // src/lib/loader-utils/option-defaults.ts
2257
+ var DEFAULT_LOADER_OPTIONS = {
2258
+ fetch: null,
2259
+ mimeType: void 0,
2260
+ nothrow: false,
2261
+ log: new ConsoleLog(),
2262
+ useLocalLibraries: false,
2263
+ CDN: "https://unpkg.com/@loaders.gl",
2264
+ worker: true,
2265
+ maxConcurrency: 3,
2266
+ maxMobileConcurrency: 1,
2267
+ reuseWorkers: isBrowser,
2268
+ _nodeWorkers: false,
2269
+ _workerType: "",
2270
+ limit: 0,
2271
+ _limitMB: 0,
2272
+ batchSize: "auto",
2273
+ batchDebounceMs: 0,
2274
+ metadata: false,
2275
+ transforms: []
2276
+ };
2277
+ var REMOVED_LOADER_OPTIONS = {
2278
+ throws: "nothrow",
2279
+ dataType: "(no longer used)",
2280
+ uri: "baseUri",
2281
+ method: "fetch.method",
2282
+ headers: "fetch.headers",
2283
+ body: "fetch.body",
2284
+ mode: "fetch.mode",
2285
+ credentials: "fetch.credentials",
2286
+ cache: "fetch.cache",
2287
+ redirect: "fetch.redirect",
2288
+ referrer: "fetch.referrer",
2289
+ referrerPolicy: "fetch.referrerPolicy",
2290
+ integrity: "fetch.integrity",
2291
+ keepalive: "fetch.keepalive",
2292
+ signal: "fetch.signal"
2293
+ };
2510
2294
 
2511
2295
  // src/lib/loader-utils/option-utils.ts
2512
2296
  function getGlobalLoaderState() {
2513
2297
  globalThis.loaders = globalThis.loaders || {};
2514
- const { loaders } = globalThis;
2298
+ const {
2299
+ loaders
2300
+ } = globalThis;
2515
2301
  loaders._state = loaders._state || {};
2516
2302
  return loaders._state;
2517
2303
  }
2518
2304
  function getGlobalLoaderOptions() {
2519
2305
  const state = getGlobalLoaderState();
2520
- state.globalOptions = state.globalOptions || { ...DEFAULT_LOADER_OPTIONS };
2306
+ state.globalOptions = state.globalOptions || {
2307
+ ...DEFAULT_LOADER_OPTIONS
2308
+ };
2521
2309
  return state.globalOptions;
2522
2310
  }
2523
2311
  function setGlobalOptions(options) {
@@ -2576,7 +2364,9 @@
2576
2364
  }
2577
2365
  function normalizeOptionsInternal(loader, options, url) {
2578
2366
  const loaderDefaultOptions = loader.options || {};
2579
- const mergedOptions = { ...loaderDefaultOptions };
2367
+ const mergedOptions = {
2368
+ ...loaderDefaultOptions
2369
+ };
2580
2370
  addUrlOptions(mergedOptions, url);
2581
2371
  if (mergedOptions.log === null) {
2582
2372
  mergedOptions.log = new NullLog();
@@ -2605,21 +2395,6 @@
2605
2395
  options.baseUri = url;
2606
2396
  }
2607
2397
  }
2608
- var init_option_utils = __esm({
2609
- "src/lib/loader-utils/option-utils.ts"() {
2610
- init_is_type();
2611
- init_loggers();
2612
- init_option_defaults();
2613
- }
2614
- });
2615
-
2616
- // src/lib/api/loader-options.ts
2617
- var init_loader_options = __esm({
2618
- "src/lib/api/loader-options.ts"() {
2619
- init_option_utils();
2620
- init_option_utils();
2621
- }
2622
- });
2623
2398
 
2624
2399
  // src/lib/loader-utils/normalize-loader.ts
2625
2400
  function isLoaderObject(loader) {
@@ -2641,7 +2416,10 @@
2641
2416
  loader = loader[0];
2642
2417
  loader = {
2643
2418
  ...loader,
2644
- options: { ...loader.options, ...options }
2419
+ options: {
2420
+ ...loader.options,
2421
+ ...options
2422
+ }
2645
2423
  };
2646
2424
  }
2647
2425
  if (loader?.parseTextSync || loader?.parseText) {
@@ -2652,13 +2430,13 @@
2652
2430
  }
2653
2431
  return loader;
2654
2432
  }
2655
- var init_normalize_loader = __esm({
2656
- "src/lib/loader-utils/normalize-loader.ts"() {
2657
- init_src2();
2658
- }
2659
- });
2660
2433
 
2661
2434
  // src/lib/api/register-loaders.ts
2435
+ var getGlobalLoaderRegistry = () => {
2436
+ const state = getGlobalLoaderState();
2437
+ state.loaderRegistry = state.loaderRegistry || [];
2438
+ return state.loaderRegistry;
2439
+ };
2662
2440
  function registerLoaders(loaders) {
2663
2441
  const loaderRegistry = getGlobalLoaderRegistry();
2664
2442
  loaders = Array.isArray(loaders) ? loaders : [loaders];
@@ -2676,34 +2454,22 @@
2676
2454
  const state = getGlobalLoaderState();
2677
2455
  state.loaderRegistry = [];
2678
2456
  }
2679
- var getGlobalLoaderRegistry;
2680
- var init_register_loaders = __esm({
2681
- "src/lib/api/register-loaders.ts"() {
2682
- init_normalize_loader();
2683
- init_option_utils();
2684
- getGlobalLoaderRegistry = () => {
2685
- const state = getGlobalLoaderState();
2686
- state.loaderRegistry = state.loaderRegistry || [];
2687
- return state.loaderRegistry;
2688
- };
2689
- }
2690
- });
2691
2457
 
2692
2458
  // src/lib/utils/log.ts
2693
- var log;
2694
- var init_log2 = __esm({
2695
- "src/lib/utils/log.ts"() {
2696
- init_dist3();
2697
- log = new Log({ id: "loaders.gl" });
2698
- }
2459
+ var log = new Log({
2460
+ id: "loaders.gl"
2699
2461
  });
2700
2462
 
2701
2463
  // src/lib/api/select-loader.ts
2464
+ var EXT_PATTERN = /\.([^.]+)$/;
2702
2465
  async function selectLoader(data, loaders = [], options, context) {
2703
2466
  if (!validHTTPResponse(data)) {
2704
2467
  return null;
2705
2468
  }
2706
- let loader = selectLoaderSync(data, loaders, { ...options, nothrow: true }, context);
2469
+ let loader = selectLoaderSync(data, loaders, {
2470
+ ...options,
2471
+ nothrow: true
2472
+ }, context);
2707
2473
  if (loader) {
2708
2474
  return loader;
2709
2475
  }
@@ -2882,21 +2648,9 @@
2882
2648
  }
2883
2649
  return magic;
2884
2650
  }
2885
- var EXT_PATTERN;
2886
- var init_select_loader = __esm({
2887
- "src/lib/api/select-loader.ts"() {
2888
- init_src2();
2889
- init_normalize_loader();
2890
- init_log2();
2891
- init_resource_utils();
2892
- init_register_loaders();
2893
- init_is_type();
2894
- init_url_utils();
2895
- EXT_PATTERN = /\.([^.]+)$/;
2896
- }
2897
- });
2898
2651
 
2899
2652
  // src/iterators/make-iterator/make-string-iterator.ts
2653
+ var DEFAULT_CHUNK_SIZE = 256 * 1024;
2900
2654
  function* makeStringIterator(string, options) {
2901
2655
  const chunkSize = options?.chunkSize || DEFAULT_CHUNK_SIZE;
2902
2656
  let offset = 0;
@@ -2908,16 +2662,13 @@
2908
2662
  yield textEncoder.encode(chunk);
2909
2663
  }
2910
2664
  }
2911
- var DEFAULT_CHUNK_SIZE;
2912
- var init_make_string_iterator = __esm({
2913
- "src/iterators/make-iterator/make-string-iterator.ts"() {
2914
- DEFAULT_CHUNK_SIZE = 256 * 1024;
2915
- }
2916
- });
2917
2665
 
2918
2666
  // src/iterators/make-iterator/make-array-buffer-iterator.ts
2667
+ var DEFAULT_CHUNK_SIZE2 = 256 * 1024;
2919
2668
  function* makeArrayBufferIterator(arrayBuffer, options = {}) {
2920
- const { chunkSize = DEFAULT_CHUNK_SIZE2 } = options;
2669
+ const {
2670
+ chunkSize = DEFAULT_CHUNK_SIZE2
2671
+ } = options;
2921
2672
  let byteOffset = 0;
2922
2673
  while (byteOffset < arrayBuffer.byteLength) {
2923
2674
  const chunkByteLength = Math.min(arrayBuffer.byteLength - byteOffset, chunkSize);
@@ -2929,14 +2680,9 @@
2929
2680
  yield chunk;
2930
2681
  }
2931
2682
  }
2932
- var DEFAULT_CHUNK_SIZE2;
2933
- var init_make_array_buffer_iterator = __esm({
2934
- "src/iterators/make-iterator/make-array-buffer-iterator.ts"() {
2935
- DEFAULT_CHUNK_SIZE2 = 256 * 1024;
2936
- }
2937
- });
2938
2683
 
2939
2684
  // src/iterators/make-iterator/make-blob-iterator.ts
2685
+ var DEFAULT_CHUNK_SIZE3 = 1024 * 1024;
2940
2686
  async function* makeBlobIterator(blob, options) {
2941
2687
  const chunkSize = options?.chunkSize || DEFAULT_CHUNK_SIZE3;
2942
2688
  let offset = 0;
@@ -2947,12 +2693,6 @@
2947
2693
  yield chunk;
2948
2694
  }
2949
2695
  }
2950
- var DEFAULT_CHUNK_SIZE3;
2951
- var init_make_blob_iterator = __esm({
2952
- "src/iterators/make-iterator/make-blob-iterator.ts"() {
2953
- DEFAULT_CHUNK_SIZE3 = 1024 * 1024;
2954
- }
2955
- });
2956
2696
 
2957
2697
  // src/iterators/make-iterator/make-stream-iterator.ts
2958
2698
  function makeStreamIterator(stream, options) {
@@ -2967,7 +2707,10 @@
2967
2707
  if (options?._streamReadAhead) {
2968
2708
  nextBatchPromise = reader.read();
2969
2709
  }
2970
- const { done, value } = await currentBatchPromise;
2710
+ const {
2711
+ done,
2712
+ value
2713
+ } = await currentBatchPromise;
2971
2714
  if (done) {
2972
2715
  return;
2973
2716
  }
@@ -2982,11 +2725,6 @@
2982
2725
  yield toArrayBuffer2(chunk);
2983
2726
  }
2984
2727
  }
2985
- var init_make_stream_iterator = __esm({
2986
- "src/iterators/make-iterator/make-stream-iterator.ts"() {
2987
- init_src2();
2988
- }
2989
- });
2990
2728
 
2991
2729
  // src/iterators/make-iterator/make-iterator.ts
2992
2730
  function makeIterator(data, options) {
@@ -3008,17 +2746,9 @@
3008
2746
  }
3009
2747
  throw new Error("makeIterator");
3010
2748
  }
3011
- var init_make_iterator = __esm({
3012
- "src/iterators/make-iterator/make-iterator.ts"() {
3013
- init_make_string_iterator();
3014
- init_make_array_buffer_iterator();
3015
- init_make_blob_iterator();
3016
- init_make_stream_iterator();
3017
- init_is_type();
3018
- }
3019
- });
3020
2749
 
3021
2750
  // src/lib/loader-utils/get-data.ts
2751
+ var ERR_DATA = "Cannot convert supplied data type";
3022
2752
  function getArrayBufferOrStringFromDataSync(data, loader, options) {
3023
2753
  if (loader.text && typeof data === "string") {
3024
2754
  return data;
@@ -3106,16 +2836,6 @@
3106
2836
  }
3107
2837
  throw new Error(ERR_DATA);
3108
2838
  }
3109
- var ERR_DATA;
3110
- var init_get_data = __esm({
3111
- "src/lib/loader-utils/get-data.ts"() {
3112
- init_src2();
3113
- init_is_type();
3114
- init_make_iterator();
3115
- init_response_utils();
3116
- ERR_DATA = "Cannot convert supplied data type";
3117
- }
3118
- });
3119
2839
 
3120
2840
  // src/lib/loader-utils/get-fetch-function.ts
3121
2841
  function getFetchFunction(options, context) {
@@ -3132,13 +2852,6 @@
3132
2852
  }
3133
2853
  return fetchFile;
3134
2854
  }
3135
- var init_get_fetch_function = __esm({
3136
- "src/lib/loader-utils/get-fetch-function.ts"() {
3137
- init_is_type();
3138
- init_fetch_file();
3139
- init_option_utils();
3140
- }
3141
- });
3142
2855
 
3143
2856
  // src/lib/loader-utils/loader-context.ts
3144
2857
  function getLoaderContext(context, options, parentContext) {
@@ -3175,13 +2888,6 @@
3175
2888
  }
3176
2889
  return candidateLoaders && candidateLoaders.length ? candidateLoaders : void 0;
3177
2890
  }
3178
- var init_loader_context = __esm({
3179
- "src/lib/loader-utils/loader-context.ts"() {
3180
- init_get_fetch_function();
3181
- init_url_utils();
3182
- init_src2();
3183
- }
3184
- });
3185
2891
 
3186
2892
  // src/lib/api/parse.ts
3187
2893
  async function parse(data, loaders, options, context) {
@@ -3200,7 +2906,11 @@
3200
2906
  return null;
3201
2907
  }
3202
2908
  options = normalizeOptions(options, loader, candidateLoaders, url);
3203
- context = getLoaderContext({ url, _parse: parse, loaders: candidateLoaders }, options, context || null);
2909
+ context = getLoaderContext({
2910
+ url,
2911
+ _parse: parse,
2912
+ loaders: candidateLoaders
2913
+ }, options, context || null);
3204
2914
  return await parseWithLoader(loader, data, options, context);
3205
2915
  }
3206
2916
  async function parseWithLoader(loader, data, options, context) {
@@ -3208,9 +2918,24 @@
3208
2918
  options = mergeLoaderOptions(loader.options, options);
3209
2919
  if (isResponse(data)) {
3210
2920
  const response = data;
3211
- const { ok, redirected, status, statusText, type, url } = response;
2921
+ const {
2922
+ ok,
2923
+ redirected,
2924
+ status,
2925
+ statusText,
2926
+ type,
2927
+ url
2928
+ } = response;
3212
2929
  const headers = Object.fromEntries(response.headers.entries());
3213
- context.response = { headers, ok, redirected, status, statusText, type, url };
2930
+ context.response = {
2931
+ headers,
2932
+ ok,
2933
+ redirected,
2934
+ status,
2935
+ statusText,
2936
+ type,
2937
+ url
2938
+ };
3214
2939
  }
3215
2940
  data = await getArrayBufferOrStringFromData(data, loader, options);
3216
2941
  const loaderWithParser = loader;
@@ -3229,20 +2954,6 @@
3229
2954
  assert2(!loaderWithParser.parseSync);
3230
2955
  throw new Error(`${loader.id} loader - no parser found and worker is disabled`);
3231
2956
  }
3232
- var init_parse = __esm({
3233
- "src/lib/api/parse.ts"() {
3234
- init_src2();
3235
- init_src();
3236
- init_normalize_loader();
3237
- init_is_type();
3238
- init_option_utils();
3239
- init_src2();
3240
- init_get_data();
3241
- init_loader_context();
3242
- init_resource_utils();
3243
- init_select_loader();
3244
- }
3245
- });
3246
2957
 
3247
2958
  // src/lib/api/parse-sync.ts
3248
2959
  function parseSync(data, loaders, options, context) {
@@ -3263,7 +2974,12 @@
3263
2974
  const parse2 = () => {
3264
2975
  throw new Error("parseSync called parse (which is async");
3265
2976
  };
3266
- context = getLoaderContext({ url, _parseSync: parse2, _parse: parse2, loaders }, options, context || null);
2977
+ context = getLoaderContext({
2978
+ url,
2979
+ _parseSync: parse2,
2980
+ _parse: parse2,
2981
+ loaders
2982
+ }, options, context || null);
3267
2983
  return parseWithLoaderSync(loader, data, options, context);
3268
2984
  }
3269
2985
  function parseWithLoaderSync(loader, data, options, context) {
@@ -3276,16 +2992,6 @@
3276
2992
  }
3277
2993
  throw new Error(`${loader.name} loader: 'parseSync' not supported by this loader, use 'parse' instead. ${context.url || ""}`);
3278
2994
  }
3279
- var init_parse_sync = __esm({
3280
- "src/lib/api/parse-sync.ts"() {
3281
- init_select_loader();
3282
- init_normalize_loader();
3283
- init_option_utils();
3284
- init_get_data();
3285
- init_loader_context();
3286
- init_resource_utils();
3287
- }
3288
- });
3289
2995
 
3290
2996
  // src/lib/api/parse-in-batches.ts
3291
2997
  async function parseInBatches(data, loaders, options, context) {
@@ -3303,7 +3009,12 @@
3303
3009
  return [];
3304
3010
  }
3305
3011
  options = normalizeOptions(options, loader, loaderArray, url);
3306
- context = getLoaderContext({ url, _parseInBatches: parseInBatches, _parse: parse, loaders: loaderArray }, options, context || null);
3012
+ context = getLoaderContext({
3013
+ url,
3014
+ _parseInBatches: parseInBatches,
3015
+ _parse: parse,
3016
+ loaders: loaderArray
3017
+ }, options, context || null);
3307
3018
  return await parseWithLoaderInBatches(loader, data, options, context);
3308
3019
  }
3309
3020
  async function parseWithLoaderInBatches(loader, data, options, context) {
@@ -3334,7 +3045,10 @@
3334
3045
  }
3335
3046
  async function* parseChunkInBatches() {
3336
3047
  const arrayBuffer = await concatenateArrayBuffersAsync(transformedIterator);
3337
- const parsedData = await parse(arrayBuffer, loader, { ...options, mimeType: loader.mimeTypes[0] }, context);
3048
+ const parsedData = await parse(arrayBuffer, loader, {
3049
+ ...options,
3050
+ mimeType: loader.mimeTypes[0]
3051
+ }, context);
3338
3052
  const batch = {
3339
3053
  mimeType: loader.mimeTypes[0],
3340
3054
  shape: Array.isArray(parsedData) ? "row-table" : "unknown",
@@ -3353,18 +3067,6 @@
3353
3067
  }
3354
3068
  return iteratorChain;
3355
3069
  }
3356
- var init_parse_in_batches = __esm({
3357
- "src/lib/api/parse-in-batches.ts"() {
3358
- init_src2();
3359
- init_normalize_loader();
3360
- init_option_utils();
3361
- init_loader_context();
3362
- init_get_data();
3363
- init_resource_utils();
3364
- init_select_loader();
3365
- init_parse();
3366
- }
3367
- });
3368
3070
 
3369
3071
  // src/lib/api/load.ts
3370
3072
  async function load(url, loaders, options, context) {
@@ -3388,14 +3090,6 @@
3388
3090
  }
3389
3091
  return Array.isArray(resolvedLoaders) ? await parse(data, resolvedLoaders, resolvedOptions) : await parse(data, resolvedLoaders, resolvedOptions);
3390
3092
  }
3391
- var init_load = __esm({
3392
- "src/lib/api/load.ts"() {
3393
- init_is_type();
3394
- init_normalize_loader();
3395
- init_get_fetch_function();
3396
- init_parse();
3397
- }
3398
- });
3399
3093
 
3400
3094
  // src/lib/api/load-in-batches.ts
3401
3095
  function loadInBatches(files, loaders, options, context) {
@@ -3422,13 +3116,6 @@
3422
3116
  }
3423
3117
  return Array.isArray(loaders) ? await parseInBatches(file, loaders, options) : await parseInBatches(file, loaders, options);
3424
3118
  }
3425
- var init_load_in_batches = __esm({
3426
- "src/lib/api/load-in-batches.ts"() {
3427
- init_normalize_loader();
3428
- init_get_fetch_function();
3429
- init_parse_in_batches();
3430
- }
3431
- });
3432
3119
 
3433
3120
  // src/lib/api/encode-table.ts
3434
3121
  async function encodeTable(data, writer, options) {
@@ -3467,19 +3154,21 @@
3467
3154
  throw new Error("Writer could not encode data in batches");
3468
3155
  }
3469
3156
  function getIterator(data) {
3470
- const dataIterator = [{ ...data, start: 0, end: data.length }];
3157
+ const dataIterator = [{
3158
+ ...data,
3159
+ start: 0,
3160
+ end: data.length
3161
+ }];
3471
3162
  return dataIterator;
3472
3163
  }
3473
- var init_encode_table = __esm({
3474
- "src/lib/api/encode-table.ts"() {
3475
- init_src2();
3476
- }
3477
- });
3478
3164
 
3479
3165
  // src/lib/api/encode.ts
3480
3166
  async function encode(data, writer, options) {
3481
3167
  const globalOptions = getGlobalLoaderOptions();
3482
- options = { ...globalOptions, ...options };
3168
+ options = {
3169
+ ...globalOptions,
3170
+ ...options
3171
+ };
3483
3172
  if (canEncodeWithWorker(writer, options)) {
3484
3173
  return await processOnWorker(writer, data, options);
3485
3174
  }
@@ -3502,7 +3191,8 @@
3502
3191
  }
3503
3192
  if (!isBrowser && writer.encodeURLtoURL) {
3504
3193
  const tmpInputFilename = getTemporaryFilename("input");
3505
- await writeFile(tmpInputFilename, data);
3194
+ const file = new NodeFileFacade(tmpInputFilename, "w");
3195
+ await file.write(data);
3506
3196
  const tmpOutputFilename = getTemporaryFilename("output");
3507
3197
  const outputFilename = await encodeURLtoURL(tmpInputFilename, tmpOutputFilename, writer, options);
3508
3198
  const response = await fetchFile(outputFilename);
@@ -3553,48 +3243,31 @@
3553
3243
  return outputFilename;
3554
3244
  }
3555
3245
  function getIterator2(data) {
3556
- const dataIterator = [{ ...data, start: 0, end: data.length }];
3246
+ const dataIterator = [{
3247
+ ...data,
3248
+ start: 0,
3249
+ end: data.length
3250
+ }];
3557
3251
  return dataIterator;
3558
3252
  }
3559
3253
  function getTemporaryFilename(filename2) {
3560
3254
  return `/tmp/${filename2}`;
3561
3255
  }
3562
- var init_encode = __esm({
3563
- "src/lib/api/encode.ts"() {
3564
- init_src2();
3565
- init_src();
3566
- init_src2();
3567
- init_src2();
3568
- init_write_file();
3569
- init_fetch_file();
3570
- init_loader_options();
3571
- }
3572
- });
3573
-
3574
- // src/lib/api/save.ts
3575
- async function save(data, url, writer, options) {
3576
- const encodedData = await encode(data, writer, options);
3577
- return await writeFile(url, encodedData);
3578
- }
3579
- function saveSync(data, url, writer, options) {
3580
- const encodedData = encodeSync(data, writer, options);
3581
- return writeFileSync(url, encodedData);
3582
- }
3583
- var init_save = __esm({
3584
- "src/lib/api/save.ts"() {
3585
- init_encode();
3586
- init_write_file();
3587
- }
3588
- });
3589
3256
 
3590
- // src/iterators/make-stream/make-dom-stream.ts
3257
+ // src/iterators/make-stream/make-stream.ts
3591
3258
  function makeStream(source, options) {
3259
+ if (globalThis.loaders.makeNodeStream) {
3260
+ return globalThis.loaders.makeNodeStream(source, options);
3261
+ }
3592
3262
  const iterator = source[Symbol.asyncIterator] ? source[Symbol.asyncIterator]() : source[Symbol.iterator]();
3593
3263
  return new ReadableStream({
3594
3264
  type: "bytes",
3595
3265
  async pull(controller) {
3596
3266
  try {
3597
- const { done, value } = await iterator.next();
3267
+ const {
3268
+ done,
3269
+ value
3270
+ } = await iterator.next();
3598
3271
  if (done) {
3599
3272
  controller.close();
3600
3273
  } else {
@@ -3612,53 +3285,44 @@
3612
3285
  ...options
3613
3286
  });
3614
3287
  }
3615
- var init_make_dom_stream = __esm({
3616
- "src/iterators/make-stream/make-dom-stream.ts"() {
3617
- }
3618
- });
3619
3288
 
3620
3289
  // src/null-loader.ts
3290
+ var VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
3291
+ var NullWorkerLoader = {
3292
+ name: "Null loader",
3293
+ id: "null",
3294
+ module: "core",
3295
+ version: VERSION4,
3296
+ worker: true,
3297
+ mimeTypes: ["application/x.empty"],
3298
+ extensions: ["null"],
3299
+ tests: [() => false],
3300
+ options: {
3301
+ null: {}
3302
+ }
3303
+ };
3304
+ var NullLoader = {
3305
+ name: "Null loader",
3306
+ id: "null",
3307
+ module: "core",
3308
+ version: VERSION4,
3309
+ mimeTypes: ["application/x.empty"],
3310
+ extensions: ["null"],
3311
+ parse: async (arrayBuffer, options, context) => parseSync2(arrayBuffer, options || {}, context),
3312
+ parseSync: parseSync2,
3313
+ parseInBatches: async function* generator(asyncIterator, options, context) {
3314
+ for await (const batch of asyncIterator) {
3315
+ yield parseSync2(batch, options, context);
3316
+ }
3317
+ },
3318
+ tests: [() => false],
3319
+ options: {
3320
+ null: {}
3321
+ }
3322
+ };
3621
3323
  function parseSync2(arrayBuffer, options, context) {
3622
3324
  return null;
3623
3325
  }
3624
- var VERSION4, NullWorkerLoader, NullLoader;
3625
- var init_null_loader = __esm({
3626
- "src/null-loader.ts"() {
3627
- VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
3628
- NullWorkerLoader = {
3629
- name: "Null loader",
3630
- id: "null",
3631
- module: "core",
3632
- version: VERSION4,
3633
- worker: true,
3634
- mimeTypes: ["application/x.empty"],
3635
- extensions: ["null"],
3636
- tests: [() => false],
3637
- options: {
3638
- null: {}
3639
- }
3640
- };
3641
- NullLoader = {
3642
- name: "Null loader",
3643
- id: "null",
3644
- module: "core",
3645
- version: VERSION4,
3646
- mimeTypes: ["application/x.empty"],
3647
- extensions: ["null"],
3648
- parse: async (arrayBuffer, options, context) => parseSync2(arrayBuffer, options || {}, context),
3649
- parseSync: parseSync2,
3650
- parseInBatches: async function* generator(asyncIterator, options, context) {
3651
- for await (const batch of asyncIterator) {
3652
- yield parseSync2(batch, options, context);
3653
- }
3654
- },
3655
- tests: [() => false],
3656
- options: {
3657
- null: {}
3658
- }
3659
- };
3660
- }
3661
- });
3662
3326
 
3663
3327
  // src/lib/progress/fetch-progress.ts
3664
3328
  async function fetchProgress(response, onProgress, onDone = () => {
@@ -3690,7 +3354,10 @@
3690
3354
  }
3691
3355
  async function read(controller, reader, loadedBytes, totalBytes, onProgress, onDone, onError) {
3692
3356
  try {
3693
- const { done, value } = await reader.read();
3357
+ const {
3358
+ done,
3359
+ value
3360
+ } = await reader.read();
3694
3361
  if (done) {
3695
3362
  onDone();
3696
3363
  controller.close();
@@ -3698,7 +3365,10 @@
3698
3365
  }
3699
3366
  loadedBytes += value.byteLength;
3700
3367
  const percent = Math.round(loadedBytes / totalBytes * 100);
3701
- onProgress(percent, { loadedBytes, totalBytes });
3368
+ onProgress(percent, {
3369
+ loadedBytes,
3370
+ totalBytes
3371
+ });
3702
3372
  controller.enqueue(value);
3703
3373
  await read(controller, reader, loadedBytes, totalBytes, onProgress, onDone, onError);
3704
3374
  } catch (error) {
@@ -3706,198 +3376,85 @@
3706
3376
  onError(error);
3707
3377
  }
3708
3378
  }
3709
- var init_fetch_progress = __esm({
3710
- "src/lib/progress/fetch-progress.ts"() {
3711
- }
3712
- });
3713
3379
 
3714
3380
  // src/lib/filesystems/browser-filesystem.ts
3715
- var BrowserFileSystem;
3716
- var init_browser_filesystem = __esm({
3717
- "src/lib/filesystems/browser-filesystem.ts"() {
3718
- BrowserFileSystem = class {
3719
- constructor(files, options) {
3720
- this.files = {};
3721
- this.lowerCaseFiles = {};
3722
- this.usedFiles = {};
3723
- this._fetch = options?.fetch || fetch;
3724
- for (let i = 0; i < files.length; ++i) {
3725
- const file = files[i];
3726
- this.files[file.name] = file;
3727
- this.lowerCaseFiles[file.name.toLowerCase()] = file;
3728
- this.usedFiles[file.name] = false;
3729
- }
3730
- this.fetch = this.fetch.bind(this);
3731
- }
3732
- async fetch(path, options) {
3733
- if (path.includes("://")) {
3734
- return this._fetch(path, options);
3735
- }
3736
- const file = this.files[path];
3737
- if (!file) {
3738
- return new Response(path, { status: 400, statusText: "NOT FOUND" });
3739
- }
3740
- const headers = new Headers(options?.headers);
3741
- const range = headers.get("Range");
3742
- const bytes = range && /bytes=($1)-($2)/.exec(range);
3743
- if (bytes) {
3744
- const start = parseInt(bytes[1]);
3745
- const end = parseInt(bytes[2]);
3746
- const data = await file.slice(start, end).arrayBuffer();
3747
- const response2 = new Response(data);
3748
- Object.defineProperty(response2, "url", { value: path });
3749
- return response2;
3750
- }
3751
- const response = new Response(file);
3752
- Object.defineProperty(response, "url", { value: path });
3753
- return response;
3754
- }
3755
- async readdir(dirname2) {
3756
- const files = [];
3757
- for (const path in this.files) {
3758
- files.push(path);
3759
- }
3760
- return files;
3761
- }
3762
- async stat(path, options) {
3763
- const file = this.files[path];
3764
- if (!file) {
3765
- throw new Error(path);
3766
- }
3767
- return { size: file.size };
3768
- }
3769
- async unlink(path) {
3770
- delete this.files[path];
3771
- delete this.lowerCaseFiles[path];
3772
- this.usedFiles[path] = true;
3773
- }
3774
- async open(pathname, flags, mode) {
3775
- return this.files[pathname];
3776
- }
3777
- async read(fd, buffer, offset = 0, length = buffer.byteLength, position = null) {
3778
- const file = fd;
3779
- const startPosition = 0;
3780
- const arrayBuffer = await file.slice(startPosition, startPosition + length).arrayBuffer();
3781
- return { bytesRead: length, buffer: arrayBuffer };
3782
- }
3783
- async close(fd) {
3784
- }
3785
- _getFile(path, used) {
3786
- const file = this.files[path] || this.lowerCaseFiles[path];
3787
- if (file && used) {
3788
- this.usedFiles[path] = true;
3789
- }
3790
- return file;
3791
- }
3381
+ var BrowserFileSystem = class {
3382
+ files = {};
3383
+ lowerCaseFiles = {};
3384
+ usedFiles = {};
3385
+ constructor(files, options) {
3386
+ this._fetch = options?.fetch || fetch;
3387
+ for (let i = 0; i < files.length; ++i) {
3388
+ const file = files[i];
3389
+ this.files[file.name] = file;
3390
+ this.lowerCaseFiles[file.name.toLowerCase()] = file;
3391
+ this.usedFiles[file.name] = false;
3392
+ }
3393
+ this.fetch = this.fetch.bind(this);
3394
+ }
3395
+ async fetch(path, options) {
3396
+ if (path.includes("://")) {
3397
+ return this._fetch(path, options);
3398
+ }
3399
+ const file = this.files[path];
3400
+ if (!file) {
3401
+ return new Response(path, {
3402
+ status: 400,
3403
+ statusText: "NOT FOUND"
3404
+ });
3405
+ }
3406
+ const headers = new Headers(options?.headers);
3407
+ const range = headers.get("Range");
3408
+ const bytes = range && /bytes=($1)-($2)/.exec(range);
3409
+ if (bytes) {
3410
+ const start = parseInt(bytes[1]);
3411
+ const end = parseInt(bytes[2]);
3412
+ const data = await file.slice(start, end).arrayBuffer();
3413
+ const response2 = new Response(data);
3414
+ Object.defineProperty(response2, "url", {
3415
+ value: path
3416
+ });
3417
+ return response2;
3418
+ }
3419
+ const response = new Response(file);
3420
+ Object.defineProperty(response, "url", {
3421
+ value: path
3422
+ });
3423
+ return response;
3424
+ }
3425
+ async readdir(dirname2) {
3426
+ const files = [];
3427
+ for (const path in this.files) {
3428
+ files.push(path);
3429
+ }
3430
+ return files;
3431
+ }
3432
+ async stat(path, options) {
3433
+ const file = this.files[path];
3434
+ if (!file) {
3435
+ throw new Error(path);
3436
+ }
3437
+ return {
3438
+ size: file.size
3792
3439
  };
3793
3440
  }
3794
- });
3795
-
3796
- // src/index.ts
3797
- var src_exports = {};
3798
- __export(src_exports, {
3799
- JSONLoader: () => JSONLoader,
3800
- NullLoader: () => NullLoader,
3801
- NullWorkerLoader: () => NullWorkerLoader,
3802
- RequestScheduler: () => RequestScheduler,
3803
- _BrowserFileSystem: () => BrowserFileSystem,
3804
- _fetchProgress: () => fetchProgress,
3805
- _unregisterLoaders: () => _unregisterLoaders,
3806
- assert: () => assert,
3807
- concatenateArrayBuffersAsync: () => concatenateArrayBuffersAsync,
3808
- document: () => document_,
3809
- encode: () => encode,
3810
- encodeInBatches: () => encodeInBatches,
3811
- encodeSync: () => encodeSync,
3812
- encodeTable: () => encodeTable,
3813
- encodeTableAsText: () => encodeTableAsText,
3814
- encodeTableInBatches: () => encodeTableInBatches,
3815
- encodeText: () => encodeText,
3816
- encodeTextSync: () => encodeTextSync,
3817
- encodeURLtoURL: () => encodeURLtoURL,
3818
- fetchFile: () => fetchFile,
3819
- forEach: () => forEach,
3820
- getLoaderOptions: () => getGlobalLoaderOptions,
3821
- getPathPrefix: () => getPathPrefix,
3822
- global: () => global_,
3823
- isAsyncIterable: () => isAsyncIterable,
3824
- isBrowser: () => isBrowser,
3825
- isIterable: () => isIterable,
3826
- isIterator: () => isIterator,
3827
- isPromise: () => isPromise,
3828
- isPureObject: () => isPureObject,
3829
- isReadableStream: () => isReadableStream,
3830
- isResponse: () => isResponse,
3831
- isWorker: () => isWorker,
3832
- isWritableStream: () => isWritableStream,
3833
- load: () => load,
3834
- loadInBatches: () => loadInBatches,
3835
- makeIterator: () => makeIterator,
3836
- makeLineIterator: () => makeLineIterator,
3837
- makeNumberedLineIterator: () => makeNumberedLineIterator,
3838
- makeStream: () => makeStream,
3839
- makeTextDecoderIterator: () => makeTextDecoderIterator,
3840
- makeTextEncoderIterator: () => makeTextEncoderIterator,
3841
- parse: () => parse,
3842
- parseInBatches: () => parseInBatches,
3843
- parseSync: () => parseSync,
3844
- readArrayBuffer: () => readArrayBuffer,
3845
- readFileSync: () => readFileSync,
3846
- registerLoaders: () => registerLoaders,
3847
- resolvePath: () => resolvePath,
3848
- save: () => save,
3849
- saveSync: () => saveSync,
3850
- selectLoader: () => selectLoader,
3851
- selectLoaderSync: () => selectLoaderSync,
3852
- self: () => self_,
3853
- setLoaderOptions: () => setGlobalOptions,
3854
- setPathPrefix: () => setPathPrefix,
3855
- window: () => window_,
3856
- writeFile: () => writeFile,
3857
- writeFileSync: () => writeFileSync
3858
- });
3859
- var init_src3 = __esm({
3860
- "src/index.ts"() {
3861
- init_fetch_file();
3862
- init_read_array_buffer();
3863
- init_read_file();
3864
- init_write_file();
3865
- init_loader_options();
3866
- init_register_loaders();
3867
- init_select_loader();
3868
- init_parse();
3869
- init_parse_sync();
3870
- init_parse_in_batches();
3871
- init_load();
3872
- init_load_in_batches();
3873
- init_encode_table();
3874
- init_encode();
3875
- init_encode();
3876
- init_save();
3877
- init_src2();
3878
- init_src2();
3879
- init_make_iterator();
3880
- init_make_dom_stream();
3881
- init_null_loader();
3882
- init_src2();
3883
- init_fetch_progress();
3884
- init_browser_filesystem();
3885
- init_register_loaders();
3886
- init_src2();
3887
- init_src2();
3888
- init_src2();
3889
- init_src2();
3890
- init_is_type();
3441
+ async unlink(path) {
3442
+ delete this.files[path];
3443
+ delete this.lowerCaseFiles[path];
3444
+ this.usedFiles[path] = true;
3891
3445
  }
3892
- });
3893
-
3894
- // src/bundle.ts
3895
- var require_bundle = __commonJS({
3896
- "src/bundle.ts"(exports, module) {
3897
- var moduleExports = (init_src3(), src_exports);
3898
- globalThis.loaders = globalThis.loaders || {};
3899
- module.exports = Object.assign(globalThis.loaders, moduleExports);
3446
+ async openReadableFile(pathname, flags) {
3447
+ return new BlobFile(this.files[pathname]);
3900
3448
  }
3901
- });
3902
- require_bundle();
3449
+ _getFile(path, used) {
3450
+ const file = this.files[path] || this.lowerCaseFiles[path];
3451
+ if (file && used) {
3452
+ this.usedFiles[path] = true;
3453
+ }
3454
+ return file;
3455
+ }
3456
+ };
3457
+ return __toCommonJS(src_exports);
3903
3458
  })();
3459
+ return __exports__;
3460
+ });