@blueking/bkui-form 0.0.48 → 0.0.50

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,311 +198,118 @@
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;
205
205
  }
206
- function _regeneratorRuntime() {
207
- _regeneratorRuntime = function () {
208
- return e;
209
- };
210
- var t,
211
- e = {},
212
- r = Object.prototype,
213
- n = r.hasOwnProperty,
214
- o = Object.defineProperty || function (t, e, r) {
215
- t[e] = r.value;
216
- },
217
- i = "function" == typeof Symbol ? Symbol : {},
218
- a = i.iterator || "@@iterator",
219
- c = i.asyncIterator || "@@asyncIterator",
220
- u = i.toStringTag || "@@toStringTag";
221
- function define(t, e, r) {
222
- return Object.defineProperty(t, e, {
223
- value: r,
224
- enumerable: !0,
225
- configurable: !0,
226
- writable: !0
227
- }), t[e];
228
- }
229
- try {
230
- define({}, "");
231
- } catch (t) {
232
- define = function (t, e, r) {
233
- return t[e] = r;
234
- };
235
- }
236
- function wrap(t, e, r, n) {
237
- var i = e && e.prototype instanceof Generator ? e : Generator,
238
- a = Object.create(i.prototype),
239
- c = new Context(n || []);
240
- return o(a, "_invoke", {
241
- value: makeInvokeMethod(t, r, c)
242
- }), a;
243
- }
244
- function tryCatch(t, e, r) {
245
- try {
246
- return {
247
- type: "normal",
248
- arg: t.call(e, r)
249
- };
250
- } catch (t) {
251
- return {
252
- type: "throw",
253
- arg: t
254
- };
255
- }
256
- }
257
- e.wrap = wrap;
258
- var h = "suspendedStart",
259
- l = "suspendedYield",
260
- f = "executing",
261
- s = "completed",
262
- y = {};
263
- function Generator() {}
264
- function GeneratorFunction() {}
265
- function GeneratorFunctionPrototype() {}
266
- var p = {};
267
- define(p, a, function () {
268
- return this;
269
- });
270
- var d = Object.getPrototypeOf,
271
- v = d && d(d(values([])));
272
- v && v !== r && n.call(v, a) && (p = v);
273
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
274
- function defineIteratorMethods(t) {
275
- ["next", "throw", "return"].forEach(function (e) {
276
- define(t, e, function (t) {
277
- return this._invoke(e, t);
278
- });
279
- });
280
- }
281
- function AsyncIterator(t, e) {
282
- function invoke(r, o, i, a) {
283
- var c = tryCatch(t[r], t, o);
284
- if ("throw" !== c.type) {
285
- var u = c.arg,
286
- h = u.value;
287
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
288
- invoke("next", t, i, a);
289
- }, function (t) {
290
- invoke("throw", t, i, a);
291
- }) : e.resolve(h).then(function (t) {
292
- u.value = t, i(u);
293
- }, function (t) {
294
- return invoke("throw", t, i, a);
295
- });
206
+ function _regenerator() {
207
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
208
+ var e,
209
+ t,
210
+ r = "function" == typeof Symbol ? Symbol : {},
211
+ n = r.iterator || "@@iterator",
212
+ o = r.toStringTag || "@@toStringTag";
213
+ function i(r, n, o, i) {
214
+ var c = n && n.prototype instanceof Generator ? n : Generator,
215
+ u = Object.create(c.prototype);
216
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
217
+ var i,
218
+ c,
219
+ u,
220
+ f = 0,
221
+ p = o || [],
222
+ y = !1,
223
+ G = {
224
+ p: 0,
225
+ n: 0,
226
+ v: e,
227
+ a: d,
228
+ f: d.bind(e, 4),
229
+ d: function (t, r) {
230
+ return i = t, c = 0, u = e, G.n = r, a;
231
+ }
232
+ };
233
+ function d(r, n) {
234
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
235
+ var o,
236
+ i = p[t],
237
+ d = G.p,
238
+ l = i[2];
239
+ r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
240
+ }
241
+ if (o || r > 1) return a;
242
+ throw y = !0, n;
296
243
  }
297
- a(c.arg);
298
- }
299
- var r;
300
- o(this, "_invoke", {
301
- value: function (t, n) {
302
- function callInvokeWithMethodAndArg() {
303
- return new e(function (e, r) {
304
- invoke(t, n, e, r);
305
- });
244
+ return function (o, p, l) {
245
+ if (f > 1) throw TypeError("Generator is already running");
246
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
247
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
248
+ try {
249
+ if (f = 2, i) {
250
+ if (c || (o = "next"), t = i[o]) {
251
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
252
+ if (!t.done) return t;
253
+ u = t.value, c < 2 && (c = 0);
254
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
255
+ i = e;
256
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
257
+ } catch (t) {
258
+ i = e, c = 1, u = t;
259
+ } finally {
260
+ f = 1;
261
+ }
306
262
  }
307
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
308
- }
309
- });
310
- }
311
- function makeInvokeMethod(e, r, n) {
312
- var o = h;
313
- return function (i, a) {
314
- if (o === f) throw Error("Generator is already running");
315
- if (o === s) {
316
- if ("throw" === i) throw a;
317
263
  return {
318
264
  value: t,
319
- done: !0
265
+ done: y
320
266
  };
321
- }
322
- for (n.method = i, n.arg = a;;) {
323
- var c = n.delegate;
324
- if (c) {
325
- var u = maybeInvokeDelegate(c, n);
326
- if (u) {
327
- if (u === y) continue;
328
- return u;
329
- }
330
- }
331
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
332
- if (o === h) throw o = s, n.arg;
333
- n.dispatchException(n.arg);
334
- } else "return" === n.method && n.abrupt("return", n.arg);
335
- o = f;
336
- var p = tryCatch(e, r, n);
337
- if ("normal" === p.type) {
338
- if (o = n.done ? s : l, p.arg === y) continue;
339
- return {
340
- value: p.arg,
341
- done: n.done
342
- };
343
- }
344
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
345
- }
346
- };
267
+ };
268
+ }(r, o, i), !0), u;
347
269
  }
348
- function maybeInvokeDelegate(e, r) {
349
- var n = r.method,
350
- o = e.iterator[n];
351
- if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
352
- var i = tryCatch(o, e.iterator, r.arg);
353
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
354
- var a = i.arg;
355
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
356
- }
357
- function pushTryEntry(t) {
358
- var e = {
359
- tryLoc: t[0]
360
- };
361
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
362
- }
363
- function resetTryEntry(t) {
364
- var e = t.completion || {};
365
- e.type = "normal", delete e.arg, t.completion = e;
366
- }
367
- function Context(t) {
368
- this.tryEntries = [{
369
- tryLoc: "root"
370
- }], t.forEach(pushTryEntry, this), this.reset(!0);
371
- }
372
- function values(e) {
373
- if (e || "" === e) {
374
- var r = e[a];
375
- if (r) return r.call(e);
376
- if ("function" == typeof e.next) return e;
377
- if (!isNaN(e.length)) {
378
- var o = -1,
379
- i = function next() {
380
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
381
- return next.value = t, next.done = !0, next;
382
- };
383
- return i.next = i;
384
- }
385
- }
386
- throw new TypeError(typeof e + " is not iterable");
387
- }
388
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
389
- value: GeneratorFunctionPrototype,
390
- configurable: !0
391
- }), o(GeneratorFunctionPrototype, "constructor", {
392
- value: GeneratorFunction,
393
- configurable: !0
394
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
395
- var e = "function" == typeof t && t.constructor;
396
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
397
- }, e.mark = function (t) {
398
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
399
- }, e.awrap = function (t) {
400
- return {
401
- __await: t
402
- };
403
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
404
- return this;
405
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
406
- void 0 === i && (i = Promise);
407
- var a = new AsyncIterator(wrap(t, r, n, o), i);
408
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
409
- return t.done ? t.value : a.next();
410
- });
411
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
270
+ var a = {};
271
+ function Generator() {}
272
+ function GeneratorFunction() {}
273
+ function GeneratorFunctionPrototype() {}
274
+ t = Object.getPrototypeOf;
275
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
276
+ return this;
277
+ }), t),
278
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
279
+ function f(e) {
280
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
281
+ }
282
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
412
283
  return this;
413
- }), define(g, "toString", function () {
284
+ }), _regeneratorDefine(u, "toString", function () {
414
285
  return "[object Generator]";
415
- }), e.keys = function (t) {
416
- var e = Object(t),
417
- r = [];
418
- for (var n in e) r.push(n);
419
- return r.reverse(), function next() {
420
- for (; r.length;) {
421
- var t = r.pop();
422
- if (t in e) return next.value = t, next.done = !1, next;
423
- }
424
- return next.done = !0, next;
286
+ }), (_regenerator = function () {
287
+ return {
288
+ w: i,
289
+ m: f
425
290
  };
426
- }, e.values = values, Context.prototype = {
427
- constructor: Context,
428
- reset: function (e) {
429
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
430
- },
431
- stop: function () {
432
- this.done = !0;
433
- var t = this.tryEntries[0].completion;
434
- if ("throw" === t.type) throw t.arg;
435
- return this.rval;
436
- },
437
- dispatchException: function (e) {
438
- if (this.done) throw e;
439
- var r = this;
440
- function handle(n, o) {
441
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
442
- }
443
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
444
- var i = this.tryEntries[o],
445
- a = i.completion;
446
- if ("root" === i.tryLoc) return handle("end");
447
- if (i.tryLoc <= this.prev) {
448
- var c = n.call(i, "catchLoc"),
449
- u = n.call(i, "finallyLoc");
450
- if (c && u) {
451
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
452
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
453
- } else if (c) {
454
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
455
- } else {
456
- if (!u) throw Error("try statement without catch or finally");
457
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
458
- }
459
- }
460
- }
461
- },
462
- abrupt: function (t, e) {
463
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
464
- var o = this.tryEntries[r];
465
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
466
- var i = o;
467
- break;
468
- }
469
- }
470
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
471
- var a = i ? i.completion : {};
472
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
473
- },
474
- complete: function (t, e) {
475
- if ("throw" === t.type) throw t.arg;
476
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
477
- },
478
- finish: function (t) {
479
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
480
- var r = this.tryEntries[e];
481
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
482
- }
483
- },
484
- catch: function (t) {
485
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
486
- var r = this.tryEntries[e];
487
- if (r.tryLoc === t) {
488
- var n = r.completion;
489
- if ("throw" === n.type) {
490
- var o = n.arg;
491
- resetTryEntry(r);
492
- }
493
- return o;
494
- }
495
- }
496
- throw Error("illegal catch attempt");
497
- },
498
- delegateYield: function (e, r, n) {
499
- return this.delegate = {
500
- iterator: values(e),
501
- resultName: r,
502
- nextLoc: n
503
- }, "next" === this.method && (this.arg = t), y;
291
+ })();
292
+ }
293
+ function _regeneratorDefine(e, r, n, t) {
294
+ var i = Object.defineProperty;
295
+ try {
296
+ i({}, "", {});
297
+ } catch (e) {
298
+ i = 0;
299
+ }
300
+ _regeneratorDefine = function (e, r, n, t) {
301
+ function o(r, n) {
302
+ _regeneratorDefine(e, r, function (e) {
303
+ return this._invoke(r, n, e);
304
+ });
504
305
  }
505
- }, e;
306
+ r ? i ? i(e, r, {
307
+ value: n,
308
+ enumerable: !t,
309
+ configurable: !t,
310
+ writable: !t
311
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
312
+ }, _regeneratorDefine(e, r, n, t);
506
313
  }
507
314
  function _slicedToArray(r, e) {
508
315
  return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
@@ -592,11 +399,11 @@
592
399
  }
593
400
  return _typeof(value);
594
401
  };
595
- var merge = function merge(target, source) {
402
+ var _merge = function merge(target, source) {
596
403
  if (isObj(source)) {
597
404
  return Object.keys(source).reduce(function (pre, key) {
598
405
  var _target;
599
- pre[key] = merge(((_target = target) === null || _target === void 0 ? void 0 : _target[key]) || {}, source[key]);
406
+ pre[key] = _merge(((_target = target) === null || _target === void 0 ? void 0 : _target[key]) || {}, source[key]);
600
407
  return pre;
601
408
  }, JSON.parse(JSON.stringify(target)));
602
409
  }
@@ -604,7 +411,7 @@
604
411
  target = Array.isArray(target) ? target : [];
605
412
  return source.map(function (item, index) {
606
413
  if (target[index]) {
607
- return merge(target[index], item);
414
+ return _merge(target[index], item);
608
415
  }
609
416
  return item;
610
417
  });
@@ -1375,8 +1182,8 @@
1375
1182
  headers: {},
1376
1183
  cache: 'no-cache'
1377
1184
  };
1378
- var request = ( /*#__PURE__*/(function () {
1379
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
1185
+ var request = (/*#__PURE__*/function () {
1186
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(url) {
1380
1187
  var config,
1381
1188
  _mergeDeep,
1382
1189
  params,
@@ -1397,9 +1204,11 @@
1397
1204
  labelKey,
1398
1205
  valueKey,
1399
1206
  data,
1400
- _args = arguments;
1401
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1402
- while (1) switch (_context.prev = _context.next) {
1207
+ _args = arguments,
1208
+ _t,
1209
+ _t2;
1210
+ return _regenerator().w(function (_context) {
1211
+ while (1) switch (_context.p = _context.n) {
1403
1212
  case 0:
1404
1213
  config = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
1405
1214
  _mergeDeep = mergeDeep(defaultConfig, config), params = _mergeDeep.params, _mergeDeep$responseTy = _mergeDeep.responseType, responseType = _mergeDeep$responseTy === void 0 ? 'json' : _mergeDeep$responseTy, _mergeDeep$method = _mergeDeep.method, method = _mergeDeep$method === void 0 ? 'GET' : _mergeDeep$method, _mergeDeep$headers = _mergeDeep.headers, headers = _mergeDeep$headers === void 0 ? {} : _mergeDeep$headers, responseParse = _mergeDeep.responseParse, reset = _objectWithoutProperties(_mergeDeep, _excluded$5);
@@ -1415,35 +1224,35 @@
1415
1224
  body = params;
1416
1225
  }
1417
1226
  }
1418
- _context.prev = 4;
1419
- _context.next = 7;
1227
+ _context.p = 1;
1228
+ _context.n = 2;
1420
1229
  return fetch(requestURL, _objectSpread2(_objectSpread2({}, reset), {}, {
1421
1230
  method: method.toLocaleUpperCase(),
1422
1231
  headers: headers,
1423
1232
  body: body
1424
1233
  }));
1425
- case 7:
1426
- response = _context.sent;
1234
+ case 2:
1235
+ response = _context.v;
1427
1236
  if (!response.ok) {
1428
- _context.next = 21;
1237
+ _context.n = 7;
1429
1238
  break;
1430
1239
  }
1431
- _context.next = 11;
1240
+ _context.n = 3;
1432
1241
  return response[responseType]();
1433
- case 11:
1434
- res = _context.sent;
1242
+ case 3:
1243
+ res = _context.v;
1435
1244
  if (!responseParse) {
1436
- _context.next = 20;
1245
+ _context.n = 6;
1437
1246
  break;
1438
1247
  }
1439
1248
  if (!(typeof responseParse === 'function')) {
1440
- _context.next = 15;
1249
+ _context.n = 4;
1441
1250
  break;
1442
1251
  }
1443
- return _context.abrupt("return", Promise.resolve(responseParse(res)));
1444
- case 15:
1252
+ return _context.a(2, Promise.resolve(responseParse(res)));
1253
+ case 4:
1445
1254
  if (!isObj(responseParse)) {
1446
- _context.next = 19;
1255
+ _context.n = 5;
1447
1256
  break;
1448
1257
  }
1449
1258
  _responseParse$dataKe = responseParse.dataKey, dataKey = _responseParse$dataKe === void 0 ? 'data' : _responseParse$dataKe, labelKey = responseParse.labelKey, valueKey = responseParse.valueKey;
@@ -1453,39 +1262,38 @@
1453
1262
  value: item === null || item === void 0 ? void 0 : item[valueKey]
1454
1263
  });
1455
1264
  });
1456
- return _context.abrupt("return", Promise.resolve(data));
1457
- case 19:
1458
- return _context.abrupt("return", Promise.resolve(res));
1459
- case 20:
1460
- return _context.abrupt("return", Promise.resolve(res));
1461
- case 21:
1462
- _context.t0 = response.status;
1463
- _context.next = _context.t0 === 400 ? 24 : _context.t0 === 401 ? 25 : _context.t0 === 403 ? 26 : _context.t0 === 500 ? 26 : 27;
1265
+ return _context.a(2, Promise.resolve(data));
1266
+ case 5:
1267
+ return _context.a(2, Promise.resolve(res));
1268
+ case 6:
1269
+ return _context.a(2, Promise.resolve(res));
1270
+ case 7:
1271
+ _t = response.status;
1272
+ _context.n = _t === 400 ? 8 : _t === 401 ? 9 : _t === 403 ? 10 : _t === 500 ? 10 : 11;
1464
1273
  break;
1465
- case 24:
1466
- return _context.abrupt("break", 27);
1467
- case 25:
1468
- return _context.abrupt("break", 27);
1469
- case 26:
1470
- return _context.abrupt("break", 27);
1471
- case 27:
1472
- _context.next = 33;
1274
+ case 8:
1275
+ return _context.a(3, 11);
1276
+ case 9:
1277
+ return _context.a(3, 11);
1278
+ case 10:
1279
+ return _context.a(3, 11);
1280
+ case 11:
1281
+ _context.n = 13;
1473
1282
  break;
1474
- case 29:
1475
- _context.prev = 29;
1476
- _context.t1 = _context["catch"](4);
1477
- console.error('Request Failed', _context.t1);
1478
- Promise.reject(_context.t1);
1479
- case 33:
1480
- case "end":
1481
- return _context.stop();
1283
+ case 12:
1284
+ _context.p = 12;
1285
+ _t2 = _context.v;
1286
+ console.error('Request Failed', _t2);
1287
+ Promise.reject(_t2);
1288
+ case 13:
1289
+ return _context.a(2);
1482
1290
  }
1483
- }, _callee, null, [[4, 29]]);
1291
+ }, _callee, null, [[1, 12]]);
1484
1292
  }));
1485
1293
  return function (_x) {
1486
1294
  return _ref.apply(this, arguments);
1487
1295
  };
1488
- })());
1296
+ }());
1489
1297
 
1490
1298
  var props$1 = {
1491
1299
  // 表单值
@@ -1722,7 +1530,7 @@
1722
1530
  }
1723
1531
  };
1724
1532
  };
1725
- var executeExpression = function executeExpression(expression, instance) {
1533
+ var _executeExpression = function executeExpression(expression, instance) {
1726
1534
  var $dep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
1727
1535
  var $args = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1728
1536
  var _getContext = getContext(instance),
@@ -1780,7 +1588,7 @@
1780
1588
  }
1781
1589
  if (isObj(expression)) {
1782
1590
  Object.keys(expression).forEach(function (key) {
1783
- expression[key] = executeExpression(expression[key], instance);
1591
+ expression[key] = _executeExpression(expression[key], instance);
1784
1592
  });
1785
1593
  return expression;
1786
1594
  }
@@ -1826,7 +1634,6 @@
1826
1634
  crtInstance = _ref.instance; // 当前组件实例,用来条件表达式判断
1827
1635
  var _ref2 = widgetTree.widgetMap[targetPath] || {},
1828
1636
  operateInstance = _ref2.instance; // 需要执行操作的组件实例,可能为其他组件也可能为当前组件
1829
- if (!crtInstance || !operateInstance) return;
1830
1637
  var fullfill = true;
1831
1638
  var deps = [];
1832
1639
  if (reaction.source) {
@@ -1836,33 +1643,39 @@
1836
1643
  deps.push(instance);
1837
1644
  });
1838
1645
  }
1839
- if (typeof reaction.if === 'string') {
1840
- fullfill = executeExpression(reaction.if, crtInstance, deps);
1646
+ if (typeof reaction.if === 'string' && crtInstance) {
1647
+ fullfill = _executeExpression(reaction.if, crtInstance, deps);
1841
1648
  }
1842
1649
  var operations = fullfill ? reaction.then : reaction.else;
1843
- executeOperations(operations, operateInstance, deps);
1650
+ operateInstance && executeOperations(operations, operateInstance, deps);
1844
1651
  };
1845
1652
  };
1653
+ /**
1654
+ * 执行操作
1655
+ * @param operations
1656
+ * @param instance
1657
+ * @param deps
1658
+ */
1846
1659
  var executeOperations = function executeOperations(operations, instance, deps) {
1847
1660
  if (operations) {
1848
1661
  if (operations.state) {
1849
1662
  Object.keys(operations.state).forEach(function (key) {
1850
1663
  var val = operations.state[key];
1851
1664
  if (typeof val === 'string' && /^{{.+}}$/.test(val.trim())) {
1852
- val = executeExpression(val, instance, deps);
1665
+ val = _executeExpression(val, instance, deps);
1853
1666
  }
1854
1667
  instance.setState(key, val);
1855
1668
  });
1856
1669
  }
1857
1670
  if (Array.isArray(operations.actions)) {
1858
1671
  operations.actions.forEach(function (item) {
1859
- executeExpression(item, instance, deps);
1672
+ _executeExpression(item, instance, deps);
1860
1673
  });
1861
1674
  }
1862
1675
  }
1863
1676
  };
1864
1677
  var parsePath = function parsePath(path, instance) {
1865
- return isExpression(path) ? executeExpression(path, instance) : path;
1678
+ return isExpression(path) ? _executeExpression(path, instance) : path;
1866
1679
  };
1867
1680
  var reactionRegister = function reactionRegister(path) {
1868
1681
  var reactions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
@@ -1915,8 +1728,6 @@
1915
1728
  }
1916
1729
  };
1917
1730
 
1918
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
1919
-
1920
1731
  function getDefaultExportFromCjs (x) {
1921
1732
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1922
1733
  }
@@ -1938,6 +1749,7 @@
1938
1749
  (function (exports) {
1939
1750
  Object.defineProperty(exports, "__esModule", { value: true });
1940
1751
  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;
1752
+ // eslint-disable-next-line @typescript-eslint/no-extraneous-class
1941
1753
  class _CodeOrName {
1942
1754
  }
1943
1755
  exports._CodeOrName = _CodeOrName;
@@ -3946,7 +3758,7 @@
3946
3758
  }
3947
3759
  subschema.extendSubschemaMode = extendSubschemaMode;
3948
3760
 
3949
- var resolve$1 = {};
3761
+ var resolve$2 = {};
3950
3762
 
3951
3763
  // do not edit .js files directly - edit src/index.jst
3952
3764
 
@@ -4087,10 +3899,10 @@
4087
3899
  return str.replace(/~/g, '~0').replace(/\//g, '~1');
4088
3900
  }
4089
3901
 
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;
3902
+ Object.defineProperty(resolve$2, "__esModule", { value: true });
3903
+ resolve$2.getSchemaRefs = resolve$2.resolveUrl = resolve$2.normalizeId = resolve$2._getFullPath = resolve$2.getFullPath = resolve$2.inlineRef = void 0;
4092
3904
  const util_1$m = util;
4093
- const equal$2 = fastDeepEqual;
3905
+ const equal$3 = fastDeepEqual;
4094
3906
  const traverse = jsonSchemaTraverse.exports;
4095
3907
  // TODO refactor to use keyword definitions
4096
3908
  const SIMPLE_INLINED = new Set([
@@ -4120,7 +3932,7 @@
4120
3932
  return false;
4121
3933
  return countKeys(schema) <= limit;
4122
3934
  }
4123
- resolve$1.inlineRef = inlineRef;
3935
+ resolve$2.inlineRef = inlineRef;
4124
3936
  const REF_KEYWORDS = new Set([
4125
3937
  "$ref",
4126
3938
  "$recursiveRef",
@@ -4162,22 +3974,22 @@
4162
3974
  const p = resolver.parse(id);
4163
3975
  return _getFullPath(resolver, p);
4164
3976
  }
4165
- resolve$1.getFullPath = getFullPath;
3977
+ resolve$2.getFullPath = getFullPath;
4166
3978
  function _getFullPath(resolver, p) {
4167
3979
  const serialized = resolver.serialize(p);
4168
3980
  return serialized.split("#")[0] + "#";
4169
3981
  }
4170
- resolve$1._getFullPath = _getFullPath;
3982
+ resolve$2._getFullPath = _getFullPath;
4171
3983
  const TRAILING_SLASH_HASH = /#\/?$/;
4172
3984
  function normalizeId(id) {
4173
3985
  return id ? id.replace(TRAILING_SLASH_HASH, "") : "";
4174
3986
  }
4175
- resolve$1.normalizeId = normalizeId;
3987
+ resolve$2.normalizeId = normalizeId;
4176
3988
  function resolveUrl(resolver, baseId, id) {
4177
3989
  id = normalizeId(id);
4178
3990
  return resolver.resolve(baseId, id);
4179
3991
  }
4180
- resolve$1.resolveUrl = resolveUrl;
3992
+ resolve$2.resolveUrl = resolveUrl;
4181
3993
  const ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
4182
3994
  function getSchemaRefs(schema, baseId) {
4183
3995
  if (typeof schema == "boolean")
@@ -4232,14 +4044,14 @@
4232
4044
  });
4233
4045
  return localRefs;
4234
4046
  function checkAmbiguosRef(sch1, sch2, ref) {
4235
- if (sch2 !== undefined && !equal$2(sch1, sch2))
4047
+ if (sch2 !== undefined && !equal$3(sch1, sch2))
4236
4048
  throw ambiguos(ref);
4237
4049
  }
4238
4050
  function ambiguos(ref) {
4239
4051
  return new Error(`reference "${ref}" resolves to more than one schema`);
4240
4052
  }
4241
4053
  }
4242
- resolve$1.getSchemaRefs = getSchemaRefs;
4054
+ resolve$2.getSchemaRefs = getSchemaRefs;
4243
4055
 
4244
4056
  Object.defineProperty(validate$1, "__esModule", { value: true });
4245
4057
  validate$1.getData = validate$1.KeywordCxt = validate$1.validateFunctionCode = void 0;
@@ -4252,7 +4064,7 @@
4252
4064
  const subschema_1 = subschema;
4253
4065
  const codegen_1$n = codegen;
4254
4066
  const names_1$3 = names$1;
4255
- const resolve_1$2 = resolve$1;
4067
+ const resolve_1$2 = resolve$2;
4256
4068
  const util_1$l = util;
4257
4069
  const errors_1 = errors;
4258
4070
  // schema compilation - generates validation function, subschemaCode (below) is used for subschemas
@@ -4774,7 +4586,7 @@
4774
4586
  var ref_error = {};
4775
4587
 
4776
4588
  Object.defineProperty(ref_error, "__esModule", { value: true });
4777
- const resolve_1$1 = resolve$1;
4589
+ const resolve_1$1 = resolve$2;
4778
4590
  class MissingRefError extends Error {
4779
4591
  constructor(resolver, baseId, ref, msg) {
4780
4592
  super(msg || `can't resolve reference ${ref} from id ${baseId}`);
@@ -4791,7 +4603,7 @@
4791
4603
  const codegen_1$m = codegen;
4792
4604
  const validation_error_1 = validation_error;
4793
4605
  const names_1$2 = names$1;
4794
- const resolve_1 = resolve$1;
4606
+ const resolve_1 = resolve$2;
4795
4607
  const util_1$k = util;
4796
4608
  const validate_1$1 = validate$1;
4797
4609
  class SchemaEnv {
@@ -4917,7 +4729,7 @@
4917
4729
  const schOrFunc = root.refs[ref];
4918
4730
  if (schOrFunc)
4919
4731
  return schOrFunc;
4920
- let _sch = resolve.call(this, root, ref);
4732
+ let _sch = resolve$1.call(this, root, ref);
4921
4733
  if (_sch === undefined) {
4922
4734
  const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv
4923
4735
  const { schemaId } = this.opts;
@@ -4947,7 +4759,7 @@
4947
4759
  }
4948
4760
  // resolve and compile the references ($ref)
4949
4761
  // 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
4762
+ function resolve$1(root, // information about the root schema for the current schema
4951
4763
  ref // reference to resolve
4952
4764
  ) {
4953
4765
  let sch;
@@ -5058,1416 +4870,770 @@
5058
4870
 
5059
4871
  var uri$1 = {};
5060
4872
 
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
- };
4873
+ var fastUri$1 = {exports: {}};
4874
+
4875
+ const HEX$1 = {
4876
+ 0: 0,
4877
+ 1: 1,
4878
+ 2: 2,
4879
+ 3: 3,
4880
+ 4: 4,
4881
+ 5: 5,
4882
+ 6: 6,
4883
+ 7: 7,
4884
+ 8: 8,
4885
+ 9: 9,
4886
+ a: 10,
4887
+ A: 10,
4888
+ b: 11,
4889
+ B: 11,
4890
+ c: 12,
4891
+ C: 12,
4892
+ d: 13,
4893
+ D: 13,
4894
+ e: 14,
4895
+ E: 14,
4896
+ f: 15,
4897
+ F: 15
4898
+ };
4899
+
4900
+ var scopedChars = {
4901
+ HEX: HEX$1
4902
+ };
4903
+
4904
+ const { HEX } = scopedChars;
4905
+
4906
+ 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;
4907
+
4908
+ function normalizeIPv4$1 (host) {
4909
+ if (findToken(host, '.') < 3) { return { host, isIPV4: false } }
4910
+ const matches = host.match(IPV4_REG) || [];
4911
+ const [address] = matches;
4912
+ if (address) {
4913
+ return { host: stripLeadingZeros(address, '.'), isIPV4: true }
4914
+ } else {
4915
+ return { host, isIPV4: false }
4916
+ }
5171
4917
  }
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
4918
 
5183
- try {
5184
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
5185
- _arr.push(_s.value);
4919
+ /**
4920
+ * @param {string[]} input
4921
+ * @param {boolean} [keepZero=false]
4922
+ * @returns {string|undefined}
4923
+ */
4924
+ function stringArrayToHexStripped (input, keepZero = false) {
4925
+ let acc = '';
4926
+ let strip = true;
4927
+ for (const c of input) {
4928
+ if (HEX[c] === undefined) return undefined
4929
+ if (c !== '0' && strip === true) strip = false;
4930
+ if (!strip) acc += c;
4931
+ }
4932
+ if (keepZero && acc.length === 0) acc = '0';
4933
+ return acc
4934
+ }
4935
+
4936
+ function getIPV6 (input) {
4937
+ let tokenCount = 0;
4938
+ const output = { error: false, address: '', zone: '' };
4939
+ const address = [];
4940
+ const buffer = [];
4941
+ let isZone = false;
4942
+ let endipv6Encountered = false;
4943
+ let endIpv6 = false;
4944
+
4945
+ function consume () {
4946
+ if (buffer.length) {
4947
+ if (isZone === false) {
4948
+ const hex = stringArrayToHexStripped(buffer);
4949
+ if (hex !== undefined) {
4950
+ address.push(hex);
4951
+ } else {
4952
+ output.error = true;
4953
+ return false
4954
+ }
4955
+ }
4956
+ buffer.length = 0;
4957
+ }
4958
+ return true
4959
+ }
5186
4960
 
5187
- if (i && _arr.length === i) break;
4961
+ for (let i = 0; i < input.length; i++) {
4962
+ const cursor = input[i];
4963
+ if (cursor === '[' || cursor === ']') { continue }
4964
+ if (cursor === ':') {
4965
+ if (endipv6Encountered === true) {
4966
+ endIpv6 = true;
5188
4967
  }
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;
4968
+ if (!consume()) { break }
4969
+ tokenCount++;
4970
+ address.push(':');
4971
+ if (tokenCount > 7) {
4972
+ // not valid
4973
+ output.error = true;
4974
+ break
4975
+ }
4976
+ if (i - 1 >= 0 && input[i - 1] === ':') {
4977
+ endipv6Encountered = true;
5197
4978
  }
4979
+ continue
4980
+ } else if (cursor === '%') {
4981
+ if (!consume()) { break }
4982
+ // switch to zone detection
4983
+ isZone = true;
4984
+ } else {
4985
+ buffer.push(cursor);
4986
+ continue
5198
4987
  }
5199
-
5200
- return _arr;
5201
4988
  }
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);
4989
+ if (buffer.length) {
4990
+ if (isZone) {
4991
+ output.zone = buffer.join('');
4992
+ } else if (endIpv6) {
4993
+ address.push(buffer.join(''));
5208
4994
  } else {
5209
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
4995
+ address.push(stringArrayToHexStripped(buffer));
5210
4996
  }
5211
- };
5212
- }();
5213
-
5214
-
5215
-
5216
-
5217
-
5218
-
5219
-
5220
-
5221
-
5222
-
5223
-
5224
-
4997
+ }
4998
+ output.address = address.join('');
4999
+ return output
5000
+ }
5225
5001
 
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];
5002
+ function normalizeIPv6$1 (host) {
5003
+ if (findToken(host, ':') < 2) { return { host, isIPV6: false } }
5004
+ const ipv6 = getIPV6(host);
5229
5005
 
5230
- return arr2;
5006
+ if (!ipv6.error) {
5007
+ let newHost = ipv6.address;
5008
+ let escapedHost = ipv6.address;
5009
+ if (ipv6.zone) {
5010
+ newHost += '%' + ipv6.zone;
5011
+ escapedHost += '%25' + ipv6.zone;
5012
+ }
5013
+ return { host: newHost, escapedHost, isIPV6: true }
5231
5014
  } else {
5232
- return Array.from(arr);
5015
+ return { host, isIPV6: false }
5233
5016
  }
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
5017
  }
5278
5018
 
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;
5019
+ function stripLeadingZeros (str, token) {
5020
+ let out = '';
5021
+ let skip = true;
5022
+ const l = str.length;
5023
+ for (let i = 0; i < l; i++) {
5024
+ const c = str[i];
5025
+ if (c === '0' && skip) {
5026
+ if ((i + 1 <= l && str[i + 1] === token) || i + 1 === l) {
5027
+ out += c;
5028
+ skip = false;
5029
+ }
5030
+ } else {
5031
+ if (c === token) {
5032
+ skip = true;
5033
+ } else {
5034
+ skip = false;
5035
+ }
5036
+ out += c;
5037
+ }
5038
+ }
5039
+ return out
5294
5040
  }
5295
5041
 
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;
5042
+ function findToken (str, token) {
5043
+ let ind = 0;
5044
+ for (let i = 0; i < str.length; i++) {
5045
+ if (str[i] === token) ind++;
5046
+ }
5047
+ return ind
5048
+ }
5049
+
5050
+ const RDS1 = /^\.\.?\//u;
5051
+ const RDS2 = /^\/\.(?:\/|$)/u;
5052
+ const RDS3 = /^\/\.\.(?:\/|$)/u;
5053
+ const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/u;
5054
+
5055
+ function removeDotSegments$1 (input) {
5056
+ const output = [];
5057
+
5058
+ while (input.length) {
5059
+ if (input.match(RDS1)) {
5060
+ input = input.replace(RDS1, '');
5061
+ } else if (input.match(RDS2)) {
5062
+ input = input.replace(RDS2, '/');
5063
+ } else if (input.match(RDS3)) {
5064
+ input = input.replace(RDS3, '/');
5065
+ output.pop();
5066
+ } else if (input === '.' || input === '..') {
5067
+ input = '';
5068
+ } else {
5069
+ const im = input.match(RDS5);
5070
+ if (im) {
5071
+ const s = im[0];
5072
+ input = input.slice(s.length);
5073
+ output.push(s);
5074
+ } else {
5075
+ throw new Error('Unexpected dot segment condition')
5076
+ }
5077
+ }
5078
+ }
5079
+ return output.join('')
5320
5080
  }
5321
5081
 
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;
5082
+ function normalizeComponentEncoding$1 (components, esc) {
5083
+ const func = esc !== true ? escape : unescape;
5084
+ if (components.scheme !== undefined) {
5085
+ components.scheme = func(components.scheme);
5086
+ }
5087
+ if (components.userinfo !== undefined) {
5088
+ components.userinfo = func(components.userinfo);
5089
+ }
5090
+ if (components.host !== undefined) {
5091
+ components.host = func(components.host);
5092
+ }
5093
+ if (components.path !== undefined) {
5094
+ components.path = func(components.path);
5095
+ }
5096
+ if (components.query !== undefined) {
5097
+ components.query = func(components.query);
5098
+ }
5099
+ if (components.fragment !== undefined) {
5100
+ components.fragment = func(components.fragment);
5101
+ }
5102
+ return components
5358
5103
  }
5359
5104
 
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
- };
5425
-
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
- }
5105
+ function recomposeAuthority$1 (components) {
5106
+ const uriTokens = [];
5457
5107
 
5458
- // Main decoding loop: start just after the last delimiter if any basic code
5459
- // points were copied; start at the beginning otherwise.
5108
+ if (components.userinfo !== undefined) {
5109
+ uriTokens.push(components.userinfo);
5110
+ uriTokens.push('@');
5111
+ }
5460
5112
 
5461
- for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{
5113
+ if (components.host !== undefined) {
5114
+ let host = unescape(components.host);
5115
+ const ipV4res = normalizeIPv4$1(host);
5462
5116
 
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) {
5117
+ if (ipV4res.isIPV4) {
5118
+ host = ipV4res.host;
5119
+ } else {
5120
+ const ipV6res = normalizeIPv6$1(ipV4res.host);
5121
+ if (ipV6res.isIPV6 === true) {
5122
+ host = `[${ipV6res.escapedHost}]`;
5123
+ } else {
5124
+ host = components.host;
5125
+ }
5126
+ }
5127
+ uriTokens.push(host);
5128
+ }
5470
5129
 
5471
- if (index >= inputLength) {
5472
- error$1('invalid-input');
5473
- }
5130
+ if (typeof components.port === 'number' || typeof components.port === 'string') {
5131
+ uriTokens.push(':');
5132
+ uriTokens.push(String(components.port));
5133
+ }
5474
5134
 
5475
- var digit = basicToDigit(input.charCodeAt(index++));
5135
+ return uriTokens.length ? uriTokens.join('') : undefined
5136
+ }
5137
+ var utils = {
5138
+ recomposeAuthority: recomposeAuthority$1,
5139
+ normalizeComponentEncoding: normalizeComponentEncoding$1,
5140
+ removeDotSegments: removeDotSegments$1,
5141
+ normalizeIPv4: normalizeIPv4$1,
5142
+ normalizeIPv6: normalizeIPv6$1,
5143
+ stringArrayToHexStripped
5144
+ };
5476
5145
 
5477
- if (digit >= base || digit > floor((maxInt - i) / w)) {
5478
- error$1('overflow');
5479
- }
5146
+ const UUID_REG = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu;
5147
+ const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
5480
5148
 
5481
- i += digit * w;
5482
- var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
5149
+ function isSecure (wsComponents) {
5150
+ return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === 'wss'
5151
+ }
5483
5152
 
5484
- if (digit < t) {
5485
- break;
5486
- }
5153
+ function httpParse (components) {
5154
+ if (!components.host) {
5155
+ components.error = components.error || 'HTTP URIs must have a host.';
5156
+ }
5487
5157
 
5488
- var baseMinusT = base - t;
5489
- if (w > floor(maxInt / baseMinusT)) {
5490
- error$1('overflow');
5491
- }
5158
+ return components
5159
+ }
5492
5160
 
5493
- w *= baseMinusT;
5494
- }
5161
+ function httpSerialize (components) {
5162
+ const secure = String(components.scheme).toLowerCase() === 'https';
5495
5163
 
5496
- var out = output.length + 1;
5497
- bias = adapt(i - oldi, out, oldi == 0);
5164
+ // normalize the default port
5165
+ if (components.port === (secure ? 443 : 80) || components.port === '') {
5166
+ components.port = undefined;
5167
+ }
5498
5168
 
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
- }
5169
+ // normalize the empty path
5170
+ if (!components.path) {
5171
+ components.path = '/';
5172
+ }
5504
5173
 
5505
- n += floor(i / out);
5506
- i %= out;
5174
+ // NOTE: We do not parse query strings for HTTP URIs
5175
+ // as WWW Form Url Encoded query strings are part of the HTML4+ spec,
5176
+ // and not the HTTP spec.
5507
5177
 
5508
- // Insert `n` at position `i` of the output.
5509
- output.splice(i++, 0, n);
5510
- }
5178
+ return components
5179
+ }
5511
5180
 
5512
- return String.fromCodePoint.apply(String, output);
5513
- };
5181
+ function wsParse (wsComponents) {
5182
+ // indicate if the secure flag is set
5183
+ wsComponents.secure = isSecure(wsComponents);
5514
5184
 
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 = [];
5185
+ // construct resouce name
5186
+ wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
5187
+ wsComponents.path = undefined;
5188
+ wsComponents.query = undefined;
5524
5189
 
5525
- // Convert the input in UCS-2 to an array of Unicode code points.
5526
- input = ucs2decode(input);
5190
+ return wsComponents
5191
+ }
5527
5192
 
5528
- // Cache the length.
5529
- var inputLength = input.length;
5193
+ function wsSerialize (wsComponents) {
5194
+ // normalize the default port
5195
+ if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === '') {
5196
+ wsComponents.port = undefined;
5197
+ }
5530
5198
 
5531
- // Initialize the state.
5532
- var n = initialN;
5533
- var delta = 0;
5534
- var bias = initialBias;
5199
+ // ensure scheme matches secure flag
5200
+ if (typeof wsComponents.secure === 'boolean') {
5201
+ wsComponents.scheme = (wsComponents.secure ? 'wss' : 'ws');
5202
+ wsComponents.secure = undefined;
5203
+ }
5535
5204
 
5536
- // Handle the basic code points.
5537
- var _iteratorNormalCompletion = true;
5538
- var _didIteratorError = false;
5539
- var _iteratorError = undefined;
5205
+ // reconstruct path from resource name
5206
+ if (wsComponents.resourceName) {
5207
+ const [path, query] = wsComponents.resourceName.split('?');
5208
+ wsComponents.path = (path && path !== '/' ? path : undefined);
5209
+ wsComponents.query = query;
5210
+ wsComponents.resourceName = undefined;
5211
+ }
5540
5212
 
5541
- try {
5542
- for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
5543
- var _currentValue2 = _step.value;
5213
+ // forbid fragment component
5214
+ wsComponents.fragment = undefined;
5544
5215
 
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
- }
5216
+ return wsComponents
5217
+ }
5563
5218
 
5564
- var basicLength = output.length;
5565
- var handledCPCount = basicLength;
5219
+ function urnParse (urnComponents, options) {
5220
+ if (!urnComponents.path) {
5221
+ urnComponents.error = 'URN can not be parsed';
5222
+ return urnComponents
5223
+ }
5224
+ const matches = urnComponents.path.match(URN_REG);
5225
+ if (matches) {
5226
+ const scheme = options.scheme || urnComponents.scheme || 'urn';
5227
+ urnComponents.nid = matches[1].toLowerCase();
5228
+ urnComponents.nss = matches[2];
5229
+ const urnScheme = `${scheme}:${options.nid || urnComponents.nid}`;
5230
+ const schemeHandler = SCHEMES$1[urnScheme];
5231
+ urnComponents.path = undefined;
5232
+
5233
+ if (schemeHandler) {
5234
+ urnComponents = schemeHandler.parse(urnComponents, options);
5235
+ }
5236
+ } else {
5237
+ urnComponents.error = urnComponents.error || 'URN can not be parsed.';
5238
+ }
5566
5239
 
5567
- // `handledCPCount` is the number of code points that have been handled;
5568
- // `basicLength` is the number of basic code points.
5240
+ return urnComponents
5241
+ }
5569
5242
 
5570
- // Finish the basic string with a delimiter unless it's empty.
5571
- if (basicLength) {
5572
- output.push(delimiter);
5573
- }
5243
+ function urnSerialize (urnComponents, options) {
5244
+ const scheme = options.scheme || urnComponents.scheme || 'urn';
5245
+ const nid = urnComponents.nid.toLowerCase();
5246
+ const urnScheme = `${scheme}:${options.nid || nid}`;
5247
+ const schemeHandler = SCHEMES$1[urnScheme];
5574
5248
 
5575
- // Main encoding loop:
5576
- while (handledCPCount < inputLength) {
5249
+ if (schemeHandler) {
5250
+ urnComponents = schemeHandler.serialize(urnComponents, options);
5251
+ }
5577
5252
 
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;
5253
+ const uriComponents = urnComponents;
5254
+ const nss = urnComponents.nss;
5255
+ uriComponents.path = `${nid || options.nid}:${nss}`;
5584
5256
 
5585
- try {
5586
- for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
5587
- var currentValue = _step2.value;
5257
+ options.skipEscape = true;
5258
+ return uriComponents
5259
+ }
5588
5260
 
5589
- if (currentValue >= n && currentValue < m) {
5590
- m = currentValue;
5591
- }
5592
- }
5261
+ function urnuuidParse (urnComponents, options) {
5262
+ const uuidComponents = urnComponents;
5263
+ uuidComponents.uuid = uuidComponents.nss;
5264
+ uuidComponents.nss = undefined;
5593
5265
 
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
- }
5266
+ if (!options.tolerant && (!uuidComponents.uuid || !UUID_REG.test(uuidComponents.uuid))) {
5267
+ uuidComponents.error = uuidComponents.error || 'UUID is not valid.';
5268
+ }
5610
5269
 
5611
- var handledCPCountPlusOne = handledCPCount + 1;
5612
- if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
5613
- error$1('overflow');
5614
- }
5270
+ return uuidComponents
5271
+ }
5615
5272
 
5616
- delta += (m - n) * handledCPCountPlusOne;
5617
- n = m;
5273
+ function urnuuidSerialize (uuidComponents) {
5274
+ const urnComponents = uuidComponents;
5275
+ // normalize UUID
5276
+ urnComponents.nss = (uuidComponents.uuid || '').toLowerCase();
5277
+ return urnComponents
5278
+ }
5618
5279
 
5619
- var _iteratorNormalCompletion3 = true;
5620
- var _didIteratorError3 = false;
5621
- var _iteratorError3 = undefined;
5280
+ const http = {
5281
+ scheme: 'http',
5282
+ domainHost: true,
5283
+ parse: httpParse,
5284
+ serialize: httpSerialize
5285
+ };
5622
5286
 
5623
- try {
5624
- for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
5625
- var _currentValue = _step3.value;
5287
+ const https = {
5288
+ scheme: 'https',
5289
+ domainHost: http.domainHost,
5290
+ parse: httpParse,
5291
+ serialize: httpSerialize
5292
+ };
5626
5293
 
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
- }
5294
+ const ws = {
5295
+ scheme: 'ws',
5296
+ domainHost: true,
5297
+ parse: wsParse,
5298
+ serialize: wsSerialize
5299
+ };
5664
5300
 
5665
- ++delta;
5666
- ++n;
5667
- }
5668
- return output.join('');
5301
+ const wss = {
5302
+ scheme: 'wss',
5303
+ domainHost: ws.domainHost,
5304
+ parse: ws.parse,
5305
+ serialize: ws.serialize
5669
5306
  };
5670
5307
 
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
- });
5308
+ const urn = {
5309
+ scheme: 'urn',
5310
+ parse: urnParse,
5311
+ serialize: urnSerialize,
5312
+ skipNormalize: true
5686
5313
  };
5687
5314
 
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
- });
5315
+ const urnuuid = {
5316
+ scheme: 'urn:uuid',
5317
+ parse: urnuuidParse,
5318
+ serialize: urnuuidSerialize,
5319
+ skipNormalize: true
5703
5320
  };
5704
5321
 
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
5322
+ const SCHEMES$1 = {
5323
+ http,
5324
+ https,
5325
+ ws,
5326
+ wss,
5327
+ urn,
5328
+ 'urn:uuid': urnuuid
5730
5329
  };
5731
5330
 
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
- }
5331
+ var schemes = SCHEMES$1;
5332
+
5333
+ const { normalizeIPv6, normalizeIPv4, removeDotSegments, recomposeAuthority, normalizeComponentEncoding } = utils;
5334
+ const SCHEMES = schemes;
5819
5335
 
5820
- function _stripLeadingZeros(str) {
5821
- return str.replace(/^0*(.*)/, "$1") || "0";
5336
+ function normalize (uri, options) {
5337
+ if (typeof uri === 'string') {
5338
+ uri = serialize(parse(uri, options), options);
5339
+ } else if (typeof uri === 'object') {
5340
+ uri = parse(serialize(uri, options), options);
5341
+ }
5342
+ return uri
5822
5343
  }
5823
- function _normalizeIPv4(host, protocol) {
5824
- var matches = host.match(protocol.IPV4ADDRESS) || [];
5825
5344
 
5826
- var _matches = slicedToArray(matches, 2),
5827
- address = _matches[1];
5345
+ function resolve (baseURI, relativeURI, options) {
5346
+ const schemelessOptions = Object.assign({ scheme: 'null' }, options);
5347
+ const resolved = resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true);
5348
+ return serialize(resolved, { ...schemelessOptions, skipEscape: true })
5349
+ }
5828
5350
 
5829
- if (address) {
5830
- return address.split(".").map(_stripLeadingZeros).join(".");
5351
+ function resolveComponents (base, relative, options, skipNormalization) {
5352
+ const target = {};
5353
+ if (!skipNormalization) {
5354
+ base = parse(serialize(base, options), options); // normalize base components
5355
+ relative = parse(serialize(relative, options), options); // normalize relative components
5356
+ }
5357
+ options = options || {};
5358
+
5359
+ if (!options.tolerant && relative.scheme) {
5360
+ target.scheme = relative.scheme;
5361
+ // target.authority = relative.authority;
5362
+ target.userinfo = relative.userinfo;
5363
+ target.host = relative.host;
5364
+ target.port = relative.port;
5365
+ target.path = removeDotSegments(relative.path || '');
5366
+ target.query = relative.query;
5367
+ } else {
5368
+ if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
5369
+ // target.authority = relative.authority;
5370
+ target.userinfo = relative.userinfo;
5371
+ target.host = relative.host;
5372
+ target.port = relative.port;
5373
+ target.path = removeDotSegments(relative.path || '');
5374
+ target.query = relative.query;
5831
5375
  } 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(":");
5376
+ if (!relative.path) {
5377
+ target.path = base.path;
5378
+ if (relative.query !== undefined) {
5379
+ target.query = relative.query;
5879
5380
  } else {
5880
- newHost = fields.join(":");
5381
+ target.query = base.query;
5881
5382
  }
5882
- if (zone) {
5883
- newHost += "%" + zone;
5884
- }
5885
- return newHost;
5886
- } 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
- }
5913
- } 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
- }
5927
- }
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);
5383
+ } else {
5384
+ if (relative.path.charAt(0) === '/') {
5385
+ target.path = removeDotSegments(relative.path);
5961
5386
  } else {
5962
- //normalize encodings
5963
- _normalizeComponentEncoding(components, protocol);
5964
- }
5965
- //perform scheme specific parsing
5966
- if (schemeHandler && schemeHandler.parse) {
5967
- schemeHandler.parse(components, options);
5387
+ if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
5388
+ target.path = '/' + relative.path;
5389
+ } else if (!base.path) {
5390
+ target.path = relative.path;
5391
+ } else {
5392
+ target.path = base.path.slice(0, base.path.lastIndexOf('/') + 1) + relative.path;
5393
+ }
5394
+ target.path = removeDotSegments(target.path);
5968
5395
  }
5969
- } else {
5970
- components.error = components.error || "URI can not be parsed.";
5396
+ target.query = relative.query;
5397
+ }
5398
+ // target.authority = base.authority;
5399
+ target.userinfo = base.userinfo;
5400
+ target.host = base.host;
5401
+ target.port = base.port;
5971
5402
  }
5972
- return components;
5973
- }
5403
+ target.scheme = base.scheme;
5404
+ }
5974
5405
 
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("");
5406
+ target.fragment = relative.fragment;
5407
+
5408
+ return target
6023
5409
  }
6024
5410
 
6025
- function serialize(components) {
6026
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5411
+ function equal$2 (uriA, uriB, options) {
5412
+ if (typeof uriA === 'string') {
5413
+ uriA = unescape(uriA);
5414
+ uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true });
5415
+ } else if (typeof uriA === 'object') {
5416
+ uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
5417
+ }
6027
5418
 
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
5419
+ if (typeof uriB === 'string') {
5420
+ uriB = unescape(uriB);
5421
+ uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true });
5422
+ } else if (typeof uriB === 'object') {
5423
+ uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
5424
+ }
6038
5425
 
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
- }
5426
+ return uriA.toLowerCase() === uriB.toLowerCase()
5427
+ }
5428
+
5429
+ function serialize (cmpts, opts) {
5430
+ const components = {
5431
+ host: cmpts.host,
5432
+ scheme: cmpts.scheme,
5433
+ userinfo: cmpts.userinfo,
5434
+ port: cmpts.port,
5435
+ path: cmpts.path,
5436
+ query: cmpts.query,
5437
+ nid: cmpts.nid,
5438
+ nss: cmpts.nss,
5439
+ uuid: cmpts.uuid,
5440
+ fragment: cmpts.fragment,
5441
+ reference: cmpts.reference,
5442
+ resourceName: cmpts.resourceName,
5443
+ secure: cmpts.secure,
5444
+ error: ''
5445
+ };
5446
+ const options = Object.assign({}, opts);
5447
+ const uriTokens = [];
6085
5448
 
6086
- function resolveComponents(base, relative) {
6087
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6088
- var skipNormalization = arguments[3];
5449
+ // find scheme handler
5450
+ const schemeHandler = SCHEMES[(options.scheme || components.scheme || '').toLowerCase()];
6089
5451
 
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;
5452
+ // perform scheme specific serialization
5453
+ if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
5454
+
5455
+ if (components.path !== undefined) {
5456
+ if (!options.skipEscape) {
5457
+ components.path = escape(components.path);
5458
+
5459
+ if (components.scheme !== undefined) {
5460
+ components.path = components.path.split('%3A').join(':');
5461
+ }
6104
5462
  } 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;
5463
+ components.path = unescape(components.path);
6141
5464
  }
6142
- target.fragment = relative.fragment;
6143
- return target;
6144
- }
5465
+ }
6145
5466
 
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
- }
5467
+ if (options.reference !== 'suffix' && components.scheme) {
5468
+ uriTokens.push(components.scheme, ':');
5469
+ }
6150
5470
 
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);
5471
+ const authority = recomposeAuthority(components);
5472
+ if (authority !== undefined) {
5473
+ if (options.reference !== 'suffix') {
5474
+ uriTokens.push('//');
6156
5475
  }
6157
- return uri;
6158
- }
6159
5476
 
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);
5477
+ uriTokens.push(authority);
5478
+
5479
+ if (components.path && components.path.charAt(0) !== '/') {
5480
+ uriTokens.push('/');
6165
5481
  }
6166
- if (typeof uriB === "string") {
6167
- uriB = serialize(parse(uriB, options), options);
6168
- } else if (typeOf(uriB) === "object") {
6169
- uriB = serialize(uriB, options);
5482
+ }
5483
+ if (components.path !== undefined) {
5484
+ let s = components.path;
5485
+
5486
+ if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
5487
+ s = removeDotSegments(s);
6170
5488
  }
6171
- return uriA === uriB;
6172
- }
6173
5489
 
6174
- function escapeComponent(str, options) {
6175
- return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);
6176
- }
5490
+ if (authority === undefined) {
5491
+ s = s.replace(/^\/\//u, '/%2F'); // don't allow the path to start with "//"
5492
+ }
5493
+
5494
+ uriTokens.push(s);
5495
+ }
5496
+
5497
+ if (components.query !== undefined) {
5498
+ uriTokens.push('?', components.query);
5499
+ }
6177
5500
 
6178
- function unescapeComponent(str, options) {
6179
- return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);
5501
+ if (components.fragment !== undefined) {
5502
+ uriTokens.push('#', components.fragment);
5503
+ }
5504
+ return uriTokens.join('')
6180
5505
  }
6181
5506
 
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;
5507
+ const hexLookUp = Array.from({ length: 127 }, (_v, k) => /[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(k)));
5508
+
5509
+ function nonSimpleDomain (value) {
5510
+ let code = 0;
5511
+ for (let i = 0, len = value.length; i < len; ++i) {
5512
+ code = value.charCodeAt(i);
5513
+ if (code > 126 || hexLookUp[code]) {
5514
+ return true
6206
5515
  }
6207
- };
5516
+ }
5517
+ return false
5518
+ }
6208
5519
 
6209
- var handler$1 = {
6210
- scheme: "https",
6211
- domainHost: handler.domainHost,
6212
- parse: handler.parse,
6213
- serialize: handler.serialize
6214
- };
5520
+ const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
6215
5521
 
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;
5522
+ function parse (uri, opts) {
5523
+ const options = Object.assign({}, opts);
5524
+ const parsed = {
5525
+ scheme: undefined,
5526
+ userinfo: undefined,
5527
+ host: '',
5528
+ port: undefined,
5529
+ path: '',
5530
+ query: undefined,
5531
+ fragment: undefined
5532
+ };
5533
+ const gotEncoding = uri.indexOf('%') !== -1;
5534
+ let isIP = false;
5535
+ if (options.reference === 'suffix') uri = (options.scheme ? options.scheme + ':' : '') + '//' + uri;
5536
+
5537
+ const matches = uri.match(URI_PARSE);
5538
+
5539
+ if (matches) {
5540
+ // store each component
5541
+ parsed.scheme = matches[1];
5542
+ parsed.userinfo = matches[3];
5543
+ parsed.host = matches[4];
5544
+ parsed.port = parseInt(matches[5], 10);
5545
+ parsed.path = matches[6] || '';
5546
+ parsed.query = matches[7];
5547
+ parsed.fragment = matches[8];
5548
+
5549
+ // fix port number
5550
+ if (isNaN(parsed.port)) {
5551
+ parsed.port = matches[5];
5552
+ }
5553
+ if (parsed.host) {
5554
+ const ipv4result = normalizeIPv4(parsed.host);
5555
+ if (ipv4result.isIPV4 === false) {
5556
+ const ipv6result = normalizeIPv6(ipv4result.host);
5557
+ parsed.host = ipv6result.host.toLowerCase();
5558
+ isIP = ipv6result.isIPV6;
5559
+ } else {
5560
+ parsed.host = ipv4result.host;
5561
+ isIP = true;
5562
+ }
5563
+ }
5564
+ if (parsed.scheme === undefined && parsed.userinfo === undefined && parsed.host === undefined && parsed.port === undefined && parsed.query === undefined && !parsed.path) {
5565
+ parsed.reference = 'same-document';
5566
+ } else if (parsed.scheme === undefined) {
5567
+ parsed.reference = 'relative';
5568
+ } else if (parsed.fragment === undefined) {
5569
+ parsed.reference = 'absolute';
5570
+ } else {
5571
+ parsed.reference = 'uri';
6257
5572
  }
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
5573
 
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;
5574
+ // check for reference errors
5575
+ if (options.reference && options.reference !== 'suffix' && options.reference !== parsed.reference) {
5576
+ parsed.error = parsed.error || 'URI is not a ' + options.reference + ' reference.';
6379
5577
  }
6380
- };
6381
5578
 
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.";
5579
+ // find scheme handler
5580
+ const schemeHandler = SCHEMES[(options.scheme || parsed.scheme || '').toLowerCase()];
5581
+
5582
+ // check if scheme can't handle IRIs
5583
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
5584
+ // if host component is a domain name
5585
+ if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && isIP === false && nonSimpleDomain(parsed.host)) {
5586
+ // convert Unicode IDN -> ASCII IDN
5587
+ try {
5588
+ parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
5589
+ } catch (e) {
5590
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
6403
5591
  }
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;
5592
+ }
5593
+ // convert IRI -> URI
6418
5594
  }
6419
- };
6420
5595
 
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;
5596
+ if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) {
5597
+ if (gotEncoding && parsed.scheme !== undefined) {
5598
+ parsed.scheme = unescape(parsed.scheme);
5599
+ }
5600
+ if (gotEncoding && parsed.host !== undefined) {
5601
+ parsed.host = unescape(parsed.host);
5602
+ }
5603
+ if (parsed.path) {
5604
+ parsed.path = escape(unescape(parsed.path));
5605
+ }
5606
+ if (parsed.fragment) {
5607
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
5608
+ }
6439
5609
  }
6440
- };
6441
5610
 
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 });
5611
+ // perform scheme specific parsing
5612
+ if (schemeHandler && schemeHandler.parse) {
5613
+ schemeHandler.parse(parsed, options);
5614
+ }
5615
+ } else {
5616
+ parsed.error = parsed.error || 'URI can not be parsed.';
5617
+ }
5618
+ return parsed
5619
+ }
6464
5620
 
6465
- })));
5621
+ const fastUri = {
5622
+ SCHEMES,
5623
+ normalize,
5624
+ resolve,
5625
+ resolveComponents,
5626
+ equal: equal$2,
5627
+ serialize,
5628
+ parse
5629
+ };
6466
5630
 
6467
- }(uri_all, uri_all.exports));
5631
+ fastUri$1.exports = fastUri;
5632
+ fastUri$1.exports.default = fastUri;
5633
+ fastUri$1.exports.fastUri = fastUri;
6468
5634
 
6469
5635
  Object.defineProperty(uri$1, "__esModule", { value: true });
6470
- const uri = uri_all.exports;
5636
+ const uri = fastUri$1.exports;
6471
5637
  uri.code = 'require("ajv/dist/runtime/uri").default';
6472
5638
  uri$1.default = uri;
6473
5639
 
@@ -6488,7 +5654,7 @@
6488
5654
  const rules_1 = rules;
6489
5655
  const compile_1 = compile;
6490
5656
  const codegen_2 = codegen;
6491
- const resolve_1 = resolve$1;
5657
+ const resolve_1 = resolve$2;
6492
5658
  const dataType_1 = dataType;
6493
5659
  const util_1 = util;
6494
5660
  const $dataRefSchema = require$$9;
@@ -9604,7 +8770,7 @@
9604
8770
  message = _theRule.message;
9605
8771
  var valid = true;
9606
8772
  if (isExpression(validator)) {
9607
- valid = executeExpression(validator, instance);
8773
+ valid = _executeExpression(validator, instance);
9608
8774
  } else if (typeof validator === 'function') {
9609
8775
  valid = validator(instance);
9610
8776
  // eslint-disable-next-line no-eval
@@ -9768,25 +8934,23 @@
9768
8934
  };
9769
8935
  // 校验schema是否正常
9770
8936
  var validateSchema = /*#__PURE__*/function () {
9771
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(schema) {
9772
- return _regeneratorRuntime().wrap(function _callee$(_context) {
9773
- while (1) switch (_context.prev = _context.next) {
8937
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(schema) {
8938
+ var _t;
8939
+ return _regenerator().w(function (_context) {
8940
+ while (1) switch (_context.p = _context.n) {
9774
8941
  case 0:
9775
- _context.prev = 0;
9776
- _context.next = 3;
8942
+ _context.p = 0;
8943
+ _context.n = 1;
9777
8944
  return ajv.validateSchema(schema, true);
9778
- case 3:
9779
- return _context.abrupt("return", _context.sent);
9780
- case 6:
9781
- _context.prev = 6;
9782
- _context.t0 = _context["catch"](0);
9783
- console.error('Schema不符合规范, 请检查', _context.t0);
9784
- return _context.abrupt("return", false);
9785
- case 10:
9786
- case "end":
9787
- return _context.stop();
8945
+ case 1:
8946
+ return _context.a(2, _context.v);
8947
+ case 2:
8948
+ _context.p = 2;
8949
+ _t = _context.v;
8950
+ console.error('Schema不符合规范, 请检查', _t);
8951
+ return _context.a(2, false);
9788
8952
  }
9789
- }, _callee, null, [[0, 6]]);
8953
+ }, _callee, null, [[0, 2]]);
9790
8954
  }));
9791
8955
  return function validateSchema(_x) {
9792
8956
  return _ref.apply(this, arguments);
@@ -9993,43 +9157,42 @@
9993
9157
  },
9994
9158
  loadDataSource: function loadDataSource() {
9995
9159
  var _this3 = this;
9996
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9160
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
9997
9161
  var _this3$widgetSchema, _this3$widgetSchema$u, _this3$widgetSchema$u2;
9998
- var xhrConfig, url, params, reset, _this3$httpAdapter, _this3$httpAdapter$re, http, responseParse, remoteURL, requestParams;
9999
- return _regeneratorRuntime().wrap(function _callee$(_context) {
10000
- while (1) switch (_context.prev = _context.next) {
9162
+ var xhrConfig, url, params, reset, _this3$httpAdapter, _this3$httpAdapter$re, http, responseParse, remoteURL, requestParams, _t;
9163
+ return _regenerator().w(function (_context) {
9164
+ while (1) switch (_context.p = _context.n) {
10001
9165
  case 0:
10002
9166
  xhrConfig = (_this3$widgetSchema = _this3.widgetSchema) === null || _this3$widgetSchema === void 0 ? void 0 : (_this3$widgetSchema$u = _this3$widgetSchema['ui:component']) === null || _this3$widgetSchema$u === void 0 ? void 0 : (_this3$widgetSchema$u2 = _this3$widgetSchema$u.props) === null || _this3$widgetSchema$u2 === void 0 ? void 0 : _this3$widgetSchema$u2.remoteConfig;
10003
9167
  if (!xhrConfig) {
10004
- _context.next = 18;
9168
+ _context.n = 4;
10005
9169
  break;
10006
9170
  }
10007
9171
  url = xhrConfig.url, params = xhrConfig.params, reset = _objectWithoutProperties(xhrConfig, _excluded$4);
10008
9172
  _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
- _context.prev = 4;
9173
+ _context.p = 1;
10010
9174
  _this3.loading = true;
10011
- remoteURL = executeExpression(url, _this3);
10012
- requestParams = isObj(params) ? executeExpression(params, _this3) : params;
10013
- _context.next = 10;
9175
+ remoteURL = _executeExpression(url, _this3);
9176
+ requestParams = isObj(params) ? _executeExpression(params, _this3) : params;
9177
+ _context.n = 2;
10014
9178
  return http(remoteURL, _objectSpread2(_objectSpread2({}, reset), {}, {
10015
9179
  params: requestParams,
10016
9180
  responseParse: responseParse
10017
9181
  }));
10018
- case 10:
10019
- _this3.datasource = _context.sent;
9182
+ case 2:
9183
+ _this3.datasource = _context.v;
10020
9184
  _this3.loading = false;
10021
- _context.next = 18;
9185
+ _context.n = 4;
10022
9186
  break;
10023
- case 14:
10024
- _context.prev = 14;
10025
- _context.t0 = _context["catch"](4);
9187
+ case 3:
9188
+ _context.p = 3;
9189
+ _t = _context.v;
10026
9190
  _this3.loading = false;
10027
- console.error(_context.t0);
10028
- case 18:
10029
- case "end":
10030
- return _context.stop();
9191
+ console.error(_t);
9192
+ case 4:
9193
+ return _context.a(2);
10031
9194
  }
10032
- }, _callee, null, [[4, 14]]);
9195
+ }, _callee, null, [[1, 3]]);
10033
9196
  }))();
10034
9197
  },
10035
9198
  setErrorTips: function setErrorTips(tips) {
@@ -11143,82 +10306,6 @@
11143
10306
 
11144
10307
  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
10308
 
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
10309
  // 伪数组类型
11223
10310
  var KeyValueArrayWidget = Vue__default["default"].extend({
11224
10311
  name: 'KeyValueArrayWidget',
@@ -11269,30 +10356,30 @@
11269
10356
  _this$schema2,
11270
10357
  _this$schema2$items,
11271
10358
  _this = this,
11272
- _this$value2;
10359
+ _this$value2,
10360
+ _this$value3;
11273
10361
  var labelBtnStyle = {
11274
10362
  'font-size': '16px',
11275
10363
  color: this.disabled ? '#c4c6cc' : '#979ba5',
11276
10364
  cursor: this.disabled ? 'not-allowed' : 'pointer',
11277
10365
  display: 'inline-block'
11278
10366
  };
11279
- var theadStyle = {
11280
- display: this.showTableHead ? '' : 'none'
11281
- };
10367
+ 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;
10368
+ 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']);
10369
+ // props为空时,表示只有一个项
10370
+ var keysLen = Object.keys(properties || {}).length;
10371
+ var defaultCols = properties ? new Array(keysLen).fill('1fr').concat('20px').join(' ') : '1fr 20px';
10372
+ var defaultContainerLayout = _objectSpread2({}, this.layout.container || {
10373
+ display: 'grid',
10374
+ gridGap: '20px',
10375
+ 'grid-template-columns': defaultCols // 默认配置
10376
+ });
11282
10377
  var thStyle = {
11283
10378
  fontSize: '14px',
11284
10379
  textAlign: 'left',
11285
10380
  fontWeight: 'normal',
11286
- color: '#63656E',
11287
- paddingLeft: '10px',
11288
- paddingRight: '10px'
11289
- };
11290
- var tdStyle = {
11291
- paddingLeft: '10px',
11292
- paddingRight: '10px'
10381
+ color: '#63656E'
11293
10382
  };
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
10383
  var self = this;
11297
10384
  var dealSchema = function dealSchema(schema) {
11298
10385
  return (
@@ -11340,57 +10427,55 @@
11340
10427
  }
11341
10428
  });
11342
10429
  };
11343
- return h("table", [h("thead", {
11344
- "style": theadStyle
11345
- }, [h("tr", [props === null || props === void 0 ? void 0 : props.map(function (prop, i) {
10430
+ return h("div", [this.showTableHead && (_this$value2 = this.value) !== null && _this$value2 !== void 0 && _this$value2.length ? h("div", {
10431
+ "style": _objectSpread2({}, defaultContainerLayout)
10432
+ }, [props !== null && props !== void 0 && props.length ? props.map(function (key, index) {
11346
10433
  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',
10434
+ 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];
10435
+ var curPath = Path.getCurPath(_this.path, "".concat(index, ".").concat(key));
10436
+ var lastProp = curPath.split('.').pop();
10437
+ var layoutConfig = Layout.findLayoutByProp(lastProp, _this.layout.group || []) || {};
10438
+ var path = Path.getCurPath(_this.path, "0.".concat(key));
10439
+ return h("div", {
10440
+ "style": _objectSpread2(_objectSpread2(_objectSpread2({}, thStyle), (layoutConfig === null || layoutConfig === void 0 ? void 0 : layoutConfig.item) || {}), {}, {
11352
10441
  display: ((_this$columns$path = _this.columns[path]) === null || _this$columns$path === void 0 ? void 0 : _this$columns$path.visible) === false ? 'none' : ''
11353
10442
  })
11354
10443
  }, [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) {
10444
+ }) : h("div"), h("div", {
10445
+ "style": {
10446
+ width: '16px'
10447
+ }
10448
+ })]) : null, (_this$value3 = this.value) === null || _this$value3 === void 0 ? void 0 : _this$value3.map(function (_, index) {
11356
10449
  var _this$schema5;
11357
10450
  var groupPath = Path.getCurPath(_this.path, "".concat(index));
11358
- return h(CommonGroupWrap, helper([{}, {
10451
+ return h(FieldGroupWrap, helper([{}, {
11359
10452
  "props": _objectSpread2(_objectSpread2({}, _this.$props), {}, {
11360
10453
  path: groupPath,
11361
10454
  value: Path.getPathVal(_this.rootData, groupPath),
11362
10455
  schema: _this.schema.items,
11363
- tag: 'tr',
11364
- layout: _objectSpread2({}, _this.layout)
10456
+ layout: _objectSpread2(_objectSpread2({}, _this.layout), {}, {
10457
+ container: _objectSpread2({}, defaultContainerLayout)
10458
+ })
11365
10459
  })
11366
- }]), [props !== null && props !== void 0 && props.length ? props.map(function (prop, i) {
11367
- var _this$schema4, _this$schema4$items, _this$columns$curPath;
10460
+ }]), [props !== null && props !== void 0 && props.length ? props.map(function (prop) {
10461
+ var _this$schema4, _this$schema4$items;
11368
10462
  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
10463
  var curPath = Path.getCurPath(_this.path, "".concat(index, ".").concat(prop));
11370
10464
  var lastProp = curPath.split('.').pop();
11371
10465
  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({
10466
+ return renderSchemaField({
11378
10467
  path: curPath,
11379
10468
  schema: dealSchema(schemaItem),
11380
10469
  layout: layoutConfig,
11381
10470
  required: Schema.isRequired(schemaItem, prop)
11382
- })]);
11383
- }) : h("td", [renderSchemaField({
10471
+ });
10472
+ }) : renderSchemaField({
11384
10473
  path: Path.getCurPath(_this.path, index),
11385
10474
  schema: dealSchema(((_this$schema5 = _this.schema) === null || _this$schema5 === void 0 ? void 0 : _this$schema5.items) || {}),
11386
10475
  layout: {},
11387
10476
  required: false
11388
- })]), h("td", {
11389
- "style": _objectSpread2({}, tdStyle)
11390
- }, [h("span", {
11391
- "style": _objectSpread2(_objectSpread2({}, labelBtnStyle), {}, {
11392
- marginBottom: '10px'
11393
- }),
10477
+ }), h("span", {
10478
+ "style": labelBtnStyle,
11394
10479
  "on": {
11395
10480
  "click": function click() {
11396
10481
  return _this.handleRemoveItem(index);
@@ -11398,7 +10483,7 @@
11398
10483
  }
11399
10484
  }, [h("i", {
11400
10485
  "class": "bk-icon icon-minus-line"
11401
- })])])]);
10486
+ })])]);
11402
10487
  }), h("span", {
11403
10488
  "on": {
11404
10489
  "click": this.handleAddItem
@@ -11406,7 +10491,7 @@
11406
10491
  "style": labelBtnStyle
11407
10492
  }, [h("i", {
11408
10493
  "class": "bk-icon icon-plus-line"
11409
- })])])]);
10494
+ })])]);
11410
10495
  }
11411
10496
  });
11412
10497
 
@@ -11546,7 +10631,8 @@
11546
10631
  key: key,
11547
10632
  props: {
11548
10633
  hideArrow: true,
11549
- name: key
10634
+ name: key,
10635
+ contentHiddenType: 'hidden'
11550
10636
  },
11551
10637
  class: _this.collapseStyle === 'normal' ? ['mb15'] : []
11552
10638
  }, [h('div', {
@@ -11706,7 +10792,7 @@
11706
10792
  options.fileObj.xhr = xhr;
11707
10793
  var formData = new FormData();
11708
10794
  options.data.forEach(function (item) {
11709
- formData.append(item.name, executeExpression(item.value, _this.$parent.$parent));
10795
+ formData.append(item.name, _executeExpression(item.value, _this.$parent.$parent));
11710
10796
  });
11711
10797
  formData.append(options.fileName, options.fileObj.origin);
11712
10798
  xhr.onreadystatechange = function () {
@@ -11729,12 +10815,12 @@
11729
10815
  if (Array.isArray(options.header)) {
11730
10816
  options.header.forEach(function (head) {
11731
10817
  var headerKey = head.name;
11732
- var headerVal = executeExpression(head.value, _this.$parent.$parent);
10818
+ var headerVal = _executeExpression(head.value, _this.$parent.$parent);
11733
10819
  xhr.setRequestHeader(headerKey, headerVal);
11734
10820
  });
11735
10821
  } else {
11736
10822
  var headerKey = options.header.name;
11737
- var headerVal = executeExpression(options.header.value, this.$parent.$parent);
10823
+ var headerVal = _executeExpression(options.header.value, this.$parent.$parent);
11738
10824
  xhr.setRequestHeader(headerKey, headerVal);
11739
10825
  }
11740
10826
  }
@@ -11758,13 +10844,13 @@
11758
10844
  handleResCode: function handleResCode(res) {
11759
10845
  var successed = true;
11760
10846
  if (this.isUploadSuccessed) {
11761
- successed = executeExpression(this.isUploadSuccessed, this.$parent.$parent, [], {
10847
+ successed = _executeExpression(this.isUploadSuccessed, this.$parent.$parent, [], {
11762
10848
  response: res
11763
10849
  });
11764
10850
  }
11765
10851
  if (!successed) return;
11766
10852
  if (this.responseHandler) {
11767
- var files = executeExpression(this.responseHandler, this.$parent.$parent, [], {
10853
+ var files = _executeExpression(this.responseHandler, this.$parent.$parent, [], {
11768
10854
  response: res
11769
10855
  });
11770
10856
  this.$emit('input', files);
@@ -12102,7 +11188,7 @@
12102
11188
  },
12103
11189
  methods: {
12104
11190
  initFormData: function initFormData() {
12105
- this.rootData = merge(Schema.getSchemaDefaultValue(createProxy(this.schema, this)) || {}, this.value);
11191
+ this.rootData = _merge(Schema.getSchemaDefaultValue(createProxy(this.schema, this)) || {}, this.value);
12106
11192
  this.emitFormValueChange(this.rootData, this.value);
12107
11193
  },
12108
11194
  emitFormValueChange: function emitFormValueChange(newValue, oldValue) {