x4js 1.6.5 → 2.0.2

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 (292) hide show
  1. package/README.md +3 -14
  2. package/lib/README.txt +3 -14
  3. package/lib/esm/x4.css +1 -0
  4. package/lib/esm/x4.js +1 -0
  5. package/lib/src/assets/house-light.svg +1 -0
  6. package/lib/src/assets/radio.svg +4 -0
  7. package/lib/src/components/base.scss +26 -0
  8. package/lib/src/components/boxes/boxes.module.scss +37 -0
  9. package/lib/src/components/boxes/boxes.ts +125 -0
  10. package/lib/src/components/btngroup/btngroup.module.scss +29 -0
  11. package/lib/src/components/btngroup/btngroup.ts +106 -0
  12. package/lib/src/components/button/button.module.scss +154 -0
  13. package/lib/src/components/button/button.ts +117 -0
  14. package/lib/src/components/calendar/calendar-check-sharp-light.svg +1 -0
  15. package/lib/src/components/calendar/calendar.module.scss +163 -0
  16. package/lib/src/{calendar.ts → components/calendar/calendar.ts} +81 -83
  17. package/lib/src/components/calendar/chevron-left-sharp-light.svg +1 -0
  18. package/lib/src/components/calendar/chevron-right-sharp-light.svg +1 -0
  19. package/lib/src/components/checkbox/check.svg +4 -0
  20. package/lib/src/components/checkbox/checkbox.module.scss +142 -0
  21. package/lib/src/components/checkbox/checkbox.ts +125 -0
  22. package/lib/src/components/colorinput/colorinput.module.scss +65 -0
  23. package/lib/src/components/colorinput/colorinput.ts +88 -0
  24. package/lib/src/components/colorinput/crosshairs-simple-sharp-light.svg +1 -0
  25. package/lib/src/components/colorpicker/colorpicker.module.scss +133 -0
  26. package/lib/src/components/colorpicker/colorpicker.ts +477 -0
  27. package/lib/src/components/combobox/combobox.module.scss +121 -0
  28. package/lib/src/components/combobox/combobox.ts +190 -0
  29. package/lib/src/components/combobox/updown.svg +4 -0
  30. package/lib/src/components/dialog/dialog.module.scss +71 -0
  31. package/lib/src/components/dialog/dialog.ts +91 -0
  32. package/lib/src/components/dialog/xmark-sharp-light.svg +1 -0
  33. package/lib/src/components/form/form.module.scss +34 -0
  34. package/lib/src/components/form/form.ts +36 -0
  35. package/lib/src/components/header/header.module.scss +40 -0
  36. package/lib/src/components/header/header.ts +124 -0
  37. package/lib/src/components/icon/icon.module.scss +30 -0
  38. package/lib/src/components/icon/icon.ts +134 -0
  39. package/lib/src/components/image/image.module.scss +21 -0
  40. package/lib/src/components/image/image.ts +67 -0
  41. package/lib/src/components/input/input.module.scss +69 -0
  42. package/lib/src/components/input/input.ts +274 -0
  43. package/lib/src/components/label/label.module.scss +52 -0
  44. package/lib/src/components/label/label.ts +55 -0
  45. package/lib/src/components/listbox/listbox.module.scss +103 -0
  46. package/lib/src/components/listbox/listbox.ts +427 -0
  47. package/lib/src/components/menu/caret-right-solid.svg +1 -0
  48. package/lib/src/components/menu/menu.module.scss +108 -0
  49. package/lib/src/components/menu/menu.ts +168 -0
  50. package/lib/src/components/messages/circle-exclamation.svg +1 -0
  51. package/lib/src/components/messages/messages.module.scss +47 -0
  52. package/lib/src/components/messages/messages.ts +64 -0
  53. package/lib/src/components/normalize.scss +386 -0
  54. package/lib/src/components/notification/circle-check-solid.svg +1 -0
  55. package/lib/src/components/notification/circle-exclamation-solid.svg +1 -0
  56. package/lib/src/components/notification/circle-notch-light.svg +1 -0
  57. package/lib/src/components/notification/notification.module.scss +82 -0
  58. package/lib/src/components/notification/notification.ts +108 -0
  59. package/lib/src/components/notification/xmark-sharp-light.svg +1 -0
  60. package/lib/src/components/panel/panel.module.scss +48 -0
  61. package/lib/src/components/panel/panel.ts +57 -0
  62. package/lib/src/components/popup/popup.module.scss +43 -0
  63. package/lib/src/components/popup/popup.ts +395 -0
  64. package/lib/src/components/progress/progress.module.scss +57 -0
  65. package/lib/src/components/progress/progress.ts +43 -0
  66. package/lib/src/components/rating/rating.module.scss +23 -0
  67. package/lib/src/components/rating/rating.ts +125 -0
  68. package/lib/src/components/rating/star-sharp-light.svg +1 -0
  69. package/lib/src/components/rating/star-sharp-solid.svg +1 -0
  70. package/lib/src/components/shared.scss +76 -0
  71. package/lib/src/components/sizers/sizer.module.scss +90 -0
  72. package/lib/src/components/sizers/sizer.ts +120 -0
  73. package/lib/src/components/slider/slider.module.scss +71 -0
  74. package/lib/src/components/slider/slider.ts +143 -0
  75. package/lib/src/components/switch/switch.module.scss +127 -0
  76. package/lib/src/components/switch/switch.ts +56 -0
  77. package/lib/src/components/tabs/tabs.module.scss +46 -0
  78. package/lib/src/components/tabs/tabs.ts +157 -0
  79. package/lib/src/components/textarea/textarea.module.scss +59 -0
  80. package/lib/src/components/textarea/textarea.ts +54 -0
  81. package/lib/src/components/textedit/textedit.module.scss +114 -0
  82. package/lib/src/components/textedit/textedit.ts +82 -0
  83. package/lib/src/components/themes.scss +77 -0
  84. package/lib/src/components/tooltips/circle-info-sharp-light.svg +1 -0
  85. package/lib/src/components/tooltips/tooltips.scss +51 -0
  86. package/lib/src/components/tooltips/tooltips.ts +103 -0
  87. package/lib/src/components/treeview/chevron-down-light.svg +1 -0
  88. package/lib/src/components/treeview/treeview.module.scss +116 -0
  89. package/lib/src/components/treeview/treeview.ts +403 -0
  90. package/lib/src/components/viewport/viewport.module.scss +25 -0
  91. package/lib/src/components/viewport/viewport.ts +38 -0
  92. package/lib/src/core/component.ts +979 -0
  93. package/lib/src/core/core_colors.ts +250 -0
  94. package/lib/src/{dom_events.ts → core/core_dom.ts} +195 -39
  95. package/lib/src/{drag_manager.ts → core/core_dragdrop.ts} +29 -44
  96. package/lib/src/core/core_element.ts +98 -0
  97. package/lib/src/core/core_events.ts +149 -0
  98. package/lib/src/{i18n.ts → core/core_i18n.ts} +43 -42
  99. package/lib/src/{router.ts → core/core_router.ts} +27 -40
  100. package/lib/src/core/core_styles.ts +215 -0
  101. package/lib/src/core/core_svg.ts +550 -0
  102. package/lib/src/core/core_tools.ts +673 -0
  103. package/lib/src/demo/assets/house-light.svg +1 -0
  104. package/lib/src/demo/assets/radio.svg +4 -0
  105. package/lib/src/demo/index.html +12 -0
  106. package/lib/src/demo/main.scss +21 -0
  107. package/lib/src/demo/main.tsx +323 -0
  108. package/lib/src/main.scss +21 -0
  109. package/lib/src/main.tsx +323 -0
  110. package/lib/src/x4.scss +19 -0
  111. package/lib/src/x4.ts +60 -0
  112. package/lib/types/x4.d.ts +26548 -0
  113. package/package.json +68 -59
  114. package/scripts/build.mjs +351 -0
  115. package/scripts/prepack.mjs +43 -0
  116. package/src/components/base.scss +26 -0
  117. package/src/components/boxes/boxes.module.scss +37 -0
  118. package/src/components/boxes/boxes.ts +125 -0
  119. package/src/components/btngroup/btngroup.module.scss +29 -0
  120. package/src/components/btngroup/btngroup.ts +106 -0
  121. package/src/components/button/button.module.scss +154 -0
  122. package/src/components/button/button.ts +117 -0
  123. package/src/components/calendar/calendar-check-sharp-light.svg +1 -0
  124. package/src/components/calendar/calendar.module.scss +163 -0
  125. package/src/components/calendar/calendar.ts +326 -0
  126. package/src/components/calendar/chevron-left-sharp-light.svg +1 -0
  127. package/src/components/calendar/chevron-right-sharp-light.svg +1 -0
  128. package/src/components/checkbox/check.svg +4 -0
  129. package/src/components/checkbox/checkbox.module.scss +142 -0
  130. package/src/components/checkbox/checkbox.ts +125 -0
  131. package/src/components/colorinput/colorinput.module.scss +65 -0
  132. package/src/components/colorinput/colorinput.ts +88 -0
  133. package/src/components/colorinput/crosshairs-simple-sharp-light.svg +1 -0
  134. package/src/components/colorpicker/colorpicker.module.scss +133 -0
  135. package/src/components/colorpicker/colorpicker.ts +477 -0
  136. package/src/components/combobox/combobox.module.scss +121 -0
  137. package/src/components/combobox/combobox.ts +190 -0
  138. package/src/components/combobox/updown.svg +4 -0
  139. package/src/components/dialog/dialog.module.scss +71 -0
  140. package/src/components/dialog/dialog.ts +91 -0
  141. package/src/components/dialog/xmark-sharp-light.svg +1 -0
  142. package/src/components/form/form.module.scss +34 -0
  143. package/src/components/form/form.ts +36 -0
  144. package/src/components/header/header.module.scss +40 -0
  145. package/src/components/header/header.ts +124 -0
  146. package/src/components/icon/icon.module.scss +30 -0
  147. package/src/components/icon/icon.ts +134 -0
  148. package/src/components/image/image.module.scss +21 -0
  149. package/src/components/image/image.ts +67 -0
  150. package/src/components/input/input.module.scss +69 -0
  151. package/src/components/input/input.ts +274 -0
  152. package/src/components/label/label.module.scss +52 -0
  153. package/src/components/label/label.ts +55 -0
  154. package/src/components/listbox/listbox.module.scss +103 -0
  155. package/src/components/listbox/listbox.ts +427 -0
  156. package/src/components/menu/caret-right-solid.svg +1 -0
  157. package/src/components/menu/menu.module.scss +108 -0
  158. package/src/components/menu/menu.ts +168 -0
  159. package/src/components/messages/circle-exclamation.svg +1 -0
  160. package/src/components/messages/messages.module.scss +47 -0
  161. package/src/components/messages/messages.ts +64 -0
  162. package/src/components/normalize.scss +386 -0
  163. package/src/components/notification/circle-check-solid.svg +1 -0
  164. package/src/components/notification/circle-exclamation-solid.svg +1 -0
  165. package/src/components/notification/circle-notch-light.svg +1 -0
  166. package/src/components/notification/notification.module.scss +82 -0
  167. package/src/components/notification/notification.ts +108 -0
  168. package/src/components/notification/xmark-sharp-light.svg +1 -0
  169. package/src/components/panel/panel.module.scss +48 -0
  170. package/src/components/panel/panel.ts +57 -0
  171. package/src/components/popup/popup.module.scss +43 -0
  172. package/src/components/popup/popup.ts +395 -0
  173. package/src/components/progress/progress.module.scss +57 -0
  174. package/src/components/progress/progress.ts +43 -0
  175. package/src/components/rating/rating.module.scss +23 -0
  176. package/src/components/rating/rating.ts +125 -0
  177. package/src/components/rating/star-sharp-light.svg +1 -0
  178. package/src/components/rating/star-sharp-solid.svg +1 -0
  179. package/src/components/shared.scss +76 -0
  180. package/src/components/sizers/sizer.module.scss +90 -0
  181. package/src/components/sizers/sizer.ts +120 -0
  182. package/src/components/slider/slider.module.scss +71 -0
  183. package/src/components/slider/slider.ts +143 -0
  184. package/src/components/switch/switch.module.scss +127 -0
  185. package/src/components/switch/switch.ts +56 -0
  186. package/src/components/tabs/tabs.module.scss +46 -0
  187. package/src/components/tabs/tabs.ts +157 -0
  188. package/src/components/textarea/textarea.module.scss +59 -0
  189. package/src/components/textarea/textarea.ts +54 -0
  190. package/src/components/textedit/textedit.module.scss +114 -0
  191. package/src/components/textedit/textedit.ts +82 -0
  192. package/src/components/themes.scss +77 -0
  193. package/src/components/tooltips/circle-info-sharp-light.svg +1 -0
  194. package/src/components/tooltips/tooltips.scss +51 -0
  195. package/src/components/tooltips/tooltips.ts +103 -0
  196. package/src/components/treeview/chevron-down-light.svg +1 -0
  197. package/src/components/treeview/treeview.module.scss +116 -0
  198. package/src/components/treeview/treeview.ts +403 -0
  199. package/src/components/viewport/viewport.module.scss +25 -0
  200. package/src/components/viewport/viewport.ts +38 -0
  201. package/src/core/component.ts +979 -0
  202. package/src/core/core_colors.ts +250 -0
  203. package/src/core/core_dom.ts +471 -0
  204. package/src/core/core_dragdrop.ts +201 -0
  205. package/src/core/core_element.ts +98 -0
  206. package/src/core/core_events.ts +149 -0
  207. package/src/core/core_i18n.ts +377 -0
  208. package/src/core/core_router.ts +221 -0
  209. package/src/core/core_styles.ts +215 -0
  210. package/src/core/core_svg.ts +550 -0
  211. package/src/core/core_tools.ts +673 -0
  212. package/src/demo/assets/house-light.svg +1 -0
  213. package/src/demo/assets/radio.svg +4 -0
  214. package/src/demo/index.html +12 -0
  215. package/src/demo/main.scss +21 -0
  216. package/src/demo/main.tsx +323 -0
  217. package/src/x4.scss +19 -0
  218. package/src/x4.ts +60 -0
  219. package/tsconfig.json +14 -0
  220. package/types/scss.d.ts +4 -0
  221. package/types/svg.d.ts +4 -0
  222. package/types/x4react.d.ts +9 -0
  223. package/lib/changelog.txt +0 -23
  224. package/lib/cjs/x4js.js +0 -39
  225. package/lib/cjs/x4js.js.map +0 -7
  226. package/lib/esm/x4js.mjs +0 -15972
  227. package/lib/esm/x4js.mjs.map +0 -7
  228. package/lib/licence.md +0 -21
  229. package/lib/src/MIT-license.md +0 -14
  230. package/lib/src/action.ts +0 -88
  231. package/lib/src/alpha.jpg +0 -0
  232. package/lib/src/app_sockets.ts +0 -81
  233. package/lib/src/application.ts +0 -262
  234. package/lib/src/autocomplete.ts +0 -232
  235. package/lib/src/base64.ts +0 -166
  236. package/lib/src/base_component.ts +0 -152
  237. package/lib/src/button.ts +0 -355
  238. package/lib/src/canvas.ts +0 -510
  239. package/lib/src/cardview.ts +0 -228
  240. package/lib/src/checkbox.ts +0 -188
  241. package/lib/src/color.ts +0 -752
  242. package/lib/src/colorpicker.ts +0 -1649
  243. package/lib/src/combobox.ts +0 -512
  244. package/lib/src/component.ts +0 -2367
  245. package/lib/src/copyright.txt +0 -27
  246. package/lib/src/datastore.ts +0 -1302
  247. package/lib/src/dialog.ts +0 -656
  248. package/lib/src/drawtext.ts +0 -355
  249. package/lib/src/fileupload.ts +0 -213
  250. package/lib/src/form.ts +0 -413
  251. package/lib/src/formatters.ts +0 -105
  252. package/lib/src/gridview.ts +0 -1185
  253. package/lib/src/icon.ts +0 -362
  254. package/lib/src/image.ts +0 -225
  255. package/lib/src/index.ts +0 -89
  256. package/lib/src/input.ts +0 -297
  257. package/lib/src/label.ts +0 -153
  258. package/lib/src/layout.ts +0 -442
  259. package/lib/src/link.ts +0 -86
  260. package/lib/src/listview.ts +0 -765
  261. package/lib/src/md5.ts +0 -438
  262. package/lib/src/menu.ts +0 -425
  263. package/lib/src/messagebox.ts +0 -224
  264. package/lib/src/panel.ts +0 -86
  265. package/lib/src/popup.ts +0 -494
  266. package/lib/src/property_editor.ts +0 -337
  267. package/lib/src/radiobtn.ts +0 -197
  268. package/lib/src/rating.ts +0 -135
  269. package/lib/src/request.ts +0 -300
  270. package/lib/src/settings.ts +0 -77
  271. package/lib/src/sidebarview.ts +0 -108
  272. package/lib/src/spreadsheet.ts +0 -1449
  273. package/lib/src/styles.ts +0 -343
  274. package/lib/src/svgcomponent.ts +0 -592
  275. package/lib/src/tabbar.ts +0 -151
  276. package/lib/src/tabview.ts +0 -110
  277. package/lib/src/textarea.ts +0 -235
  278. package/lib/src/textedit.ts +0 -533
  279. package/lib/src/toaster.ts +0 -80
  280. package/lib/src/tools.ts +0 -1473
  281. package/lib/src/tooltips.ts +0 -191
  282. package/lib/src/treeview.ts +0 -716
  283. package/lib/src/version.ts +0 -30
  284. package/lib/src/x4.less +0 -2242
  285. package/lib/src/x4dom.ts +0 -57
  286. package/lib/src/x4events.ts +0 -585
  287. package/lib/src/x4js.ts +0 -89
  288. package/lib/src/x4react.ts +0 -90
  289. package/lib/styles/x4.css +0 -1785
  290. package/lib/styles/x4.less +0 -2242
  291. package/lib/types/x4js.d.ts +0 -6728
  292. package/license.md +0 -21
package/lib/src/md5.ts DELETED
@@ -1,438 +0,0 @@
1
- /**
2
- * ___ ___ __
3
- * \ \_/ / / _
4
- * \ / /_| |_
5
- * / _ \____ _|
6
- * /__/ \__\ |_|
7
- *
8
- * @file md5.ts
9
- * @author Etienne Cochard
10
- * @license
11
- *
12
- * Copyright (c) 2019-2023 R-libre ingenierie
13
- *
14
- * Permission is hereby granted, free of charge, to any person obtaining a copy
15
- * of this software and associated documentation files (the "Software"), to deal
16
- * in the Software without restriction, including without limitation the rights
17
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
18
- * of the Software, and to permit persons to whom the Software is furnished to do so,
19
- * subject to the following conditions:
20
- * The above copyright notice and this permission notice shall be included in all copies
21
- * or substantial portions of the Software.
22
- *
23
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
24
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
25
- * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
- **/
30
-
31
- /*
32
- TypeScript Md5
33
- ==============
34
- Based on work by
35
- * Joseph Myers: http://www.myersdaily.org/joseph/javascript/md5-text.html
36
- * André Cruz: https://github.com/satazor/SparkMD5
37
- * Raymond Hill: https://github.com/gorhill/yamd5.js
38
- Effectively a TypeScrypt re-write of Raymond Hill JS Library
39
- The MIT License (MIT)
40
- Copyright (C) 2014 Raymond Hill
41
- Permission is hereby granted, free of charge, to any person obtaining a copy
42
- of this software and associated documentation files (the "Software"), to deal
43
- in the Software without restriction, including without limitation the rights
44
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
45
- copies of the Software, and to permit persons to whom the Software is
46
- furnished to do so, subject to the following conditions:
47
- The above copyright notice and this permission notice shall be included in
48
- all copies or substantial portions of the Software.
49
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
52
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
55
- THE SOFTWARE.
56
- */
57
-
58
- export class Md5 {
59
-
60
- // One time hashing functions
61
- public static hashStr(str: string, raw?: false): string
62
- public static hashStr(str: string, raw?: true): Int32Array
63
- public static hashStr(str: string, raw: boolean = false) {
64
- return this.onePassHasher
65
- .start()
66
- .appendStr(str)
67
- .end(raw);
68
- }
69
-
70
- public static hashAsciiStr(str: string, raw?: false): string
71
- public static hashAsciiStr(str: string, raw?: true): Int32Array
72
- public static hashAsciiStr(str: string, raw: boolean = false) {
73
- return this.onePassHasher
74
- .start()
75
- .appendAsciiStr(str)
76
- .end(raw);
77
- }
78
- // Private Static Variables
79
- private static stateIdentity = new Int32Array([1732584193, -271733879, -1732584194, 271733878]);
80
- private static buffer32Identity = new Int32Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
81
- private static hexChars = '0123456789abcdef';
82
- private static hexOut: string[] = [];
83
-
84
- // Permanent instance is to use for one-call hashing
85
- private static onePassHasher = new Md5();
86
-
87
- private static _hex(x: any): string {
88
- const hc = Md5.hexChars;
89
- const ho = Md5.hexOut;
90
- let n;
91
- let offset;
92
- let j;
93
- let i;
94
-
95
- for (i = 0; i < 4; i += 1) {
96
- offset = i * 8;
97
- n = x[i];
98
- for (j = 0; j < 8; j += 2) {
99
- ho[offset + 1 + j] = hc.charAt(n & 0x0F);
100
- n >>>= 4;
101
- ho[offset + 0 + j] = hc.charAt(n & 0x0F);
102
- n >>>= 4;
103
- }
104
- }
105
- return ho.join('');
106
- }
107
-
108
- private static _md5cycle(x: Int32Array|Uint32Array, k: Int32Array|Uint32Array) {
109
- let a = x[0];
110
- let b = x[1];
111
- let c = x[2];
112
- let d = x[3];
113
- // ff()
114
- a += (b & c | ~b & d) + k[0] - 680876936 | 0;
115
- a = (a << 7 | a >>> 25) + b | 0;
116
- d += (a & b | ~a & c) + k[1] - 389564586 | 0;
117
- d = (d << 12 | d >>> 20) + a | 0;
118
- c += (d & a | ~d & b) + k[2] + 606105819 | 0;
119
- c = (c << 17 | c >>> 15) + d | 0;
120
- b += (c & d | ~c & a) + k[3] - 1044525330 | 0;
121
- b = (b << 22 | b >>> 10) + c | 0;
122
- a += (b & c | ~b & d) + k[4] - 176418897 | 0;
123
- a = (a << 7 | a >>> 25) + b | 0;
124
- d += (a & b | ~a & c) + k[5] + 1200080426 | 0;
125
- d = (d << 12 | d >>> 20) + a | 0;
126
- c += (d & a | ~d & b) + k[6] - 1473231341 | 0;
127
- c = (c << 17 | c >>> 15) + d | 0;
128
- b += (c & d | ~c & a) + k[7] - 45705983 | 0;
129
- b = (b << 22 | b >>> 10) + c | 0;
130
- a += (b & c | ~b & d) + k[8] + 1770035416 | 0;
131
- a = (a << 7 | a >>> 25) + b | 0;
132
- d += (a & b | ~a & c) + k[9] - 1958414417 | 0;
133
- d = (d << 12 | d >>> 20) + a | 0;
134
- c += (d & a | ~d & b) + k[10] - 42063 | 0;
135
- c = (c << 17 | c >>> 15) + d | 0;
136
- b += (c & d | ~c & a) + k[11] - 1990404162 | 0;
137
- b = (b << 22 | b >>> 10) + c | 0;
138
- a += (b & c | ~b & d) + k[12] + 1804603682 | 0;
139
- a = (a << 7 | a >>> 25) + b | 0;
140
- d += (a & b | ~a & c) + k[13] - 40341101 | 0;
141
- d = (d << 12 | d >>> 20) + a | 0;
142
- c += (d & a | ~d & b) + k[14] - 1502002290 | 0;
143
- c = (c << 17 | c >>> 15) + d | 0;
144
- b += (c & d | ~c & a) + k[15] + 1236535329 | 0;
145
- b = (b << 22 | b >>> 10) + c | 0;
146
- // gg()
147
- a += (b & d | c & ~d) + k[1] - 165796510 | 0;
148
- a = (a << 5 | a >>> 27) + b | 0;
149
- d += (a & c | b & ~c) + k[6] - 1069501632 | 0;
150
- d = (d << 9 | d >>> 23) + a | 0;
151
- c += (d & b | a & ~b) + k[11] + 643717713 | 0;
152
- c = (c << 14 | c >>> 18) + d | 0;
153
- b += (c & a | d & ~a) + k[0] - 373897302 | 0;
154
- b = (b << 20 | b >>> 12) + c | 0;
155
- a += (b & d | c & ~d) + k[5] - 701558691 | 0;
156
- a = (a << 5 | a >>> 27) + b | 0;
157
- d += (a & c | b & ~c) + k[10] + 38016083 | 0;
158
- d = (d << 9 | d >>> 23) + a | 0;
159
- c += (d & b | a & ~b) + k[15] - 660478335 | 0;
160
- c = (c << 14 | c >>> 18) + d | 0;
161
- b += (c & a | d & ~a) + k[4] - 405537848 | 0;
162
- b = (b << 20 | b >>> 12) + c | 0;
163
- a += (b & d | c & ~d) + k[9] + 568446438 | 0;
164
- a = (a << 5 | a >>> 27) + b | 0;
165
- d += (a & c | b & ~c) + k[14] - 1019803690 | 0;
166
- d = (d << 9 | d >>> 23) + a | 0;
167
- c += (d & b | a & ~b) + k[3] - 187363961 | 0;
168
- c = (c << 14 | c >>> 18) + d | 0;
169
- b += (c & a | d & ~a) + k[8] + 1163531501 | 0;
170
- b = (b << 20 | b >>> 12) + c | 0;
171
- a += (b & d | c & ~d) + k[13] - 1444681467 | 0;
172
- a = (a << 5 | a >>> 27) + b | 0;
173
- d += (a & c | b & ~c) + k[2] - 51403784 | 0;
174
- d = (d << 9 | d >>> 23) + a | 0;
175
- c += (d & b | a & ~b) + k[7] + 1735328473 | 0;
176
- c = (c << 14 | c >>> 18) + d | 0;
177
- b += (c & a | d & ~a) + k[12] - 1926607734 | 0;
178
- b = (b << 20 | b >>> 12) + c | 0;
179
- // hh()
180
- a += (b ^ c ^ d) + k[5] - 378558 | 0;
181
- a = (a << 4 | a >>> 28) + b | 0;
182
- d += (a ^ b ^ c) + k[8] - 2022574463 | 0;
183
- d = (d << 11 | d >>> 21) + a | 0;
184
- c += (d ^ a ^ b) + k[11] + 1839030562 | 0;
185
- c = (c << 16 | c >>> 16) + d | 0;
186
- b += (c ^ d ^ a) + k[14] - 35309556 | 0;
187
- b = (b << 23 | b >>> 9) + c | 0;
188
- a += (b ^ c ^ d) + k[1] - 1530992060 | 0;
189
- a = (a << 4 | a >>> 28) + b | 0;
190
- d += (a ^ b ^ c) + k[4] + 1272893353 | 0;
191
- d = (d << 11 | d >>> 21) + a | 0;
192
- c += (d ^ a ^ b) + k[7] - 155497632 | 0;
193
- c = (c << 16 | c >>> 16) + d | 0;
194
- b += (c ^ d ^ a) + k[10] - 1094730640 | 0;
195
- b = (b << 23 | b >>> 9) + c | 0;
196
- a += (b ^ c ^ d) + k[13] + 681279174 | 0;
197
- a = (a << 4 | a >>> 28) + b | 0;
198
- d += (a ^ b ^ c) + k[0] - 358537222 | 0;
199
- d = (d << 11 | d >>> 21) + a | 0;
200
- c += (d ^ a ^ b) + k[3] - 722521979 | 0;
201
- c = (c << 16 | c >>> 16) + d | 0;
202
- b += (c ^ d ^ a) + k[6] + 76029189 | 0;
203
- b = (b << 23 | b >>> 9) + c | 0;
204
- a += (b ^ c ^ d) + k[9] - 640364487 | 0;
205
- a = (a << 4 | a >>> 28) + b | 0;
206
- d += (a ^ b ^ c) + k[12] - 421815835 | 0;
207
- d = (d << 11 | d >>> 21) + a | 0;
208
- c += (d ^ a ^ b) + k[15] + 530742520 | 0;
209
- c = (c << 16 | c >>> 16) + d | 0;
210
- b += (c ^ d ^ a) + k[2] - 995338651 | 0;
211
- b = (b << 23 | b >>> 9) + c | 0;
212
- // ii()
213
- a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;
214
- a = (a << 6 | a >>> 26) + b | 0;
215
- d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;
216
- d = (d << 10 | d >>> 22) + a | 0;
217
- c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;
218
- c = (c << 15 | c >>> 17) + d | 0;
219
- b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;
220
- b = (b << 21 | b >>> 11) + c | 0;
221
- a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;
222
- a = (a << 6 | a >>> 26) + b | 0;
223
- d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;
224
- d = (d << 10 | d >>> 22) + a | 0;
225
- c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;
226
- c = (c << 15 | c >>> 17) + d | 0;
227
- b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;
228
- b = (b << 21 | b >>> 11) + c | 0;
229
- a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;
230
- a = (a << 6 | a >>> 26) + b | 0;
231
- d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;
232
- d = (d << 10 | d >>> 22) + a | 0;
233
- c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;
234
- c = (c << 15 | c >>> 17) + d | 0;
235
- b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;
236
- b = (b << 21 | b >>> 11) + c | 0;
237
- a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;
238
- a = (a << 6 | a >>> 26) + b | 0;
239
- d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;
240
- d = (d << 10 | d >>> 22) + a | 0;
241
- c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;
242
- c = (c << 15 | c >>> 17) + d | 0;
243
- b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;
244
- b = (b << 21 | b >>> 11) + c | 0;
245
-
246
- x[0] = a + x[0] | 0;
247
- x[1] = b + x[1] | 0;
248
- x[2] = c + x[2] | 0;
249
- x[3] = d + x[3] | 0;
250
- }
251
-
252
- private _dataLength: number;
253
- private _bufferLength: number;
254
-
255
- private _state: Int32Array = new Int32Array(4);
256
- private _buffer: ArrayBuffer = new ArrayBuffer(68);
257
- private _buffer8: Uint8Array;
258
- private _buffer32: Uint32Array;
259
-
260
- constructor() {
261
- this._buffer8 = new Uint8Array(this._buffer, 0, 68);
262
- this._buffer32 = new Uint32Array(this._buffer, 0, 17);
263
- this.start();
264
- }
265
-
266
- public start() {
267
- this._dataLength = 0;
268
- this._bufferLength = 0;
269
- this._state.set(Md5.stateIdentity);
270
- return this;
271
- }
272
-
273
- // Char to code point to to array conversion:
274
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt
275
- // #Example.3A_Fixing_charCodeAt_to_handle_non-Basic-Multilingual-Plane_characters_if_their_presence_earlier_in_the_string_is_unknown
276
- public appendStr(str: string) {
277
- const buf8 = this._buffer8;
278
- const buf32 = this._buffer32;
279
- let bufLen = this._bufferLength;
280
- let code;
281
- let i;
282
-
283
- for (i = 0; i < str.length; i += 1) {
284
- code = str.charCodeAt(i);
285
- if (code < 128) {
286
- buf8[bufLen++] = code;
287
- } else if (code < 0x800) {
288
- buf8[bufLen++] = (code >>> 6) + 0xC0;
289
- buf8[bufLen++] = code & 0x3F | 0x80;
290
- } else if (code < 0xD800 || code > 0xDBFF) {
291
- buf8[bufLen++] = (code >>> 12) + 0xE0;
292
- buf8[bufLen++] = (code >>> 6 & 0x3F) | 0x80;
293
- buf8[bufLen++] = (code & 0x3F) | 0x80;
294
- } else {
295
- code = ((code - 0xD800) * 0x400) + (str.charCodeAt(++i) - 0xDC00) + 0x10000;
296
- if (code > 0x10FFFF) {
297
- throw new Error('Unicode standard supports code points up to U+10FFFF');
298
- }
299
- buf8[bufLen++] = (code >>> 18) + 0xF0;
300
- buf8[bufLen++] = (code >>> 12 & 0x3F) | 0x80;
301
- buf8[bufLen++] = (code >>> 6 & 0x3F) | 0x80;
302
- buf8[bufLen++] = (code & 0x3F) | 0x80;
303
- }
304
- if (bufLen >= 64) {
305
- this._dataLength += 64;
306
- Md5._md5cycle(this._state, buf32);
307
- bufLen -= 64;
308
- buf32[0] = buf32[16];
309
- }
310
- }
311
- this._bufferLength = bufLen;
312
- return this;
313
- }
314
-
315
- public appendAsciiStr(str: string) {
316
- const buf8 = this._buffer8;
317
- const buf32 = this._buffer32;
318
- let bufLen = this._bufferLength;
319
- let i;
320
- let j = 0;
321
-
322
- for (; ;) {
323
- i = Math.min(str.length - j, 64 - bufLen);
324
- while (i--) {
325
- buf8[bufLen++] = str.charCodeAt(j++);
326
- }
327
- if (bufLen < 64) {
328
- break;
329
- }
330
- this._dataLength += 64;
331
- Md5._md5cycle(this._state, buf32);
332
- bufLen = 0;
333
- }
334
- this._bufferLength = bufLen;
335
- return this;
336
- }
337
-
338
- public appendByteArray(input: Uint8Array) {
339
- const buf8 = this._buffer8;
340
- const buf32 = this._buffer32;
341
- let bufLen = this._bufferLength;
342
- let i;
343
- let j = 0;
344
-
345
- for (; ;) {
346
- i = Math.min(input.length - j, 64 - bufLen);
347
- while (i--) {
348
- buf8[bufLen++] = input[j++];
349
- }
350
- if (bufLen < 64) {
351
- break;
352
- }
353
- this._dataLength += 64;
354
- Md5._md5cycle(this._state, buf32);
355
- bufLen = 0;
356
- }
357
- this._bufferLength = bufLen;
358
- return this;
359
- }
360
-
361
- public getState() {
362
- const self = this;
363
- const s = self._state;
364
-
365
- return {
366
- //@ts-ignore
367
- buffer: String.fromCharCode.apply(null, self._buffer8),
368
- buflen: self._bufferLength,
369
- length: self._dataLength,
370
- state: [s[0], s[1], s[2], s[3]]
371
- };
372
- }
373
-
374
- public setState(state: any) {
375
- const buf = state.buffer;
376
- const x = state.state;
377
- const s = this._state;
378
- let i;
379
-
380
- this._dataLength = state.length;
381
- this._bufferLength = state.buflen;
382
- s[0] = x[0];
383
- s[1] = x[1];
384
- s[2] = x[2];
385
- s[3] = x[3];
386
-
387
- for (i = 0; i < buf.length; i += 1) {
388
- this._buffer8[i] = buf.charCodeAt(i);
389
- }
390
- }
391
-
392
- public end(raw: boolean = false) {
393
- const bufLen = this._bufferLength;
394
- const buf8 = this._buffer8;
395
- const buf32 = this._buffer32;
396
- const i = (bufLen >> 2) + 1;
397
- let dataBitsLen;
398
-
399
- this._dataLength += bufLen;
400
-
401
- buf8[bufLen] = 0x80;
402
- buf8[bufLen + 1] = buf8[bufLen + 2] = buf8[bufLen + 3] = 0;
403
- buf32.set(Md5.buffer32Identity.subarray(i), i);
404
-
405
- if (bufLen > 55) {
406
- Md5._md5cycle(this._state, buf32);
407
- buf32.set(Md5.buffer32Identity);
408
- }
409
-
410
- // Do the final computation based on the tail and length
411
- // Beware that the final length may not fit in 32 bits so we take care of that
412
- dataBitsLen = this._dataLength * 8;
413
- if (dataBitsLen <= 0xFFFFFFFF) {
414
- buf32[14] = dataBitsLen;
415
- } else {
416
- const matches = dataBitsLen.toString(16).match(/(.*?)(.{0,8})$/);
417
- if (matches === null) {
418
- return;
419
- }
420
-
421
- const lo = parseInt(matches[2], 16);
422
- const hi = parseInt(matches[1], 16) || 0;
423
-
424
- buf32[14] = lo;
425
- buf32[15] = hi;
426
- }
427
-
428
- Md5._md5cycle(this._state, buf32);
429
-
430
- return raw ? this._state : Md5._hex(this._state);
431
- }
432
- }
433
-
434
- /*
435
- if (Md5.hashStr('hello') !== '5d41402abc4b2a76b9719d911017c592') {
436
- console.error('Md5 self test failed.');
437
- }
438
- */