@nice2dev/ui-api 1.4.8 → 1.4.10

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/core.mjs ADDED
@@ -0,0 +1,4215 @@
1
+ var Qt = Object.defineProperty;
2
+ var Gt = (e, t, n) => t in e ? Qt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var be = (e, t, n) => Gt(e, typeof t != "symbol" ? t + "" : t, n);
4
+ const jr = [
5
+ "GET",
6
+ "POST",
7
+ "PUT",
8
+ "PATCH",
9
+ "DELETE",
10
+ "HEAD",
11
+ "OPTIONS",
12
+ "TRACE"
13
+ ], Nr = [
14
+ "inherit",
15
+ "none",
16
+ "apiKey",
17
+ "bearer",
18
+ "basic",
19
+ "digest",
20
+ "oauth2",
21
+ "awsSigV4",
22
+ "hmac",
23
+ "mtls",
24
+ "custom"
25
+ ];
26
+ let Re = 0;
27
+ function Pe(e = "r") {
28
+ return Re = (Re + 1) % 1e6, `${e}${Date.now().toString(36)}${Re.toString(36)}${Math.random().toString(36).slice(2, 6)}`;
29
+ }
30
+ function ye(e = {}) {
31
+ return {
32
+ ...e,
33
+ kind: "request",
34
+ id: e.id ?? Pe("r"),
35
+ name: e.name ?? "New request",
36
+ method: e.method ?? "GET",
37
+ url: e.url ?? "",
38
+ params: e.params ?? [],
39
+ body: e.body ?? { kind: "none" }
40
+ };
41
+ }
42
+ function Ae(e = {}) {
43
+ return {
44
+ ...e,
45
+ kind: "folder",
46
+ id: e.id ?? Pe("f"),
47
+ name: e.name ?? "New folder",
48
+ items: e.items ?? []
49
+ };
50
+ }
51
+ function je(e = {}) {
52
+ return {
53
+ ...e,
54
+ id: e.id ?? Pe("c"),
55
+ name: e.name ?? "New API",
56
+ items: e.items ?? [],
57
+ variables: e.variables ?? []
58
+ };
59
+ }
60
+ function it(e, t = []) {
61
+ const n = [];
62
+ for (const r of e)
63
+ r.kind === "folder" ? n.push(...it(r.items, [...t, r])) : n.push({ request: r, folders: [...t] });
64
+ return n;
65
+ }
66
+ function Yt(e, t) {
67
+ for (const n of e) {
68
+ if (n.id === t)
69
+ return n;
70
+ if (n.kind === "folder") {
71
+ const r = Yt(n.items, t);
72
+ if (r)
73
+ return r;
74
+ }
75
+ }
76
+ }
77
+ function Xt(e, t, n) {
78
+ const r = [];
79
+ for (const s of e)
80
+ if (s.id === t) {
81
+ const o = n(s);
82
+ o && r.push(o);
83
+ } else s.kind === "folder" ? r.push({ ...s, items: Xt(s.items, t, n) }) : r.push(s);
84
+ return r;
85
+ }
86
+ function L(e) {
87
+ return e.enabled !== !1;
88
+ }
89
+ function Or(e) {
90
+ const t = {};
91
+ for (const n of e)
92
+ L(n) && (t[n.key] = n.value);
93
+ return t;
94
+ }
95
+ function Zt(e, t) {
96
+ return e.params.filter((n) => n.in === t && L(n));
97
+ }
98
+ function Cr(e, t) {
99
+ var r;
100
+ const n = t.toLowerCase();
101
+ return (r = Zt(e, "header").find((s) => s.key.toLowerCase() === n)) == null ? void 0 : r.value;
102
+ }
103
+ function en(e, t = [], n) {
104
+ const r = [e.auth, ...[...t].reverse().map((s) => s.auth), n == null ? void 0 : n.auth];
105
+ for (const s of r)
106
+ if (s && s.type !== "inherit")
107
+ return s;
108
+ return { type: "none" };
109
+ }
110
+ function Ne(e) {
111
+ switch (e.kind) {
112
+ case "json":
113
+ case "graphql":
114
+ return "application/json";
115
+ case "xml":
116
+ return "application/xml";
117
+ case "text":
118
+ return e.contentType ?? "text/plain";
119
+ case "form":
120
+ return "application/x-www-form-urlencoded";
121
+ case "multipart":
122
+ return "multipart/form-data";
123
+ case "binary":
124
+ return e.contentType ?? "application/octet-stream";
125
+ case "soap":
126
+ return e.version === "1.2" ? `application/soap+xml; charset=utf-8${e.action ? `; action="${e.action}"` : ""}` : "text/xml; charset=utf-8";
127
+ default:
128
+ return;
129
+ }
130
+ }
131
+ function oe(e) {
132
+ var t;
133
+ switch (e.kind) {
134
+ case "json":
135
+ case "xml":
136
+ case "text":
137
+ return e.text;
138
+ case "form":
139
+ return e.fields.filter(L).map((n) => `${encodeURIComponent(n.key)}=${encodeURIComponent(n.value)}`).join("&");
140
+ case "graphql": {
141
+ const n = { query: e.query };
142
+ if ((t = e.variables) != null && t.trim())
143
+ try {
144
+ n.variables = JSON.parse(e.variables);
145
+ } catch {
146
+ n.variables = e.variables;
147
+ }
148
+ return e.operationName && (n.operationName = e.operationName), JSON.stringify(n);
149
+ }
150
+ case "soap":
151
+ return e.envelope;
152
+ default:
153
+ return;
154
+ }
155
+ }
156
+ function xt(e, t) {
157
+ const n = (t ?? "").toLowerCase();
158
+ return n.includes("x-www-form-urlencoded") ? { kind: "form", fields: Tt(e) } : n.includes("soap+xml") ? { kind: "soap", envelope: e, version: "1.2" } : n.includes("xml") ? /<(\w+:)?Envelope[\s>]/.test(e) ? { kind: "soap", envelope: e, version: "1.1" } : { kind: "xml", text: e } : n.includes("json") || !n && /^\s*[[{]/.test(e) ? tn(e) ?? { kind: "json", text: e } : { kind: "text", text: e, contentType: t || void 0 };
159
+ }
160
+ function Tt(e) {
161
+ return e ? e.split("&").map((t) => {
162
+ const n = t.indexOf("="), r = (s) => {
163
+ try {
164
+ return decodeURIComponent(s.replace(/\+/g, " "));
165
+ } catch {
166
+ return s;
167
+ }
168
+ };
169
+ return n < 0 ? { key: r(t), value: "" } : { key: r(t.slice(0, n)), value: r(t.slice(n + 1)) };
170
+ }) : [];
171
+ }
172
+ function tn(e) {
173
+ try {
174
+ const t = JSON.parse(e);
175
+ if (t && typeof t == "object" && typeof t.query == "string" && /^\s*(query|mutation|subscription|\{|fragment)/.test(t.query))
176
+ return {
177
+ kind: "graphql",
178
+ query: t.query,
179
+ variables: t.variables === void 0 ? void 0 : JSON.stringify(t.variables, null, 2),
180
+ operationName: typeof t.operationName == "string" ? t.operationName : void 0
181
+ };
182
+ } catch {
183
+ }
184
+ return null;
185
+ }
186
+ const St = /\{\{\s*([^{}]+?)\s*\}\}/g;
187
+ function nn(e) {
188
+ const t = /* @__PURE__ */ new Set();
189
+ for (const n of e.matchAll(St))
190
+ t.add(n[1]);
191
+ return [...t];
192
+ }
193
+ function rn(e) {
194
+ const t = (r) => Array.from({ length: r }, () => Math.floor(e() * 16).toString(16)).join(""), n = (8 + Math.floor(e() * 4)).toString(16);
195
+ return `${t(8)}-${t(4)}-4${t(3)}-${n}${t(3)}-${t(12)}`;
196
+ }
197
+ function jt(e, t, n = {}) {
198
+ const r = typeof t == "function" ? t : (c) => t[c], s = n.random ?? Math.random, o = n.now ?? (() => /* @__PURE__ */ new Date()), i = (c) => {
199
+ var l;
200
+ if (c.startsWith("secret:"))
201
+ return (l = n.resolveSecret) == null ? void 0 : l.call(n, c.slice(7).trim());
202
+ switch (c) {
203
+ case "$guid":
204
+ case "$randomUUID":
205
+ return rn(s);
206
+ case "$timestamp":
207
+ return String(Math.floor(o().getTime() / 1e3));
208
+ case "$isoTimestamp":
209
+ return o().toISOString();
210
+ case "$randomInt":
211
+ return String(Math.floor(s() * 1001));
212
+ default:
213
+ return r(c);
214
+ }
215
+ };
216
+ let a = e;
217
+ for (let c = 0; c < 5 && a.includes("{{"); c++) {
218
+ const l = a.replace(St, (f, u) => i(u) ?? f);
219
+ if (l === a)
220
+ break;
221
+ a = l;
222
+ }
223
+ return a;
224
+ }
225
+ function Ur(e, t, n = {}) {
226
+ return nn(jt(e, t, n));
227
+ }
228
+ function _r(e, t, n) {
229
+ const r = {}, s = (o) => {
230
+ for (const i of o ?? [])
231
+ L(i) && i.key && (r[i.key] = i.value);
232
+ };
233
+ return s(e == null ? void 0 : e.variables), s(t == null ? void 0 : t.values), { ...r, ...n };
234
+ }
235
+ function pe(e) {
236
+ let t = e.trim(), n = "";
237
+ const r = t.indexOf("#");
238
+ r >= 0 && (n = t.slice(r), t = t.slice(0, r));
239
+ const s = t.indexOf("?");
240
+ return s < 0 ? { base: t, query: [], hash: n } : { base: t.slice(0, s), query: Tt(t.slice(s + 1)), hash: n };
241
+ }
242
+ function sn(e) {
243
+ const t = pe(e).base, n = [], r = t.replace(/^[a-z][\w+.-]*:\/\/[^/]*/i, "").replace(/^\{\{[^}]+\}\}/, "");
244
+ for (const s of r.matchAll(
245
+ new RegExp("(?<!\\{)\\{([A-Za-z_][\\w.-]*)\\}(?!\\})|(?:^|\\/):([A-Za-z_][\\w-]*)", "g")
246
+ )) {
247
+ const o = s[1] ?? s[2];
248
+ n.includes(o) || n.push(o);
249
+ }
250
+ return n;
251
+ }
252
+ function on(e) {
253
+ const t = sn(e.url), n = e.params.filter((s) => s.in !== "path");
254
+ return [...t.map(
255
+ (s) => e.params.find((o) => o.in === "path" && o.key === s) ?? {
256
+ key: s,
257
+ value: "",
258
+ in: "path",
259
+ required: !0
260
+ }
261
+ ), ...n];
262
+ }
263
+ function an(e, t) {
264
+ const { base: n, query: r, hash: s } = pe(t), o = {
265
+ ...e,
266
+ url: n + s,
267
+ params: [
268
+ ...e.params.filter((i) => i.in !== "query"),
269
+ ...r.map((i) => ({ ...i, in: "query" }))
270
+ ]
271
+ };
272
+ return { ...o, params: on(o) };
273
+ }
274
+ function cn(e) {
275
+ return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
276
+ }
277
+ function ft(e) {
278
+ return encodeURIComponent(e).replace(
279
+ /[!'()*]/g,
280
+ (t) => `%${t.charCodeAt(0).toString(16).toUpperCase()}`
281
+ );
282
+ }
283
+ function Oe(e, t = (n) => n) {
284
+ const { base: n, query: r, hash: s } = pe(e.url);
285
+ let o = t(n);
286
+ for (const a of e.params) {
287
+ if (a.in !== "path" || !L(a))
288
+ continue;
289
+ const c = encodeURIComponent(t(a.value)), l = new RegExp(`(^|/):${cn(a.key)}(?=/|$)`);
290
+ o = o.split(`{${a.key}}`).join(c).replace(l, (f, u) => u + c);
291
+ }
292
+ const i = [...r, ...e.params.filter((a) => a.in === "query" && L(a))].map(
293
+ (a) => {
294
+ const c = ft(t(a.key)), l = t(a.value);
295
+ return l === "" && !("in" in a) ? c : `${c}=${ft(l)}`;
296
+ }
297
+ );
298
+ return o + (i.length ? `?${i.join("&")}` : "") + t(s);
299
+ }
300
+ function Er(e, t) {
301
+ return e ? t ? `${e.replace(/\/+$/, "")}/${t.replace(/^\/+/, "")}` : e : t;
302
+ }
303
+ function pn(e) {
304
+ return /^\s*(?:\$\s*)?curl(?:\.exe)?(?:\s|$)/i.test(e);
305
+ }
306
+ function ln(e) {
307
+ return /\^\r?\n/.test(e) || /\^"/.test(e) ? "cmd" : /`\r?\n/.test(e) || /^\s*curl\.exe\b/i.test(e) ? "powershell" : "bash";
308
+ }
309
+ function un(e, t = ln(e)) {
310
+ var c;
311
+ let n = e.replace(/\r\n?/g, `
312
+ `);
313
+ t === "cmd" ? n = n.replace(/\^\n/g, " ").replace(/\^([\s\S])/g, "$1") : t === "powershell" ? n = n.replace(/`\n/g, " ") : n = n.replace(/\\\n/g, " ");
314
+ const r = [];
315
+ let s = "", o = !1, i = 0;
316
+ const a = () => {
317
+ o && r.push(s), s = "", o = !1;
318
+ };
319
+ for (; i < n.length; ) {
320
+ const l = n[i];
321
+ if (l === " " || l === " " || l === `
322
+ `) {
323
+ a(), i++;
324
+ continue;
325
+ }
326
+ if (l === "#" && !o && t === "bash") {
327
+ for (; i < n.length && n[i] !== `
328
+ `; )
329
+ i++;
330
+ continue;
331
+ }
332
+ if (o = !0, l === "'" && t !== "cmd") {
333
+ for (i++; i < n.length; ) {
334
+ if (n[i] === "'") {
335
+ if (t === "powershell" && n[i + 1] === "'") {
336
+ s += "'", i += 2;
337
+ continue;
338
+ }
339
+ break;
340
+ }
341
+ s += n[i++];
342
+ }
343
+ i++;
344
+ continue;
345
+ }
346
+ if (l === "$" && n[i + 1] === "'" && t === "bash") {
347
+ for (i += 2; i < n.length && n[i] !== "'"; ) {
348
+ if (n[i] === "\\" && i + 1 < n.length) {
349
+ const f = n[i + 1], u = {
350
+ n: `
351
+ `,
352
+ t: " ",
353
+ r: "\r",
354
+ "\\": "\\",
355
+ "'": "'",
356
+ '"': '"',
357
+ 0: "\0"
358
+ };
359
+ if (f === "x") {
360
+ const d = ((c = /^[0-9a-fA-F]{1,2}/.exec(n.slice(i + 2))) == null ? void 0 : c[0]) ?? "";
361
+ s += String.fromCharCode(parseInt(d || "0", 16)), i += 2 + d.length;
362
+ continue;
363
+ }
364
+ s += u[f] ?? `\\${f}`, i += 2;
365
+ continue;
366
+ }
367
+ s += n[i++];
368
+ }
369
+ i++;
370
+ continue;
371
+ }
372
+ if (l === '"') {
373
+ for (i++; i < n.length; ) {
374
+ const f = n[i];
375
+ if (f === '"') {
376
+ if (t === "powershell" && n[i + 1] === '"') {
377
+ s += '"', i += 2;
378
+ continue;
379
+ }
380
+ break;
381
+ }
382
+ if (t === "powershell") {
383
+ if (f === "`" && i + 1 < n.length) {
384
+ s += n[i + 1], i += 2;
385
+ continue;
386
+ }
387
+ } else if (f === "\\" && i + 1 < n.length && '"\\$`'.includes(n[i + 1])) {
388
+ s += n[i + 1], i += 2;
389
+ continue;
390
+ }
391
+ s += f, i++;
392
+ }
393
+ i++;
394
+ continue;
395
+ }
396
+ if (l === "\\" && t === "bash" && i + 1 < n.length) {
397
+ s += n[i + 1], i += 2;
398
+ continue;
399
+ }
400
+ s += l, i++;
401
+ }
402
+ return a(), r;
403
+ }
404
+ const fn = new Set("XHdFubAemoxwTEKrUzCcDYyQt".split("")), dn = /* @__PURE__ */ new Set([
405
+ "request",
406
+ "header",
407
+ "data",
408
+ "data-ascii",
409
+ "data-raw",
410
+ "data-binary",
411
+ "data-urlencode",
412
+ "json",
413
+ "form",
414
+ "form-string",
415
+ "user",
416
+ "cookie",
417
+ "user-agent",
418
+ "referer",
419
+ "max-time",
420
+ "url",
421
+ "url-query",
422
+ "oauth2-bearer",
423
+ "aws-sigv4",
424
+ "output",
425
+ "proxy",
426
+ "proxy-user",
427
+ "write-out",
428
+ "connect-timeout",
429
+ "retry",
430
+ "retry-delay",
431
+ "retry-max-time",
432
+ "cacert",
433
+ "capath",
434
+ "cert",
435
+ "cert-type",
436
+ "key",
437
+ "key-type",
438
+ "pass",
439
+ "resolve",
440
+ "connect-to",
441
+ "interface",
442
+ "limit-rate",
443
+ "upload-file",
444
+ "range",
445
+ "cookie-jar",
446
+ "dump-header",
447
+ "config",
448
+ "max-redirs",
449
+ "unix-socket",
450
+ "request-target",
451
+ "expect100-timeout",
452
+ "keepalive-time",
453
+ "local-port",
454
+ "dns-servers",
455
+ "socks4",
456
+ "socks5",
457
+ "socks5-hostname",
458
+ "preproxy",
459
+ "netrc-file",
460
+ "trace",
461
+ "trace-ascii",
462
+ "stderr",
463
+ "variable",
464
+ "ciphers",
465
+ "speed-limit",
466
+ "speed-time",
467
+ "time-cond",
468
+ "quote",
469
+ "hostpubmd5",
470
+ "pubkey",
471
+ "login-options",
472
+ "sasl-authzid",
473
+ "tls-max"
474
+ ]), dt = {
475
+ X: "request",
476
+ H: "header",
477
+ d: "data",
478
+ F: "form",
479
+ u: "user",
480
+ b: "cookie",
481
+ A: "user-agent",
482
+ e: "referer",
483
+ m: "max-time",
484
+ G: "get",
485
+ k: "insecure",
486
+ L: "location",
487
+ I: "head",
488
+ T: "upload-file",
489
+ E: "cert"
490
+ };
491
+ function Nt(e) {
492
+ try {
493
+ const t = Uint8Array.from(atob(e.trim()), (n) => n.charCodeAt(0));
494
+ return new TextDecoder().decode(t);
495
+ } catch {
496
+ return "";
497
+ }
498
+ }
499
+ function ot(e) {
500
+ const t = new TextEncoder().encode(e);
501
+ let n = "";
502
+ for (const r of t)
503
+ n += String.fromCharCode(r);
504
+ return btoa(n);
505
+ }
506
+ function mn(e) {
507
+ const t = e.indexOf("@"), n = e.indexOf("=");
508
+ if (t >= 0 && (n < 0 || t < n))
509
+ return e;
510
+ if (n < 0)
511
+ return encodeURIComponent(e);
512
+ const r = e.slice(0, n), s = encodeURIComponent(e.slice(n + 1));
513
+ return r ? `${r}=${s}` : s;
514
+ }
515
+ function hn(e, t) {
516
+ const n = e.indexOf("="), r = n < 0 ? e : e.slice(0, n);
517
+ let s = n < 0 ? "" : e.slice(n + 1);
518
+ if (!t && (s.startsWith("@") || s.startsWith("<"))) {
519
+ const [o, ...i] = s.slice(1).split(";"), a = { key: r, value: "", type: "file", fileName: o };
520
+ for (const c of i) {
521
+ const [l, f] = c.split("=");
522
+ l === "type" && (a.contentType = f), l === "filename" && (a.fileName = f);
523
+ }
524
+ return a;
525
+ }
526
+ if (!t) {
527
+ const o = s.indexOf(";type=");
528
+ if (o >= 0) {
529
+ const i = { key: r, value: s.slice(0, o), type: "text" };
530
+ return i.contentType = s.slice(o + 6), i;
531
+ }
532
+ }
533
+ return s = s.replace(/^"(.*)"$/, "$1"), { key: r, value: s, type: "text" };
534
+ }
535
+ function yn(e) {
536
+ const t = un(e.trim());
537
+ if (t[0] === "$" && t.shift(), !t.length || !/^curl(\.exe)?$/i.test(t[0]))
538
+ throw new Error("Not a curl command");
539
+ let n, r = "";
540
+ const s = [], o = [], i = [], a = [];
541
+ let c;
542
+ const l = [];
543
+ let f, u = !1, d, p, b = !1, $ = !1, h = !1;
544
+ const v = {}, k = (j, x) => {
545
+ switch (j) {
546
+ case "request":
547
+ n = x == null ? void 0 : x.toUpperCase();
548
+ break;
549
+ case "url":
550
+ r = x ?? r;
551
+ break;
552
+ case "url-query":
553
+ x && i.push(...mt(x));
554
+ break;
555
+ case "header": {
556
+ if (!x)
557
+ break;
558
+ const E = x.indexOf(":");
559
+ E > 0 ? s.push({ key: x.slice(0, E).trim(), value: x.slice(E + 1).trim() }) : x.endsWith(";") && s.push({ key: x.slice(0, -1).trim(), value: "" });
560
+ break;
561
+ }
562
+ case "user-agent":
563
+ s.push({ key: "User-Agent", value: x ?? "" });
564
+ break;
565
+ case "referer":
566
+ s.push({ key: "Referer", value: x ?? "" });
567
+ break;
568
+ case "cookie":
569
+ if (x != null && x.includes("="))
570
+ for (const E of x.split(";")) {
571
+ const H = E.indexOf("=");
572
+ H > 0 && o.push({ key: E.slice(0, H).trim(), value: E.slice(H + 1).trim() });
573
+ }
574
+ break;
575
+ case "data":
576
+ case "data-ascii":
577
+ case "data-binary":
578
+ case "data-raw":
579
+ case "json":
580
+ if (x === void 0)
581
+ break;
582
+ j === "json" && (h = !0), j !== "data-raw" && x.startsWith("@") ? c = x.slice(1) : a.push(
583
+ j === "data" || j === "data-ascii" ? x.replace(/[\r\n]/g, "") : x
584
+ );
585
+ break;
586
+ case "data-urlencode":
587
+ x !== void 0 && a.push(mn(x));
588
+ break;
589
+ case "form":
590
+ case "form-string":
591
+ x !== void 0 && l.push(hn(x, j === "form-string"));
592
+ break;
593
+ case "user":
594
+ f = x;
595
+ break;
596
+ case "oauth2-bearer":
597
+ d = x;
598
+ break;
599
+ case "aws-sigv4":
600
+ p = x;
601
+ break;
602
+ case "digest":
603
+ u = !0;
604
+ break;
605
+ case "get":
606
+ b = !0;
607
+ break;
608
+ case "head":
609
+ $ = !0;
610
+ break;
611
+ case "insecure":
612
+ v.insecure = !0;
613
+ break;
614
+ case "location":
615
+ v.followRedirects = !0;
616
+ break;
617
+ case "max-time":
618
+ x && Number.isFinite(Number(x)) && (v.timeoutMs = Number(x) * 1e3);
619
+ break;
620
+ case "upload-file":
621
+ x && (c = x), n ?? (n = "PUT");
622
+ break;
623
+ }
624
+ };
625
+ for (let j = 1; j < t.length; j++) {
626
+ const x = t[j];
627
+ if (x.startsWith("--") && x.length > 2) {
628
+ const E = x.slice(2), H = dn.has(E) ? t[++j] : void 0;
629
+ k(E, H);
630
+ } else if (x.startsWith("-") && x.length > 1)
631
+ for (let E = 1; E < x.length; E++) {
632
+ const H = x[E];
633
+ if (fn.has(H)) {
634
+ const y = x.slice(E + 1) || t[++j];
635
+ k(dt[H] ?? H, y);
636
+ break;
637
+ }
638
+ k(dt[H] ?? H, void 0);
639
+ }
640
+ else r || (r = x);
641
+ }
642
+ let T;
643
+ const g = s.findIndex((j) => j.key.toLowerCase() === "authorization");
644
+ if (g >= 0) {
645
+ const j = s[g].value, x = /^Bearer\s+(.+)$/i.exec(j), E = /^Basic\s+(.+)$/i.exec(j);
646
+ if (x)
647
+ T = { type: "bearer", token: x[1].trim() }, s.splice(g, 1);
648
+ else if (E) {
649
+ const H = Nt(E[1]), m = H.indexOf(":");
650
+ m >= 0 && (T = {
651
+ type: "basic",
652
+ username: H.slice(0, m),
653
+ password: H.slice(m + 1)
654
+ }, s.splice(g, 1));
655
+ }
656
+ }
657
+ if (f !== void 0) {
658
+ const j = f.indexOf(":"), x = j < 0 ? f : f.slice(0, j), E = j < 0 ? "" : f.slice(j + 1);
659
+ if (p) {
660
+ const [, , H = "", m = ""] = p.split(":");
661
+ T = {
662
+ type: "awsSigV4",
663
+ accessKeyId: x,
664
+ secretAccessKey: E,
665
+ region: H,
666
+ service: m
667
+ };
668
+ } else
669
+ T = u ? { type: "digest", username: x, password: E } : { type: "basic", username: x, password: E };
670
+ }
671
+ d !== void 0 && (T = { type: "bearer", token: d });
672
+ const S = s.findIndex((j) => j.key.toLowerCase() === "content-type"), w = S >= 0 ? s[S].value : void 0;
673
+ h && (S < 0 && s.push({ key: "Content-Type", value: "application/json" }), s.some((j) => j.key.toLowerCase() === "accept") || s.push({ key: "Accept", value: "application/json" }));
674
+ let N = { kind: "none" };
675
+ if (b && a.length)
676
+ i.push(...mt(a.join("&")));
677
+ else if (l.length)
678
+ N = { kind: "multipart", parts: l };
679
+ else if (a.length) {
680
+ const j = a.join(h ? "" : "&"), x = /^\s*[[{]/.test(j);
681
+ N = xt(
682
+ j,
683
+ w ?? (h || x ? "application/json" : "application/x-www-form-urlencoded")
684
+ );
685
+ } else c !== void 0 && (N = { kind: "binary", fileName: c, contentType: w });
686
+ const P = n ?? ($ ? "HEAD" : b ? "GET" : N.kind !== "none" ? "POST" : "GET"), R = [
687
+ ...s.map((j) => ({ ...j, in: "header" })),
688
+ ...o.map((j) => ({ ...j, in: "cookie" }))
689
+ ];
690
+ let M = ye({
691
+ name: Ot(P, r),
692
+ method: P,
693
+ params: R,
694
+ body: N,
695
+ auth: T,
696
+ settings: Object.keys(v).length ? v : void 0
697
+ });
698
+ return M = an(M, r), i.length && (M = {
699
+ ...M,
700
+ params: [...M.params, ...i.map((j) => ({ ...j, in: "query" }))]
701
+ }), M;
702
+ }
703
+ function mt(e) {
704
+ return e.split("&").filter(Boolean).map((t) => {
705
+ const n = t.indexOf("="), r = (s) => {
706
+ try {
707
+ return decodeURIComponent(s.replace(/\+/g, " "));
708
+ } catch {
709
+ return s;
710
+ }
711
+ };
712
+ return n < 0 ? { key: r(t), value: "" } : { key: r(t.slice(0, n)), value: r(t.slice(n + 1)) };
713
+ });
714
+ }
715
+ function Ot(e, t) {
716
+ const n = t.replace(/^[a-z][\w+.-]*:\/\/[^/]*/i, "").replace(/^\{\{[^}]+\}\}/, "").split("?")[0];
717
+ return `${e} ${n || "/"}`;
718
+ }
719
+ function gn(e) {
720
+ return e === "powershell" ? (t) => `'${t.replace(/'/g, "''")}'` : e === "cmd" ? (t) => `"${t.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"` : (t) => /^[\w./:@%+=,-]+$/.test(t) ? t : `'${t.replace(/'/g, "'\\''")}'`;
721
+ }
722
+ function bn(e, t) {
723
+ const n = [], r = [], s = [];
724
+ switch (e == null ? void 0 : e.type) {
725
+ case "basic":
726
+ n.push(["-u", `${t(e.username)}:${t(e.password)}`]);
727
+ break;
728
+ case "digest":
729
+ n.push(["--digest"], ["-u", `${t(e.username)}:${t(e.password)}`]);
730
+ break;
731
+ case "bearer":
732
+ n.push(["-H", `Authorization: ${e.prefix ?? "Bearer"} ${t(e.token)}`]);
733
+ break;
734
+ case "oauth2":
735
+ e.accessToken && n.push(["-H", `Authorization: ${e.tokenType ?? "Bearer"} ${t(e.accessToken)}`]);
736
+ break;
737
+ case "apiKey":
738
+ e.in === "header" ? n.push(["-H", `${t(e.key)}: ${t(e.value)}`]) : e.in === "query" ? r.push({ key: e.key, value: e.value }) : s.push({ key: e.key, value: e.value });
739
+ break;
740
+ case "awsSigV4":
741
+ n.push(
742
+ ["--aws-sigv4", `aws:amz:${t(e.region)}:${t(e.service)}`],
743
+ ["-u", `${t(e.accessKeyId)}:${t(e.secretAccessKey)}`]
744
+ ), e.sessionToken && n.push(["-H", `x-amz-security-token: ${t(e.sessionToken)}`]);
745
+ break;
746
+ case "custom":
747
+ for (const o of e.headers.filter(L))
748
+ n.push(["-H", `${t(o.key)}: ${t(o.value)}`]);
749
+ break;
750
+ case "mtls":
751
+ e.certificate && n.push(["--cert", t(e.certificate)]), e.key && n.push(["--key", t(e.key)]);
752
+ break;
753
+ }
754
+ return { options: n, query: r, cookies: s };
755
+ }
756
+ function He(e, t = {}) {
757
+ var T, g, S;
758
+ const n = t.shell ?? "bash", r = t.transform ?? ((w) => w), s = gn(n), o = bn(t.auth ?? e.auth, r), i = {
759
+ ...e,
760
+ params: [...e.params, ...o.query.map((w) => ({ ...w, in: "query" }))]
761
+ }, a = Oe(i, r), c = [], l = e.method.toUpperCase(), f = e.body.kind !== "none";
762
+ l === "HEAD" ? c.push(["-I"]) : !(l === "GET" && !f) && !(l === "POST" && f) && c.push(["-X", l]);
763
+ const u = e.params.filter((w) => w.in === "header" && L(w));
764
+ for (const w of u)
765
+ c.push(["-H", `${r(w.key)}: ${r(w.value)}`]);
766
+ c.push(...o.options);
767
+ const d = Ne(e.body), p = u.some((w) => w.key.toLowerCase() === "content-type"), b = [
768
+ ...e.params.filter((w) => w.in === "cookie" && L(w)),
769
+ ...o.cookies
770
+ ];
771
+ b.length && c.push(["-b", b.map((w) => `${r(w.key)}=${r(w.value)}`).join("; ")]);
772
+ const $ = e.body;
773
+ switch ($.kind) {
774
+ case "none":
775
+ break;
776
+ case "form":
777
+ for (const w of $.fields.filter(L))
778
+ c.push(["--data-urlencode", `${r(w.key)}=${r(w.value)}`]);
779
+ break;
780
+ case "multipart":
781
+ for (const w of $.parts.filter(L))
782
+ w.type === "file" ? c.push([
783
+ "-F",
784
+ `${r(w.key)}=@${w.fileName ?? w.value}${w.contentType ? `;type=${w.contentType}` : ""}`
785
+ ]) : c.push([
786
+ "-F",
787
+ `${r(w.key)}=${r(w.value)}${w.contentType ? `;type=${w.contentType}` : ""}`
788
+ ]);
789
+ break;
790
+ case "binary":
791
+ !p && d && c.push(["-H", `Content-Type: ${d}`]), c.push(["--data-binary", `@${$.fileName ?? "file"}`]);
792
+ break;
793
+ default: {
794
+ !p && d && c.push(["-H", `Content-Type: ${d}`]), $.kind === "soap" && $.version === "1.1" && $.action !== void 0 && (u.some((w) => w.key.toLowerCase() === "soapaction") || c.push(["-H", `SOAPAction: "${r($.action)}"`])), c.push(["--data-raw", r(oe($) ?? "")]);
795
+ break;
796
+ }
797
+ }
798
+ (T = e.settings) != null && T.followRedirects && c.push(["-L"]), (g = e.settings) != null && g.insecure && c.push(["-k"]), (S = e.settings) != null && S.timeoutMs && c.push(["-m", String(e.settings.timeoutMs / 1e3)]);
799
+ const v = [
800
+ `${n === "powershell" ? "curl.exe" : "curl"} ${s(a)}`,
801
+ ...c.map(([w, N]) => N === void 0 ? w : `${w} ${s(N)}`)
802
+ ];
803
+ if (t.multiline === !1)
804
+ return v.join(" ");
805
+ const k = n === "cmd" ? ` ^
806
+ ` : n === "powershell" ? " `\n " : ` \\
807
+ `;
808
+ return v.join(k);
809
+ }
810
+ const kn = [
811
+ { id: "curl", label: "cURL (bash)", syntax: "shell" },
812
+ { id: "curl-cmd", label: "cURL (cmd)", syntax: "bat" },
813
+ { id: "curl-powershell", label: "cURL (PowerShell)", syntax: "powershell" },
814
+ { id: "fetch", label: "JavaScript fetch", syntax: "javascript" },
815
+ { id: "csharp", label: "C# HttpClient", syntax: "csharp" },
816
+ { id: "powershell", label: "PowerShell", syntax: "powershell" },
817
+ { id: "python", label: "Python requests", syntax: "python" }
818
+ ];
819
+ function Ue(e, t) {
820
+ var d;
821
+ const n = t.transform ?? ((p) => p), r = t.auth ?? e.auth, s = e.params.filter((p) => p.in === "header" && L(p)).map((p) => [n(p.key), n(p.value)]), o = [], i = e.params.filter((p) => p.in === "cookie" && L(p)).map((p) => `${n(p.key)}=${n(p.value)}`);
822
+ let a;
823
+ switch (r == null ? void 0 : r.type) {
824
+ case "basic":
825
+ s.push([
826
+ "Authorization",
827
+ `Basic ${ot(`${n(r.username)}:${n(r.password)}`)}`
828
+ ]);
829
+ break;
830
+ case "bearer":
831
+ s.push(["Authorization", `${r.prefix ?? "Bearer"} ${n(r.token)}`]);
832
+ break;
833
+ case "oauth2":
834
+ r.accessToken ? s.push(["Authorization", `${r.tokenType ?? "Bearer"} ${n(r.accessToken)}`]) : a = "OAuth 2: obtain a token first and send it as Authorization: Bearer <token>.";
835
+ break;
836
+ case "apiKey":
837
+ r.in === "header" ? s.push([n(r.key), n(r.value)]) : r.in === "query" ? o.push({ key: r.key, value: r.value, in: "query" }) : i.push(`${n(r.key)}=${n(r.value)}`);
838
+ break;
839
+ case "custom":
840
+ for (const p of r.headers.filter(L))
841
+ s.push([n(p.key), n(p.value)]);
842
+ break;
843
+ case "digest":
844
+ a = "Digest auth: the signature is computed per call from the server challenge.";
845
+ break;
846
+ case "awsSigV4":
847
+ a = "AWS Signature V4: sign each call (an AWS SDK or a SigV4 signer).";
848
+ break;
849
+ case "hmac":
850
+ a = `HMAC: compute the ${r.header} header per call.`;
851
+ break;
852
+ case "mtls":
853
+ a = "Mutual TLS: attach the client certificate in the HTTP client.";
854
+ break;
855
+ }
856
+ i.length && s.push(["Cookie", i.join("; ")]);
857
+ const c = Oe({ ...e, params: [...e.params, ...o] }, n), l = e.body, f = ((d = s.find(([p]) => p.toLowerCase() === "content-type")) == null ? void 0 : d[1]) ?? Ne(l);
858
+ l.kind === "soap" && l.version === "1.1" && l.action !== void 0 && (s.some(([p]) => p.toLowerCase() === "soapaction") || s.push(["SOAPAction", `"${n(l.action)}"`]));
859
+ const u = $n(l, n);
860
+ return {
861
+ method: e.method.toUpperCase(),
862
+ url: c,
863
+ headers: s,
864
+ body: u,
865
+ contentType: f,
866
+ note: a
867
+ };
868
+ }
869
+ function $n(e, t) {
870
+ switch (e.kind) {
871
+ case "json":
872
+ case "xml":
873
+ return { ...e, text: t(e.text) };
874
+ case "text":
875
+ return { ...e, text: t(e.text) };
876
+ case "form":
877
+ return {
878
+ ...e,
879
+ fields: e.fields.filter(L).map((n) => ({ ...n, key: t(n.key), value: t(n.value) }))
880
+ };
881
+ case "multipart":
882
+ return {
883
+ ...e,
884
+ parts: e.parts.filter(L).map((n) => ({ ...n, key: t(n.key), value: t(n.value) }))
885
+ };
886
+ case "graphql":
887
+ return {
888
+ ...e,
889
+ query: t(e.query),
890
+ variables: e.variables === void 0 ? void 0 : t(e.variables)
891
+ };
892
+ case "soap":
893
+ return { ...e, envelope: t(e.envelope) };
894
+ default:
895
+ return e;
896
+ }
897
+ }
898
+ const re = (e) => JSON.stringify(e), F = (e) => `@"${e.replace(/"/g, '""')}"`, te = (e) => `'${e.replace(/'/g, "''")}'`, Y = (e) => JSON.stringify(e);
899
+ function Ct(e, t) {
900
+ return e.split(`
901
+ `).map((n, r) => r === 0 ? n : t + n).join(`
902
+ `);
903
+ }
904
+ function Ut(e) {
905
+ try {
906
+ return JSON.stringify(JSON.parse(e), null, 2);
907
+ } catch {
908
+ return;
909
+ }
910
+ }
911
+ function wn(e) {
912
+ const t = [];
913
+ e.note && t.push(`// ${e.note}`);
914
+ let n = "", r;
915
+ const s = [...e.headers], o = s.some(([a]) => a.toLowerCase() === "content-type");
916
+ switch (e.body.kind) {
917
+ case "json": {
918
+ const a = Ut(e.body.text);
919
+ r = a ? `JSON.stringify(${Ct(a, " ")})` : re(e.body.text), o || s.push(["Content-Type", "application/json"]);
920
+ break;
921
+ }
922
+ case "form":
923
+ n = `const body = new URLSearchParams();
924
+ ${e.body.fields.map((a) => `body.append(${re(a.key)}, ${re(a.value)});`).join(`
925
+ `)}
926
+
927
+ `, r = "body";
928
+ break;
929
+ case "multipart":
930
+ n = `const body = new FormData();
931
+ ${e.body.parts.map(
932
+ (a) => a.type === "file" ? `body.append(${re(a.key)}, fileInput.files[0]); // ${a.fileName ?? "file"}` : `body.append(${re(a.key)}, ${re(a.value)});`
933
+ ).join(`
934
+ `)}
935
+
936
+ `, r = "body";
937
+ for (let a = s.length - 1; a >= 0; a--)
938
+ s[a][0].toLowerCase() === "content-type" && s.splice(a, 1);
939
+ break;
940
+ case "binary":
941
+ r = `file // ${e.body.fileName ?? "a File or Blob"}`, !o && e.contentType && s.push(["Content-Type", e.contentType]);
942
+ break;
943
+ case "none":
944
+ break;
945
+ default:
946
+ r = re(oe(e.body) ?? ""), !o && e.contentType && s.push(["Content-Type", e.contentType]);
947
+ }
948
+ n && t.push(n.trimEnd(), "");
949
+ const i = [` method: ${re(e.method)},`];
950
+ return s.length && i.push(
951
+ ` headers: {
952
+ ${s.map(([a, c]) => ` ${re(a)}: ${re(c)},`).join(`
953
+ `)}
954
+ },`
955
+ ), r && i.push(` body: ${r},`), t.push(`const response = await fetch(${re(e.url)}, {
956
+ ${i.join(`
957
+ `)}
958
+ });`), t.push("const data = await response.text();"), t.join(`
959
+ `);
960
+ }
961
+ const vn = /* @__PURE__ */ new Set([
962
+ "content-type",
963
+ "content-length",
964
+ "content-encoding",
965
+ "content-language",
966
+ "content-disposition"
967
+ ]);
968
+ function An(e) {
969
+ const t = [];
970
+ e.note && t.push(`// ${e.note}`), t.push("using System.Net.Http;", "using System.Text;", ""), t.push("using var client = new HttpClient();");
971
+ const r = ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "TRACE"].includes(e.method) ? `HttpMethod.${e.method[0]}${e.method.slice(1).toLowerCase()}` : `new HttpMethod(${F(e.method)})`;
972
+ t.push(`using var request = new HttpRequestMessage(${r}, ${F(e.url)});`);
973
+ for (const [o, i] of e.headers)
974
+ vn.has(o.toLowerCase()) || t.push(`request.Headers.TryAddWithoutValidation(${F(o)}, ${F(i)});`);
975
+ const s = (e.contentType ?? "text/plain").split(";")[0].trim();
976
+ switch (e.body.kind) {
977
+ case "none":
978
+ break;
979
+ case "form":
980
+ t.push(
981
+ "request.Content = new FormUrlEncodedContent(new Dictionary<string, string>",
982
+ "{",
983
+ ...e.body.fields.map((o) => ` [${F(o.key)}] = ${F(o.value)},`),
984
+ "});"
985
+ );
986
+ break;
987
+ case "multipart":
988
+ t.push("var form = new MultipartFormDataContent();");
989
+ for (const o of e.body.parts)
990
+ t.push(
991
+ o.type === "file" ? `form.Add(new StreamContent(File.OpenRead(${F(o.fileName ?? "file")})), ${F(o.key)}, ${F(o.fileName ?? "file")});` : `form.Add(new StringContent(${F(o.value)}), ${F(o.key)});`
992
+ );
993
+ t.push("request.Content = form;");
994
+ break;
995
+ case "binary":
996
+ t.push(
997
+ `request.Content = new StreamContent(File.OpenRead(${F(e.body.fileName ?? "file")}));`
998
+ ), t.push(
999
+ `request.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(${F(s)});`
1000
+ );
1001
+ break;
1002
+ default:
1003
+ t.push(
1004
+ `request.Content = new StringContent(${F(oe(e.body) ?? "")}, Encoding.UTF8, ${F(s)});`
1005
+ );
1006
+ }
1007
+ return t.push(
1008
+ "",
1009
+ "using var response = await client.SendAsync(request);",
1010
+ "response.EnsureSuccessStatusCode();",
1011
+ "var body = await response.Content.ReadAsStringAsync();"
1012
+ ), t.join(`
1013
+ `);
1014
+ }
1015
+ function xn(e) {
1016
+ const t = [];
1017
+ e.note && t.push(`# ${e.note}`);
1018
+ const n = e.headers.filter(([s]) => s.toLowerCase() !== "content-type");
1019
+ n.length && t.push("$headers = @{", ...n.map(([s, o]) => ` ${te(s)} = ${te(o)}`), "}");
1020
+ const r = [`-Uri ${te(e.url)}`, `-Method ${e.method[0]}${e.method.slice(1).toLowerCase()}`];
1021
+ switch (n.length && r.push("-Headers $headers"), e.body.kind) {
1022
+ case "none":
1023
+ break;
1024
+ case "form":
1025
+ t.push("$body = @{", ...e.body.fields.map((s) => ` ${te(s.key)} = ${te(s.value)}`), "}"), r.push("-Body $body");
1026
+ break;
1027
+ case "multipart":
1028
+ t.push(
1029
+ "$form = @{",
1030
+ ...e.body.parts.map(
1031
+ (s) => s.type === "file" ? ` ${te(s.key)} = Get-Item ${te(s.fileName ?? "file")}` : ` ${te(s.key)} = ${te(s.value)}`
1032
+ ),
1033
+ "}"
1034
+ ), r.push("-Form $form");
1035
+ break;
1036
+ case "binary":
1037
+ r.push(`-InFile ${te(e.body.fileName ?? "file")}`), e.contentType && r.push(`-ContentType ${te(e.contentType)}`);
1038
+ break;
1039
+ default:
1040
+ t.push(`$body = @'
1041
+ ${oe(e.body) ?? ""}
1042
+ '@`), r.push("-Body $body"), e.contentType && r.push(`-ContentType ${te(e.contentType)}`);
1043
+ }
1044
+ return t.push(`$response = Invoke-RestMethod ${r.join(" ")}`), t.join(`
1045
+ `);
1046
+ }
1047
+ function Tn(e) {
1048
+ const t = [];
1049
+ e.note && t.push(`# ${e.note}`), t.push("import requests", "");
1050
+ const n = [` ${Y(e.method)},`, ` ${Y(e.url)},`], r = [...e.headers];
1051
+ switch (e.body.kind) {
1052
+ case "none":
1053
+ break;
1054
+ case "json": {
1055
+ const s = Ut(e.body.text);
1056
+ if (s) {
1057
+ const o = s.replace(/\btrue\b/g, "True").replace(/\bfalse\b/g, "False").replace(/\bnull\b/g, "None");
1058
+ n.push(` json=${Ct(o, " ")},`);
1059
+ for (let i = r.length - 1; i >= 0; i--)
1060
+ r[i][0].toLowerCase() === "content-type" && r.splice(i, 1);
1061
+ } else
1062
+ n.push(` data=${Y(e.body.text)},`);
1063
+ break;
1064
+ }
1065
+ case "form":
1066
+ n.push(
1067
+ ` data={${e.body.fields.map((s) => `${Y(s.key)}: ${Y(s.value)}`).join(", ")}},`
1068
+ );
1069
+ break;
1070
+ case "multipart": {
1071
+ const s = e.body.parts.filter((i) => i.type === "file"), o = e.body.parts.filter((i) => i.type !== "file");
1072
+ o.length && n.push(` data={${o.map((i) => `${Y(i.key)}: ${Y(i.value)}`).join(", ")}},`), s.length && n.push(
1073
+ ` files={${s.map((i) => `${Y(i.key)}: open(${Y(i.fileName ?? "file")}, "rb")`).join(", ")}},`
1074
+ );
1075
+ for (let i = r.length - 1; i >= 0; i--)
1076
+ r[i][0].toLowerCase() === "content-type" && r.splice(i, 1);
1077
+ break;
1078
+ }
1079
+ case "binary":
1080
+ n.push(` data=open(${Y(e.body.fileName ?? "file")}, "rb"),`);
1081
+ break;
1082
+ default:
1083
+ n.push(` data=${Y(oe(e.body) ?? "")},`), e.contentType && !r.some(([s]) => s.toLowerCase() === "content-type") && r.push(["Content-Type", e.contentType]);
1084
+ }
1085
+ return r.length && n.splice(
1086
+ 2,
1087
+ 0,
1088
+ ` headers={
1089
+ ${r.map(([s, o]) => ` ${Y(s)}: ${Y(o)},`).join(`
1090
+ `)}
1091
+ },`
1092
+ ), t.push(
1093
+ `response = requests.request(
1094
+ ${n.join(`
1095
+ `)}
1096
+ )`,
1097
+ "print(response.status_code, response.text)"
1098
+ ), t.join(`
1099
+ `);
1100
+ }
1101
+ function Sn(e, t, n = {}) {
1102
+ switch (t) {
1103
+ case "curl":
1104
+ return He(e, { ...n, shell: "bash" });
1105
+ case "curl-cmd":
1106
+ return He(e, { ...n, shell: "cmd" });
1107
+ case "curl-powershell":
1108
+ return He(e, { ...n, shell: "powershell" });
1109
+ case "fetch":
1110
+ return wn(Ue(e, n));
1111
+ case "csharp":
1112
+ return An(Ue(e, n));
1113
+ case "powershell":
1114
+ return xn(Ue(e, n));
1115
+ case "python":
1116
+ return Tn(Ue(e, n));
1117
+ default:
1118
+ return "";
1119
+ }
1120
+ }
1121
+ class Z extends Error {
1122
+ constructor(t, n) {
1123
+ super(`${t} (line ${n})`), this.line = n, this.name = "NiceYamlError";
1124
+ }
1125
+ }
1126
+ function ht(e) {
1127
+ let t = null;
1128
+ for (let n = 0; n < e.length; n++) {
1129
+ const r = e[n];
1130
+ if (t) {
1131
+ if (r === t) {
1132
+ if (t === "'" && e[n + 1] === "'") {
1133
+ n++;
1134
+ continue;
1135
+ }
1136
+ t = null;
1137
+ } else r === "\\" && t === '"' && n++;
1138
+ continue;
1139
+ }
1140
+ if ((r === '"' || r === "'") && (n === 0 || /[\s:[{,-]/.test(e[n - 1])))
1141
+ t = r;
1142
+ else if (r === "#" && (n === 0 || /\s/.test(e[n - 1])))
1143
+ return e.slice(0, n).trimEnd();
1144
+ }
1145
+ return e.trimEnd();
1146
+ }
1147
+ const jn = /* @__PURE__ */ new Set(["", "~", "null", "Null", "NULL"]);
1148
+ function at(e) {
1149
+ if (jn.has(e))
1150
+ return null;
1151
+ if (/^(true|True|TRUE)$/.test(e))
1152
+ return !0;
1153
+ if (/^(false|False|FALSE)$/.test(e))
1154
+ return !1;
1155
+ if (/^[-+]?[0-9]+$/.test(e)) {
1156
+ const t = Number(e);
1157
+ return Number.isSafeInteger(t) ? t : e;
1158
+ }
1159
+ return /^0x[0-9a-fA-F]+$/.test(e) ? parseInt(e.slice(2), 16) : /^0o[0-7]+$/.test(e) ? parseInt(e.slice(2), 8) : /^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$/.test(e) ? Number(e) : /^[-+]?\.(inf|Inf|INF)$/.test(e) ? e.startsWith("-") ? -1 / 0 : 1 / 0 : /^\.(nan|NaN|NAN)$/.test(e) ? NaN : e;
1160
+ }
1161
+ function Ke(e, t) {
1162
+ let n = "";
1163
+ for (let r = 0; r < e.length; r++) {
1164
+ const s = e[r];
1165
+ if (s !== "\\") {
1166
+ n += s;
1167
+ continue;
1168
+ }
1169
+ const o = e[++r], i = {
1170
+ n: `
1171
+ `,
1172
+ t: " ",
1173
+ r: "\r",
1174
+ 0: "\0",
1175
+ '"': '"',
1176
+ "\\": "\\",
1177
+ "/": "/",
1178
+ " ": " ",
1179
+ b: "\b",
1180
+ f: "\f",
1181
+ e: "\x1B",
1182
+ a: "\x07",
1183
+ v: "\v",
1184
+ N: "…",
1185
+ _: " "
1186
+ };
1187
+ if (o in i)
1188
+ n += i[o];
1189
+ else if (o === "x" || o === "u" || o === "U") {
1190
+ const a = o === "x" ? 2 : o === "u" ? 4 : 8, c = e.slice(r + 1, r + 1 + a);
1191
+ if (!/^[0-9a-fA-F]+$/.test(c) || c.length !== a)
1192
+ throw new Z("Bad escape", t);
1193
+ n += String.fromCodePoint(parseInt(c, 16)), r += a;
1194
+ } else if (o !== `
1195
+ `) throw new Z(`Unknown escape \\${o}`, t);
1196
+ }
1197
+ return n;
1198
+ }
1199
+ function De(e) {
1200
+ let t = "", n = 0;
1201
+ return e.forEach((r, s) => {
1202
+ const o = s === 0 ? r.trimEnd() : s === e.length - 1 ? r.trimStart() : r.trim();
1203
+ if (s > 0 && o === "" && s < e.length - 1) {
1204
+ n++;
1205
+ return;
1206
+ }
1207
+ s > 0 && (t += n ? `
1208
+ `.repeat(n) : " "), n = 0, t += o;
1209
+ }), t;
1210
+ }
1211
+ class Nn {
1212
+ constructor(t) {
1213
+ be(this, "lines");
1214
+ be(this, "i", 0);
1215
+ be(this, "anchors", /* @__PURE__ */ new Map());
1216
+ this.lines = t.replace(/^\uFEFF/, "").replace(/\r\n?/g, `
1217
+ `).split(`
1218
+ `).map((n, r) => {
1219
+ const s = n.length - n.replace(/^ +/, "").length, o = n.slice(s);
1220
+ if (o.startsWith(" "))
1221
+ throw new Z("Tabs cannot indent YAML", r + 1);
1222
+ return { indent: s, raw: o, text: ht(o), num: r + 1 };
1223
+ });
1224
+ }
1225
+ skipBlank() {
1226
+ for (; this.i < this.lines.length && this.lines[this.i].text === ""; )
1227
+ this.i++;
1228
+ }
1229
+ current() {
1230
+ return this.skipBlank(), this.lines[this.i];
1231
+ }
1232
+ parseDocument() {
1233
+ let t = this.current();
1234
+ for (; t && (t.text.startsWith("%") || t.text === "---" || t.text.startsWith("--- ")); ) {
1235
+ if (t.text.startsWith("--- ")) {
1236
+ this.lines[this.i] = {
1237
+ ...t,
1238
+ raw: t.raw.slice(4),
1239
+ text: t.text.slice(4),
1240
+ indent: t.indent + 4
1241
+ };
1242
+ break;
1243
+ }
1244
+ this.i++, t = this.current();
1245
+ }
1246
+ if (!t || t.text === "...")
1247
+ return null;
1248
+ const n = this.parseBlock(-1), r = this.current();
1249
+ if (r && r.text !== "..." && r.text !== "---")
1250
+ throw new Z(`Unexpected text: ${r.text.slice(0, 40)}`, r.num);
1251
+ return n;
1252
+ }
1253
+ /** The node starting at the current line (indented deeper than its parent). */
1254
+ parseBlock(t) {
1255
+ const n = this.current();
1256
+ return !n || n.indent <= t ? null : n.text === "-" || n.text.startsWith("- ") ? this.parseSequence(n.indent) : this.splitKey(n.text) ? this.parseMapping(n.indent) : (this.i++, this.parseValue(n.text, t, n));
1257
+ }
1258
+ /** `key: rest` when the text is a mapping entry (the key may be quoted). */
1259
+ splitKey(t) {
1260
+ if (t.startsWith('"') || t.startsWith("'")) {
1261
+ const s = t[0];
1262
+ let o = 1;
1263
+ for (; o < t.length; ) {
1264
+ if (t[o] === "\\" && s === '"') {
1265
+ o += 2;
1266
+ continue;
1267
+ }
1268
+ if (t[o] === s) {
1269
+ if (s === "'" && t[o + 1] === "'") {
1270
+ o += 2;
1271
+ continue;
1272
+ }
1273
+ break;
1274
+ }
1275
+ o++;
1276
+ }
1277
+ const i = t.slice(o + 1), a = /^\s*:(\s|$)/.exec(i);
1278
+ if (!a)
1279
+ return null;
1280
+ const c = t.slice(1, o);
1281
+ return { key: s === '"' ? Ke(c, 0) : c.replace(/''/g, "'"), rest: i.slice(a[0].length).trim() };
1282
+ }
1283
+ if (/^[[{]/.test(t) || /^\?\s+(.*)$/.exec(t))
1284
+ return null;
1285
+ const r = /^(.*?)\s*:(?:\s+|$)/.exec(t);
1286
+ return !r || r[1] === "" || r[1].includes(" #") ? null : { key: r[1], rest: t.slice(r[0].length).trim() };
1287
+ }
1288
+ parseMapping(t) {
1289
+ const n = {};
1290
+ for (let s = this.current(); s && s.indent === t; s = this.current()) {
1291
+ const o = this.splitKey(s.text);
1292
+ if (!o) {
1293
+ if (s.text === "-" || s.text.startsWith("- "))
1294
+ break;
1295
+ throw new Z(`Expected "key: value": ${s.text.slice(0, 40)}`, s.num);
1296
+ }
1297
+ this.i++;
1298
+ const i = this.parseValue(o.rest, t, s, !0);
1299
+ if (o.key === "<<") {
1300
+ const a = Array.isArray(i) ? i : [i];
1301
+ for (const c of a)
1302
+ if (c && typeof c == "object" && !Array.isArray(c))
1303
+ for (const [l, f] of Object.entries(c))
1304
+ l in n || (n[l] = f);
1305
+ } else
1306
+ n[o.key] = i;
1307
+ }
1308
+ const r = this.current();
1309
+ if (r && r.indent > t)
1310
+ throw new Z("Bad indentation", r.num);
1311
+ return n;
1312
+ }
1313
+ parseSequence(t) {
1314
+ const n = [];
1315
+ for (let r = this.current(); r && r.indent === t && (r.text === "-" || r.text.startsWith("- ")); r = this.current()) {
1316
+ const s = r.text === "-" ? "" : r.text.slice(2).trimStart(), o = t + (r.text.length - s.length);
1317
+ if (s === "") {
1318
+ this.i++, n.push(this.parseNested(t));
1319
+ continue;
1320
+ }
1321
+ if (!this.takeAnchor(s).anchor && (s === "-" || s.startsWith("- ") || this.splitKey(s))) {
1322
+ this.lines[this.i] = {
1323
+ ...r,
1324
+ indent: o,
1325
+ raw: r.raw.slice(o - r.indent),
1326
+ text: s
1327
+ }, n.push(
1328
+ s === "-" || s.startsWith("- ") ? this.parseSequence(o) : this.parseMapping(o)
1329
+ );
1330
+ continue;
1331
+ }
1332
+ this.i++, n.push(this.parseValue(s, t, r));
1333
+ }
1334
+ return n;
1335
+ }
1336
+ takeAnchor(t) {
1337
+ let n = t, r;
1338
+ for (; ; ) {
1339
+ const s = /^&([^\s[\]{},]+)\s*/.exec(n);
1340
+ if (s) {
1341
+ r = s[1], n = n.slice(s[0].length);
1342
+ continue;
1343
+ }
1344
+ const o = /^!!?[^\s]*\s*/.exec(n);
1345
+ if (o && n.startsWith("!")) {
1346
+ n = n.slice(o[0].length);
1347
+ continue;
1348
+ }
1349
+ return { anchor: r, rest: n };
1350
+ }
1351
+ }
1352
+ /** The block under a line whose value part is empty. */
1353
+ parseNested(t, n = !1) {
1354
+ const r = this.current();
1355
+ return r ? r.indent > t ? this.parseBlock(t) : n && r.indent === t && (r.text === "-" || r.text.startsWith("- ")) ? this.parseSequence(t) : null : null;
1356
+ }
1357
+ /** The value after `key:` or `- ` (already advanced past its line). */
1358
+ parseValue(t, n, r, s = !1) {
1359
+ const { anchor: o, rest: i } = this.takeAnchor(t);
1360
+ let a;
1361
+ if (i === "")
1362
+ a = this.parseNested(n, s);
1363
+ else if (i.startsWith("*")) {
1364
+ const c = i.slice(1).trim();
1365
+ if (!this.anchors.has(c))
1366
+ throw new Z(`Unknown alias *${c}`, r.num);
1367
+ a = this.anchors.get(c);
1368
+ } else /^[|>]/.test(i) ? a = this.parseBlockScalar(i, n, r) : i.startsWith("[") || i.startsWith("{") ? a = this.parseFlowLines(i, r) : i.startsWith('"') || i.startsWith("'") ? a = this.parseQuotedLines(i, r) : a = this.parsePlainLines(i, n);
1369
+ return o && this.anchors.set(o, a), a;
1370
+ }
1371
+ parseBlockScalar(t, n, r) {
1372
+ const s = /^([|>])([1-9])?([-+])?([1-9])?\s*$/.exec(t);
1373
+ if (!s)
1374
+ throw new Z(`Bad block scalar header ${t}`, r.num);
1375
+ const o = s[1] === ">", i = s[3] ?? "", a = Number(s[2] ?? s[4] ?? 0), c = [];
1376
+ let l = a ? n + a : -1;
1377
+ for (; this.i < this.lines.length; ) {
1378
+ const d = this.lines[this.i], p = d.raw.trim() === "";
1379
+ if (!p) {
1380
+ if (l < 0) {
1381
+ if (d.indent <= n)
1382
+ break;
1383
+ l = d.indent;
1384
+ }
1385
+ if (d.indent < l)
1386
+ break;
1387
+ }
1388
+ c.push(p ? "" : " ".repeat(d.indent - l) + d.raw), this.i++;
1389
+ }
1390
+ let f = 0;
1391
+ for (; c.length && c[c.length - 1] === ""; )
1392
+ c.pop(), f++;
1393
+ let u;
1394
+ return o ? (u = "", c.forEach((d, p) => {
1395
+ if (p === 0) {
1396
+ u = d;
1397
+ return;
1398
+ }
1399
+ const b = c[p - 1], $ = d.startsWith(" ") || b.startsWith(" ");
1400
+ d === "" ? u += `
1401
+ ` : b === "" || $ ? u += (b === "" ? "" : `
1402
+ `) + d : u += ` ${d}`;
1403
+ })) : u = c.join(`
1404
+ `), c.length ? i === "-" ? u : i === "+" ? `${u}
1405
+ ${`
1406
+ `.repeat(f)}` : `${u}
1407
+ ` : i === "+" ? `
1408
+ `.repeat(f) : "";
1409
+ }
1410
+ /** A quoted scalar that may run over several lines. */
1411
+ parseQuotedLines(t, n) {
1412
+ const r = t[0], s = [];
1413
+ let o = t.slice(1), i = n.num;
1414
+ for (; ; ) {
1415
+ const a = this.findClosingQuote(o, r);
1416
+ if (a >= 0) {
1417
+ s.push(o.slice(0, a));
1418
+ const l = ht(o.slice(a + 1)).trim();
1419
+ if (l)
1420
+ throw new Z(`Text after a quoted scalar: ${l.slice(0, 20)}`, i);
1421
+ break;
1422
+ }
1423
+ if (s.push(o), this.i >= this.lines.length)
1424
+ throw new Z("Unclosed quote", n.num);
1425
+ const c = this.lines[this.i++];
1426
+ o = c.raw, i = c.num;
1427
+ }
1428
+ if (r === '"') {
1429
+ const a = [];
1430
+ for (const c of s)
1431
+ a.length && a[a.length - 1].endsWith("\\") && !a[a.length - 1].endsWith("\\\\") ? a[a.length - 1] = a[a.length - 1].slice(0, -1) + c.trimStart() : a.push(c);
1432
+ return Ke(De(a), n.num);
1433
+ }
1434
+ return De(s).replace(/''/g, "'");
1435
+ }
1436
+ findClosingQuote(t, n) {
1437
+ for (let r = 0; r < t.length; r++) {
1438
+ if (n === '"' && t[r] === "\\") {
1439
+ r++;
1440
+ continue;
1441
+ }
1442
+ if (t[r] === n) {
1443
+ if (n === "'" && t[r + 1] === "'") {
1444
+ r++;
1445
+ continue;
1446
+ }
1447
+ return r;
1448
+ }
1449
+ }
1450
+ return -1;
1451
+ }
1452
+ /** A plain scalar and its more-indented continuation lines. */
1453
+ parsePlainLines(t, n) {
1454
+ const r = [t];
1455
+ for (; this.i < this.lines.length; ) {
1456
+ const s = this.lines[this.i];
1457
+ if (s.text === "") {
1458
+ let o = this.i;
1459
+ for (; o < this.lines.length && this.lines[o].text === ""; )
1460
+ o++;
1461
+ const i = this.lines[o];
1462
+ if (i && i.indent > n && !this.splitKey(i.text) && !i.text.startsWith("- ")) {
1463
+ r.push(...Array.from({ length: o - this.i }, () => "")), this.i = o;
1464
+ continue;
1465
+ }
1466
+ break;
1467
+ }
1468
+ if (s.indent <= n || this.splitKey(s.text) || s.text.startsWith("- "))
1469
+ break;
1470
+ r.push(s.text), this.i++;
1471
+ }
1472
+ return r.length === 1 ? at(t) : De(r);
1473
+ }
1474
+ /** A flow collection, gathering lines until its brackets close. */
1475
+ parseFlowLines(t, n) {
1476
+ let r = t;
1477
+ for (; !On(r); ) {
1478
+ if (this.i >= this.lines.length)
1479
+ throw new Z("Unclosed flow collection", n.num);
1480
+ r += ` ${this.lines[this.i++].text}`;
1481
+ }
1482
+ const s = new Cn(r, n.num, this.anchors), o = s.parseValue();
1483
+ if (s.skipSpace(), !s.atEnd())
1484
+ throw new Z("Text after a flow collection", n.num);
1485
+ return o;
1486
+ }
1487
+ }
1488
+ function On(e) {
1489
+ let t = 0, n = null;
1490
+ for (let r = 0; r < e.length; r++) {
1491
+ const s = e[r];
1492
+ if (n) {
1493
+ s === "\\" && n === '"' ? r++ : s === n && (n = null);
1494
+ continue;
1495
+ }
1496
+ s === '"' || s === "'" ? n = s : s === "[" || s === "{" ? t++ : (s === "]" || s === "}") && t--;
1497
+ }
1498
+ return t <= 0 && !n;
1499
+ }
1500
+ class Cn {
1501
+ constructor(t, n, r) {
1502
+ be(this, "pos", 0);
1503
+ this.text = t, this.line = n, this.anchors = r;
1504
+ }
1505
+ atEnd() {
1506
+ return this.pos >= this.text.length;
1507
+ }
1508
+ skipSpace() {
1509
+ for (; this.pos < this.text.length && /\s/.test(this.text[this.pos]); )
1510
+ this.pos++;
1511
+ }
1512
+ fail(t) {
1513
+ throw new Z(t, this.line);
1514
+ }
1515
+ parseValue() {
1516
+ this.skipSpace();
1517
+ const t = this.text[this.pos];
1518
+ if (t === "[")
1519
+ return this.parseSeq();
1520
+ if (t === "{")
1521
+ return this.parseMap();
1522
+ if (t === '"' || t === "'")
1523
+ return this.parseQuoted();
1524
+ if (t === "*") {
1525
+ this.pos++;
1526
+ const n = /^[^\s,\]}]+/.exec(this.text.slice(this.pos));
1527
+ return this.pos += (n == null ? void 0 : n[0].length) ?? 0, this.anchors.get((n == null ? void 0 : n[0]) ?? "");
1528
+ }
1529
+ return at(this.parsePlain(!1));
1530
+ }
1531
+ parseQuoted() {
1532
+ const t = this.text[this.pos++];
1533
+ let n = "";
1534
+ for (; this.pos < this.text.length; ) {
1535
+ const r = this.text[this.pos];
1536
+ if (t === '"' && r === "\\") {
1537
+ n += r + this.text[this.pos + 1], this.pos += 2;
1538
+ continue;
1539
+ }
1540
+ if (r === t) {
1541
+ if (t === "'" && this.text[this.pos + 1] === "'") {
1542
+ n += "'", this.pos += 2;
1543
+ continue;
1544
+ }
1545
+ return this.pos++, t === '"' ? Ke(n, this.line) : n;
1546
+ }
1547
+ n += r, this.pos++;
1548
+ }
1549
+ return this.fail("Unclosed quote");
1550
+ }
1551
+ parsePlain(t) {
1552
+ const n = this.pos;
1553
+ for (; this.pos < this.text.length; ) {
1554
+ const r = this.text[this.pos];
1555
+ if (r === "," || r === "]" || r === "}" || r === ":" && (t || /[\s,\]}]/.test(this.text[this.pos + 1] ?? " ")))
1556
+ break;
1557
+ this.pos++;
1558
+ }
1559
+ return this.text.slice(n, this.pos).trim();
1560
+ }
1561
+ parseSeq() {
1562
+ this.pos++;
1563
+ const t = [];
1564
+ for (; ; ) {
1565
+ if (this.skipSpace(), this.text[this.pos] === "]")
1566
+ return this.pos++, t;
1567
+ t.push(this.parseValue()), this.skipSpace(), this.text[this.pos] === "," ? this.pos++ : this.text[this.pos] !== "]" && this.fail("Expected , or ]");
1568
+ }
1569
+ }
1570
+ parseMap() {
1571
+ this.pos++;
1572
+ const t = {};
1573
+ for (; ; ) {
1574
+ if (this.skipSpace(), this.text[this.pos] === "}")
1575
+ return this.pos++, t;
1576
+ const n = this.text[this.pos], r = n === '"' || n === "'" ? this.parseQuoted() : this.parsePlain(!0);
1577
+ this.skipSpace();
1578
+ let s = null;
1579
+ this.text[this.pos] === ":" && (this.pos++, this.skipSpace(), s = this.text[this.pos] === "," || this.text[this.pos] === "}" ? null : this.parseValue()), t[String(r)] = s, this.skipSpace(), this.text[this.pos] === "," ? this.pos++ : this.text[this.pos] !== "}" && this.fail("Expected , or }");
1580
+ }
1581
+ }
1582
+ }
1583
+ function Un(e) {
1584
+ return new Nn(e).parseDocument();
1585
+ }
1586
+ function _t(e) {
1587
+ for (let t = 0; t < e.length; t++) {
1588
+ const n = e.charCodeAt(t);
1589
+ if (n < 32 && n !== 9 && n !== 10 && n !== 13)
1590
+ return !0;
1591
+ }
1592
+ return !1;
1593
+ }
1594
+ const _n = /^[-?:,[\]{}#&*!|>'"%@`]/;
1595
+ function Et(e) {
1596
+ return e === "" || e !== e.trim() || _n.test(e) || /: |:$| #|[\t\n\r]/.test(e) || _t(e) || typeof at(e) != "string";
1597
+ }
1598
+ function En(e) {
1599
+ if (e == null)
1600
+ return "null";
1601
+ if (typeof e == "number")
1602
+ return Number.isNaN(e) ? ".nan" : Number.isFinite(e) ? String(e) : e > 0 ? ".inf" : "-.inf";
1603
+ if (typeof e == "boolean")
1604
+ return String(e);
1605
+ const t = String(e);
1606
+ return Et(t) ? JSON.stringify(t) : t;
1607
+ }
1608
+ function qn(e) {
1609
+ return Et(e) ? JSON.stringify(e) : e;
1610
+ }
1611
+ function yt(e) {
1612
+ return Array.isArray(e) ? e.length > 0 : !!e && typeof e == "object" && Object.keys(e).length > 0;
1613
+ }
1614
+ function Je(e, t, n, r) {
1615
+ const s = " ".repeat(t);
1616
+ if (Array.isArray(e)) {
1617
+ if (!e.length) {
1618
+ n.push(`${r}[]`);
1619
+ return;
1620
+ }
1621
+ r && n.push(r.trimEnd());
1622
+ for (const o of e)
1623
+ if (yt(o)) {
1624
+ const i = [];
1625
+ Je(o, t + 2, i, ""), n.push(`${s}- ${i[0].trimStart()}`, ...i.slice(1));
1626
+ } else
1627
+ Me(o, t, n, `${s}- `);
1628
+ return;
1629
+ }
1630
+ if (e && typeof e == "object") {
1631
+ const o = Object.entries(e).filter(([, i]) => i !== void 0);
1632
+ if (!o.length) {
1633
+ n.push(`${r}{}`);
1634
+ return;
1635
+ }
1636
+ r && n.push(r.trimEnd());
1637
+ for (const [i, a] of o) {
1638
+ const c = `${s}${qn(i)}:`;
1639
+ yt(a) ? Je(a, Array.isArray(a) ? t : t + 2, n, c) : Me(a, t, n, `${c} `);
1640
+ }
1641
+ return;
1642
+ }
1643
+ Me(e, t, n, r);
1644
+ }
1645
+ function Me(e, t, n, r) {
1646
+ if (Array.isArray(e)) {
1647
+ n.push(`${r}[]`);
1648
+ return;
1649
+ }
1650
+ if (e && typeof e == "object") {
1651
+ n.push(`${r}{}`);
1652
+ return;
1653
+ }
1654
+ if (typeof e == "string" && e.includes(`
1655
+ `) && !_t(e)) {
1656
+ const s = e.endsWith(`
1657
+ `), o = (s ? e.slice(0, -1) : e).split(`
1658
+ `), i = o[0].startsWith(" "), a = " ".repeat(t + 2), c = s ? e.endsWith(`
1659
+
1660
+ `) ? "+" : "" : "-";
1661
+ n.push(`${r}|${i ? "2" : ""}${c}`);
1662
+ for (const l of o)
1663
+ n.push(l ? a + l : "");
1664
+ return;
1665
+ }
1666
+ n.push(r + En(e));
1667
+ }
1668
+ function In(e) {
1669
+ const t = [];
1670
+ return Je(e, 0, t, ""), `${t.join(`
1671
+ `)}
1672
+ `;
1673
+ }
1674
+ function Qe(e, t = Un) {
1675
+ const n = e.trimStart();
1676
+ if (n.startsWith("{") || n.startsWith("["))
1677
+ try {
1678
+ return JSON.parse(n);
1679
+ } catch {
1680
+ }
1681
+ return t(e);
1682
+ }
1683
+ function qt(e) {
1684
+ return (t) => {
1685
+ var r;
1686
+ const n = (r = /^#\/(?:components\/schemas|definitions)\/(.+)$/.exec(t)) == null ? void 0 : r[1];
1687
+ return n ? e == null ? void 0 : e[decodeURIComponent(n.replace(/~1/g, "/").replace(/~0/g, "~"))] : void 0;
1688
+ };
1689
+ }
1690
+ function Ln(e) {
1691
+ if (Array.isArray(e.type))
1692
+ return e.type.find((t) => t !== "null") ?? e.type[0];
1693
+ if (e.type)
1694
+ return e.type;
1695
+ if (e.properties || e.additionalProperties)
1696
+ return "object";
1697
+ if (e.items)
1698
+ return "array";
1699
+ }
1700
+ function Pn(e, t) {
1701
+ switch (e.format) {
1702
+ case "email":
1703
+ return "user@example.com";
1704
+ case "date":
1705
+ return t().toISOString().slice(0, 10);
1706
+ case "date-time":
1707
+ return t().toISOString();
1708
+ case "time":
1709
+ return t().toISOString().slice(11, 19);
1710
+ case "uuid":
1711
+ return "3fa85f64-5717-4562-b3fc-2c963f66afa6";
1712
+ case "uri":
1713
+ case "url":
1714
+ return "https://example.com";
1715
+ case "hostname":
1716
+ return "example.com";
1717
+ case "ipv4":
1718
+ return "192.168.0.1";
1719
+ case "ipv6":
1720
+ return "::1";
1721
+ case "byte":
1722
+ return "U3dhZ2dlciByb2Nrcw==";
1723
+ case "binary":
1724
+ return "";
1725
+ case "password":
1726
+ return "********";
1727
+ default: {
1728
+ const n = e.title ?? "string";
1729
+ return e.minLength && n.length < e.minLength ? n.padEnd(e.minLength, "x") : e.maxLength && n.length > e.maxLength ? n.slice(0, e.maxLength) : n;
1730
+ }
1731
+ }
1732
+ }
1733
+ function It(e, t = {}) {
1734
+ const n = t.maxDepth ?? 6, r = t.arrayItems ?? 1, s = t.now ?? (() => /* @__PURE__ */ new Date()), o = (i, a, c) => {
1735
+ var f, u, d, p, b, $;
1736
+ if (!i)
1737
+ return null;
1738
+ if (i.$ref) {
1739
+ if (c.has(i.$ref) || a > n)
1740
+ return null;
1741
+ const h = (f = t.resolveRef) == null ? void 0 : f.call(t, i.$ref);
1742
+ return h ? o(h, a, /* @__PURE__ */ new Set([...c, i.$ref])) : null;
1743
+ }
1744
+ if (i.example !== void 0)
1745
+ return i.example;
1746
+ if ((u = i.examples) != null && u.length)
1747
+ return i.examples[0];
1748
+ if (i.const !== void 0)
1749
+ return i.const;
1750
+ if (i.default !== void 0)
1751
+ return i.default;
1752
+ if ((d = i.enum) != null && d.length)
1753
+ return i.enum[0];
1754
+ if ((p = i.allOf) != null && p.length) {
1755
+ const h = {};
1756
+ let v;
1757
+ for (const k of i.allOf) {
1758
+ const T = o(k, a, c);
1759
+ T && typeof T == "object" && !Array.isArray(T) ? Object.assign(h, T) : T != null && (v = T);
1760
+ }
1761
+ return i.properties && Object.assign(h, o({ ...i, allOf: void 0 }, a, c)), Object.keys(h).length ? h : v ?? null;
1762
+ }
1763
+ const l = ((b = i.oneOf) == null ? void 0 : b[0]) ?? (($ = i.anyOf) == null ? void 0 : $[0]);
1764
+ if (l)
1765
+ return o(l, a, c);
1766
+ switch (Ln(i)) {
1767
+ case "string":
1768
+ return Pn(i, s);
1769
+ case "integer":
1770
+ return i.minimum ?? 0;
1771
+ case "number":
1772
+ return i.minimum ?? 0;
1773
+ case "boolean":
1774
+ return !0;
1775
+ case "array":
1776
+ return a >= n ? [] : Array.from({ length: r }, () => o(i.items, a + 1, c));
1777
+ case "object": {
1778
+ if (a >= n)
1779
+ return {};
1780
+ const h = {};
1781
+ for (const [v, k] of Object.entries(i.properties ?? {}))
1782
+ t.usage === "request" && k.readOnly || t.usage === "response" && k.writeOnly || (h[v] = o(k, a + 1, c));
1783
+ return !i.properties && i.additionalProperties && typeof i.additionalProperties == "object" && (h.key = o(i.additionalProperties, a + 1, c)), h;
1784
+ }
1785
+ case "null":
1786
+ return null;
1787
+ default:
1788
+ return null;
1789
+ }
1790
+ };
1791
+ return o(e, 0, /* @__PURE__ */ new Set());
1792
+ }
1793
+ function Ge(e) {
1794
+ if (e === null)
1795
+ return { type: "null" };
1796
+ if (Array.isArray(e))
1797
+ return e.length ? { type: "array", items: Ge(e[0]) } : { type: "array" };
1798
+ switch (typeof e) {
1799
+ case "string":
1800
+ return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(e) ? { type: "string", format: "date-time" } : /^\d{4}-\d{2}-\d{2}$/.test(e) ? { type: "string", format: "date" } : /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e) ? { type: "string", format: "uuid" } : /^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e) ? { type: "string", format: "email" } : { type: "string" };
1801
+ case "number":
1802
+ return { type: Number.isInteger(e) ? "integer" : "number" };
1803
+ case "boolean":
1804
+ return { type: "boolean" };
1805
+ case "object": {
1806
+ const t = {};
1807
+ for (const [n, r] of Object.entries(e))
1808
+ t[n] = Ge(r);
1809
+ return { type: "object", properties: t };
1810
+ }
1811
+ default:
1812
+ return {};
1813
+ }
1814
+ }
1815
+ function qr(e, t) {
1816
+ var l;
1817
+ const n = (l = e.examples) == null ? void 0 : l[0];
1818
+ if (n) {
1819
+ const f = {};
1820
+ for (const u of n.headers ?? [])
1821
+ f[u.key] = u.value;
1822
+ return { status: n.status, headers: f, body: n.body ?? "" };
1823
+ }
1824
+ const r = Object.entries(e.responses ?? {}), [s, o] = r.find(([f]) => /^2\d\d$/.test(f)) ?? r.find(([f]) => f === "default") ?? ["200", void 0], i = /^\d{3}$/.test(s) ? Number(s) : 200;
1825
+ if (!o)
1826
+ return { status: i, headers: {}, body: "" };
1827
+ const a = o.contentType ?? "application/json";
1828
+ let c = o.example ?? "";
1829
+ if (!c && o.schema) {
1830
+ const f = It(o.schema, {
1831
+ resolveRef: qt(t == null ? void 0 : t.schemas),
1832
+ usage: "response"
1833
+ });
1834
+ c = typeof f == "string" ? f : JSON.stringify(f, null, 2);
1835
+ }
1836
+ return { status: i, headers: { "Content-Type": a }, body: c };
1837
+ }
1838
+ const O = (e) => !!e && typeof e == "object" && !Array.isArray(e), z = (e) => typeof e == "string" ? e : void 0, Lt = ["get", "put", "post", "delete", "options", "head", "patch", "trace"], Rn = ["query", "path", "header", "cookie"];
1839
+ function gt(e, t) {
1840
+ const n = t.indexOf("#"), r = n >= 0 ? t.slice(n + 1) : "";
1841
+ if (!r || r === "/")
1842
+ return e;
1843
+ let s = e;
1844
+ for (const o of r.split("/").slice(1)) {
1845
+ const i = decodeURIComponent(o).replace(/~1/g, "/").replace(/~0/g, "~");
1846
+ if (O(s))
1847
+ s = s[i];
1848
+ else if (Array.isArray(s))
1849
+ s = s[Number(i)];
1850
+ else
1851
+ return;
1852
+ }
1853
+ return s;
1854
+ }
1855
+ function ue(e) {
1856
+ return e == null ? "" : typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" ? String(e) : JSON.stringify(e);
1857
+ }
1858
+ function ze(e) {
1859
+ const t = Object.keys(e), n = [
1860
+ (r) => r === "application/json",
1861
+ (r) => /\+json$|\/json/.test(r),
1862
+ (r) => r === "application/x-www-form-urlencoded",
1863
+ (r) => r === "multipart/form-data",
1864
+ (r) => /xml/.test(r),
1865
+ (r) => r.startsWith("text/"),
1866
+ () => !0
1867
+ ];
1868
+ for (const r of n) {
1869
+ const s = t.find(r);
1870
+ if (s)
1871
+ return [s, O(e[s]) ? e[s] : {}];
1872
+ }
1873
+ }
1874
+ function Hn(e, t = {}) {
1875
+ var x, E, H;
1876
+ let n = typeof e == "string" ? Qe(e, t.parseYaml) : e;
1877
+ if (!O(n))
1878
+ throw new Error("Not an OpenAPI document");
1879
+ if (typeof n.swagger == "string")
1880
+ n = Dn(n);
1881
+ else if (typeof n.openapi != "string")
1882
+ throw new Error('Not an OpenAPI document: no "openapi" or "swagger" version');
1883
+ const r = n, s = t.baseUrlVariable ?? "baseUrl", o = /* @__PURE__ */ new Map(), i = (m) => {
1884
+ var A;
1885
+ if (m.startsWith("#"))
1886
+ return gt(r, m);
1887
+ const y = m.split("#")[0];
1888
+ if (!o.has(y)) {
1889
+ const U = (A = t.resolveRef) == null ? void 0 : A.call(t, y);
1890
+ o.set(
1891
+ y,
1892
+ typeof U == "string" ? Qe(U, t.parseYaml) : U
1893
+ );
1894
+ }
1895
+ return gt(o.get(y), m);
1896
+ }, a = (m) => {
1897
+ let y = m;
1898
+ for (let A = 0; A < 20 && O(y) && typeof y.$ref == "string"; A++)
1899
+ y = i(y.$ref);
1900
+ return y;
1901
+ }, c = (m, y = 0) => {
1902
+ if (!O(m))
1903
+ return;
1904
+ if (typeof m.$ref == "string")
1905
+ return /^#\/components\/schemas\//.test(m.$ref) ? { $ref: m.$ref } : y > 12 ? {} : c(i(m.$ref), y + 1);
1906
+ const A = { ...m };
1907
+ if (O(m.properties)) {
1908
+ A.properties = {};
1909
+ for (const [U, C] of Object.entries(m.properties))
1910
+ A.properties[U] = c(C, y + 1) ?? {};
1911
+ }
1912
+ m.items !== void 0 && (A.items = c(m.items, y + 1)), O(m.additionalProperties) && (A.additionalProperties = c(m.additionalProperties, y + 1));
1913
+ for (const U of ["allOf", "oneOf", "anyOf"]) {
1914
+ const C = m[U];
1915
+ Array.isArray(C) && (A[U] = C.map((q) => c(q, y + 1) ?? {}));
1916
+ }
1917
+ return A;
1918
+ }, l = O(r.components) ? r.components : {}, f = {};
1919
+ if (O(l.schemas))
1920
+ for (const [m, y] of Object.entries(l.schemas))
1921
+ f[m] = c(y) ?? {};
1922
+ const u = qt(f), d = (m) => {
1923
+ if (!O(m))
1924
+ return;
1925
+ const y = Object.values(m)[0], A = a(y);
1926
+ return O(A) ? A.value : void 0;
1927
+ }, p = /* @__PURE__ */ new Map(), b = (m, y = !1) => (p.has(m) || p.set(m, { key: m, value: "", secret: y || void 0 }), `{{${m}}}`), $ = O(l.securitySchemes) ? l.securitySchemes : {}, h = (m, y) => {
1928
+ const A = a($[m]);
1929
+ if (!O(A))
1930
+ return;
1931
+ const U = m.replace(/[^\w.-]/g, "_");
1932
+ switch (A.type) {
1933
+ case "apiKey": {
1934
+ const C = A.in === "query" || A.in === "cookie" ? A.in : "header";
1935
+ return {
1936
+ type: "apiKey",
1937
+ key: z(A.name) ?? "X-API-Key",
1938
+ value: b(U, !0),
1939
+ in: C
1940
+ };
1941
+ }
1942
+ case "http": {
1943
+ const C = (z(A.scheme) ?? "").toLowerCase();
1944
+ return C === "basic" ? {
1945
+ type: "basic",
1946
+ username: b("username"),
1947
+ password: b("password", !0)
1948
+ } : C === "digest" ? {
1949
+ type: "digest",
1950
+ username: b("username"),
1951
+ password: b("password", !0)
1952
+ } : C === "bearer" ? { type: "bearer", token: b(U, !0) } : {
1953
+ type: "custom",
1954
+ headers: [
1955
+ {
1956
+ key: "Authorization",
1957
+ value: `${z(A.scheme) ?? ""} ${b(U, !0)}`
1958
+ }
1959
+ ]
1960
+ };
1961
+ }
1962
+ case "oauth2": {
1963
+ const C = O(A.flows) ? A.flows : {}, I = ["authorizationCode", "clientCredentials", "password", "implicit"].find((se) => O(C[se])) ?? "clientCredentials", D = C[I] ?? {}, W = Array.isArray(y) && y.length ? y.join(" ") : void 0;
1964
+ return {
1965
+ type: "oauth2",
1966
+ grant: I,
1967
+ tokenUrl: z(D.tokenUrl),
1968
+ authUrl: z(D.authorizationUrl),
1969
+ clientId: b("clientId"),
1970
+ clientSecret: I === "implicit" ? void 0 : b("clientSecret", !0),
1971
+ scope: W,
1972
+ usePkce: I === "authorizationCode" || void 0,
1973
+ username: I === "password" ? b("username") : void 0,
1974
+ password: I === "password" ? b("password", !0) : void 0
1975
+ };
1976
+ }
1977
+ case "openIdConnect":
1978
+ return {
1979
+ type: "oauth2",
1980
+ grant: "authorizationCode",
1981
+ authUrl: z(A.openIdConnectUrl),
1982
+ clientId: b("clientId"),
1983
+ usePkce: !0,
1984
+ scope: Array.isArray(y) && y.length ? y.join(" ") : "openid"
1985
+ };
1986
+ case "mutualTLS":
1987
+ return { type: "mtls" };
1988
+ default:
1989
+ return;
1990
+ }
1991
+ }, v = (m) => {
1992
+ if (Array.isArray(m)) {
1993
+ if (!m.length)
1994
+ return { type: "none" };
1995
+ for (const y of m) {
1996
+ if (!O(y))
1997
+ continue;
1998
+ const A = Object.keys(y);
1999
+ if (!A.length)
2000
+ return { type: "none" };
2001
+ const U = h(A[0], y[A[0]]);
2002
+ if (U)
2003
+ return U;
2004
+ }
2005
+ }
2006
+ }, k = (m) => {
2007
+ var W, se;
2008
+ const y = a(m);
2009
+ if (!O(y) || typeof y.name != "string")
2010
+ return null;
2011
+ const A = Rn.find((ie) => ie === y.in);
2012
+ if (!A || A === "header" && /^(accept|content-type|authorization)$/i.test(y.name))
2013
+ return null;
2014
+ const U = c(y.schema) ?? (O(y.content) ? c((W = ze(y.content)) == null ? void 0 : W[1].schema) : void 0), C = U != null && U.$ref ? u(U.$ref) : U, q = y.example ?? d(y.examples) ?? (C == null ? void 0 : C.example) ?? (C == null ? void 0 : C.default) ?? ((se = C == null ? void 0 : C.enum) == null ? void 0 : se[0]), I = A === "path" || y.required === !0, D = { key: y.name, value: ue(q), in: A };
2015
+ return I && (D.required = !0), !I && q === void 0 && (D.enabled = !1), typeof y.description == "string" && (D.description = y.description), U && (D.schema = U), typeof y.style == "string" && (D.style = y.style), typeof y.explode == "boolean" && (D.explode = y.explode), D;
2016
+ }, T = (m, y) => {
2017
+ const A = c(y.schema), U = y.example ?? d(y.examples), C = U !== void 0 ? U : It(A, { resolveRef: u, usage: "request" }), q = (I) => {
2018
+ const D = I != null && I.$ref ? u(I.$ref) : I;
2019
+ return (D == null ? void 0 : D.properties) ?? {};
2020
+ };
2021
+ if (m === "application/x-www-form-urlencoded") {
2022
+ const I = O(C) ? C : {};
2023
+ return {
2024
+ kind: "form",
2025
+ fields: (Object.keys(I).length ? Object.keys(I) : Object.keys(q(A))).map((W) => ({ key: W, value: ue(I[W]) }))
2026
+ };
2027
+ }
2028
+ if (m.startsWith("multipart/")) {
2029
+ const I = O(C) ? C : {};
2030
+ return {
2031
+ kind: "multipart",
2032
+ parts: Object.entries(q(A)).map(([D, W]) => {
2033
+ var ie;
2034
+ return W.format === "binary" || W.format === "base64" || W.contentMediaType !== void 0 || W.type === "array" && ((ie = W.items) == null ? void 0 : ie.format) === "binary" ? { key: D, value: "", type: "file" } : { key: D, value: ue(I[D]), type: "text" };
2035
+ })
2036
+ };
2037
+ }
2038
+ return /json/.test(m) ? {
2039
+ kind: "json",
2040
+ text: typeof C == "string" ? C : JSON.stringify(C ?? {}, null, 2)
2041
+ } : m === "application/graphql" ? { kind: "graphql", query: ue(C) } : /xml/.test(m) ? { kind: "xml", text: typeof C == "string" ? C : "" } : m.startsWith("text/") ? {
2042
+ kind: "text",
2043
+ text: ue(C),
2044
+ contentType: m === "text/plain" ? void 0 : m
2045
+ } : { kind: "binary", contentType: m };
2046
+ }, g = (m) => {
2047
+ const y = a(m);
2048
+ if (!O(y))
2049
+ return {};
2050
+ const A = {};
2051
+ typeof y.description == "string" && (A.description = y.description);
2052
+ const U = O(y.content) ? ze(y.content) : void 0;
2053
+ if (U) {
2054
+ const [C, q] = U;
2055
+ A.contentType = C;
2056
+ const I = c(q.schema);
2057
+ I && (A.schema = I);
2058
+ const D = q.example ?? d(q.examples);
2059
+ D !== void 0 && (A.example = typeof D == "string" ? D : JSON.stringify(D, null, 2));
2060
+ }
2061
+ return O(y.headers) && (A.headers = Object.entries(y.headers).map(([C, q]) => {
2062
+ const I = a(q);
2063
+ return { key: C, value: "", description: O(I) ? z(I.description) : void 0 };
2064
+ })), A;
2065
+ }, S = v(r.security), w = [], N = O(r.paths) ? r.paths : {};
2066
+ for (const [m, y] of Object.entries(N)) {
2067
+ const A = a(y);
2068
+ if (!O(A))
2069
+ continue;
2070
+ const U = Array.isArray(A.parameters) ? A.parameters : [];
2071
+ for (const C of Lt) {
2072
+ const q = A[C];
2073
+ if (!O(q))
2074
+ continue;
2075
+ const I = [];
2076
+ for (const G of [...U, ...Array.isArray(q.parameters) ? q.parameters : []]) {
2077
+ const ce = k(G);
2078
+ if (!ce)
2079
+ continue;
2080
+ const lt = I.findIndex((ut) => ut.key === ce.key && ut.in === ce.in);
2081
+ lt >= 0 ? I[lt] = ce : I.push(ce);
2082
+ }
2083
+ let D = { kind: "none" };
2084
+ const W = a(q.requestBody);
2085
+ if (O(W) && O(W.content)) {
2086
+ const G = ze(W.content);
2087
+ G && (D = T(G[0], G[1]), ((x = Ne(D)) == null ? void 0 : x.split(";")[0]) !== G[0] && D.kind !== "multipart" && I.push({ key: "Content-Type", value: G[0], in: "header" }));
2088
+ }
2089
+ const se = {};
2090
+ if (O(q.responses))
2091
+ for (const [G, ce] of Object.entries(q.responses))
2092
+ se[G] = g(ce);
2093
+ const ie = (E = Object.entries(se).find(([G]) => /^2/.test(G))) == null ? void 0 : E[1];
2094
+ ie != null && ie.contentType && ie.contentType !== "*/*" && I.push({ key: "Accept", value: ie.contentType, in: "header" });
2095
+ let Ce = v(q.security);
2096
+ Ce && S && JSON.stringify(Ce) === JSON.stringify(S) && (Ce = void 0);
2097
+ const le = Array.isArray(q.tags) ? q.tags.filter((G) => typeof G == "string") : void 0, Jt = ye({
2098
+ name: z(q.summary) ?? z(q.operationId) ?? `${C.toUpperCase()} ${m}`,
2099
+ method: C.toUpperCase(),
2100
+ url: `{{${s}}}${m}`,
2101
+ params: I,
2102
+ body: D,
2103
+ auth: Ce,
2104
+ description: z(q.description),
2105
+ operationId: z(q.operationId),
2106
+ tags: le != null && le.length ? le : void 0,
2107
+ deprecated: q.deprecated === !0 || void 0,
2108
+ responses: Object.keys(se).length ? se : void 0
2109
+ });
2110
+ w.push({ request: Jt, tag: le == null ? void 0 : le[0], segment: m.split("/").filter(Boolean)[0] });
2111
+ }
2112
+ }
2113
+ const P = [], R = t.groupBy ?? "tag";
2114
+ if (R === "none")
2115
+ P.push(...w.map((m) => m.request));
2116
+ else {
2117
+ const m = /* @__PURE__ */ new Map(), y = Array.isArray(r.tags) ? r.tags.filter(O) : [];
2118
+ if (R === "tag")
2119
+ for (const A of y)
2120
+ typeof A.name == "string" && m.set(A.name, Ae({ name: A.name, description: z(A.description) }));
2121
+ for (const { request: A, tag: U, segment: C } of w) {
2122
+ const q = R === "tag" ? U : C;
2123
+ if (!q) {
2124
+ P.push(A);
2125
+ continue;
2126
+ }
2127
+ m.has(q) || m.set(q, Ae({ name: q })), m.get(q).items.push(A);
2128
+ }
2129
+ P.unshift(...[...m.values()].filter((A) => A.items.length));
2130
+ }
2131
+ const M = (Array.isArray(r.servers) ? r.servers.filter(O) : []).map((m) => {
2132
+ let y = z(m.url) ?? "";
2133
+ if (O(m.variables))
2134
+ for (const [A, U] of Object.entries(m.variables))
2135
+ O(U) && (y = y.split(`{${A}}`).join(ue(U.default)));
2136
+ return { url: y, description: z(m.description) };
2137
+ }), j = O(r.info) ? r.info : {};
2138
+ return je({
2139
+ name: z(j.title) ?? "API",
2140
+ description: z(j.description),
2141
+ version: j.version === void 0 ? void 0 : ue(j.version),
2142
+ items: P,
2143
+ variables: [{ key: s, value: ((H = M[0]) == null ? void 0 : H.url) ?? "" }, ...p.values()],
2144
+ auth: S,
2145
+ servers: M.length ? M : void 0,
2146
+ schemas: Object.keys(f).length ? f : void 0
2147
+ });
2148
+ }
2149
+ function Dn(e) {
2150
+ const t = (h) => {
2151
+ if (Array.isArray(h))
2152
+ return h.map(t);
2153
+ if (!O(h))
2154
+ return h;
2155
+ const v = {};
2156
+ for (const [k, T] of Object.entries(h))
2157
+ v[k] = k === "$ref" && typeof T == "string" ? T.replace("#/definitions/", "#/components/schemas/").replace("#/responses/", "#/components/responses/") : t(T);
2158
+ return v;
2159
+ }, n = t(e), r = Array.isArray(n.consumes) ? n.consumes : ["application/json"], s = Array.isArray(n.produces) ? n.produces : ["application/json"], o = O(n.parameters) ? n.parameters : {}, i = (h) => {
2160
+ if (O(h)) {
2161
+ if (typeof h.$ref == "string" && h.$ref.startsWith("#/parameters/")) {
2162
+ const v = o[h.$ref.slice(13)];
2163
+ return O(v) ? v : void 0;
2164
+ }
2165
+ return h;
2166
+ }
2167
+ }, a = (h) => {
2168
+ const v = {};
2169
+ for (const k of [
2170
+ "type",
2171
+ "format",
2172
+ "items",
2173
+ "enum",
2174
+ "default",
2175
+ "minimum",
2176
+ "maximum",
2177
+ "pattern",
2178
+ "minLength",
2179
+ "maxLength"
2180
+ ])
2181
+ h[k] !== void 0 && (v[k] = h[k]);
2182
+ return v.type === "file" && (v.type = "string", v.format = "binary"), v;
2183
+ }, c = (h, v) => {
2184
+ if (!O(h) || typeof h.$ref == "string")
2185
+ return h;
2186
+ const k = { description: h.description ?? "" };
2187
+ if (h.schema !== void 0) {
2188
+ const T = O(h.examples) ? h.examples : {};
2189
+ k.content = Object.fromEntries(
2190
+ v.map((g) => [
2191
+ g,
2192
+ T[g] !== void 0 ? { schema: h.schema, example: T[g] } : { schema: h.schema }
2193
+ ])
2194
+ );
2195
+ }
2196
+ return O(h.headers) && (k.headers = Object.fromEntries(
2197
+ Object.entries(h.headers).map(([T, g]) => [
2198
+ T,
2199
+ O(g) ? { description: g.description, schema: a(g) } : g
2200
+ ])
2201
+ )), k;
2202
+ }, l = (h, v) => {
2203
+ const k = Array.isArray(h.consumes) ? h.consumes : r, T = { ...h };
2204
+ delete T.consumes, delete T.produces, delete T.schemes;
2205
+ const g = [], S = [];
2206
+ for (const w of [...v, ...Array.isArray(h.parameters) ? h.parameters : []]) {
2207
+ const N = i(w);
2208
+ if (N)
2209
+ if (N.in === "body")
2210
+ T.requestBody = {
2211
+ description: N.description,
2212
+ required: N.required,
2213
+ content: Object.fromEntries(k.map((P) => [P, { schema: N.schema }]))
2214
+ };
2215
+ else if (N.in === "formData")
2216
+ S.push(N);
2217
+ else {
2218
+ const P = {
2219
+ name: N.name,
2220
+ in: N.in,
2221
+ description: N.description,
2222
+ required: N.required,
2223
+ schema: a(N)
2224
+ };
2225
+ N["x-example"] !== void 0 && (P.example = N["x-example"]), g.push(P);
2226
+ }
2227
+ }
2228
+ if (S.length) {
2229
+ const N = k.includes("multipart/form-data") || S.some((R) => R.type === "file") ? "multipart/form-data" : "application/x-www-form-urlencoded", P = S.filter((R) => R.required).map((R) => String(R.name));
2230
+ T.requestBody = {
2231
+ content: {
2232
+ [N]: {
2233
+ schema: {
2234
+ type: "object",
2235
+ properties: Object.fromEntries(
2236
+ S.map((R) => [
2237
+ String(R.name),
2238
+ { ...a(R), description: R.description }
2239
+ ])
2240
+ ),
2241
+ ...P.length ? { required: P } : {}
2242
+ }
2243
+ }
2244
+ }
2245
+ };
2246
+ }
2247
+ if (T.parameters = g, O(h.responses)) {
2248
+ const w = Array.isArray(h.produces) ? h.produces : s;
2249
+ T.responses = Object.fromEntries(
2250
+ Object.entries(h.responses).map(([N, P]) => [N, c(P, w)])
2251
+ );
2252
+ }
2253
+ return T;
2254
+ }, f = {};
2255
+ if (O(n.paths))
2256
+ for (const [h, v] of Object.entries(n.paths)) {
2257
+ if (!O(v))
2258
+ continue;
2259
+ const k = Array.isArray(v.parameters) ? v.parameters : [], T = {};
2260
+ for (const [g, S] of Object.entries(v))
2261
+ Lt.includes(g) && O(S) ? T[g] = l(S, k) : g !== "parameters" && (T[g] = S);
2262
+ f[h] = T;
2263
+ }
2264
+ const u = {};
2265
+ if (O(n.securityDefinitions)) {
2266
+ const h = {
2267
+ implicit: "implicit",
2268
+ password: "password",
2269
+ application: "clientCredentials",
2270
+ accessCode: "authorizationCode"
2271
+ };
2272
+ for (const [v, k] of Object.entries(n.securityDefinitions))
2273
+ O(k) && (k.type === "basic" ? u[v] = { type: "http", scheme: "basic", description: k.description } : k.type === "apiKey" ? u[v] = {
2274
+ type: "apiKey",
2275
+ name: k.name,
2276
+ in: k.in,
2277
+ description: k.description
2278
+ } : k.type === "oauth2" && (u[v] = {
2279
+ type: "oauth2",
2280
+ description: k.description,
2281
+ flows: {
2282
+ [h[String(k.flow)] ?? "clientCredentials"]: {
2283
+ authorizationUrl: k.authorizationUrl,
2284
+ tokenUrl: k.tokenUrl,
2285
+ scopes: k.scopes ?? {}
2286
+ }
2287
+ }
2288
+ }));
2289
+ }
2290
+ const d = {};
2291
+ if (O(n.responses))
2292
+ for (const [h, v] of Object.entries(n.responses))
2293
+ d[h] = c(v, s);
2294
+ const p = z(n.host), b = z(n.basePath) ?? "", $ = Array.isArray(n.schemes) && typeof n.schemes[0] == "string" ? n.schemes[0] : "https";
2295
+ return {
2296
+ openapi: "3.0.3",
2297
+ info: n.info,
2298
+ servers: p ? [{ url: `${$}://${p}${b}` }] : b ? [{ url: b }] : void 0,
2299
+ tags: n.tags,
2300
+ security: n.security,
2301
+ paths: f,
2302
+ components: {
2303
+ schemas: n.definitions,
2304
+ responses: d,
2305
+ securitySchemes: u
2306
+ }
2307
+ };
2308
+ }
2309
+ function Mn(e) {
2310
+ switch (e.type) {
2311
+ case "bearer":
2312
+ return { name: "bearerAuth", scheme: { type: "http", scheme: "bearer" }, scopes: [] };
2313
+ case "basic":
2314
+ return { name: "basicAuth", scheme: { type: "http", scheme: "basic" }, scopes: [] };
2315
+ case "digest":
2316
+ return { name: "digestAuth", scheme: { type: "http", scheme: "digest" }, scopes: [] };
2317
+ case "apiKey":
2318
+ return {
2319
+ name: `${e.key.replace(/[^\w.-]/g, "_")}Auth`,
2320
+ scheme: { type: "apiKey", in: e.in, name: e.key },
2321
+ scopes: []
2322
+ };
2323
+ case "oauth2": {
2324
+ const t = (e.scope ?? "").split(/\s+/).filter(Boolean), n = e.grant === "deviceCode" ? "clientCredentials" : e.grant, r = { scopes: Object.fromEntries(t.map((s) => [s, ""])) };
2325
+ return e.tokenUrl && (r.tokenUrl = e.tokenUrl), e.authUrl && (r.authorizationUrl = e.authUrl), { name: "oauth2", scheme: { type: "oauth2", flows: { [n]: r } }, scopes: t };
2326
+ }
2327
+ case "mtls":
2328
+ return { name: "mutualTLS", scheme: { type: "mutualTLS" }, scopes: [] };
2329
+ case "awsSigV4":
2330
+ return {
2331
+ name: "awsSigV4",
2332
+ scheme: {
2333
+ type: "apiKey",
2334
+ in: "header",
2335
+ name: "Authorization",
2336
+ "x-amazon-apigateway-authtype": "awsSigv4"
2337
+ },
2338
+ scopes: []
2339
+ };
2340
+ case "hmac":
2341
+ return {
2342
+ name: "hmacAuth",
2343
+ scheme: { type: "apiKey", in: "header", name: e.header },
2344
+ scopes: []
2345
+ };
2346
+ case "custom": {
2347
+ const t = e.headers.find(L);
2348
+ return t ? {
2349
+ name: `${t.key.replace(/[^\w.-]/g, "_")}Auth`,
2350
+ scheme: { type: "apiKey", in: "header", name: t.key },
2351
+ scopes: []
2352
+ } : void 0;
2353
+ }
2354
+ default:
2355
+ return;
2356
+ }
2357
+ }
2358
+ function Ie(e) {
2359
+ if (e !== void 0)
2360
+ try {
2361
+ return JSON.parse(e);
2362
+ } catch {
2363
+ return e;
2364
+ }
2365
+ }
2366
+ function zn(e, t) {
2367
+ let n = e.split("?")[0].split("#")[0];
2368
+ for (const r of t)
2369
+ if (r && n.startsWith(r)) {
2370
+ n = n.slice(r.length);
2371
+ break;
2372
+ }
2373
+ return n = n.replace(/^[a-z][\w+.-]*:\/\/[^/]*/i, "").replace(/^\{\{[^}]+\}\}/, ""), n = n.replace(/(^|\/):([A-Za-z_][\w-]*)/g, "$1{$2}"), n.startsWith("/") ? n : `/${n}`;
2374
+ }
2375
+ function Bn(e, t) {
2376
+ const n = t == null ? void 0 : t.split(";")[0].trim();
2377
+ switch (e.kind) {
2378
+ case "none":
2379
+ return;
2380
+ case "json": {
2381
+ const r = Ie(e.text);
2382
+ return {
2383
+ content: { [n ?? "application/json"]: { schema: Ge(r), example: r } }
2384
+ };
2385
+ }
2386
+ case "xml":
2387
+ return {
2388
+ content: {
2389
+ [n ?? "application/xml"]: { schema: { type: "string" }, example: e.text }
2390
+ }
2391
+ };
2392
+ case "text":
2393
+ return {
2394
+ content: {
2395
+ [n ?? e.contentType ?? "text/plain"]: {
2396
+ schema: { type: "string" },
2397
+ example: e.text
2398
+ }
2399
+ }
2400
+ };
2401
+ case "form":
2402
+ return {
2403
+ content: {
2404
+ "application/x-www-form-urlencoded": {
2405
+ schema: {
2406
+ type: "object",
2407
+ properties: Object.fromEntries(
2408
+ e.fields.filter(L).map((r) => [r.key, { type: "string", example: r.value || void 0 }])
2409
+ )
2410
+ }
2411
+ }
2412
+ }
2413
+ };
2414
+ case "multipart":
2415
+ return {
2416
+ content: {
2417
+ "multipart/form-data": {
2418
+ schema: {
2419
+ type: "object",
2420
+ properties: Object.fromEntries(
2421
+ e.parts.filter(L).map((r) => [
2422
+ r.key,
2423
+ r.type === "file" ? { type: "string", format: "binary" } : { type: "string", example: r.value || void 0 }
2424
+ ])
2425
+ )
2426
+ }
2427
+ }
2428
+ }
2429
+ };
2430
+ case "binary":
2431
+ return {
2432
+ content: {
2433
+ [n ?? e.contentType ?? "application/octet-stream"]: {
2434
+ schema: { type: "string", format: "binary" }
2435
+ }
2436
+ }
2437
+ };
2438
+ case "graphql":
2439
+ return {
2440
+ content: {
2441
+ "application/json": {
2442
+ schema: {
2443
+ type: "object",
2444
+ properties: {
2445
+ query: { type: "string" },
2446
+ variables: { type: "object" },
2447
+ operationName: { type: "string" }
2448
+ },
2449
+ required: ["query"]
2450
+ },
2451
+ example: Ie(oe(e))
2452
+ }
2453
+ }
2454
+ };
2455
+ case "soap":
2456
+ return {
2457
+ content: { [n ?? "text/xml"]: { schema: { type: "string" }, example: e.envelope } }
2458
+ };
2459
+ default:
2460
+ return;
2461
+ }
2462
+ }
2463
+ function Wn(e, t = {}) {
2464
+ var p, b, $, h, v, k, T;
2465
+ const n = t.baseUrlVariable ?? "baseUrl", r = (p = e.variables.find((g) => g.key === n)) == null ? void 0 : p.value, s = (b = e.servers) != null && b.length ? e.servers : r ? [{ url: r }] : void 0, o = [`{{${n}}}`, ...(s ?? []).map((g) => g.url)], i = {}, a = (g) => {
2466
+ if (!g || g.type === "inherit")
2467
+ return;
2468
+ if (g.type === "none")
2469
+ return e.auth && e.auth.type !== "none" ? [] : void 0;
2470
+ const S = Mn(g);
2471
+ if (S)
2472
+ return i[S.name] = S.scheme, [{ [S.name]: S.scopes }];
2473
+ }, c = a(e.auth), l = {}, f = /* @__PURE__ */ new Map();
2474
+ for (const { request: g, folders: S } of it(e.items)) {
2475
+ const w = zn(g.url, o), N = g.method.toLowerCase();
2476
+ if (l[w] ?? (l[w] = {}), l[w][N])
2477
+ continue;
2478
+ for (const m of S)
2479
+ f.set(m.name, m.description);
2480
+ const P = ($ = g.tags) != null && $.length ? g.tags : S.length ? [S[S.length - 1].name] : void 0, R = g.params.filter((m) => !(m.in === "header" && /^(accept|content-type|authorization)$/i.test(m.key))).map((m) => {
2481
+ const y = { name: m.key, in: m.in };
2482
+ return m.description && (y.description = m.description), (m.in === "path" || m.required) && (y.required = !0), y.schema = m.schema ?? { type: "string" }, m.value && (y.example = m.value), m.style && (y.style = m.style), m.explode !== void 0 && (y.explode = m.explode), y;
2483
+ }), M = (h = g.params.find(
2484
+ (m) => m.in === "header" && /^content-type$/i.test(m.key)
2485
+ )) == null ? void 0 : h.value, j = { summary: g.name };
2486
+ g.operationId && (j.operationId = g.operationId), g.description && (j.description = g.description), P && (j.tags = P), g.deprecated && (j.deprecated = !0), R.length && (j.parameters = R);
2487
+ const x = Bn(g.body, M);
2488
+ x && (j.requestBody = x);
2489
+ const E = {};
2490
+ for (const [m, y] of Object.entries(g.responses ?? {})) {
2491
+ const A = { description: y.description ?? "" };
2492
+ if (y.contentType) {
2493
+ const U = {};
2494
+ y.schema && (U.schema = y.schema), y.example !== void 0 && (U.example = /json/.test(y.contentType) ? Ie(y.example) : y.example), A.content = { [y.contentType]: U };
2495
+ }
2496
+ E[m] = A;
2497
+ }
2498
+ for (const m of g.examples ?? []) {
2499
+ const y = String(m.status);
2500
+ if (E[y])
2501
+ continue;
2502
+ const A = ((T = (k = (v = m.headers) == null ? void 0 : v.find((U) => /^content-type$/i.test(U.key))) == null ? void 0 : k.value) == null ? void 0 : T.split(";")[0]) ?? "application/json";
2503
+ E[y] = {
2504
+ description: m.name,
2505
+ content: { [A]: { example: /json/.test(A) ? Ie(m.body) : m.body } }
2506
+ };
2507
+ }
2508
+ j.responses = Object.keys(E).length ? E : { 200: { description: "OK" } };
2509
+ const H = a(g.auth);
2510
+ H && (j.security = H), l[w][N] = j;
2511
+ }
2512
+ const u = {
2513
+ openapi: "3.1.0",
2514
+ info: {
2515
+ title: e.name,
2516
+ version: e.version ?? "1.0.0",
2517
+ ...e.description ? { description: e.description } : {}
2518
+ }
2519
+ };
2520
+ s && (u.servers = s.map((g) => g.description ? g : { url: g.url })), f.size && (u.tags = [...f].map(
2521
+ ([g, S]) => S ? { name: g, description: S } : { name: g }
2522
+ )), c && (u.security = c), u.paths = l;
2523
+ const d = {};
2524
+ return e.schemas && Object.keys(e.schemas).length && (d.schemas = e.schemas), Object.keys(i).length && (d.securitySchemes = i), Object.keys(d).length && (u.components = d), u;
2525
+ }
2526
+ function Ir(e, t = {}) {
2527
+ return In(Wn(e, t));
2528
+ }
2529
+ const B = (e) => !!e && typeof e == "object" && !Array.isArray(e), _ = (e) => typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" ? String(e) : void 0, ge = (e) => Array.isArray(e) ? e.filter(B) : [], Fn = "https://schema.getpostman.com/json/collection/v2.1.0/collection.json";
2530
+ function Pt(e) {
2531
+ return B(e) && B(e.info) && Array.isArray(e.item);
2532
+ }
2533
+ function he(e) {
2534
+ if (typeof e == "string")
2535
+ return e || void 0;
2536
+ if (B(e))
2537
+ return _(e.content);
2538
+ }
2539
+ function xe(e) {
2540
+ return ge(e).map((t) => {
2541
+ const n = { key: _(t.key) ?? "", value: _(t.value) ?? "" };
2542
+ t.disabled === !0 && (n.enabled = !1);
2543
+ const r = he(t.description);
2544
+ return r && (n.description = r), n;
2545
+ });
2546
+ }
2547
+ function ct(e) {
2548
+ if (!B(e) || typeof e.type != "string")
2549
+ return;
2550
+ const t = e[e.type], n = (r) => {
2551
+ var s;
2552
+ if (Array.isArray(t))
2553
+ return _((s = t.filter(B).find((o) => o.key === r)) == null ? void 0 : s.value);
2554
+ if (B(t))
2555
+ return _(t[r]);
2556
+ };
2557
+ switch (e.type) {
2558
+ case "noauth":
2559
+ return { type: "none" };
2560
+ case "bearer":
2561
+ return { type: "bearer", token: n("token") ?? "" };
2562
+ case "basic":
2563
+ return { type: "basic", username: n("username") ?? "", password: n("password") ?? "" };
2564
+ case "digest":
2565
+ return {
2566
+ type: "digest",
2567
+ username: n("username") ?? "",
2568
+ password: n("password") ?? "",
2569
+ realm: n("realm"),
2570
+ nonce: n("nonce"),
2571
+ qop: n("qop"),
2572
+ algorithm: n("algorithm"),
2573
+ opaque: n("opaque")
2574
+ };
2575
+ case "apikey": {
2576
+ const r = n("in");
2577
+ return {
2578
+ type: "apiKey",
2579
+ key: n("key") ?? "X-API-Key",
2580
+ value: n("value") ?? "",
2581
+ in: r === "query" ? "query" : "header"
2582
+ };
2583
+ }
2584
+ case "oauth2": {
2585
+ const r = n("grant_type") ?? "authorization_code";
2586
+ return {
2587
+ type: "oauth2",
2588
+ grant: r === "client_credentials" ? "clientCredentials" : r === "password_credentials" || r === "password" ? "password" : r === "implicit" ? "implicit" : "authorizationCode",
2589
+ tokenUrl: n("accessTokenUrl"),
2590
+ authUrl: n("authUrl"),
2591
+ clientId: n("clientId") ?? "",
2592
+ clientSecret: n("clientSecret"),
2593
+ scope: n("scope"),
2594
+ username: n("username"),
2595
+ password: n("password"),
2596
+ redirectUri: n("redirect_uri"),
2597
+ usePkce: r === "authorization_code_with_pkce" || void 0,
2598
+ clientAuth: n("client_authentication") === "body" ? "body" : void 0,
2599
+ accessToken: n("accessToken"),
2600
+ tokenType: n("tokenType")
2601
+ };
2602
+ }
2603
+ case "awsv4":
2604
+ return {
2605
+ type: "awsSigV4",
2606
+ accessKeyId: n("accessKey") ?? "",
2607
+ secretAccessKey: n("secretKey") ?? "",
2608
+ region: n("region") ?? "",
2609
+ service: n("service") ?? "",
2610
+ sessionToken: n("sessionToken")
2611
+ };
2612
+ default:
2613
+ return;
2614
+ }
2615
+ }
2616
+ function Vn(e) {
2617
+ if (typeof e == "string") {
2618
+ const { base: o, query: i, hash: a } = pe(e);
2619
+ return { url: o + a, params: i.map((c) => ({ ...c, in: "query" })) };
2620
+ }
2621
+ if (!B(e))
2622
+ return { url: "", params: [] };
2623
+ const t = _(e.raw);
2624
+ let n;
2625
+ if (t !== void 0)
2626
+ n = pe(t).base;
2627
+ else {
2628
+ const o = _(e.protocol), i = Array.isArray(e.host) ? e.host.join(".") : _(e.host) ?? "", a = _(e.port), c = Array.isArray(e.path) ? e.path.map((l) => (B(l) ? _(l.value) : _(l)) ?? "").join("/") : _(e.path) ?? "";
2629
+ n = `${o ? `${o}://` : ""}${i}${a ? `:${a}` : ""}${c ? `/${c.replace(/^\//, "")}` : ""}`;
2630
+ }
2631
+ const r = Array.isArray(e.query) ? xe(e.query).map((o) => ({ ...o, in: "query" })) : t !== void 0 ? pe(t).query.map((o) => ({ ...o, in: "query" })) : [], s = xe(e.variable).map((o) => ({
2632
+ ...o,
2633
+ in: "path",
2634
+ required: !0
2635
+ }));
2636
+ return { url: n, params: [...s, ...r] };
2637
+ }
2638
+ function Kn(e) {
2639
+ if (!B(e))
2640
+ return { kind: "none" };
2641
+ switch (e.mode) {
2642
+ case "raw": {
2643
+ const t = _(e.raw) ?? "", n = B(e.options) && B(e.options.raw) ? _(e.options.raw.language) : void 0;
2644
+ return n === "json" ? { kind: "json", text: t } : n === "xml" ? /<(\w+:)?Envelope[\s>]/.test(t) ? { kind: "soap", envelope: t, version: "1.1" } : { kind: "xml", text: t } : n === "html" ? { kind: "text", text: t, contentType: "text/html" } : n === "javascript" ? { kind: "text", text: t, contentType: "application/javascript" } : !n && /^\s*[[{]/.test(t) ? { kind: "json", text: t } : { kind: "text", text: t };
2645
+ }
2646
+ case "urlencoded":
2647
+ return { kind: "form", fields: xe(e.urlencoded) };
2648
+ case "formdata":
2649
+ return {
2650
+ kind: "multipart",
2651
+ parts: ge(e.formdata).map((t) => {
2652
+ const n = t.type === "file", r = Array.isArray(t.src) ? _(t.src[0]) : _(t.src), s = {
2653
+ key: _(t.key) ?? "",
2654
+ value: n ? "" : _(t.value) ?? "",
2655
+ type: n ? "file" : "text",
2656
+ ...n && r ? { fileName: r } : {},
2657
+ ..._(t.contentType) ? { contentType: _(t.contentType) } : {}
2658
+ };
2659
+ return t.disabled === !0 ? { ...s, enabled: !1 } : s;
2660
+ })
2661
+ };
2662
+ case "file":
2663
+ return { kind: "binary", fileName: B(e.file) ? _(e.file.src) : void 0 };
2664
+ case "graphql": {
2665
+ const t = B(e.graphql) ? e.graphql : {};
2666
+ return { kind: "graphql", query: _(t.query) ?? "", variables: _(t.variables) };
2667
+ }
2668
+ default:
2669
+ return { kind: "none" };
2670
+ }
2671
+ }
2672
+ function Rt(e) {
2673
+ const t = {};
2674
+ for (const n of ge(e)) {
2675
+ const r = B(n.script) ? n.script : {}, s = Array.isArray(r.exec) ? r.exec.map((o) => _(o) ?? "").join(`
2676
+ `) : _(r.exec) ?? "";
2677
+ s.trim() && (n.listen === "prerequest" && (t.preRequest = s), n.listen === "test" && (t.test = s));
2678
+ }
2679
+ return t.preRequest || t.test ? t : void 0;
2680
+ }
2681
+ function Jn(e) {
2682
+ const t = B(e.request) ? e.request : typeof e.request == "string" ? { url: e.request } : {}, { url: n, params: r } = Vn(t.url), s = xe(t.header).map((i) => ({ ...i, in: "header" })), o = ge(e.response).map((i) => ({
2683
+ name: _(i.name) ?? "Example",
2684
+ status: Number(i.code ?? 200) || 200,
2685
+ headers: xe(i.header),
2686
+ body: _(i.body)
2687
+ }));
2688
+ return ye({
2689
+ id: _(e.id) ?? void 0,
2690
+ name: _(e.name) ?? "Request",
2691
+ method: (_(t.method) ?? "GET").toUpperCase(),
2692
+ url: n,
2693
+ params: [...r, ...s],
2694
+ body: Kn(t.body),
2695
+ auth: ct(t.auth),
2696
+ description: he(t.description) ?? he(e.description),
2697
+ scripts: Rt(e.event),
2698
+ examples: o.length ? o : void 0
2699
+ });
2700
+ }
2701
+ function Ht(e) {
2702
+ return ge(e).map(
2703
+ (t) => Array.isArray(t.item) ? Ae({
2704
+ id: _(t.id) ?? void 0,
2705
+ name: _(t.name) ?? "Folder",
2706
+ description: he(t.description),
2707
+ items: Ht(t.item),
2708
+ auth: ct(t.auth)
2709
+ }) : Jn(t)
2710
+ );
2711
+ }
2712
+ function Dt(e) {
2713
+ return ge(e).map((t) => {
2714
+ const n = { key: _(t.key) ?? "", value: _(t.value) ?? "" };
2715
+ t.type === "secret" && (n.secret = !0), (t.disabled === !0 || t.enabled === !1) && (n.enabled = !1);
2716
+ const r = he(t.description);
2717
+ return r && (n.description = r), n;
2718
+ });
2719
+ }
2720
+ function Qn(e) {
2721
+ const t = typeof e == "string" ? JSON.parse(e) : e;
2722
+ if (!Pt(t))
2723
+ throw new Error("Not a Postman collection");
2724
+ const n = t, r = n.info, s = Rt(n.event), o = je({
2725
+ id: _(r._postman_id) ?? void 0,
2726
+ name: _(r.name) ?? "Postman collection",
2727
+ description: he(r.description),
2728
+ version: B(r.version) ? _(r.version.raw) : _(r.version),
2729
+ items: Ht(n.item),
2730
+ variables: Dt(n.variable),
2731
+ auth: ct(n.auth)
2732
+ });
2733
+ if (s) {
2734
+ const i = (a) => a.map(
2735
+ (c) => c.kind === "folder" ? { ...c, items: i(c.items) } : c.scripts ? c : { ...c, scripts: s }
2736
+ );
2737
+ o.items = i(o.items);
2738
+ }
2739
+ return o;
2740
+ }
2741
+ function Gn(e) {
2742
+ const t = typeof e == "string" ? JSON.parse(e) : e;
2743
+ if (!B(t) || !Array.isArray(t.values))
2744
+ throw new Error("Not a Postman environment");
2745
+ return {
2746
+ id: _(t.id) ?? Pe("e"),
2747
+ name: _(t.name) ?? "Environment",
2748
+ values: Dt(t.values)
2749
+ };
2750
+ }
2751
+ const V = (e, t) => ({
2752
+ key: e,
2753
+ value: t ?? "",
2754
+ type: "string"
2755
+ });
2756
+ function Ye(e) {
2757
+ switch (e == null ? void 0 : e.type) {
2758
+ case void 0:
2759
+ case "inherit":
2760
+ return;
2761
+ case "none":
2762
+ return { type: "noauth" };
2763
+ case "bearer":
2764
+ return { type: "bearer", bearer: [V("token", e.token)] };
2765
+ case "basic":
2766
+ return {
2767
+ type: "basic",
2768
+ basic: [V("username", e.username), V("password", e.password)]
2769
+ };
2770
+ case "digest":
2771
+ return {
2772
+ type: "digest",
2773
+ digest: [
2774
+ V("username", e.username),
2775
+ V("password", e.password),
2776
+ ...["realm", "nonce", "qop", "algorithm", "opaque"].filter((t) => e[t]).map((t) => V(t, e[t]))
2777
+ ]
2778
+ };
2779
+ case "apiKey":
2780
+ return {
2781
+ type: "apikey",
2782
+ apikey: [
2783
+ V("key", e.key),
2784
+ V("value", e.value),
2785
+ V("in", e.in === "query" ? "query" : "header")
2786
+ ]
2787
+ };
2788
+ case "oauth2":
2789
+ return {
2790
+ type: "oauth2",
2791
+ oauth2: [
2792
+ ["grant_type", e.grant === "clientCredentials" ? "client_credentials" : e.grant === "password" ? "password_credentials" : e.grant === "implicit" ? "implicit" : e.usePkce ? "authorization_code_with_pkce" : "authorization_code"],
2793
+ ["accessTokenUrl", e.tokenUrl],
2794
+ ["authUrl", e.authUrl],
2795
+ ["clientId", e.clientId],
2796
+ ["clientSecret", e.clientSecret],
2797
+ ["scope", e.scope],
2798
+ ["username", e.username],
2799
+ ["password", e.password],
2800
+ ["redirect_uri", e.redirectUri],
2801
+ ["client_authentication", e.clientAuth],
2802
+ ["accessToken", e.accessToken],
2803
+ ["tokenType", e.tokenType]
2804
+ ].filter(([, r]) => r !== void 0).map(([r, s]) => V(r, s))
2805
+ };
2806
+ case "awsSigV4":
2807
+ return {
2808
+ type: "awsv4",
2809
+ awsv4: [
2810
+ V("accessKey", e.accessKeyId),
2811
+ V("secretKey", e.secretAccessKey),
2812
+ V("region", e.region),
2813
+ V("service", e.service),
2814
+ ...e.sessionToken ? [V("sessionToken", e.sessionToken)] : []
2815
+ ]
2816
+ };
2817
+ default:
2818
+ return;
2819
+ }
2820
+ }
2821
+ const Te = (e) => {
2822
+ const t = { key: e.key, value: e.value };
2823
+ return L(e) || (t.disabled = !0), e.description && (t.description = e.description), t;
2824
+ };
2825
+ function Yn(e) {
2826
+ const t = e.params.filter((u) => u.in === "query"), n = Oe({
2827
+ ...e,
2828
+ params: e.params.filter((u) => u.in === "query" && L(u))
2829
+ }).replace(/%7B%7B(.*?)%7D%7D/g, "{{$1}}").replace(new RegExp("(?<!\\{)\\{([A-Za-z_][\\w.-]*)\\}(?!\\})", "g"), ":$1"), r = pe(e.url).base, s = /^([a-z][\w+.-]*):\/\//i.exec(r), o = s ? r.slice(s[0].length) : r, i = o.indexOf("/"), a = i < 0 ? o : o.slice(0, i), c = i < 0 ? [] : o.slice(i + 1).split("/"), l = {
2830
+ raw: n,
2831
+ host: a ? a.startsWith("{{") ? [a] : a.split(".") : [],
2832
+ path: c.map((u) => u.replace(/^\{([A-Za-z_][\w.-]*)\}$/, ":$1"))
2833
+ };
2834
+ s && (l.protocol = s[1]), t.length && (l.query = t.map(Te));
2835
+ const f = e.params.filter((u) => u.in === "path");
2836
+ return f.length && (l.variable = f.map(Te)), l;
2837
+ }
2838
+ function Xn(e) {
2839
+ switch (e.kind) {
2840
+ case "none":
2841
+ return;
2842
+ case "json":
2843
+ return { mode: "raw", raw: e.text, options: { raw: { language: "json" } } };
2844
+ case "xml":
2845
+ return { mode: "raw", raw: e.text, options: { raw: { language: "xml" } } };
2846
+ case "soap":
2847
+ return { mode: "raw", raw: e.envelope, options: { raw: { language: "xml" } } };
2848
+ case "text":
2849
+ return {
2850
+ mode: "raw",
2851
+ raw: e.text,
2852
+ options: { raw: { language: e.contentType === "text/html" ? "html" : "text" } }
2853
+ };
2854
+ case "form":
2855
+ return { mode: "urlencoded", urlencoded: e.fields.map(Te) };
2856
+ case "multipart":
2857
+ return {
2858
+ mode: "formdata",
2859
+ formdata: e.parts.map((t) => {
2860
+ const n = t.type === "file" ? { key: t.key, type: "file", src: t.fileName ?? "" } : { key: t.key, value: t.value, type: "text" };
2861
+ return t.contentType && (n.contentType = t.contentType), L(t) || (n.disabled = !0), n;
2862
+ })
2863
+ };
2864
+ case "binary":
2865
+ return { mode: "file", file: { src: e.fileName ?? "" } };
2866
+ case "graphql":
2867
+ return { mode: "graphql", graphql: { query: e.query, variables: e.variables ?? "" } };
2868
+ default:
2869
+ return;
2870
+ }
2871
+ }
2872
+ function Zn(e) {
2873
+ const t = [];
2874
+ return e != null && e.preRequest && t.push({
2875
+ listen: "prerequest",
2876
+ script: { type: "text/javascript", exec: e.preRequest.split(`
2877
+ `) }
2878
+ }), e != null && e.test && t.push({
2879
+ listen: "test",
2880
+ script: { type: "text/javascript", exec: e.test.split(`
2881
+ `) }
2882
+ }), t.length ? t : void 0;
2883
+ }
2884
+ function Mt(e) {
2885
+ if (e.kind === "folder") {
2886
+ const a = { name: e.name, item: e.items.map(Mt) };
2887
+ e.description && (a.description = e.description);
2888
+ const c = Ye(e.auth);
2889
+ return c && (a.auth = c), a;
2890
+ }
2891
+ const t = {
2892
+ method: e.method,
2893
+ header: e.params.filter((a) => a.in === "header").map(Te),
2894
+ url: Yn(e)
2895
+ }, n = Xn(e.body);
2896
+ n && (t.body = n);
2897
+ const r = Ye(e.auth);
2898
+ r && (t.auth = r), e.description && (t.description = e.description);
2899
+ const s = e.params.filter((a) => a.in === "cookie" && L(a));
2900
+ s.length && t.header.push({
2901
+ key: "Cookie",
2902
+ value: s.map((a) => `${a.key}=${a.value}`).join("; ")
2903
+ });
2904
+ const o = { name: e.name, request: t }, i = Zn(e.scripts);
2905
+ return i && (o.event = i), o.response = (e.examples ?? []).map((a) => ({
2906
+ name: a.name,
2907
+ code: a.status,
2908
+ header: (a.headers ?? []).map(Te),
2909
+ body: a.body ?? ""
2910
+ })), o;
2911
+ }
2912
+ function Lr(e) {
2913
+ const t = {
2914
+ info: {
2915
+ _postman_id: e.id,
2916
+ name: e.name,
2917
+ ...e.description ? { description: e.description } : {},
2918
+ schema: Fn
2919
+ },
2920
+ item: e.items.map(Mt)
2921
+ };
2922
+ e.variables.length && (t.variable = e.variables.map((r) => {
2923
+ const s = { key: r.key, value: r.value, type: r.secret ? "secret" : "string" };
2924
+ return r.enabled === !1 && (s.disabled = !0), s;
2925
+ }));
2926
+ const n = Ye(e.auth);
2927
+ return n && (t.auth = n), t;
2928
+ }
2929
+ function Pr(e) {
2930
+ return {
2931
+ id: e.id,
2932
+ name: e.name,
2933
+ values: e.values.map((t) => ({
2934
+ key: t.key,
2935
+ value: t.value,
2936
+ type: t.secret ? "secret" : "default",
2937
+ enabled: t.enabled !== !1
2938
+ })),
2939
+ _postman_variable_scope: "environment"
2940
+ };
2941
+ }
2942
+ const fe = (e) => !!e && typeof e == "object" && !Array.isArray(e), K = (e) => typeof e == "string" ? e : void 0, Xe = (e) => Array.isArray(e) ? e.filter(fe) : [], er = /^(image|font|audio|video)\/|^text\/css|javascript|^application\/(x-)?font|wasm/;
2943
+ function ke(e) {
2944
+ return Xe(e).map((t) => ({ key: K(t.name) ?? "", value: K(t.value) ?? "" }));
2945
+ }
2946
+ function zt(e) {
2947
+ return fe(e) && fe(e.log) && Array.isArray(e.log.entries);
2948
+ }
2949
+ function tr(e, t = {}) {
2950
+ const n = typeof e == "string" ? JSON.parse(e) : e;
2951
+ if (!zt(n))
2952
+ throw new Error("Not a HAR log");
2953
+ const r = Xe(n.log.entries), s = t.skipStatic ?? !0, o = [];
2954
+ for (const i of r) {
2955
+ if (t.filter && !t.filter(i))
2956
+ continue;
2957
+ const a = fe(i.request) ? i.request : {}, c = fe(i.response) ? i.response : {}, l = fe(c.content) ? c.content : {}, f = (K(l.mimeType) ?? "").toLowerCase();
2958
+ if (s && er.test(f))
2959
+ continue;
2960
+ const { base: u, query: d } = pe(K(a.url) ?? ""), p = Array.isArray(a.queryString) ? ke(a.queryString) : d, b = ke(a.cookies), $ = ke(a.headers).filter(
2961
+ (w) => !w.key.startsWith(":") && !/^(content-length|host|connection)$/i.test(w.key) && !(b.length && /^cookie$/i.test(w.key))
2962
+ ), h = [
2963
+ ...p.map((w) => ({ ...w, in: "query" })),
2964
+ ...$.map((w) => ({ ...w, in: "header" })),
2965
+ ...b.map((w) => ({ ...w, in: "cookie" }))
2966
+ ];
2967
+ let v = { kind: "none" };
2968
+ const k = fe(a.postData) ? a.postData : void 0;
2969
+ if (k) {
2970
+ const w = K(k.mimeType) ?? "", N = Xe(k.params);
2971
+ N.length && w.includes("multipart") ? v = {
2972
+ kind: "multipart",
2973
+ parts: N.map(
2974
+ (P) => P.fileName !== void 0 ? {
2975
+ key: K(P.name) ?? "",
2976
+ value: "",
2977
+ type: "file",
2978
+ fileName: K(P.fileName),
2979
+ contentType: K(P.contentType)
2980
+ } : { key: K(P.name) ?? "", value: K(P.value) ?? "", type: "text" }
2981
+ )
2982
+ } : N.length ? v = { kind: "form", fields: ke(N) } : K(k.text) !== void 0 && (v = xt(K(k.text) ?? "", w || void 0));
2983
+ }
2984
+ const T = (K(a.method) ?? "GET").toUpperCase(), g = [], S = Number(c.status);
2985
+ if (Number.isFinite(S) && S > 0) {
2986
+ let w = K(l.text);
2987
+ w !== void 0 && l.encoding === "base64" && /json|xml|text|javascript/.test(f) && (w = Nt(w)), g.push({
2988
+ name: `${S} ${K(c.statusText) ?? ""}`.trim(),
2989
+ status: S,
2990
+ headers: ke(c.headers).filter((N) => !N.key.startsWith(":")),
2991
+ body: w
2992
+ });
2993
+ }
2994
+ o.push(
2995
+ ye({
2996
+ name: Ot(T, u),
2997
+ method: T,
2998
+ url: u,
2999
+ params: h,
3000
+ body: v,
3001
+ examples: g.length ? g : void 0
3002
+ })
3003
+ );
3004
+ }
3005
+ return je({ name: t.name ?? "HAR import", items: o });
3006
+ }
3007
+ const Be = (e) => ({ name: e.key, value: e.value });
3008
+ function Rr(e, t = {}) {
3009
+ const n = Array.isArray(e) ? e : it(e.items).map((i) => i.request), r = t.transform ?? ((i) => i), s = (t.now ?? (() => /* @__PURE__ */ new Date()))().toISOString(), o = n.map((i) => {
3010
+ var $, h, v, k, T;
3011
+ const a = Oe(i, r), c = i.params.filter((g) => g.in === "header" && L(g)).map((g) => ({ key: r(g.key), value: r(g.value) })), l = i.params.filter((g) => g.in === "cookie" && L(g)).map((g) => ({ key: r(g.key), value: r(g.value) })), f = (($ = c.find((g) => /^content-type$/i.test(g.key))) == null ? void 0 : $.value) ?? Ne(i.body), u = {
3012
+ method: i.method.toUpperCase(),
3013
+ url: a,
3014
+ httpVersion: "HTTP/1.1",
3015
+ headers: c.map(Be),
3016
+ queryString: i.params.filter((g) => g.in === "query" && L(g)).map((g) => ({ name: r(g.key), value: r(g.value) })),
3017
+ cookies: l.map(Be),
3018
+ headersSize: -1,
3019
+ bodySize: -1
3020
+ }, d = i.body;
3021
+ d.kind === "form" ? u.postData = {
3022
+ mimeType: f,
3023
+ params: d.fields.filter(L).map((g) => ({ name: r(g.key), value: r(g.value) })),
3024
+ text: r(oe(d) ?? "")
3025
+ } : d.kind === "multipart" ? u.postData = {
3026
+ mimeType: f,
3027
+ params: d.parts.filter(L).map(
3028
+ (g) => g.type === "file" ? { name: r(g.key), fileName: g.fileName ?? "", contentType: g.contentType } : { name: r(g.key), value: r(g.value) }
3029
+ )
3030
+ } : d.kind !== "none" && d.kind !== "binary" && (u.postData = { mimeType: f, text: r(oe(d) ?? "") });
3031
+ const p = (h = i.examples) == null ? void 0 : h[0], b = ((k = (v = p == null ? void 0 : p.headers) == null ? void 0 : v.find((g) => /^content-type$/i.test(g.key))) == null ? void 0 : k.value) ?? "";
3032
+ return {
3033
+ startedDateTime: s,
3034
+ time: 0,
3035
+ request: u,
3036
+ response: {
3037
+ status: (p == null ? void 0 : p.status) ?? 0,
3038
+ // the example's name is "201 Created" when it came from a HAR
3039
+ statusText: p ? p.name.replace(new RegExp(`^${p.status}\\s*`), "") : "",
3040
+ httpVersion: "HTTP/1.1",
3041
+ headers: ((p == null ? void 0 : p.headers) ?? []).map(Be),
3042
+ cookies: [],
3043
+ content: {
3044
+ size: ((T = p == null ? void 0 : p.body) == null ? void 0 : T.length) ?? 0,
3045
+ mimeType: b,
3046
+ ...(p == null ? void 0 : p.body) !== void 0 ? { text: p.body } : {}
3047
+ },
3048
+ redirectURL: "",
3049
+ headersSize: -1,
3050
+ bodySize: -1
3051
+ },
3052
+ cache: {},
3053
+ timings: { send: 0, wait: 0, receive: 0 }
3054
+ };
3055
+ });
3056
+ return {
3057
+ log: {
3058
+ version: "1.2",
3059
+ creator: { name: t.creator ?? "Nice2Dev", version: "1" },
3060
+ entries: o
3061
+ }
3062
+ };
3063
+ }
3064
+ const Hr = `query IntrospectionQuery {
3065
+ __schema {
3066
+ queryType { name }
3067
+ mutationType { name }
3068
+ subscriptionType { name }
3069
+ types { ...FullType }
3070
+ }
3071
+ }
3072
+ fragment FullType on __Type {
3073
+ kind
3074
+ name
3075
+ description
3076
+ fields(includeDeprecated: true) {
3077
+ name
3078
+ description
3079
+ args { ...InputValue }
3080
+ type { ...TypeRef }
3081
+ isDeprecated
3082
+ deprecationReason
3083
+ }
3084
+ inputFields { ...InputValue }
3085
+ interfaces { ...TypeRef }
3086
+ enumValues(includeDeprecated: true) { name description isDeprecated }
3087
+ possibleTypes { ...TypeRef }
3088
+ }
3089
+ fragment InputValue on __InputValue {
3090
+ name
3091
+ description
3092
+ type { ...TypeRef }
3093
+ defaultValue
3094
+ }
3095
+ fragment TypeRef on __Type {
3096
+ kind
3097
+ name
3098
+ ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name } } } } } }
3099
+ }`;
3100
+ function nr(e) {
3101
+ var o, i, a, c;
3102
+ const n = typeof e == "string" ? JSON.parse(e) : e, r = ((o = n == null ? void 0 : n.data) == null ? void 0 : o.__schema) ?? (n == null ? void 0 : n.__schema) ?? (Array.isArray(n == null ? void 0 : n.types) ? n : void 0);
3103
+ if (!r || !Array.isArray(r.types))
3104
+ throw new Error("Not a GraphQL introspection result");
3105
+ const s = {};
3106
+ for (const l of r.types)
3107
+ l != null && l.name && (s[l.name] = l);
3108
+ return {
3109
+ queryType: ((i = r.queryType) == null ? void 0 : i.name) ?? void 0,
3110
+ mutationType: ((a = r.mutationType) == null ? void 0 : a.name) ?? void 0,
3111
+ subscriptionType: ((c = r.subscriptionType) == null ? void 0 : c.name) ?? void 0,
3112
+ types: s
3113
+ };
3114
+ }
3115
+ function Ze(e) {
3116
+ return e ? e.kind === "NON_NULL" ? `${Ze(e.ofType)}!` : e.kind === "LIST" ? `[${Ze(e.ofType)}]` : e.name ?? "" : "";
3117
+ }
3118
+ function Bt(e) {
3119
+ let t = e;
3120
+ for (; t && (t.kind === "NON_NULL" || t.kind === "LIST"); )
3121
+ t = t.ofType;
3122
+ return (t == null ? void 0 : t.name) ?? void 0;
3123
+ }
3124
+ function rr(e) {
3125
+ const t = [], n = [
3126
+ ["query", e.queryType],
3127
+ ["mutation", e.mutationType],
3128
+ ["subscription", e.subscriptionType]
3129
+ ];
3130
+ for (const [r, s] of n) {
3131
+ const o = s ? e.types[s] : void 0;
3132
+ for (const i of (o == null ? void 0 : o.fields) ?? [])
3133
+ i.name.startsWith("__") || t.push({ kind: r, field: i });
3134
+ }
3135
+ return t;
3136
+ }
3137
+ function Wt(e, t) {
3138
+ var r;
3139
+ const n = (r = e.types[Bt(t) ?? ""]) == null ? void 0 : r.kind;
3140
+ return n === "SCALAR" || n === "ENUM" || n === void 0;
3141
+ }
3142
+ function sr(e) {
3143
+ var t;
3144
+ return ((t = e.args) == null ? void 0 : t.some((n) => n.type.kind === "NON_NULL" && n.defaultValue == null)) ?? !1;
3145
+ }
3146
+ function et(e, t, n, r) {
3147
+ const s = e.types[Bt(t) ?? ""];
3148
+ if (!s || s.kind === "SCALAR" || s.kind === "ENUM")
3149
+ return "";
3150
+ const o = [];
3151
+ if (s.kind === "UNION" || s.kind === "INTERFACE" && !(s.fields ?? []).length) {
3152
+ o.push(`${r} __typename`);
3153
+ for (const i of s.possibleTypes ?? []) {
3154
+ const a = et(e, i, Math.max(n - 1, 0), `${r} `);
3155
+ a && o.push(`${r} ... on ${i.name} ${a}`);
3156
+ }
3157
+ return `{
3158
+ ${o.join(`
3159
+ `)}
3160
+ ${r}}`;
3161
+ }
3162
+ for (const i of s.fields ?? [])
3163
+ if (!(i.isDeprecated || sr(i))) {
3164
+ if (Wt(e, i.type))
3165
+ o.push(`${r} ${i.name}`);
3166
+ else if (n > 0) {
3167
+ const a = et(e, i.type, n - 1, `${r} `);
3168
+ a && o.push(`${r} ${i.name} ${a}`);
3169
+ }
3170
+ }
3171
+ return o.length || o.push(`${r} __typename`), `{
3172
+ ${o.join(`
3173
+ `)}
3174
+ ${r}}`;
3175
+ }
3176
+ function _e(e, t, n = 0) {
3177
+ var s, o;
3178
+ if (t.kind === "NON_NULL" && t.ofType)
3179
+ return _e(e, t.ofType, n);
3180
+ if (t.kind === "LIST" && t.ofType)
3181
+ return [_e(e, t.ofType, n)];
3182
+ const r = e.types[t.name ?? ""];
3183
+ switch ((r == null ? void 0 : r.kind) ?? "SCALAR") {
3184
+ case "ENUM":
3185
+ return ((o = (s = r == null ? void 0 : r.enumValues) == null ? void 0 : s[0]) == null ? void 0 : o.name) ?? "";
3186
+ case "INPUT_OBJECT": {
3187
+ if (n > 4)
3188
+ return {};
3189
+ const i = {};
3190
+ for (const a of (r == null ? void 0 : r.inputFields) ?? [])
3191
+ (a.type.kind === "NON_NULL" || n === 0) && (i[a.name] = _e(e, a.type, n + 1));
3192
+ return i;
3193
+ }
3194
+ default:
3195
+ switch (t.name) {
3196
+ case "Int":
3197
+ case "Float":
3198
+ return 0;
3199
+ case "Boolean":
3200
+ return !1;
3201
+ default:
3202
+ return "";
3203
+ }
3204
+ }
3205
+ }
3206
+ function ir(e) {
3207
+ return e.charAt(0).toUpperCase() + e.slice(1);
3208
+ }
3209
+ function or(e, t, n = {}) {
3210
+ const { kind: r, field: s } = t, o = n.depth ?? 2, i = ir(s.name), a = s.args ?? [], c = a.length ? `(${a.map((p) => `$${p.name}: ${Ze(p.type)}`).join(", ")})` : "", l = a.length ? `(${a.map((p) => `${p.name}: $${p.name}`).join(", ")})` : "", f = Wt(e, s.type) ? "" : ` ${et(e, s.type, o - 1, " ")}`, u = `${r} ${i}${c} {
3211
+ ${s.name}${l}${f}
3212
+ }`, d = {};
3213
+ for (const p of a)
3214
+ p.defaultValue == null && (d[p.name] = _e(e, p.type));
3215
+ return { query: u, variables: d, operationName: i };
3216
+ }
3217
+ function ar(e, t = {}) {
3218
+ const n = typeof e == "object" && e && "types" in e && !Array.isArray(e.types) ? e : nr(e), r = {
3219
+ query: "Queries",
3220
+ mutation: "Mutations",
3221
+ subscription: "Subscriptions",
3222
+ ...t.folderNames
3223
+ }, s = /* @__PURE__ */ new Map();
3224
+ for (const o of rr(n)) {
3225
+ const i = or(n, o, { depth: t.depth }), a = ye({
3226
+ name: o.field.name,
3227
+ method: "POST",
3228
+ url: "{{graphqlUrl}}",
3229
+ body: {
3230
+ kind: "graphql",
3231
+ query: i.query,
3232
+ variables: Object.keys(i.variables).length ? JSON.stringify(i.variables, null, 2) : void 0,
3233
+ operationName: i.operationName
3234
+ },
3235
+ description: o.field.description ?? void 0,
3236
+ deprecated: o.field.isDeprecated || void 0
3237
+ });
3238
+ s.has(o.kind) || s.set(o.kind, []), s.get(o.kind).push(a);
3239
+ }
3240
+ return je({
3241
+ name: t.name ?? "GraphQL API",
3242
+ items: [...s].map(([o, i]) => Ae({ name: r[o], items: i })),
3243
+ variables: [{ key: "graphqlUrl", value: t.endpoint ?? "" }]
3244
+ });
3245
+ }
3246
+ const Q = "http://schemas.xmlsoap.org/wsdl/", We = "http://schemas.xmlsoap.org/wsdl/soap/", Fe = "http://schemas.xmlsoap.org/wsdl/soap12/", de = "http://www.w3.org/2001/XMLSchema", cr = "http://schemas.xmlsoap.org/soap/envelope/", pr = "http://www.w3.org/2003/05/soap-envelope", ee = (e, t) => `{${e ?? ""}}${t}`;
3247
+ function X(e, t, n) {
3248
+ return Array.from(e.childNodes).filter(
3249
+ (r) => r.nodeType === 1 && r.localName === n && (t === null || r.namespaceURI === t)
3250
+ );
3251
+ }
3252
+ function ne(e, t, n) {
3253
+ return X(e, t, n)[0];
3254
+ }
3255
+ function ae(e, t) {
3256
+ if (!t)
3257
+ return;
3258
+ const n = t.indexOf(":"), r = n < 0 ? null : t.slice(0, n), s = n < 0 ? t : t.slice(n + 1);
3259
+ return { namespace: e.lookupNamespaceURI(r) ?? void 0, name: s };
3260
+ }
3261
+ function bt(e) {
3262
+ var r;
3263
+ const t = ne(e, Q, "documentation");
3264
+ return ((r = t == null ? void 0 : t.textContent) == null ? void 0 : r.trim()) || void 0;
3265
+ }
3266
+ function lr() {
3267
+ const e = globalThis.DOMParser;
3268
+ if (!e)
3269
+ throw new Error("No DOMParser: pass one (xmldom, jsdom) in Node");
3270
+ return new e();
3271
+ }
3272
+ function ur(e, t = lr()) {
3273
+ const r = t.parseFromString(e, "text/xml").documentElement;
3274
+ if (!r || r.localName !== "definitions" || r.namespaceURI !== Q)
3275
+ throw new Error("Not a WSDL 1.1 document");
3276
+ const s = r.getAttribute("targetNamespace") ?? void 0, o = { elements: /* @__PURE__ */ new Map(), types: /* @__PURE__ */ new Map(), qualified: /* @__PURE__ */ new Map() }, i = ne(r, Q, "types");
3277
+ for (const u of i ? X(i, de, "schema") : []) {
3278
+ const d = u.getAttribute("targetNamespace") ?? void 0;
3279
+ o.qualified.set(d ?? "", u.getAttribute("elementFormDefault") === "qualified");
3280
+ for (const p of X(u, de, "element")) {
3281
+ const b = p.getAttribute("name");
3282
+ b && o.elements.set(ee(d, b), p);
3283
+ }
3284
+ for (const p of [...X(u, de, "complexType"), ...X(u, de, "simpleType")]) {
3285
+ const b = p.getAttribute("name");
3286
+ b && o.types.set(ee(d, b), p);
3287
+ }
3288
+ }
3289
+ const a = /* @__PURE__ */ new Map();
3290
+ for (const u of X(r, Q, "message")) {
3291
+ const d = X(u, Q, "part").map((p) => ({
3292
+ name: p.getAttribute("name") ?? "",
3293
+ element: ae(p, p.getAttribute("element")),
3294
+ type: ae(p, p.getAttribute("type"))
3295
+ }));
3296
+ a.set(ee(s, u.getAttribute("name") ?? ""), d);
3297
+ }
3298
+ const c = /* @__PURE__ */ new Map();
3299
+ for (const u of X(r, Q, "portType")) {
3300
+ const d = /* @__PURE__ */ new Map();
3301
+ for (const p of X(u, Q, "operation")) {
3302
+ const b = ne(p, Q, "input"), $ = ne(p, Q, "output"), h = b ? ae(b, b.getAttribute("message")) : void 0, v = $ ? ae($, $.getAttribute("message")) : void 0;
3303
+ d.set(p.getAttribute("name") ?? "", {
3304
+ doc: bt(p),
3305
+ input: h ? ee(h.namespace, h.name) : void 0,
3306
+ output: v ? ee(v.namespace, v.name) : void 0
3307
+ });
3308
+ }
3309
+ c.set(ee(s, u.getAttribute("name") ?? ""), d);
3310
+ }
3311
+ const l = /* @__PURE__ */ new Map();
3312
+ for (const u of X(r, Q, "binding")) {
3313
+ const d = ne(u, We, "binding"), p = ne(u, Fe, "binding"), b = d ?? p, $ = ee(s, u.getAttribute("name") ?? "");
3314
+ if (!b) {
3315
+ l.set($, null);
3316
+ continue;
3317
+ }
3318
+ const h = d ? We : Fe, v = ae(u, u.getAttribute("type")), k = v ? c.get(ee(v.namespace, v.name)) : void 0, T = b.getAttribute("style") === "rpc" ? "rpc" : "document", g = X(u, Q, "operation").map((S) => {
3319
+ const w = S.getAttribute("name") ?? "", N = ne(S, h, "operation"), P = ((N == null ? void 0 : N.getAttribute("style")) ?? T) === "rpc" ? "rpc" : "document", R = k == null ? void 0 : k.get(w), M = R != null && R.input ? a.get(R.input) : void 0, j = R != null && R.output ? a.get(R.output) : void 0, x = ne(S, Q, "input"), E = x ? ne(x, h, "body") : void 0, H = {
3320
+ name: w,
3321
+ soapAction: (N == null ? void 0 : N.getAttribute("soapAction")) ?? void 0,
3322
+ style: P,
3323
+ documentation: R == null ? void 0 : R.doc
3324
+ };
3325
+ if (P === "rpc")
3326
+ H.inputElement = {
3327
+ namespace: (E == null ? void 0 : E.getAttribute("namespace")) ?? s,
3328
+ name: w
3329
+ }, H.inputParts = (M ?? []).map((y) => ({ name: y.name, type: y.type }));
3330
+ else {
3331
+ const y = (M == null ? void 0 : M.find((A) => A.element)) ?? (M == null ? void 0 : M[0]);
3332
+ y != null && y.element && (H.inputElement = y.element);
3333
+ }
3334
+ const m = j == null ? void 0 : j.find((y) => y.element);
3335
+ return m != null && m.element && (H.outputElement = m.element), H;
3336
+ });
3337
+ l.set($, { version: d ? "1.1" : "1.2", operations: g });
3338
+ }
3339
+ const f = X(r, Q, "service").map((u) => ({
3340
+ name: u.getAttribute("name") ?? "Service",
3341
+ documentation: bt(u),
3342
+ ports: X(u, Q, "port").flatMap((d) => {
3343
+ const p = ae(d, d.getAttribute("binding")), b = p ? l.get(ee(p.namespace, p.name)) : void 0;
3344
+ if (!b)
3345
+ return [];
3346
+ const $ = ne(d, We, "address") ?? ne(d, Fe, "address");
3347
+ return [
3348
+ {
3349
+ name: d.getAttribute("name") ?? "",
3350
+ binding: (p == null ? void 0 : p.name) ?? "",
3351
+ version: b.version,
3352
+ address: ($ == null ? void 0 : $.getAttribute("location")) ?? "",
3353
+ operations: b.operations
3354
+ }
3355
+ ];
3356
+ })
3357
+ }));
3358
+ return { targetNamespace: s, services: f, schema: o };
3359
+ }
3360
+ function Ft(e, t, n, r, s, o, i) {
3361
+ const a = t.getAttribute("name") ?? t.getAttribute("ref") ?? "element";
3362
+ let c = t, l = n;
3363
+ if (t.getAttribute("ref")) {
3364
+ const k = ae(t, t.getAttribute("ref")), T = k ? e.schema.elements.get(ee(k.namespace, k.name)) : void 0;
3365
+ T && (c = T, l = k == null ? void 0 : k.namespace);
3366
+ }
3367
+ const f = c.getAttribute("name") ?? a.split(":").pop() ?? a, u = s && l ? tt(l, r) : "", d = u ? `${u}:${f}` : f, b = c.getAttribute("minOccurs") === "0" || t.getAttribute("minOccurs") === "0" ? `${o}<!--Optional:-->
3368
+ ` : "";
3369
+ let $ = ne(c, de, "complexType");
3370
+ const h = ae(c, c.getAttribute("type"));
3371
+ if (!$ && h && h.namespace !== de) {
3372
+ const k = e.schema.types.get(ee(h.namespace, h.name));
3373
+ (k == null ? void 0 : k.localName) === "complexType" && ($ = k);
3374
+ }
3375
+ if (!$ || i > 6)
3376
+ return `${b}${o}<${d}>?</${d}>`;
3377
+ const v = fr(e, $, l, r, o, i);
3378
+ return v ? `${b}${o}<${d}>
3379
+ ${v}
3380
+ ${o}</${d}>` : `${b}${o}<${d}/>`;
3381
+ }
3382
+ function fr(e, t, n, r, s, o) {
3383
+ const i = e.schema.qualified.get(n ?? "") ?? !1, a = [], c = (l) => {
3384
+ for (const f of Array.from(l.childNodes)) {
3385
+ if (f.nodeType !== 1)
3386
+ continue;
3387
+ const u = f;
3388
+ if (u.namespaceURI === de) {
3389
+ if (u.localName === "element")
3390
+ a.push(Ft(e, u, n, r, i, `${s} `, o + 1));
3391
+ else if (["sequence", "all", "choice", "complexContent", "extension"].includes(u.localName)) {
3392
+ if (u.localName === "extension") {
3393
+ const d = ae(u, u.getAttribute("base")), p = d ? e.schema.types.get(ee(d.namespace, d.name)) : void 0;
3394
+ p && c(p);
3395
+ }
3396
+ c(u);
3397
+ }
3398
+ }
3399
+ }
3400
+ };
3401
+ return c(t), a.join(`
3402
+ `);
3403
+ }
3404
+ function tt(e, t) {
3405
+ return t.has(e) || t.set(e, t.size ? `ns${t.size}` : "tns"), t.get(e);
3406
+ }
3407
+ function dr(e, t, n = "1.1") {
3408
+ const r = /* @__PURE__ */ new Map(), s = n === "1.2" ? "soap" : "soapenv";
3409
+ let o;
3410
+ const i = t.inputElement;
3411
+ if (t.style === "rpc") {
3412
+ const l = i == null ? void 0 : i.namespace, f = l ? tt(l, r) : "", u = f ? `${f}:${t.name}` : t.name, d = (t.inputParts ?? []).map((p) => ` <${p.name}>?</${p.name}>`);
3413
+ o = d.length ? ` <${u}>
3414
+ ${d.join(`
3415
+ `)}
3416
+ </${u}>` : ` <${u}/>`;
3417
+ } else if (i) {
3418
+ const l = e.schema.elements.get(ee(i.namespace, i.name));
3419
+ if (l)
3420
+ o = Ft(e, l, i.namespace, r, !0, " ", 0);
3421
+ else {
3422
+ const f = i.namespace ? tt(i.namespace, r) : "", u = f ? `${f}:${i.name}` : i.name;
3423
+ o = ` <${u}>?</${u}>`;
3424
+ }
3425
+ } else
3426
+ o = "";
3427
+ const c = [
3428
+ `xmlns:${s}="${n === "1.2" ? pr : cr}"`,
3429
+ ...[...r].map(([l, f]) => `xmlns:${f}="${l}"`)
3430
+ ].join(" ");
3431
+ return [
3432
+ `<${s}:Envelope ${c}>`,
3433
+ ` <${s}:Header/>`,
3434
+ ` <${s}:Body>`,
3435
+ ...o ? [o] : [],
3436
+ ` </${s}:Body>`,
3437
+ `</${s}:Envelope>`
3438
+ ].join(`
3439
+ `);
3440
+ }
3441
+ function mr(e, t = {}) {
3442
+ var s;
3443
+ const n = ur(e, t.parser), r = n.services.flatMap(
3444
+ (o) => o.ports.map(
3445
+ (i) => Ae({
3446
+ name: n.services.length > 1 || o.ports.length > 1 ? `${o.name} — ${i.name}` : o.name,
3447
+ description: o.documentation,
3448
+ items: i.operations.map(
3449
+ (a) => ye({
3450
+ name: a.name,
3451
+ method: "POST",
3452
+ url: i.address,
3453
+ body: {
3454
+ kind: "soap",
3455
+ envelope: dr(n, a, i.version),
3456
+ action: a.soapAction ?? "",
3457
+ version: i.version
3458
+ },
3459
+ description: a.documentation
3460
+ })
3461
+ )
3462
+ })
3463
+ )
3464
+ );
3465
+ return je({
3466
+ name: t.name ?? ((s = n.services[0]) == null ? void 0 : s.name) ?? "SOAP service",
3467
+ items: r.length === 1 ? r[0].items : r
3468
+ });
3469
+ }
3470
+ const kt = [
3471
+ 7,
3472
+ 12,
3473
+ 17,
3474
+ 22,
3475
+ 7,
3476
+ 12,
3477
+ 17,
3478
+ 22,
3479
+ 7,
3480
+ 12,
3481
+ 17,
3482
+ 22,
3483
+ 7,
3484
+ 12,
3485
+ 17,
3486
+ 22,
3487
+ 5,
3488
+ 9,
3489
+ 14,
3490
+ 20,
3491
+ 5,
3492
+ 9,
3493
+ 14,
3494
+ 20,
3495
+ 5,
3496
+ 9,
3497
+ 14,
3498
+ 20,
3499
+ 5,
3500
+ 9,
3501
+ 14,
3502
+ 20,
3503
+ 4,
3504
+ 11,
3505
+ 16,
3506
+ 23,
3507
+ 4,
3508
+ 11,
3509
+ 16,
3510
+ 23,
3511
+ 4,
3512
+ 11,
3513
+ 16,
3514
+ 23,
3515
+ 4,
3516
+ 11,
3517
+ 16,
3518
+ 23,
3519
+ 6,
3520
+ 10,
3521
+ 15,
3522
+ 21,
3523
+ 6,
3524
+ 10,
3525
+ 15,
3526
+ 21,
3527
+ 6,
3528
+ 10,
3529
+ 15,
3530
+ 21,
3531
+ 6,
3532
+ 10,
3533
+ 15,
3534
+ 21
3535
+ ], hr = Array.from(
3536
+ { length: 64 },
3537
+ (e, t) => Math.floor(Math.abs(Math.sin(t + 1)) * 2 ** 32) >>> 0
3538
+ );
3539
+ function Vt(e) {
3540
+ const t = typeof e == "string" ? new TextEncoder().encode(e) : e, n = t.length * 8, r = new Uint8Array(((t.length + 8 >> 6) + 1) * 64);
3541
+ r.set(t), r[t.length] = 128;
3542
+ const s = new DataView(r.buffer);
3543
+ s.setUint32(r.length - 8, n >>> 0, !0), s.setUint32(r.length - 4, Math.floor(n / 2 ** 32), !0);
3544
+ let o = 1732584193, i = 4023233417, a = 2562383102, c = 271733878;
3545
+ const l = new Uint32Array(16);
3546
+ for (let u = 0; u < r.length; u += 64) {
3547
+ for (let h = 0; h < 16; h++)
3548
+ l[h] = s.getUint32(u + h * 4, !0);
3549
+ let d = o, p = i, b = a, $ = c;
3550
+ for (let h = 0; h < 64; h++) {
3551
+ let v, k;
3552
+ h < 16 ? (v = p & b | ~p & $, k = h) : h < 32 ? (v = $ & p | ~$ & b, k = (5 * h + 1) % 16) : h < 48 ? (v = p ^ b ^ $, k = (3 * h + 5) % 16) : (v = b ^ (p | ~$), k = 7 * h % 16);
3553
+ const T = d + v + hr[h] + l[k] >>> 0;
3554
+ d = $, $ = b, b = p, p = p + (T << kt[h] | T >>> 32 - kt[h]) >>> 0;
3555
+ }
3556
+ o = o + d >>> 0, i = i + p >>> 0, a = a + b >>> 0, c = c + $ >>> 0;
3557
+ }
3558
+ const f = new DataView(new ArrayBuffer(16));
3559
+ return [o, i, a, c].forEach((u, d) => f.setUint32(d * 4, u, !0)), Array.from(new Uint8Array(f.buffer), (u) => u.toString(16).padStart(2, "0")).join(
3560
+ ""
3561
+ );
3562
+ }
3563
+ function nt(e, t) {
3564
+ if (typeof e == "string")
3565
+ return t(e);
3566
+ if (Array.isArray(e))
3567
+ return e.map((n) => nt(n, t));
3568
+ if (e && typeof e == "object") {
3569
+ const n = {};
3570
+ for (const [r, s] of Object.entries(e))
3571
+ n[r] = nt(s, t);
3572
+ return n;
3573
+ }
3574
+ return e;
3575
+ }
3576
+ const yr = new TextEncoder();
3577
+ function rt() {
3578
+ const e = globalThis.crypto;
3579
+ if (!(e != null && e.subtle))
3580
+ throw new Error("Web Crypto is not available");
3581
+ return e.subtle;
3582
+ }
3583
+ function ve(e) {
3584
+ return Array.from(new Uint8Array(e), (t) => t.toString(16).padStart(2, "0")).join("");
3585
+ }
3586
+ function pt(e) {
3587
+ let t = "";
3588
+ for (const n of e instanceof Uint8Array ? e : new Uint8Array(e))
3589
+ t += String.fromCharCode(n);
3590
+ return btoa(t);
3591
+ }
3592
+ function Ee(e) {
3593
+ const t = typeof e == "string" ? yr.encode(e) : e;
3594
+ return new Uint8Array(t);
3595
+ }
3596
+ async function Le(e, t) {
3597
+ return rt().digest(e, Ee(t));
3598
+ }
3599
+ async function me(e, t, n) {
3600
+ const r = t instanceof ArrayBuffer ? new Uint8Array(t) : Ee(t), s = await rt().importKey(
3601
+ "raw",
3602
+ Ee(r),
3603
+ { name: "HMAC", hash: e },
3604
+ !1,
3605
+ ["sign"]
3606
+ );
3607
+ return rt().sign("HMAC", s, Ee(n));
3608
+ }
3609
+ function Ve(e) {
3610
+ return encodeURIComponent(e).replace(
3611
+ /[!'()*]/g,
3612
+ (t) => `%${t.charCodeAt(0).toString(16).toUpperCase()}`
3613
+ );
3614
+ }
3615
+ function J(e, t, n) {
3616
+ const r = t.toLowerCase(), s = e.findIndex(([o]) => o.toLowerCase() === r);
3617
+ s >= 0 ? e[s] = [e[s][0], n] : e.push([t, n]);
3618
+ }
3619
+ function qe(e, t) {
3620
+ var r;
3621
+ const n = t.toLowerCase();
3622
+ return (r = e.find(([s]) => s.toLowerCase() === n)) == null ? void 0 : r[1];
3623
+ }
3624
+ function gr(e) {
3625
+ const t = /Digest\s+(.*)$/i.exec(e);
3626
+ if (!t)
3627
+ return;
3628
+ const n = {};
3629
+ for (const r of t[1].matchAll(/(\w+)=(?:"([^"]*)"|([^\s,]+))/g))
3630
+ n[r[1].toLowerCase()] = r[2] ?? r[3];
3631
+ return n;
3632
+ }
3633
+ async function $e(e, t) {
3634
+ return /sha-?256/i.test(e) ? ve(await Le("SHA-256", t)) : Vt(t);
3635
+ }
3636
+ async function br(e, t, n, r = {}) {
3637
+ var p;
3638
+ if (!e.realm || !e.nonce)
3639
+ return;
3640
+ const s = e.algorithm ?? "MD5", o = n.replace(/^[a-z][\w+.-]*:\/\/[^/]*/i, "") || "/", i = (p = e.qop) != null && p.split(",").map((b) => b.trim()).includes("auth") ? "auth" : e.qop ? e.qop.split(",")[0].trim() : void 0, a = r.cnonce ?? Vt(String(Math.random())).slice(0, 16), c = (r.nc ?? 1).toString(16).padStart(8, "0");
3641
+ let l = await $e(s, `${e.username}:${e.realm}:${e.password}`);
3642
+ /-sess$/i.test(s) && (l = await $e(s, `${l}:${e.nonce}:${a}`));
3643
+ const f = await $e(s, `${t}:${o}`), u = i ? await $e(s, `${l}:${e.nonce}:${c}:${a}:${i}:${f}`) : await $e(s, `${l}:${e.nonce}:${f}`), d = [
3644
+ `username="${e.username}"`,
3645
+ `realm="${e.realm}"`,
3646
+ `nonce="${e.nonce}"`,
3647
+ `uri="${o}"`,
3648
+ `algorithm=${s}`,
3649
+ `response="${u}"`
3650
+ ];
3651
+ return i && d.push(`qop=${i}`, `nc=${c}`, `cnonce="${a}"`), e.opaque && d.push(`opaque="${e.opaque}"`), `Digest ${d.join(", ")}`;
3652
+ }
3653
+ async function kr(e, t, n = /* @__PURE__ */ new Date()) {
3654
+ var g;
3655
+ const r = new URL(e.url), s = n.toISOString().replace(/[:-]|\.\d{3}/g, ""), o = s.slice(0, 8);
3656
+ let i = "";
3657
+ typeof e.body == "string" ? i = e.body : ((g = e.body) == null ? void 0 : g.kind) === "binary" && e.body.data && (i = Uint8Array.from(atob(e.body.data), (S) => S.charCodeAt(0)));
3658
+ const a = e.body && typeof e.body != "string" && e.body.kind === "multipart" ? "UNSIGNED-PAYLOAD" : ve(await Le("SHA-256", i)), c = t.service === "s3";
3659
+ J(e.headers, "X-Amz-Date", s), c && J(e.headers, "X-Amz-Content-Sha256", a), t.sessionToken && J(e.headers, "X-Amz-Security-Token", t.sessionToken);
3660
+ const l = r.pathname.split("/").map((S) => c ? S : Ve(S)).join("/") || "/", f = [...r.searchParams.entries()].map(([S, w]) => [Ve(S), Ve(w)]).sort(([S, w], [N, P]) => S === N ? w < P ? -1 : w > P ? 1 : 0 : S < N ? -1 : 1).map(([S, w]) => `${S}=${w}`).join("&"), u = /* @__PURE__ */ new Map([["host", r.host]]);
3661
+ for (const [S, w] of e.headers) {
3662
+ const N = S.toLowerCase();
3663
+ (N.startsWith("x-amz-") || N === "content-type") && u.set(N, w.trim().replace(/\s+/g, " "));
3664
+ }
3665
+ const d = [...u.keys()].sort(), p = d.map((S) => `${S}:${u.get(S)}
3666
+ `).join(""), b = d.join(";"), $ = [
3667
+ e.method.toUpperCase(),
3668
+ l,
3669
+ f,
3670
+ p,
3671
+ b,
3672
+ a
3673
+ ].join(`
3674
+ `), h = `${o}/${t.region}/${t.service}/aws4_request`, v = ["AWS4-HMAC-SHA256", s, h, ve(await Le("SHA-256", $))].join(
3675
+ `
3676
+ `
3677
+ );
3678
+ let k = await me("SHA-256", `AWS4${t.secretAccessKey}`, o);
3679
+ k = await me("SHA-256", k, t.region), k = await me("SHA-256", k, t.service), k = await me("SHA-256", k, "aws4_request");
3680
+ const T = ve(await me("SHA-256", k, v));
3681
+ J(
3682
+ e.headers,
3683
+ "Authorization",
3684
+ `AWS4-HMAC-SHA256 Credential=${t.accessKeyId}/${h}, SignedHeaders=${b}, Signature=${T}`
3685
+ );
3686
+ }
3687
+ async function $r(e, t, n = /* @__PURE__ */ new Date()) {
3688
+ const r = /^[a-z][\w+.-]*:\/\//i.test(e.url) ? new URL(e.url) : new URL(e.url, "http://localhost"), s = t.template ?? `{method}
3689
+ {path}
3690
+ {timestamp}
3691
+ {body}`, o = String(Math.floor(n.getTime() / 1e3)), i = s.replace(/\\n/g, `
3692
+ `).replace(/\{method\}/g, e.method.toUpperCase()).replace(/\{path\}/g, r.pathname + r.search).replace(/\{query\}/g, r.search.replace(/^\?/, "")).replace(/\{timestamp\}/g, o).replace(/\{body\}/g, typeof e.body == "string" ? e.body : ""), a = await me(t.algorithm, t.secret, i), c = t.encoding === "base64" ? pt(a) : ve(a);
3693
+ J(e.headers, t.header, `${t.prefix ?? ""}${c}`), s.includes("{timestamp}") && J(e.headers, t.timestampHeader ?? "X-Timestamp", o);
3694
+ }
3695
+ async function $t(e, t = {}) {
3696
+ var b;
3697
+ const n = ($) => jt($, t.variables ?? {}, t), r = t.auth ?? e.auth, s = !r || r.type === "inherit" ? { type: "none" } : nt(r, n), o = [], i = e.params.filter(($) => $.in === "header" && L($)).map(($) => [n($.key), n($.value)]), a = e.params.filter(($) => $.in === "cookie" && L($)).map(($) => `${n($.key)}=${n($.value)}`);
3698
+ switch (s.type) {
3699
+ case "basic":
3700
+ J(i, "Authorization", `Basic ${ot(`${s.username}:${s.password}`)}`);
3701
+ break;
3702
+ case "bearer":
3703
+ s.token && J(i, "Authorization", `${s.prefix ?? "Bearer"} ${s.token}`);
3704
+ break;
3705
+ case "oauth2":
3706
+ s.accessToken && J(i, "Authorization", `${s.tokenType ?? "Bearer"} ${s.accessToken}`);
3707
+ break;
3708
+ case "apiKey":
3709
+ s.in === "header" ? J(i, s.key, s.value) : s.in === "query" ? o.push({ key: s.key, value: s.value, in: "query" }) : a.push(`${s.key}=${s.value}`);
3710
+ break;
3711
+ case "custom":
3712
+ for (const $ of s.headers.filter(L))
3713
+ J(i, $.key, $.value);
3714
+ break;
3715
+ }
3716
+ a.length && J(
3717
+ i,
3718
+ "Cookie",
3719
+ [qe(i, "Cookie"), ...a].filter(Boolean).join("; ")
3720
+ );
3721
+ const c = Oe({ ...e, params: [...e.params, ...o] }, n);
3722
+ let l;
3723
+ const f = e.body;
3724
+ f.kind === "multipart" ? l = {
3725
+ kind: "multipart",
3726
+ parts: f.parts.filter(L).map(($) => ({ ...$, key: n($.key), value: n($.value) }))
3727
+ } : f.kind === "binary" ? l = { kind: "binary", fileName: f.fileName, contentType: f.contentType, data: f.data } : f.kind !== "none" && (l = n(oe(f) ?? ""));
3728
+ const u = Ne(f);
3729
+ u && f.kind !== "multipart" && !qe(i, "Content-Type") && J(i, "Content-Type", u), f.kind === "soap" && f.version === "1.1" && f.action !== void 0 && !qe(i, "SOAPAction") && J(i, "SOAPAction", `"${n(f.action)}"`);
3730
+ const d = {
3731
+ method: e.method.toUpperCase(),
3732
+ url: c,
3733
+ headers: i,
3734
+ body: l,
3735
+ settings: { ...e.settings }
3736
+ }, p = ((b = t.now) == null ? void 0 : b.call(t)) ?? /* @__PURE__ */ new Date();
3737
+ if (s.type === "digest") {
3738
+ const $ = await br(s, d.method, c);
3739
+ $ && J(d.headers, "Authorization", $);
3740
+ } else s.type === "awsSigV4" ? await kr(d, s, p) : s.type === "hmac" && await $r(d, s, p);
3741
+ return d;
3742
+ }
3743
+ async function Dr(e, t, n = {}, r) {
3744
+ let s = await $t(e, n), o = await t(s, r);
3745
+ const i = n.auth ?? e.auth;
3746
+ if (o.status === 401 && (i == null ? void 0 : i.type) === "digest" && !i.nonce) {
3747
+ const a = gr(qe(o.headers, "WWW-Authenticate") ?? "");
3748
+ if (a != null && a.nonce) {
3749
+ const c = {
3750
+ ...i,
3751
+ realm: a.realm,
3752
+ nonce: a.nonce,
3753
+ qop: a.qop,
3754
+ algorithm: a.algorithm,
3755
+ opaque: a.opaque
3756
+ };
3757
+ return s = await $t(e, { ...n, auth: c }), o = await t(s, r), { response: o, sent: s, auth: c };
3758
+ }
3759
+ }
3760
+ return { response: o, sent: s, auth: i };
3761
+ }
3762
+ const wr = /^text\/|json|xml|javascript|ecmascript|x-www-form-urlencoded|graphql|yaml|csv|html/i;
3763
+ function wt(e, t) {
3764
+ const n = Uint8Array.from(atob(e), (r) => r.charCodeAt(0));
3765
+ return new Blob([n], t ? { type: t } : void 0);
3766
+ }
3767
+ function Mr(e = (...t) => fetch(...t)) {
3768
+ return async (t, n) => {
3769
+ var l, f, u;
3770
+ const r = new Headers();
3771
+ for (const [d, p] of t.headers)
3772
+ r.append(d, p);
3773
+ let s;
3774
+ if (typeof t.body == "string")
3775
+ s = t.body;
3776
+ else if (((l = t.body) == null ? void 0 : l.kind) === "multipart") {
3777
+ const d = new FormData();
3778
+ for (const p of t.body.parts)
3779
+ if (p.type === "file") {
3780
+ const b = (f = t.body.files) == null ? void 0 : f[p.key];
3781
+ d.append(
3782
+ p.key,
3783
+ b ? wt(b, p.contentType) : new Blob([]),
3784
+ p.fileName ?? p.key
3785
+ );
3786
+ } else
3787
+ d.append(p.key, p.value);
3788
+ s = d, r.delete("Content-Type");
3789
+ } else ((u = t.body) == null ? void 0 : u.kind) === "binary" && t.body.data && (s = wt(t.body.data, t.body.contentType));
3790
+ const o = new AbortController(), i = () => o.abort();
3791
+ n == null || n.addEventListener("abort", i);
3792
+ const a = t.settings.timeoutMs ? setTimeout(i, t.settings.timeoutMs) : void 0, c = Date.now();
3793
+ try {
3794
+ const d = await e(t.url, {
3795
+ method: t.method,
3796
+ headers: r,
3797
+ body: t.method === "GET" || t.method === "HEAD" ? void 0 : s,
3798
+ redirect: t.settings.followRedirects === !1 ? "manual" : "follow",
3799
+ signal: o.signal
3800
+ }), p = await d.arrayBuffer(), b = d.headers.get("content-type") ?? "", $ = !b || wr.test(b), h = [];
3801
+ return d.headers.forEach((v, k) => h.push([k, v])), {
3802
+ status: d.status,
3803
+ statusText: d.statusText,
3804
+ headers: h,
3805
+ body: $ ? new TextDecoder().decode(p) : "",
3806
+ bodyBase64: $ ? void 0 : pt(p),
3807
+ timeMs: Date.now() - c,
3808
+ size: p.byteLength,
3809
+ url: d.url || t.url
3810
+ };
3811
+ } finally {
3812
+ a && clearTimeout(a), n == null || n.removeEventListener("abort", i);
3813
+ }
3814
+ };
3815
+ }
3816
+ function vt(e) {
3817
+ return pt(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
3818
+ }
3819
+ async function zr() {
3820
+ const e = new Uint8Array(32);
3821
+ globalThis.crypto.getRandomValues(e);
3822
+ const t = vt(e), n = vt(await Le("SHA-256", t));
3823
+ return { verifier: t, challenge: n };
3824
+ }
3825
+ function Br(e, t = {}) {
3826
+ const n = new URLSearchParams();
3827
+ n.set("response_type", e.grant === "implicit" ? "token" : "code"), n.set("client_id", e.clientId), e.redirectUri && n.set("redirect_uri", e.redirectUri), e.scope && n.set("scope", e.scope), e.audience && n.set("audience", e.audience), t.state && n.set("state", t.state), t.challenge && (n.set("code_challenge", t.challenge), n.set("code_challenge_method", "S256"));
3828
+ const r = e.authUrl ?? "";
3829
+ return `${r}${r.includes("?") ? "&" : "?"}${n.toString()}`;
3830
+ }
3831
+ async function Se(e, t, n) {
3832
+ if (!e.tokenUrl)
3833
+ throw new Error("OAuth 2: no token URL");
3834
+ const r = [
3835
+ ["Content-Type", "application/x-www-form-urlencoded"],
3836
+ ["Accept", "application/json"]
3837
+ ], s = new URLSearchParams(t);
3838
+ e.clientAuth === "body" || !e.clientSecret ? (s.set("client_id", e.clientId), e.clientSecret && s.set("client_secret", e.clientSecret)) : r.push([
3839
+ "Authorization",
3840
+ `Basic ${ot(`${encodeURIComponent(e.clientId)}:${encodeURIComponent(e.clientSecret)}`)}`
3841
+ ]), e.scope && !s.has("scope") && t.grant_type !== "authorization_code" && t.grant_type !== "refresh_token" && s.set("scope", e.scope), e.audience && s.set("audience", e.audience);
3842
+ const o = await n({
3843
+ method: "POST",
3844
+ url: e.tokenUrl,
3845
+ headers: r,
3846
+ body: s.toString(),
3847
+ settings: {}
3848
+ });
3849
+ let i = {};
3850
+ try {
3851
+ i = JSON.parse(o.body);
3852
+ } catch {
3853
+ i = Object.fromEntries(new URLSearchParams(o.body));
3854
+ }
3855
+ if (o.status >= 400 || typeof i.access_token != "string") {
3856
+ const c = typeof i.error == "string" ? i.error : `HTTP ${o.status}`, l = typeof i.error_description == "string" ? `: ${i.error_description}` : "";
3857
+ throw new Error(`OAuth 2 token request failed — ${c}${l}`);
3858
+ }
3859
+ const a = Number(i.expires_in);
3860
+ return {
3861
+ accessToken: i.access_token,
3862
+ tokenType: typeof i.token_type == "string" ? i.token_type.replace(/^bearer$/i, "Bearer") : "Bearer",
3863
+ refreshToken: typeof i.refresh_token == "string" ? i.refresh_token : void 0,
3864
+ expiresAt: Number.isFinite(a) && a > 0 ? Date.now() + a * 1e3 : void 0,
3865
+ scope: typeof i.scope == "string" ? i.scope : void 0,
3866
+ idToken: typeof i.id_token == "string" ? i.id_token : void 0
3867
+ };
3868
+ }
3869
+ async function Wr(e, t) {
3870
+ if (e.grant === "clientCredentials")
3871
+ return Se(e, { grant_type: "client_credentials" }, t);
3872
+ if (e.grant === "password")
3873
+ return Se(
3874
+ e,
3875
+ { grant_type: "password", username: e.username ?? "", password: e.password ?? "" },
3876
+ t
3877
+ );
3878
+ throw new Error(
3879
+ `OAuth 2: the ${e.grant} grant needs the user — use buildAuthorizationUrl / startDeviceAuthorization`
3880
+ );
3881
+ }
3882
+ async function Fr(e, t, n, r) {
3883
+ const s = { grant_type: "authorization_code", code: t };
3884
+ return e.redirectUri && (s.redirect_uri = e.redirectUri), r && (s.code_verifier = r), Se(e, s, n);
3885
+ }
3886
+ async function Vr(e, t, n) {
3887
+ return Se(e, { grant_type: "refresh_token", refresh_token: t }, n);
3888
+ }
3889
+ async function Kr(e, t) {
3890
+ if (!e.deviceUrl)
3891
+ throw new Error("OAuth 2: no device authorization URL");
3892
+ const n = new URLSearchParams({ client_id: e.clientId });
3893
+ e.scope && n.set("scope", e.scope), e.audience && n.set("audience", e.audience);
3894
+ const r = await t({
3895
+ method: "POST",
3896
+ url: e.deviceUrl,
3897
+ headers: [
3898
+ ["Content-Type", "application/x-www-form-urlencoded"],
3899
+ ["Accept", "application/json"]
3900
+ ],
3901
+ body: n.toString(),
3902
+ settings: {}
3903
+ }), s = JSON.parse(r.body);
3904
+ if (typeof s.device_code != "string")
3905
+ throw new Error(`OAuth 2 device authorization failed — HTTP ${r.status}`);
3906
+ return {
3907
+ deviceCode: s.device_code,
3908
+ userCode: String(s.user_code ?? ""),
3909
+ verificationUri: String(s.verification_uri_complete ?? s.verification_uri ?? ""),
3910
+ interval: Number(s.interval ?? 5),
3911
+ expiresIn: s.expires_in === void 0 ? void 0 : Number(s.expires_in)
3912
+ };
3913
+ }
3914
+ async function Jr(e, t, n) {
3915
+ try {
3916
+ return await Se(
3917
+ e,
3918
+ { grant_type: "urn:ietf:params:oauth:grant-type:device_code", device_code: t },
3919
+ n
3920
+ );
3921
+ } catch (r) {
3922
+ const s = r instanceof Error ? r.message : "";
3923
+ if (s.includes("authorization_pending"))
3924
+ return "pending";
3925
+ if (s.includes("slow_down"))
3926
+ return "slow_down";
3927
+ throw r;
3928
+ }
3929
+ }
3930
+ const vr = {
3931
+ version: "Version",
3932
+ servers: "Servers",
3933
+ authentication: "Authentication",
3934
+ parameters: "Parameters",
3935
+ name: "Name",
3936
+ location: "In",
3937
+ required: "Required",
3938
+ type: "Type",
3939
+ description: "Description",
3940
+ yes: "Yes",
3941
+ no: "No",
3942
+ requestBody: "Request body",
3943
+ responses: "Responses",
3944
+ status: "Status",
3945
+ example: "Example",
3946
+ deprecated: "Deprecated",
3947
+ noAuth: "None"
3948
+ }, we = (e) => (e ?? "").replace(/\|/g, "\\|").replace(/\r?\n/g, " ");
3949
+ function st(e) {
3950
+ if (!e)
3951
+ return "string";
3952
+ if (e.$ref)
3953
+ return e.$ref.split("/").pop() ?? "object";
3954
+ const t = Array.isArray(e.type) ? e.type.join(" | ") : e.type;
3955
+ return t === "array" ? `${st(e.items)}[]` : [t ?? "object", e.format ? `(${e.format})` : ""].filter(Boolean).join(" ");
3956
+ }
3957
+ function Ar(e, t) {
3958
+ switch (e.type) {
3959
+ case "none":
3960
+ case "inherit":
3961
+ return t.noAuth;
3962
+ case "apiKey":
3963
+ return `API key \`${e.key}\` (${e.in})`;
3964
+ case "bearer":
3965
+ return "Bearer token";
3966
+ case "basic":
3967
+ return "HTTP Basic";
3968
+ case "digest":
3969
+ return "HTTP Digest";
3970
+ case "oauth2":
3971
+ return `OAuth 2 (${e.grant}${e.scope ? `, scope: ${e.scope}` : ""})`;
3972
+ case "awsSigV4":
3973
+ return `AWS Signature V4 (${e.service}, ${e.region})`;
3974
+ case "hmac":
3975
+ return `HMAC ${e.algorithm} (\`${e.header}\`)`;
3976
+ case "mtls":
3977
+ return "Mutual TLS";
3978
+ case "custom":
3979
+ return e.headers.map((n) => `\`${n.key}\``).join(", ");
3980
+ default:
3981
+ return "";
3982
+ }
3983
+ }
3984
+ function At(e, t) {
3985
+ const n = e.includes("```") ? "````" : "```";
3986
+ return `${n}${t}
3987
+ ${e}
3988
+ ${n}`;
3989
+ }
3990
+ function xr(e, t, n, r, s, o) {
3991
+ var d;
3992
+ const i = "#".repeat(o), a = [], c = e.url.replace(/^\{\{[^}]+\}\}/, "") || "/";
3993
+ a.push(
3994
+ `${i} \`${e.method}\` ${c}${e.name && e.name !== `${e.method} ${c}` ? ` — ${e.name}` : ""}`,
3995
+ ""
3996
+ ), e.deprecated && a.push(`> **${r.deprecated}**`, ""), e.description && a.push(e.description, "");
3997
+ const l = e.params.filter(L);
3998
+ l.length && a.push(
3999
+ `${i}# ${r.parameters}`,
4000
+ "",
4001
+ `| ${r.name} | ${r.location} | ${r.required} | ${r.type} | ${r.description} |`,
4002
+ "|---|---|---|---|---|",
4003
+ ...l.map(
4004
+ (p) => `| \`${we(p.key)}\` | ${p.in} | ${p.required || p.in === "path" ? r.yes : r.no} | ${we(st(p.schema))} | ${we(p.description)} |`
4005
+ ),
4006
+ ""
4007
+ );
4008
+ const f = e.body;
4009
+ if (f.kind !== "none")
4010
+ if (a.push(`${i}# ${r.requestBody}`, ""), f.kind === "form" || f.kind === "multipart") {
4011
+ const p = f.kind === "form" ? f.fields : f.parts;
4012
+ a.push(
4013
+ ...p.filter(L).map(
4014
+ (b) => `- \`${b.key}\`${"type" in b && b.type === "file" ? " (file)" : b.value ? `: ${b.value}` : ""}`
4015
+ ),
4016
+ ""
4017
+ );
4018
+ } else if (f.kind === "binary")
4019
+ a.push(
4020
+ `${f.contentType ?? "application/octet-stream"}${f.fileName ? ` — ${f.fileName}` : ""}`,
4021
+ ""
4022
+ );
4023
+ else {
4024
+ const p = f.kind === "json" || f.kind === "graphql" ? "json" : f.kind === "text" ? "" : "xml";
4025
+ a.push(At(oe(f) ?? "", p), "");
4026
+ }
4027
+ const u = Object.entries(e.responses ?? {});
4028
+ if (u.length && a.push(
4029
+ `${i}# ${r.responses}`,
4030
+ "",
4031
+ `| ${r.status} | ${r.description} | ${r.type} |`,
4032
+ "|---|---|---|",
4033
+ ...u.map(
4034
+ ([p, b]) => `| ${p} | ${we(b.description)} | ${we(b.schema ? st(b.schema) : b.contentType)} |`
4035
+ ),
4036
+ ""
4037
+ ), s.codeLanguage !== !1) {
4038
+ const p = n.filter(
4039
+ (v) => v.kind === "folder"
4040
+ ), b = s.codeLanguage ?? "curl", $ = Sn(e, b, {
4041
+ auth: en(e, p, t)
4042
+ }), h = ((d = kn.find((v) => v.id === b)) == null ? void 0 : d.syntax) ?? "shell";
4043
+ a.push(`${i}# ${r.example}`, "", At($, h), "");
4044
+ }
4045
+ return a;
4046
+ }
4047
+ function Qr(e, t = {}) {
4048
+ var o;
4049
+ const n = { ...vr, ...t.labels }, r = [`# ${e.name}`, ""];
4050
+ e.description && r.push(e.description, ""), e.version && r.push(`**${n.version}:** ${e.version}`, ""), (o = e.servers) != null && o.length && r.push(
4051
+ `## ${n.servers}`,
4052
+ "",
4053
+ ...e.servers.map(
4054
+ (i) => `- \`${i.url}\`${i.description ? ` — ${i.description}` : ""}`
4055
+ ),
4056
+ ""
4057
+ ), e.auth && e.auth.type !== "none" && e.auth.type !== "inherit" && r.push(`## ${n.authentication}`, "", Ar(e.auth, n), "");
4058
+ const s = (i, a, c) => {
4059
+ for (const l of i)
4060
+ l.kind === "folder" ? (r.push(`${"#".repeat(Math.min(a, 6))} ${l.name}`, ""), l.description && r.push(l.description, ""), s(l.items, a + 1, [...c, l])) : r.push(...xr(l, e, c, n, t, Math.min(a, 5)));
4061
+ };
4062
+ return s(e.items, 2, []), `${r.join(`
4063
+ `).replace(/\n{3,}/g, `
4064
+
4065
+ `).trimEnd()}
4066
+ `;
4067
+ }
4068
+ function Kt(e, t) {
4069
+ try {
4070
+ return Qe(e, t);
4071
+ } catch {
4072
+ return;
4073
+ }
4074
+ }
4075
+ function Tr(e, t = {}) {
4076
+ const n = e.trim();
4077
+ if (!n)
4078
+ return;
4079
+ if (pn(n))
4080
+ return "curl";
4081
+ if (n.startsWith("<"))
4082
+ return /<(\w+:)?definitions[\s>]/.test(n) && /schemas\.xmlsoap\.org\/wsdl/.test(n) ? "wsdl" : void 0;
4083
+ const r = Kt(n, t.parseYaml);
4084
+ if (!r || typeof r != "object")
4085
+ return;
4086
+ const s = r;
4087
+ if (typeof s.openapi == "string" || typeof s.swagger == "string")
4088
+ return "openapi";
4089
+ if (Pt(s))
4090
+ return "postman";
4091
+ if (Array.isArray(s.values) && (s._postman_variable_scope !== void 0 || typeof s.name == "string"))
4092
+ return "postman-environment";
4093
+ if (zt(s))
4094
+ return "har";
4095
+ const o = s.data;
4096
+ if (s.__schema || o != null && o.__schema)
4097
+ return "graphql";
4098
+ }
4099
+ function Gr(e, t = {}) {
4100
+ const n = Tr(e, t), r = () => Kt(e.trim(), t.parseYaml);
4101
+ switch (n) {
4102
+ case "curl":
4103
+ return { kind: n, request: yn(e) };
4104
+ case "openapi":
4105
+ return { kind: n, collection: Hn(r(), t) };
4106
+ case "postman":
4107
+ return { kind: n, collection: Qn(r()) };
4108
+ case "postman-environment":
4109
+ return { kind: n, environment: Gn(r()) };
4110
+ case "har":
4111
+ return { kind: n, collection: tr(r()) };
4112
+ case "graphql":
4113
+ return { kind: n, collection: ar(r()) };
4114
+ case "wsdl":
4115
+ return { kind: n, collection: mr(e, { parser: t.xmlParser }) };
4116
+ default:
4117
+ throw new Error(
4118
+ "Unknown API document: expected curl, OpenAPI, Swagger, Postman, HAR, GraphQL introspection or WSDL"
4119
+ );
4120
+ }
4121
+ }
4122
+ export {
4123
+ Hr as GRAPHQL_INTROSPECTION_QUERY,
4124
+ Nr as NICE_API_AUTH_TYPES,
4125
+ kn as NICE_API_CODE_LANGUAGES,
4126
+ vr as NICE_API_MARKDOWN_LABELS,
4127
+ jr as NICE_API_METHODS,
4128
+ Z as NiceYamlError,
4129
+ Fn as POSTMAN_SCHEMA_V21,
4130
+ Ne as bodyContentType,
4131
+ xt as bodyFromText,
4132
+ oe as bodyText,
4133
+ Br as buildAuthorizationUrl,
4134
+ or as buildGraphqlOperation,
4135
+ Oe as buildRequestUrl,
4136
+ dr as buildSoapEnvelope,
4137
+ Qr as collectionToMarkdown,
4138
+ zr as createPkcePair,
4139
+ Tr as detectApiDocument,
4140
+ Le as digest,
4141
+ br as digestAuthorization,
4142
+ en as effectiveAuth,
4143
+ Fr as exchangeAuthorizationCode,
4144
+ Rr as exportHar,
4145
+ Wn as exportOpenApi,
4146
+ Ir as exportOpenApiYaml,
4147
+ Lr as exportPostman,
4148
+ Pr as exportPostmanEnvironment,
4149
+ Wr as fetchOAuth2Token,
4150
+ Mr as fetchTransport,
4151
+ Yt as findApiItem,
4152
+ nn as findVariables,
4153
+ it as flattenApiRequests,
4154
+ Nt as fromBase64,
4155
+ Sn as generateCode,
4156
+ _e as graphqlExampleValue,
4157
+ rr as graphqlOperations,
4158
+ Ze as graphqlTypeName,
4159
+ Cr as headerValue,
4160
+ me as hmac,
4161
+ Gr as importApiDocument,
4162
+ ar as importGraphqlIntrospection,
4163
+ tr as importHar,
4164
+ Hn as importOpenApi,
4165
+ Qn as importPostman,
4166
+ Gn as importPostmanEnvironment,
4167
+ mr as importWsdl,
4168
+ Ge as inferSchema,
4169
+ jt as interpolate,
4170
+ pn as isCurlCommand,
4171
+ L as isEnabled,
4172
+ zt as isHar,
4173
+ Pt as isPostmanCollection,
4174
+ Er as joinUrl,
4175
+ gt as jsonPointer,
4176
+ Vt as md5Hex,
4177
+ It as mockFromSchema,
4178
+ qr as mockResponse,
4179
+ Bt as namedType,
4180
+ je as newApiCollection,
4181
+ Ae as newApiFolder,
4182
+ Pe as newApiId,
4183
+ ye as newApiRequest,
4184
+ Zt as paramsIn,
4185
+ yn as parseCurl,
4186
+ gr as parseDigestChallenge,
4187
+ Tt as parseFormEncoded,
4188
+ nr as parseGraphqlIntrospection,
4189
+ Qe as parseJsonOrYaml,
4190
+ ur as parseWsdl,
4191
+ Un as parseYaml,
4192
+ sn as pathParamNames,
4193
+ Jr as pollDeviceToken,
4194
+ Vr as refreshOAuth2Token,
4195
+ Ot as requestName,
4196
+ at as resolvePlainScalar,
4197
+ $t as resolveRequest,
4198
+ Or as rowsToRecord,
4199
+ qt as schemaResolver,
4200
+ Dr as sendApiRequest,
4201
+ an as setRequestUrl,
4202
+ kr as signAwsV4,
4203
+ $r as signHmac,
4204
+ pe as splitUrl,
4205
+ Kr as startDeviceAuthorization,
4206
+ In as stringifyYaml,
4207
+ Dn as swagger2ToOpenApi3,
4208
+ on as syncPathParams,
4209
+ ot as toBase64,
4210
+ He as toCurl,
4211
+ un as tokenizeCommand,
4212
+ Ur as unresolvedVariables,
4213
+ Xt as updateApiItem,
4214
+ _r as variableScope
4215
+ };