@shipengine/js-api 0.40.0 → 1.0.0-next.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/account-settings/api.d.ts +2 -14
- package/account-settings/types.d.ts +2 -6
- package/addresses/api.d.ts +0 -11
- package/carriers/api.d.ts +2 -74
- package/carriers/types.d.ts +3 -22
- package/client.d.ts +1 -129
- package/custom-packages/api.d.ts +0 -6
- package/dimensions/types.d.ts +0 -5
- package/errors/types.d.ts +2 -2
- package/index.d.ts +0 -5
- package/index.js +16 -4074
- package/index.mjs +2829 -3936
- package/insurance/api.d.ts +0 -7
- package/labels/api.d.ts +0 -51
- package/order-sources/api.d.ts +0 -13
- package/package.json +2 -5
- package/rates/api.d.ts +0 -26
- package/resources/types.d.ts +0 -34
- package/sales-order-shipments/api.d.ts +5 -90
- package/sales-orders/api.d.ts +0 -25
- package/shipments/index.d.ts +0 -1
- package/shipments/types.d.ts +0 -13
- package/types.d.ts +0 -8
- package/warehouses/api.d.ts +0 -19
- package/account-billing-plan/api.d.ts +0 -13
- package/account-billing-plan/index.d.ts +0 -2
- package/account-billing-plan/types.d.ts +0 -30
- package/funding-sources/api.d.ts +0 -50
- package/funding-sources/index.d.ts +0 -2
- package/funding-sources/types.d.ts +0 -135
- package/rate-cards/api.d.ts +0 -44
- package/rate-cards/index.d.ts +0 -2
- package/rate-cards/types.d.ts +0 -88
- package/shipments/api.d.ts +0 -72
- package/shipping-rules/api.d.ts +0 -20
- package/shipping-rules/index.d.ts +0 -2
- package/shipping-rules/types.d.ts +0 -50
- package/utilities/index.d.ts +0 -1
- package/utilities/ip-address.d.ts +0 -1
- package/weight-band/index.d.ts +0 -1
- package/weight-band/types.d.ts +0 -17
- package/zones/index.d.ts +0 -1
- package/zones/types.d.ts +0 -7
package/index.js
CHANGED
|
@@ -1,4074 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
})(
|
|
12
|
-
|
|
13
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var __objRest$1 = (source, exclude) => {
|
|
17
|
-
var target = {};
|
|
18
|
-
for (var prop in source)
|
|
19
|
-
if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
20
|
-
target[prop] = source[prop];
|
|
21
|
-
if (source != null && __getOwnPropSymbols$3)
|
|
22
|
-
for (var prop of __getOwnPropSymbols$3(source)) {
|
|
23
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
}
|
|
26
|
-
return target;
|
|
27
|
-
};
|
|
28
|
-
class CodedError {
|
|
29
|
-
constructor(message, options) {
|
|
30
|
-
var _a, _b, _c;
|
|
31
|
-
this.errorCode = (_a = options == null ? void 0 : options.errorCode) != null ? _a : "unknown";
|
|
32
|
-
this.errorSource = (_b = options == null ? void 0 : options.errorSource) != null ? _b : "client";
|
|
33
|
-
this.errorType = (_c = options == null ? void 0 : options.errorType) != null ? _c : "unknown";
|
|
34
|
-
this.message = message;
|
|
35
|
-
}
|
|
36
|
-
static fromObject(_a) {
|
|
37
|
-
var _b = _a, { message } = _b, options = __objRest$1(_b, ["message"]);
|
|
38
|
-
return new CodedError(message, options);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
var MetadataCapability = /* @__PURE__ */ ((MetadataCapability2) => {
|
|
43
|
-
MetadataCapability2["AutoFunding"] = "auto_funding";
|
|
44
|
-
MetadataCapability2["UpdatePaymentMethod"] = "update_payment_method";
|
|
45
|
-
MetadataCapability2["DefaultPurchaseAmount"] = "default_purchase_amount";
|
|
46
|
-
MetadataCapability2["ReportsLink"] = "reports_link";
|
|
47
|
-
MetadataCapability2["BalanceHistory"] = "balance_history";
|
|
48
|
-
MetadataCapability2["Nickname"] = "nickname";
|
|
49
|
-
MetadataCapability2["RefreshServices"] = "refresh_services";
|
|
50
|
-
MetadataCapability2["UpdatePassword"] = "update_password";
|
|
51
|
-
MetadataCapability2["AccountSettingsLink"] = "account_settings_link";
|
|
52
|
-
MetadataCapability2["Unknown"] = "unknown";
|
|
53
|
-
return MetadataCapability2;
|
|
54
|
-
})(MetadataCapability || {});
|
|
55
|
-
var MetadataRequirement = /* @__PURE__ */ ((MetadataRequirement2) => {
|
|
56
|
-
MetadataRequirement2["BillingAddress"] = "billing_address";
|
|
57
|
-
MetadataRequirement2["CurrencyCode"] = "currency_code";
|
|
58
|
-
MetadataRequirement2["IovationBlackBox"] = "iovation_black_box";
|
|
59
|
-
MetadataRequirement2["Nickname"] = "nickname";
|
|
60
|
-
MetadataRequirement2["PaymentMethod"] = "payment_method";
|
|
61
|
-
MetadataRequirement2["PickupAddress"] = "pickup_address";
|
|
62
|
-
MetadataRequirement2["Unknown"] = "unknown";
|
|
63
|
-
return MetadataRequirement2;
|
|
64
|
-
})(MetadataRequirement || {});
|
|
65
|
-
var MetadataSatisfyingFormTypes = /* @__PURE__ */ ((MetadataSatisfyingFormTypes2) => {
|
|
66
|
-
MetadataSatisfyingFormTypes2["Address"] = "address";
|
|
67
|
-
MetadataSatisfyingFormTypes2["CreditCard"] = "credit_card";
|
|
68
|
-
MetadataSatisfyingFormTypes2["StampsAccountCredentials"] = "stamps_account_credentials";
|
|
69
|
-
MetadataSatisfyingFormTypes2["StampSellerLabelProvider"] = "stamps_seller_label_provider";
|
|
70
|
-
MetadataSatisfyingFormTypes2["Unknown"] = "unknown";
|
|
71
|
-
return MetadataSatisfyingFormTypes2;
|
|
72
|
-
})(MetadataSatisfyingFormTypes || {});
|
|
73
|
-
|
|
74
|
-
var CreditCardVendor = /* @__PURE__ */ ((CreditCardVendor2) => {
|
|
75
|
-
CreditCardVendor2["AMERICAN_EXPRESS"] = "americanexpress";
|
|
76
|
-
CreditCardVendor2["DISCOVER"] = "discover";
|
|
77
|
-
CreditCardVendor2["MASTERCARD"] = "mastercard";
|
|
78
|
-
CreditCardVendor2["VISA"] = "visa";
|
|
79
|
-
return CreditCardVendor2;
|
|
80
|
-
})(CreditCardVendor || {});
|
|
81
|
-
var Currency = /* @__PURE__ */ ((Currency2) => {
|
|
82
|
-
Currency2["USD"] = "usd";
|
|
83
|
-
Currency2["CAD"] = "cad";
|
|
84
|
-
Currency2["AUD"] = "aud";
|
|
85
|
-
Currency2["GBP"] = "gbp";
|
|
86
|
-
Currency2["EUR"] = "eur";
|
|
87
|
-
Currency2["NZD"] = "nzd";
|
|
88
|
-
return Currency2;
|
|
89
|
-
})(Currency || {});
|
|
90
|
-
|
|
91
|
-
var RateCardStatus = /* @__PURE__ */ ((RateCardStatus2) => {
|
|
92
|
-
RateCardStatus2["DRAFT"] = "Draft";
|
|
93
|
-
RateCardStatus2["DELETED"] = "Deleted";
|
|
94
|
-
RateCardStatus2["PUBLISHED"] = "Published";
|
|
95
|
-
return RateCardStatus2;
|
|
96
|
-
})(RateCardStatus || {});
|
|
97
|
-
|
|
98
|
-
var ConfirmationType = /* @__PURE__ */ ((ConfirmationType2) => {
|
|
99
|
-
ConfirmationType2["DELIVERY"] = "delivery";
|
|
100
|
-
ConfirmationType2["SIGNATURE"] = "signature";
|
|
101
|
-
ConfirmationType2["ADULT_SIGNATURE"] = "adult_signature";
|
|
102
|
-
ConfirmationType2["DIRECT_SIGNATURE"] = "direct_signature";
|
|
103
|
-
ConfirmationType2["VERBAL_CONFIRMATION"] = "verbal_confirmation";
|
|
104
|
-
ConfirmationType2["DELIVERY_MAILED"] = "delivery_mailed";
|
|
105
|
-
ConfirmationType2["NONE"] = "none";
|
|
106
|
-
return ConfirmationType2;
|
|
107
|
-
})(ConfirmationType || {});
|
|
108
|
-
var CustomsContentsType = /* @__PURE__ */ ((CustomsContentsType2) => {
|
|
109
|
-
CustomsContentsType2["DOCUMENTS"] = "documents";
|
|
110
|
-
CustomsContentsType2["GIFT"] = "gift";
|
|
111
|
-
CustomsContentsType2["MERCHANDISE"] = "merchandise";
|
|
112
|
-
CustomsContentsType2["RETURNED_GOODS"] = "returned_goods";
|
|
113
|
-
CustomsContentsType2["SAMPLE"] = "sample";
|
|
114
|
-
return CustomsContentsType2;
|
|
115
|
-
})(CustomsContentsType || {});
|
|
116
|
-
var CustomsNonDeliveryType = /* @__PURE__ */ ((CustomsNonDeliveryType2) => {
|
|
117
|
-
CustomsNonDeliveryType2["RETURN_TO_SENDER"] = "return_to_sender";
|
|
118
|
-
CustomsNonDeliveryType2["TREAT_AS_ABANDONED"] = "treat_as_abandoned";
|
|
119
|
-
return CustomsNonDeliveryType2;
|
|
120
|
-
})(CustomsNonDeliveryType || {});
|
|
121
|
-
var InsuranceProviderType = /* @__PURE__ */ ((InsuranceProviderType2) => {
|
|
122
|
-
InsuranceProviderType2["SHIPSURANCE"] = "shipsurance";
|
|
123
|
-
InsuranceProviderType2["CARRIER"] = "carrier";
|
|
124
|
-
InsuranceProviderType2["THIRD_PARTY"] = "third_party";
|
|
125
|
-
InsuranceProviderType2["NONE"] = "none";
|
|
126
|
-
return InsuranceProviderType2;
|
|
127
|
-
})(InsuranceProviderType || {});
|
|
128
|
-
|
|
129
|
-
const types = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
130
|
-
__proto__: null,
|
|
131
|
-
AccountBillingPlanChangeType,
|
|
132
|
-
CodedError,
|
|
133
|
-
ConfirmationType,
|
|
134
|
-
CreditCardVendor,
|
|
135
|
-
Currency,
|
|
136
|
-
CustomsContentsType,
|
|
137
|
-
CustomsNonDeliveryType,
|
|
138
|
-
InsuranceProviderType,
|
|
139
|
-
MetadataCapability,
|
|
140
|
-
MetadataRequirement,
|
|
141
|
-
MetadataSatisfyingFormTypes,
|
|
142
|
-
RateCardStatus
|
|
143
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
144
|
-
|
|
145
|
-
class AccountSettingsAPI {
|
|
146
|
-
constructor(client) {
|
|
147
|
-
this.client = client;
|
|
148
|
-
/**
|
|
149
|
-
* The `get` method retrieves the account settings for a given user.
|
|
150
|
-
*/
|
|
151
|
-
this.get = () => {
|
|
152
|
-
return this.client.get("/v1/account/settings");
|
|
153
|
-
};
|
|
154
|
-
/**
|
|
155
|
-
* The `update` method updates specific account settings for a given user.
|
|
156
|
-
*
|
|
157
|
-
* @params Partial<AccountSettings> The account settings to update.
|
|
158
|
-
*/
|
|
159
|
-
this.update = (settings) => {
|
|
160
|
-
return this.client.put("/v1/account/settings", settings);
|
|
161
|
-
};
|
|
162
|
-
this.client = client;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
class AddressesAPI {
|
|
167
|
-
constructor(client) {
|
|
168
|
-
this.client = client;
|
|
169
|
-
/**
|
|
170
|
-
* The `validate` method validates a list of addresses.
|
|
171
|
-
*
|
|
172
|
-
* @params Address[] The addresses to be validated.
|
|
173
|
-
*/
|
|
174
|
-
this.validate = (addresses) => {
|
|
175
|
-
return this.client.post("/v1/addresses/validate", addresses);
|
|
176
|
-
};
|
|
177
|
-
/**
|
|
178
|
-
* The `parse` method parses a string of text to extract addresses.
|
|
179
|
-
*/
|
|
180
|
-
this.parse = (text, address) => {
|
|
181
|
-
return this.client.put("/v1/addresses/recognize", {
|
|
182
|
-
address,
|
|
183
|
-
text
|
|
184
|
-
});
|
|
185
|
-
};
|
|
186
|
-
this.client = client;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
const isCodedErrors = (errs) => Array.isArray(errs) && errs.every((err) => isCodedError(err));
|
|
191
|
-
const isCodedError = (err) => !!err.errorCode;
|
|
192
|
-
|
|
193
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
194
|
-
|
|
195
|
-
function getAugmentedNamespace(n) {
|
|
196
|
-
if (n.__esModule) return n;
|
|
197
|
-
var f = n.default;
|
|
198
|
-
if (typeof f == "function") {
|
|
199
|
-
var a = function a () {
|
|
200
|
-
if (this instanceof a) {
|
|
201
|
-
var args = [null];
|
|
202
|
-
args.push.apply(args, arguments);
|
|
203
|
-
var Ctor = Function.bind.apply(f, args);
|
|
204
|
-
return new Ctor();
|
|
205
|
-
}
|
|
206
|
-
return f.apply(this, arguments);
|
|
207
|
-
};
|
|
208
|
-
a.prototype = f.prototype;
|
|
209
|
-
} else a = {};
|
|
210
|
-
Object.defineProperty(a, '__esModule', {value: true});
|
|
211
|
-
Object.keys(n).forEach(function (k) {
|
|
212
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
213
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
214
|
-
enumerable: true,
|
|
215
|
-
get: function () {
|
|
216
|
-
return n[k];
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
return a;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
var ipaddrExports = {};
|
|
224
|
-
var ipaddr = {
|
|
225
|
-
get exports(){ return ipaddrExports; },
|
|
226
|
-
set exports(v){ ipaddrExports = v; },
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
(function (module) {
|
|
230
|
-
(function() {
|
|
231
|
-
var expandIPv6, ipaddr, ipv4Part, ipv4Regexes, ipv6Part, ipv6Regexes, matchCIDR, root, zoneIndex;
|
|
232
|
-
|
|
233
|
-
ipaddr = {};
|
|
234
|
-
|
|
235
|
-
root = this;
|
|
236
|
-
|
|
237
|
-
if ((module !== null) && module.exports) {
|
|
238
|
-
module.exports = ipaddr;
|
|
239
|
-
} else {
|
|
240
|
-
root['ipaddr'] = ipaddr;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
matchCIDR = function(first, second, partSize, cidrBits) {
|
|
244
|
-
var part, shift;
|
|
245
|
-
if (first.length !== second.length) {
|
|
246
|
-
throw new Error("ipaddr: cannot match CIDR for objects with different lengths");
|
|
247
|
-
}
|
|
248
|
-
part = 0;
|
|
249
|
-
while (cidrBits > 0) {
|
|
250
|
-
shift = partSize - cidrBits;
|
|
251
|
-
if (shift < 0) {
|
|
252
|
-
shift = 0;
|
|
253
|
-
}
|
|
254
|
-
if (first[part] >> shift !== second[part] >> shift) {
|
|
255
|
-
return false;
|
|
256
|
-
}
|
|
257
|
-
cidrBits -= partSize;
|
|
258
|
-
part += 1;
|
|
259
|
-
}
|
|
260
|
-
return true;
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
ipaddr.subnetMatch = function(address, rangeList, defaultName) {
|
|
264
|
-
var k, len, rangeName, rangeSubnets, subnet;
|
|
265
|
-
if (defaultName == null) {
|
|
266
|
-
defaultName = 'unicast';
|
|
267
|
-
}
|
|
268
|
-
for (rangeName in rangeList) {
|
|
269
|
-
rangeSubnets = rangeList[rangeName];
|
|
270
|
-
if (rangeSubnets[0] && !(rangeSubnets[0] instanceof Array)) {
|
|
271
|
-
rangeSubnets = [rangeSubnets];
|
|
272
|
-
}
|
|
273
|
-
for (k = 0, len = rangeSubnets.length; k < len; k++) {
|
|
274
|
-
subnet = rangeSubnets[k];
|
|
275
|
-
if (address.kind() === subnet[0].kind()) {
|
|
276
|
-
if (address.match.apply(address, subnet)) {
|
|
277
|
-
return rangeName;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
return defaultName;
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
ipaddr.IPv4 = (function() {
|
|
286
|
-
function IPv4(octets) {
|
|
287
|
-
var k, len, octet;
|
|
288
|
-
if (octets.length !== 4) {
|
|
289
|
-
throw new Error("ipaddr: ipv4 octet count should be 4");
|
|
290
|
-
}
|
|
291
|
-
for (k = 0, len = octets.length; k < len; k++) {
|
|
292
|
-
octet = octets[k];
|
|
293
|
-
if (!((0 <= octet && octet <= 255))) {
|
|
294
|
-
throw new Error("ipaddr: ipv4 octet should fit in 8 bits");
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
this.octets = octets;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
IPv4.prototype.kind = function() {
|
|
301
|
-
return 'ipv4';
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
IPv4.prototype.toString = function() {
|
|
305
|
-
return this.octets.join(".");
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
IPv4.prototype.toNormalizedString = function() {
|
|
309
|
-
return this.toString();
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
IPv4.prototype.toByteArray = function() {
|
|
313
|
-
return this.octets.slice(0);
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
IPv4.prototype.match = function(other, cidrRange) {
|
|
317
|
-
var ref;
|
|
318
|
-
if (cidrRange === void 0) {
|
|
319
|
-
ref = other, other = ref[0], cidrRange = ref[1];
|
|
320
|
-
}
|
|
321
|
-
if (other.kind() !== 'ipv4') {
|
|
322
|
-
throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");
|
|
323
|
-
}
|
|
324
|
-
return matchCIDR(this.octets, other.octets, 8, cidrRange);
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
IPv4.prototype.SpecialRanges = {
|
|
328
|
-
unspecified: [[new IPv4([0, 0, 0, 0]), 8]],
|
|
329
|
-
broadcast: [[new IPv4([255, 255, 255, 255]), 32]],
|
|
330
|
-
multicast: [[new IPv4([224, 0, 0, 0]), 4]],
|
|
331
|
-
linkLocal: [[new IPv4([169, 254, 0, 0]), 16]],
|
|
332
|
-
loopback: [[new IPv4([127, 0, 0, 0]), 8]],
|
|
333
|
-
carrierGradeNat: [[new IPv4([100, 64, 0, 0]), 10]],
|
|
334
|
-
"private": [[new IPv4([10, 0, 0, 0]), 8], [new IPv4([172, 16, 0, 0]), 12], [new IPv4([192, 168, 0, 0]), 16]],
|
|
335
|
-
reserved: [[new IPv4([192, 0, 0, 0]), 24], [new IPv4([192, 0, 2, 0]), 24], [new IPv4([192, 88, 99, 0]), 24], [new IPv4([198, 51, 100, 0]), 24], [new IPv4([203, 0, 113, 0]), 24], [new IPv4([240, 0, 0, 0]), 4]]
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
IPv4.prototype.range = function() {
|
|
339
|
-
return ipaddr.subnetMatch(this, this.SpecialRanges);
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
IPv4.prototype.toIPv4MappedAddress = function() {
|
|
343
|
-
return ipaddr.IPv6.parse("::ffff:" + (this.toString()));
|
|
344
|
-
};
|
|
345
|
-
|
|
346
|
-
IPv4.prototype.prefixLengthFromSubnetMask = function() {
|
|
347
|
-
var cidr, i, k, octet, stop, zeros, zerotable;
|
|
348
|
-
zerotable = {
|
|
349
|
-
0: 8,
|
|
350
|
-
128: 7,
|
|
351
|
-
192: 6,
|
|
352
|
-
224: 5,
|
|
353
|
-
240: 4,
|
|
354
|
-
248: 3,
|
|
355
|
-
252: 2,
|
|
356
|
-
254: 1,
|
|
357
|
-
255: 0
|
|
358
|
-
};
|
|
359
|
-
cidr = 0;
|
|
360
|
-
stop = false;
|
|
361
|
-
for (i = k = 3; k >= 0; i = k += -1) {
|
|
362
|
-
octet = this.octets[i];
|
|
363
|
-
if (octet in zerotable) {
|
|
364
|
-
zeros = zerotable[octet];
|
|
365
|
-
if (stop && zeros !== 0) {
|
|
366
|
-
return null;
|
|
367
|
-
}
|
|
368
|
-
if (zeros !== 8) {
|
|
369
|
-
stop = true;
|
|
370
|
-
}
|
|
371
|
-
cidr += zeros;
|
|
372
|
-
} else {
|
|
373
|
-
return null;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
return 32 - cidr;
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
return IPv4;
|
|
380
|
-
|
|
381
|
-
})();
|
|
382
|
-
|
|
383
|
-
ipv4Part = "(0?\\d+|0x[a-f0-9]+)";
|
|
384
|
-
|
|
385
|
-
ipv4Regexes = {
|
|
386
|
-
fourOctet: new RegExp("^" + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "$", 'i'),
|
|
387
|
-
longValue: new RegExp("^" + ipv4Part + "$", 'i')
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
ipaddr.IPv4.parser = function(string) {
|
|
391
|
-
var match, parseIntAuto, part, shift, value;
|
|
392
|
-
parseIntAuto = function(string) {
|
|
393
|
-
if (string[0] === "0" && string[1] !== "x") {
|
|
394
|
-
return parseInt(string, 8);
|
|
395
|
-
} else {
|
|
396
|
-
return parseInt(string);
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
if (match = string.match(ipv4Regexes.fourOctet)) {
|
|
400
|
-
return (function() {
|
|
401
|
-
var k, len, ref, results;
|
|
402
|
-
ref = match.slice(1, 6);
|
|
403
|
-
results = [];
|
|
404
|
-
for (k = 0, len = ref.length; k < len; k++) {
|
|
405
|
-
part = ref[k];
|
|
406
|
-
results.push(parseIntAuto(part));
|
|
407
|
-
}
|
|
408
|
-
return results;
|
|
409
|
-
})();
|
|
410
|
-
} else if (match = string.match(ipv4Regexes.longValue)) {
|
|
411
|
-
value = parseIntAuto(match[1]);
|
|
412
|
-
if (value > 0xffffffff || value < 0) {
|
|
413
|
-
throw new Error("ipaddr: address outside defined range");
|
|
414
|
-
}
|
|
415
|
-
return ((function() {
|
|
416
|
-
var k, results;
|
|
417
|
-
results = [];
|
|
418
|
-
for (shift = k = 0; k <= 24; shift = k += 8) {
|
|
419
|
-
results.push((value >> shift) & 0xff);
|
|
420
|
-
}
|
|
421
|
-
return results;
|
|
422
|
-
})()).reverse();
|
|
423
|
-
} else {
|
|
424
|
-
return null;
|
|
425
|
-
}
|
|
426
|
-
};
|
|
427
|
-
|
|
428
|
-
ipaddr.IPv6 = (function() {
|
|
429
|
-
function IPv6(parts, zoneId) {
|
|
430
|
-
var i, k, l, len, part, ref;
|
|
431
|
-
if (parts.length === 16) {
|
|
432
|
-
this.parts = [];
|
|
433
|
-
for (i = k = 0; k <= 14; i = k += 2) {
|
|
434
|
-
this.parts.push((parts[i] << 8) | parts[i + 1]);
|
|
435
|
-
}
|
|
436
|
-
} else if (parts.length === 8) {
|
|
437
|
-
this.parts = parts;
|
|
438
|
-
} else {
|
|
439
|
-
throw new Error("ipaddr: ipv6 part count should be 8 or 16");
|
|
440
|
-
}
|
|
441
|
-
ref = this.parts;
|
|
442
|
-
for (l = 0, len = ref.length; l < len; l++) {
|
|
443
|
-
part = ref[l];
|
|
444
|
-
if (!((0 <= part && part <= 0xffff))) {
|
|
445
|
-
throw new Error("ipaddr: ipv6 part should fit in 16 bits");
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
if (zoneId) {
|
|
449
|
-
this.zoneId = zoneId;
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
IPv6.prototype.kind = function() {
|
|
454
|
-
return 'ipv6';
|
|
455
|
-
};
|
|
456
|
-
|
|
457
|
-
IPv6.prototype.toString = function() {
|
|
458
|
-
return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/, '::');
|
|
459
|
-
};
|
|
460
|
-
|
|
461
|
-
IPv6.prototype.toRFC5952String = function() {
|
|
462
|
-
var bestMatchIndex, bestMatchLength, match, regex, string;
|
|
463
|
-
regex = /((^|:)(0(:|$)){2,})/g;
|
|
464
|
-
string = this.toNormalizedString();
|
|
465
|
-
bestMatchIndex = 0;
|
|
466
|
-
bestMatchLength = -1;
|
|
467
|
-
while ((match = regex.exec(string))) {
|
|
468
|
-
if (match[0].length > bestMatchLength) {
|
|
469
|
-
bestMatchIndex = match.index;
|
|
470
|
-
bestMatchLength = match[0].length;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
if (bestMatchLength < 0) {
|
|
474
|
-
return string;
|
|
475
|
-
}
|
|
476
|
-
return string.substring(0, bestMatchIndex) + '::' + string.substring(bestMatchIndex + bestMatchLength);
|
|
477
|
-
};
|
|
478
|
-
|
|
479
|
-
IPv6.prototype.toByteArray = function() {
|
|
480
|
-
var bytes, k, len, part, ref;
|
|
481
|
-
bytes = [];
|
|
482
|
-
ref = this.parts;
|
|
483
|
-
for (k = 0, len = ref.length; k < len; k++) {
|
|
484
|
-
part = ref[k];
|
|
485
|
-
bytes.push(part >> 8);
|
|
486
|
-
bytes.push(part & 0xff);
|
|
487
|
-
}
|
|
488
|
-
return bytes;
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
IPv6.prototype.toNormalizedString = function() {
|
|
492
|
-
var addr, part, suffix;
|
|
493
|
-
addr = ((function() {
|
|
494
|
-
var k, len, ref, results;
|
|
495
|
-
ref = this.parts;
|
|
496
|
-
results = [];
|
|
497
|
-
for (k = 0, len = ref.length; k < len; k++) {
|
|
498
|
-
part = ref[k];
|
|
499
|
-
results.push(part.toString(16));
|
|
500
|
-
}
|
|
501
|
-
return results;
|
|
502
|
-
}).call(this)).join(":");
|
|
503
|
-
suffix = '';
|
|
504
|
-
if (this.zoneId) {
|
|
505
|
-
suffix = '%' + this.zoneId;
|
|
506
|
-
}
|
|
507
|
-
return addr + suffix;
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
IPv6.prototype.toFixedLengthString = function() {
|
|
511
|
-
var addr, part, suffix;
|
|
512
|
-
addr = ((function() {
|
|
513
|
-
var k, len, ref, results;
|
|
514
|
-
ref = this.parts;
|
|
515
|
-
results = [];
|
|
516
|
-
for (k = 0, len = ref.length; k < len; k++) {
|
|
517
|
-
part = ref[k];
|
|
518
|
-
results.push(part.toString(16).padStart(4, '0'));
|
|
519
|
-
}
|
|
520
|
-
return results;
|
|
521
|
-
}).call(this)).join(":");
|
|
522
|
-
suffix = '';
|
|
523
|
-
if (this.zoneId) {
|
|
524
|
-
suffix = '%' + this.zoneId;
|
|
525
|
-
}
|
|
526
|
-
return addr + suffix;
|
|
527
|
-
};
|
|
528
|
-
|
|
529
|
-
IPv6.prototype.match = function(other, cidrRange) {
|
|
530
|
-
var ref;
|
|
531
|
-
if (cidrRange === void 0) {
|
|
532
|
-
ref = other, other = ref[0], cidrRange = ref[1];
|
|
533
|
-
}
|
|
534
|
-
if (other.kind() !== 'ipv6') {
|
|
535
|
-
throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");
|
|
536
|
-
}
|
|
537
|
-
return matchCIDR(this.parts, other.parts, 16, cidrRange);
|
|
538
|
-
};
|
|
539
|
-
|
|
540
|
-
IPv6.prototype.SpecialRanges = {
|
|
541
|
-
unspecified: [new IPv6([0, 0, 0, 0, 0, 0, 0, 0]), 128],
|
|
542
|
-
linkLocal: [new IPv6([0xfe80, 0, 0, 0, 0, 0, 0, 0]), 10],
|
|
543
|
-
multicast: [new IPv6([0xff00, 0, 0, 0, 0, 0, 0, 0]), 8],
|
|
544
|
-
loopback: [new IPv6([0, 0, 0, 0, 0, 0, 0, 1]), 128],
|
|
545
|
-
uniqueLocal: [new IPv6([0xfc00, 0, 0, 0, 0, 0, 0, 0]), 7],
|
|
546
|
-
ipv4Mapped: [new IPv6([0, 0, 0, 0, 0, 0xffff, 0, 0]), 96],
|
|
547
|
-
rfc6145: [new IPv6([0, 0, 0, 0, 0xffff, 0, 0, 0]), 96],
|
|
548
|
-
rfc6052: [new IPv6([0x64, 0xff9b, 0, 0, 0, 0, 0, 0]), 96],
|
|
549
|
-
'6to4': [new IPv6([0x2002, 0, 0, 0, 0, 0, 0, 0]), 16],
|
|
550
|
-
teredo: [new IPv6([0x2001, 0, 0, 0, 0, 0, 0, 0]), 32],
|
|
551
|
-
reserved: [[new IPv6([0x2001, 0xdb8, 0, 0, 0, 0, 0, 0]), 32]]
|
|
552
|
-
};
|
|
553
|
-
|
|
554
|
-
IPv6.prototype.range = function() {
|
|
555
|
-
return ipaddr.subnetMatch(this, this.SpecialRanges);
|
|
556
|
-
};
|
|
557
|
-
|
|
558
|
-
IPv6.prototype.isIPv4MappedAddress = function() {
|
|
559
|
-
return this.range() === 'ipv4Mapped';
|
|
560
|
-
};
|
|
561
|
-
|
|
562
|
-
IPv6.prototype.toIPv4Address = function() {
|
|
563
|
-
var high, low, ref;
|
|
564
|
-
if (!this.isIPv4MappedAddress()) {
|
|
565
|
-
throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");
|
|
566
|
-
}
|
|
567
|
-
ref = this.parts.slice(-2), high = ref[0], low = ref[1];
|
|
568
|
-
return new ipaddr.IPv4([high >> 8, high & 0xff, low >> 8, low & 0xff]);
|
|
569
|
-
};
|
|
570
|
-
|
|
571
|
-
IPv6.prototype.prefixLengthFromSubnetMask = function() {
|
|
572
|
-
var cidr, i, k, part, stop, zeros, zerotable;
|
|
573
|
-
zerotable = {
|
|
574
|
-
0: 16,
|
|
575
|
-
32768: 15,
|
|
576
|
-
49152: 14,
|
|
577
|
-
57344: 13,
|
|
578
|
-
61440: 12,
|
|
579
|
-
63488: 11,
|
|
580
|
-
64512: 10,
|
|
581
|
-
65024: 9,
|
|
582
|
-
65280: 8,
|
|
583
|
-
65408: 7,
|
|
584
|
-
65472: 6,
|
|
585
|
-
65504: 5,
|
|
586
|
-
65520: 4,
|
|
587
|
-
65528: 3,
|
|
588
|
-
65532: 2,
|
|
589
|
-
65534: 1,
|
|
590
|
-
65535: 0
|
|
591
|
-
};
|
|
592
|
-
cidr = 0;
|
|
593
|
-
stop = false;
|
|
594
|
-
for (i = k = 7; k >= 0; i = k += -1) {
|
|
595
|
-
part = this.parts[i];
|
|
596
|
-
if (part in zerotable) {
|
|
597
|
-
zeros = zerotable[part];
|
|
598
|
-
if (stop && zeros !== 0) {
|
|
599
|
-
return null;
|
|
600
|
-
}
|
|
601
|
-
if (zeros !== 16) {
|
|
602
|
-
stop = true;
|
|
603
|
-
}
|
|
604
|
-
cidr += zeros;
|
|
605
|
-
} else {
|
|
606
|
-
return null;
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
return 128 - cidr;
|
|
610
|
-
};
|
|
611
|
-
|
|
612
|
-
return IPv6;
|
|
613
|
-
|
|
614
|
-
})();
|
|
615
|
-
|
|
616
|
-
ipv6Part = "(?:[0-9a-f]+::?)+";
|
|
617
|
-
|
|
618
|
-
zoneIndex = "%[0-9a-z]{1,}";
|
|
619
|
-
|
|
620
|
-
ipv6Regexes = {
|
|
621
|
-
zoneIndex: new RegExp(zoneIndex, 'i'),
|
|
622
|
-
"native": new RegExp("^(::)?(" + ipv6Part + ")?([0-9a-f]+)?(::)?(" + zoneIndex + ")?$", 'i'),
|
|
623
|
-
transitional: new RegExp(("^((?:" + ipv6Part + ")|(?:::)(?:" + ipv6Part + ")?)") + (ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part + "\\." + ipv4Part) + ("(" + zoneIndex + ")?$"), 'i')
|
|
624
|
-
};
|
|
625
|
-
|
|
626
|
-
expandIPv6 = function(string, parts) {
|
|
627
|
-
var colonCount, lastColon, part, replacement, replacementCount, zoneId;
|
|
628
|
-
if (string.indexOf('::') !== string.lastIndexOf('::')) {
|
|
629
|
-
return null;
|
|
630
|
-
}
|
|
631
|
-
zoneId = (string.match(ipv6Regexes['zoneIndex']) || [])[0];
|
|
632
|
-
if (zoneId) {
|
|
633
|
-
zoneId = zoneId.substring(1);
|
|
634
|
-
string = string.replace(/%.+$/, '');
|
|
635
|
-
}
|
|
636
|
-
colonCount = 0;
|
|
637
|
-
lastColon = -1;
|
|
638
|
-
while ((lastColon = string.indexOf(':', lastColon + 1)) >= 0) {
|
|
639
|
-
colonCount++;
|
|
640
|
-
}
|
|
641
|
-
if (string.substr(0, 2) === '::') {
|
|
642
|
-
colonCount--;
|
|
643
|
-
}
|
|
644
|
-
if (string.substr(-2, 2) === '::') {
|
|
645
|
-
colonCount--;
|
|
646
|
-
}
|
|
647
|
-
if (colonCount > parts) {
|
|
648
|
-
return null;
|
|
649
|
-
}
|
|
650
|
-
replacementCount = parts - colonCount;
|
|
651
|
-
replacement = ':';
|
|
652
|
-
while (replacementCount--) {
|
|
653
|
-
replacement += '0:';
|
|
654
|
-
}
|
|
655
|
-
string = string.replace('::', replacement);
|
|
656
|
-
if (string[0] === ':') {
|
|
657
|
-
string = string.slice(1);
|
|
658
|
-
}
|
|
659
|
-
if (string[string.length - 1] === ':') {
|
|
660
|
-
string = string.slice(0, -1);
|
|
661
|
-
}
|
|
662
|
-
parts = (function() {
|
|
663
|
-
var k, len, ref, results;
|
|
664
|
-
ref = string.split(":");
|
|
665
|
-
results = [];
|
|
666
|
-
for (k = 0, len = ref.length; k < len; k++) {
|
|
667
|
-
part = ref[k];
|
|
668
|
-
results.push(parseInt(part, 16));
|
|
669
|
-
}
|
|
670
|
-
return results;
|
|
671
|
-
})();
|
|
672
|
-
return {
|
|
673
|
-
parts: parts,
|
|
674
|
-
zoneId: zoneId
|
|
675
|
-
};
|
|
676
|
-
};
|
|
677
|
-
|
|
678
|
-
ipaddr.IPv6.parser = function(string) {
|
|
679
|
-
var addr, k, len, match, octet, octets, zoneId;
|
|
680
|
-
if (ipv6Regexes['native'].test(string)) {
|
|
681
|
-
return expandIPv6(string, 8);
|
|
682
|
-
} else if (match = string.match(ipv6Regexes['transitional'])) {
|
|
683
|
-
zoneId = match[6] || '';
|
|
684
|
-
addr = expandIPv6(match[1].slice(0, -1) + zoneId, 6);
|
|
685
|
-
if (addr.parts) {
|
|
686
|
-
octets = [parseInt(match[2]), parseInt(match[3]), parseInt(match[4]), parseInt(match[5])];
|
|
687
|
-
for (k = 0, len = octets.length; k < len; k++) {
|
|
688
|
-
octet = octets[k];
|
|
689
|
-
if (!((0 <= octet && octet <= 255))) {
|
|
690
|
-
return null;
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
addr.parts.push(octets[0] << 8 | octets[1]);
|
|
694
|
-
addr.parts.push(octets[2] << 8 | octets[3]);
|
|
695
|
-
return {
|
|
696
|
-
parts: addr.parts,
|
|
697
|
-
zoneId: addr.zoneId
|
|
698
|
-
};
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
return null;
|
|
702
|
-
};
|
|
703
|
-
|
|
704
|
-
ipaddr.IPv4.isIPv4 = ipaddr.IPv6.isIPv6 = function(string) {
|
|
705
|
-
return this.parser(string) !== null;
|
|
706
|
-
};
|
|
707
|
-
|
|
708
|
-
ipaddr.IPv4.isValid = function(string) {
|
|
709
|
-
try {
|
|
710
|
-
new this(this.parser(string));
|
|
711
|
-
return true;
|
|
712
|
-
} catch (error1) {
|
|
713
|
-
return false;
|
|
714
|
-
}
|
|
715
|
-
};
|
|
716
|
-
|
|
717
|
-
ipaddr.IPv4.isValidFourPartDecimal = function(string) {
|
|
718
|
-
if (ipaddr.IPv4.isValid(string) && string.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/)) {
|
|
719
|
-
return true;
|
|
720
|
-
} else {
|
|
721
|
-
return false;
|
|
722
|
-
}
|
|
723
|
-
};
|
|
724
|
-
|
|
725
|
-
ipaddr.IPv6.isValid = function(string) {
|
|
726
|
-
var addr;
|
|
727
|
-
if (typeof string === "string" && string.indexOf(":") === -1) {
|
|
728
|
-
return false;
|
|
729
|
-
}
|
|
730
|
-
try {
|
|
731
|
-
addr = this.parser(string);
|
|
732
|
-
new this(addr.parts, addr.zoneId);
|
|
733
|
-
return true;
|
|
734
|
-
} catch (error1) {
|
|
735
|
-
return false;
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
|
|
739
|
-
ipaddr.IPv4.parse = function(string) {
|
|
740
|
-
var parts;
|
|
741
|
-
parts = this.parser(string);
|
|
742
|
-
if (parts === null) {
|
|
743
|
-
throw new Error("ipaddr: string is not formatted like ip address");
|
|
744
|
-
}
|
|
745
|
-
return new this(parts);
|
|
746
|
-
};
|
|
747
|
-
|
|
748
|
-
ipaddr.IPv6.parse = function(string) {
|
|
749
|
-
var addr;
|
|
750
|
-
addr = this.parser(string);
|
|
751
|
-
if (addr.parts === null) {
|
|
752
|
-
throw new Error("ipaddr: string is not formatted like ip address");
|
|
753
|
-
}
|
|
754
|
-
return new this(addr.parts, addr.zoneId);
|
|
755
|
-
};
|
|
756
|
-
|
|
757
|
-
ipaddr.IPv4.parseCIDR = function(string) {
|
|
758
|
-
var maskLength, match, parsed;
|
|
759
|
-
if (match = string.match(/^(.+)\/(\d+)$/)) {
|
|
760
|
-
maskLength = parseInt(match[2]);
|
|
761
|
-
if (maskLength >= 0 && maskLength <= 32) {
|
|
762
|
-
parsed = [this.parse(match[1]), maskLength];
|
|
763
|
-
Object.defineProperty(parsed, 'toString', {
|
|
764
|
-
value: function() {
|
|
765
|
-
return this.join('/');
|
|
766
|
-
}
|
|
767
|
-
});
|
|
768
|
-
return parsed;
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range");
|
|
772
|
-
};
|
|
773
|
-
|
|
774
|
-
ipaddr.IPv4.subnetMaskFromPrefixLength = function(prefix) {
|
|
775
|
-
var filledOctetCount, j, octets;
|
|
776
|
-
prefix = parseInt(prefix);
|
|
777
|
-
if (prefix < 0 || prefix > 32) {
|
|
778
|
-
throw new Error('ipaddr: invalid IPv4 prefix length');
|
|
779
|
-
}
|
|
780
|
-
octets = [0, 0, 0, 0];
|
|
781
|
-
j = 0;
|
|
782
|
-
filledOctetCount = Math.floor(prefix / 8);
|
|
783
|
-
while (j < filledOctetCount) {
|
|
784
|
-
octets[j] = 255;
|
|
785
|
-
j++;
|
|
786
|
-
}
|
|
787
|
-
if (filledOctetCount < 4) {
|
|
788
|
-
octets[filledOctetCount] = Math.pow(2, prefix % 8) - 1 << 8 - (prefix % 8);
|
|
789
|
-
}
|
|
790
|
-
return new this(octets);
|
|
791
|
-
};
|
|
792
|
-
|
|
793
|
-
ipaddr.IPv4.broadcastAddressFromCIDR = function(string) {
|
|
794
|
-
var cidr, i, ipInterfaceOctets, octets, subnetMaskOctets;
|
|
795
|
-
try {
|
|
796
|
-
cidr = this.parseCIDR(string);
|
|
797
|
-
ipInterfaceOctets = cidr[0].toByteArray();
|
|
798
|
-
subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
|
|
799
|
-
octets = [];
|
|
800
|
-
i = 0;
|
|
801
|
-
while (i < 4) {
|
|
802
|
-
octets.push(parseInt(ipInterfaceOctets[i], 10) | parseInt(subnetMaskOctets[i], 10) ^ 255);
|
|
803
|
-
i++;
|
|
804
|
-
}
|
|
805
|
-
return new this(octets);
|
|
806
|
-
} catch (error1) {
|
|
807
|
-
throw new Error('ipaddr: the address does not have IPv4 CIDR format');
|
|
808
|
-
}
|
|
809
|
-
};
|
|
810
|
-
|
|
811
|
-
ipaddr.IPv4.networkAddressFromCIDR = function(string) {
|
|
812
|
-
var cidr, i, ipInterfaceOctets, octets, subnetMaskOctets;
|
|
813
|
-
try {
|
|
814
|
-
cidr = this.parseCIDR(string);
|
|
815
|
-
ipInterfaceOctets = cidr[0].toByteArray();
|
|
816
|
-
subnetMaskOctets = this.subnetMaskFromPrefixLength(cidr[1]).toByteArray();
|
|
817
|
-
octets = [];
|
|
818
|
-
i = 0;
|
|
819
|
-
while (i < 4) {
|
|
820
|
-
octets.push(parseInt(ipInterfaceOctets[i], 10) & parseInt(subnetMaskOctets[i], 10));
|
|
821
|
-
i++;
|
|
822
|
-
}
|
|
823
|
-
return new this(octets);
|
|
824
|
-
} catch (error1) {
|
|
825
|
-
throw new Error('ipaddr: the address does not have IPv4 CIDR format');
|
|
826
|
-
}
|
|
827
|
-
};
|
|
828
|
-
|
|
829
|
-
ipaddr.IPv6.parseCIDR = function(string) {
|
|
830
|
-
var maskLength, match, parsed;
|
|
831
|
-
if (match = string.match(/^(.+)\/(\d+)$/)) {
|
|
832
|
-
maskLength = parseInt(match[2]);
|
|
833
|
-
if (maskLength >= 0 && maskLength <= 128) {
|
|
834
|
-
parsed = [this.parse(match[1]), maskLength];
|
|
835
|
-
Object.defineProperty(parsed, 'toString', {
|
|
836
|
-
value: function() {
|
|
837
|
-
return this.join('/');
|
|
838
|
-
}
|
|
839
|
-
});
|
|
840
|
-
return parsed;
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range");
|
|
844
|
-
};
|
|
845
|
-
|
|
846
|
-
ipaddr.isValid = function(string) {
|
|
847
|
-
return ipaddr.IPv6.isValid(string) || ipaddr.IPv4.isValid(string);
|
|
848
|
-
};
|
|
849
|
-
|
|
850
|
-
ipaddr.parse = function(string) {
|
|
851
|
-
if (ipaddr.IPv6.isValid(string)) {
|
|
852
|
-
return ipaddr.IPv6.parse(string);
|
|
853
|
-
} else if (ipaddr.IPv4.isValid(string)) {
|
|
854
|
-
return ipaddr.IPv4.parse(string);
|
|
855
|
-
} else {
|
|
856
|
-
throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format");
|
|
857
|
-
}
|
|
858
|
-
};
|
|
859
|
-
|
|
860
|
-
ipaddr.parseCIDR = function(string) {
|
|
861
|
-
try {
|
|
862
|
-
return ipaddr.IPv6.parseCIDR(string);
|
|
863
|
-
} catch (error1) {
|
|
864
|
-
try {
|
|
865
|
-
return ipaddr.IPv4.parseCIDR(string);
|
|
866
|
-
} catch (error1) {
|
|
867
|
-
throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format");
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
};
|
|
871
|
-
|
|
872
|
-
ipaddr.fromByteArray = function(bytes) {
|
|
873
|
-
var length;
|
|
874
|
-
length = bytes.length;
|
|
875
|
-
if (length === 4) {
|
|
876
|
-
return new ipaddr.IPv4(bytes);
|
|
877
|
-
} else if (length === 16) {
|
|
878
|
-
return new ipaddr.IPv6(bytes);
|
|
879
|
-
} else {
|
|
880
|
-
throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address");
|
|
881
|
-
}
|
|
882
|
-
};
|
|
883
|
-
|
|
884
|
-
ipaddr.process = function(string) {
|
|
885
|
-
var addr;
|
|
886
|
-
addr = this.parse(string);
|
|
887
|
-
if (addr.kind() === 'ipv6' && addr.isIPv4MappedAddress()) {
|
|
888
|
-
return addr.toIPv4Address();
|
|
889
|
-
} else {
|
|
890
|
-
return addr;
|
|
891
|
-
}
|
|
892
|
-
};
|
|
893
|
-
|
|
894
|
-
}).call(commonjsGlobal);
|
|
895
|
-
} (ipaddr));
|
|
896
|
-
|
|
897
|
-
var __async$4 = (__this, __arguments, generator) => {
|
|
898
|
-
return new Promise((resolve, reject) => {
|
|
899
|
-
var fulfilled = (value) => {
|
|
900
|
-
try {
|
|
901
|
-
step(generator.next(value));
|
|
902
|
-
} catch (e) {
|
|
903
|
-
reject(e);
|
|
904
|
-
}
|
|
905
|
-
};
|
|
906
|
-
var rejected = (value) => {
|
|
907
|
-
try {
|
|
908
|
-
step(generator.throw(value));
|
|
909
|
-
} catch (e) {
|
|
910
|
-
reject(e);
|
|
911
|
-
}
|
|
912
|
-
};
|
|
913
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
914
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
915
|
-
});
|
|
916
|
-
};
|
|
917
|
-
const getEndUserIpAddress = () => __async$4(void 0, null, function* () {
|
|
918
|
-
try {
|
|
919
|
-
const response = yield axios.get("https://api.ipify.org/?format=json");
|
|
920
|
-
if (response.data.ip && ipaddrExports.isValid(response.data.ip)) {
|
|
921
|
-
return ipaddrExports.parse(response.data.ip).toString();
|
|
922
|
-
}
|
|
923
|
-
return void 0;
|
|
924
|
-
} catch (e) {
|
|
925
|
-
return void 0;
|
|
926
|
-
}
|
|
927
|
-
});
|
|
928
|
-
|
|
929
|
-
var __defProp$2 = Object.defineProperty;
|
|
930
|
-
var __defProps$1 = Object.defineProperties;
|
|
931
|
-
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
932
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
933
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
934
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
935
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
936
|
-
var __spreadValues$2 = (a, b) => {
|
|
937
|
-
for (var prop in b || (b = {}))
|
|
938
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
939
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
940
|
-
if (__getOwnPropSymbols$2)
|
|
941
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
942
|
-
if (__propIsEnum$2.call(b, prop))
|
|
943
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
944
|
-
}
|
|
945
|
-
return a;
|
|
946
|
-
};
|
|
947
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
948
|
-
var __objRest = (source, exclude) => {
|
|
949
|
-
var target = {};
|
|
950
|
-
for (var prop in source)
|
|
951
|
-
if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
952
|
-
target[prop] = source[prop];
|
|
953
|
-
if (source != null && __getOwnPropSymbols$2)
|
|
954
|
-
for (var prop of __getOwnPropSymbols$2(source)) {
|
|
955
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
|
|
956
|
-
target[prop] = source[prop];
|
|
957
|
-
}
|
|
958
|
-
return target;
|
|
959
|
-
};
|
|
960
|
-
var __async$3 = (__this, __arguments, generator) => {
|
|
961
|
-
return new Promise((resolve, reject) => {
|
|
962
|
-
var fulfilled = (value) => {
|
|
963
|
-
try {
|
|
964
|
-
step(generator.next(value));
|
|
965
|
-
} catch (e) {
|
|
966
|
-
reject(e);
|
|
967
|
-
}
|
|
968
|
-
};
|
|
969
|
-
var rejected = (value) => {
|
|
970
|
-
try {
|
|
971
|
-
step(generator.throw(value));
|
|
972
|
-
} catch (e) {
|
|
973
|
-
reject(e);
|
|
974
|
-
}
|
|
975
|
-
};
|
|
976
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
977
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
978
|
-
});
|
|
979
|
-
};
|
|
980
|
-
class CarriersAPI {
|
|
981
|
-
constructor(client) {
|
|
982
|
-
this.client = client;
|
|
983
|
-
/**
|
|
984
|
-
* The `list` method retrieves a list of connected carriers for a given user.
|
|
985
|
-
*/
|
|
986
|
-
this.list = () => {
|
|
987
|
-
return this.client.get("/v1/carriers");
|
|
988
|
-
};
|
|
989
|
-
/**
|
|
990
|
-
* The `get` method retrieves a specific carrier by `carrierId`.
|
|
991
|
-
*/
|
|
992
|
-
this.get = (carrierId) => {
|
|
993
|
-
return this.client.get(`/v1/carriers/${carrierId}`);
|
|
994
|
-
};
|
|
995
|
-
/**
|
|
996
|
-
* The `connect` method connects a carrier account to a user's ShipEngine account.
|
|
997
|
-
*/
|
|
998
|
-
this.connect = (_a) => __async$3(this, null, function* () {
|
|
999
|
-
var _b = _a, { carrierCode } = _b, connection = __objRest(_b, ["carrierCode"]);
|
|
1000
|
-
const endUserIpAddress = yield getEndUserIpAddress();
|
|
1001
|
-
if (!endUserIpAddress)
|
|
1002
|
-
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
1003
|
-
return yield this.client.post(`/v1/registration/${carrierCode}`, __spreadProps$1(__spreadValues$2({}, connection), {
|
|
1004
|
-
endUserIpAddress
|
|
1005
|
-
}));
|
|
1006
|
-
});
|
|
1007
|
-
/**
|
|
1008
|
-
* The `addFunds` method allows a user to add funds to their carrier account balance.
|
|
1009
|
-
* Not all carrier providers allow you to maintain a balance.
|
|
1010
|
-
*
|
|
1011
|
-
* - For example, FedEx does
|
|
1012
|
-
* not require you to maintain a balance that will be used when purchasing labels.
|
|
1013
|
-
*/
|
|
1014
|
-
this.addFunds = (carrierId, funds) => {
|
|
1015
|
-
return this.client.put(`/v1/carriers/${carrierId}/add_funds`, funds);
|
|
1016
|
-
};
|
|
1017
|
-
/**
|
|
1018
|
-
* The `updateAutoFunding` method allows a user to update the auto-funding settings
|
|
1019
|
-
* on their ShipEngine account.
|
|
1020
|
-
*
|
|
1021
|
-
* e.g. Enable auto-funding, set a balance threshold, and a maximum number of time
|
|
1022
|
-
* per day you wish to auto-fund your account.
|
|
1023
|
-
*/
|
|
1024
|
-
this.updateAutoFunding = (carrierId, options) => {
|
|
1025
|
-
return this.client.post(
|
|
1026
|
-
`/v1/carriers/${carrierId}/auto_funding`,
|
|
1027
|
-
options
|
|
1028
|
-
);
|
|
1029
|
-
};
|
|
1030
|
-
/**
|
|
1031
|
-
* The `getAutoFunding` method retrieves the current auto-funding settings.
|
|
1032
|
-
*
|
|
1033
|
-
* If no auto-funding rules have been set, the response will contain the default
|
|
1034
|
-
* values for auto-funding. Auto-funding is disabled by default.
|
|
1035
|
-
*/
|
|
1036
|
-
this.getAutoFunding = (carrierId) => {
|
|
1037
|
-
return this.client.get(
|
|
1038
|
-
`/v1/carriers/${carrierId}/auto_funding`
|
|
1039
|
-
);
|
|
1040
|
-
};
|
|
1041
|
-
/**
|
|
1042
|
-
* The `getWalletHistory` method retrieves the wallet transaction history for
|
|
1043
|
-
* a ShipEngine wallet account.
|
|
1044
|
-
*/
|
|
1045
|
-
this.getWalletHistory = (startDate, endDate, page) => {
|
|
1046
|
-
return this.client.get(`/v1/carriers/wallet_history`, {
|
|
1047
|
-
params: {
|
|
1048
|
-
endDate: endDate.toISOString(),
|
|
1049
|
-
page,
|
|
1050
|
-
startDate: startDate.toISOString()
|
|
1051
|
-
}
|
|
1052
|
-
});
|
|
1053
|
-
};
|
|
1054
|
-
/**
|
|
1055
|
-
* The `getServices` method retrieves a list of shipping services that a given carrier offers.
|
|
1056
|
-
*/
|
|
1057
|
-
this.getServices = (carrierId) => {
|
|
1058
|
-
return this.client.get(`/v1/carriers/${carrierId}/services`);
|
|
1059
|
-
};
|
|
1060
|
-
/**
|
|
1061
|
-
* The `getPackageRatingGroup` method retrieves a list of package rating groups.
|
|
1062
|
-
* This is primarily used for carriers that support negotiated rates, and a user
|
|
1063
|
-
* has a rate card with multiple package rating groups.
|
|
1064
|
-
*/
|
|
1065
|
-
this.getPackageRatingGroup = (carrierId) => {
|
|
1066
|
-
return this.client.get(
|
|
1067
|
-
`/v1/carriers/${carrierId}/package_rating_group`
|
|
1068
|
-
);
|
|
1069
|
-
};
|
|
1070
|
-
/**
|
|
1071
|
-
* The `getCountries` method retrieves a list of countries that a given carrier
|
|
1072
|
-
* supports shipping to.
|
|
1073
|
-
*/
|
|
1074
|
-
this.getCountries = (carrierId) => {
|
|
1075
|
-
return this.client.get(`/v1/carriers/${carrierId}/countries`);
|
|
1076
|
-
};
|
|
1077
|
-
/**
|
|
1078
|
-
* The `getCurrencies` method retrieves a list of currencies that a given carrier
|
|
1079
|
-
* supports the usage of.
|
|
1080
|
-
*/
|
|
1081
|
-
this.getCurrencies = (carrierId) => {
|
|
1082
|
-
return this.client.get(`/v1/carriers/${carrierId}/currencies`);
|
|
1083
|
-
};
|
|
1084
|
-
/**
|
|
1085
|
-
* The `getZones` method retrieves a list of zones for which the attached carrier
|
|
1086
|
-
* provides support to.
|
|
1087
|
-
*/
|
|
1088
|
-
this.getZones = (carrierId) => {
|
|
1089
|
-
return this.client.get(`/v1/carriers/${carrierId}/zones`);
|
|
1090
|
-
};
|
|
1091
|
-
this.client = client;
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
|
-
var o={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},l={};function a(e){return "string"==typeof e?o[e.toLowerCase()]:e}function c(e,r){return c=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e},c(e,r)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return !1}}function f(e,r,t){return f=u()?Reflect.construct:function(e,r,t){var s=[null];s.push.apply(s,r);var i=new(Function.bind.apply(e,s));return t&&c(i,t.prototype),i},f.apply(null,arguments)}function h(e){if(null==e)return e;if(Array.isArray(e))return e.slice();if("object"==typeof e){var r={};return Object.keys(e).forEach(function(t){r[t]=e[t];}),r}return e}function v(e){return void 0===e?"undefined":null===e?"null":Array.isArray(e)?"[ "+e.map(function(e){return v(e)}).join(", ")+" ]":"object"==typeof e?JSON.stringify(e):"function"==typeof e?"[Function: "+e.name+"]":"boolean"==typeof e||"number"==typeof e?e:"'"+e.toString()+"'"}function p(e){if("string"!=typeof e){for(var r=new Array(arguments.length),t=0;t<arguments.length;t++)r[t]=v(arguments[t]);return r.join(" ")}for(var s=/%[sdj%]/g,i=1,n=arguments,o=n.length,l=String(e).replace(s,function(e){if("%%"===e)return "%";if(i>=o)return e;switch(e){case"%s":return String(n[i++]);case"%d":return Number(n[i++]);case"%j":try{return JSON.stringify(n[i++])}catch(e){return "[Circular]"}default:return e}}),a=n[i];i<o;a=n[++i])l+=null===a||"object"!=typeof a?" "+a:" "+v(a);return l}function m(e,r){var t=e.split("\n");t[0]&&t[0].indexOf("call-stack-error")>=0&&t.shift();var s=t[r],i=null;if(s){var n=/^\s*(at|.*@)\s*(.+)?$/.exec(s);i=Array.isArray(n)&&n[2]?n[2]:s;}return i}Object.keys(o).forEach(function(e){l[o[e]]=e;});var y={};function d(e,r){if(r){if(y[r])return;y[r]=!0;}console.error(e+"\n");}function g(e){return y[e]}function w(){var e=[];return function(r,t){return t&&"object"==typeof t?-1!==e.indexOf(t)?"[Circular]":(e.push(t),t):t}}var b=/*#__PURE__*/function(){function e(){}return e.prototype.write=function(e){e.level<30?console.log(e):e.level<40?console.info(e):e.level<50?console.warn(e):console.error(e),e.err&&e.err.stack&&console.error(e.err.stack),e.obj&&console.log(e.obj);},e}(),j=/*#__PURE__*/function(){function e(r,t,s){var i,n,o,l,a=this;if(!(this instanceof e))return new e(r,t);if(void 0!==t&&(i=r,r=t,!(i instanceof e)))throw new TypeError("invalid Logger creation: do not pass a second arg");if(!r)throw new TypeError("options (object) is required");if(i){if(r.name)throw new TypeError("invalid options.name: child cannot set logger name")}else if(!r.name)throw new TypeError("options.name (string) is required");if(r.stream&&r.streams)throw new TypeError('cannot mix "streams" and "stream" options');if(r.streams&&!Array.isArray(r.streams))throw new TypeError("invalid options.streams: must be an array");if(r.serializers&&("object"!=typeof r.serializers||Array.isArray(r.serializers)))throw new TypeError("invalid options.serializers: must be an object");if(i&&s){this._level=i._level,this.streams=i.streams,this.serializers=i.serializers,this.src=i.src,n=this.fields={};var c=Object.keys(i.fields);for(l=0;l<c.length;l++)n[o=c[l]]=i.fields[o];var u=Object.keys(r);for(l=0;l<u.length;l++)n[o=u[l]]=r[o];}else {if(i){for(this._level=i._level,this.streams=[],l=0;l<i.streams.length;l++){var f=h(i.streams[l]);this.streams.push(f);}this.serializers=h(i.serializers),this.src=i.src,this.fields=h(i.fields),r.level&&this.level(r.level);}else this._level=Number.POSITIVE_INFINITY,this.streams=[],this.serializers=null,this.src=!1,this.fields={};r.stream?this.addStream({type:"stream",stream:r.stream,level:r.level}):r.streams?r.streams.forEach(function(e){a.addStream(e,r.level);}):i&&r.level?this.level(r.level):i||this.addStream({type:"raw",stream:new b,level:r.level}),r.serializers&&this.addSerializers(r.serializers),r.src&&(this.src=!0),delete(n=h(r)).stream,delete n.level,delete n.streams,delete n.serializers,delete n.src,this.serializers&&this._applySerializers(n),Object.keys(n).forEach(function(e){a.fields[e]=n[e];});}}var r=e.prototype;return r.addStream=function(e,r){void 0===r&&(r=30),(e=h(e)).type="raw",e.level=a(e.level||r),e.level<this._level&&(this._level=e.level),this.streams.push(e),delete this.haveNonRawStreams;},r.addSerializers=function(e){var r=this;this.serializers||(this.serializers={}),Object.keys(e).forEach(function(t){var s=e[t];if("function"!=typeof s)throw new TypeError(p('invalid serializer for "%s" field: must be a function',t));r.serializers[t]=s;});},r.child=function(e,r){return new this.constructor(this,e||{},r)},r.level=function(e){if(void 0===e)return this._level;for(var r=a(e),t=this.streams.length,s=0;s<t;s++)this.streams[s].level=r;this._level=r;},r.levels=function(e,r){if(void 0===e)return this.streams.map(function(e){return e.level});var t;if("number"==typeof e){if(void 0===(t=this.streams[e]))throw new Error("invalid stream index: "+e)}else {for(var s=this.streams.length,i=0;i<s;i++){var n=this.streams[i];if(n.name===e){t=n;break}}if(!t)throw new Error(p('no stream with name "%s"',e))}if(void 0===r)return t.level;var o=a(r);t.level=o,o<this._level&&(this._level=o);},r._applySerializers=function(e,r){var t=this;Object.keys(this.serializers).forEach(function(s){if(!(void 0===e[s]||r&&r[s]))try{e[s]=t.serializers[s](e[s]);}catch(r){d(p('bunyan: ERROR: Exception thrown from the "%s" Bunyan serializer. This should never happen. This is a bugin that serializer function.\n%s',s,r.stack||r)),e[s]=p('(Error in Bunyan log "%s" serializer broke field. See stderr for details.)',s);}});},r._emit=function(e,r){var t,s;if(void 0===this.haveNonRawStreams)for(this.haveNonRawStreams=!1,t=0;t<this.streams.length;t++)if(!this.streams[t].raw){this.haveNonRawStreams=!0;break}if(r||this.haveNonRawStreams)try{s=JSON.stringify(e,w())+"\n";}catch(r){var i=r.stack.split(/\n/g,2).join("\n");d('bunyan: ERROR: Exception in `JSON.stringify(rec)`. You can install the "safe-json-stringify" module to have Bunyan fallback to safer stringification. Record:\n'+function(e,r){return r||(r=" "),r+e.split(/\r?\n/g).join("\n"+r)}(p("%s\n%s",e,r.stack)),i),s=p("(Exception in JSON.stringify(rec): %j. See stderr for details.)\n",r.message);}if(r)return s;var n=e.level;for(t=0;t<this.streams.length;t++){var o=this.streams[t];o.level<=n&&o.stream.write(e);}return s},e}();function z(e){return function(){var r=this;function t(t){var n;t[0]instanceof Error?(s={err:r.serializers&&r.serializers.err?r.serializers.err(t[0]):k.err(t[0])},n={err:!0},i=1===t.length?[s.err.message]:Array.prototype.slice.call(t,1)):"object"!=typeof t[0]&&null!==t[0]||Array.isArray(t[0])?(s=null,i=Array.prototype.slice.call(t)):(s=t[0],i=1===t.length&&s.err&&s.err instanceof Error?[s.err.message]:Array.prototype.slice.call(t,1));var o=h(r.fields);o.level=e;var a=s?h(s):null;if(a&&(r.serializers&&r._applySerializers(a,n),Object.keys(a).forEach(function(e){o[e]=a[e];})),o.levelName=l[e],o.msg=i.length?p.apply(r,i):"",o.time||(o.time=new Date),r.src&&!o.src)try{throw new Error("call-stack-error")}catch(e){var c=e.stack?m(e.stack,2):"";c||g("src")||d("Unable to determine src line info","src"),o.src=c||"";}return o.v=1,o}var s=null,i=arguments,n=null;if(0===arguments.length)return this._level<=e;this._level>e||(n=t(i),this._emit(n));}}function S(e){var r=e.stack||e.toString();if(e.cause&&"function"==typeof e.cause){var t=e.cause();t&&(r+="\nCaused by: "+S(t));}return r}j.prototype.trace=z(10),j.prototype.debug=z(20),j.prototype.info=z(30),j.prototype.warn=z(40),j.prototype.error=z(50),j.prototype.fatal=z(60);var k={err:function(e){return e&&e.stack?{message:e.message,name:e.name,stack:S(e),code:e.code,signal:e.signal}:e}};function E(){return f(j,[].slice.call(arguments))}var A={levels:{trace:"color: DeepPink",debug:"color: GoldenRod",info:"color: DarkTurquoise",warn:"color: Purple",error:"color: Crimson",fatal:"color: Black"},def:"color: DimGray",msg:"color: SteelBlue",src:"color: DimGray; font-style: italic; font-size: 0.9em"},R=/*#__PURE__*/function(){function e(e){var r=void 0===e?{}:e,t=r.logByLevel,s=r.css,i=void 0===s?A:s;this.logByLevel=void 0!==t&&t,this.css=i;}return e.prototype.write=function(e){var r,t,s=this.css.def,i=this.css.msg,n=this.css.src,o=e.childName?e.name+"/"+e.childName:e.name,a=l[e.level],c=(Array(6-a.length).join(" ")+a).toUpperCase();this.logByLevel?(10===e.level?a="debug":60===e.level&&(a="error"),t="function"==typeof console[a]?console[a]:console.log):t=console.log,r=e.level<20?this.css.levels.trace:e.level<30?this.css.levels.debug:e.level<40?this.css.levels.info:e.level<50?this.css.levels.warn:e.level<60?this.css.levels.error:this.css.levels.fatal;var u=function(e,r){return Array(r+1-(e+"").length).join("0")+e},f=[];f.push("[%s:%s:%s:%s] %c%s%c: %s: %c%s "+(e.src?"%c%s":"")),f.push(u(e.time.getHours(),2)),f.push(u(e.time.getMinutes(),2)),f.push(u(e.time.getSeconds(),2)),f.push(u(e.time.getMilliseconds(),4)),f.push(r),f.push(c),f.push(s),f.push(o),f.push(i),f.push(e.msg),e.src&&(f.push(n),f.push(e.src)),e.obj&&(f.push("\n"),f.push(e.obj)),e.err&&e.err.stack&&(f.push("\n"),f.push(e.err.stack)),t.apply(console,f);},e.getDefaultCss=function(){return A},e}();
|
|
1096
|
-
|
|
1097
|
-
var humpsExports = {};
|
|
1098
|
-
var humps = {
|
|
1099
|
-
get exports(){ return humpsExports; },
|
|
1100
|
-
set exports(v){ humpsExports = v; },
|
|
1101
|
-
};
|
|
1102
|
-
|
|
1103
|
-
(function (module) {
|
|
1104
|
-
(function(global) {
|
|
1105
|
-
|
|
1106
|
-
var _processKeys = function(convert, obj, options) {
|
|
1107
|
-
if(!_isObject(obj) || _isDate(obj) || _isRegExp(obj) || _isBoolean(obj) || _isFunction(obj)) {
|
|
1108
|
-
return obj;
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
var output,
|
|
1112
|
-
i = 0,
|
|
1113
|
-
l = 0;
|
|
1114
|
-
|
|
1115
|
-
if(_isArray(obj)) {
|
|
1116
|
-
output = [];
|
|
1117
|
-
for(l=obj.length; i<l; i++) {
|
|
1118
|
-
output.push(_processKeys(convert, obj[i], options));
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
else {
|
|
1122
|
-
output = {};
|
|
1123
|
-
for(var key in obj) {
|
|
1124
|
-
if(Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
1125
|
-
output[convert(key, options)] = _processKeys(convert, obj[key], options);
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
return output;
|
|
1130
|
-
};
|
|
1131
|
-
|
|
1132
|
-
// String conversion methods
|
|
1133
|
-
|
|
1134
|
-
var separateWords = function(string, options) {
|
|
1135
|
-
options = options || {};
|
|
1136
|
-
var separator = options.separator || '_';
|
|
1137
|
-
var split = options.split || /(?=[A-Z])/;
|
|
1138
|
-
|
|
1139
|
-
return string.split(split).join(separator);
|
|
1140
|
-
};
|
|
1141
|
-
|
|
1142
|
-
var camelize = function(string) {
|
|
1143
|
-
if (_isNumerical(string)) {
|
|
1144
|
-
return string;
|
|
1145
|
-
}
|
|
1146
|
-
string = string.replace(/[\-_\s]+(.)?/g, function(match, chr) {
|
|
1147
|
-
return chr ? chr.toUpperCase() : '';
|
|
1148
|
-
});
|
|
1149
|
-
// Ensure 1st char is always lowercase
|
|
1150
|
-
return string.substr(0, 1).toLowerCase() + string.substr(1);
|
|
1151
|
-
};
|
|
1152
|
-
|
|
1153
|
-
var pascalize = function(string) {
|
|
1154
|
-
var camelized = camelize(string);
|
|
1155
|
-
// Ensure 1st char is always uppercase
|
|
1156
|
-
return camelized.substr(0, 1).toUpperCase() + camelized.substr(1);
|
|
1157
|
-
};
|
|
1158
|
-
|
|
1159
|
-
var decamelize = function(string, options) {
|
|
1160
|
-
return separateWords(string, options).toLowerCase();
|
|
1161
|
-
};
|
|
1162
|
-
|
|
1163
|
-
// Utilities
|
|
1164
|
-
// Taken from Underscore.js
|
|
1165
|
-
|
|
1166
|
-
var toString = Object.prototype.toString;
|
|
1167
|
-
|
|
1168
|
-
var _isFunction = function(obj) {
|
|
1169
|
-
return typeof(obj) === 'function';
|
|
1170
|
-
};
|
|
1171
|
-
var _isObject = function(obj) {
|
|
1172
|
-
return obj === Object(obj);
|
|
1173
|
-
};
|
|
1174
|
-
var _isArray = function(obj) {
|
|
1175
|
-
return toString.call(obj) == '[object Array]';
|
|
1176
|
-
};
|
|
1177
|
-
var _isDate = function(obj) {
|
|
1178
|
-
return toString.call(obj) == '[object Date]';
|
|
1179
|
-
};
|
|
1180
|
-
var _isRegExp = function(obj) {
|
|
1181
|
-
return toString.call(obj) == '[object RegExp]';
|
|
1182
|
-
};
|
|
1183
|
-
var _isBoolean = function(obj) {
|
|
1184
|
-
return toString.call(obj) == '[object Boolean]';
|
|
1185
|
-
};
|
|
1186
|
-
|
|
1187
|
-
// Performant way to determine if obj coerces to a number
|
|
1188
|
-
var _isNumerical = function(obj) {
|
|
1189
|
-
obj = obj - 0;
|
|
1190
|
-
return obj === obj;
|
|
1191
|
-
};
|
|
1192
|
-
|
|
1193
|
-
// Sets up function which handles processing keys
|
|
1194
|
-
// allowing the convert function to be modified by a callback
|
|
1195
|
-
var _processor = function(convert, options) {
|
|
1196
|
-
var callback = options && 'process' in options ? options.process : options;
|
|
1197
|
-
|
|
1198
|
-
if(typeof(callback) !== 'function') {
|
|
1199
|
-
return convert;
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
return function(string, options) {
|
|
1203
|
-
return callback(string, convert, options);
|
|
1204
|
-
}
|
|
1205
|
-
};
|
|
1206
|
-
|
|
1207
|
-
var humps = {
|
|
1208
|
-
camelize: camelize,
|
|
1209
|
-
decamelize: decamelize,
|
|
1210
|
-
pascalize: pascalize,
|
|
1211
|
-
depascalize: decamelize,
|
|
1212
|
-
camelizeKeys: function(object, options) {
|
|
1213
|
-
return _processKeys(_processor(camelize, options), object);
|
|
1214
|
-
},
|
|
1215
|
-
decamelizeKeys: function(object, options) {
|
|
1216
|
-
return _processKeys(_processor(decamelize, options), object, options);
|
|
1217
|
-
},
|
|
1218
|
-
pascalizeKeys: function(object, options) {
|
|
1219
|
-
return _processKeys(_processor(pascalize, options), object);
|
|
1220
|
-
},
|
|
1221
|
-
depascalizeKeys: function () {
|
|
1222
|
-
return this.decamelizeKeys.apply(this, arguments);
|
|
1223
|
-
}
|
|
1224
|
-
};
|
|
1225
|
-
|
|
1226
|
-
if (module.exports) {
|
|
1227
|
-
module.exports = humps;
|
|
1228
|
-
} else {
|
|
1229
|
-
global.humps = humps;
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
})(commonjsGlobal);
|
|
1233
|
-
} (humps));
|
|
1234
|
-
|
|
1235
|
-
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
|
1236
|
-
var shams = function hasSymbols() {
|
|
1237
|
-
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
|
1238
|
-
if (typeof Symbol.iterator === 'symbol') { return true; }
|
|
1239
|
-
|
|
1240
|
-
var obj = {};
|
|
1241
|
-
var sym = Symbol('test');
|
|
1242
|
-
var symObj = Object(sym);
|
|
1243
|
-
if (typeof sym === 'string') { return false; }
|
|
1244
|
-
|
|
1245
|
-
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
|
1246
|
-
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
|
1247
|
-
|
|
1248
|
-
// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
|
1249
|
-
// if (sym instanceof Symbol) { return false; }
|
|
1250
|
-
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
|
1251
|
-
// if (!(symObj instanceof Symbol)) { return false; }
|
|
1252
|
-
|
|
1253
|
-
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
|
|
1254
|
-
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
|
1255
|
-
|
|
1256
|
-
var symVal = 42;
|
|
1257
|
-
obj[sym] = symVal;
|
|
1258
|
-
for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
|
|
1259
|
-
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
|
1260
|
-
|
|
1261
|
-
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
|
1262
|
-
|
|
1263
|
-
var syms = Object.getOwnPropertySymbols(obj);
|
|
1264
|
-
if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
|
1265
|
-
|
|
1266
|
-
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
|
1267
|
-
|
|
1268
|
-
if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
|
1269
|
-
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
|
|
1270
|
-
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
return true;
|
|
1274
|
-
};
|
|
1275
|
-
|
|
1276
|
-
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
|
|
1277
|
-
var hasSymbolSham = shams;
|
|
1278
|
-
|
|
1279
|
-
var hasSymbols$1 = function hasNativeSymbols() {
|
|
1280
|
-
if (typeof origSymbol !== 'function') { return false; }
|
|
1281
|
-
if (typeof Symbol !== 'function') { return false; }
|
|
1282
|
-
if (typeof origSymbol('foo') !== 'symbol') { return false; }
|
|
1283
|
-
if (typeof Symbol('bar') !== 'symbol') { return false; }
|
|
1284
|
-
|
|
1285
|
-
return hasSymbolSham();
|
|
1286
|
-
};
|
|
1287
|
-
|
|
1288
|
-
/* eslint no-invalid-this: 1 */
|
|
1289
|
-
|
|
1290
|
-
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
|
1291
|
-
var slice = Array.prototype.slice;
|
|
1292
|
-
var toStr$1 = Object.prototype.toString;
|
|
1293
|
-
var funcType = '[object Function]';
|
|
1294
|
-
|
|
1295
|
-
var implementation$1 = function bind(that) {
|
|
1296
|
-
var target = this;
|
|
1297
|
-
if (typeof target !== 'function' || toStr$1.call(target) !== funcType) {
|
|
1298
|
-
throw new TypeError(ERROR_MESSAGE + target);
|
|
1299
|
-
}
|
|
1300
|
-
var args = slice.call(arguments, 1);
|
|
1301
|
-
|
|
1302
|
-
var bound;
|
|
1303
|
-
var binder = function () {
|
|
1304
|
-
if (this instanceof bound) {
|
|
1305
|
-
var result = target.apply(
|
|
1306
|
-
this,
|
|
1307
|
-
args.concat(slice.call(arguments))
|
|
1308
|
-
);
|
|
1309
|
-
if (Object(result) === result) {
|
|
1310
|
-
return result;
|
|
1311
|
-
}
|
|
1312
|
-
return this;
|
|
1313
|
-
} else {
|
|
1314
|
-
return target.apply(
|
|
1315
|
-
that,
|
|
1316
|
-
args.concat(slice.call(arguments))
|
|
1317
|
-
);
|
|
1318
|
-
}
|
|
1319
|
-
};
|
|
1320
|
-
|
|
1321
|
-
var boundLength = Math.max(0, target.length - args.length);
|
|
1322
|
-
var boundArgs = [];
|
|
1323
|
-
for (var i = 0; i < boundLength; i++) {
|
|
1324
|
-
boundArgs.push('$' + i);
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
|
-
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
|
|
1328
|
-
|
|
1329
|
-
if (target.prototype) {
|
|
1330
|
-
var Empty = function Empty() {};
|
|
1331
|
-
Empty.prototype = target.prototype;
|
|
1332
|
-
bound.prototype = new Empty();
|
|
1333
|
-
Empty.prototype = null;
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
|
-
return bound;
|
|
1337
|
-
};
|
|
1338
|
-
|
|
1339
|
-
var implementation = implementation$1;
|
|
1340
|
-
|
|
1341
|
-
var functionBind = Function.prototype.bind || implementation;
|
|
1342
|
-
|
|
1343
|
-
var bind$1 = functionBind;
|
|
1344
|
-
|
|
1345
|
-
var src = bind$1.call(Function.call, Object.prototype.hasOwnProperty);
|
|
1346
|
-
|
|
1347
|
-
var undefined$1;
|
|
1348
|
-
|
|
1349
|
-
var $SyntaxError = SyntaxError;
|
|
1350
|
-
var $Function = Function;
|
|
1351
|
-
var $TypeError$1 = TypeError;
|
|
1352
|
-
|
|
1353
|
-
// eslint-disable-next-line consistent-return
|
|
1354
|
-
var getEvalledConstructor = function (expressionSyntax) {
|
|
1355
|
-
try {
|
|
1356
|
-
return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
|
|
1357
|
-
} catch (e) {}
|
|
1358
|
-
};
|
|
1359
|
-
|
|
1360
|
-
var $gOPD = Object.getOwnPropertyDescriptor;
|
|
1361
|
-
if ($gOPD) {
|
|
1362
|
-
try {
|
|
1363
|
-
$gOPD({}, '');
|
|
1364
|
-
} catch (e) {
|
|
1365
|
-
$gOPD = null; // this is IE 8, which has a broken gOPD
|
|
1366
|
-
}
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
var throwTypeError = function () {
|
|
1370
|
-
throw new $TypeError$1();
|
|
1371
|
-
};
|
|
1372
|
-
var ThrowTypeError = $gOPD
|
|
1373
|
-
? (function () {
|
|
1374
|
-
try {
|
|
1375
|
-
// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
|
|
1376
|
-
arguments.callee; // IE 8 does not throw here
|
|
1377
|
-
return throwTypeError;
|
|
1378
|
-
} catch (calleeThrows) {
|
|
1379
|
-
try {
|
|
1380
|
-
// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
|
|
1381
|
-
return $gOPD(arguments, 'callee').get;
|
|
1382
|
-
} catch (gOPDthrows) {
|
|
1383
|
-
return throwTypeError;
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
}())
|
|
1387
|
-
: throwTypeError;
|
|
1388
|
-
|
|
1389
|
-
var hasSymbols = hasSymbols$1();
|
|
1390
|
-
|
|
1391
|
-
var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
|
|
1392
|
-
|
|
1393
|
-
var needsEval = {};
|
|
1394
|
-
|
|
1395
|
-
var TypedArray = typeof Uint8Array === 'undefined' ? undefined$1 : getProto(Uint8Array);
|
|
1396
|
-
|
|
1397
|
-
var INTRINSICS = {
|
|
1398
|
-
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
|
|
1399
|
-
'%Array%': Array,
|
|
1400
|
-
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
|
|
1401
|
-
'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined$1,
|
|
1402
|
-
'%AsyncFromSyncIteratorPrototype%': undefined$1,
|
|
1403
|
-
'%AsyncFunction%': needsEval,
|
|
1404
|
-
'%AsyncGenerator%': needsEval,
|
|
1405
|
-
'%AsyncGeneratorFunction%': needsEval,
|
|
1406
|
-
'%AsyncIteratorPrototype%': needsEval,
|
|
1407
|
-
'%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
|
|
1408
|
-
'%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
|
|
1409
|
-
'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined$1 : BigInt64Array,
|
|
1410
|
-
'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined$1 : BigUint64Array,
|
|
1411
|
-
'%Boolean%': Boolean,
|
|
1412
|
-
'%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
|
|
1413
|
-
'%Date%': Date,
|
|
1414
|
-
'%decodeURI%': decodeURI,
|
|
1415
|
-
'%decodeURIComponent%': decodeURIComponent,
|
|
1416
|
-
'%encodeURI%': encodeURI,
|
|
1417
|
-
'%encodeURIComponent%': encodeURIComponent,
|
|
1418
|
-
'%Error%': Error,
|
|
1419
|
-
'%eval%': eval, // eslint-disable-line no-eval
|
|
1420
|
-
'%EvalError%': EvalError,
|
|
1421
|
-
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
|
|
1422
|
-
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
|
|
1423
|
-
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
|
|
1424
|
-
'%Function%': $Function,
|
|
1425
|
-
'%GeneratorFunction%': needsEval,
|
|
1426
|
-
'%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
|
|
1427
|
-
'%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
|
|
1428
|
-
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
|
|
1429
|
-
'%isFinite%': isFinite,
|
|
1430
|
-
'%isNaN%': isNaN,
|
|
1431
|
-
'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
|
|
1432
|
-
'%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
|
|
1433
|
-
'%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
|
|
1434
|
-
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
|
|
1435
|
-
'%Math%': Math,
|
|
1436
|
-
'%Number%': Number,
|
|
1437
|
-
'%Object%': Object,
|
|
1438
|
-
'%parseFloat%': parseFloat,
|
|
1439
|
-
'%parseInt%': parseInt,
|
|
1440
|
-
'%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
|
|
1441
|
-
'%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
|
|
1442
|
-
'%RangeError%': RangeError,
|
|
1443
|
-
'%ReferenceError%': ReferenceError,
|
|
1444
|
-
'%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
|
|
1445
|
-
'%RegExp%': RegExp,
|
|
1446
|
-
'%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
|
|
1447
|
-
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
|
|
1448
|
-
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
|
|
1449
|
-
'%String%': String,
|
|
1450
|
-
'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined$1,
|
|
1451
|
-
'%Symbol%': hasSymbols ? Symbol : undefined$1,
|
|
1452
|
-
'%SyntaxError%': $SyntaxError,
|
|
1453
|
-
'%ThrowTypeError%': ThrowTypeError,
|
|
1454
|
-
'%TypedArray%': TypedArray,
|
|
1455
|
-
'%TypeError%': $TypeError$1,
|
|
1456
|
-
'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
|
|
1457
|
-
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
|
|
1458
|
-
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
|
|
1459
|
-
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
|
|
1460
|
-
'%URIError%': URIError,
|
|
1461
|
-
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
|
|
1462
|
-
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
|
|
1463
|
-
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
|
|
1464
|
-
};
|
|
1465
|
-
|
|
1466
|
-
try {
|
|
1467
|
-
null.error; // eslint-disable-line no-unused-expressions
|
|
1468
|
-
} catch (e) {
|
|
1469
|
-
// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
|
|
1470
|
-
var errorProto = getProto(getProto(e));
|
|
1471
|
-
INTRINSICS['%Error.prototype%'] = errorProto;
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
var doEval = function doEval(name) {
|
|
1475
|
-
var value;
|
|
1476
|
-
if (name === '%AsyncFunction%') {
|
|
1477
|
-
value = getEvalledConstructor('async function () {}');
|
|
1478
|
-
} else if (name === '%GeneratorFunction%') {
|
|
1479
|
-
value = getEvalledConstructor('function* () {}');
|
|
1480
|
-
} else if (name === '%AsyncGeneratorFunction%') {
|
|
1481
|
-
value = getEvalledConstructor('async function* () {}');
|
|
1482
|
-
} else if (name === '%AsyncGenerator%') {
|
|
1483
|
-
var fn = doEval('%AsyncGeneratorFunction%');
|
|
1484
|
-
if (fn) {
|
|
1485
|
-
value = fn.prototype;
|
|
1486
|
-
}
|
|
1487
|
-
} else if (name === '%AsyncIteratorPrototype%') {
|
|
1488
|
-
var gen = doEval('%AsyncGenerator%');
|
|
1489
|
-
if (gen) {
|
|
1490
|
-
value = getProto(gen.prototype);
|
|
1491
|
-
}
|
|
1492
|
-
}
|
|
1493
|
-
|
|
1494
|
-
INTRINSICS[name] = value;
|
|
1495
|
-
|
|
1496
|
-
return value;
|
|
1497
|
-
};
|
|
1498
|
-
|
|
1499
|
-
var LEGACY_ALIASES = {
|
|
1500
|
-
'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
|
|
1501
|
-
'%ArrayPrototype%': ['Array', 'prototype'],
|
|
1502
|
-
'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
|
|
1503
|
-
'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
|
|
1504
|
-
'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
|
|
1505
|
-
'%ArrayProto_values%': ['Array', 'prototype', 'values'],
|
|
1506
|
-
'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
|
|
1507
|
-
'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
|
|
1508
|
-
'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
|
|
1509
|
-
'%BooleanPrototype%': ['Boolean', 'prototype'],
|
|
1510
|
-
'%DataViewPrototype%': ['DataView', 'prototype'],
|
|
1511
|
-
'%DatePrototype%': ['Date', 'prototype'],
|
|
1512
|
-
'%ErrorPrototype%': ['Error', 'prototype'],
|
|
1513
|
-
'%EvalErrorPrototype%': ['EvalError', 'prototype'],
|
|
1514
|
-
'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
|
|
1515
|
-
'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
|
|
1516
|
-
'%FunctionPrototype%': ['Function', 'prototype'],
|
|
1517
|
-
'%Generator%': ['GeneratorFunction', 'prototype'],
|
|
1518
|
-
'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
|
|
1519
|
-
'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
|
|
1520
|
-
'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
|
|
1521
|
-
'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
|
|
1522
|
-
'%JSONParse%': ['JSON', 'parse'],
|
|
1523
|
-
'%JSONStringify%': ['JSON', 'stringify'],
|
|
1524
|
-
'%MapPrototype%': ['Map', 'prototype'],
|
|
1525
|
-
'%NumberPrototype%': ['Number', 'prototype'],
|
|
1526
|
-
'%ObjectPrototype%': ['Object', 'prototype'],
|
|
1527
|
-
'%ObjProto_toString%': ['Object', 'prototype', 'toString'],
|
|
1528
|
-
'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
|
|
1529
|
-
'%PromisePrototype%': ['Promise', 'prototype'],
|
|
1530
|
-
'%PromiseProto_then%': ['Promise', 'prototype', 'then'],
|
|
1531
|
-
'%Promise_all%': ['Promise', 'all'],
|
|
1532
|
-
'%Promise_reject%': ['Promise', 'reject'],
|
|
1533
|
-
'%Promise_resolve%': ['Promise', 'resolve'],
|
|
1534
|
-
'%RangeErrorPrototype%': ['RangeError', 'prototype'],
|
|
1535
|
-
'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
|
|
1536
|
-
'%RegExpPrototype%': ['RegExp', 'prototype'],
|
|
1537
|
-
'%SetPrototype%': ['Set', 'prototype'],
|
|
1538
|
-
'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
|
|
1539
|
-
'%StringPrototype%': ['String', 'prototype'],
|
|
1540
|
-
'%SymbolPrototype%': ['Symbol', 'prototype'],
|
|
1541
|
-
'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
|
|
1542
|
-
'%TypedArrayPrototype%': ['TypedArray', 'prototype'],
|
|
1543
|
-
'%TypeErrorPrototype%': ['TypeError', 'prototype'],
|
|
1544
|
-
'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
|
|
1545
|
-
'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
|
|
1546
|
-
'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
|
|
1547
|
-
'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
|
|
1548
|
-
'%URIErrorPrototype%': ['URIError', 'prototype'],
|
|
1549
|
-
'%WeakMapPrototype%': ['WeakMap', 'prototype'],
|
|
1550
|
-
'%WeakSetPrototype%': ['WeakSet', 'prototype']
|
|
1551
|
-
};
|
|
1552
|
-
|
|
1553
|
-
var bind = functionBind;
|
|
1554
|
-
var hasOwn$1 = src;
|
|
1555
|
-
var $concat$1 = bind.call(Function.call, Array.prototype.concat);
|
|
1556
|
-
var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
|
|
1557
|
-
var $replace$1 = bind.call(Function.call, String.prototype.replace);
|
|
1558
|
-
var $strSlice = bind.call(Function.call, String.prototype.slice);
|
|
1559
|
-
var $exec = bind.call(Function.call, RegExp.prototype.exec);
|
|
1560
|
-
|
|
1561
|
-
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
|
|
1562
|
-
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
1563
|
-
var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
|
|
1564
|
-
var stringToPath = function stringToPath(string) {
|
|
1565
|
-
var first = $strSlice(string, 0, 1);
|
|
1566
|
-
var last = $strSlice(string, -1);
|
|
1567
|
-
if (first === '%' && last !== '%') {
|
|
1568
|
-
throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
|
|
1569
|
-
} else if (last === '%' && first !== '%') {
|
|
1570
|
-
throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
|
|
1571
|
-
}
|
|
1572
|
-
var result = [];
|
|
1573
|
-
$replace$1(string, rePropName, function (match, number, quote, subString) {
|
|
1574
|
-
result[result.length] = quote ? $replace$1(subString, reEscapeChar, '$1') : number || match;
|
|
1575
|
-
});
|
|
1576
|
-
return result;
|
|
1577
|
-
};
|
|
1578
|
-
/* end adaptation */
|
|
1579
|
-
|
|
1580
|
-
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
|
|
1581
|
-
var intrinsicName = name;
|
|
1582
|
-
var alias;
|
|
1583
|
-
if (hasOwn$1(LEGACY_ALIASES, intrinsicName)) {
|
|
1584
|
-
alias = LEGACY_ALIASES[intrinsicName];
|
|
1585
|
-
intrinsicName = '%' + alias[0] + '%';
|
|
1586
|
-
}
|
|
1587
|
-
|
|
1588
|
-
if (hasOwn$1(INTRINSICS, intrinsicName)) {
|
|
1589
|
-
var value = INTRINSICS[intrinsicName];
|
|
1590
|
-
if (value === needsEval) {
|
|
1591
|
-
value = doEval(intrinsicName);
|
|
1592
|
-
}
|
|
1593
|
-
if (typeof value === 'undefined' && !allowMissing) {
|
|
1594
|
-
throw new $TypeError$1('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
|
|
1595
|
-
}
|
|
1596
|
-
|
|
1597
|
-
return {
|
|
1598
|
-
alias: alias,
|
|
1599
|
-
name: intrinsicName,
|
|
1600
|
-
value: value
|
|
1601
|
-
};
|
|
1602
|
-
}
|
|
1603
|
-
|
|
1604
|
-
throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
|
|
1605
|
-
};
|
|
1606
|
-
|
|
1607
|
-
var getIntrinsic = function GetIntrinsic(name, allowMissing) {
|
|
1608
|
-
if (typeof name !== 'string' || name.length === 0) {
|
|
1609
|
-
throw new $TypeError$1('intrinsic name must be a non-empty string');
|
|
1610
|
-
}
|
|
1611
|
-
if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
|
|
1612
|
-
throw new $TypeError$1('"allowMissing" argument must be a boolean');
|
|
1613
|
-
}
|
|
1614
|
-
|
|
1615
|
-
if ($exec(/^%?[^%]*%?$/, name) === null) {
|
|
1616
|
-
throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
|
|
1617
|
-
}
|
|
1618
|
-
var parts = stringToPath(name);
|
|
1619
|
-
var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
|
|
1620
|
-
|
|
1621
|
-
var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
|
|
1622
|
-
var intrinsicRealName = intrinsic.name;
|
|
1623
|
-
var value = intrinsic.value;
|
|
1624
|
-
var skipFurtherCaching = false;
|
|
1625
|
-
|
|
1626
|
-
var alias = intrinsic.alias;
|
|
1627
|
-
if (alias) {
|
|
1628
|
-
intrinsicBaseName = alias[0];
|
|
1629
|
-
$spliceApply(parts, $concat$1([0, 1], alias));
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1632
|
-
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
|
|
1633
|
-
var part = parts[i];
|
|
1634
|
-
var first = $strSlice(part, 0, 1);
|
|
1635
|
-
var last = $strSlice(part, -1);
|
|
1636
|
-
if (
|
|
1637
|
-
(
|
|
1638
|
-
(first === '"' || first === "'" || first === '`')
|
|
1639
|
-
|| (last === '"' || last === "'" || last === '`')
|
|
1640
|
-
)
|
|
1641
|
-
&& first !== last
|
|
1642
|
-
) {
|
|
1643
|
-
throw new $SyntaxError('property names with quotes must have matching quotes');
|
|
1644
|
-
}
|
|
1645
|
-
if (part === 'constructor' || !isOwn) {
|
|
1646
|
-
skipFurtherCaching = true;
|
|
1647
|
-
}
|
|
1648
|
-
|
|
1649
|
-
intrinsicBaseName += '.' + part;
|
|
1650
|
-
intrinsicRealName = '%' + intrinsicBaseName + '%';
|
|
1651
|
-
|
|
1652
|
-
if (hasOwn$1(INTRINSICS, intrinsicRealName)) {
|
|
1653
|
-
value = INTRINSICS[intrinsicRealName];
|
|
1654
|
-
} else if (value != null) {
|
|
1655
|
-
if (!(part in value)) {
|
|
1656
|
-
if (!allowMissing) {
|
|
1657
|
-
throw new $TypeError$1('base intrinsic for ' + name + ' exists, but the property is not available.');
|
|
1658
|
-
}
|
|
1659
|
-
return void undefined$1;
|
|
1660
|
-
}
|
|
1661
|
-
if ($gOPD && (i + 1) >= parts.length) {
|
|
1662
|
-
var desc = $gOPD(value, part);
|
|
1663
|
-
isOwn = !!desc;
|
|
1664
|
-
|
|
1665
|
-
// By convention, when a data property is converted to an accessor
|
|
1666
|
-
// property to emulate a data property that does not suffer from
|
|
1667
|
-
// the override mistake, that accessor's getter is marked with
|
|
1668
|
-
// an `originalValue` property. Here, when we detect this, we
|
|
1669
|
-
// uphold the illusion by pretending to see that original data
|
|
1670
|
-
// property, i.e., returning the value rather than the getter
|
|
1671
|
-
// itself.
|
|
1672
|
-
if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
|
|
1673
|
-
value = desc.get;
|
|
1674
|
-
} else {
|
|
1675
|
-
value = value[part];
|
|
1676
|
-
}
|
|
1677
|
-
} else {
|
|
1678
|
-
isOwn = hasOwn$1(value, part);
|
|
1679
|
-
value = value[part];
|
|
1680
|
-
}
|
|
1681
|
-
|
|
1682
|
-
if (isOwn && !skipFurtherCaching) {
|
|
1683
|
-
INTRINSICS[intrinsicRealName] = value;
|
|
1684
|
-
}
|
|
1685
|
-
}
|
|
1686
|
-
}
|
|
1687
|
-
return value;
|
|
1688
|
-
};
|
|
1689
|
-
|
|
1690
|
-
var callBindExports = {};
|
|
1691
|
-
var callBind$1 = {
|
|
1692
|
-
get exports(){ return callBindExports; },
|
|
1693
|
-
set exports(v){ callBindExports = v; },
|
|
1694
|
-
};
|
|
1695
|
-
|
|
1696
|
-
(function (module) {
|
|
1697
|
-
|
|
1698
|
-
var bind = functionBind;
|
|
1699
|
-
var GetIntrinsic = getIntrinsic;
|
|
1700
|
-
|
|
1701
|
-
var $apply = GetIntrinsic('%Function.prototype.apply%');
|
|
1702
|
-
var $call = GetIntrinsic('%Function.prototype.call%');
|
|
1703
|
-
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
|
|
1704
|
-
|
|
1705
|
-
var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
|
|
1706
|
-
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
|
|
1707
|
-
var $max = GetIntrinsic('%Math.max%');
|
|
1708
|
-
|
|
1709
|
-
if ($defineProperty) {
|
|
1710
|
-
try {
|
|
1711
|
-
$defineProperty({}, 'a', { value: 1 });
|
|
1712
|
-
} catch (e) {
|
|
1713
|
-
// IE 8 has a broken defineProperty
|
|
1714
|
-
$defineProperty = null;
|
|
1715
|
-
}
|
|
1716
|
-
}
|
|
1717
|
-
|
|
1718
|
-
module.exports = function callBind(originalFunction) {
|
|
1719
|
-
var func = $reflectApply(bind, $call, arguments);
|
|
1720
|
-
if ($gOPD && $defineProperty) {
|
|
1721
|
-
var desc = $gOPD(func, 'length');
|
|
1722
|
-
if (desc.configurable) {
|
|
1723
|
-
// original length, plus the receiver, minus any additional arguments (after the receiver)
|
|
1724
|
-
$defineProperty(
|
|
1725
|
-
func,
|
|
1726
|
-
'length',
|
|
1727
|
-
{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
|
|
1728
|
-
);
|
|
1729
|
-
}
|
|
1730
|
-
}
|
|
1731
|
-
return func;
|
|
1732
|
-
};
|
|
1733
|
-
|
|
1734
|
-
var applyBind = function applyBind() {
|
|
1735
|
-
return $reflectApply(bind, $apply, arguments);
|
|
1736
|
-
};
|
|
1737
|
-
|
|
1738
|
-
if ($defineProperty) {
|
|
1739
|
-
$defineProperty(module.exports, 'apply', { value: applyBind });
|
|
1740
|
-
} else {
|
|
1741
|
-
module.exports.apply = applyBind;
|
|
1742
|
-
}
|
|
1743
|
-
} (callBind$1));
|
|
1744
|
-
|
|
1745
|
-
var GetIntrinsic$1 = getIntrinsic;
|
|
1746
|
-
|
|
1747
|
-
var callBind = callBindExports;
|
|
1748
|
-
|
|
1749
|
-
var $indexOf = callBind(GetIntrinsic$1('String.prototype.indexOf'));
|
|
1750
|
-
|
|
1751
|
-
var callBound$1 = function callBoundIntrinsic(name, allowMissing) {
|
|
1752
|
-
var intrinsic = GetIntrinsic$1(name, !!allowMissing);
|
|
1753
|
-
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
|
|
1754
|
-
return callBind(intrinsic);
|
|
1755
|
-
}
|
|
1756
|
-
return intrinsic;
|
|
1757
|
-
};
|
|
1758
|
-
|
|
1759
|
-
const __viteBrowserExternal = {};
|
|
1760
|
-
|
|
1761
|
-
const __viteBrowserExternal$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
1762
|
-
__proto__: null,
|
|
1763
|
-
default: __viteBrowserExternal
|
|
1764
|
-
}, Symbol.toStringTag, { value: 'Module' }));
|
|
1765
|
-
|
|
1766
|
-
const require$$0 = /*@__PURE__*/getAugmentedNamespace(__viteBrowserExternal$1);
|
|
1767
|
-
|
|
1768
|
-
var hasMap = typeof Map === 'function' && Map.prototype;
|
|
1769
|
-
var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
|
|
1770
|
-
var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
|
|
1771
|
-
var mapForEach = hasMap && Map.prototype.forEach;
|
|
1772
|
-
var hasSet = typeof Set === 'function' && Set.prototype;
|
|
1773
|
-
var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
|
|
1774
|
-
var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
|
|
1775
|
-
var setForEach = hasSet && Set.prototype.forEach;
|
|
1776
|
-
var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
|
|
1777
|
-
var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
|
|
1778
|
-
var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
|
|
1779
|
-
var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
|
|
1780
|
-
var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
|
|
1781
|
-
var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
|
|
1782
|
-
var booleanValueOf = Boolean.prototype.valueOf;
|
|
1783
|
-
var objectToString = Object.prototype.toString;
|
|
1784
|
-
var functionToString = Function.prototype.toString;
|
|
1785
|
-
var $match = String.prototype.match;
|
|
1786
|
-
var $slice = String.prototype.slice;
|
|
1787
|
-
var $replace = String.prototype.replace;
|
|
1788
|
-
var $toUpperCase = String.prototype.toUpperCase;
|
|
1789
|
-
var $toLowerCase = String.prototype.toLowerCase;
|
|
1790
|
-
var $test = RegExp.prototype.test;
|
|
1791
|
-
var $concat = Array.prototype.concat;
|
|
1792
|
-
var $join = Array.prototype.join;
|
|
1793
|
-
var $arrSlice = Array.prototype.slice;
|
|
1794
|
-
var $floor = Math.floor;
|
|
1795
|
-
var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
|
|
1796
|
-
var gOPS = Object.getOwnPropertySymbols;
|
|
1797
|
-
var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
|
|
1798
|
-
var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
|
|
1799
|
-
// ie, `has-tostringtag/shams
|
|
1800
|
-
var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')
|
|
1801
|
-
? Symbol.toStringTag
|
|
1802
|
-
: null;
|
|
1803
|
-
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
|
1804
|
-
|
|
1805
|
-
var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (
|
|
1806
|
-
[].__proto__ === Array.prototype // eslint-disable-line no-proto
|
|
1807
|
-
? function (O) {
|
|
1808
|
-
return O.__proto__; // eslint-disable-line no-proto
|
|
1809
|
-
}
|
|
1810
|
-
: null
|
|
1811
|
-
);
|
|
1812
|
-
|
|
1813
|
-
function addNumericSeparator(num, str) {
|
|
1814
|
-
if (
|
|
1815
|
-
num === Infinity
|
|
1816
|
-
|| num === -Infinity
|
|
1817
|
-
|| num !== num
|
|
1818
|
-
|| (num && num > -1000 && num < 1000)
|
|
1819
|
-
|| $test.call(/e/, str)
|
|
1820
|
-
) {
|
|
1821
|
-
return str;
|
|
1822
|
-
}
|
|
1823
|
-
var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
|
|
1824
|
-
if (typeof num === 'number') {
|
|
1825
|
-
var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)
|
|
1826
|
-
if (int !== num) {
|
|
1827
|
-
var intStr = String(int);
|
|
1828
|
-
var dec = $slice.call(str, intStr.length + 1);
|
|
1829
|
-
return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');
|
|
1830
|
-
}
|
|
1831
|
-
}
|
|
1832
|
-
return $replace.call(str, sepRegex, '$&_');
|
|
1833
|
-
}
|
|
1834
|
-
|
|
1835
|
-
var utilInspect = require$$0;
|
|
1836
|
-
var inspectCustom = utilInspect.custom;
|
|
1837
|
-
var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
|
|
1838
|
-
|
|
1839
|
-
var objectInspect = function inspect_(obj, options, depth, seen) {
|
|
1840
|
-
var opts = options || {};
|
|
1841
|
-
|
|
1842
|
-
if (has$3(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
|
|
1843
|
-
throw new TypeError('option "quoteStyle" must be "single" or "double"');
|
|
1844
|
-
}
|
|
1845
|
-
if (
|
|
1846
|
-
has$3(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
|
|
1847
|
-
? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity
|
|
1848
|
-
: opts.maxStringLength !== null
|
|
1849
|
-
)
|
|
1850
|
-
) {
|
|
1851
|
-
throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
|
|
1852
|
-
}
|
|
1853
|
-
var customInspect = has$3(opts, 'customInspect') ? opts.customInspect : true;
|
|
1854
|
-
if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
|
|
1855
|
-
throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
|
|
1856
|
-
}
|
|
1857
|
-
|
|
1858
|
-
if (
|
|
1859
|
-
has$3(opts, 'indent')
|
|
1860
|
-
&& opts.indent !== null
|
|
1861
|
-
&& opts.indent !== '\t'
|
|
1862
|
-
&& !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)
|
|
1863
|
-
) {
|
|
1864
|
-
throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
|
|
1865
|
-
}
|
|
1866
|
-
if (has$3(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
|
|
1867
|
-
throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
|
|
1868
|
-
}
|
|
1869
|
-
var numericSeparator = opts.numericSeparator;
|
|
1870
|
-
|
|
1871
|
-
if (typeof obj === 'undefined') {
|
|
1872
|
-
return 'undefined';
|
|
1873
|
-
}
|
|
1874
|
-
if (obj === null) {
|
|
1875
|
-
return 'null';
|
|
1876
|
-
}
|
|
1877
|
-
if (typeof obj === 'boolean') {
|
|
1878
|
-
return obj ? 'true' : 'false';
|
|
1879
|
-
}
|
|
1880
|
-
|
|
1881
|
-
if (typeof obj === 'string') {
|
|
1882
|
-
return inspectString(obj, opts);
|
|
1883
|
-
}
|
|
1884
|
-
if (typeof obj === 'number') {
|
|
1885
|
-
if (obj === 0) {
|
|
1886
|
-
return Infinity / obj > 0 ? '0' : '-0';
|
|
1887
|
-
}
|
|
1888
|
-
var str = String(obj);
|
|
1889
|
-
return numericSeparator ? addNumericSeparator(obj, str) : str;
|
|
1890
|
-
}
|
|
1891
|
-
if (typeof obj === 'bigint') {
|
|
1892
|
-
var bigIntStr = String(obj) + 'n';
|
|
1893
|
-
return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
|
|
1894
|
-
}
|
|
1895
|
-
|
|
1896
|
-
var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
|
|
1897
|
-
if (typeof depth === 'undefined') { depth = 0; }
|
|
1898
|
-
if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
|
|
1899
|
-
return isArray$3(obj) ? '[Array]' : '[Object]';
|
|
1900
|
-
}
|
|
1901
|
-
|
|
1902
|
-
var indent = getIndent(opts, depth);
|
|
1903
|
-
|
|
1904
|
-
if (typeof seen === 'undefined') {
|
|
1905
|
-
seen = [];
|
|
1906
|
-
} else if (indexOf(seen, obj) >= 0) {
|
|
1907
|
-
return '[Circular]';
|
|
1908
|
-
}
|
|
1909
|
-
|
|
1910
|
-
function inspect(value, from, noIndent) {
|
|
1911
|
-
if (from) {
|
|
1912
|
-
seen = $arrSlice.call(seen);
|
|
1913
|
-
seen.push(from);
|
|
1914
|
-
}
|
|
1915
|
-
if (noIndent) {
|
|
1916
|
-
var newOpts = {
|
|
1917
|
-
depth: opts.depth
|
|
1918
|
-
};
|
|
1919
|
-
if (has$3(opts, 'quoteStyle')) {
|
|
1920
|
-
newOpts.quoteStyle = opts.quoteStyle;
|
|
1921
|
-
}
|
|
1922
|
-
return inspect_(value, newOpts, depth + 1, seen);
|
|
1923
|
-
}
|
|
1924
|
-
return inspect_(value, opts, depth + 1, seen);
|
|
1925
|
-
}
|
|
1926
|
-
|
|
1927
|
-
if (typeof obj === 'function' && !isRegExp$1(obj)) { // in older engines, regexes are callable
|
|
1928
|
-
var name = nameOf(obj);
|
|
1929
|
-
var keys = arrObjKeys(obj, inspect);
|
|
1930
|
-
return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
|
|
1931
|
-
}
|
|
1932
|
-
if (isSymbol(obj)) {
|
|
1933
|
-
var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
|
|
1934
|
-
return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
|
|
1935
|
-
}
|
|
1936
|
-
if (isElement(obj)) {
|
|
1937
|
-
var s = '<' + $toLowerCase.call(String(obj.nodeName));
|
|
1938
|
-
var attrs = obj.attributes || [];
|
|
1939
|
-
for (var i = 0; i < attrs.length; i++) {
|
|
1940
|
-
s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
|
|
1941
|
-
}
|
|
1942
|
-
s += '>';
|
|
1943
|
-
if (obj.childNodes && obj.childNodes.length) { s += '...'; }
|
|
1944
|
-
s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
|
|
1945
|
-
return s;
|
|
1946
|
-
}
|
|
1947
|
-
if (isArray$3(obj)) {
|
|
1948
|
-
if (obj.length === 0) { return '[]'; }
|
|
1949
|
-
var xs = arrObjKeys(obj, inspect);
|
|
1950
|
-
if (indent && !singleLineValues(xs)) {
|
|
1951
|
-
return '[' + indentedJoin(xs, indent) + ']';
|
|
1952
|
-
}
|
|
1953
|
-
return '[ ' + $join.call(xs, ', ') + ' ]';
|
|
1954
|
-
}
|
|
1955
|
-
if (isError(obj)) {
|
|
1956
|
-
var parts = arrObjKeys(obj, inspect);
|
|
1957
|
-
if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {
|
|
1958
|
-
return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
|
|
1959
|
-
}
|
|
1960
|
-
if (parts.length === 0) { return '[' + String(obj) + ']'; }
|
|
1961
|
-
return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
|
|
1962
|
-
}
|
|
1963
|
-
if (typeof obj === 'object' && customInspect) {
|
|
1964
|
-
if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {
|
|
1965
|
-
return utilInspect(obj, { depth: maxDepth - depth });
|
|
1966
|
-
} else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
|
|
1967
|
-
return obj.inspect();
|
|
1968
|
-
}
|
|
1969
|
-
}
|
|
1970
|
-
if (isMap(obj)) {
|
|
1971
|
-
var mapParts = [];
|
|
1972
|
-
if (mapForEach) {
|
|
1973
|
-
mapForEach.call(obj, function (value, key) {
|
|
1974
|
-
mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
|
|
1975
|
-
});
|
|
1976
|
-
}
|
|
1977
|
-
return collectionOf('Map', mapSize.call(obj), mapParts, indent);
|
|
1978
|
-
}
|
|
1979
|
-
if (isSet(obj)) {
|
|
1980
|
-
var setParts = [];
|
|
1981
|
-
if (setForEach) {
|
|
1982
|
-
setForEach.call(obj, function (value) {
|
|
1983
|
-
setParts.push(inspect(value, obj));
|
|
1984
|
-
});
|
|
1985
|
-
}
|
|
1986
|
-
return collectionOf('Set', setSize.call(obj), setParts, indent);
|
|
1987
|
-
}
|
|
1988
|
-
if (isWeakMap(obj)) {
|
|
1989
|
-
return weakCollectionOf('WeakMap');
|
|
1990
|
-
}
|
|
1991
|
-
if (isWeakSet(obj)) {
|
|
1992
|
-
return weakCollectionOf('WeakSet');
|
|
1993
|
-
}
|
|
1994
|
-
if (isWeakRef(obj)) {
|
|
1995
|
-
return weakCollectionOf('WeakRef');
|
|
1996
|
-
}
|
|
1997
|
-
if (isNumber(obj)) {
|
|
1998
|
-
return markBoxed(inspect(Number(obj)));
|
|
1999
|
-
}
|
|
2000
|
-
if (isBigInt(obj)) {
|
|
2001
|
-
return markBoxed(inspect(bigIntValueOf.call(obj)));
|
|
2002
|
-
}
|
|
2003
|
-
if (isBoolean(obj)) {
|
|
2004
|
-
return markBoxed(booleanValueOf.call(obj));
|
|
2005
|
-
}
|
|
2006
|
-
if (isString(obj)) {
|
|
2007
|
-
return markBoxed(inspect(String(obj)));
|
|
2008
|
-
}
|
|
2009
|
-
if (!isDate(obj) && !isRegExp$1(obj)) {
|
|
2010
|
-
var ys = arrObjKeys(obj, inspect);
|
|
2011
|
-
var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
|
|
2012
|
-
var protoTag = obj instanceof Object ? '' : 'null prototype';
|
|
2013
|
-
var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';
|
|
2014
|
-
var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
|
|
2015
|
-
var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');
|
|
2016
|
-
if (ys.length === 0) { return tag + '{}'; }
|
|
2017
|
-
if (indent) {
|
|
2018
|
-
return tag + '{' + indentedJoin(ys, indent) + '}';
|
|
2019
|
-
}
|
|
2020
|
-
return tag + '{ ' + $join.call(ys, ', ') + ' }';
|
|
2021
|
-
}
|
|
2022
|
-
return String(obj);
|
|
2023
|
-
};
|
|
2024
|
-
|
|
2025
|
-
function wrapQuotes(s, defaultStyle, opts) {
|
|
2026
|
-
var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
|
|
2027
|
-
return quoteChar + s + quoteChar;
|
|
2028
|
-
}
|
|
2029
|
-
|
|
2030
|
-
function quote(s) {
|
|
2031
|
-
return $replace.call(String(s), /"/g, '"');
|
|
2032
|
-
}
|
|
2033
|
-
|
|
2034
|
-
function isArray$3(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
2035
|
-
function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
2036
|
-
function isRegExp$1(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
2037
|
-
function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
2038
|
-
function isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
2039
|
-
function isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
2040
|
-
function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
2041
|
-
|
|
2042
|
-
// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
|
|
2043
|
-
function isSymbol(obj) {
|
|
2044
|
-
if (hasShammedSymbols) {
|
|
2045
|
-
return obj && typeof obj === 'object' && obj instanceof Symbol;
|
|
2046
|
-
}
|
|
2047
|
-
if (typeof obj === 'symbol') {
|
|
2048
|
-
return true;
|
|
2049
|
-
}
|
|
2050
|
-
if (!obj || typeof obj !== 'object' || !symToString) {
|
|
2051
|
-
return false;
|
|
2052
|
-
}
|
|
2053
|
-
try {
|
|
2054
|
-
symToString.call(obj);
|
|
2055
|
-
return true;
|
|
2056
|
-
} catch (e) {}
|
|
2057
|
-
return false;
|
|
2058
|
-
}
|
|
2059
|
-
|
|
2060
|
-
function isBigInt(obj) {
|
|
2061
|
-
if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
|
|
2062
|
-
return false;
|
|
2063
|
-
}
|
|
2064
|
-
try {
|
|
2065
|
-
bigIntValueOf.call(obj);
|
|
2066
|
-
return true;
|
|
2067
|
-
} catch (e) {}
|
|
2068
|
-
return false;
|
|
2069
|
-
}
|
|
2070
|
-
|
|
2071
|
-
var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
|
|
2072
|
-
function has$3(obj, key) {
|
|
2073
|
-
return hasOwn.call(obj, key);
|
|
2074
|
-
}
|
|
2075
|
-
|
|
2076
|
-
function toStr(obj) {
|
|
2077
|
-
return objectToString.call(obj);
|
|
2078
|
-
}
|
|
2079
|
-
|
|
2080
|
-
function nameOf(f) {
|
|
2081
|
-
if (f.name) { return f.name; }
|
|
2082
|
-
var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
|
|
2083
|
-
if (m) { return m[1]; }
|
|
2084
|
-
return null;
|
|
2085
|
-
}
|
|
2086
|
-
|
|
2087
|
-
function indexOf(xs, x) {
|
|
2088
|
-
if (xs.indexOf) { return xs.indexOf(x); }
|
|
2089
|
-
for (var i = 0, l = xs.length; i < l; i++) {
|
|
2090
|
-
if (xs[i] === x) { return i; }
|
|
2091
|
-
}
|
|
2092
|
-
return -1;
|
|
2093
|
-
}
|
|
2094
|
-
|
|
2095
|
-
function isMap(x) {
|
|
2096
|
-
if (!mapSize || !x || typeof x !== 'object') {
|
|
2097
|
-
return false;
|
|
2098
|
-
}
|
|
2099
|
-
try {
|
|
2100
|
-
mapSize.call(x);
|
|
2101
|
-
try {
|
|
2102
|
-
setSize.call(x);
|
|
2103
|
-
} catch (s) {
|
|
2104
|
-
return true;
|
|
2105
|
-
}
|
|
2106
|
-
return x instanceof Map; // core-js workaround, pre-v2.5.0
|
|
2107
|
-
} catch (e) {}
|
|
2108
|
-
return false;
|
|
2109
|
-
}
|
|
2110
|
-
|
|
2111
|
-
function isWeakMap(x) {
|
|
2112
|
-
if (!weakMapHas || !x || typeof x !== 'object') {
|
|
2113
|
-
return false;
|
|
2114
|
-
}
|
|
2115
|
-
try {
|
|
2116
|
-
weakMapHas.call(x, weakMapHas);
|
|
2117
|
-
try {
|
|
2118
|
-
weakSetHas.call(x, weakSetHas);
|
|
2119
|
-
} catch (s) {
|
|
2120
|
-
return true;
|
|
2121
|
-
}
|
|
2122
|
-
return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
|
|
2123
|
-
} catch (e) {}
|
|
2124
|
-
return false;
|
|
2125
|
-
}
|
|
2126
|
-
|
|
2127
|
-
function isWeakRef(x) {
|
|
2128
|
-
if (!weakRefDeref || !x || typeof x !== 'object') {
|
|
2129
|
-
return false;
|
|
2130
|
-
}
|
|
2131
|
-
try {
|
|
2132
|
-
weakRefDeref.call(x);
|
|
2133
|
-
return true;
|
|
2134
|
-
} catch (e) {}
|
|
2135
|
-
return false;
|
|
2136
|
-
}
|
|
2137
|
-
|
|
2138
|
-
function isSet(x) {
|
|
2139
|
-
if (!setSize || !x || typeof x !== 'object') {
|
|
2140
|
-
return false;
|
|
2141
|
-
}
|
|
2142
|
-
try {
|
|
2143
|
-
setSize.call(x);
|
|
2144
|
-
try {
|
|
2145
|
-
mapSize.call(x);
|
|
2146
|
-
} catch (m) {
|
|
2147
|
-
return true;
|
|
2148
|
-
}
|
|
2149
|
-
return x instanceof Set; // core-js workaround, pre-v2.5.0
|
|
2150
|
-
} catch (e) {}
|
|
2151
|
-
return false;
|
|
2152
|
-
}
|
|
2153
|
-
|
|
2154
|
-
function isWeakSet(x) {
|
|
2155
|
-
if (!weakSetHas || !x || typeof x !== 'object') {
|
|
2156
|
-
return false;
|
|
2157
|
-
}
|
|
2158
|
-
try {
|
|
2159
|
-
weakSetHas.call(x, weakSetHas);
|
|
2160
|
-
try {
|
|
2161
|
-
weakMapHas.call(x, weakMapHas);
|
|
2162
|
-
} catch (s) {
|
|
2163
|
-
return true;
|
|
2164
|
-
}
|
|
2165
|
-
return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
|
|
2166
|
-
} catch (e) {}
|
|
2167
|
-
return false;
|
|
2168
|
-
}
|
|
2169
|
-
|
|
2170
|
-
function isElement(x) {
|
|
2171
|
-
if (!x || typeof x !== 'object') { return false; }
|
|
2172
|
-
if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
|
|
2173
|
-
return true;
|
|
2174
|
-
}
|
|
2175
|
-
return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
|
|
2176
|
-
}
|
|
2177
|
-
|
|
2178
|
-
function inspectString(str, opts) {
|
|
2179
|
-
if (str.length > opts.maxStringLength) {
|
|
2180
|
-
var remaining = str.length - opts.maxStringLength;
|
|
2181
|
-
var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
|
|
2182
|
-
return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
|
|
2183
|
-
}
|
|
2184
|
-
// eslint-disable-next-line no-control-regex
|
|
2185
|
-
var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte);
|
|
2186
|
-
return wrapQuotes(s, 'single', opts);
|
|
2187
|
-
}
|
|
2188
|
-
|
|
2189
|
-
function lowbyte(c) {
|
|
2190
|
-
var n = c.charCodeAt(0);
|
|
2191
|
-
var x = {
|
|
2192
|
-
8: 'b',
|
|
2193
|
-
9: 't',
|
|
2194
|
-
10: 'n',
|
|
2195
|
-
12: 'f',
|
|
2196
|
-
13: 'r'
|
|
2197
|
-
}[n];
|
|
2198
|
-
if (x) { return '\\' + x; }
|
|
2199
|
-
return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));
|
|
2200
|
-
}
|
|
2201
|
-
|
|
2202
|
-
function markBoxed(str) {
|
|
2203
|
-
return 'Object(' + str + ')';
|
|
2204
|
-
}
|
|
2205
|
-
|
|
2206
|
-
function weakCollectionOf(type) {
|
|
2207
|
-
return type + ' { ? }';
|
|
2208
|
-
}
|
|
2209
|
-
|
|
2210
|
-
function collectionOf(type, size, entries, indent) {
|
|
2211
|
-
var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');
|
|
2212
|
-
return type + ' (' + size + ') {' + joinedEntries + '}';
|
|
2213
|
-
}
|
|
2214
|
-
|
|
2215
|
-
function singleLineValues(xs) {
|
|
2216
|
-
for (var i = 0; i < xs.length; i++) {
|
|
2217
|
-
if (indexOf(xs[i], '\n') >= 0) {
|
|
2218
|
-
return false;
|
|
2219
|
-
}
|
|
2220
|
-
}
|
|
2221
|
-
return true;
|
|
2222
|
-
}
|
|
2223
|
-
|
|
2224
|
-
function getIndent(opts, depth) {
|
|
2225
|
-
var baseIndent;
|
|
2226
|
-
if (opts.indent === '\t') {
|
|
2227
|
-
baseIndent = '\t';
|
|
2228
|
-
} else if (typeof opts.indent === 'number' && opts.indent > 0) {
|
|
2229
|
-
baseIndent = $join.call(Array(opts.indent + 1), ' ');
|
|
2230
|
-
} else {
|
|
2231
|
-
return null;
|
|
2232
|
-
}
|
|
2233
|
-
return {
|
|
2234
|
-
base: baseIndent,
|
|
2235
|
-
prev: $join.call(Array(depth + 1), baseIndent)
|
|
2236
|
-
};
|
|
2237
|
-
}
|
|
2238
|
-
|
|
2239
|
-
function indentedJoin(xs, indent) {
|
|
2240
|
-
if (xs.length === 0) { return ''; }
|
|
2241
|
-
var lineJoiner = '\n' + indent.prev + indent.base;
|
|
2242
|
-
return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
|
|
2243
|
-
}
|
|
2244
|
-
|
|
2245
|
-
function arrObjKeys(obj, inspect) {
|
|
2246
|
-
var isArr = isArray$3(obj);
|
|
2247
|
-
var xs = [];
|
|
2248
|
-
if (isArr) {
|
|
2249
|
-
xs.length = obj.length;
|
|
2250
|
-
for (var i = 0; i < obj.length; i++) {
|
|
2251
|
-
xs[i] = has$3(obj, i) ? inspect(obj[i], obj) : '';
|
|
2252
|
-
}
|
|
2253
|
-
}
|
|
2254
|
-
var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
|
|
2255
|
-
var symMap;
|
|
2256
|
-
if (hasShammedSymbols) {
|
|
2257
|
-
symMap = {};
|
|
2258
|
-
for (var k = 0; k < syms.length; k++) {
|
|
2259
|
-
symMap['$' + syms[k]] = syms[k];
|
|
2260
|
-
}
|
|
2261
|
-
}
|
|
2262
|
-
|
|
2263
|
-
for (var key in obj) { // eslint-disable-line no-restricted-syntax
|
|
2264
|
-
if (!has$3(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
|
|
2265
|
-
if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
|
|
2266
|
-
if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
|
|
2267
|
-
// this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
|
|
2268
|
-
continue; // eslint-disable-line no-restricted-syntax, no-continue
|
|
2269
|
-
} else if ($test.call(/[^\w$]/, key)) {
|
|
2270
|
-
xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
|
|
2271
|
-
} else {
|
|
2272
|
-
xs.push(key + ': ' + inspect(obj[key], obj));
|
|
2273
|
-
}
|
|
2274
|
-
}
|
|
2275
|
-
if (typeof gOPS === 'function') {
|
|
2276
|
-
for (var j = 0; j < syms.length; j++) {
|
|
2277
|
-
if (isEnumerable.call(obj, syms[j])) {
|
|
2278
|
-
xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
|
|
2279
|
-
}
|
|
2280
|
-
}
|
|
2281
|
-
}
|
|
2282
|
-
return xs;
|
|
2283
|
-
}
|
|
2284
|
-
|
|
2285
|
-
var GetIntrinsic = getIntrinsic;
|
|
2286
|
-
var callBound = callBound$1;
|
|
2287
|
-
var inspect = objectInspect;
|
|
2288
|
-
|
|
2289
|
-
var $TypeError = GetIntrinsic('%TypeError%');
|
|
2290
|
-
var $WeakMap = GetIntrinsic('%WeakMap%', true);
|
|
2291
|
-
var $Map = GetIntrinsic('%Map%', true);
|
|
2292
|
-
|
|
2293
|
-
var $weakMapGet = callBound('WeakMap.prototype.get', true);
|
|
2294
|
-
var $weakMapSet = callBound('WeakMap.prototype.set', true);
|
|
2295
|
-
var $weakMapHas = callBound('WeakMap.prototype.has', true);
|
|
2296
|
-
var $mapGet = callBound('Map.prototype.get', true);
|
|
2297
|
-
var $mapSet = callBound('Map.prototype.set', true);
|
|
2298
|
-
var $mapHas = callBound('Map.prototype.has', true);
|
|
2299
|
-
|
|
2300
|
-
/*
|
|
2301
|
-
* This function traverses the list returning the node corresponding to the
|
|
2302
|
-
* given key.
|
|
2303
|
-
*
|
|
2304
|
-
* That node is also moved to the head of the list, so that if it's accessed
|
|
2305
|
-
* again we don't need to traverse the whole list. By doing so, all the recently
|
|
2306
|
-
* used nodes can be accessed relatively quickly.
|
|
2307
|
-
*/
|
|
2308
|
-
var listGetNode = function (list, key) { // eslint-disable-line consistent-return
|
|
2309
|
-
for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
|
|
2310
|
-
if (curr.key === key) {
|
|
2311
|
-
prev.next = curr.next;
|
|
2312
|
-
curr.next = list.next;
|
|
2313
|
-
list.next = curr; // eslint-disable-line no-param-reassign
|
|
2314
|
-
return curr;
|
|
2315
|
-
}
|
|
2316
|
-
}
|
|
2317
|
-
};
|
|
2318
|
-
|
|
2319
|
-
var listGet = function (objects, key) {
|
|
2320
|
-
var node = listGetNode(objects, key);
|
|
2321
|
-
return node && node.value;
|
|
2322
|
-
};
|
|
2323
|
-
var listSet = function (objects, key, value) {
|
|
2324
|
-
var node = listGetNode(objects, key);
|
|
2325
|
-
if (node) {
|
|
2326
|
-
node.value = value;
|
|
2327
|
-
} else {
|
|
2328
|
-
// Prepend the new node to the beginning of the list
|
|
2329
|
-
objects.next = { // eslint-disable-line no-param-reassign
|
|
2330
|
-
key: key,
|
|
2331
|
-
next: objects.next,
|
|
2332
|
-
value: value
|
|
2333
|
-
};
|
|
2334
|
-
}
|
|
2335
|
-
};
|
|
2336
|
-
var listHas = function (objects, key) {
|
|
2337
|
-
return !!listGetNode(objects, key);
|
|
2338
|
-
};
|
|
2339
|
-
|
|
2340
|
-
var sideChannel = function getSideChannel() {
|
|
2341
|
-
var $wm;
|
|
2342
|
-
var $m;
|
|
2343
|
-
var $o;
|
|
2344
|
-
var channel = {
|
|
2345
|
-
assert: function (key) {
|
|
2346
|
-
if (!channel.has(key)) {
|
|
2347
|
-
throw new $TypeError('Side channel does not contain ' + inspect(key));
|
|
2348
|
-
}
|
|
2349
|
-
},
|
|
2350
|
-
get: function (key) { // eslint-disable-line consistent-return
|
|
2351
|
-
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
2352
|
-
if ($wm) {
|
|
2353
|
-
return $weakMapGet($wm, key);
|
|
2354
|
-
}
|
|
2355
|
-
} else if ($Map) {
|
|
2356
|
-
if ($m) {
|
|
2357
|
-
return $mapGet($m, key);
|
|
2358
|
-
}
|
|
2359
|
-
} else {
|
|
2360
|
-
if ($o) { // eslint-disable-line no-lonely-if
|
|
2361
|
-
return listGet($o, key);
|
|
2362
|
-
}
|
|
2363
|
-
}
|
|
2364
|
-
},
|
|
2365
|
-
has: function (key) {
|
|
2366
|
-
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
2367
|
-
if ($wm) {
|
|
2368
|
-
return $weakMapHas($wm, key);
|
|
2369
|
-
}
|
|
2370
|
-
} else if ($Map) {
|
|
2371
|
-
if ($m) {
|
|
2372
|
-
return $mapHas($m, key);
|
|
2373
|
-
}
|
|
2374
|
-
} else {
|
|
2375
|
-
if ($o) { // eslint-disable-line no-lonely-if
|
|
2376
|
-
return listHas($o, key);
|
|
2377
|
-
}
|
|
2378
|
-
}
|
|
2379
|
-
return false;
|
|
2380
|
-
},
|
|
2381
|
-
set: function (key, value) {
|
|
2382
|
-
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
2383
|
-
if (!$wm) {
|
|
2384
|
-
$wm = new $WeakMap();
|
|
2385
|
-
}
|
|
2386
|
-
$weakMapSet($wm, key, value);
|
|
2387
|
-
} else if ($Map) {
|
|
2388
|
-
if (!$m) {
|
|
2389
|
-
$m = new $Map();
|
|
2390
|
-
}
|
|
2391
|
-
$mapSet($m, key, value);
|
|
2392
|
-
} else {
|
|
2393
|
-
if (!$o) {
|
|
2394
|
-
/*
|
|
2395
|
-
* Initialize the linked list as an empty node, so that we don't have
|
|
2396
|
-
* to special-case handling of the first node: we can always refer to
|
|
2397
|
-
* it as (previous node).next, instead of something like (list).head
|
|
2398
|
-
*/
|
|
2399
|
-
$o = { key: {}, next: null };
|
|
2400
|
-
}
|
|
2401
|
-
listSet($o, key, value);
|
|
2402
|
-
}
|
|
2403
|
-
}
|
|
2404
|
-
};
|
|
2405
|
-
return channel;
|
|
2406
|
-
};
|
|
2407
|
-
|
|
2408
|
-
var replace = String.prototype.replace;
|
|
2409
|
-
var percentTwenties = /%20/g;
|
|
2410
|
-
|
|
2411
|
-
var Format = {
|
|
2412
|
-
RFC1738: 'RFC1738',
|
|
2413
|
-
RFC3986: 'RFC3986'
|
|
2414
|
-
};
|
|
2415
|
-
|
|
2416
|
-
var formats$3 = {
|
|
2417
|
-
'default': Format.RFC3986,
|
|
2418
|
-
formatters: {
|
|
2419
|
-
RFC1738: function (value) {
|
|
2420
|
-
return replace.call(value, percentTwenties, '+');
|
|
2421
|
-
},
|
|
2422
|
-
RFC3986: function (value) {
|
|
2423
|
-
return String(value);
|
|
2424
|
-
}
|
|
2425
|
-
},
|
|
2426
|
-
RFC1738: Format.RFC1738,
|
|
2427
|
-
RFC3986: Format.RFC3986
|
|
2428
|
-
};
|
|
2429
|
-
|
|
2430
|
-
var formats$2 = formats$3;
|
|
2431
|
-
|
|
2432
|
-
var has$2 = Object.prototype.hasOwnProperty;
|
|
2433
|
-
var isArray$2 = Array.isArray;
|
|
2434
|
-
|
|
2435
|
-
var hexTable = (function () {
|
|
2436
|
-
var array = [];
|
|
2437
|
-
for (var i = 0; i < 256; ++i) {
|
|
2438
|
-
array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
|
|
2439
|
-
}
|
|
2440
|
-
|
|
2441
|
-
return array;
|
|
2442
|
-
}());
|
|
2443
|
-
|
|
2444
|
-
var compactQueue = function compactQueue(queue) {
|
|
2445
|
-
while (queue.length > 1) {
|
|
2446
|
-
var item = queue.pop();
|
|
2447
|
-
var obj = item.obj[item.prop];
|
|
2448
|
-
|
|
2449
|
-
if (isArray$2(obj)) {
|
|
2450
|
-
var compacted = [];
|
|
2451
|
-
|
|
2452
|
-
for (var j = 0; j < obj.length; ++j) {
|
|
2453
|
-
if (typeof obj[j] !== 'undefined') {
|
|
2454
|
-
compacted.push(obj[j]);
|
|
2455
|
-
}
|
|
2456
|
-
}
|
|
2457
|
-
|
|
2458
|
-
item.obj[item.prop] = compacted;
|
|
2459
|
-
}
|
|
2460
|
-
}
|
|
2461
|
-
};
|
|
2462
|
-
|
|
2463
|
-
var arrayToObject = function arrayToObject(source, options) {
|
|
2464
|
-
var obj = options && options.plainObjects ? Object.create(null) : {};
|
|
2465
|
-
for (var i = 0; i < source.length; ++i) {
|
|
2466
|
-
if (typeof source[i] !== 'undefined') {
|
|
2467
|
-
obj[i] = source[i];
|
|
2468
|
-
}
|
|
2469
|
-
}
|
|
2470
|
-
|
|
2471
|
-
return obj;
|
|
2472
|
-
};
|
|
2473
|
-
|
|
2474
|
-
var merge = function merge(target, source, options) {
|
|
2475
|
-
/* eslint no-param-reassign: 0 */
|
|
2476
|
-
if (!source) {
|
|
2477
|
-
return target;
|
|
2478
|
-
}
|
|
2479
|
-
|
|
2480
|
-
if (typeof source !== 'object') {
|
|
2481
|
-
if (isArray$2(target)) {
|
|
2482
|
-
target.push(source);
|
|
2483
|
-
} else if (target && typeof target === 'object') {
|
|
2484
|
-
if ((options && (options.plainObjects || options.allowPrototypes)) || !has$2.call(Object.prototype, source)) {
|
|
2485
|
-
target[source] = true;
|
|
2486
|
-
}
|
|
2487
|
-
} else {
|
|
2488
|
-
return [target, source];
|
|
2489
|
-
}
|
|
2490
|
-
|
|
2491
|
-
return target;
|
|
2492
|
-
}
|
|
2493
|
-
|
|
2494
|
-
if (!target || typeof target !== 'object') {
|
|
2495
|
-
return [target].concat(source);
|
|
2496
|
-
}
|
|
2497
|
-
|
|
2498
|
-
var mergeTarget = target;
|
|
2499
|
-
if (isArray$2(target) && !isArray$2(source)) {
|
|
2500
|
-
mergeTarget = arrayToObject(target, options);
|
|
2501
|
-
}
|
|
2502
|
-
|
|
2503
|
-
if (isArray$2(target) && isArray$2(source)) {
|
|
2504
|
-
source.forEach(function (item, i) {
|
|
2505
|
-
if (has$2.call(target, i)) {
|
|
2506
|
-
var targetItem = target[i];
|
|
2507
|
-
if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
|
|
2508
|
-
target[i] = merge(targetItem, item, options);
|
|
2509
|
-
} else {
|
|
2510
|
-
target.push(item);
|
|
2511
|
-
}
|
|
2512
|
-
} else {
|
|
2513
|
-
target[i] = item;
|
|
2514
|
-
}
|
|
2515
|
-
});
|
|
2516
|
-
return target;
|
|
2517
|
-
}
|
|
2518
|
-
|
|
2519
|
-
return Object.keys(source).reduce(function (acc, key) {
|
|
2520
|
-
var value = source[key];
|
|
2521
|
-
|
|
2522
|
-
if (has$2.call(acc, key)) {
|
|
2523
|
-
acc[key] = merge(acc[key], value, options);
|
|
2524
|
-
} else {
|
|
2525
|
-
acc[key] = value;
|
|
2526
|
-
}
|
|
2527
|
-
return acc;
|
|
2528
|
-
}, mergeTarget);
|
|
2529
|
-
};
|
|
2530
|
-
|
|
2531
|
-
var assign = function assignSingleSource(target, source) {
|
|
2532
|
-
return Object.keys(source).reduce(function (acc, key) {
|
|
2533
|
-
acc[key] = source[key];
|
|
2534
|
-
return acc;
|
|
2535
|
-
}, target);
|
|
2536
|
-
};
|
|
2537
|
-
|
|
2538
|
-
var decode = function (str, decoder, charset) {
|
|
2539
|
-
var strWithoutPlus = str.replace(/\+/g, ' ');
|
|
2540
|
-
if (charset === 'iso-8859-1') {
|
|
2541
|
-
// unescape never throws, no try...catch needed:
|
|
2542
|
-
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
|
|
2543
|
-
}
|
|
2544
|
-
// utf-8
|
|
2545
|
-
try {
|
|
2546
|
-
return decodeURIComponent(strWithoutPlus);
|
|
2547
|
-
} catch (e) {
|
|
2548
|
-
return strWithoutPlus;
|
|
2549
|
-
}
|
|
2550
|
-
};
|
|
2551
|
-
|
|
2552
|
-
var encode = function encode(str, defaultEncoder, charset, kind, format) {
|
|
2553
|
-
// This code was originally written by Brian White (mscdex) for the io.js core querystring library.
|
|
2554
|
-
// It has been adapted here for stricter adherence to RFC 3986
|
|
2555
|
-
if (str.length === 0) {
|
|
2556
|
-
return str;
|
|
2557
|
-
}
|
|
2558
|
-
|
|
2559
|
-
var string = str;
|
|
2560
|
-
if (typeof str === 'symbol') {
|
|
2561
|
-
string = Symbol.prototype.toString.call(str);
|
|
2562
|
-
} else if (typeof str !== 'string') {
|
|
2563
|
-
string = String(str);
|
|
2564
|
-
}
|
|
2565
|
-
|
|
2566
|
-
if (charset === 'iso-8859-1') {
|
|
2567
|
-
return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
|
|
2568
|
-
return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
|
|
2569
|
-
});
|
|
2570
|
-
}
|
|
2571
|
-
|
|
2572
|
-
var out = '';
|
|
2573
|
-
for (var i = 0; i < string.length; ++i) {
|
|
2574
|
-
var c = string.charCodeAt(i);
|
|
2575
|
-
|
|
2576
|
-
if (
|
|
2577
|
-
c === 0x2D // -
|
|
2578
|
-
|| c === 0x2E // .
|
|
2579
|
-
|| c === 0x5F // _
|
|
2580
|
-
|| c === 0x7E // ~
|
|
2581
|
-
|| (c >= 0x30 && c <= 0x39) // 0-9
|
|
2582
|
-
|| (c >= 0x41 && c <= 0x5A) // a-z
|
|
2583
|
-
|| (c >= 0x61 && c <= 0x7A) // A-Z
|
|
2584
|
-
|| (format === formats$2.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
|
|
2585
|
-
) {
|
|
2586
|
-
out += string.charAt(i);
|
|
2587
|
-
continue;
|
|
2588
|
-
}
|
|
2589
|
-
|
|
2590
|
-
if (c < 0x80) {
|
|
2591
|
-
out = out + hexTable[c];
|
|
2592
|
-
continue;
|
|
2593
|
-
}
|
|
2594
|
-
|
|
2595
|
-
if (c < 0x800) {
|
|
2596
|
-
out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
|
|
2597
|
-
continue;
|
|
2598
|
-
}
|
|
2599
|
-
|
|
2600
|
-
if (c < 0xD800 || c >= 0xE000) {
|
|
2601
|
-
out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
|
|
2602
|
-
continue;
|
|
2603
|
-
}
|
|
2604
|
-
|
|
2605
|
-
i += 1;
|
|
2606
|
-
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
|
2607
|
-
/* eslint operator-linebreak: [2, "before"] */
|
|
2608
|
-
out += hexTable[0xF0 | (c >> 18)]
|
|
2609
|
-
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
|
|
2610
|
-
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
|
2611
|
-
+ hexTable[0x80 | (c & 0x3F)];
|
|
2612
|
-
}
|
|
2613
|
-
|
|
2614
|
-
return out;
|
|
2615
|
-
};
|
|
2616
|
-
|
|
2617
|
-
var compact = function compact(value) {
|
|
2618
|
-
var queue = [{ obj: { o: value }, prop: 'o' }];
|
|
2619
|
-
var refs = [];
|
|
2620
|
-
|
|
2621
|
-
for (var i = 0; i < queue.length; ++i) {
|
|
2622
|
-
var item = queue[i];
|
|
2623
|
-
var obj = item.obj[item.prop];
|
|
2624
|
-
|
|
2625
|
-
var keys = Object.keys(obj);
|
|
2626
|
-
for (var j = 0; j < keys.length; ++j) {
|
|
2627
|
-
var key = keys[j];
|
|
2628
|
-
var val = obj[key];
|
|
2629
|
-
if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
|
|
2630
|
-
queue.push({ obj: obj, prop: key });
|
|
2631
|
-
refs.push(val);
|
|
2632
|
-
}
|
|
2633
|
-
}
|
|
2634
|
-
}
|
|
2635
|
-
|
|
2636
|
-
compactQueue(queue);
|
|
2637
|
-
|
|
2638
|
-
return value;
|
|
2639
|
-
};
|
|
2640
|
-
|
|
2641
|
-
var isRegExp = function isRegExp(obj) {
|
|
2642
|
-
return Object.prototype.toString.call(obj) === '[object RegExp]';
|
|
2643
|
-
};
|
|
2644
|
-
|
|
2645
|
-
var isBuffer = function isBuffer(obj) {
|
|
2646
|
-
if (!obj || typeof obj !== 'object') {
|
|
2647
|
-
return false;
|
|
2648
|
-
}
|
|
2649
|
-
|
|
2650
|
-
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
|
2651
|
-
};
|
|
2652
|
-
|
|
2653
|
-
var combine = function combine(a, b) {
|
|
2654
|
-
return [].concat(a, b);
|
|
2655
|
-
};
|
|
2656
|
-
|
|
2657
|
-
var maybeMap = function maybeMap(val, fn) {
|
|
2658
|
-
if (isArray$2(val)) {
|
|
2659
|
-
var mapped = [];
|
|
2660
|
-
for (var i = 0; i < val.length; i += 1) {
|
|
2661
|
-
mapped.push(fn(val[i]));
|
|
2662
|
-
}
|
|
2663
|
-
return mapped;
|
|
2664
|
-
}
|
|
2665
|
-
return fn(val);
|
|
2666
|
-
};
|
|
2667
|
-
|
|
2668
|
-
var utils$2 = {
|
|
2669
|
-
arrayToObject: arrayToObject,
|
|
2670
|
-
assign: assign,
|
|
2671
|
-
combine: combine,
|
|
2672
|
-
compact: compact,
|
|
2673
|
-
decode: decode,
|
|
2674
|
-
encode: encode,
|
|
2675
|
-
isBuffer: isBuffer,
|
|
2676
|
-
isRegExp: isRegExp,
|
|
2677
|
-
maybeMap: maybeMap,
|
|
2678
|
-
merge: merge
|
|
2679
|
-
};
|
|
2680
|
-
|
|
2681
|
-
var getSideChannel = sideChannel;
|
|
2682
|
-
var utils$1 = utils$2;
|
|
2683
|
-
var formats$1 = formats$3;
|
|
2684
|
-
var has$1 = Object.prototype.hasOwnProperty;
|
|
2685
|
-
|
|
2686
|
-
var arrayPrefixGenerators = {
|
|
2687
|
-
brackets: function brackets(prefix) {
|
|
2688
|
-
return prefix + '[]';
|
|
2689
|
-
},
|
|
2690
|
-
comma: 'comma',
|
|
2691
|
-
indices: function indices(prefix, key) {
|
|
2692
|
-
return prefix + '[' + key + ']';
|
|
2693
|
-
},
|
|
2694
|
-
repeat: function repeat(prefix) {
|
|
2695
|
-
return prefix;
|
|
2696
|
-
}
|
|
2697
|
-
};
|
|
2698
|
-
|
|
2699
|
-
var isArray$1 = Array.isArray;
|
|
2700
|
-
var push = Array.prototype.push;
|
|
2701
|
-
var pushToArray = function (arr, valueOrArray) {
|
|
2702
|
-
push.apply(arr, isArray$1(valueOrArray) ? valueOrArray : [valueOrArray]);
|
|
2703
|
-
};
|
|
2704
|
-
|
|
2705
|
-
var toISO = Date.prototype.toISOString;
|
|
2706
|
-
|
|
2707
|
-
var defaultFormat = formats$1['default'];
|
|
2708
|
-
var defaults$1 = {
|
|
2709
|
-
addQueryPrefix: false,
|
|
2710
|
-
allowDots: false,
|
|
2711
|
-
charset: 'utf-8',
|
|
2712
|
-
charsetSentinel: false,
|
|
2713
|
-
delimiter: '&',
|
|
2714
|
-
encode: true,
|
|
2715
|
-
encoder: utils$1.encode,
|
|
2716
|
-
encodeValuesOnly: false,
|
|
2717
|
-
format: defaultFormat,
|
|
2718
|
-
formatter: formats$1.formatters[defaultFormat],
|
|
2719
|
-
// deprecated
|
|
2720
|
-
indices: false,
|
|
2721
|
-
serializeDate: function serializeDate(date) {
|
|
2722
|
-
return toISO.call(date);
|
|
2723
|
-
},
|
|
2724
|
-
skipNulls: false,
|
|
2725
|
-
strictNullHandling: false
|
|
2726
|
-
};
|
|
2727
|
-
|
|
2728
|
-
var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
|
|
2729
|
-
return typeof v === 'string'
|
|
2730
|
-
|| typeof v === 'number'
|
|
2731
|
-
|| typeof v === 'boolean'
|
|
2732
|
-
|| typeof v === 'symbol'
|
|
2733
|
-
|| typeof v === 'bigint';
|
|
2734
|
-
};
|
|
2735
|
-
|
|
2736
|
-
var sentinel = {};
|
|
2737
|
-
|
|
2738
|
-
var stringify$1 = function stringify(
|
|
2739
|
-
object,
|
|
2740
|
-
prefix,
|
|
2741
|
-
generateArrayPrefix,
|
|
2742
|
-
commaRoundTrip,
|
|
2743
|
-
strictNullHandling,
|
|
2744
|
-
skipNulls,
|
|
2745
|
-
encoder,
|
|
2746
|
-
filter,
|
|
2747
|
-
sort,
|
|
2748
|
-
allowDots,
|
|
2749
|
-
serializeDate,
|
|
2750
|
-
format,
|
|
2751
|
-
formatter,
|
|
2752
|
-
encodeValuesOnly,
|
|
2753
|
-
charset,
|
|
2754
|
-
sideChannel
|
|
2755
|
-
) {
|
|
2756
|
-
var obj = object;
|
|
2757
|
-
|
|
2758
|
-
var tmpSc = sideChannel;
|
|
2759
|
-
var step = 0;
|
|
2760
|
-
var findFlag = false;
|
|
2761
|
-
while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
|
|
2762
|
-
// Where object last appeared in the ref tree
|
|
2763
|
-
var pos = tmpSc.get(object);
|
|
2764
|
-
step += 1;
|
|
2765
|
-
if (typeof pos !== 'undefined') {
|
|
2766
|
-
if (pos === step) {
|
|
2767
|
-
throw new RangeError('Cyclic object value');
|
|
2768
|
-
} else {
|
|
2769
|
-
findFlag = true; // Break while
|
|
2770
|
-
}
|
|
2771
|
-
}
|
|
2772
|
-
if (typeof tmpSc.get(sentinel) === 'undefined') {
|
|
2773
|
-
step = 0;
|
|
2774
|
-
}
|
|
2775
|
-
}
|
|
2776
|
-
|
|
2777
|
-
if (typeof filter === 'function') {
|
|
2778
|
-
obj = filter(prefix, obj);
|
|
2779
|
-
} else if (obj instanceof Date) {
|
|
2780
|
-
obj = serializeDate(obj);
|
|
2781
|
-
} else if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
|
|
2782
|
-
obj = utils$1.maybeMap(obj, function (value) {
|
|
2783
|
-
if (value instanceof Date) {
|
|
2784
|
-
return serializeDate(value);
|
|
2785
|
-
}
|
|
2786
|
-
return value;
|
|
2787
|
-
});
|
|
2788
|
-
}
|
|
2789
|
-
|
|
2790
|
-
if (obj === null) {
|
|
2791
|
-
if (strictNullHandling) {
|
|
2792
|
-
return encoder && !encodeValuesOnly ? encoder(prefix, defaults$1.encoder, charset, 'key', format) : prefix;
|
|
2793
|
-
}
|
|
2794
|
-
|
|
2795
|
-
obj = '';
|
|
2796
|
-
}
|
|
2797
|
-
|
|
2798
|
-
if (isNonNullishPrimitive(obj) || utils$1.isBuffer(obj)) {
|
|
2799
|
-
if (encoder) {
|
|
2800
|
-
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults$1.encoder, charset, 'key', format);
|
|
2801
|
-
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults$1.encoder, charset, 'value', format))];
|
|
2802
|
-
}
|
|
2803
|
-
return [formatter(prefix) + '=' + formatter(String(obj))];
|
|
2804
|
-
}
|
|
2805
|
-
|
|
2806
|
-
var values = [];
|
|
2807
|
-
|
|
2808
|
-
if (typeof obj === 'undefined') {
|
|
2809
|
-
return values;
|
|
2810
|
-
}
|
|
2811
|
-
|
|
2812
|
-
var objKeys;
|
|
2813
|
-
if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
|
|
2814
|
-
// we need to join elements in
|
|
2815
|
-
if (encodeValuesOnly && encoder) {
|
|
2816
|
-
obj = utils$1.maybeMap(obj, encoder);
|
|
2817
|
-
}
|
|
2818
|
-
objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
|
|
2819
|
-
} else if (isArray$1(filter)) {
|
|
2820
|
-
objKeys = filter;
|
|
2821
|
-
} else {
|
|
2822
|
-
var keys = Object.keys(obj);
|
|
2823
|
-
objKeys = sort ? keys.sort(sort) : keys;
|
|
2824
|
-
}
|
|
2825
|
-
|
|
2826
|
-
var adjustedPrefix = commaRoundTrip && isArray$1(obj) && obj.length === 1 ? prefix + '[]' : prefix;
|
|
2827
|
-
|
|
2828
|
-
for (var j = 0; j < objKeys.length; ++j) {
|
|
2829
|
-
var key = objKeys[j];
|
|
2830
|
-
var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
|
|
2831
|
-
|
|
2832
|
-
if (skipNulls && value === null) {
|
|
2833
|
-
continue;
|
|
2834
|
-
}
|
|
2835
|
-
|
|
2836
|
-
var keyPrefix = isArray$1(obj)
|
|
2837
|
-
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix
|
|
2838
|
-
: adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
|
|
2839
|
-
|
|
2840
|
-
sideChannel.set(object, step);
|
|
2841
|
-
var valueSideChannel = getSideChannel();
|
|
2842
|
-
valueSideChannel.set(sentinel, sideChannel);
|
|
2843
|
-
pushToArray(values, stringify(
|
|
2844
|
-
value,
|
|
2845
|
-
keyPrefix,
|
|
2846
|
-
generateArrayPrefix,
|
|
2847
|
-
commaRoundTrip,
|
|
2848
|
-
strictNullHandling,
|
|
2849
|
-
skipNulls,
|
|
2850
|
-
generateArrayPrefix === 'comma' && encodeValuesOnly && isArray$1(obj) ? null : encoder,
|
|
2851
|
-
filter,
|
|
2852
|
-
sort,
|
|
2853
|
-
allowDots,
|
|
2854
|
-
serializeDate,
|
|
2855
|
-
format,
|
|
2856
|
-
formatter,
|
|
2857
|
-
encodeValuesOnly,
|
|
2858
|
-
charset,
|
|
2859
|
-
valueSideChannel
|
|
2860
|
-
));
|
|
2861
|
-
}
|
|
2862
|
-
|
|
2863
|
-
return values;
|
|
2864
|
-
};
|
|
2865
|
-
|
|
2866
|
-
var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
|
|
2867
|
-
if (!opts) {
|
|
2868
|
-
return defaults$1;
|
|
2869
|
-
}
|
|
2870
|
-
|
|
2871
|
-
if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
|
|
2872
|
-
throw new TypeError('Encoder has to be a function.');
|
|
2873
|
-
}
|
|
2874
|
-
|
|
2875
|
-
var charset = opts.charset || defaults$1.charset;
|
|
2876
|
-
if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
|
|
2877
|
-
throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
|
|
2878
|
-
}
|
|
2879
|
-
|
|
2880
|
-
var format = formats$1['default'];
|
|
2881
|
-
if (typeof opts.format !== 'undefined') {
|
|
2882
|
-
if (!has$1.call(formats$1.formatters, opts.format)) {
|
|
2883
|
-
throw new TypeError('Unknown format option provided.');
|
|
2884
|
-
}
|
|
2885
|
-
format = opts.format;
|
|
2886
|
-
}
|
|
2887
|
-
var formatter = formats$1.formatters[format];
|
|
2888
|
-
|
|
2889
|
-
var filter = defaults$1.filter;
|
|
2890
|
-
if (typeof opts.filter === 'function' || isArray$1(opts.filter)) {
|
|
2891
|
-
filter = opts.filter;
|
|
2892
|
-
}
|
|
2893
|
-
|
|
2894
|
-
return {
|
|
2895
|
-
addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults$1.addQueryPrefix,
|
|
2896
|
-
allowDots: typeof opts.allowDots === 'undefined' ? defaults$1.allowDots : !!opts.allowDots,
|
|
2897
|
-
charset: charset,
|
|
2898
|
-
charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults$1.charsetSentinel,
|
|
2899
|
-
delimiter: typeof opts.delimiter === 'undefined' ? defaults$1.delimiter : opts.delimiter,
|
|
2900
|
-
encode: typeof opts.encode === 'boolean' ? opts.encode : defaults$1.encode,
|
|
2901
|
-
encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults$1.encoder,
|
|
2902
|
-
encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults$1.encodeValuesOnly,
|
|
2903
|
-
filter: filter,
|
|
2904
|
-
format: format,
|
|
2905
|
-
formatter: formatter,
|
|
2906
|
-
serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults$1.serializeDate,
|
|
2907
|
-
skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults$1.skipNulls,
|
|
2908
|
-
sort: typeof opts.sort === 'function' ? opts.sort : null,
|
|
2909
|
-
strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults$1.strictNullHandling
|
|
2910
|
-
};
|
|
2911
|
-
};
|
|
2912
|
-
|
|
2913
|
-
var stringify_1 = function (object, opts) {
|
|
2914
|
-
var obj = object;
|
|
2915
|
-
var options = normalizeStringifyOptions(opts);
|
|
2916
|
-
|
|
2917
|
-
var objKeys;
|
|
2918
|
-
var filter;
|
|
2919
|
-
|
|
2920
|
-
if (typeof options.filter === 'function') {
|
|
2921
|
-
filter = options.filter;
|
|
2922
|
-
obj = filter('', obj);
|
|
2923
|
-
} else if (isArray$1(options.filter)) {
|
|
2924
|
-
filter = options.filter;
|
|
2925
|
-
objKeys = filter;
|
|
2926
|
-
}
|
|
2927
|
-
|
|
2928
|
-
var keys = [];
|
|
2929
|
-
|
|
2930
|
-
if (typeof obj !== 'object' || obj === null) {
|
|
2931
|
-
return '';
|
|
2932
|
-
}
|
|
2933
|
-
|
|
2934
|
-
var arrayFormat;
|
|
2935
|
-
if (opts && opts.arrayFormat in arrayPrefixGenerators) {
|
|
2936
|
-
arrayFormat = opts.arrayFormat;
|
|
2937
|
-
} else if (opts && 'indices' in opts) {
|
|
2938
|
-
arrayFormat = opts.indices ? 'indices' : 'repeat';
|
|
2939
|
-
} else {
|
|
2940
|
-
arrayFormat = 'indices';
|
|
2941
|
-
}
|
|
2942
|
-
|
|
2943
|
-
var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
|
|
2944
|
-
if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
|
|
2945
|
-
throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
|
|
2946
|
-
}
|
|
2947
|
-
var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip;
|
|
2948
|
-
|
|
2949
|
-
if (!objKeys) {
|
|
2950
|
-
objKeys = Object.keys(obj);
|
|
2951
|
-
}
|
|
2952
|
-
|
|
2953
|
-
if (options.sort) {
|
|
2954
|
-
objKeys.sort(options.sort);
|
|
2955
|
-
}
|
|
2956
|
-
|
|
2957
|
-
var sideChannel = getSideChannel();
|
|
2958
|
-
for (var i = 0; i < objKeys.length; ++i) {
|
|
2959
|
-
var key = objKeys[i];
|
|
2960
|
-
|
|
2961
|
-
if (options.skipNulls && obj[key] === null) {
|
|
2962
|
-
continue;
|
|
2963
|
-
}
|
|
2964
|
-
pushToArray(keys, stringify$1(
|
|
2965
|
-
obj[key],
|
|
2966
|
-
key,
|
|
2967
|
-
generateArrayPrefix,
|
|
2968
|
-
commaRoundTrip,
|
|
2969
|
-
options.strictNullHandling,
|
|
2970
|
-
options.skipNulls,
|
|
2971
|
-
options.encode ? options.encoder : null,
|
|
2972
|
-
options.filter,
|
|
2973
|
-
options.sort,
|
|
2974
|
-
options.allowDots,
|
|
2975
|
-
options.serializeDate,
|
|
2976
|
-
options.format,
|
|
2977
|
-
options.formatter,
|
|
2978
|
-
options.encodeValuesOnly,
|
|
2979
|
-
options.charset,
|
|
2980
|
-
sideChannel
|
|
2981
|
-
));
|
|
2982
|
-
}
|
|
2983
|
-
|
|
2984
|
-
var joined = keys.join(options.delimiter);
|
|
2985
|
-
var prefix = options.addQueryPrefix === true ? '?' : '';
|
|
2986
|
-
|
|
2987
|
-
if (options.charsetSentinel) {
|
|
2988
|
-
if (options.charset === 'iso-8859-1') {
|
|
2989
|
-
// encodeURIComponent('✓'), the "numeric entity" representation of a checkmark
|
|
2990
|
-
prefix += 'utf8=%26%2310003%3B&';
|
|
2991
|
-
} else {
|
|
2992
|
-
// encodeURIComponent('✓')
|
|
2993
|
-
prefix += 'utf8=%E2%9C%93&';
|
|
2994
|
-
}
|
|
2995
|
-
}
|
|
2996
|
-
|
|
2997
|
-
return joined.length > 0 ? prefix + joined : '';
|
|
2998
|
-
};
|
|
2999
|
-
|
|
3000
|
-
var utils = utils$2;
|
|
3001
|
-
|
|
3002
|
-
var has = Object.prototype.hasOwnProperty;
|
|
3003
|
-
var isArray = Array.isArray;
|
|
3004
|
-
|
|
3005
|
-
var defaults = {
|
|
3006
|
-
allowDots: false,
|
|
3007
|
-
allowPrototypes: false,
|
|
3008
|
-
allowSparse: false,
|
|
3009
|
-
arrayLimit: 20,
|
|
3010
|
-
charset: 'utf-8',
|
|
3011
|
-
charsetSentinel: false,
|
|
3012
|
-
comma: false,
|
|
3013
|
-
decoder: utils.decode,
|
|
3014
|
-
delimiter: '&',
|
|
3015
|
-
depth: 5,
|
|
3016
|
-
ignoreQueryPrefix: false,
|
|
3017
|
-
interpretNumericEntities: false,
|
|
3018
|
-
parameterLimit: 1000,
|
|
3019
|
-
parseArrays: true,
|
|
3020
|
-
plainObjects: false,
|
|
3021
|
-
strictNullHandling: false
|
|
3022
|
-
};
|
|
3023
|
-
|
|
3024
|
-
var interpretNumericEntities = function (str) {
|
|
3025
|
-
return str.replace(/&#(\d+);/g, function ($0, numberStr) {
|
|
3026
|
-
return String.fromCharCode(parseInt(numberStr, 10));
|
|
3027
|
-
});
|
|
3028
|
-
};
|
|
3029
|
-
|
|
3030
|
-
var parseArrayValue = function (val, options) {
|
|
3031
|
-
if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
|
|
3032
|
-
return val.split(',');
|
|
3033
|
-
}
|
|
3034
|
-
|
|
3035
|
-
return val;
|
|
3036
|
-
};
|
|
3037
|
-
|
|
3038
|
-
// This is what browsers will submit when the ✓ character occurs in an
|
|
3039
|
-
// application/x-www-form-urlencoded body and the encoding of the page containing
|
|
3040
|
-
// the form is iso-8859-1, or when the submitted form has an accept-charset
|
|
3041
|
-
// attribute of iso-8859-1. Presumably also with other charsets that do not contain
|
|
3042
|
-
// the ✓ character, such as us-ascii.
|
|
3043
|
-
var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('✓')
|
|
3044
|
-
|
|
3045
|
-
// These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
|
|
3046
|
-
var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
|
|
3047
|
-
|
|
3048
|
-
var parseValues = function parseQueryStringValues(str, options) {
|
|
3049
|
-
var obj = {};
|
|
3050
|
-
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
|
|
3051
|
-
var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
|
|
3052
|
-
var parts = cleanStr.split(options.delimiter, limit);
|
|
3053
|
-
var skipIndex = -1; // Keep track of where the utf8 sentinel was found
|
|
3054
|
-
var i;
|
|
3055
|
-
|
|
3056
|
-
var charset = options.charset;
|
|
3057
|
-
if (options.charsetSentinel) {
|
|
3058
|
-
for (i = 0; i < parts.length; ++i) {
|
|
3059
|
-
if (parts[i].indexOf('utf8=') === 0) {
|
|
3060
|
-
if (parts[i] === charsetSentinel) {
|
|
3061
|
-
charset = 'utf-8';
|
|
3062
|
-
} else if (parts[i] === isoSentinel) {
|
|
3063
|
-
charset = 'iso-8859-1';
|
|
3064
|
-
}
|
|
3065
|
-
skipIndex = i;
|
|
3066
|
-
i = parts.length; // The eslint settings do not allow break;
|
|
3067
|
-
}
|
|
3068
|
-
}
|
|
3069
|
-
}
|
|
3070
|
-
|
|
3071
|
-
for (i = 0; i < parts.length; ++i) {
|
|
3072
|
-
if (i === skipIndex) {
|
|
3073
|
-
continue;
|
|
3074
|
-
}
|
|
3075
|
-
var part = parts[i];
|
|
3076
|
-
|
|
3077
|
-
var bracketEqualsPos = part.indexOf(']=');
|
|
3078
|
-
var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
|
|
3079
|
-
|
|
3080
|
-
var key, val;
|
|
3081
|
-
if (pos === -1) {
|
|
3082
|
-
key = options.decoder(part, defaults.decoder, charset, 'key');
|
|
3083
|
-
val = options.strictNullHandling ? null : '';
|
|
3084
|
-
} else {
|
|
3085
|
-
key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
|
|
3086
|
-
val = utils.maybeMap(
|
|
3087
|
-
parseArrayValue(part.slice(pos + 1), options),
|
|
3088
|
-
function (encodedVal) {
|
|
3089
|
-
return options.decoder(encodedVal, defaults.decoder, charset, 'value');
|
|
3090
|
-
}
|
|
3091
|
-
);
|
|
3092
|
-
}
|
|
3093
|
-
|
|
3094
|
-
if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
|
|
3095
|
-
val = interpretNumericEntities(val);
|
|
3096
|
-
}
|
|
3097
|
-
|
|
3098
|
-
if (part.indexOf('[]=') > -1) {
|
|
3099
|
-
val = isArray(val) ? [val] : val;
|
|
3100
|
-
}
|
|
3101
|
-
|
|
3102
|
-
if (has.call(obj, key)) {
|
|
3103
|
-
obj[key] = utils.combine(obj[key], val);
|
|
3104
|
-
} else {
|
|
3105
|
-
obj[key] = val;
|
|
3106
|
-
}
|
|
3107
|
-
}
|
|
3108
|
-
|
|
3109
|
-
return obj;
|
|
3110
|
-
};
|
|
3111
|
-
|
|
3112
|
-
var parseObject = function (chain, val, options, valuesParsed) {
|
|
3113
|
-
var leaf = valuesParsed ? val : parseArrayValue(val, options);
|
|
3114
|
-
|
|
3115
|
-
for (var i = chain.length - 1; i >= 0; --i) {
|
|
3116
|
-
var obj;
|
|
3117
|
-
var root = chain[i];
|
|
3118
|
-
|
|
3119
|
-
if (root === '[]' && options.parseArrays) {
|
|
3120
|
-
obj = [].concat(leaf);
|
|
3121
|
-
} else {
|
|
3122
|
-
obj = options.plainObjects ? Object.create(null) : {};
|
|
3123
|
-
var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
|
|
3124
|
-
var index = parseInt(cleanRoot, 10);
|
|
3125
|
-
if (!options.parseArrays && cleanRoot === '') {
|
|
3126
|
-
obj = { 0: leaf };
|
|
3127
|
-
} else if (
|
|
3128
|
-
!isNaN(index)
|
|
3129
|
-
&& root !== cleanRoot
|
|
3130
|
-
&& String(index) === cleanRoot
|
|
3131
|
-
&& index >= 0
|
|
3132
|
-
&& (options.parseArrays && index <= options.arrayLimit)
|
|
3133
|
-
) {
|
|
3134
|
-
obj = [];
|
|
3135
|
-
obj[index] = leaf;
|
|
3136
|
-
} else if (cleanRoot !== '__proto__') {
|
|
3137
|
-
obj[cleanRoot] = leaf;
|
|
3138
|
-
}
|
|
3139
|
-
}
|
|
3140
|
-
|
|
3141
|
-
leaf = obj;
|
|
3142
|
-
}
|
|
3143
|
-
|
|
3144
|
-
return leaf;
|
|
3145
|
-
};
|
|
3146
|
-
|
|
3147
|
-
var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
|
|
3148
|
-
if (!givenKey) {
|
|
3149
|
-
return;
|
|
3150
|
-
}
|
|
3151
|
-
|
|
3152
|
-
// Transform dot notation to bracket notation
|
|
3153
|
-
var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
|
|
3154
|
-
|
|
3155
|
-
// The regex chunks
|
|
3156
|
-
|
|
3157
|
-
var brackets = /(\[[^[\]]*])/;
|
|
3158
|
-
var child = /(\[[^[\]]*])/g;
|
|
3159
|
-
|
|
3160
|
-
// Get the parent
|
|
3161
|
-
|
|
3162
|
-
var segment = options.depth > 0 && brackets.exec(key);
|
|
3163
|
-
var parent = segment ? key.slice(0, segment.index) : key;
|
|
3164
|
-
|
|
3165
|
-
// Stash the parent if it exists
|
|
3166
|
-
|
|
3167
|
-
var keys = [];
|
|
3168
|
-
if (parent) {
|
|
3169
|
-
// If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
|
|
3170
|
-
if (!options.plainObjects && has.call(Object.prototype, parent)) {
|
|
3171
|
-
if (!options.allowPrototypes) {
|
|
3172
|
-
return;
|
|
3173
|
-
}
|
|
3174
|
-
}
|
|
3175
|
-
|
|
3176
|
-
keys.push(parent);
|
|
3177
|
-
}
|
|
3178
|
-
|
|
3179
|
-
// Loop through children appending to the array until we hit depth
|
|
3180
|
-
|
|
3181
|
-
var i = 0;
|
|
3182
|
-
while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
|
|
3183
|
-
i += 1;
|
|
3184
|
-
if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
|
|
3185
|
-
if (!options.allowPrototypes) {
|
|
3186
|
-
return;
|
|
3187
|
-
}
|
|
3188
|
-
}
|
|
3189
|
-
keys.push(segment[1]);
|
|
3190
|
-
}
|
|
3191
|
-
|
|
3192
|
-
// If there's a remainder, just add whatever is left
|
|
3193
|
-
|
|
3194
|
-
if (segment) {
|
|
3195
|
-
keys.push('[' + key.slice(segment.index) + ']');
|
|
3196
|
-
}
|
|
3197
|
-
|
|
3198
|
-
return parseObject(keys, val, options, valuesParsed);
|
|
3199
|
-
};
|
|
3200
|
-
|
|
3201
|
-
var normalizeParseOptions = function normalizeParseOptions(opts) {
|
|
3202
|
-
if (!opts) {
|
|
3203
|
-
return defaults;
|
|
3204
|
-
}
|
|
3205
|
-
|
|
3206
|
-
if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {
|
|
3207
|
-
throw new TypeError('Decoder has to be a function.');
|
|
3208
|
-
}
|
|
3209
|
-
|
|
3210
|
-
if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
|
|
3211
|
-
throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
|
|
3212
|
-
}
|
|
3213
|
-
var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
|
|
3214
|
-
|
|
3215
|
-
return {
|
|
3216
|
-
allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
|
|
3217
|
-
allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
|
|
3218
|
-
allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
|
|
3219
|
-
arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
|
|
3220
|
-
charset: charset,
|
|
3221
|
-
charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
|
|
3222
|
-
comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
|
|
3223
|
-
decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
|
|
3224
|
-
delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
|
|
3225
|
-
// eslint-disable-next-line no-implicit-coercion, no-extra-parens
|
|
3226
|
-
depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,
|
|
3227
|
-
ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
|
|
3228
|
-
interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
|
|
3229
|
-
parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
|
|
3230
|
-
parseArrays: opts.parseArrays !== false,
|
|
3231
|
-
plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
|
|
3232
|
-
strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
|
|
3233
|
-
};
|
|
3234
|
-
};
|
|
3235
|
-
|
|
3236
|
-
var parse$1 = function (str, opts) {
|
|
3237
|
-
var options = normalizeParseOptions(opts);
|
|
3238
|
-
|
|
3239
|
-
if (str === '' || str === null || typeof str === 'undefined') {
|
|
3240
|
-
return options.plainObjects ? Object.create(null) : {};
|
|
3241
|
-
}
|
|
3242
|
-
|
|
3243
|
-
var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
|
|
3244
|
-
var obj = options.plainObjects ? Object.create(null) : {};
|
|
3245
|
-
|
|
3246
|
-
// Iterate over the keys and setup the new object
|
|
3247
|
-
|
|
3248
|
-
var keys = Object.keys(tempObj);
|
|
3249
|
-
for (var i = 0; i < keys.length; ++i) {
|
|
3250
|
-
var key = keys[i];
|
|
3251
|
-
var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
|
|
3252
|
-
obj = utils.merge(obj, newObj, options);
|
|
3253
|
-
}
|
|
3254
|
-
|
|
3255
|
-
if (options.allowSparse === true) {
|
|
3256
|
-
return obj;
|
|
3257
|
-
}
|
|
3258
|
-
|
|
3259
|
-
return utils.compact(obj);
|
|
3260
|
-
};
|
|
3261
|
-
|
|
3262
|
-
var stringify = stringify_1;
|
|
3263
|
-
var parse = parse$1;
|
|
3264
|
-
var formats = formats$3;
|
|
3265
|
-
|
|
3266
|
-
var lib = {
|
|
3267
|
-
formats: formats,
|
|
3268
|
-
parse: parse,
|
|
3269
|
-
stringify: stringify
|
|
3270
|
-
};
|
|
3271
|
-
|
|
3272
|
-
class AccountBillingPlanAPI {
|
|
3273
|
-
constructor(client) {
|
|
3274
|
-
this.client = client;
|
|
3275
|
-
/**
|
|
3276
|
-
* The `get` method retrieves the account billing plan for the current user.
|
|
3277
|
-
*/
|
|
3278
|
-
this.get = () => {
|
|
3279
|
-
return this.client.get("/v1/account/billing_plan");
|
|
3280
|
-
};
|
|
3281
|
-
this.client = client;
|
|
3282
|
-
}
|
|
3283
|
-
}
|
|
3284
|
-
|
|
3285
|
-
class CustomPackagesAPI {
|
|
3286
|
-
constructor(client) {
|
|
3287
|
-
this.client = client;
|
|
3288
|
-
/**
|
|
3289
|
-
* The `list` method retrieves a list of custom packages a given user has created.
|
|
3290
|
-
*/
|
|
3291
|
-
this.list = () => {
|
|
3292
|
-
return this.client.get("/v1/packages");
|
|
3293
|
-
};
|
|
3294
|
-
this.client = client;
|
|
3295
|
-
}
|
|
3296
|
-
}
|
|
3297
|
-
|
|
3298
|
-
var __defProp$1 = Object.defineProperty;
|
|
3299
|
-
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
3300
|
-
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
3301
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
3302
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3303
|
-
var __spreadValues$1 = (a, b) => {
|
|
3304
|
-
for (var prop in b || (b = {}))
|
|
3305
|
-
if (__hasOwnProp$1.call(b, prop))
|
|
3306
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
3307
|
-
if (__getOwnPropSymbols$1)
|
|
3308
|
-
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
3309
|
-
if (__propIsEnum$1.call(b, prop))
|
|
3310
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
3311
|
-
}
|
|
3312
|
-
return a;
|
|
3313
|
-
};
|
|
3314
|
-
var __async$2 = (__this, __arguments, generator) => {
|
|
3315
|
-
return new Promise((resolve, reject) => {
|
|
3316
|
-
var fulfilled = (value) => {
|
|
3317
|
-
try {
|
|
3318
|
-
step(generator.next(value));
|
|
3319
|
-
} catch (e) {
|
|
3320
|
-
reject(e);
|
|
3321
|
-
}
|
|
3322
|
-
};
|
|
3323
|
-
var rejected = (value) => {
|
|
3324
|
-
try {
|
|
3325
|
-
step(generator.throw(value));
|
|
3326
|
-
} catch (e) {
|
|
3327
|
-
reject(e);
|
|
3328
|
-
}
|
|
3329
|
-
};
|
|
3330
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
3331
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
3332
|
-
});
|
|
3333
|
-
};
|
|
3334
|
-
class FundingSourcesAPI {
|
|
3335
|
-
constructor(client) {
|
|
3336
|
-
this.client = client;
|
|
3337
|
-
/**
|
|
3338
|
-
* The `list` method retrieves a list of funding sources for a given user.
|
|
3339
|
-
*/
|
|
3340
|
-
this.list = () => {
|
|
3341
|
-
return this.client.get("/v1/funding_sources");
|
|
3342
|
-
};
|
|
3343
|
-
/**
|
|
3344
|
-
* The `get` method retrieves a specific funding source by `fundingSourceId`.
|
|
3345
|
-
*/
|
|
3346
|
-
this.get = (fundingSourceId) => {
|
|
3347
|
-
return this.client.get(`/v1/funding_sources/${fundingSourceId}`);
|
|
3348
|
-
};
|
|
3349
|
-
/**
|
|
3350
|
-
* The `create` method creates a new funding source for a given user. This requires
|
|
3351
|
-
* payment information to be collected from the user.
|
|
3352
|
-
*/
|
|
3353
|
-
this.create = (createFundingSource) => __async$2(this, null, function* () {
|
|
3354
|
-
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3355
|
-
if (!endUserIpAddress)
|
|
3356
|
-
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
3357
|
-
return yield this.client.post("/v1/funding_sources", __spreadValues$1({
|
|
3358
|
-
endUserIpAddress
|
|
3359
|
-
}, createFundingSource));
|
|
3360
|
-
});
|
|
3361
|
-
/**
|
|
3362
|
-
* The `update` method updates a funding source for a given user. This allows the
|
|
3363
|
-
* user to update the billing address or payment information associated with the
|
|
3364
|
-
* funding source.
|
|
3365
|
-
*/
|
|
3366
|
-
this.update = (billingInfo, creditCardInfo, fundingSourceId) => __async$2(this, null, function* () {
|
|
3367
|
-
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3368
|
-
if (!endUserIpAddress)
|
|
3369
|
-
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
3370
|
-
return yield this.client.put(
|
|
3371
|
-
`/v1/funding_sources/${fundingSourceId}`,
|
|
3372
|
-
{
|
|
3373
|
-
billingInfo,
|
|
3374
|
-
endUserIpAddress,
|
|
3375
|
-
paymentMethod: { creditCardInfo }
|
|
3376
|
-
}
|
|
3377
|
-
);
|
|
3378
|
-
});
|
|
3379
|
-
/**
|
|
3380
|
-
* The `registerCarrier` method registers a carrier account and associates
|
|
3381
|
-
* it with a given funding source.
|
|
3382
|
-
*/
|
|
3383
|
-
this.registerCarrier = (carrier) => __async$2(this, null, function* () {
|
|
3384
|
-
const endUserIpAddress = yield getEndUserIpAddress();
|
|
3385
|
-
if (!endUserIpAddress)
|
|
3386
|
-
return Promise.reject([new CodedError("Unable to get IP address")]);
|
|
3387
|
-
return yield this.client.post("/v1/registration/funding_source", __spreadValues$1({
|
|
3388
|
-
endUserIpAddress
|
|
3389
|
-
}, carrier));
|
|
3390
|
-
});
|
|
3391
|
-
/**
|
|
3392
|
-
* The `addFunds` method allows you to add funds to a funding source.
|
|
3393
|
-
*/
|
|
3394
|
-
this.addFunds = (amount, fundingSourceId) => __async$2(this, null, function* () {
|
|
3395
|
-
return yield this.client.put(
|
|
3396
|
-
`/v1/funding_sources/${fundingSourceId}/add_funds`,
|
|
3397
|
-
amount
|
|
3398
|
-
);
|
|
3399
|
-
});
|
|
3400
|
-
/**
|
|
3401
|
-
* The `metadata` method returns seller-specific requirements for creating funding sources
|
|
3402
|
-
* and attaching carriers
|
|
3403
|
-
*/
|
|
3404
|
-
this.metadata = () => __async$2(this, null, function* () {
|
|
3405
|
-
return yield this.client.get("/v1/funding_sources/metadata");
|
|
3406
|
-
});
|
|
3407
|
-
this.client = client;
|
|
3408
|
-
}
|
|
3409
|
-
}
|
|
3410
|
-
|
|
3411
|
-
class InsuranceAPI {
|
|
3412
|
-
constructor(client) {
|
|
3413
|
-
this.client = client;
|
|
3414
|
-
/**
|
|
3415
|
-
* The `get` method retrieves the insurance balance for a given `insuranceProvider`
|
|
3416
|
-
* by ID.
|
|
3417
|
-
*/
|
|
3418
|
-
this.get = (insuranceProvider) => {
|
|
3419
|
-
return this.client.get(`/v1/insurance/${insuranceProvider}/balance`);
|
|
3420
|
-
};
|
|
3421
|
-
this.client = client;
|
|
3422
|
-
}
|
|
3423
|
-
}
|
|
3424
|
-
|
|
3425
|
-
class LabelsAPI {
|
|
3426
|
-
constructor(client) {
|
|
3427
|
-
this.client = client;
|
|
3428
|
-
/**
|
|
3429
|
-
* The `get` method retrieves a specific label by `labelId`.
|
|
3430
|
-
*/
|
|
3431
|
-
this.get = (labelId) => {
|
|
3432
|
-
return this.client.get(`/v1/labels/${labelId}`);
|
|
3433
|
-
};
|
|
3434
|
-
/**
|
|
3435
|
-
* The `list` method retrieves a list of labels created by a given user.
|
|
3436
|
-
*/
|
|
3437
|
-
this.list = (params = {}) => {
|
|
3438
|
-
return this.client.get("/v1/labels", { params });
|
|
3439
|
-
};
|
|
3440
|
-
/**
|
|
3441
|
-
* The `createByRateId` allows you to create a shipping label by using a `rateId`
|
|
3442
|
-
* which is a unique identifier tied to a specific rate.
|
|
3443
|
-
*
|
|
3444
|
-
* This helps ensure that when a user is rate shopping, they can purchase a
|
|
3445
|
-
* label for the price they were initially rated.
|
|
3446
|
-
*/
|
|
3447
|
-
this.createByRateId = (rateId, options) => {
|
|
3448
|
-
return this.client.post(`/v1/labels/rates/${rateId}`, options);
|
|
3449
|
-
};
|
|
3450
|
-
/**
|
|
3451
|
-
* The `void` method allows a user to void a label by `labelId`.
|
|
3452
|
-
*/
|
|
3453
|
-
this.void = (labelId) => {
|
|
3454
|
-
return this.client.put(`/v1/labels/${labelId}/void`);
|
|
3455
|
-
};
|
|
3456
|
-
this.client = client;
|
|
3457
|
-
}
|
|
3458
|
-
}
|
|
3459
|
-
|
|
3460
|
-
class OrderSourcesAPI {
|
|
3461
|
-
constructor(client) {
|
|
3462
|
-
this.client = client;
|
|
3463
|
-
/**
|
|
3464
|
-
* The `list` method retrieves a list of connected order sources for a given user.
|
|
3465
|
-
*/
|
|
3466
|
-
this.list = () => {
|
|
3467
|
-
return this.client.get("/v-beta/order_sources");
|
|
3468
|
-
};
|
|
3469
|
-
/**
|
|
3470
|
-
* The `get` method retrieves a specific order source by `orderSourceId`.
|
|
3471
|
-
*/
|
|
3472
|
-
this.get = (orderSourceId) => {
|
|
3473
|
-
return this.client.get(`/v-beta/order_sources/${orderSourceId}`);
|
|
3474
|
-
};
|
|
3475
|
-
/**
|
|
3476
|
-
* The `refresh` method refreshes a specific order source by `orderSourceId`.
|
|
3477
|
-
* This will pull in any `new orders` since the last order import.
|
|
3478
|
-
*/
|
|
3479
|
-
this.refresh = (orderSourceId) => {
|
|
3480
|
-
return this.client.put(`/v-beta/order_sources/${orderSourceId}/refresh`);
|
|
3481
|
-
};
|
|
3482
|
-
this.client = client;
|
|
3483
|
-
}
|
|
3484
|
-
}
|
|
3485
|
-
|
|
3486
|
-
class RateCardsAPI {
|
|
3487
|
-
constructor(client) {
|
|
3488
|
-
this.client = client;
|
|
3489
|
-
/**
|
|
3490
|
-
* The `list` method retrieves a list of rate cards for a given list of carrier ID's.
|
|
3491
|
-
*/
|
|
3492
|
-
this.list = (carrierIds) => {
|
|
3493
|
-
return this.client.get(
|
|
3494
|
-
`/v1/rate_cards?carrier_ids=${carrierIds.toString()}`
|
|
3495
|
-
);
|
|
3496
|
-
};
|
|
3497
|
-
/**
|
|
3498
|
-
* The `get` method retrieves a specific rate card by `rateCardId`.
|
|
3499
|
-
*/
|
|
3500
|
-
this.get = (rateCardId) => {
|
|
3501
|
-
return this.client.get(`/v1/rate_cards/${rateCardId}`);
|
|
3502
|
-
};
|
|
3503
|
-
/**
|
|
3504
|
-
* The `create` method creates a new rate card for a given user.
|
|
3505
|
-
*/
|
|
3506
|
-
this.create = (rateCardInput) => {
|
|
3507
|
-
return this.client.post("/v1/rate_cards", rateCardInput);
|
|
3508
|
-
};
|
|
3509
|
-
/**
|
|
3510
|
-
* The `update` method updates a specific rate card by `rateCardId` with a new
|
|
3511
|
-
* `RateCard`.
|
|
3512
|
-
*/
|
|
3513
|
-
this.update = (rateCard) => {
|
|
3514
|
-
return this.client.put(`/v1/rate_cards/${rateCard.id}`, rateCard);
|
|
3515
|
-
};
|
|
3516
|
-
/**
|
|
3517
|
-
* The `download` method allows for downloading a given rate card by `rateCardId`.
|
|
3518
|
-
*/
|
|
3519
|
-
this.download = (rateCardId) => {
|
|
3520
|
-
return this.client.get(`/v1/rate_cards/${rateCardId}/rates/download`, {
|
|
3521
|
-
headers: {
|
|
3522
|
-
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
3523
|
-
},
|
|
3524
|
-
responseType: "blob"
|
|
3525
|
-
});
|
|
3526
|
-
};
|
|
3527
|
-
/**
|
|
3528
|
-
* The `upload` method allows for uploading a given rate card as a spreadsheet file.
|
|
3529
|
-
*/
|
|
3530
|
-
this.upload = (rateCardId, file) => {
|
|
3531
|
-
const formData = new FormData();
|
|
3532
|
-
formData.append("file", file);
|
|
3533
|
-
return this.client.put(`/v1/rate_cards/${rateCardId}/rates/upload`, formData, {
|
|
3534
|
-
headers: {
|
|
3535
|
-
"Content-Type": "multipart/form-data"
|
|
3536
|
-
}
|
|
3537
|
-
});
|
|
3538
|
-
};
|
|
3539
|
-
/**
|
|
3540
|
-
* The `publish` method allows for publishing a given rate card by `rateCardId`.
|
|
3541
|
-
*/
|
|
3542
|
-
this.publish = (rateCardId) => {
|
|
3543
|
-
return this.client.post(`/v1/rate_cards/${rateCardId}/publish`);
|
|
3544
|
-
};
|
|
3545
|
-
/**
|
|
3546
|
-
* @description https://auctane.atlassian.net/wiki/spaces/TE/pages/3837431603/Inc+1+3.+Rate+Card+Details#Delete-Rate-Card
|
|
3547
|
-
*/
|
|
3548
|
-
this.delete = (rateCardId) => {
|
|
3549
|
-
return this.client.delete(`/v1/rate_cards/${rateCardId}`);
|
|
3550
|
-
};
|
|
3551
|
-
this.client = client;
|
|
3552
|
-
}
|
|
3553
|
-
}
|
|
3554
|
-
|
|
3555
|
-
class RatesAPI {
|
|
3556
|
-
constructor(client) {
|
|
3557
|
-
this.client = client;
|
|
3558
|
-
/**
|
|
3559
|
-
* The `calculate` method calculates rates for a shipment by shipment ID based
|
|
3560
|
-
* on the shipment's options.
|
|
3561
|
-
*/
|
|
3562
|
-
this.calculateByShipmentId = (shipmentId, options) => {
|
|
3563
|
-
return this.client.post("/v1/rates", {
|
|
3564
|
-
rateOptions: options,
|
|
3565
|
-
shipmentId
|
|
3566
|
-
});
|
|
3567
|
-
};
|
|
3568
|
-
this.client = client;
|
|
3569
|
-
}
|
|
3570
|
-
}
|
|
3571
|
-
|
|
3572
|
-
class SalesOrderShipmentsAPI {
|
|
3573
|
-
constructor(client) {
|
|
3574
|
-
this.client = client;
|
|
3575
|
-
/**
|
|
3576
|
-
* The `list` method retrieves a list of sales order shipments for a given user.
|
|
3577
|
-
*/
|
|
3578
|
-
this.list = (body = {}, params) => {
|
|
3579
|
-
return this.client.post("/v-beta/shipments/list", body, {
|
|
3580
|
-
params
|
|
3581
|
-
});
|
|
3582
|
-
};
|
|
3583
|
-
/**
|
|
3584
|
-
* The `get` method retrieves a specific sales order shipment by `shipmentId`.
|
|
3585
|
-
*/
|
|
3586
|
-
this.get = (shipmentId) => {
|
|
3587
|
-
return this.client.get(`/v-beta/shipments/${shipmentId}`);
|
|
3588
|
-
};
|
|
3589
|
-
/**
|
|
3590
|
-
* The `create` method creates a new shipment for a sales order.
|
|
3591
|
-
*/
|
|
3592
|
-
this.create = (salesOrderId, shipment) => {
|
|
3593
|
-
return this.client.post(
|
|
3594
|
-
`/v-beta/shipments/sales_order/${salesOrderId}`,
|
|
3595
|
-
shipment
|
|
3596
|
-
);
|
|
3597
|
-
};
|
|
3598
|
-
/**
|
|
3599
|
-
* The `update` method updates a specific sales order shipment by `shipmentId`.
|
|
3600
|
-
*/
|
|
3601
|
-
this.update = (shipmentId, shipment) => {
|
|
3602
|
-
return this.client.put(`/v-beta/shipments/${shipmentId}`, shipment);
|
|
3603
|
-
};
|
|
3604
|
-
this.client = client;
|
|
3605
|
-
}
|
|
3606
|
-
}
|
|
3607
|
-
|
|
3608
|
-
class SalesOrdersAPI {
|
|
3609
|
-
constructor(client) {
|
|
3610
|
-
this.client = client;
|
|
3611
|
-
/**
|
|
3612
|
-
* The `list` method retrieves a list of sales orders.
|
|
3613
|
-
*/
|
|
3614
|
-
this.list = (params = {}) => {
|
|
3615
|
-
return this.client.get("/v-beta/sales_orders", { params });
|
|
3616
|
-
};
|
|
3617
|
-
/**
|
|
3618
|
-
* The `get` method retrieves a specific sales order by `salesOrderId`.
|
|
3619
|
-
*/
|
|
3620
|
-
this.get = (salesOrderId) => {
|
|
3621
|
-
return this.client.get(`/v-beta/sales_orders/${salesOrderId}`);
|
|
3622
|
-
};
|
|
3623
|
-
/**
|
|
3624
|
-
* The `notifyShipped` method notifies order source that the order has been
|
|
3625
|
-
* shipped. Typically, the order source will then notify the user based on
|
|
3626
|
-
* this update from ShipEngine API.
|
|
3627
|
-
*/
|
|
3628
|
-
this.notifyShipped = (salesOrderId, tracking) => {
|
|
3629
|
-
return this.client.post(`/v-beta/sales_orders/${salesOrderId}/notify`, tracking);
|
|
3630
|
-
};
|
|
3631
|
-
this.client = client;
|
|
3632
|
-
}
|
|
3633
|
-
}
|
|
3634
|
-
|
|
3635
|
-
var __async$1 = (__this, __arguments, generator) => {
|
|
3636
|
-
return new Promise((resolve, reject) => {
|
|
3637
|
-
var fulfilled = (value) => {
|
|
3638
|
-
try {
|
|
3639
|
-
step(generator.next(value));
|
|
3640
|
-
} catch (e) {
|
|
3641
|
-
reject(e);
|
|
3642
|
-
}
|
|
3643
|
-
};
|
|
3644
|
-
var rejected = (value) => {
|
|
3645
|
-
try {
|
|
3646
|
-
step(generator.throw(value));
|
|
3647
|
-
} catch (e) {
|
|
3648
|
-
reject(e);
|
|
3649
|
-
}
|
|
3650
|
-
};
|
|
3651
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
3652
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
3653
|
-
});
|
|
3654
|
-
};
|
|
3655
|
-
class ShipmentsAPI {
|
|
3656
|
-
constructor(client) {
|
|
3657
|
-
this.client = client;
|
|
3658
|
-
/**
|
|
3659
|
-
* The `getShipmentRates` method retrieves rates for a given shipment by
|
|
3660
|
-
* shipment ID.
|
|
3661
|
-
*/
|
|
3662
|
-
this.getShipmentRates = ({ shipmentId, createdAtStart }) => {
|
|
3663
|
-
return this.client.get(
|
|
3664
|
-
`/v1/shipments/${shipmentId}/rates`,
|
|
3665
|
-
createdAtStart !== void 0 ? { params: { createdAtStart } } : void 0
|
|
3666
|
-
);
|
|
3667
|
-
};
|
|
3668
|
-
/**
|
|
3669
|
-
* The `list` method retrieves a list of shipments for a given user.
|
|
3670
|
-
*/
|
|
3671
|
-
this.list = (options) => {
|
|
3672
|
-
return this.client.get("/v1/shipments", { params: options });
|
|
3673
|
-
};
|
|
3674
|
-
/**
|
|
3675
|
-
* The `create` method allows for creating shipments based on a list of shipment
|
|
3676
|
-
* items passed into this method.
|
|
3677
|
-
*/
|
|
3678
|
-
this.create = (...shipments) => __async$1(this, null, function* () {
|
|
3679
|
-
return this.client.post("/v1/shipments", {
|
|
3680
|
-
shipments
|
|
3681
|
-
});
|
|
3682
|
-
});
|
|
3683
|
-
this.client = client;
|
|
3684
|
-
}
|
|
3685
|
-
}
|
|
3686
|
-
|
|
3687
|
-
class ShippingRulesAPI {
|
|
3688
|
-
constructor(client) {
|
|
3689
|
-
this.client = client;
|
|
3690
|
-
/**
|
|
3691
|
-
* The `list` method retrieves the list of shipping rules by seller.
|
|
3692
|
-
*/
|
|
3693
|
-
this.list = () => {
|
|
3694
|
-
return this.client.get(`/v1/shipping_rules`);
|
|
3695
|
-
};
|
|
3696
|
-
/**
|
|
3697
|
-
* The `create` method creates a new shipping rule for a given user.
|
|
3698
|
-
*/
|
|
3699
|
-
this.create = (shippingRule) => {
|
|
3700
|
-
return this.client.post("/v1/shipping_rules", shippingRule);
|
|
3701
|
-
};
|
|
3702
|
-
this.client = client;
|
|
3703
|
-
}
|
|
3704
|
-
}
|
|
3705
|
-
|
|
3706
|
-
class WarehousesAPI {
|
|
3707
|
-
constructor(client) {
|
|
3708
|
-
this.client = client;
|
|
3709
|
-
/**
|
|
3710
|
-
* The `list` method retrieves a list of `warehouses` (Ship From Locations)
|
|
3711
|
-
* for a given user.
|
|
3712
|
-
*/
|
|
3713
|
-
this.list = () => {
|
|
3714
|
-
return this.client.get("/v1/warehouses");
|
|
3715
|
-
};
|
|
3716
|
-
/**
|
|
3717
|
-
* The `create` method allows for creation of warehouses (Ship From Locations)
|
|
3718
|
-
* on a users ShipEngine account.
|
|
3719
|
-
*/
|
|
3720
|
-
this.create = (warehouse) => {
|
|
3721
|
-
return this.client.post("/v1/warehouses", warehouse);
|
|
3722
|
-
};
|
|
3723
|
-
/**
|
|
3724
|
-
* The `update` method updates a specific warehouse (Ship From Location) for a
|
|
3725
|
-
* given user by `warehouseId`.
|
|
3726
|
-
*/
|
|
3727
|
-
this.update = (warehouseId, warehouse) => {
|
|
3728
|
-
return this.client.put(`/v1/warehouses/${warehouseId}`, warehouse);
|
|
3729
|
-
};
|
|
3730
|
-
/**
|
|
3731
|
-
* The `delete` method deletes a specific warehouse (Ship From Location) by
|
|
3732
|
-
* `warehouseId` from a users ShipEngine account.
|
|
3733
|
-
*/
|
|
3734
|
-
this.delete = (warehouseId) => {
|
|
3735
|
-
return this.client.delete(`/v1/warehouses/${warehouseId}`);
|
|
3736
|
-
};
|
|
3737
|
-
this.client = client;
|
|
3738
|
-
}
|
|
3739
|
-
}
|
|
3740
|
-
|
|
3741
|
-
var __defProp = Object.defineProperty;
|
|
3742
|
-
var __defProps = Object.defineProperties;
|
|
3743
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
3744
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3745
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3746
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
3747
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3748
|
-
var __spreadValues = (a, b) => {
|
|
3749
|
-
for (var prop in b || (b = {}))
|
|
3750
|
-
if (__hasOwnProp.call(b, prop))
|
|
3751
|
-
__defNormalProp(a, prop, b[prop]);
|
|
3752
|
-
if (__getOwnPropSymbols)
|
|
3753
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
3754
|
-
if (__propIsEnum.call(b, prop))
|
|
3755
|
-
__defNormalProp(a, prop, b[prop]);
|
|
3756
|
-
}
|
|
3757
|
-
return a;
|
|
3758
|
-
};
|
|
3759
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
3760
|
-
var __async = (__this, __arguments, generator) => {
|
|
3761
|
-
return new Promise((resolve, reject) => {
|
|
3762
|
-
var fulfilled = (value) => {
|
|
3763
|
-
try {
|
|
3764
|
-
step(generator.next(value));
|
|
3765
|
-
} catch (e) {
|
|
3766
|
-
reject(e);
|
|
3767
|
-
}
|
|
3768
|
-
};
|
|
3769
|
-
var rejected = (value) => {
|
|
3770
|
-
try {
|
|
3771
|
-
step(generator.throw(value));
|
|
3772
|
-
} catch (e) {
|
|
3773
|
-
reject(e);
|
|
3774
|
-
}
|
|
3775
|
-
};
|
|
3776
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
3777
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
3778
|
-
});
|
|
3779
|
-
};
|
|
3780
|
-
const logger = E({
|
|
3781
|
-
name: "shipengine-api",
|
|
3782
|
-
serializers: __spreadProps(__spreadValues({}, k), {
|
|
3783
|
-
req: (req) => ({
|
|
3784
|
-
headers: req.headers,
|
|
3785
|
-
method: req.method,
|
|
3786
|
-
url: req.url
|
|
3787
|
-
}),
|
|
3788
|
-
res: (res) => ({
|
|
3789
|
-
data: res.data,
|
|
3790
|
-
headers: res.config.headers,
|
|
3791
|
-
method: res.config.method,
|
|
3792
|
-
statusCode: res.status,
|
|
3793
|
-
url: res.config.url
|
|
3794
|
-
})
|
|
3795
|
-
}),
|
|
3796
|
-
streams: [
|
|
3797
|
-
{
|
|
3798
|
-
stream: new R()
|
|
3799
|
-
}
|
|
3800
|
-
]
|
|
3801
|
-
});
|
|
3802
|
-
const isDataCodedErrors = (data) => !!data.errors && isCodedErrors(data.errors);
|
|
3803
|
-
class ShipEngineAPI {
|
|
3804
|
-
constructor(token, { baseURL, headers, getToken }) {
|
|
3805
|
-
const client = axios.create({
|
|
3806
|
-
baseURL,
|
|
3807
|
-
headers: __spreadProps(__spreadValues({}, headers), {
|
|
3808
|
-
Authorization: `Bearer ${token}`,
|
|
3809
|
-
"Content-Type": "application/json"
|
|
3810
|
-
}),
|
|
3811
|
-
paramsSerializer: (params) => lib.stringify(humpsExports.decamelizeKeys(params), { arrayFormat: "brackets" }),
|
|
3812
|
-
transformRequest: [
|
|
3813
|
-
(data) => {
|
|
3814
|
-
if (data && !(data instanceof FormData))
|
|
3815
|
-
return humpsExports.decamelizeKeys(data);
|
|
3816
|
-
else
|
|
3817
|
-
return data;
|
|
3818
|
-
},
|
|
3819
|
-
(data) => {
|
|
3820
|
-
if (data && !(data instanceof FormData))
|
|
3821
|
-
return JSON.stringify(data);
|
|
3822
|
-
else
|
|
3823
|
-
return data;
|
|
3824
|
-
}
|
|
3825
|
-
],
|
|
3826
|
-
transformResponse: [
|
|
3827
|
-
(data) => {
|
|
3828
|
-
if (data && !(data instanceof Blob))
|
|
3829
|
-
return JSON.parse(data);
|
|
3830
|
-
else
|
|
3831
|
-
return data;
|
|
3832
|
-
},
|
|
3833
|
-
(data) => {
|
|
3834
|
-
if (data && !(data instanceof Blob))
|
|
3835
|
-
return humpsExports.camelizeKeys(data);
|
|
3836
|
-
else
|
|
3837
|
-
return data;
|
|
3838
|
-
}
|
|
3839
|
-
]
|
|
3840
|
-
});
|
|
3841
|
-
client.interceptors.response.use(
|
|
3842
|
-
(res) => {
|
|
3843
|
-
var _a;
|
|
3844
|
-
logger.info(
|
|
3845
|
-
{ req: res.config, res },
|
|
3846
|
-
"%s %s: %s %s",
|
|
3847
|
-
(_a = res.config.method) == null ? void 0 : _a.toUpperCase(),
|
|
3848
|
-
res.config.url,
|
|
3849
|
-
res.status,
|
|
3850
|
-
res.statusText
|
|
3851
|
-
);
|
|
3852
|
-
return res;
|
|
3853
|
-
},
|
|
3854
|
-
(err) => __async(this, null, function* () {
|
|
3855
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
3856
|
-
logger.error(
|
|
3857
|
-
{ err, req: err.config, res: err.response },
|
|
3858
|
-
"%s %s: %s %s - %s",
|
|
3859
|
-
(_b = (_a = err.config) == null ? void 0 : _a.method) == null ? void 0 : _b.toUpperCase(),
|
|
3860
|
-
(_c = err.config) == null ? void 0 : _c.url,
|
|
3861
|
-
(_d = err.response) == null ? void 0 : _d.status,
|
|
3862
|
-
(_e = err.response) == null ? void 0 : _e.statusText,
|
|
3863
|
-
err.message
|
|
3864
|
-
);
|
|
3865
|
-
if (((_f = err.response) == null ? void 0 : _f.status) === 401) {
|
|
3866
|
-
const token2 = yield getToken();
|
|
3867
|
-
const config = err.config;
|
|
3868
|
-
if (config) {
|
|
3869
|
-
config.headers || (config.headers = {});
|
|
3870
|
-
config.headers["Authorization"] = `Bearer ${token2}`;
|
|
3871
|
-
}
|
|
3872
|
-
return axios(config);
|
|
3873
|
-
}
|
|
3874
|
-
if ((_g = err.response) == null ? void 0 : _g.data) {
|
|
3875
|
-
if (isDataCodedErrors(err.response.data)) {
|
|
3876
|
-
return Promise.reject(
|
|
3877
|
-
err.response.data.errors.map((err2) => CodedError.fromObject(err2))
|
|
3878
|
-
);
|
|
3879
|
-
}
|
|
3880
|
-
if (isCodedErrors(err.response.data)) {
|
|
3881
|
-
return Promise.reject(err.response.data.map((err2) => CodedError.fromObject(err2)));
|
|
3882
|
-
}
|
|
3883
|
-
if (isCodedError(err.response.data)) {
|
|
3884
|
-
return Promise.reject([CodedError.fromObject(err.response.data)]);
|
|
3885
|
-
}
|
|
3886
|
-
return Promise.reject([new CodedError(err.response.data)]);
|
|
3887
|
-
} else {
|
|
3888
|
-
return Promise.reject([new CodedError(err.message)]);
|
|
3889
|
-
}
|
|
3890
|
-
})
|
|
3891
|
-
);
|
|
3892
|
-
this.client = client;
|
|
3893
|
-
}
|
|
3894
|
-
/**
|
|
3895
|
-
* The `token` method takes in a string and sets it as the Authorization header for all requests.
|
|
3896
|
-
*/
|
|
3897
|
-
set token(token) {
|
|
3898
|
-
this.client.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
3899
|
-
}
|
|
3900
|
-
/**
|
|
3901
|
-
* The `accountSettings` method provides access to the Account Settings endpoints
|
|
3902
|
-
* in ShipEngine API.
|
|
3903
|
-
*
|
|
3904
|
-
* @see {@link AccountSettingsAPI | The Account Settings API module}
|
|
3905
|
-
*/
|
|
3906
|
-
get accountSettings() {
|
|
3907
|
-
return new AccountSettingsAPI(this.client);
|
|
3908
|
-
}
|
|
3909
|
-
/**
|
|
3910
|
-
* The `accountBillingPlan` method provides access to the Account Billing Plan endpoints
|
|
3911
|
-
* in ShipEngine API.
|
|
3912
|
-
*/
|
|
3913
|
-
get accountBillingPlan() {
|
|
3914
|
-
return new AccountBillingPlanAPI(this.client);
|
|
3915
|
-
}
|
|
3916
|
-
/**
|
|
3917
|
-
* The `addresses` method provides access to the Address Validation endpoints
|
|
3918
|
-
* in ShipEngine API. e.g. Validate Addresses, Parse Addresses, etc.
|
|
3919
|
-
*
|
|
3920
|
-
* @see {@link AddressesAPI | The Addresses API module}
|
|
3921
|
-
*/
|
|
3922
|
-
get addresses() {
|
|
3923
|
-
return new AddressesAPI(this.client);
|
|
3924
|
-
}
|
|
3925
|
-
/**
|
|
3926
|
-
* The `carriers` method provides access to the Carrier endpoints in ShipEngine
|
|
3927
|
-
* API. e.g. List Carriers, Get Carrier, Connect Carrier, etc.
|
|
3928
|
-
*
|
|
3929
|
-
* @see {@link CarriersAPI | The Carriers API module}
|
|
3930
|
-
*/
|
|
3931
|
-
get carriers() {
|
|
3932
|
-
return new CarriersAPI(this.client);
|
|
3933
|
-
}
|
|
3934
|
-
/**
|
|
3935
|
-
* The `customPackages` method provides access to the Packages endpoint in ShipEngine
|
|
3936
|
-
* API. e.g. List Packages
|
|
3937
|
-
*
|
|
3938
|
-
* @see {@link CustomPackagesAPI | The Custom Packages API module}
|
|
3939
|
-
*/
|
|
3940
|
-
get customPackages() {
|
|
3941
|
-
return new CustomPackagesAPI(this.client);
|
|
3942
|
-
}
|
|
3943
|
-
/**
|
|
3944
|
-
* The `fundingSources` method provides access to the Funding Sources endpoints
|
|
3945
|
-
* in ShipEngine API.
|
|
3946
|
-
*
|
|
3947
|
-
* @see {@link FundingSourcesAPI | The Funding Sources API module}
|
|
3948
|
-
*/
|
|
3949
|
-
get fundingSources() {
|
|
3950
|
-
return new FundingSourcesAPI(this.client);
|
|
3951
|
-
}
|
|
3952
|
-
/**
|
|
3953
|
-
* The `insurance` method provides access to the Insurance endpoint in ShipEngine
|
|
3954
|
-
* API. e.g. Get Insurance Balance
|
|
3955
|
-
*
|
|
3956
|
-
* @see {@link InsuranceAPI | The Insurance API module}
|
|
3957
|
-
*/
|
|
3958
|
-
get insurance() {
|
|
3959
|
-
return new InsuranceAPI(this.client);
|
|
3960
|
-
}
|
|
3961
|
-
/**
|
|
3962
|
-
* The `labels` method provides access to the Label endpoints in ShipEngine API.
|
|
3963
|
-
* e.g. Create Label, Get Label, Void Label, etc.
|
|
3964
|
-
*
|
|
3965
|
-
* @see {@link LabelsAPI | The Labels API module}
|
|
3966
|
-
*/
|
|
3967
|
-
get labels() {
|
|
3968
|
-
return new LabelsAPI(this.client);
|
|
3969
|
-
}
|
|
3970
|
-
/**
|
|
3971
|
-
* The `orderSources` method provides access to the Order Sources endpoints in
|
|
3972
|
-
* ShipEngine API. e.g. List Order Sources, Get Order Source, Refresh Order Source, etc.
|
|
3973
|
-
*
|
|
3974
|
-
* @see {@link OrderSourcesAPI | The Order Sources API module}
|
|
3975
|
-
*/
|
|
3976
|
-
get orderSources() {
|
|
3977
|
-
return new OrderSourcesAPI(this.client);
|
|
3978
|
-
}
|
|
3979
|
-
/**
|
|
3980
|
-
* The `rateCards` method provides access to the Rate Cards endpoints in ShipEngine
|
|
3981
|
-
* API.
|
|
3982
|
-
*
|
|
3983
|
-
* @see {@link RateCardsAPI | The Rate Cards API module}
|
|
3984
|
-
*/
|
|
3985
|
-
get rateCards() {
|
|
3986
|
-
return new RateCardsAPI(this.client);
|
|
3987
|
-
}
|
|
3988
|
-
/**
|
|
3989
|
-
* The `rates` method provides access to the Rate endpoints in ShipEngine API.
|
|
3990
|
-
* e.g. Get Rates
|
|
3991
|
-
*
|
|
3992
|
-
* @see {@link RatesAPI | The Rates API module}
|
|
3993
|
-
*/
|
|
3994
|
-
get rates() {
|
|
3995
|
-
return new RatesAPI(this.client);
|
|
3996
|
-
}
|
|
3997
|
-
/**
|
|
3998
|
-
* The `salesOrderShipments` method provides access to the `v-beta` Sales
|
|
3999
|
-
* Order Shipments endpoints in ShipEngine API.
|
|
4000
|
-
*
|
|
4001
|
-
* @see {@link SalesOrderShipmentsAPI | The Sales Order Shipments API module}
|
|
4002
|
-
*/
|
|
4003
|
-
get salesOrderShipments() {
|
|
4004
|
-
return new SalesOrderShipmentsAPI(this.client);
|
|
4005
|
-
}
|
|
4006
|
-
/**
|
|
4007
|
-
* The `salesOrders` method provides access to the `v-beta` Sales Order endpoints
|
|
4008
|
-
* in ShipEngine API.
|
|
4009
|
-
*
|
|
4010
|
-
* @see {@link SalesOrdersAPI | The Sales Orders API module}
|
|
4011
|
-
*/
|
|
4012
|
-
get salesOrders() {
|
|
4013
|
-
return new SalesOrdersAPI(this.client);
|
|
4014
|
-
}
|
|
4015
|
-
/**
|
|
4016
|
-
* The `shipments` method provides access to the Shipment endpoints in ShipEngine
|
|
4017
|
-
* API. e.g. Create Shipment, Get Shipment, etc.
|
|
4018
|
-
*
|
|
4019
|
-
* @see {@link ShipmentsAPI | The Shipments API module}
|
|
4020
|
-
*/
|
|
4021
|
-
get shipments() {
|
|
4022
|
-
return new ShipmentsAPI(this.client);
|
|
4023
|
-
}
|
|
4024
|
-
/**
|
|
4025
|
-
* The `warehouses` method provides access to the Warehouses endpoints in ShipEngine
|
|
4026
|
-
* API. e.g. List Warehouses, Get Warehouse, etc.
|
|
4027
|
-
*
|
|
4028
|
-
* @see {@link WarehousesAPI | The Warehouses API module}
|
|
4029
|
-
*/
|
|
4030
|
-
get warehouses() {
|
|
4031
|
-
return new WarehousesAPI(this.client);
|
|
4032
|
-
}
|
|
4033
|
-
/**
|
|
4034
|
-
* The `shippingRules` method provides access to the Shipping Rules endpoints in ShipEngine
|
|
4035
|
-
* API.
|
|
4036
|
-
*
|
|
4037
|
-
* @see {@link ShippingRulesAPI | The Shipping Rules API module}
|
|
4038
|
-
*/
|
|
4039
|
-
get shippingRules() {
|
|
4040
|
-
return new ShippingRulesAPI(this.client);
|
|
4041
|
-
}
|
|
4042
|
-
}
|
|
4043
|
-
|
|
4044
|
-
exports.AccountSettingsAPI = AccountSettingsAPI;
|
|
4045
|
-
exports.AddressesAPI = AddressesAPI;
|
|
4046
|
-
exports.CarriersAPI = CarriersAPI;
|
|
4047
|
-
exports.CodedError = CodedError;
|
|
4048
|
-
exports.ConfirmationType = ConfirmationType;
|
|
4049
|
-
exports.CreditCardVendor = CreditCardVendor;
|
|
4050
|
-
exports.Currency = Currency;
|
|
4051
|
-
exports.CustomPackagesAPI = CustomPackagesAPI;
|
|
4052
|
-
exports.CustomsContentsType = CustomsContentsType;
|
|
4053
|
-
exports.CustomsNonDeliveryType = CustomsNonDeliveryType;
|
|
4054
|
-
exports.FundingSourcesAPI = FundingSourcesAPI;
|
|
4055
|
-
exports.InsuranceAPI = InsuranceAPI;
|
|
4056
|
-
exports.InsuranceProviderType = InsuranceProviderType;
|
|
4057
|
-
exports.LabelsAPI = LabelsAPI;
|
|
4058
|
-
exports.MetadataCapability = MetadataCapability;
|
|
4059
|
-
exports.MetadataRequirement = MetadataRequirement;
|
|
4060
|
-
exports.MetadataSatisfyingFormTypes = MetadataSatisfyingFormTypes;
|
|
4061
|
-
exports.OrderSourcesAPI = OrderSourcesAPI;
|
|
4062
|
-
exports.RateCardStatus = RateCardStatus;
|
|
4063
|
-
exports.RateCardsAPI = RateCardsAPI;
|
|
4064
|
-
exports.RatesAPI = RatesAPI;
|
|
4065
|
-
exports.SE = types;
|
|
4066
|
-
exports.SalesOrderShipmentsAPI = SalesOrderShipmentsAPI;
|
|
4067
|
-
exports.SalesOrdersAPI = SalesOrdersAPI;
|
|
4068
|
-
exports.ShipEngineAPI = ShipEngineAPI;
|
|
4069
|
-
exports.ShipmentsAPI = ShipmentsAPI;
|
|
4070
|
-
exports.ShippingRulesAPI = ShippingRulesAPI;
|
|
4071
|
-
exports.WarehousesAPI = WarehousesAPI;
|
|
4072
|
-
exports.getEndUserIpAddress = getEndUserIpAddress;
|
|
4073
|
-
exports.isCodedError = isCodedError;
|
|
4074
|
-
exports.isCodedErrors = isCodedErrors;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class z{constructor(e,t){this.errorCode=t?.errorCode??"unknown",this.errorSource=t?.errorSource??"client",this.errorType=t?.errorType??"unknown",this.message=e}static fromObject({message:e,...t}){return new z(e,t)}}var Rr=(r=>(r.AMERICAN_EXPRESS="americanexpress",r.DISCOVER="discover",r.MASTERCARD="mastercard",r.VISA="visa",r))(Rr||{}),xr=(r=>(r.USD="usd",r.CAD="cad",r.AUD="aud",r.GBP="gbp",r.EUR="eur",r.NZD="nzd",r))(xr||{}),Cr=(r=>(r.DELIVERY="delivery",r.SIGNATURE="signature",r.ADULT_SIGNATURE="adult_signature",r.DIRECT_SIGNATURE="direct_signature",r.VERBAL_CONFIRMATION="verbal_confirmation",r.DELIVERY_MAILED="delivery_mailed",r.NONE="none",r))(Cr||{}),Nr=(r=>(r.DOCUMENTS="documents",r.GIFT="gift",r.MERCHANDISE="merchandise",r.RETURNED_GOODS="returned_goods",r.SAMPLE="sample",r))(Nr||{}),$r=(r=>(r.RETURN_TO_SENDER="return_to_sender",r.TREAT_AS_ABANDONED="treat_as_abandoned",r))($r||{}),_r=(r=>(r.SHIPSURANCE="shipsurance",r.CARRIER="carrier",r.THIRD_PARTY="third_party",r.NONE="none",r))(_r||{});const xn=Object.freeze(Object.defineProperty({__proto__:null,CodedError:z,ConfirmationType:Cr,CreditCardVendor:Rr,Currency:xr,CustomsContentsType:Nr,CustomsNonDeliveryType:$r,InsuranceProviderType:_r},Symbol.toStringTag,{value:"Module"}));class Ut{constructor(e){this.client=e,this.getAccountSettings=()=>this.client.get("/v1/account/settings"),this.client=e}}class Mt{constructor(e){this.client=e,this.validate=t=>this.client.post("/v1/addresses/validate",t),this.parse=(t,n)=>this.client.put("/v1/addresses/recognize",{address:n,text:t}),this.client=e}}var zt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Cn(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Nn(r){if(r.__esModule)return r;var e=r.default;if(typeof e=="function"){var t=function n(){if(this instanceof n){var a=[null];a.push.apply(a,arguments);var i=Function.bind.apply(e,a);return new i}return e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var a=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return r[n]}})}),t}var lr={},$n={get exports(){return lr},set exports(r){lr=r}},Oe={},_n={get exports(){return Oe},set exports(r){Oe=r}},Lt=function(e,t){return function(){for(var a=new Array(arguments.length),i=0;i<a.length;i++)a[i]=arguments[i];return e.apply(t,a)}},Dn=Lt,G=Object.prototype.toString;function Dr(r){return Array.isArray(r)}function fr(r){return typeof r>"u"}function Tn(r){return r!==null&&!fr(r)&&r.constructor!==null&&!fr(r.constructor)&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function jt(r){return G.call(r)==="[object ArrayBuffer]"}function Fn(r){return G.call(r)==="[object FormData]"}function kn(r){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&jt(r.buffer),e}function Bn(r){return typeof r=="string"}function Un(r){return typeof r=="number"}function qt(r){return r!==null&&typeof r=="object"}function Ee(r){if(G.call(r)!=="[object Object]")return!1;var e=Object.getPrototypeOf(r);return e===null||e===Object.prototype}function Mn(r){return G.call(r)==="[object Date]"}function zn(r){return G.call(r)==="[object File]"}function Ln(r){return G.call(r)==="[object Blob]"}function Wt(r){return G.call(r)==="[object Function]"}function jn(r){return qt(r)&&Wt(r.pipe)}function qn(r){return G.call(r)==="[object URLSearchParams]"}function Wn(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function Hn(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function Tr(r,e){if(!(r===null||typeof r>"u"))if(typeof r!="object"&&(r=[r]),Dr(r))for(var t=0,n=r.length;t<n;t++)e.call(null,r[t],t,r);else for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&e.call(null,r[a],a,r)}function cr(){var r={};function e(a,i){Ee(r[i])&&Ee(a)?r[i]=cr(r[i],a):Ee(a)?r[i]=cr({},a):Dr(a)?r[i]=a.slice():r[i]=a}for(var t=0,n=arguments.length;t<n;t++)Tr(arguments[t],e);return r}function Vn(r,e,t){return Tr(e,function(a,i){t&&typeof a=="function"?r[i]=Dn(a,t):r[i]=a}),r}function Gn(r){return r.charCodeAt(0)===65279&&(r=r.slice(1)),r}var $={isArray:Dr,isArrayBuffer:jt,isBuffer:Tn,isFormData:Fn,isArrayBufferView:kn,isString:Bn,isNumber:Un,isObject:qt,isPlainObject:Ee,isUndefined:fr,isDate:Mn,isFile:zn,isBlob:Ln,isFunction:Wt,isStream:jn,isURLSearchParams:qn,isStandardBrowserEnv:Hn,forEach:Tr,merge:cr,extend:Vn,trim:Wn,stripBOM:Gn},re=$;function Kr(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Ht=function(e,t,n){if(!t)return e;var a;if(n)a=n(t);else if(re.isURLSearchParams(t))a=t.toString();else{var i=[];re.forEach(t,function(f,d){f===null||typeof f>"u"||(re.isArray(f)?d=d+"[]":f=[f],re.forEach(f,function(o){re.isDate(o)?o=o.toISOString():re.isObject(o)&&(o=JSON.stringify(o)),i.push(Kr(d)+"="+Kr(o))}))}),a=i.join("&")}if(a){var s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e},Jn=$;function Ne(){this.handlers=[]}Ne.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};Ne.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};Ne.prototype.forEach=function(e){Jn.forEach(this.handlers,function(n){n!==null&&e(n)})};var Kn=Ne,Qn=$,Xn=function(e,t){Qn.forEach(e,function(a,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=a,delete e[i])})},Vt=function(e,t,n,a,i){return e.config=t,n&&(e.code=n),e.request=a,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e},Gt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Fe,Qr;function Jt(){if(Qr)return Fe;Qr=1;var r=Vt;return Fe=function(t,n,a,i,s){var l=new Error(t);return r(l,n,a,i,s)},Fe}var ke,Xr;function Yn(){if(Xr)return ke;Xr=1;var r=Jt();return ke=function(t,n,a){var i=a.config.validateStatus;!a.status||!i||i(a.status)?t(a):n(r("Request failed with status code "+a.status,a.config,null,a.request,a))},ke}var Be,Yr;function Zn(){if(Yr)return Be;Yr=1;var r=$;return Be=r.isStandardBrowserEnv()?function(){return{write:function(n,a,i,s,l,f){var d=[];d.push(n+"="+encodeURIComponent(a)),r.isNumber(i)&&d.push("expires="+new Date(i).toGMTString()),r.isString(s)&&d.push("path="+s),r.isString(l)&&d.push("domain="+l),f===!0&&d.push("secure"),document.cookie=d.join("; ")},read:function(n){var a=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return a?decodeURIComponent(a[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),Be}var Ue,Zr;function ea(){return Zr||(Zr=1,Ue=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}),Ue}var Me,et;function ra(){return et||(et=1,Me=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}),Me}var ze,rt;function ta(){if(rt)return ze;rt=1;var r=ea(),e=ra();return ze=function(n,a){return n&&!r(a)?e(n,a):a},ze}var Le,tt;function na(){if(tt)return Le;tt=1;var r=$,e=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return Le=function(n){var a={},i,s,l;return n&&r.forEach(n.split(`
|
|
2
|
+
`),function(d){if(l=d.indexOf(":"),i=r.trim(d.substr(0,l)).toLowerCase(),s=r.trim(d.substr(l+1)),i){if(a[i]&&e.indexOf(i)>=0)return;i==="set-cookie"?a[i]=(a[i]?a[i]:[]).concat([s]):a[i]=a[i]?a[i]+", "+s:s}}),a},Le}var je,nt;function aa(){if(nt)return je;nt=1;var r=$;return je=r.isStandardBrowserEnv()?function(){var t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a"),a;function i(s){var l=s;return t&&(n.setAttribute("href",l),l=n.href),n.setAttribute("href",l),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return a=i(window.location.href),function(l){var f=r.isString(l)?i(l):l;return f.protocol===a.protocol&&f.host===a.host}}():function(){return function(){return!0}}(),je}var qe,at;function $e(){if(at)return qe;at=1;function r(e){this.message=e}return r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,qe=r,qe}var We,it;function ot(){if(it)return We;it=1;var r=$,e=Yn(),t=Zn(),n=Ht,a=ta(),i=na(),s=aa(),l=Jt(),f=Gt,d=$e();return We=function(o){return new Promise(function(p,y){var v=o.data,m=o.headers,h=o.responseType,g;function b(){o.cancelToken&&o.cancelToken.unsubscribe(g),o.signal&&o.signal.removeEventListener("abort",g)}r.isFormData(v)&&delete m["Content-Type"];var S=new XMLHttpRequest;if(o.auth){var O=o.auth.username||"",k=o.auth.password?unescape(encodeURIComponent(o.auth.password)):"";m.Authorization="Basic "+btoa(O+":"+k)}var x=a(o.baseURL,o.url);S.open(o.method.toUpperCase(),n(x,o.params,o.paramsSerializer),!0),S.timeout=o.timeout;function W(){if(S){var E="getAllResponseHeaders"in S?i(S.getAllResponseHeaders()):null,C=!h||h==="text"||h==="json"?S.responseText:S.response,N={data:C,status:S.status,statusText:S.statusText,headers:E,config:o,request:S};e(function(T){p(T),b()},function(T){y(T),b()},N),S=null}}if("onloadend"in S?S.onloadend=W:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(W)},S.onabort=function(){S&&(y(l("Request aborted",o,"ECONNABORTED",S)),S=null)},S.onerror=function(){y(l("Network Error",o,null,S)),S=null},S.ontimeout=function(){var C=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",N=o.transitional||f;o.timeoutErrorMessage&&(C=o.timeoutErrorMessage),y(l(C,o,N.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",S)),S=null},r.isStandardBrowserEnv()){var F=(o.withCredentials||s(x))&&o.xsrfCookieName?t.read(o.xsrfCookieName):void 0;F&&(m[o.xsrfHeaderName]=F)}"setRequestHeader"in S&&r.forEach(m,function(C,N){typeof v>"u"&&N.toLowerCase()==="content-type"?delete m[N]:S.setRequestHeader(N,C)}),r.isUndefined(o.withCredentials)||(S.withCredentials=!!o.withCredentials),h&&h!=="json"&&(S.responseType=o.responseType),typeof o.onDownloadProgress=="function"&&S.addEventListener("progress",o.onDownloadProgress),typeof o.onUploadProgress=="function"&&S.upload&&S.upload.addEventListener("progress",o.onUploadProgress),(o.cancelToken||o.signal)&&(g=function(E){S&&(y(!E||E&&E.type?new d("canceled"):E),S.abort(),S=null)},o.cancelToken&&o.cancelToken.subscribe(g),o.signal&&(o.signal.aborted?g():o.signal.addEventListener("abort",g))),v||(v=null),S.send(v)})},We}var I=$,st=Xn,ia=Vt,oa=Gt,sa={"Content-Type":"application/x-www-form-urlencoded"};function ut(r,e){!I.isUndefined(r)&&I.isUndefined(r["Content-Type"])&&(r["Content-Type"]=e)}function ua(){var r;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(r=ot()),r}function la(r,e,t){if(I.isString(r))try{return(e||JSON.parse)(r),I.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}var _e={transitional:oa,adapter:ua(),transformRequest:[function(e,t){return st(t,"Accept"),st(t,"Content-Type"),I.isFormData(e)||I.isArrayBuffer(e)||I.isBuffer(e)||I.isStream(e)||I.isFile(e)||I.isBlob(e)?e:I.isArrayBufferView(e)?e.buffer:I.isURLSearchParams(e)?(ut(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):I.isObject(e)||t&&t["Content-Type"]==="application/json"?(ut(t,"application/json"),la(e)):e}],transformResponse:[function(e){var t=this.transitional||_e.transitional,n=t&&t.silentJSONParsing,a=t&&t.forcedJSONParsing,i=!n&&this.responseType==="json";if(i||a&&I.isString(e)&&e.length)try{return JSON.parse(e)}catch(s){if(i)throw s.name==="SyntaxError"?ia(s,this,"E_JSON_PARSE"):s}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};I.forEach(["delete","get","head"],function(e){_e.headers[e]={}});I.forEach(["post","put","patch"],function(e){_e.headers[e]=I.merge(sa)});var Fr=_e,fa=$,ca=Fr,pa=function(e,t,n){var a=this||ca;return fa.forEach(n,function(s){e=s.call(a,e,t)}),e},He,lt;function Kt(){return lt||(lt=1,He=function(e){return!!(e&&e.__CANCEL__)}),He}var ft=$,Ve=pa,da=Kt(),ha=Fr,ya=$e();function Ge(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new ya("canceled")}var va=function(e){Ge(e),e.headers=e.headers||{},e.data=Ve.call(e,e.data,e.headers,e.transformRequest),e.headers=ft.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),ft.forEach(["delete","get","head","post","put","patch","common"],function(a){delete e.headers[a]});var t=e.adapter||ha.adapter;return t(e).then(function(a){return Ge(e),a.data=Ve.call(e,a.data,a.headers,e.transformResponse),a},function(a){return da(a)||(Ge(e),a&&a.response&&(a.response.data=Ve.call(e,a.response.data,a.response.headers,e.transformResponse))),Promise.reject(a)})},_=$,Qt=function(e,t){t=t||{};var n={};function a(u,o){return _.isPlainObject(u)&&_.isPlainObject(o)?_.merge(u,o):_.isPlainObject(o)?_.merge({},o):_.isArray(o)?o.slice():o}function i(u){if(_.isUndefined(t[u])){if(!_.isUndefined(e[u]))return a(void 0,e[u])}else return a(e[u],t[u])}function s(u){if(!_.isUndefined(t[u]))return a(void 0,t[u])}function l(u){if(_.isUndefined(t[u])){if(!_.isUndefined(e[u]))return a(void 0,e[u])}else return a(void 0,t[u])}function f(u){if(u in t)return a(e[u],t[u]);if(u in e)return a(void 0,e[u])}var d={url:s,method:s,data:s,baseURL:l,transformRequest:l,transformResponse:l,paramsSerializer:l,timeout:l,timeoutMessage:l,withCredentials:l,adapter:l,responseType:l,xsrfCookieName:l,xsrfHeaderName:l,onUploadProgress:l,onDownloadProgress:l,decompress:l,maxContentLength:l,maxBodyLength:l,transport:l,httpAgent:l,httpsAgent:l,cancelToken:l,socketPath:l,responseEncoding:l,validateStatus:f};return _.forEach(Object.keys(e).concat(Object.keys(t)),function(o){var c=d[o]||i,p=c(o);_.isUndefined(p)&&c!==f||(n[o]=p)}),n},Je,ct;function Xt(){return ct||(ct=1,Je={version:"0.26.1"}),Je}var ma=Xt().version,kr={};["object","boolean","number","function","string","symbol"].forEach(function(r,e){kr[r]=function(n){return typeof n===r||"a"+(e<1?"n ":" ")+r}});var pt={};kr.transitional=function(e,t,n){function a(i,s){return"[Axios v"+ma+"] Transitional option '"+i+"'"+s+(n?". "+n:"")}return function(i,s,l){if(e===!1)throw new Error(a(s," has been removed"+(t?" in "+t:"")));return t&&!pt[s]&&(pt[s]=!0,console.warn(a(s," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,s,l):!0}};function ga(r,e,t){if(typeof r!="object")throw new TypeError("options must be an object");for(var n=Object.keys(r),a=n.length;a-- >0;){var i=n[a],s=e[i];if(s){var l=r[i],f=l===void 0||s(l,i,r);if(f!==!0)throw new TypeError("option "+i+" must be "+f);continue}if(t!==!0)throw Error("Unknown option "+i)}}var Sa={assertOptions:ga,validators:kr},Yt=$,wa=Ht,dt=Kn,ht=va,De=Qt,Zt=Sa,te=Zt.validators;function me(r){this.defaults=r,this.interceptors={request:new dt,response:new dt}}me.prototype.request=function(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=De(this.defaults,t),t.method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var n=t.transitional;n!==void 0&&Zt.assertOptions(n,{silentJSONParsing:te.transitional(te.boolean),forcedJSONParsing:te.transitional(te.boolean),clarifyTimeoutError:te.transitional(te.boolean)},!1);var a=[],i=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(t)===!1||(i=i&&p.synchronous,a.unshift(p.fulfilled,p.rejected))});var s=[];this.interceptors.response.forEach(function(p){s.push(p.fulfilled,p.rejected)});var l;if(!i){var f=[ht,void 0];for(Array.prototype.unshift.apply(f,a),f=f.concat(s),l=Promise.resolve(t);f.length;)l=l.then(f.shift(),f.shift());return l}for(var d=t;a.length;){var u=a.shift(),o=a.shift();try{d=u(d)}catch(c){o(c);break}}try{l=ht(d)}catch(c){return Promise.reject(c)}for(;s.length;)l=l.then(s.shift(),s.shift());return l};me.prototype.getUri=function(e){return e=De(this.defaults,e),wa(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};Yt.forEach(["delete","get","head","options"],function(e){me.prototype[e]=function(t,n){return this.request(De(n||{},{method:e,url:t,data:(n||{}).data}))}});Yt.forEach(["post","put","patch"],function(e){me.prototype[e]=function(t,n,a){return this.request(De(a||{},{method:e,url:t,data:n}))}});var ba=me,Ke,yt;function Ea(){if(yt)return Ke;yt=1;var r=$e();function e(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var n;this.promise=new Promise(function(s){n=s});var a=this;this.promise.then(function(i){if(a._listeners){var s,l=a._listeners.length;for(s=0;s<l;s++)a._listeners[s](i);a._listeners=null}}),this.promise.then=function(i){var s,l=new Promise(function(f){a.subscribe(f),s=f}).then(i);return l.cancel=function(){a.unsubscribe(s)},l},t(function(s){a.reason||(a.reason=new r(s),n(a.reason))})}return e.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},e.prototype.subscribe=function(n){if(this.reason){n(this.reason);return}this._listeners?this._listeners.push(n):this._listeners=[n]},e.prototype.unsubscribe=function(n){if(this._listeners){var a=this._listeners.indexOf(n);a!==-1&&this._listeners.splice(a,1)}},e.source=function(){var n,a=new e(function(s){n=s});return{token:a,cancel:n}},Ke=e,Ke}var Qe,vt;function Aa(){return vt||(vt=1,Qe=function(e){return function(n){return e.apply(null,n)}}),Qe}var Xe,mt;function Oa(){if(mt)return Xe;mt=1;var r=$;return Xe=function(t){return r.isObject(t)&&t.isAxiosError===!0},Xe}var gt=$,Pa=Lt,Ae=ba,Ia=Qt,Ra=Fr;function en(r){var e=new Ae(r),t=Pa(Ae.prototype.request,e);return gt.extend(t,Ae.prototype,e),gt.extend(t,e),t.create=function(a){return en(Ia(r,a))},t}var L=en(Ra);L.Axios=Ae;L.Cancel=$e();L.CancelToken=Ea();L.isCancel=Kt();L.VERSION=Xt().version;L.all=function(e){return Promise.all(e)};L.spread=Aa();L.isAxiosError=Oa();_n.exports=L;Oe.default=L;(function(r){r.exports=Oe})($n);const pr=Cn(lr);var Pe={},xa={get exports(){return Pe},set exports(r){Pe=r}};(function(r){(function(){var e,t,n,a,i,s,l,f,d;t={},f=this,r!==null&&r.exports?r.exports=t:f.ipaddr=t,l=function(u,o,c,p){var y,v;if(u.length!==o.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");for(y=0;p>0;){if(v=c-p,v<0&&(v=0),u[y]>>v!==o[y]>>v)return!1;p-=c,y+=1}return!0},t.subnetMatch=function(u,o,c){var p,y,v,m,h;c==null&&(c="unicast");for(v in o)for(m=o[v],m[0]&&!(m[0]instanceof Array)&&(m=[m]),p=0,y=m.length;p<y;p++)if(h=m[p],u.kind()===h[0].kind()&&u.match.apply(u,h))return v;return c},t.IPv4=function(){function u(o){var c,p,y;if(o.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");for(c=0,p=o.length;c<p;c++)if(y=o[c],!(0<=y&&y<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=o}return u.prototype.kind=function(){return"ipv4"},u.prototype.toString=function(){return this.octets.join(".")},u.prototype.toNormalizedString=function(){return this.toString()},u.prototype.toByteArray=function(){return this.octets.slice(0)},u.prototype.match=function(o,c){var p;if(c===void 0&&(p=o,o=p[0],c=p[1]),o.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return l(this.octets,o.octets,8,c)},u.prototype.SpecialRanges={unspecified:[[new u([0,0,0,0]),8]],broadcast:[[new u([255,255,255,255]),32]],multicast:[[new u([224,0,0,0]),4]],linkLocal:[[new u([169,254,0,0]),16]],loopback:[[new u([127,0,0,0]),8]],carrierGradeNat:[[new u([100,64,0,0]),10]],private:[[new u([10,0,0,0]),8],[new u([172,16,0,0]),12],[new u([192,168,0,0]),16]],reserved:[[new u([192,0,0,0]),24],[new u([192,0,2,0]),24],[new u([192,88,99,0]),24],[new u([198,51,100,0]),24],[new u([203,0,113,0]),24],[new u([240,0,0,0]),4]]},u.prototype.range=function(){return t.subnetMatch(this,this.SpecialRanges)},u.prototype.toIPv4MappedAddress=function(){return t.IPv6.parse("::ffff:"+this.toString())},u.prototype.prefixLengthFromSubnetMask=function(){var o,c,p,y,v,m,h;for(h={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},o=0,v=!1,c=p=3;p>=0;c=p+=-1)if(y=this.octets[c],y in h){if(m=h[y],v&&m!==0)return null;m!==8&&(v=!0),o+=m}else return null;return 32-o},u}(),n="(0?\\d+|0x[a-f0-9]+)",a={fourOctet:new RegExp("^"+n+"\\."+n+"\\."+n+"\\."+n+"$","i"),longValue:new RegExp("^"+n+"$","i")},t.IPv4.parser=function(u){var o,c,p,y,v;if(c=function(m){return m[0]==="0"&&m[1]!=="x"?parseInt(m,8):parseInt(m)},o=u.match(a.fourOctet))return function(){var m,h,g,b;for(g=o.slice(1,6),b=[],m=0,h=g.length;m<h;m++)p=g[m],b.push(c(p));return b}();if(o=u.match(a.longValue)){if(v=c(o[1]),v>4294967295||v<0)throw new Error("ipaddr: address outside defined range");return function(){var m,h;for(h=[],y=m=0;m<=24;y=m+=8)h.push(v>>y&255);return h}().reverse()}else return null},t.IPv6=function(){function u(o,c){var p,y,v,m,h,g;if(o.length===16)for(this.parts=[],p=y=0;y<=14;p=y+=2)this.parts.push(o[p]<<8|o[p+1]);else if(o.length===8)this.parts=o;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(g=this.parts,v=0,m=g.length;v<m;v++)if(h=g[v],!(0<=h&&h<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");c&&(this.zoneId=c)}return u.prototype.kind=function(){return"ipv6"},u.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")},u.prototype.toRFC5952String=function(){var o,c,p,y,v;for(y=/((^|:)(0(:|$)){2,})/g,v=this.toNormalizedString(),o=0,c=-1;p=y.exec(v);)p[0].length>c&&(o=p.index,c=p[0].length);return c<0?v:v.substring(0,o)+"::"+v.substring(o+c)},u.prototype.toByteArray=function(){var o,c,p,y,v;for(o=[],v=this.parts,c=0,p=v.length;c<p;c++)y=v[c],o.push(y>>8),o.push(y&255);return o},u.prototype.toNormalizedString=function(){var o,c,p;return o=function(){var y,v,m,h;for(m=this.parts,h=[],y=0,v=m.length;y<v;y++)c=m[y],h.push(c.toString(16));return h}.call(this).join(":"),p="",this.zoneId&&(p="%"+this.zoneId),o+p},u.prototype.toFixedLengthString=function(){var o,c,p;return o=function(){var y,v,m,h;for(m=this.parts,h=[],y=0,v=m.length;y<v;y++)c=m[y],h.push(c.toString(16).padStart(4,"0"));return h}.call(this).join(":"),p="",this.zoneId&&(p="%"+this.zoneId),o+p},u.prototype.match=function(o,c){var p;if(c===void 0&&(p=o,o=p[0],c=p[1]),o.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return l(this.parts,o.parts,16,c)},u.prototype.SpecialRanges={unspecified:[new u([0,0,0,0,0,0,0,0]),128],linkLocal:[new u([65152,0,0,0,0,0,0,0]),10],multicast:[new u([65280,0,0,0,0,0,0,0]),8],loopback:[new u([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new u([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new u([0,0,0,0,0,65535,0,0]),96],rfc6145:[new u([0,0,0,0,65535,0,0,0]),96],rfc6052:[new u([100,65435,0,0,0,0,0,0]),96],"6to4":[new u([8194,0,0,0,0,0,0,0]),16],teredo:[new u([8193,0,0,0,0,0,0,0]),32],reserved:[[new u([8193,3512,0,0,0,0,0,0]),32]]},u.prototype.range=function(){return t.subnetMatch(this,this.SpecialRanges)},u.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},u.prototype.toIPv4Address=function(){var o,c,p;if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");return p=this.parts.slice(-2),o=p[0],c=p[1],new t.IPv4([o>>8,o&255,c>>8,c&255])},u.prototype.prefixLengthFromSubnetMask=function(){var o,c,p,y,v,m,h;for(h={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},o=0,v=!1,c=p=7;p>=0;c=p+=-1)if(y=this.parts[c],y in h){if(m=h[y],v&&m!==0)return null;m!==16&&(v=!0),o+=m}else return null;return 128-o},u}(),i="(?:[0-9a-f]+::?)+",d="%[0-9a-z]{1,}",s={zoneIndex:new RegExp(d,"i"),native:new RegExp("^(::)?("+i+")?([0-9a-f]+)?(::)?("+d+")?$","i"),transitional:new RegExp("^((?:"+i+")|(?:::)(?:"+i+")?)"+(n+"\\."+n+"\\."+n+"\\."+n)+("("+d+")?$"),"i")},e=function(u,o){var c,p,y,v,m,h;if(u.indexOf("::")!==u.lastIndexOf("::"))return null;for(h=(u.match(s.zoneIndex)||[])[0],h&&(h=h.substring(1),u=u.replace(/%.+$/,"")),c=0,p=-1;(p=u.indexOf(":",p+1))>=0;)c++;if(u.substr(0,2)==="::"&&c--,u.substr(-2,2)==="::"&&c--,c>o)return null;for(m=o-c,v=":";m--;)v+="0:";return u=u.replace("::",v),u[0]===":"&&(u=u.slice(1)),u[u.length-1]===":"&&(u=u.slice(0,-1)),o=function(){var g,b,S,O;for(S=u.split(":"),O=[],g=0,b=S.length;g<b;g++)y=S[g],O.push(parseInt(y,16));return O}(),{parts:o,zoneId:h}},t.IPv6.parser=function(u){var o,c,p,y,v,m,h;if(s.native.test(u))return e(u,8);if((y=u.match(s.transitional))&&(h=y[6]||"",o=e(y[1].slice(0,-1)+h,6),o.parts)){for(m=[parseInt(y[2]),parseInt(y[3]),parseInt(y[4]),parseInt(y[5])],c=0,p=m.length;c<p;c++)if(v=m[c],!(0<=v&&v<=255))return null;return o.parts.push(m[0]<<8|m[1]),o.parts.push(m[2]<<8|m[3]),{parts:o.parts,zoneId:o.zoneId}}return null},t.IPv4.isIPv4=t.IPv6.isIPv6=function(u){return this.parser(u)!==null},t.IPv4.isValid=function(u){try{return new this(this.parser(u)),!0}catch{return!1}},t.IPv4.isValidFourPartDecimal=function(u){return!!(t.IPv4.isValid(u)&&u.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},t.IPv6.isValid=function(u){var o;if(typeof u=="string"&&u.indexOf(":")===-1)return!1;try{return o=this.parser(u),new this(o.parts,o.zoneId),!0}catch{return!1}},t.IPv4.parse=function(u){var o;if(o=this.parser(u),o===null)throw new Error("ipaddr: string is not formatted like ip address");return new this(o)},t.IPv6.parse=function(u){var o;if(o=this.parser(u),o.parts===null)throw new Error("ipaddr: string is not formatted like ip address");return new this(o.parts,o.zoneId)},t.IPv4.parseCIDR=function(u){var o,c,p;if((c=u.match(/^(.+)\/(\d+)$/))&&(o=parseInt(c[2]),o>=0&&o<=32))return p=[this.parse(c[1]),o],Object.defineProperty(p,"toString",{value:function(){return this.join("/")}}),p;throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},t.IPv4.subnetMaskFromPrefixLength=function(u){var o,c,p;if(u=parseInt(u),u<0||u>32)throw new Error("ipaddr: invalid IPv4 prefix length");for(p=[0,0,0,0],c=0,o=Math.floor(u/8);c<o;)p[c]=255,c++;return o<4&&(p[o]=Math.pow(2,u%8)-1<<8-u%8),new this(p)},t.IPv4.broadcastAddressFromCIDR=function(u){var o,c,p,y,v;try{for(o=this.parseCIDR(u),p=o[0].toByteArray(),v=this.subnetMaskFromPrefixLength(o[1]).toByteArray(),y=[],c=0;c<4;)y.push(parseInt(p[c],10)|parseInt(v[c],10)^255),c++;return new this(y)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},t.IPv4.networkAddressFromCIDR=function(u){var o,c,p,y,v;try{for(o=this.parseCIDR(u),p=o[0].toByteArray(),v=this.subnetMaskFromPrefixLength(o[1]).toByteArray(),y=[],c=0;c<4;)y.push(parseInt(p[c],10)&parseInt(v[c],10)),c++;return new this(y)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},t.IPv6.parseCIDR=function(u){var o,c,p;if((c=u.match(/^(.+)\/(\d+)$/))&&(o=parseInt(c[2]),o>=0&&o<=128))return p=[this.parse(c[1]),o],Object.defineProperty(p,"toString",{value:function(){return this.join("/")}}),p;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},t.isValid=function(u){return t.IPv6.isValid(u)||t.IPv4.isValid(u)},t.parse=function(u){if(t.IPv6.isValid(u))return t.IPv6.parse(u);if(t.IPv4.isValid(u))return t.IPv4.parse(u);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},t.parseCIDR=function(u){try{return t.IPv6.parseCIDR(u)}catch{try{return t.IPv4.parseCIDR(u)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},t.fromByteArray=function(u){var o;if(o=u.length,o===4)return new t.IPv4(u);if(o===16)return new t.IPv6(u);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},t.process=function(u){var o;return o=this.parse(u),o.kind()==="ipv6"&&o.isIPv4MappedAddress()?o.toIPv4Address():o}}).call(zt)})(xa);const Br=r=>Array.isArray(r)&&r.every(e=>Ur(e)),Ur=r=>!!r.errorCode,Ca=async()=>{try{const r=await pr.get("https://api.ipify.org/?format=json");return r.data.ip&&Pe.isValid(r.data.ip)?Pe.parse(r.data.ip).toString():void 0}catch{return}};class rn{constructor(e){this.client=e,this.list=()=>this.client.get("/v1/carriers"),this.get=t=>this.client.get(`/v1/carriers/${t}`),this.connect=async({carrierCode:t,...n})=>{const a=await Ca();return a?await this.client.post(`/v1/registration/${t}`,{...n,endUserIpAddress:a}):Promise.reject([new z("Unable to get IP address")])},this.addFunds=(t,n)=>this.client.put(`/v1/carriers/${t}/add_funds`,n),this.updateAutoFunding=(t,n)=>this.client.post(`/v1/carriers/${t}/auto_funding`,n),this.getAutoFunding=t=>this.client.get(`/v1/carriers/${t}/auto_funding`),this.client=e}}var dr={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},Mr={};function Ye(r){return typeof r=="string"?dr[r.toLowerCase()]:r}function hr(r,e){return hr=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t},hr(r,e)}function Na(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function yr(r,e,t){return yr=Na()?Reflect.construct:function(n,a,i){var s=[null];s.push.apply(s,a);var l=new(Function.bind.apply(n,s));return i&&hr(l,i.prototype),l},yr.apply(null,arguments)}function X(r){if(r==null)return r;if(Array.isArray(r))return r.slice();if(typeof r=="object"){var e={};return Object.keys(r).forEach(function(t){e[t]=r[t]}),e}return r}function vr(r){return r===void 0?"undefined":r===null?"null":Array.isArray(r)?"[ "+r.map(function(e){return vr(e)}).join(", ")+" ]":typeof r=="object"?JSON.stringify(r):typeof r=="function"?"[Function: "+r.name+"]":typeof r=="boolean"||typeof r=="number"?r:"'"+r.toString()+"'"}function K(r){if(typeof r!="string"){for(var e=new Array(arguments.length),t=0;t<arguments.length;t++)e[t]=vr(arguments[t]);return e.join(" ")}for(var n=/%[sdj%]/g,a=1,i=arguments,s=i.length,l=String(r).replace(n,function(d){if(d==="%%")return"%";if(a>=s)return d;switch(d){case"%s":return String(i[a++]);case"%d":return Number(i[a++]);case"%j":try{return JSON.stringify(i[a++])}catch{return"[Circular]"}default:return d}}),f=i[a];a<s;f=i[++a])l+=f===null||typeof f!="object"?" "+f:" "+vr(f);return l}function $a(r,e){var t=r.split(`
|
|
3
|
+
`);t[0]&&t[0].indexOf("call-stack-error")>=0&&t.shift();var n=t[e],a=null;if(n){var i=/^\s*(at|.*@)\s*(.+)?$/.exec(n);a=Array.isArray(i)&&i[2]?i[2]:n}return a}Object.keys(dr).forEach(function(r){Mr[dr[r]]=r});var mr={};function gr(r,e){if(e){if(mr[e])return;mr[e]=!0}console.error(r+`
|
|
4
|
+
`)}function _a(r){return mr[r]}function Da(){var r=[];return function(e,t){return t&&typeof t=="object"?r.indexOf(t)!==-1?"[Circular]":(r.push(t),t):t}}var Ta=function(){function r(){}return r.prototype.write=function(e){e.level<30?console.log(e):e.level<40?console.info(e):e.level<50?console.warn(e):console.error(e),e.err&&e.err.stack&&console.error(e.err.stack),e.obj&&console.log(e.obj)},r}(),Q=function(){function r(t,n,a){var i,s,l,f,d=this;if(!(this instanceof r))return new r(t,n);if(n!==void 0&&(i=t,t=n,!(i instanceof r)))throw new TypeError("invalid Logger creation: do not pass a second arg");if(!t)throw new TypeError("options (object) is required");if(i){if(t.name)throw new TypeError("invalid options.name: child cannot set logger name")}else if(!t.name)throw new TypeError("options.name (string) is required");if(t.stream&&t.streams)throw new TypeError('cannot mix "streams" and "stream" options');if(t.streams&&!Array.isArray(t.streams))throw new TypeError("invalid options.streams: must be an array");if(t.serializers&&(typeof t.serializers!="object"||Array.isArray(t.serializers)))throw new TypeError("invalid options.serializers: must be an object");if(i&&a){this._level=i._level,this.streams=i.streams,this.serializers=i.serializers,this.src=i.src,s=this.fields={};var u=Object.keys(i.fields);for(f=0;f<u.length;f++)s[l=u[f]]=i.fields[l];var o=Object.keys(t);for(f=0;f<o.length;f++)s[l=o[f]]=t[l]}else{if(i){for(this._level=i._level,this.streams=[],f=0;f<i.streams.length;f++){var c=X(i.streams[f]);this.streams.push(c)}this.serializers=X(i.serializers),this.src=i.src,this.fields=X(i.fields),t.level&&this.level(t.level)}else this._level=Number.POSITIVE_INFINITY,this.streams=[],this.serializers=null,this.src=!1,this.fields={};t.stream?this.addStream({type:"stream",stream:t.stream,level:t.level}):t.streams?t.streams.forEach(function(p){d.addStream(p,t.level)}):i&&t.level?this.level(t.level):i||this.addStream({type:"raw",stream:new Ta,level:t.level}),t.serializers&&this.addSerializers(t.serializers),t.src&&(this.src=!0),delete(s=X(t)).stream,delete s.level,delete s.streams,delete s.serializers,delete s.src,this.serializers&&this._applySerializers(s),Object.keys(s).forEach(function(p){d.fields[p]=s[p]})}}var e=r.prototype;return e.addStream=function(t,n){n===void 0&&(n=30),(t=X(t)).type="raw",t.level=Ye(t.level||n),t.level<this._level&&(this._level=t.level),this.streams.push(t),delete this.haveNonRawStreams},e.addSerializers=function(t){var n=this;this.serializers||(this.serializers={}),Object.keys(t).forEach(function(a){var i=t[a];if(typeof i!="function")throw new TypeError(K('invalid serializer for "%s" field: must be a function',a));n.serializers[a]=i})},e.child=function(t,n){return new this.constructor(this,t||{},n)},e.level=function(t){if(t===void 0)return this._level;for(var n=Ye(t),a=this.streams.length,i=0;i<a;i++)this.streams[i].level=n;this._level=n},e.levels=function(t,n){if(t===void 0)return this.streams.map(function(d){return d.level});var a;if(typeof t=="number"){if((a=this.streams[t])===void 0)throw new Error("invalid stream index: "+t)}else{for(var i=this.streams.length,s=0;s<i;s++){var l=this.streams[s];if(l.name===t){a=l;break}}if(!a)throw new Error(K('no stream with name "%s"',t))}if(n===void 0)return a.level;var f=Ye(n);a.level=f,f<this._level&&(this._level=f)},e._applySerializers=function(t,n){var a=this;Object.keys(this.serializers).forEach(function(i){if(!(t[i]===void 0||n&&n[i]))try{t[i]=a.serializers[i](t[i])}catch(s){gr(K(`bunyan: ERROR: Exception thrown from the "%s" Bunyan serializer. This should never happen. This is a bugin that serializer function.
|
|
5
|
+
%s`,i,s.stack||s)),t[i]=K('(Error in Bunyan log "%s" serializer broke field. See stderr for details.)',i)}})},e._emit=function(t,n){var a,i;if(this.haveNonRawStreams===void 0){for(this.haveNonRawStreams=!1,a=0;a<this.streams.length;a++)if(!this.streams[a].raw){this.haveNonRawStreams=!0;break}}if(n||this.haveNonRawStreams)try{i=JSON.stringify(t,Da())+`
|
|
6
|
+
`}catch(d){var s=d.stack.split(/\n/g,2).join(`
|
|
7
|
+
`);gr('bunyan: ERROR: Exception in `JSON.stringify(rec)`. You can install the "safe-json-stringify" module to have Bunyan fallback to safer stringification. Record:\n'+function(u,o){return o||(o=" "),o+u.split(/\r?\n/g).join(`
|
|
8
|
+
`+o)}(K(`%s
|
|
9
|
+
%s`,t,d.stack)),s),i=K(`(Exception in JSON.stringify(rec): %j. See stderr for details.)
|
|
10
|
+
`,d.message)}if(n)return i;var l=t.level;for(a=0;a<this.streams.length;a++){var f=this.streams[a];f.level<=l&&f.stream.write(t)}return i},r}();function ne(r){return function(){var e=this;function t(s){var l;s[0]instanceof Error?(n={err:e.serializers&&e.serializers.err?e.serializers.err(s[0]):nn.err(s[0])},l={err:!0},a=s.length===1?[n.err.message]:Array.prototype.slice.call(s,1)):typeof s[0]!="object"&&s[0]!==null||Array.isArray(s[0])?(n=null,a=Array.prototype.slice.call(s)):(n=s[0],a=s.length===1&&n.err&&n.err instanceof Error?[n.err.message]:Array.prototype.slice.call(s,1));var f=X(e.fields);f.level=r;var d=n?X(n):null;if(d&&(e.serializers&&e._applySerializers(d,l),Object.keys(d).forEach(function(o){f[o]=d[o]})),f.levelName=Mr[r],f.msg=a.length?K.apply(e,a):"",f.time||(f.time=new Date),e.src&&!f.src)try{throw new Error("call-stack-error")}catch(o){var u=o.stack?$a(o.stack,2):"";u||_a("src")||gr("Unable to determine src line info","src"),f.src=u||""}return f.v=1,f}var n=null,a=arguments,i=null;if(arguments.length===0)return this._level<=r;this._level>r||(i=t(a),this._emit(i))}}function tn(r){var e=r.stack||r.toString();if(r.cause&&typeof r.cause=="function"){var t=r.cause();t&&(e+=`
|
|
11
|
+
Caused by: `+tn(t))}return e}Q.prototype.trace=ne(10),Q.prototype.debug=ne(20),Q.prototype.info=ne(30),Q.prototype.warn=ne(40),Q.prototype.error=ne(50),Q.prototype.fatal=ne(60);var nn={err:function(r){return r&&r.stack?{message:r.message,name:r.name,stack:tn(r),code:r.code,signal:r.signal}:r}};function Fa(){return yr(Q,[].slice.call(arguments))}var St={levels:{trace:"color: DeepPink",debug:"color: GoldenRod",info:"color: DarkTurquoise",warn:"color: Purple",error:"color: Crimson",fatal:"color: Black"},def:"color: DimGray",msg:"color: SteelBlue",src:"color: DimGray; font-style: italic; font-size: 0.9em"},ka=function(){function r(e){var t=e===void 0?{}:e,n=t.logByLevel,a=t.css,i=a===void 0?St:a;this.logByLevel=n!==void 0&&n,this.css=i}return r.prototype.write=function(e){var t,n,a=this.css.def,i=this.css.msg,s=this.css.src,l=e.childName?e.name+"/"+e.childName:e.name,f=Mr[e.level],d=(Array(6-f.length).join(" ")+f).toUpperCase();this.logByLevel?(e.level===10?f="debug":e.level===60&&(f="error"),n=typeof console[f]=="function"?console[f]:console.log):n=console.log,t=e.level<20?this.css.levels.trace:e.level<30?this.css.levels.debug:e.level<40?this.css.levels.info:e.level<50?this.css.levels.warn:e.level<60?this.css.levels.error:this.css.levels.fatal;var u=function(c,p){return Array(p+1-(c+"").length).join("0")+c},o=[];o.push("[%s:%s:%s:%s] %c%s%c: %s: %c%s "+(e.src?"%c%s":"")),o.push(u(e.time.getHours(),2)),o.push(u(e.time.getMinutes(),2)),o.push(u(e.time.getSeconds(),2)),o.push(u(e.time.getMilliseconds(),4)),o.push(t),o.push(d),o.push(a),o.push(l),o.push(i),o.push(e.msg),e.src&&(o.push(s),o.push(e.src)),e.obj&&(o.push(`
|
|
12
|
+
`),o.push(e.obj)),e.err&&e.err.stack&&(o.push(`
|
|
13
|
+
`),o.push(e.err.stack)),n.apply(console,o)},r.getDefaultCss=function(){return St},r}(),de={},Ba={get exports(){return de},set exports(r){de=r}};(function(r){(function(e){var t=function(h,g,b){if(!d(g)||o(g)||c(g)||p(g)||f(g))return g;var S,O=0,k=0;if(u(g))for(S=[],k=g.length;O<k;O++)S.push(t(h,g[O],b));else{S={};for(var x in g)Object.prototype.hasOwnProperty.call(g,x)&&(S[h(x,b)]=t(h,g[x],b))}return S},n=function(h,g){g=g||{};var b=g.separator||"_",S=g.split||/(?=[A-Z])/;return h.split(S).join(b)},a=function(h){return y(h)?h:(h=h.replace(/[\-_\s]+(.)?/g,function(g,b){return b?b.toUpperCase():""}),h.substr(0,1).toLowerCase()+h.substr(1))},i=function(h){var g=a(h);return g.substr(0,1).toUpperCase()+g.substr(1)},s=function(h,g){return n(h,g).toLowerCase()},l=Object.prototype.toString,f=function(h){return typeof h=="function"},d=function(h){return h===Object(h)},u=function(h){return l.call(h)=="[object Array]"},o=function(h){return l.call(h)=="[object Date]"},c=function(h){return l.call(h)=="[object RegExp]"},p=function(h){return l.call(h)=="[object Boolean]"},y=function(h){return h=h-0,h===h},v=function(h,g){var b=g&&"process"in g?g.process:g;return typeof b!="function"?h:function(S,O){return b(S,h,O)}},m={camelize:a,decamelize:s,pascalize:i,depascalize:s,camelizeKeys:function(h,g){return t(v(a,g),h)},decamelizeKeys:function(h,g){return t(v(s,g),h,g)},pascalizeKeys:function(h,g){return t(v(i,g),h)},depascalizeKeys:function(){return this.decamelizeKeys.apply(this,arguments)}};r.exports?r.exports=m:e.humps=m})(zt)})(Ba);var Ua=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var a=42;e[t]=a;for(t in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var i=Object.getOwnPropertySymbols(e);if(i.length!==1||i[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,t);if(s.value!==a||s.enumerable!==!0)return!1}return!0},wt=typeof Symbol<"u"&&Symbol,Ma=Ua,za=function(){return typeof wt!="function"||typeof Symbol!="function"||typeof wt("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Ma()},La="Function.prototype.bind called on incompatible ",Ze=Array.prototype.slice,ja=Object.prototype.toString,qa="[object Function]",Wa=function(e){var t=this;if(typeof t!="function"||ja.call(t)!==qa)throw new TypeError(La+t);for(var n=Ze.call(arguments,1),a,i=function(){if(this instanceof a){var u=t.apply(this,n.concat(Ze.call(arguments)));return Object(u)===u?u:this}else return t.apply(e,n.concat(Ze.call(arguments)))},s=Math.max(0,t.length-n.length),l=[],f=0;f<s;f++)l.push("$"+f);if(a=Function("binder","return function ("+l.join(",")+"){ return binder.apply(this,arguments); }")(i),t.prototype){var d=function(){};d.prototype=t.prototype,a.prototype=new d,d.prototype=null}return a},Ha=Wa,zr=Function.prototype.bind||Ha,Va=zr,Ga=Va.call(Function.call,Object.prototype.hasOwnProperty),w,se=SyntaxError,an=Function,oe=TypeError,er=function(r){try{return an('"use strict"; return ('+r+").constructor;")()}catch{}},Z=Object.getOwnPropertyDescriptor;if(Z)try{Z({},"")}catch{Z=null}var rr=function(){throw new oe},Ja=Z?function(){try{return arguments.callee,rr}catch{try{return Z(arguments,"callee").get}catch{return rr}}}():rr,ae=za(),U=Object.getPrototypeOf||function(r){return r.__proto__},ie={},Ka=typeof Uint8Array>"u"?w:U(Uint8Array),ee={"%AggregateError%":typeof AggregateError>"u"?w:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?w:ArrayBuffer,"%ArrayIteratorPrototype%":ae?U([][Symbol.iterator]()):w,"%AsyncFromSyncIteratorPrototype%":w,"%AsyncFunction%":ie,"%AsyncGenerator%":ie,"%AsyncGeneratorFunction%":ie,"%AsyncIteratorPrototype%":ie,"%Atomics%":typeof Atomics>"u"?w:Atomics,"%BigInt%":typeof BigInt>"u"?w:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?w:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?w:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?w:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?w:Float32Array,"%Float64Array%":typeof Float64Array>"u"?w:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?w:FinalizationRegistry,"%Function%":an,"%GeneratorFunction%":ie,"%Int8Array%":typeof Int8Array>"u"?w:Int8Array,"%Int16Array%":typeof Int16Array>"u"?w:Int16Array,"%Int32Array%":typeof Int32Array>"u"?w:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ae?U(U([][Symbol.iterator]())):w,"%JSON%":typeof JSON=="object"?JSON:w,"%Map%":typeof Map>"u"?w:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ae?w:U(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?w:Promise,"%Proxy%":typeof Proxy>"u"?w:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?w:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?w:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ae?w:U(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?w:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ae?U(""[Symbol.iterator]()):w,"%Symbol%":ae?Symbol:w,"%SyntaxError%":se,"%ThrowTypeError%":Ja,"%TypedArray%":Ka,"%TypeError%":oe,"%Uint8Array%":typeof Uint8Array>"u"?w:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?w:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?w:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?w:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?w:WeakMap,"%WeakRef%":typeof WeakRef>"u"?w:WeakRef,"%WeakSet%":typeof WeakSet>"u"?w:WeakSet};try{null.error}catch(r){var Qa=U(U(r));ee["%Error.prototype%"]=Qa}var Xa=function r(e){var t;if(e==="%AsyncFunction%")t=er("async function () {}");else if(e==="%GeneratorFunction%")t=er("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=er("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&(t=U(a.prototype))}return ee[e]=t,t},bt={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ge=zr,Ie=Ga,Ya=ge.call(Function.call,Array.prototype.concat),Za=ge.call(Function.apply,Array.prototype.splice),Et=ge.call(Function.call,String.prototype.replace),Re=ge.call(Function.call,String.prototype.slice),ei=ge.call(Function.call,RegExp.prototype.exec),ri=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ti=/\\(\\)?/g,ni=function(e){var t=Re(e,0,1),n=Re(e,-1);if(t==="%"&&n!=="%")throw new se("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new se("invalid intrinsic syntax, expected opening `%`");var a=[];return Et(e,ri,function(i,s,l,f){a[a.length]=l?Et(f,ti,"$1"):s||i}),a},ai=function(e,t){var n=e,a;if(Ie(bt,n)&&(a=bt[n],n="%"+a[0]+"%"),Ie(ee,n)){var i=ee[n];if(i===ie&&(i=Xa(n)),typeof i>"u"&&!t)throw new oe("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:a,name:n,value:i}}throw new se("intrinsic "+e+" does not exist!")},Lr=function(e,t){if(typeof e!="string"||e.length===0)throw new oe("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new oe('"allowMissing" argument must be a boolean');if(ei(/^%?[^%]*%?$/,e)===null)throw new se("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=ni(e),a=n.length>0?n[0]:"",i=ai("%"+a+"%",t),s=i.name,l=i.value,f=!1,d=i.alias;d&&(a=d[0],Za(n,Ya([0,1],d)));for(var u=1,o=!0;u<n.length;u+=1){var c=n[u],p=Re(c,0,1),y=Re(c,-1);if((p==='"'||p==="'"||p==="`"||y==='"'||y==="'"||y==="`")&&p!==y)throw new se("property names with quotes must have matching quotes");if((c==="constructor"||!o)&&(f=!0),a+="."+c,s="%"+a+"%",Ie(ee,s))l=ee[s];else if(l!=null){if(!(c in l)){if(!t)throw new oe("base intrinsic for "+e+" exists, but the property is not available.");return}if(Z&&u+1>=n.length){var v=Z(l,c);o=!!v,o&&"get"in v&&!("originalValue"in v.get)?l=v.get:l=l[c]}else o=Ie(l,c),l=l[c];o&&!f&&(ee[s]=l)}}return l},Sr={},ii={get exports(){return Sr},set exports(r){Sr=r}};(function(r){var e=zr,t=Lr,n=t("%Function.prototype.apply%"),a=t("%Function.prototype.call%"),i=t("%Reflect.apply%",!0)||e.call(a,n),s=t("%Object.getOwnPropertyDescriptor%",!0),l=t("%Object.defineProperty%",!0),f=t("%Math.max%");if(l)try{l({},"a",{value:1})}catch{l=null}r.exports=function(o){var c=i(e,a,arguments);if(s&&l){var p=s(c,"length");p.configurable&&l(c,"length",{value:1+f(0,o.length-(arguments.length-1))})}return c};var d=function(){return i(e,n,arguments)};l?l(r.exports,"apply",{value:d}):r.exports.apply=d})(ii);var on=Lr,sn=Sr,oi=sn(on("String.prototype.indexOf")),si=function(e,t){var n=on(e,!!t);return typeof n=="function"&&oi(e,".prototype.")>-1?sn(n):n};const ui={},li=Object.freeze(Object.defineProperty({__proto__:null,default:ui},Symbol.toStringTag,{value:"Module"})),fi=Nn(li);var jr=typeof Map=="function"&&Map.prototype,tr=Object.getOwnPropertyDescriptor&&jr?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,xe=jr&&tr&&typeof tr.get=="function"?tr.get:null,At=jr&&Map.prototype.forEach,qr=typeof Set=="function"&&Set.prototype,nr=Object.getOwnPropertyDescriptor&&qr?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Ce=qr&&nr&&typeof nr.get=="function"?nr.get:null,Ot=qr&&Set.prototype.forEach,ci=typeof WeakMap=="function"&&WeakMap.prototype,he=ci?WeakMap.prototype.has:null,pi=typeof WeakSet=="function"&&WeakSet.prototype,ye=pi?WeakSet.prototype.has:null,di=typeof WeakRef=="function"&&WeakRef.prototype,Pt=di?WeakRef.prototype.deref:null,hi=Boolean.prototype.valueOf,yi=Object.prototype.toString,vi=Function.prototype.toString,mi=String.prototype.match,Wr=String.prototype.slice,V=String.prototype.replace,gi=String.prototype.toUpperCase,It=String.prototype.toLowerCase,un=RegExp.prototype.test,Rt=Array.prototype.concat,M=Array.prototype.join,Si=Array.prototype.slice,xt=Math.floor,wr=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ar=Object.getOwnPropertySymbols,br=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ue=typeof Symbol=="function"&&typeof Symbol.iterator=="object",R=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ue||"symbol")?Symbol.toStringTag:null,ln=Object.prototype.propertyIsEnumerable,Ct=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function Nt(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||un.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var n=r<0?-xt(-r):xt(r);if(n!==r){var a=String(n),i=Wr.call(e,a.length+1);return V.call(a,t,"$&_")+"."+V.call(V.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return V.call(e,t,"$&_")}var Er=fi,$t=Er.custom,_t=cn($t)?$t:null,wi=function r(e,t,n,a){var i=t||{};if(H(i,"quoteStyle")&&i.quoteStyle!=="single"&&i.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(H(i,"maxStringLength")&&(typeof i.maxStringLength=="number"?i.maxStringLength<0&&i.maxStringLength!==1/0:i.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=H(i,"customInspect")?i.customInspect:!0;if(typeof s!="boolean"&&s!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(H(i,"indent")&&i.indent!==null&&i.indent!==" "&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(H(i,"numericSeparator")&&typeof i.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var l=i.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return dn(e,i);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var f=String(e);return l?Nt(e,f):f}if(typeof e=="bigint"){var d=String(e)+"n";return l?Nt(e,d):d}var u=typeof i.depth>"u"?5:i.depth;if(typeof n>"u"&&(n=0),n>=u&&u>0&&typeof e=="object")return Ar(e)?"[Array]":"[Object]";var o=Ui(i,n);if(typeof a>"u")a=[];else if(pn(a,e)>=0)return"[Circular]";function c(D,T,j){if(T&&(a=Si.call(a),a.push(T)),j){var ce={depth:i.depth};return H(i,"quoteStyle")&&(ce.quoteStyle=i.quoteStyle),r(D,ce,n+1,a)}return r(D,i,n+1,a)}if(typeof e=="function"&&!Dt(e)){var p=Ci(e),y=Se(e,c);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(y.length>0?" { "+M.call(y,", ")+" }":"")}if(cn(e)){var v=ue?V.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):br.call(e);return typeof e=="object"&&!ue?pe(v):v}if(Fi(e)){for(var m="<"+It.call(String(e.nodeName)),h=e.attributes||[],g=0;g<h.length;g++)m+=" "+h[g].name+"="+fn(bi(h[g].value),"double",i);return m+=">",e.childNodes&&e.childNodes.length&&(m+="..."),m+="</"+It.call(String(e.nodeName))+">",m}if(Ar(e)){if(e.length===0)return"[]";var b=Se(e,c);return o&&!Bi(b)?"["+Or(b,o)+"]":"[ "+M.call(b,", ")+" ]"}if(Ai(e)){var S=Se(e,c);return!("cause"in Error.prototype)&&"cause"in e&&!ln.call(e,"cause")?"{ ["+String(e)+"] "+M.call(Rt.call("[cause]: "+c(e.cause),S),", ")+" }":S.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+M.call(S,", ")+" }"}if(typeof e=="object"&&s){if(_t&&typeof e[_t]=="function"&&Er)return Er(e,{depth:u-n});if(s!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Ni(e)){var O=[];return At&&At.call(e,function(D,T){O.push(c(T,e,!0)+" => "+c(D,e))}),Tt("Map",xe.call(e),O,o)}if(Di(e)){var k=[];return Ot&&Ot.call(e,function(D){k.push(c(D,e))}),Tt("Set",Ce.call(e),k,o)}if($i(e))return ir("WeakMap");if(Ti(e))return ir("WeakSet");if(_i(e))return ir("WeakRef");if(Pi(e))return pe(c(Number(e)));if(Ri(e))return pe(c(wr.call(e)));if(Ii(e))return pe(hi.call(e));if(Oi(e))return pe(c(String(e)));if(!Ei(e)&&!Dt(e)){var x=Se(e,c),W=Ct?Ct(e)===Object.prototype:e instanceof Object||e.constructor===Object,F=e instanceof Object?"":"null prototype",E=!W&&R&&Object(e)===e&&R in e?Wr.call(J(e),8,-1):F?"Object":"",C=W||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",N=C+(E||F?"["+M.call(Rt.call([],E||[],F||[]),": ")+"] ":"");return x.length===0?N+"{}":o?N+"{"+Or(x,o)+"}":N+"{ "+M.call(x,", ")+" }"}return String(e)};function fn(r,e,t){var n=(t.quoteStyle||e)==="double"?'"':"'";return n+r+n}function bi(r){return V.call(String(r),/"/g,""")}function Ar(r){return J(r)==="[object Array]"&&(!R||!(typeof r=="object"&&R in r))}function Ei(r){return J(r)==="[object Date]"&&(!R||!(typeof r=="object"&&R in r))}function Dt(r){return J(r)==="[object RegExp]"&&(!R||!(typeof r=="object"&&R in r))}function Ai(r){return J(r)==="[object Error]"&&(!R||!(typeof r=="object"&&R in r))}function Oi(r){return J(r)==="[object String]"&&(!R||!(typeof r=="object"&&R in r))}function Pi(r){return J(r)==="[object Number]"&&(!R||!(typeof r=="object"&&R in r))}function Ii(r){return J(r)==="[object Boolean]"&&(!R||!(typeof r=="object"&&R in r))}function cn(r){if(ue)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!br)return!1;try{return br.call(r),!0}catch{}return!1}function Ri(r){if(!r||typeof r!="object"||!wr)return!1;try{return wr.call(r),!0}catch{}return!1}var xi=Object.prototype.hasOwnProperty||function(r){return r in this};function H(r,e){return xi.call(r,e)}function J(r){return yi.call(r)}function Ci(r){if(r.name)return r.name;var e=mi.call(vi.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function pn(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,n=r.length;t<n;t++)if(r[t]===e)return t;return-1}function Ni(r){if(!xe||!r||typeof r!="object")return!1;try{xe.call(r);try{Ce.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function $i(r){if(!he||!r||typeof r!="object")return!1;try{he.call(r,he);try{ye.call(r,ye)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function _i(r){if(!Pt||!r||typeof r!="object")return!1;try{return Pt.call(r),!0}catch{}return!1}function Di(r){if(!Ce||!r||typeof r!="object")return!1;try{Ce.call(r);try{xe.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function Ti(r){if(!ye||!r||typeof r!="object")return!1;try{ye.call(r,ye);try{he.call(r,he)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function Fi(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function dn(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,n="... "+t+" more character"+(t>1?"s":"");return dn(Wr.call(r,0,e.maxStringLength),e)+n}var a=V.call(V.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ki);return fn(a,"single",e)}function ki(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+gi.call(e.toString(16))}function pe(r){return"Object("+r+")"}function ir(r){return r+" { ? }"}function Tt(r,e,t,n){var a=n?Or(t,n):M.call(t,", ");return r+" ("+e+") {"+a+"}"}function Bi(r){for(var e=0;e<r.length;e++)if(pn(r[e],`
|
|
14
|
+
`)>=0)return!1;return!0}function Ui(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=M.call(Array(r.indent+1)," ");else return null;return{base:t,prev:M.call(Array(e+1),t)}}function Or(r,e){if(r.length===0)return"";var t=`
|
|
15
|
+
`+e.prev+e.base;return t+M.call(r,","+t)+`
|
|
16
|
+
`+e.prev}function Se(r,e){var t=Ar(r),n=[];if(t){n.length=r.length;for(var a=0;a<r.length;a++)n[a]=H(r,a)?e(r[a],r):""}var i=typeof ar=="function"?ar(r):[],s;if(ue){s={};for(var l=0;l<i.length;l++)s["$"+i[l]]=i[l]}for(var f in r)H(r,f)&&(t&&String(Number(f))===f&&f<r.length||ue&&s["$"+f]instanceof Symbol||(un.call(/[^\w$]/,f)?n.push(e(f,r)+": "+e(r[f],r)):n.push(f+": "+e(r[f],r))));if(typeof ar=="function")for(var d=0;d<i.length;d++)ln.call(r,i[d])&&n.push("["+e(i[d])+"]: "+e(r[i[d]],r));return n}var Hr=Lr,fe=si,Mi=wi,zi=Hr("%TypeError%"),we=Hr("%WeakMap%",!0),be=Hr("%Map%",!0),Li=fe("WeakMap.prototype.get",!0),ji=fe("WeakMap.prototype.set",!0),qi=fe("WeakMap.prototype.has",!0),Wi=fe("Map.prototype.get",!0),Hi=fe("Map.prototype.set",!0),Vi=fe("Map.prototype.has",!0),Vr=function(r,e){for(var t=r,n;(n=t.next)!==null;t=n)if(n.key===e)return t.next=n.next,n.next=r.next,r.next=n,n},Gi=function(r,e){var t=Vr(r,e);return t&&t.value},Ji=function(r,e,t){var n=Vr(r,e);n?n.value=t:r.next={key:e,next:r.next,value:t}},Ki=function(r,e){return!!Vr(r,e)},Qi=function(){var e,t,n,a={assert:function(i){if(!a.has(i))throw new zi("Side channel does not contain "+Mi(i))},get:function(i){if(we&&i&&(typeof i=="object"||typeof i=="function")){if(e)return Li(e,i)}else if(be){if(t)return Wi(t,i)}else if(n)return Gi(n,i)},has:function(i){if(we&&i&&(typeof i=="object"||typeof i=="function")){if(e)return qi(e,i)}else if(be){if(t)return Vi(t,i)}else if(n)return Ki(n,i);return!1},set:function(i,s){we&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new we),ji(e,i,s)):be?(t||(t=new be),Hi(t,i,s)):(n||(n={key:{},next:null}),Ji(n,i,s))}};return a},Xi=String.prototype.replace,Yi=/%20/g,or={RFC1738:"RFC1738",RFC3986:"RFC3986"},Gr={default:or.RFC3986,formatters:{RFC1738:function(r){return Xi.call(r,Yi,"+")},RFC3986:function(r){return String(r)}},RFC1738:or.RFC1738,RFC3986:or.RFC3986},Zi=Gr,sr=Object.prototype.hasOwnProperty,Y=Array.isArray,B=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),eo=function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(Y(n)){for(var a=[],i=0;i<n.length;++i)typeof n[i]<"u"&&a.push(n[i]);t.obj[t.prop]=a}}},hn=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},a=0;a<e.length;++a)typeof e[a]<"u"&&(n[a]=e[a]);return n},ro=function r(e,t,n){if(!t)return e;if(typeof t!="object"){if(Y(e))e.push(t);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!sr.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);var a=e;return Y(e)&&!Y(t)&&(a=hn(e,n)),Y(e)&&Y(t)?(t.forEach(function(i,s){if(sr.call(e,s)){var l=e[s];l&&typeof l=="object"&&i&&typeof i=="object"?e[s]=r(l,i,n):e.push(i)}else e[s]=i}),e):Object.keys(t).reduce(function(i,s){var l=t[s];return sr.call(i,s)?i[s]=r(i[s],l,n):i[s]=l,i},a)},to=function(e,t){return Object.keys(t).reduce(function(n,a){return n[a]=t[a],n},e)},no=function(r,e,t){var n=r.replace(/\+/g," ");if(t==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},ao=function(e,t,n,a,i){if(e.length===0)return e;var s=e;if(typeof e=="symbol"?s=Symbol.prototype.toString.call(e):typeof e!="string"&&(s=String(e)),n==="iso-8859-1")return escape(s).replace(/%u[0-9a-f]{4}/gi,function(u){return"%26%23"+parseInt(u.slice(2),16)+"%3B"});for(var l="",f=0;f<s.length;++f){var d=s.charCodeAt(f);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||i===Zi.RFC1738&&(d===40||d===41)){l+=s.charAt(f);continue}if(d<128){l=l+B[d];continue}if(d<2048){l=l+(B[192|d>>6]+B[128|d&63]);continue}if(d<55296||d>=57344){l=l+(B[224|d>>12]+B[128|d>>6&63]+B[128|d&63]);continue}f+=1,d=65536+((d&1023)<<10|s.charCodeAt(f)&1023),l+=B[240|d>>18]+B[128|d>>12&63]+B[128|d>>6&63]+B[128|d&63]}return l},io=function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],a=0;a<t.length;++a)for(var i=t[a],s=i.obj[i.prop],l=Object.keys(s),f=0;f<l.length;++f){var d=l[f],u=s[d];typeof u=="object"&&u!==null&&n.indexOf(u)===-1&&(t.push({obj:s,prop:d}),n.push(u))}return eo(t),e},oo=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},so=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},uo=function(e,t){return[].concat(e,t)},lo=function(e,t){if(Y(e)){for(var n=[],a=0;a<e.length;a+=1)n.push(t(e[a]));return n}return t(e)},yn={arrayToObject:hn,assign:to,combine:uo,compact:io,decode:no,encode:ao,isBuffer:so,isRegExp:oo,maybeMap:lo,merge:ro},vn=Qi,Pr=yn,ve=Gr,fo=Object.prototype.hasOwnProperty,Ft={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},q=Array.isArray,co=String.prototype.split,po=Array.prototype.push,mn=function(r,e){po.apply(r,q(e)?e:[e])},ho=Date.prototype.toISOString,kt=ve.default,P={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Pr.encode,encodeValuesOnly:!1,format:kt,formatter:ve.formatters[kt],indices:!1,serializeDate:function(e){return ho.call(e)},skipNulls:!1,strictNullHandling:!1},yo=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},ur={},vo=function r(e,t,n,a,i,s,l,f,d,u,o,c,p,y,v,m){for(var h=e,g=m,b=0,S=!1;(g=g.get(ur))!==void 0&&!S;){var O=g.get(e);if(b+=1,typeof O<"u"){if(O===b)throw new RangeError("Cyclic object value");S=!0}typeof g.get(ur)>"u"&&(b=0)}if(typeof f=="function"?h=f(t,h):h instanceof Date?h=o(h):n==="comma"&&q(h)&&(h=Pr.maybeMap(h,function(Te){return Te instanceof Date?o(Te):Te})),h===null){if(i)return l&&!y?l(t,P.encoder,v,"key",c):t;h=""}if(yo(h)||Pr.isBuffer(h)){if(l){var k=y?t:l(t,P.encoder,v,"key",c);if(n==="comma"&&y){for(var x=co.call(String(h),","),W="",F=0;F<x.length;++F)W+=(F===0?"":",")+p(l(x[F],P.encoder,v,"value",c));return[p(k)+(a&&q(h)&&x.length===1?"[]":"")+"="+W]}return[p(k)+"="+p(l(h,P.encoder,v,"value",c))]}return[p(t)+"="+p(String(h))]}var E=[];if(typeof h>"u")return E;var C;if(n==="comma"&&q(h))C=[{value:h.length>0?h.join(",")||null:void 0}];else if(q(f))C=f;else{var N=Object.keys(h);C=d?N.sort(d):N}for(var D=a&&q(h)&&h.length===1?t+"[]":t,T=0;T<C.length;++T){var j=C[T],ce=typeof j=="object"&&typeof j.value<"u"?j.value:h[j];if(!(s&&ce===null)){var Rn=q(h)?typeof n=="function"?n(D,j):D:D+(u?"."+j:"["+j+"]");m.set(e,b);var Jr=vn();Jr.set(ur,m),mn(E,r(ce,Rn,n,a,i,s,l,f,d,u,o,c,p,y,v,Jr))}}return E},mo=function(e){if(!e)return P;if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||P.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=ve.default;if(typeof e.format<"u"){if(!fo.call(ve.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var a=ve.formatters[n],i=P.filter;return(typeof e.filter=="function"||q(e.filter))&&(i=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:P.addQueryPrefix,allowDots:typeof e.allowDots>"u"?P.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:P.charsetSentinel,delimiter:typeof e.delimiter>"u"?P.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:P.encode,encoder:typeof e.encoder=="function"?e.encoder:P.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:P.encodeValuesOnly,filter:i,format:n,formatter:a,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:P.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:P.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:P.strictNullHandling}},go=function(r,e){var t=r,n=mo(e),a,i;typeof n.filter=="function"?(i=n.filter,t=i("",t)):q(n.filter)&&(i=n.filter,a=i);var s=[];if(typeof t!="object"||t===null)return"";var l;e&&e.arrayFormat in Ft?l=e.arrayFormat:e&&"indices"in e?l=e.indices?"indices":"repeat":l="indices";var f=Ft[l];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var d=f==="comma"&&e&&e.commaRoundTrip;a||(a=Object.keys(t)),n.sort&&a.sort(n.sort);for(var u=vn(),o=0;o<a.length;++o){var c=a[o];n.skipNulls&&t[c]===null||mn(s,vo(t[c],c,f,d,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,u))}var p=s.join(n.delimiter),y=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?y+="utf8=%26%2310003%3B&":y+="utf8=%E2%9C%93&"),p.length>0?y+p:""},le=yn,Ir=Object.prototype.hasOwnProperty,So=Array.isArray,A={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:le.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},wo=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},gn=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},bo="utf8=%26%2310003%3B",Eo="utf8=%E2%9C%93",Ao=function(e,t){var n={},a=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=t.parameterLimit===1/0?void 0:t.parameterLimit,s=a.split(t.delimiter,i),l=-1,f,d=t.charset;if(t.charsetSentinel)for(f=0;f<s.length;++f)s[f].indexOf("utf8=")===0&&(s[f]===Eo?d="utf-8":s[f]===bo&&(d="iso-8859-1"),l=f,f=s.length);for(f=0;f<s.length;++f)if(f!==l){var u=s[f],o=u.indexOf("]="),c=o===-1?u.indexOf("="):o+1,p,y;c===-1?(p=t.decoder(u,A.decoder,d,"key"),y=t.strictNullHandling?null:""):(p=t.decoder(u.slice(0,c),A.decoder,d,"key"),y=le.maybeMap(gn(u.slice(c+1),t),function(v){return t.decoder(v,A.decoder,d,"value")})),y&&t.interpretNumericEntities&&d==="iso-8859-1"&&(y=wo(y)),u.indexOf("[]=")>-1&&(y=So(y)?[y]:y),Ir.call(n,p)?n[p]=le.combine(n[p],y):n[p]=y}return n},Oo=function(r,e,t,n){for(var a=n?e:gn(e,t),i=r.length-1;i>=0;--i){var s,l=r[i];if(l==="[]"&&t.parseArrays)s=[].concat(a);else{s=t.plainObjects?Object.create(null):{};var f=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,d=parseInt(f,10);!t.parseArrays&&f===""?s={0:a}:!isNaN(d)&&l!==f&&String(d)===f&&d>=0&&t.parseArrays&&d<=t.arrayLimit?(s=[],s[d]=a):f!=="__proto__"&&(s[f]=a)}a=s}return a},Po=function(e,t,n,a){if(e){var i=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,s=/(\[[^[\]]*])/,l=/(\[[^[\]]*])/g,f=n.depth>0&&s.exec(i),d=f?i.slice(0,f.index):i,u=[];if(d){if(!n.plainObjects&&Ir.call(Object.prototype,d)&&!n.allowPrototypes)return;u.push(d)}for(var o=0;n.depth>0&&(f=l.exec(i))!==null&&o<n.depth;){if(o+=1,!n.plainObjects&&Ir.call(Object.prototype,f[1].slice(1,-1))&&!n.allowPrototypes)return;u.push(f[1])}return f&&u.push("["+i.slice(f.index)+"]"),Oo(u,t,n,a)}},Io=function(e){if(!e)return A;if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=typeof e.charset>"u"?A.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?A.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:A.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:A.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:A.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:A.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:A.comma,decoder:typeof e.decoder=="function"?e.decoder:A.decoder,delimiter:typeof e.delimiter=="string"||le.isRegExp(e.delimiter)?e.delimiter:A.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:A.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:A.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:A.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:A.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:A.strictNullHandling}},Ro=function(r,e){var t=Io(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};for(var n=typeof r=="string"?Ao(r,t):r,a=t.plainObjects?Object.create(null):{},i=Object.keys(n),s=0;s<i.length;++s){var l=i[s],f=Po(l,n[l],t,typeof r=="string");a=le.merge(a,f,t)}return t.allowSparse===!0?a:le.compact(a)},xo=go,Co=Ro,No=Gr,$o={formats:No,parse:Co,stringify:xo};class Sn{constructor(e){this.client=e,this.list=()=>this.client.get("/v1/packages"),this.client=e}}class wn{constructor(e){this.client=e,this.get=t=>this.client.get(`/v1/insurance/${t}/balance`),this.client=e}}class bn{constructor(e){this.client=e,this.get=t=>this.client.get(`/v1/labels/${t}`),this.list=(t={})=>this.client.get("/v1/labels",{params:t}),this.createByRateId=(t,n)=>this.client.post(`/v1/labels/rates/${t}`,n),this.void=t=>this.client.put(`/v1/labels/${t}/void`),this.client=e}}class En{constructor(e){this.client=e,this.list=()=>this.client.get("/v-beta/order_sources"),this.get=t=>this.client.get(`/v-beta/order_sources/${t}`),this.refresh=t=>this.client.put(`/v-beta/order_sources/${t}/refresh`),this.client=e}}class An{constructor(e){this.client=e,this.calculateByShipmentId=(t,n)=>this.client.post("/v1/rates",{rateOptions:n,shipmentId:t}),this.client=e}}class On{constructor(e){this.client=e,this.list=(t={})=>this.client.post("/v-beta/shipments/list",t),this.get=t=>this.client.get(`/v-beta/shipments/${t}`),this.create=(t,n)=>this.client.post(`/v-beta/shipments/sales_order/${t}`,n),this.update=(t,n)=>this.client.put(`/v-beta/shipments/${t}`,n),this.client=e}}class Pn{constructor(e){this.client=e,this.list=(t={})=>this.client.get("/v-beta/sales_orders",{params:t}),this.get=t=>this.client.get(`/v-beta/sales_orders/${t}`),this.notifyShipped=(t,n)=>this.client.post(`/v-beta/sales_orders/${t}/notify`,n),this.client=e}}class In{constructor(e){this.client=e,this.list=()=>this.client.get("/v1/warehouses"),this.create=t=>this.client.post("/v1/warehouses",t),this.update=(t,n)=>this.client.put(`/v1/warehouses/${t}`,n),this.delete=t=>this.client.delete(`/v1/warehouses/${t}`),this.client=e}}const Bt=Fa({name:"shipengine-api",serializers:{...nn,req:r=>({headers:r.headers,method:r.method,url:r.url}),res:r=>({data:r.data,headers:r.config.headers,method:r.config.method,statusCode:r.status,url:r.config.url})},streams:[{stream:new ka}]}),_o=r=>!!r.errors&&Br(r.errors);class Do{constructor(e,{baseURL:t,headers:n,getToken:a}){const i=pr.create({baseURL:t,headers:{...n,Authorization:`Bearer ${e}`,"Content-Type":"application/json"},paramsSerializer:s=>$o.stringify(de.decamelizeKeys(s),{arrayFormat:"brackets"}),transformRequest:[s=>de.decamelizeKeys(s),s=>JSON.stringify(s)],transformResponse:[s=>{if(s)return JSON.parse(s)},s=>de.camelizeKeys(s)]});i.interceptors.response.use(s=>(Bt.info({req:s.config,res:s},"%s %s: %s %s",s.config.method?.toUpperCase(),s.config.url,s.status,s.statusText),s),async s=>{if(Bt.error({err:s,req:s.config,res:s.response},"%s %s: %s %s - %s",s.config?.method?.toUpperCase(),s.config?.url,s.response?.status,s.response?.statusText,s.message),s.response?.status===401){const l=await a(),f=s.config;return f&&(f.headers||={},f.headers.Authorization=`Bearer ${l}`),pr(f)}return s.response?.data?_o(s.response.data)?Promise.reject(s.response.data.errors.map(l=>z.fromObject(l))):Br(s.response.data)?Promise.reject(s.response.data.map(l=>z.fromObject(l))):Ur(s.response.data)?Promise.reject([z.fromObject(s.response.data)]):Promise.reject([new z(s.response.data)]):Promise.reject([new z(s.message)])}),this.client=i}set token(e){this.client.defaults.headers.common.Authorization=`Bearer ${e}`}get addresses(){return new Mt(this.client)}get accountSettings(){return new Ut(this.client)}get carriers(){return new rn(this.client)}get customPackages(){return new Sn(this.client)}get insurance(){return new wn(this.client)}get labels(){return new bn(this.client)}get orderSources(){return new En(this.client)}get rates(){return new An(this.client)}get salesOrderShipments(){return new On(this.client)}get salesOrders(){return new Pn(this.client)}get warehouses(){return new In(this.client)}}exports.AccountSettingsAPI=Ut;exports.AddressesAPI=Mt;exports.CarriersAPI=rn;exports.CodedError=z;exports.ConfirmationType=Cr;exports.CreditCardVendor=Rr;exports.Currency=xr;exports.CustomPackagesAPI=Sn;exports.CustomsContentsType=Nr;exports.CustomsNonDeliveryType=$r;exports.InsuranceAPI=wn;exports.InsuranceProviderType=_r;exports.LabelsAPI=bn;exports.OrderSourcesAPI=En;exports.RatesAPI=An;exports.SE=xn;exports.SalesOrderShipmentsAPI=On;exports.SalesOrdersAPI=Pn;exports.ShipEngineAPI=Do;exports.WarehousesAPI=In;exports.isCodedError=Ur;exports.isCodedErrors=Br;
|