@jentic/arazzo-validator 1.0.0-alpha.32 → 1.0.0-alpha.33

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.
@@ -21210,9 +21210,32 @@ function objectLiteral(value) {
21210
21210
  "use strict";
21211
21211
 
21212
21212
 
21213
- const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = __webpack_require__(75365)
21213
+ const { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = __webpack_require__(75365)
21214
21214
  const { SCHEMES, getSchemeHandler } = __webpack_require__(13956)
21215
21215
 
21216
+ const VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u
21217
+ const MALFORMED_SCHEME_ERROR = 'URI scheme is malformed.'
21218
+ const MALFORMED_HOST_ERROR = 'URI host is malformed.'
21219
+ // ASCII characters outside the RFC 3986 reg-name set (unreserved, sub-delims
21220
+ // and "%" for pct-encoded): C0 controls, space, DEL, and "#/:<>?@[\]^`{|}.
21221
+ const FORBIDDEN_DOMAIN_HOST_CHARACTER = /[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u
21222
+
21223
+ /**
21224
+ * RFC 3986 section 3.1 does not allow percent-encoding in a scheme, so the
21225
+ * scheme is validated as-is and never decoded. Decoding would let inert input
21226
+ * such as `%6Aavascript:` become a live `javascript:` scheme.
21227
+ *
21228
+ * @param {string} scheme
21229
+ * @returns {string}
21230
+ */
21231
+ function validateScheme (scheme) {
21232
+ const stringScheme = String(scheme)
21233
+ if (!VALID_SCHEME.test(stringScheme)) {
21234
+ throw new TypeError(MALFORMED_SCHEME_ERROR)
21235
+ }
21236
+ return stringScheme
21237
+ }
21238
+
21216
21239
  /**
21217
21240
  * @template {import('./types/index').URIComponent|string} T
21218
21241
  * @param {T} uri
@@ -21236,7 +21259,56 @@ function normalize (uri, options) {
21236
21259
  */
21237
21260
  function resolve (baseURI, relativeURI, options) {
21238
21261
  const schemelessOptions = options ? Object.assign({ scheme: 'null' }, options) : { scheme: 'null' }
21239
- const resolved = resolveComponent(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true)
21262
+ const {
21263
+ parsed: baseParsed,
21264
+ malformedAuthorityOrPort: baseMalformed,
21265
+ malformedPercentEncoding: baseMalformedPercentEncoding,
21266
+ malformedSchemeSpecific: baseMalformedSchemeSpecific,
21267
+ malformedHost: baseMalformedHost,
21268
+ malformedScheme: baseMalformedScheme
21269
+ } = parseWithStatus(baseURI, schemelessOptions)
21270
+ const {
21271
+ parsed: relativeParsed,
21272
+ malformedAuthorityOrPort: relativeMalformed,
21273
+ malformedPercentEncoding: relativeMalformedPercentEncoding,
21274
+ malformedSchemeSpecific: relativeMalformedSchemeSpecific,
21275
+ malformedHost: relativeMalformedHost,
21276
+ malformedScheme: relativeMalformedScheme
21277
+ } = parseWithStatus(relativeURI, schemelessOptions)
21278
+ if (
21279
+ baseMalformed ||
21280
+ relativeMalformed ||
21281
+ baseMalformedPercentEncoding ||
21282
+ relativeMalformedPercentEncoding ||
21283
+ baseMalformedSchemeSpecific ||
21284
+ relativeMalformedSchemeSpecific ||
21285
+ baseMalformedHost ||
21286
+ relativeMalformedHost ||
21287
+ baseMalformedScheme ||
21288
+ relativeMalformedScheme
21289
+ ) {
21290
+ throw new Error(baseParsed.error || relativeParsed.error || 'URI is malformed.')
21291
+ }
21292
+ const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true)
21293
+ const resolvedSchemeHandler = getSchemeHandler((options && options.scheme) || resolved.scheme)
21294
+ const resolvedHost = resolved.host
21295
+ const resolvedHostIsIP = resolvedHost !== undefined && resolvedHost !== '' &&
21296
+ (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6)
21297
+ // Inputs are parsed scheme-neutrally, so delimiters and controls in a domain
21298
+ // host are only detected here, once the final scheme is known. They always
21299
+ // fail closed, including in percent-encoded hosts.
21300
+ if (hasForbiddenDomainHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP)) {
21301
+ throw new Error(MALFORMED_HOST_ERROR)
21302
+ }
21303
+ canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP)
21304
+ // Percent escapes in an ASCII reg-name are encoded data. The WHATWG hostname
21305
+ // parser can reject them even though fast-uri preserves them safely as RFC
21306
+ // 3986 data. A raw non-ASCII host must still fail closed if conversion fails.
21307
+ const encodedASCIIHost = resolvedHost && resolvedHost.indexOf('%') !== -1 &&
21308
+ !/\P{ASCII}/u.test(resolvedHost)
21309
+ if (resolved.error && !encodedASCIIHost) {
21310
+ throw new Error(resolved.error)
21311
+ }
21240
21312
  schemelessOptions.skipEscape = true
21241
21313
  return serialize(resolved, schemelessOptions)
21242
21314
  }
@@ -21285,14 +21357,17 @@ function resolveComponent (base, relative, options, skipNormalization) {
21285
21357
  if (relative.path[0] === '/') {
21286
21358
  target.path = removeDotSegments(relative.path)
21287
21359
  } else {
21288
- if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
21360
+ const baseHasAuthority = base.userinfo !== undefined || base.host !== undefined || base.port !== undefined
21361
+ if (baseHasAuthority && !base.path) {
21289
21362
  target.path = '/' + relative.path
21290
21363
  } else if (!base.path) {
21291
21364
  target.path = relative.path
21292
21365
  } else {
21293
21366
  target.path = base.path.slice(0, base.path.lastIndexOf('/') + 1) + relative.path
21294
21367
  }
21295
- target.path = removeDotSegments(target.path)
21368
+ target.path = base.scheme === undefined && !baseHasAuthority && target.path[0] !== '/'
21369
+ ? removeDotSegmentsRelative(target.path)
21370
+ : removeDotSegments(target.path)
21296
21371
  }
21297
21372
  target.query = relative.query
21298
21373
  }
@@ -21319,7 +21394,7 @@ function equal (uriA, uriB, options) {
21319
21394
  const normalizedA = normalizeComparableURI(uriA, options)
21320
21395
  const normalizedB = normalizeComparableURI(uriB, options)
21321
21396
 
21322
- return normalizedA !== undefined && normalizedB !== undefined && normalizedA.toLowerCase() === normalizedB.toLowerCase()
21397
+ return normalizedA !== undefined && normalizedB !== undefined && normalizedA === normalizedB
21323
21398
  }
21324
21399
 
21325
21400
  /**
@@ -21347,25 +21422,34 @@ function serialize (cmpts, opts) {
21347
21422
  const options = Object.assign({}, opts)
21348
21423
  const uriTokens = []
21349
21424
 
21425
+ if (component.scheme) {
21426
+ component.scheme = validateScheme(component.scheme)
21427
+ }
21428
+
21350
21429
  // find scheme handler
21351
21430
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme)
21352
21431
 
21353
21432
  // perform scheme specific serialization
21354
21433
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options)
21355
21434
 
21435
+ const hasAuthority = component.userinfo !== undefined || component.host !== undefined || component.port !== undefined
21436
+ // A reference with no emitted scheme is path-noscheme: a bare ':' in its
21437
+ // first path segment would reparse as a scheme (RFC 3986 3.3/4.2). Enforced
21438
+ // under skipEscape too (resolve()), so the reapply below gates on this flag.
21439
+ const schemelessReference = (component.scheme === undefined || options.reference === 'suffix') && !hasAuthority
21440
+ const pathNoScheme = !options.skipEscape && schemelessReference
21441
+
21356
21442
  if (component.path !== undefined) {
21357
21443
  if (!options.skipEscape) {
21358
- component.path = escapePreservingEscapes(component.path)
21359
-
21360
- if (component.scheme !== undefined) {
21361
- component.path = component.path.split('%3A').join(':')
21362
- }
21444
+ component.path = serializePathEncoding(component.path, pathNoScheme)
21363
21445
  } else {
21364
21446
  component.path = normalizePercentEncoding(component.path)
21365
21447
  }
21366
21448
  }
21367
21449
 
21368
21450
  if (options.reference !== 'suffix' && component.scheme) {
21451
+ // Scheme handlers may replace the scheme during serialization.
21452
+ component.scheme = validateScheme(component.scheme)
21369
21453
  uriTokens.push(component.scheme, ':')
21370
21454
  }
21371
21455
 
@@ -21385,7 +21469,19 @@ function serialize (cmpts, opts) {
21385
21469
  let s = component.path
21386
21470
 
21387
21471
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
21388
- s = removeDotSegments(s)
21472
+ // A relative-path reference keeps its unresolvable leading ".." segments
21473
+ // and must never become root-relative (RFC 3986 section 5.2.4 applies to
21474
+ // merged target paths, not to the reference itself).
21475
+ s = schemelessReference && s[0] !== '/'
21476
+ ? removeDotSegmentsRelative(s)
21477
+ : removeDotSegments(s)
21478
+ }
21479
+
21480
+ // Dot-segment removal can expose a colon that was not originally in the
21481
+ // first segment (for example, "./a:b"). Reapply path-noscheme encoding so
21482
+ // the serialized relative reference cannot be reparsed as a URI scheme.
21483
+ if (schemelessReference) {
21484
+ s = serializePathEncoding(s, true)
21389
21485
  }
21390
21486
 
21391
21487
  if (
@@ -21401,11 +21497,11 @@ function serialize (cmpts, opts) {
21401
21497
  }
21402
21498
 
21403
21499
  if (component.query !== undefined) {
21404
- uriTokens.push('?', component.query)
21500
+ uriTokens.push('?', encodeQuery(component.query))
21405
21501
  }
21406
21502
 
21407
21503
  if (component.fragment !== undefined) {
21408
- uriTokens.push('#', component.fragment)
21504
+ uriTokens.push('#', encodeFragment(component.fragment))
21409
21505
  }
21410
21506
  return uriTokens.join('')
21411
21507
  }
@@ -21416,6 +21512,15 @@ const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:
21416
21512
  // with or without a scheme prefix, for the literal-backslash rejection below.
21417
21513
  const AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/
21418
21514
 
21515
+ // Captures the leading authority-introducer region after an optional scheme: a
21516
+ // run of forward slashes, backslashes, and the characters the WHATWG URL parser
21517
+ // removes before parsing (TAB U+0009, LF U+000A, CR U+000D). A valid introducer
21518
+ // is exactly "//". Node treats "\" as "/" on special schemes and strips those
21519
+ // characters first, so forms like "\\", "/\", "\/", "/<TAB>/", or a leading
21520
+ // "<TAB>//" reach an authority in Node while fast-uri's URI_PARSE folds them into
21521
+ // the path group (host confusion / SSRF / redirect bypass).
21522
+ const AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/
21523
+
21419
21524
  /**
21420
21525
  * @param {import('./types/index').URIComponent} parsed
21421
21526
  * @param {RegExpMatchArray} matches
@@ -21433,10 +21538,137 @@ function getParseError (parsed, matches) {
21433
21538
  return undefined
21434
21539
  }
21435
21540
 
21541
+ /**
21542
+ * Checks percent syntax without decoding the represented octets. RFC 3986
21543
+ * percent-encoding is byte-oriented, so sequences such as `%FF` are valid even
21544
+ * though they are not independently valid UTF-8.
21545
+ *
21546
+ * @param {string|undefined} component
21547
+ * @returns {boolean}
21548
+ */
21549
+ function hasMalformedPercentEncoding (component) {
21550
+ if (component === undefined) return false
21551
+
21552
+ let percent = component.indexOf('%')
21553
+ while (percent !== -1) {
21554
+ if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
21555
+ return true
21556
+ }
21557
+ percent = component.indexOf('%', percent + 3)
21558
+ }
21559
+
21560
+ return false
21561
+ }
21562
+
21563
+ /**
21564
+ * Whether the host is a bracketed IP literal (RFC 3986 `IP-literal`).
21565
+ * An unterminated `[` is not a literal, so it must still be validated as a
21566
+ * reg-name instead of being waved through as an IP.
21567
+ *
21568
+ * @param {string} host
21569
+ * @returns {boolean}
21570
+ */
21571
+ function isIPLiteral (host) {
21572
+ return host[0] === '[' && host[host.length - 1] === ']'
21573
+ }
21574
+
21575
+ /**
21576
+ * @param {RegExpMatchArray} matches
21577
+ * @returns {boolean}
21578
+ */
21579
+ function hasMalformedComponentPercentEncoding (matches) {
21580
+ // Bracketed IP literals use a raw "%" as the zone separator for historical
21581
+ // compatibility. Their parsing is intentionally left to normalizeIPv6.
21582
+ const host = matches[4]
21583
+ return hasMalformedPercentEncoding(matches[3]) ||
21584
+ (host !== undefined && !isIPLiteral(host) && hasMalformedPercentEncoding(host)) ||
21585
+ hasMalformedPercentEncoding(matches[6]) ||
21586
+ hasMalformedPercentEncoding(matches[7]) ||
21587
+ hasMalformedPercentEncoding(matches[8])
21588
+ }
21589
+
21590
+ /**
21591
+ * @param {import('./types/index').URIComponent} parsed
21592
+ * @param {import('./types/index').Options} options
21593
+ * @param {{ domainHost?: boolean, unicodeSupport?: boolean }|undefined} schemeHandler
21594
+ * @param {boolean} isIP
21595
+ * @returns {boolean} whether host conversion failed
21596
+ */
21597
+ function canonicalizeHost (parsed, options, schemeHandler, isIP) {
21598
+ if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP)) {
21599
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR
21600
+ return true
21601
+ }
21602
+
21603
+ if (
21604
+ !options.unicodeSupport &&
21605
+ (!schemeHandler || !schemeHandler.unicodeSupport) &&
21606
+ parsed.host &&
21607
+ !isIPLiteral(parsed.host) &&
21608
+ (options.domainHost || (schemeHandler && schemeHandler.domainHost)) &&
21609
+ isIP === false &&
21610
+ nonSimpleDomain(parsed.host)
21611
+ ) {
21612
+ let url
21613
+ try {
21614
+ url = new URL('http://' + parsed.host)
21615
+ } catch (e) {
21616
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e
21617
+ return true
21618
+ }
21619
+ // The WHATWG parser must have read the whole input as a host. Anything
21620
+ // else means it found a delimiter fast-uri did not, so its hostname would
21621
+ // describe a different authority.
21622
+ if (!isHostOnlyURL(url)) {
21623
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR
21624
+ return true
21625
+ }
21626
+ parsed.host = url.hostname
21627
+ }
21628
+ return false
21629
+ }
21630
+
21631
+ /**
21632
+ * Whether a domain host contains an ASCII character that RFC 3986 does not
21633
+ * allow in a reg-name (unreserved, sub-delims, or pct-encoded). Such a host is
21634
+ * rejected instead of being handed to the WHATWG URL parser, which would treat
21635
+ * "@" as a userinfo delimiter (silently dropping the data before it) and strip
21636
+ * TAB, LF, and CR. Non-ASCII characters remain allowed for IDNs.
21637
+ *
21638
+ * @param {import('./types/index').URIComponent} parsed
21639
+ * @param {import('./types/index').Options} options
21640
+ * @param {{ domainHost?: boolean }|undefined} schemeHandler
21641
+ * @param {boolean} isIP
21642
+ * @returns {boolean}
21643
+ */
21644
+ function hasForbiddenDomainHost (parsed, options, schemeHandler, isIP) {
21645
+ return Boolean(
21646
+ parsed.host &&
21647
+ isIP === false &&
21648
+ !isIPLiteral(parsed.host) &&
21649
+ (options.domainHost || (schemeHandler && schemeHandler.domainHost)) &&
21650
+ FORBIDDEN_DOMAIN_HOST_CHARACTER.test(parsed.host)
21651
+ )
21652
+ }
21653
+
21654
+ /**
21655
+ * @param {URL} url
21656
+ * @returns {boolean}
21657
+ */
21658
+ function isHostOnlyURL (url) {
21659
+ return url.username === '' &&
21660
+ url.password === '' &&
21661
+ url.port === '' &&
21662
+ url.pathname === '/' &&
21663
+ url.search === '' &&
21664
+ url.hash === '' &&
21665
+ url.hostname !== ''
21666
+ }
21667
+
21436
21668
  /**
21437
21669
  * @param {string} uri
21438
21670
  * @param {import('./types/index').Options} [opts]
21439
- * @returns {{ parsed: import('./types/index').URIComponent, malformedAuthorityOrPort: boolean }}
21671
+ * @returns {{ parsed: import('./types/index').URIComponent, malformedAuthorityOrPort: boolean, malformedPercentEncoding: boolean, malformedSchemeSpecific: boolean, malformedHost: boolean, malformedScheme: boolean }}
21440
21672
  */
21441
21673
  function parseWithStatus (uri, opts) {
21442
21674
  const options = Object.assign({}, opts)
@@ -21452,6 +21684,11 @@ function parseWithStatus (uri, opts) {
21452
21684
  }
21453
21685
 
21454
21686
  let malformedAuthorityOrPort = false
21687
+ let malformedPercentEncoding = false
21688
+ let malformedSchemeSpecific = false
21689
+ let malformedHost = false
21690
+ let malformedIPLiteral = false
21691
+ let malformedScheme = false
21455
21692
 
21456
21693
  let isIP = false
21457
21694
  if (options.reference === 'suffix') {
@@ -21475,6 +21712,28 @@ function parseWithStatus (uri, opts) {
21475
21712
  malformedAuthorityOrPort = true
21476
21713
  }
21477
21714
 
21715
+ // Reject a malformed or whitespace-smuggled authority introducer. fast-uri
21716
+ // only recognizes a literal "//"; anything else in the leading separator run
21717
+ // (a backslash, or a "//" that appears only after removing the TAB/LF/CR that
21718
+ // Node strips) means the authority fast-uri parses differs from the one Node's
21719
+ // URL resolves. Reject rather than rewrite, mirroring the literal-backslash
21720
+ // guard above. Percent-encoded forms (%5C, %09) are untouched, valid data.
21721
+ const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION)
21722
+ if (introducerMatch !== null) {
21723
+ const region = introducerMatch[1]
21724
+ const normalizedRegion = region.replace(/[\t\n\r]/g, '')
21725
+ // Two or more leading separators introduce an authority.
21726
+ if (normalizedRegion.length >= 2) {
21727
+ if (normalizedRegion.slice(0, 2) !== '//') {
21728
+ parsed.error = parsed.error || 'URI authority must not contain a literal backslash.'
21729
+ malformedAuthorityOrPort = true
21730
+ } else if (region.length !== normalizedRegion.length) {
21731
+ parsed.error = parsed.error || 'URI authority introducer must not contain whitespace.'
21732
+ malformedAuthorityOrPort = true
21733
+ }
21734
+ }
21735
+ }
21736
+
21478
21737
  const matches = uri.match(URI_PARSE)
21479
21738
 
21480
21739
  if (matches) {
@@ -21487,6 +21746,20 @@ function parseWithStatus (uri, opts) {
21487
21746
  parsed.query = matches[7]
21488
21747
  parsed.fragment = matches[8]
21489
21748
 
21749
+ if (parsed.scheme !== undefined) {
21750
+ if (VALID_SCHEME.test(parsed.scheme)) {
21751
+ parsed.scheme = parsed.scheme.toLowerCase()
21752
+ } else {
21753
+ parsed.error = parsed.error || MALFORMED_SCHEME_ERROR
21754
+ malformedScheme = true
21755
+ }
21756
+ }
21757
+
21758
+ malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches)
21759
+ if (malformedPercentEncoding) {
21760
+ parsed.error = parsed.error || 'URI contains malformed percent-encoding.'
21761
+ }
21762
+
21490
21763
  // fix port number
21491
21764
  if (isNaN(parsed.port)) {
21492
21765
  parsed.port = matches[5]
@@ -21501,9 +21774,17 @@ function parseWithStatus (uri, opts) {
21501
21774
  if (parsed.host) {
21502
21775
  const ipv4result = isIPv4(parsed.host)
21503
21776
  if (ipv4result === false) {
21777
+ const bracketedIPLiteral = isIPLiteral(parsed.host)
21778
+ const hasIPLiteralBracket = parsed.host.indexOf('[') !== -1 || parsed.host.indexOf(']') !== -1
21504
21779
  const ipv6result = normalizeIPv6(parsed.host)
21505
- parsed.host = ipv6result.host.toLowerCase()
21506
- isIP = ipv6result.isIPV6
21780
+ isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true
21781
+ malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true)
21782
+ parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase()
21783
+
21784
+ if (malformedIPLiteral) {
21785
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR
21786
+ malformedAuthorityOrPort = true
21787
+ }
21507
21788
  } else {
21508
21789
  isIP = true
21509
21790
  }
@@ -21526,49 +21807,48 @@ function parseWithStatus (uri, opts) {
21526
21807
  // find scheme handler
21527
21808
  const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme)
21528
21809
 
21529
- // check if scheme can't handle IRIs
21530
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
21531
- // if host component is a domain name
21532
- if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && isIP === false && nonSimpleDomain(parsed.host)) {
21533
- // convert Unicode IDN -> ASCII IDN
21534
- try {
21535
- parsed.host = new URL('http://' + parsed.host).hostname
21536
- } catch (e) {
21537
- parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e
21538
- }
21810
+ // convert Unicode IDN -> ASCII IDN when the effective scheme uses domain hosts
21811
+ if (!malformedIPLiteral) {
21812
+ malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP)
21813
+ }
21814
+
21815
+ if (uri.indexOf('%') !== -1 && parsed.host !== undefined && !malformedIPLiteral) {
21816
+ let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true)
21817
+ if (!isIP) {
21818
+ // Fold reg-name case after decoding unreserved octets. The second
21819
+ // pass only restores uppercase hex in escapes that remain encoded.
21820
+ host = normalizePercentEncoding(host.toLowerCase())
21539
21821
  }
21540
- // convert IRI -> URI
21822
+ // Resolution parses both inputs with the internal `null` scheme before
21823
+ // the effective scheme is known. Keep raw host delimiters for that step
21824
+ // so resolve() can reject them for domain-host schemes; the resolved
21825
+ // authority is encoded when it is serialized.
21826
+ parsed.host = isIP || options.scheme !== 'null' ? reescapeHostDelimiters(host, isIP) : host
21541
21827
  }
21542
21828
 
21543
21829
  if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) {
21544
- if (uri.indexOf('%') !== -1) {
21545
- if (parsed.scheme !== undefined) {
21546
- parsed.scheme = unescape(parsed.scheme)
21547
- }
21548
- if (parsed.host !== undefined) {
21549
- parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP)
21550
- }
21551
- }
21552
21830
  if (parsed.path) {
21553
21831
  parsed.path = normalizePathEncoding(parsed.path)
21554
21832
  }
21833
+ if (parsed.query) {
21834
+ parsed.query = normalizeQueryFragmentEncoding(parsed.query)
21835
+ }
21555
21836
  if (parsed.fragment) {
21556
- try {
21557
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment))
21558
- } catch {
21559
- parsed.error = parsed.error || 'URI malformed'
21560
- }
21837
+ parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment)
21561
21838
  }
21562
21839
  }
21563
21840
 
21564
21841
  // perform scheme specific parsing
21565
21842
  if (schemeHandler && schemeHandler.parse) {
21566
21843
  schemeHandler.parse(parsed, options)
21844
+ if (schemeHandler === SCHEMES.urn && parsed.nid === undefined) {
21845
+ malformedSchemeSpecific = true
21846
+ }
21567
21847
  }
21568
21848
  } else {
21569
21849
  parsed.error = parsed.error || 'URI can not be parsed.'
21570
21850
  }
21571
- return { parsed, malformedAuthorityOrPort }
21851
+ return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme }
21572
21852
  }
21573
21853
 
21574
21854
  /**
@@ -21592,13 +21872,17 @@ function normalizeString (uri, opts) {
21592
21872
  /**
21593
21873
  * @param {string} uri
21594
21874
  * @param {import('./types/index').Options} [opts]
21595
- * @returns {{ normalized: string, malformedAuthorityOrPort: boolean }}
21875
+ * @returns {{ normalized: string, malformedAuthorityOrPort: boolean, malformedPercentEncoding: boolean, malformedSchemeSpecific: boolean, malformedHost: boolean, malformedScheme: boolean }}
21596
21876
  */
21597
21877
  function normalizeStringWithStatus (uri, opts) {
21598
- const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts)
21878
+ const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts)
21599
21879
  return {
21600
- normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
21601
- malformedAuthorityOrPort
21880
+ normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
21881
+ malformedAuthorityOrPort,
21882
+ malformedPercentEncoding,
21883
+ malformedSchemeSpecific,
21884
+ malformedHost,
21885
+ malformedScheme
21602
21886
  }
21603
21887
  }
21604
21888
 
@@ -21608,14 +21892,18 @@ function normalizeStringWithStatus (uri, opts) {
21608
21892
  * @returns {string|undefined}
21609
21893
  */
21610
21894
  function normalizeComparableURI (uri, opts) {
21611
- if (typeof uri === 'string') {
21612
- const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts)
21613
- return malformedAuthorityOrPort ? undefined : normalized
21895
+ if (typeof uri !== 'string' && typeof uri !== 'object') {
21896
+ return undefined
21614
21897
  }
21615
21898
 
21616
- if (typeof uri === 'object') {
21617
- return serialize(uri, opts)
21899
+ let value
21900
+ try {
21901
+ value = typeof uri === 'string' ? uri : serialize(uri, opts)
21902
+ } catch {
21903
+ return undefined
21618
21904
  }
21905
+ const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts)
21906
+ return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? undefined : normalized
21619
21907
  }
21620
21908
 
21621
21909
  const fastUri = {
@@ -21642,7 +21930,7 @@ module.exports.fastUri = fastUri
21642
21930
 
21643
21931
 
21644
21932
  const { isUUID } = __webpack_require__(75365)
21645
- const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu
21933
+ const URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu
21646
21934
 
21647
21935
  const supportedSchemeNames = /** @type {const} */ (['http', 'https', 'ws',
21648
21936
  'wss', 'urn', 'urn:uuid'])
@@ -21754,9 +22042,14 @@ function wsSerialize (wsComponent) {
21754
22042
 
21755
22043
  // reconstruct path from resource name
21756
22044
  if (wsComponent.resourceName) {
21757
- const [path, query] = wsComponent.resourceName.split('?')
22045
+ const queryIndex = wsComponent.resourceName.indexOf('?')
22046
+ const path = queryIndex === -1
22047
+ ? wsComponent.resourceName
22048
+ : wsComponent.resourceName.slice(0, queryIndex)
21758
22049
  wsComponent.path = (path && path !== '/' ? path : undefined)
21759
- wsComponent.query = query
22050
+ wsComponent.query = queryIndex === -1
22051
+ ? undefined
22052
+ : wsComponent.resourceName.slice(queryIndex + 1)
21760
22053
  wsComponent.resourceName = undefined
21761
22054
  }
21762
22055
 
@@ -21773,7 +22066,7 @@ function urnParse (urnComponent, options) {
21773
22066
  return urnComponent
21774
22067
  }
21775
22068
  const matches = urnComponent.path.match(URN_REG)
21776
- if (matches) {
22069
+ if (matches && matches[0] === urnComponent.path) {
21777
22070
  const scheme = options.scheme || urnComponent.scheme || 'urn'
21778
22071
  urnComponent.nid = matches[1].toLowerCase()
21779
22072
  urnComponent.nss = matches[2]
@@ -21922,6 +22215,9 @@ const isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\d
21922
22215
  /** @type {(value: string) => boolean} */
21923
22216
  const isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u)
21924
22217
 
22218
+ /** @type {(value: string) => boolean} */
22219
+ const isPort = RegExp.prototype.test.bind(/^\d*$/u)
22220
+
21925
22221
  /** @type {(value: string) => boolean} */
21926
22222
  const isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu)
21927
22223
 
@@ -21929,7 +22225,36 @@ const isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu)
21929
22225
  const isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu)
21930
22226
 
21931
22227
  /** @type {(value: string) => boolean} */
21932
- const isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu)
22228
+ const isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u)
22229
+
22230
+ /** @type {(value: string) => boolean} */
22231
+ const isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u)
22232
+
22233
+ /** @type {(value: string) => boolean} */
22234
+ const isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u)
22235
+
22236
+ const BYTE_HEX = new Array(256)
22237
+ {
22238
+ const HEX_DIGITS = '0123456789ABCDEF'
22239
+ for (let i = 0; i < 256; i++) {
22240
+ BYTE_HEX[i] = '%' + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 0xF]
22241
+ }
22242
+ }
22243
+ function percentEncodeNonAscii (cp) {
22244
+ if (cp < 0x800) {
22245
+ return BYTE_HEX[0xC0 | (cp >> 6)] +
22246
+ BYTE_HEX[0x80 | (cp & 0x3F)]
22247
+ }
22248
+ if (cp < 0x10000) {
22249
+ return BYTE_HEX[0xE0 | (cp >> 12)] +
22250
+ BYTE_HEX[0x80 | ((cp >> 6) & 0x3F)] +
22251
+ BYTE_HEX[0x80 | (cp & 0x3F)]
22252
+ }
22253
+ return BYTE_HEX[0xF0 | (cp >> 18)] +
22254
+ BYTE_HEX[0x80 | ((cp >> 12) & 0x3F)] +
22255
+ BYTE_HEX[0x80 | ((cp >> 6) & 0x3F)] +
22256
+ BYTE_HEX[0x80 | (cp & 0x3F)]
22257
+ }
21933
22258
 
21934
22259
  /**
21935
22260
  * @param {Array<string>} input
@@ -21962,12 +22287,14 @@ function stringArrayToHexStripped (input) {
21962
22287
  return acc
21963
22288
  }
21964
22289
 
21965
- /**
21966
- * @typedef {Object} GetIPV6Result
21967
- * @property {boolean} error - Indicates if there was an error parsing the IPv6 address.
21968
- * @property {string} address - The parsed IPv6 address.
21969
- * @property {string} [zone] - The zone identifier, if present.
21970
- */
22290
+ /** @type {(value: string) => boolean} */
22291
+ const isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/)
22292
+
22293
+ /** @type {(value: string) => boolean} */
22294
+ const isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/)
22295
+
22296
+ /** @type {(value: string) => boolean} */
22297
+ const isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/)
21971
22298
 
21972
22299
  /**
21973
22300
  * @param {string} value
@@ -21976,88 +22303,104 @@ function stringArrayToHexStripped (input) {
21976
22303
  const nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u)
21977
22304
 
21978
22305
  /**
21979
- * @param {Array<string>} buffer
22306
+ * @param {string} zone
21980
22307
  * @returns {boolean}
21981
22308
  */
21982
- function consumeIsZone (buffer) {
21983
- buffer.length = 0
22309
+ function isZoneIdentifier (zone) {
22310
+ if (zone.length === 0) return false
22311
+
22312
+ for (let i = 0; i < zone.length; i++) {
22313
+ if (isZoneCharacter(zone[i])) continue
22314
+ if (zone[i] === '%' && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
22315
+ i += 2
22316
+ continue
22317
+ }
22318
+ return false
22319
+ }
22320
+
21984
22321
  return true
21985
22322
  }
21986
22323
 
21987
22324
  /**
21988
- * @param {Array<string>} buffer
21989
- * @param {Array<string>} address
21990
- * @param {GetIPV6Result} output
21991
- * @returns {boolean}
22325
+ * Compresses the longest run of zero hextets to "::" per RFC 5952. A run of a
22326
+ * single zero hextet is left uncompressed. On ties the leftmost run wins.
22327
+ *
22328
+ * @param {string[]} hextets
22329
+ * @returns {string}
21992
22330
  */
21993
- function consumeHextets (buffer, address, output) {
21994
- if (buffer.length) {
21995
- const hex = stringArrayToHexStripped(buffer)
21996
- if (hex !== '') {
21997
- address.push(hex)
22331
+ function compressIPv6ZeroRun (hextets) {
22332
+ let bestStart = -1
22333
+ let bestLength = 0
22334
+ let runStart = -1
22335
+ let runLength = 0
22336
+ for (let i = 0; i < hextets.length; i++) {
22337
+ if (hextets[i] === '0') {
22338
+ if (runStart === -1) runStart = i
22339
+ runLength++
22340
+ if (runLength > bestLength) {
22341
+ bestLength = runLength
22342
+ bestStart = runStart
22343
+ }
21998
22344
  } else {
21999
- output.error = true
22000
- return false
22345
+ runStart = -1
22346
+ runLength = 0
22001
22347
  }
22002
- buffer.length = 0
22003
22348
  }
22004
- return true
22349
+
22350
+ if (bestLength < 2) return hextets.join(':')
22351
+
22352
+ const head = hextets.slice(0, bestStart).join(':')
22353
+ const tail = hextets.slice(bestStart + bestLength).join(':')
22354
+ return head + '::' + tail
22005
22355
  }
22006
22356
 
22007
22357
  /**
22358
+ * Validates an IPv6 address against the alternatives in RFC 3986 section
22359
+ * 3.2.2 and returns the same address with leading hextet zeroes removed.
22360
+ * An embedded IPv4 address counts as two hextets and is only valid at the end.
22361
+ *
22008
22362
  * @param {string} input
22009
- * @returns {GetIPV6Result}
22363
+ * @returns {string|undefined}
22010
22364
  */
22011
- function getIPV6 (input) {
22012
- let tokenCount = 0
22013
- const output = { error: false, address: '', zone: '' }
22014
- /** @type {Array<string>} */
22015
- const address = []
22016
- /** @type {Array<string>} */
22017
- const buffer = []
22018
- let endipv6Encountered = false
22019
- let endIpv6 = false
22365
+ function normalizeIPv6Address (input) {
22366
+ const compression = input.indexOf('::')
22367
+ if (compression !== -1 && input.indexOf('::', compression + 1) !== -1) return undefined
22020
22368
 
22021
- let consume = consumeHextets
22369
+ const left = compression === -1 ? input.split(':') : input.slice(0, compression).split(':')
22370
+ const right = compression === -1 ? [] : input.slice(compression + 2).split(':')
22371
+ if (compression !== -1) {
22372
+ if (left.length === 1 && left[0] === '') left.length = 0
22373
+ if (right.length === 1 && right[0] === '') right.length = 0
22374
+ }
22022
22375
 
22023
- for (let i = 0; i < input.length; i++) {
22024
- const cursor = input[i]
22025
- if (cursor === '[' || cursor === ']') { continue }
22026
- if (cursor === ':') {
22027
- if (endipv6Encountered === true) {
22028
- endIpv6 = true
22029
- }
22030
- if (!consume(buffer, address, output)) { break }
22031
- if (++tokenCount > 7) {
22032
- // not valid
22033
- output.error = true
22034
- break
22035
- }
22036
- if (i > 0 && input[i - 1] === ':') {
22037
- endipv6Encountered = true
22038
- }
22039
- address.push(':')
22040
- continue
22041
- } else if (cursor === '%') {
22042
- if (!consume(buffer, address, output)) { break }
22043
- // switch to zone detection
22044
- consume = consumeIsZone
22045
- } else {
22046
- buffer.push(cursor)
22376
+ const parts = left.concat(right)
22377
+ let hextetCount = 0
22378
+ for (let i = 0; i < parts.length; i++) {
22379
+ const part = parts[i]
22380
+ if (part === '') return undefined
22381
+
22382
+ if (part.indexOf('.') !== -1) {
22383
+ if (i !== parts.length - 1 || (compression !== -1 && right.length === 0) || !isIPv4(part)) return undefined
22384
+ hextetCount += 2
22047
22385
  continue
22048
22386
  }
22387
+
22388
+ if (!isHextet(part)) return undefined
22389
+ parts[i] = parseInt(part, 16).toString(16)
22390
+ hextetCount++
22049
22391
  }
22050
- if (buffer.length) {
22051
- if (consume === consumeIsZone) {
22052
- output.zone = buffer.join('')
22053
- } else if (endIpv6) {
22054
- address.push(buffer.join(''))
22055
- } else {
22056
- address.push(stringArrayToHexStripped(buffer))
22057
- }
22392
+
22393
+ if (compression === -1) {
22394
+ if (hextetCount !== 8) return undefined
22395
+ return compressIPv6ZeroRun(parts)
22058
22396
  }
22059
- output.address = address.join('')
22060
- return output
22397
+ if (hextetCount >= 8) return undefined
22398
+
22399
+ // expand "::" then re-compress the longest run for a canonical result
22400
+ const expanded = parts.slice(0, left.length)
22401
+ for (let i = hextetCount; i < 8; i++) expanded.push('0')
22402
+ for (let i = left.length; i < parts.length; i++) expanded.push(parts[i])
22403
+ return compressIPv6ZeroRun(expanded)
22061
22404
  }
22062
22405
 
22063
22406
  /**
@@ -22065,26 +22408,49 @@ function getIPV6 (input) {
22065
22408
  * @property {string} host - The normalized host.
22066
22409
  * @property {string} [escapedHost] - The escaped host.
22067
22410
  * @property {boolean} isIPV6 - Indicates if the host is an IPv6 address.
22411
+ * @property {boolean} [isIPVFuture] - Indicates if the host is an IPvFuture literal.
22412
+ * @property {boolean} [error] - Indicates if a bracketed IP literal is malformed.
22068
22413
  */
22069
22414
 
22070
22415
  /**
22416
+ * Validates and normalizes a bracketed IP literal. Raw zone separators remain
22417
+ * accepted for backwards compatibility, while encoded separators and zone
22418
+ * contents follow RFC 6874.
22419
+ *
22071
22420
  * @param {string} host
22072
22421
  * @returns {NormalizeIPv6Result}
22073
22422
  */
22074
22423
  function normalizeIPv6 (host) {
22075
- if (findToken(host, ':') < 2) { return { host, isIPV6: false } }
22076
- const ipv6 = getIPV6(host)
22424
+ const bracketed = host[0] === '[' && host[host.length - 1] === ']'
22425
+ const hasBracket = host[0] === '[' || host[host.length - 1] === ']'
22426
+ if (hasBracket && !bracketed) return { host, isIPV6: false, error: true }
22077
22427
 
22078
- if (!ipv6.error) {
22079
- let newHost = ipv6.address
22080
- let escapedHost = ipv6.address
22081
- if (ipv6.zone) {
22082
- newHost += '%' + ipv6.zone
22083
- escapedHost += '%25' + ipv6.zone
22084
- }
22085
- return { host: newHost, isIPV6: true, escapedHost }
22086
- } else {
22087
- return { host, isIPV6: false }
22428
+ let input = bracketed ? host.slice(1, -1) : host
22429
+ if (bracketed && isIPvFuture(input)) {
22430
+ input = input.toLowerCase()
22431
+ return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true }
22432
+ }
22433
+
22434
+ if (findToken(input, ':') < 2) {
22435
+ return { host, isIPV6: false, error: bracketed }
22436
+ }
22437
+
22438
+ let zoneIdentifier = ''
22439
+ const zoneSeparator = input.indexOf('%')
22440
+ if (zoneSeparator !== -1) {
22441
+ const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === '%25' ? 3 : 1
22442
+ zoneIdentifier = input.slice(zoneSeparator + separatorLength)
22443
+ if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true }
22444
+ input = input.slice(0, zoneSeparator)
22445
+ }
22446
+
22447
+ const address = normalizeIPv6Address(input)
22448
+ if (address === undefined) return { host, isIPV6: false, error: true }
22449
+
22450
+ return {
22451
+ host: address + (zoneIdentifier ? '%' + zoneIdentifier : ''),
22452
+ escapedHost: address + (zoneIdentifier ? '%25' + zoneIdentifier : ''),
22453
+ isIPV6: true
22088
22454
  }
22089
22455
  }
22090
22456
 
@@ -22188,6 +22554,57 @@ function removeDotSegments (path) {
22188
22554
  return output.join('')
22189
22555
  }
22190
22556
 
22557
+ /**
22558
+ * Removes dot segments from the path of a relative reference (a path that does
22559
+ * not start with "/") without changing what it resolves to against any base.
22560
+ * Unlike `removeDotSegments`, leading ".." segments that cannot be collapsed
22561
+ * are kept, the result never becomes root-relative, and a result that would be
22562
+ * empty or start with an empty segment is prefixed with "." (an empty path
22563
+ * means "same document" and a leading "//" would introduce an authority).
22564
+ *
22565
+ * @param {string} path
22566
+ * @returns {string}
22567
+ */
22568
+ function removeDotSegmentsRelative (path) {
22569
+ if (path === '' || path[0] === '/') {
22570
+ return removeDotSegments(path)
22571
+ }
22572
+
22573
+ const segments = path.split('/')
22574
+ const last = segments.length - 1
22575
+ /** @type {string[]} */
22576
+ const output = []
22577
+ let trailingDirectory = false
22578
+
22579
+ for (let i = 0; i <= last; i++) {
22580
+ const segment = segments[i]
22581
+ if (segment === '.' || segment === '..') {
22582
+ if (segment === '..') {
22583
+ if (output.length !== 0 && output[output.length - 1] !== '..') {
22584
+ output.pop()
22585
+ } else {
22586
+ output.push('..')
22587
+ }
22588
+ }
22589
+ trailingDirectory = i === last
22590
+ } else {
22591
+ output.push(segment)
22592
+ }
22593
+ }
22594
+
22595
+ if (trailingDirectory && output[output.length - 1] !== '..') {
22596
+ output.push('')
22597
+ }
22598
+ if (output.length === 0 || output[0] === '' || output[0].includes(':')) {
22599
+ // An empty path, a leading empty segment ("//"), or a first segment
22600
+ // containing ":" (which would be mistaken for a scheme, RFC 3986 section
22601
+ // 4.2) must stay behind a "." segment so the reference keeps its meaning.
22602
+ output.unshift('.')
22603
+ }
22604
+
22605
+ return output.join('/')
22606
+ }
22607
+
22191
22608
  /**
22192
22609
  * Re-escape RFC 3986 gen-delims that must not appear literally in the host.
22193
22610
  * After the URI regex parses, these characters cannot be literal in the host
@@ -22210,7 +22627,7 @@ function reescapeHostDelimiters (host, isIP) {
22210
22627
 
22211
22628
  /**
22212
22629
  * Normalizes percent escapes and optionally decodes only unreserved ASCII bytes.
22213
- * Reserved delimiters such as `%2F` and `%2E` stay escaped.
22630
+ * Reserved delimiters such as `%2F` stay escaped; `%2E` is unreserved.
22214
22631
  *
22215
22632
  * @param {string} input
22216
22633
  * @param {boolean} [decodeUnreserved=false]
@@ -22259,7 +22676,8 @@ function normalizePathEncoding (input) {
22259
22676
  let output = ''
22260
22677
 
22261
22678
  for (let i = 0; i < input.length; i++) {
22262
- if (input[i] === '%' && i + 2 < input.length) {
22679
+ const ch = input[i]
22680
+ if (ch === '%' && i + 2 < input.length) {
22263
22681
  const hex = input.slice(i + 1, i + 3)
22264
22682
  if (isHexPair(hex)) {
22265
22683
  const normalizedHex = hex.toUpperCase()
@@ -22276,10 +22694,225 @@ function normalizePathEncoding (input) {
22276
22694
  }
22277
22695
  }
22278
22696
 
22279
- if (isPathCharacter(input[i])) {
22280
- output += input[i]
22697
+ if (isPathCharacter(ch)) {
22698
+ output += ch
22699
+ } else {
22700
+ const code = input.charCodeAt(i)
22701
+ if (code < 0x80) {
22702
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code]
22703
+ } else if (code < 0xD800 || code > 0xDFFF) {
22704
+ output += percentEncodeNonAscii(code)
22705
+ } else if (code <= 0xDBFF && i + 1 < input.length) {
22706
+ const low = input.charCodeAt(i + 1)
22707
+ if (low >= 0xDC00 && low <= 0xDFFF) {
22708
+ output += percentEncodeNonAscii(0x10000 + ((code - 0xD800) << 10) + (low - 0xDC00))
22709
+ i++
22710
+ } else {
22711
+ output += percentEncodeNonAscii(0xFFFD)
22712
+ }
22713
+ } else {
22714
+ output += percentEncodeNonAscii(0xFFFD)
22715
+ }
22716
+ }
22717
+ }
22718
+
22719
+ return output
22720
+ }
22721
+
22722
+ /**
22723
+ * Serializes a path without rewriting reserved data. Raw RFC 3986 path
22724
+ * characters remain literal, valid escapes are preserved and uppercased, and
22725
+ * everything else is UTF-8 percent-encoded. In a path-noscheme, a colon in the
22726
+ * first segment must be escaped so the result cannot be parsed as a scheme.
22727
+ *
22728
+ * @param {string} input
22729
+ * @param {boolean} [pathNoScheme=false]
22730
+ * @returns {string}
22731
+ */
22732
+ function serializePathEncoding (input, pathNoScheme = false) {
22733
+ let output = ''
22734
+ let firstSegment = pathNoScheme && input[0] !== '/'
22735
+
22736
+ for (let i = 0; i < input.length; i++) {
22737
+ const ch = input[i]
22738
+ if (ch === '%' && i + 2 < input.length) {
22739
+ const hex = input.slice(i + 1, i + 3)
22740
+ if (isHexPair(hex)) {
22741
+ output += '%' + hex.toUpperCase()
22742
+ i += 2
22743
+ continue
22744
+ }
22745
+ }
22746
+
22747
+ if (ch === '/') {
22748
+ firstSegment = false
22749
+ }
22750
+
22751
+ if (isPathCharacter(ch) && (ch !== ':' || !firstSegment)) {
22752
+ output += ch
22753
+ } else {
22754
+ const code = input.charCodeAt(i)
22755
+ if (code < 0x80) {
22756
+ output += BYTE_HEX[code]
22757
+ } else if (code < 0xD800 || code > 0xDFFF) {
22758
+ output += percentEncodeNonAscii(code)
22759
+ } else if (code <= 0xDBFF && i + 1 < input.length) {
22760
+ const low = input.charCodeAt(i + 1)
22761
+ if (low >= 0xDC00 && low <= 0xDFFF) {
22762
+ output += percentEncodeNonAscii(0x10000 + ((code - 0xD800) << 10) + (low - 0xDC00))
22763
+ i++
22764
+ } else {
22765
+ output += percentEncodeNonAscii(0xFFFD)
22766
+ }
22767
+ } else {
22768
+ output += percentEncodeNonAscii(0xFFFD)
22769
+ }
22770
+ }
22771
+ }
22772
+
22773
+ return output
22774
+ }
22775
+
22776
+ /**
22777
+ * Percent-encodes a URI component using its RFC 3986 literal character set.
22778
+ * Existing valid escapes are preserved and normalized to uppercase hex.
22779
+ *
22780
+ * @param {string} input
22781
+ * @param {(value: string) => boolean} isAllowed
22782
+ * @returns {string}
22783
+ */
22784
+ function encodeComponent (input, isAllowed) {
22785
+ let output = ''
22786
+
22787
+ for (let i = 0; i < input.length; i++) {
22788
+ const ch = input[i]
22789
+ if (ch === '%' && i + 2 < input.length) {
22790
+ const hex = input.slice(i + 1, i + 3)
22791
+ if (isHexPair(hex)) {
22792
+ output += '%' + hex.toUpperCase()
22793
+ i += 2
22794
+ continue
22795
+ }
22796
+ }
22797
+
22798
+ if (isAllowed(ch)) {
22799
+ output += ch
22800
+ } else {
22801
+ const code = input.charCodeAt(i)
22802
+ if (code < 0x80) {
22803
+ output += BYTE_HEX[code]
22804
+ } else if (code < 0xD800 || code > 0xDFFF) {
22805
+ output += percentEncodeNonAscii(code)
22806
+ } else if (code <= 0xDBFF && i + 1 < input.length) {
22807
+ const low = input.charCodeAt(i + 1)
22808
+ if (low >= 0xDC00 && low <= 0xDFFF) {
22809
+ output += percentEncodeNonAscii(0x10000 + ((code - 0xD800) << 10) + (low - 0xDC00))
22810
+ i++
22811
+ } else {
22812
+ output += percentEncodeNonAscii(0xFFFD)
22813
+ }
22814
+ } else {
22815
+ output += percentEncodeNonAscii(0xFFFD)
22816
+ }
22817
+ }
22818
+ }
22819
+
22820
+ return output
22821
+ }
22822
+
22823
+ /**
22824
+ * Encodes userinfo while preserving its RFC 3986 §3.2.1 literal characters.
22825
+ * In particular, authority delimiters such as `@`, `/`, `?`, and `#` are data.
22826
+ *
22827
+ * @param {string} input
22828
+ * @returns {string}
22829
+ */
22830
+ function encodeUserinfo (input) {
22831
+ return encodeComponent(input, isUserinfoCharacter)
22832
+ }
22833
+
22834
+ /**
22835
+ * Encodes query data using the RFC 3986 §3.4 grammar. A literal `#` must be
22836
+ * escaped because it would otherwise begin the fragment component.
22837
+ *
22838
+ * @param {string} input
22839
+ * @returns {string}
22840
+ */
22841
+ function encodeQuery (input) {
22842
+ return encodeComponent(input, isQueryFragmentCharacter)
22843
+ }
22844
+
22845
+ /**
22846
+ * Encodes fragment data using the RFC 3986 §3.5 grammar.
22847
+ *
22848
+ * @param {string} input
22849
+ * @returns {string}
22850
+ */
22851
+ function encodeFragment (input) {
22852
+ return encodeComponent(input, isQueryFragmentCharacter)
22853
+ }
22854
+
22855
+ function isEscapeSafe (cp) {
22856
+ return (
22857
+ (cp >= 0x30 && cp <= 0x39) ||
22858
+ (cp >= 0x41 && cp <= 0x5A) ||
22859
+ (cp >= 0x61 && cp <= 0x7A) ||
22860
+ cp === 0x2A || cp === 0x2B || cp === 0x2D || cp === 0x2E ||
22861
+ cp === 0x2F || cp === 0x40 || cp === 0x5F
22862
+ )
22863
+ }
22864
+
22865
+ /**
22866
+ * Normalizes the percent-encoding of a query or fragment component.
22867
+ *
22868
+ * Like `normalizePathEncoding`, but uses the query/fragment character set
22869
+ * (which additionally allows `?`) and decodes `.` since it has no dot-segment
22870
+ * meaning outside of a path.
22871
+ *
22872
+ * @param {string} input
22873
+ * @returns {string}
22874
+ */
22875
+ function normalizeQueryFragmentEncoding (input) {
22876
+ let output = ''
22877
+
22878
+ for (let i = 0; i < input.length; i++) {
22879
+ const ch = input[i]
22880
+ if (ch === '%' && i + 2 < input.length) {
22881
+ const hex = input.slice(i + 1, i + 3)
22882
+ if (isHexPair(hex)) {
22883
+ const normalizedHex = hex.toUpperCase()
22884
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16))
22885
+
22886
+ if (isUnreserved(decoded)) {
22887
+ output += decoded
22888
+ } else {
22889
+ output += '%' + normalizedHex
22890
+ }
22891
+
22892
+ i += 2
22893
+ continue
22894
+ }
22895
+ }
22896
+
22897
+ if (isQueryFragmentCharacter(ch)) {
22898
+ output += ch
22281
22899
  } else {
22282
- output += escape(input[i])
22900
+ const code = input.charCodeAt(i)
22901
+ if (code < 0x80) {
22902
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code]
22903
+ } else if (code < 0xD800 || code > 0xDFFF) {
22904
+ output += percentEncodeNonAscii(code)
22905
+ } else if (code <= 0xDBFF && i + 1 < input.length) {
22906
+ const low = input.charCodeAt(i + 1)
22907
+ if (low >= 0xDC00 && low <= 0xDFFF) {
22908
+ output += percentEncodeNonAscii(0x10000 + ((code - 0xD800) << 10) + (low - 0xDC00))
22909
+ i++
22910
+ } else {
22911
+ output += percentEncodeNonAscii(0xFFFD)
22912
+ }
22913
+ } else {
22914
+ output += percentEncodeNonAscii(0xFFFD)
22915
+ }
22283
22916
  }
22284
22917
  }
22285
22918
 
@@ -22319,15 +22952,21 @@ function recomposeAuthority (component) {
22319
22952
  const uriTokens = []
22320
22953
 
22321
22954
  if (component.userinfo !== undefined) {
22322
- uriTokens.push(component.userinfo)
22955
+ uriTokens.push(encodeUserinfo(component.userinfo))
22323
22956
  uriTokens.push('@')
22324
22957
  }
22325
22958
 
22326
22959
  if (component.host !== undefined) {
22327
- let host = unescape(component.host)
22960
+ let host = component.host
22328
22961
  if (!isIPv4(host)) {
22329
- const ipV6res = normalizeIPv6(host)
22330
- if (ipV6res.isIPV6 === true) {
22962
+ let ipV6res = normalizeIPv6(host)
22963
+ if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
22964
+ // Decode only unreserved bytes, once. In particular, keep %25 encoded
22965
+ // so it cannot introduce a second escape during recomposition.
22966
+ host = normalizePercentEncoding(host, true)
22967
+ ipV6res = normalizeIPv6(host)
22968
+ }
22969
+ if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
22331
22970
  host = `[${ipV6res.escapedHost}]`
22332
22971
  } else {
22333
22972
  host = reescapeHostDelimiters(host, false)
@@ -22337,8 +22976,12 @@ function recomposeAuthority (component) {
22337
22976
  }
22338
22977
 
22339
22978
  if (typeof component.port === 'number' || typeof component.port === 'string') {
22979
+ const port = String(component.port)
22980
+ if (!isPort(port)) {
22981
+ throw new TypeError('URI port is malformed.')
22982
+ }
22340
22983
  uriTokens.push(':')
22341
- uriTokens.push(String(component.port))
22984
+ uriTokens.push(port)
22342
22985
  }
22343
22986
 
22344
22987
  return uriTokens.length ? uriTokens.join('') : undefined
@@ -22350,8 +22993,14 @@ module.exports = {
22350
22993
  reescapeHostDelimiters,
22351
22994
  normalizePercentEncoding,
22352
22995
  normalizePathEncoding,
22996
+ serializePathEncoding,
22997
+ normalizeQueryFragmentEncoding,
22998
+ encodeUserinfo,
22999
+ encodeQuery,
23000
+ encodeFragment,
22353
23001
  escapePreservingEscapes,
22354
23002
  removeDotSegments,
23003
+ removeDotSegmentsRelative,
22355
23004
  isIPv4,
22356
23005
  isUUID,
22357
23006
  normalizeIPv6,
@@ -202250,6 +202899,18 @@ __webpack_require__.r(__webpack_exports__);
202250
202899
 
202251
202900
  const DEFAULT_CHUNK_SIZE = 64 * 1024;
202252
202901
 
202902
+ const DEFAULT_REQUEST_OPTIONS = {
202903
+ cache: 'default',
202904
+ redirect: 'follow',
202905
+ referrer: 'about:client',
202906
+ referrerPolicy: '',
202907
+ mode: 'cors',
202908
+ integrity: '',
202909
+ keepalive: false,
202910
+ priority: 'auto',
202911
+ window: null,
202912
+ };
202913
+
202253
202914
  const { isFunction } = _utils_js__WEBPACK_IMPORTED_MODULE_1__["default"];
202254
202915
 
202255
202916
  /**
@@ -202300,9 +202961,7 @@ const maybeWithAuthCredentials = (url) => {
202300
202961
 
202301
202962
  const factory = (env) => {
202302
202963
  const globalObject =
202303
- _utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].global !== undefined && _utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].global !== null
202304
- ? _utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].global
202305
- : globalThis;
202964
+ _utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].global !== undefined && _utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].global !== null ? _utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].global : globalThis;
202306
202965
  const { ReadableStream, TextEncoder } = globalObject;
202307
202966
 
202308
202967
  env = _utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].merge.call(
@@ -202441,6 +203100,7 @@ const factory = (env) => {
202441
203100
  fetchOptions,
202442
203101
  maxContentLength,
202443
203102
  maxBodyLength,
203103
+ maxRedirects,
202444
203104
  } = (0,_helpers_resolveConfig_js__WEBPACK_IMPORTED_MODULE_7__["default"])(config);
202445
203105
 
202446
203106
  const hasMaxContentLength = _utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].isNumber(maxContentLength) && maxContentLength > -1;
@@ -202491,7 +203151,7 @@ const factory = (env) => {
202491
203151
  const password = _utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].getSafeProp(configAuth, 'password') || '';
202492
203152
  auth = {
202493
203153
  username,
202494
- password
203154
+ password,
202495
203155
  };
202496
203156
  }
202497
203157
 
@@ -202503,7 +203163,7 @@ const factory = (env) => {
202503
203163
  const urlPassword = decodeURIComponentSafe(parsedURL.password);
202504
203164
  auth = {
202505
203165
  username: urlUsername,
202506
- password: urlPassword
203166
+ password: urlPassword,
202507
203167
  };
202508
203168
  }
202509
203169
 
@@ -202577,7 +203237,9 @@ const factory = (env) => {
202577
203237
  (onUploadProgress || mustEnforceStreamBody)
202578
203238
  ) {
202579
203239
  requestContentLength =
202580
- requestContentLength == null ? await resolveBodyLength(headers, data) : requestContentLength;
203240
+ requestContentLength == null
203241
+ ? await resolveBodyLength(headers, data)
203242
+ : requestContentLength;
202581
203243
 
202582
203244
  // A declared length of 0 is only trusted to skip the wrap when we are
202583
203245
  // not enforcing a stream limit (which must not rely on that header).
@@ -202590,7 +203252,10 @@ const factory = (env) => {
202590
203252
 
202591
203253
  let contentTypeHeader;
202592
203254
 
202593
- if (_utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
203255
+ if (
203256
+ _utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].isFormData(data) &&
203257
+ (contentTypeHeader = _request.headers.get('content-type'))
203258
+ ) {
202594
203259
  headers.setContentType(contentTypeHeader);
202595
203260
  }
202596
203261
 
@@ -202653,20 +203318,57 @@ const factory = (env) => {
202653
203318
  // Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
202654
203319
  headers.set('User-Agent', 'axios/' + _env_data_js__WEBPACK_IMPORTED_MODULE_10__.VERSION, false);
202655
203320
 
202656
- const resolvedOptions = {
202657
- ...fetchOptions,
203321
+ const safeFetchOptions =
203322
+ fetchOptions == null ? fetchOptions : Object.assign(Object.create(null), fetchOptions);
203323
+
203324
+ if (safeFetchOptions) {
203325
+ // These options are owned by Axios and are already reflected in the
203326
+ // resolved Request passed to fetch.
203327
+ delete safeFetchOptions.body;
203328
+ delete safeFetchOptions.headers;
203329
+ delete safeFetchOptions.method;
203330
+ delete safeFetchOptions.signal;
203331
+ delete safeFetchOptions.duplex;
203332
+ delete safeFetchOptions.credentials;
203333
+ }
203334
+
203335
+ const resolvedOptions = Object.assign(Object.create(null), safeFetchOptions, {
202658
203336
  signal: composedSignal,
202659
203337
  method: method.toUpperCase(),
202660
203338
  headers: (0,_helpers_sanitizeHeaderValue_js__WEBPACK_IMPORTED_MODULE_11__.toByteStringHeaderObject)(headers.normalize()),
202661
203339
  body: data,
202662
203340
  duplex: 'half',
202663
203341
  credentials: isCredentialsSupported ? withCredentials : undefined,
202664
- };
203342
+ });
203343
+
203344
+ if (isRequestSupported) {
203345
+ _utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].forEach(DEFAULT_REQUEST_OPTIONS, (value, key) => {
203346
+ if (resolvedOptions[key] === undefined) {
203347
+ resolvedOptions[key] = value;
203348
+ }
203349
+ });
203350
+
203351
+ if (resolvedOptions.signal === undefined) {
203352
+ resolvedOptions.signal = null;
203353
+ }
203354
+
203355
+ if (resolvedOptions.body === undefined) {
203356
+ resolvedOptions.body = null;
203357
+ }
203358
+ }
203359
+
203360
+ if (maxRedirects === 0) {
203361
+ resolvedOptions.redirect = 'manual';
203362
+
203363
+ if (safeFetchOptions) {
203364
+ safeFetchOptions.redirect = 'manual';
203365
+ }
203366
+ }
202665
203367
 
202666
203368
  request = isRequestSupported && new Request(url, resolvedOptions);
202667
203369
 
202668
203370
  let response = await (isRequestSupported
202669
- ? _fetch(request, fetchOptions)
203371
+ ? _fetch(request, safeFetchOptions)
202670
203372
  : _fetch(url, resolvedOptions));
202671
203373
 
202672
203374
  const responseHeaders = _core_AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_5__["default"].from(response.headers);
@@ -202893,12 +203595,14 @@ __webpack_require__.r(__webpack_exports__);
202893
203595
  /* harmony import */ var _defaults_transitional_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(69006);
202894
203596
  /* harmony import */ var _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(19011);
202895
203597
  /* harmony import */ var _cancel_CanceledError_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(95273);
202896
- /* harmony import */ var _helpers_parseProtocol_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(43406);
202897
- /* harmony import */ var _platform_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(79455);
202898
- /* harmony import */ var _core_AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(76487);
202899
- /* harmony import */ var _helpers_progressEventReducer_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(79194);
202900
- /* harmony import */ var _helpers_resolveConfig_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(28451);
202901
- /* harmony import */ var _helpers_sanitizeHeaderValue_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(51306);
203598
+ /* harmony import */ var _helpers_normalizeURLForProtocolCheck_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(53744);
203599
+ /* harmony import */ var _helpers_parseProtocol_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(43406);
203600
+ /* harmony import */ var _platform_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(79455);
203601
+ /* harmony import */ var _core_AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(76487);
203602
+ /* harmony import */ var _helpers_progressEventReducer_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(79194);
203603
+ /* harmony import */ var _helpers_resolveConfig_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(28451);
203604
+ /* harmony import */ var _helpers_sanitizeHeaderValue_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(51306);
203605
+
202902
203606
 
202903
203607
 
202904
203608
 
@@ -202916,13 +203620,13 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
202916
203620
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (isXHRAdapterSupported &&
202917
203621
  function (config) {
202918
203622
  return new Promise(function dispatchXhrRequest(resolve, reject) {
202919
- const _config = (0,_helpers_resolveConfig_js__WEBPACK_IMPORTED_MODULE_9__["default"])(config);
203623
+ const _config = (0,_helpers_resolveConfig_js__WEBPACK_IMPORTED_MODULE_10__["default"])(config);
202920
203624
  let requestData = _config.data;
202921
- const requestHeaders = _core_AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_7__["default"].from(_config.headers).normalize();
203625
+ const requestHeaders = _core_AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_8__["default"].from(_config.headers).normalize();
202922
203626
  let { responseType, onUploadProgress, onDownloadProgress } = _config;
202923
203627
  let onCanceled;
202924
203628
  let uploadThrottled, downloadThrottled;
202925
- let flushUpload, flushDownload;
203629
+ let flushUpload, flushDownload, flushDownloadWithEvent;
202926
203630
 
202927
203631
  function done() {
202928
203632
  flushUpload && flushUpload(); // flush events
@@ -202940,12 +203644,57 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
202940
203644
  // Set the request timeout in MS
202941
203645
  request.timeout = _config.timeout;
202942
203646
 
202943
- function onloadend() {
203647
+ function onloadend(event) {
202944
203648
  if (!request) {
202945
203649
  return;
202946
203650
  }
203651
+
203652
+ // Status 0 means no response was received, which onerror and onabort normally
203653
+ // reject before this runs. Firefox 152 fires only readystatechange and loadend for
203654
+ // navigation-canceled requests (https://bugzilla.mozilla.org/show_bug.cgi?id=1505389),
203655
+ // leaving settle() to resolve them as an empty success. ECONNABORTED is the error
203656
+ // onabort raised on Firefox 151. Reads over file:, which some environments report as
203657
+ // status 0 on success, are excluded by the request URL's scheme after browser-style
203658
+ // preprocessing, by the page origin's scheme for relative URLs (which inherit it), or
203659
+ // by responseURL where implemented.
203660
+ if (
203661
+ request.status === 0 &&
203662
+ ((0,_helpers_parseProtocol_js__WEBPACK_IMPORTED_MODULE_6__["default"])((0,_helpers_normalizeURLForProtocolCheck_js__WEBPACK_IMPORTED_MODULE_5__["default"])(_config.url)) ||
203663
+ (0,_helpers_parseProtocol_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_platform_index_js__WEBPACK_IMPORTED_MODULE_7__["default"].origin)) !== 'file' &&
203664
+ !(request.responseURL && request.responseURL.startsWith('file:'))
203665
+ ) {
203666
+ reject(new _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_3__["default"]('Request aborted', _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_3__["default"].ECONNABORTED, config, request));
203667
+ done();
203668
+
203669
+ // Clean up request
203670
+ request = null;
203671
+ return;
203672
+ }
203673
+
203674
+ // When loadend is still dispatching, flushing with it gives progress
203675
+ // listeners a final delivery whose event has a live target. The legacy
203676
+ // ready-state fallback has no event, so replay its pending progress.
203677
+ // A throwing listener must not block settlement; rethrow asynchronously,
203678
+ // matching how listener errors surface on the throttle timer path.
203679
+ try {
203680
+ if (event) {
203681
+ flushDownloadWithEvent && flushDownloadWithEvent(event);
203682
+ } else {
203683
+ flushDownload && flushDownload();
203684
+ }
203685
+ } catch (err) {
203686
+ setTimeout(() => {
203687
+ throw err;
203688
+ });
203689
+ }
203690
+
203691
+ // A final progress callback can cancel the request synchronously.
203692
+ if (!request) {
203693
+ return;
203694
+ }
203695
+
202947
203696
  // Prepare the response
202948
- const responseHeaders = _core_AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_7__["default"].from(
203697
+ const responseHeaders = _core_AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_8__["default"].from(
202949
203698
  'getAllResponseHeaders' in request && request.getAllResponseHeaders()
202950
203699
  );
202951
203700
  const responseData =
@@ -203058,7 +203807,7 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
203058
203807
 
203059
203808
  // Add headers to the request
203060
203809
  if ('setRequestHeader' in request) {
203061
- _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].forEach((0,_helpers_sanitizeHeaderValue_js__WEBPACK_IMPORTED_MODULE_10__.toByteStringHeaderObject)(requestHeaders), function setRequestHeader(val, key) {
203810
+ _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].forEach((0,_helpers_sanitizeHeaderValue_js__WEBPACK_IMPORTED_MODULE_11__.toByteStringHeaderObject)(requestHeaders), function setRequestHeader(val, key) {
203062
203811
  request.setRequestHeader(key, val);
203063
203812
  });
203064
203813
  }
@@ -203075,13 +203824,16 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
203075
203824
 
203076
203825
  // Handle progress if needed
203077
203826
  if (onDownloadProgress) {
203078
- [downloadThrottled, flushDownload] = (0,_helpers_progressEventReducer_js__WEBPACK_IMPORTED_MODULE_8__.progressEventReducer)(onDownloadProgress, true);
203827
+ [downloadThrottled, flushDownload, flushDownloadWithEvent] = (0,_helpers_progressEventReducer_js__WEBPACK_IMPORTED_MODULE_9__.progressEventReducer)(
203828
+ onDownloadProgress,
203829
+ true
203830
+ );
203079
203831
  request.addEventListener('progress', downloadThrottled);
203080
203832
  }
203081
203833
 
203082
203834
  // Not all browsers support upload events
203083
203835
  if (onUploadProgress && request.upload) {
203084
- [uploadThrottled, flushUpload] = (0,_helpers_progressEventReducer_js__WEBPACK_IMPORTED_MODULE_8__.progressEventReducer)(onUploadProgress);
203836
+ [uploadThrottled, flushUpload] = (0,_helpers_progressEventReducer_js__WEBPACK_IMPORTED_MODULE_9__.progressEventReducer)(onUploadProgress);
203085
203837
 
203086
203838
  request.upload.addEventListener('progress', uploadThrottled);
203087
203839
 
@@ -203109,9 +203861,9 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
203109
203861
  }
203110
203862
  }
203111
203863
 
203112
- const protocol = (0,_helpers_parseProtocol_js__WEBPACK_IMPORTED_MODULE_5__["default"])(_config.url);
203864
+ const protocol = (0,_helpers_parseProtocol_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_config.url);
203113
203865
 
203114
- if (protocol && !_platform_index_js__WEBPACK_IMPORTED_MODULE_6__["default"].protocols.includes(protocol)) {
203866
+ if (protocol && !_platform_index_js__WEBPACK_IMPORTED_MODULE_7__["default"].protocols.includes(protocol)) {
203115
203867
  reject(
203116
203868
  new _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_3__["default"](
203117
203869
  'Unsupported protocol ' + protocol + ':',
@@ -203467,9 +204219,11 @@ __webpack_require__.r(__webpack_exports__);
203467
204219
  /* harmony import */ var _dispatchRequest_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(97844);
203468
204220
  /* harmony import */ var _mergeConfig_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(58757);
203469
204221
  /* harmony import */ var _buildFullPath_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(22921);
203470
- /* harmony import */ var _helpers_validator_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(62215);
203471
- /* harmony import */ var _AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(76487);
203472
- /* harmony import */ var _defaults_transitional_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(69006);
204222
+ /* harmony import */ var _methodList_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(8726);
204223
+ /* harmony import */ var _helpers_validator_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(62215);
204224
+ /* harmony import */ var _AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(76487);
204225
+ /* harmony import */ var _defaults_transitional_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(69006);
204226
+
203473
204227
 
203474
204228
 
203475
204229
 
@@ -203482,7 +204236,7 @@ __webpack_require__.r(__webpack_exports__);
203482
204236
 
203483
204237
 
203484
204238
 
203485
- const validators = _helpers_validator_js__WEBPACK_IMPORTED_MODULE_6__["default"].validators;
204239
+ const validators = _helpers_validator_js__WEBPACK_IMPORTED_MODULE_7__["default"].validators;
203486
204240
 
203487
204241
  /**
203488
204242
  * Create a new instance of Axios
@@ -203513,21 +204267,21 @@ class Axios {
203513
204267
  return await this._request(configOrUrl, config);
203514
204268
  } catch (err) {
203515
204269
  if (err instanceof Error) {
203516
- let dummy = {};
204270
+ try {
204271
+ let dummy = {};
203517
204272
 
203518
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
204273
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
203519
204274
 
203520
- // slice off the Error: ... line
203521
- const stack = (() => {
203522
- if (!dummy.stack) {
203523
- return '';
203524
- }
204275
+ const dummyStack = dummy.stack;
204276
+ let stack = '';
203525
204277
 
203526
- const firstNewlineIndex = dummy.stack.indexOf('\n');
204278
+ // slice off the Error: ... line
204279
+ if (typeof dummyStack === 'string') {
204280
+ const firstNewlineIndex = dummyStack.indexOf('\n');
204281
+
204282
+ stack = firstNewlineIndex === -1 ? '' : dummyStack.slice(firstNewlineIndex + 1);
204283
+ }
203527
204284
 
203528
- return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
203529
- })();
203530
- try {
203531
204285
  if (!err.stack) {
203532
204286
  err.stack = stack;
203533
204287
  // match without the 2 top stack lines
@@ -203543,7 +204297,7 @@ class Axios {
203543
204297
  }
203544
204298
  }
203545
204299
  } catch (e) {
203546
- // ignore the case where "stack" is an un-writable property
204300
+ // Ignore failures from custom stack hooks or un-writable stack properties.
203547
204301
  }
203548
204302
  }
203549
204303
 
@@ -203566,7 +204320,7 @@ class Axios {
203566
204320
  const { transitional, paramsSerializer, headers } = config;
203567
204321
 
203568
204322
  if (transitional !== undefined) {
203569
- _helpers_validator_js__WEBPACK_IMPORTED_MODULE_6__["default"].assertOptions(
204323
+ _helpers_validator_js__WEBPACK_IMPORTED_MODULE_7__["default"].assertOptions(
203570
204324
  transitional,
203571
204325
  {
203572
204326
  silentJSONParsing: validators.transitional(validators.boolean),
@@ -203586,7 +204340,7 @@ class Axios {
203586
204340
  serialize: paramsSerializer,
203587
204341
  };
203588
204342
  } else {
203589
- _helpers_validator_js__WEBPACK_IMPORTED_MODULE_6__["default"].assertOptions(
204343
+ _helpers_validator_js__WEBPACK_IMPORTED_MODULE_7__["default"].assertOptions(
203590
204344
  paramsSerializer,
203591
204345
  {
203592
204346
  encode: validators.function,
@@ -203606,7 +204360,7 @@ class Axios {
203606
204360
  config.allowAbsoluteUrls = true;
203607
204361
  }
203608
204362
 
203609
- _helpers_validator_js__WEBPACK_IMPORTED_MODULE_6__["default"].assertOptions(
204363
+ _helpers_validator_js__WEBPACK_IMPORTED_MODULE_7__["default"].assertOptions(
203610
204364
  config,
203611
204365
  {
203612
204366
  baseUrl: validators.spelling('baseURL'),
@@ -203616,17 +204370,21 @@ class Axios {
203616
204370
  );
203617
204371
 
203618
204372
  // Set config.method
203619
- config.method = (config.method || this.defaults.method || 'get').toLowerCase();
204373
+ config.method = (
204374
+ _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].getSafeProp(config, 'method') ||
204375
+ _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].getSafeProp(this.defaults, 'method') ||
204376
+ 'get'
204377
+ ).toLowerCase();
203620
204378
 
203621
204379
  // Flatten headers
203622
204380
  let contextHeaders = headers && _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].merge(headers.common, headers[config.method]);
203623
204381
 
203624
204382
  headers &&
203625
- _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], (method) => {
204383
+ _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].forEach(_methodList_js__WEBPACK_IMPORTED_MODULE_6__["default"].concat('common'), (method) => {
203626
204384
  delete headers[method];
203627
204385
  });
203628
204386
 
203629
- config.headers = _AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_7__["default"].concat(contextHeaders, headers);
204387
+ config.headers = _AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_8__["default"].concat(contextHeaders, headers);
203630
204388
 
203631
204389
  // filter out skipped interceptors
203632
204390
  const requestInterceptorChain = [];
@@ -203638,7 +204396,7 @@ class Axios {
203638
204396
 
203639
204397
  synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
203640
204398
 
203641
- const transitional = config.transitional || _defaults_transitional_js__WEBPACK_IMPORTED_MODULE_8__["default"];
204399
+ const transitional = config.transitional || _defaults_transitional_js__WEBPACK_IMPORTED_MODULE_9__["default"];
203642
204400
  const legacyInterceptorReqResOrdering =
203643
204401
  transitional && transitional.legacyInterceptorReqResOrdering;
203644
204402
 
@@ -203681,17 +204439,35 @@ class Axios {
203681
204439
  const onFulfilled = requestInterceptorChain[i++];
203682
204440
  const onRejected = requestInterceptorChain[i++];
203683
204441
  try {
203684
- newConfig = onFulfilled(newConfig);
204442
+ newConfig = onFulfilled ? onFulfilled(newConfig) : newConfig;
203685
204443
  } catch (error) {
203686
- onRejected.call(this, error);
204444
+ if (!onRejected) {
204445
+ promise = Promise.reject(error);
204446
+ break;
204447
+ }
204448
+
204449
+ try {
204450
+ const rejectedResult = onRejected.call(this, error);
204451
+
204452
+ if (_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isThenable(rejectedResult)) {
204453
+ promise = Promise.resolve(rejectedResult).then(() =>
204454
+ _dispatchRequest_js__WEBPACK_IMPORTED_MODULE_3__["default"].call(this, newConfig)
204455
+ );
204456
+ }
204457
+ } catch (rejectedError) {
204458
+ promise = Promise.reject(rejectedError);
204459
+ }
204460
+
203687
204461
  break;
203688
204462
  }
203689
204463
  }
203690
204464
 
203691
- try {
203692
- promise = _dispatchRequest_js__WEBPACK_IMPORTED_MODULE_3__["default"].call(this, newConfig);
203693
- } catch (error) {
203694
- return Promise.reject(error);
204465
+ if (!promise) {
204466
+ try {
204467
+ promise = _dispatchRequest_js__WEBPACK_IMPORTED_MODULE_3__["default"].call(this, newConfig);
204468
+ } catch (error) {
204469
+ promise = Promise.reject(error);
204470
+ }
203695
204471
  }
203696
204472
 
203697
204473
  i = 0;
@@ -203842,9 +204618,40 @@ function redactConfig(config, redactKeys) {
203842
204618
  return visit(config);
203843
204619
  }
203844
204620
 
204621
+ function stringifySafely(value) {
204622
+ try {
204623
+ return String(value);
204624
+ } catch (err) {
204625
+ return '';
204626
+ }
204627
+ }
204628
+
204629
+ function aggregateErrorMessage(error) {
204630
+ const message = error.errors
204631
+ .map((entry) => {
204632
+ try {
204633
+ return entry && entry.message ? stringifySafely(entry.message) : stringifySafely(entry);
204634
+ } catch (err) {
204635
+ return '';
204636
+ }
204637
+ })
204638
+ .filter(Boolean)
204639
+ .join('; ');
204640
+
204641
+ return message || error.name || 'AggregateError';
204642
+ }
204643
+
203845
204644
  class AxiosError extends Error {
203846
204645
  static from(error, code, config, request, response, customProps) {
203847
- const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
204646
+ // `AggregateError` (thrown by Node on dual-stack/Happy-Eyeballs connection
204647
+ // failures) has an empty `message`; its detail lives in `errors[]`. Without
204648
+ // this, the wrapped error surfaces with a blank message (see #6721).
204649
+ let message = error.message;
204650
+ if (!message && _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isArray(error.errors) && error.errors.length) {
204651
+ message = aggregateErrorMessage(error);
204652
+ }
204653
+
204654
+ const axiosError = new AxiosError(message, code || error.code, config, request, response);
203848
204655
  // Match native `Error` `cause` semantics: non-enumerable. The wrapped
203849
204656
  // error often carries circular internals (sockets, requests, agents), so
203850
204657
  // an enumerable `cause` makes structured loggers (pino/winston) and any
@@ -203958,6 +204765,7 @@ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
203958
204765
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (AxiosError);
203959
204766
 
203960
204767
  /* harmony export */ __webpack_require__.d(__webpack_exports__, [
204768
+ /* harmony export */ "REDACTED", 0, /* binding */ REDACTED,
203961
204769
  /* harmony export */ "default", 0, /* export default binding */ __WEBPACK_DEFAULT_EXPORT__
203962
204770
  /* harmony export */ ]);
203963
204771
 
@@ -204004,6 +204812,124 @@ function parseTokens(str) {
204004
204812
  return tokens;
204005
204813
  }
204006
204814
 
204815
+ const parameterNameRE = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
204816
+
204817
+ function trimOWS(value) {
204818
+ let start = 0;
204819
+ let end = value.length;
204820
+
204821
+ while (start < end) {
204822
+ const code = value.charCodeAt(start);
204823
+
204824
+ if (code !== 0x09 && code !== 0x20) {
204825
+ break;
204826
+ }
204827
+
204828
+ start += 1;
204829
+ }
204830
+
204831
+ while (end > start) {
204832
+ const code = value.charCodeAt(end - 1);
204833
+
204834
+ if (code !== 0x09 && code !== 0x20) {
204835
+ break;
204836
+ }
204837
+
204838
+ end -= 1;
204839
+ }
204840
+
204841
+ return start === 0 && end === value.length ? value : value.slice(start, end);
204842
+ }
204843
+
204844
+ function decodeQuotedString(value) {
204845
+ const last = value.length - 1;
204846
+
204847
+ if (last < 1 || value.charCodeAt(0) !== 0x22 || value.charCodeAt(last) !== 0x22) {
204848
+ return value;
204849
+ }
204850
+
204851
+ let decoded = '';
204852
+
204853
+ for (let i = 1; i < last; i++) {
204854
+ const code = value.charCodeAt(i);
204855
+
204856
+ if (code === 0x22) {
204857
+ return value;
204858
+ }
204859
+
204860
+ if (code === 0x5c) {
204861
+ i += 1;
204862
+
204863
+ if (i >= last) {
204864
+ return value;
204865
+ }
204866
+ }
204867
+
204868
+ decoded += value[i];
204869
+ }
204870
+
204871
+ return decoded;
204872
+ }
204873
+
204874
+ function parseParameters(value) {
204875
+ const parameters = Object.create(null);
204876
+ const str = String(value);
204877
+ let start = 0;
204878
+ let quoted = false;
204879
+ let escaped = false;
204880
+
204881
+ function parseParameter(end) {
204882
+ const part = trimOWS(str.slice(start, end));
204883
+ const equals = part.indexOf('=');
204884
+
204885
+ if (equals < 1) {
204886
+ return;
204887
+ }
204888
+
204889
+ const name = trimOWS(part.slice(0, equals));
204890
+
204891
+ if (!parameterNameRE.test(name)) {
204892
+ return;
204893
+ }
204894
+
204895
+ const normalizedName = name.toLowerCase();
204896
+
204897
+ if (
204898
+ normalizedName === '__proto__' ||
204899
+ normalizedName === 'constructor' ||
204900
+ normalizedName === 'prototype'
204901
+ ) {
204902
+ return;
204903
+ }
204904
+
204905
+ const parameterValue = trimOWS(part.slice(equals + 1));
204906
+ parameters[normalizedName] = decodeQuotedString(parameterValue);
204907
+ }
204908
+
204909
+ for (let i = 0; i < str.length; i++) {
204910
+ const code = str.charCodeAt(i);
204911
+
204912
+ if (quoted) {
204913
+ if (escaped) {
204914
+ escaped = false;
204915
+ } else if (code === 0x5c) {
204916
+ escaped = true;
204917
+ } else if (code === 0x22) {
204918
+ quoted = false;
204919
+ }
204920
+ } else if (code === 0x22) {
204921
+ quoted = true;
204922
+ } else if (code === 0x2c || code === 0x3b) {
204923
+ parseParameter(i);
204924
+ start = i + 1;
204925
+ }
204926
+ }
204927
+
204928
+ parseParameter(str.length);
204929
+
204930
+ return parameters;
204931
+ }
204932
+
204007
204933
  const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
204008
204934
 
204009
204935
  function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
@@ -204255,7 +205181,8 @@ class AxiosHeaders {
204255
205181
  }
204256
205182
 
204257
205183
  getSetCookie() {
204258
- return this.get('set-cookie') || [];
205184
+ const value = this.get('set-cookie');
205185
+ return _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isArray(value) ? value : value == null || value === false ? [] : [value];
204259
205186
  }
204260
205187
 
204261
205188
  get [Symbol.toStringTag]() {
@@ -204266,6 +205193,10 @@ class AxiosHeaders {
204266
205193
  return thing instanceof this ? thing : new this(thing);
204267
205194
  }
204268
205195
 
205196
+ static parseParameters(value) {
205197
+ return parseParameters(value);
205198
+ }
205199
+
204269
205200
  static concat(first, ...targets) {
204270
205201
  const computed = new this(first);
204271
205202
 
@@ -204341,9 +205272,57 @@ __webpack_require__.r(__webpack_exports__);
204341
205272
 
204342
205273
 
204343
205274
 
205275
+ const $internals = Symbol('internals');
205276
+
205277
+ // `handlers` is public and may be replaced with a nullish value by user code;
205278
+ // `clear()` has always tolerated that. Treat it as an empty stack rather than
205279
+ // dereferencing it.
205280
+ function countHandlers(handlers) {
205281
+ return handlers ? handlers.length : 0;
205282
+ }
205283
+
205284
+ function trimHandlers(handlers) {
205285
+ if (!handlers) {
205286
+ return;
205287
+ }
205288
+
205289
+ while (handlers.length && handlers[handlers.length - 1] === null) {
205290
+ handlers.pop();
205291
+ }
205292
+ }
205293
+
205294
+ function syncHandlerEntries(manager, internals) {
205295
+ const handlers = manager.handlers;
205296
+ const length = countHandlers(handlers);
205297
+
205298
+ if (handlers !== internals.handlersRef) {
205299
+ internals.handlersRef = handlers;
205300
+ internals.handlerEntries.clear();
205301
+ } else if (length !== internals.handlersLength) {
205302
+ if (!length) {
205303
+ internals.handlerEntries.clear();
205304
+ } else {
205305
+ internals.handlerEntries.forEach(function removeStaleEntry(entry, id) {
205306
+ if (handlers[entry.index] !== entry.handler) {
205307
+ internals.handlerEntries.delete(id);
205308
+ }
205309
+ });
205310
+ }
205311
+ }
205312
+
205313
+ internals.handlersLength = length;
205314
+ }
205315
+
204344
205316
  class InterceptorManager {
204345
205317
  constructor() {
204346
205318
  this.handlers = [];
205319
+ this[$internals] = {
205320
+ handlersRef: this.handlers,
205321
+ handlersLength: this.handlers.length,
205322
+ handlerEntries: new Map(),
205323
+ iterationDepth: 0,
205324
+ nextId: 0,
205325
+ };
204347
205326
  }
204348
205327
 
204349
205328
  /**
@@ -204356,13 +205335,30 @@ class InterceptorManager {
204356
205335
  * @return {Number} An ID used to remove interceptor later
204357
205336
  */
204358
205337
  use(fulfilled, rejected, options) {
204359
- this.handlers.push({
205338
+ const handler = {
204360
205339
  fulfilled,
204361
205340
  rejected,
204362
205341
  synchronous: options ? options.synchronous : false,
204363
205342
  runWhen: options ? options.runWhen : null,
205343
+ };
205344
+ const internals = this[$internals];
205345
+
205346
+ if (this.handlers == null) {
205347
+ this.handlers = [];
205348
+ }
205349
+
205350
+ syncHandlerEntries(this, internals);
205351
+
205352
+ const id = internals.nextId++;
205353
+
205354
+ this.handlers.push(handler);
205355
+ internals.handlerEntries.set(id, {
205356
+ handler,
205357
+ index: this.handlers.length - 1,
204364
205358
  });
204365
- return this.handlers.length - 1;
205359
+ internals.handlersLength = this.handlers.length;
205360
+
205361
+ return id;
204366
205362
  }
204367
205363
 
204368
205364
  /**
@@ -204373,8 +205369,27 @@ class InterceptorManager {
204373
205369
  * @returns {void}
204374
205370
  */
204375
205371
  eject(id) {
204376
- if (this.handlers[id]) {
204377
- this.handlers[id] = null;
205372
+ const internals = this[$internals];
205373
+
205374
+ syncHandlerEntries(this, internals);
205375
+
205376
+ const entry = internals.handlerEntries.get(id);
205377
+
205378
+ if (entry) {
205379
+ internals.handlerEntries.delete(id);
205380
+
205381
+ // Ignore IDs invalidated by clear or direct replacement of handlers.
205382
+ if (this.handlers[entry.index] !== entry.handler) {
205383
+ return;
205384
+ }
205385
+
205386
+ this.handlers[entry.index] = null;
205387
+
205388
+ // Do not reuse an index while forEach is walking its length snapshot.
205389
+ if (!internals.iterationDepth) {
205390
+ trimHandlers(this.handlers);
205391
+ internals.handlersLength = this.handlers.length;
205392
+ }
204378
205393
  }
204379
205394
  }
204380
205395
 
@@ -204386,6 +205401,7 @@ class InterceptorManager {
204386
205401
  clear() {
204387
205402
  if (this.handlers) {
204388
205403
  this.handlers = [];
205404
+ syncHandlerEntries(this, this[$internals]);
204389
205405
  }
204390
205406
  }
204391
205407
 
@@ -204400,11 +205416,25 @@ class InterceptorManager {
204400
205416
  * @returns {void}
204401
205417
  */
204402
205418
  forEach(fn) {
204403
- _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].forEach(this.handlers, function forEachHandler(h) {
204404
- if (h !== null) {
204405
- fn(h);
205419
+ const internals = this[$internals];
205420
+
205421
+ syncHandlerEntries(this, internals);
205422
+
205423
+ internals.iterationDepth++;
205424
+
205425
+ try {
205426
+ _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].forEach(this.handlers, function forEachHandler(h) {
205427
+ if (h !== null) {
205428
+ fn(h);
205429
+ }
205430
+ });
205431
+ } finally {
205432
+ if (!--internals.iterationDepth) {
205433
+ syncHandlerEntries(this, internals);
205434
+ trimHandlers(this.handlers);
205435
+ internals.handlersLength = countHandlers(this.handlers);
204406
205436
  }
204407
- });
205437
+ }
204408
205438
  }
204409
205439
  }
204410
205440
 
@@ -204428,6 +205458,8 @@ __webpack_require__.r(__webpack_exports__);
204428
205458
  /* harmony import */ var _AxiosError_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(19011);
204429
205459
  /* harmony import */ var _helpers_isAbsoluteURL_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(75983);
204430
205460
  /* harmony import */ var _helpers_combineURLs_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(54042);
205461
+ /* harmony import */ var _helpers_normalizeURLForProtocolCheck_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(53744);
205462
+
204431
205463
 
204432
205464
 
204433
205465
 
@@ -204435,27 +205467,52 @@ __webpack_require__.r(__webpack_exports__);
204435
205467
 
204436
205468
 
204437
205469
  const malformedHttpProtocol = /^https?:(?!\/\/)/i;
204438
- const httpProtocolControlCharacters = /[\t\n\r]/g;
204439
205470
 
204440
- function stripLeadingC0ControlOrSpace(url) {
204441
- let i = 0;
204442
- while (i < url.length && url.charCodeAt(i) <= 0x20) {
204443
- i++;
205471
+ // Redact the parts of a URL that can carry secrets before it is embedded in an
205472
+ // error message. AxiosError.toJSON() serializes `message` verbatim and errors
205473
+ // are commonly logged, while the opt-in `config.redact` model only cleans
205474
+ // config keys — it cannot reach the message. Redact only the genuinely
205475
+ // sensitive substrings — userinfo (credentials), query parameter values and
205476
+ // fragment contents — with the same REDACTED marker the config redaction uses,
205477
+ // while keeping the scheme, host, path and parameter names so the offending
205478
+ // request stays accurately identifiable.
205479
+ function redactFragment(fragment) {
205480
+ if (!fragment) {
205481
+ return fragment;
204444
205482
  }
204445
- return url.slice(i);
205483
+
205484
+ return fragment.replace(/(^|&)([^=&]*=)?[^&]+/g, (match, separator, parameterName = '') => {
205485
+ return `${separator}${parameterName}${_AxiosError_js__WEBPACK_IMPORTED_MODULE_0__.REDACTED}`;
205486
+ });
204446
205487
  }
204447
205488
 
204448
- function normalizeURLForProtocolCheck(url) {
204449
- return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, '');
205489
+ function redactSensitiveURLParts(url) {
205490
+ const redactedURL = url.replace(/^(https?:\/{0,2})[^/?#]*@/i, `$1${_AxiosError_js__WEBPACK_IMPORTED_MODULE_0__.REDACTED}@`);
205491
+ const fragmentIndex = redactedURL.indexOf('#');
205492
+ const urlWithoutFragment =
205493
+ fragmentIndex === -1 ? redactedURL : redactedURL.slice(0, fragmentIndex);
205494
+ const redactedURLWithoutFragment = urlWithoutFragment.replace(
205495
+ /([?&][^=&#]*=)[^&#]*/g,
205496
+ `$1${_AxiosError_js__WEBPACK_IMPORTED_MODULE_0__.REDACTED}`
205497
+ );
205498
+
205499
+ if (fragmentIndex === -1) {
205500
+ return redactedURLWithoutFragment;
205501
+ }
205502
+
205503
+ return `${redactedURLWithoutFragment}#${redactFragment(redactedURL.slice(fragmentIndex + 1))}`;
204450
205504
  }
204451
205505
 
204452
205506
  function assertValidHttpProtocolURL(url, config) {
204453
- if (typeof url === 'string' && malformedHttpProtocol.test(normalizeURLForProtocolCheck(url))) {
204454
- throw new _AxiosError_js__WEBPACK_IMPORTED_MODULE_0__["default"](
204455
- 'Invalid URL: missing "//" after protocol',
204456
- _AxiosError_js__WEBPACK_IMPORTED_MODULE_0__["default"].ERR_INVALID_URL,
204457
- config
204458
- );
205507
+ if (typeof url === 'string') {
205508
+ const normalizedURL = (0,_helpers_normalizeURLForProtocolCheck_js__WEBPACK_IMPORTED_MODULE_3__["default"])(url);
205509
+ if (malformedHttpProtocol.test(normalizedURL)) {
205510
+ throw new _AxiosError_js__WEBPACK_IMPORTED_MODULE_0__["default"](
205511
+ `Invalid URL ${JSON.stringify(redactSensitiveURLParts(normalizedURL))}: missing "//" after protocol`,
205512
+ _AxiosError_js__WEBPACK_IMPORTED_MODULE_0__["default"].ERR_INVALID_URL,
205513
+ config
205514
+ );
205515
+ }
204459
205516
  }
204460
205517
  }
204461
205518
 
@@ -204496,6 +205553,8 @@ __webpack_require__.r(__webpack_exports__);
204496
205553
  /* harmony import */ var _cancel_CanceledError_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(95273);
204497
205554
  /* harmony import */ var _core_AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(76487);
204498
205555
  /* harmony import */ var _adapters_adapters_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(63002);
205556
+ /* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(68750);
205557
+
204499
205558
 
204500
205559
 
204501
205560
 
@@ -204529,10 +205588,15 @@ function throwIfCancellationRequested(config) {
204529
205588
  *
204530
205589
  * @returns {Promise} The Promise to be fulfilled
204531
205590
  */
204532
- function dispatchRequest(config) {
205591
+ function dispatchRequest(_config) {
205592
+ // Interceptors may replace the merged config with an ordinary object. Flatten
205593
+ // it at the dispatch boundary so shared prototype members cannot become
205594
+ // request behavior, while preserving intentional template/class members.
205595
+ const config = _utils_js__WEBPACK_IMPORTED_MODULE_6__["default"].toSafeFlatObject(_config);
205596
+
204533
205597
  throwIfCancellationRequested(config);
204534
205598
 
204535
- config.headers = _core_AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_4__["default"].from(config.headers);
205599
+ config.headers = _core_AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_4__["default"].from(_utils_js__WEBPACK_IMPORTED_MODULE_6__["default"].getSafeProp(config, 'headers'));
204536
205600
 
204537
205601
  // Transform request data
204538
205602
  config.data = _transformData_js__WEBPACK_IMPORTED_MODULE_0__["default"].call(config, config.transformRequest);
@@ -204606,6 +205670,17 @@ __webpack_require__.r(__webpack_exports__);
204606
205670
 
204607
205671
  const headersToObject = (thing) => (thing instanceof _AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_1__["default"] ? { ...thing } : thing);
204608
205672
 
205673
+ const ownEnumerableKeys = (thing) => {
205674
+ if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
205675
+ return Object.keys(thing).concat(
205676
+ Object.getOwnPropertySymbols(thing).filter(
205677
+ (symbol) => Object.getOwnPropertyDescriptor(thing, symbol).enumerable
205678
+ )
205679
+ );
205680
+ }
205681
+ return Object.keys(thing);
205682
+ };
205683
+
204609
205684
  /**
204610
205685
  * Config-specific merge-function which creates a new config-object
204611
205686
  * by merging two configuration objects together.
@@ -204671,7 +205746,9 @@ function mergeConfig(config1, config2) {
204671
205746
  }
204672
205747
 
204673
205748
  function getMergedTransitionalOption(prop) {
204674
- const transitional2 = _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].hasOwnProp(config2, 'transitional') ? config2.transitional : undefined;
205749
+ const transitional2 = _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].hasOwnProp(config2, 'transitional')
205750
+ ? config2.transitional
205751
+ : undefined;
204675
205752
 
204676
205753
  if (!_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isUndefined(transitional2)) {
204677
205754
  if (_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isPlainObject(transitional2)) {
@@ -204683,7 +205760,9 @@ function mergeConfig(config1, config2) {
204683
205760
  }
204684
205761
  }
204685
205762
 
204686
- const transitional1 = _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].hasOwnProp(config1, 'transitional') ? config1.transitional : undefined;
205763
+ const transitional1 = _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].hasOwnProp(config1, 'transitional')
205764
+ ? config1.transitional
205765
+ : undefined;
204687
205766
 
204688
205767
  if (_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isPlainObject(transitional1) && _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].hasOwnProp(transitional1, prop)) {
204689
205768
  return transitional1[prop];
@@ -204710,7 +205789,7 @@ function mergeConfig(config1, config2) {
204710
205789
  transformResponse: defaultToConfig2,
204711
205790
  paramsSerializer: defaultToConfig2,
204712
205791
  timeout: defaultToConfig2,
204713
- timeoutMessage: defaultToConfig2,
205792
+ timeoutErrorMessage: defaultToConfig2,
204714
205793
  withCredentials: defaultToConfig2,
204715
205794
  withXSRFToken: defaultToConfig2,
204716
205795
  adapter: defaultToConfig2,
@@ -204735,7 +205814,7 @@ function mergeConfig(config1, config2) {
204735
205814
  mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
204736
205815
  };
204737
205816
 
204738
- _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
205817
+ _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].forEach(ownEnumerableKeys({ ...config1, ...config2 }), function computeConfigValue(prop) {
204739
205818
  if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
204740
205819
  const merge = _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
204741
205820
  const a = _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].hasOwnProp(config1, prop) ? config1[prop] : undefined;
@@ -204760,6 +205839,75 @@ function mergeConfig(config1, config2) {
204760
205839
  }
204761
205840
 
204762
205841
 
205842
+ /***/ },
205843
+
205844
+ /***/ 8726
205845
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
205846
+
205847
+ "use strict";
205848
+ __webpack_require__.r(__webpack_exports__);
205849
+
205850
+
205851
+ const methodList = Object.freeze([
205852
+ 'get',
205853
+ 'delete',
205854
+ 'head',
205855
+ 'options',
205856
+ 'post',
205857
+ 'put',
205858
+ 'patch',
205859
+ 'purge',
205860
+ 'link',
205861
+ 'unlink',
205862
+ 'query',
205863
+ ]);
205864
+
205865
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (methodList);
205866
+
205867
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, [
205868
+ /* harmony export */ "default", 0, /* export default binding */ __WEBPACK_DEFAULT_EXPORT__
205869
+ /* harmony export */ ]);
205870
+
205871
+
205872
+ /***/ },
205873
+
205874
+ /***/ 371
205875
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
205876
+
205877
+ "use strict";
205878
+ __webpack_require__.r(__webpack_exports__);
205879
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
205880
+ /* harmony export */ "default": () => (/* binding */ setFormDataHeaders)
205881
+ /* harmony export */ });
205882
+
205883
+
205884
+ const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
205885
+
205886
+ /**
205887
+ * Apply the headers generated by a FormData implementation to the request headers,
205888
+ * honoring the `formDataHeaderPolicy` option: with 'content-only', copy only the
205889
+ * content-* headers; otherwise merge all of them.
205890
+ *
205891
+ * @param {AxiosHeaders} headers - the request headers to mutate
205892
+ * @param {Object | null | undefined} formHeaders - headers produced by the FormData implementation
205893
+ * @param {String} [policy] - the resolved `formDataHeaderPolicy` config value
205894
+ *
205895
+ * @returns {void}
205896
+ */
205897
+ function setFormDataHeaders(headers, formHeaders, policy) {
205898
+ if (policy !== 'content-only') {
205899
+ headers.set(formHeaders);
205900
+ return;
205901
+ }
205902
+
205903
+ Object.entries(formHeaders || {}).forEach(([key, val]) => {
205904
+ if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
205905
+ headers.set(key, val);
205906
+ }
205907
+ });
205908
+ }
205909
+
205910
+
204763
205911
  /***/ },
204764
205912
 
204765
205913
  /***/ 40788
@@ -204857,6 +206005,8 @@ __webpack_require__.r(__webpack_exports__);
204857
206005
  /* harmony import */ var _helpers_toURLEncodedForm_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(24699);
204858
206006
  /* harmony import */ var _platform_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(79455);
204859
206007
  /* harmony import */ var _helpers_formDataToJSON_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(66256);
206008
+ /* harmony import */ var _core_methodList_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(8726);
206009
+
204860
206010
 
204861
206011
 
204862
206012
 
@@ -205029,7 +206179,7 @@ const defaults = {
205029
206179
  },
205030
206180
  };
205031
206181
 
205032
- _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], (method) => {
206182
+ _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].forEach(_core_methodList_js__WEBPACK_IMPORTED_MODULE_7__["default"], (method) => {
205033
206183
  defaults.headers[method] = {};
205034
206184
  });
205035
206185
 
@@ -205070,7 +206220,7 @@ __webpack_require__.r(__webpack_exports__);
205070
206220
 
205071
206221
  "use strict";
205072
206222
  __webpack_require__.r(__webpack_exports__);
205073
- const VERSION = "1.18.1";
206223
+ const VERSION = "1.20.0";
205074
206224
  /* harmony export */ __webpack_require__.d(__webpack_exports__, [
205075
206225
  /* harmony export */ "VERSION", 0, /* binding */ VERSION
205076
206226
  /* harmony export */ ]);
@@ -205193,14 +206343,22 @@ const HttpStatusCode = {
205193
206343
  Gone: 410,
205194
206344
  LengthRequired: 411,
205195
206345
  PreconditionFailed: 412,
206346
+ /**
206347
+ * @deprecated Use `ContentTooLarge` instead.
206348
+ */
205196
206349
  PayloadTooLarge: 413,
206350
+ ContentTooLarge: 413,
205197
206351
  UriTooLong: 414,
205198
206352
  UnsupportedMediaType: 415,
205199
206353
  RangeNotSatisfiable: 416,
205200
206354
  ExpectationFailed: 417,
205201
206355
  ImATeapot: 418,
205202
206356
  MisdirectedRequest: 421,
206357
+ /**
206358
+ * @deprecated Use `UnprocessableContent` instead.
206359
+ */
205203
206360
  UnprocessableEntity: 422,
206361
+ UnprocessableContent: 422,
205204
206362
  Locked: 423,
205205
206363
  FailedDependency: 424,
205206
206364
  TooEarly: 425,
@@ -205220,6 +206378,7 @@ const HttpStatusCode = {
205220
206378
  LoopDetected: 508,
205221
206379
  NotExtended: 510,
205222
206380
  NetworkAuthenticationRequired: 511,
206381
+ WebServerReturnsAnUnknownError: 520,
205223
206382
  WebServerIsDown: 521,
205224
206383
  ConnectionTimedOut: 522,
205225
206384
  OriginIsUnreachable: 523,
@@ -205229,7 +206388,9 @@ const HttpStatusCode = {
205229
206388
  };
205230
206389
 
205231
206390
  Object.entries(HttpStatusCode).forEach(([key, value]) => {
205232
- HttpStatusCode[value] = key;
206391
+ if (HttpStatusCode[value] === undefined) {
206392
+ HttpStatusCode[value] = key;
206393
+ }
205233
206394
  });
205234
206395
 
205235
206396
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (HttpStatusCode);
@@ -205370,9 +206531,17 @@ __webpack_require__.r(__webpack_exports__);
205370
206531
  * @returns {string} The combined URL
205371
206532
  */
205372
206533
  function combineURLs(baseURL, relativeURL) {
205373
- return relativeURL
205374
- ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
205375
- : baseURL;
206534
+ if (!relativeURL) {
206535
+ return baseURL;
206536
+ }
206537
+
206538
+ let end = baseURL.length;
206539
+
206540
+ while (end > 0 && baseURL.charCodeAt(end - 1) === 47) {
206541
+ end--;
206542
+ }
206543
+
206544
+ return baseURL.slice(0, end) + '/' + relativeURL.replace(/^\/+/, '');
205376
206545
  }
205377
206546
 
205378
206547
 
@@ -205433,7 +206602,18 @@ const composeSignals = (signals, timeout) => {
205433
206602
  signals = null;
205434
206603
  };
205435
206604
 
205436
- signals.forEach((signal) => signal.addEventListener('abort', onabort, { once: true }));
206605
+ signals.forEach((signal) => {
206606
+ if (aborted) {
206607
+ return;
206608
+ }
206609
+
206610
+ if (signal.aborted) {
206611
+ onabort.call(signal);
206612
+ return;
206613
+ }
206614
+
206615
+ signal.addEventListener('abort', onabort, { once: true });
206616
+ });
205437
206617
 
205438
206618
  const { signal } = controller;
205439
206619
 
@@ -205536,16 +206716,15 @@ __webpack_require__.r(__webpack_exports__);
205536
206716
  "use strict";
205537
206717
  __webpack_require__.r(__webpack_exports__);
205538
206718
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
205539
- /* harmony export */ "default": () => (/* binding */ estimateDataURLDecodedBytes)
206719
+ /* harmony export */ "default": () => (/* binding */ estimateDataURLDecodedBytes),
206720
+ /* harmony export */ estimateDataURLBufferAllocation: () => (/* binding */ estimateDataURLBufferAllocation)
205540
206721
  /* harmony export */ });
205541
206722
  /**
205542
- * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
205543
- * - For base64: compute exact decoded size using length and padding;
205544
- * handle %XX at the character-count level (no string allocation).
205545
- * - For non-base64: compute the exact percent-decoded UTF-8 byte length.
205546
- *
205547
- * @param {string} url
205548
- * @returns {number}
206723
+ * Estimate data: URL byte lengths *without* allocating large buffers.
206724
+ * - Fetch percent-decodes a base64 body before decoding it.
206725
+ * - Node's Buffer.from(body, 'base64') sizes its backing allocation from the
206726
+ * raw body, including ignored characters and content after padding.
206727
+ * - Non-base64 data is percent-decoded and then encoded as UTF-8.
205549
206728
  */
205550
206729
  const isHexDigit = (charCode) =>
205551
206730
  (charCode >= 48 && charCode <= 57) ||
@@ -205555,64 +206734,101 @@ const isHexDigit = (charCode) =>
205555
206734
  const isPercentEncodedByte = (str, i, len) =>
205556
206735
  i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
205557
206736
 
205558
- function estimateDataURLDecodedBytes(url) {
205559
- if (!url || typeof url !== 'string') return 0;
205560
- if (!url.startsWith('data:')) return 0;
206737
+ const hexValue = (charCode) => (charCode <= 57 ? charCode - 48 : (charCode & 0xdf) - 55);
205561
206738
 
205562
- const comma = url.indexOf(',');
205563
- if (comma < 0) return 0;
206739
+ const isBase64Char = (charCode) =>
206740
+ (charCode >= 65 && charCode <= 90) || // A-Z
206741
+ (charCode >= 97 && charCode <= 122) || // a-z
206742
+ (charCode >= 48 && charCode <= 57) || // 0-9
206743
+ charCode === 43 || // +
206744
+ charCode === 47 || // /
206745
+ charCode === 45 || // - (base64url)
206746
+ charCode === 95; // _ (base64url)
205564
206747
 
205565
- const meta = url.slice(5, comma);
205566
- const body = url.slice(comma + 1);
205567
- const isBase64 = /;base64/i.test(meta);
206748
+ const isBase64Whitespace = (charCode) =>
206749
+ charCode === 9 || charCode === 10 || charCode === 12 || charCode === 13 || charCode === 32;
205568
206750
 
205569
- if (isBase64) {
205570
- let effectiveLen = body.length;
205571
- const len = body.length; // cache length
206751
+ const base64Bytes = (significant) => {
206752
+ const groups = Math.floor(significant / 4);
206753
+ const remainder = significant % 4;
206754
+ return groups * 3 + (remainder === 2 ? 1 : remainder === 3 ? 2 : 0);
206755
+ };
205572
206756
 
205573
- for (let i = 0; i < len; i++) {
205574
- if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
205575
- const a = body.charCodeAt(i + 1);
205576
- const b = body.charCodeAt(i + 2);
205577
- const isHex = isHexDigit(a) && isHexDigit(b);
206757
+ // Buffer.byteLength(body, 'base64') uses the raw string length as an allocation
206758
+ // upper bound even when Buffer.from later ignores characters or stops at '='.
206759
+ const estimateBase64BufferAllocation = (body) => {
206760
+ const len = body.length;
206761
+ let padding = 0;
205578
206762
 
205579
- if (isHex) {
205580
- effectiveLen -= 2;
205581
- i += 2;
205582
- }
205583
- }
206763
+ if (len > 0 && body.charCodeAt(len - 1) === 61 /* '=' */) {
206764
+ padding++;
206765
+
206766
+ if (len > 1 && body.charCodeAt(len - 2) === 61 /* '=' */) {
206767
+ padding++;
205584
206768
  }
206769
+ }
206770
+
206771
+ return Math.floor(((len - padding) * 3) / 4);
206772
+ };
205585
206773
 
205586
- let pad = 0;
205587
- let idx = len - 1;
206774
+ const estimatePercentDecodedBase64Bytes = (body) => {
206775
+ const len = body.length;
206776
+ let significant = 0;
206777
+ let padding = 0;
206778
+ let invalid = false;
205588
206779
 
205589
- const tailIsPct3D = (j) =>
205590
- j >= 2 &&
205591
- body.charCodeAt(j - 2) === 37 && // '%'
205592
- body.charCodeAt(j - 1) === 51 && // '3'
205593
- (body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd'
206780
+ for (let i = 0; i < len; i++) {
206781
+ let code = body.charCodeAt(i);
205594
206782
 
205595
- if (idx >= 0) {
205596
- if (body.charCodeAt(idx) === 61 /* '=' */) {
205597
- pad++;
205598
- idx--;
205599
- } else if (tailIsPct3D(idx)) {
205600
- pad++;
205601
- idx -= 3;
205602
- }
206783
+ if (code === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
206784
+ code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));
206785
+ i += 2;
205603
206786
  }
205604
206787
 
205605
- if (pad === 1 && idx >= 0) {
205606
- if (body.charCodeAt(idx) === 61 /* '=' */) {
205607
- pad++;
205608
- } else if (tailIsPct3D(idx)) {
205609
- pad++;
205610
- }
206788
+ if (isBase64Whitespace(code)) {
206789
+ continue;
206790
+ }
206791
+
206792
+ if (code === 61 /* '=' */) {
206793
+ padding++;
206794
+ continue;
206795
+ }
206796
+
206797
+ if (!isBase64Char(code) || padding > 0) {
206798
+ invalid = true;
206799
+ continue;
205611
206800
  }
205612
206801
 
205613
- const groups = Math.floor(effectiveLen / 4);
205614
- const bytes = groups * 3 - (pad || 0);
205615
- return bytes > 0 ? bytes : 0;
206802
+ significant++;
206803
+ }
206804
+
206805
+ // Fetch rejects malformed forgiving-base64 input. Returning the raw-size
206806
+ // allocation bound keeps that invalid input from becoming a pre-check bypass.
206807
+ if (
206808
+ invalid ||
206809
+ padding > 2 ||
206810
+ (padding > 0 && (significant + padding) % 4 !== 0) ||
206811
+ significant % 4 === 1
206812
+ ) {
206813
+ return estimateBase64BufferAllocation(body);
206814
+ }
206815
+
206816
+ return base64Bytes(significant);
206817
+ };
206818
+
206819
+ const estimateDataURLBytes = (url, estimateBase64) => {
206820
+ if (!url || typeof url !== 'string') return 0;
206821
+ if (!url.startsWith('data:')) return 0;
206822
+
206823
+ const comma = url.indexOf(',');
206824
+ if (comma < 0) return 0;
206825
+
206826
+ const meta = url.slice(5, comma);
206827
+ const body = url.slice(comma + 1);
206828
+ const isBase64 = /;base64/i.test(meta);
206829
+
206830
+ if (isBase64) {
206831
+ return estimateBase64(body);
205616
206832
  }
205617
206833
 
205618
206834
  // Compute UTF-8 byte length directly from UTF-16 code units without allocating
@@ -205642,6 +206858,32 @@ function estimateDataURLDecodedBytes(url) {
205642
206858
  }
205643
206859
  }
205644
206860
  return bytes;
206861
+ };
206862
+
206863
+ /**
206864
+ * Estimate the percent-decoded payload size used by Fetch data: URLs.
206865
+ *
206866
+ * @param {string} url
206867
+ * @returns {number}
206868
+ */
206869
+ function estimateDataURLDecodedBytes(url) {
206870
+ // Fetch removes URL fragments before processing a data: URL.
206871
+ const fragmentIndex = typeof url === 'string' ? url.indexOf('#') : -1;
206872
+
206873
+ return estimateDataURLBytes(
206874
+ fragmentIndex === -1 ? url : url.slice(0, fragmentIndex),
206875
+ estimatePercentDecodedBase64Bytes
206876
+ );
206877
+ }
206878
+
206879
+ /**
206880
+ * Estimate the Buffer backing allocation used by Node's raw base64 decoder.
206881
+ *
206882
+ * @param {string} url
206883
+ * @returns {number}
206884
+ */
206885
+ function estimateDataURLBufferAllocation(url) {
206886
+ return estimateDataURLBytes(url, estimateBase64BufferAllocation);
205645
206887
  }
205646
206888
 
205647
206889
 
@@ -205680,12 +206922,18 @@ function throwIfDepthExceeded(index) {
205680
206922
  * @returns An array of strings.
205681
206923
  */
205682
206924
  function parsePropPath(name) {
205683
- // foo[x][y][z]
205684
- // foo.x.y.z
205685
- // foo-x-y-z
205686
- // foo x y z
206925
+ // foo[x][y][z] -> ['foo', 'x', 'y', 'z']
206926
+ // foo.x.y.z -> ['foo', 'x', 'y', 'z']
206927
+ // A path is split on `.` and on `[...]` groups. A segment — whether written
206928
+ // in dot notation or captured inside brackets — may contain any character
206929
+ // except `.`, `[` and `]`, so a key like `user-name` or `user name` is kept
206930
+ // literal instead of being split (#5402). `.`, `[` and `]` keep their existing
206931
+ // meaning, e.g. `foo[bar.baz]` -> ['foo', 'bar', 'baz'] and `[]` is an array push.
206932
+ // Excluding `[` from the bracket group also makes the match fail fast at the
206933
+ // next `[`, so a malformed name cannot rescan to the end of the string from
206934
+ // every unmatched `[` — parsing stays linear in the length of the name.
205687
206935
  const path = [];
205688
- const pattern = /\w+|\[(\w*)]/g;
206936
+ const pattern = /[^.[\]]+|\[([^.[\]]*)]/g;
205689
206937
  let match;
205690
206938
 
205691
206939
  while ((match = pattern.exec(name)) !== null) {
@@ -205868,6 +207116,42 @@ __webpack_require__.r(__webpack_exports__);
205868
207116
  /* harmony export */ ]);
205869
207117
 
205870
207118
 
207119
+ /***/ },
207120
+
207121
+ /***/ 53744
207122
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
207123
+
207124
+ "use strict";
207125
+ __webpack_require__.r(__webpack_exports__);
207126
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
207127
+ /* harmony export */ "default": () => (/* binding */ normalizeURLForProtocolCheck)
207128
+ /* harmony export */ });
207129
+
207130
+
207131
+ const urlParserControlCharacters = /[\t\n\r]/g;
207132
+
207133
+ /**
207134
+ * Match WHATWG URL preprocessing before checking a URL's protocol.
207135
+ *
207136
+ * @param {string} url
207137
+ *
207138
+ * @returns {string}
207139
+ */
207140
+ function normalizeURLForProtocolCheck(url) {
207141
+ if (typeof url !== 'string') {
207142
+ return url;
207143
+ }
207144
+
207145
+ let start = 0;
207146
+
207147
+ while (start < url.length && url.charCodeAt(start) <= 0x20) {
207148
+ start++;
207149
+ }
207150
+
207151
+ return url.slice(start).replace(urlParserControlCharacters, '');
207152
+ }
207153
+
207154
+
205871
207155
  /***/ },
205872
207156
 
205873
207157
  /***/ 92008
@@ -205943,18 +207227,20 @@ const ignoreDuplicateOf = _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].toOb
205943
207227
  key = line.substring(0, i).trim().toLowerCase();
205944
207228
  val = line.substring(i + 1).trim();
205945
207229
 
205946
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
207230
+ const hasKey = _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].hasOwnProp(parsed, key);
207231
+
207232
+ if (!key || (hasKey && _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].hasOwnProp(ignoreDuplicateOf, key))) {
205947
207233
  return;
205948
207234
  }
205949
207235
 
205950
207236
  if (key === 'set-cookie') {
205951
- if (parsed[key]) {
207237
+ if (hasKey) {
205952
207238
  parsed[key].push(val);
205953
207239
  } else {
205954
207240
  parsed[key] = [val];
205955
207241
  }
205956
207242
  } else {
205957
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
207243
+ parsed[key] = hasKey ? parsed[key] + ', ' + val : val;
205958
207244
  }
205959
207245
  });
205960
207246
 
@@ -206003,12 +207289,12 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
206003
207289
  const _speedometer = (0,_speedometer_js__WEBPACK_IMPORTED_MODULE_0__["default"])(50, 250);
206004
207290
 
206005
207291
  return (0,_throttle_js__WEBPACK_IMPORTED_MODULE_1__["default"])((e) => {
206006
- if (!e || typeof e.loaded !== 'number') {
207292
+ if (!e || !_utils_js__WEBPACK_IMPORTED_MODULE_2__["default"].isNumber(e.loaded)) {
206007
207293
  return;
206008
207294
  }
206009
207295
  const rawLoaded = e.loaded;
206010
207296
  const total = e.lengthComputable ? e.total : undefined;
206011
- const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
207297
+ const loaded = Math.max(0, total != null ? Math.min(rawLoaded, total) : rawLoaded);
206012
207298
  const progressBytes = Math.max(0, loaded - bytesNotified);
206013
207299
  const rate = _speedometer(progressBytes);
206014
207300
 
@@ -206045,9 +207331,9 @@ const progressEventDecorator = (total, throttled) => {
206045
207331
  };
206046
207332
 
206047
207333
  const asyncDecorator =
206048
- (fn) =>
207334
+ (fn, scheduler = _utils_js__WEBPACK_IMPORTED_MODULE_2__["default"].asap) =>
206049
207335
  (...args) =>
206050
- _utils_js__WEBPACK_IMPORTED_MODULE_2__["default"].asap(() => fn(...args));
207336
+ scheduler(() => fn(...args));
206051
207337
 
206052
207338
  /* harmony export */ __webpack_require__.d(__webpack_exports__, [
206053
207339
  /* harmony export */ "asyncDecorator", 0, /* binding */ asyncDecorator,
@@ -206071,9 +207357,8 @@ __webpack_require__.r(__webpack_exports__);
206071
207357
  /* harmony import */ var _core_buildFullPath_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(22921);
206072
207358
  /* harmony import */ var _core_mergeConfig_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(58757);
206073
207359
  /* harmony import */ var _core_AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(76487);
206074
- /* harmony import */ var _buildURL_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(77760);
206075
-
206076
-
207360
+ /* harmony import */ var _core_setFormDataHeaders_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(371);
207361
+ /* harmony import */ var _buildURL_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(77760);
206077
207362
 
206078
207363
 
206079
207364
 
@@ -206082,20 +207367,8 @@ __webpack_require__.r(__webpack_exports__);
206082
207367
 
206083
207368
 
206084
207369
 
206085
- const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
206086
207370
 
206087
- function setFormDataHeaders(headers, formHeaders, policy) {
206088
- if (policy !== 'content-only') {
206089
- headers.set(formHeaders);
206090
- return;
206091
- }
206092
207371
 
206093
- Object.entries(formHeaders || {}).forEach(([key, val]) => {
206094
- if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
206095
- headers.set(key, val);
206096
- }
206097
- });
206098
- }
206099
207372
 
206100
207373
  /**
206101
207374
  * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
@@ -206129,7 +207402,7 @@ function resolveConfig(config) {
206129
207402
 
206130
207403
  newConfig.headers = headers = _core_AxiosHeaders_js__WEBPACK_IMPORTED_MODULE_7__["default"].from(headers);
206131
207404
 
206132
- newConfig.url = (0,_buildURL_js__WEBPACK_IMPORTED_MODULE_8__["default"])(
207405
+ newConfig.url = (0,_buildURL_js__WEBPACK_IMPORTED_MODULE_9__["default"])(
206133
207406
  (0,_core_buildFullPath_js__WEBPACK_IMPORTED_MODULE_5__["default"])(baseURL, url, allowAbsoluteUrls, newConfig),
206134
207407
  own('params'),
206135
207408
  own('paramsSerializer')
@@ -206151,15 +207424,17 @@ function resolveConfig(config) {
206151
207424
  }
206152
207425
 
206153
207426
  if (_utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].isFormData(data)) {
207427
+ const getHeaders = _utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].getSafeProp(data, 'getHeaders');
207428
+
206154
207429
  if (
206155
207430
  _platform_index_js__WEBPACK_IMPORTED_MODULE_0__["default"].hasStandardBrowserEnv ||
206156
207431
  _platform_index_js__WEBPACK_IMPORTED_MODULE_0__["default"].hasStandardBrowserWebWorkerEnv ||
206157
207432
  _utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].isReactNative(data)
206158
207433
  ) {
206159
207434
  headers.setContentType(undefined); // browser/web worker/RN handles it
206160
- } else if (_utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].isFunction(data.getHeaders)) {
207435
+ } else if (_utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].isFunction(getHeaders)) {
206161
207436
  // Node.js FormData (like form-data package)
206162
- setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
207437
+ (0,_core_setFormDataHeaders_js__WEBPACK_IMPORTED_MODULE_8__["default"])(headers, getHeaders.call(data), own('formDataHeaderPolicy'));
206163
207438
  }
206164
207439
  }
206165
207440
 
@@ -206394,7 +207669,7 @@ __webpack_require__.r(__webpack_exports__);
206394
207669
  * Throttle decorator
206395
207670
  * @param {Function} fn
206396
207671
  * @param {Number} freq
206397
- * @return {Function}
207672
+ * @return {Array<Function>}
206398
207673
  */
206399
207674
  function throttle(fn, freq) {
206400
207675
  let timestamp = 0;
@@ -206429,8 +207704,9 @@ function throttle(fn, freq) {
206429
207704
  };
206430
207705
 
206431
207706
  const flush = () => lastArgs && invoke(lastArgs);
207707
+ const flushWith = (...args) => invoke(args);
206432
207708
 
206433
- return [throttled, flush];
207709
+ return [throttled, flush, flushWith];
206434
207710
  }
206435
207711
 
206436
207712
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (throttle);
@@ -206457,6 +207733,7 @@ __webpack_require__.r(__webpack_exports__);
206457
207733
  // temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored
206458
207734
 
206459
207735
 
207736
+
206460
207737
  // Default nesting limit shared with the inverse transform (formDataToJSON) so
206461
207738
  // the FormData <-> JSON round-trip stays symmetric.
206462
207739
  const DEFAULT_FORM_DATA_MAX_DEPTH = 100;
@@ -206550,28 +207827,18 @@ function toFormData(obj, formData, options) {
206550
207827
  // eslint-disable-next-line no-param-reassign
206551
207828
  formData = formData || new (_platform_node_classes_FormData_js__WEBPACK_IMPORTED_MODULE_2__["default"] || FormData)();
206552
207829
 
206553
- // eslint-disable-next-line no-param-reassign
206554
- options = _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].toFlatObject(
206555
- options,
206556
- {
206557
- metaTokens: true,
206558
- dots: false,
206559
- indexes: false,
206560
- },
206561
- false,
206562
- function defined(option, source) {
206563
- // eslint-disable-next-line no-eq-null,eqeqeq
206564
- return !_utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isUndefined(source[option]);
206565
- }
206566
- );
207830
+ const option = (name, fallback) => {
207831
+ const value = _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].getSafeProp(options, name);
207832
+ return _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isUndefined(value) ? fallback : value;
207833
+ };
206567
207834
 
206568
- const metaTokens = options.metaTokens;
207835
+ const metaTokens = option('metaTokens', true);
206569
207836
  // eslint-disable-next-line no-use-before-define
206570
- const visitor = options.visitor || defaultVisitor;
206571
- const dots = options.dots;
206572
- const indexes = options.indexes;
206573
- const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
206574
- const maxDepth = options.maxDepth === undefined ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
207837
+ const visitor = option('visitor') || defaultVisitor;
207838
+ const dots = option('dots', false);
207839
+ const indexes = option('indexes', false);
207840
+ const _Blob = option('Blob') || (typeof Blob !== 'undefined' && Blob);
207841
+ const maxDepth = option('maxDepth', DEFAULT_FORM_DATA_MAX_DEPTH);
206575
207842
  const useBlob = _Blob && _utils_js__WEBPACK_IMPORTED_MODULE_0__["default"].isSpecCompliantForm(formData);
206576
207843
  const stack = [];
206577
207844
 
@@ -206598,10 +207865,13 @@ function toFormData(obj, formData, options) {
206598
207865
  if (useBlob && typeof _Blob === 'function') {
206599
207866
  return new _Blob([value]);
206600
207867
  }
206601
- if (typeof Buffer !== 'undefined') {
206602
- return Buffer.from(value);
207868
+ if (_platform_node_classes_FormData_js__WEBPACK_IMPORTED_MODULE_2__["default"] && _platform_node_classes_FormData_js__WEBPACK_IMPORTED_MODULE_2__["default"].isBufferAvailable()) {
207869
+ return _platform_node_classes_FormData_js__WEBPACK_IMPORTED_MODULE_2__["default"].from(value);
206603
207870
  }
206604
- throw new _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_1__["default"]('Blob is not supported. Use a Buffer instead.', _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_1__["default"].ERR_NOT_SUPPORT);
207871
+ throw new _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_1__["default"](
207872
+ 'Blob is not supported. Use a Buffer instead.',
207873
+ _core_AxiosError_js__WEBPACK_IMPORTED_MODULE_1__["default"].ERR_NOT_SUPPORT
207874
+ );
206605
207875
  }
206606
207876
 
206607
207877
  return value;
@@ -207196,12 +208466,65 @@ const hasOwnProperty = (
207196
208466
  hasOwnProperty.call(obj, prop)
207197
208467
  )(Object.prototype);
207198
208468
 
208469
+ const isUnsafeObjectKey = (prop) =>
208470
+ typeof prop === 'string' &&
208471
+ (prop === '__proto__' || prop === 'constructor' || prop === 'prototype');
208472
+
207199
208473
  /**
207200
- * Walk the prototype chain (excluding the shared Object.prototype) looking for
207201
- * an own `prop`. This distinguishes genuine own/inherited members — including
207202
- * class accessors and template prototypes — from members injected via
207203
- * Object.prototype pollution (e.g. `Object.prototype.username = '...'`), which
207204
- * live on Object.prototype itself and are therefore never matched.
208474
+ * Determine whether an inherited object must be treated as a shared-prototype
208475
+ * boundary. Cross-realm Object.prototype objects cannot be distinguished
208476
+ * reliably from application-created null-prototype objects because their
208477
+ * properties are mutable, so all inherited terminal prototypes are excluded
208478
+ * as a fail-closed boundary. A null-prototype source still keeps its own
208479
+ * properties, as produced by mergeConfig and other safe materialization paths.
208480
+ *
208481
+ * @param {*} obj The object to inspect
208482
+ * @param {*} prototype The object's prototype
208483
+ * @param {boolean} source Whether obj is the original traversal source
208484
+ *
208485
+ * @returns {boolean} True when obj is a safe prototype traversal boundary
208486
+ */
208487
+ const isPrototypeBoundary = (obj, prototype, source) =>
208488
+ obj === Object.prototype || (!source && prototype === null);
208489
+
208490
+ /**
208491
+ * Determine whether an object can retain its identity through code paths that
208492
+ * add, replace, and remove config properties without bypassing unsafe-key
208493
+ * filtering. Immutable objects, unsafe-key-bearing objects, and objects with
208494
+ * accessor or restricted data properties must be materialized instead.
208495
+ *
208496
+ * @param {*} obj The object to inspect
208497
+ *
208498
+ * @returns {boolean} True when every own property is safe and fully mutable
208499
+ */
208500
+ const isSafeAndFullyMutable = (obj) => {
208501
+ if (!Object.isExtensible(obj)) {
208502
+ return false;
208503
+ }
208504
+
208505
+ const props = Object.getOwnPropertyNames(obj);
208506
+
208507
+ if (Object.getOwnPropertySymbols) {
208508
+ props.push(...Object.getOwnPropertySymbols(obj));
208509
+ }
208510
+
208511
+ return props.every((prop) => {
208512
+ if (isUnsafeObjectKey(prop)) {
208513
+ return false;
208514
+ }
208515
+
208516
+ const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
208517
+
208518
+ return !!descriptor && descriptor.configurable && descriptor.writable === true;
208519
+ });
208520
+ };
208521
+
208522
+ /**
208523
+ * Walk the prototype chain (excluding the source realm's Object.prototype)
208524
+ * looking for an own `prop`. This distinguishes genuine own/inherited members
208525
+ * — including class accessors and template prototypes — from members injected
208526
+ * via Object.prototype pollution (e.g. `Object.prototype.username = '...'`),
208527
+ * which live on Object.prototype itself and are therefore never matched.
207205
208528
  *
207206
208529
  * @param {*} thing The value whose chain to inspect
207207
208530
  * @param {string|symbol} prop The property key to look for
@@ -207212,16 +208535,22 @@ const hasOwnInPrototypeChain = (thing, prop) => {
207212
208535
  let obj = thing;
207213
208536
  const seen = [];
207214
208537
 
207215
- while (obj != null && obj !== Object.prototype) {
208538
+ while (obj != null) {
207216
208539
  if (seen.indexOf(obj) !== -1) {
207217
208540
  return false;
207218
208541
  }
207219
208542
  seen.push(obj);
207220
208543
 
208544
+ const prototype = getPrototypeOf(obj);
208545
+
208546
+ if (isPrototypeBoundary(obj, prototype, obj === thing)) {
208547
+ return false;
208548
+ }
208549
+
207221
208550
  if (hasOwnProperty(obj, prop)) {
207222
208551
  return true;
207223
208552
  }
207224
- obj = getPrototypeOf(obj);
208553
+ obj = prototype;
207225
208554
  }
207226
208555
  return false;
207227
208556
  };
@@ -207240,6 +208569,69 @@ const hasOwnInPrototypeChain = (thing, prop) => {
207240
208569
  const getSafeProp = (obj, prop) =>
207241
208570
  obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : undefined;
207242
208571
 
208572
+ /**
208573
+ * Flatten an object and its application-defined prototype chain into a
208574
+ * null-prototype object. Members inherited only from the source realm's
208575
+ * Object.prototype are deliberately excluded, while class/template members
208576
+ * below that boundary are preserved.
208577
+ *
208578
+ * @param {*} thing The value to flatten
208579
+ *
208580
+ * @returns {*} A null-prototype copy, or the original value when it is already
208581
+ * structurally safe or is not an object
208582
+ */
208583
+ const toSafeFlatObject = (thing) => {
208584
+ if (thing == null || (typeof thing !== 'object' && typeof thing !== 'function')) {
208585
+ return thing;
208586
+ }
208587
+
208588
+ const sourcePrototype = getPrototypeOf(thing);
208589
+
208590
+ if (sourcePrototype === null && isSafeAndFullyMutable(thing)) {
208591
+ return thing;
208592
+ }
208593
+
208594
+ const result = Object.create(null);
208595
+ const merged = Object.create(null);
208596
+ const seen = [];
208597
+ let current = thing;
208598
+
208599
+ while (current != null) {
208600
+ if (seen.indexOf(current) !== -1) {
208601
+ break;
208602
+ }
208603
+
208604
+ seen.push(current);
208605
+
208606
+ const prototype = current === thing ? sourcePrototype : getPrototypeOf(current);
208607
+
208608
+ if (isPrototypeBoundary(current, prototype, current === thing)) {
208609
+ break;
208610
+ }
208611
+
208612
+ const props = Object.getOwnPropertyNames(current);
208613
+
208614
+ if (Object.getOwnPropertySymbols) {
208615
+ props.push(...Object.getOwnPropertySymbols(current));
208616
+ }
208617
+
208618
+ for (const prop of props) {
208619
+ if (isUnsafeObjectKey(prop)) {
208620
+ continue;
208621
+ }
208622
+
208623
+ if (!hasOwnProperty(merged, prop)) {
208624
+ result[prop] = thing[prop];
208625
+ merged[prop] = true;
208626
+ }
208627
+ }
208628
+
208629
+ current = prototype;
208630
+ }
208631
+
208632
+ return result;
208633
+ };
208634
+
207243
208635
  const kindOf = ((cache) => (thing) => {
207244
208636
  const str = toString.call(thing);
207245
208637
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
@@ -207371,12 +208763,10 @@ const isPlainObject = (val) => {
207371
208763
 
207372
208764
  const prototype = getPrototypeOf(val);
207373
208765
  return (
207374
- (prototype === null ||
207375
- prototype === Object.prototype ||
207376
- getPrototypeOf(prototype) === null) &&
207377
- // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
207378
- // Symbol.iterator as evidence the value is a tagged/iterable type rather
207379
- // than a plain object, while ignoring keys injected onto Object.prototype.
208766
+ (prototype === null || prototype === Object.prototype || getPrototypeOf(prototype) === null) &&
208767
+ // Treat safe own/inherited Symbol.toStringTag or Symbol.iterator members as
208768
+ // evidence the value is tagged/iterable, while ignoring members reachable
208769
+ // only through shared or terminal prototype boundaries.
207380
208770
  !hasOwnInPrototypeChain(val, toStringTag) &&
207381
208771
  !hasOwnInPrototypeChain(val, iterator)
207382
208772
  );
@@ -207463,6 +208853,7 @@ const isBlob = kindOfTest('Blob');
207463
208853
  * @returns {boolean} True if value is a FileList, otherwise false
207464
208854
  */
207465
208855
  const isFileList = kindOfTest('FileList');
208856
+ const isSet = kindOfTest('Set');
207466
208857
 
207467
208858
  /**
207468
208859
  * Determine if a value is a Stream
@@ -208028,12 +209419,23 @@ const toJSONObject = (obj) => {
208028
209419
  if (!('toJSON' in source)) {
208029
209420
  // add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
208030
209421
  visited.add(source);
208031
- const target = isArray(source) ? [] : {};
208032
209422
 
208033
- forEach(source, (value, key) => {
208034
- const reducedValue = visit(value);
208035
- !isUndefined(reducedValue) && (target[key] = reducedValue);
208036
- });
209423
+ let target;
209424
+
209425
+ if (isSet(source)) {
209426
+ target = [];
209427
+ for (const value of source) {
209428
+ const reducedValue = visit(value);
209429
+ !isUndefined(reducedValue) && target.push(reducedValue);
209430
+ }
209431
+ } else {
209432
+ target = isArray(source) ? [] : {};
209433
+
209434
+ forEach(source, (value, key) => {
209435
+ const reducedValue = visit(value);
209436
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
209437
+ });
209438
+ }
208037
209439
 
208038
209440
  visited.delete(source);
208039
209441
 
@@ -208178,6 +209580,7 @@ const isSafeIterable = (thing) =>
208178
209580
  hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
208179
209581
  hasOwnInPrototypeChain,
208180
209582
  getSafeProp,
209583
+ toSafeFlatObject,
208181
209584
  reduceDescriptors,
208182
209585
  freezeMethods,
208183
209586
  toObjectSet,