ranuts 0.4.1-alpha.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/CLAUDE.md +178 -26
  2. package/README.de.md +62 -0
  3. package/README.es.md +62 -0
  4. package/README.fa.md +62 -0
  5. package/README.ja.md +62 -0
  6. package/README.ko.md +62 -0
  7. package/README.md +35 -90
  8. package/README.pt.md +62 -0
  9. package/README.zh-CN.md +35 -89
  10. package/dist/iife/index.iife.js +4 -0
  11. package/dist/iife/utils.iife.js +4 -0
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.js +306 -1
  14. package/dist/src/_virtual/_rolldown/runtime/index.js +12 -0
  15. package/dist/src/conversation/engine.d.ts +109 -0
  16. package/dist/src/conversation/engine.js +101 -0
  17. package/dist/src/conversation/index.d.ts +12 -0
  18. package/dist/src/conversation/index.js +4 -0
  19. package/dist/src/conversation/types.d.ts +99 -0
  20. package/dist/src/stream/accumulator.d.ts +51 -0
  21. package/dist/src/stream/accumulator.js +79 -0
  22. package/dist/src/stream/budget.d.ts +89 -0
  23. package/dist/src/stream/budget.js +45 -0
  24. package/dist/src/stream/index.d.ts +25 -0
  25. package/dist/src/stream/index.js +11 -0
  26. package/dist/src/stream/sse.d.ts +51 -0
  27. package/dist/src/stream/sse.js +61 -0
  28. package/dist/src/stream/types.d.ts +106 -0
  29. package/dist/src/sw/index.js +52 -1
  30. package/dist/src/utils/async.js +49 -0
  31. package/dist/src/utils/audioRecorder.js +1121 -0
  32. package/dist/src/utils/behavior.js +9 -0
  33. package/dist/src/utils/binary.js +89 -0
  34. package/dist/src/utils/bom.d.ts +31 -9
  35. package/dist/src/utils/bom.js +165 -0
  36. package/dist/src/utils/bridge.js +310 -0
  37. package/dist/src/utils/canvas.d.ts +1 -0
  38. package/dist/src/utils/canvas.js +103 -0
  39. package/dist/src/utils/chain.js +76 -0
  40. package/dist/src/utils/color.d.ts +0 -1
  41. package/dist/src/utils/color.js +312 -0
  42. package/dist/src/utils/compose.js +22 -0
  43. package/dist/src/utils/console.js +22 -0
  44. package/dist/src/utils/debounce.js +18 -0
  45. package/dist/src/utils/device.d.ts +0 -9
  46. package/dist/src/utils/device.js +31 -0
  47. package/dist/src/utils/diff.d.ts +51 -0
  48. package/dist/src/utils/diff.js +110 -0
  49. package/dist/src/utils/dom.d.ts +1 -1
  50. package/dist/src/utils/dom.js +89 -0
  51. package/dist/src/utils/error.js +11 -0
  52. package/dist/src/utils/event.d.ts +3 -3
  53. package/dist/src/utils/event.js +39 -0
  54. package/dist/src/utils/file.js +14 -0
  55. package/dist/src/utils/func.js +4 -0
  56. package/dist/src/utils/i18n/index.js +79 -1
  57. package/dist/src/utils/idb.js +177 -0
  58. package/dist/src/utils/img.d.ts +1 -1
  59. package/dist/src/utils/img.js +68 -0
  60. package/dist/src/utils/index.d.ts +81 -77
  61. package/dist/src/utils/index.js +306 -1
  62. package/dist/src/utils/lang.d.ts +23 -6
  63. package/dist/src/utils/lang.js +42 -0
  64. package/dist/src/utils/localePath.js +48 -0
  65. package/dist/src/utils/memoize.d.ts +1 -7
  66. package/dist/src/utils/memoize.js +16 -0
  67. package/dist/src/utils/mimeType.js +841 -0
  68. package/dist/src/utils/monitor.js +84 -0
  69. package/dist/src/utils/network.js +117 -0
  70. package/dist/src/utils/noop.js +5 -0
  71. package/dist/src/utils/number.d.ts +20 -0
  72. package/dist/src/utils/number.js +185 -0
  73. package/dist/src/utils/obj.d.ts +2 -2
  74. package/dist/src/utils/obj.js +140 -0
  75. package/dist/src/utils/paginate.js +93 -0
  76. package/dist/src/utils/performance.js +26 -0
  77. package/dist/src/utils/placement.d.ts +42 -5
  78. package/dist/src/utils/placement.js +37 -0
  79. package/dist/src/utils/prefetch.js +69 -0
  80. package/dist/src/utils/queue.js +46 -0
  81. package/dist/src/utils/report.js +44 -0
  82. package/dist/src/utils/request.js +35 -0
  83. package/dist/src/utils/script.d.ts +1 -1
  84. package/dist/src/utils/script.js +46 -0
  85. package/dist/src/utils/scroll.d.ts +93 -0
  86. package/dist/src/utils/scroll.js +62 -0
  87. package/dist/src/utils/secure.js +36 -0
  88. package/dist/src/utils/segment.js +43 -0
  89. package/dist/src/utils/signal.d.ts +1 -1
  90. package/dist/src/utils/signal.js +13 -0
  91. package/dist/src/utils/speech.js +59 -0
  92. package/dist/src/utils/storage.js +53 -0
  93. package/dist/src/utils/str.d.ts +0 -6
  94. package/dist/src/utils/str.js +395 -0
  95. package/dist/src/utils/style.js +29 -0
  96. package/dist/src/utils/subscribe.js +58 -0
  97. package/dist/src/utils/throttle.js +17 -0
  98. package/dist/src/utils/time.d.ts +0 -21
  99. package/dist/src/utils/time.js +97 -0
  100. package/dist/src/utils/totp/sha/common.d.ts +1 -1
  101. package/dist/src/utils/totp/sha/common.js +201 -0
  102. package/dist/src/utils/totp/sha/converters.d.ts +1 -1
  103. package/dist/src/utils/totp/sha/converters.js +188 -0
  104. package/dist/src/utils/totp/sha/primitives_32.js +55 -0
  105. package/dist/src/utils/totp/sha/primitives_64.js +85 -0
  106. package/dist/src/utils/totp/sha/sha.d.ts +1 -1
  107. package/dist/src/utils/totp/sha/sha.js +30 -0
  108. package/dist/src/utils/totp/sha/sha1.d.ts +2 -2
  109. package/dist/src/utils/totp/sha/sha1.js +51 -0
  110. package/dist/src/utils/totp/sha/sha256.d.ts +2 -2
  111. package/dist/src/utils/totp/sha/sha256.js +56 -0
  112. package/dist/src/utils/totp/sha/sha3.d.ts +3 -3
  113. package/dist/src/utils/totp/sha/sha3.js +253 -0
  114. package/dist/src/utils/totp/sha/sha512.d.ts +3 -3
  115. package/dist/src/utils/totp/sha/sha512.js +177 -0
  116. package/dist/src/utils/totp/totp.js +49 -0
  117. package/dist/src/utils/tween.js +59 -0
  118. package/dist/src/utils/visual/application.d.ts +4 -4
  119. package/dist/src/utils/visual/application.js +42 -0
  120. package/dist/src/utils/visual/enums.js +19 -0
  121. package/dist/src/utils/visual/event/boundary.d.ts +2 -2
  122. package/dist/src/utils/visual/event/boundary.js +93 -0
  123. package/dist/src/utils/visual/event/event.d.ts +1 -1
  124. package/dist/src/utils/visual/event/event.js +34 -0
  125. package/dist/src/utils/visual/event/index.d.ts +4 -4
  126. package/dist/src/utils/visual/event/types.d.ts +2 -2
  127. package/dist/src/utils/visual/event/types.js +23 -0
  128. package/dist/src/utils/visual/graphics/graphics.d.ts +8 -8
  129. package/dist/src/utils/visual/graphics/graphics.js +168 -0
  130. package/dist/src/utils/visual/graphics/graphicsData.d.ts +3 -3
  131. package/dist/src/utils/visual/graphics/graphicsData.js +12 -0
  132. package/dist/src/utils/visual/graphics/graphicsGeometry.d.ts +7 -7
  133. package/dist/src/utils/visual/graphics/graphicsGeometry.js +39 -0
  134. package/dist/src/utils/visual/graphics/index.d.ts +3 -3
  135. package/dist/src/utils/visual/index.d.ts +8 -8
  136. package/dist/src/utils/visual/index.js +20 -1
  137. package/dist/src/utils/visual/math/bezier.js +15 -0
  138. package/dist/src/utils/visual/math/enums.js +6 -0
  139. package/dist/src/utils/visual/math/index.d.ts +4 -4
  140. package/dist/src/utils/visual/math/matrix.d.ts +1 -1
  141. package/dist/src/utils/visual/math/matrix.js +59 -0
  142. package/dist/src/utils/visual/math/transform.d.ts +2 -2
  143. package/dist/src/utils/visual/math/transform.js +50 -0
  144. package/dist/src/utils/visual/render/batchRenderer.d.ts +4 -4
  145. package/dist/src/utils/visual/render/batchRenderer.js +59 -0
  146. package/dist/src/utils/visual/render/canvasRenderer.d.ts +3 -3
  147. package/dist/src/utils/visual/render/canvasRenderer.js +17 -0
  148. package/dist/src/utils/visual/render/filter.d.ts +1 -1
  149. package/dist/src/utils/visual/render/filter.js +92 -0
  150. package/dist/src/utils/visual/render/index.d.ts +2 -2
  151. package/dist/src/utils/visual/render/index.js +20 -0
  152. package/dist/src/utils/visual/render/render.d.ts +4 -4
  153. package/dist/src/utils/visual/render/render.js +19 -0
  154. package/dist/src/utils/visual/render/renderTarget.js +28 -0
  155. package/dist/src/utils/visual/render/utils/batch/index.d.ts +4 -4
  156. package/dist/src/utils/visual/render/utils/batch/index.js +88 -0
  157. package/dist/src/utils/visual/render/utils/earcut.js +328 -0
  158. package/dist/src/utils/visual/render/utils/float.js +65 -0
  159. package/dist/src/utils/visual/render/utils/index.js +50 -0
  160. package/dist/src/utils/visual/render/utils/verticy.d.ts +2 -2
  161. package/dist/src/utils/visual/render/utils/verticy.js +162 -0
  162. package/dist/src/utils/visual/render/utils/webgl/initShader.d.ts +1 -1
  163. package/dist/src/utils/visual/render/utils/webgl/initShader.js +31 -0
  164. package/dist/src/utils/visual/render/utils/webgl/shaders.js +22 -0
  165. package/dist/src/utils/visual/render/utils/webgpu/shaders.js +32 -0
  166. package/dist/src/utils/visual/render/webGPURenderer.d.ts +2 -2
  167. package/dist/src/utils/visual/render/webGPURenderer.js +185 -0
  168. package/dist/src/utils/visual/render/webGlRenderer.d.ts +2 -2
  169. package/dist/src/utils/visual/render/webGlRenderer.js +88 -0
  170. package/dist/src/utils/visual/shape/circle.d.ts +3 -3
  171. package/dist/src/utils/visual/shape/circle.js +17 -0
  172. package/dist/src/utils/visual/shape/ellipse.d.ts +3 -3
  173. package/dist/src/utils/visual/shape/ellipse.js +18 -0
  174. package/dist/src/utils/visual/shape/index.d.ts +6 -6
  175. package/dist/src/utils/visual/shape/polygon.d.ts +3 -3
  176. package/dist/src/utils/visual/shape/polygon.js +29 -0
  177. package/dist/src/utils/visual/shape/rectangle.d.ts +3 -3
  178. package/dist/src/utils/visual/shape/rectangle.js +18 -0
  179. package/dist/src/utils/visual/shape/roundedRectangle.d.ts +3 -3
  180. package/dist/src/utils/visual/shape/roundedRectangle.js +32 -0
  181. package/dist/src/utils/visual/shape/shape.d.ts +2 -2
  182. package/dist/src/utils/visual/shape/shape.js +5 -0
  183. package/dist/src/utils/visual/style/fill.js +18 -0
  184. package/dist/src/utils/visual/style/index.d.ts +2 -2
  185. package/dist/src/utils/visual/style/line.d.ts +2 -2
  186. package/dist/src/utils/visual/style/line.js +18 -0
  187. package/dist/src/utils/visual/types.d.ts +1 -1
  188. package/dist/src/utils/visual/vertex/container.d.ts +5 -5
  189. package/dist/src/utils/visual/vertex/container.js +54 -0
  190. package/dist/src/utils/visual/vertex/point.js +37 -0
  191. package/dist/src/utils/visual/vertex/vertex.d.ts +7 -7
  192. package/dist/src/utils/visual/vertex/vertex.js +76 -0
  193. package/dist/src/utils/worker.js +89 -0
  194. package/dist/src/utils/zip.js +161 -0
  195. package/dist/src/vnode/h.d.ts +1 -1
  196. package/dist/src/vnode/h.js +22 -0
  197. package/dist/src/vnode/hooks.d.ts +1 -1
  198. package/dist/src/vnode/htmlDomApi.js +94 -0
  199. package/dist/src/vnode/index.d.ts +16 -16
  200. package/dist/src/vnode/index.js +28 -1
  201. package/dist/src/vnode/init.d.ts +1 -1
  202. package/dist/src/vnode/init.js +104 -0
  203. package/dist/src/vnode/is.d.ts +1 -1
  204. package/dist/src/vnode/is.js +20 -0
  205. package/dist/src/vnode/modules/attributes.d.ts +1 -1
  206. package/dist/src/vnode/modules/attributes.js +21 -0
  207. package/dist/src/vnode/modules/class.d.ts +1 -1
  208. package/dist/src/vnode/modules/class.js +18 -0
  209. package/dist/src/vnode/modules/index.js +15 -0
  210. package/dist/src/vnode/modules/listeners.d.ts +1 -1
  211. package/dist/src/vnode/modules/listeners.js +36 -0
  212. package/dist/src/vnode/modules/props.d.ts +1 -1
  213. package/dist/src/vnode/modules/props.js +17 -0
  214. package/dist/src/vnode/modules/style.d.ts +1 -1
  215. package/dist/src/vnode/modules/style.js +52 -0
  216. package/dist/src/vnode/vnode.d.ts +6 -6
  217. package/dist/src/vnode/vnode.js +13 -0
  218. package/dist/third-party/jschardet/LICENSE.txt +504 -0
  219. package/dist/third-party/jschardet/NOTICE.txt +33 -0
  220. package/docs/API.md +86 -65
  221. package/package.json +20 -15
  222. package/dist/bin/generate-api-docs.d.ts +0 -1
  223. package/dist/build/build.es.d.ts +0 -2
  224. package/dist/build/build.umd.d.ts +0 -2
  225. package/dist/build/build.umd.node.d.ts +0 -2
  226. package/dist/build/build.umd.utils.d.ts +0 -2
  227. package/dist/chain-CTywmh_H.js +0 -1
  228. package/dist/color-B_KMM8UX.js +0 -1
  229. package/dist/enums-BAgbyGdH.js +0 -1
  230. package/dist/examples/clone-deep-example.d.ts +0 -1
  231. package/dist/examples/is-equal-example.d.ts +0 -1
  232. package/dist/i18n-BJIS1fR1.js +0 -1
  233. package/dist/plugins/vite-plugins-banner.d.ts +0 -2
  234. package/dist/rolldown-runtime-I3TIJKkN.js +0 -1
  235. package/dist/src/node/appendFile.d.ts +0 -7
  236. package/dist/src/node/body.d.ts +0 -9
  237. package/dist/src/node/color.d.ts +0 -7
  238. package/dist/src/node/command.d.ts +0 -8
  239. package/dist/src/node/ctx2req.d.ts +0 -5
  240. package/dist/src/node/fileInfo.d.ts +0 -7
  241. package/dist/src/node/fs.d.ts +0 -7
  242. package/dist/src/node/get.d.ts +0 -10
  243. package/dist/src/node/getIPAdress.d.ts +0 -1
  244. package/dist/src/node/index.d.ts +0 -25
  245. package/dist/src/node/index.js +0 -1
  246. package/dist/src/node/isColorSupported.d.ts +0 -2
  247. package/dist/src/node/paresUrl.d.ts +0 -19
  248. package/dist/src/node/readDir.d.ts +0 -6
  249. package/dist/src/node/readFile.d.ts +0 -9
  250. package/dist/src/node/router.d.ts +0 -42
  251. package/dist/src/node/send.d.ts +0 -7
  252. package/dist/src/node/server.d.ts +0 -18
  253. package/dist/src/node/startTask.d.ts +0 -2
  254. package/dist/src/node/stream.d.ts +0 -15
  255. package/dist/src/node/taskEnd.d.ts +0 -2
  256. package/dist/src/node/traverse.d.ts +0 -17
  257. package/dist/src/node/watchFile.d.ts +0 -8
  258. package/dist/src/node/writeFile.d.ts +0 -8
  259. package/dist/src/node/ws.d.ts +0 -8
  260. package/dist/src/utils/visual/render/utils/batch/index.test.d.ts +0 -1
  261. package/dist/src/utils/visual/render/utils/index.test.d.ts +0 -1
  262. package/dist/test/binary.test.d.ts +0 -1
  263. package/dist/test/bridge.test.d.ts +0 -1
  264. package/dist/test/canvas.test.d.ts +0 -1
  265. package/dist/test/clearBr.test.d.ts +0 -1
  266. package/dist/test/cloneDeep.test.d.ts +0 -1
  267. package/dist/test/color.test.d.ts +0 -1
  268. package/dist/test/command.test.d.ts +0 -1
  269. package/dist/test/encodeUrl.test.d.ts +0 -1
  270. package/dist/test/escapeHtml.test.d.ts +0 -1
  271. package/dist/test/is-equal.test.d.ts +0 -1
  272. package/dist/test/mimeType.test.d.ts +0 -1
  273. package/dist/test/package-exports.test.d.ts +0 -1
  274. package/dist/test/server.test.d.ts +0 -1
  275. package/dist/test/status.test.d.ts +0 -1
  276. package/dist/test/sw.test.d.ts +0 -1
  277. package/dist/test/totp.test.d.ts +0 -1
  278. package/dist/test/tween.test.d.ts +0 -1
  279. package/dist/test/utils/async.test.d.ts +0 -1
  280. package/dist/test/utils/autosize.test.d.ts +0 -1
  281. package/dist/test/utils/color-grade.test.d.ts +0 -1
  282. package/dist/test/utils/compose.test.d.ts +0 -1
  283. package/dist/test/utils/event.test.d.ts +0 -1
  284. package/dist/test/utils/file-read.test.d.ts +0 -1
  285. package/dist/test/utils/format.test.d.ts +0 -1
  286. package/dist/test/utils/i18n.test.d.ts +0 -1
  287. package/dist/test/utils/idb-collection.test.d.ts +0 -1
  288. package/dist/test/utils/idb.test.d.ts +0 -1
  289. package/dist/test/utils/instrumentation.test.d.ts +0 -1
  290. package/dist/test/utils/interp.test.d.ts +0 -1
  291. package/dist/test/utils/lang.test.d.ts +0 -1
  292. package/dist/test/utils/locale-path.test.d.ts +0 -1
  293. package/dist/test/utils/media-query.test.d.ts +0 -1
  294. package/dist/test/utils/mergeObj.test.d.ts +0 -1
  295. package/dist/test/utils/number-parse.test.d.ts +0 -1
  296. package/dist/test/utils/paginate.test.d.ts +0 -1
  297. package/dist/test/utils/placement.test.d.ts +0 -1
  298. package/dist/test/utils/prefetch.test.d.ts +0 -1
  299. package/dist/test/utils/query-storage.test.d.ts +0 -1
  300. package/dist/test/utils/queue.test.d.ts +0 -1
  301. package/dist/test/utils/report-config.test.d.ts +0 -1
  302. package/dist/test/utils/report-image.test.d.ts +0 -1
  303. package/dist/test/utils/secure.test.d.ts +0 -1
  304. package/dist/test/utils/segment.test.d.ts +0 -1
  305. package/dist/test/utils/signal-once.test.d.ts +0 -1
  306. package/dist/test/utils/single-flight.test.d.ts +0 -1
  307. package/dist/test/utils/speech.test.d.ts +0 -1
  308. package/dist/test/utils/text-boundary.test.d.ts +0 -1
  309. package/dist/test/utils/time.test.d.ts +0 -1
  310. package/dist/test/utils/timing.test.d.ts +0 -1
  311. package/dist/test/utils/truncate.test.d.ts +0 -1
  312. package/dist/test/utils/visual/filter.test.d.ts +0 -1
  313. package/dist/test/utils/worker-client.test.d.ts +0 -1
  314. package/dist/test/utils/worker-serve.test.d.ts +0 -1
  315. package/dist/test/utils/zip.test.d.ts +0 -1
  316. package/dist/test/visual/math.test.d.ts +0 -1
  317. package/dist/test/visual-application.test.d.ts +0 -1
  318. package/dist/test/visual-batch.test.d.ts +0 -1
  319. package/dist/test/visual-math.test.d.ts +0 -1
  320. package/dist/test/vnode/index.d.ts +0 -1
  321. package/dist/test/vnode/server.d.ts +0 -2
  322. package/dist/test/vnode/vnode.d.ts +0 -1
  323. package/dist/test/vnode.test.d.ts +0 -1
  324. package/dist/test/websocket.test.d.ts +0 -1
  325. package/dist/test/writeFile.test.d.ts +0 -1
  326. package/dist/umd/index.umd.cjs +0 -1
  327. package/dist/umd/node/node.umd.cjs +0 -1
  328. package/dist/umd/utils/utils.umd.cjs +0 -1
  329. package/dist/utils-BNwhohXq.js +0 -1
  330. package/dist/vite.config.d.ts +0 -8
  331. package/dist/vitest.config.d.ts +0 -2
@@ -0,0 +1,53 @@
1
+ var o = () => {
2
+ try {
3
+ return typeof localStorage > "u" ? null : localStorage;
4
+ } catch {
5
+ return null;
6
+ }
7
+ }, l = (r, e) => {
8
+ try {
9
+ o()?.setItem(r, e);
10
+ } catch {
11
+ }
12
+ }, n = (r) => {
13
+ try {
14
+ return o()?.getItem(r) ?? "";
15
+ } catch {
16
+ return "";
17
+ }
18
+ }, u = (r) => {
19
+ try {
20
+ o()?.removeItem(r);
21
+ } catch {
22
+ }
23
+ }, m = (r = "") => {
24
+ const e = (t) => `${r}${t}`;
25
+ return {
26
+ keyOf: e,
27
+ get: (t, c) => {
28
+ const a = n(e(t));
29
+ if (!a) return c;
30
+ try {
31
+ return JSON.parse(a);
32
+ } catch {
33
+ return c;
34
+ }
35
+ },
36
+ set: (t, c) => {
37
+ let a;
38
+ try {
39
+ a = JSON.stringify(c);
40
+ } catch {
41
+ return !1;
42
+ }
43
+ return l(e(t), a), n(e(t)) === a;
44
+ },
45
+ remove: (t) => u(e(t))
46
+ };
47
+ };
48
+ export {
49
+ m as createStore,
50
+ n as localStorageGetItem,
51
+ u as localStorageRemoveItem,
52
+ l as localStorageSetItem
53
+ };
@@ -107,12 +107,6 @@ export interface TransformText {
107
107
  content: string;
108
108
  }
109
109
  export declare const transformText: (content: string | ArrayBuffer) => TransformText | undefined;
110
- /**
111
- * MD5 hash function implementation
112
- * @param str The string to hash
113
- * @returns The MD5 hash as a hexadecimal string
114
- */
115
- export declare const md5: (str: string) => string;
116
110
  /**
117
111
  * @description: A short random-ish base-36 string.
118
112
  *
@@ -0,0 +1,395 @@
1
+ import { detect as w } from "jschardet";
2
+ var m = (r = "", e = "", t = "") => {
3
+ const n = {}, o = r.split(e);
4
+ return o.length > 0 && o.forEach((a) => {
5
+ const [h = "", s = ""] = a.split(t);
6
+ u(h) && (n[u(h)] = u(s));
7
+ }), n;
8
+ }, E = (r = "") => {
9
+ if (r.length === 0) return "";
10
+ let e = "", t = 0;
11
+ for (const n of r)
12
+ if (!/\s/.test(n)) {
13
+ if (n === "<") {
14
+ t++;
15
+ continue;
16
+ }
17
+ if (n === ">" && t > 0) {
18
+ t--;
19
+ continue;
20
+ }
21
+ t === 0 && (e += n);
22
+ }
23
+ return e;
24
+ }, A = (r) => window.toString.call(r) === "[object String]";
25
+ function C(r = 8) {
26
+ const e = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678";
27
+ let n = "";
28
+ for (let o = 0; o < r; o++) n += e.charAt(Math.floor(Math.random() * 48));
29
+ return `${Date.now()}-${n}`;
30
+ }
31
+ var u = (r, e = {}) => {
32
+ const { urlencoded: t = !0 } = e, n = String.prototype.trim.call(r);
33
+ return t ? decodeURIComponent(n).replace(/"|'/g, "") : n.replace(/"|'/g, "");
34
+ };
35
+ function S(r, e) {
36
+ if (!r || !e) return [];
37
+ const t = [], n = new RegExp(e, "gi");
38
+ let o;
39
+ for (; (o = n.exec(r)) !== null; ) {
40
+ const s = o.index;
41
+ let c = s;
42
+ for (; c > 0; ) {
43
+ const i = r[c - 1];
44
+ if (i === "。" || i === "." || i === `
45
+ ` || i === "!" || i === "?" || i === "?") break;
46
+ c--;
47
+ }
48
+ let l = s + e.length;
49
+ for (; l < r.length; ) {
50
+ const i = r[l];
51
+ if (i === "。" || i === "." || i === `
52
+ ` || i === "!" || i === "?" || i === "?") {
53
+ l++;
54
+ break;
55
+ }
56
+ l++;
57
+ }
58
+ const f = r.slice(c, l).trim();
59
+ f && t.push({
60
+ sentence: f,
61
+ start: c,
62
+ end: l
63
+ });
64
+ }
65
+ const a = [], h = [];
66
+ t.sort((s, c) => c.sentence.length - s.sentence.length);
67
+ for (const s of t) h.some((c) => !(s.end <= c.start || s.start >= c.end)) || (a.push(s.sentence), h.push({
68
+ start: s.start,
69
+ end: s.end
70
+ }));
71
+ return [...new Set(a)];
72
+ }
73
+ var v = (r) => String(r), g = (r) => {
74
+ const e = Array.from(r).map((t) => String.fromCharCode(t)).join("");
75
+ return w(e).encoding || "utf-8";
76
+ }, R = (r) => {
77
+ const e = r instanceof Uint8Array ? r : new Uint8Array(r);
78
+ return new TextDecoder(g(e)).decode(e);
79
+ }, I = (r) => r.replace(/[!-~]/g, (e) => String.fromCharCode(e.charCodeAt(0) - 65248)).replace(/\u3000/g, " "), b = (r) => r.replace(/[!-~]/g, (e) => String.fromCharCode(e.charCodeAt(0) + 65248)).replace(/ /g, " "), M = (r, e) => {
80
+ const { length: t, position: n = "end", ellipsis: o = "…" } = typeof e == "number" ? { length: e } : e;
81
+ if (!r) return r;
82
+ const a = Array.from(r), h = Array.from(o);
83
+ if (a.length <= t) return r;
84
+ if (t <= h.length) return h.slice(0, Math.max(0, t)).join("");
85
+ const s = t - h.length;
86
+ if (n === "start") return o + a.slice(a.length - s).join("");
87
+ if (n === "middle") {
88
+ const c = Math.ceil(s / 2);
89
+ return a.slice(0, c).join("") + o + a.slice(a.length - (s - c)).join("");
90
+ }
91
+ return a.slice(0, s).join("") + o;
92
+ }, D = (r) => {
93
+ if (r instanceof ArrayBuffer) {
94
+ const e = new Uint8Array(r), t = String.fromCharCode.apply(null, e), n = w(t), o = n.encoding || "utf-8", a = new TextDecoder(o).decode(r);
95
+ if (n.encoding && a) return {
96
+ encoding: n.encoding,
97
+ content: a
98
+ };
99
+ }
100
+ }, U = (r = 8) => Math.random().toString(36).substring(2, r + 2), d = class extends Error {
101
+ code;
102
+ constructor(r, e) {
103
+ super(r), this.code = e, this.name = "MessageCodecError";
104
+ }
105
+ }, B = {
106
+ encode(r) {
107
+ try {
108
+ const e = JSON.stringify(r), t = new TextEncoder().encode(e);
109
+ let n = "";
110
+ const o = 32768;
111
+ for (let a = 0; a < t.length; a += o) n += String.fromCharCode.apply(null, Array.from(t.subarray(a, a + o)));
112
+ return btoa(n);
113
+ } catch {
114
+ return "";
115
+ }
116
+ },
117
+ decode(r) {
118
+ try {
119
+ const e = atob(r), t = new Uint8Array(e.length);
120
+ for (let o = 0; o < e.length; o++) t[o] = e.charCodeAt(o);
121
+ const n = new TextDecoder().decode(t);
122
+ return JSON.parse(n);
123
+ } catch {
124
+ return null;
125
+ }
126
+ },
127
+ async encodeFile(r) {
128
+ try {
129
+ const e = await r.arrayBuffer();
130
+ return this.encode({
131
+ type: "File",
132
+ name: r.name,
133
+ mimeType: r.type,
134
+ size: r.size,
135
+ lastModified: r.lastModified,
136
+ content: new Uint8Array(e)
137
+ });
138
+ } catch (e) {
139
+ throw new d(`Failed to encode file: ${e instanceof Error ? e.message : "Unknown error"}`, "FILE_ENCODE_ERROR");
140
+ }
141
+ },
142
+ decodeFile(r) {
143
+ try {
144
+ const e = this.decode(r);
145
+ if (e.type !== "File") throw new d(`Expected File type but got ${e.type}`, "INVALID_FILE_TYPE");
146
+ const t = e, n = t.content instanceof Uint8Array ? t.content.buffer.slice(0) : t.content;
147
+ return new File([n], t.name, {
148
+ type: t.mimeType,
149
+ lastModified: t.lastModified
150
+ });
151
+ } catch (e) {
152
+ throw e instanceof d ? e : new d(`Failed to decode file: ${e instanceof Error ? e.message : "Unknown error"}`, "FILE_DECODE_ERROR");
153
+ }
154
+ },
155
+ async encodeBlob(r) {
156
+ try {
157
+ const e = await r.arrayBuffer();
158
+ return this.encode({
159
+ type: "Blob",
160
+ mimeType: r.type,
161
+ size: r.size,
162
+ content: new Uint8Array(e)
163
+ });
164
+ } catch (e) {
165
+ throw new d(`Failed to encode blob: ${e instanceof Error ? e.message : "Unknown error"}`, "BLOB_ENCODE_ERROR");
166
+ }
167
+ },
168
+ decodeBlob(r) {
169
+ try {
170
+ const e = this.decode(r);
171
+ if (e.type !== "Blob") throw new d(`Expected Blob type but got ${e.type}`, "INVALID_BLOB_TYPE");
172
+ const t = e, n = t.content instanceof Uint8Array ? t.content.buffer.slice(0) : t.content;
173
+ return new Blob([n], { type: t.mimeType });
174
+ } catch (e) {
175
+ throw e instanceof d ? e : new d(`Failed to decode blob: ${e instanceof Error ? e.message : "Unknown error"}`, "BLOB_DECODE_ERROR");
176
+ }
177
+ },
178
+ encodeDate(r) {
179
+ try {
180
+ return this.encode({
181
+ type: "Date",
182
+ value: r.toISOString()
183
+ });
184
+ } catch (e) {
185
+ throw e;
186
+ }
187
+ },
188
+ decodeDate(r) {
189
+ try {
190
+ const e = this.decode(r);
191
+ if (e.type !== "Date") throw new Error("Invalid encoded Date data");
192
+ return new Date(e.value);
193
+ } catch (e) {
194
+ throw e;
195
+ }
196
+ },
197
+ encodeRegExp(r) {
198
+ try {
199
+ return this.encode({
200
+ type: "RegExp",
201
+ source: r.source,
202
+ flags: r.flags
203
+ });
204
+ } catch (e) {
205
+ throw e;
206
+ }
207
+ },
208
+ decodeRegExp(r) {
209
+ try {
210
+ const e = this.decode(r);
211
+ if (e.type !== "RegExp") throw new Error("Invalid encoded RegExp data");
212
+ return new RegExp(e.source, e.flags);
213
+ } catch (e) {
214
+ throw e;
215
+ }
216
+ },
217
+ encodeMap(r) {
218
+ try {
219
+ return this.encode({
220
+ type: "Map",
221
+ value: Array.from(r.entries())
222
+ });
223
+ } catch (e) {
224
+ throw e;
225
+ }
226
+ },
227
+ decodeMap(r) {
228
+ try {
229
+ const e = this.decode(r);
230
+ if (e.type !== "Map") throw new Error("Invalid encoded Map data");
231
+ return new Map(e.value);
232
+ } catch (e) {
233
+ throw e;
234
+ }
235
+ },
236
+ encodeSet(r) {
237
+ try {
238
+ return this.encode({
239
+ type: "Set",
240
+ value: Array.from(r)
241
+ });
242
+ } catch (e) {
243
+ throw e;
244
+ }
245
+ },
246
+ decodeSet(r) {
247
+ try {
248
+ const e = this.decode(r);
249
+ if (e.type !== "Set") throw new Error("Invalid encoded Set data");
250
+ return new Set(e.value);
251
+ } catch (e) {
252
+ throw e;
253
+ }
254
+ },
255
+ encodeError(r) {
256
+ try {
257
+ return this.encode({
258
+ type: "Error",
259
+ name: r.name,
260
+ message: r.message,
261
+ stack: r.stack
262
+ });
263
+ } catch (e) {
264
+ throw e;
265
+ }
266
+ },
267
+ decodeError(r) {
268
+ try {
269
+ const e = this.decode(r);
270
+ if (e.type !== "Error") throw new Error("Invalid encoded Error data");
271
+ const t = new Error(e.message);
272
+ return t.name = e.name, t.stack = e.stack, t;
273
+ } catch (e) {
274
+ throw e;
275
+ }
276
+ },
277
+ encodeArrayBuffer(r) {
278
+ try {
279
+ return this.encode({
280
+ type: "ArrayBuffer",
281
+ value: Array.from(new Uint8Array(r))
282
+ });
283
+ } catch (e) {
284
+ throw e;
285
+ }
286
+ },
287
+ decodeArrayBuffer(r) {
288
+ try {
289
+ const e = this.decode(r);
290
+ if (e.type !== "ArrayBuffer") throw new Error("Invalid encoded ArrayBuffer data");
291
+ return new Uint8Array(e.value).buffer;
292
+ } catch (e) {
293
+ throw e;
294
+ }
295
+ },
296
+ encodeTypedArray(r) {
297
+ try {
298
+ return this.encode({
299
+ type: "TypedArray",
300
+ constructor: r.constructor.name,
301
+ value: Array.from(new Uint8Array(r.buffer, r.byteOffset, r.byteLength))
302
+ });
303
+ } catch {
304
+ return "";
305
+ }
306
+ },
307
+ decodeTypedArray(r) {
308
+ try {
309
+ const e = this.decode(r);
310
+ if (e.type !== "TypedArray") throw new Error("Invalid encoded TypedArray data");
311
+ const t = window[e.constructor];
312
+ return new t(e.value);
313
+ } catch (e) {
314
+ throw e;
315
+ }
316
+ },
317
+ async encodeFileChunked(r, e = 16384) {
318
+ try {
319
+ if (e <= 0) throw new d("Chunk size must be greater than 0", "INVALID_CHUNK_SIZE");
320
+ const t = Math.ceil(r.size / e), n = [];
321
+ for (let o = 0; o < t; o++) {
322
+ const a = o * e, h = Math.min(a + e, r.size), s = await r.slice(a, h).arrayBuffer(), c = String.fromCharCode.apply(null, Array.from(new Uint8Array(s)));
323
+ n.push({
324
+ name: r.name,
325
+ type: r.type,
326
+ size: r.size,
327
+ lastModified: r.lastModified,
328
+ totalChunks: t,
329
+ chunkIndex: o,
330
+ data: c
331
+ });
332
+ }
333
+ return n;
334
+ } catch (t) {
335
+ throw t instanceof d ? t : new d(`Failed to encode file chunks: ${t instanceof Error ? t.message : "Unknown error"}`, "FILE_CHUNK_ENCODE_ERROR");
336
+ }
337
+ },
338
+ async decodeFileChunked(r) {
339
+ try {
340
+ if (!r.length) throw new d("No chunks provided", "NO_CHUNKS");
341
+ const { type: e, lastModified: t, totalChunks: n } = r[0];
342
+ if (r.length !== n) throw new d(`Missing chunks. Expected ${n}, got ${r.length}`, "INCOMPLETE_CHUNKS");
343
+ r.sort((c, l) => c.chunkIndex - l.chunkIndex);
344
+ for (let c = 0; c < r.length; c++) if (r[c].chunkIndex !== c) throw new d(`Invalid chunk index at position ${c}`, "INVALID_CHUNK_ORDER");
345
+ const o = await Promise.all(r.map(async (c) => {
346
+ const l = c.data, f = new Uint8Array(l.length);
347
+ for (let i = 0; i < l.length; i++) f[i] = l.charCodeAt(i);
348
+ return f;
349
+ })), a = r.reduce((c, l) => c + l.data.length, 0), h = new Uint8Array(a);
350
+ let s = 0;
351
+ for (const c of o)
352
+ h.set(c, s), s += c.length;
353
+ return new File([h.buffer.slice(0)], r[0].name, {
354
+ type: e,
355
+ lastModified: t
356
+ });
357
+ } catch (e) {
358
+ throw e instanceof d ? e : new d(`Failed to decode file chunks: ${e instanceof Error ? e.message : "Unknown error"}`, "FILE_CHUNK_DECODE_ERROR");
359
+ }
360
+ }
361
+ }, _ = (r, e, t = "…[truncated]") => r.length > e ? r.slice(0, e) + t : r, x = (r, e = "") => {
362
+ const t = Math.max(0, ...Array.from(r.matchAll(/`+/g), (o) => o[0].length)), n = "`".repeat(Math.max(3, t + 1));
363
+ return `${n}${e}
364
+ ${r}
365
+ ${n}`;
366
+ }, y = (r) => {
367
+ let e = 0, t = r.length;
368
+ for (; e < t && r[e] === "-"; ) e++;
369
+ for (; t > e && r[t - 1] === "-"; ) t--;
370
+ return r.slice(e, t);
371
+ }, F = (r, e = 60) => y(y(r.toLowerCase().replace(/[^a-z0-9]+/g, "-")).slice(0, e)), O = (r) => {
372
+ const e = String(r), t = /^[=+\-@]/.test(e) ? `'${e}` : e;
373
+ return /[",\n\r]/.test(t) ? `"${t.replace(/"/g, '""')}"` : t;
374
+ };
375
+ export {
376
+ B as MessageCodec,
377
+ R as arrayBufferToString,
378
+ g as checkEncoding,
379
+ E as clearBr,
380
+ u as clearStr,
381
+ O as csvEscape,
382
+ x as fenceCode,
383
+ S as getMatchingSentences,
384
+ U as getRandomString,
385
+ A as isString,
386
+ C as randomString,
387
+ F as slugify,
388
+ m as strParse,
389
+ b as toFullWidth,
390
+ I as toHalfWidth,
391
+ v as toString,
392
+ D as transformText,
393
+ M as truncate,
394
+ _ as truncateWithMarker
395
+ };
@@ -0,0 +1,29 @@
1
+ var d = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), y = "data-adopted-style", S = "data-adopted-sheet", a = (n, e, r) => {
2
+ if (typeof CSSStyleSheet > "u") return !1;
3
+ try {
4
+ if (!r.has(e)) {
5
+ const l = new CSSStyleSheet();
6
+ l.replaceSync(e), r.set(e, l);
7
+ }
8
+ const t = r.get(e);
9
+ return n.adoptedStyleSheets.includes(t) || (n.adoptedStyleSheets = [...n.adoptedStyleSheets, t]), !0;
10
+ } catch {
11
+ return !1;
12
+ }
13
+ }, f = (n, e, r = y) => {
14
+ if (!(typeof document > "u") && e && !a(n, e, d) && !n.querySelector(`style[${r}]`)) {
15
+ const t = document.createElement("style");
16
+ t.setAttribute(r, ""), t.textContent = e, n.appendChild(t);
17
+ }
18
+ }, i = (n, e, r = S) => {
19
+ if (!(typeof document > "u") && e && !a(n, e, u) && !Array.from(n.querySelectorAll(`style[${r}]`)).some((t) => t.textContent === e)) {
20
+ const t = document.createElement("style");
21
+ t.setAttribute(r, ""), t.textContent = e, n.appendChild(t);
22
+ }
23
+ };
24
+ export {
25
+ S as ADOPTED_SHEET_MARKER,
26
+ y as ADOPTED_STYLE_MARKER,
27
+ i as adoptSheetText,
28
+ f as adoptStyles
29
+ };
@@ -0,0 +1,58 @@
1
+ var i = "NEW_LISTENER", n = class {
2
+ _events = /* @__PURE__ */ new Map();
3
+ tap = (l, c) => {
4
+ this._events.get(l) && l !== /* @__PURE__ */ Symbol.for("NEW_LISTENER") && this.call(Symbol.for(i), l);
5
+ const a = this._events.get(l) || /* @__PURE__ */ new Set();
6
+ return typeof c == "function" ? a.add({
7
+ name: l,
8
+ callback: c
9
+ }) : a.add(c), this._events.set(l, a), this;
10
+ };
11
+ call = (l, ...c) => ((this._events.get(l) || /* @__PURE__ */ new Set()).forEach((a) => {
12
+ const { callback: s } = a;
13
+ s(...c);
14
+ }), this);
15
+ callSync = async (l, ...c) => {
16
+ const a = this._events.get(l) || /* @__PURE__ */ new Set();
17
+ for (const s of a) {
18
+ const { callback: t } = s;
19
+ await t(...c);
20
+ }
21
+ return this;
22
+ };
23
+ once = (l, c) => {
24
+ let a;
25
+ if (typeof c == "function") a = {
26
+ name: l,
27
+ callback: (...s) => {
28
+ c(...s), this.off(l, a);
29
+ },
30
+ initialCallback: c
31
+ };
32
+ else {
33
+ const { callback: s } = c;
34
+ a = {
35
+ name: l,
36
+ callback: (...t) => {
37
+ s(...t), this.off(l, a);
38
+ },
39
+ initialCallback: s
40
+ };
41
+ }
42
+ return this.tap(l, a), this;
43
+ };
44
+ off = (l, c) => {
45
+ const a = [...this._events.get(l) || /* @__PURE__ */ new Set()].filter((s) => {
46
+ if (typeof c == "function") return s.callback !== c && s.initialCallback !== c;
47
+ {
48
+ const { callback: t } = c;
49
+ return s.callback !== t && s.initialCallback !== t;
50
+ }
51
+ });
52
+ return this._events.set(l, new Set(a)), this;
53
+ };
54
+ };
55
+ export {
56
+ i as NEW_LISTENER,
57
+ n as SyncHook
58
+ };
@@ -0,0 +1,17 @@
1
+ function c(r, a = 300) {
2
+ let u = 0, l = null, n, t = null;
3
+ const s = () => {
4
+ if (l = null, !t) return;
5
+ const o = t, e = n;
6
+ t = null, n = void 0, u = Date.now(), r.apply(e, o);
7
+ }, i = function(...o) {
8
+ const e = a - (Date.now() - u);
9
+ n = this, t = o, e <= 0 ? (l !== null && (clearTimeout(l), l = null), s()) : l === null && (l = setTimeout(s, e));
10
+ };
11
+ return i.cancel = () => {
12
+ l !== null && clearTimeout(l), l = null, t = null, n = void 0;
13
+ }, i.pending = () => l !== null, i;
14
+ }
15
+ export {
16
+ c as throttle
17
+ };
@@ -29,18 +29,6 @@ export type DateInput = number | string | Date;
29
29
  * ```
30
30
  */
31
31
  export declare const formatDate: (value?: DateInput, pattern?: string) => string;
32
- /**
33
- * @description: Turn a timestamp into a `Date` carrying a `format` method.
34
- * @deprecated Use [`formatDate`](#formatdate). This returns a `Date` with an extra method
35
- * bolted onto the instance, which does not survive serialization, breaks `instanceof`-based
36
- * type narrowing on the extra property, and is untypeable beyond `Function`. Its `format`
37
- * now delegates to `formatDate`, so the token handling is fixed here too.
38
- * @param {number | string} timestamp omit for the current time
39
- * @return {Date & { format?: Function }}
40
- */
41
- export declare function timestampToTime(timestamp?: number | string): Date & {
42
- format?: Function;
43
- };
44
32
  /**
45
33
  * @description: Format an elapsed number of **seconds** as a colon-separated clock duration,
46
34
  * the shape media players use for a playhead: `mm:ss`, widening to `hh:mm:ss` past an hour.
@@ -61,15 +49,6 @@ export declare function timestampToTime(timestamp?: number | string): Date & {
61
49
  * ```
62
50
  */
63
51
  export declare const formatDuration: (seconds: number) => string;
64
- /**
65
- * @description: Format a number of seconds as a colon-separated duration
66
- * @deprecated Renamed to [`formatDuration`](#formatduration) — `timeFormat` said nothing about
67
- * *which* of the three time formats it was, and read backwards from its `formatDate` sibling.
68
- * This alias stays for compatibility and behaves identically.
69
- * @param {number} time
70
- * @return {string}
71
- */
72
- export declare const timeFormat: (time: number) => string;
73
52
  /**
74
53
  * @description: Parse a WebVTT/SRT-style timestamp — `HH:MM:SS.mmm` or `MM:SS.mmm` (the hour
75
54
  * component is optional) — into seconds. The inverse of [`formatDuration`](#formatduration),
@@ -0,0 +1,97 @@
1
+ var o = (e, r = 2) => String(e).padStart(r, "0"), l = (e) => e == null ? /* @__PURE__ */ new Date() : new Date(e), T = /YYYY|YY|MM|M|DD|D|HH|H|hh|h|mm|m|ss|s|SSS|A|a|\[([^[\]]*)]/g, w = (e, r = "YYYY-MM-DD HH:mm:ss") => {
2
+ const t = l(e);
3
+ if (Number.isNaN(t.getTime())) return "Invalid Date";
4
+ const n = t.getHours(), a = n % 12 || 12, m = {
5
+ YYYY: String(t.getFullYear()),
6
+ YY: o(t.getFullYear() % 100),
7
+ MM: o(t.getMonth() + 1),
8
+ M: String(t.getMonth() + 1),
9
+ DD: o(t.getDate()),
10
+ D: String(t.getDate()),
11
+ HH: o(n),
12
+ H: String(n),
13
+ hh: o(a),
14
+ h: String(a),
15
+ mm: o(t.getMinutes()),
16
+ m: String(t.getMinutes()),
17
+ ss: o(t.getSeconds()),
18
+ s: String(t.getSeconds()),
19
+ SSS: o(t.getMilliseconds(), 3),
20
+ A: n < 12 ? "AM" : "PM",
21
+ a: n < 12 ? "am" : "pm"
22
+ };
23
+ return r.replace(T, (d, u) => u !== void 0 ? u : m[d]);
24
+ }, y = (e) => {
25
+ if (!Number.isFinite(e)) return "";
26
+ const r = Math.max(0, Math.trunc(e)), t = Math.trunc(r / 3600), n = Math.trunc(r % 3600 / 60), a = o(r % 60);
27
+ return t === 0 ? `${o(n)}:${a}` : `${o(t)}:${o(n)}:${a}`;
28
+ }, b = /(?:(\d{2,}):)?(\d{2}):(\d{2})\.(\d{3})/, Y = (e) => {
29
+ const r = e.trim().match(b);
30
+ if (!r) return;
31
+ const [, t, n, a, m] = r;
32
+ return (t ? Number(t) * 3600 : 0) + Number(n) * 60 + Number(a) + Number(m) / 1e3;
33
+ }, H = (e) => {
34
+ const [r, t] = e.split("-->");
35
+ if (!r || !t) return;
36
+ const n = Y(r), a = Y(t.trim().split(/\s+/)[0] ?? "");
37
+ if (!(n === void 0 || a === void 0))
38
+ return {
39
+ start: n,
40
+ end: a
41
+ };
42
+ }, c = [
43
+ ["year", 315576e5],
44
+ ["month", 26298e5],
45
+ ["week", 6048e5],
46
+ ["day", 864e5],
47
+ ["hour", 36e5],
48
+ ["minute", 6e4],
49
+ ["second", 1e3]
50
+ ], D = {
51
+ year: "y",
52
+ quarter: "q",
53
+ month: "mo",
54
+ week: "w",
55
+ day: "d",
56
+ hour: "h",
57
+ minute: "m",
58
+ second: "s"
59
+ }, N = /* @__PURE__ */ new Map(), $ = (e, r, t) => {
60
+ if (typeof Intl > "u" || typeof Intl.RelativeTimeFormat != "function") return;
61
+ const n = `${String(e)}|${r}|${t}`;
62
+ let a = N.get(n);
63
+ return a || (a = new Intl.RelativeTimeFormat(e, {
64
+ style: r,
65
+ numeric: t
66
+ }), N.set(n, a)), a;
67
+ }, I = (e, r = {}) => {
68
+ const { now: t, locale: n, style: a = "long", numeric: m = "auto" } = r, d = l(e).getTime(), u = l(t).getTime();
69
+ if (Number.isNaN(d) || Number.isNaN(u)) return "";
70
+ const v = d - u, M = Math.abs(v);
71
+ let s = c.findIndex(([, h]) => M >= h);
72
+ s === -1 && (s = c.length - 1);
73
+ const p = v < 0 ? -1 : 1;
74
+ let [g, f] = c[s], i = p * Math.round(M / f);
75
+ if (s > 0 && Math.abs(i) * f >= c[s - 1][1] && ([g, f] = c[s - 1], i = p * Math.round(M / f)), a === "compact") return `${Math.abs(i)}${D[g] ?? ""}`;
76
+ const S = $(n, a, m);
77
+ if (!S) {
78
+ const h = D[g] ?? "";
79
+ return i < 0 ? `${Math.abs(i)}${h} ago` : `in ${i}${h}`;
80
+ }
81
+ return S.format(i, g);
82
+ }, F = () => {
83
+ if (typeof document < "u") return performance.now();
84
+ if (typeof process < "u") {
85
+ const [e, r] = process.hrtime();
86
+ return e * 1e3 + r / 1e6;
87
+ }
88
+ return Date.now();
89
+ };
90
+ export {
91
+ w as formatDate,
92
+ y as formatDuration,
93
+ I as formatRelative,
94
+ H as parseVttCueTiming,
95
+ Y as parseVttTimestamp,
96
+ F as performanceTime
97
+ };