@loaders.gl/core 5.0.0-alpha.12 → 5.0.0-alpha.13

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 (1314) hide show
  1. package/LICENSE +1 -1
  2. package/SCHEMA-README.md +9 -0
  3. package/SCHEMA-UTILS-README.md +11 -0
  4. package/dist/dist.dev.js +163 -142
  5. package/dist/dist.min.js +3 -3
  6. package/dist/index.cjs +87 -91
  7. package/dist/index.cjs.map +2 -2
  8. package/dist/index.d.ts +10 -10
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +8 -8
  11. package/dist/index.js.map +1 -1
  12. package/dist/iterators/make-iterator/make-iterator.js +1 -1
  13. package/dist/iterators/make-iterator/make-iterator.js.map +1 -1
  14. package/dist/iterators/make-iterator/make-stream-iterator.js +1 -1
  15. package/dist/iterators/make-iterator/make-stream-iterator.js.map +1 -1
  16. package/dist/iterators/make-iterator/make-string-iterator.js +1 -1
  17. package/dist/iterators/make-iterator/make-string-iterator.js.map +1 -1
  18. package/dist/lib/api/core-api.d.ts +1 -1
  19. package/dist/lib/api/core-api.d.ts.map +1 -1
  20. package/dist/lib/api/create-data-source.d.ts +1 -1
  21. package/dist/lib/api/create-data-source.d.ts.map +1 -1
  22. package/dist/lib/api/create-data-source.js +1 -1
  23. package/dist/lib/api/create-data-source.js.map +1 -1
  24. package/dist/lib/api/encode-table.d.ts +2 -2
  25. package/dist/lib/api/encode-table.d.ts.map +1 -1
  26. package/dist/lib/api/encode-table.js +1 -1
  27. package/dist/lib/api/encode-table.js.map +1 -1
  28. package/dist/lib/api/encode.d.ts +1 -1
  29. package/dist/lib/api/encode.d.ts.map +1 -1
  30. package/dist/lib/api/encode.js +2 -2
  31. package/dist/lib/api/encode.js.map +1 -1
  32. package/dist/lib/api/load-in-batches.d.ts +1 -1
  33. package/dist/lib/api/load-in-batches.d.ts.map +1 -1
  34. package/dist/lib/api/load-in-batches.js +1 -1
  35. package/dist/lib/api/load-in-batches.js.map +1 -1
  36. package/dist/lib/api/load-loader.d.ts +1 -1
  37. package/dist/lib/api/load-loader.d.ts.map +1 -1
  38. package/dist/lib/api/load-loader.js +1 -1
  39. package/dist/lib/api/load-loader.js.map +1 -1
  40. package/dist/lib/api/load.d.ts +1 -1
  41. package/dist/lib/api/load.d.ts.map +1 -1
  42. package/dist/lib/api/load.js +1 -1
  43. package/dist/lib/api/load.js.map +1 -1
  44. package/dist/lib/api/parse-file.d.ts +1 -1
  45. package/dist/lib/api/parse-file.d.ts.map +1 -1
  46. package/dist/lib/api/parse-file.js +2 -2
  47. package/dist/lib/api/parse-file.js.map +1 -1
  48. package/dist/lib/api/parse-in-batches.d.ts +1 -1
  49. package/dist/lib/api/parse-in-batches.d.ts.map +1 -1
  50. package/dist/lib/api/parse-in-batches.js +40 -4
  51. package/dist/lib/api/parse-in-batches.js.map +1 -1
  52. package/dist/lib/api/parse-sync.d.ts +1 -1
  53. package/dist/lib/api/parse-sync.d.ts.map +1 -1
  54. package/dist/lib/api/parse-sync.js +1 -1
  55. package/dist/lib/api/parse-sync.js.map +1 -1
  56. package/dist/lib/api/parse.d.ts +1 -1
  57. package/dist/lib/api/parse.d.ts.map +1 -1
  58. package/dist/lib/api/parse.js +3 -3
  59. package/dist/lib/api/parse.js.map +1 -1
  60. package/dist/lib/api/preload.d.ts +1 -1
  61. package/dist/lib/api/preload.d.ts.map +1 -1
  62. package/dist/lib/api/preload.js.map +1 -1
  63. package/dist/lib/api/register-loaders.d.ts +1 -1
  64. package/dist/lib/api/register-loaders.d.ts.map +1 -1
  65. package/dist/lib/api/select-loader.d.ts +1 -1
  66. package/dist/lib/api/select-loader.d.ts.map +1 -1
  67. package/dist/lib/api/select-loader.js +1 -1
  68. package/dist/lib/api/select-loader.js.map +1 -1
  69. package/dist/lib/api/select-source.d.ts +1 -1
  70. package/dist/lib/api/select-source.d.ts.map +1 -1
  71. package/dist/lib/common.d.ts +1 -1
  72. package/dist/lib/common.d.ts.map +1 -1
  73. package/dist/lib/fetch/fetch-file.js +2 -2
  74. package/dist/lib/fetch/fetch-file.js.map +1 -1
  75. package/dist/lib/filesystems/browser-filesystem.d.ts +1 -1
  76. package/dist/lib/filesystems/browser-filesystem.d.ts.map +1 -1
  77. package/dist/lib/filesystems/browser-filesystem.js +1 -1
  78. package/dist/lib/filesystems/browser-filesystem.js.map +1 -1
  79. package/dist/lib/init.js +2 -2
  80. package/dist/lib/init.js.map +1 -1
  81. package/dist/lib/loader-utils/get-data.d.ts +1 -1
  82. package/dist/lib/loader-utils/get-data.d.ts.map +1 -1
  83. package/dist/lib/loader-utils/get-data.js +1 -1
  84. package/dist/lib/loader-utils/get-data.js.map +1 -1
  85. package/dist/lib/loader-utils/get-fetch-function.d.ts +1 -1
  86. package/dist/lib/loader-utils/get-fetch-function.d.ts.map +1 -1
  87. package/dist/lib/loader-utils/get-fetch-function.js +1 -1
  88. package/dist/lib/loader-utils/get-fetch-function.js.map +1 -1
  89. package/dist/lib/loader-utils/loader-context.d.ts +1 -1
  90. package/dist/lib/loader-utils/loader-context.d.ts.map +1 -1
  91. package/dist/lib/loader-utils/loader-context.js +1 -1
  92. package/dist/lib/loader-utils/loader-context.js.map +1 -1
  93. package/dist/lib/loader-utils/loggers.d.ts +1 -1
  94. package/dist/lib/loader-utils/loggers.d.ts.map +1 -1
  95. package/dist/lib/loader-utils/loggers.js +1 -1
  96. package/dist/lib/loader-utils/loggers.js.map +1 -1
  97. package/dist/lib/loader-utils/normalize-loader.d.ts +1 -1
  98. package/dist/lib/loader-utils/normalize-loader.d.ts.map +1 -1
  99. package/dist/lib/loader-utils/normalize-loader.js +1 -1
  100. package/dist/lib/loader-utils/normalize-loader.js.map +1 -1
  101. package/dist/lib/loader-utils/option-defaults.d.ts +1 -1
  102. package/dist/lib/loader-utils/option-defaults.d.ts.map +1 -1
  103. package/dist/lib/loader-utils/option-defaults.js +1 -1
  104. package/dist/lib/loader-utils/option-defaults.js.map +1 -1
  105. package/dist/lib/loader-utils/option-utils.d.ts +1 -1
  106. package/dist/lib/loader-utils/option-utils.d.ts.map +1 -1
  107. package/dist/lib/loader-utils/option-utils.js +1 -1
  108. package/dist/lib/loader-utils/option-utils.js.map +1 -1
  109. package/dist/lib/utils/resource-utils.js +1 -1
  110. package/dist/lib/utils/resource-utils.js.map +1 -1
  111. package/dist/lib/utils/response-utils.js +1 -1
  112. package/dist/lib/utils/response-utils.js.map +1 -1
  113. package/dist/loader-utils/format-types.d.ts +32 -0
  114. package/dist/loader-utils/format-types.d.ts.map +1 -0
  115. package/dist/loader-utils/format-types.js +5 -0
  116. package/dist/loader-utils/format-types.js.map +1 -0
  117. package/dist/loader-utils/index.cjs +12416 -0
  118. package/dist/loader-utils/index.cjs.map +6 -0
  119. package/dist/loader-utils/index.d.ts +122 -0
  120. package/dist/loader-utils/index.d.ts.map +1 -0
  121. package/dist/loader-utils/index.js +91 -0
  122. package/dist/loader-utils/index.js.map +1 -0
  123. package/dist/loader-utils/json-loader.d.ts +27 -0
  124. package/dist/loader-utils/json-loader.d.ts.map +1 -0
  125. package/dist/loader-utils/json-loader.js +32 -0
  126. package/dist/loader-utils/json-loader.js.map +1 -0
  127. package/dist/loader-utils/lib/binary-utils/array-buffer-utils.d.ts +32 -0
  128. package/dist/loader-utils/lib/binary-utils/array-buffer-utils.d.ts.map +1 -0
  129. package/dist/loader-utils/lib/binary-utils/array-buffer-utils.js +88 -0
  130. package/dist/loader-utils/lib/binary-utils/array-buffer-utils.js.map +1 -0
  131. package/dist/loader-utils/lib/binary-utils/binary-chunk-reader.d.ts +67 -0
  132. package/dist/loader-utils/lib/binary-utils/binary-chunk-reader.d.ts.map +1 -0
  133. package/dist/loader-utils/lib/binary-utils/binary-chunk-reader.js +245 -0
  134. package/dist/loader-utils/lib/binary-utils/binary-chunk-reader.js.map +1 -0
  135. package/dist/loader-utils/lib/binary-utils/dataview-copy-utils.d.ts +43 -0
  136. package/dist/loader-utils/lib/binary-utils/dataview-copy-utils.d.ts.map +1 -0
  137. package/dist/loader-utils/lib/binary-utils/dataview-copy-utils.js +92 -0
  138. package/dist/loader-utils/lib/binary-utils/dataview-copy-utils.js.map +1 -0
  139. package/dist/loader-utils/lib/binary-utils/encode-array-buffer-to-base64.d.ts +3 -0
  140. package/dist/loader-utils/lib/binary-utils/encode-array-buffer-to-base64.d.ts.map +1 -0
  141. package/dist/loader-utils/lib/binary-utils/encode-array-buffer-to-base64.js +15 -0
  142. package/dist/loader-utils/lib/binary-utils/encode-array-buffer-to-base64.js.map +1 -0
  143. package/dist/loader-utils/lib/binary-utils/get-first-characters.d.ts +17 -0
  144. package/dist/loader-utils/lib/binary-utils/get-first-characters.d.ts.map +1 -0
  145. package/dist/loader-utils/lib/binary-utils/get-first-characters.js +43 -0
  146. package/dist/loader-utils/lib/binary-utils/get-first-characters.js.map +1 -0
  147. package/dist/loader-utils/lib/binary-utils/hex-transcoder.d.ts +15 -0
  148. package/dist/loader-utils/lib/binary-utils/hex-transcoder.d.ts.map +1 -0
  149. package/dist/loader-utils/lib/binary-utils/hex-transcoder.js +51 -0
  150. package/dist/loader-utils/lib/binary-utils/hex-transcoder.js.map +1 -0
  151. package/dist/loader-utils/lib/binary-utils/memory-conversion-utils.d.ts +20 -0
  152. package/dist/loader-utils/lib/binary-utils/memory-conversion-utils.d.ts.map +1 -0
  153. package/dist/loader-utils/lib/binary-utils/memory-conversion-utils.js +82 -0
  154. package/dist/loader-utils/lib/binary-utils/memory-conversion-utils.js.map +1 -0
  155. package/dist/loader-utils/lib/binary-utils/memory-copy-utils.d.ts +25 -0
  156. package/dist/loader-utils/lib/binary-utils/memory-copy-utils.d.ts.map +1 -0
  157. package/dist/loader-utils/lib/binary-utils/memory-copy-utils.js +59 -0
  158. package/dist/loader-utils/lib/binary-utils/memory-copy-utils.js.map +1 -0
  159. package/dist/loader-utils/lib/crs/crs-reprojection.d.ts +31 -0
  160. package/dist/loader-utils/lib/crs/crs-reprojection.d.ts.map +1 -0
  161. package/dist/loader-utils/lib/crs/crs-reprojection.js +20 -0
  162. package/dist/loader-utils/lib/crs/crs-reprojection.js.map +1 -0
  163. package/dist/loader-utils/lib/env-utils/assert.d.ts +6 -0
  164. package/dist/loader-utils/lib/env-utils/assert.d.ts.map +1 -0
  165. package/dist/loader-utils/lib/env-utils/assert.js +13 -0
  166. package/dist/loader-utils/lib/env-utils/assert.js.map +1 -0
  167. package/dist/loader-utils/lib/env-utils/globals.d.ts +15 -0
  168. package/dist/loader-utils/lib/env-utils/globals.d.ts.map +1 -0
  169. package/dist/loader-utils/lib/env-utils/globals.js +28 -0
  170. package/dist/loader-utils/lib/env-utils/globals.js.map +1 -0
  171. package/dist/loader-utils/lib/file-provider/data-view-file.d.ts +40 -0
  172. package/dist/loader-utils/lib/file-provider/data-view-file.d.ts.map +1 -0
  173. package/dist/loader-utils/lib/file-provider/data-view-file.js +68 -0
  174. package/dist/loader-utils/lib/file-provider/data-view-file.js.map +1 -0
  175. package/dist/loader-utils/lib/file-provider/file-handle-file.d.ts +54 -0
  176. package/dist/loader-utils/lib/file-provider/file-handle-file.d.ts.map +1 -0
  177. package/dist/loader-utils/lib/file-provider/file-handle-file.js +102 -0
  178. package/dist/loader-utils/lib/file-provider/file-handle-file.js.map +1 -0
  179. package/dist/loader-utils/lib/file-provider/file-provider-interface.d.ts +45 -0
  180. package/dist/loader-utils/lib/file-provider/file-provider-interface.d.ts.map +1 -0
  181. package/dist/loader-utils/lib/file-provider/file-provider-interface.js +13 -0
  182. package/dist/loader-utils/lib/file-provider/file-provider-interface.js.map +1 -0
  183. package/dist/loader-utils/lib/file-provider/file-provider.d.ts +57 -0
  184. package/dist/loader-utils/lib/file-provider/file-provider.d.ts.map +1 -0
  185. package/dist/loader-utils/lib/file-provider/file-provider.js +114 -0
  186. package/dist/loader-utils/lib/file-provider/file-provider.js.map +1 -0
  187. package/dist/loader-utils/lib/files/array-buffer-file.d.ts +21 -0
  188. package/dist/loader-utils/lib/files/array-buffer-file.d.ts.map +1 -0
  189. package/dist/loader-utils/lib/files/array-buffer-file.js +36 -0
  190. package/dist/loader-utils/lib/files/array-buffer-file.js.map +1 -0
  191. package/dist/loader-utils/lib/files/blob-file.d.ts +19 -0
  192. package/dist/loader-utils/lib/files/blob-file.d.ts.map +1 -0
  193. package/dist/loader-utils/lib/files/blob-file.js +39 -0
  194. package/dist/loader-utils/lib/files/blob-file.js.map +1 -0
  195. package/dist/loader-utils/lib/files/file.d.ts +33 -0
  196. package/dist/loader-utils/lib/files/file.d.ts.map +1 -0
  197. package/dist/loader-utils/lib/files/file.js +5 -0
  198. package/dist/loader-utils/lib/files/file.js.map +1 -0
  199. package/dist/loader-utils/lib/files/http-file-transport.d.ts +37 -0
  200. package/dist/loader-utils/lib/files/http-file-transport.d.ts.map +1 -0
  201. package/dist/loader-utils/lib/files/http-file-transport.js +290 -0
  202. package/dist/loader-utils/lib/files/http-file-transport.js.map +1 -0
  203. package/dist/loader-utils/lib/files/http-file-types.d.ts +49 -0
  204. package/dist/loader-utils/lib/files/http-file-types.d.ts.map +1 -0
  205. package/dist/loader-utils/lib/files/http-file-types.js +5 -0
  206. package/dist/loader-utils/lib/files/http-file-types.js.map +1 -0
  207. package/dist/loader-utils/lib/files/http-file.d.ts +55 -0
  208. package/dist/loader-utils/lib/files/http-file.d.ts.map +1 -0
  209. package/dist/loader-utils/lib/files/http-file.js +213 -0
  210. package/dist/loader-utils/lib/files/http-file.js.map +1 -0
  211. package/dist/loader-utils/lib/files/node-file-facade.d.ts +22 -0
  212. package/dist/loader-utils/lib/files/node-file-facade.d.ts.map +1 -0
  213. package/dist/loader-utils/lib/files/node-file-facade.js +45 -0
  214. package/dist/loader-utils/lib/files/node-file-facade.js.map +1 -0
  215. package/dist/loader-utils/lib/files/sources.d.ts +1 -0
  216. package/dist/loader-utils/lib/files/sources.d.ts.map +1 -0
  217. package/dist/loader-utils/lib/files/sources.js +155 -0
  218. package/dist/loader-utils/lib/files/sources.js.map +1 -0
  219. package/dist/loader-utils/lib/filesystems/filesystem.d.ts +33 -0
  220. package/dist/loader-utils/lib/filesystems/filesystem.d.ts.map +1 -0
  221. package/dist/loader-utils/lib/filesystems/filesystem.js +5 -0
  222. package/dist/loader-utils/lib/filesystems/filesystem.js.map +1 -0
  223. package/dist/loader-utils/lib/filesystems/node-filesystem-facade.d.ts +23 -0
  224. package/dist/loader-utils/lib/filesystems/node-filesystem-facade.d.ts.map +1 -0
  225. package/dist/loader-utils/lib/filesystems/node-filesystem-facade.js +48 -0
  226. package/dist/loader-utils/lib/filesystems/node-filesystem-facade.js.map +1 -0
  227. package/dist/loader-utils/lib/iterators/async-iteration.d.ts +20 -0
  228. package/dist/loader-utils/lib/iterators/async-iteration.d.ts.map +1 -0
  229. package/dist/loader-utils/lib/iterators/async-iteration.js +102 -0
  230. package/dist/loader-utils/lib/iterators/async-iteration.js.map +1 -0
  231. package/dist/loader-utils/lib/iterators/text-iterators.d.ts +19 -0
  232. package/dist/loader-utils/lib/iterators/text-iterators.d.ts.map +1 -0
  233. package/dist/loader-utils/lib/iterators/text-iterators.js +60 -0
  234. package/dist/loader-utils/lib/iterators/text-iterators.js.map +1 -0
  235. package/dist/loader-utils/lib/javascript-utils/is-type.d.ts +59 -0
  236. package/dist/loader-utils/lib/javascript-utils/is-type.d.ts.map +1 -0
  237. package/dist/loader-utils/lib/javascript-utils/is-type.js +68 -0
  238. package/dist/loader-utils/lib/javascript-utils/is-type.js.map +1 -0
  239. package/dist/loader-utils/lib/laz/laz-arithmetic-encoder.d.ts +118 -0
  240. package/dist/loader-utils/lib/laz/laz-arithmetic-encoder.d.ts.map +1 -0
  241. package/dist/loader-utils/lib/laz/laz-arithmetic-encoder.js +427 -0
  242. package/dist/loader-utils/lib/laz/laz-arithmetic-encoder.js.map +1 -0
  243. package/dist/loader-utils/lib/laz/laz-chunk-decoder.d.ts +204 -0
  244. package/dist/loader-utils/lib/laz/laz-chunk-decoder.d.ts.map +1 -0
  245. package/dist/loader-utils/lib/laz/laz-chunk-decoder.js +4226 -0
  246. package/dist/loader-utils/lib/laz/laz-chunk-decoder.js.map +1 -0
  247. package/dist/loader-utils/lib/laz/laz-chunk-encoder.d.ts +40 -0
  248. package/dist/loader-utils/lib/laz/laz-chunk-encoder.d.ts.map +1 -0
  249. package/dist/loader-utils/lib/laz/laz-chunk-encoder.js +1518 -0
  250. package/dist/loader-utils/lib/laz/laz-chunk-encoder.js.map +1 -0
  251. package/dist/loader-utils/lib/log-utils/log.d.ts +4 -0
  252. package/dist/loader-utils/lib/log-utils/log.d.ts.map +1 -0
  253. package/dist/loader-utils/lib/log-utils/log.js +21 -0
  254. package/dist/loader-utils/lib/log-utils/log.js.map +1 -0
  255. package/dist/loader-utils/lib/module-utils/initialize-wasm-module.d.ts +10 -0
  256. package/dist/loader-utils/lib/module-utils/initialize-wasm-module.d.ts.map +1 -0
  257. package/dist/loader-utils/lib/module-utils/initialize-wasm-module.js +44 -0
  258. package/dist/loader-utils/lib/module-utils/initialize-wasm-module.js.map +1 -0
  259. package/dist/loader-utils/lib/module-utils/js-module-utils.d.ts +18 -0
  260. package/dist/loader-utils/lib/module-utils/js-module-utils.d.ts.map +1 -0
  261. package/dist/loader-utils/lib/module-utils/js-module-utils.js +40 -0
  262. package/dist/loader-utils/lib/module-utils/js-module-utils.js.map +1 -0
  263. package/dist/loader-utils/lib/node/buffer.browser.d.ts +11 -0
  264. package/dist/loader-utils/lib/node/buffer.browser.d.ts.map +1 -0
  265. package/dist/loader-utils/lib/node/buffer.browser.js +20 -0
  266. package/dist/loader-utils/lib/node/buffer.browser.js.map +1 -0
  267. package/dist/loader-utils/lib/node/buffer.d.ts +11 -0
  268. package/dist/loader-utils/lib/node/buffer.d.ts.map +1 -0
  269. package/dist/loader-utils/lib/node/buffer.js +35 -0
  270. package/dist/loader-utils/lib/node/buffer.js.map +1 -0
  271. package/dist/loader-utils/lib/node/fs.browser.d.ts +2 -0
  272. package/dist/loader-utils/lib/node/fs.browser.d.ts.map +1 -0
  273. package/dist/loader-utils/lib/node/fs.browser.js +5 -0
  274. package/dist/loader-utils/lib/node/fs.browser.js.map +1 -0
  275. package/dist/loader-utils/lib/node/promisify.d.ts +13 -0
  276. package/dist/loader-utils/lib/node/promisify.d.ts.map +1 -0
  277. package/dist/loader-utils/lib/node/promisify.js +19 -0
  278. package/dist/loader-utils/lib/node/promisify.js.map +1 -0
  279. package/dist/loader-utils/lib/node/stream.browser.d.ts +2 -0
  280. package/dist/loader-utils/lib/node/stream.browser.d.ts.map +1 -0
  281. package/dist/loader-utils/lib/node/stream.browser.js +5 -0
  282. package/dist/loader-utils/lib/node/stream.browser.js.map +1 -0
  283. package/dist/loader-utils/lib/node/stream.d.ts +6 -0
  284. package/dist/loader-utils/lib/node/stream.d.ts.map +1 -0
  285. package/dist/loader-utils/lib/node/stream.js +8 -0
  286. package/dist/loader-utils/lib/node/stream.js.map +1 -0
  287. package/dist/loader-utils/lib/option-utils/merge-options.d.ts +12 -0
  288. package/dist/loader-utils/lib/option-utils/merge-options.d.ts.map +1 -0
  289. package/dist/loader-utils/lib/option-utils/merge-options.js +34 -0
  290. package/dist/loader-utils/lib/option-utils/merge-options.js.map +1 -0
  291. package/dist/loader-utils/lib/parser-utils/parse-json.d.ts +5 -0
  292. package/dist/loader-utils/lib/parser-utils/parse-json.d.ts.map +1 -0
  293. package/dist/loader-utils/lib/parser-utils/parse-json.js +16 -0
  294. package/dist/loader-utils/lib/parser-utils/parse-json.js.map +1 -0
  295. package/dist/loader-utils/lib/path-utils/cached-uri-resolver.d.ts +35 -0
  296. package/dist/loader-utils/lib/path-utils/cached-uri-resolver.d.ts.map +1 -0
  297. package/dist/loader-utils/lib/path-utils/cached-uri-resolver.js +64 -0
  298. package/dist/loader-utils/lib/path-utils/cached-uri-resolver.js.map +1 -0
  299. package/dist/loader-utils/lib/path-utils/file-aliases.d.ts +17 -0
  300. package/dist/loader-utils/lib/path-utils/file-aliases.d.ts.map +1 -0
  301. package/dist/loader-utils/lib/path-utils/file-aliases.js +44 -0
  302. package/dist/loader-utils/lib/path-utils/file-aliases.js.map +1 -0
  303. package/dist/loader-utils/lib/path-utils/get-cwd.d.ts +3 -0
  304. package/dist/loader-utils/lib/path-utils/get-cwd.d.ts.map +1 -0
  305. package/dist/loader-utils/lib/path-utils/get-cwd.js +12 -0
  306. package/dist/loader-utils/lib/path-utils/get-cwd.js.map +1 -0
  307. package/dist/loader-utils/lib/path-utils/path.d.ts +24 -0
  308. package/dist/loader-utils/lib/path-utils/path.d.ts.map +1 -0
  309. package/dist/loader-utils/lib/path-utils/path.js +173 -0
  310. package/dist/loader-utils/lib/path-utils/path.js.map +1 -0
  311. package/dist/loader-utils/lib/request-utils/abort-utils.d.ts +5 -0
  312. package/dist/loader-utils/lib/request-utils/abort-utils.d.ts.map +1 -0
  313. package/dist/loader-utils/lib/request-utils/abort-utils.js +59 -0
  314. package/dist/loader-utils/lib/request-utils/abort-utils.js.map +1 -0
  315. package/dist/loader-utils/lib/request-utils/authentication.d.ts +56 -0
  316. package/dist/loader-utils/lib/request-utils/authentication.d.ts.map +1 -0
  317. package/dist/loader-utils/lib/request-utils/authentication.js +67 -0
  318. package/dist/loader-utils/lib/request-utils/authentication.js.map +1 -0
  319. package/dist/loader-utils/lib/request-utils/parse-content-type.d.ts +7 -0
  320. package/dist/loader-utils/lib/request-utils/parse-content-type.d.ts.map +1 -0
  321. package/dist/loader-utils/lib/request-utils/parse-content-type.js +20 -0
  322. package/dist/loader-utils/lib/request-utils/parse-content-type.js.map +1 -0
  323. package/dist/loader-utils/lib/request-utils/range-request-cache.d.ts +70 -0
  324. package/dist/loader-utils/lib/request-utils/range-request-cache.d.ts.map +1 -0
  325. package/dist/loader-utils/lib/request-utils/range-request-cache.js +203 -0
  326. package/dist/loader-utils/lib/request-utils/range-request-cache.js.map +1 -0
  327. package/dist/loader-utils/lib/request-utils/range-request-scheduler.d.ts +201 -0
  328. package/dist/loader-utils/lib/request-utils/range-request-scheduler.d.ts.map +1 -0
  329. package/dist/loader-utils/lib/request-utils/range-request-scheduler.js +636 -0
  330. package/dist/loader-utils/lib/request-utils/range-request-scheduler.js.map +1 -0
  331. package/dist/loader-utils/lib/request-utils/request-cache.d.ts +62 -0
  332. package/dist/loader-utils/lib/request-utils/request-cache.d.ts.map +1 -0
  333. package/dist/loader-utils/lib/request-utils/request-cache.js +236 -0
  334. package/dist/loader-utils/lib/request-utils/request-cache.js.map +1 -0
  335. package/dist/loader-utils/lib/request-utils/request-credentials.d.ts +137 -0
  336. package/dist/loader-utils/lib/request-utils/request-credentials.d.ts.map +1 -0
  337. package/dist/loader-utils/lib/request-utils/request-credentials.js +379 -0
  338. package/dist/loader-utils/lib/request-utils/request-credentials.js.map +1 -0
  339. package/dist/loader-utils/lib/request-utils/request-scheduler.d.ts +71 -0
  340. package/dist/loader-utils/lib/request-utils/request-scheduler.d.ts.map +1 -0
  341. package/dist/loader-utils/lib/request-utils/request-scheduler.js +174 -0
  342. package/dist/loader-utils/lib/request-utils/request-scheduler.js.map +1 -0
  343. package/dist/loader-utils/lib/scan-utils/columnar-predicate.d.ts +56 -0
  344. package/dist/loader-utils/lib/scan-utils/columnar-predicate.d.ts.map +1 -0
  345. package/dist/loader-utils/lib/scan-utils/columnar-predicate.js +261 -0
  346. package/dist/loader-utils/lib/scan-utils/columnar-predicate.js.map +1 -0
  347. package/dist/loader-utils/lib/scan-utils/experimental-scan-options.d.ts +42 -0
  348. package/dist/loader-utils/lib/scan-utils/experimental-scan-options.d.ts.map +1 -0
  349. package/dist/loader-utils/lib/scan-utils/experimental-scan-options.js +5 -0
  350. package/dist/loader-utils/lib/scan-utils/experimental-scan-options.js.map +1 -0
  351. package/dist/loader-utils/lib/scan-utils/point-cloud-query.d.ts +56 -0
  352. package/dist/loader-utils/lib/scan-utils/point-cloud-query.d.ts.map +1 -0
  353. package/dist/loader-utils/lib/scan-utils/point-cloud-query.js +86 -0
  354. package/dist/loader-utils/lib/scan-utils/point-cloud-query.js.map +1 -0
  355. package/dist/loader-utils/lib/scan-utils/raster-query.d.ts +36 -0
  356. package/dist/loader-utils/lib/scan-utils/raster-query.d.ts.map +1 -0
  357. package/dist/loader-utils/lib/scan-utils/raster-query.js +49 -0
  358. package/dist/loader-utils/lib/scan-utils/raster-query.js.map +1 -0
  359. package/dist/loader-utils/lib/scan-utils/relational-query.d.ts +75 -0
  360. package/dist/loader-utils/lib/scan-utils/relational-query.d.ts.map +1 -0
  361. package/dist/loader-utils/lib/scan-utils/relational-query.js +107 -0
  362. package/dist/loader-utils/lib/scan-utils/relational-query.js.map +1 -0
  363. package/dist/loader-utils/lib/scan-utils/scan-executor.d.ts +20 -0
  364. package/dist/loader-utils/lib/scan-utils/scan-executor.d.ts.map +1 -0
  365. package/dist/loader-utils/lib/scan-utils/scan-executor.js +183 -0
  366. package/dist/loader-utils/lib/scan-utils/scan-executor.js.map +1 -0
  367. package/dist/loader-utils/lib/scan-utils/scan-fragments.d.ts +23 -0
  368. package/dist/loader-utils/lib/scan-utils/scan-fragments.d.ts.map +1 -0
  369. package/dist/loader-utils/lib/scan-utils/scan-fragments.js +5 -0
  370. package/dist/loader-utils/lib/scan-utils/scan-fragments.js.map +1 -0
  371. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts +272 -0
  372. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.d.ts.map +1 -0
  373. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js +97 -0
  374. package/dist/loader-utils/lib/scan-utils/scan-query-metadata.js.map +1 -0
  375. package/dist/loader-utils/lib/scan-utils/table-query-explain.d.ts +39 -0
  376. package/dist/loader-utils/lib/scan-utils/table-query-explain.d.ts.map +1 -0
  377. package/dist/loader-utils/lib/scan-utils/table-query-explain.js +35 -0
  378. package/dist/loader-utils/lib/scan-utils/table-query-explain.js.map +1 -0
  379. package/dist/loader-utils/lib/scan-utils/table-query.d.ts +77 -0
  380. package/dist/loader-utils/lib/scan-utils/table-query.d.ts.map +1 -0
  381. package/dist/loader-utils/lib/scan-utils/table-query.js +56 -0
  382. package/dist/loader-utils/lib/scan-utils/table-query.js.map +1 -0
  383. package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts +30 -0
  384. package/dist/loader-utils/lib/scan-utils/table-scan-batch.d.ts.map +1 -0
  385. package/dist/loader-utils/lib/scan-utils/table-scan-batch.js +161 -0
  386. package/dist/loader-utils/lib/scan-utils/table-scan-batch.js.map +1 -0
  387. package/dist/loader-utils/lib/sources/catalog-source.d.ts +36 -0
  388. package/dist/loader-utils/lib/sources/catalog-source.d.ts.map +1 -0
  389. package/dist/loader-utils/lib/sources/catalog-source.js +5 -0
  390. package/dist/loader-utils/lib/sources/catalog-source.js.map +1 -0
  391. package/dist/loader-utils/lib/sources/data-source-manager.d.ts +136 -0
  392. package/dist/loader-utils/lib/sources/data-source-manager.d.ts.map +1 -0
  393. package/dist/loader-utils/lib/sources/data-source-manager.js +376 -0
  394. package/dist/loader-utils/lib/sources/data-source-manager.js.map +1 -0
  395. package/dist/loader-utils/lib/sources/data-source.d.ts +79 -0
  396. package/dist/loader-utils/lib/sources/data-source.d.ts.map +1 -0
  397. package/dist/loader-utils/lib/sources/data-source.js +145 -0
  398. package/dist/loader-utils/lib/sources/data-source.js.map +1 -0
  399. package/dist/loader-utils/lib/sources/image-source.d.ts +55 -0
  400. package/dist/loader-utils/lib/sources/image-source.d.ts.map +1 -0
  401. package/dist/loader-utils/lib/sources/image-source.js +5 -0
  402. package/dist/loader-utils/lib/sources/image-source.js.map +1 -0
  403. package/dist/loader-utils/lib/sources/image-tile-source.d.ts +12 -0
  404. package/dist/loader-utils/lib/sources/image-tile-source.d.ts.map +1 -0
  405. package/dist/loader-utils/lib/sources/image-tile-source.js +5 -0
  406. package/dist/loader-utils/lib/sources/image-tile-source.js.map +1 -0
  407. package/dist/loader-utils/lib/sources/raster-coverage.d.ts +17 -0
  408. package/dist/loader-utils/lib/sources/raster-coverage.d.ts.map +1 -0
  409. package/dist/loader-utils/lib/sources/raster-coverage.js +62 -0
  410. package/dist/loader-utils/lib/sources/raster-coverage.js.map +1 -0
  411. package/dist/loader-utils/lib/sources/raster-region.d.ts +4 -0
  412. package/dist/loader-utils/lib/sources/raster-region.d.ts.map +1 -0
  413. package/dist/loader-utils/lib/sources/raster-region.js +22 -0
  414. package/dist/loader-utils/lib/sources/raster-region.js.map +1 -0
  415. package/dist/loader-utils/lib/sources/raster-sampling.d.ts +35 -0
  416. package/dist/loader-utils/lib/sources/raster-sampling.d.ts.map +1 -0
  417. package/dist/loader-utils/lib/sources/raster-sampling.js +152 -0
  418. package/dist/loader-utils/lib/sources/raster-sampling.js.map +1 -0
  419. package/dist/loader-utils/lib/sources/raster-source.d.ts +302 -0
  420. package/dist/loader-utils/lib/sources/raster-source.d.ts.map +1 -0
  421. package/dist/loader-utils/lib/sources/raster-source.js +20 -0
  422. package/dist/loader-utils/lib/sources/raster-source.js.map +1 -0
  423. package/dist/loader-utils/lib/sources/service-capabilities.d.ts +36 -0
  424. package/dist/loader-utils/lib/sources/service-capabilities.d.ts.map +1 -0
  425. package/dist/loader-utils/lib/sources/service-capabilities.js +5 -0
  426. package/dist/loader-utils/lib/sources/service-capabilities.js.map +1 -0
  427. package/dist/loader-utils/lib/sources/tile-grid.d.ts +46 -0
  428. package/dist/loader-utils/lib/sources/tile-grid.d.ts.map +1 -0
  429. package/dist/loader-utils/lib/sources/tile-grid.js +128 -0
  430. package/dist/loader-utils/lib/sources/tile-grid.js.map +1 -0
  431. package/dist/loader-utils/lib/sources/tile-source-adapter.d.ts +24 -0
  432. package/dist/loader-utils/lib/sources/tile-source-adapter.d.ts.map +1 -0
  433. package/dist/loader-utils/lib/sources/tile-source-adapter.js +109 -0
  434. package/dist/loader-utils/lib/sources/tile-source-adapter.js.map +1 -0
  435. package/dist/loader-utils/lib/sources/tile-source-utils.d.ts +6 -0
  436. package/dist/loader-utils/lib/sources/tile-source-utils.d.ts.map +1 -0
  437. package/dist/loader-utils/lib/sources/tile-source-utils.js +13 -0
  438. package/dist/loader-utils/lib/sources/tile-source-utils.js.map +1 -0
  439. package/dist/loader-utils/lib/sources/tile-source.d.ts +190 -0
  440. package/dist/loader-utils/lib/sources/tile-source.d.ts.map +1 -0
  441. package/dist/loader-utils/lib/sources/tile-source.js +5 -0
  442. package/dist/loader-utils/lib/sources/tile-source.js.map +1 -0
  443. package/dist/loader-utils/lib/sources/utils/image-type.d.ts +10 -0
  444. package/dist/loader-utils/lib/sources/utils/image-type.d.ts.map +1 -0
  445. package/dist/loader-utils/lib/sources/utils/image-type.js +5 -0
  446. package/dist/loader-utils/lib/sources/utils/image-type.js.map +1 -0
  447. package/dist/loader-utils/lib/sources/utils/utils.d.ts +13 -0
  448. package/dist/loader-utils/lib/sources/utils/utils.d.ts.map +1 -0
  449. package/dist/loader-utils/lib/sources/utils/utils.js +26 -0
  450. package/dist/loader-utils/lib/sources/utils/utils.js.map +1 -0
  451. package/dist/loader-utils/lib/sources/vector-source.d.ts +76 -0
  452. package/dist/loader-utils/lib/sources/vector-source.d.ts.map +1 -0
  453. package/dist/loader-utils/lib/sources/vector-source.js +5 -0
  454. package/dist/loader-utils/lib/sources/vector-source.js.map +1 -0
  455. package/dist/loader-utils/lib/sources/vector-tile-source.d.ts +15 -0
  456. package/dist/loader-utils/lib/sources/vector-tile-source.d.ts.map +1 -0
  457. package/dist/loader-utils/lib/sources/vector-tile-source.js +5 -0
  458. package/dist/loader-utils/lib/sources/vector-tile-source.js.map +1 -0
  459. package/dist/loader-utils/lib/sources/xyz-grid.d.ts +9 -0
  460. package/dist/loader-utils/lib/sources/xyz-grid.d.ts.map +1 -0
  461. package/dist/loader-utils/lib/sources/xyz-grid.js +63 -0
  462. package/dist/loader-utils/lib/sources/xyz-grid.js.map +1 -0
  463. package/dist/loader-utils/lib/worker-loader-utils/create-loader-worker.d.ts +22 -0
  464. package/dist/loader-utils/lib/worker-loader-utils/create-loader-worker.d.ts.map +1 -0
  465. package/dist/loader-utils/lib/worker-loader-utils/create-loader-worker.js +155 -0
  466. package/dist/loader-utils/lib/worker-loader-utils/create-loader-worker.js.map +1 -0
  467. package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.d.ts +8 -0
  468. package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.d.ts.map +1 -0
  469. package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.js +23 -0
  470. package/dist/loader-utils/lib/worker-loader-utils/encode-with-worker.js.map +1 -0
  471. package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.d.ts +41 -0
  472. package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.d.ts.map +1 -0
  473. package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.js +239 -0
  474. package/dist/loader-utils/lib/worker-loader-utils/parse-with-worker.js.map +1 -0
  475. package/dist/loader-utils/loader-types.d.ts +322 -0
  476. package/dist/loader-utils/loader-types.d.ts.map +1 -0
  477. package/dist/loader-utils/loader-types.js +33 -0
  478. package/dist/loader-utils/loader-types.js.map +1 -0
  479. package/dist/loader-utils/source-types.d.ts +42 -0
  480. package/dist/loader-utils/source-types.d.ts.map +1 -0
  481. package/dist/loader-utils/source-types.js +8 -0
  482. package/dist/loader-utils/source-types.js.map +1 -0
  483. package/dist/loader-utils/types.d.ts +24 -0
  484. package/dist/loader-utils/types.d.ts.map +1 -0
  485. package/dist/loader-utils/types.js +6 -0
  486. package/dist/loader-utils/types.js.map +1 -0
  487. package/dist/loader-utils/workers/json-worker.d.ts +2 -0
  488. package/dist/loader-utils/workers/json-worker.d.ts.map +1 -0
  489. package/dist/loader-utils/workers/json-worker.js +7 -0
  490. package/dist/loader-utils/workers/json-worker.js.map +1 -0
  491. package/dist/loader-utils/writer-types.d.ts +74 -0
  492. package/dist/loader-utils/writer-types.d.ts.map +1 -0
  493. package/dist/loader-utils/writer-types.js +5 -0
  494. package/dist/loader-utils/writer-types.js.map +1 -0
  495. package/dist/null-loader.d.ts +2 -2
  496. package/dist/null-loader.d.ts.map +1 -1
  497. package/dist/null-loader.js +1 -1
  498. package/dist/null-worker-node.js +7 -7
  499. package/dist/null-worker.js +7 -7
  500. package/dist/polyfills/buffer/btoa.node.d.ts +3 -0
  501. package/dist/polyfills/buffer/btoa.node.d.ts.map +1 -0
  502. package/dist/polyfills/buffer/btoa.node.js +13 -0
  503. package/dist/polyfills/buffer/btoa.node.js.map +1 -0
  504. package/dist/polyfills/buffer/to-array-buffer.node.d.ts +2 -0
  505. package/dist/polyfills/buffer/to-array-buffer.node.d.ts.map +1 -0
  506. package/dist/polyfills/buffer/to-array-buffer.node.js +12 -0
  507. package/dist/polyfills/buffer/to-array-buffer.node.js.map +1 -0
  508. package/dist/polyfills/crypto/node-hash.d.ts +29 -0
  509. package/dist/polyfills/crypto/node-hash.d.ts.map +1 -0
  510. package/dist/polyfills/crypto/node-hash.js +63 -0
  511. package/dist/polyfills/crypto/node-hash.js.map +1 -0
  512. package/dist/polyfills/fetch/decode-data-uri.d.ts +11 -0
  513. package/dist/polyfills/fetch/decode-data-uri.d.ts.map +1 -0
  514. package/dist/polyfills/fetch/decode-data-uri.js +63 -0
  515. package/dist/polyfills/fetch/decode-data-uri.js.map +1 -0
  516. package/dist/polyfills/fetch/fetch-polyfill.d.ts +11 -0
  517. package/dist/polyfills/fetch/fetch-polyfill.d.ts.map +1 -0
  518. package/dist/polyfills/fetch/fetch-polyfill.js +141 -0
  519. package/dist/polyfills/fetch/fetch-polyfill.js.map +1 -0
  520. package/dist/polyfills/fetch/headers-polyfill.d.ts +34 -0
  521. package/dist/polyfills/fetch/headers-polyfill.d.ts.map +1 -0
  522. package/dist/polyfills/fetch/headers-polyfill.js +105 -0
  523. package/dist/polyfills/fetch/headers-polyfill.js.map +1 -0
  524. package/dist/polyfills/fetch/response-polyfill.d.ts +22 -0
  525. package/dist/polyfills/fetch/response-polyfill.d.ts.map +1 -0
  526. package/dist/polyfills/fetch/response-polyfill.js +81 -0
  527. package/dist/polyfills/fetch/response-polyfill.js.map +1 -0
  528. package/dist/polyfills/fetch/utils/decode-data-uri.node.d.ts +11 -0
  529. package/dist/polyfills/fetch/utils/decode-data-uri.node.d.ts.map +1 -0
  530. package/dist/polyfills/fetch/utils/decode-data-uri.node.js +32 -0
  531. package/dist/polyfills/fetch/utils/decode-data-uri.node.js.map +1 -0
  532. package/dist/polyfills/file/blob-stream-controller.d.ts +29 -0
  533. package/dist/polyfills/file/blob-stream-controller.d.ts.map +1 -0
  534. package/dist/polyfills/file/blob-stream-controller.js +64 -0
  535. package/dist/polyfills/file/blob-stream-controller.js.map +1 -0
  536. package/dist/polyfills/file/blob-stream.d.ts +25 -0
  537. package/dist/polyfills/file/blob-stream.d.ts.map +1 -0
  538. package/dist/polyfills/file/blob-stream.js +38 -0
  539. package/dist/polyfills/file/blob-stream.js.map +1 -0
  540. package/dist/polyfills/file/blob.d.ts +58 -0
  541. package/dist/polyfills/file/blob.d.ts.map +1 -0
  542. package/dist/polyfills/file/blob.js +166 -0
  543. package/dist/polyfills/file/blob.js.map +1 -0
  544. package/dist/polyfills/file/file-reader.d.ts +24 -0
  545. package/dist/polyfills/file/file-reader.d.ts.map +1 -0
  546. package/dist/polyfills/file/file-reader.js +51 -0
  547. package/dist/polyfills/file/file-reader.js.map +1 -0
  548. package/dist/polyfills/file/file.d.ts +24 -0
  549. package/dist/polyfills/file/file.d.ts.map +1 -0
  550. package/dist/polyfills/file/file.js +41 -0
  551. package/dist/polyfills/file/file.js.map +1 -0
  552. package/dist/polyfills/file/install-blob-polyfills.d.ts +9 -0
  553. package/dist/polyfills/file/install-blob-polyfills.d.ts.map +1 -0
  554. package/dist/polyfills/file/install-blob-polyfills.js +14 -0
  555. package/dist/polyfills/file/install-blob-polyfills.js.map +1 -0
  556. package/dist/polyfills/file/install-file-polyfills.d.ts +3 -0
  557. package/dist/polyfills/file/install-file-polyfills.d.ts.map +1 -0
  558. package/dist/polyfills/file/install-file-polyfills.js +20 -0
  559. package/dist/polyfills/file/install-file-polyfills.js.map +1 -0
  560. package/dist/polyfills/file/readable-stream.d.ts +5 -0
  561. package/dist/polyfills/file/readable-stream.d.ts.map +1 -0
  562. package/dist/polyfills/file/readable-stream.js +8 -0
  563. package/dist/polyfills/file/readable-stream.js.map +1 -0
  564. package/dist/polyfills/filesystems/fetch-node.d.ts +8 -0
  565. package/dist/polyfills/filesystems/fetch-node.d.ts.map +1 -0
  566. package/dist/polyfills/filesystems/fetch-node.js +88 -0
  567. package/dist/polyfills/filesystems/fetch-node.js.map +1 -0
  568. package/dist/polyfills/filesystems/node-file.d.ts +15 -0
  569. package/dist/polyfills/filesystems/node-file.d.ts.map +1 -0
  570. package/dist/polyfills/filesystems/node-file.js +138 -0
  571. package/dist/polyfills/filesystems/node-file.js.map +1 -0
  572. package/dist/polyfills/filesystems/node-filesystem.d.ts +19 -0
  573. package/dist/polyfills/filesystems/node-filesystem.d.ts.map +1 -0
  574. package/dist/polyfills/filesystems/node-filesystem.js +44 -0
  575. package/dist/polyfills/filesystems/node-filesystem.js.map +1 -0
  576. package/dist/polyfills/filesystems/stream-utils.node.d.ts +18 -0
  577. package/dist/polyfills/filesystems/stream-utils.node.d.ts.map +1 -0
  578. package/dist/polyfills/filesystems/stream-utils.node.js +67 -0
  579. package/dist/polyfills/filesystems/stream-utils.node.js.map +1 -0
  580. package/dist/polyfills/images/encode-image-node.d.ts +20 -0
  581. package/dist/polyfills/images/encode-image-node.d.ts.map +1 -0
  582. package/dist/polyfills/images/encode-image-node.js +37 -0
  583. package/dist/polyfills/images/encode-image-node.js.map +1 -0
  584. package/dist/polyfills/images/image-codecs-node.d.ts +8 -0
  585. package/dist/polyfills/images/image-codecs-node.d.ts.map +1 -0
  586. package/dist/polyfills/images/image-codecs-node.js +27 -0
  587. package/dist/polyfills/images/image-codecs-node.js.map +1 -0
  588. package/dist/polyfills/images/node-image-bitmap.d.ts +38 -0
  589. package/dist/polyfills/images/node-image-bitmap.d.ts.map +1 -0
  590. package/dist/polyfills/images/node-image-bitmap.js +64 -0
  591. package/dist/polyfills/images/node-image-bitmap.js.map +1 -0
  592. package/dist/polyfills/images/node-image-formats.d.ts +3 -0
  593. package/dist/polyfills/images/node-image-formats.d.ts.map +1 -0
  594. package/dist/polyfills/images/node-image-formats.js +6 -0
  595. package/dist/polyfills/images/node-image-formats.js.map +1 -0
  596. package/dist/polyfills/images/parse-image-node.d.ts +11 -0
  597. package/dist/polyfills/images/parse-image-node.d.ts.map +1 -0
  598. package/dist/polyfills/images/parse-image-node.js +36 -0
  599. package/dist/polyfills/images/parse-image-node.js.map +1 -0
  600. package/dist/polyfills/index.browser.d.ts +8 -0
  601. package/dist/polyfills/index.browser.d.ts.map +1 -0
  602. package/dist/polyfills/index.browser.js +18 -0
  603. package/dist/polyfills/index.browser.js.map +1 -0
  604. package/dist/polyfills/index.cjs +2918 -0
  605. package/dist/polyfills/index.cjs.map +6 -0
  606. package/dist/polyfills/index.d.ts +7 -0
  607. package/dist/polyfills/index.d.ts.map +1 -0
  608. package/dist/polyfills/index.js +110 -0
  609. package/dist/polyfills/index.js.map +1 -0
  610. package/dist/polyfills/libs/encoding-indexes-asian.d.ts +10 -0
  611. package/dist/polyfills/libs/encoding-indexes-asian.d.ts.map +1 -0
  612. package/dist/polyfills/libs/encoding-indexes-asian.js +14 -0
  613. package/dist/polyfills/libs/encoding-indexes-asian.js.map +1 -0
  614. package/dist/polyfills/load-library/require-utils.node.d.ts +19 -0
  615. package/dist/polyfills/load-library/require-utils.node.d.ts.map +1 -0
  616. package/dist/polyfills/load-library/require-utils.node.js +88 -0
  617. package/dist/polyfills/load-library/require-utils.node.js.map +1 -0
  618. package/dist/polyfills/streams/make-node-stream.d.ts +10 -0
  619. package/dist/polyfills/streams/make-node-stream.d.ts.map +1 -0
  620. package/dist/polyfills/streams/make-node-stream.js +70 -0
  621. package/dist/polyfills/streams/make-node-stream.js.map +1 -0
  622. package/dist/polyfills/text-encoder/encoding-indexes.d.ts +31 -0
  623. package/dist/polyfills/text-encoder/encoding-indexes.d.ts.map +1 -0
  624. package/dist/polyfills/text-encoder/encoding-indexes.js +35 -0
  625. package/dist/polyfills/text-encoder/encoding-indexes.js.map +1 -0
  626. package/dist/polyfills/text-encoder/text-encoder.d.ts +15 -0
  627. package/dist/polyfills/text-encoder/text-encoder.d.ts.map +1 -0
  628. package/dist/polyfills/text-encoder/text-encoder.js +2778 -0
  629. package/dist/polyfills/text-encoder/text-encoder.js.map +1 -0
  630. package/dist/polyfills/utils/assert.d.ts +2 -0
  631. package/dist/polyfills/utils/assert.d.ts.map +1 -0
  632. package/dist/polyfills/utils/assert.js +9 -0
  633. package/dist/polyfills/utils/assert.js.map +1 -0
  634. package/dist/polyfills/utils/buffer-utils.d.ts +5 -0
  635. package/dist/polyfills/utils/buffer-utils.d.ts.map +1 -0
  636. package/dist/polyfills/utils/buffer-utils.js +34 -0
  637. package/dist/polyfills/utils/buffer-utils.js.map +1 -0
  638. package/dist/polyfills/utils/filesystem-types.d.ts +10 -0
  639. package/dist/polyfills/utils/filesystem-types.d.ts.map +1 -0
  640. package/dist/polyfills/utils/filesystem-types.js +5 -0
  641. package/dist/polyfills/utils/filesystem-types.js.map +1 -0
  642. package/dist/polyfills/utils/is-browser.d.ts +2 -0
  643. package/dist/polyfills/utils/is-browser.d.ts.map +1 -0
  644. package/dist/polyfills/utils/is-browser.js +8 -0
  645. package/dist/polyfills/utils/is-browser.js.map +1 -0
  646. package/dist/polyfills/utils/path-utils.d.ts +7 -0
  647. package/dist/polyfills/utils/path-utils.d.ts.map +1 -0
  648. package/dist/polyfills/utils/path-utils.js +28 -0
  649. package/dist/polyfills/utils/path-utils.js.map +1 -0
  650. package/dist/schema/categories/category-gis.d.ts +7 -0
  651. package/dist/schema/categories/category-gis.d.ts.map +1 -0
  652. package/dist/schema/categories/category-gis.js +5 -0
  653. package/dist/schema/categories/category-gis.js.map +1 -0
  654. package/dist/schema/categories/category-image.d.ts +18 -0
  655. package/dist/schema/categories/category-image.d.ts.map +1 -0
  656. package/dist/schema/categories/category-image.js +5 -0
  657. package/dist/schema/categories/category-image.js.map +1 -0
  658. package/dist/schema/categories/category-mesh.d.ts +99 -0
  659. package/dist/schema/categories/category-mesh.d.ts.map +1 -0
  660. package/dist/schema/categories/category-mesh.js +14 -0
  661. package/dist/schema/categories/category-mesh.js.map +1 -0
  662. package/dist/schema/categories/category-table.d.ts +106 -0
  663. package/dist/schema/categories/category-table.d.ts.map +1 -0
  664. package/dist/schema/categories/category-table.js +5 -0
  665. package/dist/schema/categories/category-table.js.map +1 -0
  666. package/dist/schema/categories/category-texture.d.ts +115 -0
  667. package/dist/schema/categories/category-texture.d.ts.map +1 -0
  668. package/dist/schema/categories/category-texture.js +5 -0
  669. package/dist/schema/categories/category-texture.js.map +1 -0
  670. package/dist/schema/deprecated/mesh-utils.d.ts +12 -0
  671. package/dist/schema/deprecated/mesh-utils.d.ts.map +1 -0
  672. package/dist/schema/deprecated/mesh-utils.js +37 -0
  673. package/dist/schema/deprecated/mesh-utils.js.map +1 -0
  674. package/dist/schema/float16.d.ts +19 -0
  675. package/dist/schema/float16.d.ts.map +1 -0
  676. package/dist/schema/float16.js +90 -0
  677. package/dist/schema/float16.js.map +1 -0
  678. package/dist/schema/geoarrow-metadata.schema.json +117 -0
  679. package/dist/schema/geometry/arrow-binary-features.d.ts +45 -0
  680. package/dist/schema/geometry/arrow-binary-features.d.ts.map +1 -0
  681. package/dist/schema/geometry/arrow-binary-features.js +5 -0
  682. package/dist/schema/geometry/arrow-binary-features.js.map +1 -0
  683. package/dist/schema/geometry/binary-features.d.ts +30 -0
  684. package/dist/schema/geometry/binary-features.d.ts.map +1 -0
  685. package/dist/schema/geometry/binary-features.js +5 -0
  686. package/dist/schema/geometry/binary-features.js.map +1 -0
  687. package/dist/schema/geometry/binary-geometries.d.ts +33 -0
  688. package/dist/schema/geometry/binary-geometries.d.ts.map +1 -0
  689. package/dist/schema/geometry/binary-geometries.js +5 -0
  690. package/dist/schema/geometry/binary-geometries.js.map +1 -0
  691. package/dist/schema/geometry/flat-geometries.d.ts +61 -0
  692. package/dist/schema/geometry/flat-geometries.d.ts.map +1 -0
  693. package/dist/schema/geometry/flat-geometries.js +5 -0
  694. package/dist/schema/geometry/flat-geometries.js.map +1 -0
  695. package/dist/schema/geometry/geoarrow.d.ts +69 -0
  696. package/dist/schema/geometry/geoarrow.d.ts.map +1 -0
  697. package/dist/schema/geometry/geoarrow.js +5 -0
  698. package/dist/schema/geometry/geoarrow.js.map +1 -0
  699. package/dist/schema/geoparquet.schema.json +222 -0
  700. package/dist/schema/geospatial-metadata-zod-schema.cjs +154 -0
  701. package/dist/schema/geospatial-metadata-zod-schema.cjs.map +6 -0
  702. package/dist/schema/geospatial-metadata-zod-schema.d.ts +44 -0
  703. package/dist/schema/geospatial-metadata-zod-schema.d.ts.map +1 -0
  704. package/dist/schema/geospatial-metadata-zod-schema.js +151 -0
  705. package/dist/schema/geospatial-metadata-zod-schema.js.map +1 -0
  706. package/dist/schema/index.cjs +259 -0
  707. package/dist/schema/index.cjs.map +6 -0
  708. package/dist/schema/index.d.ts +21 -0
  709. package/dist/schema/index.d.ts.map +1 -0
  710. package/dist/schema/index.js +9 -0
  711. package/dist/schema/index.js.map +1 -0
  712. package/dist/schema/metadata.d.ts +40 -0
  713. package/dist/schema/metadata.d.ts.map +1 -0
  714. package/dist/schema/metadata.js +86 -0
  715. package/dist/schema/metadata.js.map +1 -0
  716. package/dist/schema/types/batch.d.ts +37 -0
  717. package/dist/schema/types/batch.d.ts.map +1 -0
  718. package/dist/schema/types/batch.js +5 -0
  719. package/dist/schema/types/batch.js.map +1 -0
  720. package/dist/schema/types/schema.d.ts +70 -0
  721. package/dist/schema/types/schema.d.ts.map +1 -0
  722. package/dist/schema/types/schema.js +5 -0
  723. package/dist/schema/types/schema.js.map +1 -0
  724. package/dist/schema/types/types.d.ts +16 -0
  725. package/dist/schema/types/types.d.ts.map +1 -0
  726. package/dist/schema/types/types.js +6 -0
  727. package/dist/schema/types/types.js.map +1 -0
  728. package/dist/schema-utils/arrow-transport.cjs +665 -0
  729. package/dist/schema-utils/arrow-transport.cjs.map +6 -0
  730. package/dist/schema-utils/arrow-transport.d.ts +4 -0
  731. package/dist/schema-utils/arrow-transport.d.ts.map +1 -0
  732. package/dist/schema-utils/arrow-transport.js +7 -0
  733. package/dist/schema-utils/arrow-transport.js.map +1 -0
  734. package/dist/schema-utils/deprecated.d.ts +24 -0
  735. package/dist/schema-utils/deprecated.d.ts.map +1 -0
  736. package/dist/schema-utils/deprecated.js +27 -0
  737. package/dist/schema-utils/deprecated.js.map +1 -0
  738. package/dist/schema-utils/index.cjs +3423 -0
  739. package/dist/schema-utils/index.cjs.map +6 -0
  740. package/dist/schema-utils/index.d.ts +38 -0
  741. package/dist/schema-utils/index.d.ts.map +1 -0
  742. package/dist/schema-utils/index.js +77 -0
  743. package/dist/schema-utils/index.js.map +1 -0
  744. package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts +72 -0
  745. package/dist/schema-utils/lib/arrow/arrow-table-transport.d.ts.map +1 -0
  746. package/dist/schema-utils/lib/arrow/arrow-table-transport.js +162 -0
  747. package/dist/schema-utils/lib/arrow/arrow-table-transport.js.map +1 -0
  748. package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts +33 -0
  749. package/dist/schema-utils/lib/arrow/split-arrow-buffers.d.ts.map +1 -0
  750. package/dist/schema-utils/lib/arrow/split-arrow-buffers.js +128 -0
  751. package/dist/schema-utils/lib/arrow/split-arrow-buffers.js.map +1 -0
  752. package/dist/schema-utils/lib/arrow-utils/arrow-fixed-size-list-utils.d.ts +11 -0
  753. package/dist/schema-utils/lib/arrow-utils/arrow-fixed-size-list-utils.d.ts.map +1 -0
  754. package/dist/schema-utils/lib/arrow-utils/arrow-fixed-size-list-utils.js +45 -0
  755. package/dist/schema-utils/lib/arrow-utils/arrow-fixed-size-list-utils.js.map +1 -0
  756. package/dist/schema-utils/lib/arrow-utils/arrow-list-of-fixed-size-list-utils.d.ts +11 -0
  757. package/dist/schema-utils/lib/arrow-utils/arrow-list-of-fixed-size-list-utils.d.ts.map +1 -0
  758. package/dist/schema-utils/lib/arrow-utils/arrow-list-of-fixed-size-list-utils.js +33 -0
  759. package/dist/schema-utils/lib/arrow-utils/arrow-list-of-fixed-size-list-utils.js.map +1 -0
  760. package/dist/schema-utils/lib/converters/convert.d.ts +10 -0
  761. package/dist/schema-utils/lib/converters/convert.d.ts.map +1 -0
  762. package/dist/schema-utils/lib/converters/convert.js +98 -0
  763. package/dist/schema-utils/lib/converters/convert.js.map +1 -0
  764. package/dist/schema-utils/lib/converters/converters.d.ts +3 -0
  765. package/dist/schema-utils/lib/converters/converters.d.ts.map +1 -0
  766. package/dist/schema-utils/lib/converters/converters.js +5 -0
  767. package/dist/schema-utils/lib/converters/converters.js.map +1 -0
  768. package/dist/schema-utils/lib/converters/types.d.ts +35 -0
  769. package/dist/schema-utils/lib/converters/types.d.ts.map +1 -0
  770. package/dist/schema-utils/lib/converters/types.js +5 -0
  771. package/dist/schema-utils/lib/converters/types.js.map +1 -0
  772. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.d.ts +44 -0
  773. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.d.ts.map +1 -0
  774. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.js +187 -0
  775. package/dist/schema-utils/lib/mesh/convert-mesh-to-table.js.map +1 -0
  776. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.d.ts +14 -0
  777. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.d.ts.map +1 -0
  778. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.js +217 -0
  779. package/dist/schema-utils/lib/mesh/convert-table-to-mesh.js.map +1 -0
  780. package/dist/schema-utils/lib/mesh/deduce-mesh-schema.d.ts +23 -0
  781. package/dist/schema-utils/lib/mesh/deduce-mesh-schema.d.ts.map +1 -0
  782. package/dist/schema-utils/lib/mesh/deduce-mesh-schema.js +72 -0
  783. package/dist/schema-utils/lib/mesh/deduce-mesh-schema.js.map +1 -0
  784. package/dist/schema-utils/lib/mesh/mesh-utils.d.ts +23 -0
  785. package/dist/schema-utils/lib/mesh/mesh-utils.d.ts.map +1 -0
  786. package/dist/schema-utils/lib/mesh/mesh-utils.js +54 -0
  787. package/dist/schema-utils/lib/mesh/mesh-utils.js.map +1 -0
  788. package/dist/schema-utils/lib/mesh/point-cloud-tiler.d.ts +98 -0
  789. package/dist/schema-utils/lib/mesh/point-cloud-tiler.d.ts.map +1 -0
  790. package/dist/schema-utils/lib/mesh/point-cloud-tiler.js +407 -0
  791. package/dist/schema-utils/lib/mesh/point-cloud-tiler.js.map +1 -0
  792. package/dist/schema-utils/lib/schema/convert-arrow-schema.d.ts +39 -0
  793. package/dist/schema-utils/lib/schema/convert-arrow-schema.d.ts.map +1 -0
  794. package/dist/schema-utils/lib/schema/convert-arrow-schema.js +441 -0
  795. package/dist/schema-utils/lib/schema/convert-arrow-schema.js.map +1 -0
  796. package/dist/schema-utils/lib/schema/data-type.d.ts +16 -0
  797. package/dist/schema-utils/lib/schema/data-type.d.ts.map +1 -0
  798. package/dist/schema-utils/lib/schema/data-type.js +102 -0
  799. package/dist/schema-utils/lib/schema/data-type.js.map +1 -0
  800. package/dist/schema-utils/lib/schema/deduce-table-schema.d.ts +14 -0
  801. package/dist/schema-utils/lib/schema/deduce-table-schema.d.ts.map +1 -0
  802. package/dist/schema-utils/lib/schema/deduce-table-schema.js +101 -0
  803. package/dist/schema-utils/lib/schema/deduce-table-schema.js.map +1 -0
  804. package/dist/schema-utils/lib/table/arrow-api/arrow-like-field.d.ts +19 -0
  805. package/dist/schema-utils/lib/table/arrow-api/arrow-like-field.d.ts.map +1 -0
  806. package/dist/schema-utils/lib/table/arrow-api/arrow-like-field.js +37 -0
  807. package/dist/schema-utils/lib/table/arrow-api/arrow-like-field.js.map +1 -0
  808. package/dist/schema-utils/lib/table/arrow-api/arrow-like-interface.d.ts +43 -0
  809. package/dist/schema-utils/lib/table/arrow-api/arrow-like-interface.d.ts.map +1 -0
  810. package/dist/schema-utils/lib/table/arrow-api/arrow-like-interface.js +5 -0
  811. package/dist/schema-utils/lib/table/arrow-api/arrow-like-interface.js.map +1 -0
  812. package/dist/schema-utils/lib/table/arrow-api/arrow-like-schema.d.ts +12 -0
  813. package/dist/schema-utils/lib/table/arrow-api/arrow-like-schema.d.ts.map +1 -0
  814. package/dist/schema-utils/lib/table/arrow-api/arrow-like-schema.js +82 -0
  815. package/dist/schema-utils/lib/table/arrow-api/arrow-like-schema.js.map +1 -0
  816. package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.d.ts +28 -0
  817. package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.d.ts.map +1 -0
  818. package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.js +64 -0
  819. package/dist/schema-utils/lib/table/arrow-api/arrow-like-table.js.map +1 -0
  820. package/dist/schema-utils/lib/table/arrow-api/arrow-like-type.d.ts +177 -0
  821. package/dist/schema-utils/lib/table/arrow-api/arrow-like-type.d.ts.map +1 -0
  822. package/dist/schema-utils/lib/table/arrow-api/arrow-like-type.js +441 -0
  823. package/dist/schema-utils/lib/table/arrow-api/arrow-like-type.js.map +1 -0
  824. package/dist/schema-utils/lib/table/arrow-api/enum.d.ts +92 -0
  825. package/dist/schema-utils/lib/table/arrow-api/enum.d.ts.map +1 -0
  826. package/dist/schema-utils/lib/table/arrow-api/enum.js +98 -0
  827. package/dist/schema-utils/lib/table/arrow-api/enum.js.map +1 -0
  828. package/dist/schema-utils/lib/table/arrow-api/get-type-info.d.ts +13 -0
  829. package/dist/schema-utils/lib/table/arrow-api/get-type-info.d.ts.map +1 -0
  830. package/dist/schema-utils/lib/table/arrow-api/get-type-info.js +28 -0
  831. package/dist/schema-utils/lib/table/arrow-api/get-type-info.js.map +1 -0
  832. package/dist/schema-utils/lib/table/arrow-api/index.d.ts +6 -0
  833. package/dist/schema-utils/lib/table/arrow-api/index.d.ts.map +1 -0
  834. package/dist/schema-utils/lib/table/arrow-api/index.js +8 -0
  835. package/dist/schema-utils/lib/table/arrow-api/index.js.map +1 -0
  836. package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.d.ts +10 -0
  837. package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.d.ts.map +1 -0
  838. package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.js +71 -0
  839. package/dist/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.js.map +1 -0
  840. package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.d.ts +28 -0
  841. package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.d.ts.map +1 -0
  842. package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.js +104 -0
  843. package/dist/schema-utils/lib/table/batch-builder/arrow-table-builder.js.map +1 -0
  844. package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.d.ts +19 -0
  845. package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.d.ts.map +1 -0
  846. package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.js +64 -0
  847. package/dist/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.js.map +1 -0
  848. package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.d.ts +20 -0
  849. package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.d.ts.map +1 -0
  850. package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.js +84 -0
  851. package/dist/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.js.map +1 -0
  852. package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.d.ts +21 -0
  853. package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.d.ts.map +1 -0
  854. package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.js +86 -0
  855. package/dist/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.js.map +1 -0
  856. package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.d.ts +24 -0
  857. package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.d.ts.map +1 -0
  858. package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.js +5 -0
  859. package/dist/schema-utils/lib/table/batch-builder/table-batch-aggregator.js.map +1 -0
  860. package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.d.ts +52 -0
  861. package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.d.ts.map +1 -0
  862. package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.js +149 -0
  863. package/dist/schema-utils/lib/table/batch-builder/table-batch-builder.js.map +1 -0
  864. package/dist/schema-utils/lib/table/batches/convert-batches.d.ts +10 -0
  865. package/dist/schema-utils/lib/table/batches/convert-batches.d.ts.map +1 -0
  866. package/dist/schema-utils/lib/table/batches/convert-batches.js +46 -0
  867. package/dist/schema-utils/lib/table/batches/convert-batches.js.map +1 -0
  868. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.d.ts +17 -0
  869. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.d.ts.map +1 -0
  870. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.js +61 -0
  871. package/dist/schema-utils/lib/table/batches/make-arrow-batch-iterator.js.map +1 -0
  872. package/dist/schema-utils/lib/table/batches/make-table-batch-iterator.d.ts +15 -0
  873. package/dist/schema-utils/lib/table/batches/make-table-batch-iterator.d.ts.map +1 -0
  874. package/dist/schema-utils/lib/table/batches/make-table-batch-iterator.js +22 -0
  875. package/dist/schema-utils/lib/table/batches/make-table-batch-iterator.js.map +1 -0
  876. package/dist/schema-utils/lib/table/batches/make-table-from-batches.d.ts +9 -0
  877. package/dist/schema-utils/lib/table/batches/make-table-from-batches.d.ts.map +1 -0
  878. package/dist/schema-utils/lib/table/batches/make-table-from-batches.js +63 -0
  879. package/dist/schema-utils/lib/table/batches/make-table-from-batches.js.map +1 -0
  880. package/dist/schema-utils/lib/table/query-arrow-table.d.ts +23 -0
  881. package/dist/schema-utils/lib/table/query-arrow-table.d.ts.map +1 -0
  882. package/dist/schema-utils/lib/table/query-arrow-table.js +73 -0
  883. package/dist/schema-utils/lib/table/query-arrow-table.js.map +1 -0
  884. package/dist/schema-utils/lib/table/tables/convert-arrow-table.d.ts +24 -0
  885. package/dist/schema-utils/lib/table/tables/convert-arrow-table.d.ts.map +1 -0
  886. package/dist/schema-utils/lib/table/tables/convert-arrow-table.js +151 -0
  887. package/dist/schema-utils/lib/table/tables/convert-arrow-table.js.map +1 -0
  888. package/dist/schema-utils/lib/table/tables/convert-table.d.ts +43 -0
  889. package/dist/schema-utils/lib/table/tables/convert-table.d.ts.map +1 -0
  890. package/dist/schema-utils/lib/table/tables/convert-table.js +122 -0
  891. package/dist/schema-utils/lib/table/tables/convert-table.js.map +1 -0
  892. package/dist/schema-utils/lib/table/tables/make-table.d.ts +67 -0
  893. package/dist/schema-utils/lib/table/tables/make-table.d.ts.map +1 -0
  894. package/dist/schema-utils/lib/table/tables/make-table.js +102 -0
  895. package/dist/schema-utils/lib/table/tables/make-table.js.map +1 -0
  896. package/dist/schema-utils/lib/table/tables/row-utils.d.ts +15 -0
  897. package/dist/schema-utils/lib/table/tables/row-utils.d.ts.map +1 -0
  898. package/dist/schema-utils/lib/table/tables/row-utils.js +50 -0
  899. package/dist/schema-utils/lib/table/tables/row-utils.js.map +1 -0
  900. package/dist/schema-utils/lib/table/tables/table-accessors.d.ts +68 -0
  901. package/dist/schema-utils/lib/table/tables/table-accessors.d.ts.map +1 -0
  902. package/dist/schema-utils/lib/table/tables/table-accessors.js +352 -0
  903. package/dist/schema-utils/lib/table/tables/table-accessors.js.map +1 -0
  904. package/dist/schema-utils/lib/table/tables/table-column.d.ts +7 -0
  905. package/dist/schema-utils/lib/table/tables/table-column.d.ts.map +1 -0
  906. package/dist/schema-utils/lib/table/tables/table-column.js +40 -0
  907. package/dist/schema-utils/lib/table/tables/table-column.js.map +1 -0
  908. package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.d.ts +9 -0
  909. package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.d.ts.map +1 -0
  910. package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.js +19 -0
  911. package/dist/schema-utils/lib/table/tables/table-converter/convert-tables.js.map +1 -0
  912. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.d.ts +16 -0
  913. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.d.ts.map +1 -0
  914. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.js +45 -0
  915. package/dist/schema-utils/lib/table/tables/table-converter/table-converter.js.map +1 -0
  916. package/dist/schema-utils/lib/table/tables/table-types.d.ts +12 -0
  917. package/dist/schema-utils/lib/table/tables/table-types.d.ts.map +1 -0
  918. package/dist/schema-utils/lib/table/tables/table-types.js +24 -0
  919. package/dist/schema-utils/lib/table/tables/table-types.js.map +1 -0
  920. package/dist/schema-utils/lib/utils/assert.d.ts +2 -0
  921. package/dist/schema-utils/lib/utils/assert.d.ts.map +1 -0
  922. package/dist/schema-utils/lib/utils/assert.js +12 -0
  923. package/dist/schema-utils/lib/utils/assert.js.map +1 -0
  924. package/dist/schema-utils/lib/utils/async-queue.d.ts +18 -0
  925. package/dist/schema-utils/lib/utils/async-queue.d.ts.map +1 -0
  926. package/dist/schema-utils/lib/utils/async-queue.js +96 -0
  927. package/dist/schema-utils/lib/utils/async-queue.js.map +1 -0
  928. package/dist/schema-utils/types/types.d.ts +15 -0
  929. package/dist/schema-utils/types/types.d.ts.map +1 -0
  930. package/dist/schema-utils/types/types.js +5 -0
  931. package/dist/schema-utils/types/types.js.map +1 -0
  932. package/dist/worker-utils/index.cjs +1448 -0
  933. package/dist/worker-utils/index.cjs.map +6 -0
  934. package/dist/worker-utils/index.d.ts +22 -0
  935. package/dist/worker-utils/index.d.ts.map +1 -0
  936. package/dist/worker-utils/index.js +40 -0
  937. package/dist/worker-utils/index.js.map +1 -0
  938. package/dist/worker-utils/lib/async-queue/async-queue.d.ts +32 -0
  939. package/dist/worker-utils/lib/async-queue/async-queue.d.ts.map +1 -0
  940. package/dist/worker-utils/lib/async-queue/async-queue.js +91 -0
  941. package/dist/worker-utils/lib/async-queue/async-queue.js.map +1 -0
  942. package/dist/worker-utils/lib/env-utils/assert.d.ts +3 -0
  943. package/dist/worker-utils/lib/env-utils/assert.d.ts.map +1 -0
  944. package/dist/worker-utils/lib/env-utils/assert.js +13 -0
  945. package/dist/worker-utils/lib/env-utils/assert.js.map +1 -0
  946. package/dist/worker-utils/lib/env-utils/globals.d.ts +22 -0
  947. package/dist/worker-utils/lib/env-utils/globals.d.ts.map +1 -0
  948. package/dist/worker-utils/lib/env-utils/globals.js +30 -0
  949. package/dist/worker-utils/lib/env-utils/globals.js.map +1 -0
  950. package/dist/worker-utils/lib/env-utils/version.d.ts +2 -0
  951. package/dist/worker-utils/lib/env-utils/version.d.ts.map +1 -0
  952. package/dist/worker-utils/lib/env-utils/version.js +20 -0
  953. package/dist/worker-utils/lib/env-utils/version.js.map +1 -0
  954. package/dist/worker-utils/lib/library-utils/library-utils.d.ts +42 -0
  955. package/dist/worker-utils/lib/library-utils/library-utils.d.ts.map +1 -0
  956. package/dist/worker-utils/lib/library-utils/library-utils.js +248 -0
  957. package/dist/worker-utils/lib/library-utils/library-utils.js.map +1 -0
  958. package/dist/worker-utils/lib/node/worker_threads-browser.d.ts +14 -0
  959. package/dist/worker-utils/lib/node/worker_threads-browser.d.ts.map +1 -0
  960. package/dist/worker-utils/lib/node/worker_threads-browser.js +22 -0
  961. package/dist/worker-utils/lib/node/worker_threads-browser.js.map +1 -0
  962. package/dist/worker-utils/lib/node/worker_threads.d.ts +15 -0
  963. package/dist/worker-utils/lib/node/worker_threads.d.ts.map +1 -0
  964. package/dist/worker-utils/lib/node/worker_threads.js +16 -0
  965. package/dist/worker-utils/lib/node/worker_threads.js.map +1 -0
  966. package/dist/worker-utils/lib/npm-tag.d.ts +8 -0
  967. package/dist/worker-utils/lib/npm-tag.d.ts.map +1 -0
  968. package/dist/worker-utils/lib/npm-tag.js +11 -0
  969. package/dist/worker-utils/lib/npm-tag.js.map +1 -0
  970. package/dist/worker-utils/lib/process-utils/child-process-proxy.browser.d.ts +8 -0
  971. package/dist/worker-utils/lib/process-utils/child-process-proxy.browser.d.ts.map +1 -0
  972. package/dist/worker-utils/lib/process-utils/child-process-proxy.browser.js +18 -0
  973. package/dist/worker-utils/lib/process-utils/child-process-proxy.browser.js.map +1 -0
  974. package/dist/worker-utils/lib/process-utils/child-process-proxy.d.ts +45 -0
  975. package/dist/worker-utils/lib/process-utils/child-process-proxy.d.ts.map +1 -0
  976. package/dist/worker-utils/lib/process-utils/child-process-proxy.js +123 -0
  977. package/dist/worker-utils/lib/process-utils/child-process-proxy.js.map +1 -0
  978. package/dist/worker-utils/lib/process-utils/process-utils.d.ts +2 -0
  979. package/dist/worker-utils/lib/process-utils/process-utils.d.ts.map +1 -0
  980. package/dist/worker-utils/lib/process-utils/process-utils.js +32 -0
  981. package/dist/worker-utils/lib/process-utils/process-utils.js.map +1 -0
  982. package/dist/worker-utils/lib/worker-api/create-worker.d.ts +9 -0
  983. package/dist/worker-utils/lib/worker-api/create-worker.d.ts.map +1 -0
  984. package/dist/worker-utils/lib/worker-api/create-worker.js +123 -0
  985. package/dist/worker-utils/lib/worker-api/create-worker.js.map +1 -0
  986. package/dist/worker-utils/lib/worker-api/get-worker-url.d.ts +27 -0
  987. package/dist/worker-utils/lib/worker-api/get-worker-url.d.ts.map +1 -0
  988. package/dist/worker-utils/lib/worker-api/get-worker-url.js +103 -0
  989. package/dist/worker-utils/lib/worker-api/get-worker-url.js.map +1 -0
  990. package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts +44 -0
  991. package/dist/worker-utils/lib/worker-api/process-on-worker.d.ts.map +1 -0
  992. package/dist/worker-utils/lib/worker-api/process-on-worker.js +312 -0
  993. package/dist/worker-utils/lib/worker-api/process-on-worker.js.map +1 -0
  994. package/dist/worker-utils/lib/worker-api/validate-worker-version.d.ts +9 -0
  995. package/dist/worker-utils/lib/worker-api/validate-worker-version.d.ts.map +1 -0
  996. package/dist/worker-utils/lib/worker-api/validate-worker-version.js +35 -0
  997. package/dist/worker-utils/lib/worker-api/validate-worker-version.js.map +1 -0
  998. package/dist/worker-utils/lib/worker-farm/worker-body.d.ts +20 -0
  999. package/dist/worker-utils/lib/worker-farm/worker-body.d.ts.map +1 -0
  1000. package/dist/worker-utils/lib/worker-farm/worker-body.js +131 -0
  1001. package/dist/worker-utils/lib/worker-farm/worker-body.js.map +1 -0
  1002. package/dist/worker-utils/lib/worker-farm/worker-farm.d.ts +58 -0
  1003. package/dist/worker-utils/lib/worker-farm/worker-farm.d.ts.map +1 -0
  1004. package/dist/worker-utils/lib/worker-farm/worker-farm.js +116 -0
  1005. package/dist/worker-utils/lib/worker-farm/worker-farm.js.map +1 -0
  1006. package/dist/worker-utils/lib/worker-farm/worker-job.d.ts +34 -0
  1007. package/dist/worker-utils/lib/worker-farm/worker-job.d.ts.map +1 -0
  1008. package/dist/worker-utils/lib/worker-farm/worker-job.js +73 -0
  1009. package/dist/worker-utils/lib/worker-farm/worker-job.js.map +1 -0
  1010. package/dist/worker-utils/lib/worker-farm/worker-pool.d.ts +94 -0
  1011. package/dist/worker-utils/lib/worker-farm/worker-pool.d.ts.map +1 -0
  1012. package/dist/worker-utils/lib/worker-farm/worker-pool.js +193 -0
  1013. package/dist/worker-utils/lib/worker-farm/worker-pool.js.map +1 -0
  1014. package/dist/worker-utils/lib/worker-farm/worker-thread.d.ts +67 -0
  1015. package/dist/worker-utils/lib/worker-farm/worker-thread.d.ts.map +1 -0
  1016. package/dist/worker-utils/lib/worker-farm/worker-thread.js +175 -0
  1017. package/dist/worker-utils/lib/worker-farm/worker-thread.js.map +1 -0
  1018. package/dist/worker-utils/lib/worker-utils/get-loadable-worker-url.d.ts +14 -0
  1019. package/dist/worker-utils/lib/worker-utils/get-loadable-worker-url.d.ts.map +1 -0
  1020. package/dist/worker-utils/lib/worker-utils/get-loadable-worker-url.js +72 -0
  1021. package/dist/worker-utils/lib/worker-utils/get-loadable-worker-url.js.map +1 -0
  1022. package/dist/worker-utils/lib/worker-utils/get-transfer-list.d.ts +15 -0
  1023. package/dist/worker-utils/lib/worker-utils/get-transfer-list.d.ts.map +1 -0
  1024. package/dist/worker-utils/lib/worker-utils/get-transfer-list.js +86 -0
  1025. package/dist/worker-utils/lib/worker-utils/get-transfer-list.js.map +1 -0
  1026. package/dist/worker-utils/lib/worker-utils/remove-nontransferable-options.d.ts +6 -0
  1027. package/dist/worker-utils/lib/worker-utils/remove-nontransferable-options.d.ts.map +1 -0
  1028. package/dist/worker-utils/lib/worker-utils/remove-nontransferable-options.js +27 -0
  1029. package/dist/worker-utils/lib/worker-utils/remove-nontransferable-options.js.map +1 -0
  1030. package/dist/worker-utils/null-worker-node.js +349 -0
  1031. package/dist/worker-utils/null-worker-node.js.map +7 -0
  1032. package/dist/worker-utils/null-worker.js +327 -0
  1033. package/dist/worker-utils/null-worker.js.map +7 -0
  1034. package/dist/worker-utils/types.d.ts +79 -0
  1035. package/dist/worker-utils/types.d.ts.map +1 -0
  1036. package/dist/worker-utils/types.js +5 -0
  1037. package/dist/worker-utils/types.js.map +1 -0
  1038. package/dist/worker-utils/workers/null-worker.d.ts +2 -0
  1039. package/dist/worker-utils/workers/null-worker.d.ts.map +1 -0
  1040. package/dist/worker-utils/workers/null-worker.js +17 -0
  1041. package/dist/worker-utils/workers/null-worker.js.map +1 -0
  1042. package/dist/workers/null-worker-node.js +1 -1
  1043. package/dist/workers/null-worker-node.js.map +1 -1
  1044. package/dist/workers/null-worker.js +1 -1
  1045. package/dist/workers/null-worker.js.map +1 -1
  1046. package/package.json +101 -11
  1047. package/src/index.ts +10 -10
  1048. package/src/iterators/make-iterator/make-iterator.ts +1 -1
  1049. package/src/iterators/make-iterator/make-stream-iterator.ts +1 -1
  1050. package/src/iterators/make-iterator/make-string-iterator.ts +1 -1
  1051. package/src/lib/api/core-api.ts +1 -1
  1052. package/src/lib/api/create-data-source.ts +2 -2
  1053. package/src/lib/api/encode-table.ts +2 -2
  1054. package/src/lib/api/encode.ts +3 -3
  1055. package/src/lib/api/load-in-batches.ts +2 -2
  1056. package/src/lib/api/load-loader.ts +2 -2
  1057. package/src/lib/api/load.ts +2 -2
  1058. package/src/lib/api/parse-file.ts +3 -3
  1059. package/src/lib/api/parse-in-batches.ts +44 -6
  1060. package/src/lib/api/parse-sync.ts +2 -2
  1061. package/src/lib/api/parse.ts +4 -4
  1062. package/src/lib/api/preload.ts +6 -1
  1063. package/src/lib/api/register-loaders.ts +1 -1
  1064. package/src/lib/api/select-loader.ts +3 -3
  1065. package/src/lib/api/select-source.ts +1 -1
  1066. package/src/lib/common.ts +1 -1
  1067. package/src/lib/fetch/fetch-file.ts +2 -2
  1068. package/src/lib/filesystems/browser-filesystem.ts +2 -2
  1069. package/src/lib/init.ts +1 -1
  1070. package/src/lib/loader-utils/get-data.ts +2 -2
  1071. package/src/lib/loader-utils/get-fetch-function.ts +2 -2
  1072. package/src/lib/loader-utils/loader-context.ts +2 -2
  1073. package/src/lib/loader-utils/loggers.ts +1 -1
  1074. package/src/lib/loader-utils/normalize-loader.ts +2 -2
  1075. package/src/lib/loader-utils/option-defaults.ts +2 -2
  1076. package/src/lib/loader-utils/option-utils.ts +1 -1
  1077. package/src/lib/utils/resource-utils.ts +1 -1
  1078. package/src/lib/utils/response-utils.ts +1 -1
  1079. package/src/loader-utils/format-types.ts +49 -0
  1080. package/src/loader-utils/index.ts +522 -0
  1081. package/src/loader-utils/json-loader.ts +39 -0
  1082. package/src/loader-utils/lib/binary-utils/array-buffer-utils.ts +114 -0
  1083. package/src/loader-utils/lib/binary-utils/binary-chunk-reader.ts +297 -0
  1084. package/src/loader-utils/lib/binary-utils/dataview-copy-utils.ts +121 -0
  1085. package/src/loader-utils/lib/binary-utils/encode-array-buffer-to-base64.ts +17 -0
  1086. package/src/loader-utils/lib/binary-utils/get-first-characters.ts +46 -0
  1087. package/src/loader-utils/lib/binary-utils/hex-transcoder.ts +54 -0
  1088. package/src/loader-utils/lib/binary-utils/memory-conversion-utils.ts +105 -0
  1089. package/src/loader-utils/lib/binary-utils/memory-copy-utils.ts +69 -0
  1090. package/src/loader-utils/lib/crs/crs-reprojection.ts +52 -0
  1091. package/src/loader-utils/lib/env-utils/assert.ts +13 -0
  1092. package/src/loader-utils/lib/env-utils/globals.ts +36 -0
  1093. package/src/loader-utils/lib/file-provider/data-view-file.ts +83 -0
  1094. package/src/loader-utils/lib/file-provider/file-handle-file.ts +114 -0
  1095. package/src/loader-utils/lib/file-provider/file-provider-interface.ts +60 -0
  1096. package/src/loader-utils/lib/file-provider/file-provider.ts +130 -0
  1097. package/src/loader-utils/lib/files/array-buffer-file.ts +46 -0
  1098. package/src/loader-utils/lib/files/blob-file.ts +45 -0
  1099. package/src/loader-utils/lib/files/file.ts +39 -0
  1100. package/src/loader-utils/lib/files/http-file-transport.ts +432 -0
  1101. package/src/loader-utils/lib/files/http-file-types.ts +60 -0
  1102. package/src/loader-utils/lib/files/http-file.ts +267 -0
  1103. package/src/loader-utils/lib/files/node-file-facade.ts +57 -0
  1104. package/src/loader-utils/lib/files/sources.ts +154 -0
  1105. package/src/loader-utils/lib/filesystems/filesystem.ts +40 -0
  1106. package/src/loader-utils/lib/filesystems/node-filesystem-facade.ts +65 -0
  1107. package/src/loader-utils/lib/iterators/async-iteration.ts +136 -0
  1108. package/src/loader-utils/lib/iterators/text-iterators.ts +76 -0
  1109. package/src/loader-utils/lib/javascript-utils/is-type.ts +130 -0
  1110. package/src/loader-utils/lib/laz/LASZIP-LICENSE +202 -0
  1111. package/src/loader-utils/lib/laz/LASZIP-NOTICE +6 -0
  1112. package/src/loader-utils/lib/laz/laz-arithmetic-encoder.ts +446 -0
  1113. package/src/loader-utils/lib/laz/laz-chunk-decoder.ts +5251 -0
  1114. package/src/loader-utils/lib/laz/laz-chunk-encoder.ts +1909 -0
  1115. package/src/loader-utils/lib/log-utils/log.ts +28 -0
  1116. package/src/loader-utils/lib/module-utils/initialize-wasm-module.ts +51 -0
  1117. package/src/loader-utils/lib/module-utils/js-module-utils.ts +44 -0
  1118. package/src/loader-utils/lib/node/buffer.browser.ts +22 -0
  1119. package/src/loader-utils/lib/node/buffer.ts +40 -0
  1120. package/src/loader-utils/lib/node/fs.browser.ts +5 -0
  1121. package/src/loader-utils/lib/node/promisify.ts +72 -0
  1122. package/src/loader-utils/lib/node/stream.browser.ts +5 -0
  1123. package/src/loader-utils/lib/node/stream.ts +12 -0
  1124. package/src/loader-utils/lib/option-utils/merge-options.ts +50 -0
  1125. package/src/loader-utils/lib/parser-utils/parse-json.ts +16 -0
  1126. package/src/loader-utils/lib/path-utils/cached-uri-resolver.ts +69 -0
  1127. package/src/loader-utils/lib/path-utils/file-aliases.ts +49 -0
  1128. package/src/loader-utils/lib/path-utils/get-cwd.ts +12 -0
  1129. package/src/loader-utils/lib/path-utils/path.ts +173 -0
  1130. package/src/loader-utils/lib/request-utils/abort-utils.ts +64 -0
  1131. package/src/loader-utils/lib/request-utils/authentication.ts +134 -0
  1132. package/src/loader-utils/lib/request-utils/parse-content-type.ts +22 -0
  1133. package/src/loader-utils/lib/request-utils/range-request-cache.ts +279 -0
  1134. package/src/loader-utils/lib/request-utils/range-request-scheduler.ts +899 -0
  1135. package/src/loader-utils/lib/request-utils/request-cache.ts +296 -0
  1136. package/src/loader-utils/lib/request-utils/request-credentials.ts +576 -0
  1137. package/src/loader-utils/lib/request-utils/request-scheduler.ts +230 -0
  1138. package/src/loader-utils/lib/scan-utils/columnar-predicate.ts +397 -0
  1139. package/src/loader-utils/lib/scan-utils/experimental-scan-options.ts +46 -0
  1140. package/src/loader-utils/lib/scan-utils/point-cloud-query.ts +176 -0
  1141. package/src/loader-utils/lib/scan-utils/raster-query.ts +82 -0
  1142. package/src/loader-utils/lib/scan-utils/relational-query.ts +188 -0
  1143. package/src/loader-utils/lib/scan-utils/scan-executor.ts +208 -0
  1144. package/src/loader-utils/lib/scan-utils/scan-fragments.ts +33 -0
  1145. package/src/loader-utils/lib/scan-utils/scan-query-metadata.ts +439 -0
  1146. package/src/loader-utils/lib/scan-utils/table-query-explain.ts +88 -0
  1147. package/src/loader-utils/lib/scan-utils/table-query.ts +163 -0
  1148. package/src/loader-utils/lib/scan-utils/table-scan-batch.ts +200 -0
  1149. package/src/loader-utils/lib/sources/catalog-source.ts +42 -0
  1150. package/src/loader-utils/lib/sources/data-source-manager.ts +569 -0
  1151. package/src/loader-utils/lib/sources/data-source.ts +236 -0
  1152. package/src/loader-utils/lib/sources/image-source.ts +66 -0
  1153. package/src/loader-utils/lib/sources/image-tile-source.ts +22 -0
  1154. package/src/loader-utils/lib/sources/raster-coverage.ts +92 -0
  1155. package/src/loader-utils/lib/sources/raster-region.ts +35 -0
  1156. package/src/loader-utils/lib/sources/raster-sampling.ts +213 -0
  1157. package/src/loader-utils/lib/sources/raster-source.ts +344 -0
  1158. package/src/loader-utils/lib/sources/service-capabilities.ts +50 -0
  1159. package/src/loader-utils/lib/sources/tile-grid.ts +162 -0
  1160. package/src/loader-utils/lib/sources/tile-source-adapter.ts +126 -0
  1161. package/src/loader-utils/lib/sources/tile-source-utils.ts +19 -0
  1162. package/src/loader-utils/lib/sources/tile-source.ts +198 -0
  1163. package/src/loader-utils/lib/sources/utils/image-type.ts +14 -0
  1164. package/src/loader-utils/lib/sources/utils/utils.ts +31 -0
  1165. package/src/loader-utils/lib/sources/vector-source.ts +89 -0
  1166. package/src/loader-utils/lib/sources/vector-tile-source.ts +29 -0
  1167. package/src/loader-utils/lib/sources/xyz-grid.ts +82 -0
  1168. package/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts +233 -0
  1169. package/src/loader-utils/lib/worker-loader-utils/encode-with-worker.ts +28 -0
  1170. package/src/loader-utils/lib/worker-loader-utils/parse-with-worker.ts +347 -0
  1171. package/src/loader-utils/loader-types.ts +531 -0
  1172. package/src/loader-utils/source-types.ts +76 -0
  1173. package/src/loader-utils/types.ts +83 -0
  1174. package/src/loader-utils/workers/json-worker.ts +8 -0
  1175. package/src/loader-utils/writer-types.ts +107 -0
  1176. package/src/null-loader.ts +2 -2
  1177. package/src/polyfills/README.md +16 -0
  1178. package/src/polyfills/buffer/btoa.node.ts +15 -0
  1179. package/src/polyfills/buffer/to-array-buffer.node.ts +12 -0
  1180. package/src/polyfills/crypto/node-hash.ts +78 -0
  1181. package/src/polyfills/fetch/decode-data-uri.ts +71 -0
  1182. package/src/polyfills/fetch/fetch-polyfill.ts +165 -0
  1183. package/src/polyfills/fetch/headers-polyfill.ts +119 -0
  1184. package/src/polyfills/fetch/response-polyfill.ts +101 -0
  1185. package/src/polyfills/fetch/utils/decode-data-uri.node.ts +34 -0
  1186. package/src/polyfills/file/blob-stream-controller.ts +69 -0
  1187. package/src/polyfills/file/blob-stream.ts +40 -0
  1188. package/src/polyfills/file/blob.ts +177 -0
  1189. package/src/polyfills/file/file-reader.ts +59 -0
  1190. package/src/polyfills/file/file.ts +45 -0
  1191. package/src/polyfills/file/install-blob-polyfills.ts +17 -0
  1192. package/src/polyfills/file/install-file-polyfills.ts +24 -0
  1193. package/src/polyfills/file/readable-stream.ts +8 -0
  1194. package/src/polyfills/filesystems/fetch-node.ts +98 -0
  1195. package/src/polyfills/filesystems/node-file.ts +169 -0
  1196. package/src/polyfills/filesystems/node-filesystem.ts +54 -0
  1197. package/src/polyfills/filesystems/stream-utils.node.ts +81 -0
  1198. package/src/polyfills/images/encode-image-node.ts +45 -0
  1199. package/src/polyfills/images/encode-image.node.ts.disabled +41 -0
  1200. package/src/polyfills/images/image-codecs-node.ts +40 -0
  1201. package/src/polyfills/images/node-image-bitmap.ts +81 -0
  1202. package/src/polyfills/images/node-image-formats.ts +6 -0
  1203. package/src/polyfills/images/parse-image-node.ts +54 -0
  1204. package/src/polyfills/images/parse-image.node.ts.disabled +55 -0
  1205. package/src/polyfills/index.browser.ts +23 -0
  1206. package/src/polyfills/index.ts +154 -0
  1207. package/src/polyfills/libs/encoding-indexes-asian.js +15 -0
  1208. package/src/polyfills/load-library/require-utils.node.ts +108 -0
  1209. package/src/polyfills/streams/make-node-stream.ts +83 -0
  1210. package/src/polyfills/text-encoder/encoding-indexes.ts +36 -0
  1211. package/src/polyfills/text-encoder/text-encoder.ts +3085 -0
  1212. package/src/polyfills/utils/assert.ts +9 -0
  1213. package/src/polyfills/utils/buffer-utils.ts +40 -0
  1214. package/src/polyfills/utils/filesystem-types.ts +13 -0
  1215. package/src/polyfills/utils/is-browser.ts +8 -0
  1216. package/src/polyfills/utils/path-utils.ts +31 -0
  1217. package/src/polyfills/wip/fetch-browser/fetch-file.browser.d.ts +34 -0
  1218. package/src/schema/categories/category-gis.ts +63 -0
  1219. package/src/schema/categories/category-image.ts +23 -0
  1220. package/src/schema/categories/category-mesh.ts +138 -0
  1221. package/src/schema/categories/category-table.ts +125 -0
  1222. package/src/schema/categories/category-texture.ts +259 -0
  1223. package/src/schema/deprecated/mesh-utils.ts +46 -0
  1224. package/src/schema/float16.ts +111 -0
  1225. package/src/schema/geometry/arrow-binary-features.ts +54 -0
  1226. package/src/schema/geometry/binary-features.ts +43 -0
  1227. package/src/schema/geometry/binary-geometries.ts +45 -0
  1228. package/src/schema/geometry/flat-geometries.ts +72 -0
  1229. package/src/schema/geometry/geoarrow.ts +116 -0
  1230. package/src/schema/geospatial-metadata-zod-schema.ts +163 -0
  1231. package/src/schema/index.ts +169 -0
  1232. package/src/schema/metadata.ts +115 -0
  1233. package/src/schema/types/batch.ts +47 -0
  1234. package/src/schema/types/schema.ts +86 -0
  1235. package/src/schema/types/types.ts +52 -0
  1236. package/src/schema-utils/arrow-transport.ts +7 -0
  1237. package/src/schema-utils/deprecated.ts +53 -0
  1238. package/src/schema-utils/index.ts +165 -0
  1239. package/src/schema-utils/lib/arrow/arrow-table-transport.ts +260 -0
  1240. package/src/schema-utils/lib/arrow/split-arrow-buffers.ts +235 -0
  1241. package/src/schema-utils/lib/arrow-utils/arrow-fixed-size-list-utils.ts +78 -0
  1242. package/src/schema-utils/lib/arrow-utils/arrow-list-of-fixed-size-list-utils.ts +48 -0
  1243. package/src/schema-utils/lib/converters/convert.ts +142 -0
  1244. package/src/schema-utils/lib/converters/converters.ts +6 -0
  1245. package/src/schema-utils/lib/converters/types.ts +44 -0
  1246. package/src/schema-utils/lib/mesh/convert-mesh-to-table.ts +311 -0
  1247. package/src/schema-utils/lib/mesh/convert-table-to-mesh.ts +257 -0
  1248. package/src/schema-utils/lib/mesh/deduce-mesh-schema.ts +85 -0
  1249. package/src/schema-utils/lib/mesh/mesh-utils.ts +73 -0
  1250. package/src/schema-utils/lib/mesh/point-cloud-tiler.ts +485 -0
  1251. package/src/schema-utils/lib/schema/convert-arrow-schema.ts +552 -0
  1252. package/src/schema-utils/lib/schema/data-type.ts +122 -0
  1253. package/src/schema-utils/lib/schema/deduce-table-schema.ts +119 -0
  1254. package/src/schema-utils/lib/table/arrow-api/arrow-like-field.ts +53 -0
  1255. package/src/schema-utils/lib/table/arrow-api/arrow-like-interface.ts +84 -0
  1256. package/src/schema-utils/lib/table/arrow-api/arrow-like-schema.ts +101 -0
  1257. package/src/schema-utils/lib/table/arrow-api/arrow-like-table.ts +85 -0
  1258. package/src/schema-utils/lib/table/arrow-api/arrow-like-type.ts +500 -0
  1259. package/src/schema-utils/lib/table/arrow-api/enum.ts +99 -0
  1260. package/src/schema-utils/lib/table/arrow-api/get-type-info.ts +38 -0
  1261. package/src/schema-utils/lib/table/arrow-api/index.ts +50 -0
  1262. package/src/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator-builders.ts.disabled +190 -0
  1263. package/src/schema-utils/lib/table/batch-builder/arrow-table-batch-aggregator.ts +85 -0
  1264. package/src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts +123 -0
  1265. package/src/schema-utils/lib/table/batch-builder/base-table-batch-aggregator.ts +82 -0
  1266. package/src/schema-utils/lib/table/batch-builder/columnar-table-batch-aggregator.ts +104 -0
  1267. package/src/schema-utils/lib/table/batch-builder/row-table-batch-aggregator.ts +108 -0
  1268. package/src/schema-utils/lib/table/batch-builder/table-batch-aggregator.ts +28 -0
  1269. package/src/schema-utils/lib/table/batch-builder/table-batch-builder.ts +185 -0
  1270. package/src/schema-utils/lib/table/batches/convert-batches.ts +83 -0
  1271. package/src/schema-utils/lib/table/batches/make-arrow-batch-iterator.ts +81 -0
  1272. package/src/schema-utils/lib/table/batches/make-table-batch-iterator.ts +25 -0
  1273. package/src/schema-utils/lib/table/batches/make-table-from-batches.ts +84 -0
  1274. package/src/schema-utils/lib/table/query-arrow-table.ts +130 -0
  1275. package/src/schema-utils/lib/table/tables/convert-arrow-table.ts +198 -0
  1276. package/src/schema-utils/lib/table/tables/convert-table.ts +152 -0
  1277. package/src/schema-utils/lib/table/tables/make-table.ts +127 -0
  1278. package/src/schema-utils/lib/table/tables/row-utils.ts +59 -0
  1279. package/src/schema-utils/lib/table/tables/table-accessors.ts +418 -0
  1280. package/src/schema-utils/lib/table/tables/table-column.ts +49 -0
  1281. package/src/schema-utils/lib/table/tables/table-converter/convert-tables.ts +35 -0
  1282. package/src/schema-utils/lib/table/tables/table-converter/table-converter.ts +57 -0
  1283. package/src/schema-utils/lib/table/tables/table-types.ts +37 -0
  1284. package/src/schema-utils/lib/utils/assert.ts +12 -0
  1285. package/src/schema-utils/lib/utils/async-queue.ts +109 -0
  1286. package/src/schema-utils/types/types.ts +45 -0
  1287. package/src/worker-utils/index.ts +80 -0
  1288. package/src/worker-utils/lib/async-queue/async-queue.ts +100 -0
  1289. package/src/worker-utils/lib/env-utils/assert.ts +14 -0
  1290. package/src/worker-utils/lib/env-utils/globals.ts +40 -0
  1291. package/src/worker-utils/lib/env-utils/version.ts +25 -0
  1292. package/src/worker-utils/lib/library-utils/library-utils.ts +303 -0
  1293. package/src/worker-utils/lib/node/worker_threads-browser.ts +34 -0
  1294. package/src/worker-utils/lib/node/worker_threads.ts +58 -0
  1295. package/src/worker-utils/lib/npm-tag.ts +11 -0
  1296. package/src/worker-utils/lib/process-utils/child-process-proxy.browser.ts +23 -0
  1297. package/src/worker-utils/lib/process-utils/child-process-proxy.ts +165 -0
  1298. package/src/worker-utils/lib/process-utils/process-utils.ts +34 -0
  1299. package/src/worker-utils/lib/worker-api/create-worker.ts +166 -0
  1300. package/src/worker-utils/lib/worker-api/get-worker-url.ts +129 -0
  1301. package/src/worker-utils/lib/worker-api/process-on-worker.ts +413 -0
  1302. package/src/worker-utils/lib/worker-api/validate-worker-version.ts +44 -0
  1303. package/src/worker-utils/lib/worker-farm/worker-body.ts +145 -0
  1304. package/src/worker-utils/lib/worker-farm/worker-farm.ts +144 -0
  1305. package/src/worker-utils/lib/worker-farm/worker-job.ts +83 -0
  1306. package/src/worker-utils/lib/worker-farm/worker-pool.ts +263 -0
  1307. package/src/worker-utils/lib/worker-farm/worker-thread.ts +206 -0
  1308. package/src/worker-utils/lib/worker-utils/get-loadable-worker-url.ts +81 -0
  1309. package/src/worker-utils/lib/worker-utils/get-transfer-list.ts +93 -0
  1310. package/src/worker-utils/lib/worker-utils/remove-nontransferable-options.ts +27 -0
  1311. package/src/worker-utils/types.ts +125 -0
  1312. package/src/worker-utils/workers/null-worker.ts +20 -0
  1313. package/src/workers/null-worker-node.ts +1 -1
  1314. package/src/workers/null-worker.ts +1 -1
@@ -0,0 +1,3085 @@
1
+ // SPDX-License-Identifier: Unlicense
2
+
3
+ // @ts-nocheck
4
+ /* eslint-disable */
5
+
6
+ // Copied from https://github.com/inexorabletash/text-encoding/blob/b4e5bc26e26e51f56e3daa9f13138c79f49d3c34/lib/encoding.js
7
+ // This is free and unencumbered software released into the public domain.
8
+ // See LICENSE.md for more information.
9
+
10
+ import indexes from './encoding-indexes';
11
+ // Note: Aaian character indices add half a megabyte to bundle. Ignore, since we really only want the built-in UTF8...
12
+ // import indexes from './encoding-indexes-asian.js';
13
+ globalThis['encoding-indexes'] = indexes || {};
14
+
15
+ //
16
+ // Utilities
17
+ //
18
+
19
+ /**
20
+ * @param {number} a The number to test.
21
+ * @param {number} min The minimum value in the range, inclusive.
22
+ * @param {number} max The maximum value in the range, inclusive.
23
+ * @return {boolean} True if a >= min and a <= max.
24
+ */
25
+ function inRange(a, min, max) {
26
+ return min <= a && a <= max;
27
+ }
28
+
29
+ /**
30
+ * @param {!Array.<*>} array The array to check.
31
+ * @param {*} item The item to look for in the array.
32
+ * @return {boolean} True if the item appears in the array.
33
+ */
34
+ function includes(array, item) {
35
+ return array.indexOf(item) !== -1;
36
+ }
37
+
38
+ var floor = Math.floor;
39
+
40
+ /**
41
+ * @param {*} o
42
+ * @return {Object}
43
+ */
44
+ function ToDictionary(o) {
45
+ if (o === undefined) return {};
46
+ if (o === Object(o)) return o;
47
+ throw TypeError('Could not convert argument to dictionary');
48
+ }
49
+
50
+ /**
51
+ * @param {string} string Input string of UTF-16 code units.
52
+ * @return {!Array.<number>} Code points.
53
+ */
54
+ function stringToCodePoints(string) {
55
+ // https://heycam.github.io/webidl/#dfn-obtain-unicode
56
+
57
+ // 1. Let S be the DOMString value.
58
+ var s = String(string);
59
+
60
+ // 2. Let n be the length of S.
61
+ var n = s.length;
62
+
63
+ // 3. Initialize i to 0.
64
+ var i = 0;
65
+
66
+ // 4. Initialize U to be an empty sequence of Unicode characters.
67
+ var u = [];
68
+
69
+ // 5. While i < n:
70
+ while (i < n) {
71
+ // 1. Let c be the code unit in S at index i.
72
+ var c = s.charCodeAt(i);
73
+
74
+ // 2. Depending on the value of c:
75
+
76
+ // c < 0xD800 or c > 0xDFFF
77
+ if (c < 0xd800 || c > 0xdfff) {
78
+ // Append to U the Unicode character with code point c.
79
+ u.push(c);
80
+ }
81
+
82
+ // 0xDC00 ≤ c ≤ 0xDFFF
83
+ else if (0xdc00 <= c && c <= 0xdfff) {
84
+ // Append to U a U+FFFD REPLACEMENT CHARACTER.
85
+ u.push(0xfffd);
86
+ }
87
+
88
+ // 0xD800 ≤ c ≤ 0xDBFF
89
+ else if (0xd800 <= c && c <= 0xdbff) {
90
+ // 1. If i = n−1, then append to U a U+FFFD REPLACEMENT
91
+ // CHARACTER.
92
+ if (i === n - 1) {
93
+ u.push(0xfffd);
94
+ }
95
+ // 2. Otherwise, i < n−1:
96
+ else {
97
+ // 1. Let d be the code unit in S at index i+1.
98
+ var d = s.charCodeAt(i + 1);
99
+
100
+ // 2. If 0xDC00 ≤ d ≤ 0xDFFF, then:
101
+ if (0xdc00 <= d && d <= 0xdfff) {
102
+ // 1. Let a be c & 0x3FF.
103
+ var a = c & 0x3ff;
104
+
105
+ // 2. Let b be d & 0x3FF.
106
+ var b = d & 0x3ff;
107
+
108
+ // 3. Append to U the Unicode character with code point
109
+ // 2^16+2^10*a+b.
110
+ u.push(0x10000 + (a << 10) + b);
111
+
112
+ // 4. Set i to i+1.
113
+ i += 1;
114
+ }
115
+
116
+ // 3. Otherwise, d < 0xDC00 or d > 0xDFFF. Append to U a
117
+ // U+FFFD REPLACEMENT CHARACTER.
118
+ else {
119
+ u.push(0xfffd);
120
+ }
121
+ }
122
+ }
123
+
124
+ // 3. Set i to i+1.
125
+ i += 1;
126
+ }
127
+
128
+ // 6. Return U.
129
+ return u;
130
+ }
131
+
132
+ /**
133
+ * @param {!Array.<number>} code_points Array of code points.
134
+ * @return {string} string String of UTF-16 code units.
135
+ */
136
+ function codePointsToString(code_points) {
137
+ var s = '';
138
+ for (var i = 0; i < code_points.length; ++i) {
139
+ var cp = code_points[i];
140
+ if (cp <= 0xffff) {
141
+ s += String.fromCharCode(cp);
142
+ } else {
143
+ cp -= 0x10000;
144
+ s += String.fromCharCode((cp >> 10) + 0xd800, (cp & 0x3ff) + 0xdc00);
145
+ }
146
+ }
147
+ return s;
148
+ }
149
+
150
+ //
151
+ // Implementation of Encoding specification
152
+ // https://encoding.spec.whatwg.org/
153
+ //
154
+
155
+ //
156
+ // 4. Terminology
157
+ //
158
+
159
+ /**
160
+ * An ASCII byte is a byte in the range 0x00 to 0x7F, inclusive.
161
+ * @param {number} a The number to test.
162
+ * @return {boolean} True if a is in the range 0x00 to 0x7F, inclusive.
163
+ */
164
+ function isASCIIByte(a) {
165
+ return 0x00 <= a && a <= 0x7f;
166
+ }
167
+
168
+ /**
169
+ * An ASCII code point is a code point in the range U+0000 to
170
+ * U+007F, inclusive.
171
+ */
172
+ var isASCIICodePoint = isASCIIByte;
173
+
174
+ /**
175
+ * End-of-stream is a special token that signifies no more tokens
176
+ * are in the stream.
177
+ * @const
178
+ */ var end_of_stream = -1;
179
+
180
+ /**
181
+ * A stream represents an ordered sequence of tokens.
182
+ *
183
+ * @constructor
184
+ * @param {!(Array.<number>|Uint8Array)} tokens Array of tokens that provide
185
+ * the stream.
186
+ */
187
+ function Stream(tokens) {
188
+ /** @type {!Array.<number>} */
189
+ this.tokens = [].slice.call(tokens);
190
+ // Reversed as push/pop is more efficient than shift/unshift.
191
+ this.tokens.reverse();
192
+ }
193
+
194
+ Stream.prototype = {
195
+ /**
196
+ * @return {boolean} True if end-of-stream has been hit.
197
+ */
198
+ endOfStream: function () {
199
+ return !this.tokens.length;
200
+ },
201
+
202
+ /**
203
+ * When a token is read from a stream, the first token in the
204
+ * stream must be returned and subsequently removed, and
205
+ * end-of-stream must be returned otherwise.
206
+ *
207
+ * @return {number} Get the next token from the stream, or
208
+ * end_of_stream.
209
+ */
210
+ read: function () {
211
+ if (!this.tokens.length) return end_of_stream;
212
+ return this.tokens.pop();
213
+ },
214
+
215
+ /**
216
+ * When one or more tokens are prepended to a stream, those tokens
217
+ * must be inserted, in given order, before the first token in the
218
+ * stream.
219
+ *
220
+ * @param {(number|!Array.<number>)} token The token(s) to prepend to the
221
+ * stream.
222
+ */
223
+ prepend: function (token) {
224
+ if (Array.isArray(token)) {
225
+ var tokens = /**@type {!Array.<number>}*/ token;
226
+ while (tokens.length) this.tokens.push(tokens.pop());
227
+ } else {
228
+ this.tokens.push(token);
229
+ }
230
+ },
231
+
232
+ /**
233
+ * When one or more tokens are pushed to a stream, those tokens
234
+ * must be inserted, in given order, after the last token in the
235
+ * stream.
236
+ *
237
+ * @param {(number|!Array.<number>)} token The tokens(s) to push to the
238
+ * stream.
239
+ */
240
+ push: function (token) {
241
+ if (Array.isArray(token)) {
242
+ var tokens = /**@type {!Array.<number>}*/ token;
243
+ while (tokens.length) this.tokens.unshift(tokens.shift());
244
+ } else {
245
+ this.tokens.unshift(token);
246
+ }
247
+ }
248
+ };
249
+
250
+ //
251
+ // 5. Encodings
252
+ //
253
+
254
+ // 5.1 Encoders and decoders
255
+
256
+ /** @const */
257
+ var finished = -1;
258
+
259
+ /**
260
+ * @param {boolean} fatal If true, decoding errors raise an exception.
261
+ * @param {number=} opt_code_point Override the standard fallback code point.
262
+ * @return {number} The code point to insert on a decoding error.
263
+ */
264
+ function decoderError(fatal, opt_code_point) {
265
+ if (fatal) throw TypeError('Decoder error');
266
+ return opt_code_point || 0xfffd;
267
+ }
268
+
269
+ /**
270
+ * @param {number} code_point The code point that could not be encoded.
271
+ * @return {number} Always throws, no value is actually returned.
272
+ */
273
+ function encoderError(code_point) {
274
+ throw TypeError('The code point ' + code_point + ' could not be encoded.');
275
+ }
276
+
277
+ /** @interface */
278
+ function Decoder() {}
279
+ Decoder.prototype = {
280
+ /**
281
+ * @param {Stream} stream The stream of bytes being decoded.
282
+ * @param {number} bite The next byte read from the stream.
283
+ * @return {?(number|!Array.<number>)} The next code point(s)
284
+ * decoded, or null if not enough data exists in the input
285
+ * stream to decode a complete code point, or |finished|.
286
+ */
287
+ handler: function (stream, bite) {}
288
+ };
289
+
290
+ /** @interface */
291
+ function Encoder() {}
292
+ Encoder.prototype = {
293
+ /**
294
+ * @param {Stream} stream The stream of code points being encoded.
295
+ * @param {number} code_point Next code point read from the stream.
296
+ * @return {(number|!Array.<number>)} Byte(s) to emit, or |finished|.
297
+ */
298
+ handler: function (stream, code_point) {}
299
+ };
300
+
301
+ // 5.2 Names and labels
302
+
303
+ // TODO: Define @typedef for Encoding: {name:string,labels:Array.<string>}
304
+ // https://github.com/google/closure-compiler/issues/247
305
+
306
+ /**
307
+ * @param {string} label The encoding label.
308
+ * @return {?{name:string,labels:Array.<string>}}
309
+ */
310
+ function getEncoding(label) {
311
+ // 1. Remove any leading and trailing ASCII whitespace from label.
312
+ label = String(label).trim().toLowerCase();
313
+
314
+ // 2. If label is an ASCII case-insensitive match for any of the
315
+ // labels listed in the table below, return the corresponding
316
+ // encoding, and failure otherwise.
317
+ if (Object.prototype.hasOwnProperty.call(label_to_encoding, label)) {
318
+ return label_to_encoding[label];
319
+ }
320
+ return null;
321
+ }
322
+
323
+ /**
324
+ * Encodings table: https://encoding.spec.whatwg.org/encodings.json
325
+ * @const
326
+ * @type {!Array.<{
327
+ * heading: string,
328
+ * encodings: Array.<{name:string,labels:Array.<string>}>
329
+ * }>}
330
+ */
331
+ var encodings = [
332
+ {
333
+ encodings: [
334
+ {
335
+ labels: ['unicode-1-1-utf-8', 'utf-8', 'utf8'],
336
+ name: 'UTF-8'
337
+ }
338
+ ],
339
+ heading: 'The Encoding'
340
+ },
341
+ {
342
+ encodings: [
343
+ {
344
+ labels: ['866', 'cp866', 'csibm866', 'ibm866'],
345
+ name: 'IBM866'
346
+ },
347
+ {
348
+ labels: [
349
+ 'csisolatin2',
350
+ 'iso-8859-2',
351
+ 'iso-ir-101',
352
+ 'iso8859-2',
353
+ 'iso88592',
354
+ 'iso_8859-2',
355
+ 'iso_8859-2:1987',
356
+ 'l2',
357
+ 'latin2'
358
+ ],
359
+ name: 'ISO-8859-2'
360
+ },
361
+ {
362
+ labels: [
363
+ 'csisolatin3',
364
+ 'iso-8859-3',
365
+ 'iso-ir-109',
366
+ 'iso8859-3',
367
+ 'iso88593',
368
+ 'iso_8859-3',
369
+ 'iso_8859-3:1988',
370
+ 'l3',
371
+ 'latin3'
372
+ ],
373
+ name: 'ISO-8859-3'
374
+ },
375
+ {
376
+ labels: [
377
+ 'csisolatin4',
378
+ 'iso-8859-4',
379
+ 'iso-ir-110',
380
+ 'iso8859-4',
381
+ 'iso88594',
382
+ 'iso_8859-4',
383
+ 'iso_8859-4:1988',
384
+ 'l4',
385
+ 'latin4'
386
+ ],
387
+ name: 'ISO-8859-4'
388
+ },
389
+ {
390
+ labels: [
391
+ 'csisolatincyrillic',
392
+ 'cyrillic',
393
+ 'iso-8859-5',
394
+ 'iso-ir-144',
395
+ 'iso8859-5',
396
+ 'iso88595',
397
+ 'iso_8859-5',
398
+ 'iso_8859-5:1988'
399
+ ],
400
+ name: 'ISO-8859-5'
401
+ },
402
+ {
403
+ labels: [
404
+ 'arabic',
405
+ 'asmo-708',
406
+ 'csiso88596e',
407
+ 'csiso88596i',
408
+ 'csisolatinarabic',
409
+ 'ecma-114',
410
+ 'iso-8859-6',
411
+ 'iso-8859-6-e',
412
+ 'iso-8859-6-i',
413
+ 'iso-ir-127',
414
+ 'iso8859-6',
415
+ 'iso88596',
416
+ 'iso_8859-6',
417
+ 'iso_8859-6:1987'
418
+ ],
419
+ name: 'ISO-8859-6'
420
+ },
421
+ {
422
+ labels: [
423
+ 'csisolatingreek',
424
+ 'ecma-118',
425
+ 'elot_928',
426
+ 'greek',
427
+ 'greek8',
428
+ 'iso-8859-7',
429
+ 'iso-ir-126',
430
+ 'iso8859-7',
431
+ 'iso88597',
432
+ 'iso_8859-7',
433
+ 'iso_8859-7:1987',
434
+ 'sun_eu_greek'
435
+ ],
436
+ name: 'ISO-8859-7'
437
+ },
438
+ {
439
+ labels: [
440
+ 'csiso88598e',
441
+ 'csisolatinhebrew',
442
+ 'hebrew',
443
+ 'iso-8859-8',
444
+ 'iso-8859-8-e',
445
+ 'iso-ir-138',
446
+ 'iso8859-8',
447
+ 'iso88598',
448
+ 'iso_8859-8',
449
+ 'iso_8859-8:1988',
450
+ 'visual'
451
+ ],
452
+ name: 'ISO-8859-8'
453
+ },
454
+ {
455
+ labels: ['csiso88598i', 'iso-8859-8-i', 'logical'],
456
+ name: 'ISO-8859-8-I'
457
+ },
458
+ {
459
+ labels: [
460
+ 'csisolatin6',
461
+ 'iso-8859-10',
462
+ 'iso-ir-157',
463
+ 'iso8859-10',
464
+ 'iso885910',
465
+ 'l6',
466
+ 'latin6'
467
+ ],
468
+ name: 'ISO-8859-10'
469
+ },
470
+ {
471
+ labels: ['iso-8859-13', 'iso8859-13', 'iso885913'],
472
+ name: 'ISO-8859-13'
473
+ },
474
+ {
475
+ labels: ['iso-8859-14', 'iso8859-14', 'iso885914'],
476
+ name: 'ISO-8859-14'
477
+ },
478
+ {
479
+ labels: ['csisolatin9', 'iso-8859-15', 'iso8859-15', 'iso885915', 'iso_8859-15', 'l9'],
480
+ name: 'ISO-8859-15'
481
+ },
482
+ {
483
+ labels: ['iso-8859-16'],
484
+ name: 'ISO-8859-16'
485
+ },
486
+ {
487
+ labels: ['cskoi8r', 'koi', 'koi8', 'koi8-r', 'koi8_r'],
488
+ name: 'KOI8-R'
489
+ },
490
+ {
491
+ labels: ['koi8-ru', 'koi8-u'],
492
+ name: 'KOI8-U'
493
+ },
494
+ {
495
+ labels: ['csmacintosh', 'mac', 'macintosh', 'x-mac-roman'],
496
+ name: 'macintosh'
497
+ },
498
+ {
499
+ labels: ['dos-874', 'iso-8859-11', 'iso8859-11', 'iso885911', 'tis-620', 'windows-874'],
500
+ name: 'windows-874'
501
+ },
502
+ {
503
+ labels: ['cp1250', 'windows-1250', 'x-cp1250'],
504
+ name: 'windows-1250'
505
+ },
506
+ {
507
+ labels: ['cp1251', 'windows-1251', 'x-cp1251'],
508
+ name: 'windows-1251'
509
+ },
510
+ {
511
+ labels: [
512
+ 'ansi_x3.4-1968',
513
+ 'ascii',
514
+ 'cp1252',
515
+ 'cp819',
516
+ 'csisolatin1',
517
+ 'ibm819',
518
+ 'iso-8859-1',
519
+ 'iso-ir-100',
520
+ 'iso8859-1',
521
+ 'iso88591',
522
+ 'iso_8859-1',
523
+ 'iso_8859-1:1987',
524
+ 'l1',
525
+ 'latin1',
526
+ 'us-ascii',
527
+ 'windows-1252',
528
+ 'x-cp1252'
529
+ ],
530
+ name: 'windows-1252'
531
+ },
532
+ {
533
+ labels: ['cp1253', 'windows-1253', 'x-cp1253'],
534
+ name: 'windows-1253'
535
+ },
536
+ {
537
+ labels: [
538
+ 'cp1254',
539
+ 'csisolatin5',
540
+ 'iso-8859-9',
541
+ 'iso-ir-148',
542
+ 'iso8859-9',
543
+ 'iso88599',
544
+ 'iso_8859-9',
545
+ 'iso_8859-9:1989',
546
+ 'l5',
547
+ 'latin5',
548
+ 'windows-1254',
549
+ 'x-cp1254'
550
+ ],
551
+ name: 'windows-1254'
552
+ },
553
+ {
554
+ labels: ['cp1255', 'windows-1255', 'x-cp1255'],
555
+ name: 'windows-1255'
556
+ },
557
+ {
558
+ labels: ['cp1256', 'windows-1256', 'x-cp1256'],
559
+ name: 'windows-1256'
560
+ },
561
+ {
562
+ labels: ['cp1257', 'windows-1257', 'x-cp1257'],
563
+ name: 'windows-1257'
564
+ },
565
+ {
566
+ labels: ['cp1258', 'windows-1258', 'x-cp1258'],
567
+ name: 'windows-1258'
568
+ },
569
+ {
570
+ labels: ['x-mac-cyrillic', 'x-mac-ukrainian'],
571
+ name: 'x-mac-cyrillic'
572
+ }
573
+ ],
574
+ heading: 'Legacy single-byte encodings'
575
+ },
576
+ {
577
+ encodings: [
578
+ {
579
+ labels: [
580
+ 'chinese',
581
+ 'csgb2312',
582
+ 'csiso58gb231280',
583
+ 'gb2312',
584
+ 'gb_2312',
585
+ 'gb_2312-80',
586
+ 'gbk',
587
+ 'iso-ir-58',
588
+ 'x-gbk'
589
+ ],
590
+ name: 'GBK'
591
+ },
592
+ {
593
+ labels: ['gb18030'],
594
+ name: 'gb18030'
595
+ }
596
+ ],
597
+ heading: 'Legacy multi-byte Chinese (simplified) encodings'
598
+ },
599
+ {
600
+ encodings: [
601
+ {
602
+ labels: ['big5', 'big5-hkscs', 'cn-big5', 'csbig5', 'x-x-big5'],
603
+ name: 'Big5'
604
+ }
605
+ ],
606
+ heading: 'Legacy multi-byte Chinese (traditional) encodings'
607
+ },
608
+ {
609
+ encodings: [
610
+ {
611
+ labels: ['cseucpkdfmtjapanese', 'euc-jp', 'x-euc-jp'],
612
+ name: 'EUC-JP'
613
+ },
614
+ {
615
+ labels: ['csiso2022jp', 'iso-2022-jp'],
616
+ name: 'ISO-2022-JP'
617
+ },
618
+ {
619
+ labels: [
620
+ 'csshiftjis',
621
+ 'ms932',
622
+ 'ms_kanji',
623
+ 'shift-jis',
624
+ 'shift_jis',
625
+ 'sjis',
626
+ 'windows-31j',
627
+ 'x-sjis'
628
+ ],
629
+ name: 'Shift_JIS'
630
+ }
631
+ ],
632
+ heading: 'Legacy multi-byte Japanese encodings'
633
+ },
634
+ {
635
+ encodings: [
636
+ {
637
+ labels: [
638
+ 'cseuckr',
639
+ 'csksc56011987',
640
+ 'euc-kr',
641
+ 'iso-ir-149',
642
+ 'korean',
643
+ 'ks_c_5601-1987',
644
+ 'ks_c_5601-1989',
645
+ 'ksc5601',
646
+ 'ksc_5601',
647
+ 'windows-949'
648
+ ],
649
+ name: 'EUC-KR'
650
+ }
651
+ ],
652
+ heading: 'Legacy multi-byte Korean encodings'
653
+ },
654
+ {
655
+ encodings: [
656
+ {
657
+ labels: ['csiso2022kr', 'hz-gb-2312', 'iso-2022-cn', 'iso-2022-cn-ext', 'iso-2022-kr'],
658
+ name: 'replacement'
659
+ },
660
+ {
661
+ labels: ['utf-16be'],
662
+ name: 'UTF-16BE'
663
+ },
664
+ {
665
+ labels: ['utf-16', 'utf-16le'],
666
+ name: 'UTF-16LE'
667
+ },
668
+ {
669
+ labels: ['x-user-defined'],
670
+ name: 'x-user-defined'
671
+ }
672
+ ],
673
+ heading: 'Legacy miscellaneous encodings'
674
+ }
675
+ ];
676
+
677
+ // Label to encoding registry.
678
+ /** @type {Object.<string,{name:string,labels:Array.<string>}>} */
679
+ var label_to_encoding = {};
680
+ encodings.forEach(function (category) {
681
+ category.encodings.forEach(function (encoding) {
682
+ encoding.labels.forEach(function (label) {
683
+ label_to_encoding[label] = encoding;
684
+ });
685
+ });
686
+ });
687
+
688
+ // Registry of of encoder/decoder factories, by encoding name.
689
+ /** @type {Object.<string, function({fatal:boolean}): Encoder>} */
690
+ var encoders = {};
691
+ /** @type {Object.<string, function({fatal:boolean}): Decoder>} */
692
+ var decoders = {};
693
+
694
+ //
695
+ // 6. Indexes
696
+ //
697
+
698
+ /**
699
+ * @param {number} pointer The |pointer| to search for.
700
+ * @param {(!Array.<?number>|undefined)} index The |index| to search within.
701
+ * @return {?number} The code point corresponding to |pointer| in |index|,
702
+ * or null if |code point| is not in |index|.
703
+ */
704
+ function indexCodePointFor(pointer, index) {
705
+ if (!index) return null;
706
+ return index[pointer] || null;
707
+ }
708
+
709
+ /**
710
+ * @param {number} code_point The |code point| to search for.
711
+ * @param {!Array.<?number>} index The |index| to search within.
712
+ * @return {?number} The first pointer corresponding to |code point| in
713
+ * |index|, or null if |code point| is not in |index|.
714
+ */
715
+ function indexPointerFor(code_point, index) {
716
+ var pointer = index.indexOf(code_point);
717
+ return pointer === -1 ? null : pointer;
718
+ }
719
+
720
+ /**
721
+ * @param {string} name Name of the index.
722
+ * @return {(!Array.<number>|!Array.<Array.<number>>)}
723
+ * */
724
+ function index(name) {
725
+ if (!('encoding-indexes' in globalThis)) {
726
+ throw Error('Indexes missing.' + ' Did you forget to include encoding-indexes.js first?');
727
+ }
728
+ return globalThis['encoding-indexes'][name];
729
+ }
730
+
731
+ /**
732
+ * @param {number} pointer The |pointer| to search for in the gb18030 index.
733
+ * @return {?number} The code point corresponding to |pointer| in |index|,
734
+ * or null if |code point| is not in the gb18030 index.
735
+ */
736
+ function indexGB18030RangesCodePointFor(pointer) {
737
+ // 1. If pointer is greater than 39419 and less than 189000, or
738
+ // pointer is greater than 1237575, return null.
739
+ if ((pointer > 39419 && pointer < 189000) || pointer > 1237575) return null;
740
+
741
+ // 2. If pointer is 7457, return code point U+E7C7.
742
+ if (pointer === 7457) return 0xe7c7;
743
+
744
+ // 3. Let offset be the last pointer in index gb18030 ranges that
745
+ // is equal to or less than pointer and let code point offset be
746
+ // its corresponding code point.
747
+ var offset = 0;
748
+ var code_point_offset = 0;
749
+ var idx = index('gb18030-ranges');
750
+ var i;
751
+ for (i = 0; i < idx.length; ++i) {
752
+ /** @type {!Array.<number>} */
753
+ var entry = idx[i];
754
+ if (entry[0] <= pointer) {
755
+ offset = entry[0];
756
+ code_point_offset = entry[1];
757
+ } else {
758
+ break;
759
+ }
760
+ }
761
+
762
+ // 4. Return a code point whose value is code point offset +
763
+ // pointer − offset.
764
+ return code_point_offset + pointer - offset;
765
+ }
766
+
767
+ /**
768
+ * @param {number} code_point The |code point| to locate in the gb18030 index.
769
+ * @return {number} The first pointer corresponding to |code point| in the
770
+ * gb18030 index.
771
+ */
772
+ function indexGB18030RangesPointerFor(code_point) {
773
+ // 1. If code point is U+E7C7, return pointer 7457.
774
+ if (code_point === 0xe7c7) return 7457;
775
+
776
+ // 2. Let offset be the last code point in index gb18030 ranges
777
+ // that is equal to or less than code point and let pointer offset
778
+ // be its corresponding pointer.
779
+ var offset = 0;
780
+ var pointer_offset = 0;
781
+ var idx = index('gb18030-ranges');
782
+ var i;
783
+ for (i = 0; i < idx.length; ++i) {
784
+ /** @type {!Array.<number>} */
785
+ var entry = idx[i];
786
+ if (entry[1] <= code_point) {
787
+ offset = entry[1];
788
+ pointer_offset = entry[0];
789
+ } else {
790
+ break;
791
+ }
792
+ }
793
+
794
+ // 3. Return a pointer whose value is pointer offset + code point
795
+ // − offset.
796
+ return pointer_offset + code_point - offset;
797
+ }
798
+
799
+ /**
800
+ * @param {number} code_point The |code_point| to search for in the Shift_JIS
801
+ * index.
802
+ * @return {?number} The code point corresponding to |pointer| in |index|,
803
+ * or null if |code point| is not in the Shift_JIS index.
804
+ */
805
+ function indexShiftJISPointerFor(code_point) {
806
+ // 1. Let index be index jis0208 excluding all entries whose
807
+ // pointer is in the range 8272 to 8835, inclusive.
808
+ shift_jis_index =
809
+ shift_jis_index ||
810
+ index('jis0208').map(function (code_point, pointer) {
811
+ return inRange(pointer, 8272, 8835) ? null : code_point;
812
+ });
813
+ var index_ = shift_jis_index;
814
+
815
+ // 2. Return the index pointer for code point in index.
816
+ return index_.indexOf(code_point);
817
+ }
818
+ var shift_jis_index;
819
+
820
+ /**
821
+ * @param {number} code_point The |code_point| to search for in the big5
822
+ * index.
823
+ * @return {?number} The code point corresponding to |pointer| in |index|,
824
+ * or null if |code point| is not in the big5 index.
825
+ */
826
+ function indexBig5PointerFor(code_point) {
827
+ // 1. Let index be index Big5 excluding all entries whose pointer
828
+ big5_index_no_hkscs =
829
+ big5_index_no_hkscs ||
830
+ index('big5').map(function (code_point, pointer) {
831
+ return pointer < (0xa1 - 0x81) * 157 ? null : code_point;
832
+ });
833
+ var index_ = big5_index_no_hkscs;
834
+
835
+ // 2. If code point is U+2550, U+255E, U+2561, U+256A, U+5341, or
836
+ // U+5345, return the last pointer corresponding to code point in
837
+ // index.
838
+ if (
839
+ code_point === 0x2550 ||
840
+ code_point === 0x255e ||
841
+ code_point === 0x2561 ||
842
+ code_point === 0x256a ||
843
+ code_point === 0x5341 ||
844
+ code_point === 0x5345
845
+ ) {
846
+ return index_.lastIndexOf(code_point);
847
+ }
848
+
849
+ // 3. Return the index pointer for code point in index.
850
+ return indexPointerFor(code_point, index_);
851
+ }
852
+ var big5_index_no_hkscs;
853
+
854
+ //
855
+ // 8. API
856
+ //
857
+
858
+ /** @const */ var DEFAULT_ENCODING = 'utf-8';
859
+
860
+ // 8.1 Interface TextDecoder
861
+
862
+ /**
863
+ * @constructor
864
+ * @param {string=} label The label of the encoding;
865
+ * defaults to 'utf-8'.
866
+ * @param {Object=} options
867
+ */
868
+ function TextDecoder(label, options) {
869
+ // Web IDL conventions
870
+ if (!(this instanceof TextDecoder))
871
+ throw TypeError("Called as a function. Did you forget 'new'?");
872
+ label = label !== undefined ? String(label) : DEFAULT_ENCODING;
873
+ options = ToDictionary(options);
874
+
875
+ // A TextDecoder object has an associated encoding, decoder,
876
+ // stream, ignore BOM flag (initially unset), BOM seen flag
877
+ // (initially unset), error mode (initially replacement), and do
878
+ // not flush flag (initially unset).
879
+
880
+ /** @private */
881
+ this._encoding = null;
882
+ /** @private @type {?Decoder} */
883
+ this._decoder = null;
884
+ /** @private @type {boolean} */
885
+ this._ignoreBOM = false;
886
+ /** @private @type {boolean} */
887
+ this._BOMseen = false;
888
+ /** @private @type {string} */
889
+ this._error_mode = 'replacement';
890
+ /** @private @type {boolean} */
891
+ this._do_not_flush = false;
892
+
893
+ // 1. Let encoding be the result of getting an encoding from
894
+ // label.
895
+ var encoding = getEncoding(label);
896
+
897
+ // 2. If encoding is failure or replacement, throw a RangeError.
898
+ if (encoding === null || encoding.name === 'replacement')
899
+ throw RangeError('Unknown encoding: ' + label);
900
+ if (!decoders[encoding.name]) {
901
+ throw Error('Decoder not present.' + ' Did you forget to include encoding-indexes.js first?');
902
+ }
903
+
904
+ // 3. Let dec be a new TextDecoder object.
905
+ var dec = this;
906
+
907
+ // 4. Set dec's encoding to encoding.
908
+ dec._encoding = encoding;
909
+
910
+ // 5. If options's fatal member is true, set dec's error mode to
911
+ // fatal.
912
+ if (Boolean(options['fatal'])) dec._error_mode = 'fatal';
913
+
914
+ // 6. If options's ignoreBOM member is true, set dec's ignore BOM
915
+ // flag.
916
+ if (Boolean(options['ignoreBOM'])) dec._ignoreBOM = true;
917
+
918
+ // For pre-ES5 runtimes:
919
+ if (!Object.defineProperty) {
920
+ this.encoding = dec._encoding.name.toLowerCase();
921
+ this.fatal = dec._error_mode === 'fatal';
922
+ this.ignoreBOM = dec._ignoreBOM;
923
+ }
924
+
925
+ // 7. Return dec.
926
+ return dec;
927
+ }
928
+
929
+ if (Object.defineProperty) {
930
+ // The encoding attribute's getter must return encoding's name.
931
+ Object.defineProperty(TextDecoder.prototype, 'encoding', {
932
+ /** @this {TextDecoder} */
933
+ get: function () {
934
+ return this._encoding.name.toLowerCase();
935
+ }
936
+ });
937
+
938
+ // The fatal attribute's getter must return true if error mode
939
+ // is fatal, and false otherwise.
940
+ Object.defineProperty(TextDecoder.prototype, 'fatal', {
941
+ /** @this {TextDecoder} */
942
+ get: function () {
943
+ return this._error_mode === 'fatal';
944
+ }
945
+ });
946
+
947
+ // The ignoreBOM attribute's getter must return true if ignore
948
+ // BOM flag is set, and false otherwise.
949
+ Object.defineProperty(TextDecoder.prototype, 'ignoreBOM', {
950
+ /** @this {TextDecoder} */
951
+ get: function () {
952
+ return this._ignoreBOM;
953
+ }
954
+ });
955
+ }
956
+
957
+ /**
958
+ * @param {BufferSource=} input The buffer of bytes to decode.
959
+ * @param {Object=} options
960
+ * @return {string} The decoded string.
961
+ */
962
+ TextDecoder.prototype.decode = function decode(input, options) {
963
+ var bytes;
964
+ if (typeof input === 'object' && input instanceof ArrayBuffer) {
965
+ bytes = new Uint8Array(input);
966
+ } else if (
967
+ typeof input === 'object' &&
968
+ 'buffer' in input &&
969
+ input.buffer instanceof ArrayBuffer
970
+ ) {
971
+ bytes = new Uint8Array(input.buffer, input.byteOffset, input.byteLength);
972
+ } else {
973
+ bytes = new Uint8Array(0);
974
+ }
975
+
976
+ options = ToDictionary(options);
977
+
978
+ // 1. If the do not flush flag is unset, set decoder to a new
979
+ // encoding's decoder, set stream to a new stream, and unset the
980
+ // BOM seen flag.
981
+ if (!this._do_not_flush) {
982
+ this._decoder = decoders[this._encoding.name]({
983
+ fatal: this._error_mode === 'fatal'
984
+ });
985
+ this._BOMseen = false;
986
+ }
987
+
988
+ // 2. If options's stream is true, set the do not flush flag, and
989
+ // unset the do not flush flag otherwise.
990
+ this._do_not_flush = Boolean(options['stream']);
991
+
992
+ // 3. If input is given, push a copy of input to stream.
993
+ // TODO: Align with spec algorithm - maintain stream on instance.
994
+ var input_stream = new Stream(bytes);
995
+
996
+ // 4. Let output be a new stream.
997
+ var output = [];
998
+
999
+ /** @type {?(number|!Array.<number>)} */
1000
+ var result;
1001
+
1002
+ // 5. While true:
1003
+ while (true) {
1004
+ // 1. Let token be the result of reading from stream.
1005
+ var token = input_stream.read();
1006
+
1007
+ // 2. If token is end-of-stream and the do not flush flag is
1008
+ // set, return output, serialized.
1009
+ // TODO: Align with spec algorithm.
1010
+ if (token === end_of_stream) break;
1011
+
1012
+ // 3. Otherwise, run these subsubsteps:
1013
+
1014
+ // 1. Let result be the result of processing token for decoder,
1015
+ // stream, output, and error mode.
1016
+ result = this._decoder.handler(input_stream, token);
1017
+
1018
+ // 2. If result is finished, return output, serialized.
1019
+ if (result === finished) break;
1020
+
1021
+ if (result !== null) {
1022
+ if (Array.isArray(result)) output.push.apply(output, /**@type {!Array.<number>}*/ result);
1023
+ else output.push(result);
1024
+ }
1025
+
1026
+ // 3. Otherwise, if result is error, throw a TypeError.
1027
+ // (Thrown in handler)
1028
+
1029
+ // 4. Otherwise, do nothing.
1030
+ }
1031
+ // TODO: Align with spec algorithm.
1032
+ if (!this._do_not_flush) {
1033
+ do {
1034
+ result = this._decoder.handler(input_stream, input_stream.read());
1035
+ if (result === finished) break;
1036
+ if (result === null) continue;
1037
+ if (Array.isArray(result)) output.push.apply(output, /**@type {!Array.<number>}*/ result);
1038
+ else output.push(result);
1039
+ } while (!input_stream.endOfStream());
1040
+ this._decoder = null;
1041
+ }
1042
+
1043
+ // A TextDecoder object also has an associated serialize stream
1044
+ // algorithm...
1045
+ /**
1046
+ * @param {!Array.<number>} stream
1047
+ * @return {string}
1048
+ * @this {TextDecoder}
1049
+ */
1050
+ function serializeStream(stream) {
1051
+ // 1. Let token be the result of reading from stream.
1052
+ // (Done in-place on array, rather than as a stream)
1053
+
1054
+ // 2. If encoding is UTF-8, UTF-16BE, or UTF-16LE, and ignore
1055
+ // BOM flag and BOM seen flag are unset, run these subsubsteps:
1056
+ if (
1057
+ includes(['UTF-8', 'UTF-16LE', 'UTF-16BE'], this._encoding.name) &&
1058
+ !this._ignoreBOM &&
1059
+ !this._BOMseen
1060
+ ) {
1061
+ if (stream.length > 0 && stream[0] === 0xfeff) {
1062
+ // 1. If token is U+FEFF, set BOM seen flag.
1063
+ this._BOMseen = true;
1064
+ stream.shift();
1065
+ } else if (stream.length > 0) {
1066
+ // 2. Otherwise, if token is not end-of-stream, set BOM seen
1067
+ // flag and append token to stream.
1068
+ this._BOMseen = true;
1069
+ } else {
1070
+ // 3. Otherwise, if token is not end-of-stream, append token
1071
+ // to output.
1072
+ // (no-op)
1073
+ }
1074
+ }
1075
+ // 4. Otherwise, return output.
1076
+ return codePointsToString(stream);
1077
+ }
1078
+
1079
+ return serializeStream.call(this, output);
1080
+ };
1081
+
1082
+ // 8.2 Interface TextEncoder
1083
+
1084
+ /**
1085
+ * @constructor
1086
+ * @param {string=} label The label of the encoding. NONSTANDARD.
1087
+ * @param {Object=} options NONSTANDARD.
1088
+ */
1089
+ function TextEncoder(label, options) {
1090
+ // Web IDL conventions
1091
+ if (!(this instanceof TextEncoder))
1092
+ throw TypeError("Called as a function. Did you forget 'new'?");
1093
+ options = ToDictionary(options);
1094
+
1095
+ // A TextEncoder object has an associated encoding and encoder.
1096
+
1097
+ /** @private */
1098
+ this._encoding = null;
1099
+ /** @private @type {?Encoder} */
1100
+ this._encoder = null;
1101
+
1102
+ // Non-standard
1103
+ /** @private @type {boolean} */
1104
+ this._do_not_flush = false;
1105
+ /** @private @type {string} */
1106
+ this._fatal = Boolean(options['fatal']) ? 'fatal' : 'replacement';
1107
+
1108
+ // 1. Let enc be a new TextEncoder object.
1109
+ var enc = this;
1110
+
1111
+ // 2. Set enc's encoding to UTF-8's encoder.
1112
+ if (Boolean(options['NONSTANDARD_allowLegacyEncoding'])) {
1113
+ // NONSTANDARD behavior.
1114
+ label = label !== undefined ? String(label) : DEFAULT_ENCODING;
1115
+ var encoding = getEncoding(label);
1116
+ if (encoding === null || encoding.name === 'replacement')
1117
+ throw RangeError('Unknown encoding: ' + label);
1118
+ if (!encoders[encoding.name]) {
1119
+ throw Error('Encoder not present.' + ' Did you forget to include encoding-indexes.js first?');
1120
+ }
1121
+ enc._encoding = encoding;
1122
+ } else {
1123
+ // Standard behavior.
1124
+ enc._encoding = getEncoding('utf-8');
1125
+
1126
+ if (label !== undefined && 'console' in globalThis) {
1127
+ }
1128
+ }
1129
+
1130
+ // For pre-ES5 runtimes:
1131
+ if (!Object.defineProperty) this.encoding = enc._encoding.name.toLowerCase();
1132
+
1133
+ // 3. Return enc.
1134
+ return enc;
1135
+ }
1136
+
1137
+ if (Object.defineProperty) {
1138
+ // The encoding attribute's getter must return encoding's name.
1139
+ Object.defineProperty(TextEncoder.prototype, 'encoding', {
1140
+ /** @this {TextEncoder} */
1141
+ get: function () {
1142
+ return this._encoding.name.toLowerCase();
1143
+ }
1144
+ });
1145
+ }
1146
+
1147
+ /**
1148
+ * @param {string=} opt_string The string to encode.
1149
+ * @param {Object=} options
1150
+ * @return {!Uint8Array} Encoded bytes, as a Uint8Array.
1151
+ */
1152
+ TextEncoder.prototype.encode = function encode(opt_string, options) {
1153
+ opt_string = opt_string === undefined ? '' : String(opt_string);
1154
+ options = ToDictionary(options);
1155
+
1156
+ // NOTE: This option is nonstandard. None of the encodings
1157
+ // permitted for encoding (i.e. UTF-8, UTF-16) are stateful when
1158
+ // the input is a USVString so streaming is not necessary.
1159
+ if (!this._do_not_flush)
1160
+ this._encoder = encoders[this._encoding.name]({
1161
+ fatal: this._fatal === 'fatal'
1162
+ });
1163
+ this._do_not_flush = Boolean(options['stream']);
1164
+
1165
+ // 1. Convert input to a stream.
1166
+ var input = new Stream(stringToCodePoints(opt_string));
1167
+
1168
+ // 2. Let output be a new stream
1169
+ var output = [];
1170
+
1171
+ /** @type {?(number|!Array.<number>)} */
1172
+ var result;
1173
+ // 3. While true, run these substeps:
1174
+ while (true) {
1175
+ // 1. Let token be the result of reading from input.
1176
+ var token = input.read();
1177
+ if (token === end_of_stream) break;
1178
+ // 2. Let result be the result of processing token for encoder,
1179
+ // input, output.
1180
+ result = this._encoder.handler(input, token);
1181
+ if (result === finished) break;
1182
+ if (Array.isArray(result)) output.push.apply(output, /**@type {!Array.<number>}*/ result);
1183
+ else output.push(result);
1184
+ }
1185
+ // TODO: Align with spec algorithm.
1186
+ if (!this._do_not_flush) {
1187
+ while (true) {
1188
+ result = this._encoder.handler(input, input.read());
1189
+ if (result === finished) break;
1190
+ if (Array.isArray(result)) output.push.apply(output, /**@type {!Array.<number>}*/ result);
1191
+ else output.push(result);
1192
+ }
1193
+ this._encoder = null;
1194
+ }
1195
+ // 3. If result is finished, convert output into a byte sequence,
1196
+ // and then return a Uint8Array object wrapping an ArrayBuffer
1197
+ // containing output.
1198
+ return new Uint8Array(output);
1199
+ };
1200
+
1201
+ //
1202
+ // 9. The encoding
1203
+ //
1204
+
1205
+ // 9.1 utf-8
1206
+
1207
+ // 9.1.1 utf-8 decoder
1208
+ /**
1209
+ * @constructor
1210
+ * @implements {Decoder}
1211
+ * @param {{fatal: boolean}} options
1212
+ */
1213
+ function UTF8Decoder(options) {
1214
+ var fatal = options.fatal;
1215
+
1216
+ // utf-8's decoder's has an associated utf-8 code point, utf-8
1217
+ // bytes seen, and utf-8 bytes needed (all initially 0), a utf-8
1218
+ // lower boundary (initially 0x80), and a utf-8 upper boundary
1219
+ // (initially 0xBF).
1220
+ var /** @type {number} */ utf8_code_point = 0,
1221
+ /** @type {number} */ utf8_bytes_seen = 0,
1222
+ /** @type {number} */ utf8_bytes_needed = 0,
1223
+ /** @type {number} */ utf8_lower_boundary = 0x80,
1224
+ /** @type {number} */ utf8_upper_boundary = 0xbf;
1225
+
1226
+ /**
1227
+ * @param {Stream} stream The stream of bytes being decoded.
1228
+ * @param {number} bite The next byte read from the stream.
1229
+ * @return {?(number|!Array.<number>)} The next code point(s)
1230
+ * decoded, or null if not enough data exists in the input
1231
+ * stream to decode a complete code point.
1232
+ */
1233
+ this.handler = function (stream, bite) {
1234
+ // 1. If byte is end-of-stream and utf-8 bytes needed is not 0,
1235
+ // set utf-8 bytes needed to 0 and return error.
1236
+ if (bite === end_of_stream && utf8_bytes_needed !== 0) {
1237
+ utf8_bytes_needed = 0;
1238
+ return decoderError(fatal);
1239
+ }
1240
+
1241
+ // 2. If byte is end-of-stream, return finished.
1242
+ if (bite === end_of_stream) return finished;
1243
+
1244
+ // 3. If utf-8 bytes needed is 0, based on byte:
1245
+ if (utf8_bytes_needed === 0) {
1246
+ // 0x00 to 0x7F
1247
+ if (inRange(bite, 0x00, 0x7f)) {
1248
+ // Return a code point whose value is byte.
1249
+ return bite;
1250
+ }
1251
+
1252
+ // 0xC2 to 0xDF
1253
+ else if (inRange(bite, 0xc2, 0xdf)) {
1254
+ // 1. Set utf-8 bytes needed to 1.
1255
+ utf8_bytes_needed = 1;
1256
+
1257
+ // 2. Set UTF-8 code point to byte & 0x1F.
1258
+ utf8_code_point = bite & 0x1f;
1259
+ }
1260
+
1261
+ // 0xE0 to 0xEF
1262
+ else if (inRange(bite, 0xe0, 0xef)) {
1263
+ // 1. If byte is 0xE0, set utf-8 lower boundary to 0xA0.
1264
+ if (bite === 0xe0) utf8_lower_boundary = 0xa0;
1265
+ // 2. If byte is 0xED, set utf-8 upper boundary to 0x9F.
1266
+ if (bite === 0xed) utf8_upper_boundary = 0x9f;
1267
+ // 3. Set utf-8 bytes needed to 2.
1268
+ utf8_bytes_needed = 2;
1269
+ // 4. Set UTF-8 code point to byte & 0xF.
1270
+ utf8_code_point = bite & 0xf;
1271
+ }
1272
+
1273
+ // 0xF0 to 0xF4
1274
+ else if (inRange(bite, 0xf0, 0xf4)) {
1275
+ // 1. If byte is 0xF0, set utf-8 lower boundary to 0x90.
1276
+ if (bite === 0xf0) utf8_lower_boundary = 0x90;
1277
+ // 2. If byte is 0xF4, set utf-8 upper boundary to 0x8F.
1278
+ if (bite === 0xf4) utf8_upper_boundary = 0x8f;
1279
+ // 3. Set utf-8 bytes needed to 3.
1280
+ utf8_bytes_needed = 3;
1281
+ // 4. Set UTF-8 code point to byte & 0x7.
1282
+ utf8_code_point = bite & 0x7;
1283
+ }
1284
+
1285
+ // Otherwise
1286
+ else {
1287
+ // Return error.
1288
+ return decoderError(fatal);
1289
+ }
1290
+
1291
+ // Return continue.
1292
+ return null;
1293
+ }
1294
+
1295
+ // 4. If byte is not in the range utf-8 lower boundary to utf-8
1296
+ // upper boundary, inclusive, run these substeps:
1297
+ if (!inRange(bite, utf8_lower_boundary, utf8_upper_boundary)) {
1298
+ // 1. Set utf-8 code point, utf-8 bytes needed, and utf-8
1299
+ // bytes seen to 0, set utf-8 lower boundary to 0x80, and set
1300
+ // utf-8 upper boundary to 0xBF.
1301
+ utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;
1302
+ utf8_lower_boundary = 0x80;
1303
+ utf8_upper_boundary = 0xbf;
1304
+
1305
+ // 2. Prepend byte to stream.
1306
+ stream.prepend(bite);
1307
+
1308
+ // 3. Return error.
1309
+ return decoderError(fatal);
1310
+ }
1311
+
1312
+ // 5. Set utf-8 lower boundary to 0x80 and utf-8 upper boundary
1313
+ // to 0xBF.
1314
+ utf8_lower_boundary = 0x80;
1315
+ utf8_upper_boundary = 0xbf;
1316
+
1317
+ // 6. Set UTF-8 code point to (UTF-8 code point << 6) | (byte &
1318
+ // 0x3F)
1319
+ utf8_code_point = (utf8_code_point << 6) | (bite & 0x3f);
1320
+
1321
+ // 7. Increase utf-8 bytes seen by one.
1322
+ utf8_bytes_seen += 1;
1323
+
1324
+ // 8. If utf-8 bytes seen is not equal to utf-8 bytes needed,
1325
+ // continue.
1326
+ if (utf8_bytes_seen !== utf8_bytes_needed) return null;
1327
+
1328
+ // 9. Let code point be utf-8 code point.
1329
+ var code_point = utf8_code_point;
1330
+
1331
+ // 10. Set utf-8 code point, utf-8 bytes needed, and utf-8 bytes
1332
+ // seen to 0.
1333
+ utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;
1334
+
1335
+ // 11. Return a code point whose value is code point.
1336
+ return code_point;
1337
+ };
1338
+ }
1339
+
1340
+ // 9.1.2 utf-8 encoder
1341
+ /**
1342
+ * @constructor
1343
+ * @implements {Encoder}
1344
+ * @param {{fatal: boolean}} options
1345
+ */
1346
+ function UTF8Encoder(options) {
1347
+ var _fatal = options.fatal;
1348
+ /**
1349
+ * @param {Stream} stream Input stream.
1350
+ * @param {number} code_point Next code point read from the stream.
1351
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
1352
+ */
1353
+ this.handler = function (stream, code_point) {
1354
+ // 1. If code point is end-of-stream, return finished.
1355
+ if (code_point === end_of_stream) return finished;
1356
+
1357
+ // 2. If code point is an ASCII code point, return a byte whose
1358
+ // value is code point.
1359
+ if (isASCIICodePoint(code_point)) return code_point;
1360
+
1361
+ // 3. Set count and offset based on the range code point is in:
1362
+ var count, offset;
1363
+ // U+0080 to U+07FF, inclusive:
1364
+ if (inRange(code_point, 0x0080, 0x07ff)) {
1365
+ // 1 and 0xC0
1366
+ count = 1;
1367
+ offset = 0xc0;
1368
+ }
1369
+ // U+0800 to U+FFFF, inclusive:
1370
+ else if (inRange(code_point, 0x0800, 0xffff)) {
1371
+ // 2 and 0xE0
1372
+ count = 2;
1373
+ offset = 0xe0;
1374
+ }
1375
+ // U+10000 to U+10FFFF, inclusive:
1376
+ else if (inRange(code_point, 0x10000, 0x10ffff)) {
1377
+ // 3 and 0xF0
1378
+ count = 3;
1379
+ offset = 0xf0;
1380
+ }
1381
+
1382
+ // 4. Let bytes be a byte sequence whose first byte is (code
1383
+ // point >> (6 × count)) + offset.
1384
+ var bytes = [(code_point >> (6 * count)) + offset];
1385
+
1386
+ // 5. Run these substeps while count is greater than 0:
1387
+ while (count > 0) {
1388
+ // 1. Set temp to code point >> (6 × (count − 1)).
1389
+ var temp = code_point >> (6 * (count - 1));
1390
+
1391
+ // 2. Append to bytes 0x80 | (temp & 0x3F).
1392
+ bytes.push(0x80 | (temp & 0x3f));
1393
+
1394
+ // 3. Decrease count by one.
1395
+ count -= 1;
1396
+ }
1397
+
1398
+ // 6. Return bytes bytes, in order.
1399
+ return bytes;
1400
+ };
1401
+ }
1402
+
1403
+ /** @param {{fatal: boolean}} options */
1404
+ encoders['UTF-8'] = function (options) {
1405
+ return new UTF8Encoder(options);
1406
+ };
1407
+ /** @param {{fatal: boolean}} options */
1408
+ decoders['UTF-8'] = function (options) {
1409
+ return new UTF8Decoder(options);
1410
+ };
1411
+
1412
+ //
1413
+ // 10. Legacy single-byte encodings
1414
+ //
1415
+
1416
+ // 10.1 single-byte decoder
1417
+ /**
1418
+ * @constructor
1419
+ * @implements {Decoder}
1420
+ * @param {!Array.<number>} index The encoding index.
1421
+ * @param {{fatal: boolean}} options
1422
+ */
1423
+ function SingleByteDecoder(index, options) {
1424
+ var fatal = options.fatal;
1425
+ /**
1426
+ * @param {Stream} stream The stream of bytes being decoded.
1427
+ * @param {number} bite The next byte read from the stream.
1428
+ * @return {?(number|!Array.<number>)} The next code point(s)
1429
+ * decoded, or null if not enough data exists in the input
1430
+ * stream to decode a complete code point.
1431
+ */
1432
+ this.handler = function (stream, bite) {
1433
+ // 1. If byte is end-of-stream, return finished.
1434
+ if (bite === end_of_stream) return finished;
1435
+
1436
+ // 2. If byte is an ASCII byte, return a code point whose value
1437
+ // is byte.
1438
+ if (isASCIIByte(bite)) return bite;
1439
+
1440
+ // 3. Let code point be the index code point for byte − 0x80 in
1441
+ // index single-byte.
1442
+ var code_point = index[bite - 0x80];
1443
+
1444
+ // 4. If code point is null, return error.
1445
+ if (code_point === null) return decoderError(fatal);
1446
+
1447
+ // 5. Return a code point whose value is code point.
1448
+ return code_point;
1449
+ };
1450
+ }
1451
+
1452
+ // 10.2 single-byte encoder
1453
+ /**
1454
+ * @constructor
1455
+ * @implements {Encoder}
1456
+ * @param {!Array.<?number>} index The encoding index.
1457
+ * @param {{fatal: boolean}} options
1458
+ */
1459
+ function SingleByteEncoder(index, options) {
1460
+ var _fatal = options.fatal;
1461
+ /**
1462
+ * @param {Stream} stream Input stream.
1463
+ * @param {number} code_point Next code point read from the stream.
1464
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
1465
+ */
1466
+ this.handler = function (stream, code_point) {
1467
+ // 1. If code point is end-of-stream, return finished.
1468
+ if (code_point === end_of_stream) return finished;
1469
+
1470
+ // 2. If code point is an ASCII code point, return a byte whose
1471
+ // value is code point.
1472
+ if (isASCIICodePoint(code_point)) return code_point;
1473
+
1474
+ // 3. Let pointer be the index pointer for code point in index
1475
+ // single-byte.
1476
+ var pointer = indexPointerFor(code_point, index);
1477
+
1478
+ // 4. If pointer is null, return error with code point.
1479
+ if (pointer === null) encoderError(code_point);
1480
+
1481
+ // 5. Return a byte whose value is pointer + 0x80.
1482
+ return pointer + 0x80;
1483
+ };
1484
+ }
1485
+
1486
+ (function () {
1487
+ if (!('encoding-indexes' in globalThis)) return;
1488
+ encodings.forEach(function (category) {
1489
+ if (category.heading !== 'Legacy single-byte encodings') return;
1490
+ category.encodings.forEach(function (encoding) {
1491
+ var name = encoding.name;
1492
+ var idx = index(name.toLowerCase());
1493
+ /** @param {{fatal: boolean}} options */
1494
+ decoders[name] = function (options) {
1495
+ return new SingleByteDecoder(idx, options);
1496
+ };
1497
+ /** @param {{fatal: boolean}} options */
1498
+ encoders[name] = function (options) {
1499
+ return new SingleByteEncoder(idx, options);
1500
+ };
1501
+ });
1502
+ });
1503
+ })();
1504
+
1505
+ //
1506
+ // 11. Legacy multi-byte Chinese (simplified) encodings
1507
+ //
1508
+
1509
+ // 11.1 gbk
1510
+
1511
+ // 11.1.1 gbk decoder
1512
+ // gbk's decoder is gb18030's decoder.
1513
+ /** @param {{fatal: boolean}} options */
1514
+ decoders['GBK'] = function (options) {
1515
+ return new GB18030Decoder(options);
1516
+ };
1517
+
1518
+ // 11.1.2 gbk encoder
1519
+ // gbk's encoder is gb18030's encoder with its gbk flag set.
1520
+ /** @param {{fatal: boolean}} options */
1521
+ encoders['GBK'] = function (options) {
1522
+ return new GB18030Encoder(options, true);
1523
+ };
1524
+
1525
+ // 11.2 gb18030
1526
+
1527
+ // 11.2.1 gb18030 decoder
1528
+ /**
1529
+ * @constructor
1530
+ * @implements {Decoder}
1531
+ * @param {{fatal: boolean}} options
1532
+ */
1533
+ function GB18030Decoder(options) {
1534
+ var fatal = options.fatal;
1535
+ // gb18030's decoder has an associated gb18030 first, gb18030
1536
+ // second, and gb18030 third (all initially 0x00).
1537
+ var /** @type {number} */ gb18030_first = 0x00,
1538
+ /** @type {number} */ gb18030_second = 0x00,
1539
+ /** @type {number} */ gb18030_third = 0x00;
1540
+ /**
1541
+ * @param {Stream} stream The stream of bytes being decoded.
1542
+ * @param {number} bite The next byte read from the stream.
1543
+ * @return {?(number|!Array.<number>)} The next code point(s)
1544
+ * decoded, or null if not enough data exists in the input
1545
+ * stream to decode a complete code point.
1546
+ */
1547
+ this.handler = function (stream, bite) {
1548
+ // 1. If byte is end-of-stream and gb18030 first, gb18030
1549
+ // second, and gb18030 third are 0x00, return finished.
1550
+ if (
1551
+ bite === end_of_stream &&
1552
+ gb18030_first === 0x00 &&
1553
+ gb18030_second === 0x00 &&
1554
+ gb18030_third === 0x00
1555
+ ) {
1556
+ return finished;
1557
+ }
1558
+ // 2. If byte is end-of-stream, and gb18030 first, gb18030
1559
+ // second, or gb18030 third is not 0x00, set gb18030 first,
1560
+ // gb18030 second, and gb18030 third to 0x00, and return error.
1561
+ if (
1562
+ bite === end_of_stream &&
1563
+ (gb18030_first !== 0x00 || gb18030_second !== 0x00 || gb18030_third !== 0x00)
1564
+ ) {
1565
+ gb18030_first = 0x00;
1566
+ gb18030_second = 0x00;
1567
+ gb18030_third = 0x00;
1568
+ decoderError(fatal);
1569
+ }
1570
+ var code_point;
1571
+ // 3. If gb18030 third is not 0x00, run these substeps:
1572
+ if (gb18030_third !== 0x00) {
1573
+ // 1. Let code point be null.
1574
+ code_point = null;
1575
+ // 2. If byte is in the range 0x30 to 0x39, inclusive, set
1576
+ // code point to the index gb18030 ranges code point for
1577
+ // (((gb18030 first − 0x81) × 10 + gb18030 second − 0x30) ×
1578
+ // 126 + gb18030 third − 0x81) × 10 + byte − 0x30.
1579
+ if (inRange(bite, 0x30, 0x39)) {
1580
+ code_point = indexGB18030RangesCodePointFor(
1581
+ (((gb18030_first - 0x81) * 10 + gb18030_second - 0x30) * 126 + gb18030_third - 0x81) *
1582
+ 10 +
1583
+ bite -
1584
+ 0x30
1585
+ );
1586
+ }
1587
+
1588
+ // 3. Let buffer be a byte sequence consisting of gb18030
1589
+ // second, gb18030 third, and byte, in order.
1590
+ var buffer = [gb18030_second, gb18030_third, bite];
1591
+
1592
+ // 4. Set gb18030 first, gb18030 second, and gb18030 third to
1593
+ // 0x00.
1594
+ gb18030_first = 0x00;
1595
+ gb18030_second = 0x00;
1596
+ gb18030_third = 0x00;
1597
+
1598
+ // 5. If code point is null, prepend buffer to stream and
1599
+ // return error.
1600
+ if (code_point === null) {
1601
+ stream.prepend(buffer);
1602
+ return decoderError(fatal);
1603
+ }
1604
+
1605
+ // 6. Return a code point whose value is code point.
1606
+ return code_point;
1607
+ }
1608
+
1609
+ // 4. If gb18030 second is not 0x00, run these substeps:
1610
+ if (gb18030_second !== 0x00) {
1611
+ // 1. If byte is in the range 0x81 to 0xFE, inclusive, set
1612
+ // gb18030 third to byte and return continue.
1613
+ if (inRange(bite, 0x81, 0xfe)) {
1614
+ gb18030_third = bite;
1615
+ return null;
1616
+ }
1617
+
1618
+ // 2. Prepend gb18030 second followed by byte to stream, set
1619
+ // gb18030 first and gb18030 second to 0x00, and return error.
1620
+ stream.prepend([gb18030_second, bite]);
1621
+ gb18030_first = 0x00;
1622
+ gb18030_second = 0x00;
1623
+ return decoderError(fatal);
1624
+ }
1625
+
1626
+ // 5. If gb18030 first is not 0x00, run these substeps:
1627
+ if (gb18030_first !== 0x00) {
1628
+ // 1. If byte is in the range 0x30 to 0x39, inclusive, set
1629
+ // gb18030 second to byte and return continue.
1630
+ if (inRange(bite, 0x30, 0x39)) {
1631
+ gb18030_second = bite;
1632
+ return null;
1633
+ }
1634
+
1635
+ // 2. Let lead be gb18030 first, let pointer be null, and set
1636
+ // gb18030 first to 0x00.
1637
+ var lead = gb18030_first;
1638
+ var pointer = null;
1639
+ gb18030_first = 0x00;
1640
+
1641
+ // 3. Let offset be 0x40 if byte is less than 0x7F and 0x41
1642
+ // otherwise.
1643
+ var offset = bite < 0x7f ? 0x40 : 0x41;
1644
+
1645
+ // 4. If byte is in the range 0x40 to 0x7E, inclusive, or 0x80
1646
+ // to 0xFE, inclusive, set pointer to (lead − 0x81) × 190 +
1647
+ // (byte − offset).
1648
+ if (inRange(bite, 0x40, 0x7e) || inRange(bite, 0x80, 0xfe))
1649
+ pointer = (lead - 0x81) * 190 + (bite - offset);
1650
+
1651
+ // 5. Let code point be null if pointer is null and the index
1652
+ // code point for pointer in index gb18030 otherwise.
1653
+ code_point = pointer === null ? null : indexCodePointFor(pointer, index('gb18030'));
1654
+
1655
+ // 6. If code point is null and byte is an ASCII byte, prepend
1656
+ // byte to stream.
1657
+ if (code_point === null && isASCIIByte(bite)) stream.prepend(bite);
1658
+
1659
+ // 7. If code point is null, return error.
1660
+ if (code_point === null) return decoderError(fatal);
1661
+
1662
+ // 8. Return a code point whose value is code point.
1663
+ return code_point;
1664
+ }
1665
+
1666
+ // 6. If byte is an ASCII byte, return a code point whose value
1667
+ // is byte.
1668
+ if (isASCIIByte(bite)) return bite;
1669
+
1670
+ // 7. If byte is 0x80, return code point U+20AC.
1671
+ if (bite === 0x80) return 0x20ac;
1672
+
1673
+ // 8. If byte is in the range 0x81 to 0xFE, inclusive, set
1674
+ // gb18030 first to byte and return continue.
1675
+ if (inRange(bite, 0x81, 0xfe)) {
1676
+ gb18030_first = bite;
1677
+ return null;
1678
+ }
1679
+
1680
+ // 9. Return error.
1681
+ return decoderError(fatal);
1682
+ };
1683
+ }
1684
+
1685
+ // 11.2.2 gb18030 encoder
1686
+ /**
1687
+ * @constructor
1688
+ * @implements {Encoder}
1689
+ * @param {{fatal: boolean}} options
1690
+ * @param {boolean=} gbk_flag
1691
+ */
1692
+ function GB18030Encoder(options, gbk_flag) {
1693
+ var _fatal = options.fatal;
1694
+ // gb18030's decoder has an associated gbk flag (initially unset).
1695
+ /**
1696
+ * @param {Stream} stream Input stream.
1697
+ * @param {number} code_point Next code point read from the stream.
1698
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
1699
+ */
1700
+ this.handler = function (stream, code_point) {
1701
+ // 1. If code point is end-of-stream, return finished.
1702
+ if (code_point === end_of_stream) return finished;
1703
+
1704
+ // 2. If code point is an ASCII code point, return a byte whose
1705
+ // value is code point.
1706
+ if (isASCIICodePoint(code_point)) return code_point;
1707
+
1708
+ // 3. If code point is U+E5E5, return error with code point.
1709
+ if (code_point === 0xe5e5) return encoderError(code_point);
1710
+
1711
+ // 4. If the gbk flag is set and code point is U+20AC, return
1712
+ // byte 0x80.
1713
+ if (gbk_flag && code_point === 0x20ac) return 0x80;
1714
+
1715
+ // 5. Let pointer be the index pointer for code point in index
1716
+ // gb18030.
1717
+ var pointer = indexPointerFor(code_point, index('gb18030'));
1718
+
1719
+ // 6. If pointer is not null, run these substeps:
1720
+ if (pointer !== null) {
1721
+ // 1. Let lead be floor(pointer / 190) + 0x81.
1722
+ var lead = floor(pointer / 190) + 0x81;
1723
+
1724
+ // 2. Let trail be pointer % 190.
1725
+ var trail = pointer % 190;
1726
+
1727
+ // 3. Let offset be 0x40 if trail is less than 0x3F and 0x41 otherwise.
1728
+ var offset = trail < 0x3f ? 0x40 : 0x41;
1729
+
1730
+ // 4. Return two bytes whose values are lead and trail + offset.
1731
+ return [lead, trail + offset];
1732
+ }
1733
+
1734
+ // 7. If gbk flag is set, return error with code point.
1735
+ if (gbk_flag) return encoderError(code_point);
1736
+
1737
+ // 8. Set pointer to the index gb18030 ranges pointer for code
1738
+ // point.
1739
+ pointer = indexGB18030RangesPointerFor(code_point);
1740
+
1741
+ // 9. Let byte1 be floor(pointer / 10 / 126 / 10).
1742
+ var byte1 = floor(pointer / 10 / 126 / 10);
1743
+
1744
+ // 10. Set pointer to pointer − byte1 × 10 × 126 × 10.
1745
+ pointer = pointer - byte1 * 10 * 126 * 10;
1746
+
1747
+ // 11. Let byte2 be floor(pointer / 10 / 126).
1748
+ var byte2 = floor(pointer / 10 / 126);
1749
+
1750
+ // 12. Set pointer to pointer − byte2 × 10 × 126.
1751
+ pointer = pointer - byte2 * 10 * 126;
1752
+
1753
+ // 13. Let byte3 be floor(pointer / 10).
1754
+ var byte3 = floor(pointer / 10);
1755
+
1756
+ // 14. Let byte4 be pointer − byte3 × 10.
1757
+ var byte4 = pointer - byte3 * 10;
1758
+
1759
+ // 15. Return four bytes whose values are byte1 + 0x81, byte2 +
1760
+ // 0x30, byte3 + 0x81, byte4 + 0x30.
1761
+ return [byte1 + 0x81, byte2 + 0x30, byte3 + 0x81, byte4 + 0x30];
1762
+ };
1763
+ }
1764
+
1765
+ /** @param {{fatal: boolean}} options */
1766
+ encoders['gb18030'] = function (options) {
1767
+ return new GB18030Encoder(options);
1768
+ };
1769
+ /** @param {{fatal: boolean}} options */
1770
+ decoders['gb18030'] = function (options) {
1771
+ return new GB18030Decoder(options);
1772
+ };
1773
+
1774
+ //
1775
+ // 12. Legacy multi-byte Chinese (traditional) encodings
1776
+ //
1777
+
1778
+ // 12.1 Big5
1779
+
1780
+ // 12.1.1 Big5 decoder
1781
+ /**
1782
+ * @constructor
1783
+ * @implements {Decoder}
1784
+ * @param {{fatal: boolean}} options
1785
+ */
1786
+ function Big5Decoder(options) {
1787
+ var fatal = options.fatal;
1788
+ // Big5's decoder has an associated Big5 lead (initially 0x00).
1789
+ var /** @type {number} */ Big5_lead = 0x00;
1790
+
1791
+ /**
1792
+ * @param {Stream} stream The stream of bytes being decoded.
1793
+ * @param {number} bite The next byte read from the stream.
1794
+ * @return {?(number|!Array.<number>)} The next code point(s)
1795
+ * decoded, or null if not enough data exists in the input
1796
+ * stream to decode a complete code point.
1797
+ */
1798
+ this.handler = function (stream, bite) {
1799
+ // 1. If byte is end-of-stream and Big5 lead is not 0x00, set
1800
+ // Big5 lead to 0x00 and return error.
1801
+ if (bite === end_of_stream && Big5_lead !== 0x00) {
1802
+ Big5_lead = 0x00;
1803
+ return decoderError(fatal);
1804
+ }
1805
+
1806
+ // 2. If byte is end-of-stream and Big5 lead is 0x00, return
1807
+ // finished.
1808
+ if (bite === end_of_stream && Big5_lead === 0x00) return finished;
1809
+
1810
+ // 3. If Big5 lead is not 0x00, let lead be Big5 lead, let
1811
+ // pointer be null, set Big5 lead to 0x00, and then run these
1812
+ // substeps:
1813
+ if (Big5_lead !== 0x00) {
1814
+ var lead = Big5_lead;
1815
+ var pointer = null;
1816
+ Big5_lead = 0x00;
1817
+
1818
+ // 1. Let offset be 0x40 if byte is less than 0x7F and 0x62
1819
+ // otherwise.
1820
+ var offset = bite < 0x7f ? 0x40 : 0x62;
1821
+
1822
+ // 2. If byte is in the range 0x40 to 0x7E, inclusive, or 0xA1
1823
+ // to 0xFE, inclusive, set pointer to (lead − 0x81) × 157 +
1824
+ // (byte − offset).
1825
+ if (inRange(bite, 0x40, 0x7e) || inRange(bite, 0xa1, 0xfe))
1826
+ pointer = (lead - 0x81) * 157 + (bite - offset);
1827
+
1828
+ // 3. If there is a row in the table below whose first column
1829
+ // is pointer, return the two code points listed in its second
1830
+ // column
1831
+ // Pointer | Code points
1832
+ // --------+--------------
1833
+ // 1133 | U+00CA U+0304
1834
+ // 1135 | U+00CA U+030C
1835
+ // 1164 | U+00EA U+0304
1836
+ // 1166 | U+00EA U+030C
1837
+ switch (pointer) {
1838
+ case 1133:
1839
+ return [0x00ca, 0x0304];
1840
+ case 1135:
1841
+ return [0x00ca, 0x030c];
1842
+ case 1164:
1843
+ return [0x00ea, 0x0304];
1844
+ case 1166:
1845
+ return [0x00ea, 0x030c];
1846
+ }
1847
+
1848
+ // 4. Let code point be null if pointer is null and the index
1849
+ // code point for pointer in index Big5 otherwise.
1850
+ var code_point = pointer === null ? null : indexCodePointFor(pointer, index('big5'));
1851
+
1852
+ // 5. If code point is null and byte is an ASCII byte, prepend
1853
+ // byte to stream.
1854
+ if (code_point === null && isASCIIByte(bite)) stream.prepend(bite);
1855
+
1856
+ // 6. If code point is null, return error.
1857
+ if (code_point === null) return decoderError(fatal);
1858
+
1859
+ // 7. Return a code point whose value is code point.
1860
+ return code_point;
1861
+ }
1862
+
1863
+ // 4. If byte is an ASCII byte, return a code point whose value
1864
+ // is byte.
1865
+ if (isASCIIByte(bite)) return bite;
1866
+
1867
+ // 5. If byte is in the range 0x81 to 0xFE, inclusive, set Big5
1868
+ // lead to byte and return continue.
1869
+ if (inRange(bite, 0x81, 0xfe)) {
1870
+ Big5_lead = bite;
1871
+ return null;
1872
+ }
1873
+
1874
+ // 6. Return error.
1875
+ return decoderError(fatal);
1876
+ };
1877
+ }
1878
+
1879
+ // 12.1.2 Big5 encoder
1880
+ /**
1881
+ * @constructor
1882
+ * @implements {Encoder}
1883
+ * @param {{fatal: boolean}} options
1884
+ */
1885
+ function Big5Encoder(options) {
1886
+ var _fatal = options.fatal;
1887
+ /**
1888
+ * @param {Stream} stream Input stream.
1889
+ * @param {number} code_point Next code point read from the stream.
1890
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
1891
+ */
1892
+ this.handler = function (stream, code_point) {
1893
+ // 1. If code point is end-of-stream, return finished.
1894
+ if (code_point === end_of_stream) return finished;
1895
+
1896
+ // 2. If code point is an ASCII code point, return a byte whose
1897
+ // value is code point.
1898
+ if (isASCIICodePoint(code_point)) return code_point;
1899
+
1900
+ // 3. Let pointer be the index Big5 pointer for code point.
1901
+ var pointer = indexBig5PointerFor(code_point);
1902
+
1903
+ // 4. If pointer is null, return error with code point.
1904
+ if (pointer === null) return encoderError(code_point);
1905
+
1906
+ // 5. Let lead be floor(pointer / 157) + 0x81.
1907
+ var lead = floor(pointer / 157) + 0x81;
1908
+
1909
+ // 6. If lead is less than 0xA1, return error with code point.
1910
+ if (lead < 0xa1) return encoderError(code_point);
1911
+
1912
+ // 7. Let trail be pointer % 157.
1913
+ var trail = pointer % 157;
1914
+
1915
+ // 8. Let offset be 0x40 if trail is less than 0x3F and 0x62
1916
+ // otherwise.
1917
+ var offset = trail < 0x3f ? 0x40 : 0x62;
1918
+
1919
+ // Return two bytes whose values are lead and trail + offset.
1920
+ return [lead, trail + offset];
1921
+ };
1922
+ }
1923
+
1924
+ /** @param {{fatal: boolean}} options */
1925
+ encoders['Big5'] = function (options) {
1926
+ return new Big5Encoder(options);
1927
+ };
1928
+ /** @param {{fatal: boolean}} options */
1929
+ decoders['Big5'] = function (options) {
1930
+ return new Big5Decoder(options);
1931
+ };
1932
+
1933
+ //
1934
+ // 13. Legacy multi-byte Japanese encodings
1935
+ //
1936
+
1937
+ // 13.1 euc-jp
1938
+
1939
+ // 13.1.1 euc-jp decoder
1940
+ /**
1941
+ * @constructor
1942
+ * @implements {Decoder}
1943
+ * @param {{fatal: boolean}} options
1944
+ */
1945
+ function EUCJPDecoder(options) {
1946
+ var fatal = options.fatal;
1947
+
1948
+ // euc-jp's decoder has an associated euc-jp jis0212 flag
1949
+ // (initially unset) and euc-jp lead (initially 0x00).
1950
+ var /** @type {boolean} */ eucjp_jis0212_flag = false,
1951
+ /** @type {number} */ eucjp_lead = 0x00;
1952
+
1953
+ /**
1954
+ * @param {Stream} stream The stream of bytes being decoded.
1955
+ * @param {number} bite The next byte read from the stream.
1956
+ * @return {?(number|!Array.<number>)} The next code point(s)
1957
+ * decoded, or null if not enough data exists in the input
1958
+ * stream to decode a complete code point.
1959
+ */
1960
+ this.handler = function (stream, bite) {
1961
+ // 1. If byte is end-of-stream and euc-jp lead is not 0x00, set
1962
+ // euc-jp lead to 0x00, and return error.
1963
+ if (bite === end_of_stream && eucjp_lead !== 0x00) {
1964
+ eucjp_lead = 0x00;
1965
+ return decoderError(fatal);
1966
+ }
1967
+
1968
+ // 2. If byte is end-of-stream and euc-jp lead is 0x00, return
1969
+ // finished.
1970
+ if (bite === end_of_stream && eucjp_lead === 0x00) return finished;
1971
+
1972
+ // 3. If euc-jp lead is 0x8E and byte is in the range 0xA1 to
1973
+ // 0xDF, inclusive, set euc-jp lead to 0x00 and return a code
1974
+ // point whose value is 0xFF61 − 0xA1 + byte.
1975
+ if (eucjp_lead === 0x8e && inRange(bite, 0xa1, 0xdf)) {
1976
+ eucjp_lead = 0x00;
1977
+ return 0xff61 - 0xa1 + bite;
1978
+ }
1979
+
1980
+ // 4. If euc-jp lead is 0x8F and byte is in the range 0xA1 to
1981
+ // 0xFE, inclusive, set the euc-jp jis0212 flag, set euc-jp lead
1982
+ // to byte, and return continue.
1983
+ if (eucjp_lead === 0x8f && inRange(bite, 0xa1, 0xfe)) {
1984
+ eucjp_jis0212_flag = true;
1985
+ eucjp_lead = bite;
1986
+ return null;
1987
+ }
1988
+
1989
+ // 5. If euc-jp lead is not 0x00, let lead be euc-jp lead, set
1990
+ // euc-jp lead to 0x00, and run these substeps:
1991
+ if (eucjp_lead !== 0x00) {
1992
+ var lead = eucjp_lead;
1993
+ eucjp_lead = 0x00;
1994
+
1995
+ // 1. Let code point be null.
1996
+ var code_point = null;
1997
+
1998
+ // 2. If lead and byte are both in the range 0xA1 to 0xFE,
1999
+ // inclusive, set code point to the index code point for (lead
2000
+ // − 0xA1) × 94 + byte − 0xA1 in index jis0208 if the euc-jp
2001
+ // jis0212 flag is unset and in index jis0212 otherwise.
2002
+ if (inRange(lead, 0xa1, 0xfe) && inRange(bite, 0xa1, 0xfe)) {
2003
+ code_point = indexCodePointFor(
2004
+ (lead - 0xa1) * 94 + (bite - 0xa1),
2005
+ index(!eucjp_jis0212_flag ? 'jis0208' : 'jis0212')
2006
+ );
2007
+ }
2008
+
2009
+ // 3. Unset the euc-jp jis0212 flag.
2010
+ eucjp_jis0212_flag = false;
2011
+
2012
+ // 4. If byte is not in the range 0xA1 to 0xFE, inclusive,
2013
+ // prepend byte to stream.
2014
+ if (!inRange(bite, 0xa1, 0xfe)) stream.prepend(bite);
2015
+
2016
+ // 5. If code point is null, return error.
2017
+ if (code_point === null) return decoderError(fatal);
2018
+
2019
+ // 6. Return a code point whose value is code point.
2020
+ return code_point;
2021
+ }
2022
+
2023
+ // 6. If byte is an ASCII byte, return a code point whose value
2024
+ // is byte.
2025
+ if (isASCIIByte(bite)) return bite;
2026
+
2027
+ // 7. If byte is 0x8E, 0x8F, or in the range 0xA1 to 0xFE,
2028
+ // inclusive, set euc-jp lead to byte and return continue.
2029
+ if (bite === 0x8e || bite === 0x8f || inRange(bite, 0xa1, 0xfe)) {
2030
+ eucjp_lead = bite;
2031
+ return null;
2032
+ }
2033
+
2034
+ // 8. Return error.
2035
+ return decoderError(fatal);
2036
+ };
2037
+ }
2038
+
2039
+ // 13.1.2 euc-jp encoder
2040
+ /**
2041
+ * @constructor
2042
+ * @implements {Encoder}
2043
+ * @param {{fatal: boolean}} options
2044
+ */
2045
+ function EUCJPEncoder(options) {
2046
+ var _fatal = options.fatal;
2047
+ /**
2048
+ * @param {Stream} stream Input stream.
2049
+ * @param {number} code_point Next code point read from the stream.
2050
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
2051
+ */
2052
+ this.handler = function (stream, code_point) {
2053
+ // 1. If code point is end-of-stream, return finished.
2054
+ if (code_point === end_of_stream) return finished;
2055
+
2056
+ // 2. If code point is an ASCII code point, return a byte whose
2057
+ // value is code point.
2058
+ if (isASCIICodePoint(code_point)) return code_point;
2059
+
2060
+ // 3. If code point is U+00A5, return byte 0x5C.
2061
+ if (code_point === 0x00a5) return 0x5c;
2062
+
2063
+ // 4. If code point is U+203E, return byte 0x7E.
2064
+ if (code_point === 0x203e) return 0x7e;
2065
+
2066
+ // 5. If code point is in the range U+FF61 to U+FF9F, inclusive,
2067
+ // return two bytes whose values are 0x8E and code point −
2068
+ // 0xFF61 + 0xA1.
2069
+ if (inRange(code_point, 0xff61, 0xff9f)) return [0x8e, code_point - 0xff61 + 0xa1];
2070
+
2071
+ // 6. If code point is U+2212, set it to U+FF0D.
2072
+ if (code_point === 0x2212) code_point = 0xff0d;
2073
+
2074
+ // 7. Let pointer be the index pointer for code point in index
2075
+ // jis0208.
2076
+ var pointer = indexPointerFor(code_point, index('jis0208'));
2077
+
2078
+ // 8. If pointer is null, return error with code point.
2079
+ if (pointer === null) return encoderError(code_point);
2080
+
2081
+ // 9. Let lead be floor(pointer / 94) + 0xA1.
2082
+ var lead = floor(pointer / 94) + 0xa1;
2083
+
2084
+ // 10. Let trail be pointer % 94 + 0xA1.
2085
+ var trail = (pointer % 94) + 0xa1;
2086
+
2087
+ // 11. Return two bytes whose values are lead and trail.
2088
+ return [lead, trail];
2089
+ };
2090
+ }
2091
+
2092
+ /** @param {{fatal: boolean}} options */
2093
+ encoders['EUC-JP'] = function (options) {
2094
+ return new EUCJPEncoder(options);
2095
+ };
2096
+ /** @param {{fatal: boolean}} options */
2097
+ decoders['EUC-JP'] = function (options) {
2098
+ return new EUCJPDecoder(options);
2099
+ };
2100
+
2101
+ // 13.2 iso-2022-jp
2102
+
2103
+ // 13.2.1 iso-2022-jp decoder
2104
+ /**
2105
+ * @constructor
2106
+ * @implements {Decoder}
2107
+ * @param {{fatal: boolean}} options
2108
+ */
2109
+ function ISO2022JPDecoder(options) {
2110
+ var fatal = options.fatal;
2111
+ /** @enum */
2112
+ var states = {
2113
+ ASCII: 0,
2114
+ Roman: 1,
2115
+ Katakana: 2,
2116
+ LeadByte: 3,
2117
+ TrailByte: 4,
2118
+ EscapeStart: 5,
2119
+ Escape: 6
2120
+ };
2121
+ // iso-2022-jp's decoder has an associated iso-2022-jp decoder
2122
+ // state (initially ASCII), iso-2022-jp decoder output state
2123
+ // (initially ASCII), iso-2022-jp lead (initially 0x00), and
2124
+ // iso-2022-jp output flag (initially unset).
2125
+ var /** @type {number} */ iso2022jp_decoder_state = states.ASCII,
2126
+ /** @type {number} */ iso2022jp_decoder_output_state = states.ASCII,
2127
+ /** @type {number} */ iso2022jp_lead = 0x00,
2128
+ /** @type {boolean} */ iso2022jp_output_flag = false;
2129
+ /**
2130
+ * @param {Stream} stream The stream of bytes being decoded.
2131
+ * @param {number} bite The next byte read from the stream.
2132
+ * @return {?(number|!Array.<number>)} The next code point(s)
2133
+ * decoded, or null if not enough data exists in the input
2134
+ * stream to decode a complete code point.
2135
+ */
2136
+ this.handler = function (stream, bite) {
2137
+ // switching on iso-2022-jp decoder state:
2138
+ switch (iso2022jp_decoder_state) {
2139
+ default:
2140
+ case states.ASCII:
2141
+ // ASCII
2142
+ // Based on byte:
2143
+
2144
+ // 0x1B
2145
+ if (bite === 0x1b) {
2146
+ // Set iso-2022-jp decoder state to escape start and return
2147
+ // continue.
2148
+ iso2022jp_decoder_state = states.EscapeStart;
2149
+ return null;
2150
+ }
2151
+
2152
+ // 0x00 to 0x7F, excluding 0x0E, 0x0F, and 0x1B
2153
+ if (inRange(bite, 0x00, 0x7f) && bite !== 0x0e && bite !== 0x0f && bite !== 0x1b) {
2154
+ // Unset the iso-2022-jp output flag and return a code point
2155
+ // whose value is byte.
2156
+ iso2022jp_output_flag = false;
2157
+ return bite;
2158
+ }
2159
+
2160
+ // end-of-stream
2161
+ if (bite === end_of_stream) {
2162
+ // Return finished.
2163
+ return finished;
2164
+ }
2165
+
2166
+ // Otherwise
2167
+ // Unset the iso-2022-jp output flag and return error.
2168
+ iso2022jp_output_flag = false;
2169
+ return decoderError(fatal);
2170
+
2171
+ case states.Roman:
2172
+ // Roman
2173
+ // Based on byte:
2174
+
2175
+ // 0x1B
2176
+ if (bite === 0x1b) {
2177
+ // Set iso-2022-jp decoder state to escape start and return
2178
+ // continue.
2179
+ iso2022jp_decoder_state = states.EscapeStart;
2180
+ return null;
2181
+ }
2182
+
2183
+ // 0x5C
2184
+ if (bite === 0x5c) {
2185
+ // Unset the iso-2022-jp output flag and return code point
2186
+ // U+00A5.
2187
+ iso2022jp_output_flag = false;
2188
+ return 0x00a5;
2189
+ }
2190
+
2191
+ // 0x7E
2192
+ if (bite === 0x7e) {
2193
+ // Unset the iso-2022-jp output flag and return code point
2194
+ // U+203E.
2195
+ iso2022jp_output_flag = false;
2196
+ return 0x203e;
2197
+ }
2198
+
2199
+ // 0x00 to 0x7F, excluding 0x0E, 0x0F, 0x1B, 0x5C, and 0x7E
2200
+ if (
2201
+ inRange(bite, 0x00, 0x7f) &&
2202
+ bite !== 0x0e &&
2203
+ bite !== 0x0f &&
2204
+ bite !== 0x1b &&
2205
+ bite !== 0x5c &&
2206
+ bite !== 0x7e
2207
+ ) {
2208
+ // Unset the iso-2022-jp output flag and return a code point
2209
+ // whose value is byte.
2210
+ iso2022jp_output_flag = false;
2211
+ return bite;
2212
+ }
2213
+
2214
+ // end-of-stream
2215
+ if (bite === end_of_stream) {
2216
+ // Return finished.
2217
+ return finished;
2218
+ }
2219
+
2220
+ // Otherwise
2221
+ // Unset the iso-2022-jp output flag and return error.
2222
+ iso2022jp_output_flag = false;
2223
+ return decoderError(fatal);
2224
+
2225
+ case states.Katakana:
2226
+ // Katakana
2227
+ // Based on byte:
2228
+
2229
+ // 0x1B
2230
+ if (bite === 0x1b) {
2231
+ // Set iso-2022-jp decoder state to escape start and return
2232
+ // continue.
2233
+ iso2022jp_decoder_state = states.EscapeStart;
2234
+ return null;
2235
+ }
2236
+
2237
+ // 0x21 to 0x5F
2238
+ if (inRange(bite, 0x21, 0x5f)) {
2239
+ // Unset the iso-2022-jp output flag and return a code point
2240
+ // whose value is 0xFF61 − 0x21 + byte.
2241
+ iso2022jp_output_flag = false;
2242
+ return 0xff61 - 0x21 + bite;
2243
+ }
2244
+
2245
+ // end-of-stream
2246
+ if (bite === end_of_stream) {
2247
+ // Return finished.
2248
+ return finished;
2249
+ }
2250
+
2251
+ // Otherwise
2252
+ // Unset the iso-2022-jp output flag and return error.
2253
+ iso2022jp_output_flag = false;
2254
+ return decoderError(fatal);
2255
+
2256
+ case states.LeadByte:
2257
+ // Lead byte
2258
+ // Based on byte:
2259
+
2260
+ // 0x1B
2261
+ if (bite === 0x1b) {
2262
+ // Set iso-2022-jp decoder state to escape start and return
2263
+ // continue.
2264
+ iso2022jp_decoder_state = states.EscapeStart;
2265
+ return null;
2266
+ }
2267
+
2268
+ // 0x21 to 0x7E
2269
+ if (inRange(bite, 0x21, 0x7e)) {
2270
+ // Unset the iso-2022-jp output flag, set iso-2022-jp lead
2271
+ // to byte, iso-2022-jp decoder state to trail byte, and
2272
+ // return continue.
2273
+ iso2022jp_output_flag = false;
2274
+ iso2022jp_lead = bite;
2275
+ iso2022jp_decoder_state = states.TrailByte;
2276
+ return null;
2277
+ }
2278
+
2279
+ // end-of-stream
2280
+ if (bite === end_of_stream) {
2281
+ // Return finished.
2282
+ return finished;
2283
+ }
2284
+
2285
+ // Otherwise
2286
+ // Unset the iso-2022-jp output flag and return error.
2287
+ iso2022jp_output_flag = false;
2288
+ return decoderError(fatal);
2289
+
2290
+ case states.TrailByte:
2291
+ // Trail byte
2292
+ // Based on byte:
2293
+
2294
+ // 0x1B
2295
+ if (bite === 0x1b) {
2296
+ // Set iso-2022-jp decoder state to escape start and return
2297
+ // continue.
2298
+ iso2022jp_decoder_state = states.EscapeStart;
2299
+ return decoderError(fatal);
2300
+ }
2301
+
2302
+ // 0x21 to 0x7E
2303
+ if (inRange(bite, 0x21, 0x7e)) {
2304
+ // 1. Set the iso-2022-jp decoder state to lead byte.
2305
+ iso2022jp_decoder_state = states.LeadByte;
2306
+
2307
+ // 2. Let pointer be (iso-2022-jp lead − 0x21) × 94 + byte − 0x21.
2308
+ var pointer = (iso2022jp_lead - 0x21) * 94 + bite - 0x21;
2309
+
2310
+ // 3. Let code point be the index code point for pointer in
2311
+ // index jis0208.
2312
+ var code_point = indexCodePointFor(pointer, index('jis0208'));
2313
+
2314
+ // 4. If code point is null, return error.
2315
+ if (code_point === null) return decoderError(fatal);
2316
+
2317
+ // 5. Return a code point whose value is code point.
2318
+ return code_point;
2319
+ }
2320
+
2321
+ // end-of-stream
2322
+ if (bite === end_of_stream) {
2323
+ // Set the iso-2022-jp decoder state to lead byte, prepend
2324
+ // byte to stream, and return error.
2325
+ iso2022jp_decoder_state = states.LeadByte;
2326
+ stream.prepend(bite);
2327
+ return decoderError(fatal);
2328
+ }
2329
+
2330
+ // Otherwise
2331
+ // Set iso-2022-jp decoder state to lead byte and return
2332
+ // error.
2333
+ iso2022jp_decoder_state = states.LeadByte;
2334
+ return decoderError(fatal);
2335
+
2336
+ case states.EscapeStart:
2337
+ // Escape start
2338
+
2339
+ // 1. If byte is either 0x24 or 0x28, set iso-2022-jp lead to
2340
+ // byte, iso-2022-jp decoder state to escape, and return
2341
+ // continue.
2342
+ if (bite === 0x24 || bite === 0x28) {
2343
+ iso2022jp_lead = bite;
2344
+ iso2022jp_decoder_state = states.Escape;
2345
+ return null;
2346
+ }
2347
+
2348
+ // 2. Prepend byte to stream.
2349
+ stream.prepend(bite);
2350
+
2351
+ // 3. Unset the iso-2022-jp output flag, set iso-2022-jp
2352
+ // decoder state to iso-2022-jp decoder output state, and
2353
+ // return error.
2354
+ iso2022jp_output_flag = false;
2355
+ iso2022jp_decoder_state = iso2022jp_decoder_output_state;
2356
+ return decoderError(fatal);
2357
+
2358
+ case states.Escape:
2359
+ // Escape
2360
+
2361
+ // 1. Let lead be iso-2022-jp lead and set iso-2022-jp lead to
2362
+ // 0x00.
2363
+ var lead = iso2022jp_lead;
2364
+ iso2022jp_lead = 0x00;
2365
+
2366
+ // 2. Let state be null.
2367
+ var state = null;
2368
+
2369
+ // 3. If lead is 0x28 and byte is 0x42, set state to ASCII.
2370
+ if (lead === 0x28 && bite === 0x42) state = states.ASCII;
2371
+
2372
+ // 4. If lead is 0x28 and byte is 0x4A, set state to Roman.
2373
+ if (lead === 0x28 && bite === 0x4a) state = states.Roman;
2374
+
2375
+ // 5. If lead is 0x28 and byte is 0x49, set state to Katakana.
2376
+ if (lead === 0x28 && bite === 0x49) state = states.Katakana;
2377
+
2378
+ // 6. If lead is 0x24 and byte is either 0x40 or 0x42, set
2379
+ // state to lead byte.
2380
+ if (lead === 0x24 && (bite === 0x40 || bite === 0x42)) state = states.LeadByte;
2381
+
2382
+ // 7. If state is non-null, run these substeps:
2383
+ if (state !== null) {
2384
+ // 1. Set iso-2022-jp decoder state and iso-2022-jp decoder
2385
+ // output state to states.
2386
+ iso2022jp_decoder_state = iso2022jp_decoder_state = state;
2387
+
2388
+ // 2. Let output flag be the iso-2022-jp output flag.
2389
+ var output_flag = iso2022jp_output_flag;
2390
+
2391
+ // 3. Set the iso-2022-jp output flag.
2392
+ iso2022jp_output_flag = true;
2393
+
2394
+ // 4. Return continue, if output flag is unset, and error
2395
+ // otherwise.
2396
+ return !output_flag ? null : decoderError(fatal);
2397
+ }
2398
+
2399
+ // 8. Prepend lead and byte to stream.
2400
+ stream.prepend([lead, bite]);
2401
+
2402
+ // 9. Unset the iso-2022-jp output flag, set iso-2022-jp
2403
+ // decoder state to iso-2022-jp decoder output state and
2404
+ // return error.
2405
+ iso2022jp_output_flag = false;
2406
+ iso2022jp_decoder_state = iso2022jp_decoder_output_state;
2407
+ return decoderError(fatal);
2408
+ }
2409
+ };
2410
+ }
2411
+
2412
+ // 13.2.2 iso-2022-jp encoder
2413
+ /**
2414
+ * @constructor
2415
+ * @implements {Encoder}
2416
+ * @param {{fatal: boolean}} options
2417
+ */
2418
+ function ISO2022JPEncoder(options) {
2419
+ var _fatal = options.fatal;
2420
+ // iso-2022-jp's encoder has an associated iso-2022-jp encoder
2421
+ // state which is one of ASCII, Roman, and jis0208 (initially
2422
+ // ASCII).
2423
+ /** @enum */
2424
+ var states = {
2425
+ ASCII: 0,
2426
+ Roman: 1,
2427
+ jis0208: 2
2428
+ };
2429
+ var /** @type {number} */ iso2022jp_state = states.ASCII;
2430
+ /**
2431
+ * @param {Stream} stream Input stream.
2432
+ * @param {number} code_point Next code point read from the stream.
2433
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
2434
+ */
2435
+ this.handler = function (stream, code_point) {
2436
+ // 1. If code point is end-of-stream and iso-2022-jp encoder
2437
+ // state is not ASCII, prepend code point to stream, set
2438
+ // iso-2022-jp encoder state to ASCII, and return three bytes
2439
+ // 0x1B 0x28 0x42.
2440
+ if (code_point === end_of_stream && iso2022jp_state !== states.ASCII) {
2441
+ stream.prepend(code_point);
2442
+ iso2022jp_state = states.ASCII;
2443
+ return [0x1b, 0x28, 0x42];
2444
+ }
2445
+
2446
+ // 2. If code point is end-of-stream and iso-2022-jp encoder
2447
+ // state is ASCII, return finished.
2448
+ if (code_point === end_of_stream && iso2022jp_state === states.ASCII) return finished;
2449
+
2450
+ // 3. If ISO-2022-JP encoder state is ASCII or Roman, and code
2451
+ // point is U+000E, U+000F, or U+001B, return error with U+FFFD.
2452
+ if (
2453
+ (iso2022jp_state === states.ASCII || iso2022jp_state === states.Roman) &&
2454
+ (code_point === 0x000e || code_point === 0x000f || code_point === 0x001b)
2455
+ ) {
2456
+ return encoderError(0xfffd);
2457
+ }
2458
+
2459
+ // 4. If iso-2022-jp encoder state is ASCII and code point is an
2460
+ // ASCII code point, return a byte whose value is code point.
2461
+ if (iso2022jp_state === states.ASCII && isASCIICodePoint(code_point)) return code_point;
2462
+
2463
+ // 5. If iso-2022-jp encoder state is Roman and code point is an
2464
+ // ASCII code point, excluding U+005C and U+007E, or is U+00A5
2465
+ // or U+203E, run these substeps:
2466
+ if (
2467
+ iso2022jp_state === states.Roman &&
2468
+ ((isASCIICodePoint(code_point) && code_point !== 0x005c && code_point !== 0x007e) ||
2469
+ code_point === 0x00a5 ||
2470
+ code_point === 0x203e)
2471
+ ) {
2472
+ // 1. If code point is an ASCII code point, return a byte
2473
+ // whose value is code point.
2474
+ if (isASCIICodePoint(code_point)) return code_point;
2475
+
2476
+ // 2. If code point is U+00A5, return byte 0x5C.
2477
+ if (code_point === 0x00a5) return 0x5c;
2478
+
2479
+ // 3. If code point is U+203E, return byte 0x7E.
2480
+ if (code_point === 0x203e) return 0x7e;
2481
+ }
2482
+
2483
+ // 6. If code point is an ASCII code point, and iso-2022-jp
2484
+ // encoder state is not ASCII, prepend code point to stream, set
2485
+ // iso-2022-jp encoder state to ASCII, and return three bytes
2486
+ // 0x1B 0x28 0x42.
2487
+ if (isASCIICodePoint(code_point) && iso2022jp_state !== states.ASCII) {
2488
+ stream.prepend(code_point);
2489
+ iso2022jp_state = states.ASCII;
2490
+ return [0x1b, 0x28, 0x42];
2491
+ }
2492
+
2493
+ // 7. If code point is either U+00A5 or U+203E, and iso-2022-jp
2494
+ // encoder state is not Roman, prepend code point to stream, set
2495
+ // iso-2022-jp encoder state to Roman, and return three bytes
2496
+ // 0x1B 0x28 0x4A.
2497
+ if ((code_point === 0x00a5 || code_point === 0x203e) && iso2022jp_state !== states.Roman) {
2498
+ stream.prepend(code_point);
2499
+ iso2022jp_state = states.Roman;
2500
+ return [0x1b, 0x28, 0x4a];
2501
+ }
2502
+
2503
+ // 8. If code point is U+2212, set it to U+FF0D.
2504
+ if (code_point === 0x2212) code_point = 0xff0d;
2505
+
2506
+ // 9. Let pointer be the index pointer for code point in index
2507
+ // jis0208.
2508
+ var pointer = indexPointerFor(code_point, index('jis0208'));
2509
+
2510
+ // 10. If pointer is null, return error with code point.
2511
+ if (pointer === null) return encoderError(code_point);
2512
+
2513
+ // 11. If iso-2022-jp encoder state is not jis0208, prepend code
2514
+ // point to stream, set iso-2022-jp encoder state to jis0208,
2515
+ // and return three bytes 0x1B 0x24 0x42.
2516
+ if (iso2022jp_state !== states.jis0208) {
2517
+ stream.prepend(code_point);
2518
+ iso2022jp_state = states.jis0208;
2519
+ return [0x1b, 0x24, 0x42];
2520
+ }
2521
+
2522
+ // 12. Let lead be floor(pointer / 94) + 0x21.
2523
+ var lead = floor(pointer / 94) + 0x21;
2524
+
2525
+ // 13. Let trail be pointer % 94 + 0x21.
2526
+ var trail = (pointer % 94) + 0x21;
2527
+
2528
+ // 14. Return two bytes whose values are lead and trail.
2529
+ return [lead, trail];
2530
+ };
2531
+ }
2532
+
2533
+ /** @param {{fatal: boolean}} options */
2534
+ encoders['ISO-2022-JP'] = function (options) {
2535
+ return new ISO2022JPEncoder(options);
2536
+ };
2537
+ /** @param {{fatal: boolean}} options */
2538
+ decoders['ISO-2022-JP'] = function (options) {
2539
+ return new ISO2022JPDecoder(options);
2540
+ };
2541
+
2542
+ // 13.3 Shift_JIS
2543
+
2544
+ // 13.3.1 Shift_JIS decoder
2545
+ /**
2546
+ * @constructor
2547
+ * @implements {Decoder}
2548
+ * @param {{fatal: boolean}} options
2549
+ */
2550
+ function ShiftJISDecoder(options) {
2551
+ var fatal = options.fatal;
2552
+ // Shift_JIS's decoder has an associated Shift_JIS lead (initially
2553
+ // 0x00).
2554
+ var /** @type {number} */ Shift_JIS_lead = 0x00;
2555
+ /**
2556
+ * @param {Stream} stream The stream of bytes being decoded.
2557
+ * @param {number} bite The next byte read from the stream.
2558
+ * @return {?(number|!Array.<number>)} The next code point(s)
2559
+ * decoded, or null if not enough data exists in the input
2560
+ * stream to decode a complete code point.
2561
+ */
2562
+ this.handler = function (stream, bite) {
2563
+ // 1. If byte is end-of-stream and Shift_JIS lead is not 0x00,
2564
+ // set Shift_JIS lead to 0x00 and return error.
2565
+ if (bite === end_of_stream && Shift_JIS_lead !== 0x00) {
2566
+ Shift_JIS_lead = 0x00;
2567
+ return decoderError(fatal);
2568
+ }
2569
+
2570
+ // 2. If byte is end-of-stream and Shift_JIS lead is 0x00,
2571
+ // return finished.
2572
+ if (bite === end_of_stream && Shift_JIS_lead === 0x00) return finished;
2573
+
2574
+ // 3. If Shift_JIS lead is not 0x00, let lead be Shift_JIS lead,
2575
+ // let pointer be null, set Shift_JIS lead to 0x00, and then run
2576
+ // these substeps:
2577
+ if (Shift_JIS_lead !== 0x00) {
2578
+ var lead = Shift_JIS_lead;
2579
+ var pointer = null;
2580
+ Shift_JIS_lead = 0x00;
2581
+
2582
+ // 1. Let offset be 0x40, if byte is less than 0x7F, and 0x41
2583
+ // otherwise.
2584
+ var offset = bite < 0x7f ? 0x40 : 0x41;
2585
+
2586
+ // 2. Let lead offset be 0x81, if lead is less than 0xA0, and
2587
+ // 0xC1 otherwise.
2588
+ var lead_offset = lead < 0xa0 ? 0x81 : 0xc1;
2589
+
2590
+ // 3. If byte is in the range 0x40 to 0x7E, inclusive, or 0x80
2591
+ // to 0xFC, inclusive, set pointer to (lead − lead offset) ×
2592
+ // 188 + byte − offset.
2593
+ if (inRange(bite, 0x40, 0x7e) || inRange(bite, 0x80, 0xfc))
2594
+ pointer = (lead - lead_offset) * 188 + bite - offset;
2595
+
2596
+ // 4. If pointer is in the range 8836 to 10715, inclusive,
2597
+ // return a code point whose value is 0xE000 − 8836 + pointer.
2598
+ if (inRange(pointer, 8836, 10715)) return 0xe000 - 8836 + pointer;
2599
+
2600
+ // 5. Let code point be null, if pointer is null, and the
2601
+ // index code point for pointer in index jis0208 otherwise.
2602
+ var code_point = pointer === null ? null : indexCodePointFor(pointer, index('jis0208'));
2603
+
2604
+ // 6. If code point is null and byte is an ASCII byte, prepend
2605
+ // byte to stream.
2606
+ if (code_point === null && isASCIIByte(bite)) stream.prepend(bite);
2607
+
2608
+ // 7. If code point is null, return error.
2609
+ if (code_point === null) return decoderError(fatal);
2610
+
2611
+ // 8. Return a code point whose value is code point.
2612
+ return code_point;
2613
+ }
2614
+
2615
+ // 4. If byte is an ASCII byte or 0x80, return a code point
2616
+ // whose value is byte.
2617
+ if (isASCIIByte(bite) || bite === 0x80) return bite;
2618
+
2619
+ // 5. If byte is in the range 0xA1 to 0xDF, inclusive, return a
2620
+ // code point whose value is 0xFF61 − 0xA1 + byte.
2621
+ if (inRange(bite, 0xa1, 0xdf)) return 0xff61 - 0xa1 + bite;
2622
+
2623
+ // 6. If byte is in the range 0x81 to 0x9F, inclusive, or 0xE0
2624
+ // to 0xFC, inclusive, set Shift_JIS lead to byte and return
2625
+ // continue.
2626
+ if (inRange(bite, 0x81, 0x9f) || inRange(bite, 0xe0, 0xfc)) {
2627
+ Shift_JIS_lead = bite;
2628
+ return null;
2629
+ }
2630
+
2631
+ // 7. Return error.
2632
+ return decoderError(fatal);
2633
+ };
2634
+ }
2635
+
2636
+ // 13.3.2 Shift_JIS encoder
2637
+ /**
2638
+ * @constructor
2639
+ * @implements {Encoder}
2640
+ * @param {{fatal: boolean}} options
2641
+ */
2642
+ function ShiftJISEncoder(options) {
2643
+ var _fatal = options.fatal;
2644
+ /**
2645
+ * @param {Stream} stream Input stream.
2646
+ * @param {number} code_point Next code point read from the stream.
2647
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
2648
+ */
2649
+ this.handler = function (stream, code_point) {
2650
+ // 1. If code point is end-of-stream, return finished.
2651
+ if (code_point === end_of_stream) return finished;
2652
+
2653
+ // 2. If code point is an ASCII code point or U+0080, return a
2654
+ // byte whose value is code point.
2655
+ if (isASCIICodePoint(code_point) || code_point === 0x0080) return code_point;
2656
+
2657
+ // 3. If code point is U+00A5, return byte 0x5C.
2658
+ if (code_point === 0x00a5) return 0x5c;
2659
+
2660
+ // 4. If code point is U+203E, return byte 0x7E.
2661
+ if (code_point === 0x203e) return 0x7e;
2662
+
2663
+ // 5. If code point is in the range U+FF61 to U+FF9F, inclusive,
2664
+ // return a byte whose value is code point − 0xFF61 + 0xA1.
2665
+ if (inRange(code_point, 0xff61, 0xff9f)) return code_point - 0xff61 + 0xa1;
2666
+
2667
+ // 6. If code point is U+2212, set it to U+FF0D.
2668
+ if (code_point === 0x2212) code_point = 0xff0d;
2669
+
2670
+ // 7. Let pointer be the index Shift_JIS pointer for code point.
2671
+ var pointer = indexShiftJISPointerFor(code_point);
2672
+
2673
+ // 8. If pointer is null, return error with code point.
2674
+ if (pointer === null) return encoderError(code_point);
2675
+
2676
+ // 9. Let lead be floor(pointer / 188).
2677
+ var lead = floor(pointer / 188);
2678
+
2679
+ // 10. Let lead offset be 0x81, if lead is less than 0x1F, and
2680
+ // 0xC1 otherwise.
2681
+ var lead_offset = lead < 0x1f ? 0x81 : 0xc1;
2682
+
2683
+ // 11. Let trail be pointer % 188.
2684
+ var trail = pointer % 188;
2685
+
2686
+ // 12. Let offset be 0x40, if trail is less than 0x3F, and 0x41
2687
+ // otherwise.
2688
+ var offset = trail < 0x3f ? 0x40 : 0x41;
2689
+
2690
+ // 13. Return two bytes whose values are lead + lead offset and
2691
+ // trail + offset.
2692
+ return [lead + lead_offset, trail + offset];
2693
+ };
2694
+ }
2695
+
2696
+ /** @param {{fatal: boolean}} options */
2697
+ encoders['Shift_JIS'] = function (options) {
2698
+ return new ShiftJISEncoder(options);
2699
+ };
2700
+ /** @param {{fatal: boolean}} options */
2701
+ decoders['Shift_JIS'] = function (options) {
2702
+ return new ShiftJISDecoder(options);
2703
+ };
2704
+
2705
+ //
2706
+ // 14. Legacy multi-byte Korean encodings
2707
+ //
2708
+
2709
+ // 14.1 euc-kr
2710
+
2711
+ // 14.1.1 euc-kr decoder
2712
+ /**
2713
+ * @constructor
2714
+ * @implements {Decoder}
2715
+ * @param {{fatal: boolean}} options
2716
+ */
2717
+ function EUCKRDecoder(options) {
2718
+ var fatal = options.fatal;
2719
+
2720
+ // euc-kr's decoder has an associated euc-kr lead (initially 0x00).
2721
+ var /** @type {number} */ euckr_lead = 0x00;
2722
+ /**
2723
+ * @param {Stream} stream The stream of bytes being decoded.
2724
+ * @param {number} bite The next byte read from the stream.
2725
+ * @return {?(number|!Array.<number>)} The next code point(s)
2726
+ * decoded, or null if not enough data exists in the input
2727
+ * stream to decode a complete code point.
2728
+ */
2729
+ this.handler = function (stream, bite) {
2730
+ // 1. If byte is end-of-stream and euc-kr lead is not 0x00, set
2731
+ // euc-kr lead to 0x00 and return error.
2732
+ if (bite === end_of_stream && euckr_lead !== 0) {
2733
+ euckr_lead = 0x00;
2734
+ return decoderError(fatal);
2735
+ }
2736
+
2737
+ // 2. If byte is end-of-stream and euc-kr lead is 0x00, return
2738
+ // finished.
2739
+ if (bite === end_of_stream && euckr_lead === 0) return finished;
2740
+
2741
+ // 3. If euc-kr lead is not 0x00, let lead be euc-kr lead, let
2742
+ // pointer be null, set euc-kr lead to 0x00, and then run these
2743
+ // substeps:
2744
+ if (euckr_lead !== 0x00) {
2745
+ var lead = euckr_lead;
2746
+ var pointer = null;
2747
+ euckr_lead = 0x00;
2748
+
2749
+ // 1. If byte is in the range 0x41 to 0xFE, inclusive, set
2750
+ // pointer to (lead − 0x81) × 190 + (byte − 0x41).
2751
+ if (inRange(bite, 0x41, 0xfe)) pointer = (lead - 0x81) * 190 + (bite - 0x41);
2752
+
2753
+ // 2. Let code point be null, if pointer is null, and the
2754
+ // index code point for pointer in index euc-kr otherwise.
2755
+ var code_point = pointer === null ? null : indexCodePointFor(pointer, index('euc-kr'));
2756
+
2757
+ // 3. If code point is null and byte is an ASCII byte, prepend
2758
+ // byte to stream.
2759
+ if (pointer === null && isASCIIByte(bite)) stream.prepend(bite);
2760
+
2761
+ // 4. If code point is null, return error.
2762
+ if (code_point === null) return decoderError(fatal);
2763
+
2764
+ // 5. Return a code point whose value is code point.
2765
+ return code_point;
2766
+ }
2767
+
2768
+ // 4. If byte is an ASCII byte, return a code point whose value
2769
+ // is byte.
2770
+ if (isASCIIByte(bite)) return bite;
2771
+
2772
+ // 5. If byte is in the range 0x81 to 0xFE, inclusive, set
2773
+ // euc-kr lead to byte and return continue.
2774
+ if (inRange(bite, 0x81, 0xfe)) {
2775
+ euckr_lead = bite;
2776
+ return null;
2777
+ }
2778
+
2779
+ // 6. Return error.
2780
+ return decoderError(fatal);
2781
+ };
2782
+ }
2783
+
2784
+ // 14.1.2 euc-kr encoder
2785
+ /**
2786
+ * @constructor
2787
+ * @implements {Encoder}
2788
+ * @param {{fatal: boolean}} options
2789
+ */
2790
+ function EUCKREncoder(options) {
2791
+ var _fatal = options.fatal;
2792
+ /**
2793
+ * @param {Stream} stream Input stream.
2794
+ * @param {number} code_point Next code point read from the stream.
2795
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
2796
+ */
2797
+ this.handler = function (stream, code_point) {
2798
+ // 1. If code point is end-of-stream, return finished.
2799
+ if (code_point === end_of_stream) return finished;
2800
+
2801
+ // 2. If code point is an ASCII code point, return a byte whose
2802
+ // value is code point.
2803
+ if (isASCIICodePoint(code_point)) return code_point;
2804
+
2805
+ // 3. Let pointer be the index pointer for code point in index
2806
+ // euc-kr.
2807
+ var pointer = indexPointerFor(code_point, index('euc-kr'));
2808
+
2809
+ // 4. If pointer is null, return error with code point.
2810
+ if (pointer === null) return encoderError(code_point);
2811
+
2812
+ // 5. Let lead be floor(pointer / 190) + 0x81.
2813
+ var lead = floor(pointer / 190) + 0x81;
2814
+
2815
+ // 6. Let trail be pointer % 190 + 0x41.
2816
+ var trail = (pointer % 190) + 0x41;
2817
+
2818
+ // 7. Return two bytes whose values are lead and trail.
2819
+ return [lead, trail];
2820
+ };
2821
+ }
2822
+
2823
+ /** @param {{fatal: boolean}} options */
2824
+ encoders['EUC-KR'] = function (options) {
2825
+ return new EUCKREncoder(options);
2826
+ };
2827
+ /** @param {{fatal: boolean}} options */
2828
+ decoders['EUC-KR'] = function (options) {
2829
+ return new EUCKRDecoder(options);
2830
+ };
2831
+
2832
+ //
2833
+ // 15. Legacy miscellaneous encodings
2834
+ //
2835
+
2836
+ // 15.1 replacement
2837
+
2838
+ // Not needed - API throws RangeError
2839
+
2840
+ // 15.2 Common infrastructure for utf-16be and utf-16le
2841
+
2842
+ /**
2843
+ * @param {number} code_unit
2844
+ * @param {boolean} utf16be
2845
+ * @return {!Array.<number>} bytes
2846
+ */
2847
+ function convertCodeUnitToBytes(code_unit, utf16be) {
2848
+ // 1. Let byte1 be code unit >> 8.
2849
+ var byte1 = code_unit >> 8;
2850
+
2851
+ // 2. Let byte2 be code unit & 0x00FF.
2852
+ var byte2 = code_unit & 0x00ff;
2853
+
2854
+ // 3. Then return the bytes in order:
2855
+ // utf-16be flag is set: byte1, then byte2.
2856
+ if (utf16be) return [byte1, byte2];
2857
+ // utf-16be flag is unset: byte2, then byte1.
2858
+ return [byte2, byte1];
2859
+ }
2860
+
2861
+ // 15.2.1 shared utf-16 decoder
2862
+ /**
2863
+ * @constructor
2864
+ * @implements {Decoder}
2865
+ * @param {boolean} utf16_be True if big-endian, false if little-endian.
2866
+ * @param {{fatal: boolean}} options
2867
+ */
2868
+ function UTF16Decoder(utf16_be, options) {
2869
+ var fatal = options.fatal;
2870
+ var /** @type {?number} */ utf16_lead_byte = null,
2871
+ /** @type {?number} */ utf16_lead_surrogate = null;
2872
+ /**
2873
+ * @param {Stream} stream The stream of bytes being decoded.
2874
+ * @param {number} bite The next byte read from the stream.
2875
+ * @return {?(number|!Array.<number>)} The next code point(s)
2876
+ * decoded, or null if not enough data exists in the input
2877
+ * stream to decode a complete code point.
2878
+ */
2879
+ this.handler = function (stream, bite) {
2880
+ // 1. If byte is end-of-stream and either utf-16 lead byte or
2881
+ // utf-16 lead surrogate is not null, set utf-16 lead byte and
2882
+ // utf-16 lead surrogate to null, and return error.
2883
+ if (bite === end_of_stream && (utf16_lead_byte !== null || utf16_lead_surrogate !== null)) {
2884
+ return decoderError(fatal);
2885
+ }
2886
+
2887
+ // 2. If byte is end-of-stream and utf-16 lead byte and utf-16
2888
+ // lead surrogate are null, return finished.
2889
+ if (bite === end_of_stream && utf16_lead_byte === null && utf16_lead_surrogate === null) {
2890
+ return finished;
2891
+ }
2892
+
2893
+ // 3. If utf-16 lead byte is null, set utf-16 lead byte to byte
2894
+ // and return continue.
2895
+ if (utf16_lead_byte === null) {
2896
+ utf16_lead_byte = bite;
2897
+ return null;
2898
+ }
2899
+
2900
+ // 4. Let code unit be the result of:
2901
+ var code_unit;
2902
+ if (utf16_be) {
2903
+ // utf-16be decoder flag is set
2904
+ // (utf-16 lead byte << 8) + byte.
2905
+ code_unit = (utf16_lead_byte << 8) + bite;
2906
+ } else {
2907
+ // utf-16be decoder flag is unset
2908
+ // (byte << 8) + utf-16 lead byte.
2909
+ code_unit = (bite << 8) + utf16_lead_byte;
2910
+ }
2911
+ // Then set utf-16 lead byte to null.
2912
+ utf16_lead_byte = null;
2913
+
2914
+ // 5. If utf-16 lead surrogate is not null, let lead surrogate
2915
+ // be utf-16 lead surrogate, set utf-16 lead surrogate to null,
2916
+ // and then run these substeps:
2917
+ if (utf16_lead_surrogate !== null) {
2918
+ var lead_surrogate = utf16_lead_surrogate;
2919
+ utf16_lead_surrogate = null;
2920
+
2921
+ // 1. If code unit is in the range U+DC00 to U+DFFF,
2922
+ // inclusive, return a code point whose value is 0x10000 +
2923
+ // ((lead surrogate − 0xD800) << 10) + (code unit − 0xDC00).
2924
+ if (inRange(code_unit, 0xdc00, 0xdfff)) {
2925
+ return 0x10000 + (lead_surrogate - 0xd800) * 0x400 + (code_unit - 0xdc00);
2926
+ }
2927
+
2928
+ // 2. Prepend the sequence resulting of converting code unit
2929
+ // to bytes using utf-16be decoder flag to stream and return
2930
+ // error.
2931
+ stream.prepend(convertCodeUnitToBytes(code_unit, utf16_be));
2932
+ return decoderError(fatal);
2933
+ }
2934
+
2935
+ // 6. If code unit is in the range U+D800 to U+DBFF, inclusive,
2936
+ // set utf-16 lead surrogate to code unit and return continue.
2937
+ if (inRange(code_unit, 0xd800, 0xdbff)) {
2938
+ utf16_lead_surrogate = code_unit;
2939
+ return null;
2940
+ }
2941
+
2942
+ // 7. If code unit is in the range U+DC00 to U+DFFF, inclusive,
2943
+ // return error.
2944
+ if (inRange(code_unit, 0xdc00, 0xdfff)) return decoderError(fatal);
2945
+
2946
+ // 8. Return code point code unit.
2947
+ return code_unit;
2948
+ };
2949
+ }
2950
+
2951
+ // 15.2.2 shared utf-16 encoder
2952
+ /**
2953
+ * @constructor
2954
+ * @implements {Encoder}
2955
+ * @param {boolean} utf16_be True if big-endian, false if little-endian.
2956
+ * @param {{fatal: boolean}} options
2957
+ */
2958
+ function UTF16Encoder(utf16_be, options) {
2959
+ var _fatal = options.fatal;
2960
+ /**
2961
+ * @param {Stream} stream Input stream.
2962
+ * @param {number} code_point Next code point read from the stream.
2963
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
2964
+ */
2965
+ this.handler = function (stream, code_point) {
2966
+ // 1. If code point is end-of-stream, return finished.
2967
+ if (code_point === end_of_stream) return finished;
2968
+
2969
+ // 2. If code point is in the range U+0000 to U+FFFF, inclusive,
2970
+ // return the sequence resulting of converting code point to
2971
+ // bytes using utf-16be encoder flag.
2972
+ if (inRange(code_point, 0x0000, 0xffff)) return convertCodeUnitToBytes(code_point, utf16_be);
2973
+
2974
+ // 3. Let lead be ((code point − 0x10000) >> 10) + 0xD800,
2975
+ // converted to bytes using utf-16be encoder flag.
2976
+ var lead = convertCodeUnitToBytes(((code_point - 0x10000) >> 10) + 0xd800, utf16_be);
2977
+
2978
+ // 4. Let trail be ((code point − 0x10000) & 0x3FF) + 0xDC00,
2979
+ // converted to bytes using utf-16be encoder flag.
2980
+ var trail = convertCodeUnitToBytes(((code_point - 0x10000) & 0x3ff) + 0xdc00, utf16_be);
2981
+
2982
+ // 5. Return a byte sequence of lead followed by trail.
2983
+ return lead.concat(trail);
2984
+ };
2985
+ }
2986
+
2987
+ // 15.3 utf-16be
2988
+ // 15.3.1 utf-16be decoder
2989
+ /** @param {{fatal: boolean}} options */
2990
+ encoders['UTF-16BE'] = function (options) {
2991
+ return new UTF16Encoder(true, options);
2992
+ };
2993
+ // 15.3.2 utf-16be encoder
2994
+ /** @param {{fatal: boolean}} options */
2995
+ decoders['UTF-16BE'] = function (options) {
2996
+ return new UTF16Decoder(true, options);
2997
+ };
2998
+
2999
+ // 15.4 utf-16le
3000
+ // 15.4.1 utf-16le decoder
3001
+ /** @param {{fatal: boolean}} options */
3002
+ encoders['UTF-16LE'] = function (options) {
3003
+ return new UTF16Encoder(false, options);
3004
+ };
3005
+ // 15.4.2 utf-16le encoder
3006
+ /** @param {{fatal: boolean}} options */
3007
+ decoders['UTF-16LE'] = function (options) {
3008
+ return new UTF16Decoder(false, options);
3009
+ };
3010
+
3011
+ // 15.5 x-user-defined
3012
+
3013
+ // 15.5.1 x-user-defined decoder
3014
+ /**
3015
+ * @constructor
3016
+ * @implements {Decoder}
3017
+ * @param {{fatal: boolean}} options
3018
+ */
3019
+ function XUserDefinedDecoder(options) {
3020
+ var _fatal = options.fatal;
3021
+ /**
3022
+ * @param {Stream} stream The stream of bytes being decoded.
3023
+ * @param {number} bite The next byte read from the stream.
3024
+ * @return {?(number|!Array.<number>)} The next code point(s)
3025
+ * decoded, or null if not enough data exists in the input
3026
+ * stream to decode a complete code point.
3027
+ */
3028
+ this.handler = function (stream, bite) {
3029
+ // 1. If byte is end-of-stream, return finished.
3030
+ if (bite === end_of_stream) return finished;
3031
+
3032
+ // 2. If byte is an ASCII byte, return a code point whose value
3033
+ // is byte.
3034
+ if (isASCIIByte(bite)) return bite;
3035
+
3036
+ // 3. Return a code point whose value is 0xF780 + byte − 0x80.
3037
+ return 0xf780 + bite - 0x80;
3038
+ };
3039
+ }
3040
+
3041
+ // 15.5.2 x-user-defined encoder
3042
+ /**
3043
+ * @constructor
3044
+ * @implements {Encoder}
3045
+ * @param {{fatal: boolean}} options
3046
+ */
3047
+ function XUserDefinedEncoder(options) {
3048
+ var _fatal = options.fatal;
3049
+ /**
3050
+ * @param {Stream} stream Input stream.
3051
+ * @param {number} code_point Next code point read from the stream.
3052
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
3053
+ */
3054
+ this.handler = function (stream, code_point) {
3055
+ // 1.If code point is end-of-stream, return finished.
3056
+ if (code_point === end_of_stream) return finished;
3057
+
3058
+ // 2. If code point is an ASCII code point, return a byte whose
3059
+ // value is code point.
3060
+ if (isASCIICodePoint(code_point)) return code_point;
3061
+
3062
+ // 3. If code point is in the range U+F780 to U+F7FF, inclusive,
3063
+ // return a byte whose value is code point − 0xF780 + 0x80.
3064
+ if (inRange(code_point, 0xf780, 0xf7ff)) return code_point - 0xf780 + 0x80;
3065
+
3066
+ // 4. Return error with code point.
3067
+ return encoderError(code_point);
3068
+ };
3069
+ }
3070
+
3071
+ /** @param {{fatal: boolean}} options */
3072
+ encoders['x-user-defined'] = function (options) {
3073
+ return new XUserDefinedEncoder(options);
3074
+ };
3075
+ /** @param {{fatal: boolean}} options */
3076
+ decoders['x-user-defined'] = function (options) {
3077
+ return new XUserDefinedDecoder(options);
3078
+ };
3079
+
3080
+ // FORK
3081
+ // if (!globalThis['TextEncoder']) globalThis['TextEncoder'] = TextEncoder;
3082
+ // if (!globalThis['TextDecoder']) globalThis['TextDecoder'] = TextDecoder;
3083
+ // babel.config.js skip transpiling files in `libs/`
3084
+ // module.exports = {TextEncoder, TextDecoder};
3085
+ export {TextEncoder, TextDecoder};