@putkoff/abstract-utilities 1.0.70 → 1.0.93
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.
- package/dist/cjs/index.js +247 -341
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/server.js +342 -0
- package/dist/cjs/server.js.map +1 -0
- package/dist/esm/index.js +508 -1156
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/server.js +305 -0
- package/dist/esm/server.js.map +1 -0
- package/dist/types/functions/auth_utils/imports.d.ts +0 -0
- package/dist/types/functions/auth_utils/index.d.ts +0 -0
- package/dist/types/functions/auth_utils/src/index.d.ts +0 -0
- package/dist/types/functions/auth_utils/src/token_utils.d.ts +0 -0
- package/dist/types/functions/config_utils/imports.d.ts +0 -0
- package/dist/types/functions/config_utils/index.d.ts +0 -0
- package/dist/types/functions/config_utils/src/config_utils.d.ts +0 -0
- package/dist/types/functions/config_utils/src/index.d.ts +0 -0
- package/dist/types/functions/constants_utils/index.d.ts +0 -0
- package/dist/types/functions/constants_utils/src/constants.d.ts +0 -0
- package/dist/types/functions/constants_utils/src/index.d.ts +0 -0
- package/dist/types/functions/env_utils/imports.d.ts +0 -0
- package/dist/types/functions/env_utils/index.d.ts +0 -0
- package/dist/types/functions/env_utils/src/index.d.ts +0 -0
- package/dist/types/functions/env_utils/src/window_utils.d.ts +0 -0
- package/dist/types/functions/fetch_utils/imports.d.ts +0 -0
- package/dist/types/functions/fetch_utils/index.d.ts +0 -0
- package/dist/types/functions/fetch_utils/src/fetch_utils.d.ts +0 -0
- package/dist/types/functions/fetch_utils/src/index.d.ts +0 -0
- package/dist/types/functions/fetch_utils/src/url_utils.d.ts +0 -0
- package/dist/types/functions/fetch_utils/src/utils.d.ts +0 -0
- package/dist/types/functions/index.d.ts +0 -0
- package/dist/types/functions/math_utils/constants.d.ts +0 -0
- package/dist/types/functions/math_utils/conversions.d.ts +0 -0
- package/dist/types/functions/math_utils/index.d.ts +0 -0
- package/dist/types/functions/math_utils/safe_math.d.ts +0 -0
- package/dist/types/functions/math_utils/scaleInterfaces.d.ts +0 -0
- package/dist/types/functions/path_utils/imports.d.ts +0 -0
- package/dist/types/functions/path_utils/index.d.ts +0 -0
- package/dist/types/functions/path_utils/src/base_dirs.d.ts +0 -0
- package/dist/types/functions/path_utils/src/function_dirs.d.ts +0 -0
- package/dist/types/functions/path_utils/src/index.d.ts +0 -0
- package/dist/types/functions/path_utils/src/misc_dirs.d.ts +0 -0
- package/dist/types/functions/path_utils/src/path_utils.d.ts +0 -0
- package/dist/types/functions/path_utils/src/paths.d.ts +0 -0
- package/dist/types/functions/path_utils/src/src_dirs.d.ts +0 -0
- package/dist/types/functions/read_utils/imports.d.ts +0 -0
- package/dist/types/functions/read_utils/index.d.ts +0 -0
- package/dist/types/functions/read_utils/src/index.d.ts +3 -1
- package/dist/types/functions/read_utils/src/readJsonFile.browser.d.ts +1 -0
- package/dist/types/functions/read_utils/src/readJsonFile.d.ts +2 -0
- package/dist/types/functions/read_utils/src/readJsonFile.node.d.ts +1 -0
- package/dist/types/functions/rndm_utils/imports.d.ts +0 -0
- package/dist/types/functions/rndm_utils/index.d.ts +0 -0
- package/dist/types/functions/rndm_utils/src/index.d.ts +0 -0
- package/dist/types/functions/rndm_utils/src/utils.d.ts +0 -0
- package/dist/types/functions/safe_utils/imports.d.ts +0 -0
- package/dist/types/functions/safe_utils/index.d.ts +0 -0
- package/dist/types/functions/safe_utils/src/index.d.ts +0 -0
- package/dist/types/functions/safe_utils/src/safe_document.d.ts +0 -0
- package/dist/types/functions/safe_utils/src/safe_globals.d.ts +0 -0
- package/dist/types/functions/safe_utils/src/safe_storage.d.ts +0 -0
- package/dist/types/functions/safe_utils/src/safe_window.d.ts +0 -0
- package/dist/types/functions/string_utils/index.d.ts +0 -0
- package/dist/types/functions/string_utils/src/index.d.ts +0 -0
- package/dist/types/functions/string_utils/src/string_utils.d.ts +0 -0
- package/dist/types/functions/type_utils/imports.d.ts +0 -0
- package/dist/types/functions/type_utils/index.d.ts +0 -0
- package/dist/types/functions/type_utils/src/clean_utils.d.ts +0 -0
- package/dist/types/functions/type_utils/src/ensure_utils.d.ts +0 -0
- package/dist/types/functions/type_utils/src/imports.d.ts +0 -0
- package/dist/types/functions/type_utils/src/index.d.ts +0 -0
- package/dist/types/functions/type_utils/src/json_utils.d.ts +0 -0
- package/dist/types/functions/type_utils/src/list_utils.d.ts +0 -0
- package/dist/types/functions/type_utils/src/mime_utils.d.ts +0 -0
- package/dist/types/functions/type_utils/src/type_utils.d.ts +0 -0
- package/dist/types/functions/variable_utils/imports.d.ts +0 -0
- package/dist/types/functions/variable_utils/index.d.ts +0 -0
- package/dist/types/functions/variable_utils/src/index.d.ts +0 -0
- package/dist/types/functions/variable_utils/src/variable_utils.d.ts +0 -0
- package/dist/types/index.d.ts +0 -0
- package/dist/types/types/index.d.ts +0 -0
- package/dist/types/types/src/Files.d.ts +0 -0
- package/dist/types/types/src/index.d.ts +0 -0
- package/dist/types/types/src/login.d.ts +0 -0
- package/dist/types/types/src/logout.d.ts +0 -0
- package/dist/types/types/src/utils.d.ts +0 -0
- package/dist/types/utils/imports.d.ts +0 -0
- package/dist/types/utils/index.d.ts +0 -0
- package/dist/types/utils/src/Input.d.ts +0 -0
- package/dist/types/utils/src/config.d.ts +0 -0
- package/dist/types/utils/src/index.d.ts +0 -0
- package/package.json +2 -17
- package/dist/index.d.ts +0 -813
- package/dist/types/functions/read_utils/src/utils.d.ts +0 -8
- package/dist/types/functions/ui_utils/imports.d.ts +0 -4
- package/dist/types/functions/ui_utils/index.d.ts +0 -1
- package/dist/types/functions/ui_utils/src/button.d.ts +0 -5
- package/dist/types/functions/ui_utils/src/checkbox.d.ts +0 -4
- package/dist/types/functions/ui_utils/src/index.d.ts +0 -4
- package/dist/types/functions/ui_utils/src/input.d.ts +0 -5
- package/dist/types/functions/ui_utils/src/spinner.d.ts +0 -1
- package/dist/types/types/src/ChangePassword.d.ts +0 -16
- package/dist/types/ui/Navbar/DropDowns/DropDownElements.d.ts +0 -8
- package/dist/types/ui/Navbar/DropDowns/ForumsDropdown.d.ts +0 -2
- package/dist/types/ui/Navbar/DropDowns/index.d.ts +0 -3
- package/dist/types/ui/Navbar/NavBar.d.ts +0 -8
- package/dist/types/ui/Navbar/index.d.ts +0 -3
- package/dist/types/ui/index.d.ts +0 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,36 +1,28 @@
|
|
|
1
|
+
import path$1 from 'path';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import * as fsp from 'node:fs/promises';
|
|
5
|
+
import * as path from 'node:path';
|
|
6
|
+
import { isAbsolute, resolve } from 'node:path';
|
|
1
7
|
import require$$0$2 from 'util';
|
|
2
8
|
import require$$0$1 from 'os';
|
|
3
9
|
import require$$0$3 from 'stream';
|
|
4
10
|
import require$$0$4 from 'buffer';
|
|
5
11
|
import require$$0$5 from 'events';
|
|
12
|
+
import require$$0$6 from 'fs';
|
|
6
13
|
import require$$3 from 'zlib';
|
|
7
14
|
import require$$1 from 'tty';
|
|
8
15
|
import require$$1$1 from 'string_decoder';
|
|
9
16
|
import require$$0$7 from 'http';
|
|
10
17
|
import require$$1$3 from 'https';
|
|
11
18
|
|
|
12
|
-
function _mergeNamespaces(n, m) {
|
|
13
|
-
m.forEach(function (e) {
|
|
14
|
-
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
15
|
-
if (k !== 'default' && !(k in n)) {
|
|
16
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function () { return e[k]; }
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
return Object.freeze(n);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
19
|
/** True if token is structurally bad or its exp ≤ now. */
|
|
28
20
|
function isTokenExpired(token) {
|
|
29
21
|
try {
|
|
30
22
|
const payload = decodeJwt(token);
|
|
31
23
|
return Date.now() / 1000 >= payload.exp;
|
|
32
24
|
}
|
|
33
|
-
catch
|
|
25
|
+
catch {
|
|
34
26
|
return true; // treat malformed token as expired
|
|
35
27
|
}
|
|
36
28
|
}
|
|
@@ -105,50 +97,6 @@ function get_window_parts() {
|
|
|
105
97
|
return null;
|
|
106
98
|
}
|
|
107
99
|
|
|
108
|
-
/******************************************************************************
|
|
109
|
-
Copyright (c) Microsoft Corporation.
|
|
110
|
-
|
|
111
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
112
|
-
purpose with or without fee is hereby granted.
|
|
113
|
-
|
|
114
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
115
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
116
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
117
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
118
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
119
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
120
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
121
|
-
***************************************************************************** */
|
|
122
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
function __rest(s, e) {
|
|
126
|
-
var t = {};
|
|
127
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
128
|
-
t[p] = s[p];
|
|
129
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
130
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
131
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
132
|
-
t[p[i]] = s[p[i]];
|
|
133
|
-
}
|
|
134
|
-
return t;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
138
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
139
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
140
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
141
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
142
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
143
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
148
|
-
var e = new Error(message);
|
|
149
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
100
|
/**
|
|
153
101
|
* Unwraps nested { result } fields until you hit a non-object or no more "result" keys.
|
|
154
102
|
*/
|
|
@@ -172,13 +120,13 @@ function getMethod(method = null, body = null) {
|
|
|
172
120
|
}
|
|
173
121
|
// Gets headers, skips JSON headers when body is FormData
|
|
174
122
|
function getHeaders(headers = {}, method = null, body = null) {
|
|
175
|
-
const result =
|
|
123
|
+
const result = { ...headers };
|
|
176
124
|
// let browser set boundary
|
|
177
125
|
if (body instanceof FormData) {
|
|
178
126
|
return result;
|
|
179
127
|
}
|
|
180
|
-
const upper = method
|
|
181
|
-
if (['POST', 'PUT', 'PATCH'].includes(upper
|
|
128
|
+
const upper = method?.toUpperCase();
|
|
129
|
+
if (['POST', 'PUT', 'PATCH'].includes(upper ?? '') &&
|
|
182
130
|
!result['Content-Type']) {
|
|
183
131
|
result['Content-Type'] = 'application/json';
|
|
184
132
|
}
|
|
@@ -214,18 +162,16 @@ function getFetchVars(headers = null, method = null, body = null) {
|
|
|
214
162
|
* parseResult no longer needs to worry about JSON vs HTML redirect errors;
|
|
215
163
|
* all 401/403 have already been handled above.
|
|
216
164
|
*/
|
|
217
|
-
function parseResult(res) {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
return res.json();
|
|
228
|
-
});
|
|
165
|
+
async function parseResult(res) {
|
|
166
|
+
// runs checkResponse first, will throw if session is expired
|
|
167
|
+
res = checkResponse(res);
|
|
168
|
+
if (!res.ok) {
|
|
169
|
+
// for any other non-401 errors, you can still surface them
|
|
170
|
+
const errorText = await res.text();
|
|
171
|
+
throw new Error(errorText || res.statusText);
|
|
172
|
+
}
|
|
173
|
+
// now safely parse JSON
|
|
174
|
+
return res.json();
|
|
229
175
|
}
|
|
230
176
|
/**
|
|
231
177
|
* Intercept 401/403 and force a clean redirect to login
|
|
@@ -243,77 +189,155 @@ function checkResponse(res) {
|
|
|
243
189
|
return res;
|
|
244
190
|
}
|
|
245
191
|
|
|
246
|
-
function fetchIt(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
192
|
+
async function fetchIt(endpoint, body = null, method = null, headers = null, blob = false, configUrl = false, withCredentials = true, returnJson = true, returnReult = true) {
|
|
193
|
+
method = (method || "GET").toUpperCase();
|
|
194
|
+
// 2) choose the URL
|
|
195
|
+
const url = endpoint;
|
|
196
|
+
// 3) prepare headers & body
|
|
197
|
+
headers = {
|
|
198
|
+
...(body instanceof FormData ? {} : { "Content-Type": "application/json" }),
|
|
199
|
+
...headers,
|
|
200
|
+
};
|
|
201
|
+
const opts = {
|
|
202
|
+
method,
|
|
203
|
+
credentials: withCredentials ? "include" : "same-origin",
|
|
204
|
+
headers,
|
|
205
|
+
body: body instanceof FormData
|
|
206
|
+
? body
|
|
207
|
+
: body != null && method !== "GET"
|
|
208
|
+
? JSON.stringify(body)
|
|
209
|
+
: undefined,
|
|
210
|
+
};
|
|
211
|
+
console.debug("➡️ secureFetchIt →", url, opts);
|
|
212
|
+
const res = await fetch(url, opts);
|
|
213
|
+
if (!res.ok) {
|
|
214
|
+
const err = await res.text();
|
|
215
|
+
throw new Error(`HTTP ${res.status}: ${err}`);
|
|
216
|
+
}
|
|
217
|
+
if (blob)
|
|
218
|
+
return res.blob();
|
|
219
|
+
if (returnReult)
|
|
220
|
+
return getResult(res.json());
|
|
221
|
+
if (returnJson)
|
|
222
|
+
return res.json();
|
|
223
|
+
return res;
|
|
277
224
|
}
|
|
278
225
|
// Constructs HTML directory path
|
|
279
226
|
function getHtmlDirectory(directory, filename) {
|
|
280
227
|
return `${directory}/${filename}.html`;
|
|
281
228
|
}
|
|
282
229
|
// Fetches HTML content
|
|
283
|
-
function fetchIndexHtml(
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
return yield response.text();
|
|
288
|
-
});
|
|
230
|
+
async function fetchIndexHtml(filename, directory = 'sf_index', base = 'html') {
|
|
231
|
+
const url = `/${base}/${directory}/${filename}.html`;
|
|
232
|
+
const response = await fetch(url);
|
|
233
|
+
return await response.text();
|
|
289
234
|
}
|
|
290
235
|
// Fetches and injects HTML content into container
|
|
291
|
-
function fetchIndexHtmlContainer(
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
236
|
+
async function fetchIndexHtmlContainer(filename, doc = document, directory = 'html') {
|
|
237
|
+
const container = `${filename}-container`;
|
|
238
|
+
const html = await fetchIndexHtml(filename, directory);
|
|
239
|
+
const el = doc.getElementById(container);
|
|
240
|
+
if (el) {
|
|
241
|
+
el.innerHTML = html;
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
console.warn(`⚠️ No container found for: #${container}`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function urlJoin(...parts) {
|
|
249
|
+
const s = (parts.length === 1 && Array.isArray(parts[0]) ? parts[0] : parts);
|
|
250
|
+
let r = "";
|
|
251
|
+
for (let i = 0; i < s.length; i++) {
|
|
252
|
+
let d = (s[i] ?? "").toString();
|
|
253
|
+
if (!d)
|
|
254
|
+
continue;
|
|
255
|
+
if (i === 0)
|
|
256
|
+
r = d;
|
|
299
257
|
else {
|
|
300
|
-
|
|
258
|
+
d = d.replace(/^\/+/, "");
|
|
259
|
+
r = r.replace(/\/+$/, "");
|
|
260
|
+
r = `${r}/${d}`;
|
|
301
261
|
}
|
|
302
|
-
}
|
|
262
|
+
}
|
|
263
|
+
return r;
|
|
303
264
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
265
|
+
/**
|
|
266
|
+
* Returns a full URL.
|
|
267
|
+
* If partial_url is already absolute (starts with http), it is returned as is.
|
|
268
|
+
* Otherwise, it is combined with the base URL.
|
|
269
|
+
*/
|
|
270
|
+
function get_full_url(partial_url, domain = null) {
|
|
271
|
+
if (typeof partial_url !== 'string') {
|
|
272
|
+
throw new Error('partial_url must be a string');
|
|
273
|
+
}
|
|
274
|
+
// If it already starts with http, assume it is absolute.
|
|
275
|
+
if (partial_url.startsWith('http')) {
|
|
276
|
+
return partial_url;
|
|
277
|
+
}
|
|
278
|
+
return urlJoin(domain, partial_url);
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Returns a full file system path.
|
|
282
|
+
* If partial_path is already absolute, it is returned as is.
|
|
283
|
+
* Otherwise, it is joined with the base directory.
|
|
284
|
+
*/
|
|
285
|
+
function get_full_path(partial_path, parent_dir = null) {
|
|
286
|
+
if (typeof partial_path !== 'string') {
|
|
287
|
+
throw new Error('partial_path must be a string');
|
|
288
|
+
}
|
|
289
|
+
if (path$1.isAbsolute(partial_path)) {
|
|
290
|
+
return partial_path;
|
|
291
|
+
}
|
|
292
|
+
return urlJoin(parent_dir, partial_path);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Converts a local file system path into its corresponding URL.
|
|
296
|
+
* It checks against the known directories in all_paths and replaces the matching base.
|
|
297
|
+
*/
|
|
298
|
+
function path_to_url(filePath, all_paths) {
|
|
299
|
+
if (typeof filePath !== 'string') {
|
|
300
|
+
throw new Error('filePath must be a string');
|
|
301
|
+
}
|
|
302
|
+
for (const key in all_paths) {
|
|
303
|
+
const mapping = all_paths[key];
|
|
304
|
+
const normalizedBase = path$1.normalize(mapping.path);
|
|
305
|
+
if (filePath.startsWith(normalizedBase)) {
|
|
306
|
+
const relativePath = filePath.substring(normalizedBase.length);
|
|
307
|
+
return urlJoin(mapping.url, relativePath.replace(/\\/g, '/'));
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Converts a URL into its corresponding local file system path.
|
|
314
|
+
* It checks against the known URL prefixes in all_paths and replaces the matching base.
|
|
315
|
+
*/
|
|
316
|
+
function url_to_path(urlStr, all_paths) {
|
|
317
|
+
if (typeof urlStr !== 'string') {
|
|
318
|
+
throw new Error('urlStr must be a string');
|
|
319
|
+
}
|
|
320
|
+
for (const key in all_paths) {
|
|
321
|
+
const mapping = all_paths[key];
|
|
322
|
+
if (urlStr.startsWith(mapping.url)) {
|
|
323
|
+
const relativeUrl = urlStr.substring(mapping.url.length);
|
|
324
|
+
return urlJoin(mapping.path, relativeUrl);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
function urljoin(...parts) {
|
|
330
|
+
return urlJoin(...parts);
|
|
307
331
|
}
|
|
308
332
|
|
|
309
|
-
function assertPath
|
|
333
|
+
function assertPath(path) {
|
|
310
334
|
if (typeof path !== 'string') {
|
|
311
335
|
throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));
|
|
312
336
|
}
|
|
313
337
|
}
|
|
314
338
|
|
|
315
339
|
// Resolves . and .. elements in a path with directory names
|
|
316
|
-
function normalizeStringPosix
|
|
340
|
+
function normalizeStringPosix(path, allowAboveRoot) {
|
|
317
341
|
var res = '';
|
|
318
342
|
var lastSegmentLength = 0;
|
|
319
343
|
var lastSlash = -1;
|
|
@@ -376,7 +400,7 @@ function normalizeStringPosix$1(path, allowAboveRoot) {
|
|
|
376
400
|
return res;
|
|
377
401
|
}
|
|
378
402
|
|
|
379
|
-
function _format
|
|
403
|
+
function _format(sep, pathObject) {
|
|
380
404
|
var dir = pathObject.dir || pathObject.root;
|
|
381
405
|
var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');
|
|
382
406
|
if (!dir) {
|
|
@@ -388,7 +412,7 @@ function _format$1(sep, pathObject) {
|
|
|
388
412
|
return dir + sep + base;
|
|
389
413
|
}
|
|
390
414
|
|
|
391
|
-
var posix
|
|
415
|
+
var posix = {
|
|
392
416
|
// path.resolve([from ...], to)
|
|
393
417
|
resolve: function resolve() {
|
|
394
418
|
var resolvedPath = '';
|
|
@@ -405,7 +429,7 @@ var posix$1 = {
|
|
|
405
429
|
path = cwd;
|
|
406
430
|
}
|
|
407
431
|
|
|
408
|
-
assertPath
|
|
432
|
+
assertPath(path);
|
|
409
433
|
|
|
410
434
|
// Skip empty entries
|
|
411
435
|
if (path.length === 0) {
|
|
@@ -420,7 +444,7 @@ var posix$1 = {
|
|
|
420
444
|
// handle relative paths to be safe (might happen when process.cwd() fails)
|
|
421
445
|
|
|
422
446
|
// Normalize the path
|
|
423
|
-
resolvedPath = normalizeStringPosix
|
|
447
|
+
resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
|
|
424
448
|
|
|
425
449
|
if (resolvedAbsolute) {
|
|
426
450
|
if (resolvedPath.length > 0)
|
|
@@ -435,7 +459,7 @@ var posix$1 = {
|
|
|
435
459
|
},
|
|
436
460
|
|
|
437
461
|
normalize: function normalize(path) {
|
|
438
|
-
assertPath
|
|
462
|
+
assertPath(path);
|
|
439
463
|
|
|
440
464
|
if (path.length === 0) return '.';
|
|
441
465
|
|
|
@@ -443,7 +467,7 @@ var posix$1 = {
|
|
|
443
467
|
var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;
|
|
444
468
|
|
|
445
469
|
// Normalize the path
|
|
446
|
-
path = normalizeStringPosix
|
|
470
|
+
path = normalizeStringPosix(path, !isAbsolute);
|
|
447
471
|
|
|
448
472
|
if (path.length === 0 && !isAbsolute) path = '.';
|
|
449
473
|
if (path.length > 0 && trailingSeparator) path += '/';
|
|
@@ -453,7 +477,7 @@ var posix$1 = {
|
|
|
453
477
|
},
|
|
454
478
|
|
|
455
479
|
isAbsolute: function isAbsolute(path) {
|
|
456
|
-
assertPath
|
|
480
|
+
assertPath(path);
|
|
457
481
|
return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;
|
|
458
482
|
},
|
|
459
483
|
|
|
@@ -463,7 +487,7 @@ var posix$1 = {
|
|
|
463
487
|
var joined;
|
|
464
488
|
for (var i = 0; i < arguments.length; ++i) {
|
|
465
489
|
var arg = arguments[i];
|
|
466
|
-
assertPath
|
|
490
|
+
assertPath(arg);
|
|
467
491
|
if (arg.length > 0) {
|
|
468
492
|
if (joined === undefined)
|
|
469
493
|
joined = arg;
|
|
@@ -473,17 +497,17 @@ var posix$1 = {
|
|
|
473
497
|
}
|
|
474
498
|
if (joined === undefined)
|
|
475
499
|
return '.';
|
|
476
|
-
return posix
|
|
500
|
+
return posix.normalize(joined);
|
|
477
501
|
},
|
|
478
502
|
|
|
479
503
|
relative: function relative(from, to) {
|
|
480
|
-
assertPath
|
|
481
|
-
assertPath
|
|
504
|
+
assertPath(from);
|
|
505
|
+
assertPath(to);
|
|
482
506
|
|
|
483
507
|
if (from === to) return '';
|
|
484
508
|
|
|
485
|
-
from = posix
|
|
486
|
-
to = posix
|
|
509
|
+
from = posix.resolve(from);
|
|
510
|
+
to = posix.resolve(to);
|
|
487
511
|
|
|
488
512
|
if (from === to) return '';
|
|
489
513
|
|
|
@@ -571,7 +595,7 @@ var posix$1 = {
|
|
|
571
595
|
},
|
|
572
596
|
|
|
573
597
|
dirname: function dirname(path) {
|
|
574
|
-
assertPath
|
|
598
|
+
assertPath(path);
|
|
575
599
|
if (path.length === 0) return '.';
|
|
576
600
|
var code = path.charCodeAt(0);
|
|
577
601
|
var hasRoot = code === 47 /*/*/;
|
|
@@ -597,7 +621,7 @@ var posix$1 = {
|
|
|
597
621
|
|
|
598
622
|
basename: function basename(path, ext) {
|
|
599
623
|
if (ext !== undefined && typeof ext !== 'string') throw new TypeError('"ext" argument must be a string');
|
|
600
|
-
assertPath
|
|
624
|
+
assertPath(path);
|
|
601
625
|
|
|
602
626
|
var start = 0;
|
|
603
627
|
var end = -1;
|
|
@@ -667,7 +691,7 @@ var posix$1 = {
|
|
|
667
691
|
},
|
|
668
692
|
|
|
669
693
|
extname: function extname(path) {
|
|
670
|
-
assertPath
|
|
694
|
+
assertPath(path);
|
|
671
695
|
var startDot = -1;
|
|
672
696
|
var startPart = 0;
|
|
673
697
|
var end = -1;
|
|
@@ -719,11 +743,11 @@ var posix$1 = {
|
|
|
719
743
|
if (pathObject === null || typeof pathObject !== 'object') {
|
|
720
744
|
throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
|
|
721
745
|
}
|
|
722
|
-
return _format
|
|
746
|
+
return _format('/', pathObject);
|
|
723
747
|
},
|
|
724
748
|
|
|
725
749
|
parse: function parse(path) {
|
|
726
|
-
assertPath
|
|
750
|
+
assertPath(path);
|
|
727
751
|
|
|
728
752
|
var ret = { root: '', dir: '', base: '', ext: '', name: '' };
|
|
729
753
|
if (path.length === 0) return ret;
|
|
@@ -804,102 +828,9 @@ var posix$1 = {
|
|
|
804
828
|
posix: null
|
|
805
829
|
};
|
|
806
830
|
|
|
807
|
-
posix
|
|
808
|
-
|
|
809
|
-
var pathBrowserify$1 = posix$1;
|
|
810
|
-
|
|
811
|
-
var path$1 = /*@__PURE__*/getDefaultExportFromCjs(pathBrowserify$1);
|
|
812
|
-
|
|
813
|
-
var path$2 = /*#__PURE__*/_mergeNamespaces({
|
|
814
|
-
__proto__: null,
|
|
815
|
-
default: path$1
|
|
816
|
-
}, [pathBrowserify$1]);
|
|
831
|
+
posix.posix = posix;
|
|
817
832
|
|
|
818
|
-
|
|
819
|
-
var _a;
|
|
820
|
-
const s = (parts.length === 1 && Array.isArray(parts[0]) ? parts[0] : parts);
|
|
821
|
-
let r = "";
|
|
822
|
-
for (let i = 0; i < s.length; i++) {
|
|
823
|
-
let d = ((_a = s[i]) !== null && _a !== void 0 ? _a : "").toString();
|
|
824
|
-
if (!d)
|
|
825
|
-
continue;
|
|
826
|
-
if (i === 0)
|
|
827
|
-
r = d;
|
|
828
|
-
else {
|
|
829
|
-
d = d.replace(/^\/+/, "");
|
|
830
|
-
r = r.replace(/\/+$/, "");
|
|
831
|
-
r = `${r}/${d}`;
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
return r;
|
|
835
|
-
}
|
|
836
|
-
/**
|
|
837
|
-
* Returns a full URL.
|
|
838
|
-
* If partial_url is already absolute (starts with http), it is returned as is.
|
|
839
|
-
* Otherwise, it is combined with the base URL.
|
|
840
|
-
*/
|
|
841
|
-
function get_full_url(partial_url, domain = null) {
|
|
842
|
-
if (typeof partial_url !== 'string') {
|
|
843
|
-
throw new Error('partial_url must be a string');
|
|
844
|
-
}
|
|
845
|
-
// If it already starts with http, assume it is absolute.
|
|
846
|
-
if (partial_url.startsWith('http')) {
|
|
847
|
-
return partial_url;
|
|
848
|
-
}
|
|
849
|
-
return urlJoin(domain, partial_url);
|
|
850
|
-
}
|
|
851
|
-
/**
|
|
852
|
-
* Returns a full file system path.
|
|
853
|
-
* If partial_path is already absolute, it is returned as is.
|
|
854
|
-
* Otherwise, it is joined with the base directory.
|
|
855
|
-
*/
|
|
856
|
-
function get_full_path(partial_path, parent_dir = null) {
|
|
857
|
-
if (typeof partial_path !== 'string') {
|
|
858
|
-
throw new Error('partial_path must be a string');
|
|
859
|
-
}
|
|
860
|
-
if (path$1.isAbsolute(partial_path)) {
|
|
861
|
-
return partial_path;
|
|
862
|
-
}
|
|
863
|
-
return urlJoin(parent_dir, partial_path);
|
|
864
|
-
}
|
|
865
|
-
/**
|
|
866
|
-
* Converts a local file system path into its corresponding URL.
|
|
867
|
-
* It checks against the known directories in all_paths and replaces the matching base.
|
|
868
|
-
*/
|
|
869
|
-
function path_to_url(filePath, all_paths) {
|
|
870
|
-
if (typeof filePath !== 'string') {
|
|
871
|
-
throw new Error('filePath must be a string');
|
|
872
|
-
}
|
|
873
|
-
for (const key in all_paths) {
|
|
874
|
-
const mapping = all_paths[key];
|
|
875
|
-
const normalizedBase = path$1.normalize(mapping.path);
|
|
876
|
-
if (filePath.startsWith(normalizedBase)) {
|
|
877
|
-
const relativePath = filePath.substring(normalizedBase.length);
|
|
878
|
-
return urlJoin(mapping.url, relativePath.replace(/\\/g, '/'));
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
return null;
|
|
882
|
-
}
|
|
883
|
-
/**
|
|
884
|
-
* Converts a URL into its corresponding local file system path.
|
|
885
|
-
* It checks against the known URL prefixes in all_paths and replaces the matching base.
|
|
886
|
-
*/
|
|
887
|
-
function url_to_path(urlStr, all_paths) {
|
|
888
|
-
if (typeof urlStr !== 'string') {
|
|
889
|
-
throw new Error('urlStr must be a string');
|
|
890
|
-
}
|
|
891
|
-
for (const key in all_paths) {
|
|
892
|
-
const mapping = all_paths[key];
|
|
893
|
-
if (urlStr.startsWith(mapping.url)) {
|
|
894
|
-
const relativeUrl = urlStr.substring(mapping.url.length);
|
|
895
|
-
return urlJoin(mapping.path, relativeUrl);
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
return null;
|
|
899
|
-
}
|
|
900
|
-
function urljoin(...parts) {
|
|
901
|
-
return urlJoin(...parts);
|
|
902
|
-
}
|
|
833
|
+
var pathBrowserify = posix;
|
|
903
834
|
|
|
904
835
|
function split_outside_brackets(s) {
|
|
905
836
|
let depth = 0;
|
|
@@ -1054,7 +985,7 @@ function formatNumber(value) {
|
|
|
1054
985
|
return value;
|
|
1055
986
|
return US_DECIMAL_FORMATTER.format(num);
|
|
1056
987
|
}
|
|
1057
|
-
catch
|
|
988
|
+
catch {
|
|
1058
989
|
// if anything goes wrong, return the original
|
|
1059
990
|
return value;
|
|
1060
991
|
}
|
|
@@ -1095,7 +1026,7 @@ function findKeyValue(obj, keyToFind) {
|
|
|
1095
1026
|
return undefined;
|
|
1096
1027
|
}
|
|
1097
1028
|
function omitKeys(obj, ...keys) {
|
|
1098
|
-
const newObj =
|
|
1029
|
+
const newObj = { ...obj };
|
|
1099
1030
|
keys.forEach(key => {
|
|
1100
1031
|
delete newObj[key];
|
|
1101
1032
|
});
|
|
@@ -1111,7 +1042,7 @@ function extractInsertData(insertValue) {
|
|
|
1111
1042
|
// Example: Suppose you only need certain fields from the transaction
|
|
1112
1043
|
// Modify this function based on your actual data structure
|
|
1113
1044
|
if (insertValue && typeof insertValue === 'object') {
|
|
1114
|
-
const { transaction
|
|
1045
|
+
const { transaction, ...rest } = insertValue; // Exclude 'transaction' property
|
|
1115
1046
|
return rest;
|
|
1116
1047
|
}
|
|
1117
1048
|
return insertValue;
|
|
@@ -1181,36 +1112,7 @@ function getAlphas() {
|
|
|
1181
1112
|
return 'abcdefghijklmnopqrstuvwxyz';
|
|
1182
1113
|
}
|
|
1183
1114
|
|
|
1184
|
-
//
|
|
1185
|
-
// Fake Node APIs for browser builds — every fn is a harmless noop.
|
|
1186
|
-
|
|
1187
|
-
function statSync() {
|
|
1188
|
-
throw new Error("fs.statSync is not available in browser");
|
|
1189
|
-
}
|
|
1190
|
-
function readdirSync() {
|
|
1191
|
-
return [];
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1194
|
-
// For async fs/promises
|
|
1195
|
-
async function stat() {
|
|
1196
|
-
throw new Error("fs.promises.stat is not available in browser");
|
|
1197
|
-
}
|
|
1198
|
-
async function readdir() {
|
|
1199
|
-
return [];
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
// Export default empty object for wildcard imports
|
|
1203
|
-
var require$$0$6 = {};
|
|
1204
|
-
|
|
1205
|
-
var fsp = /*#__PURE__*/Object.freeze({
|
|
1206
|
-
__proto__: null,
|
|
1207
|
-
default: require$$0$6,
|
|
1208
|
-
readdir: readdir,
|
|
1209
|
-
readdirSync: readdirSync,
|
|
1210
|
-
stat: stat,
|
|
1211
|
-
statSync: statSync
|
|
1212
|
-
});
|
|
1213
|
-
|
|
1115
|
+
// mediaTypes.ts
|
|
1214
1116
|
/** ---- Data: large but explicit, mirrors your Python mapping ---- */
|
|
1215
1117
|
const MIME_TYPES = {
|
|
1216
1118
|
image: {
|
|
@@ -1362,13 +1264,12 @@ function toCategorySet(categories) {
|
|
|
1362
1264
|
return out.size ? out : new Set(allCats);
|
|
1363
1265
|
}
|
|
1364
1266
|
function normalizeCategories(categories, opts) {
|
|
1365
|
-
|
|
1366
|
-
const selected = (_a = categories !== null && categories !== void 0 ? categories : opts === null || opts === void 0 ? void 0 : opts.media_types) !== null && _a !== void 0 ? _a : null;
|
|
1267
|
+
const selected = categories ?? opts?.media_types ?? null;
|
|
1367
1268
|
return toCategorySet(selected);
|
|
1368
1269
|
}
|
|
1369
1270
|
function extOf(input) {
|
|
1370
1271
|
// Behaves like pathlib.Path(...).suffix.lower(): last extension only; lowercased.
|
|
1371
|
-
let ext =
|
|
1272
|
+
let ext = path.extname(input || "");
|
|
1372
1273
|
if (!ext && input && input.startsWith(".")) {
|
|
1373
1274
|
// user passed ".jpg" directly
|
|
1374
1275
|
ext = input;
|
|
@@ -1439,24 +1340,24 @@ function getMimeType(pathOrExt) {
|
|
|
1439
1340
|
}
|
|
1440
1341
|
function getAllFileTypesSync(directory, categories, opts) {
|
|
1441
1342
|
// 🧩 Skip entirely if fs isn't available
|
|
1442
|
-
if (!
|
|
1343
|
+
if (!fs || !path)
|
|
1443
1344
|
return [];
|
|
1444
1345
|
try {
|
|
1445
|
-
const stat = statSync(directory);
|
|
1346
|
+
const stat = fs.statSync(directory);
|
|
1446
1347
|
if (!stat.isDirectory())
|
|
1447
1348
|
return [];
|
|
1448
1349
|
const cats = normalizeCategories(categories, opts);
|
|
1449
1350
|
const wanted = unionExts(cats);
|
|
1450
1351
|
const results = [];
|
|
1451
1352
|
function walkSync(dir) {
|
|
1452
|
-
const entries = readdirSync(dir, { withFileTypes: true });
|
|
1353
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
1453
1354
|
for (const ent of entries) {
|
|
1454
|
-
const full =
|
|
1355
|
+
const full = path.join(dir, ent.name);
|
|
1455
1356
|
if (ent.isDirectory()) {
|
|
1456
1357
|
walkSync(full);
|
|
1457
1358
|
}
|
|
1458
1359
|
else if (ent.isFile()) {
|
|
1459
|
-
const ext =
|
|
1360
|
+
const ext = path.extname(ent.name).toLowerCase();
|
|
1460
1361
|
if (wanted.has(ext))
|
|
1461
1362
|
results.push(full);
|
|
1462
1363
|
}
|
|
@@ -1465,45 +1366,41 @@ function getAllFileTypesSync(directory, categories, opts) {
|
|
|
1465
1366
|
walkSync(directory);
|
|
1466
1367
|
return results;
|
|
1467
1368
|
}
|
|
1468
|
-
catch
|
|
1369
|
+
catch {
|
|
1469
1370
|
return [];
|
|
1470
1371
|
}
|
|
1471
1372
|
}
|
|
1472
|
-
function getAllFileTypes(directory, categories, opts) {
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1373
|
+
async function getAllFileTypes(directory, categories, opts) {
|
|
1374
|
+
// 🧩 Skip entirely if fsp isn't available
|
|
1375
|
+
if (!fsp || !path)
|
|
1376
|
+
return [];
|
|
1377
|
+
try {
|
|
1378
|
+
const stat = await fsp.stat(directory);
|
|
1379
|
+
if (!stat.isDirectory())
|
|
1476
1380
|
return [];
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
const
|
|
1482
|
-
const
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
else if (ent.isFile()) {
|
|
1493
|
-
const ext = pathBrowserify$1.extname(ent.name).toLowerCase();
|
|
1494
|
-
if (wanted.has(ext))
|
|
1495
|
-
results.push(full);
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
});
|
|
1381
|
+
const cats = normalizeCategories(categories, opts);
|
|
1382
|
+
const wanted = unionExts(cats);
|
|
1383
|
+
const results = [];
|
|
1384
|
+
async function walkAsync(dir) {
|
|
1385
|
+
const entries = await fsp.readdir(dir, { withFileTypes: true });
|
|
1386
|
+
for (const ent of entries) {
|
|
1387
|
+
const full = path.join(dir, ent.name);
|
|
1388
|
+
if (ent.isDirectory()) {
|
|
1389
|
+
await walkAsync(full);
|
|
1390
|
+
}
|
|
1391
|
+
else if (ent.isFile()) {
|
|
1392
|
+
const ext = path.extname(ent.name).toLowerCase();
|
|
1393
|
+
if (wanted.has(ext))
|
|
1394
|
+
results.push(full);
|
|
1395
|
+
}
|
|
1499
1396
|
}
|
|
1500
|
-
yield walkAsync(directory);
|
|
1501
|
-
return results;
|
|
1502
|
-
}
|
|
1503
|
-
catch (_a) {
|
|
1504
|
-
return [];
|
|
1505
1397
|
}
|
|
1506
|
-
|
|
1398
|
+
await walkAsync(directory);
|
|
1399
|
+
return results;
|
|
1400
|
+
}
|
|
1401
|
+
catch {
|
|
1402
|
+
return [];
|
|
1403
|
+
}
|
|
1507
1404
|
}
|
|
1508
1405
|
/** Optional convenience re-exports that mirror your Python names */
|
|
1509
1406
|
const get_all_file_types = getAllFileTypes;
|
|
@@ -1521,10 +1418,9 @@ function getIfNone(obj, fallback) {
|
|
|
1521
1418
|
* Merges non-null values from multiple dictionaries.
|
|
1522
1419
|
*/
|
|
1523
1420
|
function mergeNotNullValues(dictA, dictB, dictC, dictD, dictE) {
|
|
1524
|
-
var _a, _b, _c, _d;
|
|
1525
1421
|
const result = {};
|
|
1526
1422
|
for (const key of Object.keys(dictA)) {
|
|
1527
|
-
result[key] =
|
|
1423
|
+
result[key] = dictA[key] ?? dictB?.[key] ?? dictC?.[key] ?? dictD?.[key] ?? dictE?.[key];
|
|
1528
1424
|
}
|
|
1529
1425
|
return result;
|
|
1530
1426
|
}
|
|
@@ -1537,8 +1433,8 @@ function emptyObjectToNull(value) {
|
|
|
1537
1433
|
|
|
1538
1434
|
function getSubstring(obj, maxLength = null, minLength = null) {
|
|
1539
1435
|
const objLength = obj.length;
|
|
1540
|
-
const effectiveMaxLength = maxLength
|
|
1541
|
-
const effectiveMinLength = minLength
|
|
1436
|
+
const effectiveMaxLength = maxLength ?? objLength; // Use nullish coalescing for clarity
|
|
1437
|
+
const effectiveMinLength = minLength ?? 0;
|
|
1542
1438
|
// Ensure bounds are valid
|
|
1543
1439
|
const clampedMaxLength = Math.min(Math.max(effectiveMaxLength, 0), objLength);
|
|
1544
1440
|
const clampedMinLength = Math.min(Math.max(effectiveMinLength, 0), objLength);
|
|
@@ -1746,7 +1642,7 @@ function fileURLToPath(fileUrl) {
|
|
|
1746
1642
|
const u = new URL(fileUrl);
|
|
1747
1643
|
return u.pathname;
|
|
1748
1644
|
}
|
|
1749
|
-
catch
|
|
1645
|
+
catch {
|
|
1750
1646
|
// fallback: just strip file://
|
|
1751
1647
|
return fileUrl.replace(/^file:\/\//, '');
|
|
1752
1648
|
}
|
|
@@ -1758,30 +1654,30 @@ function getAbsolutePath() {
|
|
|
1758
1654
|
function get_dirname(filePath) {
|
|
1759
1655
|
if (!filePath)
|
|
1760
1656
|
return '';
|
|
1761
|
-
return pathBrowserify
|
|
1657
|
+
return pathBrowserify.dirname(filePath);
|
|
1762
1658
|
}
|
|
1763
1659
|
function get_basename(filePath) {
|
|
1764
1660
|
if (!filePath)
|
|
1765
1661
|
return '';
|
|
1766
|
-
return pathBrowserify
|
|
1662
|
+
return pathBrowserify.basename(filePath);
|
|
1767
1663
|
}
|
|
1768
1664
|
function get_filename(filePath) {
|
|
1769
1665
|
if (!filePath)
|
|
1770
1666
|
return '';
|
|
1771
|
-
const ext = pathBrowserify
|
|
1772
|
-
return pathBrowserify
|
|
1667
|
+
const ext = pathBrowserify.extname(filePath);
|
|
1668
|
+
return pathBrowserify.basename(filePath, ext);
|
|
1773
1669
|
}
|
|
1774
1670
|
function get_extname(filePath) {
|
|
1775
1671
|
if (!filePath)
|
|
1776
1672
|
return '';
|
|
1777
|
-
return pathBrowserify
|
|
1673
|
+
return pathBrowserify.extname(filePath);
|
|
1778
1674
|
}
|
|
1779
1675
|
function get_splitext(filePath) {
|
|
1780
1676
|
if (!filePath)
|
|
1781
1677
|
return { filename: '', extname: '' };
|
|
1782
|
-
const ext = pathBrowserify
|
|
1678
|
+
const ext = pathBrowserify.extname(filePath);
|
|
1783
1679
|
// Get the basename without the extension
|
|
1784
|
-
const filename = pathBrowserify
|
|
1680
|
+
const filename = pathBrowserify.basename(filePath, ext);
|
|
1785
1681
|
return { filename, ext };
|
|
1786
1682
|
}
|
|
1787
1683
|
/**
|
|
@@ -1795,9 +1691,9 @@ function get_splitext(filePath) {
|
|
|
1795
1691
|
function get_relative_path(basePath, targetPath) {
|
|
1796
1692
|
try {
|
|
1797
1693
|
// Compute the relative path using Node's native path.relative
|
|
1798
|
-
let rel = pathBrowserify
|
|
1694
|
+
let rel = pathBrowserify.relative(basePath, targetPath);
|
|
1799
1695
|
// Normalize to POSIX-style slashes for consistency (especially on Windows)
|
|
1800
|
-
rel = rel.split(pathBrowserify
|
|
1696
|
+
rel = rel.split(pathBrowserify.sep).join('/');
|
|
1801
1697
|
// Avoid empty string (happens if both paths are identical)
|
|
1802
1698
|
return rel || '.';
|
|
1803
1699
|
}
|
|
@@ -2006,7 +1902,7 @@ function alertit(obj = null) {
|
|
|
2006
1902
|
try {
|
|
2007
1903
|
msg = JSON.stringify(obj);
|
|
2008
1904
|
}
|
|
2009
|
-
catch
|
|
1905
|
+
catch {
|
|
2010
1906
|
// If JSON.stringify fails (circular refs, etc.), fall back to a simple string
|
|
2011
1907
|
msg = String(obj);
|
|
2012
1908
|
}
|
|
@@ -2046,681 +1942,177 @@ function isZero(obj) {
|
|
|
2046
1942
|
return true;
|
|
2047
1943
|
}
|
|
2048
1944
|
return false;
|
|
2049
|
-
}
|
|
2050
|
-
|
|
2051
|
-
const SECOND = 1;
|
|
2052
|
-
const ZEPTOSECOND = exponential(SECOND, -21);
|
|
2053
|
-
const ATTOSECOND = exponential(SECOND, -18);
|
|
2054
|
-
const FEMTOSECOND = exponential(SECOND, -15);
|
|
2055
|
-
const PICOSECOND = exponential(SECOND, -12);
|
|
2056
|
-
const NANOSECOND = exponential(SECOND, -9);
|
|
2057
|
-
const MICROSECOND = exponential(SECOND, -6);
|
|
2058
|
-
const MILISECOND = exponential(SECOND, -3);
|
|
2059
|
-
const CENTISECOND = exponential(SECOND, -2);
|
|
2060
|
-
const DECISECOND = exponential(SECOND, -1);
|
|
2061
|
-
const MINUTE = 60 * SECOND;
|
|
2062
|
-
const HOUR = 60 * MINUTE;
|
|
2063
|
-
const DAY = 24 * HOUR;
|
|
2064
|
-
const YEAR = 365 * DAY;
|
|
2065
|
-
const MONTH = YEAR / 12;
|
|
2066
|
-
// Derived: explicit names
|
|
2067
|
-
const SECONDS_PER_MINUTE = MINUTE;
|
|
2068
|
-
const SECONDS_PER_HOUR = HOUR;
|
|
2069
|
-
const SECONDS_PER_DAY = DAY;
|
|
2070
|
-
//math
|
|
2071
|
-
const PI = Math.PI;
|
|
2072
|
-
const PI2 = 2 * PI;
|
|
2073
|
-
// Distance
|
|
2074
|
-
const METERS_PER_KM = 1000;
|
|
2075
|
-
const METERS_PER_MILE = 1609.34;
|
|
2076
|
-
const METERS_PER_FOOT = 0.3048;
|
|
2077
|
-
const KMS_PER_METER = 1 / METERS_PER_KM;
|
|
2078
|
-
const MILES_PER_METER = 1 / METERS_PER_MILE;
|
|
2079
|
-
const FEET_PER_METER = 1 / METERS_PER_FOOT;
|
|
2080
|
-
const MIN_IN_S = 1 / MINUTE;
|
|
2081
|
-
const HOUR_IN_S = 1 / HOUR;
|
|
2082
|
-
const DAY_IN_S = 1 / DAY;
|
|
2083
|
-
const YEAR_IN_S = 1 / YEAR;
|
|
2084
|
-
const MONTH_IN_S = 1 / MONTH;
|
|
2085
|
-
const MiPerH_TO_MPerS = METERS_PER_MILE * HOUR_IN_S;
|
|
2086
|
-
const MPerS_TO_MiPerH = 1 / MiPerH_TO_MPerS;
|
|
2087
|
-
|
|
2088
|
-
// conversions.ts
|
|
2089
|
-
/*───────────────────────────────────────────────────────────────
|
|
2090
|
-
🧭 CANONICAL MAPPINGS
|
|
2091
|
-
───────────────────────────────────────────────────────────────*/
|
|
2092
|
-
const DIST_ALIASES = {
|
|
2093
|
-
m: "m", meter: "m", meters: "m",
|
|
2094
|
-
km: "km", kms: "km", kilometer: "km", kilometers: "km",
|
|
2095
|
-
mi: "mi", mile: "mi", miles: "mi",
|
|
2096
|
-
ft: "ft", f: "ft", foot: "ft", feet: "ft",
|
|
2097
|
-
};
|
|
2098
|
-
const TIME_ALIASES = {
|
|
2099
|
-
s: "s", sec: "s", second: "s", seconds: "s",
|
|
2100
|
-
min: "min", m: "min", minute: "min", minutes: "min",
|
|
2101
|
-
h: "h", hr: "h", hour: "h", hours: "h",
|
|
2102
|
-
day: "day", d: "day", days: "day",
|
|
2103
|
-
};
|
|
2104
|
-
const DIST_FACTORS = {
|
|
2105
|
-
m: 1,
|
|
2106
|
-
km: METERS_PER_KM,
|
|
2107
|
-
mi: METERS_PER_MILE,
|
|
2108
|
-
ft: METERS_PER_FOOT,
|
|
2109
|
-
};
|
|
2110
|
-
const TIME_FACTORS = {
|
|
2111
|
-
s: 1,
|
|
2112
|
-
min: MINUTE,
|
|
2113
|
-
h: HOUR,
|
|
2114
|
-
day: DAY,
|
|
2115
|
-
};
|
|
2116
|
-
/*───────────────────────────────────────────────────────────────
|
|
2117
|
-
🔍 CANONICALIZATION HELPERS
|
|
2118
|
-
───────────────────────────────────────────────────────────────*/
|
|
2119
|
-
function canonDist(u) {
|
|
2120
|
-
const key = (u !== null && u !== void 0 ? u : "m").toString().toLowerCase();
|
|
2121
|
-
const canon = DIST_ALIASES[key];
|
|
2122
|
-
if (!canon)
|
|
2123
|
-
throw new Error(`Unknown distance unit: ${u}`);
|
|
2124
|
-
return canon;
|
|
2125
|
-
}
|
|
2126
|
-
function canonTime(u) {
|
|
2127
|
-
const key = (u !== null && u !== void 0 ? u : "s").toString().toLowerCase();
|
|
2128
|
-
const canon = TIME_ALIASES[key];
|
|
2129
|
-
if (!canon)
|
|
2130
|
-
throw new Error(`Unknown time unit: ${u}`);
|
|
2131
|
-
return canon;
|
|
2132
|
-
}
|
|
2133
|
-
/*───────────────────────────────────────────────────────────────
|
|
2134
|
-
⚖️ NORMALIZATION HELPERS
|
|
2135
|
-
───────────────────────────────────────────────────────────────*/
|
|
2136
|
-
function distanceToMeters(d, unit) {
|
|
2137
|
-
const u = canonDist(unit);
|
|
2138
|
-
return safeMultiply(d, DIST_FACTORS[u]);
|
|
2139
|
-
}
|
|
2140
|
-
function metersToDistance(v, unit) {
|
|
2141
|
-
const u = canonDist(unit);
|
|
2142
|
-
return safeDivide(v, DIST_FACTORS[u]);
|
|
2143
|
-
}
|
|
2144
|
-
function timeToSeconds(t, unit) {
|
|
2145
|
-
const u = canonTime(unit);
|
|
2146
|
-
return safeMultiply(t, TIME_FACTORS[u]);
|
|
2147
|
-
}
|
|
2148
|
-
function secondsToTime(v, unit) {
|
|
2149
|
-
const u = canonTime(unit);
|
|
2150
|
-
return safeDivide(v, TIME_FACTORS[u]);
|
|
2151
|
-
}
|
|
2152
|
-
/*───────────────────────────────────────────────────────────────
|
|
2153
|
-
🚀 SPEED CONVERSIONS (normalize / unnormalize)
|
|
2154
|
-
───────────────────────────────────────────────────────────────*/
|
|
2155
|
-
function speedToMps(v, distUnit, timeUnit) {
|
|
2156
|
-
const du = canonDist(distUnit);
|
|
2157
|
-
const tu = canonTime(timeUnit);
|
|
2158
|
-
return v * (DIST_FACTORS[du] / TIME_FACTORS[tu]);
|
|
2159
|
-
}
|
|
2160
|
-
function mpsToSpeed(vMps, distUnit, timeUnit) {
|
|
2161
|
-
const du = canonDist(distUnit);
|
|
2162
|
-
const tu = canonTime(timeUnit);
|
|
2163
|
-
return vMps * (TIME_FACTORS[tu] / DIST_FACTORS[du]);
|
|
2164
|
-
}
|
|
2165
|
-
/*───────────────────────────────────────────────────────────────
|
|
2166
|
-
🎯 UNIVERSAL CONVERTERS
|
|
2167
|
-
───────────────────────────────────────────────────────────────*/
|
|
2168
|
-
function convertDistance({ d, fromDist, toDist, vOnly = true, }) {
|
|
2169
|
-
const m = distanceToMeters(d, fromDist);
|
|
2170
|
-
const D = canonDist(toDist !== null && toDist !== void 0 ? toDist : "m");
|
|
2171
|
-
const out = metersToDistance(m, D);
|
|
2172
|
-
return vOnly ? out : { d: out, D };
|
|
2173
|
-
}
|
|
2174
|
-
function convertTime({ t, fromTime, toTime, vOnly = true, }) {
|
|
2175
|
-
const sec = timeToSeconds(t, fromTime);
|
|
2176
|
-
const T = canonTime(toTime !== null && toTime !== void 0 ? toTime : "s");
|
|
2177
|
-
const out = secondsToTime(sec, T);
|
|
2178
|
-
return vOnly ? out : { t: out, T };
|
|
2179
|
-
}
|
|
2180
|
-
function convertSpeed({ v, fromDist, fromTime, toDist, toTime, vOnly = true, }) {
|
|
2181
|
-
const mps = speedToMps(v, fromDist, fromTime);
|
|
2182
|
-
const d = canonDist(toDist !== null && toDist !== void 0 ? toDist : "m");
|
|
2183
|
-
const t = canonTime(toTime !== null && toTime !== void 0 ? toTime : "s");
|
|
2184
|
-
const out = mpsToSpeed(mps, d, t);
|
|
2185
|
-
return vOnly ? out : { v: out, d, t };
|
|
2186
|
-
}
|
|
2187
|
-
const DistanceConverter = {
|
|
2188
|
-
normalize: distanceToMeters,
|
|
2189
|
-
unnormalize: metersToDistance,
|
|
2190
|
-
};
|
|
2191
|
-
const TimeConverter = {
|
|
2192
|
-
normalize: timeToSeconds,
|
|
2193
|
-
unnormalize: secondsToTime,
|
|
2194
|
-
};
|
|
2195
|
-
const SpeedConverter = {
|
|
2196
|
-
normalize: (v, [du, tu]) => speedToMps(v, du, tu),
|
|
2197
|
-
unnormalize: (v, [du, tu]) => mpsToSpeed(v, du, tu),
|
|
2198
|
-
};
|
|
2199
|
-
/*───────────────────────────────────────────────────────────────
|
|
2200
|
-
🧩 COMPATIBILITY WRAPPERS (legacy aliases)
|
|
2201
|
-
───────────────────────────────────────────────────────────────*/
|
|
2202
|
-
const toMeters = distanceToMeters;
|
|
2203
|
-
const fromMeters = metersToDistance;
|
|
2204
|
-
const toSeconds = timeToSeconds;
|
|
2205
|
-
const fromSeconds = secondsToTime;
|
|
2206
|
-
const velocityToMs = (value, unit) => speedToMps(value, unit, "s");
|
|
2207
|
-
const velocityFromMs = (value, unit) => mpsToSpeed(value, unit, "s");
|
|
2208
|
-
/** Non-canonical helper for arbitrary rate conversion, e.g. ft/day → m/s */
|
|
2209
|
-
const fromMps = (v, dist_unit, time_unit) => mpsToSpeed(v, dist_unit, time_unit);
|
|
2210
|
-
/*───────────────────────────────────────────────────────────────
|
|
2211
|
-
📊 UTILITIES
|
|
2212
|
-
───────────────────────────────────────────────────────────────*/
|
|
2213
|
-
const isFiniteNum = (x) => Number.isFinite(x);
|
|
2214
|
-
const fmt = (n, digits = 2) => isFiniteNum(n) ? n.toFixed(digits) : "N/A";
|
|
2215
|
-
|
|
2216
|
-
// Function to check time interval
|
|
2217
|
-
function isTimeInterval(timeObj, interval) {
|
|
2218
|
-
return (Date.now() / 1000 - timeObj) < (interval - 1);
|
|
2219
|
-
}
|
|
2220
|
-
|
|
2221
|
-
function assertPath(path) {
|
|
2222
|
-
if (typeof path !== 'string') {
|
|
2223
|
-
throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));
|
|
2224
|
-
}
|
|
2225
|
-
}
|
|
2226
|
-
|
|
2227
|
-
// Resolves . and .. elements in a path with directory names
|
|
2228
|
-
function normalizeStringPosix(path, allowAboveRoot) {
|
|
2229
|
-
var res = '';
|
|
2230
|
-
var lastSegmentLength = 0;
|
|
2231
|
-
var lastSlash = -1;
|
|
2232
|
-
var dots = 0;
|
|
2233
|
-
var code;
|
|
2234
|
-
for (var i = 0; i <= path.length; ++i) {
|
|
2235
|
-
if (i < path.length)
|
|
2236
|
-
code = path.charCodeAt(i);
|
|
2237
|
-
else if (code === 47 /*/*/)
|
|
2238
|
-
break;
|
|
2239
|
-
else
|
|
2240
|
-
code = 47 /*/*/;
|
|
2241
|
-
if (code === 47 /*/*/) {
|
|
2242
|
-
if (lastSlash === i - 1 || dots === 1) ; else if (lastSlash !== i - 1 && dots === 2) {
|
|
2243
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {
|
|
2244
|
-
if (res.length > 2) {
|
|
2245
|
-
var lastSlashIndex = res.lastIndexOf('/');
|
|
2246
|
-
if (lastSlashIndex !== res.length - 1) {
|
|
2247
|
-
if (lastSlashIndex === -1) {
|
|
2248
|
-
res = '';
|
|
2249
|
-
lastSegmentLength = 0;
|
|
2250
|
-
} else {
|
|
2251
|
-
res = res.slice(0, lastSlashIndex);
|
|
2252
|
-
lastSegmentLength = res.length - 1 - res.lastIndexOf('/');
|
|
2253
|
-
}
|
|
2254
|
-
lastSlash = i;
|
|
2255
|
-
dots = 0;
|
|
2256
|
-
continue;
|
|
2257
|
-
}
|
|
2258
|
-
} else if (res.length === 2 || res.length === 1) {
|
|
2259
|
-
res = '';
|
|
2260
|
-
lastSegmentLength = 0;
|
|
2261
|
-
lastSlash = i;
|
|
2262
|
-
dots = 0;
|
|
2263
|
-
continue;
|
|
2264
|
-
}
|
|
2265
|
-
}
|
|
2266
|
-
if (allowAboveRoot) {
|
|
2267
|
-
if (res.length > 0)
|
|
2268
|
-
res += '/..';
|
|
2269
|
-
else
|
|
2270
|
-
res = '..';
|
|
2271
|
-
lastSegmentLength = 2;
|
|
2272
|
-
}
|
|
2273
|
-
} else {
|
|
2274
|
-
if (res.length > 0)
|
|
2275
|
-
res += '/' + path.slice(lastSlash + 1, i);
|
|
2276
|
-
else
|
|
2277
|
-
res = path.slice(lastSlash + 1, i);
|
|
2278
|
-
lastSegmentLength = i - lastSlash - 1;
|
|
2279
|
-
}
|
|
2280
|
-
lastSlash = i;
|
|
2281
|
-
dots = 0;
|
|
2282
|
-
} else if (code === 46 /*.*/ && dots !== -1) {
|
|
2283
|
-
++dots;
|
|
2284
|
-
} else {
|
|
2285
|
-
dots = -1;
|
|
2286
|
-
}
|
|
2287
|
-
}
|
|
2288
|
-
return res;
|
|
2289
|
-
}
|
|
2290
|
-
|
|
2291
|
-
function _format(sep, pathObject) {
|
|
2292
|
-
var dir = pathObject.dir || pathObject.root;
|
|
2293
|
-
var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');
|
|
2294
|
-
if (!dir) {
|
|
2295
|
-
return base;
|
|
2296
|
-
}
|
|
2297
|
-
if (dir === pathObject.root) {
|
|
2298
|
-
return dir + base;
|
|
2299
|
-
}
|
|
2300
|
-
return dir + sep + base;
|
|
2301
|
-
}
|
|
2302
|
-
|
|
2303
|
-
var posix = {
|
|
2304
|
-
// path.resolve([from ...], to)
|
|
2305
|
-
resolve: function resolve() {
|
|
2306
|
-
var resolvedPath = '';
|
|
2307
|
-
var resolvedAbsolute = false;
|
|
2308
|
-
var cwd;
|
|
2309
|
-
|
|
2310
|
-
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
2311
|
-
var path;
|
|
2312
|
-
if (i >= 0)
|
|
2313
|
-
path = arguments[i];
|
|
2314
|
-
else {
|
|
2315
|
-
if (cwd === undefined)
|
|
2316
|
-
cwd = process.cwd();
|
|
2317
|
-
path = cwd;
|
|
2318
|
-
}
|
|
2319
|
-
|
|
2320
|
-
assertPath(path);
|
|
2321
|
-
|
|
2322
|
-
// Skip empty entries
|
|
2323
|
-
if (path.length === 0) {
|
|
2324
|
-
continue;
|
|
2325
|
-
}
|
|
2326
|
-
|
|
2327
|
-
resolvedPath = path + '/' + resolvedPath;
|
|
2328
|
-
resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;
|
|
2329
|
-
}
|
|
2330
|
-
|
|
2331
|
-
// At this point the path should be resolved to a full absolute path, but
|
|
2332
|
-
// handle relative paths to be safe (might happen when process.cwd() fails)
|
|
2333
|
-
|
|
2334
|
-
// Normalize the path
|
|
2335
|
-
resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
|
|
2336
|
-
|
|
2337
|
-
if (resolvedAbsolute) {
|
|
2338
|
-
if (resolvedPath.length > 0)
|
|
2339
|
-
return '/' + resolvedPath;
|
|
2340
|
-
else
|
|
2341
|
-
return '/';
|
|
2342
|
-
} else if (resolvedPath.length > 0) {
|
|
2343
|
-
return resolvedPath;
|
|
2344
|
-
} else {
|
|
2345
|
-
return '.';
|
|
2346
|
-
}
|
|
2347
|
-
},
|
|
2348
|
-
|
|
2349
|
-
normalize: function normalize(path) {
|
|
2350
|
-
assertPath(path);
|
|
2351
|
-
|
|
2352
|
-
if (path.length === 0) return '.';
|
|
2353
|
-
|
|
2354
|
-
var isAbsolute = path.charCodeAt(0) === 47 /*/*/;
|
|
2355
|
-
var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;
|
|
2356
|
-
|
|
2357
|
-
// Normalize the path
|
|
2358
|
-
path = normalizeStringPosix(path, !isAbsolute);
|
|
2359
|
-
|
|
2360
|
-
if (path.length === 0 && !isAbsolute) path = '.';
|
|
2361
|
-
if (path.length > 0 && trailingSeparator) path += '/';
|
|
2362
|
-
|
|
2363
|
-
if (isAbsolute) return '/' + path;
|
|
2364
|
-
return path;
|
|
2365
|
-
},
|
|
2366
|
-
|
|
2367
|
-
isAbsolute: function isAbsolute(path) {
|
|
2368
|
-
assertPath(path);
|
|
2369
|
-
return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;
|
|
2370
|
-
},
|
|
2371
|
-
|
|
2372
|
-
join: function join() {
|
|
2373
|
-
if (arguments.length === 0)
|
|
2374
|
-
return '.';
|
|
2375
|
-
var joined;
|
|
2376
|
-
for (var i = 0; i < arguments.length; ++i) {
|
|
2377
|
-
var arg = arguments[i];
|
|
2378
|
-
assertPath(arg);
|
|
2379
|
-
if (arg.length > 0) {
|
|
2380
|
-
if (joined === undefined)
|
|
2381
|
-
joined = arg;
|
|
2382
|
-
else
|
|
2383
|
-
joined += '/' + arg;
|
|
2384
|
-
}
|
|
2385
|
-
}
|
|
2386
|
-
if (joined === undefined)
|
|
2387
|
-
return '.';
|
|
2388
|
-
return posix.normalize(joined);
|
|
2389
|
-
},
|
|
2390
|
-
|
|
2391
|
-
relative: function relative(from, to) {
|
|
2392
|
-
assertPath(from);
|
|
2393
|
-
assertPath(to);
|
|
2394
|
-
|
|
2395
|
-
if (from === to) return '';
|
|
2396
|
-
|
|
2397
|
-
from = posix.resolve(from);
|
|
2398
|
-
to = posix.resolve(to);
|
|
2399
|
-
|
|
2400
|
-
if (from === to) return '';
|
|
2401
|
-
|
|
2402
|
-
// Trim any leading backslashes
|
|
2403
|
-
var fromStart = 1;
|
|
2404
|
-
for (; fromStart < from.length; ++fromStart) {
|
|
2405
|
-
if (from.charCodeAt(fromStart) !== 47 /*/*/)
|
|
2406
|
-
break;
|
|
2407
|
-
}
|
|
2408
|
-
var fromEnd = from.length;
|
|
2409
|
-
var fromLen = fromEnd - fromStart;
|
|
2410
|
-
|
|
2411
|
-
// Trim any leading backslashes
|
|
2412
|
-
var toStart = 1;
|
|
2413
|
-
for (; toStart < to.length; ++toStart) {
|
|
2414
|
-
if (to.charCodeAt(toStart) !== 47 /*/*/)
|
|
2415
|
-
break;
|
|
2416
|
-
}
|
|
2417
|
-
var toEnd = to.length;
|
|
2418
|
-
var toLen = toEnd - toStart;
|
|
2419
|
-
|
|
2420
|
-
// Compare paths to find the longest common path from root
|
|
2421
|
-
var length = fromLen < toLen ? fromLen : toLen;
|
|
2422
|
-
var lastCommonSep = -1;
|
|
2423
|
-
var i = 0;
|
|
2424
|
-
for (; i <= length; ++i) {
|
|
2425
|
-
if (i === length) {
|
|
2426
|
-
if (toLen > length) {
|
|
2427
|
-
if (to.charCodeAt(toStart + i) === 47 /*/*/) {
|
|
2428
|
-
// We get here if `from` is the exact base path for `to`.
|
|
2429
|
-
// For example: from='/foo/bar'; to='/foo/bar/baz'
|
|
2430
|
-
return to.slice(toStart + i + 1);
|
|
2431
|
-
} else if (i === 0) {
|
|
2432
|
-
// We get here if `from` is the root
|
|
2433
|
-
// For example: from='/'; to='/foo'
|
|
2434
|
-
return to.slice(toStart + i);
|
|
2435
|
-
}
|
|
2436
|
-
} else if (fromLen > length) {
|
|
2437
|
-
if (from.charCodeAt(fromStart + i) === 47 /*/*/) {
|
|
2438
|
-
// We get here if `to` is the exact base path for `from`.
|
|
2439
|
-
// For example: from='/foo/bar/baz'; to='/foo/bar'
|
|
2440
|
-
lastCommonSep = i;
|
|
2441
|
-
} else if (i === 0) {
|
|
2442
|
-
// We get here if `to` is the root.
|
|
2443
|
-
// For example: from='/foo'; to='/'
|
|
2444
|
-
lastCommonSep = 0;
|
|
2445
|
-
}
|
|
2446
|
-
}
|
|
2447
|
-
break;
|
|
2448
|
-
}
|
|
2449
|
-
var fromCode = from.charCodeAt(fromStart + i);
|
|
2450
|
-
var toCode = to.charCodeAt(toStart + i);
|
|
2451
|
-
if (fromCode !== toCode)
|
|
2452
|
-
break;
|
|
2453
|
-
else if (fromCode === 47 /*/*/)
|
|
2454
|
-
lastCommonSep = i;
|
|
2455
|
-
}
|
|
2456
|
-
|
|
2457
|
-
var out = '';
|
|
2458
|
-
// Generate the relative path based on the path difference between `to`
|
|
2459
|
-
// and `from`
|
|
2460
|
-
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
|
|
2461
|
-
if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {
|
|
2462
|
-
if (out.length === 0)
|
|
2463
|
-
out += '..';
|
|
2464
|
-
else
|
|
2465
|
-
out += '/..';
|
|
2466
|
-
}
|
|
2467
|
-
}
|
|
2468
|
-
|
|
2469
|
-
// Lastly, append the rest of the destination (`to`) path that comes after
|
|
2470
|
-
// the common path parts
|
|
2471
|
-
if (out.length > 0)
|
|
2472
|
-
return out + to.slice(toStart + lastCommonSep);
|
|
2473
|
-
else {
|
|
2474
|
-
toStart += lastCommonSep;
|
|
2475
|
-
if (to.charCodeAt(toStart) === 47 /*/*/)
|
|
2476
|
-
++toStart;
|
|
2477
|
-
return to.slice(toStart);
|
|
2478
|
-
}
|
|
2479
|
-
},
|
|
2480
|
-
|
|
2481
|
-
_makeLong: function _makeLong(path) {
|
|
2482
|
-
return path;
|
|
2483
|
-
},
|
|
2484
|
-
|
|
2485
|
-
dirname: function dirname(path) {
|
|
2486
|
-
assertPath(path);
|
|
2487
|
-
if (path.length === 0) return '.';
|
|
2488
|
-
var code = path.charCodeAt(0);
|
|
2489
|
-
var hasRoot = code === 47 /*/*/;
|
|
2490
|
-
var end = -1;
|
|
2491
|
-
var matchedSlash = true;
|
|
2492
|
-
for (var i = path.length - 1; i >= 1; --i) {
|
|
2493
|
-
code = path.charCodeAt(i);
|
|
2494
|
-
if (code === 47 /*/*/) {
|
|
2495
|
-
if (!matchedSlash) {
|
|
2496
|
-
end = i;
|
|
2497
|
-
break;
|
|
2498
|
-
}
|
|
2499
|
-
} else {
|
|
2500
|
-
// We saw the first non-path separator
|
|
2501
|
-
matchedSlash = false;
|
|
2502
|
-
}
|
|
2503
|
-
}
|
|
2504
|
-
|
|
2505
|
-
if (end === -1) return hasRoot ? '/' : '.';
|
|
2506
|
-
if (hasRoot && end === 1) return '//';
|
|
2507
|
-
return path.slice(0, end);
|
|
2508
|
-
},
|
|
2509
|
-
|
|
2510
|
-
basename: function basename(path, ext) {
|
|
2511
|
-
if (ext !== undefined && typeof ext !== 'string') throw new TypeError('"ext" argument must be a string');
|
|
2512
|
-
assertPath(path);
|
|
2513
|
-
|
|
2514
|
-
var start = 0;
|
|
2515
|
-
var end = -1;
|
|
2516
|
-
var matchedSlash = true;
|
|
2517
|
-
var i;
|
|
2518
|
-
|
|
2519
|
-
if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
|
|
2520
|
-
if (ext.length === path.length && ext === path) return '';
|
|
2521
|
-
var extIdx = ext.length - 1;
|
|
2522
|
-
var firstNonSlashEnd = -1;
|
|
2523
|
-
for (i = path.length - 1; i >= 0; --i) {
|
|
2524
|
-
var code = path.charCodeAt(i);
|
|
2525
|
-
if (code === 47 /*/*/) {
|
|
2526
|
-
// If we reached a path separator that was not part of a set of path
|
|
2527
|
-
// separators at the end of the string, stop now
|
|
2528
|
-
if (!matchedSlash) {
|
|
2529
|
-
start = i + 1;
|
|
2530
|
-
break;
|
|
2531
|
-
}
|
|
2532
|
-
} else {
|
|
2533
|
-
if (firstNonSlashEnd === -1) {
|
|
2534
|
-
// We saw the first non-path separator, remember this index in case
|
|
2535
|
-
// we need it if the extension ends up not matching
|
|
2536
|
-
matchedSlash = false;
|
|
2537
|
-
firstNonSlashEnd = i + 1;
|
|
2538
|
-
}
|
|
2539
|
-
if (extIdx >= 0) {
|
|
2540
|
-
// Try to match the explicit extension
|
|
2541
|
-
if (code === ext.charCodeAt(extIdx)) {
|
|
2542
|
-
if (--extIdx === -1) {
|
|
2543
|
-
// We matched the extension, so mark this as the end of our path
|
|
2544
|
-
// component
|
|
2545
|
-
end = i;
|
|
2546
|
-
}
|
|
2547
|
-
} else {
|
|
2548
|
-
// Extension does not match, so our result is the entire path
|
|
2549
|
-
// component
|
|
2550
|
-
extIdx = -1;
|
|
2551
|
-
end = firstNonSlashEnd;
|
|
2552
|
-
}
|
|
2553
|
-
}
|
|
2554
|
-
}
|
|
2555
|
-
}
|
|
2556
|
-
|
|
2557
|
-
if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;
|
|
2558
|
-
return path.slice(start, end);
|
|
2559
|
-
} else {
|
|
2560
|
-
for (i = path.length - 1; i >= 0; --i) {
|
|
2561
|
-
if (path.charCodeAt(i) === 47 /*/*/) {
|
|
2562
|
-
// If we reached a path separator that was not part of a set of path
|
|
2563
|
-
// separators at the end of the string, stop now
|
|
2564
|
-
if (!matchedSlash) {
|
|
2565
|
-
start = i + 1;
|
|
2566
|
-
break;
|
|
2567
|
-
}
|
|
2568
|
-
} else if (end === -1) {
|
|
2569
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
2570
|
-
// path component
|
|
2571
|
-
matchedSlash = false;
|
|
2572
|
-
end = i + 1;
|
|
2573
|
-
}
|
|
2574
|
-
}
|
|
2575
|
-
|
|
2576
|
-
if (end === -1) return '';
|
|
2577
|
-
return path.slice(start, end);
|
|
2578
|
-
}
|
|
2579
|
-
},
|
|
2580
|
-
|
|
2581
|
-
extname: function extname(path) {
|
|
2582
|
-
assertPath(path);
|
|
2583
|
-
var startDot = -1;
|
|
2584
|
-
var startPart = 0;
|
|
2585
|
-
var end = -1;
|
|
2586
|
-
var matchedSlash = true;
|
|
2587
|
-
// Track the state of characters (if any) we see before our first dot and
|
|
2588
|
-
// after any path separator we find
|
|
2589
|
-
var preDotState = 0;
|
|
2590
|
-
for (var i = path.length - 1; i >= 0; --i) {
|
|
2591
|
-
var code = path.charCodeAt(i);
|
|
2592
|
-
if (code === 47 /*/*/) {
|
|
2593
|
-
// If we reached a path separator that was not part of a set of path
|
|
2594
|
-
// separators at the end of the string, stop now
|
|
2595
|
-
if (!matchedSlash) {
|
|
2596
|
-
startPart = i + 1;
|
|
2597
|
-
break;
|
|
2598
|
-
}
|
|
2599
|
-
continue;
|
|
2600
|
-
}
|
|
2601
|
-
if (end === -1) {
|
|
2602
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
2603
|
-
// extension
|
|
2604
|
-
matchedSlash = false;
|
|
2605
|
-
end = i + 1;
|
|
2606
|
-
}
|
|
2607
|
-
if (code === 46 /*.*/) {
|
|
2608
|
-
// If this is our first dot, mark it as the start of our extension
|
|
2609
|
-
if (startDot === -1)
|
|
2610
|
-
startDot = i;
|
|
2611
|
-
else if (preDotState !== 1)
|
|
2612
|
-
preDotState = 1;
|
|
2613
|
-
} else if (startDot !== -1) {
|
|
2614
|
-
// We saw a non-dot and non-path separator before our dot, so we should
|
|
2615
|
-
// have a good chance at having a non-empty extension
|
|
2616
|
-
preDotState = -1;
|
|
2617
|
-
}
|
|
2618
|
-
}
|
|
2619
|
-
|
|
2620
|
-
if (startDot === -1 || end === -1 ||
|
|
2621
|
-
// We saw a non-dot character immediately before the dot
|
|
2622
|
-
preDotState === 0 ||
|
|
2623
|
-
// The (right-most) trimmed path component is exactly '..'
|
|
2624
|
-
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
2625
|
-
return '';
|
|
2626
|
-
}
|
|
2627
|
-
return path.slice(startDot, end);
|
|
2628
|
-
},
|
|
2629
|
-
|
|
2630
|
-
format: function format(pathObject) {
|
|
2631
|
-
if (pathObject === null || typeof pathObject !== 'object') {
|
|
2632
|
-
throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
|
|
2633
|
-
}
|
|
2634
|
-
return _format('/', pathObject);
|
|
2635
|
-
},
|
|
2636
|
-
|
|
2637
|
-
parse: function parse(path) {
|
|
2638
|
-
assertPath(path);
|
|
2639
|
-
|
|
2640
|
-
var ret = { root: '', dir: '', base: '', ext: '', name: '' };
|
|
2641
|
-
if (path.length === 0) return ret;
|
|
2642
|
-
var code = path.charCodeAt(0);
|
|
2643
|
-
var isAbsolute = code === 47 /*/*/;
|
|
2644
|
-
var start;
|
|
2645
|
-
if (isAbsolute) {
|
|
2646
|
-
ret.root = '/';
|
|
2647
|
-
start = 1;
|
|
2648
|
-
} else {
|
|
2649
|
-
start = 0;
|
|
2650
|
-
}
|
|
2651
|
-
var startDot = -1;
|
|
2652
|
-
var startPart = 0;
|
|
2653
|
-
var end = -1;
|
|
2654
|
-
var matchedSlash = true;
|
|
2655
|
-
var i = path.length - 1;
|
|
2656
|
-
|
|
2657
|
-
// Track the state of characters (if any) we see before our first dot and
|
|
2658
|
-
// after any path separator we find
|
|
2659
|
-
var preDotState = 0;
|
|
2660
|
-
|
|
2661
|
-
// Get non-dir info
|
|
2662
|
-
for (; i >= start; --i) {
|
|
2663
|
-
code = path.charCodeAt(i);
|
|
2664
|
-
if (code === 47 /*/*/) {
|
|
2665
|
-
// If we reached a path separator that was not part of a set of path
|
|
2666
|
-
// separators at the end of the string, stop now
|
|
2667
|
-
if (!matchedSlash) {
|
|
2668
|
-
startPart = i + 1;
|
|
2669
|
-
break;
|
|
2670
|
-
}
|
|
2671
|
-
continue;
|
|
2672
|
-
}
|
|
2673
|
-
if (end === -1) {
|
|
2674
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
2675
|
-
// extension
|
|
2676
|
-
matchedSlash = false;
|
|
2677
|
-
end = i + 1;
|
|
2678
|
-
}
|
|
2679
|
-
if (code === 46 /*.*/) {
|
|
2680
|
-
// If this is our first dot, mark it as the start of our extension
|
|
2681
|
-
if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;
|
|
2682
|
-
} else if (startDot !== -1) {
|
|
2683
|
-
// We saw a non-dot and non-path separator before our dot, so we should
|
|
2684
|
-
// have a good chance at having a non-empty extension
|
|
2685
|
-
preDotState = -1;
|
|
2686
|
-
}
|
|
2687
|
-
}
|
|
2688
|
-
|
|
2689
|
-
if (startDot === -1 || end === -1 ||
|
|
2690
|
-
// We saw a non-dot character immediately before the dot
|
|
2691
|
-
preDotState === 0 ||
|
|
2692
|
-
// The (right-most) trimmed path component is exactly '..'
|
|
2693
|
-
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
2694
|
-
if (end !== -1) {
|
|
2695
|
-
if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);
|
|
2696
|
-
}
|
|
2697
|
-
} else {
|
|
2698
|
-
if (startPart === 0 && isAbsolute) {
|
|
2699
|
-
ret.name = path.slice(1, startDot);
|
|
2700
|
-
ret.base = path.slice(1, end);
|
|
2701
|
-
} else {
|
|
2702
|
-
ret.name = path.slice(startPart, startDot);
|
|
2703
|
-
ret.base = path.slice(startPart, end);
|
|
2704
|
-
}
|
|
2705
|
-
ret.ext = path.slice(startDot, end);
|
|
2706
|
-
}
|
|
2707
|
-
|
|
2708
|
-
if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';
|
|
2709
|
-
|
|
2710
|
-
return ret;
|
|
2711
|
-
},
|
|
2712
|
-
|
|
2713
|
-
sep: '/',
|
|
2714
|
-
delimiter: ':',
|
|
2715
|
-
win32: null,
|
|
2716
|
-
posix: null
|
|
2717
|
-
};
|
|
1945
|
+
}
|
|
2718
1946
|
|
|
2719
|
-
|
|
1947
|
+
const SECOND = 1;
|
|
1948
|
+
const ZEPTOSECOND = exponential(SECOND, -21);
|
|
1949
|
+
const ATTOSECOND = exponential(SECOND, -18);
|
|
1950
|
+
const FEMTOSECOND = exponential(SECOND, -15);
|
|
1951
|
+
const PICOSECOND = exponential(SECOND, -12);
|
|
1952
|
+
const NANOSECOND = exponential(SECOND, -9);
|
|
1953
|
+
const MICROSECOND = exponential(SECOND, -6);
|
|
1954
|
+
const MILISECOND = exponential(SECOND, -3);
|
|
1955
|
+
const CENTISECOND = exponential(SECOND, -2);
|
|
1956
|
+
const DECISECOND = exponential(SECOND, -1);
|
|
1957
|
+
const MINUTE = 60 * SECOND;
|
|
1958
|
+
const HOUR = 60 * MINUTE;
|
|
1959
|
+
const DAY = 24 * HOUR;
|
|
1960
|
+
const YEAR = 365 * DAY;
|
|
1961
|
+
const MONTH = YEAR / 12;
|
|
1962
|
+
// Derived: explicit names
|
|
1963
|
+
const SECONDS_PER_MINUTE = MINUTE;
|
|
1964
|
+
const SECONDS_PER_HOUR = HOUR;
|
|
1965
|
+
const SECONDS_PER_DAY = DAY;
|
|
1966
|
+
//math
|
|
1967
|
+
const PI = Math.PI;
|
|
1968
|
+
const PI2 = 2 * PI;
|
|
1969
|
+
// Distance
|
|
1970
|
+
const METERS_PER_KM = 1000;
|
|
1971
|
+
const METERS_PER_MILE = 1609.34;
|
|
1972
|
+
const METERS_PER_FOOT = 0.3048;
|
|
1973
|
+
const KMS_PER_METER = 1 / METERS_PER_KM;
|
|
1974
|
+
const MILES_PER_METER = 1 / METERS_PER_MILE;
|
|
1975
|
+
const FEET_PER_METER = 1 / METERS_PER_FOOT;
|
|
1976
|
+
const MIN_IN_S = 1 / MINUTE;
|
|
1977
|
+
const HOUR_IN_S = 1 / HOUR;
|
|
1978
|
+
const DAY_IN_S = 1 / DAY;
|
|
1979
|
+
const YEAR_IN_S = 1 / YEAR;
|
|
1980
|
+
const MONTH_IN_S = 1 / MONTH;
|
|
1981
|
+
const MiPerH_TO_MPerS = METERS_PER_MILE * HOUR_IN_S;
|
|
1982
|
+
const MPerS_TO_MiPerH = 1 / MiPerH_TO_MPerS;
|
|
2720
1983
|
|
|
2721
|
-
|
|
1984
|
+
// conversions.ts
|
|
1985
|
+
/*───────────────────────────────────────────────────────────────
|
|
1986
|
+
🧭 CANONICAL MAPPINGS
|
|
1987
|
+
───────────────────────────────────────────────────────────────*/
|
|
1988
|
+
const DIST_ALIASES = {
|
|
1989
|
+
m: "m", meter: "m", meters: "m",
|
|
1990
|
+
km: "km", kms: "km", kilometer: "km", kilometers: "km",
|
|
1991
|
+
mi: "mi", mile: "mi", miles: "mi",
|
|
1992
|
+
ft: "ft", f: "ft", foot: "ft", feet: "ft",
|
|
1993
|
+
};
|
|
1994
|
+
const TIME_ALIASES = {
|
|
1995
|
+
s: "s", sec: "s", second: "s", seconds: "s",
|
|
1996
|
+
min: "min", m: "min", minute: "min", minutes: "min",
|
|
1997
|
+
h: "h", hr: "h", hour: "h", hours: "h",
|
|
1998
|
+
day: "day", d: "day", days: "day",
|
|
1999
|
+
};
|
|
2000
|
+
const DIST_FACTORS = {
|
|
2001
|
+
m: 1,
|
|
2002
|
+
km: METERS_PER_KM,
|
|
2003
|
+
mi: METERS_PER_MILE,
|
|
2004
|
+
ft: METERS_PER_FOOT,
|
|
2005
|
+
};
|
|
2006
|
+
const TIME_FACTORS = {
|
|
2007
|
+
s: 1,
|
|
2008
|
+
min: MINUTE,
|
|
2009
|
+
h: HOUR,
|
|
2010
|
+
day: DAY,
|
|
2011
|
+
};
|
|
2012
|
+
/*───────────────────────────────────────────────────────────────
|
|
2013
|
+
🔍 CANONICALIZATION HELPERS
|
|
2014
|
+
───────────────────────────────────────────────────────────────*/
|
|
2015
|
+
function canonDist(u) {
|
|
2016
|
+
const key = (u ?? "m").toString().toLowerCase();
|
|
2017
|
+
const canon = DIST_ALIASES[key];
|
|
2018
|
+
if (!canon)
|
|
2019
|
+
throw new Error(`Unknown distance unit: ${u}`);
|
|
2020
|
+
return canon;
|
|
2021
|
+
}
|
|
2022
|
+
function canonTime(u) {
|
|
2023
|
+
const key = (u ?? "s").toString().toLowerCase();
|
|
2024
|
+
const canon = TIME_ALIASES[key];
|
|
2025
|
+
if (!canon)
|
|
2026
|
+
throw new Error(`Unknown time unit: ${u}`);
|
|
2027
|
+
return canon;
|
|
2028
|
+
}
|
|
2029
|
+
/*───────────────────────────────────────────────────────────────
|
|
2030
|
+
⚖️ NORMALIZATION HELPERS
|
|
2031
|
+
───────────────────────────────────────────────────────────────*/
|
|
2032
|
+
function distanceToMeters(d, unit) {
|
|
2033
|
+
const u = canonDist(unit);
|
|
2034
|
+
return safeMultiply(d, DIST_FACTORS[u]);
|
|
2035
|
+
}
|
|
2036
|
+
function metersToDistance(v, unit) {
|
|
2037
|
+
const u = canonDist(unit);
|
|
2038
|
+
return safeDivide(v, DIST_FACTORS[u]);
|
|
2039
|
+
}
|
|
2040
|
+
function timeToSeconds(t, unit) {
|
|
2041
|
+
const u = canonTime(unit);
|
|
2042
|
+
return safeMultiply(t, TIME_FACTORS[u]);
|
|
2043
|
+
}
|
|
2044
|
+
function secondsToTime(v, unit) {
|
|
2045
|
+
const u = canonTime(unit);
|
|
2046
|
+
return safeDivide(v, TIME_FACTORS[u]);
|
|
2047
|
+
}
|
|
2048
|
+
/*───────────────────────────────────────────────────────────────
|
|
2049
|
+
🚀 SPEED CONVERSIONS (normalize / unnormalize)
|
|
2050
|
+
───────────────────────────────────────────────────────────────*/
|
|
2051
|
+
function speedToMps(v, distUnit, timeUnit) {
|
|
2052
|
+
const du = canonDist(distUnit);
|
|
2053
|
+
const tu = canonTime(timeUnit);
|
|
2054
|
+
return v * (DIST_FACTORS[du] / TIME_FACTORS[tu]);
|
|
2055
|
+
}
|
|
2056
|
+
function mpsToSpeed(vMps, distUnit, timeUnit) {
|
|
2057
|
+
const du = canonDist(distUnit);
|
|
2058
|
+
const tu = canonTime(timeUnit);
|
|
2059
|
+
return vMps * (TIME_FACTORS[tu] / DIST_FACTORS[du]);
|
|
2060
|
+
}
|
|
2061
|
+
/*───────────────────────────────────────────────────────────────
|
|
2062
|
+
🎯 UNIVERSAL CONVERTERS
|
|
2063
|
+
───────────────────────────────────────────────────────────────*/
|
|
2064
|
+
function convertDistance({ d, fromDist, toDist, vOnly = true, }) {
|
|
2065
|
+
const m = distanceToMeters(d, fromDist);
|
|
2066
|
+
const D = canonDist(toDist ?? "m");
|
|
2067
|
+
const out = metersToDistance(m, D);
|
|
2068
|
+
return vOnly ? out : { d: out, D };
|
|
2069
|
+
}
|
|
2070
|
+
function convertTime({ t, fromTime, toTime, vOnly = true, }) {
|
|
2071
|
+
const sec = timeToSeconds(t, fromTime);
|
|
2072
|
+
const T = canonTime(toTime ?? "s");
|
|
2073
|
+
const out = secondsToTime(sec, T);
|
|
2074
|
+
return vOnly ? out : { t: out, T };
|
|
2075
|
+
}
|
|
2076
|
+
function convertSpeed({ v, fromDist, fromTime, toDist, toTime, vOnly = true, }) {
|
|
2077
|
+
const mps = speedToMps(v, fromDist, fromTime);
|
|
2078
|
+
const d = canonDist(toDist ?? "m");
|
|
2079
|
+
const t = canonTime(toTime ?? "s");
|
|
2080
|
+
const out = mpsToSpeed(mps, d, t);
|
|
2081
|
+
return vOnly ? out : { v: out, d, t };
|
|
2082
|
+
}
|
|
2083
|
+
const DistanceConverter = {
|
|
2084
|
+
normalize: distanceToMeters,
|
|
2085
|
+
unnormalize: metersToDistance,
|
|
2086
|
+
};
|
|
2087
|
+
const TimeConverter = {
|
|
2088
|
+
normalize: timeToSeconds,
|
|
2089
|
+
unnormalize: secondsToTime,
|
|
2090
|
+
};
|
|
2091
|
+
const SpeedConverter = {
|
|
2092
|
+
normalize: (v, [du, tu]) => speedToMps(v, du, tu),
|
|
2093
|
+
unnormalize: (v, [du, tu]) => mpsToSpeed(v, du, tu),
|
|
2094
|
+
};
|
|
2095
|
+
/*───────────────────────────────────────────────────────────────
|
|
2096
|
+
🧩 COMPATIBILITY WRAPPERS (legacy aliases)
|
|
2097
|
+
───────────────────────────────────────────────────────────────*/
|
|
2098
|
+
const toMeters = distanceToMeters;
|
|
2099
|
+
const fromMeters = metersToDistance;
|
|
2100
|
+
const toSeconds = timeToSeconds;
|
|
2101
|
+
const fromSeconds = secondsToTime;
|
|
2102
|
+
const velocityToMs = (value, unit) => speedToMps(value, unit, "s");
|
|
2103
|
+
const velocityFromMs = (value, unit) => mpsToSpeed(value, unit, "s");
|
|
2104
|
+
/** Non-canonical helper for arbitrary rate conversion, e.g. ft/day → m/s */
|
|
2105
|
+
const fromMps = (v, dist_unit, time_unit) => mpsToSpeed(v, dist_unit, time_unit);
|
|
2106
|
+
/*───────────────────────────────────────────────────────────────
|
|
2107
|
+
📊 UTILITIES
|
|
2108
|
+
───────────────────────────────────────────────────────────────*/
|
|
2109
|
+
const isFiniteNum = (x) => Number.isFinite(x);
|
|
2110
|
+
const fmt = (n, digits = 2) => isFiniteNum(n) ? n.toFixed(digits) : "N/A";
|
|
2722
2111
|
|
|
2723
|
-
|
|
2112
|
+
// Function to check time interval
|
|
2113
|
+
function isTimeInterval(timeObj, interval) {
|
|
2114
|
+
return (Date.now() / 1000 - timeObj) < (interval - 1);
|
|
2115
|
+
}
|
|
2724
2116
|
|
|
2725
2117
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2726
2118
|
|
|
@@ -13577,7 +12969,7 @@ function requireFile () {
|
|
|
13577
12969
|
hasRequiredFile = 1;
|
|
13578
12970
|
|
|
13579
12971
|
const fs = require$$0$6;
|
|
13580
|
-
const path =
|
|
12972
|
+
const path = path$1;
|
|
13581
12973
|
const asyncSeries = requireSeries();
|
|
13582
12974
|
const zlib = require$$3;
|
|
13583
12975
|
const { MESSAGE } = tripleBeam;
|
|
@@ -17278,7 +16670,7 @@ function resolveLogger(candidate) {
|
|
|
17278
16670
|
return null;
|
|
17279
16671
|
}
|
|
17280
16672
|
/* ------------------------------------------------------------------ */
|
|
17281
|
-
/*
|
|
16673
|
+
/* IMPLEMENTATION */
|
|
17282
16674
|
/* ------------------------------------------------------------------ */
|
|
17283
16675
|
function getLogString(messageOrOptions, logType = null, details = null, function_name = null, file_location = null, consumerLogger = null) {
|
|
17284
16676
|
// ---------------- Normalize inputs ----------------
|
|
@@ -17441,7 +16833,7 @@ function getSafeLocalStorage() {
|
|
|
17441
16833
|
try {
|
|
17442
16834
|
return window.localStorage;
|
|
17443
16835
|
}
|
|
17444
|
-
catch
|
|
16836
|
+
catch {
|
|
17445
16837
|
return undefined; // e.g. Safari private-mode block
|
|
17446
16838
|
}
|
|
17447
16839
|
}
|
|
@@ -17462,7 +16854,7 @@ function callStorage(method, ...args) {
|
|
|
17462
16854
|
try {
|
|
17463
16855
|
return fn.apply(storage, args);
|
|
17464
16856
|
}
|
|
17465
|
-
catch
|
|
16857
|
+
catch {
|
|
17466
16858
|
return undefined;
|
|
17467
16859
|
}
|
|
17468
16860
|
}
|
|
@@ -17477,7 +16869,7 @@ function safeStorage(storageName, method, ...args) {
|
|
|
17477
16869
|
return undefined;
|
|
17478
16870
|
return store[method](...args);
|
|
17479
16871
|
}
|
|
17480
|
-
catch
|
|
16872
|
+
catch {
|
|
17481
16873
|
return undefined;
|
|
17482
16874
|
}
|
|
17483
16875
|
}
|
|
@@ -17507,7 +16899,7 @@ function callWindowMethod(method, ...args) {
|
|
|
17507
16899
|
// cast to any so TS doesn’t complain about apply/invoke
|
|
17508
16900
|
return fn(...args);
|
|
17509
16901
|
}
|
|
17510
|
-
catch
|
|
16902
|
+
catch {
|
|
17511
16903
|
return undefined;
|
|
17512
16904
|
}
|
|
17513
16905
|
}
|
|
@@ -17525,172 +16917,132 @@ function getWindowHost() {
|
|
|
17525
16917
|
return getWindowProp('location', 'host');
|
|
17526
16918
|
}
|
|
17527
16919
|
|
|
17528
|
-
|
|
17529
|
-
|
|
17530
|
-
|
|
17531
|
-
|
|
17532
|
-
|
|
17533
|
-
|
|
17534
|
-
if (!
|
|
17535
|
-
try {
|
|
17536
|
-
// prevent bundlers from resolving these at build time
|
|
17537
|
-
fs = (new Function("return require('fs')"))();
|
|
17538
|
-
path = (new Function("return require('path')"))();
|
|
17539
|
-
}
|
|
17540
|
-
catch (_b) {
|
|
17541
|
-
fs = null;
|
|
17542
|
-
path = null;
|
|
17543
|
-
}
|
|
17544
|
-
}
|
|
17545
|
-
return { fs, path };
|
|
17546
|
-
});
|
|
17547
|
-
}
|
|
17548
|
-
/**
|
|
17549
|
-
* Reads a JSON file, either via Node’s fs (if available)
|
|
17550
|
-
* or via window.fetch in the browser. Never throws — returns
|
|
17551
|
-
* the parsed object or null on any error.
|
|
17552
|
-
*/
|
|
17553
|
-
function readJsonFile(relativeOrAbsolutePath) {
|
|
17554
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17555
|
-
var _a;
|
|
17556
|
-
// 1) Try Node.js fs (only at runtime, not bundled)
|
|
17557
|
-
if (typeof process !== "undefined" && ((_a = process.versions) === null || _a === void 0 ? void 0 : _a.node)) {
|
|
17558
|
-
try {
|
|
17559
|
-
const { fs, path } = yield getFsModules();
|
|
17560
|
-
if (fs && path) {
|
|
17561
|
-
const filePath = path.isAbsolute(relativeOrAbsolutePath)
|
|
17562
|
-
? relativeOrAbsolutePath
|
|
17563
|
-
: path.resolve(process.cwd(), relativeOrAbsolutePath);
|
|
17564
|
-
const text = fs.readFileSync(filePath, "utf8");
|
|
17565
|
-
return JSON.parse(text);
|
|
17566
|
-
}
|
|
17567
|
-
}
|
|
17568
|
-
catch (_b) {
|
|
17569
|
-
// swallow and fall back
|
|
17570
|
-
}
|
|
17571
|
-
}
|
|
17572
|
-
// 2) Try browser fetch
|
|
17573
|
-
const fetchFn = safeGlobalProp("fetch");
|
|
17574
|
-
if (typeof fetchFn !== "function") {
|
|
17575
|
-
return null;
|
|
17576
|
-
}
|
|
17577
|
-
let url = relativeOrAbsolutePath;
|
|
17578
|
-
const baseURI = safeGlobalProp("document", "baseURI");
|
|
17579
|
-
if (baseURI) {
|
|
17580
|
-
try {
|
|
17581
|
-
url = new URL(relativeOrAbsolutePath, baseURI).href;
|
|
17582
|
-
}
|
|
17583
|
-
catch (_c) {
|
|
17584
|
-
/* keep url as-is */
|
|
17585
|
-
}
|
|
17586
|
-
}
|
|
17587
|
-
try {
|
|
17588
|
-
const res = yield fetchFn(url);
|
|
17589
|
-
if (!res.ok)
|
|
17590
|
-
return null;
|
|
17591
|
-
return (yield res.json());
|
|
17592
|
-
}
|
|
17593
|
-
catch (_d) {
|
|
16920
|
+
async function readJsonFileBrowser(url) {
|
|
16921
|
+
const fetchFn = safeGlobalProp("fetch");
|
|
16922
|
+
if (typeof fetchFn !== "function")
|
|
16923
|
+
return null;
|
|
16924
|
+
try {
|
|
16925
|
+
const res = await fetchFn(url);
|
|
16926
|
+
if (!res.ok)
|
|
17594
16927
|
return null;
|
|
17595
|
-
|
|
17596
|
-
}
|
|
16928
|
+
return (await res.json());
|
|
16929
|
+
}
|
|
16930
|
+
catch {
|
|
16931
|
+
return null;
|
|
16932
|
+
}
|
|
17597
16933
|
}
|
|
17598
|
-
|
|
17599
|
-
|
|
17600
|
-
|
|
17601
|
-
|
|
17602
|
-
|
|
17603
|
-
|
|
17604
|
-
|
|
17605
|
-
|
|
17606
|
-
|
|
17607
|
-
|
|
17608
|
-
|
|
17609
|
-
|
|
16934
|
+
|
|
16935
|
+
var readJsonFile_browser = /*#__PURE__*/Object.freeze({
|
|
16936
|
+
__proto__: null,
|
|
16937
|
+
readJsonFileBrowser: readJsonFileBrowser
|
|
16938
|
+
});
|
|
16939
|
+
|
|
16940
|
+
function readJsonFileNode(relativeOrAbsolutePath) {
|
|
16941
|
+
try {
|
|
16942
|
+
const filePath = isAbsolute(relativeOrAbsolutePath)
|
|
16943
|
+
? relativeOrAbsolutePath
|
|
16944
|
+
: resolve(process.cwd(), relativeOrAbsolutePath);
|
|
16945
|
+
return JSON.parse(readFileSync(filePath, "utf8"));
|
|
16946
|
+
}
|
|
16947
|
+
catch {
|
|
16948
|
+
return null;
|
|
16949
|
+
}
|
|
17610
16950
|
}
|
|
17611
|
-
|
|
17612
|
-
|
|
17613
|
-
|
|
17614
|
-
|
|
17615
|
-
|
|
17616
|
-
|
|
17617
|
-
|
|
17618
|
-
|
|
17619
|
-
|
|
16951
|
+
|
|
16952
|
+
var readJsonFile_node = /*#__PURE__*/Object.freeze({
|
|
16953
|
+
__proto__: null,
|
|
16954
|
+
readJsonFileNode: readJsonFileNode
|
|
16955
|
+
});
|
|
16956
|
+
|
|
16957
|
+
async function readJsonFile(relativeOrAbsolutePath) {
|
|
16958
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
16959
|
+
const mod = await Promise.resolve().then(function () { return readJsonFile_node; });
|
|
16960
|
+
return mod.readJsonFileNode(relativeOrAbsolutePath);
|
|
16961
|
+
}
|
|
16962
|
+
else {
|
|
16963
|
+
const mod = await Promise.resolve().then(function () { return readJsonFile_browser; });
|
|
16964
|
+
return mod.readJsonFileBrowser(relativeOrAbsolutePath);
|
|
16965
|
+
}
|
|
16966
|
+
}
|
|
16967
|
+
async function getConfigContent() {
|
|
16968
|
+
try {
|
|
16969
|
+
// `readJsonFile` should throw if the file isn’t there or isn’t valid JSON
|
|
16970
|
+
const cfg = await readJsonFile('./config.json');
|
|
16971
|
+
return cfg;
|
|
16972
|
+
}
|
|
16973
|
+
catch {
|
|
16974
|
+
// swallow errors & return null so callers can detect “no config”
|
|
16975
|
+
return null;
|
|
16976
|
+
}
|
|
17620
16977
|
}
|
|
17621
16978
|
|
|
17622
16979
|
// src/functions/config_utils/src/config_utils.ts
|
|
17623
16980
|
let _cachedConfig = null;
|
|
17624
|
-
function loadConfig() {
|
|
17625
|
-
|
|
17626
|
-
|
|
17627
|
-
|
|
16981
|
+
async function loadConfig(filePath = null) {
|
|
16982
|
+
if (_cachedConfig) {
|
|
16983
|
+
return _cachedConfig;
|
|
16984
|
+
}
|
|
16985
|
+
// 1) figure out where config.json lives
|
|
16986
|
+
let configUrl;
|
|
16987
|
+
if (filePath) {
|
|
16988
|
+
configUrl = filePath;
|
|
16989
|
+
}
|
|
16990
|
+
else if (typeof import.meta !== 'undefined' && typeof import.meta.url === 'string') {
|
|
16991
|
+
// ES module: resolve relative to this file
|
|
16992
|
+
try {
|
|
16993
|
+
const mod = await (new Function("return import('./config.json').catch(() => ({}))"))();
|
|
16994
|
+
_cachedConfig = mod.default ?? {};
|
|
17628
16995
|
return _cachedConfig;
|
|
17629
16996
|
}
|
|
17630
|
-
|
|
17631
|
-
|
|
17632
|
-
if (filePath) {
|
|
17633
|
-
configUrl = filePath;
|
|
17634
|
-
}
|
|
17635
|
-
else if (typeof import.meta !== 'undefined' && typeof import.meta.url === 'string') {
|
|
17636
|
-
// ES module: resolve relative to this file
|
|
17637
|
-
try {
|
|
17638
|
-
const mod = yield (new Function("return import('./config.json').catch(() => ({}))"))();
|
|
17639
|
-
_cachedConfig = (_a = mod.default) !== null && _a !== void 0 ? _a : {};
|
|
17640
|
-
return _cachedConfig;
|
|
17641
|
-
}
|
|
17642
|
-
catch (_c) {
|
|
17643
|
-
configUrl = 'config.json';
|
|
17644
|
-
}
|
|
16997
|
+
catch {
|
|
16998
|
+
configUrl = 'config.json';
|
|
17645
16999
|
}
|
|
17646
|
-
|
|
17647
|
-
|
|
17648
|
-
|
|
17649
|
-
|
|
17650
|
-
|
|
17651
|
-
|
|
17652
|
-
|
|
17653
|
-
|
|
17654
|
-
|
|
17655
|
-
catch (_d) {
|
|
17656
|
-
configUrl = 'config.json';
|
|
17657
|
-
}
|
|
17000
|
+
}
|
|
17001
|
+
else {
|
|
17002
|
+
// browser fallback
|
|
17003
|
+
const baseURI = safeGlobalProp('document', 'baseURI');
|
|
17004
|
+
try {
|
|
17005
|
+
configUrl =
|
|
17006
|
+
typeof baseURI === 'string'
|
|
17007
|
+
? new URL('config.json', baseURI).href
|
|
17008
|
+
: 'config.json';
|
|
17658
17009
|
}
|
|
17659
|
-
|
|
17660
|
-
|
|
17661
|
-
if (typeof fetchFn === 'function') {
|
|
17662
|
-
try {
|
|
17663
|
-
const res = yield fetchFn(configUrl);
|
|
17664
|
-
if (res.ok) {
|
|
17665
|
-
const json = yield res.json();
|
|
17666
|
-
// cache & return
|
|
17667
|
-
_cachedConfig = (_b = json) !== null && _b !== void 0 ? _b : {};
|
|
17668
|
-
return _cachedConfig;
|
|
17669
|
-
}
|
|
17670
|
-
}
|
|
17671
|
-
catch (_e) {
|
|
17672
|
-
/* swallow */
|
|
17673
|
-
}
|
|
17010
|
+
catch {
|
|
17011
|
+
configUrl = 'config.json';
|
|
17674
17012
|
}
|
|
17675
|
-
|
|
17013
|
+
}
|
|
17014
|
+
// 2) if we have a fetch, try HTTP(S)
|
|
17015
|
+
const fetchFn = safeGlobalProp('fetch');
|
|
17016
|
+
if (typeof fetchFn === 'function') {
|
|
17676
17017
|
try {
|
|
17677
|
-
const
|
|
17678
|
-
|
|
17679
|
-
|
|
17018
|
+
const res = await fetchFn(configUrl);
|
|
17019
|
+
if (res.ok) {
|
|
17020
|
+
const json = await res.json();
|
|
17021
|
+
// cache & return
|
|
17022
|
+
_cachedConfig = json ?? {};
|
|
17023
|
+
return _cachedConfig;
|
|
17024
|
+
}
|
|
17680
17025
|
}
|
|
17681
|
-
catch
|
|
17026
|
+
catch {
|
|
17682
17027
|
/* swallow */
|
|
17683
17028
|
}
|
|
17684
|
-
|
|
17685
|
-
|
|
17029
|
+
}
|
|
17030
|
+
// 3) Node fallback: try reading from disk (requires your readJsonFile util)
|
|
17031
|
+
try {
|
|
17032
|
+
const disk = await readJsonFile(configUrl);
|
|
17033
|
+
_cachedConfig = disk ?? {};
|
|
17686
17034
|
return _cachedConfig;
|
|
17687
|
-
}
|
|
17035
|
+
}
|
|
17036
|
+
catch {
|
|
17037
|
+
/* swallow */
|
|
17038
|
+
}
|
|
17039
|
+
// 4) if all else fails, return an empty config
|
|
17040
|
+
_cachedConfig = {};
|
|
17041
|
+
return _cachedConfig;
|
|
17688
17042
|
}
|
|
17689
|
-
function getConfig(key) {
|
|
17690
|
-
|
|
17691
|
-
|
|
17692
|
-
return key != null ? cfg[key] : cfg;
|
|
17693
|
-
});
|
|
17043
|
+
async function getConfig(key) {
|
|
17044
|
+
const cfg = await loadConfig();
|
|
17045
|
+
return key != null ? cfg[key] : cfg;
|
|
17694
17046
|
}
|
|
17695
17047
|
|
|
17696
17048
|
/**
|
|
@@ -17772,5 +17124,5 @@ function dataSize(data) {
|
|
|
17772
17124
|
return size / 1000; // Convert to kilobytes
|
|
17773
17125
|
}
|
|
17774
17126
|
|
|
17775
|
-
export { API_PREFIX, ATTOSECOND, BASE_URL, CENTISECOND, DAY, DAY_IN_S, DECISECOND, DEV_PREFIX, DIST_ALIASES, DIST_FACTORS, DOMAIN_NAME, DistanceConverter, FEET_PER_METER, FEMTOSECOND, HOUR, HOUR_IN_S, KMS_PER_METER, MEDIA_TYPES, METERS_PER_FOOT, METERS_PER_KM, METERS_PER_MILE, MICROSECOND, MILES_PER_METER, MILISECOND, MIME_TYPES, MINUTE, MIN_IN_S, MONTH, MONTH_IN_S, MPerS_TO_MiPerH, MiPerH_TO_MPerS, NANOSECOND, PI, PI2, PICOSECOND, PROD_PREFIX, PROTOCOL, SECOND, SECONDS_PER_DAY, SECONDS_PER_HOUR, SECONDS_PER_MINUTE, SUB_DIR, SpeedConverter, TIME_ALIASES, TIME_FACTORS, TimeConverter, YEAR, YEAR_IN_S, ZEPTOSECOND, alertit, assureArray, assureList, assureNumber, assureString, assure_array, assure_list, assure_number, assure_string, assurearray, assurelist, assurenumber, assurestring, callStorage, callWindowMethod, canonDist, canonTime, capitalize, capitalize_str, checkResponse, cleanArray, cleanText, confirmType, confirm_type, convertBigInts, convertDistance, convertSpeed, convertTime, create_list_string, dataSize, dataSizeInMb, decodeJwt, distanceToMeters, eatAll, eatElse, eatInner, eatOuter, eatall, eatinner, eatouter, emptyObjectToNull, ends_in_quotes, ensureArray, ensureList, ensureNumber, ensureString, ensure_array, ensure_list, ensure_number, ensure_string, ensurearray, ensurelist, ensurenumber, ensurestring, exceedsMbLimit, exponential, extractInsertData, fetchIndexHtml, fetchIndexHtmlContainer, fetchIt, findKeyValue, fmt, formatNumber, fromMeters, fromMps, fromSeconds, geAuthsUtilsDirectory, geBackupsUtilsDirectory, geConstantsUtilsDirectory, geEnvUtilsDirectory, geFetchUtilsDirectory, geFileUtilsDirectory, gePathUtilsDirectory, geStaticDirectory, geStringUtilsDirectory, geTypeUtilsDirectory, get, getAbsDir, getAbsPath, getAllFileTypes, getAllFileTypesSync, getAlphaNum, getAlphas, getBaseDir, getBasename, getBody, getChar, getCleanArray, getComponentsUtilsDirectory, getConfig, getConfigContent,
|
|
17127
|
+
export { API_PREFIX, ATTOSECOND, BASE_URL, CENTISECOND, DAY, DAY_IN_S, DECISECOND, DEV_PREFIX, DIST_ALIASES, DIST_FACTORS, DOMAIN_NAME, DistanceConverter, FEET_PER_METER, FEMTOSECOND, HOUR, HOUR_IN_S, KMS_PER_METER, MEDIA_TYPES, METERS_PER_FOOT, METERS_PER_KM, METERS_PER_MILE, MICROSECOND, MILES_PER_METER, MILISECOND, MIME_TYPES, MINUTE, MIN_IN_S, MONTH, MONTH_IN_S, MPerS_TO_MiPerH, MiPerH_TO_MPerS, NANOSECOND, PI, PI2, PICOSECOND, PROD_PREFIX, PROTOCOL, SECOND, SECONDS_PER_DAY, SECONDS_PER_HOUR, SECONDS_PER_MINUTE, SUB_DIR, SpeedConverter, TIME_ALIASES, TIME_FACTORS, TimeConverter, YEAR, YEAR_IN_S, ZEPTOSECOND, alertit, assureArray, assureList, assureNumber, assureString, assure_array, assure_list, assure_number, assure_string, assurearray, assurelist, assurenumber, assurestring, callStorage, callWindowMethod, canonDist, canonTime, capitalize, capitalize_str, checkResponse, cleanArray, cleanText, confirmType, confirm_type, convertBigInts, convertDistance, convertSpeed, convertTime, create_list_string, dataSize, dataSizeInMb, decodeJwt, distanceToMeters, eatAll, eatElse, eatInner, eatOuter, eatall, eatinner, eatouter, emptyObjectToNull, ends_in_quotes, ensureArray, ensureList, ensureNumber, ensureString, ensure_array, ensure_list, ensure_number, ensure_string, ensurearray, ensurelist, ensurenumber, ensurestring, exceedsMbLimit, exponential, extractInsertData, fetchIndexHtml, fetchIndexHtmlContainer, fetchIt, findKeyValue, fmt, formatNumber, fromMeters, fromMps, fromSeconds, geAuthsUtilsDirectory, geBackupsUtilsDirectory, geConstantsUtilsDirectory, geEnvUtilsDirectory, geFetchUtilsDirectory, geFileUtilsDirectory, gePathUtilsDirectory, geStaticDirectory, geStringUtilsDirectory, geTypeUtilsDirectory, get, getAbsDir, getAbsPath, getAllFileTypes, getAllFileTypesSync, getAlphaNum, getAlphas, getBaseDir, getBasename, getBody, getChar, getCleanArray, getComponentsUtilsDirectory, getConfig, getConfigContent, getDbConfigsPath, getDirname, getDistDir, getDocumentProp, getEnvDir, getEnvPath, getExtname, getFetchVars, getFilename, getFunctionsDir, getFunctionsUtilsDirectory, getHeaders, getHooksUtilsDirectory, getHtmlDirectory, getIfNone, getJsonSizeInMb, getLibUtilsDirectory, getMediaExts, getMediaMap, getMethod, getMimeType, getNums, getPublicDir, getResult, getSafeDocument, getSafeLocalStorage, getSafeWindow, getSchemasDirPath, getSchemasPath, getSplitext, getSrcDir, getSubstring, getWindowHost, getWindowProp, get_all_file_types, get_basename, get_dirname, get_extname, get_filename, get_full_path, get_full_url, get_key_value, get_keyword_string, get_media_exts, get_media_map, get_mime_type, get_relative_path, get_splitext, get_window, get_window_location, get_window_parts, get_window_pathname, getbasename, getdirname, getextname, getfilename, getsplitext, isFiniteNum, isMediaType, isNum, isStrInString, isTimeInterval, isTokenExpired, isType, isZero, is_media_type, loadConfig, loadInnerJson, makePath, make_path, make_sanitized_path, makepath, mergeNotNullValues, metersToDistance, mpsToSpeed, normalizeUrl, omitKeys, parseResult, pathJoin, path_join, path_to_url, pathjoin, processKeywords, readJsonFile, readJsonFileBrowser, readJsonFileNode, roundPercentage, safeDivide, safeGlobalProp, safeJsonSizeInMb, safeMultiply, safeNums, safeStorage, sanitizeFilename, sanitizeString, secondsToTime, speedToMps, stripPrefixes, stripQuotes, timeToSeconds, toMeters, toSeconds, truncateString, tryEatPrefix, tryParse, urlJoin, url_to_path, urljoin, velocityFromMs, velocityToMs };
|
|
17776
17128
|
//# sourceMappingURL=index.js.map
|