@frollo/frollo-web-ui 0.0.7 → 0.0.10

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.
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, openBlock, createBlock, resolveDynamicComponent, normalizeClass, withCtx, createElementBlock, toDisplayString, createCommentVNode, renderSlot, ref, createElementVNode, resolveComponent, Fragment, renderList, createTextVNode, createVNode, Transition } from 'vue';
1
+ import { defineComponent, computed, openBlock, createBlock, resolveDynamicComponent, normalizeClass, withCtx, createElementBlock, toDisplayString, createCommentVNode, renderSlot, ref, createElementVNode, resolveComponent, Fragment, renderList, createTextVNode, createVNode, Transition, getCurrentInstance, inject, warn as warn$1, unref, reactive, watch, nextTick, onUnmounted, onMounted, provide, isRef, onBeforeUnmount, toRef, h, markRaw, watchEffect, readonly, mergeProps } from 'vue';
2
2
 
3
3
  function _arrayWithHoles(arr) {
4
4
  if (Array.isArray(arr)) return arr;
@@ -173,35 +173,35 @@ var createPropertyDescriptor$2 = function (bitmap, value) {
173
173
 
174
174
  var NATIVE_BIND$1 = functionBindNative;
175
175
 
176
- var FunctionPrototype$1 = Function.prototype;
177
- var bind$2 = FunctionPrototype$1.bind;
178
- var call$3 = FunctionPrototype$1.call;
179
- var uncurryThis$d = NATIVE_BIND$1 && bind$2.bind(call$3, call$3);
176
+ var FunctionPrototype$2 = Function.prototype;
177
+ var bind$2 = FunctionPrototype$2.bind;
178
+ var call$3 = FunctionPrototype$2.call;
179
+ var uncurryThis$e = NATIVE_BIND$1 && bind$2.bind(call$3, call$3);
180
180
 
181
181
  var functionUncurryThis = NATIVE_BIND$1 ? function (fn) {
182
- return fn && uncurryThis$d(fn);
182
+ return fn && uncurryThis$e(fn);
183
183
  } : function (fn) {
184
184
  return fn && function () {
185
185
  return call$3.apply(fn, arguments);
186
186
  };
187
187
  };
188
188
 
189
- var uncurryThis$c = functionUncurryThis;
189
+ var uncurryThis$d = functionUncurryThis;
190
190
 
191
- var toString$2 = uncurryThis$c({}.toString);
192
- var stringSlice = uncurryThis$c(''.slice);
191
+ var toString$2 = uncurryThis$d({}.toString);
192
+ var stringSlice = uncurryThis$d(''.slice);
193
193
 
194
194
  var classofRaw$1 = function (it) {
195
195
  return stringSlice(toString$2(it), 8, -1);
196
196
  };
197
197
 
198
198
  var global$n = global$o;
199
- var uncurryThis$b = functionUncurryThis;
199
+ var uncurryThis$c = functionUncurryThis;
200
200
  var fails$6 = fails$9;
201
201
  var classof$4 = classofRaw$1;
202
202
 
203
203
  var Object$4 = global$n.Object;
204
- var split = uncurryThis$b(''.split);
204
+ var split = uncurryThis$c(''.split);
205
205
 
206
206
  // fallback for non-array-like ES3 and non-enumerable old V8 strings
207
207
  var indexedObject = fails$6(function () {
@@ -233,30 +233,30 @@ var toIndexedObject$5 = function (it) {
233
233
 
234
234
  // `IsCallable` abstract operation
235
235
  // https://tc39.es/ecma262/#sec-iscallable
236
- var isCallable$b = function (argument) {
236
+ var isCallable$c = function (argument) {
237
237
  return typeof argument == 'function';
238
238
  };
239
239
 
240
- var isCallable$a = isCallable$b;
240
+ var isCallable$b = isCallable$c;
241
241
 
242
- var isObject$6 = function (it) {
243
- return typeof it == 'object' ? it !== null : isCallable$a(it);
242
+ var isObject$7 = function (it) {
243
+ return typeof it == 'object' ? it !== null : isCallable$b(it);
244
244
  };
245
245
 
246
246
  var global$l = global$o;
247
- var isCallable$9 = isCallable$b;
247
+ var isCallable$a = isCallable$c;
248
248
 
249
249
  var aFunction = function (argument) {
250
- return isCallable$9(argument) ? argument : undefined;
250
+ return isCallable$a(argument) ? argument : undefined;
251
251
  };
252
252
 
253
253
  var getBuiltIn$5 = function (namespace, method) {
254
254
  return arguments.length < 2 ? aFunction(global$l[namespace]) : global$l[namespace] && global$l[namespace][method];
255
255
  };
256
256
 
257
- var uncurryThis$a = functionUncurryThis;
257
+ var uncurryThis$b = functionUncurryThis;
258
258
 
259
- var objectIsPrototypeOf = uncurryThis$a({}.isPrototypeOf);
259
+ var objectIsPrototypeOf = uncurryThis$b({}.isPrototypeOf);
260
260
 
261
261
  var getBuiltIn$4 = getBuiltIn$5;
262
262
 
@@ -315,7 +315,7 @@ var useSymbolAsUid = NATIVE_SYMBOL$1
315
315
 
316
316
  var global$j = global$o;
317
317
  var getBuiltIn$3 = getBuiltIn$5;
318
- var isCallable$8 = isCallable$b;
318
+ var isCallable$9 = isCallable$c;
319
319
  var isPrototypeOf = objectIsPrototypeOf;
320
320
  var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
321
321
 
@@ -325,7 +325,7 @@ var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
325
325
  return typeof it == 'symbol';
326
326
  } : function (it) {
327
327
  var $Symbol = getBuiltIn$3('Symbol');
328
- return isCallable$8($Symbol) && isPrototypeOf($Symbol.prototype, Object$3(it));
328
+ return isCallable$9($Symbol) && isPrototypeOf($Symbol.prototype, Object$3(it));
329
329
  };
330
330
 
331
331
  var global$i = global$o;
@@ -341,14 +341,14 @@ var tryToString$1 = function (argument) {
341
341
  };
342
342
 
343
343
  var global$h = global$o;
344
- var isCallable$7 = isCallable$b;
344
+ var isCallable$8 = isCallable$c;
345
345
  var tryToString = tryToString$1;
346
346
 
347
347
  var TypeError$6 = global$h.TypeError;
348
348
 
349
349
  // `Assert: IsCallable(argument) is true`
350
350
  var aCallable$2 = function (argument) {
351
- if (isCallable$7(argument)) return argument;
351
+ if (isCallable$8(argument)) return argument;
352
352
  throw TypeError$6(tryToString(argument) + ' is not a function');
353
353
  };
354
354
 
@@ -363,8 +363,8 @@ var getMethod$1 = function (V, P) {
363
363
 
364
364
  var global$g = global$o;
365
365
  var call$2 = functionCall;
366
- var isCallable$6 = isCallable$b;
367
- var isObject$5 = isObject$6;
366
+ var isCallable$7 = isCallable$c;
367
+ var isObject$6 = isObject$7;
368
368
 
369
369
  var TypeError$5 = global$g.TypeError;
370
370
 
@@ -372,9 +372,9 @@ var TypeError$5 = global$g.TypeError;
372
372
  // https://tc39.es/ecma262/#sec-ordinarytoprimitive
373
373
  var ordinaryToPrimitive$1 = function (input, pref) {
374
374
  var fn, val;
375
- if (pref === 'string' && isCallable$6(fn = input.toString) && !isObject$5(val = call$2(fn, input))) return val;
376
- if (isCallable$6(fn = input.valueOf) && !isObject$5(val = call$2(fn, input))) return val;
377
- if (pref !== 'string' && isCallable$6(fn = input.toString) && !isObject$5(val = call$2(fn, input))) return val;
375
+ if (pref === 'string' && isCallable$7(fn = input.toString) && !isObject$6(val = call$2(fn, input))) return val;
376
+ if (isCallable$7(fn = input.valueOf) && !isObject$6(val = call$2(fn, input))) return val;
377
+ if (pref !== 'string' && isCallable$7(fn = input.toString) && !isObject$6(val = call$2(fn, input))) return val;
378
378
  throw TypeError$5("Can't convert object to primitive value");
379
379
  };
380
380
 
@@ -385,11 +385,11 @@ var isPure = false;
385
385
  var global$f = global$o;
386
386
 
387
387
  // eslint-disable-next-line es/no-object-defineproperty -- safe
388
- var defineProperty = Object.defineProperty;
388
+ var defineProperty$1 = Object.defineProperty;
389
389
 
390
390
  var setGlobal$3 = function (key, value) {
391
391
  try {
392
- defineProperty(global$f, key, { value: value, configurable: true, writable: true });
392
+ defineProperty$1(global$f, key, { value: value, configurable: true, writable: true });
393
393
  } catch (error) {
394
394
  global$f[key] = value;
395
395
  } return value;
@@ -429,10 +429,10 @@ var toObject$2 = function (argument) {
429
429
  return Object$2(requireObjectCoercible(argument));
430
430
  };
431
431
 
432
- var uncurryThis$9 = functionUncurryThis;
432
+ var uncurryThis$a = functionUncurryThis;
433
433
  var toObject$1 = toObject$2;
434
434
 
435
- var hasOwnProperty = uncurryThis$9({}.hasOwnProperty);
435
+ var hasOwnProperty = uncurryThis$a({}.hasOwnProperty);
436
436
 
437
437
  // `HasOwnProperty` abstract operation
438
438
  // https://tc39.es/ecma262/#sec-hasownproperty
@@ -440,11 +440,11 @@ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
440
440
  return hasOwnProperty(toObject$1(it), key);
441
441
  };
442
442
 
443
- var uncurryThis$8 = functionUncurryThis;
443
+ var uncurryThis$9 = functionUncurryThis;
444
444
 
445
445
  var id = 0;
446
446
  var postfix = Math.random();
447
- var toString$1 = uncurryThis$8(1.0.toString);
447
+ var toString$1 = uncurryThis$9(1.0.toString);
448
448
 
449
449
  var uid$2 = function (key) {
450
450
  return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$1(++id + postfix, 36);
@@ -477,7 +477,7 @@ var wellKnownSymbol$5 = function (name) {
477
477
 
478
478
  var global$b = global$o;
479
479
  var call$1 = functionCall;
480
- var isObject$4 = isObject$6;
480
+ var isObject$5 = isObject$7;
481
481
  var isSymbol$1 = isSymbol$2;
482
482
  var getMethod = getMethod$1;
483
483
  var ordinaryToPrimitive = ordinaryToPrimitive$1;
@@ -489,13 +489,13 @@ var TO_PRIMITIVE = wellKnownSymbol$4('toPrimitive');
489
489
  // `ToPrimitive` abstract operation
490
490
  // https://tc39.es/ecma262/#sec-toprimitive
491
491
  var toPrimitive$1 = function (input, pref) {
492
- if (!isObject$4(input) || isSymbol$1(input)) return input;
492
+ if (!isObject$5(input) || isSymbol$1(input)) return input;
493
493
  var exoticToPrim = getMethod(input, TO_PRIMITIVE);
494
494
  var result;
495
495
  if (exoticToPrim) {
496
496
  if (pref === undefined) pref = 'default';
497
497
  result = call$1(exoticToPrim, input, pref);
498
- if (!isObject$4(result) || isSymbol$1(result)) return result;
498
+ if (!isObject$5(result) || isSymbol$1(result)) return result;
499
499
  throw TypeError$4("Can't convert object to primitive value");
500
500
  }
501
501
  if (pref === undefined) pref = 'number';
@@ -513,29 +513,29 @@ var toPropertyKey$2 = function (argument) {
513
513
  };
514
514
 
515
515
  var global$a = global$o;
516
- var isObject$3 = isObject$6;
516
+ var isObject$4 = isObject$7;
517
517
 
518
518
  var document$1 = global$a.document;
519
519
  // typeof document.createElement is 'object' in old IE
520
- var EXISTS$1 = isObject$3(document$1) && isObject$3(document$1.createElement);
520
+ var EXISTS$1 = isObject$4(document$1) && isObject$4(document$1.createElement);
521
521
 
522
522
  var documentCreateElement$2 = function (it) {
523
523
  return EXISTS$1 ? document$1.createElement(it) : {};
524
524
  };
525
525
 
526
- var DESCRIPTORS$7 = descriptors;
526
+ var DESCRIPTORS$8 = descriptors;
527
527
  var fails$4 = fails$9;
528
528
  var createElement = documentCreateElement$2;
529
529
 
530
530
  // Thanks to IE8 for its funny defineProperty
531
- var ie8DomDefine = !DESCRIPTORS$7 && !fails$4(function () {
531
+ var ie8DomDefine = !DESCRIPTORS$8 && !fails$4(function () {
532
532
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
533
533
  return Object.defineProperty(createElement('div'), 'a', {
534
534
  get: function () { return 7; }
535
535
  }).a != 7;
536
536
  });
537
537
 
538
- var DESCRIPTORS$6 = descriptors;
538
+ var DESCRIPTORS$7 = descriptors;
539
539
  var call = functionCall;
540
540
  var propertyIsEnumerableModule = objectPropertyIsEnumerable;
541
541
  var createPropertyDescriptor$1 = createPropertyDescriptor$2;
@@ -549,7 +549,7 @@ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
549
549
 
550
550
  // `Object.getOwnPropertyDescriptor` method
551
551
  // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
552
- var f$4 = objectGetOwnPropertyDescriptor.f = DESCRIPTORS$6 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
552
+ var f$4 = objectGetOwnPropertyDescriptor.f = DESCRIPTORS$7 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
553
553
  O = toIndexedObject$4(O);
554
554
  P = toPropertyKey$1(P);
555
555
  if (IE8_DOM_DEFINE$1) try {
@@ -560,12 +560,12 @@ var f$4 = objectGetOwnPropertyDescriptor.f = DESCRIPTORS$6 ? $getOwnPropertyDesc
560
560
 
561
561
  var objectDefineProperty = {};
562
562
 
563
- var DESCRIPTORS$5 = descriptors;
563
+ var DESCRIPTORS$6 = descriptors;
564
564
  var fails$3 = fails$9;
565
565
 
566
566
  // V8 ~ Chrome 36-
567
567
  // https://bugs.chromium.org/p/v8/issues/detail?id=3334
568
- var v8PrototypeDefineBug = DESCRIPTORS$5 && fails$3(function () {
568
+ var v8PrototypeDefineBug = DESCRIPTORS$6 && fails$3(function () {
569
569
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
570
570
  return Object.defineProperty(function () { /* empty */ }, 'prototype', {
571
571
  value: 42,
@@ -574,19 +574,19 @@ var v8PrototypeDefineBug = DESCRIPTORS$5 && fails$3(function () {
574
574
  });
575
575
 
576
576
  var global$9 = global$o;
577
- var isObject$2 = isObject$6;
577
+ var isObject$3 = isObject$7;
578
578
 
579
579
  var String$1 = global$9.String;
580
580
  var TypeError$3 = global$9.TypeError;
581
581
 
582
582
  // `Assert: Type(argument) is Object`
583
583
  var anObject$4 = function (argument) {
584
- if (isObject$2(argument)) return argument;
584
+ if (isObject$3(argument)) return argument;
585
585
  throw TypeError$3(String$1(argument) + ' is not an object');
586
586
  };
587
587
 
588
588
  var global$8 = global$o;
589
- var DESCRIPTORS$4 = descriptors;
589
+ var DESCRIPTORS$5 = descriptors;
590
590
  var IE8_DOM_DEFINE = ie8DomDefine;
591
591
  var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
592
592
  var anObject$3 = anObject$4;
@@ -603,7 +603,7 @@ var WRITABLE = 'writable';
603
603
 
604
604
  // `Object.defineProperty` method
605
605
  // https://tc39.es/ecma262/#sec-object.defineproperty
606
- var f$3 = objectDefineProperty.f = DESCRIPTORS$4 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
606
+ var f$3 = objectDefineProperty.f = DESCRIPTORS$5 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
607
607
  anObject$3(O);
608
608
  P = toPropertyKey(P);
609
609
  anObject$3(Attributes);
@@ -630,11 +630,11 @@ var f$3 = objectDefineProperty.f = DESCRIPTORS$4 ? V8_PROTOTYPE_DEFINE_BUG$1 ? f
630
630
  return O;
631
631
  };
632
632
 
633
- var DESCRIPTORS$3 = descriptors;
633
+ var DESCRIPTORS$4 = descriptors;
634
634
  var definePropertyModule$3 = objectDefineProperty;
635
635
  var createPropertyDescriptor = createPropertyDescriptor$2;
636
636
 
637
- var createNonEnumerableProperty$4 = DESCRIPTORS$3 ? function (object, key, value) {
637
+ var createNonEnumerableProperty$4 = DESCRIPTORS$4 ? function (object, key, value) {
638
638
  return definePropertyModule$3.f(object, key, createPropertyDescriptor(1, value));
639
639
  } : function (object, key, value) {
640
640
  object[key] = value;
@@ -643,28 +643,28 @@ var createNonEnumerableProperty$4 = DESCRIPTORS$3 ? function (object, key, value
643
643
 
644
644
  var redefine$3 = {exports: {}};
645
645
 
646
- var uncurryThis$7 = functionUncurryThis;
647
- var isCallable$5 = isCallable$b;
646
+ var uncurryThis$8 = functionUncurryThis;
647
+ var isCallable$6 = isCallable$c;
648
648
  var store$1 = sharedStore;
649
649
 
650
- var functionToString = uncurryThis$7(Function.toString);
650
+ var functionToString$1 = uncurryThis$8(Function.toString);
651
651
 
652
652
  // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
653
- if (!isCallable$5(store$1.inspectSource)) {
653
+ if (!isCallable$6(store$1.inspectSource)) {
654
654
  store$1.inspectSource = function (it) {
655
- return functionToString(it);
655
+ return functionToString$1(it);
656
656
  };
657
657
  }
658
658
 
659
659
  var inspectSource$3 = store$1.inspectSource;
660
660
 
661
661
  var global$7 = global$o;
662
- var isCallable$4 = isCallable$b;
662
+ var isCallable$5 = isCallable$c;
663
663
  var inspectSource$2 = inspectSource$3;
664
664
 
665
665
  var WeakMap$1 = global$7.WeakMap;
666
666
 
667
- var nativeWeakMap = isCallable$4(WeakMap$1) && /native code/.test(inspectSource$2(WeakMap$1));
667
+ var nativeWeakMap = isCallable$5(WeakMap$1) && /native code/.test(inspectSource$2(WeakMap$1));
668
668
 
669
669
  var shared$1 = shared$4.exports;
670
670
  var uid = uid$2;
@@ -679,8 +679,8 @@ var hiddenKeys$4 = {};
679
679
 
680
680
  var NATIVE_WEAK_MAP = nativeWeakMap;
681
681
  var global$6 = global$o;
682
- var uncurryThis$6 = functionUncurryThis;
683
- var isObject$1 = isObject$6;
682
+ var uncurryThis$7 = functionUncurryThis;
683
+ var isObject$2 = isObject$7;
684
684
  var createNonEnumerableProperty$3 = createNonEnumerableProperty$4;
685
685
  var hasOwn$4 = hasOwnProperty_1;
686
686
  var shared = sharedStore;
@@ -690,16 +690,16 @@ var hiddenKeys$3 = hiddenKeys$4;
690
690
  var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
691
691
  var TypeError$1 = global$6.TypeError;
692
692
  var WeakMap = global$6.WeakMap;
693
- var set, get, has;
693
+ var set$1, get, has;
694
694
 
695
695
  var enforce = function (it) {
696
- return has(it) ? get(it) : set(it, {});
696
+ return has(it) ? get(it) : set$1(it, {});
697
697
  };
698
698
 
699
699
  var getterFor = function (TYPE) {
700
700
  return function (it) {
701
701
  var state;
702
- if (!isObject$1(it) || (state = get(it)).type !== TYPE) {
702
+ if (!isObject$2(it) || (state = get(it)).type !== TYPE) {
703
703
  throw TypeError$1('Incompatible receiver, ' + TYPE + ' required');
704
704
  } return state;
705
705
  };
@@ -707,10 +707,10 @@ var getterFor = function (TYPE) {
707
707
 
708
708
  if (NATIVE_WEAK_MAP || shared.state) {
709
709
  var store = shared.state || (shared.state = new WeakMap());
710
- var wmget = uncurryThis$6(store.get);
711
- var wmhas = uncurryThis$6(store.has);
712
- var wmset = uncurryThis$6(store.set);
713
- set = function (it, metadata) {
710
+ var wmget = uncurryThis$7(store.get);
711
+ var wmhas = uncurryThis$7(store.has);
712
+ var wmset = uncurryThis$7(store.set);
713
+ set$1 = function (it, metadata) {
714
714
  if (wmhas(store, it)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
715
715
  metadata.facade = it;
716
716
  wmset(store, it, metadata);
@@ -725,7 +725,7 @@ if (NATIVE_WEAK_MAP || shared.state) {
725
725
  } else {
726
726
  var STATE = sharedKey$1('state');
727
727
  hiddenKeys$3[STATE] = true;
728
- set = function (it, metadata) {
728
+ set$1 = function (it, metadata) {
729
729
  if (hasOwn$4(it, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
730
730
  metadata.facade = it;
731
731
  createNonEnumerableProperty$3(it, STATE, metadata);
@@ -740,24 +740,24 @@ if (NATIVE_WEAK_MAP || shared.state) {
740
740
  }
741
741
 
742
742
  var internalState = {
743
- set: set,
743
+ set: set$1,
744
744
  get: get,
745
745
  has: has,
746
746
  enforce: enforce,
747
747
  getterFor: getterFor
748
748
  };
749
749
 
750
- var DESCRIPTORS$2 = descriptors;
750
+ var DESCRIPTORS$3 = descriptors;
751
751
  var hasOwn$3 = hasOwnProperty_1;
752
752
 
753
- var FunctionPrototype = Function.prototype;
753
+ var FunctionPrototype$1 = Function.prototype;
754
754
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
755
- var getDescriptor = DESCRIPTORS$2 && Object.getOwnPropertyDescriptor;
755
+ var getDescriptor = DESCRIPTORS$3 && Object.getOwnPropertyDescriptor;
756
756
 
757
- var EXISTS = hasOwn$3(FunctionPrototype, 'name');
757
+ var EXISTS = hasOwn$3(FunctionPrototype$1, 'name');
758
758
  // additional protection from minified / mangled / dropped function names
759
759
  var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
760
- var CONFIGURABLE = EXISTS && (!DESCRIPTORS$2 || (DESCRIPTORS$2 && getDescriptor(FunctionPrototype, 'name').configurable));
760
+ var CONFIGURABLE = EXISTS && (!DESCRIPTORS$3 || (DESCRIPTORS$3 && getDescriptor(FunctionPrototype$1, 'name').configurable));
761
761
 
762
762
  var functionName = {
763
763
  EXISTS: EXISTS,
@@ -766,7 +766,7 @@ var functionName = {
766
766
  };
767
767
 
768
768
  var global$5 = global$o;
769
- var isCallable$3 = isCallable$b;
769
+ var isCallable$4 = isCallable$c;
770
770
  var hasOwn$2 = hasOwnProperty_1;
771
771
  var createNonEnumerableProperty$2 = createNonEnumerableProperty$4;
772
772
  var setGlobal$1 = setGlobal$3;
@@ -784,7 +784,7 @@ var TEMPLATE = String(String).split('String');
784
784
  var noTargetGet = options ? !!options.noTargetGet : false;
785
785
  var name = options && options.name !== undefined ? options.name : key;
786
786
  var state;
787
- if (isCallable$3(value)) {
787
+ if (isCallable$4(value)) {
788
788
  if (String(name).slice(0, 7) === 'Symbol(') {
789
789
  name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
790
790
  }
@@ -809,7 +809,7 @@ var TEMPLATE = String(String).split('String');
809
809
  else createNonEnumerableProperty$2(O, key, value);
810
810
  // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
811
811
  })(Function.prototype, 'toString', function toString() {
812
- return isCallable$3(this) && getInternalState(this).source || inspectSource$1(this);
812
+ return isCallable$4(this) && getInternalState(this).source || inspectSource$1(this);
813
813
  });
814
814
 
815
815
  var redefine$2 = redefine$3.exports;
@@ -891,13 +891,13 @@ var arrayIncludes = {
891
891
  indexOf: createMethod$2(false)
892
892
  };
893
893
 
894
- var uncurryThis$5 = functionUncurryThis;
894
+ var uncurryThis$6 = functionUncurryThis;
895
895
  var hasOwn$1 = hasOwnProperty_1;
896
896
  var toIndexedObject$2 = toIndexedObject$5;
897
897
  var indexOf = arrayIncludes.indexOf;
898
898
  var hiddenKeys$2 = hiddenKeys$4;
899
899
 
900
- var push$2 = uncurryThis$5([].push);
900
+ var push$2 = uncurryThis$6([].push);
901
901
 
902
902
  var objectKeysInternal = function (object, names) {
903
903
  var O = toIndexedObject$2(object);
@@ -941,12 +941,12 @@ var objectGetOwnPropertySymbols = {};
941
941
  var f$1 = objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
942
942
 
943
943
  var getBuiltIn$2 = getBuiltIn$5;
944
- var uncurryThis$4 = functionUncurryThis;
944
+ var uncurryThis$5 = functionUncurryThis;
945
945
  var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
946
946
  var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
947
947
  var anObject$2 = anObject$4;
948
948
 
949
- var concat = uncurryThis$4([].concat);
949
+ var concat = uncurryThis$5([].concat);
950
950
 
951
951
  // all object keys, includes non-enumerable and symbols
952
952
  var ownKeys$1 = getBuiltIn$2('Reflect', 'ownKeys') || function ownKeys(it) {
@@ -973,7 +973,7 @@ var copyConstructorProperties$1 = function (target, source, exceptions) {
973
973
  };
974
974
 
975
975
  var fails$2 = fails$9;
976
- var isCallable$2 = isCallable$b;
976
+ var isCallable$3 = isCallable$c;
977
977
 
978
978
  var replacement = /#|\.prototype\./;
979
979
 
@@ -981,7 +981,7 @@ var isForced$1 = function (feature, detection) {
981
981
  var value = data[normalize(feature)];
982
982
  return value == POLYFILL ? true
983
983
  : value == NATIVE ? false
984
- : isCallable$2(detection) ? fails$2(detection)
984
+ : isCallable$3(detection) ? fails$2(detection)
985
985
  : !!detection;
986
986
  };
987
987
 
@@ -1051,11 +1051,11 @@ var _export = function (options, source) {
1051
1051
  }
1052
1052
  };
1053
1053
 
1054
- var uncurryThis$3 = functionUncurryThis;
1054
+ var uncurryThis$4 = functionUncurryThis;
1055
1055
  var aCallable = aCallable$2;
1056
1056
  var NATIVE_BIND = functionBindNative;
1057
1057
 
1058
- var bind$1 = uncurryThis$3(uncurryThis$3.bind);
1058
+ var bind$1 = uncurryThis$4(uncurryThis$4.bind);
1059
1059
 
1060
1060
  // optional / simple context binding
1061
1061
  var functionBindContext = function (fn, that) {
@@ -1085,7 +1085,7 @@ var toStringTagSupport = String(test) === '[object z]';
1085
1085
 
1086
1086
  var global$3 = global$o;
1087
1087
  var TO_STRING_TAG_SUPPORT$2 = toStringTagSupport;
1088
- var isCallable$1 = isCallable$b;
1088
+ var isCallable$2 = isCallable$c;
1089
1089
  var classofRaw = classofRaw$1;
1090
1090
  var wellKnownSymbol$2 = wellKnownSymbol$5;
1091
1091
 
@@ -1111,12 +1111,12 @@ var classof$2 = TO_STRING_TAG_SUPPORT$2 ? classofRaw : function (it) {
1111
1111
  // builtinTag case
1112
1112
  : CORRECT_ARGUMENTS ? classofRaw(O)
1113
1113
  // ES3 arguments fallback
1114
- : (result = classofRaw(O)) == 'Object' && isCallable$1(O.callee) ? 'Arguments' : result;
1114
+ : (result = classofRaw(O)) == 'Object' && isCallable$2(O.callee) ? 'Arguments' : result;
1115
1115
  };
1116
1116
 
1117
- var uncurryThis$2 = functionUncurryThis;
1117
+ var uncurryThis$3 = functionUncurryThis;
1118
1118
  var fails$1 = fails$9;
1119
- var isCallable = isCallable$b;
1119
+ var isCallable$1 = isCallable$c;
1120
1120
  var classof$1 = classof$2;
1121
1121
  var getBuiltIn$1 = getBuiltIn$5;
1122
1122
  var inspectSource = inspectSource$3;
@@ -1125,11 +1125,11 @@ var noop = function () { /* empty */ };
1125
1125
  var empty = [];
1126
1126
  var construct = getBuiltIn$1('Reflect', 'construct');
1127
1127
  var constructorRegExp = /^\s*(?:class|function)\b/;
1128
- var exec = uncurryThis$2(constructorRegExp.exec);
1128
+ var exec = uncurryThis$3(constructorRegExp.exec);
1129
1129
  var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
1130
1130
 
1131
1131
  var isConstructorModern = function isConstructor(argument) {
1132
- if (!isCallable(argument)) return false;
1132
+ if (!isCallable$1(argument)) return false;
1133
1133
  try {
1134
1134
  construct(noop, empty, argument);
1135
1135
  return true;
@@ -1139,7 +1139,7 @@ var isConstructorModern = function isConstructor(argument) {
1139
1139
  };
1140
1140
 
1141
1141
  var isConstructorLegacy = function isConstructor(argument) {
1142
- if (!isCallable(argument)) return false;
1142
+ if (!isCallable$1(argument)) return false;
1143
1143
  switch (classof$1(argument)) {
1144
1144
  case 'AsyncFunction':
1145
1145
  case 'GeneratorFunction':
@@ -1170,7 +1170,7 @@ var isConstructor$1 = !construct || fails$1(function () {
1170
1170
  var global$2 = global$o;
1171
1171
  var isArray = isArray$1;
1172
1172
  var isConstructor = isConstructor$1;
1173
- var isObject = isObject$6;
1173
+ var isObject$1 = isObject$7;
1174
1174
  var wellKnownSymbol$1 = wellKnownSymbol$5;
1175
1175
 
1176
1176
  var SPECIES = wellKnownSymbol$1('species');
@@ -1184,7 +1184,7 @@ var arraySpeciesConstructor$1 = function (originalArray) {
1184
1184
  C = originalArray.constructor;
1185
1185
  // cross-realm fallback
1186
1186
  if (isConstructor(C) && (C === Array$1 || isArray(C.prototype))) C = undefined;
1187
- else if (isObject(C)) {
1187
+ else if (isObject$1(C)) {
1188
1188
  C = C[SPECIES];
1189
1189
  if (C === null) C = undefined;
1190
1190
  }
@@ -1200,13 +1200,13 @@ var arraySpeciesCreate$1 = function (originalArray, length) {
1200
1200
  };
1201
1201
 
1202
1202
  var bind = functionBindContext;
1203
- var uncurryThis$1 = functionUncurryThis;
1203
+ var uncurryThis$2 = functionUncurryThis;
1204
1204
  var IndexedObject = indexedObject;
1205
1205
  var toObject = toObject$2;
1206
1206
  var lengthOfArrayLike = lengthOfArrayLike$2;
1207
1207
  var arraySpeciesCreate = arraySpeciesCreate$1;
1208
1208
 
1209
- var push$1 = uncurryThis$1([].push);
1209
+ var push$1 = uncurryThis$2([].push);
1210
1210
 
1211
1211
  // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
1212
1212
  var createMethod$1 = function (TYPE) {
@@ -1411,14 +1411,14 @@ var objectKeys$2 = Object.keys || function keys(O) {
1411
1411
  return internalObjectKeys(O, enumBugKeys$1);
1412
1412
  };
1413
1413
 
1414
- var DESCRIPTORS$1 = descriptors;
1415
- var uncurryThis = functionUncurryThis;
1414
+ var DESCRIPTORS$2 = descriptors;
1415
+ var uncurryThis$1 = functionUncurryThis;
1416
1416
  var objectKeys$1 = objectKeys$2;
1417
1417
  var toIndexedObject$1 = toIndexedObject$5;
1418
1418
  var $propertyIsEnumerable = objectPropertyIsEnumerable.f;
1419
1419
 
1420
- var propertyIsEnumerable = uncurryThis($propertyIsEnumerable);
1421
- var push = uncurryThis([].push);
1420
+ var propertyIsEnumerable = uncurryThis$1($propertyIsEnumerable);
1421
+ var push = uncurryThis$1([].push);
1422
1422
 
1423
1423
  // `Object.{ entries, values }` methods implementation
1424
1424
  var createMethod = function (TO_ENTRIES) {
@@ -1431,7 +1431,7 @@ var createMethod = function (TO_ENTRIES) {
1431
1431
  var key;
1432
1432
  while (length > i) {
1433
1433
  key = keys[i++];
1434
- if (!DESCRIPTORS$1 || propertyIsEnumerable(O, key)) {
1434
+ if (!DESCRIPTORS$2 || propertyIsEnumerable(O, key)) {
1435
1435
  push(result, TO_ENTRIES ? [key, O[key]] : O[key]);
1436
1436
  }
1437
1437
  }
@@ -1459,7 +1459,7 @@ $$1({ target: 'Object', stat: true }, {
1459
1459
  }
1460
1460
  });
1461
1461
 
1462
- var script$2 = defineComponent({
1462
+ var script$3 = defineComponent({
1463
1463
  name: 'FwCard',
1464
1464
  props: {
1465
1465
  /**
@@ -1500,41 +1500,42 @@ var script$2 = defineComponent({
1500
1500
  }
1501
1501
  });
1502
1502
 
1503
- var _hoisted_1$1 = {
1503
+ var _hoisted_1$2 = {
1504
1504
  key: 0,
1505
1505
  "class": "fw-card--header text-lg px-8 py-4 font-bold bg-grey-lightest rounded-t-lg border-opacity-0"
1506
1506
  };
1507
- var _hoisted_2$1 = {
1507
+ var _hoisted_2$2 = {
1508
1508
  key: 0,
1509
1509
  "class": "fw-card--prefix-title text-primary"
1510
1510
  };
1511
- var _hoisted_3$1 = {
1511
+ var _hoisted_3$2 = {
1512
1512
  key: 1
1513
1513
  };
1514
- var _hoisted_4$1 = {
1514
+ var _hoisted_4$2 = {
1515
1515
  key: 1,
1516
1516
  "class": "p-8"
1517
1517
  };
1518
- function render$2(_ctx, _cache, $props, $setup, $data, $options) {
1518
+ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
1519
1519
  return openBlock(), createBlock(resolveDynamicComponent(_ctx.componentName), {
1520
1520
  to: _ctx.to ? _ctx.to : null,
1521
1521
  href: _ctx.href ? _ctx.href : null,
1522
- "class": normalizeClass(["fw-card shadow-card rounded-lg", _ctx.to || _ctx.href ? 'block focus:outline-none ring-offset-3 focus:ring focus:ring-primary transform-none transition-transform hover:-translate-y-1' : ''])
1522
+ tabindex: _ctx.to ? 0 : null,
1523
+ "class": 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' : ''])
1523
1524
  }, {
1524
1525
  "default": withCtx(function () {
1525
- return [_ctx.title || _ctx.prefixTitle ? (openBlock(), createElementBlock("h4", _hoisted_1$1, [_ctx.prefixTitle ? (openBlock(), createElementBlock("span", _hoisted_2$1, toDisplayString(_ctx.prefixTitle), 1)) : createCommentVNode("", true), _ctx.title ? (openBlock(), createElementBlock("span", _hoisted_3$1, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true)])) : createCommentVNode("", true), _ctx.$slots["default"] ? (openBlock(), createElementBlock("div", _hoisted_4$1, [renderSlot(_ctx.$slots, "default")])) : createCommentVNode("", true)];
1526
+ return [_ctx.title || _ctx.prefixTitle ? (openBlock(), createElementBlock("h4", _hoisted_1$2, [_ctx.prefixTitle ? (openBlock(), createElementBlock("span", _hoisted_2$2, toDisplayString(_ctx.prefixTitle), 1)) : createCommentVNode("", true), _ctx.title ? (openBlock(), createElementBlock("span", _hoisted_3$2, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true)])) : createCommentVNode("", true), _ctx.$slots["default"] ? (openBlock(), createElementBlock("div", _hoisted_4$2, [renderSlot(_ctx.$slots, "default")])) : createCommentVNode("", true)];
1526
1527
  }),
1527
1528
  _: 3
1528
- }, 8, ["to", "href", "class"]);
1529
+ }, 8, ["to", "href", "tabindex", "class"]);
1529
1530
  }
1530
1531
 
1531
- script$2.render = render$2;
1532
+ script$3.render = render$3;
1532
1533
 
1533
1534
  var es_array_includes = {};
1534
1535
 
1535
1536
  var objectDefineProperties = {};
1536
1537
 
1537
- var DESCRIPTORS = descriptors;
1538
+ var DESCRIPTORS$1 = descriptors;
1538
1539
  var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
1539
1540
  var definePropertyModule$1 = objectDefineProperty;
1540
1541
  var anObject$1 = anObject$4;
@@ -1544,7 +1545,7 @@ var objectKeys = objectKeys$2;
1544
1545
  // `Object.defineProperties` method
1545
1546
  // https://tc39.es/ecma262/#sec-object.defineproperties
1546
1547
  // eslint-disable-next-line es/no-object-defineproperties -- safe
1547
- var f = objectDefineProperties.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1548
+ var f = objectDefineProperties.f = DESCRIPTORS$1 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1548
1549
  anObject$1(O);
1549
1550
  var props = toIndexedObject(Properties);
1550
1551
  var keys = objectKeys(Properties);
@@ -1680,7 +1681,7 @@ $({ target: 'Array', proto: true }, {
1680
1681
  // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1681
1682
  addToUnscopables('includes');
1682
1683
 
1683
- var script$1 = defineComponent({
1684
+ var script$2 = defineComponent({
1684
1685
  name: 'FwButton',
1685
1686
  emits: ['click', 'mouseover', 'mouseout', 'focusin', 'focusout'],
1686
1687
  props: {
@@ -1831,12 +1832,13 @@ var script$1 = defineComponent({
1831
1832
  }
1832
1833
  });
1833
1834
 
1834
- function render$1(_ctx, _cache, $props, $setup, $data, $options) {
1835
+ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
1835
1836
  return openBlock(), createBlock(resolveDynamicComponent(_ctx.tagName), {
1836
1837
  "class": 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]]),
1837
1838
  type: _ctx.tagName === 'button' ? _ctx.tagName : null,
1838
1839
  to: _ctx.to ? _ctx.to : null,
1839
1840
  href: _ctx.href ? _ctx.href : null,
1841
+ tabindex: _ctx.to ? 0 : null,
1840
1842
  onClick: _ctx.onClick,
1841
1843
  onFocusin: _ctx.onFocusin,
1842
1844
  onFocusout: _ctx.onFocusout,
@@ -1847,7 +1849,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
1847
1849
  return [renderSlot(_ctx.$slots, "default")];
1848
1850
  }),
1849
1851
  _: 3
1850
- }, 8, ["class", "type", "to", "href", "onClick", "onFocusin", "onFocusout", "onMouseover", "onMouseout"]);
1852
+ }, 8, ["class", "type", "to", "href", "tabindex", "onClick", "onFocusin", "onFocusout", "onMouseover", "onMouseout"]);
1851
1853
  }
1852
1854
 
1853
1855
  function styleInject(css, ref) {
@@ -1877,17 +1879,17 @@ function styleInject(css, ref) {
1877
1879
  }
1878
1880
  }
1879
1881
 
1880
- var css_248z$1 = ".fw-button{-webkit-transition:all .25s ease-in;-o-transition:all .25s ease-in;transition:all .25s ease-in}";
1881
- var stylesheet$1 = ".fw-button{-webkit-transition:all .25s ease-in;-o-transition:all .25s ease-in;transition:all .25s ease-in}";
1882
- styleInject(css_248z$1);
1882
+ var css_248z$2 = ".fw-button{-webkit-transition:all .25s ease-in;-o-transition:all .25s ease-in;transition:all .25s ease-in}";
1883
+ var stylesheet$2 = ".fw-button{-webkit-transition:all .25s ease-in;-o-transition:all .25s ease-in;transition:all .25s ease-in}";
1884
+ styleInject(css_248z$2);
1883
1885
 
1884
- script$1.render = render$1;
1886
+ script$2.render = render$2;
1885
1887
 
1886
- var script = defineComponent({
1888
+ var script$1 = defineComponent({
1887
1889
  name: 'FwNavigationMenu',
1888
1890
  emits: ['action'],
1889
1891
  components: {
1890
- FwButton: script$1
1892
+ FwButton: script$2
1891
1893
  },
1892
1894
  props: {
1893
1895
  /**
@@ -1925,36 +1927,36 @@ var script = defineComponent({
1925
1927
  }
1926
1928
  });
1927
1929
 
1928
- var _hoisted_1 = {
1930
+ var _hoisted_1$1 = {
1929
1931
  "class": "fw-nav-menu relative z-50 h-20 shadow-md"
1930
1932
  };
1931
- var _hoisted_2 = {
1933
+ var _hoisted_2$1 = {
1932
1934
  "class": "px-6 flex-1 h-full flex bg-white items-stretch justify-between"
1933
1935
  };
1934
- var _hoisted_3 = {
1936
+ var _hoisted_3$1 = {
1935
1937
  key: 0,
1936
1938
  "class": "flex-shrink-0 flex items-center"
1937
1939
  };
1938
- var _hoisted_4 = {
1940
+ var _hoisted_4$1 = {
1939
1941
  key: 1,
1940
1942
  "class": "container hidden sm:flex items-center justify-start sm:ml-6"
1941
1943
  };
1942
- var _hoisted_5 = {
1944
+ var _hoisted_5$1 = {
1943
1945
  "class": "flex space-x-2"
1944
1946
  };
1945
- var _hoisted_6 = {
1947
+ var _hoisted_6$1 = {
1946
1948
  key: 2,
1947
1949
  "class": "hidden sm:flex items-center justify-start sm:ml-6"
1948
1950
  };
1949
- var _hoisted_7 = {
1951
+ var _hoisted_7$1 = {
1950
1952
  "class": "flex items-center sm:hidden"
1951
1953
  };
1952
1954
 
1953
- var _hoisted_8 = /*#__PURE__*/createElementVNode("span", {
1955
+ var _hoisted_8$1 = /*#__PURE__*/createElementVNode("span", {
1954
1956
  "class": "sr-only"
1955
1957
  }, "Open main menu", -1);
1956
1958
 
1957
- var _hoisted_9 = {
1959
+ var _hoisted_9$1 = {
1958
1960
  "class": "block h-6 w-6",
1959
1961
  xmlns: "http://www.w3.org/2000/svg",
1960
1962
  fill: "none",
@@ -1962,20 +1964,20 @@ var _hoisted_9 = {
1962
1964
  stroke: "currentColor",
1963
1965
  "aria-hidden": "true"
1964
1966
  };
1965
- var _hoisted_10 = ["d"];
1966
- var _hoisted_11 = {
1967
+ var _hoisted_10$1 = ["d"];
1968
+ var _hoisted_11$1 = {
1967
1969
  key: 0,
1968
1970
  "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"
1969
1971
  };
1970
1972
  var _hoisted_12 = {
1971
1973
  "class": "w-full flex flex-col"
1972
1974
  };
1973
- function render(_ctx, _cache, $props, $setup, $data, $options) {
1975
+ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
1974
1976
  var _ctx$menuItems;
1975
1977
 
1976
1978
  var _component_FwButton = resolveComponent("FwButton");
1977
1979
 
1978
- return openBlock(), createElementBlock("nav", _hoisted_1, [createElementVNode("div", _hoisted_2, [_ctx.$slots.logo ? (openBlock(), createElementBlock("div", _hoisted_3, [renderSlot(_ctx.$slots, "logo")])) : createCommentVNode("", true), ((_ctx$menuItems = _ctx.menuItems) === null || _ctx$menuItems === void 0 ? void 0 : _ctx$menuItems.length) > 0 ? (openBlock(), createElementBlock("div", _hoisted_4, [createElementVNode("div", _hoisted_5, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuItems, function (item, i) {
1980
+ return openBlock(), createElementBlock("nav", _hoisted_1$1, [createElementVNode("div", _hoisted_2$1, [_ctx.$slots.logo ? (openBlock(), createElementBlock("div", _hoisted_3$1, [renderSlot(_ctx.$slots, "logo")])) : createCommentVNode("", true), ((_ctx$menuItems = _ctx.menuItems) === null || _ctx$menuItems === void 0 ? void 0 : _ctx$menuItems.length) > 0 ? (openBlock(), createElementBlock("div", _hoisted_4$1, [createElementVNode("div", _hoisted_5$1, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuItems, function (item, i) {
1979
1981
  return openBlock(), createBlock(_component_FwButton, {
1980
1982
  key: i,
1981
1983
  variant: "text",
@@ -1989,7 +1991,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1989
1991
  }),
1990
1992
  _: 2
1991
1993
  }, 1032, ["href", "to"]);
1992
- }), 128))])])) : createCommentVNode("", true), _ctx.actionLabel ? (openBlock(), createElementBlock("div", _hoisted_6, [createVNode(_component_FwButton, {
1994
+ }), 128))])])) : createCommentVNode("", true), _ctx.actionLabel ? (openBlock(), createElementBlock("div", _hoisted_6$1, [createVNode(_component_FwButton, {
1993
1995
  onClick: _ctx.actionClicked,
1994
1996
  size: "md",
1995
1997
  "aria-label": _ctx.actionLabel
@@ -1998,18 +2000,18 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
1998
2000
  return [createTextVNode(toDisplayString(_ctx.actionLabel), 1)];
1999
2001
  }),
2000
2002
  _: 1
2001
- }, 8, ["onClick", "aria-label"])])) : createCommentVNode("", true), createElementVNode("div", _hoisted_7, [createVNode(_component_FwButton, {
2003
+ }, 8, ["onClick", "aria-label"])])) : createCommentVNode("", true), createElementVNode("div", _hoisted_7$1, [createVNode(_component_FwButton, {
2002
2004
  variant: "text",
2003
2005
  size: "sm",
2004
2006
  onClick: _ctx.toggleMobileMenu
2005
2007
  }, {
2006
2008
  "default": withCtx(function () {
2007
- return [_hoisted_8, (openBlock(), createElementBlock("svg", _hoisted_9, [createElementVNode("path", {
2009
+ return [_hoisted_8$1, (openBlock(), createElementBlock("svg", _hoisted_9$1, [createElementVNode("path", {
2008
2010
  "stroke-linecap": "round",
2009
2011
  "stroke-linejoin": "round",
2010
2012
  "stroke-width": "2",
2011
2013
  d: _ctx.isMobileMenuOpen ? 'M6 18L18 6M6 6l12 12' : 'M4 6h16M4 12h16M4 18h16'
2012
- }, null, 8, _hoisted_10)]))];
2014
+ }, null, 8, _hoisted_10$1)]))];
2013
2015
  }),
2014
2016
  _: 1
2015
2017
  }, 8, ["onClick"])])]), createVNode(Transition, {
@@ -2018,7 +2020,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
2018
2020
  "default": withCtx(function () {
2019
2021
  var _ctx$menuItems2;
2020
2022
 
2021
- return [((_ctx$menuItems2 = _ctx.menuItems) === null || _ctx$menuItems2 === void 0 ? void 0 : _ctx$menuItems2.length) > 0 && _ctx.isMobileMenuOpen ? (openBlock(), createElementBlock("div", _hoisted_11, [createElementVNode("div", _hoisted_12, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuItems, function (item, i) {
2023
+ return [((_ctx$menuItems2 = _ctx.menuItems) === null || _ctx$menuItems2 === void 0 ? void 0 : _ctx$menuItems2.length) > 0 && _ctx.isMobileMenuOpen ? (openBlock(), createElementBlock("div", _hoisted_11$1, [createElementVNode("div", _hoisted_12, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuItems, function (item, i) {
2022
2024
  return openBlock(), createBlock(_component_FwButton, {
2023
2025
  key: i,
2024
2026
  "class": "w-full rounded-md px-2",
@@ -2049,17 +2051,3344 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
2049
2051
  })]);
2050
2052
  }
2051
2053
 
2052
- 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}}";
2053
- 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}}";
2054
+ 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}}";
2055
+ 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}}";
2056
+ styleInject(css_248z$1);
2057
+
2058
+ script$1.render = render$1;
2059
+
2060
+ function getDevtoolsGlobalHook() {
2061
+ return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
2062
+ }
2063
+ function getTarget() {
2064
+ // @ts-ignore
2065
+ return (typeof navigator !== 'undefined' && typeof window !== 'undefined')
2066
+ ? window
2067
+ : typeof global !== 'undefined'
2068
+ ? global
2069
+ : {};
2070
+ }
2071
+ const isProxyAvailable = typeof Proxy === 'function';
2072
+
2073
+ const HOOK_SETUP = 'devtools-plugin:setup';
2074
+ const HOOK_PLUGIN_SETTINGS_SET = 'plugin:settings:set';
2075
+
2076
+ class ApiProxy {
2077
+ constructor(plugin, hook) {
2078
+ this.target = null;
2079
+ this.targetQueue = [];
2080
+ this.onQueue = [];
2081
+ this.plugin = plugin;
2082
+ this.hook = hook;
2083
+ const defaultSettings = {};
2084
+ if (plugin.settings) {
2085
+ for (const id in plugin.settings) {
2086
+ const item = plugin.settings[id];
2087
+ defaultSettings[id] = item.defaultValue;
2088
+ }
2089
+ }
2090
+ const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;
2091
+ let currentSettings = Object.assign({}, defaultSettings);
2092
+ try {
2093
+ const raw = localStorage.getItem(localSettingsSaveId);
2094
+ const data = JSON.parse(raw);
2095
+ Object.assign(currentSettings, data);
2096
+ }
2097
+ catch (e) {
2098
+ // noop
2099
+ }
2100
+ this.fallbacks = {
2101
+ getSettings() {
2102
+ return currentSettings;
2103
+ },
2104
+ setSettings(value) {
2105
+ try {
2106
+ localStorage.setItem(localSettingsSaveId, JSON.stringify(value));
2107
+ }
2108
+ catch (e) {
2109
+ // noop
2110
+ }
2111
+ currentSettings = value;
2112
+ },
2113
+ };
2114
+ if (hook) {
2115
+ hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {
2116
+ if (pluginId === this.plugin.id) {
2117
+ this.fallbacks.setSettings(value);
2118
+ }
2119
+ });
2120
+ }
2121
+ this.proxiedOn = new Proxy({}, {
2122
+ get: (_target, prop) => {
2123
+ if (this.target) {
2124
+ return this.target.on[prop];
2125
+ }
2126
+ else {
2127
+ return (...args) => {
2128
+ this.onQueue.push({
2129
+ method: prop,
2130
+ args,
2131
+ });
2132
+ };
2133
+ }
2134
+ },
2135
+ });
2136
+ this.proxiedTarget = new Proxy({}, {
2137
+ get: (_target, prop) => {
2138
+ if (this.target) {
2139
+ return this.target[prop];
2140
+ }
2141
+ else if (prop === 'on') {
2142
+ return this.proxiedOn;
2143
+ }
2144
+ else if (Object.keys(this.fallbacks).includes(prop)) {
2145
+ return (...args) => {
2146
+ this.targetQueue.push({
2147
+ method: prop,
2148
+ args,
2149
+ resolve: () => { },
2150
+ });
2151
+ return this.fallbacks[prop](...args);
2152
+ };
2153
+ }
2154
+ else {
2155
+ return (...args) => {
2156
+ return new Promise(resolve => {
2157
+ this.targetQueue.push({
2158
+ method: prop,
2159
+ args,
2160
+ resolve,
2161
+ });
2162
+ });
2163
+ };
2164
+ }
2165
+ },
2166
+ });
2167
+ }
2168
+ async setRealTarget(target) {
2169
+ this.target = target;
2170
+ for (const item of this.onQueue) {
2171
+ this.target.on[item.method](...item.args);
2172
+ }
2173
+ for (const item of this.targetQueue) {
2174
+ item.resolve(await this.target[item.method](...item.args));
2175
+ }
2176
+ }
2177
+ }
2178
+
2179
+ function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
2180
+ const descriptor = pluginDescriptor;
2181
+ const target = getTarget();
2182
+ const hook = getDevtoolsGlobalHook();
2183
+ const enableProxy = isProxyAvailable && descriptor.enableEarlyProxy;
2184
+ if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
2185
+ hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
2186
+ }
2187
+ else {
2188
+ const proxy = enableProxy ? new ApiProxy(descriptor, hook) : null;
2189
+ const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
2190
+ list.push({
2191
+ pluginDescriptor: descriptor,
2192
+ setupFn,
2193
+ proxy,
2194
+ });
2195
+ if (proxy)
2196
+ setupFn(proxy.proxiedTarget);
2197
+ }
2198
+ }
2199
+
2200
+ /**
2201
+ * vee-validate v4.5.9
2202
+ * (c) 2022 Abdelrahman Awad
2203
+ * @license MIT
2204
+ */
2205
+
2206
+ function isCallable(fn) {
2207
+ return typeof fn === 'function';
2208
+ }
2209
+ function isNullOrUndefined(value) {
2210
+ return value === null || value === undefined;
2211
+ }
2212
+ const isObject = (obj) => obj !== null && !!obj && typeof obj === 'object' && !Array.isArray(obj);
2213
+ function isIndex(value) {
2214
+ return Number(value) >= 0;
2215
+ }
2216
+ function toNumber(value) {
2217
+ const n = parseFloat(value);
2218
+ return isNaN(n) ? value : n;
2219
+ }
2220
+
2221
+ const RULES = {};
2222
+ /**
2223
+ * Adds a custom validator to the list of validation rules.
2224
+ */
2225
+ function defineRule(id, validator) {
2226
+ // makes sure new rules are properly formatted.
2227
+ guardExtend(id, validator);
2228
+ RULES[id] = validator;
2229
+ }
2230
+ /**
2231
+ * Gets an already defined rule
2232
+ */
2233
+ function resolveRule(id) {
2234
+ return RULES[id];
2235
+ }
2236
+ /**
2237
+ * Guards from extension violations.
2238
+ */
2239
+ function guardExtend(id, validator) {
2240
+ if (isCallable(validator)) {
2241
+ return;
2242
+ }
2243
+ throw new Error(`Extension Error: The validator '${id}' must be a function.`);
2244
+ }
2245
+
2246
+ const FormContextKey = Symbol('vee-validate-form');
2247
+ const FieldContextKey = Symbol('vee-validate-field-instance');
2248
+ const IS_ABSENT = Symbol('Default empty value');
2249
+
2250
+ function isLocator(value) {
2251
+ return isCallable(value) && !!value.__locatorRef;
2252
+ }
2253
+ /**
2254
+ * Checks if an tag name is a native HTML tag and not a Vue component
2255
+ */
2256
+ function isHTMLTag(tag) {
2257
+ return ['input', 'textarea', 'select'].includes(tag);
2258
+ }
2259
+ /**
2260
+ * Checks if an input is of type file
2261
+ */
2262
+ function isFileInputNode(tag, attrs) {
2263
+ return isHTMLTag(tag) && attrs.type === 'file';
2264
+ }
2265
+ function isYupValidator(value) {
2266
+ return !!value && isCallable(value.validate);
2267
+ }
2268
+ function hasCheckedAttr(type) {
2269
+ return type === 'checkbox' || type === 'radio';
2270
+ }
2271
+ function isContainerValue(value) {
2272
+ return isObject(value) || Array.isArray(value);
2273
+ }
2274
+ /**
2275
+ * True if the value is an empty object or array
2276
+ */
2277
+ function isEmptyContainer(value) {
2278
+ if (Array.isArray(value)) {
2279
+ return value.length === 0;
2280
+ }
2281
+ return isObject(value) && Object.keys(value).length === 0;
2282
+ }
2283
+ /**
2284
+ * Checks if the path opted out of nested fields using `[fieldName]` syntax
2285
+ */
2286
+ function isNotNestedPath(path) {
2287
+ return /^\[.+\]$/i.test(path);
2288
+ }
2289
+ /**
2290
+ * Checks if an element is a native HTML5 multi-select input element
2291
+ */
2292
+ function isNativeMultiSelect(el) {
2293
+ return isNativeSelect(el) && el.multiple;
2294
+ }
2295
+ /**
2296
+ * Checks if an element is a native HTML5 select input element
2297
+ */
2298
+ function isNativeSelect(el) {
2299
+ return el.tagName === 'SELECT';
2300
+ }
2301
+ /**
2302
+ * Checks if a tag name with attrs object will render a native multi-select element
2303
+ */
2304
+ function isNativeMultiSelectNode(tag, attrs) {
2305
+ // The falsy value array is the values that Vue won't add the `multiple` prop if it has one of these values
2306
+ const hasTruthyBindingValue = ![false, null, undefined, 0].includes(attrs.multiple) && !Number.isNaN(attrs.multiple);
2307
+ return tag === 'select' && 'multiple' in attrs && hasTruthyBindingValue;
2308
+ }
2309
+ /**
2310
+ * Checks if a node should have a `:value` binding or not
2311
+ *
2312
+ * These nodes should not have a value binding
2313
+ * For files, because they are not reactive
2314
+ * For multi-selects because the value binding will reset the value
2315
+ */
2316
+ function shouldHaveValueBinding(tag, attrs) {
2317
+ return isNativeMultiSelectNode(tag, attrs) || isFileInputNode(tag, attrs);
2318
+ }
2319
+ function isFormSubmitEvent(evt) {
2320
+ return isEvent(evt) && evt.target && 'submit' in evt.target;
2321
+ }
2322
+ function isEvent(evt) {
2323
+ if (!evt) {
2324
+ return false;
2325
+ }
2326
+ if (typeof Event !== 'undefined' && isCallable(Event) && evt instanceof Event) {
2327
+ return true;
2328
+ }
2329
+ // this is for IE and Cypress #3161
2330
+ /* istanbul ignore next */
2331
+ if (evt && evt.srcElement) {
2332
+ return true;
2333
+ }
2334
+ return false;
2335
+ }
2336
+ function isPropPresent(obj, prop) {
2337
+ return prop in obj && obj[prop] !== IS_ABSENT;
2338
+ }
2339
+
2340
+ function cleanupNonNestedPath(path) {
2341
+ if (isNotNestedPath(path)) {
2342
+ return path.replace(/\[|\]/gi, '');
2343
+ }
2344
+ return path;
2345
+ }
2346
+ function getFromPath(object, path, fallback) {
2347
+ if (!object) {
2348
+ return fallback;
2349
+ }
2350
+ if (isNotNestedPath(path)) {
2351
+ return object[cleanupNonNestedPath(path)];
2352
+ }
2353
+ const resolvedValue = (path || '')
2354
+ .split(/\.|\[(\d+)\]/)
2355
+ .filter(Boolean)
2356
+ .reduce((acc, propKey) => {
2357
+ if (isContainerValue(acc) && propKey in acc) {
2358
+ return acc[propKey];
2359
+ }
2360
+ return fallback;
2361
+ }, object);
2362
+ return resolvedValue;
2363
+ }
2364
+ /**
2365
+ * Sets a nested property value in a path, creates the path properties if it doesn't exist
2366
+ */
2367
+ function setInPath(object, path, value) {
2368
+ if (isNotNestedPath(path)) {
2369
+ object[cleanupNonNestedPath(path)] = value;
2370
+ return;
2371
+ }
2372
+ const keys = path.split(/\.|\[(\d+)\]/).filter(Boolean);
2373
+ let acc = object;
2374
+ for (let i = 0; i < keys.length; i++) {
2375
+ // Last key, set it
2376
+ if (i === keys.length - 1) {
2377
+ acc[keys[i]] = value;
2378
+ return;
2379
+ }
2380
+ // Key does not exist, create a container for it
2381
+ if (!(keys[i] in acc) || isNullOrUndefined(acc[keys[i]])) {
2382
+ // container can be either an object or an array depending on the next key if it exists
2383
+ acc[keys[i]] = isIndex(keys[i + 1]) ? [] : {};
2384
+ }
2385
+ acc = acc[keys[i]];
2386
+ }
2387
+ }
2388
+ function unset(object, key) {
2389
+ if (Array.isArray(object) && isIndex(key)) {
2390
+ object.splice(Number(key), 1);
2391
+ return;
2392
+ }
2393
+ if (isObject(object)) {
2394
+ delete object[key];
2395
+ }
2396
+ }
2397
+ /**
2398
+ * Removes a nested property from object
2399
+ */
2400
+ function unsetPath(object, path) {
2401
+ if (isNotNestedPath(path)) {
2402
+ delete object[cleanupNonNestedPath(path)];
2403
+ return;
2404
+ }
2405
+ const keys = path.split(/\.|\[(\d+)\]/).filter(Boolean);
2406
+ let acc = object;
2407
+ for (let i = 0; i < keys.length; i++) {
2408
+ // Last key, unset it
2409
+ if (i === keys.length - 1) {
2410
+ unset(acc, keys[i]);
2411
+ break;
2412
+ }
2413
+ // Key does not exist, exit
2414
+ if (!(keys[i] in acc) || isNullOrUndefined(acc[keys[i]])) {
2415
+ break;
2416
+ }
2417
+ acc = acc[keys[i]];
2418
+ }
2419
+ const pathValues = keys.map((_, idx) => {
2420
+ return getFromPath(object, keys.slice(0, idx).join('.'));
2421
+ });
2422
+ for (let i = pathValues.length - 1; i >= 0; i--) {
2423
+ if (!isEmptyContainer(pathValues[i])) {
2424
+ continue;
2425
+ }
2426
+ if (i === 0) {
2427
+ unset(object, keys[0]);
2428
+ continue;
2429
+ }
2430
+ unset(pathValues[i - 1], keys[i - 1]);
2431
+ }
2432
+ }
2433
+ /**
2434
+ * A typed version of Object.keys
2435
+ */
2436
+ function keysOf(record) {
2437
+ return Object.keys(record);
2438
+ }
2439
+ // Uses same component provide as its own injections
2440
+ // Due to changes in https://github.com/vuejs/vue-next/pull/2424
2441
+ function injectWithSelf(symbol, def = undefined) {
2442
+ const vm = getCurrentInstance();
2443
+ return (vm === null || vm === void 0 ? void 0 : vm.provides[symbol]) || inject(symbol, def);
2444
+ }
2445
+ function warn(message) {
2446
+ warn$1(`[vee-validate]: ${message}`);
2447
+ }
2448
+ /**
2449
+ * Ensures we deal with a singular field value
2450
+ */
2451
+ function normalizeField(field) {
2452
+ if (Array.isArray(field)) {
2453
+ return field[0];
2454
+ }
2455
+ return field;
2456
+ }
2457
+ function resolveNextCheckboxValue(currentValue, checkedValue, uncheckedValue) {
2458
+ if (Array.isArray(currentValue)) {
2459
+ const newVal = [...currentValue];
2460
+ const idx = newVal.indexOf(checkedValue);
2461
+ idx >= 0 ? newVal.splice(idx, 1) : newVal.push(checkedValue);
2462
+ return newVal;
2463
+ }
2464
+ return currentValue === checkedValue ? uncheckedValue : checkedValue;
2465
+ }
2466
+ /**
2467
+ * Creates a throttled function that only invokes the provided function (`func`) at most once per within a given number of milliseconds
2468
+ * (`limit`)
2469
+ */
2470
+ function throttle(func, limit) {
2471
+ let inThrottle;
2472
+ let lastResult;
2473
+ return function (...args) {
2474
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
2475
+ const context = this;
2476
+ if (!inThrottle) {
2477
+ inThrottle = true;
2478
+ setTimeout(() => (inThrottle = false), limit);
2479
+ lastResult = func.apply(context, args);
2480
+ }
2481
+ return lastResult;
2482
+ };
2483
+ }
2484
+ function debounceAsync(inner, ms = 0) {
2485
+ let timer = null;
2486
+ let resolves = [];
2487
+ return function (...args) {
2488
+ // Run the function after a certain amount of time
2489
+ if (timer) {
2490
+ window.clearTimeout(timer);
2491
+ }
2492
+ timer = window.setTimeout(() => {
2493
+ // Get the result of the inner function, then apply it to the resolve function of
2494
+ // each promise that has been created since the last time the inner function was run
2495
+ const result = inner(...args);
2496
+ resolves.forEach(r => r(result));
2497
+ resolves = [];
2498
+ }, ms);
2499
+ return new Promise(resolve => resolves.push(resolve));
2500
+ };
2501
+ }
2502
+
2503
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2504
+ const normalizeChildren = (tag, context, slotProps) => {
2505
+ if (!context.slots.default) {
2506
+ return context.slots.default;
2507
+ }
2508
+ if (typeof tag === 'string' || !tag) {
2509
+ return context.slots.default(slotProps());
2510
+ }
2511
+ return {
2512
+ default: () => { var _a, _b; return (_b = (_a = context.slots).default) === null || _b === void 0 ? void 0 : _b.call(_a, slotProps()); },
2513
+ };
2514
+ };
2515
+ /**
2516
+ * 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
2517
+ * as they do not get casted to strings unlike `el.value` which preserves user-code behavior
2518
+ */
2519
+ function getBoundValue(el) {
2520
+ if (hasValueBinding(el)) {
2521
+ return el._value;
2522
+ }
2523
+ return undefined;
2524
+ }
2525
+ /**
2526
+ * 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
2527
+ * as they do not get casted to strings unlike `el.value` which preserves user-code behavior
2528
+ */
2529
+ function hasValueBinding(el) {
2530
+ return '_value' in el;
2531
+ }
2532
+
2533
+ function normalizeEventValue(value) {
2534
+ if (!isEvent(value)) {
2535
+ return value;
2536
+ }
2537
+ const input = value.target;
2538
+ // Vue sets the current bound value on `_value` prop
2539
+ // for checkboxes it it should fetch the value binding type as is (boolean instead of string)
2540
+ if (hasCheckedAttr(input.type) && hasValueBinding(input)) {
2541
+ return getBoundValue(input);
2542
+ }
2543
+ if (input.type === 'file' && input.files) {
2544
+ return Array.from(input.files);
2545
+ }
2546
+ if (isNativeMultiSelect(input)) {
2547
+ return Array.from(input.options)
2548
+ .filter(opt => opt.selected && !opt.disabled)
2549
+ .map(getBoundValue);
2550
+ }
2551
+ // makes sure we get the actual `option` bound value
2552
+ // #3440
2553
+ if (isNativeSelect(input)) {
2554
+ const selectedOption = Array.from(input.options).find(opt => opt.selected);
2555
+ return selectedOption ? getBoundValue(selectedOption) : input.value;
2556
+ }
2557
+ return input.value;
2558
+ }
2559
+
2560
+ /**
2561
+ * Normalizes the given rules expression.
2562
+ */
2563
+ function normalizeRules(rules) {
2564
+ const acc = {};
2565
+ Object.defineProperty(acc, '_$$isNormalized', {
2566
+ value: true,
2567
+ writable: false,
2568
+ enumerable: false,
2569
+ configurable: false,
2570
+ });
2571
+ if (!rules) {
2572
+ return acc;
2573
+ }
2574
+ // Object is already normalized, skip.
2575
+ if (isObject(rules) && rules._$$isNormalized) {
2576
+ return rules;
2577
+ }
2578
+ if (isObject(rules)) {
2579
+ return Object.keys(rules).reduce((prev, curr) => {
2580
+ const params = normalizeParams(rules[curr]);
2581
+ if (rules[curr] !== false) {
2582
+ prev[curr] = buildParams(params);
2583
+ }
2584
+ return prev;
2585
+ }, acc);
2586
+ }
2587
+ /* istanbul ignore if */
2588
+ if (typeof rules !== 'string') {
2589
+ return acc;
2590
+ }
2591
+ return rules.split('|').reduce((prev, rule) => {
2592
+ const parsedRule = parseRule(rule);
2593
+ if (!parsedRule.name) {
2594
+ return prev;
2595
+ }
2596
+ prev[parsedRule.name] = buildParams(parsedRule.params);
2597
+ return prev;
2598
+ }, acc);
2599
+ }
2600
+ /**
2601
+ * Normalizes a rule param.
2602
+ */
2603
+ function normalizeParams(params) {
2604
+ if (params === true) {
2605
+ return [];
2606
+ }
2607
+ if (Array.isArray(params)) {
2608
+ return params;
2609
+ }
2610
+ if (isObject(params)) {
2611
+ return params;
2612
+ }
2613
+ return [params];
2614
+ }
2615
+ function buildParams(provided) {
2616
+ const mapValueToLocator = (value) => {
2617
+ // A target param using interpolation
2618
+ if (typeof value === 'string' && value[0] === '@') {
2619
+ return createLocator(value.slice(1));
2620
+ }
2621
+ return value;
2622
+ };
2623
+ if (Array.isArray(provided)) {
2624
+ return provided.map(mapValueToLocator);
2625
+ }
2626
+ // #3073
2627
+ if (provided instanceof RegExp) {
2628
+ return [provided];
2629
+ }
2630
+ return Object.keys(provided).reduce((prev, key) => {
2631
+ prev[key] = mapValueToLocator(provided[key]);
2632
+ return prev;
2633
+ }, {});
2634
+ }
2635
+ /**
2636
+ * Parses a rule string expression.
2637
+ */
2638
+ const parseRule = (rule) => {
2639
+ let params = [];
2640
+ const name = rule.split(':')[0];
2641
+ if (rule.includes(':')) {
2642
+ params = rule.split(':').slice(1).join(':').split(',');
2643
+ }
2644
+ return { name, params };
2645
+ };
2646
+ function createLocator(value) {
2647
+ const locator = (crossTable) => {
2648
+ const val = getFromPath(crossTable, value) || crossTable[value];
2649
+ return val;
2650
+ };
2651
+ locator.__locatorRef = value;
2652
+ return locator;
2653
+ }
2654
+ function extractLocators(params) {
2655
+ if (Array.isArray(params)) {
2656
+ return params.filter(isLocator);
2657
+ }
2658
+ return keysOf(params)
2659
+ .filter(key => isLocator(params[key]))
2660
+ .map(key => params[key]);
2661
+ }
2662
+
2663
+ const DEFAULT_CONFIG = {
2664
+ generateMessage: ({ field }) => `${field} is not valid.`,
2665
+ bails: true,
2666
+ validateOnBlur: true,
2667
+ validateOnChange: true,
2668
+ validateOnInput: false,
2669
+ validateOnModelUpdate: true,
2670
+ };
2671
+ let currentConfig = Object.assign({}, DEFAULT_CONFIG);
2672
+ const getConfig = () => currentConfig;
2673
+ const setConfig = (newConf) => {
2674
+ currentConfig = Object.assign(Object.assign({}, currentConfig), newConf);
2675
+ };
2676
+ const configure = setConfig;
2677
+
2678
+ /**
2679
+ * Validates a value against the rules.
2680
+ */
2681
+ async function validate(value, rules, options = {}) {
2682
+ const shouldBail = options === null || options === void 0 ? void 0 : options.bails;
2683
+ const field = {
2684
+ name: (options === null || options === void 0 ? void 0 : options.name) || '{field}',
2685
+ rules,
2686
+ bails: shouldBail !== null && shouldBail !== void 0 ? shouldBail : true,
2687
+ formData: (options === null || options === void 0 ? void 0 : options.values) || {},
2688
+ };
2689
+ const result = await _validate(field, value);
2690
+ const errors = result.errors;
2691
+ return {
2692
+ errors,
2693
+ valid: !errors.length,
2694
+ };
2695
+ }
2696
+ /**
2697
+ * Starts the validation process.
2698
+ */
2699
+ async function _validate(field, value) {
2700
+ if (isYupValidator(field.rules)) {
2701
+ return validateFieldWithYup(value, field.rules, { bails: field.bails });
2702
+ }
2703
+ // if a generic function, use it as the pipeline.
2704
+ if (isCallable(field.rules)) {
2705
+ const ctx = {
2706
+ field: field.name,
2707
+ form: field.formData,
2708
+ value: value,
2709
+ };
2710
+ const result = await field.rules(value, ctx);
2711
+ const isValid = typeof result !== 'string' && result;
2712
+ const message = typeof result === 'string' ? result : _generateFieldError(ctx);
2713
+ return {
2714
+ errors: !isValid ? [message] : [],
2715
+ };
2716
+ }
2717
+ const normalizedContext = Object.assign(Object.assign({}, field), { rules: normalizeRules(field.rules) });
2718
+ const errors = [];
2719
+ const rulesKeys = Object.keys(normalizedContext.rules);
2720
+ const length = rulesKeys.length;
2721
+ for (let i = 0; i < length; i++) {
2722
+ const rule = rulesKeys[i];
2723
+ const result = await _test(normalizedContext, value, {
2724
+ name: rule,
2725
+ params: normalizedContext.rules[rule],
2726
+ });
2727
+ if (result.error) {
2728
+ errors.push(result.error);
2729
+ if (field.bails) {
2730
+ return {
2731
+ errors,
2732
+ };
2733
+ }
2734
+ }
2735
+ }
2736
+ return {
2737
+ errors,
2738
+ };
2739
+ }
2740
+ /**
2741
+ * Handles yup validation
2742
+ */
2743
+ async function validateFieldWithYup(value, validator, opts) {
2744
+ var _a;
2745
+ const errors = await validator
2746
+ .validate(value, {
2747
+ abortEarly: (_a = opts.bails) !== null && _a !== void 0 ? _a : true,
2748
+ })
2749
+ .then(() => [])
2750
+ .catch((err) => {
2751
+ // Yup errors have a name prop one them.
2752
+ // https://github.com/jquense/yup#validationerrorerrors-string--arraystring-value-any-path-string
2753
+ if (err.name === 'ValidationError') {
2754
+ return err.errors;
2755
+ }
2756
+ // re-throw the error so we don't hide it
2757
+ throw err;
2758
+ });
2759
+ return {
2760
+ errors,
2761
+ };
2762
+ }
2763
+ /**
2764
+ * Tests a single input value against a rule.
2765
+ */
2766
+ async function _test(field, value, rule) {
2767
+ const validator = resolveRule(rule.name);
2768
+ if (!validator) {
2769
+ throw new Error(`No such validator '${rule.name}' exists.`);
2770
+ }
2771
+ const params = fillTargetValues(rule.params, field.formData);
2772
+ const ctx = {
2773
+ field: field.name,
2774
+ value,
2775
+ form: field.formData,
2776
+ rule: Object.assign(Object.assign({}, rule), { params }),
2777
+ };
2778
+ const result = await validator(value, params, ctx);
2779
+ if (typeof result === 'string') {
2780
+ return {
2781
+ error: result,
2782
+ };
2783
+ }
2784
+ return {
2785
+ error: result ? undefined : _generateFieldError(ctx),
2786
+ };
2787
+ }
2788
+ /**
2789
+ * Generates error messages.
2790
+ */
2791
+ function _generateFieldError(fieldCtx) {
2792
+ const message = getConfig().generateMessage;
2793
+ if (!message) {
2794
+ return 'Field is invalid';
2795
+ }
2796
+ return message(fieldCtx);
2797
+ }
2798
+ function fillTargetValues(params, crossTable) {
2799
+ const normalize = (value) => {
2800
+ if (isLocator(value)) {
2801
+ return value(crossTable);
2802
+ }
2803
+ return value;
2804
+ };
2805
+ if (Array.isArray(params)) {
2806
+ return params.map(normalize);
2807
+ }
2808
+ return Object.keys(params).reduce((acc, param) => {
2809
+ acc[param] = normalize(params[param]);
2810
+ return acc;
2811
+ }, {});
2812
+ }
2813
+ async function validateYupSchema(schema, values) {
2814
+ const errorObjects = await schema
2815
+ .validate(values, { abortEarly: false })
2816
+ .then(() => [])
2817
+ .catch((err) => {
2818
+ // Yup errors have a name prop one them.
2819
+ // https://github.com/jquense/yup#validationerrorerrors-string--arraystring-value-any-path-string
2820
+ if (err.name !== 'ValidationError') {
2821
+ throw err;
2822
+ }
2823
+ // list of aggregated errors
2824
+ return err.inner || [];
2825
+ });
2826
+ const results = {};
2827
+ const errors = {};
2828
+ for (const error of errorObjects) {
2829
+ const messages = error.errors;
2830
+ results[error.path] = { valid: !messages.length, errors: messages };
2831
+ if (messages.length) {
2832
+ errors[error.path] = messages[0];
2833
+ }
2834
+ }
2835
+ return {
2836
+ valid: !errorObjects.length,
2837
+ results,
2838
+ errors,
2839
+ };
2840
+ }
2841
+ async function validateObjectSchema(schema, values, opts) {
2842
+ const paths = keysOf(schema);
2843
+ const validations = paths.map(async (path) => {
2844
+ var _a, _b, _c;
2845
+ const fieldResult = await validate(getFromPath(values, path), schema[path], {
2846
+ name: ((_a = opts === null || opts === void 0 ? void 0 : opts.names) === null || _a === void 0 ? void 0 : _a[path]) || path,
2847
+ values: values,
2848
+ 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,
2849
+ });
2850
+ return Object.assign(Object.assign({}, fieldResult), { path });
2851
+ });
2852
+ let isAllValid = true;
2853
+ const validationResults = await Promise.all(validations);
2854
+ const results = {};
2855
+ const errors = {};
2856
+ for (const result of validationResults) {
2857
+ results[result.path] = {
2858
+ valid: result.valid,
2859
+ errors: result.errors,
2860
+ };
2861
+ if (!result.valid) {
2862
+ isAllValid = false;
2863
+ errors[result.path] = result.errors[0];
2864
+ }
2865
+ }
2866
+ return {
2867
+ valid: isAllValid,
2868
+ results,
2869
+ errors,
2870
+ };
2871
+ }
2872
+
2873
+ function set(obj, key, val) {
2874
+ if (typeof val.value === 'object') val.value = klona(val.value);
2875
+ if (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === '__proto__') {
2876
+ Object.defineProperty(obj, key, val);
2877
+ } else obj[key] = val.value;
2878
+ }
2879
+
2880
+ function klona(x) {
2881
+ if (typeof x !== 'object') return x;
2882
+
2883
+ var i=0, k, list, tmp, str=Object.prototype.toString.call(x);
2884
+
2885
+ if (str === '[object Object]') {
2886
+ tmp = Object.create(x.__proto__ || null);
2887
+ } else if (str === '[object Array]') {
2888
+ tmp = Array(x.length);
2889
+ } else if (str === '[object Set]') {
2890
+ tmp = new Set;
2891
+ x.forEach(function (val) {
2892
+ tmp.add(klona(val));
2893
+ });
2894
+ } else if (str === '[object Map]') {
2895
+ tmp = new Map;
2896
+ x.forEach(function (val, key) {
2897
+ tmp.set(klona(key), klona(val));
2898
+ });
2899
+ } else if (str === '[object Date]') {
2900
+ tmp = new Date(+x);
2901
+ } else if (str === '[object RegExp]') {
2902
+ tmp = new RegExp(x.source, x.flags);
2903
+ } else if (str === '[object DataView]') {
2904
+ tmp = new x.constructor( klona(x.buffer) );
2905
+ } else if (str === '[object ArrayBuffer]') {
2906
+ tmp = x.slice(0);
2907
+ } else if (str.slice(-6) === 'Array]') {
2908
+ // ArrayBuffer.isView(x)
2909
+ // ~> `new` bcuz `Buffer.slice` => ref
2910
+ tmp = new x.constructor(x);
2911
+ }
2912
+
2913
+ if (tmp) {
2914
+ for (list=Object.getOwnPropertySymbols(x); i < list.length; i++) {
2915
+ set(tmp, list[i], Object.getOwnPropertyDescriptor(x, list[i]));
2916
+ }
2917
+
2918
+ for (i=0, list=Object.getOwnPropertyNames(x); i < list.length; i++) {
2919
+ if (Object.hasOwnProperty.call(tmp, k=list[i]) && tmp[k] === x[k]) continue;
2920
+ set(tmp, k, Object.getOwnPropertyDescriptor(x, k));
2921
+ }
2922
+ }
2923
+
2924
+ return tmp || x;
2925
+ }
2926
+
2927
+ var es6 = function equal(a, b) {
2928
+ if (a === b) return true;
2929
+
2930
+ if (a && b && typeof a == 'object' && typeof b == 'object') {
2931
+ if (a.constructor !== b.constructor) return false;
2932
+
2933
+ var length, i, keys;
2934
+ if (Array.isArray(a)) {
2935
+ length = a.length;
2936
+ if (length != b.length) return false;
2937
+ for (i = length; i-- !== 0;)
2938
+ if (!equal(a[i], b[i])) return false;
2939
+ return true;
2940
+ }
2941
+
2942
+
2943
+ if ((a instanceof Map) && (b instanceof Map)) {
2944
+ if (a.size !== b.size) return false;
2945
+ for (i of a.entries())
2946
+ if (!b.has(i[0])) return false;
2947
+ for (i of a.entries())
2948
+ if (!equal(i[1], b.get(i[0]))) return false;
2949
+ return true;
2950
+ }
2951
+
2952
+ if ((a instanceof Set) && (b instanceof Set)) {
2953
+ if (a.size !== b.size) return false;
2954
+ for (i of a.entries())
2955
+ if (!b.has(i[0])) return false;
2956
+ return true;
2957
+ }
2958
+
2959
+ if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
2960
+ length = a.length;
2961
+ if (length != b.length) return false;
2962
+ for (i = length; i-- !== 0;)
2963
+ if (a[i] !== b[i]) return false;
2964
+ return true;
2965
+ }
2966
+
2967
+
2968
+ if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
2969
+ if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
2970
+ if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
2971
+
2972
+ keys = Object.keys(a);
2973
+ length = keys.length;
2974
+ if (length !== Object.keys(b).length) return false;
2975
+
2976
+ for (i = length; i-- !== 0;)
2977
+ if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
2978
+
2979
+ for (i = length; i-- !== 0;) {
2980
+ var key = keys[i];
2981
+
2982
+ if (!equal(a[key], b[key])) return false;
2983
+ }
2984
+
2985
+ return true;
2986
+ }
2987
+
2988
+ // true if both NaN, false otherwise
2989
+ return a!==a && b!==b;
2990
+ };
2991
+
2992
+ let ID_COUNTER = 0;
2993
+ function useFieldState(path, init) {
2994
+ const { value, initialValue, setInitialValue } = _useFieldValue(path, init.modelValue, !init.standalone);
2995
+ const { errorMessage, errors, setErrors } = _useFieldErrors(path, !init.standalone);
2996
+ const meta = _useFieldMeta(value, initialValue, errors);
2997
+ const id = ID_COUNTER >= Number.MAX_SAFE_INTEGER ? 0 : ++ID_COUNTER;
2998
+ function setState(state) {
2999
+ var _a;
3000
+ if ('value' in state) {
3001
+ value.value = state.value;
3002
+ }
3003
+ if ('errors' in state) {
3004
+ setErrors(state.errors);
3005
+ }
3006
+ if ('touched' in state) {
3007
+ meta.touched = (_a = state.touched) !== null && _a !== void 0 ? _a : meta.touched;
3008
+ }
3009
+ if ('initialValue' in state) {
3010
+ setInitialValue(state.initialValue);
3011
+ }
3012
+ }
3013
+ return {
3014
+ id,
3015
+ path,
3016
+ value,
3017
+ initialValue,
3018
+ meta,
3019
+ errors,
3020
+ errorMessage,
3021
+ setState,
3022
+ };
3023
+ }
3024
+ /**
3025
+ * Creates the field value and resolves the initial value
3026
+ */
3027
+ function _useFieldValue(path, modelValue, shouldInjectForm) {
3028
+ const form = shouldInjectForm ? injectWithSelf(FormContextKey, undefined) : undefined;
3029
+ const modelRef = ref(unref(modelValue));
3030
+ function resolveInitialValue() {
3031
+ if (!form) {
3032
+ return unref(modelRef);
3033
+ }
3034
+ return getFromPath(form.meta.value.initialValues, unref(path), unref(modelRef));
3035
+ }
3036
+ function setInitialValue(value) {
3037
+ if (!form) {
3038
+ modelRef.value = value;
3039
+ return;
3040
+ }
3041
+ form.setFieldInitialValue(unref(path), value);
3042
+ }
3043
+ const initialValue = computed(resolveInitialValue);
3044
+ // if no form is associated, use a regular ref.
3045
+ if (!form) {
3046
+ const value = ref(resolveInitialValue());
3047
+ return {
3048
+ value,
3049
+ initialValue,
3050
+ setInitialValue,
3051
+ };
3052
+ }
3053
+ // to set the initial value, first check if there is a current value, if there is then use it.
3054
+ // otherwise use the configured initial value if it exists.
3055
+ // prioritize model value over form values
3056
+ // #3429
3057
+ const currentValue = modelValue ? unref(modelValue) : getFromPath(form.values, unref(path), unref(initialValue));
3058
+ form.stageInitialValue(unref(path), currentValue);
3059
+ // otherwise use a computed setter that triggers the `setFieldValue`
3060
+ const value = computed({
3061
+ get() {
3062
+ return getFromPath(form.values, unref(path));
3063
+ },
3064
+ set(newVal) {
3065
+ form.setFieldValue(unref(path), newVal);
3066
+ },
3067
+ });
3068
+ return {
3069
+ value,
3070
+ initialValue,
3071
+ setInitialValue,
3072
+ };
3073
+ }
3074
+ /**
3075
+ * Creates meta flags state and some associated effects with them
3076
+ */
3077
+ function _useFieldMeta(currentValue, initialValue, errors) {
3078
+ const meta = reactive({
3079
+ touched: false,
3080
+ pending: false,
3081
+ valid: true,
3082
+ validated: !!unref(errors).length,
3083
+ initialValue: computed(() => unref(initialValue)),
3084
+ dirty: computed(() => {
3085
+ return !es6(unref(currentValue), unref(initialValue));
3086
+ }),
3087
+ });
3088
+ watch(errors, value => {
3089
+ meta.valid = !value.length;
3090
+ }, {
3091
+ immediate: true,
3092
+ flush: 'sync',
3093
+ });
3094
+ return meta;
3095
+ }
3096
+ /**
3097
+ * Creates the error message state for the field state
3098
+ */
3099
+ function _useFieldErrors(path, shouldInjectForm) {
3100
+ const form = shouldInjectForm ? injectWithSelf(FormContextKey, undefined) : undefined;
3101
+ function normalizeErrors(messages) {
3102
+ if (!messages) {
3103
+ return [];
3104
+ }
3105
+ return Array.isArray(messages) ? messages : [messages];
3106
+ }
3107
+ if (!form) {
3108
+ const errors = ref([]);
3109
+ return {
3110
+ errors,
3111
+ errorMessage: computed(() => errors.value[0]),
3112
+ setErrors: (messages) => {
3113
+ errors.value = normalizeErrors(messages);
3114
+ },
3115
+ };
3116
+ }
3117
+ const errors = computed(() => form.errorBag.value[unref(path)] || []);
3118
+ return {
3119
+ errors,
3120
+ errorMessage: computed(() => errors.value[0]),
3121
+ setErrors: (messages) => {
3122
+ form.setFieldErrorBag(unref(path), normalizeErrors(messages));
3123
+ },
3124
+ };
3125
+ }
3126
+
3127
+ function installDevtoolsPlugin(app) {
3128
+ if (("production" !== 'production')) {
3129
+ setupDevtoolsPlugin({
3130
+ id: 'vee-validate-devtools-plugin',
3131
+ label: 'VeeValidate Plugin',
3132
+ packageName: 'vee-validate',
3133
+ homepage: 'https://vee-validate.logaretm.com/v4',
3134
+ app,
3135
+ logo: 'https://vee-validate.logaretm.com/v4/logo.png',
3136
+ }, setupApiHooks);
3137
+ }
3138
+ }
3139
+ const DEVTOOLS_FORMS = {};
3140
+ const DEVTOOLS_FIELDS = {};
3141
+ let API;
3142
+ const refreshInspector = throttle(() => {
3143
+ setTimeout(async () => {
3144
+ await nextTick();
3145
+ API === null || API === void 0 ? void 0 : API.sendInspectorState(INSPECTOR_ID);
3146
+ API === null || API === void 0 ? void 0 : API.sendInspectorTree(INSPECTOR_ID);
3147
+ }, 100);
3148
+ }, 100);
3149
+ function registerFormWithDevTools(form) {
3150
+ const vm = getCurrentInstance();
3151
+ if (!API) {
3152
+ const app = vm === null || vm === void 0 ? void 0 : vm.appContext.app;
3153
+ if (!app) {
3154
+ return;
3155
+ }
3156
+ installDevtoolsPlugin(app);
3157
+ }
3158
+ DEVTOOLS_FORMS[form.formId] = Object.assign({}, form);
3159
+ DEVTOOLS_FORMS[form.formId]._vm = vm;
3160
+ onUnmounted(() => {
3161
+ delete DEVTOOLS_FORMS[form.formId];
3162
+ refreshInspector();
3163
+ });
3164
+ refreshInspector();
3165
+ }
3166
+ function registerSingleFieldWithDevtools(field) {
3167
+ const vm = getCurrentInstance();
3168
+ if (!API) {
3169
+ const app = vm === null || vm === void 0 ? void 0 : vm.appContext.app;
3170
+ if (!app) {
3171
+ return;
3172
+ }
3173
+ installDevtoolsPlugin(app);
3174
+ }
3175
+ DEVTOOLS_FIELDS[field.id] = Object.assign({}, field);
3176
+ DEVTOOLS_FIELDS[field.id]._vm = vm;
3177
+ onUnmounted(() => {
3178
+ delete DEVTOOLS_FIELDS[field.id];
3179
+ refreshInspector();
3180
+ });
3181
+ refreshInspector();
3182
+ }
3183
+ const INSPECTOR_ID = 'vee-validate-inspector';
3184
+ const COLORS = {
3185
+ error: 0xbd4b4b,
3186
+ success: 0x06d77b,
3187
+ unknown: 0x54436b,
3188
+ white: 0xffffff,
3189
+ black: 0x000000,
3190
+ blue: 0x035397,
3191
+ purple: 0xb980f0,
3192
+ orange: 0xf5a962,
3193
+ gray: 0xbbbfca,
3194
+ };
3195
+ let SELECTED_NODE = null;
3196
+ function setupApiHooks(api) {
3197
+ API = api;
3198
+ api.addInspector({
3199
+ id: INSPECTOR_ID,
3200
+ icon: 'rule',
3201
+ label: 'vee-validate',
3202
+ noSelectionText: 'Select a vee-validate node to inspect',
3203
+ actions: [
3204
+ {
3205
+ icon: 'done_outline',
3206
+ tooltip: 'Validate selected item',
3207
+ action: async () => {
3208
+ if (!SELECTED_NODE) {
3209
+ console.error('There is not a valid selected vee-validate node or component');
3210
+ return;
3211
+ }
3212
+ const result = await SELECTED_NODE.validate();
3213
+ console.log(result);
3214
+ },
3215
+ },
3216
+ {
3217
+ icon: 'delete_sweep',
3218
+ tooltip: 'Clear validation state of the selected item',
3219
+ action: () => {
3220
+ if (!SELECTED_NODE) {
3221
+ console.error('There is not a valid selected vee-validate node or component');
3222
+ return;
3223
+ }
3224
+ if ('id' in SELECTED_NODE) {
3225
+ SELECTED_NODE.resetField();
3226
+ return;
3227
+ }
3228
+ SELECTED_NODE.resetForm();
3229
+ },
3230
+ },
3231
+ ],
3232
+ });
3233
+ api.on.getInspectorTree(payload => {
3234
+ if (payload.inspectorId !== INSPECTOR_ID) {
3235
+ return;
3236
+ }
3237
+ const forms = Object.values(DEVTOOLS_FORMS);
3238
+ const fields = Object.values(DEVTOOLS_FIELDS);
3239
+ payload.rootNodes = [
3240
+ ...forms.map(mapFormForDevtoolsInspector),
3241
+ ...fields.map(field => mapFieldForDevtoolsInspector(field)),
3242
+ ];
3243
+ });
3244
+ api.on.getInspectorState((payload, ctx) => {
3245
+ if (payload.inspectorId !== INSPECTOR_ID || ctx.currentTab !== `custom-inspector:${INSPECTOR_ID}`) {
3246
+ return;
3247
+ }
3248
+ const { form, field, type } = decodeNodeId(payload.nodeId);
3249
+ if (form && type === 'form') {
3250
+ payload.state = buildFormState(form);
3251
+ SELECTED_NODE = form;
3252
+ return;
3253
+ }
3254
+ if (field && type === 'field') {
3255
+ payload.state = buildFieldState(field);
3256
+ SELECTED_NODE = field;
3257
+ return;
3258
+ }
3259
+ SELECTED_NODE = null;
3260
+ });
3261
+ }
3262
+ function mapFormForDevtoolsInspector(form) {
3263
+ const { textColor, bgColor } = getTagTheme(form);
3264
+ const formTreeNodes = {};
3265
+ Object.values(form.fieldsByPath.value).forEach(field => {
3266
+ const fieldInstance = Array.isArray(field) ? field[0] : field;
3267
+ if (!fieldInstance) {
3268
+ return;
3269
+ }
3270
+ setInPath(formTreeNodes, unref(fieldInstance.name), mapFieldForDevtoolsInspector(fieldInstance, form));
3271
+ });
3272
+ function buildFormTree(tree, path = []) {
3273
+ const key = [...path].pop();
3274
+ if ('id' in tree) {
3275
+ return Object.assign(Object.assign({}, tree), { label: key || tree.label });
3276
+ }
3277
+ if (isObject(tree)) {
3278
+ return {
3279
+ id: `${path.join('.')}`,
3280
+ label: key || '',
3281
+ children: Object.keys(tree).map(key => buildFormTree(tree[key], [...path, key])),
3282
+ };
3283
+ }
3284
+ if (Array.isArray(tree)) {
3285
+ return {
3286
+ id: `${path.join('.')}`,
3287
+ label: `${key}[]`,
3288
+ children: tree.map((c, idx) => buildFormTree(c, [...path, String(idx)])),
3289
+ };
3290
+ }
3291
+ return { id: '', label: '', children: [] };
3292
+ }
3293
+ const { children } = buildFormTree(formTreeNodes);
3294
+ return {
3295
+ id: encodeNodeId(form),
3296
+ label: 'Form',
3297
+ children,
3298
+ tags: [
3299
+ {
3300
+ label: 'Form',
3301
+ textColor,
3302
+ backgroundColor: bgColor,
3303
+ },
3304
+ {
3305
+ label: `${Object.keys(form.fieldsByPath.value).length} fields`,
3306
+ textColor: COLORS.white,
3307
+ backgroundColor: COLORS.unknown,
3308
+ },
3309
+ ],
3310
+ };
3311
+ }
3312
+ function mapFieldForDevtoolsInspector(field, form) {
3313
+ const fieldInstance = normalizeField(field);
3314
+ const { textColor, bgColor } = getTagTheme(fieldInstance);
3315
+ const isGroup = Array.isArray(field) && field.length > 1;
3316
+ return {
3317
+ id: encodeNodeId(form, fieldInstance, !isGroup),
3318
+ label: unref(fieldInstance.name),
3319
+ children: Array.isArray(field) ? field.map(fieldItem => mapFieldForDevtoolsInspector(fieldItem, form)) : undefined,
3320
+ tags: [
3321
+ isGroup
3322
+ ? undefined
3323
+ : {
3324
+ label: 'Field',
3325
+ textColor,
3326
+ backgroundColor: bgColor,
3327
+ },
3328
+ !form
3329
+ ? {
3330
+ label: 'Standalone',
3331
+ textColor: COLORS.black,
3332
+ backgroundColor: COLORS.gray,
3333
+ }
3334
+ : undefined,
3335
+ !isGroup && fieldInstance.type === 'checkbox'
3336
+ ? {
3337
+ label: 'Checkbox',
3338
+ textColor: COLORS.white,
3339
+ backgroundColor: COLORS.blue,
3340
+ }
3341
+ : undefined,
3342
+ !isGroup && fieldInstance.type === 'radio'
3343
+ ? {
3344
+ label: 'Radio',
3345
+ textColor: COLORS.white,
3346
+ backgroundColor: COLORS.purple,
3347
+ }
3348
+ : undefined,
3349
+ isGroup
3350
+ ? {
3351
+ label: 'Group',
3352
+ textColor: COLORS.black,
3353
+ backgroundColor: COLORS.orange,
3354
+ }
3355
+ : undefined,
3356
+ ].filter(Boolean),
3357
+ };
3358
+ }
3359
+ function encodeNodeId(form, field, encodeIndex = true) {
3360
+ const fieldPath = form ? unref(field === null || field === void 0 ? void 0 : field.name) : field === null || field === void 0 ? void 0 : field.id;
3361
+ const fieldGroup = fieldPath ? form === null || form === void 0 ? void 0 : form.fieldsByPath.value[fieldPath] : undefined;
3362
+ let idx;
3363
+ if (encodeIndex && field && Array.isArray(fieldGroup)) {
3364
+ idx = fieldGroup.indexOf(field);
3365
+ }
3366
+ const idObject = { f: form === null || form === void 0 ? void 0 : form.formId, ff: fieldPath, idx, type: field ? 'field' : 'form' };
3367
+ return btoa(JSON.stringify(idObject));
3368
+ }
3369
+ function decodeNodeId(nodeId) {
3370
+ try {
3371
+ const idObject = JSON.parse(atob(nodeId));
3372
+ const form = DEVTOOLS_FORMS[idObject.f];
3373
+ if (!form && idObject.ff) {
3374
+ const field = DEVTOOLS_FIELDS[idObject.ff];
3375
+ if (!field) {
3376
+ return {};
3377
+ }
3378
+ return {
3379
+ type: idObject.type,
3380
+ field,
3381
+ };
3382
+ }
3383
+ if (!form) {
3384
+ return {};
3385
+ }
3386
+ const fieldGroup = form.fieldsByPath.value[idObject.ff];
3387
+ return {
3388
+ type: idObject.type,
3389
+ form,
3390
+ field: Array.isArray(fieldGroup) ? fieldGroup[idObject.idx || 0] : fieldGroup,
3391
+ };
3392
+ }
3393
+ catch (err) {
3394
+ // console.error(`Devtools: [vee-validate] Failed to parse node id ${nodeId}`);
3395
+ }
3396
+ return {};
3397
+ }
3398
+ function buildFieldState(field) {
3399
+ const { errors, meta, value } = field;
3400
+ return {
3401
+ 'Field state': [
3402
+ { key: 'errors', value: errors.value },
3403
+ {
3404
+ key: 'initialValue',
3405
+ value: meta.initialValue,
3406
+ },
3407
+ {
3408
+ key: 'currentValue',
3409
+ value: value.value,
3410
+ },
3411
+ {
3412
+ key: 'touched',
3413
+ value: meta.touched,
3414
+ },
3415
+ {
3416
+ key: 'dirty',
3417
+ value: meta.dirty,
3418
+ },
3419
+ {
3420
+ key: 'valid',
3421
+ value: meta.valid,
3422
+ },
3423
+ ],
3424
+ };
3425
+ }
3426
+ function buildFormState(form) {
3427
+ const { errorBag, meta, values, isSubmitting, submitCount } = form;
3428
+ return {
3429
+ 'Form state': [
3430
+ {
3431
+ key: 'submitCount',
3432
+ value: submitCount.value,
3433
+ },
3434
+ {
3435
+ key: 'isSubmitting',
3436
+ value: isSubmitting.value,
3437
+ },
3438
+ {
3439
+ key: 'touched',
3440
+ value: meta.value.touched,
3441
+ },
3442
+ {
3443
+ key: 'dirty',
3444
+ value: meta.value.dirty,
3445
+ },
3446
+ {
3447
+ key: 'valid',
3448
+ value: meta.value.valid,
3449
+ },
3450
+ {
3451
+ key: 'initialValues',
3452
+ value: meta.value.initialValues,
3453
+ },
3454
+ {
3455
+ key: 'currentValues',
3456
+ value: values,
3457
+ },
3458
+ {
3459
+ key: 'errors',
3460
+ value: keysOf(errorBag.value).reduce((acc, key) => {
3461
+ var _a;
3462
+ const message = (_a = errorBag.value[key]) === null || _a === void 0 ? void 0 : _a[0];
3463
+ if (message) {
3464
+ acc[key] = message;
3465
+ }
3466
+ return acc;
3467
+ }, {}),
3468
+ },
3469
+ ],
3470
+ };
3471
+ }
3472
+ /**
3473
+ * Resolves the tag color based on the form state
3474
+ */
3475
+ function getTagTheme(fieldOrForm) {
3476
+ // const fallbackColors = {
3477
+ // bgColor: COLORS.unknown,
3478
+ // textColor: COLORS.white,
3479
+ // };
3480
+ const isValid = 'id' in fieldOrForm ? fieldOrForm.meta.valid : fieldOrForm.meta.value.valid;
3481
+ return {
3482
+ bgColor: isValid ? COLORS.success : COLORS.error,
3483
+ textColor: isValid ? COLORS.black : COLORS.white,
3484
+ };
3485
+ }
3486
+
3487
+ /**
3488
+ * Creates a field composite.
3489
+ */
3490
+ function useField(name, rules, opts) {
3491
+ if (hasCheckedAttr(opts === null || opts === void 0 ? void 0 : opts.type)) {
3492
+ return useCheckboxField(name, rules, opts);
3493
+ }
3494
+ return _useField(name, rules, opts);
3495
+ }
3496
+ function _useField(name, rules, opts) {
3497
+ const { initialValue: modelValue, validateOnMount, bails, type, checkedValue, label, validateOnValueUpdate, uncheckedValue, standalone, } = normalizeOptions(unref(name), opts);
3498
+ const form = !standalone ? injectWithSelf(FormContextKey) : undefined;
3499
+ const { id, value, initialValue, meta, setState, errors, errorMessage } = useFieldState(name, {
3500
+ modelValue,
3501
+ standalone,
3502
+ });
3503
+ /**
3504
+ * Handles common onBlur meta update
3505
+ */
3506
+ const handleBlur = () => {
3507
+ meta.touched = true;
3508
+ };
3509
+ const normalizedRules = computed(() => {
3510
+ let rulesValue = unref(rules);
3511
+ const schema = unref(form === null || form === void 0 ? void 0 : form.schema);
3512
+ if (schema && !isYupValidator(schema)) {
3513
+ rulesValue = extractRuleFromSchema(schema, unref(name)) || rulesValue;
3514
+ }
3515
+ if (isYupValidator(rulesValue) || isCallable(rulesValue)) {
3516
+ return rulesValue;
3517
+ }
3518
+ return normalizeRules(rulesValue);
3519
+ });
3520
+ async function validateCurrentValue(mode) {
3521
+ var _a, _b;
3522
+ if (form === null || form === void 0 ? void 0 : form.validateSchema) {
3523
+ return (_a = (await form.validateSchema(mode)).results[unref(name)]) !== null && _a !== void 0 ? _a : { valid: true, errors: [] };
3524
+ }
3525
+ return validate(value.value, normalizedRules.value, {
3526
+ name: unref(label) || unref(name),
3527
+ values: (_b = form === null || form === void 0 ? void 0 : form.values) !== null && _b !== void 0 ? _b : {},
3528
+ bails,
3529
+ });
3530
+ }
3531
+ async function validateWithStateMutation() {
3532
+ meta.pending = true;
3533
+ meta.validated = true;
3534
+ const result = await validateCurrentValue('validated-only');
3535
+ setState({ errors: result.errors });
3536
+ meta.pending = false;
3537
+ return result;
3538
+ }
3539
+ async function validateValidStateOnly() {
3540
+ const result = await validateCurrentValue('silent');
3541
+ meta.valid = result.valid;
3542
+ return result;
3543
+ }
3544
+ function validate$1(opts) {
3545
+ if (!(opts === null || opts === void 0 ? void 0 : opts.mode) || (opts === null || opts === void 0 ? void 0 : opts.mode) === 'force') {
3546
+ return validateWithStateMutation();
3547
+ }
3548
+ if ((opts === null || opts === void 0 ? void 0 : opts.mode) === 'validated-only') {
3549
+ return validateWithStateMutation();
3550
+ }
3551
+ return validateValidStateOnly();
3552
+ }
3553
+ // Common input/change event handler
3554
+ const handleChange = (e, shouldValidate = true) => {
3555
+ const newValue = normalizeEventValue(e);
3556
+ value.value = newValue;
3557
+ if (!validateOnValueUpdate && shouldValidate) {
3558
+ validateWithStateMutation();
3559
+ }
3560
+ };
3561
+ // Runs the initial validation
3562
+ onMounted(() => {
3563
+ if (validateOnMount) {
3564
+ return validateWithStateMutation();
3565
+ }
3566
+ // validate self initially if no form was handling this
3567
+ // forms should have their own initial silent validation run to make things more efficient
3568
+ if (!form || !form.validateSchema) {
3569
+ validateValidStateOnly();
3570
+ }
3571
+ });
3572
+ function setTouched(isTouched) {
3573
+ meta.touched = isTouched;
3574
+ }
3575
+ let unwatchValue;
3576
+ function watchValue() {
3577
+ unwatchValue = watch(value, validateOnValueUpdate ? validateWithStateMutation : validateValidStateOnly, {
3578
+ deep: true,
3579
+ });
3580
+ }
3581
+ watchValue();
3582
+ function resetField(state) {
3583
+ var _a;
3584
+ unwatchValue === null || unwatchValue === void 0 ? void 0 : unwatchValue();
3585
+ const newValue = state && 'value' in state ? state.value : initialValue.value;
3586
+ setState({
3587
+ value: klona(newValue),
3588
+ initialValue: klona(newValue),
3589
+ touched: (_a = state === null || state === void 0 ? void 0 : state.touched) !== null && _a !== void 0 ? _a : false,
3590
+ errors: (state === null || state === void 0 ? void 0 : state.errors) || [],
3591
+ });
3592
+ meta.pending = false;
3593
+ meta.validated = false;
3594
+ validateValidStateOnly();
3595
+ // need to watch at next tick to avoid triggering the value watcher
3596
+ nextTick(() => {
3597
+ watchValue();
3598
+ });
3599
+ }
3600
+ function setValue(newValue) {
3601
+ value.value = newValue;
3602
+ }
3603
+ function setErrors(errors) {
3604
+ setState({ errors: Array.isArray(errors) ? errors : [errors] });
3605
+ }
3606
+ const field = {
3607
+ id,
3608
+ name,
3609
+ label,
3610
+ value,
3611
+ meta,
3612
+ errors,
3613
+ errorMessage,
3614
+ type,
3615
+ checkedValue,
3616
+ uncheckedValue,
3617
+ bails,
3618
+ resetField,
3619
+ handleReset: () => resetField(),
3620
+ validate: validate$1,
3621
+ handleChange,
3622
+ handleBlur,
3623
+ setState,
3624
+ setTouched,
3625
+ setErrors,
3626
+ setValue,
3627
+ };
3628
+ provide(FieldContextKey, field);
3629
+ if (isRef(rules) && typeof unref(rules) !== 'function') {
3630
+ watch(rules, (value, oldValue) => {
3631
+ if (es6(value, oldValue)) {
3632
+ return;
3633
+ }
3634
+ meta.validated ? validateWithStateMutation() : validateValidStateOnly();
3635
+ }, {
3636
+ deep: true,
3637
+ });
3638
+ }
3639
+ if (("production" !== 'production')) {
3640
+ field._vm = getCurrentInstance();
3641
+ watch(() => (Object.assign(Object.assign({ errors: errors.value }, meta), { value: value.value })), refreshInspector, {
3642
+ deep: true,
3643
+ });
3644
+ if (!form) {
3645
+ registerSingleFieldWithDevtools(field);
3646
+ }
3647
+ }
3648
+ // if no associated form return the field API immediately
3649
+ if (!form) {
3650
+ return field;
3651
+ }
3652
+ // associate the field with the given form
3653
+ form.register(field);
3654
+ onBeforeUnmount(() => {
3655
+ form.unregister(field);
3656
+ });
3657
+ // extract cross-field dependencies in a computed prop
3658
+ const dependencies = computed(() => {
3659
+ const rulesVal = normalizedRules.value;
3660
+ // is falsy, a function schema or a yup schema
3661
+ if (!rulesVal || isCallable(rulesVal) || isYupValidator(rulesVal)) {
3662
+ return {};
3663
+ }
3664
+ return Object.keys(rulesVal).reduce((acc, rule) => {
3665
+ const deps = extractLocators(rulesVal[rule])
3666
+ .map((dep) => dep.__locatorRef)
3667
+ .reduce((depAcc, depName) => {
3668
+ const depValue = getFromPath(form.values, depName) || form.values[depName];
3669
+ if (depValue !== undefined) {
3670
+ depAcc[depName] = depValue;
3671
+ }
3672
+ return depAcc;
3673
+ }, {});
3674
+ Object.assign(acc, deps);
3675
+ return acc;
3676
+ }, {});
3677
+ });
3678
+ // Adds a watcher that runs the validation whenever field dependencies change
3679
+ watch(dependencies, (deps, oldDeps) => {
3680
+ // Skip if no dependencies or if the field wasn't manipulated
3681
+ if (!Object.keys(deps).length) {
3682
+ return;
3683
+ }
3684
+ const shouldValidate = !es6(deps, oldDeps);
3685
+ if (shouldValidate) {
3686
+ meta.validated ? validateWithStateMutation() : validateValidStateOnly();
3687
+ }
3688
+ });
3689
+ return field;
3690
+ }
3691
+ /**
3692
+ * Normalizes partial field options to include the full options
3693
+ */
3694
+ function normalizeOptions(name, opts) {
3695
+ const defaults = () => ({
3696
+ initialValue: undefined,
3697
+ validateOnMount: false,
3698
+ bails: true,
3699
+ rules: '',
3700
+ label: name,
3701
+ validateOnValueUpdate: true,
3702
+ standalone: false,
3703
+ });
3704
+ if (!opts) {
3705
+ return defaults();
3706
+ }
3707
+ // TODO: Deprecate this in next major release
3708
+ const checkedValue = 'valueProp' in opts ? opts.valueProp : opts.checkedValue;
3709
+ return Object.assign(Object.assign(Object.assign({}, defaults()), (opts || {})), { checkedValue });
3710
+ }
3711
+ /**
3712
+ * Extracts the validation rules from a schema
3713
+ */
3714
+ function extractRuleFromSchema(schema, fieldName) {
3715
+ // no schema at all
3716
+ if (!schema) {
3717
+ return undefined;
3718
+ }
3719
+ // there is a key on the schema object for this field
3720
+ return schema[fieldName];
3721
+ }
3722
+ function useCheckboxField(name, rules, opts) {
3723
+ const form = !(opts === null || opts === void 0 ? void 0 : opts.standalone) ? injectWithSelf(FormContextKey) : undefined;
3724
+ const checkedValue = opts === null || opts === void 0 ? void 0 : opts.checkedValue;
3725
+ const uncheckedValue = opts === null || opts === void 0 ? void 0 : opts.uncheckedValue;
3726
+ function patchCheckboxApi(field) {
3727
+ const handleChange = field.handleChange;
3728
+ const checked = computed(() => {
3729
+ const currentValue = unref(field.value);
3730
+ const checkedVal = unref(checkedValue);
3731
+ return Array.isArray(currentValue) ? currentValue.includes(checkedVal) : checkedVal === currentValue;
3732
+ });
3733
+ function handleCheckboxChange(e, shouldValidate = true) {
3734
+ var _a, _b;
3735
+ if (checked.value === ((_b = (_a = e) === null || _a === void 0 ? void 0 : _a.target) === null || _b === void 0 ? void 0 : _b.checked)) {
3736
+ return;
3737
+ }
3738
+ let newValue = normalizeEventValue(e);
3739
+ // Single checkbox field without a form to toggle it's value
3740
+ if (!form) {
3741
+ newValue = resolveNextCheckboxValue(unref(field.value), unref(checkedValue), unref(uncheckedValue));
3742
+ }
3743
+ handleChange(newValue, shouldValidate);
3744
+ }
3745
+ onBeforeUnmount(() => {
3746
+ // toggles the checkbox value if it was checked
3747
+ if (checked.value) {
3748
+ handleCheckboxChange(unref(checkedValue), false);
3749
+ }
3750
+ });
3751
+ return Object.assign(Object.assign({}, field), { checked,
3752
+ checkedValue,
3753
+ uncheckedValue, handleChange: handleCheckboxChange });
3754
+ }
3755
+ return patchCheckboxApi(_useField(name, rules, opts));
3756
+ }
3757
+
3758
+ const FieldImpl = defineComponent({
3759
+ name: 'Field',
3760
+ inheritAttrs: false,
3761
+ props: {
3762
+ as: {
3763
+ type: [String, Object],
3764
+ default: undefined,
3765
+ },
3766
+ name: {
3767
+ type: String,
3768
+ required: true,
3769
+ },
3770
+ rules: {
3771
+ type: [Object, String, Function],
3772
+ default: undefined,
3773
+ },
3774
+ validateOnMount: {
3775
+ type: Boolean,
3776
+ default: false,
3777
+ },
3778
+ validateOnBlur: {
3779
+ type: Boolean,
3780
+ default: undefined,
3781
+ },
3782
+ validateOnChange: {
3783
+ type: Boolean,
3784
+ default: undefined,
3785
+ },
3786
+ validateOnInput: {
3787
+ type: Boolean,
3788
+ default: undefined,
3789
+ },
3790
+ validateOnModelUpdate: {
3791
+ type: Boolean,
3792
+ default: undefined,
3793
+ },
3794
+ bails: {
3795
+ type: Boolean,
3796
+ default: () => getConfig().bails,
3797
+ },
3798
+ label: {
3799
+ type: String,
3800
+ default: undefined,
3801
+ },
3802
+ uncheckedValue: {
3803
+ type: null,
3804
+ default: undefined,
3805
+ },
3806
+ modelValue: {
3807
+ type: null,
3808
+ default: IS_ABSENT,
3809
+ },
3810
+ modelModifiers: {
3811
+ type: null,
3812
+ default: () => ({}),
3813
+ },
3814
+ 'onUpdate:modelValue': {
3815
+ type: null,
3816
+ default: undefined,
3817
+ },
3818
+ standalone: {
3819
+ type: Boolean,
3820
+ default: false,
3821
+ },
3822
+ },
3823
+ setup(props, ctx) {
3824
+ const rules = toRef(props, 'rules');
3825
+ const name = toRef(props, 'name');
3826
+ const label = toRef(props, 'label');
3827
+ const uncheckedValue = toRef(props, 'uncheckedValue');
3828
+ const hasModelEvents = isPropPresent(props, 'onUpdate:modelValue');
3829
+ const { errors, value, errorMessage, validate: validateField, handleChange, handleBlur, setTouched, resetField, handleReset, meta, checked, setErrors, } = useField(name, rules, {
3830
+ validateOnMount: props.validateOnMount,
3831
+ bails: props.bails,
3832
+ standalone: props.standalone,
3833
+ type: ctx.attrs.type,
3834
+ initialValue: resolveInitialValue(props, ctx),
3835
+ // Only for checkboxes and radio buttons
3836
+ checkedValue: ctx.attrs.value,
3837
+ uncheckedValue,
3838
+ label,
3839
+ validateOnValueUpdate: false,
3840
+ });
3841
+ // If there is a v-model applied on the component we need to emit the `update:modelValue` whenever the value binding changes
3842
+ const onChangeHandler = hasModelEvents
3843
+ ? function handleChangeWithModel(e, shouldValidate = true) {
3844
+ handleChange(e, shouldValidate);
3845
+ ctx.emit('update:modelValue', value.value);
3846
+ }
3847
+ : handleChange;
3848
+ const handleInput = (e) => {
3849
+ if (!hasCheckedAttr(ctx.attrs.type)) {
3850
+ value.value = normalizeEventValue(e);
3851
+ }
3852
+ };
3853
+ const onInputHandler = hasModelEvents
3854
+ ? function handleInputWithModel(e) {
3855
+ handleInput(e);
3856
+ ctx.emit('update:modelValue', value.value);
3857
+ }
3858
+ : handleInput;
3859
+ const fieldProps = computed(() => {
3860
+ const { validateOnInput, validateOnChange, validateOnBlur, validateOnModelUpdate } = resolveValidationTriggers(props);
3861
+ const baseOnBlur = [handleBlur, ctx.attrs.onBlur, validateOnBlur ? validateField : undefined].filter(Boolean);
3862
+ const baseOnInput = [(e) => onChangeHandler(e, validateOnInput), ctx.attrs.onInput].filter(Boolean);
3863
+ const baseOnChange = [(e) => onChangeHandler(e, validateOnChange), ctx.attrs.onChange].filter(Boolean);
3864
+ const attrs = {
3865
+ name: props.name,
3866
+ onBlur: baseOnBlur,
3867
+ onInput: baseOnInput,
3868
+ onChange: baseOnChange,
3869
+ };
3870
+ attrs['onUpdate:modelValue'] = e => onChangeHandler(e, validateOnModelUpdate);
3871
+ if (hasCheckedAttr(ctx.attrs.type) && checked) {
3872
+ attrs.checked = checked.value;
3873
+ }
3874
+ else {
3875
+ attrs.value = value.value;
3876
+ }
3877
+ const tag = resolveTag(props, ctx);
3878
+ if (shouldHaveValueBinding(tag, ctx.attrs)) {
3879
+ delete attrs.value;
3880
+ }
3881
+ return attrs;
3882
+ });
3883
+ const modelValue = toRef(props, 'modelValue');
3884
+ watch(modelValue, newModelValue => {
3885
+ // Don't attempt to sync absent values
3886
+ if (newModelValue === IS_ABSENT && value.value === undefined) {
3887
+ return;
3888
+ }
3889
+ if (newModelValue !== applyModifiers(value.value, props.modelModifiers)) {
3890
+ value.value = newModelValue === IS_ABSENT ? undefined : newModelValue;
3891
+ validateField();
3892
+ }
3893
+ });
3894
+ function slotProps() {
3895
+ return {
3896
+ field: fieldProps.value,
3897
+ value: value.value,
3898
+ meta,
3899
+ errors: errors.value,
3900
+ errorMessage: errorMessage.value,
3901
+ validate: validateField,
3902
+ resetField,
3903
+ handleChange: onChangeHandler,
3904
+ handleInput: onInputHandler,
3905
+ handleReset,
3906
+ handleBlur,
3907
+ setTouched,
3908
+ setErrors,
3909
+ };
3910
+ }
3911
+ ctx.expose({
3912
+ setErrors,
3913
+ setTouched,
3914
+ reset: resetField,
3915
+ validate: validateField,
3916
+ handleChange,
3917
+ });
3918
+ return () => {
3919
+ const tag = resolveDynamicComponent(resolveTag(props, ctx));
3920
+ const children = normalizeChildren(tag, ctx, slotProps);
3921
+ if (tag) {
3922
+ return h(tag, Object.assign(Object.assign({}, ctx.attrs), fieldProps.value), children);
3923
+ }
3924
+ return children;
3925
+ };
3926
+ },
3927
+ });
3928
+ function resolveTag(props, ctx) {
3929
+ let tag = props.as || '';
3930
+ if (!props.as && !ctx.slots.default) {
3931
+ tag = 'input';
3932
+ }
3933
+ return tag;
3934
+ }
3935
+ function resolveValidationTriggers(props) {
3936
+ var _a, _b, _c, _d;
3937
+ const { validateOnInput, validateOnChange, validateOnBlur, validateOnModelUpdate } = getConfig();
3938
+ return {
3939
+ validateOnInput: (_a = props.validateOnInput) !== null && _a !== void 0 ? _a : validateOnInput,
3940
+ validateOnChange: (_b = props.validateOnChange) !== null && _b !== void 0 ? _b : validateOnChange,
3941
+ validateOnBlur: (_c = props.validateOnBlur) !== null && _c !== void 0 ? _c : validateOnBlur,
3942
+ validateOnModelUpdate: (_d = props.validateOnModelUpdate) !== null && _d !== void 0 ? _d : validateOnModelUpdate,
3943
+ };
3944
+ }
3945
+ function applyModifiers(value, modifiers) {
3946
+ if (modifiers.number) {
3947
+ return toNumber(value);
3948
+ }
3949
+ return value;
3950
+ }
3951
+ function resolveInitialValue(props, ctx) {
3952
+ // Gets the initial value either from `value` prop/attr or `v-model` binding (modelValue)
3953
+ // For checkboxes and radio buttons it will always be the model value not the `value` attribute
3954
+ if (!hasCheckedAttr(ctx.attrs.type)) {
3955
+ return isPropPresent(props, 'modelValue') ? props.modelValue : ctx.attrs.value;
3956
+ }
3957
+ return isPropPresent(props, 'modelValue') ? props.modelValue : undefined;
3958
+ }
3959
+ const Field = FieldImpl;
3960
+
3961
+ let FORM_COUNTER = 0;
3962
+ function useForm(opts) {
3963
+ const formId = FORM_COUNTER++;
3964
+ // Prevents fields from double resetting their values, which causes checkboxes to toggle their initial value
3965
+ // TODO: This won't be needed if we centralize all the state inside the `form` for form inputs
3966
+ let RESET_LOCK = false;
3967
+ // A lookup containing fields or field groups
3968
+ const fieldsByPath = ref({});
3969
+ // If the form is currently submitting
3970
+ const isSubmitting = ref(false);
3971
+ // The number of times the user tried to submit the form
3972
+ const submitCount = ref(0);
3973
+ // dictionary for field arrays to receive various signals like reset
3974
+ const fieldArraysLookup = {};
3975
+ // a private ref for all form values
3976
+ const formValues = reactive(klona(unref(opts === null || opts === void 0 ? void 0 : opts.initialValues) || {}));
3977
+ // the source of errors for the form fields
3978
+ const { errorBag, setErrorBag, setFieldErrorBag } = useErrorBag(opts === null || opts === void 0 ? void 0 : opts.initialErrors);
3979
+ // Gets the first error of each field
3980
+ const errors = computed(() => {
3981
+ return keysOf(errorBag.value).reduce((acc, key) => {
3982
+ const bag = errorBag.value[key];
3983
+ if (bag && bag.length) {
3984
+ acc[key] = bag[0];
3985
+ }
3986
+ return acc;
3987
+ }, {});
3988
+ });
3989
+ function getFirstFieldAtPath(path) {
3990
+ const fieldOrGroup = fieldsByPath.value[path];
3991
+ return Array.isArray(fieldOrGroup) ? fieldOrGroup[0] : fieldOrGroup;
3992
+ }
3993
+ function fieldExists(path) {
3994
+ return !!fieldsByPath.value[path];
3995
+ }
3996
+ /**
3997
+ * Holds a computed reference to all fields names and labels
3998
+ */
3999
+ const fieldNames = computed(() => {
4000
+ return keysOf(fieldsByPath.value).reduce((names, path) => {
4001
+ const field = getFirstFieldAtPath(path);
4002
+ if (field) {
4003
+ names[path] = unref(field.label || field.name) || '';
4004
+ }
4005
+ return names;
4006
+ }, {});
4007
+ });
4008
+ const fieldBailsMap = computed(() => {
4009
+ return keysOf(fieldsByPath.value).reduce((map, path) => {
4010
+ var _a;
4011
+ const field = getFirstFieldAtPath(path);
4012
+ if (field) {
4013
+ map[path] = (_a = field.bails) !== null && _a !== void 0 ? _a : true;
4014
+ }
4015
+ return map;
4016
+ }, {});
4017
+ });
4018
+ // mutable non-reactive reference to initial errors
4019
+ // we need this to process initial errors then unset them
4020
+ const initialErrors = Object.assign({}, ((opts === null || opts === void 0 ? void 0 : opts.initialErrors) || {}));
4021
+ // initial form values
4022
+ const { initialValues, originalInitialValues, setInitialValues } = useFormInitialValues(fieldsByPath, formValues, opts === null || opts === void 0 ? void 0 : opts.initialValues);
4023
+ // form meta aggregations
4024
+ const meta = useFormMeta(fieldsByPath, formValues, initialValues, errors);
4025
+ const schema = opts === null || opts === void 0 ? void 0 : opts.validationSchema;
4026
+ const formCtx = {
4027
+ formId,
4028
+ fieldsByPath,
4029
+ values: formValues,
4030
+ errorBag,
4031
+ errors,
4032
+ schema,
4033
+ submitCount,
4034
+ meta,
4035
+ isSubmitting,
4036
+ fieldArraysLookup,
4037
+ validateSchema: unref(schema) ? validateSchema : undefined,
4038
+ validate,
4039
+ register: registerField,
4040
+ unregister: unregisterField,
4041
+ setFieldErrorBag,
4042
+ validateField,
4043
+ setFieldValue,
4044
+ setValues,
4045
+ setErrors,
4046
+ setFieldError,
4047
+ setFieldTouched,
4048
+ setTouched,
4049
+ resetForm,
4050
+ handleSubmit,
4051
+ stageInitialValue,
4052
+ unsetInitialValue,
4053
+ setFieldInitialValue,
4054
+ };
4055
+ function isFieldGroup(fieldOrGroup) {
4056
+ return Array.isArray(fieldOrGroup);
4057
+ }
4058
+ function applyFieldMutation(fieldOrGroup, mutation) {
4059
+ if (Array.isArray(fieldOrGroup)) {
4060
+ return fieldOrGroup.forEach(mutation);
4061
+ }
4062
+ return mutation(fieldOrGroup);
4063
+ }
4064
+ function mutateAllFields(mutation) {
4065
+ Object.values(fieldsByPath.value).forEach(field => {
4066
+ if (!field) {
4067
+ return;
4068
+ }
4069
+ // avoid resetting the field values, because they should've been reset already.
4070
+ applyFieldMutation(field, mutation);
4071
+ });
4072
+ }
4073
+ /**
4074
+ * Manually sets an error message on a specific field
4075
+ */
4076
+ function setFieldError(field, message) {
4077
+ setFieldErrorBag(field, message);
4078
+ }
4079
+ /**
4080
+ * Sets errors for the fields specified in the object
4081
+ */
4082
+ function setErrors(fields) {
4083
+ setErrorBag(fields);
4084
+ }
4085
+ /**
4086
+ * Sets a single field value
4087
+ */
4088
+ function setFieldValue(field, value, { force } = { force: false }) {
4089
+ var _a;
4090
+ const fieldInstance = fieldsByPath.value[field];
4091
+ const clonedValue = klona(value);
4092
+ // field wasn't found, create a virtual field as a placeholder
4093
+ if (!fieldInstance) {
4094
+ setInPath(formValues, field, clonedValue);
4095
+ return;
4096
+ }
4097
+ if (isFieldGroup(fieldInstance) && ((_a = fieldInstance[0]) === null || _a === void 0 ? void 0 : _a.type) === 'checkbox' && !Array.isArray(value)) {
4098
+ // Multiple checkboxes, and only one of them got updated
4099
+ const newValue = klona(resolveNextCheckboxValue(getFromPath(formValues, field) || [], value, undefined));
4100
+ setInPath(formValues, field, newValue);
4101
+ return;
4102
+ }
4103
+ let newValue = value;
4104
+ // Single Checkbox: toggles the field value unless the field is being reset then force it
4105
+ if (!isFieldGroup(fieldInstance) && fieldInstance.type === 'checkbox' && !force && !RESET_LOCK) {
4106
+ newValue = klona(resolveNextCheckboxValue(getFromPath(formValues, field), value, unref(fieldInstance.uncheckedValue)));
4107
+ }
4108
+ setInPath(formValues, field, newValue);
4109
+ }
4110
+ /**
4111
+ * Sets multiple fields values
4112
+ */
4113
+ function setValues(fields) {
4114
+ // clean up old values
4115
+ keysOf(formValues).forEach(key => {
4116
+ delete formValues[key];
4117
+ });
4118
+ // set up new values
4119
+ keysOf(fields).forEach(path => {
4120
+ setFieldValue(path, fields[path]);
4121
+ });
4122
+ // regenerate the arrays when the form values change
4123
+ Object.values(fieldArraysLookup).forEach(f => f && f.reset());
4124
+ }
4125
+ /**
4126
+ * Sets the touched meta state on a field
4127
+ */
4128
+ function setFieldTouched(field, isTouched) {
4129
+ const fieldInstance = fieldsByPath.value[field];
4130
+ if (fieldInstance) {
4131
+ applyFieldMutation(fieldInstance, f => f.setTouched(isTouched));
4132
+ }
4133
+ }
4134
+ /**
4135
+ * Sets the touched meta state on multiple fields
4136
+ */
4137
+ function setTouched(fields) {
4138
+ keysOf(fields).forEach(field => {
4139
+ setFieldTouched(field, !!fields[field]);
4140
+ });
4141
+ }
4142
+ /**
4143
+ * Resets all fields
4144
+ */
4145
+ function resetForm(state) {
4146
+ RESET_LOCK = true;
4147
+ // set initial values if provided
4148
+ if (state === null || state === void 0 ? void 0 : state.values) {
4149
+ setInitialValues(state.values);
4150
+ setValues(state === null || state === void 0 ? void 0 : state.values);
4151
+ }
4152
+ else {
4153
+ // clean up the initial values back to the original
4154
+ setInitialValues(originalInitialValues.value);
4155
+ // otherwise clean the current values
4156
+ setValues(originalInitialValues.value);
4157
+ }
4158
+ // avoid resetting the field values, because they should've been reset already.
4159
+ mutateAllFields(f => f.resetField());
4160
+ if (state === null || state === void 0 ? void 0 : state.touched) {
4161
+ setTouched(state.touched);
4162
+ }
4163
+ setErrors((state === null || state === void 0 ? void 0 : state.errors) || {});
4164
+ submitCount.value = (state === null || state === void 0 ? void 0 : state.submitCount) || 0;
4165
+ nextTick(() => {
4166
+ RESET_LOCK = false;
4167
+ });
4168
+ }
4169
+ function insertFieldAtPath(field, path) {
4170
+ const rawField = markRaw(field);
4171
+ const fieldPath = path;
4172
+ // first field at that path
4173
+ if (!fieldsByPath.value[fieldPath]) {
4174
+ fieldsByPath.value[fieldPath] = rawField;
4175
+ return;
4176
+ }
4177
+ const fieldAtPath = fieldsByPath.value[fieldPath];
4178
+ if (fieldAtPath && !Array.isArray(fieldAtPath)) {
4179
+ fieldsByPath.value[fieldPath] = [fieldAtPath];
4180
+ }
4181
+ // add the new array to that path
4182
+ fieldsByPath.value[fieldPath] = [...fieldsByPath.value[fieldPath], rawField];
4183
+ }
4184
+ function removeFieldFromPath(field, path) {
4185
+ const fieldPath = path;
4186
+ const fieldAtPath = fieldsByPath.value[fieldPath];
4187
+ if (!fieldAtPath) {
4188
+ return;
4189
+ }
4190
+ // same field at path
4191
+ if (!isFieldGroup(fieldAtPath) && field.id === fieldAtPath.id) {
4192
+ delete fieldsByPath.value[fieldPath];
4193
+ return;
4194
+ }
4195
+ if (isFieldGroup(fieldAtPath)) {
4196
+ const idx = fieldAtPath.findIndex(f => f.id === field.id);
4197
+ if (idx === -1) {
4198
+ return;
4199
+ }
4200
+ fieldAtPath.splice(idx, 1);
4201
+ if (fieldAtPath.length === 1) {
4202
+ fieldsByPath.value[fieldPath] = fieldAtPath[0];
4203
+ return;
4204
+ }
4205
+ if (!fieldAtPath.length) {
4206
+ delete fieldsByPath.value[fieldPath];
4207
+ }
4208
+ }
4209
+ }
4210
+ function registerField(field) {
4211
+ const fieldPath = unref(field.name);
4212
+ insertFieldAtPath(field, fieldPath);
4213
+ if (isRef(field.name)) {
4214
+ // ensures when a field's name was already taken that it preserves its same value
4215
+ // necessary for fields generated by loops
4216
+ watch(field.name, async (newPath, oldPath) => {
4217
+ // cache the value
4218
+ await nextTick();
4219
+ removeFieldFromPath(field, oldPath);
4220
+ insertFieldAtPath(field, newPath);
4221
+ // re-validate if either path had errors before
4222
+ if (errors.value[oldPath] || errors.value[newPath]) {
4223
+ // clear up both paths errors
4224
+ setFieldError(oldPath, undefined);
4225
+ validateField(newPath);
4226
+ }
4227
+ // clean up the old path if no other field is sharing that name
4228
+ // #3325
4229
+ await nextTick();
4230
+ if (!fieldExists(oldPath)) {
4231
+ unsetPath(formValues, oldPath);
4232
+ }
4233
+ });
4234
+ }
4235
+ // if field already had errors (initial errors) that's not user-set, validate it again to ensure state is correct
4236
+ // the difference being that `initialErrors` will contain the error message while other errors (pre-validated schema) won't have them as initial errors
4237
+ // #3342
4238
+ const initialErrorMessage = unref(field.errorMessage);
4239
+ if (initialErrorMessage && (initialErrors === null || initialErrors === void 0 ? void 0 : initialErrors[fieldPath]) !== initialErrorMessage) {
4240
+ validateField(fieldPath);
4241
+ }
4242
+ // marks the initial error as "consumed" so it won't be matched later with same non-initial error
4243
+ delete initialErrors[fieldPath];
4244
+ }
4245
+ function unregisterField(field) {
4246
+ const fieldName = unref(field.name);
4247
+ removeFieldFromPath(field, fieldName);
4248
+ nextTick(() => {
4249
+ // clears a field error on unmounted
4250
+ // we wait till next tick to make sure if the field is completely removed and doesn't have any siblings like checkboxes
4251
+ // #3384
4252
+ if (!fieldExists(fieldName)) {
4253
+ setFieldError(fieldName, undefined);
4254
+ unsetPath(formValues, fieldName);
4255
+ }
4256
+ });
4257
+ }
4258
+ async function validate(opts) {
4259
+ mutateAllFields(f => (f.meta.validated = true));
4260
+ if (formCtx.validateSchema) {
4261
+ return formCtx.validateSchema((opts === null || opts === void 0 ? void 0 : opts.mode) || 'force');
4262
+ }
4263
+ // No schema, each field is responsible to validate itself
4264
+ const validations = await Promise.all(Object.values(fieldsByPath.value).map(field => {
4265
+ const fieldInstance = Array.isArray(field) ? field[0] : field;
4266
+ if (!fieldInstance) {
4267
+ return Promise.resolve({ key: '', valid: true, errors: [] });
4268
+ }
4269
+ return fieldInstance.validate(opts).then((result) => {
4270
+ return {
4271
+ key: unref(fieldInstance.name),
4272
+ valid: result.valid,
4273
+ errors: result.errors,
4274
+ };
4275
+ });
4276
+ }));
4277
+ const results = {};
4278
+ const errors = {};
4279
+ for (const validation of validations) {
4280
+ results[validation.key] = {
4281
+ valid: validation.valid,
4282
+ errors: validation.errors,
4283
+ };
4284
+ if (validation.errors.length) {
4285
+ errors[validation.key] = validation.errors[0];
4286
+ }
4287
+ }
4288
+ return {
4289
+ valid: validations.every(r => r.valid),
4290
+ results,
4291
+ errors,
4292
+ };
4293
+ }
4294
+ async function validateField(field) {
4295
+ const fieldInstance = fieldsByPath.value[field];
4296
+ if (!fieldInstance) {
4297
+ warn$1(`field with name ${field} was not found`);
4298
+ return Promise.resolve({ errors: [], valid: true });
4299
+ }
4300
+ if (Array.isArray(fieldInstance)) {
4301
+ return fieldInstance.map(f => f.validate())[0];
4302
+ }
4303
+ return fieldInstance.validate();
4304
+ }
4305
+ function handleSubmit(fn, onValidationError) {
4306
+ return function submissionHandler(e) {
4307
+ if (e instanceof Event) {
4308
+ e.preventDefault();
4309
+ e.stopPropagation();
4310
+ }
4311
+ // Touch all fields
4312
+ setTouched(keysOf(fieldsByPath.value).reduce((acc, field) => {
4313
+ acc[field] = true;
4314
+ return acc;
4315
+ }, {}));
4316
+ isSubmitting.value = true;
4317
+ submitCount.value++;
4318
+ return validate()
4319
+ .then(result => {
4320
+ if (result.valid && typeof fn === 'function') {
4321
+ return fn(klona(formValues), {
4322
+ evt: e,
4323
+ setErrors,
4324
+ setFieldError,
4325
+ setTouched,
4326
+ setFieldTouched,
4327
+ setValues,
4328
+ setFieldValue,
4329
+ resetForm,
4330
+ });
4331
+ }
4332
+ if (!result.valid && typeof onValidationError === 'function') {
4333
+ onValidationError({
4334
+ values: klona(formValues),
4335
+ evt: e,
4336
+ errors: result.errors,
4337
+ results: result.results,
4338
+ });
4339
+ }
4340
+ })
4341
+ .then(returnVal => {
4342
+ isSubmitting.value = false;
4343
+ return returnVal;
4344
+ }, err => {
4345
+ isSubmitting.value = false;
4346
+ // re-throw the err so it doesn't go silent
4347
+ throw err;
4348
+ });
4349
+ };
4350
+ }
4351
+ function setFieldInitialValue(path, value) {
4352
+ setInPath(initialValues.value, path, klona(value));
4353
+ }
4354
+ function unsetInitialValue(path) {
4355
+ unsetPath(initialValues.value, path);
4356
+ }
4357
+ /**
4358
+ * Sneaky function to set initial field values
4359
+ */
4360
+ function stageInitialValue(path, value) {
4361
+ setInPath(formValues, path, value);
4362
+ setFieldInitialValue(path, value);
4363
+ }
4364
+ async function _validateSchema() {
4365
+ const schemaValue = unref(schema);
4366
+ if (!schemaValue) {
4367
+ return { valid: true, results: {}, errors: {} };
4368
+ }
4369
+ const formResult = isYupValidator(schemaValue)
4370
+ ? await validateYupSchema(schemaValue, formValues)
4371
+ : await validateObjectSchema(schemaValue, formValues, {
4372
+ names: fieldNames.value,
4373
+ bailsMap: fieldBailsMap.value,
4374
+ });
4375
+ return formResult;
4376
+ }
4377
+ /**
4378
+ * Batches validation runs in 5ms batches
4379
+ */
4380
+ const debouncedSchemaValidation = debounceAsync(_validateSchema, 5);
4381
+ async function validateSchema(mode) {
4382
+ const formResult = await debouncedSchemaValidation();
4383
+ // fields by id lookup
4384
+ const fieldsById = formCtx.fieldsByPath.value || {};
4385
+ // errors fields names, we need it to also check if custom errors are updated
4386
+ const currentErrorsPaths = keysOf(formCtx.errorBag.value);
4387
+ // collect all the keys from the schema and all fields
4388
+ // this ensures we have a complete keymap of all the fields
4389
+ const paths = [
4390
+ ...new Set([...keysOf(formResult.results), ...keysOf(fieldsById), ...currentErrorsPaths]),
4391
+ ];
4392
+ // aggregates the paths into a single result object while applying the results on the fields
4393
+ return paths.reduce((validation, path) => {
4394
+ const field = fieldsById[path];
4395
+ const messages = (formResult.results[path] || { errors: [] }).errors;
4396
+ const fieldResult = {
4397
+ errors: messages,
4398
+ valid: !messages.length,
4399
+ };
4400
+ validation.results[path] = fieldResult;
4401
+ if (!fieldResult.valid) {
4402
+ validation.errors[path] = fieldResult.errors[0];
4403
+ }
4404
+ // field not rendered
4405
+ if (!field) {
4406
+ setFieldError(path, messages);
4407
+ return validation;
4408
+ }
4409
+ // always update the valid flag regardless of the mode
4410
+ applyFieldMutation(field, f => (f.meta.valid = fieldResult.valid));
4411
+ if (mode === 'silent') {
4412
+ return validation;
4413
+ }
4414
+ const wasValidated = Array.isArray(field) ? field.some(f => f.meta.validated) : field.meta.validated;
4415
+ if (mode === 'validated-only' && !wasValidated) {
4416
+ return validation;
4417
+ }
4418
+ applyFieldMutation(field, f => f.setState({ errors: fieldResult.errors }));
4419
+ return validation;
4420
+ }, { valid: formResult.valid, results: {}, errors: {} });
4421
+ }
4422
+ const submitForm = handleSubmit((_, { evt }) => {
4423
+ if (isFormSubmitEvent(evt)) {
4424
+ evt.target.submit();
4425
+ }
4426
+ });
4427
+ // Trigger initial validation
4428
+ onMounted(() => {
4429
+ if (opts === null || opts === void 0 ? void 0 : opts.initialErrors) {
4430
+ setErrors(opts.initialErrors);
4431
+ }
4432
+ if (opts === null || opts === void 0 ? void 0 : opts.initialTouched) {
4433
+ setTouched(opts.initialTouched);
4434
+ }
4435
+ // if validate on mount was enabled
4436
+ if (opts === null || opts === void 0 ? void 0 : opts.validateOnMount) {
4437
+ validate();
4438
+ return;
4439
+ }
4440
+ // otherwise run initial silent validation through schema if available
4441
+ // the useField should skip their own silent validation if a yup schema is present
4442
+ if (formCtx.validateSchema) {
4443
+ formCtx.validateSchema('silent');
4444
+ }
4445
+ });
4446
+ if (isRef(schema)) {
4447
+ watch(schema, () => {
4448
+ var _a;
4449
+ (_a = formCtx.validateSchema) === null || _a === void 0 ? void 0 : _a.call(formCtx, 'validated-only');
4450
+ });
4451
+ }
4452
+ // Provide injections
4453
+ provide(FormContextKey, formCtx);
4454
+ if (("production" !== 'production')) {
4455
+ registerFormWithDevTools(formCtx);
4456
+ watch(() => (Object.assign(Object.assign({ errors: errorBag.value }, meta.value), { values: formValues, isSubmitting: isSubmitting.value, submitCount: submitCount.value })), refreshInspector, {
4457
+ deep: true,
4458
+ });
4459
+ }
4460
+ return {
4461
+ errors,
4462
+ meta,
4463
+ values: formValues,
4464
+ isSubmitting,
4465
+ submitCount,
4466
+ validate,
4467
+ validateField,
4468
+ handleReset: () => resetForm(),
4469
+ resetForm,
4470
+ handleSubmit,
4471
+ submitForm,
4472
+ setFieldError,
4473
+ setErrors,
4474
+ setFieldValue,
4475
+ setValues,
4476
+ setFieldTouched,
4477
+ setTouched,
4478
+ };
4479
+ }
4480
+ /**
4481
+ * Manages form meta aggregation
4482
+ */
4483
+ function useFormMeta(fieldsByPath, currentValues, initialValues, errors) {
4484
+ const MERGE_STRATEGIES = {
4485
+ touched: 'some',
4486
+ pending: 'some',
4487
+ valid: 'every',
4488
+ };
4489
+ const isDirty = computed(() => {
4490
+ return !es6(currentValues, unref(initialValues));
4491
+ });
4492
+ function calculateFlags() {
4493
+ const fields = Object.values(fieldsByPath.value).flat(1).filter(Boolean);
4494
+ return keysOf(MERGE_STRATEGIES).reduce((acc, flag) => {
4495
+ const mergeMethod = MERGE_STRATEGIES[flag];
4496
+ acc[flag] = fields[mergeMethod](field => field.meta[flag]);
4497
+ return acc;
4498
+ }, {});
4499
+ }
4500
+ const flags = reactive(calculateFlags());
4501
+ watchEffect(() => {
4502
+ const value = calculateFlags();
4503
+ flags.touched = value.touched;
4504
+ flags.valid = value.valid;
4505
+ flags.pending = value.pending;
4506
+ });
4507
+ return computed(() => {
4508
+ return Object.assign(Object.assign({ initialValues: unref(initialValues) }, flags), { valid: flags.valid && !keysOf(errors.value).length, dirty: isDirty.value });
4509
+ });
4510
+ }
4511
+ /**
4512
+ * Manages the initial values prop
4513
+ */
4514
+ function useFormInitialValues(fields, formValues, providedValues) {
4515
+ // these are the mutable initial values as the fields are mounted/unmounted
4516
+ const initialValues = ref(klona(unref(providedValues)) || {});
4517
+ // these are the original initial value as provided by the user initially, they don't keep track of conditional fields
4518
+ // this is important because some conditional fields will overwrite the initial values for other fields who had the same name
4519
+ // like array fields, any push/insert operation will overwrite the initial values because they "create new fields"
4520
+ // so these are the values that the reset function should use
4521
+ // these only change when the user explicitly chanegs the initial values or when the user resets them with new values.
4522
+ const originalInitialValues = ref(klona(unref(providedValues)) || {});
4523
+ function setInitialValues(values, updateFields = false) {
4524
+ initialValues.value = klona(values);
4525
+ originalInitialValues.value = klona(values);
4526
+ if (!updateFields) {
4527
+ return;
4528
+ }
4529
+ // update the pristine non-touched fields
4530
+ // those are excluded because it's unlikely you want to change the form values using initial values
4531
+ // we mostly watch them for API population or newly inserted fields
4532
+ // 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
4533
+ keysOf(fields.value).forEach(fieldPath => {
4534
+ const field = fields.value[fieldPath];
4535
+ const wasTouched = Array.isArray(field) ? field.some(f => f.meta.touched) : field === null || field === void 0 ? void 0 : field.meta.touched;
4536
+ if (!field || wasTouched) {
4537
+ return;
4538
+ }
4539
+ const newValue = getFromPath(initialValues.value, fieldPath);
4540
+ setInPath(formValues, fieldPath, klona(newValue));
4541
+ });
4542
+ }
4543
+ if (isRef(providedValues)) {
4544
+ watch(providedValues, value => {
4545
+ setInitialValues(value, true);
4546
+ }, {
4547
+ deep: true,
4548
+ });
4549
+ }
4550
+ return {
4551
+ initialValues,
4552
+ originalInitialValues,
4553
+ setInitialValues,
4554
+ };
4555
+ }
4556
+ function useErrorBag(initialErrors) {
4557
+ const errorBag = ref({});
4558
+ function normalizeErrorItem(message) {
4559
+ return Array.isArray(message) ? message : message ? [message] : [];
4560
+ }
4561
+ /**
4562
+ * Manually sets an error message on a specific field
4563
+ */
4564
+ function setFieldErrorBag(field, message) {
4565
+ if (!message) {
4566
+ delete errorBag.value[field];
4567
+ return;
4568
+ }
4569
+ errorBag.value[field] = normalizeErrorItem(message);
4570
+ }
4571
+ /**
4572
+ * Sets errors for the fields specified in the object
4573
+ */
4574
+ function setErrorBag(fields) {
4575
+ errorBag.value = keysOf(fields).reduce((acc, key) => {
4576
+ const message = fields[key];
4577
+ if (message) {
4578
+ acc[key] = normalizeErrorItem(message);
4579
+ }
4580
+ return acc;
4581
+ }, {});
4582
+ }
4583
+ if (initialErrors) {
4584
+ setErrorBag(initialErrors);
4585
+ }
4586
+ return {
4587
+ errorBag,
4588
+ setErrorBag,
4589
+ setFieldErrorBag,
4590
+ };
4591
+ }
4592
+
4593
+ const FormImpl = defineComponent({
4594
+ name: 'Form',
4595
+ inheritAttrs: false,
4596
+ props: {
4597
+ as: {
4598
+ type: String,
4599
+ default: 'form',
4600
+ },
4601
+ validationSchema: {
4602
+ type: Object,
4603
+ default: undefined,
4604
+ },
4605
+ initialValues: {
4606
+ type: Object,
4607
+ default: undefined,
4608
+ },
4609
+ initialErrors: {
4610
+ type: Object,
4611
+ default: undefined,
4612
+ },
4613
+ initialTouched: {
4614
+ type: Object,
4615
+ default: undefined,
4616
+ },
4617
+ validateOnMount: {
4618
+ type: Boolean,
4619
+ default: false,
4620
+ },
4621
+ onSubmit: {
4622
+ type: Function,
4623
+ default: undefined,
4624
+ },
4625
+ onInvalidSubmit: {
4626
+ type: Function,
4627
+ default: undefined,
4628
+ },
4629
+ },
4630
+ setup(props, ctx) {
4631
+ const initialValues = toRef(props, 'initialValues');
4632
+ const validationSchema = toRef(props, 'validationSchema');
4633
+ const { errors, values, meta, isSubmitting, submitCount, validate, validateField, handleReset, resetForm, handleSubmit, submitForm, setErrors, setFieldError, setFieldValue, setValues, setFieldTouched, setTouched, } = useForm({
4634
+ validationSchema: validationSchema.value ? validationSchema : undefined,
4635
+ initialValues,
4636
+ initialErrors: props.initialErrors,
4637
+ initialTouched: props.initialTouched,
4638
+ validateOnMount: props.validateOnMount,
4639
+ });
4640
+ const onSubmit = props.onSubmit ? handleSubmit(props.onSubmit, props.onInvalidSubmit) : submitForm;
4641
+ function handleFormReset(e) {
4642
+ if (isEvent(e)) {
4643
+ // Prevent default form reset behavior
4644
+ e.preventDefault();
4645
+ }
4646
+ handleReset();
4647
+ if (typeof ctx.attrs.onReset === 'function') {
4648
+ ctx.attrs.onReset();
4649
+ }
4650
+ }
4651
+ function handleScopedSlotSubmit(evt, onSubmit) {
4652
+ const onSuccess = typeof evt === 'function' && !onSubmit ? evt : onSubmit;
4653
+ return handleSubmit(onSuccess, props.onInvalidSubmit)(evt);
4654
+ }
4655
+ function slotProps() {
4656
+ return {
4657
+ meta: meta.value,
4658
+ errors: errors.value,
4659
+ values: values,
4660
+ isSubmitting: isSubmitting.value,
4661
+ submitCount: submitCount.value,
4662
+ validate,
4663
+ validateField,
4664
+ handleSubmit: handleScopedSlotSubmit,
4665
+ handleReset,
4666
+ submitForm,
4667
+ setErrors,
4668
+ setFieldError,
4669
+ setFieldValue,
4670
+ setValues,
4671
+ setFieldTouched,
4672
+ setTouched,
4673
+ resetForm,
4674
+ };
4675
+ }
4676
+ // expose these functions and methods as part of public API
4677
+ ctx.expose({
4678
+ setFieldError,
4679
+ setErrors,
4680
+ setFieldValue,
4681
+ setValues,
4682
+ setFieldTouched,
4683
+ setTouched,
4684
+ resetForm,
4685
+ validate,
4686
+ validateField,
4687
+ });
4688
+ return function renderForm() {
4689
+ // avoid resolving the form component as itself
4690
+ const tag = props.as === 'form' ? props.as : resolveDynamicComponent(props.as);
4691
+ const children = normalizeChildren(tag, ctx, slotProps);
4692
+ if (!props.as) {
4693
+ return children;
4694
+ }
4695
+ // Attributes to add on a native `form` tag
4696
+ const formAttrs = props.as === 'form'
4697
+ ? {
4698
+ // Disables native validation as vee-validate will handle it.
4699
+ novalidate: true,
4700
+ }
4701
+ : {};
4702
+ return h(tag, Object.assign(Object.assign(Object.assign({}, formAttrs), ctx.attrs), { onSubmit, onReset: handleFormReset }), children);
4703
+ };
4704
+ },
4705
+ });
4706
+ const Form = FormImpl;
4707
+
4708
+ let FIELD_ARRAY_COUNTER = 0;
4709
+ function useFieldArray(arrayPath) {
4710
+ const id = FIELD_ARRAY_COUNTER++;
4711
+ const form = injectWithSelf(FormContextKey, undefined);
4712
+ const fields = ref([]);
4713
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
4714
+ const noOp = () => { };
4715
+ const noOpApi = {
4716
+ fields: readonly(fields),
4717
+ remove: noOp,
4718
+ push: noOp,
4719
+ swap: noOp,
4720
+ insert: noOp,
4721
+ update: noOp,
4722
+ replace: noOp,
4723
+ prepend: noOp,
4724
+ };
4725
+ if (!form) {
4726
+ warn('FieldArray requires being a child of `<Form/>` or `useForm` being called before it. Array fields may not work correctly');
4727
+ return noOpApi;
4728
+ }
4729
+ if (!unref(arrayPath)) {
4730
+ warn('FieldArray requires a field path to be provided, did you forget to pass the `name` prop?');
4731
+ return noOpApi;
4732
+ }
4733
+ let entryCounter = 0;
4734
+ function initFields() {
4735
+ const currentValues = getFromPath(form === null || form === void 0 ? void 0 : form.values, unref(arrayPath), []);
4736
+ fields.value = currentValues.map(createEntry);
4737
+ updateEntryFlags();
4738
+ }
4739
+ initFields();
4740
+ function updateEntryFlags() {
4741
+ const fieldsLength = fields.value.length;
4742
+ for (let i = 0; i < fieldsLength; i++) {
4743
+ const entry = fields.value[i];
4744
+ entry.isFirst = i === 0;
4745
+ entry.isLast = i === fieldsLength - 1;
4746
+ }
4747
+ }
4748
+ function createEntry(value) {
4749
+ const key = entryCounter++;
4750
+ const entry = {
4751
+ key,
4752
+ value: computed(() => {
4753
+ const currentValues = getFromPath(form === null || form === void 0 ? void 0 : form.values, unref(arrayPath), []);
4754
+ const idx = fields.value.findIndex(e => e.key === key);
4755
+ return idx === -1 ? value : currentValues[idx];
4756
+ }),
4757
+ isFirst: false,
4758
+ isLast: false,
4759
+ };
4760
+ return entry;
4761
+ }
4762
+ function remove(idx) {
4763
+ const pathName = unref(arrayPath);
4764
+ const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
4765
+ if (!pathValue || !Array.isArray(pathValue)) {
4766
+ return;
4767
+ }
4768
+ const newValue = [...pathValue];
4769
+ newValue.splice(idx, 1);
4770
+ form === null || form === void 0 ? void 0 : form.unsetInitialValue(pathName + `[${idx}]`);
4771
+ form === null || form === void 0 ? void 0 : form.setFieldValue(pathName, newValue);
4772
+ fields.value.splice(idx, 1);
4773
+ updateEntryFlags();
4774
+ }
4775
+ function push(value) {
4776
+ const pathName = unref(arrayPath);
4777
+ const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
4778
+ const normalizedPathValue = isNullOrUndefined(pathValue) ? [] : pathValue;
4779
+ if (!Array.isArray(normalizedPathValue)) {
4780
+ return;
4781
+ }
4782
+ const newValue = [...normalizedPathValue];
4783
+ newValue.push(value);
4784
+ form === null || form === void 0 ? void 0 : form.stageInitialValue(pathName + `[${newValue.length - 1}]`, value);
4785
+ form === null || form === void 0 ? void 0 : form.setFieldValue(pathName, newValue);
4786
+ fields.value.push(createEntry(value));
4787
+ updateEntryFlags();
4788
+ }
4789
+ function swap(indexA, indexB) {
4790
+ const pathName = unref(arrayPath);
4791
+ const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
4792
+ if (!Array.isArray(pathValue) || !(indexA in pathValue) || !(indexB in pathValue)) {
4793
+ return;
4794
+ }
4795
+ const newValue = [...pathValue];
4796
+ const newFields = [...fields.value];
4797
+ // the old switcheroo
4798
+ const temp = newValue[indexA];
4799
+ newValue[indexA] = newValue[indexB];
4800
+ newValue[indexB] = temp;
4801
+ const tempEntry = newFields[indexA];
4802
+ newFields[indexA] = newFields[indexB];
4803
+ newFields[indexB] = tempEntry;
4804
+ form === null || form === void 0 ? void 0 : form.setFieldValue(pathName, newValue);
4805
+ fields.value = newFields;
4806
+ updateEntryFlags();
4807
+ }
4808
+ function insert(idx, value) {
4809
+ const pathName = unref(arrayPath);
4810
+ const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
4811
+ if (!Array.isArray(pathValue) || pathValue.length < idx) {
4812
+ return;
4813
+ }
4814
+ const newValue = [...pathValue];
4815
+ const newFields = [...fields.value];
4816
+ newValue.splice(idx, 0, value);
4817
+ newFields.splice(idx, 0, createEntry(value));
4818
+ form === null || form === void 0 ? void 0 : form.setFieldValue(pathName, newValue);
4819
+ fields.value = newFields;
4820
+ updateEntryFlags();
4821
+ }
4822
+ function replace(arr) {
4823
+ const pathName = unref(arrayPath);
4824
+ form === null || form === void 0 ? void 0 : form.setFieldValue(pathName, arr);
4825
+ initFields();
4826
+ }
4827
+ function update(idx, value) {
4828
+ const pathName = unref(arrayPath);
4829
+ const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
4830
+ if (!Array.isArray(pathValue) || pathValue.length - 1 < idx) {
4831
+ return;
4832
+ }
4833
+ form === null || form === void 0 ? void 0 : form.setFieldValue(`${pathName}[${idx}]`, value);
4834
+ }
4835
+ function prepend(value) {
4836
+ const pathName = unref(arrayPath);
4837
+ const pathValue = getFromPath(form === null || form === void 0 ? void 0 : form.values, pathName);
4838
+ const normalizedPathValue = isNullOrUndefined(pathValue) ? [] : pathValue;
4839
+ if (!Array.isArray(normalizedPathValue)) {
4840
+ return;
4841
+ }
4842
+ const newValue = [value, ...normalizedPathValue];
4843
+ form === null || form === void 0 ? void 0 : form.stageInitialValue(pathName + `[${newValue.length - 1}]`, value);
4844
+ form === null || form === void 0 ? void 0 : form.setFieldValue(pathName, newValue);
4845
+ fields.value.unshift(createEntry(value));
4846
+ updateEntryFlags();
4847
+ }
4848
+ form.fieldArraysLookup[id] = {
4849
+ reset: initFields,
4850
+ };
4851
+ onBeforeUnmount(() => {
4852
+ delete form.fieldArraysLookup[id];
4853
+ });
4854
+ return {
4855
+ fields: readonly(fields),
4856
+ remove,
4857
+ push,
4858
+ swap,
4859
+ insert,
4860
+ update,
4861
+ replace,
4862
+ prepend,
4863
+ };
4864
+ }
4865
+
4866
+ const FieldArrayImpl = defineComponent({
4867
+ name: 'FieldArray',
4868
+ inheritAttrs: false,
4869
+ props: {
4870
+ name: {
4871
+ type: String,
4872
+ required: true,
4873
+ },
4874
+ },
4875
+ setup(props, ctx) {
4876
+ const { push, remove, swap, insert, replace, update, prepend, fields } = useFieldArray(toRef(props, 'name'));
4877
+ function slotProps() {
4878
+ return {
4879
+ fields: fields.value,
4880
+ push,
4881
+ remove,
4882
+ swap,
4883
+ insert,
4884
+ update,
4885
+ replace,
4886
+ prepend,
4887
+ };
4888
+ }
4889
+ ctx.expose({
4890
+ push,
4891
+ remove,
4892
+ swap,
4893
+ insert,
4894
+ update,
4895
+ replace,
4896
+ prepend,
4897
+ });
4898
+ return () => {
4899
+ const children = normalizeChildren(undefined, ctx, slotProps);
4900
+ return children;
4901
+ };
4902
+ },
4903
+ });
4904
+ const FieldArray = FieldArrayImpl;
4905
+
4906
+ const ErrorMessageImpl = defineComponent({
4907
+ name: 'ErrorMessage',
4908
+ props: {
4909
+ as: {
4910
+ type: String,
4911
+ default: undefined,
4912
+ },
4913
+ name: {
4914
+ type: String,
4915
+ required: true,
4916
+ },
4917
+ },
4918
+ setup(props, ctx) {
4919
+ const form = inject(FormContextKey, undefined);
4920
+ const message = computed(() => {
4921
+ return form === null || form === void 0 ? void 0 : form.errors.value[props.name];
4922
+ });
4923
+ function slotProps() {
4924
+ return {
4925
+ message: message.value,
4926
+ };
4927
+ }
4928
+ return () => {
4929
+ // Renders nothing if there are no messages
4930
+ if (!message.value) {
4931
+ return undefined;
4932
+ }
4933
+ const tag = (props.as ? resolveDynamicComponent(props.as) : props.as);
4934
+ const children = normalizeChildren(tag, ctx, slotProps);
4935
+ const attrs = Object.assign({ role: 'alert' }, ctx.attrs);
4936
+ // If no tag was specified and there are children
4937
+ // render the slot as is without wrapping it
4938
+ if (!tag && (Array.isArray(children) || !children) && (children === null || children === void 0 ? void 0 : children.length)) {
4939
+ return children;
4940
+ }
4941
+ // If no children in slot
4942
+ // render whatever specified and fallback to a <span> with the message in it's contents
4943
+ if ((Array.isArray(children) || !children) && !(children === null || children === void 0 ? void 0 : children.length)) {
4944
+ return h(tag || 'span', attrs, message.value);
4945
+ }
4946
+ return h(tag, attrs, children);
4947
+ };
4948
+ },
4949
+ });
4950
+ const ErrorMessage = ErrorMessageImpl;
4951
+
4952
+ function useResetForm() {
4953
+ const form = injectWithSelf(FormContextKey);
4954
+ if (!form) {
4955
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
4956
+ }
4957
+ return function resetForm(state) {
4958
+ if (!form) {
4959
+ return;
4960
+ }
4961
+ return form.resetForm(state);
4962
+ };
4963
+ }
4964
+
4965
+ /**
4966
+ * If a field is dirty or not
4967
+ */
4968
+ function useIsFieldDirty(path) {
4969
+ const form = injectWithSelf(FormContextKey);
4970
+ let field = path ? undefined : inject(FieldContextKey);
4971
+ return computed(() => {
4972
+ if (path) {
4973
+ field = normalizeField(form === null || form === void 0 ? void 0 : form.fieldsByPath.value[unref(path)]);
4974
+ }
4975
+ if (!field) {
4976
+ warn(`field with name ${unref(path)} was not found`);
4977
+ return false;
4978
+ }
4979
+ return field.meta.dirty;
4980
+ });
4981
+ }
4982
+
4983
+ /**
4984
+ * If a field is touched or not
4985
+ */
4986
+ function useIsFieldTouched(path) {
4987
+ const form = injectWithSelf(FormContextKey);
4988
+ let field = path ? undefined : inject(FieldContextKey);
4989
+ return computed(() => {
4990
+ if (path) {
4991
+ field = normalizeField(form === null || form === void 0 ? void 0 : form.fieldsByPath.value[unref(path)]);
4992
+ }
4993
+ if (!field) {
4994
+ warn(`field with name ${unref(path)} was not found`);
4995
+ return false;
4996
+ }
4997
+ return field.meta.touched;
4998
+ });
4999
+ }
5000
+
5001
+ /**
5002
+ * If a field is validated and is valid
5003
+ */
5004
+ function useIsFieldValid(path) {
5005
+ const form = injectWithSelf(FormContextKey);
5006
+ let field = path ? undefined : inject(FieldContextKey);
5007
+ return computed(() => {
5008
+ if (path) {
5009
+ field = normalizeField(form === null || form === void 0 ? void 0 : form.fieldsByPath.value[unref(path)]);
5010
+ }
5011
+ if (!field) {
5012
+ warn(`field with name ${unref(path)} was not found`);
5013
+ return false;
5014
+ }
5015
+ return field.meta.valid;
5016
+ });
5017
+ }
5018
+
5019
+ /**
5020
+ * If the form is submitting or not
5021
+ */
5022
+ function useIsSubmitting() {
5023
+ const form = injectWithSelf(FormContextKey);
5024
+ if (!form) {
5025
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
5026
+ }
5027
+ return computed(() => {
5028
+ var _a;
5029
+ return (_a = form === null || form === void 0 ? void 0 : form.isSubmitting.value) !== null && _a !== void 0 ? _a : false;
5030
+ });
5031
+ }
5032
+
5033
+ /**
5034
+ * Validates a single field
5035
+ */
5036
+ function useValidateField(path) {
5037
+ const form = injectWithSelf(FormContextKey);
5038
+ let field = path ? undefined : inject(FieldContextKey);
5039
+ return function validateField() {
5040
+ if (path) {
5041
+ field = normalizeField(form === null || form === void 0 ? void 0 : form.fieldsByPath.value[unref(path)]);
5042
+ }
5043
+ if (!field) {
5044
+ warn(`field with name ${unref(path)} was not found`);
5045
+ return Promise.resolve({
5046
+ errors: [],
5047
+ valid: true,
5048
+ });
5049
+ }
5050
+ return field.validate();
5051
+ };
5052
+ }
5053
+
5054
+ /**
5055
+ * If the form is dirty or not
5056
+ */
5057
+ function useIsFormDirty() {
5058
+ const form = injectWithSelf(FormContextKey);
5059
+ if (!form) {
5060
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
5061
+ }
5062
+ return computed(() => {
5063
+ var _a;
5064
+ return (_a = form === null || form === void 0 ? void 0 : form.meta.value.dirty) !== null && _a !== void 0 ? _a : false;
5065
+ });
5066
+ }
5067
+
5068
+ /**
5069
+ * If the form is touched or not
5070
+ */
5071
+ function useIsFormTouched() {
5072
+ const form = injectWithSelf(FormContextKey);
5073
+ if (!form) {
5074
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
5075
+ }
5076
+ return computed(() => {
5077
+ var _a;
5078
+ return (_a = form === null || form === void 0 ? void 0 : form.meta.value.touched) !== null && _a !== void 0 ? _a : false;
5079
+ });
5080
+ }
5081
+
5082
+ /**
5083
+ * If the form has been validated and is valid
5084
+ */
5085
+ function useIsFormValid() {
5086
+ const form = injectWithSelf(FormContextKey);
5087
+ if (!form) {
5088
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
5089
+ }
5090
+ return computed(() => {
5091
+ var _a;
5092
+ return (_a = form === null || form === void 0 ? void 0 : form.meta.value.valid) !== null && _a !== void 0 ? _a : false;
5093
+ });
5094
+ }
5095
+
5096
+ /**
5097
+ * Validate multiple fields
5098
+ */
5099
+ function useValidateForm() {
5100
+ const form = injectWithSelf(FormContextKey);
5101
+ if (!form) {
5102
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
5103
+ }
5104
+ return function validateField() {
5105
+ if (!form) {
5106
+ return Promise.resolve({ results: {}, errors: {}, valid: true });
5107
+ }
5108
+ return form.validate();
5109
+ };
5110
+ }
5111
+
5112
+ /**
5113
+ * The number of form's submission count
5114
+ */
5115
+ function useSubmitCount() {
5116
+ const form = injectWithSelf(FormContextKey);
5117
+ if (!form) {
5118
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
5119
+ }
5120
+ return computed(() => {
5121
+ var _a;
5122
+ return (_a = form === null || form === void 0 ? void 0 : form.submitCount.value) !== null && _a !== void 0 ? _a : 0;
5123
+ });
5124
+ }
5125
+
5126
+ /**
5127
+ * Gives access to a field's current value
5128
+ */
5129
+ function useFieldValue(path) {
5130
+ const form = injectWithSelf(FormContextKey);
5131
+ // We don't want to use self injected context as it doesn't make sense
5132
+ const field = path ? undefined : inject(FieldContextKey);
5133
+ return computed(() => {
5134
+ if (path) {
5135
+ return getFromPath(form === null || form === void 0 ? void 0 : form.values, unref(path));
5136
+ }
5137
+ return unref(field === null || field === void 0 ? void 0 : field.value);
5138
+ });
5139
+ }
5140
+
5141
+ /**
5142
+ * Gives access to a form's values
5143
+ */
5144
+ function useFormValues() {
5145
+ const form = injectWithSelf(FormContextKey);
5146
+ if (!form) {
5147
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
5148
+ }
5149
+ return computed(() => {
5150
+ return (form === null || form === void 0 ? void 0 : form.values) || {};
5151
+ });
5152
+ }
5153
+
5154
+ /**
5155
+ * Gives access to all form errors
5156
+ */
5157
+ function useFormErrors() {
5158
+ const form = injectWithSelf(FormContextKey);
5159
+ if (!form) {
5160
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
5161
+ }
5162
+ return computed(() => {
5163
+ return ((form === null || form === void 0 ? void 0 : form.errors.value) || {});
5164
+ });
5165
+ }
5166
+
5167
+ /**
5168
+ * Gives access to a single field error
5169
+ */
5170
+ function useFieldError(path) {
5171
+ const form = injectWithSelf(FormContextKey);
5172
+ // We don't want to use self injected context as it doesn't make sense
5173
+ const field = path ? undefined : inject(FieldContextKey);
5174
+ return computed(() => {
5175
+ if (path) {
5176
+ return form === null || form === void 0 ? void 0 : form.errors.value[unref(path)];
5177
+ }
5178
+ return field === null || field === void 0 ? void 0 : field.errorMessage.value;
5179
+ });
5180
+ }
5181
+
5182
+ function useSubmitForm(cb) {
5183
+ const form = injectWithSelf(FormContextKey);
5184
+ if (!form) {
5185
+ warn('No vee-validate <Form /> or `useForm` was detected in the component tree');
5186
+ }
5187
+ const onSubmit = form ? form.handleSubmit(cb) : undefined;
5188
+ return function submitForm(e) {
5189
+ if (!onSubmit) {
5190
+ return;
5191
+ }
5192
+ return onSubmit(e);
5193
+ };
5194
+ }
5195
+
5196
+ var script = defineComponent({
5197
+ name: 'FwInput',
5198
+ emits: ['update:modelValue'],
5199
+ components: {
5200
+ InputField: Field
5201
+ },
5202
+ props: {
5203
+ /**
5204
+ * The input v-model
5205
+ */
5206
+ modelValue: {
5207
+ type: String,
5208
+ "default": ''
5209
+ },
5210
+
5211
+ /**
5212
+ * The name of the input field. Must be unique per form.
5213
+ */
5214
+ name: {
5215
+ type: String,
5216
+ required: true
5217
+ },
5218
+
5219
+ /**
5220
+ * The input type. Accepts `text` | `password`
5221
+ */
5222
+ type: {
5223
+ type: String,
5224
+ "default": 'text',
5225
+ validator: function validator(value) {
5226
+ return ['text', 'password'].includes(value);
5227
+ }
5228
+ },
5229
+
5230
+ /**
5231
+ * Label for the input. Also renders to an aria-label attribute
5232
+ */
5233
+ label: {
5234
+ type: String
5235
+ },
5236
+
5237
+ /**
5238
+ * The placeholder text of the input
5239
+ */
5240
+ placeholder: {
5241
+ type: String,
5242
+ "default": ''
5243
+ },
5244
+
5245
+ /**
5246
+ * Validation rules. Accepts a string, object, function or schema.
5247
+ */
5248
+ rules: {
5249
+ type: [String, Object, Function]
5250
+ }
5251
+ },
5252
+ setup: function setup(props, ctx) {
5253
+ var inputValue = computed({
5254
+ get: function get() {
5255
+ return props.modelValue;
5256
+ },
5257
+ set: function set(state) {
5258
+ return ctx.emit('update:modelValue', state);
5259
+ }
5260
+ });
5261
+ return {
5262
+ inputValue: inputValue
5263
+ };
5264
+ }
5265
+ });
5266
+
5267
+ var es_function_name = {};
5268
+
5269
+ var DESCRIPTORS = descriptors;
5270
+ var FUNCTION_NAME_EXISTS = functionName.EXISTS;
5271
+ var uncurryThis = functionUncurryThis;
5272
+ var defineProperty = objectDefineProperty.f;
5273
+
5274
+ var FunctionPrototype = Function.prototype;
5275
+ var functionToString = uncurryThis(FunctionPrototype.toString);
5276
+ var nameRE = /function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/;
5277
+ var regExpExec = uncurryThis(nameRE.exec);
5278
+ var NAME = 'name';
5279
+
5280
+ // Function instances `.name` property
5281
+ // https://tc39.es/ecma262/#sec-function-instances-name
5282
+ if (DESCRIPTORS && !FUNCTION_NAME_EXISTS) {
5283
+ defineProperty(FunctionPrototype, NAME, {
5284
+ configurable: true,
5285
+ get: function () {
5286
+ try {
5287
+ return regExpExec(nameRE, functionToString(this))[1];
5288
+ } catch (error) {
5289
+ return '';
5290
+ }
5291
+ }
5292
+ });
5293
+ }
5294
+
5295
+ var _hoisted_1 = {
5296
+ "class": "fw-input w-full"
5297
+ };
5298
+ var _hoisted_2 = {
5299
+ "class": "flex flex-col"
5300
+ };
5301
+ var _hoisted_3 = ["for"];
5302
+ var _hoisted_4 = {
5303
+ "class": "relative"
5304
+ };
5305
+ var _hoisted_5 = {
5306
+ key: 0,
5307
+ "class": "flex text-grey-base absolute w-9 h-full inset-y-0 left-0 items-center pl-3 pointer-events-none"
5308
+ };
5309
+ var _hoisted_6 = ["placeholder", "type"];
5310
+ var _hoisted_7 = {
5311
+ key: 0,
5312
+ "class": "flex text-error absolute w-9 h-full inset-y-0 right-0 items-center pr-3 pointer-events-none"
5313
+ };
5314
+
5315
+ var _hoisted_8 = /*#__PURE__*/createElementVNode("svg", {
5316
+ fill: "currentColor",
5317
+ "aria-hidden": "true",
5318
+ focusable: "false",
5319
+ role: "img",
5320
+ xmlns: "http://www.w3.org/2000/svg",
5321
+ viewBox: "0 0 512 512"
5322
+ }, [/*#__PURE__*/createElementVNode("path", {
5323
+ 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"
5324
+ })], -1);
5325
+
5326
+ var _hoisted_9 = [_hoisted_8];
5327
+ var _hoisted_10 = {
5328
+ "class": "text-error italic text-right text-sm font-medium mt-2 min-h-[21px]"
5329
+ };
5330
+ var _hoisted_11 = {
5331
+ key: 0
5332
+ };
5333
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
5334
+ var _component_InputField = resolveComponent("InputField");
5335
+
5336
+ return openBlock(), createElementBlock("div", _hoisted_1, [createVNode(_component_InputField, {
5337
+ modelValue: _ctx.inputValue,
5338
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) {
5339
+ return _ctx.inputValue = $event;
5340
+ }),
5341
+ name: _ctx.name,
5342
+ rules: _ctx.rules
5343
+ }, {
5344
+ "default": withCtx(function (_ref) {
5345
+ var field = _ref.field,
5346
+ errors = _ref.errors,
5347
+ errorMessage = _ref.errorMessage,
5348
+ meta = _ref.meta;
5349
+ return [createElementVNode("div", _hoisted_2, [_ctx.label ? (openBlock(), createElementBlock("label", {
5350
+ key: 0,
5351
+ "for": _ctx.name,
5352
+ "class": "block mb-2"
5353
+ }, toDisplayString(_ctx.label), 9, _hoisted_3)) : createCommentVNode("", true), createElementVNode("div", _hoisted_4, [_ctx.$slots.prefixIcon ? (openBlock(), createElementBlock("div", _hoisted_5, [renderSlot(_ctx.$slots, "prefixIcon")])) : createCommentVNode("", true), createElementVNode("input", mergeProps(field, {
5354
+ placeholder: _ctx.placeholder,
5355
+ type: _ctx.type,
5356
+ "class": ["border-2 border-grey-lightest rounded-lg focus:outline-none focus:ring-2 focus:ring-primary block w-full p-2.5", {
5357
+ 'pl-10': !!_ctx.$slots.prefixIcon
5358
+ }]
5359
+ }), null, 16, _hoisted_6), createVNode(Transition, {
5360
+ name: "errorFadeIn"
5361
+ }, {
5362
+ "default": withCtx(function () {
5363
+ return [(errorMessage || errors[0]) && meta.touched ? (openBlock(), createElementBlock("div", _hoisted_7, _hoisted_9)) : createCommentVNode("", true)];
5364
+ }),
5365
+ _: 2
5366
+ }, 1024)]), createElementVNode("div", _hoisted_10, [createVNode(Transition, {
5367
+ name: "errorFadeIn"
5368
+ }, {
5369
+ "default": withCtx(function () {
5370
+ return [(errorMessage || errors[0]) && meta.touched ? (openBlock(), createElementBlock("span", _hoisted_11, toDisplayString(errorMessage || errors[0]), 1)) : createCommentVNode("", true)];
5371
+ }),
5372
+ _: 2
5373
+ }, 1024)])])];
5374
+ }),
5375
+ _: 3
5376
+ }, 8, ["modelValue", "name", "rules"])]);
5377
+ }
5378
+
5379
+ 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}}";
5380
+ 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}}";
2054
5381
  styleInject(css_248z);
2055
5382
 
2056
5383
  script.render = render;
2057
5384
 
2058
5385
  var components = /*#__PURE__*/Object.freeze({
2059
5386
  __proto__: null,
2060
- FwCard: script$2,
2061
- FwButton: script$1,
2062
- FwNavigationMenu: script
5387
+ FwCard: script$3,
5388
+ FwButton: script$2,
5389
+ FwNavigationMenu: script$1,
5390
+ FwForm: Form,
5391
+ FwInput: script
2063
5392
  });
2064
5393
 
2065
5394
  var install = function install(app) {
@@ -2072,4 +5401,4 @@ var install = function install(app) {
2072
5401
  });
2073
5402
  };
2074
5403
 
2075
- export { script$1 as FwButton, script$2 as FwCard, script as FwNavigationMenu, install as default };
5404
+ export { script$2 as FwButton, script$3 as FwCard, Form as FwForm, script as FwInput, script$1 as FwNavigationMenu, install as default };