@opengeoweb/form-fields 9.20.2 → 9.22.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/index.esm.js CHANGED
@@ -3,12 +3,85 @@ import { FormControl, FormHelperText, InputLabel, Select, RadioGroup, TextField,
3
3
  import { useFormContext, useController, useForm, FormProvider } from 'react-hook-form';
4
4
  import { isEqual } from 'lodash';
5
5
  import { dateUtils } from '@opengeoweb/shared';
6
+ import i18n from 'i18next';
7
+ import { initReactI18next } from 'react-i18next';
6
8
  import * as React from 'react';
7
9
  import { DateTimePicker } from '@mui/x-date-pickers';
8
10
  import { CalendarToday } from '@opengeoweb/theme';
9
11
  import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
10
12
  import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3';
11
13
 
14
+ var en = {
15
+ "form-fields-error-required": "This field is required",
16
+ "form-fields-error-date-valid": "Not a valid date",
17
+ "form-fields-error-date-after": "Date should not be before",
18
+ "form-fields-error-date-hours-before": "Date is too far in the past",
19
+ "form-fields-error-date-hours-after": "Date is too far in the future",
20
+ "form-fields-error-date-before": "Timestamp too late",
21
+ "form-fields-error-min-level": "The minimum level is 1",
22
+ "form-fields-error-latitude": "Invalid latitude, expected number with maximum two decimal degrees between -90.00 and 90.00",
23
+ "form-fields-error-longitude": "Invalid longitude, expected number with maximum two decimal degrees between -180.00 and 180.00",
24
+ "form-fields-error-valid-max": "The maximum value is exceeded",
25
+ "form-fields-error-level-lower": "The lower level has to be below the upper level",
26
+ "form-fields-error-non-or-both-cooordinates": "Please enter both coordinates",
27
+ "form-fields-error-integer": "Invalid entry, enter a non-decimal number",
28
+ "form-fields-error-numeric": "Invalid entry, enter a numeric value"
29
+ };
30
+ var fi = {
31
+ "form-fields-error-required": "ei käännetty",
32
+ "form-fields-error-date-valid": "ei käännetty",
33
+ "form-fields-error-date-after": "ei käännetty",
34
+ "form-fields-error-date-hours-before": "ei käännetty",
35
+ "form-fields-error-date-hours-after": "ei käännetty",
36
+ "form-fields-error-date-before": "ei käännetty",
37
+ "form-fields-error-min-level": "ei käännetty",
38
+ "form-fields-error-latitude": "ei käännetty",
39
+ "form-fields-error-longitude": "ei käännetty",
40
+ "form-fields-error-valid-max": "ei käännetty",
41
+ "form-fields-error-level-lower": "ei käännetty",
42
+ "form-fields-error-non-or-both-cooordinates": "ei käännetty",
43
+ "form-fields-error-integer": "ei käännetty",
44
+ "form-fields-error-numeric": "ei käännetty"
45
+ };
46
+ var no = {
47
+ "form-fields-error-required": "Dette feltet er påkrevet",
48
+ "form-fields-error-date-valid": "Ingen gyldig dato",
49
+ "form-fields-error-date-after": "Dato skal ikke vere før",
50
+ "form-fields-error-date-hours-before": "Dato er for langt tilbake i tid",
51
+ "form-fields-error-date-hours-after": "Dato er for langt fram i tid",
52
+ "form-fields-error-date-before": "Tidspunktet er for seint",
53
+ "form-fields-error-min-level": "Mimimumsgrensen er 1",
54
+ "form-fields-error-latitude": "Ikke gyldig breddegrad, forventet et tall med to desimaler mellom -90.00 og 90.00",
55
+ "form-fields-error-longitude": "Ikke gyldig lengdegrad, forventet et tall med to desimaler mellom -180.00 og 180.00",
56
+ "form-fields-error-valid-max": "Maksimalverdien er overskredet",
57
+ "form-fields-error-level-lower": "Den laveste verdien må vere mindre enn den høyeste",
58
+ "form-fields-error-non-or-both-cooordinates": "Vennligst skriv inn begge koordinatene",
59
+ "form-fields-error-integer": "Ikke gyldig input, skriv inn et heltall",
60
+ "form-fields-error-numeric": "Ikke gyldig input, skriv inn et tall"
61
+ };
62
+ var nl = {
63
+ "form-fields-error-required": "Dit veld is verplicht",
64
+ "form-fields-error-date-valid": "Geen geldige datum",
65
+ "form-fields-error-date-after": "Datum mag niet in het verleden liggen",
66
+ "form-fields-error-date-hours-before": "Datum ligt te ver in het verleden",
67
+ "form-fields-error-date-hours-after": "Datum ligt te ver in de toekomst",
68
+ "form-fields-error-date-before": "Tijdsaanduiding is te laat",
69
+ "form-fields-error-min-level": "Het minimum niveau is 1",
70
+ "form-fields-error-latitude": "Ongeldige breedtegraad, er wordt een getal verwacht van maximaal 2 decimalen in graden tussen -90.00 en 90.00",
71
+ "form-fields-error-longitude": "Ongeldige lengtegraad, er wordt een getal verwacht van maximaal 2 decimalen in graden tussen -180.00 en 180.00",
72
+ "form-fields-error-valid-max": "Het maximum niveau is bereikt",
73
+ "form-fields-error-level-lower": "Het lage niveau moet onder het hoge niveau zijn",
74
+ "form-fields-error-non-or-both-cooordinates": "Voer beide coördinaten in",
75
+ "form-fields-error-integer": "Ongeldige invoer, voer een niet decimaal getal in",
76
+ "form-fields-error-numeric": "Ongeldige invoer, voor een numerieke waarde in"
77
+ };
78
+ var formFieldsTranslations = {
79
+ en: en,
80
+ fi: fi,
81
+ no: no,
82
+ nl: nl
83
+ };
84
+
12
85
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
13
86
 
14
87
  var check = function (it) {
@@ -1118,176 +1191,12 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
1118
1191
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1119
1192
  };
1120
1193
 
1121
- var wellKnownSymbol$9 = wellKnownSymbol$b;
1122
-
1123
- var TO_STRING_TAG$2 = wellKnownSymbol$9('toStringTag');
1124
- var test = {};
1125
-
1126
- test[TO_STRING_TAG$2] = 'z';
1127
-
1128
- var toStringTagSupport = String(test) === '[object z]';
1129
-
1130
- var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1131
- var isCallable$5 = isCallable$g;
1132
- var classofRaw = classofRaw$1;
1133
- var wellKnownSymbol$8 = wellKnownSymbol$b;
1134
-
1135
- var TO_STRING_TAG$1 = wellKnownSymbol$8('toStringTag');
1136
- var $Object$1 = Object;
1137
-
1138
- // ES3 wrong here
1139
- var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';
1140
-
1141
- // fallback for IE11 Script Access Denied error
1142
- var tryGet = function (it, key) {
1143
- try {
1144
- return it[key];
1145
- } catch (error) { /* empty */ }
1146
- };
1147
-
1148
- // getting tag from ES6+ `Object.prototype.toString`
1149
- var classof$4 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1150
- var O, tag, result;
1151
- return it === undefined ? 'Undefined' : it === null ? 'Null'
1152
- // @@toStringTag case
1153
- : typeof (tag = tryGet(O = $Object$1(it), TO_STRING_TAG$1)) == 'string' ? tag
1154
- // builtinTag case
1155
- : CORRECT_ARGUMENTS ? classofRaw(O)
1156
- // ES3 arguments fallback
1157
- : (result = classofRaw(O)) === 'Object' && isCallable$5(O.callee) ? 'Arguments' : result;
1158
- };
1159
-
1160
- var classof$3 = classof$4;
1161
-
1162
- var $String$1 = String;
1163
-
1164
- var toString$8 = function (argument) {
1165
- if (classof$3(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
1166
- return $String$1(argument);
1167
- };
1168
-
1169
- // a string of all valid unicode whitespaces
1170
- var whitespaces$4 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
1171
- '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
1172
-
1173
- var uncurryThis$6 = functionUncurryThis;
1174
- var requireObjectCoercible$4 = requireObjectCoercible$7;
1175
- var toString$7 = toString$8;
1176
- var whitespaces$3 = whitespaces$4;
1177
-
1178
- var replace$1 = uncurryThis$6(''.replace);
1179
- var ltrim = RegExp('^[' + whitespaces$3 + ']+');
1180
- var rtrim = RegExp('(^|[^' + whitespaces$3 + '])[' + whitespaces$3 + ']+$');
1181
-
1182
- // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
1183
- var createMethod$2 = function (TYPE) {
1184
- return function ($this) {
1185
- var string = toString$7(requireObjectCoercible$4($this));
1186
- if (TYPE & 1) string = replace$1(string, ltrim, '');
1187
- if (TYPE & 2) string = replace$1(string, rtrim, '$1');
1188
- return string;
1189
- };
1190
- };
1191
-
1192
- var stringTrim = {
1193
- // `String.prototype.{ trimLeft, trimStart }` methods
1194
- // https://tc39.es/ecma262/#sec-string.prototype.trimstart
1195
- start: createMethod$2(1),
1196
- // `String.prototype.{ trimRight, trimEnd }` methods
1197
- // https://tc39.es/ecma262/#sec-string.prototype.trimend
1198
- end: createMethod$2(2),
1199
- // `String.prototype.trim` method
1200
- // https://tc39.es/ecma262/#sec-string.prototype.trim
1201
- trim: createMethod$2(3)
1202
- };
1203
-
1204
- var global$7 = global$h;
1205
- var fails$b = fails$l;
1206
- var uncurryThis$5 = functionUncurryThis;
1207
- var toString$6 = toString$8;
1208
- var trim$1 = stringTrim.trim;
1209
- var whitespaces$2 = whitespaces$4;
1210
-
1211
- var charAt$3 = uncurryThis$5(''.charAt);
1212
- var $parseFloat$1 = global$7.parseFloat;
1213
- var Symbol$2 = global$7.Symbol;
1214
- var ITERATOR$4 = Symbol$2 && Symbol$2.iterator;
1215
- var FORCED$2 = 1 / $parseFloat$1(whitespaces$2 + '-0') !== -Infinity
1216
- // MS Edge 18- broken with boxed symbols
1217
- || (ITERATOR$4 && !fails$b(function () { $parseFloat$1(Object(ITERATOR$4)); }));
1218
-
1219
- // `parseFloat` method
1220
- // https://tc39.es/ecma262/#sec-parsefloat-string
1221
- var numberParseFloat = FORCED$2 ? function parseFloat(string) {
1222
- var trimmedString = trim$1(toString$6(string));
1223
- var result = $parseFloat$1(trimmedString);
1224
- return result === 0 && charAt$3(trimmedString, 0) === '-' ? -0 : result;
1225
- } : $parseFloat$1;
1226
-
1227
- var $$8 = _export;
1228
- var $parseFloat = numberParseFloat;
1229
-
1230
- // `parseFloat` method
1231
- // https://tc39.es/ecma262/#sec-parsefloat-string
1232
- $$8({ global: true, forced: parseFloat !== $parseFloat }, {
1233
- parseFloat: $parseFloat
1234
- });
1235
-
1236
- var anObject$6 = anObject$9;
1237
-
1238
- // `RegExp.prototype.flags` getter implementation
1239
- // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
1240
- var regexpFlags$1 = function () {
1241
- var that = anObject$6(this);
1242
- var result = '';
1243
- if (that.hasIndices) result += 'd';
1244
- if (that.global) result += 'g';
1245
- if (that.ignoreCase) result += 'i';
1246
- if (that.multiline) result += 'm';
1247
- if (that.dotAll) result += 's';
1248
- if (that.unicode) result += 'u';
1249
- if (that.unicodeSets) result += 'v';
1250
- if (that.sticky) result += 'y';
1251
- return result;
1252
- };
1253
-
1254
- var fails$a = fails$l;
1255
- var global$6 = global$h;
1256
-
1257
- // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
1258
- var $RegExp$2 = global$6.RegExp;
1259
-
1260
- var UNSUPPORTED_Y$1 = fails$a(function () {
1261
- var re = $RegExp$2('a', 'y');
1262
- re.lastIndex = 2;
1263
- return re.exec('abcd') !== null;
1264
- });
1265
-
1266
- // UC Browser bug
1267
- // https://github.com/zloirock/core-js/issues/1008
1268
- var MISSED_STICKY = UNSUPPORTED_Y$1 || fails$a(function () {
1269
- return !$RegExp$2('a', 'y').sticky;
1270
- });
1271
-
1272
- var BROKEN_CARET = UNSUPPORTED_Y$1 || fails$a(function () {
1273
- // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
1274
- var re = $RegExp$2('^r', 'gy');
1275
- re.lastIndex = 2;
1276
- return re.exec('str') !== null;
1277
- });
1278
-
1279
- var regexpStickyHelpers = {
1280
- BROKEN_CARET: BROKEN_CARET,
1281
- MISSED_STICKY: MISSED_STICKY,
1282
- UNSUPPORTED_Y: UNSUPPORTED_Y$1
1283
- };
1284
-
1285
1194
  var objectDefineProperties = {};
1286
1195
 
1287
1196
  var DESCRIPTORS$1 = descriptors;
1288
1197
  var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
1289
1198
  var definePropertyModule = objectDefineProperty;
1290
- var anObject$5 = anObject$9;
1199
+ var anObject$6 = anObject$9;
1291
1200
  var toIndexedObject$1 = toIndexedObject$5;
1292
1201
  var objectKeys = objectKeys$2;
1293
1202
 
@@ -1295,7 +1204,7 @@ var objectKeys = objectKeys$2;
1295
1204
  // https://tc39.es/ecma262/#sec-object.defineproperties
1296
1205
  // eslint-disable-next-line es/no-object-defineproperties -- safe
1297
1206
  objectDefineProperties.f = DESCRIPTORS$1 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1298
- anObject$5(O);
1207
+ anObject$6(O);
1299
1208
  var props = toIndexedObject$1(Properties);
1300
1209
  var keys = objectKeys(Properties);
1301
1210
  var length = keys.length;
@@ -1310,7 +1219,7 @@ var getBuiltIn = getBuiltIn$3;
1310
1219
  var html$1 = getBuiltIn('document', 'documentElement');
1311
1220
 
1312
1221
  /* global ActiveXObject -- old IE, WSH */
1313
- var anObject$4 = anObject$9;
1222
+ var anObject$5 = anObject$9;
1314
1223
  var definePropertiesModule = objectDefineProperties;
1315
1224
  var enumBugKeys = enumBugKeys$3;
1316
1225
  var hiddenKeys = hiddenKeys$4;
@@ -1384,7 +1293,7 @@ hiddenKeys[IE_PROTO$1] = true;
1384
1293
  var objectCreate = Object.create || function create(O, Properties) {
1385
1294
  var result;
1386
1295
  if (O !== null) {
1387
- EmptyConstructor[PROTOTYPE] = anObject$4(O);
1296
+ EmptyConstructor[PROTOTYPE] = anObject$5(O);
1388
1297
  result = new EmptyConstructor();
1389
1298
  EmptyConstructor[PROTOTYPE] = null;
1390
1299
  // add "__proto__" for Object.getPrototypeOf polyfill
@@ -1393,1190 +1302,1486 @@ var objectCreate = Object.create || function create(O, Properties) {
1393
1302
  return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
1394
1303
  };
1395
1304
 
1396
- var fails$9 = fails$l;
1397
- var global$5 = global$h;
1305
+ var wellKnownSymbol$9 = wellKnownSymbol$b;
1306
+ var create$2 = objectCreate;
1307
+ var defineProperty$2 = objectDefineProperty.f;
1398
1308
 
1399
- // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
1400
- var $RegExp$1 = global$5.RegExp;
1309
+ var UNSCOPABLES = wellKnownSymbol$9('unscopables');
1310
+ var ArrayPrototype = Array.prototype;
1401
1311
 
1402
- var regexpUnsupportedDotAll = fails$9(function () {
1403
- var re = $RegExp$1('.', 's');
1404
- return !(re.dotAll && re.test('\n') && re.flags === 's');
1405
- });
1312
+ // Array.prototype[@@unscopables]
1313
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1314
+ if (ArrayPrototype[UNSCOPABLES] === undefined) {
1315
+ defineProperty$2(ArrayPrototype, UNSCOPABLES, {
1316
+ configurable: true,
1317
+ value: create$2(null)
1318
+ });
1319
+ }
1406
1320
 
1407
- var fails$8 = fails$l;
1408
- var global$4 = global$h;
1321
+ // add a key to Array.prototype[@@unscopables]
1322
+ var addToUnscopables$2 = function (key) {
1323
+ ArrayPrototype[UNSCOPABLES][key] = true;
1324
+ };
1409
1325
 
1410
- // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
1411
- var $RegExp = global$4.RegExp;
1326
+ var iterators = {};
1412
1327
 
1413
- var regexpUnsupportedNcg = fails$8(function () {
1414
- var re = $RegExp('(?<a>b)', 'g');
1415
- return re.exec('b').groups.a !== 'b' ||
1416
- 'b'.replace(re, '$<a>c') !== 'bc';
1328
+ var fails$b = fails$l;
1329
+
1330
+ var correctPrototypeGetter = !fails$b(function () {
1331
+ function F() { /* empty */ }
1332
+ F.prototype.constructor = null;
1333
+ // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
1334
+ return Object.getPrototypeOf(new F()) !== F.prototype;
1417
1335
  });
1418
1336
 
1419
- /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
1420
- /* eslint-disable regexp/no-useless-quantifier -- testing */
1421
- var call$6 = functionCall;
1422
- var uncurryThis$4 = functionUncurryThis;
1423
- var toString$5 = toString$8;
1424
- var regexpFlags = regexpFlags$1;
1425
- var stickyHelpers = regexpStickyHelpers;
1426
- var shared = shared$4;
1427
- var create$2 = objectCreate;
1428
- var getInternalState$1 = internalState.get;
1429
- var UNSUPPORTED_DOT_ALL = regexpUnsupportedDotAll;
1430
- var UNSUPPORTED_NCG = regexpUnsupportedNcg;
1337
+ var hasOwn$2 = hasOwnProperty_1;
1338
+ var isCallable$5 = isCallable$g;
1339
+ var toObject$1 = toObject$4;
1340
+ var sharedKey = sharedKey$3;
1341
+ var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
1431
1342
 
1432
- var nativeReplace = shared('native-string-replace', String.prototype.replace);
1433
- var nativeExec = RegExp.prototype.exec;
1434
- var patchedExec = nativeExec;
1435
- var charAt$2 = uncurryThis$4(''.charAt);
1436
- var indexOf = uncurryThis$4(''.indexOf);
1437
- var replace = uncurryThis$4(''.replace);
1438
- var stringSlice$1 = uncurryThis$4(''.slice);
1343
+ var IE_PROTO = sharedKey('IE_PROTO');
1344
+ var $Object$1 = Object;
1345
+ var ObjectPrototype = $Object$1.prototype;
1439
1346
 
1440
- var UPDATES_LAST_INDEX_WRONG = (function () {
1441
- var re1 = /a/;
1442
- var re2 = /b*/g;
1443
- call$6(nativeExec, re1, 'a');
1444
- call$6(nativeExec, re2, 'a');
1445
- return re1.lastIndex !== 0 || re2.lastIndex !== 0;
1446
- })();
1347
+ // `Object.getPrototypeOf` method
1348
+ // https://tc39.es/ecma262/#sec-object.getprototypeof
1349
+ // eslint-disable-next-line es/no-object-getprototypeof -- safe
1350
+ var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object$1.getPrototypeOf : function (O) {
1351
+ var object = toObject$1(O);
1352
+ if (hasOwn$2(object, IE_PROTO)) return object[IE_PROTO];
1353
+ var constructor = object.constructor;
1354
+ if (isCallable$5(constructor) && object instanceof constructor) {
1355
+ return constructor.prototype;
1356
+ } return object instanceof $Object$1 ? ObjectPrototype : null;
1357
+ };
1447
1358
 
1448
- var UNSUPPORTED_Y = stickyHelpers.BROKEN_CARET;
1359
+ var fails$a = fails$l;
1360
+ var isCallable$4 = isCallable$g;
1361
+ var isObject$3 = isObject$9;
1362
+ var getPrototypeOf$1 = objectGetPrototypeOf;
1363
+ var defineBuiltIn$3 = defineBuiltIn$5;
1364
+ var wellKnownSymbol$8 = wellKnownSymbol$b;
1449
1365
 
1450
- // nonparticipating capturing group, copied from es5-shim's String#split patch.
1451
- var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
1366
+ var ITERATOR$4 = wellKnownSymbol$8('iterator');
1367
+ var BUGGY_SAFARI_ITERATORS$1 = false;
1452
1368
 
1453
- var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;
1369
+ // `%IteratorPrototype%` object
1370
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
1371
+ var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
1454
1372
 
1455
- if (PATCH) {
1456
- patchedExec = function exec(string) {
1457
- var re = this;
1458
- var state = getInternalState$1(re);
1459
- var str = toString$5(string);
1460
- var raw = state.raw;
1461
- var result, reCopy, lastIndex, match, i, object, group;
1373
+ /* eslint-disable es/no-array-prototype-keys -- safe */
1374
+ if ([].keys) {
1375
+ arrayIterator = [].keys();
1376
+ // Safari 8 has buggy iterators w/o `next`
1377
+ if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
1378
+ else {
1379
+ PrototypeOfArrayIteratorPrototype = getPrototypeOf$1(getPrototypeOf$1(arrayIterator));
1380
+ if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
1381
+ }
1382
+ }
1462
1383
 
1463
- if (raw) {
1464
- raw.lastIndex = re.lastIndex;
1465
- result = call$6(patchedExec, raw, str);
1466
- re.lastIndex = raw.lastIndex;
1467
- return result;
1468
- }
1384
+ var NEW_ITERATOR_PROTOTYPE = !isObject$3(IteratorPrototype$2) || fails$a(function () {
1385
+ var test = {};
1386
+ // FF44- legacy iterators case
1387
+ return IteratorPrototype$2[ITERATOR$4].call(test) !== test;
1388
+ });
1469
1389
 
1470
- var groups = state.groups;
1471
- var sticky = UNSUPPORTED_Y && re.sticky;
1472
- var flags = call$6(regexpFlags, re);
1473
- var source = re.source;
1474
- var charsAdded = 0;
1475
- var strCopy = str;
1390
+ if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
1476
1391
 
1477
- if (sticky) {
1478
- flags = replace(flags, 'y', '');
1479
- if (indexOf(flags, 'g') === -1) {
1480
- flags += 'g';
1481
- }
1392
+ // `%IteratorPrototype%[@@iterator]()` method
1393
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
1394
+ if (!isCallable$4(IteratorPrototype$2[ITERATOR$4])) {
1395
+ defineBuiltIn$3(IteratorPrototype$2, ITERATOR$4, function () {
1396
+ return this;
1397
+ });
1398
+ }
1482
1399
 
1483
- strCopy = stringSlice$1(str, re.lastIndex);
1484
- // Support anchored sticky behavior.
1485
- if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$2(str, re.lastIndex - 1) !== '\n')) {
1486
- source = '(?: ' + source + ')';
1487
- strCopy = ' ' + strCopy;
1488
- charsAdded++;
1489
- }
1490
- // ^(? + rx + ) is needed, in combination with some str slicing, to
1491
- // simulate the 'y' flag.
1492
- reCopy = new RegExp('^(?:' + source + ')', flags);
1493
- }
1400
+ var iteratorsCore = {
1401
+ IteratorPrototype: IteratorPrototype$2,
1402
+ BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
1403
+ };
1494
1404
 
1495
- if (NPCG_INCLUDED) {
1496
- reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
1497
- }
1498
- if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
1405
+ var defineProperty$1 = objectDefineProperty.f;
1406
+ var hasOwn$1 = hasOwnProperty_1;
1407
+ var wellKnownSymbol$7 = wellKnownSymbol$b;
1499
1408
 
1500
- match = call$6(nativeExec, sticky ? reCopy : re, strCopy);
1409
+ var TO_STRING_TAG$2 = wellKnownSymbol$7('toStringTag');
1501
1410
 
1502
- if (sticky) {
1503
- if (match) {
1504
- match.input = stringSlice$1(match.input, charsAdded);
1505
- match[0] = stringSlice$1(match[0], charsAdded);
1506
- match.index = re.lastIndex;
1507
- re.lastIndex += match[0].length;
1508
- } else re.lastIndex = 0;
1509
- } else if (UPDATES_LAST_INDEX_WRONG && match) {
1510
- re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
1511
- }
1512
- if (NPCG_INCLUDED && match && match.length > 1) {
1513
- // Fix browsers whose `exec` methods don't consistently return `undefined`
1514
- // for NPCG, like IE8. NOTE: This doesn't work for /(.?)?/
1515
- call$6(nativeReplace, match[0], reCopy, function () {
1516
- for (i = 1; i < arguments.length - 2; i++) {
1517
- if (arguments[i] === undefined) match[i] = undefined;
1518
- }
1519
- });
1520
- }
1411
+ var setToStringTag$3 = function (target, TAG, STATIC) {
1412
+ if (target && !STATIC) target = target.prototype;
1413
+ if (target && !hasOwn$1(target, TO_STRING_TAG$2)) {
1414
+ defineProperty$1(target, TO_STRING_TAG$2, { configurable: true, value: TAG });
1415
+ }
1416
+ };
1521
1417
 
1522
- if (match && groups) {
1523
- match.groups = object = create$2(null);
1524
- for (i = 0; i < groups.length; i++) {
1525
- group = groups[i];
1526
- object[group[0]] = match[group[1]];
1527
- }
1528
- }
1418
+ var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
1419
+ var create$1 = objectCreate;
1420
+ var createPropertyDescriptor = createPropertyDescriptor$3;
1421
+ var setToStringTag$2 = setToStringTag$3;
1422
+ var Iterators$2 = iterators;
1529
1423
 
1530
- return match;
1531
- };
1532
- }
1424
+ var returnThis$1 = function () { return this; };
1533
1425
 
1534
- var regexpExec$2 = patchedExec;
1426
+ var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
1427
+ var TO_STRING_TAG = NAME + ' Iterator';
1428
+ IteratorConstructor.prototype = create$1(IteratorPrototype$1, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
1429
+ setToStringTag$2(IteratorConstructor, TO_STRING_TAG, false);
1430
+ Iterators$2[TO_STRING_TAG] = returnThis$1;
1431
+ return IteratorConstructor;
1432
+ };
1535
1433
 
1536
- var $$7 = _export;
1537
- var exec$1 = regexpExec$2;
1434
+ var uncurryThis$6 = functionUncurryThis;
1435
+ var aCallable$1 = aCallable$3;
1538
1436
 
1539
- // `RegExp.prototype.exec` method
1540
- // https://tc39.es/ecma262/#sec-regexp.prototype.exec
1541
- $$7({ target: 'RegExp', proto: true, forced: /./.exec !== exec$1 }, {
1542
- exec: exec$1
1543
- });
1437
+ var functionUncurryThisAccessor = function (object, key, method) {
1438
+ try {
1439
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1440
+ return uncurryThis$6(aCallable$1(Object.getOwnPropertyDescriptor(object, key)[method]));
1441
+ } catch (error) { /* empty */ }
1442
+ };
1544
1443
 
1545
- // TODO: Remove from `core-js@4` since it's moved to entry points
1444
+ var isObject$2 = isObject$9;
1546
1445
 
1547
- var $$6 = _export;
1548
- var call$5 = functionCall;
1549
- var isCallable$4 = isCallable$g;
1550
- var anObject$3 = anObject$9;
1551
- var toString$4 = toString$8;
1446
+ var isPossiblePrototype$1 = function (argument) {
1447
+ return isObject$2(argument) || argument === null;
1448
+ };
1552
1449
 
1553
- var DELEGATES_TO_EXEC = function () {
1554
- var execCalled = false;
1555
- var re = /[ac]/;
1556
- re.exec = function () {
1557
- execCalled = true;
1558
- return /./.exec.apply(this, arguments);
1559
- };
1560
- return re.test('abc') === true && execCalled;
1561
- }();
1450
+ var isPossiblePrototype = isPossiblePrototype$1;
1562
1451
 
1563
- var nativeTest = /./.test;
1452
+ var $String$1 = String;
1453
+ var $TypeError$3 = TypeError;
1564
1454
 
1565
- // `RegExp.prototype.test` method
1566
- // https://tc39.es/ecma262/#sec-regexp.prototype.test
1567
- $$6({ target: 'RegExp', proto: true, forced: !DELEGATES_TO_EXEC }, {
1568
- test: function (S) {
1569
- var R = anObject$3(this);
1570
- var string = toString$4(S);
1571
- var exec = R.exec;
1572
- if (!isCallable$4(exec)) return call$5(nativeTest, R, string);
1573
- var result = call$5(exec, R, string);
1574
- if (result === null) return false;
1575
- anObject$3(result);
1576
- return true;
1577
- }
1578
- });
1455
+ var aPossiblePrototype$1 = function (argument) {
1456
+ if (isPossiblePrototype(argument)) return argument;
1457
+ throw new $TypeError$3("Can't set " + $String$1(argument) + ' as a prototype');
1458
+ };
1579
1459
 
1580
- var call$4 = functionCall;
1581
- var hasOwn$2 = hasOwnProperty_1;
1582
- var isPrototypeOf = objectIsPrototypeOf;
1583
- var regExpFlags = regexpFlags$1;
1460
+ /* eslint-disable no-proto -- safe */
1461
+ var uncurryThisAccessor = functionUncurryThisAccessor;
1462
+ var isObject$1 = isObject$9;
1463
+ var requireObjectCoercible$4 = requireObjectCoercible$7;
1464
+ var aPossiblePrototype = aPossiblePrototype$1;
1584
1465
 
1585
- var RegExpPrototype$2 = RegExp.prototype;
1466
+ // `Object.setPrototypeOf` method
1467
+ // https://tc39.es/ecma262/#sec-object.setprototypeof
1468
+ // Works with __proto__ only. Old v8 can't work with null proto objects.
1469
+ // eslint-disable-next-line es/no-object-setprototypeof -- safe
1470
+ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1471
+ var CORRECT_SETTER = false;
1472
+ var test = {};
1473
+ var setter;
1474
+ try {
1475
+ setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');
1476
+ setter(test, []);
1477
+ CORRECT_SETTER = test instanceof Array;
1478
+ } catch (error) { /* empty */ }
1479
+ return function setPrototypeOf(O, proto) {
1480
+ requireObjectCoercible$4(O);
1481
+ aPossiblePrototype(proto);
1482
+ if (!isObject$1(O)) return O;
1483
+ if (CORRECT_SETTER) setter(O, proto);
1484
+ else O.__proto__ = proto;
1485
+ return O;
1486
+ };
1487
+ }() : undefined);
1586
1488
 
1587
- var regexpGetFlags = function (R) {
1588
- var flags = R.flags;
1589
- return flags === undefined && !('flags' in RegExpPrototype$2) && !hasOwn$2(R, 'flags') && isPrototypeOf(RegExpPrototype$2, R)
1590
- ? call$4(regExpFlags, R) : flags;
1591
- };
1489
+ var $$8 = _export;
1490
+ var call$6 = functionCall;
1491
+ var FunctionName = functionName;
1492
+ var isCallable$3 = isCallable$g;
1493
+ var createIteratorConstructor = iteratorCreateConstructor;
1494
+ var getPrototypeOf = objectGetPrototypeOf;
1495
+ var setPrototypeOf = objectSetPrototypeOf;
1496
+ var setToStringTag$1 = setToStringTag$3;
1497
+ var createNonEnumerableProperty$2 = createNonEnumerableProperty$5;
1498
+ var defineBuiltIn$2 = defineBuiltIn$5;
1499
+ var wellKnownSymbol$6 = wellKnownSymbol$b;
1500
+ var Iterators$1 = iterators;
1501
+ var IteratorsCore = iteratorsCore;
1592
1502
 
1593
- var PROPER_FUNCTION_NAME$2 = functionName.PROPER;
1594
- var defineBuiltIn$3 = defineBuiltIn$5;
1595
- var anObject$2 = anObject$9;
1596
- var $toString = toString$8;
1597
- var fails$7 = fails$l;
1598
- var getRegExpFlags = regexpGetFlags;
1503
+ var PROPER_FUNCTION_NAME$2 = FunctionName.PROPER;
1504
+ var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
1505
+ var IteratorPrototype = IteratorsCore.IteratorPrototype;
1506
+ var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
1507
+ var ITERATOR$3 = wellKnownSymbol$6('iterator');
1508
+ var KEYS = 'keys';
1509
+ var VALUES = 'values';
1510
+ var ENTRIES = 'entries';
1599
1511
 
1600
- var TO_STRING = 'toString';
1601
- var RegExpPrototype$1 = RegExp.prototype;
1602
- var nativeToString = RegExpPrototype$1[TO_STRING];
1512
+ var returnThis = function () { return this; };
1603
1513
 
1604
- var NOT_GENERIC = fails$7(function () { return nativeToString.call({ source: 'a', flags: 'b' }) !== '/a/b'; });
1605
- // FF44- RegExp#toString has a wrong name
1606
- var INCORRECT_NAME = PROPER_FUNCTION_NAME$2 && nativeToString.name !== TO_STRING;
1514
+ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
1515
+ createIteratorConstructor(IteratorConstructor, NAME, next);
1607
1516
 
1608
- // `RegExp.prototype.toString` method
1609
- // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
1610
- if (NOT_GENERIC || INCORRECT_NAME) {
1611
- defineBuiltIn$3(RegExpPrototype$1, TO_STRING, function toString() {
1612
- var R = anObject$2(this);
1613
- var pattern = $toString(R.source);
1614
- var flags = $toString(getRegExpFlags(R));
1615
- return '/' + pattern + '/' + flags;
1616
- }, { unsafe: true });
1617
- }
1517
+ var getIterationMethod = function (KIND) {
1518
+ if (KIND === DEFAULT && defaultIterator) return defaultIterator;
1519
+ if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND];
1618
1520
 
1619
- var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
1620
- var fails$6 = fails$l;
1621
- var whitespaces$1 = whitespaces$4;
1521
+ switch (KIND) {
1522
+ case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
1523
+ case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
1524
+ case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
1525
+ }
1622
1526
 
1623
- var non = '\u200B\u0085\u180E';
1527
+ return function () { return new IteratorConstructor(this); };
1528
+ };
1624
1529
 
1625
- // check that a method works with the correct list
1626
- // of whitespaces and has a correct name
1627
- var stringTrimForced = function (METHOD_NAME) {
1628
- return fails$6(function () {
1629
- return !!whitespaces$1[METHOD_NAME]()
1630
- || non[METHOD_NAME]() !== non
1631
- || (PROPER_FUNCTION_NAME$1 && whitespaces$1[METHOD_NAME].name !== METHOD_NAME);
1632
- });
1633
- };
1530
+ var TO_STRING_TAG = NAME + ' Iterator';
1531
+ var INCORRECT_VALUES_NAME = false;
1532
+ var IterablePrototype = Iterable.prototype;
1533
+ var nativeIterator = IterablePrototype[ITERATOR$3]
1534
+ || IterablePrototype['@@iterator']
1535
+ || DEFAULT && IterablePrototype[DEFAULT];
1536
+ var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
1537
+ var anyNativeIterator = NAME === 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
1538
+ var CurrentIteratorPrototype, methods, KEY;
1634
1539
 
1635
- var $$5 = _export;
1636
- var $trim = stringTrim.trim;
1637
- var forcedStringTrimMethod = stringTrimForced;
1540
+ // fix native
1541
+ if (anyNativeIterator) {
1542
+ CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
1543
+ if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
1544
+ if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
1545
+ if (setPrototypeOf) {
1546
+ setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
1547
+ } else if (!isCallable$3(CurrentIteratorPrototype[ITERATOR$3])) {
1548
+ defineBuiltIn$2(CurrentIteratorPrototype, ITERATOR$3, returnThis);
1549
+ }
1550
+ }
1551
+ // Set @@toStringTag to native iterators
1552
+ setToStringTag$1(CurrentIteratorPrototype, TO_STRING_TAG, true);
1553
+ }
1554
+ }
1638
1555
 
1639
- // `String.prototype.trim` method
1640
- // https://tc39.es/ecma262/#sec-string.prototype.trim
1641
- $$5({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
1642
- trim: function trim() {
1643
- return $trim(this);
1556
+ // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
1557
+ if (PROPER_FUNCTION_NAME$2 && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) {
1558
+ if (CONFIGURABLE_FUNCTION_NAME) {
1559
+ createNonEnumerableProperty$2(IterablePrototype, 'name', VALUES);
1560
+ } else {
1561
+ INCORRECT_VALUES_NAME = true;
1562
+ defaultIterator = function values() { return call$6(nativeIterator, this); };
1563
+ }
1644
1564
  }
1645
- });
1646
1565
 
1647
- const defaultProps = {
1648
- shouldUnregister: false
1649
- };
1650
- const errorMessages = {
1651
- required: 'This field is required',
1652
- isValidDate: 'Not a valid date',
1653
- isAfter: 'Date should not be before',
1654
- isXHoursBefore: 'Date is too far in the past',
1655
- isXHoursAfter: 'Date is too far in the future',
1656
- isBefore: 'Timestamp too late',
1657
- minLevel: 'The minimum level is 1',
1658
- isLatitude: 'Invalid latitude, expected number with maximum two decimal degrees between -90.00 and 90.00',
1659
- isLongitude: 'Invalid longitude, expected number with maximum two decimal degrees between -180.00 and 180.00',
1660
- isValidMax: 'The maximum value is exceeded',
1661
- isLevelLower: 'The lower level has to be below the upper level',
1662
- isNonOrBothCoordinates: 'Please enter both coordinates',
1663
- isInteger: 'Invalid entry, enter a non-decimal number',
1664
- isNumeric: 'Invalid entry, enter a numeric value'
1665
- };
1666
- const regexMaxTwoDecimals = /^\s*-?\d+(\.\d{1,2})?\s*$/;
1667
- // validations
1668
- const isEmpty = value => {
1669
- if (typeof value === 'string' && !value.trim().length || value === null || value === undefined) {
1670
- return true;
1671
- }
1672
- return false;
1673
- };
1674
- const isXHoursBefore = (ownDate, otherDate, hours = 4) => {
1675
- if (isEmpty(ownDate) || isEmpty(otherDate)) {
1676
- return true;
1677
- }
1678
- const duration = dateUtils.differenceInHours(dateUtils.utc(otherDate), dateUtils.utc(ownDate), 'ceil');
1679
- return duration <= hours;
1680
- };
1681
- const isXHoursAfter = (ownDate, otherDate, hours = 4) => {
1682
- if (isEmpty(ownDate) || isEmpty(otherDate)) {
1683
- return true;
1566
+ // export additional methods
1567
+ if (DEFAULT) {
1568
+ methods = {
1569
+ values: getIterationMethod(VALUES),
1570
+ keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
1571
+ entries: getIterationMethod(ENTRIES)
1572
+ };
1573
+ if (FORCED) for (KEY in methods) {
1574
+ if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1575
+ defineBuiltIn$2(IterablePrototype, KEY, methods[KEY]);
1576
+ }
1577
+ } else $$8({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
1684
1578
  }
1685
- const duration = dateUtils.differenceInHours(dateUtils.utc(ownDate), dateUtils.utc(otherDate), 'ceil');
1686
- return duration <= hours;
1687
- };
1688
- const isLatitude = lat => {
1689
- if (!lat) {
1690
- return true;
1579
+
1580
+ // define iterator
1581
+ if (IterablePrototype[ITERATOR$3] !== defaultIterator) {
1582
+ defineBuiltIn$2(IterablePrototype, ITERATOR$3, defaultIterator, { name: DEFAULT });
1691
1583
  }
1692
- return isFinite(lat) && Math.abs(lat) <= 90 && regexMaxTwoDecimals.test(lat.toString());
1584
+ Iterators$1[NAME] = defaultIterator;
1585
+
1586
+ return methods;
1693
1587
  };
1694
- const isLongitude = lng => {
1695
- if (!lng) {
1696
- return true;
1697
- }
1698
- return isFinite(lng) && Math.abs(lng) <= 180 && lng >= -180 && regexMaxTwoDecimals.test(lng.toString());
1588
+
1589
+ // `CreateIterResultObject` abstract operation
1590
+ // https://tc39.es/ecma262/#sec-createiterresultobject
1591
+ var createIterResultObject$1 = function (value, done) {
1592
+ return { value: value, done: done };
1699
1593
  };
1700
- // Pass null if no maxValue
1701
- const isValidMax = (value, maxValue) => {
1702
- if (isEmpty(value) || maxValue === null) {
1703
- return true;
1594
+
1595
+ var toIndexedObject = toIndexedObject$5;
1596
+ var addToUnscopables$1 = addToUnscopables$2;
1597
+ var Iterators = iterators;
1598
+ var InternalStateModule = internalState;
1599
+ var defineProperty = objectDefineProperty.f;
1600
+ var defineIterator = iteratorDefine;
1601
+ var createIterResultObject = createIterResultObject$1;
1602
+ var DESCRIPTORS = descriptors;
1603
+
1604
+ var ARRAY_ITERATOR = 'Array Iterator';
1605
+ var setInternalState = InternalStateModule.set;
1606
+ var getInternalState$1 = InternalStateModule.getterFor(ARRAY_ITERATOR);
1607
+
1608
+ // `Array.prototype.entries` method
1609
+ // https://tc39.es/ecma262/#sec-array.prototype.entries
1610
+ // `Array.prototype.keys` method
1611
+ // https://tc39.es/ecma262/#sec-array.prototype.keys
1612
+ // `Array.prototype.values` method
1613
+ // https://tc39.es/ecma262/#sec-array.prototype.values
1614
+ // `Array.prototype[@@iterator]` method
1615
+ // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
1616
+ // `CreateArrayIterator` internal method
1617
+ // https://tc39.es/ecma262/#sec-createarrayiterator
1618
+ var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
1619
+ setInternalState(this, {
1620
+ type: ARRAY_ITERATOR,
1621
+ target: toIndexedObject(iterated), // target
1622
+ index: 0, // next index
1623
+ kind: kind // kind
1624
+ });
1625
+ // `%ArrayIteratorPrototype%.next` method
1626
+ // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
1627
+ }, function () {
1628
+ var state = getInternalState$1(this);
1629
+ var target = state.target;
1630
+ var index = state.index++;
1631
+ if (!target || index >= target.length) {
1632
+ state.target = undefined;
1633
+ return createIterResultObject(undefined, true);
1704
1634
  }
1705
- return !(value > maxValue);
1635
+ switch (state.kind) {
1636
+ case 'keys': return createIterResultObject(index, false);
1637
+ case 'values': return createIterResultObject(target[index], false);
1638
+ } return createIterResultObject([index, target[index]], false);
1639
+ }, 'values');
1640
+
1641
+ // argumentsList[@@iterator] is %ArrayProto_values%
1642
+ // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
1643
+ // https://tc39.es/ecma262/#sec-createmappedargumentsobject
1644
+ var values = Iterators.Arguments = Iterators.Array;
1645
+
1646
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1647
+ addToUnscopables$1('keys');
1648
+ addToUnscopables$1('values');
1649
+ addToUnscopables$1('entries');
1650
+
1651
+ // V8 ~ Chrome 45- bug
1652
+ if (DESCRIPTORS && values.name !== 'values') try {
1653
+ defineProperty(values, 'name', { value: 'values' });
1654
+ } catch (error) { /* empty */ }
1655
+
1656
+ var wellKnownSymbol$5 = wellKnownSymbol$b;
1657
+
1658
+ var TO_STRING_TAG$1 = wellKnownSymbol$5('toStringTag');
1659
+ var test = {};
1660
+
1661
+ test[TO_STRING_TAG$1] = 'z';
1662
+
1663
+ var toStringTagSupport = String(test) === '[object z]';
1664
+
1665
+ var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1666
+ var isCallable$2 = isCallable$g;
1667
+ var classofRaw = classofRaw$1;
1668
+ var wellKnownSymbol$4 = wellKnownSymbol$b;
1669
+
1670
+ var TO_STRING_TAG = wellKnownSymbol$4('toStringTag');
1671
+ var $Object = Object;
1672
+
1673
+ // ES3 wrong here
1674
+ var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';
1675
+
1676
+ // fallback for IE11 Script Access Denied error
1677
+ var tryGet = function (it, key) {
1678
+ try {
1679
+ return it[key];
1680
+ } catch (error) { /* empty */ }
1706
1681
  };
1707
- // Pass null if no minValue
1708
- const isValidMin = (value, minValue) => {
1709
- if (isEmpty(value) || minValue === null) {
1710
- return true;
1711
- }
1712
- return !(value < minValue);
1682
+
1683
+ // getting tag from ES6+ `Object.prototype.toString`
1684
+ var classof$4 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1685
+ var O, tag, result;
1686
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
1687
+ // @@toStringTag case
1688
+ : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
1689
+ // builtinTag case
1690
+ : CORRECT_ARGUMENTS ? classofRaw(O)
1691
+ // ES3 arguments fallback
1692
+ : (result = classofRaw(O)) === 'Object' && isCallable$2(O.callee) ? 'Arguments' : result;
1713
1693
  };
1714
- const hasValidGeometry = geojson => {
1715
- if (!geojson || !geojson.features || !geojson.features.length || !geojson.features[0].geometry ||
1716
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1717
- // @ts-ignore
1718
- !geojson.features[0].geometry.coordinates || !geojson.features[0].geometry.type) {
1719
- return false;
1720
- }
1721
- return true;
1694
+
1695
+ var classof$3 = classof$4;
1696
+
1697
+ var $String = String;
1698
+
1699
+ var toString$8 = function (argument) {
1700
+ if (classof$3(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
1701
+ return $String(argument);
1722
1702
  };
1723
- const isValidGeoJsonCoordinates = geojson => {
1724
- const hasGeometry = hasValidGeometry(geojson);
1725
- if (!hasGeometry) {
1726
- return false;
1727
- }
1728
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1729
- // @ts-ignore
1730
- const {
1731
- coordinates,
1732
- type
1733
- } = geojson.features[0].geometry;
1734
- // For type POINT coordinates is an array of 2
1735
- if (coordinates.length === 2 && type === 'Point') {
1736
- return true;
1737
- }
1738
- // For type POLYGON coordinates is an array of arrays
1739
- if (coordinates.length === 1 && coordinates[0].length > 0 && type === 'Polygon') {
1740
- return true;
1741
- }
1742
- return false;
1703
+
1704
+ // a string of all valid unicode whitespaces
1705
+ var whitespaces$4 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
1706
+ '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
1707
+
1708
+ var uncurryThis$5 = functionUncurryThis;
1709
+ var requireObjectCoercible$3 = requireObjectCoercible$7;
1710
+ var toString$7 = toString$8;
1711
+ var whitespaces$3 = whitespaces$4;
1712
+
1713
+ var replace$1 = uncurryThis$5(''.replace);
1714
+ var ltrim = RegExp('^[' + whitespaces$3 + ']+');
1715
+ var rtrim = RegExp('(^|[^' + whitespaces$3 + '])[' + whitespaces$3 + ']+$');
1716
+
1717
+ // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
1718
+ var createMethod$2 = function (TYPE) {
1719
+ return function ($this) {
1720
+ var string = toString$7(requireObjectCoercible$3($this));
1721
+ if (TYPE & 1) string = replace$1(string, ltrim, '');
1722
+ if (TYPE & 2) string = replace$1(string, rtrim, '$1');
1723
+ return string;
1724
+ };
1743
1725
  };
1744
- const isMaximumOneDrawing = geojson => {
1745
- const hasGeometry = hasValidGeometry(geojson);
1746
- if (!hasGeometry) {
1747
- return true; // no need to check further when there is no drawing yet
1748
- }
1749
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1750
- // @ts-ignore
1751
- const {
1752
- coordinates,
1753
- type
1754
- } = geojson.features[0].geometry;
1755
- // For type POLYGON only one array of coordinates is allowed
1756
- if (type === 'Polygon' && coordinates.length > 1) {
1757
- return false;
1758
- }
1759
- return true;
1760
- };
1761
- const hasIntersectionWithFIR = (geojson, intersection) => {
1762
- if (!hasValidGeometry(geojson) ||
1763
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1764
- // @ts-ignore
1765
- !geojson.features[0].geometry.coordinates.length || geojson.features[0].geometry.type === 'Polygon' && !geojson.features[0].geometry.coordinates[0].length) {
1766
- return true; // no need to check further when there is no drawing yet
1767
- }
1768
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1769
- // @ts-ignore
1770
- const {
1771
- coordinates,
1772
- type
1773
- } = intersection.features[0].geometry;
1774
- if (type === 'Point' && coordinates.length === 0) {
1775
- return false;
1776
- }
1777
- if (type !== 'Point' && coordinates.length > 0 && coordinates[0].length === 0) {
1778
- return false;
1779
- }
1780
- return true;
1781
- };
1782
- const hasMulitpleIntersections = geojson => {
1783
- const hasGeometry = hasValidGeometry(geojson);
1784
- if (!hasGeometry) {
1785
- return false;
1786
- }
1787
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1788
- // @ts-ignore
1789
- const {
1790
- coordinates,
1791
- type
1792
- } = geojson.features[0].geometry;
1793
- if (type === 'MultiPolygon' || coordinates.length > 1 && type !== 'Point') {
1794
- return true;
1795
- }
1796
- return false;
1797
- };
1798
- const isGeometryDirty = (geoJSON, formGeoJSON) => {
1799
- if (geoJSON === (undefined) || formGeoJSON === (undefined) || !hasValidGeometry(geoJSON) || !hasValidGeometry(formGeoJSON)) {
1800
- return false;
1801
- }
1802
- return !isEqual(
1803
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1804
- // @ts-ignore
1805
- geoJSON.features[0].geometry.coordinates,
1806
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1807
- // @ts-ignore
1808
- formGeoJSON.features[0].geometry.coordinates);
1809
- };
1810
- const isInteger = value => {
1811
- if (isEmpty(value)) {
1812
- return true;
1813
- }
1814
- return Number.isInteger(value);
1815
- };
1816
- const isNonOrBothCoordinates = (coordinate, otherCoordinate) => {
1817
- if (typeof coordinate === 'number' && typeof otherCoordinate === 'number' || coordinate === null && otherCoordinate === null || coordinate === undefined && otherCoordinate === undefined) {
1818
- return true;
1819
- }
1820
- if (typeof coordinate === 'number') {
1821
- return true;
1822
- }
1823
- return false;
1824
- };
1825
-
1826
- const radioCheckboxStyle = {
1827
- // hides unchecked values
1828
- display: 'none',
1829
- '&+.MuiFormControlLabel-label': {
1830
- display: 'none'
1831
- },
1832
- // shows checked value
1833
- '&.Mui-checked': {
1834
- display: 'inherit',
1835
- '&+.MuiFormControlLabel-label': {
1836
- display: 'inherit'
1837
- }
1838
- },
1839
- '&.Mui-checked+.MuiFormControlLabel-label': {
1840
- color: 'geowebColors.typographyAndIcons.text'
1841
- },
1842
- '&.Mui-disabled.Mui-checked': {
1843
- color: 'geowebColors.typographyAndIcons.iconLinkActive'
1844
- }
1845
- };
1846
- const getErrorMessage = errors => {
1847
- if (errors && errors.message && typeof errors.message === 'string') {
1848
- return errors.message;
1849
- }
1850
- if (errors && errors.type && typeof errors.type === 'string') {
1851
- return errorMessages[errors.type];
1852
- }
1853
- return '';
1854
- };
1855
- const ReactHookFormFormControl = _a => {
1856
- var {
1857
- children,
1858
- errors,
1859
- isReadOnly,
1860
- sx = {},
1861
- className = '',
1862
- size = 'medium'
1863
- } = _a,
1864
- props = __rest(_a, ["children", "errors", "isReadOnly", "sx", "className", "size"]);
1865
- return jsxs(FormControl, Object.assign({
1866
- fullWidth: true,
1867
- error: !!errors,
1868
- className: `${isReadOnly ? 'is-read-only' : ''} ${className}`,
1869
- size: size,
1870
- sx: Object.assign(Object.assign({}, isReadOnly && {
1871
- // Radio input
1872
- '.MuiRadio-root': radioCheckboxStyle,
1873
- // Checkbox input
1874
- '.MuiCheckbox-root': radioCheckboxStyle,
1875
- // Select input
1876
- '.MuiSelect-select.Mui-disabled': {
1877
- color: 'geowebColors.typographyAndIcons.text',
1878
- WebkitTextFillColor: 'inherit',
1879
- '&:before': {
1880
- borderColor: 'transparent'
1881
- }
1882
- },
1883
- '.MuiSelect-nativeInput+.MuiSvgIcon-root': {
1884
- display: 'none'
1885
- },
1886
- '.Mui-disabled:before': {
1887
- border: 'transparent'
1888
- }
1889
- }), sx)
1890
- }, props, {
1891
- children: [children, errors && jsx(FormHelperText, Object.assign({
1892
- variant: "filled",
1893
- role: "alert"
1894
- }, {
1895
- children: getErrorMessage(errors)
1896
- }))]
1897
- }));
1726
+
1727
+ var stringTrim = {
1728
+ // `String.prototype.{ trimLeft, trimStart }` methods
1729
+ // https://tc39.es/ecma262/#sec-string.prototype.trimstart
1730
+ start: createMethod$2(1),
1731
+ // `String.prototype.{ trimRight, trimEnd }` methods
1732
+ // https://tc39.es/ecma262/#sec-string.prototype.trimend
1733
+ end: createMethod$2(2),
1734
+ // `String.prototype.trim` method
1735
+ // https://tc39.es/ecma262/#sec-string.prototype.trim
1736
+ trim: createMethod$2(3)
1898
1737
  };
1899
1738
 
1900
- var aCallable$1 = aCallable$3;
1901
- var toObject$1 = toObject$4;
1902
- var IndexedObject = indexedObject;
1903
- var lengthOfArrayLike = lengthOfArrayLike$2;
1739
+ var global$7 = global$h;
1740
+ var fails$9 = fails$l;
1741
+ var uncurryThis$4 = functionUncurryThis;
1742
+ var toString$6 = toString$8;
1743
+ var trim$1 = stringTrim.trim;
1744
+ var whitespaces$2 = whitespaces$4;
1904
1745
 
1905
- var $TypeError$3 = TypeError;
1746
+ var charAt$3 = uncurryThis$4(''.charAt);
1747
+ var $parseFloat$1 = global$7.parseFloat;
1748
+ var Symbol$2 = global$7.Symbol;
1749
+ var ITERATOR$2 = Symbol$2 && Symbol$2.iterator;
1750
+ var FORCED$2 = 1 / $parseFloat$1(whitespaces$2 + '-0') !== -Infinity
1751
+ // MS Edge 18- broken with boxed symbols
1752
+ || (ITERATOR$2 && !fails$9(function () { $parseFloat$1(Object(ITERATOR$2)); }));
1906
1753
 
1907
- var REDUCE_EMPTY = 'Reduce of empty array with no initial value';
1754
+ // `parseFloat` method
1755
+ // https://tc39.es/ecma262/#sec-parsefloat-string
1756
+ var numberParseFloat = FORCED$2 ? function parseFloat(string) {
1757
+ var trimmedString = trim$1(toString$6(string));
1758
+ var result = $parseFloat$1(trimmedString);
1759
+ return result === 0 && charAt$3(trimmedString, 0) === '-' ? -0 : result;
1760
+ } : $parseFloat$1;
1908
1761
 
1909
- // `Array.prototype.{ reduce, reduceRight }` methods implementation
1910
- var createMethod$1 = function (IS_RIGHT) {
1911
- return function (that, callbackfn, argumentsLength, memo) {
1912
- var O = toObject$1(that);
1913
- var self = IndexedObject(O);
1914
- var length = lengthOfArrayLike(O);
1915
- aCallable$1(callbackfn);
1916
- if (length === 0 && argumentsLength < 2) throw new $TypeError$3(REDUCE_EMPTY);
1917
- var index = IS_RIGHT ? length - 1 : 0;
1918
- var i = IS_RIGHT ? -1 : 1;
1919
- if (argumentsLength < 2) while (true) {
1920
- if (index in self) {
1921
- memo = self[index];
1922
- index += i;
1923
- break;
1924
- }
1925
- index += i;
1926
- if (IS_RIGHT ? index < 0 : length <= index) {
1927
- throw new $TypeError$3(REDUCE_EMPTY);
1928
- }
1929
- }
1930
- for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
1931
- memo = callbackfn(memo, self[index], index, O);
1932
- }
1933
- return memo;
1934
- };
1935
- };
1762
+ var $$7 = _export;
1763
+ var $parseFloat = numberParseFloat;
1936
1764
 
1937
- var arrayReduce = {
1938
- // `Array.prototype.reduce` method
1939
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
1940
- left: createMethod$1(false),
1941
- // `Array.prototype.reduceRight` method
1942
- // https://tc39.es/ecma262/#sec-array.prototype.reduceright
1943
- right: createMethod$1(true)
1944
- };
1765
+ // `parseFloat` method
1766
+ // https://tc39.es/ecma262/#sec-parsefloat-string
1767
+ $$7({ global: true, forced: parseFloat !== $parseFloat }, {
1768
+ parseFloat: $parseFloat
1769
+ });
1945
1770
 
1946
- var fails$5 = fails$l;
1771
+ var anObject$4 = anObject$9;
1947
1772
 
1948
- var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
1949
- var method = [][METHOD_NAME];
1950
- return !!method && fails$5(function () {
1951
- // eslint-disable-next-line no-useless-call -- required for testing
1952
- method.call(null, argument || function () { return 1; }, 1);
1953
- });
1773
+ // `RegExp.prototype.flags` getter implementation
1774
+ // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
1775
+ var regexpFlags$1 = function () {
1776
+ var that = anObject$4(this);
1777
+ var result = '';
1778
+ if (that.hasIndices) result += 'd';
1779
+ if (that.global) result += 'g';
1780
+ if (that.ignoreCase) result += 'i';
1781
+ if (that.multiline) result += 'm';
1782
+ if (that.dotAll) result += 's';
1783
+ if (that.unicode) result += 'u';
1784
+ if (that.unicodeSets) result += 'v';
1785
+ if (that.sticky) result += 'y';
1786
+ return result;
1954
1787
  };
1955
1788
 
1956
- var global$3 = global$h;
1957
- var classof$2 = classofRaw$1;
1789
+ var fails$8 = fails$l;
1790
+ var global$6 = global$h;
1958
1791
 
1959
- var engineIsNode = classof$2(global$3.process) === 'process';
1792
+ // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
1793
+ var $RegExp$2 = global$6.RegExp;
1960
1794
 
1961
- var $$4 = _export;
1962
- var $reduce = arrayReduce.left;
1963
- var arrayMethodIsStrict = arrayMethodIsStrict$1;
1964
- var CHROME_VERSION = engineV8Version;
1965
- var IS_NODE = engineIsNode;
1795
+ var UNSUPPORTED_Y$1 = fails$8(function () {
1796
+ var re = $RegExp$2('a', 'y');
1797
+ re.lastIndex = 2;
1798
+ return re.exec('abcd') !== null;
1799
+ });
1966
1800
 
1967
- // Chrome 80-82 has a critical bug
1968
- // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
1969
- var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
1970
- var FORCED$1 = CHROME_BUG || !arrayMethodIsStrict('reduce');
1801
+ // UC Browser bug
1802
+ // https://github.com/zloirock/core-js/issues/1008
1803
+ var MISSED_STICKY = UNSUPPORTED_Y$1 || fails$8(function () {
1804
+ return !$RegExp$2('a', 'y').sticky;
1805
+ });
1971
1806
 
1972
- // `Array.prototype.reduce` method
1973
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
1974
- $$4({ target: 'Array', proto: true, forced: FORCED$1 }, {
1975
- reduce: function reduce(callbackfn /* , initialValue */) {
1976
- var length = arguments.length;
1977
- return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
1978
- }
1807
+ var BROKEN_CARET = UNSUPPORTED_Y$1 || fails$8(function () {
1808
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
1809
+ var re = $RegExp$2('^r', 'gy');
1810
+ re.lastIndex = 2;
1811
+ return re.exec('str') !== null;
1979
1812
  });
1980
1813
 
1981
- function getDeepProperty(p, o) {
1982
- return p.reduce((xs, x) => xs && xs[x] ? xs[x] : null, o);
1983
- }
1984
- const getErrors = (name, errors) => {
1985
- const nameAsArray = name.split('.');
1986
- return getDeepProperty(nameAsArray, errors);
1814
+ var regexpStickyHelpers = {
1815
+ BROKEN_CARET: BROKEN_CARET,
1816
+ MISSED_STICKY: MISSED_STICKY,
1817
+ UNSUPPORTED_Y: UNSUPPORTED_Y$1
1987
1818
  };
1988
1819
 
1989
- const ReactHookFormSelect = _a => {
1990
- var {
1991
- name,
1992
- label,
1993
- defaultValue = '',
1994
- children,
1995
- rules,
1996
- onChange = () => {},
1997
- disabled,
1998
- className,
1999
- sx,
2000
- isReadOnly,
2001
- size = 'medium'
2002
- } = _a,
2003
- otherProps = __rest(_a, ["name", "label", "defaultValue", "children", "rules", "onChange", "disabled", "className", "sx", "isReadOnly", "size"]);
2004
- const labelId = `${name}-label`;
2005
- const {
2006
- control
2007
- } = useFormContext();
2008
- const {
2009
- field: {
2010
- onChange: onChangeField,
2011
- value,
2012
- ref
2013
- },
2014
- formState: {
2015
- errors: formErrors
1820
+ var fails$7 = fails$l;
1821
+ var global$5 = global$h;
1822
+
1823
+ // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
1824
+ var $RegExp$1 = global$5.RegExp;
1825
+
1826
+ var regexpUnsupportedDotAll = fails$7(function () {
1827
+ var re = $RegExp$1('.', 's');
1828
+ return !(re.dotAll && re.test('\n') && re.flags === 's');
1829
+ });
1830
+
1831
+ var fails$6 = fails$l;
1832
+ var global$4 = global$h;
1833
+
1834
+ // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
1835
+ var $RegExp = global$4.RegExp;
1836
+
1837
+ var regexpUnsupportedNcg = fails$6(function () {
1838
+ var re = $RegExp('(?<a>b)', 'g');
1839
+ return re.exec('b').groups.a !== 'b' ||
1840
+ 'b'.replace(re, '$<a>c') !== 'bc';
1841
+ });
1842
+
1843
+ /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
1844
+ /* eslint-disable regexp/no-useless-quantifier -- testing */
1845
+ var call$5 = functionCall;
1846
+ var uncurryThis$3 = functionUncurryThis;
1847
+ var toString$5 = toString$8;
1848
+ var regexpFlags = regexpFlags$1;
1849
+ var stickyHelpers = regexpStickyHelpers;
1850
+ var shared = shared$4;
1851
+ var create = objectCreate;
1852
+ var getInternalState = internalState.get;
1853
+ var UNSUPPORTED_DOT_ALL = regexpUnsupportedDotAll;
1854
+ var UNSUPPORTED_NCG = regexpUnsupportedNcg;
1855
+
1856
+ var nativeReplace = shared('native-string-replace', String.prototype.replace);
1857
+ var nativeExec = RegExp.prototype.exec;
1858
+ var patchedExec = nativeExec;
1859
+ var charAt$2 = uncurryThis$3(''.charAt);
1860
+ var indexOf = uncurryThis$3(''.indexOf);
1861
+ var replace = uncurryThis$3(''.replace);
1862
+ var stringSlice$1 = uncurryThis$3(''.slice);
1863
+
1864
+ var UPDATES_LAST_INDEX_WRONG = (function () {
1865
+ var re1 = /a/;
1866
+ var re2 = /b*/g;
1867
+ call$5(nativeExec, re1, 'a');
1868
+ call$5(nativeExec, re2, 'a');
1869
+ return re1.lastIndex !== 0 || re2.lastIndex !== 0;
1870
+ })();
1871
+
1872
+ var UNSUPPORTED_Y = stickyHelpers.BROKEN_CARET;
1873
+
1874
+ // nonparticipating capturing group, copied from es5-shim's String#split patch.
1875
+ var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
1876
+
1877
+ var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;
1878
+
1879
+ if (PATCH) {
1880
+ patchedExec = function exec(string) {
1881
+ var re = this;
1882
+ var state = getInternalState(re);
1883
+ var str = toString$5(string);
1884
+ var raw = state.raw;
1885
+ var result, reCopy, lastIndex, match, i, object, group;
1886
+
1887
+ if (raw) {
1888
+ raw.lastIndex = re.lastIndex;
1889
+ result = call$5(patchedExec, raw, str);
1890
+ re.lastIndex = raw.lastIndex;
1891
+ return result;
2016
1892
  }
2017
- } = useController(Object.assign({
2018
- name,
2019
- control,
2020
- rules,
2021
- defaultValue
2022
- }, defaultProps));
2023
- const errors = getErrors(name, formErrors);
2024
- return jsxs(ReactHookFormFormControl, Object.assign({
2025
- className: className,
2026
- sx: sx,
2027
- disabled: disabled,
2028
- errors: errors,
2029
- isReadOnly: isReadOnly,
2030
- size: size
2031
- }, {
2032
- children: [jsx(InputLabel, Object.assign({
2033
- variant: "filled",
2034
- id: labelId
2035
- }, {
2036
- children: label
2037
- })), jsx(Select, Object.assign({
2038
- labelId: labelId,
2039
- label: label,
2040
- inputRef: ref,
2041
- name: name,
2042
- onChange: changeEvent => {
2043
- onChangeField(changeEvent.target.value);
2044
- // default props
2045
- onChange(changeEvent);
2046
- },
2047
- value: value || '',
2048
- variant: "filled"
2049
- }, otherProps, {
2050
- children: children
2051
- }))]
2052
- }));
1893
+
1894
+ var groups = state.groups;
1895
+ var sticky = UNSUPPORTED_Y && re.sticky;
1896
+ var flags = call$5(regexpFlags, re);
1897
+ var source = re.source;
1898
+ var charsAdded = 0;
1899
+ var strCopy = str;
1900
+
1901
+ if (sticky) {
1902
+ flags = replace(flags, 'y', '');
1903
+ if (indexOf(flags, 'g') === -1) {
1904
+ flags += 'g';
1905
+ }
1906
+
1907
+ strCopy = stringSlice$1(str, re.lastIndex);
1908
+ // Support anchored sticky behavior.
1909
+ if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$2(str, re.lastIndex - 1) !== '\n')) {
1910
+ source = '(?: ' + source + ')';
1911
+ strCopy = ' ' + strCopy;
1912
+ charsAdded++;
1913
+ }
1914
+ // ^(? + rx + ) is needed, in combination with some str slicing, to
1915
+ // simulate the 'y' flag.
1916
+ reCopy = new RegExp('^(?:' + source + ')', flags);
1917
+ }
1918
+
1919
+ if (NPCG_INCLUDED) {
1920
+ reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
1921
+ }
1922
+ if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
1923
+
1924
+ match = call$5(nativeExec, sticky ? reCopy : re, strCopy);
1925
+
1926
+ if (sticky) {
1927
+ if (match) {
1928
+ match.input = stringSlice$1(match.input, charsAdded);
1929
+ match[0] = stringSlice$1(match[0], charsAdded);
1930
+ match.index = re.lastIndex;
1931
+ re.lastIndex += match[0].length;
1932
+ } else re.lastIndex = 0;
1933
+ } else if (UPDATES_LAST_INDEX_WRONG && match) {
1934
+ re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
1935
+ }
1936
+ if (NPCG_INCLUDED && match && match.length > 1) {
1937
+ // Fix browsers whose `exec` methods don't consistently return `undefined`
1938
+ // for NPCG, like IE8. NOTE: This doesn't work for /(.?)?/
1939
+ call$5(nativeReplace, match[0], reCopy, function () {
1940
+ for (i = 1; i < arguments.length - 2; i++) {
1941
+ if (arguments[i] === undefined) match[i] = undefined;
1942
+ }
1943
+ });
1944
+ }
1945
+
1946
+ if (match && groups) {
1947
+ match.groups = object = create(null);
1948
+ for (i = 0; i < groups.length; i++) {
1949
+ group = groups[i];
1950
+ object[group[0]] = match[group[1]];
1951
+ }
1952
+ }
1953
+
1954
+ return match;
1955
+ };
1956
+ }
1957
+
1958
+ var regexpExec$2 = patchedExec;
1959
+
1960
+ var $$6 = _export;
1961
+ var exec$1 = regexpExec$2;
1962
+
1963
+ // `RegExp.prototype.exec` method
1964
+ // https://tc39.es/ecma262/#sec-regexp.prototype.exec
1965
+ $$6({ target: 'RegExp', proto: true, forced: /./.exec !== exec$1 }, {
1966
+ exec: exec$1
1967
+ });
1968
+
1969
+ // TODO: Remove from `core-js@4` since it's moved to entry points
1970
+
1971
+ var $$5 = _export;
1972
+ var call$4 = functionCall;
1973
+ var isCallable$1 = isCallable$g;
1974
+ var anObject$3 = anObject$9;
1975
+ var toString$4 = toString$8;
1976
+
1977
+ var DELEGATES_TO_EXEC = function () {
1978
+ var execCalled = false;
1979
+ var re = /[ac]/;
1980
+ re.exec = function () {
1981
+ execCalled = true;
1982
+ return /./.exec.apply(this, arguments);
1983
+ };
1984
+ return re.test('abc') === true && execCalled;
1985
+ }();
1986
+
1987
+ var nativeTest = /./.test;
1988
+
1989
+ // `RegExp.prototype.test` method
1990
+ // https://tc39.es/ecma262/#sec-regexp.prototype.test
1991
+ $$5({ target: 'RegExp', proto: true, forced: !DELEGATES_TO_EXEC }, {
1992
+ test: function (S) {
1993
+ var R = anObject$3(this);
1994
+ var string = toString$4(S);
1995
+ var exec = R.exec;
1996
+ if (!isCallable$1(exec)) return call$4(nativeTest, R, string);
1997
+ var result = call$4(exec, R, string);
1998
+ if (result === null) return false;
1999
+ anObject$3(result);
2000
+ return true;
2001
+ }
2002
+ });
2003
+
2004
+ var call$3 = functionCall;
2005
+ var hasOwn = hasOwnProperty_1;
2006
+ var isPrototypeOf = objectIsPrototypeOf;
2007
+ var regExpFlags = regexpFlags$1;
2008
+
2009
+ var RegExpPrototype$2 = RegExp.prototype;
2010
+
2011
+ var regexpGetFlags = function (R) {
2012
+ var flags = R.flags;
2013
+ return flags === undefined && !('flags' in RegExpPrototype$2) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype$2, R)
2014
+ ? call$3(regExpFlags, R) : flags;
2053
2015
  };
2054
2016
 
2055
- const ReactHookFormRadioGroup = _a => {
2056
- var {
2057
- name,
2058
- label,
2059
- defaultValue = '',
2060
- children,
2061
- rules,
2062
- disabled = false,
2063
- onChange = () => {},
2064
- isReadOnly
2065
- } = _a,
2066
- otherProps = __rest(_a, ["name", "label", "defaultValue", "children", "rules", "disabled", "onChange", "isReadOnly"]);
2067
- const labelId = `${name}-label`;
2068
- const {
2069
- control
2070
- } = useFormContext();
2071
- const {
2072
- field: {
2073
- onChange: onChangeField,
2074
- value,
2075
- ref
2076
- },
2077
- formState: {
2078
- errors: formErrors
2017
+ var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
2018
+ var defineBuiltIn$1 = defineBuiltIn$5;
2019
+ var anObject$2 = anObject$9;
2020
+ var $toString = toString$8;
2021
+ var fails$5 = fails$l;
2022
+ var getRegExpFlags = regexpGetFlags;
2023
+
2024
+ var TO_STRING = 'toString';
2025
+ var RegExpPrototype$1 = RegExp.prototype;
2026
+ var nativeToString = RegExpPrototype$1[TO_STRING];
2027
+
2028
+ var NOT_GENERIC = fails$5(function () { return nativeToString.call({ source: 'a', flags: 'b' }) !== '/a/b'; });
2029
+ // FF44- RegExp#toString has a wrong name
2030
+ var INCORRECT_NAME = PROPER_FUNCTION_NAME$1 && nativeToString.name !== TO_STRING;
2031
+
2032
+ // `RegExp.prototype.toString` method
2033
+ // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
2034
+ if (NOT_GENERIC || INCORRECT_NAME) {
2035
+ defineBuiltIn$1(RegExpPrototype$1, TO_STRING, function toString() {
2036
+ var R = anObject$2(this);
2037
+ var pattern = $toString(R.source);
2038
+ var flags = $toString(getRegExpFlags(R));
2039
+ return '/' + pattern + '/' + flags;
2040
+ }, { unsafe: true });
2041
+ }
2042
+
2043
+ var PROPER_FUNCTION_NAME = functionName.PROPER;
2044
+ var fails$4 = fails$l;
2045
+ var whitespaces$1 = whitespaces$4;
2046
+
2047
+ var non = '\u200B\u0085\u180E';
2048
+
2049
+ // check that a method works with the correct list
2050
+ // of whitespaces and has a correct name
2051
+ var stringTrimForced = function (METHOD_NAME) {
2052
+ return fails$4(function () {
2053
+ return !!whitespaces$1[METHOD_NAME]()
2054
+ || non[METHOD_NAME]() !== non
2055
+ || (PROPER_FUNCTION_NAME && whitespaces$1[METHOD_NAME].name !== METHOD_NAME);
2056
+ });
2057
+ };
2058
+
2059
+ var $$4 = _export;
2060
+ var $trim = stringTrim.trim;
2061
+ var forcedStringTrimMethod = stringTrimForced;
2062
+
2063
+ // `String.prototype.trim` method
2064
+ // https://tc39.es/ecma262/#sec-string.prototype.trim
2065
+ $$4({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
2066
+ trim: function trim() {
2067
+ return $trim(this);
2068
+ }
2069
+ });
2070
+
2071
+ // iterable DOM collections
2072
+ // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
2073
+ var domIterables = {
2074
+ CSSRuleList: 0,
2075
+ CSSStyleDeclaration: 0,
2076
+ CSSValueList: 0,
2077
+ ClientRectList: 0,
2078
+ DOMRectList: 0,
2079
+ DOMStringList: 0,
2080
+ DOMTokenList: 1,
2081
+ DataTransferItemList: 0,
2082
+ FileList: 0,
2083
+ HTMLAllCollection: 0,
2084
+ HTMLCollection: 0,
2085
+ HTMLFormElement: 0,
2086
+ HTMLSelectElement: 0,
2087
+ MediaList: 0,
2088
+ MimeTypeArray: 0,
2089
+ NamedNodeMap: 0,
2090
+ NodeList: 1,
2091
+ PaintRequestList: 0,
2092
+ Plugin: 0,
2093
+ PluginArray: 0,
2094
+ SVGLengthList: 0,
2095
+ SVGNumberList: 0,
2096
+ SVGPathSegList: 0,
2097
+ SVGPointList: 0,
2098
+ SVGStringList: 0,
2099
+ SVGTransformList: 0,
2100
+ SourceBufferList: 0,
2101
+ StyleSheetList: 0,
2102
+ TextTrackCueList: 0,
2103
+ TextTrackList: 0,
2104
+ TouchList: 0
2105
+ };
2106
+
2107
+ // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
2108
+ var documentCreateElement = documentCreateElement$2;
2109
+
2110
+ var classList = documentCreateElement('span').classList;
2111
+ var DOMTokenListPrototype$1 = classList && classList.constructor && classList.constructor.prototype;
2112
+
2113
+ var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
2114
+
2115
+ var global$3 = global$h;
2116
+ var DOMIterables = domIterables;
2117
+ var DOMTokenListPrototype = domTokenListPrototype;
2118
+ var ArrayIteratorMethods = es_array_iterator;
2119
+ var createNonEnumerableProperty$1 = createNonEnumerableProperty$5;
2120
+ var setToStringTag = setToStringTag$3;
2121
+ var wellKnownSymbol$3 = wellKnownSymbol$b;
2122
+
2123
+ var ITERATOR$1 = wellKnownSymbol$3('iterator');
2124
+ var ArrayValues = ArrayIteratorMethods.values;
2125
+
2126
+ var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
2127
+ if (CollectionPrototype) {
2128
+ // some Chrome versions have non-configurable methods on DOMTokenList
2129
+ if (CollectionPrototype[ITERATOR$1] !== ArrayValues) try {
2130
+ createNonEnumerableProperty$1(CollectionPrototype, ITERATOR$1, ArrayValues);
2131
+ } catch (error) {
2132
+ CollectionPrototype[ITERATOR$1] = ArrayValues;
2079
2133
  }
2080
- } = useController(Object.assign({
2081
- name,
2082
- control,
2083
- rules,
2084
- defaultValue
2085
- }, defaultProps));
2086
- const errors = getErrors(name, formErrors);
2087
- React.useEffect(() => {
2088
- if (errors) {
2089
- const firstError = Object.keys(formErrors)[0];
2090
- if (firstError === name) {
2091
- // if first error in form is same, focus on that input
2092
- const inputNode = document.querySelector(`[name="${name}"]`);
2093
- if (inputNode !== null) {
2094
- inputNode.focus();
2095
- }
2134
+ setToStringTag(CollectionPrototype, COLLECTION_NAME, true);
2135
+ if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
2136
+ // some Chrome versions have non-configurable methods on DOMTokenList
2137
+ if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
2138
+ createNonEnumerableProperty$1(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
2139
+ } catch (error) {
2140
+ CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
2096
2141
  }
2097
2142
  }
2098
- }, [errors, formErrors, name]);
2099
- return jsxs(ReactHookFormFormControl, Object.assign({
2100
- disabled: disabled,
2101
- errors: errors,
2102
- isReadOnly: isReadOnly
2103
- }, {
2104
- children: [jsx(InputLabel, Object.assign({
2105
- id: labelId
2106
- }, {
2107
- children: label
2108
- })), jsx(RadioGroup, Object.assign({
2109
- value: value,
2110
- onChange: changeEvent => {
2111
- onChangeField(changeEvent.target.value);
2112
- onChange(changeEvent, changeEvent.target.value);
2113
- },
2114
- ref: ref,
2115
- name: name
2116
- }, otherProps, {
2117
- children: children
2118
- }))]
2119
- }));
2143
+ }
2120
2144
  };
2121
2145
 
2122
- const convertTextInputValue = (value, inCapitals) => {
2123
- return inCapitals ? value.toUpperCase() : value;
2146
+ for (var COLLECTION_NAME in DOMIterables) {
2147
+ handlePrototype(global$3[COLLECTION_NAME] && global$3[COLLECTION_NAME].prototype, COLLECTION_NAME);
2148
+ }
2149
+
2150
+ handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
2151
+
2152
+ const defaultProps = {
2153
+ shouldUnregister: false
2124
2154
  };
2125
- const ReactHookFormTextField = _a => {
2126
- var {
2127
- name,
2128
- label,
2129
- defaultValue = '',
2130
- rules,
2131
- disabled = false,
2132
- upperCase = false,
2133
- helperText = '',
2134
- className,
2135
- sx,
2136
- onChange = () => {},
2137
- isReadOnly,
2138
- InputProps
2139
- } = _a,
2140
- otherProps = __rest(_a, ["name", "label", "defaultValue", "rules", "disabled", "upperCase", "helperText", "className", "sx", "onChange", "isReadOnly", "InputProps"]);
2155
+ const errorMessages = {
2156
+ required: 'form-fields-error-required',
2157
+ isValidDate: 'form-fields-error-date-valid',
2158
+ isAfter: 'form-fields-error-date-after',
2159
+ isXHoursBefore: 'form-fields-error-date-hours-before',
2160
+ isXHoursAfter: 'form-fields-error-date-hours-after',
2161
+ isBefore: 'form-fields-error-date-before',
2162
+ minLevel: 'form-fields-error-min-level',
2163
+ isLatitude: 'form-fields-error-latitude',
2164
+ isLongitude: 'form-fields-error-longitude',
2165
+ isValidMax: 'form-fields-error-valid-max',
2166
+ isLevelLower: 'form-fields-error-level-lower',
2167
+ isNonOrBothCoordinates: 'form-fields-error-non-or-both-cooordinate',
2168
+ isInteger: 'form-fields-error-integer',
2169
+ isNumeric: 'form-fields-error-numeric'
2170
+ };
2171
+ const regexMaxTwoDecimals = /^\s*-?\d+(\.\d{1,2})?\s*$/;
2172
+ // validations
2173
+ const isEmpty = value => {
2174
+ if (typeof value === 'string' && !value.trim().length || value === null || value === undefined) {
2175
+ return true;
2176
+ }
2177
+ return false;
2178
+ };
2179
+ const isXHoursBefore = (ownDate, otherDate, hours = 4) => {
2180
+ if (isEmpty(ownDate) || isEmpty(otherDate)) {
2181
+ return true;
2182
+ }
2183
+ const duration = dateUtils.differenceInHours(dateUtils.utc(otherDate), dateUtils.utc(ownDate), 'ceil');
2184
+ return duration <= hours;
2185
+ };
2186
+ const isXHoursAfter = (ownDate, otherDate, hours = 4) => {
2187
+ if (isEmpty(ownDate) || isEmpty(otherDate)) {
2188
+ return true;
2189
+ }
2190
+ const duration = dateUtils.differenceInHours(dateUtils.utc(ownDate), dateUtils.utc(otherDate), 'ceil');
2191
+ return duration <= hours;
2192
+ };
2193
+ const isLatitude = lat => {
2194
+ if (!lat) {
2195
+ return true;
2196
+ }
2197
+ return isFinite(lat) && Math.abs(lat) <= 90 && regexMaxTwoDecimals.test(lat.toString());
2198
+ };
2199
+ const isLongitude = lng => {
2200
+ if (!lng) {
2201
+ return true;
2202
+ }
2203
+ return isFinite(lng) && Math.abs(lng) <= 180 && lng >= -180 && regexMaxTwoDecimals.test(lng.toString());
2204
+ };
2205
+ // Pass null if no maxValue
2206
+ const isValidMax = (value, maxValue) => {
2207
+ if (isEmpty(value) || maxValue === null) {
2208
+ return true;
2209
+ }
2210
+ return !(value > maxValue);
2211
+ };
2212
+ // Pass null if no minValue
2213
+ const isValidMin = (value, minValue) => {
2214
+ if (isEmpty(value) || minValue === null) {
2215
+ return true;
2216
+ }
2217
+ return !(value < minValue);
2218
+ };
2219
+ const hasValidGeometry = geojson => {
2220
+ if (!geojson || !geojson.features || !geojson.features.length || !geojson.features[0].geometry ||
2221
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2222
+ // @ts-ignore
2223
+ !geojson.features[0].geometry.coordinates || !geojson.features[0].geometry.type) {
2224
+ return false;
2225
+ }
2226
+ return true;
2227
+ };
2228
+ const isValidGeoJsonCoordinates = geojson => {
2229
+ const hasGeometry = hasValidGeometry(geojson);
2230
+ if (!hasGeometry) {
2231
+ return false;
2232
+ }
2233
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2234
+ // @ts-ignore
2141
2235
  const {
2142
- control
2143
- } = useFormContext();
2236
+ coordinates,
2237
+ type
2238
+ } = geojson.features[0].geometry;
2239
+ // For type POINT coordinates is an array of 2
2240
+ if (coordinates.length === 2 && type === 'Point') {
2241
+ return true;
2242
+ }
2243
+ // For type POLYGON coordinates is an array of arrays
2244
+ if (coordinates.length === 1 && coordinates[0].length > 0 && type === 'Polygon') {
2245
+ return true;
2246
+ }
2247
+ return false;
2248
+ };
2249
+ const isMaximumOneDrawing = geojson => {
2250
+ const hasGeometry = hasValidGeometry(geojson);
2251
+ if (!hasGeometry) {
2252
+ return true; // no need to check further when there is no drawing yet
2253
+ }
2254
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2255
+ // @ts-ignore
2144
2256
  const {
2145
- field: {
2146
- onChange: onChangeField,
2147
- value,
2148
- ref
2149
- },
2150
- formState: {
2151
- errors: formErrors
2152
- }
2153
- } = useController(Object.assign({
2154
- name,
2155
- control,
2156
- rules,
2157
- defaultValue
2158
- }, defaultProps));
2159
- const errors = getErrors(name, formErrors);
2160
- return jsx(ReactHookFormFormControl, Object.assign({
2161
- className: className,
2162
- sx: sx,
2163
- disabled: disabled,
2164
- errors: errors,
2165
- isReadOnly: isReadOnly
2166
- }, {
2167
- children: jsx(TextField, Object.assign({
2168
- label: label,
2169
- error: !!errors,
2170
- helperText: helperText,
2171
- value: value,
2172
- variant: "filled",
2173
- type: "text",
2174
- name: name,
2175
- onChange: evt => {
2176
- const {
2177
- value
2178
- } = evt.target;
2179
- const convertedValue = convertTextInputValue(value, upperCase);
2180
- onChangeField(convertedValue);
2181
- onChange(null);
2182
- },
2183
- disabled: disabled,
2184
- inputRef: ref,
2185
- InputProps: Object.assign(Object.assign({}, InputProps), isReadOnly && {
2186
- readOnly: true
2187
- })
2188
- }, otherProps))
2189
- }));
2257
+ coordinates,
2258
+ type
2259
+ } = geojson.features[0].geometry;
2260
+ // For type POLYGON only one array of coordinates is allowed
2261
+ if (type === 'Polygon' && coordinates.length > 1) {
2262
+ return false;
2263
+ }
2264
+ return true;
2265
+ };
2266
+ const hasIntersectionWithFIR = (geojson, intersection) => {
2267
+ if (!hasValidGeometry(geojson) ||
2268
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2269
+ // @ts-ignore
2270
+ !geojson.features[0].geometry.coordinates.length || geojson.features[0].geometry.type === 'Polygon' && !geojson.features[0].geometry.coordinates[0].length) {
2271
+ return true; // no need to check further when there is no drawing yet
2272
+ }
2273
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2274
+ // @ts-ignore
2275
+ const {
2276
+ coordinates,
2277
+ type
2278
+ } = intersection.features[0].geometry;
2279
+ if (type === 'Point' && coordinates.length === 0) {
2280
+ return false;
2281
+ }
2282
+ if (type !== 'Point' && coordinates.length > 0 && coordinates[0].length === 0) {
2283
+ return false;
2284
+ }
2285
+ return true;
2190
2286
  };
2191
-
2192
- var wellKnownSymbol$7 = wellKnownSymbol$b;
2193
- var create$1 = objectCreate;
2194
- var defineProperty$2 = objectDefineProperty.f;
2195
-
2196
- var UNSCOPABLES = wellKnownSymbol$7('unscopables');
2197
- var ArrayPrototype = Array.prototype;
2198
-
2199
- // Array.prototype[@@unscopables]
2200
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
2201
- if (ArrayPrototype[UNSCOPABLES] === undefined) {
2202
- defineProperty$2(ArrayPrototype, UNSCOPABLES, {
2203
- configurable: true,
2204
- value: create$1(null)
2287
+ const hasMulitpleIntersections = geojson => {
2288
+ const hasGeometry = hasValidGeometry(geojson);
2289
+ if (!hasGeometry) {
2290
+ return false;
2291
+ }
2292
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2293
+ // @ts-ignore
2294
+ const {
2295
+ coordinates,
2296
+ type
2297
+ } = geojson.features[0].geometry;
2298
+ if (type === 'MultiPolygon' || coordinates.length > 1 && type !== 'Point') {
2299
+ return true;
2300
+ }
2301
+ return false;
2302
+ };
2303
+ const countIntersectionPoints = (geojson, intersection) => {
2304
+ var _a, _b;
2305
+ if (!(geojson === null || geojson === void 0 ? void 0 : geojson.features) || !((_a = geojson.features[0]) === null || _a === void 0 ? void 0 : _a.geometry) || !(intersection === null || intersection === void 0 ? void 0 : intersection.features) || !((_b = intersection.features[0]) === null || _b === void 0 ? void 0 : _b.geometry)) {
2306
+ return 0;
2307
+ }
2308
+ const geojsonGeometry = geojson.features[0].geometry;
2309
+ const intersectionGeometry = intersection.features[0].geometry;
2310
+ if (geojsonGeometry.type !== 'Polygon' || intersectionGeometry.type !== 'Polygon') {
2311
+ return 0;
2312
+ }
2313
+ const geojsonCoordinates = geojsonGeometry.coordinates[0];
2314
+ const intersectionCoordinates = intersectionGeometry.coordinates[0];
2315
+ // If both arrays are empty, return 0
2316
+ if (!geojsonCoordinates && !intersectionCoordinates) {
2317
+ return 0;
2318
+ }
2319
+ const intersectionPoints = intersectionCoordinates.map(point => [point[0], point[1]]);
2320
+ const uniqueIntersectionPoints = intersectionPoints.filter((point, index, self) => index === self.findIndex(p => p[0] === point[0] && p[1] === point[1]));
2321
+ const collisionPoints = uniqueIntersectionPoints.filter(point => {
2322
+ const [x, y] = point;
2323
+ return !geojsonCoordinates.some(originalPoint => originalPoint[0] === x && originalPoint[1] === y);
2205
2324
  });
2206
- }
2207
-
2208
- // add a key to Array.prototype[@@unscopables]
2209
- var addToUnscopables$2 = function (key) {
2210
- ArrayPrototype[UNSCOPABLES][key] = true;
2325
+ return collisionPoints.length;
2211
2326
  };
2212
-
2213
- var $$3 = _export;
2214
- var $includes = arrayIncludes.includes;
2215
- var fails$4 = fails$l;
2216
- var addToUnscopables$1 = addToUnscopables$2;
2217
-
2218
- // FF99+ bug
2219
- var BROKEN_ON_SPARSE = fails$4(function () {
2220
- // eslint-disable-next-line es/no-array-prototype-includes -- detection
2221
- return !Array(1).includes();
2222
- });
2223
-
2224
- // `Array.prototype.includes` method
2225
- // https://tc39.es/ecma262/#sec-array.prototype.includes
2226
- $$3({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
2227
- includes: function includes(el /* , fromIndex = 0 */) {
2228
- return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
2327
+ const isGeometryDirty = (geoJSON, formGeoJSON) => {
2328
+ if (geoJSON === (undefined) || formGeoJSON === (undefined) || !hasValidGeometry(geoJSON) || !hasValidGeometry(formGeoJSON)) {
2329
+ return false;
2229
2330
  }
2230
- });
2231
-
2232
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
2233
- addToUnscopables$1('includes');
2234
-
2235
- var iterators = {};
2236
-
2237
- var fails$3 = fails$l;
2238
-
2239
- var correctPrototypeGetter = !fails$3(function () {
2240
- function F() { /* empty */ }
2241
- F.prototype.constructor = null;
2242
- // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
2243
- return Object.getPrototypeOf(new F()) !== F.prototype;
2244
- });
2245
-
2246
- var hasOwn$1 = hasOwnProperty_1;
2247
- var isCallable$3 = isCallable$g;
2248
- var toObject = toObject$4;
2249
- var sharedKey = sharedKey$3;
2250
- var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
2251
-
2252
- var IE_PROTO = sharedKey('IE_PROTO');
2253
- var $Object = Object;
2254
- var ObjectPrototype = $Object.prototype;
2255
-
2256
- // `Object.getPrototypeOf` method
2257
- // https://tc39.es/ecma262/#sec-object.getprototypeof
2258
- // eslint-disable-next-line es/no-object-getprototypeof -- safe
2259
- var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
2260
- var object = toObject(O);
2261
- if (hasOwn$1(object, IE_PROTO)) return object[IE_PROTO];
2262
- var constructor = object.constructor;
2263
- if (isCallable$3(constructor) && object instanceof constructor) {
2264
- return constructor.prototype;
2265
- } return object instanceof $Object ? ObjectPrototype : null;
2331
+ return !isEqual(
2332
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2333
+ // @ts-ignore
2334
+ geoJSON.features[0].geometry.coordinates,
2335
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2336
+ // @ts-ignore
2337
+ formGeoJSON.features[0].geometry.coordinates);
2266
2338
  };
2267
-
2268
- var fails$2 = fails$l;
2269
- var isCallable$2 = isCallable$g;
2270
- var isObject$3 = isObject$9;
2271
- var getPrototypeOf$1 = objectGetPrototypeOf;
2272
- var defineBuiltIn$2 = defineBuiltIn$5;
2273
- var wellKnownSymbol$6 = wellKnownSymbol$b;
2274
-
2275
- var ITERATOR$3 = wellKnownSymbol$6('iterator');
2276
- var BUGGY_SAFARI_ITERATORS$1 = false;
2277
-
2278
- // `%IteratorPrototype%` object
2279
- // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
2280
- var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
2281
-
2282
- /* eslint-disable es/no-array-prototype-keys -- safe */
2283
- if ([].keys) {
2284
- arrayIterator = [].keys();
2285
- // Safari 8 has buggy iterators w/o `next`
2286
- if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
2287
- else {
2288
- PrototypeOfArrayIteratorPrototype = getPrototypeOf$1(getPrototypeOf$1(arrayIterator));
2289
- if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
2339
+ const isInteger = value => {
2340
+ if (isEmpty(value)) {
2341
+ return true;
2290
2342
  }
2291
- }
2343
+ return Number.isInteger(value);
2344
+ };
2345
+ const isNonOrBothCoordinates = (coordinate, otherCoordinate) => {
2346
+ if (typeof coordinate === 'number' && typeof otherCoordinate === 'number' || coordinate === null && otherCoordinate === null || coordinate === undefined && otherCoordinate === undefined) {
2347
+ return true;
2348
+ }
2349
+ if (typeof coordinate === 'number') {
2350
+ return true;
2351
+ }
2352
+ return false;
2353
+ };
2292
2354
 
2293
- var NEW_ITERATOR_PROTOTYPE = !isObject$3(IteratorPrototype$2) || fails$2(function () {
2294
- var test = {};
2295
- // FF44- legacy iterators case
2296
- return IteratorPrototype$2[ITERATOR$3].call(test) !== test;
2355
+ const FORM_FIELDS_NAMESPACE = 'form-fields';
2356
+ i18n.use(initReactI18next).init({
2357
+ lng: 'en',
2358
+ ns: FORM_FIELDS_NAMESPACE,
2359
+ interpolation: {
2360
+ escapeValue: false
2361
+ },
2362
+ resources: {
2363
+ en: {
2364
+ [FORM_FIELDS_NAMESPACE]: formFieldsTranslations.en
2365
+ },
2366
+ fi: {
2367
+ [FORM_FIELDS_NAMESPACE]: formFieldsTranslations.fi
2368
+ },
2369
+ no: {
2370
+ [FORM_FIELDS_NAMESPACE]: formFieldsTranslations.no
2371
+ },
2372
+ nl: {
2373
+ [FORM_FIELDS_NAMESPACE]: formFieldsTranslations.nl
2374
+ }
2375
+ }
2297
2376
  });
2377
+ const ns = [FORM_FIELDS_NAMESPACE];
2378
+ const translateKeyOutsideComponents = (key, params = undefined) => i18n.t(key, Object.assign({
2379
+ ns
2380
+ }, params));
2298
2381
 
2299
- if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
2300
-
2301
- // `%IteratorPrototype%[@@iterator]()` method
2302
- // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
2303
- if (!isCallable$2(IteratorPrototype$2[ITERATOR$3])) {
2304
- defineBuiltIn$2(IteratorPrototype$2, ITERATOR$3, function () {
2305
- return this;
2306
- });
2307
- }
2308
-
2309
- var iteratorsCore = {
2310
- IteratorPrototype: IteratorPrototype$2,
2311
- BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
2382
+ const radioCheckboxStyle = {
2383
+ // hides unchecked values
2384
+ display: 'none',
2385
+ '&+.MuiFormControlLabel-label': {
2386
+ display: 'none'
2387
+ },
2388
+ // shows checked value
2389
+ '&.Mui-checked': {
2390
+ display: 'inherit',
2391
+ '&+.MuiFormControlLabel-label': {
2392
+ display: 'inherit'
2393
+ }
2394
+ },
2395
+ '&.Mui-checked+.MuiFormControlLabel-label': {
2396
+ color: 'geowebColors.typographyAndIcons.text'
2397
+ },
2398
+ '&.Mui-disabled.Mui-checked': {
2399
+ color: 'geowebColors.typographyAndIcons.iconLinkActive'
2400
+ }
2312
2401
  };
2313
-
2314
- var defineProperty$1 = objectDefineProperty.f;
2315
- var hasOwn = hasOwnProperty_1;
2316
- var wellKnownSymbol$5 = wellKnownSymbol$b;
2317
-
2318
- var TO_STRING_TAG = wellKnownSymbol$5('toStringTag');
2319
-
2320
- var setToStringTag$3 = function (target, TAG, STATIC) {
2321
- if (target && !STATIC) target = target.prototype;
2322
- if (target && !hasOwn(target, TO_STRING_TAG)) {
2323
- defineProperty$1(target, TO_STRING_TAG, { configurable: true, value: TAG });
2402
+ const getErrorMessage = errors => {
2403
+ if (errors && errors.message && typeof errors.message === 'string') {
2404
+ return translateKeyOutsideComponents(errors.message);
2324
2405
  }
2406
+ if (errors && errors.type && typeof errors.type === 'string') {
2407
+ return translateKeyOutsideComponents(errorMessages[errors.type]);
2408
+ }
2409
+ return '';
2325
2410
  };
2326
-
2327
- var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
2328
- var create = objectCreate;
2329
- var createPropertyDescriptor = createPropertyDescriptor$3;
2330
- var setToStringTag$2 = setToStringTag$3;
2331
- var Iterators$2 = iterators;
2332
-
2333
- var returnThis$1 = function () { return this; };
2334
-
2335
- var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
2336
- var TO_STRING_TAG = NAME + ' Iterator';
2337
- IteratorConstructor.prototype = create(IteratorPrototype$1, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
2338
- setToStringTag$2(IteratorConstructor, TO_STRING_TAG, false);
2339
- Iterators$2[TO_STRING_TAG] = returnThis$1;
2340
- return IteratorConstructor;
2411
+ const ReactHookFormFormControl = _a => {
2412
+ var {
2413
+ children,
2414
+ errors,
2415
+ isReadOnly,
2416
+ sx = {},
2417
+ className = '',
2418
+ size = 'medium'
2419
+ } = _a,
2420
+ props = __rest(_a, ["children", "errors", "isReadOnly", "sx", "className", "size"]);
2421
+ return jsxs(FormControl, Object.assign({
2422
+ fullWidth: true,
2423
+ error: !!errors,
2424
+ className: `${isReadOnly ? 'is-read-only' : ''} ${className}`,
2425
+ size: size,
2426
+ sx: Object.assign(Object.assign({}, isReadOnly && {
2427
+ // Radio input
2428
+ '.MuiRadio-root': radioCheckboxStyle,
2429
+ // Checkbox input
2430
+ '.MuiCheckbox-root': radioCheckboxStyle,
2431
+ // Select input
2432
+ '.MuiSelect-select.Mui-disabled': {
2433
+ color: 'geowebColors.typographyAndIcons.text',
2434
+ WebkitTextFillColor: 'inherit',
2435
+ '&:before': {
2436
+ borderColor: 'transparent'
2437
+ }
2438
+ },
2439
+ '.MuiSelect-nativeInput+.MuiSvgIcon-root': {
2440
+ display: 'none'
2441
+ },
2442
+ '.Mui-disabled:before': {
2443
+ border: 'transparent'
2444
+ }
2445
+ }), sx)
2446
+ }, props, {
2447
+ children: [children, errors && jsx(FormHelperText, Object.assign({
2448
+ variant: "filled",
2449
+ role: "alert"
2450
+ }, {
2451
+ children: getErrorMessage(errors)
2452
+ }))]
2453
+ }));
2341
2454
  };
2342
2455
 
2343
- var uncurryThis$3 = functionUncurryThis;
2344
2456
  var aCallable = aCallable$3;
2457
+ var toObject = toObject$4;
2458
+ var IndexedObject = indexedObject;
2459
+ var lengthOfArrayLike = lengthOfArrayLike$2;
2345
2460
 
2346
- var functionUncurryThisAccessor = function (object, key, method) {
2347
- try {
2348
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
2349
- return uncurryThis$3(aCallable(Object.getOwnPropertyDescriptor(object, key)[method]));
2350
- } catch (error) { /* empty */ }
2461
+ var $TypeError$2 = TypeError;
2462
+
2463
+ var REDUCE_EMPTY = 'Reduce of empty array with no initial value';
2464
+
2465
+ // `Array.prototype.{ reduce, reduceRight }` methods implementation
2466
+ var createMethod$1 = function (IS_RIGHT) {
2467
+ return function (that, callbackfn, argumentsLength, memo) {
2468
+ var O = toObject(that);
2469
+ var self = IndexedObject(O);
2470
+ var length = lengthOfArrayLike(O);
2471
+ aCallable(callbackfn);
2472
+ if (length === 0 && argumentsLength < 2) throw new $TypeError$2(REDUCE_EMPTY);
2473
+ var index = IS_RIGHT ? length - 1 : 0;
2474
+ var i = IS_RIGHT ? -1 : 1;
2475
+ if (argumentsLength < 2) while (true) {
2476
+ if (index in self) {
2477
+ memo = self[index];
2478
+ index += i;
2479
+ break;
2480
+ }
2481
+ index += i;
2482
+ if (IS_RIGHT ? index < 0 : length <= index) {
2483
+ throw new $TypeError$2(REDUCE_EMPTY);
2484
+ }
2485
+ }
2486
+ for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
2487
+ memo = callbackfn(memo, self[index], index, O);
2488
+ }
2489
+ return memo;
2490
+ };
2351
2491
  };
2352
2492
 
2353
- var isObject$2 = isObject$9;
2354
-
2355
- var isPossiblePrototype$1 = function (argument) {
2356
- return isObject$2(argument) || argument === null;
2493
+ var arrayReduce = {
2494
+ // `Array.prototype.reduce` method
2495
+ // https://tc39.es/ecma262/#sec-array.prototype.reduce
2496
+ left: createMethod$1(false),
2497
+ // `Array.prototype.reduceRight` method
2498
+ // https://tc39.es/ecma262/#sec-array.prototype.reduceright
2499
+ right: createMethod$1(true)
2357
2500
  };
2358
2501
 
2359
- var isPossiblePrototype = isPossiblePrototype$1;
2360
-
2361
- var $String = String;
2362
- var $TypeError$2 = TypeError;
2502
+ var fails$3 = fails$l;
2363
2503
 
2364
- var aPossiblePrototype$1 = function (argument) {
2365
- if (isPossiblePrototype(argument)) return argument;
2366
- throw new $TypeError$2("Can't set " + $String(argument) + ' as a prototype');
2504
+ var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
2505
+ var method = [][METHOD_NAME];
2506
+ return !!method && fails$3(function () {
2507
+ // eslint-disable-next-line no-useless-call -- required for testing
2508
+ method.call(null, argument || function () { return 1; }, 1);
2509
+ });
2367
2510
  };
2368
2511
 
2369
- /* eslint-disable no-proto -- safe */
2370
- var uncurryThisAccessor = functionUncurryThisAccessor;
2371
- var isObject$1 = isObject$9;
2372
- var requireObjectCoercible$3 = requireObjectCoercible$7;
2373
- var aPossiblePrototype = aPossiblePrototype$1;
2374
-
2375
- // `Object.setPrototypeOf` method
2376
- // https://tc39.es/ecma262/#sec-object.setprototypeof
2377
- // Works with __proto__ only. Old v8 can't work with null proto objects.
2378
- // eslint-disable-next-line es/no-object-setprototypeof -- safe
2379
- var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
2380
- var CORRECT_SETTER = false;
2381
- var test = {};
2382
- var setter;
2383
- try {
2384
- setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');
2385
- setter(test, []);
2386
- CORRECT_SETTER = test instanceof Array;
2387
- } catch (error) { /* empty */ }
2388
- return function setPrototypeOf(O, proto) {
2389
- requireObjectCoercible$3(O);
2390
- aPossiblePrototype(proto);
2391
- if (!isObject$1(O)) return O;
2392
- if (CORRECT_SETTER) setter(O, proto);
2393
- else O.__proto__ = proto;
2394
- return O;
2395
- };
2396
- }() : undefined);
2397
-
2398
- var $$2 = _export;
2399
- var call$3 = functionCall;
2400
- var FunctionName = functionName;
2401
- var isCallable$1 = isCallable$g;
2402
- var createIteratorConstructor = iteratorCreateConstructor;
2403
- var getPrototypeOf = objectGetPrototypeOf;
2404
- var setPrototypeOf = objectSetPrototypeOf;
2405
- var setToStringTag$1 = setToStringTag$3;
2406
- var createNonEnumerableProperty$2 = createNonEnumerableProperty$5;
2407
- var defineBuiltIn$1 = defineBuiltIn$5;
2408
- var wellKnownSymbol$4 = wellKnownSymbol$b;
2409
- var Iterators$1 = iterators;
2410
- var IteratorsCore = iteratorsCore;
2411
-
2412
- var PROPER_FUNCTION_NAME = FunctionName.PROPER;
2413
- var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
2414
- var IteratorPrototype = IteratorsCore.IteratorPrototype;
2415
- var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
2416
- var ITERATOR$2 = wellKnownSymbol$4('iterator');
2417
- var KEYS = 'keys';
2418
- var VALUES = 'values';
2419
- var ENTRIES = 'entries';
2420
-
2421
- var returnThis = function () { return this; };
2512
+ var global$2 = global$h;
2513
+ var classof$2 = classofRaw$1;
2422
2514
 
2423
- var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
2424
- createIteratorConstructor(IteratorConstructor, NAME, next);
2515
+ var engineIsNode = classof$2(global$2.process) === 'process';
2425
2516
 
2426
- var getIterationMethod = function (KIND) {
2427
- if (KIND === DEFAULT && defaultIterator) return defaultIterator;
2428
- if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND];
2517
+ var $$3 = _export;
2518
+ var $reduce = arrayReduce.left;
2519
+ var arrayMethodIsStrict = arrayMethodIsStrict$1;
2520
+ var CHROME_VERSION = engineV8Version;
2521
+ var IS_NODE = engineIsNode;
2429
2522
 
2430
- switch (KIND) {
2431
- case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
2432
- case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
2433
- case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
2434
- }
2523
+ // Chrome 80-82 has a critical bug
2524
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
2525
+ var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
2526
+ var FORCED$1 = CHROME_BUG || !arrayMethodIsStrict('reduce');
2435
2527
 
2436
- return function () { return new IteratorConstructor(this); };
2437
- };
2528
+ // `Array.prototype.reduce` method
2529
+ // https://tc39.es/ecma262/#sec-array.prototype.reduce
2530
+ $$3({ target: 'Array', proto: true, forced: FORCED$1 }, {
2531
+ reduce: function reduce(callbackfn /* , initialValue */) {
2532
+ var length = arguments.length;
2533
+ return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
2534
+ }
2535
+ });
2438
2536
 
2439
- var TO_STRING_TAG = NAME + ' Iterator';
2440
- var INCORRECT_VALUES_NAME = false;
2441
- var IterablePrototype = Iterable.prototype;
2442
- var nativeIterator = IterablePrototype[ITERATOR$2]
2443
- || IterablePrototype['@@iterator']
2444
- || DEFAULT && IterablePrototype[DEFAULT];
2445
- var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
2446
- var anyNativeIterator = NAME === 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
2447
- var CurrentIteratorPrototype, methods, KEY;
2537
+ function getDeepProperty(p, o) {
2538
+ return p.reduce((xs, x) => xs && xs[x] ? xs[x] : null, o);
2539
+ }
2540
+ const getErrors = (name, errors) => {
2541
+ const nameAsArray = name.split('.');
2542
+ return getDeepProperty(nameAsArray, errors);
2543
+ };
2448
2544
 
2449
- // fix native
2450
- if (anyNativeIterator) {
2451
- CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
2452
- if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
2453
- if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
2454
- if (setPrototypeOf) {
2455
- setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
2456
- } else if (!isCallable$1(CurrentIteratorPrototype[ITERATOR$2])) {
2457
- defineBuiltIn$1(CurrentIteratorPrototype, ITERATOR$2, returnThis);
2458
- }
2459
- }
2460
- // Set @@toStringTag to native iterators
2461
- setToStringTag$1(CurrentIteratorPrototype, TO_STRING_TAG, true);
2545
+ const ReactHookFormSelect = _a => {
2546
+ var {
2547
+ name,
2548
+ label,
2549
+ defaultValue = '',
2550
+ children,
2551
+ rules,
2552
+ onChange = () => {},
2553
+ disabled,
2554
+ className,
2555
+ sx,
2556
+ isReadOnly,
2557
+ size = 'medium'
2558
+ } = _a,
2559
+ otherProps = __rest(_a, ["name", "label", "defaultValue", "children", "rules", "onChange", "disabled", "className", "sx", "isReadOnly", "size"]);
2560
+ const labelId = `${name}-label`;
2561
+ const {
2562
+ control
2563
+ } = useFormContext();
2564
+ const {
2565
+ field: {
2566
+ onChange: onChangeField,
2567
+ value,
2568
+ ref
2569
+ },
2570
+ formState: {
2571
+ errors: formErrors
2462
2572
  }
2463
- }
2573
+ } = useController(Object.assign({
2574
+ name,
2575
+ control,
2576
+ rules,
2577
+ defaultValue
2578
+ }, defaultProps));
2579
+ const errors = getErrors(name, formErrors);
2580
+ return jsxs(ReactHookFormFormControl, Object.assign({
2581
+ className: className,
2582
+ sx: sx,
2583
+ disabled: disabled,
2584
+ errors: errors,
2585
+ isReadOnly: isReadOnly,
2586
+ size: size
2587
+ }, {
2588
+ children: [jsx(InputLabel, Object.assign({
2589
+ variant: "filled",
2590
+ id: labelId
2591
+ }, {
2592
+ children: label
2593
+ })), jsx(Select, Object.assign({
2594
+ labelId: labelId,
2595
+ label: label,
2596
+ inputRef: ref,
2597
+ name: name,
2598
+ onChange: changeEvent => {
2599
+ onChangeField(changeEvent.target.value);
2600
+ // default props
2601
+ onChange(changeEvent);
2602
+ },
2603
+ value: value || '',
2604
+ variant: "filled"
2605
+ }, otherProps, {
2606
+ children: children
2607
+ }))]
2608
+ }));
2609
+ };
2464
2610
 
2465
- // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
2466
- if (PROPER_FUNCTION_NAME && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) {
2467
- if (CONFIGURABLE_FUNCTION_NAME) {
2468
- createNonEnumerableProperty$2(IterablePrototype, 'name', VALUES);
2469
- } else {
2470
- INCORRECT_VALUES_NAME = true;
2471
- defaultIterator = function values() { return call$3(nativeIterator, this); };
2611
+ const ReactHookFormRadioGroup = _a => {
2612
+ var {
2613
+ name,
2614
+ label,
2615
+ defaultValue = '',
2616
+ children,
2617
+ rules,
2618
+ disabled = false,
2619
+ onChange = () => {},
2620
+ isReadOnly
2621
+ } = _a,
2622
+ otherProps = __rest(_a, ["name", "label", "defaultValue", "children", "rules", "disabled", "onChange", "isReadOnly"]);
2623
+ const labelId = `${name}-label`;
2624
+ const {
2625
+ control
2626
+ } = useFormContext();
2627
+ const {
2628
+ field: {
2629
+ onChange: onChangeField,
2630
+ value,
2631
+ ref
2632
+ },
2633
+ formState: {
2634
+ errors: formErrors
2472
2635
  }
2473
- }
2474
-
2475
- // export additional methods
2476
- if (DEFAULT) {
2477
- methods = {
2478
- values: getIterationMethod(VALUES),
2479
- keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
2480
- entries: getIterationMethod(ENTRIES)
2481
- };
2482
- if (FORCED) for (KEY in methods) {
2483
- if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
2484
- defineBuiltIn$1(IterablePrototype, KEY, methods[KEY]);
2636
+ } = useController(Object.assign({
2637
+ name,
2638
+ control,
2639
+ rules,
2640
+ defaultValue
2641
+ }, defaultProps));
2642
+ const errors = getErrors(name, formErrors);
2643
+ React.useEffect(() => {
2644
+ if (errors) {
2645
+ const firstError = Object.keys(formErrors)[0];
2646
+ if (firstError === name) {
2647
+ // if first error in form is same, focus on that input
2648
+ const inputNode = document.querySelector(`[name="${name}"]`);
2649
+ if (inputNode !== null) {
2650
+ inputNode.focus();
2651
+ }
2485
2652
  }
2486
- } else $$2({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
2487
- }
2488
-
2489
- // define iterator
2490
- if (IterablePrototype[ITERATOR$2] !== defaultIterator) {
2491
- defineBuiltIn$1(IterablePrototype, ITERATOR$2, defaultIterator, { name: DEFAULT });
2492
- }
2493
- Iterators$1[NAME] = defaultIterator;
2494
-
2495
- return methods;
2653
+ }
2654
+ }, [errors, formErrors, name]);
2655
+ return jsxs(ReactHookFormFormControl, Object.assign({
2656
+ disabled: disabled,
2657
+ errors: errors,
2658
+ isReadOnly: isReadOnly
2659
+ }, {
2660
+ children: [jsx(InputLabel, Object.assign({
2661
+ id: labelId
2662
+ }, {
2663
+ children: label
2664
+ })), jsx(RadioGroup, Object.assign({
2665
+ value: value,
2666
+ onChange: changeEvent => {
2667
+ onChangeField(changeEvent.target.value);
2668
+ onChange(changeEvent, changeEvent.target.value);
2669
+ },
2670
+ ref: ref,
2671
+ name: name
2672
+ }, otherProps, {
2673
+ children: children
2674
+ }))]
2675
+ }));
2496
2676
  };
2497
2677
 
2498
- // `CreateIterResultObject` abstract operation
2499
- // https://tc39.es/ecma262/#sec-createiterresultobject
2500
- var createIterResultObject$1 = function (value, done) {
2501
- return { value: value, done: done };
2678
+ const convertTextInputValue = (value, inCapitals) => {
2679
+ return inCapitals ? value.toUpperCase() : value;
2680
+ };
2681
+ const ReactHookFormTextField = _a => {
2682
+ var {
2683
+ name,
2684
+ label,
2685
+ defaultValue = '',
2686
+ rules,
2687
+ disabled = false,
2688
+ upperCase = false,
2689
+ helperText = '',
2690
+ className,
2691
+ sx,
2692
+ onChange = () => {},
2693
+ isReadOnly,
2694
+ InputProps
2695
+ } = _a,
2696
+ otherProps = __rest(_a, ["name", "label", "defaultValue", "rules", "disabled", "upperCase", "helperText", "className", "sx", "onChange", "isReadOnly", "InputProps"]);
2697
+ const {
2698
+ control
2699
+ } = useFormContext();
2700
+ const {
2701
+ field: {
2702
+ onChange: onChangeField,
2703
+ value,
2704
+ ref
2705
+ },
2706
+ formState: {
2707
+ errors: formErrors
2708
+ }
2709
+ } = useController(Object.assign({
2710
+ name,
2711
+ control,
2712
+ rules,
2713
+ defaultValue
2714
+ }, defaultProps));
2715
+ const errors = getErrors(name, formErrors);
2716
+ return jsx(ReactHookFormFormControl, Object.assign({
2717
+ className: className,
2718
+ sx: sx,
2719
+ disabled: disabled,
2720
+ errors: errors,
2721
+ isReadOnly: isReadOnly
2722
+ }, {
2723
+ children: jsx(TextField, Object.assign({
2724
+ label: label,
2725
+ error: !!errors,
2726
+ helperText: helperText,
2727
+ value: value,
2728
+ variant: "filled",
2729
+ type: "text",
2730
+ name: name,
2731
+ onChange: evt => {
2732
+ const {
2733
+ value
2734
+ } = evt.target;
2735
+ const convertedValue = convertTextInputValue(value, upperCase);
2736
+ onChangeField(convertedValue);
2737
+ onChange(null);
2738
+ },
2739
+ disabled: disabled,
2740
+ inputRef: ref,
2741
+ InputProps: Object.assign(Object.assign({}, InputProps), isReadOnly && {
2742
+ readOnly: true
2743
+ })
2744
+ }, otherProps))
2745
+ }));
2502
2746
  };
2503
2747
 
2504
- var toIndexedObject = toIndexedObject$5;
2748
+ var $$2 = _export;
2749
+ var $includes = arrayIncludes.includes;
2750
+ var fails$2 = fails$l;
2505
2751
  var addToUnscopables = addToUnscopables$2;
2506
- var Iterators = iterators;
2507
- var InternalStateModule = internalState;
2508
- var defineProperty = objectDefineProperty.f;
2509
- var defineIterator = iteratorDefine;
2510
- var createIterResultObject = createIterResultObject$1;
2511
- var DESCRIPTORS = descriptors;
2512
2752
 
2513
- var ARRAY_ITERATOR = 'Array Iterator';
2514
- var setInternalState = InternalStateModule.set;
2515
- var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
2753
+ // FF99+ bug
2754
+ var BROKEN_ON_SPARSE = fails$2(function () {
2755
+ // eslint-disable-next-line es/no-array-prototype-includes -- detection
2756
+ return !Array(1).includes();
2757
+ });
2516
2758
 
2517
- // `Array.prototype.entries` method
2518
- // https://tc39.es/ecma262/#sec-array.prototype.entries
2519
- // `Array.prototype.keys` method
2520
- // https://tc39.es/ecma262/#sec-array.prototype.keys
2521
- // `Array.prototype.values` method
2522
- // https://tc39.es/ecma262/#sec-array.prototype.values
2523
- // `Array.prototype[@@iterator]` method
2524
- // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
2525
- // `CreateArrayIterator` internal method
2526
- // https://tc39.es/ecma262/#sec-createarrayiterator
2527
- var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
2528
- setInternalState(this, {
2529
- type: ARRAY_ITERATOR,
2530
- target: toIndexedObject(iterated), // target
2531
- index: 0, // next index
2532
- kind: kind // kind
2533
- });
2534
- // `%ArrayIteratorPrototype%.next` method
2535
- // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
2536
- }, function () {
2537
- var state = getInternalState(this);
2538
- var target = state.target;
2539
- var index = state.index++;
2540
- if (!target || index >= target.length) {
2541
- state.target = undefined;
2542
- return createIterResultObject(undefined, true);
2759
+ // `Array.prototype.includes` method
2760
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
2761
+ $$2({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
2762
+ includes: function includes(el /* , fromIndex = 0 */) {
2763
+ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
2543
2764
  }
2544
- switch (state.kind) {
2545
- case 'keys': return createIterResultObject(index, false);
2546
- case 'values': return createIterResultObject(target[index], false);
2547
- } return createIterResultObject([index, target[index]], false);
2548
- }, 'values');
2549
-
2550
- // argumentsList[@@iterator] is %ArrayProto_values%
2551
- // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
2552
- // https://tc39.es/ecma262/#sec-createmappedargumentsobject
2553
- var values = Iterators.Arguments = Iterators.Array;
2765
+ });
2554
2766
 
2555
2767
  // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
2556
- addToUnscopables('keys');
2557
- addToUnscopables('values');
2558
- addToUnscopables('entries');
2559
-
2560
- // V8 ~ Chrome 45- bug
2561
- if (DESCRIPTORS && values.name !== 'values') try {
2562
- defineProperty(values, 'name', { value: 'values' });
2563
- } catch (error) { /* empty */ }
2768
+ addToUnscopables('includes');
2564
2769
 
2565
- var global$2 = global$h;
2770
+ var global$1 = global$h;
2566
2771
  var fails$1 = fails$l;
2567
2772
  var uncurryThis$2 = functionUncurryThis;
2568
2773
  var toString$3 = toString$8;
2569
2774
  var trim = stringTrim.trim;
2570
2775
  var whitespaces = whitespaces$4;
2571
2776
 
2572
- var $parseInt$1 = global$2.parseInt;
2573
- var Symbol$1 = global$2.Symbol;
2574
- var ITERATOR$1 = Symbol$1 && Symbol$1.iterator;
2777
+ var $parseInt$1 = global$1.parseInt;
2778
+ var Symbol$1 = global$1.Symbol;
2779
+ var ITERATOR = Symbol$1 && Symbol$1.iterator;
2575
2780
  var hex = /^[+-]?0x/i;
2576
2781
  var exec = uncurryThis$2(hex.exec);
2577
2782
  var FORCED = $parseInt$1(whitespaces + '08') !== 8 || $parseInt$1(whitespaces + '0x16') !== 22
2578
2783
  // MS Edge 18- broken with boxed symbols
2579
- || (ITERATOR$1 && !fails$1(function () { $parseInt$1(Object(ITERATOR$1)); }));
2784
+ || (ITERATOR && !fails$1(function () { $parseInt$1(Object(ITERATOR)); }));
2580
2785
 
2581
2786
  // `parseInt` method
2582
2787
  // https://tc39.es/ecma262/#sec-parseint-string-radix
@@ -2596,9 +2801,9 @@ $$1({ global: true, forced: parseInt !== $parseInt }, {
2596
2801
 
2597
2802
  var isObject = isObject$9;
2598
2803
  var classof$1 = classofRaw$1;
2599
- var wellKnownSymbol$3 = wellKnownSymbol$b;
2804
+ var wellKnownSymbol$2 = wellKnownSymbol$b;
2600
2805
 
2601
- var MATCH$1 = wellKnownSymbol$3('match');
2806
+ var MATCH$1 = wellKnownSymbol$2('match');
2602
2807
 
2603
2808
  // `IsRegExp` abstract operation
2604
2809
  // https://tc39.es/ecma262/#sec-isregexp
@@ -2617,9 +2822,9 @@ var notARegexp = function (it) {
2617
2822
  } return it;
2618
2823
  };
2619
2824
 
2620
- var wellKnownSymbol$2 = wellKnownSymbol$b;
2825
+ var wellKnownSymbol$1 = wellKnownSymbol$b;
2621
2826
 
2622
- var MATCH = wellKnownSymbol$2('match');
2827
+ var MATCH = wellKnownSymbol$1('match');
2623
2828
 
2624
2829
  var correctIsRegexpLogic = function (METHOD_NAME) {
2625
2830
  var regexp = /./;
@@ -2660,14 +2865,14 @@ var call$2 = functionCall;
2660
2865
  var defineBuiltIn = defineBuiltIn$5;
2661
2866
  var regexpExec$1 = regexpExec$2;
2662
2867
  var fails = fails$l;
2663
- var wellKnownSymbol$1 = wellKnownSymbol$b;
2664
- var createNonEnumerableProperty$1 = createNonEnumerableProperty$5;
2868
+ var wellKnownSymbol = wellKnownSymbol$b;
2869
+ var createNonEnumerableProperty = createNonEnumerableProperty$5;
2665
2870
 
2666
- var SPECIES = wellKnownSymbol$1('species');
2871
+ var SPECIES = wellKnownSymbol('species');
2667
2872
  var RegExpPrototype = RegExp.prototype;
2668
2873
 
2669
2874
  var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
2670
- var SYMBOL = wellKnownSymbol$1(KEY);
2875
+ var SYMBOL = wellKnownSymbol(KEY);
2671
2876
 
2672
2877
  var DELEGATES_TO_SYMBOL = !fails(function () {
2673
2878
  // String methods call symbol-named RegExp methods
@@ -2727,7 +2932,7 @@ var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
2727
2932
  defineBuiltIn(RegExpPrototype, SYMBOL, methods[1]);
2728
2933
  }
2729
2934
 
2730
- if (SHAM) createNonEnumerableProperty$1(RegExpPrototype[SYMBOL], 'sham', true);
2935
+ if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
2731
2936
  };
2732
2937
 
2733
2938
  var uncurryThis = functionUncurryThis;
@@ -2844,87 +3049,6 @@ fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNa
2844
3049
  ];
2845
3050
  });
2846
3051
 
2847
- // iterable DOM collections
2848
- // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
2849
- var domIterables = {
2850
- CSSRuleList: 0,
2851
- CSSStyleDeclaration: 0,
2852
- CSSValueList: 0,
2853
- ClientRectList: 0,
2854
- DOMRectList: 0,
2855
- DOMStringList: 0,
2856
- DOMTokenList: 1,
2857
- DataTransferItemList: 0,
2858
- FileList: 0,
2859
- HTMLAllCollection: 0,
2860
- HTMLCollection: 0,
2861
- HTMLFormElement: 0,
2862
- HTMLSelectElement: 0,
2863
- MediaList: 0,
2864
- MimeTypeArray: 0,
2865
- NamedNodeMap: 0,
2866
- NodeList: 1,
2867
- PaintRequestList: 0,
2868
- Plugin: 0,
2869
- PluginArray: 0,
2870
- SVGLengthList: 0,
2871
- SVGNumberList: 0,
2872
- SVGPathSegList: 0,
2873
- SVGPointList: 0,
2874
- SVGStringList: 0,
2875
- SVGTransformList: 0,
2876
- SourceBufferList: 0,
2877
- StyleSheetList: 0,
2878
- TextTrackCueList: 0,
2879
- TextTrackList: 0,
2880
- TouchList: 0
2881
- };
2882
-
2883
- // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
2884
- var documentCreateElement = documentCreateElement$2;
2885
-
2886
- var classList = documentCreateElement('span').classList;
2887
- var DOMTokenListPrototype$1 = classList && classList.constructor && classList.constructor.prototype;
2888
-
2889
- var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
2890
-
2891
- var global$1 = global$h;
2892
- var DOMIterables = domIterables;
2893
- var DOMTokenListPrototype = domTokenListPrototype;
2894
- var ArrayIteratorMethods = es_array_iterator;
2895
- var createNonEnumerableProperty = createNonEnumerableProperty$5;
2896
- var setToStringTag = setToStringTag$3;
2897
- var wellKnownSymbol = wellKnownSymbol$b;
2898
-
2899
- var ITERATOR = wellKnownSymbol('iterator');
2900
- var ArrayValues = ArrayIteratorMethods.values;
2901
-
2902
- var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
2903
- if (CollectionPrototype) {
2904
- // some Chrome versions have non-configurable methods on DOMTokenList
2905
- if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
2906
- createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
2907
- } catch (error) {
2908
- CollectionPrototype[ITERATOR] = ArrayValues;
2909
- }
2910
- setToStringTag(CollectionPrototype, COLLECTION_NAME, true);
2911
- if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
2912
- // some Chrome versions have non-configurable methods on DOMTokenList
2913
- if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
2914
- createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
2915
- } catch (error) {
2916
- CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
2917
- }
2918
- }
2919
- }
2920
- };
2921
-
2922
- for (var COLLECTION_NAME in DOMIterables) {
2923
- handlePrototype(global$1[COLLECTION_NAME] && global$1[COLLECTION_NAME].prototype, COLLECTION_NAME);
2924
- }
2925
-
2926
- handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
2927
-
2928
3052
  const convertNumericInputValue = (value, inputMode) => {
2929
3053
  if (value !== '' && !isNaN(parseFloat(value))) {
2930
3054
  return inputMode === 'numeric' ? parseInt(value, 10) : parseFloat(value);
@@ -3270,4 +3394,4 @@ const useDraftFormHelpers = (isDefaultDraft = false) => {
3270
3394
  };
3271
3395
  };
3272
3396
 
3273
- export { HIDDEN_INPUT_HELPER_IS_DRAFT, ReactHookKeyboardDateTimePicker as ReactHookFormDateTime, ReactHookFormFormControl, ReactHookFormHiddenInput, ReactHookFormNumberField, ReactHookFormProviderWrapper as ReactHookFormProvider, ReactHookFormRadioGroup, ReactHookFormSelect, ReactHookFormTextField, defaultFormOptions, errorMessages, getDateValue, getDeepProperty, getFormattedValueForDatePicker, hasIntersectionWithFIR, hasMulitpleIntersections, hasValidGeometry, isEmpty, isGeometryDirty, isInteger, isLatitude, isLongitude, isMaximumOneDrawing, isNonOrBothCoordinates, isValidGeoJsonCoordinates, isValidMax, isValidMin, isXHoursAfter, isXHoursBefore, useDraftFormHelpers };
3397
+ export { FORM_FIELDS_NAMESPACE, HIDDEN_INPUT_HELPER_IS_DRAFT, ReactHookKeyboardDateTimePicker as ReactHookFormDateTime, ReactHookFormFormControl, ReactHookFormHiddenInput, ReactHookFormNumberField, ReactHookFormProviderWrapper as ReactHookFormProvider, ReactHookFormRadioGroup, ReactHookFormSelect, ReactHookFormTextField, countIntersectionPoints, defaultFormOptions, errorMessages, formFieldsTranslations, getDateValue, getDeepProperty, getFormattedValueForDatePicker, hasIntersectionWithFIR, hasMulitpleIntersections, hasValidGeometry, isEmpty, isGeometryDirty, isInteger, isLatitude, isLongitude, isMaximumOneDrawing, isNonOrBothCoordinates, isValidGeoJsonCoordinates, isValidMax, isValidMin, isXHoursAfter, isXHoursBefore, useDraftFormHelpers };