google-spreadsheet 5.0.0 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +100 -2475
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -617
- package/dist/index.d.ts +2 -617
- package/dist/index.js +55 -2434
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
- package/src/lib/GoogleSpreadsheet.ts +9 -6
- package/src/lib/types/auth-types.ts +1 -5
package/dist/index.cjs
CHANGED
|
@@ -1,2389 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
// node_modules/.pnpm/ky@1.8.2/node_modules/ky/distribution/errors/HTTPError.js
|
|
7
|
-
var HTTPError = class extends Error {
|
|
8
|
-
static {
|
|
9
|
-
__name(this, "HTTPError");
|
|
10
|
-
}
|
|
11
|
-
response;
|
|
12
|
-
request;
|
|
13
|
-
options;
|
|
14
|
-
constructor(response, request, options) {
|
|
15
|
-
const code = response.status || response.status === 0 ? response.status : "";
|
|
16
|
-
const title = response.statusText || "";
|
|
17
|
-
const status = `${code} ${title}`.trim();
|
|
18
|
-
const reason = status ? `status code ${status}` : "an unknown error";
|
|
19
|
-
super(`Request failed with ${reason}: ${request.method} ${request.url}`);
|
|
20
|
-
this.name = "HTTPError";
|
|
21
|
-
this.response = response;
|
|
22
|
-
this.request = request;
|
|
23
|
-
this.options = options;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
// node_modules/.pnpm/ky@1.8.2/node_modules/ky/distribution/errors/TimeoutError.js
|
|
28
|
-
var TimeoutError = class extends Error {
|
|
29
|
-
static {
|
|
30
|
-
__name(this, "TimeoutError");
|
|
31
|
-
}
|
|
32
|
-
request;
|
|
33
|
-
constructor(request) {
|
|
34
|
-
super(`Request timed out: ${request.method} ${request.url}`);
|
|
35
|
-
this.name = "TimeoutError";
|
|
36
|
-
this.request = request;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
// node_modules/.pnpm/ky@1.8.2/node_modules/ky/distribution/core/constants.js
|
|
41
|
-
var supportsRequestStreams = (() => {
|
|
42
|
-
let duplexAccessed = false;
|
|
43
|
-
let hasContentType = false;
|
|
44
|
-
const supportsReadableStream = typeof globalThis.ReadableStream === "function";
|
|
45
|
-
const supportsRequest = typeof globalThis.Request === "function";
|
|
46
|
-
if (supportsReadableStream && supportsRequest) {
|
|
47
|
-
try {
|
|
48
|
-
hasContentType = new globalThis.Request("https://empty.invalid", {
|
|
49
|
-
body: new globalThis.ReadableStream(),
|
|
50
|
-
method: "POST",
|
|
51
|
-
// @ts-expect-error - Types are outdated.
|
|
52
|
-
get duplex() {
|
|
53
|
-
duplexAccessed = true;
|
|
54
|
-
return "half";
|
|
55
|
-
}
|
|
56
|
-
}).headers.has("Content-Type");
|
|
57
|
-
} catch (error) {
|
|
58
|
-
if (error instanceof Error && error.message === "unsupported BodyInit type") {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
throw error;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return duplexAccessed && !hasContentType;
|
|
65
|
-
})();
|
|
66
|
-
var supportsAbortController = typeof globalThis.AbortController === "function";
|
|
67
|
-
var supportsAbortSignal = typeof globalThis.AbortSignal === "function" && typeof globalThis.AbortSignal.any === "function";
|
|
68
|
-
var supportsResponseStreams = typeof globalThis.ReadableStream === "function";
|
|
69
|
-
var supportsFormData = typeof globalThis.FormData === "function";
|
|
70
|
-
var requestMethods = ["get", "post", "put", "patch", "head", "delete"];
|
|
71
|
-
var validate = /* @__PURE__ */ __name(() => void 0, "validate");
|
|
72
|
-
validate();
|
|
73
|
-
var responseTypes = {
|
|
74
|
-
json: "application/json",
|
|
75
|
-
text: "text/*",
|
|
76
|
-
formData: "multipart/form-data",
|
|
77
|
-
arrayBuffer: "*/*",
|
|
78
|
-
blob: "*/*"
|
|
79
|
-
};
|
|
80
|
-
var maxSafeTimeout = 2147483647;
|
|
81
|
-
var usualFormBoundarySize = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length;
|
|
82
|
-
var stop = Symbol("stop");
|
|
83
|
-
var kyOptionKeys = {
|
|
84
|
-
json: true,
|
|
85
|
-
parseJson: true,
|
|
86
|
-
stringifyJson: true,
|
|
87
|
-
searchParams: true,
|
|
88
|
-
prefixUrl: true,
|
|
89
|
-
retry: true,
|
|
90
|
-
timeout: true,
|
|
91
|
-
hooks: true,
|
|
92
|
-
throwHttpErrors: true,
|
|
93
|
-
onDownloadProgress: true,
|
|
94
|
-
onUploadProgress: true,
|
|
95
|
-
fetch: true
|
|
96
|
-
};
|
|
97
|
-
var requestOptionsRegistry = {
|
|
98
|
-
method: true,
|
|
99
|
-
headers: true,
|
|
100
|
-
body: true,
|
|
101
|
-
mode: true,
|
|
102
|
-
credentials: true,
|
|
103
|
-
cache: true,
|
|
104
|
-
redirect: true,
|
|
105
|
-
referrer: true,
|
|
106
|
-
referrerPolicy: true,
|
|
107
|
-
integrity: true,
|
|
108
|
-
keepalive: true,
|
|
109
|
-
signal: true,
|
|
110
|
-
window: true,
|
|
111
|
-
dispatcher: true,
|
|
112
|
-
duplex: true,
|
|
113
|
-
priority: true
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
// node_modules/.pnpm/ky@1.8.2/node_modules/ky/distribution/utils/body.js
|
|
117
|
-
var getBodySize = /* @__PURE__ */ __name((body) => {
|
|
118
|
-
if (!body) {
|
|
119
|
-
return 0;
|
|
120
|
-
}
|
|
121
|
-
if (body instanceof FormData) {
|
|
122
|
-
let size = 0;
|
|
123
|
-
for (const [key, value] of body) {
|
|
124
|
-
size += usualFormBoundarySize;
|
|
125
|
-
size += new TextEncoder().encode(`Content-Disposition: form-data; name="${key}"`).length;
|
|
126
|
-
size += typeof value === "string" ? new TextEncoder().encode(value).length : value.size;
|
|
127
|
-
}
|
|
128
|
-
return size;
|
|
129
|
-
}
|
|
130
|
-
if (body instanceof Blob) {
|
|
131
|
-
return body.size;
|
|
132
|
-
}
|
|
133
|
-
if (body instanceof ArrayBuffer) {
|
|
134
|
-
return body.byteLength;
|
|
135
|
-
}
|
|
136
|
-
if (typeof body === "string") {
|
|
137
|
-
return new TextEncoder().encode(body).length;
|
|
138
|
-
}
|
|
139
|
-
if (body instanceof URLSearchParams) {
|
|
140
|
-
return new TextEncoder().encode(body.toString()).length;
|
|
141
|
-
}
|
|
142
|
-
if ("byteLength" in body) {
|
|
143
|
-
return body.byteLength;
|
|
144
|
-
}
|
|
145
|
-
if (typeof body === "object" && body !== null) {
|
|
146
|
-
try {
|
|
147
|
-
const jsonString = JSON.stringify(body);
|
|
148
|
-
return new TextEncoder().encode(jsonString).length;
|
|
149
|
-
} catch {
|
|
150
|
-
return 0;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return 0;
|
|
154
|
-
}, "getBodySize");
|
|
155
|
-
var streamResponse = /* @__PURE__ */ __name((response, onDownloadProgress) => {
|
|
156
|
-
const totalBytes = Number(response.headers.get("content-length")) || 0;
|
|
157
|
-
let transferredBytes = 0;
|
|
158
|
-
if (response.status === 204) {
|
|
159
|
-
if (onDownloadProgress) {
|
|
160
|
-
onDownloadProgress({ percent: 1, totalBytes, transferredBytes }, new Uint8Array());
|
|
161
|
-
}
|
|
162
|
-
return new Response(null, {
|
|
163
|
-
status: response.status,
|
|
164
|
-
statusText: response.statusText,
|
|
165
|
-
headers: response.headers
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
return new Response(new ReadableStream({
|
|
169
|
-
async start(controller) {
|
|
170
|
-
const reader = response.body.getReader();
|
|
171
|
-
if (onDownloadProgress) {
|
|
172
|
-
onDownloadProgress({ percent: 0, transferredBytes: 0, totalBytes }, new Uint8Array());
|
|
173
|
-
}
|
|
174
|
-
async function read() {
|
|
175
|
-
const { done, value } = await reader.read();
|
|
176
|
-
if (done) {
|
|
177
|
-
controller.close();
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
if (onDownloadProgress) {
|
|
181
|
-
transferredBytes += value.byteLength;
|
|
182
|
-
const percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
|
|
183
|
-
onDownloadProgress({ percent, transferredBytes, totalBytes }, value);
|
|
184
|
-
}
|
|
185
|
-
controller.enqueue(value);
|
|
186
|
-
await read();
|
|
187
|
-
}
|
|
188
|
-
__name(read, "read");
|
|
189
|
-
await read();
|
|
190
|
-
}
|
|
191
|
-
}), {
|
|
192
|
-
status: response.status,
|
|
193
|
-
statusText: response.statusText,
|
|
194
|
-
headers: response.headers
|
|
195
|
-
});
|
|
196
|
-
}, "streamResponse");
|
|
197
|
-
var streamRequest = /* @__PURE__ */ __name((request, onUploadProgress) => {
|
|
198
|
-
const totalBytes = getBodySize(request.body);
|
|
199
|
-
let transferredBytes = 0;
|
|
200
|
-
return new Request(request, {
|
|
201
|
-
// @ts-expect-error - Types are outdated.
|
|
202
|
-
duplex: "half",
|
|
203
|
-
body: new ReadableStream({
|
|
204
|
-
async start(controller) {
|
|
205
|
-
const reader = request.body instanceof ReadableStream ? request.body.getReader() : new Response("").body.getReader();
|
|
206
|
-
async function read() {
|
|
207
|
-
const { done, value } = await reader.read();
|
|
208
|
-
if (done) {
|
|
209
|
-
if (onUploadProgress) {
|
|
210
|
-
onUploadProgress({ percent: 1, transferredBytes, totalBytes: Math.max(totalBytes, transferredBytes) }, new Uint8Array());
|
|
211
|
-
}
|
|
212
|
-
controller.close();
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
transferredBytes += value.byteLength;
|
|
216
|
-
let percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
|
|
217
|
-
if (totalBytes < transferredBytes || percent === 1) {
|
|
218
|
-
percent = 0.99;
|
|
219
|
-
}
|
|
220
|
-
if (onUploadProgress) {
|
|
221
|
-
onUploadProgress({ percent: Number(percent.toFixed(2)), transferredBytes, totalBytes }, value);
|
|
222
|
-
}
|
|
223
|
-
controller.enqueue(value);
|
|
224
|
-
await read();
|
|
225
|
-
}
|
|
226
|
-
__name(read, "read");
|
|
227
|
-
await read();
|
|
228
|
-
}
|
|
229
|
-
})
|
|
230
|
-
});
|
|
231
|
-
}, "streamRequest");
|
|
232
|
-
|
|
233
|
-
// node_modules/.pnpm/ky@1.8.2/node_modules/ky/distribution/utils/is.js
|
|
234
|
-
var isObject = /* @__PURE__ */ __name((value) => value !== null && typeof value === "object", "isObject");
|
|
235
|
-
|
|
236
|
-
// node_modules/.pnpm/ky@1.8.2/node_modules/ky/distribution/utils/merge.js
|
|
237
|
-
var validateAndMerge = /* @__PURE__ */ __name((...sources) => {
|
|
238
|
-
for (const source of sources) {
|
|
239
|
-
if ((!isObject(source) || Array.isArray(source)) && source !== void 0) {
|
|
240
|
-
throw new TypeError("The `options` argument must be an object");
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
return deepMerge({}, ...sources);
|
|
244
|
-
}, "validateAndMerge");
|
|
245
|
-
var mergeHeaders = /* @__PURE__ */ __name((source1 = {}, source2 = {}) => {
|
|
246
|
-
const result = new globalThis.Headers(source1);
|
|
247
|
-
const isHeadersInstance = source2 instanceof globalThis.Headers;
|
|
248
|
-
const source = new globalThis.Headers(source2);
|
|
249
|
-
for (const [key, value] of source.entries()) {
|
|
250
|
-
if (isHeadersInstance && value === "undefined" || value === void 0) {
|
|
251
|
-
result.delete(key);
|
|
252
|
-
} else {
|
|
253
|
-
result.set(key, value);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
return result;
|
|
257
|
-
}, "mergeHeaders");
|
|
258
|
-
function newHookValue(original, incoming, property2) {
|
|
259
|
-
return Object.hasOwn(incoming, property2) && incoming[property2] === void 0 ? [] : deepMerge(original[property2] ?? [], incoming[property2] ?? []);
|
|
260
|
-
}
|
|
261
|
-
__name(newHookValue, "newHookValue");
|
|
262
|
-
var mergeHooks = /* @__PURE__ */ __name((original = {}, incoming = {}) => ({
|
|
263
|
-
beforeRequest: newHookValue(original, incoming, "beforeRequest"),
|
|
264
|
-
beforeRetry: newHookValue(original, incoming, "beforeRetry"),
|
|
265
|
-
afterResponse: newHookValue(original, incoming, "afterResponse"),
|
|
266
|
-
beforeError: newHookValue(original, incoming, "beforeError")
|
|
267
|
-
}), "mergeHooks");
|
|
268
|
-
var deepMerge = /* @__PURE__ */ __name((...sources) => {
|
|
269
|
-
let returnValue = {};
|
|
270
|
-
let headers = {};
|
|
271
|
-
let hooks = {};
|
|
272
|
-
for (const source of sources) {
|
|
273
|
-
if (Array.isArray(source)) {
|
|
274
|
-
if (!Array.isArray(returnValue)) {
|
|
275
|
-
returnValue = [];
|
|
276
|
-
}
|
|
277
|
-
returnValue = [...returnValue, ...source];
|
|
278
|
-
} else if (isObject(source)) {
|
|
279
|
-
for (let [key, value] of Object.entries(source)) {
|
|
280
|
-
if (isObject(value) && key in returnValue) {
|
|
281
|
-
value = deepMerge(returnValue[key], value);
|
|
282
|
-
}
|
|
283
|
-
returnValue = { ...returnValue, [key]: value };
|
|
284
|
-
}
|
|
285
|
-
if (isObject(source.hooks)) {
|
|
286
|
-
hooks = mergeHooks(hooks, source.hooks);
|
|
287
|
-
returnValue.hooks = hooks;
|
|
288
|
-
}
|
|
289
|
-
if (isObject(source.headers)) {
|
|
290
|
-
headers = mergeHeaders(headers, source.headers);
|
|
291
|
-
returnValue.headers = headers;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
return returnValue;
|
|
296
|
-
}, "deepMerge");
|
|
297
|
-
|
|
298
|
-
// node_modules/.pnpm/ky@1.8.2/node_modules/ky/distribution/utils/normalize.js
|
|
299
|
-
var normalizeRequestMethod = /* @__PURE__ */ __name((input) => requestMethods.includes(input) ? input.toUpperCase() : input, "normalizeRequestMethod");
|
|
300
|
-
var retryMethods = ["get", "put", "head", "delete", "options", "trace"];
|
|
301
|
-
var retryStatusCodes = [408, 413, 429, 500, 502, 503, 504];
|
|
302
|
-
var retryAfterStatusCodes = [413, 429, 503];
|
|
303
|
-
var defaultRetryOptions = {
|
|
304
|
-
limit: 2,
|
|
305
|
-
methods: retryMethods,
|
|
306
|
-
statusCodes: retryStatusCodes,
|
|
307
|
-
afterStatusCodes: retryAfterStatusCodes,
|
|
308
|
-
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
309
|
-
backoffLimit: Number.POSITIVE_INFINITY,
|
|
310
|
-
delay: /* @__PURE__ */ __name((attemptCount) => 0.3 * 2 ** (attemptCount - 1) * 1e3, "delay")
|
|
311
|
-
};
|
|
312
|
-
var normalizeRetryOptions = /* @__PURE__ */ __name((retry = {}) => {
|
|
313
|
-
if (typeof retry === "number") {
|
|
314
|
-
return {
|
|
315
|
-
...defaultRetryOptions,
|
|
316
|
-
limit: retry
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
if (retry.methods && !Array.isArray(retry.methods)) {
|
|
320
|
-
throw new Error("retry.methods must be an array");
|
|
321
|
-
}
|
|
322
|
-
if (retry.statusCodes && !Array.isArray(retry.statusCodes)) {
|
|
323
|
-
throw new Error("retry.statusCodes must be an array");
|
|
324
|
-
}
|
|
325
|
-
return {
|
|
326
|
-
...defaultRetryOptions,
|
|
327
|
-
...retry
|
|
328
|
-
};
|
|
329
|
-
}, "normalizeRetryOptions");
|
|
330
|
-
|
|
331
|
-
// node_modules/.pnpm/ky@1.8.2/node_modules/ky/distribution/utils/timeout.js
|
|
332
|
-
async function timeout(request, init, abortController, options) {
|
|
333
|
-
return new Promise((resolve, reject) => {
|
|
334
|
-
const timeoutId = setTimeout(() => {
|
|
335
|
-
if (abortController) {
|
|
336
|
-
abortController.abort();
|
|
337
|
-
}
|
|
338
|
-
reject(new TimeoutError(request));
|
|
339
|
-
}, options.timeout);
|
|
340
|
-
void options.fetch(request, init).then(resolve).catch(reject).then(() => {
|
|
341
|
-
clearTimeout(timeoutId);
|
|
342
|
-
});
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
__name(timeout, "timeout");
|
|
346
|
-
|
|
347
|
-
// node_modules/.pnpm/ky@1.8.2/node_modules/ky/distribution/utils/delay.js
|
|
348
|
-
async function delay(ms, { signal }) {
|
|
349
|
-
return new Promise((resolve, reject) => {
|
|
350
|
-
if (signal) {
|
|
351
|
-
signal.throwIfAborted();
|
|
352
|
-
signal.addEventListener("abort", abortHandler, { once: true });
|
|
353
|
-
}
|
|
354
|
-
function abortHandler() {
|
|
355
|
-
clearTimeout(timeoutId);
|
|
356
|
-
reject(signal.reason);
|
|
357
|
-
}
|
|
358
|
-
__name(abortHandler, "abortHandler");
|
|
359
|
-
const timeoutId = setTimeout(() => {
|
|
360
|
-
signal?.removeEventListener("abort", abortHandler);
|
|
361
|
-
resolve();
|
|
362
|
-
}, ms);
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
__name(delay, "delay");
|
|
366
|
-
|
|
367
|
-
// node_modules/.pnpm/ky@1.8.2/node_modules/ky/distribution/utils/options.js
|
|
368
|
-
var findUnknownOptions = /* @__PURE__ */ __name((request, options) => {
|
|
369
|
-
const unknownOptions = {};
|
|
370
|
-
for (const key in options) {
|
|
371
|
-
if (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && !(key in request)) {
|
|
372
|
-
unknownOptions[key] = options[key];
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
return unknownOptions;
|
|
376
|
-
}, "findUnknownOptions");
|
|
377
|
-
|
|
378
|
-
// node_modules/.pnpm/ky@1.8.2/node_modules/ky/distribution/core/Ky.js
|
|
379
|
-
var Ky = class _Ky {
|
|
380
|
-
static {
|
|
381
|
-
__name(this, "Ky");
|
|
382
|
-
}
|
|
383
|
-
static create(input, options) {
|
|
384
|
-
const ky2 = new _Ky(input, options);
|
|
385
|
-
const function_ = /* @__PURE__ */ __name(async () => {
|
|
386
|
-
if (typeof ky2._options.timeout === "number" && ky2._options.timeout > maxSafeTimeout) {
|
|
387
|
-
throw new RangeError(`The \`timeout\` option cannot be greater than ${maxSafeTimeout}`);
|
|
388
|
-
}
|
|
389
|
-
await Promise.resolve();
|
|
390
|
-
let response = await ky2._fetch();
|
|
391
|
-
for (const hook of ky2._options.hooks.afterResponse) {
|
|
392
|
-
const modifiedResponse = await hook(ky2.request, ky2._options, ky2._decorateResponse(response.clone()));
|
|
393
|
-
if (modifiedResponse instanceof globalThis.Response) {
|
|
394
|
-
response = modifiedResponse;
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
ky2._decorateResponse(response);
|
|
398
|
-
if (!response.ok && ky2._options.throwHttpErrors) {
|
|
399
|
-
let error = new HTTPError(response, ky2.request, ky2._options);
|
|
400
|
-
for (const hook of ky2._options.hooks.beforeError) {
|
|
401
|
-
error = await hook(error);
|
|
402
|
-
}
|
|
403
|
-
throw error;
|
|
404
|
-
}
|
|
405
|
-
if (ky2._options.onDownloadProgress) {
|
|
406
|
-
if (typeof ky2._options.onDownloadProgress !== "function") {
|
|
407
|
-
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
408
|
-
}
|
|
409
|
-
if (!supportsResponseStreams) {
|
|
410
|
-
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
411
|
-
}
|
|
412
|
-
return streamResponse(response.clone(), ky2._options.onDownloadProgress);
|
|
413
|
-
}
|
|
414
|
-
return response;
|
|
415
|
-
}, "function_");
|
|
416
|
-
const isRetriableMethod = ky2._options.retry.methods.includes(ky2.request.method.toLowerCase());
|
|
417
|
-
const result = (isRetriableMethod ? ky2._retry(function_) : function_()).finally(async () => {
|
|
418
|
-
if (!ky2.request.bodyUsed) {
|
|
419
|
-
await ky2.request.body?.cancel();
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
for (const [type, mimeType] of Object.entries(responseTypes)) {
|
|
423
|
-
result[type] = async () => {
|
|
424
|
-
ky2.request.headers.set("accept", ky2.request.headers.get("accept") || mimeType);
|
|
425
|
-
const response = await result;
|
|
426
|
-
if (type === "json") {
|
|
427
|
-
if (response.status === 204) {
|
|
428
|
-
return "";
|
|
429
|
-
}
|
|
430
|
-
const arrayBuffer = await response.clone().arrayBuffer();
|
|
431
|
-
const responseSize = arrayBuffer.byteLength;
|
|
432
|
-
if (responseSize === 0) {
|
|
433
|
-
return "";
|
|
434
|
-
}
|
|
435
|
-
if (options.parseJson) {
|
|
436
|
-
return options.parseJson(await response.text());
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
return response[type]();
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
return result;
|
|
443
|
-
}
|
|
444
|
-
request;
|
|
445
|
-
abortController;
|
|
446
|
-
_retryCount = 0;
|
|
447
|
-
_input;
|
|
448
|
-
_options;
|
|
449
|
-
// eslint-disable-next-line complexity
|
|
450
|
-
constructor(input, options = {}) {
|
|
451
|
-
this._input = input;
|
|
452
|
-
this._options = {
|
|
453
|
-
...options,
|
|
454
|
-
headers: mergeHeaders(this._input.headers, options.headers),
|
|
455
|
-
hooks: mergeHooks({
|
|
456
|
-
beforeRequest: [],
|
|
457
|
-
beforeRetry: [],
|
|
458
|
-
beforeError: [],
|
|
459
|
-
afterResponse: []
|
|
460
|
-
}, options.hooks),
|
|
461
|
-
method: normalizeRequestMethod(options.method ?? this._input.method ?? "GET"),
|
|
462
|
-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
463
|
-
prefixUrl: String(options.prefixUrl || ""),
|
|
464
|
-
retry: normalizeRetryOptions(options.retry),
|
|
465
|
-
throwHttpErrors: options.throwHttpErrors !== false,
|
|
466
|
-
timeout: options.timeout ?? 1e4,
|
|
467
|
-
fetch: options.fetch ?? globalThis.fetch.bind(globalThis)
|
|
468
|
-
};
|
|
469
|
-
if (typeof this._input !== "string" && !(this._input instanceof URL || this._input instanceof globalThis.Request)) {
|
|
470
|
-
throw new TypeError("`input` must be a string, URL, or Request");
|
|
471
|
-
}
|
|
472
|
-
if (this._options.prefixUrl && typeof this._input === "string") {
|
|
473
|
-
if (this._input.startsWith("/")) {
|
|
474
|
-
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
475
|
-
}
|
|
476
|
-
if (!this._options.prefixUrl.endsWith("/")) {
|
|
477
|
-
this._options.prefixUrl += "/";
|
|
478
|
-
}
|
|
479
|
-
this._input = this._options.prefixUrl + this._input;
|
|
480
|
-
}
|
|
481
|
-
if (supportsAbortController && supportsAbortSignal) {
|
|
482
|
-
const originalSignal = this._options.signal ?? this._input.signal;
|
|
483
|
-
this.abortController = new globalThis.AbortController();
|
|
484
|
-
this._options.signal = originalSignal ? AbortSignal.any([originalSignal, this.abortController.signal]) : this.abortController.signal;
|
|
485
|
-
}
|
|
486
|
-
if (supportsRequestStreams) {
|
|
487
|
-
this._options.duplex = "half";
|
|
488
|
-
}
|
|
489
|
-
if (this._options.json !== void 0) {
|
|
490
|
-
this._options.body = this._options.stringifyJson?.(this._options.json) ?? JSON.stringify(this._options.json);
|
|
491
|
-
this._options.headers.set("content-type", this._options.headers.get("content-type") ?? "application/json");
|
|
492
|
-
}
|
|
493
|
-
this.request = new globalThis.Request(this._input, this._options);
|
|
494
|
-
if (this._options.searchParams) {
|
|
495
|
-
const textSearchParams = typeof this._options.searchParams === "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString();
|
|
496
|
-
const searchParams = "?" + textSearchParams;
|
|
497
|
-
const url = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, searchParams);
|
|
498
|
-
if ((supportsFormData && this._options.body instanceof globalThis.FormData || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers["content-type"])) {
|
|
499
|
-
this.request.headers.delete("content-type");
|
|
500
|
-
}
|
|
501
|
-
this.request = new globalThis.Request(new globalThis.Request(url, { ...this.request }), this._options);
|
|
502
|
-
}
|
|
503
|
-
if (this._options.onUploadProgress) {
|
|
504
|
-
if (typeof this._options.onUploadProgress !== "function") {
|
|
505
|
-
throw new TypeError("The `onUploadProgress` option must be a function");
|
|
506
|
-
}
|
|
507
|
-
if (!supportsRequestStreams) {
|
|
508
|
-
throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");
|
|
509
|
-
}
|
|
510
|
-
const originalBody = this.request.body;
|
|
511
|
-
if (originalBody) {
|
|
512
|
-
this.request = streamRequest(this.request, this._options.onUploadProgress);
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
_calculateRetryDelay(error) {
|
|
517
|
-
this._retryCount++;
|
|
518
|
-
if (this._retryCount > this._options.retry.limit || error instanceof TimeoutError) {
|
|
519
|
-
throw error;
|
|
520
|
-
}
|
|
521
|
-
if (error instanceof HTTPError) {
|
|
522
|
-
if (!this._options.retry.statusCodes.includes(error.response.status)) {
|
|
523
|
-
throw error;
|
|
524
|
-
}
|
|
525
|
-
const retryAfter = error.response.headers.get("Retry-After") ?? error.response.headers.get("RateLimit-Reset") ?? error.response.headers.get("X-RateLimit-Reset") ?? error.response.headers.get("X-Rate-Limit-Reset");
|
|
526
|
-
if (retryAfter && this._options.retry.afterStatusCodes.includes(error.response.status)) {
|
|
527
|
-
let after = Number(retryAfter) * 1e3;
|
|
528
|
-
if (Number.isNaN(after)) {
|
|
529
|
-
after = Date.parse(retryAfter) - Date.now();
|
|
530
|
-
} else if (after >= Date.parse("2024-01-01")) {
|
|
531
|
-
after -= Date.now();
|
|
532
|
-
}
|
|
533
|
-
const max = this._options.retry.maxRetryAfter ?? after;
|
|
534
|
-
return after < max ? after : max;
|
|
535
|
-
}
|
|
536
|
-
if (error.response.status === 413) {
|
|
537
|
-
throw error;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
const retryDelay = this._options.retry.delay(this._retryCount);
|
|
541
|
-
return Math.min(this._options.retry.backoffLimit, retryDelay);
|
|
542
|
-
}
|
|
543
|
-
_decorateResponse(response) {
|
|
544
|
-
if (this._options.parseJson) {
|
|
545
|
-
response.json = async () => this._options.parseJson(await response.text());
|
|
546
|
-
}
|
|
547
|
-
return response;
|
|
548
|
-
}
|
|
549
|
-
async _retry(function_) {
|
|
550
|
-
try {
|
|
551
|
-
return await function_();
|
|
552
|
-
} catch (error) {
|
|
553
|
-
const ms = Math.min(this._calculateRetryDelay(error), maxSafeTimeout);
|
|
554
|
-
if (this._retryCount < 1) {
|
|
555
|
-
throw error;
|
|
556
|
-
}
|
|
557
|
-
await delay(ms, { signal: this._options.signal });
|
|
558
|
-
for (const hook of this._options.hooks.beforeRetry) {
|
|
559
|
-
const hookResult = await hook({
|
|
560
|
-
request: this.request,
|
|
561
|
-
options: this._options,
|
|
562
|
-
error,
|
|
563
|
-
retryCount: this._retryCount
|
|
564
|
-
});
|
|
565
|
-
if (hookResult === stop) {
|
|
566
|
-
return;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
return this._retry(function_);
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
async _fetch() {
|
|
573
|
-
for (const hook of this._options.hooks.beforeRequest) {
|
|
574
|
-
const result = await hook(this.request, this._options);
|
|
575
|
-
if (result instanceof Request) {
|
|
576
|
-
this.request = result;
|
|
577
|
-
break;
|
|
578
|
-
}
|
|
579
|
-
if (result instanceof Response) {
|
|
580
|
-
return result;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
const nonRequestOptions = findUnknownOptions(this.request, this._options);
|
|
584
|
-
const mainRequest = this.request;
|
|
585
|
-
this.request = mainRequest.clone();
|
|
586
|
-
if (this._options.timeout === false) {
|
|
587
|
-
return this._options.fetch(mainRequest, nonRequestOptions);
|
|
588
|
-
}
|
|
589
|
-
return timeout(mainRequest, nonRequestOptions, this.abortController, this._options);
|
|
590
|
-
}
|
|
591
|
-
};
|
|
592
|
-
|
|
593
|
-
// node_modules/.pnpm/ky@1.8.2/node_modules/ky/distribution/index.js
|
|
594
|
-
var createInstance = /* @__PURE__ */ __name((defaults) => {
|
|
595
|
-
const ky2 = /* @__PURE__ */ __name((input, options) => Ky.create(input, validateAndMerge(defaults, options)), "ky");
|
|
596
|
-
for (const method of requestMethods) {
|
|
597
|
-
ky2[method] = (input, options) => Ky.create(input, validateAndMerge(defaults, options, { method }));
|
|
598
|
-
}
|
|
599
|
-
ky2.create = (newDefaults) => createInstance(validateAndMerge(newDefaults));
|
|
600
|
-
ky2.extend = (newDefaults) => {
|
|
601
|
-
if (typeof newDefaults === "function") {
|
|
602
|
-
newDefaults = newDefaults(defaults ?? {});
|
|
603
|
-
}
|
|
604
|
-
return createInstance(validateAndMerge(defaults, newDefaults));
|
|
605
|
-
};
|
|
606
|
-
ky2.stop = stop;
|
|
607
|
-
return ky2;
|
|
608
|
-
}, "createInstance");
|
|
609
|
-
var ky = createInstance();
|
|
610
|
-
var distribution_default = ky;
|
|
611
|
-
|
|
612
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/predicate/isLength.mjs
|
|
613
|
-
function isLength(value) {
|
|
614
|
-
return Number.isSafeInteger(value) && value >= 0;
|
|
615
|
-
}
|
|
616
|
-
__name(isLength, "isLength");
|
|
617
|
-
|
|
618
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.mjs
|
|
619
|
-
function isArrayLike(value) {
|
|
620
|
-
return value != null && typeof value !== "function" && isLength(value.length);
|
|
621
|
-
}
|
|
622
|
-
__name(isArrayLike, "isArrayLike");
|
|
623
|
-
|
|
624
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/array/compact.mjs
|
|
625
|
-
function compact(arr) {
|
|
626
|
-
const result = [];
|
|
627
|
-
for (let i = 0; i < arr.length; i++) {
|
|
628
|
-
const item = arr[i];
|
|
629
|
-
if (item) {
|
|
630
|
-
result.push(item);
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
return result;
|
|
634
|
-
}
|
|
635
|
-
__name(compact, "compact");
|
|
636
|
-
|
|
637
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/array/compact.mjs
|
|
638
|
-
function compact2(arr) {
|
|
639
|
-
if (!isArrayLike(arr)) {
|
|
640
|
-
return [];
|
|
641
|
-
}
|
|
642
|
-
return compact(Array.from(arr));
|
|
643
|
-
}
|
|
644
|
-
__name(compact2, "compact");
|
|
645
|
-
|
|
646
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/array/flatten.mjs
|
|
647
|
-
function flatten(arr, depth = 1) {
|
|
648
|
-
const result = [];
|
|
649
|
-
const flooredDepth = Math.floor(depth);
|
|
650
|
-
const recursive = /* @__PURE__ */ __name((arr2, currentDepth) => {
|
|
651
|
-
for (let i = 0; i < arr2.length; i++) {
|
|
652
|
-
const item = arr2[i];
|
|
653
|
-
if (Array.isArray(item) && currentDepth < flooredDepth) {
|
|
654
|
-
recursive(item, currentDepth + 1);
|
|
655
|
-
} else {
|
|
656
|
-
result.push(item);
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
}, "recursive");
|
|
660
|
-
recursive(arr, 0);
|
|
661
|
-
return result;
|
|
662
|
-
}
|
|
663
|
-
__name(flatten, "flatten");
|
|
664
|
-
|
|
665
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/function/identity.mjs
|
|
666
|
-
function identity(x) {
|
|
667
|
-
return x;
|
|
668
|
-
}
|
|
669
|
-
__name(identity, "identity");
|
|
670
|
-
|
|
671
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs
|
|
672
|
-
function isUnsafeProperty(key) {
|
|
673
|
-
return key === "__proto__";
|
|
674
|
-
}
|
|
675
|
-
__name(isUnsafeProperty, "isUnsafeProperty");
|
|
676
|
-
|
|
677
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/_internal/isDeepKey.mjs
|
|
678
|
-
function isDeepKey(key) {
|
|
679
|
-
switch (typeof key) {
|
|
680
|
-
case "number":
|
|
681
|
-
case "symbol": {
|
|
682
|
-
return false;
|
|
683
|
-
}
|
|
684
|
-
case "string": {
|
|
685
|
-
return key.includes(".") || key.includes("[") || key.includes("]");
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
__name(isDeepKey, "isDeepKey");
|
|
690
|
-
|
|
691
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/_internal/toKey.mjs
|
|
692
|
-
function toKey(value) {
|
|
693
|
-
if (typeof value === "string" || typeof value === "symbol") {
|
|
694
|
-
return value;
|
|
695
|
-
}
|
|
696
|
-
if (Object.is(value?.valueOf?.(), -0)) {
|
|
697
|
-
return "-0";
|
|
698
|
-
}
|
|
699
|
-
return String(value);
|
|
700
|
-
}
|
|
701
|
-
__name(toKey, "toKey");
|
|
702
|
-
|
|
703
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/util/toPath.mjs
|
|
704
|
-
function toPath(deepKey) {
|
|
705
|
-
const result = [];
|
|
706
|
-
const length = deepKey.length;
|
|
707
|
-
if (length === 0) {
|
|
708
|
-
return result;
|
|
709
|
-
}
|
|
710
|
-
let index = 0;
|
|
711
|
-
let key = "";
|
|
712
|
-
let quoteChar = "";
|
|
713
|
-
let bracket = false;
|
|
714
|
-
if (deepKey.charCodeAt(0) === 46) {
|
|
715
|
-
result.push("");
|
|
716
|
-
index++;
|
|
717
|
-
}
|
|
718
|
-
while (index < length) {
|
|
719
|
-
const char = deepKey[index];
|
|
720
|
-
if (quoteChar) {
|
|
721
|
-
if (char === "\\" && index + 1 < length) {
|
|
722
|
-
index++;
|
|
723
|
-
key += deepKey[index];
|
|
724
|
-
} else if (char === quoteChar) {
|
|
725
|
-
quoteChar = "";
|
|
726
|
-
} else {
|
|
727
|
-
key += char;
|
|
728
|
-
}
|
|
729
|
-
} else if (bracket) {
|
|
730
|
-
if (char === '"' || char === "'") {
|
|
731
|
-
quoteChar = char;
|
|
732
|
-
} else if (char === "]") {
|
|
733
|
-
bracket = false;
|
|
734
|
-
result.push(key);
|
|
735
|
-
key = "";
|
|
736
|
-
} else {
|
|
737
|
-
key += char;
|
|
738
|
-
}
|
|
739
|
-
} else {
|
|
740
|
-
if (char === "[") {
|
|
741
|
-
bracket = true;
|
|
742
|
-
if (key) {
|
|
743
|
-
result.push(key);
|
|
744
|
-
key = "";
|
|
745
|
-
}
|
|
746
|
-
} else if (char === ".") {
|
|
747
|
-
if (key) {
|
|
748
|
-
result.push(key);
|
|
749
|
-
key = "";
|
|
750
|
-
}
|
|
751
|
-
} else {
|
|
752
|
-
key += char;
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
index++;
|
|
756
|
-
}
|
|
757
|
-
if (key) {
|
|
758
|
-
result.push(key);
|
|
759
|
-
}
|
|
760
|
-
return result;
|
|
761
|
-
}
|
|
762
|
-
__name(toPath, "toPath");
|
|
763
|
-
|
|
764
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/object/get.mjs
|
|
765
|
-
function get(object, path, defaultValue) {
|
|
766
|
-
if (object == null) {
|
|
767
|
-
return defaultValue;
|
|
768
|
-
}
|
|
769
|
-
switch (typeof path) {
|
|
770
|
-
case "string": {
|
|
771
|
-
if (isUnsafeProperty(path)) {
|
|
772
|
-
return defaultValue;
|
|
773
|
-
}
|
|
774
|
-
const result = object[path];
|
|
775
|
-
if (result === void 0) {
|
|
776
|
-
if (isDeepKey(path)) {
|
|
777
|
-
return get(object, toPath(path), defaultValue);
|
|
778
|
-
} else {
|
|
779
|
-
return defaultValue;
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
return result;
|
|
783
|
-
}
|
|
784
|
-
case "number":
|
|
785
|
-
case "symbol": {
|
|
786
|
-
if (typeof path === "number") {
|
|
787
|
-
path = toKey(path);
|
|
788
|
-
}
|
|
789
|
-
const result = object[path];
|
|
790
|
-
if (result === void 0) {
|
|
791
|
-
return defaultValue;
|
|
792
|
-
}
|
|
793
|
-
return result;
|
|
794
|
-
}
|
|
795
|
-
default: {
|
|
796
|
-
if (Array.isArray(path)) {
|
|
797
|
-
return getWithPath(object, path, defaultValue);
|
|
798
|
-
}
|
|
799
|
-
if (Object.is(path?.valueOf(), -0)) {
|
|
800
|
-
path = "-0";
|
|
801
|
-
} else {
|
|
802
|
-
path = String(path);
|
|
803
|
-
}
|
|
804
|
-
if (isUnsafeProperty(path)) {
|
|
805
|
-
return defaultValue;
|
|
806
|
-
}
|
|
807
|
-
const result = object[path];
|
|
808
|
-
if (result === void 0) {
|
|
809
|
-
return defaultValue;
|
|
810
|
-
}
|
|
811
|
-
return result;
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
__name(get, "get");
|
|
816
|
-
function getWithPath(object, path, defaultValue) {
|
|
817
|
-
if (path.length === 0) {
|
|
818
|
-
return defaultValue;
|
|
819
|
-
}
|
|
820
|
-
let current = object;
|
|
821
|
-
for (let index = 0; index < path.length; index++) {
|
|
822
|
-
if (current == null) {
|
|
823
|
-
return defaultValue;
|
|
824
|
-
}
|
|
825
|
-
if (isUnsafeProperty(path[index])) {
|
|
826
|
-
return defaultValue;
|
|
827
|
-
}
|
|
828
|
-
current = current[path[index]];
|
|
829
|
-
}
|
|
830
|
-
if (current === void 0) {
|
|
831
|
-
return defaultValue;
|
|
832
|
-
}
|
|
833
|
-
return current;
|
|
834
|
-
}
|
|
835
|
-
__name(getWithPath, "getWithPath");
|
|
836
|
-
|
|
837
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/object/property.mjs
|
|
838
|
-
function property(path) {
|
|
839
|
-
return function(object) {
|
|
840
|
-
return get(object, path);
|
|
841
|
-
};
|
|
842
|
-
}
|
|
843
|
-
__name(property, "property");
|
|
844
|
-
|
|
845
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/predicate/isObject.mjs
|
|
846
|
-
function isObject2(value) {
|
|
847
|
-
return value !== null && (typeof value === "object" || typeof value === "function");
|
|
848
|
-
}
|
|
849
|
-
__name(isObject2, "isObject");
|
|
850
|
-
|
|
851
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/predicate/isPrimitive.mjs
|
|
852
|
-
function isPrimitive(value) {
|
|
853
|
-
return value == null || typeof value !== "object" && typeof value !== "function";
|
|
854
|
-
}
|
|
855
|
-
__name(isPrimitive, "isPrimitive");
|
|
856
|
-
|
|
857
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/util/eq.mjs
|
|
858
|
-
function eq(value, other) {
|
|
859
|
-
return value === other || Number.isNaN(value) && Number.isNaN(other);
|
|
860
|
-
}
|
|
861
|
-
__name(eq, "eq");
|
|
862
|
-
|
|
863
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/predicate/isMatchWith.mjs
|
|
864
|
-
function isMatchWith(target, source, compare) {
|
|
865
|
-
if (typeof compare !== "function") {
|
|
866
|
-
return isMatch(target, source);
|
|
867
|
-
}
|
|
868
|
-
return isMatchWithInternal(target, source, /* @__PURE__ */ __name(function doesMatch(objValue, srcValue, key, object, source2, stack) {
|
|
869
|
-
const isEqual2 = compare(objValue, srcValue, key, object, source2, stack);
|
|
870
|
-
if (isEqual2 !== void 0) {
|
|
871
|
-
return Boolean(isEqual2);
|
|
872
|
-
}
|
|
873
|
-
return isMatchWithInternal(objValue, srcValue, doesMatch, stack);
|
|
874
|
-
}, "doesMatch"), /* @__PURE__ */ new Map());
|
|
875
|
-
}
|
|
876
|
-
__name(isMatchWith, "isMatchWith");
|
|
877
|
-
function isMatchWithInternal(target, source, compare, stack) {
|
|
878
|
-
if (source === target) {
|
|
879
|
-
return true;
|
|
880
|
-
}
|
|
881
|
-
switch (typeof source) {
|
|
882
|
-
case "object": {
|
|
883
|
-
return isObjectMatch(target, source, compare, stack);
|
|
884
|
-
}
|
|
885
|
-
case "function": {
|
|
886
|
-
const sourceKeys = Object.keys(source);
|
|
887
|
-
if (sourceKeys.length > 0) {
|
|
888
|
-
return isMatchWithInternal(target, { ...source }, compare, stack);
|
|
889
|
-
}
|
|
890
|
-
return eq(target, source);
|
|
891
|
-
}
|
|
892
|
-
default: {
|
|
893
|
-
if (!isObject2(target)) {
|
|
894
|
-
return eq(target, source);
|
|
895
|
-
}
|
|
896
|
-
if (typeof source === "string") {
|
|
897
|
-
return source === "";
|
|
898
|
-
}
|
|
899
|
-
return true;
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
__name(isMatchWithInternal, "isMatchWithInternal");
|
|
904
|
-
function isObjectMatch(target, source, compare, stack) {
|
|
905
|
-
if (source == null) {
|
|
906
|
-
return true;
|
|
907
|
-
}
|
|
908
|
-
if (Array.isArray(source)) {
|
|
909
|
-
return isArrayMatch(target, source, compare, stack);
|
|
910
|
-
}
|
|
911
|
-
if (source instanceof Map) {
|
|
912
|
-
return isMapMatch(target, source, compare, stack);
|
|
913
|
-
}
|
|
914
|
-
if (source instanceof Set) {
|
|
915
|
-
return isSetMatch(target, source, compare, stack);
|
|
916
|
-
}
|
|
917
|
-
const keys2 = Object.keys(source);
|
|
918
|
-
if (target == null) {
|
|
919
|
-
return keys2.length === 0;
|
|
920
|
-
}
|
|
921
|
-
if (keys2.length === 0) {
|
|
922
|
-
return true;
|
|
923
|
-
}
|
|
924
|
-
if (stack && stack.has(source)) {
|
|
925
|
-
return stack.get(source) === target;
|
|
926
|
-
}
|
|
927
|
-
if (stack) {
|
|
928
|
-
stack.set(source, target);
|
|
929
|
-
}
|
|
930
|
-
try {
|
|
931
|
-
for (let i = 0; i < keys2.length; i++) {
|
|
932
|
-
const key = keys2[i];
|
|
933
|
-
if (!isPrimitive(target) && !(key in target)) {
|
|
934
|
-
return false;
|
|
935
|
-
}
|
|
936
|
-
if (source[key] === void 0 && target[key] !== void 0) {
|
|
937
|
-
return false;
|
|
938
|
-
}
|
|
939
|
-
if (source[key] === null && target[key] !== null) {
|
|
940
|
-
return false;
|
|
941
|
-
}
|
|
942
|
-
const isEqual2 = compare(target[key], source[key], key, target, source, stack);
|
|
943
|
-
if (!isEqual2) {
|
|
944
|
-
return false;
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
return true;
|
|
948
|
-
} finally {
|
|
949
|
-
if (stack) {
|
|
950
|
-
stack.delete(source);
|
|
951
|
-
}
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
__name(isObjectMatch, "isObjectMatch");
|
|
955
|
-
function isMapMatch(target, source, compare, stack) {
|
|
956
|
-
if (source.size === 0) {
|
|
957
|
-
return true;
|
|
958
|
-
}
|
|
959
|
-
if (!(target instanceof Map)) {
|
|
960
|
-
return false;
|
|
961
|
-
}
|
|
962
|
-
for (const [key, sourceValue] of source.entries()) {
|
|
963
|
-
const targetValue = target.get(key);
|
|
964
|
-
const isEqual2 = compare(targetValue, sourceValue, key, target, source, stack);
|
|
965
|
-
if (isEqual2 === false) {
|
|
966
|
-
return false;
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
return true;
|
|
970
|
-
}
|
|
971
|
-
__name(isMapMatch, "isMapMatch");
|
|
972
|
-
function isArrayMatch(target, source, compare, stack) {
|
|
973
|
-
if (source.length === 0) {
|
|
974
|
-
return true;
|
|
975
|
-
}
|
|
976
|
-
if (!Array.isArray(target)) {
|
|
977
|
-
return false;
|
|
978
|
-
}
|
|
979
|
-
const countedIndex = /* @__PURE__ */ new Set();
|
|
980
|
-
for (let i = 0; i < source.length; i++) {
|
|
981
|
-
const sourceItem = source[i];
|
|
982
|
-
let found = false;
|
|
983
|
-
for (let j = 0; j < target.length; j++) {
|
|
984
|
-
if (countedIndex.has(j)) {
|
|
985
|
-
continue;
|
|
986
|
-
}
|
|
987
|
-
const targetItem = target[j];
|
|
988
|
-
let matches2 = false;
|
|
989
|
-
const isEqual2 = compare(targetItem, sourceItem, i, target, source, stack);
|
|
990
|
-
if (isEqual2) {
|
|
991
|
-
matches2 = true;
|
|
992
|
-
}
|
|
993
|
-
if (matches2) {
|
|
994
|
-
countedIndex.add(j);
|
|
995
|
-
found = true;
|
|
996
|
-
break;
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
if (!found) {
|
|
1000
|
-
return false;
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
return true;
|
|
1004
|
-
}
|
|
1005
|
-
__name(isArrayMatch, "isArrayMatch");
|
|
1006
|
-
function isSetMatch(target, source, compare, stack) {
|
|
1007
|
-
if (source.size === 0) {
|
|
1008
|
-
return true;
|
|
1009
|
-
}
|
|
1010
|
-
if (!(target instanceof Set)) {
|
|
1011
|
-
return false;
|
|
1012
|
-
}
|
|
1013
|
-
return isArrayMatch([...target], [...source], compare, stack);
|
|
1014
|
-
}
|
|
1015
|
-
__name(isSetMatch, "isSetMatch");
|
|
1016
|
-
|
|
1017
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/predicate/isMatch.mjs
|
|
1018
|
-
function isMatch(target, source) {
|
|
1019
|
-
return isMatchWith(target, source, () => void 0);
|
|
1020
|
-
}
|
|
1021
|
-
__name(isMatch, "isMatch");
|
|
1022
|
-
|
|
1023
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs
|
|
1024
|
-
function getSymbols(object) {
|
|
1025
|
-
return Object.getOwnPropertySymbols(object).filter((symbol) => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
|
1026
|
-
}
|
|
1027
|
-
__name(getSymbols, "getSymbols");
|
|
1028
|
-
|
|
1029
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs
|
|
1030
|
-
function getTag(value) {
|
|
1031
|
-
if (value == null) {
|
|
1032
|
-
return value === void 0 ? "[object Undefined]" : "[object Null]";
|
|
1033
|
-
}
|
|
1034
|
-
return Object.prototype.toString.call(value);
|
|
1035
|
-
}
|
|
1036
|
-
__name(getTag, "getTag");
|
|
1037
|
-
|
|
1038
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/_internal/tags.mjs
|
|
1039
|
-
var regexpTag = "[object RegExp]";
|
|
1040
|
-
var stringTag = "[object String]";
|
|
1041
|
-
var numberTag = "[object Number]";
|
|
1042
|
-
var booleanTag = "[object Boolean]";
|
|
1043
|
-
var argumentsTag = "[object Arguments]";
|
|
1044
|
-
var symbolTag = "[object Symbol]";
|
|
1045
|
-
var dateTag = "[object Date]";
|
|
1046
|
-
var mapTag = "[object Map]";
|
|
1047
|
-
var setTag = "[object Set]";
|
|
1048
|
-
var arrayTag = "[object Array]";
|
|
1049
|
-
var functionTag = "[object Function]";
|
|
1050
|
-
var arrayBufferTag = "[object ArrayBuffer]";
|
|
1051
|
-
var objectTag = "[object Object]";
|
|
1052
|
-
var errorTag = "[object Error]";
|
|
1053
|
-
var dataViewTag = "[object DataView]";
|
|
1054
|
-
var uint8ArrayTag = "[object Uint8Array]";
|
|
1055
|
-
var uint8ClampedArrayTag = "[object Uint8ClampedArray]";
|
|
1056
|
-
var uint16ArrayTag = "[object Uint16Array]";
|
|
1057
|
-
var uint32ArrayTag = "[object Uint32Array]";
|
|
1058
|
-
var bigUint64ArrayTag = "[object BigUint64Array]";
|
|
1059
|
-
var int8ArrayTag = "[object Int8Array]";
|
|
1060
|
-
var int16ArrayTag = "[object Int16Array]";
|
|
1061
|
-
var int32ArrayTag = "[object Int32Array]";
|
|
1062
|
-
var bigInt64ArrayTag = "[object BigInt64Array]";
|
|
1063
|
-
var float32ArrayTag = "[object Float32Array]";
|
|
1064
|
-
var float64ArrayTag = "[object Float64Array]";
|
|
1065
|
-
|
|
1066
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/predicate/isTypedArray.mjs
|
|
1067
|
-
function isTypedArray(x) {
|
|
1068
|
-
return ArrayBuffer.isView(x) && !(x instanceof DataView);
|
|
1069
|
-
}
|
|
1070
|
-
__name(isTypedArray, "isTypedArray");
|
|
1071
|
-
|
|
1072
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/object/cloneDeepWith.mjs
|
|
1073
|
-
function cloneDeepWith(obj, cloneValue) {
|
|
1074
|
-
return cloneDeepWithImpl(obj, void 0, obj, /* @__PURE__ */ new Map(), cloneValue);
|
|
1075
|
-
}
|
|
1076
|
-
__name(cloneDeepWith, "cloneDeepWith");
|
|
1077
|
-
function cloneDeepWithImpl(valueToClone, keyToClone, objectToClone, stack = /* @__PURE__ */ new Map(), cloneValue = void 0) {
|
|
1078
|
-
const cloned = cloneValue?.(valueToClone, keyToClone, objectToClone, stack);
|
|
1079
|
-
if (cloned != null) {
|
|
1080
|
-
return cloned;
|
|
1081
|
-
}
|
|
1082
|
-
if (isPrimitive(valueToClone)) {
|
|
1083
|
-
return valueToClone;
|
|
1084
|
-
}
|
|
1085
|
-
if (stack.has(valueToClone)) {
|
|
1086
|
-
return stack.get(valueToClone);
|
|
1087
|
-
}
|
|
1088
|
-
if (Array.isArray(valueToClone)) {
|
|
1089
|
-
const result = new Array(valueToClone.length);
|
|
1090
|
-
stack.set(valueToClone, result);
|
|
1091
|
-
for (let i = 0; i < valueToClone.length; i++) {
|
|
1092
|
-
result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, cloneValue);
|
|
1093
|
-
}
|
|
1094
|
-
if (Object.hasOwn(valueToClone, "index")) {
|
|
1095
|
-
result.index = valueToClone.index;
|
|
1096
|
-
}
|
|
1097
|
-
if (Object.hasOwn(valueToClone, "input")) {
|
|
1098
|
-
result.input = valueToClone.input;
|
|
1099
|
-
}
|
|
1100
|
-
return result;
|
|
1101
|
-
}
|
|
1102
|
-
if (valueToClone instanceof Date) {
|
|
1103
|
-
return new Date(valueToClone.getTime());
|
|
1104
|
-
}
|
|
1105
|
-
if (valueToClone instanceof RegExp) {
|
|
1106
|
-
const result = new RegExp(valueToClone.source, valueToClone.flags);
|
|
1107
|
-
result.lastIndex = valueToClone.lastIndex;
|
|
1108
|
-
return result;
|
|
1109
|
-
}
|
|
1110
|
-
if (valueToClone instanceof Map) {
|
|
1111
|
-
const result = /* @__PURE__ */ new Map();
|
|
1112
|
-
stack.set(valueToClone, result);
|
|
1113
|
-
for (const [key, value] of valueToClone) {
|
|
1114
|
-
result.set(key, cloneDeepWithImpl(value, key, objectToClone, stack, cloneValue));
|
|
1115
|
-
}
|
|
1116
|
-
return result;
|
|
1117
|
-
}
|
|
1118
|
-
if (valueToClone instanceof Set) {
|
|
1119
|
-
const result = /* @__PURE__ */ new Set();
|
|
1120
|
-
stack.set(valueToClone, result);
|
|
1121
|
-
for (const value of valueToClone) {
|
|
1122
|
-
result.add(cloneDeepWithImpl(value, void 0, objectToClone, stack, cloneValue));
|
|
1123
|
-
}
|
|
1124
|
-
return result;
|
|
1125
|
-
}
|
|
1126
|
-
if (typeof Buffer !== "undefined" && Buffer.isBuffer(valueToClone)) {
|
|
1127
|
-
return valueToClone.subarray();
|
|
1128
|
-
}
|
|
1129
|
-
if (isTypedArray(valueToClone)) {
|
|
1130
|
-
const result = new (Object.getPrototypeOf(valueToClone)).constructor(valueToClone.length);
|
|
1131
|
-
stack.set(valueToClone, result);
|
|
1132
|
-
for (let i = 0; i < valueToClone.length; i++) {
|
|
1133
|
-
result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, cloneValue);
|
|
1134
|
-
}
|
|
1135
|
-
return result;
|
|
1136
|
-
}
|
|
1137
|
-
if (valueToClone instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && valueToClone instanceof SharedArrayBuffer) {
|
|
1138
|
-
return valueToClone.slice(0);
|
|
1139
|
-
}
|
|
1140
|
-
if (valueToClone instanceof DataView) {
|
|
1141
|
-
const result = new DataView(valueToClone.buffer.slice(0), valueToClone.byteOffset, valueToClone.byteLength);
|
|
1142
|
-
stack.set(valueToClone, result);
|
|
1143
|
-
copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
|
|
1144
|
-
return result;
|
|
1145
|
-
}
|
|
1146
|
-
if (typeof File !== "undefined" && valueToClone instanceof File) {
|
|
1147
|
-
const result = new File([valueToClone], valueToClone.name, {
|
|
1148
|
-
type: valueToClone.type
|
|
1149
|
-
});
|
|
1150
|
-
stack.set(valueToClone, result);
|
|
1151
|
-
copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
|
|
1152
|
-
return result;
|
|
1153
|
-
}
|
|
1154
|
-
if (valueToClone instanceof Blob) {
|
|
1155
|
-
const result = new Blob([valueToClone], { type: valueToClone.type });
|
|
1156
|
-
stack.set(valueToClone, result);
|
|
1157
|
-
copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
|
|
1158
|
-
return result;
|
|
1159
|
-
}
|
|
1160
|
-
if (valueToClone instanceof Error) {
|
|
1161
|
-
const result = new valueToClone.constructor();
|
|
1162
|
-
stack.set(valueToClone, result);
|
|
1163
|
-
result.message = valueToClone.message;
|
|
1164
|
-
result.name = valueToClone.name;
|
|
1165
|
-
result.stack = valueToClone.stack;
|
|
1166
|
-
result.cause = valueToClone.cause;
|
|
1167
|
-
copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
|
|
1168
|
-
return result;
|
|
1169
|
-
}
|
|
1170
|
-
if (typeof valueToClone === "object" && isCloneableObject(valueToClone)) {
|
|
1171
|
-
const result = Object.create(Object.getPrototypeOf(valueToClone));
|
|
1172
|
-
stack.set(valueToClone, result);
|
|
1173
|
-
copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
|
|
1174
|
-
return result;
|
|
1175
|
-
}
|
|
1176
|
-
return valueToClone;
|
|
1177
|
-
}
|
|
1178
|
-
__name(cloneDeepWithImpl, "cloneDeepWithImpl");
|
|
1179
|
-
function copyProperties(target, source, objectToClone = target, stack, cloneValue) {
|
|
1180
|
-
const keys2 = [...Object.keys(source), ...getSymbols(source)];
|
|
1181
|
-
for (let i = 0; i < keys2.length; i++) {
|
|
1182
|
-
const key = keys2[i];
|
|
1183
|
-
const descriptor = Object.getOwnPropertyDescriptor(target, key);
|
|
1184
|
-
if (descriptor == null || descriptor.writable) {
|
|
1185
|
-
target[key] = cloneDeepWithImpl(source[key], key, objectToClone, stack, cloneValue);
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
__name(copyProperties, "copyProperties");
|
|
1190
|
-
function isCloneableObject(object) {
|
|
1191
|
-
switch (getTag(object)) {
|
|
1192
|
-
case argumentsTag:
|
|
1193
|
-
case arrayTag:
|
|
1194
|
-
case arrayBufferTag:
|
|
1195
|
-
case dataViewTag:
|
|
1196
|
-
case booleanTag:
|
|
1197
|
-
case dateTag:
|
|
1198
|
-
case float32ArrayTag:
|
|
1199
|
-
case float64ArrayTag:
|
|
1200
|
-
case int8ArrayTag:
|
|
1201
|
-
case int16ArrayTag:
|
|
1202
|
-
case int32ArrayTag:
|
|
1203
|
-
case mapTag:
|
|
1204
|
-
case numberTag:
|
|
1205
|
-
case objectTag:
|
|
1206
|
-
case regexpTag:
|
|
1207
|
-
case setTag:
|
|
1208
|
-
case stringTag:
|
|
1209
|
-
case symbolTag:
|
|
1210
|
-
case uint8ArrayTag:
|
|
1211
|
-
case uint8ClampedArrayTag:
|
|
1212
|
-
case uint16ArrayTag:
|
|
1213
|
-
case uint32ArrayTag: {
|
|
1214
|
-
return true;
|
|
1215
|
-
}
|
|
1216
|
-
default: {
|
|
1217
|
-
return false;
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
__name(isCloneableObject, "isCloneableObject");
|
|
1222
|
-
|
|
1223
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/object/cloneDeep.mjs
|
|
1224
|
-
function cloneDeep(obj) {
|
|
1225
|
-
return cloneDeepWithImpl(obj, void 0, obj, /* @__PURE__ */ new Map(), void 0);
|
|
1226
|
-
}
|
|
1227
|
-
__name(cloneDeep, "cloneDeep");
|
|
1228
|
-
|
|
1229
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/predicate/matches.mjs
|
|
1230
|
-
function matches(source) {
|
|
1231
|
-
source = cloneDeep(source);
|
|
1232
|
-
return (target) => {
|
|
1233
|
-
return isMatch(target, source);
|
|
1234
|
-
};
|
|
1235
|
-
}
|
|
1236
|
-
__name(matches, "matches");
|
|
1237
|
-
|
|
1238
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.mjs
|
|
1239
|
-
function cloneDeepWith2(obj, customizer) {
|
|
1240
|
-
return cloneDeepWith(obj, (value, key, object, stack) => {
|
|
1241
|
-
const cloned = customizer?.(value, key, object, stack);
|
|
1242
|
-
if (cloned != null) {
|
|
1243
|
-
return cloned;
|
|
1244
|
-
}
|
|
1245
|
-
if (typeof obj !== "object") {
|
|
1246
|
-
return void 0;
|
|
1247
|
-
}
|
|
1248
|
-
switch (Object.prototype.toString.call(obj)) {
|
|
1249
|
-
case numberTag:
|
|
1250
|
-
case stringTag:
|
|
1251
|
-
case booleanTag: {
|
|
1252
|
-
const result = new obj.constructor(obj?.valueOf());
|
|
1253
|
-
copyProperties(result, obj);
|
|
1254
|
-
return result;
|
|
1255
|
-
}
|
|
1256
|
-
case argumentsTag: {
|
|
1257
|
-
const result = {};
|
|
1258
|
-
copyProperties(result, obj);
|
|
1259
|
-
result.length = obj.length;
|
|
1260
|
-
result[Symbol.iterator] = obj[Symbol.iterator];
|
|
1261
|
-
return result;
|
|
1262
|
-
}
|
|
1263
|
-
default: {
|
|
1264
|
-
return void 0;
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
});
|
|
1268
|
-
}
|
|
1269
|
-
__name(cloneDeepWith2, "cloneDeepWith");
|
|
1270
|
-
|
|
1271
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/object/cloneDeep.mjs
|
|
1272
|
-
function cloneDeep2(obj) {
|
|
1273
|
-
return cloneDeepWith2(obj);
|
|
1274
|
-
}
|
|
1275
|
-
__name(cloneDeep2, "cloneDeep");
|
|
1276
|
-
|
|
1277
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/_internal/isIndex.mjs
|
|
1278
|
-
var IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/;
|
|
1279
|
-
function isIndex(value, length = Number.MAX_SAFE_INTEGER) {
|
|
1280
|
-
switch (typeof value) {
|
|
1281
|
-
case "number": {
|
|
1282
|
-
return Number.isInteger(value) && value >= 0 && value < length;
|
|
1283
|
-
}
|
|
1284
|
-
case "symbol": {
|
|
1285
|
-
return false;
|
|
1286
|
-
}
|
|
1287
|
-
case "string": {
|
|
1288
|
-
return IS_UNSIGNED_INTEGER.test(value);
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
__name(isIndex, "isIndex");
|
|
1293
|
-
|
|
1294
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/predicate/isArguments.mjs
|
|
1295
|
-
function isArguments(value) {
|
|
1296
|
-
return value !== null && typeof value === "object" && getTag(value) === "[object Arguments]";
|
|
1297
|
-
}
|
|
1298
|
-
__name(isArguments, "isArguments");
|
|
1299
|
-
|
|
1300
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/object/has.mjs
|
|
1301
|
-
function has(object, path) {
|
|
1302
|
-
let resolvedPath;
|
|
1303
|
-
if (Array.isArray(path)) {
|
|
1304
|
-
resolvedPath = path;
|
|
1305
|
-
} else if (typeof path === "string" && isDeepKey(path) && object?.[path] == null) {
|
|
1306
|
-
resolvedPath = toPath(path);
|
|
1307
|
-
} else {
|
|
1308
|
-
resolvedPath = [path];
|
|
1309
|
-
}
|
|
1310
|
-
if (resolvedPath.length === 0) {
|
|
1311
|
-
return false;
|
|
1312
|
-
}
|
|
1313
|
-
let current = object;
|
|
1314
|
-
for (let i = 0; i < resolvedPath.length; i++) {
|
|
1315
|
-
const key = resolvedPath[i];
|
|
1316
|
-
if (current == null || !Object.hasOwn(current, key)) {
|
|
1317
|
-
const isSparseIndex = (Array.isArray(current) || isArguments(current)) && isIndex(key) && key < current.length;
|
|
1318
|
-
if (!isSparseIndex) {
|
|
1319
|
-
return false;
|
|
1320
|
-
}
|
|
1321
|
-
}
|
|
1322
|
-
current = current[key];
|
|
1323
|
-
}
|
|
1324
|
-
return true;
|
|
1325
|
-
}
|
|
1326
|
-
__name(has, "has");
|
|
1327
|
-
|
|
1328
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/predicate/matchesProperty.mjs
|
|
1329
|
-
function matchesProperty(property2, source) {
|
|
1330
|
-
switch (typeof property2) {
|
|
1331
|
-
case "object": {
|
|
1332
|
-
if (Object.is(property2?.valueOf(), -0)) {
|
|
1333
|
-
property2 = "-0";
|
|
1334
|
-
}
|
|
1335
|
-
break;
|
|
1336
|
-
}
|
|
1337
|
-
case "number": {
|
|
1338
|
-
property2 = toKey(property2);
|
|
1339
|
-
break;
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
source = cloneDeep2(source);
|
|
1343
|
-
return function(target) {
|
|
1344
|
-
const result = get(target, property2);
|
|
1345
|
-
if (result === void 0) {
|
|
1346
|
-
return has(target, property2);
|
|
1347
|
-
}
|
|
1348
|
-
if (source === void 0) {
|
|
1349
|
-
return result === void 0;
|
|
1350
|
-
}
|
|
1351
|
-
return isMatch(result, source);
|
|
1352
|
-
};
|
|
1353
|
-
}
|
|
1354
|
-
__name(matchesProperty, "matchesProperty");
|
|
1355
|
-
|
|
1356
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/util/iteratee.mjs
|
|
1357
|
-
function iteratee(value) {
|
|
1358
|
-
if (value == null) {
|
|
1359
|
-
return identity;
|
|
1360
|
-
}
|
|
1361
|
-
switch (typeof value) {
|
|
1362
|
-
case "function": {
|
|
1363
|
-
return value;
|
|
1364
|
-
}
|
|
1365
|
-
case "object": {
|
|
1366
|
-
if (Array.isArray(value) && value.length === 2) {
|
|
1367
|
-
return matchesProperty(value[0], value[1]);
|
|
1368
|
-
}
|
|
1369
|
-
return matches(value);
|
|
1370
|
-
}
|
|
1371
|
-
case "string":
|
|
1372
|
-
case "symbol":
|
|
1373
|
-
case "number": {
|
|
1374
|
-
return property(value);
|
|
1375
|
-
}
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
|
-
__name(iteratee, "iteratee");
|
|
1379
|
-
|
|
1380
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.mjs
|
|
1381
|
-
function isObjectLike(value) {
|
|
1382
|
-
return typeof value === "object" && value !== null;
|
|
1383
|
-
}
|
|
1384
|
-
__name(isObjectLike, "isObjectLike");
|
|
1385
|
-
|
|
1386
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/predicate/isSymbol.mjs
|
|
1387
|
-
function isSymbol(value) {
|
|
1388
|
-
return typeof value === "symbol" || value instanceof Symbol;
|
|
1389
|
-
}
|
|
1390
|
-
__name(isSymbol, "isSymbol");
|
|
1391
|
-
|
|
1392
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/util/toNumber.mjs
|
|
1393
|
-
function toNumber(value) {
|
|
1394
|
-
if (isSymbol(value)) {
|
|
1395
|
-
return NaN;
|
|
1396
|
-
}
|
|
1397
|
-
return Number(value);
|
|
1398
|
-
}
|
|
1399
|
-
__name(toNumber, "toNumber");
|
|
1400
|
-
|
|
1401
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/util/toFinite.mjs
|
|
1402
|
-
function toFinite(value) {
|
|
1403
|
-
if (!value) {
|
|
1404
|
-
return value === 0 ? value : 0;
|
|
1405
|
-
}
|
|
1406
|
-
value = toNumber(value);
|
|
1407
|
-
if (value === Infinity || value === -Infinity) {
|
|
1408
|
-
const sign = value < 0 ? -1 : 1;
|
|
1409
|
-
return sign * Number.MAX_VALUE;
|
|
1410
|
-
}
|
|
1411
|
-
return value === value ? value : 0;
|
|
1412
|
-
}
|
|
1413
|
-
__name(toFinite, "toFinite");
|
|
1414
|
-
|
|
1415
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/util/toInteger.mjs
|
|
1416
|
-
function toInteger(value) {
|
|
1417
|
-
const finite = toFinite(value);
|
|
1418
|
-
const remainder = finite % 1;
|
|
1419
|
-
return remainder ? finite - remainder : finite;
|
|
1420
|
-
}
|
|
1421
|
-
__name(toInteger, "toInteger");
|
|
1422
|
-
|
|
1423
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/math/range.mjs
|
|
1424
|
-
function range(start, end, step = 1) {
|
|
1425
|
-
if (end == null) {
|
|
1426
|
-
end = start;
|
|
1427
|
-
start = 0;
|
|
1428
|
-
}
|
|
1429
|
-
if (!Number.isInteger(step) || step === 0) {
|
|
1430
|
-
throw new Error(`The step value must be a non-zero integer.`);
|
|
1431
|
-
}
|
|
1432
|
-
const length = Math.max(Math.ceil((end - start) / step), 0);
|
|
1433
|
-
const result = new Array(length);
|
|
1434
|
-
for (let i = 0; i < length; i++) {
|
|
1435
|
-
result[i] = start + i * step;
|
|
1436
|
-
}
|
|
1437
|
-
return result;
|
|
1438
|
-
}
|
|
1439
|
-
__name(range, "range");
|
|
1440
|
-
|
|
1441
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/array/forEach.mjs
|
|
1442
|
-
function forEach(collection, callback = identity) {
|
|
1443
|
-
if (!collection) {
|
|
1444
|
-
return collection;
|
|
1445
|
-
}
|
|
1446
|
-
const keys2 = isArrayLike(collection) || Array.isArray(collection) ? range(0, collection.length) : Object.keys(collection);
|
|
1447
|
-
for (let i = 0; i < keys2.length; i++) {
|
|
1448
|
-
const key = keys2[i];
|
|
1449
|
-
const value = collection[key];
|
|
1450
|
-
const result = callback(value, key, collection);
|
|
1451
|
-
if (result === false) {
|
|
1452
|
-
break;
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
return collection;
|
|
1456
|
-
}
|
|
1457
|
-
__name(forEach, "forEach");
|
|
1458
|
-
|
|
1459
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/_internal/isIterateeCall.mjs
|
|
1460
|
-
function isIterateeCall(value, index, object) {
|
|
1461
|
-
if (!isObject2(object)) {
|
|
1462
|
-
return false;
|
|
1463
|
-
}
|
|
1464
|
-
if (typeof index === "number" && isArrayLike(object) && isIndex(index) && index < object.length || typeof index === "string" && index in object) {
|
|
1465
|
-
return eq(object[index], value);
|
|
1466
|
-
}
|
|
1467
|
-
return false;
|
|
1468
|
-
}
|
|
1469
|
-
__name(isIterateeCall, "isIterateeCall");
|
|
1470
|
-
|
|
1471
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/predicate/isString.mjs
|
|
1472
|
-
function isString(value) {
|
|
1473
|
-
return typeof value === "string" || value instanceof String;
|
|
1474
|
-
}
|
|
1475
|
-
__name(isString, "isString");
|
|
1476
|
-
|
|
1477
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/array/filter.mjs
|
|
1478
|
-
function filter(source, predicate = identity) {
|
|
1479
|
-
if (!source) {
|
|
1480
|
-
return [];
|
|
1481
|
-
}
|
|
1482
|
-
predicate = iteratee(predicate);
|
|
1483
|
-
if (!Array.isArray(source)) {
|
|
1484
|
-
const result2 = [];
|
|
1485
|
-
const keys2 = Object.keys(source);
|
|
1486
|
-
const length2 = isArrayLike(source) ? source.length : keys2.length;
|
|
1487
|
-
for (let i = 0; i < length2; i++) {
|
|
1488
|
-
const key = keys2[i];
|
|
1489
|
-
const value = source[key];
|
|
1490
|
-
if (predicate(value, key, source)) {
|
|
1491
|
-
result2.push(value);
|
|
1492
|
-
}
|
|
1493
|
-
}
|
|
1494
|
-
return result2;
|
|
1495
|
-
}
|
|
1496
|
-
const result = [];
|
|
1497
|
-
const length = source.length;
|
|
1498
|
-
for (let i = 0; i < length; i++) {
|
|
1499
|
-
const value = source[i];
|
|
1500
|
-
if (predicate(value, i, source)) {
|
|
1501
|
-
result.push(value);
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
|
-
return result;
|
|
1505
|
-
}
|
|
1506
|
-
__name(filter, "filter");
|
|
1507
|
-
|
|
1508
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/array/find.mjs
|
|
1509
|
-
function find(source, _doesMatch = identity, fromIndex = 0) {
|
|
1510
|
-
if (!source) {
|
|
1511
|
-
return void 0;
|
|
1512
|
-
}
|
|
1513
|
-
if (fromIndex < 0) {
|
|
1514
|
-
fromIndex = Math.max(source.length + fromIndex, 0);
|
|
1515
|
-
}
|
|
1516
|
-
const doesMatch = iteratee(_doesMatch);
|
|
1517
|
-
if (typeof doesMatch === "function" && !Array.isArray(source)) {
|
|
1518
|
-
const keys2 = Object.keys(source);
|
|
1519
|
-
for (let i = fromIndex; i < keys2.length; i++) {
|
|
1520
|
-
const key = keys2[i];
|
|
1521
|
-
const value = source[key];
|
|
1522
|
-
if (doesMatch(value, key, source)) {
|
|
1523
|
-
return value;
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
return void 0;
|
|
1527
|
-
}
|
|
1528
|
-
const values2 = Array.isArray(source) ? source.slice(fromIndex) : Object.values(source).slice(fromIndex);
|
|
1529
|
-
return values2.find(doesMatch);
|
|
1530
|
-
}
|
|
1531
|
-
__name(find, "find");
|
|
1532
|
-
|
|
1533
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/array/flatten.mjs
|
|
1534
|
-
function flatten2(value, depth = 1) {
|
|
1535
|
-
const result = [];
|
|
1536
|
-
const flooredDepth = Math.floor(depth);
|
|
1537
|
-
if (!isArrayLike(value)) {
|
|
1538
|
-
return result;
|
|
1539
|
-
}
|
|
1540
|
-
const recursive = /* @__PURE__ */ __name((arr, currentDepth) => {
|
|
1541
|
-
for (let i = 0; i < arr.length; i++) {
|
|
1542
|
-
const item = arr[i];
|
|
1543
|
-
if (currentDepth < flooredDepth && (Array.isArray(item) || Boolean(item?.[Symbol.isConcatSpreadable]) || item !== null && typeof item === "object" && Object.prototype.toString.call(item) === "[object Arguments]")) {
|
|
1544
|
-
if (Array.isArray(item)) {
|
|
1545
|
-
recursive(item, currentDepth + 1);
|
|
1546
|
-
} else {
|
|
1547
|
-
recursive(Array.from(item), currentDepth + 1);
|
|
1548
|
-
}
|
|
1549
|
-
} else {
|
|
1550
|
-
result.push(item);
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
}, "recursive");
|
|
1554
|
-
recursive(Array.from(value), 0);
|
|
1555
|
-
return result;
|
|
1556
|
-
}
|
|
1557
|
-
__name(flatten2, "flatten");
|
|
1558
|
-
|
|
1559
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/array/map.mjs
|
|
1560
|
-
function map(collection, _iteratee) {
|
|
1561
|
-
if (!collection) {
|
|
1562
|
-
return [];
|
|
1563
|
-
}
|
|
1564
|
-
const keys2 = isArrayLike(collection) || Array.isArray(collection) ? range(0, collection.length) : Object.keys(collection);
|
|
1565
|
-
const iteratee$1 = iteratee(_iteratee ?? identity);
|
|
1566
|
-
const result = new Array(keys2.length);
|
|
1567
|
-
for (let i = 0; i < keys2.length; i++) {
|
|
1568
|
-
const key = keys2[i];
|
|
1569
|
-
const value = collection[key];
|
|
1570
|
-
result[i] = iteratee$1(value, key, collection);
|
|
1571
|
-
}
|
|
1572
|
-
return result;
|
|
1573
|
-
}
|
|
1574
|
-
__name(map, "map");
|
|
1575
|
-
|
|
1576
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/array/groupBy.mjs
|
|
1577
|
-
function groupBy(arr, getKeyFromItem) {
|
|
1578
|
-
const result = {};
|
|
1579
|
-
for (let i = 0; i < arr.length; i++) {
|
|
1580
|
-
const item = arr[i];
|
|
1581
|
-
const key = getKeyFromItem(item);
|
|
1582
|
-
if (!Object.hasOwn(result, key)) {
|
|
1583
|
-
result[key] = [];
|
|
1584
|
-
}
|
|
1585
|
-
result[key].push(item);
|
|
1586
|
-
}
|
|
1587
|
-
return result;
|
|
1588
|
-
}
|
|
1589
|
-
__name(groupBy, "groupBy");
|
|
1590
|
-
|
|
1591
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/array/groupBy.mjs
|
|
1592
|
-
function groupBy2(source, _getKeyFromItem) {
|
|
1593
|
-
if (source == null) {
|
|
1594
|
-
return {};
|
|
1595
|
-
}
|
|
1596
|
-
const items = isArrayLike(source) ? Array.from(source) : Object.values(source);
|
|
1597
|
-
const getKeyFromItem = iteratee(_getKeyFromItem ?? identity);
|
|
1598
|
-
return groupBy(items, getKeyFromItem);
|
|
1599
|
-
}
|
|
1600
|
-
__name(groupBy2, "groupBy");
|
|
1601
|
-
|
|
1602
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/array/reduce.mjs
|
|
1603
|
-
function reduce(collection, iteratee2 = identity, accumulator) {
|
|
1604
|
-
if (!collection) {
|
|
1605
|
-
return accumulator;
|
|
1606
|
-
}
|
|
1607
|
-
let keys2;
|
|
1608
|
-
let startIndex = 0;
|
|
1609
|
-
if (isArrayLike(collection)) {
|
|
1610
|
-
keys2 = range(0, collection.length);
|
|
1611
|
-
if (accumulator == null && collection.length > 0) {
|
|
1612
|
-
accumulator = collection[0];
|
|
1613
|
-
startIndex += 1;
|
|
1614
|
-
}
|
|
1615
|
-
} else {
|
|
1616
|
-
keys2 = Object.keys(collection);
|
|
1617
|
-
if (accumulator == null) {
|
|
1618
|
-
accumulator = collection[keys2[0]];
|
|
1619
|
-
startIndex += 1;
|
|
1620
|
-
}
|
|
1621
|
-
}
|
|
1622
|
-
for (let i = startIndex; i < keys2.length; i++) {
|
|
1623
|
-
const key = keys2[i];
|
|
1624
|
-
const value = collection[key];
|
|
1625
|
-
accumulator = iteratee2(accumulator, value, key, collection);
|
|
1626
|
-
}
|
|
1627
|
-
return accumulator;
|
|
1628
|
-
}
|
|
1629
|
-
__name(reduce, "reduce");
|
|
1630
|
-
|
|
1631
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/array/keyBy.mjs
|
|
1632
|
-
function keyBy(collection, iteratee$1) {
|
|
1633
|
-
if (!isArrayLike(collection) && !isObjectLike(collection)) {
|
|
1634
|
-
return {};
|
|
1635
|
-
}
|
|
1636
|
-
const keyFn = iteratee(iteratee$1 ?? identity);
|
|
1637
|
-
return reduce(collection, (result, value) => {
|
|
1638
|
-
const key = keyFn(value);
|
|
1639
|
-
result[key] = value;
|
|
1640
|
-
return result;
|
|
1641
|
-
}, {});
|
|
1642
|
-
}
|
|
1643
|
-
__name(keyBy, "keyBy");
|
|
1644
|
-
|
|
1645
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/_internal/compareValues.mjs
|
|
1646
|
-
function getPriority(a) {
|
|
1647
|
-
if (typeof a === "symbol") {
|
|
1648
|
-
return 1;
|
|
1649
|
-
}
|
|
1650
|
-
if (a === null) {
|
|
1651
|
-
return 2;
|
|
1652
|
-
}
|
|
1653
|
-
if (a === void 0) {
|
|
1654
|
-
return 3;
|
|
1655
|
-
}
|
|
1656
|
-
if (a !== a) {
|
|
1657
|
-
return 4;
|
|
1658
|
-
}
|
|
1659
|
-
return 0;
|
|
1660
|
-
}
|
|
1661
|
-
__name(getPriority, "getPriority");
|
|
1662
|
-
var compareValues = /* @__PURE__ */ __name((a, b, order) => {
|
|
1663
|
-
if (a !== b) {
|
|
1664
|
-
const aPriority = getPriority(a);
|
|
1665
|
-
const bPriority = getPriority(b);
|
|
1666
|
-
if (aPriority === bPriority && aPriority === 0) {
|
|
1667
|
-
if (a < b) {
|
|
1668
|
-
return order === "desc" ? 1 : -1;
|
|
1669
|
-
}
|
|
1670
|
-
if (a > b) {
|
|
1671
|
-
return order === "desc" ? -1 : 1;
|
|
1672
|
-
}
|
|
1673
|
-
}
|
|
1674
|
-
return order === "desc" ? bPriority - aPriority : aPriority - bPriority;
|
|
1675
|
-
}
|
|
1676
|
-
return 0;
|
|
1677
|
-
}, "compareValues");
|
|
1678
|
-
|
|
1679
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/_internal/isKey.mjs
|
|
1680
|
-
var regexIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
|
|
1681
|
-
var regexIsPlainProp = /^\w*$/;
|
|
1682
|
-
function isKey(value, object) {
|
|
1683
|
-
if (Array.isArray(value)) {
|
|
1684
|
-
return false;
|
|
1685
|
-
}
|
|
1686
|
-
if (typeof value === "number" || typeof value === "boolean" || value == null || isSymbol(value)) {
|
|
1687
|
-
return true;
|
|
1688
|
-
}
|
|
1689
|
-
return typeof value === "string" && (regexIsPlainProp.test(value) || !regexIsDeepProp.test(value)) || object != null && Object.hasOwn(object, value);
|
|
1690
|
-
}
|
|
1691
|
-
__name(isKey, "isKey");
|
|
1692
|
-
|
|
1693
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/array/orderBy.mjs
|
|
1694
|
-
function orderBy(collection, criteria, orders, guard) {
|
|
1695
|
-
if (collection == null) {
|
|
1696
|
-
return [];
|
|
1697
|
-
}
|
|
1698
|
-
orders = guard ? void 0 : orders;
|
|
1699
|
-
if (!Array.isArray(collection)) {
|
|
1700
|
-
collection = Object.values(collection);
|
|
1701
|
-
}
|
|
1702
|
-
if (!Array.isArray(criteria)) {
|
|
1703
|
-
criteria = criteria == null ? [null] : [criteria];
|
|
1704
|
-
}
|
|
1705
|
-
if (criteria.length === 0) {
|
|
1706
|
-
criteria = [null];
|
|
1707
|
-
}
|
|
1708
|
-
if (!Array.isArray(orders)) {
|
|
1709
|
-
orders = orders == null ? [] : [orders];
|
|
1710
|
-
}
|
|
1711
|
-
orders = orders.map((order) => String(order));
|
|
1712
|
-
const getValueByNestedPath = /* @__PURE__ */ __name((object, path) => {
|
|
1713
|
-
let target = object;
|
|
1714
|
-
for (let i = 0; i < path.length && target != null; ++i) {
|
|
1715
|
-
target = target[path[i]];
|
|
1716
|
-
}
|
|
1717
|
-
return target;
|
|
1718
|
-
}, "getValueByNestedPath");
|
|
1719
|
-
const getValueByCriterion = /* @__PURE__ */ __name((criterion, object) => {
|
|
1720
|
-
if (object == null || criterion == null) {
|
|
1721
|
-
return object;
|
|
1722
|
-
}
|
|
1723
|
-
if (typeof criterion === "object" && "key" in criterion) {
|
|
1724
|
-
if (Object.hasOwn(object, criterion.key)) {
|
|
1725
|
-
return object[criterion.key];
|
|
1726
|
-
}
|
|
1727
|
-
return getValueByNestedPath(object, criterion.path);
|
|
1728
|
-
}
|
|
1729
|
-
if (typeof criterion === "function") {
|
|
1730
|
-
return criterion(object);
|
|
1731
|
-
}
|
|
1732
|
-
if (Array.isArray(criterion)) {
|
|
1733
|
-
return getValueByNestedPath(object, criterion);
|
|
1734
|
-
}
|
|
1735
|
-
if (typeof object === "object") {
|
|
1736
|
-
return object[criterion];
|
|
1737
|
-
}
|
|
1738
|
-
return object;
|
|
1739
|
-
}, "getValueByCriterion");
|
|
1740
|
-
const preparedCriteria = criteria.map((criterion) => {
|
|
1741
|
-
if (Array.isArray(criterion) && criterion.length === 1) {
|
|
1742
|
-
criterion = criterion[0];
|
|
1743
|
-
}
|
|
1744
|
-
if (criterion == null || typeof criterion === "function" || Array.isArray(criterion) || isKey(criterion)) {
|
|
1745
|
-
return criterion;
|
|
1746
|
-
}
|
|
1747
|
-
return { key: criterion, path: toPath(criterion) };
|
|
1748
|
-
});
|
|
1749
|
-
const preparedCollection = collection.map((item) => ({
|
|
1750
|
-
original: item,
|
|
1751
|
-
criteria: preparedCriteria.map((criterion) => getValueByCriterion(criterion, item))
|
|
1752
|
-
}));
|
|
1753
|
-
return preparedCollection.slice().sort((a, b) => {
|
|
1754
|
-
for (let i = 0; i < preparedCriteria.length; i++) {
|
|
1755
|
-
const comparedResult = compareValues(a.criteria[i], b.criteria[i], orders[i]);
|
|
1756
|
-
if (comparedResult !== 0) {
|
|
1757
|
-
return comparedResult;
|
|
1758
|
-
}
|
|
1759
|
-
}
|
|
1760
|
-
return 0;
|
|
1761
|
-
}).map((item) => item.original);
|
|
1762
|
-
}
|
|
1763
|
-
__name(orderBy, "orderBy");
|
|
1764
|
-
|
|
1765
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/object/unset.mjs
|
|
1766
|
-
function unset(obj, path) {
|
|
1767
|
-
if (obj == null) {
|
|
1768
|
-
return true;
|
|
1769
|
-
}
|
|
1770
|
-
switch (typeof path) {
|
|
1771
|
-
case "symbol":
|
|
1772
|
-
case "number":
|
|
1773
|
-
case "object": {
|
|
1774
|
-
if (Array.isArray(path)) {
|
|
1775
|
-
return unsetWithPath(obj, path);
|
|
1776
|
-
}
|
|
1777
|
-
if (typeof path === "number") {
|
|
1778
|
-
path = toKey(path);
|
|
1779
|
-
} else if (typeof path === "object") {
|
|
1780
|
-
if (Object.is(path?.valueOf(), -0)) {
|
|
1781
|
-
path = "-0";
|
|
1782
|
-
} else {
|
|
1783
|
-
path = String(path);
|
|
1784
|
-
}
|
|
1785
|
-
}
|
|
1786
|
-
if (isUnsafeProperty(path)) {
|
|
1787
|
-
return false;
|
|
1788
|
-
}
|
|
1789
|
-
if (obj?.[path] === void 0) {
|
|
1790
|
-
return true;
|
|
1791
|
-
}
|
|
1792
|
-
try {
|
|
1793
|
-
delete obj[path];
|
|
1794
|
-
return true;
|
|
1795
|
-
} catch {
|
|
1796
|
-
return false;
|
|
1797
|
-
}
|
|
1798
|
-
}
|
|
1799
|
-
case "string": {
|
|
1800
|
-
if (obj?.[path] === void 0 && isDeepKey(path)) {
|
|
1801
|
-
return unsetWithPath(obj, toPath(path));
|
|
1802
|
-
}
|
|
1803
|
-
if (isUnsafeProperty(path)) {
|
|
1804
|
-
return false;
|
|
1805
|
-
}
|
|
1806
|
-
try {
|
|
1807
|
-
delete obj[path];
|
|
1808
|
-
return true;
|
|
1809
|
-
} catch {
|
|
1810
|
-
return false;
|
|
1811
|
-
}
|
|
1812
|
-
}
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1815
|
-
__name(unset, "unset");
|
|
1816
|
-
function unsetWithPath(obj, path) {
|
|
1817
|
-
const parent = get(obj, path.slice(0, -1), obj);
|
|
1818
|
-
const lastKey = path[path.length - 1];
|
|
1819
|
-
if (parent?.[lastKey] === void 0) {
|
|
1820
|
-
return true;
|
|
1821
|
-
}
|
|
1822
|
-
if (isUnsafeProperty(lastKey)) {
|
|
1823
|
-
return false;
|
|
1824
|
-
}
|
|
1825
|
-
try {
|
|
1826
|
-
delete parent[lastKey];
|
|
1827
|
-
return true;
|
|
1828
|
-
} catch {
|
|
1829
|
-
return false;
|
|
1830
|
-
}
|
|
1831
|
-
}
|
|
1832
|
-
__name(unsetWithPath, "unsetWithPath");
|
|
1833
|
-
|
|
1834
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/predicate/isArray.mjs
|
|
1835
|
-
function isArray(value) {
|
|
1836
|
-
return Array.isArray(value);
|
|
1837
|
-
}
|
|
1838
|
-
__name(isArray, "isArray");
|
|
1839
|
-
|
|
1840
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/object/values.mjs
|
|
1841
|
-
function values(object) {
|
|
1842
|
-
if (object == null) {
|
|
1843
|
-
return [];
|
|
1844
|
-
}
|
|
1845
|
-
return Object.values(object);
|
|
1846
|
-
}
|
|
1847
|
-
__name(values, "values");
|
|
1848
|
-
|
|
1849
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/predicate/isNil.mjs
|
|
1850
|
-
function isNil(x) {
|
|
1851
|
-
return x == null;
|
|
1852
|
-
}
|
|
1853
|
-
__name(isNil, "isNil");
|
|
1854
|
-
|
|
1855
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/array/some.mjs
|
|
1856
|
-
function some(source, predicate, guard) {
|
|
1857
|
-
if (!source) {
|
|
1858
|
-
return false;
|
|
1859
|
-
}
|
|
1860
|
-
if (guard != null) {
|
|
1861
|
-
predicate = void 0;
|
|
1862
|
-
}
|
|
1863
|
-
if (!predicate) {
|
|
1864
|
-
predicate = identity;
|
|
1865
|
-
}
|
|
1866
|
-
const values2 = Array.isArray(source) ? source : Object.values(source);
|
|
1867
|
-
switch (typeof predicate) {
|
|
1868
|
-
case "function": {
|
|
1869
|
-
if (!Array.isArray(source)) {
|
|
1870
|
-
const keys2 = Object.keys(source);
|
|
1871
|
-
for (let i = 0; i < keys2.length; i++) {
|
|
1872
|
-
const key = keys2[i];
|
|
1873
|
-
const value = source[key];
|
|
1874
|
-
if (predicate(value, key, source)) {
|
|
1875
|
-
return true;
|
|
1876
|
-
}
|
|
1877
|
-
}
|
|
1878
|
-
return false;
|
|
1879
|
-
}
|
|
1880
|
-
for (let i = 0; i < source.length; i++) {
|
|
1881
|
-
if (predicate(source[i], i, source)) {
|
|
1882
|
-
return true;
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
1885
|
-
return false;
|
|
1886
|
-
}
|
|
1887
|
-
case "object": {
|
|
1888
|
-
if (Array.isArray(predicate) && predicate.length === 2) {
|
|
1889
|
-
const key = predicate[0];
|
|
1890
|
-
const value = predicate[1];
|
|
1891
|
-
const matchFunc = matchesProperty(key, value);
|
|
1892
|
-
if (Array.isArray(source)) {
|
|
1893
|
-
for (let i = 0; i < source.length; i++) {
|
|
1894
|
-
if (matchFunc(source[i])) {
|
|
1895
|
-
return true;
|
|
1896
|
-
}
|
|
1897
|
-
}
|
|
1898
|
-
return false;
|
|
1899
|
-
}
|
|
1900
|
-
return values2.some(matchFunc);
|
|
1901
|
-
} else {
|
|
1902
|
-
const matchFunc = matches(predicate);
|
|
1903
|
-
if (Array.isArray(source)) {
|
|
1904
|
-
for (let i = 0; i < source.length; i++) {
|
|
1905
|
-
if (matchFunc(source[i])) {
|
|
1906
|
-
return true;
|
|
1907
|
-
}
|
|
1908
|
-
}
|
|
1909
|
-
return false;
|
|
1910
|
-
}
|
|
1911
|
-
return values2.some(matchFunc);
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
|
-
case "number":
|
|
1915
|
-
case "symbol":
|
|
1916
|
-
case "string": {
|
|
1917
|
-
const propFunc = property(predicate);
|
|
1918
|
-
if (Array.isArray(source)) {
|
|
1919
|
-
for (let i = 0; i < source.length; i++) {
|
|
1920
|
-
if (propFunc(source[i])) {
|
|
1921
|
-
return true;
|
|
1922
|
-
}
|
|
1923
|
-
}
|
|
1924
|
-
return false;
|
|
1925
|
-
}
|
|
1926
|
-
return values2.some(propFunc);
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
|
-
}
|
|
1930
|
-
__name(some, "some");
|
|
1931
|
-
|
|
1932
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/array/sortBy.mjs
|
|
1933
|
-
function sortBy(collection, ...criteria) {
|
|
1934
|
-
const length = criteria.length;
|
|
1935
|
-
if (length > 1 && isIterateeCall(collection, criteria[0], criteria[1])) {
|
|
1936
|
-
criteria = [];
|
|
1937
|
-
} else if (length > 2 && isIterateeCall(criteria[0], criteria[1], criteria[2])) {
|
|
1938
|
-
criteria = [criteria[0]];
|
|
1939
|
-
}
|
|
1940
|
-
return orderBy(collection, flatten(criteria), ["asc"]);
|
|
1941
|
-
}
|
|
1942
|
-
__name(sortBy, "sortBy");
|
|
1943
|
-
|
|
1944
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/function/identity.mjs
|
|
1945
|
-
function identity2(x) {
|
|
1946
|
-
return x;
|
|
1947
|
-
}
|
|
1948
|
-
__name(identity2, "identity");
|
|
1949
|
-
|
|
1950
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/_internal/assignValue.mjs
|
|
1951
|
-
var assignValue = /* @__PURE__ */ __name((object, key, value) => {
|
|
1952
|
-
const objValue = object[key];
|
|
1953
|
-
if (!(Object.hasOwn(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
|
|
1954
|
-
object[key] = value;
|
|
1955
|
-
}
|
|
1956
|
-
}, "assignValue");
|
|
1957
|
-
|
|
1958
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/object/updateWith.mjs
|
|
1959
|
-
function updateWith(obj, path, updater, customizer) {
|
|
1960
|
-
if (obj == null && !isObject2(obj)) {
|
|
1961
|
-
return obj;
|
|
1962
|
-
}
|
|
1963
|
-
const resolvedPath = isKey(path, obj) ? [path] : Array.isArray(path) ? path : typeof path === "string" ? toPath(path) : [path];
|
|
1964
|
-
let current = obj;
|
|
1965
|
-
for (let i = 0; i < resolvedPath.length && current != null; i++) {
|
|
1966
|
-
const key = toKey(resolvedPath[i]);
|
|
1967
|
-
if (isUnsafeProperty(key)) {
|
|
1968
|
-
continue;
|
|
1969
|
-
}
|
|
1970
|
-
let newValue;
|
|
1971
|
-
if (i === resolvedPath.length - 1) {
|
|
1972
|
-
newValue = updater(current[key]);
|
|
1973
|
-
} else {
|
|
1974
|
-
const objValue = current[key];
|
|
1975
|
-
const customizerResult = customizer?.(objValue, key, obj);
|
|
1976
|
-
newValue = customizerResult !== void 0 ? customizerResult : isObject2(objValue) ? objValue : isIndex(resolvedPath[i + 1]) ? [] : {};
|
|
1977
|
-
}
|
|
1978
|
-
assignValue(current, key, newValue);
|
|
1979
|
-
current = current[key];
|
|
1980
|
-
}
|
|
1981
|
-
return obj;
|
|
1982
|
-
}
|
|
1983
|
-
__name(updateWith, "updateWith");
|
|
1984
|
-
|
|
1985
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/object/set.mjs
|
|
1986
|
-
function set(obj, path, value) {
|
|
1987
|
-
return updateWith(obj, path, () => value, () => void 0);
|
|
1988
|
-
}
|
|
1989
|
-
__name(set, "set");
|
|
1990
|
-
|
|
1991
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
|
|
1992
|
-
function isPlainObject(value) {
|
|
1993
|
-
if (!value || typeof value !== "object") {
|
|
1994
|
-
return false;
|
|
1995
|
-
}
|
|
1996
|
-
const proto = Object.getPrototypeOf(value);
|
|
1997
|
-
const hasObjectPrototype = proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null;
|
|
1998
|
-
if (!hasObjectPrototype) {
|
|
1999
|
-
return false;
|
|
2000
|
-
}
|
|
2001
|
-
return Object.prototype.toString.call(value) === "[object Object]";
|
|
2002
|
-
}
|
|
2003
|
-
__name(isPlainObject, "isPlainObject");
|
|
2004
|
-
|
|
2005
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/predicate/isEqualWith.mjs
|
|
2006
|
-
function isEqualWith(a, b, areValuesEqual) {
|
|
2007
|
-
return isEqualWithImpl(a, b, void 0, void 0, void 0, void 0, areValuesEqual);
|
|
2008
|
-
}
|
|
2009
|
-
__name(isEqualWith, "isEqualWith");
|
|
2010
|
-
function isEqualWithImpl(a, b, property2, aParent, bParent, stack, areValuesEqual) {
|
|
2011
|
-
const result = areValuesEqual(a, b, property2, aParent, bParent, stack);
|
|
2012
|
-
if (result !== void 0) {
|
|
2013
|
-
return result;
|
|
2014
|
-
}
|
|
2015
|
-
if (typeof a === typeof b) {
|
|
2016
|
-
switch (typeof a) {
|
|
2017
|
-
case "bigint":
|
|
2018
|
-
case "string":
|
|
2019
|
-
case "boolean":
|
|
2020
|
-
case "symbol":
|
|
2021
|
-
case "undefined": {
|
|
2022
|
-
return a === b;
|
|
2023
|
-
}
|
|
2024
|
-
case "number": {
|
|
2025
|
-
return a === b || Object.is(a, b);
|
|
2026
|
-
}
|
|
2027
|
-
case "function": {
|
|
2028
|
-
return a === b;
|
|
2029
|
-
}
|
|
2030
|
-
case "object": {
|
|
2031
|
-
return areObjectsEqual(a, b, stack, areValuesEqual);
|
|
2032
|
-
}
|
|
2033
|
-
}
|
|
2034
|
-
}
|
|
2035
|
-
return areObjectsEqual(a, b, stack, areValuesEqual);
|
|
2036
|
-
}
|
|
2037
|
-
__name(isEqualWithImpl, "isEqualWithImpl");
|
|
2038
|
-
function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
2039
|
-
if (Object.is(a, b)) {
|
|
2040
|
-
return true;
|
|
2041
|
-
}
|
|
2042
|
-
let aTag = getTag(a);
|
|
2043
|
-
let bTag = getTag(b);
|
|
2044
|
-
if (aTag === argumentsTag) {
|
|
2045
|
-
aTag = objectTag;
|
|
2046
|
-
}
|
|
2047
|
-
if (bTag === argumentsTag) {
|
|
2048
|
-
bTag = objectTag;
|
|
2049
|
-
}
|
|
2050
|
-
if (aTag !== bTag) {
|
|
2051
|
-
return false;
|
|
2052
|
-
}
|
|
2053
|
-
switch (aTag) {
|
|
2054
|
-
case stringTag:
|
|
2055
|
-
return a.toString() === b.toString();
|
|
2056
|
-
case numberTag: {
|
|
2057
|
-
const x = a.valueOf();
|
|
2058
|
-
const y = b.valueOf();
|
|
2059
|
-
return eq(x, y);
|
|
2060
|
-
}
|
|
2061
|
-
case booleanTag:
|
|
2062
|
-
case dateTag:
|
|
2063
|
-
case symbolTag:
|
|
2064
|
-
return Object.is(a.valueOf(), b.valueOf());
|
|
2065
|
-
case regexpTag: {
|
|
2066
|
-
return a.source === b.source && a.flags === b.flags;
|
|
2067
|
-
}
|
|
2068
|
-
case functionTag: {
|
|
2069
|
-
return a === b;
|
|
2070
|
-
}
|
|
2071
|
-
}
|
|
2072
|
-
stack = stack ?? /* @__PURE__ */ new Map();
|
|
2073
|
-
const aStack = stack.get(a);
|
|
2074
|
-
const bStack = stack.get(b);
|
|
2075
|
-
if (aStack != null && bStack != null) {
|
|
2076
|
-
return aStack === b;
|
|
2077
|
-
}
|
|
2078
|
-
stack.set(a, b);
|
|
2079
|
-
stack.set(b, a);
|
|
2080
|
-
try {
|
|
2081
|
-
switch (aTag) {
|
|
2082
|
-
case mapTag: {
|
|
2083
|
-
if (a.size !== b.size) {
|
|
2084
|
-
return false;
|
|
2085
|
-
}
|
|
2086
|
-
for (const [key, value] of a.entries()) {
|
|
2087
|
-
if (!b.has(key) || !isEqualWithImpl(value, b.get(key), key, a, b, stack, areValuesEqual)) {
|
|
2088
|
-
return false;
|
|
2089
|
-
}
|
|
2090
|
-
}
|
|
2091
|
-
return true;
|
|
2092
|
-
}
|
|
2093
|
-
case setTag: {
|
|
2094
|
-
if (a.size !== b.size) {
|
|
2095
|
-
return false;
|
|
2096
|
-
}
|
|
2097
|
-
const aValues = Array.from(a.values());
|
|
2098
|
-
const bValues = Array.from(b.values());
|
|
2099
|
-
for (let i = 0; i < aValues.length; i++) {
|
|
2100
|
-
const aValue = aValues[i];
|
|
2101
|
-
const index = bValues.findIndex((bValue) => {
|
|
2102
|
-
return isEqualWithImpl(aValue, bValue, void 0, a, b, stack, areValuesEqual);
|
|
2103
|
-
});
|
|
2104
|
-
if (index === -1) {
|
|
2105
|
-
return false;
|
|
2106
|
-
}
|
|
2107
|
-
bValues.splice(index, 1);
|
|
2108
|
-
}
|
|
2109
|
-
return true;
|
|
2110
|
-
}
|
|
2111
|
-
case arrayTag:
|
|
2112
|
-
case uint8ArrayTag:
|
|
2113
|
-
case uint8ClampedArrayTag:
|
|
2114
|
-
case uint16ArrayTag:
|
|
2115
|
-
case uint32ArrayTag:
|
|
2116
|
-
case bigUint64ArrayTag:
|
|
2117
|
-
case int8ArrayTag:
|
|
2118
|
-
case int16ArrayTag:
|
|
2119
|
-
case int32ArrayTag:
|
|
2120
|
-
case bigInt64ArrayTag:
|
|
2121
|
-
case float32ArrayTag:
|
|
2122
|
-
case float64ArrayTag: {
|
|
2123
|
-
if (typeof Buffer !== "undefined" && Buffer.isBuffer(a) !== Buffer.isBuffer(b)) {
|
|
2124
|
-
return false;
|
|
2125
|
-
}
|
|
2126
|
-
if (a.length !== b.length) {
|
|
2127
|
-
return false;
|
|
2128
|
-
}
|
|
2129
|
-
for (let i = 0; i < a.length; i++) {
|
|
2130
|
-
if (!isEqualWithImpl(a[i], b[i], i, a, b, stack, areValuesEqual)) {
|
|
2131
|
-
return false;
|
|
2132
|
-
}
|
|
2133
|
-
}
|
|
2134
|
-
return true;
|
|
2135
|
-
}
|
|
2136
|
-
case arrayBufferTag: {
|
|
2137
|
-
if (a.byteLength !== b.byteLength) {
|
|
2138
|
-
return false;
|
|
2139
|
-
}
|
|
2140
|
-
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
|
2141
|
-
}
|
|
2142
|
-
case dataViewTag: {
|
|
2143
|
-
if (a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset) {
|
|
2144
|
-
return false;
|
|
2145
|
-
}
|
|
2146
|
-
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
|
2147
|
-
}
|
|
2148
|
-
case errorTag: {
|
|
2149
|
-
return a.name === b.name && a.message === b.message;
|
|
2150
|
-
}
|
|
2151
|
-
case objectTag: {
|
|
2152
|
-
const areEqualInstances = areObjectsEqual(a.constructor, b.constructor, stack, areValuesEqual) || isPlainObject(a) && isPlainObject(b);
|
|
2153
|
-
if (!areEqualInstances) {
|
|
2154
|
-
return false;
|
|
2155
|
-
}
|
|
2156
|
-
const aKeys = [...Object.keys(a), ...getSymbols(a)];
|
|
2157
|
-
const bKeys = [...Object.keys(b), ...getSymbols(b)];
|
|
2158
|
-
if (aKeys.length !== bKeys.length) {
|
|
2159
|
-
return false;
|
|
2160
|
-
}
|
|
2161
|
-
for (let i = 0; i < aKeys.length; i++) {
|
|
2162
|
-
const propKey = aKeys[i];
|
|
2163
|
-
const aProp = a[propKey];
|
|
2164
|
-
if (!Object.hasOwn(b, propKey)) {
|
|
2165
|
-
return false;
|
|
2166
|
-
}
|
|
2167
|
-
const bProp = b[propKey];
|
|
2168
|
-
if (!isEqualWithImpl(aProp, bProp, propKey, a, b, stack, areValuesEqual)) {
|
|
2169
|
-
return false;
|
|
2170
|
-
}
|
|
2171
|
-
}
|
|
2172
|
-
return true;
|
|
2173
|
-
}
|
|
2174
|
-
default: {
|
|
2175
|
-
return false;
|
|
2176
|
-
}
|
|
2177
|
-
}
|
|
2178
|
-
} finally {
|
|
2179
|
-
stack.delete(a);
|
|
2180
|
-
stack.delete(b);
|
|
2181
|
-
}
|
|
2182
|
-
}
|
|
2183
|
-
__name(areObjectsEqual, "areObjectsEqual");
|
|
2184
|
-
|
|
2185
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/function/noop.mjs
|
|
2186
|
-
function noop() {
|
|
2187
|
-
}
|
|
2188
|
-
__name(noop, "noop");
|
|
2189
|
-
|
|
2190
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/predicate/isEqual.mjs
|
|
2191
|
-
function isEqual(a, b) {
|
|
2192
|
-
return isEqualWith(a, b, noop);
|
|
2193
|
-
}
|
|
2194
|
-
__name(isEqual, "isEqual");
|
|
2195
|
-
|
|
2196
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/predicate/isBuffer.mjs
|
|
2197
|
-
function isBuffer(x) {
|
|
2198
|
-
return typeof Buffer !== "undefined" && Buffer.isBuffer(x);
|
|
2199
|
-
}
|
|
2200
|
-
__name(isBuffer, "isBuffer");
|
|
2201
|
-
|
|
2202
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/_internal/isPrototype.mjs
|
|
2203
|
-
function isPrototype(value) {
|
|
2204
|
-
const constructor = value?.constructor;
|
|
2205
|
-
const prototype = typeof constructor === "function" ? constructor.prototype : Object.prototype;
|
|
2206
|
-
return value === prototype;
|
|
2207
|
-
}
|
|
2208
|
-
__name(isPrototype, "isPrototype");
|
|
2209
|
-
|
|
2210
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.mjs
|
|
2211
|
-
function isTypedArray2(x) {
|
|
2212
|
-
return isTypedArray(x);
|
|
2213
|
-
}
|
|
2214
|
-
__name(isTypedArray2, "isTypedArray");
|
|
2215
|
-
|
|
2216
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/util/times.mjs
|
|
2217
|
-
function times(n, getValue) {
|
|
2218
|
-
n = toInteger(n);
|
|
2219
|
-
if (n < 1 || !Number.isSafeInteger(n)) {
|
|
2220
|
-
return [];
|
|
2221
|
-
}
|
|
2222
|
-
const result = new Array(n);
|
|
2223
|
-
for (let i = 0; i < n; i++) {
|
|
2224
|
-
result[i] = typeof getValue === "function" ? getValue(i) : i;
|
|
2225
|
-
}
|
|
2226
|
-
return result;
|
|
2227
|
-
}
|
|
2228
|
-
__name(times, "times");
|
|
2229
|
-
|
|
2230
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/object/keys.mjs
|
|
2231
|
-
function keys(object) {
|
|
2232
|
-
if (isArrayLike(object)) {
|
|
2233
|
-
return arrayLikeKeys(object);
|
|
2234
|
-
}
|
|
2235
|
-
const result = Object.keys(Object(object));
|
|
2236
|
-
if (!isPrototype(object)) {
|
|
2237
|
-
return result;
|
|
2238
|
-
}
|
|
2239
|
-
return result.filter((key) => key !== "constructor");
|
|
2240
|
-
}
|
|
2241
|
-
__name(keys, "keys");
|
|
2242
|
-
function arrayLikeKeys(object) {
|
|
2243
|
-
const indices = times(object.length, (index) => `${index}`);
|
|
2244
|
-
const filteredKeys = new Set(indices);
|
|
2245
|
-
if (isBuffer(object)) {
|
|
2246
|
-
filteredKeys.add("offset");
|
|
2247
|
-
filteredKeys.add("parent");
|
|
2248
|
-
}
|
|
2249
|
-
if (isTypedArray2(object)) {
|
|
2250
|
-
filteredKeys.add("buffer");
|
|
2251
|
-
filteredKeys.add("byteLength");
|
|
2252
|
-
filteredKeys.add("byteOffset");
|
|
2253
|
-
}
|
|
2254
|
-
return [...indices, ...Object.keys(object).filter((key) => !filteredKeys.has(key))];
|
|
2255
|
-
}
|
|
2256
|
-
__name(arrayLikeKeys, "arrayLikeKeys");
|
|
2257
|
-
|
|
2258
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/object/keysIn.mjs
|
|
2259
|
-
function keysIn(object) {
|
|
2260
|
-
if (object == null) {
|
|
2261
|
-
return [];
|
|
2262
|
-
}
|
|
2263
|
-
switch (typeof object) {
|
|
2264
|
-
case "object":
|
|
2265
|
-
case "function": {
|
|
2266
|
-
if (isArrayLike(object)) {
|
|
2267
|
-
return arrayLikeKeysIn(object);
|
|
2268
|
-
}
|
|
2269
|
-
if (isPrototype(object)) {
|
|
2270
|
-
return prototypeKeysIn(object);
|
|
2271
|
-
}
|
|
2272
|
-
return keysInImpl(object);
|
|
2273
|
-
}
|
|
2274
|
-
default: {
|
|
2275
|
-
return keysInImpl(Object(object));
|
|
2276
|
-
}
|
|
2277
|
-
}
|
|
2278
|
-
}
|
|
2279
|
-
__name(keysIn, "keysIn");
|
|
2280
|
-
function keysInImpl(object) {
|
|
2281
|
-
const result = [];
|
|
2282
|
-
for (const key in object) {
|
|
2283
|
-
result.push(key);
|
|
2284
|
-
}
|
|
2285
|
-
return result;
|
|
2286
|
-
}
|
|
2287
|
-
__name(keysInImpl, "keysInImpl");
|
|
2288
|
-
function prototypeKeysIn(object) {
|
|
2289
|
-
const keys2 = keysInImpl(object);
|
|
2290
|
-
return keys2.filter((key) => key !== "constructor");
|
|
2291
|
-
}
|
|
2292
|
-
__name(prototypeKeysIn, "prototypeKeysIn");
|
|
2293
|
-
function arrayLikeKeysIn(object) {
|
|
2294
|
-
const indices = times(object.length, (index) => `${index}`);
|
|
2295
|
-
const filteredKeys = new Set(indices);
|
|
2296
|
-
if (isBuffer(object)) {
|
|
2297
|
-
filteredKeys.add("offset");
|
|
2298
|
-
filteredKeys.add("parent");
|
|
2299
|
-
}
|
|
2300
|
-
if (isTypedArray2(object)) {
|
|
2301
|
-
filteredKeys.add("buffer");
|
|
2302
|
-
filteredKeys.add("byteLength");
|
|
2303
|
-
filteredKeys.add("byteOffset");
|
|
2304
|
-
}
|
|
2305
|
-
return [...indices, ...keysInImpl(object).filter((key) => !filteredKeys.has(key))];
|
|
2306
|
-
}
|
|
2307
|
-
__name(arrayLikeKeysIn, "arrayLikeKeysIn");
|
|
2308
|
-
|
|
2309
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/object/omit.mjs
|
|
2310
|
-
function omit(obj, ...keysArr) {
|
|
2311
|
-
if (obj == null) {
|
|
2312
|
-
return {};
|
|
2313
|
-
}
|
|
2314
|
-
const result = cloneDeep(obj);
|
|
2315
|
-
for (let i = 0; i < keysArr.length; i++) {
|
|
2316
|
-
let keys2 = keysArr[i];
|
|
2317
|
-
switch (typeof keys2) {
|
|
2318
|
-
case "object": {
|
|
2319
|
-
if (!Array.isArray(keys2)) {
|
|
2320
|
-
keys2 = Array.from(keys2);
|
|
2321
|
-
}
|
|
2322
|
-
for (let j = 0; j < keys2.length; j++) {
|
|
2323
|
-
const key = keys2[j];
|
|
2324
|
-
unset(result, key);
|
|
2325
|
-
}
|
|
2326
|
-
break;
|
|
2327
|
-
}
|
|
2328
|
-
case "string":
|
|
2329
|
-
case "symbol":
|
|
2330
|
-
case "number": {
|
|
2331
|
-
unset(result, keys2);
|
|
2332
|
-
break;
|
|
2333
|
-
}
|
|
2334
|
-
}
|
|
2335
|
-
}
|
|
2336
|
-
return result;
|
|
2337
|
-
}
|
|
2338
|
-
__name(omit, "omit");
|
|
2339
|
-
|
|
2340
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/_internal/getSymbolsIn.mjs
|
|
2341
|
-
function getSymbolsIn(object) {
|
|
2342
|
-
const result = [];
|
|
2343
|
-
while (object) {
|
|
2344
|
-
result.push(...getSymbols(object));
|
|
2345
|
-
object = Object.getPrototypeOf(object);
|
|
2346
|
-
}
|
|
2347
|
-
return result;
|
|
2348
|
-
}
|
|
2349
|
-
__name(getSymbolsIn, "getSymbolsIn");
|
|
2350
|
-
|
|
2351
|
-
// node_modules/.pnpm/es-toolkit@1.39.8/node_modules/es-toolkit/dist/compat/object/pickBy.mjs
|
|
2352
|
-
function pickBy(obj, shouldPick) {
|
|
2353
|
-
if (obj == null) {
|
|
2354
|
-
return {};
|
|
2355
|
-
}
|
|
2356
|
-
const predicate = iteratee(shouldPick ?? identity2);
|
|
2357
|
-
const result = {};
|
|
2358
|
-
const keys2 = isArrayLike(obj) ? range(0, obj.length) : [...keysIn(obj), ...getSymbolsIn(obj)];
|
|
2359
|
-
for (let i = 0; i < keys2.length; i++) {
|
|
2360
|
-
const key = isSymbol(keys2[i]) ? keys2[i] : keys2[i].toString();
|
|
2361
|
-
const value = obj[key];
|
|
2362
|
-
if (predicate(value, key, obj)) {
|
|
2363
|
-
result[key] = value;
|
|
2364
|
-
}
|
|
2365
|
-
}
|
|
2366
|
-
return result;
|
|
2367
|
-
}
|
|
2368
|
-
__name(pickBy, "pickBy");
|
|
3
|
+
var ky = require('ky');
|
|
4
|
+
var compat = require('es-toolkit/compat');
|
|
2369
5
|
|
|
2370
|
-
|
|
2371
|
-
function isBoolean(value) {
|
|
2372
|
-
return typeof value === "boolean" || value instanceof Boolean;
|
|
2373
|
-
}
|
|
2374
|
-
__name(isBoolean, "isBoolean");
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
2375
7
|
|
|
2376
|
-
|
|
2377
|
-
function isFinite(value) {
|
|
2378
|
-
return Number.isFinite(value);
|
|
2379
|
-
}
|
|
2380
|
-
__name(isFinite, "isFinite");
|
|
8
|
+
var ky__default = /*#__PURE__*/_interopDefault(ky);
|
|
2381
9
|
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
return Number.isInteger(value);
|
|
2385
|
-
}
|
|
2386
|
-
__name(isInteger, "isInteger");
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
2387
12
|
|
|
2388
13
|
// src/lib/utils.ts
|
|
2389
14
|
function getFieldMask(obj) {
|
|
@@ -2420,8 +45,8 @@ function letterToColumn(letter) {
|
|
|
2420
45
|
}
|
|
2421
46
|
__name(letterToColumn, "letterToColumn");
|
|
2422
47
|
function checkForDuplicateHeaders(headers) {
|
|
2423
|
-
const checkForDupes =
|
|
2424
|
-
|
|
48
|
+
const checkForDupes = compat.groupBy(headers);
|
|
49
|
+
compat.each(checkForDupes, (grouped, header) => {
|
|
2425
50
|
if (!header) return;
|
|
2426
51
|
if (grouped.length > 1) {
|
|
2427
52
|
throw new Error(`Duplicate header detected: "${header}". Please make sure all non-empty headers are unique`);
|
|
@@ -2604,20 +229,20 @@ var GoogleSpreadsheetCell = class {
|
|
|
2604
229
|
if (this._draftData.value !== void 0) throw new Error("Value has been changed");
|
|
2605
230
|
if (this._error) return this._error;
|
|
2606
231
|
if (!this._rawData?.effectiveValue) return null;
|
|
2607
|
-
return values(this._rawData.effectiveValue)[0];
|
|
232
|
+
return compat.values(this._rawData.effectiveValue)[0];
|
|
2608
233
|
}
|
|
2609
234
|
set value(newValue) {
|
|
2610
235
|
if (newValue instanceof GoogleSpreadsheetCellErrorValue) {
|
|
2611
236
|
throw new Error("You can't manually set a value to an error");
|
|
2612
237
|
}
|
|
2613
|
-
if (isBoolean(newValue)) {
|
|
238
|
+
if (compat.isBoolean(newValue)) {
|
|
2614
239
|
this._draftData.valueType = "boolValue";
|
|
2615
|
-
} else if (isString(newValue)) {
|
|
240
|
+
} else if (compat.isString(newValue)) {
|
|
2616
241
|
if (newValue.substring(0, 1) === "=") this._draftData.valueType = "formulaValue";
|
|
2617
242
|
else this._draftData.valueType = "stringValue";
|
|
2618
|
-
} else if (isFinite(newValue)) {
|
|
243
|
+
} else if (compat.isFinite(newValue)) {
|
|
2619
244
|
this._draftData.valueType = "numberValue";
|
|
2620
|
-
} else if (isNil(newValue)) {
|
|
245
|
+
} else if (compat.isNil(newValue)) {
|
|
2621
246
|
this._draftData.valueType = "stringValue";
|
|
2622
247
|
newValue = "";
|
|
2623
248
|
} else {
|
|
@@ -2628,14 +253,14 @@ var GoogleSpreadsheetCell = class {
|
|
|
2628
253
|
get valueType() {
|
|
2629
254
|
if (this._error) return "errorValue";
|
|
2630
255
|
if (!this._rawData?.effectiveValue) return null;
|
|
2631
|
-
return keys(this._rawData.effectiveValue)[0];
|
|
256
|
+
return compat.keys(this._rawData.effectiveValue)[0];
|
|
2632
257
|
}
|
|
2633
258
|
/** The formatted value of the cell - this is the value as it's shown to the user */
|
|
2634
259
|
get formattedValue() {
|
|
2635
260
|
return this._rawData?.formattedValue || null;
|
|
2636
261
|
}
|
|
2637
262
|
get formula() {
|
|
2638
|
-
return get(this._rawData, "userEnteredValue.formulaValue", null);
|
|
263
|
+
return compat.get(this._rawData, "userEnteredValue.formulaValue", null);
|
|
2639
264
|
}
|
|
2640
265
|
set formula(newValue) {
|
|
2641
266
|
if (!newValue) throw new Error("To clear a formula, set `cell.value = null`");
|
|
@@ -2693,7 +318,7 @@ var GoogleSpreadsheetCell = class {
|
|
|
2693
318
|
}
|
|
2694
319
|
set note(newVal) {
|
|
2695
320
|
if (newVal === null || newVal === void 0 || newVal === false) newVal = "";
|
|
2696
|
-
if (!isString(newVal)) throw new Error("Note must be a string");
|
|
321
|
+
if (!compat.isString(newVal)) throw new Error("Note must be a string");
|
|
2697
322
|
if (newVal === this._rawData?.note) delete this._draftData.note;
|
|
2698
323
|
else this._draftData.note = newVal;
|
|
2699
324
|
}
|
|
@@ -2705,16 +330,16 @@ var GoogleSpreadsheetCell = class {
|
|
|
2705
330
|
return Object.freeze(this._rawData?.effectiveFormat);
|
|
2706
331
|
}
|
|
2707
332
|
_getFormatParam(param) {
|
|
2708
|
-
if (get(this._draftData, `userEnteredFormat.${param}`)) {
|
|
333
|
+
if (compat.get(this._draftData, `userEnteredFormat.${param}`)) {
|
|
2709
334
|
throw new Error("User format is unsaved - save the cell to be able to read it again");
|
|
2710
335
|
}
|
|
2711
336
|
return Object.freeze(this._rawData.userEnteredFormat[param]);
|
|
2712
337
|
}
|
|
2713
338
|
_setFormatParam(param, newVal) {
|
|
2714
|
-
if (isEqual(newVal, get(this._rawData, `userEnteredFormat.${param}`))) {
|
|
2715
|
-
unset(this._draftData, `userEnteredFormat.${param}`);
|
|
339
|
+
if (compat.isEqual(newVal, compat.get(this._rawData, `userEnteredFormat.${param}`))) {
|
|
340
|
+
compat.unset(this._draftData, `userEnteredFormat.${param}`);
|
|
2716
341
|
} else {
|
|
2717
|
-
set(this._draftData, `userEnteredFormat.${param}`, newVal);
|
|
342
|
+
compat.set(this._draftData, `userEnteredFormat.${param}`, newVal);
|
|
2718
343
|
this._draftData.clearFormat = false;
|
|
2719
344
|
}
|
|
2720
345
|
}
|
|
@@ -2800,7 +425,7 @@ var GoogleSpreadsheetCell = class {
|
|
|
2800
425
|
// returns true if there are any updates that have not been saved yet
|
|
2801
426
|
get _isDirty() {
|
|
2802
427
|
if (this._draftData.note !== void 0) return true;
|
|
2803
|
-
if (keys(this._draftData.userEnteredFormat).length) return true;
|
|
428
|
+
if (compat.keys(this._draftData.userEnteredFormat).length) return true;
|
|
2804
429
|
if (this._draftData.clearFormat) return true;
|
|
2805
430
|
if (this._draftData.value !== void 0) return true;
|
|
2806
431
|
return false;
|
|
@@ -2823,9 +448,9 @@ var GoogleSpreadsheetCell = class {
|
|
|
2823
448
|
_getUpdateRequest() {
|
|
2824
449
|
const isValueUpdated = this._draftData.value !== void 0;
|
|
2825
450
|
const isNoteUpdated = this._draftData.note !== void 0;
|
|
2826
|
-
const isFormatUpdated = !!keys(this._draftData.userEnteredFormat || {}).length;
|
|
451
|
+
const isFormatUpdated = !!compat.keys(this._draftData.userEnteredFormat || {}).length;
|
|
2827
452
|
const isFormatCleared = this._draftData.clearFormat;
|
|
2828
|
-
if (!some([isValueUpdated, isNoteUpdated, isFormatUpdated, isFormatCleared])) {
|
|
453
|
+
if (!compat.some([isValueUpdated, isNoteUpdated, isFormatUpdated, isFormatCleared])) {
|
|
2829
454
|
return null;
|
|
2830
455
|
}
|
|
2831
456
|
const format = {
|
|
@@ -2833,7 +458,7 @@ var GoogleSpreadsheetCell = class {
|
|
|
2833
458
|
...this._rawData?.userEnteredFormat,
|
|
2834
459
|
...this._draftData.userEnteredFormat
|
|
2835
460
|
};
|
|
2836
|
-
if (get(this._draftData, "userEnteredFormat.backgroundColor")) {
|
|
461
|
+
if (compat.get(this._draftData, "userEnteredFormat.backgroundColor")) {
|
|
2837
462
|
delete format.backgroundColorStyle;
|
|
2838
463
|
}
|
|
2839
464
|
return {
|
|
@@ -2855,7 +480,7 @@ var GoogleSpreadsheetCell = class {
|
|
|
2855
480
|
}]
|
|
2856
481
|
}],
|
|
2857
482
|
// turns into a string of which fields to update ex "note,userEnteredFormat"
|
|
2858
|
-
fields: keys(pickBy({
|
|
483
|
+
fields: compat.keys(compat.pickBy({
|
|
2859
484
|
userEnteredValue: isValueUpdated,
|
|
2860
485
|
note: isNoteUpdated,
|
|
2861
486
|
userEnteredFormat: isFormatUpdated || isFormatCleared
|
|
@@ -2920,17 +545,17 @@ var GoogleSpreadsheetWorksheet = class {
|
|
|
2920
545
|
this._cells = [];
|
|
2921
546
|
}
|
|
2922
547
|
_fillCellData(dataRanges) {
|
|
2923
|
-
|
|
2924
|
-
const startRow =
|
|
2925
|
-
const startColumn =
|
|
2926
|
-
const numRows =
|
|
2927
|
-
const numColumns =
|
|
548
|
+
compat.each(dataRanges, (range) => {
|
|
549
|
+
const startRow = range.startRow || 0;
|
|
550
|
+
const startColumn = range.startColumn || 0;
|
|
551
|
+
const numRows = range.rowMetadata.length;
|
|
552
|
+
const numColumns = range.columnMetadata.length;
|
|
2928
553
|
for (let i = 0; i < numRows; i++) {
|
|
2929
554
|
const actualRow = startRow + i;
|
|
2930
555
|
for (let j = 0; j < numColumns; j++) {
|
|
2931
556
|
const actualColumn = startColumn + j;
|
|
2932
557
|
if (!this._cells[actualRow]) this._cells[actualRow] = [];
|
|
2933
|
-
const cellData = get(
|
|
558
|
+
const cellData = compat.get(range, `rowData[${i}].values[${j}]`);
|
|
2934
559
|
if (this._cells[actualRow][actualColumn]) {
|
|
2935
560
|
this._cells[actualRow][actualColumn]._updateRawData(cellData);
|
|
2936
561
|
} else {
|
|
@@ -2943,21 +568,21 @@ var GoogleSpreadsheetWorksheet = class {
|
|
|
2943
568
|
}
|
|
2944
569
|
}
|
|
2945
570
|
}
|
|
2946
|
-
for (let i = 0; i <
|
|
2947
|
-
this._rowMetadata[startRow + i] =
|
|
571
|
+
for (let i = 0; i < range.rowMetadata.length; i++) {
|
|
572
|
+
this._rowMetadata[startRow + i] = range.rowMetadata[i];
|
|
2948
573
|
}
|
|
2949
|
-
for (let i = 0; i <
|
|
2950
|
-
this._columnMetadata[startColumn + i] =
|
|
574
|
+
for (let i = 0; i < range.columnMetadata.length; i++) {
|
|
575
|
+
this._columnMetadata[startColumn + i] = range.columnMetadata[i];
|
|
2951
576
|
}
|
|
2952
577
|
});
|
|
2953
578
|
}
|
|
2954
579
|
// TODO: make this handle A1 ranges as well?
|
|
2955
|
-
_addSheetIdToRange(
|
|
2956
|
-
if (
|
|
580
|
+
_addSheetIdToRange(range) {
|
|
581
|
+
if (range.sheetId && range.sheetId !== this.sheetId) {
|
|
2957
582
|
throw new Error("Leave sheet ID blank or set to matching ID of this sheet");
|
|
2958
583
|
}
|
|
2959
584
|
return {
|
|
2960
|
-
...
|
|
585
|
+
...range,
|
|
2961
586
|
sheetId: this.sheetId
|
|
2962
587
|
};
|
|
2963
588
|
}
|
|
@@ -3040,10 +665,10 @@ var GoogleSpreadsheetWorksheet = class {
|
|
|
3040
665
|
}
|
|
3041
666
|
// CELLS-BASED INTERACTIONS //////////////////////////////////////////////////////////////////////
|
|
3042
667
|
get cellStats() {
|
|
3043
|
-
let allCells =
|
|
3044
|
-
allCells =
|
|
668
|
+
let allCells = compat.flatten(this._cells);
|
|
669
|
+
allCells = compat.compact(allCells);
|
|
3045
670
|
return {
|
|
3046
|
-
nonEmpty: filter(allCells, (c) => c.value).length,
|
|
671
|
+
nonEmpty: compat.filter(allCells, (c) => c.value).length,
|
|
3047
672
|
loaded: allCells.length,
|
|
3048
673
|
total: this.rowCount * this.columnCount
|
|
3049
674
|
};
|
|
@@ -3060,20 +685,20 @@ var GoogleSpreadsheetWorksheet = class {
|
|
|
3060
685
|
if (rowIndex >= this.rowCount || columnIndex >= this.columnCount) {
|
|
3061
686
|
throw new Error(`Out of bounds, sheet is ${this.rowCount} by ${this.columnCount}`);
|
|
3062
687
|
}
|
|
3063
|
-
if (!get(this._cells, `[${rowIndex}][${columnIndex}]`)) {
|
|
688
|
+
if (!compat.get(this._cells, `[${rowIndex}][${columnIndex}]`)) {
|
|
3064
689
|
throw new Error("This cell has not been loaded yet");
|
|
3065
690
|
}
|
|
3066
691
|
return this._cells[rowIndex][columnIndex];
|
|
3067
692
|
}
|
|
3068
693
|
async loadCells(sheetFilters) {
|
|
3069
694
|
if (!sheetFilters) return this._spreadsheet.loadCells(this.a1SheetName);
|
|
3070
|
-
const filtersArray = isArray(sheetFilters) ? sheetFilters : [sheetFilters];
|
|
3071
|
-
const filtersArrayWithSheetId = map(filtersArray, (filter2) => {
|
|
3072
|
-
if (isString(filter2)) {
|
|
695
|
+
const filtersArray = compat.isArray(sheetFilters) ? sheetFilters : [sheetFilters];
|
|
696
|
+
const filtersArrayWithSheetId = compat.map(filtersArray, (filter2) => {
|
|
697
|
+
if (compat.isString(filter2)) {
|
|
3073
698
|
if (filter2.startsWith(this.a1SheetName)) return filter2;
|
|
3074
699
|
return `${this.a1SheetName}!${filter2}`;
|
|
3075
700
|
}
|
|
3076
|
-
if (
|
|
701
|
+
if (compat.isObject(filter2)) {
|
|
3077
702
|
const filterAny = filter2;
|
|
3078
703
|
if (filterAny.sheetId && filterAny.sheetId !== this.sheetId) {
|
|
3079
704
|
throw new Error("Leave sheet ID blank or set to matching ID of this sheet");
|
|
@@ -3085,15 +710,15 @@ var GoogleSpreadsheetWorksheet = class {
|
|
|
3085
710
|
return this._spreadsheet.loadCells(filtersArrayWithSheetId);
|
|
3086
711
|
}
|
|
3087
712
|
async saveUpdatedCells() {
|
|
3088
|
-
const cellsToSave = filter(
|
|
713
|
+
const cellsToSave = compat.filter(compat.flatten(this._cells), { _isDirty: true });
|
|
3089
714
|
if (cellsToSave.length) {
|
|
3090
715
|
await this.saveCells(cellsToSave);
|
|
3091
716
|
}
|
|
3092
717
|
}
|
|
3093
718
|
async saveCells(cellsToUpdate) {
|
|
3094
|
-
const requests = map(cellsToUpdate, (cell) => cell._getUpdateRequest());
|
|
3095
|
-
const responseRanges = map(cellsToUpdate, (c) => `${this.a1SheetName}!${c.a1Address}`);
|
|
3096
|
-
if (!
|
|
719
|
+
const requests = compat.map(cellsToUpdate, (cell) => cell._getUpdateRequest());
|
|
720
|
+
const responseRanges = compat.map(cellsToUpdate, (c) => `${this.a1SheetName}!${c.a1Address}`);
|
|
721
|
+
if (!compat.compact(requests).length) {
|
|
3097
722
|
throw new Error("At least one cell must have something to update");
|
|
3098
723
|
}
|
|
3099
724
|
await this._spreadsheet._makeBatchUpdateRequest(requests, responseRanges);
|
|
@@ -3168,8 +793,8 @@ var GoogleSpreadsheetWorksheet = class {
|
|
|
3168
793
|
if (!rows) {
|
|
3169
794
|
throw new Error("No values in the header row - fill the first row with header values before trying to interact with rows");
|
|
3170
795
|
}
|
|
3171
|
-
this._headerValues = map(rows[0], (header) => header?.trim());
|
|
3172
|
-
if (!
|
|
796
|
+
this._headerValues = compat.map(rows[0], (header) => header?.trim());
|
|
797
|
+
if (!compat.compact(this.headerValues).length) {
|
|
3173
798
|
throw new Error("All your header cells are blank - fill the first row with header values before trying to interact with rows");
|
|
3174
799
|
}
|
|
3175
800
|
checkForDuplicateHeaders(this.headerValues);
|
|
@@ -3179,9 +804,9 @@ var GoogleSpreadsheetWorksheet = class {
|
|
|
3179
804
|
if (headerValues.length > this.columnCount) {
|
|
3180
805
|
throw new Error(`Sheet is not large enough to fit ${headerValues.length} columns. Resize the sheet first.`);
|
|
3181
806
|
}
|
|
3182
|
-
const trimmedHeaderValues = map(headerValues, (h) => h?.trim());
|
|
807
|
+
const trimmedHeaderValues = compat.map(headerValues, (h) => h?.trim());
|
|
3183
808
|
checkForDuplicateHeaders(trimmedHeaderValues);
|
|
3184
|
-
if (!
|
|
809
|
+
if (!compat.compact(trimmedHeaderValues).length) {
|
|
3185
810
|
throw new Error("All your header cells are blank -");
|
|
3186
811
|
}
|
|
3187
812
|
if (headerRowIndex) this._headerRowIndex = headerRowIndex;
|
|
@@ -3199,7 +824,7 @@ var GoogleSpreadsheetWorksheet = class {
|
|
|
3199
824
|
values: [[
|
|
3200
825
|
...trimmedHeaderValues,
|
|
3201
826
|
// pad the rest of the row with empty values to clear them all out
|
|
3202
|
-
...times(this.columnCount - trimmedHeaderValues.length, () => "")
|
|
827
|
+
...compat.times(this.columnCount - trimmedHeaderValues.length, () => "")
|
|
3203
828
|
]]
|
|
3204
829
|
}
|
|
3205
830
|
}
|
|
@@ -3212,14 +837,14 @@ var GoogleSpreadsheetWorksheet = class {
|
|
|
3212
837
|
if (this.title.includes(":")) {
|
|
3213
838
|
throw new Error('Please remove the ":" from your sheet title. There is a bug with the google API which breaks appending rows if any colons are in the sheet title.');
|
|
3214
839
|
}
|
|
3215
|
-
if (!isArray(rows)) throw new Error("You must pass in an array of row values to append");
|
|
840
|
+
if (!compat.isArray(rows)) throw new Error("You must pass in an array of row values to append");
|
|
3216
841
|
await this._ensureHeaderRowLoaded();
|
|
3217
842
|
const rowsAsArrays = [];
|
|
3218
|
-
|
|
843
|
+
compat.each(rows, (row) => {
|
|
3219
844
|
let rowAsArray;
|
|
3220
|
-
if (isArray(row)) {
|
|
845
|
+
if (compat.isArray(row)) {
|
|
3221
846
|
rowAsArray = row;
|
|
3222
|
-
} else if (
|
|
847
|
+
} else if (compat.isObject(row)) {
|
|
3223
848
|
rowAsArray = [];
|
|
3224
849
|
for (let i = 0; i < this.headerValues.length; i++) {
|
|
3225
850
|
const propName = this.headerValues[i];
|
|
@@ -3253,7 +878,7 @@ var GoogleSpreadsheetWorksheet = class {
|
|
|
3253
878
|
} else if (rowNumber + rows.length > this.rowCount) {
|
|
3254
879
|
this._rawProperties.gridProperties.rowCount = rowNumber + rows.length - 1;
|
|
3255
880
|
}
|
|
3256
|
-
return map(data.updates.updatedData.values, (rowValues) => {
|
|
881
|
+
return compat.map(data.updates.updatedData.values, (rowValues) => {
|
|
3257
882
|
const row = new GoogleSpreadsheetRow(this, rowNumber++, rowValues);
|
|
3258
883
|
return row;
|
|
3259
884
|
});
|
|
@@ -3387,19 +1012,19 @@ var GoogleSpreadsheetWorksheet = class {
|
|
|
3387
1012
|
* Merges all cells in the range
|
|
3388
1013
|
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#MergeCellsRequest
|
|
3389
1014
|
*/
|
|
3390
|
-
async mergeCells(
|
|
1015
|
+
async mergeCells(range, mergeType = "MERGE_ALL") {
|
|
3391
1016
|
await this._makeSingleUpdateRequest("mergeCells", {
|
|
3392
1017
|
mergeType,
|
|
3393
|
-
range: this._addSheetIdToRange(
|
|
1018
|
+
range: this._addSheetIdToRange(range)
|
|
3394
1019
|
});
|
|
3395
1020
|
}
|
|
3396
1021
|
/**
|
|
3397
1022
|
* Unmerges cells in the given range
|
|
3398
1023
|
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#UnmergeCellsRequest
|
|
3399
1024
|
*/
|
|
3400
|
-
async unmergeCells(
|
|
1025
|
+
async unmergeCells(range) {
|
|
3401
1026
|
await this._makeSingleUpdateRequest("unmergeCells", {
|
|
3402
|
-
range: this._addSheetIdToRange(
|
|
1027
|
+
range: this._addSheetIdToRange(range)
|
|
3403
1028
|
});
|
|
3404
1029
|
}
|
|
3405
1030
|
async updateBorders() {
|
|
@@ -3440,9 +1065,9 @@ var GoogleSpreadsheetWorksheet = class {
|
|
|
3440
1065
|
*/
|
|
3441
1066
|
async insertDimension(columnsOrRows, rangeIndexes, inheritFromBefore) {
|
|
3442
1067
|
if (!columnsOrRows) throw new Error("You need to specify a dimension. i.e. COLUMNS|ROWS");
|
|
3443
|
-
if (!
|
|
3444
|
-
if (!isInteger(rangeIndexes.startIndex) || rangeIndexes.startIndex < 0) throw new Error("range.startIndex must be an integer >=0");
|
|
3445
|
-
if (!isInteger(rangeIndexes.endIndex) || rangeIndexes.endIndex < 0) throw new Error("range.endIndex must be an integer >=0");
|
|
1068
|
+
if (!compat.isObject(rangeIndexes)) throw new Error("`range` must be an object containing `startIndex` and `endIndex`");
|
|
1069
|
+
if (!compat.isInteger(rangeIndexes.startIndex) || rangeIndexes.startIndex < 0) throw new Error("range.startIndex must be an integer >=0");
|
|
1070
|
+
if (!compat.isInteger(rangeIndexes.endIndex) || rangeIndexes.endIndex < 0) throw new Error("range.endIndex must be an integer >=0");
|
|
3446
1071
|
if (rangeIndexes.endIndex <= rangeIndexes.startIndex) throw new Error("range.endIndex must be greater than range.startIndex");
|
|
3447
1072
|
if (inheritFromBefore === void 0) {
|
|
3448
1073
|
inheritFromBefore = rangeIndexes.startIndex > 0;
|
|
@@ -3488,11 +1113,11 @@ var GoogleSpreadsheetWorksheet = class {
|
|
|
3488
1113
|
* Sets (or unsets) a data validation rule to every cell in the range
|
|
3489
1114
|
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#SetDataValidationRequest
|
|
3490
1115
|
*/
|
|
3491
|
-
async setDataValidation(
|
|
1116
|
+
async setDataValidation(range, rule) {
|
|
3492
1117
|
return this._makeSingleUpdateRequest("setDataValidation", {
|
|
3493
1118
|
range: {
|
|
3494
1119
|
sheetId: this.sheetId,
|
|
3495
|
-
...
|
|
1120
|
+
...range
|
|
3496
1121
|
},
|
|
3497
1122
|
...rule && { rule }
|
|
3498
1123
|
});
|
|
@@ -3558,8 +1183,8 @@ var GoogleSpreadsheetWorksheet = class {
|
|
|
3558
1183
|
}
|
|
3559
1184
|
/** clear data in the sheet - either the entire sheet or a specific range */
|
|
3560
1185
|
async clear(a1Range) {
|
|
3561
|
-
const
|
|
3562
|
-
await this._spreadsheet.sheetsApi.post(`values/${this.encodedA1SheetName}${
|
|
1186
|
+
const range = a1Range ? `!${a1Range}` : "";
|
|
1187
|
+
await this._spreadsheet.sheetsApi.post(`values/${this.encodedA1SheetName}${range}:clear`);
|
|
3563
1188
|
this.resetLocalCache(true);
|
|
3564
1189
|
}
|
|
3565
1190
|
async downloadAsCSV(returnStreamInsteadOfBuffer = false) {
|
|
@@ -3595,7 +1220,13 @@ __name(getAuthMode, "getAuthMode");
|
|
|
3595
1220
|
async function getRequestAuthConfig(auth) {
|
|
3596
1221
|
if ("getRequestHeaders" in auth) {
|
|
3597
1222
|
const headers = await auth.getRequestHeaders();
|
|
3598
|
-
|
|
1223
|
+
if ("entries" in headers) {
|
|
1224
|
+
return { headers: Object.fromEntries(headers.entries()) };
|
|
1225
|
+
}
|
|
1226
|
+
if (compat.isObject(headers)) {
|
|
1227
|
+
return { headers };
|
|
1228
|
+
}
|
|
1229
|
+
throw new Error("unexpected headers returned from getRequestHeaders");
|
|
3599
1230
|
}
|
|
3600
1231
|
if ("apiKey" in auth && auth.apiKey) {
|
|
3601
1232
|
return { searchParams: { key: auth.apiKey } };
|
|
@@ -3643,14 +1274,14 @@ var GoogleSpreadsheet = class _GoogleSpreadsheet {
|
|
|
3643
1274
|
this.auth = auth;
|
|
3644
1275
|
this._rawSheets = {};
|
|
3645
1276
|
this._spreadsheetUrl = null;
|
|
3646
|
-
this.sheetsApi =
|
|
1277
|
+
this.sheetsApi = ky__default.default.create({
|
|
3647
1278
|
prefixUrl: `${SHEETS_API_BASE_URL}/${spreadsheetId}`,
|
|
3648
1279
|
hooks: {
|
|
3649
1280
|
beforeRequest: [(r) => this._setAuthRequestHook(r)],
|
|
3650
1281
|
beforeError: [(e) => this._errorHook(e)]
|
|
3651
1282
|
}
|
|
3652
1283
|
});
|
|
3653
|
-
this.driveApi =
|
|
1284
|
+
this.driveApi = ky__default.default.create({
|
|
3654
1285
|
prefixUrl: `${DRIVE_API_BASE_URL}/${spreadsheetId}`,
|
|
3655
1286
|
hooks: {
|
|
3656
1287
|
beforeRequest: [(r) => this._setAuthRequestHook(r)],
|
|
@@ -3663,8 +1294,7 @@ var GoogleSpreadsheet = class _GoogleSpreadsheet {
|
|
|
3663
1294
|
async _setAuthRequestHook(req) {
|
|
3664
1295
|
const authConfig = await getRequestAuthConfig(this.auth);
|
|
3665
1296
|
if (authConfig.headers) {
|
|
3666
|
-
|
|
3667
|
-
Object.entries(headers).forEach(([key, val]) => {
|
|
1297
|
+
Object.entries(authConfig.headers).forEach(([key, val]) => {
|
|
3668
1298
|
req.headers.set(key, String(val));
|
|
3669
1299
|
});
|
|
3670
1300
|
}
|
|
@@ -3692,7 +1322,7 @@ var GoogleSpreadsheet = class _GoogleSpreadsheet {
|
|
|
3692
1322
|
error.message = `Google API error - [${code}] ${message}`;
|
|
3693
1323
|
return error;
|
|
3694
1324
|
}
|
|
3695
|
-
if (get(error, "response.status") === 403) {
|
|
1325
|
+
if (compat.get(error, "response.status") === 403) {
|
|
3696
1326
|
if ("apiKey" in this.auth) {
|
|
3697
1327
|
throw new Error("Sheet is private. Use authentication or make public. (see https://github.com/theoephraim/node-google-spreadsheet#a-note-on-authentication for details)");
|
|
3698
1328
|
}
|
|
@@ -3711,7 +1341,7 @@ var GoogleSpreadsheet = class _GoogleSpreadsheet {
|
|
|
3711
1341
|
});
|
|
3712
1342
|
const data = await response.json();
|
|
3713
1343
|
this._updateRawProperties(data.updatedSpreadsheet.properties);
|
|
3714
|
-
|
|
1344
|
+
compat.each(data.updatedSpreadsheet.sheets, (s) => this._updateOrCreateSheet(s));
|
|
3715
1345
|
return data.replies[0][requestType];
|
|
3716
1346
|
}
|
|
3717
1347
|
// TODO: review these types
|
|
@@ -3730,7 +1360,7 @@ var GoogleSpreadsheet = class _GoogleSpreadsheet {
|
|
|
3730
1360
|
});
|
|
3731
1361
|
const data = await response.json();
|
|
3732
1362
|
this._updateRawProperties(data.updatedSpreadsheet.properties);
|
|
3733
|
-
|
|
1363
|
+
compat.each(data.updatedSpreadsheet.sheets, (s) => this._updateOrCreateSheet(s));
|
|
3734
1364
|
}
|
|
3735
1365
|
/** @internal */
|
|
3736
1366
|
_ensureInfoLoaded() {
|
|
@@ -3805,7 +1435,7 @@ var GoogleSpreadsheet = class _GoogleSpreadsheet {
|
|
|
3805
1435
|
// WORKSHEETS ////////////////////////////////////////////////////////////////////////////////////
|
|
3806
1436
|
get sheetCount() {
|
|
3807
1437
|
this._ensureInfoLoaded();
|
|
3808
|
-
return values(this._rawSheets).length;
|
|
1438
|
+
return compat.values(this._rawSheets).length;
|
|
3809
1439
|
}
|
|
3810
1440
|
get sheetsById() {
|
|
3811
1441
|
this._ensureInfoLoaded();
|
|
@@ -3813,11 +1443,11 @@ var GoogleSpreadsheet = class _GoogleSpreadsheet {
|
|
|
3813
1443
|
}
|
|
3814
1444
|
get sheetsByIndex() {
|
|
3815
1445
|
this._ensureInfoLoaded();
|
|
3816
|
-
return sortBy(this._rawSheets, "index");
|
|
1446
|
+
return compat.sortBy(this._rawSheets, "index");
|
|
3817
1447
|
}
|
|
3818
1448
|
get sheetsByTitle() {
|
|
3819
1449
|
this._ensureInfoLoaded();
|
|
3820
|
-
return keyBy(this._rawSheets, "title");
|
|
1450
|
+
return compat.keyBy(this._rawSheets, "title");
|
|
3821
1451
|
}
|
|
3822
1452
|
/**
|
|
3823
1453
|
* Add new worksheet to document
|
|
@@ -3825,7 +1455,7 @@ var GoogleSpreadsheet = class _GoogleSpreadsheet {
|
|
|
3825
1455
|
* */
|
|
3826
1456
|
async addSheet(properties = {}) {
|
|
3827
1457
|
const response = await this._makeSingleUpdateRequest("addSheet", {
|
|
3828
|
-
properties: omit(properties, "headerValues", "headerRowIndex")
|
|
1458
|
+
properties: compat.omit(properties, "headerValues", "headerRowIndex")
|
|
3829
1459
|
});
|
|
3830
1460
|
const newSheetId = response.properties.sheetId;
|
|
3831
1461
|
const newSheet = this.sheetsById[newSheetId];
|
|
@@ -3847,11 +1477,11 @@ var GoogleSpreadsheet = class _GoogleSpreadsheet {
|
|
|
3847
1477
|
* create a new named range
|
|
3848
1478
|
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AddNamedRangeRequest
|
|
3849
1479
|
*/
|
|
3850
|
-
async addNamedRange(name,
|
|
1480
|
+
async addNamedRange(name, range, namedRangeId) {
|
|
3851
1481
|
return this._makeSingleUpdateRequest("addNamedRange", {
|
|
3852
1482
|
name,
|
|
3853
1483
|
namedRangeId,
|
|
3854
|
-
range
|
|
1484
|
+
range
|
|
3855
1485
|
});
|
|
3856
1486
|
}
|
|
3857
1487
|
/**
|
|
@@ -3865,12 +1495,12 @@ var GoogleSpreadsheet = class _GoogleSpreadsheet {
|
|
|
3865
1495
|
/** fetch cell data into local cache */
|
|
3866
1496
|
async loadCells(filters) {
|
|
3867
1497
|
const readOnlyMode = this.authMode === "api_key" /* API_KEY */;
|
|
3868
|
-
const filtersArray = isArray(filters) ? filters : [filters];
|
|
3869
|
-
const dataFilters = map(filtersArray, (filter2) => {
|
|
3870
|
-
if (isString(filter2)) {
|
|
1498
|
+
const filtersArray = compat.isArray(filters) ? filters : [filters];
|
|
1499
|
+
const dataFilters = compat.map(filtersArray, (filter2) => {
|
|
1500
|
+
if (compat.isString(filter2)) {
|
|
3871
1501
|
return readOnlyMode ? filter2 : { a1Range: filter2 };
|
|
3872
1502
|
}
|
|
3873
|
-
if (
|
|
1503
|
+
if (compat.isObject(filter2)) {
|
|
3874
1504
|
if (readOnlyMode) {
|
|
3875
1505
|
throw new Error("Only A1 ranges are supported when fetching cells with read-only access (using only an API key)");
|
|
3876
1506
|
}
|
|
@@ -3883,7 +1513,7 @@ var GoogleSpreadsheet = class _GoogleSpreadsheet {
|
|
|
3883
1513
|
const params = new URLSearchParams();
|
|
3884
1514
|
params.append("includeGridData", "true");
|
|
3885
1515
|
dataFilters.forEach((singleFilter) => {
|
|
3886
|
-
if (!isString(singleFilter)) {
|
|
1516
|
+
if (!compat.isString(singleFilter)) {
|
|
3887
1517
|
throw new Error("Only A1 ranges are supported when fetching cells with read-only access (using only an API key)");
|
|
3888
1518
|
}
|
|
3889
1519
|
params.append("ranges", singleFilter);
|
|
@@ -3900,7 +1530,7 @@ var GoogleSpreadsheet = class _GoogleSpreadsheet {
|
|
|
3900
1530
|
});
|
|
3901
1531
|
}
|
|
3902
1532
|
const data = await result?.json();
|
|
3903
|
-
|
|
1533
|
+
compat.each(data.sheets, (sheet) => {
|
|
3904
1534
|
this._updateOrCreateSheet(sheet);
|
|
3905
1535
|
});
|
|
3906
1536
|
}
|
|
@@ -3967,7 +1597,7 @@ var GoogleSpreadsheet = class _GoogleSpreadsheet {
|
|
|
3967
1597
|
}
|
|
3968
1598
|
async setPublicAccessLevel(role) {
|
|
3969
1599
|
const permissions = await this.listPermissions();
|
|
3970
|
-
const existingPublicPermission = find(permissions, (p) => p.type === "anyone");
|
|
1600
|
+
const existingPublicPermission = compat.find(permissions, (p) => p.type === "anyone");
|
|
3971
1601
|
if (role === false) {
|
|
3972
1602
|
if (!existingPublicPermission) {
|
|
3973
1603
|
return;
|
|
@@ -3994,7 +1624,7 @@ var GoogleSpreadsheet = class _GoogleSpreadsheet {
|
|
|
3994
1624
|
const shareReq = await this.driveApi.post("permissions", {
|
|
3995
1625
|
searchParams: {
|
|
3996
1626
|
...opts?.emailMessage === false && { sendNotificationEmail: false },
|
|
3997
|
-
...isString(opts?.emailMessage) && { emailMessage: opts?.emailMessage },
|
|
1627
|
+
...compat.isString(opts?.emailMessage) && { emailMessage: opts?.emailMessage },
|
|
3998
1628
|
...opts?.role === "owner" && { transferOwnership: true }
|
|
3999
1629
|
},
|
|
4000
1630
|
json: {
|
|
@@ -4018,7 +1648,7 @@ var GoogleSpreadsheet = class _GoogleSpreadsheet {
|
|
|
4018
1648
|
throw new Error("Cannot use api key only to create a new spreadsheet - it is only usable for read-only access of public docs");
|
|
4019
1649
|
}
|
|
4020
1650
|
const authConfig = await getRequestAuthConfig(auth);
|
|
4021
|
-
const response = await
|
|
1651
|
+
const response = await ky__default.default.post(SHEETS_API_BASE_URL, {
|
|
4022
1652
|
...authConfig,
|
|
4023
1653
|
// has the auth header
|
|
4024
1654
|
json: {
|
|
@@ -4029,15 +1659,10 @@ var GoogleSpreadsheet = class _GoogleSpreadsheet {
|
|
|
4029
1659
|
const newSpreadsheet = new _GoogleSpreadsheet(data.spreadsheetId, auth);
|
|
4030
1660
|
newSpreadsheet._spreadsheetUrl = data.spreadsheetUrl;
|
|
4031
1661
|
newSpreadsheet._rawProperties = data.properties;
|
|
4032
|
-
|
|
1662
|
+
compat.each(data.sheets, (s) => newSpreadsheet._updateOrCreateSheet(s));
|
|
4033
1663
|
return newSpreadsheet;
|
|
4034
1664
|
}
|
|
4035
1665
|
};
|
|
4036
|
-
/*! Bundled license information:
|
|
4037
|
-
|
|
4038
|
-
ky/distribution/index.js:
|
|
4039
|
-
(*! MIT License © Sindre Sorhus *)
|
|
4040
|
-
*/
|
|
4041
1666
|
|
|
4042
1667
|
exports.GoogleSpreadsheet = GoogleSpreadsheet;
|
|
4043
1668
|
exports.GoogleSpreadsheetCell = GoogleSpreadsheetCell;
|