@vbarbarosh/node-helpers 3.75.0 → 3.76.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (367) hide show
  1. package/README.md +29 -3
  2. package/dist/browser.js +1 -2504
  3. package/package.json +31 -11
  4. package/src/HeartbeatServer.js +24 -3
  5. package/src/HeartbeatServer.md +33 -0
  6. package/src/array_chunk.js +1 -1
  7. package/src/array_chunk.md +8 -0
  8. package/src/array_chunk_balanced.md +14 -0
  9. package/src/array_fps.md +12 -0
  10. package/src/array_gcd.js +4 -2
  11. package/src/array_gcd.md +2 -1
  12. package/src/array_group.js +3 -3
  13. package/src/array_group.md +14 -0
  14. package/src/array_group_map.js +3 -3
  15. package/src/array_group_map.md +13 -0
  16. package/src/array_index.js +2 -2
  17. package/src/array_index.md +9 -0
  18. package/src/array_lcm.js +4 -2
  19. package/src/array_lcm.md +2 -1
  20. package/src/array_max.js +11 -4
  21. package/src/array_max.md +1 -1
  22. package/src/array_min.js +11 -4
  23. package/src/array_min.md +1 -1
  24. package/src/array_permutations.js +4 -0
  25. package/src/array_permutations.md +13 -0
  26. package/src/array_sort.js +7 -2
  27. package/src/array_sort.md +13 -0
  28. package/src/array_sort_other.js +8 -5
  29. package/src/array_sort_other.md +11 -0
  30. package/src/array_sum.js +2 -2
  31. package/src/array_sum.md +8 -0
  32. package/src/array_unique.js +2 -2
  33. package/src/array_unique_last.js +2 -2
  34. package/src/assert_valid_expires_at.md +10 -0
  35. package/src/clamp.md +9 -0
  36. package/src/cli-apps/watchdog.js +5 -0
  37. package/src/cli.js +3 -1
  38. package/src/cli.md +15 -0
  39. package/src/const_stream.md +7 -0
  40. package/src/const_type.md +5 -0
  41. package/src/countdown.js +22 -5
  42. package/src/countdown.md +21 -0
  43. package/src/crypto_decrypt_aes256.md +13 -0
  44. package/src/crypto_encrypt_aes256.md +13 -0
  45. package/src/crypto_hash_md5.md +10 -0
  46. package/src/crypto_hash_sha256.md +10 -0
  47. package/src/crypto_hmac_sha256.md +11 -0
  48. package/src/date_add_hours.md +8 -0
  49. package/src/date_add_milliseconds.md +4 -0
  50. package/src/date_add_minutes.md +4 -0
  51. package/src/date_add_months.md +13 -0
  52. package/src/date_add_seconds.md +4 -0
  53. package/src/date_diff_seconds.md +4 -0
  54. package/src/date_is_leap_year.md +9 -0
  55. package/src/escape_content_disposition.js +6 -3
  56. package/src/escape_content_disposition.md +13 -0
  57. package/src/escape_regexp.md +7 -0
  58. package/src/eta.js +7 -1
  59. package/src/eta.md +18 -0
  60. package/src/factorize_ms.js +3 -0
  61. package/src/factorize_ms.md +10 -0
  62. package/src/fastdl.js +14 -3
  63. package/src/fcmp_dates.md +12 -0
  64. package/src/fcmp_default.js +7 -0
  65. package/src/fcmp_default.md +29 -0
  66. package/src/fcmp_default_desc.js +4 -7
  67. package/src/fcmp_default_desc.md +10 -0
  68. package/src/fcmp_from_spec.md +13 -0
  69. package/src/fcmp_numbers.md +11 -0
  70. package/src/fcmp_tuples.md +17 -0
  71. package/src/fcmp_utf8_bin.md +14 -0
  72. package/src/fcmp_utf8_ci.md +14 -0
  73. package/src/fcmp_utf8_cs.md +15 -0
  74. package/src/fcmp_utf8_natural_bin.js +38 -0
  75. package/src/fcmp_utf8_natural_bin.md +8 -0
  76. package/src/fcmp_utf8_natural_ci.md +13 -0
  77. package/src/fcmp_utf8_natural_cs.md +13 -0
  78. package/src/fcmpx.md +26 -9
  79. package/src/filter1_from_spec.js +3 -3
  80. package/src/format_bytes.md +15 -0
  81. package/src/format_date.md +7 -0
  82. package/src/format_date_fs.md +7 -0
  83. package/src/format_date_human.md +6 -0
  84. package/src/format_date_ymd.md +6 -0
  85. package/src/format_error_report.js +3 -3
  86. package/src/format_error_report.md +12 -0
  87. package/src/format_kilo.md +13 -0
  88. package/src/format_ms.js +3 -2
  89. package/src/format_ms.md +12 -0
  90. package/src/format_ms2.js +6 -3
  91. package/src/format_ms2.md +12 -0
  92. package/src/format_ms3.js +3 -2
  93. package/src/format_ms3.md +12 -0
  94. package/src/format_percents.md +10 -0
  95. package/src/format_progress_bytes.md +13 -0
  96. package/src/format_progress_kilo.md +10 -0
  97. package/src/format_seconds.md +11 -0
  98. package/src/format_thousands.md +9 -0
  99. package/src/fs_append.md +7 -0
  100. package/src/fs_append_json.md +8 -0
  101. package/src/fs_append_utf8.md +6 -0
  102. package/src/fs_assert_file_exists.md +3 -0
  103. package/src/fs_assert_file_readable.js +1 -1
  104. package/src/fs_assert_file_readable.md +3 -0
  105. package/src/fs_assert_file_socket.md +2 -0
  106. package/src/fs_copy.md +7 -0
  107. package/src/fs_copy_excl.md +2 -0
  108. package/src/fs_exists.md +6 -0
  109. package/src/fs_fclose.md +5 -0
  110. package/src/fs_fi.js +13 -1
  111. package/src/fs_fi.md +11 -0
  112. package/src/fs_file_md5.md +8 -0
  113. package/src/fs_find.md +7 -0
  114. package/src/fs_fopen.md +6 -0
  115. package/src/fs_fread.js +2 -2
  116. package/src/fs_fread.md +11 -0
  117. package/src/fs_fsize.md +2 -0
  118. package/src/fs_fstat.md +2 -0
  119. package/src/fs_fwrite.js +2 -2
  120. package/src/fs_fwrite.md +9 -0
  121. package/src/fs_list.md +5 -0
  122. package/src/fs_list_deep.md +5 -0
  123. package/src/fs_ls.md +2 -0
  124. package/src/fs_lsr.md +4 -0
  125. package/src/fs_lstat.md +3 -0
  126. package/src/fs_mkdir.md +3 -0
  127. package/src/fs_mkdirp.js +3 -30
  128. package/src/fs_mkdirp.md +7 -0
  129. package/src/fs_path_basename.md +2 -0
  130. package/src/fs_path_dirname.md +2 -0
  131. package/src/fs_path_extname.md +9 -0
  132. package/src/fs_path_join.md +2 -0
  133. package/src/fs_path_relative.md +2 -0
  134. package/src/fs_path_resolve.md +2 -0
  135. package/src/fs_path_tempdir.md +2 -0
  136. package/src/fs_path_untildify.md +8 -0
  137. package/src/fs_read.md +3 -0
  138. package/src/fs_read_buffer.md +5 -0
  139. package/src/fs_read_json.md +6 -0
  140. package/src/fs_read_lines.md +7 -0
  141. package/src/fs_read_stream.md +2 -0
  142. package/src/fs_read_utf8.md +5 -0
  143. package/src/fs_readdir.md +3 -0
  144. package/src/fs_readlink.md +6 -0
  145. package/src/fs_rename.md +6 -0
  146. package/src/fs_rm.md +4 -0
  147. package/src/fs_rmdir.md +3 -0
  148. package/src/fs_rmf.md +2 -0
  149. package/src/fs_rmrf.md +8 -0
  150. package/src/fs_sha256.js +16 -0
  151. package/src/fs_sha256.md +9 -0
  152. package/src/fs_size.js +2 -2
  153. package/src/fs_size.md +6 -0
  154. package/src/fs_stat.md +2 -0
  155. package/src/fs_tempdir.js +20 -5
  156. package/src/fs_touch.md +6 -0
  157. package/src/fs_walk.js +2 -2
  158. package/src/fs_walk.md +14 -0
  159. package/src/fs_write.md +3 -0
  160. package/src/fs_write_json.md +7 -0
  161. package/src/fs_write_stream.md +2 -0
  162. package/src/gettype.md +13 -0
  163. package/src/http_delete.md +11 -0
  164. package/src/http_get_blob.md +8 -0
  165. package/src/http_get_buffer.md +10 -0
  166. package/src/http_get_file.js +8 -8
  167. package/src/http_get_file.md +14 -0
  168. package/src/http_get_json.md +10 -0
  169. package/src/http_get_stream.md +14 -0
  170. package/src/http_get_stream_range.js +27 -9
  171. package/src/http_get_stream_range.md +22 -0
  172. package/src/http_get_utf8.md +9 -0
  173. package/src/http_head.md +9 -0
  174. package/src/http_patch_json.md +10 -0
  175. package/src/http_post_json.md +11 -0
  176. package/src/http_post_multipart.md +15 -0
  177. package/src/http_post_urlencoded.md +11 -0
  178. package/src/http_put_buffer.md +9 -0
  179. package/src/http_put_file.js +9 -6
  180. package/src/http_put_file.md +16 -0
  181. package/src/http_put_json.md +11 -0
  182. package/src/http_put_utf8.md +9 -0
  183. package/src/http_range_parse.js +6 -3
  184. package/src/http_range_parse.md +18 -0
  185. package/src/http_stream_range.js +35 -22
  186. package/src/http_stream_range.md +29 -0
  187. package/src/identity.md +2 -0
  188. package/src/ignore.md +2 -0
  189. package/src/json_stringify_safe.md +10 -0
  190. package/src/json_stringify_stable.md +9 -0
  191. package/src/logger.js +2 -3
  192. package/src/logger.md +15 -0
  193. package/src/make_progress.js +8 -5
  194. package/src/make_progress.md +20 -0
  195. package/src/math_gcd.js +2 -1
  196. package/src/mongo_stream_upsert.js +10 -3
  197. package/src/mongo_stream_upsert.md +17 -0
  198. package/src/mongo_stream_write.js +10 -3
  199. package/src/mongo_stream_write.md +16 -0
  200. package/src/msval.md +10 -0
  201. package/src/now_fs.md +7 -0
  202. package/src/now_human.md +6 -0
  203. package/src/object_defaults.md +11 -0
  204. package/src/object_schema.js +2 -1
  205. package/src/object_schema.md +12 -0
  206. package/src/object_walk_preorder.md +16 -0
  207. package/src/parallel.js +23 -10
  208. package/src/parse_bytes.js +4 -2
  209. package/src/parse_bytes.md +15 -0
  210. package/src/parse_hms.js +1 -1
  211. package/src/parse_http_content_range.js +9 -5
  212. package/src/parse_http_content_range.md +16 -0
  213. package/src/perf_end_human.md +10 -0
  214. package/src/perf_end_ms.md +8 -0
  215. package/src/perf_measure.md +10 -0
  216. package/src/perf_measure_human.md +8 -0
  217. package/src/perf_start.md +9 -0
  218. package/src/pgid_exists.md +6 -0
  219. package/src/pgid_kill_grace.js +1 -1
  220. package/src/pgid_kill_grace.md +15 -0
  221. package/src/pid_exists.md +5 -0
  222. package/src/pid_kill_grace.js +1 -1
  223. package/src/pid_kill_grace.md +14 -0
  224. package/src/plural.md +13 -0
  225. package/src/random_hex.md +9 -0
  226. package/src/random_int.md +8 -0
  227. package/src/range.js +4 -2
  228. package/src/range.md +2 -0
  229. package/src/redis_connect.js +1 -1
  230. package/src/redis_connect.md +10 -0
  231. package/src/redis_lshift.md +14 -0
  232. package/src/redis_poll.js +1 -0
  233. package/src/redis_poll.md +17 -0
  234. package/src/redis_poll_zshift_callback_rpush.js +1 -2
  235. package/src/redis_poll_zshift_callback_rpush.md +17 -0
  236. package/src/redis_poll_zshift_spawn_rpush.js +2 -1
  237. package/src/redis_poll_zshift_spawn_rpush.md +20 -0
  238. package/src/redis_zshift.md +14 -0
  239. package/src/round.js +7 -8
  240. package/src/round.md +15 -0
  241. package/src/sanitize_dash_name.md +13 -0
  242. package/src/sanitize_filename.md +9 -0
  243. package/src/sanitize_var_name.md +14 -0
  244. package/src/sftp_get_file_info.js +2 -2
  245. package/src/sftp_get_file_info.md +14 -0
  246. package/src/sftp_get_stream_range.js +32 -22
  247. package/src/sftp_get_stream_range.md +20 -0
  248. package/src/shell_curl_progress.js +2 -1
  249. package/src/shell_curl_progress.md +17 -0
  250. package/src/shell_lines.js +2 -2
  251. package/src/shell_lines.md +1 -1
  252. package/src/shell_spawn.js +7 -0
  253. package/src/shell_ytdlp_progress.js +2 -1
  254. package/src/shell_ytdlp_progress.md +17 -0
  255. package/src/str_camel_to_snake.md +11 -0
  256. package/src/str_parse_kv.md +11 -0
  257. package/src/stream_curl_progress.md +14 -0
  258. package/src/stream_data_ln.js +7 -1
  259. package/src/stream_discard.md +8 -0
  260. package/src/stream_group.md +3 -0
  261. package/src/stream_gunzip.md +7 -0
  262. package/src/stream_hash.md +10 -0
  263. package/src/stream_map.js +8 -1
  264. package/src/stream_map_parallel.js +9 -1
  265. package/src/stream_md5.md +9 -0
  266. package/src/stream_multiplex.js +11 -0
  267. package/src/stream_multiplex.md +16 -0
  268. package/src/stream_through.md +3 -0
  269. package/src/stream_transform.md +2 -0
  270. package/src/stream_xml_analyze.js +9 -1
  271. package/src/stream_xml_parse.js +9 -1
  272. package/src/stream_ytdlp_progress.js +1 -1
  273. package/src/stream_ytdlp_progress.md +18 -0
  274. package/src/strtr.js +15 -5
  275. package/src/strtr.md +11 -0
  276. package/src/urlclean.js +9 -2
  277. package/src/urlmod.js +5 -0
  278. package/src/urlparts.md +17 -0
  279. package/src/wait_while.js +1 -1
  280. package/src/wait_while.md +1 -1
  281. package/src/HeartbeatServer.test.js +0 -31
  282. package/src/array_chunk.test.js +0 -24
  283. package/src/array_chunk_balanced.test.js +0 -37
  284. package/src/array_fps.test.js +0 -72
  285. package/src/array_gcd.test.js +0 -10
  286. package/src/array_index.test.js +0 -14
  287. package/src/array_lcm.test.js +0 -12
  288. package/src/array_max.test.js +0 -20
  289. package/src/array_min.test.js +0 -20
  290. package/src/array_permutations.test.js +0 -20
  291. package/src/array_sort.test.js +0 -85
  292. package/src/array_sort_other.test.js +0 -9
  293. package/src/array_sum.test.js +0 -11
  294. package/src/cli-apps/watchdog.d/connect_close.js +0 -17
  295. package/src/cli-apps/watchdog.d/connect_close2.js +0 -20
  296. package/src/cli-apps/watchdog.d/connect_close3.js +0 -25
  297. package/src/cli-apps/watchdog.d/connect_no_ping.js +0 -13
  298. package/src/cli-apps/watchdog.d/early_exit.js +0 -7
  299. package/src/cli-apps/watchdog.d/flood.js +0 -13
  300. package/src/cli-apps/watchdog.d/flood2.js +0 -15
  301. package/src/cli-apps/watchdog.d/hang.js +0 -8
  302. package/src/cli-apps/watchdog.d/huge_delay.js +0 -18
  303. package/src/cli-apps/watchdog.d/ignore_sigterm.js +0 -29
  304. package/src/cli-apps/watchdog.d/late_heartbeat.js +0 -21
  305. package/src/cli-apps/watchdog.d/my-exit-after-2-pings.js +0 -16
  306. package/src/cli-apps/watchdog.d/my-happy-path.js +0 -16
  307. package/src/cli-apps/watchdog.d/my-ignore-sigterm.js +0 -22
  308. package/src/cli-apps/watchdog.d/my-never-ping.js +0 -15
  309. package/src/cli-apps/watchdog.d/no_heartbeat.js +0 -5
  310. package/src/cli-apps/watchdog.d/ok.js +0 -17
  311. package/src/cli-apps/watchdog.d/quick-exit-after-2-pings.js +0 -15
  312. package/src/cli-apps/watchdog.d/quick-hang-after-1-ping.js +0 -15
  313. package/src/cli-apps/watchdog.d/spawn_children.js +0 -14
  314. package/src/cli-apps/watchdog.test.js +0 -48
  315. package/src/crypto_encrypt_aes256.test.js +0 -10
  316. package/src/crypto_hash_sha256.test.js +0 -10
  317. package/src/date_add_months.test.js +0 -40
  318. package/src/date_is_leap_year.test.js +0 -14
  319. package/src/escape_content_disposition.test.js +0 -22
  320. package/src/fcmp_from_spec.test.js +0 -91
  321. package/src/fcmpx.test.js +0 -173
  322. package/src/filter1_from_spec.test.js +0 -31
  323. package/src/format_bytes.test.js +0 -22
  324. package/src/format_error_report.d/src/1.js +0 -26
  325. package/src/format_error_report.d/src/2.js +0 -29
  326. package/src/format_kilo.test.js +0 -25
  327. package/src/format_ms.test.js +0 -33
  328. package/src/format_ms2.test.js +0 -33
  329. package/src/format_ms3.test.js +0 -33
  330. package/src/format_percents.test.js +0 -22
  331. package/src/format_progress_bytes.test.js +0 -19
  332. package/src/format_progress_kilo.test.js +0 -19
  333. package/src/format_seconds.test.js +0 -42
  334. package/src/format_thousands.test.js +0 -28
  335. package/src/fs_file_md5.test.js +0 -11
  336. package/src/fs_mkdirp.test.js +0 -24
  337. package/src/fs_path_extname.test.js +0 -22
  338. package/src/gettype.test.js +0 -27
  339. package/src/object_schema.test.js +0 -15
  340. package/src/object_walk_preorder.test.js +0 -17
  341. package/src/parallel.test.js +0 -11
  342. package/src/parse_bytes.test.js +0 -21
  343. package/src/parse_hms.test.js +0 -32
  344. package/src/parse_http_content_range.test.js +0 -14
  345. package/src/pid_kill_grace.d/ignore-sigterm-for-10ms.js +0 -33
  346. package/src/pid_kill_grace.d/ignore-sigterm.js +0 -22
  347. package/src/pid_kill_grace.test.js +0 -63
  348. package/src/ping_socket.test.js +0 -58
  349. package/src/plural.test.js +0 -20
  350. package/src/range.test.js +0 -41
  351. package/src/redis_lshift.test.js +0 -57
  352. package/src/redis_zshift.test.js +0 -58
  353. package/src/round.test.js +0 -56
  354. package/src/sanitize_dash_name.test.js +0 -59
  355. package/src/sanitize_var_name.test.js +0 -39
  356. package/src/shell_spawn.test.js +0 -30
  357. package/src/str_camel_to_snake.test.js +0 -17
  358. package/src/stream_curl_progress.d/basic +0 -3
  359. package/src/stream_curl_progress.d/basic.json +0 -42
  360. package/src/stream_curl_progress.test.js +0 -17
  361. package/src/stream_data_ln.test.js +0 -24
  362. package/src/stream_map_parallel.test.js +0 -26
  363. package/src/stream_multiplex.test.js +0 -67
  364. package/src/stream_strpbrk.test.js +0 -29
  365. package/src/urlclean.test.js +0 -18
  366. package/src/urlmod.test.js +0 -40
  367. package/src/urlparts.test.js +0 -294
package/dist/browser.js CHANGED
@@ -1,2504 +1 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ var __webpack_modules__ = ({
3
-
4
- /***/ "./node_modules/@vbarbarosh/type-helpers/src/is_num.js":
5
- /*!*************************************************************!*\
6
- !*** ./node_modules/@vbarbarosh/type-helpers/src/is_num.js ***!
7
- \*************************************************************/
8
- /***/ ((module) => {
9
-
10
- function is_num(input)
11
- {
12
- return (typeof input === 'number') && isFinite(input);
13
- }
14
-
15
- module.exports = is_num;
16
-
17
-
18
- /***/ }),
19
-
20
- /***/ "./node_modules/@vbarbarosh/type-helpers/src/is_num_gt.js":
21
- /*!****************************************************************!*\
22
- !*** ./node_modules/@vbarbarosh/type-helpers/src/is_num_gt.js ***!
23
- \****************************************************************/
24
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
25
-
26
- const is_num = __webpack_require__(/*! ./is_num */ "./node_modules/@vbarbarosh/type-helpers/src/is_num.js");
27
-
28
- function is_num_gt(input, min)
29
- {
30
- return is_num(input) && input > min;
31
- }
32
-
33
- module.exports = is_num_gt;
34
-
35
-
36
- /***/ }),
37
-
38
- /***/ "./node_modules/json-stringify-safe/stringify.js":
39
- /*!*******************************************************!*\
40
- !*** ./node_modules/json-stringify-safe/stringify.js ***!
41
- \*******************************************************/
42
- /***/ ((module, exports) => {
43
-
44
- exports = module.exports = stringify
45
- exports.getSerialize = serializer
46
-
47
- function stringify(obj, replacer, spaces, cycleReplacer) {
48
- return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces)
49
- }
50
-
51
- function serializer(replacer, cycleReplacer) {
52
- var stack = [], keys = []
53
-
54
- if (cycleReplacer == null) cycleReplacer = function(key, value) {
55
- if (stack[0] === value) return "[Circular ~]"
56
- return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]"
57
- }
58
-
59
- return function(key, value) {
60
- if (stack.length > 0) {
61
- var thisPos = stack.indexOf(this)
62
- ~thisPos ? stack.splice(thisPos + 1) : stack.push(this)
63
- ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key)
64
- if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value)
65
- }
66
- else stack.push(value)
67
-
68
- return replacer == null ? value : replacer.call(this, key, value)
69
- }
70
- }
71
-
72
-
73
- /***/ }),
74
-
75
- /***/ "./src sync recursive ^(?%21.*(cli-apps%7Cbrowser%7C\\.d)\\/).*\\b(array%7Cdate%7Chttp_delete%7Chttp_get_blob%7Chttp_get_buffer%7Chttp_get_json%7Chttp_get_utf8%7Chttp_head%7Chttp_patch_json%7Chttp_post_json%7Chttp_post_multipart%7Chttp_put_buffer%7Chttp_put_json%7Chttp_put_utf8%7Cidentity%7Cignore%7Cfcmp%7Cfilter%7Cformat%7Cplural%7Crandom_int%7Curlmod%7Cwaitcb)[^/]*(?<%21\\.test)\\.js$":
76
- /*!**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
77
- !*** ./src/ sync ^(?%21.*(cli-apps%7Cbrowser%7C\.d)\/).*\b(array%7Cdate%7Chttp_delete%7Chttp_get_blob%7Chttp_get_buffer%7Chttp_get_json%7Chttp_get_utf8%7Chttp_head%7Chttp_patch_json%7Chttp_post_json%7Chttp_post_multipart%7Chttp_put_buffer%7Chttp_put_json%7Chttp_put_utf8%7Cidentity%7Cignore%7Cfcmp%7Cfilter%7Cformat%7Cplural%7Crandom_int%7Curlmod%7Cwaitcb)[^/]*(?<%21\.test)\.js$ ***!
78
- \**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
79
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
80
-
81
- var map = {
82
- "./array_chunk.js": "./src/array_chunk.js",
83
- "./array_chunk_balanced.js": "./src/array_chunk_balanced.js",
84
- "./array_fps.js": "./src/array_fps.js",
85
- "./array_gcd.js": "./src/array_gcd.js",
86
- "./array_group.js": "./src/array_group.js",
87
- "./array_group_map.js": "./src/array_group_map.js",
88
- "./array_index.js": "./src/array_index.js",
89
- "./array_lcm.js": "./src/array_lcm.js",
90
- "./array_max.js": "./src/array_max.js",
91
- "./array_min.js": "./src/array_min.js",
92
- "./array_permutations.js": "./src/array_permutations.js",
93
- "./array_shuffle.js": "./src/array_shuffle.js",
94
- "./array_sort.js": "./src/array_sort.js",
95
- "./array_sort_other.js": "./src/array_sort_other.js",
96
- "./array_sum.js": "./src/array_sum.js",
97
- "./array_unique.js": "./src/array_unique.js",
98
- "./array_unique_last.js": "./src/array_unique_last.js",
99
- "./date_add_hours.js": "./src/date_add_hours.js",
100
- "./date_add_milliseconds.js": "./src/date_add_milliseconds.js",
101
- "./date_add_minutes.js": "./src/date_add_minutes.js",
102
- "./date_add_months.js": "./src/date_add_months.js",
103
- "./date_add_seconds.js": "./src/date_add_seconds.js",
104
- "./date_diff_seconds.js": "./src/date_diff_seconds.js",
105
- "./date_is_leap_year.js": "./src/date_is_leap_year.js",
106
- "./fcmp_dates.js": "./src/fcmp_dates.js",
107
- "./fcmp_default.js": "./src/fcmp_default.js",
108
- "./fcmp_default_desc.js": "./src/fcmp_default_desc.js",
109
- "./fcmp_from_spec.js": "./src/fcmp_from_spec.js",
110
- "./fcmp_numbers.js": "./src/fcmp_numbers.js",
111
- "./fcmp_tuples.js": "./src/fcmp_tuples.js",
112
- "./fcmp_utf8_bin.js": "./src/fcmp_utf8_bin.js",
113
- "./fcmp_utf8_ci.js": "./src/fcmp_utf8_ci.js",
114
- "./fcmp_utf8_cs.js": "./src/fcmp_utf8_cs.js",
115
- "./fcmp_utf8_natural_ci.js": "./src/fcmp_utf8_natural_ci.js",
116
- "./fcmp_utf8_natural_cs.js": "./src/fcmp_utf8_natural_cs.js",
117
- "./fcmpx.js": "./src/fcmpx.js",
118
- "./filter1_from_spec.js": "./src/filter1_from_spec.js",
119
- "./format_bytes.js": "./src/format_bytes.js",
120
- "./format_date.js": "./src/format_date.js",
121
- "./format_date_fs.js": "./src/format_date_fs.js",
122
- "./format_date_human.js": "./src/format_date_human.js",
123
- "./format_date_ymd.js": "./src/format_date_ymd.js",
124
- "./format_error_report.js": "./src/format_error_report.js",
125
- "./format_hrtime.js": "./src/format_hrtime.js",
126
- "./format_kilo.js": "./src/format_kilo.js",
127
- "./format_ms.js": "./src/format_ms.js",
128
- "./format_ms2.js": "./src/format_ms2.js",
129
- "./format_ms3.js": "./src/format_ms3.js",
130
- "./format_percents.js": "./src/format_percents.js",
131
- "./format_progress_bytes.js": "./src/format_progress_bytes.js",
132
- "./format_progress_kilo.js": "./src/format_progress_kilo.js",
133
- "./format_seconds.js": "./src/format_seconds.js",
134
- "./format_thousands.js": "./src/format_thousands.js",
135
- "./http_delete.js": "./src/http_delete.js",
136
- "./http_get_blob.js": "./src/http_get_blob.js",
137
- "./http_get_buffer.js": "./src/http_get_buffer.js",
138
- "./http_get_json.js": "./src/http_get_json.js",
139
- "./http_get_utf8.js": "./src/http_get_utf8.js",
140
- "./http_head.js": "./src/http_head.js",
141
- "./http_patch_json.js": "./src/http_patch_json.js",
142
- "./http_post_json.js": "./src/http_post_json.js",
143
- "./http_post_multipart.js": "./src/http_post_multipart.js",
144
- "./http_put_buffer.js": "./src/http_put_buffer.js",
145
- "./http_put_json.js": "./src/http_put_json.js",
146
- "./http_put_utf8.js": "./src/http_put_utf8.js",
147
- "./identity.js": "./src/identity.js",
148
- "./ignore.js": "./src/ignore.js",
149
- "./plural.js": "./src/plural.js",
150
- "./random_int.js": "./src/random_int.js",
151
- "./urlmod.js": "./src/urlmod.js",
152
- "./waitcb.js": "./src/waitcb.js"
153
- };
154
-
155
-
156
- function webpackContext(req) {
157
- var id = webpackContextResolve(req);
158
- return __webpack_require__(id);
159
- }
160
- function webpackContextResolve(req) {
161
- if(!__webpack_require__.o(map, req)) {
162
- var e = new Error("Cannot find module '" + req + "'");
163
- e.code = 'MODULE_NOT_FOUND';
164
- throw e;
165
- }
166
- return map[req];
167
- }
168
- webpackContext.keys = function webpackContextKeys() {
169
- return Object.keys(map);
170
- };
171
- webpackContext.resolve = webpackContextResolve;
172
- module.exports = webpackContext;
173
- webpackContext.id = "./src sync recursive ^(?%21.*(cli-apps%7Cbrowser%7C\\.d)\\/).*\\b(array%7Cdate%7Chttp_delete%7Chttp_get_blob%7Chttp_get_buffer%7Chttp_get_json%7Chttp_get_utf8%7Chttp_head%7Chttp_patch_json%7Chttp_post_json%7Chttp_post_multipart%7Chttp_put_buffer%7Chttp_put_json%7Chttp_put_utf8%7Cidentity%7Cignore%7Cfcmp%7Cfilter%7Cformat%7Cplural%7Crandom_int%7Curlmod%7Cwaitcb)[^/]*(?<%21\\.test)\\.js$";
174
-
175
- /***/ }),
176
-
177
- /***/ "./src/array_chunk.js":
178
- /*!****************************!*\
179
- !*** ./src/array_chunk.js ***!
180
- \****************************/
181
- /***/ ((module) => {
182
-
183
- /**
184
- * Split an array into chunks.
185
- *
186
- * @param array
187
- * @param limit
188
- * @returns {*[]}
189
- */
190
- function array_chunk(array = [], limit = 1)
191
- {
192
- if (limit < 1) {
193
- throw new Error('Limit value should be greater than 1');
194
- }
195
-
196
- const out = [];
197
- for (let i = 0, end = array.length; i < end; i += limit) {
198
- out.push(array.slice(i, i + limit));
199
- }
200
- return out;
201
- }
202
-
203
- module.exports = array_chunk;
204
-
205
-
206
- /***/ }),
207
-
208
- /***/ "./src/array_chunk_balanced.js":
209
- /*!*************************************!*\
210
- !*** ./src/array_chunk_balanced.js ***!
211
- \*************************************/
212
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
213
-
214
- const clamp = __webpack_require__(/*! ./clamp */ "./src/clamp.js");
215
-
216
- /**
217
- * Split an array into up to `max_chunks` balanced chunks, while ensuring that
218
- * each chunk contains at least `min_items_per_chunk` items (when possible).
219
- *
220
- * The function distributes items as evenly as possible:
221
- * - Chunk sizes differ by at most 1 item.
222
- * - The number of chunks never exceeds `max_chunks`.
223
- *
224
- * Originally designed for distributing workload across threads
225
- * (e.g. `array_chunk_balanced(jobs, max_threads, min_jobs_per_thread)`).
226
- *
227
- * Edge cases:
228
- * - If the input array is empty → returns [].
229
- * - If there are too few items to satisfy `min_items_per_chunk`, even for a single
230
- * chunk, all items are placed into one chunk.
231
- *
232
- * @param {Array} array
233
- * @param {number} max_chunks
234
- * @param {number} min_items_per_chunk
235
- * @returns {Array<Array>}
236
- */
237
- function array_chunk_balanced(array = [], max_chunks = 1, min_items_per_chunk = 1)
238
- {
239
- const total_chunks = clamp(1, max_chunks, Math.floor(array.length / min_items_per_chunk));
240
- const items_per_chunk = Math.floor(array.length / total_chunks);
241
- let extra = array.length % total_chunks;
242
-
243
- const out = [];
244
- for (let i = 0; i < array.length; ) {
245
- const size = items_per_chunk + (extra ? 1 : 0);
246
- out.push(array.slice(i, i + size));
247
- i += size;
248
- if (extra) {
249
- extra--;
250
- }
251
- }
252
- return out;
253
- }
254
-
255
- module.exports = array_chunk_balanced;
256
-
257
-
258
- /***/ }),
259
-
260
- /***/ "./src/array_fps.js":
261
- /*!**************************!*\
262
- !*** ./src/array_fps.js ***!
263
- \**************************/
264
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
265
-
266
- const round = __webpack_require__(/*! ./round */ "./src/round.js");
267
-
268
- const EPS = 0.00001;
269
-
270
- function array_fps(duration_sec, fps)
271
- {
272
- const total_frames = Math.floor(duration_sec * fps);
273
-
274
- if (total_frames <= 1) {
275
- return [0];
276
- }
277
-
278
- const out = [];
279
- for (let i = 0; i < total_frames; ++i) {
280
- out.push(round((i / (total_frames - 1)) * (duration_sec - EPS), EPS));
281
- }
282
- return out;
283
- }
284
-
285
- module.exports = array_fps;
286
-
287
-
288
- /***/ }),
289
-
290
- /***/ "./src/array_gcd.js":
291
- /*!**************************!*\
292
- !*** ./src/array_gcd.js ***!
293
- \**************************/
294
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
295
-
296
- const math_gcd = __webpack_require__(/*! ./math_gcd */ "./src/math_gcd.js");
297
-
298
- // https://stackoverflow.com/a/39764792/1478566
299
- function array_gcd(array, fn = Number)
300
- {
301
- return array.reduce((a,b) => math_gcd(fn(a), fn(b)));
302
- }
303
-
304
- module.exports = array_gcd;
305
-
306
-
307
- /***/ }),
308
-
309
- /***/ "./src/array_group.js":
310
- /*!****************************!*\
311
- !*** ./src/array_group.js ***!
312
- \****************************/
313
- /***/ ((module) => {
314
-
315
- /**
316
- * Group items by a common key and return an array of groups.
317
- *
318
- * @alternative Map.groupBy(items, fn)
319
- */
320
- function array_group(array, fn)
321
- {
322
- const map = new Map();
323
- array.forEach(function (item) {
324
- const key = fn(item);
325
- if (!map.has(key)) {
326
- map.set(key, {key, items: []});
327
- }
328
- map.get(key).items.push(item);
329
- });
330
- return map.values().toArray();
331
- }
332
-
333
- module.exports = array_group;
334
-
335
-
336
- /***/ }),
337
-
338
- /***/ "./src/array_group_map.js":
339
- /*!********************************!*\
340
- !*** ./src/array_group_map.js ***!
341
- \********************************/
342
- /***/ ((module) => {
343
-
344
- /**
345
- * Group items by common key and return an object of items grouped by key.
346
- *
347
- * @param array
348
- * @param fn
349
- * @returns {{}}
350
- */
351
- function array_group_map(array, fn)
352
- {
353
- const out = {};
354
- array.forEach(function (item) {
355
- const key = fn(item);
356
- out[key] = out[key] || {key, items: []};
357
- out[key].items.push(item);
358
- });
359
- return out;
360
- }
361
-
362
- module.exports = array_group_map;
363
-
364
-
365
- /***/ }),
366
-
367
- /***/ "./src/array_index.js":
368
- /*!****************************!*\
369
- !*** ./src/array_index.js ***!
370
- \****************************/
371
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
372
-
373
- const identity = __webpack_require__(/*! ./identity */ "./src/identity.js");
374
-
375
- /**
376
- * Usage:
377
- * array_index(items, v => v.name)
378
- *
379
- * Seems, there is a native way to do it:
380
- * Object.fromEntries(items.map(v => [v.name, v]));
381
- */
382
- function array_index(array, fn = identity)
383
- {
384
- const out = {};
385
- array.forEach(v => out[fn(v)] = v);
386
- return out;
387
- }
388
-
389
- module.exports = array_index;
390
-
391
-
392
- /***/ }),
393
-
394
- /***/ "./src/array_lcm.js":
395
- /*!**************************!*\
396
- !*** ./src/array_lcm.js ***!
397
- \**************************/
398
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
399
-
400
- const math_lcm = __webpack_require__(/*! ./math_lcm */ "./src/math_lcm.js");
401
-
402
- function array_lcm(array, fn = Number)
403
- {
404
- return array.reduce((a,b) => math_lcm(fn(a), fn(b)));
405
- }
406
-
407
- module.exports = array_lcm;
408
-
409
-
410
- /***/ }),
411
-
412
- /***/ "./src/array_max.js":
413
- /*!**************************!*\
414
- !*** ./src/array_max.js ***!
415
- \**************************/
416
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
417
-
418
- const identity = __webpack_require__(/*! ./identity */ "./src/identity.js");
419
-
420
- /**
421
- * Returns the first element in the array with the maximal weight
422
- */
423
- function array_max(array, fn = identity)
424
- {
425
- let out = null;
426
- let max = null;
427
- array.forEach(function (item, i) {
428
- const weight = fn(item);
429
- if (i === 0 || max < weight) {
430
- max = weight;
431
- out = item;
432
- }
433
- });
434
- return out;
435
- }
436
-
437
- module.exports = array_max;
438
-
439
-
440
- /***/ }),
441
-
442
- /***/ "./src/array_min.js":
443
- /*!**************************!*\
444
- !*** ./src/array_min.js ***!
445
- \**************************/
446
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
447
-
448
- const identity = __webpack_require__(/*! ./identity */ "./src/identity.js");
449
-
450
- /**
451
- * Returns the first element in the array with the minimal weight
452
- */
453
- function array_min(array, fn = identity)
454
- {
455
- let out = null;
456
- let min = null;
457
- array.forEach(function (item, i) {
458
- const weight = fn(item);
459
- if (i === 0 || min > weight) {
460
- min = weight;
461
- out = item;
462
- }
463
- });
464
- return out;
465
- }
466
-
467
- module.exports = array_min;
468
-
469
-
470
- /***/ }),
471
-
472
- /***/ "./src/array_permutations.js":
473
- /*!***********************************!*\
474
- !*** ./src/array_permutations.js ***!
475
- \***********************************/
476
- /***/ ((module) => {
477
-
478
- // https://stackoverflow.com/a/37580979/23502239
479
- function array_permutations(array, k = array.length)
480
- {
481
- if (k !== array.length) {
482
- return array_permutations_k(array, k);
483
- }
484
-
485
- let length = array.length;
486
- let out = [array.slice()];
487
- let c = new Array(length).fill(0);
488
- let i = 1, kk, p;
489
-
490
- while (i < length) {
491
- if (c[i] < i) {
492
- kk = i % 2 && c[i];
493
- p = array[i];
494
- array[i] = array[kk];
495
- array[kk] = p;
496
- ++c[i];
497
- i = 1;
498
- out.push(array.slice());
499
- }
500
- else {
501
- c[i] = 0;
502
- ++i;
503
- }
504
- }
505
- return out;
506
- }
507
-
508
- function array_permutations_k(array, k)
509
- {
510
- if (k === 0) {
511
- return [
512
- []
513
- ];
514
- }
515
- if (array.length < k) {
516
- return [];
517
- }
518
-
519
- const out = [];
520
- for (let i = 0; i < array.length; i++) {
521
- const rest = array.slice(0, i).concat(array.slice(i + 1));
522
- for (const perm of array_permutations(rest, k - 1)) {
523
- out.push([array[i], ...perm]);
524
- }
525
- }
526
- return out;
527
- }
528
-
529
- module.exports = array_permutations;
530
-
531
-
532
- /***/ }),
533
-
534
- /***/ "./src/array_shuffle.js":
535
- /*!******************************!*\
536
- !*** ./src/array_shuffle.js ***!
537
- \******************************/
538
- /***/ ((module) => {
539
-
540
- /**
541
- * Shuffles an array using Durstenfeld shuffle algorithm.
542
- *
543
- * Note: This function performs shuffle in-place. In order
544
- * to get a shuffled copy use call slice before calling, e.g.
545
- * array_shuffle(items.slice()).
546
- *
547
- * @param array
548
- * @returns array
549
- * @link https://stackoverflow.com/a/6274381/1478566
550
- * @link https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle
551
- */
552
- function array_shuffle(array)
553
- {
554
- for (let i = array.length; --i > 0; ) {
555
- const j = Math.floor(Math.random() * (i + 1));
556
- const x = array[i];
557
- array[i] = array[j];
558
- array[j] = x;
559
- }
560
- return array;
561
- }
562
-
563
- module.exports = array_shuffle;
564
-
565
-
566
- /***/ }),
567
-
568
- /***/ "./src/array_sort.js":
569
- /*!***************************!*\
570
- !*** ./src/array_sort.js ***!
571
- \***************************/
572
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
573
-
574
- const fcmp_default = __webpack_require__(/*! ./fcmp_default */ "./src/fcmp_default.js");
575
- const fcmp_tuples = __webpack_require__(/*! ./fcmp_tuples */ "./src/fcmp_tuples.js");
576
-
577
- /**
578
- * Sorts an array in place by the result of applying `fn` to each item,
579
- * using `fcmp` to compare the results.
580
- *
581
- * array_sort(items, v => [v.name])
582
- * array_sort(items, v => [v.age, v.name])
583
- */
584
- function array_sort(array, mapper, fcmp = fcmp_default)
585
- {
586
- const keys = new Map();
587
- return array.sort(function (a, b) {
588
- if (!keys.has(a)) {
589
- keys.set(a, mapper(a));
590
- }
591
- if (!keys.has(b)) {
592
- keys.set(b, mapper(b));
593
- }
594
- return fcmp_tuples(keys.get(a), keys.get(b), fcmp);
595
- });
596
- }
597
-
598
- // function array_sort(array, fn = identity, fcmp = fcmp_default)
599
- // {
600
- // return array.sort(function (a, b) {
601
- // return fcmp(fn(a), fn(b));
602
- // });
603
- // }
604
-
605
- module.exports = array_sort;
606
-
607
-
608
- /***/ }),
609
-
610
- /***/ "./src/array_sort_other.js":
611
- /*!*********************************!*\
612
- !*** ./src/array_sort_other.js ***!
613
- \*********************************/
614
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
615
-
616
- const fcmp_default = __webpack_require__(/*! ./fcmp_default */ "./src/fcmp_default.js");
617
-
618
- /**
619
- * Sort items in an `array` at the same order as in `other`. Values which
620
- * are not in the `other` are added to the end of the result defined by `fcmp`.
621
- *
622
- * @param array
623
- * @param fn
624
- * @param other
625
- * @param fcmp
626
- * @returns {*}
627
- */
628
- function array_sort_other(array, fn, other, fcmp = fcmp_default)
629
- {
630
- const other_map = {};
631
- other.forEach((v,i) => other_map[v] = i + 1);
632
- return array.sort(function (a, b) {
633
- const ax = other_map[fn(a)];
634
- const bx = other_map[fn(b)];
635
- if (ax && bx) {
636
- return ax - bx;
637
- }
638
- if (ax) {
639
- return -1;
640
- }
641
- if (bx) {
642
- return 1;
643
- }
644
- return fcmp(a, b);
645
- });
646
- }
647
-
648
- module.exports = array_sort_other;
649
-
650
-
651
- /***/ }),
652
-
653
- /***/ "./src/array_sum.js":
654
- /*!**************************!*\
655
- !*** ./src/array_sum.js ***!
656
- \**************************/
657
- /***/ ((module) => {
658
-
659
- function array_sum(array, fn = Number)
660
- {
661
- let out = 0;
662
- array.forEach(function (item) {
663
- out += fn(item);
664
- });
665
- return out;
666
- }
667
-
668
- module.exports = array_sum;
669
-
670
-
671
- /***/ }),
672
-
673
- /***/ "./src/array_unique.js":
674
- /*!*****************************!*\
675
- !*** ./src/array_unique.js ***!
676
- \*****************************/
677
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
678
-
679
- const identity = __webpack_require__(/*! ./identity */ "./src/identity.js");
680
-
681
- /**
682
- * Return unique values; if a value occurs multiple times, keep the first one.
683
- */
684
- function array_unique(values, fn = identity)
685
- {
686
- const set = new Set();
687
- return values.filter(function (item) {
688
- const key = fn(item);
689
- if (set.has(key)) {
690
- return false;
691
- }
692
- set.add(key);
693
- return true;
694
- });
695
- }
696
-
697
- module.exports = array_unique;
698
-
699
-
700
- /***/ }),
701
-
702
- /***/ "./src/array_unique_last.js":
703
- /*!**********************************!*\
704
- !*** ./src/array_unique_last.js ***!
705
- \**********************************/
706
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
707
-
708
- const identity = __webpack_require__(/*! ./identity */ "./src/identity.js");
709
-
710
- /**
711
- * Return unique values; if a value occurs multiple times, keep the last one.
712
- */
713
- function array_unique_last(array, fn = identity)
714
- {
715
- const out = [];
716
- const set = new Set();
717
- for (let i = array.length; --i >= 0; ) {
718
- const item = array[i];
719
- const key = fn(item);
720
- if (!set.has(key)) {
721
- set.add(key);
722
- out.push(item);
723
- }
724
- }
725
- return out.reverse();
726
- }
727
-
728
- module.exports = array_unique_last;
729
-
730
-
731
- /***/ }),
732
-
733
- /***/ "./src/clamp.js":
734
- /*!**********************!*\
735
- !*** ./src/clamp.js ***!
736
- \**********************/
737
- /***/ ((module) => {
738
-
739
- function clamp(min, max, value)
740
- {
741
- return Math.max(min, Math.min(max, value));
742
- }
743
-
744
- module.exports = clamp;
745
-
746
-
747
- /***/ }),
748
-
749
- /***/ "./src/date_add_hours.js":
750
- /*!*******************************!*\
751
- !*** ./src/date_add_hours.js ***!
752
- \*******************************/
753
- /***/ ((module) => {
754
-
755
- function date_add_hours(date, hours)
756
- {
757
- date.setHours(date.getHours() + hours);
758
- return date;
759
- }
760
-
761
- module.exports = date_add_hours;
762
-
763
-
764
- /***/ }),
765
-
766
- /***/ "./src/date_add_milliseconds.js":
767
- /*!**************************************!*\
768
- !*** ./src/date_add_milliseconds.js ***!
769
- \**************************************/
770
- /***/ ((module) => {
771
-
772
- function date_add_milliseconds(date, milliseconds)
773
- {
774
- date.setMilliseconds(date.getMilliseconds() + milliseconds);
775
- return date;
776
- }
777
-
778
- module.exports = date_add_milliseconds;
779
-
780
-
781
- /***/ }),
782
-
783
- /***/ "./src/date_add_minutes.js":
784
- /*!*********************************!*\
785
- !*** ./src/date_add_minutes.js ***!
786
- \*********************************/
787
- /***/ ((module) => {
788
-
789
- function date_add_minutes(date, minutes)
790
- {
791
- date.setMinutes(date.getMinutes() + minutes);
792
- return date;
793
- }
794
-
795
- module.exports = date_add_minutes;
796
-
797
-
798
- /***/ }),
799
-
800
- /***/ "./src/date_add_months.js":
801
- /*!********************************!*\
802
- !*** ./src/date_add_months.js ***!
803
- \********************************/
804
- /***/ ((module) => {
805
-
806
- /**
807
- * @link https://stackoverflow.com/a/7937257
808
- */
809
- function date_add_months(d, months)
810
- {
811
- if (!months) {
812
- return d;
813
- }
814
-
815
- // https://github.com/briannesbitt/Carbon/blob/f01cfa96468f4c38325f507ab81a4f1d2cd93cfe/src/Carbon/Traits/Units.php#L360C1-L361C1
816
- // > } elseif (isset($canOverflow, $day) && $canOverflow && $day !== $date?->day) {
817
- // > $date = $date?->modify('last day of previous month');
818
- // > }
819
-
820
- const date0 = d.getDate();
821
- d.setMonth(d.getMonth() + months);
822
- if (d.getDate() !== date0) {
823
- d.setDate(0);
824
- }
825
-
826
- return d;
827
- }
828
-
829
- module.exports = date_add_months;
830
-
831
-
832
- /***/ }),
833
-
834
- /***/ "./src/date_add_seconds.js":
835
- /*!*********************************!*\
836
- !*** ./src/date_add_seconds.js ***!
837
- \*********************************/
838
- /***/ ((module) => {
839
-
840
- function date_add_seconds(date, seconds)
841
- {
842
- date.setSeconds(date.getSeconds() + seconds);
843
- return date;
844
- }
845
-
846
- module.exports = date_add_seconds;
847
-
848
-
849
- /***/ }),
850
-
851
- /***/ "./src/date_diff_seconds.js":
852
- /*!**********************************!*\
853
- !*** ./src/date_diff_seconds.js ***!
854
- \**********************************/
855
- /***/ ((module) => {
856
-
857
- function date_diff_seconds(a, b)
858
- {
859
- return Math.floor((a.getTime() - b.getTime())/1000);
860
- }
861
-
862
- module.exports = date_diff_seconds;
863
-
864
-
865
- /***/ }),
866
-
867
- /***/ "./src/date_is_leap_year.js":
868
- /*!**********************************!*\
869
- !*** ./src/date_is_leap_year.js ***!
870
- \**********************************/
871
- /***/ ((module) => {
872
-
873
- /**
874
- * @link https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/src/lib/utils/is-leap-year.js
875
- * @link https://en.wikipedia.org/wiki/Leap_year
876
- * > Each leap year has 366 days instead of 365. This extra leap day
877
- * > occurs in each year that is a multiple of 4, except for years
878
- * > evenly divisible by 100 but not by 400.
879
- */
880
- function date_is_leap_year(d)
881
- {
882
- const year = d.getFullYear();
883
- // return (year % 4 === 0) && !(year % 100 === 0 && year % 400 !== 0);
884
- return (year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0);
885
- }
886
-
887
- module.exports = date_is_leap_year;
888
-
889
-
890
- /***/ }),
891
-
892
- /***/ "./src/factorize_ms.js":
893
- /*!*****************************!*\
894
- !*** ./src/factorize_ms.js ***!
895
- \*****************************/
896
- /***/ ((module) => {
897
-
898
- function factorize_ms(v)
899
- {
900
- const h = Math.floor(v / 3600000);
901
- const m = Math.floor(v % 3600000 / 60000);
902
- const s = Math.floor(v % 60000 / 1000);
903
- const ms = v % 1000;
904
- return [h, m, s, ms];
905
- }
906
-
907
- module.exports = factorize_ms;
908
-
909
-
910
- /***/ }),
911
-
912
- /***/ "./src/fcmp_dates.js":
913
- /*!***************************!*\
914
- !*** ./src/fcmp_dates.js ***!
915
- \***************************/
916
- /***/ ((module) => {
917
-
918
- function fcmp_dates(a, b)
919
- {
920
- return a.getTime() - b.getTime();
921
- }
922
-
923
- module.exports = fcmp_dates;
924
-
925
-
926
- /***/ }),
927
-
928
- /***/ "./src/fcmp_default.js":
929
- /*!*****************************!*\
930
- !*** ./src/fcmp_default.js ***!
931
- \*****************************/
932
- /***/ ((module) => {
933
-
934
- function fcmp_default(a, b)
935
- {
936
- if (a < b) {
937
- return -1;
938
- }
939
- if (a > b) {
940
- return 1;
941
- }
942
- return 0;
943
- }
944
-
945
- module.exports = fcmp_default;
946
-
947
-
948
- /***/ }),
949
-
950
- /***/ "./src/fcmp_default_desc.js":
951
- /*!**********************************!*\
952
- !*** ./src/fcmp_default_desc.js ***!
953
- \**********************************/
954
- /***/ ((module) => {
955
-
956
- function fcmp_default_desc(b, a)
957
- {
958
- if (a < b) {
959
- return -1;
960
- }
961
- if (a > b) {
962
- return 1;
963
- }
964
- return 0;
965
- }
966
-
967
- module.exports = fcmp_default_desc;
968
-
969
-
970
- /***/ }),
971
-
972
- /***/ "./src/fcmp_from_spec.js":
973
- /*!*******************************!*\
974
- !*** ./src/fcmp_from_spec.js ***!
975
- \*******************************/
976
- /***/ ((module) => {
977
-
978
- /**
979
- * Create fcmp from an array of props. For desc order a prop should be prefixed
980
- * with minus sign (e.g. -price).
981
- *
982
- * @deprecated Deprecated in favor of fcmpx
983
- */
984
- function fcmp_from_spec(props)
985
- {
986
- const fcmp = props.map(one);
987
- switch (fcmp.length) {
988
- case 0:
989
- return () => 0;
990
- case 1:
991
- return fcmp[0];
992
- case 2:
993
- return function (a, b) {
994
- return fcmp[0](a, b) || fcmp[1](a, b);
995
- };
996
- case 3:
997
- return function (a, b) {
998
- return fcmp[0](a, b) || fcmp[1](a, b) || fcmp[2](a, b);
999
- };
1000
- default:
1001
- return function (a, b) {
1002
- for (let i = 0; i < fcmp.length; ++i) {
1003
- const tmp = fcmp[i](a, b);
1004
- if (tmp) {
1005
- return tmp;
1006
- }
1007
- }
1008
- return 0;
1009
- };
1010
- }
1011
- }
1012
-
1013
- function one(prop)
1014
- {
1015
- if (prop[0] === '-') {
1016
- prop = prop.slice(1);
1017
- return function (b, a) {
1018
- return comp_types(a[prop], b[prop]);
1019
- };
1020
- }
1021
- return function (a, b) {
1022
- return comp_types(a[prop], b[prop]);
1023
- };
1024
- }
1025
-
1026
- function comp_types(a, b)
1027
- {
1028
- if (typeof a === 'string' && typeof b === 'string') {
1029
- return a.localeCompare(b);
1030
- }
1031
- return a - b;
1032
- }
1033
-
1034
- module.exports = fcmp_from_spec;
1035
-
1036
-
1037
- /***/ }),
1038
-
1039
- /***/ "./src/fcmp_numbers.js":
1040
- /*!*****************************!*\
1041
- !*** ./src/fcmp_numbers.js ***!
1042
- \*****************************/
1043
- /***/ ((module) => {
1044
-
1045
- function fcmp_numbers(a, b)
1046
- {
1047
- return a - b;
1048
- }
1049
-
1050
- module.exports = fcmp_numbers;
1051
-
1052
-
1053
- /***/ }),
1054
-
1055
- /***/ "./src/fcmp_tuples.js":
1056
- /*!****************************!*\
1057
- !*** ./src/fcmp_tuples.js ***!
1058
- \****************************/
1059
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1060
-
1061
- const fcmp_default = __webpack_require__(/*! ./fcmp_default */ "./src/fcmp_default.js");
1062
-
1063
- function fcmp_tuples(a, b, fcmp = fcmp_default)
1064
- {
1065
- const end = Math.min(a.length, b.length);
1066
- for (let i = 0; i < end; ++i) {
1067
- const tmp = fcmp(a[i], b[i]);
1068
- if (tmp) {
1069
- return tmp;
1070
- }
1071
- }
1072
- return 0;
1073
- }
1074
-
1075
- module.exports = fcmp_tuples;
1076
-
1077
-
1078
- /***/ }),
1079
-
1080
- /***/ "./src/fcmp_utf8_bin.js":
1081
- /*!******************************!*\
1082
- !*** ./src/fcmp_utf8_bin.js ***!
1083
- \******************************/
1084
- /***/ ((module) => {
1085
-
1086
- // Strict binary (codepoint) comparison, like MySQL's utf8_bin collation
1087
- function fcmp_utf8_bin(a, b)
1088
- {
1089
- if (a < b) {
1090
- return -1;
1091
- }
1092
- if (a > b) {
1093
- return 1;
1094
- }
1095
- return 0;
1096
- }
1097
-
1098
- module.exports = fcmp_utf8_bin;
1099
-
1100
-
1101
- /***/ }),
1102
-
1103
- /***/ "./src/fcmp_utf8_ci.js":
1104
- /*!*****************************!*\
1105
- !*** ./src/fcmp_utf8_ci.js ***!
1106
- \*****************************/
1107
- /***/ ((module) => {
1108
-
1109
- // Locale-aware, case-insensitive, like utf8_ci or utf8mb4_ci
1110
- function fcmp_utf8_ci(a, b)
1111
- {
1112
- return a.localeCompare(b, undefined, {sensitivity: 'base'});
1113
- }
1114
-
1115
- module.exports = fcmp_utf8_ci;
1116
-
1117
-
1118
- /***/ }),
1119
-
1120
- /***/ "./src/fcmp_utf8_cs.js":
1121
- /*!*****************************!*\
1122
- !*** ./src/fcmp_utf8_cs.js ***!
1123
- \*****************************/
1124
- /***/ ((module) => {
1125
-
1126
- // Locale-aware, case-sensitive, like utf8_cs or utf8mb4_cs (but using system locale)
1127
- function fcmp_utf8_cs(a, b)
1128
- {
1129
- return a.localeCompare(b, undefined, {sensitivity: 'variant'});
1130
- }
1131
-
1132
- module.exports = fcmp_utf8_cs;
1133
-
1134
-
1135
- /***/ }),
1136
-
1137
- /***/ "./src/fcmp_utf8_natural_ci.js":
1138
- /*!*************************************!*\
1139
- !*** ./src/fcmp_utf8_natural_ci.js ***!
1140
- \*************************************/
1141
- /***/ ((module) => {
1142
-
1143
- // Natural sort (numeric), case-insensitive
1144
- function fcmp_utf8_natural_ci(a, b)
1145
- {
1146
- return a.localeCompare(b, undefined, {numeric: true, sensitivity: 'base'});
1147
- }
1148
-
1149
- module.exports = fcmp_utf8_natural_ci;
1150
-
1151
-
1152
- /***/ }),
1153
-
1154
- /***/ "./src/fcmp_utf8_natural_cs.js":
1155
- /*!*************************************!*\
1156
- !*** ./src/fcmp_utf8_natural_cs.js ***!
1157
- \*************************************/
1158
- /***/ ((module) => {
1159
-
1160
- // Natural sort (numeric), case-sensitive
1161
- function fcmp_utf8_natural_cs(a, b)
1162
- {
1163
- return a.localeCompare(b, undefined, {numeric: true, sensitivity: 'variant'});
1164
- }
1165
-
1166
- module.exports = fcmp_utf8_natural_cs;
1167
-
1168
-
1169
- /***/ }),
1170
-
1171
- /***/ "./src/fcmpx.js":
1172
- /*!**********************!*\
1173
- !*** ./src/fcmpx.js ***!
1174
- \**********************/
1175
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1176
-
1177
- const fcmp_default = __webpack_require__(/*! ./fcmp_default */ "./src/fcmp_default.js");
1178
- const fcmp_default_desc = __webpack_require__(/*! ./fcmp_default_desc */ "./src/fcmp_default_desc.js");
1179
- const identity = __webpack_require__(/*! ./identity */ "./src/identity.js");
1180
-
1181
- const MISSING = Symbol('fcmpx.missing');
1182
-
1183
- /**
1184
- * Comparator builder using compact expressions.
1185
- *
1186
- * fcmp expression — Creates an `fcmp` function from an expression, suitable for use with `[].sort()`.
1187
- *
1188
- * fcmpx('user.email')
1189
- * fcmpx('-user.age,user.email')
1190
- * fcmpx(v => v.user.email)
1191
- * fcmpx(['user.age', 'user.email'])
1192
- * fcmpx(['-user.age', 'user.email'])
1193
- */
1194
- function fcmpx(expr)
1195
- {
1196
- if (typeof expr === 'string') {
1197
- if (expr.includes(',')) {
1198
- return fcmpx(expr.split(','));
1199
- }
1200
- return fcmpx_compile(expr);
1201
- }
1202
- if (!Array.isArray(expr)) {
1203
- return fcmpx_compile(expr);
1204
- }
1205
- const fcmp_items = expr.map(fcmpx_parse);
1206
- return function (a, b) {
1207
- const tuple1 = fcmp_items.map(v => v.read(a));
1208
- const tuple2 = fcmp_items.map(v => v.read(b));
1209
- for (let i = 0; i < fcmp_items.length; ++i) {
1210
- const tmp = fcmp_items[i].fcmp(tuple1[i], tuple2[i]);
1211
- if (tmp) {
1212
- return tmp;
1213
- }
1214
- }
1215
- return 0;
1216
- };
1217
- }
1218
-
1219
- function fcmpx_compile(expr)
1220
- {
1221
- const {read, fcmp} = fcmpx_parse(expr);
1222
- return function (a, b) {
1223
- return fcmp(read(a), read(b));
1224
- };
1225
- }
1226
-
1227
- function fcmpx_parse(expr)
1228
- {
1229
- if (typeof expr === 'function') {
1230
- return {read: fcmpx_compile_read(expr), fcmp: fcmp_wrapper(fcmp_default)};
1231
- }
1232
- if (typeof expr === 'string') {
1233
- const desc = expr.startsWith('-');
1234
- const read = desc ? fcmpx_compile_read(expr.slice(1)) : fcmpx_compile_read(expr);
1235
- const fcmp = fcmp_wrapper(desc ? fcmp_default_desc : fcmp_default);
1236
- return {read, fcmp};
1237
- }
1238
- const fcmp_user = expr.fcmp;
1239
- const read = fcmpx_compile_read(expr.read);
1240
- const desc = expr.desc ?? false;
1241
- const fcmp = fcmp_wrapper(desc ? (fcmp_user ? (b, a) => fcmp_user(a, b) : fcmp_default_desc) : (fcmp_user ?? fcmp_default));
1242
- if (Array.isArray(expr.top)) {
1243
- const priority = new Map(expr.top.map((v, i) => [v, i]));
1244
- return {read: v => priority.get(read(v)) ?? priority.size, fcmp};
1245
- }
1246
- if (Array.isArray(expr.bottom)) {
1247
- const priority = new Map(expr.bottom.map((v, i) => [v, i]));
1248
- return {read: v => priority.get(read(v)) ?? -1, fcmp};
1249
- }
1250
- return {read, fcmp};
1251
- }
1252
-
1253
- function fcmpx_compile_read(read)
1254
- {
1255
- if (read === undefined || read === '' || read === '.') {
1256
- return identity;
1257
- }
1258
- if (typeof read === 'function') {
1259
- return function (value) {
1260
- return read(value) ?? MISSING;
1261
- };
1262
- }
1263
- if (typeof read === 'string') {
1264
- const props = read.split('.');
1265
- const [a, b, c, d, e] = props;
1266
- switch (props.length) {
1267
- case 1: return v => v?.[a] ?? MISSING;
1268
- case 2: return v => v?.[a]?.[b] ?? MISSING;
1269
- case 3: return v => v?.[a]?.[b]?.[c] ?? MISSING;
1270
- case 4: return v => v?.[a]?.[b]?.[c]?.[d] ?? MISSING;
1271
- case 5: return v => v?.[a]?.[b]?.[c]?.[d]?.[e] ?? MISSING;
1272
- default: return v => props.reduce((a,p) => a?.[p], v) ?? MISSING;
1273
- }
1274
- }
1275
- return v => v?.[read] ?? MISSING;
1276
- }
1277
-
1278
- // Sorting rule: Missing values are considered greater than any defined value
1279
- // and are therefore placed after all defined values.
1280
- function fcmp_wrapper(fcmp)
1281
- {
1282
- return function (a, b) {
1283
- if (a === MISSING) {
1284
- if (b === MISSING) {
1285
- return 0;
1286
- }
1287
- return 1;
1288
- }
1289
- if (b === MISSING) {
1290
- return -1;
1291
- }
1292
- return fcmp(a, b);
1293
- };
1294
- }
1295
-
1296
- module.exports = fcmpx;
1297
-
1298
-
1299
- /***/ }),
1300
-
1301
- /***/ "./src/filter1_from_spec.js":
1302
- /*!**********************************!*\
1303
- !*** ./src/filter1_from_spec.js ***!
1304
- \**********************************/
1305
- /***/ ((module) => {
1306
-
1307
- /**
1308
- * Creates a filtering function based on the following spec:
1309
- * 1. Substrings are separated by `/`.
1310
- * 2. Each substring may have special characters:
1311
- * - `^`: Substring must appear at the beginning.
1312
- * - `$`: Substring must appear at the end.
1313
- * - `!`: Negates the condition (substring must not appear).
1314
- */
1315
- function filter1_from_spec(spec)
1316
- {
1317
- let a, b, c, d;
1318
- const parts = parse_spec(spec);
1319
- switch (parts.length) {
1320
- case 0:
1321
- // No filters, always true
1322
- return () => true;
1323
- case 1:
1324
- return parts[0];
1325
- case 2:
1326
- [a, b] = parts;
1327
- return s => a(s) && b(s);
1328
- case 3:
1329
- [a, b, c] = parts;
1330
- return s => a(s) && b(s) && c(s);
1331
- case 4:
1332
- [a, b, c, d] = parts;
1333
- return s => a(s) && b(s) && c(s) && d(s);
1334
- default:
1335
- return s => parts.every(fn => fn(s));
1336
- }
1337
- }
1338
-
1339
- function parse_spec(spec)
1340
- {
1341
- return spec.split('/').filter(v => v).map(parse_expr);
1342
- }
1343
-
1344
- // convert expr into an array of objects {substr, starts, ends}
1345
- function parse_expr(expr)
1346
- {
1347
- let substr;
1348
- let starts = false; // ^
1349
- let ends = false; // $
1350
- substr = expr.replaceAll('^', '');
1351
- starts = (substr.length !== expr.length);
1352
- expr = substr;
1353
- substr = expr.replaceAll('$', '');
1354
- ends = (substr.length !== expr.length);
1355
- expr = substr;
1356
- substr = expr.replaceAll('!', '');
1357
- if ((expr.length - substr.length) % 2) { // not
1358
- if (starts && ends) {
1359
- return s => !s.startsWith(substr) && !s.endsWith(substr);
1360
- }
1361
- if (starts) {
1362
- return s => !s.startsWith(substr);
1363
- }
1364
- if (ends) {
1365
- return s => !s.endsWith(substr);
1366
- }
1367
- return s => !s.includes(substr);
1368
- }
1369
- if (starts && ends) {
1370
- return s => s.startsWith(substr) && s.endsWith(substr);
1371
- }
1372
- if (starts) {
1373
- return s => s.startsWith(substr);
1374
- }
1375
- if (ends) {
1376
- return s => s.endsWith(substr);
1377
- }
1378
- return s => s.includes(substr);
1379
- }
1380
-
1381
- module.exports = filter1_from_spec;
1382
-
1383
-
1384
- /***/ }),
1385
-
1386
- /***/ "./src/format_bytes.js":
1387
- /*!*****************************!*\
1388
- !*** ./src/format_bytes.js ***!
1389
- \*****************************/
1390
- /***/ ((module) => {
1391
-
1392
- /**
1393
- * @link https://stackoverflow.com/a/18650828
1394
- */
1395
- function format_bytes(bytes)
1396
- {
1397
- const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
1398
- if (typeof bytes !== 'number' || Number.isNaN(bytes)) {
1399
- return 'n/a';
1400
- }
1401
- if (!bytes) {
1402
- return '0KB';
1403
- }
1404
- if (bytes < 1024) {
1405
- return '1KB';
1406
- }
1407
- const i = Math.floor(Math.log(bytes) / Math.log(1024));
1408
- return `${(bytes / (1024 ** i)).toFixed(bytes > 1024*1024 ? 2 : 0)}${sizes[i]}`.replace(/\.00/, '.0');
1409
- }
1410
-
1411
- module.exports = format_bytes;
1412
-
1413
- // https://wiki.ubuntu.com/UnitsPolicy
1414
- // > Applications must use SI standard for base-10 units:
1415
- // >
1416
- // > 1 kB = 1,000 bytes (Note: small k)
1417
- // > 1 MB = 1,000 kB = 1,000,000 bytes
1418
- // > 1 GB = 1,000 MB = 1,000,000 kB = 1,000,000,000 bytes
1419
- // > 1 TB = 1,000 GB = 1,000,000 MB = 1,000,000,000 kB = 1,000,000,000,000 bytes
1420
-
1421
-
1422
- /***/ }),
1423
-
1424
- /***/ "./src/format_date.js":
1425
- /*!****************************!*\
1426
- !*** ./src/format_date.js ***!
1427
- \****************************/
1428
- /***/ ((module) => {
1429
-
1430
- function format_date(d)
1431
- {
1432
- return d.getFullYear() + `/0${d.getMonth()+1}/0${d.getDate()} 0${d.getHours()}:0${d.getMinutes()}:0${d.getSeconds()}`.replace(/0(\d\d)/g, '$1');
1433
- }
1434
-
1435
- module.exports = format_date;
1436
-
1437
-
1438
- /***/ }),
1439
-
1440
- /***/ "./src/format_date_fs.js":
1441
- /*!*******************************!*\
1442
- !*** ./src/format_date_fs.js ***!
1443
- \*******************************/
1444
- /***/ ((module) => {
1445
-
1446
- function format_date_fs(d)
1447
- {
1448
- const ymd = d.getFullYear() + dd(d.getMonth() + 1) + dd(d.getDate());
1449
- const hms = dd(d.getHours()) + dd(d.getMinutes()) + dd(d.getSeconds());
1450
- return ymd + '_' + hms;
1451
- }
1452
-
1453
- function dd(v)
1454
- {
1455
- return v > 9 ? `${v}` : `0${v}`;
1456
- }
1457
-
1458
- module.exports = format_date_fs;
1459
-
1460
-
1461
- /***/ }),
1462
-
1463
- /***/ "./src/format_date_human.js":
1464
- /*!**********************************!*\
1465
- !*** ./src/format_date_human.js ***!
1466
- \**********************************/
1467
- /***/ ((module) => {
1468
-
1469
- function format_date_human(d)
1470
- {
1471
- const ymd = d.getFullYear() + '/' + dd(d.getMonth() + 1) + '/' + dd(d.getDate());
1472
- const hms = dd(d.getHours()) + ':' + dd(d.getMinutes()) + ':' + dd(d.getSeconds());
1473
- return ymd + ' ' + hms;
1474
- }
1475
-
1476
- function dd(v)
1477
- {
1478
- return v > 9 ? `${v}` : `0${v}`;
1479
- }
1480
-
1481
- module.exports = format_date_human;
1482
-
1483
-
1484
- /***/ }),
1485
-
1486
- /***/ "./src/format_date_ymd.js":
1487
- /*!********************************!*\
1488
- !*** ./src/format_date_ymd.js ***!
1489
- \********************************/
1490
- /***/ ((module) => {
1491
-
1492
- function format_date_ymd(d)
1493
- {
1494
- return d.getFullYear() + `/0${d.getMonth()+1}/0${d.getDate()}`.replace(/0(\d\d)/g, '$1');
1495
- }
1496
-
1497
- module.exports = format_date_ymd;
1498
-
1499
-
1500
- /***/ }),
1501
-
1502
- /***/ "./src/format_error_report.js":
1503
- /*!************************************!*\
1504
- !*** ./src/format_error_report.js ***!
1505
- \************************************/
1506
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1507
-
1508
- const json_stringify_safe = __webpack_require__(/*! ./json_stringify_safe */ "./src/json_stringify_safe.js");
1509
-
1510
- function format_error_report(error)
1511
- {
1512
- if (!error) {
1513
- return json_stringify_safe({error: error === undefined ? '---undefined---' : error});
1514
- }
1515
-
1516
- if (error.response?.status && error.response?.statusText && error.response?.config) {
1517
- return fm_axios_response(error);
1518
- }
1519
-
1520
- if (error.config) {
1521
- return fm_axios_config(error);
1522
- }
1523
-
1524
- return json_stringify_safe({
1525
- code: error.code,
1526
- name: error.name,
1527
- message: error.message ?? 'n/a',
1528
- stack: error.stack && error.stack.split(/\n\s*/)
1529
- }, null, 4);
1530
- }
1531
-
1532
- function fm_axios_response(error)
1533
- {
1534
- return `
1535
- ${error.message ?? 'n/a'}
1536
-
1537
- --- REQUEST ---
1538
-
1539
- ${(error.response.config.method||'').toUpperCase()} ${error.response.config.url}
1540
-
1541
- ${JSON.stringify(error.response.config.headers||{}, null, 4).slice(1, -1).replace(/^\s+|,$/mg, '').trim()}
1542
-
1543
- --- RESPONSE ---
1544
-
1545
- ${error.response.status} ${error.response.statusText}
1546
-
1547
- ${(error.response.data.toString()||'').slice(0, 10240) || 'n/a'}
1548
-
1549
- --- STACK ---
1550
-
1551
- ${error.stack ? error.stack.split(/\\n\\s*/) : 'n/a'}
1552
- `.trimStart();
1553
- }
1554
-
1555
- function fm_axios_config(error)
1556
- {
1557
- return `
1558
- ${error.message ?? 'n/a'}
1559
-
1560
- --- REQUEST ---
1561
-
1562
- ${(error.config.method||'').toUpperCase()} ${error.config.url}
1563
-
1564
- ${JSON.stringify(error.config.headers||{}, null, 4).slice(1, -1).replace(/^\s+|,$/mg, '').trim()}
1565
-
1566
- --- STACK ---
1567
-
1568
- ${error.stack ? error.stack.split(/\\n\\s*/) : 'n/a'}
1569
- `.trimStart();
1570
- }
1571
-
1572
- module.exports = format_error_report;
1573
-
1574
-
1575
- /***/ }),
1576
-
1577
- /***/ "./src/format_hrtime.js":
1578
- /*!******************************!*\
1579
- !*** ./src/format_hrtime.js ***!
1580
- \******************************/
1581
- /***/ ((module) => {
1582
-
1583
- /**
1584
- * Return a human-readable representation of hrtime (the return value from `process.hrtime(hrtime0)`).
1585
- */
1586
- function format_hrtime(hrtime, digits = 6)
1587
- {
1588
- const [u, v] = hrtime; // process.hrtime(hrtime0)
1589
- return (u + v/1E9).toFixed(digits) + 's';
1590
- }
1591
-
1592
- module.exports = format_hrtime;
1593
-
1594
-
1595
- /***/ }),
1596
-
1597
- /***/ "./src/format_kilo.js":
1598
- /*!****************************!*\
1599
- !*** ./src/format_kilo.js ***!
1600
- \****************************/
1601
- /***/ ((module) => {
1602
-
1603
- function format_kilo(num)
1604
- {
1605
- const sizes = ['', 'K', 'M', 'G', 'T', 'P'];
1606
- if (typeof num !== 'number' || Number.isNaN(num)) {
1607
- return 'n/a';
1608
- }
1609
- if (!num) {
1610
- return '0';
1611
- }
1612
- if (num < 1000) {
1613
- return num.toFixed(0);
1614
- }
1615
- const i = parseInt(Math.floor(Math.log(num) / Math.log(1000)), 10);
1616
- return `${(num / (1000 ** i)).toFixed(2)}${sizes[i]}`;
1617
- }
1618
-
1619
- module.exports = format_kilo;
1620
-
1621
-
1622
- /***/ }),
1623
-
1624
- /***/ "./src/format_ms.js":
1625
- /*!**************************!*\
1626
- !*** ./src/format_ms.js ***!
1627
- \**************************/
1628
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1629
-
1630
- const factorize_ms = __webpack_require__(/*! ./factorize_ms */ "./src/factorize_ms.js");
1631
-
1632
- /**
1633
- * Format milliseconds
1634
- */
1635
- function format_ms(ms)
1636
- {
1637
- if (!ms) {
1638
- ms = 0;
1639
- }
1640
-
1641
- // 00:05
1642
- const [h, m, s] = factorize_ms(ms);
1643
- if (h) {
1644
- return `0${h}:0${m}:0${s}`.replace(/0+(?=\d\d)/g, '');
1645
- }
1646
- return `0${m}:0${s}`.replace(/0+(?=\d\d)/g, '');
1647
- }
1648
-
1649
- module.exports = format_ms;
1650
-
1651
-
1652
- /***/ }),
1653
-
1654
- /***/ "./src/format_ms2.js":
1655
- /*!***************************!*\
1656
- !*** ./src/format_ms2.js ***!
1657
- \***************************/
1658
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1659
-
1660
- const factorize_ms = __webpack_require__(/*! ./factorize_ms */ "./src/factorize_ms.js");
1661
-
1662
- /**
1663
- * Format milliseconds
1664
- */
1665
- function format_ms2(ms)
1666
- {
1667
- if (!ms) {
1668
- ms = 0;
1669
- }
1670
-
1671
- // 00:05.45
1672
- const [h, m, s, xx] = factorize_ms(ms);
1673
- if (h) {
1674
- return `0${h}:0${m}:0${s}.0${Math.round(xx/10)}`.replace(/0+(?=\d\d)/g, '');
1675
- }
1676
- return `0${m}:0${s}.0${Math.round(xx/10)}`.replace(/0+(?=\d\d)/g, '');
1677
- }
1678
-
1679
- module.exports = format_ms2;
1680
-
1681
-
1682
- /***/ }),
1683
-
1684
- /***/ "./src/format_ms3.js":
1685
- /*!***************************!*\
1686
- !*** ./src/format_ms3.js ***!
1687
- \***************************/
1688
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1689
-
1690
- const factorize_ms = __webpack_require__(/*! ./factorize_ms */ "./src/factorize_ms.js");
1691
-
1692
- /**
1693
- * Format milliseconds
1694
- */
1695
- function format_ms3(ms, include_zero_hours = false)
1696
- {
1697
- if (!ms) {
1698
- ms = 0;
1699
- }
1700
-
1701
- // 00:05.445
1702
- const [h, m, s, xx] = factorize_ms(ms);
1703
- if (h || include_zero_hours) {
1704
- return `0${h}:0${m}:0${s}.00${xx}`.replace(/0+(?=\d\d+[:.]|\d\d\d)/g, '');
1705
- }
1706
- return `0${m}:0${s}.00${xx}`.replace(/0+(?=\d\d+[:.]|\d\d\d)/g, '')
1707
- }
1708
-
1709
- module.exports = format_ms3;
1710
-
1711
-
1712
- /***/ }),
1713
-
1714
- /***/ "./src/format_percents.js":
1715
- /*!********************************!*\
1716
- !*** ./src/format_percents.js ***!
1717
- \********************************/
1718
- /***/ ((module) => {
1719
-
1720
- function format_percents(v)
1721
- {
1722
- return (v*100).toFixed(2).replace(/^(0|100).00$/, '$1') + '%';
1723
- }
1724
-
1725
- module.exports = format_percents;
1726
-
1727
-
1728
- /***/ }),
1729
-
1730
- /***/ "./src/format_progress_bytes.js":
1731
- /*!**************************************!*\
1732
- !*** ./src/format_progress_bytes.js ***!
1733
- \**************************************/
1734
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1735
-
1736
- const format_bytes = __webpack_require__(/*! ./format_bytes */ "./src/format_bytes.js");
1737
- const format_percents = __webpack_require__(/*! ./format_percents */ "./src/format_percents.js");
1738
- const format_seconds = __webpack_require__(/*! ./format_seconds */ "./src/format_seconds.js");
1739
- const is_num_gt = __webpack_require__(/*! @vbarbarosh/type-helpers/src/is_num_gt */ "./node_modules/@vbarbarosh/type-helpers/src/is_num_gt.js");
1740
-
1741
- function format_progress_bytes({percents, total, done, rate, eta, duration})
1742
- {
1743
- const bps = is_num_gt(rate, 0) ? `${format_bytes(rate)}/s` : '~';
1744
- if (done > total) {
1745
- return `${format_bytes(done)} at ${bps} duration=${format_seconds(duration)}`;
1746
- }
1747
- if (is_num_gt(total, 0)) {
1748
- const eta_str = is_num_gt(eta, 0) ? format_seconds(eta) : '~';
1749
- return `${format_percents(percents)} | ${format_bytes(done)} of ${format_bytes(total)} at ${bps} ETA ${eta_str} duration=${format_seconds(duration)}`;
1750
- }
1751
- if (is_num_gt(done, 0)) {
1752
- return `${format_bytes(done)} of ~ at ${bps} duration=${format_seconds(duration)}`;
1753
- }
1754
- if (is_num_gt(duration, 0)) {
1755
- return `~ duration=${format_seconds(duration)}`;
1756
- }
1757
- return '~';
1758
- }
1759
-
1760
- module.exports = format_progress_bytes;
1761
-
1762
-
1763
- /***/ }),
1764
-
1765
- /***/ "./src/format_progress_kilo.js":
1766
- /*!*************************************!*\
1767
- !*** ./src/format_progress_kilo.js ***!
1768
- \*************************************/
1769
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1770
-
1771
- const format_kilo = __webpack_require__(/*! ./format_kilo */ "./src/format_kilo.js");
1772
- const format_percents = __webpack_require__(/*! ./format_percents */ "./src/format_percents.js");
1773
- const format_seconds = __webpack_require__(/*! ./format_seconds */ "./src/format_seconds.js");
1774
- const is_num_gt = __webpack_require__(/*! @vbarbarosh/type-helpers/src/is_num_gt */ "./node_modules/@vbarbarosh/type-helpers/src/is_num_gt.js");
1775
-
1776
- function format_progress_kilo({percents, total, done, rate, eta, duration})
1777
- {
1778
- const speed = is_num_gt(rate, 0) ? `${format_kilo(rate)}/s` : '~';
1779
- if (done > total) {
1780
- return `${format_kilo(done)} at ${speed} duration=${format_seconds(duration)}`;
1781
- }
1782
- if (is_num_gt(total, 0)) {
1783
- const eta_str = is_num_gt(eta, 0) ? format_seconds(eta) : '~';
1784
- return `${format_percents(percents)} | ${format_kilo(done)} of ${format_kilo(total)} at ${speed} ETA ${eta_str} duration=${format_seconds(duration)}`;
1785
- }
1786
- if (is_num_gt(done, 0)) {
1787
- return `${format_kilo(done)} of ~ at ${speed} duration=${format_seconds(duration)}`;
1788
- }
1789
- if (is_num_gt(duration, 0)) {
1790
- return `~ duration=${format_seconds(duration)}`;
1791
- }
1792
- return '~';
1793
- }
1794
-
1795
- module.exports = format_progress_kilo;
1796
-
1797
-
1798
- /***/ }),
1799
-
1800
- /***/ "./src/format_seconds.js":
1801
- /*!*******************************!*\
1802
- !*** ./src/format_seconds.js ***!
1803
- \*******************************/
1804
- /***/ ((module) => {
1805
-
1806
- function format_seconds(seconds)
1807
- {
1808
- const v = Math.abs(Math.trunc(seconds));
1809
- const hh = Math.floor(v / 60 / 60);
1810
- const mm = Math.floor(v / 60) % 60;
1811
- const ss = v % 60;
1812
- const tmp = `0${hh}:0${mm}:0${ss}`.replace(/0(\d\d)/g, '$1');
1813
- return (seconds <= -1) ? ('-' + tmp) : tmp;
1814
- }
1815
-
1816
- module.exports = format_seconds;
1817
-
1818
-
1819
- /***/ }),
1820
-
1821
- /***/ "./src/format_thousands.js":
1822
- /*!*********************************!*\
1823
- !*** ./src/format_thousands.js ***!
1824
- \*********************************/
1825
- /***/ ((module) => {
1826
-
1827
- // https://stackoverflow.com/a/2901298
1828
- function format_thousands(x)
1829
- {
1830
- return x.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ',');
1831
- }
1832
-
1833
- module.exports = format_thousands;
1834
-
1835
-
1836
- /***/ }),
1837
-
1838
- /***/ "./src/http_delete.js":
1839
- /*!****************************!*\
1840
- !*** ./src/http_delete.js ***!
1841
- \****************************/
1842
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1843
-
1844
- const axios = __webpack_require__(/*! axios */ "axios");
1845
-
1846
- function http_delete(url, options)
1847
- {
1848
- return axios.delete(url, {responseType: 'json', ...options}).then(v => v.data);
1849
- }
1850
-
1851
- module.exports = http_delete;
1852
-
1853
-
1854
- /***/ }),
1855
-
1856
- /***/ "./src/http_get_blob.js":
1857
- /*!******************************!*\
1858
- !*** ./src/http_get_blob.js ***!
1859
- \******************************/
1860
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1861
-
1862
- const axios = __webpack_require__(/*! axios */ "axios");
1863
-
1864
- function http_get_blob(url, options)
1865
- {
1866
- return axios.get(url, {responseType: 'blob', ...options}).then(v => v.data);
1867
- }
1868
-
1869
- module.exports = http_get_blob;
1870
-
1871
-
1872
- /***/ }),
1873
-
1874
- /***/ "./src/http_get_buffer.js":
1875
- /*!********************************!*\
1876
- !*** ./src/http_get_buffer.js ***!
1877
- \********************************/
1878
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1879
-
1880
- const axios = __webpack_require__(/*! axios */ "axios");
1881
-
1882
- function http_get_buffer(url, options)
1883
- {
1884
- return axios.get(url, {responseType: 'arraybuffer', ...options}).then(v => v.data);
1885
- }
1886
-
1887
- module.exports = http_get_buffer;
1888
-
1889
-
1890
- /***/ }),
1891
-
1892
- /***/ "./src/http_get_json.js":
1893
- /*!******************************!*\
1894
- !*** ./src/http_get_json.js ***!
1895
- \******************************/
1896
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1897
-
1898
- const axios = __webpack_require__(/*! axios */ "axios");
1899
-
1900
- function http_get_json(url, options)
1901
- {
1902
- return axios.get(url, {responseType: 'json', ...options}).then(v => v.data);
1903
- }
1904
-
1905
- module.exports = http_get_json;
1906
-
1907
-
1908
- /***/ }),
1909
-
1910
- /***/ "./src/http_get_utf8.js":
1911
- /*!******************************!*\
1912
- !*** ./src/http_get_utf8.js ***!
1913
- \******************************/
1914
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1915
-
1916
- const axios = __webpack_require__(/*! axios */ "axios");
1917
-
1918
- function http_get_utf8(url, options)
1919
- {
1920
- return axios.get(url, {responseType: 'text', responseEncoding: 'utf8', ...options}).then(v => v.data);
1921
- }
1922
-
1923
- module.exports = http_get_utf8;
1924
-
1925
-
1926
- /***/ }),
1927
-
1928
- /***/ "./src/http_head.js":
1929
- /*!**************************!*\
1930
- !*** ./src/http_head.js ***!
1931
- \**************************/
1932
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1933
-
1934
- const axios = __webpack_require__(/*! axios */ "axios");
1935
-
1936
- function http_head(url, options)
1937
- {
1938
- return axios.head(url, options).then(v => v.request.res.headers);
1939
- }
1940
-
1941
- module.exports = http_head;
1942
-
1943
-
1944
- /***/ }),
1945
-
1946
- /***/ "./src/http_patch_json.js":
1947
- /*!********************************!*\
1948
- !*** ./src/http_patch_json.js ***!
1949
- \********************************/
1950
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1951
-
1952
- const axios = __webpack_require__(/*! axios */ "axios");
1953
-
1954
- function http_patch_json(url, body, options)
1955
- {
1956
- return axios.patch(url, body, options).then(v => v.data);
1957
- }
1958
-
1959
- module.exports = http_patch_json;
1960
-
1961
-
1962
- /***/ }),
1963
-
1964
- /***/ "./src/http_post_json.js":
1965
- /*!*******************************!*\
1966
- !*** ./src/http_post_json.js ***!
1967
- \*******************************/
1968
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1969
-
1970
- const axios = __webpack_require__(/*! axios */ "axios");
1971
-
1972
- function http_post_json(url, body, options)
1973
- {
1974
- return axios.post(url, body, options).then(v => v.data);
1975
- }
1976
-
1977
- module.exports = http_post_json;
1978
-
1979
-
1980
- /***/ }),
1981
-
1982
- /***/ "./src/http_post_multipart.js":
1983
- /*!************************************!*\
1984
- !*** ./src/http_post_multipart.js ***!
1985
- \************************************/
1986
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1987
-
1988
- const FormData = __webpack_require__(/*! form-data */ "form-data");
1989
- const axios = __webpack_require__(/*! axios */ "axios");
1990
-
1991
- // Provide examples for the following common tasks:
1992
- //
1993
- // * send plain text
1994
- // * send json
1995
- // * send image
1996
- // * send attachment
1997
-
1998
- // import fetch from 'node-fetch';
1999
- //
2000
- // async function http_post_multipart(url, rows)
2001
- // {
2002
- // const form = new FormData();
2003
- // for (let i = 0, end = rows.length; i < end; ++i) {
2004
- // const {name, body} = rows[i];
2005
- // form.append(name, body);
2006
- // }
2007
- // return await fetch(url, {method: 'POST', body: form});
2008
- // }
2009
- //
2010
- // Example:
2011
- //
2012
- // const rows = [];
2013
- // rows.push({name: 'from', body: MAILGUN_FROM});
2014
- // rows.push({name: 'to', body: to});
2015
- // rows.push({name: 'subject', body: subject});
2016
- // rows.push({name: 'text', body: text});
2017
- // rows.push({name: 'attachment', body: fs_read_stream(__filename), options: {filename: 'hello.txt'}});
2018
- // return http_post_multipart(`${MAILGUN_BASE}/messages`, rows, options);
2019
-
2020
- // https://github.com/axios/axios/issues/318#issuecomment-344620216
2021
- // https://github.com/axios/axios/issues/1006#issuecomment-320165427
2022
- function http_post_multipart(url, items, options)
2023
- {
2024
- const form = new FormData();
2025
- for (let i = 0, end = items.length; i < end; ++i) {
2026
- const item = items[i];
2027
- // Without this, all string vales (ordinary fields) will
2028
- // be empty in _Chrome 59.0.3071.86 (Official Build) (64-bit)_
2029
- if (item.options) {
2030
- form.append(item.name, item.body, item.options);
2031
- }
2032
- else {
2033
- form.append(item.name, item.body);
2034
- }
2035
- }
2036
- // For Node
2037
- // import FormData from 'form-data'
2038
- // noinspection JSUnresolvedVariable
2039
- if (form.getHeaders) {
2040
- const options2 = {...options};
2041
- options2.headers = {...options2.headers, ...form.getHeaders()};
2042
- return Promise.resolve(axios.post(url, form, options2)).then(v => v.data);
2043
- }
2044
- // For Browser
2045
- // webpack.config.js
2046
- // externals: {"form-data": "FormData"}
2047
- return Promise.resolve(axios.post(url, form, options)).then(v => v.data);
2048
- }
2049
-
2050
- module.exports = http_post_multipart;
2051
-
2052
-
2053
- /***/ }),
2054
-
2055
- /***/ "./src/http_put_buffer.js":
2056
- /*!********************************!*\
2057
- !*** ./src/http_put_buffer.js ***!
2058
- \********************************/
2059
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2060
-
2061
- const axios = __webpack_require__(/*! axios */ "axios");
2062
-
2063
- function http_put_buffer(url, body, options)
2064
- {
2065
- return axios.put(url, body, options).then(v => v.data);
2066
- }
2067
-
2068
- module.exports = http_put_buffer;
2069
-
2070
-
2071
- /***/ }),
2072
-
2073
- /***/ "./src/http_put_json.js":
2074
- /*!******************************!*\
2075
- !*** ./src/http_put_json.js ***!
2076
- \******************************/
2077
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2078
-
2079
- const axios = __webpack_require__(/*! axios */ "axios");
2080
-
2081
- function http_put_json(url, body, options)
2082
- {
2083
- return axios.put(url, body, options).then(v => v.data);
2084
- }
2085
-
2086
- module.exports = http_put_json;
2087
-
2088
-
2089
- /***/ }),
2090
-
2091
- /***/ "./src/http_put_utf8.js":
2092
- /*!******************************!*\
2093
- !*** ./src/http_put_utf8.js ***!
2094
- \******************************/
2095
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2096
-
2097
- const axios = __webpack_require__(/*! axios */ "axios");
2098
-
2099
- async function http_put_utf8(url, utf8, options)
2100
- {
2101
- return axios.put(url, utf8, options).then(v => v.data);
2102
- }
2103
-
2104
- module.exports = http_put_utf8;
2105
-
2106
-
2107
- /***/ }),
2108
-
2109
- /***/ "./src/identity.js":
2110
- /*!*************************!*\
2111
- !*** ./src/identity.js ***!
2112
- \*************************/
2113
- /***/ ((module) => {
2114
-
2115
- function identity(value)
2116
- {
2117
- return value;
2118
- }
2119
-
2120
- module.exports = identity;
2121
-
2122
-
2123
- /***/ }),
2124
-
2125
- /***/ "./src/ignore.js":
2126
- /*!***********************!*\
2127
- !*** ./src/ignore.js ***!
2128
- \***********************/
2129
- /***/ ((module) => {
2130
-
2131
- function ignore()
2132
- {
2133
- }
2134
-
2135
- module.exports = ignore;
2136
-
2137
-
2138
- /***/ }),
2139
-
2140
- /***/ "./src/json_stringify_safe.js":
2141
- /*!************************************!*\
2142
- !*** ./src/json_stringify_safe.js ***!
2143
- \************************************/
2144
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2145
-
2146
- const json_stringify_safe = __webpack_require__(/*! json-stringify-safe */ "./node_modules/json-stringify-safe/stringify.js");
2147
-
2148
- module.exports = json_stringify_safe;
2149
-
2150
-
2151
- /***/ }),
2152
-
2153
- /***/ "./src/math_gcd.js":
2154
- /*!*************************!*\
2155
- !*** ./src/math_gcd.js ***!
2156
- \*************************/
2157
- /***/ ((module) => {
2158
-
2159
- // https://stackoverflow.com/a/39764792/1478566
2160
- function math_gcd(a, b)
2161
- {
2162
- if (b) {
2163
- return math_gcd(b, a % b);
2164
- }
2165
- return a;
2166
- }
2167
-
2168
- module.exports = math_gcd;
2169
-
2170
-
2171
- /***/ }),
2172
-
2173
- /***/ "./src/math_lcm.js":
2174
- /*!*************************!*\
2175
- !*** ./src/math_lcm.js ***!
2176
- \*************************/
2177
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2178
-
2179
- const math_gcd = __webpack_require__(/*! ./math_gcd */ "./src/math_gcd.js");
2180
-
2181
- function math_lcm(a, b)
2182
- {
2183
- return Math.abs(a*b) / math_gcd(a, b);
2184
- }
2185
-
2186
- module.exports = math_lcm;
2187
-
2188
-
2189
- /***/ }),
2190
-
2191
- /***/ "./src/plural.js":
2192
- /*!***********************!*\
2193
- !*** ./src/plural.js ***!
2194
- \***********************/
2195
- /***/ ((module) => {
2196
-
2197
- function plural(n, singular, plural, zero)
2198
- {
2199
- if (n === 0 && typeof zero === 'string') {
2200
- return zero;
2201
- }
2202
- if (n % 10 === 1 && n % 100 !== 11) {
2203
- return singular.split('#').join(n);
2204
- }
2205
- return plural.split('#').join(n);
2206
- }
2207
-
2208
- module.exports = plural;
2209
-
2210
-
2211
- /***/ }),
2212
-
2213
- /***/ "./src/random_int.js":
2214
- /*!***************************!*\
2215
- !*** ./src/random_int.js ***!
2216
- \***************************/
2217
- /***/ ((module) => {
2218
-
2219
- function random_int(min, max)
2220
- {
2221
- return Math.floor(Math.random()*(max - min + 1) + min);
2222
- }
2223
-
2224
- module.exports = random_int;
2225
-
2226
-
2227
- /***/ }),
2228
-
2229
- /***/ "./src/round.js":
2230
- /*!**********************!*\
2231
- !*** ./src/round.js ***!
2232
- \**********************/
2233
- /***/ ((module) => {
2234
-
2235
- function round(value, precision = 1)
2236
- {
2237
- if (precision === 0) {
2238
- return value;
2239
- }
2240
-
2241
- const factor = 1 / precision;
2242
- const sign = Math.sign(value);
2243
-
2244
- // Count decimal places for the cleanup (toFixed)
2245
- const exponent = get_decimal_places(precision);
2246
-
2247
- // Small epsilon helps fix most floating point edge cases involving ties
2248
- const epsilon = 1e-12*sign;
2249
-
2250
- // Scale → Nudge → Round → Unscale
2251
- const final = (Math.round(value*factor + epsilon) / factor);
2252
-
2253
- // Cleanup trailing garbage such as: 34.038000000000004 → 34.038
2254
- return Number(final.toFixed(exponent));
2255
- }
2256
-
2257
- function get_decimal_places(precision)
2258
- {
2259
- if (Math.floor(precision) === precision) {
2260
- return 0;
2261
- }
2262
-
2263
- // Scientific notation support: e.g., 1e-20
2264
- const e = precision.toExponential().split('e');
2265
- if (e.length > 1) {
2266
- return Math.abs(parseInt(e[1], 10));
2267
- }
2268
-
2269
- // Normal decimal notation (e.g., 0.001)
2270
- return precision.toString().split('.')[1]?.length || 0;
2271
- }
2272
-
2273
- // // round(34.037531, 0.001) -> 34.038000000000004
2274
- // function round(value, precision = 1)
2275
- // {
2276
- // return Math.round(value / precision) * precision;
2277
- // }
2278
-
2279
- // // round(1.005, 0.01) -> 1
2280
- // function round(value, precision = 1)
2281
- // {
2282
- // const p = 1 / precision;
2283
- // return Math.round(value * p) / p;
2284
- // }
2285
-
2286
- // function round(value, precision = 1)
2287
- // {
2288
- // if (precision === 0) {
2289
- // return value;
2290
- // }
2291
- // const factor = 1 / precision;
2292
- // const epsilon = 1e-12 * Math.sign(value);
2293
- // return Number((Math.round((value * factor) + epsilon) / factor).toPrecision(15));
2294
- // }
2295
-
2296
- // function round(value, precision = 1)
2297
- // {
2298
- // if (precision === 0) {
2299
- // return value;
2300
- // }
2301
- //
2302
- // const factor = 1 / precision;
2303
- //
2304
- // // The exponent is critical for defining the precision of the cleanup
2305
- // const exponent = Math.max(0, String(precision).length - 2);
2306
- //
2307
- // // 1. Calculate the scaled value.
2308
- // let scaled = value * factor;
2309
- //
2310
- // // 2. Strategic Nudge: Add a tiny, signed epsilon (1e-12) to correct floating-point
2311
- // // representation errors and force symmetric rounding (as Math.abs failed).
2312
- // const epsilon = 1e-12 * Math.sign(value);
2313
- //
2314
- // // 3. Round the nudged value.
2315
- // const roundedScaled = Math.round(scaled + epsilon);
2316
- //
2317
- // // 4. Unscale the value.
2318
- // const result = roundedScaled / factor;
2319
- //
2320
- // // 5. CRITICAL FINAL STEP: Use .toFixed() with the required decimal places for cleanup.
2321
- // // This stabilizes the result against the strict equality checks, including
2322
- // // the safe integer boundary errors caused by the final division.
2323
- // return Number(result.toFixed(exponent));
2324
- // }
2325
-
2326
- // 💎 The most precise solution, but - extra dependency.
2327
- //
2328
- // const Decimal = require('decimal.js');
2329
- //
2330
- // function round(value, precision = 1)
2331
- // {
2332
- // return new Decimal(value).div(precision).round().times(precision).toNumber();
2333
- // }
2334
-
2335
- module.exports = round;
2336
-
2337
-
2338
- /***/ }),
2339
-
2340
- /***/ "./src/urlmod.js":
2341
- /*!***********************!*\
2342
- !*** ./src/urlmod.js ***!
2343
- \***********************/
2344
- /***/ ((module) => {
2345
-
2346
- /**
2347
- * Set, change, or remove query string parameters.
2348
- *
2349
- * urlmod('', {a: 1}) '?a=1' set
2350
- * urlmod('?a=1', {a: 2}) '?a=2' change
2351
- * urlmod('?a=1', {a: null}) '' remove
2352
- */
2353
- function urlmod(url, params)
2354
- {
2355
- const tmp_url = new URL(url||'', 'xxx://___base___/');
2356
- const tmp_search = tmp_url.searchParams;
2357
- Object.entries(params || {}).forEach(function ([key, value]) {
2358
- switch (value) {
2359
- case null:
2360
- case undefined:
2361
- tmp_search.delete(key);
2362
- break;
2363
- case true:
2364
- tmp_search.set(key, 1);
2365
- break;
2366
- case false:
2367
- tmp_search.set(key, 0);
2368
- break;
2369
- default:
2370
- tmp_search.set(key, value);
2371
- break;
2372
- }
2373
- });
2374
- if (url && url[0] === '/') {
2375
- return tmp_url.toString().replace(/^xxx:\/\/___base___/, '');
2376
- }
2377
- return tmp_url.toString().replace(/^xxx:\/\/___base___\//, '');
2378
- }
2379
-
2380
- module.exports = urlmod;
2381
-
2382
-
2383
- /***/ }),
2384
-
2385
- /***/ "./src/waitcb.js":
2386
- /*!***********************!*\
2387
- !*** ./src/waitcb.js ***!
2388
- \***********************/
2389
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2390
-
2391
- const Promise = __webpack_require__(/*! bluebird */ "bluebird");
2392
-
2393
- /**
2394
- * Wait for a Node-like function to finish (which will call `callback`
2395
- * with 2 arguments: `error` and `value`).
2396
- *
2397
- * await waitcb(cb => fs.writeFile('a', 'hello\n', cb));
2398
- */
2399
- function waitcb(fn)
2400
- {
2401
- return new Promise(function (resolve, reject) {
2402
- fn(function (error, out) {
2403
- error ? reject(error) : resolve(out);
2404
- });
2405
- });
2406
- }
2407
-
2408
- module.exports = waitcb;
2409
-
2410
-
2411
- /***/ }),
2412
-
2413
- /***/ "axios":
2414
- /*!************************!*\
2415
- !*** external "axios" ***!
2416
- \************************/
2417
- /***/ ((module) => {
2418
-
2419
- "use strict";
2420
- module.exports = axios;
2421
-
2422
- /***/ }),
2423
-
2424
- /***/ "bluebird":
2425
- /*!**************************!*\
2426
- !*** external "Promise" ***!
2427
- \**************************/
2428
- /***/ ((module) => {
2429
-
2430
- "use strict";
2431
- module.exports = Promise;
2432
-
2433
- /***/ }),
2434
-
2435
- /***/ "form-data":
2436
- /*!***************************!*\
2437
- !*** external "FormData" ***!
2438
- \***************************/
2439
- /***/ ((module) => {
2440
-
2441
- "use strict";
2442
- module.exports = FormData;
2443
-
2444
- /***/ })
2445
-
2446
- /******/ });
2447
- /************************************************************************/
2448
- /******/ // The module cache
2449
- /******/ var __webpack_module_cache__ = {};
2450
- /******/
2451
- /******/ // The require function
2452
- /******/ function __webpack_require__(moduleId) {
2453
- /******/ // Check if module is in cache
2454
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
2455
- /******/ if (cachedModule !== undefined) {
2456
- /******/ return cachedModule.exports;
2457
- /******/ }
2458
- /******/ // Create a new module (and put it into the cache)
2459
- /******/ var module = __webpack_module_cache__[moduleId] = {
2460
- /******/ // no module.id needed
2461
- /******/ // no module.loaded needed
2462
- /******/ exports: {}
2463
- /******/ };
2464
- /******/
2465
- /******/ // Execute the module function
2466
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
2467
- /******/
2468
- /******/ // Return the exports of the module
2469
- /******/ return module.exports;
2470
- /******/ }
2471
- /******/
2472
- /************************************************************************/
2473
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
2474
- /******/ (() => {
2475
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
2476
- /******/ })();
2477
- /******/
2478
- /************************************************************************/
2479
- var __webpack_exports__ = {};
2480
- // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
2481
- (() => {
2482
- /*!******************************!*\
2483
- !*** ./src/browser/index.js ***!
2484
- \******************************/
2485
- const ns = new URL(document.currentScript.src).searchParams.get('var') ?? 'h';
2486
- if (typeof window[ns] !== 'undefined') {
2487
- console.log(`❌ @vbarbarosh/node-helpers@${"3.75.0"} was not injected — window.${ns} is already in use`);
2488
- }
2489
- else {
2490
- console.log(`🎉 @vbarbarosh/node-helpers@${"3.75.0"} successfully exposed as window.${ns}`);
2491
- window[ns] = {};
2492
- // https://github.com/webpack/webpack/issues/625
2493
- // https://webpack.js.org/guides/dependency-management/#require-context
2494
- const require_tmp = __webpack_require__("./src sync recursive ^(?%21.*(cli-apps%7Cbrowser%7C\\.d)\\/).*\\b(array%7Cdate%7Chttp_delete%7Chttp_get_blob%7Chttp_get_buffer%7Chttp_get_json%7Chttp_get_utf8%7Chttp_head%7Chttp_patch_json%7Chttp_post_json%7Chttp_post_multipart%7Chttp_put_buffer%7Chttp_put_json%7Chttp_put_utf8%7Cidentity%7Cignore%7Cfcmp%7Cfilter%7Cformat%7Cplural%7Crandom_int%7Curlmod%7Cwaitcb)[^/]*(?<%21\\.test)\\.js$");
2495
- require_tmp.keys().forEach(function (key) {
2496
- const [, basename] = key.match(/([^/]+)\.js$/);
2497
- window[ns][basename] = require_tmp(key);
2498
- });
2499
- }
2500
-
2501
- })();
2502
-
2503
- /******/ })()
2504
- ;
1
+ (()=>{var t={932(t){t.exports=function(t){return"number"==typeof t&&isFinite(t)}},5392(t,e,n){const r=n(932);t.exports=function(t,e){return r(t)&&t>e}},4106(t,e){function n(t,e){var n=[],r=[];return null==e&&(e=function(t,e){return n[0]===e?"[Circular ~]":"[Circular ~."+r.slice(0,n.indexOf(e)).join(".")+"]"}),function(o,s){if(n.length>0){var u=n.indexOf(this);~u?n.splice(u+1):n.push(this),~u?r.splice(u,1/0,o):r.push(o),~n.indexOf(s)&&(s=e.call(this,o,s))}else n.push(s);return null==t?s:t.call(this,o,s)}}(t.exports=function(t,e,r,o){return JSON.stringify(t,n(e,o),r)}).getSerialize=n},6083(t){t.exports=function(t=[],e=1){if(e<1)throw new Error("Limit value should be at least 1");const n=[];for(let r=0,o=t.length;r<o;r+=e)n.push(t.slice(r,r+e));return n}},2458(t,e,n){const r=n(7727);t.exports=function(t=[],e=1,n=1){const o=r(1,e,Math.floor(t.length/n)),s=Math.floor(t.length/o);let u=t.length%o;const c=[];for(let e=0;e<t.length;){const n=s+(u?1:0);c.push(t.slice(e,e+n)),e+=n,u&&u--}return c}},353(t,e,n){const r=n(4476),o=1e-5;t.exports=function(t,e){const n=Math.floor(t*e);if(n<=1)return[0];const s=[];for(let e=0;e<n;++e)s.push(r(e/(n-1)*(t-o),o));return s}},6372(t,e,n){const r=n(6785);t.exports=function(t,e=Number){return t.map(t=>e(t)).reduce((t,e)=>r(t,e),0)}},3537(t){t.exports=function(t,e){const n=new Map;return t.forEach(function(t){const r=e(t);n.has(r)||n.set(r,{key:r,items:[]}),n.get(r).items.push(t)}),n.values().toArray()}},2976(t){t.exports=function(t,e){const n={};return t.forEach(function(t){const r=e(t);n[r]=n[r]||{key:r,items:[]},n[r].items.push(t)}),n}},2166(t,e,n){const r=n(956);t.exports=function(t,e=r){const n={};return t.forEach(t=>n[e(t)]=t),n}},7866(t,e,n){const r=n(7347);t.exports=function(t,e=Number){return t.map(t=>e(t)).reduce((t,e)=>r(t,e),1)}},6772(t,e,n){const r=n(956);t.exports=function(t,e=r){let n=null,o=null,s=!1;return t.forEach(function(t){const r=e(t);Number.isNaN(r)||(!s||o<r)&&(s=!0,o=r,n=t)}),n}},42(t,e,n){const r=n(956);t.exports=function(t,e=r){let n=null,o=null,s=!1;return t.forEach(function(t){const r=e(t);Number.isNaN(r)||(!s||o>r)&&(s=!0,o=r,n=t)}),n}},3685(t){t.exports=function t(e,n=e.length){if(n!==e.length)return function(e,n){if(0===n)return[[]];if(e.length<n)return[];const r=[];for(let o=0;o<e.length;o++){const s=e.slice(0,o).concat(e.slice(o+1));for(const u of t(s,n-1))r.push([e[o],...u])}return r}(e,n);let r,o,s=(e=e.slice()).length,u=[e.slice()],c=new Array(s).fill(0),a=1;for(;a<s;)c[a]<a?(r=a%2&&c[a],o=e[a],e[a]=e[r],e[r]=o,++c[a],a=1,u.push(e.slice())):(c[a]=0,++a);return u}},4943(t){t.exports=function(t){for(let e=t.length;--e>0;){const n=Math.floor(Math.random()*(e+1)),r=t[e];t[e]=t[n],t[n]=r}return t}},2356(t,e,n){const r=n(8310),o=n(4332);t.exports=function(t,e,n=r){const s=new Map;return t.sort(function(t,r){if(!s.has(t)){const n=e(t);s.set(t,Array.isArray(n)?n:[n])}if(!s.has(r)){const t=e(r);s.set(r,Array.isArray(t)?t:[t])}return o(s.get(t),s.get(r),n)})}},5181(t,e,n){const r=n(8310);t.exports=function(t,e,n,o=r){const s=Object.create(null);return n.forEach((t,e)=>s[t]=e+1),t.sort(function(t,n){const r=s[e(t)],u=s[e(n)];return r&&u?r-u:r?-1:u?1:o(t,n)})}},453(t){t.exports=function(t,e=Number){let n=0;return t.forEach(function(t){n+=e(t)}),n}},3523(t,e,n){const r=n(956);t.exports=function(t,e=r){const n=new Set;return t.filter(function(t){const r=e(t);return!n.has(r)&&(n.add(r),!0)})}},6382(t,e,n){const r=n(956);t.exports=function(t,e=r){const n=[],o=new Set;for(let r=t.length;--r>=0;){const s=t[r],u=e(s);o.has(u)||(o.add(u),n.push(s))}return n.reverse()}},7727(t){t.exports=function(t,e,n){return Math.max(t,Math.min(e,n))}},9870(t){t.exports=function(t,e){return t.setHours(t.getHours()+e),t}},5799(t){t.exports=function(t,e){return t.setMilliseconds(t.getMilliseconds()+e),t}},3160(t){t.exports=function(t,e){return t.setMinutes(t.getMinutes()+e),t}},1570(t){t.exports=function(t,e){if(!e)return t;const n=t.getDate();return t.setMonth(t.getMonth()+e),t.getDate()!==n&&t.setDate(0),t}},9296(t){t.exports=function(t,e){return t.setSeconds(t.getSeconds()+e),t}},5488(t){t.exports=function(t,e){return Math.floor((t.getTime()-e.getTime())/1e3)}},3752(t){t.exports=function(t){const e=t.getFullYear();return e%4==0&&e%100!=0||e%400==0}},3150(t){t.exports=function(t){return t=Math.trunc(Math.abs(t)),[Math.floor(t/36e5),Math.floor(t%36e5/6e4),Math.floor(t%6e4/1e3),t%1e3]}},2806(t){t.exports=function(t,e){return t.getTime()-e.getTime()}},8310(t,e,n){const r=n(7668);t.exports=function(t,e){return"string"==typeof t&&"string"==typeof e?r(t,e):t<e?-1:t>e?1:0}},2092(t,e,n){const r=n(8310);t.exports=function(t,e){return r(e,t)}},3553(t){function e(t){return"-"===t[0]?(t=t.slice(1),function(e,r){return n(r[t],e[t])}):function(e,r){return n(e[t],r[t])}}function n(t,e){return"string"==typeof t&&"string"==typeof e?t.localeCompare(e):t-e}t.exports=function(t){const n=t.map(e);switch(n.length){case 0:return()=>0;case 1:return n[0];case 2:return function(t,e){return n[0](t,e)||n[1](t,e)};case 3:return function(t,e){return n[0](t,e)||n[1](t,e)||n[2](t,e)};default:return function(t,e){for(let r=0;r<n.length;++r){const o=n[r](t,e);if(o)return o}return 0}}}},3129(t){t.exports=function(t,e){return t-e}},4332(t,e,n){const r=n(8310);t.exports=function(t,e,n=r){const o=Math.min(t.length,e.length);for(let r=0;r<o;++r){const o=n(t[r],e[r]);if(o)return o}return 0}},3106(t){t.exports=function(t,e){return t<e?-1:t>e?1:0}},2271(t){t.exports=function(t,e){return t.localeCompare(e,void 0,{sensitivity:"base"})}},4457(t){t.exports=function(t,e){return t.localeCompare(e,void 0,{sensitivity:"variant"})}},7668(t){function e(t,e){const r=t.replace(/^0+/,""),o=e.replace(/^0+/,"");return r.length-o.length||n(r,o)||t.length-e.length}function n(t,e){return t<e?-1:t>e?1:0}t.exports=function(t,r){const o=t.match(/\d+|\D+/g)||[],s=r.match(/\d+|\D+/g)||[],u=Math.min(o.length,s.length);for(let t=0;t<u;++t){const r=o[t][0]<="9"&&s[t][0]<="9"&&o[t][0]>="0"&&s[t][0]>="0"?e(o[t],s[t]):n(o[t],s[t]);if(r)return r}return o.length-s.length}},4385(t){t.exports=function(t,e){return t.localeCompare(e,void 0,{numeric:!0,sensitivity:"base"})}},8951(t){t.exports=function(t,e){return t.localeCompare(e,void 0,{numeric:!0,sensitivity:"variant"})}},4734(t,e,n){const r=n(8310),o=n(2092),s=n(956),u=Symbol("fcmpx.missing");function c(t){const{read:e,fcmp:n}=a(t);return function(t,r){return n(e(t),e(r))}}function a(t){if("function"==typeof t)return{read:i(t),fcmp:f(r)};if("string"==typeof t){const e=t.startsWith("-");return{read:i(e?t.slice(1):t),fcmp:f(e?o:r)}}const e=t.fcmp,n=i(t.read),s=f(t.desc?e?(t,n)=>e(n,t):o:e??r);if(Array.isArray(t.top)){const e=new Map(t.top.map((t,e)=>[t,e]));return{read:t=>e.get(n(t))??e.size,fcmp:s}}if(Array.isArray(t.bottom)){const e=new Map(t.bottom.map((t,e)=>[t,e]));return{read:t=>e.get(n(t))??-1,fcmp:s}}return{read:n,fcmp:s}}function i(t){if(void 0===t||""===t||"."===t)return s;if("function"==typeof t)return function(e){return t(e)??u};if("string"==typeof t){const e=t.split("."),[n,r,o,s,c]=e;switch(e.length){case 1:return t=>t?.[n]??u;case 2:return t=>t?.[n]?.[r]??u;case 3:return t=>t?.[n]?.[r]?.[o]??u;case 4:return t=>t?.[n]?.[r]?.[o]?.[s]??u;case 5:return t=>t?.[n]?.[r]?.[o]?.[s]?.[c]??u;default:return t=>e.reduce((t,e)=>t?.[e],t)??u}}return e=>e?.[t]??u}function f(t){return function(e,n){return e===u?n===u?0:1:n===u?-1:t(e,n)}}t.exports=function t(e){if("string"==typeof e)return e.includes(",")?t(e.split(",")):c(e);if(!Array.isArray(e))return c(e);const n=e.map(a);return function(t,e){const r=n.map(e=>e.read(t)),o=n.map(t=>t.read(e));for(let t=0;t<n.length;++t){const e=n[t].fcmp(r[t],o[t]);if(e)return e}return 0}}},7960(t){function e(t){let e,n,r;return e=t.replaceAll("^",""),n=e.length!==t.length,e=(t=e).replaceAll("$",""),r=e.length!==t.length,e=(t=e).replaceAll("!",""),(t.length-e.length)%2?n&&r?t=>!(t.startsWith(e)&&t.endsWith(e)):n?t=>!t.startsWith(e):r?t=>!t.endsWith(e):t=>!t.includes(e):n&&r?t=>t.startsWith(e)&&t.endsWith(e):n?t=>t.startsWith(e):r?t=>t.endsWith(e):t=>t.includes(e)}t.exports=function(t){let n,r,o,s;const u=function(t){return t.split("/").filter(t=>t).map(e)}(t);switch(u.length){case 0:return()=>!0;case 1:return u[0];case 2:return[n,r]=u,t=>n(t)&&r(t);case 3:return[n,r,o]=u,t=>n(t)&&r(t)&&o(t);case 4:return[n,r,o,s]=u,t=>n(t)&&r(t)&&o(t)&&s(t);default:return t=>u.every(e=>e(t))}}},6017(t){t.exports=function(t){if("number"!=typeof t||Number.isNaN(t))return"n/a";if(!t)return"0KB";if(t<1024)return"1KB";const e=Math.floor(Math.log(t)/Math.log(1024));return`${(t/1024**e).toFixed(t>1048576?2:0)}${["B","KB","MB","GB","TB","PB"][e]}`.replace(/\.00/,".0")}},1284(t){t.exports=function(t){return t.getFullYear()+`/0${t.getMonth()+1}/0${t.getDate()} 0${t.getHours()}:0${t.getMinutes()}:0${t.getSeconds()}`.replace(/0(\d\d)/g,"$1")}},5224(t){function e(t){return t>9?`${t}`:`0${t}`}t.exports=function(t){return t.getFullYear()+e(t.getMonth()+1)+e(t.getDate())+"_"+(e(t.getHours())+e(t.getMinutes())+e(t.getSeconds()))}},1690(t){function e(t){return t>9?`${t}`:`0${t}`}t.exports=function(t){return t.getFullYear()+"/"+e(t.getMonth()+1)+"/"+e(t.getDate())+" "+e(t.getHours())+":"+e(t.getMinutes())+":"+e(t.getSeconds())}},6997(t){t.exports=function(t){return t.getFullYear()+`/0${t.getMonth()+1}/0${t.getDate()}`.replace(/0(\d\d)/g,"$1")}},9009(t,e,n){const r=n(3332);t.exports=function(t){return t?t.response?.status&&t.response?.statusText&&t.response?.config?function(t){return`\n${t.message??"n/a"}\n\n--- REQUEST ---\n\n${(t.response.config.method||"").toUpperCase()} ${t.response.config.url}\n\n${JSON.stringify(t.response.config.headers||{},null,4).slice(1,-1).replace(/^\s+|,$/gm,"").trim()}\n\n--- RESPONSE ---\n\n${t.response.status} ${t.response.statusText}\n\n${String(t.response.data??"").slice(0,10240)||"n/a"}\n\n--- STACK ---\n\n${t.stack??"n/a"}\n`.trimStart()}(t):t.config?function(t){return`\n${t.message??"n/a"}\n\n--- REQUEST ---\n\n${(t.config.method||"").toUpperCase()} ${t.config.url}\n\n${JSON.stringify(t.config.headers||{},null,4).slice(1,-1).replace(/^\s+|,$/gm,"").trim()}\n\n--- STACK ---\n\n${t.stack??"n/a"}\n`.trimStart()}(t):r({code:t.code,name:t.name,message:t.message??"n/a",stack:t.stack&&t.stack.split(/\n\s*/)},null,4):r({error:void 0===t?"---undefined---":t})}},6015(t){t.exports=function(t,e=6){const[n,r]=t;return(n+r/1e9).toFixed(e)+"s"}},4153(t){t.exports=function(t){if("number"!=typeof t||Number.isNaN(t))return"n/a";if(!t)return"0";if(t<1e3)return t.toFixed(0);const e=parseInt(Math.floor(Math.log(t)/Math.log(1e3)),10);return`${(t/1e3**e).toFixed(2)}${["","K","M","G","T","P"][e]}`}},1120(t,e,n){const r=n(3150);t.exports=function(t){t||(t=0);const e=t<0?"-":"",[n,o,s]=r(t);return n?e+`0${n}:0${o}:0${s}`.replace(/0+(?=\d\d)/g,""):e+`0${o}:0${s}`.replace(/0+(?=\d\d)/g,"")}},7336(t,e,n){const r=n(3150);t.exports=function(t){t||(t=0);const e=t<0?"-":"",[n,o,s,u]=r(10*Math.round(Math.abs(t)/10));return n?e+`0${n}:0${o}:0${s}.0${u/10}`.replace(/0+(?=\d\d)/g,""):e+`0${o}:0${s}.0${u/10}`.replace(/0+(?=\d\d)/g,"")}},495(t,e,n){const r=n(3150);t.exports=function(t,e=!1){t||(t=0);const n=t<0?"-":"",[o,s,u,c]=r(t);return o||e?n+`0${o}:0${s}:0${u}.00${c}`.replace(/0+(?=\d\d+[:.]|\d\d\d)/g,""):n+`0${s}:0${u}.00${c}`.replace(/0+(?=\d\d+[:.]|\d\d\d)/g,"")}},7882(t){t.exports=function(t){return(100*t).toFixed(2).replace(/^(0|100).00$/,"$1")+"%"}},7111(t,e,n){const r=n(6017),o=n(7882),s=n(3527),u=n(5392);t.exports=function({percents:t,total:e,done:n,rate:c,eta:a,duration:i}){const f=u(c,0)?`${r(c)}/s`:"~";if(n>e)return`${r(n)} at ${f} duration=${s(i)}`;if(u(e,0)){const c=u(a,0)?s(a):"~";return`${o(t)} | ${r(n)} of ${r(e)} at ${f} ETA ${c} duration=${s(i)}`}return u(n,0)?`${r(n)} of ~ at ${f} duration=${s(i)}`:u(i,0)?`~ duration=${s(i)}`:"~"}},5051(t,e,n){const r=n(4153),o=n(7882),s=n(3527),u=n(5392);t.exports=function({percents:t,total:e,done:n,rate:c,eta:a,duration:i}){const f=u(c,0)?`${r(c)}/s`:"~";if(n>e)return`${r(n)} at ${f} duration=${s(i)}`;if(u(e,0)){const c=u(a,0)?s(a):"~";return`${o(t)} | ${r(n)} of ${r(e)} at ${f} ETA ${c} duration=${s(i)}`}return u(n,0)?`${r(n)} of ~ at ${f} duration=${s(i)}`:u(i,0)?`~ duration=${s(i)}`:"~"}},3527(t){t.exports=function(t){const e=Math.abs(Math.trunc(t)),n=`0${Math.floor(e/60/60)}:0${Math.floor(e/60)%60}:0${e%60}`.replace(/0(\d\d)/g,"$1");return t<=-1?"-"+n:n}},2677(t){t.exports=function(t){return t.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g,",")}},4206(t,e,n){const r=n(3719);t.exports=function(t,e){return r.delete(t,{responseType:"json",...e}).then(t=>t.data)}},4131(t,e,n){const r=n(3719);t.exports=function(t,e){return r.get(t,{responseType:"blob",...e}).then(t=>t.data)}},706(t,e,n){const r=n(3719);t.exports=function(t,e){return r.get(t,{responseType:"arraybuffer",...e}).then(t=>t.data)}},3066(t,e,n){const r=n(3719);t.exports=function(t,e){return r.get(t,{responseType:"json",...e}).then(t=>t.data)}},3019(t,e,n){const r=n(3719);t.exports=function(t,e){return r.get(t,{responseType:"text",responseEncoding:"utf8",...e}).then(t=>t.data)}},7379(t,e,n){const r=n(3719);t.exports=function(t,e){return r.head(t,e).then(t=>t.request.res.headers)}},2552(t,e,n){const r=n(3719);t.exports=function(t,e,n){return r.patch(t,e,n).then(t=>t.data)}},7484(t,e,n){const r=n(3719);t.exports=function(t,e,n){return r.post(t,e,n).then(t=>t.data)}},5420(t,e,n){const r=n(8241),o=n(3719);t.exports=function(t,e,n){const s=new r;for(let t=0,n=e.length;t<n;++t){const n=e[t];n.options?s.append(n.name,n.body,n.options):s.append(n.name,n.body)}if(s.getHeaders){const e={...n};return e.headers={...e.headers,...s.getHeaders()},Promise.resolve(o.post(t,s,e)).then(t=>t.data)}return Promise.resolve(o.post(t,s,n)).then(t=>t.data)}},4605(t,e,n){const r=n(3719);t.exports=function(t,e,n){return r.put(t,e,n).then(t=>t.data)}},6357(t,e,n){const r=n(3719);t.exports=function(t,e,n){return r.put(t,e,n).then(t=>t.data)}},2380(t,e,n){const r=n(3719);t.exports=async function(t,e,n){return r.put(t,e,n).then(t=>t.data)}},956(t){t.exports=function(t){return t}},1828(t){t.exports=function(){}},3332(t,e,n){const r=n(4106);t.exports=r},6785(t){t.exports=function t(e,n){return n?t(n,e%n):Math.abs(e)}},7347(t,e,n){const r=n(6785);t.exports=function(t,e){return Math.abs(t*e)/r(t,e)}},792(t){t.exports=function(t,e,n,r){return 0===t&&"string"==typeof r?r:t%10==1&&t%100!=11?e.split("#").join(t):n.split("#").join(t)}},131(t){t.exports=function(t,e){return Math.floor(Math.random()*(e-t+1)+t)}},4476(t){t.exports=function(t,e=1){if(0===e)return t;const n=1/e,r=Math.sign(t),o=function(t){if(Math.floor(t)===t)return 0;const[e,n]=t.toExponential().split("e"),r=(e.split(".")[1]||"").length;return Math.max(0,r-parseInt(n,10))}(e),s=1e-12*r,u=Math.round(t*n+s)/n;return Number(u.toFixed(o))}},7233(t){t.exports=function(t,e){const n=new URL(t||"","xxx://___base___/"),r=n.searchParams;return Object.entries(e||{}).forEach(function([t,e]){switch(e){case null:case void 0:r.delete(t);break;case!0:r.set(t,1);break;case!1:r.set(t,0);break;default:r.set(t,e)}}),t&&"/"===t[0]&&"/"===t[1]?n.toString().replace(/^xxx:/,""):t&&"/"===t[0]?n.toString().replace(/^xxx:\/\/___base___/,""):n.toString().replace(/^xxx:\/\/___base___\//,"")}},6966(t,e,n){const r=n(2468);t.exports=function(t){return new r(function(e,n){t(function(t,r){t?n(t):e(r)})})}},7072(t,e,n){const r={"./array_chunk.js":6083,"./array_chunk_balanced.js":2458,"./array_fps.js":353,"./array_gcd.js":6372,"./array_group.js":3537,"./array_group_map.js":2976,"./array_index.js":2166,"./array_lcm.js":7866,"./array_max.js":6772,"./array_min.js":42,"./array_permutations.js":3685,"./array_shuffle.js":4943,"./array_sort.js":2356,"./array_sort_other.js":5181,"./array_sum.js":453,"./array_unique.js":3523,"./array_unique_last.js":6382,"./date_add_hours.js":9870,"./date_add_milliseconds.js":5799,"./date_add_minutes.js":3160,"./date_add_months.js":1570,"./date_add_seconds.js":9296,"./date_diff_seconds.js":5488,"./date_is_leap_year.js":3752,"./fcmp_dates.js":2806,"./fcmp_default.js":8310,"./fcmp_default_desc.js":2092,"./fcmp_from_spec.js":3553,"./fcmp_numbers.js":3129,"./fcmp_tuples.js":4332,"./fcmp_utf8_bin.js":3106,"./fcmp_utf8_ci.js":2271,"./fcmp_utf8_cs.js":4457,"./fcmp_utf8_natural_bin.js":7668,"./fcmp_utf8_natural_ci.js":4385,"./fcmp_utf8_natural_cs.js":8951,"./fcmpx.js":4734,"./filter1_from_spec.js":7960,"./format_bytes.js":6017,"./format_date.js":1284,"./format_date_fs.js":5224,"./format_date_human.js":1690,"./format_date_ymd.js":6997,"./format_error_report.js":9009,"./format_hrtime.js":6015,"./format_kilo.js":4153,"./format_ms.js":1120,"./format_ms2.js":7336,"./format_ms3.js":495,"./format_percents.js":7882,"./format_progress_bytes.js":7111,"./format_progress_kilo.js":5051,"./format_seconds.js":3527,"./format_thousands.js":2677,"./http_delete.js":4206,"./http_get_blob.js":4131,"./http_get_buffer.js":706,"./http_get_json.js":3066,"./http_get_utf8.js":3019,"./http_head.js":7379,"./http_patch_json.js":2552,"./http_post_json.js":7484,"./http_post_multipart.js":5420,"./http_put_buffer.js":4605,"./http_put_json.js":6357,"./http_put_utf8.js":2380,"./identity.js":956,"./ignore.js":1828,"./plural.js":792,"./random_int.js":131,"./urlmod.js":7233,"./waitcb.js":6966};function o(t){const e=s(t);return n(e)}function s(t){if(!n.o(r,t)){const e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return r[t]}o.keys=function(){return Object.keys(r)},o.resolve=s,t.exports=o,o.id=7072},8241(t){"use strict";t.exports=FormData},2468(t){"use strict";t.exports=Promise},3719(t){"use strict";t.exports=axios}};const e={};function n(r){const o=e[r];if(void 0!==o)return o.exports;const s=e[r]={exports:{}};return t[r](s,s.exports,n),s.exports}n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const r=new URL(document.currentScript.src).searchParams.get("var")??"h";if(void 0!==window[r])console.log(`❌ @vbarbarosh/node-helpers@3.76.0 was not injected — window.${r} is already in use`);else{console.log(`🎉 @vbarbarosh/node-helpers@3.76.0 successfully exposed as window.${r}`),window[r]={};const t=n(7072);t.keys().forEach(function(e){const[,n]=e.match(/([^/]+)\.js$/);window[r][n]=t(e)})}})();