@blueking/bkui-form 0.0.44 → 0.0.46

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.
@@ -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) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[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) >= 0) continue;
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 merge = function merge(target, source) {
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] = merge(((_target = target) === null || _target === void 0 ? void 0 : _target[key]) || {}, source[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 merge(target[index], item);
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 = ( /*#__PURE__*/(function () {
1371
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
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 executeExpression = function executeExpression(expression, instance) {
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] = executeExpression(expression[key], instance);
1775
+ expression[key] = _executeExpression(expression[key], instance);
1776
1776
  });
1777
1777
  return expression;
1778
1778
  }
@@ -1818,6 +1818,7 @@ 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;
1821
1822
  var fullfill = true;
1822
1823
  var deps = [];
1823
1824
  if (reaction.source) {
@@ -1828,7 +1829,7 @@ var resolveReaction = function resolveReaction(crtInsPath, targetPath, reaction,
1828
1829
  });
1829
1830
  }
1830
1831
  if (typeof reaction.if === 'string') {
1831
- fullfill = executeExpression(reaction.if, crtInstance, deps);
1832
+ fullfill = _executeExpression(reaction.if, crtInstance, deps);
1832
1833
  }
1833
1834
  var operations = fullfill ? reaction.then : reaction.else;
1834
1835
  executeOperations(operations, operateInstance, deps);
@@ -1840,20 +1841,20 @@ var executeOperations = function executeOperations(operations, instance, deps) {
1840
1841
  Object.keys(operations.state).forEach(function (key) {
1841
1842
  var val = operations.state[key];
1842
1843
  if (typeof val === 'string' && /^{{.+}}$/.test(val.trim())) {
1843
- val = executeExpression(val, instance, deps);
1844
+ val = _executeExpression(val, instance, deps);
1844
1845
  }
1845
1846
  instance.setState(key, val);
1846
1847
  });
1847
1848
  }
1848
1849
  if (Array.isArray(operations.actions)) {
1849
1850
  operations.actions.forEach(function (item) {
1850
- executeExpression(item, instance, deps);
1851
+ _executeExpression(item, instance, deps);
1851
1852
  });
1852
1853
  }
1853
1854
  }
1854
1855
  };
1855
1856
  var parsePath = function parsePath(path, instance) {
1856
- return isExpression(path) ? executeExpression(path, instance) : path;
1857
+ return isExpression(path) ? _executeExpression(path, instance) : path;
1857
1858
  };
1858
1859
  var reactionRegister = function reactionRegister(path) {
1859
1860
  var reactions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
@@ -1906,8 +1907,6 @@ var reactionDispatch = function reactionDispatch(path, typeName) {
1906
1907
  }
1907
1908
  };
1908
1909
 
1909
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
1910
-
1911
1910
  function getDefaultExportFromCjs (x) {
1912
1911
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1913
1912
  }
@@ -1929,6 +1928,7 @@ var code$1 = {};
1929
1928
  (function (exports) {
1930
1929
  Object.defineProperty(exports, "__esModule", { value: true });
1931
1930
  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;
1931
+ // eslint-disable-next-line @typescript-eslint/no-extraneous-class
1932
1932
  class _CodeOrName {
1933
1933
  }
1934
1934
  exports._CodeOrName = _CodeOrName;
@@ -3937,7 +3937,7 @@ function extendSubschemaMode(subschema, { jtdDiscriminator, jtdMetadata, composi
3937
3937
  }
3938
3938
  subschema.extendSubschemaMode = extendSubschemaMode;
3939
3939
 
3940
- var resolve$1 = {};
3940
+ var resolve$2 = {};
3941
3941
 
3942
3942
  // do not edit .js files directly - edit src/index.jst
3943
3943
 
@@ -4078,10 +4078,10 @@ function escapeJsonPtr(str) {
4078
4078
  return str.replace(/~/g, '~0').replace(/\//g, '~1');
4079
4079
  }
4080
4080
 
4081
- Object.defineProperty(resolve$1, "__esModule", { value: true });
4082
- resolve$1.getSchemaRefs = resolve$1.resolveUrl = resolve$1.normalizeId = resolve$1._getFullPath = resolve$1.getFullPath = resolve$1.inlineRef = void 0;
4081
+ Object.defineProperty(resolve$2, "__esModule", { value: true });
4082
+ resolve$2.getSchemaRefs = resolve$2.resolveUrl = resolve$2.normalizeId = resolve$2._getFullPath = resolve$2.getFullPath = resolve$2.inlineRef = void 0;
4083
4083
  const util_1$m = util;
4084
- const equal$2 = fastDeepEqual;
4084
+ const equal$3 = fastDeepEqual;
4085
4085
  const traverse = jsonSchemaTraverse.exports;
4086
4086
  // TODO refactor to use keyword definitions
4087
4087
  const SIMPLE_INLINED = new Set([
@@ -4111,7 +4111,7 @@ function inlineRef(schema, limit = true) {
4111
4111
  return false;
4112
4112
  return countKeys(schema) <= limit;
4113
4113
  }
4114
- resolve$1.inlineRef = inlineRef;
4114
+ resolve$2.inlineRef = inlineRef;
4115
4115
  const REF_KEYWORDS = new Set([
4116
4116
  "$ref",
4117
4117
  "$recursiveRef",
@@ -4153,22 +4153,22 @@ function getFullPath(resolver, id = "", normalize) {
4153
4153
  const p = resolver.parse(id);
4154
4154
  return _getFullPath(resolver, p);
4155
4155
  }
4156
- resolve$1.getFullPath = getFullPath;
4156
+ resolve$2.getFullPath = getFullPath;
4157
4157
  function _getFullPath(resolver, p) {
4158
4158
  const serialized = resolver.serialize(p);
4159
4159
  return serialized.split("#")[0] + "#";
4160
4160
  }
4161
- resolve$1._getFullPath = _getFullPath;
4161
+ resolve$2._getFullPath = _getFullPath;
4162
4162
  const TRAILING_SLASH_HASH = /#\/?$/;
4163
4163
  function normalizeId(id) {
4164
4164
  return id ? id.replace(TRAILING_SLASH_HASH, "") : "";
4165
4165
  }
4166
- resolve$1.normalizeId = normalizeId;
4166
+ resolve$2.normalizeId = normalizeId;
4167
4167
  function resolveUrl(resolver, baseId, id) {
4168
4168
  id = normalizeId(id);
4169
4169
  return resolver.resolve(baseId, id);
4170
4170
  }
4171
- resolve$1.resolveUrl = resolveUrl;
4171
+ resolve$2.resolveUrl = resolveUrl;
4172
4172
  const ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
4173
4173
  function getSchemaRefs(schema, baseId) {
4174
4174
  if (typeof schema == "boolean")
@@ -4223,14 +4223,14 @@ function getSchemaRefs(schema, baseId) {
4223
4223
  });
4224
4224
  return localRefs;
4225
4225
  function checkAmbiguosRef(sch1, sch2, ref) {
4226
- if (sch2 !== undefined && !equal$2(sch1, sch2))
4226
+ if (sch2 !== undefined && !equal$3(sch1, sch2))
4227
4227
  throw ambiguos(ref);
4228
4228
  }
4229
4229
  function ambiguos(ref) {
4230
4230
  return new Error(`reference "${ref}" resolves to more than one schema`);
4231
4231
  }
4232
4232
  }
4233
- resolve$1.getSchemaRefs = getSchemaRefs;
4233
+ resolve$2.getSchemaRefs = getSchemaRefs;
4234
4234
 
4235
4235
  Object.defineProperty(validate$1, "__esModule", { value: true });
4236
4236
  validate$1.getData = validate$1.KeywordCxt = validate$1.validateFunctionCode = void 0;
@@ -4243,7 +4243,7 @@ const keyword_1 = keyword;
4243
4243
  const subschema_1 = subschema;
4244
4244
  const codegen_1$n = codegen;
4245
4245
  const names_1$3 = names$1;
4246
- const resolve_1$2 = resolve$1;
4246
+ const resolve_1$2 = resolve$2;
4247
4247
  const util_1$l = util;
4248
4248
  const errors_1 = errors;
4249
4249
  // schema compilation - generates validation function, subschemaCode (below) is used for subschemas
@@ -4765,7 +4765,7 @@ validation_error.default = ValidationError;
4765
4765
  var ref_error = {};
4766
4766
 
4767
4767
  Object.defineProperty(ref_error, "__esModule", { value: true });
4768
- const resolve_1$1 = resolve$1;
4768
+ const resolve_1$1 = resolve$2;
4769
4769
  class MissingRefError extends Error {
4770
4770
  constructor(resolver, baseId, ref, msg) {
4771
4771
  super(msg || `can't resolve reference ${ref} from id ${baseId}`);
@@ -4782,7 +4782,7 @@ compile.resolveSchema = compile.getCompilingSchema = compile.resolveRef = compil
4782
4782
  const codegen_1$m = codegen;
4783
4783
  const validation_error_1 = validation_error;
4784
4784
  const names_1$2 = names$1;
4785
- const resolve_1 = resolve$1;
4785
+ const resolve_1 = resolve$2;
4786
4786
  const util_1$k = util;
4787
4787
  const validate_1$1 = validate$1;
4788
4788
  class SchemaEnv {
@@ -4908,7 +4908,7 @@ function resolveRef(root, baseId, ref) {
4908
4908
  const schOrFunc = root.refs[ref];
4909
4909
  if (schOrFunc)
4910
4910
  return schOrFunc;
4911
- let _sch = resolve.call(this, root, ref);
4911
+ let _sch = resolve$1.call(this, root, ref);
4912
4912
  if (_sch === undefined) {
4913
4913
  const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv
4914
4914
  const { schemaId } = this.opts;
@@ -4938,7 +4938,7 @@ function sameSchemaEnv(s1, s2) {
4938
4938
  }
4939
4939
  // resolve and compile the references ($ref)
4940
4940
  // TODO returns AnySchemaObject (if the schema can be inlined) or validation function
4941
- function resolve(root, // information about the root schema for the current schema
4941
+ function resolve$1(root, // information about the root schema for the current schema
4942
4942
  ref // reference to resolve
4943
4943
  ) {
4944
4944
  let sch;
@@ -5049,1416 +5049,770 @@ var require$$9 = {
5049
5049
 
5050
5050
  var uri$1 = {};
5051
5051
 
5052
- var uri_all = {exports: {}};
5053
-
5054
- /** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
5055
-
5056
- (function (module, exports) {
5057
- (function (global, factory) {
5058
- factory(exports) ;
5059
- }(commonjsGlobal, (function (exports) {
5060
- function merge() {
5061
- for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
5062
- sets[_key] = arguments[_key];
5063
- }
5064
-
5065
- if (sets.length > 1) {
5066
- sets[0] = sets[0].slice(0, -1);
5067
- var xl = sets.length - 1;
5068
- for (var x = 1; x < xl; ++x) {
5069
- sets[x] = sets[x].slice(1, -1);
5070
- }
5071
- sets[xl] = sets[xl].slice(1);
5072
- return sets.join('');
5073
- } else {
5074
- return sets[0];
5075
- }
5076
- }
5077
- function subexp(str) {
5078
- return "(?:" + str + ")";
5079
- }
5080
- function typeOf(o) {
5081
- return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase();
5082
- }
5083
- function toUpperCase(str) {
5084
- return str.toUpperCase();
5085
- }
5086
- function toArray(obj) {
5087
- return obj !== undefined && obj !== null ? obj instanceof Array ? obj : typeof obj.length !== "number" || obj.split || obj.setInterval || obj.call ? [obj] : Array.prototype.slice.call(obj) : [];
5088
- }
5089
- function assign(target, source) {
5090
- var obj = target;
5091
- if (source) {
5092
- for (var key in source) {
5093
- obj[key] = source[key];
5094
- }
5095
- }
5096
- return obj;
5097
- }
5098
-
5099
- function buildExps(isIRI) {
5100
- var ALPHA$$ = "[A-Za-z]",
5101
- DIGIT$$ = "[0-9]",
5102
- HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"),
5103
- PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)),
5104
- //expanded
5105
- GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
5106
- SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
5107
- RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
5108
- UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]",
5109
- //subset, excludes bidi control characters
5110
- IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",
5111
- //subset
5112
- UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$);
5113
- subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*");
5114
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*");
5115
- 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$$),
5116
- //relaxed parsing rules
5117
- IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
5118
- H16$ = subexp(HEXDIG$$ + "{1,4}"),
5119
- LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
5120
- IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$),
5121
- // 6( h16 ":" ) ls32
5122
- IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$),
5123
- // "::" 5( h16 ":" ) ls32
5124
- IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$),
5125
- //[ h16 ] "::" 4( h16 ":" ) ls32
5126
- IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$),
5127
- //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
5128
- IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$),
5129
- //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
5130
- IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$),
5131
- //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
5132
- IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$),
5133
- //[ *4( h16 ":" ) h16 ] "::" ls32
5134
- IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$),
5135
- //[ *5( h16 ":" ) h16 ] "::" h16
5136
- IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),
5137
- //[ *6( h16 ":" ) h16 ] "::"
5138
- IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
5139
- ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+");
5140
- //RFC 6874, with relaxed parsing rules
5141
- subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+");
5142
- //RFC 6874
5143
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*");
5144
- var PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"));
5145
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+");
5146
- subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*");
5147
- return {
5148
- NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
5149
- NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5150
- NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5151
- NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5152
- NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5153
- NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
5154
- NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
5155
- ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5156
- UNRESERVED: new RegExp(UNRESERVED$$, "g"),
5157
- OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
5158
- PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
5159
- IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
5160
- IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
5161
- };
5052
+ var fastUri$1 = {exports: {}};
5053
+
5054
+ const HEX$1 = {
5055
+ 0: 0,
5056
+ 1: 1,
5057
+ 2: 2,
5058
+ 3: 3,
5059
+ 4: 4,
5060
+ 5: 5,
5061
+ 6: 6,
5062
+ 7: 7,
5063
+ 8: 8,
5064
+ 9: 9,
5065
+ a: 10,
5066
+ A: 10,
5067
+ b: 11,
5068
+ B: 11,
5069
+ c: 12,
5070
+ C: 12,
5071
+ d: 13,
5072
+ D: 13,
5073
+ e: 14,
5074
+ E: 14,
5075
+ f: 15,
5076
+ F: 15
5077
+ };
5078
+
5079
+ var scopedChars = {
5080
+ HEX: HEX$1
5081
+ };
5082
+
5083
+ const { HEX } = scopedChars;
5084
+
5085
+ 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;
5086
+
5087
+ function normalizeIPv4$1 (host) {
5088
+ if (findToken(host, '.') < 3) { return { host, isIPV4: false } }
5089
+ const matches = host.match(IPV4_REG) || [];
5090
+ const [address] = matches;
5091
+ if (address) {
5092
+ return { host: stripLeadingZeros(address, '.'), isIPV4: true }
5093
+ } else {
5094
+ return { host, isIPV4: false }
5095
+ }
5162
5096
  }
5163
- var URI_PROTOCOL = buildExps(false);
5164
-
5165
- var IRI_PROTOCOL = buildExps(true);
5166
5097
 
5167
- var slicedToArray = function () {
5168
- function sliceIterator(arr, i) {
5169
- var _arr = [];
5170
- var _n = true;
5171
- var _d = false;
5172
- var _e = undefined;
5173
-
5174
- try {
5175
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
5176
- _arr.push(_s.value);
5098
+ /**
5099
+ * @param {string[]} input
5100
+ * @param {boolean} [keepZero=false]
5101
+ * @returns {string|undefined}
5102
+ */
5103
+ function stringArrayToHexStripped (input, keepZero = false) {
5104
+ let acc = '';
5105
+ let strip = true;
5106
+ for (const c of input) {
5107
+ if (HEX[c] === undefined) return undefined
5108
+ if (c !== '0' && strip === true) strip = false;
5109
+ if (!strip) acc += c;
5110
+ }
5111
+ if (keepZero && acc.length === 0) acc = '0';
5112
+ return acc
5113
+ }
5114
+
5115
+ function getIPV6 (input) {
5116
+ let tokenCount = 0;
5117
+ const output = { error: false, address: '', zone: '' };
5118
+ const address = [];
5119
+ const buffer = [];
5120
+ let isZone = false;
5121
+ let endipv6Encountered = false;
5122
+ let endIpv6 = false;
5123
+
5124
+ function consume () {
5125
+ if (buffer.length) {
5126
+ if (isZone === false) {
5127
+ const hex = stringArrayToHexStripped(buffer);
5128
+ if (hex !== undefined) {
5129
+ address.push(hex);
5130
+ } else {
5131
+ output.error = true;
5132
+ return false
5133
+ }
5134
+ }
5135
+ buffer.length = 0;
5136
+ }
5137
+ return true
5138
+ }
5177
5139
 
5178
- if (i && _arr.length === i) break;
5140
+ for (let i = 0; i < input.length; i++) {
5141
+ const cursor = input[i];
5142
+ if (cursor === '[' || cursor === ']') { continue }
5143
+ if (cursor === ':') {
5144
+ if (endipv6Encountered === true) {
5145
+ endIpv6 = true;
5179
5146
  }
5180
- } catch (err) {
5181
- _d = true;
5182
- _e = err;
5183
- } finally {
5184
- try {
5185
- if (!_n && _i["return"]) _i["return"]();
5186
- } finally {
5187
- if (_d) throw _e;
5147
+ if (!consume()) { break }
5148
+ tokenCount++;
5149
+ address.push(':');
5150
+ if (tokenCount > 7) {
5151
+ // not valid
5152
+ output.error = true;
5153
+ break
5154
+ }
5155
+ if (i - 1 >= 0 && input[i - 1] === ':') {
5156
+ endipv6Encountered = true;
5188
5157
  }
5158
+ continue
5159
+ } else if (cursor === '%') {
5160
+ if (!consume()) { break }
5161
+ // switch to zone detection
5162
+ isZone = true;
5163
+ } else {
5164
+ buffer.push(cursor);
5165
+ continue
5189
5166
  }
5190
-
5191
- return _arr;
5192
5167
  }
5193
-
5194
- return function (arr, i) {
5195
- if (Array.isArray(arr)) {
5196
- return arr;
5197
- } else if (Symbol.iterator in Object(arr)) {
5198
- return sliceIterator(arr, i);
5168
+ if (buffer.length) {
5169
+ if (isZone) {
5170
+ output.zone = buffer.join('');
5171
+ } else if (endIpv6) {
5172
+ address.push(buffer.join(''));
5199
5173
  } else {
5200
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
5174
+ address.push(stringArrayToHexStripped(buffer));
5201
5175
  }
5202
- };
5203
- }();
5204
-
5205
-
5206
-
5207
-
5208
-
5209
-
5210
-
5211
-
5212
-
5213
-
5214
-
5215
-
5176
+ }
5177
+ output.address = address.join('');
5178
+ return output
5179
+ }
5216
5180
 
5217
- var toConsumableArray = function (arr) {
5218
- if (Array.isArray(arr)) {
5219
- for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
5181
+ function normalizeIPv6$1 (host) {
5182
+ if (findToken(host, ':') < 2) { return { host, isIPV6: false } }
5183
+ const ipv6 = getIPV6(host);
5220
5184
 
5221
- return arr2;
5185
+ if (!ipv6.error) {
5186
+ let newHost = ipv6.address;
5187
+ let escapedHost = ipv6.address;
5188
+ if (ipv6.zone) {
5189
+ newHost += '%' + ipv6.zone;
5190
+ escapedHost += '%25' + ipv6.zone;
5191
+ }
5192
+ return { host: newHost, escapedHost, isIPV6: true }
5222
5193
  } else {
5223
- return Array.from(arr);
5194
+ return { host, isIPV6: false }
5224
5195
  }
5225
- };
5226
-
5227
- /** Highest positive signed 32-bit float value */
5228
-
5229
- var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
5230
-
5231
- /** Bootstring parameters */
5232
- var base = 36;
5233
- var tMin = 1;
5234
- var tMax = 26;
5235
- var skew = 38;
5236
- var damp = 700;
5237
- var initialBias = 72;
5238
- var initialN = 128; // 0x80
5239
- var delimiter = '-'; // '\x2D'
5240
-
5241
- /** Regular expressions */
5242
- var regexPunycode = /^xn--/;
5243
- var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars
5244
- var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
5245
-
5246
- /** Error messages */
5247
- var errors = {
5248
- 'overflow': 'Overflow: input needs wider integers to process',
5249
- 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
5250
- 'invalid-input': 'Invalid input'
5251
- };
5252
-
5253
- /** Convenience shortcuts */
5254
- var baseMinusTMin = base - tMin;
5255
- var floor = Math.floor;
5256
- var stringFromCharCode = String.fromCharCode;
5257
-
5258
- /*--------------------------------------------------------------------------*/
5259
-
5260
- /**
5261
- * A generic error utility function.
5262
- * @private
5263
- * @param {String} type The error type.
5264
- * @returns {Error} Throws a `RangeError` with the applicable error message.
5265
- */
5266
- function error$1(type) {
5267
- throw new RangeError(errors[type]);
5268
5196
  }
5269
5197
 
5270
- /**
5271
- * A generic `Array#map` utility function.
5272
- * @private
5273
- * @param {Array} array The array to iterate over.
5274
- * @param {Function} callback The function that gets called for every array
5275
- * item.
5276
- * @returns {Array} A new array of values returned by the callback function.
5277
- */
5278
- function map(array, fn) {
5279
- var result = [];
5280
- var length = array.length;
5281
- while (length--) {
5282
- result[length] = fn(array[length]);
5283
- }
5284
- return result;
5198
+ function stripLeadingZeros (str, token) {
5199
+ let out = '';
5200
+ let skip = true;
5201
+ const l = str.length;
5202
+ for (let i = 0; i < l; i++) {
5203
+ const c = str[i];
5204
+ if (c === '0' && skip) {
5205
+ if ((i + 1 <= l && str[i + 1] === token) || i + 1 === l) {
5206
+ out += c;
5207
+ skip = false;
5208
+ }
5209
+ } else {
5210
+ if (c === token) {
5211
+ skip = true;
5212
+ } else {
5213
+ skip = false;
5214
+ }
5215
+ out += c;
5216
+ }
5217
+ }
5218
+ return out
5285
5219
  }
5286
5220
 
5287
- /**
5288
- * A simple `Array#map`-like wrapper to work with domain name strings or email
5289
- * addresses.
5290
- * @private
5291
- * @param {String} domain The domain name or email address.
5292
- * @param {Function} callback The function that gets called for every
5293
- * character.
5294
- * @returns {Array} A new string of characters returned by the callback
5295
- * function.
5296
- */
5297
- function mapDomain(string, fn) {
5298
- var parts = string.split('@');
5299
- var result = '';
5300
- if (parts.length > 1) {
5301
- // In email addresses, only the domain name should be punycoded. Leave
5302
- // the local part (i.e. everything up to `@`) intact.
5303
- result = parts[0] + '@';
5304
- string = parts[1];
5305
- }
5306
- // Avoid `split(regex)` for IE8 compatibility. See #17.
5307
- string = string.replace(regexSeparators, '\x2E');
5308
- var labels = string.split('.');
5309
- var encoded = map(labels, fn).join('.');
5310
- return result + encoded;
5221
+ function findToken (str, token) {
5222
+ let ind = 0;
5223
+ for (let i = 0; i < str.length; i++) {
5224
+ if (str[i] === token) ind++;
5225
+ }
5226
+ return ind
5227
+ }
5228
+
5229
+ const RDS1 = /^\.\.?\//u;
5230
+ const RDS2 = /^\/\.(?:\/|$)/u;
5231
+ const RDS3 = /^\/\.\.(?:\/|$)/u;
5232
+ const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/u;
5233
+
5234
+ function removeDotSegments$1 (input) {
5235
+ const output = [];
5236
+
5237
+ while (input.length) {
5238
+ if (input.match(RDS1)) {
5239
+ input = input.replace(RDS1, '');
5240
+ } else if (input.match(RDS2)) {
5241
+ input = input.replace(RDS2, '/');
5242
+ } else if (input.match(RDS3)) {
5243
+ input = input.replace(RDS3, '/');
5244
+ output.pop();
5245
+ } else if (input === '.' || input === '..') {
5246
+ input = '';
5247
+ } else {
5248
+ const im = input.match(RDS5);
5249
+ if (im) {
5250
+ const s = im[0];
5251
+ input = input.slice(s.length);
5252
+ output.push(s);
5253
+ } else {
5254
+ throw new Error('Unexpected dot segment condition')
5255
+ }
5256
+ }
5257
+ }
5258
+ return output.join('')
5311
5259
  }
5312
5260
 
5313
- /**
5314
- * Creates an array containing the numeric code points of each Unicode
5315
- * character in the string. While JavaScript uses UCS-2 internally,
5316
- * this function will convert a pair of surrogate halves (each of which
5317
- * UCS-2 exposes as separate characters) into a single code point,
5318
- * matching UTF-16.
5319
- * @see `punycode.ucs2.encode`
5320
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
5321
- * @memberOf punycode.ucs2
5322
- * @name decode
5323
- * @param {String} string The Unicode input string (UCS-2).
5324
- * @returns {Array} The new array of code points.
5325
- */
5326
- function ucs2decode(string) {
5327
- var output = [];
5328
- var counter = 0;
5329
- var length = string.length;
5330
- while (counter < length) {
5331
- var value = string.charCodeAt(counter++);
5332
- if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
5333
- // It's a high surrogate, and there is a next character.
5334
- var extra = string.charCodeAt(counter++);
5335
- if ((extra & 0xFC00) == 0xDC00) {
5336
- // Low surrogate.
5337
- output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
5338
- } else {
5339
- // It's an unmatched surrogate; only append this code unit, in case the
5340
- // next code unit is the high surrogate of a surrogate pair.
5341
- output.push(value);
5342
- counter--;
5343
- }
5344
- } else {
5345
- output.push(value);
5346
- }
5347
- }
5348
- return output;
5261
+ function normalizeComponentEncoding$1 (components, esc) {
5262
+ const func = esc !== true ? escape : unescape;
5263
+ if (components.scheme !== undefined) {
5264
+ components.scheme = func(components.scheme);
5265
+ }
5266
+ if (components.userinfo !== undefined) {
5267
+ components.userinfo = func(components.userinfo);
5268
+ }
5269
+ if (components.host !== undefined) {
5270
+ components.host = func(components.host);
5271
+ }
5272
+ if (components.path !== undefined) {
5273
+ components.path = func(components.path);
5274
+ }
5275
+ if (components.query !== undefined) {
5276
+ components.query = func(components.query);
5277
+ }
5278
+ if (components.fragment !== undefined) {
5279
+ components.fragment = func(components.fragment);
5280
+ }
5281
+ return components
5349
5282
  }
5350
5283
 
5351
- /**
5352
- * Creates a string based on an array of numeric code points.
5353
- * @see `punycode.ucs2.decode`
5354
- * @memberOf punycode.ucs2
5355
- * @name encode
5356
- * @param {Array} codePoints The array of numeric code points.
5357
- * @returns {String} The new Unicode string (UCS-2).
5358
- */
5359
- var ucs2encode = function ucs2encode(array) {
5360
- return String.fromCodePoint.apply(String, toConsumableArray(array));
5361
- };
5362
-
5363
- /**
5364
- * Converts a basic code point into a digit/integer.
5365
- * @see `digitToBasic()`
5366
- * @private
5367
- * @param {Number} codePoint The basic numeric code point value.
5368
- * @returns {Number} The numeric value of a basic code point (for use in
5369
- * representing integers) in the range `0` to `base - 1`, or `base` if
5370
- * the code point does not represent a value.
5371
- */
5372
- var basicToDigit = function basicToDigit(codePoint) {
5373
- if (codePoint - 0x30 < 0x0A) {
5374
- return codePoint - 0x16;
5375
- }
5376
- if (codePoint - 0x41 < 0x1A) {
5377
- return codePoint - 0x41;
5378
- }
5379
- if (codePoint - 0x61 < 0x1A) {
5380
- return codePoint - 0x61;
5381
- }
5382
- return base;
5383
- };
5384
-
5385
- /**
5386
- * Converts a digit/integer into a basic code point.
5387
- * @see `basicToDigit()`
5388
- * @private
5389
- * @param {Number} digit The numeric value of a basic code point.
5390
- * @returns {Number} The basic code point whose value (when used for
5391
- * representing integers) is `digit`, which needs to be in the range
5392
- * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
5393
- * used; else, the lowercase form is used. The behavior is undefined
5394
- * if `flag` is non-zero and `digit` has no uppercase form.
5395
- */
5396
- var digitToBasic = function digitToBasic(digit, flag) {
5397
- // 0..25 map to ASCII a..z or A..Z
5398
- // 26..35 map to ASCII 0..9
5399
- return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
5400
- };
5284
+ function recomposeAuthority$1 (components) {
5285
+ const uriTokens = [];
5401
5286
 
5402
- /**
5403
- * Bias adaptation function as per section 3.4 of RFC 3492.
5404
- * https://tools.ietf.org/html/rfc3492#section-3.4
5405
- * @private
5406
- */
5407
- var adapt = function adapt(delta, numPoints, firstTime) {
5408
- var k = 0;
5409
- delta = firstTime ? floor(delta / damp) : delta >> 1;
5410
- delta += floor(delta / numPoints);
5411
- for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {
5412
- delta = floor(delta / baseMinusTMin);
5413
- }
5414
- return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
5415
- };
5416
-
5417
- /**
5418
- * Converts a Punycode string of ASCII-only symbols to a string of Unicode
5419
- * symbols.
5420
- * @memberOf punycode
5421
- * @param {String} input The Punycode string of ASCII-only symbols.
5422
- * @returns {String} The resulting string of Unicode symbols.
5423
- */
5424
- var decode = function decode(input) {
5425
- // Don't use UCS-2.
5426
- var output = [];
5427
- var inputLength = input.length;
5428
- var i = 0;
5429
- var n = initialN;
5430
- var bias = initialBias;
5431
-
5432
- // Handle the basic code points: let `basic` be the number of input code
5433
- // points before the last delimiter, or `0` if there is none, then copy
5434
- // the first basic code points to the output.
5435
-
5436
- var basic = input.lastIndexOf(delimiter);
5437
- if (basic < 0) {
5438
- basic = 0;
5439
- }
5440
-
5441
- for (var j = 0; j < basic; ++j) {
5442
- // if it's not a basic code point
5443
- if (input.charCodeAt(j) >= 0x80) {
5444
- error$1('not-basic');
5445
- }
5446
- output.push(input.charCodeAt(j));
5447
- }
5448
-
5449
- // Main decoding loop: start just after the last delimiter if any basic code
5450
- // points were copied; start at the beginning otherwise.
5287
+ if (components.userinfo !== undefined) {
5288
+ uriTokens.push(components.userinfo);
5289
+ uriTokens.push('@');
5290
+ }
5451
5291
 
5452
- for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{
5292
+ if (components.host !== undefined) {
5293
+ let host = unescape(components.host);
5294
+ const ipV4res = normalizeIPv4$1(host);
5453
5295
 
5454
- // `index` is the index of the next character to be consumed.
5455
- // Decode a generalized variable-length integer into `delta`,
5456
- // which gets added to `i`. The overflow checking is easier
5457
- // if we increase `i` as we go, then subtract off its starting
5458
- // value at the end to obtain `delta`.
5459
- var oldi = i;
5460
- for (var w = 1, k = base;; /* no condition */k += base) {
5296
+ if (ipV4res.isIPV4) {
5297
+ host = ipV4res.host;
5298
+ } else {
5299
+ const ipV6res = normalizeIPv6$1(ipV4res.host);
5300
+ if (ipV6res.isIPV6 === true) {
5301
+ host = `[${ipV6res.escapedHost}]`;
5302
+ } else {
5303
+ host = components.host;
5304
+ }
5305
+ }
5306
+ uriTokens.push(host);
5307
+ }
5461
5308
 
5462
- if (index >= inputLength) {
5463
- error$1('invalid-input');
5464
- }
5309
+ if (typeof components.port === 'number' || typeof components.port === 'string') {
5310
+ uriTokens.push(':');
5311
+ uriTokens.push(String(components.port));
5312
+ }
5465
5313
 
5466
- var digit = basicToDigit(input.charCodeAt(index++));
5314
+ return uriTokens.length ? uriTokens.join('') : undefined
5315
+ }
5316
+ var utils = {
5317
+ recomposeAuthority: recomposeAuthority$1,
5318
+ normalizeComponentEncoding: normalizeComponentEncoding$1,
5319
+ removeDotSegments: removeDotSegments$1,
5320
+ normalizeIPv4: normalizeIPv4$1,
5321
+ normalizeIPv6: normalizeIPv6$1,
5322
+ stringArrayToHexStripped
5323
+ };
5467
5324
 
5468
- if (digit >= base || digit > floor((maxInt - i) / w)) {
5469
- error$1('overflow');
5470
- }
5325
+ const UUID_REG = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu;
5326
+ const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
5471
5327
 
5472
- i += digit * w;
5473
- var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
5328
+ function isSecure (wsComponents) {
5329
+ return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === 'wss'
5330
+ }
5474
5331
 
5475
- if (digit < t) {
5476
- break;
5477
- }
5332
+ function httpParse (components) {
5333
+ if (!components.host) {
5334
+ components.error = components.error || 'HTTP URIs must have a host.';
5335
+ }
5478
5336
 
5479
- var baseMinusT = base - t;
5480
- if (w > floor(maxInt / baseMinusT)) {
5481
- error$1('overflow');
5482
- }
5337
+ return components
5338
+ }
5483
5339
 
5484
- w *= baseMinusT;
5485
- }
5340
+ function httpSerialize (components) {
5341
+ const secure = String(components.scheme).toLowerCase() === 'https';
5486
5342
 
5487
- var out = output.length + 1;
5488
- bias = adapt(i - oldi, out, oldi == 0);
5343
+ // normalize the default port
5344
+ if (components.port === (secure ? 443 : 80) || components.port === '') {
5345
+ components.port = undefined;
5346
+ }
5489
5347
 
5490
- // `i` was supposed to wrap around from `out` to `0`,
5491
- // incrementing `n` each time, so we'll fix that now:
5492
- if (floor(i / out) > maxInt - n) {
5493
- error$1('overflow');
5494
- }
5348
+ // normalize the empty path
5349
+ if (!components.path) {
5350
+ components.path = '/';
5351
+ }
5495
5352
 
5496
- n += floor(i / out);
5497
- i %= out;
5353
+ // NOTE: We do not parse query strings for HTTP URIs
5354
+ // as WWW Form Url Encoded query strings are part of the HTML4+ spec,
5355
+ // and not the HTTP spec.
5498
5356
 
5499
- // Insert `n` at position `i` of the output.
5500
- output.splice(i++, 0, n);
5501
- }
5357
+ return components
5358
+ }
5502
5359
 
5503
- return String.fromCodePoint.apply(String, output);
5504
- };
5360
+ function wsParse (wsComponents) {
5361
+ // indicate if the secure flag is set
5362
+ wsComponents.secure = isSecure(wsComponents);
5505
5363
 
5506
- /**
5507
- * Converts a string of Unicode symbols (e.g. a domain name label) to a
5508
- * Punycode string of ASCII-only symbols.
5509
- * @memberOf punycode
5510
- * @param {String} input The string of Unicode symbols.
5511
- * @returns {String} The resulting Punycode string of ASCII-only symbols.
5512
- */
5513
- var encode = function encode(input) {
5514
- var output = [];
5364
+ // construct resouce name
5365
+ wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
5366
+ wsComponents.path = undefined;
5367
+ wsComponents.query = undefined;
5515
5368
 
5516
- // Convert the input in UCS-2 to an array of Unicode code points.
5517
- input = ucs2decode(input);
5369
+ return wsComponents
5370
+ }
5518
5371
 
5519
- // Cache the length.
5520
- var inputLength = input.length;
5372
+ function wsSerialize (wsComponents) {
5373
+ // normalize the default port
5374
+ if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === '') {
5375
+ wsComponents.port = undefined;
5376
+ }
5521
5377
 
5522
- // Initialize the state.
5523
- var n = initialN;
5524
- var delta = 0;
5525
- var bias = initialBias;
5378
+ // ensure scheme matches secure flag
5379
+ if (typeof wsComponents.secure === 'boolean') {
5380
+ wsComponents.scheme = (wsComponents.secure ? 'wss' : 'ws');
5381
+ wsComponents.secure = undefined;
5382
+ }
5526
5383
 
5527
- // Handle the basic code points.
5528
- var _iteratorNormalCompletion = true;
5529
- var _didIteratorError = false;
5530
- var _iteratorError = undefined;
5384
+ // reconstruct path from resource name
5385
+ if (wsComponents.resourceName) {
5386
+ const [path, query] = wsComponents.resourceName.split('?');
5387
+ wsComponents.path = (path && path !== '/' ? path : undefined);
5388
+ wsComponents.query = query;
5389
+ wsComponents.resourceName = undefined;
5390
+ }
5531
5391
 
5532
- try {
5533
- for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
5534
- var _currentValue2 = _step.value;
5392
+ // forbid fragment component
5393
+ wsComponents.fragment = undefined;
5535
5394
 
5536
- if (_currentValue2 < 0x80) {
5537
- output.push(stringFromCharCode(_currentValue2));
5538
- }
5539
- }
5540
- } catch (err) {
5541
- _didIteratorError = true;
5542
- _iteratorError = err;
5543
- } finally {
5544
- try {
5545
- if (!_iteratorNormalCompletion && _iterator.return) {
5546
- _iterator.return();
5547
- }
5548
- } finally {
5549
- if (_didIteratorError) {
5550
- throw _iteratorError;
5551
- }
5552
- }
5553
- }
5395
+ return wsComponents
5396
+ }
5554
5397
 
5555
- var basicLength = output.length;
5556
- var handledCPCount = basicLength;
5398
+ function urnParse (urnComponents, options) {
5399
+ if (!urnComponents.path) {
5400
+ urnComponents.error = 'URN can not be parsed';
5401
+ return urnComponents
5402
+ }
5403
+ const matches = urnComponents.path.match(URN_REG);
5404
+ if (matches) {
5405
+ const scheme = options.scheme || urnComponents.scheme || 'urn';
5406
+ urnComponents.nid = matches[1].toLowerCase();
5407
+ urnComponents.nss = matches[2];
5408
+ const urnScheme = `${scheme}:${options.nid || urnComponents.nid}`;
5409
+ const schemeHandler = SCHEMES$1[urnScheme];
5410
+ urnComponents.path = undefined;
5411
+
5412
+ if (schemeHandler) {
5413
+ urnComponents = schemeHandler.parse(urnComponents, options);
5414
+ }
5415
+ } else {
5416
+ urnComponents.error = urnComponents.error || 'URN can not be parsed.';
5417
+ }
5557
5418
 
5558
- // `handledCPCount` is the number of code points that have been handled;
5559
- // `basicLength` is the number of basic code points.
5419
+ return urnComponents
5420
+ }
5560
5421
 
5561
- // Finish the basic string with a delimiter unless it's empty.
5562
- if (basicLength) {
5563
- output.push(delimiter);
5564
- }
5422
+ function urnSerialize (urnComponents, options) {
5423
+ const scheme = options.scheme || urnComponents.scheme || 'urn';
5424
+ const nid = urnComponents.nid.toLowerCase();
5425
+ const urnScheme = `${scheme}:${options.nid || nid}`;
5426
+ const schemeHandler = SCHEMES$1[urnScheme];
5565
5427
 
5566
- // Main encoding loop:
5567
- while (handledCPCount < inputLength) {
5428
+ if (schemeHandler) {
5429
+ urnComponents = schemeHandler.serialize(urnComponents, options);
5430
+ }
5568
5431
 
5569
- // All non-basic code points < n have been handled already. Find the next
5570
- // larger one:
5571
- var m = maxInt;
5572
- var _iteratorNormalCompletion2 = true;
5573
- var _didIteratorError2 = false;
5574
- var _iteratorError2 = undefined;
5432
+ const uriComponents = urnComponents;
5433
+ const nss = urnComponents.nss;
5434
+ uriComponents.path = `${nid || options.nid}:${nss}`;
5575
5435
 
5576
- try {
5577
- for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
5578
- var currentValue = _step2.value;
5436
+ options.skipEscape = true;
5437
+ return uriComponents
5438
+ }
5579
5439
 
5580
- if (currentValue >= n && currentValue < m) {
5581
- m = currentValue;
5582
- }
5583
- }
5440
+ function urnuuidParse (urnComponents, options) {
5441
+ const uuidComponents = urnComponents;
5442
+ uuidComponents.uuid = uuidComponents.nss;
5443
+ uuidComponents.nss = undefined;
5584
5444
 
5585
- // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
5586
- // but guard against overflow.
5587
- } catch (err) {
5588
- _didIteratorError2 = true;
5589
- _iteratorError2 = err;
5590
- } finally {
5591
- try {
5592
- if (!_iteratorNormalCompletion2 && _iterator2.return) {
5593
- _iterator2.return();
5594
- }
5595
- } finally {
5596
- if (_didIteratorError2) {
5597
- throw _iteratorError2;
5598
- }
5599
- }
5600
- }
5445
+ if (!options.tolerant && (!uuidComponents.uuid || !UUID_REG.test(uuidComponents.uuid))) {
5446
+ uuidComponents.error = uuidComponents.error || 'UUID is not valid.';
5447
+ }
5601
5448
 
5602
- var handledCPCountPlusOne = handledCPCount + 1;
5603
- if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
5604
- error$1('overflow');
5605
- }
5449
+ return uuidComponents
5450
+ }
5606
5451
 
5607
- delta += (m - n) * handledCPCountPlusOne;
5608
- n = m;
5452
+ function urnuuidSerialize (uuidComponents) {
5453
+ const urnComponents = uuidComponents;
5454
+ // normalize UUID
5455
+ urnComponents.nss = (uuidComponents.uuid || '').toLowerCase();
5456
+ return urnComponents
5457
+ }
5609
5458
 
5610
- var _iteratorNormalCompletion3 = true;
5611
- var _didIteratorError3 = false;
5612
- var _iteratorError3 = undefined;
5459
+ const http = {
5460
+ scheme: 'http',
5461
+ domainHost: true,
5462
+ parse: httpParse,
5463
+ serialize: httpSerialize
5464
+ };
5613
5465
 
5614
- try {
5615
- for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
5616
- var _currentValue = _step3.value;
5466
+ const https = {
5467
+ scheme: 'https',
5468
+ domainHost: http.domainHost,
5469
+ parse: httpParse,
5470
+ serialize: httpSerialize
5471
+ };
5617
5472
 
5618
- if (_currentValue < n && ++delta > maxInt) {
5619
- error$1('overflow');
5620
- }
5621
- if (_currentValue == n) {
5622
- // Represent delta as a generalized variable-length integer.
5623
- var q = delta;
5624
- for (var k = base;; /* no condition */k += base) {
5625
- var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
5626
- if (q < t) {
5627
- break;
5628
- }
5629
- var qMinusT = q - t;
5630
- var baseMinusT = base - t;
5631
- output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
5632
- q = floor(qMinusT / baseMinusT);
5633
- }
5634
-
5635
- output.push(stringFromCharCode(digitToBasic(q, 0)));
5636
- bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
5637
- delta = 0;
5638
- ++handledCPCount;
5639
- }
5640
- }
5641
- } catch (err) {
5642
- _didIteratorError3 = true;
5643
- _iteratorError3 = err;
5644
- } finally {
5645
- try {
5646
- if (!_iteratorNormalCompletion3 && _iterator3.return) {
5647
- _iterator3.return();
5648
- }
5649
- } finally {
5650
- if (_didIteratorError3) {
5651
- throw _iteratorError3;
5652
- }
5653
- }
5654
- }
5473
+ const ws = {
5474
+ scheme: 'ws',
5475
+ domainHost: true,
5476
+ parse: wsParse,
5477
+ serialize: wsSerialize
5478
+ };
5655
5479
 
5656
- ++delta;
5657
- ++n;
5658
- }
5659
- return output.join('');
5480
+ const wss = {
5481
+ scheme: 'wss',
5482
+ domainHost: ws.domainHost,
5483
+ parse: ws.parse,
5484
+ serialize: ws.serialize
5660
5485
  };
5661
5486
 
5662
- /**
5663
- * Converts a Punycode string representing a domain name or an email address
5664
- * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
5665
- * it doesn't matter if you call it on a string that has already been
5666
- * converted to Unicode.
5667
- * @memberOf punycode
5668
- * @param {String} input The Punycoded domain name or email address to
5669
- * convert to Unicode.
5670
- * @returns {String} The Unicode representation of the given Punycode
5671
- * string.
5672
- */
5673
- var toUnicode = function toUnicode(input) {
5674
- return mapDomain(input, function (string) {
5675
- return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
5676
- });
5487
+ const urn = {
5488
+ scheme: 'urn',
5489
+ parse: urnParse,
5490
+ serialize: urnSerialize,
5491
+ skipNormalize: true
5677
5492
  };
5678
5493
 
5679
- /**
5680
- * Converts a Unicode string representing a domain name or an email address to
5681
- * Punycode. Only the non-ASCII parts of the domain name will be converted,
5682
- * i.e. it doesn't matter if you call it with a domain that's already in
5683
- * ASCII.
5684
- * @memberOf punycode
5685
- * @param {String} input The domain name or email address to convert, as a
5686
- * Unicode string.
5687
- * @returns {String} The Punycode representation of the given domain name or
5688
- * email address.
5689
- */
5690
- var toASCII = function toASCII(input) {
5691
- return mapDomain(input, function (string) {
5692
- return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
5693
- });
5494
+ const urnuuid = {
5495
+ scheme: 'urn:uuid',
5496
+ parse: urnuuidParse,
5497
+ serialize: urnuuidSerialize,
5498
+ skipNormalize: true
5694
5499
  };
5695
5500
 
5696
- /*--------------------------------------------------------------------------*/
5697
-
5698
- /** Define the public API */
5699
- var punycode = {
5700
- /**
5701
- * A string representing the current Punycode.js version number.
5702
- * @memberOf punycode
5703
- * @type String
5704
- */
5705
- 'version': '2.1.0',
5706
- /**
5707
- * An object of methods to convert from JavaScript's internal character
5708
- * representation (UCS-2) to Unicode code points, and back.
5709
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
5710
- * @memberOf punycode
5711
- * @type Object
5712
- */
5713
- 'ucs2': {
5714
- 'decode': ucs2decode,
5715
- 'encode': ucs2encode
5716
- },
5717
- 'decode': decode,
5718
- 'encode': encode,
5719
- 'toASCII': toASCII,
5720
- 'toUnicode': toUnicode
5501
+ const SCHEMES$1 = {
5502
+ http,
5503
+ https,
5504
+ ws,
5505
+ wss,
5506
+ urn,
5507
+ 'urn:uuid': urnuuid
5721
5508
  };
5722
5509
 
5723
- /**
5724
- * URI.js
5725
- *
5726
- * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
5727
- * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
5728
- * @see http://github.com/garycourt/uri-js
5729
- */
5730
- /**
5731
- * Copyright 2011 Gary Court. All rights reserved.
5732
- *
5733
- * Redistribution and use in source and binary forms, with or without modification, are
5734
- * permitted provided that the following conditions are met:
5735
- *
5736
- * 1. Redistributions of source code must retain the above copyright notice, this list of
5737
- * conditions and the following disclaimer.
5738
- *
5739
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
5740
- * of conditions and the following disclaimer in the documentation and/or other materials
5741
- * provided with the distribution.
5742
- *
5743
- * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
5744
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
5745
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
5746
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
5747
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5748
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
5749
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
5750
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
5751
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5752
- *
5753
- * The views and conclusions contained in the software and documentation are those of the
5754
- * authors and should not be interpreted as representing official policies, either expressed
5755
- * or implied, of Gary Court.
5756
- */
5757
- var SCHEMES = {};
5758
- function pctEncChar(chr) {
5759
- var c = chr.charCodeAt(0);
5760
- var e = void 0;
5761
- 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();
5762
- return e;
5763
- }
5764
- function pctDecChars(str) {
5765
- var newStr = "";
5766
- var i = 0;
5767
- var il = str.length;
5768
- while (i < il) {
5769
- var c = parseInt(str.substr(i + 1, 2), 16);
5770
- if (c < 128) {
5771
- newStr += String.fromCharCode(c);
5772
- i += 3;
5773
- } else if (c >= 194 && c < 224) {
5774
- if (il - i >= 6) {
5775
- var c2 = parseInt(str.substr(i + 4, 2), 16);
5776
- newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);
5777
- } else {
5778
- newStr += str.substr(i, 6);
5779
- }
5780
- i += 6;
5781
- } else if (c >= 224) {
5782
- if (il - i >= 9) {
5783
- var _c = parseInt(str.substr(i + 4, 2), 16);
5784
- var c3 = parseInt(str.substr(i + 7, 2), 16);
5785
- newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);
5786
- } else {
5787
- newStr += str.substr(i, 9);
5788
- }
5789
- i += 9;
5790
- } else {
5791
- newStr += str.substr(i, 3);
5792
- i += 3;
5793
- }
5794
- }
5795
- return newStr;
5796
- }
5797
- function _normalizeComponentEncoding(components, protocol) {
5798
- function decodeUnreserved(str) {
5799
- var decStr = pctDecChars(str);
5800
- return !decStr.match(protocol.UNRESERVED) ? str : decStr;
5801
- }
5802
- if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
5803
- if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
5804
- 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);
5805
- 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);
5806
- if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
5807
- if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
5808
- return components;
5809
- }
5510
+ var schemes = SCHEMES$1;
5511
+
5512
+ const { normalizeIPv6, normalizeIPv4, removeDotSegments, recomposeAuthority, normalizeComponentEncoding } = utils;
5513
+ const SCHEMES = schemes;
5810
5514
 
5811
- function _stripLeadingZeros(str) {
5812
- return str.replace(/^0*(.*)/, "$1") || "0";
5515
+ function normalize (uri, options) {
5516
+ if (typeof uri === 'string') {
5517
+ uri = serialize(parse(uri, options), options);
5518
+ } else if (typeof uri === 'object') {
5519
+ uri = parse(serialize(uri, options), options);
5520
+ }
5521
+ return uri
5813
5522
  }
5814
- function _normalizeIPv4(host, protocol) {
5815
- var matches = host.match(protocol.IPV4ADDRESS) || [];
5816
5523
 
5817
- var _matches = slicedToArray(matches, 2),
5818
- address = _matches[1];
5524
+ function resolve (baseURI, relativeURI, options) {
5525
+ const schemelessOptions = Object.assign({ scheme: 'null' }, options);
5526
+ const resolved = resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
5527
+ return serialize(resolved, { ...schemelessOptions, skipEscape: true })
5528
+ }
5819
5529
 
5820
- if (address) {
5821
- return address.split(".").map(_stripLeadingZeros).join(".");
5822
- } else {
5823
- return host;
5824
- }
5825
- }
5826
- function _normalizeIPv6(host, protocol) {
5827
- var matches = host.match(protocol.IPV6ADDRESS) || [];
5828
-
5829
- var _matches2 = slicedToArray(matches, 3),
5830
- address = _matches2[1],
5831
- zone = _matches2[2];
5832
-
5833
- if (address) {
5834
- var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(),
5835
- _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2),
5836
- last = _address$toLowerCase$2[0],
5837
- first = _address$toLowerCase$2[1];
5838
-
5839
- var firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
5840
- var lastFields = last.split(":").map(_stripLeadingZeros);
5841
- var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
5842
- var fieldCount = isLastFieldIPv4Address ? 7 : 8;
5843
- var lastFieldsStart = lastFields.length - fieldCount;
5844
- var fields = Array(fieldCount);
5845
- for (var x = 0; x < fieldCount; ++x) {
5846
- fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
5847
- }
5848
- if (isLastFieldIPv4Address) {
5849
- fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
5850
- }
5851
- var allZeroFields = fields.reduce(function (acc, field, index) {
5852
- if (!field || field === "0") {
5853
- var lastLongest = acc[acc.length - 1];
5854
- if (lastLongest && lastLongest.index + lastLongest.length === index) {
5855
- lastLongest.length++;
5856
- } else {
5857
- acc.push({ index: index, length: 1 });
5858
- }
5859
- }
5860
- return acc;
5861
- }, []);
5862
- var longestZeroFields = allZeroFields.sort(function (a, b) {
5863
- return b.length - a.length;
5864
- })[0];
5865
- var newHost = void 0;
5866
- if (longestZeroFields && longestZeroFields.length > 1) {
5867
- var newFirst = fields.slice(0, longestZeroFields.index);
5868
- var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
5869
- newHost = newFirst.join(":") + "::" + newLast.join(":");
5870
- } else {
5871
- newHost = fields.join(":");
5872
- }
5873
- if (zone) {
5874
- newHost += "%" + zone;
5875
- }
5876
- return newHost;
5530
+ function resolveComponents (base, relative, options, skipNormalization) {
5531
+ const target = {};
5532
+ if (!skipNormalization) {
5533
+ base = parse(serialize(base, options), options); // normalize base components
5534
+ relative = parse(serialize(relative, options), options); // normalize relative components
5535
+ }
5536
+ options = options || {};
5537
+
5538
+ if (!options.tolerant && relative.scheme) {
5539
+ target.scheme = relative.scheme;
5540
+ // target.authority = relative.authority;
5541
+ target.userinfo = relative.userinfo;
5542
+ target.host = relative.host;
5543
+ target.port = relative.port;
5544
+ target.path = removeDotSegments(relative.path || '');
5545
+ target.query = relative.query;
5546
+ } else {
5547
+ if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
5548
+ // target.authority = relative.authority;
5549
+ target.userinfo = relative.userinfo;
5550
+ target.host = relative.host;
5551
+ target.port = relative.port;
5552
+ target.path = removeDotSegments(relative.path || '');
5553
+ target.query = relative.query;
5877
5554
  } else {
5878
- return host;
5879
- }
5880
- }
5881
- var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
5882
- var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined;
5883
- function parse(uriString) {
5884
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5885
-
5886
- var components = {};
5887
- var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
5888
- if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
5889
- var matches = uriString.match(URI_PARSE);
5890
- if (matches) {
5891
- if (NO_MATCH_IS_UNDEFINED) {
5892
- //store each component
5893
- components.scheme = matches[1];
5894
- components.userinfo = matches[3];
5895
- components.host = matches[4];
5896
- components.port = parseInt(matches[5], 10);
5897
- components.path = matches[6] || "";
5898
- components.query = matches[7];
5899
- components.fragment = matches[8];
5900
- //fix port number
5901
- if (isNaN(components.port)) {
5902
- components.port = matches[5];
5903
- }
5555
+ if (!relative.path) {
5556
+ target.path = base.path;
5557
+ if (relative.query !== undefined) {
5558
+ target.query = relative.query;
5904
5559
  } else {
5905
- //IE FIX for improper RegExp matching
5906
- //store each component
5907
- components.scheme = matches[1] || undefined;
5908
- components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined;
5909
- components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined;
5910
- components.port = parseInt(matches[5], 10);
5911
- components.path = matches[6] || "";
5912
- components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined;
5913
- components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined;
5914
- //fix port number
5915
- if (isNaN(components.port)) {
5916
- components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined;
5917
- }
5560
+ target.query = base.query;
5918
5561
  }
5919
- if (components.host) {
5920
- //normalize IP hosts
5921
- components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
5922
- }
5923
- //determine reference type
5924
- if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
5925
- components.reference = "same-document";
5926
- } else if (components.scheme === undefined) {
5927
- components.reference = "relative";
5928
- } else if (components.fragment === undefined) {
5929
- components.reference = "absolute";
5930
- } else {
5931
- components.reference = "uri";
5932
- }
5933
- //check for reference errors
5934
- if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
5935
- components.error = components.error || "URI is not a " + options.reference + " reference.";
5936
- }
5937
- //find scheme handler
5938
- var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
5939
- //check if scheme can't handle IRIs
5940
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
5941
- //if host component is a domain name
5942
- if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {
5943
- //convert Unicode IDN -> ASCII IDN
5944
- try {
5945
- components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
5946
- } catch (e) {
5947
- components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
5948
- }
5949
- }
5950
- //convert IRI -> URI
5951
- _normalizeComponentEncoding(components, URI_PROTOCOL);
5562
+ } else {
5563
+ if (relative.path.charAt(0) === '/') {
5564
+ target.path = removeDotSegments(relative.path);
5952
5565
  } else {
5953
- //normalize encodings
5954
- _normalizeComponentEncoding(components, protocol);
5955
- }
5956
- //perform scheme specific parsing
5957
- if (schemeHandler && schemeHandler.parse) {
5958
- schemeHandler.parse(components, options);
5566
+ if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
5567
+ target.path = '/' + relative.path;
5568
+ } else if (!base.path) {
5569
+ target.path = relative.path;
5570
+ } else {
5571
+ target.path = base.path.slice(0, base.path.lastIndexOf('/') + 1) + relative.path;
5572
+ }
5573
+ target.path = removeDotSegments(target.path);
5959
5574
  }
5960
- } else {
5961
- components.error = components.error || "URI can not be parsed.";
5575
+ target.query = relative.query;
5576
+ }
5577
+ // target.authority = base.authority;
5578
+ target.userinfo = base.userinfo;
5579
+ target.host = base.host;
5580
+ target.port = base.port;
5962
5581
  }
5963
- return components;
5964
- }
5582
+ target.scheme = base.scheme;
5583
+ }
5965
5584
 
5966
- function _recomposeAuthority(components, options) {
5967
- var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
5968
- var uriTokens = [];
5969
- if (components.userinfo !== undefined) {
5970
- uriTokens.push(components.userinfo);
5971
- uriTokens.push("@");
5972
- }
5973
- if (components.host !== undefined) {
5974
- //normalize IP hosts, add brackets and escape zone separator for IPv6
5975
- uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {
5976
- return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
5977
- }));
5978
- }
5979
- if (typeof components.port === "number" || typeof components.port === "string") {
5980
- uriTokens.push(":");
5981
- uriTokens.push(String(components.port));
5982
- }
5983
- return uriTokens.length ? uriTokens.join("") : undefined;
5984
- }
5985
-
5986
- var RDS1 = /^\.\.?\//;
5987
- var RDS2 = /^\/\.(\/|$)/;
5988
- var RDS3 = /^\/\.\.(\/|$)/;
5989
- var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
5990
- function removeDotSegments(input) {
5991
- var output = [];
5992
- while (input.length) {
5993
- if (input.match(RDS1)) {
5994
- input = input.replace(RDS1, "");
5995
- } else if (input.match(RDS2)) {
5996
- input = input.replace(RDS2, "/");
5997
- } else if (input.match(RDS3)) {
5998
- input = input.replace(RDS3, "/");
5999
- output.pop();
6000
- } else if (input === "." || input === "..") {
6001
- input = "";
6002
- } else {
6003
- var im = input.match(RDS5);
6004
- if (im) {
6005
- var s = im[0];
6006
- input = input.slice(s.length);
6007
- output.push(s);
6008
- } else {
6009
- throw new Error("Unexpected dot segment condition");
6010
- }
6011
- }
6012
- }
6013
- return output.join("");
5585
+ target.fragment = relative.fragment;
5586
+
5587
+ return target
6014
5588
  }
6015
5589
 
6016
- function serialize(components) {
6017
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5590
+ function equal$2 (uriA, uriB, options) {
5591
+ if (typeof uriA === 'string') {
5592
+ uriA = unescape(uriA);
5593
+ uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true });
5594
+ } else if (typeof uriA === 'object') {
5595
+ uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
5596
+ }
6018
5597
 
6019
- var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;
6020
- var uriTokens = [];
6021
- //find scheme handler
6022
- var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
6023
- //perform scheme specific serialization
6024
- if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
6025
- if (components.host) {
6026
- //if host component is an IPv6 address
6027
- if (protocol.IPV6ADDRESS.test(components.host)) ;
6028
- //TODO: normalize IPv6 address as per RFC 5952
5598
+ if (typeof uriB === 'string') {
5599
+ uriB = unescape(uriB);
5600
+ uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true });
5601
+ } else if (typeof uriB === 'object') {
5602
+ uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
5603
+ }
6029
5604
 
6030
- //if host component is a domain name
6031
- else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {
6032
- //convert IDN via punycode
6033
- try {
6034
- components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);
6035
- } catch (e) {
6036
- components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
6037
- }
6038
- }
6039
- }
6040
- //normalize encoding
6041
- _normalizeComponentEncoding(components, protocol);
6042
- if (options.reference !== "suffix" && components.scheme) {
6043
- uriTokens.push(components.scheme);
6044
- uriTokens.push(":");
6045
- }
6046
- var authority = _recomposeAuthority(components, options);
6047
- if (authority !== undefined) {
6048
- if (options.reference !== "suffix") {
6049
- uriTokens.push("//");
6050
- }
6051
- uriTokens.push(authority);
6052
- if (components.path && components.path.charAt(0) !== "/") {
6053
- uriTokens.push("/");
6054
- }
6055
- }
6056
- if (components.path !== undefined) {
6057
- var s = components.path;
6058
- if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
6059
- s = removeDotSegments(s);
6060
- }
6061
- if (authority === undefined) {
6062
- s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
6063
- }
6064
- uriTokens.push(s);
6065
- }
6066
- if (components.query !== undefined) {
6067
- uriTokens.push("?");
6068
- uriTokens.push(components.query);
6069
- }
6070
- if (components.fragment !== undefined) {
6071
- uriTokens.push("#");
6072
- uriTokens.push(components.fragment);
6073
- }
6074
- return uriTokens.join(""); //merge tokens into a string
6075
- }
5605
+ return uriA.toLowerCase() === uriB.toLowerCase()
5606
+ }
5607
+
5608
+ function serialize (cmpts, opts) {
5609
+ const components = {
5610
+ host: cmpts.host,
5611
+ scheme: cmpts.scheme,
5612
+ userinfo: cmpts.userinfo,
5613
+ port: cmpts.port,
5614
+ path: cmpts.path,
5615
+ query: cmpts.query,
5616
+ nid: cmpts.nid,
5617
+ nss: cmpts.nss,
5618
+ uuid: cmpts.uuid,
5619
+ fragment: cmpts.fragment,
5620
+ reference: cmpts.reference,
5621
+ resourceName: cmpts.resourceName,
5622
+ secure: cmpts.secure,
5623
+ error: ''
5624
+ };
5625
+ const options = Object.assign({}, opts);
5626
+ const uriTokens = [];
6076
5627
 
6077
- function resolveComponents(base, relative) {
6078
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6079
- var skipNormalization = arguments[3];
5628
+ // find scheme handler
5629
+ const schemeHandler = SCHEMES[(options.scheme || components.scheme || '').toLowerCase()];
6080
5630
 
6081
- var target = {};
6082
- if (!skipNormalization) {
6083
- base = parse(serialize(base, options), options); //normalize base components
6084
- relative = parse(serialize(relative, options), options); //normalize relative components
6085
- }
6086
- options = options || {};
6087
- if (!options.tolerant && relative.scheme) {
6088
- target.scheme = relative.scheme;
6089
- //target.authority = relative.authority;
6090
- target.userinfo = relative.userinfo;
6091
- target.host = relative.host;
6092
- target.port = relative.port;
6093
- target.path = removeDotSegments(relative.path || "");
6094
- target.query = relative.query;
5631
+ // perform scheme specific serialization
5632
+ if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
5633
+
5634
+ if (components.path !== undefined) {
5635
+ if (!options.skipEscape) {
5636
+ components.path = escape(components.path);
5637
+
5638
+ if (components.scheme !== undefined) {
5639
+ components.path = components.path.split('%3A').join(':');
5640
+ }
6095
5641
  } else {
6096
- if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
6097
- //target.authority = relative.authority;
6098
- target.userinfo = relative.userinfo;
6099
- target.host = relative.host;
6100
- target.port = relative.port;
6101
- target.path = removeDotSegments(relative.path || "");
6102
- target.query = relative.query;
6103
- } else {
6104
- if (!relative.path) {
6105
- target.path = base.path;
6106
- if (relative.query !== undefined) {
6107
- target.query = relative.query;
6108
- } else {
6109
- target.query = base.query;
6110
- }
6111
- } else {
6112
- if (relative.path.charAt(0) === "/") {
6113
- target.path = removeDotSegments(relative.path);
6114
- } else {
6115
- if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
6116
- target.path = "/" + relative.path;
6117
- } else if (!base.path) {
6118
- target.path = relative.path;
6119
- } else {
6120
- target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
6121
- }
6122
- target.path = removeDotSegments(target.path);
6123
- }
6124
- target.query = relative.query;
6125
- }
6126
- //target.authority = base.authority;
6127
- target.userinfo = base.userinfo;
6128
- target.host = base.host;
6129
- target.port = base.port;
6130
- }
6131
- target.scheme = base.scheme;
5642
+ components.path = unescape(components.path);
6132
5643
  }
6133
- target.fragment = relative.fragment;
6134
- return target;
6135
- }
5644
+ }
6136
5645
 
6137
- function resolve(baseURI, relativeURI, options) {
6138
- var schemelessOptions = assign({ scheme: 'null' }, options);
6139
- return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
6140
- }
5646
+ if (options.reference !== 'suffix' && components.scheme) {
5647
+ uriTokens.push(components.scheme, ':');
5648
+ }
6141
5649
 
6142
- function normalize(uri, options) {
6143
- if (typeof uri === "string") {
6144
- uri = serialize(parse(uri, options), options);
6145
- } else if (typeOf(uri) === "object") {
6146
- uri = parse(serialize(uri, options), options);
5650
+ const authority = recomposeAuthority(components);
5651
+ if (authority !== undefined) {
5652
+ if (options.reference !== 'suffix') {
5653
+ uriTokens.push('//');
6147
5654
  }
6148
- return uri;
6149
- }
6150
5655
 
6151
- function equal(uriA, uriB, options) {
6152
- if (typeof uriA === "string") {
6153
- uriA = serialize(parse(uriA, options), options);
6154
- } else if (typeOf(uriA) === "object") {
6155
- uriA = serialize(uriA, options);
5656
+ uriTokens.push(authority);
5657
+
5658
+ if (components.path && components.path.charAt(0) !== '/') {
5659
+ uriTokens.push('/');
6156
5660
  }
6157
- if (typeof uriB === "string") {
6158
- uriB = serialize(parse(uriB, options), options);
6159
- } else if (typeOf(uriB) === "object") {
6160
- uriB = serialize(uriB, options);
5661
+ }
5662
+ if (components.path !== undefined) {
5663
+ let s = components.path;
5664
+
5665
+ if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
5666
+ s = removeDotSegments(s);
6161
5667
  }
6162
- return uriA === uriB;
6163
- }
6164
5668
 
6165
- function escapeComponent(str, options) {
6166
- return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);
6167
- }
5669
+ if (authority === undefined) {
5670
+ s = s.replace(/^\/\//u, '/%2F'); // don't allow the path to start with "//"
5671
+ }
5672
+
5673
+ uriTokens.push(s);
5674
+ }
6168
5675
 
6169
- function unescapeComponent(str, options) {
6170
- return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);
5676
+ if (components.query !== undefined) {
5677
+ uriTokens.push('?', components.query);
5678
+ }
5679
+
5680
+ if (components.fragment !== undefined) {
5681
+ uriTokens.push('#', components.fragment);
5682
+ }
5683
+ return uriTokens.join('')
6171
5684
  }
6172
5685
 
6173
- var handler = {
6174
- scheme: "http",
6175
- domainHost: true,
6176
- parse: function parse(components, options) {
6177
- //report missing host
6178
- if (!components.host) {
6179
- components.error = components.error || "HTTP URIs must have a host.";
6180
- }
6181
- return components;
6182
- },
6183
- serialize: function serialize(components, options) {
6184
- var secure = String(components.scheme).toLowerCase() === "https";
6185
- //normalize the default port
6186
- if (components.port === (secure ? 443 : 80) || components.port === "") {
6187
- components.port = undefined;
6188
- }
6189
- //normalize the empty path
6190
- if (!components.path) {
6191
- components.path = "/";
6192
- }
6193
- //NOTE: We do not parse query strings for HTTP URIs
6194
- //as WWW Form Url Encoded query strings are part of the HTML4+ spec,
6195
- //and not the HTTP spec.
6196
- return components;
5686
+ const hexLookUp = Array.from({ length: 127 }, (_v, k) => /[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(k)));
5687
+
5688
+ function nonSimpleDomain (value) {
5689
+ let code = 0;
5690
+ for (let i = 0, len = value.length; i < len; ++i) {
5691
+ code = value.charCodeAt(i);
5692
+ if (code > 126 || hexLookUp[code]) {
5693
+ return true
6197
5694
  }
6198
- };
5695
+ }
5696
+ return false
5697
+ }
6199
5698
 
6200
- var handler$1 = {
6201
- scheme: "https",
6202
- domainHost: handler.domainHost,
6203
- parse: handler.parse,
6204
- serialize: handler.serialize
6205
- };
5699
+ const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
6206
5700
 
6207
- function isSecure(wsComponents) {
6208
- return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
6209
- }
6210
- //RFC 6455
6211
- var handler$2 = {
6212
- scheme: "ws",
6213
- domainHost: true,
6214
- parse: function parse(components, options) {
6215
- var wsComponents = components;
6216
- //indicate if the secure flag is set
6217
- wsComponents.secure = isSecure(wsComponents);
6218
- //construct resouce name
6219
- wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
6220
- wsComponents.path = undefined;
6221
- wsComponents.query = undefined;
6222
- return wsComponents;
6223
- },
6224
- serialize: function serialize(wsComponents, options) {
6225
- //normalize the default port
6226
- if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
6227
- wsComponents.port = undefined;
6228
- }
6229
- //ensure scheme matches secure flag
6230
- if (typeof wsComponents.secure === 'boolean') {
6231
- wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';
6232
- wsComponents.secure = undefined;
6233
- }
6234
- //reconstruct path from resource name
6235
- if (wsComponents.resourceName) {
6236
- var _wsComponents$resourc = wsComponents.resourceName.split('?'),
6237
- _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),
6238
- path = _wsComponents$resourc2[0],
6239
- query = _wsComponents$resourc2[1];
6240
-
6241
- wsComponents.path = path && path !== '/' ? path : undefined;
6242
- wsComponents.query = query;
6243
- wsComponents.resourceName = undefined;
6244
- }
6245
- //forbid fragment component
6246
- wsComponents.fragment = undefined;
6247
- return wsComponents;
5701
+ function parse (uri, opts) {
5702
+ const options = Object.assign({}, opts);
5703
+ const parsed = {
5704
+ scheme: undefined,
5705
+ userinfo: undefined,
5706
+ host: '',
5707
+ port: undefined,
5708
+ path: '',
5709
+ query: undefined,
5710
+ fragment: undefined
5711
+ };
5712
+ const gotEncoding = uri.indexOf('%') !== -1;
5713
+ let isIP = false;
5714
+ if (options.reference === 'suffix') uri = (options.scheme ? options.scheme + ':' : '') + '//' + uri;
5715
+
5716
+ const matches = uri.match(URI_PARSE);
5717
+
5718
+ if (matches) {
5719
+ // store each component
5720
+ parsed.scheme = matches[1];
5721
+ parsed.userinfo = matches[3];
5722
+ parsed.host = matches[4];
5723
+ parsed.port = parseInt(matches[5], 10);
5724
+ parsed.path = matches[6] || '';
5725
+ parsed.query = matches[7];
5726
+ parsed.fragment = matches[8];
5727
+
5728
+ // fix port number
5729
+ if (isNaN(parsed.port)) {
5730
+ parsed.port = matches[5];
5731
+ }
5732
+ if (parsed.host) {
5733
+ const ipv4result = normalizeIPv4(parsed.host);
5734
+ if (ipv4result.isIPV4 === false) {
5735
+ const ipv6result = normalizeIPv6(ipv4result.host);
5736
+ parsed.host = ipv6result.host.toLowerCase();
5737
+ isIP = ipv6result.isIPV6;
5738
+ } else {
5739
+ parsed.host = ipv4result.host;
5740
+ isIP = true;
5741
+ }
5742
+ }
5743
+ if (parsed.scheme === undefined && parsed.userinfo === undefined && parsed.host === undefined && parsed.port === undefined && parsed.query === undefined && !parsed.path) {
5744
+ parsed.reference = 'same-document';
5745
+ } else if (parsed.scheme === undefined) {
5746
+ parsed.reference = 'relative';
5747
+ } else if (parsed.fragment === undefined) {
5748
+ parsed.reference = 'absolute';
5749
+ } else {
5750
+ parsed.reference = 'uri';
6248
5751
  }
6249
- };
6250
5752
 
6251
- var handler$3 = {
6252
- scheme: "wss",
6253
- domainHost: handler$2.domainHost,
6254
- parse: handler$2.parse,
6255
- serialize: handler$2.serialize
6256
- };
5753
+ // check for reference errors
5754
+ if (options.reference && options.reference !== 'suffix' && options.reference !== parsed.reference) {
5755
+ parsed.error = parsed.error || 'URI is not a ' + options.reference + ' reference.';
5756
+ }
6257
5757
 
6258
- var O = {};
6259
- //RFC 3986
6260
- var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + ("\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" ) + "]";
6261
- var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
6262
- var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
6263
- //RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
6264
- //const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
6265
- //const WSP$$ = "[\\x20\\x09]";
6266
- //const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)
6267
- //const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext
6268
- //const VCHAR$$ = "[\\x21-\\x7E]";
6269
- //const WSP$$ = "[\\x20\\x09]";
6270
- //const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
6271
- //const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
6272
- //const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
6273
- //const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
6274
- var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
6275
- var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
6276
- var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
6277
- var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
6278
- var UNRESERVED = new RegExp(UNRESERVED$$, "g");
6279
- var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
6280
- var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
6281
- var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
6282
- var NOT_HFVALUE = NOT_HFNAME;
6283
- function decodeUnreserved(str) {
6284
- var decStr = pctDecChars(str);
6285
- return !decStr.match(UNRESERVED) ? str : decStr;
6286
- }
6287
- var handler$4 = {
6288
- scheme: "mailto",
6289
- parse: function parse$$1(components, options) {
6290
- var mailtoComponents = components;
6291
- var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : [];
6292
- mailtoComponents.path = undefined;
6293
- if (mailtoComponents.query) {
6294
- var unknownHeaders = false;
6295
- var headers = {};
6296
- var hfields = mailtoComponents.query.split("&");
6297
- for (var x = 0, xl = hfields.length; x < xl; ++x) {
6298
- var hfield = hfields[x].split("=");
6299
- switch (hfield[0]) {
6300
- case "to":
6301
- var toAddrs = hfield[1].split(",");
6302
- for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {
6303
- to.push(toAddrs[_x]);
6304
- }
6305
- break;
6306
- case "subject":
6307
- mailtoComponents.subject = unescapeComponent(hfield[1], options);
6308
- break;
6309
- case "body":
6310
- mailtoComponents.body = unescapeComponent(hfield[1], options);
6311
- break;
6312
- default:
6313
- unknownHeaders = true;
6314
- headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
6315
- break;
6316
- }
6317
- }
6318
- if (unknownHeaders) mailtoComponents.headers = headers;
6319
- }
6320
- mailtoComponents.query = undefined;
6321
- for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {
6322
- var addr = to[_x2].split("@");
6323
- addr[0] = unescapeComponent(addr[0]);
6324
- if (!options.unicodeSupport) {
6325
- //convert Unicode IDN -> ASCII IDN
6326
- try {
6327
- addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
6328
- } catch (e) {
6329
- mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
6330
- }
6331
- } else {
6332
- addr[1] = unescapeComponent(addr[1], options).toLowerCase();
6333
- }
6334
- to[_x2] = addr.join("@");
6335
- }
6336
- return mailtoComponents;
6337
- },
6338
- serialize: function serialize$$1(mailtoComponents, options) {
6339
- var components = mailtoComponents;
6340
- var to = toArray(mailtoComponents.to);
6341
- if (to) {
6342
- for (var x = 0, xl = to.length; x < xl; ++x) {
6343
- var toAddr = String(to[x]);
6344
- var atIdx = toAddr.lastIndexOf("@");
6345
- var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
6346
- var domain = toAddr.slice(atIdx + 1);
6347
- //convert IDN via punycode
6348
- try {
6349
- domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);
6350
- } catch (e) {
6351
- components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
6352
- }
6353
- to[x] = localPart + "@" + domain;
6354
- }
6355
- components.path = to.join(",");
6356
- }
6357
- var headers = mailtoComponents.headers = mailtoComponents.headers || {};
6358
- if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
6359
- if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
6360
- var fields = [];
6361
- for (var name in headers) {
6362
- if (headers[name] !== O[name]) {
6363
- 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));
6364
- }
6365
- }
6366
- if (fields.length) {
6367
- components.query = fields.join("&");
5758
+ // find scheme handler
5759
+ const schemeHandler = SCHEMES[(options.scheme || parsed.scheme || '').toLowerCase()];
5760
+
5761
+ // check if scheme can't handle IRIs
5762
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
5763
+ // if host component is a domain name
5764
+ if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && isIP === false && nonSimpleDomain(parsed.host)) {
5765
+ // convert Unicode IDN -> ASCII IDN
5766
+ try {
5767
+ parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
5768
+ } catch (e) {
5769
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
6368
5770
  }
6369
- return components;
5771
+ }
5772
+ // convert IRI -> URI
6370
5773
  }
6371
- };
6372
5774
 
6373
- var URN_PARSE = /^([^\:]+)\:(.*)/;
6374
- //RFC 2141
6375
- var handler$5 = {
6376
- scheme: "urn",
6377
- parse: function parse$$1(components, options) {
6378
- var matches = components.path && components.path.match(URN_PARSE);
6379
- var urnComponents = components;
6380
- if (matches) {
6381
- var scheme = options.scheme || urnComponents.scheme || "urn";
6382
- var nid = matches[1].toLowerCase();
6383
- var nss = matches[2];
6384
- var urnScheme = scheme + ":" + (options.nid || nid);
6385
- var schemeHandler = SCHEMES[urnScheme];
6386
- urnComponents.nid = nid;
6387
- urnComponents.nss = nss;
6388
- urnComponents.path = undefined;
6389
- if (schemeHandler) {
6390
- urnComponents = schemeHandler.parse(urnComponents, options);
6391
- }
6392
- } else {
6393
- urnComponents.error = urnComponents.error || "URN can not be parsed.";
6394
- }
6395
- return urnComponents;
6396
- },
6397
- serialize: function serialize$$1(urnComponents, options) {
6398
- var scheme = options.scheme || urnComponents.scheme || "urn";
6399
- var nid = urnComponents.nid;
6400
- var urnScheme = scheme + ":" + (options.nid || nid);
6401
- var schemeHandler = SCHEMES[urnScheme];
6402
- if (schemeHandler) {
6403
- urnComponents = schemeHandler.serialize(urnComponents, options);
6404
- }
6405
- var uriComponents = urnComponents;
6406
- var nss = urnComponents.nss;
6407
- uriComponents.path = (nid || options.nid) + ":" + nss;
6408
- return uriComponents;
5775
+ if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) {
5776
+ if (gotEncoding && parsed.scheme !== undefined) {
5777
+ parsed.scheme = unescape(parsed.scheme);
5778
+ }
5779
+ if (gotEncoding && parsed.host !== undefined) {
5780
+ parsed.host = unescape(parsed.host);
5781
+ }
5782
+ if (parsed.path) {
5783
+ parsed.path = escape(unescape(parsed.path));
5784
+ }
5785
+ if (parsed.fragment) {
5786
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
5787
+ }
6409
5788
  }
6410
- };
6411
5789
 
6412
- var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
6413
- //RFC 4122
6414
- var handler$6 = {
6415
- scheme: "urn:uuid",
6416
- parse: function parse(urnComponents, options) {
6417
- var uuidComponents = urnComponents;
6418
- uuidComponents.uuid = uuidComponents.nss;
6419
- uuidComponents.nss = undefined;
6420
- if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
6421
- uuidComponents.error = uuidComponents.error || "UUID is not valid.";
6422
- }
6423
- return uuidComponents;
6424
- },
6425
- serialize: function serialize(uuidComponents, options) {
6426
- var urnComponents = uuidComponents;
6427
- //normalize UUID
6428
- urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
6429
- return urnComponents;
5790
+ // perform scheme specific parsing
5791
+ if (schemeHandler && schemeHandler.parse) {
5792
+ schemeHandler.parse(parsed, options);
6430
5793
  }
5794
+ } else {
5795
+ parsed.error = parsed.error || 'URI can not be parsed.';
5796
+ }
5797
+ return parsed
5798
+ }
5799
+
5800
+ const fastUri = {
5801
+ SCHEMES,
5802
+ normalize,
5803
+ resolve,
5804
+ resolveComponents,
5805
+ equal: equal$2,
5806
+ serialize,
5807
+ parse
6431
5808
  };
6432
5809
 
6433
- SCHEMES[handler.scheme] = handler;
6434
- SCHEMES[handler$1.scheme] = handler$1;
6435
- SCHEMES[handler$2.scheme] = handler$2;
6436
- SCHEMES[handler$3.scheme] = handler$3;
6437
- SCHEMES[handler$4.scheme] = handler$4;
6438
- SCHEMES[handler$5.scheme] = handler$5;
6439
- SCHEMES[handler$6.scheme] = handler$6;
6440
-
6441
- exports.SCHEMES = SCHEMES;
6442
- exports.pctEncChar = pctEncChar;
6443
- exports.pctDecChars = pctDecChars;
6444
- exports.parse = parse;
6445
- exports.removeDotSegments = removeDotSegments;
6446
- exports.serialize = serialize;
6447
- exports.resolveComponents = resolveComponents;
6448
- exports.resolve = resolve;
6449
- exports.normalize = normalize;
6450
- exports.equal = equal;
6451
- exports.escapeComponent = escapeComponent;
6452
- exports.unescapeComponent = unescapeComponent;
6453
-
6454
- Object.defineProperty(exports, '__esModule', { value: true });
6455
-
6456
- })));
6457
-
6458
- }(uri_all, uri_all.exports));
5810
+ fastUri$1.exports = fastUri;
5811
+ fastUri$1.exports.default = fastUri;
5812
+ fastUri$1.exports.fastUri = fastUri;
6459
5813
 
6460
5814
  Object.defineProperty(uri$1, "__esModule", { value: true });
6461
- const uri = uri_all.exports;
5815
+ const uri = fastUri$1.exports;
6462
5816
  uri.code = 'require("ajv/dist/runtime/uri").default';
6463
5817
  uri$1.default = uri;
6464
5818
 
@@ -6479,7 +5833,7 @@ const ref_error_1 = ref_error;
6479
5833
  const rules_1 = rules;
6480
5834
  const compile_1 = compile;
6481
5835
  const codegen_2 = codegen;
6482
- const resolve_1 = resolve$1;
5836
+ const resolve_1 = resolve$2;
6483
5837
  const dataType_1 = dataType;
6484
5838
  const util_1 = util;
6485
5839
  const $dataRefSchema = require$$9;
@@ -9595,7 +8949,7 @@ var validate = function validate(rule, instance) {
9595
8949
  message = _theRule.message;
9596
8950
  var valid = true;
9597
8951
  if (isExpression(validator)) {
9598
- valid = executeExpression(validator, instance);
8952
+ valid = _executeExpression(validator, instance);
9599
8953
  } else if (typeof validator === 'function') {
9600
8954
  valid = validator(instance);
9601
8955
  // eslint-disable-next-line no-eval
@@ -9759,7 +9113,7 @@ var validateFormWithResult = function validateFormWithResult(widgetTree) {
9759
9113
  };
9760
9114
  // 校验schema是否正常
9761
9115
  var validateSchema = /*#__PURE__*/function () {
9762
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(schema) {
9116
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(schema) {
9763
9117
  return _regeneratorRuntime().wrap(function _callee$(_context) {
9764
9118
  while (1) switch (_context.prev = _context.next) {
9765
9119
  case 0:
@@ -9967,6 +9321,11 @@ var Widget = Vue.extend({
9967
9321
  setState: function setState(key, value) {
9968
9322
  if (Reflect.has(this.state, key)) {
9969
9323
  this.state[key] = value;
9324
+ // state变化
9325
+ this.$emit('state-change', {
9326
+ path: this.path,
9327
+ state: this.state
9328
+ });
9970
9329
  } else if (key === 'value') {
9971
9330
  // 特殊处理value设置
9972
9331
  this.$emit('input', {
@@ -9979,7 +9338,7 @@ var Widget = Vue.extend({
9979
9338
  },
9980
9339
  loadDataSource: function loadDataSource() {
9981
9340
  var _this3 = this;
9982
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9341
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9983
9342
  var _this3$widgetSchema, _this3$widgetSchema$u, _this3$widgetSchema$u2;
9984
9343
  var xhrConfig, url, params, reset, _this3$httpAdapter, _this3$httpAdapter$re, http, responseParse, remoteURL, requestParams;
9985
9344
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -9994,8 +9353,8 @@ var Widget = Vue.extend({
9994
9353
  _this3$httpAdapter = _this3.httpAdapter, _this3$httpAdapter$re = _this3$httpAdapter.request, http = _this3$httpAdapter$re === void 0 ? request : _this3$httpAdapter$re, responseParse = _this3$httpAdapter.responseParse;
9995
9354
  _context.prev = 4;
9996
9355
  _this3.loading = true;
9997
- remoteURL = executeExpression(url, _this3);
9998
- requestParams = isObj(params) ? executeExpression(params, _this3) : params;
9356
+ remoteURL = _executeExpression(url, _this3);
9357
+ requestParams = isObj(params) ? _executeExpression(params, _this3) : params;
9999
9358
  _context.next = 10;
10000
9359
  return http(remoteURL, _objectSpread2(_objectSpread2({}, reset), {}, {
10001
9360
  params: requestParams,
@@ -11129,14 +10488,98 @@ var FieldGroupWrap = Vue.extend({
11129
10488
 
11130
10489
  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;
11131
10490
 
10491
+ var CommonGroupWrap = Vue.extend({
10492
+ name: 'CommonFieldGroupWrap',
10493
+ inject: ['widgetTree'],
10494
+ props: _objectSpread2(_objectSpread2({}, props), {}, {
10495
+ // 组类型
10496
+ type: {
10497
+ type: String,
10498
+ default: 'default',
10499
+ validator: function validator(value) {
10500
+ return ['default', 'normal', 'card'].includes(value);
10501
+ }
10502
+ },
10503
+ // 是否显示组title
10504
+ showTitle: {
10505
+ type: Boolean,
10506
+ default: false
10507
+ },
10508
+ // 是否显示border
10509
+ border: {
10510
+ type: Boolean,
10511
+ default: false
10512
+ },
10513
+ verifiable: {
10514
+ type: Boolean,
10515
+ default: false
10516
+ },
10517
+ hideEmptyRow: {
10518
+ type: Boolean,
10519
+ default: false
10520
+ },
10521
+ description: {
10522
+ type: String,
10523
+ default: ''
10524
+ },
10525
+ tag: {
10526
+ type: String,
10527
+ default: 'div'
10528
+ }
10529
+ }),
10530
+ data: function data() {
10531
+ return {
10532
+ state: {
10533
+ // 组类型目前只支持visible
10534
+ visible: true
10535
+ }
10536
+ };
10537
+ },
10538
+ created: function created() {
10539
+ // 注册widget TreeNode
10540
+ this.widgetTree.addWidgetNode(this.path, this, 'group');
10541
+ },
10542
+ mounted: function mounted() {
10543
+ // 更新样式
10544
+ this.$forceUpdate();
10545
+ },
10546
+ beforeDestroy: function beforeDestroy() {
10547
+ this.widgetTree.removeWidgetNode(this.path, this);
10548
+ },
10549
+ methods: {
10550
+ setState: function setState(key, value) {
10551
+ if (Reflect.has(this.state, key)) {
10552
+ this.state[key] = value;
10553
+ } else {
10554
+ console.warn("Group unsupported ".concat(key, " state, please check"));
10555
+ }
10556
+ }
10557
+ },
10558
+ render: function render(h) {
10559
+ var _this$layout;
10560
+ var groupContentStyle = _objectSpread2({}, (_this$layout = this.layout) === null || _this$layout === void 0 ? void 0 : _this$layout.container);
10561
+ return h(this.tag, {
10562
+ style: groupContentStyle
10563
+ }, [this.$slots.default]);
10564
+ }
10565
+ });
10566
+
11132
10567
  // 伪数组类型
11133
10568
  var KeyValueArrayWidget = Vue.extend({
11134
10569
  name: 'KeyValueArrayWidget',
11135
10570
  props: _objectSpread2({}, props),
10571
+ data: function data() {
10572
+ return {
10573
+ columns: {},
10574
+ showTableHead: false
10575
+ };
10576
+ },
11136
10577
  mounted: function mounted() {
11137
10578
  var _this$value;
11138
10579
  var _this$schema$minItems = this.schema.minItems,
11139
10580
  minItems = _this$schema$minItems === void 0 ? 0 : _this$schema$minItems;
10581
+ var uiOptions = Schema.getUiOptions(this.schema);
10582
+ this.showTableHead = !!uiOptions.showTableHead;
11140
10583
  // 补全minItems项
11141
10584
  if (((_this$value = this.value) === null || _this$value === void 0 ? void 0 : _this$value.length) < minItems) {
11142
10585
  var data = Schema.getSchemaDefaultValue(this.schema.items);
@@ -11178,16 +10621,23 @@ var KeyValueArrayWidget = Vue.extend({
11178
10621
  cursor: this.disabled ? 'not-allowed' : 'pointer',
11179
10622
  display: 'inline-block'
11180
10623
  };
10624
+ var theadStyle = {
10625
+ display: this.showTableHead ? '' : 'none'
10626
+ };
10627
+ var thStyle = {
10628
+ fontSize: '14px',
10629
+ textAlign: 'left',
10630
+ fontWeight: 'normal',
10631
+ color: '#63656E',
10632
+ paddingLeft: '10px',
10633
+ paddingRight: '10px'
10634
+ };
10635
+ var tdStyle = {
10636
+ paddingLeft: '10px',
10637
+ paddingRight: '10px'
10638
+ };
11181
10639
  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;
11182
10640
  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']);
11183
- // props为空时,表示只有一个项
11184
- var keysLen = Object.keys(properties || {}).length;
11185
- var defaultCols = properties ? new Array(keysLen).fill('1fr').concat('20px').join(' ') : '1fr 20px';
11186
- var defaultContainerLayout = _objectSpread2({}, this.layout.container || {
11187
- display: 'grid',
11188
- gridGap: '20px',
11189
- 'grid-template-columns': defaultCols // 默认配置
11190
- });
11191
10641
  var self = this;
11192
10642
  var dealSchema = function dealSchema(schema) {
11193
10643
  return (
@@ -11223,6 +10673,11 @@ var KeyValueArrayWidget = Vue.extend({
11223
10673
  on: {
11224
10674
  input: function input(data) {
11225
10675
  self.handleInput(data);
10676
+ },
10677
+ 'state-change': function stateChange(_ref2) {
10678
+ var path = _ref2.path,
10679
+ state = _ref2.state;
10680
+ _this.$set(_this.columns, path, state);
11226
10681
  }
11227
10682
  },
11228
10683
  style: {
@@ -11230,37 +10685,57 @@ var KeyValueArrayWidget = Vue.extend({
11230
10685
  }
11231
10686
  });
11232
10687
  };
11233
- return h("div", [(_this$value2 = this.value) === null || _this$value2 === void 0 ? void 0 : _this$value2.map(function (_, index) {
11234
- var _this$schema4;
10688
+ return h("table", [h("thead", {
10689
+ "style": theadStyle
10690
+ }, [h("tr", [props === null || props === void 0 ? void 0 : props.map(function (prop, i) {
10691
+ var _this$schema3, _this$schema3$items, _this$columns$path;
10692
+ 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[prop];
10693
+ var path = Path.getCurPath(_this.path, "0.".concat(prop));
10694
+ return h("th", {
10695
+ "style": _objectSpread2(_objectSpread2({}, thStyle), {}, {
10696
+ paddingLeft: i > 0 ? '10px' : '0px',
10697
+ display: ((_this$columns$path = _this.columns[path]) === null || _this$columns$path === void 0 ? void 0 : _this$columns$path.visible) === false ? 'none' : ''
10698
+ })
10699
+ }, [schemaItem === null || schemaItem === void 0 ? void 0 : schemaItem.title]);
10700
+ }), h("th")])]), h("tbody", [(_this$value2 = this.value) === null || _this$value2 === void 0 ? void 0 : _this$value2.map(function (_, index) {
10701
+ var _this$schema5;
11235
10702
  var groupPath = Path.getCurPath(_this.path, "".concat(index));
11236
- return h(FieldGroupWrap, helper([{}, {
10703
+ return h(CommonGroupWrap, helper([{}, {
11237
10704
  "props": _objectSpread2(_objectSpread2({}, _this.$props), {}, {
11238
10705
  path: groupPath,
11239
10706
  value: Path.getPathVal(_this.rootData, groupPath),
11240
10707
  schema: _this.schema.items,
11241
- layout: _objectSpread2(_objectSpread2({}, _this.layout), {}, {
11242
- container: _objectSpread2({}, defaultContainerLayout)
11243
- })
10708
+ tag: 'tr',
10709
+ layout: _objectSpread2({}, _this.layout)
11244
10710
  })
11245
- }]), [props !== null && props !== void 0 && props.length ? props.map(function (prop) {
11246
- var _this$schema3, _this$schema3$items;
11247
- 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[prop];
10711
+ }]), [props !== null && props !== void 0 && props.length ? props.map(function (prop, i) {
10712
+ var _this$schema4, _this$schema4$items, _this$columns$curPath;
10713
+ 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];
11248
10714
  var curPath = Path.getCurPath(_this.path, "".concat(index, ".").concat(prop));
11249
10715
  var lastProp = curPath.split('.').pop();
11250
10716
  var layoutConfig = Layout.findLayoutByProp(lastProp, _this.layout.group || []) || {};
11251
- return renderSchemaField({
10717
+ return h("td", {
10718
+ "style": _objectSpread2(_objectSpread2({}, tdStyle), {}, {
10719
+ paddingLeft: i > 0 ? '10px' : '0px',
10720
+ display: ((_this$columns$curPath = _this.columns[curPath]) === null || _this$columns$curPath === void 0 ? void 0 : _this$columns$curPath.visible) === false ? 'none' : ''
10721
+ })
10722
+ }, [renderSchemaField({
11252
10723
  path: curPath,
11253
10724
  schema: dealSchema(schemaItem),
11254
10725
  layout: layoutConfig,
11255
10726
  required: Schema.isRequired(schemaItem, prop)
11256
- });
11257
- }) : renderSchemaField({
10727
+ })]);
10728
+ }) : h("td", [renderSchemaField({
11258
10729
  path: Path.getCurPath(_this.path, index),
11259
- schema: dealSchema(((_this$schema4 = _this.schema) === null || _this$schema4 === void 0 ? void 0 : _this$schema4.items) || {}),
10730
+ schema: dealSchema(((_this$schema5 = _this.schema) === null || _this$schema5 === void 0 ? void 0 : _this$schema5.items) || {}),
11260
10731
  layout: {},
11261
10732
  required: false
11262
- }), h("span", {
11263
- "style": labelBtnStyle,
10733
+ })]), h("td", {
10734
+ "style": _objectSpread2({}, tdStyle)
10735
+ }, [h("span", {
10736
+ "style": _objectSpread2(_objectSpread2({}, labelBtnStyle), {}, {
10737
+ marginBottom: '10px'
10738
+ }),
11264
10739
  "on": {
11265
10740
  "click": function click() {
11266
10741
  return _this.handleRemoveItem(index);
@@ -11268,7 +10743,7 @@ var KeyValueArrayWidget = Vue.extend({
11268
10743
  }
11269
10744
  }, [h("i", {
11270
10745
  "class": "bk-icon icon-minus-line"
11271
- })])]);
10746
+ })])])]);
11272
10747
  }), h("span", {
11273
10748
  "on": {
11274
10749
  "click": this.handleAddItem
@@ -11276,7 +10751,7 @@ var KeyValueArrayWidget = Vue.extend({
11276
10751
  "style": labelBtnStyle
11277
10752
  }, [h("i", {
11278
10753
  "class": "bk-icon icon-plus-line"
11279
- })])]);
10754
+ })])])]);
11280
10755
  }
11281
10756
  });
11282
10757
 
@@ -11576,7 +11051,7 @@ var UploadWidget = Vue.extend({
11576
11051
  options.fileObj.xhr = xhr;
11577
11052
  var formData = new FormData();
11578
11053
  options.data.forEach(function (item) {
11579
- formData.append(item.name, executeExpression(item.value, _this.$parent.$parent));
11054
+ formData.append(item.name, _executeExpression(item.value, _this.$parent.$parent));
11580
11055
  });
11581
11056
  formData.append(options.fileName, options.fileObj.origin);
11582
11057
  xhr.onreadystatechange = function () {
@@ -11599,12 +11074,12 @@ var UploadWidget = Vue.extend({
11599
11074
  if (Array.isArray(options.header)) {
11600
11075
  options.header.forEach(function (head) {
11601
11076
  var headerKey = head.name;
11602
- var headerVal = executeExpression(head.value, _this.$parent.$parent);
11077
+ var headerVal = _executeExpression(head.value, _this.$parent.$parent);
11603
11078
  xhr.setRequestHeader(headerKey, headerVal);
11604
11079
  });
11605
11080
  } else {
11606
11081
  var headerKey = options.header.name;
11607
- var headerVal = executeExpression(options.header.value, this.$parent.$parent);
11082
+ var headerVal = _executeExpression(options.header.value, this.$parent.$parent);
11608
11083
  xhr.setRequestHeader(headerKey, headerVal);
11609
11084
  }
11610
11085
  }
@@ -11628,13 +11103,13 @@ var UploadWidget = Vue.extend({
11628
11103
  handleResCode: function handleResCode(res) {
11629
11104
  var successed = true;
11630
11105
  if (this.isUploadSuccessed) {
11631
- successed = executeExpression(this.isUploadSuccessed, this.$parent.$parent, [], {
11106
+ successed = _executeExpression(this.isUploadSuccessed, this.$parent.$parent, [], {
11632
11107
  response: res
11633
11108
  });
11634
11109
  }
11635
11110
  if (!successed) return;
11636
11111
  if (this.responseHandler) {
11637
- var files = executeExpression(this.responseHandler, this.$parent.$parent, [], {
11112
+ var files = _executeExpression(this.responseHandler, this.$parent.$parent, [], {
11638
11113
  response: res
11639
11114
  });
11640
11115
  this.$emit('input', files);
@@ -11972,7 +11447,7 @@ function createForm() {
11972
11447
  },
11973
11448
  methods: {
11974
11449
  initFormData: function initFormData() {
11975
- this.rootData = merge(Schema.getSchemaDefaultValue(createProxy(this.schema, this)) || {}, this.value);
11450
+ this.rootData = _merge(Schema.getSchemaDefaultValue(createProxy(this.schema, this)) || {}, this.value);
11976
11451
  this.emitFormValueChange(this.rootData, this.value);
11977
11452
  },
11978
11453
  emitFormValueChange: function emitFormValueChange(newValue, oldValue) {