@unicom-cloud/utils 0.1.32 → 0.1.34

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 (358) hide show
  1. package/case-name/index.js +1 -1
  2. package/caseName.js +1 -1
  3. package/class-name/index.js +1 -1
  4. package/className.js +1 -1
  5. package/clipboard-copy/index.js +7 -7
  6. package/clipboardCopy.js +1 -1
  7. package/constant/address.js +1 -1
  8. package/constant/chineseCharacters.js +1 -1
  9. package/constant/constellations.js +1 -1
  10. package/constant/domain.js +1 -1
  11. package/constant/emoji.js +1 -1
  12. package/constant/identity.js +1 -1
  13. package/constant/index.js +1 -1
  14. package/constant/isMobile.js +1 -1
  15. package/constant/keyboardCode.js +1 -1
  16. package/constant/licensePlate.js +1 -1
  17. package/constant/name.js +1 -1
  18. package/constant/platform.js +1 -1
  19. package/constant/protocol.js +1 -1
  20. package/constant/string.js +1 -1
  21. package/constant/ui.js +1 -1
  22. package/constant.js +1 -1
  23. package/content-disposition/index.js +1 -1
  24. package/contentDisposition.js +1 -1
  25. package/cookie/index.js +1 -1
  26. package/cookie/src/api.js +1 -1
  27. package/cookie/src/assign.js +1 -1
  28. package/cookie/src/converter.js +1 -1
  29. package/cookie.js +1 -1
  30. package/date/convertTime.js +1 -1
  31. package/date/convertToDuration.js +1 -1
  32. package/date/index.js +5 -5
  33. package/date.js +5 -5
  34. package/decimal/decimal.js +1 -1
  35. package/decimal/index.js +1 -1
  36. package/decimal.js +1 -1
  37. package/dom-helpers/activeElement.js +1 -1
  38. package/dom-helpers/addClass.js +1 -1
  39. package/dom-helpers/addEventListener.js +1 -1
  40. package/dom-helpers/animate.js +1 -1
  41. package/dom-helpers/animationFrame.js +1 -1
  42. package/dom-helpers/attribute.js +1 -1
  43. package/dom-helpers/camelize.js +1 -1
  44. package/dom-helpers/camelizeStyle.js +1 -1
  45. package/dom-helpers/canUseDOM.js +1 -1
  46. package/dom-helpers/childElements.js +1 -1
  47. package/dom-helpers/childNodes.js +1 -1
  48. package/dom-helpers/clear.js +1 -1
  49. package/dom-helpers/closest.js +1 -1
  50. package/dom-helpers/collectElements.js +1 -1
  51. package/dom-helpers/collectSiblings.js +1 -1
  52. package/dom-helpers/contains.js +1 -1
  53. package/dom-helpers/css.js +1 -1
  54. package/dom-helpers/filterEventHandler.js +1 -1
  55. package/dom-helpers/getComputedStyle.js +1 -1
  56. package/dom-helpers/getElementCoordinates.js +46 -0
  57. package/dom-helpers/getScrollAccessor.js +1 -1
  58. package/dom-helpers/hasClass.js +1 -1
  59. package/dom-helpers/height.js +1 -1
  60. package/dom-helpers/hyphenate.js +1 -1
  61. package/dom-helpers/hyphenateStyle.js +1 -1
  62. package/dom-helpers/index.js +87 -84
  63. package/dom-helpers/insertAfter.js +1 -1
  64. package/dom-helpers/isDocument.js +1 -1
  65. package/dom-helpers/isInput.js +1 -1
  66. package/dom-helpers/isTransform.js +1 -1
  67. package/dom-helpers/isVisible.js +1 -1
  68. package/dom-helpers/isWindow.js +1 -1
  69. package/dom-helpers/listen.js +1 -1
  70. package/dom-helpers/matches.js +1 -1
  71. package/dom-helpers/nextUntil.js +1 -1
  72. package/dom-helpers/offset.js +1 -1
  73. package/dom-helpers/offsetParent.js +1 -1
  74. package/dom-helpers/ownerDocument.js +1 -1
  75. package/dom-helpers/ownerWindow.js +1 -1
  76. package/dom-helpers/parents.js +1 -1
  77. package/dom-helpers/position.js +1 -1
  78. package/dom-helpers/prepend.js +1 -1
  79. package/dom-helpers/querySelectorAll.js +1 -1
  80. package/dom-helpers/reflow.js +1 -1
  81. package/dom-helpers/remove.js +1 -1
  82. package/dom-helpers/removeClass.js +1 -1
  83. package/dom-helpers/removeEventListener.js +1 -1
  84. package/dom-helpers/scrollLeft.js +1 -1
  85. package/dom-helpers/scrollParent.js +1 -1
  86. package/dom-helpers/scrollTo.js +1 -1
  87. package/dom-helpers/scrollTop.js +1 -1
  88. package/dom-helpers/scrollbarSize.js +1 -1
  89. package/dom-helpers/siblings.js +1 -1
  90. package/dom-helpers/text.js +1 -1
  91. package/dom-helpers/toggleClass.js +1 -1
  92. package/dom-helpers/transitionEnd.js +2 -2
  93. package/dom-helpers/triggerEvent.js +1 -1
  94. package/dom-helpers/types.js +1 -1
  95. package/dom-helpers/width.js +1 -1
  96. package/domHelpers.js +65 -63
  97. package/emitter/index.js +1 -1
  98. package/emitter/src/index.js +1 -1
  99. package/emitter.js +1 -1
  100. package/escape/index.js +11 -0
  101. package/escape.js +6 -0
  102. package/file/fileToURL.js +14 -21
  103. package/file/index.js +1 -1
  104. package/file/saveAs.js +28 -31
  105. package/file.js +1 -1
  106. package/function/index.js +50 -0
  107. package/function.js +48 -0
  108. package/idb/index.js +1 -1
  109. package/idb.js +1 -1
  110. package/index.js +1 -1
  111. package/invariant/index.js +1 -1
  112. package/invariant.js +1 -1
  113. package/is/index.js +196 -141
  114. package/is/lib/isAscii.js +9 -0
  115. package/is/lib/isBase64.js +13 -0
  116. package/is/lib/isChinese.js +19 -0
  117. package/is/lib/isDataURI.js +25 -0
  118. package/is/lib/isEmail.js +72 -0
  119. package/is/lib/isFQDN.js +27 -0
  120. package/is/lib/isFullWidth.js +10 -0
  121. package/is/lib/isHSL.js +11 -0
  122. package/is/lib/isHalfWidth.js +10 -0
  123. package/is/lib/isHash.js +23 -0
  124. package/is/lib/isHexColor.js +12 -0
  125. package/is/lib/isIMEI.js +20 -0
  126. package/is/lib/isIP.js +21 -0
  127. package/is/lib/isIPRange.js +25 -0
  128. package/is/lib/isIdentityCard.js +190 -0
  129. package/is/lib/isJWT.js +14 -0
  130. package/is/lib/isMACAddress.js +9 -0
  131. package/is/lib/isMD5.js +9 -0
  132. package/is/lib/isMimeType.js +9 -0
  133. package/is/lib/isMobilePhone.js +192 -0
  134. package/is/lib/isPort.js +7 -0
  135. package/is/lib/isRgbColor.js +18 -0
  136. package/is/lib/isSemVer.js +20 -0
  137. package/is/lib/isSlug.js +9 -0
  138. package/is/lib/isStrongPassword.js +48 -0
  139. package/is/lib/isURL.js +78 -0
  140. package/is/lib/isUUID.js +24 -0
  141. package/is/lib/isVariableWidth.js +10 -0
  142. package/is/lib/util/assertString.js +12 -0
  143. package/is.js +122 -66
  144. package/lunar/index.js +1 -1
  145. package/lunar/lib/Holiday.js +1 -1
  146. package/lunar/lib/HolidayUtil.js +1 -1
  147. package/lunar/lib/I18n.js +1 -1
  148. package/lunar/lib/JieQi.js +1 -1
  149. package/lunar/lib/Lunar.js +1 -1
  150. package/lunar/lib/LunarMonth.js +1 -1
  151. package/lunar/lib/LunarTime.js +1 -1
  152. package/lunar/lib/LunarUtil.js +1 -1
  153. package/lunar/lib/LunarYear.js +1 -1
  154. package/lunar/lib/ShouXingUtil.js +1 -1
  155. package/lunar/lib/Solar.js +1 -1
  156. package/lunar/lib/SolarHalfYear.js +1 -1
  157. package/lunar/lib/SolarMonth.js +1 -1
  158. package/lunar/lib/SolarSeason.js +1 -1
  159. package/lunar/lib/SolarUtil.js +1 -1
  160. package/lunar/lib/SolarWeek.js +1 -1
  161. package/lunar/lib/SolarYear.js +1 -1
  162. package/lunar/lib/index.js +1 -1
  163. package/lunar.js +1 -1
  164. package/math/index.js +1 -1
  165. package/math.js +1 -1
  166. package/md5/index.js +1 -1
  167. package/md5.js +1 -1
  168. package/mock/MockWebSocket.js +1 -1
  169. package/mock/MockXMLHttpRequest.js +1 -1
  170. package/mock/index.js +1 -1
  171. package/mock.js +1 -1
  172. package/normalize-wheel/ExecutionEnvironment.js +1 -1
  173. package/normalize-wheel/UserAgent_DEPRECATED.js +1 -1
  174. package/normalize-wheel/index.js +1 -1
  175. package/normalize-wheel/isEventSupported.js +1 -1
  176. package/normalizeWheel.js +1 -1
  177. package/number-to-chinese/index.js +1 -1
  178. package/numberToChinese.js +1 -1
  179. package/nzh/cn.js +1 -1
  180. package/nzh/hk.js +1 -1
  181. package/nzh/index.js +1 -1
  182. package/nzh/nzh.js +1 -1
  183. package/nzh/src/autoGet.js +1 -1
  184. package/nzh/src/index.js +1 -1
  185. package/nzh/src/langs/cn_b.js +1 -1
  186. package/nzh/src/langs/cn_s.js +1 -1
  187. package/nzh/src/langs/hk_b.js +1 -1
  188. package/nzh/src/langs/hk_s.js +1 -1
  189. package/nzh/src/utils.js +1 -1
  190. package/nzh.js +1 -1
  191. package/object-keys-sort/index.js +1 -1
  192. package/object-prototype-to-string-call/index.js +2 -2
  193. package/objectKeysSort.js +1 -1
  194. package/objectPrototypeToStringCall.js +1 -1
  195. package/package.json +1 -1
  196. package/pinyin/index.js +1 -1
  197. package/pinyin/simplified.js +1 -1
  198. package/pinyin/src/core.js +1 -1
  199. package/pinyin/src/simplified.js +6 -6
  200. package/pinyin/src/simplified_dict.js +5 -4
  201. package/pinyin/src/traditional.js +4 -4
  202. package/pinyin/src/traditional_dict.js +4 -3
  203. package/pinyin/traditional.js +1 -1
  204. package/pinyin.js +1 -1
  205. package/query-string/base.js +1 -1
  206. package/query-string/index.js +1 -1
  207. package/query-string/splitOnFirst.js +1 -1
  208. package/queryString.js +1 -1
  209. package/random/address.js +1 -1
  210. package/random/constellation.js +1 -1
  211. package/random/image.js +1 -1
  212. package/random/index.js +1 -1
  213. package/random/licensePlate.js +1 -1
  214. package/random/name.js +1 -1
  215. package/random/number.js +1 -1
  216. package/random/text.js +1 -1
  217. package/random/time.js +1 -1
  218. package/random/web.js +1 -1
  219. package/random.js +1 -1
  220. package/screenfull/index.js +1 -1
  221. package/screenfull.js +1 -1
  222. package/sleep/index.js +1 -1
  223. package/sleep.js +1 -1
  224. package/snapdom/index.js +1 -1
  225. package/snapdom/src/api/preCache.js +1 -1
  226. package/snapdom/src/api/snapdom.js +2 -2
  227. package/snapdom/src/core/cache.js +1 -1
  228. package/snapdom/src/core/capture.js +1 -1
  229. package/snapdom/src/core/clone.js +1 -1
  230. package/snapdom/src/core/context.js +1 -1
  231. package/snapdom/src/core/plugins.js +1 -1
  232. package/snapdom/src/core/prepare.js +1 -1
  233. package/snapdom/src/exporters/download.js +14 -9
  234. package/snapdom/src/exporters/toBlob.js +1 -1
  235. package/snapdom/src/exporters/toCanvas.js +1 -1
  236. package/snapdom/src/exporters/toImg.js +1 -1
  237. package/snapdom/src/modules/CSSVar.js +1 -1
  238. package/snapdom/src/modules/background.js +1 -1
  239. package/snapdom/src/modules/changeCSS.js +1 -1
  240. package/snapdom/src/modules/counter.js +1 -1
  241. package/snapdom/src/modules/fonts.js +1 -1
  242. package/snapdom/src/modules/iconFonts.js +1 -1
  243. package/snapdom/src/modules/images.js +1 -1
  244. package/snapdom/src/modules/lineClamp.js +1 -1
  245. package/snapdom/src/modules/pseudo.js +1 -1
  246. package/snapdom/src/modules/rasterize.js +1 -1
  247. package/snapdom/src/modules/snapFetch.js +1 -1
  248. package/snapdom/src/modules/styles.js +2 -2
  249. package/snapdom/src/modules/svgDefs.js +1 -1
  250. package/snapdom/src/utils/browser.js +1 -1
  251. package/snapdom/src/utils/capture.helpers.js +1 -1
  252. package/snapdom/src/utils/clone.helpers.js +1 -1
  253. package/snapdom/src/utils/css.js +1 -1
  254. package/snapdom/src/utils/helpers.js +1 -1
  255. package/snapdom/src/utils/image.js +1 -1
  256. package/snapdom/src/utils/prepare.helpers.js +1 -1
  257. package/snapdom/src/utils/transforms.helpers.js +1 -1
  258. package/snapdom.js +1 -1
  259. package/string/index.js +1 -1
  260. package/string.js +1 -1
  261. package/tinycolor/index.js +1 -1
  262. package/tinycolor/src/conversion.js +1 -1
  263. package/tinycolor/src/css-color-names.js +1 -1
  264. package/tinycolor/src/format-input.js +1 -1
  265. package/tinycolor/src/from-ratio.js +12 -11
  266. package/tinycolor/src/index.js +1 -1
  267. package/tinycolor/src/random.js +30 -29
  268. package/tinycolor/src/readability.js +1 -1
  269. package/tinycolor/src/to-ms-filter.js +1 -1
  270. package/tinycolor/src/utils.js +1 -1
  271. package/tinycolor.js +1 -1
  272. package/tree/index.js +54 -75
  273. package/tree/search/index.js +1 -1
  274. package/tree.js +9 -11
  275. package/tween/index.js +1 -1
  276. package/tween/src/easing.js +1 -1
  277. package/tween/src/tween.js +15 -14
  278. package/tween.js +1 -1
  279. package/types/clipboard-copy/index.d.ts +1 -1
  280. package/types/date/index.d.ts +3 -3
  281. package/types/dom-helpers/getElementCoordinates.d.ts +40 -0
  282. package/types/dom-helpers/index.d.ts +3 -1
  283. package/types/escape/index.d.ts +2 -0
  284. package/types/file/fileToURL.d.ts +1 -1
  285. package/types/function/index.d.ts +2 -0
  286. package/types/is/index.d.ts +28 -1
  287. package/types/is/lib/isAscii.d.ts +1 -0
  288. package/types/is/lib/isBase64.d.ts +1 -0
  289. package/types/is/lib/isChinese.d.ts +4 -0
  290. package/types/is/lib/isDataURI.d.ts +1 -0
  291. package/types/is/lib/isEmail.d.ts +1 -0
  292. package/types/is/lib/isFQDN.d.ts +1 -0
  293. package/types/is/lib/isFullWidth.d.ts +2 -0
  294. package/types/is/lib/isHSL.d.ts +1 -0
  295. package/types/is/lib/isHalfWidth.d.ts +2 -0
  296. package/types/is/lib/isHash.d.ts +1 -0
  297. package/types/is/lib/isHexColor.d.ts +1 -0
  298. package/types/is/lib/isIMEI.d.ts +1 -0
  299. package/types/is/lib/isIP.d.ts +3 -0
  300. package/types/is/lib/isIPRange.d.ts +1 -0
  301. package/types/is/lib/isIdentityCard.d.ts +1 -0
  302. package/types/is/lib/isJWT.d.ts +1 -0
  303. package/types/is/lib/isMACAddress.d.ts +1 -0
  304. package/types/is/lib/isMD5.d.ts +1 -0
  305. package/types/is/lib/isMimeType.d.ts +1 -0
  306. package/types/is/lib/isMobilePhone.d.ts +2 -0
  307. package/types/is/lib/isOctal.d.ts +1 -0
  308. package/types/is/lib/isPort.d.ts +1 -0
  309. package/types/is/lib/isRgbColor.d.ts +1 -0
  310. package/types/is/lib/isSemVer.d.ts +1 -0
  311. package/types/is/lib/isSlug.d.ts +1 -0
  312. package/types/is/lib/isStrongPassword.d.ts +1 -0
  313. package/types/is/lib/isURL.d.ts +1 -0
  314. package/types/is/lib/isUUID.d.ts +1 -0
  315. package/types/is/lib/isVariableWidth.d.ts +1 -0
  316. package/types/is/lib/util/assertString.d.ts +1 -0
  317. package/types/pinyin/es/main.d.ts +4 -0
  318. package/types/pinyin/es/traditional.d.ts +4 -0
  319. package/types/snapdom/src/api/snapdom.d.ts +1 -0
  320. package/types/tree/index.d.ts +3 -4
  321. package/types/validate/src/index.d.ts +23 -25
  322. package/types/validate/src/interface.d.ts +5 -3
  323. package/types/validate/src/locale/en-US.d.ts +12 -2
  324. package/types/validate/src/locale/index.d.ts +171 -0
  325. package/types/validate/src/locale/zh-CN.d.ts +12 -2
  326. package/types/validate/src/rules/base.d.ts +3 -1
  327. package/types/validate/src/rules/custom.d.ts +1 -1
  328. package/types/validate/src/rules/type.d.ts +10 -0
  329. package/ui-color/compareColorByRange.js +1 -1
  330. package/ui-color/index.js +8 -7
  331. package/uiColor.js +25 -24
  332. package/url-toolkit/index.js +1 -1
  333. package/url-toolkit/src/url-toolkit.js +1 -1
  334. package/urlToolkit.js +1 -1
  335. package/validate/index.js +23 -25
  336. package/validate/src/index.js +116 -73
  337. package/validate/src/locale/en-US.js +12 -2
  338. package/validate/src/locale/index.js +11 -0
  339. package/validate/src/locale/zh-CN.js +12 -2
  340. package/validate/src/rules/array.js +2 -2
  341. package/validate/src/rules/base.js +35 -31
  342. package/validate/src/rules/boolean.js +1 -1
  343. package/validate/src/rules/custom.js +2 -2
  344. package/validate/src/rules/number.js +1 -1
  345. package/validate/src/rules/object.js +1 -1
  346. package/validate/src/rules/string.js +6 -5
  347. package/validate/src/rules/type.js +84 -14
  348. package/validate.js +23 -25
  349. package/version/index.js +1 -1
  350. package/version.js +1 -1
  351. package/xlsx/index.d.ts +4 -8
  352. package/xlsx/index.js +1 -1
  353. package/xlsx/xlsx.js +2 -2
  354. package/xlsx.js +1 -1
  355. package/types/validate/src/message.d.ts +0 -2
  356. package/types/validate/src/utils.d.ts +0 -3
  357. package/validate/src/message.js +0 -5
  358. package/validate/src/utils.js +0 -8
@@ -0,0 +1,9 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ import i from "./util/assertString.js";
3
+ const s = /^[\x00-\x7F]+$/;
4
+ function e(t) {
5
+ return i(t), s.test(t);
6
+ }
7
+ export {
8
+ e as default
9
+ };
@@ -0,0 +1,13 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ import r from "lodash/defaults";
3
+ import t from "./util/assertString.js";
4
+ const i = /^[A-Za-z0-9+/]+={0,2}$/, n = /^[A-Za-z0-9+/]+$/, f = /^[A-Za-z0-9_-]+={0,2}$/, g = /^[A-Za-z0-9_-]+$/;
5
+ function s(e, a) {
6
+ if (t(e), a = r(a, { urlSafe: !1, padding: !a?.urlSafe }), e === "") return !0;
7
+ if (a.padding && e.length % 4 !== 0) return !1;
8
+ let d;
9
+ return a.urlSafe ? d = a.padding ? f : g : d = a.padding ? i : n, (!a.padding || e.length % 4 === 0) && d.test(e);
10
+ }
11
+ export {
12
+ s as default
13
+ };
@@ -0,0 +1,19 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ function u(t) {
3
+ try {
4
+ return /\p{Script=Han}/u.test(t);
5
+ } catch {
6
+ return /[\u4e00-\u9fa5]/.test(t);
7
+ }
8
+ }
9
+ function n(t) {
10
+ try {
11
+ return /^\p{Script=Han}+$/u.test(t);
12
+ } catch {
13
+ return /^[\u4e00-\u9fa5]+$/.test(t);
14
+ }
15
+ }
16
+ export {
17
+ u as default,
18
+ n as isAllChinese
19
+ };
@@ -0,0 +1,25 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ import n from "./util/assertString.js";
3
+ const l = /^[a-z]+\/[a-z0-9\-+._]+$/i, f = /^[a-z-]+=[a-z0-9-]+$/i, o = /^[a-z0-9!$&'()*+,;=\-._~:@/?%\s]*$/i;
4
+ function u(i) {
5
+ n(i);
6
+ const a = i.split(",");
7
+ if (a.length < 2)
8
+ return !1;
9
+ const e = a.shift().trim().split(";"), s = e.shift();
10
+ if (s.slice(0, 5) !== "data:")
11
+ return !1;
12
+ const r = s.slice(5);
13
+ if (r !== "" && !l.test(r))
14
+ return !1;
15
+ for (let t = 0; t < e.length; t++)
16
+ if (!(t === e.length - 1 && e[t].toLowerCase() === "base64") && !f.test(e[t]))
17
+ return !1;
18
+ for (let t = 0; t < a.length; t++)
19
+ if (!o.test(a[t]))
20
+ return !1;
21
+ return !0;
22
+ }
23
+ export {
24
+ u as default
25
+ };
@@ -0,0 +1,72 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ import x from "lodash/defaults";
3
+ import m from "lodash/isObject";
4
+ import d from "lodash/isUndefined";
5
+ import o from "./isFQDN.js";
6
+ import u from "./isIP.js";
7
+ import _ from "./util/assertString.js";
8
+ const F = {
9
+ allow_display_name: !1,
10
+ allow_underscores: !1,
11
+ require_display_name: !1,
12
+ allow_utf8_local_part: !0,
13
+ require_tld: !0,
14
+ blacklisted_chars: "",
15
+ ignore_max_length: !1
16
+ }, g = /^([^\x00-\x1F\x7F-\x9F\cX]+)</i, h = /^[a-z\d!#$%&'*+\-/=?^_`{|}~]+$/i, p = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i, w = /^[a-z\d!#$%&'*+\-/=?^_`{|}~\u00A1-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i, b = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i, D = 254;
17
+ function $(a) {
18
+ const e = a.replace(/^"(.+)"$/, "$1");
19
+ return !(!e.trim() || /[.";<>]/.test(e) && (e === a || !(e.split('"').length === e.split('\\"').length)));
20
+ }
21
+ function f(a, e) {
22
+ _(a);
23
+ let i, t;
24
+ m(e) ? (i = e.min || 0, t = e.max) : (i = arguments[1], t = arguments[2]);
25
+ const l = encodeURI(a).split(/%..|./).length - 1;
26
+ return l >= i && (d(t) || l <= t);
27
+ }
28
+ function C(a, e) {
29
+ if (_(a), e = x(e, F), e.require_display_name || e.allow_display_name) {
30
+ const r = a.match(g);
31
+ if (r) {
32
+ let s = r[1];
33
+ if (a = a.replace(s, "").replace(/(^<|>$)/g, ""), s.endsWith(" ") && (s = s.slice(0, -1)), !$(s))
34
+ return !1;
35
+ } else if (e.require_display_name)
36
+ return !1;
37
+ }
38
+ if (!e.ignore_max_length && a.length > D)
39
+ return !1;
40
+ const i = a.split("@"), t = i.pop();
41
+ t.toLowerCase();
42
+ let l = i.join("@");
43
+ if (e.ignore_max_length === !1 && (!f(l, { max: 64 }) || !f(t, { max: 254 })))
44
+ return !1;
45
+ if (!o(t, {
46
+ require_tld: e.require_tld,
47
+ ignore_max_length: e.ignore_max_length,
48
+ allow_underscores: e.allow_underscores
49
+ })) {
50
+ if (!e.allow_ip_domain)
51
+ return !1;
52
+ if (!u(t)) {
53
+ if (!t.startsWith("[") || !t.endsWith("]"))
54
+ return !1;
55
+ const r = t.slice(1, -1);
56
+ if (r.length === 0 || !u(r))
57
+ return !1;
58
+ }
59
+ }
60
+ if (e.blacklisted_chars && l.search(new RegExp(`[${e.blacklisted_chars}]+`, "g")) !== -1)
61
+ return !1;
62
+ if (l[0] === '"' && l[l.length - 1] === '"')
63
+ return l = l.slice(1, l.length - 1), e.allow_utf8_local_part ? b.test(l) : p.test(l);
64
+ const c = e.allow_utf8_local_part ? w : h, n = l.split(".");
65
+ for (let r = 0; r < n.length; r++)
66
+ if (!c.test(n[r]))
67
+ return !1;
68
+ return !0;
69
+ }
70
+ export {
71
+ C as default
72
+ };
@@ -0,0 +1,27 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ import u from "lodash/defaults";
3
+ import a from "./util/assertString.js";
4
+ const n = {
5
+ require_tld: !0,
6
+ // 必须包含顶级域名(.com/.cn等)
7
+ allow_underscores: !1,
8
+ // 是否允许下划线 (如 my_site.com)
9
+ allow_trailing_dot: !1,
10
+ // 是否允许结尾的点 (如 www.example.com.)
11
+ allow_numeric_tld: !1,
12
+ // 是否允许纯数字TLD (如 example.123)
13
+ allow_wildcard: !1,
14
+ // 是否允许通配符 (如 *.example.com)
15
+ ignore_max_length: !1
16
+ // 是否忽略每部分63字符限制
17
+ };
18
+ function _(e, l) {
19
+ a(e), l = u(l, n), l.allow_trailing_dot && e[e.length - 1] === "." && (e = e.substring(0, e.length - 1)), l.allow_wildcard === !0 && e.indexOf("*.") === 0 && (e = e.substring(2));
20
+ const t = e.split("."), r = t[t.length - 1];
21
+ return l.require_tld && (t.length < 2 || !l.allow_numeric_tld && !/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(
22
+ r
23
+ ) || /\s/.test(r)) || !l.allow_numeric_tld && /^\d+$/.test(r) ? !1 : t.every((f) => !(f.length > 63 && !l.ignore_max_length || !/^[a-z_\u00a1-\uffff0-9-]+$/i.test(f) || /[\uff01-\uff5e]/.test(f) || /^-|-$/.test(f) || !l.allow_underscores && /_/.test(f)));
24
+ }
25
+ export {
26
+ _ as default
27
+ };
@@ -0,0 +1,10 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ import u from "./util/assertString.js";
3
+ const t = /[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/;
4
+ function r(F) {
5
+ return u(F), t.test(F);
6
+ }
7
+ export {
8
+ r as default,
9
+ t as fullWidth
10
+ };
@@ -0,0 +1,11 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ import r from "./util/assertString.js";
3
+ const t = /^hsla?\(((\+|-)?([0-9]+(\.[0-9]+)?(e(\+|-)?[0-9]+)?|\.[0-9]+(e(\+|-)?[0-9]+)?))(deg|grad|rad|turn)?(,(\+|-)?([0-9]+(\.[0-9]+)?(e(\+|-)?[0-9]+)?|\.[0-9]+(e(\+|-)?[0-9]+)?)%){2}(,((\+|-)?([0-9]+(\.[0-9]+)?(e(\+|-)?[0-9]+)?|\.[0-9]+(e(\+|-)?[0-9]+)?)%?))?\)$/i, a = /^hsla?\(((\+|-)?([0-9]+(\.[0-9]+)?(e(\+|-)?[0-9]+)?|\.[0-9]+(e(\+|-)?[0-9]+)?))(deg|grad|rad|turn)?(\s(\+|-)?([0-9]+(\.[0-9]+)?(e(\+|-)?[0-9]+)?|\.[0-9]+(e(\+|-)?[0-9]+)?)%){2}\s?(\/\s((\+|-)?([0-9]+(\.[0-9]+)?(e(\+|-)?[0-9]+)?|\.[0-9]+(e(\+|-)?[0-9]+)?)%?)\s?)?\)$/i;
4
+ function i(s) {
5
+ r(s);
6
+ const e = s.replace(/\s+/g, " ").replace(/\s?(hsla?\(|\)|,)\s?/gi, "$1");
7
+ return e.includes(",") ? t.test(e) : a.test(e);
8
+ }
9
+ export {
10
+ i as default
11
+ };
@@ -0,0 +1,10 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ import t from "./util/assertString.js";
3
+ const u = /[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/;
4
+ function i(F) {
5
+ return t(F), u.test(F);
6
+ }
7
+ export {
8
+ i as default,
9
+ u as halfWidth
10
+ };
@@ -0,0 +1,23 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ import e from "./util/assertString.js";
3
+ const r = {
4
+ md5: 32,
5
+ md4: 32,
6
+ sha1: 40,
7
+ sha256: 64,
8
+ sha384: 96,
9
+ sha512: 128,
10
+ ripemd128: 32,
11
+ ripemd160: 40,
12
+ tiger128: 32,
13
+ tiger160: 40,
14
+ tiger192: 48,
15
+ crc32: 8,
16
+ crc32b: 8
17
+ };
18
+ function i(s, t) {
19
+ return e(s), new RegExp(`^[a-fA-F0-9]{${r[t]}}$`).test(s);
20
+ }
21
+ export {
22
+ i as default
23
+ };
@@ -0,0 +1,12 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ import o from "lodash/defaults";
3
+ import t from "./util/assertString.js";
4
+ const s = /^#?([0-9A-F]{3}|[0-9A-F]{4}|[0-9A-F]{6}|[0-9A-F]{8})$/i, i = /^#([0-9A-F]{3}|[0-9A-F]{4}|[0-9A-F]{6}|[0-9A-F]{8})$/i, a = {
5
+ require_hashtag: !1
6
+ };
7
+ function x(r, e) {
8
+ return t(r), e = o(e, a), (e.require_hashtag ? i : s).test(r);
9
+ }
10
+ export {
11
+ x as default
12
+ };
@@ -0,0 +1,20 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ import c from "./util/assertString.js";
3
+ const a = /^[0-9]{15}$/, o = /^\d{2}-\d{6}-\d{6}-\d{1}$/;
4
+ function m(e, s) {
5
+ c(e), s = s || {};
6
+ let f = a;
7
+ if (s.allow_hyphens && (f = o), !f.test(e))
8
+ return !1;
9
+ e = e.replace(/-/g, "");
10
+ let n = 0, t = 2;
11
+ const l = 14;
12
+ for (let i = 0; i < l; i++) {
13
+ const u = e.substring(l - i - 1, l - i), r = parseInt(u, 10) * t;
14
+ r >= 10 ? n += r % 10 + 1 : n += r, t === 1 ? t += 1 : t -= 1;
15
+ }
16
+ return (10 - n % 10) % 10 === parseInt(e.substring(14, 15), 10);
17
+ }
18
+ export {
19
+ m as default
20
+ };
package/is/lib/isIP.js ADDED
@@ -0,0 +1,21 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ import a from "lodash/isObject";
3
+ import g from "./util/assertString.js";
4
+ const o = "(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])", t = `(${o}[.]){3}${o}`, i = new RegExp(`^${t}$`), $ = "(?:[0-9a-fA-F]{1,4})", m = new RegExp(
5
+ `^((?:${$}:){7}(?:${$}|:)|(?:${$}:){6}(?:${t}|:${$}|:)|(?:${$}:){5}(?::${t}|(:${$}){1,2}|:)|(?:${$}:){4}(?:(:${$}){0,1}:${t}|(:${$}){1,3}|:)|(?:${$}:){3}(?:(:${$}){0,2}:${t}|(:${$}){1,4}|:)|(?:${$}:){2}(?:(:${$}){0,3}:${t}|(:${$}){1,5}|:)|(?:${$}:){1}(?:(:${$}){0,4}:${t}|(:${$}){1,6}|:)|(?::((?::${$}){0,5}:${t}|(?::${$}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`
6
+ );
7
+ function s(e, n = {}) {
8
+ g(e);
9
+ const r = (a(n) ? n.version : arguments[1]) || "";
10
+ if (r) {
11
+ if (r.toString() === "4")
12
+ return i.test(e);
13
+ if (r.toString() === "6")
14
+ return m.test(e);
15
+ } else
16
+ return s(e, { version: 4 }) || s(e, { version: 6 });
17
+ return !1;
18
+ }
19
+ export {
20
+ s as default
21
+ };
@@ -0,0 +1,25 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ import r from "./isIP.js";
3
+ import l from "./util/assertString.js";
4
+ const f = /^\d{1,3}$/, a = 32, i = 128;
5
+ function b(s, n = "") {
6
+ l(s);
7
+ const t = s.split("/");
8
+ if (t.length !== 2 || !f.test(t[1]) || t[1].length > 1 && t[1].startsWith("0") || !r(t[0], n))
9
+ return !1;
10
+ let e = null;
11
+ switch (String(n)) {
12
+ case "4":
13
+ e = a;
14
+ break;
15
+ case "6":
16
+ e = i;
17
+ break;
18
+ default:
19
+ e = r(t[0], "6") ? i : a;
20
+ }
21
+ return t[1] <= e && t[1] >= 0;
22
+ }
23
+ export {
24
+ b as default
25
+ };
@@ -0,0 +1,190 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ import A from "./util/assertString.js";
3
+ const h = {
4
+ "zh-CN": (t) => {
5
+ const u = [
6
+ "11",
7
+ // 北京
8
+ "12",
9
+ // 天津
10
+ "13",
11
+ // 河北
12
+ "14",
13
+ // 山西
14
+ "15",
15
+ // 内蒙古
16
+ "21",
17
+ // 辽宁
18
+ "22",
19
+ // 吉林
20
+ "23",
21
+ // 黑龙江
22
+ "31",
23
+ // 上海
24
+ "32",
25
+ // 江苏
26
+ "33",
27
+ // 浙江
28
+ "34",
29
+ // 安徽
30
+ "35",
31
+ // 福建
32
+ "36",
33
+ // 江西
34
+ "37",
35
+ // 山东
36
+ "41",
37
+ // 河南
38
+ "42",
39
+ // 湖北
40
+ "43",
41
+ // 湖南
42
+ "44",
43
+ // 广东
44
+ "45",
45
+ // 广西
46
+ "46",
47
+ // 海南
48
+ "50",
49
+ // 重庆
50
+ "51",
51
+ // 四川
52
+ "52",
53
+ // 贵州
54
+ "53",
55
+ // 云南
56
+ "54",
57
+ // 西藏
58
+ "61",
59
+ // 陕西
60
+ "62",
61
+ // 甘肃
62
+ "63",
63
+ // 青海
64
+ "64",
65
+ // 宁夏
66
+ "65",
67
+ // 新疆
68
+ "71",
69
+ // 台湾
70
+ "81",
71
+ // 香港
72
+ "82",
73
+ // 澳门
74
+ "91"
75
+ // 国外
76
+ ], o = [
77
+ "7",
78
+ "9",
79
+ "10",
80
+ "5",
81
+ "8",
82
+ "4",
83
+ "2",
84
+ "1",
85
+ "6",
86
+ "3",
87
+ "7",
88
+ "9",
89
+ "10",
90
+ "5",
91
+ "8",
92
+ "4",
93
+ "2"
94
+ ], s = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"], c = (e) => u.includes(e), n = (e) => {
95
+ const r = parseInt(e.substring(0, 4), 10), i = parseInt(e.substring(4, 6), 10), l = parseInt(e.substring(6), 10), a = new Date(r, i - 1, l);
96
+ return a > /* @__PURE__ */ new Date() ? !1 : a.getFullYear() === r && a.getMonth() === i - 1 && a.getDate() === l;
97
+ }, f = (e) => {
98
+ const r = e.substring(0, 17);
99
+ let i = 0;
100
+ for (let a = 0; a < 17; a++)
101
+ i += parseInt(r.charAt(a), 10) * parseInt(o[a], 10);
102
+ const l = i % 11;
103
+ return s[l];
104
+ }, d = (e) => f(e) === e.charAt(17).toUpperCase(), g = (e) => {
105
+ let r = /^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test(
106
+ e
107
+ );
108
+ if (!r) return !1;
109
+ const i = e.substring(0, 2);
110
+ if (r = c(i), !r) return !1;
111
+ const l = `19${e.substring(6, 12)}`;
112
+ return r = n(l), !!r;
113
+ }, p = (e) => {
114
+ let r = /^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test(
115
+ e
116
+ );
117
+ if (!r) return !1;
118
+ const i = e.substring(0, 2);
119
+ if (r = c(i), !r) return !1;
120
+ const l = e.substring(6, 14);
121
+ return r = n(l), r ? d(e) : !1;
122
+ };
123
+ return ((e) => /^\d{15}|(\d{17}(\d|x|X))$/.test(e) ? e.length === 15 ? g(e) : p(e) : !1)(t);
124
+ },
125
+ "zh-HK": (t) => {
126
+ t = t.trim();
127
+ const u = /^[A-Z]{1,2}[0-9]{6}((\([0-9A]\))|(\[[0-9A]\])|([0-9A]))$/, o = /^[0-9]$/;
128
+ if (t = t.toUpperCase(), !u.test(t)) return !1;
129
+ t = t.replace(/\[|\]|\(|\)/g, ""), t.length === 8 && (t = `3${t}`);
130
+ let s = 0;
131
+ for (let n = 0; n <= 7; n++) {
132
+ let f;
133
+ o.test(t[n]) ? f = t[n] : f = (t[n].charCodeAt(0) - 55) % 11, s += f * (9 - n);
134
+ }
135
+ s %= 11;
136
+ let c;
137
+ return s === 0 ? c = "0" : s === 1 ? c = "A" : c = String(11 - s), c === t[t.length - 1];
138
+ },
139
+ "zh-TW": (t) => {
140
+ const u = {
141
+ A: 10,
142
+ B: 11,
143
+ C: 12,
144
+ D: 13,
145
+ E: 14,
146
+ F: 15,
147
+ G: 16,
148
+ H: 17,
149
+ I: 34,
150
+ J: 18,
151
+ K: 19,
152
+ L: 20,
153
+ M: 21,
154
+ N: 22,
155
+ O: 35,
156
+ P: 23,
157
+ Q: 24,
158
+ R: 25,
159
+ S: 26,
160
+ T: 27,
161
+ U: 28,
162
+ V: 29,
163
+ W: 32,
164
+ X: 30,
165
+ Y: 31,
166
+ Z: 33
167
+ }, o = t.trim().toUpperCase();
168
+ return /^[A-Z][0-9]{9}$/.test(o) ? Array.from(o).reduce((s, c, n) => {
169
+ if (n === 0) {
170
+ const f = u[c];
171
+ return f % 10 * 9 + Math.floor(f / 10);
172
+ }
173
+ return n === 9 ? (10 - s % 10 - Number(c)) % 10 === 0 : s + Number(c) * (9 - n);
174
+ }, 0) : !1;
175
+ }
176
+ };
177
+ function I(t, u) {
178
+ if (A(t), u in h)
179
+ return h[u](t);
180
+ for (const o in h)
181
+ if (Object.prototype.hasOwnProperty.call(h, o)) {
182
+ const s = h[o];
183
+ if (s(t))
184
+ return !0;
185
+ }
186
+ return !1;
187
+ }
188
+ export {
189
+ I as default
190
+ };
@@ -0,0 +1,14 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ import i from "./isBase64.js";
3
+ import o from "./util/assertString.js";
4
+ function f(t) {
5
+ o(t);
6
+ const e = t.split(".");
7
+ return e.length !== 3 ? !1 : e.reduce(
8
+ (r, n) => r && i(n, { urlSafe: !0 }),
9
+ !0
10
+ );
11
+ }
12
+ export {
13
+ f as default
14
+ };
@@ -0,0 +1,9 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ import r from "./util/assertString.js";
3
+ const A = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){4}([0-9a-fA-F]{2})$/, t = /^([0-9a-fA-F]){12}$/, u = /^([0-9a-fA-F]{4}\.){2}([0-9a-fA-F]{4})$/, d = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){6}([0-9a-fA-F]{2})$/, s = /^([0-9a-fA-F]){16}$/, c = /^([0-9a-fA-F]{4}\.){3}([0-9a-fA-F]{4})$/;
4
+ function f(e, a) {
5
+ return r(e), a?.eui && (a.eui = String(a.eui)), a?.no_colons || a?.no_separators ? a.eui === "48" ? t.test(e) : a.eui === "64" ? s.test(e) : t.test(e) || s.test(e) : a?.eui === "48" ? A.test(e) || u.test(e) : a?.eui === "64" ? d.test(e) || c.test(e) : f(e, { eui: "48" }) || f(e, { eui: "64" });
6
+ }
7
+ export {
8
+ f as default
9
+ };
@@ -0,0 +1,9 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ import r from "./util/assertString.js";
3
+ const e = /^[a-f0-9]{32}$/;
4
+ function o(t) {
5
+ return r(t), e.test(t);
6
+ }
7
+ export {
8
+ o as default
9
+ };
@@ -0,0 +1,9 @@
1
+ /* 2025-12-19 15:35:18 */
2
+ import e from "./util/assertString.js";
3
+ const a = /^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9.\-+_]{1,100}$/i, i = /^text\/[a-zA-Z0-9.\-+]{1,100};\s?charset=("[a-zA-Z0-9.\-+\s]{0,70}"|[a-zA-Z0-9.\-+]{0,70})(\s?\([a-zA-Z0-9.\-+\s]{1,20}\))?$/i, s = /^multipart\/[a-zA-Z0-9.\-+]{1,100}(;\s?(boundary|charset)=("[a-zA-Z0-9.\-+\s]{0,70}"|[a-zA-Z0-9.\-+]{0,70})(\s?\([a-zA-Z0-9.\-+\s]{1,20}\))?){0,2}$/i;
4
+ function o(t) {
5
+ return e(t), a.test(t) || i.test(t) || s.test(t);
6
+ }
7
+ export {
8
+ o as default
9
+ };