@apiuikit/web-component 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +25 -5
  2. package/dist/CodeSamples-CvGJUENN-CR16fFmG.js +4234 -0
  3. package/dist/LinkedInExtension-BL-4T9tt-CwUePUjv.js +21 -0
  4. package/dist/LogoExtension-BCPMpWxf-CD0UVJhy.js +16 -0
  5. package/dist/XExtension-GyRtdHLL-DPPkXhkP.js +23 -0
  6. package/dist/c-Bz1-FJiA-CwNanOv1.js +277 -0
  7. package/dist/clojure-aY2138WD-CzZhvUkO.js +135 -0
  8. package/dist/crystal-BtD5fR4q-B1F7Ovrt.js +283 -0
  9. package/dist/csharp-AnFv7wyC-DBJ0ahb9.js +382 -0
  10. package/dist/elements/asyncapi-info.d.ts +7 -0
  11. package/dist/elements/asyncapi-info.js +17 -0
  12. package/dist/elements/asyncapi-messages.d.ts +7 -0
  13. package/dist/elements/asyncapi-messages.js +17 -0
  14. package/dist/elements/asyncapi-operations.d.ts +7 -0
  15. package/dist/elements/asyncapi-operations.js +17 -0
  16. package/dist/elements/asyncapi-renderer.d.ts +7 -0
  17. package/dist/elements/asyncapi-renderer.js +17 -0
  18. package/dist/elements/asyncapi-servers.d.ts +7 -0
  19. package/dist/elements/asyncapi-servers.js +17 -0
  20. package/dist/elements/asyncapi.d.ts +7 -0
  21. package/dist/elements/asyncapi.js +17 -0
  22. package/dist/elements/openapi-endpoints.d.ts +7 -0
  23. package/dist/elements/openapi-endpoints.js +17 -0
  24. package/dist/elements/openapi-info.d.ts +7 -0
  25. package/dist/elements/openapi-info.js +17 -0
  26. package/dist/elements/openapi-renderer.d.ts +7 -0
  27. package/dist/elements/openapi-renderer.js +17 -0
  28. package/dist/elements/openapi-servers.d.ts +7 -0
  29. package/dist/elements/openapi-servers.js +17 -0
  30. package/dist/elements/openapi-webhooks.d.ts +7 -0
  31. package/dist/elements/openapi-webhooks.js +17 -0
  32. package/dist/elements/openapi.d.ts +7 -0
  33. package/dist/elements/openapi.js +17 -0
  34. package/dist/elements/schemas.d.ts +7 -0
  35. package/dist/elements/schemas.js +17 -0
  36. package/dist/go-CkZ9_bn0-BavTPlHs.js +151 -0
  37. package/dist/http-DKeNlJKS-CncZekYb.js +85 -0
  38. package/dist/index-227TxMRF-BYlp71U_.js +25403 -0
  39. package/dist/index-Bf4YsziL-DPjrM_Iz.js +17529 -0
  40. package/dist/index-DCDYBZcY-B5md4zhj.js +1459 -0
  41. package/dist/java-BicX26Pg-BE9j1hqd.js +240 -0
  42. package/dist/kotlin-BwB8b-YX-DrhZ7rRS.js +242 -0
  43. package/dist/objectivec-CnyrJ13Z-crbGiB8Q.js +237 -0
  44. package/dist/ocaml-T8IqWCjo-T8IqWCjo.js +67 -0
  45. package/dist/php-BL35ZHWM-BVESXHm8.js +566 -0
  46. package/dist/powershell-DuhUKWoO-BkKc-lpt.js +236 -0
  47. package/dist/protoToJsonSchema-nTI0cRt8-B1zlLwd7.js +6127 -0
  48. package/dist/protobufSchemaParser-ChAv0AAl-DDsAdtNH.js +55 -0
  49. package/dist/r-B8fCBydS-B8fCBydS.js +207 -0
  50. package/dist/registerElement-DAVqIcyy.js +25412 -0
  51. package/dist/ruby-CvOid-1s-CANQXRsZ.js +386 -0
  52. package/dist/rust-BocnJ3Ns-BBcgTcYY.js +305 -0
  53. package/dist/swift-C35Eof-I-CeYSuGtY.js +799 -0
  54. package/dist/web-component.css +1 -1
  55. package/dist/web-component.es.js +20617 -20262
  56. package/dist/web-component.iife.js +329 -326
  57. package/package.json +57 -5
  58. package/dist/adapters.d.ts +0 -25
@@ -0,0 +1,4234 @@
1
+ import { c as Cn, r as re, l as tr, I as An, f as Rn, j as me, g as qn, $ as Nn, v as Ln, b as rt, D as Un } from "./registerElement-DAVqIcyy.js";
2
+ function Vr(e, t = /* @__PURE__ */ new Set()) {
3
+ if (t.has(e)) return e;
4
+ if (e.type === "object" && e.properties && typeof e.properties == "object") {
5
+ t.add(e);
6
+ try {
7
+ const r = {};
8
+ for (const [n, l] of Object.entries(e.properties)) {
9
+ const a = /id$/i.test(n) && l.type === "string" && !l.format && !l.examples, s = l.type === "string" && !l.format && !l.examples && !l.enum;
10
+ r[n] = a ? { ...l, format: "uuid" } : s ? { ...l, examples: ["string"] } : Vr(l, t);
11
+ }
12
+ return { ...e, properties: r };
13
+ } finally {
14
+ t.delete(e);
15
+ }
16
+ }
17
+ return e;
18
+ }
19
+ async function Dn(e) {
20
+ try {
21
+ const { generate: t } = await import("./index-DCDYBZcY-B5md4zhj.js");
22
+ return await t(Vr(e), {
23
+ seed: 42,
24
+ useExamplesValue: !0,
25
+ optionalsProbability: 1
26
+ });
27
+ } catch {
28
+ return;
29
+ }
30
+ }
31
+ const rr = "", nr = `
32
+ `;
33
+ var k = class {
34
+ /**
35
+ * Helper object to format and aggragate lines of code.
36
+ * Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.
37
+ */
38
+ constructor({ indent: e, join: t } = {}) {
39
+ this.postProcessors = [], this.code = [], this.indentationCharacter = rr, this.lineJoin = nr, this.indentLine = (r, n = 0) => `${this.indentationCharacter.repeat(n)}${r}`, this.unshift = (r, n) => {
40
+ const l = this.indentLine(r, n);
41
+ this.code.unshift(l);
42
+ }, this.push = (r, n) => {
43
+ const l = this.indentLine(r, n);
44
+ this.code.push(l);
45
+ }, this.pushToLast = (r) => {
46
+ this.code || this.push(r);
47
+ const n = `${this.code[this.code.length - 1]}${r}`;
48
+ this.code[this.code.length - 1] = n;
49
+ }, this.blank = () => {
50
+ this.code.push("");
51
+ }, this.join = () => {
52
+ const r = this.code.join(this.lineJoin);
53
+ return this.postProcessors.reduce((n, l) => l(n), r);
54
+ }, this.addPostProcessor = (r) => {
55
+ this.postProcessors = [...this.postProcessors, r];
56
+ }, this.indentationCharacter = e || rr, this.lineJoin = t ?? nr;
57
+ }
58
+ }, _n = function(e) {
59
+ return Object.prototype.toString.call(e) === "[object RegExp]";
60
+ }, Hn = function(e) {
61
+ var t = typeof e;
62
+ return e !== null && (t === "object" || t === "function");
63
+ }, Kt = {};
64
+ Object.defineProperty(Kt, "__esModule", { value: !0 });
65
+ Kt.default = (e) => Object.getOwnPropertySymbols(e).filter((t) => Object.prototype.propertyIsEnumerable.call(e, t));
66
+ const In = _n, Mn = Hn, Fn = Kt.default;
67
+ var Bn = (e, t, r) => {
68
+ const n = [];
69
+ return (function l(a, s, o) {
70
+ s = s || {}, s.indent = s.indent || " ", o = o || "";
71
+ let i;
72
+ s.inlineCharacterLimit === void 0 ? i = {
73
+ newLine: `
74
+ `,
75
+ newLineOrSpace: `
76
+ `,
77
+ pad: o,
78
+ indent: o + s.indent
79
+ } : i = {
80
+ newLine: "@@__STRINGIFY_OBJECT_NEW_LINE__@@",
81
+ newLineOrSpace: "@@__STRINGIFY_OBJECT_NEW_LINE_OR_SPACE__@@",
82
+ pad: "@@__STRINGIFY_OBJECT_PAD__@@",
83
+ indent: "@@__STRINGIFY_OBJECT_INDENT__@@"
84
+ };
85
+ const c = (p) => {
86
+ if (s.inlineCharacterLimit === void 0)
87
+ return p;
88
+ const f = p.replace(new RegExp(i.newLine, "g"), "").replace(new RegExp(i.newLineOrSpace, "g"), " ").replace(new RegExp(i.pad + "|" + i.indent, "g"), "");
89
+ return f.length <= s.inlineCharacterLimit ? f : p.replace(new RegExp(i.newLine + "|" + i.newLineOrSpace, "g"), `
90
+ `).replace(new RegExp(i.pad, "g"), o).replace(new RegExp(i.indent, "g"), o + s.indent);
91
+ };
92
+ if (n.indexOf(a) !== -1)
93
+ return '"[Circular]"';
94
+ if (a == null || typeof a == "number" || typeof a == "boolean" || typeof a == "function" || typeof a == "symbol" || In(a))
95
+ return String(a);
96
+ if (a instanceof Date)
97
+ return `new Date('${a.toISOString()}')`;
98
+ if (Array.isArray(a)) {
99
+ if (a.length === 0)
100
+ return "[]";
101
+ n.push(a);
102
+ const p = "[" + i.newLine + a.map((f, u) => {
103
+ const d = a.length - 1 === u ? i.newLine : "," + i.newLineOrSpace;
104
+ let h = l(f, s, o + s.indent);
105
+ return s.transform && (h = s.transform(a, u, h)), i.indent + h + d;
106
+ }).join("") + i.pad + "]";
107
+ return n.pop(), c(p);
108
+ }
109
+ if (Mn(a)) {
110
+ let p = Object.keys(a).concat(Fn(a));
111
+ if (s.filter && (p = p.filter((u) => s.filter(a, u))), p.length === 0)
112
+ return "{}";
113
+ n.push(a);
114
+ const f = "{" + i.newLine + p.map((u, d) => {
115
+ const h = p.length - 1 === d ? i.newLine : "," + i.newLineOrSpace, m = typeof u == "symbol", b = !m && /^[a-z$_][a-z$_0-9]*$/i.test(u), j = m || b ? u : l(u, s);
116
+ let y = l(a[u], s, o + s.indent);
117
+ return s.transform && (y = s.transform(a, u, y)), i.indent + String(j) + ": " + y + h;
118
+ }).join("") + i.pad + "}";
119
+ return n.pop(), c(f);
120
+ }
121
+ return a = String(a).replace(/[\r\n]/g, (p) => p === `
122
+ ` ? "\\n" : "\\r"), s.singleQuotes === !1 ? (a = a.replace(/"/g, '\\"'), `"${a}"`) : (a = a.replace(/\\?'/g, "\\'"), `'${a}'`);
123
+ })(e, t, r);
124
+ };
125
+ const ae = /* @__PURE__ */ Ln(Bn), W = (e, t) => Object.keys(e).find((r) => r.toLowerCase() === t.toLowerCase()), le = (e, t) => {
126
+ const r = W(e, t);
127
+ if (r)
128
+ return e[r];
129
+ }, nt = (e, t) => !!W(e, t), Wn = (e) => [
130
+ "application/json",
131
+ "application/x-json",
132
+ "text/json",
133
+ "text/x-json",
134
+ "+json"
135
+ ].some((t) => e.indexOf(t) > -1), Jn = {
136
+ info: {
137
+ key: "agent",
138
+ title: "Agent",
139
+ default: "prompt"
140
+ },
141
+ clientsById: { prompt: {
142
+ info: {
143
+ key: "prompt",
144
+ title: "Agent Prompt",
145
+ link: "https://github.com/readmeio/httpsnippet",
146
+ description: "A copy-and-pastable prompt, for any AI agent, describing how to make the request.",
147
+ extname: ".txt"
148
+ },
149
+ convert: ({ method: e, fullUrl: t, allHeaders: r, postData: n }, l) => {
150
+ const a = {
151
+ indent: " ",
152
+ join: `
153
+ `,
154
+ ...l
155
+ }, { blank: s, push: o, join: i } = new k(a);
156
+ o("Write code that makes the HTTP request described below. Use my preferred programming language and HTTP client library — if I haven't told you what those are, ask me before writing any code."), s(), o(`Method: ${e}`), o(`URL: ${t}`);
157
+ const c = Object.keys(r);
158
+ return c.length && (s(), o("Headers:"), c.forEach((p) => {
159
+ o(`${p}: ${r[p]}`, 1);
160
+ })), n.text && (s(), o(`Body (${n.mimeType}):`), o(n.text)), s(), o("The request the code makes must match the method, URL, headers, and body exactly as described above."), a.markdownURL && (s(), o(`Check ${a.markdownURL} for more info.`)), i();
161
+ }
162
+ } }
163
+ };
164
+ function Me(e, t = {}) {
165
+ const { delimiter: r = '"', escapeChar: n = "\\", escapeNewlines: l = !0 } = t;
166
+ return [...e.toString()].map((a) => a === "\b" ? `${n}b` : a === " " ? `${n}t` : a === `
167
+ ` ? l ? `${n}n` : a : a === "\f" ? `${n}f` : a === "\r" ? l ? `${n}r` : a : a === n ? n + n : a === r ? n + r : a < " " || a > "~" ? JSON.stringify(a).slice(1, -1) : a).join("");
168
+ }
169
+ const Ae = (e) => Me(e, { delimiter: "'" }), D = (e) => Me(e, { delimiter: '"' }), zn = {
170
+ info: {
171
+ key: "c",
172
+ title: "C",
173
+ default: "libcurl",
174
+ cli: "c"
175
+ },
176
+ clientsById: { libcurl: {
177
+ info: {
178
+ key: "libcurl",
179
+ title: "Libcurl",
180
+ link: "http://curl.haxx.se/libcurl",
181
+ description: "Simple REST and HTTP API Client for C",
182
+ extname: ".c"
183
+ },
184
+ convert: ({ method: e, fullUrl: t, headersObj: r, allHeaders: n, postData: l }) => {
185
+ const { push: a, blank: s, join: o } = new k();
186
+ a("CURL *hnd = curl_easy_init();"), s(), a(`curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "${e.toUpperCase()}");`), a("curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);"), a(`curl_easy_setopt(hnd, CURLOPT_URL, "${t}");`);
187
+ const i = Object.keys(r);
188
+ return i.length && (s(), a("struct curl_slist *headers = NULL;"), i.forEach((c) => {
189
+ a(`headers = curl_slist_append(headers, "${c}: ${D(r[c])}");`);
190
+ }), a("curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);")), n.cookie && (s(), a(`curl_easy_setopt(hnd, CURLOPT_COOKIE, "${n.cookie}");`)), l.text && (s(), a(`curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, ${JSON.stringify(l.text)});`)), s(), a("CURLcode ret = curl_easy_perform(hnd);"), o();
191
+ }
192
+ } }
193
+ };
194
+ var or = class {
195
+ constructor(e) {
196
+ this.name = "", this.toString = () => `:${this.name}`, this.name = e;
197
+ }
198
+ }, Kn = class {
199
+ constructor(e) {
200
+ this.path = "", this.toString = () => `(clojure.java.io/file "${this.path}")`, this.path = e;
201
+ }
202
+ };
203
+ const Gr = (e) => e === void 0 ? null : e === null ? "null" : e.constructor.name.toLowerCase(), Qr = (e) => e === void 0 ? !0 : Gr(e) === "object" ? Object.keys(e).length === 0 : !1, ar = (e) => (Object.keys(e).filter((t) => Qr(e[t])).forEach((t) => {
204
+ delete e[t];
205
+ }), e), Qe = (e, t) => {
206
+ const r = " ".repeat(e);
207
+ return t.replace(/\n/g, `
208
+ ${r}`);
209
+ }, Lt = (e) => {
210
+ switch (Gr(e)) {
211
+ case "string":
212
+ return `"${e.replace(/"/g, '\\"')}"`;
213
+ case "file":
214
+ return e.toString();
215
+ case "keyword":
216
+ return e.toString();
217
+ case "null":
218
+ return "nil";
219
+ case "regexp":
220
+ return `#"${e.source}"`;
221
+ case "object": {
222
+ const t = Object.keys(e).reduce((r, n) => `${r}:${n} ${Qe(n.length + 2, Lt(e[n]))}
223
+ `, "").trim();
224
+ return `{${Qe(1, t)}}`;
225
+ }
226
+ case "array": {
227
+ const t = e.reduce((r, n) => `${r} ${Lt(n)}`, "").trim();
228
+ return `[${Qe(1, t)}]`;
229
+ }
230
+ default:
231
+ return e.toString();
232
+ }
233
+ }, Vn = {
234
+ info: {
235
+ key: "clojure",
236
+ title: "Clojure",
237
+ default: "clj_http"
238
+ },
239
+ clientsById: { clj_http: {
240
+ info: {
241
+ key: "clj_http",
242
+ title: "clj-http",
243
+ link: "https://github.com/dakrone/clj-http",
244
+ description: "An idiomatic clojure http client wrapping the apache client.",
245
+ extname: ".clj"
246
+ },
247
+ convert: ({ queryObj: e, method: t, postData: r, url: n, allHeaders: l }, a) => {
248
+ const { push: s, join: o } = new k({ indent: a == null ? void 0 : a.indent }), i = [
249
+ "get",
250
+ "post",
251
+ "put",
252
+ "delete",
253
+ "patch",
254
+ "head",
255
+ "options"
256
+ ];
257
+ if (t = t.toLowerCase(), !i.includes(t))
258
+ return s("Method not supported"), o();
259
+ const c = {
260
+ headers: l,
261
+ "query-params": e
262
+ };
263
+ switch (r.mimeType) {
264
+ case "application/json":
265
+ {
266
+ c["content-type"] = new or("json"), c["form-params"] = r.jsonObj;
267
+ const p = W(c.headers, "content-type");
268
+ p && delete c.headers[p];
269
+ }
270
+ break;
271
+ case "application/x-www-form-urlencoded":
272
+ {
273
+ c["form-params"] = r.paramsObj;
274
+ const p = W(c.headers, "content-type");
275
+ p && delete c.headers[p];
276
+ }
277
+ break;
278
+ case "text/plain":
279
+ {
280
+ c.body = r.text;
281
+ const p = W(c.headers, "content-type");
282
+ p && delete c.headers[p];
283
+ }
284
+ break;
285
+ case "multipart/form-data":
286
+ if (r.params) {
287
+ c.multipart = r.params.map((f) => f.fileName && !f.value ? {
288
+ name: f.name,
289
+ content: new Kn(f.fileName)
290
+ } : {
291
+ name: f.name,
292
+ content: f.value
293
+ });
294
+ const p = W(c.headers, "content-type");
295
+ p && delete c.headers[p];
296
+ }
297
+ break;
298
+ }
299
+ switch (le(c.headers, "accept")) {
300
+ case "application/json":
301
+ {
302
+ c.accept = new or("json");
303
+ const p = W(c.headers, "accept");
304
+ p && delete c.headers[p];
305
+ }
306
+ break;
307
+ }
308
+ if (s(`(require '[clj-http.client :as client])
309
+ `), Qr(ar(c))) s(`(client/${t} "${n}")`);
310
+ else {
311
+ const p = 11 + t.length + n.length, f = Qe(p, Lt(ar(c)));
312
+ s(`(client/${t} "${n}" ${f})`);
313
+ }
314
+ return o();
315
+ }
316
+ } }
317
+ }, Gn = {
318
+ info: {
319
+ key: "crystal",
320
+ title: "Crystal",
321
+ default: "native"
322
+ },
323
+ clientsById: { native: {
324
+ info: {
325
+ key: "native",
326
+ title: "http::client",
327
+ link: "https://crystal-lang.org/api/master/HTTP/Client.html",
328
+ description: "Crystal HTTP client",
329
+ extname: ".cr"
330
+ },
331
+ convert: ({ method: e, fullUrl: t, postData: r, allHeaders: n }, l = {}) => {
332
+ const { insecureSkipVerify: a = !1 } = l, { push: s, blank: o, join: i } = new k();
333
+ s('require "http/client"'), o(), s(`url = "${t}"`);
334
+ const c = Object.keys(n);
335
+ c.length && (s("headers = HTTP::Headers{"), c.forEach((m) => {
336
+ s(` "${m}" => "${D(n[m])}"`);
337
+ }), s("}")), r.text && s(`reqBody = ${JSON.stringify(r.text)}`), o();
338
+ const p = e.toUpperCase(), f = [
339
+ "GET",
340
+ "POST",
341
+ "HEAD",
342
+ "DELETE",
343
+ "PATCH",
344
+ "PUT",
345
+ "OPTIONS"
346
+ ], u = c.length ? ", headers: headers" : "", d = r.text ? ", body: reqBody" : "", h = a ? ", tls: OpenSSL::SSL::Context::Client.insecure" : "";
347
+ return f.includes(p) ? s(`response = HTTP::Client.${p.toLowerCase()} url${u}${d}${h}`) : s(`response = HTTP::Client.exec "${p}", url${u}${d}${h}`), s("puts response.body"), i();
348
+ }
349
+ } }
350
+ }, Qn = (e) => {
351
+ let t = le(e, "accept-encoding");
352
+ if (!t) return [];
353
+ const r = {
354
+ gzip: "DecompressionMethods.GZip",
355
+ deflate: "DecompressionMethods.Deflate"
356
+ }, n = [];
357
+ return typeof t == "string" && (t = [t]), t.forEach((l) => {
358
+ l.split(",").forEach((a) => {
359
+ const s = /\s*([^;\s]+)/.exec(a);
360
+ if (s) {
361
+ const o = r[s[1]];
362
+ o && n.push(o);
363
+ }
364
+ });
365
+ }), n;
366
+ }, Yn = {
367
+ info: {
368
+ key: "httpclient",
369
+ title: "HttpClient",
370
+ link: "https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient",
371
+ description: ".NET Standard HTTP Client",
372
+ extname: ".cs"
373
+ },
374
+ convert: ({ allHeaders: e, postData: t, method: r, fullUrl: n }, l) => {
375
+ var a, s;
376
+ const { push: o, join: i } = new k({ indent: {
377
+ indent: " ",
378
+ ...l
379
+ }.indent });
380
+ o("using System.Net.Http.Headers;");
381
+ let c = "";
382
+ const p = !!e.cookie, f = Qn(e);
383
+ (p || f.length) && (c = "clientHandler", o("var clientHandler = new HttpClientHandler"), o("{"), p && o("UseCookies = false,", 1), f.length && o(`AutomaticDecompression = ${f.join(" | ")},`, 1), o("};")), o(`var client = new HttpClient(${c});`), o("var request = new HttpRequestMessage"), o("{");
384
+ const u = [
385
+ "GET",
386
+ "POST",
387
+ "PUT",
388
+ "DELETE",
389
+ "PATCH",
390
+ "HEAD",
391
+ "OPTIONS",
392
+ "TRACE"
393
+ ];
394
+ r = r.toUpperCase(), r && u.includes(r) ? r = `HttpMethod.${r[0]}${r.substring(1).toLowerCase()}` : r = `new HttpMethod("${r}")`, o(`Method = ${r},`, 1), o(`RequestUri = new Uri("${n}"),`, 1);
395
+ const d = Object.keys(e).filter((h) => {
396
+ switch (h.toLowerCase()) {
397
+ case "content-type":
398
+ case "content-length":
399
+ case "accept-encoding":
400
+ return !1;
401
+ default:
402
+ return !0;
403
+ }
404
+ });
405
+ if (d.length && (o("Headers =", 1), o("{", 1), d.forEach((h) => {
406
+ o(`{ "${h}", "${D(e[h])}" },`, 2);
407
+ }), o("},", 1)), t.text) {
408
+ const h = t.mimeType;
409
+ switch (h) {
410
+ case "application/x-www-form-urlencoded":
411
+ o("Content = new FormUrlEncodedContent(new Dictionary<string, string>", 1), o("{", 1), (a = t.params) == null || a.forEach((m) => {
412
+ o(`{ "${m.name}", "${m.value}" },`, 2);
413
+ }), o("}),", 1);
414
+ break;
415
+ case "multipart/form-data":
416
+ o("Content = new MultipartFormDataContent", 1), o("{", 1), (s = t.params) == null || s.forEach((m) => {
417
+ o(`new StringContent(${JSON.stringify(m.value || "")})`, 2), o("{", 2), o("Headers =", 3), o("{", 3), m.contentType && o(`ContentType = new MediaTypeHeaderValue("${m.contentType}"),`, 4), o('ContentDisposition = new ContentDispositionHeaderValue("form-data")', 4), o("{", 4), o(`Name = "${m.name}",`, 5), m.fileName && o(`FileName = "${m.fileName}",`, 5), o("}", 4), o("}", 3), o("},", 2);
418
+ }), o("},", 1);
419
+ break;
420
+ default:
421
+ o(`Content = new StringContent(${JSON.stringify(t.text || "")})`, 1), o("{", 1), o("Headers =", 2), o("{", 2), o(`ContentType = new MediaTypeHeaderValue("${h}")`, 3), o("}", 2), o("}", 1);
422
+ break;
423
+ }
424
+ }
425
+ return o("};"), o("using (var response = await client.SendAsync(request))"), o("{"), o("response.EnsureSuccessStatusCode();", 1), o("var body = await response.Content.ReadAsStringAsync();", 1), o("Console.WriteLine(body);", 1), o("}"), i();
426
+ }
427
+ };
428
+ function Xn(e) {
429
+ return e[0].toUpperCase() + e.slice(1).toLowerCase();
430
+ }
431
+ const Zn = {
432
+ info: {
433
+ key: "csharp",
434
+ title: "C#",
435
+ default: "restsharp",
436
+ cli: "dotnet"
437
+ },
438
+ clientsById: {
439
+ httpclient: Yn,
440
+ restsharp: {
441
+ info: {
442
+ key: "restsharp",
443
+ title: "RestSharp",
444
+ link: "http://restsharp.org/",
445
+ description: "Simple REST and HTTP API Client for .NET",
446
+ extname: ".cs",
447
+ installation: () => "dotnet add package RestSharp"
448
+ },
449
+ convert: ({ method: e, fullUrl: t, headersObj: r, cookies: n, postData: l, uriObj: a }) => {
450
+ const { push: s, join: o } = new k();
451
+ if (![
452
+ "GET",
453
+ "POST",
454
+ "PUT",
455
+ "DELETE",
456
+ "PATCH",
457
+ "HEAD",
458
+ "OPTIONS"
459
+ ].includes(e.toUpperCase())) return "Method not supported";
460
+ s(`using RestSharp;
461
+
462
+ `), s(`var options = new RestClientOptions("${t}");`), s("var client = new RestClient(options);"), s('var request = new RestRequest("");');
463
+ const i = l.mimeType && l.mimeType === "multipart/form-data";
464
+ switch (i && s("request.AlwaysMultipartFormData = true;"), Object.keys(r).forEach((c) => {
465
+ if (l.mimeType && c.toLowerCase() === "content-type" && l.text) {
466
+ i && l.boundary && s(`request.FormBoundary = "${l.boundary}";`);
467
+ return;
468
+ }
469
+ s(`request.AddHeader("${c}", "${D(r[c])}");`);
470
+ }), n.forEach(({ name: c, value: p }) => {
471
+ s(`request.AddCookie("${c}", "${D(p)}", "${a.pathname}", "${a.host}");`);
472
+ }), l.mimeType) {
473
+ case "multipart/form-data":
474
+ if (!l.params) break;
475
+ l.params.forEach((c) => {
476
+ c.fileName ? s(`request.AddFile("${c.name}", "${c.fileName}");`) : s(`request.AddParameter("${c.name}", "${c.value}");`);
477
+ });
478
+ break;
479
+ case "application/x-www-form-urlencoded":
480
+ if (!l.params) break;
481
+ l.params.forEach((c) => {
482
+ s(`request.AddParameter("${c.name}", "${c.value}");`);
483
+ });
484
+ break;
485
+ case "application/json":
486
+ if (!l.text) break;
487
+ s(`request.AddJsonBody(${JSON.stringify(l.text)}, false);`);
488
+ break;
489
+ default:
490
+ if (!l.text) break;
491
+ s(`request.AddStringBody("${l.text}", "${l.mimeType}");`);
492
+ }
493
+ return s(`var response = await client.${Xn(e)}Async(request);
494
+ `), s(`Console.WriteLine("{0}", response.Content);
495
+ `), o();
496
+ }
497
+ }
498
+ }
499
+ }, eo = {
500
+ info: {
501
+ key: "go",
502
+ title: "Go",
503
+ default: "native",
504
+ cli: "go"
505
+ },
506
+ clientsById: { native: {
507
+ info: {
508
+ key: "native",
509
+ title: "NewRequest",
510
+ link: "http://golang.org/pkg/net/http/#NewRequest",
511
+ description: "Golang HTTP client request",
512
+ extname: ".go"
513
+ },
514
+ convert: ({ postData: e, method: t, allHeaders: r, fullUrl: n }, l = {}) => {
515
+ const { blank: a, push: s, join: o } = new k({ indent: " " }), { showBoilerplate: i = !0, checkErrors: c = !1, printBody: p = !0, timeout: f = -1, insecureSkipVerify: u = !1 } = l, d = c ? "err" : "_", h = i ? 1 : 0, m = () => {
516
+ c && (s("if err != nil {", h), s("panic(err)", h + 1), s("}", h));
517
+ };
518
+ i && (s("package main"), a(), s("import ("), s('"fmt"', h), f > 0 && s('"time"', h), u && s('"crypto/tls"', h), e.text && s('"strings"', h), s('"net/http"', h), p && s('"io"', h), s(")"), a(), s("func main() {"), a()), u && (s("insecureTransport := http.DefaultTransport.(*http.Transport).Clone()", h), s("insecureTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}", h));
519
+ const b = f > 0, j = b || u, y = j ? "client" : "http.DefaultClient";
520
+ return j && (s("client := http.Client{", h), b && s(`Timeout: time.Duration(${f} * time.Second),`, h + 1), u && s("Transport: insecureTransport,", h + 1), s("}", h), a()), s(`url := "${n}"`, h), a(), e.text ? (s(`payload := strings.NewReader(${JSON.stringify(e.text)})`, h), a(), s(`req, ${d} := http.NewRequest("${t}", url, payload)`, h), a()) : (s(`req, ${d} := http.NewRequest("${t}", url, nil)`, h), a()), m(), Object.keys(r).length && (Object.keys(r).forEach((g) => {
521
+ s(`req.Header.Add("${g}", "${D(r[g])}")`, h);
522
+ }), a()), s(`res, ${d} := ${y}.Do(req)`, h), m(), p && (a(), s("defer res.Body.Close()", h), s(`body, ${d} := io.ReadAll(res.Body)`, h), m()), a(), p && s("fmt.Println(string(body))", h), i && (a(), s("}")), o();
523
+ }
524
+ } }
525
+ }, ir = `\r
526
+ `, to = {
527
+ info: {
528
+ key: "http",
529
+ title: "HTTP",
530
+ default: "http1.1"
531
+ },
532
+ clientsById: { "http1.1": {
533
+ info: {
534
+ key: "http1.1",
535
+ title: "HTTP/1.1",
536
+ link: "https://tools.ietf.org/html/rfc7230",
537
+ description: "HTTP/1.1 request string in accordance with RFC 7230",
538
+ extname: null
539
+ },
540
+ convert: ({ method: e, fullUrl: t, uriObj: r, httpVersion: n, allHeaders: l, postData: a }, s) => {
541
+ const o = {
542
+ absoluteURI: !1,
543
+ autoContentLength: !0,
544
+ autoHost: !0,
545
+ ...s
546
+ }, { blank: i, push: c, join: p } = new k({
547
+ indent: "",
548
+ join: ir
549
+ });
550
+ c(`${e} ${o.absoluteURI ? t : r.path} ${n}`);
551
+ const f = Object.keys(l);
552
+ f.forEach((h) => {
553
+ const m = h.toLowerCase().replace(/(^|-)(\w)/g, (b) => b.toUpperCase());
554
+ c(`${m}: ${l[h]}`);
555
+ }), o.autoHost && !f.includes("host") && c(`Host: ${r.host}`), o.autoContentLength && a.text && !f.includes("content-length") && c(`Content-Length: ${Buffer.byteLength(a.text, "ascii").toString()}`), i();
556
+ const u = p(), d = a.text || "";
557
+ return `${u}${ir}${d}`;
558
+ }
559
+ } }
560
+ }, ro = {
561
+ info: {
562
+ key: "java",
563
+ title: "Java",
564
+ default: "unirest"
565
+ },
566
+ clientsById: {
567
+ asynchttp: {
568
+ info: {
569
+ key: "asynchttp",
570
+ title: "AsyncHttp",
571
+ link: "https://github.com/AsyncHttpClient/async-http-client",
572
+ description: "Asynchronous Http and WebSocket Client library for Java",
573
+ extname: ".java"
574
+ },
575
+ convert: ({ method: e, allHeaders: t, postData: r, fullUrl: n }, l) => {
576
+ const { blank: a, push: s, join: o } = new k({ indent: {
577
+ indent: " ",
578
+ ...l
579
+ }.indent });
580
+ return s("AsyncHttpClient client = new DefaultAsyncHttpClient();"), s(`client.prepare("${e.toUpperCase()}", "${n}")`), Object.keys(t).forEach((i) => {
581
+ s(`.setHeader("${i}", "${D(t[i])}")`, 1);
582
+ }), r.text && s(`.setBody(${JSON.stringify(r.text)})`, 1), s(".execute()", 1), s(".toCompletableFuture()", 1), s(".thenAccept(System.out::println)", 1), s(".join();", 1), a(), s("client.close();"), o();
583
+ }
584
+ },
585
+ nethttp: {
586
+ info: {
587
+ key: "nethttp",
588
+ title: "java.net.http",
589
+ link: "https://openjdk.java.net/groups/net/httpclient/intro.html",
590
+ description: "Java Standardized HTTP Client API",
591
+ extname: ".java"
592
+ },
593
+ convert: ({ allHeaders: e, fullUrl: t, method: r, postData: n }, l) => {
594
+ const { push: a, join: s } = new k({ indent: {
595
+ indent: " ",
596
+ ...l
597
+ }.indent });
598
+ return a("HttpRequest request = HttpRequest.newBuilder()"), a(`.uri(URI.create("${t}"))`, 2), Object.keys(e).forEach((o) => {
599
+ a(`.header("${o}", "${D(e[o])}")`, 2);
600
+ }), n.text ? a(`.method("${r.toUpperCase()}", HttpRequest.BodyPublishers.ofString(${JSON.stringify(n.text)}))`, 2) : a(`.method("${r.toUpperCase()}", HttpRequest.BodyPublishers.noBody())`, 2), a(".build();", 2), a("HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());"), a("System.out.println(response.body());"), s();
601
+ }
602
+ },
603
+ okhttp: {
604
+ info: {
605
+ key: "okhttp",
606
+ title: "OkHttp",
607
+ link: "http://square.github.io/okhttp/",
608
+ description: "An HTTP Request Client Library",
609
+ extname: ".java"
610
+ },
611
+ convert: ({ postData: e, method: t, fullUrl: r, allHeaders: n }, l) => {
612
+ const { push: a, blank: s, join: o } = new k({ indent: {
613
+ indent: " ",
614
+ ...l
615
+ }.indent }), i = [
616
+ "GET",
617
+ "POST",
618
+ "PUT",
619
+ "DELETE",
620
+ "PATCH",
621
+ "HEAD"
622
+ ], c = [
623
+ "POST",
624
+ "PUT",
625
+ "DELETE",
626
+ "PATCH"
627
+ ];
628
+ return a("OkHttpClient client = new OkHttpClient();"), s(), e.text && (e.boundary ? a(`MediaType mediaType = MediaType.parse("${e.mimeType}; boundary=${e.boundary}");`) : a(`MediaType mediaType = MediaType.parse("${e.mimeType}");`), a(`RequestBody body = RequestBody.create(mediaType, ${JSON.stringify(e.text)});`)), a("Request request = new Request.Builder()"), a(`.url("${r}")`, 1), i.includes(t.toUpperCase()) ? c.includes(t.toUpperCase()) ? e.text ? a(`.${t.toLowerCase()}(body)`, 1) : a(`.${t.toLowerCase()}(null)`, 1) : a(`.${t.toLowerCase()}()`, 1) : e.text ? a(`.method("${t.toUpperCase()}", body)`, 1) : a(`.method("${t.toUpperCase()}", null)`, 1), Object.keys(n).forEach((p) => {
629
+ a(`.addHeader("${p}", "${D(n[p])}")`, 1);
630
+ }), a(".build();", 1), s(), a("Response response = client.newCall(request).execute();"), o();
631
+ }
632
+ },
633
+ unirest: {
634
+ info: {
635
+ key: "unirest",
636
+ title: "Unirest",
637
+ link: "http://unirest.io/java.html",
638
+ description: "Lightweight HTTP Request Client Library",
639
+ extname: ".java"
640
+ },
641
+ convert: ({ method: e, allHeaders: t, postData: r, fullUrl: n }, l) => {
642
+ const { join: a, push: s } = new k({ indent: {
643
+ indent: " ",
644
+ ...l
645
+ }.indent });
646
+ return [
647
+ "GET",
648
+ "POST",
649
+ "PUT",
650
+ "DELETE",
651
+ "PATCH",
652
+ "HEAD",
653
+ "OPTIONS"
654
+ ].includes(e.toUpperCase()) ? s(`HttpResponse<String> response = Unirest.${e.toLowerCase()}("${n}")`) : s(`HttpResponse<String> response = Unirest.customMethod("${e.toUpperCase()}","${n}")`), Object.keys(t).forEach((o) => {
655
+ s(`.header("${o}", "${D(t[o])}")`, 1);
656
+ }), r.text && s(`.body(${JSON.stringify(r.text)})`, 1), s(".asString();", 1), a();
657
+ }
658
+ }
659
+ }
660
+ }, no = {
661
+ info: {
662
+ key: "javascript",
663
+ title: "JavaScript",
664
+ default: "fetch"
665
+ },
666
+ clientsById: {
667
+ xhr: {
668
+ info: {
669
+ key: "xhr",
670
+ title: "XMLHttpRequest",
671
+ link: "https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest",
672
+ description: "W3C Standard API that provides scripted client functionality",
673
+ extname: ".js"
674
+ },
675
+ convert: ({ postData: e, allHeaders: t, method: r, fullUrl: n }, l) => {
676
+ var a;
677
+ const s = {
678
+ indent: " ",
679
+ cors: !0,
680
+ ...l
681
+ }, { blank: o, push: i, join: c } = new k({ indent: s.indent });
682
+ switch (e.mimeType) {
683
+ case "application/json":
684
+ i(`const data = JSON.stringify(${ae(e.jsonObj, { indent: s.indent })});`), o();
685
+ break;
686
+ case "multipart/form-data":
687
+ if (!e.params) break;
688
+ if (i("const data = new FormData();"), e.params.forEach((p) => {
689
+ i(`data.append('${p.name}', '${p.value || p.fileName || ""}');`);
690
+ }), nt(t, "content-type") && (a = le(t, "content-type")) != null && a.includes("boundary")) {
691
+ const p = W(t, "content-type");
692
+ p && delete t[p];
693
+ }
694
+ o();
695
+ break;
696
+ default:
697
+ i(`const data = ${e.text ? `'${e.text}'` : "null"};`), o();
698
+ }
699
+ return i("const xhr = new XMLHttpRequest();"), s.cors && i("xhr.withCredentials = true;"), o(), i("xhr.addEventListener('readystatechange', function () {"), i("if (this.readyState === this.DONE) {", 1), i("console.log(this.responseText);", 2), i("}", 1), i("});"), o(), i(`xhr.open('${r}', '${n}');`), Object.keys(t).forEach((p) => {
700
+ i(`xhr.setRequestHeader('${p}', '${Ae(t[p])}');`);
701
+ }), o(), i("xhr.send(data);"), c();
702
+ }
703
+ },
704
+ axios: {
705
+ info: {
706
+ key: "axios",
707
+ title: "Axios",
708
+ link: "https://github.com/axios/axios",
709
+ description: "Promise based HTTP client for the browser and node.js",
710
+ extname: ".js",
711
+ installation: () => "npm install axios --save"
712
+ },
713
+ convert: ({ allHeaders: e, method: t, url: r, queryObj: n, postData: l }, a) => {
714
+ const { blank: s, push: o, join: i, addPostProcessor: c } = new k({ indent: {
715
+ indent: " ",
716
+ ...a
717
+ }.indent });
718
+ o("import axios from 'axios';"), s();
719
+ const p = {
720
+ method: t,
721
+ url: r
722
+ };
723
+ switch (Object.keys(n).length && (p.params = n), Object.keys(e).length && (p.headers = e), l.mimeType) {
724
+ case "application/x-www-form-urlencoded":
725
+ l.params && (o("const encodedParams = new URLSearchParams();"), l.params.forEach((f) => {
726
+ o(`encodedParams.set('${f.name}', '${f.value}');`);
727
+ }), s(), p.data = "encodedParams,", c((f) => f.replace(/'encodedParams,'/, "encodedParams,")));
728
+ break;
729
+ case "application/json":
730
+ l.jsonObj && (p.data = l.jsonObj);
731
+ break;
732
+ case "multipart/form-data":
733
+ if (!l.params) break;
734
+ o("const form = new FormData();"), l.params.forEach((f) => {
735
+ o(`form.append('${f.name}', '${f.value || f.fileName || ""}');`);
736
+ }), s(), p.data = "[form]";
737
+ break;
738
+ default:
739
+ l.text && (p.data = l.text);
740
+ }
741
+ return o(`const options = ${ae(p, {
742
+ indent: " ",
743
+ inlineCharacterLimit: 80
744
+ }).replace('"[form]"', "form")};`), s(), o("try {"), o("const { data } = await axios.request(options);", 1), o("console.log(data);", 1), o("} catch (error) {"), o("console.error(error);", 1), o("}"), i();
745
+ }
746
+ },
747
+ fetch: {
748
+ info: {
749
+ key: "fetch",
750
+ title: "fetch",
751
+ link: "https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch",
752
+ description: "Perform asynchronous HTTP requests with the Fetch API",
753
+ extname: ".js"
754
+ },
755
+ convert: ({ method: e, allHeaders: t, postData: r, fullUrl: n }, l) => {
756
+ const a = {
757
+ indent: " ",
758
+ credentials: null,
759
+ ...l
760
+ }, { blank: s, join: o, push: i } = new k({ indent: a.indent }), c = { method: e };
761
+ switch (Object.keys(t).length && (c.headers = t), a.credentials !== null && (c.credentials = a.credentials), r.mimeType) {
762
+ case "application/x-www-form-urlencoded":
763
+ c.body = r.paramsObj ? r.paramsObj : r.text;
764
+ break;
765
+ case "application/json":
766
+ r.jsonObj && (c.body = r.jsonObj);
767
+ break;
768
+ case "multipart/form-data": {
769
+ if (!r.params) break;
770
+ const p = W(t, "content-type");
771
+ p && delete t[p], i("const form = new FormData();"), r.params.forEach((f) => {
772
+ i(`form.append('${f.name}', '${f.value || f.fileName || ""}');`);
773
+ }), s();
774
+ break;
775
+ }
776
+ default:
777
+ r.text && (c.body = r.text);
778
+ }
779
+ return c.headers && !Object.keys(c.headers).length && delete c.headers, i(`const options = ${ae(c, {
780
+ indent: a.indent,
781
+ inlineCharacterLimit: 80,
782
+ transform: (p, f, u) => {
783
+ if (f === "body") {
784
+ if (r.mimeType === "application/x-www-form-urlencoded") return `new URLSearchParams(${u})`;
785
+ if (r.mimeType === "application/json") return `JSON.stringify(${u})`;
786
+ }
787
+ return u;
788
+ }
789
+ })};`), s(), r.params && r.mimeType === "multipart/form-data" && (i("options.body = form;"), s()), i(`fetch('${n}', options)`), i(".then(res => res.json())", 1), i(".then(res => console.log(res))", 1), i(".catch(err => console.error(err));", 1), o();
790
+ }
791
+ },
792
+ jquery: {
793
+ info: {
794
+ key: "jquery",
795
+ title: "jQuery",
796
+ link: "http://api.jquery.com/jquery.ajax/",
797
+ description: "Perform an asynchronous HTTP (Ajax) requests with jQuery",
798
+ extname: ".js"
799
+ },
800
+ convert: ({ fullUrl: e, method: t, allHeaders: r, postData: n }, l) => {
801
+ var a;
802
+ const s = {
803
+ indent: " ",
804
+ ...l
805
+ }, { blank: o, push: i, join: c } = new k({ indent: s.indent }), p = {
806
+ async: !0,
807
+ crossDomain: !0,
808
+ url: e,
809
+ method: t,
810
+ headers: r
811
+ };
812
+ switch (n.mimeType) {
813
+ case "application/x-www-form-urlencoded":
814
+ p.data = n.paramsObj ? n.paramsObj : n.text;
815
+ break;
816
+ case "application/json":
817
+ p.processData = !1, p.data = n.text;
818
+ break;
819
+ case "multipart/form-data":
820
+ if (!n.params) break;
821
+ if (i("const form = new FormData();"), n.params.forEach((f) => {
822
+ i(`form.append('${f.name}', '${f.value || f.fileName || ""}');`);
823
+ }), p.processData = !1, p.contentType = !1, p.mimeType = "multipart/form-data", p.data = "[form]", nt(r, "content-type") && (a = le(r, "content-type")) != null && a.includes("boundary")) {
824
+ const f = W(r, "content-type");
825
+ f && delete p.headers[f];
826
+ }
827
+ o();
828
+ break;
829
+ default:
830
+ n.text && (p.data = n.text);
831
+ }
832
+ return i(`const settings = ${ae(p, { indent: s.indent }).replace("'[form]'", "form")};`), o(), i("$.ajax(settings).done(res => {"), i("console.log(res);", 1), i("});"), c();
833
+ }
834
+ }
835
+ }
836
+ }, oo = {
837
+ info: {
838
+ key: "json",
839
+ title: "JSON",
840
+ default: "native"
841
+ },
842
+ clientsById: { native: {
843
+ info: {
844
+ key: "native",
845
+ title: "Native JSON",
846
+ link: "https://www.json.org/json-en.html",
847
+ description: "A JSON represetation of any HAR payload.",
848
+ extname: ".json"
849
+ },
850
+ convert: ({ postData: e }, t) => {
851
+ const r = {
852
+ indent: " ",
853
+ ...t
854
+ };
855
+ let n = "";
856
+ switch (e.mimeType) {
857
+ case "application/x-www-form-urlencoded":
858
+ n = e.paramsObj ? e.paramsObj : e.text;
859
+ break;
860
+ case "application/json":
861
+ e.jsonObj && (n = e.jsonObj);
862
+ break;
863
+ case "multipart/form-data": {
864
+ if (!e.params) break;
865
+ const l = {};
866
+ e.params.forEach((a) => {
867
+ l[a.name] = a.value;
868
+ }), n = l;
869
+ break;
870
+ }
871
+ default:
872
+ e.text && (n = e.text);
873
+ }
874
+ return typeof n > "u" || n === "" ? "No JSON body" : JSON.stringify(n, null, r.indent);
875
+ }
876
+ } }
877
+ }, ao = {
878
+ info: {
879
+ key: "kotlin",
880
+ title: "Kotlin",
881
+ default: "okhttp"
882
+ },
883
+ clientsById: { okhttp: {
884
+ info: {
885
+ key: "okhttp",
886
+ title: "OkHttp",
887
+ link: "http://square.github.io/okhttp/",
888
+ description: "An HTTP Request Client Library",
889
+ extname: ".kt"
890
+ },
891
+ convert: ({ postData: e, fullUrl: t, method: r, allHeaders: n }, l) => {
892
+ const { blank: a, join: s, push: o } = new k({ indent: {
893
+ indent: " ",
894
+ ...l
895
+ }.indent }), i = [
896
+ "GET",
897
+ "POST",
898
+ "PUT",
899
+ "DELETE",
900
+ "PATCH",
901
+ "HEAD"
902
+ ], c = [
903
+ "POST",
904
+ "PUT",
905
+ "DELETE",
906
+ "PATCH"
907
+ ];
908
+ return o("val client = OkHttpClient()"), a(), e.text && (e.boundary ? o(`val mediaType = MediaType.parse("${e.mimeType}; boundary=${e.boundary}")`) : o(`val mediaType = MediaType.parse("${e.mimeType}")`), o(`val body = RequestBody.create(mediaType, ${JSON.stringify(e.text)})`)), o("val request = Request.Builder()"), o(`.url("${t}")`, 1), i.includes(r.toUpperCase()) ? c.includes(r.toUpperCase()) ? e.text ? o(`.${r.toLowerCase()}(body)`, 1) : o(`.${r.toLowerCase()}(null)`, 1) : o(`.${r.toLowerCase()}()`, 1) : e.text ? o(`.method("${r.toUpperCase()}", body)`, 1) : o(`.method("${r.toUpperCase()}", null)`, 1), Object.keys(n).forEach((p) => {
909
+ o(`.addHeader("${p}", "${D(n[p])}")`, 1);
910
+ }), o(".build()", 1), a(), o("val response = client.newCall(request).execute()"), s();
911
+ }
912
+ } }
913
+ }, io = {
914
+ info: {
915
+ key: "node",
916
+ title: "Node.js",
917
+ default: "fetch",
918
+ cli: "node %s"
919
+ },
920
+ clientsById: {
921
+ native: {
922
+ info: {
923
+ key: "native",
924
+ title: "HTTP",
925
+ link: "http://nodejs.org/api/http.html#http_http_request_options_callback",
926
+ description: "Node.js native HTTP interface",
927
+ extname: ".cjs"
928
+ },
929
+ convert: ({ uriObj: e, method: t, allHeaders: r, postData: n }, l = {}) => {
930
+ var a;
931
+ const { indent: s = " " } = l, { blank: o, join: i, push: c, unshift: p } = new k({ indent: s }), f = {
932
+ method: t,
933
+ hostname: e.hostname,
934
+ port: e.port,
935
+ path: e.path,
936
+ headers: r
937
+ };
938
+ switch (c(`const http = require('${(a = e.protocol) == null ? void 0 : a.replace(":", "")}');`), o(), c(`const options = ${ae(f, { indent: s })};`), o(), c("const req = http.request(options, function (res) {"), c("const chunks = [];", 1), o(), c("res.on('data', function (chunk) {", 1), c("chunks.push(chunk);", 2), c("});", 1), o(), c("res.on('end', function () {", 1), c("const body = Buffer.concat(chunks);", 2), c("console.log(body.toString());", 2), c("});", 1), c("});"), o(), n.mimeType) {
939
+ case "application/x-www-form-urlencoded":
940
+ n.paramsObj && (p("const qs = require('querystring');"), c(`req.write(qs.stringify(${ae(n.paramsObj, {
941
+ indent: " ",
942
+ inlineCharacterLimit: 80
943
+ })}));`));
944
+ break;
945
+ case "application/json":
946
+ n.jsonObj && c(`req.write(JSON.stringify(${ae(n.jsonObj, {
947
+ indent: " ",
948
+ inlineCharacterLimit: 80
949
+ })}));`);
950
+ break;
951
+ default:
952
+ n.text && c(`req.write(${ae(n.text, { indent: s })});`);
953
+ }
954
+ return c("req.end();"), i();
955
+ }
956
+ },
957
+ axios: {
958
+ info: {
959
+ key: "axios",
960
+ title: "Axios",
961
+ link: "https://github.com/axios/axios",
962
+ description: "Promise based HTTP client for the browser and node.js",
963
+ extname: ".js",
964
+ installation: () => "npm install axios --save"
965
+ },
966
+ convert: ({ method: e, fullUrl: t, allHeaders: r, postData: n }, l) => {
967
+ const { blank: a, join: s, push: o, addPostProcessor: i } = new k({ indent: {
968
+ indent: " ",
969
+ ...l
970
+ }.indent });
971
+ o("import axios from 'axios';"), a();
972
+ const c = {
973
+ method: e,
974
+ url: t
975
+ };
976
+ switch (Object.keys(r).length && (c.headers = r), n.mimeType) {
977
+ case "application/x-www-form-urlencoded":
978
+ n.params && (o("const encodedParams = new URLSearchParams();"), n.params.forEach((p) => {
979
+ o(`encodedParams.set('${p.name}', '${p.value}');`);
980
+ }), a(), c.data = "encodedParams,", i((p) => p.replace(/'encodedParams,'/, "encodedParams,")));
981
+ break;
982
+ case "application/json":
983
+ n.jsonObj && (c.data = n.jsonObj);
984
+ break;
985
+ default:
986
+ n.text && (c.data = n.text);
987
+ }
988
+ return o(`const options = ${ae(c, {
989
+ indent: " ",
990
+ inlineCharacterLimit: 80
991
+ })};`), a(), o("axios"), o(".request(options)", 1), o(".then(res => console.log(res.data))", 1), o(".catch(err => console.error(err));", 1), s();
992
+ }
993
+ },
994
+ fetch: {
995
+ info: {
996
+ key: "fetch",
997
+ title: "fetch",
998
+ link: "https://nodejs.org/docs/latest/api/globals.html#fetch",
999
+ description: "Perform asynchronous HTTP requests with the Fetch API",
1000
+ extname: ".js"
1001
+ },
1002
+ convert: ({ method: e, fullUrl: t, postData: r, headersObj: n, cookies: l }, a) => {
1003
+ var s;
1004
+ const o = {
1005
+ indent: " ",
1006
+ ...a
1007
+ };
1008
+ let i = !1;
1009
+ const { blank: c, push: p, join: f, unshift: u } = new k({ indent: o.indent }), d = t, h = { method: e };
1010
+ switch (Object.keys(n).length && (h.headers = n), r.mimeType) {
1011
+ case "application/x-www-form-urlencoded":
1012
+ p("const encodedParams = new URLSearchParams();"), (s = r.params) == null || s.forEach((m) => {
1013
+ p(`encodedParams.set('${m.name}', '${m.value}');`);
1014
+ }), h.body = "encodedParams", c();
1015
+ break;
1016
+ case "application/json":
1017
+ r.jsonObj && (h.body = r.jsonObj);
1018
+ break;
1019
+ case "multipart/form-data": {
1020
+ if (!r.params) break;
1021
+ const m = W(n, "content-type");
1022
+ m && delete n[m], p("const formData = new FormData();"), r.params.forEach((b) => {
1023
+ if (!b.fileName && !b.contentType) {
1024
+ p(`formData.append('${b.name}', '${b.value}');`);
1025
+ return;
1026
+ }
1027
+ b.fileName && (i = !0, p(`formData.append('${b.name}', await new Response(fs.createReadStream('${b.fileName}')).blob());`));
1028
+ }), h.body = "formData", c();
1029
+ break;
1030
+ }
1031
+ default:
1032
+ r.text && (h.body = r.text);
1033
+ }
1034
+ if (l.length) {
1035
+ const m = l.map(({ name: b, value: j }) => `${encodeURIComponent(b)}=${encodeURIComponent(j)}`).join("; ");
1036
+ h.headers || (h.headers = {}), h.headers.cookie = m;
1037
+ }
1038
+ return p(`const url = '${d}';`), h.headers && !Object.keys(h.headers).length && delete h.headers, p(`const options = ${ae(h, {
1039
+ indent: " ",
1040
+ inlineCharacterLimit: 80,
1041
+ transform: (m, b, j) => b === "body" && r.mimeType === "application/json" ? `JSON.stringify(${j})` : j
1042
+ })};`), c(), i && u(`import fs from 'fs';
1043
+ `), p("fetch(url, options)"), p(".then(res => res.json())", 1), p(".then(json => console.log(json))", 1), p(".catch(err => console.error(err));", 1), f().replace(/'encodedParams'/, "encodedParams").replace(/'formData'/, "formData");
1044
+ }
1045
+ }
1046
+ }
1047
+ }, bt = (e, t, r, n) => {
1048
+ const l = `${e} *${t} = `;
1049
+ return `${l}${Ut(r, n ? l.length : void 0)};`;
1050
+ }, Ut = (e, t) => {
1051
+ const r = t === void 0 ? ", " : `,
1052
+ ${" ".repeat(t)}`;
1053
+ switch (Object.prototype.toString.call(e)) {
1054
+ case "[object Number]":
1055
+ return `@${e}`;
1056
+ case "[object Array]":
1057
+ return `@[ ${e.map((n) => Ut(n)).join(r)} ]`;
1058
+ case "[object Object]": {
1059
+ const n = [];
1060
+ return Object.keys(e).forEach((l) => {
1061
+ n.push(`@"${l}": ${Ut(e[l])}`);
1062
+ }), `@{ ${n.join(r)} }`;
1063
+ }
1064
+ case "[object Boolean]":
1065
+ return e ? "@YES" : "@NO";
1066
+ default:
1067
+ return e == null ? "" : `@"${e.toString().replace(/"/g, '\\"')}"`;
1068
+ }
1069
+ }, so = {
1070
+ info: {
1071
+ key: "objc",
1072
+ title: "Objective-C",
1073
+ default: "nsurlsession"
1074
+ },
1075
+ clientsById: { nsurlsession: {
1076
+ info: {
1077
+ key: "nsurlsession",
1078
+ title: "NSURLSession",
1079
+ link: "https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLSession_class/index.html",
1080
+ description: "Foundation's NSURLSession request",
1081
+ extname: ".m"
1082
+ },
1083
+ convert: ({ allHeaders: e, postData: t, method: r, fullUrl: n }, l) => {
1084
+ var a;
1085
+ const s = {
1086
+ indent: " ",
1087
+ pretty: !0,
1088
+ timeout: 10,
1089
+ ...l
1090
+ }, { push: o, join: i, blank: c } = new k({ indent: s.indent }), p = {
1091
+ hasHeaders: !1,
1092
+ hasBody: !1
1093
+ };
1094
+ if (o("#import <Foundation/Foundation.h>"), Object.keys(e).length && (p.hasHeaders = !0, c(), o(bt("NSDictionary", "headers", e, s.pretty))), t.text || t.jsonObj || t.params)
1095
+ switch (p.hasBody = !0, t.mimeType) {
1096
+ case "application/x-www-form-urlencoded":
1097
+ if ((a = t.params) != null && a.length) {
1098
+ c();
1099
+ const [f, ...u] = t.params;
1100
+ o(`NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"${f.name}=${f.value}" dataUsingEncoding:NSUTF8StringEncoding]];`), u.forEach(({ name: d, value: h }) => {
1101
+ o(`[postData appendData:[@"&${d}=${h}" dataUsingEncoding:NSUTF8StringEncoding]];`);
1102
+ });
1103
+ } else p.hasBody = !1;
1104
+ break;
1105
+ case "application/json":
1106
+ t.jsonObj && (o(bt("NSDictionary", "parameters", t.jsonObj, s.pretty)), c(), o("NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];"));
1107
+ break;
1108
+ case "multipart/form-data":
1109
+ o(bt("NSArray", "parameters", t.params || [], s.pretty)), o(`NSString *boundary = @"${t.boundary}";`), c(), o("NSError *error;"), o("NSMutableString *body = [NSMutableString string];"), o("for (NSDictionary *param in parameters) {"), o('[body appendFormat:@"--%@\\r\\n", boundary];', 1), o('if (param[@"fileName"]) {', 1), o('[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"; filename=\\"%@\\"\\r\\n", param[@"name"], param[@"fileName"]];', 2), o('[body appendFormat:@"Content-Type: %@\\r\\n\\r\\n", param[@"contentType"]];', 2), o('[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];', 2), o("if (error) {", 2), o('NSLog(@"%@", error);', 3), o("}", 2), o("} else {", 1), o('[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"\\r\\n\\r\\n", param[@"name"]];', 2), o('[body appendFormat:@"%@", param[@"value"]];', 2), o("}", 1), o("}"), o('[body appendFormat:@"\\r\\n--%@--\\r\\n", boundary];'), o("NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];");
1110
+ break;
1111
+ default:
1112
+ c(), o(`NSData *postData = [[NSData alloc] initWithData:[@"${t.text}" dataUsingEncoding:NSUTF8StringEncoding]];`);
1113
+ }
1114
+ return c(), o(`NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"${n}"]`), o(" cachePolicy:NSURLRequestUseProtocolCachePolicy"), o(` timeoutInterval:${s.timeout.toFixed(1)}];`), o(`[request setHTTPMethod:@"${r}"];`), p.hasHeaders && o("[request setAllHTTPHeaderFields:headers];"), p.hasBody && o("[request setHTTPBody:postData];"), c(), o("NSURLSession *session = [NSURLSession sharedSession];"), o("NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request"), o(" completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {"), o(" if (error) {", 1), o(' NSLog(@"%@", error);', 2), o(" } else {", 1), o(" NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;", 2), o(' NSLog(@"%@", httpResponse);', 2), o(" }", 1), o(" }];"), o("[dataTask resume];"), i();
1115
+ }
1116
+ } }
1117
+ }, lo = {
1118
+ info: {
1119
+ key: "ocaml",
1120
+ title: "OCaml",
1121
+ default: "cohttp"
1122
+ },
1123
+ clientsById: { cohttp: {
1124
+ info: {
1125
+ key: "cohttp",
1126
+ title: "CoHTTP",
1127
+ link: "https://github.com/mirage/ocaml-cohttp",
1128
+ description: "Cohttp is a very lightweight HTTP server using Lwt or Async for OCaml",
1129
+ extname: ".ml",
1130
+ installation: () => "opam install cohttp-lwt-unix cohttp-async"
1131
+ },
1132
+ convert: ({ fullUrl: e, allHeaders: t, postData: r, method: n }, l) => {
1133
+ const a = {
1134
+ indent: " ",
1135
+ ...l
1136
+ }, s = [
1137
+ "get",
1138
+ "post",
1139
+ "head",
1140
+ "delete",
1141
+ "patch",
1142
+ "put",
1143
+ "options"
1144
+ ], { push: o, blank: i, join: c } = new k({ indent: a.indent });
1145
+ o("open Cohttp_lwt_unix"), o("open Cohttp"), o("open Lwt"), i(), o(`let uri = Uri.of_string "${e}" in`);
1146
+ const p = Object.keys(t);
1147
+ return p.length === 1 ? o(`let headers = Header.add (Header.init ()) "${p[0]}" "${D(t[p[0]])}" in`) : p.length > 1 && (o("let headers = Header.add_list (Header.init ()) ["), p.forEach((f) => {
1148
+ o(`("${f}", "${D(t[f])}");`, 1);
1149
+ }), o("] in")), r.text && o(`let body = Cohttp_lwt_body.of_string ${JSON.stringify(r.text)} in`), i(), o(`Client.call ${p.length ? "~headers " : ""}${r.text ? "~body " : ""}${s.includes(n.toLowerCase()) ? `\`${n.toUpperCase()}` : `(Code.method_of_string "${n}")`} uri`), o(">>= fun (res, body_stream) ->"), o("(* Do stuff with the result *)", 1), c();
1150
+ }
1151
+ } }
1152
+ }, A = (e, t, r) => {
1153
+ switch (r = r || "", t = t || "", Object.prototype.toString.call(e)) {
1154
+ case "[object Boolean]":
1155
+ return e;
1156
+ case "[object Null]":
1157
+ return "null";
1158
+ case "[object Undefined]":
1159
+ return "null";
1160
+ case "[object String]":
1161
+ return `'${Me(e, {
1162
+ delimiter: "'",
1163
+ escapeNewlines: !1
1164
+ })}'`;
1165
+ case "[object Number]":
1166
+ return e.toString();
1167
+ case "[object Array]": {
1168
+ const n = e.map((l) => A(l, `${t}${t}`, t)).join(`,
1169
+ ${t}`);
1170
+ return `[
1171
+ ${t}${n}
1172
+ ${r}]`;
1173
+ }
1174
+ case "[object Object]": {
1175
+ const n = [];
1176
+ for (const l in e) Object.prototype.hasOwnProperty.call(e, l) && n.push(`${A(l, t)} => ${A(e[l], `${t}${t}`, t)}`);
1177
+ return `[
1178
+ ${t}${n.join(`,
1179
+ ${t}`)}
1180
+ ${r}]`;
1181
+ }
1182
+ default:
1183
+ return "null";
1184
+ }
1185
+ }, sr = [
1186
+ "ACL",
1187
+ "BASELINE_CONTROL",
1188
+ "CHECKIN",
1189
+ "CHECKOUT",
1190
+ "CONNECT",
1191
+ "COPY",
1192
+ "DELETE",
1193
+ "GET",
1194
+ "HEAD",
1195
+ "LABEL",
1196
+ "LOCK",
1197
+ "MERGE",
1198
+ "MKACTIVITY",
1199
+ "MKCOL",
1200
+ "MKWORKSPACE",
1201
+ "MOVE",
1202
+ "OPTIONS",
1203
+ "POST",
1204
+ "PROPFIND",
1205
+ "PROPPATCH",
1206
+ "PUT",
1207
+ "REPORT",
1208
+ "TRACE",
1209
+ "UNCHECKOUT",
1210
+ "UNLOCK",
1211
+ "UPDATE",
1212
+ "VERSION_CONTROL"
1213
+ ], co = {
1214
+ info: {
1215
+ key: "php",
1216
+ title: "PHP",
1217
+ default: "curl",
1218
+ cli: "php %s"
1219
+ },
1220
+ clientsById: {
1221
+ curl: {
1222
+ info: {
1223
+ key: "curl",
1224
+ title: "cURL",
1225
+ link: "http://php.net/manual/en/book.curl.php",
1226
+ description: "PHP with ext-curl",
1227
+ extname: ".php"
1228
+ },
1229
+ convert: ({ uriObj: e, postData: t, fullUrl: r, method: n, httpVersion: l, cookies: a, headersObj: s }, o = {}) => {
1230
+ const { closingTag: i = !1, indent: c = " ", maxRedirects: p = 10, namedErrors: f = !1, noTags: u = !1, shortTags: d = !1, timeout: h = 30 } = o, { push: m, blank: b, join: j } = new k({ indent: c });
1231
+ u || (m(d ? "<?" : "<?php"), b()), m("$curl = curl_init();"), b();
1232
+ const y = [
1233
+ {
1234
+ escape: !0,
1235
+ name: "CURLOPT_PORT",
1236
+ value: e.port
1237
+ },
1238
+ {
1239
+ escape: !0,
1240
+ name: "CURLOPT_URL",
1241
+ value: r
1242
+ },
1243
+ {
1244
+ escape: !1,
1245
+ name: "CURLOPT_RETURNTRANSFER",
1246
+ value: "true"
1247
+ },
1248
+ {
1249
+ escape: !0,
1250
+ name: "CURLOPT_ENCODING",
1251
+ value: ""
1252
+ },
1253
+ {
1254
+ escape: !1,
1255
+ name: "CURLOPT_MAXREDIRS",
1256
+ value: p
1257
+ },
1258
+ {
1259
+ escape: !1,
1260
+ name: "CURLOPT_TIMEOUT",
1261
+ value: h
1262
+ },
1263
+ {
1264
+ escape: !1,
1265
+ name: "CURLOPT_HTTP_VERSION",
1266
+ value: l === "HTTP/1.0" ? "CURL_HTTP_VERSION_1_0" : "CURL_HTTP_VERSION_1_1"
1267
+ },
1268
+ {
1269
+ escape: !0,
1270
+ name: "CURLOPT_CUSTOMREQUEST",
1271
+ value: n
1272
+ },
1273
+ {
1274
+ escape: !t.jsonObj,
1275
+ name: "CURLOPT_POSTFIELDS",
1276
+ value: t ? t.jsonObj ? `json_encode(${A(t.jsonObj, c.repeat(2), c)})` : t.text : void 0
1277
+ }
1278
+ ];
1279
+ m("curl_setopt_array($curl, [");
1280
+ const g = new k({
1281
+ indent: c,
1282
+ join: `
1283
+ ${c}`
1284
+ });
1285
+ y.forEach(({ value: $, name: E, escape: S }) => {
1286
+ $ != null && g.push(`${E} => ${S ? JSON.stringify($) : $},`);
1287
+ });
1288
+ const w = a.map(($) => `${encodeURIComponent($.name)}=${encodeURIComponent($.value)}`);
1289
+ w.length && g.push(`CURLOPT_COOKIE => "${w.join("; ")}",`);
1290
+ const O = Object.keys(s).sort().map(($) => `"${$}: ${D(s[$])}"`);
1291
+ return O.length && (g.push("CURLOPT_HTTPHEADER => ["), g.push(O.join(`,
1292
+ ${c}${c}`), 1), g.push("],")), m(g.join(), 1), m("]);"), b(), m("$response = curl_exec($curl);"), m("$err = curl_error($curl);"), b(), m("curl_close($curl);"), b(), m("if ($err) {"), m(f ? 'echo array_flip(get_defined_constants(true)["curl"])[$err];' : 'echo "cURL Error #:" . $err;', 1), m("} else {"), m("echo $response;", 1), m("}"), !u && i && (b(), m("?>")), j();
1293
+ }
1294
+ },
1295
+ guzzle: {
1296
+ info: {
1297
+ key: "guzzle",
1298
+ title: "Guzzle",
1299
+ link: "http://docs.guzzlephp.org/en/stable/",
1300
+ description: "PHP with Guzzle",
1301
+ extname: ".php",
1302
+ installation: () => "composer require guzzlehttp/guzzle"
1303
+ },
1304
+ convert: ({ postData: e, fullUrl: t, method: r, cookies: n, headersObj: l }, a) => {
1305
+ var s;
1306
+ const o = {
1307
+ closingTag: !1,
1308
+ indent: " ",
1309
+ noTags: !1,
1310
+ shortTags: !1,
1311
+ ...a
1312
+ }, { push: i, blank: c, join: p } = new k({ indent: o.indent }), { code: f, push: u, join: d } = new k({ indent: o.indent });
1313
+ switch (o.noTags || i(o.shortTags ? "<?" : "<?php"), i("require_once('vendor/autoload.php');"), c(), e.mimeType) {
1314
+ case "application/x-www-form-urlencoded":
1315
+ u(`'form_params' => ${A(e.paramsObj, o.indent + o.indent, o.indent)},`, 1);
1316
+ break;
1317
+ case "multipart/form-data": {
1318
+ const b = [];
1319
+ if (e.params && e.params.forEach((j) => {
1320
+ if (j.fileName) {
1321
+ const y = {
1322
+ name: j.name,
1323
+ filename: j.fileName,
1324
+ contents: j.value
1325
+ };
1326
+ j.contentType && (y.headers = { "Content-Type": j.contentType }), b.push(y);
1327
+ } else j.value && b.push({
1328
+ name: j.name,
1329
+ contents: j.value
1330
+ });
1331
+ }), b.length && (u(`'multipart' => ${A(b, o.indent + o.indent, o.indent)}`, 1), nt(l, "content-type") && (s = le(l, "content-type")) != null && s.indexOf("boundary"))) {
1332
+ const j = W(l, "content-type");
1333
+ j && delete l[j];
1334
+ }
1335
+ break;
1336
+ }
1337
+ default:
1338
+ e.text && u(`'body' => ${A(e.text)},`, 1);
1339
+ }
1340
+ const h = Object.keys(l).sort().map((b) => `${o.indent}${o.indent}'${b}' => '${Ae(l[b])}',`), m = n.map((b) => `${encodeURIComponent(b.name)}=${encodeURIComponent(b.value)}`).join("; ");
1341
+ return m.length && h.push(`${o.indent}${o.indent}'cookie' => '${Ae(m)}',`), h.length && (u("'headers' => [", 1), u(h.join(`
1342
+ `)), u("],", 1)), i("$client = new \\GuzzleHttp\\Client();"), c(), f.length ? (i(`$response = $client->request('${r}', '${t}', [`), i(d()), i("]);")) : i(`$response = $client->request('${r}', '${t}');`), c(), i("echo $response->getBody();"), !o.noTags && o.closingTag && (c(), i("?>")), p();
1343
+ }
1344
+ },
1345
+ http1: {
1346
+ info: {
1347
+ key: "http1",
1348
+ title: "HTTP v1",
1349
+ link: "http://php.net/manual/en/book.http.php",
1350
+ description: "PHP with pecl/http v1",
1351
+ extname: ".php"
1352
+ },
1353
+ convert: ({ method: e, url: t, postData: r, queryObj: n, headersObj: l, cookiesObj: a }, s = {}) => {
1354
+ const { closingTag: o = !1, indent: i = " ", noTags: c = !1, shortTags: p = !1 } = s, { push: f, blank: u, join: d } = new k({ indent: i });
1355
+ switch (c || (f(p ? "<?" : "<?php"), u()), sr.includes(e.toUpperCase()) || f(`HttpRequest::methodRegister('${e}');`), f("$request = new HttpRequest();"), f(`$request->setUrl(${A(t)});`), sr.includes(e.toUpperCase()) ? f(`$request->setMethod(HTTP_METH_${e.toUpperCase()});`) : f(`$request->setMethod(HttpRequest::HTTP_METH_${e.toUpperCase()});`), u(), Object.keys(n).length && (f(`$request->setQueryData(${A(n, i)});`), u()), Object.keys(l).length && (f(`$request->setHeaders(${A(l, i)});`), u()), Object.keys(a).length && (f(`$request->setCookies(${A(a, i)});`), u()), r.mimeType) {
1356
+ case "application/x-www-form-urlencoded":
1357
+ f(`$request->setContentType(${A(r.mimeType)});`), f(`$request->setPostFields(${A(r.paramsObj, i)});`), u();
1358
+ break;
1359
+ case "application/json":
1360
+ f(`$request->setContentType(${A(r.mimeType)});`), f(`$request->setBody(json_encode(${A(r.jsonObj, i)}));`), u();
1361
+ break;
1362
+ default:
1363
+ r.text && (f(`$request->setBody(${A(r.text)});`), u());
1364
+ }
1365
+ return f("try {"), f("$response = $request->send();", 1), u(), f("echo $response->getBody();", 1), f("} catch (HttpException $ex) {"), f("echo $ex;", 1), f("}"), !c && o && (u(), f("?>")), d();
1366
+ }
1367
+ },
1368
+ http2: {
1369
+ info: {
1370
+ key: "http2",
1371
+ title: "HTTP v2",
1372
+ link: "http://devel-m6w6.rhcloud.com/mdref/http",
1373
+ description: "PHP with pecl/http v2",
1374
+ extname: ".php"
1375
+ },
1376
+ convert: ({ postData: e, headersObj: t, method: r, queryObj: n, cookiesObj: l, url: a }, s = {}) => {
1377
+ var o;
1378
+ const { closingTag: i = !1, indent: c = " ", noTags: p = !1, shortTags: f = !1 } = s, { push: u, blank: d, join: h } = new k({ indent: c });
1379
+ let m = !1;
1380
+ switch (p || (u(f ? "<?" : "<?php"), d()), u("$client = new http\\Client;"), u("$request = new http\\Client\\Request;"), d(), e.mimeType) {
1381
+ case "application/x-www-form-urlencoded":
1382
+ u("$body = new http\\Message\\Body;"), u(`$body->append(new http\\QueryString(${A(e.paramsObj, c)}));`), d(), m = !0;
1383
+ break;
1384
+ case "multipart/form-data": {
1385
+ if (!e.params) break;
1386
+ const b = [], j = {};
1387
+ e.params.forEach(({ name: w, fileName: O, value: $, contentType: E }) => {
1388
+ if (O) {
1389
+ b.push({
1390
+ name: w,
1391
+ type: E,
1392
+ file: O,
1393
+ data: $
1394
+ });
1395
+ return;
1396
+ }
1397
+ $ && (j[w] = $);
1398
+ });
1399
+ const y = Object.keys(j).length ? A(j, c) : "null", g = b.length ? A(b, c) : "null";
1400
+ if (u("$body = new http\\Message\\Body;"), u(`$body->addForm(${y}, ${g});`), nt(t, "content-type") && (o = le(t, "content-type")) != null && o.indexOf("boundary")) {
1401
+ const w = W(t, "content-type");
1402
+ w && delete t[w];
1403
+ }
1404
+ d(), m = !0;
1405
+ break;
1406
+ }
1407
+ case "application/json":
1408
+ u("$body = new http\\Message\\Body;"), u(`$body->append(json_encode(${A(e.jsonObj, c)}));`), m = !0;
1409
+ break;
1410
+ default:
1411
+ e.text && (u("$body = new http\\Message\\Body;"), u(`$body->append(${A(e.text)});`), d(), m = !0);
1412
+ }
1413
+ return u(`$request->setRequestUrl(${A(a)});`), u(`$request->setRequestMethod(${A(r)});`), m && (u("$request->setBody($body);"), d()), Object.keys(n).length && (u(`$request->setQuery(new http\\QueryString(${A(n, c)}));`), d()), Object.keys(t).length && (u(`$request->setHeaders(${A(t, c)});`), d()), Object.keys(l).length && (d(), u(`$client->setCookies(${A(l, c)});`), d()), u("$client->enqueue($request)->send();"), u("$response = $client->getResponse();"), d(), u("echo $response->getBody();"), !p && i && (d(), u("?>")), h();
1414
+ }
1415
+ }
1416
+ }
1417
+ }, Yr = (e) => ({ method: t, headersObj: r, cookies: n, uriObj: l, fullUrl: a, postData: s, allHeaders: o }) => {
1418
+ const { push: i, join: c } = new k();
1419
+ if (![
1420
+ "GET",
1421
+ "POST",
1422
+ "PUT",
1423
+ "DELETE",
1424
+ "PATCH",
1425
+ "HEAD",
1426
+ "OPTIONS"
1427
+ ].includes(t.toUpperCase())) return "Method not supported";
1428
+ const p = [], f = Object.keys(r);
1429
+ return f.length && (i("$headers=@{}"), f.forEach((u) => {
1430
+ u !== "connection" && i(`$headers.Add("${u}", "${Me(r[u], { escapeChar: "`" })}")`);
1431
+ }), p.push("-Headers $headers")), n.length && (i("$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession"), n.forEach((u) => {
1432
+ i("$cookie = New-Object System.Net.Cookie"), i(`$cookie.Name = '${u.name}'`), i(`$cookie.Value = '${u.value}'`), i(`$cookie.Domain = '${l.host}'`), i("$session.Cookies.Add($cookie)");
1433
+ }), p.push("-WebSession $session")), s.text && (p.push(`-ContentType '${Me(le(o, "content-type"), {
1434
+ delimiter: "'",
1435
+ escapeChar: "`"
1436
+ })}'`), p.push(`-Body '${s.text}'`)), i(`$response = ${e} -Uri '${a}' -Method ${t} ${p.join(" ")}`.trim()), c();
1437
+ }, po = {
1438
+ info: {
1439
+ key: "restmethod",
1440
+ title: "Invoke-RestMethod",
1441
+ link: "https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-RestMethod",
1442
+ description: "Powershell Invoke-RestMethod client",
1443
+ extname: ".ps1"
1444
+ },
1445
+ convert: Yr("Invoke-RestMethod")
1446
+ }, uo = {
1447
+ info: {
1448
+ key: "powershell",
1449
+ title: "Powershell",
1450
+ default: "webrequest"
1451
+ },
1452
+ clientsById: {
1453
+ webrequest: {
1454
+ info: {
1455
+ key: "webrequest",
1456
+ title: "Invoke-WebRequest",
1457
+ link: "https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-WebRequest",
1458
+ description: "Powershell Invoke-WebRequest client",
1459
+ extname: ".ps1"
1460
+ },
1461
+ convert: Yr("Invoke-WebRequest")
1462
+ },
1463
+ restmethod: po
1464
+ }
1465
+ };
1466
+ function lr(e, t, r, n, l) {
1467
+ const a = n.repeat(l), s = n.repeat(l - 1), o = r ? `,
1468
+ ${a}` : ", ", i = e === "object" ? "{" : "[", c = e === "object" ? "}" : "]";
1469
+ return r ? `${i}
1470
+ ${a}${t.join(o)}
1471
+ ${s}${c}` : e === "object" && t.length > 0 ? `${i} ${t.join(o)} ${c}` : `${i}${t.join(o)}${c}`;
1472
+ }
1473
+ const Te = (e, t, r) => {
1474
+ switch (r = r === void 0 ? 1 : r + 1, Object.prototype.toString.call(e)) {
1475
+ case "[object Number]":
1476
+ return e;
1477
+ case "[object Array]": {
1478
+ let n = !1;
1479
+ return lr("array", e.map((l) => (Object.prototype.toString.call(l) === "[object Object]" && (n = Object.keys(l).length > 1), Te(l, t, r))), n, t.indent, r);
1480
+ }
1481
+ case "[object Object]": {
1482
+ const n = [];
1483
+ for (const l in e) n.push(`"${l}": ${Te(e[l], t, r)}`);
1484
+ return lr("object", n, t.pretty && n.length > 1, t.indent, r);
1485
+ }
1486
+ case "[object Null]":
1487
+ return "None";
1488
+ case "[object Boolean]":
1489
+ return e ? "True" : "False";
1490
+ default:
1491
+ return e == null ? "" : `"${e.toString().replace(/"/g, '\\"')}"`;
1492
+ }
1493
+ }, fo = [
1494
+ "HEAD",
1495
+ "GET",
1496
+ "POST",
1497
+ "PUT",
1498
+ "PATCH",
1499
+ "DELETE",
1500
+ "OPTIONS"
1501
+ ], ho = {
1502
+ info: {
1503
+ key: "python",
1504
+ title: "Python",
1505
+ default: "requests",
1506
+ cli: "python3 %s"
1507
+ },
1508
+ clientsById: { requests: {
1509
+ info: {
1510
+ key: "requests",
1511
+ title: "Requests",
1512
+ link: "http://docs.python-requests.org/en/latest/api/#requests.request",
1513
+ description: "Requests HTTP library",
1514
+ extname: ".py",
1515
+ installation: () => "python -m pip install requests"
1516
+ },
1517
+ convert: ({ fullUrl: e, postData: t, allHeaders: r, method: n }, l) => {
1518
+ const a = {
1519
+ indent: " ",
1520
+ pretty: !0,
1521
+ ...l
1522
+ }, { push: s, blank: o, join: i, addPostProcessor: c } = new k({ indent: a.indent });
1523
+ s("import requests"), o(), s(`url = "${e}"`), o();
1524
+ const p = r;
1525
+ let f = {};
1526
+ const u = {};
1527
+ let d = !1, h = !1, m = !1;
1528
+ switch (t.mimeType) {
1529
+ case "application/json":
1530
+ t.jsonObj && (s(`payload = ${Te(t.jsonObj, a)}`), m = !0, h = !0);
1531
+ break;
1532
+ case "multipart/form-data":
1533
+ if (!t.params) break;
1534
+ if (f = {}, t.params.forEach((y) => {
1535
+ y.fileName ? (y.contentType ? u[y.name] = `('${y.fileName}', open('${y.fileName}', 'rb'), '${y.contentType}')` : u[y.name] = `('${y.fileName}', open('${y.fileName}', 'rb'))`, d = !0) : (f[y.name] = y.value, h = !0);
1536
+ }), d) {
1537
+ s(`files = ${Te(u, a)}`), h && s(`payload = ${Te(f, a)}`);
1538
+ const y = W(p, "content-type");
1539
+ y && delete p[y];
1540
+ } else {
1541
+ const y = JSON.stringify(t.text);
1542
+ y && (s(`payload = ${y}`), h = !0);
1543
+ }
1544
+ c((y) => y.replace(/"\('(.+)', open\('(.+)', 'rb'\)\)"/g, '("$1", open("$2", "rb"))').replace(/"\('(.+)', open\('(.+)', 'rb'\), '(.+)'\)"/g, '("$1", open("$2", "rb"), "$3")'));
1545
+ break;
1546
+ default: {
1547
+ if (t.mimeType === "application/x-www-form-urlencoded" && t.paramsObj) {
1548
+ s(`payload = ${Te(t.paramsObj, a)}`), h = !0;
1549
+ break;
1550
+ }
1551
+ const y = JSON.stringify(t.text);
1552
+ y && (s(`payload = ${y}`), h = !0);
1553
+ }
1554
+ }
1555
+ const b = Object.keys(p).length;
1556
+ if (b === 0 && (h || d)) o();
1557
+ else if (b === 1) Object.keys(p).forEach((y) => {
1558
+ s(`headers = {"${y}": "${D(p[y])}"}`), o();
1559
+ });
1560
+ else if (b > 1) {
1561
+ let y = 1;
1562
+ s("headers = {"), Object.keys(p).forEach((g) => {
1563
+ s(y !== b ? `"${g}": "${D(p[g])}",` : `"${g}": "${D(p[g])}"`, 1), y += 1;
1564
+ }), s("}"), o();
1565
+ }
1566
+ let j = fo.includes(n) ? `response = requests.${n.toLowerCase()}(url` : `response = requests.request("${n}", url`;
1567
+ return h && (m ? j += ", json=payload" : j += ", data=payload"), d && (j += ", files=files"), b > 0 && (j += ", headers=headers"), j += ")", s(j), o(), s("print(response.text)"), i();
1568
+ }
1569
+ } }
1570
+ }, yo = {
1571
+ info: {
1572
+ key: "r",
1573
+ title: "R",
1574
+ default: "httr"
1575
+ },
1576
+ clientsById: { httr: {
1577
+ info: {
1578
+ key: "httr",
1579
+ title: "httr",
1580
+ link: "https://cran.r-project.org/web/packages/httr/vignettes/quickstart.html",
1581
+ description: "httr: Tools for Working with URLs and HTTP",
1582
+ extname: ".r"
1583
+ },
1584
+ convert: ({ url: e, queryObj: t, queryString: r, postData: n, allHeaders: l, method: a }) => {
1585
+ const { push: s, blank: o, join: i } = new k();
1586
+ s("library(httr)"), o(), s(`url <- "${e}"`), o();
1587
+ const c = t;
1588
+ delete t.key;
1589
+ const p = Object.keys(c).length;
1590
+ r.length === 1 ? (s(`queryString <- list(${Object.keys(c)} = "${Object.values(c).toString()}")`), o()) : r.length > 1 && (s("queryString <- list("), Object.keys(c).forEach((O, $) => {
1591
+ $ !== p - 1 ? s(` ${O} = "${c[O].toString()}",`) : s(` ${O} = "${c[O].toString()}"`);
1592
+ }), s(")"), o());
1593
+ const f = JSON.stringify(n.text);
1594
+ if (f && (s(`payload <- ${f}`), o()), n.text || n.jsonObj || n.params) switch (n.mimeType) {
1595
+ case "application/x-www-form-urlencoded":
1596
+ s('encode <- "form"'), o();
1597
+ break;
1598
+ case "application/json":
1599
+ s('encode <- "json"'), o();
1600
+ break;
1601
+ case "multipart/form-data":
1602
+ s('encode <- "multipart"'), o();
1603
+ break;
1604
+ default:
1605
+ s('encode <- "raw"'), o();
1606
+ break;
1607
+ }
1608
+ const u = le(l, "cookie"), d = le(l, "accept"), h = u ? `set_cookies(\`${String(u).replace(/;/g, '", `').replace(/` /g, "`").replace(/[=]/g, '` = "')}")` : void 0, m = d ? `accept("${D(d)}")` : void 0, b = `content_type("${D(n.mimeType)}")`, j = Object.entries(l).filter(([O]) => ![
1609
+ "cookie",
1610
+ "accept",
1611
+ "content-type"
1612
+ ].includes(O.toLowerCase())).map(([O, $]) => `'${O}' = '${Ae($)}'`).join(", "), y = j ? `add_headers(${j})` : void 0;
1613
+ let g = `response <- VERB("${a}", url`;
1614
+ f && (g += ", body = payload"), r.length && (g += ", query = queryString");
1615
+ const w = [
1616
+ y,
1617
+ b,
1618
+ m,
1619
+ h
1620
+ ].filter((O) => !!O).join(", ");
1621
+ return w && (g += `, ${w}`), (n.text || n.jsonObj || n.params) && (g += ", encode = encode"), g += ")", s(g), o(), s('content(response, "text")'), i();
1622
+ }
1623
+ } }
1624
+ }, mo = {
1625
+ info: {
1626
+ key: "ruby",
1627
+ title: "Ruby",
1628
+ default: "native"
1629
+ },
1630
+ clientsById: {
1631
+ native: {
1632
+ info: {
1633
+ key: "native",
1634
+ title: "net::http",
1635
+ link: "http://ruby-doc.org/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTP.html",
1636
+ description: "Ruby HTTP client",
1637
+ extname: ".rb"
1638
+ },
1639
+ convert: ({ uriObj: e, method: t, fullUrl: r, postData: n, allHeaders: l }) => {
1640
+ const { push: a, blank: s, join: o } = new k();
1641
+ a("require 'uri'"), a("require 'net/http'"), s();
1642
+ const i = t.toUpperCase(), c = [
1643
+ "GET",
1644
+ "POST",
1645
+ "HEAD",
1646
+ "DELETE",
1647
+ "PATCH",
1648
+ "PUT",
1649
+ "OPTIONS",
1650
+ "COPY",
1651
+ "LOCK",
1652
+ "UNLOCK",
1653
+ "MOVE",
1654
+ "TRACE"
1655
+ ], p = i.charAt(0) + i.substring(1).toLowerCase();
1656
+ c.includes(i) || (a(`class Net::HTTP::${p} < Net::HTTPRequest`), a(` METHOD = '${i.toUpperCase()}'`), a(` REQUEST_HAS_BODY = '${n.text ? "true" : "false"}'`), a(" RESPONSE_HAS_BODY = true"), a("end"), s()), a(`url = URI("${r}")`), s(), a("http = Net::HTTP.new(url.host, url.port)"), e.protocol === "https:" && a("http.use_ssl = true"), s(), a(`request = Net::HTTP::${p}.new(url)`);
1657
+ const f = Object.keys(l);
1658
+ return f.length && f.forEach((u) => {
1659
+ a(`request["${u}"] = '${Ae(l[u])}'`);
1660
+ }), n.text && a(`request.body = ${JSON.stringify(n.text)}`), s(), a("response = http.request(request)"), a("puts response.read_body"), o();
1661
+ }
1662
+ },
1663
+ faraday: {
1664
+ info: {
1665
+ key: "faraday",
1666
+ title: "faraday",
1667
+ link: "https://github.com/lostisland/faraday",
1668
+ description: "Faraday HTTP client",
1669
+ extname: ".rb"
1670
+ },
1671
+ convert: ({ uriObj: e, queryObj: t, method: r, postData: n, allHeaders: l }) => {
1672
+ const { push: a, blank: s, join: o } = new k(), i = r.toUpperCase();
1673
+ if (![
1674
+ "GET",
1675
+ "POST",
1676
+ "HEAD",
1677
+ "DELETE",
1678
+ "PATCH",
1679
+ "PUT",
1680
+ "OPTIONS",
1681
+ "COPY",
1682
+ "LOCK",
1683
+ "UNLOCK",
1684
+ "MOVE",
1685
+ "TRACE"
1686
+ ].includes(i))
1687
+ return a(`# Faraday cannot currently run ${i} requests. Please use another client.`), o();
1688
+ a("require 'faraday'"), s(), n.mimeType === "application/x-www-form-urlencoded" && n.params && (a("data = {"), n.params.forEach((p) => {
1689
+ a(` :${p.name} => ${JSON.stringify(p.value)},`);
1690
+ }), a("}"), s()), a("conn = Faraday.new("), a(` url: '${e.protocol}//${e.host}',`), (l["content-type"] || l["Content-Type"]) && a(` headers: {'Content-Type' => '${l["content-type"] || l["Content-Type"]}'}`), a(")"), s(), a(`response = conn.${i.toLowerCase()}('${e.pathname}') do |req|`);
1691
+ const c = Object.keys(l);
1692
+ switch (c.length && c.forEach((p) => {
1693
+ p.toLowerCase() !== "content-type" && a(` req.headers['${p}'] = '${Ae(l[p])}'`);
1694
+ }), Object.keys(t).forEach((p) => {
1695
+ const f = t[p];
1696
+ Array.isArray(f) ? a(` req.params['${p}'] = ${JSON.stringify(f)}`) : a(` req.params['${p}'] = '${f}'`);
1697
+ }), n.mimeType) {
1698
+ case "application/x-www-form-urlencoded":
1699
+ n.params && a(" req.body = URI.encode_www_form(data)");
1700
+ break;
1701
+ case "application/json":
1702
+ n.jsonObj && a(` req.body = ${JSON.stringify(n.text)}`);
1703
+ break;
1704
+ default:
1705
+ n.text && a(` req.body = ${JSON.stringify(n.text)}`);
1706
+ }
1707
+ return a("end"), s(), a("puts response.status"), a("puts response.body"), o();
1708
+ }
1709
+ }
1710
+ }
1711
+ };
1712
+ function cr(e, t, r, n, l) {
1713
+ const a = n.repeat(l), s = n.repeat(l - 1), o = r ? `,
1714
+ ${a}` : ", ", i = e === "object" ? "json!({" : "(", c = e === "object" ? "})" : ")";
1715
+ return r ? `${i}
1716
+ ${a}${t.join(o)}
1717
+ ${s}${c}` : `${i}${t.join(o)}${c}`;
1718
+ }
1719
+ const ke = (e, t, r) => {
1720
+ switch (r = r === void 0 ? 1 : r + 1, Object.prototype.toString.call(e)) {
1721
+ case "[object Number]":
1722
+ return e;
1723
+ case "[object Array]": {
1724
+ if (e.length === 0) return "json!([])";
1725
+ let n = !1;
1726
+ return cr("array", e.map((l) => (Object.prototype.toString.call(l) === "[object Object]" && (n = Object.keys(l).length > 1), ke(l, t, r))), n, t.indent, r);
1727
+ }
1728
+ case "[object Object]": {
1729
+ const n = [];
1730
+ for (const l in e) n.push(`"${l}": ${ke(e[l], t, r)}`);
1731
+ return cr("object", n, t.pretty && n.length > 1, t.indent, r);
1732
+ }
1733
+ case "[object Null]":
1734
+ return "json!(null)";
1735
+ case "[object Boolean]":
1736
+ return e ? "true" : "false";
1737
+ default:
1738
+ return e == null ? "" : `"${e.toString().replace(/"/g, '\\"')}"`;
1739
+ }
1740
+ }, bo = {
1741
+ info: {
1742
+ key: "reqwest",
1743
+ title: "reqwest",
1744
+ link: "https://docs.rs/reqwest/latest/reqwest/",
1745
+ description: "reqwest HTTP library",
1746
+ extname: ".rs"
1747
+ },
1748
+ convert: ({ queryObj: e, url: t, postData: r, allHeaders: n, method: l }, a) => {
1749
+ const s = {
1750
+ indent: " ",
1751
+ pretty: !0,
1752
+ ...a
1753
+ };
1754
+ let o = 0;
1755
+ const { push: i, blank: c, join: p, pushToLast: f, unshift: u } = new k({ indent: s.indent });
1756
+ i("use reqwest;", o), c(), i("#[tokio::main]", o), i("pub async fn main() {", o), o += 1, i(`let url = "${t}";`, o), c();
1757
+ let d = !1;
1758
+ if (Object.keys(e).length) {
1759
+ d = !0, i("let querystring = [", o), o += 1;
1760
+ for (const [$, E] of Object.entries(e)) if (Array.isArray(E)) for (const S of E) i(`("${$}", "${decodeURIComponent(S)}"),`, o);
1761
+ else i(`("${$}", "${decodeURIComponent(String(E))}"),`, o);
1762
+ o -= 1, i("];", o), c();
1763
+ }
1764
+ let h = {};
1765
+ const m = {};
1766
+ let b = !1, j = !1, y = !1, g = !1, w = !1;
1767
+ switch (r.mimeType) {
1768
+ case "application/json":
1769
+ r.jsonObj && i(`let payload = ${ke(r.jsonObj, s, o)};`, o), g = !0;
1770
+ break;
1771
+ case "multipart/form-data":
1772
+ if (w = !0, !r.params) {
1773
+ i("let form = reqwest::multipart::Form::new()", o), i('.text("", "");', o + 1);
1774
+ break;
1775
+ }
1776
+ if (h = {}, r.params.forEach(($) => {
1777
+ $.fileName ? (m[$.name] = $.fileName, b = !0) : h[$.name] = $.value;
1778
+ }), b) {
1779
+ for (const $ of go) i($, o);
1780
+ c();
1781
+ }
1782
+ i("let form = reqwest::multipart::Form::new()", o);
1783
+ for (const [$, E] of Object.entries(m)) i(`.part("${$}", file_to_part("${E}").await)`, o + 1);
1784
+ for (const [$, E] of Object.entries(h)) i(`.text("${$}", "${E}")`, o + 1);
1785
+ f(";");
1786
+ break;
1787
+ default:
1788
+ if (r.mimeType === "application/x-www-form-urlencoded" && r.paramsObj) {
1789
+ i(`let payload = ${ke(r.paramsObj, s, o)};`, o), j = !0;
1790
+ break;
1791
+ }
1792
+ if (r.text) {
1793
+ i(`let payload = ${ke(r.text, s, o)};`, o), y = !0;
1794
+ break;
1795
+ }
1796
+ }
1797
+ (j || g) && u("use serde_json::json;"), (j || g || y || w) && c();
1798
+ const O = Object.entries(n).filter(([$]) => !($.toLowerCase() === "content-type" && w));
1799
+ switch (i("let client = reqwest::Client::new();", o), l) {
1800
+ case "POST":
1801
+ i("let response = client.post(url)", o);
1802
+ break;
1803
+ case "GET":
1804
+ i("let response = client.get(url)", o);
1805
+ break;
1806
+ default:
1807
+ i(`let response = client.request(reqwest::Method::from_str("${l}").unwrap(), url)`, o), u("use std::str::FromStr;");
1808
+ break;
1809
+ }
1810
+ d && i(".query(&querystring)", o + 1), w && i(".multipart(form)", o + 1);
1811
+ for (const [$, E] of O) i(`.header("${$}", ${ke(E, s)})`, o + 1);
1812
+ return g && i(".json(&payload)", o + 1), j && i(".form(&payload)", o + 1), y && i(".body(payload)", o + 1), i(".send()", o + 1), i(".await;", o + 1), c(), i("let results = response.unwrap()", o), i(".json::<serde_json::Value>()", o + 1), i(".await", o + 1), i(".unwrap();", o + 1), c(), i('println!("{}", results);', o), i(`}
1813
+ `), p();
1814
+ }
1815
+ }, go = [
1816
+ "async fn file_to_part(file_name: &'static str) -> reqwest::multipart::Part {",
1817
+ " let bytes = tokio::fs::read(file_name).await.unwrap();",
1818
+ " reqwest::multipart::Part::bytes(bytes)",
1819
+ " .file_name(file_name)",
1820
+ ' .mime_str("text/plain").unwrap()',
1821
+ "}"
1822
+ ], jo = {
1823
+ info: {
1824
+ key: "rust",
1825
+ title: "Rust",
1826
+ default: "reqwest",
1827
+ cli: "rust"
1828
+ },
1829
+ clientsById: { reqwest: bo }
1830
+ }, M = (e = "") => /^[a-z0-9-_/.@%^=:]+$/i.test(e) ? e : `'${e.replace(/'/g, "'\\''")}'`, $o = (e) => e.replace(/\r/g, "\\r").replace(/\n/g, "\\n"), vo = {
1831
+ "http1.0": "0",
1832
+ "url ": "",
1833
+ cookie: "b",
1834
+ data: "d",
1835
+ form: "F",
1836
+ globoff: "g",
1837
+ header: "H",
1838
+ insecure: "k",
1839
+ request: "X"
1840
+ }, wo = (e) => (t) => {
1841
+ if (e) {
1842
+ const r = vo[t];
1843
+ return r ? `-${r}` : "";
1844
+ }
1845
+ return `--${t}`;
1846
+ }, Oo = {
1847
+ info: {
1848
+ key: "shell",
1849
+ title: "Shell",
1850
+ default: "curl",
1851
+ cli: "%s"
1852
+ },
1853
+ clientsById: {
1854
+ curl: {
1855
+ info: {
1856
+ key: "curl",
1857
+ title: "cURL",
1858
+ link: "http://curl.haxx.se/",
1859
+ description: "cURL is a command line tool and library for transferring data with URL syntax",
1860
+ extname: ".sh"
1861
+ },
1862
+ convert: ({ fullUrl: e, method: t, httpVersion: r, headersObj: n, allHeaders: l, postData: a }, s = {}) => {
1863
+ var o;
1864
+ const { binary: i = !1, globOff: c = !1, indent: p = " ", insecureSkipVerify: f = !1, short: u = !1 } = s, d = " ", { push: h, join: m } = new k({
1865
+ ...typeof p == "string" ? { indent: p } : {},
1866
+ join: p !== !1 ? ` \\
1867
+ ${p}` : " "
1868
+ }), b = wo(u);
1869
+ let j = M(e);
1870
+ if (h(`curl ${b("request")} ${t}`), c && (j = unescape(j), h(b("globoff"))), h(`${b("url ")}${j}`), f && h(b("insecure")), r === "HTTP/1.0" && h(b("http1.0")), le(l, "accept-encoding") && h("--compressed"), a.mimeType === "multipart/form-data") {
1871
+ const y = W(n, "content-type");
1872
+ if (y) {
1873
+ const g = n[y];
1874
+ if (y && g) {
1875
+ const w = String(g).replace(/; boundary.+?(?=(;|$))/, "");
1876
+ n[y] = w, l[y] = w;
1877
+ }
1878
+ }
1879
+ }
1880
+ switch (Object.keys(n).sort().forEach((y) => {
1881
+ const g = `${y}: ${n[y]}`;
1882
+ h(`${b("header")} ${M(g)}`);
1883
+ }), l.cookie && h(`${b("cookie")} ${M(l.cookie)}`), a.mimeType) {
1884
+ case "multipart/form-data":
1885
+ (o = a.params) == null || o.forEach((y) => {
1886
+ let g = "";
1887
+ y.fileName ? g = `${y.name}='@${y.fileName}'` : g = M(`${y.name}=${y.value}`), h(`${b("form")} ${g}`);
1888
+ });
1889
+ break;
1890
+ case "application/x-www-form-urlencoded":
1891
+ a.params ? a.params.forEach((y) => {
1892
+ const g = encodeURIComponent(y.name), w = g !== y.name ? g : y.name;
1893
+ h(`${i ? "--data-binary" : "--data-urlencode"} ${M(`${w}=${y.value}`)}`);
1894
+ }) : h(`${i ? "--data-binary" : b("data")} ${M(a.text)}`);
1895
+ break;
1896
+ default: {
1897
+ if (!a.text) break;
1898
+ let y = !1;
1899
+ if (Wn(a.mimeType) && a.text.length > 20)
1900
+ try {
1901
+ const g = JSON.parse(a.text);
1902
+ y = !0, a.text.indexOf("'") > 0 ? h(`${i ? "--data-binary" : b("data")} @- <<EOF
1903
+ ${JSON.stringify(g, null, d)}
1904
+ EOF`) : h(`${i ? "--data-binary" : b("data")} '
1905
+ ${JSON.stringify(g, null, d)}
1906
+ '`);
1907
+ } catch {
1908
+ }
1909
+ y || h(`${i ? "--data-binary" : b("data")} ${M(a.text)}`);
1910
+ }
1911
+ }
1912
+ return m();
1913
+ }
1914
+ },
1915
+ httpie: {
1916
+ info: {
1917
+ key: "httpie",
1918
+ title: "HTTPie",
1919
+ link: "http://httpie.org/",
1920
+ description: "a CLI, cURL-like tool for humans",
1921
+ extname: ".sh",
1922
+ installation: () => "brew install httpie"
1923
+ },
1924
+ convert: ({ allHeaders: e, postData: t, queryObj: r, fullUrl: n, method: l, url: a }, s) => {
1925
+ var o;
1926
+ const i = {
1927
+ body: !1,
1928
+ cert: !1,
1929
+ headers: !1,
1930
+ indent: " ",
1931
+ pretty: !1,
1932
+ print: !1,
1933
+ queryParams: !1,
1934
+ short: !1,
1935
+ style: !1,
1936
+ timeout: !1,
1937
+ verbose: !1,
1938
+ verify: !1,
1939
+ ...s
1940
+ }, { push: c, join: p, unshift: f } = new k({
1941
+ indent: i.indent,
1942
+ join: i.indent !== !1 ? ` \\
1943
+ ${i.indent}` : " "
1944
+ });
1945
+ let u = !1;
1946
+ const d = [];
1947
+ i.headers && d.push(i.short ? "-h" : "--headers"), i.body && d.push(i.short ? "-b" : "--body"), i.verbose && d.push(i.short ? "-v" : "--verbose"), i.print && d.push(`${i.short ? "-p" : "--print"}=${i.print}`), i.verify && d.push(`--verify=${i.verify}`), i.cert && d.push(`--cert=${i.cert}`), i.pretty && d.push(`--pretty=${i.pretty}`), i.style && d.push(`--style=${i.style}`), i.timeout && d.push(`--timeout=${i.timeout}`), i.queryParams && Object.keys(r).forEach((m) => {
1948
+ const b = r[m];
1949
+ Array.isArray(b) ? b.forEach((j) => {
1950
+ c(`${m}==${M(j)}`);
1951
+ }) : c(`${m}==${M(b)}`);
1952
+ }), Object.keys(e).sort().forEach((m) => {
1953
+ c(`${m}:${M(e[m])}`);
1954
+ }), t.mimeType === "application/x-www-form-urlencoded" ? (o = t.params) != null && o.length && (d.push(i.short ? "-f" : "--form"), t.params.forEach((m) => {
1955
+ c(`${m.name}=${M(m.value)}`);
1956
+ })) : u = !0;
1957
+ const h = d.length ? `${d.join(" ")} ` : "";
1958
+ return a = M(i.queryParams ? a : n), f(`http ${h}${l} ${a}`), u && t.text && f(`echo ${M(t.text)} | `), p();
1959
+ }
1960
+ },
1961
+ wget: {
1962
+ info: {
1963
+ key: "wget",
1964
+ title: "Wget",
1965
+ link: "https://www.gnu.org/software/wget/",
1966
+ description: "a free software package for retrieving files using HTTP, HTTPS",
1967
+ extname: ".sh"
1968
+ },
1969
+ convert: ({ method: e, postData: t, allHeaders: r, fullUrl: n }, l) => {
1970
+ const a = {
1971
+ indent: " ",
1972
+ short: !1,
1973
+ verbose: !1,
1974
+ ...l
1975
+ }, { push: s, join: o } = new k({
1976
+ ...typeof a.indent == "string" ? { indent: a.indent } : {},
1977
+ join: a.indent !== !1 ? ` \\
1978
+ ${a.indent}` : " "
1979
+ });
1980
+ return a.verbose ? s(`wget ${a.short ? "-v" : "--verbose"}`) : s(`wget ${a.short ? "-q" : "--quiet"}`), s(`--method ${M(e)}`), Object.keys(r).forEach((i) => {
1981
+ const c = `${i}: ${r[i]}`;
1982
+ s(`--header ${M(c)}`);
1983
+ }), t.text && s(`--body-data ${$o(M(t.text))}`), s(a.short ? "-O" : "--output-document"), s(`- ${M(n)}`), o();
1984
+ }
1985
+ }
1986
+ }
1987
+ }, pr = (e, t) => t.repeat(e), ur = (e, t, r, n) => {
1988
+ const l = pr(n, r), a = pr(n - 1, r), s = t ? `,
1989
+ ${l}` : ", ";
1990
+ return t ? `[
1991
+ ${l}${e.join(s)}
1992
+ ${a}]` : `[${e.join(s)}]`;
1993
+ }, fr = (e, t, r) => `let ${e} = ${ot(t, r)}`, ot = (e, t, r) => {
1994
+ switch (r = r === void 0 ? 1 : r + 1, Object.prototype.toString.call(e)) {
1995
+ case "[object Number]":
1996
+ return e;
1997
+ case "[object Array]": {
1998
+ let n = !1;
1999
+ const l = e.map((a) => (Object.prototype.toString.call(a) === "[object Object]" && (n = Object.keys(a).length > 1), ot(a, t, r)));
2000
+ return ur(l, n, t.indent, r);
2001
+ }
2002
+ case "[object Object]": {
2003
+ const n = [];
2004
+ for (const l in e) n.push(`"${l}": ${ot(e[l], t, r)}`);
2005
+ return ur(n, t.pretty && n.length > 1, t.indent, r);
2006
+ }
2007
+ case "[object Boolean]":
2008
+ return e.toString();
2009
+ default:
2010
+ return e == null ? "nil" : `"${e.toString().replace(/"/g, '\\"')}"`;
2011
+ }
2012
+ }, xe = {
2013
+ agent: Jn,
2014
+ c: zn,
2015
+ clojure: Vn,
2016
+ crystal: Gn,
2017
+ csharp: Zn,
2018
+ go: eo,
2019
+ http: to,
2020
+ java: ro,
2021
+ javascript: no,
2022
+ json: oo,
2023
+ kotlin: ao,
2024
+ node: io,
2025
+ objc: so,
2026
+ ocaml: lo,
2027
+ php: co,
2028
+ powershell: uo,
2029
+ python: ho,
2030
+ r: yo,
2031
+ ruby: mo,
2032
+ rust: jo,
2033
+ shell: Oo,
2034
+ swift: {
2035
+ info: {
2036
+ key: "swift",
2037
+ title: "Swift",
2038
+ default: "urlsession"
2039
+ },
2040
+ clientsById: { urlsession: {
2041
+ info: {
2042
+ key: "urlsession",
2043
+ title: "URLSession",
2044
+ link: "https://developer.apple.com/documentation/foundation/urlsession",
2045
+ description: "Foundation's URLSession request",
2046
+ extname: ".swift"
2047
+ },
2048
+ convert: ({ allHeaders: e, postData: t, uriObj: r, queryObj: n, method: l }, a) => {
2049
+ var s;
2050
+ const o = {
2051
+ indent: " ",
2052
+ pretty: !0,
2053
+ timeout: 10,
2054
+ ...a
2055
+ }, { push: i, blank: c, join: p } = new k({ indent: o.indent });
2056
+ i("import Foundation"), c();
2057
+ const f = t.text || t.jsonObj || t.params;
2058
+ if (f) switch (t.mimeType) {
2059
+ case "application/x-www-form-urlencoded":
2060
+ if ((s = t.params) != null && s.length) {
2061
+ const d = t.params.map((h) => `"${h.name}": "${h.value}"`);
2062
+ o.pretty ? (i("let parameters = ["), d.forEach((h) => {
2063
+ i(`${h},`, 1);
2064
+ }), i("]")) : i(`let parameters = [${d.join(", ")}]`), i('let joinedParameters = parameters.map { "\\($0.key)=\\($0.value)" }.joined(separator: "&")'), i("let postData = Data(joinedParameters.utf8)"), c();
2065
+ }
2066
+ break;
2067
+ case "application/json":
2068
+ t.jsonObj && (i(`${fr("parameters", t.jsonObj, o)} as [String : Any?]`), c(), i("let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])"), c());
2069
+ break;
2070
+ case "multipart/form-data":
2071
+ i(fr("parameters", t.params, o)), c(), i(`let boundary = "${t.boundary}"`), c(), i('var body = ""'), i("for param in parameters {"), i('let paramName = param["name"]!', 1), i('body += "--\\(boundary)\\r\\n"', 1), i('body += "Content-Disposition:form-data; name=\\"\\(paramName)\\""', 1), i('if let filename = param["fileName"] {', 1), i('let contentType = param["contentType"]!', 2), i("let fileContent = try String(contentsOfFile: filename, encoding: .utf8)", 2), i('body += "; filename=\\"\\(filename)\\"\\r\\n"', 2), i('body += "Content-Type: \\(contentType)\\r\\n\\r\\n"', 2), i("body += fileContent", 2), i('} else if let paramValue = param["value"] {', 1), i('body += "\\r\\n\\r\\n\\(paramValue)"', 2), i("}", 1), i("}"), c(), i("let postData = Data(body.utf8)"), c();
2072
+ break;
2073
+ default:
2074
+ i(`let postData = Data("${t.text}".utf8)`), c();
2075
+ }
2076
+ i(`let url = URL(string: "${r.href}")!`);
2077
+ const u = n ? Object.entries(n) : [];
2078
+ return u.length < 1 ? i("var request = URLRequest(url: url)") : (i("var components = URLComponents(url: url, resolvingAgainstBaseURL: true)!"), i("let queryItems: [URLQueryItem] = ["), u.forEach((d) => {
2079
+ const h = d[0], m = d[1];
2080
+ switch (Object.prototype.toString.call(m)) {
2081
+ case "[object String]":
2082
+ i(`URLQueryItem(name: "${h}", value: "${m}"),`, 1);
2083
+ break;
2084
+ case "[object Array]":
2085
+ m.forEach((b) => {
2086
+ i(`URLQueryItem(name: "${h}", value: "${b}"),`, 1);
2087
+ });
2088
+ break;
2089
+ }
2090
+ }), i("]"), i("components.queryItems = components.queryItems.map { $0 + queryItems } ?? queryItems"), c(), i("var request = URLRequest(url: components.url!)")), i(`request.httpMethod = "${l}"`), i(`request.timeoutInterval = ${o.timeout}`), Object.keys(e).length && i(`request.allHTTPHeaderFields = ${ot(e, o)}`), f && i("request.httpBody = postData"), c(), i("let (data, _) = try await URLSession.shared.data(for: request)"), i("print(String(decoding: data, as: UTF8.self))"), p();
2091
+ }
2092
+ } }
2093
+ }
2094
+ }, dr = (e, t) => {
2095
+ const r = e[t.name];
2096
+ return r === void 0 ? (e[t.name] = t.value, e) : Array.isArray(r) ? (r.push(t.value), e) : (e[t.name] = [r, t.value], e);
2097
+ };
2098
+ var at = { exports: {} };
2099
+ /*! https://mths.be/punycode v1.4.1 by @mathias */
2100
+ var So = at.exports;
2101
+ (function(e, t) {
2102
+ (function(r) {
2103
+ var n = t && !t.nodeType && t, l = e && !e.nodeType && e, a = typeof rt == "object" && rt;
2104
+ (a.global === a || a.window === a || a.self === a) && (r = a);
2105
+ var s, o = 2147483647, i = 36, c = 1, p = 26, f = 38, u = 700, d = 72, h = 128, m = "-", b = /^xn--/, j = /[^\x20-\x7E]/, y = /[\x2E\u3002\uFF0E\uFF61]/g, g = {
2106
+ overflow: "Overflow: input needs wider integers to process",
2107
+ "not-basic": "Illegal input >= 0x80 (not a basic code point)",
2108
+ "invalid-input": "Invalid input"
2109
+ }, w = i - c, O = Math.floor, $ = String.fromCharCode, E;
2110
+ function S(v) {
2111
+ throw new RangeError(g[v]);
2112
+ }
2113
+ function C(v, T) {
2114
+ for (var P = v.length, R = []; P--; )
2115
+ R[P] = T(v[P]);
2116
+ return R;
2117
+ }
2118
+ function _(v, T) {
2119
+ var P = v.split("@"), R = "";
2120
+ P.length > 1 && (R = P[0] + "@", v = P[1]), v = v.replace(y, ".");
2121
+ var N = v.split("."), z = C(N, T).join(".");
2122
+ return R + z;
2123
+ }
2124
+ function Q(v) {
2125
+ for (var T = [], P = 0, R = v.length, N, z; P < R; )
2126
+ N = v.charCodeAt(P++), N >= 55296 && N <= 56319 && P < R ? (z = v.charCodeAt(P++), (z & 64512) == 56320 ? T.push(((N & 1023) << 10) + (z & 1023) + 65536) : (T.push(N), P--)) : T.push(N);
2127
+ return T;
2128
+ }
2129
+ function Y(v) {
2130
+ return C(v, function(T) {
2131
+ var P = "";
2132
+ return T > 65535 && (T -= 65536, P += $(T >>> 10 & 1023 | 55296), T = 56320 | T & 1023), P += $(T), P;
2133
+ }).join("");
2134
+ }
2135
+ function L(v) {
2136
+ return v - 48 < 10 ? v - 22 : v - 65 < 26 ? v - 65 : v - 97 < 26 ? v - 97 : i;
2137
+ }
2138
+ function J(v, T) {
2139
+ return v + 22 + 75 * (v < 26) - ((T != 0) << 5);
2140
+ }
2141
+ function F(v, T, P) {
2142
+ var R = 0;
2143
+ for (v = P ? O(v / u) : v >> 1, v += O(v / T); v > w * p >> 1; R += i)
2144
+ v = O(v / w);
2145
+ return O(R + (w + 1) * v / (v + f));
2146
+ }
2147
+ function K(v) {
2148
+ var T = [], P = v.length, R, N = 0, z = h, I = d, V, X, te, ce, B, G, Z, fe, ye;
2149
+ for (V = v.lastIndexOf(m), V < 0 && (V = 0), X = 0; X < V; ++X)
2150
+ v.charCodeAt(X) >= 128 && S("not-basic"), T.push(v.charCodeAt(X));
2151
+ for (te = V > 0 ? V + 1 : 0; te < P; ) {
2152
+ for (ce = N, B = 1, G = i; te >= P && S("invalid-input"), Z = L(v.charCodeAt(te++)), (Z >= i || Z > O((o - N) / B)) && S("overflow"), N += Z * B, fe = G <= I ? c : G >= I + p ? p : G - I, !(Z < fe); G += i)
2153
+ ye = i - fe, B > O(o / ye) && S("overflow"), B *= ye;
2154
+ R = T.length + 1, I = F(N - ce, R, ce == 0), O(N / R) > o - z && S("overflow"), z += O(N / R), N %= R, T.splice(N++, 0, z);
2155
+ }
2156
+ return Y(T);
2157
+ }
2158
+ function ue(v) {
2159
+ var T, P, R, N, z, I, V, X, te, ce, B, G = [], Z, fe, ye, mt;
2160
+ for (v = Q(v), Z = v.length, T = h, P = 0, z = d, I = 0; I < Z; ++I)
2161
+ B = v[I], B < 128 && G.push($(B));
2162
+ for (R = N = G.length, N && G.push(m); R < Z; ) {
2163
+ for (V = o, I = 0; I < Z; ++I)
2164
+ B = v[I], B >= T && B < V && (V = B);
2165
+ for (fe = R + 1, V - T > O((o - P) / fe) && S("overflow"), P += (V - T) * fe, T = V, I = 0; I < Z; ++I)
2166
+ if (B = v[I], B < T && ++P > o && S("overflow"), B == T) {
2167
+ for (X = P, te = i; ce = te <= z ? c : te >= z + p ? p : te - z, !(X < ce); te += i)
2168
+ mt = X - ce, ye = i - ce, G.push(
2169
+ $(J(ce + mt % ye, 0))
2170
+ ), X = O(mt / ye);
2171
+ G.push($(J(X, 0))), z = F(P, fe, R == N), P = 0, ++R;
2172
+ }
2173
+ ++P, ++T;
2174
+ }
2175
+ return G.join("");
2176
+ }
2177
+ function yt(v) {
2178
+ return _(v, function(T) {
2179
+ return b.test(T) ? K(T.slice(4).toLowerCase()) : T;
2180
+ });
2181
+ }
2182
+ function ze(v) {
2183
+ return _(v, function(T) {
2184
+ return j.test(T) ? "xn--" + ue(T) : T;
2185
+ });
2186
+ }
2187
+ if (s = {
2188
+ /**
2189
+ * A string representing the current Punycode.js version number.
2190
+ * @memberOf punycode
2191
+ * @type String
2192
+ */
2193
+ version: "1.4.1",
2194
+ /**
2195
+ * An object of methods to convert from JavaScript's internal character
2196
+ * representation (UCS-2) to Unicode code points, and back.
2197
+ * @see <https://mathiasbynens.be/notes/javascript-encoding>
2198
+ * @memberOf punycode
2199
+ * @type Object
2200
+ */
2201
+ ucs2: {
2202
+ decode: Q,
2203
+ encode: Y
2204
+ },
2205
+ decode: K,
2206
+ encode: ue,
2207
+ toASCII: ze,
2208
+ toUnicode: yt
2209
+ }, n && l)
2210
+ if (e.exports == n)
2211
+ l.exports = s;
2212
+ else
2213
+ for (E in s)
2214
+ s.hasOwnProperty(E) && (n[E] = s[E]);
2215
+ else
2216
+ r.punycode = s;
2217
+ })(So);
2218
+ })(at, at.exports);
2219
+ var To = at.exports, Ne = TypeError;
2220
+ const Xr = (e) => String(e);
2221
+ Object.assign(Xr, { custom: Symbol.for("nodejs.util.inspect.custom") });
2222
+ const ko = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2223
+ __proto__: null,
2224
+ default: Xr
2225
+ }, Symbol.toStringTag, { value: "Module" })), xo = /* @__PURE__ */ Un(ko);
2226
+ var Vt = typeof Map == "function" && Map.prototype, gt = Object.getOwnPropertyDescriptor && Vt ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, it = Vt && gt && typeof gt.get == "function" ? gt.get : null, hr = Vt && Map.prototype.forEach, Gt = typeof Set == "function" && Set.prototype, jt = Object.getOwnPropertyDescriptor && Gt ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, st = Gt && jt && typeof jt.get == "function" ? jt.get : null, yr = Gt && Set.prototype.forEach, Eo = typeof WeakMap == "function" && WeakMap.prototype, De = Eo ? WeakMap.prototype.has : null, Po = typeof WeakSet == "function" && WeakSet.prototype, _e = Po ? WeakSet.prototype.has : null, Co = typeof WeakRef == "function" && WeakRef.prototype, mr = Co ? WeakRef.prototype.deref : null, Ao = Boolean.prototype.valueOf, Ro = Object.prototype.toString, qo = Function.prototype.toString, No = String.prototype.match, Qt = String.prototype.slice, de = String.prototype.replace, Lo = String.prototype.toUpperCase, br = String.prototype.toLowerCase, Zr = RegExp.prototype.test, gr = Array.prototype.concat, ie = Array.prototype.join, Uo = Array.prototype.slice, jr = Math.floor, Dt = typeof BigInt == "function" ? BigInt.prototype.valueOf : null, $t = Object.getOwnPropertySymbols, _t = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null, Re = typeof Symbol == "function" && typeof Symbol.iterator == "object", He = typeof Symbol == "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === Re || !0) ? Symbol.toStringTag : null, en = Object.prototype.propertyIsEnumerable, $r = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(e) {
2227
+ return e.__proto__;
2228
+ } : null);
2229
+ function vr(e, t) {
2230
+ if (e === 1 / 0 || e === -1 / 0 || e !== e || e && e > -1e3 && e < 1e3 || Zr.call(/e/, t))
2231
+ return t;
2232
+ var r = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
2233
+ if (typeof e == "number") {
2234
+ var n = e < 0 ? -jr(-e) : jr(e);
2235
+ if (n !== e) {
2236
+ var l = String(n), a = Qt.call(t, l.length + 1);
2237
+ return de.call(l, r, "$&_") + "." + de.call(de.call(a, /([0-9]{3})/g, "$&_"), /_$/, "");
2238
+ }
2239
+ }
2240
+ return de.call(t, r, "$&_");
2241
+ }
2242
+ var Ht = xo, wr = Ht.custom, Or = nn(wr) ? wr : null, tn = {
2243
+ __proto__: null,
2244
+ double: '"',
2245
+ single: "'"
2246
+ }, Do = {
2247
+ __proto__: null,
2248
+ double: /(["\\])/g,
2249
+ single: /(['\\])/g
2250
+ }, pt = function e(t, r, n, l) {
2251
+ var a = r || {};
2252
+ if (pe(a, "quoteStyle") && !pe(tn, a.quoteStyle))
2253
+ throw new TypeError('option "quoteStyle" must be "single" or "double"');
2254
+ if (pe(a, "maxStringLength") && (typeof a.maxStringLength == "number" ? a.maxStringLength < 0 && a.maxStringLength !== 1 / 0 : a.maxStringLength !== null))
2255
+ throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
2256
+ var s = pe(a, "customInspect") ? a.customInspect : !0;
2257
+ if (typeof s != "boolean" && s !== "symbol")
2258
+ throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
2259
+ if (pe(a, "indent") && a.indent !== null && a.indent !== " " && !(parseInt(a.indent, 10) === a.indent && a.indent > 0))
2260
+ throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
2261
+ if (pe(a, "numericSeparator") && typeof a.numericSeparator != "boolean")
2262
+ throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
2263
+ var o = a.numericSeparator;
2264
+ if (typeof t > "u")
2265
+ return "undefined";
2266
+ if (t === null)
2267
+ return "null";
2268
+ if (typeof t == "boolean")
2269
+ return t ? "true" : "false";
2270
+ if (typeof t == "string")
2271
+ return an(t, a);
2272
+ if (typeof t == "number") {
2273
+ if (t === 0)
2274
+ return 1 / 0 / t > 0 ? "0" : "-0";
2275
+ var i = String(t);
2276
+ return o ? vr(t, i) : i;
2277
+ }
2278
+ if (typeof t == "bigint") {
2279
+ var c = String(t) + "n";
2280
+ return o ? vr(t, c) : c;
2281
+ }
2282
+ var p = typeof a.depth > "u" ? 5 : a.depth;
2283
+ if (typeof n > "u" && (n = 0), n >= p && p > 0 && typeof t == "object")
2284
+ return It(t) ? "[Array]" : "[Object]";
2285
+ var f = ta(a, n);
2286
+ if (typeof l > "u")
2287
+ l = [];
2288
+ else if (on(l, t) >= 0)
2289
+ return "[Circular]";
2290
+ function u(L, J, F) {
2291
+ if (J && (l = Uo.call(l), l.push(J)), F) {
2292
+ var K = {
2293
+ depth: a.depth
2294
+ };
2295
+ return pe(a, "quoteStyle") && (K.quoteStyle = a.quoteStyle), e(L, K, n + 1, l);
2296
+ }
2297
+ return e(L, a, n + 1, l);
2298
+ }
2299
+ if (typeof t == "function" && !Sr(t)) {
2300
+ var d = zo(t), h = Ke(t, u);
2301
+ return "[Function" + (d ? ": " + d : " (anonymous)") + "]" + (h.length > 0 ? " { " + ie.call(h, ", ") + " }" : "");
2302
+ }
2303
+ if (nn(t)) {
2304
+ var m = Re ? de.call(String(t), /^(Symbol\(.*\))_[^)]*$/, "$1") : _t.call(t);
2305
+ return typeof t == "object" && !Re ? Le(m) : m;
2306
+ }
2307
+ if (Xo(t)) {
2308
+ for (var b = "<" + br.call(String(t.nodeName)), j = t.attributes || [], y = 0; y < j.length; y++)
2309
+ b += " " + j[y].name + "=" + rn(_o(j[y].value), "double", a);
2310
+ return b += ">", t.childNodes && t.childNodes.length && (b += "..."), b += "</" + br.call(String(t.nodeName)) + ">", b;
2311
+ }
2312
+ if (It(t)) {
2313
+ if (t.length === 0)
2314
+ return "[]";
2315
+ var g = Ke(t, u);
2316
+ return f && !ea(g) ? "[" + Mt(g, f) + "]" : "[ " + ie.call(g, ", ") + " ]";
2317
+ }
2318
+ if (Io(t)) {
2319
+ var w = Ke(t, u);
2320
+ return !("cause" in Error.prototype) && "cause" in t && !en.call(t, "cause") ? "{ [" + String(t) + "] " + ie.call(gr.call("[cause]: " + u(t.cause), w), ", ") + " }" : w.length === 0 ? "[" + String(t) + "]" : "{ [" + String(t) + "] " + ie.call(w, ", ") + " }";
2321
+ }
2322
+ if (typeof t == "object" && s) {
2323
+ if (Or && typeof t[Or] == "function" && Ht)
2324
+ return Ht(t, { depth: p - n });
2325
+ if (s !== "symbol" && typeof t.inspect == "function")
2326
+ return t.inspect();
2327
+ }
2328
+ if (Ko(t)) {
2329
+ var O = [];
2330
+ return hr && hr.call(t, function(L, J) {
2331
+ O.push(u(J, t, !0) + " => " + u(L, t));
2332
+ }), Tr("Map", it.call(t), O, f);
2333
+ }
2334
+ if (Qo(t)) {
2335
+ var $ = [];
2336
+ return yr && yr.call(t, function(L) {
2337
+ $.push(u(L, t));
2338
+ }), Tr("Set", st.call(t), $, f);
2339
+ }
2340
+ if (Vo(t))
2341
+ return vt("WeakMap");
2342
+ if (Yo(t))
2343
+ return vt("WeakSet");
2344
+ if (Go(t))
2345
+ return vt("WeakRef");
2346
+ if (Fo(t))
2347
+ return Le(u(Number(t)));
2348
+ if (Wo(t))
2349
+ return Le(u(Dt.call(t)));
2350
+ if (Bo(t))
2351
+ return Le(Ao.call(t));
2352
+ if (Mo(t))
2353
+ return Le(u(String(t)));
2354
+ if (typeof window < "u" && t === window)
2355
+ return "{ [object Window] }";
2356
+ if (typeof globalThis < "u" && t === globalThis || typeof rt < "u" && t === rt)
2357
+ return "{ [object globalThis] }";
2358
+ if (!Ho(t) && !Sr(t)) {
2359
+ var E = Ke(t, u), S = $r ? $r(t) === Object.prototype : t instanceof Object || t.constructor === Object, C = t instanceof Object ? "" : "null prototype", _ = !S && He && Object(t) === t && He in t ? Qt.call(he(t), 8, -1) : C ? "Object" : "", Q = S || typeof t.constructor != "function" ? "" : t.constructor.name ? t.constructor.name + " " : "", Y = Q + (_ || C ? "[" + ie.call(gr.call([], _ || [], C || []), ": ") + "] " : "");
2360
+ return E.length === 0 ? Y + "{}" : f ? Y + "{" + Mt(E, f) + "}" : Y + "{ " + ie.call(E, ", ") + " }";
2361
+ }
2362
+ return String(t);
2363
+ };
2364
+ function rn(e, t, r) {
2365
+ var n = r.quoteStyle || t, l = tn[n];
2366
+ return l + e + l;
2367
+ }
2368
+ function _o(e) {
2369
+ return de.call(String(e), /"/g, "&quot;");
2370
+ }
2371
+ function ve(e) {
2372
+ return !He || !(typeof e == "object" && (He in e || typeof e[He] < "u"));
2373
+ }
2374
+ function It(e) {
2375
+ return he(e) === "[object Array]" && ve(e);
2376
+ }
2377
+ function Ho(e) {
2378
+ return he(e) === "[object Date]" && ve(e);
2379
+ }
2380
+ function Sr(e) {
2381
+ return he(e) === "[object RegExp]" && ve(e);
2382
+ }
2383
+ function Io(e) {
2384
+ return he(e) === "[object Error]" && ve(e);
2385
+ }
2386
+ function Mo(e) {
2387
+ return he(e) === "[object String]" && ve(e);
2388
+ }
2389
+ function Fo(e) {
2390
+ return he(e) === "[object Number]" && ve(e);
2391
+ }
2392
+ function Bo(e) {
2393
+ return he(e) === "[object Boolean]" && ve(e);
2394
+ }
2395
+ function nn(e) {
2396
+ if (Re)
2397
+ return e && typeof e == "object" && e instanceof Symbol;
2398
+ if (typeof e == "symbol")
2399
+ return !0;
2400
+ if (!e || typeof e != "object" || !_t)
2401
+ return !1;
2402
+ try {
2403
+ return _t.call(e), !0;
2404
+ } catch {
2405
+ }
2406
+ return !1;
2407
+ }
2408
+ function Wo(e) {
2409
+ if (!e || typeof e != "object" || !Dt)
2410
+ return !1;
2411
+ try {
2412
+ return Dt.call(e), !0;
2413
+ } catch {
2414
+ }
2415
+ return !1;
2416
+ }
2417
+ var Jo = Object.prototype.hasOwnProperty || function(e) {
2418
+ return e in this;
2419
+ };
2420
+ function pe(e, t) {
2421
+ return Jo.call(e, t);
2422
+ }
2423
+ function he(e) {
2424
+ return Ro.call(e);
2425
+ }
2426
+ function zo(e) {
2427
+ if (e.name)
2428
+ return e.name;
2429
+ var t = No.call(qo.call(e), /^function\s*([\w$]+)/);
2430
+ return t ? t[1] : null;
2431
+ }
2432
+ function on(e, t) {
2433
+ if (e.indexOf)
2434
+ return e.indexOf(t);
2435
+ for (var r = 0, n = e.length; r < n; r++)
2436
+ if (e[r] === t)
2437
+ return r;
2438
+ return -1;
2439
+ }
2440
+ function Ko(e) {
2441
+ if (!it || !e || typeof e != "object")
2442
+ return !1;
2443
+ try {
2444
+ it.call(e);
2445
+ try {
2446
+ st.call(e);
2447
+ } catch {
2448
+ return !0;
2449
+ }
2450
+ return e instanceof Map;
2451
+ } catch {
2452
+ }
2453
+ return !1;
2454
+ }
2455
+ function Vo(e) {
2456
+ if (!De || !e || typeof e != "object")
2457
+ return !1;
2458
+ try {
2459
+ De.call(e, De);
2460
+ try {
2461
+ _e.call(e, _e);
2462
+ } catch {
2463
+ return !0;
2464
+ }
2465
+ return e instanceof WeakMap;
2466
+ } catch {
2467
+ }
2468
+ return !1;
2469
+ }
2470
+ function Go(e) {
2471
+ if (!mr || !e || typeof e != "object")
2472
+ return !1;
2473
+ try {
2474
+ return mr.call(e), !0;
2475
+ } catch {
2476
+ }
2477
+ return !1;
2478
+ }
2479
+ function Qo(e) {
2480
+ if (!st || !e || typeof e != "object")
2481
+ return !1;
2482
+ try {
2483
+ st.call(e);
2484
+ try {
2485
+ it.call(e);
2486
+ } catch {
2487
+ return !0;
2488
+ }
2489
+ return e instanceof Set;
2490
+ } catch {
2491
+ }
2492
+ return !1;
2493
+ }
2494
+ function Yo(e) {
2495
+ if (!_e || !e || typeof e != "object")
2496
+ return !1;
2497
+ try {
2498
+ _e.call(e, _e);
2499
+ try {
2500
+ De.call(e, De);
2501
+ } catch {
2502
+ return !0;
2503
+ }
2504
+ return e instanceof WeakSet;
2505
+ } catch {
2506
+ }
2507
+ return !1;
2508
+ }
2509
+ function Xo(e) {
2510
+ return !e || typeof e != "object" ? !1 : typeof HTMLElement < "u" && e instanceof HTMLElement ? !0 : typeof e.nodeName == "string" && typeof e.getAttribute == "function";
2511
+ }
2512
+ function an(e, t) {
2513
+ if (e.length > t.maxStringLength) {
2514
+ var r = e.length - t.maxStringLength, n = "... " + r + " more character" + (r > 1 ? "s" : "");
2515
+ return an(Qt.call(e, 0, t.maxStringLength), t) + n;
2516
+ }
2517
+ var l = Do[t.quoteStyle || "single"];
2518
+ l.lastIndex = 0;
2519
+ var a = de.call(de.call(e, l, "\\$1"), /[\x00-\x1f]/g, Zo);
2520
+ return rn(a, "single", t);
2521
+ }
2522
+ function Zo(e) {
2523
+ var t = e.charCodeAt(0), r = {
2524
+ 8: "b",
2525
+ 9: "t",
2526
+ 10: "n",
2527
+ 12: "f",
2528
+ 13: "r"
2529
+ }[t];
2530
+ return r ? "\\" + r : "\\x" + (t < 16 ? "0" : "") + Lo.call(t.toString(16));
2531
+ }
2532
+ function Le(e) {
2533
+ return "Object(" + e + ")";
2534
+ }
2535
+ function vt(e) {
2536
+ return e + " { ? }";
2537
+ }
2538
+ function Tr(e, t, r, n) {
2539
+ var l = n ? Mt(r, n) : ie.call(r, ", ");
2540
+ return e + " (" + t + ") {" + l + "}";
2541
+ }
2542
+ function ea(e) {
2543
+ for (var t = 0; t < e.length; t++)
2544
+ if (on(e[t], `
2545
+ `) >= 0)
2546
+ return !1;
2547
+ return !0;
2548
+ }
2549
+ function ta(e, t) {
2550
+ var r;
2551
+ if (e.indent === " ")
2552
+ r = " ";
2553
+ else if (typeof e.indent == "number" && e.indent > 0)
2554
+ r = ie.call(Array(e.indent + 1), " ");
2555
+ else
2556
+ return null;
2557
+ return {
2558
+ base: r,
2559
+ prev: ie.call(Array(t + 1), r)
2560
+ };
2561
+ }
2562
+ function Mt(e, t) {
2563
+ if (e.length === 0)
2564
+ return "";
2565
+ var r = `
2566
+ ` + t.prev + t.base;
2567
+ return r + ie.call(e, "," + r) + `
2568
+ ` + t.prev;
2569
+ }
2570
+ function Ke(e, t) {
2571
+ var r = It(e), n = [];
2572
+ if (r) {
2573
+ n.length = e.length;
2574
+ for (var l = 0; l < e.length; l++)
2575
+ n[l] = pe(e, l) ? t(e[l], e) : "";
2576
+ }
2577
+ var a = typeof $t == "function" ? $t(e) : [], s;
2578
+ if (Re) {
2579
+ s = {};
2580
+ for (var o = 0; o < a.length; o++)
2581
+ s["$" + a[o]] = a[o];
2582
+ }
2583
+ for (var i in e)
2584
+ pe(e, i) && (r && String(Number(i)) === i && i < e.length || Re && s["$" + i] instanceof Symbol || (Zr.call(/[^\w$]/, i) ? n.push(t(i, e) + ": " + t(e[i], e)) : n.push(i + ": " + t(e[i], e))));
2585
+ if (typeof $t == "function")
2586
+ for (var c = 0; c < a.length; c++)
2587
+ en.call(e, a[c]) && n.push("[" + t(a[c]) + "]: " + t(e[a[c]], e));
2588
+ return n;
2589
+ }
2590
+ var ra = pt, na = Ne, ut = function(e, t, r) {
2591
+ for (var n = e, l; (l = n.next) != null; n = l)
2592
+ if (l.key === t)
2593
+ return n.next = l.next, r || (l.next = /** @type {NonNullable<typeof list.next>} */
2594
+ e.next, e.next = l), l;
2595
+ }, oa = function(e, t) {
2596
+ if (e) {
2597
+ var r = ut(e, t);
2598
+ return r && r.value;
2599
+ }
2600
+ }, aa = function(e, t, r) {
2601
+ var n = ut(e, t);
2602
+ n ? n.value = r : e.next = /** @type {import('./list.d.ts').ListNode<typeof value, typeof key>} */
2603
+ {
2604
+ // eslint-disable-line no-param-reassign, no-extra-parens
2605
+ key: t,
2606
+ next: e.next,
2607
+ value: r
2608
+ };
2609
+ }, ia = function(e, t) {
2610
+ return e ? !!ut(e, t) : !1;
2611
+ }, sa = function(e, t) {
2612
+ if (e)
2613
+ return ut(e, t, !0);
2614
+ }, la = function() {
2615
+ var e, t = {
2616
+ assert: function(r) {
2617
+ if (!t.has(r))
2618
+ throw new na("Side channel does not contain " + ra(r));
2619
+ },
2620
+ delete: function(r) {
2621
+ var n = sa(e, r);
2622
+ return n && e && !e.next && (e = void 0), !!n;
2623
+ },
2624
+ get: function(r) {
2625
+ return oa(e, r);
2626
+ },
2627
+ has: function(r) {
2628
+ return ia(e, r);
2629
+ },
2630
+ set: function(r, n) {
2631
+ e || (e = {
2632
+ next: void 0
2633
+ }), aa(
2634
+ /** @type {NonNullable<typeof $o>} */
2635
+ e,
2636
+ r,
2637
+ n
2638
+ );
2639
+ }
2640
+ };
2641
+ return t;
2642
+ }, sn = Object, ca = Error, pa = EvalError, ua = RangeError, fa = ReferenceError, da = SyntaxError, ha = URIError, ya = Math.abs, ma = Math.floor, ba = Math.max, ga = Math.min, ja = Math.pow, $a = Math.round, va = Number.isNaN || function(e) {
2643
+ return e !== e;
2644
+ }, wa = va, Oa = function(e) {
2645
+ return wa(e) || e === 0 ? e : e < 0 ? -1 : 1;
2646
+ }, Sa = Object.getOwnPropertyDescriptor, Ye = Sa;
2647
+ if (Ye)
2648
+ try {
2649
+ Ye([], "length");
2650
+ } catch {
2651
+ Ye = null;
2652
+ }
2653
+ var ln = Ye, Xe = Object.defineProperty || !1;
2654
+ if (Xe)
2655
+ try {
2656
+ Xe({}, "a", { value: 1 });
2657
+ } catch {
2658
+ Xe = !1;
2659
+ }
2660
+ var cn = Xe, kr, xr;
2661
+ function Ta() {
2662
+ return xr || (xr = 1, kr = function() {
2663
+ if (typeof Symbol != "function" || typeof Object.getOwnPropertySymbols != "function")
2664
+ return !1;
2665
+ if (typeof Symbol.iterator == "symbol")
2666
+ return !0;
2667
+ var e = {}, t = Symbol("test"), r = Object(t);
2668
+ if (typeof t == "string" || Object.prototype.toString.call(t) !== "[object Symbol]" || Object.prototype.toString.call(r) !== "[object Symbol]")
2669
+ return !1;
2670
+ var n = 42;
2671
+ e[t] = n;
2672
+ for (var l in e)
2673
+ return !1;
2674
+ if (typeof Object.keys == "function" && Object.keys(e).length !== 0 || typeof Object.getOwnPropertyNames == "function" && Object.getOwnPropertyNames(e).length !== 0)
2675
+ return !1;
2676
+ var a = Object.getOwnPropertySymbols(e);
2677
+ if (a.length !== 1 || a[0] !== t || !Object.prototype.propertyIsEnumerable.call(e, t))
2678
+ return !1;
2679
+ if (typeof Object.getOwnPropertyDescriptor == "function") {
2680
+ var s = (
2681
+ /** @type {PropertyDescriptor} */
2682
+ Object.getOwnPropertyDescriptor(e, t)
2683
+ );
2684
+ if (s.value !== n || s.enumerable !== !0)
2685
+ return !1;
2686
+ }
2687
+ return !0;
2688
+ }), kr;
2689
+ }
2690
+ var wt, Er;
2691
+ function ka() {
2692
+ if (Er) return wt;
2693
+ Er = 1;
2694
+ var e = typeof Symbol < "u" && Symbol, t = Ta();
2695
+ return wt = function() {
2696
+ return typeof e != "function" || typeof Symbol != "function" || typeof e("foo") != "symbol" || typeof Symbol("bar") != "symbol" ? !1 : t();
2697
+ }, wt;
2698
+ }
2699
+ var Pr, Cr;
2700
+ function pn() {
2701
+ return Cr || (Cr = 1, Pr = typeof Reflect < "u" && Reflect.getPrototypeOf || null), Pr;
2702
+ }
2703
+ var Ot, Ar;
2704
+ function un() {
2705
+ if (Ar) return Ot;
2706
+ Ar = 1;
2707
+ var e = sn;
2708
+ return Ot = e.getPrototypeOf || null, Ot;
2709
+ }
2710
+ var St, Rr;
2711
+ function xa() {
2712
+ if (Rr) return St;
2713
+ Rr = 1;
2714
+ var e = "Function.prototype.bind called on incompatible ", t = Object.prototype.toString, r = Math.max, n = "[object Function]", l = function(o, i) {
2715
+ for (var c = [], p = 0; p < o.length; p += 1)
2716
+ c[p] = o[p];
2717
+ for (var f = 0; f < i.length; f += 1)
2718
+ c[f + o.length] = i[f];
2719
+ return c;
2720
+ }, a = function(o, i) {
2721
+ for (var c = [], p = i, f = 0; p < o.length; p += 1, f += 1)
2722
+ c[f] = o[p];
2723
+ return c;
2724
+ }, s = function(o, i) {
2725
+ for (var c = "", p = 0; p < o.length; p += 1)
2726
+ c += o[p], p + 1 < o.length && (c += i);
2727
+ return c;
2728
+ };
2729
+ return St = function(o) {
2730
+ var i = this;
2731
+ if (typeof i != "function" || t.apply(i) !== n)
2732
+ throw new TypeError(e + i);
2733
+ for (var c = a(arguments, 1), p, f = function() {
2734
+ if (this instanceof p) {
2735
+ var b = i.apply(
2736
+ this,
2737
+ l(c, arguments)
2738
+ );
2739
+ return Object(b) === b ? b : this;
2740
+ }
2741
+ return i.apply(
2742
+ o,
2743
+ l(c, arguments)
2744
+ );
2745
+ }, u = r(0, i.length - c.length), d = [], h = 0; h < u; h++)
2746
+ d[h] = "$" + h;
2747
+ if (p = Function("binder", "return function (" + s(d, ",") + "){ return binder.apply(this,arguments); }")(f), i.prototype) {
2748
+ var m = function() {
2749
+ };
2750
+ m.prototype = i.prototype, p.prototype = new m(), m.prototype = null;
2751
+ }
2752
+ return p;
2753
+ }, St;
2754
+ }
2755
+ var Tt, qr;
2756
+ function ft() {
2757
+ if (qr) return Tt;
2758
+ qr = 1;
2759
+ var e = xa();
2760
+ return Tt = Function.prototype.bind || e, Tt;
2761
+ }
2762
+ var Yt = Function.prototype.call, Nr, Lr;
2763
+ function fn() {
2764
+ return Lr || (Lr = 1, Nr = Function.prototype.apply), Nr;
2765
+ }
2766
+ var Ea = typeof Reflect < "u" && Reflect && Reflect.apply, Pa = ft(), Ca = fn(), Aa = Yt, Ra = Ea, qa = Ra || Pa.call(Aa, Ca), Na = ft(), La = Ne, Ua = Yt, Da = qa, dn = function(e) {
2767
+ if (e.length < 1 || typeof e[0] != "function")
2768
+ throw new La("a function is required");
2769
+ return Da(Na, Ua, e);
2770
+ }, kt, Ur;
2771
+ function _a() {
2772
+ if (Ur) return kt;
2773
+ Ur = 1;
2774
+ var e = dn, t = ln, r;
2775
+ try {
2776
+ r = /** @type {{ __proto__?: typeof Array.prototype }} */
2777
+ [].__proto__ === Array.prototype;
2778
+ } catch (s) {
2779
+ if (!s || typeof s != "object" || !("code" in s) || s.code !== "ERR_PROTO_ACCESS")
2780
+ throw s;
2781
+ }
2782
+ var n = !!r && t && t(
2783
+ Object.prototype,
2784
+ /** @type {keyof typeof Object.prototype} */
2785
+ "__proto__"
2786
+ ), l = Object, a = l.getPrototypeOf;
2787
+ return kt = n && typeof n.get == "function" ? e([n.get]) : typeof a == "function" ? (
2788
+ /** @type {import('./get')} */
2789
+ (function(s) {
2790
+ return a(s == null ? s : l(s));
2791
+ })
2792
+ ) : !1, kt;
2793
+ }
2794
+ var xt, Dr;
2795
+ function Ha() {
2796
+ if (Dr) return xt;
2797
+ Dr = 1;
2798
+ var e = pn(), t = un(), r = /* @__PURE__ */ _a();
2799
+ return xt = e ? function(n) {
2800
+ return e(n);
2801
+ } : t ? function(n) {
2802
+ if (!n || typeof n != "object" && typeof n != "function")
2803
+ throw new TypeError("getProto: not an object");
2804
+ return t(n);
2805
+ } : r ? function(n) {
2806
+ return r(n);
2807
+ } : null, xt;
2808
+ }
2809
+ var Et, _r;
2810
+ function Ia() {
2811
+ if (_r) return Et;
2812
+ _r = 1;
2813
+ var e = Function.prototype.call, t = Object.prototype.hasOwnProperty, r = ft();
2814
+ return Et = r.call(e, t), Et;
2815
+ }
2816
+ var x, Ma = sn, Fa = ca, Ba = pa, Wa = ua, Ja = fa, qe = da, Pe = Ne, za = ha, Ka = ya, Va = ma, Ga = ba, Qa = ga, Ya = ja, Xa = $a, Za = Oa, hn = Function, Pt = function(e) {
2817
+ try {
2818
+ return hn('"use strict"; return (' + e + ").constructor;")();
2819
+ } catch {
2820
+ }
2821
+ }, Fe = ln, ei = cn, Ct = function() {
2822
+ throw new Pe();
2823
+ }, ti = Fe ? (function() {
2824
+ try {
2825
+ return arguments.callee, Ct;
2826
+ } catch {
2827
+ try {
2828
+ return Fe(arguments, "callee").get;
2829
+ } catch {
2830
+ return Ct;
2831
+ }
2832
+ }
2833
+ })() : Ct, we = ka()(), H = Ha(), ri = un(), ni = pn(), yn = fn(), Be = Yt, Se = {}, oi = typeof Uint8Array > "u" || !H ? x : H(Uint8Array), $e = {
2834
+ __proto__: null,
2835
+ "%AggregateError%": typeof AggregateError > "u" ? x : AggregateError,
2836
+ "%Array%": Array,
2837
+ "%ArrayBuffer%": typeof ArrayBuffer > "u" ? x : ArrayBuffer,
2838
+ "%ArrayIteratorPrototype%": we && H ? H([][Symbol.iterator]()) : x,
2839
+ "%AsyncFromSyncIteratorPrototype%": x,
2840
+ "%AsyncFunction%": Se,
2841
+ "%AsyncGenerator%": Se,
2842
+ "%AsyncGeneratorFunction%": Se,
2843
+ "%AsyncIteratorPrototype%": Se,
2844
+ "%Atomics%": typeof Atomics > "u" ? x : Atomics,
2845
+ "%BigInt%": typeof BigInt > "u" ? x : BigInt,
2846
+ "%BigInt64Array%": typeof BigInt64Array > "u" ? x : BigInt64Array,
2847
+ "%BigUint64Array%": typeof BigUint64Array > "u" ? x : BigUint64Array,
2848
+ "%Boolean%": Boolean,
2849
+ "%DataView%": typeof DataView > "u" ? x : DataView,
2850
+ "%Date%": Date,
2851
+ "%decodeURI%": decodeURI,
2852
+ "%decodeURIComponent%": decodeURIComponent,
2853
+ "%encodeURI%": encodeURI,
2854
+ "%encodeURIComponent%": encodeURIComponent,
2855
+ "%Error%": Fa,
2856
+ "%eval%": eval,
2857
+ // eslint-disable-line no-eval
2858
+ "%EvalError%": Ba,
2859
+ "%Float16Array%": typeof Float16Array > "u" ? x : Float16Array,
2860
+ "%Float32Array%": typeof Float32Array > "u" ? x : Float32Array,
2861
+ "%Float64Array%": typeof Float64Array > "u" ? x : Float64Array,
2862
+ "%FinalizationRegistry%": typeof FinalizationRegistry > "u" ? x : FinalizationRegistry,
2863
+ "%Function%": hn,
2864
+ "%GeneratorFunction%": Se,
2865
+ "%Int8Array%": typeof Int8Array > "u" ? x : Int8Array,
2866
+ "%Int16Array%": typeof Int16Array > "u" ? x : Int16Array,
2867
+ "%Int32Array%": typeof Int32Array > "u" ? x : Int32Array,
2868
+ "%isFinite%": isFinite,
2869
+ "%isNaN%": isNaN,
2870
+ "%IteratorPrototype%": we && H ? H(H([][Symbol.iterator]())) : x,
2871
+ "%JSON%": typeof JSON == "object" ? JSON : x,
2872
+ "%Map%": typeof Map > "u" ? x : Map,
2873
+ "%MapIteratorPrototype%": typeof Map > "u" || !we || !H ? x : H((/* @__PURE__ */ new Map())[Symbol.iterator]()),
2874
+ "%Math%": Math,
2875
+ "%Number%": Number,
2876
+ "%Object%": Ma,
2877
+ "%Object.getOwnPropertyDescriptor%": Fe,
2878
+ "%parseFloat%": parseFloat,
2879
+ "%parseInt%": parseInt,
2880
+ "%Promise%": typeof Promise > "u" ? x : Promise,
2881
+ "%Proxy%": typeof Proxy > "u" ? x : Proxy,
2882
+ "%RangeError%": Wa,
2883
+ "%ReferenceError%": Ja,
2884
+ "%Reflect%": typeof Reflect > "u" ? x : Reflect,
2885
+ "%RegExp%": RegExp,
2886
+ "%Set%": typeof Set > "u" ? x : Set,
2887
+ "%SetIteratorPrototype%": typeof Set > "u" || !we || !H ? x : H((/* @__PURE__ */ new Set())[Symbol.iterator]()),
2888
+ "%SharedArrayBuffer%": typeof SharedArrayBuffer > "u" ? x : SharedArrayBuffer,
2889
+ "%String%": String,
2890
+ "%StringIteratorPrototype%": we && H ? H(""[Symbol.iterator]()) : x,
2891
+ "%Symbol%": we ? Symbol : x,
2892
+ "%SyntaxError%": qe,
2893
+ "%ThrowTypeError%": ti,
2894
+ "%TypedArray%": oi,
2895
+ "%TypeError%": Pe,
2896
+ "%Uint8Array%": typeof Uint8Array > "u" ? x : Uint8Array,
2897
+ "%Uint8ClampedArray%": typeof Uint8ClampedArray > "u" ? x : Uint8ClampedArray,
2898
+ "%Uint16Array%": typeof Uint16Array > "u" ? x : Uint16Array,
2899
+ "%Uint32Array%": typeof Uint32Array > "u" ? x : Uint32Array,
2900
+ "%URIError%": za,
2901
+ "%WeakMap%": typeof WeakMap > "u" ? x : WeakMap,
2902
+ "%WeakRef%": typeof WeakRef > "u" ? x : WeakRef,
2903
+ "%WeakSet%": typeof WeakSet > "u" ? x : WeakSet,
2904
+ "%Function.prototype.call%": Be,
2905
+ "%Function.prototype.apply%": yn,
2906
+ "%Object.defineProperty%": ei,
2907
+ "%Object.getPrototypeOf%": ri,
2908
+ "%Math.abs%": Ka,
2909
+ "%Math.floor%": Va,
2910
+ "%Math.max%": Ga,
2911
+ "%Math.min%": Qa,
2912
+ "%Math.pow%": Ya,
2913
+ "%Math.round%": Xa,
2914
+ "%Math.sign%": Za,
2915
+ "%Reflect.getPrototypeOf%": ni
2916
+ };
2917
+ if (H)
2918
+ try {
2919
+ null.error;
2920
+ } catch (e) {
2921
+ var ai = H(H(e));
2922
+ $e["%Error.prototype%"] = ai;
2923
+ }
2924
+ var ii = function e(t) {
2925
+ var r;
2926
+ if (t === "%AsyncFunction%")
2927
+ r = Pt("async function () {}");
2928
+ else if (t === "%GeneratorFunction%")
2929
+ r = Pt("function* () {}");
2930
+ else if (t === "%AsyncGeneratorFunction%")
2931
+ r = Pt("async function* () {}");
2932
+ else if (t === "%AsyncGenerator%") {
2933
+ var n = e("%AsyncGeneratorFunction%");
2934
+ n && (r = n.prototype);
2935
+ } else if (t === "%AsyncIteratorPrototype%") {
2936
+ var l = e("%AsyncGenerator%");
2937
+ l && H && (r = H(l.prototype));
2938
+ }
2939
+ return $e[t] = r, r;
2940
+ }, Hr = {
2941
+ __proto__: null,
2942
+ "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
2943
+ "%ArrayPrototype%": ["Array", "prototype"],
2944
+ "%ArrayProto_entries%": ["Array", "prototype", "entries"],
2945
+ "%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
2946
+ "%ArrayProto_keys%": ["Array", "prototype", "keys"],
2947
+ "%ArrayProto_values%": ["Array", "prototype", "values"],
2948
+ "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
2949
+ "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
2950
+ "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
2951
+ "%BooleanPrototype%": ["Boolean", "prototype"],
2952
+ "%DataViewPrototype%": ["DataView", "prototype"],
2953
+ "%DatePrototype%": ["Date", "prototype"],
2954
+ "%ErrorPrototype%": ["Error", "prototype"],
2955
+ "%EvalErrorPrototype%": ["EvalError", "prototype"],
2956
+ "%Float32ArrayPrototype%": ["Float32Array", "prototype"],
2957
+ "%Float64ArrayPrototype%": ["Float64Array", "prototype"],
2958
+ "%FunctionPrototype%": ["Function", "prototype"],
2959
+ "%Generator%": ["GeneratorFunction", "prototype"],
2960
+ "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
2961
+ "%Int8ArrayPrototype%": ["Int8Array", "prototype"],
2962
+ "%Int16ArrayPrototype%": ["Int16Array", "prototype"],
2963
+ "%Int32ArrayPrototype%": ["Int32Array", "prototype"],
2964
+ "%JSONParse%": ["JSON", "parse"],
2965
+ "%JSONStringify%": ["JSON", "stringify"],
2966
+ "%MapPrototype%": ["Map", "prototype"],
2967
+ "%NumberPrototype%": ["Number", "prototype"],
2968
+ "%ObjectPrototype%": ["Object", "prototype"],
2969
+ "%ObjProto_toString%": ["Object", "prototype", "toString"],
2970
+ "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
2971
+ "%PromisePrototype%": ["Promise", "prototype"],
2972
+ "%PromiseProto_then%": ["Promise", "prototype", "then"],
2973
+ "%Promise_all%": ["Promise", "all"],
2974
+ "%Promise_reject%": ["Promise", "reject"],
2975
+ "%Promise_resolve%": ["Promise", "resolve"],
2976
+ "%RangeErrorPrototype%": ["RangeError", "prototype"],
2977
+ "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
2978
+ "%RegExpPrototype%": ["RegExp", "prototype"],
2979
+ "%SetPrototype%": ["Set", "prototype"],
2980
+ "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
2981
+ "%StringPrototype%": ["String", "prototype"],
2982
+ "%SymbolPrototype%": ["Symbol", "prototype"],
2983
+ "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
2984
+ "%TypedArrayPrototype%": ["TypedArray", "prototype"],
2985
+ "%TypeErrorPrototype%": ["TypeError", "prototype"],
2986
+ "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
2987
+ "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
2988
+ "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
2989
+ "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
2990
+ "%URIErrorPrototype%": ["URIError", "prototype"],
2991
+ "%WeakMapPrototype%": ["WeakMap", "prototype"],
2992
+ "%WeakSetPrototype%": ["WeakSet", "prototype"]
2993
+ }, We = ft(), lt = /* @__PURE__ */ Ia(), si = We.call(Be, Array.prototype.concat), li = We.call(yn, Array.prototype.splice), Ir = We.call(Be, String.prototype.replace), ct = We.call(Be, String.prototype.slice), ci = We.call(Be, RegExp.prototype.exec), pi = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, ui = /\\(\\)?/g, fi = function(e) {
2994
+ var t = ct(e, 0, 1), r = ct(e, -1);
2995
+ if (t === "%" && r !== "%")
2996
+ throw new qe("invalid intrinsic syntax, expected closing `%`");
2997
+ if (r === "%" && t !== "%")
2998
+ throw new qe("invalid intrinsic syntax, expected opening `%`");
2999
+ var n = [];
3000
+ return Ir(e, pi, function(l, a, s, o) {
3001
+ n[n.length] = s ? Ir(o, ui, "$1") : a || l;
3002
+ }), n;
3003
+ }, di = function(e, t) {
3004
+ var r = e, n;
3005
+ if (lt(Hr, r) && (n = Hr[r], r = "%" + n[0] + "%"), lt($e, r)) {
3006
+ var l = $e[r];
3007
+ if (l === Se && (l = ii(r)), typeof l > "u" && !t)
3008
+ throw new Pe("intrinsic " + e + " exists, but is not available. Please file an issue!");
3009
+ return {
3010
+ alias: n,
3011
+ name: r,
3012
+ value: l
3013
+ };
3014
+ }
3015
+ throw new qe("intrinsic " + e + " does not exist!");
3016
+ }, Xt = function(e, t) {
3017
+ if (typeof e != "string" || e.length === 0)
3018
+ throw new Pe("intrinsic name must be a non-empty string");
3019
+ if (arguments.length > 1 && typeof t != "boolean")
3020
+ throw new Pe('"allowMissing" argument must be a boolean');
3021
+ if (ci(/^%?[^%]*%?$/, e) === null)
3022
+ throw new qe("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
3023
+ var r = fi(e), n = r.length > 0 ? r[0] : "", l = di("%" + n + "%", t), a = l.name, s = l.value, o = !1, i = l.alias;
3024
+ i && (n = i[0], li(r, si([0, 1], i)));
3025
+ for (var c = 1, p = !0; c < r.length; c += 1) {
3026
+ var f = r[c], u = ct(f, 0, 1), d = ct(f, -1);
3027
+ if ((u === '"' || u === "'" || u === "`" || d === '"' || d === "'" || d === "`") && u !== d)
3028
+ throw new qe("property names with quotes must have matching quotes");
3029
+ if ((f === "constructor" || !p) && (o = !0), n += "." + f, a = "%" + n + "%", lt($e, a))
3030
+ s = $e[a];
3031
+ else if (s != null) {
3032
+ if (!(f in s)) {
3033
+ if (!t)
3034
+ throw new Pe("base intrinsic for " + e + " exists, but the property is not available.");
3035
+ return;
3036
+ }
3037
+ if (Fe && c + 1 >= r.length) {
3038
+ var h = Fe(s, f);
3039
+ p = !!h, p && "get" in h && !("originalValue" in h.get) ? s = h.get : s = s[f];
3040
+ } else
3041
+ p = lt(s, f), s = s[f];
3042
+ p && !o && ($e[a] = s);
3043
+ }
3044
+ }
3045
+ return s;
3046
+ }, mn = Xt, bn = dn, hi = bn([mn("%String.prototype.indexOf%")]), gn = function(e, t) {
3047
+ var r = (
3048
+ /** @type {(this: unknown, ...args: unknown[]) => unknown} */
3049
+ mn(e, !!t)
3050
+ );
3051
+ return typeof r == "function" && hi(e, ".prototype.") > -1 ? bn(
3052
+ /** @type {const} */
3053
+ [r]
3054
+ ) : r;
3055
+ }, yi = Xt, Je = gn, mi = pt, bi = Ne, Mr = yi("%Map%", !0), gi = Je("Map.prototype.get", !0), ji = Je("Map.prototype.set", !0), $i = Je("Map.prototype.has", !0), vi = Je("Map.prototype.delete", !0), wi = Je("Map.prototype.size", !0), jn = !!Mr && /** @type {Exclude<import('.'), false>} */
3056
+ function() {
3057
+ var e, t = {
3058
+ assert: function(r) {
3059
+ if (!t.has(r))
3060
+ throw new bi("Side channel does not contain " + mi(r));
3061
+ },
3062
+ delete: function(r) {
3063
+ if (e) {
3064
+ var n = vi(e, r);
3065
+ return wi(e) === 0 && (e = void 0), n;
3066
+ }
3067
+ return !1;
3068
+ },
3069
+ get: function(r) {
3070
+ if (e)
3071
+ return gi(e, r);
3072
+ },
3073
+ has: function(r) {
3074
+ return e ? $i(e, r) : !1;
3075
+ },
3076
+ set: function(r, n) {
3077
+ e || (e = new Mr()), ji(e, r, n);
3078
+ }
3079
+ };
3080
+ return t;
3081
+ }, Oi = Xt, dt = gn, Si = pt, Ve = jn, Ti = Ne, Oe = Oi("%WeakMap%", !0), ki = dt("WeakMap.prototype.get", !0), xi = dt("WeakMap.prototype.set", !0), Ei = dt("WeakMap.prototype.has", !0), Pi = dt("WeakMap.prototype.delete", !0), Ci = Oe ? (
3082
+ /** @type {Exclude<import('.'), false>} */
3083
+ (function() {
3084
+ var e, t, r = {
3085
+ assert: function(n) {
3086
+ if (!r.has(n))
3087
+ throw new Ti("Side channel does not contain " + Si(n));
3088
+ },
3089
+ delete: function(n) {
3090
+ if (Oe && n && (typeof n == "object" || typeof n == "function")) {
3091
+ if (e)
3092
+ return Pi(e, n);
3093
+ } else if (Ve && t)
3094
+ return t.delete(n);
3095
+ return !1;
3096
+ },
3097
+ get: function(n) {
3098
+ return Oe && n && (typeof n == "object" || typeof n == "function") && e ? ki(e, n) : t && t.get(n);
3099
+ },
3100
+ has: function(n) {
3101
+ return Oe && n && (typeof n == "object" || typeof n == "function") && e ? Ei(e, n) : !!t && t.has(n);
3102
+ },
3103
+ set: function(n, l) {
3104
+ Oe && n && (typeof n == "object" || typeof n == "function") ? (e || (e = new Oe()), xi(e, n, l)) : Ve && (t || (t = Ve()), t.set(n, l));
3105
+ }
3106
+ };
3107
+ return r;
3108
+ })
3109
+ ) : Ve, Ai = Ne, Ri = pt, qi = la, Ni = jn, Li = Ci, Ui = Li || Ni || qi, $n = function() {
3110
+ var e, t = {
3111
+ assert: function(r) {
3112
+ if (!t.has(r)) {
3113
+ var n = r && Object(r) === r ? "the given object key" : Ri(r);
3114
+ throw new Ai("Side channel does not contain " + n);
3115
+ }
3116
+ },
3117
+ delete: function(r) {
3118
+ return !!e && e.delete(r);
3119
+ },
3120
+ get: function(r) {
3121
+ return e && e.get(r);
3122
+ },
3123
+ has: function(r) {
3124
+ return !!e && e.has(r);
3125
+ },
3126
+ set: function(r, n) {
3127
+ e || (e = Ui()), e.set(r, n);
3128
+ }
3129
+ };
3130
+ return t;
3131
+ }, Di = String.prototype.replace, _i = /%20/g, At = {
3132
+ RFC1738: "RFC1738",
3133
+ RFC3986: "RFC3986"
3134
+ }, Zt = {
3135
+ default: At.RFC3986,
3136
+ formatters: {
3137
+ RFC1738: function(e) {
3138
+ return Di.call(e, _i, "+");
3139
+ },
3140
+ RFC3986: function(e) {
3141
+ return String(e);
3142
+ }
3143
+ },
3144
+ RFC1738: At.RFC1738,
3145
+ RFC3986: At.RFC3986
3146
+ }, Hi = Zt, vn = $n, Fr = cn, Rt = Object.prototype.hasOwnProperty, be = Array.isArray, ht = vn(), ge = function(e, t) {
3147
+ return ht.set(e, t), e;
3148
+ }, je = function(e) {
3149
+ return ht.has(e);
3150
+ }, Ue = function(e) {
3151
+ return ht.get(e);
3152
+ }, Ft = function(e, t) {
3153
+ ht.set(e, t);
3154
+ }, ne = (function() {
3155
+ for (var e = [], t = 0; t < 256; ++t)
3156
+ e[e.length] = "%" + ((t < 16 ? "0" : "") + t.toString(16)).toUpperCase();
3157
+ return e;
3158
+ })(), Ii = function(e) {
3159
+ for (; e.length > 1; ) {
3160
+ var t = e.pop(), r = t.obj[t.prop];
3161
+ if (be(r)) {
3162
+ for (var n = [], l = 0; l < r.length; ++l)
3163
+ typeof r[l] < "u" && (n[n.length] = r[l]);
3164
+ t.obj[t.prop] = n;
3165
+ }
3166
+ }
3167
+ }, Ee = function(e, t) {
3168
+ for (var r = t && t.plainObjects ? { __proto__: null } : {}, n = 0; n < e.length; ++n)
3169
+ typeof e[n] < "u" && (r[n] = e[n]);
3170
+ return r;
3171
+ }, Bt = function(e, t, r) {
3172
+ t === "__proto__" && Fr ? Fr(e, t, {
3173
+ configurable: !0,
3174
+ enumerable: !0,
3175
+ value: r,
3176
+ writable: !0
3177
+ }) : e[t] = r;
3178
+ }, Mi = function e(t, r, n) {
3179
+ if (!r)
3180
+ return t;
3181
+ if (typeof r != "object" && typeof r != "function") {
3182
+ if (be(t)) {
3183
+ var l = t.length;
3184
+ if (n && typeof n.arrayLimit == "number" && l >= n.arrayLimit) {
3185
+ if (n.throwOnLimitExceeded)
3186
+ throw new RangeError("Array limit exceeded. Only " + n.arrayLimit + " element" + (n.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
3187
+ return ge(Ee(t.concat(r), n), l);
3188
+ }
3189
+ t[l] = r;
3190
+ } else if (t && typeof t == "object")
3191
+ if (je(t)) {
3192
+ var a = Ue(t) + 1;
3193
+ t[a] = r, Ft(t, a);
3194
+ } else {
3195
+ if (n && n.strictMerge)
3196
+ return [t, r];
3197
+ (n && (n.plainObjects || n.allowPrototypes) || !Rt.call(Object.prototype, r)) && (t[r] = !0);
3198
+ }
3199
+ else
3200
+ return [t, r];
3201
+ return t;
3202
+ }
3203
+ if (!t || typeof t != "object") {
3204
+ if (je(r)) {
3205
+ for (var s = Object.keys(r), o = n && n.plainObjects ? { __proto__: null, 0: t } : { 0: t }, i = 0; i < s.length; i++) {
3206
+ var c = parseInt(s[i], 10);
3207
+ o[c + 1] = r[s[i]];
3208
+ }
3209
+ return ge(o, Ue(r) + 1);
3210
+ }
3211
+ var p = [t].concat(r);
3212
+ if (n && typeof n.arrayLimit == "number" && p.length > n.arrayLimit) {
3213
+ if (n.throwOnLimitExceeded)
3214
+ throw new RangeError("Array limit exceeded. Only " + n.arrayLimit + " element" + (n.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
3215
+ return ge(Ee(p, n), p.length - 1);
3216
+ }
3217
+ return p;
3218
+ }
3219
+ var f = t;
3220
+ if (be(t) && !be(r) && (f = Ee(t, n)), be(t) && be(r)) {
3221
+ if (r.forEach(function(u, d) {
3222
+ if (Rt.call(t, d)) {
3223
+ var h = t[d];
3224
+ h && typeof h == "object" && u && typeof u == "object" ? t[d] = e(h, u, n) : t[t.length] = u;
3225
+ } else
3226
+ t[d] = u;
3227
+ }), n && typeof n.arrayLimit == "number" && t.length > n.arrayLimit) {
3228
+ if (n.throwOnLimitExceeded)
3229
+ throw new RangeError("Array limit exceeded. Only " + n.arrayLimit + " element" + (n.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
3230
+ return ge(Ee(t, n), t.length - 1);
3231
+ }
3232
+ return t;
3233
+ }
3234
+ return Object.keys(r).reduce(function(u, d) {
3235
+ var h = r[d];
3236
+ if (Rt.call(u, d) ? Bt(u, d, e(u[d], h, n)) : Bt(u, d, h), je(r) && !je(u) && ge(u, Ue(r)), je(u)) {
3237
+ var m = parseInt(d, 10);
3238
+ String(m) === d && m >= 0 && m > Ue(u) && Ft(u, m);
3239
+ }
3240
+ return u;
3241
+ }, f);
3242
+ }, Fi = function(e, t) {
3243
+ return Object.keys(t).reduce(function(r, n) {
3244
+ return Bt(r, n, t[n]), r;
3245
+ }, e);
3246
+ }, Bi = function(e, t, r) {
3247
+ var n = e.replace(/\+/g, " ");
3248
+ if (r === "iso-8859-1")
3249
+ return n.replace(/%[0-9a-f]{2}/gi, unescape);
3250
+ try {
3251
+ return decodeURIComponent(n);
3252
+ } catch {
3253
+ return n;
3254
+ }
3255
+ }, Ge = 1024, Wi = function(e, t, r, n, l) {
3256
+ if (e.length === 0)
3257
+ return e;
3258
+ var a = e;
3259
+ if (typeof e == "symbol" ? a = Symbol.prototype.toString.call(e) : typeof e != "string" && (a = String(e)), r === "iso-8859-1")
3260
+ return escape(a).replace(/%u[0-9a-f]{4}/gi, function(d) {
3261
+ return "%26%23" + parseInt(d.slice(2), 16) + "%3B";
3262
+ });
3263
+ for (var s = "", o = 0; o < a.length; o += Ge) {
3264
+ var i = a.length >= Ge ? a.slice(o, o + Ge) : a;
3265
+ if (o + Ge < a.length) {
3266
+ var c = i.charCodeAt(i.length - 1);
3267
+ c >= 55296 && c <= 56319 && (i = i.slice(0, -1), o -= 1);
3268
+ }
3269
+ for (var p = [], f = 0; f < i.length; ++f) {
3270
+ var u = i.charCodeAt(f);
3271
+ if (u === 45 || u === 46 || u === 95 || u === 126 || u >= 48 && u <= 57 || u >= 65 && u <= 90 || u >= 97 && u <= 122 || l === Hi.RFC1738 && (u === 40 || u === 41)) {
3272
+ p[p.length] = i.charAt(f);
3273
+ continue;
3274
+ }
3275
+ if (u < 128) {
3276
+ p[p.length] = ne[u];
3277
+ continue;
3278
+ }
3279
+ if (u < 2048) {
3280
+ p[p.length] = ne[192 | u >> 6] + ne[128 | u & 63];
3281
+ continue;
3282
+ }
3283
+ if (u < 55296 || u >= 57344) {
3284
+ p[p.length] = ne[224 | u >> 12] + ne[128 | u >> 6 & 63] + ne[128 | u & 63];
3285
+ continue;
3286
+ }
3287
+ f += 1, u = 65536 + ((u & 1023) << 10 | i.charCodeAt(f) & 1023), p[p.length] = ne[240 | u >> 18] + ne[128 | u >> 12 & 63] + ne[128 | u >> 6 & 63] + ne[128 | u & 63];
3288
+ }
3289
+ s += p.join("");
3290
+ }
3291
+ return s;
3292
+ }, Ji = function(e) {
3293
+ for (var t = [{ obj: { o: e }, prop: "o" }], r = vn(), n = 0; n < t.length; ++n)
3294
+ for (var l = t[n], a = l.obj[l.prop], s = Object.keys(a), o = 0; o < s.length; ++o) {
3295
+ var i = s[o], c = a[i];
3296
+ typeof c == "object" && c !== null && !r.has(c) && (t[t.length] = { obj: a, prop: i }, r.set(c, !0));
3297
+ }
3298
+ return Ii(t), e;
3299
+ }, zi = function(e) {
3300
+ return Object.prototype.toString.call(e) === "[object RegExp]";
3301
+ }, Ki = function(e) {
3302
+ return !e || typeof e != "object" ? !1 : !!(e.constructor && e.constructor.isBuffer && e.constructor.isBuffer(e));
3303
+ }, Vi = function(e, t, r, n, l) {
3304
+ if (je(e)) {
3305
+ if (l)
3306
+ throw new RangeError("Array limit exceeded. Only " + r + " element" + (r === 1 ? "" : "s") + " allowed in an array.");
3307
+ var a = Ue(e) + 1;
3308
+ return e[a] = t, Ft(e, a), e;
3309
+ }
3310
+ var s = [].concat(e, t);
3311
+ if (s.length > r) {
3312
+ if (l)
3313
+ throw new RangeError("Array limit exceeded. Only " + r + " element" + (r === 1 ? "" : "s") + " allowed in an array.");
3314
+ return ge(Ee(s, { plainObjects: n }), s.length - 1);
3315
+ }
3316
+ return s;
3317
+ }, Gi = function(e, t) {
3318
+ if (be(e)) {
3319
+ for (var r = [], n = 0; n < e.length; n += 1)
3320
+ r[r.length] = t(e[n]);
3321
+ return r;
3322
+ }
3323
+ return t(e);
3324
+ }, wn = {
3325
+ arrayToObject: Ee,
3326
+ assign: Fi,
3327
+ combine: Vi,
3328
+ compact: Ji,
3329
+ decode: Bi,
3330
+ encode: Wi,
3331
+ isBuffer: Ki,
3332
+ isOverflow: je,
3333
+ isRegExp: zi,
3334
+ markOverflow: ge,
3335
+ maybeMap: Gi,
3336
+ merge: Mi
3337
+ }, On = $n, Ze = wn, Ie = Zt, Qi = Object.prototype.hasOwnProperty, Sn = {
3338
+ brackets: function(e) {
3339
+ return e + "[]";
3340
+ },
3341
+ comma: "comma",
3342
+ indices: function(e, t) {
3343
+ return e + "[" + t + "]";
3344
+ },
3345
+ repeat: function(e) {
3346
+ return e;
3347
+ }
3348
+ }, oe = Array.isArray, Yi = Array.prototype.push, Tn = function(e, t) {
3349
+ Yi.apply(e, oe(t) ? t : [t]);
3350
+ }, Xi = Date.prototype.toISOString, Br = Ie.default, U = {
3351
+ addQueryPrefix: !1,
3352
+ allowDots: !1,
3353
+ allowEmptyArrays: !1,
3354
+ arrayFormat: "indices",
3355
+ charset: "utf-8",
3356
+ charsetSentinel: !1,
3357
+ commaRoundTrip: !1,
3358
+ delimiter: "&",
3359
+ encode: !0,
3360
+ encodeDotInKeys: !1,
3361
+ encoder: Ze.encode,
3362
+ encodeValuesOnly: !1,
3363
+ filter: void 0,
3364
+ format: Br,
3365
+ formatter: Ie.formatters[Br],
3366
+ // deprecated
3367
+ indices: !1,
3368
+ serializeDate: function(e) {
3369
+ return Xi.call(e);
3370
+ },
3371
+ skipNulls: !1,
3372
+ strictNullHandling: !1
3373
+ }, Zi = function(e) {
3374
+ return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "symbol" || typeof e == "bigint";
3375
+ }, qt = {}, es = function e(t, r, n, l, a, s, o, i, c, p, f, u, d, h, m, b, j, y) {
3376
+ for (var g = t, w = y, O = 0, $ = !1; (w = w.get(qt)) !== void 0 && !$; ) {
3377
+ var E = w.get(t);
3378
+ if (O += 1, typeof E < "u") {
3379
+ if (E === O)
3380
+ throw new RangeError("Cyclic object value");
3381
+ $ = !0;
3382
+ }
3383
+ typeof w.get(qt) > "u" && (O = 0);
3384
+ }
3385
+ if (typeof p == "function" ? g = p(r, g) : g instanceof Date ? g = d(g) : n === "comma" && oe(g) && (g = Ze.maybeMap(g, function(v) {
3386
+ return v instanceof Date ? d(v) : v;
3387
+ })), g === null) {
3388
+ if (s)
3389
+ return m(c && !b ? c(r, U.encoder, j, "key", h) : r);
3390
+ g = "";
3391
+ }
3392
+ if (Zi(g) || Ze.isBuffer(g)) {
3393
+ if (c) {
3394
+ var S = b ? r : c(r, U.encoder, j, "key", h);
3395
+ return [m(S) + "=" + m(c(g, U.encoder, j, "value", h))];
3396
+ }
3397
+ return [m(r) + "=" + m(String(g))];
3398
+ }
3399
+ var C = [];
3400
+ if (typeof g > "u")
3401
+ return C;
3402
+ var _;
3403
+ if (n === "comma" && oe(g))
3404
+ b && c && (g = Ze.maybeMap(g, function(v) {
3405
+ return v == null ? v : c(v);
3406
+ })), _ = [{ value: g.length > 0 ? g.join(",") || null : void 0 }];
3407
+ else if (oe(p))
3408
+ _ = p;
3409
+ else {
3410
+ var Q = Object.keys(g);
3411
+ _ = f ? Q.sort(f) : Q;
3412
+ }
3413
+ var Y = i ? String(r).replace(/\./g, "%2E") : String(r), L = l && oe(g) && g.length === 1 ? Y + "[]" : Y;
3414
+ if (a && oe(g) && g.length === 0)
3415
+ return L + "[]";
3416
+ for (var J = 0; J < _.length; ++J) {
3417
+ var F = _[J], K = typeof F == "object" && F && typeof F.value < "u" ? F.value : g[F];
3418
+ if (!(o && K === null)) {
3419
+ var ue = u && i ? String(F).replace(/\./g, "%2E") : String(F), yt = oe(g) ? typeof n == "function" ? n(L, ue) : L : L + (u ? "." + ue : "[" + ue + "]");
3420
+ y.set(t, O);
3421
+ var ze = On();
3422
+ ze.set(qt, y), Tn(C, e(
3423
+ K,
3424
+ yt,
3425
+ n,
3426
+ l,
3427
+ a,
3428
+ s,
3429
+ o,
3430
+ i,
3431
+ n === "comma" && b && oe(g) ? null : c,
3432
+ p,
3433
+ f,
3434
+ u,
3435
+ d,
3436
+ h,
3437
+ m,
3438
+ b,
3439
+ j,
3440
+ ze
3441
+ ));
3442
+ }
3443
+ }
3444
+ return C;
3445
+ }, ts = function(e) {
3446
+ if (!e)
3447
+ return U;
3448
+ if (typeof e.allowEmptyArrays < "u" && typeof e.allowEmptyArrays != "boolean")
3449
+ throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
3450
+ if (typeof e.encodeDotInKeys < "u" && typeof e.encodeDotInKeys != "boolean")
3451
+ throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");
3452
+ if (e.encoder !== null && typeof e.encoder < "u" && typeof e.encoder != "function")
3453
+ throw new TypeError("Encoder has to be a function.");
3454
+ var t = e.charset || U.charset;
3455
+ if (typeof e.charset < "u" && e.charset !== "utf-8" && e.charset !== "iso-8859-1")
3456
+ throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
3457
+ var r = Ie.default;
3458
+ if (typeof e.format < "u") {
3459
+ if (!Qi.call(Ie.formatters, e.format))
3460
+ throw new TypeError("Unknown format option provided.");
3461
+ r = e.format;
3462
+ }
3463
+ var n = Ie.formatters[r], l = U.filter;
3464
+ (typeof e.filter == "function" || oe(e.filter)) && (l = e.filter);
3465
+ var a;
3466
+ if (e.arrayFormat in Sn ? a = e.arrayFormat : "indices" in e ? a = e.indices ? "indices" : "repeat" : a = U.arrayFormat, "commaRoundTrip" in e && typeof e.commaRoundTrip != "boolean")
3467
+ throw new TypeError("`commaRoundTrip` must be a boolean, or absent");
3468
+ var s = typeof e.allowDots > "u" ? e.encodeDotInKeys === !0 ? !0 : U.allowDots : !!e.allowDots;
3469
+ return {
3470
+ addQueryPrefix: typeof e.addQueryPrefix == "boolean" ? e.addQueryPrefix : U.addQueryPrefix,
3471
+ allowDots: s,
3472
+ allowEmptyArrays: typeof e.allowEmptyArrays == "boolean" ? !!e.allowEmptyArrays : U.allowEmptyArrays,
3473
+ arrayFormat: a,
3474
+ charset: t,
3475
+ charsetSentinel: typeof e.charsetSentinel == "boolean" ? e.charsetSentinel : U.charsetSentinel,
3476
+ commaRoundTrip: !!e.commaRoundTrip,
3477
+ delimiter: typeof e.delimiter > "u" ? U.delimiter : e.delimiter,
3478
+ encode: typeof e.encode == "boolean" ? e.encode : U.encode,
3479
+ encodeDotInKeys: typeof e.encodeDotInKeys == "boolean" ? e.encodeDotInKeys : U.encodeDotInKeys,
3480
+ encoder: typeof e.encoder == "function" ? e.encoder : U.encoder,
3481
+ encodeValuesOnly: typeof e.encodeValuesOnly == "boolean" ? e.encodeValuesOnly : U.encodeValuesOnly,
3482
+ filter: l,
3483
+ format: r,
3484
+ formatter: n,
3485
+ serializeDate: typeof e.serializeDate == "function" ? e.serializeDate : U.serializeDate,
3486
+ skipNulls: typeof e.skipNulls == "boolean" ? e.skipNulls : U.skipNulls,
3487
+ sort: typeof e.sort == "function" ? e.sort : null,
3488
+ strictNullHandling: typeof e.strictNullHandling == "boolean" ? e.strictNullHandling : U.strictNullHandling
3489
+ };
3490
+ }, rs = function(e, t) {
3491
+ var r = e, n = ts(t), l, a;
3492
+ typeof n.filter == "function" ? (a = n.filter, r = a("", r)) : oe(n.filter) && (a = n.filter, l = a);
3493
+ var s = [];
3494
+ if (typeof r != "object" || r === null)
3495
+ return "";
3496
+ var o = Sn[n.arrayFormat], i = o === "comma" && n.commaRoundTrip;
3497
+ l || (l = Object.keys(r)), n.sort && l.sort(n.sort);
3498
+ for (var c = On(), p = 0; p < l.length; ++p) {
3499
+ var f = l[p];
3500
+ if (!(typeof f > "u" || f === null)) {
3501
+ var u = r[f];
3502
+ n.skipNulls && u === null || Tn(s, es(
3503
+ u,
3504
+ f,
3505
+ o,
3506
+ i,
3507
+ n.allowEmptyArrays,
3508
+ n.strictNullHandling,
3509
+ n.skipNulls,
3510
+ n.encodeDotInKeys,
3511
+ n.encode ? n.encoder : null,
3512
+ n.filter,
3513
+ n.sort,
3514
+ n.allowDots,
3515
+ n.serializeDate,
3516
+ n.format,
3517
+ n.formatter,
3518
+ n.encodeValuesOnly,
3519
+ n.charset,
3520
+ c
3521
+ ));
3522
+ }
3523
+ }
3524
+ var d = s.join(n.delimiter), h = n.addQueryPrefix === !0 ? "?" : "";
3525
+ return n.charsetSentinel && (n.charset === "iso-8859-1" ? h += "utf8=%26%2310003%3B" + n.delimiter : h += "utf8=%E2%9C%93" + n.delimiter), d.length > 0 ? h + d : "";
3526
+ }, se = wn, et = Object.prototype.hasOwnProperty, Nt = Array.isArray, q = {
3527
+ allowDots: !1,
3528
+ allowEmptyArrays: !1,
3529
+ allowPrototypes: !1,
3530
+ allowSparse: !1,
3531
+ arrayLimit: 20,
3532
+ charset: "utf-8",
3533
+ charsetSentinel: !1,
3534
+ comma: !1,
3535
+ decodeDotInKeys: !1,
3536
+ decoder: se.decode,
3537
+ delimiter: "&",
3538
+ depth: 5,
3539
+ duplicates: "combine",
3540
+ ignoreQueryPrefix: !1,
3541
+ interpretNumericEntities: !1,
3542
+ parameterLimit: 1e3,
3543
+ parseArrays: !0,
3544
+ plainObjects: !1,
3545
+ strictDepth: !1,
3546
+ strictMerge: !0,
3547
+ strictNullHandling: !1,
3548
+ throwOnLimitExceeded: !1
3549
+ }, ns = function(e) {
3550
+ return e.replace(/&#(\d+);/g, function(t, r) {
3551
+ return String.fromCharCode(parseInt(r, 10));
3552
+ });
3553
+ }, kn = function(e, t, r, n) {
3554
+ if (e && typeof e == "string" && t.comma && e.indexOf(",") > -1) {
3555
+ if (n && t.throwOnLimitExceeded)
3556
+ for (var l = 0, a = e.indexOf(","); a > -1; ) {
3557
+ if (l += 1, l >= t.arrayLimit)
3558
+ throw new RangeError("Array limit exceeded. Only " + t.arrayLimit + " element" + (t.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
3559
+ a = e.indexOf(",", a + 1);
3560
+ }
3561
+ return e.split(",");
3562
+ }
3563
+ if (t.throwOnLimitExceeded && r >= t.arrayLimit)
3564
+ throw new RangeError("Array limit exceeded. Only " + t.arrayLimit + " element" + (t.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
3565
+ return e;
3566
+ }, os = "utf8=%26%2310003%3B", as = "utf8=%E2%9C%93", is = function(e, t) {
3567
+ var r = { __proto__: null }, n = t.ignoreQueryPrefix ? e.replace(/^\?/, "") : e;
3568
+ n = n.replace(/%5B/gi, "[").replace(/%5D/gi, "]");
3569
+ var l = t.parameterLimit === 1 / 0 ? void 0 : t.parameterLimit, a = n.split(
3570
+ t.delimiter,
3571
+ t.throwOnLimitExceeded && typeof l < "u" ? l + 1 : l
3572
+ );
3573
+ if (t.throwOnLimitExceeded && typeof l < "u" && a.length > l)
3574
+ throw new RangeError("Parameter limit exceeded. Only " + l + " parameter" + (l === 1 ? "" : "s") + " allowed.");
3575
+ var s = -1, o, i = t.charset;
3576
+ if (t.charsetSentinel)
3577
+ for (o = 0; o < a.length; ++o)
3578
+ a[o].indexOf("utf8=") === 0 && (a[o] === as ? i = "utf-8" : a[o] === os && (i = "iso-8859-1"), s = o, o = a.length);
3579
+ for (o = 0; o < a.length; ++o)
3580
+ if (o !== s) {
3581
+ var c = a[o], p = c.indexOf("]="), f = p === -1 ? c.indexOf("=") : p + 1, u, d;
3582
+ if (f === -1 ? (u = t.decoder(c, q.decoder, i, "key"), d = t.strictNullHandling ? null : "") : (u = t.decoder(c.slice(0, f), q.decoder, i, "key"), u !== null && (d = se.maybeMap(
3583
+ kn(
3584
+ c.slice(f + 1),
3585
+ t,
3586
+ Nt(r[u]) ? r[u].length : 0,
3587
+ c.indexOf("[]=") === -1
3588
+ ),
3589
+ function(m) {
3590
+ return t.decoder(m, q.decoder, i, "value");
3591
+ }
3592
+ ))), d && t.interpretNumericEntities && i === "iso-8859-1" && (d = ns(String(d))), c.indexOf("[]=") > -1 && (d = Nt(d) ? [d] : d), t.comma && Nt(d) && d.length > t.arrayLimit && (d = se.combine([], d, t.arrayLimit, t.plainObjects, t.throwOnLimitExceeded)), u !== null) {
3593
+ var h = et.call(r, u);
3594
+ h && (t.duplicates === "combine" || c.indexOf("[]=") > -1) ? r[u] = se.combine(
3595
+ r[u],
3596
+ d,
3597
+ t.arrayLimit,
3598
+ t.plainObjects,
3599
+ t.throwOnLimitExceeded
3600
+ ) : (!h || t.duplicates === "last") && (r[u] = d);
3601
+ }
3602
+ }
3603
+ return r;
3604
+ }, ss = function(e, t, r, n) {
3605
+ var l = 0;
3606
+ if (e.length > 0 && e[e.length - 1] === "[]") {
3607
+ var a = e.slice(0, -1).join("");
3608
+ l = Array.isArray(t) && t[a] ? t[a].length : 0;
3609
+ }
3610
+ for (var s = n ? t : kn(t, r, l), o = e.length - 1; o >= 0; --o) {
3611
+ var i, c = e[o];
3612
+ if (c === "[]" && r.parseArrays)
3613
+ se.isOverflow(s) ? i = s : i = r.allowEmptyArrays && (s === "" || r.strictNullHandling && s === null) ? [] : se.combine(
3614
+ [],
3615
+ s,
3616
+ r.arrayLimit,
3617
+ r.plainObjects,
3618
+ r.throwOnLimitExceeded
3619
+ );
3620
+ else {
3621
+ i = r.plainObjects ? { __proto__: null } : {};
3622
+ var p = c.charAt(0) === "[" && c.charAt(c.length - 1) === "]" ? c.slice(1, -1) : c, f = r.decodeDotInKeys ? p.replace(/%2E/g, ".") : p, u = parseInt(f, 10), d = !isNaN(u) && c !== f && String(u) === f && u >= 0 && r.parseArrays;
3623
+ if (!r.parseArrays && f === "")
3624
+ i = { 0: s };
3625
+ else if (d && u < r.arrayLimit)
3626
+ i = [], i[u] = s;
3627
+ else {
3628
+ if (d && r.throwOnLimitExceeded)
3629
+ throw new RangeError("Array limit exceeded. Only " + r.arrayLimit + " element" + (r.arrayLimit === 1 ? "" : "s") + " allowed in an array.");
3630
+ d ? (i[u] = s, se.markOverflow(i, u)) : f !== "__proto__" && (i[f] = s);
3631
+ }
3632
+ }
3633
+ s = i;
3634
+ }
3635
+ return s;
3636
+ }, ls = function(e, t) {
3637
+ var r = t.allowDots ? e.replace(/\.([^.[]+)/g, "[$1]") : e;
3638
+ if (t.depth <= 0)
3639
+ return !t.plainObjects && et.call(Object.prototype, r) && !t.allowPrototypes ? void 0 : [r];
3640
+ var n = [], l = r.indexOf("["), a = l >= 0 ? r.slice(0, l) : r;
3641
+ if (a) {
3642
+ if (!t.plainObjects && et.call(Object.prototype, a) && !t.allowPrototypes)
3643
+ return;
3644
+ n[n.length] = a;
3645
+ }
3646
+ for (var s = r.length, o = l, i = 0; o >= 0 && i < t.depth; ) {
3647
+ for (var c = 1, p = o + 1, f = -1; p < s && f < 0; ) {
3648
+ var u = r.charCodeAt(p);
3649
+ u === 91 ? c += 1 : u === 93 && (c -= 1, c === 0 && (f = p)), p += 1;
3650
+ }
3651
+ if (f < 0)
3652
+ return n[n.length] = "[" + r.slice(o) + "]", n;
3653
+ var d = r.slice(o, f + 1), h = d.slice(1, -1);
3654
+ if (!t.plainObjects && et.call(Object.prototype, h) && !t.allowPrototypes)
3655
+ return;
3656
+ n[n.length] = d, i += 1, o = r.indexOf("[", f + 1);
3657
+ }
3658
+ if (o >= 0) {
3659
+ if (t.strictDepth === !0)
3660
+ throw new RangeError("Input depth exceeded depth option of " + t.depth + " and strictDepth is true");
3661
+ n[n.length] = "[" + r.slice(o) + "]";
3662
+ }
3663
+ return n;
3664
+ }, cs = function(e, t, r, n) {
3665
+ if (e) {
3666
+ var l = ls(e, r);
3667
+ if (l)
3668
+ return ss(l, t, r, n);
3669
+ }
3670
+ }, ps = function(e) {
3671
+ if (!e)
3672
+ return q;
3673
+ if (typeof e.allowEmptyArrays < "u" && typeof e.allowEmptyArrays != "boolean")
3674
+ throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
3675
+ if (typeof e.decodeDotInKeys < "u" && typeof e.decodeDotInKeys != "boolean")
3676
+ throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");
3677
+ if (e.decoder !== null && typeof e.decoder < "u" && typeof e.decoder != "function")
3678
+ throw new TypeError("Decoder has to be a function.");
3679
+ if (typeof e.charset < "u" && e.charset !== "utf-8" && e.charset !== "iso-8859-1")
3680
+ throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
3681
+ if (typeof e.throwOnLimitExceeded < "u" && typeof e.throwOnLimitExceeded != "boolean")
3682
+ throw new TypeError("`throwOnLimitExceeded` option must be a boolean");
3683
+ var t = typeof e.charset > "u" ? q.charset : e.charset, r = typeof e.duplicates > "u" ? q.duplicates : e.duplicates;
3684
+ if (r !== "combine" && r !== "first" && r !== "last")
3685
+ throw new TypeError("The duplicates option must be either combine, first, or last");
3686
+ var n = typeof e.allowDots > "u" ? e.decodeDotInKeys === !0 ? !0 : q.allowDots : !!e.allowDots;
3687
+ return {
3688
+ allowDots: n,
3689
+ allowEmptyArrays: typeof e.allowEmptyArrays == "boolean" ? !!e.allowEmptyArrays : q.allowEmptyArrays,
3690
+ allowPrototypes: typeof e.allowPrototypes == "boolean" ? e.allowPrototypes : q.allowPrototypes,
3691
+ allowSparse: typeof e.allowSparse == "boolean" ? e.allowSparse : q.allowSparse,
3692
+ arrayLimit: typeof e.arrayLimit == "number" ? e.arrayLimit : q.arrayLimit,
3693
+ charset: t,
3694
+ charsetSentinel: typeof e.charsetSentinel == "boolean" ? e.charsetSentinel : q.charsetSentinel,
3695
+ comma: typeof e.comma == "boolean" ? e.comma : q.comma,
3696
+ decodeDotInKeys: typeof e.decodeDotInKeys == "boolean" ? e.decodeDotInKeys : q.decodeDotInKeys,
3697
+ decoder: typeof e.decoder == "function" ? e.decoder : q.decoder,
3698
+ delimiter: typeof e.delimiter == "string" || se.isRegExp(e.delimiter) ? e.delimiter : q.delimiter,
3699
+ // eslint-disable-next-line no-implicit-coercion, no-extra-parens
3700
+ depth: typeof e.depth == "number" || e.depth === !1 ? +e.depth : q.depth,
3701
+ duplicates: r,
3702
+ ignoreQueryPrefix: e.ignoreQueryPrefix === !0,
3703
+ interpretNumericEntities: typeof e.interpretNumericEntities == "boolean" ? e.interpretNumericEntities : q.interpretNumericEntities,
3704
+ parameterLimit: typeof e.parameterLimit == "number" ? e.parameterLimit : q.parameterLimit,
3705
+ parseArrays: e.parseArrays !== !1,
3706
+ plainObjects: typeof e.plainObjects == "boolean" ? e.plainObjects : q.plainObjects,
3707
+ strictDepth: typeof e.strictDepth == "boolean" ? !!e.strictDepth : q.strictDepth,
3708
+ strictMerge: typeof e.strictMerge == "boolean" ? !!e.strictMerge : q.strictMerge,
3709
+ strictNullHandling: typeof e.strictNullHandling == "boolean" ? e.strictNullHandling : q.strictNullHandling,
3710
+ throwOnLimitExceeded: typeof e.throwOnLimitExceeded == "boolean" ? e.throwOnLimitExceeded : !1
3711
+ };
3712
+ }, us = function(e, t) {
3713
+ var r = ps(t);
3714
+ if (e === "" || e === null || typeof e > "u")
3715
+ return r.plainObjects ? { __proto__: null } : {};
3716
+ for (var n = typeof e == "string" ? is(e, r) : e, l = r.plainObjects ? { __proto__: null } : {}, a = Object.keys(n), s = 0; s < a.length; ++s) {
3717
+ var o = a[s], i = cs(o, n[o], r, typeof e == "string");
3718
+ l = se.merge(l, i, r);
3719
+ }
3720
+ return r.allowSparse === !0 ? l : se.compact(l);
3721
+ }, fs = rs, ds = us, hs = Zt, tt = {
3722
+ formats: hs,
3723
+ parse: ds,
3724
+ stringify: fs
3725
+ }, ys = To;
3726
+ function ee() {
3727
+ this.protocol = null, this.slashes = null, this.auth = null, this.host = null, this.port = null, this.hostname = null, this.hash = null, this.search = null, this.query = null, this.pathname = null, this.path = null, this.href = null;
3728
+ }
3729
+ var ms = /^([a-z0-9.+-]+:)/i, bs = /:[0-9]*$/, gs = /^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/, js = [
3730
+ "<",
3731
+ ">",
3732
+ '"',
3733
+ "`",
3734
+ " ",
3735
+ "\r",
3736
+ `
3737
+ `,
3738
+ " "
3739
+ ], $s = [
3740
+ "{",
3741
+ "}",
3742
+ "|",
3743
+ "\\",
3744
+ "^",
3745
+ "`"
3746
+ ].concat(js), Wt = ["'"].concat($s), Wr = [
3747
+ "%",
3748
+ "/",
3749
+ "?",
3750
+ ";",
3751
+ "#"
3752
+ ].concat(Wt), Jr = [
3753
+ "/",
3754
+ "?",
3755
+ "#"
3756
+ ], vs = 255, zr = /^[+a-z0-9A-Z_-]{0,63}$/, ws = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, Os = {
3757
+ javascript: !0,
3758
+ "javascript:": !0
3759
+ }, Jt = {
3760
+ javascript: !0,
3761
+ "javascript:": !0
3762
+ }, Ce = {
3763
+ http: !0,
3764
+ https: !0,
3765
+ ftp: !0,
3766
+ gopher: !0,
3767
+ file: !0,
3768
+ "http:": !0,
3769
+ "https:": !0,
3770
+ "ftp:": !0,
3771
+ "gopher:": !0,
3772
+ "file:": !0
3773
+ }, zt = tt;
3774
+ function er(e, t, r) {
3775
+ if (e && typeof e == "object" && e instanceof ee)
3776
+ return e;
3777
+ var n = new ee();
3778
+ return n.parse(e, t, r), n;
3779
+ }
3780
+ ee.prototype.parse = function(e, t, r) {
3781
+ if (typeof e != "string")
3782
+ throw new TypeError("Parameter 'url' must be a string, not " + typeof e);
3783
+ var n = e.indexOf("?"), l = n !== -1 && n < e.indexOf("#") ? "?" : "#", a = e.split(l), s = /\\/g;
3784
+ a[0] = a[0].replace(s, "/"), e = a.join(l);
3785
+ var o = e;
3786
+ if (o = o.trim(), !r && e.split("#").length === 1) {
3787
+ var i = gs.exec(o);
3788
+ if (i)
3789
+ return this.path = o, this.href = o, this.pathname = i[1], i[2] ? (this.search = i[2], t ? this.query = zt.parse(this.search.substr(1)) : this.query = this.search.substr(1)) : t && (this.search = "", this.query = {}), this;
3790
+ }
3791
+ var c = ms.exec(o);
3792
+ if (c) {
3793
+ c = c[0];
3794
+ var p = c.toLowerCase();
3795
+ this.protocol = p, o = o.substr(c.length);
3796
+ }
3797
+ if (r || c || o.match(/^\/\/[^@/]+@[^@/]+/)) {
3798
+ var f = o.substr(0, 2) === "//";
3799
+ f && !(c && Jt[c]) && (o = o.substr(2), this.slashes = !0);
3800
+ }
3801
+ if (!Jt[c] && (f || c && !Ce[c])) {
3802
+ for (var u = -1, d = 0; d < Jr.length; d++) {
3803
+ var h = o.indexOf(Jr[d]);
3804
+ h !== -1 && (u === -1 || h < u) && (u = h);
3805
+ }
3806
+ var m, b;
3807
+ u === -1 ? b = o.lastIndexOf("@") : b = o.lastIndexOf("@", u), b !== -1 && (m = o.slice(0, b), o = o.slice(b + 1), this.auth = decodeURIComponent(m)), u = -1;
3808
+ for (var d = 0; d < Wr.length; d++) {
3809
+ var h = o.indexOf(Wr[d]);
3810
+ h !== -1 && (u === -1 || h < u) && (u = h);
3811
+ }
3812
+ u === -1 && (u = o.length), this.host = o.slice(0, u), o = o.slice(u), this.parseHost(), this.hostname = this.hostname || "";
3813
+ var j = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]";
3814
+ if (!j)
3815
+ for (var y = this.hostname.split(/\./), d = 0, g = y.length; d < g; d++) {
3816
+ var w = y[d];
3817
+ if (w && !w.match(zr)) {
3818
+ for (var O = "", $ = 0, E = w.length; $ < E; $++)
3819
+ w.charCodeAt($) > 127 ? O += "x" : O += w[$];
3820
+ if (!O.match(zr)) {
3821
+ var S = y.slice(0, d), C = y.slice(d + 1), _ = w.match(ws);
3822
+ _ && (S.push(_[1]), C.unshift(_[2])), C.length && (o = "/" + C.join(".") + o), this.hostname = S.join(".");
3823
+ break;
3824
+ }
3825
+ }
3826
+ }
3827
+ this.hostname.length > vs ? this.hostname = "" : this.hostname = this.hostname.toLowerCase(), j || (this.hostname = ys.toASCII(this.hostname));
3828
+ var Q = this.port ? ":" + this.port : "", Y = this.hostname || "";
3829
+ this.host = Y + Q, this.href += this.host, j && (this.hostname = this.hostname.substr(1, this.hostname.length - 2), o[0] !== "/" && (o = "/" + o));
3830
+ }
3831
+ if (!Os[p])
3832
+ for (var d = 0, g = Wt.length; d < g; d++) {
3833
+ var L = Wt[d];
3834
+ if (o.indexOf(L) !== -1) {
3835
+ var J = encodeURIComponent(L);
3836
+ J === L && (J = escape(L)), o = o.split(L).join(J);
3837
+ }
3838
+ }
3839
+ var F = o.indexOf("#");
3840
+ F !== -1 && (this.hash = o.substr(F), o = o.slice(0, F));
3841
+ var K = o.indexOf("?");
3842
+ if (K !== -1 ? (this.search = o.substr(K), this.query = o.substr(K + 1), t && (this.query = zt.parse(this.query)), o = o.slice(0, K)) : t && (this.search = "", this.query = {}), o && (this.pathname = o), Ce[p] && this.hostname && !this.pathname && (this.pathname = "/"), this.pathname || this.search) {
3843
+ var Q = this.pathname || "", ue = this.search || "";
3844
+ this.path = Q + ue;
3845
+ }
3846
+ return this.href = this.format(), this;
3847
+ };
3848
+ function Ss(e) {
3849
+ return typeof e == "string" && (e = er(e)), e instanceof ee ? e.format() : ee.prototype.format.call(e);
3850
+ }
3851
+ ee.prototype.format = function() {
3852
+ var e = this.auth || "";
3853
+ e && (e = encodeURIComponent(e), e = e.replace(/%3A/i, ":"), e += "@");
3854
+ var t = this.protocol || "", r = this.pathname || "", n = this.hash || "", l = !1, a = "";
3855
+ this.host ? l = e + this.host : this.hostname && (l = e + (this.hostname.indexOf(":") === -1 ? this.hostname : "[" + this.hostname + "]"), this.port && (l += ":" + this.port)), this.query && typeof this.query == "object" && Object.keys(this.query).length && (a = zt.stringify(this.query, {
3856
+ arrayFormat: "repeat",
3857
+ addQueryPrefix: !1
3858
+ }));
3859
+ var s = this.search || a && "?" + a || "";
3860
+ return t && t.substr(-1) !== ":" && (t += ":"), this.slashes || (!t || Ce[t]) && l !== !1 ? (l = "//" + (l || ""), r && r.charAt(0) !== "/" && (r = "/" + r)) : l || (l = ""), n && n.charAt(0) !== "#" && (n = "#" + n), s && s.charAt(0) !== "?" && (s = "?" + s), r = r.replace(/[?#]/g, function(o) {
3861
+ return encodeURIComponent(o);
3862
+ }), s = s.replace("#", "%23"), t + l + r + s + n;
3863
+ };
3864
+ ee.prototype.resolve = function(e) {
3865
+ return this.resolveObject(er(e, !1, !0)).format();
3866
+ };
3867
+ ee.prototype.resolveObject = function(e) {
3868
+ if (typeof e == "string") {
3869
+ var t = new ee();
3870
+ t.parse(e, !1, !0), e = t;
3871
+ }
3872
+ for (var r = new ee(), n = Object.keys(this), l = 0; l < n.length; l++) {
3873
+ var a = n[l];
3874
+ r[a] = this[a];
3875
+ }
3876
+ if (r.hash = e.hash, e.href === "")
3877
+ return r.href = r.format(), r;
3878
+ if (e.slashes && !e.protocol) {
3879
+ for (var s = Object.keys(e), o = 0; o < s.length; o++) {
3880
+ var i = s[o];
3881
+ i !== "protocol" && (r[i] = e[i]);
3882
+ }
3883
+ return Ce[r.protocol] && r.hostname && !r.pathname && (r.pathname = "/", r.path = r.pathname), r.href = r.format(), r;
3884
+ }
3885
+ if (e.protocol && e.protocol !== r.protocol) {
3886
+ if (!Ce[e.protocol]) {
3887
+ for (var c = Object.keys(e), p = 0; p < c.length; p++) {
3888
+ var f = c[p];
3889
+ r[f] = e[f];
3890
+ }
3891
+ return r.href = r.format(), r;
3892
+ }
3893
+ if (r.protocol = e.protocol, !e.host && !Jt[e.protocol]) {
3894
+ for (var g = (e.pathname || "").split("/"); g.length && !(e.host = g.shift()); )
3895
+ ;
3896
+ e.host || (e.host = ""), e.hostname || (e.hostname = ""), g[0] !== "" && g.unshift(""), g.length < 2 && g.unshift(""), r.pathname = g.join("/");
3897
+ } else
3898
+ r.pathname = e.pathname;
3899
+ if (r.search = e.search, r.query = e.query, r.host = e.host || "", r.auth = e.auth, r.hostname = e.hostname || e.host, r.port = e.port, r.pathname || r.search) {
3900
+ var u = r.pathname || "", d = r.search || "";
3901
+ r.path = u + d;
3902
+ }
3903
+ return r.slashes = r.slashes || e.slashes, r.href = r.format(), r;
3904
+ }
3905
+ var h = r.pathname && r.pathname.charAt(0) === "/", m = e.host || e.pathname && e.pathname.charAt(0) === "/", b = m || h || r.host && e.pathname, j = b, y = r.pathname && r.pathname.split("/") || [], g = e.pathname && e.pathname.split("/") || [], w = r.protocol && !Ce[r.protocol];
3906
+ if (w && (r.hostname = "", r.port = null, r.host && (y[0] === "" ? y[0] = r.host : y.unshift(r.host)), r.host = "", e.protocol && (e.hostname = null, e.port = null, e.host && (g[0] === "" ? g[0] = e.host : g.unshift(e.host)), e.host = null), b = b && (g[0] === "" || y[0] === "")), m)
3907
+ r.host = e.host || e.host === "" ? e.host : r.host, r.hostname = e.hostname || e.hostname === "" ? e.hostname : r.hostname, r.search = e.search, r.query = e.query, y = g;
3908
+ else if (g.length)
3909
+ y || (y = []), y.pop(), y = y.concat(g), r.search = e.search, r.query = e.query;
3910
+ else if (e.search != null) {
3911
+ if (w) {
3912
+ r.host = y.shift(), r.hostname = r.host;
3913
+ var O = r.host && r.host.indexOf("@") > 0 ? r.host.split("@") : !1;
3914
+ O && (r.auth = O.shift(), r.hostname = O.shift(), r.host = r.hostname);
3915
+ }
3916
+ return r.search = e.search, r.query = e.query, (r.pathname !== null || r.search !== null) && (r.path = (r.pathname ? r.pathname : "") + (r.search ? r.search : "")), r.href = r.format(), r;
3917
+ }
3918
+ if (!y.length)
3919
+ return r.pathname = null, r.search ? r.path = "/" + r.search : r.path = null, r.href = r.format(), r;
3920
+ for (var $ = y.slice(-1)[0], E = (r.host || e.host || y.length > 1) && ($ === "." || $ === "..") || $ === "", S = 0, C = y.length; C >= 0; C--)
3921
+ $ = y[C], $ === "." ? y.splice(C, 1) : $ === ".." ? (y.splice(C, 1), S++) : S && (y.splice(C, 1), S--);
3922
+ if (!b && !j)
3923
+ for (; S--; S)
3924
+ y.unshift("..");
3925
+ b && y[0] !== "" && (!y[0] || y[0].charAt(0) !== "/") && y.unshift(""), E && y.join("/").substr(-1) !== "/" && y.push("");
3926
+ var _ = y[0] === "" || y[0] && y[0].charAt(0) === "/";
3927
+ if (w) {
3928
+ r.hostname = _ ? "" : y.length ? y.shift() : "", r.host = r.hostname;
3929
+ var O = r.host && r.host.indexOf("@") > 0 ? r.host.split("@") : !1;
3930
+ O && (r.auth = O.shift(), r.hostname = O.shift(), r.host = r.hostname);
3931
+ }
3932
+ return b = b || r.host && y.length, b && !_ && y.unshift(""), y.length > 0 ? r.pathname = y.join("/") : (r.pathname = null, r.path = null), (r.pathname !== null || r.search !== null) && (r.path = (r.pathname ? r.pathname : "") + (r.search ? r.search : "")), r.auth = e.auth || r.auth, r.slashes = r.slashes || e.slashes, r.href = r.format(), r;
3933
+ };
3934
+ ee.prototype.parseHost = function() {
3935
+ var e = this.host, t = bs.exec(e);
3936
+ t && (t = t[0], t !== ":" && (this.port = t.substr(1)), e = e.substr(0, e.length - t.length)), e && (this.hostname = e);
3937
+ };
3938
+ var Ts = er, Kr = Ss;
3939
+ const ks = () => Object.keys(xe).map((e) => ({
3940
+ ...xe[e].info,
3941
+ clients: Object.keys(xe[e].clientsById).map((t) => xe[e].clientsById[t].info)
3942
+ })), xs = (e) => typeof e == "object" && "log" in e && typeof e.log == "object" && "entries" in e.log && Array.isArray(e.log.entries);
3943
+ var Es = class {
3944
+ constructor(e, t = {}) {
3945
+ this.initCalled = !1, this.entries = [], this.requests = [], this.options = {}, this.options = {
3946
+ harIsAlreadyEncoded: !1,
3947
+ ...t
3948
+ }, this.requests = [], xs(e) ? this.entries = e.log.entries : this.entries = [{ request: e }];
3949
+ }
3950
+ init() {
3951
+ return this.initCalled = !0, this.requests = this.entries.map(({ request: e }) => {
3952
+ var t;
3953
+ const r = {
3954
+ bodySize: 0,
3955
+ headersSize: 0,
3956
+ headers: [],
3957
+ cookies: [],
3958
+ httpVersion: "HTTP/1.1",
3959
+ queryString: [],
3960
+ postData: { mimeType: ((t = e.postData) == null ? void 0 : t.mimeType) || "application/octet-stream" },
3961
+ ...e
3962
+ };
3963
+ return r.postData && !r.postData.mimeType && (r.postData.mimeType = "application/octet-stream"), this.prepare(r, this.options);
3964
+ }), this;
3965
+ }
3966
+ prepare(e, t) {
3967
+ var r, n, l;
3968
+ const a = {
3969
+ ...e,
3970
+ fullUrl: "",
3971
+ uriObj: {},
3972
+ queryObj: {},
3973
+ headersObj: {},
3974
+ cookiesObj: {},
3975
+ allHeaders: {}
3976
+ };
3977
+ if (a != null && a.queryString.length && (a.queryObj = a.queryString.reduce(dr, {})), a != null && a.headers.length) {
3978
+ const d = /^HTTP\/2/;
3979
+ a.headersObj = a.headers.reduce((h, { name: m, value: b }) => {
3980
+ const j = d.exec(a.httpVersion) ? m.toLocaleLowerCase() : m;
3981
+ return {
3982
+ ...h,
3983
+ [j]: b
3984
+ };
3985
+ }, {});
3986
+ }
3987
+ a != null && a.cookies.length && (a.cookiesObj = a.cookies.reduceRight((d, { name: h, value: m }) => ({
3988
+ ...d,
3989
+ [h]: m
3990
+ }), {}));
3991
+ const s = (r = a.cookies) == null ? void 0 : r.map(({ name: d, value: h }) => t.harIsAlreadyEncoded ? `${d}=${h}` : `${encodeURIComponent(d)}=${encodeURIComponent(h)}`);
3992
+ switch (s != null && s.length && (a.allHeaders.cookie = s.join("; ")), a.postData.mimeType) {
3993
+ case "multipart/mixed":
3994
+ case "multipart/related":
3995
+ case "multipart/form-data":
3996
+ case "multipart/alternative":
3997
+ if (a.postData.text = "", a.postData.mimeType = "multipart/form-data", (n = a.postData) != null && n.params) {
3998
+ const d = "---011000010111000001101001", h = `${d}--`, m = `\r
3999
+ `;
4000
+ /*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
4001
+ const b = (w) => w.replace(/\n/g, "%0A").replace(/\r/g, "%0D").replace(/"/g, "%22"), j = (w) => w.replace(/\r?\n|\r/g, `\r
4002
+ `), y = [`--${d}`];
4003
+ (l = a.postData) == null || l.params.forEach((w, O) => {
4004
+ const $ = w.name, E = w.value || "", S = w.fileName || null, C = w.contentType || "application/octet-stream";
4005
+ S ? (y.push(`Content-Disposition: form-data; name="${b(j($))}"; filename="${S}"`), y.push(`Content-Type: ${C}`)) : y.push(`Content-Disposition: form-data; name="${escape(j($))}"`), y.push(""), y.push(j(E)), O !== a.postData.params.length - 1 && y.push(`--${d}`);
4006
+ }), y.push(`--${h}`), a.postData.boundary = d, a.postData.text = y.join(m);
4007
+ const g = W(a.headersObj, "content-type") || "content-type";
4008
+ a.headersObj[g] = `multipart/form-data; boundary=${d}`;
4009
+ }
4010
+ break;
4011
+ case "application/x-www-form-urlencoded":
4012
+ a.postData.params ? (a.postData.paramsObj = a.postData.params.reduce(dr, {}), a.postData.text = tt.stringify(a.postData.paramsObj)) : a.postData.text = "";
4013
+ break;
4014
+ case "text/json":
4015
+ case "text/x-json":
4016
+ case "application/json":
4017
+ case "application/x-json":
4018
+ if (a.postData.mimeType = "application/json", a.postData.text) try {
4019
+ a.postData.jsonObj = JSON.parse(a.postData.text);
4020
+ } catch {
4021
+ a.postData.mimeType = "text/plain";
4022
+ }
4023
+ break;
4024
+ }
4025
+ const o = {
4026
+ ...a.allHeaders,
4027
+ ...a.headersObj
4028
+ }, i = Ts(a.url, !0, !0);
4029
+ a.queryObj = {
4030
+ ...a.queryObj,
4031
+ ...i.query
4032
+ };
4033
+ let c;
4034
+ t.harIsAlreadyEncoded ? c = tt.stringify(a.queryObj, {
4035
+ encode: !1,
4036
+ indices: !1
4037
+ }) : c = tt.stringify(a.queryObj, { indices: !1 });
4038
+ const p = {
4039
+ ...i,
4040
+ query: a.queryObj,
4041
+ search: c,
4042
+ path: c ? `${i.pathname}?${c}` : i.pathname
4043
+ }, f = Kr({
4044
+ ...i,
4045
+ query: null,
4046
+ search: null
4047
+ }), u = Kr({
4048
+ ...i,
4049
+ ...p
4050
+ });
4051
+ return {
4052
+ ...a,
4053
+ allHeaders: o,
4054
+ fullUrl: u,
4055
+ url: f,
4056
+ uriObj: p
4057
+ };
4058
+ }
4059
+ convert(e, t, r) {
4060
+ this.initCalled || this.init(), !r && t && (r = { clientId: t });
4061
+ const n = xe[e];
4062
+ if (!n) return [!1];
4063
+ const { convert: l } = n.clientsById[t || n.info.default];
4064
+ return this.requests.map((a) => l(a, r));
4065
+ }
4066
+ installation(e, t, r) {
4067
+ this.initCalled || this.init(), !r && t && (r = { clientId: t });
4068
+ const n = xe[e];
4069
+ if (!n) return [!1];
4070
+ const { info: l } = n.clientsById[t || n.info.default];
4071
+ return this.requests.map((a) => l != null && l.installation ? l.installation(a, r) : !1);
4072
+ }
4073
+ };
4074
+ const xn = "agent", En = "prompt";
4075
+ function Ps() {
4076
+ return ks();
4077
+ }
4078
+ function Cs(e) {
4079
+ var t;
4080
+ const r = e == null ? void 0 : e[0];
4081
+ if (!r) return "http://localhost";
4082
+ let n = r.url;
4083
+ for (const [l, a] of Object.entries(r.variables ?? {})) {
4084
+ const s = a.default ?? ((t = a.enum) == null ? void 0 : t[0]) ?? `{${l}}`;
4085
+ n = n.replace(new RegExp(`\\{${l}\\}`, "g"), String(s));
4086
+ }
4087
+ return n;
4088
+ }
4089
+ function As(e) {
4090
+ if (e.example !== void 0 || e.examples && Object.keys(e.examples).length > 0) return !0;
4091
+ const t = e.schema;
4092
+ return !!((t == null ? void 0 : t.example) !== void 0 || t != null && t.enum && t.enum.length > 0);
4093
+ }
4094
+ function Pn(e) {
4095
+ if (e.example !== void 0) return String(e.example);
4096
+ if (e.examples) {
4097
+ for (const r of Object.values(e.examples))
4098
+ if (r && typeof r == "object" && "value" in r && r.value !== void 0)
4099
+ return String(r.value);
4100
+ }
4101
+ const t = e.schema;
4102
+ return (t == null ? void 0 : t.example) !== void 0 ? String(t.example) : t != null && t.enum && t.enum.length > 0 ? String(t.enum[0]) : `{${e.name}}`;
4103
+ }
4104
+ function Rs(e, t, r) {
4105
+ const n = t.replace(/\{([^}]+)\}/g, (l, a) => {
4106
+ const s = r.find((i) => i.in === "path" && i.name === a);
4107
+ if (!s) return l;
4108
+ const o = Pn(s);
4109
+ return o === `{${a}}` ? o : encodeURIComponent(o);
4110
+ });
4111
+ return `${e.replace(/\/$/, "")}${n}`;
4112
+ }
4113
+ function qs(e, t) {
4114
+ var r;
4115
+ const n = e[0];
4116
+ if (!n || !t) return [];
4117
+ const l = [];
4118
+ for (const a of Object.keys(n)) {
4119
+ const s = t[a];
4120
+ if (s)
4121
+ if (s.type === "apiKey") {
4122
+ const o = s.in === "query" || s.in === "cookie" ? s.in : "header";
4123
+ l.push({ location: o, name: s.name, value: "YOUR_API_KEY" });
4124
+ } else if (s.type === "http") {
4125
+ const o = ((r = s.scheme) == null ? void 0 : r.toLowerCase()) === "basic";
4126
+ l.push({
4127
+ location: "header",
4128
+ name: "Authorization",
4129
+ value: o ? "Basic BASE64_ENCODED_CREDENTIALS" : "Bearer YOUR_ACCESS_TOKEN"
4130
+ });
4131
+ } else (s.type === "oauth2" || s.type === "openIdConnect") && l.push({ location: "header", name: "Authorization", value: "Bearer YOUR_ACCESS_TOKEN" });
4132
+ }
4133
+ return l;
4134
+ }
4135
+ function Ns(e) {
4136
+ const t = e == null ? void 0 : e.content;
4137
+ if (!t) return null;
4138
+ const r = "application/json" in t ? "application/json" : Object.keys(t)[0];
4139
+ if (!r) return null;
4140
+ const n = t[r];
4141
+ let l = n.example;
4142
+ if (l === void 0 && n.examples) {
4143
+ for (const a of Object.values(n.examples))
4144
+ if (a && typeof a == "object" && "value" in a && a.value !== void 0) {
4145
+ l = a.value;
4146
+ break;
4147
+ }
4148
+ }
4149
+ return { contentType: r, schema: n.schema, authorExample: l };
4150
+ }
4151
+ function Ls(e) {
4152
+ const t = Cs(e.servers), r = Rs(t, e.path, e.parameters), n = qs(e.security, e.securitySchemes), l = [], a = [], s = [];
4153
+ for (const i of n)
4154
+ (i.location === "header" ? l : i.location === "query" ? a : s).push({ name: i.name, value: i.value });
4155
+ for (const i of e.parameters)
4156
+ i.in === "query" && (i.required || As(i)) && a.push({ name: i.name, value: Pn(i) });
4157
+ const o = {
4158
+ method: e.method.toUpperCase(),
4159
+ url: r,
4160
+ httpVersion: "HTTP/1.1",
4161
+ headers: l,
4162
+ queryString: a,
4163
+ cookies: s
4164
+ };
4165
+ return e.media && e.resolvedBodyValue !== void 0 && (l.push({ name: "Content-Type", value: e.media.contentType }), o.postData = { mimeType: e.media.contentType, text: JSON.stringify(e.resolvedBodyValue, null, 2) }), o;
4166
+ }
4167
+ function Us(e, t, r) {
4168
+ try {
4169
+ const n = new Es(e), [l] = n.convert(t, r);
4170
+ return typeof l == "string" ? l : "";
4171
+ } catch {
4172
+ return "";
4173
+ }
4174
+ }
4175
+ const Ds = `${xn}:${En}`;
4176
+ function Hs({ method: e, path: t, parameters: r, requestBody: n, security: l, id: a }) {
4177
+ var s;
4178
+ const { document: o, deref: i, showCodeSamples: c } = Cn(), p = o, f = re.useId(), u = re.useMemo(() => Ps(), []), [d, h] = re.useState(Ds), [m, b] = d.split(":"), j = Nn(m), y = re.useMemo(() => Ns(n), [n]), [g, w] = re.useState(void 0);
4179
+ re.useEffect(() => {
4180
+ if (w(void 0), !y || y.authorExample !== void 0 || !y.schema) return;
4181
+ let S = !1;
4182
+ return Dn(y.schema).then((C) => {
4183
+ S || w(C);
4184
+ }), () => {
4185
+ S = !0;
4186
+ };
4187
+ }, [y]);
4188
+ const [, O] = re.useState(() => tr(j));
4189
+ re.useEffect(() => {
4190
+ O(tr(j));
4191
+ let S = !1;
4192
+ return An(j).then(() => {
4193
+ S || O(!0);
4194
+ }), () => {
4195
+ S = !0;
4196
+ };
4197
+ }, [j]);
4198
+ const $ = re.useMemo(
4199
+ () => {
4200
+ var S;
4201
+ return Ls({
4202
+ method: e,
4203
+ path: t,
4204
+ servers: p.servers,
4205
+ parameters: r,
4206
+ security: l,
4207
+ securitySchemes: (S = p.components) == null ? void 0 : S.securitySchemes,
4208
+ media: y,
4209
+ resolvedBodyValue: (y == null ? void 0 : y.authorExample) ?? g
4210
+ });
4211
+ },
4212
+ [e, t, p.servers, r, l, (s = p.components) == null ? void 0 : s.securitySchemes, y, g]
4213
+ ), E = re.useMemo(() => m === xn && b === En ? Rn(p, e, t, i) : Us($, m, b), [$, m, b, p, e, t, i]);
4214
+ return c ? /* @__PURE__ */ me.jsxs("div", { id: `endpoint-${a}-code-samples`, children: [
4215
+ /* @__PURE__ */ me.jsxs("div", { className: "flex items-center justify-between mb-2", children: [
4216
+ /* @__PURE__ */ me.jsx("label", { htmlFor: f, className: "text-xs font-medium text-foreground-muted uppercase tracking-wider", children: "Example Request" }),
4217
+ /* @__PURE__ */ me.jsx(
4218
+ "select",
4219
+ {
4220
+ id: f,
4221
+ value: d,
4222
+ onChange: (S) => h(S.target.value),
4223
+ "aria-label": "Code sample language",
4224
+ className: "text-xs font-medium rounded-md border border-border bg-surface px-2 py-1 text-foreground-secondary focus:border-secondary-500 focus:ring-secondary-500",
4225
+ children: u.map((S) => /* @__PURE__ */ me.jsx("optgroup", { label: S.title, children: S.clients.map((C) => /* @__PURE__ */ me.jsx("option", { value: `${S.key}:${C.key}`, children: C.title }, C.key)) }, S.key))
4226
+ }
4227
+ )
4228
+ ] }),
4229
+ /* @__PURE__ */ me.jsx(qn, { code: E, language: j })
4230
+ ] }) : null;
4231
+ }
4232
+ export {
4233
+ Hs as CodeSamples
4234
+ };