@frollo/frollo-web-ui 0.0.5 → 0.0.8

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/cjs/index.js CHANGED
@@ -137,31 +137,31 @@ var f$5 = objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumer
137
137
  };
138
138
  };var NATIVE_BIND$1 = functionBindNative;
139
139
 
140
- var FunctionPrototype$1 = Function.prototype;
141
- var bind$2 = FunctionPrototype$1.bind;
142
- var call$3 = FunctionPrototype$1.call;
143
- var uncurryThis$d = NATIVE_BIND$1 && bind$2.bind(call$3, call$3);
140
+ var FunctionPrototype$2 = Function.prototype;
141
+ var bind$2 = FunctionPrototype$2.bind;
142
+ var call$3 = FunctionPrototype$2.call;
143
+ var uncurryThis$e = NATIVE_BIND$1 && bind$2.bind(call$3, call$3);
144
144
 
145
145
  var functionUncurryThis = NATIVE_BIND$1 ? function (fn) {
146
- return fn && uncurryThis$d(fn);
146
+ return fn && uncurryThis$e(fn);
147
147
  } : function (fn) {
148
148
  return fn && function () {
149
149
  return call$3.apply(fn, arguments);
150
150
  };
151
- };var uncurryThis$c = functionUncurryThis;
151
+ };var uncurryThis$d = functionUncurryThis;
152
152
 
153
- var toString$2 = uncurryThis$c({}.toString);
154
- var stringSlice = uncurryThis$c(''.slice);
153
+ var toString$2 = uncurryThis$d({}.toString);
154
+ var stringSlice = uncurryThis$d(''.slice);
155
155
 
156
156
  var classofRaw$1 = function (it) {
157
157
  return stringSlice(toString$2(it), 8, -1);
158
158
  };var global$n = global$o;
159
- var uncurryThis$b = functionUncurryThis;
159
+ var uncurryThis$c = functionUncurryThis;
160
160
  var fails$6 = fails$9;
161
161
  var classof$4 = classofRaw$1;
162
162
 
163
163
  var Object$4 = global$n.Object;
164
- var split = uncurryThis$b(''.split);
164
+ var split = uncurryThis$c(''.split);
165
165
 
166
166
  // fallback for non-array-like ES3 and non-enumerable old V8 strings
167
167
  var indexedObject = fails$6(function () {
@@ -187,24 +187,24 @@ var toIndexedObject$5 = function (it) {
187
187
  return IndexedObject$1(requireObjectCoercible$1(it));
188
188
  };// `IsCallable` abstract operation
189
189
  // https://tc39.es/ecma262/#sec-iscallable
190
- var isCallable$b = function (argument) {
190
+ var isCallable$c = function (argument) {
191
191
  return typeof argument == 'function';
192
- };var isCallable$a = isCallable$b;
192
+ };var isCallable$b = isCallable$c;
193
193
 
194
- var isObject$6 = function (it) {
195
- return typeof it == 'object' ? it !== null : isCallable$a(it);
194
+ var isObject$7 = function (it) {
195
+ return typeof it == 'object' ? it !== null : isCallable$b(it);
196
196
  };var global$l = global$o;
197
- var isCallable$9 = isCallable$b;
197
+ var isCallable$a = isCallable$c;
198
198
 
199
199
  var aFunction = function (argument) {
200
- return isCallable$9(argument) ? argument : undefined;
200
+ return isCallable$a(argument) ? argument : undefined;
201
201
  };
202
202
 
203
203
  var getBuiltIn$5 = function (namespace, method) {
204
204
  return arguments.length < 2 ? aFunction(global$l[namespace]) : global$l[namespace] && global$l[namespace][method];
205
- };var uncurryThis$a = functionUncurryThis;
205
+ };var uncurryThis$b = functionUncurryThis;
206
206
 
207
- var objectIsPrototypeOf = uncurryThis$a({}.isPrototypeOf);var getBuiltIn$4 = getBuiltIn$5;
207
+ var objectIsPrototypeOf = uncurryThis$b({}.isPrototypeOf);var getBuiltIn$4 = getBuiltIn$5;
208
208
 
209
209
  var engineUserAgent = getBuiltIn$4('navigator', 'userAgent') || '';var global$k = global$o;
210
210
  var userAgent = engineUserAgent;
@@ -253,7 +253,7 @@ var useSymbolAsUid = NATIVE_SYMBOL$1
253
253
  && !Symbol.sham
254
254
  && typeof Symbol.iterator == 'symbol';var global$j = global$o;
255
255
  var getBuiltIn$3 = getBuiltIn$5;
256
- var isCallable$8 = isCallable$b;
256
+ var isCallable$9 = isCallable$c;
257
257
  var isPrototypeOf = objectIsPrototypeOf;
258
258
  var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
259
259
 
@@ -263,7 +263,7 @@ var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
263
263
  return typeof it == 'symbol';
264
264
  } : function (it) {
265
265
  var $Symbol = getBuiltIn$3('Symbol');
266
- return isCallable$8($Symbol) && isPrototypeOf($Symbol.prototype, Object$3(it));
266
+ return isCallable$9($Symbol) && isPrototypeOf($Symbol.prototype, Object$3(it));
267
267
  };var global$i = global$o;
268
268
 
269
269
  var String$2 = global$i.String;
@@ -275,14 +275,14 @@ var tryToString$1 = function (argument) {
275
275
  return 'Object';
276
276
  }
277
277
  };var global$h = global$o;
278
- var isCallable$7 = isCallable$b;
278
+ var isCallable$8 = isCallable$c;
279
279
  var tryToString = tryToString$1;
280
280
 
281
281
  var TypeError$6 = global$h.TypeError;
282
282
 
283
283
  // `Assert: IsCallable(argument) is true`
284
284
  var aCallable$2 = function (argument) {
285
- if (isCallable$7(argument)) return argument;
285
+ if (isCallable$8(argument)) return argument;
286
286
  throw TypeError$6(tryToString(argument) + ' is not a function');
287
287
  };var aCallable$1 = aCallable$2;
288
288
 
@@ -293,8 +293,8 @@ var getMethod$1 = function (V, P) {
293
293
  return func == null ? undefined : aCallable$1(func);
294
294
  };var global$g = global$o;
295
295
  var call$2 = functionCall;
296
- var isCallable$6 = isCallable$b;
297
- var isObject$5 = isObject$6;
296
+ var isCallable$7 = isCallable$c;
297
+ var isObject$6 = isObject$7;
298
298
 
299
299
  var TypeError$5 = global$g.TypeError;
300
300
 
@@ -302,18 +302,18 @@ var TypeError$5 = global$g.TypeError;
302
302
  // https://tc39.es/ecma262/#sec-ordinarytoprimitive
303
303
  var ordinaryToPrimitive$1 = function (input, pref) {
304
304
  var fn, val;
305
- if (pref === 'string' && isCallable$6(fn = input.toString) && !isObject$5(val = call$2(fn, input))) return val;
306
- if (isCallable$6(fn = input.valueOf) && !isObject$5(val = call$2(fn, input))) return val;
307
- if (pref !== 'string' && isCallable$6(fn = input.toString) && !isObject$5(val = call$2(fn, input))) return val;
305
+ if (pref === 'string' && isCallable$7(fn = input.toString) && !isObject$6(val = call$2(fn, input))) return val;
306
+ if (isCallable$7(fn = input.valueOf) && !isObject$6(val = call$2(fn, input))) return val;
307
+ if (pref !== 'string' && isCallable$7(fn = input.toString) && !isObject$6(val = call$2(fn, input))) return val;
308
308
  throw TypeError$5("Can't convert object to primitive value");
309
309
  };var shared$4 = {exports: {}};var isPure = false;var global$f = global$o;
310
310
 
311
311
  // eslint-disable-next-line es/no-object-defineproperty -- safe
312
- var defineProperty = Object.defineProperty;
312
+ var defineProperty$1 = Object.defineProperty;
313
313
 
314
314
  var setGlobal$3 = function (key, value) {
315
315
  try {
316
- defineProperty(global$f, key, { value: value, configurable: true, writable: true });
316
+ defineProperty$1(global$f, key, { value: value, configurable: true, writable: true });
317
317
  } catch (error) {
318
318
  global$f[key] = value;
319
319
  } return value;
@@ -345,20 +345,20 @@ var Object$2 = global$d.Object;
345
345
  // https://tc39.es/ecma262/#sec-toobject
346
346
  var toObject$2 = function (argument) {
347
347
  return Object$2(requireObjectCoercible(argument));
348
- };var uncurryThis$9 = functionUncurryThis;
348
+ };var uncurryThis$a = functionUncurryThis;
349
349
  var toObject$1 = toObject$2;
350
350
 
351
- var hasOwnProperty = uncurryThis$9({}.hasOwnProperty);
351
+ var hasOwnProperty = uncurryThis$a({}.hasOwnProperty);
352
352
 
353
353
  // `HasOwnProperty` abstract operation
354
354
  // https://tc39.es/ecma262/#sec-hasownproperty
355
355
  var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
356
356
  return hasOwnProperty(toObject$1(it), key);
357
- };var uncurryThis$8 = functionUncurryThis;
357
+ };var uncurryThis$9 = functionUncurryThis;
358
358
 
359
359
  var id = 0;
360
360
  var postfix = Math.random();
361
- var toString$1 = uncurryThis$8(1.0.toString);
361
+ var toString$1 = uncurryThis$9(1.0.toString);
362
362
 
363
363
  var uid$2 = function (key) {
364
364
  return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$1(++id + postfix, 36);
@@ -387,7 +387,7 @@ var wellKnownSymbol$5 = function (name) {
387
387
  } return WellKnownSymbolsStore[name];
388
388
  };var global$b = global$o;
389
389
  var call$1 = functionCall;
390
- var isObject$4 = isObject$6;
390
+ var isObject$5 = isObject$7;
391
391
  var isSymbol$1 = isSymbol$2;
392
392
  var getMethod = getMethod$1;
393
393
  var ordinaryToPrimitive = ordinaryToPrimitive$1;
@@ -399,13 +399,13 @@ var TO_PRIMITIVE = wellKnownSymbol$4('toPrimitive');
399
399
  // `ToPrimitive` abstract operation
400
400
  // https://tc39.es/ecma262/#sec-toprimitive
401
401
  var toPrimitive$1 = function (input, pref) {
402
- if (!isObject$4(input) || isSymbol$1(input)) return input;
402
+ if (!isObject$5(input) || isSymbol$1(input)) return input;
403
403
  var exoticToPrim = getMethod(input, TO_PRIMITIVE);
404
404
  var result;
405
405
  if (exoticToPrim) {
406
406
  if (pref === undefined) pref = 'default';
407
407
  result = call$1(exoticToPrim, input, pref);
408
- if (!isObject$4(result) || isSymbol$1(result)) return result;
408
+ if (!isObject$5(result) || isSymbol$1(result)) return result;
409
409
  throw TypeError$4("Can't convert object to primitive value");
410
410
  }
411
411
  if (pref === undefined) pref = 'number';
@@ -419,25 +419,25 @@ var toPropertyKey$2 = function (argument) {
419
419
  var key = toPrimitive(argument, 'string');
420
420
  return isSymbol(key) ? key : key + '';
421
421
  };var global$a = global$o;
422
- var isObject$3 = isObject$6;
422
+ var isObject$4 = isObject$7;
423
423
 
424
424
  var document$1 = global$a.document;
425
425
  // typeof document.createElement is 'object' in old IE
426
- var EXISTS$1 = isObject$3(document$1) && isObject$3(document$1.createElement);
426
+ var EXISTS$1 = isObject$4(document$1) && isObject$4(document$1.createElement);
427
427
 
428
428
  var documentCreateElement$2 = function (it) {
429
429
  return EXISTS$1 ? document$1.createElement(it) : {};
430
- };var DESCRIPTORS$7 = descriptors;
430
+ };var DESCRIPTORS$8 = descriptors;
431
431
  var fails$4 = fails$9;
432
432
  var createElement = documentCreateElement$2;
433
433
 
434
434
  // Thanks to IE8 for its funny defineProperty
435
- var ie8DomDefine = !DESCRIPTORS$7 && !fails$4(function () {
435
+ var ie8DomDefine = !DESCRIPTORS$8 && !fails$4(function () {
436
436
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
437
437
  return Object.defineProperty(createElement('div'), 'a', {
438
438
  get: function () { return 7; }
439
439
  }).a != 7;
440
- });var DESCRIPTORS$6 = descriptors;
440
+ });var DESCRIPTORS$7 = descriptors;
441
441
  var call = functionCall;
442
442
  var propertyIsEnumerableModule = objectPropertyIsEnumerable;
443
443
  var createPropertyDescriptor$1 = createPropertyDescriptor$2;
@@ -451,36 +451,36 @@ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
451
451
 
452
452
  // `Object.getOwnPropertyDescriptor` method
453
453
  // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
454
- var f$4 = objectGetOwnPropertyDescriptor.f = DESCRIPTORS$6 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
454
+ var f$4 = objectGetOwnPropertyDescriptor.f = DESCRIPTORS$7 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
455
455
  O = toIndexedObject$4(O);
456
456
  P = toPropertyKey$1(P);
457
457
  if (IE8_DOM_DEFINE$1) try {
458
458
  return $getOwnPropertyDescriptor$1(O, P);
459
459
  } catch (error) { /* empty */ }
460
460
  if (hasOwn$5(O, P)) return createPropertyDescriptor$1(!call(propertyIsEnumerableModule.f, O, P), O[P]);
461
- };var objectDefineProperty = {};var DESCRIPTORS$5 = descriptors;
461
+ };var objectDefineProperty = {};var DESCRIPTORS$6 = descriptors;
462
462
  var fails$3 = fails$9;
463
463
 
464
464
  // V8 ~ Chrome 36-
465
465
  // https://bugs.chromium.org/p/v8/issues/detail?id=3334
466
- var v8PrototypeDefineBug = DESCRIPTORS$5 && fails$3(function () {
466
+ var v8PrototypeDefineBug = DESCRIPTORS$6 && fails$3(function () {
467
467
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
468
468
  return Object.defineProperty(function () { /* empty */ }, 'prototype', {
469
469
  value: 42,
470
470
  writable: false
471
471
  }).prototype != 42;
472
472
  });var global$9 = global$o;
473
- var isObject$2 = isObject$6;
473
+ var isObject$3 = isObject$7;
474
474
 
475
475
  var String$1 = global$9.String;
476
476
  var TypeError$3 = global$9.TypeError;
477
477
 
478
478
  // `Assert: Type(argument) is Object`
479
479
  var anObject$4 = function (argument) {
480
- if (isObject$2(argument)) return argument;
480
+ if (isObject$3(argument)) return argument;
481
481
  throw TypeError$3(String$1(argument) + ' is not an object');
482
482
  };var global$8 = global$o;
483
- var DESCRIPTORS$4 = descriptors;
483
+ var DESCRIPTORS$5 = descriptors;
484
484
  var IE8_DOM_DEFINE = ie8DomDefine;
485
485
  var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
486
486
  var anObject$3 = anObject$4;
@@ -497,7 +497,7 @@ var WRITABLE = 'writable';
497
497
 
498
498
  // `Object.defineProperty` method
499
499
  // https://tc39.es/ecma262/#sec-object.defineproperty
500
- var f$3 = objectDefineProperty.f = DESCRIPTORS$4 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
500
+ var f$3 = objectDefineProperty.f = DESCRIPTORS$5 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
501
501
  anObject$3(O);
502
502
  P = toPropertyKey(P);
503
503
  anObject$3(Attributes);
@@ -522,35 +522,35 @@ var f$3 = objectDefineProperty.f = DESCRIPTORS$4 ? V8_PROTOTYPE_DEFINE_BUG$1 ? f
522
522
  if ('get' in Attributes || 'set' in Attributes) throw TypeError$2('Accessors not supported');
523
523
  if ('value' in Attributes) O[P] = Attributes.value;
524
524
  return O;
525
- };var DESCRIPTORS$3 = descriptors;
525
+ };var DESCRIPTORS$4 = descriptors;
526
526
  var definePropertyModule$3 = objectDefineProperty;
527
527
  var createPropertyDescriptor = createPropertyDescriptor$2;
528
528
 
529
- var createNonEnumerableProperty$4 = DESCRIPTORS$3 ? function (object, key, value) {
529
+ var createNonEnumerableProperty$4 = DESCRIPTORS$4 ? function (object, key, value) {
530
530
  return definePropertyModule$3.f(object, key, createPropertyDescriptor(1, value));
531
531
  } : function (object, key, value) {
532
532
  object[key] = value;
533
533
  return object;
534
- };var redefine$3 = {exports: {}};var uncurryThis$7 = functionUncurryThis;
535
- var isCallable$5 = isCallable$b;
534
+ };var redefine$3 = {exports: {}};var uncurryThis$8 = functionUncurryThis;
535
+ var isCallable$6 = isCallable$c;
536
536
  var store$1 = sharedStore;
537
537
 
538
- var functionToString = uncurryThis$7(Function.toString);
538
+ var functionToString$1 = uncurryThis$8(Function.toString);
539
539
 
540
540
  // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
541
- if (!isCallable$5(store$1.inspectSource)) {
541
+ if (!isCallable$6(store$1.inspectSource)) {
542
542
  store$1.inspectSource = function (it) {
543
- return functionToString(it);
543
+ return functionToString$1(it);
544
544
  };
545
545
  }
546
546
 
547
547
  var inspectSource$3 = store$1.inspectSource;var global$7 = global$o;
548
- var isCallable$4 = isCallable$b;
548
+ var isCallable$5 = isCallable$c;
549
549
  var inspectSource$2 = inspectSource$3;
550
550
 
551
551
  var WeakMap$1 = global$7.WeakMap;
552
552
 
553
- var nativeWeakMap = isCallable$4(WeakMap$1) && /native code/.test(inspectSource$2(WeakMap$1));var shared$1 = shared$4.exports;
553
+ var nativeWeakMap = isCallable$5(WeakMap$1) && /native code/.test(inspectSource$2(WeakMap$1));var shared$1 = shared$4.exports;
554
554
  var uid = uid$2;
555
555
 
556
556
  var keys = shared$1('keys');
@@ -559,8 +559,8 @@ var sharedKey$2 = function (key) {
559
559
  return keys[key] || (keys[key] = uid(key));
560
560
  };var hiddenKeys$4 = {};var NATIVE_WEAK_MAP = nativeWeakMap;
561
561
  var global$6 = global$o;
562
- var uncurryThis$6 = functionUncurryThis;
563
- var isObject$1 = isObject$6;
562
+ var uncurryThis$7 = functionUncurryThis;
563
+ var isObject$2 = isObject$7;
564
564
  var createNonEnumerableProperty$3 = createNonEnumerableProperty$4;
565
565
  var hasOwn$4 = hasOwnProperty_1;
566
566
  var shared = sharedStore;
@@ -570,16 +570,16 @@ var hiddenKeys$3 = hiddenKeys$4;
570
570
  var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
571
571
  var TypeError$1 = global$6.TypeError;
572
572
  var WeakMap = global$6.WeakMap;
573
- var set, get, has;
573
+ var set$1, get, has;
574
574
 
575
575
  var enforce = function (it) {
576
- return has(it) ? get(it) : set(it, {});
576
+ return has(it) ? get(it) : set$1(it, {});
577
577
  };
578
578
 
579
579
  var getterFor = function (TYPE) {
580
580
  return function (it) {
581
581
  var state;
582
- if (!isObject$1(it) || (state = get(it)).type !== TYPE) {
582
+ if (!isObject$2(it) || (state = get(it)).type !== TYPE) {
583
583
  throw TypeError$1('Incompatible receiver, ' + TYPE + ' required');
584
584
  } return state;
585
585
  };
@@ -587,10 +587,10 @@ var getterFor = function (TYPE) {
587
587
 
588
588
  if (NATIVE_WEAK_MAP || shared.state) {
589
589
  var store = shared.state || (shared.state = new WeakMap());
590
- var wmget = uncurryThis$6(store.get);
591
- var wmhas = uncurryThis$6(store.has);
592
- var wmset = uncurryThis$6(store.set);
593
- set = function (it, metadata) {
590
+ var wmget = uncurryThis$7(store.get);
591
+ var wmhas = uncurryThis$7(store.has);
592
+ var wmset = uncurryThis$7(store.set);
593
+ set$1 = function (it, metadata) {
594
594
  if (wmhas(store, it)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
595
595
  metadata.facade = it;
596
596
  wmset(store, it, metadata);
@@ -605,7 +605,7 @@ if (NATIVE_WEAK_MAP || shared.state) {
605
605
  } else {
606
606
  var STATE = sharedKey$1('state');
607
607
  hiddenKeys$3[STATE] = true;
608
- set = function (it, metadata) {
608
+ set$1 = function (it, metadata) {
609
609
  if (hasOwn$4(it, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
610
610
  metadata.facade = it;
611
611
  createNonEnumerableProperty$3(it, STATE, metadata);
@@ -620,29 +620,29 @@ if (NATIVE_WEAK_MAP || shared.state) {
620
620
  }
621
621
 
622
622
  var internalState = {
623
- set: set,
623
+ set: set$1,
624
624
  get: get,
625
625
  has: has,
626
626
  enforce: enforce,
627
627
  getterFor: getterFor
628
- };var DESCRIPTORS$2 = descriptors;
628
+ };var DESCRIPTORS$3 = descriptors;
629
629
  var hasOwn$3 = hasOwnProperty_1;
630
630
 
631
- var FunctionPrototype = Function.prototype;
631
+ var FunctionPrototype$1 = Function.prototype;
632
632
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
633
- var getDescriptor = DESCRIPTORS$2 && Object.getOwnPropertyDescriptor;
633
+ var getDescriptor = DESCRIPTORS$3 && Object.getOwnPropertyDescriptor;
634
634
 
635
- var EXISTS = hasOwn$3(FunctionPrototype, 'name');
635
+ var EXISTS = hasOwn$3(FunctionPrototype$1, 'name');
636
636
  // additional protection from minified / mangled / dropped function names
637
637
  var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
638
- var CONFIGURABLE = EXISTS && (!DESCRIPTORS$2 || (DESCRIPTORS$2 && getDescriptor(FunctionPrototype, 'name').configurable));
638
+ var CONFIGURABLE = EXISTS && (!DESCRIPTORS$3 || (DESCRIPTORS$3 && getDescriptor(FunctionPrototype$1, 'name').configurable));
639
639
 
640
640
  var functionName = {
641
641
  EXISTS: EXISTS,
642
642
  PROPER: PROPER,
643
643
  CONFIGURABLE: CONFIGURABLE
644
644
  };var global$5 = global$o;
645
- var isCallable$3 = isCallable$b;
645
+ var isCallable$4 = isCallable$c;
646
646
  var hasOwn$2 = hasOwnProperty_1;
647
647
  var createNonEnumerableProperty$2 = createNonEnumerableProperty$4;
648
648
  var setGlobal$1 = setGlobal$3;
@@ -660,7 +660,7 @@ var TEMPLATE = String(String).split('String');
660
660
  var noTargetGet = options ? !!options.noTargetGet : false;
661
661
  var name = options && options.name !== undefined ? options.name : key;
662
662
  var state;
663
- if (isCallable$3(value)) {
663
+ if (isCallable$4(value)) {
664
664
  if (String(name).slice(0, 7) === 'Symbol(') {
665
665
  name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
666
666
  }
@@ -685,7 +685,7 @@ var TEMPLATE = String(String).split('String');
685
685
  else createNonEnumerableProperty$2(O, key, value);
686
686
  // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
687
687
  })(Function.prototype, 'toString', function toString() {
688
- return isCallable$3(this) && getInternalState(this).source || inspectSource$1(this);
688
+ return isCallable$4(this) && getInternalState(this).source || inspectSource$1(this);
689
689
  });
690
690
 
691
691
  var redefine$2 = redefine$3.exports;var objectGetOwnPropertyNames = {};var ceil = Math.ceil;
@@ -753,13 +753,13 @@ var arrayIncludes = {
753
753
  // `Array.prototype.indexOf` method
754
754
  // https://tc39.es/ecma262/#sec-array.prototype.indexof
755
755
  indexOf: createMethod$2(false)
756
- };var uncurryThis$5 = functionUncurryThis;
756
+ };var uncurryThis$6 = functionUncurryThis;
757
757
  var hasOwn$1 = hasOwnProperty_1;
758
758
  var toIndexedObject$2 = toIndexedObject$5;
759
759
  var indexOf = arrayIncludes.indexOf;
760
760
  var hiddenKeys$2 = hiddenKeys$4;
761
761
 
762
- var push$2 = uncurryThis$5([].push);
762
+ var push$2 = uncurryThis$6([].push);
763
763
 
764
764
  var objectKeysInternal = function (object, names) {
765
765
  var O = toIndexedObject$2(object);
@@ -793,12 +793,12 @@ var f$2 = objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function g
793
793
  return internalObjectKeys$1(O, hiddenKeys$1);
794
794
  };var objectGetOwnPropertySymbols = {};// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
795
795
  var f$1 = objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;var getBuiltIn$2 = getBuiltIn$5;
796
- var uncurryThis$4 = functionUncurryThis;
796
+ var uncurryThis$5 = functionUncurryThis;
797
797
  var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
798
798
  var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
799
799
  var anObject$2 = anObject$4;
800
800
 
801
- var concat = uncurryThis$4([].concat);
801
+ var concat = uncurryThis$5([].concat);
802
802
 
803
803
  // all object keys, includes non-enumerable and symbols
804
804
  var ownKeys$1 = getBuiltIn$2('Reflect', 'ownKeys') || function ownKeys(it) {
@@ -821,7 +821,7 @@ var copyConstructorProperties$1 = function (target, source, exceptions) {
821
821
  }
822
822
  }
823
823
  };var fails$2 = fails$9;
824
- var isCallable$2 = isCallable$b;
824
+ var isCallable$3 = isCallable$c;
825
825
 
826
826
  var replacement = /#|\.prototype\./;
827
827
 
@@ -829,7 +829,7 @@ var isForced$1 = function (feature, detection) {
829
829
  var value = data[normalize(feature)];
830
830
  return value == POLYFILL ? true
831
831
  : value == NATIVE ? false
832
- : isCallable$2(detection) ? fails$2(detection)
832
+ : isCallable$3(detection) ? fails$2(detection)
833
833
  : !!detection;
834
834
  };
835
835
 
@@ -895,11 +895,11 @@ var _export = function (options, source) {
895
895
  // extend global
896
896
  redefine$1(target, key, sourceProperty, options);
897
897
  }
898
- };var uncurryThis$3 = functionUncurryThis;
898
+ };var uncurryThis$4 = functionUncurryThis;
899
899
  var aCallable = aCallable$2;
900
900
  var NATIVE_BIND = functionBindNative;
901
901
 
902
- var bind$1 = uncurryThis$3(uncurryThis$3.bind);
902
+ var bind$1 = uncurryThis$4(uncurryThis$4.bind);
903
903
 
904
904
  // optional / simple context binding
905
905
  var functionBindContext = function (fn, that) {
@@ -923,7 +923,7 @@ test[TO_STRING_TAG$1] = 'z';
923
923
 
924
924
  var toStringTagSupport = String(test) === '[object z]';var global$3 = global$o;
925
925
  var TO_STRING_TAG_SUPPORT$2 = toStringTagSupport;
926
- var isCallable$1 = isCallable$b;
926
+ var isCallable$2 = isCallable$c;
927
927
  var classofRaw = classofRaw$1;
928
928
  var wellKnownSymbol$2 = wellKnownSymbol$5;
929
929
 
@@ -949,10 +949,10 @@ var classof$2 = TO_STRING_TAG_SUPPORT$2 ? classofRaw : function (it) {
949
949
  // builtinTag case
950
950
  : CORRECT_ARGUMENTS ? classofRaw(O)
951
951
  // ES3 arguments fallback
952
- : (result = classofRaw(O)) == 'Object' && isCallable$1(O.callee) ? 'Arguments' : result;
953
- };var uncurryThis$2 = functionUncurryThis;
952
+ : (result = classofRaw(O)) == 'Object' && isCallable$2(O.callee) ? 'Arguments' : result;
953
+ };var uncurryThis$3 = functionUncurryThis;
954
954
  var fails$1 = fails$9;
955
- var isCallable = isCallable$b;
955
+ var isCallable$1 = isCallable$c;
956
956
  var classof$1 = classof$2;
957
957
  var getBuiltIn$1 = getBuiltIn$5;
958
958
  var inspectSource = inspectSource$3;
@@ -961,11 +961,11 @@ var noop = function () { /* empty */ };
961
961
  var empty = [];
962
962
  var construct = getBuiltIn$1('Reflect', 'construct');
963
963
  var constructorRegExp = /^\s*(?:class|function)\b/;
964
- var exec = uncurryThis$2(constructorRegExp.exec);
964
+ var exec = uncurryThis$3(constructorRegExp.exec);
965
965
  var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
966
966
 
967
967
  var isConstructorModern = function isConstructor(argument) {
968
- if (!isCallable(argument)) return false;
968
+ if (!isCallable$1(argument)) return false;
969
969
  try {
970
970
  construct(noop, empty, argument);
971
971
  return true;
@@ -975,7 +975,7 @@ var isConstructorModern = function isConstructor(argument) {
975
975
  };
976
976
 
977
977
  var isConstructorLegacy = function isConstructor(argument) {
978
- if (!isCallable(argument)) return false;
978
+ if (!isCallable$1(argument)) return false;
979
979
  switch (classof$1(argument)) {
980
980
  case 'AsyncFunction':
981
981
  case 'GeneratorFunction':
@@ -1004,7 +1004,7 @@ var isConstructor$1 = !construct || fails$1(function () {
1004
1004
  }) ? isConstructorLegacy : isConstructorModern;var global$2 = global$o;
1005
1005
  var isArray = isArray$1;
1006
1006
  var isConstructor = isConstructor$1;
1007
- var isObject = isObject$6;
1007
+ var isObject$1 = isObject$7;
1008
1008
  var wellKnownSymbol$1 = wellKnownSymbol$5;
1009
1009
 
1010
1010
  var SPECIES = wellKnownSymbol$1('species');
@@ -1018,7 +1018,7 @@ var arraySpeciesConstructor$1 = function (originalArray) {
1018
1018
  C = originalArray.constructor;
1019
1019
  // cross-realm fallback
1020
1020
  if (isConstructor(C) && (C === Array$1 || isArray(C.prototype))) C = undefined;
1021
- else if (isObject(C)) {
1021
+ else if (isObject$1(C)) {
1022
1022
  C = C[SPECIES];
1023
1023
  if (C === null) C = undefined;
1024
1024
  }
@@ -1030,13 +1030,13 @@ var arraySpeciesConstructor$1 = function (originalArray) {
1030
1030
  var arraySpeciesCreate$1 = function (originalArray, length) {
1031
1031
  return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
1032
1032
  };var bind = functionBindContext;
1033
- var uncurryThis$1 = functionUncurryThis;
1033
+ var uncurryThis$2 = functionUncurryThis;
1034
1034
  var IndexedObject = indexedObject;
1035
1035
  var toObject = toObject$2;
1036
1036
  var lengthOfArrayLike = lengthOfArrayLike$2;
1037
1037
  var arraySpeciesCreate = arraySpeciesCreate$1;
1038
1038
 
1039
- var push$1 = uncurryThis$1([].push);
1039
+ var push$1 = uncurryThis$2([].push);
1040
1040
 
1041
1041
  // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
1042
1042
  var createMethod$1 = function (TYPE) {
@@ -1215,14 +1215,14 @@ var enumBugKeys$1 = enumBugKeys$3;
1215
1215
  // eslint-disable-next-line es/no-object-keys -- safe
1216
1216
  var objectKeys$2 = Object.keys || function keys(O) {
1217
1217
  return internalObjectKeys(O, enumBugKeys$1);
1218
- };var DESCRIPTORS$1 = descriptors;
1219
- var uncurryThis = functionUncurryThis;
1218
+ };var DESCRIPTORS$2 = descriptors;
1219
+ var uncurryThis$1 = functionUncurryThis;
1220
1220
  var objectKeys$1 = objectKeys$2;
1221
1221
  var toIndexedObject$1 = toIndexedObject$5;
1222
1222
  var $propertyIsEnumerable = objectPropertyIsEnumerable.f;
1223
1223
 
1224
- var propertyIsEnumerable = uncurryThis($propertyIsEnumerable);
1225
- var push = uncurryThis([].push);
1224
+ var propertyIsEnumerable = uncurryThis$1($propertyIsEnumerable);
1225
+ var push = uncurryThis$1([].push);
1226
1226
 
1227
1227
  // `Object.{ entries, values }` methods implementation
1228
1228
  var createMethod = function (TO_ENTRIES) {
@@ -1235,7 +1235,7 @@ var createMethod = function (TO_ENTRIES) {
1235
1235
  var key;
1236
1236
  while (length > i) {
1237
1237
  key = keys[i++];
1238
- if (!DESCRIPTORS$1 || propertyIsEnumerable(O, key)) {
1238
+ if (!DESCRIPTORS$2 || propertyIsEnumerable(O, key)) {
1239
1239
  push(result, TO_ENTRIES ? [key, O[key]] : O[key]);
1240
1240
  }
1241
1241
  }
@@ -1259,7 +1259,7 @@ $$1({ target: 'Object', stat: true }, {
1259
1259
  entries: function entries(O) {
1260
1260
  return $entries(O);
1261
1261
  }
1262
- });var script$2 = vue.defineComponent({
1262
+ });var script$3 = vue.defineComponent({
1263
1263
  name: 'FwCard',
1264
1264
  props: {
1265
1265
  /**
@@ -1274,29 +1274,58 @@ $$1({ target: 'Object', stat: true }, {
1274
1274
  */
1275
1275
  prefixTitle: {
1276
1276
  type: String
1277
- }
1277
+ },
1278
+
1279
+ /**
1280
+ * A `router-link` path or object
1281
+ */
1282
+ to: {
1283
+ type: [String, Object]
1284
+ },
1285
+
1286
+ /**
1287
+ * A URL to link to using a native anchor element
1288
+ */
1289
+ href: String
1290
+ },
1291
+ setup: function setup(props) {
1292
+ var componentName = vue.computed(function () {
1293
+ if (props.to) return 'router-link';
1294
+ if (props.href) return 'a';
1295
+ return 'div';
1296
+ });
1297
+ return {
1298
+ componentName: componentName
1299
+ };
1278
1300
  }
1279
- });var _hoisted_1$1 = {
1280
- "class": "fw-card shadow rounded-lg"
1281
- };
1282
- var _hoisted_2$1 = {
1301
+ });var _hoisted_1$2 = {
1283
1302
  key: 0,
1284
1303
  "class": "fw-card--header text-lg px-8 py-4 font-bold bg-grey-lightest rounded-t-lg border-opacity-0"
1285
1304
  };
1286
- var _hoisted_3$1 = {
1305
+ var _hoisted_2$2 = {
1287
1306
  key: 0,
1288
1307
  "class": "fw-card--prefix-title text-primary"
1289
1308
  };
1290
- var _hoisted_4$1 = {
1309
+ var _hoisted_3$2 = {
1291
1310
  key: 1
1292
1311
  };
1293
- var _hoisted_5$1 = {
1312
+ var _hoisted_4$2 = {
1294
1313
  key: 1,
1295
1314
  "class": "p-8"
1296
1315
  };
1297
- function render$2(_ctx, _cache, $props, $setup, $data, $options) {
1298
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [_ctx.title || _ctx.prefixTitle ? (vue.openBlock(), vue.createElementBlock("h4", _hoisted_2$1, [_ctx.prefixTitle ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$1, vue.toDisplayString(_ctx.prefixTitle), 1)) : vue.createCommentVNode("", true), _ctx.title ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$1, vue.toDisplayString(_ctx.title), 1)) : vue.createCommentVNode("", true)])) : vue.createCommentVNode("", true), _ctx.$slots["default"] ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$1, [vue.renderSlot(_ctx.$slots, "default")])) : vue.createCommentVNode("", true)]);
1299
- }script$2.render = render$2;var es_array_includes = {};var objectDefineProperties = {};var DESCRIPTORS = descriptors;
1316
+ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
1317
+ return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.componentName), {
1318
+ to: _ctx.to ? _ctx.to : null,
1319
+ href: _ctx.href ? _ctx.href : null,
1320
+ tabindex: _ctx.to ? 0 : null,
1321
+ "class": vue.normalizeClass(["fw-card shadow-card rounded-lg", _ctx.to || _ctx.href ? 'block cursor-pointer focus:outline-none ring-offset-3 focus:ring focus:ring-primary transform-none transition-transform hover:-translate-y-1' : ''])
1322
+ }, {
1323
+ "default": vue.withCtx(function () {
1324
+ return [_ctx.title || _ctx.prefixTitle ? (vue.openBlock(), vue.createElementBlock("h4", _hoisted_1$2, [_ctx.prefixTitle ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$2, vue.toDisplayString(_ctx.prefixTitle), 1)) : vue.createCommentVNode("", true), _ctx.title ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$2, vue.toDisplayString(_ctx.title), 1)) : vue.createCommentVNode("", true)])) : vue.createCommentVNode("", true), _ctx.$slots["default"] ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$2, [vue.renderSlot(_ctx.$slots, "default")])) : vue.createCommentVNode("", true)];
1325
+ }),
1326
+ _: 3
1327
+ }, 8, ["to", "href", "tabindex", "class"]);
1328
+ }script$3.render = render$3;var es_array_includes = {};var objectDefineProperties = {};var DESCRIPTORS$1 = descriptors;
1300
1329
  var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
1301
1330
  var definePropertyModule$1 = objectDefineProperty;
1302
1331
  var anObject$1 = anObject$4;
@@ -1306,7 +1335,7 @@ var objectKeys = objectKeys$2;
1306
1335
  // `Object.defineProperties` method
1307
1336
  // https://tc39.es/ecma262/#sec-object.defineproperties
1308
1337
  // eslint-disable-next-line es/no-object-defineproperties -- safe
1309
- var f = objectDefineProperties.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1338
+ var f = objectDefineProperties.f = DESCRIPTORS$1 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1310
1339
  anObject$1(O);
1311
1340
  var props = toIndexedObject(Properties);
1312
1341
  var keys = objectKeys(Properties);
@@ -1432,7 +1461,7 @@ $({ target: 'Array', proto: true }, {
1432
1461
  });
1433
1462
 
1434
1463
  // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1435
- addToUnscopables('includes');var script$1 = vue.defineComponent({
1464
+ addToUnscopables('includes');var script$2 = vue.defineComponent({
1436
1465
  name: 'FwButton',
1437
1466
  emits: ['click', 'mouseover', 'mouseout', 'focusin', 'focusout'],
1438
1467
  props: {
@@ -1581,12 +1610,13 @@ addToUnscopables('includes');var script$1 = vue.defineComponent({
1581
1610
  tagName: tagName
1582
1611
  };
1583
1612
  }
1584
- });function render$1(_ctx, _cache, $props, $setup, $data, $options) {
1613
+ });function render$2(_ctx, _cache, $props, $setup, $data, $options) {
1585
1614
  return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tagName), {
1586
1615
  "class": vue.normalizeClass(["fw-button font-bold cursor-pointer whitespace-nowrap rounded-full border-2 focus:outline-none ring-offset-2 focus:ring", [_ctx.textColorClass, _ctx.bgColorClass, _ctx.sizeClass, _ctx.borderClass]]),
1587
1616
  type: _ctx.tagName === 'button' ? _ctx.tagName : null,
1588
- to: _ctx.to,
1589
- href: _ctx.href,
1617
+ to: _ctx.to ? _ctx.to : null,
1618
+ href: _ctx.href ? _ctx.href : null,
1619
+ tabindex: _ctx.to ? 0 : null,
1590
1620
  onClick: _ctx.onClick,
1591
1621
  onFocusin: _ctx.onFocusin,
1592
1622
  onFocusout: _ctx.onFocusout,
@@ -1597,12 +1627,39 @@ addToUnscopables('includes');var script$1 = vue.defineComponent({
1597
1627
  return [vue.renderSlot(_ctx.$slots, "default")];
1598
1628
  }),
1599
1629
  _: 3
1600
- }, 8, ["class", "type", "to", "href", "onClick", "onFocusin", "onFocusout", "onMouseover", "onMouseout"]);
1601
- }script$1.render = render$1;var script = vue.defineComponent({
1630
+ }, 8, ["class", "type", "to", "href", "tabindex", "onClick", "onFocusin", "onFocusout", "onMouseover", "onMouseout"]);
1631
+ }function styleInject(css, ref) {
1632
+ if ( ref === void 0 ) ref = {};
1633
+ var insertAt = ref.insertAt;
1634
+
1635
+ if (!css || typeof document === 'undefined') { return; }
1636
+
1637
+ var head = document.head || document.getElementsByTagName('head')[0];
1638
+ var style = document.createElement('style');
1639
+ style.type = 'text/css';
1640
+
1641
+ if (insertAt === 'top') {
1642
+ if (head.firstChild) {
1643
+ head.insertBefore(style, head.firstChild);
1644
+ } else {
1645
+ head.appendChild(style);
1646
+ }
1647
+ } else {
1648
+ head.appendChild(style);
1649
+ }
1650
+
1651
+ if (style.styleSheet) {
1652
+ style.styleSheet.cssText = css;
1653
+ } else {
1654
+ style.appendChild(document.createTextNode(css));
1655
+ }
1656
+ }var css_248z$2 = ".fw-button{-webkit-transition:all .25s ease-in;-o-transition:all .25s ease-in;transition:all .25s ease-in}";
1657
+ var stylesheet$2 = ".fw-button{-webkit-transition:all .25s ease-in;-o-transition:all .25s ease-in;transition:all .25s ease-in}";
1658
+ styleInject(css_248z$2);script$2.render = render$2;var script$1 = vue.defineComponent({
1602
1659
  name: 'FwNavigationMenu',
1603
1660
  emits: ['action'],
1604
1661
  components: {
1605
- FwButton: script$1
1662
+ FwButton: script$2
1606
1663
  },
1607
1664
  props: {
1608
1665
  /**
@@ -1638,36 +1695,36 @@ addToUnscopables('includes');var script$1 = vue.defineComponent({
1638
1695
  actionClicked: actionClicked
1639
1696
  };
1640
1697
  }
1641
- });var _hoisted_1 = {
1698
+ });var _hoisted_1$1 = {
1642
1699
  "class": "fw-nav-menu relative z-50 h-20 shadow-md"
1643
1700
  };
1644
- var _hoisted_2 = {
1701
+ var _hoisted_2$1 = {
1645
1702
  "class": "px-6 flex-1 h-full flex bg-white items-stretch justify-between"
1646
1703
  };
1647
- var _hoisted_3 = {
1704
+ var _hoisted_3$1 = {
1648
1705
  key: 0,
1649
1706
  "class": "flex-shrink-0 flex items-center"
1650
1707
  };
1651
- var _hoisted_4 = {
1708
+ var _hoisted_4$1 = {
1652
1709
  key: 1,
1653
1710
  "class": "container hidden sm:flex items-center justify-start sm:ml-6"
1654
1711
  };
1655
- var _hoisted_5 = {
1712
+ var _hoisted_5$1 = {
1656
1713
  "class": "flex space-x-2"
1657
1714
  };
1658
- var _hoisted_6 = {
1715
+ var _hoisted_6$1 = {
1659
1716
  key: 2,
1660
1717
  "class": "hidden sm:flex items-center justify-start sm:ml-6"
1661
1718
  };
1662
- var _hoisted_7 = {
1719
+ var _hoisted_7$1 = {
1663
1720
  "class": "flex items-center sm:hidden"
1664
1721
  };
1665
1722
 
1666
- var _hoisted_8 = /*#__PURE__*/vue.createElementVNode("span", {
1723
+ var _hoisted_8$1 = /*#__PURE__*/vue.createElementVNode("span", {
1667
1724
  "class": "sr-only"
1668
1725
  }, "Open main menu", -1);
1669
1726
 
1670
- var _hoisted_9 = {
1727
+ var _hoisted_9$1 = {
1671
1728
  "class": "block h-6 w-6",
1672
1729
  xmlns: "http://www.w3.org/2000/svg",
1673
1730
  fill: "none",
@@ -1675,7 +1732,7 @@ var _hoisted_9 = {
1675
1732
  stroke: "currentColor",
1676
1733
  "aria-hidden": "true"
1677
1734
  };
1678
- var _hoisted_10 = ["d"];
1735
+ var _hoisted_10$1 = ["d"];
1679
1736
  var _hoisted_11 = {
1680
1737
  key: 0,
1681
1738
  "class": "fw-nav-menu--mobile min-h-screen top-0 left-0 pt-20 absolute w-full flex flex-col justify-between px-2 bg-white shadow-md pb-3 space-y-1"
@@ -1683,12 +1740,12 @@ var _hoisted_11 = {
1683
1740
  var _hoisted_12 = {
1684
1741
  "class": "w-full flex flex-col"
1685
1742
  };
1686
- function render(_ctx, _cache, $props, $setup, $data, $options) {
1743
+ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
1687
1744
  var _ctx$menuItems;
1688
1745
 
1689
1746
  var _component_FwButton = vue.resolveComponent("FwButton");
1690
1747
 
1691
- return vue.openBlock(), vue.createElementBlock("nav", _hoisted_1, [vue.createElementVNode("div", _hoisted_2, [_ctx.$slots.logo ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, [vue.renderSlot(_ctx.$slots, "logo")])) : vue.createCommentVNode("", true), ((_ctx$menuItems = _ctx.menuItems) === null || _ctx$menuItems === void 0 ? void 0 : _ctx$menuItems.length) > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4, [vue.createElementVNode("div", _hoisted_5, [(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menuItems, function (item, i) {
1748
+ return vue.openBlock(), vue.createElementBlock("nav", _hoisted_1$1, [vue.createElementVNode("div", _hoisted_2$1, [_ctx.$slots.logo ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$1, [vue.renderSlot(_ctx.$slots, "logo")])) : vue.createCommentVNode("", true), ((_ctx$menuItems = _ctx.menuItems) === null || _ctx$menuItems === void 0 ? void 0 : _ctx$menuItems.length) > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1, [vue.createElementVNode("div", _hoisted_5$1, [(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menuItems, function (item, i) {
1692
1749
  return vue.openBlock(), vue.createBlock(_component_FwButton, {
1693
1750
  key: i,
1694
1751
  variant: "text",
@@ -1702,7 +1759,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1702
1759
  }),
1703
1760
  _: 2
1704
1761
  }, 1032, ["href", "to"]);
1705
- }), 128))])])) : vue.createCommentVNode("", true), _ctx.actionLabel ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [vue.createVNode(_component_FwButton, {
1762
+ }), 128))])])) : vue.createCommentVNode("", true), _ctx.actionLabel ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$1, [vue.createVNode(_component_FwButton, {
1706
1763
  onClick: _ctx.actionClicked,
1707
1764
  size: "md",
1708
1765
  "aria-label": _ctx.actionLabel
@@ -1711,18 +1768,18 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1711
1768
  return [vue.createTextVNode(vue.toDisplayString(_ctx.actionLabel), 1)];
1712
1769
  }),
1713
1770
  _: 1
1714
- }, 8, ["onClick", "aria-label"])])) : vue.createCommentVNode("", true), vue.createElementVNode("div", _hoisted_7, [vue.createVNode(_component_FwButton, {
1771
+ }, 8, ["onClick", "aria-label"])])) : vue.createCommentVNode("", true), vue.createElementVNode("div", _hoisted_7$1, [vue.createVNode(_component_FwButton, {
1715
1772
  variant: "text",
1716
1773
  size: "sm",
1717
1774
  onClick: _ctx.toggleMobileMenu
1718
1775
  }, {
1719
1776
  "default": vue.withCtx(function () {
1720
- return [_hoisted_8, (vue.openBlock(), vue.createElementBlock("svg", _hoisted_9, [vue.createElementVNode("path", {
1777
+ return [_hoisted_8$1, (vue.openBlock(), vue.createElementBlock("svg", _hoisted_9$1, [vue.createElementVNode("path", {
1721
1778
  "stroke-linecap": "round",
1722
1779
  "stroke-linejoin": "round",
1723
1780
  "stroke-width": "2",
1724
1781
  d: _ctx.isMobileMenuOpen ? 'M6 18L18 6M6 6l12 12' : 'M4 6h16M4 12h16M4 18h16'
1725
- }, null, 8, _hoisted_10)]))];
1782
+ }, null, 8, _hoisted_10$1)]))];
1726
1783
  }),
1727
1784
  _: 1
1728
1785
  }, 8, ["onClick"])])]), vue.createVNode(vue.Transition, {
@@ -1760,34 +1817,3308 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1760
1817
  }),
1761
1818
  _: 1
1762
1819
  })]);
1763
- }function styleInject(css, ref) {
1764
- if ( ref === void 0 ) ref = {};
1765
- var insertAt = ref.insertAt;
1820
+ }var css_248z$1 = ".fw-nav-menu--mobile{z-index:-1}.fw-nav-menu--mobile,.slideInLeft-enter-active{-webkit-transition:left .35s ease-in;-o-transition:left .35s ease-in;transition:left .35s ease-in}.slideInLeft-enter-active{-webkit-animation:slideInLeft .35s;animation:slideInLeft .35s}.slideInLeft-leave-active{animation:slideInLeft .35s reverse;-webkit-transition:left .35s ease-in-out;-o-transition:left .35s ease-in-out;transition:left .35s ease-in-out}@-webkit-keyframes slideInLeft{0%{left:100%}to{left:0}}@keyframes slideInLeft{0%{left:100%}to{left:0}}";
1821
+ var stylesheet$1 = ".fw-nav-menu--mobile{z-index:-1}.fw-nav-menu--mobile,.slideInLeft-enter-active{-webkit-transition:left .35s ease-in;-o-transition:left .35s ease-in;transition:left .35s ease-in}.slideInLeft-enter-active{-webkit-animation:slideInLeft .35s;animation:slideInLeft .35s}.slideInLeft-leave-active{animation:slideInLeft .35s reverse;-webkit-transition:left .35s ease-in-out;-o-transition:left .35s ease-in-out;transition:left .35s ease-in-out}@-webkit-keyframes slideInLeft{0%{left:100%}to{left:0}}@keyframes slideInLeft{0%{left:100%}to{left:0}}";
1822
+ styleInject(css_248z$1);script$1.render = render$1;function getDevtoolsGlobalHook() {
1823
+ return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
1824
+ }
1825
+ function getTarget() {
1826
+ // @ts-ignore
1827
+ return (typeof navigator !== 'undefined' && typeof window !== 'undefined')
1828
+ ? window
1829
+ : typeof global !== 'undefined'
1830
+ ? global
1831
+ : {};
1832
+ }
1833
+ const isProxyAvailable = typeof Proxy === 'function';const HOOK_SETUP = 'devtools-plugin:setup';
1834
+ const HOOK_PLUGIN_SETTINGS_SET = 'plugin:settings:set';class ApiProxy {
1835
+ constructor(plugin, hook) {
1836
+ this.target = null;
1837
+ this.targetQueue = [];
1838
+ this.onQueue = [];
1839
+ this.plugin = plugin;
1840
+ this.hook = hook;
1841
+ const defaultSettings = {};
1842
+ if (plugin.settings) {
1843
+ for (const id in plugin.settings) {
1844
+ const item = plugin.settings[id];
1845
+ defaultSettings[id] = item.defaultValue;
1846
+ }
1847
+ }
1848
+ const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;
1849
+ let currentSettings = Object.assign({}, defaultSettings);
1850
+ try {
1851
+ const raw = localStorage.getItem(localSettingsSaveId);
1852
+ const data = JSON.parse(raw);
1853
+ Object.assign(currentSettings, data);
1854
+ }
1855
+ catch (e) {
1856
+ // noop
1857
+ }
1858
+ this.fallbacks = {
1859
+ getSettings() {
1860
+ return currentSettings;
1861
+ },
1862
+ setSettings(value) {
1863
+ try {
1864
+ localStorage.setItem(localSettingsSaveId, JSON.stringify(value));
1865
+ }
1866
+ catch (e) {
1867
+ // noop
1868
+ }
1869
+ currentSettings = value;
1870
+ },
1871
+ };
1872
+ if (hook) {
1873
+ hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {
1874
+ if (pluginId === this.plugin.id) {
1875
+ this.fallbacks.setSettings(value);
1876
+ }
1877
+ });
1878
+ }
1879
+ this.proxiedOn = new Proxy({}, {
1880
+ get: (_target, prop) => {
1881
+ if (this.target) {
1882
+ return this.target.on[prop];
1883
+ }
1884
+ else {
1885
+ return (...args) => {
1886
+ this.onQueue.push({
1887
+ method: prop,
1888
+ args,
1889
+ });
1890
+ };
1891
+ }
1892
+ },
1893
+ });
1894
+ this.proxiedTarget = new Proxy({}, {
1895
+ get: (_target, prop) => {
1896
+ if (this.target) {
1897
+ return this.target[prop];
1898
+ }
1899
+ else if (prop === 'on') {
1900
+ return this.proxiedOn;
1901
+ }
1902
+ else if (Object.keys(this.fallbacks).includes(prop)) {
1903
+ return (...args) => {
1904
+ this.targetQueue.push({
1905
+ method: prop,
1906
+ args,
1907
+ resolve: () => { },
1908
+ });
1909
+ return this.fallbacks[prop](...args);
1910
+ };
1911
+ }
1912
+ else {
1913
+ return (...args) => {
1914
+ return new Promise(resolve => {
1915
+ this.targetQueue.push({
1916
+ method: prop,
1917
+ args,
1918
+ resolve,
1919
+ });
1920
+ });
1921
+ };
1922
+ }
1923
+ },
1924
+ });
1925
+ }
1926
+ async setRealTarget(target) {
1927
+ this.target = target;
1928
+ for (const item of this.onQueue) {
1929
+ this.target.on[item.method](...item.args);
1930
+ }
1931
+ for (const item of this.targetQueue) {
1932
+ item.resolve(await this.target[item.method](...item.args));
1933
+ }
1934
+ }
1935
+ }function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
1936
+ const descriptor = pluginDescriptor;
1937
+ const target = getTarget();
1938
+ const hook = getDevtoolsGlobalHook();
1939
+ const enableProxy = isProxyAvailable && descriptor.enableEarlyProxy;
1940
+ if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
1941
+ hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
1942
+ }
1943
+ else {
1944
+ const proxy = enableProxy ? new ApiProxy(descriptor, hook) : null;
1945
+ const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
1946
+ list.push({
1947
+ pluginDescriptor: descriptor,
1948
+ setupFn,
1949
+ proxy,
1950
+ });
1951
+ if (proxy)
1952
+ setupFn(proxy.proxiedTarget);
1953
+ }
1954
+ }/**
1955
+ * vee-validate v4.5.9
1956
+ * (c) 2022 Abdelrahman Awad
1957
+ * @license MIT
1958
+ */
1959
+
1960
+ function isCallable(fn) {
1961
+ return typeof fn === 'function';
1962
+ }
1963
+ function isNullOrUndefined(value) {
1964
+ return value === null || value === undefined;
1965
+ }
1966
+ const isObject = (obj) => obj !== null && !!obj && typeof obj === 'object' && !Array.isArray(obj);
1967
+ function isIndex(value) {
1968
+ return Number(value) >= 0;
1969
+ }
1970
+ function toNumber(value) {
1971
+ const n = parseFloat(value);
1972
+ return isNaN(n) ? value : n;
1973
+ }
1766
1974
 
1767
- if (!css || typeof document === 'undefined') { return; }
1975
+ const RULES = {};
1976
+ /**
1977
+ * Adds a custom validator to the list of validation rules.
1978
+ */
1979
+ function defineRule(id, validator) {
1980
+ // makes sure new rules are properly formatted.
1981
+ guardExtend(id, validator);
1982
+ RULES[id] = validator;
1983
+ }
1984
+ /**
1985
+ * Gets an already defined rule
1986
+ */
1987
+ function resolveRule(id) {
1988
+ return RULES[id];
1989
+ }
1990
+ /**
1991
+ * Guards from extension violations.
1992
+ */
1993
+ function guardExtend(id, validator) {
1994
+ if (isCallable(validator)) {
1995
+ return;
1996
+ }
1997
+ throw new Error(`Extension Error: The validator '${id}' must be a function.`);
1998
+ }
1768
1999
 
1769
- var head = document.head || document.getElementsByTagName('head')[0];
1770
- var style = document.createElement('style');
1771
- style.type = 'text/css';
2000
+ const FormContextKey = Symbol('vee-validate-form');
2001
+ const FieldContextKey = Symbol('vee-validate-field-instance');
2002
+ const IS_ABSENT = Symbol('Default empty value');
2003
+
2004
+ function isLocator(value) {
2005
+ return isCallable(value) && !!value.__locatorRef;
2006
+ }
2007
+ /**
2008
+ * Checks if an tag name is a native HTML tag and not a Vue component
2009
+ */
2010
+ function isHTMLTag(tag) {
2011
+ return ['input', 'textarea', 'select'].includes(tag);
2012
+ }
2013
+ /**
2014
+ * Checks if an input is of type file
2015
+ */
2016
+ function isFileInputNode(tag, attrs) {
2017
+ return isHTMLTag(tag) && attrs.type === 'file';
2018
+ }
2019
+ function isYupValidator(value) {
2020
+ return !!value && isCallable(value.validate);
2021
+ }
2022
+ function hasCheckedAttr(type) {
2023
+ return type === 'checkbox' || type === 'radio';
2024
+ }
2025
+ function isContainerValue(value) {
2026
+ return isObject(value) || Array.isArray(value);
2027
+ }
2028
+ /**
2029
+ * True if the value is an empty object or array
2030
+ */
2031
+ function isEmptyContainer(value) {
2032
+ if (Array.isArray(value)) {
2033
+ return value.length === 0;
2034
+ }
2035
+ return isObject(value) && Object.keys(value).length === 0;
2036
+ }
2037
+ /**
2038
+ * Checks if the path opted out of nested fields using `[fieldName]` syntax
2039
+ */
2040
+ function isNotNestedPath(path) {
2041
+ return /^\[.+\]$/i.test(path);
2042
+ }
2043
+ /**
2044
+ * Checks if an element is a native HTML5 multi-select input element
2045
+ */
2046
+ function isNativeMultiSelect(el) {
2047
+ return isNativeSelect(el) && el.multiple;
2048
+ }
2049
+ /**
2050
+ * Checks if an element is a native HTML5 select input element
2051
+ */
2052
+ function isNativeSelect(el) {
2053
+ return el.tagName === 'SELECT';
2054
+ }
2055
+ /**
2056
+ * Checks if a tag name with attrs object will render a native multi-select element
2057
+ */
2058
+ function isNativeMultiSelectNode(tag, attrs) {
2059
+ // The falsy value array is the values that Vue won't add the `multiple` prop if it has one of these values
2060
+ const hasTruthyBindingValue = ![false, null, undefined, 0].includes(attrs.multiple) && !Number.isNaN(attrs.multiple);
2061
+ return tag === 'select' && 'multiple' in attrs && hasTruthyBindingValue;
2062
+ }
2063
+ /**
2064
+ * Checks if a node should have a `:value` binding or not
2065
+ *
2066
+ * These nodes should not have a value binding
2067
+ * For files, because they are not reactive
2068
+ * For multi-selects because the value binding will reset the value
2069
+ */
2070
+ function shouldHaveValueBinding(tag, attrs) {
2071
+ return isNativeMultiSelectNode(tag, attrs) || isFileInputNode(tag, attrs);
2072
+ }
2073
+ function isFormSubmitEvent(evt) {
2074
+ return isEvent(evt) && evt.target && 'submit' in evt.target;
2075
+ }
2076
+ function isEvent(evt) {
2077
+ if (!evt) {
2078
+ return false;
2079
+ }
2080
+ if (typeof Event !== 'undefined' && isCallable(Event) && evt instanceof Event) {
2081
+ return true;
2082
+ }
2083
+ // this is for IE and Cypress #3161
2084
+ /* istanbul ignore next */
2085
+ if (evt && evt.srcElement) {
2086
+ return true;
2087
+ }
2088
+ return false;
2089
+ }
2090
+ function isPropPresent(obj, prop) {
2091
+ return prop in obj && obj[prop] !== IS_ABSENT;
2092
+ }
1772
2093
 
1773
- if (insertAt === 'top') {
1774
- if (head.firstChild) {
1775
- head.insertBefore(style, head.firstChild);
1776
- } else {
1777
- head.appendChild(style);
2094
+ function cleanupNonNestedPath(path) {
2095
+ if (isNotNestedPath(path)) {
2096
+ return path.replace(/\[|\]/gi, '');
2097
+ }
2098
+ return path;
2099
+ }
2100
+ function getFromPath(object, path, fallback) {
2101
+ if (!object) {
2102
+ return fallback;
2103
+ }
2104
+ if (isNotNestedPath(path)) {
2105
+ return object[cleanupNonNestedPath(path)];
2106
+ }
2107
+ const resolvedValue = (path || '')
2108
+ .split(/\.|\[(\d+)\]/)
2109
+ .filter(Boolean)
2110
+ .reduce((acc, propKey) => {
2111
+ if (isContainerValue(acc) && propKey in acc) {
2112
+ return acc[propKey];
2113
+ }
2114
+ return fallback;
2115
+ }, object);
2116
+ return resolvedValue;
2117
+ }
2118
+ /**
2119
+ * Sets a nested property value in a path, creates the path properties if it doesn't exist
2120
+ */
2121
+ function setInPath(object, path, value) {
2122
+ if (isNotNestedPath(path)) {
2123
+ object[cleanupNonNestedPath(path)] = value;
2124
+ return;
2125
+ }
2126
+ const keys = path.split(/\.|\[(\d+)\]/).filter(Boolean);
2127
+ let acc = object;
2128
+ for (let i = 0; i < keys.length; i++) {
2129
+ // Last key, set it
2130
+ if (i === keys.length - 1) {
2131
+ acc[keys[i]] = value;
2132
+ return;
2133
+ }
2134
+ // Key does not exist, create a container for it
2135
+ if (!(keys[i] in acc) || isNullOrUndefined(acc[keys[i]])) {
2136
+ // container can be either an object or an array depending on the next key if it exists
2137
+ acc[keys[i]] = isIndex(keys[i + 1]) ? [] : {};
2138
+ }
2139
+ acc = acc[keys[i]];
2140
+ }
2141
+ }
2142
+ function unset(object, key) {
2143
+ if (Array.isArray(object) && isIndex(key)) {
2144
+ object.splice(Number(key), 1);
2145
+ return;
2146
+ }
2147
+ if (isObject(object)) {
2148
+ delete object[key];
2149
+ }
2150
+ }
2151
+ /**
2152
+ * Removes a nested property from object
2153
+ */
2154
+ function unsetPath(object, path) {
2155
+ if (isNotNestedPath(path)) {
2156
+ delete object[cleanupNonNestedPath(path)];
2157
+ return;
2158
+ }
2159
+ const keys = path.split(/\.|\[(\d+)\]/).filter(Boolean);
2160
+ let acc = object;
2161
+ for (let i = 0; i < keys.length; i++) {
2162
+ // Last key, unset it
2163
+ if (i === keys.length - 1) {
2164
+ unset(acc, keys[i]);
2165
+ break;
2166
+ }
2167
+ // Key does not exist, exit
2168
+ if (!(keys[i] in acc) || isNullOrUndefined(acc[keys[i]])) {
2169
+ break;
2170
+ }
2171
+ acc = acc[keys[i]];
2172
+ }
2173
+ const pathValues = keys.map((_, idx) => {
2174
+ return getFromPath(object, keys.slice(0, idx).join('.'));
2175
+ });
2176
+ for (let i = pathValues.length - 1; i >= 0; i--) {
2177
+ if (!isEmptyContainer(pathValues[i])) {
2178
+ continue;
2179
+ }
2180
+ if (i === 0) {
2181
+ unset(object, keys[0]);
2182
+ continue;
2183
+ }
2184
+ unset(pathValues[i - 1], keys[i - 1]);
2185
+ }
2186
+ }
2187
+ /**
2188
+ * A typed version of Object.keys
2189
+ */
2190
+ function keysOf(record) {
2191
+ return Object.keys(record);
2192
+ }
2193
+ // Uses same component provide as its own injections
2194
+ // Due to changes in https://github.com/vuejs/vue-next/pull/2424
2195
+ function injectWithSelf(symbol, def = undefined) {
2196
+ const vm = vue.getCurrentInstance();
2197
+ return (vm === null || vm === void 0 ? void 0 : vm.provides[symbol]) || vue.inject(symbol, def);
2198
+ }
2199
+ function warn(message) {
2200
+ vue.warn(`[vee-validate]: ${message}`);
2201
+ }
2202
+ /**
2203
+ * Ensures we deal with a singular field value
2204
+ */
2205
+ function normalizeField(field) {
2206
+ if (Array.isArray(field)) {
2207
+ return field[0];
2208
+ }
2209
+ return field;
2210
+ }
2211
+ function resolveNextCheckboxValue(currentValue, checkedValue, uncheckedValue) {
2212
+ if (Array.isArray(currentValue)) {
2213
+ const newVal = [...currentValue];
2214
+ const idx = newVal.indexOf(checkedValue);
2215
+ idx >= 0 ? newVal.splice(idx, 1) : newVal.push(checkedValue);
2216
+ return newVal;
2217
+ }
2218
+ return currentValue === checkedValue ? uncheckedValue : checkedValue;
2219
+ }
2220
+ /**
2221
+ * Creates a throttled function that only invokes the provided function (`func`) at most once per within a given number of milliseconds
2222
+ * (`limit`)
2223
+ */
2224
+ function throttle(func, limit) {
2225
+ let inThrottle;
2226
+ let lastResult;
2227
+ return function (...args) {
2228
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
2229
+ const context = this;
2230
+ if (!inThrottle) {
2231
+ inThrottle = true;
2232
+ setTimeout(() => (inThrottle = false), limit);
2233
+ lastResult = func.apply(context, args);
2234
+ }
2235
+ return lastResult;
2236
+ };
2237
+ }
2238
+ function debounceAsync(inner, ms = 0) {
2239
+ let timer = null;
2240
+ let resolves = [];
2241
+ return function (...args) {
2242
+ // Run the function after a certain amount of time
2243
+ if (timer) {
2244
+ window.clearTimeout(timer);
2245
+ }
2246
+ timer = window.setTimeout(() => {
2247
+ // Get the result of the inner function, then apply it to the resolve function of
2248
+ // each promise that has been created since the last time the inner function was run
2249
+ const result = inner(...args);
2250
+ resolves.forEach(r => r(result));
2251
+ resolves = [];
2252
+ }, ms);
2253
+ return new Promise(resolve => resolves.push(resolve));
2254
+ };
2255
+ }
2256
+
2257
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2258
+ const normalizeChildren = (tag, context, slotProps) => {
2259
+ if (!context.slots.default) {
2260
+ return context.slots.default;
2261
+ }
2262
+ if (typeof tag === 'string' || !tag) {
2263
+ return context.slots.default(slotProps());
2264
+ }
2265
+ return {
2266
+ default: () => { var _a, _b; return (_b = (_a = context.slots).default) === null || _b === void 0 ? void 0 : _b.call(_a, slotProps()); },
2267
+ };
2268
+ };
2269
+ /**
2270
+ * Vue adds a `_value` prop at the moment on the input elements to store the REAL value on them, real values are different than the `value` attribute
2271
+ * as they do not get casted to strings unlike `el.value` which preserves user-code behavior
2272
+ */
2273
+ function getBoundValue(el) {
2274
+ if (hasValueBinding(el)) {
2275
+ return el._value;
2276
+ }
2277
+ return undefined;
2278
+ }
2279
+ /**
2280
+ * Vue adds a `_value` prop at the moment on the input elements to store the REAL value on them, real values are different than the `value` attribute
2281
+ * as they do not get casted to strings unlike `el.value` which preserves user-code behavior
2282
+ */
2283
+ function hasValueBinding(el) {
2284
+ return '_value' in el;
2285
+ }
2286
+
2287
+ function normalizeEventValue(value) {
2288
+ if (!isEvent(value)) {
2289
+ return value;
2290
+ }
2291
+ const input = value.target;
2292
+ // Vue sets the current bound value on `_value` prop
2293
+ // for checkboxes it it should fetch the value binding type as is (boolean instead of string)
2294
+ if (hasCheckedAttr(input.type) && hasValueBinding(input)) {
2295
+ return getBoundValue(input);
2296
+ }
2297
+ if (input.type === 'file' && input.files) {
2298
+ return Array.from(input.files);
2299
+ }
2300
+ if (isNativeMultiSelect(input)) {
2301
+ return Array.from(input.options)
2302
+ .filter(opt => opt.selected && !opt.disabled)
2303
+ .map(getBoundValue);
2304
+ }
2305
+ // makes sure we get the actual `option` bound value
2306
+ // #3440
2307
+ if (isNativeSelect(input)) {
2308
+ const selectedOption = Array.from(input.options).find(opt => opt.selected);
2309
+ return selectedOption ? getBoundValue(selectedOption) : input.value;
2310
+ }
2311
+ return input.value;
2312
+ }
2313
+
2314
+ /**
2315
+ * Normalizes the given rules expression.
2316
+ */
2317
+ function normalizeRules(rules) {
2318
+ const acc = {};
2319
+ Object.defineProperty(acc, '_$$isNormalized', {
2320
+ value: true,
2321
+ writable: false,
2322
+ enumerable: false,
2323
+ configurable: false,
2324
+ });
2325
+ if (!rules) {
2326
+ return acc;
2327
+ }
2328
+ // Object is already normalized, skip.
2329
+ if (isObject(rules) && rules._$$isNormalized) {
2330
+ return rules;
2331
+ }
2332
+ if (isObject(rules)) {
2333
+ return Object.keys(rules).reduce((prev, curr) => {
2334
+ const params = normalizeParams(rules[curr]);
2335
+ if (rules[curr] !== false) {
2336
+ prev[curr] = buildParams(params);
2337
+ }
2338
+ return prev;
2339
+ }, acc);
2340
+ }
2341
+ /* istanbul ignore if */
2342
+ if (typeof rules !== 'string') {
2343
+ return acc;
2344
+ }
2345
+ return rules.split('|').reduce((prev, rule) => {
2346
+ const parsedRule = parseRule(rule);
2347
+ if (!parsedRule.name) {
2348
+ return prev;
2349
+ }
2350
+ prev[parsedRule.name] = buildParams(parsedRule.params);
2351
+ return prev;
2352
+ }, acc);
2353
+ }
2354
+ /**
2355
+ * Normalizes a rule param.
2356
+ */
2357
+ function normalizeParams(params) {
2358
+ if (params === true) {
2359
+ return [];
2360
+ }
2361
+ if (Array.isArray(params)) {
2362
+ return params;
2363
+ }
2364
+ if (isObject(params)) {
2365
+ return params;
2366
+ }
2367
+ return [params];
2368
+ }
2369
+ function buildParams(provided) {
2370
+ const mapValueToLocator = (value) => {
2371
+ // A target param using interpolation
2372
+ if (typeof value === 'string' && value[0] === '@') {
2373
+ return createLocator(value.slice(1));
2374
+ }
2375
+ return value;
2376
+ };
2377
+ if (Array.isArray(provided)) {
2378
+ return provided.map(mapValueToLocator);
2379
+ }
2380
+ // #3073
2381
+ if (provided instanceof RegExp) {
2382
+ return [provided];
2383
+ }
2384
+ return Object.keys(provided).reduce((prev, key) => {
2385
+ prev[key] = mapValueToLocator(provided[key]);
2386
+ return prev;
2387
+ }, {});
2388
+ }
2389
+ /**
2390
+ * Parses a rule string expression.
2391
+ */
2392
+ const parseRule = (rule) => {
2393
+ let params = [];
2394
+ const name = rule.split(':')[0];
2395
+ if (rule.includes(':')) {
2396
+ params = rule.split(':').slice(1).join(':').split(',');
2397
+ }
2398
+ return { name, params };
2399
+ };
2400
+ function createLocator(value) {
2401
+ const locator = (crossTable) => {
2402
+ const val = getFromPath(crossTable, value) || crossTable[value];
2403
+ return val;
2404
+ };
2405
+ locator.__locatorRef = value;
2406
+ return locator;
2407
+ }
2408
+ function extractLocators(params) {
2409
+ if (Array.isArray(params)) {
2410
+ return params.filter(isLocator);
2411
+ }
2412
+ return keysOf(params)
2413
+ .filter(key => isLocator(params[key]))
2414
+ .map(key => params[key]);
2415
+ }
2416
+
2417
+ const DEFAULT_CONFIG = {
2418
+ generateMessage: ({ field }) => `${field} is not valid.`,
2419
+ bails: true,
2420
+ validateOnBlur: true,
2421
+ validateOnChange: true,
2422
+ validateOnInput: false,
2423
+ validateOnModelUpdate: true,
2424
+ };
2425
+ let currentConfig = Object.assign({}, DEFAULT_CONFIG);
2426
+ const getConfig = () => currentConfig;
2427
+ const setConfig = (newConf) => {
2428
+ currentConfig = Object.assign(Object.assign({}, currentConfig), newConf);
2429
+ };
2430
+ const configure = setConfig;
2431
+
2432
+ /**
2433
+ * Validates a value against the rules.
2434
+ */
2435
+ async function validate(value, rules, options = {}) {
2436
+ const shouldBail = options === null || options === void 0 ? void 0 : options.bails;
2437
+ const field = {
2438
+ name: (options === null || options === void 0 ? void 0 : options.name) || '{field}',
2439
+ rules,
2440
+ bails: shouldBail !== null && shouldBail !== void 0 ? shouldBail : true,
2441
+ formData: (options === null || options === void 0 ? void 0 : options.values) || {},
2442
+ };
2443
+ const result = await _validate(field, value);
2444
+ const errors = result.errors;
2445
+ return {
2446
+ errors,
2447
+ valid: !errors.length,
2448
+ };
2449
+ }
2450
+ /**
2451
+ * Starts the validation process.
2452
+ */
2453
+ async function _validate(field, value) {
2454
+ if (isYupValidator(field.rules)) {
2455
+ return validateFieldWithYup(value, field.rules, { bails: field.bails });
2456
+ }
2457
+ // if a generic function, use it as the pipeline.
2458
+ if (isCallable(field.rules)) {
2459
+ const ctx = {
2460
+ field: field.name,
2461
+ form: field.formData,
2462
+ value: value,
2463
+ };
2464
+ const result = await field.rules(value, ctx);
2465
+ const isValid = typeof result !== 'string' && result;
2466
+ const message = typeof result === 'string' ? result : _generateFieldError(ctx);
2467
+ return {
2468
+ errors: !isValid ? [message] : [],
2469
+ };
2470
+ }
2471
+ const normalizedContext = Object.assign(Object.assign({}, field), { rules: normalizeRules(field.rules) });
2472
+ const errors = [];
2473
+ const rulesKeys = Object.keys(normalizedContext.rules);
2474
+ const length = rulesKeys.length;
2475
+ for (let i = 0; i < length; i++) {
2476
+ const rule = rulesKeys[i];
2477
+ const result = await _test(normalizedContext, value, {
2478
+ name: rule,
2479
+ params: normalizedContext.rules[rule],
2480
+ });
2481
+ if (result.error) {
2482
+ errors.push(result.error);
2483
+ if (field.bails) {
2484
+ return {
2485
+ errors,
2486
+ };
2487
+ }
2488
+ }
2489
+ }
2490
+ return {
2491
+ errors,
2492
+ };
2493
+ }
2494
+ /**
2495
+ * Handles yup validation
2496
+ */
2497
+ async function validateFieldWithYup(value, validator, opts) {
2498
+ var _a;
2499
+ const errors = await validator
2500
+ .validate(value, {
2501
+ abortEarly: (_a = opts.bails) !== null && _a !== void 0 ? _a : true,
2502
+ })
2503
+ .then(() => [])
2504
+ .catch((err) => {
2505
+ // Yup errors have a name prop one them.
2506
+ // https://github.com/jquense/yup#validationerrorerrors-string--arraystring-value-any-path-string
2507
+ if (err.name === 'ValidationError') {
2508
+ return err.errors;
2509
+ }
2510
+ // re-throw the error so we don't hide it
2511
+ throw err;
2512
+ });
2513
+ return {
2514
+ errors,
2515
+ };
2516
+ }
2517
+ /**
2518
+ * Tests a single input value against a rule.
2519
+ */
2520
+ async function _test(field, value, rule) {
2521
+ const validator = resolveRule(rule.name);
2522
+ if (!validator) {
2523
+ throw new Error(`No such validator '${rule.name}' exists.`);
2524
+ }
2525
+ const params = fillTargetValues(rule.params, field.formData);
2526
+ const ctx = {
2527
+ field: field.name,
2528
+ value,
2529
+ form: field.formData,
2530
+ rule: Object.assign(Object.assign({}, rule), { params }),
2531
+ };
2532
+ const result = await validator(value, params, ctx);
2533
+ if (typeof result === 'string') {
2534
+ return {
2535
+ error: result,
2536
+ };
2537
+ }
2538
+ return {
2539
+ error: result ? undefined : _generateFieldError(ctx),
2540
+ };
2541
+ }
2542
+ /**
2543
+ * Generates error messages.
2544
+ */
2545
+ function _generateFieldError(fieldCtx) {
2546
+ const message = getConfig().generateMessage;
2547
+ if (!message) {
2548
+ return 'Field is invalid';
2549
+ }
2550
+ return message(fieldCtx);
2551
+ }
2552
+ function fillTargetValues(params, crossTable) {
2553
+ const normalize = (value) => {
2554
+ if (isLocator(value)) {
2555
+ return value(crossTable);
2556
+ }
2557
+ return value;
2558
+ };
2559
+ if (Array.isArray(params)) {
2560
+ return params.map(normalize);
2561
+ }
2562
+ return Object.keys(params).reduce((acc, param) => {
2563
+ acc[param] = normalize(params[param]);
2564
+ return acc;
2565
+ }, {});
2566
+ }
2567
+ async function validateYupSchema(schema, values) {
2568
+ const errorObjects = await schema
2569
+ .validate(values, { abortEarly: false })
2570
+ .then(() => [])
2571
+ .catch((err) => {
2572
+ // Yup errors have a name prop one them.
2573
+ // https://github.com/jquense/yup#validationerrorerrors-string--arraystring-value-any-path-string
2574
+ if (err.name !== 'ValidationError') {
2575
+ throw err;
2576
+ }
2577
+ // list of aggregated errors
2578
+ return err.inner || [];
2579
+ });
2580
+ const results = {};
2581
+ const errors = {};
2582
+ for (const error of errorObjects) {
2583
+ const messages = error.errors;
2584
+ results[error.path] = { valid: !messages.length, errors: messages };
2585
+ if (messages.length) {
2586
+ errors[error.path] = messages[0];
2587
+ }
2588
+ }
2589
+ return {
2590
+ valid: !errorObjects.length,
2591
+ results,
2592
+ errors,
2593
+ };
2594
+ }
2595
+ async function validateObjectSchema(schema, values, opts) {
2596
+ const paths = keysOf(schema);
2597
+ const validations = paths.map(async (path) => {
2598
+ var _a, _b, _c;
2599
+ const fieldResult = await validate(getFromPath(values, path), schema[path], {
2600
+ name: ((_a = opts === null || opts === void 0 ? void 0 : opts.names) === null || _a === void 0 ? void 0 : _a[path]) || path,
2601
+ values: values,
2602
+ bails: (_c = (_b = opts === null || opts === void 0 ? void 0 : opts.bailsMap) === null || _b === void 0 ? void 0 : _b[path]) !== null && _c !== void 0 ? _c : true,
2603
+ });
2604
+ return Object.assign(Object.assign({}, fieldResult), { path });
2605
+ });
2606
+ let isAllValid = true;
2607
+ const validationResults = await Promise.all(validations);
2608
+ const results = {};
2609
+ const errors = {};
2610
+ for (const result of validationResults) {
2611
+ results[result.path] = {
2612
+ valid: result.valid,
2613
+ errors: result.errors,
2614
+ };
2615
+ if (!result.valid) {
2616
+ isAllValid = false;
2617
+ errors[result.path] = result.errors[0];
2618
+ }
2619
+ }
2620
+ return {
2621
+ valid: isAllValid,
2622
+ results,
2623
+ errors,
2624
+ };
2625
+ }
2626
+
2627
+ function set(obj, key, val) {
2628
+ if (typeof val.value === 'object') val.value = klona(val.value);
2629
+ if (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === '__proto__') {
2630
+ Object.defineProperty(obj, key, val);
2631
+ } else obj[key] = val.value;
2632
+ }
2633
+
2634
+ function klona(x) {
2635
+ if (typeof x !== 'object') return x;
2636
+
2637
+ var i=0, k, list, tmp, str=Object.prototype.toString.call(x);
2638
+
2639
+ if (str === '[object Object]') {
2640
+ tmp = Object.create(x.__proto__ || null);
2641
+ } else if (str === '[object Array]') {
2642
+ tmp = Array(x.length);
2643
+ } else if (str === '[object Set]') {
2644
+ tmp = new Set;
2645
+ x.forEach(function (val) {
2646
+ tmp.add(klona(val));
2647
+ });
2648
+ } else if (str === '[object Map]') {
2649
+ tmp = new Map;
2650
+ x.forEach(function (val, key) {
2651
+ tmp.set(klona(key), klona(val));
2652
+ });
2653
+ } else if (str === '[object Date]') {
2654
+ tmp = new Date(+x);
2655
+ } else if (str === '[object RegExp]') {
2656
+ tmp = new RegExp(x.source, x.flags);
2657
+ } else if (str === '[object DataView]') {
2658
+ tmp = new x.constructor( klona(x.buffer) );
2659
+ } else if (str === '[object ArrayBuffer]') {
2660
+ tmp = x.slice(0);
2661
+ } else if (str.slice(-6) === 'Array]') {
2662
+ // ArrayBuffer.isView(x)
2663
+ // ~> `new` bcuz `Buffer.slice` => ref
2664
+ tmp = new x.constructor(x);
2665
+ }
2666
+
2667
+ if (tmp) {
2668
+ for (list=Object.getOwnPropertySymbols(x); i < list.length; i++) {
2669
+ set(tmp, list[i], Object.getOwnPropertyDescriptor(x, list[i]));
2670
+ }
2671
+
2672
+ for (i=0, list=Object.getOwnPropertyNames(x); i < list.length; i++) {
2673
+ if (Object.hasOwnProperty.call(tmp, k=list[i]) && tmp[k] === x[k]) continue;
2674
+ set(tmp, k, Object.getOwnPropertyDescriptor(x, k));
2675
+ }
2676
+ }
2677
+
2678
+ return tmp || x;
2679
+ }
2680
+
2681
+ var es6 = function equal(a, b) {
2682
+ if (a === b) return true;
2683
+
2684
+ if (a && b && typeof a == 'object' && typeof b == 'object') {
2685
+ if (a.constructor !== b.constructor) return false;
2686
+
2687
+ var length, i, keys;
2688
+ if (Array.isArray(a)) {
2689
+ length = a.length;
2690
+ if (length != b.length) return false;
2691
+ for (i = length; i-- !== 0;)
2692
+ if (!equal(a[i], b[i])) return false;
2693
+ return true;
1778
2694
  }
1779
- } else {
1780
- head.appendChild(style);
2695
+
2696
+
2697
+ if ((a instanceof Map) && (b instanceof Map)) {
2698
+ if (a.size !== b.size) return false;
2699
+ for (i of a.entries())
2700
+ if (!b.has(i[0])) return false;
2701
+ for (i of a.entries())
2702
+ if (!equal(i[1], b.get(i[0]))) return false;
2703
+ return true;
2704
+ }
2705
+
2706
+ if ((a instanceof Set) && (b instanceof Set)) {
2707
+ if (a.size !== b.size) return false;
2708
+ for (i of a.entries())
2709
+ if (!b.has(i[0])) return false;
2710
+ return true;
2711
+ }
2712
+
2713
+ if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
2714
+ length = a.length;
2715
+ if (length != b.length) return false;
2716
+ for (i = length; i-- !== 0;)
2717
+ if (a[i] !== b[i]) return false;
2718
+ return true;
2719
+ }
2720
+
2721
+
2722
+ if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
2723
+ if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
2724
+ if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
2725
+
2726
+ keys = Object.keys(a);
2727
+ length = keys.length;
2728
+ if (length !== Object.keys(b).length) return false;
2729
+
2730
+ for (i = length; i-- !== 0;)
2731
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
2732
+
2733
+ for (i = length; i-- !== 0;) {
2734
+ var key = keys[i];
2735
+
2736
+ if (!equal(a[key], b[key])) return false;
2737
+ }
2738
+
2739
+ return true;
1781
2740
  }
1782
2741
 
1783
- if (style.styleSheet) {
1784
- style.styleSheet.cssText = css;
1785
- } else {
1786
- style.appendChild(document.createTextNode(css));
2742
+ // true if both NaN, false otherwise
2743
+ return a!==a && b!==b;
2744
+ };
2745
+
2746
+ let ID_COUNTER = 0;
2747
+ function useFieldState(path, init) {
2748
+ const { value, initialValue, setInitialValue } = _useFieldValue(path, init.modelValue, !init.standalone);
2749
+ const { errorMessage, errors, setErrors } = _useFieldErrors(path, !init.standalone);
2750
+ const meta = _useFieldMeta(value, initialValue, errors);
2751
+ const id = ID_COUNTER >= Number.MAX_SAFE_INTEGER ? 0 : ++ID_COUNTER;
2752
+ function setState(state) {
2753
+ var _a;
2754
+ if ('value' in state) {
2755
+ value.value = state.value;
2756
+ }
2757
+ if ('errors' in state) {
2758
+ setErrors(state.errors);
2759
+ }
2760
+ if ('touched' in state) {
2761
+ meta.touched = (_a = state.touched) !== null && _a !== void 0 ? _a : meta.touched;
2762
+ }
2763
+ if ('initialValue' in state) {
2764
+ setInitialValue(state.initialValue);
2765
+ }
2766
+ }
2767
+ return {
2768
+ id,
2769
+ path,
2770
+ value,
2771
+ initialValue,
2772
+ meta,
2773
+ errors,
2774
+ errorMessage,
2775
+ setState,
2776
+ };
2777
+ }
2778
+ /**
2779
+ * Creates the field value and resolves the initial value
2780
+ */
2781
+ function _useFieldValue(path, modelValue, shouldInjectForm) {
2782
+ const form = shouldInjectForm ? injectWithSelf(FormContextKey, undefined) : undefined;
2783
+ const modelRef = vue.ref(vue.unref(modelValue));
2784
+ function resolveInitialValue() {
2785
+ if (!form) {
2786
+ return vue.unref(modelRef);
2787
+ }
2788
+ return getFromPath(form.meta.value.initialValues, vue.unref(path), vue.unref(modelRef));
2789
+ }
2790
+ function setInitialValue(value) {
2791
+ if (!form) {
2792
+ modelRef.value = value;
2793
+ return;
2794
+ }
2795
+ form.setFieldInitialValue(vue.unref(path), value);
2796
+ }
2797
+ const initialValue = vue.computed(resolveInitialValue);
2798
+ // if no form is associated, use a regular ref.
2799
+ if (!form) {
2800
+ const value = vue.ref(resolveInitialValue());
2801
+ return {
2802
+ value,
2803
+ initialValue,
2804
+ setInitialValue,
2805
+ };
2806
+ }
2807
+ // to set the initial value, first check if there is a current value, if there is then use it.
2808
+ // otherwise use the configured initial value if it exists.
2809
+ // prioritize model value over form values
2810
+ // #3429
2811
+ const currentValue = modelValue ? vue.unref(modelValue) : getFromPath(form.values, vue.unref(path), vue.unref(initialValue));
2812
+ form.stageInitialValue(vue.unref(path), currentValue);
2813
+ // otherwise use a computed setter that triggers the `setFieldValue`
2814
+ const value = vue.computed({
2815
+ get() {
2816
+ return getFromPath(form.values, vue.unref(path));
2817
+ },
2818
+ set(newVal) {
2819
+ form.setFieldValue(vue.unref(path), newVal);
2820
+ },
2821
+ });
2822
+ return {
2823
+ value,
2824
+ initialValue,
2825
+ setInitialValue,
2826
+ };
2827
+ }
2828
+ /**
2829
+ * Creates meta flags state and some associated effects with them
2830
+ */
2831
+ function _useFieldMeta(currentValue, initialValue, errors) {
2832
+ const meta = vue.reactive({
2833
+ touched: false,
2834
+ pending: false,
2835
+ valid: true,
2836
+ validated: !!vue.unref(errors).length,
2837
+ initialValue: vue.computed(() => vue.unref(initialValue)),
2838
+ dirty: vue.computed(() => {
2839
+ return !es6(vue.unref(currentValue), vue.unref(initialValue));
2840
+ }),
2841
+ });
2842
+ vue.watch(errors, value => {
2843
+ meta.valid = !value.length;
2844
+ }, {
2845
+ immediate: true,
2846
+ flush: 'sync',
2847
+ });
2848
+ return meta;
2849
+ }
2850
+ /**
2851
+ * Creates the error message state for the field state
2852
+ */
2853
+ function _useFieldErrors(path, shouldInjectForm) {
2854
+ const form = shouldInjectForm ? injectWithSelf(FormContextKey, undefined) : undefined;
2855
+ function normalizeErrors(messages) {
2856
+ if (!messages) {
2857
+ return [];
2858
+ }
2859
+ return Array.isArray(messages) ? messages : [messages];
2860
+ }
2861
+ if (!form) {
2862
+ const errors = vue.ref([]);
2863
+ return {
2864
+ errors,
2865
+ errorMessage: vue.computed(() => errors.value[0]),
2866
+ setErrors: (messages) => {
2867
+ errors.value = normalizeErrors(messages);
2868
+ },
2869
+ };
2870
+ }
2871
+ const errors = vue.computed(() => form.errorBag.value[vue.unref(path)] || []);
2872
+ return {
2873
+ errors,
2874
+ errorMessage: vue.computed(() => errors.value[0]),
2875
+ setErrors: (messages) => {
2876
+ form.setFieldErrorBag(vue.unref(path), normalizeErrors(messages));
2877
+ },
2878
+ };
2879
+ }
2880
+
2881
+ function installDevtoolsPlugin(app) {
2882
+ if (("production" !== 'production')) {
2883
+ setupDevtoolsPlugin({
2884
+ id: 'vee-validate-devtools-plugin',
2885
+ label: 'VeeValidate Plugin',
2886
+ packageName: 'vee-validate',
2887
+ homepage: 'https://vee-validate.logaretm.com/v4',
2888
+ app,
2889
+ logo: 'https://vee-validate.logaretm.com/v4/logo.png',
2890
+ }, setupApiHooks);
2891
+ }
2892
+ }
2893
+ const DEVTOOLS_FORMS = {};
2894
+ const DEVTOOLS_FIELDS = {};
2895
+ let API;
2896
+ const refreshInspector = throttle(() => {
2897
+ setTimeout(async () => {
2898
+ await vue.nextTick();
2899
+ API === null || API === void 0 ? void 0 : API.sendInspectorState(INSPECTOR_ID);
2900
+ API === null || API === void 0 ? void 0 : API.sendInspectorTree(INSPECTOR_ID);
2901
+ }, 100);
2902
+ }, 100);
2903
+ function registerFormWithDevTools(form) {
2904
+ const vm = vue.getCurrentInstance();
2905
+ if (!API) {
2906
+ const app = vm === null || vm === void 0 ? void 0 : vm.appContext.app;
2907
+ if (!app) {
2908
+ return;
2909
+ }
2910
+ installDevtoolsPlugin(app);
2911
+ }
2912
+ DEVTOOLS_FORMS[form.formId] = Object.assign({}, form);
2913
+ DEVTOOLS_FORMS[form.formId]._vm = vm;
2914
+ vue.onUnmounted(() => {
2915
+ delete DEVTOOLS_FORMS[form.formId];
2916
+ refreshInspector();
2917
+ });
2918
+ refreshInspector();
2919
+ }
2920
+ function registerSingleFieldWithDevtools(field) {
2921
+ const vm = vue.getCurrentInstance();
2922
+ if (!API) {
2923
+ const app = vm === null || vm === void 0 ? void 0 : vm.appContext.app;
2924
+ if (!app) {
2925
+ return;
2926
+ }
2927
+ installDevtoolsPlugin(app);
2928
+ }
2929
+ DEVTOOLS_FIELDS[field.id] = Object.assign({}, field);
2930
+ DEVTOOLS_FIELDS[field.id]._vm = vm;
2931
+ vue.onUnmounted(() => {
2932
+ delete DEVTOOLS_FIELDS[field.id];
2933
+ refreshInspector();
2934
+ });
2935
+ refreshInspector();
2936
+ }
2937
+ const INSPECTOR_ID = 'vee-validate-inspector';
2938
+ const COLORS = {
2939
+ error: 0xbd4b4b,
2940
+ success: 0x06d77b,
2941
+ unknown: 0x54436b,
2942
+ white: 0xffffff,
2943
+ black: 0x000000,
2944
+ blue: 0x035397,
2945
+ purple: 0xb980f0,
2946
+ orange: 0xf5a962,
2947
+ gray: 0xbbbfca,
2948
+ };
2949
+ let SELECTED_NODE = null;
2950
+ function setupApiHooks(api) {
2951
+ API = api;
2952
+ api.addInspector({
2953
+ id: INSPECTOR_ID,
2954
+ icon: 'rule',
2955
+ label: 'vee-validate',
2956
+ noSelectionText: 'Select a vee-validate node to inspect',
2957
+ actions: [
2958
+ {
2959
+ icon: 'done_outline',
2960
+ tooltip: 'Validate selected item',
2961
+ action: async () => {
2962
+ if (!SELECTED_NODE) {
2963
+ console.error('There is not a valid selected vee-validate node or component');
2964
+ return;
2965
+ }
2966
+ const result = await SELECTED_NODE.validate();
2967
+ console.log(result);
2968
+ },
2969
+ },
2970
+ {
2971
+ icon: 'delete_sweep',
2972
+ tooltip: 'Clear validation state of the selected item',
2973
+ action: () => {
2974
+ if (!SELECTED_NODE) {
2975
+ console.error('There is not a valid selected vee-validate node or component');
2976
+ return;
2977
+ }
2978
+ if ('id' in SELECTED_NODE) {
2979
+ SELECTED_NODE.resetField();
2980
+ return;
2981
+ }
2982
+ SELECTED_NODE.resetForm();
2983
+ },
2984
+ },
2985
+ ],
2986
+ });
2987
+ api.on.getInspectorTree(payload => {
2988
+ if (payload.inspectorId !== INSPECTOR_ID) {
2989
+ return;
2990
+ }
2991
+ const forms = Object.values(DEVTOOLS_FORMS);
2992
+ const fields = Object.values(DEVTOOLS_FIELDS);
2993
+ payload.rootNodes = [
2994
+ ...forms.map(mapFormForDevtoolsInspector),
2995
+ ...fields.map(field => mapFieldForDevtoolsInspector(field)),
2996
+ ];
2997
+ });
2998
+ api.on.getInspectorState((payload, ctx) => {
2999
+ if (payload.inspectorId !== INSPECTOR_ID || ctx.currentTab !== `custom-inspector:${INSPECTOR_ID}`) {
3000
+ return;
3001
+ }
3002
+ const { form, field, type } = decodeNodeId(payload.nodeId);
3003
+ if (form && type === 'form') {
3004
+ payload.state = buildFormState(form);
3005
+ SELECTED_NODE = form;
3006
+ return;
3007
+ }
3008
+ if (field && type === 'field') {
3009
+ payload.state = buildFieldState(field);
3010
+ SELECTED_NODE = field;
3011
+ return;
3012
+ }
3013
+ SELECTED_NODE = null;
3014
+ });
3015
+ }
3016
+ function mapFormForDevtoolsInspector(form) {
3017
+ const { textColor, bgColor } = getTagTheme(form);
3018
+ const formTreeNodes = {};
3019
+ Object.values(form.fieldsByPath.value).forEach(field => {
3020
+ const fieldInstance = Array.isArray(field) ? field[0] : field;
3021
+ if (!fieldInstance) {
3022
+ return;
3023
+ }
3024
+ setInPath(formTreeNodes, vue.unref(fieldInstance.name), mapFieldForDevtoolsInspector(fieldInstance, form));
3025
+ });
3026
+ function buildFormTree(tree, path = []) {
3027
+ const key = [...path].pop();
3028
+ if ('id' in tree) {
3029
+ return Object.assign(Object.assign({}, tree), { label: key || tree.label });
3030
+ }
3031
+ if (isObject(tree)) {
3032
+ return {
3033
+ id: `${path.join('.')}`,
3034
+ label: key || '',
3035
+ children: Object.keys(tree).map(key => buildFormTree(tree[key], [...path, key])),
3036
+ };
3037
+ }
3038
+ if (Array.isArray(tree)) {
3039
+ return {
3040
+ id: `${path.join('.')}`,
3041
+ label: `${key}[]`,
3042
+ children: tree.map((c, idx) => buildFormTree(c, [...path, String(idx)])),
3043
+ };
3044
+ }
3045
+ return { id: '', label: '', children: [] };
3046
+ }
3047
+ const { children } = buildFormTree(formTreeNodes);
3048
+ return {
3049
+ id: encodeNodeId(form),
3050
+ label: 'Form',
3051
+ children,
3052
+ tags: [
3053
+ {
3054
+ label: 'Form',
3055
+ textColor,
3056
+ backgroundColor: bgColor,
3057
+ },
3058
+ {
3059
+ label: `${Object.keys(form.fieldsByPath.value).length} fields`,
3060
+ textColor: COLORS.white,
3061
+ backgroundColor: COLORS.unknown,
3062
+ },
3063
+ ],
3064
+ };
3065
+ }
3066
+ function mapFieldForDevtoolsInspector(field, form) {
3067
+ const fieldInstance = normalizeField(field);
3068
+ const { textColor, bgColor } = getTagTheme(fieldInstance);
3069
+ const isGroup = Array.isArray(field) && field.length > 1;
3070
+ return {
3071
+ id: encodeNodeId(form, fieldInstance, !isGroup),
3072
+ label: vue.unref(fieldInstance.name),
3073
+ children: Array.isArray(field) ? field.map(fieldItem => mapFieldForDevtoolsInspector(fieldItem, form)) : undefined,
3074
+ tags: [
3075
+ isGroup
3076
+ ? undefined
3077
+ : {
3078
+ label: 'Field',
3079
+ textColor,
3080
+ backgroundColor: bgColor,
3081
+ },
3082
+ !form
3083
+ ? {
3084
+ label: 'Standalone',
3085
+ textColor: COLORS.black,
3086
+ backgroundColor: COLORS.gray,
3087
+ }
3088
+ : undefined,
3089
+ !isGroup && fieldInstance.type === 'checkbox'
3090
+ ? {
3091
+ label: 'Checkbox',
3092
+ textColor: COLORS.white,
3093
+ backgroundColor: COLORS.blue,
3094
+ }
3095
+ : undefined,
3096
+ !isGroup && fieldInstance.type === 'radio'
3097
+ ? {
3098
+ label: 'Radio',
3099
+ textColor: COLORS.white,
3100
+ backgroundColor: COLORS.purple,
3101
+ }
3102
+ : undefined,
3103
+ isGroup
3104
+ ? {
3105
+ label: 'Group',
3106
+ textColor: COLORS.black,
3107
+ backgroundColor: COLORS.orange,
3108
+ }
3109
+ : undefined,
3110
+ ].filter(Boolean),
3111
+ };
3112
+ }
3113
+ function encodeNodeId(form, field, encodeIndex = true) {
3114
+ const fieldPath = form ? vue.unref(field === null || field === void 0 ? void 0 : field.name) : field === null || field === void 0 ? void 0 : field.id;
3115
+ const fieldGroup = fieldPath ? form === null || form === void 0 ? void 0 : form.fieldsByPath.value[fieldPath] : undefined;
3116
+ let idx;
3117
+ if (encodeIndex && field && Array.isArray(fieldGroup)) {
3118
+ idx = fieldGroup.indexOf(field);
3119
+ }
3120
+ const idObject = { f: form === null || form === void 0 ? void 0 : form.formId, ff: fieldPath, idx, type: field ? 'field' : 'form' };
3121
+ return btoa(JSON.stringify(idObject));
3122
+ }
3123
+ function decodeNodeId(nodeId) {
3124
+ try {
3125
+ const idObject = JSON.parse(atob(nodeId));
3126
+ const form = DEVTOOLS_FORMS[idObject.f];
3127
+ if (!form && idObject.ff) {
3128
+ const field = DEVTOOLS_FIELDS[idObject.ff];
3129
+ if (!field) {
3130
+ return {};
3131
+ }
3132
+ return {
3133
+ type: idObject.type,
3134
+ field,
3135
+ };
3136
+ }
3137
+ if (!form) {
3138
+ return {};
3139
+ }
3140
+ const fieldGroup = form.fieldsByPath.value[idObject.ff];
3141
+ return {
3142
+ type: idObject.type,
3143
+ form,
3144
+ field: Array.isArray(fieldGroup) ? fieldGroup[idObject.idx || 0] : fieldGroup,
3145
+ };
3146
+ }
3147
+ catch (err) {
3148
+ // console.error(`Devtools: [vee-validate] Failed to parse node id ${nodeId}`);
3149
+ }
3150
+ return {};
3151
+ }
3152
+ function buildFieldState(field) {
3153
+ const { errors, meta, value } = field;
3154
+ return {
3155
+ 'Field state': [
3156
+ { key: 'errors', value: errors.value },
3157
+ {
3158
+ key: 'initialValue',
3159
+ value: meta.initialValue,
3160
+ },
3161
+ {
3162
+ key: 'currentValue',
3163
+ value: value.value,
3164
+ },
3165
+ {
3166
+ key: 'touched',
3167
+ value: meta.touched,
3168
+ },
3169
+ {
3170
+ key: 'dirty',
3171
+ value: meta.dirty,
3172
+ },
3173
+ {
3174
+ key: 'valid',
3175
+ value: meta.valid,
3176
+ },
3177
+ ],
3178
+ };
3179
+ }
3180
+ function buildFormState(form) {
3181
+ const { errorBag, meta, values, isSubmitting, submitCount } = form;
3182
+ return {
3183
+ 'Form state': [
3184
+ {
3185
+ key: 'submitCount',
3186
+ value: submitCount.value,
3187
+ },
3188
+ {
3189
+ key: 'isSubmitting',
3190
+ value: isSubmitting.value,
3191
+ },
3192
+ {
3193
+ key: 'touched',
3194
+ value: meta.value.touched,
3195
+ },
3196
+ {
3197
+ key: 'dirty',
3198
+ value: meta.value.dirty,
3199
+ },
3200
+ {
3201
+ key: 'valid',
3202
+ value: meta.value.valid,
3203
+ },
3204
+ {
3205
+ key: 'initialValues',
3206
+ value: meta.value.initialValues,
3207
+ },
3208
+ {
3209
+ key: 'currentValues',
3210
+ value: values,
3211
+ },
3212
+ {
3213
+ key: 'errors',
3214
+ value: keysOf(errorBag.value).reduce((acc, key) => {
3215
+ var _a;
3216
+ const message = (_a = errorBag.value[key]) === null || _a === void 0 ? void 0 : _a[0];
3217
+ if (message) {
3218
+ acc[key] = message;
3219
+ }
3220
+ return acc;
3221
+ }, {}),
3222
+ },
3223
+ ],
3224
+ };
3225
+ }
3226
+ /**
3227
+ * Resolves the tag color based on the form state
3228
+ */
3229
+ function getTagTheme(fieldOrForm) {
3230
+ // const fallbackColors = {
3231
+ // bgColor: COLORS.unknown,
3232
+ // textColor: COLORS.white,
3233
+ // };
3234
+ const isValid = 'id' in fieldOrForm ? fieldOrForm.meta.valid : fieldOrForm.meta.value.valid;
3235
+ return {
3236
+ bgColor: isValid ? COLORS.success : COLORS.error,
3237
+ textColor: isValid ? COLORS.black : COLORS.white,
3238
+ };
3239
+ }
3240
+
3241
+ /**
3242
+ * Creates a field composite.
3243
+ */
3244
+ function useField(name, rules, opts) {
3245
+ if (hasCheckedAttr(opts === null || opts === void 0 ? void 0 : opts.type)) {
3246
+ return useCheckboxField(name, rules, opts);
3247
+ }
3248
+ return _useField(name, rules, opts);
3249
+ }
3250
+ function _useField(name, rules, opts) {
3251
+ const { initialValue: modelValue, validateOnMount, bails, type, checkedValue, label, validateOnValueUpdate, uncheckedValue, standalone, } = normalizeOptions(vue.unref(name), opts);
3252
+ const form = !standalone ? injectWithSelf(FormContextKey) : undefined;
3253
+ const { id, value, initialValue, meta, setState, errors, errorMessage } = useFieldState(name, {
3254
+ modelValue,
3255
+ standalone,
3256
+ });
3257
+ /**
3258
+ * Handles common onBlur meta update
3259
+ */
3260
+ const handleBlur = () => {
3261
+ meta.touched = true;
3262
+ };
3263
+ const normalizedRules = vue.computed(() => {
3264
+ let rulesValue = vue.unref(rules);
3265
+ const schema = vue.unref(form === null || form === void 0 ? void 0 : form.schema);
3266
+ if (schema && !isYupValidator(schema)) {
3267
+ rulesValue = extractRuleFromSchema(schema, vue.unref(name)) || rulesValue;
3268
+ }
3269
+ if (isYupValidator(rulesValue) || isCallable(rulesValue)) {
3270
+ return rulesValue;
3271
+ }
3272
+ return normalizeRules(rulesValue);
3273
+ });
3274
+ async function validateCurrentValue(mode) {
3275
+ var _a, _b;
3276
+ if (form === null || form === void 0 ? void 0 : form.validateSchema) {
3277
+ return (_a = (await form.validateSchema(mode)).results[vue.unref(name)]) !== null && _a !== void 0 ? _a : { valid: true, errors: [] };
3278
+ }
3279
+ return validate(value.value, normalizedRules.value, {
3280
+ name: vue.unref(label) || vue.unref(name),
3281
+ values: (_b = form === null || form === void 0 ? void 0 : form.values) !== null && _b !== void 0 ? _b : {},
3282
+ bails,
3283
+ });
3284
+ }
3285
+ async function validateWithStateMutation() {
3286
+ meta.pending = true;
3287
+ meta.validated = true;
3288
+ const result = await validateCurrentValue('validated-only');
3289
+ setState({ errors: result.errors });
3290
+ meta.pending = false;
3291
+ return result;
3292
+ }
3293
+ async function validateValidStateOnly() {
3294
+ const result = await validateCurrentValue('silent');
3295
+ meta.valid = result.valid;
3296
+ return result;
3297
+ }
3298
+ function validate$1(opts) {
3299
+ if (!(opts === null || opts === void 0 ? void 0 : opts.mode) || (opts === null || opts === void 0 ? void 0 : opts.mode) === 'force') {
3300
+ return validateWithStateMutation();
3301
+ }
3302
+ if ((opts === null || opts === void 0 ? void 0 : opts.mode) === 'validated-only') {
3303
+ return validateWithStateMutation();
3304
+ }
3305
+ return validateValidStateOnly();
3306
+ }
3307
+ // Common input/change event handler
3308
+ const handleChange = (e, shouldValidate = true) => {
3309
+ const newValue = normalizeEventValue(e);
3310
+ value.value = newValue;
3311
+ if (!validateOnValueUpdate && shouldValidate) {
3312
+ validateWithStateMutation();
3313
+ }
3314
+ };
3315
+ // Runs the initial validation
3316
+ vue.onMounted(() => {
3317
+ if (validateOnMount) {
3318
+ return validateWithStateMutation();
3319
+ }
3320
+ // validate self initially if no form was handling this
3321
+ // forms should have their own initial silent validation run to make things more efficient
3322
+ if (!form || !form.validateSchema) {
3323
+ validateValidStateOnly();
3324
+ }
3325
+ });
3326
+ function setTouched(isTouched) {
3327
+ meta.touched = isTouched;
3328
+ }
3329
+ let unwatchValue;
3330
+ function watchValue() {
3331
+ unwatchValue = vue.watch(value, validateOnValueUpdate ? validateWithStateMutation : validateValidStateOnly, {
3332
+ deep: true,
3333
+ });
3334
+ }
3335
+ watchValue();
3336
+ function resetField(state) {
3337
+ var _a;
3338
+ unwatchValue === null || unwatchValue === void 0 ? void 0 : unwatchValue();
3339
+ const newValue = state && 'value' in state ? state.value : initialValue.value;
3340
+ setState({
3341
+ value: klona(newValue),
3342
+ initialValue: klona(newValue),
3343
+ touched: (_a = state === null || state === void 0 ? void 0 : state.touched) !== null && _a !== void 0 ? _a : false,
3344
+ errors: (state === null || state === void 0 ? void 0 : state.errors) || [],
3345
+ });
3346
+ meta.pending = false;
3347
+ meta.validated = false;
3348
+ validateValidStateOnly();
3349
+ // need to watch at next tick to avoid triggering the value watcher
3350
+ vue.nextTick(() => {
3351
+ watchValue();
3352
+ });
3353
+ }
3354
+ function setValue(newValue) {
3355
+ value.value = newValue;
3356
+ }
3357
+ function setErrors(errors) {
3358
+ setState({ errors: Array.isArray(errors) ? errors : [errors] });
3359
+ }
3360
+ const field = {
3361
+ id,
3362
+ name,
3363
+ label,
3364
+ value,
3365
+ meta,
3366
+ errors,
3367
+ errorMessage,
3368
+ type,
3369
+ checkedValue,
3370
+ uncheckedValue,
3371
+ bails,
3372
+ resetField,
3373
+ handleReset: () => resetField(),
3374
+ validate: validate$1,
3375
+ handleChange,
3376
+ handleBlur,
3377
+ setState,
3378
+ setTouched,
3379
+ setErrors,
3380
+ setValue,
3381
+ };
3382
+ vue.provide(FieldContextKey, field);
3383
+ if (vue.isRef(rules) && typeof vue.unref(rules) !== 'function') {
3384
+ vue.watch(rules, (value, oldValue) => {
3385
+ if (es6(value, oldValue)) {
3386
+ return;
3387
+ }
3388
+ meta.validated ? validateWithStateMutation() : validateValidStateOnly();
3389
+ }, {
3390
+ deep: true,
3391
+ });
3392
+ }
3393
+ if (("production" !== 'production')) {
3394
+ field._vm = vue.getCurrentInstance();
3395
+ vue.watch(() => (Object.assign(Object.assign({ errors: errors.value }, meta), { value: value.value })), refreshInspector, {
3396
+ deep: true,
3397
+ });
3398
+ if (!form) {
3399
+ registerSingleFieldWithDevtools(field);
3400
+ }
3401
+ }
3402
+ // if no associated form return the field API immediately
3403
+ if (!form) {
3404
+ return field;
3405
+ }
3406
+ // associate the field with the given form
3407
+ form.register(field);
3408
+ vue.onBeforeUnmount(() => {
3409
+ form.unregister(field);
3410
+ });
3411
+ // extract cross-field dependencies in a computed prop
3412
+ const dependencies = vue.computed(() => {
3413
+ const rulesVal = normalizedRules.value;
3414
+ // is falsy, a function schema or a yup schema
3415
+ if (!rulesVal || isCallable(rulesVal) || isYupValidator(rulesVal)) {
3416
+ return {};
3417
+ }
3418
+ return Object.keys(rulesVal).reduce((acc, rule) => {
3419
+ const deps = extractLocators(rulesVal[rule])
3420
+ .map((dep) => dep.__locatorRef)
3421
+ .reduce((depAcc, depName) => {
3422
+ const depValue = getFromPath(form.values, depName) || form.values[depName];
3423
+ if (depValue !== undefined) {
3424
+ depAcc[depName] = depValue;
3425
+ }
3426
+ return depAcc;
3427
+ }, {});
3428
+ Object.assign(acc, deps);
3429
+ return acc;
3430
+ }, {});
3431
+ });
3432
+ // Adds a watcher that runs the validation whenever field dependencies change
3433
+ vue.watch(dependencies, (deps, oldDeps) => {
3434
+ // Skip if no dependencies or if the field wasn't manipulated
3435
+ if (!Object.keys(deps).length) {
3436
+ return;
3437
+ }
3438
+ const shouldValidate = !es6(deps, oldDeps);
3439
+ if (shouldValidate) {
3440
+ meta.validated ? validateWithStateMutation() : validateValidStateOnly();
3441
+ }
3442
+ });
3443
+ return field;
3444
+ }
3445
+ /**
3446
+ * Normalizes partial field options to include the full options
3447
+ */
3448
+ function normalizeOptions(name, opts) {
3449
+ const defaults = () => ({
3450
+ initialValue: undefined,
3451
+ validateOnMount: false,
3452
+ bails: true,
3453
+ rules: '',
3454
+ label: name,
3455
+ validateOnValueUpdate: true,
3456
+ standalone: false,
3457
+ });
3458
+ if (!opts) {
3459
+ return defaults();
3460
+ }
3461
+ // TODO: Deprecate this in next major release
3462
+ const checkedValue = 'valueProp' in opts ? opts.valueProp : opts.checkedValue;
3463
+ return Object.assign(Object.assign(Object.assign({}, defaults()), (opts || {})), { checkedValue });
3464
+ }
3465
+ /**
3466
+ * Extracts the validation rules from a schema
3467
+ */
3468
+ function extractRuleFromSchema(schema, fieldName) {
3469
+ // no schema at all
3470
+ if (!schema) {
3471
+ return undefined;
3472
+ }
3473
+ // there is a key on the schema object for this field
3474
+ return schema[fieldName];
3475
+ }
3476
+ function useCheckboxField(name, rules, opts) {
3477
+ const form = !(opts === null || opts === void 0 ? void 0 : opts.standalone) ? injectWithSelf(FormContextKey) : undefined;
3478
+ const checkedValue = opts === null || opts === void 0 ? void 0 : opts.checkedValue;
3479
+ const uncheckedValue = opts === null || opts === void 0 ? void 0 : opts.uncheckedValue;
3480
+ function patchCheckboxApi(field) {
3481
+ const handleChange = field.handleChange;
3482
+ const checked = vue.computed(() => {
3483
+ const currentValue = vue.unref(field.value);
3484
+ const checkedVal = vue.unref(checkedValue);
3485
+ return Array.isArray(currentValue) ? currentValue.includes(checkedVal) : checkedVal === currentValue;
3486
+ });
3487
+ function handleCheckboxChange(e, shouldValidate = true) {
3488
+ var _a, _b;
3489
+ if (checked.value === ((_b = (_a = e) === null || _a === void 0 ? void 0 : _a.target) === null || _b === void 0 ? void 0 : _b.checked)) {
3490
+ return;
3491
+ }
3492
+ let newValue = normalizeEventValue(e);
3493
+ // Single checkbox field without a form to toggle it's value
3494
+ if (!form) {
3495
+ newValue = resolveNextCheckboxValue(vue.unref(field.value), vue.unref(checkedValue), vue.unref(uncheckedValue));
3496
+ }
3497
+ handleChange(newValue, shouldValidate);
3498
+ }
3499
+ vue.onBeforeUnmount(() => {
3500
+ // toggles the checkbox value if it was checked
3501
+ if (checked.value) {
3502
+ handleCheckboxChange(vue.unref(checkedValue), false);
3503
+ }
3504
+ });
3505
+ return Object.assign(Object.assign({}, field), { checked,
3506
+ checkedValue,
3507
+ uncheckedValue, handleChange: handleCheckboxChange });
3508
+ }
3509
+ return patchCheckboxApi(_useField(name, rules, opts));
3510
+ }
3511
+
3512
+ const FieldImpl = vue.defineComponent({
3513
+ name: 'Field',
3514
+ inheritAttrs: false,
3515
+ props: {
3516
+ as: {
3517
+ type: [String, Object],
3518
+ default: undefined,
3519
+ },
3520
+ name: {
3521
+ type: String,
3522
+ required: true,
3523
+ },
3524
+ rules: {
3525
+ type: [Object, String, Function],
3526
+ default: undefined,
3527
+ },
3528
+ validateOnMount: {
3529
+ type: Boolean,
3530
+ default: false,
3531
+ },
3532
+ validateOnBlur: {
3533
+ type: Boolean,
3534
+ default: undefined,
3535
+ },
3536
+ validateOnChange: {
3537
+ type: Boolean,
3538
+ default: undefined,
3539
+ },
3540
+ validateOnInput: {
3541
+ type: Boolean,
3542
+ default: undefined,
3543
+ },
3544
+ validateOnModelUpdate: {
3545
+ type: Boolean,
3546
+ default: undefined,
3547
+ },
3548
+ bails: {
3549
+ type: Boolean,
3550
+ default: () => getConfig().bails,
3551
+ },
3552
+ label: {
3553
+ type: String,
3554
+ default: undefined,
3555
+ },
3556
+ uncheckedValue: {
3557
+ type: null,
3558
+ default: undefined,
3559
+ },
3560
+ modelValue: {
3561
+ type: null,
3562
+ default: IS_ABSENT,
3563
+ },
3564
+ modelModifiers: {
3565
+ type: null,
3566
+ default: () => ({}),
3567
+ },
3568
+ 'onUpdate:modelValue': {
3569
+ type: null,
3570
+ default: undefined,
3571
+ },
3572
+ standalone: {
3573
+ type: Boolean,
3574
+ default: false,
3575
+ },
3576
+ },
3577
+ setup(props, ctx) {
3578
+ const rules = vue.toRef(props, 'rules');
3579
+ const name = vue.toRef(props, 'name');
3580
+ const label = vue.toRef(props, 'label');
3581
+ const uncheckedValue = vue.toRef(props, 'uncheckedValue');
3582
+ const hasModelEvents = isPropPresent(props, 'onUpdate:modelValue');
3583
+ const { errors, value, errorMessage, validate: validateField, handleChange, handleBlur, setTouched, resetField, handleReset, meta, checked, setErrors, } = useField(name, rules, {
3584
+ validateOnMount: props.validateOnMount,
3585
+ bails: props.bails,
3586
+ standalone: props.standalone,
3587
+ type: ctx.attrs.type,
3588
+ initialValue: resolveInitialValue(props, ctx),
3589
+ // Only for checkboxes and radio buttons
3590
+ checkedValue: ctx.attrs.value,
3591
+ uncheckedValue,
3592
+ label,
3593
+ validateOnValueUpdate: false,
3594
+ });
3595
+ // If there is a v-model applied on the component we need to emit the `update:modelValue` whenever the value binding changes
3596
+ const onChangeHandler = hasModelEvents
3597
+ ? function handleChangeWithModel(e, shouldValidate = true) {
3598
+ handleChange(e, shouldValidate);
3599
+ ctx.emit('update:modelValue', value.value);
3600
+ }
3601
+ : handleChange;
3602
+ const handleInput = (e) => {
3603
+ if (!hasCheckedAttr(ctx.attrs.type)) {
3604
+ value.value = normalizeEventValue(e);
3605
+ }
3606
+ };
3607
+ const onInputHandler = hasModelEvents
3608
+ ? function handleInputWithModel(e) {
3609
+ handleInput(e);
3610
+ ctx.emit('update:modelValue', value.value);
3611
+ }
3612
+ : handleInput;
3613
+ const fieldProps = vue.computed(() => {
3614
+ const { validateOnInput, validateOnChange, validateOnBlur, validateOnModelUpdate } = resolveValidationTriggers(props);
3615
+ const baseOnBlur = [handleBlur, ctx.attrs.onBlur, validateOnBlur ? validateField : undefined].filter(Boolean);
3616
+ const baseOnInput = [(e) => onChangeHandler(e, validateOnInput), ctx.attrs.onInput].filter(Boolean);
3617
+ const baseOnChange = [(e) => onChangeHandler(e, validateOnChange), ctx.attrs.onChange].filter(Boolean);
3618
+ const attrs = {
3619
+ name: props.name,
3620
+ onBlur: baseOnBlur,
3621
+ onInput: baseOnInput,
3622
+ onChange: baseOnChange,
3623
+ };
3624
+ attrs['onUpdate:modelValue'] = e => onChangeHandler(e, validateOnModelUpdate);
3625
+ if (hasCheckedAttr(ctx.attrs.type) && checked) {
3626
+ attrs.checked = checked.value;
3627
+ }
3628
+ else {
3629
+ attrs.value = value.value;
3630
+ }
3631
+ const tag = resolveTag(props, ctx);
3632
+ if (shouldHaveValueBinding(tag, ctx.attrs)) {
3633
+ delete attrs.value;
3634
+ }
3635
+ return attrs;
3636
+ });
3637
+ const modelValue = vue.toRef(props, 'modelValue');
3638
+ vue.watch(modelValue, newModelValue => {
3639
+ // Don't attempt to sync absent values
3640
+ if (newModelValue === IS_ABSENT && value.value === undefined) {
3641
+ return;
3642
+ }
3643
+ if (newModelValue !== applyModifiers(value.value, props.modelModifiers)) {
3644
+ value.value = newModelValue === IS_ABSENT ? undefined : newModelValue;
3645
+ validateField();
3646
+ }
3647
+ });
3648
+ function slotProps() {
3649
+ return {
3650
+ field: fieldProps.value,
3651
+ value: value.value,
3652
+ meta,
3653
+ errors: errors.value,
3654
+ errorMessage: errorMessage.value,
3655
+ validate: validateField,
3656
+ resetField,
3657
+ handleChange: onChangeHandler,
3658
+ handleInput: onInputHandler,
3659
+ handleReset,
3660
+ handleBlur,
3661
+ setTouched,
3662
+ setErrors,
3663
+ };
3664
+ }
3665
+ ctx.expose({
3666
+ setErrors,
3667
+ setTouched,
3668
+ reset: resetField,
3669
+ validate: validateField,
3670
+ handleChange,
3671
+ });
3672
+ return () => {
3673
+ const tag = vue.resolveDynamicComponent(resolveTag(props, ctx));
3674
+ const children = normalizeChildren(tag, ctx, slotProps);
3675
+ if (tag) {
3676
+ return vue.h(tag, Object.assign(Object.assign({}, ctx.attrs), fieldProps.value), children);
3677
+ }
3678
+ return children;
3679
+ };
3680
+ },
3681
+ });
3682
+ function resolveTag(props, ctx) {
3683
+ let tag = props.as || '';
3684
+ if (!props.as && !ctx.slots.default) {
3685
+ tag = 'input';
3686
+ }
3687
+ return tag;
3688
+ }
3689
+ function resolveValidationTriggers(props) {
3690
+ var _a, _b, _c, _d;
3691
+ const { validateOnInput, validateOnChange, validateOnBlur, validateOnModelUpdate } = getConfig();
3692
+ return {
3693
+ validateOnInput: (_a = props.validateOnInput) !== null && _a !== void 0 ? _a : validateOnInput,
3694
+ validateOnChange: (_b = props.validateOnChange) !== null && _b !== void 0 ? _b : validateOnChange,
3695
+ validateOnBlur: (_c = props.validateOnBlur) !== null && _c !== void 0 ? _c : validateOnBlur,
3696
+ validateOnModelUpdate: (_d = props.validateOnModelUpdate) !== null && _d !== void 0 ? _d : validateOnModelUpdate,
3697
+ };
3698
+ }
3699
+ function applyModifiers(value, modifiers) {
3700
+ if (modifiers.number) {
3701
+ return toNumber(value);
3702
+ }
3703
+ return value;
3704
+ }
3705
+ function resolveInitialValue(props, ctx) {
3706
+ // Gets the initial value either from `value` prop/attr or `v-model` binding (modelValue)
3707
+ // For checkboxes and radio buttons it will always be the model value not the `value` attribute
3708
+ if (!hasCheckedAttr(ctx.attrs.type)) {
3709
+ return isPropPresent(props, 'modelValue') ? props.modelValue : ctx.attrs.value;
3710
+ }
3711
+ return isPropPresent(props, 'modelValue') ? props.modelValue : undefined;
3712
+ }
3713
+ const Field = FieldImpl;
3714
+
3715
+ let FORM_COUNTER = 0;
3716
+ function useForm(opts) {
3717
+ const formId = FORM_COUNTER++;
3718
+ // Prevents fields from double resetting their values, which causes checkboxes to toggle their initial value
3719
+ // TODO: This won't be needed if we centralize all the state inside the `form` for form inputs
3720
+ let RESET_LOCK = false;
3721
+ // A lookup containing fields or field groups
3722
+ const fieldsByPath = vue.ref({});
3723
+ // If the form is currently submitting
3724
+ const isSubmitting = vue.ref(false);
3725
+ // The number of times the user tried to submit the form
3726
+ const submitCount = vue.ref(0);
3727
+ // dictionary for field arrays to receive various signals like reset
3728
+ const fieldArraysLookup = {};
3729
+ // a private ref for all form values
3730
+ const formValues = vue.reactive(klona(vue.unref(opts === null || opts === void 0 ? void 0 : opts.initialValues) || {}));
3731
+ // the source of errors for the form fields
3732
+ const { errorBag, setErrorBag, setFieldErrorBag } = useErrorBag(opts === null || opts === void 0 ? void 0 : opts.initialErrors);
3733
+ // Gets the first error of each field
3734
+ const errors = vue.computed(() => {
3735
+ return keysOf(errorBag.value).reduce((acc, key) => {
3736
+ const bag = errorBag.value[key];
3737
+ if (bag && bag.length) {
3738
+ acc[key] = bag[0];
3739
+ }
3740
+ return acc;
3741
+ }, {});
3742
+ });
3743
+ function getFirstFieldAtPath(path) {
3744
+ const fieldOrGroup = fieldsByPath.value[path];
3745
+ return Array.isArray(fieldOrGroup) ? fieldOrGroup[0] : fieldOrGroup;
3746
+ }
3747
+ function fieldExists(path) {
3748
+ return !!fieldsByPath.value[path];
3749
+ }
3750
+ /**
3751
+ * Holds a computed reference to all fields names and labels
3752
+ */
3753
+ const fieldNames = vue.computed(() => {
3754
+ return keysOf(fieldsByPath.value).reduce((names, path) => {
3755
+ const field = getFirstFieldAtPath(path);
3756
+ if (field) {
3757
+ names[path] = vue.unref(field.label || field.name) || '';
3758
+ }
3759
+ return names;
3760
+ }, {});
3761
+ });
3762
+ const fieldBailsMap = vue.computed(() => {
3763
+ return keysOf(fieldsByPath.value).reduce((map, path) => {
3764
+ var _a;
3765
+ const field = getFirstFieldAtPath(path);
3766
+ if (field) {
3767
+ map[path] = (_a = field.bails) !== null && _a !== void 0 ? _a : true;
3768
+ }
3769
+ return map;
3770
+ }, {});
3771
+ });
3772
+ // mutable non-reactive reference to initial errors
3773
+ // we need this to process initial errors then unset them
3774
+ const initialErrors = Object.assign({}, ((opts === null || opts === void 0 ? void 0 : opts.initialErrors) || {}));
3775
+ // initial form values
3776
+ const { initialValues, originalInitialValues, setInitialValues } = useFormInitialValues(fieldsByPath, formValues, opts === null || opts === void 0 ? void 0 : opts.initialValues);
3777
+ // form meta aggregations
3778
+ const meta = useFormMeta(fieldsByPath, formValues, initialValues, errors);
3779
+ const schema = opts === null || opts === void 0 ? void 0 : opts.validationSchema;
3780
+ const formCtx = {
3781
+ formId,
3782
+ fieldsByPath,
3783
+ values: formValues,
3784
+ errorBag,
3785
+ errors,
3786
+ schema,
3787
+ submitCount,
3788
+ meta,
3789
+ isSubmitting,
3790
+ fieldArraysLookup,
3791
+ validateSchema: vue.unref(schema) ? validateSchema : undefined,
3792
+ validate,
3793
+ register: registerField,
3794
+ unregister: unregisterField,
3795
+ setFieldErrorBag,
3796
+ validateField,
3797
+ setFieldValue,
3798
+ setValues,
3799
+ setErrors,
3800
+ setFieldError,
3801
+ setFieldTouched,
3802
+ setTouched,
3803
+ resetForm,
3804
+ handleSubmit,
3805
+ stageInitialValue,
3806
+ unsetInitialValue,
3807
+ setFieldInitialValue,
3808
+ };
3809
+ function isFieldGroup(fieldOrGroup) {
3810
+ return Array.isArray(fieldOrGroup);
3811
+ }
3812
+ function applyFieldMutation(fieldOrGroup, mutation) {
3813
+ if (Array.isArray(fieldOrGroup)) {
3814
+ return fieldOrGroup.forEach(mutation);
3815
+ }
3816
+ return mutation(fieldOrGroup);
3817
+ }
3818
+ function mutateAllFields(mutation) {
3819
+ Object.values(fieldsByPath.value).forEach(field => {
3820
+ if (!field) {
3821
+ return;
3822
+ }
3823
+ // avoid resetting the field values, because they should've been reset already.
3824
+ applyFieldMutation(field, mutation);
3825
+ });
3826
+ }
3827
+ /**
3828
+ * Manually sets an error message on a specific field
3829
+ */
3830
+ function setFieldError(field, message) {
3831
+ setFieldErrorBag(field, message);
3832
+ }
3833
+ /**
3834
+ * Sets errors for the fields specified in the object
3835
+ */
3836
+ function setErrors(fields) {
3837
+ setErrorBag(fields);
3838
+ }
3839
+ /**
3840
+ * Sets a single field value
3841
+ */
3842
+ function setFieldValue(field, value, { force } = { force: false }) {
3843
+ var _a;
3844
+ const fieldInstance = fieldsByPath.value[field];
3845
+ const clonedValue = klona(value);
3846
+ // field wasn't found, create a virtual field as a placeholder
3847
+ if (!fieldInstance) {
3848
+ setInPath(formValues, field, clonedValue);
3849
+ return;
3850
+ }
3851
+ if (isFieldGroup(fieldInstance) && ((_a = fieldInstance[0]) === null || _a === void 0 ? void 0 : _a.type) === 'checkbox' && !Array.isArray(value)) {
3852
+ // Multiple checkboxes, and only one of them got updated
3853
+ const newValue = klona(resolveNextCheckboxValue(getFromPath(formValues, field) || [], value, undefined));
3854
+ setInPath(formValues, field, newValue);
3855
+ return;
3856
+ }
3857
+ let newValue = value;
3858
+ // Single Checkbox: toggles the field value unless the field is being reset then force it
3859
+ if (!isFieldGroup(fieldInstance) && fieldInstance.type === 'checkbox' && !force && !RESET_LOCK) {
3860
+ newValue = klona(resolveNextCheckboxValue(getFromPath(formValues, field), value, vue.unref(fieldInstance.uncheckedValue)));
3861
+ }
3862
+ setInPath(formValues, field, newValue);
3863
+ }
3864
+ /**
3865
+ * Sets multiple fields values
3866
+ */
3867
+ function setValues(fields) {
3868
+ // clean up old values
3869
+ keysOf(formValues).forEach(key => {
3870
+ delete formValues[key];
3871
+ });
3872
+ // set up new values
3873
+ keysOf(fields).forEach(path => {
3874
+ setFieldValue(path, fields[path]);
3875
+ });
3876
+ // regenerate the arrays when the form values change
3877
+ Object.values(fieldArraysLookup).forEach(f => f && f.reset());
3878
+ }
3879
+ /**
3880
+ * Sets the touched meta state on a field
3881
+ */
3882
+ function setFieldTouched(field, isTouched) {
3883
+ const fieldInstance = fieldsByPath.value[field];
3884
+ if (fieldInstance) {
3885
+ applyFieldMutation(fieldInstance, f => f.setTouched(isTouched));
3886
+ }
3887
+ }
3888
+ /**
3889
+ * Sets the touched meta state on multiple fields
3890
+ */
3891
+ function setTouched(fields) {
3892
+ keysOf(fields).forEach(field => {
3893
+ setFieldTouched(field, !!fields[field]);
3894
+ });
3895
+ }
3896
+ /**
3897
+ * Resets all fields
3898
+ */
3899
+ function resetForm(state) {
3900
+ RESET_LOCK = true;
3901
+ // set initial values if provided
3902
+ if (state === null || state === void 0 ? void 0 : state.values) {
3903
+ setInitialValues(state.values);
3904
+ setValues(state === null || state === void 0 ? void 0 : state.values);
3905
+ }
3906
+ else {
3907
+ // clean up the initial values back to the original
3908
+ setInitialValues(originalInitialValues.value);
3909
+ // otherwise clean the current values
3910
+ setValues(originalInitialValues.value);
3911
+ }
3912
+ // avoid resetting the field values, because they should've been reset already.
3913
+ mutateAllFields(f => f.resetField());
3914
+ if (state === null || state === void 0 ? void 0 : state.touched) {
3915
+ setTouched(state.touched);
3916
+ }
3917
+ setErrors((state === null || state === void 0 ? void 0 : state.errors) || {});
3918
+ submitCount.value = (state === null || state === void 0 ? void 0 : state.submitCount) || 0;
3919
+ vue.nextTick(() => {
3920
+ RESET_LOCK = false;
3921
+ });
3922
+ }
3923
+ function insertFieldAtPath(field, path) {
3924
+ const rawField = vue.markRaw(field);
3925
+ const fieldPath = path;
3926
+ // first field at that path
3927
+ if (!fieldsByPath.value[fieldPath]) {
3928
+ fieldsByPath.value[fieldPath] = rawField;
3929
+ return;
3930
+ }
3931
+ const fieldAtPath = fieldsByPath.value[fieldPath];
3932
+ if (fieldAtPath && !Array.isArray(fieldAtPath)) {
3933
+ fieldsByPath.value[fieldPath] = [fieldAtPath];
3934
+ }
3935
+ // add the new array to that path
3936
+ fieldsByPath.value[fieldPath] = [...fieldsByPath.value[fieldPath], rawField];
3937
+ }
3938
+ function removeFieldFromPath(field, path) {
3939
+ const fieldPath = path;
3940
+ const fieldAtPath = fieldsByPath.value[fieldPath];
3941
+ if (!fieldAtPath) {
3942
+ return;
3943
+ }
3944
+ // same field at path
3945
+ if (!isFieldGroup(fieldAtPath) && field.id === fieldAtPath.id) {
3946
+ delete fieldsByPath.value[fieldPath];
3947
+ return;
3948
+ }
3949
+ if (isFieldGroup(fieldAtPath)) {
3950
+ const idx = fieldAtPath.findIndex(f => f.id === field.id);
3951
+ if (idx === -1) {
3952
+ return;
3953
+ }
3954
+ fieldAtPath.splice(idx, 1);
3955
+ if (fieldAtPath.length === 1) {
3956
+ fieldsByPath.value[fieldPath] = fieldAtPath[0];
3957
+ return;
3958
+ }
3959
+ if (!fieldAtPath.length) {
3960
+ delete fieldsByPath.value[fieldPath];
3961
+ }
3962
+ }
3963
+ }
3964
+ function registerField(field) {
3965
+ const fieldPath = vue.unref(field.name);
3966
+ insertFieldAtPath(field, fieldPath);
3967
+ if (vue.isRef(field.name)) {
3968
+ // ensures when a field's name was already taken that it preserves its same value
3969
+ // necessary for fields generated by loops
3970
+ vue.watch(field.name, async (newPath, oldPath) => {
3971
+ // cache the value
3972
+ await vue.nextTick();
3973
+ removeFieldFromPath(field, oldPath);
3974
+ insertFieldAtPath(field, newPath);
3975
+ // re-validate if either path had errors before
3976
+ if (errors.value[oldPath] || errors.value[newPath]) {
3977
+ // clear up both paths errors
3978
+ setFieldError(oldPath, undefined);
3979
+ validateField(newPath);
3980
+ }
3981
+ // clean up the old path if no other field is sharing that name
3982
+ // #3325
3983
+ await vue.nextTick();
3984
+ if (!fieldExists(oldPath)) {
3985
+ unsetPath(formValues, oldPath);
3986
+ }
3987
+ });
3988
+ }
3989
+ // if field already had errors (initial errors) that's not user-set, validate it again to ensure state is correct
3990
+ // the difference being that `initialErrors` will contain the error message while other errors (pre-validated schema) won't have them as initial errors
3991
+ // #3342
3992
+ const initialErrorMessage = vue.unref(field.errorMessage);
3993
+ if (initialErrorMessage && (initialErrors === null || initialErrors === void 0 ? void 0 : initialErrors[fieldPath]) !== initialErrorMessage) {
3994
+ validateField(fieldPath);
3995
+ }
3996
+ // marks the initial error as "consumed" so it won't be matched later with same non-initial error
3997
+ delete initialErrors[fieldPath];
3998
+ }
3999
+ function unregisterField(field) {
4000
+ const fieldName = vue.unref(field.name);
4001
+ removeFieldFromPath(field, fieldName);
4002
+ vue.nextTick(() => {
4003
+ // clears a field error on unmounted
4004
+ // we wait till next tick to make sure if the field is completely removed and doesn't have any siblings like checkboxes
4005
+ // #3384
4006
+ if (!fieldExists(fieldName)) {
4007
+ setFieldError(fieldName, undefined);
4008
+ unsetPath(formValues, fieldName);
4009
+ }
4010
+ });
4011
+ }
4012
+ async function validate(opts) {
4013
+ mutateAllFields(f => (f.meta.validated = true));
4014
+ if (formCtx.validateSchema) {
4015
+ return formCtx.validateSchema((opts === null || opts === void 0 ? void 0 : opts.mode) || 'force');
4016
+ }
4017
+ // No schema, each field is responsible to validate itself
4018
+ const validations = await Promise.all(Object.values(fieldsByPath.value).map(field => {
4019
+ const fieldInstance = Array.isArray(field) ? field[0] : field;
4020
+ if (!fieldInstance) {
4021
+ return Promise.resolve({ key: '', valid: true, errors: [] });
4022
+ }
4023
+ return fieldInstance.validate(opts).then((result) => {
4024
+ return {
4025
+ key: vue.unref(fieldInstance.name),
4026
+ valid: result.valid,
4027
+ errors: result.errors,
4028
+ };
4029
+ });
4030
+ }));
4031
+ const results = {};
4032
+ const errors = {};
4033
+ for (const validation of validations) {
4034
+ results[validation.key] = {
4035
+ valid: validation.valid,
4036
+ errors: validation.errors,
4037
+ };
4038
+ if (validation.errors.length) {
4039
+ errors[validation.key] = validation.errors[0];
4040
+ }
4041
+ }
4042
+ return {
4043
+ valid: validations.every(r => r.valid),
4044
+ results,
4045
+ errors,
4046
+ };
4047
+ }
4048
+ async function validateField(field) {
4049
+ const fieldInstance = fieldsByPath.value[field];
4050
+ if (!fieldInstance) {
4051
+ vue.warn(`field with name ${field} was not found`);
4052
+ return Promise.resolve({ errors: [], valid: true });
4053
+ }
4054
+ if (Array.isArray(fieldInstance)) {
4055
+ return fieldInstance.map(f => f.validate())[0];
4056
+ }
4057
+ return fieldInstance.validate();
4058
+ }
4059
+ function handleSubmit(fn, onValidationError) {
4060
+ return function submissionHandler(e) {
4061
+ if (e instanceof Event) {
4062
+ e.preventDefault();
4063
+ e.stopPropagation();
4064
+ }
4065
+ // Touch all fields
4066
+ setTouched(keysOf(fieldsByPath.value).reduce((acc, field) => {
4067
+ acc[field] = true;
4068
+ return acc;
4069
+ }, {}));
4070
+ isSubmitting.value = true;
4071
+ submitCount.value++;
4072
+ return validate()
4073
+ .then(result => {
4074
+ if (result.valid && typeof fn === 'function') {
4075
+ return fn(klona(formValues), {
4076
+ evt: e,
4077
+ setErrors,
4078
+ setFieldError,
4079
+ setTouched,
4080
+ setFieldTouched,
4081
+ setValues,
4082
+ setFieldValue,
4083
+ resetForm,
4084
+ });
4085
+ }
4086
+ if (!result.valid && typeof onValidationError === 'function') {
4087
+ onValidationError({
4088
+ values: klona(formValues),
4089
+ evt: e,
4090
+ errors: result.errors,
4091
+ results: result.results,
4092
+ });
4093
+ }
4094
+ })
4095
+ .then(returnVal => {
4096
+ isSubmitting.value = false;
4097
+ return returnVal;
4098
+ }, err => {
4099
+ isSubmitting.value = false;
4100
+ // re-throw the err so it doesn't go silent
4101
+ throw err;
4102
+ });
4103
+ };
4104
+ }
4105
+ function setFieldInitialValue(path, value) {
4106
+ setInPath(initialValues.value, path, klona(value));
4107
+ }
4108
+ function unsetInitialValue(path) {
4109
+ unsetPath(initialValues.value, path);
4110
+ }
4111
+ /**
4112
+ * Sneaky function to set initial field values
4113
+ */
4114
+ function stageInitialValue(path, value) {
4115
+ setInPath(formValues, path, value);
4116
+ setFieldInitialValue(path, value);
4117
+ }
4118
+ async function _validateSchema() {
4119
+ const schemaValue = vue.unref(schema);
4120
+ if (!schemaValue) {
4121
+ return { valid: true, results: {}, errors: {} };
4122
+ }
4123
+ const formResult = isYupValidator(schemaValue)
4124
+ ? await validateYupSchema(schemaValue, formValues)
4125
+ : await validateObjectSchema(schemaValue, formValues, {
4126
+ names: fieldNames.value,
4127
+ bailsMap: fieldBailsMap.value,
4128
+ });
4129
+ return formResult;
4130
+ }
4131
+ /**
4132
+ * Batches validation runs in 5ms batches
4133
+ */
4134
+ const debouncedSchemaValidation = debounceAsync(_validateSchema, 5);
4135
+ async function validateSchema(mode) {
4136
+ const formResult = await debouncedSchemaValidation();
4137
+ // fields by id lookup
4138
+ const fieldsById = formCtx.fieldsByPath.value || {};
4139
+ // errors fields names, we need it to also check if custom errors are updated
4140
+ const currentErrorsPaths = keysOf(formCtx.errorBag.value);
4141
+ // collect all the keys from the schema and all fields
4142
+ // this ensures we have a complete keymap of all the fields
4143
+ const paths = [
4144
+ ...new Set([...keysOf(formResult.results), ...keysOf(fieldsById), ...currentErrorsPaths]),
4145
+ ];
4146
+ // aggregates the paths into a single result object while applying the results on the fields
4147
+ return paths.reduce((validation, path) => {
4148
+ const field = fieldsById[path];
4149
+ const messages = (formResult.results[path] || { errors: [] }).errors;
4150
+ const fieldResult = {
4151
+ errors: messages,
4152
+ valid: !messages.length,
4153
+ };
4154
+ validation.results[path] = fieldResult;
4155
+ if (!fieldResult.valid) {
4156
+ validation.errors[path] = fieldResult.errors[0];
4157
+ }
4158
+ // field not rendered
4159
+ if (!field) {
4160
+ setFieldError(path, messages);
4161
+ return validation;
4162
+ }
4163
+ // always update the valid flag regardless of the mode
4164
+ applyFieldMutation(field, f => (f.meta.valid = fieldResult.valid));
4165
+ if (mode === 'silent') {
4166
+ return validation;
4167
+ }
4168
+ const wasValidated = Array.isArray(field) ? field.some(f => f.meta.validated) : field.meta.validated;
4169
+ if (mode === 'validated-only' && !wasValidated) {
4170
+ return validation;
4171
+ }
4172
+ applyFieldMutation(field, f => f.setState({ errors: fieldResult.errors }));
4173
+ return validation;
4174
+ }, { valid: formResult.valid, results: {}, errors: {} });
4175
+ }
4176
+ const submitForm = handleSubmit((_, { evt }) => {
4177
+ if (isFormSubmitEvent(evt)) {
4178
+ evt.target.submit();
4179
+ }
4180
+ });
4181
+ // Trigger initial validation
4182
+ vue.onMounted(() => {
4183
+ if (opts === null || opts === void 0 ? void 0 : opts.initialErrors) {
4184
+ setErrors(opts.initialErrors);
4185
+ }
4186
+ if (opts === null || opts === void 0 ? void 0 : opts.initialTouched) {
4187
+ setTouched(opts.initialTouched);
4188
+ }
4189
+ // if validate on mount was enabled
4190
+ if (opts === null || opts === void 0 ? void 0 : opts.validateOnMount) {
4191
+ validate();
4192
+ return;
4193
+ }
4194
+ // otherwise run initial silent validation through schema if available
4195
+ // the useField should skip their own silent validation if a yup schema is present
4196
+ if (formCtx.validateSchema) {
4197
+ formCtx.validateSchema('silent');
4198
+ }
4199
+ });
4200
+ if (vue.isRef(schema)) {
4201
+ vue.watch(schema, () => {
4202
+ var _a;
4203
+ (_a = formCtx.validateSchema) === null || _a === void 0 ? void 0 : _a.call(formCtx, 'validated-only');
4204
+ });
4205
+ }
4206
+ // Provide injections
4207
+ vue.provide(FormContextKey, formCtx);
4208
+ if (("production" !== 'production')) {
4209
+ registerFormWithDevTools(formCtx);
4210
+ vue.watch(() => (Object.assign(Object.assign({ errors: errorBag.value }, meta.value), { values: formValues, isSubmitting: isSubmitting.value, submitCount: submitCount.value })), refreshInspector, {
4211
+ deep: true,
4212
+ });
4213
+ }
4214
+ return {
4215
+ errors,
4216
+ meta,
4217
+ values: formValues,
4218
+ isSubmitting,
4219
+ submitCount,
4220
+ validate,
4221
+ validateField,
4222
+ handleReset: () => resetForm(),
4223
+ resetForm,
4224
+ handleSubmit,
4225
+ submitForm,
4226
+ setFieldError,
4227
+ setErrors,
4228
+ setFieldValue,
4229
+ setValues,
4230
+ setFieldTouched,
4231
+ setTouched,
4232
+ };
4233
+ }
4234
+ /**
4235
+ * Manages form meta aggregation
4236
+ */
4237
+ function useFormMeta(fieldsByPath, currentValues, initialValues, errors) {
4238
+ const MERGE_STRATEGIES = {
4239
+ touched: 'some',
4240
+ pending: 'some',
4241
+ valid: 'every',
4242
+ };
4243
+ const isDirty = vue.computed(() => {
4244
+ return !es6(currentValues, vue.unref(initialValues));
4245
+ });
4246
+ function calculateFlags() {
4247
+ const fields = Object.values(fieldsByPath.value).flat(1).filter(Boolean);
4248
+ return keysOf(MERGE_STRATEGIES).reduce((acc, flag) => {
4249
+ const mergeMethod = MERGE_STRATEGIES[flag];
4250
+ acc[flag] = fields[mergeMethod](field => field.meta[flag]);
4251
+ return acc;
4252
+ }, {});
4253
+ }
4254
+ const flags = vue.reactive(calculateFlags());
4255
+ vue.watchEffect(() => {
4256
+ const value = calculateFlags();
4257
+ flags.touched = value.touched;
4258
+ flags.valid = value.valid;
4259
+ flags.pending = value.pending;
4260
+ });
4261
+ return vue.computed(() => {
4262
+ return Object.assign(Object.assign({ initialValues: vue.unref(initialValues) }, flags), { valid: flags.valid && !keysOf(errors.value).length, dirty: isDirty.value });
4263
+ });
4264
+ }
4265
+ /**
4266
+ * Manages the initial values prop
4267
+ */
4268
+ function useFormInitialValues(fields, formValues, providedValues) {
4269
+ // these are the mutable initial values as the fields are mounted/unmounted
4270
+ const initialValues = vue.ref(klona(vue.unref(providedValues)) || {});
4271
+ // these are the original initial value as provided by the user initially, they don't keep track of conditional fields
4272
+ // this is important because some conditional fields will overwrite the initial values for other fields who had the same name
4273
+ // like array fields, any push/insert operation will overwrite the initial values because they "create new fields"
4274
+ // so these are the values that the reset function should use
4275
+ // these only change when the user explicitly chanegs the initial values or when the user resets them with new values.
4276
+ const originalInitialValues = vue.ref(klona(vue.unref(providedValues)) || {});
4277
+ function setInitialValues(values, updateFields = false) {
4278
+ initialValues.value = klona(values);
4279
+ originalInitialValues.value = klona(values);
4280
+ if (!updateFields) {
4281
+ return;
4282
+ }
4283
+ // update the pristine non-touched fields
4284
+ // those are excluded because it's unlikely you want to change the form values using initial values
4285
+ // we mostly watch them for API population or newly inserted fields
4286
+ // if the user API is taking too much time before user interaction they should consider disabling or hiding their inputs until the values are ready
4287
+ keysOf(fields.value).forEach(fieldPath => {
4288
+ const field = fields.value[fieldPath];
4289
+ const wasTouched = Array.isArray(field) ? field.some(f => f.meta.touched) : field === null || field === void 0 ? void 0 : field.meta.touched;
4290
+ if (!field || wasTouched) {
4291
+ return;
4292
+ }
4293
+ const newValue = getFromPath(initialValues.value, fieldPath);
4294
+ setInPath(formValues, fieldPath, klona(newValue));
4295
+ });
4296
+ }
4297
+ if (vue.isRef(providedValues)) {
4298
+ vue.watch(providedValues, value => {
4299
+ setInitialValues(value, true);
4300
+ }, {
4301
+ deep: true,
4302
+ });
4303
+ }
4304
+ return {
4305
+ initialValues,
4306
+ originalInitialValues,
4307
+ setInitialValues,
4308
+ };
4309
+ }
4310
+ function useErrorBag(initialErrors) {
4311
+ const errorBag = vue.ref({});
4312
+ function normalizeErrorItem(message) {
4313
+ return Array.isArray(message) ? message : message ? [message] : [];
4314
+ }
4315
+ /**
4316
+ * Manually sets an error message on a specific field
4317
+ */
4318
+ function setFieldErrorBag(field, message) {
4319
+ if (!message) {
4320
+ delete errorBag.value[field];
4321
+ return;
4322
+ }
4323
+ errorBag.value[field] = normalizeErrorItem(message);
4324
+ }
4325
+ /**
4326
+ * Sets errors for the fields specified in the object
4327
+ */
4328
+ function setErrorBag(fields) {
4329
+ errorBag.value = keysOf(fields).reduce((acc, key) => {
4330
+ const message = fields[key];
4331
+ if (message) {
4332
+ acc[key] = normalizeErrorItem(message);
4333
+ }
4334
+ return acc;
4335
+ }, {});
4336
+ }
4337
+ if (initialErrors) {
4338
+ setErrorBag(initialErrors);
4339
+ }
4340
+ return {
4341
+ errorBag,
4342
+ setErrorBag,
4343
+ setFieldErrorBag,
4344
+ };
4345
+ }
4346
+
4347
+ const FormImpl = vue.defineComponent({
4348
+ name: 'Form',
4349
+ inheritAttrs: false,
4350
+ props: {
4351
+ as: {
4352
+ type: String,
4353
+ default: 'form',
4354
+ },
4355
+ validationSchema: {
4356
+ type: Object,
4357
+ default: undefined,
4358
+ },
4359
+ initialValues: {
4360
+ type: Object,
4361
+ default: undefined,
4362
+ },
4363
+ initialErrors: {
4364
+ type: Object,
4365
+ default: undefined,
4366
+ },
4367
+ initialTouched: {
4368
+ type: Object,
4369
+ default: undefined,
4370
+ },
4371
+ validateOnMount: {
4372
+ type: Boolean,
4373
+ default: false,
4374
+ },
4375
+ onSubmit: {
4376
+ type: Function,
4377
+ default: undefined,
4378
+ },
4379
+ onInvalidSubmit: {
4380
+ type: Function,
4381
+ default: undefined,
4382
+ },
4383
+ },
4384
+ setup(props, ctx) {
4385
+ const initialValues = vue.toRef(props, 'initialValues');
4386
+ const validationSchema = vue.toRef(props, 'validationSchema');
4387
+ const { errors, values, meta, isSubmitting, submitCount, validate, validateField, handleReset, resetForm, handleSubmit, submitForm, setErrors, setFieldError, setFieldValue, setValues, setFieldTouched, setTouched, } = useForm({
4388
+ validationSchema: validationSchema.value ? validationSchema : undefined,
4389
+ initialValues,
4390
+ initialErrors: props.initialErrors,
4391
+ initialTouched: props.initialTouched,
4392
+ validateOnMount: props.validateOnMount,
4393
+ });
4394
+ const onSubmit = props.onSubmit ? handleSubmit(props.onSubmit, props.onInvalidSubmit) : submitForm;
4395
+ function handleFormReset(e) {
4396
+ if (isEvent(e)) {
4397
+ // Prevent default form reset behavior
4398
+ e.preventDefault();
4399
+ }
4400
+ handleReset();
4401
+ if (typeof ctx.attrs.onReset === 'function') {
4402
+ ctx.attrs.onReset();
4403
+ }
4404
+ }
4405
+ function handleScopedSlotSubmit(evt, onSubmit) {
4406
+ const onSuccess = typeof evt === 'function' && !onSubmit ? evt : onSubmit;
4407
+ return handleSubmit(onSuccess, props.onInvalidSubmit)(evt);
4408
+ }
4409
+ function slotProps() {
4410
+ return {
4411
+ meta: meta.value,
4412
+ errors: errors.value,
4413
+ values: values,
4414
+ isSubmitting: isSubmitting.value,
4415
+ submitCount: submitCount.value,
4416
+ validate,
4417
+ validateField,
4418
+ handleSubmit: handleScopedSlotSubmit,
4419
+ handleReset,
4420
+ submitForm,
4421
+ setErrors,
4422
+ setFieldError,
4423
+ setFieldValue,
4424
+ setValues,
4425
+ setFieldTouched,
4426
+ setTouched,
4427
+ resetForm,
4428
+ };
4429
+ }
4430
+ // expose these functions and methods as part of public API
4431
+ ctx.expose({
4432
+ setFieldError,
4433
+ setErrors,
4434
+ setFieldValue,
4435
+ setValues,
4436
+ setFieldTouched,
4437
+ setTouched,
4438
+ resetForm,
4439
+ validate,
4440
+ validateField,
4441
+ });
4442
+ return function renderForm() {
4443
+ // avoid resolving the form component as itself
4444
+ const tag = props.as === 'form' ? props.as : vue.resolveDynamicComponent(props.as);
4445
+ const children = normalizeChildren(tag, ctx, slotProps);
4446
+ if (!props.as) {
4447
+ return children;
4448
+ }
4449
+ // Attributes to add on a native `form` tag
4450
+ const formAttrs = props.as === 'form'
4451
+ ? {
4452
+ // Disables native validation as vee-validate will handle it.
4453
+ novalidate: true,
4454
+ }
4455
+ : {};
4456
+ return vue.h(tag, Object.assign(Object.assign(Object.assign({}, formAttrs), ctx.attrs), { onSubmit, onReset: handleFormReset }), children);
4457
+ };
4458
+ },
4459
+ });
4460
+ const Form = FormImpl;
4461
+
4462
+ let FIELD_ARRAY_COUNTER = 0;
4463
+ function useFieldArray(arrayPath) {
4464
+ const id = FIELD_ARRAY_COUNTER++;
4465
+ const form = injectWithSelf(FormContextKey, undefined);
4466
+ const fields = vue.ref([]);
4467
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
4468
+ const noOp = () => { };
4469
+ const noOpApi = {
4470
+ fields: vue.readonly(fields),
4471
+ remove: noOp,
4472
+ push: noOp,
4473
+ swap: noOp,
4474
+ insert: noOp,
4475
+ update: noOp,
4476
+ replace: noOp,
4477
+ prepend: noOp,
4478
+ };
4479
+ if (!form) {
4480
+ warn('FieldArray requires being a child of `<Form/>` or `useForm` being called before it. Array fields may not work correctly');
4481
+ return noOpApi;
4482
+ }
4483
+ if (!vue.unref(arrayPath)) {
4484
+ warn('FieldArray requires a field path to be provided, did you forget to pass the `name` prop?');
4485
+ return noOpApi;
4486
+ }
4487
+ let entryCounter = 0;
4488
+ function initFields() {
4489
+ const currentValues = getFromPath(form === null || form === void 0 ? void 0 : form.values, vue.unref(arrayPath), []);
4490
+ fields.value = currentValues.map(createEntry);
4491
+ updateEntryFlags();
4492
+ }
4493
+ initFields();
4494
+ function updateEntryFlags() {
4495
+ const fieldsLength = fields.value.length;
4496
+ for (let i = 0; i < fieldsLength; i++) {
4497
+ const entry = fields.value[i];
4498
+ entry.isFirst = i === 0;
4499
+ entry.isLast = i === fieldsLength - 1;
4500
+ }
4501
+ }
4502
+ function createEntry(value) {
4503
+ const key = entryCounter++;
4504
+ const entry = {
4505
+ key,
4506
+ value: vue.computed(() => {
4507
+ const currentValues = getFromPath(form === null || form === void 0 ? void 0 : form.values, vue.unref(arrayPath), []);
4508
+ const idx = fields.value.findIndex(e => e.key === key);
4509
+ return idx === -1 ? value : currentValues[idx];
4510
+ }),
4511
+ isFirst: false,
4512
+ isLast: false,
4513
+ };
4514
+ return entry;
4515
+ }
4516
+ function remove(idx) {
4517
+ const pathName = vue.unref(arrayPath);
4518
+ const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
4519
+ if (!pathValue || !Array.isArray(pathValue)) {
4520
+ return;
4521
+ }
4522
+ const newValue = [...pathValue];
4523
+ newValue.splice(idx, 1);
4524
+ form === null || form === void 0 ? void 0 : form.unsetInitialValue(pathName + `[${idx}]`);
4525
+ form === null || form === void 0 ? void 0 : form.setFieldValue(pathName, newValue);
4526
+ fields.value.splice(idx, 1);
4527
+ updateEntryFlags();
4528
+ }
4529
+ function push(value) {
4530
+ const pathName = vue.unref(arrayPath);
4531
+ const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
4532
+ const normalizedPathValue = isNullOrUndefined(pathValue) ? [] : pathValue;
4533
+ if (!Array.isArray(normalizedPathValue)) {
4534
+ return;
4535
+ }
4536
+ const newValue = [...normalizedPathValue];
4537
+ newValue.push(value);
4538
+ form === null || form === void 0 ? void 0 : form.stageInitialValue(pathName + `[${newValue.length - 1}]`, value);
4539
+ form === null || form === void 0 ? void 0 : form.setFieldValue(pathName, newValue);
4540
+ fields.value.push(createEntry(value));
4541
+ updateEntryFlags();
4542
+ }
4543
+ function swap(indexA, indexB) {
4544
+ const pathName = vue.unref(arrayPath);
4545
+ const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
4546
+ if (!Array.isArray(pathValue) || !(indexA in pathValue) || !(indexB in pathValue)) {
4547
+ return;
4548
+ }
4549
+ const newValue = [...pathValue];
4550
+ const newFields = [...fields.value];
4551
+ // the old switcheroo
4552
+ const temp = newValue[indexA];
4553
+ newValue[indexA] = newValue[indexB];
4554
+ newValue[indexB] = temp;
4555
+ const tempEntry = newFields[indexA];
4556
+ newFields[indexA] = newFields[indexB];
4557
+ newFields[indexB] = tempEntry;
4558
+ form === null || form === void 0 ? void 0 : form.setFieldValue(pathName, newValue);
4559
+ fields.value = newFields;
4560
+ updateEntryFlags();
4561
+ }
4562
+ function insert(idx, value) {
4563
+ const pathName = vue.unref(arrayPath);
4564
+ const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
4565
+ if (!Array.isArray(pathValue) || pathValue.length < idx) {
4566
+ return;
4567
+ }
4568
+ const newValue = [...pathValue];
4569
+ const newFields = [...fields.value];
4570
+ newValue.splice(idx, 0, value);
4571
+ newFields.splice(idx, 0, createEntry(value));
4572
+ form === null || form === void 0 ? void 0 : form.setFieldValue(pathName, newValue);
4573
+ fields.value = newFields;
4574
+ updateEntryFlags();
4575
+ }
4576
+ function replace(arr) {
4577
+ const pathName = vue.unref(arrayPath);
4578
+ form === null || form === void 0 ? void 0 : form.setFieldValue(pathName, arr);
4579
+ initFields();
4580
+ }
4581
+ function update(idx, value) {
4582
+ const pathName = vue.unref(arrayPath);
4583
+ const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
4584
+ if (!Array.isArray(pathValue) || pathValue.length - 1 < idx) {
4585
+ return;
4586
+ }
4587
+ form === null || form === void 0 ? void 0 : form.setFieldValue(`${pathName}[${idx}]`, value);
4588
+ }
4589
+ function prepend(value) {
4590
+ const pathName = vue.unref(arrayPath);
4591
+ const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
4592
+ const normalizedPathValue = isNullOrUndefined(pathValue) ? [] : pathValue;
4593
+ if (!Array.isArray(normalizedPathValue)) {
4594
+ return;
4595
+ }
4596
+ const newValue = [value, ...normalizedPathValue];
4597
+ form === null || form === void 0 ? void 0 : form.stageInitialValue(pathName + `[${newValue.length - 1}]`, value);
4598
+ form === null || form === void 0 ? void 0 : form.setFieldValue(pathName, newValue);
4599
+ fields.value.unshift(createEntry(value));
4600
+ updateEntryFlags();
4601
+ }
4602
+ form.fieldArraysLookup[id] = {
4603
+ reset: initFields,
4604
+ };
4605
+ vue.onBeforeUnmount(() => {
4606
+ delete form.fieldArraysLookup[id];
4607
+ });
4608
+ return {
4609
+ fields: vue.readonly(fields),
4610
+ remove,
4611
+ push,
4612
+ swap,
4613
+ insert,
4614
+ update,
4615
+ replace,
4616
+ prepend,
4617
+ };
4618
+ }
4619
+
4620
+ const FieldArrayImpl = vue.defineComponent({
4621
+ name: 'FieldArray',
4622
+ inheritAttrs: false,
4623
+ props: {
4624
+ name: {
4625
+ type: String,
4626
+ required: true,
4627
+ },
4628
+ },
4629
+ setup(props, ctx) {
4630
+ const { push, remove, swap, insert, replace, update, prepend, fields } = useFieldArray(vue.toRef(props, 'name'));
4631
+ function slotProps() {
4632
+ return {
4633
+ fields: fields.value,
4634
+ push,
4635
+ remove,
4636
+ swap,
4637
+ insert,
4638
+ update,
4639
+ replace,
4640
+ prepend,
4641
+ };
4642
+ }
4643
+ ctx.expose({
4644
+ push,
4645
+ remove,
4646
+ swap,
4647
+ insert,
4648
+ update,
4649
+ replace,
4650
+ prepend,
4651
+ });
4652
+ return () => {
4653
+ const children = normalizeChildren(undefined, ctx, slotProps);
4654
+ return children;
4655
+ };
4656
+ },
4657
+ });
4658
+ const FieldArray = FieldArrayImpl;
4659
+
4660
+ const ErrorMessageImpl = vue.defineComponent({
4661
+ name: 'ErrorMessage',
4662
+ props: {
4663
+ as: {
4664
+ type: String,
4665
+ default: undefined,
4666
+ },
4667
+ name: {
4668
+ type: String,
4669
+ required: true,
4670
+ },
4671
+ },
4672
+ setup(props, ctx) {
4673
+ const form = vue.inject(FormContextKey, undefined);
4674
+ const message = vue.computed(() => {
4675
+ return form === null || form === void 0 ? void 0 : form.errors.value[props.name];
4676
+ });
4677
+ function slotProps() {
4678
+ return {
4679
+ message: message.value,
4680
+ };
4681
+ }
4682
+ return () => {
4683
+ // Renders nothing if there are no messages
4684
+ if (!message.value) {
4685
+ return undefined;
4686
+ }
4687
+ const tag = (props.as ? vue.resolveDynamicComponent(props.as) : props.as);
4688
+ const children = normalizeChildren(tag, ctx, slotProps);
4689
+ const attrs = Object.assign({ role: 'alert' }, ctx.attrs);
4690
+ // If no tag was specified and there are children
4691
+ // render the slot as is without wrapping it
4692
+ if (!tag && (Array.isArray(children) || !children) && (children === null || children === void 0 ? void 0 : children.length)) {
4693
+ return children;
4694
+ }
4695
+ // If no children in slot
4696
+ // render whatever specified and fallback to a <span> with the message in it's contents
4697
+ if ((Array.isArray(children) || !children) && !(children === null || children === void 0 ? void 0 : children.length)) {
4698
+ return vue.h(tag || 'span', attrs, message.value);
4699
+ }
4700
+ return vue.h(tag, attrs, children);
4701
+ };
4702
+ },
4703
+ });
4704
+ const ErrorMessage = ErrorMessageImpl;
4705
+
4706
+ function useResetForm() {
4707
+ const form = injectWithSelf(FormContextKey);
4708
+ if (!form) {
4709
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
4710
+ }
4711
+ return function resetForm(state) {
4712
+ if (!form) {
4713
+ return;
4714
+ }
4715
+ return form.resetForm(state);
4716
+ };
4717
+ }
4718
+
4719
+ /**
4720
+ * If a field is dirty or not
4721
+ */
4722
+ function useIsFieldDirty(path) {
4723
+ const form = injectWithSelf(FormContextKey);
4724
+ let field = path ? undefined : vue.inject(FieldContextKey);
4725
+ return vue.computed(() => {
4726
+ if (path) {
4727
+ field = normalizeField(form === null || form === void 0 ? void 0 : form.fieldsByPath.value[vue.unref(path)]);
4728
+ }
4729
+ if (!field) {
4730
+ warn(`field with name ${vue.unref(path)} was not found`);
4731
+ return false;
4732
+ }
4733
+ return field.meta.dirty;
4734
+ });
4735
+ }
4736
+
4737
+ /**
4738
+ * If a field is touched or not
4739
+ */
4740
+ function useIsFieldTouched(path) {
4741
+ const form = injectWithSelf(FormContextKey);
4742
+ let field = path ? undefined : vue.inject(FieldContextKey);
4743
+ return vue.computed(() => {
4744
+ if (path) {
4745
+ field = normalizeField(form === null || form === void 0 ? void 0 : form.fieldsByPath.value[vue.unref(path)]);
4746
+ }
4747
+ if (!field) {
4748
+ warn(`field with name ${vue.unref(path)} was not found`);
4749
+ return false;
4750
+ }
4751
+ return field.meta.touched;
4752
+ });
4753
+ }
4754
+
4755
+ /**
4756
+ * If a field is validated and is valid
4757
+ */
4758
+ function useIsFieldValid(path) {
4759
+ const form = injectWithSelf(FormContextKey);
4760
+ let field = path ? undefined : vue.inject(FieldContextKey);
4761
+ return vue.computed(() => {
4762
+ if (path) {
4763
+ field = normalizeField(form === null || form === void 0 ? void 0 : form.fieldsByPath.value[vue.unref(path)]);
4764
+ }
4765
+ if (!field) {
4766
+ warn(`field with name ${vue.unref(path)} was not found`);
4767
+ return false;
4768
+ }
4769
+ return field.meta.valid;
4770
+ });
4771
+ }
4772
+
4773
+ /**
4774
+ * If the form is submitting or not
4775
+ */
4776
+ function useIsSubmitting() {
4777
+ const form = injectWithSelf(FormContextKey);
4778
+ if (!form) {
4779
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
4780
+ }
4781
+ return vue.computed(() => {
4782
+ var _a;
4783
+ return (_a = form === null || form === void 0 ? void 0 : form.isSubmitting.value) !== null && _a !== void 0 ? _a : false;
4784
+ });
4785
+ }
4786
+
4787
+ /**
4788
+ * Validates a single field
4789
+ */
4790
+ function useValidateField(path) {
4791
+ const form = injectWithSelf(FormContextKey);
4792
+ let field = path ? undefined : vue.inject(FieldContextKey);
4793
+ return function validateField() {
4794
+ if (path) {
4795
+ field = normalizeField(form === null || form === void 0 ? void 0 : form.fieldsByPath.value[vue.unref(path)]);
4796
+ }
4797
+ if (!field) {
4798
+ warn(`field with name ${vue.unref(path)} was not found`);
4799
+ return Promise.resolve({
4800
+ errors: [],
4801
+ valid: true,
4802
+ });
4803
+ }
4804
+ return field.validate();
4805
+ };
4806
+ }
4807
+
4808
+ /**
4809
+ * If the form is dirty or not
4810
+ */
4811
+ function useIsFormDirty() {
4812
+ const form = injectWithSelf(FormContextKey);
4813
+ if (!form) {
4814
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
4815
+ }
4816
+ return vue.computed(() => {
4817
+ var _a;
4818
+ return (_a = form === null || form === void 0 ? void 0 : form.meta.value.dirty) !== null && _a !== void 0 ? _a : false;
4819
+ });
4820
+ }
4821
+
4822
+ /**
4823
+ * If the form is touched or not
4824
+ */
4825
+ function useIsFormTouched() {
4826
+ const form = injectWithSelf(FormContextKey);
4827
+ if (!form) {
4828
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
4829
+ }
4830
+ return vue.computed(() => {
4831
+ var _a;
4832
+ return (_a = form === null || form === void 0 ? void 0 : form.meta.value.touched) !== null && _a !== void 0 ? _a : false;
4833
+ });
4834
+ }
4835
+
4836
+ /**
4837
+ * If the form has been validated and is valid
4838
+ */
4839
+ function useIsFormValid() {
4840
+ const form = injectWithSelf(FormContextKey);
4841
+ if (!form) {
4842
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
4843
+ }
4844
+ return vue.computed(() => {
4845
+ var _a;
4846
+ return (_a = form === null || form === void 0 ? void 0 : form.meta.value.valid) !== null && _a !== void 0 ? _a : false;
4847
+ });
4848
+ }
4849
+
4850
+ /**
4851
+ * Validate multiple fields
4852
+ */
4853
+ function useValidateForm() {
4854
+ const form = injectWithSelf(FormContextKey);
4855
+ if (!form) {
4856
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
4857
+ }
4858
+ return function validateField() {
4859
+ if (!form) {
4860
+ return Promise.resolve({ results: {}, errors: {}, valid: true });
4861
+ }
4862
+ return form.validate();
4863
+ };
4864
+ }
4865
+
4866
+ /**
4867
+ * The number of form's submission count
4868
+ */
4869
+ function useSubmitCount() {
4870
+ const form = injectWithSelf(FormContextKey);
4871
+ if (!form) {
4872
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
4873
+ }
4874
+ return vue.computed(() => {
4875
+ var _a;
4876
+ return (_a = form === null || form === void 0 ? void 0 : form.submitCount.value) !== null && _a !== void 0 ? _a : 0;
4877
+ });
4878
+ }
4879
+
4880
+ /**
4881
+ * Gives access to a field's current value
4882
+ */
4883
+ function useFieldValue(path) {
4884
+ const form = injectWithSelf(FormContextKey);
4885
+ // We don't want to use self injected context as it doesn't make sense
4886
+ const field = path ? undefined : vue.inject(FieldContextKey);
4887
+ return vue.computed(() => {
4888
+ if (path) {
4889
+ return getFromPath(form === null || form === void 0 ? void 0 : form.values, vue.unref(path));
4890
+ }
4891
+ return vue.unref(field === null || field === void 0 ? void 0 : field.value);
4892
+ });
4893
+ }
4894
+
4895
+ /**
4896
+ * Gives access to a form's values
4897
+ */
4898
+ function useFormValues() {
4899
+ const form = injectWithSelf(FormContextKey);
4900
+ if (!form) {
4901
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
4902
+ }
4903
+ return vue.computed(() => {
4904
+ return (form === null || form === void 0 ? void 0 : form.values) || {};
4905
+ });
4906
+ }
4907
+
4908
+ /**
4909
+ * Gives access to all form errors
4910
+ */
4911
+ function useFormErrors() {
4912
+ const form = injectWithSelf(FormContextKey);
4913
+ if (!form) {
4914
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
4915
+ }
4916
+ return vue.computed(() => {
4917
+ return ((form === null || form === void 0 ? void 0 : form.errors.value) || {});
4918
+ });
4919
+ }
4920
+
4921
+ /**
4922
+ * Gives access to a single field error
4923
+ */
4924
+ function useFieldError(path) {
4925
+ const form = injectWithSelf(FormContextKey);
4926
+ // We don't want to use self injected context as it doesn't make sense
4927
+ const field = path ? undefined : vue.inject(FieldContextKey);
4928
+ return vue.computed(() => {
4929
+ if (path) {
4930
+ return form === null || form === void 0 ? void 0 : form.errors.value[vue.unref(path)];
4931
+ }
4932
+ return field === null || field === void 0 ? void 0 : field.errorMessage.value;
4933
+ });
4934
+ }
4935
+
4936
+ function useSubmitForm(cb) {
4937
+ const form = injectWithSelf(FormContextKey);
4938
+ if (!form) {
4939
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
4940
+ }
4941
+ const onSubmit = form ? form.handleSubmit(cb) : undefined;
4942
+ return function submitForm(e) {
4943
+ if (!onSubmit) {
4944
+ return;
4945
+ }
4946
+ return onSubmit(e);
4947
+ };
4948
+ }var script = vue.defineComponent({
4949
+ name: 'FwInput',
4950
+ emits: ['update:modelValue'],
4951
+ components: {
4952
+ InputField: Field
4953
+ },
4954
+ props: {
4955
+ /**
4956
+ * The input v-model
4957
+ */
4958
+ modelValue: {
4959
+ type: String,
4960
+ "default": ''
4961
+ },
4962
+
4963
+ /**
4964
+ * The name of the input field. Must be unique per form.
4965
+ */
4966
+ name: {
4967
+ type: String,
4968
+ required: true
4969
+ },
4970
+
4971
+ /**
4972
+ * The input type. Accepts `text` | `password`
4973
+ */
4974
+ type: {
4975
+ type: String,
4976
+ "default": 'text',
4977
+ validator: function validator(value) {
4978
+ return ['text', 'password'].includes(value);
4979
+ }
4980
+ },
4981
+
4982
+ /**
4983
+ * Label for the input. Also renders to an aria-label attribute
4984
+ */
4985
+ label: {
4986
+ type: String
4987
+ },
4988
+
4989
+ /**
4990
+ * The placeholder text of the input
4991
+ */
4992
+ placeholder: {
4993
+ type: String,
4994
+ "default": ''
4995
+ },
4996
+
4997
+ /**
4998
+ * Validation rules. Accepts a string, object, function or schema.
4999
+ */
5000
+ rules: {
5001
+ type: [String, Object, Function]
5002
+ }
5003
+ },
5004
+ setup: function setup(props, ctx) {
5005
+ var inputValue = vue.computed({
5006
+ get: function get() {
5007
+ return props.modelValue;
5008
+ },
5009
+ set: function set(state) {
5010
+ return ctx.emit('update:modelValue', state);
5011
+ }
5012
+ });
5013
+ return {
5014
+ inputValue: inputValue
5015
+ };
1787
5016
  }
1788
- }var css_248z = ".fw-nav-menu--mobile{z-index:-1}.fw-nav-menu--mobile,.slideInLeft-enter-active{-webkit-transition:left .35s ease-in;-o-transition:left .35s ease-in;transition:left .35s ease-in}.slideInLeft-enter-active{-webkit-animation:slideInLeft .35s;animation:slideInLeft .35s}.slideInLeft-leave-active{animation:slideInLeft .35s reverse;-webkit-transition:left .35s ease-in-out;-o-transition:left .35s ease-in-out;transition:left .35s ease-in-out}@-webkit-keyframes slideInLeft{0%{left:100%}to{left:0}}@keyframes slideInLeft{0%{left:100%}to{left:0}}";
1789
- var stylesheet = ".fw-nav-menu--mobile{z-index:-1}.fw-nav-menu--mobile,.slideInLeft-enter-active{-webkit-transition:left .35s ease-in;-o-transition:left .35s ease-in;transition:left .35s ease-in}.slideInLeft-enter-active{-webkit-animation:slideInLeft .35s;animation:slideInLeft .35s}.slideInLeft-leave-active{animation:slideInLeft .35s reverse;-webkit-transition:left .35s ease-in-out;-o-transition:left .35s ease-in-out;transition:left .35s ease-in-out}@-webkit-keyframes slideInLeft{0%{left:100%}to{left:0}}@keyframes slideInLeft{0%{left:100%}to{left:0}}";
1790
- styleInject(css_248z);script.render = render;var components$1=/*#__PURE__*/Object.freeze({__proto__:null,FwCard:script$2,FwButton:script$1,FwNavigationMenu:script});var install = function install(app) {
5017
+ });var es_function_name = {};var DESCRIPTORS = descriptors;
5018
+ var FUNCTION_NAME_EXISTS = functionName.EXISTS;
5019
+ var uncurryThis = functionUncurryThis;
5020
+ var defineProperty = objectDefineProperty.f;
5021
+
5022
+ var FunctionPrototype = Function.prototype;
5023
+ var functionToString = uncurryThis(FunctionPrototype.toString);
5024
+ var nameRE = /function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/;
5025
+ var regExpExec = uncurryThis(nameRE.exec);
5026
+ var NAME = 'name';
5027
+
5028
+ // Function instances `.name` property
5029
+ // https://tc39.es/ecma262/#sec-function-instances-name
5030
+ if (DESCRIPTORS && !FUNCTION_NAME_EXISTS) {
5031
+ defineProperty(FunctionPrototype, NAME, {
5032
+ configurable: true,
5033
+ get: function () {
5034
+ try {
5035
+ return regExpExec(nameRE, functionToString(this))[1];
5036
+ } catch (error) {
5037
+ return '';
5038
+ }
5039
+ }
5040
+ });
5041
+ }var _hoisted_1 = {
5042
+ "class": "flex flex-col"
5043
+ };
5044
+ var _hoisted_2 = ["for"];
5045
+ var _hoisted_3 = {
5046
+ "class": "relative"
5047
+ };
5048
+ var _hoisted_4 = {
5049
+ key: 0,
5050
+ "class": "flex text-grey-base absolute w-9 h-full inset-y-0 left-0 items-center pl-3 pointer-events-none"
5051
+ };
5052
+ var _hoisted_5 = ["placeholder", "type"];
5053
+ var _hoisted_6 = {
5054
+ key: 0,
5055
+ "class": "flex text-error absolute w-9 h-full inset-y-0 right-0 items-center pr-3 pointer-events-none"
5056
+ };
5057
+
5058
+ var _hoisted_7 = /*#__PURE__*/vue.createElementVNode("svg", {
5059
+ fill: "currentColor",
5060
+ "aria-hidden": "true",
5061
+ focusable: "false",
5062
+ role: "img",
5063
+ xmlns: "http://www.w3.org/2000/svg",
5064
+ viewBox: "0 0 512 512"
5065
+ }, [/*#__PURE__*/vue.createElementVNode("path", {
5066
+ d: "M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM232 152C232 138.8\n 242.8 128 256 128s24 10.75 24 24v128c0 13.25-10.75 24-24 24S232 293.3 232 280V152zM256 400c-17.36\n 0-31.44-14.08-31.44-31.44c0-17.36 14.07-31.44 31.44-31.44s31.44 14.08 31.44 31.44C287.4 385.9 273.4\n 400 256 400z"
5067
+ })], -1);
5068
+
5069
+ var _hoisted_8 = [_hoisted_7];
5070
+ var _hoisted_9 = {
5071
+ "class": "text-error text-right text-sm font-medium mt-2 min-h-[21px]"
5072
+ };
5073
+ var _hoisted_10 = {
5074
+ key: 0
5075
+ };
5076
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
5077
+ var _component_InputField = vue.resolveComponent("InputField");
5078
+
5079
+ return vue.openBlock(), vue.createBlock(_component_InputField, {
5080
+ modelValue: _ctx.inputValue,
5081
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) {
5082
+ return _ctx.inputValue = $event;
5083
+ }),
5084
+ name: _ctx.name,
5085
+ rules: _ctx.rules
5086
+ }, {
5087
+ "default": vue.withCtx(function (_ref) {
5088
+ var field = _ref.field,
5089
+ errorMessage = _ref.errorMessage,
5090
+ meta = _ref.meta;
5091
+ return [vue.createElementVNode("div", _hoisted_1, [_ctx.label ? (vue.openBlock(), vue.createElementBlock("label", {
5092
+ key: 0,
5093
+ "for": _ctx.name,
5094
+ "class": "block mb-2"
5095
+ }, vue.toDisplayString(_ctx.label), 9, _hoisted_2)) : vue.createCommentVNode("", true), vue.createElementVNode("div", _hoisted_3, [_ctx.$slots.prefixIcon ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4, [vue.renderSlot(_ctx.$slots, "prefixIcon")])) : vue.createCommentVNode("", true), vue.createElementVNode("input", vue.mergeProps(field, {
5096
+ placeholder: _ctx.placeholder,
5097
+ type: _ctx.type,
5098
+ "class": ["border-2 border-grey-lightest rounded-lg focus:outline-none focus:ring-2 focus:ring-primary block w-full p-2.5", {
5099
+ 'pl-10': !!_ctx.$slots.prefixIcon
5100
+ }]
5101
+ }), null, 16, _hoisted_5), vue.createVNode(vue.Transition, {
5102
+ name: "errorFadeIn"
5103
+ }, {
5104
+ "default": vue.withCtx(function () {
5105
+ return [errorMessage && meta.touched ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, _hoisted_8)) : vue.createCommentVNode("", true)];
5106
+ }),
5107
+ _: 2
5108
+ }, 1024)]), vue.createElementVNode("div", _hoisted_9, [vue.createVNode(vue.Transition, {
5109
+ name: "errorFadeIn"
5110
+ }, {
5111
+ "default": vue.withCtx(function () {
5112
+ return [errorMessage && meta.touched ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_10, vue.toDisplayString(errorMessage), 1)) : vue.createCommentVNode("", true)];
5113
+ }),
5114
+ _: 2
5115
+ }, 1024)])])];
5116
+ }),
5117
+ _: 3
5118
+ }, 8, ["modelValue", "name", "rules"]);
5119
+ }var css_248z = ".errorFadeIn-enter-active{-webkit-animation:errorFadeIn .35s;animation:errorFadeIn .35s;-webkit-transition:opacity .35s ease-in;-o-transition:opacity .35s ease-in;transition:opacity .35s ease-in}.errorFadeIn-leave-active{animation:errorFadeIn .35s reverse;-webkit-transition:opacity .35s ease-out;-o-transition:opacity .35s ease-out;transition:opacity .35s ease-out}@-webkit-keyframes errorFadeIn{0%{opacity:0}to{opacity:1}}@keyframes errorFadeIn{0%{opacity:0}to{opacity:1}}";
5120
+ var stylesheet = ".errorFadeIn-enter-active{-webkit-animation:errorFadeIn .35s;animation:errorFadeIn .35s;-webkit-transition:opacity .35s ease-in;-o-transition:opacity .35s ease-in;transition:opacity .35s ease-in}.errorFadeIn-leave-active{animation:errorFadeIn .35s reverse;-webkit-transition:opacity .35s ease-out;-o-transition:opacity .35s ease-out;transition:opacity .35s ease-out}@-webkit-keyframes errorFadeIn{0%{opacity:0}to{opacity:1}}@keyframes errorFadeIn{0%{opacity:0}to{opacity:1}}";
5121
+ styleInject(css_248z);script.render = render;var components$1=/*#__PURE__*/Object.freeze({__proto__:null,FwCard:script$3,FwButton:script$2,FwNavigationMenu:script$1,FwInput:script});var install = function install(app) {
1791
5122
  Object.entries(components$1).forEach(function (_ref) {
1792
5123
  var _ref2 = _slicedToArray(_ref, 2),
1793
5124
  componentName = _ref2[0],
@@ -1795,7 +5126,7 @@ styleInject(css_248z);script.render = render;var components$1=/*#__PURE__*/Objec
1795
5126
 
1796
5127
  app.component(componentName, component);
1797
5128
  });
1798
- };var components=/*#__PURE__*/Object.freeze({__proto__:null,'default':install,FwCard:script$2,FwButton:script$1,FwNavigationMenu:script});Object.entries(components).forEach(function (_ref) {
5129
+ };var components=/*#__PURE__*/Object.freeze({__proto__:null,'default':install,FwCard:script$3,FwButton:script$2,FwNavigationMenu:script$1,FwInput:script});Object.entries(components).forEach(function (_ref) {
1799
5130
  var _ref2 = _slicedToArray(_ref, 2),
1800
5131
  componentName = _ref2[0],
1801
5132
  component = _ref2[1];