@remoteoss/json-schema-form 0.3.0-beta.0 → 0.4.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
3
  Copyright (c) 2023 Remote Technology, Inc.
4
- NPM Package: @remoteoss/json-schema-form@0.3.0-beta.0
5
- Generated: Wed, 21 Jun 2023 11:17:55 GMT
4
+ NPM Package: @remoteoss/json-schema-form@0.4.1-beta.0
5
+ Generated: Mon, 03 Jul 2023 22:21:10 GMT
6
6
 
7
7
  MIT License
8
8
 
@@ -3496,440 +3496,6 @@ var require_set = __commonJS({
3496
3496
  }
3497
3497
  });
3498
3498
 
3499
- // node_modules/synchronous-promise/index.js
3500
- var require_synchronous_promise = __commonJS({
3501
- "node_modules/synchronous-promise/index.js"(exports2, module2) {
3502
- "use strict";
3503
- function makeArrayFrom(obj) {
3504
- return Array.prototype.slice.apply(obj);
3505
- }
3506
- var PENDING = "pending";
3507
- var RESOLVED = "resolved";
3508
- var REJECTED = "rejected";
3509
- function SynchronousPromise4(handler) {
3510
- this.status = PENDING;
3511
- this._continuations = [];
3512
- this._parent = null;
3513
- this._paused = false;
3514
- if (handler) {
3515
- handler.call(
3516
- this,
3517
- this._continueWith.bind(this),
3518
- this._failWith.bind(this)
3519
- );
3520
- }
3521
- }
3522
- function looksLikeAPromise(obj) {
3523
- return obj && typeof obj.then === "function";
3524
- }
3525
- function passThrough(value) {
3526
- return value;
3527
- }
3528
- SynchronousPromise4.prototype = {
3529
- then: function(nextFn, catchFn) {
3530
- var next = SynchronousPromise4.unresolved()._setParent(this);
3531
- if (this._isRejected()) {
3532
- if (this._paused) {
3533
- this._continuations.push({
3534
- promise: next,
3535
- nextFn,
3536
- catchFn
3537
- });
3538
- return next;
3539
- }
3540
- if (catchFn) {
3541
- try {
3542
- var catchResult = catchFn(this._error);
3543
- if (looksLikeAPromise(catchResult)) {
3544
- this._chainPromiseData(catchResult, next);
3545
- return next;
3546
- } else {
3547
- return SynchronousPromise4.resolve(catchResult)._setParent(this);
3548
- }
3549
- } catch (e) {
3550
- return SynchronousPromise4.reject(e)._setParent(this);
3551
- }
3552
- }
3553
- return SynchronousPromise4.reject(this._error)._setParent(this);
3554
- }
3555
- this._continuations.push({
3556
- promise: next,
3557
- nextFn,
3558
- catchFn
3559
- });
3560
- this._runResolutions();
3561
- return next;
3562
- },
3563
- catch: function(handler) {
3564
- if (this._isResolved()) {
3565
- return SynchronousPromise4.resolve(this._data)._setParent(this);
3566
- }
3567
- var next = SynchronousPromise4.unresolved()._setParent(this);
3568
- this._continuations.push({
3569
- promise: next,
3570
- catchFn: handler
3571
- });
3572
- this._runRejections();
3573
- return next;
3574
- },
3575
- finally: function(callback) {
3576
- var ran = false;
3577
- function runFinally(result, err) {
3578
- if (!ran) {
3579
- ran = true;
3580
- if (!callback) {
3581
- callback = passThrough;
3582
- }
3583
- var callbackResult = callback(result);
3584
- if (looksLikeAPromise(callbackResult)) {
3585
- return callbackResult.then(function() {
3586
- if (err) {
3587
- throw err;
3588
- }
3589
- return result;
3590
- });
3591
- } else {
3592
- return result;
3593
- }
3594
- }
3595
- }
3596
- return this.then(function(result) {
3597
- return runFinally(result);
3598
- }).catch(function(err) {
3599
- return runFinally(null, err);
3600
- });
3601
- },
3602
- pause: function() {
3603
- this._paused = true;
3604
- return this;
3605
- },
3606
- resume: function() {
3607
- var firstPaused = this._findFirstPaused();
3608
- if (firstPaused) {
3609
- firstPaused._paused = false;
3610
- firstPaused._runResolutions();
3611
- firstPaused._runRejections();
3612
- }
3613
- return this;
3614
- },
3615
- _findAncestry: function() {
3616
- return this._continuations.reduce(function(acc, cur) {
3617
- if (cur.promise) {
3618
- var node = {
3619
- promise: cur.promise,
3620
- children: cur.promise._findAncestry()
3621
- };
3622
- acc.push(node);
3623
- }
3624
- return acc;
3625
- }, []);
3626
- },
3627
- _setParent: function(parent) {
3628
- if (this._parent) {
3629
- throw new Error("parent already set");
3630
- }
3631
- this._parent = parent;
3632
- return this;
3633
- },
3634
- _continueWith: function(data) {
3635
- var firstPending = this._findFirstPending();
3636
- if (firstPending) {
3637
- firstPending._data = data;
3638
- firstPending._setResolved();
3639
- }
3640
- },
3641
- _findFirstPending: function() {
3642
- return this._findFirstAncestor(function(test2) {
3643
- return test2._isPending && test2._isPending();
3644
- });
3645
- },
3646
- _findFirstPaused: function() {
3647
- return this._findFirstAncestor(function(test2) {
3648
- return test2._paused;
3649
- });
3650
- },
3651
- _findFirstAncestor: function(matching) {
3652
- var test2 = this;
3653
- var result;
3654
- while (test2) {
3655
- if (matching(test2)) {
3656
- result = test2;
3657
- }
3658
- test2 = test2._parent;
3659
- }
3660
- return result;
3661
- },
3662
- _failWith: function(error) {
3663
- var firstRejected = this._findFirstPending();
3664
- if (firstRejected) {
3665
- firstRejected._error = error;
3666
- firstRejected._setRejected();
3667
- }
3668
- },
3669
- _takeContinuations: function() {
3670
- return this._continuations.splice(0, this._continuations.length);
3671
- },
3672
- _runRejections: function() {
3673
- if (this._paused || !this._isRejected()) {
3674
- return;
3675
- }
3676
- var error = this._error, continuations = this._takeContinuations(), self2 = this;
3677
- continuations.forEach(function(cont) {
3678
- if (cont.catchFn) {
3679
- try {
3680
- var catchResult = cont.catchFn(error);
3681
- self2._handleUserFunctionResult(catchResult, cont.promise);
3682
- } catch (e) {
3683
- cont.promise.reject(e);
3684
- }
3685
- } else {
3686
- cont.promise.reject(error);
3687
- }
3688
- });
3689
- },
3690
- _runResolutions: function() {
3691
- if (this._paused || !this._isResolved() || this._isPending()) {
3692
- return;
3693
- }
3694
- var continuations = this._takeContinuations();
3695
- if (looksLikeAPromise(this._data)) {
3696
- return this._handleWhenResolvedDataIsPromise(this._data);
3697
- }
3698
- var data = this._data;
3699
- var self2 = this;
3700
- continuations.forEach(function(cont) {
3701
- if (cont.nextFn) {
3702
- try {
3703
- var result = cont.nextFn(data);
3704
- self2._handleUserFunctionResult(result, cont.promise);
3705
- } catch (e) {
3706
- self2._handleResolutionError(e, cont);
3707
- }
3708
- } else if (cont.promise) {
3709
- cont.promise.resolve(data);
3710
- }
3711
- });
3712
- },
3713
- _handleResolutionError: function(e, continuation) {
3714
- this._setRejected();
3715
- if (continuation.catchFn) {
3716
- try {
3717
- continuation.catchFn(e);
3718
- return;
3719
- } catch (e2) {
3720
- e = e2;
3721
- }
3722
- }
3723
- if (continuation.promise) {
3724
- continuation.promise.reject(e);
3725
- }
3726
- },
3727
- _handleWhenResolvedDataIsPromise: function(data) {
3728
- var self2 = this;
3729
- return data.then(function(result) {
3730
- self2._data = result;
3731
- self2._runResolutions();
3732
- }).catch(function(error) {
3733
- self2._error = error;
3734
- self2._setRejected();
3735
- self2._runRejections();
3736
- });
3737
- },
3738
- _handleUserFunctionResult: function(data, nextSynchronousPromise) {
3739
- if (looksLikeAPromise(data)) {
3740
- this._chainPromiseData(data, nextSynchronousPromise);
3741
- } else {
3742
- nextSynchronousPromise.resolve(data);
3743
- }
3744
- },
3745
- _chainPromiseData: function(promiseData, nextSynchronousPromise) {
3746
- promiseData.then(function(newData) {
3747
- nextSynchronousPromise.resolve(newData);
3748
- }).catch(function(newError) {
3749
- nextSynchronousPromise.reject(newError);
3750
- });
3751
- },
3752
- _setResolved: function() {
3753
- this.status = RESOLVED;
3754
- if (!this._paused) {
3755
- this._runResolutions();
3756
- }
3757
- },
3758
- _setRejected: function() {
3759
- this.status = REJECTED;
3760
- if (!this._paused) {
3761
- this._runRejections();
3762
- }
3763
- },
3764
- _isPending: function() {
3765
- return this.status === PENDING;
3766
- },
3767
- _isResolved: function() {
3768
- return this.status === RESOLVED;
3769
- },
3770
- _isRejected: function() {
3771
- return this.status === REJECTED;
3772
- }
3773
- };
3774
- SynchronousPromise4.resolve = function(result) {
3775
- return new SynchronousPromise4(function(resolve2, reject) {
3776
- if (looksLikeAPromise(result)) {
3777
- result.then(function(newResult) {
3778
- resolve2(newResult);
3779
- }).catch(function(error) {
3780
- reject(error);
3781
- });
3782
- } else {
3783
- resolve2(result);
3784
- }
3785
- });
3786
- };
3787
- SynchronousPromise4.reject = function(result) {
3788
- return new SynchronousPromise4(function(resolve2, reject) {
3789
- reject(result);
3790
- });
3791
- };
3792
- SynchronousPromise4.unresolved = function() {
3793
- return new SynchronousPromise4(function(resolve2, reject) {
3794
- this.resolve = resolve2;
3795
- this.reject = reject;
3796
- });
3797
- };
3798
- SynchronousPromise4.all = function() {
3799
- var args = makeArrayFrom(arguments);
3800
- if (Array.isArray(args[0])) {
3801
- args = args[0];
3802
- }
3803
- if (!args.length) {
3804
- return SynchronousPromise4.resolve([]);
3805
- }
3806
- return new SynchronousPromise4(function(resolve2, reject) {
3807
- var allData = [], numResolved = 0, doResolve = function() {
3808
- if (numResolved === args.length) {
3809
- resolve2(allData);
3810
- }
3811
- }, rejected = false, doReject = function(err) {
3812
- if (rejected) {
3813
- return;
3814
- }
3815
- rejected = true;
3816
- reject(err);
3817
- };
3818
- args.forEach(function(arg, idx) {
3819
- SynchronousPromise4.resolve(arg).then(function(thisResult) {
3820
- allData[idx] = thisResult;
3821
- numResolved += 1;
3822
- doResolve();
3823
- }).catch(function(err) {
3824
- doReject(err);
3825
- });
3826
- });
3827
- });
3828
- };
3829
- function createAggregateErrorFrom(errors) {
3830
- if (typeof window !== "undefined" && "AggregateError" in window) {
3831
- return new window.AggregateError(errors);
3832
- }
3833
- return { errors };
3834
- }
3835
- SynchronousPromise4.any = function() {
3836
- var args = makeArrayFrom(arguments);
3837
- if (Array.isArray(args[0])) {
3838
- args = args[0];
3839
- }
3840
- if (!args.length) {
3841
- return SynchronousPromise4.reject(createAggregateErrorFrom([]));
3842
- }
3843
- return new SynchronousPromise4(function(resolve2, reject) {
3844
- var allErrors = [], numRejected = 0, doReject = function() {
3845
- if (numRejected === args.length) {
3846
- reject(createAggregateErrorFrom(allErrors));
3847
- }
3848
- }, resolved = false, doResolve = function(result) {
3849
- if (resolved) {
3850
- return;
3851
- }
3852
- resolved = true;
3853
- resolve2(result);
3854
- };
3855
- args.forEach(function(arg, idx) {
3856
- SynchronousPromise4.resolve(arg).then(function(thisResult) {
3857
- doResolve(thisResult);
3858
- }).catch(function(err) {
3859
- allErrors[idx] = err;
3860
- numRejected += 1;
3861
- doReject();
3862
- });
3863
- });
3864
- });
3865
- };
3866
- SynchronousPromise4.allSettled = function() {
3867
- var args = makeArrayFrom(arguments);
3868
- if (Array.isArray(args[0])) {
3869
- args = args[0];
3870
- }
3871
- if (!args.length) {
3872
- return SynchronousPromise4.resolve([]);
3873
- }
3874
- return new SynchronousPromise4(function(resolve2) {
3875
- var allData = [], numSettled = 0, doSettled = function() {
3876
- numSettled += 1;
3877
- if (numSettled === args.length) {
3878
- resolve2(allData);
3879
- }
3880
- };
3881
- args.forEach(function(arg, idx) {
3882
- SynchronousPromise4.resolve(arg).then(function(thisResult) {
3883
- allData[idx] = {
3884
- status: "fulfilled",
3885
- value: thisResult
3886
- };
3887
- doSettled();
3888
- }).catch(function(err) {
3889
- allData[idx] = {
3890
- status: "rejected",
3891
- reason: err
3892
- };
3893
- doSettled();
3894
- });
3895
- });
3896
- });
3897
- };
3898
- if (Promise === SynchronousPromise4) {
3899
- throw new Error("Please use SynchronousPromise.installGlobally() to install globally");
3900
- }
3901
- var RealPromise = Promise;
3902
- SynchronousPromise4.installGlobally = function(__awaiter) {
3903
- if (Promise === SynchronousPromise4) {
3904
- return __awaiter;
3905
- }
3906
- var result = patchAwaiterIfRequired(__awaiter);
3907
- Promise = SynchronousPromise4;
3908
- return result;
3909
- };
3910
- SynchronousPromise4.uninstallGlobally = function() {
3911
- if (Promise === SynchronousPromise4) {
3912
- Promise = RealPromise;
3913
- }
3914
- };
3915
- function patchAwaiterIfRequired(__awaiter) {
3916
- if (typeof __awaiter === "undefined" || __awaiter.__patched) {
3917
- return __awaiter;
3918
- }
3919
- var originalAwaiter = __awaiter;
3920
- __awaiter = function() {
3921
- var Promise3 = RealPromise;
3922
- originalAwaiter.apply(this, makeArrayFrom(arguments));
3923
- };
3924
- __awaiter.__patched = true;
3925
- return __awaiter;
3926
- }
3927
- module2.exports = {
3928
- SynchronousPromise: SynchronousPromise4
3929
- };
3930
- }
3931
- });
3932
-
3933
3499
  // node_modules/property-expr/index.js
3934
3500
  var require_property_expr = __commonJS({
3935
3501
  "node_modules/property-expr/index.js"(exports2, module2) {
@@ -8559,6 +8125,7 @@ var date = {
8559
8125
  min: "${path} field must be later than ${min}",
8560
8126
  max: "${path} field must be at earlier than ${max}"
8561
8127
  };
8128
+ var boolean = {};
8562
8129
  var object = {
8563
8130
  noUnknown: "${path} field has unspecified keys: ${unknown}"
8564
8131
  };
@@ -8566,6 +8133,15 @@ var array = {
8566
8133
  min: "${path} field must have at least ${min} items",
8567
8134
  max: "${path} field must have less than or equal to ${max} items"
8568
8135
  };
8136
+ var locale_default = _extends(/* @__PURE__ */ Object.create(null), {
8137
+ mixed,
8138
+ string,
8139
+ number,
8140
+ date,
8141
+ object,
8142
+ array,
8143
+ boolean
8144
+ });
8569
8145
 
8570
8146
  // node_modules/yup/es/util/isSchema.js
8571
8147
  var isSchema_default = function(obj) {
@@ -8610,7 +8186,7 @@ var Condition = /* @__PURE__ */ function() {
8610
8186
  var _proto = Condition2.prototype;
8611
8187
  _proto.resolve = function resolve2(base, options) {
8612
8188
  var values2 = this.refs.map(function(ref) {
8613
- return ref.getValue(options);
8189
+ return ref.getValue(options == null ? void 0 : options.value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context);
8614
8190
  });
8615
8191
  var schema = this.fn.apply(base, values2.concat(base, options));
8616
8192
  if (schema === void 0 || schema === base)
@@ -8623,34 +8199,8 @@ var Condition = /* @__PURE__ */ function() {
8623
8199
  }();
8624
8200
  var Condition_default = Condition;
8625
8201
 
8626
- // node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
8627
- function _objectWithoutPropertiesLoose(source, excluded) {
8628
- if (source == null)
8629
- return {};
8630
- var target = {};
8631
- var sourceKeys = Object.keys(source);
8632
- var key, i;
8633
- for (i = 0; i < sourceKeys.length; i++) {
8634
- key = sourceKeys[i];
8635
- if (excluded.indexOf(key) >= 0)
8636
- continue;
8637
- target[key] = source[key];
8638
- }
8639
- return target;
8640
- }
8641
-
8642
- // node_modules/yup/es/util/runValidations.js
8643
- var import_synchronous_promise = __toESM(require_synchronous_promise());
8644
-
8645
8202
  // node_modules/yup/es/ValidationError.js
8646
8203
  var strReg = /\$\{\s*(\w+)\s*\}/g;
8647
- var replace = function replace2(str) {
8648
- return function(params) {
8649
- return str.replace(strReg, function(_, key) {
8650
- return printValue(params[key]);
8651
- });
8652
- };
8653
- };
8654
8204
  function ValidationError(errors, value, field, type) {
8655
8205
  var _this = this;
8656
8206
  this.name = "ValidationError";
@@ -8675,85 +8225,65 @@ ValidationError.isError = function(err) {
8675
8225
  return err && err.name === "ValidationError";
8676
8226
  };
8677
8227
  ValidationError.formatError = function(message, params) {
8228
+ params.path = params.label || params.path || "this";
8678
8229
  if (typeof message === "string")
8679
- message = replace(message);
8680
- var fn = function fn2(params2) {
8681
- params2.path = params2.label || params2.path || "this";
8682
- return typeof message === "function" ? message(params2) : message;
8683
- };
8684
- return arguments.length === 1 ? fn : fn(params);
8230
+ return message.replace(strReg, function(_, key) {
8231
+ return printValue(params[key]);
8232
+ });
8233
+ if (typeof message === "function")
8234
+ return message(params);
8235
+ return message;
8685
8236
  };
8686
8237
 
8687
- // node_modules/yup/es/util/runValidations.js
8688
- var promise = function promise2(sync) {
8689
- return sync ? import_synchronous_promise.SynchronousPromise : Promise;
8690
- };
8691
- var unwrapError = function unwrapError2(errors) {
8692
- if (errors === void 0) {
8693
- errors = [];
8694
- }
8695
- return errors.inner && errors.inner.length ? errors.inner : [].concat(errors);
8696
- };
8697
- function scopeToValue(promises, value, sync) {
8698
- var p = promise(sync).all(promises);
8699
- var b = p.catch(function(err) {
8700
- if (err.name === "ValidationError")
8701
- err.value = value;
8702
- throw err;
8703
- });
8704
- var c = b.then(function() {
8705
- return value;
8706
- });
8707
- return c;
8708
- }
8709
- function propagateErrors(endEarly, errors) {
8710
- return endEarly ? null : function(err) {
8711
- errors.push(err);
8712
- return err.value;
8238
+ // node_modules/yup/es/util/async.js
8239
+ var once = function once2(cb) {
8240
+ var fired = false;
8241
+ return function() {
8242
+ if (fired)
8243
+ return;
8244
+ fired = true;
8245
+ cb.apply(void 0, arguments);
8713
8246
  };
8714
- }
8715
- function settled(promises, sync) {
8716
- var Promise3 = promise(sync);
8717
- return Promise3.all(promises.map(function(p) {
8718
- return Promise3.resolve(p).then(function(value) {
8719
- return {
8720
- fulfilled: true,
8721
- value
8722
- };
8723
- }, function(value) {
8724
- return {
8725
- fulfilled: false,
8726
- value
8727
- };
8247
+ };
8248
+
8249
+ // node_modules/yup/es/util/runTests.js
8250
+ function runTests(options, cb) {
8251
+ var endEarly = options.endEarly, tests = options.tests, args = options.args, value = options.value, errors = options.errors, sort = options.sort, path = options.path;
8252
+ var callback = once(cb);
8253
+ var count = tests.length;
8254
+ if (!count)
8255
+ return callback(null, value);
8256
+ var nestedErrors = [];
8257
+ errors = errors ? errors : [];
8258
+ for (var i = 0; i < tests.length; i++) {
8259
+ var test2 = tests[i];
8260
+ test2(args, function finishTestRun(err) {
8261
+ if (err) {
8262
+ if (!ValidationError.isError(err)) {
8263
+ return callback(err);
8264
+ }
8265
+ if (endEarly) {
8266
+ err.value = value;
8267
+ return callback(err);
8268
+ }
8269
+ nestedErrors.push(err);
8270
+ }
8271
+ if (--count <= 0) {
8272
+ if (nestedErrors.length) {
8273
+ if (sort)
8274
+ nestedErrors.sort(sort);
8275
+ if (errors.length)
8276
+ nestedErrors.push.apply(nestedErrors, errors);
8277
+ errors = nestedErrors;
8278
+ }
8279
+ if (errors.length) {
8280
+ callback(new ValidationError(errors, value, path));
8281
+ return;
8282
+ }
8283
+ callback(null, value);
8284
+ }
8728
8285
  });
8729
- }));
8730
- }
8731
- function collectErrors(_ref) {
8732
- var validations = _ref.validations, value = _ref.value, path = _ref.path, sync = _ref.sync, errors = _ref.errors, sort = _ref.sort;
8733
- errors = unwrapError(errors);
8734
- return settled(validations, sync).then(function(results) {
8735
- var nestedErrors = results.filter(function(r) {
8736
- return !r.fulfilled;
8737
- }).reduce(function(arr, _ref2) {
8738
- var error = _ref2.value;
8739
- if (!ValidationError.isError(error)) {
8740
- throw error;
8741
- }
8742
- return arr.concat(error);
8743
- }, []);
8744
- if (sort)
8745
- nestedErrors.sort(sort);
8746
- errors = nestedErrors.concat(errors);
8747
- if (errors.length)
8748
- throw new ValidationError(errors, value, path);
8749
- return value;
8750
- });
8751
- }
8752
- function runValidations(_ref3) {
8753
- var endEarly = _ref3.endEarly, options = _objectWithoutPropertiesLoose(_ref3, ["endEarly"]);
8754
- if (endEarly)
8755
- return scopeToValue(options.validations, options.value, options.sync);
8756
- return collectErrors(options);
8286
+ }
8757
8287
  }
8758
8288
 
8759
8289
  // node_modules/yup/es/util/prependDeep.js
@@ -8783,6 +8313,22 @@ function prependDeep(target, source) {
8783
8313
  return target;
8784
8314
  }
8785
8315
 
8316
+ // node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
8317
+ function _objectWithoutPropertiesLoose(source, excluded) {
8318
+ if (source == null)
8319
+ return {};
8320
+ var target = {};
8321
+ var sourceKeys = Object.keys(source);
8322
+ var key, i;
8323
+ for (i = 0; i < sourceKeys.length; i++) {
8324
+ key = sourceKeys[i];
8325
+ if (excluded.indexOf(key) >= 0)
8326
+ continue;
8327
+ target[key] = source[key];
8328
+ }
8329
+ return target;
8330
+ }
8331
+
8786
8332
  // node_modules/lodash-es/_createBaseFor.js
8787
8333
  function createBaseFor(fromRight) {
8788
8334
  return function(object2, iteratee, keysFunc) {
@@ -9263,8 +8809,8 @@ var Reference = /* @__PURE__ */ function() {
9263
8809
  this.map = options.map;
9264
8810
  }
9265
8811
  var _proto = Reference2.prototype;
9266
- _proto.getValue = function getValue2(options) {
9267
- var result = this.isContext ? options.context : this.isValue ? options.value : options.parent;
8812
+ _proto.getValue = function getValue2(value, parent, context) {
8813
+ var result = this.isContext ? context : this.isValue ? value : parent;
9268
8814
  if (this.getter)
9269
8815
  result = this.getter(result || {});
9270
8816
  if (this.map)
@@ -9272,9 +8818,7 @@ var Reference = /* @__PURE__ */ function() {
9272
8818
  return result;
9273
8819
  };
9274
8820
  _proto.cast = function cast2(value, options) {
9275
- return this.getValue(_extends({}, options, {
9276
- value
9277
- }));
8821
+ return this.getValue(value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context);
9278
8822
  };
9279
8823
  _proto.resolve = function resolve2() {
9280
8824
  return this;
@@ -9296,76 +8840,71 @@ var Reference = /* @__PURE__ */ function() {
9296
8840
  Reference.prototype.__isYupRef = true;
9297
8841
 
9298
8842
  // node_modules/yup/es/util/createValidation.js
9299
- var import_synchronous_promise2 = __toESM(require_synchronous_promise());
9300
- var formatError = ValidationError.formatError;
9301
- var thenable = function thenable2(p) {
9302
- return p && typeof p.then === "function" && typeof p.catch === "function";
9303
- };
9304
- function runTest(testFn, ctx, value, sync) {
9305
- var result = testFn.call(ctx, value);
9306
- if (!sync)
9307
- return Promise.resolve(result);
9308
- if (thenable(result)) {
9309
- throw new Error('Validation test of type: "' + ctx.type + '" returned a Promise during a synchronous validate. This test will finish after the validate call has returned');
9310
- }
9311
- return import_synchronous_promise2.SynchronousPromise.resolve(result);
9312
- }
9313
- function resolveParams(oldParams, newParams, resolve2) {
9314
- return mapValues_default(_extends({}, oldParams, newParams), resolve2);
9315
- }
9316
- function createErrorFactory(_ref) {
9317
- var value = _ref.value, label2 = _ref.label, resolve2 = _ref.resolve, originalValue = _ref.originalValue, opts = _objectWithoutPropertiesLoose(_ref, ["value", "label", "resolve", "originalValue"]);
9318
- return function createError(_temp) {
9319
- var _ref2 = _temp === void 0 ? {} : _temp, _ref2$path = _ref2.path, path = _ref2$path === void 0 ? opts.path : _ref2$path, _ref2$message = _ref2.message, message = _ref2$message === void 0 ? opts.message : _ref2$message, _ref2$type = _ref2.type, type = _ref2$type === void 0 ? opts.name : _ref2$type, params = _ref2.params;
9320
- params = _extends({
9321
- path,
9322
- value,
9323
- originalValue,
9324
- label: label2
9325
- }, resolveParams(opts.params, params, resolve2));
9326
- return _extends(new ValidationError(formatError(message, params), value, path, type), {
9327
- params
9328
- });
9329
- };
9330
- }
9331
- function createValidation(options) {
9332
- var name = options.name, message = options.message, test2 = options.test, params = options.params;
9333
- function validate2(_ref3) {
9334
- var value = _ref3.value, path = _ref3.path, label2 = _ref3.label, options2 = _ref3.options, originalValue = _ref3.originalValue, sync = _ref3.sync, rest = _objectWithoutPropertiesLoose(_ref3, ["value", "path", "label", "options", "originalValue", "sync"]);
9335
- var parent = options2.parent;
9336
- var resolve2 = function resolve3(item) {
9337
- return Reference.isRef(item) ? item.getValue({
8843
+ function createValidation(config) {
8844
+ function validate2(_ref, cb) {
8845
+ var value = _ref.value, path = _ref.path, label2 = _ref.label, options = _ref.options, originalValue = _ref.originalValue, sync = _ref.sync, rest = _objectWithoutPropertiesLoose(_ref, ["value", "path", "label", "options", "originalValue", "sync"]);
8846
+ var name = config.name, test2 = config.test, params = config.params, message = config.message;
8847
+ var parent = options.parent, context = options.context;
8848
+ function resolve2(item) {
8849
+ return Reference.isRef(item) ? item.getValue(value, parent, context) : item;
8850
+ }
8851
+ function createError(overrides) {
8852
+ if (overrides === void 0) {
8853
+ overrides = {};
8854
+ }
8855
+ var nextParams = mapValues_default(_extends({
9338
8856
  value,
9339
- parent,
9340
- context: options2.context
9341
- }) : item;
9342
- };
9343
- var createError = createErrorFactory({
9344
- message,
9345
- path,
9346
- value,
9347
- originalValue,
9348
- params,
9349
- label: label2,
9350
- resolve: resolve2,
9351
- name
9352
- });
8857
+ originalValue,
8858
+ label: label2,
8859
+ path: overrides.path || path
8860
+ }, params, overrides.params), resolve2);
8861
+ var error = new ValidationError(ValidationError.formatError(overrides.message || message, nextParams), value, nextParams.path, overrides.type || name);
8862
+ error.params = nextParams;
8863
+ return error;
8864
+ }
9353
8865
  var ctx = _extends({
9354
8866
  path,
9355
8867
  parent,
9356
8868
  type: name,
9357
8869
  createError,
9358
8870
  resolve: resolve2,
9359
- options: options2
8871
+ options,
8872
+ originalValue
9360
8873
  }, rest);
9361
- return runTest(test2, ctx, value, sync).then(function(validOrError) {
9362
- if (ValidationError.isError(validOrError))
9363
- throw validOrError;
9364
- else if (!validOrError)
9365
- throw createError();
9366
- });
8874
+ if (!sync) {
8875
+ try {
8876
+ Promise.resolve(test2.call(ctx, value, ctx)).then(function(validOrError) {
8877
+ if (ValidationError.isError(validOrError))
8878
+ cb(validOrError);
8879
+ else if (!validOrError)
8880
+ cb(createError());
8881
+ else
8882
+ cb(null, validOrError);
8883
+ });
8884
+ } catch (err) {
8885
+ cb(err);
8886
+ }
8887
+ return;
8888
+ }
8889
+ var result;
8890
+ try {
8891
+ var _result;
8892
+ result = test2.call(ctx, value, ctx);
8893
+ if (typeof ((_result = result) == null ? void 0 : _result.then) === "function") {
8894
+ throw new Error('Validation test of type: "' + ctx.type + '" returned a Promise during a synchronous validate. This test will finish after the validate call has returned');
8895
+ }
8896
+ } catch (err) {
8897
+ cb(err);
8898
+ return;
8899
+ }
8900
+ if (ValidationError.isError(result))
8901
+ cb(result);
8902
+ else if (!result)
8903
+ cb(createError());
8904
+ else
8905
+ cb(null, result);
9367
8906
  }
9368
- validate2.OPTIONS = options;
8907
+ validate2.OPTIONS = config;
9369
8908
  return validate2;
9370
8909
  }
9371
8910
 
@@ -9558,9 +9097,12 @@ var proto = SchemaType.prototype = {
9558
9097
  var _this2 = this;
9559
9098
  if (this._mutate)
9560
9099
  return this;
9561
- return cloneDeepWith_default(this, function(value) {
9100
+ return cloneDeepWith_default(this, function(value, key) {
9562
9101
  if (isSchema_default(value) && value !== _this2)
9563
9102
  return value;
9103
+ if (key === "_whitelist" || key === "_blacklist") {
9104
+ return value.clone();
9105
+ }
9564
9106
  });
9565
9107
  },
9566
9108
  label: function label(_label) {
@@ -9619,13 +9161,20 @@ var proto = SchemaType.prototype = {
9619
9161
  }
9620
9162
  return schema;
9621
9163
  },
9164
+ /**
9165
+ *
9166
+ * @param {*} value
9167
+ * @param {Object} options
9168
+ * @param {*=} options.parent
9169
+ * @param {*=} options.context
9170
+ */
9622
9171
  cast: function cast(value, options) {
9623
9172
  if (options === void 0) {
9624
9173
  options = {};
9625
9174
  }
9626
- var resolvedSchema = this.resolve(_extends({}, options, {
9175
+ var resolvedSchema = this.resolve(_extends({
9627
9176
  value
9628
- }));
9177
+ }, options));
9629
9178
  var result = resolvedSchema._cast(value, options);
9630
9179
  if (value !== void 0 && options.assert !== false && resolvedSchema.isType(result) !== true) {
9631
9180
  var formattedValue = printValue(value);
@@ -9644,68 +9193,72 @@ var proto = SchemaType.prototype = {
9644
9193
  }
9645
9194
  return value;
9646
9195
  },
9647
- _validate: function _validate(_value, options) {
9196
+ _validate: function _validate(_value, options, cb) {
9648
9197
  var _this4 = this;
9649
9198
  if (options === void 0) {
9650
9199
  options = {};
9651
9200
  }
9201
+ var _options = options, sync = _options.sync, path = _options.path, _options$from = _options.from, from2 = _options$from === void 0 ? [] : _options$from, _options$originalValu = _options.originalValue, originalValue = _options$originalValu === void 0 ? _value : _options$originalValu, _options$strict = _options.strict, strict2 = _options$strict === void 0 ? this._options.strict : _options$strict, _options$abortEarly = _options.abortEarly, abortEarly = _options$abortEarly === void 0 ? this._options.abortEarly : _options$abortEarly;
9652
9202
  var value = _value;
9653
- var originalValue = options.originalValue != null ? options.originalValue : _value;
9654
- var isStrict = this._option("strict", options);
9655
- var endEarly = this._option("abortEarly", options);
9656
- var sync = options.sync;
9657
- var path = options.path;
9658
- var label2 = this._label;
9659
- if (!isStrict) {
9203
+ if (!strict2) {
9204
+ this._validating = true;
9660
9205
  value = this._cast(value, _extends({
9661
9206
  assert: false
9662
9207
  }, options));
9208
+ this._validating = false;
9663
9209
  }
9664
- var validationParams = {
9210
+ var args = {
9665
9211
  value,
9666
9212
  path,
9667
- schema: this,
9668
9213
  options,
9669
- label: label2,
9670
9214
  originalValue,
9671
- sync
9215
+ schema: this,
9216
+ label: this._label,
9217
+ sync,
9218
+ from: from2
9672
9219
  };
9673
- if (options.from) {
9674
- validationParams.from = options.from;
9675
- }
9676
9220
  var initialTests = [];
9677
9221
  if (this._typeError)
9678
- initialTests.push(this._typeError(validationParams));
9222
+ initialTests.push(this._typeError);
9679
9223
  if (this._whitelistError)
9680
- initialTests.push(this._whitelistError(validationParams));
9224
+ initialTests.push(this._whitelistError);
9681
9225
  if (this._blacklistError)
9682
- initialTests.push(this._blacklistError(validationParams));
9683
- return runValidations({
9684
- validations: initialTests,
9685
- endEarly,
9226
+ initialTests.push(this._blacklistError);
9227
+ return runTests({
9228
+ args,
9686
9229
  value,
9687
9230
  path,
9688
- sync
9689
- }).then(function(value2) {
9690
- return runValidations({
9231
+ sync,
9232
+ tests: initialTests,
9233
+ endEarly: abortEarly
9234
+ }, function(err) {
9235
+ if (err)
9236
+ return void cb(err);
9237
+ runTests({
9238
+ tests: _this4.tests,
9239
+ args,
9691
9240
  path,
9692
9241
  sync,
9693
- value: value2,
9694
- endEarly,
9695
- validations: _this4.tests.map(function(fn) {
9696
- return fn(validationParams);
9697
- })
9698
- });
9242
+ value,
9243
+ endEarly: abortEarly
9244
+ }, cb);
9699
9245
  });
9700
9246
  },
9701
- validate: function validate(value, options) {
9247
+ validate: function validate(value, options, maybeCb) {
9702
9248
  if (options === void 0) {
9703
9249
  options = {};
9704
9250
  }
9705
9251
  var schema = this.resolve(_extends({}, options, {
9706
9252
  value
9707
9253
  }));
9708
- return schema._validate(value, options);
9254
+ return typeof maybeCb === "function" ? schema._validate(value, options, maybeCb) : new Promise(function(resolve2, reject) {
9255
+ return schema._validate(value, options, function(err, value2) {
9256
+ if (err)
9257
+ reject(err);
9258
+ else
9259
+ resolve2(value2);
9260
+ });
9261
+ });
9709
9262
  },
9710
9263
  validateSync: function validateSync(value, options) {
9711
9264
  if (options === void 0) {
@@ -9714,16 +9267,14 @@ var proto = SchemaType.prototype = {
9714
9267
  var schema = this.resolve(_extends({}, options, {
9715
9268
  value
9716
9269
  }));
9717
- var result, err;
9270
+ var result;
9718
9271
  schema._validate(value, _extends({}, options, {
9719
9272
  sync: true
9720
- })).then(function(r) {
9721
- return result = r;
9722
- }).catch(function(e) {
9723
- return err = e;
9273
+ }), function(err, value2) {
9274
+ if (err)
9275
+ throw err;
9276
+ result = value2;
9724
9277
  });
9725
- if (err)
9726
- throw err;
9727
9278
  return result;
9728
9279
  },
9729
9280
  isValid: function isValid(value, options) {
@@ -9983,7 +9534,7 @@ var proto = SchemaType.prototype = {
9983
9534
  if (message === void 0) {
9984
9535
  message = mixed.defined;
9985
9536
  }
9986
- return this.nullable().test({
9537
+ return this.test({
9987
9538
  message,
9988
9539
  name: "defined",
9989
9540
  exclusive: true,
@@ -10077,7 +9628,7 @@ var isAbsent_default = function(value) {
10077
9628
  // node_modules/yup/es/string.js
10078
9629
  var rEmail = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;
10079
9630
  var rUrl = /^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i;
10080
- var rUUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
9631
+ var rUUID = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
10081
9632
  var isTrimmed = function isTrimmed2(value) {
10082
9633
  return isAbsent_default(value) || value === value.trim();
10083
9634
  };
@@ -10492,15 +10043,6 @@ inherits(DateSchema, SchemaType, {
10492
10043
  }
10493
10044
  });
10494
10045
 
10495
- // node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js
10496
- function _taggedTemplateLiteralLoose(strings, raw) {
10497
- if (!raw) {
10498
- raw = strings.slice(0);
10499
- }
10500
- strings.raw = raw;
10501
- return strings;
10502
- }
10503
-
10504
10046
  // node_modules/lodash-es/_arrayReduce.js
10505
10047
  function arrayReduce(array2, iteratee, accumulator, initAccum) {
10506
10048
  var index = -1, length2 = array2 == null ? 0 : array2.length;
@@ -10908,7 +10450,8 @@ function sortFields(fields, excludes) {
10908
10450
  if (excludes === void 0) {
10909
10451
  excludes = [];
10910
10452
  }
10911
- var edges = [], nodes = [];
10453
+ var edges = [];
10454
+ var nodes = [];
10912
10455
  function addNode(depPath, key2) {
10913
10456
  var node = (0, import_property_expr3.split)(depPath)[0];
10914
10457
  if (!~nodes.indexOf(node))
@@ -10916,18 +10459,21 @@ function sortFields(fields, excludes) {
10916
10459
  if (!~excludes.indexOf(key2 + "-" + node))
10917
10460
  edges.push([key2, node]);
10918
10461
  }
10919
- for (var key in fields) {
10920
- if (has_default(fields, key)) {
10921
- var value = fields[key];
10922
- if (!~nodes.indexOf(key))
10923
- nodes.push(key);
10462
+ var _loop3 = function _loop4(key2) {
10463
+ if (has_default(fields, key2)) {
10464
+ var value = fields[key2];
10465
+ if (!~nodes.indexOf(key2))
10466
+ nodes.push(key2);
10924
10467
  if (Reference.isRef(value) && value.isSibling)
10925
- addNode(value.path, key);
10468
+ addNode(value.path, key2);
10926
10469
  else if (isSchema_default(value) && value._deps)
10927
10470
  value._deps.forEach(function(path) {
10928
- return addNode(path, key);
10471
+ return addNode(path, key2);
10929
10472
  });
10930
10473
  }
10474
+ };
10475
+ for (var key in fields) {
10476
+ _loop3(key);
10931
10477
  }
10932
10478
  return import_toposort.default.array(nodes, edges).reverse();
10933
10479
  }
@@ -10943,54 +10489,55 @@ function findIndex(arr, err) {
10943
10489
  });
10944
10490
  return idx;
10945
10491
  }
10946
- function sortByKeyOrder(fields) {
10947
- var keys2 = Object.keys(fields);
10492
+ function sortByKeyOrder(keys2) {
10948
10493
  return function(a, b) {
10949
10494
  return findIndex(keys2, a) - findIndex(keys2, b);
10950
10495
  };
10951
10496
  }
10952
10497
 
10953
- // node_modules/yup/es/util/makePath.js
10954
- function makePath(strings) {
10955
- for (var _len = arguments.length, values2 = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
10956
- values2[_key - 1] = arguments[_key];
10957
- }
10958
- var path = strings.reduce(function(str, next) {
10959
- var value = values2.shift();
10960
- return str + (value == null ? "" : value) + next;
10961
- });
10962
- return path.replace(/^\./, "");
10963
- }
10964
-
10965
10498
  // node_modules/yup/es/object.js
10966
- var import_synchronous_promise3 = __toESM(require_synchronous_promise());
10967
- function _templateObject3() {
10968
- var data = _taggedTemplateLiteralLoose(["", '["', '"]']);
10969
- _templateObject3 = function _templateObject32() {
10970
- return data;
10971
- };
10972
- return data;
10499
+ function _createForOfIteratorHelperLoose2(o, allowArrayLike) {
10500
+ var it;
10501
+ if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
10502
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray2(o)) || allowArrayLike && o && typeof o.length === "number") {
10503
+ if (it)
10504
+ o = it;
10505
+ var i = 0;
10506
+ return function() {
10507
+ if (i >= o.length)
10508
+ return { done: true };
10509
+ return { done: false, value: o[i++] };
10510
+ };
10511
+ }
10512
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
10513
+ }
10514
+ it = o[Symbol.iterator]();
10515
+ return it.next.bind(it);
10973
10516
  }
10974
- function _templateObject2() {
10975
- var data = _taggedTemplateLiteralLoose(["", ".", ""]);
10976
- _templateObject2 = function _templateObject23() {
10977
- return data;
10978
- };
10979
- return data;
10517
+ function _unsupportedIterableToArray2(o, minLen) {
10518
+ if (!o)
10519
+ return;
10520
+ if (typeof o === "string")
10521
+ return _arrayLikeToArray2(o, minLen);
10522
+ var n = Object.prototype.toString.call(o).slice(8, -1);
10523
+ if (n === "Object" && o.constructor)
10524
+ n = o.constructor.name;
10525
+ if (n === "Map" || n === "Set")
10526
+ return Array.from(o);
10527
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
10528
+ return _arrayLikeToArray2(o, minLen);
10980
10529
  }
10981
- function _templateObject() {
10982
- var data = _taggedTemplateLiteralLoose(["", ".", ""]);
10983
- _templateObject = function _templateObject5() {
10984
- return data;
10985
- };
10986
- return data;
10530
+ function _arrayLikeToArray2(arr, len) {
10531
+ if (len == null || len > arr.length)
10532
+ len = arr.length;
10533
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
10534
+ arr2[i] = arr[i];
10535
+ }
10536
+ return arr2;
10987
10537
  }
10988
10538
  var isObject4 = function isObject5(obj) {
10989
10539
  return Object.prototype.toString.call(obj) === "[object Object]";
10990
10540
  };
10991
- var promise3 = function promise4(sync) {
10992
- return sync ? import_synchronous_promise3.SynchronousPromise : Promise;
10993
- };
10994
10541
  function unknown(ctx, value) {
10995
10542
  var known = Object.keys(ctx.fields);
10996
10543
  return Object.keys(value).filter(function(key) {
@@ -11015,6 +10562,7 @@ function ObjectSchema(spec) {
11015
10562
  }
11016
10563
  });
11017
10564
  this.fields = /* @__PURE__ */ Object.create(null);
10565
+ this._sortErrors = sortByKeyOrder([]);
11018
10566
  this._nodes = [];
11019
10567
  this._excludedEdges = [];
11020
10568
  this.withMutation(function() {
@@ -11044,7 +10592,7 @@ inherits(ObjectSchema, SchemaType, {
11044
10592
  if (options === void 0) {
11045
10593
  options = {};
11046
10594
  }
11047
- var value = SchemaType.prototype._cast.call(this, _value, options);
10595
+ var value = SchemaType.prototype._cast.call(this, _value);
11048
10596
  if (value === void 0)
11049
10597
  return this.default();
11050
10598
  if (!this._typeCheck(value))
@@ -11060,84 +10608,111 @@ inherits(ObjectSchema, SchemaType, {
11060
10608
  __validating: options.__validating || false
11061
10609
  });
11062
10610
  var isChanged = false;
11063
- props.forEach(function(prop) {
10611
+ for (var _iterator = _createForOfIteratorHelperLoose2(props), _step; !(_step = _iterator()).done; ) {
10612
+ var prop = _step.value;
11064
10613
  var field = fields[prop];
11065
10614
  var exists = has_default(value, prop);
11066
10615
  if (field) {
11067
- var fieldValue;
10616
+ var fieldValue = void 0;
11068
10617
  var strict2 = field._options && field._options.strict;
11069
- innerOptions.path = makePath(_templateObject(), options.path, prop);
10618
+ innerOptions.path = (options.path ? options.path + "." : "") + prop;
11070
10619
  innerOptions.value = value[prop];
11071
10620
  field = field.resolve(innerOptions);
11072
10621
  if (field._strip === true) {
11073
10622
  isChanged = isChanged || prop in value;
11074
- return;
10623
+ continue;
11075
10624
  }
11076
10625
  fieldValue = !options.__validating || !strict2 ? field.cast(value[prop], innerOptions) : value[prop];
11077
- if (fieldValue !== void 0)
10626
+ if (fieldValue !== void 0) {
11078
10627
  intermediateValue[prop] = fieldValue;
11079
- } else if (exists && !strip2)
10628
+ }
10629
+ } else if (exists && !strip2) {
11080
10630
  intermediateValue[prop] = value[prop];
11081
- if (intermediateValue[prop] !== value[prop])
10631
+ }
10632
+ if (intermediateValue[prop] !== value[prop]) {
11082
10633
  isChanged = true;
11083
- });
10634
+ }
10635
+ }
11084
10636
  return isChanged ? intermediateValue : value;
11085
10637
  },
11086
- _validate: function _validate2(_value, opts) {
10638
+ /**
10639
+ * @typedef {Object} Ancestor
10640
+ * @property {Object} schema - a string property of SpecialType
10641
+ * @property {*} value - a number property of SpecialType
10642
+ */
10643
+ /**
10644
+ *
10645
+ * @param {*} _value
10646
+ * @param {Object} opts
10647
+ * @param {string=} opts.path
10648
+ * @param {*=} opts.parent
10649
+ * @param {Object=} opts.context
10650
+ * @param {boolean=} opts.sync
10651
+ * @param {boolean=} opts.stripUnknown
10652
+ * @param {boolean=} opts.strict
10653
+ * @param {boolean=} opts.recursive
10654
+ * @param {boolean=} opts.abortEarly
10655
+ * @param {boolean=} opts.__validating
10656
+ * @param {Object=} opts.originalValue
10657
+ * @param {Ancestor[]=} opts.from
10658
+ * @param {Object} [opts.from]
10659
+ * @param {Function} callback
10660
+ */
10661
+ _validate: function _validate2(_value, opts, callback) {
11087
10662
  var _this4 = this;
11088
10663
  if (opts === void 0) {
11089
10664
  opts = {};
11090
10665
  }
11091
- var endEarly, recursive;
11092
- var sync = opts.sync;
11093
10666
  var errors = [];
11094
- var originalValue = opts.originalValue != null ? opts.originalValue : _value;
11095
- var from2 = [{
10667
+ var _opts = opts, sync = _opts.sync, _opts$from = _opts.from, from2 = _opts$from === void 0 ? [] : _opts$from, _opts$originalValue = _opts.originalValue, originalValue = _opts$originalValue === void 0 ? _value : _opts$originalValue, _opts$abortEarly = _opts.abortEarly, abortEarly = _opts$abortEarly === void 0 ? this._options.abortEarly : _opts$abortEarly, _opts$recursive = _opts.recursive, recursive = _opts$recursive === void 0 ? this._options.recursive : _opts$recursive;
10668
+ from2 = [{
11096
10669
  schema: this,
11097
10670
  value: originalValue
11098
- }].concat(opts.from || []);
11099
- endEarly = this._option("abortEarly", opts);
11100
- recursive = this._option("recursive", opts);
11101
- opts = _extends({}, opts, {
11102
- __validating: true,
11103
- originalValue,
11104
- from: from2
11105
- });
11106
- return SchemaType.prototype._validate.call(this, _value, opts).catch(propagateErrors(endEarly, errors)).then(function(value) {
10671
+ }].concat(from2);
10672
+ opts.__validating = true;
10673
+ opts.originalValue = originalValue;
10674
+ opts.from = from2;
10675
+ SchemaType.prototype._validate.call(this, _value, opts, function(err, value) {
10676
+ if (err) {
10677
+ if (abortEarly)
10678
+ return void callback(err);
10679
+ errors.push(err);
10680
+ value = err.value;
10681
+ }
11107
10682
  if (!recursive || !isObject4(value)) {
11108
- if (errors.length)
11109
- throw errors[0];
11110
- return value;
10683
+ callback(errors[0] || null, value);
10684
+ return;
11111
10685
  }
11112
- from2 = originalValue ? [].concat(from2) : [{
11113
- schema: _this4,
11114
- value: originalValue || value
11115
- }].concat(opts.from || []);
11116
10686
  originalValue = originalValue || value;
11117
- var validations = _this4._nodes.map(function(key) {
11118
- var path = key.indexOf(".") === -1 ? makePath(_templateObject2(), opts.path, key) : makePath(_templateObject3(), opts.path, key);
11119
- var field = _this4.fields[key];
11120
- var innerOptions = _extends({}, opts, {
11121
- path,
11122
- from: from2,
11123
- parent: value,
11124
- originalValue: originalValue[key]
11125
- });
11126
- if (field && field.validate) {
11127
- innerOptions.strict = true;
11128
- return field.validate(value[key], innerOptions);
11129
- }
11130
- return promise3(sync).resolve(true);
10687
+ var tests = _this4._nodes.map(function(key) {
10688
+ return function(_, cb) {
10689
+ var path = key.indexOf(".") === -1 ? (opts.path ? opts.path + "." : "") + key : (opts.path || "") + '["' + key + '"]';
10690
+ var field = _this4.fields[key];
10691
+ if (field && field.validate) {
10692
+ field.validate(value[key], _extends({}, opts, {
10693
+ path,
10694
+ from: from2,
10695
+ // inner fields are always strict:
10696
+ // 1. this isn't strict so the casting will also have cast inner values
10697
+ // 2. this is strict in which case the nested values weren't cast either
10698
+ strict: true,
10699
+ parent: value,
10700
+ originalValue: originalValue[key]
10701
+ }), cb);
10702
+ return;
10703
+ }
10704
+ cb(null);
10705
+ };
11131
10706
  });
11132
- return runValidations({
10707
+ runTests({
11133
10708
  sync,
11134
- validations,
10709
+ tests,
11135
10710
  value,
11136
10711
  errors,
11137
- endEarly,
11138
- path: opts.path,
11139
- sort: sortByKeyOrder(_this4.fields)
11140
- });
10712
+ endEarly: abortEarly,
10713
+ sort: _this4._sortErrors,
10714
+ path: opts.path
10715
+ }, callback);
11141
10716
  });
11142
10717
  },
11143
10718
  concat: function concat2(schema) {
@@ -11152,6 +10727,7 @@ inherits(ObjectSchema, SchemaType, {
11152
10727
  var next = this.clone();
11153
10728
  var fields = _extends(next.fields, schema);
11154
10729
  next.fields = fields;
10730
+ next._sortErrors = sortByKeyOrder(Object.keys(fields));
11155
10731
  if (excludes.length) {
11156
10732
  if (!Array.isArray(excludes[0]))
11157
10733
  excludes = [excludes];
@@ -11245,20 +10821,6 @@ inherits(ObjectSchema, SchemaType, {
11245
10821
  });
11246
10822
 
11247
10823
  // node_modules/yup/es/array.js
11248
- function _templateObject22() {
11249
- var data = _taggedTemplateLiteralLoose(["", "[", "]"]);
11250
- _templateObject22 = function _templateObject23() {
11251
- return data;
11252
- };
11253
- return data;
11254
- }
11255
- function _templateObject4() {
11256
- var data = _taggedTemplateLiteralLoose(["", "[", "]"]);
11257
- _templateObject4 = function _templateObject5() {
11258
- return data;
11259
- };
11260
- return data;
11261
- }
11262
10824
  var array_default = ArraySchema;
11263
10825
  function ArraySchema(type) {
11264
10826
  var _this = this;
@@ -11295,7 +10857,7 @@ inherits(ArraySchema, SchemaType, {
11295
10857
  var isChanged = false;
11296
10858
  var castArray = value.map(function(v, idx) {
11297
10859
  var castElement = _this2.innerType.cast(v, _extends({}, _opts, {
11298
- path: makePath(_templateObject4(), _opts.path, idx)
10860
+ path: (_opts.path || "") + "[" + idx + "]"
11299
10861
  }));
11300
10862
  if (castElement !== v) {
11301
10863
  isChanged = true;
@@ -11304,7 +10866,7 @@ inherits(ArraySchema, SchemaType, {
11304
10866
  });
11305
10867
  return isChanged ? castArray : value;
11306
10868
  },
11307
- _validate: function _validate3(_value, options) {
10869
+ _validate: function _validate3(_value, options, callback) {
11308
10870
  var _this3 = this;
11309
10871
  if (options === void 0) {
11310
10872
  options = {};
@@ -11316,34 +10878,44 @@ inherits(ArraySchema, SchemaType, {
11316
10878
  var endEarly = this._option("abortEarly", options);
11317
10879
  var recursive = this._option("recursive", options);
11318
10880
  var originalValue = options.originalValue != null ? options.originalValue : _value;
11319
- return SchemaType.prototype._validate.call(this, _value, options).catch(propagateErrors(endEarly, errors)).then(function(value) {
10881
+ SchemaType.prototype._validate.call(this, _value, options, function(err, value) {
10882
+ if (err) {
10883
+ if (endEarly)
10884
+ return void callback(err);
10885
+ errors.push(err);
10886
+ value = err.value;
10887
+ }
11320
10888
  if (!recursive || !innerType || !_this3._typeCheck(value)) {
11321
- if (errors.length)
11322
- throw errors[0];
11323
- return value;
10889
+ callback(errors[0] || null, value);
10890
+ return;
11324
10891
  }
11325
10892
  originalValue = originalValue || value;
11326
- var validations = new Array(value.length);
11327
- for (var idx = 0; idx < value.length; idx++) {
11328
- var item = value[idx];
11329
- var _path = makePath(_templateObject22(), options.path, idx);
10893
+ var tests = new Array(value.length);
10894
+ var _loop3 = function _loop4(idx2) {
10895
+ var item = value[idx2];
10896
+ var path2 = (options.path || "") + "[" + idx2 + "]";
11330
10897
  var innerOptions = _extends({}, options, {
11331
- path: _path,
10898
+ path: path2,
11332
10899
  strict: true,
11333
10900
  parent: value,
11334
- index: idx,
11335
- originalValue: originalValue[idx]
10901
+ index: idx2,
10902
+ originalValue: originalValue[idx2]
11336
10903
  });
11337
- validations[idx] = innerType.validate ? innerType.validate(item, innerOptions) : true;
10904
+ tests[idx2] = function(_, cb) {
10905
+ return innerType.validate ? innerType.validate(item, innerOptions, cb) : cb(null);
10906
+ };
10907
+ };
10908
+ for (var idx = 0; idx < value.length; idx++) {
10909
+ _loop3(idx);
11338
10910
  }
11339
- return runValidations({
10911
+ runTests({
11340
10912
  sync,
11341
10913
  path,
11342
10914
  value,
11343
10915
  errors,
11344
10916
  endEarly,
11345
- validations
11346
- });
10917
+ tests
10918
+ }, callback);
11347
10919
  });
11348
10920
  },
11349
10921
  _isPresent: function _isPresent3(value) {
@@ -11430,8 +11002,8 @@ var Lazy = /* @__PURE__ */ function() {
11430
11002
  _proto.cast = function cast2(value, options) {
11431
11003
  return this._resolve(value, options).cast(value, options);
11432
11004
  };
11433
- _proto.validate = function validate2(value, options) {
11434
- return this._resolve(value, options).validate(value, options);
11005
+ _proto.validate = function validate2(value, options, maybeCb) {
11006
+ return this._resolve(value, options).validate(value, options, maybeCb);
11435
11007
  };
11436
11008
  _proto.validateSync = function validateSync2(value, options) {
11437
11009
  return this._resolve(value, options).validateSync(value, options);
@@ -11448,7 +11020,7 @@ Lazy.prototype.__isYupSchema__ = true;
11448
11020
  var Lazy_default = Lazy;
11449
11021
 
11450
11022
  // node_modules/yup/es/index.js
11451
- var boolean = boolean_default;
11023
+ var boolean2 = boolean_default;
11452
11024
  var lazy = function lazy2(fn) {
11453
11025
  return new Lazy_default(fn);
11454
11026
  };
@@ -11751,8 +11323,17 @@ var validateOnlyStrings = StringSchema().trim().nullable().test(
11751
11323
  );
11752
11324
  var yupSchemas = {
11753
11325
  text: validateOnlyStrings,
11754
- select: StringSchema().trim().nullable(),
11755
- radio: StringSchema().trim().nullable(),
11326
+ radioOrSelect: (options) => StringSchema().nullable().transform((value) => {
11327
+ if (value === "") {
11328
+ return void 0;
11329
+ }
11330
+ if (options?.includes(null)) {
11331
+ return value;
11332
+ }
11333
+ return value === null ? void 0 : value;
11334
+ }).oneOf(options, ({ value }) => {
11335
+ return `The option ${JSON.stringify(value)} is not valid.`;
11336
+ }),
11756
11337
  date: StringSchema().nullable().trim().matches(
11757
11338
  /(?:\d){4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9]|3[0-1])/,
11758
11339
  `Must be a valid date in ${DEFAULT_DATE_FORMAT.toLocaleLowerCase()} format. e.g. ${todayDateHint}`
@@ -11762,7 +11343,7 @@ var yupSchemas = {
11762
11343
  email: StringSchema().trim().email("Please enter a valid email address").nullable(),
11763
11344
  fieldset: ObjectSchema().nullable(),
11764
11345
  checkbox: StringSchema().trim().nullable(),
11765
- checkboxBool: boolean(),
11346
+ checkboxBool: boolean2(),
11766
11347
  multiple: {
11767
11348
  select: array_default().nullable(),
11768
11349
  "group-array": array_default().nullable()
@@ -11787,18 +11368,33 @@ function getRequiredErrorMessage(inputType, { inlineError, configError }) {
11787
11368
  return "Required field";
11788
11369
  }
11789
11370
  var getJsonTypeInArray = (jsonType) => Array.isArray(jsonType) ? jsonType.find((val) => val !== "null") : jsonType;
11371
+ var getOptions = (field) => {
11372
+ const allValues = field.options?.map((option) => option.value);
11373
+ const isOptionalWithNull = Array.isArray(field.jsonType) && // @TODO should also check the "oneOf" directly looking for "null"
11374
+ // option but we don't have direct access at this point.
11375
+ // Otherwise the JSON Schema validator will fail as explained in PR#18
11376
+ field.jsonType.includes("null");
11377
+ return isOptionalWithNull ? [...allValues, null] : allValues;
11378
+ };
11379
+ var getYupSchema = ({ inputType, ...field }) => {
11380
+ const jsonType = getJsonTypeInArray(field.jsonType);
11381
+ if (field.options?.length > 0) {
11382
+ const optionValues = getOptions(field);
11383
+ return yupSchemas.radioOrSelect(optionValues);
11384
+ }
11385
+ return yupSchemas[inputType] || yupSchemasToJsonTypes[jsonType];
11386
+ };
11790
11387
  function buildYupSchema(field, config) {
11791
11388
  const { inputType, jsonType: jsonTypeValue, errorMessage = {}, ...propertyFields } = field;
11792
11389
  const isCheckboxBoolean = typeof propertyFields.checkboxValue === "boolean";
11793
11390
  let baseSchema;
11794
- const jsonType = getJsonTypeInArray(jsonTypeValue);
11795
11391
  const errorMessageFromConfig = config?.inputTypes?.[inputType]?.errorMessage || {};
11796
11392
  if (propertyFields.multiple) {
11797
11393
  baseSchema = yupSchemas.multiple[inputType] || yupSchemasToJsonTypes.array;
11798
11394
  } else if (isCheckboxBoolean) {
11799
11395
  baseSchema = yupSchemas.checkboxBool;
11800
11396
  } else {
11801
- baseSchema = yupSchemas[inputType] || yupSchemasToJsonTypes[jsonType];
11397
+ baseSchema = getYupSchema(field);
11802
11398
  }
11803
11399
  if (!baseSchema) {
11804
11400
  return import_noop.default;
@@ -11998,8 +11594,17 @@ function checkIfConditionMatches(node, formValues, formFields) {
11998
11594
  if (currentProperty.enum) {
11999
11595
  return currentProperty.enum.includes(value);
12000
11596
  }
12001
- const { inputType } = getField(name, formFields);
12002
- return validateFieldSchema({ ...currentProperty, inputType, required: true }, value);
11597
+ const field = getField(name, formFields);
11598
+ return validateFieldSchema(
11599
+ {
11600
+ options: field.options,
11601
+ // @TODO/CODE SMELL. We are passing the property (raw field), but buildYupSchema() expected the output field.
11602
+ ...currentProperty,
11603
+ inputType: field.inputType,
11604
+ required: true
11605
+ },
11606
+ value
11607
+ );
12003
11608
  });
12004
11609
  }
12005
11610
  function isFieldFilled(fieldValue) {
@@ -12172,12 +11777,26 @@ function updateFieldsProperties(fields, formValues, jsonSchema) {
12172
11777
  clearValuesIfNotVisible(fields, formValues);
12173
11778
  }
12174
11779
  var notNullOption = (opt) => opt.const !== null;
11780
+ function flatPresentation(item) {
11781
+ return Object.entries(item).reduce((newItem, [key, value]) => {
11782
+ if (key === "x-jsf-presentation") {
11783
+ return {
11784
+ ...newItem,
11785
+ ...value
11786
+ };
11787
+ }
11788
+ return {
11789
+ ...newItem,
11790
+ [key]: value
11791
+ };
11792
+ }, {});
11793
+ }
12175
11794
  function getFieldOptions(node, presentation) {
12176
11795
  function convertToOptions(nodeOptions) {
12177
11796
  return nodeOptions.filter(notNullOption).map(({ title, const: cons, ...item }) => ({
12178
11797
  label: title,
12179
11798
  value: cons,
12180
- ...item
11799
+ ...flatPresentation(item)
12181
11800
  }));
12182
11801
  }
12183
11802
  if (presentation.options) {
@@ -12293,30 +11912,38 @@ var handleValuesChange = (fields, jsonSchema, config) => (values2) => {
12293
11912
  };
12294
11913
 
12295
11914
  // src/calculateConditionalProperties.js
12296
- function isFieldRequired(node, inputName) {
12297
- if (node?.required) {
12298
- return node.required.includes(inputName);
12299
- }
12300
- return false;
11915
+ function isFieldRequired(node, field) {
11916
+ return (
11917
+ // Check base root required
11918
+ field.scopedJsonSchema?.required?.includes(field.name) || // Check conditional required
11919
+ node?.required?.includes(field.name)
11920
+ );
12301
11921
  }
12302
- function rebuildInnerFieldsRequiredProperty(fields, property2) {
11922
+ function rebuildFieldset(fields, property2) {
12303
11923
  if (property2?.properties) {
12304
11924
  return fields.map((field) => {
11925
+ const propertyConditionals = property2.properties[field.name];
11926
+ if (!propertyConditionals) {
11927
+ return field;
11928
+ }
11929
+ const newFieldParams = extractParametersFromNode(propertyConditionals);
12305
11930
  if (field.fields) {
12306
11931
  return {
12307
11932
  ...field,
12308
- fields: rebuildInnerFieldsRequiredProperty(field.fields, property2.properties[field.name])
11933
+ ...newFieldParams,
11934
+ fields: rebuildFieldset(field.fields, propertyConditionals)
12309
11935
  };
12310
11936
  }
12311
11937
  return {
12312
11938
  ...field,
12313
- required: isFieldRequired(property2, field.name)
11939
+ ...newFieldParams,
11940
+ required: isFieldRequired(property2, field)
12314
11941
  };
12315
11942
  });
12316
11943
  }
12317
11944
  return fields.map((field) => ({
12318
11945
  ...field,
12319
- required: isFieldRequired(property2, field.name)
11946
+ required: isFieldRequired(property2, field)
12320
11947
  }));
12321
11948
  }
12322
11949
  function calculateConditionalProperties(fieldParams, customProperties) {
@@ -12331,10 +11958,7 @@ function calculateConditionalProperties(fieldParams, customProperties) {
12331
11958
  });
12332
11959
  let fieldSetFields;
12333
11960
  if (fieldParams.inputType === supportedTypes.FIELDSET) {
12334
- fieldSetFields = rebuildInnerFieldsRequiredProperty(
12335
- fieldParams.fields,
12336
- conditionalProperty
12337
- );
11961
+ fieldSetFields = rebuildFieldset(fieldParams.fields, conditionalProperty);
12338
11962
  newFieldParams.fields = fieldSetFields;
12339
11963
  }
12340
11964
  const base = {