@d0paminedriven/fs 10.1.0 → 11.0.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 (60) hide show
  1. package/dist/docs/index.d.ts +119 -0
  2. package/dist/docs/index.js +1027 -0
  3. package/dist/extract/client.d.ts +54 -0
  4. package/dist/extract/client.js +118 -0
  5. package/dist/extract/index.d.ts +69 -0
  6. package/dist/extract/index.js +622 -0
  7. package/dist/fs/index.d.ts +19 -55
  8. package/dist/fs/index.js +88 -19
  9. package/dist/fs-atomic/index.d.ts +28 -36
  10. package/dist/fs-atomic/index.js +88 -13
  11. package/dist/fs-base/index.d.ts +105 -111
  12. package/dist/fs-base/index.js +188 -12
  13. package/dist/fs-core/index.d.ts +20 -24
  14. package/dist/fs-core/index.js +44 -16
  15. package/dist/fs-fetch/index.d.ts +48 -62
  16. package/dist/fs-fetch/index.js +146 -18
  17. package/dist/fs-size/index.d.ts +16 -28
  18. package/dist/fs-size/index.js +64 -15
  19. package/dist/fs-tmp/index.d.ts +179 -192
  20. package/dist/fs-tmp/index.js +321 -17
  21. package/dist/images/index.d.ts +447 -0
  22. package/dist/images/index.js +899 -0
  23. package/dist/images/workup.d.ts +30 -0
  24. package/dist/images/workup.js +317 -0
  25. package/dist/index.d.ts +20 -22
  26. package/dist/index.js +20 -64
  27. package/dist/ld/index.d.ts +15 -13
  28. package/dist/ld/index.js +56 -6
  29. package/dist/mime/index.d.ts +299 -294
  30. package/dist/mime/index.js +348 -13
  31. package/dist/mixins/index.d.ts +34 -0
  32. package/dist/mixins/index.js +54 -0
  33. package/dist/types/index.d.ts +279 -215
  34. package/dist/types/index.js +11 -6
  35. package/dist/types/stream.d.ts +6 -4
  36. package/dist/types/stream.js +1 -1
  37. package/dist/url/index.d.ts +15 -18
  38. package/dist/url/index.js +21 -8
  39. package/dist/utils/index.d.ts +19 -23
  40. package/dist/utils/index.js +82 -7
  41. package/package.json +33 -13
  42. package/dist/chunk-4D2YBCI6.js +0 -163
  43. package/dist/chunk-5CACVZVF.js +0 -386
  44. package/dist/chunk-5H6GE5AO.js +0 -14
  45. package/dist/chunk-7QVYU63E.js +0 -7
  46. package/dist/chunk-DNR5ZI2T.js +0 -75
  47. package/dist/chunk-JZ6JNZZ6.js +0 -77
  48. package/dist/chunk-L2QMQOEJ.js +0 -366
  49. package/dist/chunk-NJHN5OE3.js +0 -33
  50. package/dist/chunk-OHKRQJZH.js +0 -82
  51. package/dist/chunk-OT5JEQKW.js +0 -139
  52. package/dist/chunk-PATMSIQK.js +0 -367
  53. package/dist/chunk-PB5A7ZFD.js +0 -79
  54. package/dist/chunk-VDKUXJE7.js +0 -240
  55. package/dist/chunk-Y5QWE4EG.js +0 -1335
  56. package/dist/chunk-YRCJWFZD.js +0 -107
  57. package/dist/image/index.d.ts +0 -182
  58. package/dist/image/index.js +0 -13
  59. package/dist/image/workup.d.ts +0 -40
  60. package/dist/image/workup.js +0 -12
@@ -1,366 +0,0 @@
1
- import {
2
- UrlService
3
- } from "./chunk-NJHN5OE3.js";
4
- import {
5
- __name
6
- } from "./chunk-7QVYU63E.js";
7
-
8
- // src/mime/index.ts
9
- var extMimeMap = {
10
- aac: ["audio/aac"],
11
- abw: ["application/x-abiword"],
12
- aces: ["image/aces"],
13
- apng: ["image/apng"],
14
- arc: ["application/x-freearc"],
15
- avci: ["image/avci"],
16
- avif: ["image/avif"],
17
- avi: ["video/x-msvideo"],
18
- azw: ["application/vnd.amazon.ebook"],
19
- bin: ["application/octet-stream", "multipart/voice-message"],
20
- bmp: ["image/bmp"],
21
- bz: ["application/x-bzip"],
22
- bz2: ["application/x-bzip2"],
23
- c: ["text/x-c"],
24
- cda: ["application/x-cdf"],
25
- cjs: ["text/javascript", "application/node"],
26
- cpp: ["text/x-c++"],
27
- cs: ["text/x-csharp"],
28
- csh: ["application/x-csh"],
29
- css: ["text/css"],
30
- csv: ["text/csv"],
31
- cur: ["image/x-icon"],
32
- doc: ["application/msword"],
33
- docx: [
34
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
35
- ],
36
- dpx: ["image/dpx"],
37
- emf: ["image/emf"],
38
- eot: ["application/vnd.ms-fontobject"],
39
- epub: ["application/epub+zip"],
40
- gif: ["image/gif"],
41
- glb: ["model/gltf-binary"],
42
- gltf: ["model/gltf+json"],
43
- gz: ["application/gzip", "application/x-gzip"],
44
- heic: ["image/heic"],
45
- hjif: ["haptics/hjif"],
46
- hmpg: ["haptics/hmpg"],
47
- htm: ["text/html"],
48
- html: ["text/html"],
49
- ico: ["image/vnd.microsoft.icon", "image/x-icon"],
50
- ics: ["text/calendar"],
51
- ivs: ["haptics/ivs"],
52
- ivt: ["haptics/ivs"],
53
- jar: ["application/java-archive"],
54
- java: ["text/x-java"],
55
- jfif: ["image/jpeg"],
56
- jif: ["image/jpeg"],
57
- jpe: ["image/jpeg"],
58
- jpeg: ["image/jpeg"],
59
- jpg: ["image/jpeg"],
60
- js: ["text/javascript", "application/node"],
61
- json: ["application/json"],
62
- jsonld: ["application/ld+json"],
63
- jsonc: ["application/json", "application/jsonc"],
64
- json5: ["application/json", "application/json5"],
65
- ktx: ["image/ktx"],
66
- ktx2: ["image/ktx2"],
67
- m3u8: ["application/vnd.apple.mpegurl"],
68
- m4a: ["audio/mp4"],
69
- m4s: ["video/mp4"],
70
- m4v: ["video/mp4"],
71
- md: ["text/markdown"],
72
- mdx: ["application/x-mdx"],
73
- mid: ["audio/midi"],
74
- midi: ["audio/x-midi"],
75
- mjs: ["text/javascript"],
76
- mp3: ["audio/mpeg"],
77
- mp4: ["video/mp4"],
78
- mpd: ["application/dash+xml"],
79
- mpeg: ["video/mpeg"],
80
- mpkg: ["application/vnd.apple.installer+xml"],
81
- mtlx: ["application/xml"],
82
- ndjson: ["application/x-ndjson"],
83
- node: ["application/node", "text/javascript"],
84
- obj: ["model/obj", "application/octet-stream", "text/plain"],
85
- odp: ["application/vnd.oasis.opendocument.presentation"],
86
- ods: ["application/vnd.oasis.opendocument.spreadsheet"],
87
- odt: ["application/vnd.oasis.opendocument.text"],
88
- oga: ["audio/ogg"],
89
- ogg: ["audio/ogg"],
90
- ogv: ["video/ogg"],
91
- ogx: ["application/ogg"],
92
- opus: ["audio/ogg"],
93
- otf: ["font/otf"],
94
- pk1: ["application/octet-stream"],
95
- png: ["image/png"],
96
- pdf: ["application/pdf"],
97
- php: ["text/x-php", "application/x-httpd-php"],
98
- pjp: ["image/jpeg"],
99
- pjpeg: ["image/jpeg"],
100
- pkpass: ["application/vnd.apple.pkpass"],
101
- ppt: ["application/vnd.ms-powerpoint"],
102
- pptx: [
103
- "application/vnd.openxmlformats-officedocument.presentationml.presentation"
104
- ],
105
- py: ["text/x-python", "text/x-script.python"],
106
- pyc: ["application/x-python-code"],
107
- rar: ["application/vnd.rar"],
108
- rb: ["text/x-ruby"],
109
- rs: ["text/rust"],
110
- rtf: ["application/rtf"],
111
- sh: ["application/x-sh"],
112
- sql: ["application/sql"],
113
- sse: ["text/event-stream"],
114
- svg: ["image/svg+xml"],
115
- tar: ["application/x-tar"],
116
- tex: ["text/x-tex"],
117
- tif: ["image/tiff"],
118
- tiff: ["image/tiff"],
119
- toml: ["application/toml"],
120
- ts: [
121
- "text/typescript",
122
- "application/typescript",
123
- "video/mp2t",
124
- "video/vnd.dlna.mpeg-tts"
125
- ],
126
- ttf: ["application/font-sfnt", "font/ttf"],
127
- txt: ["text/plain"],
128
- usdz: ["model/vnd.usdz+zip"],
129
- vsd: ["application/vnd.visio"],
130
- vtt: ["text/vtt"],
131
- wasm: ["application/wasm"],
132
- wav: ["audio/wav"],
133
- weba: ["audio/webm"],
134
- webm: ["video/webm"],
135
- webmanifest: ["application/manifest+json"],
136
- webp: ["image/webp"],
137
- woff: ["font/woff"],
138
- woff2: ["font/woff2"],
139
- xhtml: ["application/xhtml+xml"],
140
- xls: ["application/vnd.ms-excel"],
141
- xlsx: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
142
- xml: ["application/xml", "text/xml"],
143
- xul: ["application/vnd.mozilla.xul+xml"],
144
- yaml: ["application/yaml"],
145
- yml: ["application/yaml"],
146
- zip: ["application/zip", "application/x-zip-compressed"],
147
- "3gp": ["video/3gpp"],
148
- "3g2": ["video/3gpp2"],
149
- "7z": ["application/x-7z-compressed"]
150
- };
151
- var mimeToExt = {
152
- "application/dash+xml": ["mpd"],
153
- "application/epub+zip": ["epub"],
154
- "application/font-sfnt": ["ttf"],
155
- "application/gzip": ["gz"],
156
- "application/java-archive": ["jar"],
157
- "application/json": ["json", "jsonc"],
158
- "application/jsonc": ["jsonc"],
159
- "application/json5": ["json5"],
160
- "application/ld+json": ["jsonld"],
161
- "application/manifest+json": ["webmanifest"],
162
- "application/msword": ["doc"],
163
- "application/node": ["node", "js"],
164
- "application/octet-stream": ["bin", "obj"],
165
- "application/ogg": ["ogx"],
166
- "application/pdf": ["pdf"],
167
- "application/rtf": ["rtf"],
168
- "application/sql": ["sql"],
169
- "application/text": ["md"],
170
- "application/toml": ["toml"],
171
- "application/vnd.amazon.ebook": ["azw"],
172
- "application/vnd.apple.installer+xml": ["mpkg"],
173
- "application/vnd.apple.mpegurl": ["m3u8"],
174
- "application/vnd.apple.pkpass": ["pkpass"],
175
- "application/vnd.json5": ["json5"],
176
- "application/vnd.mozilla.xul+xml": ["xul"],
177
- "application/vnd.ms-excel": ["xls"],
178
- "application/vnd.ms-fontobject": ["eot"],
179
- "application/vnd.ms-powerpoint": ["ppt"],
180
- "application/vnd.oasis.opendocument.presentation": ["odp"],
181
- "application/vnd.oasis.opendocument.spreadsheet": ["ods"],
182
- "application/vnd.oasis.opendocument.text": ["odt"],
183
- "application/vnd.openxmlformats-officedocument.presentationml.presentation": [
184
- "pptx"
185
- ],
186
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ["xlsx"],
187
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document": [
188
- "docx"
189
- ],
190
- "application/vnd.rar": ["rar"],
191
- "application/vnd.visio": ["vsd"],
192
- "application/wasm": ["wasm"],
193
- "application/x-7z-compressed": ["7z"],
194
- "application/x-abiword": ["abw"],
195
- "application/x-bzip": ["bz"],
196
- "application/x-bzip2": ["bz2"],
197
- "application/x-cdf": ["cda"],
198
- "application/x-csh": ["csh"],
199
- "application/x-freearc": ["arc"],
200
- "application/x-gzip": ["gz"],
201
- "application/x-httpd-php": ["php"],
202
- "application/x-mdx": ["mdx"],
203
- "application/x-ndjson": ["ndjson"],
204
- "application/x-python-code": ["pyc"],
205
- "application/x-sh": ["sh"],
206
- "application/x-tar": ["tar"],
207
- "application/x-zip-compressed": ["zip"],
208
- "application/xhtml+xml": ["xhtml"],
209
- "application/xml": ["xml"],
210
- "application/yaml": ["yml", "yaml"],
211
- "application/zip": ["zip"],
212
- "audio/aac": ["aac"],
213
- "audio/midi": ["mid"],
214
- "audio/mp4": ["m4a"],
215
- "audio/mpeg": ["mp3"],
216
- "audio/ogg": ["opus", "ogg", "oga"],
217
- "audio/wav": ["wav"],
218
- "audio/webm": ["weba"],
219
- "audio/x-midi": ["midi"],
220
- "font/otf": ["otf"],
221
- "font/ttf": ["ttf"],
222
- "font/woff": ["woff"],
223
- "font/woff2": ["woff2"],
224
- "haptics/hjif": ["hjif"],
225
- "haptics/hmpg": ["hmpg"],
226
- "haptics/ivs": ["ivs", "ivt"],
227
- "image/aces": ["aces"],
228
- "image/apng": ["apng"],
229
- "image/avci": ["avci"],
230
- "image/avif": ["avif"],
231
- "image/bmp": ["bmp"],
232
- "image/dpx": ["dpx"],
233
- "image/emf": ["emf"],
234
- "image/gif": ["gif"],
235
- "image/heic": ["heic"],
236
- "image/jpeg": ["jpg", "jpeg"],
237
- "image/ktx": ["ktx"],
238
- "image/ktx2": ["ktx2"],
239
- "image/png": ["png"],
240
- "image/svg+xml": ["svg"],
241
- "image/tiff": ["tiff"],
242
- "image/vnd.microsoft.icon": ["ico"],
243
- "image/webp": ["webp"],
244
- "image/x-icon": ["ico", "cur"],
245
- "model/gltf-binary": ["glb"],
246
- "model/gltf+json": ["gltf"],
247
- "model/obj": ["obj"],
248
- "model/vnd.usdz+zip": ["usdz"],
249
- "multipart/voice-message": ["bin"],
250
- "text/calendar": ["ics"],
251
- "text/css": ["css"],
252
- "text/csv": ["csv"],
253
- "text/event-stream": ["sse", "ts", "rs", "py", "txt"],
254
- "text/html": ["html", "htm"],
255
- "text/javascript": ["cjs", "js", "mjs"],
256
- "text/markdown": ["md"],
257
- "text/plain": ["txt"],
258
- "text/rust": ["rs"],
259
- "text/typescript": ["ts"],
260
- "text/vtt": ["vtt"],
261
- "text/x-c": ["c"],
262
- "text/x-c++": ["cpp"],
263
- "text/x-csharp": ["cs"],
264
- "text/x-java": ["java"],
265
- "text/x-php": ["php"],
266
- "text/x-python": ["py"],
267
- "text/x-ruby": ["rb"],
268
- "text/x-script.python": ["py"],
269
- "text/x-tex": ["tex"],
270
- "text/xml": ["xml"],
271
- "video/3gpp": ["3gp"],
272
- "video/3gpp2": ["3g2"],
273
- "video/mp2t": ["ts"],
274
- "video/mp4": ["mp4", "m4v", "m4s"],
275
- "video/mpeg": ["mpeg"],
276
- "video/ogg": ["ogv"],
277
- "video/vnd.dlna.mpeg-tts": ["ts"],
278
- "video/webm": ["weba"],
279
- "video/x-msvideo": ["avi"]
280
- };
281
- var MimeService = class extends UrlService {
282
- static {
283
- __name(this, "MimeService");
284
- }
285
- constructor() {
286
- super();
287
- }
288
- mimeTypeObj = extMimeMap;
289
- toExtObj = mimeToExt;
290
- compareMimeToExt(p = "mime") {
291
- let a = {};
292
- if (p === "mime") {
293
- for (const [_key, vals] of Object.entries(extMimeMap)) {
294
- for (const val of vals) {
295
- a[val] = (a[val] ?? 0) + 1;
296
- }
297
- }
298
- for (const [key, _val] of Object.entries(mimeToExt)) {
299
- a[key] = (a[key] ?? 0) + 1;
300
- }
301
- return Object.fromEntries(
302
- Object.entries(a).sort(([_a, aa], [_b, bb]) => bb - aa)
303
- );
304
- } else {
305
- for (const [_key, vals] of Object.entries(mimeToExt)) {
306
- for (const val of vals) {
307
- a[val] = (a[val] ?? 0) + 1;
308
- }
309
- }
310
- for (const [key, _val] of Object.entries(extMimeMap)) {
311
- a[key] = (a[key] ?? 0) + 1;
312
- }
313
- return Object.fromEntries(
314
- Object.entries(a).sort(([_a, aa], [_b, bb]) => bb - aa)
315
- );
316
- }
317
- }
318
- mimeToExt(mime) {
319
- const extensions = this.toExtObj[mime];
320
- if (extensions.length === 1) return extensions[0];
321
- if (extensions.length === 2) {
322
- return extensions[0];
323
- }
324
- if (extensions.length === 3) {
325
- if (mime === "audio/ogg") return "ogg";
326
- return extensions[0];
327
- }
328
- if (extensions.length === 5) {
329
- return extensions[0];
330
- }
331
- return extensions[0];
332
- }
333
- assetType(url) {
334
- const parsed = this.parseUrl(url);
335
- if (!parsed) return void 0;
336
- const ext = parsed.pathname.split(/([.])/g)?.reverse()?.[0]?.toLowerCase();
337
- return ext && ext in this.mimeTypeObj ? ext : void 0;
338
- }
339
- getMimes(ext) {
340
- return this.mimeTypeObj[ext];
341
- }
342
- getMimeFor(ext, opts) {
343
- const mimes = this.getMimes(ext);
344
- if (mimes.length === 1) return mimes[0];
345
- if (opts?.type) {
346
- const found = mimes.find((mime) => mime.startsWith(opts.type + "/"));
347
- return found ?? mimes[0];
348
- }
349
- return mimes[0];
350
- }
351
- isMimeFor(ext, mime) {
352
- return this.getMimes(ext).find((s) => s === mime);
353
- }
354
- getMimeTypeForPath(path, opts) {
355
- const ext = this.assetType(path);
356
- if (!ext) return "application/octet-stream";
357
- return this.getMimeFor(ext, opts);
358
- }
359
- };
360
-
361
- export {
362
- extMimeMap,
363
- mimeToExt,
364
- MimeService
365
- };
366
- //# sourceMappingURL=chunk-L2QMQOEJ.js.map
@@ -1,33 +0,0 @@
1
- import {
2
- UtilsService
3
- } from "./chunk-OT5JEQKW.js";
4
- import {
5
- __name
6
- } from "./chunk-7QVYU63E.js";
7
-
8
- // src/url/index.ts
9
- var UrlService = class extends UtilsService {
10
- static {
11
- __name(this, "UrlService");
12
- }
13
- URL_REGEX = /^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
14
- parseUrl(url) {
15
- const parsed = this.URL_REGEX.exec(url);
16
- if (parsed) {
17
- return {
18
- href: parsed[0],
19
- protocol: parsed[1] ?? "",
20
- baseUrl: `${parsed[1]}${parsed[3]}`,
21
- host: parsed[4] ?? "",
22
- pathname: parsed[5] ?? "",
23
- search: parsed[6] ?? "",
24
- hash: parsed[8] ?? ""
25
- };
26
- } else return null;
27
- }
28
- };
29
-
30
- export {
31
- UrlService
32
- };
33
- //# sourceMappingURL=chunk-NJHN5OE3.js.map
@@ -1,82 +0,0 @@
1
- import {
2
- FsSize
3
- } from "./chunk-DNR5ZI2T.js";
4
- import {
5
- __name
6
- } from "./chunk-7QVYU63E.js";
7
-
8
- // src/fs-core/index.ts
9
- import fsSync from "fs";
10
- import fsAsync from "fs/promises";
11
- import { relative } from "path";
12
- var FsCore = class extends FsSize {
13
- constructor(cwd) {
14
- super(cwd ??= process.cwd());
15
- this.cwd = cwd;
16
- }
17
- static {
18
- __name(this, "FsCore");
19
- }
20
- withWs(path, data, options) {
21
- try {
22
- if (/\//g.test(path) === true) {
23
- return this.generateDirIfDNE(this.pathHandler(path), {
24
- recursive: true
25
- });
26
- } else return path;
27
- } catch (error) {
28
- console.error(
29
- `[withWs error]: `.concat(
30
- typeof error === "string" ? error : JSON.stringify(error, null, 2)
31
- )
32
- );
33
- } finally {
34
- return fsSync.createWriteStream(
35
- relative(this.cwd ?? process.cwd(), path),
36
- typeof options !== "undefined" ? typeof options === "object" ? options : options : { autoClose: true }
37
- ).write(data);
38
- }
39
- }
40
- async withWsAsync(path, data, options) {
41
- try {
42
- if (/\//g.test(path) === true) {
43
- return this.generateDirIfDNE(this.pathHandler(path), {
44
- recursive: true
45
- });
46
- } else return path;
47
- } catch (error) {
48
- console.error(
49
- `[withWs error]: `.concat(
50
- typeof error === "string" ? error : JSON.stringify(error, null, 2)
51
- )
52
- );
53
- } finally {
54
- return fsSync.createWriteStream(
55
- relative(this.cwd ?? process.cwd(), path),
56
- typeof options !== "undefined" ? typeof options === "object" ? options : options : { autoClose: true }
57
- ).write(data);
58
- }
59
- }
60
- writeFileAsync = /* @__PURE__ */ __name(async (path, data, options = {}) => {
61
- try {
62
- if (/\//g.test(path) === true)
63
- return this.generateDirIfDNE(this.pathHandler(path), {
64
- recursive: true
65
- });
66
- else return path;
67
- } catch (error) {
68
- console.error(
69
- `[writeFileAsync error]: `.concat(
70
- error instanceof Error ? error.message : typeof error === "string" ? error : JSON.stringify(error, null, 2)
71
- )
72
- );
73
- } finally {
74
- return fsAsync.writeFile(relative(this.cwd, path), data, options);
75
- }
76
- }, "writeFileAsync");
77
- };
78
-
79
- export {
80
- FsCore
81
- };
82
- //# sourceMappingURL=chunk-OHKRQJZH.js.map
@@ -1,139 +0,0 @@
1
- import {
2
- LevenshteinDistance
3
- } from "./chunk-PB5A7ZFD.js";
4
- import {
5
- __name
6
- } from "./chunk-7QVYU63E.js";
7
-
8
- // src/utils/index.ts
9
- var UtilsService = class extends LevenshteinDistance {
10
- static {
11
- __name(this, "UtilsService");
12
- }
13
- chunkArray(arr, maxChunkLength) {
14
- const chunks = Array.of();
15
- let currentChunkLength = 0;
16
- let currentChunk = Array.of();
17
- for (const [index, val] of arr.entries()) {
18
- if (val.length + currentChunkLength >= maxChunkLength) {
19
- if (currentChunk.length) {
20
- chunks.push(currentChunk);
21
- }
22
- currentChunkLength = val.length;
23
- currentChunk = [val];
24
- } else {
25
- currentChunk.push(val);
26
- currentChunkLength += val.length + 1;
27
- }
28
- if (arr.length === index + 1) {
29
- chunks.push(currentChunk);
30
- }
31
- }
32
- return chunks.length ? chunks : [arr];
33
- }
34
- b64ToBlob(b64Data) {
35
- {
36
- const sliceSize = 512;
37
- const typeMatch = /^data:((?:image|application|haptics|video|text|font|model|audio|multipart)\/[A-Za-z0-9+-.]+(?:;[^,]+)*);base64,(.+)$/i.exec(
38
- b64Data
39
- );
40
- if (!typeMatch) {
41
- throw new Error(`${b64Data} is not a valid data Url`);
42
- }
43
- const type = typeMatch[1];
44
- const base64Data = typeMatch?.[2] ?? "";
45
- const byteCharacters = Buffer.from(base64Data, "base64").toString(
46
- "binary"
47
- );
48
- const byteArrays = Array.of();
49
- for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
50
- const slice = byteCharacters.slice(offset, offset + sliceSize);
51
- const byteNumbers = new Array(slice.length);
52
- for (let i = 0; i < slice.length; i++) {
53
- byteNumbers[i] = slice.charCodeAt(i);
54
- }
55
- const byteArray = new Uint8Array(byteNumbers);
56
- byteArrays.push(byteArray);
57
- }
58
- const blob = new Blob(byteArrays, { type });
59
- return blob;
60
- }
61
- }
62
- arrToArrOfArrs = /* @__PURE__ */ __name(({
63
- arrToFragment = Array.of(),
64
- arrOfArrsAggregator = Array.of(),
65
- interval
66
- }) => new Promise(
67
- (resolve, _reject) => resolve(
68
- ((interval2) => {
69
- for (let i = 0; i <= arrToFragment.length; i++) {
70
- if ((i % interval2 === 0 || i === 0) && i <= arrToFragment.length) {
71
- let segment = arrToFragment.slice(i, i + interval2);
72
- arrOfArrsAggregator.push(segment);
73
- }
74
- }
75
- })(interval)
76
- )
77
- ).then((_) => arrOfArrsAggregator), "arrToArrOfArrs");
78
- extractTuple(obj, props) {
79
- return [props, obj[props]];
80
- }
81
- sort(obj, order) {
82
- return Object.fromEntries(
83
- Object.entries(obj).sort(
84
- ([a, _aa], [b, _bb]) => order === "DESC" ? b.localeCompare(a) - a.localeCompare(b) : a.localeCompare(b) - b.localeCompare(a)
85
- )
86
- );
87
- }
88
- excludeTargeted = /* @__PURE__ */ __name((obj, props, sort) => {
89
- const resolve = Object.fromEntries(
90
- Object.entries(obj).map(([key, val]) => {
91
- if (props.includes(key)) {
92
- return ["omit", "omit"];
93
- } else return [key, val];
94
- }).filter(([t, _v]) => /omit/.test(t) === false)
95
- );
96
- return typeof sort !== "undefined" ? this.sort(resolve, sort) : resolve;
97
- }, "excludeTargeted");
98
- includeTargeted = /* @__PURE__ */ __name((obj, props, sort) => {
99
- const resolve = Object.fromEntries(
100
- props.map((val) => this.extractTuple(obj, val))
101
- );
102
- return typeof sort !== "undefined" ? this.sort(resolve, sort) : resolve;
103
- }, "includeTargeted");
104
- countsSorter = /* @__PURE__ */ __name((counter, keySort = "ASC", valSort = "DESC") => Object.fromEntries(
105
- Array.from(Object.entries(counter)).sort(
106
- ([aStr, _aNum], [bStr, _bNum]) => keySort === "DESC" ? bStr.localeCompare(aStr) - aStr.localeCompare(bStr) : aStr.localeCompare(bStr) - bStr.localeCompare(aStr)
107
- ).sort(([aStr, aNum], [bStr, bNum]) => {
108
- if (typeof (aNum && bNum) === "number") {
109
- return valSort === "ASC" ? aNum - bNum : bNum - aNum;
110
- } else if (typeof (aNum && bNum) === "string") {
111
- return valSort === "ASC" ? aStr.localeCompare(bStr) - bStr.localeCompare(aStr) : bStr.localeCompare(aStr) - aStr.localeCompare(bStr);
112
- } else
113
- throw new Error(
114
- "only Record<string, string> and Record<string,number> types supported"
115
- );
116
- })
117
- ), "countsSorter");
118
- range(from, to) {
119
- const values = Array.of();
120
- for (let i = from; i < to; i++) {
121
- values.push(i);
122
- }
123
- return values;
124
- }
125
- isPrimeNumber = /* @__PURE__ */ __name((n) => {
126
- for (let i = 2; n > i; i++) {
127
- if (n % i === 0) {
128
- return false;
129
- }
130
- }
131
- return n > 1;
132
- }, "isPrimeNumber");
133
- acceptor = /* @__PURE__ */ __name((num) => [...Array(num !== 0 ? num : this.range(num = -101, num = 101)).keys()].reverse().filter(this.isPrimeNumber), "acceptor");
134
- };
135
-
136
- export {
137
- UtilsService
138
- };
139
- //# sourceMappingURL=chunk-OT5JEQKW.js.map