| @@ -3111,266 +3111,504 @@ | ||
| 3111 | 3111 | }; |
| 3112 | 3112 | } |
| 3113 | 3113 | }); |
| 3114 | 3114 | |
| 3115 | -// node_modules/fast-uri/lib/scopedChars.js | |
| 3116 | -var require_scopedChars = __commonJS({ | |
| 3117 | - "node_modules/fast-uri/lib/scopedChars.js"(exports, module) { | |
| 3118 | - "use strict"; | |
| 3119 | - var HEX = { | |
| 3120 | - 0: 0, | |
| 3121 | - 1: 1, | |
| 3122 | - 2: 2, | |
| 3123 | - 3: 3, | |
| 3124 | - 4: 4, | |
| 3125 | - 5: 5, | |
| 3126 | - 6: 6, | |
| 3127 | - 7: 7, | |
| 3128 | - 8: 8, | |
| 3129 | - 9: 9, | |
| 3130 | - a: 10, | |
| 3131 | - A: 10, | |
| 3132 | - b: 11, | |
| 3133 | - B: 11, | |
| 3134 | - c: 12, | |
| 3135 | - C: 12, | |
| 3136 | - d: 13, | |
| 3137 | - D: 13, | |
| 3138 | - e: 14, | |
| 3139 | - E: 14, | |
| 3140 | - f: 15, | |
| 3141 | - F: 15 | |
| 3142 | - }; | |
| 3143 | - module.exports = { | |
| 3144 | - HEX | |
| 3145 | - }; | |
| 3146 | - } | |
| 3147 | -}); | |
| 3148 | - | |
| 3149 | 3115 | // node_modules/fast-uri/lib/utils.js |
| 3150 | 3116 | var require_utils = __commonJS({ |
| 3151 | 3117 | "node_modules/fast-uri/lib/utils.js"(exports, module) { |
| 3152 | 3118 | "use strict"; |
| 3153 | - var { HEX } = require_scopedChars(); | |
| 3154 | - function normalizeIPv4(host) { | |
| 3155 | - if (findToken(host, ".") < 3) { | |
| 3156 | - return { host, isIPV4: false }; | |
| 3119 | + var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu); | |
| 3120 | + var 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); | |
| 3121 | + var isPort = RegExp.prototype.test.bind(/^\d*$/u); | |
| 3122 | + var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu); | |
| 3123 | + var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu); | |
| 3124 | + var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u); | |
| 3125 | + var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u); | |
| 3126 | + var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u); | |
| 3127 | + var BYTE_HEX = new Array(256); | |
| 3128 | + { | |
| 3129 | + const HEX_DIGITS = "0123456789ABCDEF"; | |
| 3130 | + for (let i = 0; i < 256; i++) { | |
| 3131 | + BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15]; | |
| 3157 | 3132 | } |
| 3158 | - const matches = host.match(/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/u) || []; | |
| 3159 | - const [address] = matches; | |
| 3160 | - if (address) { | |
| 3161 | - return { host: stripLeadingZeros(address, "."), isIPV4: true }; | |
| 3162 | - } else { | |
| 3163 | - return { host, isIPV4: false }; | |
| 3133 | + } | |
| 3134 | + function percentEncodeNonAscii(cp) { | |
| 3135 | + if (cp < 2048) { | |
| 3136 | + return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63]; | |
| 3164 | 3137 | } |
| 3138 | + if (cp < 65536) { | |
| 3139 | + return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63]; | |
| 3140 | + } | |
| 3141 | + return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63]; | |
| 3165 | 3142 | } |
| 3166 | - function stringArrayToHexStripped(input, keepZero = false) { | |
| 3143 | + function stringArrayToHexStripped(input) { | |
| 3167 | 3144 | let acc = ""; |
| 3168 | - let strip = true; | |
| 3169 | - for (const c of input) { | |
| 3170 | - if (HEX[c] === void 0) return void 0; | |
| 3171 | - if (c !== "0" && strip === true) strip = false; | |
| 3172 | - if (!strip) acc += c; | |
| 3145 | + let code = 0; | |
| 3146 | + let i = 0; | |
| 3147 | + for (i = 0; i < input.length; i++) { | |
| 3148 | + code = input[i].charCodeAt(0); | |
| 3149 | + if (code === 48) { | |
| 3150 | + continue; | |
| 3151 | + } | |
| 3152 | + if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) { | |
| 3153 | + return ""; | |
| 3154 | + } | |
| 3155 | + acc += input[i]; | |
| 3156 | + break; | |
| 3173 | 3157 | } |
| 3174 | - if (keepZero && acc.length === 0) acc = "0"; | |
| 3158 | + for (i += 1; i < input.length; i++) { | |
| 3159 | + code = input[i].charCodeAt(0); | |
| 3160 | + if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) { | |
| 3161 | + return ""; | |
| 3162 | + } | |
| 3163 | + acc += input[i]; | |
| 3164 | + } | |
| 3175 | 3165 | return acc; |
| 3176 | 3166 | } |
| 3177 | - function getIPV6(input) { | |
| 3178 | - let tokenCount = 0; | |
| 3179 | - const output = { error: false, address: "", zone: "" }; | |
| 3180 | - const address = []; | |
| 3181 | - const buffer = []; | |
| 3182 | - let isZone = false; | |
| 3183 | - let endipv6Encountered = false; | |
| 3184 | - let endIpv6 = false; | |
| 3185 | - function consume() { | |
| 3186 | - if (buffer.length) { | |
| 3187 | - if (isZone === false) { | |
| 3188 | - const hex = stringArrayToHexStripped(buffer); | |
| 3189 | - if (hex !== void 0) { | |
| 3190 | - address.push(hex); | |
| 3191 | - } else { | |
| 3192 | - output.error = true; | |
| 3193 | - return false; | |
| 3194 | - } | |
| 3167 | + var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/); | |
| 3168 | + var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/); | |
| 3169 | + var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/); | |
| 3170 | + var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u); | |
| 3171 | + function isZoneIdentifier(zone) { | |
| 3172 | + if (zone.length === 0) return false; | |
| 3173 | + for (let i = 0; i < zone.length; i++) { | |
| 3174 | + if (isZoneCharacter(zone[i])) continue; | |
| 3175 | + if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) { | |
| 3176 | + i += 2; | |
| 3177 | + continue; | |
| 3178 | + } | |
| 3179 | + return false; | |
| 3180 | + } | |
| 3181 | + return true; | |
| 3182 | + } | |
| 3183 | + function compressIPv6ZeroRun(hextets) { | |
| 3184 | + let bestStart = -1; | |
| 3185 | + let bestLength = 0; | |
| 3186 | + let runStart = -1; | |
| 3187 | + let runLength = 0; | |
| 3188 | + for (let i = 0; i < hextets.length; i++) { | |
| 3189 | + if (hextets[i] === "0") { | |
| 3190 | + if (runStart === -1) runStart = i; | |
| 3191 | + runLength++; | |
| 3192 | + if (runLength > bestLength) { | |
| 3193 | + bestLength = runLength; | |
| 3194 | + bestStart = runStart; | |
| 3195 | 3195 | } |
| 3196 | - buffer.length = 0; | |
| 3196 | + } else { | |
| 3197 | + runStart = -1; | |
| 3198 | + runLength = 0; | |
| 3197 | 3199 | } |
| 3198 | - return true; | |
| 3199 | 3200 | } |
| 3200 | - for (let i = 0; i < input.length; i++) { | |
| 3201 | - const cursor = input[i]; | |
| 3202 | - if (cursor === "[" || cursor === "]") { | |
| 3201 | + if (bestLength < 2) return hextets.join(":"); | |
| 3202 | + const head = hextets.slice(0, bestStart).join(":"); | |
| 3203 | + const tail = hextets.slice(bestStart + bestLength).join(":"); | |
| 3204 | + return head + "::" + tail; | |
| 3205 | + } | |
| 3206 | + function normalizeIPv6Address(input) { | |
| 3207 | + const compression = input.indexOf("::"); | |
| 3208 | + if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0; | |
| 3209 | + const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":"); | |
| 3210 | + const right = compression === -1 ? [] : input.slice(compression + 2).split(":"); | |
| 3211 | + if (compression !== -1) { | |
| 3212 | + if (left.length === 1 && left[0] === "") left.length = 0; | |
| 3213 | + if (right.length === 1 && right[0] === "") right.length = 0; | |
| 3214 | + } | |
| 3215 | + const parts = left.concat(right); | |
| 3216 | + let hextetCount = 0; | |
| 3217 | + for (let i = 0; i < parts.length; i++) { | |
| 3218 | + const part = parts[i]; | |
| 3219 | + if (part === "") return void 0; | |
| 3220 | + if (part.indexOf(".") !== -1) { | |
| 3221 | + if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part)) return void 0; | |
| 3222 | + hextetCount += 2; | |
| 3203 | 3223 | continue; |
| 3204 | 3224 | } |
| 3205 | - if (cursor === ":") { | |
| 3206 | - if (endipv6Encountered === true) { | |
| 3207 | - endIpv6 = true; | |
| 3225 | + if (!isHextet(part)) return void 0; | |
| 3226 | + parts[i] = parseInt(part, 16).toString(16); | |
| 3227 | + hextetCount++; | |
| 3228 | + } | |
| 3229 | + if (compression === -1) { | |
| 3230 | + if (hextetCount !== 8) return void 0; | |
| 3231 | + return compressIPv6ZeroRun(parts); | |
| 3232 | + } | |
| 3233 | + if (hextetCount >= 8) return void 0; | |
| 3234 | + const expanded = parts.slice(0, left.length); | |
| 3235 | + for (let i = hextetCount; i < 8; i++) expanded.push("0"); | |
| 3236 | + for (let i = left.length; i < parts.length; i++) expanded.push(parts[i]); | |
| 3237 | + return compressIPv6ZeroRun(expanded); | |
| 3238 | + } | |
| 3239 | + function normalizeIPv6(host) { | |
| 3240 | + const bracketed = host[0] === "[" && host[host.length - 1] === "]"; | |
| 3241 | + const hasBracket = host[0] === "[" || host[host.length - 1] === "]"; | |
| 3242 | + if (hasBracket && !bracketed) return { host, isIPV6: false, error: true }; | |
| 3243 | + let input = bracketed ? host.slice(1, -1) : host; | |
| 3244 | + if (bracketed && isIPvFuture(input)) { | |
| 3245 | + input = input.toLowerCase(); | |
| 3246 | + return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true }; | |
| 3247 | + } | |
| 3248 | + if (findToken(input, ":") < 2) { | |
| 3249 | + return { host, isIPV6: false, error: bracketed }; | |
| 3250 | + } | |
| 3251 | + let zoneIdentifier = ""; | |
| 3252 | + const zoneSeparator = input.indexOf("%"); | |
| 3253 | + if (zoneSeparator !== -1) { | |
| 3254 | + const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1; | |
| 3255 | + zoneIdentifier = input.slice(zoneSeparator + separatorLength); | |
| 3256 | + if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true }; | |
| 3257 | + input = input.slice(0, zoneSeparator); | |
| 3258 | + } | |
| 3259 | + const address = normalizeIPv6Address(input); | |
| 3260 | + if (address === void 0) return { host, isIPV6: false, error: true }; | |
| 3261 | + return { | |
| 3262 | + host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""), | |
| 3263 | + escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""), | |
| 3264 | + isIPV6: true | |
| 3265 | + }; | |
| 3266 | + } | |
| 3267 | + function findToken(str, token) { | |
| 3268 | + let ind = 0; | |
| 3269 | + for (let i = 0; i < str.length; i++) { | |
| 3270 | + if (str[i] === token) ind++; | |
| 3271 | + } | |
| 3272 | + return ind; | |
| 3273 | + } | |
| 3274 | + function removeDotSegments(path) { | |
| 3275 | + let input = path; | |
| 3276 | + const output = []; | |
| 3277 | + let nextSlash = -1; | |
| 3278 | + let len = 0; | |
| 3279 | + while (len = input.length) { | |
| 3280 | + if (len === 1) { | |
| 3281 | + if (input === ".") { | |
| 3282 | + break; | |
| 3283 | + } else if (input === "/") { | |
| 3284 | + output.push("/"); | |
| 3285 | + break; | |
| 3286 | + } else { | |
| 3287 | + output.push(input); | |
| 3288 | + break; | |
| 3208 | 3289 | } |
| 3209 | - if (!consume()) { | |
| 3210 | - break; | |
| 3290 | + } else if (len === 2) { | |
| 3291 | + if (input[0] === ".") { | |
| 3292 | + if (input[1] === ".") { | |
| 3293 | + break; | |
| 3294 | + } else if (input[1] === "/") { | |
| 3295 | + input = input.slice(2); | |
| 3296 | + continue; | |
| 3297 | + } | |
| 3298 | + } else if (input[0] === "/") { | |
| 3299 | + if (input[1] === "." || input[1] === "/") { | |
| 3300 | + output.push("/"); | |
| 3301 | + break; | |
| 3302 | + } | |
| 3211 | 3303 | } |
| 3212 | - tokenCount++; | |
| 3213 | - address.push(":"); | |
| 3214 | - if (tokenCount > 7) { | |
| 3215 | - output.error = true; | |
| 3304 | + } else if (len === 3) { | |
| 3305 | + if (input === "/..") { | |
| 3306 | + if (output.length !== 0) { | |
| 3307 | + output.pop(); | |
| 3308 | + } | |
| 3309 | + output.push("/"); | |
| 3216 | 3310 | break; |
| 3217 | 3311 | } |
| 3218 | - if (i - 1 >= 0 && input[i - 1] === ":") { | |
| 3219 | - endipv6Encountered = true; | |
| 3312 | + } | |
| 3313 | + if (input[0] === ".") { | |
| 3314 | + if (input[1] === ".") { | |
| 3315 | + if (input[2] === "/") { | |
| 3316 | + input = input.slice(3); | |
| 3317 | + continue; | |
| 3318 | + } | |
| 3319 | + } else if (input[1] === "/") { | |
| 3320 | + input = input.slice(2); | |
| 3321 | + continue; | |
| 3220 | 3322 | } |
| 3221 | - continue; | |
| 3222 | - } else if (cursor === "%") { | |
| 3223 | - if (!consume()) { | |
| 3224 | - break; | |
| 3323 | + } else if (input[0] === "/") { | |
| 3324 | + if (input[1] === ".") { | |
| 3325 | + if (input[2] === "/") { | |
| 3326 | + input = input.slice(2); | |
| 3327 | + continue; | |
| 3328 | + } else if (input[2] === ".") { | |
| 3329 | + if (input[3] === "/") { | |
| 3330 | + input = input.slice(3); | |
| 3331 | + if (output.length !== 0) { | |
| 3332 | + output.pop(); | |
| 3333 | + } | |
| 3334 | + continue; | |
| 3335 | + } | |
| 3336 | + } | |
| 3225 | 3337 | } |
| 3226 | - isZone = true; | |
| 3338 | + } | |
| 3339 | + if ((nextSlash = input.indexOf("/", 1)) === -1) { | |
| 3340 | + output.push(input); | |
| 3341 | + break; | |
| 3227 | 3342 | } else { |
| 3228 | - buffer.push(cursor); | |
| 3229 | - continue; | |
| 3343 | + output.push(input.slice(0, nextSlash)); | |
| 3344 | + input = input.slice(nextSlash); | |
| 3230 | 3345 | } |
| 3231 | 3346 | } |
| 3232 | - if (buffer.length) { | |
| 3233 | - if (isZone) { | |
| 3234 | - output.zone = buffer.join(""); | |
| 3235 | - } else if (endIpv6) { | |
| 3236 | - address.push(buffer.join("")); | |
| 3347 | + return output.join(""); | |
| 3348 | + } | |
| 3349 | + var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" }; | |
| 3350 | + var HOST_DELIM_RE = /[@/?#:]/g; | |
| 3351 | + var HOST_DELIM_NO_COLON_RE = /[@/?#]/g; | |
| 3352 | + function reescapeHostDelimiters(host, isIP) { | |
| 3353 | + const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE; | |
| 3354 | + re.lastIndex = 0; | |
| 3355 | + return host.replace(re, (ch) => HOST_DELIMS[ch]); | |
| 3356 | + } | |
| 3357 | + function normalizePercentEncoding(input, decodeUnreserved = false) { | |
| 3358 | + if (input.indexOf("%") === -1) { | |
| 3359 | + return input; | |
| 3360 | + } | |
| 3361 | + let output = ""; | |
| 3362 | + for (let i = 0; i < input.length; i++) { | |
| 3363 | + if (input[i] === "%" && i + 2 < input.length) { | |
| 3364 | + const hex = input.slice(i + 1, i + 3); | |
| 3365 | + if (isHexPair(hex)) { | |
| 3366 | + const normalizedHex = hex.toUpperCase(); | |
| 3367 | + const decoded = String.fromCharCode(parseInt(normalizedHex, 16)); | |
| 3368 | + if (decodeUnreserved && isUnreserved(decoded)) { | |
| 3369 | + output += decoded; | |
| 3370 | + } else { | |
| 3371 | + output += "%" + normalizedHex; | |
| 3372 | + } | |
| 3373 | + i += 2; | |
| 3374 | + continue; | |
| 3375 | + } | |
| 3376 | + } | |
| 3377 | + output += input[i]; | |
| 3378 | + } | |
| 3379 | + return output; | |
| 3380 | + } | |
| 3381 | + function normalizePathEncoding(input) { | |
| 3382 | + let output = ""; | |
| 3383 | + for (let i = 0; i < input.length; i++) { | |
| 3384 | + const ch = input[i]; | |
| 3385 | + if (ch === "%" && i + 2 < input.length) { | |
| 3386 | + const hex = input.slice(i + 1, i + 3); | |
| 3387 | + if (isHexPair(hex)) { | |
| 3388 | + const normalizedHex = hex.toUpperCase(); | |
| 3389 | + const decoded = String.fromCharCode(parseInt(normalizedHex, 16)); | |
| 3390 | + if (decoded !== "." && isUnreserved(decoded)) { | |
| 3391 | + output += decoded; | |
| 3392 | + } else { | |
| 3393 | + output += "%" + normalizedHex; | |
| 3394 | + } | |
| 3395 | + i += 2; | |
| 3396 | + continue; | |
| 3397 | + } | |
| 3398 | + } | |
| 3399 | + if (isPathCharacter(ch)) { | |
| 3400 | + output += ch; | |
| 3237 | 3401 | } else { |
| 3238 | - address.push(stringArrayToHexStripped(buffer)); | |
| 3402 | + const code = input.charCodeAt(i); | |
| 3403 | + if (code < 128) { | |
| 3404 | + output += isEscapeSafe(code) ? ch : BYTE_HEX[code]; | |
| 3405 | + } else if (code < 55296 || code > 57343) { | |
| 3406 | + output += percentEncodeNonAscii(code); | |
| 3407 | + } else if (code <= 56319 && i + 1 < input.length) { | |
| 3408 | + const low = input.charCodeAt(i + 1); | |
| 3409 | + if (low >= 56320 && low <= 57343) { | |
| 3410 | + output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); | |
| 3411 | + i++; | |
| 3412 | + } else { | |
| 3413 | + output += percentEncodeNonAscii(65533); | |
| 3414 | + } | |
| 3415 | + } else { | |
| 3416 | + output += percentEncodeNonAscii(65533); | |
| 3417 | + } | |
| 3239 | 3418 | } |
| 3240 | 3419 | } |
| 3241 | - output.address = address.join(""); | |
| 3242 | 3420 | return output; |
| 3243 | 3421 | } |
| 3244 | - function normalizeIPv6(host, opts = {}) { | |
| 3245 | - if (findToken(host, ":") < 2) { | |
| 3246 | - return { host, isIPV6: false }; | |
| 3247 | - } | |
| 3248 | - const ipv6 = getIPV6(host); | |
| 3249 | - if (!ipv6.error) { | |
| 3250 | - let newHost = ipv6.address; | |
| 3251 | - let escapedHost = ipv6.address; | |
| 3252 | - if (ipv6.zone) { | |
| 3253 | - newHost += "%" + ipv6.zone; | |
| 3254 | - escapedHost += "%25" + ipv6.zone; | |
| 3422 | + function serializePathEncoding(input, pathNoScheme = false) { | |
| 3423 | + let output = ""; | |
| 3424 | + let firstSegment = pathNoScheme && input[0] !== "/"; | |
| 3425 | + for (let i = 0; i < input.length; i++) { | |
| 3426 | + const ch = input[i]; | |
| 3427 | + if (ch === "%" && i + 2 < input.length) { | |
| 3428 | + const hex = input.slice(i + 1, i + 3); | |
| 3429 | + if (isHexPair(hex)) { | |
| 3430 | + output += "%" + hex.toUpperCase(); | |
| 3431 | + i += 2; | |
| 3432 | + continue; | |
| 3433 | + } | |
| 3255 | 3434 | } |
| 3256 | - return { host: newHost, escapedHost, isIPV6: true }; | |
| 3257 | - } else { | |
| 3258 | - return { host, isIPV6: false }; | |
| 3435 | + if (ch === "/") { | |
| 3436 | + firstSegment = false; | |
| 3437 | + } | |
| 3438 | + if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) { | |
| 3439 | + output += ch; | |
| 3440 | + } else { | |
| 3441 | + const code = input.charCodeAt(i); | |
| 3442 | + if (code < 128) { | |
| 3443 | + output += BYTE_HEX[code]; | |
| 3444 | + } else if (code < 55296 || code > 57343) { | |
| 3445 | + output += percentEncodeNonAscii(code); | |
| 3446 | + } else if (code <= 56319 && i + 1 < input.length) { | |
| 3447 | + const low = input.charCodeAt(i + 1); | |
| 3448 | + if (low >= 56320 && low <= 57343) { | |
| 3449 | + output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); | |
| 3450 | + i++; | |
| 3451 | + } else { | |
| 3452 | + output += percentEncodeNonAscii(65533); | |
| 3453 | + } | |
| 3454 | + } else { | |
| 3455 | + output += percentEncodeNonAscii(65533); | |
| 3456 | + } | |
| 3457 | + } | |
| 3259 | 3458 | } |
| 3459 | + return output; | |
| 3260 | 3460 | } |
| 3261 | - function stripLeadingZeros(str, token) { | |
| 3262 | - let out = ""; | |
| 3263 | - let skip = true; | |
| 3264 | - const l = str.length; | |
| 3265 | - for (let i = 0; i < l; i++) { | |
| 3266 | - const c = str[i]; | |
| 3267 | - if (c === "0" && skip) { | |
| 3268 | - if (i + 1 <= l && str[i + 1] === token || i + 1 === l) { | |
| 3269 | - out += c; | |
| 3270 | - skip = false; | |
| 3461 | + function encodeComponent(input, isAllowed) { | |
| 3462 | + let output = ""; | |
| 3463 | + for (let i = 0; i < input.length; i++) { | |
| 3464 | + const ch = input[i]; | |
| 3465 | + if (ch === "%" && i + 2 < input.length) { | |
| 3466 | + const hex = input.slice(i + 1, i + 3); | |
| 3467 | + if (isHexPair(hex)) { | |
| 3468 | + output += "%" + hex.toUpperCase(); | |
| 3469 | + i += 2; | |
| 3470 | + continue; | |
| 3271 | 3471 | } |
| 3472 | + } | |
| 3473 | + if (isAllowed(ch)) { | |
| 3474 | + output += ch; | |
| 3272 | 3475 | } else { |
| 3273 | - if (c === token) { | |
| 3274 | - skip = true; | |
| 3476 | + const code = input.charCodeAt(i); | |
| 3477 | + if (code < 128) { | |
| 3478 | + output += BYTE_HEX[code]; | |
| 3479 | + } else if (code < 55296 || code > 57343) { | |
| 3480 | + output += percentEncodeNonAscii(code); | |
| 3481 | + } else if (code <= 56319 && i + 1 < input.length) { | |
| 3482 | + const low = input.charCodeAt(i + 1); | |
| 3483 | + if (low >= 56320 && low <= 57343) { | |
| 3484 | + output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); | |
| 3485 | + i++; | |
| 3486 | + } else { | |
| 3487 | + output += percentEncodeNonAscii(65533); | |
| 3488 | + } | |
| 3275 | 3489 | } else { |
| 3276 | - skip = false; | |
| 3490 | + output += percentEncodeNonAscii(65533); | |
| 3277 | 3491 | } |
| 3278 | - out += c; | |
| 3279 | 3492 | } |
| 3280 | 3493 | } |
| 3281 | - return out; | |
| 3494 | + return output; | |
| 3282 | 3495 | } |
| 3283 | - function findToken(str, token) { | |
| 3284 | - let ind = 0; | |
| 3285 | - for (let i = 0; i < str.length; i++) { | |
| 3286 | - if (str[i] === token) ind++; | |
| 3287 | - } | |
| 3288 | - return ind; | |
| 3496 | + function encodeUserinfo(input) { | |
| 3497 | + return encodeComponent(input, isUserinfoCharacter); | |
| 3289 | 3498 | } |
| 3290 | - var RDS1 = /^\.\.?\//u; | |
| 3291 | - var RDS2 = /^\/\.(?:\/|$)/u; | |
| 3292 | - var RDS3 = /^\/\.\.(?:\/|$)/u; | |
| 3293 | - var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/u; | |
| 3294 | - function removeDotSegments(input) { | |
| 3295 | - const output = []; | |
| 3296 | - while (input.length) { | |
| 3297 | - if (input.match(RDS1)) { | |
| 3298 | - input = input.replace(RDS1, ""); | |
| 3299 | - } else if (input.match(RDS2)) { | |
| 3300 | - input = input.replace(RDS2, "/"); | |
| 3301 | - } else if (input.match(RDS3)) { | |
| 3302 | - input = input.replace(RDS3, "/"); | |
| 3303 | - output.pop(); | |
| 3304 | - } else if (input === "." || input === "..") { | |
| 3305 | - input = ""; | |
| 3499 | + function encodeQuery(input) { | |
| 3500 | + return encodeComponent(input, isQueryFragmentCharacter); | |
| 3501 | + } | |
| 3502 | + function encodeFragment(input) { | |
| 3503 | + return encodeComponent(input, isQueryFragmentCharacter); | |
| 3504 | + } | |
| 3505 | + function isEscapeSafe(cp) { | |
| 3506 | + return cp >= 48 && cp <= 57 || cp >= 65 && cp <= 90 || cp >= 97 && cp <= 122 || cp === 42 || cp === 43 || cp === 45 || cp === 46 || cp === 47 || cp === 64 || cp === 95; | |
| 3507 | + } | |
| 3508 | + function normalizeQueryFragmentEncoding(input) { | |
| 3509 | + let output = ""; | |
| 3510 | + for (let i = 0; i < input.length; i++) { | |
| 3511 | + const ch = input[i]; | |
| 3512 | + if (ch === "%" && i + 2 < input.length) { | |
| 3513 | + const hex = input.slice(i + 1, i + 3); | |
| 3514 | + if (isHexPair(hex)) { | |
| 3515 | + const normalizedHex = hex.toUpperCase(); | |
| 3516 | + const decoded = String.fromCharCode(parseInt(normalizedHex, 16)); | |
| 3517 | + if (isUnreserved(decoded)) { | |
| 3518 | + output += decoded; | |
| 3519 | + } else { | |
| 3520 | + output += "%" + normalizedHex; | |
| 3521 | + } | |
| 3522 | + i += 2; | |
| 3523 | + continue; | |
| 3524 | + } | |
| 3525 | + } | |
| 3526 | + if (isQueryFragmentCharacter(ch)) { | |
| 3527 | + output += ch; | |
| 3306 | 3528 | } else { |
| 3307 | - const im = input.match(RDS5); | |
| 3308 | - if (im) { | |
| 3309 | - const s = im[0]; | |
| 3310 | - input = input.slice(s.length); | |
| 3311 | - output.push(s); | |
| 3529 | + const code = input.charCodeAt(i); | |
| 3530 | + if (code < 128) { | |
| 3531 | + output += isEscapeSafe(code) ? ch : BYTE_HEX[code]; | |
| 3532 | + } else if (code < 55296 || code > 57343) { | |
| 3533 | + output += percentEncodeNonAscii(code); | |
| 3534 | + } else if (code <= 56319 && i + 1 < input.length) { | |
| 3535 | + const low = input.charCodeAt(i + 1); | |
| 3536 | + if (low >= 56320 && low <= 57343) { | |
| 3537 | + output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); | |
| 3538 | + i++; | |
| 3539 | + } else { | |
| 3540 | + output += percentEncodeNonAscii(65533); | |
| 3541 | + } | |
| 3312 | 3542 | } else { |
| 3313 | - throw new Error("Unexpected dot segment condition"); | |
| 3543 | + output += percentEncodeNonAscii(65533); | |
| 3314 | 3544 | } |
| 3315 | 3545 | } |
| 3316 | 3546 | } |
| 3317 | - return output.join(""); | |
| 3547 | + return output; | |
| 3318 | 3548 | } |
| 3319 | - function normalizeComponentEncoding(components, esc) { | |
| 3320 | - const func = esc !== true ? escape : unescape; | |
| 3321 | - if (components.scheme !== void 0) { | |
| 3322 | - components.scheme = func(components.scheme); | |
| 3549 | + function escapePreservingEscapes(input) { | |
| 3550 | + let output = ""; | |
| 3551 | + for (let i = 0; i < input.length; i++) { | |
| 3552 | + if (input[i] === "%" && i + 2 < input.length) { | |
| 3553 | + const hex = input.slice(i + 1, i + 3); | |
| 3554 | + if (isHexPair(hex)) { | |
| 3555 | + output += "%" + hex.toUpperCase(); | |
| 3556 | + i += 2; | |
| 3557 | + continue; | |
| 3558 | + } | |
| 3559 | + } | |
| 3560 | + output += escape(input[i]); | |
| 3323 | 3561 | } |
| 3324 | - if (components.userinfo !== void 0) { | |
| 3325 | - components.userinfo = func(components.userinfo); | |
| 3326 | - } | |
| 3327 | - if (components.host !== void 0) { | |
| 3328 | - components.host = func(components.host); | |
| 3329 | - } | |
| 3330 | - if (components.path !== void 0) { | |
| 3331 | - components.path = func(components.path); | |
| 3332 | - } | |
| 3333 | - if (components.query !== void 0) { | |
| 3334 | - components.query = func(components.query); | |
| 3335 | - } | |
| 3336 | - if (components.fragment !== void 0) { | |
| 3337 | - components.fragment = func(components.fragment); | |
| 3338 | - } | |
| 3339 | - return components; | |
| 3562 | + return output; | |
| 3340 | 3563 | } |
| 3341 | - function recomposeAuthority(components, options) { | |
| 3564 | + function recomposeAuthority(component) { | |
| 3342 | 3565 | const uriTokens = []; |
| 3343 | - if (components.userinfo !== void 0) { | |
| 3344 | - uriTokens.push(components.userinfo); | |
| 3566 | + if (component.userinfo !== void 0) { | |
| 3567 | + uriTokens.push(encodeUserinfo(component.userinfo)); | |
| 3345 | 3568 | uriTokens.push("@"); |
| 3346 | 3569 | } |
| 3347 | - if (components.host !== void 0) { | |
| 3348 | - let host = unescape(components.host); | |
| 3349 | - const ipV4res = normalizeIPv4(host); | |
| 3350 | - if (ipV4res.isIPV4) { | |
| 3351 | - host = ipV4res.host; | |
| 3352 | - } else { | |
| 3353 | - const ipV6res = normalizeIPv6(ipV4res.host, { isIPV4: false }); | |
| 3354 | - if (ipV6res.isIPV6 === true) { | |
| 3570 | + if (component.host !== void 0) { | |
| 3571 | + let host = component.host; | |
| 3572 | + if (!isIPv4(host)) { | |
| 3573 | + let ipV6res = normalizeIPv6(host); | |
| 3574 | + if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) { | |
| 3575 | + host = normalizePercentEncoding(host, true); | |
| 3576 | + ipV6res = normalizeIPv6(host); | |
| 3577 | + } | |
| 3578 | + if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) { | |
| 3355 | 3579 | host = `[${ipV6res.escapedHost}]`; |
| 3356 | 3580 | } else { |
| 3357 | - host = components.host; | |
| 3581 | + host = reescapeHostDelimiters(host, false); | |
| 3358 | 3582 | } |
| 3359 | 3583 | } |
| 3360 | 3584 | uriTokens.push(host); |
| 3361 | 3585 | } |
| 3362 | - if (typeof components.port === "number" || typeof components.port === "string") { | |
| 3586 | + if (typeof component.port === "number" || typeof component.port === "string") { | |
| 3587 | + const port = String(component.port); | |
| 3588 | + if (!isPort(port)) { | |
| 3589 | + throw new TypeError("URI port is malformed."); | |
| 3590 | + } | |
| 3363 | 3591 | uriTokens.push(":"); |
| 3364 | - uriTokens.push(String(components.port)); | |
| 3592 | + uriTokens.push(port); | |
| 3365 | 3593 | } |
| 3366 | 3594 | return uriTokens.length ? uriTokens.join("") : void 0; |
| 3367 | 3595 | } |
| 3368 | 3596 | module.exports = { |
| 3597 | + nonSimpleDomain, | |
| 3369 | 3598 | recomposeAuthority, |
| 3370 | - normalizeComponentEncoding, | |
| 3599 | + reescapeHostDelimiters, | |
| 3600 | + normalizePercentEncoding, | |
| 3601 | + normalizePathEncoding, | |
| 3602 | + serializePathEncoding, | |
| 3603 | + normalizeQueryFragmentEncoding, | |
| 3604 | + encodeUserinfo, | |
| 3605 | + encodeQuery, | |
| 3606 | + encodeFragment, | |
| 3607 | + escapePreservingEscapes, | |
| 3371 | 3608 | removeDotSegments, |
| 3372 | - normalizeIPv4, | |
| 3609 | + isIPv4, | |
| 3610 | + isUUID, | |
| 3373 | 3611 | normalizeIPv6, |
| 3374 | 3612 | stringArrayToHexStripped |
| 3375 | 3613 | }; |
| 3376 | 3614 | } |
| @@ -3379,147 +3617,212 @@ | ||
| 3379 | 3617 | // node_modules/fast-uri/lib/schemes.js |
| 3380 | 3618 | var require_schemes = __commonJS({ |
| 3381 | 3619 | "node_modules/fast-uri/lib/schemes.js"(exports, module) { |
| 3382 | 3620 | "use strict"; |
| 3383 | - var UUID_REG = /^[\da-f]{8}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{12}$/iu; | |
| 3384 | - var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu; | |
| 3385 | - function isSecure(wsComponents) { | |
| 3386 | - return typeof wsComponents.secure === "boolean" ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss"; | |
| 3621 | + var { isUUID } = require_utils(); | |
| 3622 | + var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu; | |
| 3623 | + var supportedSchemeNames = ( | |
| 3624 | + /** @type {const} */ | |
| 3625 | + [ | |
| 3626 | + "http", | |
| 3627 | + "https", | |
| 3628 | + "ws", | |
| 3629 | + "wss", | |
| 3630 | + "urn", | |
| 3631 | + "urn:uuid" | |
| 3632 | + ] | |
| 3633 | + ); | |
| 3634 | + function isValidSchemeName(name) { | |
| 3635 | + return supportedSchemeNames.indexOf( | |
| 3636 | + /** @type {*} */ | |
| 3637 | + name | |
| 3638 | + ) !== -1; | |
| 3387 | 3639 | } |
| 3388 | - function httpParse(components) { | |
| 3389 | - if (!components.host) { | |
| 3390 | - components.error = components.error || "HTTP URIs must have a host."; | |
| 3640 | + function wsIsSecure(wsComponent) { | |
| 3641 | + if (wsComponent.secure === true) { | |
| 3642 | + return true; | |
| 3643 | + } else if (wsComponent.secure === false) { | |
| 3644 | + return false; | |
| 3645 | + } else if (wsComponent.scheme) { | |
| 3646 | + return wsComponent.scheme.length === 3 && (wsComponent.scheme[0] === "w" || wsComponent.scheme[0] === "W") && (wsComponent.scheme[1] === "s" || wsComponent.scheme[1] === "S") && (wsComponent.scheme[2] === "s" || wsComponent.scheme[2] === "S"); | |
| 3647 | + } else { | |
| 3648 | + return false; | |
| 3391 | 3649 | } |
| 3392 | - return components; | |
| 3393 | 3650 | } |
| 3394 | - function httpSerialize(components) { | |
| 3395 | - const secure = String(components.scheme).toLowerCase() === "https"; | |
| 3396 | - if (components.port === (secure ? 443 : 80) || components.port === "") { | |
| 3397 | - components.port = void 0; | |
| 3651 | + function httpParse(component) { | |
| 3652 | + if (!component.host) { | |
| 3653 | + component.error = component.error || "HTTP URIs must have a host."; | |
| 3398 | 3654 | } |
| 3399 | - if (!components.path) { | |
| 3400 | - components.path = "/"; | |
| 3655 | + return component; | |
| 3656 | + } | |
| 3657 | + function httpSerialize(component) { | |
| 3658 | + const secure = String(component.scheme).toLowerCase() === "https"; | |
| 3659 | + if (component.port === (secure ? 443 : 80) || component.port === "") { | |
| 3660 | + component.port = void 0; | |
| 3401 | 3661 | } |
| 3402 | - return components; | |
| 3662 | + if (!component.path) { | |
| 3663 | + component.path = "/"; | |
| 3664 | + } | |
| 3665 | + return component; | |
| 3403 | 3666 | } |
| 3404 | - function wsParse(wsComponents) { | |
| 3405 | - wsComponents.secure = isSecure(wsComponents); | |
| 3406 | - wsComponents.resourceName = (wsComponents.path || "/") + (wsComponents.query ? "?" + wsComponents.query : ""); | |
| 3407 | - wsComponents.path = void 0; | |
| 3408 | - wsComponents.query = void 0; | |
| 3409 | - return wsComponents; | |
| 3667 | + function wsParse(wsComponent) { | |
| 3668 | + wsComponent.secure = wsIsSecure(wsComponent); | |
| 3669 | + wsComponent.resourceName = (wsComponent.path || "/") + (wsComponent.query ? "?" + wsComponent.query : ""); | |
| 3670 | + wsComponent.path = void 0; | |
| 3671 | + wsComponent.query = void 0; | |
| 3672 | + return wsComponent; | |
| 3410 | 3673 | } |
| 3411 | - function wsSerialize(wsComponents) { | |
| 3412 | - if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") { | |
| 3413 | - wsComponents.port = void 0; | |
| 3674 | + function wsSerialize(wsComponent) { | |
| 3675 | + if (wsComponent.port === (wsIsSecure(wsComponent) ? 443 : 80) || wsComponent.port === "") { | |
| 3676 | + wsComponent.port = void 0; | |
| 3414 | 3677 | } |
| 3415 | - if (typeof wsComponents.secure === "boolean") { | |
| 3416 | - wsComponents.scheme = wsComponents.secure ? "wss" : "ws"; | |
| 3417 | - wsComponents.secure = void 0; | |
| 3678 | + if (typeof wsComponent.secure === "boolean") { | |
| 3679 | + wsComponent.scheme = wsComponent.secure ? "wss" : "ws"; | |
| 3680 | + wsComponent.secure = void 0; | |
| 3418 | 3681 | } |
| 3419 | - if (wsComponents.resourceName) { | |
| 3420 | - const [path, query] = wsComponents.resourceName.split("?"); | |
| 3421 | - wsComponents.path = path && path !== "/" ? path : void 0; | |
| 3422 | - wsComponents.query = query; | |
| 3423 | - wsComponents.resourceName = void 0; | |
| 3682 | + if (wsComponent.resourceName) { | |
| 3683 | + const queryIndex = wsComponent.resourceName.indexOf("?"); | |
| 3684 | + const path = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex); | |
| 3685 | + wsComponent.path = path && path !== "/" ? path : void 0; | |
| 3686 | + wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1); | |
| 3687 | + wsComponent.resourceName = void 0; | |
| 3424 | 3688 | } |
| 3425 | - wsComponents.fragment = void 0; | |
| 3426 | - return wsComponents; | |
| 3689 | + wsComponent.fragment = void 0; | |
| 3690 | + return wsComponent; | |
| 3427 | 3691 | } |
| 3428 | - function urnParse(urnComponents, options) { | |
| 3429 | - if (!urnComponents.path) { | |
| 3430 | - urnComponents.error = "URN can not be parsed"; | |
| 3431 | - return urnComponents; | |
| 3692 | + function urnParse(urnComponent, options) { | |
| 3693 | + if (!urnComponent.path) { | |
| 3694 | + urnComponent.error = "URN can not be parsed"; | |
| 3695 | + return urnComponent; | |
| 3432 | 3696 | } |
| 3433 | - const matches = urnComponents.path.match(URN_REG); | |
| 3434 | - if (matches) { | |
| 3435 | - const scheme = options.scheme || urnComponents.scheme || "urn"; | |
| 3436 | - urnComponents.nid = matches[1].toLowerCase(); | |
| 3437 | - urnComponents.nss = matches[2]; | |
| 3438 | - const urnScheme = `${scheme}:${options.nid || urnComponents.nid}`; | |
| 3439 | - const schemeHandler = SCHEMES[urnScheme]; | |
| 3440 | - urnComponents.path = void 0; | |
| 3697 | + const matches = urnComponent.path.match(URN_REG); | |
| 3698 | + if (matches && matches[0] === urnComponent.path) { | |
| 3699 | + const scheme = options.scheme || urnComponent.scheme || "urn"; | |
| 3700 | + urnComponent.nid = matches[1].toLowerCase(); | |
| 3701 | + urnComponent.nss = matches[2]; | |
| 3702 | + const urnScheme = `${scheme}:${options.nid || urnComponent.nid}`; | |
| 3703 | + const schemeHandler = getSchemeHandler(urnScheme); | |
| 3704 | + urnComponent.path = void 0; | |
| 3441 | 3705 | if (schemeHandler) { |
| 3442 | - urnComponents = schemeHandler.parse(urnComponents, options); | |
| 3706 | + urnComponent = schemeHandler.parse(urnComponent, options); | |
| 3443 | 3707 | } |
| 3444 | 3708 | } else { |
| 3445 | - urnComponents.error = urnComponents.error || "URN can not be parsed."; | |
| 3709 | + urnComponent.error = urnComponent.error || "URN can not be parsed."; | |
| 3446 | 3710 | } |
| 3447 | - return urnComponents; | |
| 3711 | + return urnComponent; | |
| 3448 | 3712 | } |
| 3449 | - function urnSerialize(urnComponents, options) { | |
| 3450 | - const scheme = options.scheme || urnComponents.scheme || "urn"; | |
| 3451 | - const nid = urnComponents.nid.toLowerCase(); | |
| 3713 | + function urnSerialize(urnComponent, options) { | |
| 3714 | + if (urnComponent.nid === void 0) { | |
| 3715 | + throw new Error("URN without nid cannot be serialized"); | |
| 3716 | + } | |
| 3717 | + const scheme = options.scheme || urnComponent.scheme || "urn"; | |
| 3718 | + const nid = urnComponent.nid.toLowerCase(); | |
| 3452 | 3719 | const urnScheme = `${scheme}:${options.nid || nid}`; |
| 3453 | - const schemeHandler = SCHEMES[urnScheme]; | |
| 3720 | + const schemeHandler = getSchemeHandler(urnScheme); | |
| 3454 | 3721 | if (schemeHandler) { |
| 3455 | - urnComponents = schemeHandler.serialize(urnComponents, options); | |
| 3722 | + urnComponent = schemeHandler.serialize(urnComponent, options); | |
| 3456 | 3723 | } |
| 3457 | - const uriComponents = urnComponents; | |
| 3458 | - const nss = urnComponents.nss; | |
| 3459 | - uriComponents.path = `${nid || options.nid}:${nss}`; | |
| 3724 | + const uriComponent = urnComponent; | |
| 3725 | + const nss = urnComponent.nss; | |
| 3726 | + uriComponent.path = `${nid || options.nid}:${nss}`; | |
| 3460 | 3727 | options.skipEscape = true; |
| 3461 | - return uriComponents; | |
| 3728 | + return uriComponent; | |
| 3462 | 3729 | } |
| 3463 | - function urnuuidParse(urnComponents, options) { | |
| 3464 | - const uuidComponents = urnComponents; | |
| 3465 | - uuidComponents.uuid = uuidComponents.nss; | |
| 3466 | - uuidComponents.nss = void 0; | |
| 3467 | - if (!options.tolerant && (!uuidComponents.uuid || !UUID_REG.test(uuidComponents.uuid))) { | |
| 3468 | - uuidComponents.error = uuidComponents.error || "UUID is not valid."; | |
| 3730 | + function urnuuidParse(urnComponent, options) { | |
| 3731 | + const uuidComponent = urnComponent; | |
| 3732 | + uuidComponent.uuid = uuidComponent.nss; | |
| 3733 | + uuidComponent.nss = void 0; | |
| 3734 | + if (!options.tolerant && (!uuidComponent.uuid || !isUUID(uuidComponent.uuid))) { | |
| 3735 | + uuidComponent.error = uuidComponent.error || "UUID is not valid."; | |
| 3469 | 3736 | } |
| 3470 | - return uuidComponents; | |
| 3737 | + return uuidComponent; | |
| 3471 | 3738 | } |
| 3472 | - function urnuuidSerialize(uuidComponents) { | |
| 3473 | - const urnComponents = uuidComponents; | |
| 3474 | - urnComponents.nss = (uuidComponents.uuid || "").toLowerCase(); | |
| 3475 | - return urnComponents; | |
| 3739 | + function urnuuidSerialize(uuidComponent) { | |
| 3740 | + const urnComponent = uuidComponent; | |
| 3741 | + urnComponent.nss = (uuidComponent.uuid || "").toLowerCase(); | |
| 3742 | + return urnComponent; | |
| 3476 | 3743 | } |
| 3477 | - var http = { | |
| 3478 | - scheme: "http", | |
| 3479 | - domainHost: true, | |
| 3480 | - parse: httpParse, | |
| 3481 | - serialize: httpSerialize | |
| 3744 | + var http = ( | |
| 3745 | + /** @type {SchemeHandler} */ | |
| 3746 | + { | |
| 3747 | + scheme: "http", | |
| 3748 | + domainHost: true, | |
| 3749 | + parse: httpParse, | |
| 3750 | + serialize: httpSerialize | |
| 3751 | + } | |
| 3752 | + ); | |
| 3753 | + var https = ( | |
| 3754 | + /** @type {SchemeHandler} */ | |
| 3755 | + { | |
| 3756 | + scheme: "https", | |
| 3757 | + domainHost: http.domainHost, | |
| 3758 | + parse: httpParse, | |
| 3759 | + serialize: httpSerialize | |
| 3760 | + } | |
| 3761 | + ); | |
| 3762 | + var ws = ( | |
| 3763 | + /** @type {SchemeHandler} */ | |
| 3764 | + { | |
| 3765 | + scheme: "ws", | |
| 3766 | + domainHost: true, | |
| 3767 | + parse: wsParse, | |
| 3768 | + serialize: wsSerialize | |
| 3769 | + } | |
| 3770 | + ); | |
| 3771 | + var wss = ( | |
| 3772 | + /** @type {SchemeHandler} */ | |
| 3773 | + { | |
| 3774 | + scheme: "wss", | |
| 3775 | + domainHost: ws.domainHost, | |
| 3776 | + parse: ws.parse, | |
| 3777 | + serialize: ws.serialize | |
| 3778 | + } | |
| 3779 | + ); | |
| 3780 | + var urn = ( | |
| 3781 | + /** @type {SchemeHandler} */ | |
| 3782 | + { | |
| 3783 | + scheme: "urn", | |
| 3784 | + parse: urnParse, | |
| 3785 | + serialize: urnSerialize, | |
| 3786 | + skipNormalize: true | |
| 3787 | + } | |
| 3788 | + ); | |
| 3789 | + var urnuuid = ( | |
| 3790 | + /** @type {SchemeHandler} */ | |
| 3791 | + { | |
| 3792 | + scheme: "urn:uuid", | |
| 3793 | + parse: urnuuidParse, | |
| 3794 | + serialize: urnuuidSerialize, | |
| 3795 | + skipNormalize: true | |
| 3796 | + } | |
| 3797 | + ); | |
| 3798 | + var SCHEMES = ( | |
| 3799 | + /** @type {Record<SchemeName, SchemeHandler>} */ | |
| 3800 | + { | |
| 3801 | + http, | |
| 3802 | + https, | |
| 3803 | + ws, | |
| 3804 | + wss, | |
| 3805 | + urn, | |
| 3806 | + "urn:uuid": urnuuid | |
| 3807 | + } | |
| 3808 | + ); | |
| 3809 | + Object.setPrototypeOf(SCHEMES, null); | |
| 3810 | + function getSchemeHandler(scheme) { | |
| 3811 | + return scheme && (SCHEMES[ | |
| 3812 | + /** @type {SchemeName} */ | |
| 3813 | + scheme | |
| 3814 | + ] || SCHEMES[ | |
| 3815 | + /** @type {SchemeName} */ | |
| 3816 | + scheme.toLowerCase() | |
| 3817 | + ]) || void 0; | |
| 3818 | + } | |
| 3819 | + module.exports = { | |
| 3820 | + wsIsSecure, | |
| 3821 | + SCHEMES, | |
| 3822 | + isValidSchemeName, | |
| 3823 | + getSchemeHandler | |
| 3482 | 3824 | }; |
| 3483 | - var https = { | |
| 3484 | - scheme: "https", | |
| 3485 | - domainHost: http.domainHost, | |
| 3486 | - parse: httpParse, | |
| 3487 | - serialize: httpSerialize | |
| 3488 | - }; | |
| 3489 | - var ws = { | |
| 3490 | - scheme: "ws", | |
| 3491 | - domainHost: true, | |
| 3492 | - parse: wsParse, | |
| 3493 | - serialize: wsSerialize | |
| 3494 | - }; | |
| 3495 | - var wss = { | |
| 3496 | - scheme: "wss", | |
| 3497 | - domainHost: ws.domainHost, | |
| 3498 | - parse: ws.parse, | |
| 3499 | - serialize: ws.serialize | |
| 3500 | - }; | |
| 3501 | - var urn = { | |
| 3502 | - scheme: "urn", | |
| 3503 | - parse: urnParse, | |
| 3504 | - serialize: urnSerialize, | |
| 3505 | - skipNormalize: true | |
| 3506 | - }; | |
| 3507 | - var urnuuid = { | |
| 3508 | - scheme: "urn:uuid", | |
| 3509 | - parse: urnuuidParse, | |
| 3510 | - serialize: urnuuidSerialize, | |
| 3511 | - skipNormalize: true | |
| 3512 | - }; | |
| 3513 | - var SCHEMES = { | |
| 3514 | - http, | |
| 3515 | - https, | |
| 3516 | - ws, | |
| 3517 | - wss, | |
| 3518 | - urn, | |
| 3519 | - "urn:uuid": urnuuid | |
| 3520 | - }; | |
| 3521 | - module.exports = SCHEMES; | |
| 3522 | 3825 | } |
| 3523 | 3826 | }); |
| 3524 | 3827 | |
| 3525 | 3828 | // node_modules/fast-uri/index.js |
| @@ -3525,24 +3828,63 @@ | ||
| 3525 | 3828 | // node_modules/fast-uri/index.js |
| 3526 | 3829 | var require_fast_uri = __commonJS({ |
| 3527 | 3830 | "node_modules/fast-uri/index.js"(exports, module) { |
| 3528 | 3831 | "use strict"; |
| 3529 | - var { normalizeIPv6, normalizeIPv4, removeDotSegments, recomposeAuthority, normalizeComponentEncoding } = require_utils(); | |
| 3530 | - var SCHEMES = require_schemes(); | |
| 3832 | + var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils(); | |
| 3833 | + var { SCHEMES, getSchemeHandler } = require_schemes(); | |
| 3834 | + var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u; | |
| 3835 | + var MALFORMED_SCHEME_ERROR = "URI scheme is malformed."; | |
| 3836 | + function decodeValidScheme(scheme) { | |
| 3837 | + const decodedScheme = unescape(String(scheme)); | |
| 3838 | + if (!VALID_SCHEME.test(decodedScheme)) { | |
| 3839 | + throw new TypeError(MALFORMED_SCHEME_ERROR); | |
| 3840 | + } | |
| 3841 | + return decodedScheme; | |
| 3842 | + } | |
| 3531 | 3843 | function normalize(uri, options) { |
| 3532 | 3844 | if (typeof uri === "string") { |
| 3533 | - uri = serialize(parse(uri, options), options); | |
| 3845 | + uri = /** @type {T} */ | |
| 3846 | + normalizeString(uri, options); | |
| 3534 | 3847 | } else if (typeof uri === "object") { |
| 3535 | - uri = parse(serialize(uri, options), options); | |
| 3848 | + uri = /** @type {T} */ | |
| 3849 | + parse(serialize(uri, options), options); | |
| 3536 | 3850 | } |
| 3537 | 3851 | return uri; |
| 3538 | 3852 | } |
| 3539 | 3853 | function resolve(baseURI, relativeURI, options) { |
| 3540 | - const schemelessOptions = Object.assign({ scheme: "null" }, options); | |
| 3541 | - const resolved = resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true); | |
| 3542 | - return serialize(resolved, { ...schemelessOptions, skipEscape: true }); | |
| 3854 | + const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" }; | |
| 3855 | + const { | |
| 3856 | + parsed: baseParsed, | |
| 3857 | + malformedAuthorityOrPort: baseMalformed, | |
| 3858 | + malformedPercentEncoding: baseMalformedPercentEncoding, | |
| 3859 | + malformedSchemeSpecific: baseMalformedSchemeSpecific, | |
| 3860 | + malformedHost: baseMalformedHost, | |
| 3861 | + malformedScheme: baseMalformedScheme | |
| 3862 | + } = parseWithStatus(baseURI, schemelessOptions); | |
| 3863 | + const { | |
| 3864 | + parsed: relativeParsed, | |
| 3865 | + malformedAuthorityOrPort: relativeMalformed, | |
| 3866 | + malformedPercentEncoding: relativeMalformedPercentEncoding, | |
| 3867 | + malformedSchemeSpecific: relativeMalformedSchemeSpecific, | |
| 3868 | + malformedHost: relativeMalformedHost, | |
| 3869 | + malformedScheme: relativeMalformedScheme | |
| 3870 | + } = parseWithStatus(relativeURI, schemelessOptions); | |
| 3871 | + if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) { | |
| 3872 | + throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed."); | |
| 3873 | + } | |
| 3874 | + const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true); | |
| 3875 | + const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme); | |
| 3876 | + const resolvedHost = resolved.host; | |
| 3877 | + const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6); | |
| 3878 | + canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP); | |
| 3879 | + const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost); | |
| 3880 | + if (resolved.error && !encodedASCIIHost) { | |
| 3881 | + throw new Error(resolved.error); | |
| 3882 | + } | |
| 3883 | + schemelessOptions.skipEscape = true; | |
| 3884 | + return serialize(resolved, schemelessOptions); | |
| 3543 | 3885 | } |
| 3544 | - function resolveComponents(base, relative, options, skipNormalization) { | |
| 3886 | + function resolveComponent(base, relative, options, skipNormalization) { | |
| 3545 | 3887 | const target = {}; |
| 3546 | 3888 | if (!skipNormalization) { |
| 3547 | 3889 | base = parse(serialize(base, options), options); |
| 3548 | 3890 | relative = parse(serialize(relative, options), options); |
| @@ -3570,9 +3912,9 @@ | ||
| 3570 | 3912 | } else { |
| 3571 | 3913 | target.query = base.query; |
| 3572 | 3914 | } |
| 3573 | 3915 | } else { |
| 3574 | - if (relative.path.charAt(0) === "/") { | |
| 3916 | + if (relative.path[0] === "/") { | |
| 3575 | 3917 | target.path = removeDotSegments(relative.path); |
| 3576 | 3918 | } else { |
| 3577 | 3919 | if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) { |
| 3578 | 3920 | target.path = "/" + relative.path; |
| @@ -3594,24 +3936,14 @@ | ||
| 3594 | 3936 | target.fragment = relative.fragment; |
| 3595 | 3937 | return target; |
| 3596 | 3938 | } |
| 3597 | 3939 | function equal(uriA, uriB, options) { |
| 3598 | - if (typeof uriA === "string") { | |
| 3599 | - uriA = unescape(uriA); | |
| 3600 | - uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true }); | |
| 3601 | - } else if (typeof uriA === "object") { | |
| 3602 | - uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true }); | |
| 3603 | - } | |
| 3604 | - if (typeof uriB === "string") { | |
| 3605 | - uriB = unescape(uriB); | |
| 3606 | - uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true }); | |
| 3607 | - } else if (typeof uriB === "object") { | |
| 3608 | - uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true }); | |
| 3609 | - } | |
| 3610 | - return uriA.toLowerCase() === uriB.toLowerCase(); | |
| 3940 | + const normalizedA = normalizeComparableURI(uriA, options); | |
| 3941 | + const normalizedB = normalizeComparableURI(uriB, options); | |
| 3942 | + return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA === normalizedB; | |
| 3611 | 3943 | } |
| 3612 | 3944 | function serialize(cmpts, opts) { |
| 3613 | - const components = { | |
| 3945 | + const component = { | |
| 3614 | 3946 | host: cmpts.host, |
| 3615 | 3947 | scheme: cmpts.scheme, |
| 3616 | 3948 | userinfo: cmpts.userinfo, |
| 3617 | 3949 | port: cmpts.port, |
| @@ -3627,67 +3959,99 @@ | ||
| 3627 | 3959 | error: "" |
| 3628 | 3960 | }; |
| 3629 | 3961 | const options = Object.assign({}, opts); |
| 3630 | 3962 | const uriTokens = []; |
| 3631 | - const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()]; | |
| 3632 | - if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options); | |
| 3633 | - if (components.path !== void 0) { | |
| 3963 | + if (component.scheme) { | |
| 3964 | + component.scheme = decodeValidScheme(component.scheme); | |
| 3965 | + } | |
| 3966 | + const schemeHandler = getSchemeHandler(options.scheme || component.scheme); | |
| 3967 | + if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options); | |
| 3968 | + const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0; | |
| 3969 | + const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority; | |
| 3970 | + if (component.path !== void 0) { | |
| 3634 | 3971 | if (!options.skipEscape) { |
| 3635 | - components.path = escape(components.path); | |
| 3636 | - if (components.scheme !== void 0) { | |
| 3637 | - components.path = components.path.split("%3A").join(":"); | |
| 3638 | - } | |
| 3972 | + component.path = serializePathEncoding(component.path, pathNoScheme); | |
| 3639 | 3973 | } else { |
| 3640 | - components.path = unescape(components.path); | |
| 3974 | + component.path = normalizePercentEncoding(component.path); | |
| 3641 | 3975 | } |
| 3642 | 3976 | } |
| 3643 | - if (options.reference !== "suffix" && components.scheme) { | |
| 3644 | - uriTokens.push(components.scheme); | |
| 3645 | - uriTokens.push(":"); | |
| 3977 | + if (options.reference !== "suffix" && component.scheme) { | |
| 3978 | + component.scheme = decodeValidScheme(component.scheme); | |
| 3979 | + uriTokens.push(component.scheme, ":"); | |
| 3646 | 3980 | } |
| 3647 | - const authority = recomposeAuthority(components, options); | |
| 3981 | + const authority = recomposeAuthority(component); | |
| 3648 | 3982 | if (authority !== void 0) { |
| 3649 | 3983 | if (options.reference !== "suffix") { |
| 3650 | 3984 | uriTokens.push("//"); |
| 3651 | 3985 | } |
| 3652 | 3986 | uriTokens.push(authority); |
| 3653 | - if (components.path && components.path.charAt(0) !== "/") { | |
| 3987 | + if (component.path && component.path[0] !== "/") { | |
| 3654 | 3988 | uriTokens.push("/"); |
| 3655 | 3989 | } |
| 3656 | 3990 | } |
| 3657 | - if (components.path !== void 0) { | |
| 3658 | - let s = components.path; | |
| 3991 | + if (component.path !== void 0) { | |
| 3992 | + let s = component.path; | |
| 3659 | 3993 | if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) { |
| 3660 | 3994 | s = removeDotSegments(s); |
| 3661 | 3995 | } |
| 3662 | - if (authority === void 0) { | |
| 3663 | - s = s.replace(/^\/\//u, "/%2F"); | |
| 3996 | + if (pathNoScheme) { | |
| 3997 | + s = serializePathEncoding(s, true); | |
| 3664 | 3998 | } |
| 3999 | + if (authority === void 0 && s[0] === "/" && s[1] === "/") { | |
| 4000 | + s = "/%2F" + s.slice(2); | |
| 4001 | + } | |
| 3665 | 4002 | uriTokens.push(s); |
| 3666 | 4003 | } |
| 3667 | - if (components.query !== void 0) { | |
| 3668 | - uriTokens.push("?"); | |
| 3669 | - uriTokens.push(components.query); | |
| 4004 | + if (component.query !== void 0) { | |
| 4005 | + uriTokens.push("?", encodeQuery(component.query)); | |
| 3670 | 4006 | } |
| 3671 | - if (components.fragment !== void 0) { | |
| 3672 | - uriTokens.push("#"); | |
| 3673 | - uriTokens.push(components.fragment); | |
| 4007 | + if (component.fragment !== void 0) { | |
| 4008 | + uriTokens.push("#", encodeFragment(component.fragment)); | |
| 3674 | 4009 | } |
| 3675 | 4010 | return uriTokens.join(""); |
| 3676 | 4011 | } |
| 3677 | - var hexLookUp = Array.from({ length: 127 }, (v, k) => /[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(k))); | |
| 3678 | - function nonSimpleDomain(value) { | |
| 3679 | - let code = 0; | |
| 3680 | - for (let i = 0, len = value.length; i < len; ++i) { | |
| 3681 | - code = value.charCodeAt(i); | |
| 3682 | - if (code > 126 || hexLookUp[code]) { | |
| 4012 | + var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u; | |
| 4013 | + var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/; | |
| 4014 | + var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/; | |
| 4015 | + function getParseError(parsed, matches) { | |
| 4016 | + if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") { | |
| 4017 | + return 'URI path must start with "/" when authority is present.'; | |
| 4018 | + } | |
| 4019 | + if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) { | |
| 4020 | + return "URI port is malformed."; | |
| 4021 | + } | |
| 4022 | + return void 0; | |
| 4023 | + } | |
| 4024 | + function hasMalformedPercentEncoding(component) { | |
| 4025 | + if (component === void 0) return false; | |
| 4026 | + let percent = component.indexOf("%"); | |
| 4027 | + while (percent !== -1) { | |
| 4028 | + if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) { | |
| 3683 | 4029 | return true; |
| 3684 | 4030 | } |
| 4031 | + percent = component.indexOf("%", percent + 3); | |
| 3685 | 4032 | } |
| 3686 | 4033 | return false; |
| 3687 | 4034 | } |
| 3688 | - var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u; | |
| 3689 | - function parse(uri, opts) { | |
| 4035 | + function isIPLiteral(host) { | |
| 4036 | + return host[0] === "[" && host[host.length - 1] === "]"; | |
| 4037 | + } | |
| 4038 | + function hasMalformedComponentPercentEncoding(matches) { | |
| 4039 | + const host = matches[4]; | |
| 4040 | + return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]); | |
| 4041 | + } | |
| 4042 | + function canonicalizeHost(parsed, options, schemeHandler, isIP) { | |
| 4043 | + if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) { | |
| 4044 | + try { | |
| 4045 | + parsed.host = new URL("http://" + parsed.host).hostname; | |
| 4046 | + } catch (e) { | |
| 4047 | + parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e; | |
| 4048 | + return true; | |
| 4049 | + } | |
| 4050 | + } | |
| 4051 | + return false; | |
| 4052 | + } | |
| 4053 | + function parseWithStatus(uri, opts) { | |
| 3690 | 4054 | const options = Object.assign({}, opts); |
| 3691 | 4055 | const parsed = { |
| 3692 | 4056 | scheme: void 0, |
| 3693 | 4057 | userinfo: void 0, |
| @@ -3696,11 +4060,41 @@ | ||
| 3696 | 4060 | path: "", |
| 3697 | 4061 | query: void 0, |
| 3698 | 4062 | fragment: void 0 |
| 3699 | 4063 | }; |
| 3700 | - const gotEncoding = uri.indexOf("%") !== -1; | |
| 4064 | + let malformedAuthorityOrPort = false; | |
| 4065 | + let malformedPercentEncoding = false; | |
| 4066 | + let malformedSchemeSpecific = false; | |
| 4067 | + let malformedHost = false; | |
| 4068 | + let malformedIPLiteral = false; | |
| 4069 | + let malformedScheme = false; | |
| 3701 | 4070 | let isIP = false; |
| 3702 | - if (options.reference === "suffix") uri = (options.scheme ? options.scheme + ":" : "") + "//" + uri; | |
| 4071 | + if (options.reference === "suffix") { | |
| 4072 | + if (options.scheme) { | |
| 4073 | + uri = options.scheme + ":" + uri; | |
| 4074 | + } else { | |
| 4075 | + uri = "//" + uri; | |
| 4076 | + } | |
| 4077 | + } | |
| 4078 | + const authorityMatch = uri.match(AUTHORITY_PREFIX); | |
| 4079 | + if (authorityMatch !== null && authorityMatch[1].indexOf("\\") !== -1) { | |
| 4080 | + parsed.error = "URI authority must not contain a literal backslash."; | |
| 4081 | + malformedAuthorityOrPort = true; | |
| 4082 | + } | |
| 4083 | + const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION); | |
| 4084 | + if (introducerMatch !== null) { | |
| 4085 | + const region = introducerMatch[1]; | |
| 4086 | + const normalizedRegion = region.replace(/[\t\n\r]/g, ""); | |
| 4087 | + if (normalizedRegion.length >= 2) { | |
| 4088 | + if (normalizedRegion.slice(0, 2) !== "//") { | |
| 4089 | + parsed.error = parsed.error || "URI authority must not contain a literal backslash."; | |
| 4090 | + malformedAuthorityOrPort = true; | |
| 4091 | + } else if (region.length !== normalizedRegion.length) { | |
| 4092 | + parsed.error = parsed.error || "URI authority introducer must not contain whitespace."; | |
| 4093 | + malformedAuthorityOrPort = true; | |
| 4094 | + } | |
| 4095 | + } | |
| 4096 | + } | |
| 3703 | 4097 | const matches = uri.match(URI_PARSE); |
| 3704 | 4098 | if (matches) { |
| 3705 | 4099 | parsed.scheme = matches[1]; |
| 3706 | 4100 | parsed.userinfo = matches[3]; |
| @@ -3708,23 +4102,47 @@ | ||
| 3708 | 4102 | parsed.port = parseInt(matches[5], 10); |
| 3709 | 4103 | parsed.path = matches[6] || ""; |
| 3710 | 4104 | parsed.query = matches[7]; |
| 3711 | 4105 | parsed.fragment = matches[8]; |
| 4106 | + if (parsed.scheme !== void 0) { | |
| 4107 | + const decodedScheme = unescape(parsed.scheme); | |
| 4108 | + if (VALID_SCHEME.test(decodedScheme)) { | |
| 4109 | + parsed.scheme = decodedScheme.toLowerCase(); | |
| 4110 | + } else { | |
| 4111 | + parsed.error = parsed.error || MALFORMED_SCHEME_ERROR; | |
| 4112 | + malformedScheme = true; | |
| 4113 | + } | |
| 4114 | + } | |
| 4115 | + malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches); | |
| 4116 | + if (malformedPercentEncoding) { | |
| 4117 | + parsed.error = parsed.error || "URI contains malformed percent-encoding."; | |
| 4118 | + } | |
| 3712 | 4119 | if (isNaN(parsed.port)) { |
| 3713 | 4120 | parsed.port = matches[5]; |
| 3714 | 4121 | } |
| 4122 | + const parseError = getParseError(parsed, matches); | |
| 4123 | + if (parseError !== void 0) { | |
| 4124 | + parsed.error = parsed.error || parseError; | |
| 4125 | + malformedAuthorityOrPort = true; | |
| 4126 | + } | |
| 3715 | 4127 | if (parsed.host) { |
| 3716 | - const ipv4result = normalizeIPv4(parsed.host); | |
| 3717 | - if (ipv4result.isIPV4 === false) { | |
| 3718 | - const ipv6result = normalizeIPv6(ipv4result.host, { isIPV4: false }); | |
| 3719 | - parsed.host = ipv6result.host.toLowerCase(); | |
| 3720 | - isIP = ipv6result.isIPV6; | |
| 4128 | + const ipv4result = isIPv4(parsed.host); | |
| 4129 | + if (ipv4result === false) { | |
| 4130 | + const bracketedIPLiteral = isIPLiteral(parsed.host); | |
| 4131 | + const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1; | |
| 4132 | + const ipv6result = normalizeIPv6(parsed.host); | |
| 4133 | + isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true; | |
| 4134 | + malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true); | |
| 4135 | + parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase(); | |
| 4136 | + if (malformedIPLiteral) { | |
| 4137 | + parsed.error = parsed.error || "URI host is malformed."; | |
| 4138 | + malformedAuthorityOrPort = true; | |
| 4139 | + } | |
| 3721 | 4140 | } else { |
| 3722 | - parsed.host = ipv4result.host; | |
| 3723 | 4141 | isIP = true; |
| 3724 | 4142 | } |
| 3725 | 4143 | } |
| 3726 | - if (parsed.scheme === void 0 && parsed.userinfo === void 0 && parsed.host === void 0 && parsed.port === void 0 && !parsed.path && parsed.query === void 0) { | |
| 4144 | + if (parsed.scheme === void 0 && parsed.userinfo === void 0 && parsed.host === void 0 && parsed.port === void 0 && parsed.query === void 0 && !parsed.path) { | |
| 3727 | 4145 | parsed.reference = "same-document"; |
| 3728 | 4146 | } else if (parsed.scheme === void 0) { |
| 3729 | 4147 | parsed.reference = "relative"; |
| 3730 | 4148 | } else if (parsed.fragment === void 0) { |
| @@ -3734,48 +4152,75 @@ | ||
| 3734 | 4152 | } |
| 3735 | 4153 | if (options.reference && options.reference !== "suffix" && options.reference !== parsed.reference) { |
| 3736 | 4154 | parsed.error = parsed.error || "URI is not a " + options.reference + " reference."; |
| 3737 | 4155 | } |
| 3738 | - const schemeHandler = SCHEMES[(options.scheme || parsed.scheme || "").toLowerCase()]; | |
| 3739 | - if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) { | |
| 3740 | - if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) { | |
| 3741 | - try { | |
| 3742 | - parsed.host = URL.domainToASCII(parsed.host.toLowerCase()); | |
| 3743 | - } catch (e) { | |
| 3744 | - parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e; | |
| 3745 | - } | |
| 3746 | - } | |
| 4156 | + const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme); | |
| 4157 | + if (!malformedIPLiteral) { | |
| 4158 | + malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP); | |
| 3747 | 4159 | } |
| 3748 | 4160 | if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) { |
| 3749 | - if (gotEncoding && parsed.scheme !== void 0) { | |
| 3750 | - parsed.scheme = unescape(parsed.scheme); | |
| 4161 | + if (uri.indexOf("%") !== -1) { | |
| 4162 | + if (parsed.host !== void 0 && !malformedIPLiteral) { | |
| 4163 | + const host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true); | |
| 4164 | + parsed.host = reescapeHostDelimiters(host, isIP); | |
| 4165 | + } | |
| 3751 | 4166 | } |
| 3752 | - if (gotEncoding && parsed.userinfo !== void 0) { | |
| 3753 | - parsed.userinfo = unescape(parsed.userinfo); | |
| 4167 | + if (parsed.path) { | |
| 4168 | + parsed.path = normalizePathEncoding(parsed.path); | |
| 3754 | 4169 | } |
| 3755 | - if (gotEncoding && parsed.host !== void 0) { | |
| 3756 | - parsed.host = unescape(parsed.host); | |
| 4170 | + if (parsed.query) { | |
| 4171 | + parsed.query = normalizeQueryFragmentEncoding(parsed.query); | |
| 3757 | 4172 | } |
| 3758 | - if (parsed.path !== void 0 && parsed.path.length) { | |
| 3759 | - parsed.path = escape(unescape(parsed.path)); | |
| 4173 | + if (parsed.fragment) { | |
| 4174 | + parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment); | |
| 3760 | 4175 | } |
| 3761 | - if (parsed.fragment !== void 0 && parsed.fragment.length) { | |
| 3762 | - parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment)); | |
| 3763 | - } | |
| 3764 | 4176 | } |
| 3765 | 4177 | if (schemeHandler && schemeHandler.parse) { |
| 3766 | 4178 | schemeHandler.parse(parsed, options); |
| 4179 | + if (schemeHandler === SCHEMES.urn && parsed.nid === void 0) { | |
| 4180 | + malformedSchemeSpecific = true; | |
| 4181 | + } | |
| 3767 | 4182 | } |
| 3768 | 4183 | } else { |
| 3769 | 4184 | parsed.error = parsed.error || "URI can not be parsed."; |
| 3770 | 4185 | } |
| 3771 | - return parsed; | |
| 4186 | + return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme }; | |
| 3772 | 4187 | } |
| 4188 | + function parse(uri, opts) { | |
| 4189 | + return parseWithStatus(uri, opts).parsed; | |
| 4190 | + } | |
| 4191 | + function normalizeString(uri, opts) { | |
| 4192 | + return normalizeStringWithStatus(uri, opts).normalized; | |
| 4193 | + } | |
| 4194 | + function normalizeStringWithStatus(uri, opts) { | |
| 4195 | + const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts); | |
| 4196 | + return { | |
| 4197 | + normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts), | |
| 4198 | + malformedAuthorityOrPort, | |
| 4199 | + malformedPercentEncoding, | |
| 4200 | + malformedSchemeSpecific, | |
| 4201 | + malformedHost, | |
| 4202 | + malformedScheme | |
| 4203 | + }; | |
| 4204 | + } | |
| 4205 | + function normalizeComparableURI(uri, opts) { | |
| 4206 | + if (typeof uri !== "string" && typeof uri !== "object") { | |
| 4207 | + return void 0; | |
| 4208 | + } | |
| 4209 | + let value; | |
| 4210 | + try { | |
| 4211 | + value = typeof uri === "string" ? uri : serialize(uri, opts); | |
| 4212 | + } catch { | |
| 4213 | + return void 0; | |
| 4214 | + } | |
| 4215 | + const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts); | |
| 4216 | + return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized; | |
| 4217 | + } | |
| 3773 | 4218 | var fastUri = { |
| 3774 | 4219 | SCHEMES, |
| 3775 | 4220 | normalize, |
| 3776 | 4221 | resolve, |
| 3777 | - resolveComponents, | |
| 4222 | + resolveComponent, | |
| 3778 | 4223 | equal, |
| 3779 | 4224 | serialize, |
| 3780 | 4225 | parse |
| 3781 | 4226 | }; |
| @@ -3907,9 +4352,9 @@ | ||
| 3907 | 4352 | var Ajv2 = class { |
| 3908 | 4353 | constructor(opts = {}) { |
| 3909 | 4354 | this.schemas = {}; |
| 3910 | 4355 | this.refs = {}; |
| 3911 | - this.formats = {}; | |
| 4356 | + this.formats = /* @__PURE__ */ Object.create(null); | |
| 3912 | 4357 | this._compilations = /* @__PURE__ */ new Set(); |
| 3913 | 4358 | this._loading = {}; |
| 3914 | 4359 | this._cache = /* @__PURE__ */ new Map(); |
| 3915 | 4360 | opts = this.opts = { ...opts, ...requiredOptions(opts) }; |
| @@ -4711,8 +5156,9 @@ | ||
| 4711 | 5156 | "node_modules/ajv/dist/vocabularies/validation/pattern.js"(exports) { |
| 4712 | 5157 | "use strict"; |
| 4713 | 5158 | Object.defineProperty(exports, "__esModule", { value: true }); |
| 4714 | 5159 | var code_1 = require_code2(); |
| 5160 | + var util_1 = require_util(); | |
| 4715 | 5161 | var codegen_1 = require_codegen(); |
| 4716 | 5162 | var error = { |
| 4717 | 5163 | message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`, |
| 4718 | 5164 | params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}` |
| @@ -4723,12 +5169,20 @@ | ||
| 4723 | 5169 | schemaType: "string", |
| 4724 | 5170 | $data: true, |
| 4725 | 5171 | error, |
| 4726 | 5172 | code(cxt) { |
| 4727 | - const { data, $data, schema, schemaCode, it } = cxt; | |
| 5173 | + const { gen, data, $data, schema, schemaCode, it } = cxt; | |
| 4728 | 5174 | const u = it.opts.unicodeRegExp ? "u" : ""; |
| 4729 | - const regExp = $data ? (0, codegen_1._)`(new RegExp(${schemaCode}, ${u}))` : (0, code_1.usePattern)(cxt, schema); | |
| 4730 | - cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`); | |
| 5175 | + if ($data) { | |
| 5176 | + const { regExp } = it.opts.code; | |
| 5177 | + const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp); | |
| 5178 | + const valid = gen.let("valid"); | |
| 5179 | + gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false)); | |
| 5180 | + cxt.fail$data((0, codegen_1._)`!${valid}`); | |
| 5181 | + } else { | |
| 5182 | + const regExp = (0, code_1.usePattern)(cxt, schema); | |
| 5183 | + cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`); | |
| 5184 | + } | |
| 4731 | 5185 | } |
| 4732 | 5186 | }; |
| 4733 | 5187 | exports.default = def; |
| 4734 | 5188 | } |
| @@ -6419,11 +6873,11 @@ | ||
| 6419 | 6873 | } }); |
| 6420 | 6874 | } |
| 6421 | 6875 | }); |
| 6422 | 6876 | |
| 6423 | -// packages/abilities/node_modules/ajv-formats/dist/formats.js | |
| 6877 | +// node_modules/ajv-formats/dist/formats.js | |
| 6424 | 6878 | var require_formats = __commonJS({ |
| 6425 | - "packages/abilities/node_modules/ajv-formats/dist/formats.js"(exports) { | |
| 6879 | + "node_modules/ajv-formats/dist/formats.js"(exports) { | |
| 6426 | 6880 | "use strict"; |
| 6427 | 6881 | Object.defineProperty(exports, "__esModule", { value: true }); |
| 6428 | 6882 | exports.formatNames = exports.fastFormats = exports.fullFormats = void 0; |
| 6429 | 6883 | function fmtDef(validate, compare) { |
| @@ -7000,11 +7454,11 @@ | ||
| 7000 | 7454 | } }); |
| 7001 | 7455 | } |
| 7002 | 7456 | }); |
| 7003 | 7457 | |
| 7004 | -// packages/abilities/node_modules/ajv-formats/dist/limit.js | |
| 7458 | +// node_modules/ajv-formats/dist/limit.js | |
| 7005 | 7459 | var require_limit = __commonJS({ |
| 7006 | - "packages/abilities/node_modules/ajv-formats/dist/limit.js"(exports) { | |
| 7460 | + "node_modules/ajv-formats/dist/limit.js"(exports) { | |
| 7007 | 7461 | "use strict"; |
| 7008 | 7462 | Object.defineProperty(exports, "__esModule", { value: true }); |
| 7009 | 7463 | exports.formatLimitDefinition = void 0; |
| 7010 | 7464 | var ajv_1 = require_ajv(); |
| @@ -7072,11 +7526,11 @@ | ||
| 7072 | 7526 | exports.default = formatLimitPlugin; |
| 7073 | 7527 | } |
| 7074 | 7528 | }); |
| 7075 | 7529 | |
| 7076 | -// packages/abilities/node_modules/ajv-formats/dist/index.js | |
| 7530 | +// node_modules/ajv-formats/dist/index.js | |
| 7077 | 7531 | var require_dist2 = __commonJS({ |
| 7078 | - "packages/abilities/node_modules/ajv-formats/dist/index.js"(exports, module) { | |
| 7532 | + "node_modules/ajv-formats/dist/index.js"(exports, module) { | |
| 7079 | 7533 | "use strict"; |
| 7080 | 7534 | Object.defineProperty(exports, "__esModule", { value: true }); |
| 7081 | 7535 | var formats_1 = require_formats(); |
| 7082 | 7536 | var limit_1 = require_limit(); |
| @@ -7443,9 +7897,17 @@ | ||
| 7443 | 7897 | verbose: true, |
| 7444 | 7898 | allowUnionTypes: true |
| 7445 | 7899 | // Allow anyOf without explicit type |
| 7446 | 7900 | }); |
| 7447 | -(0, import_ajv_formats.default)(ajv, ["date-time", "email", "hostname", "ipv4", "ipv6", "uuid"]); | |
| 7901 | +(0, import_ajv_formats.default)(ajv, [ | |
| 7902 | + "date-time", | |
| 7903 | + "email", | |
| 7904 | + "hostname", | |
| 7905 | + "ipv4", | |
| 7906 | + "ipv6", | |
| 7907 | + "uri", | |
| 7908 | + "uuid" | |
| 7909 | +]); | |
| 7448 | 7910 | function formatAjvError(ajvError, param) { |
| 7449 | 7911 | const instancePath = ajvError.instancePath ? ajvError.instancePath.replace(/\//g, "][").replace(/^\]\[/, "[") + "]" : ""; |
| 7450 | 7912 | const fullParam = param + instancePath; |
| 7451 | 7913 | switch (ajvError.keyword) { |
| @@ -7469,9 +7931,10 @@ | ||
| 7469 | 7931 | "date-time": "Invalid date.", |
| 7470 | 7932 | uuid: `${fullParam} is not a valid UUID.`, |
| 7471 | 7933 | ipv4: `${fullParam} is not a valid IP address.`, |
| 7472 | 7934 | ipv6: `${fullParam} is not a valid IP address.`, |
| 7473 | - hostname: `${fullParam} is not a valid hostname.` | |
| 7935 | + hostname: `${fullParam} is not a valid hostname.`, | |
| 7936 | + uri: `${fullParam} is not a valid URI.` | |
| 7474 | 7937 | }; |
| 7475 | 7938 | return formatMessages[format] || `Invalid ${format}.`; |
| 7476 | 7939 | case "minimum": |
| 7477 | 7940 | case "exclusiveMinimum": |