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