avo 1.20.1 → 1.20.2.pre.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of avo might be problematic. Click here for more details.

Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -1
  3. data/Gemfile.lock +7 -3
  4. data/app/assets/builds/avo.css +8606 -0
  5. data/app/assets/builds/avo.js +87838 -0
  6. data/app/assets/builds/avo.js.map +7 -0
  7. data/app/assets/svgs/x.svg +3 -0
  8. data/app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb +22 -0
  9. data/app/components/avo/fields/belongs_to_field/autocomplete_component.rb +33 -0
  10. data/app/components/avo/fields/belongs_to_field/edit_component.html.erb +39 -33
  11. data/app/components/avo/fields/common/files_list_viewer_component.html.erb +1 -1
  12. data/app/components/avo/fields/common/multiple_file_viewer_component.html.erb +2 -0
  13. data/app/components/avo/fields/common/multiple_file_viewer_component.rb +2 -1
  14. data/app/components/avo/fields/common/single_file_viewer_component.html.erb +2 -0
  15. data/app/components/avo/fields/common/single_file_viewer_component.rb +2 -1
  16. data/app/components/avo/fields/file_field/edit_component.html.erb +1 -1
  17. data/app/components/avo/fields/file_field/index_component.html.erb +3 -1
  18. data/app/components/avo/fields/file_field/show_component.html.erb +1 -1
  19. data/app/components/avo/resource_component.rb +1 -0
  20. data/app/components/avo/views/resource_index_component.html.erb +1 -1
  21. data/app/controllers/avo/base_controller.rb +1 -2
  22. data/app/controllers/avo/relations_controller.rb +4 -4
  23. data/app/controllers/avo/search_controller.rb +0 -1
  24. data/app/javascript/js/controllers/fields/belongs_to_field_controller.js +96 -33
  25. data/app/javascript/js/controllers/search_controller.js +83 -17
  26. data/app/views/avo/partials/_global_search.html.erb +0 -1
  27. data/app/views/avo/partials/_javascript.html.erb +1 -0
  28. data/app/views/avo/partials/_resource_search.html.erb +0 -1
  29. data/db/factories.rb +4 -0
  30. data/lib/avo/fields/base_field.rb +1 -1
  31. data/lib/avo/fields/belongs_to_field.rb +19 -2
  32. data/lib/avo/fields/file_field.rb +2 -0
  33. data/lib/avo/fields/files_field.rb +2 -0
  34. data/lib/avo/fields/key_value_field.rb +4 -4
  35. data/lib/avo/licensing/pro_license.rb +2 -1
  36. data/lib/avo/version.rb +1 -1
  37. data/lib/generators/avo/templates/locales/avo.en.yml +1 -0
  38. data/public/avo-assets/avo.css +16 -0
  39. data/public/avo-assets/avo.js +317 -234
  40. data/public/avo-assets/avo.js.map +2 -2
  41. metadata +10 -4
@@ -17880,17 +17880,17 @@
17880
17880
  })(exports, function(punycode, IPv6, SLD, root) {
17881
17881
  "use strict";
17882
17882
  var _URI = root && root.URI;
17883
- function URI2(url, base) {
17883
+ function URI3(url, base) {
17884
17884
  var _urlSupplied = arguments.length >= 1;
17885
17885
  var _baseSupplied = arguments.length >= 2;
17886
- if (!(this instanceof URI2)) {
17886
+ if (!(this instanceof URI3)) {
17887
17887
  if (_urlSupplied) {
17888
17888
  if (_baseSupplied) {
17889
- return new URI2(url, base);
17889
+ return new URI3(url, base);
17890
17890
  }
17891
- return new URI2(url);
17891
+ return new URI3(url);
17892
17892
  }
17893
- return new URI2();
17893
+ return new URI3();
17894
17894
  }
17895
17895
  if (url === void 0) {
17896
17896
  if (_urlSupplied) {
@@ -17916,8 +17916,8 @@
17916
17916
  function isInteger(value) {
17917
17917
  return /^[0-9]+$/.test(value);
17918
17918
  }
17919
- URI2.version = "1.19.7";
17920
- var p2 = URI2.prototype;
17919
+ URI3.version = "1.19.7";
17920
+ var p2 = URI3.prototype;
17921
17921
  var hasOwn = Object.prototype.hasOwnProperty;
17922
17922
  function escapeRegEx(string) {
17923
17923
  return string.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1");
@@ -17995,7 +17995,7 @@
17995
17995
  var trim_expression = /^\/+|\/+$/g;
17996
17996
  return text.replace(trim_expression, "");
17997
17997
  }
17998
- URI2._parts = function() {
17998
+ URI3._parts = function() {
17999
17999
  return {
18000
18000
  protocol: null,
18001
18001
  username: null,
@@ -18006,27 +18006,27 @@
18006
18006
  path: null,
18007
18007
  query: null,
18008
18008
  fragment: null,
18009
- preventInvalidHostname: URI2.preventInvalidHostname,
18010
- duplicateQueryParameters: URI2.duplicateQueryParameters,
18011
- escapeQuerySpace: URI2.escapeQuerySpace
18009
+ preventInvalidHostname: URI3.preventInvalidHostname,
18010
+ duplicateQueryParameters: URI3.duplicateQueryParameters,
18011
+ escapeQuerySpace: URI3.escapeQuerySpace
18012
18012
  };
18013
18013
  };
18014
- URI2.preventInvalidHostname = false;
18015
- URI2.duplicateQueryParameters = false;
18016
- URI2.escapeQuerySpace = true;
18017
- URI2.protocol_expression = /^[a-z][a-z0-9.+-]*$/i;
18018
- URI2.idn_expression = /[^a-z0-9\._-]/i;
18019
- URI2.punycode_expression = /(xn--)/i;
18020
- URI2.ip4_expression = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
18021
- URI2.ip6_expression = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/;
18022
- URI2.find_uri_expression = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig;
18023
- URI2.findUri = {
18014
+ URI3.preventInvalidHostname = false;
18015
+ URI3.duplicateQueryParameters = false;
18016
+ URI3.escapeQuerySpace = true;
18017
+ URI3.protocol_expression = /^[a-z][a-z0-9.+-]*$/i;
18018
+ URI3.idn_expression = /[^a-z0-9\._-]/i;
18019
+ URI3.punycode_expression = /(xn--)/i;
18020
+ URI3.ip4_expression = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
18021
+ URI3.ip6_expression = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/;
18022
+ URI3.find_uri_expression = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig;
18023
+ URI3.findUri = {
18024
18024
  start: /\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,
18025
18025
  end: /[\s\r\n]|$/,
18026
18026
  trim: /[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,
18027
18027
  parens: /(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g
18028
18028
  };
18029
- URI2.defaultPorts = {
18029
+ URI3.defaultPorts = {
18030
18030
  http: "80",
18031
18031
  https: "443",
18032
18032
  ftp: "21",
@@ -18034,12 +18034,12 @@
18034
18034
  ws: "80",
18035
18035
  wss: "443"
18036
18036
  };
18037
- URI2.hostProtocols = [
18037
+ URI3.hostProtocols = [
18038
18038
  "http",
18039
18039
  "https"
18040
18040
  ];
18041
- URI2.invalid_hostname_characters = /[^a-zA-Z0-9\.\-:_]/;
18042
- URI2.domAttributes = {
18041
+ URI3.invalid_hostname_characters = /[^a-zA-Z0-9\.\-:_]/;
18042
+ URI3.domAttributes = {
18043
18043
  "a": "href",
18044
18044
  "blockquote": "cite",
18045
18045
  "link": "href",
@@ -18056,7 +18056,7 @@
18056
18056
  "audio": "src",
18057
18057
  "video": "src"
18058
18058
  };
18059
- URI2.getDomAttribute = function(node) {
18059
+ URI3.getDomAttribute = function(node) {
18060
18060
  if (!node || !node.nodeName) {
18061
18061
  return void 0;
18062
18062
  }
@@ -18064,7 +18064,7 @@
18064
18064
  if (nodeName === "input" && node.type !== "image") {
18065
18065
  return void 0;
18066
18066
  }
18067
- return URI2.domAttributes[nodeName];
18067
+ return URI3.domAttributes[nodeName];
18068
18068
  };
18069
18069
  function escapeForDumbFirefox36(value) {
18070
18070
  return escape(value);
@@ -18072,17 +18072,17 @@
18072
18072
  function strictEncodeURIComponent(string) {
18073
18073
  return encodeURIComponent(string).replace(/[!'()*]/g, escapeForDumbFirefox36).replace(/\*/g, "%2A");
18074
18074
  }
18075
- URI2.encode = strictEncodeURIComponent;
18076
- URI2.decode = decodeURIComponent;
18077
- URI2.iso8859 = function() {
18078
- URI2.encode = escape;
18079
- URI2.decode = unescape;
18075
+ URI3.encode = strictEncodeURIComponent;
18076
+ URI3.decode = decodeURIComponent;
18077
+ URI3.iso8859 = function() {
18078
+ URI3.encode = escape;
18079
+ URI3.decode = unescape;
18080
18080
  };
18081
- URI2.unicode = function() {
18082
- URI2.encode = strictEncodeURIComponent;
18083
- URI2.decode = decodeURIComponent;
18081
+ URI3.unicode = function() {
18082
+ URI3.encode = strictEncodeURIComponent;
18083
+ URI3.decode = decodeURIComponent;
18084
18084
  };
18085
- URI2.characters = {
18085
+ URI3.characters = {
18086
18086
  pathname: {
18087
18087
  encode: {
18088
18088
  expression: /%(24|26|2B|2C|3B|3D|3A|40)/ig,
@@ -18159,20 +18159,20 @@
18159
18159
  }
18160
18160
  }
18161
18161
  };
18162
- URI2.encodeQuery = function(string, escapeQuerySpace) {
18163
- var escaped = URI2.encode(string + "");
18162
+ URI3.encodeQuery = function(string, escapeQuerySpace) {
18163
+ var escaped = URI3.encode(string + "");
18164
18164
  if (escapeQuerySpace === void 0) {
18165
- escapeQuerySpace = URI2.escapeQuerySpace;
18165
+ escapeQuerySpace = URI3.escapeQuerySpace;
18166
18166
  }
18167
18167
  return escapeQuerySpace ? escaped.replace(/%20/g, "+") : escaped;
18168
18168
  };
18169
- URI2.decodeQuery = function(string, escapeQuerySpace) {
18169
+ URI3.decodeQuery = function(string, escapeQuerySpace) {
18170
18170
  string += "";
18171
18171
  if (escapeQuerySpace === void 0) {
18172
- escapeQuerySpace = URI2.escapeQuerySpace;
18172
+ escapeQuerySpace = URI3.escapeQuerySpace;
18173
18173
  }
18174
18174
  try {
18175
- return URI2.decode(escapeQuerySpace ? string.replace(/\+/g, "%20") : string);
18175
+ return URI3.decode(escapeQuerySpace ? string.replace(/\+/g, "%20") : string);
18176
18176
  } catch (e2) {
18177
18177
  return string;
18178
18178
  }
@@ -18182,8 +18182,8 @@
18182
18182
  var generateAccessor = function(_group, _part2) {
18183
18183
  return function(string) {
18184
18184
  try {
18185
- return URI2[_part2](string + "").replace(URI2.characters[_group][_part2].expression, function(c2) {
18186
- return URI2.characters[_group][_part2].map[c2];
18185
+ return URI3[_part2](string + "").replace(URI3.characters[_group][_part2].expression, function(c2) {
18186
+ return URI3.characters[_group][_part2].map[c2];
18187
18187
  });
18188
18188
  } catch (e2) {
18189
18189
  return string;
@@ -18191,17 +18191,17 @@
18191
18191
  };
18192
18192
  };
18193
18193
  for (_part in _parts) {
18194
- URI2[_part + "PathSegment"] = generateAccessor("pathname", _parts[_part]);
18195
- URI2[_part + "UrnPathSegment"] = generateAccessor("urnpath", _parts[_part]);
18194
+ URI3[_part + "PathSegment"] = generateAccessor("pathname", _parts[_part]);
18195
+ URI3[_part + "UrnPathSegment"] = generateAccessor("urnpath", _parts[_part]);
18196
18196
  }
18197
18197
  var generateSegmentedPathFunction = function(_sep, _codingFuncName, _innerCodingFuncName) {
18198
18198
  return function(string) {
18199
18199
  var actualCodingFunc;
18200
18200
  if (!_innerCodingFuncName) {
18201
- actualCodingFunc = URI2[_codingFuncName];
18201
+ actualCodingFunc = URI3[_codingFuncName];
18202
18202
  } else {
18203
18203
  actualCodingFunc = function(string2) {
18204
- return URI2[_codingFuncName](URI2[_innerCodingFuncName](string2));
18204
+ return URI3[_codingFuncName](URI3[_innerCodingFuncName](string2));
18205
18205
  };
18206
18206
  }
18207
18207
  var segments = (string + "").split(_sep);
@@ -18211,16 +18211,16 @@
18211
18211
  return segments.join(_sep);
18212
18212
  };
18213
18213
  };
18214
- URI2.decodePath = generateSegmentedPathFunction("/", "decodePathSegment");
18215
- URI2.decodeUrnPath = generateSegmentedPathFunction(":", "decodeUrnPathSegment");
18216
- URI2.recodePath = generateSegmentedPathFunction("/", "encodePathSegment", "decode");
18217
- URI2.recodeUrnPath = generateSegmentedPathFunction(":", "encodeUrnPathSegment", "decode");
18218
- URI2.encodeReserved = generateAccessor("reserved", "encode");
18219
- URI2.parse = function(string, parts) {
18214
+ URI3.decodePath = generateSegmentedPathFunction("/", "decodePathSegment");
18215
+ URI3.decodeUrnPath = generateSegmentedPathFunction(":", "decodeUrnPathSegment");
18216
+ URI3.recodePath = generateSegmentedPathFunction("/", "encodePathSegment", "decode");
18217
+ URI3.recodeUrnPath = generateSegmentedPathFunction(":", "encodeUrnPathSegment", "decode");
18218
+ URI3.encodeReserved = generateAccessor("reserved", "encode");
18219
+ URI3.parse = function(string, parts) {
18220
18220
  var pos;
18221
18221
  if (!parts) {
18222
18222
  parts = {
18223
- preventInvalidHostname: URI2.preventInvalidHostname
18223
+ preventInvalidHostname: URI3.preventInvalidHostname
18224
18224
  };
18225
18225
  }
18226
18226
  pos = string.indexOf("#");
@@ -18237,16 +18237,16 @@
18237
18237
  if (string.substring(0, 2) === "//") {
18238
18238
  parts.protocol = null;
18239
18239
  string = string.substring(2);
18240
- string = URI2.parseAuthority(string, parts);
18240
+ string = URI3.parseAuthority(string, parts);
18241
18241
  } else {
18242
18242
  pos = string.indexOf(":");
18243
18243
  if (pos > -1) {
18244
18244
  parts.protocol = string.substring(0, pos) || null;
18245
- if (parts.protocol && !parts.protocol.match(URI2.protocol_expression)) {
18245
+ if (parts.protocol && !parts.protocol.match(URI3.protocol_expression)) {
18246
18246
  parts.protocol = void 0;
18247
18247
  } else if (string.substring(pos + 1, pos + 3).replace(/\\/g, "/") === "//") {
18248
18248
  string = string.substring(pos + 3);
18249
- string = URI2.parseAuthority(string, parts);
18249
+ string = URI3.parseAuthority(string, parts);
18250
18250
  } else {
18251
18251
  string = string.substring(pos + 1);
18252
18252
  parts.urn = true;
@@ -18256,7 +18256,7 @@
18256
18256
  parts.path = string;
18257
18257
  return parts;
18258
18258
  };
18259
- URI2.parseHost = function(string, parts) {
18259
+ URI3.parseHost = function(string, parts) {
18260
18260
  if (!string) {
18261
18261
  string = "";
18262
18262
  }
@@ -18292,18 +18292,18 @@
18292
18292
  string = "/" + string;
18293
18293
  }
18294
18294
  if (parts.preventInvalidHostname) {
18295
- URI2.ensureValidHostname(parts.hostname, parts.protocol);
18295
+ URI3.ensureValidHostname(parts.hostname, parts.protocol);
18296
18296
  }
18297
18297
  if (parts.port) {
18298
- URI2.ensureValidPort(parts.port);
18298
+ URI3.ensureValidPort(parts.port);
18299
18299
  }
18300
18300
  return string.substring(pos) || "/";
18301
18301
  };
18302
- URI2.parseAuthority = function(string, parts) {
18303
- string = URI2.parseUserinfo(string, parts);
18304
- return URI2.parseHost(string, parts);
18302
+ URI3.parseAuthority = function(string, parts) {
18303
+ string = URI3.parseUserinfo(string, parts);
18304
+ return URI3.parseHost(string, parts);
18305
18305
  };
18306
- URI2.parseUserinfo = function(string, parts) {
18306
+ URI3.parseUserinfo = function(string, parts) {
18307
18307
  var _string = string;
18308
18308
  var firstBackSlash = string.indexOf("\\");
18309
18309
  if (firstBackSlash !== -1) {
@@ -18314,9 +18314,9 @@
18314
18314
  var t2;
18315
18315
  if (pos > -1 && (firstSlash === -1 || pos < firstSlash)) {
18316
18316
  t2 = string.substring(0, pos).split(":");
18317
- parts.username = t2[0] ? URI2.decode(t2[0]) : null;
18317
+ parts.username = t2[0] ? URI3.decode(t2[0]) : null;
18318
18318
  t2.shift();
18319
- parts.password = t2[0] ? URI2.decode(t2.join(":")) : null;
18319
+ parts.password = t2[0] ? URI3.decode(t2.join(":")) : null;
18320
18320
  string = _string.substring(pos + 1);
18321
18321
  } else {
18322
18322
  parts.username = null;
@@ -18324,7 +18324,7 @@
18324
18324
  }
18325
18325
  return string;
18326
18326
  };
18327
- URI2.parseQuery = function(string, escapeQuerySpace) {
18327
+ URI3.parseQuery = function(string, escapeQuerySpace) {
18328
18328
  if (!string) {
18329
18329
  return {};
18330
18330
  }
@@ -18338,8 +18338,8 @@
18338
18338
  var v2, name, value;
18339
18339
  for (var i2 = 0; i2 < length; i2++) {
18340
18340
  v2 = splits[i2].split("=");
18341
- name = URI2.decodeQuery(v2.shift(), escapeQuerySpace);
18342
- value = v2.length ? URI2.decodeQuery(v2.join("="), escapeQuerySpace) : null;
18341
+ name = URI3.decodeQuery(v2.shift(), escapeQuerySpace);
18342
+ value = v2.length ? URI3.decodeQuery(v2.join("="), escapeQuerySpace) : null;
18343
18343
  if (name === "__proto__") {
18344
18344
  continue;
18345
18345
  } else if (hasOwn.call(items, name)) {
@@ -18353,7 +18353,7 @@
18353
18353
  }
18354
18354
  return items;
18355
18355
  };
18356
- URI2.build = function(parts) {
18356
+ URI3.build = function(parts) {
18357
18357
  var t2 = "";
18358
18358
  var requireAbsolutePath = false;
18359
18359
  if (parts.protocol) {
@@ -18363,7 +18363,7 @@
18363
18363
  t2 += "//";
18364
18364
  requireAbsolutePath = true;
18365
18365
  }
18366
- t2 += URI2.buildAuthority(parts) || "";
18366
+ t2 += URI3.buildAuthority(parts) || "";
18367
18367
  if (typeof parts.path === "string") {
18368
18368
  if (parts.path.charAt(0) !== "/" && requireAbsolutePath) {
18369
18369
  t2 += "/";
@@ -18378,11 +18378,11 @@
18378
18378
  }
18379
18379
  return t2;
18380
18380
  };
18381
- URI2.buildHost = function(parts) {
18381
+ URI3.buildHost = function(parts) {
18382
18382
  var t2 = "";
18383
18383
  if (!parts.hostname) {
18384
18384
  return "";
18385
- } else if (URI2.ip6_expression.test(parts.hostname)) {
18385
+ } else if (URI3.ip6_expression.test(parts.hostname)) {
18386
18386
  t2 += "[" + parts.hostname + "]";
18387
18387
  } else {
18388
18388
  t2 += parts.hostname;
@@ -18392,23 +18392,23 @@
18392
18392
  }
18393
18393
  return t2;
18394
18394
  };
18395
- URI2.buildAuthority = function(parts) {
18396
- return URI2.buildUserinfo(parts) + URI2.buildHost(parts);
18395
+ URI3.buildAuthority = function(parts) {
18396
+ return URI3.buildUserinfo(parts) + URI3.buildHost(parts);
18397
18397
  };
18398
- URI2.buildUserinfo = function(parts) {
18398
+ URI3.buildUserinfo = function(parts) {
18399
18399
  var t2 = "";
18400
18400
  if (parts.username) {
18401
- t2 += URI2.encode(parts.username);
18401
+ t2 += URI3.encode(parts.username);
18402
18402
  }
18403
18403
  if (parts.password) {
18404
- t2 += ":" + URI2.encode(parts.password);
18404
+ t2 += ":" + URI3.encode(parts.password);
18405
18405
  }
18406
18406
  if (t2) {
18407
18407
  t2 += "@";
18408
18408
  }
18409
18409
  return t2;
18410
18410
  };
18411
- URI2.buildQuery = function(data, duplicateQueryParameters, escapeQuerySpace) {
18411
+ URI3.buildQuery = function(data, duplicateQueryParameters, escapeQuerySpace) {
18412
18412
  var t2 = "";
18413
18413
  var unique2, key, i2, length;
18414
18414
  for (key in data) {
@@ -18419,27 +18419,27 @@
18419
18419
  unique2 = {};
18420
18420
  for (i2 = 0, length = data[key].length; i2 < length; i2++) {
18421
18421
  if (data[key][i2] !== void 0 && unique2[data[key][i2] + ""] === void 0) {
18422
- t2 += "&" + URI2.buildQueryParameter(key, data[key][i2], escapeQuerySpace);
18422
+ t2 += "&" + URI3.buildQueryParameter(key, data[key][i2], escapeQuerySpace);
18423
18423
  if (duplicateQueryParameters !== true) {
18424
18424
  unique2[data[key][i2] + ""] = true;
18425
18425
  }
18426
18426
  }
18427
18427
  }
18428
18428
  } else if (data[key] !== void 0) {
18429
- t2 += "&" + URI2.buildQueryParameter(key, data[key], escapeQuerySpace);
18429
+ t2 += "&" + URI3.buildQueryParameter(key, data[key], escapeQuerySpace);
18430
18430
  }
18431
18431
  }
18432
18432
  }
18433
18433
  return t2.substring(1);
18434
18434
  };
18435
- URI2.buildQueryParameter = function(name, value, escapeQuerySpace) {
18436
- return URI2.encodeQuery(name, escapeQuerySpace) + (value !== null ? "=" + URI2.encodeQuery(value, escapeQuerySpace) : "");
18435
+ URI3.buildQueryParameter = function(name, value, escapeQuerySpace) {
18436
+ return URI3.encodeQuery(name, escapeQuerySpace) + (value !== null ? "=" + URI3.encodeQuery(value, escapeQuerySpace) : "");
18437
18437
  };
18438
- URI2.addQuery = function(data, name, value) {
18438
+ URI3.addQuery = function(data, name, value) {
18439
18439
  if (typeof name === "object") {
18440
18440
  for (var key in name) {
18441
18441
  if (hasOwn.call(name, key)) {
18442
- URI2.addQuery(data, key, name[key]);
18442
+ URI3.addQuery(data, key, name[key]);
18443
18443
  }
18444
18444
  }
18445
18445
  } else if (typeof name === "string") {
@@ -18457,11 +18457,11 @@
18457
18457
  throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");
18458
18458
  }
18459
18459
  };
18460
- URI2.setQuery = function(data, name, value) {
18460
+ URI3.setQuery = function(data, name, value) {
18461
18461
  if (typeof name === "object") {
18462
18462
  for (var key in name) {
18463
18463
  if (hasOwn.call(name, key)) {
18464
- URI2.setQuery(data, key, name[key]);
18464
+ URI3.setQuery(data, key, name[key]);
18465
18465
  }
18466
18466
  }
18467
18467
  } else if (typeof name === "string") {
@@ -18470,7 +18470,7 @@
18470
18470
  throw new TypeError("URI.setQuery() accepts an object, string as the name parameter");
18471
18471
  }
18472
18472
  };
18473
- URI2.removeQuery = function(data, name, value) {
18473
+ URI3.removeQuery = function(data, name, value) {
18474
18474
  var i2, length, key;
18475
18475
  if (isArray(name)) {
18476
18476
  for (i2 = 0, length = name.length; i2 < length; i2++) {
@@ -18485,7 +18485,7 @@
18485
18485
  } else if (typeof name === "object") {
18486
18486
  for (key in name) {
18487
18487
  if (hasOwn.call(name, key)) {
18488
- URI2.removeQuery(data, key, name[key]);
18488
+ URI3.removeQuery(data, key, name[key]);
18489
18489
  }
18490
18490
  }
18491
18491
  } else if (typeof name === "string") {
@@ -18508,14 +18508,14 @@
18508
18508
  throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter");
18509
18509
  }
18510
18510
  };
18511
- URI2.hasQuery = function(data, name, value, withinArray) {
18511
+ URI3.hasQuery = function(data, name, value, withinArray) {
18512
18512
  switch (getType(name)) {
18513
18513
  case "String":
18514
18514
  break;
18515
18515
  case "RegExp":
18516
18516
  for (var key in data) {
18517
18517
  if (hasOwn.call(data, key)) {
18518
- if (name.test(key) && (value === void 0 || URI2.hasQuery(data, key, value))) {
18518
+ if (name.test(key) && (value === void 0 || URI3.hasQuery(data, key, value))) {
18519
18519
  return true;
18520
18520
  }
18521
18521
  }
@@ -18524,7 +18524,7 @@
18524
18524
  case "Object":
18525
18525
  for (var _key in name) {
18526
18526
  if (hasOwn.call(name, _key)) {
18527
- if (!URI2.hasQuery(data, _key, name[_key])) {
18527
+ if (!URI3.hasQuery(data, _key, name[_key])) {
18528
18528
  return false;
18529
18529
  }
18530
18530
  }
@@ -18569,12 +18569,12 @@
18569
18569
  throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter");
18570
18570
  }
18571
18571
  };
18572
- URI2.joinPaths = function() {
18572
+ URI3.joinPaths = function() {
18573
18573
  var input = [];
18574
18574
  var segments = [];
18575
18575
  var nonEmptySegments = 0;
18576
18576
  for (var i2 = 0; i2 < arguments.length; i2++) {
18577
- var url = new URI2(arguments[i2]);
18577
+ var url = new URI3(arguments[i2]);
18578
18578
  input.push(url);
18579
18579
  var _segments = url.segment();
18580
18580
  for (var s2 = 0; s2 < _segments.length; s2++) {
@@ -18587,15 +18587,15 @@
18587
18587
  }
18588
18588
  }
18589
18589
  if (!segments.length || !nonEmptySegments) {
18590
- return new URI2("");
18590
+ return new URI3("");
18591
18591
  }
18592
- var uri = new URI2("").segment(segments);
18592
+ var uri = new URI3("").segment(segments);
18593
18593
  if (input[0].path() === "" || input[0].path().slice(0, 1) === "/") {
18594
18594
  uri.path("/" + uri.path());
18595
18595
  }
18596
18596
  return uri.normalize();
18597
18597
  };
18598
- URI2.commonPath = function(one, two) {
18598
+ URI3.commonPath = function(one, two) {
18599
18599
  var length = Math.min(one.length, two.length);
18600
18600
  var pos;
18601
18601
  for (pos = 0; pos < length; pos++) {
@@ -18612,12 +18612,12 @@
18612
18612
  }
18613
18613
  return one.substring(0, pos + 1);
18614
18614
  };
18615
- URI2.withinString = function(string, callback, options) {
18615
+ URI3.withinString = function(string, callback, options) {
18616
18616
  options || (options = {});
18617
- var _start = options.start || URI2.findUri.start;
18618
- var _end = options.end || URI2.findUri.end;
18619
- var _trim = options.trim || URI2.findUri.trim;
18620
- var _parens = options.parens || URI2.findUri.parens;
18617
+ var _start = options.start || URI3.findUri.start;
18618
+ var _end = options.end || URI3.findUri.end;
18619
+ var _trim = options.trim || URI3.findUri.trim;
18620
+ var _parens = options.parens || URI3.findUri.parens;
18621
18621
  var _attributeOpen = /[a-z0-9-]=["']?$/i;
18622
18622
  _start.lastIndex = 0;
18623
18623
  while (true) {
@@ -18667,25 +18667,25 @@
18667
18667
  _start.lastIndex = 0;
18668
18668
  return string;
18669
18669
  };
18670
- URI2.ensureValidHostname = function(v2, protocol) {
18670
+ URI3.ensureValidHostname = function(v2, protocol) {
18671
18671
  var hasHostname = !!v2;
18672
18672
  var hasProtocol = !!protocol;
18673
18673
  var rejectEmptyHostname = false;
18674
18674
  if (hasProtocol) {
18675
- rejectEmptyHostname = arrayContains(URI2.hostProtocols, protocol);
18675
+ rejectEmptyHostname = arrayContains(URI3.hostProtocols, protocol);
18676
18676
  }
18677
18677
  if (rejectEmptyHostname && !hasHostname) {
18678
18678
  throw new TypeError("Hostname cannot be empty, if protocol is " + protocol);
18679
- } else if (v2 && v2.match(URI2.invalid_hostname_characters)) {
18679
+ } else if (v2 && v2.match(URI3.invalid_hostname_characters)) {
18680
18680
  if (!punycode) {
18681
18681
  throw new TypeError('Hostname "' + v2 + '" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');
18682
18682
  }
18683
- if (punycode.toASCII(v2).match(URI2.invalid_hostname_characters)) {
18683
+ if (punycode.toASCII(v2).match(URI3.invalid_hostname_characters)) {
18684
18684
  throw new TypeError('Hostname "' + v2 + '" contains characters other than [A-Z0-9.-:_]');
18685
18685
  }
18686
18686
  }
18687
18687
  };
18688
- URI2.ensureValidPort = function(v2) {
18688
+ URI3.ensureValidPort = function(v2) {
18689
18689
  if (!v2) {
18690
18690
  return;
18691
18691
  }
@@ -18695,7 +18695,7 @@
18695
18695
  }
18696
18696
  throw new TypeError('Port "' + v2 + '" is not a valid port');
18697
18697
  };
18698
- URI2.noConflict = function(removeAll) {
18698
+ URI3.noConflict = function(removeAll) {
18699
18699
  if (removeAll) {
18700
18700
  var unconflicted = {
18701
18701
  URI: this.noConflict()
@@ -18719,13 +18719,13 @@
18719
18719
  if (deferBuild === true) {
18720
18720
  this._deferred_build = true;
18721
18721
  } else if (deferBuild === void 0 || this._deferred_build) {
18722
- this._string = URI2.build(this._parts);
18722
+ this._string = URI3.build(this._parts);
18723
18723
  this._deferred_build = false;
18724
18724
  }
18725
18725
  return this;
18726
18726
  };
18727
18727
  p2.clone = function() {
18728
- return new URI2(this);
18728
+ return new URI3(this);
18729
18729
  };
18730
18730
  p2.valueOf = p2.toString = function() {
18731
18731
  return this.build(false)._string;
@@ -18776,12 +18776,12 @@
18776
18776
  p2.pathname = function(v2, build) {
18777
18777
  if (v2 === void 0 || v2 === true) {
18778
18778
  var res = this._parts.path || (this._parts.hostname ? "/" : "");
18779
- return v2 ? (this._parts.urn ? URI2.decodeUrnPath : URI2.decodePath)(res) : res;
18779
+ return v2 ? (this._parts.urn ? URI3.decodeUrnPath : URI3.decodePath)(res) : res;
18780
18780
  } else {
18781
18781
  if (this._parts.urn) {
18782
- this._parts.path = v2 ? URI2.recodeUrnPath(v2) : "";
18782
+ this._parts.path = v2 ? URI3.recodeUrnPath(v2) : "";
18783
18783
  } else {
18784
- this._parts.path = v2 ? URI2.recodePath(v2) : "/";
18784
+ this._parts.path = v2 ? URI3.recodePath(v2) : "/";
18785
18785
  }
18786
18786
  this.build(!build);
18787
18787
  return this;
@@ -18794,11 +18794,11 @@
18794
18794
  return this.toString();
18795
18795
  }
18796
18796
  this._string = "";
18797
- this._parts = URI2._parts();
18798
- var _URI2 = href instanceof URI2;
18797
+ this._parts = URI3._parts();
18798
+ var _URI2 = href instanceof URI3;
18799
18799
  var _object = typeof href === "object" && (href.hostname || href.path || href.pathname);
18800
18800
  if (href.nodeName) {
18801
- var attribute = URI2.getDomAttribute(href);
18801
+ var attribute = URI3.getDomAttribute(href);
18802
18802
  href = href[attribute] || "";
18803
18803
  _object = false;
18804
18804
  }
@@ -18806,7 +18806,7 @@
18806
18806
  href = href.toString();
18807
18807
  }
18808
18808
  if (typeof href === "string" || href instanceof String) {
18809
- this._parts = URI2.parse(String(href), this._parts);
18809
+ this._parts = URI3.parse(String(href), this._parts);
18810
18810
  } else if (_URI2 || _object) {
18811
18811
  var src = _URI2 ? href._parts : href;
18812
18812
  for (key in src) {
@@ -18837,13 +18837,13 @@
18837
18837
  var relative = !this._parts.urn;
18838
18838
  if (this._parts.hostname) {
18839
18839
  relative = false;
18840
- ip4 = URI2.ip4_expression.test(this._parts.hostname);
18841
- ip6 = URI2.ip6_expression.test(this._parts.hostname);
18840
+ ip4 = URI3.ip4_expression.test(this._parts.hostname);
18841
+ ip6 = URI3.ip6_expression.test(this._parts.hostname);
18842
18842
  ip = ip4 || ip6;
18843
18843
  name = !ip;
18844
18844
  sld = name && SLD && SLD.has(this._parts.hostname);
18845
- idn = name && URI2.idn_expression.test(this._parts.hostname);
18846
- punycode2 = name && URI2.punycode_expression.test(this._parts.hostname);
18845
+ idn = name && URI3.idn_expression.test(this._parts.hostname);
18846
+ punycode2 = name && URI3.punycode_expression.test(this._parts.hostname);
18847
18847
  }
18848
18848
  switch (what.toLowerCase()) {
18849
18849
  case "relative":
@@ -18882,7 +18882,7 @@
18882
18882
  p2.protocol = function(v2, build) {
18883
18883
  if (v2) {
18884
18884
  v2 = v2.replace(/:(\/\/)?$/, "");
18885
- if (!v2.match(URI2.protocol_expression)) {
18885
+ if (!v2.match(URI3.protocol_expression)) {
18886
18886
  throw new TypeError('Protocol "' + v2 + `" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]`);
18887
18887
  }
18888
18888
  }
@@ -18902,7 +18902,7 @@
18902
18902
  if (v2.charAt(0) === ":") {
18903
18903
  v2 = v2.substring(1);
18904
18904
  }
18905
- URI2.ensureValidPort(v2);
18905
+ URI3.ensureValidPort(v2);
18906
18906
  }
18907
18907
  }
18908
18908
  return _port.call(this, v2, build);
@@ -18913,13 +18913,13 @@
18913
18913
  }
18914
18914
  if (v2 !== void 0) {
18915
18915
  var x2 = { preventInvalidHostname: this._parts.preventInvalidHostname };
18916
- var res = URI2.parseHost(v2, x2);
18916
+ var res = URI3.parseHost(v2, x2);
18917
18917
  if (res !== "/") {
18918
18918
  throw new TypeError('Hostname "' + v2 + '" contains characters other than [A-Z0-9.-]');
18919
18919
  }
18920
18920
  v2 = x2.hostname;
18921
18921
  if (this._parts.preventInvalidHostname) {
18922
- URI2.ensureValidHostname(v2, this._parts.protocol);
18922
+ URI3.ensureValidHostname(v2, this._parts.protocol);
18923
18923
  }
18924
18924
  }
18925
18925
  return _hostname.call(this, v2, build);
@@ -18936,7 +18936,7 @@
18936
18936
  }
18937
18937
  return (protocol ? protocol + "://" : "") + this.authority();
18938
18938
  } else {
18939
- var origin = URI2(v2);
18939
+ var origin = URI3(v2);
18940
18940
  this.protocol(origin.protocol()).authority(origin.authority()).build(!build);
18941
18941
  return this;
18942
18942
  }
@@ -18946,9 +18946,9 @@
18946
18946
  return v2 === void 0 ? "" : this;
18947
18947
  }
18948
18948
  if (v2 === void 0) {
18949
- return this._parts.hostname ? URI2.buildHost(this._parts) : "";
18949
+ return this._parts.hostname ? URI3.buildHost(this._parts) : "";
18950
18950
  } else {
18951
- var res = URI2.parseHost(v2, this._parts);
18951
+ var res = URI3.parseHost(v2, this._parts);
18952
18952
  if (res !== "/") {
18953
18953
  throw new TypeError('Hostname "' + v2 + '" contains characters other than [A-Z0-9.-]');
18954
18954
  }
@@ -18961,9 +18961,9 @@
18961
18961
  return v2 === void 0 ? "" : this;
18962
18962
  }
18963
18963
  if (v2 === void 0) {
18964
- return this._parts.hostname ? URI2.buildAuthority(this._parts) : "";
18964
+ return this._parts.hostname ? URI3.buildAuthority(this._parts) : "";
18965
18965
  } else {
18966
- var res = URI2.parseAuthority(v2, this._parts);
18966
+ var res = URI3.parseAuthority(v2, this._parts);
18967
18967
  if (res !== "/") {
18968
18968
  throw new TypeError('Hostname "' + v2 + '" contains characters other than [A-Z0-9.-]');
18969
18969
  }
@@ -18976,13 +18976,13 @@
18976
18976
  return v2 === void 0 ? "" : this;
18977
18977
  }
18978
18978
  if (v2 === void 0) {
18979
- var t2 = URI2.buildUserinfo(this._parts);
18979
+ var t2 = URI3.buildUserinfo(this._parts);
18980
18980
  return t2 ? t2.substring(0, t2.length - 1) : t2;
18981
18981
  } else {
18982
18982
  if (v2[v2.length - 1] !== "@") {
18983
18983
  v2 += "@";
18984
18984
  }
18985
- URI2.parseUserinfo(v2, this._parts);
18985
+ URI3.parseUserinfo(v2, this._parts);
18986
18986
  this.build(!build);
18987
18987
  return this;
18988
18988
  }
@@ -18992,7 +18992,7 @@
18992
18992
  if (v2 === void 0) {
18993
18993
  return this.path() + this.search() + this.hash();
18994
18994
  }
18995
- parts = URI2.parse(v2);
18995
+ parts = URI3.parse(v2);
18996
18996
  this._parts.path = parts.path;
18997
18997
  this._parts.query = parts.query;
18998
18998
  this._parts.fragment = parts.fragment;
@@ -19020,7 +19020,7 @@
19020
19020
  throw new TypeError("Domains cannot contain colons");
19021
19021
  }
19022
19022
  if (v2) {
19023
- URI2.ensureValidHostname(v2, this._parts.protocol);
19023
+ URI3.ensureValidHostname(v2, this._parts.protocol);
19024
19024
  }
19025
19025
  this._parts.hostname = this._parts.hostname.replace(replace, v2);
19026
19026
  this.build(!build);
@@ -19053,7 +19053,7 @@
19053
19053
  if (v2.indexOf(":") !== -1) {
19054
19054
  throw new TypeError("Domains cannot contain colons");
19055
19055
  }
19056
- URI2.ensureValidHostname(v2, this._parts.protocol);
19056
+ URI3.ensureValidHostname(v2, this._parts.protocol);
19057
19057
  if (!this._parts.hostname || this.is("IP")) {
19058
19058
  this._parts.hostname = v2;
19059
19059
  } else {
@@ -19116,7 +19116,7 @@
19116
19116
  }
19117
19117
  var end2 = this._parts.path.length - this.filename().length - 1;
19118
19118
  var res = this._parts.path.substring(0, end2) || (this._parts.hostname ? "/" : "");
19119
- return v2 ? URI2.decodePath(res) : res;
19119
+ return v2 ? URI3.decodePath(res) : res;
19120
19120
  } else {
19121
19121
  var e2 = this._parts.path.length - this.filename().length;
19122
19122
  var directory = this._parts.path.substring(0, e2);
@@ -19132,7 +19132,7 @@
19132
19132
  if (v2 && v2.charAt(v2.length - 1) !== "/") {
19133
19133
  v2 += "/";
19134
19134
  }
19135
- v2 = URI2.recodePath(v2);
19135
+ v2 = URI3.recodePath(v2);
19136
19136
  this._parts.path = this._parts.path.replace(replace, v2);
19137
19137
  this.build(!build);
19138
19138
  return this;
@@ -19148,7 +19148,7 @@
19148
19148
  }
19149
19149
  var pos = this._parts.path.lastIndexOf("/");
19150
19150
  var res = this._parts.path.substring(pos + 1);
19151
- return v2 ? URI2.decodePathSegment(res) : res;
19151
+ return v2 ? URI3.decodePathSegment(res) : res;
19152
19152
  } else {
19153
19153
  var mutatedDirectory = false;
19154
19154
  if (v2.charAt(0) === "/") {
@@ -19158,7 +19158,7 @@
19158
19158
  mutatedDirectory = true;
19159
19159
  }
19160
19160
  var replace = new RegExp(escapeRegEx(this.filename()) + "$");
19161
- v2 = URI2.recodePath(v2);
19161
+ v2 = URI3.recodePath(v2);
19162
19162
  this._parts.path = this._parts.path.replace(replace, v2);
19163
19163
  if (mutatedDirectory) {
19164
19164
  this.normalizePath(build);
@@ -19184,7 +19184,7 @@
19184
19184
  }
19185
19185
  s2 = filename.substring(pos + 1);
19186
19186
  res = /^[a-z0-9%]+$/i.test(s2) ? s2 : "";
19187
- return v2 ? URI2.decodePathSegment(res) : res;
19187
+ return v2 ? URI3.decodePathSegment(res) : res;
19188
19188
  } else {
19189
19189
  if (v2.charAt(0) === ".") {
19190
19190
  v2 = v2.substring(1);
@@ -19195,14 +19195,14 @@
19195
19195
  if (!v2) {
19196
19196
  return this;
19197
19197
  }
19198
- this._parts.path += "." + URI2.recodePath(v2);
19198
+ this._parts.path += "." + URI3.recodePath(v2);
19199
19199
  } else if (!v2) {
19200
19200
  replace = new RegExp(escapeRegEx("." + suffix) + "$");
19201
19201
  } else {
19202
19202
  replace = new RegExp(escapeRegEx(suffix) + "$");
19203
19203
  }
19204
19204
  if (replace) {
19205
- v2 = URI2.recodePath(v2);
19205
+ v2 = URI3.recodePath(v2);
19206
19206
  this._parts.path = this._parts.path.replace(replace, v2);
19207
19207
  }
19208
19208
  this.build(!build);
@@ -19272,19 +19272,19 @@
19272
19272
  if (v2 === void 0) {
19273
19273
  segments = this.segment(segment, v2, build);
19274
19274
  if (!isArray(segments)) {
19275
- segments = segments !== void 0 ? URI2.decode(segments) : void 0;
19275
+ segments = segments !== void 0 ? URI3.decode(segments) : void 0;
19276
19276
  } else {
19277
19277
  for (i2 = 0, l2 = segments.length; i2 < l2; i2++) {
19278
- segments[i2] = URI2.decode(segments[i2]);
19278
+ segments[i2] = URI3.decode(segments[i2]);
19279
19279
  }
19280
19280
  }
19281
19281
  return segments;
19282
19282
  }
19283
19283
  if (!isArray(v2)) {
19284
- v2 = typeof v2 === "string" || v2 instanceof String ? URI2.encode(v2) : v2;
19284
+ v2 = typeof v2 === "string" || v2 instanceof String ? URI3.encode(v2) : v2;
19285
19285
  } else {
19286
19286
  for (i2 = 0, l2 = v2.length; i2 < l2; i2++) {
19287
- v2[i2] = URI2.encode(v2[i2]);
19287
+ v2[i2] = URI3.encode(v2[i2]);
19288
19288
  }
19289
19289
  }
19290
19290
  return this.segment(segment, v2, build);
@@ -19292,15 +19292,15 @@
19292
19292
  var q = p2.query;
19293
19293
  p2.query = function(v2, build) {
19294
19294
  if (v2 === true) {
19295
- return URI2.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
19295
+ return URI3.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
19296
19296
  } else if (typeof v2 === "function") {
19297
- var data = URI2.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
19297
+ var data = URI3.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
19298
19298
  var result = v2.call(this, data);
19299
- this._parts.query = URI2.buildQuery(result || data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
19299
+ this._parts.query = URI3.buildQuery(result || data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
19300
19300
  this.build(!build);
19301
19301
  return this;
19302
19302
  } else if (v2 !== void 0 && typeof v2 !== "string") {
19303
- this._parts.query = URI2.buildQuery(v2, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
19303
+ this._parts.query = URI3.buildQuery(v2, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
19304
19304
  this.build(!build);
19305
19305
  return this;
19306
19306
  } else {
@@ -19308,7 +19308,7 @@
19308
19308
  }
19309
19309
  };
19310
19310
  p2.setQuery = function(name, value, build) {
19311
- var data = URI2.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
19311
+ var data = URI3.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
19312
19312
  if (typeof name === "string" || name instanceof String) {
19313
19313
  data[name] = value !== void 0 ? value : null;
19314
19314
  } else if (typeof name === "object") {
@@ -19320,7 +19320,7 @@
19320
19320
  } else {
19321
19321
  throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");
19322
19322
  }
19323
- this._parts.query = URI2.buildQuery(data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
19323
+ this._parts.query = URI3.buildQuery(data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
19324
19324
  if (typeof name !== "string") {
19325
19325
  build = value;
19326
19326
  }
@@ -19328,9 +19328,9 @@
19328
19328
  return this;
19329
19329
  };
19330
19330
  p2.addQuery = function(name, value, build) {
19331
- var data = URI2.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
19332
- URI2.addQuery(data, name, value === void 0 ? null : value);
19333
- this._parts.query = URI2.buildQuery(data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
19331
+ var data = URI3.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
19332
+ URI3.addQuery(data, name, value === void 0 ? null : value);
19333
+ this._parts.query = URI3.buildQuery(data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
19334
19334
  if (typeof name !== "string") {
19335
19335
  build = value;
19336
19336
  }
@@ -19338,9 +19338,9 @@
19338
19338
  return this;
19339
19339
  };
19340
19340
  p2.removeQuery = function(name, value, build) {
19341
- var data = URI2.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
19342
- URI2.removeQuery(data, name, value);
19343
- this._parts.query = URI2.buildQuery(data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
19341
+ var data = URI3.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
19342
+ URI3.removeQuery(data, name, value);
19343
+ this._parts.query = URI3.buildQuery(data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
19344
19344
  if (typeof name !== "string") {
19345
19345
  build = value;
19346
19346
  }
@@ -19348,8 +19348,8 @@
19348
19348
  return this;
19349
19349
  };
19350
19350
  p2.hasQuery = function(name, value, withinArray) {
19351
- var data = URI2.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
19352
- return URI2.hasQuery(data, name, value, withinArray);
19351
+ var data = URI3.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
19352
+ return URI3.hasQuery(data, name, value, withinArray);
19353
19353
  };
19354
19354
  p2.setSearch = p2.setQuery;
19355
19355
  p2.addSearch = p2.addQuery;
@@ -19381,7 +19381,7 @@
19381
19381
  return this;
19382
19382
  };
19383
19383
  p2.normalizePort = function(build) {
19384
- if (typeof this._parts.protocol === "string" && this._parts.port === URI2.defaultPorts[this._parts.protocol]) {
19384
+ if (typeof this._parts.protocol === "string" && this._parts.port === URI3.defaultPorts[this._parts.protocol]) {
19385
19385
  this._parts.port = null;
19386
19386
  this.build(!build);
19387
19387
  }
@@ -19393,14 +19393,14 @@
19393
19393
  return this;
19394
19394
  }
19395
19395
  if (this._parts.urn) {
19396
- this._parts.path = URI2.recodeUrnPath(this._parts.path);
19396
+ this._parts.path = URI3.recodeUrnPath(this._parts.path);
19397
19397
  this.build(!build);
19398
19398
  return this;
19399
19399
  }
19400
19400
  if (this._parts.path === "/") {
19401
19401
  return this;
19402
19402
  }
19403
- _path = URI2.recodePath(_path);
19403
+ _path = URI3.recodePath(_path);
19404
19404
  var _was_relative;
19405
19405
  var _leadingParents = "";
19406
19406
  var _parent, _pos;
@@ -19445,7 +19445,7 @@
19445
19445
  if (!this._parts.query.length) {
19446
19446
  this._parts.query = null;
19447
19447
  } else {
19448
- this.query(URI2.parseQuery(this._parts.query, this._parts.escapeQuerySpace));
19448
+ this.query(URI3.parseQuery(this._parts.query, this._parts.escapeQuerySpace));
19449
19449
  }
19450
19450
  this.build(!build);
19451
19451
  }
@@ -19461,28 +19461,28 @@
19461
19461
  p2.normalizeSearch = p2.normalizeQuery;
19462
19462
  p2.normalizeHash = p2.normalizeFragment;
19463
19463
  p2.iso8859 = function() {
19464
- var e2 = URI2.encode;
19465
- var d2 = URI2.decode;
19466
- URI2.encode = escape;
19467
- URI2.decode = decodeURIComponent;
19464
+ var e2 = URI3.encode;
19465
+ var d2 = URI3.decode;
19466
+ URI3.encode = escape;
19467
+ URI3.decode = decodeURIComponent;
19468
19468
  try {
19469
19469
  this.normalize();
19470
19470
  } finally {
19471
- URI2.encode = e2;
19472
- URI2.decode = d2;
19471
+ URI3.encode = e2;
19472
+ URI3.decode = d2;
19473
19473
  }
19474
19474
  return this;
19475
19475
  };
19476
19476
  p2.unicode = function() {
19477
- var e2 = URI2.encode;
19478
- var d2 = URI2.decode;
19479
- URI2.encode = strictEncodeURIComponent;
19480
- URI2.decode = unescape;
19477
+ var e2 = URI3.encode;
19478
+ var d2 = URI3.decode;
19479
+ URI3.encode = strictEncodeURIComponent;
19480
+ URI3.decode = unescape;
19481
19481
  try {
19482
19482
  this.normalize();
19483
19483
  } finally {
19484
- URI2.encode = e2;
19485
- URI2.decode = d2;
19484
+ URI3.encode = e2;
19485
+ URI3.decode = d2;
19486
19486
  }
19487
19487
  return this;
19488
19488
  };
@@ -19511,14 +19511,14 @@
19511
19511
  var q2 = "";
19512
19512
  for (var i2 = 0, qp = uri._parts.query.split("&"), l2 = qp.length; i2 < l2; i2++) {
19513
19513
  var kv = (qp[i2] || "").split("=");
19514
- q2 += "&" + URI2.decodeQuery(kv[0], this._parts.escapeQuerySpace).replace(/&/g, "%26");
19514
+ q2 += "&" + URI3.decodeQuery(kv[0], this._parts.escapeQuerySpace).replace(/&/g, "%26");
19515
19515
  if (kv[1] !== void 0) {
19516
- q2 += "=" + URI2.decodeQuery(kv[1], this._parts.escapeQuerySpace).replace(/&/g, "%26");
19516
+ q2 += "=" + URI3.decodeQuery(kv[1], this._parts.escapeQuerySpace).replace(/&/g, "%26");
19517
19517
  }
19518
19518
  }
19519
19519
  t2 += "?" + q2.substring(1);
19520
19520
  }
19521
- t2 += URI2.decodeQuery(uri.hash(), true);
19521
+ t2 += URI3.decodeQuery(uri.hash(), true);
19522
19522
  return t2;
19523
19523
  };
19524
19524
  p2.absoluteTo = function(base) {
@@ -19528,8 +19528,8 @@
19528
19528
  if (this._parts.urn) {
19529
19529
  throw new Error("URNs do not have any generally defined hierarchical components");
19530
19530
  }
19531
- if (!(base instanceof URI2)) {
19532
- base = new URI2(base);
19531
+ if (!(base instanceof URI3)) {
19532
+ base = new URI3(base);
19533
19533
  }
19534
19534
  if (resolved._parts.protocol) {
19535
19535
  return resolved;
@@ -19567,7 +19567,7 @@
19567
19567
  if (relative._parts.urn) {
19568
19568
  throw new Error("URNs do not have any generally defined hierarchical components");
19569
19569
  }
19570
- base = new URI2(base).normalize();
19570
+ base = new URI3(base).normalize();
19571
19571
  relativeParts = relative._parts;
19572
19572
  baseParts = base._parts;
19573
19573
  relativePath = relative.path();
@@ -19597,7 +19597,7 @@
19597
19597
  relativeParts.path = "";
19598
19598
  return relative.build();
19599
19599
  }
19600
- common = URI2.commonPath(relativePath, basePath);
19600
+ common = URI3.commonPath(relativePath, basePath);
19601
19601
  if (!common) {
19602
19602
  return relative.build();
19603
19603
  }
@@ -19607,7 +19607,7 @@
19607
19607
  };
19608
19608
  p2.equals = function(uri) {
19609
19609
  var one = this.clone();
19610
- var two = new URI2(uri);
19610
+ var two = new URI3(uri);
19611
19611
  var one_map = {};
19612
19612
  var two_map = {};
19613
19613
  var checked = {};
@@ -19627,8 +19627,8 @@
19627
19627
  if (one_query.length !== two_query.length) {
19628
19628
  return false;
19629
19629
  }
19630
- one_map = URI2.parseQuery(one_query, this._parts.escapeQuerySpace);
19631
- two_map = URI2.parseQuery(two_query, this._parts.escapeQuerySpace);
19630
+ one_map = URI3.parseQuery(one_query, this._parts.escapeQuerySpace);
19631
+ two_map = URI3.parseQuery(two_query, this._parts.escapeQuerySpace);
19632
19632
  for (key in one_map) {
19633
19633
  if (hasOwn.call(one_map, key)) {
19634
19634
  if (!isArray(one_map[key])) {
@@ -19662,7 +19662,7 @@
19662
19662
  this._parts.escapeQuerySpace = !!v2;
19663
19663
  return this;
19664
19664
  };
19665
- return URI2;
19665
+ return URI3;
19666
19666
  });
19667
19667
  }
19668
19668
  });
@@ -81066,55 +81066,93 @@
81066
81066
 
81067
81067
  // app/javascript/js/controllers/fields/belongs_to_field_controller.js
81068
81068
  var belongs_to_field_controller_default = class extends Controller {
81069
+ constructor() {
81070
+ super(...arguments);
81071
+ __publicField(this, "defaults", {});
81072
+ }
81069
81073
  get selectedType() {
81070
81074
  return this.selectTarget.value;
81071
81075
  }
81072
- connect() {
81073
- this.setValidNames();
81074
- this.changedType();
81076
+ get isSearchable() {
81077
+ return this.context.scope.element.dataset.searchable === "true";
81075
81078
  }
81076
- setValidNames() {
81077
- this.typeTargets.forEach((target) => {
81078
- const { type } = target.dataset;
81079
- const select = target.querySelector("select");
81080
- const name = select.getAttribute("name");
81081
- select.setAttribute("valid-name", name);
81082
- if (this.selectedType !== type) {
81083
- select.selectedIndex = 0;
81084
- }
81085
- });
81079
+ get association() {
81080
+ return this.context.scope.element.dataset.association;
81086
81081
  }
81087
- changedType() {
81088
- this.hideAllTypeTargets();
81089
- this.enableType(this.selectTarget.value);
81082
+ get associationClass() {
81083
+ return this.context.scope.element.dataset.associationClass;
81084
+ }
81085
+ connect() {
81086
+ this.copyValidNames();
81087
+ this.changeType();
81090
81088
  }
81091
- hideAllTypeTargets() {
81089
+ changeType() {
81090
+ this.hideAllTypes();
81091
+ this.showType(this.selectTarget.value);
81092
+ }
81093
+ hideAllTypes() {
81092
81094
  this.typeTargets.forEach((target) => {
81093
- this.hideTarget(target);
81095
+ target.classList.add("hidden");
81094
81096
  this.invalidateTarget(target);
81095
81097
  });
81096
81098
  }
81097
- hideTarget(target) {
81098
- target.classList.add("hidden");
81099
- }
81100
- invalidateTarget(target) {
81101
- const select = target.querySelector("select");
81102
- select.setAttribute("name", "");
81103
- }
81104
- validateTarget(target) {
81105
- const select = target.querySelector("select");
81106
- const validName = select.getAttribute("valid-name");
81107
- select.setAttribute("name", validName);
81099
+ copyValidNames() {
81100
+ this.typeTargets.forEach((target) => {
81101
+ const { type } = target.dataset;
81102
+ if (this.isSearchable) {
81103
+ const textInput = target.querySelector('input[type="text"]');
81104
+ if (textInput) {
81105
+ textInput.setAttribute("valid-name", textInput.getAttribute("name"));
81106
+ }
81107
+ const hiddenInput = target.querySelector('input[type="hidden"]');
81108
+ if (hiddenInput) {
81109
+ hiddenInput.setAttribute("valid-name", hiddenInput.getAttribute("name"));
81110
+ }
81111
+ } else {
81112
+ const select = target.querySelector("select");
81113
+ if (select) {
81114
+ select.setAttribute("valid-name", select.getAttribute("name"));
81115
+ }
81116
+ if (this.selectedType !== type) {
81117
+ select.selectedIndex = 0;
81118
+ }
81119
+ }
81120
+ });
81108
81121
  }
81109
- enableType(type) {
81122
+ showType(type) {
81110
81123
  const target = this.typeTargets.find((typeTarget) => typeTarget.dataset.type === type);
81111
81124
  if (target) {
81112
81125
  target.classList.remove("hidden");
81113
81126
  this.validateTarget(target);
81114
81127
  }
81115
81128
  }
81129
+ validateTarget(target) {
81130
+ if (this.isSearchable) {
81131
+ const textInput = target.querySelector('input[type="text"]');
81132
+ const hiddenInput = target.querySelector('input[type="hidden"]');
81133
+ textInput.setAttribute("name", textInput.getAttribute("valid-name"));
81134
+ hiddenInput.setAttribute("name", hiddenInput.getAttribute("valid-name"));
81135
+ } else {
81136
+ const select = target.querySelector("select");
81137
+ select.setAttribute("name", select.getAttribute("valid-name"));
81138
+ }
81139
+ }
81140
+ invalidateTarget(target) {
81141
+ if (this.isSearchable) {
81142
+ try {
81143
+ target.querySelector('input[type="text"]').setAttribute("name", "");
81144
+ target.querySelector('input[type="hidden"]').setAttribute("name", "");
81145
+ } catch (e2) {
81146
+ }
81147
+ } else if (target) {
81148
+ try {
81149
+ target.querySelector("select").setAttribute("name", "");
81150
+ } catch (error2) {
81151
+ }
81152
+ }
81153
+ }
81116
81154
  };
81117
- __publicField(belongs_to_field_controller_default, "targets", ["select", "type"]);
81155
+ __publicField(belongs_to_field_controller_default, "targets", ["select", "type", "loadAssociationLink"]);
81118
81156
 
81119
81157
  // app/javascript/js/controllers/filter_controller.js
81120
81158
  var import_urijs = __toESM(require_URI());
@@ -87236,6 +87274,9 @@
87236
87274
  });
87237
87275
  }
87238
87276
 
87277
+ // app/javascript/js/controllers/search_controller.js
87278
+ var import_urijs2 = __toESM(require_URI());
87279
+
87239
87280
  // app/javascript/js/helpers/debounce_promise.js
87240
87281
  var debounce_promise_default = (fn2, time) => {
87241
87282
  let timerId;
@@ -87253,37 +87294,62 @@
87253
87294
  var search_controller_default = class extends Controller {
87254
87295
  constructor() {
87255
87296
  super(...arguments);
87256
- __publicField(this, "debouncedFetch", debounce_promise_default(fetch, this.debounceTimeout));
87297
+ __publicField(this, "debouncedFetch", debounce_promise_default(fetch, this.searchDebounce));
87298
+ }
87299
+ get dataset() {
87300
+ return this.autocompleteTarget.dataset;
87301
+ }
87302
+ get searchDebounce() {
87303
+ return window.Avo.configuration.search_debounce;
87257
87304
  }
87258
87305
  get translationKeys() {
87259
87306
  let keys;
87260
87307
  try {
87261
- keys = JSON.parse(this.autocompleteTarget.dataset.translationKeys);
87308
+ keys = JSON.parse(this.dataset.translationKeys);
87262
87309
  } catch (error2) {
87263
87310
  keys = {};
87264
87311
  }
87265
87312
  return keys;
87266
87313
  }
87267
- get debounceTimeout() {
87268
- return this.autocompleteTarget.dataset.debounceTimeout;
87269
- }
87270
- get searchResource() {
87271
- return this.autocompleteTarget.dataset.searchResource;
87314
+ get isBelongsToSearch() {
87315
+ return this.dataset.viaAssociation === "belongs_to";
87272
87316
  }
87273
87317
  get isGlobalSearch() {
87274
- return this.searchResource === "global";
87318
+ return this.dataset.searchResource === "global";
87319
+ }
87320
+ searchUrl(query) {
87321
+ const url = (0, import_urijs2.default)();
87322
+ let params = { q: query };
87323
+ let segments = [
87324
+ window.Avo.configuration.root_path,
87325
+ "avo_api",
87326
+ this.dataset.searchResource,
87327
+ "search"
87328
+ ];
87329
+ if (this.isGlobalSearch) {
87330
+ segments = [window.Avo.configuration.root_path, "avo_api", "search"];
87331
+ }
87332
+ if (this.isBelongsToSearch) {
87333
+ params = __spreadProps(__spreadValues({}, params), { via_association: this.dataset.viaAssociation });
87334
+ }
87335
+ return url.segment(segments).search(params).toString();
87275
87336
  }
87276
- get searchUrl() {
87277
- return this.isGlobalSearch ? `${window.Avo.configuration.root_path}/avo_api/search` : `${window.Avo.configuration.root_path}/avo_api/${this.searchResource}/search`;
87337
+ handleOnSelect({ item }) {
87338
+ if (this.isBelongsToSearch) {
87339
+ this.hiddenIdTarget.setAttribute("value", item._id);
87340
+ this.buttonTarget.setAttribute("value", item._label);
87341
+ document.querySelector(".aa-DetachedOverlay").remove();
87342
+ this.clearButtonTarget.classList.remove("hidden");
87343
+ } else {
87344
+ turbo_es2017_esm_exports.visit(item._url, { action: "advance" });
87345
+ }
87278
87346
  }
87279
87347
  addSource(resourceName, data) {
87280
87348
  const that = this;
87281
87349
  return {
87282
87350
  sourceId: resourceName,
87283
87351
  getItems: () => data.results,
87284
- onSelect({ item }) {
87285
- turbo_es2017_esm_exports.visit(item._url, { action: "replace" });
87286
- },
87352
+ onSelect: that.handleOnSelect.bind(that),
87287
87353
  templates: {
87288
87354
  header() {
87289
87355
  return `${data.header.toUpperCase()} ${data.help}`;
@@ -87324,9 +87390,18 @@
87324
87390
  showSearchPanel() {
87325
87391
  this.autocompleteTarget.querySelector("button").click();
87326
87392
  }
87393
+ clearValue() {
87394
+ this.clearValueTargets.map((e2) => e2.setAttribute("value", ""));
87395
+ this.clearButtonTarget.classList.add("hidden");
87396
+ }
87327
87397
  connect() {
87328
87398
  const that = this;
87329
87399
  this.buttonTarget.onclick = () => this.showSearchPanel();
87400
+ this.clearValueTargets.forEach((target) => {
87401
+ if (target.getAttribute("value")) {
87402
+ this.clearButtonTarget.classList.remove("hidden");
87403
+ }
87404
+ });
87330
87405
  if (this.isGlobalSearch) {
87331
87406
  Mousetrap.bind(["command+k", "ctrl+k"], () => this.showSearchPanel());
87332
87407
  }
@@ -87339,13 +87414,21 @@
87339
87414
  openOnFocus: true,
87340
87415
  detachedMediaQuery: "",
87341
87416
  getSources: ({ query }) => {
87342
- const endpoint = `${that.searchUrl}?q=${query}`;
87417
+ const endpoint = that.searchUrl(query);
87343
87418
  return that.debouncedFetch(endpoint).then((response) => response.json()).then((data) => Object.keys(data).map((resourceName) => that.addSource(resourceName, data[resourceName])));
87344
87419
  }
87345
87420
  });
87421
+ this.buttonTarget.removeAttribute("disabled");
87346
87422
  }
87347
87423
  };
87348
- __publicField(search_controller_default, "targets", ["autocomplete", "button"]);
87424
+ __publicField(search_controller_default, "targets", [
87425
+ "autocomplete",
87426
+ "button",
87427
+ "hiddenId",
87428
+ "visibleLabel",
87429
+ "clearValue",
87430
+ "clearButton"
87431
+ ]);
87349
87432
 
87350
87433
  // app/javascript/js/controllers/select_filter_controller.js
87351
87434
  var select_filter_controller_default = class extends filter_controller_default {