@blueking/bkui-form 0.0.48 → 0.0.49
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/dist/bkui-form-es-min.js +3 -5
- package/dist/bkui-form-es.js +746 -1466
- package/dist/bkui-form-es.js.map +1 -1
- package/dist/bkui-form-umd-min.js +3 -5
- package/dist/bkui-form-umd.js +746 -1466
- package/dist/bkui-form-umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/adapter/vue2/common/CommonGroupWrap.d.ts +0 -32
package/dist/bkui-form-es.js
CHANGED
|
@@ -182,7 +182,7 @@ function _objectWithoutProperties(e, t) {
|
|
|
182
182
|
i = _objectWithoutPropertiesLoose(e, t);
|
|
183
183
|
if (Object.getOwnPropertySymbols) {
|
|
184
184
|
var n = Object.getOwnPropertySymbols(e);
|
|
185
|
-
for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o)
|
|
185
|
+
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
186
186
|
}
|
|
187
187
|
return i;
|
|
188
188
|
}
|
|
@@ -190,7 +190,7 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
190
190
|
if (null == r) return {};
|
|
191
191
|
var t = {};
|
|
192
192
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
193
|
-
if (e.indexOf(n)
|
|
193
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
194
194
|
t[n] = r[n];
|
|
195
195
|
}
|
|
196
196
|
return t;
|
|
@@ -584,11 +584,11 @@ var valueType = function valueType(value) {
|
|
|
584
584
|
}
|
|
585
585
|
return _typeof(value);
|
|
586
586
|
};
|
|
587
|
-
var
|
|
587
|
+
var _merge = function merge(target, source) {
|
|
588
588
|
if (isObj(source)) {
|
|
589
589
|
return Object.keys(source).reduce(function (pre, key) {
|
|
590
590
|
var _target;
|
|
591
|
-
pre[key] =
|
|
591
|
+
pre[key] = _merge(((_target = target) === null || _target === void 0 ? void 0 : _target[key]) || {}, source[key]);
|
|
592
592
|
return pre;
|
|
593
593
|
}, JSON.parse(JSON.stringify(target)));
|
|
594
594
|
}
|
|
@@ -596,7 +596,7 @@ var merge = function merge(target, source) {
|
|
|
596
596
|
target = Array.isArray(target) ? target : [];
|
|
597
597
|
return source.map(function (item, index) {
|
|
598
598
|
if (target[index]) {
|
|
599
|
-
return
|
|
599
|
+
return _merge(target[index], item);
|
|
600
600
|
}
|
|
601
601
|
return item;
|
|
602
602
|
});
|
|
@@ -1367,8 +1367,8 @@ var defaultConfig = {
|
|
|
1367
1367
|
headers: {},
|
|
1368
1368
|
cache: 'no-cache'
|
|
1369
1369
|
};
|
|
1370
|
-
var request = (
|
|
1371
|
-
var _ref = _asyncToGenerator(
|
|
1370
|
+
var request = (/*#__PURE__*/function () {
|
|
1371
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
|
|
1372
1372
|
var config,
|
|
1373
1373
|
_mergeDeep,
|
|
1374
1374
|
params,
|
|
@@ -1477,7 +1477,7 @@ var request = ( /*#__PURE__*/(function () {
|
|
|
1477
1477
|
return function (_x) {
|
|
1478
1478
|
return _ref.apply(this, arguments);
|
|
1479
1479
|
};
|
|
1480
|
-
}
|
|
1480
|
+
}());
|
|
1481
1481
|
|
|
1482
1482
|
var props$1 = {
|
|
1483
1483
|
// 表单值
|
|
@@ -1714,7 +1714,7 @@ var getContext = function getContext(instance) {
|
|
|
1714
1714
|
}
|
|
1715
1715
|
};
|
|
1716
1716
|
};
|
|
1717
|
-
var
|
|
1717
|
+
var _executeExpression = function executeExpression(expression, instance) {
|
|
1718
1718
|
var $dep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
1719
1719
|
var $args = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
1720
1720
|
var _getContext = getContext(instance),
|
|
@@ -1772,7 +1772,7 @@ var executeExpression = function executeExpression(expression, instance) {
|
|
|
1772
1772
|
}
|
|
1773
1773
|
if (isObj(expression)) {
|
|
1774
1774
|
Object.keys(expression).forEach(function (key) {
|
|
1775
|
-
expression[key] =
|
|
1775
|
+
expression[key] = _executeExpression(expression[key], instance);
|
|
1776
1776
|
});
|
|
1777
1777
|
return expression;
|
|
1778
1778
|
}
|
|
@@ -1818,7 +1818,6 @@ var resolveReaction = function resolveReaction(crtInsPath, targetPath, reaction,
|
|
|
1818
1818
|
crtInstance = _ref.instance; // 当前组件实例,用来条件表达式判断
|
|
1819
1819
|
var _ref2 = widgetTree.widgetMap[targetPath] || {},
|
|
1820
1820
|
operateInstance = _ref2.instance; // 需要执行操作的组件实例,可能为其他组件也可能为当前组件
|
|
1821
|
-
if (!crtInstance || !operateInstance) return;
|
|
1822
1821
|
var fullfill = true;
|
|
1823
1822
|
var deps = [];
|
|
1824
1823
|
if (reaction.source) {
|
|
@@ -1828,33 +1827,39 @@ var resolveReaction = function resolveReaction(crtInsPath, targetPath, reaction,
|
|
|
1828
1827
|
deps.push(instance);
|
|
1829
1828
|
});
|
|
1830
1829
|
}
|
|
1831
|
-
if (typeof reaction.if === 'string') {
|
|
1832
|
-
fullfill =
|
|
1830
|
+
if (typeof reaction.if === 'string' && crtInstance) {
|
|
1831
|
+
fullfill = _executeExpression(reaction.if, crtInstance, deps);
|
|
1833
1832
|
}
|
|
1834
1833
|
var operations = fullfill ? reaction.then : reaction.else;
|
|
1835
|
-
executeOperations(operations, operateInstance, deps);
|
|
1834
|
+
operateInstance && executeOperations(operations, operateInstance, deps);
|
|
1836
1835
|
};
|
|
1837
1836
|
};
|
|
1837
|
+
/**
|
|
1838
|
+
* 执行操作
|
|
1839
|
+
* @param operations
|
|
1840
|
+
* @param instance
|
|
1841
|
+
* @param deps
|
|
1842
|
+
*/
|
|
1838
1843
|
var executeOperations = function executeOperations(operations, instance, deps) {
|
|
1839
1844
|
if (operations) {
|
|
1840
1845
|
if (operations.state) {
|
|
1841
1846
|
Object.keys(operations.state).forEach(function (key) {
|
|
1842
1847
|
var val = operations.state[key];
|
|
1843
1848
|
if (typeof val === 'string' && /^{{.+}}$/.test(val.trim())) {
|
|
1844
|
-
val =
|
|
1849
|
+
val = _executeExpression(val, instance, deps);
|
|
1845
1850
|
}
|
|
1846
1851
|
instance.setState(key, val);
|
|
1847
1852
|
});
|
|
1848
1853
|
}
|
|
1849
1854
|
if (Array.isArray(operations.actions)) {
|
|
1850
1855
|
operations.actions.forEach(function (item) {
|
|
1851
|
-
|
|
1856
|
+
_executeExpression(item, instance, deps);
|
|
1852
1857
|
});
|
|
1853
1858
|
}
|
|
1854
1859
|
}
|
|
1855
1860
|
};
|
|
1856
1861
|
var parsePath = function parsePath(path, instance) {
|
|
1857
|
-
return isExpression(path) ?
|
|
1862
|
+
return isExpression(path) ? _executeExpression(path, instance) : path;
|
|
1858
1863
|
};
|
|
1859
1864
|
var reactionRegister = function reactionRegister(path) {
|
|
1860
1865
|
var reactions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
@@ -1907,8 +1912,6 @@ var reactionDispatch = function reactionDispatch(path, typeName) {
|
|
|
1907
1912
|
}
|
|
1908
1913
|
};
|
|
1909
1914
|
|
|
1910
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
1911
|
-
|
|
1912
1915
|
function getDefaultExportFromCjs (x) {
|
|
1913
1916
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
1914
1917
|
}
|
|
@@ -1930,6 +1933,7 @@ var code$1 = {};
|
|
|
1930
1933
|
(function (exports) {
|
|
1931
1934
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1932
1935
|
exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
|
|
1936
|
+
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
1933
1937
|
class _CodeOrName {
|
|
1934
1938
|
}
|
|
1935
1939
|
exports._CodeOrName = _CodeOrName;
|
|
@@ -3938,7 +3942,7 @@ function extendSubschemaMode(subschema, { jtdDiscriminator, jtdMetadata, composi
|
|
|
3938
3942
|
}
|
|
3939
3943
|
subschema.extendSubschemaMode = extendSubschemaMode;
|
|
3940
3944
|
|
|
3941
|
-
var resolve$
|
|
3945
|
+
var resolve$2 = {};
|
|
3942
3946
|
|
|
3943
3947
|
// do not edit .js files directly - edit src/index.jst
|
|
3944
3948
|
|
|
@@ -4079,10 +4083,10 @@ function escapeJsonPtr(str) {
|
|
|
4079
4083
|
return str.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
4080
4084
|
}
|
|
4081
4085
|
|
|
4082
|
-
Object.defineProperty(resolve$
|
|
4083
|
-
resolve$
|
|
4086
|
+
Object.defineProperty(resolve$2, "__esModule", { value: true });
|
|
4087
|
+
resolve$2.getSchemaRefs = resolve$2.resolveUrl = resolve$2.normalizeId = resolve$2._getFullPath = resolve$2.getFullPath = resolve$2.inlineRef = void 0;
|
|
4084
4088
|
const util_1$m = util;
|
|
4085
|
-
const equal$
|
|
4089
|
+
const equal$3 = fastDeepEqual;
|
|
4086
4090
|
const traverse = jsonSchemaTraverse.exports;
|
|
4087
4091
|
// TODO refactor to use keyword definitions
|
|
4088
4092
|
const SIMPLE_INLINED = new Set([
|
|
@@ -4112,7 +4116,7 @@ function inlineRef(schema, limit = true) {
|
|
|
4112
4116
|
return false;
|
|
4113
4117
|
return countKeys(schema) <= limit;
|
|
4114
4118
|
}
|
|
4115
|
-
resolve$
|
|
4119
|
+
resolve$2.inlineRef = inlineRef;
|
|
4116
4120
|
const REF_KEYWORDS = new Set([
|
|
4117
4121
|
"$ref",
|
|
4118
4122
|
"$recursiveRef",
|
|
@@ -4154,22 +4158,22 @@ function getFullPath(resolver, id = "", normalize) {
|
|
|
4154
4158
|
const p = resolver.parse(id);
|
|
4155
4159
|
return _getFullPath(resolver, p);
|
|
4156
4160
|
}
|
|
4157
|
-
resolve$
|
|
4161
|
+
resolve$2.getFullPath = getFullPath;
|
|
4158
4162
|
function _getFullPath(resolver, p) {
|
|
4159
4163
|
const serialized = resolver.serialize(p);
|
|
4160
4164
|
return serialized.split("#")[0] + "#";
|
|
4161
4165
|
}
|
|
4162
|
-
resolve$
|
|
4166
|
+
resolve$2._getFullPath = _getFullPath;
|
|
4163
4167
|
const TRAILING_SLASH_HASH = /#\/?$/;
|
|
4164
4168
|
function normalizeId(id) {
|
|
4165
4169
|
return id ? id.replace(TRAILING_SLASH_HASH, "") : "";
|
|
4166
4170
|
}
|
|
4167
|
-
resolve$
|
|
4171
|
+
resolve$2.normalizeId = normalizeId;
|
|
4168
4172
|
function resolveUrl(resolver, baseId, id) {
|
|
4169
4173
|
id = normalizeId(id);
|
|
4170
4174
|
return resolver.resolve(baseId, id);
|
|
4171
4175
|
}
|
|
4172
|
-
resolve$
|
|
4176
|
+
resolve$2.resolveUrl = resolveUrl;
|
|
4173
4177
|
const ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
|
|
4174
4178
|
function getSchemaRefs(schema, baseId) {
|
|
4175
4179
|
if (typeof schema == "boolean")
|
|
@@ -4224,14 +4228,14 @@ function getSchemaRefs(schema, baseId) {
|
|
|
4224
4228
|
});
|
|
4225
4229
|
return localRefs;
|
|
4226
4230
|
function checkAmbiguosRef(sch1, sch2, ref) {
|
|
4227
|
-
if (sch2 !== undefined && !equal$
|
|
4231
|
+
if (sch2 !== undefined && !equal$3(sch1, sch2))
|
|
4228
4232
|
throw ambiguos(ref);
|
|
4229
4233
|
}
|
|
4230
4234
|
function ambiguos(ref) {
|
|
4231
4235
|
return new Error(`reference "${ref}" resolves to more than one schema`);
|
|
4232
4236
|
}
|
|
4233
4237
|
}
|
|
4234
|
-
resolve$
|
|
4238
|
+
resolve$2.getSchemaRefs = getSchemaRefs;
|
|
4235
4239
|
|
|
4236
4240
|
Object.defineProperty(validate$1, "__esModule", { value: true });
|
|
4237
4241
|
validate$1.getData = validate$1.KeywordCxt = validate$1.validateFunctionCode = void 0;
|
|
@@ -4244,7 +4248,7 @@ const keyword_1 = keyword;
|
|
|
4244
4248
|
const subschema_1 = subschema;
|
|
4245
4249
|
const codegen_1$n = codegen;
|
|
4246
4250
|
const names_1$3 = names$1;
|
|
4247
|
-
const resolve_1$2 = resolve$
|
|
4251
|
+
const resolve_1$2 = resolve$2;
|
|
4248
4252
|
const util_1$l = util;
|
|
4249
4253
|
const errors_1 = errors;
|
|
4250
4254
|
// schema compilation - generates validation function, subschemaCode (below) is used for subschemas
|
|
@@ -4766,7 +4770,7 @@ validation_error.default = ValidationError;
|
|
|
4766
4770
|
var ref_error = {};
|
|
4767
4771
|
|
|
4768
4772
|
Object.defineProperty(ref_error, "__esModule", { value: true });
|
|
4769
|
-
const resolve_1$1 = resolve$
|
|
4773
|
+
const resolve_1$1 = resolve$2;
|
|
4770
4774
|
class MissingRefError extends Error {
|
|
4771
4775
|
constructor(resolver, baseId, ref, msg) {
|
|
4772
4776
|
super(msg || `can't resolve reference ${ref} from id ${baseId}`);
|
|
@@ -4783,7 +4787,7 @@ compile.resolveSchema = compile.getCompilingSchema = compile.resolveRef = compil
|
|
|
4783
4787
|
const codegen_1$m = codegen;
|
|
4784
4788
|
const validation_error_1 = validation_error;
|
|
4785
4789
|
const names_1$2 = names$1;
|
|
4786
|
-
const resolve_1 = resolve$
|
|
4790
|
+
const resolve_1 = resolve$2;
|
|
4787
4791
|
const util_1$k = util;
|
|
4788
4792
|
const validate_1$1 = validate$1;
|
|
4789
4793
|
class SchemaEnv {
|
|
@@ -4909,7 +4913,7 @@ function resolveRef(root, baseId, ref) {
|
|
|
4909
4913
|
const schOrFunc = root.refs[ref];
|
|
4910
4914
|
if (schOrFunc)
|
|
4911
4915
|
return schOrFunc;
|
|
4912
|
-
let _sch = resolve.call(this, root, ref);
|
|
4916
|
+
let _sch = resolve$1.call(this, root, ref);
|
|
4913
4917
|
if (_sch === undefined) {
|
|
4914
4918
|
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv
|
|
4915
4919
|
const { schemaId } = this.opts;
|
|
@@ -4939,7 +4943,7 @@ function sameSchemaEnv(s1, s2) {
|
|
|
4939
4943
|
}
|
|
4940
4944
|
// resolve and compile the references ($ref)
|
|
4941
4945
|
// TODO returns AnySchemaObject (if the schema can be inlined) or validation function
|
|
4942
|
-
function resolve(root, // information about the root schema for the current schema
|
|
4946
|
+
function resolve$1(root, // information about the root schema for the current schema
|
|
4943
4947
|
ref // reference to resolve
|
|
4944
4948
|
) {
|
|
4945
4949
|
let sch;
|
|
@@ -5050,1416 +5054,770 @@ var require$$9 = {
|
|
|
5050
5054
|
|
|
5051
5055
|
var uri$1 = {};
|
|
5052
5056
|
|
|
5053
|
-
var
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
}
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
}
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
return obj;
|
|
5098
|
-
}
|
|
5099
|
-
|
|
5100
|
-
function buildExps(isIRI) {
|
|
5101
|
-
var ALPHA$$ = "[A-Za-z]",
|
|
5102
|
-
DIGIT$$ = "[0-9]",
|
|
5103
|
-
HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"),
|
|
5104
|
-
PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)),
|
|
5105
|
-
//expanded
|
|
5106
|
-
GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
|
|
5107
|
-
SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
|
|
5108
|
-
RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
|
|
5109
|
-
UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]",
|
|
5110
|
-
//subset, excludes bidi control characters
|
|
5111
|
-
IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",
|
|
5112
|
-
//subset
|
|
5113
|
-
UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$);
|
|
5114
|
-
subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*");
|
|
5115
|
-
subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*");
|
|
5116
|
-
var DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$),
|
|
5117
|
-
//relaxed parsing rules
|
|
5118
|
-
IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
|
|
5119
|
-
H16$ = subexp(HEXDIG$$ + "{1,4}"),
|
|
5120
|
-
LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
|
|
5121
|
-
IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$),
|
|
5122
|
-
// 6( h16 ":" ) ls32
|
|
5123
|
-
IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$),
|
|
5124
|
-
// "::" 5( h16 ":" ) ls32
|
|
5125
|
-
IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$),
|
|
5126
|
-
//[ h16 ] "::" 4( h16 ":" ) ls32
|
|
5127
|
-
IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$),
|
|
5128
|
-
//[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
|
|
5129
|
-
IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$),
|
|
5130
|
-
//[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
|
|
5131
|
-
IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$),
|
|
5132
|
-
//[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
|
|
5133
|
-
IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$),
|
|
5134
|
-
//[ *4( h16 ":" ) h16 ] "::" ls32
|
|
5135
|
-
IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$),
|
|
5136
|
-
//[ *5( h16 ":" ) h16 ] "::" h16
|
|
5137
|
-
IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),
|
|
5138
|
-
//[ *6( h16 ":" ) h16 ] "::"
|
|
5139
|
-
IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
|
|
5140
|
-
ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+");
|
|
5141
|
-
//RFC 6874, with relaxed parsing rules
|
|
5142
|
-
subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+");
|
|
5143
|
-
//RFC 6874
|
|
5144
|
-
subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*");
|
|
5145
|
-
var PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"));
|
|
5146
|
-
subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+");
|
|
5147
|
-
subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*");
|
|
5148
|
-
return {
|
|
5149
|
-
NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
|
|
5150
|
-
NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
5151
|
-
NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
5152
|
-
NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
5153
|
-
NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
5154
|
-
NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
|
|
5155
|
-
NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
|
|
5156
|
-
ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
5157
|
-
UNRESERVED: new RegExp(UNRESERVED$$, "g"),
|
|
5158
|
-
OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
|
|
5159
|
-
PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
|
|
5160
|
-
IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
|
|
5161
|
-
IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
|
|
5162
|
-
};
|
|
5057
|
+
var fastUri$1 = {exports: {}};
|
|
5058
|
+
|
|
5059
|
+
const HEX$1 = {
|
|
5060
|
+
0: 0,
|
|
5061
|
+
1: 1,
|
|
5062
|
+
2: 2,
|
|
5063
|
+
3: 3,
|
|
5064
|
+
4: 4,
|
|
5065
|
+
5: 5,
|
|
5066
|
+
6: 6,
|
|
5067
|
+
7: 7,
|
|
5068
|
+
8: 8,
|
|
5069
|
+
9: 9,
|
|
5070
|
+
a: 10,
|
|
5071
|
+
A: 10,
|
|
5072
|
+
b: 11,
|
|
5073
|
+
B: 11,
|
|
5074
|
+
c: 12,
|
|
5075
|
+
C: 12,
|
|
5076
|
+
d: 13,
|
|
5077
|
+
D: 13,
|
|
5078
|
+
e: 14,
|
|
5079
|
+
E: 14,
|
|
5080
|
+
f: 15,
|
|
5081
|
+
F: 15
|
|
5082
|
+
};
|
|
5083
|
+
|
|
5084
|
+
var scopedChars = {
|
|
5085
|
+
HEX: HEX$1
|
|
5086
|
+
};
|
|
5087
|
+
|
|
5088
|
+
const { HEX } = scopedChars;
|
|
5089
|
+
|
|
5090
|
+
const IPV4_REG = /^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;
|
|
5091
|
+
|
|
5092
|
+
function normalizeIPv4$1 (host) {
|
|
5093
|
+
if (findToken(host, '.') < 3) { return { host, isIPV4: false } }
|
|
5094
|
+
const matches = host.match(IPV4_REG) || [];
|
|
5095
|
+
const [address] = matches;
|
|
5096
|
+
if (address) {
|
|
5097
|
+
return { host: stripLeadingZeros(address, '.'), isIPV4: true }
|
|
5098
|
+
} else {
|
|
5099
|
+
return { host, isIPV4: false }
|
|
5100
|
+
}
|
|
5163
5101
|
}
|
|
5164
|
-
var URI_PROTOCOL = buildExps(false);
|
|
5165
|
-
|
|
5166
|
-
var IRI_PROTOCOL = buildExps(true);
|
|
5167
|
-
|
|
5168
|
-
var slicedToArray = function () {
|
|
5169
|
-
function sliceIterator(arr, i) {
|
|
5170
|
-
var _arr = [];
|
|
5171
|
-
var _n = true;
|
|
5172
|
-
var _d = false;
|
|
5173
|
-
var _e = undefined;
|
|
5174
5102
|
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5103
|
+
/**
|
|
5104
|
+
* @param {string[]} input
|
|
5105
|
+
* @param {boolean} [keepZero=false]
|
|
5106
|
+
* @returns {string|undefined}
|
|
5107
|
+
*/
|
|
5108
|
+
function stringArrayToHexStripped (input, keepZero = false) {
|
|
5109
|
+
let acc = '';
|
|
5110
|
+
let strip = true;
|
|
5111
|
+
for (const c of input) {
|
|
5112
|
+
if (HEX[c] === undefined) return undefined
|
|
5113
|
+
if (c !== '0' && strip === true) strip = false;
|
|
5114
|
+
if (!strip) acc += c;
|
|
5115
|
+
}
|
|
5116
|
+
if (keepZero && acc.length === 0) acc = '0';
|
|
5117
|
+
return acc
|
|
5118
|
+
}
|
|
5119
|
+
|
|
5120
|
+
function getIPV6 (input) {
|
|
5121
|
+
let tokenCount = 0;
|
|
5122
|
+
const output = { error: false, address: '', zone: '' };
|
|
5123
|
+
const address = [];
|
|
5124
|
+
const buffer = [];
|
|
5125
|
+
let isZone = false;
|
|
5126
|
+
let endipv6Encountered = false;
|
|
5127
|
+
let endIpv6 = false;
|
|
5128
|
+
|
|
5129
|
+
function consume () {
|
|
5130
|
+
if (buffer.length) {
|
|
5131
|
+
if (isZone === false) {
|
|
5132
|
+
const hex = stringArrayToHexStripped(buffer);
|
|
5133
|
+
if (hex !== undefined) {
|
|
5134
|
+
address.push(hex);
|
|
5135
|
+
} else {
|
|
5136
|
+
output.error = true;
|
|
5137
|
+
return false
|
|
5138
|
+
}
|
|
5139
|
+
}
|
|
5140
|
+
buffer.length = 0;
|
|
5141
|
+
}
|
|
5142
|
+
return true
|
|
5143
|
+
}
|
|
5178
5144
|
|
|
5179
|
-
|
|
5145
|
+
for (let i = 0; i < input.length; i++) {
|
|
5146
|
+
const cursor = input[i];
|
|
5147
|
+
if (cursor === '[' || cursor === ']') { continue }
|
|
5148
|
+
if (cursor === ':') {
|
|
5149
|
+
if (endipv6Encountered === true) {
|
|
5150
|
+
endIpv6 = true;
|
|
5180
5151
|
}
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
if (_d) throw _e;
|
|
5152
|
+
if (!consume()) { break }
|
|
5153
|
+
tokenCount++;
|
|
5154
|
+
address.push(':');
|
|
5155
|
+
if (tokenCount > 7) {
|
|
5156
|
+
// not valid
|
|
5157
|
+
output.error = true;
|
|
5158
|
+
break
|
|
5189
5159
|
}
|
|
5160
|
+
if (i - 1 >= 0 && input[i - 1] === ':') {
|
|
5161
|
+
endipv6Encountered = true;
|
|
5162
|
+
}
|
|
5163
|
+
continue
|
|
5164
|
+
} else if (cursor === '%') {
|
|
5165
|
+
if (!consume()) { break }
|
|
5166
|
+
// switch to zone detection
|
|
5167
|
+
isZone = true;
|
|
5168
|
+
} else {
|
|
5169
|
+
buffer.push(cursor);
|
|
5170
|
+
continue
|
|
5190
5171
|
}
|
|
5191
|
-
|
|
5192
|
-
return _arr;
|
|
5193
5172
|
}
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
return sliceIterator(arr, i);
|
|
5173
|
+
if (buffer.length) {
|
|
5174
|
+
if (isZone) {
|
|
5175
|
+
output.zone = buffer.join('');
|
|
5176
|
+
} else if (endIpv6) {
|
|
5177
|
+
address.push(buffer.join(''));
|
|
5200
5178
|
} else {
|
|
5201
|
-
|
|
5179
|
+
address.push(stringArrayToHexStripped(buffer));
|
|
5202
5180
|
}
|
|
5203
|
-
}
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5181
|
+
}
|
|
5182
|
+
output.address = address.join('');
|
|
5183
|
+
return output
|
|
5184
|
+
}
|
|
5217
5185
|
|
|
5218
|
-
|
|
5219
|
-
if (
|
|
5220
|
-
|
|
5186
|
+
function normalizeIPv6$1 (host) {
|
|
5187
|
+
if (findToken(host, ':') < 2) { return { host, isIPV6: false } }
|
|
5188
|
+
const ipv6 = getIPV6(host);
|
|
5221
5189
|
|
|
5222
|
-
|
|
5190
|
+
if (!ipv6.error) {
|
|
5191
|
+
let newHost = ipv6.address;
|
|
5192
|
+
let escapedHost = ipv6.address;
|
|
5193
|
+
if (ipv6.zone) {
|
|
5194
|
+
newHost += '%' + ipv6.zone;
|
|
5195
|
+
escapedHost += '%25' + ipv6.zone;
|
|
5196
|
+
}
|
|
5197
|
+
return { host: newHost, escapedHost, isIPV6: true }
|
|
5223
5198
|
} else {
|
|
5224
|
-
return
|
|
5199
|
+
return { host, isIPV6: false }
|
|
5225
5200
|
}
|
|
5226
|
-
};
|
|
5227
|
-
|
|
5228
|
-
/** Highest positive signed 32-bit float value */
|
|
5229
|
-
|
|
5230
|
-
var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
|
|
5231
|
-
|
|
5232
|
-
/** Bootstring parameters */
|
|
5233
|
-
var base = 36;
|
|
5234
|
-
var tMin = 1;
|
|
5235
|
-
var tMax = 26;
|
|
5236
|
-
var skew = 38;
|
|
5237
|
-
var damp = 700;
|
|
5238
|
-
var initialBias = 72;
|
|
5239
|
-
var initialN = 128; // 0x80
|
|
5240
|
-
var delimiter = '-'; // '\x2D'
|
|
5241
|
-
|
|
5242
|
-
/** Regular expressions */
|
|
5243
|
-
var regexPunycode = /^xn--/;
|
|
5244
|
-
var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars
|
|
5245
|
-
var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
|
|
5246
|
-
|
|
5247
|
-
/** Error messages */
|
|
5248
|
-
var errors = {
|
|
5249
|
-
'overflow': 'Overflow: input needs wider integers to process',
|
|
5250
|
-
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
|
5251
|
-
'invalid-input': 'Invalid input'
|
|
5252
|
-
};
|
|
5253
|
-
|
|
5254
|
-
/** Convenience shortcuts */
|
|
5255
|
-
var baseMinusTMin = base - tMin;
|
|
5256
|
-
var floor = Math.floor;
|
|
5257
|
-
var stringFromCharCode = String.fromCharCode;
|
|
5258
|
-
|
|
5259
|
-
/*--------------------------------------------------------------------------*/
|
|
5260
|
-
|
|
5261
|
-
/**
|
|
5262
|
-
* A generic error utility function.
|
|
5263
|
-
* @private
|
|
5264
|
-
* @param {String} type The error type.
|
|
5265
|
-
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
|
5266
|
-
*/
|
|
5267
|
-
function error$1(type) {
|
|
5268
|
-
throw new RangeError(errors[type]);
|
|
5269
5201
|
}
|
|
5270
5202
|
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5203
|
+
function stripLeadingZeros (str, token) {
|
|
5204
|
+
let out = '';
|
|
5205
|
+
let skip = true;
|
|
5206
|
+
const l = str.length;
|
|
5207
|
+
for (let i = 0; i < l; i++) {
|
|
5208
|
+
const c = str[i];
|
|
5209
|
+
if (c === '0' && skip) {
|
|
5210
|
+
if ((i + 1 <= l && str[i + 1] === token) || i + 1 === l) {
|
|
5211
|
+
out += c;
|
|
5212
|
+
skip = false;
|
|
5213
|
+
}
|
|
5214
|
+
} else {
|
|
5215
|
+
if (c === token) {
|
|
5216
|
+
skip = true;
|
|
5217
|
+
} else {
|
|
5218
|
+
skip = false;
|
|
5219
|
+
}
|
|
5220
|
+
out += c;
|
|
5221
|
+
}
|
|
5222
|
+
}
|
|
5223
|
+
return out
|
|
5286
5224
|
}
|
|
5287
5225
|
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5226
|
+
function findToken (str, token) {
|
|
5227
|
+
let ind = 0;
|
|
5228
|
+
for (let i = 0; i < str.length; i++) {
|
|
5229
|
+
if (str[i] === token) ind++;
|
|
5230
|
+
}
|
|
5231
|
+
return ind
|
|
5232
|
+
}
|
|
5233
|
+
|
|
5234
|
+
const RDS1 = /^\.\.?\//u;
|
|
5235
|
+
const RDS2 = /^\/\.(?:\/|$)/u;
|
|
5236
|
+
const RDS3 = /^\/\.\.(?:\/|$)/u;
|
|
5237
|
+
const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/u;
|
|
5238
|
+
|
|
5239
|
+
function removeDotSegments$1 (input) {
|
|
5240
|
+
const output = [];
|
|
5241
|
+
|
|
5242
|
+
while (input.length) {
|
|
5243
|
+
if (input.match(RDS1)) {
|
|
5244
|
+
input = input.replace(RDS1, '');
|
|
5245
|
+
} else if (input.match(RDS2)) {
|
|
5246
|
+
input = input.replace(RDS2, '/');
|
|
5247
|
+
} else if (input.match(RDS3)) {
|
|
5248
|
+
input = input.replace(RDS3, '/');
|
|
5249
|
+
output.pop();
|
|
5250
|
+
} else if (input === '.' || input === '..') {
|
|
5251
|
+
input = '';
|
|
5252
|
+
} else {
|
|
5253
|
+
const im = input.match(RDS5);
|
|
5254
|
+
if (im) {
|
|
5255
|
+
const s = im[0];
|
|
5256
|
+
input = input.slice(s.length);
|
|
5257
|
+
output.push(s);
|
|
5258
|
+
} else {
|
|
5259
|
+
throw new Error('Unexpected dot segment condition')
|
|
5260
|
+
}
|
|
5261
|
+
}
|
|
5262
|
+
}
|
|
5263
|
+
return output.join('')
|
|
5312
5264
|
}
|
|
5313
5265
|
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
var extra = string.charCodeAt(counter++);
|
|
5336
|
-
if ((extra & 0xFC00) == 0xDC00) {
|
|
5337
|
-
// Low surrogate.
|
|
5338
|
-
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
|
5339
|
-
} else {
|
|
5340
|
-
// It's an unmatched surrogate; only append this code unit, in case the
|
|
5341
|
-
// next code unit is the high surrogate of a surrogate pair.
|
|
5342
|
-
output.push(value);
|
|
5343
|
-
counter--;
|
|
5344
|
-
}
|
|
5345
|
-
} else {
|
|
5346
|
-
output.push(value);
|
|
5347
|
-
}
|
|
5348
|
-
}
|
|
5349
|
-
return output;
|
|
5266
|
+
function normalizeComponentEncoding$1 (components, esc) {
|
|
5267
|
+
const func = esc !== true ? escape : unescape;
|
|
5268
|
+
if (components.scheme !== undefined) {
|
|
5269
|
+
components.scheme = func(components.scheme);
|
|
5270
|
+
}
|
|
5271
|
+
if (components.userinfo !== undefined) {
|
|
5272
|
+
components.userinfo = func(components.userinfo);
|
|
5273
|
+
}
|
|
5274
|
+
if (components.host !== undefined) {
|
|
5275
|
+
components.host = func(components.host);
|
|
5276
|
+
}
|
|
5277
|
+
if (components.path !== undefined) {
|
|
5278
|
+
components.path = func(components.path);
|
|
5279
|
+
}
|
|
5280
|
+
if (components.query !== undefined) {
|
|
5281
|
+
components.query = func(components.query);
|
|
5282
|
+
}
|
|
5283
|
+
if (components.fragment !== undefined) {
|
|
5284
|
+
components.fragment = func(components.fragment);
|
|
5285
|
+
}
|
|
5286
|
+
return components
|
|
5350
5287
|
}
|
|
5351
5288
|
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
* @see `punycode.ucs2.decode`
|
|
5355
|
-
* @memberOf punycode.ucs2
|
|
5356
|
-
* @name encode
|
|
5357
|
-
* @param {Array} codePoints The array of numeric code points.
|
|
5358
|
-
* @returns {String} The new Unicode string (UCS-2).
|
|
5359
|
-
*/
|
|
5360
|
-
var ucs2encode = function ucs2encode(array) {
|
|
5361
|
-
return String.fromCodePoint.apply(String, toConsumableArray(array));
|
|
5362
|
-
};
|
|
5289
|
+
function recomposeAuthority$1 (components) {
|
|
5290
|
+
const uriTokens = [];
|
|
5363
5291
|
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
* @param {Number} codePoint The basic numeric code point value.
|
|
5369
|
-
* @returns {Number} The numeric value of a basic code point (for use in
|
|
5370
|
-
* representing integers) in the range `0` to `base - 1`, or `base` if
|
|
5371
|
-
* the code point does not represent a value.
|
|
5372
|
-
*/
|
|
5373
|
-
var basicToDigit = function basicToDigit(codePoint) {
|
|
5374
|
-
if (codePoint - 0x30 < 0x0A) {
|
|
5375
|
-
return codePoint - 0x16;
|
|
5376
|
-
}
|
|
5377
|
-
if (codePoint - 0x41 < 0x1A) {
|
|
5378
|
-
return codePoint - 0x41;
|
|
5379
|
-
}
|
|
5380
|
-
if (codePoint - 0x61 < 0x1A) {
|
|
5381
|
-
return codePoint - 0x61;
|
|
5382
|
-
}
|
|
5383
|
-
return base;
|
|
5384
|
-
};
|
|
5385
|
-
|
|
5386
|
-
/**
|
|
5387
|
-
* Converts a digit/integer into a basic code point.
|
|
5388
|
-
* @see `basicToDigit()`
|
|
5389
|
-
* @private
|
|
5390
|
-
* @param {Number} digit The numeric value of a basic code point.
|
|
5391
|
-
* @returns {Number} The basic code point whose value (when used for
|
|
5392
|
-
* representing integers) is `digit`, which needs to be in the range
|
|
5393
|
-
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
|
5394
|
-
* used; else, the lowercase form is used. The behavior is undefined
|
|
5395
|
-
* if `flag` is non-zero and `digit` has no uppercase form.
|
|
5396
|
-
*/
|
|
5397
|
-
var digitToBasic = function digitToBasic(digit, flag) {
|
|
5398
|
-
// 0..25 map to ASCII a..z or A..Z
|
|
5399
|
-
// 26..35 map to ASCII 0..9
|
|
5400
|
-
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
|
5401
|
-
};
|
|
5402
|
-
|
|
5403
|
-
/**
|
|
5404
|
-
* Bias adaptation function as per section 3.4 of RFC 3492.
|
|
5405
|
-
* https://tools.ietf.org/html/rfc3492#section-3.4
|
|
5406
|
-
* @private
|
|
5407
|
-
*/
|
|
5408
|
-
var adapt = function adapt(delta, numPoints, firstTime) {
|
|
5409
|
-
var k = 0;
|
|
5410
|
-
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
|
5411
|
-
delta += floor(delta / numPoints);
|
|
5412
|
-
for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {
|
|
5413
|
-
delta = floor(delta / baseMinusTMin);
|
|
5414
|
-
}
|
|
5415
|
-
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
|
5416
|
-
};
|
|
5417
|
-
|
|
5418
|
-
/**
|
|
5419
|
-
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
|
|
5420
|
-
* symbols.
|
|
5421
|
-
* @memberOf punycode
|
|
5422
|
-
* @param {String} input The Punycode string of ASCII-only symbols.
|
|
5423
|
-
* @returns {String} The resulting string of Unicode symbols.
|
|
5424
|
-
*/
|
|
5425
|
-
var decode = function decode(input) {
|
|
5426
|
-
// Don't use UCS-2.
|
|
5427
|
-
var output = [];
|
|
5428
|
-
var inputLength = input.length;
|
|
5429
|
-
var i = 0;
|
|
5430
|
-
var n = initialN;
|
|
5431
|
-
var bias = initialBias;
|
|
5432
|
-
|
|
5433
|
-
// Handle the basic code points: let `basic` be the number of input code
|
|
5434
|
-
// points before the last delimiter, or `0` if there is none, then copy
|
|
5435
|
-
// the first basic code points to the output.
|
|
5436
|
-
|
|
5437
|
-
var basic = input.lastIndexOf(delimiter);
|
|
5438
|
-
if (basic < 0) {
|
|
5439
|
-
basic = 0;
|
|
5440
|
-
}
|
|
5441
|
-
|
|
5442
|
-
for (var j = 0; j < basic; ++j) {
|
|
5443
|
-
// if it's not a basic code point
|
|
5444
|
-
if (input.charCodeAt(j) >= 0x80) {
|
|
5445
|
-
error$1('not-basic');
|
|
5446
|
-
}
|
|
5447
|
-
output.push(input.charCodeAt(j));
|
|
5448
|
-
}
|
|
5449
|
-
|
|
5450
|
-
// Main decoding loop: start just after the last delimiter if any basic code
|
|
5451
|
-
// points were copied; start at the beginning otherwise.
|
|
5292
|
+
if (components.userinfo !== undefined) {
|
|
5293
|
+
uriTokens.push(components.userinfo);
|
|
5294
|
+
uriTokens.push('@');
|
|
5295
|
+
}
|
|
5452
5296
|
|
|
5453
|
-
|
|
5297
|
+
if (components.host !== undefined) {
|
|
5298
|
+
let host = unescape(components.host);
|
|
5299
|
+
const ipV4res = normalizeIPv4$1(host);
|
|
5454
5300
|
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5301
|
+
if (ipV4res.isIPV4) {
|
|
5302
|
+
host = ipV4res.host;
|
|
5303
|
+
} else {
|
|
5304
|
+
const ipV6res = normalizeIPv6$1(ipV4res.host);
|
|
5305
|
+
if (ipV6res.isIPV6 === true) {
|
|
5306
|
+
host = `[${ipV6res.escapedHost}]`;
|
|
5307
|
+
} else {
|
|
5308
|
+
host = components.host;
|
|
5309
|
+
}
|
|
5310
|
+
}
|
|
5311
|
+
uriTokens.push(host);
|
|
5312
|
+
}
|
|
5462
5313
|
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5314
|
+
if (typeof components.port === 'number' || typeof components.port === 'string') {
|
|
5315
|
+
uriTokens.push(':');
|
|
5316
|
+
uriTokens.push(String(components.port));
|
|
5317
|
+
}
|
|
5466
5318
|
|
|
5467
|
-
|
|
5319
|
+
return uriTokens.length ? uriTokens.join('') : undefined
|
|
5320
|
+
}
|
|
5321
|
+
var utils = {
|
|
5322
|
+
recomposeAuthority: recomposeAuthority$1,
|
|
5323
|
+
normalizeComponentEncoding: normalizeComponentEncoding$1,
|
|
5324
|
+
removeDotSegments: removeDotSegments$1,
|
|
5325
|
+
normalizeIPv4: normalizeIPv4$1,
|
|
5326
|
+
normalizeIPv6: normalizeIPv6$1,
|
|
5327
|
+
stringArrayToHexStripped
|
|
5328
|
+
};
|
|
5468
5329
|
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
}
|
|
5330
|
+
const UUID_REG = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu;
|
|
5331
|
+
const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
|
|
5472
5332
|
|
|
5473
|
-
|
|
5474
|
-
|
|
5333
|
+
function isSecure (wsComponents) {
|
|
5334
|
+
return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === 'wss'
|
|
5335
|
+
}
|
|
5475
5336
|
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5337
|
+
function httpParse (components) {
|
|
5338
|
+
if (!components.host) {
|
|
5339
|
+
components.error = components.error || 'HTTP URIs must have a host.';
|
|
5340
|
+
}
|
|
5479
5341
|
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
error$1('overflow');
|
|
5483
|
-
}
|
|
5342
|
+
return components
|
|
5343
|
+
}
|
|
5484
5344
|
|
|
5485
|
-
|
|
5486
|
-
|
|
5345
|
+
function httpSerialize (components) {
|
|
5346
|
+
const secure = String(components.scheme).toLowerCase() === 'https';
|
|
5487
5347
|
|
|
5488
|
-
|
|
5489
|
-
|
|
5348
|
+
// normalize the default port
|
|
5349
|
+
if (components.port === (secure ? 443 : 80) || components.port === '') {
|
|
5350
|
+
components.port = undefined;
|
|
5351
|
+
}
|
|
5490
5352
|
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
}
|
|
5353
|
+
// normalize the empty path
|
|
5354
|
+
if (!components.path) {
|
|
5355
|
+
components.path = '/';
|
|
5356
|
+
}
|
|
5496
5357
|
|
|
5497
|
-
|
|
5498
|
-
|
|
5358
|
+
// NOTE: We do not parse query strings for HTTP URIs
|
|
5359
|
+
// as WWW Form Url Encoded query strings are part of the HTML4+ spec,
|
|
5360
|
+
// and not the HTTP spec.
|
|
5499
5361
|
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
}
|
|
5362
|
+
return components
|
|
5363
|
+
}
|
|
5503
5364
|
|
|
5504
|
-
|
|
5505
|
-
|
|
5365
|
+
function wsParse (wsComponents) {
|
|
5366
|
+
// indicate if the secure flag is set
|
|
5367
|
+
wsComponents.secure = isSecure(wsComponents);
|
|
5506
5368
|
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
* @param {String} input The string of Unicode symbols.
|
|
5512
|
-
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
|
5513
|
-
*/
|
|
5514
|
-
var encode = function encode(input) {
|
|
5515
|
-
var output = [];
|
|
5369
|
+
// construct resouce name
|
|
5370
|
+
wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
|
|
5371
|
+
wsComponents.path = undefined;
|
|
5372
|
+
wsComponents.query = undefined;
|
|
5516
5373
|
|
|
5517
|
-
|
|
5518
|
-
|
|
5374
|
+
return wsComponents
|
|
5375
|
+
}
|
|
5519
5376
|
|
|
5520
|
-
|
|
5521
|
-
|
|
5377
|
+
function wsSerialize (wsComponents) {
|
|
5378
|
+
// normalize the default port
|
|
5379
|
+
if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === '') {
|
|
5380
|
+
wsComponents.port = undefined;
|
|
5381
|
+
}
|
|
5522
5382
|
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5383
|
+
// ensure scheme matches secure flag
|
|
5384
|
+
if (typeof wsComponents.secure === 'boolean') {
|
|
5385
|
+
wsComponents.scheme = (wsComponents.secure ? 'wss' : 'ws');
|
|
5386
|
+
wsComponents.secure = undefined;
|
|
5387
|
+
}
|
|
5527
5388
|
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5389
|
+
// reconstruct path from resource name
|
|
5390
|
+
if (wsComponents.resourceName) {
|
|
5391
|
+
const [path, query] = wsComponents.resourceName.split('?');
|
|
5392
|
+
wsComponents.path = (path && path !== '/' ? path : undefined);
|
|
5393
|
+
wsComponents.query = query;
|
|
5394
|
+
wsComponents.resourceName = undefined;
|
|
5395
|
+
}
|
|
5532
5396
|
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
var _currentValue2 = _step.value;
|
|
5397
|
+
// forbid fragment component
|
|
5398
|
+
wsComponents.fragment = undefined;
|
|
5536
5399
|
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
}
|
|
5540
|
-
}
|
|
5541
|
-
} catch (err) {
|
|
5542
|
-
_didIteratorError = true;
|
|
5543
|
-
_iteratorError = err;
|
|
5544
|
-
} finally {
|
|
5545
|
-
try {
|
|
5546
|
-
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
5547
|
-
_iterator.return();
|
|
5548
|
-
}
|
|
5549
|
-
} finally {
|
|
5550
|
-
if (_didIteratorError) {
|
|
5551
|
-
throw _iteratorError;
|
|
5552
|
-
}
|
|
5553
|
-
}
|
|
5554
|
-
}
|
|
5400
|
+
return wsComponents
|
|
5401
|
+
}
|
|
5555
5402
|
|
|
5556
|
-
|
|
5557
|
-
|
|
5403
|
+
function urnParse (urnComponents, options) {
|
|
5404
|
+
if (!urnComponents.path) {
|
|
5405
|
+
urnComponents.error = 'URN can not be parsed';
|
|
5406
|
+
return urnComponents
|
|
5407
|
+
}
|
|
5408
|
+
const matches = urnComponents.path.match(URN_REG);
|
|
5409
|
+
if (matches) {
|
|
5410
|
+
const scheme = options.scheme || urnComponents.scheme || 'urn';
|
|
5411
|
+
urnComponents.nid = matches[1].toLowerCase();
|
|
5412
|
+
urnComponents.nss = matches[2];
|
|
5413
|
+
const urnScheme = `${scheme}:${options.nid || urnComponents.nid}`;
|
|
5414
|
+
const schemeHandler = SCHEMES$1[urnScheme];
|
|
5415
|
+
urnComponents.path = undefined;
|
|
5416
|
+
|
|
5417
|
+
if (schemeHandler) {
|
|
5418
|
+
urnComponents = schemeHandler.parse(urnComponents, options);
|
|
5419
|
+
}
|
|
5420
|
+
} else {
|
|
5421
|
+
urnComponents.error = urnComponents.error || 'URN can not be parsed.';
|
|
5422
|
+
}
|
|
5558
5423
|
|
|
5559
|
-
|
|
5560
|
-
|
|
5424
|
+
return urnComponents
|
|
5425
|
+
}
|
|
5561
5426
|
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5427
|
+
function urnSerialize (urnComponents, options) {
|
|
5428
|
+
const scheme = options.scheme || urnComponents.scheme || 'urn';
|
|
5429
|
+
const nid = urnComponents.nid.toLowerCase();
|
|
5430
|
+
const urnScheme = `${scheme}:${options.nid || nid}`;
|
|
5431
|
+
const schemeHandler = SCHEMES$1[urnScheme];
|
|
5566
5432
|
|
|
5567
|
-
|
|
5568
|
-
|
|
5433
|
+
if (schemeHandler) {
|
|
5434
|
+
urnComponents = schemeHandler.serialize(urnComponents, options);
|
|
5435
|
+
}
|
|
5569
5436
|
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
var _iteratorNormalCompletion2 = true;
|
|
5574
|
-
var _didIteratorError2 = false;
|
|
5575
|
-
var _iteratorError2 = undefined;
|
|
5437
|
+
const uriComponents = urnComponents;
|
|
5438
|
+
const nss = urnComponents.nss;
|
|
5439
|
+
uriComponents.path = `${nid || options.nid}:${nss}`;
|
|
5576
5440
|
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5441
|
+
options.skipEscape = true;
|
|
5442
|
+
return uriComponents
|
|
5443
|
+
}
|
|
5580
5444
|
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5445
|
+
function urnuuidParse (urnComponents, options) {
|
|
5446
|
+
const uuidComponents = urnComponents;
|
|
5447
|
+
uuidComponents.uuid = uuidComponents.nss;
|
|
5448
|
+
uuidComponents.nss = undefined;
|
|
5585
5449
|
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
_didIteratorError2 = true;
|
|
5590
|
-
_iteratorError2 = err;
|
|
5591
|
-
} finally {
|
|
5592
|
-
try {
|
|
5593
|
-
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
5594
|
-
_iterator2.return();
|
|
5595
|
-
}
|
|
5596
|
-
} finally {
|
|
5597
|
-
if (_didIteratorError2) {
|
|
5598
|
-
throw _iteratorError2;
|
|
5599
|
-
}
|
|
5600
|
-
}
|
|
5601
|
-
}
|
|
5450
|
+
if (!options.tolerant && (!uuidComponents.uuid || !UUID_REG.test(uuidComponents.uuid))) {
|
|
5451
|
+
uuidComponents.error = uuidComponents.error || 'UUID is not valid.';
|
|
5452
|
+
}
|
|
5602
5453
|
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
error$1('overflow');
|
|
5606
|
-
}
|
|
5454
|
+
return uuidComponents
|
|
5455
|
+
}
|
|
5607
5456
|
|
|
5608
|
-
|
|
5609
|
-
|
|
5457
|
+
function urnuuidSerialize (uuidComponents) {
|
|
5458
|
+
const urnComponents = uuidComponents;
|
|
5459
|
+
// normalize UUID
|
|
5460
|
+
urnComponents.nss = (uuidComponents.uuid || '').toLowerCase();
|
|
5461
|
+
return urnComponents
|
|
5462
|
+
}
|
|
5610
5463
|
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5464
|
+
const http = {
|
|
5465
|
+
scheme: 'http',
|
|
5466
|
+
domainHost: true,
|
|
5467
|
+
parse: httpParse,
|
|
5468
|
+
serialize: httpSerialize
|
|
5469
|
+
};
|
|
5614
5470
|
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5471
|
+
const https = {
|
|
5472
|
+
scheme: 'https',
|
|
5473
|
+
domainHost: http.domainHost,
|
|
5474
|
+
parse: httpParse,
|
|
5475
|
+
serialize: httpSerialize
|
|
5476
|
+
};
|
|
5618
5477
|
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
for (var k = base;; /* no condition */k += base) {
|
|
5626
|
-
var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
|
|
5627
|
-
if (q < t) {
|
|
5628
|
-
break;
|
|
5629
|
-
}
|
|
5630
|
-
var qMinusT = q - t;
|
|
5631
|
-
var baseMinusT = base - t;
|
|
5632
|
-
output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
|
|
5633
|
-
q = floor(qMinusT / baseMinusT);
|
|
5634
|
-
}
|
|
5635
|
-
|
|
5636
|
-
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
|
5637
|
-
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
|
5638
|
-
delta = 0;
|
|
5639
|
-
++handledCPCount;
|
|
5640
|
-
}
|
|
5641
|
-
}
|
|
5642
|
-
} catch (err) {
|
|
5643
|
-
_didIteratorError3 = true;
|
|
5644
|
-
_iteratorError3 = err;
|
|
5645
|
-
} finally {
|
|
5646
|
-
try {
|
|
5647
|
-
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
|
5648
|
-
_iterator3.return();
|
|
5649
|
-
}
|
|
5650
|
-
} finally {
|
|
5651
|
-
if (_didIteratorError3) {
|
|
5652
|
-
throw _iteratorError3;
|
|
5653
|
-
}
|
|
5654
|
-
}
|
|
5655
|
-
}
|
|
5478
|
+
const ws = {
|
|
5479
|
+
scheme: 'ws',
|
|
5480
|
+
domainHost: true,
|
|
5481
|
+
parse: wsParse,
|
|
5482
|
+
serialize: wsSerialize
|
|
5483
|
+
};
|
|
5656
5484
|
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5485
|
+
const wss = {
|
|
5486
|
+
scheme: 'wss',
|
|
5487
|
+
domainHost: ws.domainHost,
|
|
5488
|
+
parse: ws.parse,
|
|
5489
|
+
serialize: ws.serialize
|
|
5661
5490
|
};
|
|
5662
5491
|
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
* @memberOf punycode
|
|
5669
|
-
* @param {String} input The Punycoded domain name or email address to
|
|
5670
|
-
* convert to Unicode.
|
|
5671
|
-
* @returns {String} The Unicode representation of the given Punycode
|
|
5672
|
-
* string.
|
|
5673
|
-
*/
|
|
5674
|
-
var toUnicode = function toUnicode(input) {
|
|
5675
|
-
return mapDomain(input, function (string) {
|
|
5676
|
-
return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
|
|
5677
|
-
});
|
|
5492
|
+
const urn = {
|
|
5493
|
+
scheme: 'urn',
|
|
5494
|
+
parse: urnParse,
|
|
5495
|
+
serialize: urnSerialize,
|
|
5496
|
+
skipNormalize: true
|
|
5678
5497
|
};
|
|
5679
5498
|
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
* @memberOf punycode
|
|
5686
|
-
* @param {String} input The domain name or email address to convert, as a
|
|
5687
|
-
* Unicode string.
|
|
5688
|
-
* @returns {String} The Punycode representation of the given domain name or
|
|
5689
|
-
* email address.
|
|
5690
|
-
*/
|
|
5691
|
-
var toASCII = function toASCII(input) {
|
|
5692
|
-
return mapDomain(input, function (string) {
|
|
5693
|
-
return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
|
|
5694
|
-
});
|
|
5499
|
+
const urnuuid = {
|
|
5500
|
+
scheme: 'urn:uuid',
|
|
5501
|
+
parse: urnuuidParse,
|
|
5502
|
+
serialize: urnuuidSerialize,
|
|
5503
|
+
skipNormalize: true
|
|
5695
5504
|
};
|
|
5696
5505
|
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
* @type String
|
|
5705
|
-
*/
|
|
5706
|
-
'version': '2.1.0',
|
|
5707
|
-
/**
|
|
5708
|
-
* An object of methods to convert from JavaScript's internal character
|
|
5709
|
-
* representation (UCS-2) to Unicode code points, and back.
|
|
5710
|
-
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
5711
|
-
* @memberOf punycode
|
|
5712
|
-
* @type Object
|
|
5713
|
-
*/
|
|
5714
|
-
'ucs2': {
|
|
5715
|
-
'decode': ucs2decode,
|
|
5716
|
-
'encode': ucs2encode
|
|
5717
|
-
},
|
|
5718
|
-
'decode': decode,
|
|
5719
|
-
'encode': encode,
|
|
5720
|
-
'toASCII': toASCII,
|
|
5721
|
-
'toUnicode': toUnicode
|
|
5506
|
+
const SCHEMES$1 = {
|
|
5507
|
+
http,
|
|
5508
|
+
https,
|
|
5509
|
+
ws,
|
|
5510
|
+
wss,
|
|
5511
|
+
urn,
|
|
5512
|
+
'urn:uuid': urnuuid
|
|
5722
5513
|
};
|
|
5723
5514
|
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
* @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
|
|
5729
|
-
* @see http://github.com/garycourt/uri-js
|
|
5730
|
-
*/
|
|
5731
|
-
/**
|
|
5732
|
-
* Copyright 2011 Gary Court. All rights reserved.
|
|
5733
|
-
*
|
|
5734
|
-
* Redistribution and use in source and binary forms, with or without modification, are
|
|
5735
|
-
* permitted provided that the following conditions are met:
|
|
5736
|
-
*
|
|
5737
|
-
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
|
5738
|
-
* conditions and the following disclaimer.
|
|
5739
|
-
*
|
|
5740
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
5741
|
-
* of conditions and the following disclaimer in the documentation and/or other materials
|
|
5742
|
-
* provided with the distribution.
|
|
5743
|
-
*
|
|
5744
|
-
* THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
5745
|
-
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
5746
|
-
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
|
|
5747
|
-
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
5748
|
-
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
5749
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
5750
|
-
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
5751
|
-
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
5752
|
-
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
5753
|
-
*
|
|
5754
|
-
* The views and conclusions contained in the software and documentation are those of the
|
|
5755
|
-
* authors and should not be interpreted as representing official policies, either expressed
|
|
5756
|
-
* or implied, of Gary Court.
|
|
5757
|
-
*/
|
|
5758
|
-
var SCHEMES = {};
|
|
5759
|
-
function pctEncChar(chr) {
|
|
5760
|
-
var c = chr.charCodeAt(0);
|
|
5761
|
-
var e = void 0;
|
|
5762
|
-
if (c < 16) e = "%0" + c.toString(16).toUpperCase();else if (c < 128) e = "%" + c.toString(16).toUpperCase();else if (c < 2048) e = "%" + (c >> 6 | 192).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();else e = "%" + (c >> 12 | 224).toString(16).toUpperCase() + "%" + (c >> 6 & 63 | 128).toString(16).toUpperCase() + "%" + (c & 63 | 128).toString(16).toUpperCase();
|
|
5763
|
-
return e;
|
|
5764
|
-
}
|
|
5765
|
-
function pctDecChars(str) {
|
|
5766
|
-
var newStr = "";
|
|
5767
|
-
var i = 0;
|
|
5768
|
-
var il = str.length;
|
|
5769
|
-
while (i < il) {
|
|
5770
|
-
var c = parseInt(str.substr(i + 1, 2), 16);
|
|
5771
|
-
if (c < 128) {
|
|
5772
|
-
newStr += String.fromCharCode(c);
|
|
5773
|
-
i += 3;
|
|
5774
|
-
} else if (c >= 194 && c < 224) {
|
|
5775
|
-
if (il - i >= 6) {
|
|
5776
|
-
var c2 = parseInt(str.substr(i + 4, 2), 16);
|
|
5777
|
-
newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);
|
|
5778
|
-
} else {
|
|
5779
|
-
newStr += str.substr(i, 6);
|
|
5780
|
-
}
|
|
5781
|
-
i += 6;
|
|
5782
|
-
} else if (c >= 224) {
|
|
5783
|
-
if (il - i >= 9) {
|
|
5784
|
-
var _c = parseInt(str.substr(i + 4, 2), 16);
|
|
5785
|
-
var c3 = parseInt(str.substr(i + 7, 2), 16);
|
|
5786
|
-
newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);
|
|
5787
|
-
} else {
|
|
5788
|
-
newStr += str.substr(i, 9);
|
|
5789
|
-
}
|
|
5790
|
-
i += 9;
|
|
5791
|
-
} else {
|
|
5792
|
-
newStr += str.substr(i, 3);
|
|
5793
|
-
i += 3;
|
|
5794
|
-
}
|
|
5795
|
-
}
|
|
5796
|
-
return newStr;
|
|
5797
|
-
}
|
|
5798
|
-
function _normalizeComponentEncoding(components, protocol) {
|
|
5799
|
-
function decodeUnreserved(str) {
|
|
5800
|
-
var decStr = pctDecChars(str);
|
|
5801
|
-
return !decStr.match(protocol.UNRESERVED) ? str : decStr;
|
|
5802
|
-
}
|
|
5803
|
-
if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
|
|
5804
|
-
if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
5805
|
-
if (components.host !== undefined) components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
5806
|
-
if (components.path !== undefined) components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
5807
|
-
if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
5808
|
-
if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
|
|
5809
|
-
return components;
|
|
5810
|
-
}
|
|
5515
|
+
var schemes = SCHEMES$1;
|
|
5516
|
+
|
|
5517
|
+
const { normalizeIPv6, normalizeIPv4, removeDotSegments, recomposeAuthority, normalizeComponentEncoding } = utils;
|
|
5518
|
+
const SCHEMES = schemes;
|
|
5811
5519
|
|
|
5812
|
-
function
|
|
5813
|
-
|
|
5520
|
+
function normalize (uri, options) {
|
|
5521
|
+
if (typeof uri === 'string') {
|
|
5522
|
+
uri = serialize(parse(uri, options), options);
|
|
5523
|
+
} else if (typeof uri === 'object') {
|
|
5524
|
+
uri = parse(serialize(uri, options), options);
|
|
5525
|
+
}
|
|
5526
|
+
return uri
|
|
5814
5527
|
}
|
|
5815
|
-
function _normalizeIPv4(host, protocol) {
|
|
5816
|
-
var matches = host.match(protocol.IPV4ADDRESS) || [];
|
|
5817
5528
|
|
|
5818
|
-
|
|
5819
|
-
|
|
5529
|
+
function resolve (baseURI, relativeURI, options) {
|
|
5530
|
+
const schemelessOptions = Object.assign({ scheme: 'null' }, options);
|
|
5531
|
+
const resolved = resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
5532
|
+
return serialize(resolved, { ...schemelessOptions, skipEscape: true })
|
|
5533
|
+
}
|
|
5820
5534
|
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
}
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
var fields = Array(fieldCount);
|
|
5846
|
-
for (var x = 0; x < fieldCount; ++x) {
|
|
5847
|
-
fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
|
|
5848
|
-
}
|
|
5849
|
-
if (isLastFieldIPv4Address) {
|
|
5850
|
-
fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
|
|
5851
|
-
}
|
|
5852
|
-
var allZeroFields = fields.reduce(function (acc, field, index) {
|
|
5853
|
-
if (!field || field === "0") {
|
|
5854
|
-
var lastLongest = acc[acc.length - 1];
|
|
5855
|
-
if (lastLongest && lastLongest.index + lastLongest.length === index) {
|
|
5856
|
-
lastLongest.length++;
|
|
5857
|
-
} else {
|
|
5858
|
-
acc.push({ index: index, length: 1 });
|
|
5859
|
-
}
|
|
5860
|
-
}
|
|
5861
|
-
return acc;
|
|
5862
|
-
}, []);
|
|
5863
|
-
var longestZeroFields = allZeroFields.sort(function (a, b) {
|
|
5864
|
-
return b.length - a.length;
|
|
5865
|
-
})[0];
|
|
5866
|
-
var newHost = void 0;
|
|
5867
|
-
if (longestZeroFields && longestZeroFields.length > 1) {
|
|
5868
|
-
var newFirst = fields.slice(0, longestZeroFields.index);
|
|
5869
|
-
var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
|
|
5870
|
-
newHost = newFirst.join(":") + "::" + newLast.join(":");
|
|
5871
|
-
} else {
|
|
5872
|
-
newHost = fields.join(":");
|
|
5873
|
-
}
|
|
5874
|
-
if (zone) {
|
|
5875
|
-
newHost += "%" + zone;
|
|
5876
|
-
}
|
|
5877
|
-
return newHost;
|
|
5535
|
+
function resolveComponents (base, relative, options, skipNormalization) {
|
|
5536
|
+
const target = {};
|
|
5537
|
+
if (!skipNormalization) {
|
|
5538
|
+
base = parse(serialize(base, options), options); // normalize base components
|
|
5539
|
+
relative = parse(serialize(relative, options), options); // normalize relative components
|
|
5540
|
+
}
|
|
5541
|
+
options = options || {};
|
|
5542
|
+
|
|
5543
|
+
if (!options.tolerant && relative.scheme) {
|
|
5544
|
+
target.scheme = relative.scheme;
|
|
5545
|
+
// target.authority = relative.authority;
|
|
5546
|
+
target.userinfo = relative.userinfo;
|
|
5547
|
+
target.host = relative.host;
|
|
5548
|
+
target.port = relative.port;
|
|
5549
|
+
target.path = removeDotSegments(relative.path || '');
|
|
5550
|
+
target.query = relative.query;
|
|
5551
|
+
} else {
|
|
5552
|
+
if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
|
|
5553
|
+
// target.authority = relative.authority;
|
|
5554
|
+
target.userinfo = relative.userinfo;
|
|
5555
|
+
target.host = relative.host;
|
|
5556
|
+
target.port = relative.port;
|
|
5557
|
+
target.path = removeDotSegments(relative.path || '');
|
|
5558
|
+
target.query = relative.query;
|
|
5878
5559
|
} else {
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined;
|
|
5884
|
-
function parse(uriString) {
|
|
5885
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5886
|
-
|
|
5887
|
-
var components = {};
|
|
5888
|
-
var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
|
|
5889
|
-
if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
|
|
5890
|
-
var matches = uriString.match(URI_PARSE);
|
|
5891
|
-
if (matches) {
|
|
5892
|
-
if (NO_MATCH_IS_UNDEFINED) {
|
|
5893
|
-
//store each component
|
|
5894
|
-
components.scheme = matches[1];
|
|
5895
|
-
components.userinfo = matches[3];
|
|
5896
|
-
components.host = matches[4];
|
|
5897
|
-
components.port = parseInt(matches[5], 10);
|
|
5898
|
-
components.path = matches[6] || "";
|
|
5899
|
-
components.query = matches[7];
|
|
5900
|
-
components.fragment = matches[8];
|
|
5901
|
-
//fix port number
|
|
5902
|
-
if (isNaN(components.port)) {
|
|
5903
|
-
components.port = matches[5];
|
|
5904
|
-
}
|
|
5560
|
+
if (!relative.path) {
|
|
5561
|
+
target.path = base.path;
|
|
5562
|
+
if (relative.query !== undefined) {
|
|
5563
|
+
target.query = relative.query;
|
|
5905
5564
|
} else {
|
|
5906
|
-
|
|
5907
|
-
//store each component
|
|
5908
|
-
components.scheme = matches[1] || undefined;
|
|
5909
|
-
components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined;
|
|
5910
|
-
components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined;
|
|
5911
|
-
components.port = parseInt(matches[5], 10);
|
|
5912
|
-
components.path = matches[6] || "";
|
|
5913
|
-
components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined;
|
|
5914
|
-
components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined;
|
|
5915
|
-
//fix port number
|
|
5916
|
-
if (isNaN(components.port)) {
|
|
5917
|
-
components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined;
|
|
5918
|
-
}
|
|
5565
|
+
target.query = base.query;
|
|
5919
5566
|
}
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
}
|
|
5924
|
-
//determine reference type
|
|
5925
|
-
if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
|
|
5926
|
-
components.reference = "same-document";
|
|
5927
|
-
} else if (components.scheme === undefined) {
|
|
5928
|
-
components.reference = "relative";
|
|
5929
|
-
} else if (components.fragment === undefined) {
|
|
5930
|
-
components.reference = "absolute";
|
|
5931
|
-
} else {
|
|
5932
|
-
components.reference = "uri";
|
|
5933
|
-
}
|
|
5934
|
-
//check for reference errors
|
|
5935
|
-
if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
|
|
5936
|
-
components.error = components.error || "URI is not a " + options.reference + " reference.";
|
|
5937
|
-
}
|
|
5938
|
-
//find scheme handler
|
|
5939
|
-
var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
|
|
5940
|
-
//check if scheme can't handle IRIs
|
|
5941
|
-
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
|
|
5942
|
-
//if host component is a domain name
|
|
5943
|
-
if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {
|
|
5944
|
-
//convert Unicode IDN -> ASCII IDN
|
|
5945
|
-
try {
|
|
5946
|
-
components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
|
|
5947
|
-
} catch (e) {
|
|
5948
|
-
components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
|
|
5949
|
-
}
|
|
5950
|
-
}
|
|
5951
|
-
//convert IRI -> URI
|
|
5952
|
-
_normalizeComponentEncoding(components, URI_PROTOCOL);
|
|
5567
|
+
} else {
|
|
5568
|
+
if (relative.path.charAt(0) === '/') {
|
|
5569
|
+
target.path = removeDotSegments(relative.path);
|
|
5953
5570
|
} else {
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5571
|
+
if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
|
|
5572
|
+
target.path = '/' + relative.path;
|
|
5573
|
+
} else if (!base.path) {
|
|
5574
|
+
target.path = relative.path;
|
|
5575
|
+
} else {
|
|
5576
|
+
target.path = base.path.slice(0, base.path.lastIndexOf('/') + 1) + relative.path;
|
|
5577
|
+
}
|
|
5578
|
+
target.path = removeDotSegments(target.path);
|
|
5960
5579
|
}
|
|
5961
|
-
|
|
5962
|
-
|
|
5580
|
+
target.query = relative.query;
|
|
5581
|
+
}
|
|
5582
|
+
// target.authority = base.authority;
|
|
5583
|
+
target.userinfo = base.userinfo;
|
|
5584
|
+
target.host = base.host;
|
|
5585
|
+
target.port = base.port;
|
|
5963
5586
|
}
|
|
5964
|
-
|
|
5965
|
-
}
|
|
5587
|
+
target.scheme = base.scheme;
|
|
5588
|
+
}
|
|
5966
5589
|
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
if (components.userinfo !== undefined) {
|
|
5971
|
-
uriTokens.push(components.userinfo);
|
|
5972
|
-
uriTokens.push("@");
|
|
5973
|
-
}
|
|
5974
|
-
if (components.host !== undefined) {
|
|
5975
|
-
//normalize IP hosts, add brackets and escape zone separator for IPv6
|
|
5976
|
-
uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {
|
|
5977
|
-
return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
|
|
5978
|
-
}));
|
|
5979
|
-
}
|
|
5980
|
-
if (typeof components.port === "number" || typeof components.port === "string") {
|
|
5981
|
-
uriTokens.push(":");
|
|
5982
|
-
uriTokens.push(String(components.port));
|
|
5983
|
-
}
|
|
5984
|
-
return uriTokens.length ? uriTokens.join("") : undefined;
|
|
5985
|
-
}
|
|
5986
|
-
|
|
5987
|
-
var RDS1 = /^\.\.?\//;
|
|
5988
|
-
var RDS2 = /^\/\.(\/|$)/;
|
|
5989
|
-
var RDS3 = /^\/\.\.(\/|$)/;
|
|
5990
|
-
var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
|
|
5991
|
-
function removeDotSegments(input) {
|
|
5992
|
-
var output = [];
|
|
5993
|
-
while (input.length) {
|
|
5994
|
-
if (input.match(RDS1)) {
|
|
5995
|
-
input = input.replace(RDS1, "");
|
|
5996
|
-
} else if (input.match(RDS2)) {
|
|
5997
|
-
input = input.replace(RDS2, "/");
|
|
5998
|
-
} else if (input.match(RDS3)) {
|
|
5999
|
-
input = input.replace(RDS3, "/");
|
|
6000
|
-
output.pop();
|
|
6001
|
-
} else if (input === "." || input === "..") {
|
|
6002
|
-
input = "";
|
|
6003
|
-
} else {
|
|
6004
|
-
var im = input.match(RDS5);
|
|
6005
|
-
if (im) {
|
|
6006
|
-
var s = im[0];
|
|
6007
|
-
input = input.slice(s.length);
|
|
6008
|
-
output.push(s);
|
|
6009
|
-
} else {
|
|
6010
|
-
throw new Error("Unexpected dot segment condition");
|
|
6011
|
-
}
|
|
6012
|
-
}
|
|
6013
|
-
}
|
|
6014
|
-
return output.join("");
|
|
5590
|
+
target.fragment = relative.fragment;
|
|
5591
|
+
|
|
5592
|
+
return target
|
|
6015
5593
|
}
|
|
6016
5594
|
|
|
6017
|
-
function
|
|
6018
|
-
|
|
5595
|
+
function equal$2 (uriA, uriB, options) {
|
|
5596
|
+
if (typeof uriA === 'string') {
|
|
5597
|
+
uriA = unescape(uriA);
|
|
5598
|
+
uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true });
|
|
5599
|
+
} else if (typeof uriA === 'object') {
|
|
5600
|
+
uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
|
|
5601
|
+
}
|
|
6019
5602
|
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
if (components.host) {
|
|
6027
|
-
//if host component is an IPv6 address
|
|
6028
|
-
if (protocol.IPV6ADDRESS.test(components.host)) ;
|
|
6029
|
-
//TODO: normalize IPv6 address as per RFC 5952
|
|
5603
|
+
if (typeof uriB === 'string') {
|
|
5604
|
+
uriB = unescape(uriB);
|
|
5605
|
+
uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true });
|
|
5606
|
+
} else if (typeof uriB === 'object') {
|
|
5607
|
+
uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
|
|
5608
|
+
}
|
|
6030
5609
|
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
if (components.path && components.path.charAt(0) !== "/") {
|
|
6054
|
-
uriTokens.push("/");
|
|
6055
|
-
}
|
|
6056
|
-
}
|
|
6057
|
-
if (components.path !== undefined) {
|
|
6058
|
-
var s = components.path;
|
|
6059
|
-
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
6060
|
-
s = removeDotSegments(s);
|
|
6061
|
-
}
|
|
6062
|
-
if (authority === undefined) {
|
|
6063
|
-
s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
|
|
6064
|
-
}
|
|
6065
|
-
uriTokens.push(s);
|
|
6066
|
-
}
|
|
6067
|
-
if (components.query !== undefined) {
|
|
6068
|
-
uriTokens.push("?");
|
|
6069
|
-
uriTokens.push(components.query);
|
|
6070
|
-
}
|
|
6071
|
-
if (components.fragment !== undefined) {
|
|
6072
|
-
uriTokens.push("#");
|
|
6073
|
-
uriTokens.push(components.fragment);
|
|
6074
|
-
}
|
|
6075
|
-
return uriTokens.join(""); //merge tokens into a string
|
|
6076
|
-
}
|
|
5610
|
+
return uriA.toLowerCase() === uriB.toLowerCase()
|
|
5611
|
+
}
|
|
5612
|
+
|
|
5613
|
+
function serialize (cmpts, opts) {
|
|
5614
|
+
const components = {
|
|
5615
|
+
host: cmpts.host,
|
|
5616
|
+
scheme: cmpts.scheme,
|
|
5617
|
+
userinfo: cmpts.userinfo,
|
|
5618
|
+
port: cmpts.port,
|
|
5619
|
+
path: cmpts.path,
|
|
5620
|
+
query: cmpts.query,
|
|
5621
|
+
nid: cmpts.nid,
|
|
5622
|
+
nss: cmpts.nss,
|
|
5623
|
+
uuid: cmpts.uuid,
|
|
5624
|
+
fragment: cmpts.fragment,
|
|
5625
|
+
reference: cmpts.reference,
|
|
5626
|
+
resourceName: cmpts.resourceName,
|
|
5627
|
+
secure: cmpts.secure,
|
|
5628
|
+
error: ''
|
|
5629
|
+
};
|
|
5630
|
+
const options = Object.assign({}, opts);
|
|
5631
|
+
const uriTokens = [];
|
|
6077
5632
|
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
var skipNormalization = arguments[3];
|
|
5633
|
+
// find scheme handler
|
|
5634
|
+
const schemeHandler = SCHEMES[(options.scheme || components.scheme || '').toLowerCase()];
|
|
6081
5635
|
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
target.host = relative.host;
|
|
6093
|
-
target.port = relative.port;
|
|
6094
|
-
target.path = removeDotSegments(relative.path || "");
|
|
6095
|
-
target.query = relative.query;
|
|
5636
|
+
// perform scheme specific serialization
|
|
5637
|
+
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
|
|
5638
|
+
|
|
5639
|
+
if (components.path !== undefined) {
|
|
5640
|
+
if (!options.skipEscape) {
|
|
5641
|
+
components.path = escape(components.path);
|
|
5642
|
+
|
|
5643
|
+
if (components.scheme !== undefined) {
|
|
5644
|
+
components.path = components.path.split('%3A').join(':');
|
|
5645
|
+
}
|
|
6096
5646
|
} else {
|
|
6097
|
-
|
|
6098
|
-
//target.authority = relative.authority;
|
|
6099
|
-
target.userinfo = relative.userinfo;
|
|
6100
|
-
target.host = relative.host;
|
|
6101
|
-
target.port = relative.port;
|
|
6102
|
-
target.path = removeDotSegments(relative.path || "");
|
|
6103
|
-
target.query = relative.query;
|
|
6104
|
-
} else {
|
|
6105
|
-
if (!relative.path) {
|
|
6106
|
-
target.path = base.path;
|
|
6107
|
-
if (relative.query !== undefined) {
|
|
6108
|
-
target.query = relative.query;
|
|
6109
|
-
} else {
|
|
6110
|
-
target.query = base.query;
|
|
6111
|
-
}
|
|
6112
|
-
} else {
|
|
6113
|
-
if (relative.path.charAt(0) === "/") {
|
|
6114
|
-
target.path = removeDotSegments(relative.path);
|
|
6115
|
-
} else {
|
|
6116
|
-
if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
|
|
6117
|
-
target.path = "/" + relative.path;
|
|
6118
|
-
} else if (!base.path) {
|
|
6119
|
-
target.path = relative.path;
|
|
6120
|
-
} else {
|
|
6121
|
-
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
|
|
6122
|
-
}
|
|
6123
|
-
target.path = removeDotSegments(target.path);
|
|
6124
|
-
}
|
|
6125
|
-
target.query = relative.query;
|
|
6126
|
-
}
|
|
6127
|
-
//target.authority = base.authority;
|
|
6128
|
-
target.userinfo = base.userinfo;
|
|
6129
|
-
target.host = base.host;
|
|
6130
|
-
target.port = base.port;
|
|
6131
|
-
}
|
|
6132
|
-
target.scheme = base.scheme;
|
|
5647
|
+
components.path = unescape(components.path);
|
|
6133
5648
|
}
|
|
6134
|
-
|
|
6135
|
-
return target;
|
|
6136
|
-
}
|
|
5649
|
+
}
|
|
6137
5650
|
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
}
|
|
5651
|
+
if (options.reference !== 'suffix' && components.scheme) {
|
|
5652
|
+
uriTokens.push(components.scheme, ':');
|
|
5653
|
+
}
|
|
6142
5654
|
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
uri = parse(serialize(uri, options), options);
|
|
5655
|
+
const authority = recomposeAuthority(components);
|
|
5656
|
+
if (authority !== undefined) {
|
|
5657
|
+
if (options.reference !== 'suffix') {
|
|
5658
|
+
uriTokens.push('//');
|
|
6148
5659
|
}
|
|
6149
|
-
return uri;
|
|
6150
|
-
}
|
|
6151
5660
|
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
uriA = serialize(uriA, options);
|
|
5661
|
+
uriTokens.push(authority);
|
|
5662
|
+
|
|
5663
|
+
if (components.path && components.path.charAt(0) !== '/') {
|
|
5664
|
+
uriTokens.push('/');
|
|
6157
5665
|
}
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
5666
|
+
}
|
|
5667
|
+
if (components.path !== undefined) {
|
|
5668
|
+
let s = components.path;
|
|
5669
|
+
|
|
5670
|
+
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
5671
|
+
s = removeDotSegments(s);
|
|
6162
5672
|
}
|
|
6163
|
-
return uriA === uriB;
|
|
6164
|
-
}
|
|
6165
5673
|
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
}
|
|
5674
|
+
if (authority === undefined) {
|
|
5675
|
+
s = s.replace(/^\/\//u, '/%2F'); // don't allow the path to start with "//"
|
|
5676
|
+
}
|
|
5677
|
+
|
|
5678
|
+
uriTokens.push(s);
|
|
5679
|
+
}
|
|
5680
|
+
|
|
5681
|
+
if (components.query !== undefined) {
|
|
5682
|
+
uriTokens.push('?', components.query);
|
|
5683
|
+
}
|
|
6169
5684
|
|
|
6170
|
-
|
|
6171
|
-
|
|
5685
|
+
if (components.fragment !== undefined) {
|
|
5686
|
+
uriTokens.push('#', components.fragment);
|
|
5687
|
+
}
|
|
5688
|
+
return uriTokens.join('')
|
|
6172
5689
|
}
|
|
6173
5690
|
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
return components;
|
|
6183
|
-
},
|
|
6184
|
-
serialize: function serialize(components, options) {
|
|
6185
|
-
var secure = String(components.scheme).toLowerCase() === "https";
|
|
6186
|
-
//normalize the default port
|
|
6187
|
-
if (components.port === (secure ? 443 : 80) || components.port === "") {
|
|
6188
|
-
components.port = undefined;
|
|
6189
|
-
}
|
|
6190
|
-
//normalize the empty path
|
|
6191
|
-
if (!components.path) {
|
|
6192
|
-
components.path = "/";
|
|
6193
|
-
}
|
|
6194
|
-
//NOTE: We do not parse query strings for HTTP URIs
|
|
6195
|
-
//as WWW Form Url Encoded query strings are part of the HTML4+ spec,
|
|
6196
|
-
//and not the HTTP spec.
|
|
6197
|
-
return components;
|
|
5691
|
+
const hexLookUp = Array.from({ length: 127 }, (_v, k) => /[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(k)));
|
|
5692
|
+
|
|
5693
|
+
function nonSimpleDomain (value) {
|
|
5694
|
+
let code = 0;
|
|
5695
|
+
for (let i = 0, len = value.length; i < len; ++i) {
|
|
5696
|
+
code = value.charCodeAt(i);
|
|
5697
|
+
if (code > 126 || hexLookUp[code]) {
|
|
5698
|
+
return true
|
|
6198
5699
|
}
|
|
6199
|
-
}
|
|
5700
|
+
}
|
|
5701
|
+
return false
|
|
5702
|
+
}
|
|
6200
5703
|
|
|
6201
|
-
|
|
6202
|
-
scheme: "https",
|
|
6203
|
-
domainHost: handler.domainHost,
|
|
6204
|
-
parse: handler.parse,
|
|
6205
|
-
serialize: handler.serialize
|
|
6206
|
-
};
|
|
5704
|
+
const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
6207
5705
|
|
|
6208
|
-
function
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
5706
|
+
function parse (uri, opts) {
|
|
5707
|
+
const options = Object.assign({}, opts);
|
|
5708
|
+
const parsed = {
|
|
5709
|
+
scheme: undefined,
|
|
5710
|
+
userinfo: undefined,
|
|
5711
|
+
host: '',
|
|
5712
|
+
port: undefined,
|
|
5713
|
+
path: '',
|
|
5714
|
+
query: undefined,
|
|
5715
|
+
fragment: undefined
|
|
5716
|
+
};
|
|
5717
|
+
const gotEncoding = uri.indexOf('%') !== -1;
|
|
5718
|
+
let isIP = false;
|
|
5719
|
+
if (options.reference === 'suffix') uri = (options.scheme ? options.scheme + ':' : '') + '//' + uri;
|
|
5720
|
+
|
|
5721
|
+
const matches = uri.match(URI_PARSE);
|
|
5722
|
+
|
|
5723
|
+
if (matches) {
|
|
5724
|
+
// store each component
|
|
5725
|
+
parsed.scheme = matches[1];
|
|
5726
|
+
parsed.userinfo = matches[3];
|
|
5727
|
+
parsed.host = matches[4];
|
|
5728
|
+
parsed.port = parseInt(matches[5], 10);
|
|
5729
|
+
parsed.path = matches[6] || '';
|
|
5730
|
+
parsed.query = matches[7];
|
|
5731
|
+
parsed.fragment = matches[8];
|
|
5732
|
+
|
|
5733
|
+
// fix port number
|
|
5734
|
+
if (isNaN(parsed.port)) {
|
|
5735
|
+
parsed.port = matches[5];
|
|
5736
|
+
}
|
|
5737
|
+
if (parsed.host) {
|
|
5738
|
+
const ipv4result = normalizeIPv4(parsed.host);
|
|
5739
|
+
if (ipv4result.isIPV4 === false) {
|
|
5740
|
+
const ipv6result = normalizeIPv6(ipv4result.host);
|
|
5741
|
+
parsed.host = ipv6result.host.toLowerCase();
|
|
5742
|
+
isIP = ipv6result.isIPV6;
|
|
5743
|
+
} else {
|
|
5744
|
+
parsed.host = ipv4result.host;
|
|
5745
|
+
isIP = true;
|
|
5746
|
+
}
|
|
5747
|
+
}
|
|
5748
|
+
if (parsed.scheme === undefined && parsed.userinfo === undefined && parsed.host === undefined && parsed.port === undefined && parsed.query === undefined && !parsed.path) {
|
|
5749
|
+
parsed.reference = 'same-document';
|
|
5750
|
+
} else if (parsed.scheme === undefined) {
|
|
5751
|
+
parsed.reference = 'relative';
|
|
5752
|
+
} else if (parsed.fragment === undefined) {
|
|
5753
|
+
parsed.reference = 'absolute';
|
|
5754
|
+
} else {
|
|
5755
|
+
parsed.reference = 'uri';
|
|
6249
5756
|
}
|
|
6250
|
-
};
|
|
6251
5757
|
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
serialize: handler$2.serialize
|
|
6257
|
-
};
|
|
5758
|
+
// check for reference errors
|
|
5759
|
+
if (options.reference && options.reference !== 'suffix' && options.reference !== parsed.reference) {
|
|
5760
|
+
parsed.error = parsed.error || 'URI is not a ' + options.reference + ' reference.';
|
|
5761
|
+
}
|
|
6258
5762
|
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
//
|
|
6265
|
-
|
|
6266
|
-
//
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
//const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
|
|
6272
|
-
//const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
|
|
6273
|
-
//const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
|
|
6274
|
-
//const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
|
|
6275
|
-
var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
|
|
6276
|
-
var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
|
|
6277
|
-
var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
|
|
6278
|
-
var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
|
|
6279
|
-
var UNRESERVED = new RegExp(UNRESERVED$$, "g");
|
|
6280
|
-
var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
|
|
6281
|
-
var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
|
|
6282
|
-
var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
|
|
6283
|
-
var NOT_HFVALUE = NOT_HFNAME;
|
|
6284
|
-
function decodeUnreserved(str) {
|
|
6285
|
-
var decStr = pctDecChars(str);
|
|
6286
|
-
return !decStr.match(UNRESERVED) ? str : decStr;
|
|
6287
|
-
}
|
|
6288
|
-
var handler$4 = {
|
|
6289
|
-
scheme: "mailto",
|
|
6290
|
-
parse: function parse$$1(components, options) {
|
|
6291
|
-
var mailtoComponents = components;
|
|
6292
|
-
var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : [];
|
|
6293
|
-
mailtoComponents.path = undefined;
|
|
6294
|
-
if (mailtoComponents.query) {
|
|
6295
|
-
var unknownHeaders = false;
|
|
6296
|
-
var headers = {};
|
|
6297
|
-
var hfields = mailtoComponents.query.split("&");
|
|
6298
|
-
for (var x = 0, xl = hfields.length; x < xl; ++x) {
|
|
6299
|
-
var hfield = hfields[x].split("=");
|
|
6300
|
-
switch (hfield[0]) {
|
|
6301
|
-
case "to":
|
|
6302
|
-
var toAddrs = hfield[1].split(",");
|
|
6303
|
-
for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {
|
|
6304
|
-
to.push(toAddrs[_x]);
|
|
6305
|
-
}
|
|
6306
|
-
break;
|
|
6307
|
-
case "subject":
|
|
6308
|
-
mailtoComponents.subject = unescapeComponent(hfield[1], options);
|
|
6309
|
-
break;
|
|
6310
|
-
case "body":
|
|
6311
|
-
mailtoComponents.body = unescapeComponent(hfield[1], options);
|
|
6312
|
-
break;
|
|
6313
|
-
default:
|
|
6314
|
-
unknownHeaders = true;
|
|
6315
|
-
headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
|
|
6316
|
-
break;
|
|
6317
|
-
}
|
|
6318
|
-
}
|
|
6319
|
-
if (unknownHeaders) mailtoComponents.headers = headers;
|
|
6320
|
-
}
|
|
6321
|
-
mailtoComponents.query = undefined;
|
|
6322
|
-
for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {
|
|
6323
|
-
var addr = to[_x2].split("@");
|
|
6324
|
-
addr[0] = unescapeComponent(addr[0]);
|
|
6325
|
-
if (!options.unicodeSupport) {
|
|
6326
|
-
//convert Unicode IDN -> ASCII IDN
|
|
6327
|
-
try {
|
|
6328
|
-
addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
|
|
6329
|
-
} catch (e) {
|
|
6330
|
-
mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
|
|
6331
|
-
}
|
|
6332
|
-
} else {
|
|
6333
|
-
addr[1] = unescapeComponent(addr[1], options).toLowerCase();
|
|
6334
|
-
}
|
|
6335
|
-
to[_x2] = addr.join("@");
|
|
6336
|
-
}
|
|
6337
|
-
return mailtoComponents;
|
|
6338
|
-
},
|
|
6339
|
-
serialize: function serialize$$1(mailtoComponents, options) {
|
|
6340
|
-
var components = mailtoComponents;
|
|
6341
|
-
var to = toArray(mailtoComponents.to);
|
|
6342
|
-
if (to) {
|
|
6343
|
-
for (var x = 0, xl = to.length; x < xl; ++x) {
|
|
6344
|
-
var toAddr = String(to[x]);
|
|
6345
|
-
var atIdx = toAddr.lastIndexOf("@");
|
|
6346
|
-
var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
|
|
6347
|
-
var domain = toAddr.slice(atIdx + 1);
|
|
6348
|
-
//convert IDN via punycode
|
|
6349
|
-
try {
|
|
6350
|
-
domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);
|
|
6351
|
-
} catch (e) {
|
|
6352
|
-
components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
|
|
6353
|
-
}
|
|
6354
|
-
to[x] = localPart + "@" + domain;
|
|
6355
|
-
}
|
|
6356
|
-
components.path = to.join(",");
|
|
6357
|
-
}
|
|
6358
|
-
var headers = mailtoComponents.headers = mailtoComponents.headers || {};
|
|
6359
|
-
if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
|
|
6360
|
-
if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
|
|
6361
|
-
var fields = [];
|
|
6362
|
-
for (var name in headers) {
|
|
6363
|
-
if (headers[name] !== O[name]) {
|
|
6364
|
-
fields.push(name.replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFNAME, pctEncChar) + "=" + headers[name].replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_HFVALUE, pctEncChar));
|
|
6365
|
-
}
|
|
6366
|
-
}
|
|
6367
|
-
if (fields.length) {
|
|
6368
|
-
components.query = fields.join("&");
|
|
5763
|
+
// find scheme handler
|
|
5764
|
+
const schemeHandler = SCHEMES[(options.scheme || parsed.scheme || '').toLowerCase()];
|
|
5765
|
+
|
|
5766
|
+
// check if scheme can't handle IRIs
|
|
5767
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
|
|
5768
|
+
// if host component is a domain name
|
|
5769
|
+
if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
5770
|
+
// convert Unicode IDN -> ASCII IDN
|
|
5771
|
+
try {
|
|
5772
|
+
parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
|
|
5773
|
+
} catch (e) {
|
|
5774
|
+
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
6369
5775
|
}
|
|
6370
|
-
|
|
5776
|
+
}
|
|
5777
|
+
// convert IRI -> URI
|
|
6371
5778
|
}
|
|
6372
|
-
};
|
|
6373
5779
|
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
urnComponents.nid = nid;
|
|
6388
|
-
urnComponents.nss = nss;
|
|
6389
|
-
urnComponents.path = undefined;
|
|
6390
|
-
if (schemeHandler) {
|
|
6391
|
-
urnComponents = schemeHandler.parse(urnComponents, options);
|
|
6392
|
-
}
|
|
6393
|
-
} else {
|
|
6394
|
-
urnComponents.error = urnComponents.error || "URN can not be parsed.";
|
|
6395
|
-
}
|
|
6396
|
-
return urnComponents;
|
|
6397
|
-
},
|
|
6398
|
-
serialize: function serialize$$1(urnComponents, options) {
|
|
6399
|
-
var scheme = options.scheme || urnComponents.scheme || "urn";
|
|
6400
|
-
var nid = urnComponents.nid;
|
|
6401
|
-
var urnScheme = scheme + ":" + (options.nid || nid);
|
|
6402
|
-
var schemeHandler = SCHEMES[urnScheme];
|
|
6403
|
-
if (schemeHandler) {
|
|
6404
|
-
urnComponents = schemeHandler.serialize(urnComponents, options);
|
|
6405
|
-
}
|
|
6406
|
-
var uriComponents = urnComponents;
|
|
6407
|
-
var nss = urnComponents.nss;
|
|
6408
|
-
uriComponents.path = (nid || options.nid) + ":" + nss;
|
|
6409
|
-
return uriComponents;
|
|
5780
|
+
if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) {
|
|
5781
|
+
if (gotEncoding && parsed.scheme !== undefined) {
|
|
5782
|
+
parsed.scheme = unescape(parsed.scheme);
|
|
5783
|
+
}
|
|
5784
|
+
if (gotEncoding && parsed.host !== undefined) {
|
|
5785
|
+
parsed.host = unescape(parsed.host);
|
|
5786
|
+
}
|
|
5787
|
+
if (parsed.path) {
|
|
5788
|
+
parsed.path = escape(unescape(parsed.path));
|
|
5789
|
+
}
|
|
5790
|
+
if (parsed.fragment) {
|
|
5791
|
+
parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
|
|
5792
|
+
}
|
|
6410
5793
|
}
|
|
6411
|
-
};
|
|
6412
5794
|
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
scheme: "urn:uuid",
|
|
6417
|
-
parse: function parse(urnComponents, options) {
|
|
6418
|
-
var uuidComponents = urnComponents;
|
|
6419
|
-
uuidComponents.uuid = uuidComponents.nss;
|
|
6420
|
-
uuidComponents.nss = undefined;
|
|
6421
|
-
if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
|
|
6422
|
-
uuidComponents.error = uuidComponents.error || "UUID is not valid.";
|
|
6423
|
-
}
|
|
6424
|
-
return uuidComponents;
|
|
6425
|
-
},
|
|
6426
|
-
serialize: function serialize(uuidComponents, options) {
|
|
6427
|
-
var urnComponents = uuidComponents;
|
|
6428
|
-
//normalize UUID
|
|
6429
|
-
urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
|
|
6430
|
-
return urnComponents;
|
|
5795
|
+
// perform scheme specific parsing
|
|
5796
|
+
if (schemeHandler && schemeHandler.parse) {
|
|
5797
|
+
schemeHandler.parse(parsed, options);
|
|
6431
5798
|
}
|
|
5799
|
+
} else {
|
|
5800
|
+
parsed.error = parsed.error || 'URI can not be parsed.';
|
|
5801
|
+
}
|
|
5802
|
+
return parsed
|
|
5803
|
+
}
|
|
5804
|
+
|
|
5805
|
+
const fastUri = {
|
|
5806
|
+
SCHEMES,
|
|
5807
|
+
normalize,
|
|
5808
|
+
resolve,
|
|
5809
|
+
resolveComponents,
|
|
5810
|
+
equal: equal$2,
|
|
5811
|
+
serialize,
|
|
5812
|
+
parse
|
|
6432
5813
|
};
|
|
6433
5814
|
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
SCHEMES[handler$3.scheme] = handler$3;
|
|
6438
|
-
SCHEMES[handler$4.scheme] = handler$4;
|
|
6439
|
-
SCHEMES[handler$5.scheme] = handler$5;
|
|
6440
|
-
SCHEMES[handler$6.scheme] = handler$6;
|
|
6441
|
-
|
|
6442
|
-
exports.SCHEMES = SCHEMES;
|
|
6443
|
-
exports.pctEncChar = pctEncChar;
|
|
6444
|
-
exports.pctDecChars = pctDecChars;
|
|
6445
|
-
exports.parse = parse;
|
|
6446
|
-
exports.removeDotSegments = removeDotSegments;
|
|
6447
|
-
exports.serialize = serialize;
|
|
6448
|
-
exports.resolveComponents = resolveComponents;
|
|
6449
|
-
exports.resolve = resolve;
|
|
6450
|
-
exports.normalize = normalize;
|
|
6451
|
-
exports.equal = equal;
|
|
6452
|
-
exports.escapeComponent = escapeComponent;
|
|
6453
|
-
exports.unescapeComponent = unescapeComponent;
|
|
6454
|
-
|
|
6455
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6456
|
-
|
|
6457
|
-
})));
|
|
6458
|
-
|
|
6459
|
-
}(uri_all, uri_all.exports));
|
|
5815
|
+
fastUri$1.exports = fastUri;
|
|
5816
|
+
fastUri$1.exports.default = fastUri;
|
|
5817
|
+
fastUri$1.exports.fastUri = fastUri;
|
|
6460
5818
|
|
|
6461
5819
|
Object.defineProperty(uri$1, "__esModule", { value: true });
|
|
6462
|
-
const uri =
|
|
5820
|
+
const uri = fastUri$1.exports;
|
|
6463
5821
|
uri.code = 'require("ajv/dist/runtime/uri").default';
|
|
6464
5822
|
uri$1.default = uri;
|
|
6465
5823
|
|
|
@@ -6480,7 +5838,7 @@ const ref_error_1 = ref_error;
|
|
|
6480
5838
|
const rules_1 = rules;
|
|
6481
5839
|
const compile_1 = compile;
|
|
6482
5840
|
const codegen_2 = codegen;
|
|
6483
|
-
const resolve_1 = resolve$
|
|
5841
|
+
const resolve_1 = resolve$2;
|
|
6484
5842
|
const dataType_1 = dataType;
|
|
6485
5843
|
const util_1 = util;
|
|
6486
5844
|
const $dataRefSchema = require$$9;
|
|
@@ -9596,7 +8954,7 @@ var validate = function validate(rule, instance) {
|
|
|
9596
8954
|
message = _theRule.message;
|
|
9597
8955
|
var valid = true;
|
|
9598
8956
|
if (isExpression(validator)) {
|
|
9599
|
-
valid =
|
|
8957
|
+
valid = _executeExpression(validator, instance);
|
|
9600
8958
|
} else if (typeof validator === 'function') {
|
|
9601
8959
|
valid = validator(instance);
|
|
9602
8960
|
// eslint-disable-next-line no-eval
|
|
@@ -9760,7 +9118,7 @@ var validateFormWithResult = function validateFormWithResult(widgetTree) {
|
|
|
9760
9118
|
};
|
|
9761
9119
|
// 校验schema是否正常
|
|
9762
9120
|
var validateSchema = /*#__PURE__*/function () {
|
|
9763
|
-
var _ref = _asyncToGenerator(
|
|
9121
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(schema) {
|
|
9764
9122
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9765
9123
|
while (1) switch (_context.prev = _context.next) {
|
|
9766
9124
|
case 0:
|
|
@@ -9985,7 +9343,7 @@ var Widget = Vue.extend({
|
|
|
9985
9343
|
},
|
|
9986
9344
|
loadDataSource: function loadDataSource() {
|
|
9987
9345
|
var _this3 = this;
|
|
9988
|
-
return _asyncToGenerator(
|
|
9346
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
9989
9347
|
var _this3$widgetSchema, _this3$widgetSchema$u, _this3$widgetSchema$u2;
|
|
9990
9348
|
var xhrConfig, url, params, reset, _this3$httpAdapter, _this3$httpAdapter$re, http, responseParse, remoteURL, requestParams;
|
|
9991
9349
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -10000,8 +9358,8 @@ var Widget = Vue.extend({
|
|
|
10000
9358
|
_this3$httpAdapter = _this3.httpAdapter, _this3$httpAdapter$re = _this3$httpAdapter.request, http = _this3$httpAdapter$re === void 0 ? request : _this3$httpAdapter$re, responseParse = _this3$httpAdapter.responseParse;
|
|
10001
9359
|
_context.prev = 4;
|
|
10002
9360
|
_this3.loading = true;
|
|
10003
|
-
remoteURL =
|
|
10004
|
-
requestParams = isObj(params) ?
|
|
9361
|
+
remoteURL = _executeExpression(url, _this3);
|
|
9362
|
+
requestParams = isObj(params) ? _executeExpression(params, _this3) : params;
|
|
10005
9363
|
_context.next = 10;
|
|
10006
9364
|
return http(remoteURL, _objectSpread2(_objectSpread2({}, reset), {}, {
|
|
10007
9365
|
params: requestParams,
|
|
@@ -11135,82 +10493,6 @@ var FieldGroupWrap = Vue.extend({
|
|
|
11135
10493
|
|
|
11136
10494
|
function _extends(){return _extends=Object.assign?Object.assign.bind():function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},_extends.apply(this,arguments)}var normalMerge=["attrs","props","domProps"],toArrayMerge=["class","style","directives"],functionalMerge=["on","nativeOn"],mergeJsxProps=function(a){return a.reduce(function(c,a){for(var b in a)if(!c[b])c[b]=a[b];else if(-1!==normalMerge.indexOf(b))c[b]=_extends({},c[b],a[b]);else if(-1!==toArrayMerge.indexOf(b)){var d=c[b]instanceof Array?c[b]:[c[b]],e=a[b]instanceof Array?a[b]:[a[b]];c[b]=[].concat(d,e);}else if(-1!==functionalMerge.indexOf(b)){for(var f in a[b])if(c[b][f]){var g=c[b][f]instanceof Array?c[b][f]:[c[b][f]],h=a[b][f]instanceof Array?a[b][f]:[a[b][f]];c[b][f]=[].concat(g,h);}else c[b][f]=a[b][f];}else if("hook"===b)for(var i in a[b])c[b][i]=c[b][i]?mergeFn(c[b][i],a[b][i]):a[b][i];else c[b]=a[b];return c},{})},mergeFn=function(a,b){return function(){a&&a.apply(this,arguments),b&&b.apply(this,arguments);}};var helper=mergeJsxProps;
|
|
11137
10495
|
|
|
11138
|
-
var CommonGroupWrap = Vue.extend({
|
|
11139
|
-
name: 'CommonFieldGroupWrap',
|
|
11140
|
-
inject: ['widgetTree'],
|
|
11141
|
-
props: _objectSpread2(_objectSpread2({}, props), {}, {
|
|
11142
|
-
// 组类型
|
|
11143
|
-
type: {
|
|
11144
|
-
type: String,
|
|
11145
|
-
default: 'default',
|
|
11146
|
-
validator: function validator(value) {
|
|
11147
|
-
return ['default', 'normal', 'card'].includes(value);
|
|
11148
|
-
}
|
|
11149
|
-
},
|
|
11150
|
-
// 是否显示组title
|
|
11151
|
-
showTitle: {
|
|
11152
|
-
type: Boolean,
|
|
11153
|
-
default: false
|
|
11154
|
-
},
|
|
11155
|
-
// 是否显示border
|
|
11156
|
-
border: {
|
|
11157
|
-
type: Boolean,
|
|
11158
|
-
default: false
|
|
11159
|
-
},
|
|
11160
|
-
verifiable: {
|
|
11161
|
-
type: Boolean,
|
|
11162
|
-
default: false
|
|
11163
|
-
},
|
|
11164
|
-
hideEmptyRow: {
|
|
11165
|
-
type: Boolean,
|
|
11166
|
-
default: false
|
|
11167
|
-
},
|
|
11168
|
-
description: {
|
|
11169
|
-
type: String,
|
|
11170
|
-
default: ''
|
|
11171
|
-
},
|
|
11172
|
-
tag: {
|
|
11173
|
-
type: String,
|
|
11174
|
-
default: 'div'
|
|
11175
|
-
}
|
|
11176
|
-
}),
|
|
11177
|
-
data: function data() {
|
|
11178
|
-
return {
|
|
11179
|
-
state: {
|
|
11180
|
-
// 组类型目前只支持visible
|
|
11181
|
-
visible: true
|
|
11182
|
-
}
|
|
11183
|
-
};
|
|
11184
|
-
},
|
|
11185
|
-
// created() {
|
|
11186
|
-
// // 注册widget TreeNode
|
|
11187
|
-
// this.widgetTree.addWidgetNode(this.path, this, 'group');
|
|
11188
|
-
// },
|
|
11189
|
-
mounted: function mounted() {
|
|
11190
|
-
// 更新样式
|
|
11191
|
-
this.$forceUpdate();
|
|
11192
|
-
},
|
|
11193
|
-
// beforeDestroy() {
|
|
11194
|
-
// this.widgetTree.removeWidgetNode(this.path, this);
|
|
11195
|
-
// },
|
|
11196
|
-
methods: {
|
|
11197
|
-
setState: function setState(key, value) {
|
|
11198
|
-
if (Reflect.has(this.state, key)) {
|
|
11199
|
-
this.state[key] = value;
|
|
11200
|
-
} else {
|
|
11201
|
-
console.warn("Group unsupported ".concat(key, " state, please check"));
|
|
11202
|
-
}
|
|
11203
|
-
}
|
|
11204
|
-
},
|
|
11205
|
-
render: function render(h) {
|
|
11206
|
-
var _this$layout;
|
|
11207
|
-
var groupContentStyle = _objectSpread2({}, (_this$layout = this.layout) === null || _this$layout === void 0 ? void 0 : _this$layout.container);
|
|
11208
|
-
return h(this.tag, {
|
|
11209
|
-
style: groupContentStyle
|
|
11210
|
-
}, [this.$slots.default]);
|
|
11211
|
-
}
|
|
11212
|
-
});
|
|
11213
|
-
|
|
11214
10496
|
// 伪数组类型
|
|
11215
10497
|
var KeyValueArrayWidget = Vue.extend({
|
|
11216
10498
|
name: 'KeyValueArrayWidget',
|
|
@@ -11261,30 +10543,30 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11261
10543
|
_this$schema2,
|
|
11262
10544
|
_this$schema2$items,
|
|
11263
10545
|
_this = this,
|
|
11264
|
-
_this$value2
|
|
10546
|
+
_this$value2,
|
|
10547
|
+
_this$value3;
|
|
11265
10548
|
var labelBtnStyle = {
|
|
11266
10549
|
'font-size': '16px',
|
|
11267
10550
|
color: this.disabled ? '#c4c6cc' : '#979ba5',
|
|
11268
10551
|
cursor: this.disabled ? 'not-allowed' : 'pointer',
|
|
11269
10552
|
display: 'inline-block'
|
|
11270
10553
|
};
|
|
11271
|
-
var
|
|
11272
|
-
|
|
11273
|
-
|
|
10554
|
+
var properties = (_this$schema = this.schema) === null || _this$schema === void 0 ? void 0 : (_this$schema$items = _this$schema.items) === null || _this$schema$items === void 0 ? void 0 : _this$schema$items.properties;
|
|
10555
|
+
var props = orderProperties(Object.keys(properties || {}), (_this$schema2 = this.schema) === null || _this$schema2 === void 0 ? void 0 : (_this$schema2$items = _this$schema2.items) === null || _this$schema2$items === void 0 ? void 0 : _this$schema2$items['ui:order']);
|
|
10556
|
+
// props为空时,表示只有一个项
|
|
10557
|
+
var keysLen = Object.keys(properties || {}).length;
|
|
10558
|
+
var defaultCols = properties ? new Array(keysLen).fill('1fr').concat('20px').join(' ') : '1fr 20px';
|
|
10559
|
+
var defaultContainerLayout = _objectSpread2({}, this.layout.container || {
|
|
10560
|
+
display: 'grid',
|
|
10561
|
+
gridGap: '20px',
|
|
10562
|
+
'grid-template-columns': defaultCols // 默认配置
|
|
10563
|
+
});
|
|
11274
10564
|
var thStyle = {
|
|
11275
10565
|
fontSize: '14px',
|
|
11276
10566
|
textAlign: 'left',
|
|
11277
10567
|
fontWeight: 'normal',
|
|
11278
|
-
color: '#63656E'
|
|
11279
|
-
paddingLeft: '10px',
|
|
11280
|
-
paddingRight: '10px'
|
|
11281
|
-
};
|
|
11282
|
-
var tdStyle = {
|
|
11283
|
-
paddingLeft: '10px',
|
|
11284
|
-
paddingRight: '10px'
|
|
10568
|
+
color: '#63656E'
|
|
11285
10569
|
};
|
|
11286
|
-
var properties = (_this$schema = this.schema) === null || _this$schema === void 0 ? void 0 : (_this$schema$items = _this$schema.items) === null || _this$schema$items === void 0 ? void 0 : _this$schema$items.properties;
|
|
11287
|
-
var props = orderProperties(Object.keys(properties || {}), (_this$schema2 = this.schema) === null || _this$schema2 === void 0 ? void 0 : (_this$schema2$items = _this$schema2.items) === null || _this$schema2$items === void 0 ? void 0 : _this$schema2$items['ui:order']);
|
|
11288
10570
|
var self = this;
|
|
11289
10571
|
var dealSchema = function dealSchema(schema) {
|
|
11290
10572
|
return (
|
|
@@ -11332,57 +10614,55 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11332
10614
|
}
|
|
11333
10615
|
});
|
|
11334
10616
|
};
|
|
11335
|
-
return h("
|
|
11336
|
-
"style":
|
|
11337
|
-
}, [
|
|
10617
|
+
return h("div", [this.showTableHead && (_this$value2 = this.value) !== null && _this$value2 !== void 0 && _this$value2.length ? h("div", {
|
|
10618
|
+
"style": _objectSpread2({}, defaultContainerLayout)
|
|
10619
|
+
}, [props !== null && props !== void 0 && props.length ? props.map(function (key, index) {
|
|
11338
10620
|
var _this$schema3, _this$schema3$items, _this$columns$path;
|
|
11339
|
-
var schemaItem = (_this$schema3 = _this.schema) === null || _this$schema3 === void 0 ? void 0 : (_this$schema3$items = _this$schema3.items) === null || _this$schema3$items === void 0 ? void 0 : _this$schema3$items.properties[
|
|
11340
|
-
var
|
|
11341
|
-
|
|
11342
|
-
|
|
11343
|
-
|
|
10621
|
+
var schemaItem = (_this$schema3 = _this.schema) === null || _this$schema3 === void 0 ? void 0 : (_this$schema3$items = _this$schema3.items) === null || _this$schema3$items === void 0 ? void 0 : _this$schema3$items.properties[key];
|
|
10622
|
+
var curPath = Path.getCurPath(_this.path, "".concat(index, ".").concat(key));
|
|
10623
|
+
var lastProp = curPath.split('.').pop();
|
|
10624
|
+
var layoutConfig = Layout.findLayoutByProp(lastProp, _this.layout.group || []) || {};
|
|
10625
|
+
var path = Path.getCurPath(_this.path, "0.".concat(key));
|
|
10626
|
+
return h("div", {
|
|
10627
|
+
"style": _objectSpread2(_objectSpread2(_objectSpread2({}, thStyle), (layoutConfig === null || layoutConfig === void 0 ? void 0 : layoutConfig.item) || {}), {}, {
|
|
11344
10628
|
display: ((_this$columns$path = _this.columns[path]) === null || _this$columns$path === void 0 ? void 0 : _this$columns$path.visible) === false ? 'none' : ''
|
|
11345
10629
|
})
|
|
11346
10630
|
}, [schemaItem === null || schemaItem === void 0 ? void 0 : schemaItem.title]);
|
|
11347
|
-
})
|
|
10631
|
+
}) : h("div"), h("div", {
|
|
10632
|
+
"style": {
|
|
10633
|
+
width: '16px'
|
|
10634
|
+
}
|
|
10635
|
+
})]) : null, (_this$value3 = this.value) === null || _this$value3 === void 0 ? void 0 : _this$value3.map(function (_, index) {
|
|
11348
10636
|
var _this$schema5;
|
|
11349
10637
|
var groupPath = Path.getCurPath(_this.path, "".concat(index));
|
|
11350
|
-
return h(
|
|
10638
|
+
return h(FieldGroupWrap, helper([{}, {
|
|
11351
10639
|
"props": _objectSpread2(_objectSpread2({}, _this.$props), {}, {
|
|
11352
10640
|
path: groupPath,
|
|
11353
10641
|
value: Path.getPathVal(_this.rootData, groupPath),
|
|
11354
10642
|
schema: _this.schema.items,
|
|
11355
|
-
|
|
11356
|
-
|
|
10643
|
+
layout: _objectSpread2(_objectSpread2({}, _this.layout), {}, {
|
|
10644
|
+
container: _objectSpread2({}, defaultContainerLayout)
|
|
10645
|
+
})
|
|
11357
10646
|
})
|
|
11358
|
-
}]), [props !== null && props !== void 0 && props.length ? props.map(function (prop
|
|
11359
|
-
var _this$schema4, _this$schema4$items
|
|
10647
|
+
}]), [props !== null && props !== void 0 && props.length ? props.map(function (prop) {
|
|
10648
|
+
var _this$schema4, _this$schema4$items;
|
|
11360
10649
|
var schemaItem = (_this$schema4 = _this.schema) === null || _this$schema4 === void 0 ? void 0 : (_this$schema4$items = _this$schema4.items) === null || _this$schema4$items === void 0 ? void 0 : _this$schema4$items.properties[prop];
|
|
11361
10650
|
var curPath = Path.getCurPath(_this.path, "".concat(index, ".").concat(prop));
|
|
11362
10651
|
var lastProp = curPath.split('.').pop();
|
|
11363
10652
|
var layoutConfig = Layout.findLayoutByProp(lastProp, _this.layout.group || []) || {};
|
|
11364
|
-
return
|
|
11365
|
-
"style": _objectSpread2(_objectSpread2({}, tdStyle), {}, {
|
|
11366
|
-
paddingLeft: i > 0 ? '10px' : '0px',
|
|
11367
|
-
display: ((_this$columns$curPath = _this.columns[curPath]) === null || _this$columns$curPath === void 0 ? void 0 : _this$columns$curPath.visible) === false ? 'none' : ''
|
|
11368
|
-
})
|
|
11369
|
-
}, [renderSchemaField({
|
|
10653
|
+
return renderSchemaField({
|
|
11370
10654
|
path: curPath,
|
|
11371
10655
|
schema: dealSchema(schemaItem),
|
|
11372
10656
|
layout: layoutConfig,
|
|
11373
10657
|
required: Schema.isRequired(schemaItem, prop)
|
|
11374
|
-
})
|
|
11375
|
-
}) :
|
|
10658
|
+
});
|
|
10659
|
+
}) : renderSchemaField({
|
|
11376
10660
|
path: Path.getCurPath(_this.path, index),
|
|
11377
10661
|
schema: dealSchema(((_this$schema5 = _this.schema) === null || _this$schema5 === void 0 ? void 0 : _this$schema5.items) || {}),
|
|
11378
10662
|
layout: {},
|
|
11379
10663
|
required: false
|
|
11380
|
-
})
|
|
11381
|
-
"style":
|
|
11382
|
-
}, [h("span", {
|
|
11383
|
-
"style": _objectSpread2(_objectSpread2({}, labelBtnStyle), {}, {
|
|
11384
|
-
marginBottom: '10px'
|
|
11385
|
-
}),
|
|
10664
|
+
}), h("span", {
|
|
10665
|
+
"style": labelBtnStyle,
|
|
11386
10666
|
"on": {
|
|
11387
10667
|
"click": function click() {
|
|
11388
10668
|
return _this.handleRemoveItem(index);
|
|
@@ -11390,7 +10670,7 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11390
10670
|
}
|
|
11391
10671
|
}, [h("i", {
|
|
11392
10672
|
"class": "bk-icon icon-minus-line"
|
|
11393
|
-
})])])
|
|
10673
|
+
})])]);
|
|
11394
10674
|
}), h("span", {
|
|
11395
10675
|
"on": {
|
|
11396
10676
|
"click": this.handleAddItem
|
|
@@ -11398,7 +10678,7 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11398
10678
|
"style": labelBtnStyle
|
|
11399
10679
|
}, [h("i", {
|
|
11400
10680
|
"class": "bk-icon icon-plus-line"
|
|
11401
|
-
})])])
|
|
10681
|
+
})])]);
|
|
11402
10682
|
}
|
|
11403
10683
|
});
|
|
11404
10684
|
|
|
@@ -11698,7 +10978,7 @@ var UploadWidget = Vue.extend({
|
|
|
11698
10978
|
options.fileObj.xhr = xhr;
|
|
11699
10979
|
var formData = new FormData();
|
|
11700
10980
|
options.data.forEach(function (item) {
|
|
11701
|
-
formData.append(item.name,
|
|
10981
|
+
formData.append(item.name, _executeExpression(item.value, _this.$parent.$parent));
|
|
11702
10982
|
});
|
|
11703
10983
|
formData.append(options.fileName, options.fileObj.origin);
|
|
11704
10984
|
xhr.onreadystatechange = function () {
|
|
@@ -11721,12 +11001,12 @@ var UploadWidget = Vue.extend({
|
|
|
11721
11001
|
if (Array.isArray(options.header)) {
|
|
11722
11002
|
options.header.forEach(function (head) {
|
|
11723
11003
|
var headerKey = head.name;
|
|
11724
|
-
var headerVal =
|
|
11004
|
+
var headerVal = _executeExpression(head.value, _this.$parent.$parent);
|
|
11725
11005
|
xhr.setRequestHeader(headerKey, headerVal);
|
|
11726
11006
|
});
|
|
11727
11007
|
} else {
|
|
11728
11008
|
var headerKey = options.header.name;
|
|
11729
|
-
var headerVal =
|
|
11009
|
+
var headerVal = _executeExpression(options.header.value, this.$parent.$parent);
|
|
11730
11010
|
xhr.setRequestHeader(headerKey, headerVal);
|
|
11731
11011
|
}
|
|
11732
11012
|
}
|
|
@@ -11750,13 +11030,13 @@ var UploadWidget = Vue.extend({
|
|
|
11750
11030
|
handleResCode: function handleResCode(res) {
|
|
11751
11031
|
var successed = true;
|
|
11752
11032
|
if (this.isUploadSuccessed) {
|
|
11753
|
-
successed =
|
|
11033
|
+
successed = _executeExpression(this.isUploadSuccessed, this.$parent.$parent, [], {
|
|
11754
11034
|
response: res
|
|
11755
11035
|
});
|
|
11756
11036
|
}
|
|
11757
11037
|
if (!successed) return;
|
|
11758
11038
|
if (this.responseHandler) {
|
|
11759
|
-
var files =
|
|
11039
|
+
var files = _executeExpression(this.responseHandler, this.$parent.$parent, [], {
|
|
11760
11040
|
response: res
|
|
11761
11041
|
});
|
|
11762
11042
|
this.$emit('input', files);
|
|
@@ -12094,7 +11374,7 @@ function createForm() {
|
|
|
12094
11374
|
},
|
|
12095
11375
|
methods: {
|
|
12096
11376
|
initFormData: function initFormData() {
|
|
12097
|
-
this.rootData =
|
|
11377
|
+
this.rootData = _merge(Schema.getSchemaDefaultValue(createProxy(this.schema, this)) || {}, this.value);
|
|
12098
11378
|
this.emitFormValueChange(this.rootData, this.value);
|
|
12099
11379
|
},
|
|
12100
11380
|
emitFormValueChange: function emitFormValueChange(newValue, oldValue) {
|