| @@ -3111,58 +3111,69 @@ | ||
| 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 | + | |
| 3115 | 3149 | // node_modules/fast-uri/lib/utils.js |
| 3116 | 3150 | var require_utils = __commonJS({ |
| 3117 | 3151 | "node_modules/fast-uri/lib/utils.js"(exports, module) { |
| 3118 | 3152 | "use strict"; |
| 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 isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu); | |
| 3122 | - var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu); | |
| 3123 | - var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu); | |
| 3124 | - function stringArrayToHexStripped(input) { | |
| 3125 | - let acc = ""; | |
| 3126 | - let code = 0; | |
| 3127 | - let i = 0; | |
| 3128 | - for (i = 0; i < input.length; i++) { | |
| 3129 | - code = input[i].charCodeAt(0); | |
| 3130 | - if (code === 48) { | |
| 3131 | - continue; | |
| 3132 | - } | |
| 3133 | - if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) { | |
| 3134 | - return ""; | |
| 3135 | - } | |
| 3136 | - acc += input[i]; | |
| 3137 | - break; | |
| 3153 | + var { HEX } = require_scopedChars(); | |
| 3154 | + function normalizeIPv4(host) { | |
| 3155 | + if (findToken(host, ".") < 3) { | |
| 3156 | + return { host, isIPV4: false }; | |
| 3138 | 3157 | } |
| 3139 | - for (i += 1; i < input.length; i++) { | |
| 3140 | - code = input[i].charCodeAt(0); | |
| 3141 | - if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) { | |
| 3142 | - return ""; | |
| 3143 | - } | |
| 3144 | - acc += input[i]; | |
| 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 }; | |
| 3145 | 3164 | } |
| 3146 | - return acc; | |
| 3147 | 3165 | } |
| 3148 | - var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u); | |
| 3149 | - function consumeIsZone(buffer) { | |
| 3150 | - buffer.length = 0; | |
| 3151 | - return true; | |
| 3152 | - } | |
| 3153 | - function consumeHextets(buffer, address, output) { | |
| 3154 | - if (buffer.length) { | |
| 3155 | - const hex = stringArrayToHexStripped(buffer); | |
| 3156 | - if (hex !== "") { | |
| 3157 | - address.push(hex); | |
| 3158 | - } else { | |
| 3159 | - output.error = true; | |
| 3160 | - return false; | |
| 3161 | - } | |
| 3162 | - buffer.length = 0; | |
| 3166 | + function stringArrayToHexStripped(input, keepZero = false) { | |
| 3167 | + 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; | |
| 3163 | 3173 | } |
| 3164 | - return true; | |
| 3174 | + if (keepZero && acc.length === 0) acc = "0"; | |
| 3175 | + return acc; | |
| 3165 | 3176 | } |
| 3166 | 3177 | function getIPV6(input) { |
| 3167 | 3178 | let tokenCount = 0; |
| 3168 | 3179 | const output = { error: false, address: "", zone: "" }; |
| @@ -3167,11 +3178,26 @@ | ||
| 3167 | 3178 | let tokenCount = 0; |
| 3168 | 3179 | const output = { error: false, address: "", zone: "" }; |
| 3169 | 3180 | const address = []; |
| 3170 | 3181 | const buffer = []; |
| 3182 | + let isZone = false; | |
| 3171 | 3183 | let endipv6Encountered = false; |
| 3172 | 3184 | let endIpv6 = false; |
| 3173 | - let consume = consumeHextets; | |
| 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 | + } | |
| 3195 | + } | |
| 3196 | + buffer.length = 0; | |
| 3197 | + } | |
| 3198 | + return true; | |
| 3199 | + } | |
| 3174 | 3200 | for (let i = 0; i < input.length; i++) { |
| 3175 | 3201 | const cursor = input[i]; |
| 3176 | 3202 | if (cursor === "[" || cursor === "]") { |
| 3177 | 3203 | continue; |
| @@ -3179,25 +3205,26 @@ | ||
| 3179 | 3205 | if (cursor === ":") { |
| 3180 | 3206 | if (endipv6Encountered === true) { |
| 3181 | 3207 | endIpv6 = true; |
| 3182 | 3208 | } |
| 3183 | - if (!consume(buffer, address, output)) { | |
| 3209 | + if (!consume()) { | |
| 3184 | 3210 | break; |
| 3185 | 3211 | } |
| 3186 | - if (++tokenCount > 7) { | |
| 3212 | + tokenCount++; | |
| 3213 | + address.push(":"); | |
| 3214 | + if (tokenCount > 7) { | |
| 3187 | 3215 | output.error = true; |
| 3188 | 3216 | break; |
| 3189 | 3217 | } |
| 3190 | - if (i > 0 && input[i - 1] === ":") { | |
| 3218 | + if (i - 1 >= 0 && input[i - 1] === ":") { | |
| 3191 | 3219 | endipv6Encountered = true; |
| 3192 | 3220 | } |
| 3193 | - address.push(":"); | |
| 3194 | 3221 | continue; |
| 3195 | 3222 | } else if (cursor === "%") { |
| 3196 | - if (!consume(buffer, address, output)) { | |
| 3223 | + if (!consume()) { | |
| 3197 | 3224 | break; |
| 3198 | 3225 | } |
| 3199 | - consume = consumeIsZone; | |
| 3226 | + isZone = true; | |
| 3200 | 3227 | } else { |
| 3201 | 3228 | buffer.push(cursor); |
| 3202 | 3229 | continue; |
| 3203 | 3230 | } |
| @@ -3202,9 +3229,9 @@ | ||
| 3202 | 3229 | continue; |
| 3203 | 3230 | } |
| 3204 | 3231 | } |
| 3205 | 3232 | if (buffer.length) { |
| 3206 | - if (consume === consumeIsZone) { | |
| 3233 | + if (isZone) { | |
| 3207 | 3234 | output.zone = buffer.join(""); |
| 3208 | 3235 | } else if (endIpv6) { |
| 3209 | 3236 | address.push(buffer.join("")); |
| 3210 | 3237 | } else { |
| @@ -3213,9 +3240,9 @@ | ||
| 3213 | 3240 | } |
| 3214 | 3241 | output.address = address.join(""); |
| 3215 | 3242 | return output; |
| 3216 | 3243 | } |
| 3217 | - function normalizeIPv6(host) { | |
| 3244 | + function normalizeIPv6(host, opts = {}) { | |
| 3218 | 3245 | if (findToken(host, ":") < 2) { |
| 3219 | 3246 | return { host, isIPV6: false }; |
| 3220 | 3247 | } |
| 3221 | 3248 | const ipv6 = getIPV6(host); |
| @@ -3225,13 +3252,35 @@ | ||
| 3225 | 3252 | if (ipv6.zone) { |
| 3226 | 3253 | newHost += "%" + ipv6.zone; |
| 3227 | 3254 | escapedHost += "%25" + ipv6.zone; |
| 3228 | 3255 | } |
| 3229 | - return { host: newHost, isIPV6: true, escapedHost }; | |
| 3256 | + return { host: newHost, escapedHost, isIPV6: true }; | |
| 3230 | 3257 | } else { |
| 3231 | 3258 | return { host, isIPV6: false }; |
| 3232 | 3259 | } |
| 3233 | 3260 | } |
| 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; | |
| 3271 | + } | |
| 3272 | + } else { | |
| 3273 | + if (c === token) { | |
| 3274 | + skip = true; | |
| 3275 | + } else { | |
| 3276 | + skip = false; | |
| 3277 | + } | |
| 3278 | + out += c; | |
| 3279 | + } | |
| 3280 | + } | |
| 3281 | + return out; | |
| 3282 | + } | |
| 3234 | 3283 | function findToken(str, token) { |
| 3235 | 3284 | let ind = 0; |
| 3236 | 3285 | for (let i = 0; i < str.length; i++) { |
| 3237 | 3286 | if (str[i] === token) ind++; |
| @@ -3237,189 +3286,91 @@ | ||
| 3237 | 3286 | if (str[i] === token) ind++; |
| 3238 | 3287 | } |
| 3239 | 3288 | return ind; |
| 3240 | 3289 | } |
| 3241 | - function removeDotSegments(path) { | |
| 3242 | - let input = path; | |
| 3290 | + var RDS1 = /^\.\.?\//u; | |
| 3291 | + var RDS2 = /^\/\.(?:\/|$)/u; | |
| 3292 | + var RDS3 = /^\/\.\.(?:\/|$)/u; | |
| 3293 | + var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/u; | |
| 3294 | + function removeDotSegments(input) { | |
| 3243 | 3295 | const output = []; |
| 3244 | - let nextSlash = -1; | |
| 3245 | - let len = 0; | |
| 3246 | - while (len = input.length) { | |
| 3247 | - if (len === 1) { | |
| 3248 | - if (input === ".") { | |
| 3249 | - break; | |
| 3250 | - } else if (input === "/") { | |
| 3251 | - output.push("/"); | |
| 3252 | - break; | |
| 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 = ""; | |
| 3306 | + } 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); | |
| 3253 | 3312 | } else { |
| 3254 | - output.push(input); | |
| 3255 | - break; | |
| 3313 | + throw new Error("Unexpected dot segment condition"); | |
| 3256 | 3314 | } |
| 3257 | - } else if (len === 2) { | |
| 3258 | - if (input[0] === ".") { | |
| 3259 | - if (input[1] === ".") { | |
| 3260 | - break; | |
| 3261 | - } else if (input[1] === "/") { | |
| 3262 | - input = input.slice(2); | |
| 3263 | - continue; | |
| 3264 | - } | |
| 3265 | - } else if (input[0] === "/") { | |
| 3266 | - if (input[1] === "." || input[1] === "/") { | |
| 3267 | - output.push("/"); | |
| 3268 | - break; | |
| 3269 | - } | |
| 3270 | - } | |
| 3271 | - } else if (len === 3) { | |
| 3272 | - if (input === "/..") { | |
| 3273 | - if (output.length !== 0) { | |
| 3274 | - output.pop(); | |
| 3275 | - } | |
| 3276 | - output.push("/"); | |
| 3277 | - break; | |
| 3278 | - } | |
| 3279 | 3315 | } |
| 3280 | - if (input[0] === ".") { | |
| 3281 | - if (input[1] === ".") { | |
| 3282 | - if (input[2] === "/") { | |
| 3283 | - input = input.slice(3); | |
| 3284 | - continue; | |
| 3285 | - } | |
| 3286 | - } else if (input[1] === "/") { | |
| 3287 | - input = input.slice(2); | |
| 3288 | - continue; | |
| 3289 | - } | |
| 3290 | - } else if (input[0] === "/") { | |
| 3291 | - if (input[1] === ".") { | |
| 3292 | - if (input[2] === "/") { | |
| 3293 | - input = input.slice(2); | |
| 3294 | - continue; | |
| 3295 | - } else if (input[2] === ".") { | |
| 3296 | - if (input[3] === "/") { | |
| 3297 | - input = input.slice(3); | |
| 3298 | - if (output.length !== 0) { | |
| 3299 | - output.pop(); | |
| 3300 | - } | |
| 3301 | - continue; | |
| 3302 | - } | |
| 3303 | - } | |
| 3304 | - } | |
| 3305 | - } | |
| 3306 | - if ((nextSlash = input.indexOf("/", 1)) === -1) { | |
| 3307 | - output.push(input); | |
| 3308 | - break; | |
| 3309 | - } else { | |
| 3310 | - output.push(input.slice(0, nextSlash)); | |
| 3311 | - input = input.slice(nextSlash); | |
| 3312 | - } | |
| 3313 | 3316 | } |
| 3314 | 3317 | return output.join(""); |
| 3315 | 3318 | } |
| 3316 | - var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" }; | |
| 3317 | - var HOST_DELIM_RE = /[@/?#:]/g; | |
| 3318 | - var HOST_DELIM_NO_COLON_RE = /[@/?#]/g; | |
| 3319 | - function reescapeHostDelimiters(host, isIP) { | |
| 3320 | - const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE; | |
| 3321 | - re.lastIndex = 0; | |
| 3322 | - return host.replace(re, (ch) => HOST_DELIMS[ch]); | |
| 3323 | - } | |
| 3324 | - function normalizePercentEncoding(input, decodeUnreserved = false) { | |
| 3325 | - if (input.indexOf("%") === -1) { | |
| 3326 | - return input; | |
| 3319 | + function normalizeComponentEncoding(components, esc) { | |
| 3320 | + const func = esc !== true ? escape : unescape; | |
| 3321 | + if (components.scheme !== void 0) { | |
| 3322 | + components.scheme = func(components.scheme); | |
| 3327 | 3323 | } |
| 3328 | - let output = ""; | |
| 3329 | - for (let i = 0; i < input.length; i++) { | |
| 3330 | - if (input[i] === "%" && i + 2 < input.length) { | |
| 3331 | - const hex = input.slice(i + 1, i + 3); | |
| 3332 | - if (isHexPair(hex)) { | |
| 3333 | - const normalizedHex = hex.toUpperCase(); | |
| 3334 | - const decoded = String.fromCharCode(parseInt(normalizedHex, 16)); | |
| 3335 | - if (decodeUnreserved && isUnreserved(decoded)) { | |
| 3336 | - output += decoded; | |
| 3337 | - } else { | |
| 3338 | - output += "%" + normalizedHex; | |
| 3339 | - } | |
| 3340 | - i += 2; | |
| 3341 | - continue; | |
| 3342 | - } | |
| 3343 | - } | |
| 3344 | - output += input[i]; | |
| 3324 | + if (components.userinfo !== void 0) { | |
| 3325 | + components.userinfo = func(components.userinfo); | |
| 3345 | 3326 | } |
| 3346 | - return output; | |
| 3347 | - } | |
| 3348 | - function normalizePathEncoding(input) { | |
| 3349 | - let output = ""; | |
| 3350 | - for (let i = 0; i < input.length; i++) { | |
| 3351 | - if (input[i] === "%" && i + 2 < input.length) { | |
| 3352 | - const hex = input.slice(i + 1, i + 3); | |
| 3353 | - if (isHexPair(hex)) { | |
| 3354 | - const normalizedHex = hex.toUpperCase(); | |
| 3355 | - const decoded = String.fromCharCode(parseInt(normalizedHex, 16)); | |
| 3356 | - if (decoded !== "." && isUnreserved(decoded)) { | |
| 3357 | - output += decoded; | |
| 3358 | - } else { | |
| 3359 | - output += "%" + normalizedHex; | |
| 3360 | - } | |
| 3361 | - i += 2; | |
| 3362 | - continue; | |
| 3363 | - } | |
| 3364 | - } | |
| 3365 | - if (isPathCharacter(input[i])) { | |
| 3366 | - output += input[i]; | |
| 3367 | - } else { | |
| 3368 | - output += escape(input[i]); | |
| 3369 | - } | |
| 3327 | + if (components.host !== void 0) { | |
| 3328 | + components.host = func(components.host); | |
| 3370 | 3329 | } |
| 3371 | - return output; | |
| 3372 | - } | |
| 3373 | - function escapePreservingEscapes(input) { | |
| 3374 | - let output = ""; | |
| 3375 | - for (let i = 0; i < input.length; i++) { | |
| 3376 | - if (input[i] === "%" && i + 2 < input.length) { | |
| 3377 | - const hex = input.slice(i + 1, i + 3); | |
| 3378 | - if (isHexPair(hex)) { | |
| 3379 | - output += "%" + hex.toUpperCase(); | |
| 3380 | - i += 2; | |
| 3381 | - continue; | |
| 3382 | - } | |
| 3383 | - } | |
| 3384 | - output += escape(input[i]); | |
| 3330 | + if (components.path !== void 0) { | |
| 3331 | + components.path = func(components.path); | |
| 3385 | 3332 | } |
| 3386 | - return output; | |
| 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; | |
| 3387 | 3340 | } |
| 3388 | - function recomposeAuthority(component) { | |
| 3341 | + function recomposeAuthority(components, options) { | |
| 3389 | 3342 | const uriTokens = []; |
| 3390 | - if (component.userinfo !== void 0) { | |
| 3391 | - uriTokens.push(component.userinfo); | |
| 3343 | + if (components.userinfo !== void 0) { | |
| 3344 | + uriTokens.push(components.userinfo); | |
| 3392 | 3345 | uriTokens.push("@"); |
| 3393 | 3346 | } |
| 3394 | - if (component.host !== void 0) { | |
| 3395 | - let host = unescape(component.host); | |
| 3396 | - if (!isIPv4(host)) { | |
| 3397 | - const ipV6res = normalizeIPv6(host); | |
| 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 }); | |
| 3398 | 3354 | if (ipV6res.isIPV6 === true) { |
| 3399 | 3355 | host = `[${ipV6res.escapedHost}]`; |
| 3400 | 3356 | } else { |
| 3401 | - host = reescapeHostDelimiters(host, false); | |
| 3357 | + host = components.host; | |
| 3402 | 3358 | } |
| 3403 | 3359 | } |
| 3404 | 3360 | uriTokens.push(host); |
| 3405 | 3361 | } |
| 3406 | - if (typeof component.port === "number" || typeof component.port === "string") { | |
| 3362 | + if (typeof components.port === "number" || typeof components.port === "string") { | |
| 3407 | 3363 | uriTokens.push(":"); |
| 3408 | - uriTokens.push(String(component.port)); | |
| 3364 | + uriTokens.push(String(components.port)); | |
| 3409 | 3365 | } |
| 3410 | 3366 | return uriTokens.length ? uriTokens.join("") : void 0; |
| 3411 | 3367 | } |
| 3412 | 3368 | module.exports = { |
| 3413 | - nonSimpleDomain, | |
| 3414 | 3369 | recomposeAuthority, |
| 3415 | - reescapeHostDelimiters, | |
| 3416 | - normalizePercentEncoding, | |
| 3417 | - normalizePathEncoding, | |
| 3418 | - escapePreservingEscapes, | |
| 3370 | + normalizeComponentEncoding, | |
| 3419 | 3371 | removeDotSegments, |
| 3420 | - isIPv4, | |
| 3421 | - isUUID, | |
| 3372 | + normalizeIPv4, | |
| 3422 | 3373 | normalizeIPv6, |
| 3423 | 3374 | stringArrayToHexStripped |
| 3424 | 3375 | }; |
| 3425 | 3376 | } |
| @@ -3428,211 +3379,147 @@ | ||
| 3428 | 3379 | // node_modules/fast-uri/lib/schemes.js |
| 3429 | 3380 | var require_schemes = __commonJS({ |
| 3430 | 3381 | "node_modules/fast-uri/lib/schemes.js"(exports, module) { |
| 3431 | 3382 | "use strict"; |
| 3432 | - var { isUUID } = require_utils(); | |
| 3383 | + var UUID_REG = /^[\da-f]{8}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{12}$/iu; | |
| 3433 | 3384 | var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu; |
| 3434 | - var supportedSchemeNames = ( | |
| 3435 | - /** @type {const} */ | |
| 3436 | - [ | |
| 3437 | - "http", | |
| 3438 | - "https", | |
| 3439 | - "ws", | |
| 3440 | - "wss", | |
| 3441 | - "urn", | |
| 3442 | - "urn:uuid" | |
| 3443 | - ] | |
| 3444 | - ); | |
| 3445 | - function isValidSchemeName(name) { | |
| 3446 | - return supportedSchemeNames.indexOf( | |
| 3447 | - /** @type {*} */ | |
| 3448 | - name | |
| 3449 | - ) !== -1; | |
| 3385 | + function isSecure(wsComponents) { | |
| 3386 | + return typeof wsComponents.secure === "boolean" ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss"; | |
| 3450 | 3387 | } |
| 3451 | - function wsIsSecure(wsComponent) { | |
| 3452 | - if (wsComponent.secure === true) { | |
| 3453 | - return true; | |
| 3454 | - } else if (wsComponent.secure === false) { | |
| 3455 | - return false; | |
| 3456 | - } else if (wsComponent.scheme) { | |
| 3457 | - 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"); | |
| 3458 | - } else { | |
| 3459 | - return false; | |
| 3388 | + function httpParse(components) { | |
| 3389 | + if (!components.host) { | |
| 3390 | + components.error = components.error || "HTTP URIs must have a host."; | |
| 3460 | 3391 | } |
| 3392 | + return components; | |
| 3461 | 3393 | } |
| 3462 | - function httpParse(component) { | |
| 3463 | - if (!component.host) { | |
| 3464 | - component.error = component.error || "HTTP URIs must have a host."; | |
| 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; | |
| 3465 | 3398 | } |
| 3466 | - return component; | |
| 3467 | - } | |
| 3468 | - function httpSerialize(component) { | |
| 3469 | - const secure = String(component.scheme).toLowerCase() === "https"; | |
| 3470 | - if (component.port === (secure ? 443 : 80) || component.port === "") { | |
| 3471 | - component.port = void 0; | |
| 3399 | + if (!components.path) { | |
| 3400 | + components.path = "/"; | |
| 3472 | 3401 | } |
| 3473 | - if (!component.path) { | |
| 3474 | - component.path = "/"; | |
| 3475 | - } | |
| 3476 | - return component; | |
| 3402 | + return components; | |
| 3477 | 3403 | } |
| 3478 | - function wsParse(wsComponent) { | |
| 3479 | - wsComponent.secure = wsIsSecure(wsComponent); | |
| 3480 | - wsComponent.resourceName = (wsComponent.path || "/") + (wsComponent.query ? "?" + wsComponent.query : ""); | |
| 3481 | - wsComponent.path = void 0; | |
| 3482 | - wsComponent.query = void 0; | |
| 3483 | - return wsComponent; | |
| 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; | |
| 3484 | 3410 | } |
| 3485 | - function wsSerialize(wsComponent) { | |
| 3486 | - if (wsComponent.port === (wsIsSecure(wsComponent) ? 443 : 80) || wsComponent.port === "") { | |
| 3487 | - wsComponent.port = void 0; | |
| 3411 | + function wsSerialize(wsComponents) { | |
| 3412 | + if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") { | |
| 3413 | + wsComponents.port = void 0; | |
| 3488 | 3414 | } |
| 3489 | - if (typeof wsComponent.secure === "boolean") { | |
| 3490 | - wsComponent.scheme = wsComponent.secure ? "wss" : "ws"; | |
| 3491 | - wsComponent.secure = void 0; | |
| 3415 | + if (typeof wsComponents.secure === "boolean") { | |
| 3416 | + wsComponents.scheme = wsComponents.secure ? "wss" : "ws"; | |
| 3417 | + wsComponents.secure = void 0; | |
| 3492 | 3418 | } |
| 3493 | - if (wsComponent.resourceName) { | |
| 3494 | - const [path, query] = wsComponent.resourceName.split("?"); | |
| 3495 | - wsComponent.path = path && path !== "/" ? path : void 0; | |
| 3496 | - wsComponent.query = query; | |
| 3497 | - wsComponent.resourceName = void 0; | |
| 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; | |
| 3498 | 3424 | } |
| 3499 | - wsComponent.fragment = void 0; | |
| 3500 | - return wsComponent; | |
| 3425 | + wsComponents.fragment = void 0; | |
| 3426 | + return wsComponents; | |
| 3501 | 3427 | } |
| 3502 | - function urnParse(urnComponent, options) { | |
| 3503 | - if (!urnComponent.path) { | |
| 3504 | - urnComponent.error = "URN can not be parsed"; | |
| 3505 | - return urnComponent; | |
| 3428 | + function urnParse(urnComponents, options) { | |
| 3429 | + if (!urnComponents.path) { | |
| 3430 | + urnComponents.error = "URN can not be parsed"; | |
| 3431 | + return urnComponents; | |
| 3506 | 3432 | } |
| 3507 | - const matches = urnComponent.path.match(URN_REG); | |
| 3433 | + const matches = urnComponents.path.match(URN_REG); | |
| 3508 | 3434 | if (matches) { |
| 3509 | - const scheme = options.scheme || urnComponent.scheme || "urn"; | |
| 3510 | - urnComponent.nid = matches[1].toLowerCase(); | |
| 3511 | - urnComponent.nss = matches[2]; | |
| 3512 | - const urnScheme = `${scheme}:${options.nid || urnComponent.nid}`; | |
| 3513 | - const schemeHandler = getSchemeHandler(urnScheme); | |
| 3514 | - urnComponent.path = void 0; | |
| 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; | |
| 3515 | 3441 | if (schemeHandler) { |
| 3516 | - urnComponent = schemeHandler.parse(urnComponent, options); | |
| 3442 | + urnComponents = schemeHandler.parse(urnComponents, options); | |
| 3517 | 3443 | } |
| 3518 | 3444 | } else { |
| 3519 | - urnComponent.error = urnComponent.error || "URN can not be parsed."; | |
| 3445 | + urnComponents.error = urnComponents.error || "URN can not be parsed."; | |
| 3520 | 3446 | } |
| 3521 | - return urnComponent; | |
| 3447 | + return urnComponents; | |
| 3522 | 3448 | } |
| 3523 | - function urnSerialize(urnComponent, options) { | |
| 3524 | - if (urnComponent.nid === void 0) { | |
| 3525 | - throw new Error("URN without nid cannot be serialized"); | |
| 3526 | - } | |
| 3527 | - const scheme = options.scheme || urnComponent.scheme || "urn"; | |
| 3528 | - const nid = urnComponent.nid.toLowerCase(); | |
| 3449 | + function urnSerialize(urnComponents, options) { | |
| 3450 | + const scheme = options.scheme || urnComponents.scheme || "urn"; | |
| 3451 | + const nid = urnComponents.nid.toLowerCase(); | |
| 3529 | 3452 | const urnScheme = `${scheme}:${options.nid || nid}`; |
| 3530 | - const schemeHandler = getSchemeHandler(urnScheme); | |
| 3453 | + const schemeHandler = SCHEMES[urnScheme]; | |
| 3531 | 3454 | if (schemeHandler) { |
| 3532 | - urnComponent = schemeHandler.serialize(urnComponent, options); | |
| 3455 | + urnComponents = schemeHandler.serialize(urnComponents, options); | |
| 3533 | 3456 | } |
| 3534 | - const uriComponent = urnComponent; | |
| 3535 | - const nss = urnComponent.nss; | |
| 3536 | - uriComponent.path = `${nid || options.nid}:${nss}`; | |
| 3457 | + const uriComponents = urnComponents; | |
| 3458 | + const nss = urnComponents.nss; | |
| 3459 | + uriComponents.path = `${nid || options.nid}:${nss}`; | |
| 3537 | 3460 | options.skipEscape = true; |
| 3538 | - return uriComponent; | |
| 3461 | + return uriComponents; | |
| 3539 | 3462 | } |
| 3540 | - function urnuuidParse(urnComponent, options) { | |
| 3541 | - const uuidComponent = urnComponent; | |
| 3542 | - uuidComponent.uuid = uuidComponent.nss; | |
| 3543 | - uuidComponent.nss = void 0; | |
| 3544 | - if (!options.tolerant && (!uuidComponent.uuid || !isUUID(uuidComponent.uuid))) { | |
| 3545 | - uuidComponent.error = uuidComponent.error || "UUID is not valid."; | |
| 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."; | |
| 3546 | 3469 | } |
| 3547 | - return uuidComponent; | |
| 3470 | + return uuidComponents; | |
| 3548 | 3471 | } |
| 3549 | - function urnuuidSerialize(uuidComponent) { | |
| 3550 | - const urnComponent = uuidComponent; | |
| 3551 | - urnComponent.nss = (uuidComponent.uuid || "").toLowerCase(); | |
| 3552 | - return urnComponent; | |
| 3472 | + function urnuuidSerialize(uuidComponents) { | |
| 3473 | + const urnComponents = uuidComponents; | |
| 3474 | + urnComponents.nss = (uuidComponents.uuid || "").toLowerCase(); | |
| 3475 | + return urnComponents; | |
| 3553 | 3476 | } |
| 3554 | - var http = ( | |
| 3555 | - /** @type {SchemeHandler} */ | |
| 3556 | - { | |
| 3557 | - scheme: "http", | |
| 3558 | - domainHost: true, | |
| 3559 | - parse: httpParse, | |
| 3560 | - serialize: httpSerialize | |
| 3561 | - } | |
| 3562 | - ); | |
| 3563 | - var https = ( | |
| 3564 | - /** @type {SchemeHandler} */ | |
| 3565 | - { | |
| 3566 | - scheme: "https", | |
| 3567 | - domainHost: http.domainHost, | |
| 3568 | - parse: httpParse, | |
| 3569 | - serialize: httpSerialize | |
| 3570 | - } | |
| 3571 | - ); | |
| 3572 | - var ws = ( | |
| 3573 | - /** @type {SchemeHandler} */ | |
| 3574 | - { | |
| 3575 | - scheme: "ws", | |
| 3576 | - domainHost: true, | |
| 3577 | - parse: wsParse, | |
| 3578 | - serialize: wsSerialize | |
| 3579 | - } | |
| 3580 | - ); | |
| 3581 | - var wss = ( | |
| 3582 | - /** @type {SchemeHandler} */ | |
| 3583 | - { | |
| 3584 | - scheme: "wss", | |
| 3585 | - domainHost: ws.domainHost, | |
| 3586 | - parse: ws.parse, | |
| 3587 | - serialize: ws.serialize | |
| 3588 | - } | |
| 3589 | - ); | |
| 3590 | - var urn = ( | |
| 3591 | - /** @type {SchemeHandler} */ | |
| 3592 | - { | |
| 3593 | - scheme: "urn", | |
| 3594 | - parse: urnParse, | |
| 3595 | - serialize: urnSerialize, | |
| 3596 | - skipNormalize: true | |
| 3597 | - } | |
| 3598 | - ); | |
| 3599 | - var urnuuid = ( | |
| 3600 | - /** @type {SchemeHandler} */ | |
| 3601 | - { | |
| 3602 | - scheme: "urn:uuid", | |
| 3603 | - parse: urnuuidParse, | |
| 3604 | - serialize: urnuuidSerialize, | |
| 3605 | - skipNormalize: true | |
| 3606 | - } | |
| 3607 | - ); | |
| 3608 | - var SCHEMES = ( | |
| 3609 | - /** @type {Record<SchemeName, SchemeHandler>} */ | |
| 3610 | - { | |
| 3611 | - http, | |
| 3612 | - https, | |
| 3613 | - ws, | |
| 3614 | - wss, | |
| 3615 | - urn, | |
| 3616 | - "urn:uuid": urnuuid | |
| 3617 | - } | |
| 3618 | - ); | |
| 3619 | - Object.setPrototypeOf(SCHEMES, null); | |
| 3620 | - function getSchemeHandler(scheme) { | |
| 3621 | - return scheme && (SCHEMES[ | |
| 3622 | - /** @type {SchemeName} */ | |
| 3623 | - scheme | |
| 3624 | - ] || SCHEMES[ | |
| 3625 | - /** @type {SchemeName} */ | |
| 3626 | - scheme.toLowerCase() | |
| 3627 | - ]) || void 0; | |
| 3628 | - } | |
| 3629 | - module.exports = { | |
| 3630 | - wsIsSecure, | |
| 3631 | - SCHEMES, | |
| 3632 | - isValidSchemeName, | |
| 3633 | - getSchemeHandler | |
| 3477 | + var http = { | |
| 3478 | + scheme: "http", | |
| 3479 | + domainHost: true, | |
| 3480 | + parse: httpParse, | |
| 3481 | + serialize: httpSerialize | |
| 3634 | 3482 | }; |
| 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; | |
| 3635 | 3522 | } |
| 3636 | 3523 | }); |
| 3637 | 3524 | |
| 3638 | 3525 | // node_modules/fast-uri/index.js |
| @@ -3638,27 +3525,24 @@ | ||
| 3638 | 3525 | // node_modules/fast-uri/index.js |
| 3639 | 3526 | var require_fast_uri = __commonJS({ |
| 3640 | 3527 | "node_modules/fast-uri/index.js"(exports, module) { |
| 3641 | 3528 | "use strict"; |
| 3642 | - var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils(); | |
| 3643 | - var { SCHEMES, getSchemeHandler } = require_schemes(); | |
| 3529 | + var { normalizeIPv6, normalizeIPv4, removeDotSegments, recomposeAuthority, normalizeComponentEncoding } = require_utils(); | |
| 3530 | + var SCHEMES = require_schemes(); | |
| 3644 | 3531 | function normalize(uri, options) { |
| 3645 | 3532 | if (typeof uri === "string") { |
| 3646 | - uri = /** @type {T} */ | |
| 3647 | - normalizeString(uri, options); | |
| 3533 | + uri = serialize(parse(uri, options), options); | |
| 3648 | 3534 | } else if (typeof uri === "object") { |
| 3649 | - uri = /** @type {T} */ | |
| 3650 | - parse(serialize(uri, options), options); | |
| 3535 | + uri = parse(serialize(uri, options), options); | |
| 3651 | 3536 | } |
| 3652 | 3537 | return uri; |
| 3653 | 3538 | } |
| 3654 | 3539 | function resolve(baseURI, relativeURI, options) { |
| 3655 | - const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" }; | |
| 3656 | - const resolved = resolveComponent(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true); | |
| 3657 | - schemelessOptions.skipEscape = true; | |
| 3658 | - return serialize(resolved, schemelessOptions); | |
| 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 }); | |
| 3659 | 3543 | } |
| 3660 | - function resolveComponent(base, relative, options, skipNormalization) { | |
| 3544 | + function resolveComponents(base, relative, options, skipNormalization) { | |
| 3661 | 3545 | const target = {}; |
| 3662 | 3546 | if (!skipNormalization) { |
| 3663 | 3547 | base = parse(serialize(base, options), options); |
| 3664 | 3548 | relative = parse(serialize(relative, options), options); |
| @@ -3686,9 +3570,9 @@ | ||
| 3686 | 3570 | } else { |
| 3687 | 3571 | target.query = base.query; |
| 3688 | 3572 | } |
| 3689 | 3573 | } else { |
| 3690 | - if (relative.path[0] === "/") { | |
| 3574 | + if (relative.path.charAt(0) === "/") { | |
| 3691 | 3575 | target.path = removeDotSegments(relative.path); |
| 3692 | 3576 | } else { |
| 3693 | 3577 | if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) { |
| 3694 | 3578 | target.path = "/" + relative.path; |
| @@ -3710,14 +3594,24 @@ | ||
| 3710 | 3594 | target.fragment = relative.fragment; |
| 3711 | 3595 | return target; |
| 3712 | 3596 | } |
| 3713 | 3597 | function equal(uriA, uriB, options) { |
| 3714 | - const normalizedA = normalizeComparableURI(uriA, options); | |
| 3715 | - const normalizedB = normalizeComparableURI(uriB, options); | |
| 3716 | - return normalizedA !== void 0 && normalizedB !== void 0 && normalizedA.toLowerCase() === normalizedB.toLowerCase(); | |
| 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(); | |
| 3717 | 3611 | } |
| 3718 | 3612 | function serialize(cmpts, opts) { |
| 3719 | - const component = { | |
| 3613 | + const components = { | |
| 3720 | 3614 | host: cmpts.host, |
| 3721 | 3615 | scheme: cmpts.scheme, |
| 3722 | 3616 | userinfo: cmpts.userinfo, |
| 3723 | 3617 | port: cmpts.port, |
| @@ -3733,62 +3627,67 @@ | ||
| 3733 | 3627 | error: "" |
| 3734 | 3628 | }; |
| 3735 | 3629 | const options = Object.assign({}, opts); |
| 3736 | 3630 | const uriTokens = []; |
| 3737 | - const schemeHandler = getSchemeHandler(options.scheme || component.scheme); | |
| 3738 | - if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options); | |
| 3739 | - if (component.path !== void 0) { | |
| 3631 | + const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()]; | |
| 3632 | + if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options); | |
| 3633 | + if (components.path !== void 0) { | |
| 3740 | 3634 | if (!options.skipEscape) { |
| 3741 | - component.path = escapePreservingEscapes(component.path); | |
| 3742 | - if (component.scheme !== void 0) { | |
| 3743 | - component.path = component.path.split("%3A").join(":"); | |
| 3635 | + components.path = escape(components.path); | |
| 3636 | + if (components.scheme !== void 0) { | |
| 3637 | + components.path = components.path.split("%3A").join(":"); | |
| 3744 | 3638 | } |
| 3745 | 3639 | } else { |
| 3746 | - component.path = normalizePercentEncoding(component.path); | |
| 3640 | + components.path = unescape(components.path); | |
| 3747 | 3641 | } |
| 3748 | 3642 | } |
| 3749 | - if (options.reference !== "suffix" && component.scheme) { | |
| 3750 | - uriTokens.push(component.scheme, ":"); | |
| 3643 | + if (options.reference !== "suffix" && components.scheme) { | |
| 3644 | + uriTokens.push(components.scheme); | |
| 3645 | + uriTokens.push(":"); | |
| 3751 | 3646 | } |
| 3752 | - const authority = recomposeAuthority(component); | |
| 3647 | + const authority = recomposeAuthority(components, options); | |
| 3753 | 3648 | if (authority !== void 0) { |
| 3754 | 3649 | if (options.reference !== "suffix") { |
| 3755 | 3650 | uriTokens.push("//"); |
| 3756 | 3651 | } |
| 3757 | 3652 | uriTokens.push(authority); |
| 3758 | - if (component.path && component.path[0] !== "/") { | |
| 3653 | + if (components.path && components.path.charAt(0) !== "/") { | |
| 3759 | 3654 | uriTokens.push("/"); |
| 3760 | 3655 | } |
| 3761 | 3656 | } |
| 3762 | - if (component.path !== void 0) { | |
| 3763 | - let s = component.path; | |
| 3657 | + if (components.path !== void 0) { | |
| 3658 | + let s = components.path; | |
| 3764 | 3659 | if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) { |
| 3765 | 3660 | s = removeDotSegments(s); |
| 3766 | 3661 | } |
| 3767 | - if (authority === void 0 && s[0] === "/" && s[1] === "/") { | |
| 3768 | - s = "/%2F" + s.slice(2); | |
| 3662 | + if (authority === void 0) { | |
| 3663 | + s = s.replace(/^\/\//u, "/%2F"); | |
| 3769 | 3664 | } |
| 3770 | 3665 | uriTokens.push(s); |
| 3771 | 3666 | } |
| 3772 | - if (component.query !== void 0) { | |
| 3773 | - uriTokens.push("?", component.query); | |
| 3667 | + if (components.query !== void 0) { | |
| 3668 | + uriTokens.push("?"); | |
| 3669 | + uriTokens.push(components.query); | |
| 3774 | 3670 | } |
| 3775 | - if (component.fragment !== void 0) { | |
| 3776 | - uriTokens.push("#", component.fragment); | |
| 3671 | + if (components.fragment !== void 0) { | |
| 3672 | + uriTokens.push("#"); | |
| 3673 | + uriTokens.push(components.fragment); | |
| 3777 | 3674 | } |
| 3778 | 3675 | return uriTokens.join(""); |
| 3779 | 3676 | } |
| 3780 | - var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u; | |
| 3781 | - function getParseError(parsed, matches) { | |
| 3782 | - if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") { | |
| 3783 | - return 'URI path must start with "/" when authority is present.'; | |
| 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]) { | |
| 3683 | + return true; | |
| 3684 | + } | |
| 3784 | 3685 | } |
| 3785 | - if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) { | |
| 3786 | - return "URI port is malformed."; | |
| 3787 | - } | |
| 3788 | - return void 0; | |
| 3686 | + return false; | |
| 3789 | 3687 | } |
| 3790 | - function parseWithStatus(uri, opts) { | |
| 3688 | + var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u; | |
| 3689 | + function parse(uri, opts) { | |
| 3791 | 3690 | const options = Object.assign({}, opts); |
| 3792 | 3691 | const parsed = { |
| 3793 | 3692 | scheme: void 0, |
| 3794 | 3693 | userinfo: void 0, |
| @@ -3797,17 +3696,11 @@ | ||
| 3797 | 3696 | path: "", |
| 3798 | 3697 | query: void 0, |
| 3799 | 3698 | fragment: void 0 |
| 3800 | 3699 | }; |
| 3801 | - let malformedAuthorityOrPort = false; | |
| 3700 | + const gotEncoding = uri.indexOf("%") !== -1; | |
| 3802 | 3701 | let isIP = false; |
| 3803 | - if (options.reference === "suffix") { | |
| 3804 | - if (options.scheme) { | |
| 3805 | - uri = options.scheme + ":" + uri; | |
| 3806 | - } else { | |
| 3807 | - uri = "//" + uri; | |
| 3808 | - } | |
| 3809 | - } | |
| 3702 | + if (options.reference === "suffix") uri = (options.scheme ? options.scheme + ":" : "") + "//" + uri; | |
| 3810 | 3703 | const matches = uri.match(URI_PARSE); |
| 3811 | 3704 | if (matches) { |
| 3812 | 3705 | parsed.scheme = matches[1]; |
| 3813 | 3706 | parsed.userinfo = matches[3]; |
| @@ -3818,24 +3711,20 @@ | ||
| 3818 | 3711 | parsed.fragment = matches[8]; |
| 3819 | 3712 | if (isNaN(parsed.port)) { |
| 3820 | 3713 | parsed.port = matches[5]; |
| 3821 | 3714 | } |
| 3822 | - const parseError = getParseError(parsed, matches); | |
| 3823 | - if (parseError !== void 0) { | |
| 3824 | - parsed.error = parsed.error || parseError; | |
| 3825 | - malformedAuthorityOrPort = true; | |
| 3826 | - } | |
| 3827 | 3715 | if (parsed.host) { |
| 3828 | - const ipv4result = isIPv4(parsed.host); | |
| 3829 | - if (ipv4result === false) { | |
| 3830 | - const ipv6result = normalizeIPv6(parsed.host); | |
| 3716 | + const ipv4result = normalizeIPv4(parsed.host); | |
| 3717 | + if (ipv4result.isIPV4 === false) { | |
| 3718 | + const ipv6result = normalizeIPv6(ipv4result.host, { isIPV4: false }); | |
| 3831 | 3719 | parsed.host = ipv6result.host.toLowerCase(); |
| 3832 | 3720 | isIP = ipv6result.isIPV6; |
| 3833 | 3721 | } else { |
| 3722 | + parsed.host = ipv4result.host; | |
| 3834 | 3723 | isIP = true; |
| 3835 | 3724 | } |
| 3836 | 3725 | } |
| 3837 | - if (parsed.scheme === void 0 && parsed.userinfo === void 0 && parsed.host === void 0 && parsed.port === void 0 && parsed.query === void 0 && !parsed.path) { | |
| 3726 | + if (parsed.scheme === void 0 && parsed.userinfo === void 0 && parsed.host === void 0 && parsed.port === void 0 && !parsed.path && parsed.query === void 0) { | |
| 3838 | 3727 | parsed.reference = "same-document"; |
| 3839 | 3728 | } else if (parsed.scheme === void 0) { |
| 3840 | 3729 | parsed.reference = "relative"; |
| 3841 | 3730 | } else if (parsed.fragment === void 0) { |
| @@ -3845,13 +3734,13 @@ | ||
| 3845 | 3734 | } |
| 3846 | 3735 | if (options.reference && options.reference !== "suffix" && options.reference !== parsed.reference) { |
| 3847 | 3736 | parsed.error = parsed.error || "URI is not a " + options.reference + " reference."; |
| 3848 | 3737 | } |
| 3849 | - const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme); | |
| 3738 | + const schemeHandler = SCHEMES[(options.scheme || parsed.scheme || "").toLowerCase()]; | |
| 3850 | 3739 | if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) { |
| 3851 | 3740 | if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) { |
| 3852 | 3741 | try { |
| 3853 | - parsed.host = new URL("http://" + parsed.host).hostname; | |
| 3742 | + parsed.host = URL.domainToASCII(parsed.host.toLowerCase()); | |
| 3854 | 3743 | } catch (e) { |
| 3855 | 3744 | parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e; |
| 3856 | 3745 | } |
| 3857 | 3746 | } |
| @@ -3856,26 +3745,23 @@ | ||
| 3856 | 3745 | } |
| 3857 | 3746 | } |
| 3858 | 3747 | } |
| 3859 | 3748 | if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) { |
| 3860 | - if (uri.indexOf("%") !== -1) { | |
| 3861 | - if (parsed.scheme !== void 0) { | |
| 3862 | - parsed.scheme = unescape(parsed.scheme); | |
| 3863 | - } | |
| 3864 | - if (parsed.host !== void 0) { | |
| 3865 | - parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP); | |
| 3866 | - } | |
| 3749 | + if (gotEncoding && parsed.scheme !== void 0) { | |
| 3750 | + parsed.scheme = unescape(parsed.scheme); | |
| 3867 | 3751 | } |
| 3868 | - if (parsed.path) { | |
| 3869 | - parsed.path = normalizePathEncoding(parsed.path); | |
| 3752 | + if (gotEncoding && parsed.userinfo !== void 0) { | |
| 3753 | + parsed.userinfo = unescape(parsed.userinfo); | |
| 3870 | 3754 | } |
| 3871 | - if (parsed.fragment) { | |
| 3872 | - try { | |
| 3873 | - parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment)); | |
| 3874 | - } catch { | |
| 3875 | - parsed.error = parsed.error || "URI malformed"; | |
| 3876 | - } | |
| 3755 | + if (gotEncoding && parsed.host !== void 0) { | |
| 3756 | + parsed.host = unescape(parsed.host); | |
| 3877 | 3757 | } |
| 3758 | + if (parsed.path !== void 0 && parsed.path.length) { | |
| 3759 | + parsed.path = escape(unescape(parsed.path)); | |
| 3760 | + } | |
| 3761 | + if (parsed.fragment !== void 0 && parsed.fragment.length) { | |
| 3762 | + parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment)); | |
| 3763 | + } | |
| 3878 | 3764 | } |
| 3879 | 3765 | if (schemeHandler && schemeHandler.parse) { |
| 3880 | 3766 | schemeHandler.parse(parsed, options); |
| 3881 | 3767 | } |
| @@ -3881,37 +3767,15 @@ | ||
| 3881 | 3767 | } |
| 3882 | 3768 | } else { |
| 3883 | 3769 | parsed.error = parsed.error || "URI can not be parsed."; |
| 3884 | 3770 | } |
| 3885 | - return { parsed, malformedAuthorityOrPort }; | |
| 3771 | + return parsed; | |
| 3886 | 3772 | } |
| 3887 | - function parse(uri, opts) { | |
| 3888 | - return parseWithStatus(uri, opts).parsed; | |
| 3889 | - } | |
| 3890 | - function normalizeString(uri, opts) { | |
| 3891 | - return normalizeStringWithStatus(uri, opts).normalized; | |
| 3892 | - } | |
| 3893 | - function normalizeStringWithStatus(uri, opts) { | |
| 3894 | - const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts); | |
| 3895 | - return { | |
| 3896 | - normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts), | |
| 3897 | - malformedAuthorityOrPort | |
| 3898 | - }; | |
| 3899 | - } | |
| 3900 | - function normalizeComparableURI(uri, opts) { | |
| 3901 | - if (typeof uri === "string") { | |
| 3902 | - const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts); | |
| 3903 | - return malformedAuthorityOrPort ? void 0 : normalized; | |
| 3904 | - } | |
| 3905 | - if (typeof uri === "object") { | |
| 3906 | - return serialize(uri, opts); | |
| 3907 | - } | |
| 3908 | - } | |
| 3909 | 3773 | var fastUri = { |
| 3910 | 3774 | SCHEMES, |
| 3911 | 3775 | normalize, |
| 3912 | 3776 | resolve, |
| 3913 | - resolveComponent, | |
| 3777 | + resolveComponents, | |
| 3914 | 3778 | equal, |
| 3915 | 3779 | serialize, |
| 3916 | 3780 | parse |
| 3917 | 3781 | }; |
| @@ -4043,9 +3907,9 @@ | ||
| 4043 | 3907 | var Ajv2 = class { |
| 4044 | 3908 | constructor(opts = {}) { |
| 4045 | 3909 | this.schemas = {}; |
| 4046 | 3910 | this.refs = {}; |
| 4047 | - this.formats = /* @__PURE__ */ Object.create(null); | |
| 3911 | + this.formats = {}; | |
| 4048 | 3912 | this._compilations = /* @__PURE__ */ new Set(); |
| 4049 | 3913 | this._loading = {}; |
| 4050 | 3914 | this._cache = /* @__PURE__ */ new Map(); |
| 4051 | 3915 | opts = this.opts = { ...opts, ...requiredOptions(opts) }; |
| @@ -4847,9 +4711,8 @@ | ||
| 4847 | 4711 | "node_modules/ajv/dist/vocabularies/validation/pattern.js"(exports) { |
| 4848 | 4712 | "use strict"; |
| 4849 | 4713 | Object.defineProperty(exports, "__esModule", { value: true }); |
| 4850 | 4714 | var code_1 = require_code2(); |
| 4851 | - var util_1 = require_util(); | |
| 4852 | 4715 | var codegen_1 = require_codegen(); |
| 4853 | 4716 | var error = { |
| 4854 | 4717 | message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`, |
| 4855 | 4718 | params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}` |
| @@ -4860,20 +4723,12 @@ | ||
| 4860 | 4723 | schemaType: "string", |
| 4861 | 4724 | $data: true, |
| 4862 | 4725 | error, |
| 4863 | 4726 | code(cxt) { |
| 4864 | - const { gen, data, $data, schema, schemaCode, it } = cxt; | |
| 4727 | + const { data, $data, schema, schemaCode, it } = cxt; | |
| 4865 | 4728 | const u = it.opts.unicodeRegExp ? "u" : ""; |
| 4866 | - if ($data) { | |
| 4867 | - const { regExp } = it.opts.code; | |
| 4868 | - const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp); | |
| 4869 | - const valid = gen.let("valid"); | |
| 4870 | - gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false)); | |
| 4871 | - cxt.fail$data((0, codegen_1._)`!${valid}`); | |
| 4872 | - } else { | |
| 4873 | - const regExp = (0, code_1.usePattern)(cxt, schema); | |
| 4874 | - cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`); | |
| 4875 | - } | |
| 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})`); | |
| 4876 | 4731 | } |
| 4877 | 4732 | }; |
| 4878 | 4733 | exports.default = def; |
| 4879 | 4734 | } |
| @@ -7588,17 +7443,9 @@ | ||
| 7588 | 7443 | verbose: true, |
| 7589 | 7444 | allowUnionTypes: true |
| 7590 | 7445 | // Allow anyOf without explicit type |
| 7591 | 7446 | }); |
| 7592 | -(0, import_ajv_formats.default)(ajv, [ | |
| 7593 | - "date-time", | |
| 7594 | - "email", | |
| 7595 | - "hostname", | |
| 7596 | - "ipv4", | |
| 7597 | - "ipv6", | |
| 7598 | - "uri", | |
| 7599 | - "uuid" | |
| 7600 | -]); | |
| 7447 | +(0, import_ajv_formats.default)(ajv, ["date-time", "email", "hostname", "ipv4", "ipv6", "uuid"]); | |
| 7601 | 7448 | function formatAjvError(ajvError, param) { |
| 7602 | 7449 | const instancePath = ajvError.instancePath ? ajvError.instancePath.replace(/\//g, "][").replace(/^\]\[/, "[") + "]" : ""; |
| 7603 | 7450 | const fullParam = param + instancePath; |
| 7604 | 7451 | switch (ajvError.keyword) { |
| @@ -7622,10 +7469,9 @@ | ||
| 7622 | 7469 | "date-time": "Invalid date.", |
| 7623 | 7470 | uuid: `${fullParam} is not a valid UUID.`, |
| 7624 | 7471 | ipv4: `${fullParam} is not a valid IP address.`, |
| 7625 | 7472 | ipv6: `${fullParam} is not a valid IP address.`, |
| 7626 | - hostname: `${fullParam} is not a valid hostname.`, | |
| 7627 | - uri: `${fullParam} is not a valid URI.` | |
| 7473 | + hostname: `${fullParam} is not a valid hostname.` | |
| 7628 | 7474 | }; |
| 7629 | 7475 | return formatMessages[format] || `Invalid ${format}.`; |
| 7630 | 7476 | case "minimum": |
| 7631 | 7477 | case "exclusiveMinimum": |