@kubohiroya/turbowarp-aframe 0.13.1 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +1 -1
- package/README.md +1 -1
- package/dist/turbowarp-aframe.js +600 -147
- package/package.json +3 -3
package/README.ja.md
CHANGED
|
@@ -94,7 +94,7 @@ TurboWarp では `dist/turbowarp-aframe.js` を unsandboxed custom extension と
|
|
|
94
94
|
package として参照する場合は version を固定します。
|
|
95
95
|
|
|
96
96
|
```bash
|
|
97
|
-
pnpm add --save-exact @kubohiroya/turbowarp-aframe@0.
|
|
97
|
+
pnpm add --save-exact @kubohiroya/turbowarp-aframe@0.14.0
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
## ブロック概要
|
package/README.md
CHANGED
|
@@ -94,7 +94,7 @@ Load `dist/turbowarp-aframe.js` as an unsandboxed custom extension in TurboWarp.
|
|
|
94
94
|
For package-based reuse, pin the version:
|
|
95
95
|
|
|
96
96
|
```bash
|
|
97
|
-
pnpm add --save-exact @kubohiroya/turbowarp-aframe@0.
|
|
97
|
+
pnpm add --save-exact @kubohiroya/turbowarp-aframe@0.14.0
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
## Block reference
|
package/dist/turbowarp-aframe.js
CHANGED
|
@@ -7148,8 +7148,10 @@ var require_formats = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7148
7148
|
}
|
|
7149
7149
|
exports.fullFormats = {
|
|
7150
7150
|
date: fmtDef(date, compareDate),
|
|
7151
|
-
time: fmtDef(
|
|
7152
|
-
"date-time": fmtDef(
|
|
7151
|
+
time: fmtDef(getTime(true), compareTime),
|
|
7152
|
+
"date-time": fmtDef(getDateTime(true), compareDateTime),
|
|
7153
|
+
"iso-time": fmtDef(getTime(), compareIsoTime),
|
|
7154
|
+
"iso-date-time": fmtDef(getDateTime(), compareIsoDateTime),
|
|
7153
7155
|
duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,
|
|
7154
7156
|
uri,
|
|
7155
7157
|
"uri-reference": /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,
|
|
@@ -7157,7 +7159,7 @@ var require_formats = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7157
7159
|
url: /^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,
|
|
7158
7160
|
email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
|
|
7159
7161
|
hostname: /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,
|
|
7160
|
-
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[
|
|
7162
|
+
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,
|
|
7161
7163
|
ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,
|
|
7162
7164
|
regex,
|
|
7163
7165
|
uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,
|
|
@@ -7187,8 +7189,10 @@ var require_formats = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7187
7189
|
exports.fastFormats = {
|
|
7188
7190
|
...exports.fullFormats,
|
|
7189
7191
|
date: fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/, compareDate),
|
|
7190
|
-
time: fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)
|
|
7191
|
-
"date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\
|
|
7192
|
+
time: fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareTime),
|
|
7193
|
+
"date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareDateTime),
|
|
7194
|
+
"iso-time": fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareIsoTime),
|
|
7195
|
+
"iso-date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareIsoDateTime),
|
|
7192
7196
|
uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
|
|
7193
7197
|
"uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
|
|
7194
7198
|
email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i
|
|
@@ -7227,33 +7231,59 @@ var require_formats = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7227
7231
|
if (d1 < d2) return -1;
|
|
7228
7232
|
return 0;
|
|
7229
7233
|
}
|
|
7230
|
-
var TIME = /^(\d\d):(\d\d):(\d\d
|
|
7231
|
-
function
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
|
|
7238
|
-
|
|
7234
|
+
var TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
|
|
7235
|
+
function getTime(strictTimeZone) {
|
|
7236
|
+
return function time(str) {
|
|
7237
|
+
const matches = TIME.exec(str);
|
|
7238
|
+
if (!matches) return false;
|
|
7239
|
+
const hr = +matches[1];
|
|
7240
|
+
const min = +matches[2];
|
|
7241
|
+
const sec = +matches[3];
|
|
7242
|
+
const tz = matches[4];
|
|
7243
|
+
const tzSign = matches[5] === "-" ? -1 : 1;
|
|
7244
|
+
const tzH = +(matches[6] || 0);
|
|
7245
|
+
const tzM = +(matches[7] || 0);
|
|
7246
|
+
if (tzH > 23 || tzM > 59 || strictTimeZone && !tz) return false;
|
|
7247
|
+
if (hr <= 23 && min <= 59 && sec < 60) return true;
|
|
7248
|
+
const utcMin = min - tzM * tzSign;
|
|
7249
|
+
const utcHr = hr - tzH * tzSign - (utcMin < 0 ? 1 : 0);
|
|
7250
|
+
return (utcHr === 23 || utcHr === -1) && (utcMin === 59 || utcMin === -1) && sec < 61;
|
|
7251
|
+
};
|
|
7239
7252
|
}
|
|
7240
|
-
function compareTime(
|
|
7253
|
+
function compareTime(s1, s2) {
|
|
7254
|
+
if (!(s1 && s2)) return void 0;
|
|
7255
|
+
const t1 = (/* @__PURE__ */ new Date("2020-01-01T" + s1)).valueOf();
|
|
7256
|
+
const t2 = (/* @__PURE__ */ new Date("2020-01-01T" + s2)).valueOf();
|
|
7257
|
+
if (!(t1 && t2)) return void 0;
|
|
7258
|
+
return t1 - t2;
|
|
7259
|
+
}
|
|
7260
|
+
function compareIsoTime(t1, t2) {
|
|
7241
7261
|
if (!(t1 && t2)) return void 0;
|
|
7242
7262
|
const a1 = TIME.exec(t1);
|
|
7243
7263
|
const a2 = TIME.exec(t2);
|
|
7244
7264
|
if (!(a1 && a2)) return void 0;
|
|
7245
|
-
t1 = a1[1] + a1[2] + a1[3]
|
|
7246
|
-
t2 = a2[1] + a2[2] + a2[3]
|
|
7265
|
+
t1 = a1[1] + a1[2] + a1[3];
|
|
7266
|
+
t2 = a2[1] + a2[2] + a2[3];
|
|
7247
7267
|
if (t1 > t2) return 1;
|
|
7248
7268
|
if (t1 < t2) return -1;
|
|
7249
7269
|
return 0;
|
|
7250
7270
|
}
|
|
7251
7271
|
var DATE_TIME_SEPARATOR = /t|\s/i;
|
|
7252
|
-
function
|
|
7253
|
-
const
|
|
7254
|
-
return
|
|
7272
|
+
function getDateTime(strictTimeZone) {
|
|
7273
|
+
const time = getTime(strictTimeZone);
|
|
7274
|
+
return function date_time(str) {
|
|
7275
|
+
const dateTime = str.split(DATE_TIME_SEPARATOR);
|
|
7276
|
+
return dateTime.length === 2 && date(dateTime[0]) && time(dateTime[1]);
|
|
7277
|
+
};
|
|
7255
7278
|
}
|
|
7256
7279
|
function compareDateTime(dt1, dt2) {
|
|
7280
|
+
if (!(dt1 && dt2)) return void 0;
|
|
7281
|
+
const d1 = new Date(dt1).valueOf();
|
|
7282
|
+
const d2 = new Date(dt2).valueOf();
|
|
7283
|
+
if (!(d1 && d2)) return void 0;
|
|
7284
|
+
return d1 - d2;
|
|
7285
|
+
}
|
|
7286
|
+
function compareIsoDateTime(dt1, dt2) {
|
|
7257
7287
|
if (!(dt1 && dt2)) return void 0;
|
|
7258
7288
|
const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR);
|
|
7259
7289
|
const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR);
|
|
@@ -7327,8 +7357,8 @@ var require_limit = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7327
7357
|
schemaType: "string",
|
|
7328
7358
|
$data: true,
|
|
7329
7359
|
error: {
|
|
7330
|
-
message: ({ keyword, schemaCode }) => codegen_1.str`should be ${KWDs[keyword].okStr} ${schemaCode}`,
|
|
7331
|
-
params: ({ keyword, schemaCode }) => codegen_1._`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`
|
|
7360
|
+
message: ({ keyword, schemaCode }) => (0, codegen_1.str)`should be ${KWDs[keyword].okStr} ${schemaCode}`,
|
|
7361
|
+
params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`
|
|
7332
7362
|
},
|
|
7333
7363
|
code(cxt) {
|
|
7334
7364
|
const { gen, data, schemaCode, keyword, it } = cxt;
|
|
@@ -7342,8 +7372,8 @@ var require_limit = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7342
7372
|
ref: self.formats,
|
|
7343
7373
|
code: opts.code.formats
|
|
7344
7374
|
});
|
|
7345
|
-
const fmt = gen.const("fmt", codegen_1._`${fmts}[${fCxt.schemaCode}]`);
|
|
7346
|
-
cxt.fail$data(codegen_1.or(codegen_1._`typeof ${fmt} != "object"`, codegen_1._`${fmt} instanceof RegExp`, codegen_1._`typeof ${fmt}.compare != "function"`, compareCode(fmt)));
|
|
7375
|
+
const fmt = gen.const("fmt", (0, codegen_1._)`${fmts}[${fCxt.schemaCode}]`);
|
|
7376
|
+
cxt.fail$data((0, codegen_1.or)((0, codegen_1._)`typeof ${fmt} != "object"`, (0, codegen_1._)`${fmt} instanceof RegExp`, (0, codegen_1._)`typeof ${fmt}.compare != "function"`, compareCode(fmt)));
|
|
7347
7377
|
}
|
|
7348
7378
|
function validateFormat() {
|
|
7349
7379
|
const format = fCxt.schema;
|
|
@@ -7353,12 +7383,12 @@ var require_limit = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7353
7383
|
const fmt = gen.scopeValue("formats", {
|
|
7354
7384
|
key: format,
|
|
7355
7385
|
ref: fmtDef,
|
|
7356
|
-
code: opts.code.formats ? codegen_1._`${opts.code.formats}${codegen_1.getProperty(format)}` : void 0
|
|
7386
|
+
code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(format)}` : void 0
|
|
7357
7387
|
});
|
|
7358
7388
|
cxt.fail$data(compareCode(fmt));
|
|
7359
7389
|
}
|
|
7360
7390
|
function compareCode(fmt) {
|
|
7361
|
-
return codegen_1._`${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword].fail} 0`;
|
|
7391
|
+
return (0, codegen_1._)`${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword].fail} 0`;
|
|
7362
7392
|
}
|
|
7363
7393
|
},
|
|
7364
7394
|
dependencies: ["format"]
|
|
@@ -7383,7 +7413,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7383
7413
|
}
|
|
7384
7414
|
const [formats, exportName] = opts.mode === "fast" ? [formats_1.fastFormats, fastName] : [formats_1.fullFormats, fullName];
|
|
7385
7415
|
addFormats(ajv, opts.formats || formats_1.formatNames, formats, exportName);
|
|
7386
|
-
if (opts.keywords) limit_1.default(ajv);
|
|
7416
|
+
if (opts.keywords) (0, limit_1.default)(ajv);
|
|
7387
7417
|
return ajv;
|
|
7388
7418
|
};
|
|
7389
7419
|
formatsPlugin.get = (name, mode = "full") => {
|
|
@@ -7394,7 +7424,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7394
7424
|
function addFormats(ajv, list, fs, exportName) {
|
|
7395
7425
|
var _a;
|
|
7396
7426
|
var _b;
|
|
7397
|
-
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 || (_b.formats = codegen_1._`require("ajv-formats/dist/formats").${exportName}`);
|
|
7427
|
+
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 || (_b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
|
|
7398
7428
|
for (const f of list) ajv.addFormat(f, fs[f]);
|
|
7399
7429
|
}
|
|
7400
7430
|
module.exports = exports = formatsPlugin;
|
|
@@ -7418,16 +7448,10 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7418
7448
|
var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
|
|
7419
7449
|
/** @type {(value: string) => boolean} */
|
|
7420
7450
|
var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
}
|
|
7426
|
-
function percentEncodeNonAscii(cp) {
|
|
7427
|
-
if (cp < 2048) return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
|
|
7428
|
-
if (cp < 65536) return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
|
|
7429
|
-
return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
|
|
7430
|
-
}
|
|
7451
|
+
/** @type {(value: string) => boolean} */
|
|
7452
|
+
var isRegNameCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=]$/u);
|
|
7453
|
+
/** @type {(value: string) => boolean} */
|
|
7454
|
+
var isLiteralRegName = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=]*$/u);
|
|
7431
7455
|
/**
|
|
7432
7456
|
* @param {Array<string>} input
|
|
7433
7457
|
* @returns {string}
|
|
@@ -7461,6 +7485,27 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7461
7485
|
* @returns {boolean}
|
|
7462
7486
|
*/
|
|
7463
7487
|
var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
|
|
7488
|
+
/** @type {(value: string) => boolean} */
|
|
7489
|
+
var nonSimpleDomainChars = RegExp.prototype.test.bind(/[^\d!"$&'()*+,\-.;=_`a-z{}~]/u);
|
|
7490
|
+
/** @type {(value: string) => boolean} */
|
|
7491
|
+
var numericLastLabel = RegExp.prototype.test.bind(/(?:^|\.)\d+$/u);
|
|
7492
|
+
/**
|
|
7493
|
+
* True when `new URL('http://' + domain).hostname` may differ from `domain`,
|
|
7494
|
+
* i.e. when the caller must fall back to the WHATWG parser.
|
|
7495
|
+
*
|
|
7496
|
+
* Same purpose as `nonSimpleDomain`, but digits are allowed: for this character
|
|
7497
|
+
* set `hostname` is the identity, *except* that an all-numeric final label is
|
|
7498
|
+
* read as IPv4 shorthand ("1.2.3" -> "1.2.0.3", "127.1" -> "127.0.0.1",
|
|
7499
|
+
* "a.b.1" throws), which is why `nonSimpleDomain` excludes digits outright.
|
|
7500
|
+
* Rejecting that one shape lets the common `mail2.example.org` case stay on the
|
|
7501
|
+
* fast path.
|
|
7502
|
+
*
|
|
7503
|
+
* @param {string} domain - must already be lowercased
|
|
7504
|
+
* @returns {boolean}
|
|
7505
|
+
*/
|
|
7506
|
+
function nonSimpleMailtoDomain(domain) {
|
|
7507
|
+
return nonSimpleDomainChars(domain) || numericLastLabel(domain);
|
|
7508
|
+
}
|
|
7464
7509
|
/**
|
|
7465
7510
|
* @param {string} zone
|
|
7466
7511
|
* @returns {boolean}
|
|
@@ -7647,7 +7692,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7647
7692
|
continue;
|
|
7648
7693
|
}
|
|
7649
7694
|
} else if (input[0] === "/") {
|
|
7650
|
-
if (input[1] === "."
|
|
7695
|
+
if (input[1] === ".") {
|
|
7651
7696
|
output.push("/");
|
|
7652
7697
|
break;
|
|
7653
7698
|
}
|
|
@@ -7726,28 +7771,30 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7726
7771
|
return output.join("/");
|
|
7727
7772
|
}
|
|
7728
7773
|
/**
|
|
7729
|
-
*
|
|
7730
|
-
*
|
|
7731
|
-
*
|
|
7732
|
-
*
|
|
7774
|
+
* Encodes a host according to the RFC 3986 host grammar. Valid IP literals
|
|
7775
|
+
* have already been checked by `normalizeIPv6`, so their address separators
|
|
7776
|
+
* remain literal. Every other host is a reg-name and may contain only
|
|
7777
|
+
* unreserved characters, sub-delimiters, and valid percent escapes.
|
|
7733
7778
|
*
|
|
7734
7779
|
* @param {string} host
|
|
7735
|
-
* @param {boolean} isIP - true for IPv4/IPv6
|
|
7780
|
+
* @param {boolean} isIP - true for a validated IPv4/IPv6 host
|
|
7781
|
+
* @param {boolean} [allowNonAscii=false] - preserve non-ASCII IRI characters
|
|
7736
7782
|
* @returns {string}
|
|
7737
7783
|
*/
|
|
7738
|
-
var
|
|
7784
|
+
var IP_HOST_DELIMS = {
|
|
7739
7785
|
"@": "%40",
|
|
7740
7786
|
"/": "%2F",
|
|
7741
7787
|
"?": "%3F",
|
|
7742
|
-
"#": "%23"
|
|
7743
|
-
":": "%3A"
|
|
7788
|
+
"#": "%23"
|
|
7744
7789
|
};
|
|
7745
|
-
var
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7790
|
+
var IP_HOST_DELIM_RE = /[@/?#]/g;
|
|
7791
|
+
function encodeHost(host, isIP, allowNonAscii = false) {
|
|
7792
|
+
if (!isIP) {
|
|
7793
|
+
if (isLiteralRegName(host)) return host;
|
|
7794
|
+
return encodeComponent(host, isRegNameCharacter, allowNonAscii);
|
|
7795
|
+
}
|
|
7796
|
+
IP_HOST_DELIM_RE.lastIndex = 0;
|
|
7797
|
+
return host.replace(IP_HOST_DELIM_RE, (ch) => IP_HOST_DELIMS[ch]);
|
|
7751
7798
|
}
|
|
7752
7799
|
/**
|
|
7753
7800
|
* Normalizes percent escapes and optionally decodes only unreserved ASCII bytes.
|
|
@@ -7776,6 +7823,34 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7776
7823
|
}
|
|
7777
7824
|
return output;
|
|
7778
7825
|
}
|
|
7826
|
+
/** Pre-built `%XX` strings for every byte. Avoids per-call hex math/concat. */
|
|
7827
|
+
var BYTE_HEX = new Array(256);
|
|
7828
|
+
{
|
|
7829
|
+
const HEX_DIGITS = "0123456789ABCDEF";
|
|
7830
|
+
for (let i = 0; i < 256; i++) BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
|
|
7831
|
+
}
|
|
7832
|
+
/**
|
|
7833
|
+
* Mirrors the pass-through set of the deprecated `escape()` global:
|
|
7834
|
+
* `A-Z a-z 0-9 * + - . / @ _`. Keeps drop-in semantics for ASCII input.
|
|
7835
|
+
*
|
|
7836
|
+
* @param {number} cp
|
|
7837
|
+
* @returns {boolean}
|
|
7838
|
+
*/
|
|
7839
|
+
function isEscapeSafe(cp) {
|
|
7840
|
+
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;
|
|
7841
|
+
}
|
|
7842
|
+
/**
|
|
7843
|
+
* RFC 3986 percent-encode a non-ASCII Unicode code point as UTF-8 bytes.
|
|
7844
|
+
* Caller handles the ASCII branch inline for speed.
|
|
7845
|
+
*
|
|
7846
|
+
* @param {number} cp - Unicode code point (>= 0x80, <= 0x10FFFF)
|
|
7847
|
+
* @returns {string}
|
|
7848
|
+
*/
|
|
7849
|
+
function percentEncodeNonAscii(cp) {
|
|
7850
|
+
if (cp < 2048) return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
|
|
7851
|
+
if (cp < 65536) return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
|
|
7852
|
+
return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
|
|
7853
|
+
}
|
|
7779
7854
|
/**
|
|
7780
7855
|
* Normalizes path data without turning reserved escapes into live path syntax.
|
|
7781
7856
|
* Valid escapes are uppercased, raw unsafe characters are escaped, and only
|
|
@@ -7856,14 +7931,56 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7856
7931
|
return output;
|
|
7857
7932
|
}
|
|
7858
7933
|
/**
|
|
7934
|
+
* Normalizes the percent-encoding of a query or fragment component.
|
|
7935
|
+
*
|
|
7936
|
+
* Like `normalizePathEncoding`, but uses the query/fragment character set
|
|
7937
|
+
* (which additionally allows `?`) and decodes `.` since it has no dot-segment
|
|
7938
|
+
* meaning outside of a path.
|
|
7939
|
+
*
|
|
7940
|
+
* @param {string} input
|
|
7941
|
+
* @returns {string}
|
|
7942
|
+
*/
|
|
7943
|
+
function normalizeQueryFragmentEncoding(input) {
|
|
7944
|
+
let output = "";
|
|
7945
|
+
for (let i = 0; i < input.length; i++) {
|
|
7946
|
+
const ch = input[i];
|
|
7947
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
7948
|
+
const hex = input.slice(i + 1, i + 3);
|
|
7949
|
+
if (isHexPair(hex)) {
|
|
7950
|
+
const normalizedHex = hex.toUpperCase();
|
|
7951
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
7952
|
+
if (isUnreserved(decoded)) output += decoded;
|
|
7953
|
+
else output += "%" + normalizedHex;
|
|
7954
|
+
i += 2;
|
|
7955
|
+
continue;
|
|
7956
|
+
}
|
|
7957
|
+
}
|
|
7958
|
+
if (isQueryFragmentCharacter(ch)) output += ch;
|
|
7959
|
+
else {
|
|
7960
|
+
const code = input.charCodeAt(i);
|
|
7961
|
+
if (code < 128) output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
|
|
7962
|
+
else if (code < 55296 || code > 57343) output += percentEncodeNonAscii(code);
|
|
7963
|
+
else if (code <= 56319 && i + 1 < input.length) {
|
|
7964
|
+
const low = input.charCodeAt(i + 1);
|
|
7965
|
+
if (low >= 56320 && low <= 57343) {
|
|
7966
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
7967
|
+
i++;
|
|
7968
|
+
} else output += percentEncodeNonAscii(65533);
|
|
7969
|
+
} else output += percentEncodeNonAscii(65533);
|
|
7970
|
+
}
|
|
7971
|
+
}
|
|
7972
|
+
return output;
|
|
7973
|
+
}
|
|
7974
|
+
/**
|
|
7859
7975
|
* Percent-encodes a URI component using its RFC 3986 literal character set.
|
|
7860
7976
|
* Existing valid escapes are preserved and normalized to uppercase hex.
|
|
7861
7977
|
*
|
|
7862
7978
|
* @param {string} input
|
|
7863
7979
|
* @param {(value: string) => boolean} isAllowed
|
|
7980
|
+
* @param {boolean} [allowNonAscii=false]
|
|
7864
7981
|
* @returns {string}
|
|
7865
7982
|
*/
|
|
7866
|
-
function encodeComponent(input, isAllowed) {
|
|
7983
|
+
function encodeComponent(input, isAllowed, allowNonAscii = false) {
|
|
7867
7984
|
let output = "";
|
|
7868
7985
|
for (let i = 0; i < input.length; i++) {
|
|
7869
7986
|
const ch = input[i];
|
|
@@ -7879,14 +7996,14 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7879
7996
|
else {
|
|
7880
7997
|
const code = input.charCodeAt(i);
|
|
7881
7998
|
if (code < 128) output += BYTE_HEX[code];
|
|
7882
|
-
else if (code < 55296 || code > 57343) output += percentEncodeNonAscii(code);
|
|
7999
|
+
else if (code < 55296 || code > 57343) output += allowNonAscii ? ch : percentEncodeNonAscii(code);
|
|
7883
8000
|
else if (code <= 56319 && i + 1 < input.length) {
|
|
7884
8001
|
const low = input.charCodeAt(i + 1);
|
|
7885
8002
|
if (low >= 56320 && low <= 57343) {
|
|
7886
|
-
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
8003
|
+
output += allowNonAscii ? ch + input[i + 1] : percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
7887
8004
|
i++;
|
|
7888
|
-
} else output += percentEncodeNonAscii(65533);
|
|
7889
|
-
} else output += percentEncodeNonAscii(65533);
|
|
8005
|
+
} else output += allowNonAscii ? "�" : percentEncodeNonAscii(65533);
|
|
8006
|
+
} else output += allowNonAscii ? "�" : percentEncodeNonAscii(65533);
|
|
7890
8007
|
}
|
|
7891
8008
|
}
|
|
7892
8009
|
return output;
|
|
@@ -7920,76 +8037,65 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7920
8037
|
function encodeFragment(input) {
|
|
7921
8038
|
return encodeComponent(input, isQueryFragmentCharacter);
|
|
7922
8039
|
}
|
|
7923
|
-
function isEscapeSafe(cp) {
|
|
7924
|
-
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;
|
|
7925
|
-
}
|
|
7926
8040
|
/**
|
|
7927
|
-
*
|
|
7928
|
-
*
|
|
7929
|
-
* Like `normalizePathEncoding`, but uses the query/fragment character set
|
|
7930
|
-
* (which additionally allows `?`) and decodes `.` since it has no dot-segment
|
|
7931
|
-
* meaning outside of a path.
|
|
8041
|
+
* Escapes a component while preserving existing valid percent escapes.
|
|
7932
8042
|
*
|
|
7933
8043
|
* @param {string} input
|
|
7934
8044
|
* @returns {string}
|
|
7935
8045
|
*/
|
|
7936
|
-
function
|
|
8046
|
+
function escapePreservingEscapes(input) {
|
|
7937
8047
|
let output = "";
|
|
7938
8048
|
for (let i = 0; i < input.length; i++) {
|
|
7939
8049
|
const ch = input[i];
|
|
7940
8050
|
if (ch === "%" && i + 2 < input.length) {
|
|
7941
8051
|
const hex = input.slice(i + 1, i + 3);
|
|
7942
8052
|
if (isHexPair(hex)) {
|
|
7943
|
-
|
|
7944
|
-
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
7945
|
-
if (isUnreserved(decoded)) output += decoded;
|
|
7946
|
-
else output += "%" + normalizedHex;
|
|
8053
|
+
output += "%" + hex.toUpperCase();
|
|
7947
8054
|
i += 2;
|
|
7948
8055
|
continue;
|
|
7949
8056
|
}
|
|
7950
8057
|
}
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
7960
|
-
i++;
|
|
7961
|
-
} else output += percentEncodeNonAscii(65533);
|
|
8058
|
+
const code = input.charCodeAt(i);
|
|
8059
|
+
if (code < 128) output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
|
|
8060
|
+
else if (code < 55296 || code > 57343) output += percentEncodeNonAscii(code);
|
|
8061
|
+
else if (code <= 56319 && i + 1 < input.length) {
|
|
8062
|
+
const low = input.charCodeAt(i + 1);
|
|
8063
|
+
if (low >= 56320 && low <= 57343) {
|
|
8064
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
8065
|
+
i++;
|
|
7962
8066
|
} else output += percentEncodeNonAscii(65533);
|
|
7963
|
-
}
|
|
8067
|
+
} else output += percentEncodeNonAscii(65533);
|
|
7964
8068
|
}
|
|
7965
8069
|
return output;
|
|
7966
8070
|
}
|
|
7967
8071
|
/**
|
|
7968
|
-
*
|
|
8072
|
+
* Rebuilds the bracketed form of a zoned IPv6 authority from the current
|
|
8073
|
+
* `component.host` and its zone identifier (`component.ipv6Zone`), but only
|
|
8074
|
+
* when they are consistent and describe a real zoned IPv6 literal that
|
|
8075
|
+
* normalizes back to `component.host`. This validates the zone on use, so a
|
|
8076
|
+
* caller-supplied `ipv6Zone` that does not match the host (or a host
|
|
8077
|
+
* reassigned after `parse`) is never trusted and recomposition falls back to
|
|
8078
|
+
* the normal path.
|
|
7969
8079
|
*
|
|
7970
|
-
* @param {
|
|
7971
|
-
* @returns {string}
|
|
8080
|
+
* @param {import('../types/index').URIComponent} component
|
|
8081
|
+
* @returns {string|undefined}
|
|
7972
8082
|
*/
|
|
7973
|
-
function
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
}
|
|
7983
|
-
}
|
|
7984
|
-
output += escape(input[i]);
|
|
7985
|
-
}
|
|
7986
|
-
return output;
|
|
8083
|
+
function recomposeZonedIPv6Host(component) {
|
|
8084
|
+
const zone = component.ipv6Zone;
|
|
8085
|
+
if (zone === void 0) return void 0;
|
|
8086
|
+
const host = component.host;
|
|
8087
|
+
const separator = host.indexOf("%");
|
|
8088
|
+
if (separator === -1) return void 0;
|
|
8089
|
+
const escaped = host.slice(0, separator) + "%25" + zone;
|
|
8090
|
+
const derived = normalizeIPv6("[" + escaped + "]");
|
|
8091
|
+
if (derived.isIPV6 === true && derived.host === host) return "[" + escaped + "]";
|
|
7987
8092
|
}
|
|
7988
8093
|
/**
|
|
7989
8094
|
* @param {import('../types/index').URIComponent} component
|
|
8095
|
+
* @param {boolean} [allowNonAscii=false] - preserve non-ASCII IRI characters
|
|
7990
8096
|
* @returns {string|undefined}
|
|
7991
8097
|
*/
|
|
7992
|
-
function recomposeAuthority(component) {
|
|
8098
|
+
function recomposeAuthority(component, allowNonAscii = false) {
|
|
7993
8099
|
const uriTokens = [];
|
|
7994
8100
|
if (component.userinfo !== void 0) {
|
|
7995
8101
|
uriTokens.push(encodeUserinfo(component.userinfo));
|
|
@@ -7998,13 +8104,17 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7998
8104
|
if (component.host !== void 0) {
|
|
7999
8105
|
let host = component.host;
|
|
8000
8106
|
if (!isIPv4(host)) {
|
|
8001
|
-
|
|
8002
|
-
if (
|
|
8003
|
-
|
|
8004
|
-
ipV6res = normalizeIPv6(host);
|
|
8107
|
+
const zonedHost = recomposeZonedIPv6Host(component);
|
|
8108
|
+
if (zonedHost !== void 0) host = zonedHost;
|
|
8109
|
+
else {
|
|
8110
|
+
let ipV6res = normalizeIPv6(host);
|
|
8111
|
+
if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
|
|
8112
|
+
host = normalizePercentEncoding(host, true);
|
|
8113
|
+
ipV6res = normalizeIPv6(host);
|
|
8114
|
+
}
|
|
8115
|
+
if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) host = `[${ipV6res.escapedHost}]`;
|
|
8116
|
+
else host = encodeHost(host, false, allowNonAscii);
|
|
8005
8117
|
}
|
|
8006
|
-
if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) host = `[${ipV6res.escapedHost}]`;
|
|
8007
|
-
else host = reescapeHostDelimiters(host, false);
|
|
8008
8118
|
}
|
|
8009
8119
|
uriTokens.push(host);
|
|
8010
8120
|
}
|
|
@@ -8017,9 +8127,12 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8017
8127
|
return uriTokens.length ? uriTokens.join("") : void 0;
|
|
8018
8128
|
}
|
|
8019
8129
|
module.exports = {
|
|
8130
|
+
BYTE_HEX,
|
|
8131
|
+
percentEncodeNonAscii,
|
|
8020
8132
|
nonSimpleDomain,
|
|
8133
|
+
nonSimpleMailtoDomain,
|
|
8021
8134
|
recomposeAuthority,
|
|
8022
|
-
|
|
8135
|
+
encodeHost,
|
|
8023
8136
|
normalizePercentEncoding,
|
|
8024
8137
|
normalizePathEncoding,
|
|
8025
8138
|
serializePathEncoding,
|
|
@@ -8037,7 +8150,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8037
8150
|
};
|
|
8038
8151
|
}));
|
|
8039
8152
|
var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
8040
|
-
var { isUUID } = require_utils();
|
|
8153
|
+
var { isUUID, BYTE_HEX, percentEncodeNonAscii, nonSimpleMailtoDomain } = require_utils();
|
|
8041
8154
|
var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
|
|
8042
8155
|
var supportedSchemeNames = [
|
|
8043
8156
|
"http",
|
|
@@ -8045,7 +8158,8 @@ var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8045
8158
|
"ws",
|
|
8046
8159
|
"wss",
|
|
8047
8160
|
"urn",
|
|
8048
|
-
"urn:uuid"
|
|
8161
|
+
"urn:uuid",
|
|
8162
|
+
"mailto"
|
|
8049
8163
|
];
|
|
8050
8164
|
/** @typedef {supportedSchemeNames[number]} SchemeName */
|
|
8051
8165
|
/**
|
|
@@ -8180,27 +8294,333 @@ var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8180
8294
|
parse: wsParse,
|
|
8181
8295
|
serialize: wsSerialize
|
|
8182
8296
|
};
|
|
8297
|
+
var wss = {
|
|
8298
|
+
scheme: "wss",
|
|
8299
|
+
domainHost: ws.domainHost,
|
|
8300
|
+
parse: ws.parse,
|
|
8301
|
+
serialize: ws.serialize
|
|
8302
|
+
};
|
|
8303
|
+
var urn = {
|
|
8304
|
+
scheme: "urn",
|
|
8305
|
+
parse: urnParse,
|
|
8306
|
+
serialize: urnSerialize,
|
|
8307
|
+
skipNormalize: true,
|
|
8308
|
+
absolutePath: true
|
|
8309
|
+
};
|
|
8310
|
+
var urnuuid = {
|
|
8311
|
+
scheme: "urn:uuid",
|
|
8312
|
+
parse: urnuuidParse,
|
|
8313
|
+
serialize: urnuuidSerialize,
|
|
8314
|
+
skipNormalize: true
|
|
8315
|
+
};
|
|
8316
|
+
/**
|
|
8317
|
+
* Allow-sets for `encodeWithAllow`, each a `{ all, table, allowNonAscii }`
|
|
8318
|
+
* descriptor built by `allowSet`:
|
|
8319
|
+
*
|
|
8320
|
+
* - `LOCAL_PART` is the intersection of upstream uri-js's VCHAR and
|
|
8321
|
+
* NOT_PATH_NOSCHEME, minus ",": the serializer joins recipients with "," and
|
|
8322
|
+
* `mailtoParse` splits the path on it, so a comma left literal inside a local
|
|
8323
|
+
* part would silently become a recipient delimiter.
|
|
8324
|
+
* - `HFNAME` is the qchar allow-set used for header names/values.
|
|
8325
|
+
* - `DTEXT` is RFC 6068 dtext-no-obs restricted to characters that are also
|
|
8326
|
+
* safe in a URI path; `DTEXT_IRI` additionally permits non-ASCII for
|
|
8327
|
+
* `unicodeSupport`.
|
|
8328
|
+
*/
|
|
8329
|
+
var LOCAL_PART_ALLOWED = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+=";
|
|
8330
|
+
var HFNAME_ALLOWED = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+,;:@";
|
|
8331
|
+
var DTEXT_ALLOWED = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+;:";
|
|
8332
|
+
/**
|
|
8333
|
+
* @typedef {Object} AllowSet
|
|
8334
|
+
* @property {RegExp} all - matches a whole string needing no encoding at all.
|
|
8335
|
+
* @property {Uint8Array} table - per-ASCII-code allow lookup for the slow path.
|
|
8336
|
+
* @property {boolean} allowNonAscii - pass non-ASCII code points through (IRI).
|
|
8337
|
+
*/
|
|
8338
|
+
/**
|
|
8339
|
+
* `all` deliberately excludes "%" and (for the IRI variant) surrogates, so any
|
|
8340
|
+
* input needing escape normalization or surrogate repair falls to the slow path.
|
|
8341
|
+
*
|
|
8342
|
+
* @param {string} chars
|
|
8343
|
+
* @param {boolean} [allowNonAscii=false]
|
|
8344
|
+
* @returns {AllowSet}
|
|
8345
|
+
*/
|
|
8346
|
+
function allowSet(chars, allowNonAscii = false) {
|
|
8347
|
+
const table = /* @__PURE__ */ new Uint8Array(128);
|
|
8348
|
+
for (let i = 0; i < chars.length; i++) table[chars.charCodeAt(i)] = 1;
|
|
8349
|
+
const escaped = chars.replace(/[\\\]^-]/gu, "\\$&");
|
|
8350
|
+
const cls = allowNonAscii ? `[${escaped}]|[^\\0-\\x7F\\uD800-\\uDFFF]` : `[${escaped}]`;
|
|
8351
|
+
return {
|
|
8352
|
+
all: new RegExp(`^(?:${cls})*$`, "u"),
|
|
8353
|
+
table,
|
|
8354
|
+
allowNonAscii
|
|
8355
|
+
};
|
|
8356
|
+
}
|
|
8357
|
+
var LOCAL_PART = allowSet(LOCAL_PART_ALLOWED);
|
|
8358
|
+
var HFNAME = allowSet(HFNAME_ALLOWED);
|
|
8359
|
+
var DTEXT = allowSet(DTEXT_ALLOWED);
|
|
8360
|
+
var DTEXT_IRI = allowSet(DTEXT_ALLOWED, true);
|
|
8361
|
+
var HEX_PAIR = /^[\da-f]{2}$/iu;
|
|
8362
|
+
var MAILTO_DOMAIN_LITERAL = /^\[[\x21-\x5A\x5E-\x7E]*\]$/u;
|
|
8363
|
+
var MAILTO_DOMAIN_ERROR = "URI mailto has an invalid recipient domain.";
|
|
8364
|
+
var MAILTO_AUTHORITY_ERROR = "URI mailto must not have an authority component.";
|
|
8365
|
+
var HAS_SURROGATE = /[\uD800-\uDFFF]/u;
|
|
8366
|
+
/**
|
|
8367
|
+
* @param {string} str
|
|
8368
|
+
* @returns {string}
|
|
8369
|
+
*/
|
|
8370
|
+
function decodeHex(str) {
|
|
8371
|
+
if (typeof str !== "string" || str.indexOf("%") === -1) return str;
|
|
8372
|
+
try {
|
|
8373
|
+
return decodeURIComponent(str);
|
|
8374
|
+
} catch {
|
|
8375
|
+
return str;
|
|
8376
|
+
}
|
|
8377
|
+
}
|
|
8378
|
+
/**
|
|
8379
|
+
* Replaces lone surrogates with U+FFFD, leaving valid pairs intact. Only called
|
|
8380
|
+
* when `HAS_SURROGATE` matched, so the scan cost is not on the common path.
|
|
8381
|
+
* (`String.prototype.toWellFormed` would do this natively but is Node 20+.)
|
|
8382
|
+
*
|
|
8383
|
+
* @param {string} input
|
|
8384
|
+
* @returns {string}
|
|
8385
|
+
*/
|
|
8386
|
+
function replaceLoneSurrogates(input) {
|
|
8387
|
+
let result = "";
|
|
8388
|
+
for (let i = 0; i < input.length; i++) {
|
|
8389
|
+
const code = input.charCodeAt(i);
|
|
8390
|
+
if (code >= 55296 && code <= 56319 && i + 1 < input.length) {
|
|
8391
|
+
const low = input.charCodeAt(i + 1);
|
|
8392
|
+
if (low >= 56320 && low <= 57343) {
|
|
8393
|
+
result += input[i] + input[i + 1];
|
|
8394
|
+
i++;
|
|
8395
|
+
continue;
|
|
8396
|
+
}
|
|
8397
|
+
}
|
|
8398
|
+
result += code >= 55296 && code <= 57343 ? "�" : input[i];
|
|
8399
|
+
}
|
|
8400
|
+
return result;
|
|
8401
|
+
}
|
|
8402
|
+
/**
|
|
8403
|
+
* Percent-encodes everything outside `set`, preserving existing valid escapes
|
|
8404
|
+
* (uppercased) and repairing lone surrogates.
|
|
8405
|
+
*
|
|
8406
|
+
* ASCII uses `BYTE_HEX` rather than `encodeURIComponent`. That is equivalent
|
|
8407
|
+
* only because every character `encodeURIComponent` leaves unescaped
|
|
8408
|
+
* (`A-Za-z0-9-_.!~*'()`) is present in all of the allow-sets above, so no such
|
|
8409
|
+
* character ever reaches the encode branch. Re-check if a set is narrowed.
|
|
8410
|
+
*
|
|
8411
|
+
* @param {string} input
|
|
8412
|
+
* @param {AllowSet} set
|
|
8413
|
+
* @returns {string}
|
|
8414
|
+
*/
|
|
8415
|
+
function encodeWithAllow(input, set) {
|
|
8416
|
+
if (set.all.test(input)) return input;
|
|
8417
|
+
const table = set.table;
|
|
8418
|
+
let result = "";
|
|
8419
|
+
for (let i = 0; i < input.length; i++) {
|
|
8420
|
+
const code = input.charCodeAt(i);
|
|
8421
|
+
if (code < 128) {
|
|
8422
|
+
if (table[code] === 1) result += input[i];
|
|
8423
|
+
else if (code === 37 && i + 2 < input.length && HEX_PAIR.test(input.slice(i + 1, i + 3))) {
|
|
8424
|
+
result += "%" + input.slice(i + 1, i + 3).toUpperCase();
|
|
8425
|
+
i += 2;
|
|
8426
|
+
} else result += BYTE_HEX[code];
|
|
8427
|
+
continue;
|
|
8428
|
+
}
|
|
8429
|
+
if (code < 55296 || code > 57343) {
|
|
8430
|
+
result += set.allowNonAscii ? input[i] : percentEncodeNonAscii(code);
|
|
8431
|
+
continue;
|
|
8432
|
+
}
|
|
8433
|
+
if (code <= 56319 && i + 1 < input.length) {
|
|
8434
|
+
const low = input.charCodeAt(i + 1);
|
|
8435
|
+
if (low >= 56320 && low <= 57343) {
|
|
8436
|
+
result += set.allowNonAscii ? input[i] + input[i + 1] : percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
8437
|
+
i++;
|
|
8438
|
+
continue;
|
|
8439
|
+
}
|
|
8440
|
+
}
|
|
8441
|
+
result += set.allowNonAscii ? "�" : percentEncodeNonAscii(65533);
|
|
8442
|
+
}
|
|
8443
|
+
return result;
|
|
8444
|
+
}
|
|
8445
|
+
/**
|
|
8446
|
+
* @param {string} domain
|
|
8447
|
+
* @param {import('../types/index').Options} [options]
|
|
8448
|
+
* @param {{error?:string}} [component]
|
|
8449
|
+
* @returns {string}
|
|
8450
|
+
*/
|
|
8451
|
+
function mailtoNormalizeDomain(domain, options, component) {
|
|
8452
|
+
const normalizedDomain = String(domain).toLowerCase();
|
|
8453
|
+
if (MAILTO_DOMAIN_LITERAL.test(normalizedDomain)) return normalizedDomain;
|
|
8454
|
+
if (normalizedDomain !== "" && !nonSimpleMailtoDomain(normalizedDomain)) return normalizedDomain;
|
|
8455
|
+
try {
|
|
8456
|
+
const parsedDomain = new URL("http://" + normalizedDomain);
|
|
8457
|
+
if (parsedDomain.username || parsedDomain.password || parsedDomain.port || parsedDomain.pathname !== "/" || parsedDomain.search || parsedDomain.hash || !parsedDomain.hostname) throw new Error(MAILTO_DOMAIN_ERROR);
|
|
8458
|
+
return options && options.unicodeSupport ? normalizedDomain : parsedDomain.hostname;
|
|
8459
|
+
} catch {
|
|
8460
|
+
if (component) component.error = component.error || MAILTO_DOMAIN_ERROR;
|
|
8461
|
+
return normalizedDomain;
|
|
8462
|
+
}
|
|
8463
|
+
}
|
|
8464
|
+
/**
|
|
8465
|
+
* Percent-encodes everything in a recipient domain that is not `dtext-no-obs`
|
|
8466
|
+
* (RFC 6068). Serialize-only: `mailtoNormalizeDomain` returns the domain
|
|
8467
|
+
* verbatim when validation fails, and `MAILTO_DOMAIN_LITERAL` accepts the full
|
|
8468
|
+
* RFC 5321 dcontent range (which includes "?", "#", "&" and "/"), so without
|
|
8469
|
+
* this an attacker-supplied recipient could inject header fields or a fragment
|
|
8470
|
+
* into the serialized URI. `mailtoParse` deliberately reports the raw domain
|
|
8471
|
+
* instead, so it must not use this.
|
|
8472
|
+
* @param {string} domain
|
|
8473
|
+
* @param {import('../types/index').Options} [options]
|
|
8474
|
+
* @returns {string}
|
|
8475
|
+
*/
|
|
8476
|
+
function mailtoEncodeDomain(domain, options) {
|
|
8477
|
+
const set = options && options.unicodeSupport ? DTEXT_IRI : DTEXT;
|
|
8478
|
+
if (domain.length > 1 && domain[0] === "[" && domain[domain.length - 1] === "]") return "[" + encodeWithAllow(domain.slice(1, -1), set) + "]";
|
|
8479
|
+
return encodeWithAllow(domain, set);
|
|
8480
|
+
}
|
|
8481
|
+
/**
|
|
8482
|
+
* @param {import('../types/index').URIComponent} component
|
|
8483
|
+
* @param {import('../types/index').Options} options
|
|
8484
|
+
* @returns {import('../types/index').URIComponent}
|
|
8485
|
+
*/
|
|
8486
|
+
function mailtoParse(component, options) {
|
|
8487
|
+
const mailtoComponent = component;
|
|
8488
|
+
let rawPath = mailtoComponent.path;
|
|
8489
|
+
let rawQuery = mailtoComponent.query;
|
|
8490
|
+
if (rawPath && HAS_SURROGATE.test(rawPath)) rawPath = replaceLoneSurrogates(rawPath);
|
|
8491
|
+
if (rawQuery && HAS_SURROGATE.test(rawQuery)) rawQuery = replaceLoneSurrogates(rawQuery);
|
|
8492
|
+
const to = rawPath ? rawPath.indexOf(",") === -1 ? [rawPath] : rawPath.split(",") : [];
|
|
8493
|
+
mailtoComponent.path = void 0;
|
|
8494
|
+
if (rawQuery) {
|
|
8495
|
+
/** @type {Record<string,string>|null} */
|
|
8496
|
+
let headers = null;
|
|
8497
|
+
let start = 0;
|
|
8498
|
+
while (start <= rawQuery.length) {
|
|
8499
|
+
let end = rawQuery.indexOf("&", start);
|
|
8500
|
+
if (end === -1) end = rawQuery.length;
|
|
8501
|
+
const token = rawQuery.slice(start, end);
|
|
8502
|
+
start = end + 1;
|
|
8503
|
+
const eqIdx = token.indexOf("=");
|
|
8504
|
+
if (eqIdx !== token.lastIndexOf("=")) {
|
|
8505
|
+
mailtoComponent.error = mailtoComponent.error || "URI mailto has malformed header fields.";
|
|
8506
|
+
continue;
|
|
8507
|
+
}
|
|
8508
|
+
const name = decodeHex(eqIdx === -1 ? token : token.slice(0, eqIdx));
|
|
8509
|
+
const normalizedName = name.toLowerCase();
|
|
8510
|
+
const value = eqIdx === -1 ? "" : token.slice(eqIdx + 1);
|
|
8511
|
+
if (normalizedName === "to") {
|
|
8512
|
+
const addrs = value.split(",");
|
|
8513
|
+
for (let j = 0; j < addrs.length; j++) to.push(addrs[j]);
|
|
8514
|
+
continue;
|
|
8515
|
+
}
|
|
8516
|
+
if (normalizedName === "subject") {
|
|
8517
|
+
mailtoComponent.subject = decodeHex(value);
|
|
8518
|
+
continue;
|
|
8519
|
+
}
|
|
8520
|
+
if (normalizedName === "body") {
|
|
8521
|
+
mailtoComponent.body = decodeHex(value);
|
|
8522
|
+
continue;
|
|
8523
|
+
}
|
|
8524
|
+
if (headers === null) headers = Object.create(null);
|
|
8525
|
+
headers[name] = decodeHex(value);
|
|
8526
|
+
}
|
|
8527
|
+
if (headers !== null) mailtoComponent.headers = headers;
|
|
8528
|
+
}
|
|
8529
|
+
mailtoComponent.query = void 0;
|
|
8530
|
+
if (to.length > 0 && (mailtoComponent.userinfo !== void 0 || mailtoComponent.host !== void 0 || mailtoComponent.port !== void 0)) {
|
|
8531
|
+
mailtoComponent.userinfo = void 0;
|
|
8532
|
+
mailtoComponent.host = void 0;
|
|
8533
|
+
mailtoComponent.port = void 0;
|
|
8534
|
+
mailtoComponent.error = mailtoComponent.error || MAILTO_AUTHORITY_ERROR;
|
|
8535
|
+
}
|
|
8536
|
+
for (let i = 0; i < to.length; i++) {
|
|
8537
|
+
const rawAddr = to[i];
|
|
8538
|
+
const atIdx = rawAddr.lastIndexOf("@");
|
|
8539
|
+
if (atIdx < 0) {
|
|
8540
|
+
mailtoComponent.error = mailtoComponent.error || MAILTO_DOMAIN_ERROR;
|
|
8541
|
+
to[i] = decodeHex(rawAddr);
|
|
8542
|
+
continue;
|
|
8543
|
+
}
|
|
8544
|
+
const local = decodeHex(rawAddr.slice(0, atIdx));
|
|
8545
|
+
const domain = mailtoNormalizeDomain(decodeHex(rawAddr.slice(atIdx + 1)), options, mailtoComponent);
|
|
8546
|
+
to[i] = local + "@" + domain;
|
|
8547
|
+
}
|
|
8548
|
+
if (to.length) mailtoComponent.to = to;
|
|
8549
|
+
return mailtoComponent;
|
|
8550
|
+
}
|
|
8551
|
+
/**
|
|
8552
|
+
* Encodes a decoded mailto header name. Unlike `encodeWithAllow`, a percent
|
|
8553
|
+
* sign is always data here, even when followed by two hex digits. Preserving
|
|
8554
|
+
* such a sequence as an existing escape would decode the name again on the
|
|
8555
|
+
* next parse and could turn a generic header into `to`, `subject`, or `body`.
|
|
8556
|
+
* @param {string} name
|
|
8557
|
+
* @returns {string}
|
|
8558
|
+
*/
|
|
8559
|
+
function mailtoEncodeHeaderName(name) {
|
|
8560
|
+
return encodeWithAllow(name.replace(/%/gu, "%25"), HFNAME);
|
|
8561
|
+
}
|
|
8562
|
+
/**
|
|
8563
|
+
* @param {import('../types/index').URIComponent} component
|
|
8564
|
+
* @param {import('../types/index').Options} options
|
|
8565
|
+
* @returns {import('../types/index').URIComponent}
|
|
8566
|
+
*/
|
|
8567
|
+
function mailtoSerialize(component, options) {
|
|
8568
|
+
const mailtoComponent = component;
|
|
8569
|
+
const to = Array.isArray(mailtoComponent.to) ? mailtoComponent.to.slice() : [];
|
|
8570
|
+
const sourceHeaders = mailtoComponent.headers && typeof mailtoComponent.headers === "object" ? Object.assign(Object.create(null), mailtoComponent.headers) : Object.create(null);
|
|
8571
|
+
const headers = Object.create(null);
|
|
8572
|
+
for (const name in sourceHeaders) {
|
|
8573
|
+
const normalizedName = name.toLowerCase();
|
|
8574
|
+
if (normalizedName === "to") {
|
|
8575
|
+
const addrs = String(sourceHeaders[name]).split(",");
|
|
8576
|
+
for (let i = 0; i < addrs.length; i++) to.push(addrs[i]);
|
|
8577
|
+
} else if (normalizedName === "subject" || normalizedName === "body") headers[normalizedName] = sourceHeaders[name];
|
|
8578
|
+
else headers[name] = sourceHeaders[name];
|
|
8579
|
+
}
|
|
8580
|
+
if (mailtoComponent.subject !== void 0) headers.subject = mailtoComponent.subject;
|
|
8581
|
+
if (mailtoComponent.body !== void 0) headers.body = mailtoComponent.body;
|
|
8582
|
+
mailtoComponent.headers = headers;
|
|
8583
|
+
if (to.length) {
|
|
8584
|
+
mailtoComponent.userinfo = void 0;
|
|
8585
|
+
mailtoComponent.host = void 0;
|
|
8586
|
+
mailtoComponent.port = void 0;
|
|
8587
|
+
for (let i = 0; i < to.length; i++) {
|
|
8588
|
+
const addr = String(to[i]);
|
|
8589
|
+
const atIdx = addr.lastIndexOf("@");
|
|
8590
|
+
const rawLocal = atIdx >= 0 ? addr.slice(0, atIdx) : addr;
|
|
8591
|
+
const rawDomain = atIdx >= 0 ? addr.slice(atIdx + 1) : "";
|
|
8592
|
+
const local = encodeWithAllow(rawLocal, LOCAL_PART);
|
|
8593
|
+
const normalizedDomain = mailtoNormalizeDomain(decodeHex(rawDomain), options);
|
|
8594
|
+
to[i] = local + "@" + mailtoEncodeDomain(normalizedDomain, options);
|
|
8595
|
+
}
|
|
8596
|
+
mailtoComponent.path = to.join(",");
|
|
8597
|
+
options.skipEscape = true;
|
|
8598
|
+
} else mailtoComponent.path = void 0;
|
|
8599
|
+
let query = "";
|
|
8600
|
+
let count = 0;
|
|
8601
|
+
for (const name in headers) {
|
|
8602
|
+
if (count++ !== 0) query += "&";
|
|
8603
|
+
query += mailtoEncodeHeaderName(name) + "=" + encodeWithAllow(String(headers[name]), HFNAME);
|
|
8604
|
+
}
|
|
8605
|
+
if (count !== 0) mailtoComponent.query = query;
|
|
8606
|
+
else mailtoComponent.headers = void 0;
|
|
8607
|
+
return mailtoComponent;
|
|
8608
|
+
}
|
|
8183
8609
|
var SCHEMES = {
|
|
8184
8610
|
http,
|
|
8185
8611
|
https,
|
|
8186
8612
|
ws,
|
|
8187
|
-
wss
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
|
|
8198
|
-
},
|
|
8199
|
-
"urn:uuid": {
|
|
8200
|
-
scheme: "urn:uuid",
|
|
8201
|
-
parse: urnuuidParse,
|
|
8202
|
-
serialize: urnuuidSerialize,
|
|
8203
|
-
skipNormalize: true
|
|
8613
|
+
wss,
|
|
8614
|
+
urn,
|
|
8615
|
+
"urn:uuid": urnuuid,
|
|
8616
|
+
mailto: {
|
|
8617
|
+
scheme: "mailto",
|
|
8618
|
+
parse: mailtoParse,
|
|
8619
|
+
serialize: mailtoSerialize,
|
|
8620
|
+
domainHost: false,
|
|
8621
|
+
unicodeSupport: true,
|
|
8622
|
+
skipNormalize: true,
|
|
8623
|
+
absolutePath: true
|
|
8204
8624
|
}
|
|
8205
8625
|
};
|
|
8206
8626
|
Object.setPrototypeOf(SCHEMES, null);
|
|
@@ -8219,7 +8639,7 @@ var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8219
8639
|
};
|
|
8220
8640
|
}));
|
|
8221
8641
|
var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
8222
|
-
var { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment,
|
|
8642
|
+
var { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, encodeHost, isIPv4, nonSimpleDomain } = require_utils();
|
|
8223
8643
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
8224
8644
|
var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
8225
8645
|
var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
|
|
@@ -8257,21 +8677,36 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8257
8677
|
*/
|
|
8258
8678
|
function resolve(baseURI, relativeURI, options) {
|
|
8259
8679
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
8260
|
-
const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed, malformedPercentEncoding: baseMalformedPercentEncoding, malformedSchemeSpecific: baseMalformedSchemeSpecific, malformedHost: baseMalformedHost, malformedScheme: baseMalformedScheme } = parseWithStatus(baseURI, schemelessOptions);
|
|
8261
|
-
const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed, malformedPercentEncoding: relativeMalformedPercentEncoding, malformedSchemeSpecific: relativeMalformedSchemeSpecific, malformedHost: relativeMalformedHost, malformedScheme: relativeMalformedScheme } = parseWithStatus(relativeURI, schemelessOptions);
|
|
8262
|
-
if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
|
|
8680
|
+
const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed, malformedReferenceEdge: baseMalformedReferenceEdge, malformedPercentEncoding: baseMalformedPercentEncoding, malformedSchemeSpecific: baseMalformedSchemeSpecific, malformedHost: baseMalformedHost, malformedScheme: baseMalformedScheme } = parseWithStatus(baseURI, schemelessOptions);
|
|
8681
|
+
const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed, malformedReferenceEdge: relativeMalformedReferenceEdge, malformedPercentEncoding: relativeMalformedPercentEncoding, malformedSchemeSpecific: relativeMalformedSchemeSpecific, malformedHost: relativeMalformedHost, malformedScheme: relativeMalformedScheme } = parseWithStatus(relativeURI, schemelessOptions);
|
|
8682
|
+
if (baseMalformed || relativeMalformed || baseMalformedReferenceEdge || relativeMalformedReferenceEdge || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
|
|
8263
8683
|
const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
|
|
8264
8684
|
const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
|
|
8265
8685
|
const resolvedHost = resolved.host;
|
|
8686
|
+
if ((resolved.scheme === "http" || resolved.scheme === "https") && !resolvedHost) throw new Error("HTTP URIs must have a host.");
|
|
8266
8687
|
const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
|
|
8267
8688
|
if (hasForbiddenDomainHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP)) throw new Error(MALFORMED_HOST_ERROR);
|
|
8268
8689
|
canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
|
|
8269
8690
|
const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !/\P{ASCII}/u.test(resolvedHost);
|
|
8270
8691
|
if (resolved.error && !encodedASCIIHost) throw new Error(resolved.error);
|
|
8271
8692
|
schemelessOptions.skipEscape = true;
|
|
8693
|
+
if (resolvedSchemeHandler && resolvedSchemeHandler.absolutePath) schemelessOptions.absolutePath = true;
|
|
8272
8694
|
return serialize(resolved, schemelessOptions);
|
|
8273
8695
|
}
|
|
8274
8696
|
/**
|
|
8697
|
+
* Copies a host component together with its parse-time zone identifier (if
|
|
8698
|
+
* any), so downstream recomposition does not re-derive an IPv6 zone from the
|
|
8699
|
+
* ambiguous single-"%" component form. The zone is validated on use by
|
|
8700
|
+
* `recomposeAuthority` rather than blindly trusted.
|
|
8701
|
+
*
|
|
8702
|
+
* @param {import('./types/index').URIComponent} target
|
|
8703
|
+
* @param {import('./types/index').URIComponent} source
|
|
8704
|
+
*/
|
|
8705
|
+
function copyHost(target, source) {
|
|
8706
|
+
target.host = source.host;
|
|
8707
|
+
if (source.ipv6Zone !== void 0) target.ipv6Zone = source.ipv6Zone;
|
|
8708
|
+
}
|
|
8709
|
+
/**
|
|
8275
8710
|
* @param {import ('./types/index').URIComponent} base
|
|
8276
8711
|
* @param {import ('./types/index').URIComponent} relative
|
|
8277
8712
|
* @param {import('./types/index').Options} [options]
|
|
@@ -8289,14 +8724,15 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8289
8724
|
if (!options.tolerant && relative.scheme) {
|
|
8290
8725
|
target.scheme = relative.scheme;
|
|
8291
8726
|
target.userinfo = relative.userinfo;
|
|
8292
|
-
target
|
|
8727
|
+
copyHost(target, relative);
|
|
8293
8728
|
target.port = relative.port;
|
|
8294
|
-
|
|
8729
|
+
const relativeSchemeHandler = getSchemeHandler(relative.scheme);
|
|
8730
|
+
target.path = relativeSchemeHandler && relativeSchemeHandler.absolutePath ? relative.path || "" : removeDotSegments(relative.path || "");
|
|
8295
8731
|
target.query = relative.query;
|
|
8296
8732
|
} else {
|
|
8297
8733
|
if (relative.userinfo !== void 0 || relative.host !== void 0 || relative.port !== void 0) {
|
|
8298
8734
|
target.userinfo = relative.userinfo;
|
|
8299
|
-
target
|
|
8735
|
+
copyHost(target, relative);
|
|
8300
8736
|
target.port = relative.port;
|
|
8301
8737
|
target.path = removeDotSegments(relative.path || "");
|
|
8302
8738
|
target.query = relative.query;
|
|
@@ -8317,7 +8753,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8317
8753
|
target.query = relative.query;
|
|
8318
8754
|
}
|
|
8319
8755
|
target.userinfo = base.userinfo;
|
|
8320
|
-
target
|
|
8756
|
+
copyHost(target, base);
|
|
8321
8757
|
target.port = base.port;
|
|
8322
8758
|
}
|
|
8323
8759
|
target.scheme = base.scheme;
|
|
@@ -8344,6 +8780,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8344
8780
|
function serialize(cmpts, opts) {
|
|
8345
8781
|
const component = {
|
|
8346
8782
|
host: cmpts.host,
|
|
8783
|
+
ipv6Zone: cmpts.ipv6Zone,
|
|
8347
8784
|
scheme: cmpts.scheme,
|
|
8348
8785
|
userinfo: cmpts.userinfo,
|
|
8349
8786
|
port: cmpts.port,
|
|
@@ -8356,6 +8793,10 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8356
8793
|
reference: cmpts.reference,
|
|
8357
8794
|
resourceName: cmpts.resourceName,
|
|
8358
8795
|
secure: cmpts.secure,
|
|
8796
|
+
to: cmpts.to,
|
|
8797
|
+
subject: cmpts.subject,
|
|
8798
|
+
body: cmpts.body,
|
|
8799
|
+
headers: cmpts.headers,
|
|
8359
8800
|
error: ""
|
|
8360
8801
|
};
|
|
8361
8802
|
const options = Object.assign({}, opts);
|
|
@@ -8374,7 +8815,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8374
8815
|
component.scheme = validateScheme(component.scheme);
|
|
8375
8816
|
uriTokens.push(component.scheme, ":");
|
|
8376
8817
|
}
|
|
8377
|
-
const authority = recomposeAuthority(component);
|
|
8818
|
+
const authority = recomposeAuthority(component, options.unicodeSupport === true || Boolean(schemeHandler && schemeHandler.unicodeSupport));
|
|
8378
8819
|
if (authority !== void 0) {
|
|
8379
8820
|
if (options.reference !== "suffix") uriTokens.push("//");
|
|
8380
8821
|
uriTokens.push(authority);
|
|
@@ -8447,11 +8888,12 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8447
8888
|
* @returns {boolean} whether host conversion failed
|
|
8448
8889
|
*/
|
|
8449
8890
|
function canonicalizeHost(parsed, options, schemeHandler, isIP) {
|
|
8891
|
+
const bracketedIPLiteral = parsed.host && parsed.host[0] === "[" && parsed.host[parsed.host.length - 1] === "]";
|
|
8450
8892
|
if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP)) {
|
|
8451
8893
|
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
8452
8894
|
return true;
|
|
8453
8895
|
}
|
|
8454
|
-
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
8896
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && !bracketedIPLiteral && nonSimpleDomain(parsed.host)) {
|
|
8455
8897
|
let url;
|
|
8456
8898
|
try {
|
|
8457
8899
|
url = new URL("http://" + parsed.host);
|
|
@@ -8493,7 +8935,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8493
8935
|
/**
|
|
8494
8936
|
* @param {string} uri
|
|
8495
8937
|
* @param {import('./types/index').Options} [opts]
|
|
8496
|
-
* @returns {{ parsed: import('./types/index').URIComponent, malformedAuthorityOrPort: boolean, malformedPercentEncoding: boolean, malformedSchemeSpecific: boolean, malformedHost: boolean, malformedScheme: boolean }}
|
|
8938
|
+
* @returns {{ parsed: import('./types/index').URIComponent, malformedAuthorityOrPort: boolean, malformedReferenceEdge: boolean, malformedPercentEncoding: boolean, malformedSchemeSpecific: boolean, malformedHost: boolean, malformedScheme: boolean }}
|
|
8497
8939
|
*/
|
|
8498
8940
|
function parseWithStatus(uri, opts) {
|
|
8499
8941
|
const options = Object.assign({}, opts);
|
|
@@ -8508,6 +8950,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8508
8950
|
fragment: void 0
|
|
8509
8951
|
};
|
|
8510
8952
|
let malformedAuthorityOrPort = false;
|
|
8953
|
+
const malformedReferenceEdge = uri.length !== 0 && (uri.charCodeAt(0) <= 32 || uri.charCodeAt(uri.length - 1) <= 32);
|
|
8511
8954
|
let malformedPercentEncoding = false;
|
|
8512
8955
|
let malformedSchemeSpecific = false;
|
|
8513
8956
|
let malformedHost = false;
|
|
@@ -8537,6 +8980,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8537
8980
|
}
|
|
8538
8981
|
}
|
|
8539
8982
|
}
|
|
8983
|
+
if (malformedReferenceEdge) parsed.error = parsed.error || "URI must not contain leading or trailing C0 controls or spaces.";
|
|
8540
8984
|
const matches = uri.match(URI_PARSE);
|
|
8541
8985
|
if (matches) {
|
|
8542
8986
|
parsed.scheme = matches[1];
|
|
@@ -8569,6 +9013,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8569
9013
|
isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
|
|
8570
9014
|
malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
|
|
8571
9015
|
parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
9016
|
+
if (isIP && ipv6result.isIPV6 === true && parsed.host.indexOf("%") !== -1) parsed.ipv6Zone = parsed.host.slice(parsed.host.indexOf("%") + 1);
|
|
8572
9017
|
if (malformedIPLiteral) {
|
|
8573
9018
|
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
8574
9019
|
malformedAuthorityOrPort = true;
|
|
@@ -8582,10 +9027,16 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8582
9027
|
if (options.reference && options.reference !== "suffix" && options.reference !== parsed.reference) parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
|
|
8583
9028
|
const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
|
|
8584
9029
|
if (!malformedIPLiteral) malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
|
|
8585
|
-
if (
|
|
8586
|
-
let host =
|
|
8587
|
-
if (
|
|
8588
|
-
|
|
9030
|
+
if (parsed.host !== void 0 && !malformedIPLiteral) {
|
|
9031
|
+
let host = parsed.host;
|
|
9032
|
+
if (uri.indexOf("%") !== -1 && !isIP) {
|
|
9033
|
+
host = normalizePercentEncoding(host, true);
|
|
9034
|
+
host = normalizePercentEncoding(host.toLowerCase());
|
|
9035
|
+
}
|
|
9036
|
+
if (options.scheme !== "null") {
|
|
9037
|
+
const allowNonAsciiHost = options.unicodeSupport === true || Boolean(schemeHandler && schemeHandler.unicodeSupport);
|
|
9038
|
+
parsed.host = encodeHost(host, isIP, allowNonAsciiHost);
|
|
9039
|
+
} else parsed.host = host;
|
|
8589
9040
|
}
|
|
8590
9041
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
8591
9042
|
if (parsed.path) parsed.path = normalizePathEncoding(parsed.path);
|
|
@@ -8600,6 +9051,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8600
9051
|
return {
|
|
8601
9052
|
parsed,
|
|
8602
9053
|
malformedAuthorityOrPort,
|
|
9054
|
+
malformedReferenceEdge,
|
|
8603
9055
|
malformedPercentEncoding,
|
|
8604
9056
|
malformedSchemeSpecific,
|
|
8605
9057
|
malformedHost,
|
|
@@ -8625,13 +9077,14 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8625
9077
|
/**
|
|
8626
9078
|
* @param {string} uri
|
|
8627
9079
|
* @param {import('./types/index').Options} [opts]
|
|
8628
|
-
* @returns {{ normalized: string, malformedAuthorityOrPort: boolean, malformedPercentEncoding: boolean, malformedSchemeSpecific: boolean, malformedHost: boolean, malformedScheme: boolean }}
|
|
9080
|
+
* @returns {{ normalized: string, malformedAuthorityOrPort: boolean, malformedReferenceEdge: boolean, malformedPercentEncoding: boolean, malformedSchemeSpecific: boolean, malformedHost: boolean, malformedScheme: boolean }}
|
|
8629
9081
|
*/
|
|
8630
9082
|
function normalizeStringWithStatus(uri, opts) {
|
|
8631
|
-
const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
|
|
9083
|
+
const { parsed, malformedAuthorityOrPort, malformedReferenceEdge, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
|
|
8632
9084
|
return {
|
|
8633
|
-
normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
|
|
9085
|
+
normalized: malformedAuthorityOrPort || malformedReferenceEdge || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
|
|
8634
9086
|
malformedAuthorityOrPort,
|
|
9087
|
+
malformedReferenceEdge,
|
|
8635
9088
|
malformedPercentEncoding,
|
|
8636
9089
|
malformedSchemeSpecific,
|
|
8637
9090
|
malformedHost,
|
|
@@ -8651,8 +9104,8 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8651
9104
|
} catch {
|
|
8652
9105
|
return;
|
|
8653
9106
|
}
|
|
8654
|
-
const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
|
|
8655
|
-
return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
|
|
9107
|
+
const { normalized, malformedAuthorityOrPort, malformedReferenceEdge, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
|
|
9108
|
+
return malformedAuthorityOrPort || malformedReferenceEdge || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? void 0 : normalized;
|
|
8656
9109
|
}
|
|
8657
9110
|
var fastUri = {
|
|
8658
9111
|
SCHEMES,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubohiroya/turbowarp-aframe",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "A TurboWarp extension for declarative A-Frame scene graphs.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Hiroya Kubo",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@eslint/js": "^9.39.5",
|
|
74
|
-
"@kubohiroya/turbowarp-extension-manifest": "^0.
|
|
74
|
+
"@kubohiroya/turbowarp-extension-manifest": "^0.6.0",
|
|
75
75
|
"@kubohiroya/vite-plugin-turbowarp-extension": "^0.11.0",
|
|
76
76
|
"@pixiv/three-vrm": "3.5.5",
|
|
77
77
|
"@types/node": "^24.13.3",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"react-dom": "18.3.1"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@kubohiroya/turbowarp-extension-data-editor": "^0.11.
|
|
88
|
+
"@kubohiroya/turbowarp-extension-data-editor": "^0.11.2"
|
|
89
89
|
},
|
|
90
90
|
"exports": {
|
|
91
91
|
"./*": "./*",
|