@mherod/get-cookie 2.0.0-beta.8 → 2.0.0-beta.9

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.js CHANGED
@@ -1,3 +1,563 @@
1
1
  #!/usr/bin/env node
2
- var r=require("lodash"),e=(require("fs"),require("crypto"),require("path"));require("child_process"),require("sqlite3"),require("jsonwebtoken"),require("cross-fetch"),require("destr");var i=r.merge;const o={};i(o,process.env);const s=o.HOME;if(!s)throw new Error("HOME environment variable is not set");e.join(s,"Library","Application Support","Google","Chrome");
2
+ var $7oI3p$lodash = require("lodash");
3
+ var $7oI3p$fs = require("fs");
4
+ var $7oI3p$crypto = require("crypto");
5
+ var $7oI3p$path = require("path");
6
+ var $7oI3p$child_process = require("child_process");
7
+ var $7oI3p$sqlite3 = require("sqlite3");
8
+ var $7oI3p$jsonwebtoken = require("jsonwebtoken");
9
+ var $7oI3p$crossfetch = require("cross-fetch");
10
+ var $7oI3p$destr = require("destr");
11
+
12
+ function $parcel$export(e, n, v, s) {
13
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
14
+ }
15
+ function $parcel$exportWildcard(dest, source) {
16
+ Object.keys(source).forEach(function(key) {
17
+ if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
18
+ return;
19
+ }
20
+
21
+ Object.defineProperty(dest, key, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return source[key];
25
+ }
26
+ });
27
+ });
28
+
29
+ return dest;
30
+ }
31
+ function $parcel$interopDefault(a) {
32
+ return a && a.__esModule ? a.default : a;
33
+ }
34
+
35
+ $parcel$export(module.exports, "getCookie", () => $cd1ba0160120c006$export$4be65e66cfa2648a);
36
+ $parcel$export(module.exports, "getFirefoxCookie", () => $cd1ba0160120c006$export$c44c5fdef43f0941);
37
+ $parcel$export(module.exports, "getChromeCookie", () => $cd1ba0160120c006$export$e5637297e9eb6f2e);
38
+ $parcel$export(module.exports, "getGroupedRenderedCookies", () => $300d8b33187a203c$export$4d2e9997e2c23417);
39
+ $parcel$export(module.exports, "fetchWithCookies", () => $cfc07ae4aa2c7e44$export$b24a545a0b39f491);
40
+
41
+ var $fac425c10fbbada5$require$merge = $7oI3p$lodash.merge;
42
+ const $fac425c10fbbada5$export$a7b6bc01c63cdfc3 = {};
43
+ $fac425c10fbbada5$require$merge($fac425c10fbbada5$export$a7b6bc01c63cdfc3, process.env);
44
+ const $fac425c10fbbada5$export$a7c5707626fc90f = $fac425c10fbbada5$export$a7b6bc01c63cdfc3["HOME"];
45
+ if (!$fac425c10fbbada5$export$a7c5707626fc90f) throw new Error("HOME environment variable is not set");
46
+
47
+
48
+
49
+
50
+ async function $25b78d6746d4ad48$export$8d71c74f97c0202e(command) {
51
+ return new Promise((resolve, reject)=>{
52
+ (0, $7oI3p$child_process.exec)(command, {
53
+ encoding: "binary",
54
+ maxBuffer: 5120
55
+ }, (error, stdout, stderr)=>{
56
+ if (error) {
57
+ reject(error);
58
+ return;
59
+ }
60
+ if (stderr) {
61
+ reject(error);
62
+ return;
63
+ }
64
+ if (stdout) resolve(stdout.trim());
65
+ });
66
+ });
67
+ }
68
+ function $25b78d6746d4ad48$export$d53bf2de587a369(result) {
69
+ if (result == null) return null;
70
+ if (process.env.VERBOSE) console.log("result", result);
71
+ if (typeof result === "string" && result.length > 0) return result;
72
+ if (result.slice && result.toString) // noinspection JSCheckFunctionSignatures
73
+ return result.toString("utf8");
74
+ return null;
75
+ }
76
+ function $25b78d6746d4ad48$export$99ce3e33a555daf1(input) {
77
+ return typeof input !== "string" || input.length === 0;
78
+ }
79
+ function $25b78d6746d4ad48$export$5348b46700dd771c(input) {
80
+ return typeof input == "string" && input.length > 0;
81
+ }
82
+
83
+
84
+
85
+
86
+
87
+
88
+ async function $e62c2c56eb720f29$export$2c9faf86071156ae({ path: path , name: name , maxDepth: maxDepth = 2 }) {
89
+ const rootSegments = path.split("/").length;
90
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) console.log(`Searching for ${name} in ${path}`);
91
+ const files = [];
92
+ let readdirSync;
93
+ try {
94
+ readdirSync = $7oI3p$fs.readdirSync(path);
95
+ } catch (e) {
96
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) console.log(`Error reading ${path}`, e);
97
+ return [];
98
+ }
99
+ for (const file of readdirSync){
100
+ const filePath = path + "/" + file;
101
+ let stat;
102
+ try {
103
+ stat = $7oI3p$fs.statSync(filePath);
104
+ } catch (e1) {
105
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) console.error(`Error getting stat for ${filePath}`, e1);
106
+ continue;
107
+ }
108
+ if (stat.isDirectory()) {
109
+ if (filePath.split("/").length < rootSegments + maxDepth) try {
110
+ const subFiles = await $e62c2c56eb720f29$export$2c9faf86071156ae({
111
+ path: filePath,
112
+ name: name,
113
+ maxDepth: 2
114
+ });
115
+ files.push(...subFiles);
116
+ } catch (e2) {
117
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) console.error(e2);
118
+ }
119
+ } else if (file === name) files.push(filePath);
120
+ }
121
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) {
122
+ if (files.length > 0) {
123
+ console.log(`Found ${files.length} ${name} files`);
124
+ console.log(files);
125
+ }
126
+ }
127
+ return files;
128
+ }
129
+
130
+
131
+
132
+
133
+
134
+
135
+ async function $a085b524d8ee9fce$export$f19f611d1fa7c6f3(file, sql) {
136
+ if (!$7oI3p$fs.existsSync(file)) throw new Error(`doSqliteQuery1: file ${file} does not exist`);
137
+ const db = new $7oI3p$sqlite3.Database(file);
138
+ return new Promise((resolve, reject)=>{
139
+ db.all(sql, (err, rows)=>{
140
+ if (err) {
141
+ reject(err);
142
+ return;
143
+ }
144
+ const rows1 = rows;
145
+ if (rows1 == null || rows1.length === 0) {
146
+ resolve([]);
147
+ return;
148
+ }
149
+ if (Array.isArray(rows1)) {
150
+ const cookieRows = rows1.map((row)=>{
151
+ return {
152
+ domain: row["host_key"],
153
+ name: row["name"],
154
+ value: row["encrypted_value"],
155
+ meta: {
156
+ file: file
157
+ }
158
+ };
159
+ });
160
+ resolve(cookieRows);
161
+ return;
162
+ }
163
+ if (process.env.VERBOSE) console.log(`doSqliteQuery1: rows ${JSON.stringify(rows1)}`);
164
+ resolve([
165
+ rows1
166
+ ]);
167
+ });
168
+ });
169
+ }
170
+
171
+
172
+
173
+ function $af69dfb8766652d8$export$bc926c43858bd3cb(obj) {
174
+ return obj.domain !== undefined && obj.name !== undefined && obj.value !== undefined;
175
+ }
176
+
177
+
178
+ function $d66f40b581ba8bfa$export$963c8d651337e4a4(obj) {
179
+ return obj.domain !== undefined && obj.name !== undefined && obj.value !== undefined;
180
+ }
181
+
182
+
183
+ class $269fe42bfd555305$export$2e2bcd8739ae039 {
184
+ async queryCookies(name, domain) {
185
+ if (process.platform !== "darwin") throw new Error("This only works on macOS");
186
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).FIREFOX_ONLY) return [];
187
+ return $269fe42bfd555305$var$getChromeCookies({
188
+ requireJwt: false,
189
+ name: name,
190
+ domain: domain
191
+ });
192
+ }
193
+ }
194
+ async function $269fe42bfd555305$var$getPromise1(name, domain, file) {
195
+ try {
196
+ return await $269fe42bfd555305$var$getEncryptedChromeCookie({
197
+ name: name,
198
+ domain: domain,
199
+ file: file
200
+ });
201
+ } catch (e) {
202
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) console.log("Error getting encrypted cookie", e);
203
+ return [];
204
+ }
205
+ }
206
+ async function $269fe42bfd555305$var$getPromise(name, domain) {
207
+ try {
208
+ const files = await (0, $e62c2c56eb720f29$export$2c9faf86071156ae)({
209
+ path: $269fe42bfd555305$var$chromeLocal,
210
+ name: "Cookies"
211
+ });
212
+ const promises = files.map((file)=>$269fe42bfd555305$var$getPromise1(name, domain, file));
213
+ const results1 = await Promise.all(promises);
214
+ return results1.flat().filter((0, $af69dfb8766652d8$export$bc926c43858bd3cb));
215
+ } catch (error) {
216
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) console.log("error", error);
217
+ return [];
218
+ }
219
+ }
220
+ async function $269fe42bfd555305$var$decryptValue(password, encryptedValue) {
221
+ let d;
222
+ try {
223
+ d = await $269fe42bfd555305$var$decrypt(password, encryptedValue);
224
+ } catch (e) {
225
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) console.log("Error decrypting cookie", e);
226
+ d = null;
227
+ }
228
+ return d ?? encryptedValue.toString("utf-8");
229
+ }
230
+ async function $269fe42bfd555305$var$getChromeCookies({ name: name , domain: domain = "%" , requireJwt: requireJwt = false }) {
231
+ const encryptedDataItems = await $269fe42bfd555305$var$getPromise(name, domain);
232
+ const password = await $269fe42bfd555305$var$getChromePassword();
233
+ const decrypted = encryptedDataItems.filter(({ value: value })=>value != null && value.length > 0).map(async (cookieRow)=>{
234
+ const encryptedValue = cookieRow.value;
235
+ const decryptedValue = await $269fe42bfd555305$var$decryptValue(password, encryptedValue);
236
+ const meta = {};
237
+ (0, $7oI3p$lodash.merge)(meta, cookieRow.meta ?? {});
238
+ return {
239
+ domain: cookieRow.domain,
240
+ name: cookieRow.name,
241
+ value: decryptedValue,
242
+ meta: meta
243
+ };
244
+ });
245
+ const results = (await Promise.all(decrypted)).filter((0, $d66f40b581ba8bfa$export$963c8d651337e4a4));
246
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) console.log("results", results);
247
+ return results;
248
+ }
249
+ const $269fe42bfd555305$var$chromeLocal = $7oI3p$path.join((0, $fac425c10fbbada5$export$a7c5707626fc90f), "Library", "Application Support", "Google", "Chrome");
250
+ async function $269fe42bfd555305$var$getEncryptedChromeCookie({ name: name , domain: domain , file: file = $7oI3p$path.join($269fe42bfd555305$var$chromeLocal, "Default", "Cookies") }) {
251
+ if (!(0, $7oI3p$fs.existsSync)(file)) throw new Error(`File ${file} does not exist`);
252
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) {
253
+ const s = file.split("/").slice(-3).join("/");
254
+ console.log(`Trying Chrome (at ${s}) cookie ${name} for domain ${domain}`);
255
+ }
256
+ let sql;
257
+ sql = `SELECT encrypted_value, name, host_key FROM cookies`;
258
+ const wildcardRegexp = /^([*%])$/i;
259
+ const specifiedName = name.match(wildcardRegexp) == null;
260
+ const specifiedDomain = domain.match(wildcardRegexp) == null;
261
+ if (specifiedName || specifiedDomain) {
262
+ sql += ` WHERE `;
263
+ if (specifiedName) {
264
+ sql += `name = '${name}'`;
265
+ if (specifiedDomain) sql += ` AND `;
266
+ }
267
+ if (specifiedDomain) sql += `host_key LIKE '${domain}';`;
268
+ }
269
+ return (0, $a085b524d8ee9fce$export$f19f611d1fa7c6f3)(file, sql);
270
+ }
271
+ async function $269fe42bfd555305$var$getChromePassword() {
272
+ return (0, $25b78d6746d4ad48$export$8d71c74f97c0202e)('security find-generic-password -w -s "Chrome Safe Storage"');
273
+ }
274
+ async function $269fe42bfd555305$var$decrypt(password, encryptedData) {
275
+ if (typeof password !== "string") throw new Error("password must be a string: " + password);
276
+ let encryptedData1;
277
+ encryptedData1 = encryptedData;
278
+ if (encryptedData1 == null || typeof encryptedData1 !== "object") throw new Error("encryptedData must be a object: " + encryptedData1);
279
+ if (!(encryptedData1 instanceof Buffer)) {
280
+ if (Array.isArray(encryptedData1) && encryptedData1[0] instanceof Buffer) {
281
+ [encryptedData1] = encryptedData1;
282
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) console.log(`encryptedData is an array of buffers, selected first: ${encryptedData1}`);
283
+ } else throw new Error("encryptedData must be a Buffer: " + encryptedData1);
284
+ encryptedData1 = Buffer.from(encryptedData1);
285
+ }
286
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) console.log(`Trying to decrypt with password ${password}`);
287
+ return new Promise((resolve, reject)=>{
288
+ $7oI3p$crypto.pbkdf2(password, "saltysalt", 1003, 16, "sha1", (error, buffer)=>{
289
+ try {
290
+ if (error) {
291
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) console.log("Error doing pbkdf2", error);
292
+ reject(error);
293
+ return;
294
+ }
295
+ if (buffer.length !== 16) {
296
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) console.log("Error doing pbkdf2, buffer length is not 16", buffer.length);
297
+ reject(new Error("Buffer length is not 16"));
298
+ return;
299
+ }
300
+ const str = new Array(17).join(" ");
301
+ const iv = Buffer.from(str, "binary");
302
+ const decipher = $7oI3p$crypto.createDecipheriv("aes-128-cbc", buffer, iv);
303
+ decipher.setAutoPadding(false);
304
+ if (encryptedData1 && encryptedData1.slice) encryptedData1 = encryptedData1.slice(3);
305
+ if (encryptedData1.length % 16 !== 0) {
306
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) console.log("Error doing pbkdf2, encryptedData length is not a multiple of 16", encryptedData1.length);
307
+ reject(new Error("encryptedData length is not a multiple of 16"));
308
+ return;
309
+ }
310
+ let decoded = decipher.update(encryptedData1);
311
+ try {
312
+ decipher.final("utf-8");
313
+ } catch (e) {
314
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) console.log("Error doing decipher.final()", e);
315
+ reject(e);
316
+ return;
317
+ }
318
+ const padding = decoded[decoded.length - 1];
319
+ if (padding) decoded = decoded.slice(0, 0 - padding);
320
+ // noinspection JSCheckFunctionSignatures
321
+ const decodedString = decoded.toString("utf8");
322
+ resolve(decodedString);
323
+ } catch (e1) {
324
+ reject(e1);
325
+ }
326
+ });
327
+ });
328
+ }
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+
337
+ class $7bb7da9a77b2fd99$export$2e2bcd8739ae039 {
338
+ async queryCookies(name, domain) {
339
+ if (process.platform !== "darwin") throw new Error("This only works on macOS");
340
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).CHROME_ONLY) return [];
341
+ const cookies = await this.#getFirefoxCookie({
342
+ name: name,
343
+ domain: domain
344
+ });
345
+ return Array.isArray(cookies) ? cookies.map((0, $25b78d6746d4ad48$export$d53bf2de587a369)) : [];
346
+ }
347
+ /**
348
+ *
349
+ * @param name
350
+ * @param domain
351
+ * @returns {Promise<Buffer>}
352
+ */ async #getFirefoxCookie(//
353
+ { name: name , domain: domain }) {
354
+ const files = await (0, $e62c2c56eb720f29$export$2c9faf86071156ae)({
355
+ path: $7oI3p$path.join((0, $fac425c10fbbada5$export$a7c5707626fc90f), "Library", "Application Support", "Firefox", "Profiles"),
356
+ name: "cookies.sqlite"
357
+ });
358
+ const all = await Promise.all(files.map((file)=>{
359
+ return this.#queryCookiesDb(file, name, domain);
360
+ }));
361
+ return all.flat();
362
+ }
363
+ #queryCookiesDb(file, name1, domain1) {
364
+ if (file && !(0, $7oI3p$fs.existsSync)(file)) throw new Error(`File ${file} does not exist`);
365
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) console.log(`Trying Firefox cookie ${name1} for domain ${domain1}`);
366
+ let sql;
367
+ //language=SQL
368
+ sql = "SELECT value FROM moz_cookies";
369
+ if (typeof name1 === "string" || typeof domain1 === "string") {
370
+ sql += ` WHERE `;
371
+ if (typeof name1 === "string") {
372
+ sql += `name = '${name1}'`;
373
+ if (typeof domain1 === "string") sql += ` AND `;
374
+ }
375
+ if (typeof domain1 === "string") sql += `host LIKE '${domain1}';`;
376
+ }
377
+ return (0, $a085b524d8ee9fce$export$f19f611d1fa7c6f3)(file, sql).then((rows)=>{
378
+ return rows.map((row)=>{
379
+ return {
380
+ domain: row.domain,
381
+ name: row.name,
382
+ value: row.value.toString("utf8")
383
+ };
384
+ });
385
+ }).catch(()=>[]);
386
+ }
387
+ }
388
+
389
+
390
+ class $fad6f51bd5c7bae2$export$2e2bcd8739ae039 {
391
+ async queryCookies(name, domain) {
392
+ return [];
393
+ }
394
+ }
395
+
396
+
397
+ class $f72befa528c23ca7$export$2e2bcd8739ae039 {
398
+ #strategies;
399
+ constructor(){
400
+ this.#strategies = [
401
+ (0, $269fe42bfd555305$export$2e2bcd8739ae039),
402
+ (0, $7bb7da9a77b2fd99$export$2e2bcd8739ae039),
403
+ (0, $fad6f51bd5c7bae2$export$2e2bcd8739ae039),
404
+ ].map((strategy)=>{
405
+ return new strategy();
406
+ });
407
+ }
408
+ async queryCookies(name, domain) {
409
+ const results = await Promise.all(this.#strategies.map(async (strategy)=>{
410
+ // @ts-ignore
411
+ const cookies = strategy.queryCookies(name, domain);
412
+ return cookies.catch(()=>[]);
413
+ }));
414
+ return results.flat();
415
+ }
416
+ }
417
+
418
+
419
+
420
+
421
+ function $9a6b2ace073cf1d7$export$2e2bcd8739ae039(token) {
422
+ try {
423
+ const result = (0, ($parcel$interopDefault($7oI3p$jsonwebtoken))).decode(token, {
424
+ complete: true
425
+ });
426
+ if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).VERBOSE) console.log(result);
427
+ return true;
428
+ } catch (err) {
429
+ return false;
430
+ }
431
+ }
432
+
433
+
434
+ async function $7a068a32d4710f0b$export$e6d428437cf2cacb({ name: name , domain: domain }, strategy = new (0, $f72befa528c23ca7$export$2e2bcd8739ae039)()) {
435
+ const results = await strategy.queryCookies(name, domain);
436
+ const results1 = (0, $7oI3p$lodash.uniqBy)(results, JSON.stringify);
437
+ const jwtCookies = [];
438
+ for (const result of results1){
439
+ const value = result.value;
440
+ if ((0, $9a6b2ace073cf1d7$export$2e2bcd8739ae039)(value)) jwtCookies.push(result);
441
+ }
442
+ const resultsUniq = (0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).REQUIRE_JWT ? jwtCookies : results1;
443
+ return (0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).SINGLE ? [
444
+ resultsUniq[0]
445
+ ] : resultsUniq;
446
+ }
447
+
448
+
449
+
450
+
451
+
452
+
453
+
454
+
455
+
456
+ function $9c43c2ed82e63570$export$9abc0a414b0d8b8f(results) {
457
+ return (0, $7oI3p$lodash.uniqBy)(results, (r)=>r.name).map((r)=>r.name + "=" + r.value).join("; ");
458
+ }
459
+
460
+
461
+ async function $300d8b33187a203c$export$4d2e9997e2c23417(//
462
+ { name: name , domain: domain }) {
463
+ const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)({
464
+ name: name,
465
+ domain: domain
466
+ }, new (0, $f72befa528c23ca7$export$2e2bcd8739ae039)());
467
+ if (Array.isArray(cookies) && cookies.length > 0) {
468
+ const results = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)({
469
+ name: name,
470
+ domain: domain
471
+ });
472
+ const groupedByFile = (0, $7oI3p$lodash.groupBy)(results, (r)=>r.meta?.file);
473
+ return Object.keys(groupedByFile).map((file)=>{
474
+ const results = groupedByFile[file];
475
+ return (0, $9c43c2ed82e63570$export$9abc0a414b0d8b8f)(results);
476
+ });
477
+ } else throw new Error("Cookie not found");
478
+ }
479
+
480
+
481
+
482
+
483
+
484
+
485
+ async function $cfc07ae4aa2c7e44$export$b24a545a0b39f491(url, options = {}) {
486
+ const defaultOptions = {
487
+ headers: {
488
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
489
+ },
490
+ redirect: "manual"
491
+ };
492
+ const url2 = `${url}`;
493
+ const url1 = new URL(url2);
494
+ const domain = url1.hostname.replace(/^.*(\.\w+\.\w+)$/, (match, p1)=>{
495
+ return `%${p1}`;
496
+ });
497
+ const cookies = await (0, $300d8b33187a203c$export$4d2e9997e2c23417)({
498
+ name: "%",
499
+ domain: domain
500
+ });
501
+ const cookie = cookies.pop();
502
+ const newOptions1 = (0, $7oI3p$lodash.merge)(defaultOptions, options, {
503
+ headers: {
504
+ Cookie: cookie
505
+ }
506
+ });
507
+ try {
508
+ const res = await (0, $7oI3p$crossfetch.fetch)(url2, newOptions1);
509
+ const newUrl = res.headers.get("location");
510
+ if (res.redirected || newUrl && newUrl !== url2) return $cfc07ae4aa2c7e44$export$b24a545a0b39f491(newUrl, newOptions1);
511
+ const arrayBuffer1 = res.arrayBuffer();
512
+ const arrayBuffer = async ()=>arrayBuffer1;
513
+ const buffer = async ()=>arrayBuffer().then(Buffer.from);
514
+ const text = async ()=>buffer().then((buffer)=>buffer.toString("utf8"));
515
+ const json = async ()=>text().then((0, ($parcel$interopDefault($7oI3p$destr))));
516
+ const formData = async ()=>text().then((text)=>new URLSearchParams(text));
517
+ const source2 = {
518
+ status: res.status,
519
+ statusText: res.statusText,
520
+ headers: res.headers,
521
+ arrayBuffer: arrayBuffer,
522
+ buffer: buffer,
523
+ text: text,
524
+ json: json,
525
+ formData: formData
526
+ };
527
+ return (0, $7oI3p$lodash.merge)({}, res, source2);
528
+ } catch (e) {
529
+ throw e;
530
+ }
531
+ }
532
+
533
+
534
+ var $d2b0e8c8c0378e21$exports = {};
535
+
536
+
537
+ var $3d7e27b54f670f46$exports = {};
538
+
539
+
540
+ var $6c197c88880e045c$exports = {};
541
+
542
+
543
+ async function $cd1ba0160120c006$export$4be65e66cfa2648a(params) {
544
+ const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $f72befa528c23ca7$export$2e2bcd8739ae039)());
545
+ if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
546
+ else throw new Error("Cookie not found");
547
+ }
548
+ async function $cd1ba0160120c006$export$c44c5fdef43f0941(params) {
549
+ const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $7bb7da9a77b2fd99$export$2e2bcd8739ae039)());
550
+ if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
551
+ else throw new Error("Cookie not found");
552
+ }
553
+ async function $cd1ba0160120c006$export$e5637297e9eb6f2e(params) {
554
+ const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $269fe42bfd555305$export$2e2bcd8739ae039)());
555
+ if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
556
+ else throw new Error("Cookie not found");
557
+ }
558
+ $parcel$exportWildcard(module.exports, $3d7e27b54f670f46$exports);
559
+ $parcel$exportWildcard(module.exports, $d2b0e8c8c0378e21$exports);
560
+ $parcel$exportWildcard(module.exports, $6c197c88880e045c$exports);
561
+
562
+
3
563
  //# sourceMappingURL=index.js.map