@fluixi/utils 1.0.0-alpha.53

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 (354) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +73 -0
  3. package/dist/index.cjs +1 -0
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +1 -0
  7. package/dist/index.mjs +1 -0
  8. package/dist/lib/array/advanced.cjs +1 -0
  9. package/dist/lib/array/advanced.d.ts +1116 -0
  10. package/dist/lib/array/advanced.d.ts.map +1 -0
  11. package/dist/lib/array/advanced.js +2429 -0
  12. package/dist/lib/array/advanced.mjs +1 -0
  13. package/dist/lib/array/array.cjs +1 -0
  14. package/dist/lib/array/array.d.ts +6 -0
  15. package/dist/lib/array/array.d.ts.map +1 -0
  16. package/dist/lib/array/array.js +31 -0
  17. package/dist/lib/array/array.mjs +1 -0
  18. package/dist/lib/array/index.cjs +1 -0
  19. package/dist/lib/array/index.d.ts +4 -0
  20. package/dist/lib/array/index.d.ts.map +1 -0
  21. package/dist/lib/array/index.js +3 -0
  22. package/dist/lib/array/index.mjs +1 -0
  23. package/dist/lib/array/utils.cjs +1 -0
  24. package/dist/lib/array/utils.d.ts +100 -0
  25. package/dist/lib/array/utils.d.ts.map +1 -0
  26. package/dist/lib/array/utils.js +165 -0
  27. package/dist/lib/array/utils.mjs +1 -0
  28. package/dist/lib/color/color.cjs +1 -0
  29. package/dist/lib/color/color.d.ts +366 -0
  30. package/dist/lib/color/color.d.ts.map +1 -0
  31. package/dist/lib/color/color.js +722 -0
  32. package/dist/lib/color/color.mjs +1 -0
  33. package/dist/lib/color/constants.cjs +1 -0
  34. package/dist/lib/color/constants.d.ts +361 -0
  35. package/dist/lib/color/constants.d.ts.map +1 -0
  36. package/dist/lib/color/constants.js +358 -0
  37. package/dist/lib/color/constants.mjs +1 -0
  38. package/dist/lib/color/conversions.cjs +1 -0
  39. package/dist/lib/color/conversions.d.ts +166 -0
  40. package/dist/lib/color/conversions.d.ts.map +1 -0
  41. package/dist/lib/color/conversions.js +766 -0
  42. package/dist/lib/color/conversions.mjs +1 -0
  43. package/dist/lib/color/helpers.cjs +1 -0
  44. package/dist/lib/color/helpers.d.ts +75 -0
  45. package/dist/lib/color/helpers.d.ts.map +1 -0
  46. package/dist/lib/color/helpers.js +419 -0
  47. package/dist/lib/color/helpers.mjs +1 -0
  48. package/dist/lib/color/index.cjs +1 -0
  49. package/dist/lib/color/index.d.ts +12 -0
  50. package/dist/lib/color/index.d.ts.map +1 -0
  51. package/dist/lib/color/index.js +15 -0
  52. package/dist/lib/color/index.mjs +1 -0
  53. package/dist/lib/color/types.cjs +1 -0
  54. package/dist/lib/color/types.d.ts +179 -0
  55. package/dist/lib/color/types.d.ts.map +1 -0
  56. package/dist/lib/color/types.js +1 -0
  57. package/dist/lib/color/types.mjs +0 -0
  58. package/dist/lib/color/utils.cjs +1 -0
  59. package/dist/lib/color/utils.d.ts +199 -0
  60. package/dist/lib/color/utils.d.ts.map +1 -0
  61. package/dist/lib/color/utils.js +858 -0
  62. package/dist/lib/color/utils.mjs +1 -0
  63. package/dist/lib/compare/comparators.cjs +1 -0
  64. package/dist/lib/compare/comparators.d.ts +65 -0
  65. package/dist/lib/compare/comparators.d.ts.map +1 -0
  66. package/dist/lib/compare/comparators.js +210 -0
  67. package/dist/lib/compare/comparators.mjs +1 -0
  68. package/dist/lib/compare/index.cjs +1 -0
  69. package/dist/lib/compare/index.d.ts +2 -0
  70. package/dist/lib/compare/index.d.ts.map +1 -0
  71. package/dist/lib/compare/index.js +1 -0
  72. package/dist/lib/compare/index.mjs +1 -0
  73. package/dist/lib/crypto/hash.cjs +1 -0
  74. package/dist/lib/crypto/hash.d.ts +6 -0
  75. package/dist/lib/crypto/hash.d.ts.map +1 -0
  76. package/dist/lib/crypto/hash.js +53 -0
  77. package/dist/lib/crypto/hash.mjs +1 -0
  78. package/dist/lib/crypto/index.cjs +1 -0
  79. package/dist/lib/crypto/index.d.ts +2 -0
  80. package/dist/lib/crypto/index.d.ts.map +1 -0
  81. package/dist/lib/crypto/index.js +1 -0
  82. package/dist/lib/crypto/index.mjs +1 -0
  83. package/dist/lib/dom/events.cjs +1 -0
  84. package/dist/lib/dom/events.d.ts +159 -0
  85. package/dist/lib/dom/events.d.ts.map +1 -0
  86. package/dist/lib/dom/events.js +50 -0
  87. package/dist/lib/dom/events.mjs +1 -0
  88. package/dist/lib/dom/index.cjs +1 -0
  89. package/dist/lib/dom/index.d.ts +3 -0
  90. package/dist/lib/dom/index.d.ts.map +1 -0
  91. package/dist/lib/dom/index.js +2 -0
  92. package/dist/lib/dom/index.mjs +1 -0
  93. package/dist/lib/dom/utils.cjs +1 -0
  94. package/dist/lib/dom/utils.d.ts +6 -0
  95. package/dist/lib/dom/utils.d.ts.map +1 -0
  96. package/dist/lib/dom/utils.js +37 -0
  97. package/dist/lib/dom/utils.mjs +1 -0
  98. package/dist/lib/functions/functions.cjs +1 -0
  99. package/dist/lib/functions/functions.d.ts +329 -0
  100. package/dist/lib/functions/functions.d.ts.map +1 -0
  101. package/dist/lib/functions/functions.js +585 -0
  102. package/dist/lib/functions/functions.mjs +1 -0
  103. package/dist/lib/functions/index.cjs +1 -0
  104. package/dist/lib/functions/index.d.ts +3 -0
  105. package/dist/lib/functions/index.d.ts.map +1 -0
  106. package/dist/lib/functions/index.js +1 -0
  107. package/dist/lib/functions/index.mjs +1 -0
  108. package/dist/lib/functions/types.cjs +1 -0
  109. package/dist/lib/functions/types.d.ts +2 -0
  110. package/dist/lib/functions/types.d.ts.map +1 -0
  111. package/dist/lib/functions/types.js +1 -0
  112. package/dist/lib/functions/types.mjs +0 -0
  113. package/dist/lib/helpers.cjs +1 -0
  114. package/dist/lib/helpers.d.ts +13 -0
  115. package/dist/lib/helpers.d.ts.map +1 -0
  116. package/dist/lib/helpers.js +66 -0
  117. package/dist/lib/helpers.mjs +1 -0
  118. package/dist/lib/index.cjs +1 -0
  119. package/dist/lib/index.d.ts +6 -0
  120. package/dist/lib/index.d.ts.map +1 -0
  121. package/dist/lib/index.js +8 -0
  122. package/dist/lib/index.mjs +1 -0
  123. package/dist/lib/maths/constants.cjs +1 -0
  124. package/dist/lib/maths/constants.d.ts +84 -0
  125. package/dist/lib/maths/constants.d.ts.map +1 -0
  126. package/dist/lib/maths/constants.js +79 -0
  127. package/dist/lib/maths/constants.mjs +1 -0
  128. package/dist/lib/maths/fn/advanced.cjs +1 -0
  129. package/dist/lib/maths/fn/advanced.d.ts +149 -0
  130. package/dist/lib/maths/fn/advanced.d.ts.map +1 -0
  131. package/dist/lib/maths/fn/advanced.js +264 -0
  132. package/dist/lib/maths/fn/advanced.mjs +1 -0
  133. package/dist/lib/maths/fn/basic.cjs +1 -0
  134. package/dist/lib/maths/fn/basic.d.ts +182 -0
  135. package/dist/lib/maths/fn/basic.d.ts.map +1 -0
  136. package/dist/lib/maths/fn/basic.js +343 -0
  137. package/dist/lib/maths/fn/basic.mjs +1 -0
  138. package/dist/lib/maths/fn/complex.cjs +1 -0
  139. package/dist/lib/maths/fn/complex.d.ts +153 -0
  140. package/dist/lib/maths/fn/complex.d.ts.map +1 -0
  141. package/dist/lib/maths/fn/complex.js +383 -0
  142. package/dist/lib/maths/fn/complex.mjs +1 -0
  143. package/dist/lib/maths/fn/index.cjs +1 -0
  144. package/dist/lib/maths/fn/index.d.ts +10 -0
  145. package/dist/lib/maths/fn/index.d.ts.map +1 -0
  146. package/dist/lib/maths/fn/index.js +9 -0
  147. package/dist/lib/maths/fn/index.mjs +1 -0
  148. package/dist/lib/maths/fn/trigo.cjs +1 -0
  149. package/dist/lib/maths/fn/trigo.d.ts +147 -0
  150. package/dist/lib/maths/fn/trigo.d.ts.map +1 -0
  151. package/dist/lib/maths/fn/trigo.js +227 -0
  152. package/dist/lib/maths/fn/trigo.mjs +1 -0
  153. package/dist/lib/maths/fn/vector.cjs +1 -0
  154. package/dist/lib/maths/fn/vector.d.ts +512 -0
  155. package/dist/lib/maths/fn/vector.d.ts.map +1 -0
  156. package/dist/lib/maths/fn/vector.js +1136 -0
  157. package/dist/lib/maths/fn/vector.mjs +1 -0
  158. package/dist/lib/maths/formatter.cjs +1 -0
  159. package/dist/lib/maths/formatter.d.ts +35 -0
  160. package/dist/lib/maths/formatter.d.ts.map +1 -0
  161. package/dist/lib/maths/formatter.js +56 -0
  162. package/dist/lib/maths/formatter.mjs +1 -0
  163. package/dist/lib/maths/guards.cjs +1 -0
  164. package/dist/lib/maths/guards.d.ts +166 -0
  165. package/dist/lib/maths/guards.d.ts.map +1 -0
  166. package/dist/lib/maths/guards.js +315 -0
  167. package/dist/lib/maths/guards.mjs +1 -0
  168. package/dist/lib/maths/index.cjs +1 -0
  169. package/dist/lib/maths/index.d.ts +24 -0
  170. package/dist/lib/maths/index.d.ts.map +1 -0
  171. package/dist/lib/maths/index.js +29 -0
  172. package/dist/lib/maths/index.mjs +1 -0
  173. package/dist/lib/maths/parser.cjs +1 -0
  174. package/dist/lib/maths/parser.d.ts +20 -0
  175. package/dist/lib/maths/parser.d.ts.map +1 -0
  176. package/dist/lib/maths/parser.js +78 -0
  177. package/dist/lib/maths/parser.mjs +1 -0
  178. package/dist/lib/maths/random.cjs +1 -0
  179. package/dist/lib/maths/random.d.ts +27 -0
  180. package/dist/lib/maths/random.d.ts.map +1 -0
  181. package/dist/lib/maths/random.js +49 -0
  182. package/dist/lib/maths/random.mjs +1 -0
  183. package/dist/lib/maths/types/advanced.cjs +1 -0
  184. package/dist/lib/maths/types/advanced.d.ts +357 -0
  185. package/dist/lib/maths/types/advanced.d.ts.map +1 -0
  186. package/dist/lib/maths/types/advanced.js +5 -0
  187. package/dist/lib/maths/types/advanced.mjs +0 -0
  188. package/dist/lib/maths/types/basic.cjs +1 -0
  189. package/dist/lib/maths/types/basic.d.ts +95 -0
  190. package/dist/lib/maths/types/basic.d.ts.map +1 -0
  191. package/dist/lib/maths/types/basic.js +5 -0
  192. package/dist/lib/maths/types/basic.mjs +0 -0
  193. package/dist/lib/maths/types/index.cjs +1 -0
  194. package/dist/lib/maths/types/index.d.ts +4 -0
  195. package/dist/lib/maths/types/index.d.ts.map +1 -0
  196. package/dist/lib/maths/types/index.js +3 -0
  197. package/dist/lib/maths/types/index.mjs +0 -0
  198. package/dist/lib/maths/types/negative.cjs +1 -0
  199. package/dist/lib/maths/types/negative.d.ts +51 -0
  200. package/dist/lib/maths/types/negative.d.ts.map +1 -0
  201. package/dist/lib/maths/types/negative.js +5 -0
  202. package/dist/lib/maths/types/negative.mjs +0 -0
  203. package/dist/lib/maths/types/operations.cjs +1 -0
  204. package/dist/lib/maths/types/operations.d.ts +188 -0
  205. package/dist/lib/maths/types/operations.d.ts.map +1 -0
  206. package/dist/lib/maths/types/operations.js +6 -0
  207. package/dist/lib/maths/types/operations.mjs +0 -0
  208. package/dist/lib/object/clone.cjs +1 -0
  209. package/dist/lib/object/clone.d.ts +46 -0
  210. package/dist/lib/object/clone.d.ts.map +1 -0
  211. package/dist/lib/object/clone.js +104 -0
  212. package/dist/lib/object/clone.mjs +1 -0
  213. package/dist/lib/object/diff.cjs +1 -0
  214. package/dist/lib/object/diff.d.ts +203 -0
  215. package/dist/lib/object/diff.d.ts.map +1 -0
  216. package/dist/lib/object/diff.js +805 -0
  217. package/dist/lib/object/diff.mjs +1 -0
  218. package/dist/lib/object/getter-setter.cjs +1 -0
  219. package/dist/lib/object/getter-setter.d.ts +361 -0
  220. package/dist/lib/object/getter-setter.d.ts.map +1 -0
  221. package/dist/lib/object/getter-setter.js +1771 -0
  222. package/dist/lib/object/getter-setter.mjs +1 -0
  223. package/dist/lib/object/index.cjs +6 -0
  224. package/dist/lib/object/index.d.ts +13 -0
  225. package/dist/lib/object/index.d.ts.map +1 -0
  226. package/dist/lib/object/index.js +12 -0
  227. package/dist/lib/object/index.mjs +6 -0
  228. package/dist/lib/object/merge.cjs +1 -0
  229. package/dist/lib/object/merge.d.ts +93 -0
  230. package/dist/lib/object/merge.d.ts.map +1 -0
  231. package/dist/lib/object/merge.js +474 -0
  232. package/dist/lib/object/merge.mjs +1 -0
  233. package/dist/lib/object/object.cjs +1 -0
  234. package/dist/lib/object/object.d.ts +128 -0
  235. package/dist/lib/object/object.d.ts.map +1 -0
  236. package/dist/lib/object/object.js +432 -0
  237. package/dist/lib/object/object.mjs +1 -0
  238. package/dist/lib/object/omit.cjs +1 -0
  239. package/dist/lib/object/omit.d.ts +351 -0
  240. package/dist/lib/object/omit.d.ts.map +1 -0
  241. package/dist/lib/object/omit.js +656 -0
  242. package/dist/lib/object/omit.mjs +1 -0
  243. package/dist/lib/object/reconcile.cjs +1 -0
  244. package/dist/lib/object/reconcile.d.ts +7 -0
  245. package/dist/lib/object/reconcile.d.ts.map +1 -0
  246. package/dist/lib/object/reconcile.js +122 -0
  247. package/dist/lib/object/reconcile.mjs +1 -0
  248. package/dist/lib/object/selector.cjs +1 -0
  249. package/dist/lib/object/selector.d.ts +50 -0
  250. package/dist/lib/object/selector.d.ts.map +1 -0
  251. package/dist/lib/object/selector.js +371 -0
  252. package/dist/lib/object/selector.mjs +1 -0
  253. package/dist/lib/object/sort.cjs +1 -0
  254. package/dist/lib/object/sort.d.ts +149 -0
  255. package/dist/lib/object/sort.d.ts.map +1 -0
  256. package/dist/lib/object/sort.js +298 -0
  257. package/dist/lib/object/sort.mjs +1 -0
  258. package/dist/lib/object/transform.cjs +1 -0
  259. package/dist/lib/object/transform.d.ts +620 -0
  260. package/dist/lib/object/transform.d.ts.map +1 -0
  261. package/dist/lib/object/transform.js +1058 -0
  262. package/dist/lib/object/transform.mjs +1 -0
  263. package/dist/lib/object/types.cjs +1 -0
  264. package/dist/lib/object/types.d.ts +250 -0
  265. package/dist/lib/object/types.d.ts.map +1 -0
  266. package/dist/lib/object/types.js +1 -0
  267. package/dist/lib/object/types.mjs +0 -0
  268. package/dist/lib/object/utils.cjs +6 -0
  269. package/dist/lib/object/utils.d.ts +165 -0
  270. package/dist/lib/object/utils.d.ts.map +1 -0
  271. package/dist/lib/object/utils.js +444 -0
  272. package/dist/lib/object/utils.mjs +6 -0
  273. package/dist/lib/primitive/boolean/boolean.cjs +1 -0
  274. package/dist/lib/primitive/boolean/boolean.d.ts +276 -0
  275. package/dist/lib/primitive/boolean/boolean.d.ts.map +1 -0
  276. package/dist/lib/primitive/boolean/boolean.js +615 -0
  277. package/dist/lib/primitive/boolean/boolean.mjs +1 -0
  278. package/dist/lib/primitive/boolean/index.cjs +1 -0
  279. package/dist/lib/primitive/boolean/index.d.ts +3 -0
  280. package/dist/lib/primitive/boolean/index.d.ts.map +1 -0
  281. package/dist/lib/primitive/boolean/index.js +2 -0
  282. package/dist/lib/primitive/boolean/index.mjs +1 -0
  283. package/dist/lib/primitive/boolean/types.cjs +1 -0
  284. package/dist/lib/primitive/boolean/types.d.ts +14 -0
  285. package/dist/lib/primitive/boolean/types.d.ts.map +1 -0
  286. package/dist/lib/primitive/boolean/types.js +1 -0
  287. package/dist/lib/primitive/boolean/types.mjs +0 -0
  288. package/dist/lib/primitive/date/date.cjs +1 -0
  289. package/dist/lib/primitive/date/date.d.ts +641 -0
  290. package/dist/lib/primitive/date/date.d.ts.map +1 -0
  291. package/dist/lib/primitive/date/date.js +1998 -0
  292. package/dist/lib/primitive/date/date.mjs +1 -0
  293. package/dist/lib/primitive/date/index.cjs +1 -0
  294. package/dist/lib/primitive/date/index.d.ts +3 -0
  295. package/dist/lib/primitive/date/index.d.ts.map +1 -0
  296. package/dist/lib/primitive/date/index.js +2 -0
  297. package/dist/lib/primitive/date/index.mjs +1 -0
  298. package/dist/lib/primitive/date/types.cjs +1 -0
  299. package/dist/lib/primitive/date/types.d.ts +205 -0
  300. package/dist/lib/primitive/date/types.d.ts.map +1 -0
  301. package/dist/lib/primitive/date/types.js +7 -0
  302. package/dist/lib/primitive/date/types.mjs +0 -0
  303. package/dist/lib/primitive/index.cjs +5 -0
  304. package/dist/lib/primitive/index.d.ts +5 -0
  305. package/dist/lib/primitive/index.d.ts.map +1 -0
  306. package/dist/lib/primitive/index.js +4 -0
  307. package/dist/lib/primitive/index.mjs +5 -0
  308. package/dist/lib/primitive/string/index.cjs +5 -0
  309. package/dist/lib/primitive/string/index.d.ts +3 -0
  310. package/dist/lib/primitive/string/index.d.ts.map +1 -0
  311. package/dist/lib/primitive/string/index.js +2 -0
  312. package/dist/lib/primitive/string/index.mjs +5 -0
  313. package/dist/lib/primitive/string/parser-2.cjs +8 -0
  314. package/dist/lib/primitive/string/parser-2.d.ts +17 -0
  315. package/dist/lib/primitive/string/parser-2.d.ts.map +1 -0
  316. package/dist/lib/primitive/string/parser-2.js +656 -0
  317. package/dist/lib/primitive/string/parser-2.mjs +8 -0
  318. package/dist/lib/primitive/string/parser.cjs +3 -0
  319. package/dist/lib/primitive/string/parser.d.ts +9 -0
  320. package/dist/lib/primitive/string/parser.d.ts.map +1 -0
  321. package/dist/lib/primitive/string/parser.js +775 -0
  322. package/dist/lib/primitive/string/parser.mjs +3 -0
  323. package/dist/lib/primitive/string/string.cjs +5 -0
  324. package/dist/lib/primitive/string/string.d.ts +535 -0
  325. package/dist/lib/primitive/string/string.d.ts.map +1 -0
  326. package/dist/lib/primitive/string/string.js +1301 -0
  327. package/dist/lib/primitive/string/string.mjs +5 -0
  328. package/dist/lib/primitive/string/types.cjs +1 -0
  329. package/dist/lib/primitive/string/types.d.ts +318 -0
  330. package/dist/lib/primitive/string/types.d.ts.map +1 -0
  331. package/dist/lib/primitive/string/types.js +5 -0
  332. package/dist/lib/primitive/string/types.mjs +0 -0
  333. package/dist/lib/primitive/types.cjs +1 -0
  334. package/dist/lib/primitive/types.d.ts +27 -0
  335. package/dist/lib/primitive/types.d.ts.map +1 -0
  336. package/dist/lib/primitive/types.js +1 -0
  337. package/dist/lib/primitive/types.mjs +0 -0
  338. package/dist/lib/url/index.cjs +1 -0
  339. package/dist/lib/url/index.d.ts +3 -0
  340. package/dist/lib/url/index.d.ts.map +1 -0
  341. package/dist/lib/url/index.js +2 -0
  342. package/dist/lib/url/index.mjs +1 -0
  343. package/dist/lib/url/parser.cjs +1 -0
  344. package/dist/lib/url/parser.d.ts +216 -0
  345. package/dist/lib/url/parser.d.ts.map +1 -0
  346. package/dist/lib/url/parser.js +488 -0
  347. package/dist/lib/url/parser.mjs +1 -0
  348. package/dist/lib/url/types.cjs +1 -0
  349. package/dist/lib/url/types.d.ts +18 -0
  350. package/dist/lib/url/types.d.ts.map +1 -0
  351. package/dist/lib/url/types.js +1 -0
  352. package/dist/lib/url/types.mjs +0 -0
  353. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  354. package/package.json +150 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Fluixi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/fluixi/assets/main/logos/128x128.png" alt="Fluixi" width="120" height="120" />
3
+ </p>
4
+
5
+ # @fluixi/utils
6
+
7
+ **Zero-dependency, strongly-typed utilities for everyday TypeScript.**
8
+
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-22c55e.svg)](./LICENSE)
10
+ ![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178c6?logo=typescript&logoColor=white)
11
+ ![Registry](https://img.shields.io/badge/registry-GitHub%20Packages-181717?logo=github)
12
+ ![Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)
13
+
14
+ ---
15
+
16
+ ## ✨ Overview
17
+
18
+ `@fluixi/utils` is the foundational layer of Fluixi Core: a collection of small, tree-shakeable, **fully-typed** helpers with **no runtime dependencies**. Every module is exported under its own subpath so you only ship what you import.
19
+
20
+ ## 🧩 Modules
21
+
22
+ | Import | What it provides |
23
+ | --- | --- |
24
+ | `@fluixi/utils/primitive` | String, number, boolean, and date helpers. |
25
+ | `@fluixi/utils/object` | Deep get/set, clone, diff, merge, immutable path updates. |
26
+ | `@fluixi/utils/array` | Array transforms, grouping, and set operations. |
27
+ | `@fluixi/utils/maths` | Vectors, interpolation, clamping, constants, and guards. |
28
+ | `@fluixi/utils/color` | Color parsing and conversion. |
29
+ | `@fluixi/utils/dom` | Lightweight DOM helpers. |
30
+ | `@fluixi/utils/functions` | Composition, debounce/throttle, memoization. |
31
+ | `@fluixi/utils/compare` | Deep equality and comparison utilities. |
32
+
33
+ ## 📦 Installation
34
+
35
+ ```ini
36
+ # .npmrc
37
+ @fluixi:registry=https://npm.pkg.github.com
38
+ //npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
39
+ ```
40
+
41
+ ```sh
42
+ pnpm add @fluixi/utils
43
+ ```
44
+
45
+ ## 🚀 Usage
46
+
47
+ ```ts
48
+ import { set, get } from '@fluixi/utils/object';
49
+
50
+ const state = { users: [{ name: 'Alice' }] };
51
+
52
+ // Immutable update — returns a new object, leaves `state` untouched
53
+ const next = set(state, 'users', 0, 'name', 'Alice Updated');
54
+
55
+ get(next, 'users[0].name'); // → 'Alice Updated'
56
+ get(state, 'users[0].name'); // → 'Alice' (original is unchanged)
57
+ ```
58
+
59
+ ```ts
60
+ import { lerp, clamp } from '@fluixi/utils/maths/fn';
61
+
62
+ lerp(0, 100, 0.25); // → 25
63
+ clamp(150, 0, 100); // → 100
64
+ ```
65
+
66
+ ## 📋 Requirements
67
+
68
+ - **TypeScript** ≥ 5.8 (ships its own `.d.ts` declarations)
69
+ - **Node.js** ≥ 20 / any modern bundler (ESM + CJS builds included)
70
+
71
+ ## 📄 License
72
+
73
+ [MIT](./LICENSE) © [Fluixi](https://fluixi.dev)
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";var V=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var ye=Object.prototype.hasOwnProperty;var pe=(e,n)=>{for(var t in n)V(e,t,{get:n[t],enumerable:!0})},de=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of ce(n))!ye.call(e,i)&&i!==t&&V(e,i,{get:()=>n[i],enumerable:!(r=le(n,i))||r.enumerable});return e};var Te=e=>de(V({},"__esModule",{value:!0}),e);var vr={};pe(vr,{aenu:()=>Ht,after:()=>Ar,applyByIndex:()=>pt,ary:()=>cr,at:()=>Me,avgBy:()=>Un,batch:()=>Et,batchProcess:()=>Nn,batchProcessParallel:()=>Bn,before:()=>gr,bifurcate:()=>_n,binarySearch:()=>Ct,bind:()=>fr,btoa:()=>Dt,cartesian:()=>Rn,chunk:()=>I,chunkBy:()=>Fn,compact:()=>on,compareWithHash:()=>Qt,compose:()=>se,countBy:()=>_e,createHash:()=>Jt,cumulativeSum:()=>at,curry:()=>ir,debounce:()=>ie,dedupeConsecutive:()=>nt,deepCloneArray:()=>hn,defer:()=>pr,delay:()=>dr,diff:()=>ut,difference:()=>Ze,differenceWith:()=>Yn,drop:()=>rn,dropWhile:()=>sn,ensureArray:()=>Q,enumerate:()=>yt,everyAsync:()=>Ot,fill:()=>xn,filterAsync:()=>St,filterCompact:()=>Pn,filterConsecutive:()=>Ft,findAllIndices:()=>In,findAsync:()=>wt,findIndex:()=>cn,findLastIndex:()=>yn,first:()=>Fe,flatMap:()=>gn,flatten:()=>ze,flattenArray:()=>Ve,flattenDeep:()=>_,flip:()=>lr,flow:()=>xr,flowRight:()=>hr,frequencies:()=>P,generate:()=>Jn,generateID:()=>Le,generateUUID:()=>Be,getKind:()=>Ne,groupArrayBy:()=>Ee,groupBy:()=>He,groupConsecutive:()=>et,hasDuplicates:()=>mt,hasSameElements:()=>Dn,hash:()=>C,hashStringPromise:()=>Zt,indexBy:()=>$t,insert:()=>wn,insertSorted:()=>Ut,interleave:()=>Hn,intersection:()=>Ge,isAddRemoveListenerTarget:()=>Lt,isArray:()=>Se,isArrayEqual:()=>qn,isArrayLike:()=>Ke,isArrayOfBoolean:()=>xe,isArrayOfNumber:()=>me,isArrayOfObject:()=>he,isArrayOfString:()=>Ae,isAsyncFunction:()=>Yt,isDOMEventTarget:()=>Wt,isDefined:()=>We,isDoubleArray:()=>we,isEmptyArray:()=>Oe,isEqual:()=>kn,isFunction:()=>re,isIterable:()=>B,isNodeEventEmitter:()=>Nt,isNonEmptyArray:()=>Pe,isNull:()=>$e,isObjectArray:()=>be,isOnOffTarget:()=>Bt,isPrimitive:()=>D,isPromise:()=>Xt,isReadonlyArray:()=>Ie,isSorted:()=>At,isStaticArray:()=>ve,isSubset:()=>X,isSuperset:()=>zn,isTypedArray:()=>Re,isUndefined:()=>Ce,isUndefinedOrNull:()=>Ue,keyBy:()=>Je,last:()=>ke,leastCommon:()=>Wn,mapAsync:()=>ht,mapAsyncParallel:()=>bt,mapWithContext:()=>jt,maxBy:()=>Cn,median:()=>Zn,memoize:()=>er,memoizeWithTTL:()=>Tr,mergeArraysByKey:()=>Mt,mergeByKey:()=>bn,minBy:()=>$n,mode:()=>Gn,mostCommon:()=>G,move:()=>Sn,negate:()=>sr,normalize:()=>st,omit:()=>Tn,once:()=>tr,overArgs:()=>or,pad:()=>ft,pairwise:()=>ct,partial:()=>ar,partialRight:()=>ur,partition:()=>Ye,percentile:()=>E,pick:()=>dn,pickMany:()=>xt,pipe:()=>oe,pluck:()=>pn,quartiles:()=>rt,range:()=>mn,rank:()=>tt,rearg:()=>rr,reduceAsync:()=>vt,reduceRight:()=>An,remove:()=>Kn,repeat:()=>Qn,replace:()=>On,retry:()=>br,reverseSegment:()=>gt,rotate:()=>vn,rotateLeft:()=>ee,rotateRight:()=>dt,sample:()=>fn,sampleSize:()=>ln,scan:()=>Y,segment:()=>It,selectByCount:()=>kt,shuffle:()=>J,slidingWindow:()=>Mn,someAsync:()=>Kt,sortBy:()=>Qe,splitDuplicates:()=>En,standardDeviation:()=>$,standardize:()=>ot,string_hash:()=>Gt,sumBy:()=>Z,swap:()=>Tt,take:()=>en,takeLast:()=>nn,takeWhile:()=>tn,throttle:()=>nr,toArray:()=>je,toArrayString:()=>ge,toObject:()=>ne,transpose:()=>Ln,trim:()=>lt,tryCatch:()=>mr,uena:()=>zt,unary:()=>yr,union:()=>Xe,unique:()=>j,unzip:()=>un,updateBy:()=>jn,updateQueryStringParameter:()=>_t,variance:()=>it,weightedAverage:()=>Pt,weightedSample:()=>Rt,windowObject:()=>qt,withTimeout:()=>Sr,without:()=>Xn,wrap:()=>Vn,zip:()=>an,zipWith:()=>Vt});module.exports=Te(vr);var ge=e=>{if(Array.isArray(e))return e;if(typeof e=="string")if(e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch{return[]}else return[e];return[]};function Ae(e){return Array.isArray(e)&&e.every(n=>typeof n=="string")}function me(e){return Array.isArray(e)&&e.every(n=>typeof n=="number")}function xe(e){return Array.isArray(e)&&e.every(n=>typeof n=="boolean")}function he(e){return Array.isArray(e)&&e.every(n=>typeof n=="object")}var N=require("@fluixi/utils/object"),be=e=>Array.isArray(e)&&e.every(n=>(0,N.isObject)(n));function Se(e){return Array.isArray(e)}function ve(e){return Array.isArray(e)}function we(e){return Array.isArray(e)&&e.every(n=>Array.isArray(n)&&n.length===2)}function B(e){return e!=null&&typeof e[Symbol.iterator]=="function"}function Ke(e){return e!=null&&typeof e=="object"&&"length"in e&&typeof e.length=="number"&&e.length>=0&&(e.length===0||e.length-1 in e)}function Oe(e){return Array.isArray(e)&&e.length===0}function Pe(e){return Array.isArray(e)&&e.length>0}function Re(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ie(e){return Array.isArray(e)}function ke(e){return e.length>0?e[e.length-1]:void 0}function Fe(e){return e.length>0?e[0]:void 0}function je(e){return Array.isArray(e)?[...e]:B(e)?[...e]:Array.from(e)}function Ee(e,n){return e.reduce((t,r)=>{let i=n(r);return t[i]||(t[i]=[]),t[i].push(r),t},{})}function Ve(e){return e.flat()}function Me(e,n){let t=n<0?e.length+n:n;return e[t]}var m=e=>e==null||Array.isArray(e)||typeof e=="function"||e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error?!1:typeof e=="object";var S=(e,n,t,r)=>{if(t>r)return;if(n.length===0)return e;let i=n[0],s=n.slice(1);if(i.type==="descendant"){let a=S(e,s,t+1,r);if(a!==void 0)return a;if(e&&typeof e=="object")if(Array.isArray(e)){let o=[];for(let u=0;u<e.length;u++){let f=S(e[u],n,t+1,r);f!==void 0&&(o[u]=f)}return o.length>0?o:void 0}else{let o={};for(let u in e)if(e.hasOwnProperty(u)){let f=S(e[u],n,t+1,r);f!==void 0&&(o[u]=f)}return Object.keys(o).length>0?o:void 0}return}switch(i.type){case"property":if(m(e)&&i.value&&String(i.value)in e){let a=e[String(i.value)],o=S(a,s,t+1,r);if(o!==void 0)return{[String(i.value)]:o}}break;case"index":if(Array.isArray(e)){let a=i.value;if(a>=0&&a<e.length){let o=S(e[a],s,t+1,r);if(o!==void 0){let u=new Array(e.length).filter(f=>f!==void 0);return u[a]=o,u}}}else if(e&&typeof e=="object"){let a=String(i.value);if(a in e){let o=S(e[a],s,t+1,r);if(o!==void 0)return{[a]:o}}}break;case"wildcard":if(e&&typeof e=="object")if(Array.isArray(e)){let a=[],o=!1;for(let u=0;u<e.length;u++){let f=S(e[u],s,t+1,r);f!==void 0&&(a[u]=f,o=!0)}return o?a:void 0}else{let a={},o=!1;for(let u in e)if(e.hasOwnProperty(u)){let f=S(e[u],s,t+1,r);f!==void 0&&(a[u]=f,o=!0)}return o?a:void 0}break;case"slice":if(Array.isArray(e)){let[a,o]=i.value,u=Math.max(0,a),f=Math.min(e.length,o===1/0?e.length:o),y=[],T=!1;for(let p=u;p<f;p++){let b=S(e[p],s,t+1,r);b!==void 0&&(y[p]=b,T=!0)}return T?y:void 0}break;case"union":if(Array.isArray(e)){let a=i.value,o=[],u=!1;for(let f of a)if(f>=0&&f<e.length){let y=S(e[f],s,t+1,r);y!==void 0&&(o[f]=y,u=!0)}return u?o:void 0}break;case"filter":if(Array.isArray(e)){let a=i.value,o=[],u=!1;for(let f=0;f<e.length;f++)if(a(e[f])){let y=S(e[f],s,t+1,r);y!==void 0&&(o[f]=y,u=!0)}return u?o:void 0}break}};var K=(e,n)=>{if(e==null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(e instanceof Map){let t=new Map;return e.forEach((r,i)=>{(!n||!n.some(s=>s.toString()===i.toString()))&&t.set(i,K(r))}),t}if(e instanceof Set){let t=new Set;return e.forEach(r=>{t.add(K(r))}),t}if(Array.isArray(e))return Array.from(e).map(t=>K(t));if(m(e)){let t={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(!n||!n.some(s=>s.toString()===i.toString()))&&(t[i]=K(e[i]));let r=Object.getOwnPropertySymbols(e);for(let i of r)(!n||!n.some(s=>s.toString()===i.toString()))&&(t[i]=K(e[i]));return t}return e};var M=require("@fluixi/utils/primitive"),F=require("@fluixi/utils/object"),L=require("@fluixi/utils/array"),q=require("@fluixi/utils/functions");function $e(e){return e===null}function Ce(e){return e===void 0}var Ue=e=>typeof e>"u"||e===null;function D(e){let n=typeof e;return e===null||n==="string"||n==="number"||n==="boolean"||n==="symbol"||n==="bigint"||n==="undefined"||(0,M.isDate)(e)}function We(e){return e!=null}function Ne(e){return e===null?"null":e===void 0?"undefined":(0,M.isDate)(e)?"date":(0,F.isClass)(e)?"class":(0,q.isFunction)(e)?"function":(0,L.isArray)(e)?"array":D(e)?"primitive":(0,F.isObject)(e)?"object":"primitive"}var Be=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let n=Math.random()*16|0;return(e==="x"?n:n&3|8).toString(16)}),Le=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let n=Math.random()*16|0;return(e==="x"?n:n&3|8).toString(16)});var R=(e,n={})=>{let{type:t="auto",throwOnError:r=!1}=n;if(!e||typeof e!="string")return[];let i=[],s="",a=!1,o=!1,u="",f="",y=0,p=t==="auto"?(l=>l.includes("..")?"descendant":l.includes("[?(")?"filter":l.includes("[:")||l.includes("[0:")?"slice":l.includes("[,")||l.includes("[0,1]")?"union":l.includes("[*]")||l.includes(".*.")?"wildcard":l.includes("[]")?"array-wildcard":l.includes("[")&&l.includes("]")?"bracket":"dot")(e):t,b=l=>{let c=l.trim();if(c==="*"||c==="")return{type:"wildcard",value:c===""?"[]":"*",raw:c===""?"[]":l};if(c==="[]")return{type:"wildcard",value:"[]",raw:l};if(/^-?\d+$/.test(c))return{type:"index",value:parseInt(c,10),raw:l};if(c.includes(":")){let g=c.split(":").map(O=>O.trim()),x=g[0]===""?0:parseInt(g[0],10),h=g[1]===""?1/0:parseInt(g[1],10);if(isNaN(x)||isNaN(h)){if(r)throw new Error(`Invalid slice notation: ${l}`);return{type:"wildcard",value:"*",raw:l}}return{type:"slice",value:[x,h],raw:l}}if(c.includes(",")){let g=c.split(",").map(x=>{let h=parseInt(x.trim(),10);return isNaN(h)?-1:h}).filter(x=>x>=0);if(g.length===0){if(r)throw new Error(`Invalid union notation: ${l}`);return{type:"wildcard",value:"*",raw:l}}return{type:"union",value:g,raw:l}}if(c.startsWith("?(")&&c.endsWith(")")){let g=c.slice(2,-1);try{return{type:"filter",value:qe(g),raw:l}}catch(x){if(r)throw x;return{type:"wildcard",value:"*",raw:l}}}return c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'")?{type:"property",value:c.slice(1,-1),raw:l}:{type:"property",value:c,raw:l}};for(let l=0;l<e.length;l++){let c=e[l],g=e[l+1];if((c==='"'||c==="'")&&!o){o=!0,u=c;continue}else if(c===u&&o){o=!1,u="",c==='"'||c==="'"||(a?f+=c:s+=c);continue}if(o){a?f+=c:s+=c;continue}if(c==="["&&!a){s&&(i.push({type:"property",value:s,raw:s}),s=""),a=!0,f="";continue}if(c==="]"&&a&&!o){a=!1;let h=b(f);i.push(h);continue}let x=i.length>0?i[i.length-1]:null;if(c==="."&&!a&&!o){if(g==="."){let h=e.split("..")[0];i.push({type:"property",value:h,raw:h}),i.push({type:"descendant",value:"..",raw:".."}),l++}else s&&(s==="*"?i.push({type:"wildcard",value:s,raw:s}):i.push({type:"property",value:s,raw:s}),s="");continue}if(a)f+=c;else if(x&&x.type!=="descendant")s+=c;else{let h=e.split(x?.raw)[1];h!==void 0?s=h:s+=c}}return s&&i.push({type:"property",value:s,raw:s}),i.map(l=>{if(l.type==="property"&&typeof l.value=="string"&&/^-?\d+$/.test(l.value)){let c=parseInt(l.value,10);if(!isNaN(c))return{...l,type:"index",value:c}}return l})},qe=e=>{let n=e.replace(/@\.([a-zA-Z_$][\w$]*)/g,(t,r)=>`item.${r}`).replace(/@/g,"item");try{return new Function("item",`return ${n}`)}catch{throw new Error(`Invalid filter expression: ${e}`)}};var z=(e,n,t)=>{let r=R(n),i=e;for(let s=0;s<r.length;s++){let a=r[s],o=s===r.length-1;switch(a.type){case"property":if(o)i[String(a.value)]=t;else{if(!i[String(a.value)]){let f=r[s+1];i[String(a.value)]=f.type==="index"||f.type==="slice"||f.type==="union"||f.type==="wildcard"?[]:{}}i=i[String(a.value)]}break;case"index":Array.isArray(i)||(i=[]);let u=a.value;if(o){if(u>=i.length)for(let f=i.length;f<=u;f++)i.push(void 0);i[u]=t}else{if(!i[u]){let f=r[s+1];i[u]=f.type==="index"||f.type==="slice"||f.type==="union"||f.type==="wildcard"?[]:{}}i=i[u]}break;case"wildcard":if(Array.isArray(i))if(o)for(let f=0;f<i.length;f++)i[f]=t;else{let f=r[s+1];for(let y=0;y<i.length;y++)i[y]||(i[y]=f.type==="index"||f.type==="slice"||f.type==="union"||f.type==="wildcard"?[]:{});i.length>0&&(i=i[0])}break}}};function d(e,n,t={}){let{preserveStructure:r,multiple:i,throwOnError:s=!1,defaultValue:a,maxDepth:o=20}=t;if(!e||typeof e!="object")return a;if(!n)return e;if(Array.isArray(n))if(r){let y={};for(let T of n){let p=d(e,T,{...t,preserveStructure:!1});p!==void 0&&z(y,T,p)}return y}else return n.map(y=>d(e,y,{...t,preserveStructure:!1}));let u=R(n,{...t,throwOnError:s});if(u.length===0)return e;if(typeof r>"u"||r===!1){let y=De(e,n);return i===!1&&Array.isArray(y)?y[0]:y===void 0&&a!==void 0?a:y}let f=S(e,u,0,o);return f===void 0&&a!==void 0?a:f}function De(e,n,t={}){let{createMissing:r=!1,add:i=!1,debug:s=!1}=t,a=R(n),o=e,u=!1,f="",y=n;if(typeof o=="object"&&!Array.isArray(o)&&y.length>0&&o[y])return o=o[y],o;for(let T=0;T<a.length;T++){let p=a[T],b=a.length>1?T===a.length-1:!1;if(o===null&&!r)return;let l=a[T+1];switch(p.type){case"property":if(o&&typeof o=="object")if(Array.isArray(o)){if(typeof p.value=="number"){let c=p.value;if(r&&c>=o.length)for(let g=o.length;g<=c;g++)o.push(void 0);if(r&&(o[c]===null||o[c]===void 0)&&(!b||u)&&(l?o[c]=l.type==="index"||l.type==="slice"||l.type==="union"||l.type==="wildcard"?[]:{}:o[c]=null,u=!1),o=o[c],l){u=!0;continue}}else i?o.push({[String(p.value)]:null}):o=o.map(c=>c[String(p.value)]);if(l)continue;return H(o)}else{if(o[f]&&f.split(".").length>=2){o=o[f];continue}if(r&&(o[String(p.value)]===null||o[String(p.value)]===void 0)&&(!b||u)&&(l?o[String(p.value)]=l.type==="index"||l.type==="slice"||l.type==="union"||l.type==="wildcard"?[]:{}:o[String(p.value)]=null,u=!1,o=o[String(p.value)],l)){u=!0;continue}if(o?(!o[String(p.value)]&&r&&(o[String(p.value)]=null),o=o[String(p.value)]):o={[String(p.value)]:null},l)continue}else if(r)o={},o[String(p.value)]=l.type==="index"||l.type==="slice"||l.type==="union"||l.type==="wildcard"||t.type==="array"?[]:{},o=o[String(p.value)];else return;break;case"index":case"wildcard":if(Array.isArray(o)){if(p.type==="index"){let c=p.value;if(c<0){o=o[o.length-Math.abs(c)];continue}if(r&&(c>=o.length||o[c]==null||o[c]==null)&&!b){for(let g=o.length;g<=c;g++)o.push(void 0);l&&(o[c]=l.type==="index"||l.type==="slice"||l.type==="union"||l.type==="wildcard"?[]:{})}o=o[c]}else if(!b)continue}else if(r){let c=a[T+1];o=[];let g=p.value;for(let x=0;x<=g;x++)o.push(void 0);o[g]=c.type==="index"||c.type==="slice"||c.type==="union"||c.type==="wildcard"||t.type==="array"?[]:{},o=o[g]}else{if(p.type==="index"&&typeof o=="object"&&o&&o[String(p.value)]!==void 0){o=o[String(p.value)];continue}if(typeof o=="object"){o=Object.values(o);continue}return}break;default:return}}return H(o)}function H(e){return Array.isArray(e)?e.filter(n=>typeof n<"u"):e}function I(e,n){if(!Array.isArray(e)||n<1)return[];let t=[];for(let r=0;r<e.length;r+=n)t.push(e.slice(r,r+n));return t}function ze(e){return e.reduce((n,t)=>n.concat(t),[])}function _(e,n=1/0){return n<1?e.slice():e.reduce((t,r)=>(Array.isArray(r)?t.push(..._(r,n-1)):t.push(r),t),[])}function j(e,n){if(!Array.isArray(e))return[];if(!n)return[...new Set(e)];let t=new Set;return e.filter(r=>{let i=typeof n=="function"?n(r):m(r)?d(r,n):r;return t.has(i)?!1:(t.add(i),!0)})}function He(e,n){return Array.isArray(e)?e.reduce((t,r)=>{let i;return typeof n=="function"?i=String(n(r)):i=String(m(r)?d(r,n):r),t[i]||(t[i]=[]),t[i].push(r),t},{}):{}}function _e(e,n){return Array.isArray(e)?e.reduce((t,r)=>{let i;return typeof n=="function"?i=String(n(r)):n?i=String(m(r)?d(r,n):r):i=String(r),t[i]=(t[i]||0)+1,t},{}):{}}function Je(e,n,t){return Array.isArray(e)?e.reduce((r,i)=>{let s;typeof n=="function"?s=String(n(i)):s=String(m(i)?d(i,n):i);let a;return t?typeof t=="function"?a=t(i):a=d(i,t):a=i,r[s]=a,r},{}):{}}function Qe(e,n){if(!Array.isArray(e)||e.length===0)return[];let t=[...e],i=(Array.isArray(n)?n:[n]).map(s=>typeof s=="object"&&"key"in s?{key:s.key,dir:s.dir||"asc"}:{key:s,dir:"asc"});return t.sort((s,a)=>{for(let{key:o,dir:u}of i){let f=m(s)?d(s,o):s,y=m(a)?d(a,o):a;if(f===y)continue;let T=f<y?-1:1;return u==="asc"?T:-T}return 0}),t}function Ze(e,n,t){if(!Array.isArray(e))return[];if(!Array.isArray(n))return e;if(!t){let i=new Set(n);return e.filter(s=>!i.has(s))}let r=new Set(n.map(i=>m(i)?d(i,t):i));return e.filter(i=>{let s=m(i)?d(i,t):i;return!r.has(s)})}function Ge(e,n,t){if(!Array.isArray(e)||!Array.isArray(n))return[];if(!t){let i=new Set(n);return e.filter(s=>i.has(s))}let r=new Set(n.map(i=>m(i)?d(i,t):i));return e.filter(i=>{let s=m(i)?d(i,t):i;return r.has(s)})}function Xe(e,n,t){return!Array.isArray(e)&&!Array.isArray(n)?[]:Array.isArray(e)?Array.isArray(n)?j([...e,...n],t):j(e,t):j(n,t)}function Ye(e,n){return Array.isArray(e)?e.reduce((t,r,i)=>(t[n(r,i)?0:1].push(r),t),[[],[]]):[[],[]]}function en(e,n){return!Array.isArray(e)||n<=0?[]:e.slice(0,n)}function nn(e,n){return!Array.isArray(e)||n<=0?[]:e.slice(-n)}function tn(e,n){if(!Array.isArray(e))return[];let t=[];for(let r=0;r<e.length&&n(e[r],r);r++)t.push(e[r]);return t}function rn(e,n){return!Array.isArray(e)||n<=0?e?[...e]:[]:e.slice(n)}function sn(e,n){if(!Array.isArray(e))return[];let t=0;for(;t<e.length&&n(e[t],t);)t++;return e.slice(t)}function on(e){return Array.isArray(e)?e.filter(Boolean):[]}function an(...e){if(e.length===0)return[];let n=Math.max(...e.map(r=>Array.isArray(r)?r.length:0)),t=[];for(let r=0;r<n;r++){let i=[];for(let s of e)i.push(Array.isArray(s)?s[r]:void 0);t.push(i)}return t}function un(e){if(!Array.isArray(e)||e.length===0)return[];let n=Math.max(...e.map(r=>Array.isArray(r)?r.length:0)),t=[];for(let r=0;r<n;r++){let i=[];for(let s of e)Array.isArray(s)&&i.push(s[r]);t.push(i)}return t}function J(e){if(!Array.isArray(e))return[];let n=[...e];for(let t=n.length-1;t>0;t--){let r=Math.floor(Math.random()*(t+1));[n[t],n[r]]=[n[r],n[t]]}return n}function fn(e){if(!(!Array.isArray(e)||e.length===0))return e[Math.floor(Math.random()*e.length)]}function ln(e,n){return!Array.isArray(e)||n<=0?[]:J(e).slice(0,Math.min(n,e.length))}function cn(e,n,t=0){if(!Array.isArray(e))return-1;for(let r=t;r<e.length;r++)if(n(e[r],r))return r;return-1}function yn(e,n,t){if(!Array.isArray(e))return-1;let r=t!==void 0?t:e.length-1;for(let i=r;i>=0;i--)if(n(e[i],i))return i;return-1}function pn(e,n){return Array.isArray(e)?e.map(t=>d(t,n)):[]}function dn(e,n){return!Array.isArray(e)||!Array.isArray(n)?[]:e.map(t=>{let r={};for(let i of n)i in t&&(r[i]=t[i]);return r})}function Tn(e,n){return!Array.isArray(e)||!Array.isArray(n)?[]:e.map(t=>{let r={...t};for(let i of n)delete r[i];return r})}function gn(e,n){return Array.isArray(e)?e.reduce((t,r,i)=>{let s=n(r,i);return t.concat(s)},[]):[]}function An(e,n,t){if(!Array.isArray(e))return t;let r=t;for(let i=e.length-1;i>=0;i--)r=n(r,e[i],i);return r}function mn(e,n,t=1){if(t===0)return[];let r=[];if(t>0)for(let i=e;i<n;i+=t)r.push(i);else for(let i=e;i>n;i+=t)r.push(i);return r}function xn(e,n,t=0,r){if(!Array.isArray(e))return[];let i=[...e],s=r===void 0?i.length:r;for(let a=t;a<s&&a<i.length;a++)i[a]=n;return i}function hn(e){return Array.isArray(e)?K(e):[]}function bn(e,n,...t){let r,i;if(typeof n=="string")r=n,i=[e];else{let a=t[t.length-1];typeof a=="string"?(r=a,i=[e,n,...t.slice(0,-1).filter(Array.isArray)]):(r="id",i=[e,n,...t.filter(Array.isArray)])}if(i.length===0)return[];let s=new Map;for(let a of i)if(Array.isArray(a))for(let o of a){let u=m(o)?d(o,r):void 0;if(u!==void 0){let f=s.get(u);s.set(u,f?{...f,...o}:o)}}return Array.from(s.values())}function Sn(e,n,t){if(!Array.isArray(e)||n===t)return e?[...e]:[];let r=[...e],[i]=r.splice(n,1);return r.splice(t,0,i),r}function vn(e,n){if(!Array.isArray(e)||e.length===0||n===0)return e?[...e]:[];let t=e.length,r=(n%t+t)%t;return[...e.slice(-r),...e.slice(0,-r)]}function wn(e,n,...t){if(!Array.isArray(e))return t;let r=[...e];return r.splice(n,0,...t),r}function Kn(e,n,t=1){if(!Array.isArray(e))return[];let r=[...e];return r.splice(n,t),r}function On(e,n,t){if(!Array.isArray(e))return[];let r=[...e];return r[n]=t,r}function Pn(e,n){if(!Array.isArray(e))return[];let t=e.filter(r=>r!=null);return n?t.filter(n):t}function Rn(...e){return e.length===0?[[]]:e.length===1?e[0].map(n=>[n]):e.reduce((n,t)=>n.flatMap(r=>t.map(i=>[...r,i])),[[]])}function In(e,n){if(!Array.isArray(e))return[];let t=[];for(let r=0;r<e.length;r++)n(e[r],r)&&t.push(r);return t}function kn(e,n,t=!0){if(!Array.isArray(e)||!Array.isArray(n)||e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(t&&m(e[r])&&m(n[r])){if(JSON.stringify(e[r])!==JSON.stringify(n[r]))return!1}else if(e[r]!==n[r])return!1;return!0}function Fn(e,n){if(!Array.isArray(e)||e.length===0)return[];let t=[],r=[e[0]],i=n(e[0],0);for(let s=1;s<e.length;s++){let a=n(e[s],s);a===i?r.push(e[s]):(t.push(r),r=[e[s]],i=a)}return t.push(r),t}function jn(e,n,t,r){if(!Array.isArray(e))return[];let i=typeof n=="function",s=i?t:r;return e.map(a=>{let o=!1;return i?o=n(a):o=(m(a)?d(a,n):a)===t,o?{...a,...s}:a})}function En(e,n){if(!Array.isArray(e))return{unique:[],duplicates:[]};let t=new Set,r=[],i=[];for(let s of e){let a=n&&m(s)?d(s,n):s;t.has(a)?i.push(s):(t.add(a),r.push(s))}return{unique:r,duplicates:i}}function Q(e){return Array.isArray(e)?e:e==null?[]:[e]}function Vn(e){return Q(e)}function Mn(e,n,t=1){if(!Array.isArray(e)||n<1||t<1)return[];let r=[];for(let i=0;i<=e.length-n;i+=t)r.push(e.slice(i,i+n));return r}function $n(e,n){if(!Array.isArray(e)||e.length===0)return;let t=e[0],r=typeof n=="function"?n(t):d(t,n);for(let i=1;i<e.length;i++){let s=e[i],a=typeof n=="function"?n(s):d(s,n);a<r&&(r=a,t=s)}return t}function Cn(e,n){if(!Array.isArray(e)||e.length===0)return;let t=e[0],r=typeof n=="function"?n(t):d(t,n);for(let i=1;i<e.length;i++){let s=e[i],a=typeof n=="function"?n(s):d(s,n);a>r&&(r=a,t=s)}return t}function Z(e,n){if(!Array.isArray(e)||e.length===0)return 0;let t=0;for(let r of e){let i=typeof n=="function"?n(r):d(r,n);typeof i=="number"&&!isNaN(i)&&(t+=i)}return t}function Un(e,n){return!Array.isArray(e)||e.length===0?0:Z(e,n)/e.length}function P(e){let n=new Map;if(!Array.isArray(e))return n;for(let t of e)n.set(t,(n.get(t)||0)+1);return n}function G(e,n=1){if(!Array.isArray(e)||e.length===0||n<1)return[];let t=P(e);return Array.from(t.entries()).sort((i,s)=>s[1]-i[1]).slice(0,n).map(([i])=>i)}function Wn(e,n=1){if(!Array.isArray(e)||e.length===0||n<1)return[];let t=P(e);return Array.from(t.entries()).sort((i,s)=>i[1]-s[1]).slice(0,n).map(([i])=>i)}async function Nn(e,n,t){if(!Array.isArray(e)||n<1)return;let r=I(e,n);for(let i=0;i<r.length;i++)await t(r[i],i)}async function Bn(e,n,t,r){if(!Array.isArray(e)||n<1||t<1)return;let i=I(e,n),s=I(i.map((a,o)=>({batch:a,index:o})),t);for(let a of s)await Promise.all(a.map(({batch:o,index:u})=>r(o,u)))}function Ln(e){if(!Array.isArray(e)||e.length===0)return[];let n=Math.max(...e.map(r=>r.length)),t=[];for(let r=0;r<n;r++){let i=[];for(let s=0;s<e.length;s++)r<e[s].length&&i.push(e[s][r]);t.push(i)}return t}function qn(e,n){if(!Array.isArray(e)||!Array.isArray(n)||e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function Dn(e,n){if(!Array.isArray(e)||!Array.isArray(n)||e.length!==n.length)return!1;let t=P(e),r=P(n);if(t.size!==r.size)return!1;for(let[i,s]of t)if(r.get(i)!==s)return!1;return!0}function X(e,n){if(!Array.isArray(e)||!Array.isArray(n))return!1;let t=new Set(n);return e.every(r=>t.has(r))}function zn(e,n){return X(n,e)}function Hn(...e){if(e.length===0)return[];let n=Math.max(...e.map(r=>r.length)),t=[];for(let r=0;r<n;r++)for(let i of e)r<i.length&&t.push(i[r]);return t}function _n(e,n){let t=[],r=[];if(!Array.isArray(e))return{pass:t,fail:r};for(let i=0;i<e.length;i++)n(e[i],i)?t.push(e[i]):r.push(e[i]);return{pass:t,fail:r}}function Jn(e,n){if(e<0)return[];let t=[];for(let r=0;r<e;r++)t.push(n(r));return t}function Qn(e,n){if(!Array.isArray(e)||n<0)return[];let t=[];for(let r=0;r<n;r++)t.push(...e);return t}function Zn(e){if(!Array.isArray(e)||e.length===0)return;let n=[...e].sort((r,i)=>r-i),t=Math.floor(n.length/2);return n.length%2===0?(n[t-1]+n[t])/2:n[t]}function Gn(e){let n=G(e,1);return n.length>0?n[0]:void 0}function Xn(e,...n){if(!Array.isArray(e))return[];let t=new Set(n);return e.filter(r=>!t.has(r))}function Yn(e,...n){if(!Array.isArray(e))return[];let t=new Set(n.flat());return e.filter(r=>!t.has(r))}function et(e){if(!Array.isArray(e)||e.length===0)return[];let n=[],t=[e[0]];for(let r=1;r<e.length;r++)e[r]===e[r-1]?t.push(e[r]):(n.push(t),t=[e[r]]);return n.push(t),n}function nt(e){if(!Array.isArray(e)||e.length===0)return[];let n=[e[0]];for(let t=1;t<e.length;t++)e[t]!==e[t-1]&&n.push(e[t]);return n}function tt(e,n="standard"){if(!Array.isArray(e)||e.length===0)return[];let t=e.map((i,s)=>({value:i,index:s}));t.sort((i,s)=>i.value-s.value);let r=new Array(e.length);if(n==="ordinal")for(let i=0;i<t.length;i++)r[t[i].index]=i+1;else if(n==="dense"){let i=1;r[t[0].index]=i;for(let s=1;s<t.length;s++)t[s].value!==t[s-1].value&&i++,r[t[s].index]=i}else{let i=0;for(;i<t.length;){let s=i;for(;s<t.length&&t[s].value===t[i].value;)s++;let a=i+1;for(let o=i;o<s;o++)r[t[o].index]=a;i=s}}return r}function E(e,n){if(!Array.isArray(e)||e.length===0||n<0||n>100)return;let t=[...e].sort((o,u)=>o-u),r=n/100*(t.length-1),i=Math.floor(r),s=Math.ceil(r),a=r-i;return i===s?t[i]:t[i]*(1-a)+t[s]*a}function rt(e){if(!Array.isArray(e)||e.length===0)return;let n=E(e,25),t=E(e,50),r=E(e,75);return{q1:n,q2:t,q3:r,iqr:r-n}}function $(e,n=!1){if(!Array.isArray(e)||e.length===0||n&&e.length===1)return;let t=e.reduce((s,a)=>s+a,0)/e.length,i=e.map(s=>Math.pow(s-t,2)).reduce((s,a)=>s+a,0)/(n?e.length-1:e.length);return Math.sqrt(i)}function it(e,n=!1){let t=$(e,n);return t!==void 0?Math.pow(t,2):void 0}function st(e){if(!Array.isArray(e)||e.length===0)return[];let n=Math.min(...e),r=Math.max(...e)-n;return r===0?e.map(()=>0):e.map(i=>(i-n)/r)}function ot(e){if(!Array.isArray(e)||e.length===0)return[];let n=e.reduce((r,i)=>r+i,0)/e.length,t=$(e);return t===void 0||t===0?e.map(()=>0):e.map(r=>(r-n)/t)}function Y(e,n,t){if(!Array.isArray(e))return[];let r=[],i=t;for(let s=0;s<e.length;s++)i=n(i,e[s],s),r.push(i);return r}function at(e){return Y(e,(n,t)=>n+t,0)}function ut(e){if(!Array.isArray(e)||e.length<2)return[];let n=[];for(let t=1;t<e.length;t++)n.push(e[t]-e[t-1]);return n}function ft(e,n,t,r="end"){if(!Array.isArray(e)||n<=e.length)return[...e];let i=new Array(n-e.length).fill(t);return r==="start"?[...i,...e]:[...e,...i]}function lt(e,n){if(!Array.isArray(e)||e.length===0)return[];let t=0,r=e.length-1;for(;t<=r&&n(e[t]);)t++;for(;r>=t&&n(e[r]);)r--;return e.slice(t,r+1)}function ct(e){if(!Array.isArray(e)||e.length<2)return[];let n=[];for(let t=0;t<e.length-1;t++)n.push([e[t],e[t+1]]);return n}function yt(e){return Array.isArray(e)?e.map((n,t)=>[t,n]):[]}function pt(e,n){return Array.isArray(e)?e.map((t,r)=>{let i=n[r%n.length];return i(t)}):[]}function ee(e,n=1){if(!Array.isArray(e)||e.length===0)return[];let t=e.length,r=(n%t+t)%t;return[...e.slice(r),...e.slice(0,r)]}function dt(e,n=1){return ee(e,-n)}function Tt(e,n,t){if(!Array.isArray(e)||n<0||t<0||n>=e.length||t>=e.length)return[...e];let r=[...e];return[r[n],r[t]]=[r[t],r[n]],r}function gt(e,n,t){if(!Array.isArray(e)||n<0||t>=e.length||n>=t)return[...e];let r=[...e],i=r.slice(n,t+1).reverse();return r.splice(n,t-n+1,...i),r}function At(e,n){if(!Array.isArray(e)||e.length<=1)return!0;let t=n||((r,i)=>r<i?-1:r>i?1:0);for(let r=1;r<e.length;r++)if(t(e[r-1],e[r])>0)return!1;return!0}function mt(e){return Array.isArray(e)?new Set(e).size!==e.length:!1}function xt(e,n){return Array.isArray(e)?e.map(t=>{let r={};for(let i of n)i in t&&(r[i]=t[i]);return r}):[]}function ne(e,n,t){if(!Array.isArray(e))return{};let r={};for(let i=0;i<e.length;i++){let s=n(e[i],i),a=t?t(e[i],i):e[i];r[s]=a}return r}async function ht(e,n){if(!Array.isArray(e))return[];let t=[];for(let r=0;r<e.length;r++)t.push(await n(e[r],r));return t}async function bt(e,n){return Array.isArray(e)?Promise.all(e.map((t,r)=>n(t,r))):[]}async function St(e,n){if(!Array.isArray(e))return[];let t=[];for(let r=0;r<e.length;r++)await n(e[r],r)&&t.push(e[r]);return t}async function vt(e,n,t){if(!Array.isArray(e))return t;let r=t;for(let i=0;i<e.length;i++)r=await n(r,e[i],i);return r}async function wt(e,n){if(Array.isArray(e)){for(let t=0;t<e.length;t++)if(await n(e[t],t))return e[t]}}async function Kt(e,n){if(!Array.isArray(e))return!1;for(let t=0;t<e.length;t++)if(await n(e[t],t))return!0;return!1}async function Ot(e,n){if(!Array.isArray(e))return!0;for(let t=0;t<e.length;t++)if(!await n(e[t],t))return!1;return!0}function Pt(e,n,t){if(!Array.isArray(e)||e.length===0)return 0;let r=0,i=0;for(let s of e){let a=typeof n=="function"?n(s):d(s,n),o=typeof t=="function"?t(s):d(s,t);typeof a=="number"&&typeof o=="number"&&(i+=a*o,r+=o)}return r===0?0:i/r}function Rt(e,n,t=1){if(!Array.isArray(e)||e.length===0||t<1)return[];let r=[],i=0;for(let a of e){let o=typeof n=="function"?n(a):d(a,n);i+=typeof o=="number"&&o>0?o:0,r.push(i)}if(i===0)return[];let s=[];for(let a=0;a<t;a++){let o=Math.random()*i,u=r.findIndex(f=>o<f);u!==-1&&s.push(e[u])}return s}function It(e,n){if(!Array.isArray(e)||!Array.isArray(n))return[];let t=[],r=0;for(let i of n){if(r>=e.length)break;t.push(e.slice(r,r+i)),r+=i}return t}function kt(e,n){if(!Array.isArray(e)||n<1)return[];let t=P(e),r=[];for(let i of e)t.get(i)===n&&r.push(i);return r}function Ft(e,n,t){if(!Array.isArray(e)||n<1)return[];let r=[],i=0,s=[];for(let a of e)t(a)?(i++,s.push(a),i>=n&&r.push(...s.splice(0,s.length-n+1))):(i=0,s.length=0);return i>=n&&r.push(...s),r}function jt(e,n,t){if(!Array.isArray(e))return[];let r=[],i=t;for(let s=0;s<e.length;s++){let{value:a,newContext:o}=n(e[s],i,s);r.push(a),i=o}return r}function Et(e,n){return I(e,n)}function Vt(e,n,t){if(!Array.isArray(e)||!Array.isArray(n))return[];let r=Math.min(e.length,n.length),i=[];for(let s=0;s<r;s++)i.push(t(e[s],n[s]));return i}function Mt(e,n,t="last"){if(!Array.isArray(e)||e.length===0)return[];let r=new Map;for(let s of e)if(Array.isArray(s))for(let a of s){let o=d(a,n);if(t==="first")r.has(o)||r.set(o,a);else if(t==="last")r.set(o,a);else if(t==="concat"){let u=r.get(o);Array.isArray(u)?u.push(a):u?r.set(o,[u,a]):r.set(o,a)}else if(typeof t=="function"){let u=r.get(o);u&&!Array.isArray(u)?r.set(o,t(u,a)):r.set(o,a)}}let i=[];for(let s of r.values())Array.isArray(s)&&t==="concat"?i.push(...s):Array.isArray(s)||i.push(s);return i}function $t(e,n){return ne(e,t=>String(d(t,n)))}function Ct(e,n,t){if(!Array.isArray(e)||e.length===0)return-1;let r=t||((a,o)=>a<o?-1:a>o?1:0),i=0,s=e.length-1;for(;i<=s;){let a=Math.floor((i+s)/2),o=r(e[a],n);if(o===0)return a;o<0?i=a+1:s=a-1}return-1}function Ut(e,n,t){if(!Array.isArray(e))return[n];let r=t||((a,o)=>a<o?-1:a>o?1:0),i=[...e],s=0;for(;s<i.length&&r(i[s],n)<0;)s++;return i.splice(s,0,n),i}function Wt(e){return e&&typeof e.addEventListener=="function"}function Nt(e){return e&&typeof e.addEventListener=="function"&&typeof e.removeEventListener=="function"}function Bt(e){return e&&typeof e.on=="function"&&typeof e.off=="function"}function Lt(e){return e&&typeof e.addListener=="function"&&typeof e.removeListener=="function"}function qt(){return typeof globalThis=="object"?globalThis:typeof window=="object"?window:typeof self=="object"?self:typeof global=="object"?global:null}function Dt(e){return Buffer.from(e).toString("base64")}function zt(e){return Buffer.from(e).toString("base64")}function Ht(e){return decodeURIComponent(Buffer.from(e,"base64").toString("utf-8"))}var _t=(e,n,t)=>{let r=t,i=new RegExp("([?&])"+n+"=.*?(&|$)","i"),s=e.includes("?")?"&":"?";n==="country"&&(r=JSON.parse(r).alpha_2),n==="phone"&&(r=r.trim().replace(/\s/g,""));let a=e.match(i);return typeof a<"u"&&a!==null?e.replace(i,"$1"+n+"="+r+"$2"):e+s+n+"="+r};var Jt=async(e,n="SHA-1")=>{if(typeof window>"u")return null;let{subtle:t}=window.globalThis.crypto,r=await t.generateKey({name:"HMAC",hash:n,length:256},!0,["sign","verify"]),s=new TextEncoder().encode(e),a=await t.sign({name:"HMAC"},r,s);return[...new Uint8Array(a)].map(u=>u.toString(16).padStart(2,"0")).join("")},C=async(e,n="SHA-256")=>{let r=new TextEncoder().encode(e),i=await crypto.subtle.digest(n,r);return Array.from(new Uint8Array(i)).map(o=>o.toString(16).padStart(2,"0")).join("")},Qt=async(e,n,t="SHA-256")=>{let r=await C(e,t),i=await C(n,t);return r===i};async function Zt(e,n="SHA-256"){let r=new TextEncoder().encode(e),i=await crypto.subtle.digest(n,r);return Array.from(new Uint8Array(i)).map(o=>o.toString(16).padStart(2,"0")).join("")}var Gt=e=>{let n=0;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);n=(n<<5)-n+r,n=n&n}return n.toString(16)};var te=require("@fluixi/utils/object");function re(e){return typeof e=="function"&&!(0,te.isClass)(e)}function Xt(e){return e instanceof Promise||!!e&&(typeof e=="object"||typeof e=="function")&&"then"in e}function Yt(e){return re(e)&&e.constructor.name==="AsyncFunction"}function er(e,n){let t=new Map,r=function(...i){let s=n?n(...i):JSON.stringify(i);if(t.has(s))return t.get(s);let a=e.apply(this,i);return t.set(s,a),a};return r.cache=t,r}function ie(e,n,t={}){let{leading:r=!1,trailing:i=!0,maxWait:s}=t,a,o,u,f=0,y,T,p;function b(A){let v=y,w=T;return y=T=void 0,f=A,p=e.apply(w,v),p}function l(A,v){return setTimeout(A,v)}function c(A){A!==void 0&&clearTimeout(A)}function g(A){return f=A,a=l(O,n),r?b(A):p}function x(A){let v=A-u,w=A-f,W=n-v;return s!==void 0?Math.min(W,s-w):W}function h(A){let v=A-u,w=A-f;return u===void 0||v>=n||v<0||s!==void 0&&w>=s}function O(){let A=Date.now();if(h(A)){U(A);return}a=l(O,x(A))}function U(A){return a=void 0,i&&y?b(A):(y=T=void 0,p)}function ae(){c(a),c(o),f=0,y=u=T=a=o=void 0}function ue(){return a===void 0?p:U(Date.now())}function fe(){return a!==void 0}function k(...A){let v=Date.now(),w=h(v);if(y=A,T=this,u=v,w){if(a===void 0)return g(u);if(s!==void 0)return a=l(O,n),b(u)}return a===void 0&&(a=l(O,n)),p}return k.cancel=ae,k.flush=ue,k.pending=fe,k}function nr(e,n,t={}){let{leading:r=!0,trailing:i=!0}=t;return ie(e,n,{leading:r,trailing:i,maxWait:n})}function tr(e){let n=!1,t,r=function(...i){return n||(n=!0,t=e.apply(this,i)),t};return Object.defineProperty(r,"called",{get(){return n}}),r}function rr(e,...n){return function(...t){let r=n.map(i=>t[i]);return e.apply(this,r)}}function ir(e,n=e.length){return function t(...r){return r.length>=n?e.apply(this,r):function(...i){return t.apply(this,[...r,...i])}}}function se(...e){return e.reduceRight((n,t)=>r=>t(n(r)),n=>n)}function oe(...e){return e.reduce((n,t)=>r=>t(n(r)),n=>n)}function sr(e){return function(...n){return!e.apply(this,n)}}function or(e,...n){return function(...t){let r=t.map((i,s)=>n[s]?n[s](i):i);return e.apply(this,r)}}function ar(e,...n){return function(...t){return e.apply(this,[...n,...t])}}function ur(e,...n){return function(...t){return e.apply(this,[...t,...n])}}function fr(e,n,...t){return function(...r){return e.apply(n,[...t,...r])}}function lr(e){return function(...n){return e.apply(this,n.reverse())}}function cr(e,n){return function(...t){return e.apply(this,t.slice(0,n))}}function yr(e){return function(n){return e.call(this,n)}}function pr(e,...n){return setTimeout(e,1,...n)}function dr(e,n,...t){return setTimeout(e,n,...t)}function Tr(e,n,t){let r=new Map,i=function(...s){let a=t?t(...s):JSON.stringify(s),o=Date.now(),u=r.get(a);if(u&&u.expires>o)return u.value;let f=e.apply(this,s);r.set(a,{value:f,expires:o+n});for(let[y,T]of r.entries())T.expires<=o&&r.delete(y);return f};return i.cache=r,i}function gr(e,n){let t,r=0;return function(...i){return++r<n&&(t=e.apply(this,i)),r>=n&&(e=void 0),t}}function Ar(e,n){let t=0;return function(...r){if(++t>=n)return e.apply(this,r)}}function mr(e,n){return function(...t){try{return e.apply(this,t)}catch(r){return n(r,...t)}}}function xr(...e){return oe(...e)}function hr(...e){return se(...e)}function br(e,n={}){let{retries:t=3,delay:r=1e3,backoff:i=2,onRetry:s}=n;return async function(...a){let o,u=r;for(let f=0;f<=t;f++)try{return await e.apply(this,a)}catch(y){o=y,f<t&&(s&&s(o,f+1),await new Promise(T=>setTimeout(T,u)),u*=i)}throw o}}function Sr(e,n,t){return async function(...r){return Promise.race([e.apply(this,r),new Promise((i,s)=>setTimeout(()=>{t&&t(),s(new Error(`Function timed out after ${n}ms`))},n))])}}
@@ -0,0 +1,2 @@
1
+ export * from './lib/index.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from './lib/index.js';
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ var ye=e=>{if(Array.isArray(e))return e;if(typeof e=="string")if(e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch{return[]}else return[e];return[]};function pe(e){return Array.isArray(e)&&e.every(n=>typeof n=="string")}function de(e){return Array.isArray(e)&&e.every(n=>typeof n=="number")}function Te(e){return Array.isArray(e)&&e.every(n=>typeof n=="boolean")}function ge(e){return Array.isArray(e)&&e.every(n=>typeof n=="object")}import{isObject as q}from"@fluixi/utils/object";var xe=e=>Array.isArray(e)&&e.every(n=>q(n));function he(e){return Array.isArray(e)}function be(e){return Array.isArray(e)}function Se(e){return Array.isArray(e)&&e.every(n=>Array.isArray(n)&&n.length===2)}function D(e){return e!=null&&typeof e[Symbol.iterator]=="function"}function ve(e){return e!=null&&typeof e=="object"&&"length"in e&&typeof e.length=="number"&&e.length>=0&&(e.length===0||e.length-1 in e)}function we(e){return Array.isArray(e)&&e.length===0}function Ke(e){return Array.isArray(e)&&e.length>0}function Oe(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Pe(e){return Array.isArray(e)}function Re(e){return e.length>0?e[e.length-1]:void 0}function Ie(e){return e.length>0?e[0]:void 0}function ke(e){return Array.isArray(e)?[...e]:D(e)?[...e]:Array.from(e)}function Fe(e,n){return e.reduce((t,r)=>{let i=n(r);return t[i]||(t[i]=[]),t[i].push(r),t},{})}function je(e){return e.flat()}function Ee(e,n){let t=n<0?e.length+n:n;return e[t]}var m=e=>e==null||Array.isArray(e)||typeof e=="function"||e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error?!1:typeof e=="object";var S=(e,n,t,r)=>{if(t>r)return;if(n.length===0)return e;let i=n[0],s=n.slice(1);if(i.type==="descendant"){let a=S(e,s,t+1,r);if(a!==void 0)return a;if(e&&typeof e=="object")if(Array.isArray(e)){let o=[];for(let u=0;u<e.length;u++){let f=S(e[u],n,t+1,r);f!==void 0&&(o[u]=f)}return o.length>0?o:void 0}else{let o={};for(let u in e)if(e.hasOwnProperty(u)){let f=S(e[u],n,t+1,r);f!==void 0&&(o[u]=f)}return Object.keys(o).length>0?o:void 0}return}switch(i.type){case"property":if(m(e)&&i.value&&String(i.value)in e){let a=e[String(i.value)],o=S(a,s,t+1,r);if(o!==void 0)return{[String(i.value)]:o}}break;case"index":if(Array.isArray(e)){let a=i.value;if(a>=0&&a<e.length){let o=S(e[a],s,t+1,r);if(o!==void 0){let u=new Array(e.length).filter(f=>f!==void 0);return u[a]=o,u}}}else if(e&&typeof e=="object"){let a=String(i.value);if(a in e){let o=S(e[a],s,t+1,r);if(o!==void 0)return{[a]:o}}}break;case"wildcard":if(e&&typeof e=="object")if(Array.isArray(e)){let a=[],o=!1;for(let u=0;u<e.length;u++){let f=S(e[u],s,t+1,r);f!==void 0&&(a[u]=f,o=!0)}return o?a:void 0}else{let a={},o=!1;for(let u in e)if(e.hasOwnProperty(u)){let f=S(e[u],s,t+1,r);f!==void 0&&(a[u]=f,o=!0)}return o?a:void 0}break;case"slice":if(Array.isArray(e)){let[a,o]=i.value,u=Math.max(0,a),f=Math.min(e.length,o===1/0?e.length:o),y=[],T=!1;for(let p=u;p<f;p++){let b=S(e[p],s,t+1,r);b!==void 0&&(y[p]=b,T=!0)}return T?y:void 0}break;case"union":if(Array.isArray(e)){let a=i.value,o=[],u=!1;for(let f of a)if(f>=0&&f<e.length){let y=S(e[f],s,t+1,r);y!==void 0&&(o[f]=y,u=!0)}return u?o:void 0}break;case"filter":if(Array.isArray(e)){let a=i.value,o=[],u=!1;for(let f=0;f<e.length;f++)if(a(e[f])){let y=S(e[f],s,t+1,r);y!==void 0&&(o[f]=y,u=!0)}return u?o:void 0}break}};var K=(e,n)=>{if(e==null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(e instanceof Map){let t=new Map;return e.forEach((r,i)=>{(!n||!n.some(s=>s.toString()===i.toString()))&&t.set(i,K(r))}),t}if(e instanceof Set){let t=new Set;return e.forEach(r=>{t.add(K(r))}),t}if(Array.isArray(e))return Array.from(e).map(t=>K(t));if(m(e)){let t={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(!n||!n.some(s=>s.toString()===i.toString()))&&(t[i]=K(e[i]));let r=Object.getOwnPropertySymbols(e);for(let i of r)(!n||!n.some(s=>s.toString()===i.toString()))&&(t[i]=K(e[i]));return t}return e};import{isDate as M}from"@fluixi/utils/primitive";import{isClass as z,isObject as H}from"@fluixi/utils/object";import{isArray as _}from"@fluixi/utils/array";import{isFunction as J}from"@fluixi/utils/functions";function ze(e){return e===null}function He(e){return e===void 0}var _e=e=>typeof e>"u"||e===null;function Q(e){let n=typeof e;return e===null||n==="string"||n==="number"||n==="boolean"||n==="symbol"||n==="bigint"||n==="undefined"||M(e)}function Je(e){return e!=null}function Qe(e){return e===null?"null":e===void 0?"undefined":M(e)?"date":z(e)?"class":J(e)?"function":_(e)?"array":Q(e)?"primitive":H(e)?"object":"primitive"}var Ze=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let n=Math.random()*16|0;return(e==="x"?n:n&3|8).toString(16)}),Ge=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let n=Math.random()*16|0;return(e==="x"?n:n&3|8).toString(16)});var P=(e,n={})=>{let{type:t="auto",throwOnError:r=!1}=n;if(!e||typeof e!="string")return[];let i=[],s="",a=!1,o=!1,u="",f="",y=0,p=t==="auto"?(l=>l.includes("..")?"descendant":l.includes("[?(")?"filter":l.includes("[:")||l.includes("[0:")?"slice":l.includes("[,")||l.includes("[0,1]")?"union":l.includes("[*]")||l.includes(".*.")?"wildcard":l.includes("[]")?"array-wildcard":l.includes("[")&&l.includes("]")?"bracket":"dot")(e):t,b=l=>{let c=l.trim();if(c==="*"||c==="")return{type:"wildcard",value:c===""?"[]":"*",raw:c===""?"[]":l};if(c==="[]")return{type:"wildcard",value:"[]",raw:l};if(/^-?\d+$/.test(c))return{type:"index",value:parseInt(c,10),raw:l};if(c.includes(":")){let g=c.split(":").map(O=>O.trim()),x=g[0]===""?0:parseInt(g[0],10),h=g[1]===""?1/0:parseInt(g[1],10);if(isNaN(x)||isNaN(h)){if(r)throw new Error(`Invalid slice notation: ${l}`);return{type:"wildcard",value:"*",raw:l}}return{type:"slice",value:[x,h],raw:l}}if(c.includes(",")){let g=c.split(",").map(x=>{let h=parseInt(x.trim(),10);return isNaN(h)?-1:h}).filter(x=>x>=0);if(g.length===0){if(r)throw new Error(`Invalid union notation: ${l}`);return{type:"wildcard",value:"*",raw:l}}return{type:"union",value:g,raw:l}}if(c.startsWith("?(")&&c.endsWith(")")){let g=c.slice(2,-1);try{return{type:"filter",value:Z(g),raw:l}}catch(x){if(r)throw x;return{type:"wildcard",value:"*",raw:l}}}return c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'")?{type:"property",value:c.slice(1,-1),raw:l}:{type:"property",value:c,raw:l}};for(let l=0;l<e.length;l++){let c=e[l],g=e[l+1];if((c==='"'||c==="'")&&!o){o=!0,u=c;continue}else if(c===u&&o){o=!1,u="",c==='"'||c==="'"||(a?f+=c:s+=c);continue}if(o){a?f+=c:s+=c;continue}if(c==="["&&!a){s&&(i.push({type:"property",value:s,raw:s}),s=""),a=!0,f="";continue}if(c==="]"&&a&&!o){a=!1;let h=b(f);i.push(h);continue}let x=i.length>0?i[i.length-1]:null;if(c==="."&&!a&&!o){if(g==="."){let h=e.split("..")[0];i.push({type:"property",value:h,raw:h}),i.push({type:"descendant",value:"..",raw:".."}),l++}else s&&(s==="*"?i.push({type:"wildcard",value:s,raw:s}):i.push({type:"property",value:s,raw:s}),s="");continue}if(a)f+=c;else if(x&&x.type!=="descendant")s+=c;else{let h=e.split(x?.raw)[1];h!==void 0?s=h:s+=c}}return s&&i.push({type:"property",value:s,raw:s}),i.map(l=>{if(l.type==="property"&&typeof l.value=="string"&&/^-?\d+$/.test(l.value)){let c=parseInt(l.value,10);if(!isNaN(c))return{...l,type:"index",value:c}}return l})},Z=e=>{let n=e.replace(/@\.([a-zA-Z_$][\w$]*)/g,(t,r)=>`item.${r}`).replace(/@/g,"item");try{return new Function("item",`return ${n}`)}catch{throw new Error(`Invalid filter expression: ${e}`)}};var $=(e,n,t)=>{let r=P(n),i=e;for(let s=0;s<r.length;s++){let a=r[s],o=s===r.length-1;switch(a.type){case"property":if(o)i[String(a.value)]=t;else{if(!i[String(a.value)]){let f=r[s+1];i[String(a.value)]=f.type==="index"||f.type==="slice"||f.type==="union"||f.type==="wildcard"?[]:{}}i=i[String(a.value)]}break;case"index":Array.isArray(i)||(i=[]);let u=a.value;if(o){if(u>=i.length)for(let f=i.length;f<=u;f++)i.push(void 0);i[u]=t}else{if(!i[u]){let f=r[s+1];i[u]=f.type==="index"||f.type==="slice"||f.type==="union"||f.type==="wildcard"?[]:{}}i=i[u]}break;case"wildcard":if(Array.isArray(i))if(o)for(let f=0;f<i.length;f++)i[f]=t;else{let f=r[s+1];for(let y=0;y<i.length;y++)i[y]||(i[y]=f.type==="index"||f.type==="slice"||f.type==="union"||f.type==="wildcard"?[]:{});i.length>0&&(i=i[0])}break}}};function d(e,n,t={}){let{preserveStructure:r,multiple:i,throwOnError:s=!1,defaultValue:a,maxDepth:o=20}=t;if(!e||typeof e!="object")return a;if(!n)return e;if(Array.isArray(n))if(r){let y={};for(let T of n){let p=d(e,T,{...t,preserveStructure:!1});p!==void 0&&$(y,T,p)}return y}else return n.map(y=>d(e,y,{...t,preserveStructure:!1}));let u=P(n,{...t,throwOnError:s});if(u.length===0)return e;if(typeof r>"u"||r===!1){let y=G(e,n);return i===!1&&Array.isArray(y)?y[0]:y===void 0&&a!==void 0?a:y}let f=S(e,u,0,o);return f===void 0&&a!==void 0?a:f}function G(e,n,t={}){let{createMissing:r=!1,add:i=!1,debug:s=!1}=t,a=P(n),o=e,u=!1,f="",y=n;if(typeof o=="object"&&!Array.isArray(o)&&y.length>0&&o[y])return o=o[y],o;for(let T=0;T<a.length;T++){let p=a[T],b=a.length>1?T===a.length-1:!1;if(o===null&&!r)return;let l=a[T+1];switch(p.type){case"property":if(o&&typeof o=="object")if(Array.isArray(o)){if(typeof p.value=="number"){let c=p.value;if(r&&c>=o.length)for(let g=o.length;g<=c;g++)o.push(void 0);if(r&&(o[c]===null||o[c]===void 0)&&(!b||u)&&(l?o[c]=l.type==="index"||l.type==="slice"||l.type==="union"||l.type==="wildcard"?[]:{}:o[c]=null,u=!1),o=o[c],l){u=!0;continue}}else i?o.push({[String(p.value)]:null}):o=o.map(c=>c[String(p.value)]);if(l)continue;return C(o)}else{if(o[f]&&f.split(".").length>=2){o=o[f];continue}if(r&&(o[String(p.value)]===null||o[String(p.value)]===void 0)&&(!b||u)&&(l?o[String(p.value)]=l.type==="index"||l.type==="slice"||l.type==="union"||l.type==="wildcard"?[]:{}:o[String(p.value)]=null,u=!1,o=o[String(p.value)],l)){u=!0;continue}if(o?(!o[String(p.value)]&&r&&(o[String(p.value)]=null),o=o[String(p.value)]):o={[String(p.value)]:null},l)continue}else if(r)o={},o[String(p.value)]=l.type==="index"||l.type==="slice"||l.type==="union"||l.type==="wildcard"||t.type==="array"?[]:{},o=o[String(p.value)];else return;break;case"index":case"wildcard":if(Array.isArray(o)){if(p.type==="index"){let c=p.value;if(c<0){o=o[o.length-Math.abs(c)];continue}if(r&&(c>=o.length||o[c]==null||o[c]==null)&&!b){for(let g=o.length;g<=c;g++)o.push(void 0);l&&(o[c]=l.type==="index"||l.type==="slice"||l.type==="union"||l.type==="wildcard"?[]:{})}o=o[c]}else if(!b)continue}else if(r){let c=a[T+1];o=[];let g=p.value;for(let x=0;x<=g;x++)o.push(void 0);o[g]=c.type==="index"||c.type==="slice"||c.type==="union"||c.type==="wildcard"||t.type==="array"?[]:{},o=o[g]}else{if(p.type==="index"&&typeof o=="object"&&o&&o[String(p.value)]!==void 0){o=o[String(p.value)];continue}if(typeof o=="object"){o=Object.values(o);continue}return}break;default:return}}return C(o)}function C(e){return Array.isArray(e)?e.filter(n=>typeof n<"u"):e}function k(e,n){if(!Array.isArray(e)||n<1)return[];let t=[];for(let r=0;r<e.length;r+=n)t.push(e.slice(r,r+n));return t}function pn(e){return e.reduce((n,t)=>n.concat(t),[])}function X(e,n=1/0){return n<1?e.slice():e.reduce((t,r)=>(Array.isArray(r)?t.push(...X(r,n-1)):t.push(r),t),[])}function F(e,n){if(!Array.isArray(e))return[];if(!n)return[...new Set(e)];let t=new Set;return e.filter(r=>{let i=typeof n=="function"?n(r):m(r)?d(r,n):r;return t.has(i)?!1:(t.add(i),!0)})}function dn(e,n){return Array.isArray(e)?e.reduce((t,r)=>{let i;return typeof n=="function"?i=String(n(r)):i=String(m(r)?d(r,n):r),t[i]||(t[i]=[]),t[i].push(r),t},{}):{}}function Tn(e,n){return Array.isArray(e)?e.reduce((t,r)=>{let i;return typeof n=="function"?i=String(n(r)):n?i=String(m(r)?d(r,n):r):i=String(r),t[i]=(t[i]||0)+1,t},{}):{}}function gn(e,n,t){return Array.isArray(e)?e.reduce((r,i)=>{let s;typeof n=="function"?s=String(n(i)):s=String(m(i)?d(i,n):i);let a;return t?typeof t=="function"?a=t(i):a=d(i,t):a=i,r[s]=a,r},{}):{}}function An(e,n){if(!Array.isArray(e)||e.length===0)return[];let t=[...e],i=(Array.isArray(n)?n:[n]).map(s=>typeof s=="object"&&"key"in s?{key:s.key,dir:s.dir||"asc"}:{key:s,dir:"asc"});return t.sort((s,a)=>{for(let{key:o,dir:u}of i){let f=m(s)?d(s,o):s,y=m(a)?d(a,o):a;if(f===y)continue;let T=f<y?-1:1;return u==="asc"?T:-T}return 0}),t}function mn(e,n,t){if(!Array.isArray(e))return[];if(!Array.isArray(n))return e;if(!t){let i=new Set(n);return e.filter(s=>!i.has(s))}let r=new Set(n.map(i=>m(i)?d(i,t):i));return e.filter(i=>{let s=m(i)?d(i,t):i;return!r.has(s)})}function xn(e,n,t){if(!Array.isArray(e)||!Array.isArray(n))return[];if(!t){let i=new Set(n);return e.filter(s=>i.has(s))}let r=new Set(n.map(i=>m(i)?d(i,t):i));return e.filter(i=>{let s=m(i)?d(i,t):i;return r.has(s)})}function hn(e,n,t){return!Array.isArray(e)&&!Array.isArray(n)?[]:Array.isArray(e)?Array.isArray(n)?F([...e,...n],t):F(e,t):F(n,t)}function bn(e,n){return Array.isArray(e)?e.reduce((t,r,i)=>(t[n(r,i)?0:1].push(r),t),[[],[]]):[[],[]]}function Sn(e,n){return!Array.isArray(e)||n<=0?[]:e.slice(0,n)}function vn(e,n){return!Array.isArray(e)||n<=0?[]:e.slice(-n)}function wn(e,n){if(!Array.isArray(e))return[];let t=[];for(let r=0;r<e.length&&n(e[r],r);r++)t.push(e[r]);return t}function Kn(e,n){return!Array.isArray(e)||n<=0?e?[...e]:[]:e.slice(n)}function On(e,n){if(!Array.isArray(e))return[];let t=0;for(;t<e.length&&n(e[t],t);)t++;return e.slice(t)}function Pn(e){return Array.isArray(e)?e.filter(Boolean):[]}function Rn(...e){if(e.length===0)return[];let n=Math.max(...e.map(r=>Array.isArray(r)?r.length:0)),t=[];for(let r=0;r<n;r++){let i=[];for(let s of e)i.push(Array.isArray(s)?s[r]:void 0);t.push(i)}return t}function In(e){if(!Array.isArray(e)||e.length===0)return[];let n=Math.max(...e.map(r=>Array.isArray(r)?r.length:0)),t=[];for(let r=0;r<n;r++){let i=[];for(let s of e)Array.isArray(s)&&i.push(s[r]);t.push(i)}return t}function Y(e){if(!Array.isArray(e))return[];let n=[...e];for(let t=n.length-1;t>0;t--){let r=Math.floor(Math.random()*(t+1));[n[t],n[r]]=[n[r],n[t]]}return n}function kn(e){if(!(!Array.isArray(e)||e.length===0))return e[Math.floor(Math.random()*e.length)]}function Fn(e,n){return!Array.isArray(e)||n<=0?[]:Y(e).slice(0,Math.min(n,e.length))}function jn(e,n,t=0){if(!Array.isArray(e))return-1;for(let r=t;r<e.length;r++)if(n(e[r],r))return r;return-1}function En(e,n,t){if(!Array.isArray(e))return-1;let r=t!==void 0?t:e.length-1;for(let i=r;i>=0;i--)if(n(e[i],i))return i;return-1}function Vn(e,n){return Array.isArray(e)?e.map(t=>d(t,n)):[]}function Mn(e,n){return!Array.isArray(e)||!Array.isArray(n)?[]:e.map(t=>{let r={};for(let i of n)i in t&&(r[i]=t[i]);return r})}function $n(e,n){return!Array.isArray(e)||!Array.isArray(n)?[]:e.map(t=>{let r={...t};for(let i of n)delete r[i];return r})}function Cn(e,n){return Array.isArray(e)?e.reduce((t,r,i)=>{let s=n(r,i);return t.concat(s)},[]):[]}function Un(e,n,t){if(!Array.isArray(e))return t;let r=t;for(let i=e.length-1;i>=0;i--)r=n(r,e[i],i);return r}function Wn(e,n,t=1){if(t===0)return[];let r=[];if(t>0)for(let i=e;i<n;i+=t)r.push(i);else for(let i=e;i>n;i+=t)r.push(i);return r}function Nn(e,n,t=0,r){if(!Array.isArray(e))return[];let i=[...e],s=r===void 0?i.length:r;for(let a=t;a<s&&a<i.length;a++)i[a]=n;return i}function Bn(e){return Array.isArray(e)?K(e):[]}function Ln(e,n,...t){let r,i;if(typeof n=="string")r=n,i=[e];else{let a=t[t.length-1];typeof a=="string"?(r=a,i=[e,n,...t.slice(0,-1).filter(Array.isArray)]):(r="id",i=[e,n,...t.filter(Array.isArray)])}if(i.length===0)return[];let s=new Map;for(let a of i)if(Array.isArray(a))for(let o of a){let u=m(o)?d(o,r):void 0;if(u!==void 0){let f=s.get(u);s.set(u,f?{...f,...o}:o)}}return Array.from(s.values())}function qn(e,n,t){if(!Array.isArray(e)||n===t)return e?[...e]:[];let r=[...e],[i]=r.splice(n,1);return r.splice(t,0,i),r}function Dn(e,n){if(!Array.isArray(e)||e.length===0||n===0)return e?[...e]:[];let t=e.length,r=(n%t+t)%t;return[...e.slice(-r),...e.slice(0,-r)]}function zn(e,n,...t){if(!Array.isArray(e))return t;let r=[...e];return r.splice(n,0,...t),r}function Hn(e,n,t=1){if(!Array.isArray(e))return[];let r=[...e];return r.splice(n,t),r}function _n(e,n,t){if(!Array.isArray(e))return[];let r=[...e];return r[n]=t,r}function Jn(e,n){if(!Array.isArray(e))return[];let t=e.filter(r=>r!=null);return n?t.filter(n):t}function Qn(...e){return e.length===0?[[]]:e.length===1?e[0].map(n=>[n]):e.reduce((n,t)=>n.flatMap(r=>t.map(i=>[...r,i])),[[]])}function Zn(e,n){if(!Array.isArray(e))return[];let t=[];for(let r=0;r<e.length;r++)n(e[r],r)&&t.push(r);return t}function Gn(e,n,t=!0){if(!Array.isArray(e)||!Array.isArray(n)||e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(t&&m(e[r])&&m(n[r])){if(JSON.stringify(e[r])!==JSON.stringify(n[r]))return!1}else if(e[r]!==n[r])return!1;return!0}function Xn(e,n){if(!Array.isArray(e)||e.length===0)return[];let t=[],r=[e[0]],i=n(e[0],0);for(let s=1;s<e.length;s++){let a=n(e[s],s);a===i?r.push(e[s]):(t.push(r),r=[e[s]],i=a)}return t.push(r),t}function Yn(e,n,t,r){if(!Array.isArray(e))return[];let i=typeof n=="function",s=i?t:r;return e.map(a=>{let o=!1;return i?o=n(a):o=(m(a)?d(a,n):a)===t,o?{...a,...s}:a})}function et(e,n){if(!Array.isArray(e))return{unique:[],duplicates:[]};let t=new Set,r=[],i=[];for(let s of e){let a=n&&m(s)?d(s,n):s;t.has(a)?i.push(s):(t.add(a),r.push(s))}return{unique:r,duplicates:i}}function ee(e){return Array.isArray(e)?e:e==null?[]:[e]}function nt(e){return ee(e)}function tt(e,n,t=1){if(!Array.isArray(e)||n<1||t<1)return[];let r=[];for(let i=0;i<=e.length-n;i+=t)r.push(e.slice(i,i+n));return r}function rt(e,n){if(!Array.isArray(e)||e.length===0)return;let t=e[0],r=typeof n=="function"?n(t):d(t,n);for(let i=1;i<e.length;i++){let s=e[i],a=typeof n=="function"?n(s):d(s,n);a<r&&(r=a,t=s)}return t}function it(e,n){if(!Array.isArray(e)||e.length===0)return;let t=e[0],r=typeof n=="function"?n(t):d(t,n);for(let i=1;i<e.length;i++){let s=e[i],a=typeof n=="function"?n(s):d(s,n);a>r&&(r=a,t=s)}return t}function ne(e,n){if(!Array.isArray(e)||e.length===0)return 0;let t=0;for(let r of e){let i=typeof n=="function"?n(r):d(r,n);typeof i=="number"&&!isNaN(i)&&(t+=i)}return t}function st(e,n){return!Array.isArray(e)||e.length===0?0:ne(e,n)/e.length}function R(e){let n=new Map;if(!Array.isArray(e))return n;for(let t of e)n.set(t,(n.get(t)||0)+1);return n}function te(e,n=1){if(!Array.isArray(e)||e.length===0||n<1)return[];let t=R(e);return Array.from(t.entries()).sort((i,s)=>s[1]-i[1]).slice(0,n).map(([i])=>i)}function ot(e,n=1){if(!Array.isArray(e)||e.length===0||n<1)return[];let t=R(e);return Array.from(t.entries()).sort((i,s)=>i[1]-s[1]).slice(0,n).map(([i])=>i)}async function at(e,n,t){if(!Array.isArray(e)||n<1)return;let r=k(e,n);for(let i=0;i<r.length;i++)await t(r[i],i)}async function ut(e,n,t,r){if(!Array.isArray(e)||n<1||t<1)return;let i=k(e,n),s=k(i.map((a,o)=>({batch:a,index:o})),t);for(let a of s)await Promise.all(a.map(({batch:o,index:u})=>r(o,u)))}function ft(e){if(!Array.isArray(e)||e.length===0)return[];let n=Math.max(...e.map(r=>r.length)),t=[];for(let r=0;r<n;r++){let i=[];for(let s=0;s<e.length;s++)r<e[s].length&&i.push(e[s][r]);t.push(i)}return t}function lt(e,n){if(!Array.isArray(e)||!Array.isArray(n)||e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function ct(e,n){if(!Array.isArray(e)||!Array.isArray(n)||e.length!==n.length)return!1;let t=R(e),r=R(n);if(t.size!==r.size)return!1;for(let[i,s]of t)if(r.get(i)!==s)return!1;return!0}function re(e,n){if(!Array.isArray(e)||!Array.isArray(n))return!1;let t=new Set(n);return e.every(r=>t.has(r))}function yt(e,n){return re(n,e)}function pt(...e){if(e.length===0)return[];let n=Math.max(...e.map(r=>r.length)),t=[];for(let r=0;r<n;r++)for(let i of e)r<i.length&&t.push(i[r]);return t}function dt(e,n){let t=[],r=[];if(!Array.isArray(e))return{pass:t,fail:r};for(let i=0;i<e.length;i++)n(e[i],i)?t.push(e[i]):r.push(e[i]);return{pass:t,fail:r}}function Tt(e,n){if(e<0)return[];let t=[];for(let r=0;r<e;r++)t.push(n(r));return t}function gt(e,n){if(!Array.isArray(e)||n<0)return[];let t=[];for(let r=0;r<n;r++)t.push(...e);return t}function At(e){if(!Array.isArray(e)||e.length===0)return;let n=[...e].sort((r,i)=>r-i),t=Math.floor(n.length/2);return n.length%2===0?(n[t-1]+n[t])/2:n[t]}function mt(e){let n=te(e,1);return n.length>0?n[0]:void 0}function xt(e,...n){if(!Array.isArray(e))return[];let t=new Set(n);return e.filter(r=>!t.has(r))}function ht(e,...n){if(!Array.isArray(e))return[];let t=new Set(n.flat());return e.filter(r=>!t.has(r))}function bt(e){if(!Array.isArray(e)||e.length===0)return[];let n=[],t=[e[0]];for(let r=1;r<e.length;r++)e[r]===e[r-1]?t.push(e[r]):(n.push(t),t=[e[r]]);return n.push(t),n}function St(e){if(!Array.isArray(e)||e.length===0)return[];let n=[e[0]];for(let t=1;t<e.length;t++)e[t]!==e[t-1]&&n.push(e[t]);return n}function vt(e,n="standard"){if(!Array.isArray(e)||e.length===0)return[];let t=e.map((i,s)=>({value:i,index:s}));t.sort((i,s)=>i.value-s.value);let r=new Array(e.length);if(n==="ordinal")for(let i=0;i<t.length;i++)r[t[i].index]=i+1;else if(n==="dense"){let i=1;r[t[0].index]=i;for(let s=1;s<t.length;s++)t[s].value!==t[s-1].value&&i++,r[t[s].index]=i}else{let i=0;for(;i<t.length;){let s=i;for(;s<t.length&&t[s].value===t[i].value;)s++;let a=i+1;for(let o=i;o<s;o++)r[t[o].index]=a;i=s}}return r}function j(e,n){if(!Array.isArray(e)||e.length===0||n<0||n>100)return;let t=[...e].sort((o,u)=>o-u),r=n/100*(t.length-1),i=Math.floor(r),s=Math.ceil(r),a=r-i;return i===s?t[i]:t[i]*(1-a)+t[s]*a}function wt(e){if(!Array.isArray(e)||e.length===0)return;let n=j(e,25),t=j(e,50),r=j(e,75);return{q1:n,q2:t,q3:r,iqr:r-n}}function U(e,n=!1){if(!Array.isArray(e)||e.length===0||n&&e.length===1)return;let t=e.reduce((s,a)=>s+a,0)/e.length,i=e.map(s=>Math.pow(s-t,2)).reduce((s,a)=>s+a,0)/(n?e.length-1:e.length);return Math.sqrt(i)}function Kt(e,n=!1){let t=U(e,n);return t!==void 0?Math.pow(t,2):void 0}function Ot(e){if(!Array.isArray(e)||e.length===0)return[];let n=Math.min(...e),r=Math.max(...e)-n;return r===0?e.map(()=>0):e.map(i=>(i-n)/r)}function Pt(e){if(!Array.isArray(e)||e.length===0)return[];let n=e.reduce((r,i)=>r+i,0)/e.length,t=U(e);return t===void 0||t===0?e.map(()=>0):e.map(r=>(r-n)/t)}function ie(e,n,t){if(!Array.isArray(e))return[];let r=[],i=t;for(let s=0;s<e.length;s++)i=n(i,e[s],s),r.push(i);return r}function Rt(e){return ie(e,(n,t)=>n+t,0)}function It(e){if(!Array.isArray(e)||e.length<2)return[];let n=[];for(let t=1;t<e.length;t++)n.push(e[t]-e[t-1]);return n}function kt(e,n,t,r="end"){if(!Array.isArray(e)||n<=e.length)return[...e];let i=new Array(n-e.length).fill(t);return r==="start"?[...i,...e]:[...e,...i]}function Ft(e,n){if(!Array.isArray(e)||e.length===0)return[];let t=0,r=e.length-1;for(;t<=r&&n(e[t]);)t++;for(;r>=t&&n(e[r]);)r--;return e.slice(t,r+1)}function jt(e){if(!Array.isArray(e)||e.length<2)return[];let n=[];for(let t=0;t<e.length-1;t++)n.push([e[t],e[t+1]]);return n}function Et(e){return Array.isArray(e)?e.map((n,t)=>[t,n]):[]}function Vt(e,n){return Array.isArray(e)?e.map((t,r)=>{let i=n[r%n.length];return i(t)}):[]}function se(e,n=1){if(!Array.isArray(e)||e.length===0)return[];let t=e.length,r=(n%t+t)%t;return[...e.slice(r),...e.slice(0,r)]}function Mt(e,n=1){return se(e,-n)}function $t(e,n,t){if(!Array.isArray(e)||n<0||t<0||n>=e.length||t>=e.length)return[...e];let r=[...e];return[r[n],r[t]]=[r[t],r[n]],r}function Ct(e,n,t){if(!Array.isArray(e)||n<0||t>=e.length||n>=t)return[...e];let r=[...e],i=r.slice(n,t+1).reverse();return r.splice(n,t-n+1,...i),r}function Ut(e,n){if(!Array.isArray(e)||e.length<=1)return!0;let t=n||((r,i)=>r<i?-1:r>i?1:0);for(let r=1;r<e.length;r++)if(t(e[r-1],e[r])>0)return!1;return!0}function Wt(e){return Array.isArray(e)?new Set(e).size!==e.length:!1}function Nt(e,n){return Array.isArray(e)?e.map(t=>{let r={};for(let i of n)i in t&&(r[i]=t[i]);return r}):[]}function oe(e,n,t){if(!Array.isArray(e))return{};let r={};for(let i=0;i<e.length;i++){let s=n(e[i],i),a=t?t(e[i],i):e[i];r[s]=a}return r}async function Bt(e,n){if(!Array.isArray(e))return[];let t=[];for(let r=0;r<e.length;r++)t.push(await n(e[r],r));return t}async function Lt(e,n){return Array.isArray(e)?Promise.all(e.map((t,r)=>n(t,r))):[]}async function qt(e,n){if(!Array.isArray(e))return[];let t=[];for(let r=0;r<e.length;r++)await n(e[r],r)&&t.push(e[r]);return t}async function Dt(e,n,t){if(!Array.isArray(e))return t;let r=t;for(let i=0;i<e.length;i++)r=await n(r,e[i],i);return r}async function zt(e,n){if(Array.isArray(e)){for(let t=0;t<e.length;t++)if(await n(e[t],t))return e[t]}}async function Ht(e,n){if(!Array.isArray(e))return!1;for(let t=0;t<e.length;t++)if(await n(e[t],t))return!0;return!1}async function _t(e,n){if(!Array.isArray(e))return!0;for(let t=0;t<e.length;t++)if(!await n(e[t],t))return!1;return!0}function Jt(e,n,t){if(!Array.isArray(e)||e.length===0)return 0;let r=0,i=0;for(let s of e){let a=typeof n=="function"?n(s):d(s,n),o=typeof t=="function"?t(s):d(s,t);typeof a=="number"&&typeof o=="number"&&(i+=a*o,r+=o)}return r===0?0:i/r}function Qt(e,n,t=1){if(!Array.isArray(e)||e.length===0||t<1)return[];let r=[],i=0;for(let a of e){let o=typeof n=="function"?n(a):d(a,n);i+=typeof o=="number"&&o>0?o:0,r.push(i)}if(i===0)return[];let s=[];for(let a=0;a<t;a++){let o=Math.random()*i,u=r.findIndex(f=>o<f);u!==-1&&s.push(e[u])}return s}function Zt(e,n){if(!Array.isArray(e)||!Array.isArray(n))return[];let t=[],r=0;for(let i of n){if(r>=e.length)break;t.push(e.slice(r,r+i)),r+=i}return t}function Gt(e,n){if(!Array.isArray(e)||n<1)return[];let t=R(e),r=[];for(let i of e)t.get(i)===n&&r.push(i);return r}function Xt(e,n,t){if(!Array.isArray(e)||n<1)return[];let r=[],i=0,s=[];for(let a of e)t(a)?(i++,s.push(a),i>=n&&r.push(...s.splice(0,s.length-n+1))):(i=0,s.length=0);return i>=n&&r.push(...s),r}function Yt(e,n,t){if(!Array.isArray(e))return[];let r=[],i=t;for(let s=0;s<e.length;s++){let{value:a,newContext:o}=n(e[s],i,s);r.push(a),i=o}return r}function er(e,n){return k(e,n)}function nr(e,n,t){if(!Array.isArray(e)||!Array.isArray(n))return[];let r=Math.min(e.length,n.length),i=[];for(let s=0;s<r;s++)i.push(t(e[s],n[s]));return i}function tr(e,n,t="last"){if(!Array.isArray(e)||e.length===0)return[];let r=new Map;for(let s of e)if(Array.isArray(s))for(let a of s){let o=d(a,n);if(t==="first")r.has(o)||r.set(o,a);else if(t==="last")r.set(o,a);else if(t==="concat"){let u=r.get(o);Array.isArray(u)?u.push(a):u?r.set(o,[u,a]):r.set(o,a)}else if(typeof t=="function"){let u=r.get(o);u&&!Array.isArray(u)?r.set(o,t(u,a)):r.set(o,a)}}let i=[];for(let s of r.values())Array.isArray(s)&&t==="concat"?i.push(...s):Array.isArray(s)||i.push(s);return i}function rr(e,n){return oe(e,t=>String(d(t,n)))}function ir(e,n,t){if(!Array.isArray(e)||e.length===0)return-1;let r=t||((a,o)=>a<o?-1:a>o?1:0),i=0,s=e.length-1;for(;i<=s;){let a=Math.floor((i+s)/2),o=r(e[a],n);if(o===0)return a;o<0?i=a+1:s=a-1}return-1}function sr(e,n,t){if(!Array.isArray(e))return[n];let r=t||((a,o)=>a<o?-1:a>o?1:0),i=[...e],s=0;for(;s<i.length&&r(i[s],n)<0;)s++;return i.splice(s,0,n),i}function ar(e){return e&&typeof e.addEventListener=="function"}function ur(e){return e&&typeof e.addEventListener=="function"&&typeof e.removeEventListener=="function"}function fr(e){return e&&typeof e.on=="function"&&typeof e.off=="function"}function lr(e){return e&&typeof e.addListener=="function"&&typeof e.removeListener=="function"}function yr(){return typeof globalThis=="object"?globalThis:typeof window=="object"?window:typeof self=="object"?self:typeof global=="object"?global:null}function pr(e){return Buffer.from(e).toString("base64")}function dr(e){return Buffer.from(e).toString("base64")}function Tr(e){return decodeURIComponent(Buffer.from(e,"base64").toString("utf-8"))}var gr=(e,n,t)=>{let r=t,i=new RegExp("([?&])"+n+"=.*?(&|$)","i"),s=e.includes("?")?"&":"?";n==="country"&&(r=JSON.parse(r).alpha_2),n==="phone"&&(r=r.trim().replace(/\s/g,""));let a=e.match(i);return typeof a<"u"&&a!==null?e.replace(i,"$1"+n+"="+r+"$2"):e+s+n+"="+r};var mr=async(e,n="SHA-1")=>{if(typeof window>"u")return null;let{subtle:t}=window.globalThis.crypto,r=await t.generateKey({name:"HMAC",hash:n,length:256},!0,["sign","verify"]),s=new TextEncoder().encode(e),a=await t.sign({name:"HMAC"},r,s);return[...new Uint8Array(a)].map(u=>u.toString(16).padStart(2,"0")).join("")},W=async(e,n="SHA-256")=>{let r=new TextEncoder().encode(e),i=await crypto.subtle.digest(n,r);return Array.from(new Uint8Array(i)).map(o=>o.toString(16).padStart(2,"0")).join("")},xr=async(e,n,t="SHA-256")=>{let r=await W(e,t),i=await W(n,t);return r===i};async function hr(e,n="SHA-256"){let r=new TextEncoder().encode(e),i=await crypto.subtle.digest(n,r);return Array.from(new Uint8Array(i)).map(o=>o.toString(16).padStart(2,"0")).join("")}var br=e=>{let n=0;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);n=(n<<5)-n+r,n=n&n}return n.toString(16)};import{isClass as ae}from"@fluixi/utils/object";function ue(e){return typeof e=="function"&&!ae(e)}function wr(e){return e instanceof Promise||!!e&&(typeof e=="object"||typeof e=="function")&&"then"in e}function Kr(e){return ue(e)&&e.constructor.name==="AsyncFunction"}function Or(e,n){let t=new Map,r=function(...i){let s=n?n(...i):JSON.stringify(i);if(t.has(s))return t.get(s);let a=e.apply(this,i);return t.set(s,a),a};return r.cache=t,r}function fe(e,n,t={}){let{leading:r=!1,trailing:i=!0,maxWait:s}=t,a,o,u,f=0,y,T,p;function b(A){let v=y,w=T;return y=T=void 0,f=A,p=e.apply(w,v),p}function l(A,v){return setTimeout(A,v)}function c(A){A!==void 0&&clearTimeout(A)}function g(A){return f=A,a=l(O,n),r?b(A):p}function x(A){let v=A-u,w=A-f,V=n-v;return s!==void 0?Math.min(V,s-w):V}function h(A){let v=A-u,w=A-f;return u===void 0||v>=n||v<0||s!==void 0&&w>=s}function O(){let A=Date.now();if(h(A)){E(A);return}a=l(O,x(A))}function E(A){return a=void 0,i&&y?b(A):(y=T=void 0,p)}function N(){c(a),c(o),f=0,y=u=T=a=o=void 0}function B(){return a===void 0?p:E(Date.now())}function L(){return a!==void 0}function I(...A){let v=Date.now(),w=h(v);if(y=A,T=this,u=v,w){if(a===void 0)return g(u);if(s!==void 0)return a=l(O,n),b(u)}return a===void 0&&(a=l(O,n)),p}return I.cancel=N,I.flush=B,I.pending=L,I}function Pr(e,n,t={}){let{leading:r=!0,trailing:i=!0}=t;return fe(e,n,{leading:r,trailing:i,maxWait:n})}function Rr(e){let n=!1,t,r=function(...i){return n||(n=!0,t=e.apply(this,i)),t};return Object.defineProperty(r,"called",{get(){return n}}),r}function Ir(e,...n){return function(...t){let r=n.map(i=>t[i]);return e.apply(this,r)}}function kr(e,n=e.length){return function t(...r){return r.length>=n?e.apply(this,r):function(...i){return t.apply(this,[...r,...i])}}}function le(...e){return e.reduceRight((n,t)=>r=>t(n(r)),n=>n)}function ce(...e){return e.reduce((n,t)=>r=>t(n(r)),n=>n)}function Fr(e){return function(...n){return!e.apply(this,n)}}function jr(e,...n){return function(...t){let r=t.map((i,s)=>n[s]?n[s](i):i);return e.apply(this,r)}}function Er(e,...n){return function(...t){return e.apply(this,[...n,...t])}}function Vr(e,...n){return function(...t){return e.apply(this,[...t,...n])}}function Mr(e,n,...t){return function(...r){return e.apply(n,[...t,...r])}}function $r(e){return function(...n){return e.apply(this,n.reverse())}}function Cr(e,n){return function(...t){return e.apply(this,t.slice(0,n))}}function Ur(e){return function(n){return e.call(this,n)}}function Wr(e,...n){return setTimeout(e,1,...n)}function Nr(e,n,...t){return setTimeout(e,n,...t)}function Br(e,n,t){let r=new Map,i=function(...s){let a=t?t(...s):JSON.stringify(s),o=Date.now(),u=r.get(a);if(u&&u.expires>o)return u.value;let f=e.apply(this,s);r.set(a,{value:f,expires:o+n});for(let[y,T]of r.entries())T.expires<=o&&r.delete(y);return f};return i.cache=r,i}function Lr(e,n){let t,r=0;return function(...i){return++r<n&&(t=e.apply(this,i)),r>=n&&(e=void 0),t}}function qr(e,n){let t=0;return function(...r){if(++t>=n)return e.apply(this,r)}}function Dr(e,n){return function(...t){try{return e.apply(this,t)}catch(r){return n(r,...t)}}}function zr(...e){return ce(...e)}function Hr(...e){return le(...e)}function _r(e,n={}){let{retries:t=3,delay:r=1e3,backoff:i=2,onRetry:s}=n;return async function(...a){let o,u=r;for(let f=0;f<=t;f++)try{return await e.apply(this,a)}catch(y){o=y,f<t&&(s&&s(o,f+1),await new Promise(T=>setTimeout(T,u)),u*=i)}throw o}}function Jr(e,n,t){return async function(...r){return Promise.race([e.apply(this,r),new Promise((i,s)=>setTimeout(()=>{t&&t(),s(new Error(`Function timed out after ${n}ms`))},n))])}}export{Tr as aenu,qr as after,Vt as applyByIndex,Cr as ary,Ee as at,st as avgBy,er as batch,at as batchProcess,ut as batchProcessParallel,Lr as before,dt as bifurcate,ir as binarySearch,Mr as bind,pr as btoa,Qn as cartesian,k as chunk,Xn as chunkBy,Pn as compact,xr as compareWithHash,le as compose,Tn as countBy,mr as createHash,Rt as cumulativeSum,kr as curry,fe as debounce,St as dedupeConsecutive,Bn as deepCloneArray,Wr as defer,Nr as delay,It as diff,mn as difference,ht as differenceWith,Kn as drop,On as dropWhile,ee as ensureArray,Et as enumerate,_t as everyAsync,Nn as fill,qt as filterAsync,Jn as filterCompact,Xt as filterConsecutive,Zn as findAllIndices,zt as findAsync,jn as findIndex,En as findLastIndex,Ie as first,Cn as flatMap,pn as flatten,je as flattenArray,X as flattenDeep,$r as flip,zr as flow,Hr as flowRight,R as frequencies,Tt as generate,Ge as generateID,Ze as generateUUID,Qe as getKind,Fe as groupArrayBy,dn as groupBy,bt as groupConsecutive,Wt as hasDuplicates,ct as hasSameElements,W as hash,hr as hashStringPromise,rr as indexBy,zn as insert,sr as insertSorted,pt as interleave,xn as intersection,lr as isAddRemoveListenerTarget,he as isArray,lt as isArrayEqual,ve as isArrayLike,Te as isArrayOfBoolean,de as isArrayOfNumber,ge as isArrayOfObject,pe as isArrayOfString,Kr as isAsyncFunction,ar as isDOMEventTarget,Je as isDefined,Se as isDoubleArray,we as isEmptyArray,Gn as isEqual,ue as isFunction,D as isIterable,ur as isNodeEventEmitter,Ke as isNonEmptyArray,ze as isNull,xe as isObjectArray,fr as isOnOffTarget,Q as isPrimitive,wr as isPromise,Pe as isReadonlyArray,Ut as isSorted,be as isStaticArray,re as isSubset,yt as isSuperset,Oe as isTypedArray,He as isUndefined,_e as isUndefinedOrNull,gn as keyBy,Re as last,ot as leastCommon,Bt as mapAsync,Lt as mapAsyncParallel,Yt as mapWithContext,it as maxBy,At as median,Or as memoize,Br as memoizeWithTTL,tr as mergeArraysByKey,Ln as mergeByKey,rt as minBy,mt as mode,te as mostCommon,qn as move,Fr as negate,Ot as normalize,$n as omit,Rr as once,jr as overArgs,kt as pad,jt as pairwise,Er as partial,Vr as partialRight,bn as partition,j as percentile,Mn as pick,Nt as pickMany,ce as pipe,Vn as pluck,wt as quartiles,Wn as range,vt as rank,Ir as rearg,Dt as reduceAsync,Un as reduceRight,Hn as remove,gt as repeat,_n as replace,_r as retry,Ct as reverseSegment,Dn as rotate,se as rotateLeft,Mt as rotateRight,kn as sample,Fn as sampleSize,ie as scan,Zt as segment,Gt as selectByCount,Y as shuffle,tt as slidingWindow,Ht as someAsync,An as sortBy,et as splitDuplicates,U as standardDeviation,Pt as standardize,br as string_hash,ne as sumBy,$t as swap,Sn as take,vn as takeLast,wn as takeWhile,Pr as throttle,ke as toArray,ye as toArrayString,oe as toObject,ft as transpose,Ft as trim,Dr as tryCatch,dr as uena,Ur as unary,hn as union,F as unique,In as unzip,Yn as updateBy,gr as updateQueryStringParameter,Kt as variance,Jt as weightedAverage,Qt as weightedSample,yr as windowObject,Jr as withTimeout,xt as without,nt as wrap,Rn as zip,nr as zipWith};
@@ -0,0 +1 @@
1
+ "use strict";var I=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var z=(e,t)=>{for(var n in t)I(e,n,{get:t[n],enumerable:!0})},J=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of L(t))!_.call(e,i)&&i!==n&&I(e,i,{get:()=>t[i],enumerable:!(r=N(t,i))||r.enumerable});return e};var D=e=>J(I({},"__esModule",{value:!0}),e);var _n={};z(_n,{applyByIndex:()=>mn,avgBy:()=>Ne,batch:()=>En,batchProcess:()=>_e,batchProcessParallel:()=>ze,bifurcate:()=>He,binarySearch:()=>Nn,cartesian:()=>Ve,chunk:()=>v,chunkBy:()=>Ce,compact:()=>le,countBy:()=>X,cumulativeSum:()=>yn,dedupeConsecutive:()=>on,deepCloneArray:()=>we,diff:()=>pn,difference:()=>ne,differenceWith:()=>rn,drop:()=>ae,dropWhile:()=>fe,ensureArray:()=>$,enumerate:()=>gn,everyAsync:()=>kn,fill:()=>Ke,filterAsync:()=>Pn,filterCompact:()=>ke,filterConsecutive:()=>Mn,findAllIndices:()=>Re,findAsync:()=>Fn,findIndex:()=>Te,findLastIndex:()=>Ae,flatMap:()=>he,flatten:()=>G,flattenDeep:()=>V,frequencies:()=>K,generate:()=>Xe,groupBy:()=>H,groupConsecutive:()=>sn,hasDuplicates:()=>Kn,hasSameElements:()=>Qe,indexBy:()=>Bn,insert:()=>Ie,insertSorted:()=>Ln,interleave:()=>Ge,intersection:()=>te,isArrayEqual:()=>De,isEqual:()=>$e,isSorted:()=>Sn,isSubset:()=>U,isSuperset:()=>Ze,keyBy:()=>Y,leastCommon:()=>Le,mapAsync:()=>vn,mapAsyncParallel:()=>On,mapWithContext:()=>Un,maxBy:()=>Be,median:()=>en,mergeArraysByKey:()=>qn,mergeByKey:()=>ve,minBy:()=>qe,mode:()=>nn,mostCommon:()=>M,move:()=>Oe,normalize:()=>ln,omit:()=>xe,pad:()=>dn,pairwise:()=>An,partition:()=>ie,percentile:()=>P,pick:()=>me,pickMany:()=>wn,pluck:()=>ge,quartiles:()=>an,range:()=>Se,rank:()=>un,reduceAsync:()=>In,reduceRight:()=>be,remove:()=>Fe,repeat:()=>Ye,replace:()=>je,reverseSegment:()=>bn,rotate:()=>Pe,rotateLeft:()=>W,rotateRight:()=>xn,sample:()=>pe,sampleSize:()=>de,scan:()=>E,segment:()=>$n,selectByCount:()=>Cn,shuffle:()=>R,slidingWindow:()=>We,someAsync:()=>jn,sortBy:()=>ee,splitDuplicates:()=>Ue,standardDeviation:()=>F,standardize:()=>cn,sumBy:()=>C,swap:()=>hn,take:()=>se,takeLast:()=>oe,takeWhile:()=>ue,toObject:()=>q,transpose:()=>Je,trim:()=>Tn,union:()=>re,unique:()=>O,unzip:()=>ye,updateBy:()=>Me,variance:()=>fn,weightedAverage:()=>Vn,weightedSample:()=>Rn,without:()=>tn,wrap:()=>Ee,zip:()=>ce,zipWith:()=>Wn});module.exports=D(_n);var A=e=>e==null||Array.isArray(e)||typeof e=="function"||e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error?!1:typeof e=="object";var h=(e,t,n,r)=>{if(n>r)return;if(t.length===0)return e;let i=t[0],s=t.slice(1);if(i.type==="descendant"){let u=h(e,s,n+1,r);if(u!==void 0)return u;if(e&&typeof e=="object")if(Array.isArray(e)){let o=[];for(let a=0;a<e.length;a++){let f=h(e[a],t,n+1,r);f!==void 0&&(o[a]=f)}return o.length>0?o:void 0}else{let o={};for(let a in e)if(e.hasOwnProperty(a)){let f=h(e[a],t,n+1,r);f!==void 0&&(o[a]=f)}return Object.keys(o).length>0?o:void 0}return}switch(i.type){case"property":if(A(e)&&i.value&&String(i.value)in e){let u=e[String(i.value)],o=h(u,s,n+1,r);if(o!==void 0)return{[String(i.value)]:o}}break;case"index":if(Array.isArray(e)){let u=i.value;if(u>=0&&u<e.length){let o=h(e[u],s,n+1,r);if(o!==void 0){let a=new Array(e.length).filter(f=>f!==void 0);return a[u]=o,a}}}else if(e&&typeof e=="object"){let u=String(i.value);if(u in e){let o=h(e[u],s,n+1,r);if(o!==void 0)return{[u]:o}}}break;case"wildcard":if(e&&typeof e=="object")if(Array.isArray(e)){let u=[],o=!1;for(let a=0;a<e.length;a++){let f=h(e[a],s,n+1,r);f!==void 0&&(u[a]=f,o=!0)}return o?u:void 0}else{let u={},o=!1;for(let a in e)if(e.hasOwnProperty(a)){let f=h(e[a],s,n+1,r);f!==void 0&&(u[a]=f,o=!0)}return o?u:void 0}break;case"slice":if(Array.isArray(e)){let[u,o]=i.value,a=Math.max(0,u),f=Math.min(e.length,o===1/0?e.length:o),y=[],g=!1;for(let p=a;p<f;p++){let b=h(e[p],s,n+1,r);b!==void 0&&(y[p]=b,g=!0)}return g?y:void 0}break;case"union":if(Array.isArray(e)){let u=i.value,o=[],a=!1;for(let f of u)if(f>=0&&f<e.length){let y=h(e[f],s,n+1,r);y!==void 0&&(o[f]=y,a=!0)}return a?o:void 0}break;case"filter":if(Array.isArray(e)){let u=i.value,o=[],a=!1;for(let f=0;f<e.length;f++)if(u(e[f])){let y=h(e[f],s,n+1,r);y!==void 0&&(o[f]=y,a=!0)}return a?o:void 0}break}};var S=(e,t)=>{if(e==null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(e instanceof Map){let n=new Map;return e.forEach((r,i)=>{(!t||!t.some(s=>s.toString()===i.toString()))&&n.set(i,S(r))}),n}if(e instanceof Set){let n=new Set;return e.forEach(r=>{n.add(S(r))}),n}if(Array.isArray(e))return Array.from(e).map(n=>S(n));if(A(e)){let n={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(!t||!t.some(s=>s.toString()===i.toString()))&&(n[i]=S(e[i]));let r=Object.getOwnPropertySymbols(e);for(let i of r)(!t||!t.some(s=>s.toString()===i.toString()))&&(n[i]=S(e[i]));return n}return e};var w=(e,t={})=>{let{type:n="auto",throwOnError:r=!1}=t;if(!e||typeof e!="string")return[];let i=[],s="",u=!1,o=!1,a="",f="",y=0,p=n==="auto"?(c=>c.includes("..")?"descendant":c.includes("[?(")?"filter":c.includes("[:")||c.includes("[0:")?"slice":c.includes("[,")||c.includes("[0,1]")?"union":c.includes("[*]")||c.includes(".*.")?"wildcard":c.includes("[]")?"array-wildcard":c.includes("[")&&c.includes("]")?"bracket":"dot")(e):n,b=c=>{let l=c.trim();if(l==="*"||l==="")return{type:"wildcard",value:l===""?"[]":"*",raw:l===""?"[]":c};if(l==="[]")return{type:"wildcard",value:"[]",raw:c};if(/^-?\d+$/.test(l))return{type:"index",value:parseInt(l,10),raw:c};if(l.includes(":")){let T=l.split(":").map(B=>B.trim()),m=T[0]===""?0:parseInt(T[0],10),x=T[1]===""?1/0:parseInt(T[1],10);if(isNaN(m)||isNaN(x)){if(r)throw new Error(`Invalid slice notation: ${c}`);return{type:"wildcard",value:"*",raw:c}}return{type:"slice",value:[m,x],raw:c}}if(l.includes(",")){let T=l.split(",").map(m=>{let x=parseInt(m.trim(),10);return isNaN(x)?-1:x}).filter(m=>m>=0);if(T.length===0){if(r)throw new Error(`Invalid union notation: ${c}`);return{type:"wildcard",value:"*",raw:c}}return{type:"union",value:T,raw:c}}if(l.startsWith("?(")&&l.endsWith(")")){let T=l.slice(2,-1);try{return{type:"filter",value:Q(T),raw:c}}catch(m){if(r)throw m;return{type:"wildcard",value:"*",raw:c}}}return l.startsWith('"')&&l.endsWith('"')||l.startsWith("'")&&l.endsWith("'")?{type:"property",value:l.slice(1,-1),raw:c}:{type:"property",value:l,raw:c}};for(let c=0;c<e.length;c++){let l=e[c],T=e[c+1];if((l==='"'||l==="'")&&!o){o=!0,a=l;continue}else if(l===a&&o){o=!1,a="",l==='"'||l==="'"||(u?f+=l:s+=l);continue}if(o){u?f+=l:s+=l;continue}if(l==="["&&!u){s&&(i.push({type:"property",value:s,raw:s}),s=""),u=!0,f="";continue}if(l==="]"&&u&&!o){u=!1;let x=b(f);i.push(x);continue}let m=i.length>0?i[i.length-1]:null;if(l==="."&&!u&&!o){if(T==="."){let x=e.split("..")[0];i.push({type:"property",value:x,raw:x}),i.push({type:"descendant",value:"..",raw:".."}),c++}else s&&(s==="*"?i.push({type:"wildcard",value:s,raw:s}):i.push({type:"property",value:s,raw:s}),s="");continue}if(u)f+=l;else if(m&&m.type!=="descendant")s+=l;else{let x=e.split(m?.raw)[1];x!==void 0?s=x:s+=l}}return s&&i.push({type:"property",value:s,raw:s}),i.map(c=>{if(c.type==="property"&&typeof c.value=="string"&&/^-?\d+$/.test(c.value)){let l=parseInt(c.value,10);if(!isNaN(l))return{...c,type:"index",value:l}}return c})},Q=e=>{let t=e.replace(/@\.([a-zA-Z_$][\w$]*)/g,(n,r)=>`item.${r}`).replace(/@/g,"item");try{return new Function("item",`return ${t}`)}catch{throw new Error(`Invalid filter expression: ${e}`)}};var j=(e,t,n)=>{let r=w(t),i=e;for(let s=0;s<r.length;s++){let u=r[s],o=s===r.length-1;switch(u.type){case"property":if(o)i[String(u.value)]=n;else{if(!i[String(u.value)]){let f=r[s+1];i[String(u.value)]=f.type==="index"||f.type==="slice"||f.type==="union"||f.type==="wildcard"?[]:{}}i=i[String(u.value)]}break;case"index":Array.isArray(i)||(i=[]);let a=u.value;if(o){if(a>=i.length)for(let f=i.length;f<=a;f++)i.push(void 0);i[a]=n}else{if(!i[a]){let f=r[s+1];i[a]=f.type==="index"||f.type==="slice"||f.type==="union"||f.type==="wildcard"?[]:{}}i=i[a]}break;case"wildcard":if(Array.isArray(i))if(o)for(let f=0;f<i.length;f++)i[f]=n;else{let f=r[s+1];for(let y=0;y<i.length;y++)i[y]||(i[y]=f.type==="index"||f.type==="slice"||f.type==="union"||f.type==="wildcard"?[]:{});i.length>0&&(i=i[0])}break}}};function d(e,t,n={}){let{preserveStructure:r,multiple:i,throwOnError:s=!1,defaultValue:u,maxDepth:o=20}=n;if(!e||typeof e!="object")return u;if(!t)return e;if(Array.isArray(t))if(r){let y={};for(let g of t){let p=d(e,g,{...n,preserveStructure:!1});p!==void 0&&j(y,g,p)}return y}else return t.map(y=>d(e,y,{...n,preserveStructure:!1}));let a=w(t,{...n,throwOnError:s});if(a.length===0)return e;if(typeof r>"u"||r===!1){let y=Z(e,t);return i===!1&&Array.isArray(y)?y[0]:y===void 0&&u!==void 0?u:y}let f=h(e,a,0,o);return f===void 0&&u!==void 0?u:f}function Z(e,t,n={}){let{createMissing:r=!1,add:i=!1,debug:s=!1}=n,u=w(t),o=e,a=!1,f="",y=t;if(typeof o=="object"&&!Array.isArray(o)&&y.length>0&&o[y])return o=o[y],o;for(let g=0;g<u.length;g++){let p=u[g],b=u.length>1?g===u.length-1:!1;if(o===null&&!r)return;let c=u[g+1];switch(p.type){case"property":if(o&&typeof o=="object")if(Array.isArray(o)){if(typeof p.value=="number"){let l=p.value;if(r&&l>=o.length)for(let T=o.length;T<=l;T++)o.push(void 0);if(r&&(o[l]===null||o[l]===void 0)&&(!b||a)&&(c?o[l]=c.type==="index"||c.type==="slice"||c.type==="union"||c.type==="wildcard"?[]:{}:o[l]=null,a=!1),o=o[l],c){a=!0;continue}}else i?o.push({[String(p.value)]:null}):o=o.map(l=>l[String(p.value)]);if(c)continue;return k(o)}else{if(o[f]&&f.split(".").length>=2){o=o[f];continue}if(r&&(o[String(p.value)]===null||o[String(p.value)]===void 0)&&(!b||a)&&(c?o[String(p.value)]=c.type==="index"||c.type==="slice"||c.type==="union"||c.type==="wildcard"?[]:{}:o[String(p.value)]=null,a=!1,o=o[String(p.value)],c)){a=!0;continue}if(o?(!o[String(p.value)]&&r&&(o[String(p.value)]=null),o=o[String(p.value)]):o={[String(p.value)]:null},c)continue}else if(r)o={},o[String(p.value)]=c.type==="index"||c.type==="slice"||c.type==="union"||c.type==="wildcard"||n.type==="array"?[]:{},o=o[String(p.value)];else return;break;case"index":case"wildcard":if(Array.isArray(o)){if(p.type==="index"){let l=p.value;if(l<0){o=o[o.length-Math.abs(l)];continue}if(r&&(l>=o.length||o[l]==null||o[l]==null)&&!b){for(let T=o.length;T<=l;T++)o.push(void 0);c&&(o[l]=c.type==="index"||c.type==="slice"||c.type==="union"||c.type==="wildcard"?[]:{})}o=o[l]}else if(!b)continue}else if(r){let l=u[g+1];o=[];let T=p.value;for(let m=0;m<=T;m++)o.push(void 0);o[T]=l.type==="index"||l.type==="slice"||l.type==="union"||l.type==="wildcard"||n.type==="array"?[]:{},o=o[T]}else{if(p.type==="index"&&typeof o=="object"&&o&&o[String(p.value)]!==void 0){o=o[String(p.value)];continue}if(typeof o=="object"){o=Object.values(o);continue}return}break;default:return}}return k(o)}function k(e){return Array.isArray(e)?e.filter(t=>typeof t<"u"):e}function v(e,t){if(!Array.isArray(e)||t<1)return[];let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n}function G(e){return e.reduce((t,n)=>t.concat(n),[])}function V(e,t=1/0){return t<1?e.slice():e.reduce((n,r)=>(Array.isArray(r)?n.push(...V(r,t-1)):n.push(r),n),[])}function O(e,t){if(!Array.isArray(e))return[];if(!t)return[...new Set(e)];let n=new Set;return e.filter(r=>{let i=typeof t=="function"?t(r):A(r)?d(r,t):r;return n.has(i)?!1:(n.add(i),!0)})}function H(e,t){return Array.isArray(e)?e.reduce((n,r)=>{let i;return typeof t=="function"?i=String(t(r)):i=String(A(r)?d(r,t):r),n[i]||(n[i]=[]),n[i].push(r),n},{}):{}}function X(e,t){return Array.isArray(e)?e.reduce((n,r)=>{let i;return typeof t=="function"?i=String(t(r)):t?i=String(A(r)?d(r,t):r):i=String(r),n[i]=(n[i]||0)+1,n},{}):{}}function Y(e,t,n){return Array.isArray(e)?e.reduce((r,i)=>{let s;typeof t=="function"?s=String(t(i)):s=String(A(i)?d(i,t):i);let u;return n?typeof n=="function"?u=n(i):u=d(i,n):u=i,r[s]=u,r},{}):{}}function ee(e,t){if(!Array.isArray(e)||e.length===0)return[];let n=[...e],i=(Array.isArray(t)?t:[t]).map(s=>typeof s=="object"&&"key"in s?{key:s.key,dir:s.dir||"asc"}:{key:s,dir:"asc"});return n.sort((s,u)=>{for(let{key:o,dir:a}of i){let f=A(s)?d(s,o):s,y=A(u)?d(u,o):u;if(f===y)continue;let g=f<y?-1:1;return a==="asc"?g:-g}return 0}),n}function ne(e,t,n){if(!Array.isArray(e))return[];if(!Array.isArray(t))return e;if(!n){let i=new Set(t);return e.filter(s=>!i.has(s))}let r=new Set(t.map(i=>A(i)?d(i,n):i));return e.filter(i=>{let s=A(i)?d(i,n):i;return!r.has(s)})}function te(e,t,n){if(!Array.isArray(e)||!Array.isArray(t))return[];if(!n){let i=new Set(t);return e.filter(s=>i.has(s))}let r=new Set(t.map(i=>A(i)?d(i,n):i));return e.filter(i=>{let s=A(i)?d(i,n):i;return r.has(s)})}function re(e,t,n){return!Array.isArray(e)&&!Array.isArray(t)?[]:Array.isArray(e)?Array.isArray(t)?O([...e,...t],n):O(e,n):O(t,n)}function ie(e,t){return Array.isArray(e)?e.reduce((n,r,i)=>(n[t(r,i)?0:1].push(r),n),[[],[]]):[[],[]]}function se(e,t){return!Array.isArray(e)||t<=0?[]:e.slice(0,t)}function oe(e,t){return!Array.isArray(e)||t<=0?[]:e.slice(-t)}function ue(e,t){if(!Array.isArray(e))return[];let n=[];for(let r=0;r<e.length&&t(e[r],r);r++)n.push(e[r]);return n}function ae(e,t){return!Array.isArray(e)||t<=0?e?[...e]:[]:e.slice(t)}function fe(e,t){if(!Array.isArray(e))return[];let n=0;for(;n<e.length&&t(e[n],n);)n++;return e.slice(n)}function le(e){return Array.isArray(e)?e.filter(Boolean):[]}function ce(...e){if(e.length===0)return[];let t=Math.max(...e.map(r=>Array.isArray(r)?r.length:0)),n=[];for(let r=0;r<t;r++){let i=[];for(let s of e)i.push(Array.isArray(s)?s[r]:void 0);n.push(i)}return n}function ye(e){if(!Array.isArray(e)||e.length===0)return[];let t=Math.max(...e.map(r=>Array.isArray(r)?r.length:0)),n=[];for(let r=0;r<t;r++){let i=[];for(let s of e)Array.isArray(s)&&i.push(s[r]);n.push(i)}return n}function R(e){if(!Array.isArray(e))return[];let t=[...e];for(let n=t.length-1;n>0;n--){let r=Math.floor(Math.random()*(n+1));[t[n],t[r]]=[t[r],t[n]]}return t}function pe(e){if(!(!Array.isArray(e)||e.length===0))return e[Math.floor(Math.random()*e.length)]}function de(e,t){return!Array.isArray(e)||t<=0?[]:R(e).slice(0,Math.min(t,e.length))}function Te(e,t,n=0){if(!Array.isArray(e))return-1;for(let r=n;r<e.length;r++)if(t(e[r],r))return r;return-1}function Ae(e,t,n){if(!Array.isArray(e))return-1;let r=n!==void 0?n:e.length-1;for(let i=r;i>=0;i--)if(t(e[i],i))return i;return-1}function ge(e,t){return Array.isArray(e)?e.map(n=>d(n,t)):[]}function me(e,t){return!Array.isArray(e)||!Array.isArray(t)?[]:e.map(n=>{let r={};for(let i of t)i in n&&(r[i]=n[i]);return r})}function xe(e,t){return!Array.isArray(e)||!Array.isArray(t)?[]:e.map(n=>{let r={...n};for(let i of t)delete r[i];return r})}function he(e,t){return Array.isArray(e)?e.reduce((n,r,i)=>{let s=t(r,i);return n.concat(s)},[]):[]}function be(e,t,n){if(!Array.isArray(e))return n;let r=n;for(let i=e.length-1;i>=0;i--)r=t(r,e[i],i);return r}function Se(e,t,n=1){if(n===0)return[];let r=[];if(n>0)for(let i=e;i<t;i+=n)r.push(i);else for(let i=e;i>t;i+=n)r.push(i);return r}function Ke(e,t,n=0,r){if(!Array.isArray(e))return[];let i=[...e],s=r===void 0?i.length:r;for(let u=n;u<s&&u<i.length;u++)i[u]=t;return i}function we(e){return Array.isArray(e)?S(e):[]}function ve(e,t,...n){let r,i;if(typeof t=="string")r=t,i=[e];else{let u=n[n.length-1];typeof u=="string"?(r=u,i=[e,t,...n.slice(0,-1).filter(Array.isArray)]):(r="id",i=[e,t,...n.filter(Array.isArray)])}if(i.length===0)return[];let s=new Map;for(let u of i)if(Array.isArray(u))for(let o of u){let a=A(o)?d(o,r):void 0;if(a!==void 0){let f=s.get(a);s.set(a,f?{...f,...o}:o)}}return Array.from(s.values())}function Oe(e,t,n){if(!Array.isArray(e)||t===n)return e?[...e]:[];let r=[...e],[i]=r.splice(t,1);return r.splice(n,0,i),r}function Pe(e,t){if(!Array.isArray(e)||e.length===0||t===0)return e?[...e]:[];let n=e.length,r=(t%n+n)%n;return[...e.slice(-r),...e.slice(0,-r)]}function Ie(e,t,...n){if(!Array.isArray(e))return n;let r=[...e];return r.splice(t,0,...n),r}function Fe(e,t,n=1){if(!Array.isArray(e))return[];let r=[...e];return r.splice(t,n),r}function je(e,t,n){if(!Array.isArray(e))return[];let r=[...e];return r[t]=n,r}function ke(e,t){if(!Array.isArray(e))return[];let n=e.filter(r=>r!=null);return t?n.filter(t):n}function Ve(...e){return e.length===0?[[]]:e.length===1?e[0].map(t=>[t]):e.reduce((t,n)=>t.flatMap(r=>n.map(i=>[...r,i])),[[]])}function Re(e,t){if(!Array.isArray(e))return[];let n=[];for(let r=0;r<e.length;r++)t(e[r],r)&&n.push(r);return n}function $e(e,t,n=!0){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(n&&A(e[r])&&A(t[r])){if(JSON.stringify(e[r])!==JSON.stringify(t[r]))return!1}else if(e[r]!==t[r])return!1;return!0}function Ce(e,t){if(!Array.isArray(e)||e.length===0)return[];let n=[],r=[e[0]],i=t(e[0],0);for(let s=1;s<e.length;s++){let u=t(e[s],s);u===i?r.push(e[s]):(n.push(r),r=[e[s]],i=u)}return n.push(r),n}function Me(e,t,n,r){if(!Array.isArray(e))return[];let i=typeof t=="function",s=i?n:r;return e.map(u=>{let o=!1;return i?o=t(u):o=(A(u)?d(u,t):u)===n,o?{...u,...s}:u})}function Ue(e,t){if(!Array.isArray(e))return{unique:[],duplicates:[]};let n=new Set,r=[],i=[];for(let s of e){let u=t&&A(s)?d(s,t):s;n.has(u)?i.push(s):(n.add(u),r.push(s))}return{unique:r,duplicates:i}}function $(e){return Array.isArray(e)?e:e==null?[]:[e]}function Ee(e){return $(e)}function We(e,t,n=1){if(!Array.isArray(e)||t<1||n<1)return[];let r=[];for(let i=0;i<=e.length-t;i+=n)r.push(e.slice(i,i+t));return r}function qe(e,t){if(!Array.isArray(e)||e.length===0)return;let n=e[0],r=typeof t=="function"?t(n):d(n,t);for(let i=1;i<e.length;i++){let s=e[i],u=typeof t=="function"?t(s):d(s,t);u<r&&(r=u,n=s)}return n}function Be(e,t){if(!Array.isArray(e)||e.length===0)return;let n=e[0],r=typeof t=="function"?t(n):d(n,t);for(let i=1;i<e.length;i++){let s=e[i],u=typeof t=="function"?t(s):d(s,t);u>r&&(r=u,n=s)}return n}function C(e,t){if(!Array.isArray(e)||e.length===0)return 0;let n=0;for(let r of e){let i=typeof t=="function"?t(r):d(r,t);typeof i=="number"&&!isNaN(i)&&(n+=i)}return n}function Ne(e,t){return!Array.isArray(e)||e.length===0?0:C(e,t)/e.length}function K(e){let t=new Map;if(!Array.isArray(e))return t;for(let n of e)t.set(n,(t.get(n)||0)+1);return t}function M(e,t=1){if(!Array.isArray(e)||e.length===0||t<1)return[];let n=K(e);return Array.from(n.entries()).sort((i,s)=>s[1]-i[1]).slice(0,t).map(([i])=>i)}function Le(e,t=1){if(!Array.isArray(e)||e.length===0||t<1)return[];let n=K(e);return Array.from(n.entries()).sort((i,s)=>i[1]-s[1]).slice(0,t).map(([i])=>i)}async function _e(e,t,n){if(!Array.isArray(e)||t<1)return;let r=v(e,t);for(let i=0;i<r.length;i++)await n(r[i],i)}async function ze(e,t,n,r){if(!Array.isArray(e)||t<1||n<1)return;let i=v(e,t),s=v(i.map((u,o)=>({batch:u,index:o})),n);for(let u of s)await Promise.all(u.map(({batch:o,index:a})=>r(o,a)))}function Je(e){if(!Array.isArray(e)||e.length===0)return[];let t=Math.max(...e.map(r=>r.length)),n=[];for(let r=0;r<t;r++){let i=[];for(let s=0;s<e.length;s++)r<e[s].length&&i.push(e[s][r]);n.push(i)}return n}function De(e,t){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Qe(e,t){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;let n=K(e),r=K(t);if(n.size!==r.size)return!1;for(let[i,s]of n)if(r.get(i)!==s)return!1;return!0}function U(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;let n=new Set(t);return e.every(r=>n.has(r))}function Ze(e,t){return U(t,e)}function Ge(...e){if(e.length===0)return[];let t=Math.max(...e.map(r=>r.length)),n=[];for(let r=0;r<t;r++)for(let i of e)r<i.length&&n.push(i[r]);return n}function He(e,t){let n=[],r=[];if(!Array.isArray(e))return{pass:n,fail:r};for(let i=0;i<e.length;i++)t(e[i],i)?n.push(e[i]):r.push(e[i]);return{pass:n,fail:r}}function Xe(e,t){if(e<0)return[];let n=[];for(let r=0;r<e;r++)n.push(t(r));return n}function Ye(e,t){if(!Array.isArray(e)||t<0)return[];let n=[];for(let r=0;r<t;r++)n.push(...e);return n}function en(e){if(!Array.isArray(e)||e.length===0)return;let t=[...e].sort((r,i)=>r-i),n=Math.floor(t.length/2);return t.length%2===0?(t[n-1]+t[n])/2:t[n]}function nn(e){let t=M(e,1);return t.length>0?t[0]:void 0}function tn(e,...t){if(!Array.isArray(e))return[];let n=new Set(t);return e.filter(r=>!n.has(r))}function rn(e,...t){if(!Array.isArray(e))return[];let n=new Set(t.flat());return e.filter(r=>!n.has(r))}function sn(e){if(!Array.isArray(e)||e.length===0)return[];let t=[],n=[e[0]];for(let r=1;r<e.length;r++)e[r]===e[r-1]?n.push(e[r]):(t.push(n),n=[e[r]]);return t.push(n),t}function on(e){if(!Array.isArray(e)||e.length===0)return[];let t=[e[0]];for(let n=1;n<e.length;n++)e[n]!==e[n-1]&&t.push(e[n]);return t}function un(e,t="standard"){if(!Array.isArray(e)||e.length===0)return[];let n=e.map((i,s)=>({value:i,index:s}));n.sort((i,s)=>i.value-s.value);let r=new Array(e.length);if(t==="ordinal")for(let i=0;i<n.length;i++)r[n[i].index]=i+1;else if(t==="dense"){let i=1;r[n[0].index]=i;for(let s=1;s<n.length;s++)n[s].value!==n[s-1].value&&i++,r[n[s].index]=i}else{let i=0;for(;i<n.length;){let s=i;for(;s<n.length&&n[s].value===n[i].value;)s++;let u=i+1;for(let o=i;o<s;o++)r[n[o].index]=u;i=s}}return r}function P(e,t){if(!Array.isArray(e)||e.length===0||t<0||t>100)return;let n=[...e].sort((o,a)=>o-a),r=t/100*(n.length-1),i=Math.floor(r),s=Math.ceil(r),u=r-i;return i===s?n[i]:n[i]*(1-u)+n[s]*u}function an(e){if(!Array.isArray(e)||e.length===0)return;let t=P(e,25),n=P(e,50),r=P(e,75);return{q1:t,q2:n,q3:r,iqr:r-t}}function F(e,t=!1){if(!Array.isArray(e)||e.length===0||t&&e.length===1)return;let n=e.reduce((s,u)=>s+u,0)/e.length,i=e.map(s=>Math.pow(s-n,2)).reduce((s,u)=>s+u,0)/(t?e.length-1:e.length);return Math.sqrt(i)}function fn(e,t=!1){let n=F(e,t);return n!==void 0?Math.pow(n,2):void 0}function ln(e){if(!Array.isArray(e)||e.length===0)return[];let t=Math.min(...e),r=Math.max(...e)-t;return r===0?e.map(()=>0):e.map(i=>(i-t)/r)}function cn(e){if(!Array.isArray(e)||e.length===0)return[];let t=e.reduce((r,i)=>r+i,0)/e.length,n=F(e);return n===void 0||n===0?e.map(()=>0):e.map(r=>(r-t)/n)}function E(e,t,n){if(!Array.isArray(e))return[];let r=[],i=n;for(let s=0;s<e.length;s++)i=t(i,e[s],s),r.push(i);return r}function yn(e){return E(e,(t,n)=>t+n,0)}function pn(e){if(!Array.isArray(e)||e.length<2)return[];let t=[];for(let n=1;n<e.length;n++)t.push(e[n]-e[n-1]);return t}function dn(e,t,n,r="end"){if(!Array.isArray(e)||t<=e.length)return[...e];let i=new Array(t-e.length).fill(n);return r==="start"?[...i,...e]:[...e,...i]}function Tn(e,t){if(!Array.isArray(e)||e.length===0)return[];let n=0,r=e.length-1;for(;n<=r&&t(e[n]);)n++;for(;r>=n&&t(e[r]);)r--;return e.slice(n,r+1)}function An(e){if(!Array.isArray(e)||e.length<2)return[];let t=[];for(let n=0;n<e.length-1;n++)t.push([e[n],e[n+1]]);return t}function gn(e){return Array.isArray(e)?e.map((t,n)=>[n,t]):[]}function mn(e,t){return Array.isArray(e)?e.map((n,r)=>{let i=t[r%t.length];return i(n)}):[]}function W(e,t=1){if(!Array.isArray(e)||e.length===0)return[];let n=e.length,r=(t%n+n)%n;return[...e.slice(r),...e.slice(0,r)]}function xn(e,t=1){return W(e,-t)}function hn(e,t,n){if(!Array.isArray(e)||t<0||n<0||t>=e.length||n>=e.length)return[...e];let r=[...e];return[r[t],r[n]]=[r[n],r[t]],r}function bn(e,t,n){if(!Array.isArray(e)||t<0||n>=e.length||t>=n)return[...e];let r=[...e],i=r.slice(t,n+1).reverse();return r.splice(t,n-t+1,...i),r}function Sn(e,t){if(!Array.isArray(e)||e.length<=1)return!0;let n=t||((r,i)=>r<i?-1:r>i?1:0);for(let r=1;r<e.length;r++)if(n(e[r-1],e[r])>0)return!1;return!0}function Kn(e){return Array.isArray(e)?new Set(e).size!==e.length:!1}function wn(e,t){return Array.isArray(e)?e.map(n=>{let r={};for(let i of t)i in n&&(r[i]=n[i]);return r}):[]}function q(e,t,n){if(!Array.isArray(e))return{};let r={};for(let i=0;i<e.length;i++){let s=t(e[i],i),u=n?n(e[i],i):e[i];r[s]=u}return r}async function vn(e,t){if(!Array.isArray(e))return[];let n=[];for(let r=0;r<e.length;r++)n.push(await t(e[r],r));return n}async function On(e,t){return Array.isArray(e)?Promise.all(e.map((n,r)=>t(n,r))):[]}async function Pn(e,t){if(!Array.isArray(e))return[];let n=[];for(let r=0;r<e.length;r++)await t(e[r],r)&&n.push(e[r]);return n}async function In(e,t,n){if(!Array.isArray(e))return n;let r=n;for(let i=0;i<e.length;i++)r=await t(r,e[i],i);return r}async function Fn(e,t){if(Array.isArray(e)){for(let n=0;n<e.length;n++)if(await t(e[n],n))return e[n]}}async function jn(e,t){if(!Array.isArray(e))return!1;for(let n=0;n<e.length;n++)if(await t(e[n],n))return!0;return!1}async function kn(e,t){if(!Array.isArray(e))return!0;for(let n=0;n<e.length;n++)if(!await t(e[n],n))return!1;return!0}function Vn(e,t,n){if(!Array.isArray(e)||e.length===0)return 0;let r=0,i=0;for(let s of e){let u=typeof t=="function"?t(s):d(s,t),o=typeof n=="function"?n(s):d(s,n);typeof u=="number"&&typeof o=="number"&&(i+=u*o,r+=o)}return r===0?0:i/r}function Rn(e,t,n=1){if(!Array.isArray(e)||e.length===0||n<1)return[];let r=[],i=0;for(let u of e){let o=typeof t=="function"?t(u):d(u,t);i+=typeof o=="number"&&o>0?o:0,r.push(i)}if(i===0)return[];let s=[];for(let u=0;u<n;u++){let o=Math.random()*i,a=r.findIndex(f=>o<f);a!==-1&&s.push(e[a])}return s}function $n(e,t){if(!Array.isArray(e)||!Array.isArray(t))return[];let n=[],r=0;for(let i of t){if(r>=e.length)break;n.push(e.slice(r,r+i)),r+=i}return n}function Cn(e,t){if(!Array.isArray(e)||t<1)return[];let n=K(e),r=[];for(let i of e)n.get(i)===t&&r.push(i);return r}function Mn(e,t,n){if(!Array.isArray(e)||t<1)return[];let r=[],i=0,s=[];for(let u of e)n(u)?(i++,s.push(u),i>=t&&r.push(...s.splice(0,s.length-t+1))):(i=0,s.length=0);return i>=t&&r.push(...s),r}function Un(e,t,n){if(!Array.isArray(e))return[];let r=[],i=n;for(let s=0;s<e.length;s++){let{value:u,newContext:o}=t(e[s],i,s);r.push(u),i=o}return r}function En(e,t){return v(e,t)}function Wn(e,t,n){if(!Array.isArray(e)||!Array.isArray(t))return[];let r=Math.min(e.length,t.length),i=[];for(let s=0;s<r;s++)i.push(n(e[s],t[s]));return i}function qn(e,t,n="last"){if(!Array.isArray(e)||e.length===0)return[];let r=new Map;for(let s of e)if(Array.isArray(s))for(let u of s){let o=d(u,t);if(n==="first")r.has(o)||r.set(o,u);else if(n==="last")r.set(o,u);else if(n==="concat"){let a=r.get(o);Array.isArray(a)?a.push(u):a?r.set(o,[a,u]):r.set(o,u)}else if(typeof n=="function"){let a=r.get(o);a&&!Array.isArray(a)?r.set(o,n(a,u)):r.set(o,u)}}let i=[];for(let s of r.values())Array.isArray(s)&&n==="concat"?i.push(...s):Array.isArray(s)||i.push(s);return i}function Bn(e,t){return q(e,n=>String(d(n,t)))}function Nn(e,t,n){if(!Array.isArray(e)||e.length===0)return-1;let r=n||((u,o)=>u<o?-1:u>o?1:0),i=0,s=e.length-1;for(;i<=s;){let u=Math.floor((i+s)/2),o=r(e[u],t);if(o===0)return u;o<0?i=u+1:s=u-1}return-1}function Ln(e,t,n){if(!Array.isArray(e))return[t];let r=n||((u,o)=>u<o?-1:u>o?1:0),i=[...e],s=0;for(;s<i.length&&r(i[s],t)<0;)s++;return i.splice(s,0,t),i}