@blueking/bkui-form 0.0.48 → 0.0.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -190,7 +190,7 @@
190
190
  i = _objectWithoutPropertiesLoose(e, t);
191
191
  if (Object.getOwnPropertySymbols) {
192
192
  var n = Object.getOwnPropertySymbols(e);
193
- for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
193
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
194
194
  }
195
195
  return i;
196
196
  }
@@ -198,7 +198,7 @@
198
198
  if (null == r) return {};
199
199
  var t = {};
200
200
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
201
- if (e.indexOf(n) >= 0) continue;
201
+ if (-1 !== e.indexOf(n)) continue;
202
202
  t[n] = r[n];
203
203
  }
204
204
  return t;
@@ -592,11 +592,11 @@
592
592
  }
593
593
  return _typeof(value);
594
594
  };
595
- var merge = function merge(target, source) {
595
+ var _merge = function merge(target, source) {
596
596
  if (isObj(source)) {
597
597
  return Object.keys(source).reduce(function (pre, key) {
598
598
  var _target;
599
- pre[key] = merge(((_target = target) === null || _target === void 0 ? void 0 : _target[key]) || {}, source[key]);
599
+ pre[key] = _merge(((_target = target) === null || _target === void 0 ? void 0 : _target[key]) || {}, source[key]);
600
600
  return pre;
601
601
  }, JSON.parse(JSON.stringify(target)));
602
602
  }
@@ -604,7 +604,7 @@
604
604
  target = Array.isArray(target) ? target : [];
605
605
  return source.map(function (item, index) {
606
606
  if (target[index]) {
607
- return merge(target[index], item);
607
+ return _merge(target[index], item);
608
608
  }
609
609
  return item;
610
610
  });
@@ -1375,8 +1375,8 @@
1375
1375
  headers: {},
1376
1376
  cache: 'no-cache'
1377
1377
  };
1378
- var request = ( /*#__PURE__*/(function () {
1379
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
1378
+ var request = (/*#__PURE__*/function () {
1379
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
1380
1380
  var config,
1381
1381
  _mergeDeep,
1382
1382
  params,
@@ -1485,7 +1485,7 @@
1485
1485
  return function (_x) {
1486
1486
  return _ref.apply(this, arguments);
1487
1487
  };
1488
- })());
1488
+ }());
1489
1489
 
1490
1490
  var props$1 = {
1491
1491
  // 表单值
@@ -1722,7 +1722,7 @@
1722
1722
  }
1723
1723
  };
1724
1724
  };
1725
- var executeExpression = function executeExpression(expression, instance) {
1725
+ var _executeExpression = function executeExpression(expression, instance) {
1726
1726
  var $dep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
1727
1727
  var $args = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1728
1728
  var _getContext = getContext(instance),
@@ -1780,7 +1780,7 @@
1780
1780
  }
1781
1781
  if (isObj(expression)) {
1782
1782
  Object.keys(expression).forEach(function (key) {
1783
- expression[key] = executeExpression(expression[key], instance);
1783
+ expression[key] = _executeExpression(expression[key], instance);
1784
1784
  });
1785
1785
  return expression;
1786
1786
  }
@@ -1826,7 +1826,6 @@
1826
1826
  crtInstance = _ref.instance; // 当前组件实例,用来条件表达式判断
1827
1827
  var _ref2 = widgetTree.widgetMap[targetPath] || {},
1828
1828
  operateInstance = _ref2.instance; // 需要执行操作的组件实例,可能为其他组件也可能为当前组件
1829
- if (!crtInstance || !operateInstance) return;
1830
1829
  var fullfill = true;
1831
1830
  var deps = [];
1832
1831
  if (reaction.source) {
@@ -1836,33 +1835,39 @@
1836
1835
  deps.push(instance);
1837
1836
  });
1838
1837
  }
1839
- if (typeof reaction.if === 'string') {
1840
- fullfill = executeExpression(reaction.if, crtInstance, deps);
1838
+ if (typeof reaction.if === 'string' && crtInstance) {
1839
+ fullfill = _executeExpression(reaction.if, crtInstance, deps);
1841
1840
  }
1842
1841
  var operations = fullfill ? reaction.then : reaction.else;
1843
- executeOperations(operations, operateInstance, deps);
1842
+ operateInstance && executeOperations(operations, operateInstance, deps);
1844
1843
  };
1845
1844
  };
1845
+ /**
1846
+ * 执行操作
1847
+ * @param operations
1848
+ * @param instance
1849
+ * @param deps
1850
+ */
1846
1851
  var executeOperations = function executeOperations(operations, instance, deps) {
1847
1852
  if (operations) {
1848
1853
  if (operations.state) {
1849
1854
  Object.keys(operations.state).forEach(function (key) {
1850
1855
  var val = operations.state[key];
1851
1856
  if (typeof val === 'string' && /^{{.+}}$/.test(val.trim())) {
1852
- val = executeExpression(val, instance, deps);
1857
+ val = _executeExpression(val, instance, deps);
1853
1858
  }
1854
1859
  instance.setState(key, val);
1855
1860
  });
1856
1861
  }
1857
1862
  if (Array.isArray(operations.actions)) {
1858
1863
  operations.actions.forEach(function (item) {
1859
- executeExpression(item, instance, deps);
1864
+ _executeExpression(item, instance, deps);
1860
1865
  });
1861
1866
  }
1862
1867
  }
1863
1868
  };
1864
1869
  var parsePath = function parsePath(path, instance) {
1865
- return isExpression(path) ? executeExpression(path, instance) : path;
1870
+ return isExpression(path) ? _executeExpression(path, instance) : path;
1866
1871
  };
1867
1872
  var reactionRegister = function reactionRegister(path) {
1868
1873
  var reactions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
@@ -1915,8 +1920,6 @@
1915
1920
  }
1916
1921
  };
1917
1922
 
1918
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
1919
-
1920
1923
  function getDefaultExportFromCjs (x) {
1921
1924
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1922
1925
  }
@@ -1938,6 +1941,7 @@
1938
1941
  (function (exports) {
1939
1942
  Object.defineProperty(exports, "__esModule", { value: true });
1940
1943
  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;
1944
+ // eslint-disable-next-line @typescript-eslint/no-extraneous-class
1941
1945
  class _CodeOrName {
1942
1946
  }
1943
1947
  exports._CodeOrName = _CodeOrName;
@@ -3946,7 +3950,7 @@
3946
3950
  }
3947
3951
  subschema.extendSubschemaMode = extendSubschemaMode;
3948
3952
 
3949
- var resolve$1 = {};
3953
+ var resolve$2 = {};
3950
3954
 
3951
3955
  // do not edit .js files directly - edit src/index.jst
3952
3956
 
@@ -4087,10 +4091,10 @@
4087
4091
  return str.replace(/~/g, '~0').replace(/\//g, '~1');
4088
4092
  }
4089
4093
 
4090
- Object.defineProperty(resolve$1, "__esModule", { value: true });
4091
- resolve$1.getSchemaRefs = resolve$1.resolveUrl = resolve$1.normalizeId = resolve$1._getFullPath = resolve$1.getFullPath = resolve$1.inlineRef = void 0;
4094
+ Object.defineProperty(resolve$2, "__esModule", { value: true });
4095
+ resolve$2.getSchemaRefs = resolve$2.resolveUrl = resolve$2.normalizeId = resolve$2._getFullPath = resolve$2.getFullPath = resolve$2.inlineRef = void 0;
4092
4096
  const util_1$m = util;
4093
- const equal$2 = fastDeepEqual;
4097
+ const equal$3 = fastDeepEqual;
4094
4098
  const traverse = jsonSchemaTraverse.exports;
4095
4099
  // TODO refactor to use keyword definitions
4096
4100
  const SIMPLE_INLINED = new Set([
@@ -4120,7 +4124,7 @@
4120
4124
  return false;
4121
4125
  return countKeys(schema) <= limit;
4122
4126
  }
4123
- resolve$1.inlineRef = inlineRef;
4127
+ resolve$2.inlineRef = inlineRef;
4124
4128
  const REF_KEYWORDS = new Set([
4125
4129
  "$ref",
4126
4130
  "$recursiveRef",
@@ -4162,22 +4166,22 @@
4162
4166
  const p = resolver.parse(id);
4163
4167
  return _getFullPath(resolver, p);
4164
4168
  }
4165
- resolve$1.getFullPath = getFullPath;
4169
+ resolve$2.getFullPath = getFullPath;
4166
4170
  function _getFullPath(resolver, p) {
4167
4171
  const serialized = resolver.serialize(p);
4168
4172
  return serialized.split("#")[0] + "#";
4169
4173
  }
4170
- resolve$1._getFullPath = _getFullPath;
4174
+ resolve$2._getFullPath = _getFullPath;
4171
4175
  const TRAILING_SLASH_HASH = /#\/?$/;
4172
4176
  function normalizeId(id) {
4173
4177
  return id ? id.replace(TRAILING_SLASH_HASH, "") : "";
4174
4178
  }
4175
- resolve$1.normalizeId = normalizeId;
4179
+ resolve$2.normalizeId = normalizeId;
4176
4180
  function resolveUrl(resolver, baseId, id) {
4177
4181
  id = normalizeId(id);
4178
4182
  return resolver.resolve(baseId, id);
4179
4183
  }
4180
- resolve$1.resolveUrl = resolveUrl;
4184
+ resolve$2.resolveUrl = resolveUrl;
4181
4185
  const ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
4182
4186
  function getSchemaRefs(schema, baseId) {
4183
4187
  if (typeof schema == "boolean")
@@ -4232,14 +4236,14 @@
4232
4236
  });
4233
4237
  return localRefs;
4234
4238
  function checkAmbiguosRef(sch1, sch2, ref) {
4235
- if (sch2 !== undefined && !equal$2(sch1, sch2))
4239
+ if (sch2 !== undefined && !equal$3(sch1, sch2))
4236
4240
  throw ambiguos(ref);
4237
4241
  }
4238
4242
  function ambiguos(ref) {
4239
4243
  return new Error(`reference "${ref}" resolves to more than one schema`);
4240
4244
  }
4241
4245
  }
4242
- resolve$1.getSchemaRefs = getSchemaRefs;
4246
+ resolve$2.getSchemaRefs = getSchemaRefs;
4243
4247
 
4244
4248
  Object.defineProperty(validate$1, "__esModule", { value: true });
4245
4249
  validate$1.getData = validate$1.KeywordCxt = validate$1.validateFunctionCode = void 0;
@@ -4252,7 +4256,7 @@
4252
4256
  const subschema_1 = subschema;
4253
4257
  const codegen_1$n = codegen;
4254
4258
  const names_1$3 = names$1;
4255
- const resolve_1$2 = resolve$1;
4259
+ const resolve_1$2 = resolve$2;
4256
4260
  const util_1$l = util;
4257
4261
  const errors_1 = errors;
4258
4262
  // schema compilation - generates validation function, subschemaCode (below) is used for subschemas
@@ -4774,7 +4778,7 @@
4774
4778
  var ref_error = {};
4775
4779
 
4776
4780
  Object.defineProperty(ref_error, "__esModule", { value: true });
4777
- const resolve_1$1 = resolve$1;
4781
+ const resolve_1$1 = resolve$2;
4778
4782
  class MissingRefError extends Error {
4779
4783
  constructor(resolver, baseId, ref, msg) {
4780
4784
  super(msg || `can't resolve reference ${ref} from id ${baseId}`);
@@ -4791,7 +4795,7 @@
4791
4795
  const codegen_1$m = codegen;
4792
4796
  const validation_error_1 = validation_error;
4793
4797
  const names_1$2 = names$1;
4794
- const resolve_1 = resolve$1;
4798
+ const resolve_1 = resolve$2;
4795
4799
  const util_1$k = util;
4796
4800
  const validate_1$1 = validate$1;
4797
4801
  class SchemaEnv {
@@ -4917,7 +4921,7 @@
4917
4921
  const schOrFunc = root.refs[ref];
4918
4922
  if (schOrFunc)
4919
4923
  return schOrFunc;
4920
- let _sch = resolve.call(this, root, ref);
4924
+ let _sch = resolve$1.call(this, root, ref);
4921
4925
  if (_sch === undefined) {
4922
4926
  const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv
4923
4927
  const { schemaId } = this.opts;
@@ -4947,7 +4951,7 @@
4947
4951
  }
4948
4952
  // resolve and compile the references ($ref)
4949
4953
  // TODO returns AnySchemaObject (if the schema can be inlined) or validation function
4950
- function resolve(root, // information about the root schema for the current schema
4954
+ function resolve$1(root, // information about the root schema for the current schema
4951
4955
  ref // reference to resolve
4952
4956
  ) {
4953
4957
  let sch;
@@ -5058,1416 +5062,770 @@
5058
5062
 
5059
5063
  var uri$1 = {};
5060
5064
 
5061
- var uri_all = {exports: {}};
5062
-
5063
- /** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
5064
-
5065
- (function (module, exports) {
5066
- (function (global, factory) {
5067
- factory(exports) ;
5068
- }(commonjsGlobal, (function (exports) {
5069
- function merge() {
5070
- for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
5071
- sets[_key] = arguments[_key];
5072
- }
5073
-
5074
- if (sets.length > 1) {
5075
- sets[0] = sets[0].slice(0, -1);
5076
- var xl = sets.length - 1;
5077
- for (var x = 1; x < xl; ++x) {
5078
- sets[x] = sets[x].slice(1, -1);
5079
- }
5080
- sets[xl] = sets[xl].slice(1);
5081
- return sets.join('');
5082
- } else {
5083
- return sets[0];
5084
- }
5085
- }
5086
- function subexp(str) {
5087
- return "(?:" + str + ")";
5088
- }
5089
- function typeOf(o) {
5090
- return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase();
5091
- }
5092
- function toUpperCase(str) {
5093
- return str.toUpperCase();
5094
- }
5095
- function toArray(obj) {
5096
- 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) : [];
5097
- }
5098
- function assign(target, source) {
5099
- var obj = target;
5100
- if (source) {
5101
- for (var key in source) {
5102
- obj[key] = source[key];
5103
- }
5104
- }
5105
- return obj;
5106
- }
5107
-
5108
- function buildExps(isIRI) {
5109
- var ALPHA$$ = "[A-Za-z]",
5110
- DIGIT$$ = "[0-9]",
5111
- HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"),
5112
- PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)),
5113
- //expanded
5114
- GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
5115
- SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
5116
- RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
5117
- UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]",
5118
- //subset, excludes bidi control characters
5119
- IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",
5120
- //subset
5121
- UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$);
5122
- subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*");
5123
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*");
5124
- 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$$),
5125
- //relaxed parsing rules
5126
- IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
5127
- H16$ = subexp(HEXDIG$$ + "{1,4}"),
5128
- LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
5129
- IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$),
5130
- // 6( h16 ":" ) ls32
5131
- IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$),
5132
- // "::" 5( h16 ":" ) ls32
5133
- IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$),
5134
- //[ h16 ] "::" 4( h16 ":" ) ls32
5135
- IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$),
5136
- //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
5137
- IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$),
5138
- //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
5139
- IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$),
5140
- //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
5141
- IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$),
5142
- //[ *4( h16 ":" ) h16 ] "::" ls32
5143
- IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$),
5144
- //[ *5( h16 ":" ) h16 ] "::" h16
5145
- IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),
5146
- //[ *6( h16 ":" ) h16 ] "::"
5147
- IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
5148
- ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+");
5149
- //RFC 6874, with relaxed parsing rules
5150
- subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+");
5151
- //RFC 6874
5152
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*");
5153
- var PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"));
5154
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+");
5155
- subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*");
5156
- return {
5157
- NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
5158
- NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5159
- NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5160
- NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5161
- NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5162
- NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
5163
- NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
5164
- ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
5165
- UNRESERVED: new RegExp(UNRESERVED$$, "g"),
5166
- OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
5167
- PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
5168
- IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
5169
- IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
5170
- };
5065
+ var fastUri$1 = {exports: {}};
5066
+
5067
+ const HEX$1 = {
5068
+ 0: 0,
5069
+ 1: 1,
5070
+ 2: 2,
5071
+ 3: 3,
5072
+ 4: 4,
5073
+ 5: 5,
5074
+ 6: 6,
5075
+ 7: 7,
5076
+ 8: 8,
5077
+ 9: 9,
5078
+ a: 10,
5079
+ A: 10,
5080
+ b: 11,
5081
+ B: 11,
5082
+ c: 12,
5083
+ C: 12,
5084
+ d: 13,
5085
+ D: 13,
5086
+ e: 14,
5087
+ E: 14,
5088
+ f: 15,
5089
+ F: 15
5090
+ };
5091
+
5092
+ var scopedChars = {
5093
+ HEX: HEX$1
5094
+ };
5095
+
5096
+ const { HEX } = scopedChars;
5097
+
5098
+ 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;
5099
+
5100
+ function normalizeIPv4$1 (host) {
5101
+ if (findToken(host, '.') < 3) { return { host, isIPV4: false } }
5102
+ const matches = host.match(IPV4_REG) || [];
5103
+ const [address] = matches;
5104
+ if (address) {
5105
+ return { host: stripLeadingZeros(address, '.'), isIPV4: true }
5106
+ } else {
5107
+ return { host, isIPV4: false }
5108
+ }
5171
5109
  }
5172
- var URI_PROTOCOL = buildExps(false);
5173
-
5174
- var IRI_PROTOCOL = buildExps(true);
5175
-
5176
- var slicedToArray = function () {
5177
- function sliceIterator(arr, i) {
5178
- var _arr = [];
5179
- var _n = true;
5180
- var _d = false;
5181
- var _e = undefined;
5182
5110
 
5183
- try {
5184
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
5185
- _arr.push(_s.value);
5111
+ /**
5112
+ * @param {string[]} input
5113
+ * @param {boolean} [keepZero=false]
5114
+ * @returns {string|undefined}
5115
+ */
5116
+ function stringArrayToHexStripped (input, keepZero = false) {
5117
+ let acc = '';
5118
+ let strip = true;
5119
+ for (const c of input) {
5120
+ if (HEX[c] === undefined) return undefined
5121
+ if (c !== '0' && strip === true) strip = false;
5122
+ if (!strip) acc += c;
5123
+ }
5124
+ if (keepZero && acc.length === 0) acc = '0';
5125
+ return acc
5126
+ }
5127
+
5128
+ function getIPV6 (input) {
5129
+ let tokenCount = 0;
5130
+ const output = { error: false, address: '', zone: '' };
5131
+ const address = [];
5132
+ const buffer = [];
5133
+ let isZone = false;
5134
+ let endipv6Encountered = false;
5135
+ let endIpv6 = false;
5136
+
5137
+ function consume () {
5138
+ if (buffer.length) {
5139
+ if (isZone === false) {
5140
+ const hex = stringArrayToHexStripped(buffer);
5141
+ if (hex !== undefined) {
5142
+ address.push(hex);
5143
+ } else {
5144
+ output.error = true;
5145
+ return false
5146
+ }
5147
+ }
5148
+ buffer.length = 0;
5149
+ }
5150
+ return true
5151
+ }
5186
5152
 
5187
- if (i && _arr.length === i) break;
5153
+ for (let i = 0; i < input.length; i++) {
5154
+ const cursor = input[i];
5155
+ if (cursor === '[' || cursor === ']') { continue }
5156
+ if (cursor === ':') {
5157
+ if (endipv6Encountered === true) {
5158
+ endIpv6 = true;
5188
5159
  }
5189
- } catch (err) {
5190
- _d = true;
5191
- _e = err;
5192
- } finally {
5193
- try {
5194
- if (!_n && _i["return"]) _i["return"]();
5195
- } finally {
5196
- if (_d) throw _e;
5160
+ if (!consume()) { break }
5161
+ tokenCount++;
5162
+ address.push(':');
5163
+ if (tokenCount > 7) {
5164
+ // not valid
5165
+ output.error = true;
5166
+ break
5197
5167
  }
5168
+ if (i - 1 >= 0 && input[i - 1] === ':') {
5169
+ endipv6Encountered = true;
5170
+ }
5171
+ continue
5172
+ } else if (cursor === '%') {
5173
+ if (!consume()) { break }
5174
+ // switch to zone detection
5175
+ isZone = true;
5176
+ } else {
5177
+ buffer.push(cursor);
5178
+ continue
5198
5179
  }
5199
-
5200
- return _arr;
5201
5180
  }
5202
-
5203
- return function (arr, i) {
5204
- if (Array.isArray(arr)) {
5205
- return arr;
5206
- } else if (Symbol.iterator in Object(arr)) {
5207
- return sliceIterator(arr, i);
5181
+ if (buffer.length) {
5182
+ if (isZone) {
5183
+ output.zone = buffer.join('');
5184
+ } else if (endIpv6) {
5185
+ address.push(buffer.join(''));
5208
5186
  } else {
5209
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
5187
+ address.push(stringArrayToHexStripped(buffer));
5210
5188
  }
5211
- };
5212
- }();
5213
-
5214
-
5215
-
5216
-
5217
-
5218
-
5219
-
5220
-
5221
-
5222
-
5223
-
5224
-
5189
+ }
5190
+ output.address = address.join('');
5191
+ return output
5192
+ }
5225
5193
 
5226
- var toConsumableArray = function (arr) {
5227
- if (Array.isArray(arr)) {
5228
- for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
5194
+ function normalizeIPv6$1 (host) {
5195
+ if (findToken(host, ':') < 2) { return { host, isIPV6: false } }
5196
+ const ipv6 = getIPV6(host);
5229
5197
 
5230
- return arr2;
5198
+ if (!ipv6.error) {
5199
+ let newHost = ipv6.address;
5200
+ let escapedHost = ipv6.address;
5201
+ if (ipv6.zone) {
5202
+ newHost += '%' + ipv6.zone;
5203
+ escapedHost += '%25' + ipv6.zone;
5204
+ }
5205
+ return { host: newHost, escapedHost, isIPV6: true }
5231
5206
  } else {
5232
- return Array.from(arr);
5207
+ return { host, isIPV6: false }
5233
5208
  }
5234
- };
5235
-
5236
- /** Highest positive signed 32-bit float value */
5237
-
5238
- var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
5239
-
5240
- /** Bootstring parameters */
5241
- var base = 36;
5242
- var tMin = 1;
5243
- var tMax = 26;
5244
- var skew = 38;
5245
- var damp = 700;
5246
- var initialBias = 72;
5247
- var initialN = 128; // 0x80
5248
- var delimiter = '-'; // '\x2D'
5249
-
5250
- /** Regular expressions */
5251
- var regexPunycode = /^xn--/;
5252
- var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars
5253
- var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
5254
-
5255
- /** Error messages */
5256
- var errors = {
5257
- 'overflow': 'Overflow: input needs wider integers to process',
5258
- 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
5259
- 'invalid-input': 'Invalid input'
5260
- };
5261
-
5262
- /** Convenience shortcuts */
5263
- var baseMinusTMin = base - tMin;
5264
- var floor = Math.floor;
5265
- var stringFromCharCode = String.fromCharCode;
5266
-
5267
- /*--------------------------------------------------------------------------*/
5268
-
5269
- /**
5270
- * A generic error utility function.
5271
- * @private
5272
- * @param {String} type The error type.
5273
- * @returns {Error} Throws a `RangeError` with the applicable error message.
5274
- */
5275
- function error$1(type) {
5276
- throw new RangeError(errors[type]);
5277
5209
  }
5278
5210
 
5279
- /**
5280
- * A generic `Array#map` utility function.
5281
- * @private
5282
- * @param {Array} array The array to iterate over.
5283
- * @param {Function} callback The function that gets called for every array
5284
- * item.
5285
- * @returns {Array} A new array of values returned by the callback function.
5286
- */
5287
- function map(array, fn) {
5288
- var result = [];
5289
- var length = array.length;
5290
- while (length--) {
5291
- result[length] = fn(array[length]);
5292
- }
5293
- return result;
5211
+ function stripLeadingZeros (str, token) {
5212
+ let out = '';
5213
+ let skip = true;
5214
+ const l = str.length;
5215
+ for (let i = 0; i < l; i++) {
5216
+ const c = str[i];
5217
+ if (c === '0' && skip) {
5218
+ if ((i + 1 <= l && str[i + 1] === token) || i + 1 === l) {
5219
+ out += c;
5220
+ skip = false;
5221
+ }
5222
+ } else {
5223
+ if (c === token) {
5224
+ skip = true;
5225
+ } else {
5226
+ skip = false;
5227
+ }
5228
+ out += c;
5229
+ }
5230
+ }
5231
+ return out
5294
5232
  }
5295
5233
 
5296
- /**
5297
- * A simple `Array#map`-like wrapper to work with domain name strings or email
5298
- * addresses.
5299
- * @private
5300
- * @param {String} domain The domain name or email address.
5301
- * @param {Function} callback The function that gets called for every
5302
- * character.
5303
- * @returns {Array} A new string of characters returned by the callback
5304
- * function.
5305
- */
5306
- function mapDomain(string, fn) {
5307
- var parts = string.split('@');
5308
- var result = '';
5309
- if (parts.length > 1) {
5310
- // In email addresses, only the domain name should be punycoded. Leave
5311
- // the local part (i.e. everything up to `@`) intact.
5312
- result = parts[0] + '@';
5313
- string = parts[1];
5314
- }
5315
- // Avoid `split(regex)` for IE8 compatibility. See #17.
5316
- string = string.replace(regexSeparators, '\x2E');
5317
- var labels = string.split('.');
5318
- var encoded = map(labels, fn).join('.');
5319
- return result + encoded;
5234
+ function findToken (str, token) {
5235
+ let ind = 0;
5236
+ for (let i = 0; i < str.length; i++) {
5237
+ if (str[i] === token) ind++;
5238
+ }
5239
+ return ind
5240
+ }
5241
+
5242
+ const RDS1 = /^\.\.?\//u;
5243
+ const RDS2 = /^\/\.(?:\/|$)/u;
5244
+ const RDS3 = /^\/\.\.(?:\/|$)/u;
5245
+ const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/u;
5246
+
5247
+ function removeDotSegments$1 (input) {
5248
+ const output = [];
5249
+
5250
+ while (input.length) {
5251
+ if (input.match(RDS1)) {
5252
+ input = input.replace(RDS1, '');
5253
+ } else if (input.match(RDS2)) {
5254
+ input = input.replace(RDS2, '/');
5255
+ } else if (input.match(RDS3)) {
5256
+ input = input.replace(RDS3, '/');
5257
+ output.pop();
5258
+ } else if (input === '.' || input === '..') {
5259
+ input = '';
5260
+ } else {
5261
+ const im = input.match(RDS5);
5262
+ if (im) {
5263
+ const s = im[0];
5264
+ input = input.slice(s.length);
5265
+ output.push(s);
5266
+ } else {
5267
+ throw new Error('Unexpected dot segment condition')
5268
+ }
5269
+ }
5270
+ }
5271
+ return output.join('')
5320
5272
  }
5321
5273
 
5322
- /**
5323
- * Creates an array containing the numeric code points of each Unicode
5324
- * character in the string. While JavaScript uses UCS-2 internally,
5325
- * this function will convert a pair of surrogate halves (each of which
5326
- * UCS-2 exposes as separate characters) into a single code point,
5327
- * matching UTF-16.
5328
- * @see `punycode.ucs2.encode`
5329
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
5330
- * @memberOf punycode.ucs2
5331
- * @name decode
5332
- * @param {String} string The Unicode input string (UCS-2).
5333
- * @returns {Array} The new array of code points.
5334
- */
5335
- function ucs2decode(string) {
5336
- var output = [];
5337
- var counter = 0;
5338
- var length = string.length;
5339
- while (counter < length) {
5340
- var value = string.charCodeAt(counter++);
5341
- if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
5342
- // It's a high surrogate, and there is a next character.
5343
- var extra = string.charCodeAt(counter++);
5344
- if ((extra & 0xFC00) == 0xDC00) {
5345
- // Low surrogate.
5346
- output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
5347
- } else {
5348
- // It's an unmatched surrogate; only append this code unit, in case the
5349
- // next code unit is the high surrogate of a surrogate pair.
5350
- output.push(value);
5351
- counter--;
5352
- }
5353
- } else {
5354
- output.push(value);
5355
- }
5356
- }
5357
- return output;
5274
+ function normalizeComponentEncoding$1 (components, esc) {
5275
+ const func = esc !== true ? escape : unescape;
5276
+ if (components.scheme !== undefined) {
5277
+ components.scheme = func(components.scheme);
5278
+ }
5279
+ if (components.userinfo !== undefined) {
5280
+ components.userinfo = func(components.userinfo);
5281
+ }
5282
+ if (components.host !== undefined) {
5283
+ components.host = func(components.host);
5284
+ }
5285
+ if (components.path !== undefined) {
5286
+ components.path = func(components.path);
5287
+ }
5288
+ if (components.query !== undefined) {
5289
+ components.query = func(components.query);
5290
+ }
5291
+ if (components.fragment !== undefined) {
5292
+ components.fragment = func(components.fragment);
5293
+ }
5294
+ return components
5358
5295
  }
5359
5296
 
5360
- /**
5361
- * Creates a string based on an array of numeric code points.
5362
- * @see `punycode.ucs2.decode`
5363
- * @memberOf punycode.ucs2
5364
- * @name encode
5365
- * @param {Array} codePoints The array of numeric code points.
5366
- * @returns {String} The new Unicode string (UCS-2).
5367
- */
5368
- var ucs2encode = function ucs2encode(array) {
5369
- return String.fromCodePoint.apply(String, toConsumableArray(array));
5370
- };
5371
-
5372
- /**
5373
- * Converts a basic code point into a digit/integer.
5374
- * @see `digitToBasic()`
5375
- * @private
5376
- * @param {Number} codePoint The basic numeric code point value.
5377
- * @returns {Number} The numeric value of a basic code point (for use in
5378
- * representing integers) in the range `0` to `base - 1`, or `base` if
5379
- * the code point does not represent a value.
5380
- */
5381
- var basicToDigit = function basicToDigit(codePoint) {
5382
- if (codePoint - 0x30 < 0x0A) {
5383
- return codePoint - 0x16;
5384
- }
5385
- if (codePoint - 0x41 < 0x1A) {
5386
- return codePoint - 0x41;
5387
- }
5388
- if (codePoint - 0x61 < 0x1A) {
5389
- return codePoint - 0x61;
5390
- }
5391
- return base;
5392
- };
5393
-
5394
- /**
5395
- * Converts a digit/integer into a basic code point.
5396
- * @see `basicToDigit()`
5397
- * @private
5398
- * @param {Number} digit The numeric value of a basic code point.
5399
- * @returns {Number} The basic code point whose value (when used for
5400
- * representing integers) is `digit`, which needs to be in the range
5401
- * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
5402
- * used; else, the lowercase form is used. The behavior is undefined
5403
- * if `flag` is non-zero and `digit` has no uppercase form.
5404
- */
5405
- var digitToBasic = function digitToBasic(digit, flag) {
5406
- // 0..25 map to ASCII a..z or A..Z
5407
- // 26..35 map to ASCII 0..9
5408
- return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
5409
- };
5410
-
5411
- /**
5412
- * Bias adaptation function as per section 3.4 of RFC 3492.
5413
- * https://tools.ietf.org/html/rfc3492#section-3.4
5414
- * @private
5415
- */
5416
- var adapt = function adapt(delta, numPoints, firstTime) {
5417
- var k = 0;
5418
- delta = firstTime ? floor(delta / damp) : delta >> 1;
5419
- delta += floor(delta / numPoints);
5420
- for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {
5421
- delta = floor(delta / baseMinusTMin);
5422
- }
5423
- return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
5424
- };
5297
+ function recomposeAuthority$1 (components) {
5298
+ const uriTokens = [];
5425
5299
 
5426
- /**
5427
- * Converts a Punycode string of ASCII-only symbols to a string of Unicode
5428
- * symbols.
5429
- * @memberOf punycode
5430
- * @param {String} input The Punycode string of ASCII-only symbols.
5431
- * @returns {String} The resulting string of Unicode symbols.
5432
- */
5433
- var decode = function decode(input) {
5434
- // Don't use UCS-2.
5435
- var output = [];
5436
- var inputLength = input.length;
5437
- var i = 0;
5438
- var n = initialN;
5439
- var bias = initialBias;
5440
-
5441
- // Handle the basic code points: let `basic` be the number of input code
5442
- // points before the last delimiter, or `0` if there is none, then copy
5443
- // the first basic code points to the output.
5444
-
5445
- var basic = input.lastIndexOf(delimiter);
5446
- if (basic < 0) {
5447
- basic = 0;
5448
- }
5449
-
5450
- for (var j = 0; j < basic; ++j) {
5451
- // if it's not a basic code point
5452
- if (input.charCodeAt(j) >= 0x80) {
5453
- error$1('not-basic');
5454
- }
5455
- output.push(input.charCodeAt(j));
5456
- }
5457
-
5458
- // Main decoding loop: start just after the last delimiter if any basic code
5459
- // points were copied; start at the beginning otherwise.
5300
+ if (components.userinfo !== undefined) {
5301
+ uriTokens.push(components.userinfo);
5302
+ uriTokens.push('@');
5303
+ }
5460
5304
 
5461
- for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{
5305
+ if (components.host !== undefined) {
5306
+ let host = unescape(components.host);
5307
+ const ipV4res = normalizeIPv4$1(host);
5462
5308
 
5463
- // `index` is the index of the next character to be consumed.
5464
- // Decode a generalized variable-length integer into `delta`,
5465
- // which gets added to `i`. The overflow checking is easier
5466
- // if we increase `i` as we go, then subtract off its starting
5467
- // value at the end to obtain `delta`.
5468
- var oldi = i;
5469
- for (var w = 1, k = base;; /* no condition */k += base) {
5309
+ if (ipV4res.isIPV4) {
5310
+ host = ipV4res.host;
5311
+ } else {
5312
+ const ipV6res = normalizeIPv6$1(ipV4res.host);
5313
+ if (ipV6res.isIPV6 === true) {
5314
+ host = `[${ipV6res.escapedHost}]`;
5315
+ } else {
5316
+ host = components.host;
5317
+ }
5318
+ }
5319
+ uriTokens.push(host);
5320
+ }
5470
5321
 
5471
- if (index >= inputLength) {
5472
- error$1('invalid-input');
5473
- }
5322
+ if (typeof components.port === 'number' || typeof components.port === 'string') {
5323
+ uriTokens.push(':');
5324
+ uriTokens.push(String(components.port));
5325
+ }
5474
5326
 
5475
- var digit = basicToDigit(input.charCodeAt(index++));
5327
+ return uriTokens.length ? uriTokens.join('') : undefined
5328
+ }
5329
+ var utils = {
5330
+ recomposeAuthority: recomposeAuthority$1,
5331
+ normalizeComponentEncoding: normalizeComponentEncoding$1,
5332
+ removeDotSegments: removeDotSegments$1,
5333
+ normalizeIPv4: normalizeIPv4$1,
5334
+ normalizeIPv6: normalizeIPv6$1,
5335
+ stringArrayToHexStripped
5336
+ };
5476
5337
 
5477
- if (digit >= base || digit > floor((maxInt - i) / w)) {
5478
- error$1('overflow');
5479
- }
5338
+ const UUID_REG = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu;
5339
+ const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
5480
5340
 
5481
- i += digit * w;
5482
- var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
5341
+ function isSecure (wsComponents) {
5342
+ return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === 'wss'
5343
+ }
5483
5344
 
5484
- if (digit < t) {
5485
- break;
5486
- }
5345
+ function httpParse (components) {
5346
+ if (!components.host) {
5347
+ components.error = components.error || 'HTTP URIs must have a host.';
5348
+ }
5487
5349
 
5488
- var baseMinusT = base - t;
5489
- if (w > floor(maxInt / baseMinusT)) {
5490
- error$1('overflow');
5491
- }
5350
+ return components
5351
+ }
5492
5352
 
5493
- w *= baseMinusT;
5494
- }
5353
+ function httpSerialize (components) {
5354
+ const secure = String(components.scheme).toLowerCase() === 'https';
5495
5355
 
5496
- var out = output.length + 1;
5497
- bias = adapt(i - oldi, out, oldi == 0);
5356
+ // normalize the default port
5357
+ if (components.port === (secure ? 443 : 80) || components.port === '') {
5358
+ components.port = undefined;
5359
+ }
5498
5360
 
5499
- // `i` was supposed to wrap around from `out` to `0`,
5500
- // incrementing `n` each time, so we'll fix that now:
5501
- if (floor(i / out) > maxInt - n) {
5502
- error$1('overflow');
5503
- }
5361
+ // normalize the empty path
5362
+ if (!components.path) {
5363
+ components.path = '/';
5364
+ }
5504
5365
 
5505
- n += floor(i / out);
5506
- i %= out;
5366
+ // NOTE: We do not parse query strings for HTTP URIs
5367
+ // as WWW Form Url Encoded query strings are part of the HTML4+ spec,
5368
+ // and not the HTTP spec.
5507
5369
 
5508
- // Insert `n` at position `i` of the output.
5509
- output.splice(i++, 0, n);
5510
- }
5370
+ return components
5371
+ }
5511
5372
 
5512
- return String.fromCodePoint.apply(String, output);
5513
- };
5373
+ function wsParse (wsComponents) {
5374
+ // indicate if the secure flag is set
5375
+ wsComponents.secure = isSecure(wsComponents);
5514
5376
 
5515
- /**
5516
- * Converts a string of Unicode symbols (e.g. a domain name label) to a
5517
- * Punycode string of ASCII-only symbols.
5518
- * @memberOf punycode
5519
- * @param {String} input The string of Unicode symbols.
5520
- * @returns {String} The resulting Punycode string of ASCII-only symbols.
5521
- */
5522
- var encode = function encode(input) {
5523
- var output = [];
5377
+ // construct resouce name
5378
+ wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
5379
+ wsComponents.path = undefined;
5380
+ wsComponents.query = undefined;
5524
5381
 
5525
- // Convert the input in UCS-2 to an array of Unicode code points.
5526
- input = ucs2decode(input);
5382
+ return wsComponents
5383
+ }
5527
5384
 
5528
- // Cache the length.
5529
- var inputLength = input.length;
5385
+ function wsSerialize (wsComponents) {
5386
+ // normalize the default port
5387
+ if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === '') {
5388
+ wsComponents.port = undefined;
5389
+ }
5530
5390
 
5531
- // Initialize the state.
5532
- var n = initialN;
5533
- var delta = 0;
5534
- var bias = initialBias;
5391
+ // ensure scheme matches secure flag
5392
+ if (typeof wsComponents.secure === 'boolean') {
5393
+ wsComponents.scheme = (wsComponents.secure ? 'wss' : 'ws');
5394
+ wsComponents.secure = undefined;
5395
+ }
5535
5396
 
5536
- // Handle the basic code points.
5537
- var _iteratorNormalCompletion = true;
5538
- var _didIteratorError = false;
5539
- var _iteratorError = undefined;
5397
+ // reconstruct path from resource name
5398
+ if (wsComponents.resourceName) {
5399
+ const [path, query] = wsComponents.resourceName.split('?');
5400
+ wsComponents.path = (path && path !== '/' ? path : undefined);
5401
+ wsComponents.query = query;
5402
+ wsComponents.resourceName = undefined;
5403
+ }
5540
5404
 
5541
- try {
5542
- for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
5543
- var _currentValue2 = _step.value;
5405
+ // forbid fragment component
5406
+ wsComponents.fragment = undefined;
5544
5407
 
5545
- if (_currentValue2 < 0x80) {
5546
- output.push(stringFromCharCode(_currentValue2));
5547
- }
5548
- }
5549
- } catch (err) {
5550
- _didIteratorError = true;
5551
- _iteratorError = err;
5552
- } finally {
5553
- try {
5554
- if (!_iteratorNormalCompletion && _iterator.return) {
5555
- _iterator.return();
5556
- }
5557
- } finally {
5558
- if (_didIteratorError) {
5559
- throw _iteratorError;
5560
- }
5561
- }
5562
- }
5408
+ return wsComponents
5409
+ }
5563
5410
 
5564
- var basicLength = output.length;
5565
- var handledCPCount = basicLength;
5411
+ function urnParse (urnComponents, options) {
5412
+ if (!urnComponents.path) {
5413
+ urnComponents.error = 'URN can not be parsed';
5414
+ return urnComponents
5415
+ }
5416
+ const matches = urnComponents.path.match(URN_REG);
5417
+ if (matches) {
5418
+ const scheme = options.scheme || urnComponents.scheme || 'urn';
5419
+ urnComponents.nid = matches[1].toLowerCase();
5420
+ urnComponents.nss = matches[2];
5421
+ const urnScheme = `${scheme}:${options.nid || urnComponents.nid}`;
5422
+ const schemeHandler = SCHEMES$1[urnScheme];
5423
+ urnComponents.path = undefined;
5424
+
5425
+ if (schemeHandler) {
5426
+ urnComponents = schemeHandler.parse(urnComponents, options);
5427
+ }
5428
+ } else {
5429
+ urnComponents.error = urnComponents.error || 'URN can not be parsed.';
5430
+ }
5566
5431
 
5567
- // `handledCPCount` is the number of code points that have been handled;
5568
- // `basicLength` is the number of basic code points.
5432
+ return urnComponents
5433
+ }
5569
5434
 
5570
- // Finish the basic string with a delimiter unless it's empty.
5571
- if (basicLength) {
5572
- output.push(delimiter);
5573
- }
5435
+ function urnSerialize (urnComponents, options) {
5436
+ const scheme = options.scheme || urnComponents.scheme || 'urn';
5437
+ const nid = urnComponents.nid.toLowerCase();
5438
+ const urnScheme = `${scheme}:${options.nid || nid}`;
5439
+ const schemeHandler = SCHEMES$1[urnScheme];
5574
5440
 
5575
- // Main encoding loop:
5576
- while (handledCPCount < inputLength) {
5441
+ if (schemeHandler) {
5442
+ urnComponents = schemeHandler.serialize(urnComponents, options);
5443
+ }
5577
5444
 
5578
- // All non-basic code points < n have been handled already. Find the next
5579
- // larger one:
5580
- var m = maxInt;
5581
- var _iteratorNormalCompletion2 = true;
5582
- var _didIteratorError2 = false;
5583
- var _iteratorError2 = undefined;
5445
+ const uriComponents = urnComponents;
5446
+ const nss = urnComponents.nss;
5447
+ uriComponents.path = `${nid || options.nid}:${nss}`;
5584
5448
 
5585
- try {
5586
- for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
5587
- var currentValue = _step2.value;
5449
+ options.skipEscape = true;
5450
+ return uriComponents
5451
+ }
5588
5452
 
5589
- if (currentValue >= n && currentValue < m) {
5590
- m = currentValue;
5591
- }
5592
- }
5453
+ function urnuuidParse (urnComponents, options) {
5454
+ const uuidComponents = urnComponents;
5455
+ uuidComponents.uuid = uuidComponents.nss;
5456
+ uuidComponents.nss = undefined;
5593
5457
 
5594
- // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
5595
- // but guard against overflow.
5596
- } catch (err) {
5597
- _didIteratorError2 = true;
5598
- _iteratorError2 = err;
5599
- } finally {
5600
- try {
5601
- if (!_iteratorNormalCompletion2 && _iterator2.return) {
5602
- _iterator2.return();
5603
- }
5604
- } finally {
5605
- if (_didIteratorError2) {
5606
- throw _iteratorError2;
5607
- }
5608
- }
5609
- }
5458
+ if (!options.tolerant && (!uuidComponents.uuid || !UUID_REG.test(uuidComponents.uuid))) {
5459
+ uuidComponents.error = uuidComponents.error || 'UUID is not valid.';
5460
+ }
5610
5461
 
5611
- var handledCPCountPlusOne = handledCPCount + 1;
5612
- if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
5613
- error$1('overflow');
5614
- }
5462
+ return uuidComponents
5463
+ }
5615
5464
 
5616
- delta += (m - n) * handledCPCountPlusOne;
5617
- n = m;
5465
+ function urnuuidSerialize (uuidComponents) {
5466
+ const urnComponents = uuidComponents;
5467
+ // normalize UUID
5468
+ urnComponents.nss = (uuidComponents.uuid || '').toLowerCase();
5469
+ return urnComponents
5470
+ }
5618
5471
 
5619
- var _iteratorNormalCompletion3 = true;
5620
- var _didIteratorError3 = false;
5621
- var _iteratorError3 = undefined;
5472
+ const http = {
5473
+ scheme: 'http',
5474
+ domainHost: true,
5475
+ parse: httpParse,
5476
+ serialize: httpSerialize
5477
+ };
5622
5478
 
5623
- try {
5624
- for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
5625
- var _currentValue = _step3.value;
5479
+ const https = {
5480
+ scheme: 'https',
5481
+ domainHost: http.domainHost,
5482
+ parse: httpParse,
5483
+ serialize: httpSerialize
5484
+ };
5626
5485
 
5627
- if (_currentValue < n && ++delta > maxInt) {
5628
- error$1('overflow');
5629
- }
5630
- if (_currentValue == n) {
5631
- // Represent delta as a generalized variable-length integer.
5632
- var q = delta;
5633
- for (var k = base;; /* no condition */k += base) {
5634
- var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
5635
- if (q < t) {
5636
- break;
5637
- }
5638
- var qMinusT = q - t;
5639
- var baseMinusT = base - t;
5640
- output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
5641
- q = floor(qMinusT / baseMinusT);
5642
- }
5643
-
5644
- output.push(stringFromCharCode(digitToBasic(q, 0)));
5645
- bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
5646
- delta = 0;
5647
- ++handledCPCount;
5648
- }
5649
- }
5650
- } catch (err) {
5651
- _didIteratorError3 = true;
5652
- _iteratorError3 = err;
5653
- } finally {
5654
- try {
5655
- if (!_iteratorNormalCompletion3 && _iterator3.return) {
5656
- _iterator3.return();
5657
- }
5658
- } finally {
5659
- if (_didIteratorError3) {
5660
- throw _iteratorError3;
5661
- }
5662
- }
5663
- }
5486
+ const ws = {
5487
+ scheme: 'ws',
5488
+ domainHost: true,
5489
+ parse: wsParse,
5490
+ serialize: wsSerialize
5491
+ };
5664
5492
 
5665
- ++delta;
5666
- ++n;
5667
- }
5668
- return output.join('');
5493
+ const wss = {
5494
+ scheme: 'wss',
5495
+ domainHost: ws.domainHost,
5496
+ parse: ws.parse,
5497
+ serialize: ws.serialize
5669
5498
  };
5670
5499
 
5671
- /**
5672
- * Converts a Punycode string representing a domain name or an email address
5673
- * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
5674
- * it doesn't matter if you call it on a string that has already been
5675
- * converted to Unicode.
5676
- * @memberOf punycode
5677
- * @param {String} input The Punycoded domain name or email address to
5678
- * convert to Unicode.
5679
- * @returns {String} The Unicode representation of the given Punycode
5680
- * string.
5681
- */
5682
- var toUnicode = function toUnicode(input) {
5683
- return mapDomain(input, function (string) {
5684
- return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
5685
- });
5500
+ const urn = {
5501
+ scheme: 'urn',
5502
+ parse: urnParse,
5503
+ serialize: urnSerialize,
5504
+ skipNormalize: true
5686
5505
  };
5687
5506
 
5688
- /**
5689
- * Converts a Unicode string representing a domain name or an email address to
5690
- * Punycode. Only the non-ASCII parts of the domain name will be converted,
5691
- * i.e. it doesn't matter if you call it with a domain that's already in
5692
- * ASCII.
5693
- * @memberOf punycode
5694
- * @param {String} input The domain name or email address to convert, as a
5695
- * Unicode string.
5696
- * @returns {String} The Punycode representation of the given domain name or
5697
- * email address.
5698
- */
5699
- var toASCII = function toASCII(input) {
5700
- return mapDomain(input, function (string) {
5701
- return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
5702
- });
5507
+ const urnuuid = {
5508
+ scheme: 'urn:uuid',
5509
+ parse: urnuuidParse,
5510
+ serialize: urnuuidSerialize,
5511
+ skipNormalize: true
5703
5512
  };
5704
5513
 
5705
- /*--------------------------------------------------------------------------*/
5706
-
5707
- /** Define the public API */
5708
- var punycode = {
5709
- /**
5710
- * A string representing the current Punycode.js version number.
5711
- * @memberOf punycode
5712
- * @type String
5713
- */
5714
- 'version': '2.1.0',
5715
- /**
5716
- * An object of methods to convert from JavaScript's internal character
5717
- * representation (UCS-2) to Unicode code points, and back.
5718
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
5719
- * @memberOf punycode
5720
- * @type Object
5721
- */
5722
- 'ucs2': {
5723
- 'decode': ucs2decode,
5724
- 'encode': ucs2encode
5725
- },
5726
- 'decode': decode,
5727
- 'encode': encode,
5728
- 'toASCII': toASCII,
5729
- 'toUnicode': toUnicode
5514
+ const SCHEMES$1 = {
5515
+ http,
5516
+ https,
5517
+ ws,
5518
+ wss,
5519
+ urn,
5520
+ 'urn:uuid': urnuuid
5730
5521
  };
5731
5522
 
5732
- /**
5733
- * URI.js
5734
- *
5735
- * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
5736
- * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
5737
- * @see http://github.com/garycourt/uri-js
5738
- */
5739
- /**
5740
- * Copyright 2011 Gary Court. All rights reserved.
5741
- *
5742
- * Redistribution and use in source and binary forms, with or without modification, are
5743
- * permitted provided that the following conditions are met:
5744
- *
5745
- * 1. Redistributions of source code must retain the above copyright notice, this list of
5746
- * conditions and the following disclaimer.
5747
- *
5748
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
5749
- * of conditions and the following disclaimer in the documentation and/or other materials
5750
- * provided with the distribution.
5751
- *
5752
- * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
5753
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
5754
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
5755
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
5756
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5757
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
5758
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
5759
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
5760
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5761
- *
5762
- * The views and conclusions contained in the software and documentation are those of the
5763
- * authors and should not be interpreted as representing official policies, either expressed
5764
- * or implied, of Gary Court.
5765
- */
5766
- var SCHEMES = {};
5767
- function pctEncChar(chr) {
5768
- var c = chr.charCodeAt(0);
5769
- var e = void 0;
5770
- 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();
5771
- return e;
5772
- }
5773
- function pctDecChars(str) {
5774
- var newStr = "";
5775
- var i = 0;
5776
- var il = str.length;
5777
- while (i < il) {
5778
- var c = parseInt(str.substr(i + 1, 2), 16);
5779
- if (c < 128) {
5780
- newStr += String.fromCharCode(c);
5781
- i += 3;
5782
- } else if (c >= 194 && c < 224) {
5783
- if (il - i >= 6) {
5784
- var c2 = parseInt(str.substr(i + 4, 2), 16);
5785
- newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);
5786
- } else {
5787
- newStr += str.substr(i, 6);
5788
- }
5789
- i += 6;
5790
- } else if (c >= 224) {
5791
- if (il - i >= 9) {
5792
- var _c = parseInt(str.substr(i + 4, 2), 16);
5793
- var c3 = parseInt(str.substr(i + 7, 2), 16);
5794
- newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);
5795
- } else {
5796
- newStr += str.substr(i, 9);
5797
- }
5798
- i += 9;
5799
- } else {
5800
- newStr += str.substr(i, 3);
5801
- i += 3;
5802
- }
5803
- }
5804
- return newStr;
5805
- }
5806
- function _normalizeComponentEncoding(components, protocol) {
5807
- function decodeUnreserved(str) {
5808
- var decStr = pctDecChars(str);
5809
- return !decStr.match(protocol.UNRESERVED) ? str : decStr;
5810
- }
5811
- if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
5812
- if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
5813
- 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);
5814
- 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);
5815
- if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
5816
- if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
5817
- return components;
5818
- }
5523
+ var schemes = SCHEMES$1;
5819
5524
 
5820
- function _stripLeadingZeros(str) {
5821
- return str.replace(/^0*(.*)/, "$1") || "0";
5525
+ const { normalizeIPv6, normalizeIPv4, removeDotSegments, recomposeAuthority, normalizeComponentEncoding } = utils;
5526
+ const SCHEMES = schemes;
5527
+
5528
+ function normalize (uri, options) {
5529
+ if (typeof uri === 'string') {
5530
+ uri = serialize(parse(uri, options), options);
5531
+ } else if (typeof uri === 'object') {
5532
+ uri = parse(serialize(uri, options), options);
5533
+ }
5534
+ return uri
5822
5535
  }
5823
- function _normalizeIPv4(host, protocol) {
5824
- var matches = host.match(protocol.IPV4ADDRESS) || [];
5825
5536
 
5826
- var _matches = slicedToArray(matches, 2),
5827
- address = _matches[1];
5537
+ function resolve (baseURI, relativeURI, options) {
5538
+ const schemelessOptions = Object.assign({ scheme: 'null' }, options);
5539
+ const resolved = resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
5540
+ return serialize(resolved, { ...schemelessOptions, skipEscape: true })
5541
+ }
5828
5542
 
5829
- if (address) {
5830
- return address.split(".").map(_stripLeadingZeros).join(".");
5831
- } else {
5832
- return host;
5833
- }
5834
- }
5835
- function _normalizeIPv6(host, protocol) {
5836
- var matches = host.match(protocol.IPV6ADDRESS) || [];
5837
-
5838
- var _matches2 = slicedToArray(matches, 3),
5839
- address = _matches2[1],
5840
- zone = _matches2[2];
5841
-
5842
- if (address) {
5843
- var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(),
5844
- _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2),
5845
- last = _address$toLowerCase$2[0],
5846
- first = _address$toLowerCase$2[1];
5847
-
5848
- var firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
5849
- var lastFields = last.split(":").map(_stripLeadingZeros);
5850
- var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
5851
- var fieldCount = isLastFieldIPv4Address ? 7 : 8;
5852
- var lastFieldsStart = lastFields.length - fieldCount;
5853
- var fields = Array(fieldCount);
5854
- for (var x = 0; x < fieldCount; ++x) {
5855
- fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
5856
- }
5857
- if (isLastFieldIPv4Address) {
5858
- fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
5859
- }
5860
- var allZeroFields = fields.reduce(function (acc, field, index) {
5861
- if (!field || field === "0") {
5862
- var lastLongest = acc[acc.length - 1];
5863
- if (lastLongest && lastLongest.index + lastLongest.length === index) {
5864
- lastLongest.length++;
5865
- } else {
5866
- acc.push({ index: index, length: 1 });
5867
- }
5868
- }
5869
- return acc;
5870
- }, []);
5871
- var longestZeroFields = allZeroFields.sort(function (a, b) {
5872
- return b.length - a.length;
5873
- })[0];
5874
- var newHost = void 0;
5875
- if (longestZeroFields && longestZeroFields.length > 1) {
5876
- var newFirst = fields.slice(0, longestZeroFields.index);
5877
- var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
5878
- newHost = newFirst.join(":") + "::" + newLast.join(":");
5879
- } else {
5880
- newHost = fields.join(":");
5881
- }
5882
- if (zone) {
5883
- newHost += "%" + zone;
5884
- }
5885
- return newHost;
5543
+ function resolveComponents (base, relative, options, skipNormalization) {
5544
+ const target = {};
5545
+ if (!skipNormalization) {
5546
+ base = parse(serialize(base, options), options); // normalize base components
5547
+ relative = parse(serialize(relative, options), options); // normalize relative components
5548
+ }
5549
+ options = options || {};
5550
+
5551
+ if (!options.tolerant && relative.scheme) {
5552
+ target.scheme = relative.scheme;
5553
+ // target.authority = relative.authority;
5554
+ target.userinfo = relative.userinfo;
5555
+ target.host = relative.host;
5556
+ target.port = relative.port;
5557
+ target.path = removeDotSegments(relative.path || '');
5558
+ target.query = relative.query;
5559
+ } else {
5560
+ if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
5561
+ // target.authority = relative.authority;
5562
+ target.userinfo = relative.userinfo;
5563
+ target.host = relative.host;
5564
+ target.port = relative.port;
5565
+ target.path = removeDotSegments(relative.path || '');
5566
+ target.query = relative.query;
5886
5567
  } else {
5887
- return host;
5888
- }
5889
- }
5890
- var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
5891
- var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined;
5892
- function parse(uriString) {
5893
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5894
-
5895
- var components = {};
5896
- var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
5897
- if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
5898
- var matches = uriString.match(URI_PARSE);
5899
- if (matches) {
5900
- if (NO_MATCH_IS_UNDEFINED) {
5901
- //store each component
5902
- components.scheme = matches[1];
5903
- components.userinfo = matches[3];
5904
- components.host = matches[4];
5905
- components.port = parseInt(matches[5], 10);
5906
- components.path = matches[6] || "";
5907
- components.query = matches[7];
5908
- components.fragment = matches[8];
5909
- //fix port number
5910
- if (isNaN(components.port)) {
5911
- components.port = matches[5];
5912
- }
5568
+ if (!relative.path) {
5569
+ target.path = base.path;
5570
+ if (relative.query !== undefined) {
5571
+ target.query = relative.query;
5913
5572
  } else {
5914
- //IE FIX for improper RegExp matching
5915
- //store each component
5916
- components.scheme = matches[1] || undefined;
5917
- components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined;
5918
- components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined;
5919
- components.port = parseInt(matches[5], 10);
5920
- components.path = matches[6] || "";
5921
- components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined;
5922
- components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined;
5923
- //fix port number
5924
- if (isNaN(components.port)) {
5925
- components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined;
5926
- }
5573
+ target.query = base.query;
5927
5574
  }
5928
- if (components.host) {
5929
- //normalize IP hosts
5930
- components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
5931
- }
5932
- //determine reference type
5933
- if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
5934
- components.reference = "same-document";
5935
- } else if (components.scheme === undefined) {
5936
- components.reference = "relative";
5937
- } else if (components.fragment === undefined) {
5938
- components.reference = "absolute";
5939
- } else {
5940
- components.reference = "uri";
5941
- }
5942
- //check for reference errors
5943
- if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
5944
- components.error = components.error || "URI is not a " + options.reference + " reference.";
5945
- }
5946
- //find scheme handler
5947
- var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
5948
- //check if scheme can't handle IRIs
5949
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
5950
- //if host component is a domain name
5951
- if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {
5952
- //convert Unicode IDN -> ASCII IDN
5953
- try {
5954
- components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
5955
- } catch (e) {
5956
- components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
5957
- }
5958
- }
5959
- //convert IRI -> URI
5960
- _normalizeComponentEncoding(components, URI_PROTOCOL);
5575
+ } else {
5576
+ if (relative.path.charAt(0) === '/') {
5577
+ target.path = removeDotSegments(relative.path);
5961
5578
  } else {
5962
- //normalize encodings
5963
- _normalizeComponentEncoding(components, protocol);
5964
- }
5965
- //perform scheme specific parsing
5966
- if (schemeHandler && schemeHandler.parse) {
5967
- schemeHandler.parse(components, options);
5579
+ if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
5580
+ target.path = '/' + relative.path;
5581
+ } else if (!base.path) {
5582
+ target.path = relative.path;
5583
+ } else {
5584
+ target.path = base.path.slice(0, base.path.lastIndexOf('/') + 1) + relative.path;
5585
+ }
5586
+ target.path = removeDotSegments(target.path);
5968
5587
  }
5969
- } else {
5970
- components.error = components.error || "URI can not be parsed.";
5588
+ target.query = relative.query;
5589
+ }
5590
+ // target.authority = base.authority;
5591
+ target.userinfo = base.userinfo;
5592
+ target.host = base.host;
5593
+ target.port = base.port;
5971
5594
  }
5972
- return components;
5973
- }
5595
+ target.scheme = base.scheme;
5596
+ }
5974
5597
 
5975
- function _recomposeAuthority(components, options) {
5976
- var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
5977
- var uriTokens = [];
5978
- if (components.userinfo !== undefined) {
5979
- uriTokens.push(components.userinfo);
5980
- uriTokens.push("@");
5981
- }
5982
- if (components.host !== undefined) {
5983
- //normalize IP hosts, add brackets and escape zone separator for IPv6
5984
- uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {
5985
- return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
5986
- }));
5987
- }
5988
- if (typeof components.port === "number" || typeof components.port === "string") {
5989
- uriTokens.push(":");
5990
- uriTokens.push(String(components.port));
5991
- }
5992
- return uriTokens.length ? uriTokens.join("") : undefined;
5993
- }
5994
-
5995
- var RDS1 = /^\.\.?\//;
5996
- var RDS2 = /^\/\.(\/|$)/;
5997
- var RDS3 = /^\/\.\.(\/|$)/;
5998
- var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
5999
- function removeDotSegments(input) {
6000
- var output = [];
6001
- while (input.length) {
6002
- if (input.match(RDS1)) {
6003
- input = input.replace(RDS1, "");
6004
- } else if (input.match(RDS2)) {
6005
- input = input.replace(RDS2, "/");
6006
- } else if (input.match(RDS3)) {
6007
- input = input.replace(RDS3, "/");
6008
- output.pop();
6009
- } else if (input === "." || input === "..") {
6010
- input = "";
6011
- } else {
6012
- var im = input.match(RDS5);
6013
- if (im) {
6014
- var s = im[0];
6015
- input = input.slice(s.length);
6016
- output.push(s);
6017
- } else {
6018
- throw new Error("Unexpected dot segment condition");
6019
- }
6020
- }
6021
- }
6022
- return output.join("");
5598
+ target.fragment = relative.fragment;
5599
+
5600
+ return target
6023
5601
  }
6024
5602
 
6025
- function serialize(components) {
6026
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5603
+ function equal$2 (uriA, uriB, options) {
5604
+ if (typeof uriA === 'string') {
5605
+ uriA = unescape(uriA);
5606
+ uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true });
5607
+ } else if (typeof uriA === 'object') {
5608
+ uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
5609
+ }
6027
5610
 
6028
- var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;
6029
- var uriTokens = [];
6030
- //find scheme handler
6031
- var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
6032
- //perform scheme specific serialization
6033
- if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
6034
- if (components.host) {
6035
- //if host component is an IPv6 address
6036
- if (protocol.IPV6ADDRESS.test(components.host)) ;
6037
- //TODO: normalize IPv6 address as per RFC 5952
5611
+ if (typeof uriB === 'string') {
5612
+ uriB = unescape(uriB);
5613
+ uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true });
5614
+ } else if (typeof uriB === 'object') {
5615
+ uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
5616
+ }
6038
5617
 
6039
- //if host component is a domain name
6040
- else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {
6041
- //convert IDN via punycode
6042
- try {
6043
- components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);
6044
- } catch (e) {
6045
- components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
6046
- }
6047
- }
6048
- }
6049
- //normalize encoding
6050
- _normalizeComponentEncoding(components, protocol);
6051
- if (options.reference !== "suffix" && components.scheme) {
6052
- uriTokens.push(components.scheme);
6053
- uriTokens.push(":");
6054
- }
6055
- var authority = _recomposeAuthority(components, options);
6056
- if (authority !== undefined) {
6057
- if (options.reference !== "suffix") {
6058
- uriTokens.push("//");
6059
- }
6060
- uriTokens.push(authority);
6061
- if (components.path && components.path.charAt(0) !== "/") {
6062
- uriTokens.push("/");
6063
- }
6064
- }
6065
- if (components.path !== undefined) {
6066
- var s = components.path;
6067
- if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
6068
- s = removeDotSegments(s);
6069
- }
6070
- if (authority === undefined) {
6071
- s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
6072
- }
6073
- uriTokens.push(s);
6074
- }
6075
- if (components.query !== undefined) {
6076
- uriTokens.push("?");
6077
- uriTokens.push(components.query);
6078
- }
6079
- if (components.fragment !== undefined) {
6080
- uriTokens.push("#");
6081
- uriTokens.push(components.fragment);
6082
- }
6083
- return uriTokens.join(""); //merge tokens into a string
6084
- }
5618
+ return uriA.toLowerCase() === uriB.toLowerCase()
5619
+ }
5620
+
5621
+ function serialize (cmpts, opts) {
5622
+ const components = {
5623
+ host: cmpts.host,
5624
+ scheme: cmpts.scheme,
5625
+ userinfo: cmpts.userinfo,
5626
+ port: cmpts.port,
5627
+ path: cmpts.path,
5628
+ query: cmpts.query,
5629
+ nid: cmpts.nid,
5630
+ nss: cmpts.nss,
5631
+ uuid: cmpts.uuid,
5632
+ fragment: cmpts.fragment,
5633
+ reference: cmpts.reference,
5634
+ resourceName: cmpts.resourceName,
5635
+ secure: cmpts.secure,
5636
+ error: ''
5637
+ };
5638
+ const options = Object.assign({}, opts);
5639
+ const uriTokens = [];
6085
5640
 
6086
- function resolveComponents(base, relative) {
6087
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6088
- var skipNormalization = arguments[3];
5641
+ // find scheme handler
5642
+ const schemeHandler = SCHEMES[(options.scheme || components.scheme || '').toLowerCase()];
6089
5643
 
6090
- var target = {};
6091
- if (!skipNormalization) {
6092
- base = parse(serialize(base, options), options); //normalize base components
6093
- relative = parse(serialize(relative, options), options); //normalize relative components
6094
- }
6095
- options = options || {};
6096
- if (!options.tolerant && relative.scheme) {
6097
- target.scheme = relative.scheme;
6098
- //target.authority = relative.authority;
6099
- target.userinfo = relative.userinfo;
6100
- target.host = relative.host;
6101
- target.port = relative.port;
6102
- target.path = removeDotSegments(relative.path || "");
6103
- target.query = relative.query;
5644
+ // perform scheme specific serialization
5645
+ if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
5646
+
5647
+ if (components.path !== undefined) {
5648
+ if (!options.skipEscape) {
5649
+ components.path = escape(components.path);
5650
+
5651
+ if (components.scheme !== undefined) {
5652
+ components.path = components.path.split('%3A').join(':');
5653
+ }
6104
5654
  } else {
6105
- if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
6106
- //target.authority = relative.authority;
6107
- target.userinfo = relative.userinfo;
6108
- target.host = relative.host;
6109
- target.port = relative.port;
6110
- target.path = removeDotSegments(relative.path || "");
6111
- target.query = relative.query;
6112
- } else {
6113
- if (!relative.path) {
6114
- target.path = base.path;
6115
- if (relative.query !== undefined) {
6116
- target.query = relative.query;
6117
- } else {
6118
- target.query = base.query;
6119
- }
6120
- } else {
6121
- if (relative.path.charAt(0) === "/") {
6122
- target.path = removeDotSegments(relative.path);
6123
- } else {
6124
- if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
6125
- target.path = "/" + relative.path;
6126
- } else if (!base.path) {
6127
- target.path = relative.path;
6128
- } else {
6129
- target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
6130
- }
6131
- target.path = removeDotSegments(target.path);
6132
- }
6133
- target.query = relative.query;
6134
- }
6135
- //target.authority = base.authority;
6136
- target.userinfo = base.userinfo;
6137
- target.host = base.host;
6138
- target.port = base.port;
6139
- }
6140
- target.scheme = base.scheme;
5655
+ components.path = unescape(components.path);
6141
5656
  }
6142
- target.fragment = relative.fragment;
6143
- return target;
6144
- }
5657
+ }
6145
5658
 
6146
- function resolve(baseURI, relativeURI, options) {
6147
- var schemelessOptions = assign({ scheme: 'null' }, options);
6148
- return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
6149
- }
5659
+ if (options.reference !== 'suffix' && components.scheme) {
5660
+ uriTokens.push(components.scheme, ':');
5661
+ }
6150
5662
 
6151
- function normalize(uri, options) {
6152
- if (typeof uri === "string") {
6153
- uri = serialize(parse(uri, options), options);
6154
- } else if (typeOf(uri) === "object") {
6155
- uri = parse(serialize(uri, options), options);
5663
+ const authority = recomposeAuthority(components);
5664
+ if (authority !== undefined) {
5665
+ if (options.reference !== 'suffix') {
5666
+ uriTokens.push('//');
6156
5667
  }
6157
- return uri;
6158
- }
6159
5668
 
6160
- function equal(uriA, uriB, options) {
6161
- if (typeof uriA === "string") {
6162
- uriA = serialize(parse(uriA, options), options);
6163
- } else if (typeOf(uriA) === "object") {
6164
- uriA = serialize(uriA, options);
5669
+ uriTokens.push(authority);
5670
+
5671
+ if (components.path && components.path.charAt(0) !== '/') {
5672
+ uriTokens.push('/');
6165
5673
  }
6166
- if (typeof uriB === "string") {
6167
- uriB = serialize(parse(uriB, options), options);
6168
- } else if (typeOf(uriB) === "object") {
6169
- uriB = serialize(uriB, options);
5674
+ }
5675
+ if (components.path !== undefined) {
5676
+ let s = components.path;
5677
+
5678
+ if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
5679
+ s = removeDotSegments(s);
6170
5680
  }
6171
- return uriA === uriB;
6172
- }
6173
5681
 
6174
- function escapeComponent(str, options) {
6175
- return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);
6176
- }
5682
+ if (authority === undefined) {
5683
+ s = s.replace(/^\/\//u, '/%2F'); // don't allow the path to start with "//"
5684
+ }
6177
5685
 
6178
- function unescapeComponent(str, options) {
6179
- return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);
5686
+ uriTokens.push(s);
5687
+ }
5688
+
5689
+ if (components.query !== undefined) {
5690
+ uriTokens.push('?', components.query);
5691
+ }
5692
+
5693
+ if (components.fragment !== undefined) {
5694
+ uriTokens.push('#', components.fragment);
5695
+ }
5696
+ return uriTokens.join('')
6180
5697
  }
6181
5698
 
6182
- var handler = {
6183
- scheme: "http",
6184
- domainHost: true,
6185
- parse: function parse(components, options) {
6186
- //report missing host
6187
- if (!components.host) {
6188
- components.error = components.error || "HTTP URIs must have a host.";
6189
- }
6190
- return components;
6191
- },
6192
- serialize: function serialize(components, options) {
6193
- var secure = String(components.scheme).toLowerCase() === "https";
6194
- //normalize the default port
6195
- if (components.port === (secure ? 443 : 80) || components.port === "") {
6196
- components.port = undefined;
6197
- }
6198
- //normalize the empty path
6199
- if (!components.path) {
6200
- components.path = "/";
6201
- }
6202
- //NOTE: We do not parse query strings for HTTP URIs
6203
- //as WWW Form Url Encoded query strings are part of the HTML4+ spec,
6204
- //and not the HTTP spec.
6205
- return components;
5699
+ const hexLookUp = Array.from({ length: 127 }, (_v, k) => /[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(k)));
5700
+
5701
+ function nonSimpleDomain (value) {
5702
+ let code = 0;
5703
+ for (let i = 0, len = value.length; i < len; ++i) {
5704
+ code = value.charCodeAt(i);
5705
+ if (code > 126 || hexLookUp[code]) {
5706
+ return true
6206
5707
  }
6207
- };
5708
+ }
5709
+ return false
5710
+ }
6208
5711
 
6209
- var handler$1 = {
6210
- scheme: "https",
6211
- domainHost: handler.domainHost,
6212
- parse: handler.parse,
6213
- serialize: handler.serialize
6214
- };
5712
+ const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
6215
5713
 
6216
- function isSecure(wsComponents) {
6217
- return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
6218
- }
6219
- //RFC 6455
6220
- var handler$2 = {
6221
- scheme: "ws",
6222
- domainHost: true,
6223
- parse: function parse(components, options) {
6224
- var wsComponents = components;
6225
- //indicate if the secure flag is set
6226
- wsComponents.secure = isSecure(wsComponents);
6227
- //construct resouce name
6228
- wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
6229
- wsComponents.path = undefined;
6230
- wsComponents.query = undefined;
6231
- return wsComponents;
6232
- },
6233
- serialize: function serialize(wsComponents, options) {
6234
- //normalize the default port
6235
- if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
6236
- wsComponents.port = undefined;
6237
- }
6238
- //ensure scheme matches secure flag
6239
- if (typeof wsComponents.secure === 'boolean') {
6240
- wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';
6241
- wsComponents.secure = undefined;
6242
- }
6243
- //reconstruct path from resource name
6244
- if (wsComponents.resourceName) {
6245
- var _wsComponents$resourc = wsComponents.resourceName.split('?'),
6246
- _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),
6247
- path = _wsComponents$resourc2[0],
6248
- query = _wsComponents$resourc2[1];
6249
-
6250
- wsComponents.path = path && path !== '/' ? path : undefined;
6251
- wsComponents.query = query;
6252
- wsComponents.resourceName = undefined;
6253
- }
6254
- //forbid fragment component
6255
- wsComponents.fragment = undefined;
6256
- return wsComponents;
5714
+ function parse (uri, opts) {
5715
+ const options = Object.assign({}, opts);
5716
+ const parsed = {
5717
+ scheme: undefined,
5718
+ userinfo: undefined,
5719
+ host: '',
5720
+ port: undefined,
5721
+ path: '',
5722
+ query: undefined,
5723
+ fragment: undefined
5724
+ };
5725
+ const gotEncoding = uri.indexOf('%') !== -1;
5726
+ let isIP = false;
5727
+ if (options.reference === 'suffix') uri = (options.scheme ? options.scheme + ':' : '') + '//' + uri;
5728
+
5729
+ const matches = uri.match(URI_PARSE);
5730
+
5731
+ if (matches) {
5732
+ // store each component
5733
+ parsed.scheme = matches[1];
5734
+ parsed.userinfo = matches[3];
5735
+ parsed.host = matches[4];
5736
+ parsed.port = parseInt(matches[5], 10);
5737
+ parsed.path = matches[6] || '';
5738
+ parsed.query = matches[7];
5739
+ parsed.fragment = matches[8];
5740
+
5741
+ // fix port number
5742
+ if (isNaN(parsed.port)) {
5743
+ parsed.port = matches[5];
5744
+ }
5745
+ if (parsed.host) {
5746
+ const ipv4result = normalizeIPv4(parsed.host);
5747
+ if (ipv4result.isIPV4 === false) {
5748
+ const ipv6result = normalizeIPv6(ipv4result.host);
5749
+ parsed.host = ipv6result.host.toLowerCase();
5750
+ isIP = ipv6result.isIPV6;
5751
+ } else {
5752
+ parsed.host = ipv4result.host;
5753
+ isIP = true;
5754
+ }
5755
+ }
5756
+ if (parsed.scheme === undefined && parsed.userinfo === undefined && parsed.host === undefined && parsed.port === undefined && parsed.query === undefined && !parsed.path) {
5757
+ parsed.reference = 'same-document';
5758
+ } else if (parsed.scheme === undefined) {
5759
+ parsed.reference = 'relative';
5760
+ } else if (parsed.fragment === undefined) {
5761
+ parsed.reference = 'absolute';
5762
+ } else {
5763
+ parsed.reference = 'uri';
6257
5764
  }
6258
- };
6259
-
6260
- var handler$3 = {
6261
- scheme: "wss",
6262
- domainHost: handler$2.domainHost,
6263
- parse: handler$2.parse,
6264
- serialize: handler$2.serialize
6265
- };
6266
5765
 
6267
- var O = {};
6268
- //RFC 3986
6269
- var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + ("\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" ) + "]";
6270
- var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
6271
- var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
6272
- //RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
6273
- //const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
6274
- //const WSP$$ = "[\\x20\\x09]";
6275
- //const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)
6276
- //const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext
6277
- //const VCHAR$$ = "[\\x21-\\x7E]";
6278
- //const WSP$$ = "[\\x20\\x09]";
6279
- //const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
6280
- //const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
6281
- //const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
6282
- //const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
6283
- var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
6284
- var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
6285
- var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
6286
- var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
6287
- var UNRESERVED = new RegExp(UNRESERVED$$, "g");
6288
- var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
6289
- var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
6290
- var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
6291
- var NOT_HFVALUE = NOT_HFNAME;
6292
- function decodeUnreserved(str) {
6293
- var decStr = pctDecChars(str);
6294
- return !decStr.match(UNRESERVED) ? str : decStr;
6295
- }
6296
- var handler$4 = {
6297
- scheme: "mailto",
6298
- parse: function parse$$1(components, options) {
6299
- var mailtoComponents = components;
6300
- var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : [];
6301
- mailtoComponents.path = undefined;
6302
- if (mailtoComponents.query) {
6303
- var unknownHeaders = false;
6304
- var headers = {};
6305
- var hfields = mailtoComponents.query.split("&");
6306
- for (var x = 0, xl = hfields.length; x < xl; ++x) {
6307
- var hfield = hfields[x].split("=");
6308
- switch (hfield[0]) {
6309
- case "to":
6310
- var toAddrs = hfield[1].split(",");
6311
- for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {
6312
- to.push(toAddrs[_x]);
6313
- }
6314
- break;
6315
- case "subject":
6316
- mailtoComponents.subject = unescapeComponent(hfield[1], options);
6317
- break;
6318
- case "body":
6319
- mailtoComponents.body = unescapeComponent(hfield[1], options);
6320
- break;
6321
- default:
6322
- unknownHeaders = true;
6323
- headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
6324
- break;
6325
- }
6326
- }
6327
- if (unknownHeaders) mailtoComponents.headers = headers;
6328
- }
6329
- mailtoComponents.query = undefined;
6330
- for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {
6331
- var addr = to[_x2].split("@");
6332
- addr[0] = unescapeComponent(addr[0]);
6333
- if (!options.unicodeSupport) {
6334
- //convert Unicode IDN -> ASCII IDN
6335
- try {
6336
- addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
6337
- } catch (e) {
6338
- mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
6339
- }
6340
- } else {
6341
- addr[1] = unescapeComponent(addr[1], options).toLowerCase();
6342
- }
6343
- to[_x2] = addr.join("@");
6344
- }
6345
- return mailtoComponents;
6346
- },
6347
- serialize: function serialize$$1(mailtoComponents, options) {
6348
- var components = mailtoComponents;
6349
- var to = toArray(mailtoComponents.to);
6350
- if (to) {
6351
- for (var x = 0, xl = to.length; x < xl; ++x) {
6352
- var toAddr = String(to[x]);
6353
- var atIdx = toAddr.lastIndexOf("@");
6354
- var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
6355
- var domain = toAddr.slice(atIdx + 1);
6356
- //convert IDN via punycode
6357
- try {
6358
- domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);
6359
- } catch (e) {
6360
- components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
6361
- }
6362
- to[x] = localPart + "@" + domain;
6363
- }
6364
- components.path = to.join(",");
6365
- }
6366
- var headers = mailtoComponents.headers = mailtoComponents.headers || {};
6367
- if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
6368
- if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
6369
- var fields = [];
6370
- for (var name in headers) {
6371
- if (headers[name] !== O[name]) {
6372
- 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));
6373
- }
6374
- }
6375
- if (fields.length) {
6376
- components.query = fields.join("&");
6377
- }
6378
- return components;
5766
+ // check for reference errors
5767
+ if (options.reference && options.reference !== 'suffix' && options.reference !== parsed.reference) {
5768
+ parsed.error = parsed.error || 'URI is not a ' + options.reference + ' reference.';
6379
5769
  }
6380
- };
6381
5770
 
6382
- var URN_PARSE = /^([^\:]+)\:(.*)/;
6383
- //RFC 2141
6384
- var handler$5 = {
6385
- scheme: "urn",
6386
- parse: function parse$$1(components, options) {
6387
- var matches = components.path && components.path.match(URN_PARSE);
6388
- var urnComponents = components;
6389
- if (matches) {
6390
- var scheme = options.scheme || urnComponents.scheme || "urn";
6391
- var nid = matches[1].toLowerCase();
6392
- var nss = matches[2];
6393
- var urnScheme = scheme + ":" + (options.nid || nid);
6394
- var schemeHandler = SCHEMES[urnScheme];
6395
- urnComponents.nid = nid;
6396
- urnComponents.nss = nss;
6397
- urnComponents.path = undefined;
6398
- if (schemeHandler) {
6399
- urnComponents = schemeHandler.parse(urnComponents, options);
6400
- }
6401
- } else {
6402
- urnComponents.error = urnComponents.error || "URN can not be parsed.";
5771
+ // find scheme handler
5772
+ const schemeHandler = SCHEMES[(options.scheme || parsed.scheme || '').toLowerCase()];
5773
+
5774
+ // check if scheme can't handle IRIs
5775
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
5776
+ // if host component is a domain name
5777
+ if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && isIP === false && nonSimpleDomain(parsed.host)) {
5778
+ // convert Unicode IDN -> ASCII IDN
5779
+ try {
5780
+ parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
5781
+ } catch (e) {
5782
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
6403
5783
  }
6404
- return urnComponents;
6405
- },
6406
- serialize: function serialize$$1(urnComponents, options) {
6407
- var scheme = options.scheme || urnComponents.scheme || "urn";
6408
- var nid = urnComponents.nid;
6409
- var urnScheme = scheme + ":" + (options.nid || nid);
6410
- var schemeHandler = SCHEMES[urnScheme];
6411
- if (schemeHandler) {
6412
- urnComponents = schemeHandler.serialize(urnComponents, options);
6413
- }
6414
- var uriComponents = urnComponents;
6415
- var nss = urnComponents.nss;
6416
- uriComponents.path = (nid || options.nid) + ":" + nss;
6417
- return uriComponents;
5784
+ }
5785
+ // convert IRI -> URI
6418
5786
  }
6419
- };
6420
5787
 
6421
- var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
6422
- //RFC 4122
6423
- var handler$6 = {
6424
- scheme: "urn:uuid",
6425
- parse: function parse(urnComponents, options) {
6426
- var uuidComponents = urnComponents;
6427
- uuidComponents.uuid = uuidComponents.nss;
6428
- uuidComponents.nss = undefined;
6429
- if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
6430
- uuidComponents.error = uuidComponents.error || "UUID is not valid.";
6431
- }
6432
- return uuidComponents;
6433
- },
6434
- serialize: function serialize(uuidComponents, options) {
6435
- var urnComponents = uuidComponents;
6436
- //normalize UUID
6437
- urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
6438
- return urnComponents;
5788
+ if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) {
5789
+ if (gotEncoding && parsed.scheme !== undefined) {
5790
+ parsed.scheme = unescape(parsed.scheme);
5791
+ }
5792
+ if (gotEncoding && parsed.host !== undefined) {
5793
+ parsed.host = unescape(parsed.host);
5794
+ }
5795
+ if (parsed.path) {
5796
+ parsed.path = escape(unescape(parsed.path));
5797
+ }
5798
+ if (parsed.fragment) {
5799
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
5800
+ }
6439
5801
  }
6440
- };
6441
5802
 
6442
- SCHEMES[handler.scheme] = handler;
6443
- SCHEMES[handler$1.scheme] = handler$1;
6444
- SCHEMES[handler$2.scheme] = handler$2;
6445
- SCHEMES[handler$3.scheme] = handler$3;
6446
- SCHEMES[handler$4.scheme] = handler$4;
6447
- SCHEMES[handler$5.scheme] = handler$5;
6448
- SCHEMES[handler$6.scheme] = handler$6;
6449
-
6450
- exports.SCHEMES = SCHEMES;
6451
- exports.pctEncChar = pctEncChar;
6452
- exports.pctDecChars = pctDecChars;
6453
- exports.parse = parse;
6454
- exports.removeDotSegments = removeDotSegments;
6455
- exports.serialize = serialize;
6456
- exports.resolveComponents = resolveComponents;
6457
- exports.resolve = resolve;
6458
- exports.normalize = normalize;
6459
- exports.equal = equal;
6460
- exports.escapeComponent = escapeComponent;
6461
- exports.unescapeComponent = unescapeComponent;
6462
-
6463
- Object.defineProperty(exports, '__esModule', { value: true });
5803
+ // perform scheme specific parsing
5804
+ if (schemeHandler && schemeHandler.parse) {
5805
+ schemeHandler.parse(parsed, options);
5806
+ }
5807
+ } else {
5808
+ parsed.error = parsed.error || 'URI can not be parsed.';
5809
+ }
5810
+ return parsed
5811
+ }
6464
5812
 
6465
- })));
5813
+ const fastUri = {
5814
+ SCHEMES,
5815
+ normalize,
5816
+ resolve,
5817
+ resolveComponents,
5818
+ equal: equal$2,
5819
+ serialize,
5820
+ parse
5821
+ };
6466
5822
 
6467
- }(uri_all, uri_all.exports));
5823
+ fastUri$1.exports = fastUri;
5824
+ fastUri$1.exports.default = fastUri;
5825
+ fastUri$1.exports.fastUri = fastUri;
6468
5826
 
6469
5827
  Object.defineProperty(uri$1, "__esModule", { value: true });
6470
- const uri = uri_all.exports;
5828
+ const uri = fastUri$1.exports;
6471
5829
  uri.code = 'require("ajv/dist/runtime/uri").default';
6472
5830
  uri$1.default = uri;
6473
5831
 
@@ -6488,7 +5846,7 @@
6488
5846
  const rules_1 = rules;
6489
5847
  const compile_1 = compile;
6490
5848
  const codegen_2 = codegen;
6491
- const resolve_1 = resolve$1;
5849
+ const resolve_1 = resolve$2;
6492
5850
  const dataType_1 = dataType;
6493
5851
  const util_1 = util;
6494
5852
  const $dataRefSchema = require$$9;
@@ -9604,7 +8962,7 @@
9604
8962
  message = _theRule.message;
9605
8963
  var valid = true;
9606
8964
  if (isExpression(validator)) {
9607
- valid = executeExpression(validator, instance);
8965
+ valid = _executeExpression(validator, instance);
9608
8966
  } else if (typeof validator === 'function') {
9609
8967
  valid = validator(instance);
9610
8968
  // eslint-disable-next-line no-eval
@@ -9768,7 +9126,7 @@
9768
9126
  };
9769
9127
  // 校验schema是否正常
9770
9128
  var validateSchema = /*#__PURE__*/function () {
9771
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(schema) {
9129
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(schema) {
9772
9130
  return _regeneratorRuntime().wrap(function _callee$(_context) {
9773
9131
  while (1) switch (_context.prev = _context.next) {
9774
9132
  case 0:
@@ -9993,7 +9351,7 @@
9993
9351
  },
9994
9352
  loadDataSource: function loadDataSource() {
9995
9353
  var _this3 = this;
9996
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9354
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9997
9355
  var _this3$widgetSchema, _this3$widgetSchema$u, _this3$widgetSchema$u2;
9998
9356
  var xhrConfig, url, params, reset, _this3$httpAdapter, _this3$httpAdapter$re, http, responseParse, remoteURL, requestParams;
9999
9357
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -10008,8 +9366,8 @@
10008
9366
  _this3$httpAdapter = _this3.httpAdapter, _this3$httpAdapter$re = _this3$httpAdapter.request, http = _this3$httpAdapter$re === void 0 ? request : _this3$httpAdapter$re, responseParse = _this3$httpAdapter.responseParse;
10009
9367
  _context.prev = 4;
10010
9368
  _this3.loading = true;
10011
- remoteURL = executeExpression(url, _this3);
10012
- requestParams = isObj(params) ? executeExpression(params, _this3) : params;
9369
+ remoteURL = _executeExpression(url, _this3);
9370
+ requestParams = isObj(params) ? _executeExpression(params, _this3) : params;
10013
9371
  _context.next = 10;
10014
9372
  return http(remoteURL, _objectSpread2(_objectSpread2({}, reset), {}, {
10015
9373
  params: requestParams,
@@ -11143,82 +10501,6 @@
11143
10501
 
11144
10502
  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;
11145
10503
 
11146
- var CommonGroupWrap = Vue__default["default"].extend({
11147
- name: 'CommonFieldGroupWrap',
11148
- inject: ['widgetTree'],
11149
- props: _objectSpread2(_objectSpread2({}, props), {}, {
11150
- // 组类型
11151
- type: {
11152
- type: String,
11153
- default: 'default',
11154
- validator: function validator(value) {
11155
- return ['default', 'normal', 'card'].includes(value);
11156
- }
11157
- },
11158
- // 是否显示组title
11159
- showTitle: {
11160
- type: Boolean,
11161
- default: false
11162
- },
11163
- // 是否显示border
11164
- border: {
11165
- type: Boolean,
11166
- default: false
11167
- },
11168
- verifiable: {
11169
- type: Boolean,
11170
- default: false
11171
- },
11172
- hideEmptyRow: {
11173
- type: Boolean,
11174
- default: false
11175
- },
11176
- description: {
11177
- type: String,
11178
- default: ''
11179
- },
11180
- tag: {
11181
- type: String,
11182
- default: 'div'
11183
- }
11184
- }),
11185
- data: function data() {
11186
- return {
11187
- state: {
11188
- // 组类型目前只支持visible
11189
- visible: true
11190
- }
11191
- };
11192
- },
11193
- // created() {
11194
- // // 注册widget TreeNode
11195
- // this.widgetTree.addWidgetNode(this.path, this, 'group');
11196
- // },
11197
- mounted: function mounted() {
11198
- // 更新样式
11199
- this.$forceUpdate();
11200
- },
11201
- // beforeDestroy() {
11202
- // this.widgetTree.removeWidgetNode(this.path, this);
11203
- // },
11204
- methods: {
11205
- setState: function setState(key, value) {
11206
- if (Reflect.has(this.state, key)) {
11207
- this.state[key] = value;
11208
- } else {
11209
- console.warn("Group unsupported ".concat(key, " state, please check"));
11210
- }
11211
- }
11212
- },
11213
- render: function render(h) {
11214
- var _this$layout;
11215
- var groupContentStyle = _objectSpread2({}, (_this$layout = this.layout) === null || _this$layout === void 0 ? void 0 : _this$layout.container);
11216
- return h(this.tag, {
11217
- style: groupContentStyle
11218
- }, [this.$slots.default]);
11219
- }
11220
- });
11221
-
11222
10504
  // 伪数组类型
11223
10505
  var KeyValueArrayWidget = Vue__default["default"].extend({
11224
10506
  name: 'KeyValueArrayWidget',
@@ -11269,30 +10551,30 @@
11269
10551
  _this$schema2,
11270
10552
  _this$schema2$items,
11271
10553
  _this = this,
11272
- _this$value2;
10554
+ _this$value2,
10555
+ _this$value3;
11273
10556
  var labelBtnStyle = {
11274
10557
  'font-size': '16px',
11275
10558
  color: this.disabled ? '#c4c6cc' : '#979ba5',
11276
10559
  cursor: this.disabled ? 'not-allowed' : 'pointer',
11277
10560
  display: 'inline-block'
11278
10561
  };
11279
- var theadStyle = {
11280
- display: this.showTableHead ? '' : 'none'
11281
- };
10562
+ 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;
10563
+ 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']);
10564
+ // props为空时,表示只有一个项
10565
+ var keysLen = Object.keys(properties || {}).length;
10566
+ var defaultCols = properties ? new Array(keysLen).fill('1fr').concat('20px').join(' ') : '1fr 20px';
10567
+ var defaultContainerLayout = _objectSpread2({}, this.layout.container || {
10568
+ display: 'grid',
10569
+ gridGap: '20px',
10570
+ 'grid-template-columns': defaultCols // 默认配置
10571
+ });
11282
10572
  var thStyle = {
11283
10573
  fontSize: '14px',
11284
10574
  textAlign: 'left',
11285
10575
  fontWeight: 'normal',
11286
- color: '#63656E',
11287
- paddingLeft: '10px',
11288
- paddingRight: '10px'
11289
- };
11290
- var tdStyle = {
11291
- paddingLeft: '10px',
11292
- paddingRight: '10px'
10576
+ color: '#63656E'
11293
10577
  };
11294
- 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;
11295
- 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']);
11296
10578
  var self = this;
11297
10579
  var dealSchema = function dealSchema(schema) {
11298
10580
  return (
@@ -11340,57 +10622,55 @@
11340
10622
  }
11341
10623
  });
11342
10624
  };
11343
- return h("table", [h("thead", {
11344
- "style": theadStyle
11345
- }, [h("tr", [props === null || props === void 0 ? void 0 : props.map(function (prop, i) {
10625
+ return h("div", [this.showTableHead && (_this$value2 = this.value) !== null && _this$value2 !== void 0 && _this$value2.length ? h("div", {
10626
+ "style": _objectSpread2({}, defaultContainerLayout)
10627
+ }, [props !== null && props !== void 0 && props.length ? props.map(function (key, index) {
11346
10628
  var _this$schema3, _this$schema3$items, _this$columns$path;
11347
- 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];
11348
- var path = Path.getCurPath(_this.path, "0.".concat(prop));
11349
- return h("th", {
11350
- "style": _objectSpread2(_objectSpread2({}, thStyle), {}, {
11351
- paddingLeft: i > 0 ? '10px' : '0px',
10629
+ var schemaItem = (_this$schema3 = _this.schema) === null || _this$schema3 === void 0 ? void 0 : (_this$schema3$items = _this$schema3.items) === null || _this$schema3$items === void 0 ? void 0 : _this$schema3$items.properties[key];
10630
+ var curPath = Path.getCurPath(_this.path, "".concat(index, ".").concat(key));
10631
+ var lastProp = curPath.split('.').pop();
10632
+ var layoutConfig = Layout.findLayoutByProp(lastProp, _this.layout.group || []) || {};
10633
+ var path = Path.getCurPath(_this.path, "0.".concat(key));
10634
+ return h("div", {
10635
+ "style": _objectSpread2(_objectSpread2(_objectSpread2({}, thStyle), (layoutConfig === null || layoutConfig === void 0 ? void 0 : layoutConfig.item) || {}), {}, {
11352
10636
  display: ((_this$columns$path = _this.columns[path]) === null || _this$columns$path === void 0 ? void 0 : _this$columns$path.visible) === false ? 'none' : ''
11353
10637
  })
11354
10638
  }, [schemaItem === null || schemaItem === void 0 ? void 0 : schemaItem.title]);
11355
- }), h("th")])]), h("tbody", [(_this$value2 = this.value) === null || _this$value2 === void 0 ? void 0 : _this$value2.map(function (_, index) {
10639
+ }) : h("div"), h("div", {
10640
+ "style": {
10641
+ width: '16px'
10642
+ }
10643
+ })]) : null, (_this$value3 = this.value) === null || _this$value3 === void 0 ? void 0 : _this$value3.map(function (_, index) {
11356
10644
  var _this$schema5;
11357
10645
  var groupPath = Path.getCurPath(_this.path, "".concat(index));
11358
- return h(CommonGroupWrap, helper([{}, {
10646
+ return h(FieldGroupWrap, helper([{}, {
11359
10647
  "props": _objectSpread2(_objectSpread2({}, _this.$props), {}, {
11360
10648
  path: groupPath,
11361
10649
  value: Path.getPathVal(_this.rootData, groupPath),
11362
10650
  schema: _this.schema.items,
11363
- tag: 'tr',
11364
- layout: _objectSpread2({}, _this.layout)
10651
+ layout: _objectSpread2(_objectSpread2({}, _this.layout), {}, {
10652
+ container: _objectSpread2({}, defaultContainerLayout)
10653
+ })
11365
10654
  })
11366
- }]), [props !== null && props !== void 0 && props.length ? props.map(function (prop, i) {
11367
- var _this$schema4, _this$schema4$items, _this$columns$curPath;
10655
+ }]), [props !== null && props !== void 0 && props.length ? props.map(function (prop) {
10656
+ var _this$schema4, _this$schema4$items;
11368
10657
  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];
11369
10658
  var curPath = Path.getCurPath(_this.path, "".concat(index, ".").concat(prop));
11370
10659
  var lastProp = curPath.split('.').pop();
11371
10660
  var layoutConfig = Layout.findLayoutByProp(lastProp, _this.layout.group || []) || {};
11372
- return h("td", {
11373
- "style": _objectSpread2(_objectSpread2({}, tdStyle), {}, {
11374
- paddingLeft: i > 0 ? '10px' : '0px',
11375
- display: ((_this$columns$curPath = _this.columns[curPath]) === null || _this$columns$curPath === void 0 ? void 0 : _this$columns$curPath.visible) === false ? 'none' : ''
11376
- })
11377
- }, [renderSchemaField({
10661
+ return renderSchemaField({
11378
10662
  path: curPath,
11379
10663
  schema: dealSchema(schemaItem),
11380
10664
  layout: layoutConfig,
11381
10665
  required: Schema.isRequired(schemaItem, prop)
11382
- })]);
11383
- }) : h("td", [renderSchemaField({
10666
+ });
10667
+ }) : renderSchemaField({
11384
10668
  path: Path.getCurPath(_this.path, index),
11385
10669
  schema: dealSchema(((_this$schema5 = _this.schema) === null || _this$schema5 === void 0 ? void 0 : _this$schema5.items) || {}),
11386
10670
  layout: {},
11387
10671
  required: false
11388
- })]), h("td", {
11389
- "style": _objectSpread2({}, tdStyle)
11390
- }, [h("span", {
11391
- "style": _objectSpread2(_objectSpread2({}, labelBtnStyle), {}, {
11392
- marginBottom: '10px'
11393
- }),
10672
+ }), h("span", {
10673
+ "style": labelBtnStyle,
11394
10674
  "on": {
11395
10675
  "click": function click() {
11396
10676
  return _this.handleRemoveItem(index);
@@ -11398,7 +10678,7 @@
11398
10678
  }
11399
10679
  }, [h("i", {
11400
10680
  "class": "bk-icon icon-minus-line"
11401
- })])])]);
10681
+ })])]);
11402
10682
  }), h("span", {
11403
10683
  "on": {
11404
10684
  "click": this.handleAddItem
@@ -11406,7 +10686,7 @@
11406
10686
  "style": labelBtnStyle
11407
10687
  }, [h("i", {
11408
10688
  "class": "bk-icon icon-plus-line"
11409
- })])])]);
10689
+ })])]);
11410
10690
  }
11411
10691
  });
11412
10692
 
@@ -11706,7 +10986,7 @@
11706
10986
  options.fileObj.xhr = xhr;
11707
10987
  var formData = new FormData();
11708
10988
  options.data.forEach(function (item) {
11709
- formData.append(item.name, executeExpression(item.value, _this.$parent.$parent));
10989
+ formData.append(item.name, _executeExpression(item.value, _this.$parent.$parent));
11710
10990
  });
11711
10991
  formData.append(options.fileName, options.fileObj.origin);
11712
10992
  xhr.onreadystatechange = function () {
@@ -11729,12 +11009,12 @@
11729
11009
  if (Array.isArray(options.header)) {
11730
11010
  options.header.forEach(function (head) {
11731
11011
  var headerKey = head.name;
11732
- var headerVal = executeExpression(head.value, _this.$parent.$parent);
11012
+ var headerVal = _executeExpression(head.value, _this.$parent.$parent);
11733
11013
  xhr.setRequestHeader(headerKey, headerVal);
11734
11014
  });
11735
11015
  } else {
11736
11016
  var headerKey = options.header.name;
11737
- var headerVal = executeExpression(options.header.value, this.$parent.$parent);
11017
+ var headerVal = _executeExpression(options.header.value, this.$parent.$parent);
11738
11018
  xhr.setRequestHeader(headerKey, headerVal);
11739
11019
  }
11740
11020
  }
@@ -11758,13 +11038,13 @@
11758
11038
  handleResCode: function handleResCode(res) {
11759
11039
  var successed = true;
11760
11040
  if (this.isUploadSuccessed) {
11761
- successed = executeExpression(this.isUploadSuccessed, this.$parent.$parent, [], {
11041
+ successed = _executeExpression(this.isUploadSuccessed, this.$parent.$parent, [], {
11762
11042
  response: res
11763
11043
  });
11764
11044
  }
11765
11045
  if (!successed) return;
11766
11046
  if (this.responseHandler) {
11767
- var files = executeExpression(this.responseHandler, this.$parent.$parent, [], {
11047
+ var files = _executeExpression(this.responseHandler, this.$parent.$parent, [], {
11768
11048
  response: res
11769
11049
  });
11770
11050
  this.$emit('input', files);
@@ -12102,7 +11382,7 @@
12102
11382
  },
12103
11383
  methods: {
12104
11384
  initFormData: function initFormData() {
12105
- this.rootData = merge(Schema.getSchemaDefaultValue(createProxy(this.schema, this)) || {}, this.value);
11385
+ this.rootData = _merge(Schema.getSchemaDefaultValue(createProxy(this.schema, this)) || {}, this.value);
12106
11386
  this.emitFormValueChange(this.rootData, this.value);
12107
11387
  },
12108
11388
  emitFormValueChange: function emitFormValueChange(newValue, oldValue) {