ranuts 0.1.0-alpha.11 → 0.1.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/index.d.ts +5 -3
  2. package/dist/index.js +25 -16
  3. package/dist/{mimeType-Clvz2Teb.js → mimeType-eRf1TlBb.js} +4 -9
  4. package/dist/{reactify-C4cesbXi.js → reactify-Z-V9Vblb.js} +3 -8
  5. package/dist/{ml.js → src/ml/index.js} +19 -24
  6. package/dist/src/node/body.d.ts +0 -1
  7. package/dist/src/node/command.d.ts +0 -1
  8. package/dist/src/node/ctx2req.d.ts +0 -1
  9. package/dist/src/node/fs.d.ts +0 -2
  10. package/dist/src/node/index.d.ts +3 -2
  11. package/dist/src/node/index.js +54 -0
  12. package/dist/src/node/paresUrl.d.ts +0 -1
  13. package/dist/src/node/readFile.d.ts +0 -1
  14. package/dist/src/node/server.d.ts +0 -1
  15. package/dist/src/node/stream.d.ts +0 -1
  16. package/dist/src/node/traverse.d.ts +0 -1
  17. package/dist/src/node/watchFile.d.ts +1 -1
  18. package/dist/src/node/websocket.d.ts +2 -6
  19. package/dist/src/node/ws.d.ts +0 -1
  20. package/dist/src/optimize/index.d.ts +3 -3
  21. package/dist/src/react/index.js +4 -0
  22. package/dist/src/utils/behavior.d.ts +1 -1
  23. package/dist/src/utils/bom.d.ts +7 -7
  24. package/dist/src/utils/device.d.ts +9 -3
  25. package/dist/src/utils/dom.d.ts +87 -2
  26. package/dist/src/utils/img.d.ts +1 -1
  27. package/dist/src/utils/index.d.ts +8 -4
  28. package/dist/src/utils/index.js +4021 -0
  29. package/dist/src/utils/number.d.ts +1 -1
  30. package/dist/src/utils/obj.d.ts +10 -3
  31. package/dist/src/utils/storage.d.ts +2 -0
  32. package/dist/src/utils/subscribe.d.ts +34 -4
  33. package/dist/src/utils/totp/sha/common.d.ts +151 -0
  34. package/dist/src/utils/totp/sha/converters.d.ts +88 -0
  35. package/dist/src/utils/totp/sha/custom_types.d.ts +60 -0
  36. package/dist/src/utils/totp/sha/primitives_32.d.ts +98 -0
  37. package/dist/src/utils/totp/sha/primitives_64.d.ts +116 -0
  38. package/dist/src/utils/totp/sha/sha.d.ts +103 -0
  39. package/dist/src/utils/totp/sha/sha1.d.ts +18 -0
  40. package/dist/src/utils/totp/sha/sha256.d.ts +20 -0
  41. package/dist/src/utils/totp/sha/sha3.d.ts +53 -0
  42. package/dist/src/utils/totp/sha/sha512.d.ts +21 -0
  43. package/dist/src/utils/totp/totp.d.ts +23 -0
  44. package/dist/src/utils/visual/application.d.ts +10 -0
  45. package/dist/src/utils/visual/demo/index.d.ts +1 -0
  46. package/dist/src/utils/visual/demo/sankey.d.ts +2 -0
  47. package/dist/src/utils/visual/enums.d.ts +21 -0
  48. package/dist/src/utils/visual/event/boundary.d.ts +22 -0
  49. package/dist/src/utils/visual/event/event.d.ts +14 -0
  50. package/dist/src/utils/visual/event/index.d.ts +3 -0
  51. package/dist/src/utils/visual/event/types.d.ts +32 -0
  52. package/dist/src/utils/visual/graphics/graphics.d.ts +19 -0
  53. package/dist/src/utils/visual/graphics/graphicsData.d.ts +10 -0
  54. package/dist/src/utils/visual/graphics/graphicsGeometry.d.ts +10 -0
  55. package/dist/src/utils/visual/graphics/index.d.ts +3 -0
  56. package/dist/src/utils/visual/index.d.ts +4 -0
  57. package/dist/src/utils/visual/math/bezier.d.ts +2 -0
  58. package/dist/src/utils/visual/math/enums.d.ts +2 -0
  59. package/dist/src/utils/visual/math/index.d.ts +4 -0
  60. package/dist/src/utils/visual/math/matrix.d.ts +32 -0
  61. package/dist/src/utils/visual/math/transform.d.ts +27 -0
  62. package/dist/src/utils/visual/render/canvasRenderer.d.ts +9 -0
  63. package/dist/src/utils/visual/render/index.d.ts +3 -0
  64. package/dist/src/utils/visual/render/render.d.ts +10 -0
  65. package/dist/src/utils/visual/render/webGlRenderer.d.ts +7 -0
  66. package/dist/src/utils/visual/shape/circle.d.ts +11 -0
  67. package/dist/src/utils/visual/shape/ellipse.d.ts +12 -0
  68. package/dist/src/utils/visual/shape/index.d.ts +5 -0
  69. package/dist/src/utils/visual/shape/polygon.d.ts +10 -0
  70. package/dist/src/utils/visual/shape/rectangle.d.ts +12 -0
  71. package/dist/src/utils/visual/shape/shape.d.ts +7 -0
  72. package/dist/src/utils/visual/style/fill.d.ts +8 -0
  73. package/dist/src/utils/visual/style/index.d.ts +2 -0
  74. package/dist/src/utils/visual/style/line.d.ts +9 -0
  75. package/dist/src/utils/visual/types.d.ts +6 -0
  76. package/dist/src/utils/visual/vertex/application.d.ts +13 -0
  77. package/dist/src/utils/visual/vertex/container.d.ts +38 -0
  78. package/dist/src/utils/visual/vertex/index.d.ts +4 -0
  79. package/dist/src/utils/visual/vertex/point.d.ts +18 -0
  80. package/dist/src/utils/visual/vertex/vertex.d.ts +36 -0
  81. package/dist/src/vnode/chainDom.d.ts +47 -0
  82. package/dist/{wasm.js → src/wasm/index.js} +4 -8
  83. package/dist/test/writeFile.test.d.ts +1 -0
  84. package/dist/tsconfig.json +1 -0
  85. package/dist/umd/index.umd.cjs +1 -1
  86. package/dist/umd/ml/ml.umd.cjs +1 -1
  87. package/dist/umd/node/node.umd.cjs +1 -1
  88. package/dist/umd/react/react.umd.cjs +1 -1
  89. package/dist/umd/utils/utils.umd.cjs +1 -1
  90. package/dist/{ws-DoSbcWWZ.js → ws-CQA-0Bzm.js} +31 -53
  91. package/package.json +18 -16
  92. package/readme.md +6 -2
  93. package/typings.d.ts +4 -10
  94. package/dist/node.js +0 -27
  95. package/dist/react.js +0 -4
  96. package/dist/utils.js +0 -2092
  97. /package/dist/test/{server/encodeUrl.test.d.ts → encodeUrl.test.d.ts} +0 -0
  98. /package/dist/test/{server/escapeHtml.test.d.ts → escapeHtml.test.d.ts} +0 -0
  99. /package/dist/test/{server/mimeType.test.d.ts → mimeType.test.d.ts} +0 -0
  100. /package/dist/test/{server/server.test.d.ts → server.test.d.ts} +0 -0
  101. /package/dist/test/{server/status.test.d.ts → status.test.d.ts} +0 -0
  102. /package/dist/test/{file/writeFile.test.d.ts → totp.test.d.ts} +0 -0
  103. /package/dist/test/{server/websocket.test.d.ts → websocket.test.d.ts} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- import { AudioRecorder, Color, ColorScheme, FMT, Hsl, Hsla, Mathjs, MimeType, Monitor, QuestQueue, Rgb, Rgba, SyncHook, addClassToElement, appendUrl, audioVendor, canvasVendor, changeHumpToLowerCase, clearBr, clearStr, componentToHex, compose, connection, convertImageToBase64, createData, createDocumentFragment, createObjectURL, currentDevice, debounce, durationHandler, encodeUrl, escapeHtml, filterObj, formatJson, generateThrottle, getAllQueryString, getCookie, getCookieByName, getFrame, getHost, getMime, getPerformance, getPixelRatio, getStatus, getWindow, handleConsole, handleError, handleFetchHook, hexToRgb, hsbToRgb, hslToRgb, hsvToHsl, hsvToRgb, hue2rgb, imageRequest, isClient, isImageSize, isMobile, isString, isWeiXin, mathjs, memoize, merge, mergeExports, networkSpeed, noop, perToNum, performanceTime, querystring, randomColor, randomString, range, removeClassToElement, removeGhosting, replaceOld, report, requestAnimation, requestUrlToBuffer, retain, rgbToHex, rgbToHsb, rgbToHsl, scriptOnLoad, setMime, status, str2Xml, strParse, throttle, timeFormat, timestampToTime, webglVendor } from '@/utils';
1
+ import { AudioRecorder, Chain, Color, ColorScheme, FMT, Hsl, Hsla, Mathjs, MimeType, Monitor, QuestQueue, Rgb, Rgba, SyncHook, TOTP, addClassToElement, appendUrl, audioVendor, canvasVendor, changeHumpToLowerCase, clearBr, clearStr, componentToHex, compose, connection, convertImageToBase64, create, createData, createDocumentFragment, createObjectURL, currentDevice, debounce, durationHandler, encodeUrl, escapeHtml, filterObj, formatJson, generateThrottle, getAllQueryString, getCookie, getCookieByName, getFrame, getHost, getMime, getPerformance, getPixelRatio, getStatus, getWindow, handleConsole, handleError, handleFetchHook, hexToRgb, hsbToRgb, hslToRgb, hsvToHsl, hsvToRgb, hue2rgb, imageRequest, isBangDevice, isClient, isImageSize, isMobile, isString, isWeiXin, localStorageGetItem, localStorageSetItem, mathjs, memoize, merge, mergeExports, networkSpeed, noop, perToNum, performanceTime, querystring, randomColor, randomString, range, removeClassToElement, removeGhosting, replaceOld, report, requestAnimation, requestUrlToBuffer, retain, rgbToHex, rgbToHsb, rgbToHsl, scriptOnLoad, setAttributeByGlobal, setFontSize2html, setMime, status, str2Xml, strParse, throttle, timeFormat, timestampToTime, webglVendor } from '@/utils';
2
+ import type { CurrentDevice } from '@/utils';
2
3
  import { reactify } from '@/react';
3
- import { Router, Server, appendFile, body, colors, connect, get, getIPAdress, isColorSupported, paresUrl, prompt, queryFileInfo, readDir, readFile, readStream, runCommand, startTask, staticMiddleware, taskEnd, traverse, traverseSync, watchFile, writeStream, wss } from '@/node';
4
+ import { Router, Server, WSS, appendFile, body, colors, connect, get, getIPAdress, isColorSupported, paresUrl, prompt, queryFileInfo, readDir, readFile, readStream, runCommand, startTask, staticMiddleware, taskEnd, traverse, traverseSync, watchFile, writeStream } from '@/node';
4
5
  import { ocr } from '@/ml';
5
- export { ocr, reactify, AudioRecorder, Color, ColorScheme, FMT, Hsl, Hsla, Mathjs, MimeType, Monitor, QuestQueue, Rgb, Rgba, SyncHook, addClassToElement, appendUrl, audioVendor, canvasVendor, changeHumpToLowerCase, clearBr, clearStr, componentToHex, compose, connection, convertImageToBase64, createData, createDocumentFragment, createObjectURL, currentDevice, debounce, durationHandler, encodeUrl, escapeHtml, filterObj, formatJson, generateThrottle, getAllQueryString, getCookie, getCookieByName, getFrame, getHost, getMime, getPerformance, getPixelRatio, getStatus, getWindow, handleConsole, handleError, handleFetchHook, hexToRgb, hsbToRgb, hslToRgb, hsvToHsl, hsvToRgb, hue2rgb, imageRequest, isClient, isImageSize, isMobile, isString, isWeiXin, mathjs, memoize, merge, mergeExports, networkSpeed, noop, perToNum, performanceTime, querystring, randomColor, randomString, range, removeClassToElement, removeGhosting, replaceOld, report, requestAnimation, requestUrlToBuffer, retain, rgbToHex, rgbToHsb, rgbToHsl, scriptOnLoad, setMime, status, str2Xml, strParse, throttle, timeFormat, timestampToTime, webglVendor, Router, Server, appendFile, body, colors, connect, get, getIPAdress, isColorSupported, paresUrl, prompt, queryFileInfo, readDir, readFile, readStream, runCommand, startTask, staticMiddleware, taskEnd, traverse, traverseSync, watchFile, writeStream, wss, };
6
+ export { ocr, reactify, AudioRecorder, Color, ColorScheme, FMT, Hsl, Hsla, Mathjs, MimeType, Monitor, QuestQueue, Rgb, Rgba, SyncHook, addClassToElement, appendUrl, audioVendor, canvasVendor, changeHumpToLowerCase, clearBr, clearStr, componentToHex, compose, connection, convertImageToBase64, createData, createDocumentFragment, createObjectURL, currentDevice, debounce, durationHandler, encodeUrl, escapeHtml, filterObj, formatJson, generateThrottle, getAllQueryString, getCookie, getCookieByName, getFrame, getHost, getMime, getPerformance, getPixelRatio, getStatus, getWindow, handleConsole, handleError, handleFetchHook, hexToRgb, hsbToRgb, hslToRgb, hsvToHsl, hsvToRgb, hue2rgb, imageRequest, isClient, isImageSize, isMobile, isString, isWeiXin, mathjs, memoize, merge, mergeExports, networkSpeed, noop, perToNum, performanceTime, querystring, randomColor, randomString, range, removeClassToElement, removeGhosting, replaceOld, report, requestAnimation, requestUrlToBuffer, retain, rgbToHex, rgbToHsb, rgbToHsl, scriptOnLoad, setMime, status, str2Xml, strParse, throttle, timeFormat, timestampToTime, webglVendor, Router, Server, appendFile, body, colors, connect, get, getIPAdress, isColorSupported, paresUrl, prompt, queryFileInfo, readDir, readFile, readStream, runCommand, startTask, staticMiddleware, taskEnd, traverse, traverseSync, watchFile, writeStream, WSS, TOTP, isBangDevice, localStorageGetItem, localStorageSetItem, setAttributeByGlobal, setFontSize2html, Chain, create, };
7
+ export type { CurrentDevice };
package/dist/index.js CHANGED
@@ -1,10 +1,12 @@
1
- import { AudioRecorder, Mathjs, Monitor, QuestQueue, SyncHook, addClassToElement, appendUrl, audioVendor, canvasVendor, compose, connection, convertImageToBase64, createData, createDocumentFragment, createObjectURL, currentDevice, debounce, durationHandler, encodeUrl, escapeHtml, filterObj, formatJson, generateThrottle, getAllQueryString, getCookie, getCookieByName, getFrame, getHost, getPerformance, getPixelRatio, getStatus, getWindow, handleConsole, handleError, handleFetchHook, imageRequest, isClient, isImageSize, isMobile, isWeiXin, mathjs, memoize, merge, mergeExports, networkSpeed, noop, perToNum, performanceTime, querystring, range, removeClassToElement, removeGhosting, replaceOld, report, requestAnimation, requestUrlToBuffer, retain, scriptOnLoad, status, throttle, timeFormat, timestampToTime, webglVendor } from "./utils.js";
2
- import { C, a, F, H, b, M, R, c, d, e, f, g, h, i, j, k, l, m, n, o, r, p, q, s, t, u, v, w } from "./mimeType-Clvz2Teb.js";
3
- import { r as r2 } from "./reactify-C4cesbXi.js";
4
- import { R as R2, S, a as a2, b as b2, c as c2, d as d2, g as g2, e as e2, i as i2, f as f2, p as p2, q as q2, h as h2, j as j2, l as l2, r as r3, k as k2, s as s2, t as t2, m as m2, n as n2, o as o2, w as w2, W } from "./ws-DoSbcWWZ.js";
5
- import { ocr } from "./ml.js";
1
+ import { AudioRecorder, Chain, Mathjs, Monitor, QuestQueue, SyncHook, TOTP, addClassToElement, appendUrl, audioVendor, canvasVendor, compose, connection, convertImageToBase64, create, createData, createDocumentFragment, createObjectURL, currentDevice, debounce, durationHandler, encodeUrl, escapeHtml, filterObj, formatJson, generateThrottle, getAllQueryString, getCookie, getCookieByName, getFrame, getHost, getPerformance, getPixelRatio, getStatus, getWindow, handleConsole, handleError, handleFetchHook, imageRequest, isBangDevice, isClient, isImageSize, isMobile, isWeiXin, localStorageGetItem, localStorageSetItem, mathjs, memoize, merge, mergeExports, networkSpeed, noop, perToNum, performanceTime, querystring, range, removeClassToElement, removeGhosting, replaceOld, report, requestAnimation, requestUrlToBuffer, retain, scriptOnLoad, setAttributeByGlobal, setFontSize2html, status, throttle, timeFormat, timestampToTime, webglVendor } from "./src/utils/index.js";
2
+ import { C, a, F, H, b, M, R, c, d, e, f, g, h, i, j, k, l, m, n, o, r, p, q, s, t, u, v, w } from "./mimeType-eRf1TlBb.js";
3
+ import { r as r2 } from "./reactify-Z-V9Vblb.js";
4
+ import { R as R2, S, W, a as a2, b as b2, c as c2, d as d2, g as g2, e as e2, i as i2, p as p2, f as f2, q as q2, r as r3, h as h2, j as j2, k as k2, s as s2, l as l2, t as t2, m as m2, n as n2, w as w2, o as o2 } from "./ws-CQA-0Bzm.js";
5
+ import "node:fs";
6
+ import { ocr } from "./src/ml/index.js";
6
7
  export {
7
8
  AudioRecorder,
9
+ Chain,
8
10
  C as Color,
9
11
  a as ColorScheme,
10
12
  F as FMT,
@@ -19,6 +21,8 @@ export {
19
21
  R2 as Router,
20
22
  S as Server,
21
23
  SyncHook,
24
+ TOTP,
25
+ W as WSS,
22
26
  addClassToElement,
23
27
  a2 as appendFile,
24
28
  appendUrl,
@@ -34,6 +38,7 @@ export {
34
38
  d2 as connect,
35
39
  connection,
36
40
  convertImageToBase64,
41
+ create,
37
42
  createData,
38
43
  createDocumentFragment,
39
44
  createObjectURL,
@@ -67,12 +72,15 @@ export {
67
72
  m as hsvToRgb,
68
73
  n as hue2rgb,
69
74
  imageRequest,
75
+ isBangDevice,
70
76
  isClient,
71
77
  i2 as isColorSupported,
72
78
  isImageSize,
73
79
  isMobile,
74
80
  o as isString,
75
81
  isWeiXin,
82
+ localStorageGetItem,
83
+ localStorageSetItem,
76
84
  mathjs,
77
85
  memoize,
78
86
  merge,
@@ -80,19 +88,19 @@ export {
80
88
  networkSpeed,
81
89
  noop,
82
90
  ocr,
83
- f2 as paresUrl,
91
+ p2 as paresUrl,
84
92
  perToNum,
85
93
  performanceTime,
86
- p2 as prompt,
94
+ f2 as prompt,
87
95
  q2 as queryFileInfo,
88
96
  querystring,
89
97
  r as randomColor,
90
98
  p as randomString,
91
99
  range,
92
100
  r2 as reactify,
93
- h2 as readDir,
94
- j2 as readFile,
95
- l2 as readStream,
101
+ r3 as readDir,
102
+ h2 as readFile,
103
+ j2 as readStream,
96
104
  removeClassToElement,
97
105
  removeGhosting,
98
106
  replaceOld,
@@ -103,11 +111,13 @@ export {
103
111
  q as rgbToHex,
104
112
  s as rgbToHsb,
105
113
  t as rgbToHsl,
106
- r3 as runCommand,
114
+ k2 as runCommand,
107
115
  scriptOnLoad,
116
+ setAttributeByGlobal,
117
+ setFontSize2html,
108
118
  u as setMime,
109
- k2 as startTask,
110
- s2 as staticMiddleware,
119
+ s2 as startTask,
120
+ l2 as staticMiddleware,
111
121
  status,
112
122
  v as str2Xml,
113
123
  w as strParse,
@@ -117,8 +127,7 @@ export {
117
127
  timestampToTime,
118
128
  m2 as traverse,
119
129
  n2 as traverseSync,
120
- o2 as watchFile,
130
+ w2 as watchFile,
121
131
  webglVendor,
122
- w2 as writeStream,
123
- W as wss
132
+ o2 as writeStream
124
133
  };
@@ -1,9 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
4
  const strParse = (str = "", sep = "", eq = "") => {
8
5
  const result = {};
9
6
  const list = str.split(sep);
@@ -18,14 +15,12 @@ const strParse = (str = "", sep = "", eq = "") => {
18
15
  return result;
19
16
  };
20
17
  const clearBr = (str = "") => {
21
- if (str.length === 0)
22
- return "";
18
+ if (str.length === 0) return "";
23
19
  return str.replace(/\s+/g, "").replace(/<\/?.+?>/g, "").replace(/[\r\n]/g, "");
24
20
  };
25
21
  const str2Xml = (xmlStr, format = "text/xml") => {
26
- if (window.DOMParser)
27
- return new window.DOMParser().parseFromString(xmlStr, format).documentElement;
28
- if (typeof window.ActiveXObject !== "undefined" && new window.ActiveXObject("Microsoft.XMLDOM")) {
22
+ if (window.DOMParser) return new window.DOMParser().parseFromString(xmlStr, format).documentElement;
23
+ if (typeof window.ActiveXObject !== "undefined") {
29
24
  const xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM");
30
25
  xmlDoc.async = "false";
31
26
  xmlDoc.loadXML(xmlStr);
@@ -1,9 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
4
  import { forwardRef, createElement, Component, createRef } from "react";
8
5
  const reactifyWebComponent = (WC) => {
9
6
  class Reactified extends Component {
@@ -36,10 +33,8 @@ const reactifyWebComponent = (WC) => {
36
33
  update() {
37
34
  this.clearEventHandlers();
38
35
  Object.entries(this.props).forEach(([prop, val]) => {
39
- if (prop === "style" && typeof val !== "string")
40
- return;
41
- if (prop === "children")
42
- return void 0;
36
+ if (prop === "style" && typeof val !== "string") return;
37
+ if (prop === "children") return void 0;
43
38
  if (prop.toLowerCase() === "classname" && this.ref.current) {
44
39
  return this.ref.current.className = val;
45
40
  }
@@ -158,8 +158,7 @@ var runtime = { exports: {} };
158
158
  });
159
159
  exports.AsyncIterator = AsyncIterator;
160
160
  exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
161
- if (PromiseImpl === void 0)
162
- PromiseImpl = Promise;
161
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
163
162
  var iter = new AsyncIterator(
164
163
  wrap(innerFn, outerFn, self, tryLocsList),
165
164
  PromiseImpl
@@ -187,8 +186,7 @@ var runtime = { exports: {} };
187
186
  if (delegate) {
188
187
  var delegateResult = maybeInvokeDelegate(delegate, context);
189
188
  if (delegateResult) {
190
- if (delegateResult === ContinueSentinel)
191
- continue;
189
+ if (delegateResult === ContinueSentinel) continue;
192
190
  return delegateResult;
193
191
  }
194
192
  }
@@ -715,7 +713,7 @@ var OEM$2 = {
715
713
  DEFAULT: 3
716
714
  };
717
715
  const name = "tesseract.js";
718
- const version$1 = "5.0.4";
716
+ const version$1 = "5.1.0";
719
717
  const description = "Pure Javascript Multilingual OCR";
720
718
  const main = "src/index.js";
721
719
  const types = "src/index.d.ts";
@@ -784,7 +782,7 @@ const dependencies = {
784
782
  "node-fetch": "^2.6.9",
785
783
  "opencollective-postinstall": "^2.0.3",
786
784
  "regenerator-runtime": "^0.13.3",
787
- "tesseract.js-core": "^5.0.0",
785
+ "tesseract.js-core": "^5.1.0",
788
786
  "wasm-feature-detect": "^1.2.11",
789
787
  zlibjs: "^0.3.1"
790
788
  };
@@ -966,16 +964,17 @@ var createWorker$2 = async (langs = "eng", oem = OEM$1.LSTM_ONLY, _options = {},
966
964
  let worker = spawnWorker(options);
967
965
  worker.onerror = workerError;
968
966
  workerCounter += 1;
969
- const setResolve = (action, res) => {
970
- resolves[action] = res;
967
+ const setResolve = (promiseId, res) => {
968
+ resolves[promiseId] = res;
971
969
  };
972
- const setReject = (action, rej) => {
973
- rejects[action] = rej;
970
+ const setReject = (promiseId, rej) => {
971
+ rejects[promiseId] = rej;
974
972
  };
975
973
  const startJob = ({ id: jobId, action, payload }) => new Promise((resolve, reject) => {
976
974
  log(`[${id}]: Start ${jobId}, action=${action}`);
977
- setResolve(action, resolve);
978
- setReject(action, reject);
975
+ const promiseId = `${action}-${jobId}`;
976
+ setResolve(promiseId, resolve);
977
+ setReject(promiseId, reject);
979
978
  send(worker, {
980
979
  workerId: id,
981
980
  jobId,
@@ -1032,8 +1031,7 @@ var createWorker$2 = async (langs = "eng", oem = OEM$1.LSTM_ONLY, _options = {},
1032
1031
  payload: { langs: _langs, oem: _oem, config: _config }
1033
1032
  }));
1034
1033
  const reinitialize = (langs2 = "eng", oem2, config2, jobId) => {
1035
- if (lstmOnlyCore && [OEM$1.TESSERACT_ONLY, OEM$1.TESSERACT_LSTM_COMBINED].includes(oem2))
1036
- throw Error("Legacy model requested but code missing.");
1034
+ if (lstmOnlyCore && [OEM$1.TESSERACT_ONLY, OEM$1.TESSERACT_LSTM_COMBINED].includes(oem2)) throw Error("Legacy model requested but code missing.");
1037
1035
  const _oem = oem2 || currentOem;
1038
1036
  currentOem = _oem;
1039
1037
  const _config = config2 || currentConfig;
@@ -1069,8 +1067,7 @@ var createWorker$2 = async (langs = "eng", oem = OEM$1.LSTM_ONLY, _options = {},
1069
1067
  }));
1070
1068
  };
1071
1069
  const detect2 = async (image, jobId) => {
1072
- if (lstmOnlyCore)
1073
- throw Error("`worker.detect` requires Legacy model, which was not loaded.");
1070
+ if (lstmOnlyCore) throw Error("`worker.detect` requires Legacy model, which was not loaded.");
1074
1071
  return startJob(createJob({
1075
1072
  id: jobId,
1076
1073
  action: "detect",
@@ -1091,6 +1088,7 @@ var createWorker$2 = async (langs = "eng", oem = OEM$1.LSTM_ONLY, _options = {},
1091
1088
  action,
1092
1089
  data
1093
1090
  }) => {
1091
+ const promiseId = `${action}-${jobId}`;
1094
1092
  if (status === "resolve") {
1095
1093
  log(`[${workerId}]: Complete ${jobId}`);
1096
1094
  let d = data;
@@ -1099,11 +1097,10 @@ var createWorker$2 = async (langs = "eng", oem = OEM$1.LSTM_ONLY, _options = {},
1099
1097
  } else if (action === "getPDF") {
1100
1098
  d = Array.from({ ...data, length: Object.keys(data).length });
1101
1099
  }
1102
- resolves[action]({ jobId, data: d });
1100
+ resolves[promiseId]({ jobId, data: d });
1103
1101
  } else if (status === "reject") {
1104
- rejects[action](data);
1105
- if (action === "load")
1106
- workerResReject(data);
1102
+ rejects[promiseId](data);
1103
+ if (action === "load") workerResReject(data);
1107
1104
  if (errorHandler) {
1108
1105
  errorHandler(data);
1109
1106
  } else {
@@ -1290,10 +1287,8 @@ var src = {
1290
1287
  ...Tesseract
1291
1288
  };
1292
1289
  const ocr = async ({ images = [], language = "eng", langPath = "" }) => {
1293
- if (images.length === 0)
1294
- return { success: false, data: null, message: "images must be a array" };
1295
- if (!language)
1296
- return { success: false, data: null, message: "languages must be a array" };
1290
+ if (images.length === 0) return { success: false, data: null, message: "images must be a array" };
1291
+ if (!language) return { success: false, data: null, message: "languages must be a array" };
1297
1292
  let options = {};
1298
1293
  if (langPath) {
1299
1294
  options = { langPath };
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { MiddlewareFunction } from '@/node/server';
3
2
  interface ServerBody {
4
3
  uploadDir: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export declare const runCommand: (command: string, args: string[]) => Promise<void>;
3
2
  interface PromptOption {
4
3
  message: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { IncomingMessage, ServerResponse } from 'node:http';
3
2
  import type { MiddlewareFunction } from '@/node/server';
4
3
  type ConnectMiddleware = (req: IncomingMessage, res: ServerResponse, next?: Function) => void;
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import fs from 'node:fs';
4
2
  import type { Noop } from '@/utils/noop';
5
3
  export type FilePromiseResult = Promise<Ranuts.Identification> & {
@@ -18,5 +18,6 @@ import { readStream, writeStream } from '@/node/stream';
18
18
  import taskEnd from '@/node/taskEnd';
19
19
  import { traverse, traverseSync } from '@/node/traverse';
20
20
  import watchFile from '@/node/watchFile';
21
- import wss from '@/node/ws';
22
- export { appendFile, colors, body, prompt, runCommand, connect, queryFileInfo, get, getIPAdress, isColorSupported, paresUrl, readDir, Router, readFile, staticMiddleware, Server, startTask, readStream, writeStream, taskEnd, traverse, traverseSync, watchFile, wss, };
21
+ import WSS from '@/node/ws';
22
+ import writeFile from '@/node/writeFile';
23
+ export { appendFile, colors, body, prompt, runCommand, connect, queryFileInfo, get, getIPAdress, isColorSupported, paresUrl, readDir, Router, readFile, staticMiddleware, Server, startTask, readStream, writeStream, taskEnd, traverse, traverseSync, watchFile, WSS, writeFile, };
@@ -0,0 +1,54 @@
1
+ import { R, S, W, a, b, c, d, g, e, i, p, f, q, r, h, j, k, s, l, t, m, n, w, o } from "../../ws-CQA-0Bzm.js";
2
+ import fs from "node:fs";
3
+ const writeFile = (path, content) => new Promise((resolve, reject) => {
4
+ fs.writeFile(
5
+ path,
6
+ content,
7
+ {
8
+ mode: 438,
9
+ // 可读可写666,转化为十进制就是438
10
+ flag: "w+",
11
+ // r+并不会清空再写入,w+会清空再写入
12
+ encoding: "utf-8"
13
+ },
14
+ (err) => {
15
+ if (err) {
16
+ reject({ success: false, _identification: false, data: err });
17
+ throw err;
18
+ } else {
19
+ resolve({
20
+ success: true,
21
+ _identification: false,
22
+ data: { path, content }
23
+ });
24
+ }
25
+ }
26
+ );
27
+ });
28
+ export {
29
+ R as Router,
30
+ S as Server,
31
+ W as WSS,
32
+ a as appendFile,
33
+ b as body,
34
+ c as colors,
35
+ d as connect,
36
+ g as get,
37
+ e as getIPAdress,
38
+ i as isColorSupported,
39
+ p as paresUrl,
40
+ f as prompt,
41
+ q as queryFileInfo,
42
+ r as readDir,
43
+ h as readFile,
44
+ j as readStream,
45
+ k as runCommand,
46
+ s as startTask,
47
+ l as staticMiddleware,
48
+ t as taskEnd,
49
+ m as traverse,
50
+ n as traverseSync,
51
+ w as watchFile,
52
+ writeFile,
53
+ o as writeStream
54
+ };
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { IncomingMessage } from 'node:http';
3
2
  interface ParseUrl {
4
3
  search?: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { FilePromiseResult } from '@/node/fs';
3
2
  /**
4
3
  * @description: 读取一个文件,读取成功返回状态码和文件内容
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { IncomingMessage, ServerResponse } from 'node:http';
3
2
  import http from 'node:http';
4
3
  export type Next = () => Promise<never> | Promise<void>;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { ReadStream, WriteStream } from 'node:fs';
3
2
  interface ReadOption {
4
3
  path: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { Stats } from 'node:fs';
3
2
  type Caller = (relPath: string, absPath: string, stats: Stats) => any;
4
3
  /**
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @description: 观察一个文件是否被改变,返回状态
3
3
  * @param {string} path 监听的文件路径
4
- * @param {number} interval 监听的时间,单位毫秒,默认20毫秒
4
+ * @param {number} interval 监听的时间,单位毫秒,默认 20 毫秒
5
5
  * @return {Promise}
6
6
  */
7
7
  declare const watchFile: (path: string, interval?: number) => Promise<Ranuts.Identification>;
@@ -1,7 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
- /// <reference types="node" />
5
1
  import http from 'node:http';
6
2
  import type internal from 'node:stream';
7
3
  import EventEmitter from 'node:events';
@@ -40,7 +36,7 @@ declare class WebSocket extends EventEmitter {
40
36
  */
41
37
  broadcast(data: string): void;
42
38
  /**
43
- * @description: 创建client
39
+ * @description: 创建 client
44
40
  * @param {http} req
45
41
  * @param {internal} socket
46
42
  */
@@ -51,7 +47,7 @@ declare class WebSocket extends EventEmitter {
51
47
  */
52
48
  addListenCloseClient(client: Client): void;
53
49
  /**
54
- * @description: 解析帧meta
50
+ * @description: 解析帧 meta
55
51
  * @param {Buffer} source
56
52
  * @return {FrameMeta}
57
53
  */
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type http from 'node:http';
3
2
  /**
4
3
  * Create a WebSocket Server
@@ -4,7 +4,7 @@ interface FT {
4
4
  prototype: Object;
5
5
  }
6
6
  /**
7
- * @description: 实现object.create,将传入的对象作为原型
7
+ * @description: 实现 object.create,将传入的对象作为原型
8
8
  * @param {*} obj
9
9
  * @return {*}
10
10
  */
@@ -17,7 +17,7 @@ declare const objectCreate: (obj: Object) => Object;
17
17
  */
18
18
  declare const instanceOf: (obj: Object, cst: Function) => boolean;
19
19
  /**
20
- * @description: 实现new操作符
20
+ * @description: 实现 new 操作符
21
21
  * @param {*} 构造函数
22
22
  * @param {*} 参数
23
23
  * @return {*} Object
@@ -36,7 +36,7 @@ declare function debounce(fn: Function, wait?: number): (this: unknown) => void;
36
36
  */
37
37
  declare function throttle(fn: Function, wait?: number): (this: unknown) => any;
38
38
  /**
39
- * @description: 实现call函数
39
+ * @description: 实现 call 函数
40
40
  * @param {unknown} this
41
41
  * @return {*}
42
42
  */
@@ -0,0 +1,4 @@
1
+ import { r } from "../../reactify-Z-V9Vblb.js";
2
+ export {
3
+ r as reactify
4
+ };
@@ -5,6 +5,6 @@ export declare const webglVendor: () => {
5
5
  } | null;
6
6
  export declare const canvasVendor: () => string | null;
7
7
  /**
8
- * @description: 音频指纹,1.生成音频信息流(三角波),对其进行FFT变换,计算SHA值作为指纹。2.生成音频信息流(正弦波),进行动态压缩处理,计算MD5值。
8
+ * @description: 音频指纹,1.生成音频信息流 (三角波),对其进行 FFT 变换,计算 SHA 值作为指纹。2.生成音频信息流(正弦波),进行动态压缩处理,计算 MD5 值。
9
9
  */
10
10
  export declare const audioVendor: () => Promise<string>;
@@ -5,7 +5,7 @@
5
5
  */
6
6
  export declare const retain: (callback?: () => void) => void;
7
7
  /**
8
- * @description: 获取指定的cookie
8
+ * @description: 获取指定的 cookie
9
9
  * @param {string} objName
10
10
  * @return {*}
11
11
  */
@@ -26,7 +26,7 @@ export interface BaseReturn {
26
26
  message?: string;
27
27
  }
28
28
  /**
29
- * @description: url转arrayBuffer
29
+ * @description: url arrayBuffer
30
30
  * @param {string} src
31
31
  * @param {RequestUrlToArraybufferOption} options
32
32
  * @return {*}
@@ -47,7 +47,7 @@ export interface Context {
47
47
  export declare const getPixelRatio: (context: CanvasRenderingContext2D & Partial<Context>) => number;
48
48
  export declare const createObjectURL: (src: Blob | ArrayBuffer | Response) => Promise<string>;
49
49
  /**
50
- * @description: 计算每毫秒的帧率,每秒的帧率需要乘1000
50
+ * @description: 计算每毫秒的帧率,每秒的帧率需要乘 1000
51
51
  * @return {*}
52
52
  */
53
53
  export declare const getFrame: (n?: number) => Promise<number>;
@@ -57,14 +57,14 @@ export declare const getFrame: (n?: number) => Promise<number>;
57
57
  */
58
58
  export declare const getHost: (env?: string) => string | undefined;
59
59
  /**
60
- * @description: 将url上的字符串转换成对象
60
+ * @description: 将 url 上的字符串转换成对象
61
61
  * @param {string} url
62
62
  * @param {*} string
63
63
  * @return {*}
64
64
  */
65
65
  export declare const getAllQueryString: (url: string) => Record<string, string>;
66
66
  /**
67
- * @description: 将一个对象转换成querystring,拼接到url后面
67
+ * @description: 将一个对象转换成 querystring,拼接到 url 后面
68
68
  * @return {*}
69
69
  */
70
70
  export declare function appendUrl(url: string, params?: Record<string, string>): string;
@@ -125,9 +125,9 @@ export declare const imageRequest: (url?: string) => Promise<number>;
125
125
  * @param {HandlerFunction} handler
126
126
  * @param {array} params
127
127
  */
128
- export declare const durationHandler: <T, U>(handler: (...args: T[]) => U, ...params: T[]) => (a: number) => Promise<U>;
128
+ export declare const durationHandler: <T, U>(handler: (...args: T[]) => U, ...params: T[]) => ((a: number) => Promise<U>);
129
129
  /**
130
- * @description: 通过请求来测试当前网络的ping值
130
+ * @description: 通过请求来测试当前网络的 ping
131
131
  * @param {*} options
132
132
  */
133
133
  export declare const networkSpeed: (options: Options) => Promise<ReturnType>;
@@ -3,8 +3,14 @@
3
3
  * @param {*} function
4
4
  * @return {*}
5
5
  */
6
- type JudgeDeviceReturn = 'ipad' | 'android' | 'iphone' | 'pc';
7
- export declare const currentDevice: () => JudgeDeviceReturn;
6
+ export declare enum DEVICE {
7
+ IPAD = "ipad",
8
+ ANDROID = "android",
9
+ IPhONE = "iphone",
10
+ PC = "pc"
11
+ }
12
+ export type CurrentDevice = 'ipad' | 'android' | 'iphone' | 'pc';
13
+ export declare const currentDevice: () => CurrentDevice;
8
14
  export declare const isClient: boolean;
9
15
  /**
10
16
  * @description: 判断是否是微信浏览器的函数
@@ -16,4 +22,4 @@ export declare const isWeiXin: () => boolean;
16
22
  * 是否是移动端
17
23
  */
18
24
  export declare const isMobile: () => boolean;
19
- export {};
25
+ export declare const isBangDevice: () => boolean;