You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
951 lines
24 KiB
JavaScript
951 lines
24 KiB
JavaScript
"use strict";
|
|
(self["webpackChunk_JUPYTERLAB_CORE_OUTPUT"] = self["webpackChunk_JUPYTERLAB_CORE_OUTPUT"] || []).push([[5448],{
|
|
|
|
/***/ 66471:
|
|
/***/ ((module) => {
|
|
|
|
|
|
|
|
// do not edit .js files directly - edit src/index.jst
|
|
|
|
|
|
|
|
module.exports = function equal(a, b) {
|
|
if (a === b) return true;
|
|
|
|
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
|
if (a.constructor !== b.constructor) return false;
|
|
|
|
var length, i, keys;
|
|
if (Array.isArray(a)) {
|
|
length = a.length;
|
|
if (length != b.length) return false;
|
|
for (i = length; i-- !== 0;)
|
|
if (!equal(a[i], b[i])) return false;
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
|
|
keys = Object.keys(a);
|
|
length = keys.length;
|
|
if (length !== Object.keys(b).length) return false;
|
|
|
|
for (i = length; i-- !== 0;)
|
|
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
|
|
for (i = length; i-- !== 0;) {
|
|
var key = keys[i];
|
|
|
|
if (!equal(a[key], b[key])) return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
// true if both NaN, false otherwise
|
|
return a!==a && b!==b;
|
|
};
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 83745:
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
|
|
|
|
const { normalizeIPv6, normalizeIPv4, removeDotSegments, recomposeAuthority, normalizeComponentEncoding } = __webpack_require__(18607)
|
|
const SCHEMES = __webpack_require__(76042)
|
|
|
|
function normalize (uri, options) {
|
|
if (typeof uri === 'string') {
|
|
uri = serialize(parse(uri, options), options)
|
|
} else if (typeof uri === 'object') {
|
|
uri = parse(serialize(uri, options), options)
|
|
}
|
|
return uri
|
|
}
|
|
|
|
function resolve (baseURI, relativeURI, options) {
|
|
const schemelessOptions = Object.assign({ scheme: 'null' }, options)
|
|
const resolved = resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true)
|
|
return serialize(resolved, { ...schemelessOptions, skipEscape: true })
|
|
}
|
|
|
|
function resolveComponents (base, relative, options, skipNormalization) {
|
|
const target = {}
|
|
if (!skipNormalization) {
|
|
base = parse(serialize(base, options), options) // normalize base components
|
|
relative = parse(serialize(relative, options), options) // normalize relative components
|
|
}
|
|
options = options || {}
|
|
|
|
if (!options.tolerant && relative.scheme) {
|
|
target.scheme = relative.scheme
|
|
// target.authority = relative.authority;
|
|
target.userinfo = relative.userinfo
|
|
target.host = relative.host
|
|
target.port = relative.port
|
|
target.path = removeDotSegments(relative.path || '')
|
|
target.query = relative.query
|
|
} else {
|
|
if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
|
|
// target.authority = relative.authority;
|
|
target.userinfo = relative.userinfo
|
|
target.host = relative.host
|
|
target.port = relative.port
|
|
target.path = removeDotSegments(relative.path || '')
|
|
target.query = relative.query
|
|
} else {
|
|
if (!relative.path) {
|
|
target.path = base.path
|
|
if (relative.query !== undefined) {
|
|
target.query = relative.query
|
|
} else {
|
|
target.query = base.query
|
|
}
|
|
} else {
|
|
if (relative.path.charAt(0) === '/') {
|
|
target.path = removeDotSegments(relative.path)
|
|
} else {
|
|
if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
|
|
target.path = '/' + relative.path
|
|
} else if (!base.path) {
|
|
target.path = relative.path
|
|
} else {
|
|
target.path = base.path.slice(0, base.path.lastIndexOf('/') + 1) + relative.path
|
|
}
|
|
target.path = removeDotSegments(target.path)
|
|
}
|
|
target.query = relative.query
|
|
}
|
|
// target.authority = base.authority;
|
|
target.userinfo = base.userinfo
|
|
target.host = base.host
|
|
target.port = base.port
|
|
}
|
|
target.scheme = base.scheme
|
|
}
|
|
|
|
target.fragment = relative.fragment
|
|
|
|
return target
|
|
}
|
|
|
|
function equal (uriA, uriB, options) {
|
|
if (typeof uriA === 'string') {
|
|
uriA = unescape(uriA)
|
|
uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true })
|
|
} else if (typeof uriA === 'object') {
|
|
uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true })
|
|
}
|
|
|
|
if (typeof uriB === 'string') {
|
|
uriB = unescape(uriB)
|
|
uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true })
|
|
} else if (typeof uriB === 'object') {
|
|
uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true })
|
|
}
|
|
|
|
return uriA.toLowerCase() === uriB.toLowerCase()
|
|
}
|
|
|
|
function serialize (cmpts, opts) {
|
|
const components = {
|
|
host: cmpts.host,
|
|
scheme: cmpts.scheme,
|
|
userinfo: cmpts.userinfo,
|
|
port: cmpts.port,
|
|
path: cmpts.path,
|
|
query: cmpts.query,
|
|
nid: cmpts.nid,
|
|
nss: cmpts.nss,
|
|
uuid: cmpts.uuid,
|
|
fragment: cmpts.fragment,
|
|
reference: cmpts.reference,
|
|
resourceName: cmpts.resourceName,
|
|
secure: cmpts.secure,
|
|
error: ''
|
|
}
|
|
const options = Object.assign({}, opts)
|
|
const uriTokens = []
|
|
|
|
// find scheme handler
|
|
const schemeHandler = SCHEMES[(options.scheme || components.scheme || '').toLowerCase()]
|
|
|
|
// perform scheme specific serialization
|
|
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options)
|
|
|
|
if (components.path !== undefined) {
|
|
if (!options.skipEscape) {
|
|
components.path = escape(components.path)
|
|
|
|
if (components.scheme !== undefined) {
|
|
components.path = components.path.split('%3A').join(':')
|
|
}
|
|
} else {
|
|
components.path = unescape(components.path)
|
|
}
|
|
}
|
|
|
|
if (options.reference !== 'suffix' && components.scheme) {
|
|
uriTokens.push(components.scheme, ':')
|
|
}
|
|
|
|
const authority = recomposeAuthority(components)
|
|
if (authority !== undefined) {
|
|
if (options.reference !== 'suffix') {
|
|
uriTokens.push('//')
|
|
}
|
|
|
|
uriTokens.push(authority)
|
|
|
|
if (components.path && components.path.charAt(0) !== '/') {
|
|
uriTokens.push('/')
|
|
}
|
|
}
|
|
if (components.path !== undefined) {
|
|
let s = components.path
|
|
|
|
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
s = removeDotSegments(s)
|
|
}
|
|
|
|
if (authority === undefined) {
|
|
s = s.replace(/^\/\//u, '/%2F') // don't allow the path to start with "//"
|
|
}
|
|
|
|
uriTokens.push(s)
|
|
}
|
|
|
|
if (components.query !== undefined) {
|
|
uriTokens.push('?', components.query)
|
|
}
|
|
|
|
if (components.fragment !== undefined) {
|
|
uriTokens.push('#', components.fragment)
|
|
}
|
|
return uriTokens.join('')
|
|
}
|
|
|
|
const hexLookUp = Array.from({ length: 127 }, (_v, k) => /[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(k)))
|
|
|
|
function nonSimpleDomain (value) {
|
|
let code = 0
|
|
for (let i = 0, len = value.length; i < len; ++i) {
|
|
code = value.charCodeAt(i)
|
|
if (code > 126 || hexLookUp[code]) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u
|
|
|
|
function parse (uri, opts) {
|
|
const options = Object.assign({}, opts)
|
|
const parsed = {
|
|
scheme: undefined,
|
|
userinfo: undefined,
|
|
host: '',
|
|
port: undefined,
|
|
path: '',
|
|
query: undefined,
|
|
fragment: undefined
|
|
}
|
|
const gotEncoding = uri.indexOf('%') !== -1
|
|
let isIP = false
|
|
if (options.reference === 'suffix') uri = (options.scheme ? options.scheme + ':' : '') + '//' + uri
|
|
|
|
const matches = uri.match(URI_PARSE)
|
|
|
|
if (matches) {
|
|
// store each component
|
|
parsed.scheme = matches[1]
|
|
parsed.userinfo = matches[3]
|
|
parsed.host = matches[4]
|
|
parsed.port = parseInt(matches[5], 10)
|
|
parsed.path = matches[6] || ''
|
|
parsed.query = matches[7]
|
|
parsed.fragment = matches[8]
|
|
|
|
// fix port number
|
|
if (isNaN(parsed.port)) {
|
|
parsed.port = matches[5]
|
|
}
|
|
if (parsed.host) {
|
|
const ipv4result = normalizeIPv4(parsed.host)
|
|
if (ipv4result.isIPV4 === false) {
|
|
const ipv6result = normalizeIPv6(ipv4result.host)
|
|
parsed.host = ipv6result.host.toLowerCase()
|
|
isIP = ipv6result.isIPV6
|
|
} else {
|
|
parsed.host = ipv4result.host
|
|
isIP = true
|
|
}
|
|
}
|
|
if (parsed.scheme === undefined && parsed.userinfo === undefined && parsed.host === undefined && parsed.port === undefined && parsed.query === undefined && !parsed.path) {
|
|
parsed.reference = 'same-document'
|
|
} else if (parsed.scheme === undefined) {
|
|
parsed.reference = 'relative'
|
|
} else if (parsed.fragment === undefined) {
|
|
parsed.reference = 'absolute'
|
|
} else {
|
|
parsed.reference = 'uri'
|
|
}
|
|
|
|
// check for reference errors
|
|
if (options.reference && options.reference !== 'suffix' && options.reference !== parsed.reference) {
|
|
parsed.error = parsed.error || 'URI is not a ' + options.reference + ' reference.'
|
|
}
|
|
|
|
// find scheme handler
|
|
const schemeHandler = SCHEMES[(options.scheme || parsed.scheme || '').toLowerCase()]
|
|
|
|
// check if scheme can't handle IRIs
|
|
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
|
|
// if host component is a domain name
|
|
if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
// convert Unicode IDN -> ASCII IDN
|
|
try {
|
|
parsed.host = URL.domainToASCII(parsed.host.toLowerCase())
|
|
} catch (e) {
|
|
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e
|
|
}
|
|
}
|
|
// convert IRI -> URI
|
|
}
|
|
|
|
if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) {
|
|
if (gotEncoding && parsed.scheme !== undefined) {
|
|
parsed.scheme = unescape(parsed.scheme)
|
|
}
|
|
if (gotEncoding && parsed.host !== undefined) {
|
|
parsed.host = unescape(parsed.host)
|
|
}
|
|
if (parsed.path) {
|
|
parsed.path = escape(unescape(parsed.path))
|
|
}
|
|
if (parsed.fragment) {
|
|
parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment))
|
|
}
|
|
}
|
|
|
|
// perform scheme specific parsing
|
|
if (schemeHandler && schemeHandler.parse) {
|
|
schemeHandler.parse(parsed, options)
|
|
}
|
|
} else {
|
|
parsed.error = parsed.error || 'URI can not be parsed.'
|
|
}
|
|
return parsed
|
|
}
|
|
|
|
const fastUri = {
|
|
SCHEMES,
|
|
normalize,
|
|
resolve,
|
|
resolveComponents,
|
|
equal,
|
|
serialize,
|
|
parse
|
|
}
|
|
|
|
module.exports = fastUri
|
|
module.exports["default"] = fastUri
|
|
module.exports.fastUri = fastUri
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 76042:
|
|
/***/ ((module) => {
|
|
|
|
|
|
|
|
const UUID_REG = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu
|
|
const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu
|
|
|
|
function isSecure (wsComponents) {
|
|
return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === 'wss'
|
|
}
|
|
|
|
function httpParse (components) {
|
|
if (!components.host) {
|
|
components.error = components.error || 'HTTP URIs must have a host.'
|
|
}
|
|
|
|
return components
|
|
}
|
|
|
|
function httpSerialize (components) {
|
|
const secure = String(components.scheme).toLowerCase() === 'https'
|
|
|
|
// normalize the default port
|
|
if (components.port === (secure ? 443 : 80) || components.port === '') {
|
|
components.port = undefined
|
|
}
|
|
|
|
// normalize the empty path
|
|
if (!components.path) {
|
|
components.path = '/'
|
|
}
|
|
|
|
// NOTE: We do not parse query strings for HTTP URIs
|
|
// as WWW Form Url Encoded query strings are part of the HTML4+ spec,
|
|
// and not the HTTP spec.
|
|
|
|
return components
|
|
}
|
|
|
|
function wsParse (wsComponents) {
|
|
// indicate if the secure flag is set
|
|
wsComponents.secure = isSecure(wsComponents)
|
|
|
|
// construct resouce name
|
|
wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '')
|
|
wsComponents.path = undefined
|
|
wsComponents.query = undefined
|
|
|
|
return wsComponents
|
|
}
|
|
|
|
function wsSerialize (wsComponents) {
|
|
// normalize the default port
|
|
if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === '') {
|
|
wsComponents.port = undefined
|
|
}
|
|
|
|
// ensure scheme matches secure flag
|
|
if (typeof wsComponents.secure === 'boolean') {
|
|
wsComponents.scheme = (wsComponents.secure ? 'wss' : 'ws')
|
|
wsComponents.secure = undefined
|
|
}
|
|
|
|
// reconstruct path from resource name
|
|
if (wsComponents.resourceName) {
|
|
const [path, query] = wsComponents.resourceName.split('?')
|
|
wsComponents.path = (path && path !== '/' ? path : undefined)
|
|
wsComponents.query = query
|
|
wsComponents.resourceName = undefined
|
|
}
|
|
|
|
// forbid fragment component
|
|
wsComponents.fragment = undefined
|
|
|
|
return wsComponents
|
|
}
|
|
|
|
function urnParse (urnComponents, options) {
|
|
if (!urnComponents.path) {
|
|
urnComponents.error = 'URN can not be parsed'
|
|
return urnComponents
|
|
}
|
|
const matches = urnComponents.path.match(URN_REG)
|
|
if (matches) {
|
|
const scheme = options.scheme || urnComponents.scheme || 'urn'
|
|
urnComponents.nid = matches[1].toLowerCase()
|
|
urnComponents.nss = matches[2]
|
|
const urnScheme = `${scheme}:${options.nid || urnComponents.nid}`
|
|
const schemeHandler = SCHEMES[urnScheme]
|
|
urnComponents.path = undefined
|
|
|
|
if (schemeHandler) {
|
|
urnComponents = schemeHandler.parse(urnComponents, options)
|
|
}
|
|
} else {
|
|
urnComponents.error = urnComponents.error || 'URN can not be parsed.'
|
|
}
|
|
|
|
return urnComponents
|
|
}
|
|
|
|
function urnSerialize (urnComponents, options) {
|
|
const scheme = options.scheme || urnComponents.scheme || 'urn'
|
|
const nid = urnComponents.nid.toLowerCase()
|
|
const urnScheme = `${scheme}:${options.nid || nid}`
|
|
const schemeHandler = SCHEMES[urnScheme]
|
|
|
|
if (schemeHandler) {
|
|
urnComponents = schemeHandler.serialize(urnComponents, options)
|
|
}
|
|
|
|
const uriComponents = urnComponents
|
|
const nss = urnComponents.nss
|
|
uriComponents.path = `${nid || options.nid}:${nss}`
|
|
|
|
options.skipEscape = true
|
|
return uriComponents
|
|
}
|
|
|
|
function urnuuidParse (urnComponents, options) {
|
|
const uuidComponents = urnComponents
|
|
uuidComponents.uuid = uuidComponents.nss
|
|
uuidComponents.nss = undefined
|
|
|
|
if (!options.tolerant && (!uuidComponents.uuid || !UUID_REG.test(uuidComponents.uuid))) {
|
|
uuidComponents.error = uuidComponents.error || 'UUID is not valid.'
|
|
}
|
|
|
|
return uuidComponents
|
|
}
|
|
|
|
function urnuuidSerialize (uuidComponents) {
|
|
const urnComponents = uuidComponents
|
|
// normalize UUID
|
|
urnComponents.nss = (uuidComponents.uuid || '').toLowerCase()
|
|
return urnComponents
|
|
}
|
|
|
|
const http = {
|
|
scheme: 'http',
|
|
domainHost: true,
|
|
parse: httpParse,
|
|
serialize: httpSerialize
|
|
}
|
|
|
|
const https = {
|
|
scheme: 'https',
|
|
domainHost: http.domainHost,
|
|
parse: httpParse,
|
|
serialize: httpSerialize
|
|
}
|
|
|
|
const ws = {
|
|
scheme: 'ws',
|
|
domainHost: true,
|
|
parse: wsParse,
|
|
serialize: wsSerialize
|
|
}
|
|
|
|
const wss = {
|
|
scheme: 'wss',
|
|
domainHost: ws.domainHost,
|
|
parse: ws.parse,
|
|
serialize: ws.serialize
|
|
}
|
|
|
|
const urn = {
|
|
scheme: 'urn',
|
|
parse: urnParse,
|
|
serialize: urnSerialize,
|
|
skipNormalize: true
|
|
}
|
|
|
|
const urnuuid = {
|
|
scheme: 'urn:uuid',
|
|
parse: urnuuidParse,
|
|
serialize: urnuuidSerialize,
|
|
skipNormalize: true
|
|
}
|
|
|
|
const SCHEMES = {
|
|
http,
|
|
https,
|
|
ws,
|
|
wss,
|
|
urn,
|
|
'urn:uuid': urnuuid
|
|
}
|
|
|
|
module.exports = SCHEMES
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 63085:
|
|
/***/ ((module) => {
|
|
|
|
|
|
|
|
const HEX = {
|
|
0: 0,
|
|
1: 1,
|
|
2: 2,
|
|
3: 3,
|
|
4: 4,
|
|
5: 5,
|
|
6: 6,
|
|
7: 7,
|
|
8: 8,
|
|
9: 9,
|
|
a: 10,
|
|
A: 10,
|
|
b: 11,
|
|
B: 11,
|
|
c: 12,
|
|
C: 12,
|
|
d: 13,
|
|
D: 13,
|
|
e: 14,
|
|
E: 14,
|
|
f: 15,
|
|
F: 15
|
|
}
|
|
|
|
module.exports = {
|
|
HEX
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 18607:
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
|
|
|
|
|
|
const { HEX } = __webpack_require__(63085)
|
|
|
|
const IPV4_REG = /^(?:(?: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
|
|
|
|
function normalizeIPv4 (host) {
|
|
if (findToken(host, '.') < 3) { return { host, isIPV4: false } }
|
|
const matches = host.match(IPV4_REG) || []
|
|
const [address] = matches
|
|
if (address) {
|
|
return { host: stripLeadingZeros(address, '.'), isIPV4: true }
|
|
} else {
|
|
return { host, isIPV4: false }
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @param {string[]} input
|
|
* @param {boolean} [keepZero=false]
|
|
* @returns {string|undefined}
|
|
*/
|
|
function stringArrayToHexStripped (input, keepZero = false) {
|
|
let acc = ''
|
|
let strip = true
|
|
for (const c of input) {
|
|
if (HEX[c] === undefined) return undefined
|
|
if (c !== '0' && strip === true) strip = false
|
|
if (!strip) acc += c
|
|
}
|
|
if (keepZero && acc.length === 0) acc = '0'
|
|
return acc
|
|
}
|
|
|
|
function getIPV6 (input) {
|
|
let tokenCount = 0
|
|
const output = { error: false, address: '', zone: '' }
|
|
const address = []
|
|
const buffer = []
|
|
let isZone = false
|
|
let endipv6Encountered = false
|
|
let endIpv6 = false
|
|
|
|
function consume () {
|
|
if (buffer.length) {
|
|
if (isZone === false) {
|
|
const hex = stringArrayToHexStripped(buffer)
|
|
if (hex !== undefined) {
|
|
address.push(hex)
|
|
} else {
|
|
output.error = true
|
|
return false
|
|
}
|
|
}
|
|
buffer.length = 0
|
|
}
|
|
return true
|
|
}
|
|
|
|
for (let i = 0; i < input.length; i++) {
|
|
const cursor = input[i]
|
|
if (cursor === '[' || cursor === ']') { continue }
|
|
if (cursor === ':') {
|
|
if (endipv6Encountered === true) {
|
|
endIpv6 = true
|
|
}
|
|
if (!consume()) { break }
|
|
tokenCount++
|
|
address.push(':')
|
|
if (tokenCount > 7) {
|
|
// not valid
|
|
output.error = true
|
|
break
|
|
}
|
|
if (i - 1 >= 0 && input[i - 1] === ':') {
|
|
endipv6Encountered = true
|
|
}
|
|
continue
|
|
} else if (cursor === '%') {
|
|
if (!consume()) { break }
|
|
// switch to zone detection
|
|
isZone = true
|
|
} else {
|
|
buffer.push(cursor)
|
|
continue
|
|
}
|
|
}
|
|
if (buffer.length) {
|
|
if (isZone) {
|
|
output.zone = buffer.join('')
|
|
} else if (endIpv6) {
|
|
address.push(buffer.join(''))
|
|
} else {
|
|
address.push(stringArrayToHexStripped(buffer))
|
|
}
|
|
}
|
|
output.address = address.join('')
|
|
return output
|
|
}
|
|
|
|
function normalizeIPv6 (host) {
|
|
if (findToken(host, ':') < 2) { return { host, isIPV6: false } }
|
|
const ipv6 = getIPV6(host)
|
|
|
|
if (!ipv6.error) {
|
|
let newHost = ipv6.address
|
|
let escapedHost = ipv6.address
|
|
if (ipv6.zone) {
|
|
newHost += '%' + ipv6.zone
|
|
escapedHost += '%25' + ipv6.zone
|
|
}
|
|
return { host: newHost, escapedHost, isIPV6: true }
|
|
} else {
|
|
return { host, isIPV6: false }
|
|
}
|
|
}
|
|
|
|
function stripLeadingZeros (str, token) {
|
|
let out = ''
|
|
let skip = true
|
|
const l = str.length
|
|
for (let i = 0; i < l; i++) {
|
|
const c = str[i]
|
|
if (c === '0' && skip) {
|
|
if ((i + 1 <= l && str[i + 1] === token) || i + 1 === l) {
|
|
out += c
|
|
skip = false
|
|
}
|
|
} else {
|
|
if (c === token) {
|
|
skip = true
|
|
} else {
|
|
skip = false
|
|
}
|
|
out += c
|
|
}
|
|
}
|
|
return out
|
|
}
|
|
|
|
function findToken (str, token) {
|
|
let ind = 0
|
|
for (let i = 0; i < str.length; i++) {
|
|
if (str[i] === token) ind++
|
|
}
|
|
return ind
|
|
}
|
|
|
|
const RDS1 = /^\.\.?\//u
|
|
const RDS2 = /^\/\.(?:\/|$)/u
|
|
const RDS3 = /^\/\.\.(?:\/|$)/u
|
|
const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/u
|
|
|
|
function removeDotSegments (input) {
|
|
const output = []
|
|
|
|
while (input.length) {
|
|
if (input.match(RDS1)) {
|
|
input = input.replace(RDS1, '')
|
|
} else if (input.match(RDS2)) {
|
|
input = input.replace(RDS2, '/')
|
|
} else if (input.match(RDS3)) {
|
|
input = input.replace(RDS3, '/')
|
|
output.pop()
|
|
} else if (input === '.' || input === '..') {
|
|
input = ''
|
|
} else {
|
|
const im = input.match(RDS5)
|
|
if (im) {
|
|
const s = im[0]
|
|
input = input.slice(s.length)
|
|
output.push(s)
|
|
} else {
|
|
throw new Error('Unexpected dot segment condition')
|
|
}
|
|
}
|
|
}
|
|
return output.join('')
|
|
}
|
|
|
|
function normalizeComponentEncoding (components, esc) {
|
|
const func = esc !== true ? escape : unescape
|
|
if (components.scheme !== undefined) {
|
|
components.scheme = func(components.scheme)
|
|
}
|
|
if (components.userinfo !== undefined) {
|
|
components.userinfo = func(components.userinfo)
|
|
}
|
|
if (components.host !== undefined) {
|
|
components.host = func(components.host)
|
|
}
|
|
if (components.path !== undefined) {
|
|
components.path = func(components.path)
|
|
}
|
|
if (components.query !== undefined) {
|
|
components.query = func(components.query)
|
|
}
|
|
if (components.fragment !== undefined) {
|
|
components.fragment = func(components.fragment)
|
|
}
|
|
return components
|
|
}
|
|
|
|
function recomposeAuthority (components) {
|
|
const uriTokens = []
|
|
|
|
if (components.userinfo !== undefined) {
|
|
uriTokens.push(components.userinfo)
|
|
uriTokens.push('@')
|
|
}
|
|
|
|
if (components.host !== undefined) {
|
|
let host = unescape(components.host)
|
|
const ipV4res = normalizeIPv4(host)
|
|
|
|
if (ipV4res.isIPV4) {
|
|
host = ipV4res.host
|
|
} else {
|
|
const ipV6res = normalizeIPv6(ipV4res.host)
|
|
if (ipV6res.isIPV6 === true) {
|
|
host = `[${ipV6res.escapedHost}]`
|
|
} else {
|
|
host = components.host
|
|
}
|
|
}
|
|
uriTokens.push(host)
|
|
}
|
|
|
|
if (typeof components.port === 'number' || typeof components.port === 'string') {
|
|
uriTokens.push(':')
|
|
uriTokens.push(String(components.port))
|
|
}
|
|
|
|
return uriTokens.length ? uriTokens.join('') : undefined
|
|
};
|
|
|
|
module.exports = {
|
|
recomposeAuthority,
|
|
normalizeComponentEncoding,
|
|
removeDotSegments,
|
|
normalizeIPv4,
|
|
normalizeIPv6,
|
|
stringArrayToHexStripped
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 25127:
|
|
/***/ ((module) => {
|
|
|
|
|
|
|
|
var traverse = module.exports = function (schema, opts, cb) {
|
|
// Legacy support for v0.3.1 and earlier.
|
|
if (typeof opts == 'function') {
|
|
cb = opts;
|
|
opts = {};
|
|
}
|
|
|
|
cb = opts.cb || cb;
|
|
var pre = (typeof cb == 'function') ? cb : cb.pre || function() {};
|
|
var post = cb.post || function() {};
|
|
|
|
_traverse(opts, pre, post, schema, '', schema);
|
|
};
|
|
|
|
|
|
traverse.keywords = {
|
|
additionalItems: true,
|
|
items: true,
|
|
contains: true,
|
|
additionalProperties: true,
|
|
propertyNames: true,
|
|
not: true,
|
|
if: true,
|
|
then: true,
|
|
else: true
|
|
};
|
|
|
|
traverse.arrayKeywords = {
|
|
items: true,
|
|
allOf: true,
|
|
anyOf: true,
|
|
oneOf: true
|
|
};
|
|
|
|
traverse.propsKeywords = {
|
|
$defs: true,
|
|
definitions: true,
|
|
properties: true,
|
|
patternProperties: true,
|
|
dependencies: true
|
|
};
|
|
|
|
traverse.skipKeywords = {
|
|
default: true,
|
|
enum: true,
|
|
const: true,
|
|
required: true,
|
|
maximum: true,
|
|
minimum: true,
|
|
exclusiveMaximum: true,
|
|
exclusiveMinimum: true,
|
|
multipleOf: true,
|
|
maxLength: true,
|
|
minLength: true,
|
|
pattern: true,
|
|
format: true,
|
|
maxItems: true,
|
|
minItems: true,
|
|
uniqueItems: true,
|
|
maxProperties: true,
|
|
minProperties: true
|
|
};
|
|
|
|
|
|
function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
|
if (schema && typeof schema == 'object' && !Array.isArray(schema)) {
|
|
pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
for (var key in schema) {
|
|
var sch = schema[key];
|
|
if (Array.isArray(sch)) {
|
|
if (key in traverse.arrayKeywords) {
|
|
for (var i=0; i<sch.length; i++)
|
|
_traverse(opts, pre, post, sch[i], jsonPtr + '/' + key + '/' + i, rootSchema, jsonPtr, key, schema, i);
|
|
}
|
|
} else if (key in traverse.propsKeywords) {
|
|
if (sch && typeof sch == 'object') {
|
|
for (var prop in sch)
|
|
_traverse(opts, pre, post, sch[prop], jsonPtr + '/' + key + '/' + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop);
|
|
}
|
|
} else if (key in traverse.keywords || (opts.allKeys && !(key in traverse.skipKeywords))) {
|
|
_traverse(opts, pre, post, sch, jsonPtr + '/' + key, rootSchema, jsonPtr, key, schema);
|
|
}
|
|
}
|
|
post(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
|
|
}
|
|
}
|
|
|
|
|
|
function escapeJsonPtr(str) {
|
|
return str.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
}
|
|
|
|
|
|
/***/ })
|
|
|
|
}]);
|
|
//# sourceMappingURL=5448.a9016133a2b9389ac102.js.map?v=a9016133a2b9389ac102
|