@hpcc-js/ddl-shim 2.20.6 → 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -20,8 +20,8 @@
20
20
  }
21
21
 
22
22
  var PKG_NAME = "@hpcc-js/ddl-shim";
23
- var PKG_VERSION = "2.20.6";
24
- var BUILD_VERSION = "2.104.30";
23
+ var PKG_VERSION = "2.21.0";
24
+ var BUILD_VERSION = "2.106.0";
25
25
 
26
26
  function isWorkunitDatasource(ref) {
27
27
  return ref.WUID !== undefined;
@@ -68,20 +68,20 @@
68
68
 
69
69
  var v1 = /*#__PURE__*/Object.freeze({
70
70
  __proto__: null,
71
- isWorkunitDatasource: isWorkunitDatasource,
71
+ isChoroVisualization: isChoroVisualization,
72
72
  isDatabombDatasource: isDatabombDatasource,
73
+ isFormVisualization: isFormVisualization,
74
+ isGeohashMapping: isGeohashMapping,
75
+ isGraphVisualization: isGraphVisualization,
76
+ isHeatMapVisualization: isHeatMapVisualization,
73
77
  isHipieDatasource: isHipieDatasource,
74
- isPieVisualization: isPieVisualization,
75
78
  isLineVisualization: isLineVisualization,
76
- isChoroVisualization: isChoroVisualization,
77
- isTableVisualization: isTableVisualization,
79
+ isPieVisualization: isPieVisualization,
78
80
  isSliderVisualization: isSliderVisualization,
79
- isGraphVisualization: isGraphVisualization,
80
- isHeatMapVisualization: isHeatMapVisualization,
81
- isFormVisualization: isFormVisualization,
82
- isUSStateMapping: isUSStateMapping,
81
+ isTableVisualization: isTableVisualization,
83
82
  isUSCountyMapping: isUSCountyMapping,
84
- isGeohashMapping: isGeohashMapping
83
+ isUSStateMapping: isUSStateMapping,
84
+ isWorkunitDatasource: isWorkunitDatasource
85
85
  });
86
86
 
87
87
  function isDatabombRef(ref) {
@@ -118,17 +118,17 @@
118
118
 
119
119
  var v2$1 = /*#__PURE__*/Object.freeze({
120
120
  __proto__: null,
121
+ VisibilitySet: VisibilitySet,
121
122
  isDatabombRef: isDatabombRef,
122
- isWUResultRef: isWUResultRef,
123
- isRoxieServiceRef: isRoxieServiceRef,
124
- isIFilterCondition: isIFilterCondition,
125
123
  isFilterActivity: isFilterActivity,
126
- isProjectActivity: isProjectActivity,
127
- isMappingsActivity: isMappingsActivity,
128
124
  isGroupByActivity: isGroupByActivity,
129
- isSortActivity: isSortActivity,
125
+ isIFilterCondition: isIFilterCondition,
130
126
  isLimitActivity: isLimitActivity,
131
- VisibilitySet: VisibilitySet
127
+ isMappingsActivity: isMappingsActivity,
128
+ isProjectActivity: isProjectActivity,
129
+ isRoxieServiceRef: isRoxieServiceRef,
130
+ isSortActivity: isSortActivity,
131
+ isWUResultRef: isWUResultRef
132
132
  });
133
133
 
134
134
  /******************************************************************************
@@ -145,6 +145,8 @@
145
145
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
146
146
  PERFORMANCE OF THIS SOFTWARE.
147
147
  ***************************************************************************** */
148
+ /* global Reflect, Promise, SuppressedError, Symbol */
149
+
148
150
 
149
151
  var __assign = function() {
150
152
  __assign = Object.assign || function __assign(t) {
@@ -1097,159 +1099,162 @@
1097
1099
 
1098
1100
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
1099
1101
 
1102
+ function getDefaultExportFromCjs (x) {
1103
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1104
+ }
1105
+
1100
1106
  var uri_all = {exports: {}};
1101
1107
 
1102
1108
  /** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
1103
1109
 
1104
1110
  (function (module, exports) {
1105
- (function (global, factory) {
1106
- factory(exports) ;
1107
- }(commonjsGlobal, (function (exports) {
1108
- function merge() {
1109
- for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
1110
- sets[_key] = arguments[_key];
1111
- }
1112
-
1113
- if (sets.length > 1) {
1114
- sets[0] = sets[0].slice(0, -1);
1115
- var xl = sets.length - 1;
1116
- for (var x = 1; x < xl; ++x) {
1117
- sets[x] = sets[x].slice(1, -1);
1118
- }
1119
- sets[xl] = sets[xl].slice(1);
1120
- return sets.join('');
1121
- } else {
1122
- return sets[0];
1123
- }
1124
- }
1125
- function subexp(str) {
1126
- return "(?:" + str + ")";
1127
- }
1128
- function typeOf(o) {
1129
- return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase();
1130
- }
1131
- function toUpperCase(str) {
1132
- return str.toUpperCase();
1133
- }
1134
- function toArray(obj) {
1135
- 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) : [];
1136
- }
1137
- function assign(target, source) {
1138
- var obj = target;
1139
- if (source) {
1140
- for (var key in source) {
1141
- obj[key] = source[key];
1142
- }
1143
- }
1144
- return obj;
1145
- }
1146
-
1147
- function buildExps(isIRI) {
1148
- var ALPHA$$ = "[A-Za-z]",
1149
- DIGIT$$ = "[0-9]",
1150
- HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"),
1151
- PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)),
1152
- //expanded
1153
- GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
1154
- SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
1155
- RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
1156
- UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]",
1157
- //subset, excludes bidi control characters
1158
- IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",
1159
- //subset
1160
- UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$);
1161
- subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*");
1162
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*");
1163
- 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$$),
1164
- //relaxed parsing rules
1165
- IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
1166
- H16$ = subexp(HEXDIG$$ + "{1,4}"),
1167
- LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
1168
- IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$),
1169
- // 6( h16 ":" ) ls32
1170
- IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$),
1171
- // "::" 5( h16 ":" ) ls32
1172
- IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$),
1173
- //[ h16 ] "::" 4( h16 ":" ) ls32
1174
- IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$),
1175
- //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
1176
- IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$),
1177
- //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
1178
- IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$),
1179
- //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
1180
- IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$),
1181
- //[ *4( h16 ":" ) h16 ] "::" ls32
1182
- IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$),
1183
- //[ *5( h16 ":" ) h16 ] "::" h16
1184
- IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),
1185
- //[ *6( h16 ":" ) h16 ] "::"
1186
- IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
1187
- ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+");
1188
- //RFC 6874, with relaxed parsing rules
1189
- subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+");
1190
- //RFC 6874
1191
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*");
1192
- var PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"));
1193
- subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+");
1194
- subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*");
1195
- return {
1196
- NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
1197
- NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1198
- NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1199
- NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1200
- NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1201
- NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
1202
- NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
1203
- ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1204
- UNRESERVED: new RegExp(UNRESERVED$$, "g"),
1205
- OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
1206
- PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
1207
- IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
1208
- IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
1209
- };
1210
- }
1211
- var URI_PROTOCOL = buildExps(false);
1111
+ (function (global, factory) {
1112
+ factory(exports) ;
1113
+ }(commonjsGlobal, (function (exports) {
1114
+ function merge() {
1115
+ for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
1116
+ sets[_key] = arguments[_key];
1117
+ }
1118
+
1119
+ if (sets.length > 1) {
1120
+ sets[0] = sets[0].slice(0, -1);
1121
+ var xl = sets.length - 1;
1122
+ for (var x = 1; x < xl; ++x) {
1123
+ sets[x] = sets[x].slice(1, -1);
1124
+ }
1125
+ sets[xl] = sets[xl].slice(1);
1126
+ return sets.join('');
1127
+ } else {
1128
+ return sets[0];
1129
+ }
1130
+ }
1131
+ function subexp(str) {
1132
+ return "(?:" + str + ")";
1133
+ }
1134
+ function typeOf(o) {
1135
+ return o === undefined ? "undefined" : o === null ? "null" : Object.prototype.toString.call(o).split(" ").pop().split("]").shift().toLowerCase();
1136
+ }
1137
+ function toUpperCase(str) {
1138
+ return str.toUpperCase();
1139
+ }
1140
+ function toArray(obj) {
1141
+ 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) : [];
1142
+ }
1143
+ function assign(target, source) {
1144
+ var obj = target;
1145
+ if (source) {
1146
+ for (var key in source) {
1147
+ obj[key] = source[key];
1148
+ }
1149
+ }
1150
+ return obj;
1151
+ }
1212
1152
 
1213
- var IRI_PROTOCOL = buildExps(true);
1153
+ function buildExps(isIRI) {
1154
+ var ALPHA$$ = "[A-Za-z]",
1155
+ DIGIT$$ = "[0-9]",
1156
+ HEXDIG$$ = merge(DIGIT$$, "[A-Fa-f]"),
1157
+ PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)),
1158
+ //expanded
1159
+ GEN_DELIMS$$ = "[\\:\\/\\?\\#\\[\\]\\@]",
1160
+ SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",
1161
+ RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$),
1162
+ UCSCHAR$$ = isIRI ? "[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]" : "[]",
1163
+ //subset, excludes bidi control characters
1164
+ IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",
1165
+ //subset
1166
+ UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$);
1167
+ subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*");
1168
+ subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*");
1169
+ 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$$),
1170
+ //relaxed parsing rules
1171
+ IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
1172
+ H16$ = subexp(HEXDIG$$ + "{1,4}"),
1173
+ LS32$ = subexp(subexp(H16$ + "\\:" + H16$) + "|" + IPV4ADDRESS$),
1174
+ IPV6ADDRESS1$ = subexp(subexp(H16$ + "\\:") + "{6}" + LS32$),
1175
+ // 6( h16 ":" ) ls32
1176
+ IPV6ADDRESS2$ = subexp("\\:\\:" + subexp(H16$ + "\\:") + "{5}" + LS32$),
1177
+ // "::" 5( h16 ":" ) ls32
1178
+ IPV6ADDRESS3$ = subexp(subexp(H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{4}" + LS32$),
1179
+ //[ h16 ] "::" 4( h16 ":" ) ls32
1180
+ IPV6ADDRESS4$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,1}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{3}" + LS32$),
1181
+ //[ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
1182
+ IPV6ADDRESS5$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,2}" + H16$) + "?\\:\\:" + subexp(H16$ + "\\:") + "{2}" + LS32$),
1183
+ //[ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
1184
+ IPV6ADDRESS6$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,3}" + H16$) + "?\\:\\:" + H16$ + "\\:" + LS32$),
1185
+ //[ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
1186
+ IPV6ADDRESS7$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,4}" + H16$) + "?\\:\\:" + LS32$),
1187
+ //[ *4( h16 ":" ) h16 ] "::" ls32
1188
+ IPV6ADDRESS8$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,5}" + H16$) + "?\\:\\:" + H16$),
1189
+ //[ *5( h16 ":" ) h16 ] "::" h16
1190
+ IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),
1191
+ //[ *6( h16 ":" ) h16 ] "::"
1192
+ IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
1193
+ ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+");
1194
+ //RFC 6874, with relaxed parsing rules
1195
+ subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+");
1196
+ //RFC 6874
1197
+ subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*");
1198
+ var PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"));
1199
+ subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+");
1200
+ subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*");
1201
+ return {
1202
+ NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
1203
+ NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1204
+ NOT_HOST: new RegExp(merge("[^\\%\\[\\]\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1205
+ NOT_PATH: new RegExp(merge("[^\\%\\/\\:\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1206
+ NOT_PATH_NOSCHEME: new RegExp(merge("[^\\%\\/\\@]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1207
+ NOT_QUERY: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]", IPRIVATE$$), "g"),
1208
+ NOT_FRAGMENT: new RegExp(merge("[^\\%]", UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@\\/\\?]"), "g"),
1209
+ ESCAPE: new RegExp(merge("[^]", UNRESERVED$$, SUB_DELIMS$$), "g"),
1210
+ UNRESERVED: new RegExp(UNRESERVED$$, "g"),
1211
+ OTHER_CHARS: new RegExp(merge("[^\\%]", UNRESERVED$$, RESERVED$$), "g"),
1212
+ PCT_ENCODED: new RegExp(PCT_ENCODED$, "g"),
1213
+ IPV4ADDRESS: new RegExp("^(" + IPV4ADDRESS$ + ")$"),
1214
+ IPV6ADDRESS: new RegExp("^\\[?(" + IPV6ADDRESS$ + ")" + subexp(subexp("\\%25|\\%(?!" + HEXDIG$$ + "{2})") + "(" + ZONEID$ + ")") + "?\\]?$") //RFC 6874, with relaxed parsing rules
1215
+ };
1216
+ }
1217
+ var URI_PROTOCOL = buildExps(false);
1214
1218
 
1215
- var slicedToArray = function () {
1216
- function sliceIterator(arr, i) {
1217
- var _arr = [];
1218
- var _n = true;
1219
- var _d = false;
1220
- var _e = undefined;
1219
+ var IRI_PROTOCOL = buildExps(true);
1221
1220
 
1222
- try {
1223
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
1224
- _arr.push(_s.value);
1221
+ var slicedToArray = function () {
1222
+ function sliceIterator(arr, i) {
1223
+ var _arr = [];
1224
+ var _n = true;
1225
+ var _d = false;
1226
+ var _e = undefined;
1225
1227
 
1226
- if (i && _arr.length === i) break;
1227
- }
1228
- } catch (err) {
1229
- _d = true;
1230
- _e = err;
1231
- } finally {
1232
- try {
1233
- if (!_n && _i["return"]) _i["return"]();
1234
- } finally {
1235
- if (_d) throw _e;
1236
- }
1237
- }
1228
+ try {
1229
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
1230
+ _arr.push(_s.value);
1238
1231
 
1239
- return _arr;
1240
- }
1232
+ if (i && _arr.length === i) break;
1233
+ }
1234
+ } catch (err) {
1235
+ _d = true;
1236
+ _e = err;
1237
+ } finally {
1238
+ try {
1239
+ if (!_n && _i["return"]) _i["return"]();
1240
+ } finally {
1241
+ if (_d) throw _e;
1242
+ }
1243
+ }
1241
1244
 
1242
- return function (arr, i) {
1243
- if (Array.isArray(arr)) {
1244
- return arr;
1245
- } else if (Symbol.iterator in Object(arr)) {
1246
- return sliceIterator(arr, i);
1247
- } else {
1248
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
1249
- }
1250
- };
1251
- }();
1245
+ return _arr;
1246
+ }
1252
1247
 
1248
+ return function (arr, i) {
1249
+ if (Array.isArray(arr)) {
1250
+ return arr;
1251
+ } else if (Symbol.iterator in Object(arr)) {
1252
+ return sliceIterator(arr, i);
1253
+ } else {
1254
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
1255
+ }
1256
+ };
1257
+ }();
1253
1258
 
1254
1259
 
1255
1260
 
@@ -1262,1248 +1267,1251 @@
1262
1267
 
1263
1268
 
1264
1269
 
1265
- var toConsumableArray = function (arr) {
1266
- if (Array.isArray(arr)) {
1267
- for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
1268
1270
 
1269
- return arr2;
1270
- } else {
1271
- return Array.from(arr);
1272
- }
1273
- };
1271
+ var toConsumableArray = function (arr) {
1272
+ if (Array.isArray(arr)) {
1273
+ for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
1274
1274
 
1275
- /** Highest positive signed 32-bit float value */
1276
-
1277
- var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
1278
-
1279
- /** Bootstring parameters */
1280
- var base = 36;
1281
- var tMin = 1;
1282
- var tMax = 26;
1283
- var skew = 38;
1284
- var damp = 700;
1285
- var initialBias = 72;
1286
- var initialN = 128; // 0x80
1287
- var delimiter = '-'; // '\x2D'
1288
-
1289
- /** Regular expressions */
1290
- var regexPunycode = /^xn--/;
1291
- var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars
1292
- var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
1293
-
1294
- /** Error messages */
1295
- var errors = {
1296
- 'overflow': 'Overflow: input needs wider integers to process',
1297
- 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
1298
- 'invalid-input': 'Invalid input'
1299
- };
1275
+ return arr2;
1276
+ } else {
1277
+ return Array.from(arr);
1278
+ }
1279
+ };
1300
1280
 
1301
- /** Convenience shortcuts */
1302
- var baseMinusTMin = base - tMin;
1303
- var floor = Math.floor;
1304
- var stringFromCharCode = String.fromCharCode;
1281
+ /** Highest positive signed 32-bit float value */
1305
1282
 
1306
- /*--------------------------------------------------------------------------*/
1283
+ var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
1307
1284
 
1308
- /**
1309
- * A generic error utility function.
1310
- * @private
1311
- * @param {String} type The error type.
1312
- * @returns {Error} Throws a `RangeError` with the applicable error message.
1313
- */
1314
- function error$1(type) {
1315
- throw new RangeError(errors[type]);
1316
- }
1285
+ /** Bootstring parameters */
1286
+ var base = 36;
1287
+ var tMin = 1;
1288
+ var tMax = 26;
1289
+ var skew = 38;
1290
+ var damp = 700;
1291
+ var initialBias = 72;
1292
+ var initialN = 128; // 0x80
1293
+ var delimiter = '-'; // '\x2D'
1317
1294
 
1318
- /**
1319
- * A generic `Array#map` utility function.
1320
- * @private
1321
- * @param {Array} array The array to iterate over.
1322
- * @param {Function} callback The function that gets called for every array
1323
- * item.
1324
- * @returns {Array} A new array of values returned by the callback function.
1325
- */
1326
- function map(array, fn) {
1327
- var result = [];
1328
- var length = array.length;
1329
- while (length--) {
1330
- result[length] = fn(array[length]);
1331
- }
1332
- return result;
1333
- }
1295
+ /** Regular expressions */
1296
+ var regexPunycode = /^xn--/;
1297
+ var regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars
1298
+ var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
1334
1299
 
1335
- /**
1336
- * A simple `Array#map`-like wrapper to work with domain name strings or email
1337
- * addresses.
1338
- * @private
1339
- * @param {String} domain The domain name or email address.
1340
- * @param {Function} callback The function that gets called for every
1341
- * character.
1342
- * @returns {Array} A new string of characters returned by the callback
1343
- * function.
1344
- */
1345
- function mapDomain(string, fn) {
1346
- var parts = string.split('@');
1347
- var result = '';
1348
- if (parts.length > 1) {
1349
- // In email addresses, only the domain name should be punycoded. Leave
1350
- // the local part (i.e. everything up to `@`) intact.
1351
- result = parts[0] + '@';
1352
- string = parts[1];
1353
- }
1354
- // Avoid `split(regex)` for IE8 compatibility. See #17.
1355
- string = string.replace(regexSeparators, '\x2E');
1356
- var labels = string.split('.');
1357
- var encoded = map(labels, fn).join('.');
1358
- return result + encoded;
1359
- }
1300
+ /** Error messages */
1301
+ var errors = {
1302
+ 'overflow': 'Overflow: input needs wider integers to process',
1303
+ 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
1304
+ 'invalid-input': 'Invalid input'
1305
+ };
1360
1306
 
1361
- /**
1362
- * Creates an array containing the numeric code points of each Unicode
1363
- * character in the string. While JavaScript uses UCS-2 internally,
1364
- * this function will convert a pair of surrogate halves (each of which
1365
- * UCS-2 exposes as separate characters) into a single code point,
1366
- * matching UTF-16.
1367
- * @see `punycode.ucs2.encode`
1368
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
1369
- * @memberOf punycode.ucs2
1370
- * @name decode
1371
- * @param {String} string The Unicode input string (UCS-2).
1372
- * @returns {Array} The new array of code points.
1373
- */
1374
- function ucs2decode(string) {
1375
- var output = [];
1376
- var counter = 0;
1377
- var length = string.length;
1378
- while (counter < length) {
1379
- var value = string.charCodeAt(counter++);
1380
- if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
1381
- // It's a high surrogate, and there is a next character.
1382
- var extra = string.charCodeAt(counter++);
1383
- if ((extra & 0xFC00) == 0xDC00) {
1384
- // Low surrogate.
1385
- output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
1386
- } else {
1387
- // It's an unmatched surrogate; only append this code unit, in case the
1388
- // next code unit is the high surrogate of a surrogate pair.
1389
- output.push(value);
1390
- counter--;
1391
- }
1392
- } else {
1393
- output.push(value);
1394
- }
1395
- }
1396
- return output;
1397
- }
1307
+ /** Convenience shortcuts */
1308
+ var baseMinusTMin = base - tMin;
1309
+ var floor = Math.floor;
1310
+ var stringFromCharCode = String.fromCharCode;
1398
1311
 
1399
- /**
1400
- * Creates a string based on an array of numeric code points.
1401
- * @see `punycode.ucs2.decode`
1402
- * @memberOf punycode.ucs2
1403
- * @name encode
1404
- * @param {Array} codePoints The array of numeric code points.
1405
- * @returns {String} The new Unicode string (UCS-2).
1406
- */
1407
- var ucs2encode = function ucs2encode(array) {
1408
- return String.fromCodePoint.apply(String, toConsumableArray(array));
1409
- };
1312
+ /*--------------------------------------------------------------------------*/
1410
1313
 
1411
- /**
1412
- * Converts a basic code point into a digit/integer.
1413
- * @see `digitToBasic()`
1414
- * @private
1415
- * @param {Number} codePoint The basic numeric code point value.
1416
- * @returns {Number} The numeric value of a basic code point (for use in
1417
- * representing integers) in the range `0` to `base - 1`, or `base` if
1418
- * the code point does not represent a value.
1419
- */
1420
- var basicToDigit = function basicToDigit(codePoint) {
1421
- if (codePoint - 0x30 < 0x0A) {
1422
- return codePoint - 0x16;
1423
- }
1424
- if (codePoint - 0x41 < 0x1A) {
1425
- return codePoint - 0x41;
1426
- }
1427
- if (codePoint - 0x61 < 0x1A) {
1428
- return codePoint - 0x61;
1314
+ /**
1315
+ * A generic error utility function.
1316
+ * @private
1317
+ * @param {String} type The error type.
1318
+ * @returns {Error} Throws a `RangeError` with the applicable error message.
1319
+ */
1320
+ function error$1(type) {
1321
+ throw new RangeError(errors[type]);
1429
1322
  }
1430
- return base;
1431
- };
1432
1323
 
1433
- /**
1434
- * Converts a digit/integer into a basic code point.
1435
- * @see `basicToDigit()`
1436
- * @private
1437
- * @param {Number} digit The numeric value of a basic code point.
1438
- * @returns {Number} The basic code point whose value (when used for
1439
- * representing integers) is `digit`, which needs to be in the range
1440
- * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
1441
- * used; else, the lowercase form is used. The behavior is undefined
1442
- * if `flag` is non-zero and `digit` has no uppercase form.
1443
- */
1444
- var digitToBasic = function digitToBasic(digit, flag) {
1445
- // 0..25 map to ASCII a..z or A..Z
1446
- // 26..35 map to ASCII 0..9
1447
- return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
1448
- };
1449
-
1450
- /**
1451
- * Bias adaptation function as per section 3.4 of RFC 3492.
1452
- * https://tools.ietf.org/html/rfc3492#section-3.4
1453
- * @private
1454
- */
1455
- var adapt = function adapt(delta, numPoints, firstTime) {
1456
- var k = 0;
1457
- delta = firstTime ? floor(delta / damp) : delta >> 1;
1458
- delta += floor(delta / numPoints);
1459
- for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {
1460
- delta = floor(delta / baseMinusTMin);
1324
+ /**
1325
+ * A generic `Array#map` utility function.
1326
+ * @private
1327
+ * @param {Array} array The array to iterate over.
1328
+ * @param {Function} callback The function that gets called for every array
1329
+ * item.
1330
+ * @returns {Array} A new array of values returned by the callback function.
1331
+ */
1332
+ function map(array, fn) {
1333
+ var result = [];
1334
+ var length = array.length;
1335
+ while (length--) {
1336
+ result[length] = fn(array[length]);
1337
+ }
1338
+ return result;
1461
1339
  }
1462
- return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
1463
- };
1464
1340
 
1465
- /**
1466
- * Converts a Punycode string of ASCII-only symbols to a string of Unicode
1467
- * symbols.
1468
- * @memberOf punycode
1469
- * @param {String} input The Punycode string of ASCII-only symbols.
1470
- * @returns {String} The resulting string of Unicode symbols.
1471
- */
1472
- var decode = function decode(input) {
1473
- // Don't use UCS-2.
1474
- var output = [];
1475
- var inputLength = input.length;
1476
- var i = 0;
1477
- var n = initialN;
1478
- var bias = initialBias;
1479
-
1480
- // Handle the basic code points: let `basic` be the number of input code
1481
- // points before the last delimiter, or `0` if there is none, then copy
1482
- // the first basic code points to the output.
1483
-
1484
- var basic = input.lastIndexOf(delimiter);
1485
- if (basic < 0) {
1486
- basic = 0;
1341
+ /**
1342
+ * A simple `Array#map`-like wrapper to work with domain name strings or email
1343
+ * addresses.
1344
+ * @private
1345
+ * @param {String} domain The domain name or email address.
1346
+ * @param {Function} callback The function that gets called for every
1347
+ * character.
1348
+ * @returns {Array} A new string of characters returned by the callback
1349
+ * function.
1350
+ */
1351
+ function mapDomain(string, fn) {
1352
+ var parts = string.split('@');
1353
+ var result = '';
1354
+ if (parts.length > 1) {
1355
+ // In email addresses, only the domain name should be punycoded. Leave
1356
+ // the local part (i.e. everything up to `@`) intact.
1357
+ result = parts[0] + '@';
1358
+ string = parts[1];
1359
+ }
1360
+ // Avoid `split(regex)` for IE8 compatibility. See #17.
1361
+ string = string.replace(regexSeparators, '\x2E');
1362
+ var labels = string.split('.');
1363
+ var encoded = map(labels, fn).join('.');
1364
+ return result + encoded;
1487
1365
  }
1488
1366
 
1489
- for (var j = 0; j < basic; ++j) {
1490
- // if it's not a basic code point
1491
- if (input.charCodeAt(j) >= 0x80) {
1492
- error$1('not-basic');
1367
+ /**
1368
+ * Creates an array containing the numeric code points of each Unicode
1369
+ * character in the string. While JavaScript uses UCS-2 internally,
1370
+ * this function will convert a pair of surrogate halves (each of which
1371
+ * UCS-2 exposes as separate characters) into a single code point,
1372
+ * matching UTF-16.
1373
+ * @see `punycode.ucs2.encode`
1374
+ * @see <https://mathiasbynens.be/notes/javascript-encoding>
1375
+ * @memberOf punycode.ucs2
1376
+ * @name decode
1377
+ * @param {String} string The Unicode input string (UCS-2).
1378
+ * @returns {Array} The new array of code points.
1379
+ */
1380
+ function ucs2decode(string) {
1381
+ var output = [];
1382
+ var counter = 0;
1383
+ var length = string.length;
1384
+ while (counter < length) {
1385
+ var value = string.charCodeAt(counter++);
1386
+ if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
1387
+ // It's a high surrogate, and there is a next character.
1388
+ var extra = string.charCodeAt(counter++);
1389
+ if ((extra & 0xFC00) == 0xDC00) {
1390
+ // Low surrogate.
1391
+ output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
1392
+ } else {
1393
+ // It's an unmatched surrogate; only append this code unit, in case the
1394
+ // next code unit is the high surrogate of a surrogate pair.
1395
+ output.push(value);
1396
+ counter--;
1397
+ }
1398
+ } else {
1399
+ output.push(value);
1400
+ }
1493
1401
  }
1494
- output.push(input.charCodeAt(j));
1402
+ return output;
1495
1403
  }
1496
1404
 
1497
- // Main decoding loop: start just after the last delimiter if any basic code
1498
- // points were copied; start at the beginning otherwise.
1499
-
1500
- for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{
1501
-
1502
- // `index` is the index of the next character to be consumed.
1503
- // Decode a generalized variable-length integer into `delta`,
1504
- // which gets added to `i`. The overflow checking is easier
1505
- // if we increase `i` as we go, then subtract off its starting
1506
- // value at the end to obtain `delta`.
1507
- var oldi = i;
1508
- for (var w = 1, k = base;; /* no condition */k += base) {
1509
-
1510
- if (index >= inputLength) {
1511
- error$1('invalid-input');
1512
- }
1405
+ /**
1406
+ * Creates a string based on an array of numeric code points.
1407
+ * @see `punycode.ucs2.decode`
1408
+ * @memberOf punycode.ucs2
1409
+ * @name encode
1410
+ * @param {Array} codePoints The array of numeric code points.
1411
+ * @returns {String} The new Unicode string (UCS-2).
1412
+ */
1413
+ var ucs2encode = function ucs2encode(array) {
1414
+ return String.fromCodePoint.apply(String, toConsumableArray(array));
1415
+ };
1513
1416
 
1514
- var digit = basicToDigit(input.charCodeAt(index++));
1417
+ /**
1418
+ * Converts a basic code point into a digit/integer.
1419
+ * @see `digitToBasic()`
1420
+ * @private
1421
+ * @param {Number} codePoint The basic numeric code point value.
1422
+ * @returns {Number} The numeric value of a basic code point (for use in
1423
+ * representing integers) in the range `0` to `base - 1`, or `base` if
1424
+ * the code point does not represent a value.
1425
+ */
1426
+ var basicToDigit = function basicToDigit(codePoint) {
1427
+ if (codePoint - 0x30 < 0x0A) {
1428
+ return codePoint - 0x16;
1429
+ }
1430
+ if (codePoint - 0x41 < 0x1A) {
1431
+ return codePoint - 0x41;
1432
+ }
1433
+ if (codePoint - 0x61 < 0x1A) {
1434
+ return codePoint - 0x61;
1435
+ }
1436
+ return base;
1437
+ };
1515
1438
 
1516
- if (digit >= base || digit > floor((maxInt - i) / w)) {
1517
- error$1('overflow');
1518
- }
1439
+ /**
1440
+ * Converts a digit/integer into a basic code point.
1441
+ * @see `basicToDigit()`
1442
+ * @private
1443
+ * @param {Number} digit The numeric value of a basic code point.
1444
+ * @returns {Number} The basic code point whose value (when used for
1445
+ * representing integers) is `digit`, which needs to be in the range
1446
+ * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
1447
+ * used; else, the lowercase form is used. The behavior is undefined
1448
+ * if `flag` is non-zero and `digit` has no uppercase form.
1449
+ */
1450
+ var digitToBasic = function digitToBasic(digit, flag) {
1451
+ // 0..25 map to ASCII a..z or A..Z
1452
+ // 26..35 map to ASCII 0..9
1453
+ return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
1454
+ };
1519
1455
 
1520
- i += digit * w;
1521
- var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
1456
+ /**
1457
+ * Bias adaptation function as per section 3.4 of RFC 3492.
1458
+ * https://tools.ietf.org/html/rfc3492#section-3.4
1459
+ * @private
1460
+ */
1461
+ var adapt = function adapt(delta, numPoints, firstTime) {
1462
+ var k = 0;
1463
+ delta = firstTime ? floor(delta / damp) : delta >> 1;
1464
+ delta += floor(delta / numPoints);
1465
+ for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {
1466
+ delta = floor(delta / baseMinusTMin);
1467
+ }
1468
+ return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
1469
+ };
1522
1470
 
1523
- if (digit < t) {
1524
- break;
1525
- }
1471
+ /**
1472
+ * Converts a Punycode string of ASCII-only symbols to a string of Unicode
1473
+ * symbols.
1474
+ * @memberOf punycode
1475
+ * @param {String} input The Punycode string of ASCII-only symbols.
1476
+ * @returns {String} The resulting string of Unicode symbols.
1477
+ */
1478
+ var decode = function decode(input) {
1479
+ // Don't use UCS-2.
1480
+ var output = [];
1481
+ var inputLength = input.length;
1482
+ var i = 0;
1483
+ var n = initialN;
1484
+ var bias = initialBias;
1485
+
1486
+ // Handle the basic code points: let `basic` be the number of input code
1487
+ // points before the last delimiter, or `0` if there is none, then copy
1488
+ // the first basic code points to the output.
1489
+
1490
+ var basic = input.lastIndexOf(delimiter);
1491
+ if (basic < 0) {
1492
+ basic = 0;
1493
+ }
1526
1494
 
1527
- var baseMinusT = base - t;
1528
- if (w > floor(maxInt / baseMinusT)) {
1529
- error$1('overflow');
1495
+ for (var j = 0; j < basic; ++j) {
1496
+ // if it's not a basic code point
1497
+ if (input.charCodeAt(j) >= 0x80) {
1498
+ error$1('not-basic');
1530
1499
  }
1531
-
1532
- w *= baseMinusT;
1500
+ output.push(input.charCodeAt(j));
1533
1501
  }
1534
1502
 
1535
- var out = output.length + 1;
1536
- bias = adapt(i - oldi, out, oldi == 0);
1503
+ // Main decoding loop: start just after the last delimiter if any basic code
1504
+ // points were copied; start at the beginning otherwise.
1537
1505
 
1538
- // `i` was supposed to wrap around from `out` to `0`,
1539
- // incrementing `n` each time, so we'll fix that now:
1540
- if (floor(i / out) > maxInt - n) {
1541
- error$1('overflow');
1542
- }
1506
+ for (var index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{
1543
1507
 
1544
- n += floor(i / out);
1545
- i %= out;
1508
+ // `index` is the index of the next character to be consumed.
1509
+ // Decode a generalized variable-length integer into `delta`,
1510
+ // which gets added to `i`. The overflow checking is easier
1511
+ // if we increase `i` as we go, then subtract off its starting
1512
+ // value at the end to obtain `delta`.
1513
+ var oldi = i;
1514
+ for (var w = 1, k = base;; /* no condition */k += base) {
1546
1515
 
1547
- // Insert `n` at position `i` of the output.
1548
- output.splice(i++, 0, n);
1549
- }
1516
+ if (index >= inputLength) {
1517
+ error$1('invalid-input');
1518
+ }
1550
1519
 
1551
- return String.fromCodePoint.apply(String, output);
1552
- };
1520
+ var digit = basicToDigit(input.charCodeAt(index++));
1553
1521
 
1554
- /**
1555
- * Converts a string of Unicode symbols (e.g. a domain name label) to a
1556
- * Punycode string of ASCII-only symbols.
1557
- * @memberOf punycode
1558
- * @param {String} input The string of Unicode symbols.
1559
- * @returns {String} The resulting Punycode string of ASCII-only symbols.
1560
- */
1561
- var encode = function encode(input) {
1562
- var output = [];
1522
+ if (digit >= base || digit > floor((maxInt - i) / w)) {
1523
+ error$1('overflow');
1524
+ }
1563
1525
 
1564
- // Convert the input in UCS-2 to an array of Unicode code points.
1565
- input = ucs2decode(input);
1526
+ i += digit * w;
1527
+ var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
1566
1528
 
1567
- // Cache the length.
1568
- var inputLength = input.length;
1529
+ if (digit < t) {
1530
+ break;
1531
+ }
1569
1532
 
1570
- // Initialize the state.
1571
- var n = initialN;
1572
- var delta = 0;
1573
- var bias = initialBias;
1533
+ var baseMinusT = base - t;
1534
+ if (w > floor(maxInt / baseMinusT)) {
1535
+ error$1('overflow');
1536
+ }
1574
1537
 
1575
- // Handle the basic code points.
1576
- var _iteratorNormalCompletion = true;
1577
- var _didIteratorError = false;
1578
- var _iteratorError = undefined;
1538
+ w *= baseMinusT;
1539
+ }
1579
1540
 
1580
- try {
1581
- for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1582
- var _currentValue2 = _step.value;
1541
+ var out = output.length + 1;
1542
+ bias = adapt(i - oldi, out, oldi == 0);
1583
1543
 
1584
- if (_currentValue2 < 0x80) {
1585
- output.push(stringFromCharCode(_currentValue2));
1586
- }
1587
- }
1588
- } catch (err) {
1589
- _didIteratorError = true;
1590
- _iteratorError = err;
1591
- } finally {
1592
- try {
1593
- if (!_iteratorNormalCompletion && _iterator.return) {
1594
- _iterator.return();
1595
- }
1596
- } finally {
1597
- if (_didIteratorError) {
1598
- throw _iteratorError;
1544
+ // `i` was supposed to wrap around from `out` to `0`,
1545
+ // incrementing `n` each time, so we'll fix that now:
1546
+ if (floor(i / out) > maxInt - n) {
1547
+ error$1('overflow');
1599
1548
  }
1600
- }
1601
- }
1602
1549
 
1603
- var basicLength = output.length;
1604
- var handledCPCount = basicLength;
1550
+ n += floor(i / out);
1551
+ i %= out;
1605
1552
 
1606
- // `handledCPCount` is the number of code points that have been handled;
1607
- // `basicLength` is the number of basic code points.
1608
-
1609
- // Finish the basic string with a delimiter unless it's empty.
1610
- if (basicLength) {
1611
- output.push(delimiter);
1612
- }
1553
+ // Insert `n` at position `i` of the output.
1554
+ output.splice(i++, 0, n);
1555
+ }
1613
1556
 
1614
- // Main encoding loop:
1615
- while (handledCPCount < inputLength) {
1557
+ return String.fromCodePoint.apply(String, output);
1558
+ };
1616
1559
 
1617
- // All non-basic code points < n have been handled already. Find the next
1618
- // larger one:
1619
- var m = maxInt;
1620
- var _iteratorNormalCompletion2 = true;
1621
- var _didIteratorError2 = false;
1622
- var _iteratorError2 = undefined;
1560
+ /**
1561
+ * Converts a string of Unicode symbols (e.g. a domain name label) to a
1562
+ * Punycode string of ASCII-only symbols.
1563
+ * @memberOf punycode
1564
+ * @param {String} input The string of Unicode symbols.
1565
+ * @returns {String} The resulting Punycode string of ASCII-only symbols.
1566
+ */
1567
+ var encode = function encode(input) {
1568
+ var output = [];
1569
+
1570
+ // Convert the input in UCS-2 to an array of Unicode code points.
1571
+ input = ucs2decode(input);
1572
+
1573
+ // Cache the length.
1574
+ var inputLength = input.length;
1575
+
1576
+ // Initialize the state.
1577
+ var n = initialN;
1578
+ var delta = 0;
1579
+ var bias = initialBias;
1580
+
1581
+ // Handle the basic code points.
1582
+ var _iteratorNormalCompletion = true;
1583
+ var _didIteratorError = false;
1584
+ var _iteratorError = undefined;
1623
1585
 
1624
1586
  try {
1625
- for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
1626
- var currentValue = _step2.value;
1587
+ for (var _iterator = input[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1588
+ var _currentValue2 = _step.value;
1627
1589
 
1628
- if (currentValue >= n && currentValue < m) {
1629
- m = currentValue;
1590
+ if (_currentValue2 < 0x80) {
1591
+ output.push(stringFromCharCode(_currentValue2));
1630
1592
  }
1631
1593
  }
1632
-
1633
- // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
1634
- // but guard against overflow.
1635
1594
  } catch (err) {
1636
- _didIteratorError2 = true;
1637
- _iteratorError2 = err;
1595
+ _didIteratorError = true;
1596
+ _iteratorError = err;
1638
1597
  } finally {
1639
1598
  try {
1640
- if (!_iteratorNormalCompletion2 && _iterator2.return) {
1641
- _iterator2.return();
1599
+ if (!_iteratorNormalCompletion && _iterator.return) {
1600
+ _iterator.return();
1642
1601
  }
1643
1602
  } finally {
1644
- if (_didIteratorError2) {
1645
- throw _iteratorError2;
1603
+ if (_didIteratorError) {
1604
+ throw _iteratorError;
1646
1605
  }
1647
1606
  }
1648
1607
  }
1649
1608
 
1650
- var handledCPCountPlusOne = handledCPCount + 1;
1651
- if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
1652
- error$1('overflow');
1653
- }
1609
+ var basicLength = output.length;
1610
+ var handledCPCount = basicLength;
1654
1611
 
1655
- delta += (m - n) * handledCPCountPlusOne;
1656
- n = m;
1612
+ // `handledCPCount` is the number of code points that have been handled;
1613
+ // `basicLength` is the number of basic code points.
1657
1614
 
1658
- var _iteratorNormalCompletion3 = true;
1659
- var _didIteratorError3 = false;
1660
- var _iteratorError3 = undefined;
1615
+ // Finish the basic string with a delimiter unless it's empty.
1616
+ if (basicLength) {
1617
+ output.push(delimiter);
1618
+ }
1661
1619
 
1662
- try {
1663
- for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
1664
- var _currentValue = _step3.value;
1620
+ // Main encoding loop:
1621
+ while (handledCPCount < inputLength) {
1665
1622
 
1666
- if (_currentValue < n && ++delta > maxInt) {
1667
- error$1('overflow');
1668
- }
1669
- if (_currentValue == n) {
1670
- // Represent delta as a generalized variable-length integer.
1671
- var q = delta;
1672
- for (var k = base;; /* no condition */k += base) {
1673
- var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
1674
- if (q < t) {
1675
- break;
1676
- }
1677
- var qMinusT = q - t;
1678
- var baseMinusT = base - t;
1679
- output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
1680
- q = floor(qMinusT / baseMinusT);
1681
- }
1623
+ // All non-basic code points < n have been handled already. Find the next
1624
+ // larger one:
1625
+ var m = maxInt;
1626
+ var _iteratorNormalCompletion2 = true;
1627
+ var _didIteratorError2 = false;
1628
+ var _iteratorError2 = undefined;
1682
1629
 
1683
- output.push(stringFromCharCode(digitToBasic(q, 0)));
1684
- bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
1685
- delta = 0;
1686
- ++handledCPCount;
1687
- }
1688
- }
1689
- } catch (err) {
1690
- _didIteratorError3 = true;
1691
- _iteratorError3 = err;
1692
- } finally {
1693
1630
  try {
1694
- if (!_iteratorNormalCompletion3 && _iterator3.return) {
1695
- _iterator3.return();
1631
+ for (var _iterator2 = input[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
1632
+ var currentValue = _step2.value;
1633
+
1634
+ if (currentValue >= n && currentValue < m) {
1635
+ m = currentValue;
1636
+ }
1696
1637
  }
1638
+
1639
+ // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
1640
+ // but guard against overflow.
1641
+ } catch (err) {
1642
+ _didIteratorError2 = true;
1643
+ _iteratorError2 = err;
1697
1644
  } finally {
1698
- if (_didIteratorError3) {
1699
- throw _iteratorError3;
1645
+ try {
1646
+ if (!_iteratorNormalCompletion2 && _iterator2.return) {
1647
+ _iterator2.return();
1648
+ }
1649
+ } finally {
1650
+ if (_didIteratorError2) {
1651
+ throw _iteratorError2;
1652
+ }
1700
1653
  }
1701
1654
  }
1702
- }
1703
-
1704
- ++delta;
1705
- ++n;
1706
- }
1707
- return output.join('');
1708
- };
1709
-
1710
- /**
1711
- * Converts a Punycode string representing a domain name or an email address
1712
- * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
1713
- * it doesn't matter if you call it on a string that has already been
1714
- * converted to Unicode.
1715
- * @memberOf punycode
1716
- * @param {String} input The Punycoded domain name or email address to
1717
- * convert to Unicode.
1718
- * @returns {String} The Unicode representation of the given Punycode
1719
- * string.
1720
- */
1721
- var toUnicode = function toUnicode(input) {
1722
- return mapDomain(input, function (string) {
1723
- return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
1724
- });
1725
- };
1726
-
1727
- /**
1728
- * Converts a Unicode string representing a domain name or an email address to
1729
- * Punycode. Only the non-ASCII parts of the domain name will be converted,
1730
- * i.e. it doesn't matter if you call it with a domain that's already in
1731
- * ASCII.
1732
- * @memberOf punycode
1733
- * @param {String} input The domain name or email address to convert, as a
1734
- * Unicode string.
1735
- * @returns {String} The Punycode representation of the given domain name or
1736
- * email address.
1737
- */
1738
- var toASCII = function toASCII(input) {
1739
- return mapDomain(input, function (string) {
1740
- return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
1741
- });
1742
- };
1743
1655
 
1744
- /*--------------------------------------------------------------------------*/
1656
+ var handledCPCountPlusOne = handledCPCount + 1;
1657
+ if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
1658
+ error$1('overflow');
1659
+ }
1745
1660
 
1746
- /** Define the public API */
1747
- var punycode = {
1748
- /**
1749
- * A string representing the current Punycode.js version number.
1750
- * @memberOf punycode
1751
- * @type String
1752
- */
1753
- 'version': '2.1.0',
1754
- /**
1755
- * An object of methods to convert from JavaScript's internal character
1756
- * representation (UCS-2) to Unicode code points, and back.
1757
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
1758
- * @memberOf punycode
1759
- * @type Object
1760
- */
1761
- 'ucs2': {
1762
- 'decode': ucs2decode,
1763
- 'encode': ucs2encode
1764
- },
1765
- 'decode': decode,
1766
- 'encode': encode,
1767
- 'toASCII': toASCII,
1768
- 'toUnicode': toUnicode
1769
- };
1661
+ delta += (m - n) * handledCPCountPlusOne;
1662
+ n = m;
1770
1663
 
1771
- /**
1772
- * URI.js
1773
- *
1774
- * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
1775
- * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
1776
- * @see http://github.com/garycourt/uri-js
1777
- */
1778
- /**
1779
- * Copyright 2011 Gary Court. All rights reserved.
1780
- *
1781
- * Redistribution and use in source and binary forms, with or without modification, are
1782
- * permitted provided that the following conditions are met:
1783
- *
1784
- * 1. Redistributions of source code must retain the above copyright notice, this list of
1785
- * conditions and the following disclaimer.
1786
- *
1787
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
1788
- * of conditions and the following disclaimer in the documentation and/or other materials
1789
- * provided with the distribution.
1790
- *
1791
- * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
1792
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1793
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
1794
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1795
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1796
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1797
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
1798
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
1799
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1800
- *
1801
- * The views and conclusions contained in the software and documentation are those of the
1802
- * authors and should not be interpreted as representing official policies, either expressed
1803
- * or implied, of Gary Court.
1804
- */
1805
- var SCHEMES = {};
1806
- function pctEncChar(chr) {
1807
- var c = chr.charCodeAt(0);
1808
- var e = void 0;
1809
- 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();
1810
- return e;
1811
- }
1812
- function pctDecChars(str) {
1813
- var newStr = "";
1814
- var i = 0;
1815
- var il = str.length;
1816
- while (i < il) {
1817
- var c = parseInt(str.substr(i + 1, 2), 16);
1818
- if (c < 128) {
1819
- newStr += String.fromCharCode(c);
1820
- i += 3;
1821
- } else if (c >= 194 && c < 224) {
1822
- if (il - i >= 6) {
1823
- var c2 = parseInt(str.substr(i + 4, 2), 16);
1824
- newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);
1825
- } else {
1826
- newStr += str.substr(i, 6);
1827
- }
1828
- i += 6;
1829
- } else if (c >= 224) {
1830
- if (il - i >= 9) {
1831
- var _c = parseInt(str.substr(i + 4, 2), 16);
1832
- var c3 = parseInt(str.substr(i + 7, 2), 16);
1833
- newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);
1834
- } else {
1835
- newStr += str.substr(i, 9);
1836
- }
1837
- i += 9;
1838
- } else {
1839
- newStr += str.substr(i, 3);
1840
- i += 3;
1841
- }
1842
- }
1843
- return newStr;
1844
- }
1845
- function _normalizeComponentEncoding(components, protocol) {
1846
- function decodeUnreserved(str) {
1847
- var decStr = pctDecChars(str);
1848
- return !decStr.match(protocol.UNRESERVED) ? str : decStr;
1849
- }
1850
- if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
1851
- if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
1852
- 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);
1853
- 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);
1854
- if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
1855
- if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
1856
- return components;
1857
- }
1664
+ var _iteratorNormalCompletion3 = true;
1665
+ var _didIteratorError3 = false;
1666
+ var _iteratorError3 = undefined;
1858
1667
 
1859
- function _stripLeadingZeros(str) {
1860
- return str.replace(/^0*(.*)/, "$1") || "0";
1861
- }
1862
- function _normalizeIPv4(host, protocol) {
1863
- var matches = host.match(protocol.IPV4ADDRESS) || [];
1668
+ try {
1669
+ for (var _iterator3 = input[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
1670
+ var _currentValue = _step3.value;
1864
1671
 
1865
- var _matches = slicedToArray(matches, 2),
1866
- address = _matches[1];
1672
+ if (_currentValue < n && ++delta > maxInt) {
1673
+ error$1('overflow');
1674
+ }
1675
+ if (_currentValue == n) {
1676
+ // Represent delta as a generalized variable-length integer.
1677
+ var q = delta;
1678
+ for (var k = base;; /* no condition */k += base) {
1679
+ var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
1680
+ if (q < t) {
1681
+ break;
1682
+ }
1683
+ var qMinusT = q - t;
1684
+ var baseMinusT = base - t;
1685
+ output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
1686
+ q = floor(qMinusT / baseMinusT);
1687
+ }
1867
1688
 
1868
- if (address) {
1869
- return address.split(".").map(_stripLeadingZeros).join(".");
1870
- } else {
1871
- return host;
1872
- }
1873
- }
1874
- function _normalizeIPv6(host, protocol) {
1875
- var matches = host.match(protocol.IPV6ADDRESS) || [];
1876
-
1877
- var _matches2 = slicedToArray(matches, 3),
1878
- address = _matches2[1],
1879
- zone = _matches2[2];
1880
-
1881
- if (address) {
1882
- var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(),
1883
- _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2),
1884
- last = _address$toLowerCase$2[0],
1885
- first = _address$toLowerCase$2[1];
1886
-
1887
- var firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
1888
- var lastFields = last.split(":").map(_stripLeadingZeros);
1889
- var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
1890
- var fieldCount = isLastFieldIPv4Address ? 7 : 8;
1891
- var lastFieldsStart = lastFields.length - fieldCount;
1892
- var fields = Array(fieldCount);
1893
- for (var x = 0; x < fieldCount; ++x) {
1894
- fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
1895
- }
1896
- if (isLastFieldIPv4Address) {
1897
- fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
1898
- }
1899
- var allZeroFields = fields.reduce(function (acc, field, index) {
1900
- if (!field || field === "0") {
1901
- var lastLongest = acc[acc.length - 1];
1902
- if (lastLongest && lastLongest.index + lastLongest.length === index) {
1903
- lastLongest.length++;
1904
- } else {
1905
- acc.push({ index: index, length: 1 });
1906
- }
1907
- }
1908
- return acc;
1909
- }, []);
1910
- var longestZeroFields = allZeroFields.sort(function (a, b) {
1911
- return b.length - a.length;
1912
- })[0];
1913
- var newHost = void 0;
1914
- if (longestZeroFields && longestZeroFields.length > 1) {
1915
- var newFirst = fields.slice(0, longestZeroFields.index);
1916
- var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
1917
- newHost = newFirst.join(":") + "::" + newLast.join(":");
1918
- } else {
1919
- newHost = fields.join(":");
1920
- }
1921
- if (zone) {
1922
- newHost += "%" + zone;
1923
- }
1924
- return newHost;
1925
- } else {
1926
- return host;
1927
- }
1928
- }
1929
- var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
1930
- var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined;
1931
- function parse(uriString) {
1932
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1933
-
1934
- var components = {};
1935
- var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
1936
- if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
1937
- var matches = uriString.match(URI_PARSE);
1938
- if (matches) {
1939
- if (NO_MATCH_IS_UNDEFINED) {
1940
- //store each component
1941
- components.scheme = matches[1];
1942
- components.userinfo = matches[3];
1943
- components.host = matches[4];
1944
- components.port = parseInt(matches[5], 10);
1945
- components.path = matches[6] || "";
1946
- components.query = matches[7];
1947
- components.fragment = matches[8];
1948
- //fix port number
1949
- if (isNaN(components.port)) {
1950
- components.port = matches[5];
1951
- }
1952
- } else {
1953
- //IE FIX for improper RegExp matching
1954
- //store each component
1955
- components.scheme = matches[1] || undefined;
1956
- components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined;
1957
- components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined;
1958
- components.port = parseInt(matches[5], 10);
1959
- components.path = matches[6] || "";
1960
- components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined;
1961
- components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined;
1962
- //fix port number
1963
- if (isNaN(components.port)) {
1964
- components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined;
1965
- }
1966
- }
1967
- if (components.host) {
1968
- //normalize IP hosts
1969
- components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
1970
- }
1971
- //determine reference type
1972
- if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
1973
- components.reference = "same-document";
1974
- } else if (components.scheme === undefined) {
1975
- components.reference = "relative";
1976
- } else if (components.fragment === undefined) {
1977
- components.reference = "absolute";
1978
- } else {
1979
- components.reference = "uri";
1980
- }
1981
- //check for reference errors
1982
- if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
1983
- components.error = components.error || "URI is not a " + options.reference + " reference.";
1984
- }
1985
- //find scheme handler
1986
- var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
1987
- //check if scheme can't handle IRIs
1988
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
1989
- //if host component is a domain name
1990
- if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {
1991
- //convert Unicode IDN -> ASCII IDN
1992
- try {
1993
- components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
1994
- } catch (e) {
1995
- components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
1996
- }
1997
- }
1998
- //convert IRI -> URI
1999
- _normalizeComponentEncoding(components, URI_PROTOCOL);
2000
- } else {
2001
- //normalize encodings
2002
- _normalizeComponentEncoding(components, protocol);
2003
- }
2004
- //perform scheme specific parsing
2005
- if (schemeHandler && schemeHandler.parse) {
2006
- schemeHandler.parse(components, options);
2007
- }
2008
- } else {
2009
- components.error = components.error || "URI can not be parsed.";
2010
- }
2011
- return components;
2012
- }
1689
+ output.push(stringFromCharCode(digitToBasic(q, 0)));
1690
+ bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
1691
+ delta = 0;
1692
+ ++handledCPCount;
1693
+ }
1694
+ }
1695
+ } catch (err) {
1696
+ _didIteratorError3 = true;
1697
+ _iteratorError3 = err;
1698
+ } finally {
1699
+ try {
1700
+ if (!_iteratorNormalCompletion3 && _iterator3.return) {
1701
+ _iterator3.return();
1702
+ }
1703
+ } finally {
1704
+ if (_didIteratorError3) {
1705
+ throw _iteratorError3;
1706
+ }
1707
+ }
1708
+ }
2013
1709
 
2014
- function _recomposeAuthority(components, options) {
2015
- var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
2016
- var uriTokens = [];
2017
- if (components.userinfo !== undefined) {
2018
- uriTokens.push(components.userinfo);
2019
- uriTokens.push("@");
2020
- }
2021
- if (components.host !== undefined) {
2022
- //normalize IP hosts, add brackets and escape zone separator for IPv6
2023
- uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {
2024
- return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
2025
- }));
2026
- }
2027
- if (typeof components.port === "number" || typeof components.port === "string") {
2028
- uriTokens.push(":");
2029
- uriTokens.push(String(components.port));
2030
- }
2031
- return uriTokens.length ? uriTokens.join("") : undefined;
2032
- }
1710
+ ++delta;
1711
+ ++n;
1712
+ }
1713
+ return output.join('');
1714
+ };
2033
1715
 
2034
- var RDS1 = /^\.\.?\//;
2035
- var RDS2 = /^\/\.(\/|$)/;
2036
- var RDS3 = /^\/\.\.(\/|$)/;
2037
- var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
2038
- function removeDotSegments(input) {
2039
- var output = [];
2040
- while (input.length) {
2041
- if (input.match(RDS1)) {
2042
- input = input.replace(RDS1, "");
2043
- } else if (input.match(RDS2)) {
2044
- input = input.replace(RDS2, "/");
2045
- } else if (input.match(RDS3)) {
2046
- input = input.replace(RDS3, "/");
2047
- output.pop();
2048
- } else if (input === "." || input === "..") {
2049
- input = "";
2050
- } else {
2051
- var im = input.match(RDS5);
2052
- if (im) {
2053
- var s = im[0];
2054
- input = input.slice(s.length);
2055
- output.push(s);
2056
- } else {
2057
- throw new Error("Unexpected dot segment condition");
2058
- }
2059
- }
2060
- }
2061
- return output.join("");
2062
- }
1716
+ /**
1717
+ * Converts a Punycode string representing a domain name or an email address
1718
+ * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
1719
+ * it doesn't matter if you call it on a string that has already been
1720
+ * converted to Unicode.
1721
+ * @memberOf punycode
1722
+ * @param {String} input The Punycoded domain name or email address to
1723
+ * convert to Unicode.
1724
+ * @returns {String} The Unicode representation of the given Punycode
1725
+ * string.
1726
+ */
1727
+ var toUnicode = function toUnicode(input) {
1728
+ return mapDomain(input, function (string) {
1729
+ return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
1730
+ });
1731
+ };
2063
1732
 
2064
- function serialize(components) {
2065
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2066
-
2067
- var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;
2068
- var uriTokens = [];
2069
- //find scheme handler
2070
- var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
2071
- //perform scheme specific serialization
2072
- if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
2073
- if (components.host) {
2074
- //if host component is an IPv6 address
2075
- if (protocol.IPV6ADDRESS.test(components.host)) ;
2076
- //TODO: normalize IPv6 address as per RFC 5952
2077
-
2078
- //if host component is a domain name
2079
- else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {
2080
- //convert IDN via punycode
2081
- try {
2082
- components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);
2083
- } catch (e) {
2084
- components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
2085
- }
2086
- }
2087
- }
2088
- //normalize encoding
2089
- _normalizeComponentEncoding(components, protocol);
2090
- if (options.reference !== "suffix" && components.scheme) {
2091
- uriTokens.push(components.scheme);
2092
- uriTokens.push(":");
2093
- }
2094
- var authority = _recomposeAuthority(components, options);
2095
- if (authority !== undefined) {
2096
- if (options.reference !== "suffix") {
2097
- uriTokens.push("//");
2098
- }
2099
- uriTokens.push(authority);
2100
- if (components.path && components.path.charAt(0) !== "/") {
2101
- uriTokens.push("/");
2102
- }
2103
- }
2104
- if (components.path !== undefined) {
2105
- var s = components.path;
2106
- if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
2107
- s = removeDotSegments(s);
2108
- }
2109
- if (authority === undefined) {
2110
- s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
2111
- }
2112
- uriTokens.push(s);
2113
- }
2114
- if (components.query !== undefined) {
2115
- uriTokens.push("?");
2116
- uriTokens.push(components.query);
2117
- }
2118
- if (components.fragment !== undefined) {
2119
- uriTokens.push("#");
2120
- uriTokens.push(components.fragment);
2121
- }
2122
- return uriTokens.join(""); //merge tokens into a string
2123
- }
1733
+ /**
1734
+ * Converts a Unicode string representing a domain name or an email address to
1735
+ * Punycode. Only the non-ASCII parts of the domain name will be converted,
1736
+ * i.e. it doesn't matter if you call it with a domain that's already in
1737
+ * ASCII.
1738
+ * @memberOf punycode
1739
+ * @param {String} input The domain name or email address to convert, as a
1740
+ * Unicode string.
1741
+ * @returns {String} The Punycode representation of the given domain name or
1742
+ * email address.
1743
+ */
1744
+ var toASCII = function toASCII(input) {
1745
+ return mapDomain(input, function (string) {
1746
+ return regexNonASCII.test(string) ? 'xn--' + encode(string) : string;
1747
+ });
1748
+ };
1749
+
1750
+ /*--------------------------------------------------------------------------*/
1751
+
1752
+ /** Define the public API */
1753
+ var punycode = {
1754
+ /**
1755
+ * A string representing the current Punycode.js version number.
1756
+ * @memberOf punycode
1757
+ * @type String
1758
+ */
1759
+ 'version': '2.1.0',
1760
+ /**
1761
+ * An object of methods to convert from JavaScript's internal character
1762
+ * representation (UCS-2) to Unicode code points, and back.
1763
+ * @see <https://mathiasbynens.be/notes/javascript-encoding>
1764
+ * @memberOf punycode
1765
+ * @type Object
1766
+ */
1767
+ 'ucs2': {
1768
+ 'decode': ucs2decode,
1769
+ 'encode': ucs2encode
1770
+ },
1771
+ 'decode': decode,
1772
+ 'encode': encode,
1773
+ 'toASCII': toASCII,
1774
+ 'toUnicode': toUnicode
1775
+ };
2124
1776
 
2125
- function resolveComponents(base, relative) {
2126
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2127
- var skipNormalization = arguments[3];
2128
-
2129
- var target = {};
2130
- if (!skipNormalization) {
2131
- base = parse(serialize(base, options), options); //normalize base components
2132
- relative = parse(serialize(relative, options), options); //normalize relative components
2133
- }
2134
- options = options || {};
2135
- if (!options.tolerant && relative.scheme) {
2136
- target.scheme = relative.scheme;
2137
- //target.authority = relative.authority;
2138
- target.userinfo = relative.userinfo;
2139
- target.host = relative.host;
2140
- target.port = relative.port;
2141
- target.path = removeDotSegments(relative.path || "");
2142
- target.query = relative.query;
2143
- } else {
2144
- if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
2145
- //target.authority = relative.authority;
2146
- target.userinfo = relative.userinfo;
2147
- target.host = relative.host;
2148
- target.port = relative.port;
2149
- target.path = removeDotSegments(relative.path || "");
2150
- target.query = relative.query;
2151
- } else {
2152
- if (!relative.path) {
2153
- target.path = base.path;
2154
- if (relative.query !== undefined) {
2155
- target.query = relative.query;
2156
- } else {
2157
- target.query = base.query;
2158
- }
2159
- } else {
2160
- if (relative.path.charAt(0) === "/") {
2161
- target.path = removeDotSegments(relative.path);
2162
- } else {
2163
- if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
2164
- target.path = "/" + relative.path;
2165
- } else if (!base.path) {
2166
- target.path = relative.path;
2167
- } else {
2168
- target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
2169
- }
2170
- target.path = removeDotSegments(target.path);
2171
- }
2172
- target.query = relative.query;
2173
- }
2174
- //target.authority = base.authority;
2175
- target.userinfo = base.userinfo;
2176
- target.host = base.host;
2177
- target.port = base.port;
2178
- }
2179
- target.scheme = base.scheme;
2180
- }
2181
- target.fragment = relative.fragment;
2182
- return target;
2183
- }
1777
+ /**
1778
+ * URI.js
1779
+ *
1780
+ * @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
1781
+ * @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
1782
+ * @see http://github.com/garycourt/uri-js
1783
+ */
1784
+ /**
1785
+ * Copyright 2011 Gary Court. All rights reserved.
1786
+ *
1787
+ * Redistribution and use in source and binary forms, with or without modification, are
1788
+ * permitted provided that the following conditions are met:
1789
+ *
1790
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
1791
+ * conditions and the following disclaimer.
1792
+ *
1793
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
1794
+ * of conditions and the following disclaimer in the documentation and/or other materials
1795
+ * provided with the distribution.
1796
+ *
1797
+ * THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
1798
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
1799
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
1800
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1801
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1802
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
1803
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
1804
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
1805
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1806
+ *
1807
+ * The views and conclusions contained in the software and documentation are those of the
1808
+ * authors and should not be interpreted as representing official policies, either expressed
1809
+ * or implied, of Gary Court.
1810
+ */
1811
+ var SCHEMES = {};
1812
+ function pctEncChar(chr) {
1813
+ var c = chr.charCodeAt(0);
1814
+ var e = void 0;
1815
+ 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();
1816
+ return e;
1817
+ }
1818
+ function pctDecChars(str) {
1819
+ var newStr = "";
1820
+ var i = 0;
1821
+ var il = str.length;
1822
+ while (i < il) {
1823
+ var c = parseInt(str.substr(i + 1, 2), 16);
1824
+ if (c < 128) {
1825
+ newStr += String.fromCharCode(c);
1826
+ i += 3;
1827
+ } else if (c >= 194 && c < 224) {
1828
+ if (il - i >= 6) {
1829
+ var c2 = parseInt(str.substr(i + 4, 2), 16);
1830
+ newStr += String.fromCharCode((c & 31) << 6 | c2 & 63);
1831
+ } else {
1832
+ newStr += str.substr(i, 6);
1833
+ }
1834
+ i += 6;
1835
+ } else if (c >= 224) {
1836
+ if (il - i >= 9) {
1837
+ var _c = parseInt(str.substr(i + 4, 2), 16);
1838
+ var c3 = parseInt(str.substr(i + 7, 2), 16);
1839
+ newStr += String.fromCharCode((c & 15) << 12 | (_c & 63) << 6 | c3 & 63);
1840
+ } else {
1841
+ newStr += str.substr(i, 9);
1842
+ }
1843
+ i += 9;
1844
+ } else {
1845
+ newStr += str.substr(i, 3);
1846
+ i += 3;
1847
+ }
1848
+ }
1849
+ return newStr;
1850
+ }
1851
+ function _normalizeComponentEncoding(components, protocol) {
1852
+ function decodeUnreserved(str) {
1853
+ var decStr = pctDecChars(str);
1854
+ return !decStr.match(protocol.UNRESERVED) ? str : decStr;
1855
+ }
1856
+ if (components.scheme) components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
1857
+ if (components.userinfo !== undefined) components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
1858
+ 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);
1859
+ 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);
1860
+ if (components.query !== undefined) components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
1861
+ if (components.fragment !== undefined) components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
1862
+ return components;
1863
+ }
2184
1864
 
2185
- function resolve(baseURI, relativeURI, options) {
2186
- var schemelessOptions = assign({ scheme: 'null' }, options);
2187
- return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
2188
- }
1865
+ function _stripLeadingZeros(str) {
1866
+ return str.replace(/^0*(.*)/, "$1") || "0";
1867
+ }
1868
+ function _normalizeIPv4(host, protocol) {
1869
+ var matches = host.match(protocol.IPV4ADDRESS) || [];
2189
1870
 
2190
- function normalize(uri, options) {
2191
- if (typeof uri === "string") {
2192
- uri = serialize(parse(uri, options), options);
2193
- } else if (typeOf(uri) === "object") {
2194
- uri = parse(serialize(uri, options), options);
2195
- }
2196
- return uri;
2197
- }
1871
+ var _matches = slicedToArray(matches, 2),
1872
+ address = _matches[1];
2198
1873
 
2199
- function equal(uriA, uriB, options) {
2200
- if (typeof uriA === "string") {
2201
- uriA = serialize(parse(uriA, options), options);
2202
- } else if (typeOf(uriA) === "object") {
2203
- uriA = serialize(uriA, options);
2204
- }
2205
- if (typeof uriB === "string") {
2206
- uriB = serialize(parse(uriB, options), options);
2207
- } else if (typeOf(uriB) === "object") {
2208
- uriB = serialize(uriB, options);
2209
- }
2210
- return uriA === uriB;
2211
- }
1874
+ if (address) {
1875
+ return address.split(".").map(_stripLeadingZeros).join(".");
1876
+ } else {
1877
+ return host;
1878
+ }
1879
+ }
1880
+ function _normalizeIPv6(host, protocol) {
1881
+ var matches = host.match(protocol.IPV6ADDRESS) || [];
1882
+
1883
+ var _matches2 = slicedToArray(matches, 3),
1884
+ address = _matches2[1],
1885
+ zone = _matches2[2];
1886
+
1887
+ if (address) {
1888
+ var _address$toLowerCase$ = address.toLowerCase().split('::').reverse(),
1889
+ _address$toLowerCase$2 = slicedToArray(_address$toLowerCase$, 2),
1890
+ last = _address$toLowerCase$2[0],
1891
+ first = _address$toLowerCase$2[1];
1892
+
1893
+ var firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
1894
+ var lastFields = last.split(":").map(_stripLeadingZeros);
1895
+ var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
1896
+ var fieldCount = isLastFieldIPv4Address ? 7 : 8;
1897
+ var lastFieldsStart = lastFields.length - fieldCount;
1898
+ var fields = Array(fieldCount);
1899
+ for (var x = 0; x < fieldCount; ++x) {
1900
+ fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
1901
+ }
1902
+ if (isLastFieldIPv4Address) {
1903
+ fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
1904
+ }
1905
+ var allZeroFields = fields.reduce(function (acc, field, index) {
1906
+ if (!field || field === "0") {
1907
+ var lastLongest = acc[acc.length - 1];
1908
+ if (lastLongest && lastLongest.index + lastLongest.length === index) {
1909
+ lastLongest.length++;
1910
+ } else {
1911
+ acc.push({ index: index, length: 1 });
1912
+ }
1913
+ }
1914
+ return acc;
1915
+ }, []);
1916
+ var longestZeroFields = allZeroFields.sort(function (a, b) {
1917
+ return b.length - a.length;
1918
+ })[0];
1919
+ var newHost = void 0;
1920
+ if (longestZeroFields && longestZeroFields.length > 1) {
1921
+ var newFirst = fields.slice(0, longestZeroFields.index);
1922
+ var newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
1923
+ newHost = newFirst.join(":") + "::" + newLast.join(":");
1924
+ } else {
1925
+ newHost = fields.join(":");
1926
+ }
1927
+ if (zone) {
1928
+ newHost += "%" + zone;
1929
+ }
1930
+ return newHost;
1931
+ } else {
1932
+ return host;
1933
+ }
1934
+ }
1935
+ var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
1936
+ var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === undefined;
1937
+ function parse(uriString) {
1938
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1939
+
1940
+ var components = {};
1941
+ var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
1942
+ if (options.reference === "suffix") uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
1943
+ var matches = uriString.match(URI_PARSE);
1944
+ if (matches) {
1945
+ if (NO_MATCH_IS_UNDEFINED) {
1946
+ //store each component
1947
+ components.scheme = matches[1];
1948
+ components.userinfo = matches[3];
1949
+ components.host = matches[4];
1950
+ components.port = parseInt(matches[5], 10);
1951
+ components.path = matches[6] || "";
1952
+ components.query = matches[7];
1953
+ components.fragment = matches[8];
1954
+ //fix port number
1955
+ if (isNaN(components.port)) {
1956
+ components.port = matches[5];
1957
+ }
1958
+ } else {
1959
+ //IE FIX for improper RegExp matching
1960
+ //store each component
1961
+ components.scheme = matches[1] || undefined;
1962
+ components.userinfo = uriString.indexOf("@") !== -1 ? matches[3] : undefined;
1963
+ components.host = uriString.indexOf("//") !== -1 ? matches[4] : undefined;
1964
+ components.port = parseInt(matches[5], 10);
1965
+ components.path = matches[6] || "";
1966
+ components.query = uriString.indexOf("?") !== -1 ? matches[7] : undefined;
1967
+ components.fragment = uriString.indexOf("#") !== -1 ? matches[8] : undefined;
1968
+ //fix port number
1969
+ if (isNaN(components.port)) {
1970
+ components.port = uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined;
1971
+ }
1972
+ }
1973
+ if (components.host) {
1974
+ //normalize IP hosts
1975
+ components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
1976
+ }
1977
+ //determine reference type
1978
+ if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
1979
+ components.reference = "same-document";
1980
+ } else if (components.scheme === undefined) {
1981
+ components.reference = "relative";
1982
+ } else if (components.fragment === undefined) {
1983
+ components.reference = "absolute";
1984
+ } else {
1985
+ components.reference = "uri";
1986
+ }
1987
+ //check for reference errors
1988
+ if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
1989
+ components.error = components.error || "URI is not a " + options.reference + " reference.";
1990
+ }
1991
+ //find scheme handler
1992
+ var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
1993
+ //check if scheme can't handle IRIs
1994
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
1995
+ //if host component is a domain name
1996
+ if (components.host && (options.domainHost || schemeHandler && schemeHandler.domainHost)) {
1997
+ //convert Unicode IDN -> ASCII IDN
1998
+ try {
1999
+ components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
2000
+ } catch (e) {
2001
+ components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
2002
+ }
2003
+ }
2004
+ //convert IRI -> URI
2005
+ _normalizeComponentEncoding(components, URI_PROTOCOL);
2006
+ } else {
2007
+ //normalize encodings
2008
+ _normalizeComponentEncoding(components, protocol);
2009
+ }
2010
+ //perform scheme specific parsing
2011
+ if (schemeHandler && schemeHandler.parse) {
2012
+ schemeHandler.parse(components, options);
2013
+ }
2014
+ } else {
2015
+ components.error = components.error || "URI can not be parsed.";
2016
+ }
2017
+ return components;
2018
+ }
2212
2019
 
2213
- function escapeComponent(str, options) {
2214
- return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);
2215
- }
2020
+ function _recomposeAuthority(components, options) {
2021
+ var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
2022
+ var uriTokens = [];
2023
+ if (components.userinfo !== undefined) {
2024
+ uriTokens.push(components.userinfo);
2025
+ uriTokens.push("@");
2026
+ }
2027
+ if (components.host !== undefined) {
2028
+ //normalize IP hosts, add brackets and escape zone separator for IPv6
2029
+ uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, function (_, $1, $2) {
2030
+ return "[" + $1 + ($2 ? "%25" + $2 : "") + "]";
2031
+ }));
2032
+ }
2033
+ if (typeof components.port === "number" || typeof components.port === "string") {
2034
+ uriTokens.push(":");
2035
+ uriTokens.push(String(components.port));
2036
+ }
2037
+ return uriTokens.length ? uriTokens.join("") : undefined;
2038
+ }
2216
2039
 
2217
- function unescapeComponent(str, options) {
2218
- return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);
2219
- }
2040
+ var RDS1 = /^\.\.?\//;
2041
+ var RDS2 = /^\/\.(\/|$)/;
2042
+ var RDS3 = /^\/\.\.(\/|$)/;
2043
+ var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
2044
+ function removeDotSegments(input) {
2045
+ var output = [];
2046
+ while (input.length) {
2047
+ if (input.match(RDS1)) {
2048
+ input = input.replace(RDS1, "");
2049
+ } else if (input.match(RDS2)) {
2050
+ input = input.replace(RDS2, "/");
2051
+ } else if (input.match(RDS3)) {
2052
+ input = input.replace(RDS3, "/");
2053
+ output.pop();
2054
+ } else if (input === "." || input === "..") {
2055
+ input = "";
2056
+ } else {
2057
+ var im = input.match(RDS5);
2058
+ if (im) {
2059
+ var s = im[0];
2060
+ input = input.slice(s.length);
2061
+ output.push(s);
2062
+ } else {
2063
+ throw new Error("Unexpected dot segment condition");
2064
+ }
2065
+ }
2066
+ }
2067
+ return output.join("");
2068
+ }
2220
2069
 
2221
- var handler = {
2222
- scheme: "http",
2223
- domainHost: true,
2224
- parse: function parse(components, options) {
2225
- //report missing host
2226
- if (!components.host) {
2227
- components.error = components.error || "HTTP URIs must have a host.";
2228
- }
2229
- return components;
2230
- },
2231
- serialize: function serialize(components, options) {
2232
- var secure = String(components.scheme).toLowerCase() === "https";
2233
- //normalize the default port
2234
- if (components.port === (secure ? 443 : 80) || components.port === "") {
2235
- components.port = undefined;
2236
- }
2237
- //normalize the empty path
2238
- if (!components.path) {
2239
- components.path = "/";
2240
- }
2241
- //NOTE: We do not parse query strings for HTTP URIs
2242
- //as WWW Form Url Encoded query strings are part of the HTML4+ spec,
2243
- //and not the HTTP spec.
2244
- return components;
2245
- }
2246
- };
2070
+ function serialize(components) {
2071
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2072
+
2073
+ var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL;
2074
+ var uriTokens = [];
2075
+ //find scheme handler
2076
+ var schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
2077
+ //perform scheme specific serialization
2078
+ if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options);
2079
+ if (components.host) {
2080
+ //if host component is an IPv6 address
2081
+ if (protocol.IPV6ADDRESS.test(components.host)) ;
2082
+ //TODO: normalize IPv6 address as per RFC 5952
2083
+
2084
+ //if host component is a domain name
2085
+ else if (options.domainHost || schemeHandler && schemeHandler.domainHost) {
2086
+ //convert IDN via punycode
2087
+ try {
2088
+ components.host = !options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host);
2089
+ } catch (e) {
2090
+ components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
2091
+ }
2092
+ }
2093
+ }
2094
+ //normalize encoding
2095
+ _normalizeComponentEncoding(components, protocol);
2096
+ if (options.reference !== "suffix" && components.scheme) {
2097
+ uriTokens.push(components.scheme);
2098
+ uriTokens.push(":");
2099
+ }
2100
+ var authority = _recomposeAuthority(components, options);
2101
+ if (authority !== undefined) {
2102
+ if (options.reference !== "suffix") {
2103
+ uriTokens.push("//");
2104
+ }
2105
+ uriTokens.push(authority);
2106
+ if (components.path && components.path.charAt(0) !== "/") {
2107
+ uriTokens.push("/");
2108
+ }
2109
+ }
2110
+ if (components.path !== undefined) {
2111
+ var s = components.path;
2112
+ if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
2113
+ s = removeDotSegments(s);
2114
+ }
2115
+ if (authority === undefined) {
2116
+ s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
2117
+ }
2118
+ uriTokens.push(s);
2119
+ }
2120
+ if (components.query !== undefined) {
2121
+ uriTokens.push("?");
2122
+ uriTokens.push(components.query);
2123
+ }
2124
+ if (components.fragment !== undefined) {
2125
+ uriTokens.push("#");
2126
+ uriTokens.push(components.fragment);
2127
+ }
2128
+ return uriTokens.join(""); //merge tokens into a string
2129
+ }
2247
2130
 
2248
- var handler$1 = {
2249
- scheme: "https",
2250
- domainHost: handler.domainHost,
2251
- parse: handler.parse,
2252
- serialize: handler.serialize
2253
- };
2131
+ function resolveComponents(base, relative) {
2132
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2133
+ var skipNormalization = arguments[3];
2134
+
2135
+ var target = {};
2136
+ if (!skipNormalization) {
2137
+ base = parse(serialize(base, options), options); //normalize base components
2138
+ relative = parse(serialize(relative, options), options); //normalize relative components
2139
+ }
2140
+ options = options || {};
2141
+ if (!options.tolerant && relative.scheme) {
2142
+ target.scheme = relative.scheme;
2143
+ //target.authority = relative.authority;
2144
+ target.userinfo = relative.userinfo;
2145
+ target.host = relative.host;
2146
+ target.port = relative.port;
2147
+ target.path = removeDotSegments(relative.path || "");
2148
+ target.query = relative.query;
2149
+ } else {
2150
+ if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
2151
+ //target.authority = relative.authority;
2152
+ target.userinfo = relative.userinfo;
2153
+ target.host = relative.host;
2154
+ target.port = relative.port;
2155
+ target.path = removeDotSegments(relative.path || "");
2156
+ target.query = relative.query;
2157
+ } else {
2158
+ if (!relative.path) {
2159
+ target.path = base.path;
2160
+ if (relative.query !== undefined) {
2161
+ target.query = relative.query;
2162
+ } else {
2163
+ target.query = base.query;
2164
+ }
2165
+ } else {
2166
+ if (relative.path.charAt(0) === "/") {
2167
+ target.path = removeDotSegments(relative.path);
2168
+ } else {
2169
+ if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
2170
+ target.path = "/" + relative.path;
2171
+ } else if (!base.path) {
2172
+ target.path = relative.path;
2173
+ } else {
2174
+ target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
2175
+ }
2176
+ target.path = removeDotSegments(target.path);
2177
+ }
2178
+ target.query = relative.query;
2179
+ }
2180
+ //target.authority = base.authority;
2181
+ target.userinfo = base.userinfo;
2182
+ target.host = base.host;
2183
+ target.port = base.port;
2184
+ }
2185
+ target.scheme = base.scheme;
2186
+ }
2187
+ target.fragment = relative.fragment;
2188
+ return target;
2189
+ }
2254
2190
 
2255
- function isSecure(wsComponents) {
2256
- return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
2257
- }
2258
- //RFC 6455
2259
- var handler$2 = {
2260
- scheme: "ws",
2261
- domainHost: true,
2262
- parse: function parse(components, options) {
2263
- var wsComponents = components;
2264
- //indicate if the secure flag is set
2265
- wsComponents.secure = isSecure(wsComponents);
2266
- //construct resouce name
2267
- wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
2268
- wsComponents.path = undefined;
2269
- wsComponents.query = undefined;
2270
- return wsComponents;
2271
- },
2272
- serialize: function serialize(wsComponents, options) {
2273
- //normalize the default port
2274
- if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
2275
- wsComponents.port = undefined;
2276
- }
2277
- //ensure scheme matches secure flag
2278
- if (typeof wsComponents.secure === 'boolean') {
2279
- wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';
2280
- wsComponents.secure = undefined;
2281
- }
2282
- //reconstruct path from resource name
2283
- if (wsComponents.resourceName) {
2284
- var _wsComponents$resourc = wsComponents.resourceName.split('?'),
2285
- _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),
2286
- path = _wsComponents$resourc2[0],
2287
- query = _wsComponents$resourc2[1];
2288
-
2289
- wsComponents.path = path && path !== '/' ? path : undefined;
2290
- wsComponents.query = query;
2291
- wsComponents.resourceName = undefined;
2292
- }
2293
- //forbid fragment component
2294
- wsComponents.fragment = undefined;
2295
- return wsComponents;
2296
- }
2297
- };
2191
+ function resolve(baseURI, relativeURI, options) {
2192
+ var schemelessOptions = assign({ scheme: 'null' }, options);
2193
+ return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
2194
+ }
2298
2195
 
2299
- var handler$3 = {
2300
- scheme: "wss",
2301
- domainHost: handler$2.domainHost,
2302
- parse: handler$2.parse,
2303
- serialize: handler$2.serialize
2304
- };
2196
+ function normalize(uri, options) {
2197
+ if (typeof uri === "string") {
2198
+ uri = serialize(parse(uri, options), options);
2199
+ } else if (typeOf(uri) === "object") {
2200
+ uri = parse(serialize(uri, options), options);
2201
+ }
2202
+ return uri;
2203
+ }
2305
2204
 
2306
- var O = {};
2307
- //RFC 3986
2308
- var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + ("\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" ) + "]";
2309
- var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
2310
- var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
2311
- //RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
2312
- //const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
2313
- //const WSP$$ = "[\\x20\\x09]";
2314
- //const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)
2315
- //const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext
2316
- //const VCHAR$$ = "[\\x21-\\x7E]";
2317
- //const WSP$$ = "[\\x20\\x09]";
2318
- //const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
2319
- //const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
2320
- //const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
2321
- //const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
2322
- var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
2323
- var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
2324
- var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
2325
- var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
2326
- var UNRESERVED = new RegExp(UNRESERVED$$, "g");
2327
- var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
2328
- var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
2329
- var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
2330
- var NOT_HFVALUE = NOT_HFNAME;
2331
- function decodeUnreserved(str) {
2332
- var decStr = pctDecChars(str);
2333
- return !decStr.match(UNRESERVED) ? str : decStr;
2334
- }
2335
- var handler$4 = {
2336
- scheme: "mailto",
2337
- parse: function parse$$1(components, options) {
2338
- var mailtoComponents = components;
2339
- var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : [];
2340
- mailtoComponents.path = undefined;
2341
- if (mailtoComponents.query) {
2342
- var unknownHeaders = false;
2343
- var headers = {};
2344
- var hfields = mailtoComponents.query.split("&");
2345
- for (var x = 0, xl = hfields.length; x < xl; ++x) {
2346
- var hfield = hfields[x].split("=");
2347
- switch (hfield[0]) {
2348
- case "to":
2349
- var toAddrs = hfield[1].split(",");
2350
- for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {
2351
- to.push(toAddrs[_x]);
2352
- }
2353
- break;
2354
- case "subject":
2355
- mailtoComponents.subject = unescapeComponent(hfield[1], options);
2356
- break;
2357
- case "body":
2358
- mailtoComponents.body = unescapeComponent(hfield[1], options);
2359
- break;
2360
- default:
2361
- unknownHeaders = true;
2362
- headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
2363
- break;
2364
- }
2365
- }
2366
- if (unknownHeaders) mailtoComponents.headers = headers;
2367
- }
2368
- mailtoComponents.query = undefined;
2369
- for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {
2370
- var addr = to[_x2].split("@");
2371
- addr[0] = unescapeComponent(addr[0]);
2372
- if (!options.unicodeSupport) {
2373
- //convert Unicode IDN -> ASCII IDN
2374
- try {
2375
- addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
2376
- } catch (e) {
2377
- mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
2378
- }
2379
- } else {
2380
- addr[1] = unescapeComponent(addr[1], options).toLowerCase();
2381
- }
2382
- to[_x2] = addr.join("@");
2383
- }
2384
- return mailtoComponents;
2385
- },
2386
- serialize: function serialize$$1(mailtoComponents, options) {
2387
- var components = mailtoComponents;
2388
- var to = toArray(mailtoComponents.to);
2389
- if (to) {
2390
- for (var x = 0, xl = to.length; x < xl; ++x) {
2391
- var toAddr = String(to[x]);
2392
- var atIdx = toAddr.lastIndexOf("@");
2393
- var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
2394
- var domain = toAddr.slice(atIdx + 1);
2395
- //convert IDN via punycode
2396
- try {
2397
- domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);
2398
- } catch (e) {
2399
- components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
2400
- }
2401
- to[x] = localPart + "@" + domain;
2402
- }
2403
- components.path = to.join(",");
2404
- }
2405
- var headers = mailtoComponents.headers = mailtoComponents.headers || {};
2406
- if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
2407
- if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
2408
- var fields = [];
2409
- for (var name in headers) {
2410
- if (headers[name] !== O[name]) {
2411
- 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));
2412
- }
2413
- }
2414
- if (fields.length) {
2415
- components.query = fields.join("&");
2416
- }
2417
- return components;
2418
- }
2419
- };
2205
+ function equal(uriA, uriB, options) {
2206
+ if (typeof uriA === "string") {
2207
+ uriA = serialize(parse(uriA, options), options);
2208
+ } else if (typeOf(uriA) === "object") {
2209
+ uriA = serialize(uriA, options);
2210
+ }
2211
+ if (typeof uriB === "string") {
2212
+ uriB = serialize(parse(uriB, options), options);
2213
+ } else if (typeOf(uriB) === "object") {
2214
+ uriB = serialize(uriB, options);
2215
+ }
2216
+ return uriA === uriB;
2217
+ }
2420
2218
 
2421
- var URN_PARSE = /^([^\:]+)\:(.*)/;
2422
- //RFC 2141
2423
- var handler$5 = {
2424
- scheme: "urn",
2425
- parse: function parse$$1(components, options) {
2426
- var matches = components.path && components.path.match(URN_PARSE);
2427
- var urnComponents = components;
2428
- if (matches) {
2429
- var scheme = options.scheme || urnComponents.scheme || "urn";
2430
- var nid = matches[1].toLowerCase();
2431
- var nss = matches[2];
2432
- var urnScheme = scheme + ":" + (options.nid || nid);
2433
- var schemeHandler = SCHEMES[urnScheme];
2434
- urnComponents.nid = nid;
2435
- urnComponents.nss = nss;
2436
- urnComponents.path = undefined;
2437
- if (schemeHandler) {
2438
- urnComponents = schemeHandler.parse(urnComponents, options);
2439
- }
2440
- } else {
2441
- urnComponents.error = urnComponents.error || "URN can not be parsed.";
2442
- }
2443
- return urnComponents;
2444
- },
2445
- serialize: function serialize$$1(urnComponents, options) {
2446
- var scheme = options.scheme || urnComponents.scheme || "urn";
2447
- var nid = urnComponents.nid;
2448
- var urnScheme = scheme + ":" + (options.nid || nid);
2449
- var schemeHandler = SCHEMES[urnScheme];
2450
- if (schemeHandler) {
2451
- urnComponents = schemeHandler.serialize(urnComponents, options);
2452
- }
2453
- var uriComponents = urnComponents;
2454
- var nss = urnComponents.nss;
2455
- uriComponents.path = (nid || options.nid) + ":" + nss;
2456
- return uriComponents;
2457
- }
2458
- };
2219
+ function escapeComponent(str, options) {
2220
+ return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE, pctEncChar);
2221
+ }
2459
2222
 
2460
- var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
2461
- //RFC 4122
2462
- var handler$6 = {
2463
- scheme: "urn:uuid",
2464
- parse: function parse(urnComponents, options) {
2465
- var uuidComponents = urnComponents;
2466
- uuidComponents.uuid = uuidComponents.nss;
2467
- uuidComponents.nss = undefined;
2468
- if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
2469
- uuidComponents.error = uuidComponents.error || "UUID is not valid.";
2470
- }
2471
- return uuidComponents;
2472
- },
2473
- serialize: function serialize(uuidComponents, options) {
2474
- var urnComponents = uuidComponents;
2475
- //normalize UUID
2476
- urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
2477
- return urnComponents;
2478
- }
2479
- };
2223
+ function unescapeComponent(str, options) {
2224
+ return str && str.toString().replace(!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED, pctDecChars);
2225
+ }
2480
2226
 
2481
- SCHEMES[handler.scheme] = handler;
2482
- SCHEMES[handler$1.scheme] = handler$1;
2483
- SCHEMES[handler$2.scheme] = handler$2;
2484
- SCHEMES[handler$3.scheme] = handler$3;
2485
- SCHEMES[handler$4.scheme] = handler$4;
2486
- SCHEMES[handler$5.scheme] = handler$5;
2487
- SCHEMES[handler$6.scheme] = handler$6;
2488
-
2489
- exports.SCHEMES = SCHEMES;
2490
- exports.pctEncChar = pctEncChar;
2491
- exports.pctDecChars = pctDecChars;
2492
- exports.parse = parse;
2493
- exports.removeDotSegments = removeDotSegments;
2494
- exports.serialize = serialize;
2495
- exports.resolveComponents = resolveComponents;
2496
- exports.resolve = resolve;
2497
- exports.normalize = normalize;
2498
- exports.equal = equal;
2499
- exports.escapeComponent = escapeComponent;
2500
- exports.unescapeComponent = unescapeComponent;
2501
-
2502
- Object.defineProperty(exports, '__esModule', { value: true });
2503
-
2504
- })));
2505
-
2506
- }(uri_all, uri_all.exports));
2227
+ var handler = {
2228
+ scheme: "http",
2229
+ domainHost: true,
2230
+ parse: function parse(components, options) {
2231
+ //report missing host
2232
+ if (!components.host) {
2233
+ components.error = components.error || "HTTP URIs must have a host.";
2234
+ }
2235
+ return components;
2236
+ },
2237
+ serialize: function serialize(components, options) {
2238
+ var secure = String(components.scheme).toLowerCase() === "https";
2239
+ //normalize the default port
2240
+ if (components.port === (secure ? 443 : 80) || components.port === "") {
2241
+ components.port = undefined;
2242
+ }
2243
+ //normalize the empty path
2244
+ if (!components.path) {
2245
+ components.path = "/";
2246
+ }
2247
+ //NOTE: We do not parse query strings for HTTP URIs
2248
+ //as WWW Form Url Encoded query strings are part of the HTML4+ spec,
2249
+ //and not the HTTP spec.
2250
+ return components;
2251
+ }
2252
+ };
2253
+
2254
+ var handler$1 = {
2255
+ scheme: "https",
2256
+ domainHost: handler.domainHost,
2257
+ parse: handler.parse,
2258
+ serialize: handler.serialize
2259
+ };
2260
+
2261
+ function isSecure(wsComponents) {
2262
+ return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === "wss";
2263
+ }
2264
+ //RFC 6455
2265
+ var handler$2 = {
2266
+ scheme: "ws",
2267
+ domainHost: true,
2268
+ parse: function parse(components, options) {
2269
+ var wsComponents = components;
2270
+ //indicate if the secure flag is set
2271
+ wsComponents.secure = isSecure(wsComponents);
2272
+ //construct resouce name
2273
+ wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '');
2274
+ wsComponents.path = undefined;
2275
+ wsComponents.query = undefined;
2276
+ return wsComponents;
2277
+ },
2278
+ serialize: function serialize(wsComponents, options) {
2279
+ //normalize the default port
2280
+ if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === "") {
2281
+ wsComponents.port = undefined;
2282
+ }
2283
+ //ensure scheme matches secure flag
2284
+ if (typeof wsComponents.secure === 'boolean') {
2285
+ wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws';
2286
+ wsComponents.secure = undefined;
2287
+ }
2288
+ //reconstruct path from resource name
2289
+ if (wsComponents.resourceName) {
2290
+ var _wsComponents$resourc = wsComponents.resourceName.split('?'),
2291
+ _wsComponents$resourc2 = slicedToArray(_wsComponents$resourc, 2),
2292
+ path = _wsComponents$resourc2[0],
2293
+ query = _wsComponents$resourc2[1];
2294
+
2295
+ wsComponents.path = path && path !== '/' ? path : undefined;
2296
+ wsComponents.query = query;
2297
+ wsComponents.resourceName = undefined;
2298
+ }
2299
+ //forbid fragment component
2300
+ wsComponents.fragment = undefined;
2301
+ return wsComponents;
2302
+ }
2303
+ };
2304
+
2305
+ var handler$3 = {
2306
+ scheme: "wss",
2307
+ domainHost: handler$2.domainHost,
2308
+ parse: handler$2.parse,
2309
+ serialize: handler$2.serialize
2310
+ };
2311
+
2312
+ var O = {};
2313
+ //RFC 3986
2314
+ var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + ("\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" ) + "]";
2315
+ var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
2316
+ var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
2317
+ //RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
2318
+ //const ATEXT$$ = "[A-Za-z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
2319
+ //const WSP$$ = "[\\x20\\x09]";
2320
+ //const OBS_QTEXT$$ = "[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F]"; //(%d1-8 / %d11-12 / %d14-31 / %d127)
2321
+ //const QTEXT$$ = merge("[\\x21\\x23-\\x5B\\x5D-\\x7E]", OBS_QTEXT$$); //%d33 / %d35-91 / %d93-126 / obs-qtext
2322
+ //const VCHAR$$ = "[\\x21-\\x7E]";
2323
+ //const WSP$$ = "[\\x20\\x09]";
2324
+ //const OBS_QP$ = subexp("\\\\" + merge("[\\x00\\x0D\\x0A]", OBS_QTEXT$$)); //%d0 / CR / LF / obs-qtext
2325
+ //const FWS$ = subexp(subexp(WSP$$ + "*" + "\\x0D\\x0A") + "?" + WSP$$ + "+");
2326
+ //const QUOTED_PAIR$ = subexp(subexp("\\\\" + subexp(VCHAR$$ + "|" + WSP$$)) + "|" + OBS_QP$);
2327
+ //const QUOTED_STRING$ = subexp('\\"' + subexp(FWS$ + "?" + QCONTENT$) + "*" + FWS$ + "?" + '\\"');
2328
+ var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";
2329
+ var QTEXT$$ = "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";
2330
+ var VCHAR$$ = merge(QTEXT$$, "[\\\"\\\\]");
2331
+ var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";
2332
+ var UNRESERVED = new RegExp(UNRESERVED$$, "g");
2333
+ var PCT_ENCODED = new RegExp(PCT_ENCODED$, "g");
2334
+ var NOT_LOCAL_PART = new RegExp(merge("[^]", ATEXT$$, "[\\.]", '[\\"]', VCHAR$$), "g");
2335
+ var NOT_HFNAME = new RegExp(merge("[^]", UNRESERVED$$, SOME_DELIMS$$), "g");
2336
+ var NOT_HFVALUE = NOT_HFNAME;
2337
+ function decodeUnreserved(str) {
2338
+ var decStr = pctDecChars(str);
2339
+ return !decStr.match(UNRESERVED) ? str : decStr;
2340
+ }
2341
+ var handler$4 = {
2342
+ scheme: "mailto",
2343
+ parse: function parse$$1(components, options) {
2344
+ var mailtoComponents = components;
2345
+ var to = mailtoComponents.to = mailtoComponents.path ? mailtoComponents.path.split(",") : [];
2346
+ mailtoComponents.path = undefined;
2347
+ if (mailtoComponents.query) {
2348
+ var unknownHeaders = false;
2349
+ var headers = {};
2350
+ var hfields = mailtoComponents.query.split("&");
2351
+ for (var x = 0, xl = hfields.length; x < xl; ++x) {
2352
+ var hfield = hfields[x].split("=");
2353
+ switch (hfield[0]) {
2354
+ case "to":
2355
+ var toAddrs = hfield[1].split(",");
2356
+ for (var _x = 0, _xl = toAddrs.length; _x < _xl; ++_x) {
2357
+ to.push(toAddrs[_x]);
2358
+ }
2359
+ break;
2360
+ case "subject":
2361
+ mailtoComponents.subject = unescapeComponent(hfield[1], options);
2362
+ break;
2363
+ case "body":
2364
+ mailtoComponents.body = unescapeComponent(hfield[1], options);
2365
+ break;
2366
+ default:
2367
+ unknownHeaders = true;
2368
+ headers[unescapeComponent(hfield[0], options)] = unescapeComponent(hfield[1], options);
2369
+ break;
2370
+ }
2371
+ }
2372
+ if (unknownHeaders) mailtoComponents.headers = headers;
2373
+ }
2374
+ mailtoComponents.query = undefined;
2375
+ for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) {
2376
+ var addr = to[_x2].split("@");
2377
+ addr[0] = unescapeComponent(addr[0]);
2378
+ if (!options.unicodeSupport) {
2379
+ //convert Unicode IDN -> ASCII IDN
2380
+ try {
2381
+ addr[1] = punycode.toASCII(unescapeComponent(addr[1], options).toLowerCase());
2382
+ } catch (e) {
2383
+ mailtoComponents.error = mailtoComponents.error || "Email address's domain name can not be converted to ASCII via punycode: " + e;
2384
+ }
2385
+ } else {
2386
+ addr[1] = unescapeComponent(addr[1], options).toLowerCase();
2387
+ }
2388
+ to[_x2] = addr.join("@");
2389
+ }
2390
+ return mailtoComponents;
2391
+ },
2392
+ serialize: function serialize$$1(mailtoComponents, options) {
2393
+ var components = mailtoComponents;
2394
+ var to = toArray(mailtoComponents.to);
2395
+ if (to) {
2396
+ for (var x = 0, xl = to.length; x < xl; ++x) {
2397
+ var toAddr = String(to[x]);
2398
+ var atIdx = toAddr.lastIndexOf("@");
2399
+ var localPart = toAddr.slice(0, atIdx).replace(PCT_ENCODED, decodeUnreserved).replace(PCT_ENCODED, toUpperCase).replace(NOT_LOCAL_PART, pctEncChar);
2400
+ var domain = toAddr.slice(atIdx + 1);
2401
+ //convert IDN via punycode
2402
+ try {
2403
+ domain = !options.iri ? punycode.toASCII(unescapeComponent(domain, options).toLowerCase()) : punycode.toUnicode(domain);
2404
+ } catch (e) {
2405
+ components.error = components.error || "Email address's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
2406
+ }
2407
+ to[x] = localPart + "@" + domain;
2408
+ }
2409
+ components.path = to.join(",");
2410
+ }
2411
+ var headers = mailtoComponents.headers = mailtoComponents.headers || {};
2412
+ if (mailtoComponents.subject) headers["subject"] = mailtoComponents.subject;
2413
+ if (mailtoComponents.body) headers["body"] = mailtoComponents.body;
2414
+ var fields = [];
2415
+ for (var name in headers) {
2416
+ if (headers[name] !== O[name]) {
2417
+ 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));
2418
+ }
2419
+ }
2420
+ if (fields.length) {
2421
+ components.query = fields.join("&");
2422
+ }
2423
+ return components;
2424
+ }
2425
+ };
2426
+
2427
+ var URN_PARSE = /^([^\:]+)\:(.*)/;
2428
+ //RFC 2141
2429
+ var handler$5 = {
2430
+ scheme: "urn",
2431
+ parse: function parse$$1(components, options) {
2432
+ var matches = components.path && components.path.match(URN_PARSE);
2433
+ var urnComponents = components;
2434
+ if (matches) {
2435
+ var scheme = options.scheme || urnComponents.scheme || "urn";
2436
+ var nid = matches[1].toLowerCase();
2437
+ var nss = matches[2];
2438
+ var urnScheme = scheme + ":" + (options.nid || nid);
2439
+ var schemeHandler = SCHEMES[urnScheme];
2440
+ urnComponents.nid = nid;
2441
+ urnComponents.nss = nss;
2442
+ urnComponents.path = undefined;
2443
+ if (schemeHandler) {
2444
+ urnComponents = schemeHandler.parse(urnComponents, options);
2445
+ }
2446
+ } else {
2447
+ urnComponents.error = urnComponents.error || "URN can not be parsed.";
2448
+ }
2449
+ return urnComponents;
2450
+ },
2451
+ serialize: function serialize$$1(urnComponents, options) {
2452
+ var scheme = options.scheme || urnComponents.scheme || "urn";
2453
+ var nid = urnComponents.nid;
2454
+ var urnScheme = scheme + ":" + (options.nid || nid);
2455
+ var schemeHandler = SCHEMES[urnScheme];
2456
+ if (schemeHandler) {
2457
+ urnComponents = schemeHandler.serialize(urnComponents, options);
2458
+ }
2459
+ var uriComponents = urnComponents;
2460
+ var nss = urnComponents.nss;
2461
+ uriComponents.path = (nid || options.nid) + ":" + nss;
2462
+ return uriComponents;
2463
+ }
2464
+ };
2465
+
2466
+ var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
2467
+ //RFC 4122
2468
+ var handler$6 = {
2469
+ scheme: "urn:uuid",
2470
+ parse: function parse(urnComponents, options) {
2471
+ var uuidComponents = urnComponents;
2472
+ uuidComponents.uuid = uuidComponents.nss;
2473
+ uuidComponents.nss = undefined;
2474
+ if (!options.tolerant && (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID))) {
2475
+ uuidComponents.error = uuidComponents.error || "UUID is not valid.";
2476
+ }
2477
+ return uuidComponents;
2478
+ },
2479
+ serialize: function serialize(uuidComponents, options) {
2480
+ var urnComponents = uuidComponents;
2481
+ //normalize UUID
2482
+ urnComponents.nss = (uuidComponents.uuid || "").toLowerCase();
2483
+ return urnComponents;
2484
+ }
2485
+ };
2486
+
2487
+ SCHEMES[handler.scheme] = handler;
2488
+ SCHEMES[handler$1.scheme] = handler$1;
2489
+ SCHEMES[handler$2.scheme] = handler$2;
2490
+ SCHEMES[handler$3.scheme] = handler$3;
2491
+ SCHEMES[handler$4.scheme] = handler$4;
2492
+ SCHEMES[handler$5.scheme] = handler$5;
2493
+ SCHEMES[handler$6.scheme] = handler$6;
2494
+
2495
+ exports.SCHEMES = SCHEMES;
2496
+ exports.pctEncChar = pctEncChar;
2497
+ exports.pctDecChars = pctDecChars;
2498
+ exports.parse = parse;
2499
+ exports.removeDotSegments = removeDotSegments;
2500
+ exports.serialize = serialize;
2501
+ exports.resolveComponents = resolveComponents;
2502
+ exports.resolve = resolve;
2503
+ exports.normalize = normalize;
2504
+ exports.equal = equal;
2505
+ exports.escapeComponent = escapeComponent;
2506
+ exports.unescapeComponent = unescapeComponent;
2507
+
2508
+ Object.defineProperty(exports, '__esModule', { value: true });
2509
+
2510
+ })));
2511
+
2512
+ } (uri_all, uri_all.exports));
2513
+
2514
+ var uri_allExports = uri_all.exports;
2507
2515
 
2508
2516
  // do not edit .js files directly - edit src/index.jst
2509
2517
 
@@ -2904,11 +2912,13 @@
2904
2912
  return str.replace(/~/g, '~0').replace(/\//g, '~1');
2905
2913
  }
2906
2914
 
2907
- var URI$1 = uri_all.exports
2915
+ var jsonSchemaTraverseExports = jsonSchemaTraverse.exports;
2916
+
2917
+ var URI$1 = uri_allExports
2908
2918
  , equal$1 = fastDeepEqual
2909
2919
  , util$3 = util$5
2910
2920
  , SchemaObject$1 = schema_obj
2911
- , traverse = jsonSchemaTraverse.exports;
2921
+ , traverse = jsonSchemaTraverseExports;
2912
2922
 
2913
2923
  var resolve_1 = resolve$3;
2914
2924
 
@@ -4158,6 +4168,8 @@
4158
4168
  this._cache = {};
4159
4169
  };
4160
4170
 
4171
+ var cacheExports = cache.exports;
4172
+
4161
4173
  var util$1 = util$5;
4162
4174
 
4163
4175
  var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
@@ -7724,7 +7736,7 @@
7724
7736
 
7725
7737
  var compileSchema = compile_1
7726
7738
  , resolve = resolve_1
7727
- , Cache = cache.exports
7739
+ , Cache = cacheExports
7728
7740
  , SchemaObject = schema_obj
7729
7741
  , stableStringify = fastJsonStableStringify
7730
7742
  , formats = formats_1
@@ -8227,9 +8239,11 @@
8227
8239
 
8228
8240
  function noop() {}
8229
8241
 
8242
+ var ajv$1 = /*@__PURE__*/getDefaultExportFromCjs(ajv);
8243
+
8230
8244
  var _Ajv = /*#__PURE__*/_mergeNamespaces({
8231
8245
  __proto__: null,
8232
- 'default': ajv
8246
+ default: ajv$1
8233
8247
  }, [ajv]);
8234
8248
 
8235
8249
  var $ref = "#/definitions/Schema";
@@ -9812,11 +9826,11 @@
9812
9826
  __proto__: null,
9813
9827
  $ref: $ref,
9814
9828
  $schema: $schema,
9815
- definitions: definitions,
9816
- 'default': v2
9829
+ default: v2,
9830
+ definitions: definitions
9817
9831
  });
9818
9832
 
9819
- var Ajv = ajv || _Ajv;
9833
+ var Ajv = ajv$1 || _Ajv;
9820
9834
  var ddl2Schema = _ddl2Schema;
9821
9835
  var options = {
9822
9836
  allErrors: false,
@@ -9850,7 +9864,5 @@
9850
9864
  exports.upgrade = upgrade;
9851
9865
  exports.validate2 = validate2;
9852
9866
 
9853
- Object.defineProperty(exports, '__esModule', { value: true });
9854
-
9855
9867
  }));
9856
9868
  //# sourceMappingURL=index.js.map