@betterstore/react 0.6.12 → 0.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/checkout-embed/checkout-form.d.ts.map +1 -1
- package/dist/components/checkout-embed/useFormStore.d.ts +3 -5
- package/dist/components/checkout-embed/useFormStore.d.ts.map +1 -1
- package/dist/components/compounds/form/country-input/dropdown.d.ts +26 -0
- package/dist/components/compounds/form/country-input/dropdown.d.ts.map +1 -0
- package/dist/components/compounds/form/select-group/index.d.ts +14 -0
- package/dist/components/compounds/form/select-group/index.d.ts.map +1 -0
- package/dist/components/compounds/form/select-group/select.d.ts +14 -0
- package/dist/components/compounds/form/select-group/select.d.ts.map +1 -0
- package/dist/components/payment-element/betterstore-checkout-embed-payment-element.d.ts +2 -0
- package/dist/components/payment-element/betterstore-checkout-embed-payment-element.d.ts.map +1 -0
- package/dist/components/shadow-wrapper.d.ts +8 -0
- package/dist/components/shadow-wrapper.d.ts.map +1 -0
- package/dist/components/ui/form.d.ts.map +1 -1
- package/dist/index.cjs.js +634 -1195
- package/dist/index.mjs +640 -1201
- package/dist/lib/betterstore.d.ts +6 -0
- package/dist/lib/betterstore.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -45,14 +45,14 @@ const createStoreImpl = (createState) => {
|
|
|
45
45
|
const initialState = state = createState(setState, getState, api);
|
|
46
46
|
return api;
|
|
47
47
|
};
|
|
48
|
-
const createStore = (
|
|
48
|
+
const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
|
|
49
49
|
|
|
50
50
|
const identity$1 = (arg) => arg;
|
|
51
51
|
function useStore(api, selector = identity$1) {
|
|
52
52
|
const slice = React.useSyncExternalStore(
|
|
53
53
|
api.subscribe,
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
() => selector(api.getState()),
|
|
55
|
+
() => selector(api.getInitialState())
|
|
56
56
|
);
|
|
57
57
|
React.useDebugValue(slice);
|
|
58
58
|
return slice;
|
|
@@ -63,7 +63,7 @@ const createImpl = (createState) => {
|
|
|
63
63
|
Object.assign(useBoundStore, api);
|
|
64
64
|
return useBoundStore;
|
|
65
65
|
};
|
|
66
|
-
const create = (
|
|
66
|
+
const create = (createState) => createState ? createImpl(createState) : createImpl;
|
|
67
67
|
|
|
68
68
|
function createJSONStorage(getStorage, options) {
|
|
69
69
|
let storage;
|
|
@@ -154,12 +154,12 @@ const persistImpl = (config, baseOptions) => (set, get, api) => {
|
|
|
154
154
|
const savedSetState = api.setState;
|
|
155
155
|
api.setState = (state, replace) => {
|
|
156
156
|
savedSetState(state, replace);
|
|
157
|
-
|
|
157
|
+
void setItem();
|
|
158
158
|
};
|
|
159
159
|
const configResult = config(
|
|
160
160
|
(...args) => {
|
|
161
161
|
set(...args);
|
|
162
|
-
|
|
162
|
+
void setItem();
|
|
163
163
|
},
|
|
164
164
|
get,
|
|
165
165
|
api
|
|
@@ -3095,7 +3095,7 @@ const hasLoadedNamespace = (ns, i18n, options = {}) => {
|
|
|
3095
3095
|
return i18n.hasLoadedNamespace(ns, {
|
|
3096
3096
|
lng: options.lng,
|
|
3097
3097
|
precheck: (i18nInstance, loadNotPending) => {
|
|
3098
|
-
if (options.bindI18n
|
|
3098
|
+
if (options.bindI18n?.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;
|
|
3099
3099
|
}
|
|
3100
3100
|
});
|
|
3101
3101
|
};
|
|
@@ -3256,7 +3256,7 @@ const useTranslation = (ns, props = {}) => {
|
|
|
3256
3256
|
if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset);
|
|
3257
3257
|
return () => {
|
|
3258
3258
|
isMounted.current = false;
|
|
3259
|
-
if (i18n
|
|
3259
|
+
if (i18n) bindI18n?.split(' ').forEach(e => i18n.off(e, boundReset));
|
|
3260
3260
|
if (bindI18nStore && i18n) bindI18nStore.split(' ').forEach(e => i18n.store.off(e, boundReset));
|
|
3261
3261
|
};
|
|
3262
3262
|
}, [i18n, joinedNS]);
|
|
@@ -3486,13 +3486,6 @@ const createI18nInstance = (locale) => __awaiter(void 0, void 0, void 0, functio
|
|
|
3486
3486
|
return instance;
|
|
3487
3487
|
});
|
|
3488
3488
|
|
|
3489
|
-
/**
|
|
3490
|
-
* Create a bound version of a function with a specified `this` context
|
|
3491
|
-
*
|
|
3492
|
-
* @param {Function} fn - The function to bind
|
|
3493
|
-
* @param {*} thisArg - The value to be passed as the `this` parameter
|
|
3494
|
-
* @returns {Function} A new function that will call the original function with the specified `this` context
|
|
3495
|
-
*/
|
|
3496
3489
|
function bind(fn, thisArg) {
|
|
3497
3490
|
return function wrap() {
|
|
3498
3491
|
return fn.apply(thisArg, arguments);
|
|
@@ -3544,7 +3537,7 @@ const isUndefined$1 = typeOfTest('undefined');
|
|
|
3544
3537
|
*/
|
|
3545
3538
|
function isBuffer(val) {
|
|
3546
3539
|
return val !== null && !isUndefined$1(val) && val.constructor !== null && !isUndefined$1(val.constructor)
|
|
3547
|
-
&& isFunction$
|
|
3540
|
+
&& isFunction$2(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
3548
3541
|
}
|
|
3549
3542
|
|
|
3550
3543
|
/**
|
|
@@ -3589,7 +3582,7 @@ const isString$1 = typeOfTest('string');
|
|
|
3589
3582
|
* @param {*} val The value to test
|
|
3590
3583
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
3591
3584
|
*/
|
|
3592
|
-
const isFunction$
|
|
3585
|
+
const isFunction$2 = typeOfTest('function');
|
|
3593
3586
|
|
|
3594
3587
|
/**
|
|
3595
3588
|
* Determine if a value is a Number
|
|
@@ -3633,27 +3626,6 @@ const isPlainObject$1 = (val) => {
|
|
|
3633
3626
|
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
|
|
3634
3627
|
};
|
|
3635
3628
|
|
|
3636
|
-
/**
|
|
3637
|
-
* Determine if a value is an empty object (safely handles Buffers)
|
|
3638
|
-
*
|
|
3639
|
-
* @param {*} val The value to test
|
|
3640
|
-
*
|
|
3641
|
-
* @returns {boolean} True if value is an empty object, otherwise false
|
|
3642
|
-
*/
|
|
3643
|
-
const isEmptyObject$1 = (val) => {
|
|
3644
|
-
// Early return for non-objects or Buffers to prevent RangeError
|
|
3645
|
-
if (!isObject$1(val) || isBuffer(val)) {
|
|
3646
|
-
return false;
|
|
3647
|
-
}
|
|
3648
|
-
|
|
3649
|
-
try {
|
|
3650
|
-
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
3651
|
-
} catch (e) {
|
|
3652
|
-
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
3653
|
-
return false;
|
|
3654
|
-
}
|
|
3655
|
-
};
|
|
3656
|
-
|
|
3657
3629
|
/**
|
|
3658
3630
|
* Determine if a value is a Date
|
|
3659
3631
|
*
|
|
@@ -3697,7 +3669,7 @@ const isFileList = kindOfTest('FileList');
|
|
|
3697
3669
|
*
|
|
3698
3670
|
* @returns {boolean} True if value is a Stream, otherwise false
|
|
3699
3671
|
*/
|
|
3700
|
-
const isStream = (val) => isObject$1(val) && isFunction$
|
|
3672
|
+
const isStream = (val) => isObject$1(val) && isFunction$2(val.pipe);
|
|
3701
3673
|
|
|
3702
3674
|
/**
|
|
3703
3675
|
* Determine if a value is a FormData
|
|
@@ -3710,10 +3682,10 @@ const isFormData = (thing) => {
|
|
|
3710
3682
|
let kind;
|
|
3711
3683
|
return thing && (
|
|
3712
3684
|
(typeof FormData === 'function' && thing instanceof FormData) || (
|
|
3713
|
-
isFunction$
|
|
3685
|
+
isFunction$2(thing.append) && (
|
|
3714
3686
|
(kind = kindOf(thing)) === 'formdata' ||
|
|
3715
3687
|
// detect form-data instance
|
|
3716
|
-
(kind === 'object' && isFunction$
|
|
3688
|
+
(kind === 'object' && isFunction$2(thing.toString) && thing.toString() === '[object FormData]')
|
|
3717
3689
|
)
|
|
3718
3690
|
)
|
|
3719
3691
|
)
|
|
@@ -3776,11 +3748,6 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
3776
3748
|
fn.call(null, obj[i], i, obj);
|
|
3777
3749
|
}
|
|
3778
3750
|
} else {
|
|
3779
|
-
// Buffer check
|
|
3780
|
-
if (isBuffer(obj)) {
|
|
3781
|
-
return;
|
|
3782
|
-
}
|
|
3783
|
-
|
|
3784
3751
|
// Iterate over object keys
|
|
3785
3752
|
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
3786
3753
|
const len = keys.length;
|
|
@@ -3794,10 +3761,6 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
3794
3761
|
}
|
|
3795
3762
|
|
|
3796
3763
|
function findKey(obj, key) {
|
|
3797
|
-
if (isBuffer(obj)){
|
|
3798
|
-
return null;
|
|
3799
|
-
}
|
|
3800
|
-
|
|
3801
3764
|
key = key.toLowerCase();
|
|
3802
3765
|
const keys = Object.keys(obj);
|
|
3803
3766
|
let i = keys.length;
|
|
@@ -3838,7 +3801,7 @@ const isContextDefined = (context) => !isUndefined$1(context) && context !== _gl
|
|
|
3838
3801
|
* @returns {Object} Result of all merge properties
|
|
3839
3802
|
*/
|
|
3840
3803
|
function merge(/* obj1, obj2, obj3, ... */) {
|
|
3841
|
-
const {caseless
|
|
3804
|
+
const {caseless} = isContextDefined(this) && this || {};
|
|
3842
3805
|
const result = {};
|
|
3843
3806
|
const assignValue = (val, key) => {
|
|
3844
3807
|
const targetKey = caseless && findKey(result, key) || key;
|
|
@@ -3848,7 +3811,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
3848
3811
|
result[targetKey] = merge({}, val);
|
|
3849
3812
|
} else if (isArray(val)) {
|
|
3850
3813
|
result[targetKey] = val.slice();
|
|
3851
|
-
} else
|
|
3814
|
+
} else {
|
|
3852
3815
|
result[targetKey] = val;
|
|
3853
3816
|
}
|
|
3854
3817
|
};
|
|
@@ -3871,7 +3834,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
3871
3834
|
*/
|
|
3872
3835
|
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
3873
3836
|
forEach(b, (val, key) => {
|
|
3874
|
-
if (thisArg && isFunction$
|
|
3837
|
+
if (thisArg && isFunction$2(val)) {
|
|
3875
3838
|
a[key] = bind(val, thisArg);
|
|
3876
3839
|
} else {
|
|
3877
3840
|
a[key] = val;
|
|
@@ -4087,13 +4050,13 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
4087
4050
|
const freezeMethods = (obj) => {
|
|
4088
4051
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
4089
4052
|
// skip restricted props in strict mode
|
|
4090
|
-
if (isFunction$
|
|
4053
|
+
if (isFunction$2(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
4091
4054
|
return false;
|
|
4092
4055
|
}
|
|
4093
4056
|
|
|
4094
4057
|
const value = obj[name];
|
|
4095
4058
|
|
|
4096
|
-
if (!isFunction$
|
|
4059
|
+
if (!isFunction$2(value)) return;
|
|
4097
4060
|
|
|
4098
4061
|
descriptor.enumerable = false;
|
|
4099
4062
|
|
|
@@ -4130,8 +4093,6 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
4130
4093
|
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
4131
4094
|
};
|
|
4132
4095
|
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
4096
|
/**
|
|
4136
4097
|
* If the thing is a FormData object, return true, otherwise return false.
|
|
4137
4098
|
*
|
|
@@ -4140,7 +4101,7 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
4140
4101
|
* @returns {boolean}
|
|
4141
4102
|
*/
|
|
4142
4103
|
function isSpecCompliantForm(thing) {
|
|
4143
|
-
return !!(thing && isFunction$
|
|
4104
|
+
return !!(thing && isFunction$2(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
4144
4105
|
}
|
|
4145
4106
|
|
|
4146
4107
|
const toJSONObject = (obj) => {
|
|
@@ -4153,11 +4114,6 @@ const toJSONObject = (obj) => {
|
|
|
4153
4114
|
return;
|
|
4154
4115
|
}
|
|
4155
4116
|
|
|
4156
|
-
//Buffer check
|
|
4157
|
-
if (isBuffer(source)) {
|
|
4158
|
-
return source;
|
|
4159
|
-
}
|
|
4160
|
-
|
|
4161
4117
|
if(!('toJSON' in source)) {
|
|
4162
4118
|
stack[i] = source;
|
|
4163
4119
|
const target = isArray(source) ? [] : {};
|
|
@@ -4182,7 +4138,7 @@ const toJSONObject = (obj) => {
|
|
|
4182
4138
|
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
4183
4139
|
|
|
4184
4140
|
const isThenable = (thing) =>
|
|
4185
|
-
thing && (isObject$1(thing) || isFunction$
|
|
4141
|
+
thing && (isObject$1(thing) || isFunction$2(thing)) && isFunction$2(thing.then) && isFunction$2(thing.catch);
|
|
4186
4142
|
|
|
4187
4143
|
// original code
|
|
4188
4144
|
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
@@ -4206,7 +4162,7 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
|
4206
4162
|
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
4207
4163
|
})(
|
|
4208
4164
|
typeof setImmediate === 'function',
|
|
4209
|
-
isFunction$
|
|
4165
|
+
isFunction$2(_global.postMessage)
|
|
4210
4166
|
);
|
|
4211
4167
|
|
|
4212
4168
|
const asap = typeof queueMicrotask !== 'undefined' ?
|
|
@@ -4215,7 +4171,7 @@ const asap = typeof queueMicrotask !== 'undefined' ?
|
|
|
4215
4171
|
// *********************
|
|
4216
4172
|
|
|
4217
4173
|
|
|
4218
|
-
const isIterable = (thing) => thing != null && isFunction$
|
|
4174
|
+
const isIterable = (thing) => thing != null && isFunction$2(thing[iterator]);
|
|
4219
4175
|
|
|
4220
4176
|
|
|
4221
4177
|
var utils$1 = {
|
|
@@ -4229,7 +4185,6 @@ var utils$1 = {
|
|
|
4229
4185
|
isBoolean: isBoolean$1,
|
|
4230
4186
|
isObject: isObject$1,
|
|
4231
4187
|
isPlainObject: isPlainObject$1,
|
|
4232
|
-
isEmptyObject: isEmptyObject$1,
|
|
4233
4188
|
isReadableStream,
|
|
4234
4189
|
isRequest,
|
|
4235
4190
|
isResponse,
|
|
@@ -4239,7 +4194,7 @@ var utils$1 = {
|
|
|
4239
4194
|
isFile,
|
|
4240
4195
|
isBlob,
|
|
4241
4196
|
isRegExp,
|
|
4242
|
-
isFunction: isFunction$
|
|
4197
|
+
isFunction: isFunction$2,
|
|
4243
4198
|
isStream,
|
|
4244
4199
|
isURLSearchParams,
|
|
4245
4200
|
isTypedArray,
|
|
@@ -4365,18 +4320,11 @@ AxiosError$1.from = (error, code, config, request, response, customProps) => {
|
|
|
4365
4320
|
return prop !== 'isAxiosError';
|
|
4366
4321
|
});
|
|
4367
4322
|
|
|
4368
|
-
|
|
4323
|
+
AxiosError$1.call(axiosError, error.message, code, config, request, response);
|
|
4369
4324
|
|
|
4370
|
-
|
|
4371
|
-
const errCode = code == null && error ? error.code : code;
|
|
4372
|
-
AxiosError$1.call(axiosError, msg, errCode, config, request, response);
|
|
4325
|
+
axiosError.cause = error;
|
|
4373
4326
|
|
|
4374
|
-
|
|
4375
|
-
if (error && axiosError.cause == null) {
|
|
4376
|
-
Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
|
|
4377
|
-
}
|
|
4378
|
-
|
|
4379
|
-
axiosError.name = (error && error.name) || 'Error';
|
|
4327
|
+
axiosError.name = error.name;
|
|
4380
4328
|
|
|
4381
4329
|
customProps && Object.assign(axiosError, customProps);
|
|
4382
4330
|
|
|
@@ -4667,7 +4615,9 @@ function encode(val) {
|
|
|
4667
4615
|
replace(/%3A/gi, ':').
|
|
4668
4616
|
replace(/%24/g, '$').
|
|
4669
4617
|
replace(/%2C/gi, ',').
|
|
4670
|
-
replace(/%20/g, '+')
|
|
4618
|
+
replace(/%20/g, '+').
|
|
4619
|
+
replace(/%5B/gi, '[').
|
|
4620
|
+
replace(/%5D/gi, ']');
|
|
4671
4621
|
}
|
|
4672
4622
|
|
|
4673
4623
|
/**
|
|
@@ -4745,7 +4695,7 @@ class InterceptorManager {
|
|
|
4745
4695
|
*
|
|
4746
4696
|
* @param {Number} id The ID that was returned by `use`
|
|
4747
4697
|
*
|
|
4748
|
-
* @returns {
|
|
4698
|
+
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
|
4749
4699
|
*/
|
|
4750
4700
|
eject(id) {
|
|
4751
4701
|
if (this.handlers[id]) {
|
|
@@ -4864,7 +4814,7 @@ var platform$1 = {
|
|
|
4864
4814
|
};
|
|
4865
4815
|
|
|
4866
4816
|
function toURLEncodedForm(data, options) {
|
|
4867
|
-
return toFormData$1(data, new platform$1.classes.URLSearchParams(), {
|
|
4817
|
+
return toFormData$1(data, new platform$1.classes.URLSearchParams(), Object.assign({
|
|
4868
4818
|
visitor: function(value, key, path, helpers) {
|
|
4869
4819
|
if (platform$1.isNode && utils$1.isBuffer(value)) {
|
|
4870
4820
|
this.append(key, value.toString('base64'));
|
|
@@ -4872,9 +4822,8 @@ function toURLEncodedForm(data, options) {
|
|
|
4872
4822
|
}
|
|
4873
4823
|
|
|
4874
4824
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
4875
|
-
}
|
|
4876
|
-
|
|
4877
|
-
});
|
|
4825
|
+
}
|
|
4826
|
+
}, options));
|
|
4878
4827
|
}
|
|
4879
4828
|
|
|
4880
4829
|
/**
|
|
@@ -5070,7 +5019,7 @@ const defaults = {
|
|
|
5070
5019
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
5071
5020
|
|
|
5072
5021
|
try {
|
|
5073
|
-
return JSON.parse(data
|
|
5022
|
+
return JSON.parse(data);
|
|
5074
5023
|
} catch (e) {
|
|
5075
5024
|
if (strictJSONParsing) {
|
|
5076
5025
|
if (e.name === 'SyntaxError') {
|
|
@@ -5623,7 +5572,7 @@ function throttle(fn, freq) {
|
|
|
5623
5572
|
clearTimeout(timer);
|
|
5624
5573
|
timer = null;
|
|
5625
5574
|
}
|
|
5626
|
-
fn(
|
|
5575
|
+
fn.apply(null, args);
|
|
5627
5576
|
};
|
|
5628
5577
|
|
|
5629
5578
|
const throttled = (...args) => {
|
|
@@ -5705,38 +5654,27 @@ var cookies = platform$1.hasStandardBrowserEnv ?
|
|
|
5705
5654
|
|
|
5706
5655
|
// Standard browser envs support document.cookie
|
|
5707
5656
|
{
|
|
5708
|
-
write(name, value, expires, path, domain, secure
|
|
5709
|
-
|
|
5657
|
+
write(name, value, expires, path, domain, secure) {
|
|
5658
|
+
const cookie = [name + '=' + encodeURIComponent(value)];
|
|
5710
5659
|
|
|
5711
|
-
|
|
5660
|
+
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
|
5712
5661
|
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
}
|
|
5719
|
-
if (utils$1.isString(domain)) {
|
|
5720
|
-
cookie.push(`domain=${domain}`);
|
|
5721
|
-
}
|
|
5722
|
-
if (secure === true) {
|
|
5723
|
-
cookie.push('secure');
|
|
5724
|
-
}
|
|
5725
|
-
if (utils$1.isString(sameSite)) {
|
|
5726
|
-
cookie.push(`SameSite=${sameSite}`);
|
|
5727
|
-
}
|
|
5662
|
+
utils$1.isString(path) && cookie.push('path=' + path);
|
|
5663
|
+
|
|
5664
|
+
utils$1.isString(domain) && cookie.push('domain=' + domain);
|
|
5665
|
+
|
|
5666
|
+
secure === true && cookie.push('secure');
|
|
5728
5667
|
|
|
5729
5668
|
document.cookie = cookie.join('; ');
|
|
5730
5669
|
},
|
|
5731
5670
|
|
|
5732
5671
|
read(name) {
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
return match ? decodeURIComponent(match[1]) : null;
|
|
5672
|
+
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
5673
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
|
5736
5674
|
},
|
|
5737
5675
|
|
|
5738
5676
|
remove(name) {
|
|
5739
|
-
this.write(name, '', Date.now() - 86400000
|
|
5677
|
+
this.write(name, '', Date.now() - 86400000);
|
|
5740
5678
|
}
|
|
5741
5679
|
}
|
|
5742
5680
|
|
|
@@ -5825,11 +5763,11 @@ function mergeConfig$1(config1, config2) {
|
|
|
5825
5763
|
}
|
|
5826
5764
|
|
|
5827
5765
|
// eslint-disable-next-line consistent-return
|
|
5828
|
-
function mergeDeepProperties(a, b, prop, caseless) {
|
|
5766
|
+
function mergeDeepProperties(a, b, prop , caseless) {
|
|
5829
5767
|
if (!utils$1.isUndefined(b)) {
|
|
5830
|
-
return getMergedValue(a, b, prop, caseless);
|
|
5768
|
+
return getMergedValue(a, b, prop , caseless);
|
|
5831
5769
|
} else if (!utils$1.isUndefined(a)) {
|
|
5832
|
-
return getMergedValue(undefined, a, prop, caseless);
|
|
5770
|
+
return getMergedValue(undefined, a, prop , caseless);
|
|
5833
5771
|
}
|
|
5834
5772
|
}
|
|
5835
5773
|
|
|
@@ -5887,10 +5825,10 @@ function mergeConfig$1(config1, config2) {
|
|
|
5887
5825
|
socketPath: defaultToConfig2,
|
|
5888
5826
|
responseEncoding: defaultToConfig2,
|
|
5889
5827
|
validateStatus: mergeDirectKeys,
|
|
5890
|
-
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),
|
|
5828
|
+
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
|
5891
5829
|
};
|
|
5892
5830
|
|
|
5893
|
-
utils$1.forEach(Object.keys({
|
|
5831
|
+
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
5894
5832
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
5895
5833
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
5896
5834
|
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
@@ -5902,7 +5840,7 @@ function mergeConfig$1(config1, config2) {
|
|
|
5902
5840
|
var resolveConfig = (config) => {
|
|
5903
5841
|
const newConfig = mergeConfig$1({}, config);
|
|
5904
5842
|
|
|
5905
|
-
let {
|
|
5843
|
+
let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
|
|
5906
5844
|
|
|
5907
5845
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
5908
5846
|
|
|
@@ -5915,21 +5853,17 @@ var resolveConfig = (config) => {
|
|
|
5915
5853
|
);
|
|
5916
5854
|
}
|
|
5917
5855
|
|
|
5856
|
+
let contentType;
|
|
5857
|
+
|
|
5918
5858
|
if (utils$1.isFormData(data)) {
|
|
5919
5859
|
if (platform$1.hasStandardBrowserEnv || platform$1.hasStandardBrowserWebWorkerEnv) {
|
|
5920
|
-
headers.setContentType(undefined); // browser
|
|
5921
|
-
} else if (
|
|
5922
|
-
//
|
|
5923
|
-
const
|
|
5924
|
-
|
|
5925
|
-
const allowedHeaders = ['content-type', 'content-length'];
|
|
5926
|
-
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
5927
|
-
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
5928
|
-
headers.set(key, val);
|
|
5929
|
-
}
|
|
5930
|
-
});
|
|
5860
|
+
headers.setContentType(undefined); // Let the browser set it
|
|
5861
|
+
} else if ((contentType = headers.getContentType()) !== false) {
|
|
5862
|
+
// fix semicolon duplication issue for ReactNative FormData implementation
|
|
5863
|
+
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
|
|
5864
|
+
headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
|
5931
5865
|
}
|
|
5932
|
-
}
|
|
5866
|
+
}
|
|
5933
5867
|
|
|
5934
5868
|
// Add xsrf header
|
|
5935
5869
|
// This is only done if running in a standard browser environment.
|
|
@@ -6046,18 +5980,15 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
6046
5980
|
};
|
|
6047
5981
|
|
|
6048
5982
|
// Handle low level network errors
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
err.event = event || null;
|
|
6057
|
-
reject(err);
|
|
6058
|
-
request = null;
|
|
5983
|
+
request.onerror = function handleError() {
|
|
5984
|
+
// Real errors are hidden from us by the browser
|
|
5985
|
+
// onerror should only fire if it's a network error
|
|
5986
|
+
reject(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request));
|
|
5987
|
+
|
|
5988
|
+
// Clean up request
|
|
5989
|
+
request = null;
|
|
6059
5990
|
};
|
|
6060
|
-
|
|
5991
|
+
|
|
6061
5992
|
// Handle timeout
|
|
6062
5993
|
request.ontimeout = function handleTimeout() {
|
|
6063
5994
|
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
@@ -6271,18 +6202,14 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
6271
6202
|
})
|
|
6272
6203
|
};
|
|
6273
6204
|
|
|
6274
|
-
const
|
|
6275
|
-
|
|
6276
|
-
const {isFunction: isFunction$2} = utils$1;
|
|
6277
|
-
|
|
6278
|
-
const globalFetchAPI = (({Request, Response}) => ({
|
|
6279
|
-
Request, Response
|
|
6280
|
-
}))(utils$1.global);
|
|
6281
|
-
|
|
6282
|
-
const {
|
|
6283
|
-
ReadableStream: ReadableStream$1, TextEncoder
|
|
6284
|
-
} = utils$1.global;
|
|
6205
|
+
const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
|
|
6206
|
+
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
|
|
6285
6207
|
|
|
6208
|
+
// used only inside the fetch adapter
|
|
6209
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
6210
|
+
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
6211
|
+
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
|
6212
|
+
);
|
|
6286
6213
|
|
|
6287
6214
|
const test = (fn, ...args) => {
|
|
6288
6215
|
try {
|
|
@@ -6292,380 +6219,278 @@ const test = (fn, ...args) => {
|
|
|
6292
6219
|
}
|
|
6293
6220
|
};
|
|
6294
6221
|
|
|
6295
|
-
const
|
|
6296
|
-
|
|
6297
|
-
skipUndefined: true
|
|
6298
|
-
}, globalFetchAPI, env);
|
|
6299
|
-
|
|
6300
|
-
const {fetch: envFetch, Request, Response} = env;
|
|
6301
|
-
const isFetchSupported = envFetch ? isFunction$2(envFetch) : typeof fetch === 'function';
|
|
6302
|
-
const isRequestSupported = isFunction$2(Request);
|
|
6303
|
-
const isResponseSupported = isFunction$2(Response);
|
|
6304
|
-
|
|
6305
|
-
if (!isFetchSupported) {
|
|
6306
|
-
return false;
|
|
6307
|
-
}
|
|
6308
|
-
|
|
6309
|
-
const isReadableStreamSupported = isFetchSupported && isFunction$2(ReadableStream$1);
|
|
6310
|
-
|
|
6311
|
-
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
6312
|
-
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
6313
|
-
async (str) => new Uint8Array(await new Request(str).arrayBuffer())
|
|
6314
|
-
);
|
|
6315
|
-
|
|
6316
|
-
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
6317
|
-
let duplexAccessed = false;
|
|
6222
|
+
const supportsRequestStream = isReadableStreamSupported && test(() => {
|
|
6223
|
+
let duplexAccessed = false;
|
|
6318
6224
|
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6225
|
+
const hasContentType = new Request(platform$1.origin, {
|
|
6226
|
+
body: new ReadableStream(),
|
|
6227
|
+
method: 'POST',
|
|
6228
|
+
get duplex() {
|
|
6229
|
+
duplexAccessed = true;
|
|
6230
|
+
return 'half';
|
|
6231
|
+
},
|
|
6232
|
+
}).headers.has('Content-Type');
|
|
6327
6233
|
|
|
6328
|
-
|
|
6329
|
-
|
|
6234
|
+
return duplexAccessed && !hasContentType;
|
|
6235
|
+
});
|
|
6330
6236
|
|
|
6331
|
-
|
|
6332
|
-
test(() => utils$1.isReadableStream(new Response('').body));
|
|
6237
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
6333
6238
|
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
};
|
|
6239
|
+
const supportsResponseStream = isReadableStreamSupported &&
|
|
6240
|
+
test(() => utils$1.isReadableStream(new Response('').body));
|
|
6337
6241
|
|
|
6338
|
-
isFetchSupported && ((() => {
|
|
6339
|
-
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
6340
|
-
!resolvers[type] && (resolvers[type] = (res, config) => {
|
|
6341
|
-
let method = res && res[type];
|
|
6342
6242
|
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6243
|
+
const resolvers = {
|
|
6244
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
6245
|
+
};
|
|
6346
6246
|
|
|
6247
|
+
isFetchSupported && (((res) => {
|
|
6248
|
+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
6249
|
+
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
|
|
6250
|
+
(_, config) => {
|
|
6347
6251
|
throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
|
6348
6252
|
});
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
const getBodyLength = async (body) => {
|
|
6353
|
-
if (body == null) {
|
|
6354
|
-
return 0;
|
|
6355
|
-
}
|
|
6356
|
-
|
|
6357
|
-
if (utils$1.isBlob(body)) {
|
|
6358
|
-
return body.size;
|
|
6359
|
-
}
|
|
6360
|
-
|
|
6361
|
-
if (utils$1.isSpecCompliantForm(body)) {
|
|
6362
|
-
const _request = new Request(platform$1.origin, {
|
|
6363
|
-
method: 'POST',
|
|
6364
|
-
body,
|
|
6365
|
-
});
|
|
6366
|
-
return (await _request.arrayBuffer()).byteLength;
|
|
6367
|
-
}
|
|
6368
|
-
|
|
6369
|
-
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
6370
|
-
return body.byteLength;
|
|
6371
|
-
}
|
|
6372
|
-
|
|
6373
|
-
if (utils$1.isURLSearchParams(body)) {
|
|
6374
|
-
body = body + '';
|
|
6375
|
-
}
|
|
6376
|
-
|
|
6377
|
-
if (utils$1.isString(body)) {
|
|
6378
|
-
return (await encodeText(body)).byteLength;
|
|
6379
|
-
}
|
|
6380
|
-
};
|
|
6381
|
-
|
|
6382
|
-
const resolveBodyLength = async (headers, body) => {
|
|
6383
|
-
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
6384
|
-
|
|
6385
|
-
return length == null ? getBodyLength(body) : length;
|
|
6386
|
-
};
|
|
6387
|
-
|
|
6388
|
-
return async (config) => {
|
|
6389
|
-
let {
|
|
6390
|
-
url,
|
|
6391
|
-
method,
|
|
6392
|
-
data,
|
|
6393
|
-
signal,
|
|
6394
|
-
cancelToken,
|
|
6395
|
-
timeout,
|
|
6396
|
-
onDownloadProgress,
|
|
6397
|
-
onUploadProgress,
|
|
6398
|
-
responseType,
|
|
6399
|
-
headers,
|
|
6400
|
-
withCredentials = 'same-origin',
|
|
6401
|
-
fetchOptions
|
|
6402
|
-
} = resolveConfig(config);
|
|
6403
|
-
|
|
6404
|
-
let _fetch = envFetch || fetch;
|
|
6405
|
-
|
|
6406
|
-
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
6253
|
+
});
|
|
6254
|
+
})(new Response));
|
|
6407
6255
|
|
|
6408
|
-
|
|
6256
|
+
const getBodyLength = async (body) => {
|
|
6257
|
+
if (body == null) {
|
|
6258
|
+
return 0;
|
|
6259
|
+
}
|
|
6409
6260
|
|
|
6410
|
-
|
|
6261
|
+
if(utils$1.isBlob(body)) {
|
|
6262
|
+
return body.size;
|
|
6263
|
+
}
|
|
6411
6264
|
|
|
6412
|
-
|
|
6413
|
-
|
|
6265
|
+
if(utils$1.isSpecCompliantForm(body)) {
|
|
6266
|
+
const _request = new Request(platform$1.origin, {
|
|
6267
|
+
method: 'POST',
|
|
6268
|
+
body,
|
|
6414
6269
|
});
|
|
6270
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
6271
|
+
}
|
|
6415
6272
|
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
if (
|
|
6420
|
-
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
|
6421
|
-
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
6422
|
-
) {
|
|
6423
|
-
let _request = new Request(url, {
|
|
6424
|
-
method: 'POST',
|
|
6425
|
-
body: data,
|
|
6426
|
-
duplex: "half"
|
|
6427
|
-
});
|
|
6273
|
+
if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
6274
|
+
return body.byteLength;
|
|
6275
|
+
}
|
|
6428
6276
|
|
|
6429
|
-
|
|
6277
|
+
if(utils$1.isURLSearchParams(body)) {
|
|
6278
|
+
body = body + '';
|
|
6279
|
+
}
|
|
6430
6280
|
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6281
|
+
if(utils$1.isString(body)) {
|
|
6282
|
+
return (await encodeText(body)).byteLength;
|
|
6283
|
+
}
|
|
6284
|
+
};
|
|
6434
6285
|
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
requestContentLength,
|
|
6438
|
-
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
6439
|
-
);
|
|
6286
|
+
const resolveBodyLength = async (headers, body) => {
|
|
6287
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
6440
6288
|
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
}
|
|
6289
|
+
return length == null ? getBodyLength(body) : length;
|
|
6290
|
+
};
|
|
6444
6291
|
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6292
|
+
var fetchAdapter = isFetchSupported && (async (config) => {
|
|
6293
|
+
let {
|
|
6294
|
+
url,
|
|
6295
|
+
method,
|
|
6296
|
+
data,
|
|
6297
|
+
signal,
|
|
6298
|
+
cancelToken,
|
|
6299
|
+
timeout,
|
|
6300
|
+
onDownloadProgress,
|
|
6301
|
+
onUploadProgress,
|
|
6302
|
+
responseType,
|
|
6303
|
+
headers,
|
|
6304
|
+
withCredentials = 'same-origin',
|
|
6305
|
+
fetchOptions
|
|
6306
|
+
} = resolveConfig(config);
|
|
6307
|
+
|
|
6308
|
+
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
6309
|
+
|
|
6310
|
+
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
6311
|
+
|
|
6312
|
+
let request;
|
|
6313
|
+
|
|
6314
|
+
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
6315
|
+
composedSignal.unsubscribe();
|
|
6316
|
+
});
|
|
6448
6317
|
|
|
6449
|
-
|
|
6450
|
-
// see https://github.com/cloudflare/workerd/issues/902
|
|
6451
|
-
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
|
6318
|
+
let requestContentLength;
|
|
6452
6319
|
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6320
|
+
try {
|
|
6321
|
+
if (
|
|
6322
|
+
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
|
6323
|
+
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
6324
|
+
) {
|
|
6325
|
+
let _request = new Request(url, {
|
|
6326
|
+
method: 'POST',
|
|
6458
6327
|
body: data,
|
|
6459
|
-
duplex: "half"
|
|
6460
|
-
|
|
6461
|
-
};
|
|
6462
|
-
|
|
6463
|
-
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
6328
|
+
duplex: "half"
|
|
6329
|
+
});
|
|
6464
6330
|
|
|
6465
|
-
let
|
|
6331
|
+
let contentTypeHeader;
|
|
6466
6332
|
|
|
6467
|
-
|
|
6333
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
6334
|
+
headers.setContentType(contentTypeHeader);
|
|
6335
|
+
}
|
|
6468
6336
|
|
|
6469
|
-
if (
|
|
6470
|
-
const
|
|
6337
|
+
if (_request.body) {
|
|
6338
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
6339
|
+
requestContentLength,
|
|
6340
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
6341
|
+
);
|
|
6471
6342
|
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6343
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
6344
|
+
}
|
|
6345
|
+
}
|
|
6475
6346
|
|
|
6476
|
-
|
|
6347
|
+
if (!utils$1.isString(withCredentials)) {
|
|
6348
|
+
withCredentials = withCredentials ? 'include' : 'omit';
|
|
6349
|
+
}
|
|
6477
6350
|
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6351
|
+
// Cloudflare Workers throws when credentials are defined
|
|
6352
|
+
// see https://github.com/cloudflare/workerd/issues/902
|
|
6353
|
+
const isCredentialsSupported = "credentials" in Request.prototype;
|
|
6354
|
+
request = new Request(url, {
|
|
6355
|
+
...fetchOptions,
|
|
6356
|
+
signal: composedSignal,
|
|
6357
|
+
method: method.toUpperCase(),
|
|
6358
|
+
headers: headers.normalize().toJSON(),
|
|
6359
|
+
body: data,
|
|
6360
|
+
duplex: "half",
|
|
6361
|
+
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
6362
|
+
});
|
|
6482
6363
|
|
|
6483
|
-
|
|
6484
|
-
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
6485
|
-
flush && flush();
|
|
6486
|
-
unsubscribe && unsubscribe();
|
|
6487
|
-
}),
|
|
6488
|
-
options
|
|
6489
|
-
);
|
|
6490
|
-
}
|
|
6364
|
+
let response = await fetch(request, fetchOptions);
|
|
6491
6365
|
|
|
6492
|
-
|
|
6366
|
+
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
6493
6367
|
|
|
6494
|
-
|
|
6368
|
+
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
6369
|
+
const options = {};
|
|
6495
6370
|
|
|
6496
|
-
|
|
6371
|
+
['status', 'statusText', 'headers'].forEach(prop => {
|
|
6372
|
+
options[prop] = response[prop];
|
|
6373
|
+
});
|
|
6497
6374
|
|
|
6498
|
-
|
|
6499
|
-
settle(resolve, reject, {
|
|
6500
|
-
data: responseData,
|
|
6501
|
-
headers: AxiosHeaders$1.from(response.headers),
|
|
6502
|
-
status: response.status,
|
|
6503
|
-
statusText: response.statusText,
|
|
6504
|
-
config,
|
|
6505
|
-
request
|
|
6506
|
-
});
|
|
6507
|
-
})
|
|
6508
|
-
} catch (err) {
|
|
6509
|
-
unsubscribe && unsubscribe();
|
|
6375
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
6510
6376
|
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
cause: err.cause || err
|
|
6516
|
-
}
|
|
6517
|
-
)
|
|
6518
|
-
}
|
|
6377
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
6378
|
+
responseContentLength,
|
|
6379
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
6380
|
+
) || [];
|
|
6519
6381
|
|
|
6520
|
-
|
|
6382
|
+
response = new Response(
|
|
6383
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
6384
|
+
flush && flush();
|
|
6385
|
+
unsubscribe && unsubscribe();
|
|
6386
|
+
}),
|
|
6387
|
+
options
|
|
6388
|
+
);
|
|
6521
6389
|
}
|
|
6522
|
-
}
|
|
6523
|
-
};
|
|
6524
6390
|
|
|
6525
|
-
|
|
6391
|
+
responseType = responseType || 'text';
|
|
6526
6392
|
|
|
6527
|
-
|
|
6528
|
-
let env = (config && config.env) || {};
|
|
6529
|
-
const {fetch, Request, Response} = env;
|
|
6530
|
-
const seeds = [
|
|
6531
|
-
Request, Response, fetch
|
|
6532
|
-
];
|
|
6393
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
6533
6394
|
|
|
6534
|
-
|
|
6535
|
-
seed, target, map = seedCache;
|
|
6395
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
6536
6396
|
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6397
|
+
return await new Promise((resolve, reject) => {
|
|
6398
|
+
settle(resolve, reject, {
|
|
6399
|
+
data: responseData,
|
|
6400
|
+
headers: AxiosHeaders$1.from(response.headers),
|
|
6401
|
+
status: response.status,
|
|
6402
|
+
statusText: response.statusText,
|
|
6403
|
+
config,
|
|
6404
|
+
request
|
|
6405
|
+
});
|
|
6406
|
+
})
|
|
6407
|
+
} catch (err) {
|
|
6408
|
+
unsubscribe && unsubscribe();
|
|
6540
6409
|
|
|
6541
|
-
|
|
6410
|
+
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
6411
|
+
throw Object.assign(
|
|
6412
|
+
new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
|
|
6413
|
+
{
|
|
6414
|
+
cause: err.cause || err
|
|
6415
|
+
}
|
|
6416
|
+
)
|
|
6417
|
+
}
|
|
6542
6418
|
|
|
6543
|
-
|
|
6419
|
+
throw AxiosError$1.from(err, err && err.code, config, request);
|
|
6544
6420
|
}
|
|
6421
|
+
});
|
|
6545
6422
|
|
|
6546
|
-
return target;
|
|
6547
|
-
};
|
|
6548
|
-
|
|
6549
|
-
getFetch();
|
|
6550
|
-
|
|
6551
|
-
/**
|
|
6552
|
-
* Known adapters mapping.
|
|
6553
|
-
* Provides environment-specific adapters for Axios:
|
|
6554
|
-
* - `http` for Node.js
|
|
6555
|
-
* - `xhr` for browsers
|
|
6556
|
-
* - `fetch` for fetch API-based requests
|
|
6557
|
-
*
|
|
6558
|
-
* @type {Object<string, Function|Object>}
|
|
6559
|
-
*/
|
|
6560
6423
|
const knownAdapters = {
|
|
6561
6424
|
http: httpAdapter,
|
|
6562
6425
|
xhr: xhrAdapter,
|
|
6563
|
-
fetch:
|
|
6564
|
-
get: getFetch,
|
|
6565
|
-
}
|
|
6426
|
+
fetch: fetchAdapter
|
|
6566
6427
|
};
|
|
6567
6428
|
|
|
6568
|
-
// Assign adapter names for easier debugging and identification
|
|
6569
6429
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
6570
6430
|
if (fn) {
|
|
6571
6431
|
try {
|
|
6572
|
-
Object.defineProperty(fn, 'name', {
|
|
6432
|
+
Object.defineProperty(fn, 'name', {value});
|
|
6573
6433
|
} catch (e) {
|
|
6574
6434
|
// eslint-disable-next-line no-empty
|
|
6575
6435
|
}
|
|
6576
|
-
Object.defineProperty(fn, 'adapterName', {
|
|
6436
|
+
Object.defineProperty(fn, 'adapterName', {value});
|
|
6577
6437
|
}
|
|
6578
6438
|
});
|
|
6579
6439
|
|
|
6580
|
-
/**
|
|
6581
|
-
* Render a rejection reason string for unknown or unsupported adapters
|
|
6582
|
-
*
|
|
6583
|
-
* @param {string} reason
|
|
6584
|
-
* @returns {string}
|
|
6585
|
-
*/
|
|
6586
6440
|
const renderReason = (reason) => `- ${reason}`;
|
|
6587
6441
|
|
|
6588
|
-
/**
|
|
6589
|
-
* Check if the adapter is resolved (function, null, or false)
|
|
6590
|
-
*
|
|
6591
|
-
* @param {Function|null|false} adapter
|
|
6592
|
-
* @returns {boolean}
|
|
6593
|
-
*/
|
|
6594
6442
|
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
6595
6443
|
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
* Throws an AxiosError if no adapter is suitable.
|
|
6600
|
-
*
|
|
6601
|
-
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
|
|
6602
|
-
* @param {Object} config - Axios request configuration
|
|
6603
|
-
* @throws {AxiosError} If no suitable adapter is available
|
|
6604
|
-
* @returns {Function} The resolved adapter function
|
|
6605
|
-
*/
|
|
6606
|
-
function getAdapter$1(adapters, config) {
|
|
6607
|
-
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
6444
|
+
var adapters = {
|
|
6445
|
+
getAdapter: (adapters) => {
|
|
6446
|
+
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
6608
6447
|
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6448
|
+
const {length} = adapters;
|
|
6449
|
+
let nameOrAdapter;
|
|
6450
|
+
let adapter;
|
|
6612
6451
|
|
|
6613
|
-
|
|
6452
|
+
const rejectedReasons = {};
|
|
6614
6453
|
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6454
|
+
for (let i = 0; i < length; i++) {
|
|
6455
|
+
nameOrAdapter = adapters[i];
|
|
6456
|
+
let id;
|
|
6618
6457
|
|
|
6619
|
-
|
|
6458
|
+
adapter = nameOrAdapter;
|
|
6620
6459
|
|
|
6621
|
-
|
|
6622
|
-
|
|
6460
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
6461
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
6623
6462
|
|
|
6624
|
-
|
|
6625
|
-
|
|
6463
|
+
if (adapter === undefined) {
|
|
6464
|
+
throw new AxiosError$1(`Unknown adapter '${id}'`);
|
|
6465
|
+
}
|
|
6626
6466
|
}
|
|
6627
|
-
}
|
|
6628
|
-
|
|
6629
|
-
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
6630
|
-
break;
|
|
6631
|
-
}
|
|
6632
6467
|
|
|
6633
|
-
|
|
6634
|
-
|
|
6468
|
+
if (adapter) {
|
|
6469
|
+
break;
|
|
6470
|
+
}
|
|
6635
6471
|
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
.map(([id, state]) => `adapter ${id} ` +
|
|
6639
|
-
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
6640
|
-
);
|
|
6472
|
+
rejectedReasons[id || '#' + i] = adapter;
|
|
6473
|
+
}
|
|
6641
6474
|
|
|
6642
|
-
|
|
6643
|
-
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
|
6644
|
-
'as no adapter specified';
|
|
6475
|
+
if (!adapter) {
|
|
6645
6476
|
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
}
|
|
6477
|
+
const reasons = Object.entries(rejectedReasons)
|
|
6478
|
+
.map(([id, state]) => `adapter ${id} ` +
|
|
6479
|
+
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
6480
|
+
);
|
|
6651
6481
|
|
|
6652
|
-
|
|
6653
|
-
|
|
6482
|
+
let s = length ?
|
|
6483
|
+
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
|
6484
|
+
'as no adapter specified';
|
|
6654
6485
|
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
* Resolve an adapter from a list of adapter names or functions.
|
|
6661
|
-
* @type {Function}
|
|
6662
|
-
*/
|
|
6663
|
-
getAdapter: getAdapter$1,
|
|
6486
|
+
throw new AxiosError$1(
|
|
6487
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
|
6488
|
+
'ERR_NOT_SUPPORT'
|
|
6489
|
+
);
|
|
6490
|
+
}
|
|
6664
6491
|
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
* @type {Object<string, Function|Object>}
|
|
6668
|
-
*/
|
|
6492
|
+
return adapter;
|
|
6493
|
+
},
|
|
6669
6494
|
adapters: knownAdapters
|
|
6670
6495
|
};
|
|
6671
6496
|
|
|
@@ -6708,7 +6533,7 @@ function dispatchRequest(config) {
|
|
|
6708
6533
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
6709
6534
|
}
|
|
6710
6535
|
|
|
6711
|
-
const adapter = adapters.getAdapter(config.adapter || defaults.adapter
|
|
6536
|
+
const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
|
|
6712
6537
|
|
|
6713
6538
|
return adapter(config).then(function onAdapterResolution(response) {
|
|
6714
6539
|
throwIfCancellationRequested(config);
|
|
@@ -6742,7 +6567,7 @@ function dispatchRequest(config) {
|
|
|
6742
6567
|
});
|
|
6743
6568
|
}
|
|
6744
6569
|
|
|
6745
|
-
const VERSION$1 = "1.
|
|
6570
|
+
const VERSION$1 = "1.10.0";
|
|
6746
6571
|
|
|
6747
6572
|
const validators$1 = {};
|
|
6748
6573
|
|
|
@@ -6981,8 +6806,8 @@ let Axios$1 = class Axios {
|
|
|
6981
6806
|
|
|
6982
6807
|
if (!synchronousRequestInterceptors) {
|
|
6983
6808
|
const chain = [dispatchRequest.bind(this), undefined];
|
|
6984
|
-
chain.unshift(
|
|
6985
|
-
chain.push(
|
|
6809
|
+
chain.unshift.apply(chain, requestInterceptorChain);
|
|
6810
|
+
chain.push.apply(chain, responseInterceptorChain);
|
|
6986
6811
|
len = chain.length;
|
|
6987
6812
|
|
|
6988
6813
|
promise = Promise.resolve(config);
|
|
@@ -6998,6 +6823,8 @@ let Axios$1 = class Axios {
|
|
|
6998
6823
|
|
|
6999
6824
|
let newConfig = config;
|
|
7000
6825
|
|
|
6826
|
+
i = 0;
|
|
6827
|
+
|
|
7001
6828
|
while (i < len) {
|
|
7002
6829
|
const onFulfilled = requestInterceptorChain[i++];
|
|
7003
6830
|
const onRejected = requestInterceptorChain[i++];
|
|
@@ -7297,12 +7124,6 @@ const HttpStatusCode$1 = {
|
|
|
7297
7124
|
LoopDetected: 508,
|
|
7298
7125
|
NotExtended: 510,
|
|
7299
7126
|
NetworkAuthenticationRequired: 511,
|
|
7300
|
-
WebServerIsDown: 521,
|
|
7301
|
-
ConnectionTimedOut: 522,
|
|
7302
|
-
OriginIsUnreachable: 523,
|
|
7303
|
-
TimeoutOccurred: 524,
|
|
7304
|
-
SslHandshakeFailed: 525,
|
|
7305
|
-
InvalidSslCertificate: 526,
|
|
7306
7127
|
};
|
|
7307
7128
|
|
|
7308
7129
|
Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
|
|
@@ -7642,9 +7463,8 @@ class ZodError extends Error {
|
|
|
7642
7463
|
const formErrors = [];
|
|
7643
7464
|
for (const sub of this.issues) {
|
|
7644
7465
|
if (sub.path.length > 0) {
|
|
7645
|
-
|
|
7646
|
-
fieldErrors[
|
|
7647
|
-
fieldErrors[firstEl].push(mapper(sub));
|
|
7466
|
+
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
7467
|
+
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
7648
7468
|
}
|
|
7649
7469
|
else {
|
|
7650
7470
|
formErrors.push(mapper(sub));
|
|
@@ -7728,8 +7548,6 @@ const errorMap = (issue, _ctx) => {
|
|
|
7728
7548
|
message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
|
|
7729
7549
|
else if (issue.type === "number")
|
|
7730
7550
|
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
7731
|
-
else if (issue.type === "bigint")
|
|
7732
|
-
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
7733
7551
|
else if (issue.type === "date")
|
|
7734
7552
|
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
|
|
7735
7553
|
else
|
|
@@ -8327,8 +8145,6 @@ function isValidJWT(jwt, alg) {
|
|
|
8327
8145
|
return false;
|
|
8328
8146
|
try {
|
|
8329
8147
|
const [header] = jwt.split(".");
|
|
8330
|
-
if (!header)
|
|
8331
|
-
return false;
|
|
8332
8148
|
// Convert base64url to base64
|
|
8333
8149
|
const base64 = header
|
|
8334
8150
|
.replace(/-/g, "+")
|
|
@@ -12293,41 +12109,29 @@ var createApiClient = (apiKey, proxy) => {
|
|
|
12293
12109
|
baseURL: proxy ?? API_BASE_URL,
|
|
12294
12110
|
headers: {
|
|
12295
12111
|
"Content-Type": "application/json",
|
|
12296
|
-
Authorization: `Bearer ${apiKey}
|
|
12297
|
-
"Access-Control-Allow-Origin": "*",
|
|
12298
|
-
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
|
|
12299
|
-
"Access-Control-Allow-Headers": "Content-Type, Authorization"
|
|
12112
|
+
Authorization: `Bearer ${apiKey}`
|
|
12300
12113
|
}
|
|
12301
12114
|
});
|
|
12115
|
+
if (process.env.NODE_ENV === "development") {
|
|
12116
|
+
client.interceptors.request.use((config) => {
|
|
12117
|
+
console.log("Request method:", config.method);
|
|
12118
|
+
console.log("Request URL:", config.url);
|
|
12119
|
+
console.log("Request headers:", config.headers);
|
|
12120
|
+
console.log("Request body:", config.data);
|
|
12121
|
+
return config;
|
|
12122
|
+
});
|
|
12123
|
+
}
|
|
12302
12124
|
client.interceptors.response.use(
|
|
12303
12125
|
(response) => response.data,
|
|
12304
12126
|
(error) => {
|
|
12305
12127
|
const apiError = {
|
|
12306
12128
|
isError: true,
|
|
12307
|
-
status: 500,
|
|
12308
|
-
message:
|
|
12129
|
+
status: error.response?.status ?? 500,
|
|
12130
|
+
message: error.response?.data?.error || error.message || "Unknown error",
|
|
12131
|
+
code: error.response?.data?.code,
|
|
12132
|
+
details: error.response?.data
|
|
12309
12133
|
};
|
|
12310
|
-
|
|
12311
|
-
apiError.status = error.response.status;
|
|
12312
|
-
apiError.message = error.response.data?.error || "Server error occurred";
|
|
12313
|
-
apiError.code = error.response.data?.code;
|
|
12314
|
-
apiError.details = error.response.data;
|
|
12315
|
-
} else if (error.request) {
|
|
12316
|
-
apiError.status = 503;
|
|
12317
|
-
apiError.message = "Service unavailable - no response from server";
|
|
12318
|
-
apiError.code = "SERVICE_UNAVAILABLE";
|
|
12319
|
-
apiError.details = error;
|
|
12320
|
-
} else {
|
|
12321
|
-
apiError.status = 500;
|
|
12322
|
-
apiError.message = "Request configuration error";
|
|
12323
|
-
apiError.code = "REQUEST_SETUP_ERROR";
|
|
12324
|
-
apiError.details = error;
|
|
12325
|
-
}
|
|
12326
|
-
console.error("API ERROR: ", apiError);
|
|
12327
|
-
if (apiError.code === "REQUEST_SETUP_ERROR" || apiError.code === "SERVICE_UNAVAILABLE") {
|
|
12328
|
-
throw apiError;
|
|
12329
|
-
}
|
|
12330
|
-
return apiError;
|
|
12134
|
+
throw apiError;
|
|
12331
12135
|
}
|
|
12332
12136
|
);
|
|
12333
12137
|
return client;
|
|
@@ -12358,9 +12162,9 @@ var Client = class {
|
|
|
12358
12162
|
*/
|
|
12359
12163
|
async updateCheckout(clientSecret, checkoutId, params) {
|
|
12360
12164
|
const apiClient = createApiClient(clientSecret, this.proxy);
|
|
12361
|
-
const data = await apiClient.
|
|
12362
|
-
`/checkout/${checkoutId}`,
|
|
12363
|
-
params
|
|
12165
|
+
const data = await apiClient.post(
|
|
12166
|
+
`/checkout/${checkoutId}/update`,
|
|
12167
|
+
{ ...params }
|
|
12364
12168
|
);
|
|
12365
12169
|
if ("isError" in data && data.isError || !data || !("id" in data)) {
|
|
12366
12170
|
console.error(`Checkout session with id ${checkoutId} not found`);
|
|
@@ -13183,7 +12987,6 @@ const Toast = (props)=>{
|
|
|
13183
12987
|
"data-swipe-out": swipeOut,
|
|
13184
12988
|
"data-swipe-direction": swipeOutDirection,
|
|
13185
12989
|
"data-expanded": Boolean(expanded || expandByDefault && mounted),
|
|
13186
|
-
"data-testid": toast.testId,
|
|
13187
12990
|
style: {
|
|
13188
12991
|
'--index': index,
|
|
13189
12992
|
'--toasts-before': index,
|
|
@@ -13199,7 +13002,6 @@ const Toast = (props)=>{
|
|
|
13199
13002
|
pointerStartRef.current = null;
|
|
13200
13003
|
},
|
|
13201
13004
|
onPointerDown: (event)=>{
|
|
13202
|
-
if (event.button === 2) return; // Return early on right click
|
|
13203
13005
|
if (disabled || !dismissible) return;
|
|
13204
13006
|
dragStartTime.current = new Date();
|
|
13205
13007
|
setOffsetBeforeRemove(offset.current);
|
|
@@ -13392,26 +13194,17 @@ function assignOffset(defaultOffset, mobileOffset) {
|
|
|
13392
13194
|
return styles;
|
|
13393
13195
|
}
|
|
13394
13196
|
const Toaster$1 = /*#__PURE__*/ React.forwardRef(function Toaster(props, ref) {
|
|
13395
|
-
const {
|
|
13197
|
+
const { invert, position = 'bottom-right', hotkey = [
|
|
13396
13198
|
'altKey',
|
|
13397
13199
|
'KeyT'
|
|
13398
13200
|
], expand, closeButton, className, offset, mobileOffset, theme = 'light', richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = 'Notifications' } = props;
|
|
13399
13201
|
const [toasts, setToasts] = React.useState([]);
|
|
13400
|
-
const filteredToasts = React.useMemo(()=>{
|
|
13401
|
-
if (id) {
|
|
13402
|
-
return toasts.filter((toast)=>toast.toasterId === id);
|
|
13403
|
-
}
|
|
13404
|
-
return toasts.filter((toast)=>!toast.toasterId);
|
|
13405
|
-
}, [
|
|
13406
|
-
toasts,
|
|
13407
|
-
id
|
|
13408
|
-
]);
|
|
13409
13202
|
const possiblePositions = React.useMemo(()=>{
|
|
13410
13203
|
return Array.from(new Set([
|
|
13411
13204
|
position
|
|
13412
|
-
].concat(
|
|
13205
|
+
].concat(toasts.filter((toast)=>toast.position).map((toast)=>toast.position))));
|
|
13413
13206
|
}, [
|
|
13414
|
-
|
|
13207
|
+
toasts,
|
|
13415
13208
|
position
|
|
13416
13209
|
]);
|
|
13417
13210
|
const [heights, setHeights] = React.useState([]);
|
|
@@ -13566,7 +13359,7 @@ const Toaster$1 = /*#__PURE__*/ React.forwardRef(function Toaster(props, ref) {
|
|
|
13566
13359
|
}, possiblePositions.map((position, index)=>{
|
|
13567
13360
|
var _heights_;
|
|
13568
13361
|
const [y, x] = position.split('-');
|
|
13569
|
-
if (!
|
|
13362
|
+
if (!toasts.length) return null;
|
|
13570
13363
|
return /*#__PURE__*/ React.createElement("ol", {
|
|
13571
13364
|
key: position,
|
|
13572
13365
|
dir: dir === 'auto' ? getDocumentDirection() : dir,
|
|
@@ -13618,7 +13411,7 @@ const Toaster$1 = /*#__PURE__*/ React.forwardRef(function Toaster(props, ref) {
|
|
|
13618
13411
|
setInteracting(true);
|
|
13619
13412
|
},
|
|
13620
13413
|
onPointerUp: ()=>setInteracting(false)
|
|
13621
|
-
},
|
|
13414
|
+
}, toasts.filter((toast)=>!toast.position && index === 0 || toast.position === position).map((toast, index)=>{
|
|
13622
13415
|
var _toastOptions_duration, _toastOptions_closeButton;
|
|
13623
13416
|
return /*#__PURE__*/ React.createElement(Toast, {
|
|
13624
13417
|
key: toast.id,
|
|
@@ -13641,7 +13434,7 @@ const Toaster$1 = /*#__PURE__*/ React.forwardRef(function Toaster(props, ref) {
|
|
|
13641
13434
|
actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle,
|
|
13642
13435
|
closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel,
|
|
13643
13436
|
removeToast: removeToast,
|
|
13644
|
-
toasts:
|
|
13437
|
+
toasts: toasts.filter((t)=>t.position == toast.position),
|
|
13645
13438
|
heights: heights.filter((h)=>h.position == toast.position),
|
|
13646
13439
|
setHeights: setHeights,
|
|
13647
13440
|
expandByDefault: expand,
|
|
@@ -13746,24 +13539,13 @@ function useComposedRefs(...refs) {
|
|
|
13746
13539
|
}
|
|
13747
13540
|
|
|
13748
13541
|
// src/slot.tsx
|
|
13749
|
-
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
13750
|
-
var use = React__namespace[" use ".trim().toString()];
|
|
13751
|
-
function isPromiseLike(value) {
|
|
13752
|
-
return typeof value === "object" && value !== null && "then" in value;
|
|
13753
|
-
}
|
|
13754
|
-
function isLazyComponent(element) {
|
|
13755
|
-
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
13756
|
-
}
|
|
13757
13542
|
// @__NO_SIDE_EFFECTS__
|
|
13758
|
-
function createSlot
|
|
13759
|
-
const SlotClone = /* @__PURE__ */ createSlotClone
|
|
13543
|
+
function createSlot(ownerName) {
|
|
13544
|
+
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
13760
13545
|
const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
13761
|
-
|
|
13762
|
-
if (isLazyComponent(children) && typeof use === "function") {
|
|
13763
|
-
children = use(children._payload);
|
|
13764
|
-
}
|
|
13546
|
+
const { children, ...slotProps } = props;
|
|
13765
13547
|
const childrenArray = React__namespace.Children.toArray(children);
|
|
13766
|
-
const slottable = childrenArray.find(isSlottable
|
|
13548
|
+
const slottable = childrenArray.find(isSlottable);
|
|
13767
13549
|
if (slottable) {
|
|
13768
13550
|
const newElement = slottable.props.children;
|
|
13769
13551
|
const newChildren = childrenArray.map((child) => {
|
|
@@ -13781,17 +13563,14 @@ function createSlot$1(ownerName) {
|
|
|
13781
13563
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
13782
13564
|
return Slot2;
|
|
13783
13565
|
}
|
|
13784
|
-
var Slot$2 = /* @__PURE__ */ createSlot
|
|
13566
|
+
var Slot$2 = /* @__PURE__ */ createSlot("Slot");
|
|
13785
13567
|
// @__NO_SIDE_EFFECTS__
|
|
13786
|
-
function createSlotClone
|
|
13568
|
+
function createSlotClone(ownerName) {
|
|
13787
13569
|
const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
|
|
13788
|
-
|
|
13789
|
-
if (isLazyComponent(children) && typeof use === "function") {
|
|
13790
|
-
children = use(children._payload);
|
|
13791
|
-
}
|
|
13570
|
+
const { children, ...slotProps } = props;
|
|
13792
13571
|
if (React__namespace.isValidElement(children)) {
|
|
13793
|
-
const childrenRef = getElementRef$
|
|
13794
|
-
const props2 = mergeProps
|
|
13572
|
+
const childrenRef = getElementRef$1(children);
|
|
13573
|
+
const props2 = mergeProps(slotProps, children.props);
|
|
13795
13574
|
if (children.type !== React__namespace.Fragment) {
|
|
13796
13575
|
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
13797
13576
|
}
|
|
@@ -13802,11 +13581,11 @@ function createSlotClone$1(ownerName) {
|
|
|
13802
13581
|
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
13803
13582
|
return SlotClone;
|
|
13804
13583
|
}
|
|
13805
|
-
var SLOTTABLE_IDENTIFIER
|
|
13806
|
-
function isSlottable
|
|
13807
|
-
return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER
|
|
13584
|
+
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
13585
|
+
function isSlottable(child) {
|
|
13586
|
+
return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
13808
13587
|
}
|
|
13809
|
-
function mergeProps
|
|
13588
|
+
function mergeProps(slotProps, childProps) {
|
|
13810
13589
|
const overrideProps = { ...childProps };
|
|
13811
13590
|
for (const propName in childProps) {
|
|
13812
13591
|
const slotPropValue = slotProps[propName];
|
|
@@ -13830,7 +13609,7 @@ function mergeProps$1(slotProps, childProps) {
|
|
|
13830
13609
|
}
|
|
13831
13610
|
return { ...slotProps, ...overrideProps };
|
|
13832
13611
|
}
|
|
13833
|
-
function getElementRef$
|
|
13612
|
+
function getElementRef$1(element) {
|
|
13834
13613
|
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
13835
13614
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
13836
13615
|
if (mayWarn) {
|
|
@@ -13882,9 +13661,12 @@ function cloneObject(data) {
|
|
|
13882
13661
|
if (data instanceof Date) {
|
|
13883
13662
|
copy = new Date(data);
|
|
13884
13663
|
}
|
|
13664
|
+
else if (data instanceof Set) {
|
|
13665
|
+
copy = new Set(data);
|
|
13666
|
+
}
|
|
13885
13667
|
else if (!(isWeb && (data instanceof Blob || isFileListInstance)) &&
|
|
13886
13668
|
(isArray || isObject(data))) {
|
|
13887
|
-
copy = isArray ? [] :
|
|
13669
|
+
copy = isArray ? [] : {};
|
|
13888
13670
|
if (!isArray && !isPlainObject(data)) {
|
|
13889
13671
|
copy = data;
|
|
13890
13672
|
}
|
|
@@ -14005,7 +13787,7 @@ HookFormContext.displayName = 'HookFormContext';
|
|
|
14005
13787
|
*/
|
|
14006
13788
|
const useFormContext = () => React.useContext(HookFormContext);
|
|
14007
13789
|
/**
|
|
14008
|
-
* A provider component that propagates the `useForm` methods to all children components via [React Context](https://
|
|
13790
|
+
* A provider component that propagates the `useForm` methods to all children components via [React Context](https://reactjs.org/docs/context.html) API. To be used with {@link useFormContext}.
|
|
14009
13791
|
*
|
|
14010
13792
|
* @remarks
|
|
14011
13793
|
* [API](https://react-hook-form.com/docs/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)
|
|
@@ -14058,7 +13840,7 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
|
|
|
14058
13840
|
return result;
|
|
14059
13841
|
};
|
|
14060
13842
|
|
|
14061
|
-
const useIsomorphicLayoutEffect$1 = typeof window !== 'undefined' ?
|
|
13843
|
+
const useIsomorphicLayoutEffect$1 = typeof window !== 'undefined' ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
14062
13844
|
|
|
14063
13845
|
/**
|
|
14064
13846
|
* This custom hook allows you to subscribe to each form state, and isolate the re-render at the custom hook level. It has its scope in terms of form state subscription, so it would not affect other useFormState and useForm. Using this hook can reduce the re-render impact on large and complex form application.
|
|
@@ -14130,51 +13912,12 @@ var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) =>
|
|
|
14130
13912
|
return get(formValues, names, defaultValue);
|
|
14131
13913
|
}
|
|
14132
13914
|
if (Array.isArray(names)) {
|
|
14133
|
-
return names.map((fieldName) => (isGlobal && _names.watch.add(fieldName),
|
|
14134
|
-
get(formValues, fieldName)));
|
|
13915
|
+
return names.map((fieldName) => (isGlobal && _names.watch.add(fieldName), get(formValues, fieldName)));
|
|
14135
13916
|
}
|
|
14136
13917
|
isGlobal && (_names.watchAll = true);
|
|
14137
13918
|
return formValues;
|
|
14138
13919
|
};
|
|
14139
13920
|
|
|
14140
|
-
var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
|
|
14141
|
-
|
|
14142
|
-
function deepEqual$1(object1, object2, _internal_visited = new WeakSet()) {
|
|
14143
|
-
if (isPrimitive(object1) || isPrimitive(object2)) {
|
|
14144
|
-
return Object.is(object1, object2);
|
|
14145
|
-
}
|
|
14146
|
-
if (isDateObject(object1) && isDateObject(object2)) {
|
|
14147
|
-
return object1.getTime() === object2.getTime();
|
|
14148
|
-
}
|
|
14149
|
-
const keys1 = Object.keys(object1);
|
|
14150
|
-
const keys2 = Object.keys(object2);
|
|
14151
|
-
if (keys1.length !== keys2.length) {
|
|
14152
|
-
return false;
|
|
14153
|
-
}
|
|
14154
|
-
if (_internal_visited.has(object1) || _internal_visited.has(object2)) {
|
|
14155
|
-
return true;
|
|
14156
|
-
}
|
|
14157
|
-
_internal_visited.add(object1);
|
|
14158
|
-
_internal_visited.add(object2);
|
|
14159
|
-
for (const key of keys1) {
|
|
14160
|
-
const val1 = object1[key];
|
|
14161
|
-
if (!keys2.includes(key)) {
|
|
14162
|
-
return false;
|
|
14163
|
-
}
|
|
14164
|
-
if (key !== 'ref') {
|
|
14165
|
-
const val2 = object2[key];
|
|
14166
|
-
if ((isDateObject(val1) && isDateObject(val2)) ||
|
|
14167
|
-
(isObject(val1) && isObject(val2)) ||
|
|
14168
|
-
(Array.isArray(val1) && Array.isArray(val2))
|
|
14169
|
-
? !deepEqual$1(val1, val2, _internal_visited)
|
|
14170
|
-
: !Object.is(val1, val2)) {
|
|
14171
|
-
return false;
|
|
14172
|
-
}
|
|
14173
|
-
}
|
|
14174
|
-
}
|
|
14175
|
-
return true;
|
|
14176
|
-
}
|
|
14177
|
-
|
|
14178
13921
|
/**
|
|
14179
13922
|
* Custom hook to subscribe to field change and isolate re-rendering at the component level.
|
|
14180
13923
|
*
|
|
@@ -14193,72 +13936,20 @@ function deepEqual$1(object1, object2, _internal_visited = new WeakSet()) {
|
|
|
14193
13936
|
*/
|
|
14194
13937
|
function useWatch(props) {
|
|
14195
13938
|
const methods = useFormContext();
|
|
14196
|
-
const { control = methods.control, name, defaultValue, disabled, exact,
|
|
13939
|
+
const { control = methods.control, name, defaultValue, disabled, exact, } = props || {};
|
|
14197
13940
|
const _defaultValue = React.useRef(defaultValue);
|
|
14198
|
-
const
|
|
14199
|
-
|
|
14200
|
-
|
|
14201
|
-
|
|
14202
|
-
|
|
14203
|
-
|
|
14204
|
-
|
|
14205
|
-
|
|
14206
|
-
|
|
14207
|
-
|
|
14208
|
-
const formValues = generateWatchOutput(name, control._names, values || control._formValues, false, _defaultValue.current);
|
|
14209
|
-
return _compute.current ? _compute.current(formValues) : formValues;
|
|
14210
|
-
}, [control._formValues, control._names, name]);
|
|
14211
|
-
const refreshValue = React.useCallback((values) => {
|
|
14212
|
-
if (!disabled) {
|
|
14213
|
-
const formValues = generateWatchOutput(name, control._names, values || control._formValues, false, _defaultValue.current);
|
|
14214
|
-
if (_compute.current) {
|
|
14215
|
-
const computedFormValues = _compute.current(formValues);
|
|
14216
|
-
if (!deepEqual$1(computedFormValues, _computeFormValues.current)) {
|
|
14217
|
-
updateValue(computedFormValues);
|
|
14218
|
-
_computeFormValues.current = computedFormValues;
|
|
14219
|
-
}
|
|
14220
|
-
}
|
|
14221
|
-
else {
|
|
14222
|
-
updateValue(formValues);
|
|
14223
|
-
}
|
|
14224
|
-
}
|
|
14225
|
-
}, [control._formValues, control._names, disabled, name]);
|
|
14226
|
-
useIsomorphicLayoutEffect$1(() => {
|
|
14227
|
-
if (_prevControl.current !== control ||
|
|
14228
|
-
!deepEqual$1(_prevName.current, name)) {
|
|
14229
|
-
_prevControl.current = control;
|
|
14230
|
-
_prevName.current = name;
|
|
14231
|
-
refreshValue();
|
|
14232
|
-
}
|
|
14233
|
-
return control._subscribe({
|
|
14234
|
-
name,
|
|
14235
|
-
formState: {
|
|
14236
|
-
values: true,
|
|
14237
|
-
},
|
|
14238
|
-
exact,
|
|
14239
|
-
callback: (formState) => {
|
|
14240
|
-
refreshValue(formState.values);
|
|
14241
|
-
},
|
|
14242
|
-
});
|
|
14243
|
-
}, [control, exact, name, refreshValue]);
|
|
13941
|
+
const [value, updateValue] = React.useState(control._getWatch(name, _defaultValue.current));
|
|
13942
|
+
useIsomorphicLayoutEffect$1(() => control._subscribe({
|
|
13943
|
+
name,
|
|
13944
|
+
formState: {
|
|
13945
|
+
values: true,
|
|
13946
|
+
},
|
|
13947
|
+
exact,
|
|
13948
|
+
callback: (formState) => !disabled &&
|
|
13949
|
+
updateValue(generateWatchOutput(name, control._names, formState.values || control._formValues, false, _defaultValue.current)),
|
|
13950
|
+
}), [name, control, disabled, exact]);
|
|
14244
13951
|
React.useEffect(() => control._removeUnmounted());
|
|
14245
|
-
|
|
14246
|
-
// latest value so callers (like useController) see the correct value
|
|
14247
|
-
// immediately on the same render.
|
|
14248
|
-
// Optimize: Check control reference first before expensive deepEqual
|
|
14249
|
-
const controlChanged = _prevControl.current !== control;
|
|
14250
|
-
const prevName = _prevName.current;
|
|
14251
|
-
// Cache the computed output to avoid duplicate calls within the same render
|
|
14252
|
-
// We include shouldReturnImmediate in deps to ensure proper recomputation
|
|
14253
|
-
const computedOutput = React.useMemo(() => {
|
|
14254
|
-
if (disabled) {
|
|
14255
|
-
return null;
|
|
14256
|
-
}
|
|
14257
|
-
const nameChanged = !controlChanged && !deepEqual$1(prevName, name);
|
|
14258
|
-
const shouldReturnImmediate = controlChanged || nameChanged;
|
|
14259
|
-
return shouldReturnImmediate ? getCurrentOutput() : null;
|
|
14260
|
-
}, [disabled, controlChanged, name, prevName, getCurrentOutput]);
|
|
14261
|
-
return computedOutput !== null ? computedOutput : value;
|
|
13952
|
+
return value;
|
|
14262
13953
|
}
|
|
14263
13954
|
|
|
14264
13955
|
/**
|
|
@@ -14287,13 +13978,12 @@ function useWatch(props) {
|
|
|
14287
13978
|
*/
|
|
14288
13979
|
function useController(props) {
|
|
14289
13980
|
const methods = useFormContext();
|
|
14290
|
-
const { name, disabled, control = methods.control, shouldUnregister
|
|
13981
|
+
const { name, disabled, control = methods.control, shouldUnregister } = props;
|
|
14291
13982
|
const isArrayField = isNameInFieldArray(control._names.array, name);
|
|
14292
|
-
const defaultValueMemo = React.useMemo(() => get(control._formValues, name, get(control._defaultValues, name, defaultValue)), [control, name, defaultValue]);
|
|
14293
13983
|
const value = useWatch({
|
|
14294
13984
|
control,
|
|
14295
13985
|
name,
|
|
14296
|
-
defaultValue:
|
|
13986
|
+
defaultValue: get(control._formValues, name, get(control._defaultValues, name, props.defaultValue)),
|
|
14297
13987
|
exact: true,
|
|
14298
13988
|
});
|
|
14299
13989
|
const formState = useFormState({
|
|
@@ -14302,13 +13992,11 @@ function useController(props) {
|
|
|
14302
13992
|
exact: true,
|
|
14303
13993
|
});
|
|
14304
13994
|
const _props = React.useRef(props);
|
|
14305
|
-
const _previousNameRef = React.useRef(undefined);
|
|
14306
13995
|
const _registerProps = React.useRef(control.register(name, {
|
|
14307
13996
|
...props.rules,
|
|
14308
13997
|
value,
|
|
14309
13998
|
...(isBoolean(props.disabled) ? { disabled: props.disabled } : {}),
|
|
14310
13999
|
}));
|
|
14311
|
-
_props.current = props;
|
|
14312
14000
|
const fieldState = React.useMemo(() => Object.defineProperties({}, {
|
|
14313
14001
|
invalid: {
|
|
14314
14002
|
enumerable: true,
|
|
@@ -14368,10 +14056,6 @@ function useController(props) {
|
|
|
14368
14056
|
}), [name, disabled, formState.disabled, onChange, onBlur, ref, value]);
|
|
14369
14057
|
React.useEffect(() => {
|
|
14370
14058
|
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
14371
|
-
const previousName = _previousNameRef.current;
|
|
14372
|
-
if (previousName && previousName !== name && !isArrayField) {
|
|
14373
|
-
control.unregister(previousName);
|
|
14374
|
-
}
|
|
14375
14059
|
control.register(name, {
|
|
14376
14060
|
..._props.current.rules,
|
|
14377
14061
|
...(isBoolean(_props.current.disabled)
|
|
@@ -14386,14 +14070,13 @@ function useController(props) {
|
|
|
14386
14070
|
};
|
|
14387
14071
|
updateMounted(name, true);
|
|
14388
14072
|
if (_shouldUnregisterField) {
|
|
14389
|
-
const value = cloneObject(get(control._options.defaultValues, name
|
|
14073
|
+
const value = cloneObject(get(control._options.defaultValues, name));
|
|
14390
14074
|
set(control._defaultValues, name, value);
|
|
14391
14075
|
if (isUndefined(get(control._formValues, name))) {
|
|
14392
14076
|
set(control._formValues, name, value);
|
|
14393
14077
|
}
|
|
14394
14078
|
}
|
|
14395
14079
|
!isArrayField && control.register(name);
|
|
14396
|
-
_previousNameRef.current = name;
|
|
14397
14080
|
return () => {
|
|
14398
14081
|
(isArrayField
|
|
14399
14082
|
? _shouldUnregisterField && !control._state.action
|
|
@@ -14499,24 +14182,42 @@ var createSubject = () => {
|
|
|
14499
14182
|
};
|
|
14500
14183
|
};
|
|
14501
14184
|
|
|
14502
|
-
|
|
14503
|
-
|
|
14504
|
-
|
|
14505
|
-
|
|
14506
|
-
|
|
14507
|
-
|
|
14508
|
-
|
|
14509
|
-
|
|
14510
|
-
|
|
14511
|
-
|
|
14512
|
-
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
|
|
14185
|
+
var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
|
|
14186
|
+
|
|
14187
|
+
function deepEqual$1(object1, object2, _internal_visited = new WeakSet()) {
|
|
14188
|
+
if (isPrimitive(object1) || isPrimitive(object2)) {
|
|
14189
|
+
return object1 === object2;
|
|
14190
|
+
}
|
|
14191
|
+
if (isDateObject(object1) && isDateObject(object2)) {
|
|
14192
|
+
return object1.getTime() === object2.getTime();
|
|
14193
|
+
}
|
|
14194
|
+
const keys1 = Object.keys(object1);
|
|
14195
|
+
const keys2 = Object.keys(object2);
|
|
14196
|
+
if (keys1.length !== keys2.length) {
|
|
14197
|
+
return false;
|
|
14198
|
+
}
|
|
14199
|
+
if (_internal_visited.has(object1) || _internal_visited.has(object2)) {
|
|
14200
|
+
return true;
|
|
14201
|
+
}
|
|
14202
|
+
_internal_visited.add(object1);
|
|
14203
|
+
_internal_visited.add(object2);
|
|
14204
|
+
for (const key of keys1) {
|
|
14205
|
+
const val1 = object1[key];
|
|
14206
|
+
if (!keys2.includes(key)) {
|
|
14207
|
+
return false;
|
|
14208
|
+
}
|
|
14209
|
+
if (key !== 'ref') {
|
|
14210
|
+
const val2 = object2[key];
|
|
14211
|
+
if ((isDateObject(val1) && isDateObject(val2)) ||
|
|
14212
|
+
(isObject(val1) && isObject(val2)) ||
|
|
14213
|
+
(Array.isArray(val1) && Array.isArray(val2))
|
|
14214
|
+
? !deepEqual$1(val1, val2, _internal_visited)
|
|
14215
|
+
: val1 !== val2) {
|
|
14216
|
+
return false;
|
|
14516
14217
|
}
|
|
14517
14218
|
}
|
|
14518
14219
|
}
|
|
14519
|
-
return
|
|
14220
|
+
return true;
|
|
14520
14221
|
}
|
|
14521
14222
|
|
|
14522
14223
|
var isEmptyObject = (value) => isObject(value) && !Object.keys(value).length;
|
|
@@ -14587,43 +14288,46 @@ var objectHasFunction = (data) => {
|
|
|
14587
14288
|
return false;
|
|
14588
14289
|
};
|
|
14589
14290
|
|
|
14590
|
-
function isTraversable(value) {
|
|
14591
|
-
return Array.isArray(value) || (isObject(value) && !objectHasFunction(value));
|
|
14592
|
-
}
|
|
14593
14291
|
function markFieldsDirty(data, fields = {}) {
|
|
14594
|
-
|
|
14595
|
-
|
|
14596
|
-
|
|
14597
|
-
|
|
14598
|
-
|
|
14599
|
-
|
|
14600
|
-
|
|
14601
|
-
|
|
14292
|
+
const isParentNodeArray = Array.isArray(data);
|
|
14293
|
+
if (isObject(data) || isParentNodeArray) {
|
|
14294
|
+
for (const key in data) {
|
|
14295
|
+
if (Array.isArray(data[key]) ||
|
|
14296
|
+
(isObject(data[key]) && !objectHasFunction(data[key]))) {
|
|
14297
|
+
fields[key] = Array.isArray(data[key]) ? [] : {};
|
|
14298
|
+
markFieldsDirty(data[key], fields[key]);
|
|
14299
|
+
}
|
|
14300
|
+
else if (!isNullOrUndefined(data[key])) {
|
|
14301
|
+
fields[key] = true;
|
|
14302
|
+
}
|
|
14602
14303
|
}
|
|
14603
14304
|
}
|
|
14604
14305
|
return fields;
|
|
14605
14306
|
}
|
|
14606
|
-
function
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
|
|
14610
|
-
|
|
14611
|
-
|
|
14612
|
-
|
|
14613
|
-
|
|
14614
|
-
|
|
14307
|
+
function getDirtyFieldsFromDefaultValues(data, formValues, dirtyFieldsFromValues) {
|
|
14308
|
+
const isParentNodeArray = Array.isArray(data);
|
|
14309
|
+
if (isObject(data) || isParentNodeArray) {
|
|
14310
|
+
for (const key in data) {
|
|
14311
|
+
if (Array.isArray(data[key]) ||
|
|
14312
|
+
(isObject(data[key]) && !objectHasFunction(data[key]))) {
|
|
14313
|
+
if (isUndefined(formValues) ||
|
|
14314
|
+
isPrimitive(dirtyFieldsFromValues[key])) {
|
|
14315
|
+
dirtyFieldsFromValues[key] = Array.isArray(data[key])
|
|
14316
|
+
? markFieldsDirty(data[key], [])
|
|
14317
|
+
: { ...markFieldsDirty(data[key]) };
|
|
14318
|
+
}
|
|
14319
|
+
else {
|
|
14320
|
+
getDirtyFieldsFromDefaultValues(data[key], isNullOrUndefined(formValues) ? {} : formValues[key], dirtyFieldsFromValues[key]);
|
|
14321
|
+
}
|
|
14615
14322
|
}
|
|
14616
14323
|
else {
|
|
14617
|
-
|
|
14324
|
+
dirtyFieldsFromValues[key] = !deepEqual$1(data[key], formValues[key]);
|
|
14618
14325
|
}
|
|
14619
14326
|
}
|
|
14620
|
-
else {
|
|
14621
|
-
const formValue = formValues[key];
|
|
14622
|
-
dirtyFieldsFromValues[key] = !deepEqual$1(value, formValue);
|
|
14623
|
-
}
|
|
14624
14327
|
}
|
|
14625
14328
|
return dirtyFieldsFromValues;
|
|
14626
14329
|
}
|
|
14330
|
+
var getDirtyFields = (defaultValues, formValues) => getDirtyFieldsFromDefaultValues(defaultValues, formValues, markFieldsDirty(formValues));
|
|
14627
14331
|
|
|
14628
14332
|
const defaultResult = {
|
|
14629
14333
|
value: false,
|
|
@@ -14857,13 +14561,15 @@ var updateFieldArrayRootError = (errors, error, name) => {
|
|
|
14857
14561
|
return errors;
|
|
14858
14562
|
};
|
|
14859
14563
|
|
|
14564
|
+
var isMessage = (value) => isString(value);
|
|
14565
|
+
|
|
14860
14566
|
function getValidateError(result, ref, type = 'validate') {
|
|
14861
|
-
if (
|
|
14862
|
-
(Array.isArray(result) && result.every(
|
|
14567
|
+
if (isMessage(result) ||
|
|
14568
|
+
(Array.isArray(result) && result.every(isMessage)) ||
|
|
14863
14569
|
(isBoolean(result) && !result)) {
|
|
14864
14570
|
return {
|
|
14865
14571
|
type,
|
|
14866
|
-
message:
|
|
14572
|
+
message: isMessage(result) ? result : '',
|
|
14867
14573
|
ref,
|
|
14868
14574
|
};
|
|
14869
14575
|
}
|
|
@@ -14916,7 +14622,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14916
14622
|
(isBoolean(inputValue) && !inputValue) ||
|
|
14917
14623
|
(isCheckBox && !getCheckboxValue(refs).isValid) ||
|
|
14918
14624
|
(isRadio && !getRadioValue(refs).isValid))) {
|
|
14919
|
-
const { value, message } =
|
|
14625
|
+
const { value, message } = isMessage(required)
|
|
14920
14626
|
? { value: !!required, message: required }
|
|
14921
14627
|
: getValueAndMessage(required);
|
|
14922
14628
|
if (value) {
|
|
@@ -15081,7 +14787,7 @@ function createFormControl(props = {}) {
|
|
|
15081
14787
|
errors: _options.errors || {},
|
|
15082
14788
|
disabled: _options.disabled || false,
|
|
15083
14789
|
};
|
|
15084
|
-
|
|
14790
|
+
const _fields = {};
|
|
15085
14791
|
let _defaultValues = isObject(_options.defaultValues) || isObject(_options.values)
|
|
15086
14792
|
? cloneObject(_options.defaultValues || _options.values) || {}
|
|
15087
14793
|
: {};
|
|
@@ -15214,7 +14920,7 @@ function createFormControl(props = {}) {
|
|
|
15214
14920
|
shouldSkipSetValueAs
|
|
15215
14921
|
? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f))
|
|
15216
14922
|
: setFieldValue(name, defaultValue);
|
|
15217
|
-
_state.mount &&
|
|
14923
|
+
_state.mount && _setValid();
|
|
15218
14924
|
}
|
|
15219
14925
|
};
|
|
15220
14926
|
const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {
|
|
@@ -15322,11 +15028,11 @@ function createFormControl(props = {}) {
|
|
|
15322
15028
|
const isFieldArrayRoot = _names.array.has(_f.name);
|
|
15323
15029
|
const isPromiseFunction = field._f && hasPromiseValidation(field._f);
|
|
15324
15030
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
15325
|
-
_updateIsValidating([
|
|
15031
|
+
_updateIsValidating([name], true);
|
|
15326
15032
|
}
|
|
15327
15033
|
const fieldError = await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
|
|
15328
15034
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
15329
|
-
_updateIsValidating([
|
|
15035
|
+
_updateIsValidating([name]);
|
|
15330
15036
|
}
|
|
15331
15037
|
if (fieldError[_f.name]) {
|
|
15332
15038
|
context.valid = false;
|
|
@@ -15465,7 +15171,7 @@ function createFormControl(props = {}) {
|
|
|
15465
15171
|
? setValues(name, cloneValue, options)
|
|
15466
15172
|
: setFieldValue(name, cloneValue, options);
|
|
15467
15173
|
}
|
|
15468
|
-
isWatched(name, _names) && _subjects.state.next({ ..._formState
|
|
15174
|
+
isWatched(name, _names) && _subjects.state.next({ ..._formState });
|
|
15469
15175
|
_subjects.state.next({
|
|
15470
15176
|
name: _state.mount ? name : undefined,
|
|
15471
15177
|
values: cloneObject(_formValues),
|
|
@@ -15500,10 +15206,8 @@ function createFormControl(props = {}) {
|
|
|
15500
15206
|
const watched = isWatched(name, _names, isBlurEvent);
|
|
15501
15207
|
set(_formValues, name, fieldValue);
|
|
15502
15208
|
if (isBlurEvent) {
|
|
15503
|
-
|
|
15504
|
-
|
|
15505
|
-
delayErrorCallback && delayErrorCallback(0);
|
|
15506
|
-
}
|
|
15209
|
+
field._f.onBlur && field._f.onBlur(event);
|
|
15210
|
+
delayErrorCallback && delayErrorCallback(0);
|
|
15507
15211
|
}
|
|
15508
15212
|
else if (field._f.onChange) {
|
|
15509
15213
|
field._f.onChange(event);
|
|
@@ -15559,7 +15263,6 @@ function createFormControl(props = {}) {
|
|
|
15559
15263
|
}
|
|
15560
15264
|
if (isFieldValueUpdated) {
|
|
15561
15265
|
field._f.deps &&
|
|
15562
|
-
(!Array.isArray(field._f.deps) || field._f.deps.length > 0) &&
|
|
15563
15266
|
trigger(field._f.deps);
|
|
15564
15267
|
shouldRenderByError(name, isValid, error, fieldState);
|
|
15565
15268
|
}
|
|
@@ -15607,13 +15310,10 @@ function createFormControl(props = {}) {
|
|
|
15607
15310
|
iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount);
|
|
15608
15311
|
return validationResult;
|
|
15609
15312
|
};
|
|
15610
|
-
const getValues = (fieldNames
|
|
15611
|
-
|
|
15313
|
+
const getValues = (fieldNames) => {
|
|
15314
|
+
const values = {
|
|
15612
15315
|
...(_state.mount ? _formValues : _defaultValues),
|
|
15613
15316
|
};
|
|
15614
|
-
if (config) {
|
|
15615
|
-
values = extractFormValues(config.dirtyFields ? _formState.dirtyFields : _formState.touchedFields, values);
|
|
15616
|
-
}
|
|
15617
15317
|
return isUndefined(fieldNames)
|
|
15618
15318
|
? values
|
|
15619
15319
|
: isString(fieldNames)
|
|
@@ -15653,8 +15353,7 @@ function createFormControl(props = {}) {
|
|
|
15653
15353
|
};
|
|
15654
15354
|
const watch = (name, defaultValue) => isFunction$1(name)
|
|
15655
15355
|
? _subjects.state.subscribe({
|
|
15656
|
-
next: (payload) =>
|
|
15657
|
-
name(_getWatch(undefined, defaultValue), payload),
|
|
15356
|
+
next: (payload) => name(_getWatch(undefined, defaultValue), payload),
|
|
15658
15357
|
})
|
|
15659
15358
|
: _getWatch(name, defaultValue, true);
|
|
15660
15359
|
const _subscribe = (props) => _subjects.state.subscribe({
|
|
@@ -15665,7 +15364,6 @@ function createFormControl(props = {}) {
|
|
|
15665
15364
|
values: { ..._formValues },
|
|
15666
15365
|
..._formState,
|
|
15667
15366
|
...formState,
|
|
15668
|
-
defaultValues: _defaultValues,
|
|
15669
15367
|
});
|
|
15670
15368
|
}
|
|
15671
15369
|
},
|
|
@@ -15935,20 +15633,15 @@ function createFormControl(props = {}) {
|
|
|
15935
15633
|
}
|
|
15936
15634
|
}
|
|
15937
15635
|
}
|
|
15938
|
-
|
|
15939
|
-
|
|
15636
|
+
for (const fieldName of _names.mount) {
|
|
15637
|
+
const value = get(values, fieldName, get(_defaultValues, fieldName));
|
|
15638
|
+
if (!isUndefined(value)) {
|
|
15639
|
+
set(values, fieldName, value);
|
|
15940
15640
|
setValue(fieldName, get(values, fieldName));
|
|
15941
15641
|
}
|
|
15942
15642
|
}
|
|
15943
|
-
else {
|
|
15944
|
-
_fields = {};
|
|
15945
|
-
}
|
|
15946
15643
|
}
|
|
15947
|
-
_formValues =
|
|
15948
|
-
? keepStateOptions.keepDefaultValues
|
|
15949
|
-
? cloneObject(_defaultValues)
|
|
15950
|
-
: {}
|
|
15951
|
-
: cloneObject(values);
|
|
15644
|
+
_formValues = cloneObject(values);
|
|
15952
15645
|
_subjects.array.next({
|
|
15953
15646
|
values: { ...values },
|
|
15954
15647
|
});
|
|
@@ -15968,8 +15661,7 @@ function createFormControl(props = {}) {
|
|
|
15968
15661
|
_state.mount =
|
|
15969
15662
|
!_proxyFormState.isValid ||
|
|
15970
15663
|
!!keepStateOptions.keepIsValid ||
|
|
15971
|
-
!!keepStateOptions.keepDirtyValues
|
|
15972
|
-
(!_options.shouldUnregister && !isEmptyObject(values));
|
|
15664
|
+
!!keepStateOptions.keepDirtyValues;
|
|
15973
15665
|
_state.watch = !!_options.shouldUnregister;
|
|
15974
15666
|
_subjects.state.next({
|
|
15975
15667
|
submitCount: keepStateOptions.keepSubmitCount
|
|
@@ -16003,7 +15695,6 @@ function createFormControl(props = {}) {
|
|
|
16003
15695
|
? _formState.isSubmitSuccessful
|
|
16004
15696
|
: false,
|
|
16005
15697
|
isSubmitting: false,
|
|
16006
|
-
defaultValues: _defaultValues,
|
|
16007
15698
|
});
|
|
16008
15699
|
};
|
|
16009
15700
|
const reset = (formValues, keepStateOptions) => _reset(isFunction$1(formValues)
|
|
@@ -16231,15 +15922,8 @@ function useForm(props = {}) {
|
|
|
16231
15922
|
}
|
|
16232
15923
|
}, [control, formState.isDirty]);
|
|
16233
15924
|
React.useEffect(() => {
|
|
16234
|
-
var _a;
|
|
16235
15925
|
if (props.values && !deepEqual$1(props.values, _values.current)) {
|
|
16236
|
-
control._reset(props.values,
|
|
16237
|
-
keepFieldsRef: true,
|
|
16238
|
-
...control._options.resetOptions,
|
|
16239
|
-
});
|
|
16240
|
-
if (!((_a = control._options.resetOptions) === null || _a === void 0 ? void 0 : _a.keepIsValid)) {
|
|
16241
|
-
control._setValid();
|
|
16242
|
-
}
|
|
15926
|
+
control._reset(props.values, control._options.resetOptions);
|
|
16243
15927
|
_values.current = props.values;
|
|
16244
15928
|
updateFormState((state) => ({ ...state }));
|
|
16245
15929
|
}
|
|
@@ -16263,7 +15947,7 @@ function useForm(props = {}) {
|
|
|
16263
15947
|
}
|
|
16264
15948
|
|
|
16265
15949
|
// src/primitive.tsx
|
|
16266
|
-
var NODES
|
|
15950
|
+
var NODES = [
|
|
16267
15951
|
"a",
|
|
16268
15952
|
"button",
|
|
16269
15953
|
"div",
|
|
@@ -16282,8 +15966,8 @@ var NODES$1 = [
|
|
|
16282
15966
|
"svg",
|
|
16283
15967
|
"ul"
|
|
16284
15968
|
];
|
|
16285
|
-
var Primitive
|
|
16286
|
-
const Slot = createSlot
|
|
15969
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
15970
|
+
const Slot = createSlot(`Primitive.${node}`);
|
|
16287
15971
|
const Node = React__namespace.forwardRef((props, forwardedRef) => {
|
|
16288
15972
|
const { asChild, ...primitiveProps } = props;
|
|
16289
15973
|
const Comp = asChild ? Slot : node;
|
|
@@ -16295,11 +15979,14 @@ var Primitive$1 = NODES$1.reduce((primitive, node) => {
|
|
|
16295
15979
|
Node.displayName = `Primitive.${node}`;
|
|
16296
15980
|
return { ...primitive, [node]: Node };
|
|
16297
15981
|
}, {});
|
|
15982
|
+
function dispatchDiscreteCustomEvent(target, event) {
|
|
15983
|
+
if (target) ReactDOM__namespace.flushSync(() => target.dispatchEvent(event));
|
|
15984
|
+
}
|
|
16298
15985
|
|
|
16299
15986
|
var NAME$1 = "Label";
|
|
16300
15987
|
var Label$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
16301
15988
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
16302
|
-
Primitive
|
|
15989
|
+
Primitive.label,
|
|
16303
15990
|
{
|
|
16304
15991
|
...props,
|
|
16305
15992
|
ref: forwardedRef,
|
|
@@ -16317,36 +16004,7 @@ var Root$2 = Label$1;
|
|
|
16317
16004
|
|
|
16318
16005
|
function r$2(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r$2(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r$2(e))&&(n&&(n+=" "),n+=t);return n}
|
|
16319
16006
|
|
|
16320
|
-
/**
|
|
16321
|
-
* Concatenates two arrays faster than the array spread operator.
|
|
16322
|
-
*/
|
|
16323
|
-
const concatArrays = (array1, array2) => {
|
|
16324
|
-
// Pre-allocate for better V8 optimization
|
|
16325
|
-
const combinedArray = new Array(array1.length + array2.length);
|
|
16326
|
-
for (let i = 0; i < array1.length; i++) {
|
|
16327
|
-
combinedArray[i] = array1[i];
|
|
16328
|
-
}
|
|
16329
|
-
for (let i = 0; i < array2.length; i++) {
|
|
16330
|
-
combinedArray[array1.length + i] = array2[i];
|
|
16331
|
-
}
|
|
16332
|
-
return combinedArray;
|
|
16333
|
-
};
|
|
16334
|
-
|
|
16335
|
-
// Factory function ensures consistent object shapes
|
|
16336
|
-
const createClassValidatorObject = (classGroupId, validator) => ({
|
|
16337
|
-
classGroupId,
|
|
16338
|
-
validator
|
|
16339
|
-
});
|
|
16340
|
-
// Factory ensures consistent ClassPartObject shape
|
|
16341
|
-
const createClassPartObject = (nextPart = new Map(), validators = null, classGroupId) => ({
|
|
16342
|
-
nextPart,
|
|
16343
|
-
validators,
|
|
16344
|
-
classGroupId
|
|
16345
|
-
});
|
|
16346
16007
|
const CLASS_PART_SEPARATOR = '-';
|
|
16347
|
-
const EMPTY_CONFLICTS = [];
|
|
16348
|
-
// I use two dots here because one dot is used as prefix for class groups in plugins
|
|
16349
|
-
const ARBITRARY_PROPERTY_PREFIX = 'arbitrary..';
|
|
16350
16008
|
const createClassGroupUtils = config => {
|
|
16351
16009
|
const classMap = createClassMap(config);
|
|
16352
16010
|
const {
|
|
@@ -16354,73 +16012,54 @@ const createClassGroupUtils = config => {
|
|
|
16354
16012
|
conflictingClassGroupModifiers
|
|
16355
16013
|
} = config;
|
|
16356
16014
|
const getClassGroupId = className => {
|
|
16357
|
-
if (className.startsWith('[') && className.endsWith(']')) {
|
|
16358
|
-
return getGroupIdForArbitraryProperty(className);
|
|
16359
|
-
}
|
|
16360
16015
|
const classParts = className.split(CLASS_PART_SEPARATOR);
|
|
16361
|
-
// Classes like `-inset-1` produce an empty string as first classPart. We assume that classes for negative values are used correctly and
|
|
16362
|
-
|
|
16363
|
-
|
|
16016
|
+
// Classes like `-inset-1` produce an empty string as first classPart. We assume that classes for negative values are used correctly and remove it from classParts.
|
|
16017
|
+
if (classParts[0] === '' && classParts.length !== 1) {
|
|
16018
|
+
classParts.shift();
|
|
16019
|
+
}
|
|
16020
|
+
return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className);
|
|
16364
16021
|
};
|
|
16365
16022
|
const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
|
|
16366
|
-
|
|
16367
|
-
|
|
16368
|
-
|
|
16369
|
-
if (modifierConflicts) {
|
|
16370
|
-
if (baseConflicts) {
|
|
16371
|
-
// Merge base conflicts with modifier conflicts
|
|
16372
|
-
return concatArrays(baseConflicts, modifierConflicts);
|
|
16373
|
-
}
|
|
16374
|
-
// Only modifier conflicts
|
|
16375
|
-
return modifierConflicts;
|
|
16376
|
-
}
|
|
16377
|
-
// Fall back to without postfix if no modifier conflicts
|
|
16378
|
-
return baseConflicts || EMPTY_CONFLICTS;
|
|
16023
|
+
const conflicts = conflictingClassGroups[classGroupId] || [];
|
|
16024
|
+
if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
|
|
16025
|
+
return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]];
|
|
16379
16026
|
}
|
|
16380
|
-
return
|
|
16027
|
+
return conflicts;
|
|
16381
16028
|
};
|
|
16382
16029
|
return {
|
|
16383
16030
|
getClassGroupId,
|
|
16384
16031
|
getConflictingClassGroupIds
|
|
16385
16032
|
};
|
|
16386
16033
|
};
|
|
16387
|
-
const getGroupRecursive = (classParts,
|
|
16388
|
-
|
|
16389
|
-
if (classPathsLength === 0) {
|
|
16034
|
+
const getGroupRecursive = (classParts, classPartObject) => {
|
|
16035
|
+
if (classParts.length === 0) {
|
|
16390
16036
|
return classPartObject.classGroupId;
|
|
16391
16037
|
}
|
|
16392
|
-
const currentClassPart = classParts[
|
|
16038
|
+
const currentClassPart = classParts[0];
|
|
16393
16039
|
const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
|
|
16394
|
-
|
|
16395
|
-
|
|
16396
|
-
|
|
16040
|
+
const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : undefined;
|
|
16041
|
+
if (classGroupFromNextClassPart) {
|
|
16042
|
+
return classGroupFromNextClassPart;
|
|
16397
16043
|
}
|
|
16398
|
-
|
|
16399
|
-
if (validators === null) {
|
|
16044
|
+
if (classPartObject.validators.length === 0) {
|
|
16400
16045
|
return undefined;
|
|
16401
16046
|
}
|
|
16402
|
-
|
|
16403
|
-
|
|
16404
|
-
|
|
16405
|
-
|
|
16406
|
-
|
|
16407
|
-
|
|
16408
|
-
|
|
16047
|
+
const classRest = classParts.join(CLASS_PART_SEPARATOR);
|
|
16048
|
+
return classPartObject.validators.find(({
|
|
16049
|
+
validator
|
|
16050
|
+
}) => validator(classRest))?.classGroupId;
|
|
16051
|
+
};
|
|
16052
|
+
const arbitraryPropertyRegex = /^\[(.+)\]$/;
|
|
16053
|
+
const getGroupIdForArbitraryProperty = className => {
|
|
16054
|
+
if (arbitraryPropertyRegex.test(className)) {
|
|
16055
|
+
const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
|
|
16056
|
+
const property = arbitraryPropertyClassName?.substring(0, arbitraryPropertyClassName.indexOf(':'));
|
|
16057
|
+
if (property) {
|
|
16058
|
+
// I use two dots here because one dot is used as prefix for class groups in plugins
|
|
16059
|
+
return 'arbitrary..' + property;
|
|
16409
16060
|
}
|
|
16410
16061
|
}
|
|
16411
|
-
return undefined;
|
|
16412
16062
|
};
|
|
16413
|
-
/**
|
|
16414
|
-
* Get the class group ID for an arbitrary property.
|
|
16415
|
-
*
|
|
16416
|
-
* @param className - The class name to get the group ID for. Is expected to be string starting with `[` and ending with `]`.
|
|
16417
|
-
*/
|
|
16418
|
-
const getGroupIdForArbitraryProperty = className => className.slice(1, -1).indexOf(':') === -1 ? undefined : (() => {
|
|
16419
|
-
const content = className.slice(1, -1);
|
|
16420
|
-
const colonIndex = content.indexOf(':');
|
|
16421
|
-
const property = content.slice(0, colonIndex);
|
|
16422
|
-
return property ? ARBITRARY_PROPERTY_PREFIX + property : undefined;
|
|
16423
|
-
})();
|
|
16424
16063
|
/**
|
|
16425
16064
|
* Exported for testing only
|
|
16426
16065
|
*/
|
|
@@ -16429,77 +16068,54 @@ const createClassMap = config => {
|
|
|
16429
16068
|
theme,
|
|
16430
16069
|
classGroups
|
|
16431
16070
|
} = config;
|
|
16432
|
-
|
|
16433
|
-
|
|
16434
|
-
|
|
16435
|
-
|
|
16436
|
-
const classMap = createClassPartObject();
|
|
16071
|
+
const classMap = {
|
|
16072
|
+
nextPart: new Map(),
|
|
16073
|
+
validators: []
|
|
16074
|
+
};
|
|
16437
16075
|
for (const classGroupId in classGroups) {
|
|
16438
|
-
|
|
16439
|
-
processClassesRecursively(group, classMap, classGroupId, theme);
|
|
16076
|
+
processClassesRecursively(classGroups[classGroupId], classMap, classGroupId, theme);
|
|
16440
16077
|
}
|
|
16441
16078
|
return classMap;
|
|
16442
16079
|
};
|
|
16443
16080
|
const processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
|
|
16444
|
-
|
|
16445
|
-
|
|
16446
|
-
|
|
16447
|
-
|
|
16448
|
-
|
|
16449
|
-
}
|
|
16450
|
-
|
|
16451
|
-
|
|
16452
|
-
|
|
16453
|
-
|
|
16454
|
-
|
|
16455
|
-
|
|
16456
|
-
|
|
16457
|
-
|
|
16458
|
-
|
|
16459
|
-
|
|
16460
|
-
|
|
16461
|
-
|
|
16462
|
-
|
|
16463
|
-
|
|
16464
|
-
|
|
16465
|
-
};
|
|
16466
|
-
const processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
|
|
16467
|
-
if (isThemeGetter(classDefinition)) {
|
|
16468
|
-
processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
|
|
16469
|
-
return;
|
|
16470
|
-
}
|
|
16471
|
-
if (classPartObject.validators === null) {
|
|
16472
|
-
classPartObject.validators = [];
|
|
16473
|
-
}
|
|
16474
|
-
classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
|
|
16475
|
-
};
|
|
16476
|
-
const processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
|
|
16477
|
-
const entries = Object.entries(classDefinition);
|
|
16478
|
-
const len = entries.length;
|
|
16479
|
-
for (let i = 0; i < len; i++) {
|
|
16480
|
-
const [key, value] = entries[i];
|
|
16481
|
-
processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
|
|
16482
|
-
}
|
|
16081
|
+
classGroup.forEach(classDefinition => {
|
|
16082
|
+
if (typeof classDefinition === 'string') {
|
|
16083
|
+
const classPartObjectToEdit = classDefinition === '' ? classPartObject : getPart(classPartObject, classDefinition);
|
|
16084
|
+
classPartObjectToEdit.classGroupId = classGroupId;
|
|
16085
|
+
return;
|
|
16086
|
+
}
|
|
16087
|
+
if (typeof classDefinition === 'function') {
|
|
16088
|
+
if (isThemeGetter(classDefinition)) {
|
|
16089
|
+
processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
|
|
16090
|
+
return;
|
|
16091
|
+
}
|
|
16092
|
+
classPartObject.validators.push({
|
|
16093
|
+
validator: classDefinition,
|
|
16094
|
+
classGroupId
|
|
16095
|
+
});
|
|
16096
|
+
return;
|
|
16097
|
+
}
|
|
16098
|
+
Object.entries(classDefinition).forEach(([key, classGroup]) => {
|
|
16099
|
+
processClassesRecursively(classGroup, getPart(classPartObject, key), classGroupId, theme);
|
|
16100
|
+
});
|
|
16101
|
+
});
|
|
16483
16102
|
};
|
|
16484
16103
|
const getPart = (classPartObject, path) => {
|
|
16485
|
-
let
|
|
16486
|
-
|
|
16487
|
-
|
|
16488
|
-
|
|
16489
|
-
|
|
16490
|
-
|
|
16491
|
-
|
|
16492
|
-
next = createClassPartObject();
|
|
16493
|
-
current.nextPart.set(part, next);
|
|
16104
|
+
let currentClassPartObject = classPartObject;
|
|
16105
|
+
path.split(CLASS_PART_SEPARATOR).forEach(pathPart => {
|
|
16106
|
+
if (!currentClassPartObject.nextPart.has(pathPart)) {
|
|
16107
|
+
currentClassPartObject.nextPart.set(pathPart, {
|
|
16108
|
+
nextPart: new Map(),
|
|
16109
|
+
validators: []
|
|
16110
|
+
});
|
|
16494
16111
|
}
|
|
16495
|
-
|
|
16496
|
-
}
|
|
16497
|
-
return
|
|
16112
|
+
currentClassPartObject = currentClassPartObject.nextPart.get(pathPart);
|
|
16113
|
+
});
|
|
16114
|
+
return currentClassPartObject;
|
|
16498
16115
|
};
|
|
16499
|
-
|
|
16500
|
-
const isThemeGetter = func => 'isThemeGetter' in func && func.isThemeGetter === true;
|
|
16116
|
+
const isThemeGetter = func => func.isThemeGetter;
|
|
16501
16117
|
|
|
16502
|
-
// LRU cache
|
|
16118
|
+
// LRU cache inspired from hashlru (https://github.com/dominictarr/hashlru/blob/v1.0.4/index.js) but object replaced with Map to improve performance
|
|
16503
16119
|
const createLruCache = maxCacheSize => {
|
|
16504
16120
|
if (maxCacheSize < 1) {
|
|
16505
16121
|
return {
|
|
@@ -16508,31 +16124,31 @@ const createLruCache = maxCacheSize => {
|
|
|
16508
16124
|
};
|
|
16509
16125
|
}
|
|
16510
16126
|
let cacheSize = 0;
|
|
16511
|
-
let cache =
|
|
16512
|
-
let previousCache =
|
|
16127
|
+
let cache = new Map();
|
|
16128
|
+
let previousCache = new Map();
|
|
16513
16129
|
const update = (key, value) => {
|
|
16514
|
-
cache
|
|
16130
|
+
cache.set(key, value);
|
|
16515
16131
|
cacheSize++;
|
|
16516
16132
|
if (cacheSize > maxCacheSize) {
|
|
16517
16133
|
cacheSize = 0;
|
|
16518
16134
|
previousCache = cache;
|
|
16519
|
-
cache =
|
|
16135
|
+
cache = new Map();
|
|
16520
16136
|
}
|
|
16521
16137
|
};
|
|
16522
16138
|
return {
|
|
16523
16139
|
get(key) {
|
|
16524
|
-
let value = cache
|
|
16140
|
+
let value = cache.get(key);
|
|
16525
16141
|
if (value !== undefined) {
|
|
16526
16142
|
return value;
|
|
16527
16143
|
}
|
|
16528
|
-
if ((value = previousCache
|
|
16144
|
+
if ((value = previousCache.get(key)) !== undefined) {
|
|
16529
16145
|
update(key, value);
|
|
16530
16146
|
return value;
|
|
16531
16147
|
}
|
|
16532
16148
|
},
|
|
16533
16149
|
set(key, value) {
|
|
16534
|
-
if (key
|
|
16535
|
-
cache
|
|
16150
|
+
if (cache.has(key)) {
|
|
16151
|
+
cache.set(key, value);
|
|
16536
16152
|
} else {
|
|
16537
16153
|
update(key, value);
|
|
16538
16154
|
}
|
|
@@ -16541,15 +16157,7 @@ const createLruCache = maxCacheSize => {
|
|
|
16541
16157
|
};
|
|
16542
16158
|
const IMPORTANT_MODIFIER = '!';
|
|
16543
16159
|
const MODIFIER_SEPARATOR = ':';
|
|
16544
|
-
const
|
|
16545
|
-
// Pre-allocated result object shape for consistency
|
|
16546
|
-
const createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
|
|
16547
|
-
modifiers,
|
|
16548
|
-
hasImportantModifier,
|
|
16549
|
-
baseClassName,
|
|
16550
|
-
maybePostfixModifierPosition,
|
|
16551
|
-
isExternal
|
|
16552
|
-
});
|
|
16160
|
+
const MODIFIER_SEPARATOR_LENGTH = MODIFIER_SEPARATOR.length;
|
|
16553
16161
|
const createParseClassName = config => {
|
|
16554
16162
|
const {
|
|
16555
16163
|
prefix,
|
|
@@ -16562,19 +16170,17 @@ const createParseClassName = config => {
|
|
|
16562
16170
|
* @see https://github.com/tailwindlabs/tailwindcss/blob/v3.2.2/src/util/splitAtTopLevelOnly.js
|
|
16563
16171
|
*/
|
|
16564
16172
|
let parseClassName = className => {
|
|
16565
|
-
// Use simple array with push for better performance
|
|
16566
16173
|
const modifiers = [];
|
|
16567
16174
|
let bracketDepth = 0;
|
|
16568
16175
|
let parenDepth = 0;
|
|
16569
16176
|
let modifierStart = 0;
|
|
16570
16177
|
let postfixModifierPosition;
|
|
16571
|
-
|
|
16572
|
-
|
|
16573
|
-
const currentCharacter = className[index];
|
|
16178
|
+
for (let index = 0; index < className.length; index++) {
|
|
16179
|
+
let currentCharacter = className[index];
|
|
16574
16180
|
if (bracketDepth === 0 && parenDepth === 0) {
|
|
16575
16181
|
if (currentCharacter === MODIFIER_SEPARATOR) {
|
|
16576
16182
|
modifiers.push(className.slice(modifierStart, index));
|
|
16577
|
-
modifierStart = index +
|
|
16183
|
+
modifierStart = index + MODIFIER_SEPARATOR_LENGTH;
|
|
16578
16184
|
continue;
|
|
16579
16185
|
}
|
|
16580
16186
|
if (currentCharacter === '/') {
|
|
@@ -16582,31 +16188,37 @@ const createParseClassName = config => {
|
|
|
16582
16188
|
continue;
|
|
16583
16189
|
}
|
|
16584
16190
|
}
|
|
16585
|
-
if (currentCharacter === '[')
|
|
16586
|
-
|
|
16587
|
-
|
|
16588
|
-
|
|
16589
|
-
|
|
16590
|
-
|
|
16591
|
-
|
|
16592
|
-
|
|
16593
|
-
|
|
16594
|
-
} else if (
|
|
16595
|
-
/**
|
|
16596
|
-
* In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
|
|
16597
|
-
* @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
|
|
16598
|
-
*/
|
|
16599
|
-
baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)) {
|
|
16600
|
-
baseClassName = baseClassNameWithImportantModifier.slice(1);
|
|
16601
|
-
hasImportantModifier = true;
|
|
16191
|
+
if (currentCharacter === '[') {
|
|
16192
|
+
bracketDepth++;
|
|
16193
|
+
} else if (currentCharacter === ']') {
|
|
16194
|
+
bracketDepth--;
|
|
16195
|
+
} else if (currentCharacter === '(') {
|
|
16196
|
+
parenDepth++;
|
|
16197
|
+
} else if (currentCharacter === ')') {
|
|
16198
|
+
parenDepth--;
|
|
16199
|
+
}
|
|
16602
16200
|
}
|
|
16201
|
+
const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart);
|
|
16202
|
+
const baseClassName = stripImportantModifier(baseClassNameWithImportantModifier);
|
|
16203
|
+
const hasImportantModifier = baseClassName !== baseClassNameWithImportantModifier;
|
|
16603
16204
|
const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : undefined;
|
|
16604
|
-
return
|
|
16205
|
+
return {
|
|
16206
|
+
modifiers,
|
|
16207
|
+
hasImportantModifier,
|
|
16208
|
+
baseClassName,
|
|
16209
|
+
maybePostfixModifierPosition
|
|
16210
|
+
};
|
|
16605
16211
|
};
|
|
16606
16212
|
if (prefix) {
|
|
16607
16213
|
const fullPrefix = prefix + MODIFIER_SEPARATOR;
|
|
16608
16214
|
const parseClassNameOriginal = parseClassName;
|
|
16609
|
-
parseClassName = className => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.
|
|
16215
|
+
parseClassName = className => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.substring(fullPrefix.length)) : {
|
|
16216
|
+
isExternal: true,
|
|
16217
|
+
modifiers: [],
|
|
16218
|
+
hasImportantModifier: false,
|
|
16219
|
+
baseClassName: className,
|
|
16220
|
+
maybePostfixModifierPosition: undefined
|
|
16221
|
+
};
|
|
16610
16222
|
}
|
|
16611
16223
|
if (experimentalParseClassName) {
|
|
16612
16224
|
const parseClassNameOriginal = parseClassName;
|
|
@@ -16617,6 +16229,19 @@ const createParseClassName = config => {
|
|
|
16617
16229
|
}
|
|
16618
16230
|
return parseClassName;
|
|
16619
16231
|
};
|
|
16232
|
+
const stripImportantModifier = baseClassName => {
|
|
16233
|
+
if (baseClassName.endsWith(IMPORTANT_MODIFIER)) {
|
|
16234
|
+
return baseClassName.substring(0, baseClassName.length - 1);
|
|
16235
|
+
}
|
|
16236
|
+
/**
|
|
16237
|
+
* In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
|
|
16238
|
+
* @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
|
|
16239
|
+
*/
|
|
16240
|
+
if (baseClassName.startsWith(IMPORTANT_MODIFIER)) {
|
|
16241
|
+
return baseClassName.substring(1);
|
|
16242
|
+
}
|
|
16243
|
+
return baseClassName;
|
|
16244
|
+
};
|
|
16620
16245
|
|
|
16621
16246
|
/**
|
|
16622
16247
|
* Sorts modifiers according to following schema:
|
|
@@ -16624,41 +16249,26 @@ const createParseClassName = config => {
|
|
|
16624
16249
|
* - When an arbitrary variant appears, it must be preserved which modifiers are before and after it
|
|
16625
16250
|
*/
|
|
16626
16251
|
const createSortModifiers = config => {
|
|
16627
|
-
|
|
16628
|
-
const
|
|
16629
|
-
|
|
16630
|
-
|
|
16631
|
-
|
|
16632
|
-
|
|
16633
|
-
|
|
16634
|
-
|
|
16635
|
-
|
|
16636
|
-
|
|
16637
|
-
|
|
16638
|
-
|
|
16639
|
-
// Check if modifier is sensitive (starts with '[' or in orderSensitiveModifiers)
|
|
16640
|
-
const isArbitrary = modifier[0] === '[';
|
|
16641
|
-
const isOrderSensitive = modifierWeights.has(modifier);
|
|
16642
|
-
if (isArbitrary || isOrderSensitive) {
|
|
16643
|
-
// Sort and flush current segment alphabetically
|
|
16644
|
-
if (currentSegment.length > 0) {
|
|
16645
|
-
currentSegment.sort();
|
|
16646
|
-
result.push(...currentSegment);
|
|
16647
|
-
currentSegment = [];
|
|
16648
|
-
}
|
|
16649
|
-
result.push(modifier);
|
|
16252
|
+
const orderSensitiveModifiers = Object.fromEntries(config.orderSensitiveModifiers.map(modifier => [modifier, true]));
|
|
16253
|
+
const sortModifiers = modifiers => {
|
|
16254
|
+
if (modifiers.length <= 1) {
|
|
16255
|
+
return modifiers;
|
|
16256
|
+
}
|
|
16257
|
+
const sortedModifiers = [];
|
|
16258
|
+
let unsortedModifiers = [];
|
|
16259
|
+
modifiers.forEach(modifier => {
|
|
16260
|
+
const isPositionSensitive = modifier[0] === '[' || orderSensitiveModifiers[modifier];
|
|
16261
|
+
if (isPositionSensitive) {
|
|
16262
|
+
sortedModifiers.push(...unsortedModifiers.sort(), modifier);
|
|
16263
|
+
unsortedModifiers = [];
|
|
16650
16264
|
} else {
|
|
16651
|
-
|
|
16652
|
-
currentSegment.push(modifier);
|
|
16265
|
+
unsortedModifiers.push(modifier);
|
|
16653
16266
|
}
|
|
16654
|
-
}
|
|
16655
|
-
|
|
16656
|
-
|
|
16657
|
-
currentSegment.sort();
|
|
16658
|
-
result.push(...currentSegment);
|
|
16659
|
-
}
|
|
16660
|
-
return result;
|
|
16267
|
+
});
|
|
16268
|
+
sortedModifiers.push(...unsortedModifiers.sort());
|
|
16269
|
+
return sortedModifiers;
|
|
16661
16270
|
};
|
|
16271
|
+
return sortModifiers;
|
|
16662
16272
|
};
|
|
16663
16273
|
const createConfigUtils = config => ({
|
|
16664
16274
|
cache: createLruCache(config.cacheSize),
|
|
@@ -16713,11 +16323,10 @@ const mergeClassList = (classList, configUtils) => {
|
|
|
16713
16323
|
}
|
|
16714
16324
|
hasPostfixModifier = false;
|
|
16715
16325
|
}
|
|
16716
|
-
|
|
16717
|
-
const variantModifier = modifiers.length === 0 ? '' : modifiers.length === 1 ? modifiers[0] : sortModifiers(modifiers).join(':');
|
|
16326
|
+
const variantModifier = sortModifiers(modifiers).join(':');
|
|
16718
16327
|
const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
|
|
16719
16328
|
const classId = modifierId + classGroupId;
|
|
16720
|
-
if (classGroupsInConflict.
|
|
16329
|
+
if (classGroupsInConflict.includes(classId)) {
|
|
16721
16330
|
// Tailwind class omitted due to conflict
|
|
16722
16331
|
continue;
|
|
16723
16332
|
}
|
|
@@ -16742,13 +16351,13 @@ const mergeClassList = (classList, configUtils) => {
|
|
|
16742
16351
|
*
|
|
16743
16352
|
* Original code has MIT license: Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
|
|
16744
16353
|
*/
|
|
16745
|
-
|
|
16354
|
+
function twJoin() {
|
|
16746
16355
|
let index = 0;
|
|
16747
16356
|
let argument;
|
|
16748
16357
|
let resolvedValue;
|
|
16749
16358
|
let string = '';
|
|
16750
|
-
while (index <
|
|
16751
|
-
if (argument =
|
|
16359
|
+
while (index < arguments.length) {
|
|
16360
|
+
if (argument = arguments[index++]) {
|
|
16752
16361
|
if (resolvedValue = toValue(argument)) {
|
|
16753
16362
|
string && (string += ' ');
|
|
16754
16363
|
string += resolvedValue;
|
|
@@ -16756,9 +16365,8 @@ const twJoin = (...classLists) => {
|
|
|
16756
16365
|
}
|
|
16757
16366
|
}
|
|
16758
16367
|
return string;
|
|
16759
|
-
}
|
|
16368
|
+
}
|
|
16760
16369
|
const toValue = mix => {
|
|
16761
|
-
// Fast path for strings
|
|
16762
16370
|
if (typeof mix === 'string') {
|
|
16763
16371
|
return mix;
|
|
16764
16372
|
}
|
|
@@ -16774,20 +16382,20 @@ const toValue = mix => {
|
|
|
16774
16382
|
}
|
|
16775
16383
|
return string;
|
|
16776
16384
|
};
|
|
16777
|
-
|
|
16385
|
+
function createTailwindMerge(createConfigFirst, ...createConfigRest) {
|
|
16778
16386
|
let configUtils;
|
|
16779
16387
|
let cacheGet;
|
|
16780
16388
|
let cacheSet;
|
|
16781
|
-
let functionToCall;
|
|
16782
|
-
|
|
16389
|
+
let functionToCall = initTailwindMerge;
|
|
16390
|
+
function initTailwindMerge(classList) {
|
|
16783
16391
|
const config = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
|
|
16784
16392
|
configUtils = createConfigUtils(config);
|
|
16785
16393
|
cacheGet = configUtils.cache.get;
|
|
16786
16394
|
cacheSet = configUtils.cache.set;
|
|
16787
16395
|
functionToCall = tailwindMerge;
|
|
16788
16396
|
return tailwindMerge(classList);
|
|
16789
|
-
}
|
|
16790
|
-
|
|
16397
|
+
}
|
|
16398
|
+
function tailwindMerge(classList) {
|
|
16791
16399
|
const cachedResult = cacheGet(classList);
|
|
16792
16400
|
if (cachedResult) {
|
|
16793
16401
|
return cachedResult;
|
|
@@ -16795,13 +16403,13 @@ const createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
|
|
|
16795
16403
|
const result = mergeClassList(classList, configUtils);
|
|
16796
16404
|
cacheSet(classList, result);
|
|
16797
16405
|
return result;
|
|
16406
|
+
}
|
|
16407
|
+
return function callTailwindMerge() {
|
|
16408
|
+
return functionToCall(twJoin.apply(null, arguments));
|
|
16798
16409
|
};
|
|
16799
|
-
|
|
16800
|
-
return (...args) => functionToCall(twJoin(...args));
|
|
16801
|
-
};
|
|
16802
|
-
const fallbackThemeArr = [];
|
|
16410
|
+
}
|
|
16803
16411
|
const fromTheme = key => {
|
|
16804
|
-
const themeGetter = theme => theme[key] ||
|
|
16412
|
+
const themeGetter = theme => theme[key] || [];
|
|
16805
16413
|
themeGetter.isThemeGetter = true;
|
|
16806
16414
|
return themeGetter;
|
|
16807
16415
|
};
|
|
@@ -19509,7 +19117,7 @@ function Button(_a) {
|
|
|
19509
19117
|
|
|
19510
19118
|
var U=1,Y$1=.9,H=.8,J=.17,p$2=.1,u=.999,$=.9999;var k$3=.99,m=/[\\\/_+.#"@\[\(\{&]/,B$1=/[\\\/_+.#"@\[\(\{&]/g,K$1=/[\s-]/,X$1=/[\s-]/g;function G(_,C,h,P,A,f,O){if(f===C.length)return A===_.length?U:k$3;var T=`${A},${f}`;if(O[T]!==void 0)return O[T];for(var L=P.charAt(f),c=h.indexOf(L,A),S=0,E,N,R,M;c>=0;)E=G(_,C,h,P,c+1,f+1,O),E>S&&(c===A?E*=U:m.test(_.charAt(c-1))?(E*=H,R=_.slice(A,c-1).match(B$1),R&&A>0&&(E*=Math.pow(u,R.length))):K$1.test(_.charAt(c-1))?(E*=Y$1,M=_.slice(A,c-1).match(X$1),M&&A>0&&(E*=Math.pow(u,M.length))):(E*=J,A>0&&(E*=Math.pow(u,c-A))),_.charAt(c)!==C.charAt(f)&&(E*=$)),(E<p$2&&h.charAt(c-1)===P.charAt(f+1)||P.charAt(f+1)===P.charAt(f)&&h.charAt(c-1)!==P.charAt(f))&&(N=G(_,C,h,P,c+1,f+2,O),N*p$2>E&&(E=N*p$2)),E>S&&(S=E),c=h.indexOf(L,c+1);return O[T]=S,S}function D(_){return _.toLowerCase().replace(X$1," ")}function W(_,C,h){return _=h&&h.length>0?`${_+" "+h.join(" ")}`:_,G(_,C,D(_),D(C),0,0,{})}
|
|
19511
19119
|
|
|
19512
|
-
// src/primitive.tsx
|
|
19120
|
+
// packages/core/primitive/src/primitive.tsx
|
|
19513
19121
|
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
19514
19122
|
return function handleEvent(event) {
|
|
19515
19123
|
originalEventHandler?.(event);
|
|
@@ -19675,127 +19283,6 @@ function isFunction(value) {
|
|
|
19675
19283
|
return typeof value === "function";
|
|
19676
19284
|
}
|
|
19677
19285
|
|
|
19678
|
-
// src/slot.tsx
|
|
19679
|
-
// @__NO_SIDE_EFFECTS__
|
|
19680
|
-
function createSlot(ownerName) {
|
|
19681
|
-
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
19682
|
-
const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
19683
|
-
const { children, ...slotProps } = props;
|
|
19684
|
-
const childrenArray = React__namespace.Children.toArray(children);
|
|
19685
|
-
const slottable = childrenArray.find(isSlottable);
|
|
19686
|
-
if (slottable) {
|
|
19687
|
-
const newElement = slottable.props.children;
|
|
19688
|
-
const newChildren = childrenArray.map((child) => {
|
|
19689
|
-
if (child === slottable) {
|
|
19690
|
-
if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
|
|
19691
|
-
return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
|
|
19692
|
-
} else {
|
|
19693
|
-
return child;
|
|
19694
|
-
}
|
|
19695
|
-
});
|
|
19696
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
|
|
19697
|
-
}
|
|
19698
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
19699
|
-
});
|
|
19700
|
-
Slot2.displayName = `${ownerName}.Slot`;
|
|
19701
|
-
return Slot2;
|
|
19702
|
-
}
|
|
19703
|
-
// @__NO_SIDE_EFFECTS__
|
|
19704
|
-
function createSlotClone(ownerName) {
|
|
19705
|
-
const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
|
|
19706
|
-
const { children, ...slotProps } = props;
|
|
19707
|
-
if (React__namespace.isValidElement(children)) {
|
|
19708
|
-
const childrenRef = getElementRef$1(children);
|
|
19709
|
-
const props2 = mergeProps(slotProps, children.props);
|
|
19710
|
-
if (children.type !== React__namespace.Fragment) {
|
|
19711
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
19712
|
-
}
|
|
19713
|
-
return React__namespace.cloneElement(children, props2);
|
|
19714
|
-
}
|
|
19715
|
-
return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
|
|
19716
|
-
});
|
|
19717
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
19718
|
-
return SlotClone;
|
|
19719
|
-
}
|
|
19720
|
-
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
19721
|
-
function isSlottable(child) {
|
|
19722
|
-
return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
19723
|
-
}
|
|
19724
|
-
function mergeProps(slotProps, childProps) {
|
|
19725
|
-
const overrideProps = { ...childProps };
|
|
19726
|
-
for (const propName in childProps) {
|
|
19727
|
-
const slotPropValue = slotProps[propName];
|
|
19728
|
-
const childPropValue = childProps[propName];
|
|
19729
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
19730
|
-
if (isHandler) {
|
|
19731
|
-
if (slotPropValue && childPropValue) {
|
|
19732
|
-
overrideProps[propName] = (...args) => {
|
|
19733
|
-
const result = childPropValue(...args);
|
|
19734
|
-
slotPropValue(...args);
|
|
19735
|
-
return result;
|
|
19736
|
-
};
|
|
19737
|
-
} else if (slotPropValue) {
|
|
19738
|
-
overrideProps[propName] = slotPropValue;
|
|
19739
|
-
}
|
|
19740
|
-
} else if (propName === "style") {
|
|
19741
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
19742
|
-
} else if (propName === "className") {
|
|
19743
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
19744
|
-
}
|
|
19745
|
-
}
|
|
19746
|
-
return { ...slotProps, ...overrideProps };
|
|
19747
|
-
}
|
|
19748
|
-
function getElementRef$1(element) {
|
|
19749
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
19750
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
19751
|
-
if (mayWarn) {
|
|
19752
|
-
return element.ref;
|
|
19753
|
-
}
|
|
19754
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
19755
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
19756
|
-
if (mayWarn) {
|
|
19757
|
-
return element.props.ref;
|
|
19758
|
-
}
|
|
19759
|
-
return element.props.ref || element.ref;
|
|
19760
|
-
}
|
|
19761
|
-
|
|
19762
|
-
// src/primitive.tsx
|
|
19763
|
-
var NODES = [
|
|
19764
|
-
"a",
|
|
19765
|
-
"button",
|
|
19766
|
-
"div",
|
|
19767
|
-
"form",
|
|
19768
|
-
"h2",
|
|
19769
|
-
"h3",
|
|
19770
|
-
"img",
|
|
19771
|
-
"input",
|
|
19772
|
-
"label",
|
|
19773
|
-
"li",
|
|
19774
|
-
"nav",
|
|
19775
|
-
"ol",
|
|
19776
|
-
"p",
|
|
19777
|
-
"select",
|
|
19778
|
-
"span",
|
|
19779
|
-
"svg",
|
|
19780
|
-
"ul"
|
|
19781
|
-
];
|
|
19782
|
-
var Primitive = NODES.reduce((primitive, node) => {
|
|
19783
|
-
const Slot = createSlot(`Primitive.${node}`);
|
|
19784
|
-
const Node = React__namespace.forwardRef((props, forwardedRef) => {
|
|
19785
|
-
const { asChild, ...primitiveProps } = props;
|
|
19786
|
-
const Comp = asChild ? Slot : node;
|
|
19787
|
-
if (typeof window !== "undefined") {
|
|
19788
|
-
window[Symbol.for("radix-ui")] = true;
|
|
19789
|
-
}
|
|
19790
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
19791
|
-
});
|
|
19792
|
-
Node.displayName = `Primitive.${node}`;
|
|
19793
|
-
return { ...primitive, [node]: Node };
|
|
19794
|
-
}, {});
|
|
19795
|
-
function dispatchDiscreteCustomEvent(target, event) {
|
|
19796
|
-
if (target) ReactDOM__namespace.flushSync(() => target.dispatchEvent(event));
|
|
19797
|
-
}
|
|
19798
|
-
|
|
19799
19286
|
// packages/react/use-callback-ref/src/use-callback-ref.tsx
|
|
19800
19287
|
function useCallbackRef$1(callback) {
|
|
19801
19288
|
const callbackRef = React__namespace.useRef(callback);
|
|
@@ -20299,7 +19786,7 @@ function usePresence(present) {
|
|
|
20299
19786
|
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
20300
19787
|
const handleAnimationEnd = (event) => {
|
|
20301
19788
|
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
20302
|
-
const isCurrentAnimation = currentAnimationName.includes(
|
|
19789
|
+
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
20303
19790
|
if (event.target === node && isCurrentAnimation) {
|
|
20304
19791
|
send("ANIMATION_END");
|
|
20305
19792
|
if (!prevPresentRef.current) {
|
|
@@ -21215,7 +20702,7 @@ var hideOthers = function (originalTarget, parentNode, markerName) {
|
|
|
21215
20702
|
};
|
|
21216
20703
|
|
|
21217
20704
|
var DIALOG_NAME = "Dialog";
|
|
21218
|
-
var [createDialogContext] = createContextScope(DIALOG_NAME);
|
|
20705
|
+
var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
|
|
21219
20706
|
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
21220
20707
|
var Dialog = (props) => {
|
|
21221
20708
|
const {
|
|
@@ -21513,7 +21000,7 @@ var Portal = DialogPortal;
|
|
|
21513
21000
|
var Overlay = DialogOverlay;
|
|
21514
21001
|
var Content$1 = DialogContent;
|
|
21515
21002
|
|
|
21516
|
-
var N='[cmdk-group=""]',Y='[cmdk-group-items=""]',be='[cmdk-group-heading=""]',le='[cmdk-item=""]',ce=`${le}:not([aria-disabled="true"])`,Z="cmdk-item-select",T="data-value",Re=(r,o,n)=>W(r,o,n),ue=React__namespace.createContext(void 0),K=()=>React__namespace.useContext(ue),de=React__namespace.createContext(void 0),ee=()=>React__namespace.useContext(de),fe=React__namespace.createContext(void 0),me=React__namespace.forwardRef((r,o)=>{let n=L(()=>{var e,a;return {search:"",value:(a=(e=r.value)!=null?e:r.defaultValue)!=null?a:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),u=L(()=>new Set),c=L(()=>new Map),d=L(()=>new Map),f=L(()=>new Set),p=pe(r),{label:b,children:m,value:R,onValueChange:x,filter:C,shouldFilter:S,loop:A,disablePointerSelection:ge=false,vimBindings:j=true,...O}=r,$=useId(),q=useId(),_=useId(),I=React__namespace.useRef(null),v=ke();k$2(()=>{if(R!==void 0){let e=R.trim();n.current.value=e,E.emit();}},[R]),k$2(()=>{v(6,ne);},[]);let E=React__namespace.useMemo(()=>({subscribe:e=>(f.current.add(e),()=>f.current.delete(e)),snapshot:()=>n.current,setState:(e,a,s)=>{var i,l,g,y;if(!Object.is(n.current[e],a)){if(n.current[e]=a,e==="search")J(),z(),v(1,W);else if(e==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let h=document.getElementById(_);h?h.focus():(i=document.getElementById($))==null||i.focus();}if(v(7,()=>{var h;n.current.selectedItemId=(h=M())==null?void 0:h.id,E.emit();}),s||v(5,ne),((l=p.current)==null?void 0:l.value)!==void 0){let h=a!=null?a:"";(y=(g=p.current).onValueChange)==null||y.call(g,h);return}}E.emit();}},emit:()=>{f.current.forEach(e=>e());}}),[]),U=React__namespace.useMemo(()=>({value:(e,a,s)=>{var i;a!==((i=d.current.get(e))==null?void 0:i.value)&&(d.current.set(e,{value:a,keywords:s}),n.current.filtered.items.set(e,te(a,s)),v(2,()=>{z(),E.emit();}));},item:(e,a)=>(u.current.add(e),a&&(c.current.has(a)?c.current.get(a).add(e):c.current.set(a,new Set([e]))),v(3,()=>{J(),z(),n.current.value||W(),E.emit();}),()=>{d.current.delete(e),u.current.delete(e),n.current.filtered.items.delete(e);let s=M();v(4,()=>{J(),(s==null?void 0:s.getAttribute("id"))===e&&W(),E.emit();});}),group:e=>(c.current.has(e)||c.current.set(e,new Set),()=>{d.current.delete(e),c.current.delete(e);}),filter:()=>p.current.shouldFilter,label:b||r["aria-label"],getDisablePointerSelection:()=>p.current.disablePointerSelection,listId:$,inputId:_,labelId:q,listInnerRef:I}),[]);function te(e,a){var i,l;let s=(l=(i=p.current)==null?void 0:i.filter)!=null?l:Re;return e?s(e,n.current.search,a):0}function z(){if(!n.current.search||p.current.shouldFilter===false)return;let e=n.current.filtered.items,a=[];n.current.filtered.groups.forEach(i=>{let l=c.current.get(i),g=0;l.forEach(y=>{let h=e.get(y);g=Math.max(h,g);}),a.push([i,g]);});let s=I.current;V().sort((i,l)=>{var h,F;let g=i.getAttribute("id"),y=l.getAttribute("id");return ((h=e.get(y))!=null?h:0)-((F=e.get(g))!=null?F:0)}).forEach(i=>{let l=i.closest(Y);l?l.appendChild(i.parentElement===l?i:i.closest(`${Y} > *`)):s.appendChild(i.parentElement===s?i:i.closest(`${Y} > *`));}),a.sort((i,l)=>l[1]-i[1]).forEach(i=>{var g;let l=(g=I.current)==null?void 0:g.querySelector(`${N}[${T}="${encodeURIComponent(i[0])}"]`);l==null||l.parentElement.appendChild(l);});}function W(){let e=V().find(s=>s.getAttribute("aria-disabled")!=="true"),a=e==null?void 0:e.getAttribute(T);E.setState("value",a||void 0);}function J(){var a,s,i,l;if(!n.current.search||p.current.shouldFilter===false){n.current.filtered.count=u.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let g of u.current){let y=(s=(a=d.current.get(g))==null?void 0:a.value)!=null?s:"",h=(l=(i=d.current.get(g))==null?void 0:i.keywords)!=null?l:[],F=te(y,h);n.current.filtered.items.set(g,F),F>0&&e++;}for(let[g,y]of c.current)for(let h of y)if(n.current.filtered.items.get(h)>0){n.current.filtered.groups.add(g);break}n.current.filtered.count=e;}function ne(){var a,s,i;let e=M();e&&(((a=e.parentElement)==null?void 0:a.firstChild)===e&&((i=(s=e.closest(N))==null?void 0:s.querySelector(be))==null||i.scrollIntoView({block:"nearest"})),e.scrollIntoView({block:"nearest"}));}function M(){var e;return (e=I.current)==null?void 0:e.querySelector(`${le}[aria-selected="true"]`)}function V(){var e;return Array.from(((e=I.current)==null?void 0:e.querySelectorAll(ce))||[])}function X(e){let s=V()[e];s&&E.setState("value",s.getAttribute(T));}function Q(e){var g;let a=M(),s=V(),i=s.findIndex(y=>y===a),l=s[i+e];(g=p.current)!=null&&g.loop&&(l=i+e<0?s[s.length-1]:i+e===s.length?s[0]:s[i+e]),l&&E.setState("value",l.getAttribute(T));}function re(e){let a=M(),s=a==null?void 0:a.closest(N),i;for(;s&&!i;)s=e>0?we(s,N):De(s,N),i=s==null?void 0:s.querySelector(ce);i?E.setState("value",i.getAttribute(T)):Q(e);}let oe=()=>X(V().length-1),ie=e=>{e.preventDefault(),e.metaKey?oe():e.altKey?re(1):Q(1);},se=e=>{e.preventDefault(),e.metaKey?X(0):e.altKey?re(-1):Q(-1);};return React__namespace.createElement(Primitive$1.div,{ref:o,tabIndex:-1,...O,"cmdk-root":"",onKeyDown:e=>{var s;(s=O.onKeyDown)==null||s.call(O,e);let a=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||a))switch(e.key){case "n":case "j":{j&&e.ctrlKey&&ie(e);break}case "ArrowDown":{ie(e);break}case "p":case "k":{j&&e.ctrlKey&&se(e);break}case "ArrowUp":{se(e);break}case "Home":{e.preventDefault(),X(0);break}case "End":{e.preventDefault(),oe();break}case "Enter":{e.preventDefault();let i=M();if(i){let l=new Event(Z);i.dispatchEvent(l);}}}}},React__namespace.createElement("label",{"cmdk-label":"",htmlFor:U.inputId,id:U.labelId,style:Te},b),B(r,e=>React__namespace.createElement(de.Provider,{value:E},React__namespace.createElement(ue.Provider,{value:U},e))))}),he=React__namespace.forwardRef((r,o)=>{var _,I;let n=useId(),u=React__namespace.useRef(null),c=React__namespace.useContext(fe),d=K(),f=pe(r),p=(I=(_=f.current)==null?void 0:_.forceMount)!=null?I:c==null?void 0:c.forceMount;k$2(()=>{if(!p)return d.item(n,c==null?void 0:c.id)},[p]);let b=ve(n,u,[r.value,r.children,u],r.keywords),m=ee(),R=P(v=>v.value&&v.value===b.current),x=P(v=>p||d.filter()===false?true:v.search?v.filtered.items.get(n)>0:true);React__namespace.useEffect(()=>{let v=u.current;if(!(!v||r.disabled))return v.addEventListener(Z,C),()=>v.removeEventListener(Z,C)},[x,r.onSelect,r.disabled]);function C(){var v,E;S(),(E=(v=f.current).onSelect)==null||E.call(v,b.current);}function S(){m.setState("value",b.current,true);}if(!x)return null;let{disabled:A,value:ge,onSelect:j,forceMount:O,keywords:$,...q}=r;return React__namespace.createElement(Primitive$1.div,{ref:composeRefs(u,o),...q,id:n,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!R,"data-disabled":!!A,"data-selected":!!R,onPointerMove:A||d.getDisablePointerSelection()?void 0:S,onClick:A?void 0:C},r.children)}),Ee=React__namespace.forwardRef((r,o)=>{let{heading:n,children:u,forceMount:c,...d}=r,f=useId(),p=React__namespace.useRef(null),b=React__namespace.useRef(null),m=useId(),R=K(),x=P(S=>c||R.filter()===false?true:S.search?S.filtered.groups.has(f):true);k$2(()=>R.group(f),[]),ve(f,p,[r.value,r.heading,b]);let C=React__namespace.useMemo(()=>({id:f,forceMount:c}),[c]);return React__namespace.createElement(Primitive$1.div,{ref:composeRefs(p,o),...d,"cmdk-group":"",role:"presentation",hidden:x?void 0:true},n&&React__namespace.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":true,id:m},n),B(r,S=>React__namespace.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?m:void 0},React__namespace.createElement(fe.Provider,{value:C},S))))}),ye=React__namespace.forwardRef((r,o)=>{let{alwaysRender:n,...u}=r,c=React__namespace.useRef(null),d=P(f=>!f.search);return !n&&!d?null:React__namespace.createElement(Primitive$1.div,{ref:composeRefs(c,o),...u,"cmdk-separator":"",role:"separator"})}),Se=React__namespace.forwardRef((r,o)=>{let{onValueChange:n,...u}=r,c=r.value!=null,d=ee(),f=P(m=>m.search),p=P(m=>m.selectedItemId),b=K();return React__namespace.useEffect(()=>{r.value!=null&&d.setState("search",r.value);},[r.value]),React__namespace.createElement(Primitive$1.input,{ref:o,...u,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:false,"aria-autocomplete":"list",role:"combobox","aria-expanded":true,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":p,id:b.inputId,type:"text",value:c?r.value:f,onChange:m=>{c||d.setState("search",m.target.value),n==null||n(m.target.value);}})}),Ce=React__namespace.forwardRef((r,o)=>{let{children:n,label:u="Suggestions",...c}=r,d=React__namespace.useRef(null),f=React__namespace.useRef(null),p=P(m=>m.selectedItemId),b=K();return React__namespace.useEffect(()=>{if(f.current&&d.current){let m=f.current,R=d.current,x,C=new ResizeObserver(()=>{x=requestAnimationFrame(()=>{let S=m.offsetHeight;R.style.setProperty("--cmdk-list-height",S.toFixed(1)+"px");});});return C.observe(m),()=>{cancelAnimationFrame(x),C.unobserve(m);}}},[]),React__namespace.createElement(Primitive$1.div,{ref:composeRefs(d,o),...c,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":p,"aria-label":u,id:b.listId},B(r,m=>React__namespace.createElement("div",{ref:composeRefs(f,b.listInnerRef),"cmdk-list-sizer":""},m)))}),xe=React__namespace.forwardRef((r,o)=>{let{open:n,onOpenChange:u,overlayClassName:c,contentClassName:d,container:f,...p}=r;return React__namespace.createElement(Root$1,{open:n,onOpenChange:u},React__namespace.createElement(Portal,{container:f},React__namespace.createElement(Overlay,{"cmdk-overlay":"",className:c}),React__namespace.createElement(Content$1,{"aria-label":r.label,"cmdk-dialog":"",className:d},React__namespace.createElement(me,{ref:o,...p}))))}),Ie=React__namespace.forwardRef((r,o)=>P(u=>u.filtered.count===0)?React__namespace.createElement(Primitive$1.div,{ref:o,...r,"cmdk-empty":"",role:"presentation"}):null),Pe=React__namespace.forwardRef((r,o)=>{let{progress:n,children:u,label:c="Loading...",...d}=r;return React__namespace.createElement(Primitive$1.div,{ref:o,...d,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":c},B(r,f=>React__namespace.createElement("div",{"aria-hidden":true},f)))}),_e=Object.assign(me,{List:Ce,Item:he,Input:Se,Group:Ee,Separator:ye,Dialog:xe,Empty:Ie,Loading:Pe});function we(r,o){let n=r.nextElementSibling;for(;n;){if(n.matches(o))return n;n=n.nextElementSibling;}}function De(r,o){let n=r.previousElementSibling;for(;n;){if(n.matches(o))return n;n=n.previousElementSibling;}}function pe(r){let o=React__namespace.useRef(r);return k$2(()=>{o.current=r;}),o}var k$2=typeof window=="undefined"?React__namespace.useEffect:React__namespace.useLayoutEffect;function L(r){let o=React__namespace.useRef();return o.current===void 0&&(o.current=r()),o}function P(r){let o=ee(),n=()=>r(o.snapshot());return React__namespace.useSyncExternalStore(o.subscribe,n,n)}function ve(r,o,n,u=[]){let c=React__namespace.useRef(),d=K();return k$2(()=>{var b;let f=(()=>{var m;for(let R of n){if(typeof R=="string")return R.trim();if(typeof R=="object"&&"current"in R)return R.current?(m=R.current.textContent)==null?void 0:m.trim():c.current}})(),p=u.map(m=>m.trim());d.value(r,f,p),(b=o.current)==null||b.setAttribute(T,f),c.current=f;}),c}var ke=()=>{let[r,o]=React__namespace.useState(),n=L(()=>new Map);return k$2(()=>{n.current.forEach(u=>u()),n.current=new Map;},[r]),(u,c)=>{n.current.set(u,c),o({});}};function Me(r){let o=r.type;return typeof o=="function"?o(r.props):"render"in o?o.render(r.props):r}function B({asChild:r,children:o},n){return r&&React__namespace.isValidElement(o)?React__namespace.cloneElement(Me(o),{ref:o.ref},n(o.props.children)):n(o)}var Te={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};
|
|
21003
|
+
var N='[cmdk-group=""]',Y='[cmdk-group-items=""]',be='[cmdk-group-heading=""]',le='[cmdk-item=""]',ce=`${le}:not([aria-disabled="true"])`,Z="cmdk-item-select",T="data-value",Re=(r,o,n)=>W(r,o,n),ue=React__namespace.createContext(void 0),K=()=>React__namespace.useContext(ue),de=React__namespace.createContext(void 0),ee=()=>React__namespace.useContext(de),fe=React__namespace.createContext(void 0),me=React__namespace.forwardRef((r,o)=>{let n=L(()=>{var e,a;return {search:"",value:(a=(e=r.value)!=null?e:r.defaultValue)!=null?a:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),u=L(()=>new Set),c=L(()=>new Map),d=L(()=>new Map),f=L(()=>new Set),p=pe(r),{label:b,children:m,value:R,onValueChange:x,filter:C,shouldFilter:S,loop:A,disablePointerSelection:ge=false,vimBindings:j=true,...O}=r,$=useId(),q=useId(),_=useId(),I=React__namespace.useRef(null),v=ke();k$2(()=>{if(R!==void 0){let e=R.trim();n.current.value=e,E.emit();}},[R]),k$2(()=>{v(6,ne);},[]);let E=React__namespace.useMemo(()=>({subscribe:e=>(f.current.add(e),()=>f.current.delete(e)),snapshot:()=>n.current,setState:(e,a,s)=>{var i,l,g,y;if(!Object.is(n.current[e],a)){if(n.current[e]=a,e==="search")J(),z(),v(1,W);else if(e==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let h=document.getElementById(_);h?h.focus():(i=document.getElementById($))==null||i.focus();}if(v(7,()=>{var h;n.current.selectedItemId=(h=M())==null?void 0:h.id,E.emit();}),s||v(5,ne),((l=p.current)==null?void 0:l.value)!==void 0){let h=a!=null?a:"";(y=(g=p.current).onValueChange)==null||y.call(g,h);return}}E.emit();}},emit:()=>{f.current.forEach(e=>e());}}),[]),U=React__namespace.useMemo(()=>({value:(e,a,s)=>{var i;a!==((i=d.current.get(e))==null?void 0:i.value)&&(d.current.set(e,{value:a,keywords:s}),n.current.filtered.items.set(e,te(a,s)),v(2,()=>{z(),E.emit();}));},item:(e,a)=>(u.current.add(e),a&&(c.current.has(a)?c.current.get(a).add(e):c.current.set(a,new Set([e]))),v(3,()=>{J(),z(),n.current.value||W(),E.emit();}),()=>{d.current.delete(e),u.current.delete(e),n.current.filtered.items.delete(e);let s=M();v(4,()=>{J(),(s==null?void 0:s.getAttribute("id"))===e&&W(),E.emit();});}),group:e=>(c.current.has(e)||c.current.set(e,new Set),()=>{d.current.delete(e),c.current.delete(e);}),filter:()=>p.current.shouldFilter,label:b||r["aria-label"],getDisablePointerSelection:()=>p.current.disablePointerSelection,listId:$,inputId:_,labelId:q,listInnerRef:I}),[]);function te(e,a){var i,l;let s=(l=(i=p.current)==null?void 0:i.filter)!=null?l:Re;return e?s(e,n.current.search,a):0}function z(){if(!n.current.search||p.current.shouldFilter===false)return;let e=n.current.filtered.items,a=[];n.current.filtered.groups.forEach(i=>{let l=c.current.get(i),g=0;l.forEach(y=>{let h=e.get(y);g=Math.max(h,g);}),a.push([i,g]);});let s=I.current;V().sort((i,l)=>{var h,F;let g=i.getAttribute("id"),y=l.getAttribute("id");return ((h=e.get(y))!=null?h:0)-((F=e.get(g))!=null?F:0)}).forEach(i=>{let l=i.closest(Y);l?l.appendChild(i.parentElement===l?i:i.closest(`${Y} > *`)):s.appendChild(i.parentElement===s?i:i.closest(`${Y} > *`));}),a.sort((i,l)=>l[1]-i[1]).forEach(i=>{var g;let l=(g=I.current)==null?void 0:g.querySelector(`${N}[${T}="${encodeURIComponent(i[0])}"]`);l==null||l.parentElement.appendChild(l);});}function W(){let e=V().find(s=>s.getAttribute("aria-disabled")!=="true"),a=e==null?void 0:e.getAttribute(T);E.setState("value",a||void 0);}function J(){var a,s,i,l;if(!n.current.search||p.current.shouldFilter===false){n.current.filtered.count=u.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let g of u.current){let y=(s=(a=d.current.get(g))==null?void 0:a.value)!=null?s:"",h=(l=(i=d.current.get(g))==null?void 0:i.keywords)!=null?l:[],F=te(y,h);n.current.filtered.items.set(g,F),F>0&&e++;}for(let[g,y]of c.current)for(let h of y)if(n.current.filtered.items.get(h)>0){n.current.filtered.groups.add(g);break}n.current.filtered.count=e;}function ne(){var a,s,i;let e=M();e&&(((a=e.parentElement)==null?void 0:a.firstChild)===e&&((i=(s=e.closest(N))==null?void 0:s.querySelector(be))==null||i.scrollIntoView({block:"nearest"})),e.scrollIntoView({block:"nearest"}));}function M(){var e;return (e=I.current)==null?void 0:e.querySelector(`${le}[aria-selected="true"]`)}function V(){var e;return Array.from(((e=I.current)==null?void 0:e.querySelectorAll(ce))||[])}function X(e){let s=V()[e];s&&E.setState("value",s.getAttribute(T));}function Q(e){var g;let a=M(),s=V(),i=s.findIndex(y=>y===a),l=s[i+e];(g=p.current)!=null&&g.loop&&(l=i+e<0?s[s.length-1]:i+e===s.length?s[0]:s[i+e]),l&&E.setState("value",l.getAttribute(T));}function re(e){let a=M(),s=a==null?void 0:a.closest(N),i;for(;s&&!i;)s=e>0?we(s,N):De(s,N),i=s==null?void 0:s.querySelector(ce);i?E.setState("value",i.getAttribute(T)):Q(e);}let oe=()=>X(V().length-1),ie=e=>{e.preventDefault(),e.metaKey?oe():e.altKey?re(1):Q(1);},se=e=>{e.preventDefault(),e.metaKey?X(0):e.altKey?re(-1):Q(-1);};return React__namespace.createElement(Primitive.div,{ref:o,tabIndex:-1,...O,"cmdk-root":"",onKeyDown:e=>{var s;(s=O.onKeyDown)==null||s.call(O,e);let a=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||a))switch(e.key){case "n":case "j":{j&&e.ctrlKey&&ie(e);break}case "ArrowDown":{ie(e);break}case "p":case "k":{j&&e.ctrlKey&&se(e);break}case "ArrowUp":{se(e);break}case "Home":{e.preventDefault(),X(0);break}case "End":{e.preventDefault(),oe();break}case "Enter":{e.preventDefault();let i=M();if(i){let l=new Event(Z);i.dispatchEvent(l);}}}}},React__namespace.createElement("label",{"cmdk-label":"",htmlFor:U.inputId,id:U.labelId,style:Te},b),B(r,e=>React__namespace.createElement(de.Provider,{value:E},React__namespace.createElement(ue.Provider,{value:U},e))))}),he=React__namespace.forwardRef((r,o)=>{var _,I;let n=useId(),u=React__namespace.useRef(null),c=React__namespace.useContext(fe),d=K(),f=pe(r),p=(I=(_=f.current)==null?void 0:_.forceMount)!=null?I:c==null?void 0:c.forceMount;k$2(()=>{if(!p)return d.item(n,c==null?void 0:c.id)},[p]);let b=ve(n,u,[r.value,r.children,u],r.keywords),m=ee(),R=P(v=>v.value&&v.value===b.current),x=P(v=>p||d.filter()===false?true:v.search?v.filtered.items.get(n)>0:true);React__namespace.useEffect(()=>{let v=u.current;if(!(!v||r.disabled))return v.addEventListener(Z,C),()=>v.removeEventListener(Z,C)},[x,r.onSelect,r.disabled]);function C(){var v,E;S(),(E=(v=f.current).onSelect)==null||E.call(v,b.current);}function S(){m.setState("value",b.current,true);}if(!x)return null;let{disabled:A,value:ge,onSelect:j,forceMount:O,keywords:$,...q}=r;return React__namespace.createElement(Primitive.div,{ref:composeRefs(u,o),...q,id:n,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!R,"data-disabled":!!A,"data-selected":!!R,onPointerMove:A||d.getDisablePointerSelection()?void 0:S,onClick:A?void 0:C},r.children)}),Ee=React__namespace.forwardRef((r,o)=>{let{heading:n,children:u,forceMount:c,...d}=r,f=useId(),p=React__namespace.useRef(null),b=React__namespace.useRef(null),m=useId(),R=K(),x=P(S=>c||R.filter()===false?true:S.search?S.filtered.groups.has(f):true);k$2(()=>R.group(f),[]),ve(f,p,[r.value,r.heading,b]);let C=React__namespace.useMemo(()=>({id:f,forceMount:c}),[c]);return React__namespace.createElement(Primitive.div,{ref:composeRefs(p,o),...d,"cmdk-group":"",role:"presentation",hidden:x?void 0:true},n&&React__namespace.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":true,id:m},n),B(r,S=>React__namespace.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?m:void 0},React__namespace.createElement(fe.Provider,{value:C},S))))}),ye=React__namespace.forwardRef((r,o)=>{let{alwaysRender:n,...u}=r,c=React__namespace.useRef(null),d=P(f=>!f.search);return !n&&!d?null:React__namespace.createElement(Primitive.div,{ref:composeRefs(c,o),...u,"cmdk-separator":"",role:"separator"})}),Se=React__namespace.forwardRef((r,o)=>{let{onValueChange:n,...u}=r,c=r.value!=null,d=ee(),f=P(m=>m.search),p=P(m=>m.selectedItemId),b=K();return React__namespace.useEffect(()=>{r.value!=null&&d.setState("search",r.value);},[r.value]),React__namespace.createElement(Primitive.input,{ref:o,...u,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:false,"aria-autocomplete":"list",role:"combobox","aria-expanded":true,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":p,id:b.inputId,type:"text",value:c?r.value:f,onChange:m=>{c||d.setState("search",m.target.value),n==null||n(m.target.value);}})}),Ce=React__namespace.forwardRef((r,o)=>{let{children:n,label:u="Suggestions",...c}=r,d=React__namespace.useRef(null),f=React__namespace.useRef(null),p=P(m=>m.selectedItemId),b=K();return React__namespace.useEffect(()=>{if(f.current&&d.current){let m=f.current,R=d.current,x,C=new ResizeObserver(()=>{x=requestAnimationFrame(()=>{let S=m.offsetHeight;R.style.setProperty("--cmdk-list-height",S.toFixed(1)+"px");});});return C.observe(m),()=>{cancelAnimationFrame(x),C.unobserve(m);}}},[]),React__namespace.createElement(Primitive.div,{ref:composeRefs(d,o),...c,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":p,"aria-label":u,id:b.listId},B(r,m=>React__namespace.createElement("div",{ref:composeRefs(f,b.listInnerRef),"cmdk-list-sizer":""},m)))}),xe=React__namespace.forwardRef((r,o)=>{let{open:n,onOpenChange:u,overlayClassName:c,contentClassName:d,container:f,...p}=r;return React__namespace.createElement(Root$1,{open:n,onOpenChange:u},React__namespace.createElement(Portal,{container:f},React__namespace.createElement(Overlay,{"cmdk-overlay":"",className:c}),React__namespace.createElement(Content$1,{"aria-label":r.label,"cmdk-dialog":"",className:d},React__namespace.createElement(me,{ref:o,...p}))))}),Ie=React__namespace.forwardRef((r,o)=>P(u=>u.filtered.count===0)?React__namespace.createElement(Primitive.div,{ref:o,...r,"cmdk-empty":"",role:"presentation"}):null),Pe=React__namespace.forwardRef((r,o)=>{let{progress:n,children:u,label:c="Loading...",...d}=r;return React__namespace.createElement(Primitive.div,{ref:o,...d,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":c},B(r,f=>React__namespace.createElement("div",{"aria-hidden":true},f)))}),_e=Object.assign(me,{List:Ce,Item:he,Input:Se,Group:Ee,Separator:ye,Dialog:xe,Empty:Ie,Loading:Pe});function we(r,o){let n=r.nextElementSibling;for(;n;){if(n.matches(o))return n;n=n.nextElementSibling;}}function De(r,o){let n=r.previousElementSibling;for(;n;){if(n.matches(o))return n;n=n.previousElementSibling;}}function pe(r){let o=React__namespace.useRef(r);return k$2(()=>{o.current=r;}),o}var k$2=typeof window=="undefined"?React__namespace.useEffect:React__namespace.useLayoutEffect;function L(r){let o=React__namespace.useRef();return o.current===void 0&&(o.current=r()),o}function P(r){let o=ee(),n=()=>r(o.snapshot());return React__namespace.useSyncExternalStore(o.subscribe,n,n)}function ve(r,o,n,u=[]){let c=React__namespace.useRef(),d=K();return k$2(()=>{var b;let f=(()=>{var m;for(let R of n){if(typeof R=="string")return R.trim();if(typeof R=="object"&&"current"in R)return R.current?(m=R.current.textContent)==null?void 0:m.trim():c.current}})(),p=u.map(m=>m.trim());d.value(r,f,p),(b=o.current)==null||b.setAttribute(T,f),c.current=f;}),c}var ke=()=>{let[r,o]=React__namespace.useState(),n=L(()=>new Map);return k$2(()=>{n.current.forEach(u=>u()),n.current=new Map;},[r]),(u,c)=>{n.current.set(u,c),o({});}};function Me(r){let o=r.type;return typeof o=="function"?o(r.props):"render"in o?o.render(r.props):r}function B({asChild:r,children:o},n){return r&&React__namespace.isValidElement(o)?React__namespace.cloneElement(Me(o),{ref:o.ref},n(o.props.children)):n(o)}var Te={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};
|
|
21517
21004
|
|
|
21518
21005
|
/**
|
|
21519
21006
|
* @license lucide-react v0.479.0 - ISC
|
|
@@ -22245,7 +21732,7 @@ const flip$2 = function (options) {
|
|
|
22245
21732
|
if (!ignoreCrossAxisOverflow ||
|
|
22246
21733
|
// We leave the current main axis only if every placement on that axis
|
|
22247
21734
|
// overflows the main axis.
|
|
22248
|
-
overflowsData.every(d =>
|
|
21735
|
+
overflowsData.every(d => d.overflows[0] > 0 && getSideAxis(d.placement) === initialSideAxis)) {
|
|
22249
21736
|
// Try next placement and re-run the lifecycle.
|
|
22250
21737
|
return {
|
|
22251
21738
|
data: {
|
|
@@ -22984,9 +22471,14 @@ function getWindowScrollBarX(element, rect) {
|
|
|
22984
22471
|
return rect.left + leftScroll;
|
|
22985
22472
|
}
|
|
22986
22473
|
|
|
22987
|
-
function getHTMLOffset(documentElement, scroll) {
|
|
22474
|
+
function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
|
|
22475
|
+
if (ignoreScrollbarX === void 0) {
|
|
22476
|
+
ignoreScrollbarX = false;
|
|
22477
|
+
}
|
|
22988
22478
|
const htmlRect = documentElement.getBoundingClientRect();
|
|
22989
|
-
const x = htmlRect.left + scroll.scrollLeft -
|
|
22479
|
+
const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
|
|
22480
|
+
// RTL <body> scrollbar.
|
|
22481
|
+
getWindowScrollBarX(documentElement, htmlRect));
|
|
22990
22482
|
const y = htmlRect.top + scroll.scrollTop;
|
|
22991
22483
|
return {
|
|
22992
22484
|
x,
|
|
@@ -23025,7 +22517,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
23025
22517
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
23026
22518
|
}
|
|
23027
22519
|
}
|
|
23028
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
22520
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
|
|
23029
22521
|
return {
|
|
23030
22522
|
width: rect.width * scale.x,
|
|
23031
22523
|
height: rect.height * scale.y,
|
|
@@ -23059,10 +22551,6 @@ function getDocumentRect(element) {
|
|
|
23059
22551
|
};
|
|
23060
22552
|
}
|
|
23061
22553
|
|
|
23062
|
-
// Safety check: ensure the scrollbar space is reasonable in case this
|
|
23063
|
-
// calculation is affected by unusual styles.
|
|
23064
|
-
// Most scrollbars leave 15-18px of space.
|
|
23065
|
-
const SCROLLBAR_MAX = 25;
|
|
23066
22554
|
function getViewportRect(element, strategy) {
|
|
23067
22555
|
const win = getWindow(element);
|
|
23068
22556
|
const html = getDocumentElement(element);
|
|
@@ -23080,24 +22568,6 @@ function getViewportRect(element, strategy) {
|
|
|
23080
22568
|
y = visualViewport.offsetTop;
|
|
23081
22569
|
}
|
|
23082
22570
|
}
|
|
23083
|
-
const windowScrollbarX = getWindowScrollBarX(html);
|
|
23084
|
-
// <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
|
|
23085
|
-
// visual width of the <html> but this is not considered in the size
|
|
23086
|
-
// of `html.clientWidth`.
|
|
23087
|
-
if (windowScrollbarX <= 0) {
|
|
23088
|
-
const doc = html.ownerDocument;
|
|
23089
|
-
const body = doc.body;
|
|
23090
|
-
const bodyStyles = getComputedStyle(body);
|
|
23091
|
-
const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
23092
|
-
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
23093
|
-
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
23094
|
-
width -= clippingStableScrollbarWidth;
|
|
23095
|
-
}
|
|
23096
|
-
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
23097
|
-
// If the <body> scrollbar is on the left, the width needs to be extended
|
|
23098
|
-
// by the scrollbar amount so there isn't extra space on the right.
|
|
23099
|
-
width += windowScrollbarX;
|
|
23100
|
-
}
|
|
23101
22571
|
return {
|
|
23102
22572
|
width,
|
|
23103
22573
|
height,
|
|
@@ -24008,13 +23478,8 @@ var PopperAnchor = React__namespace.forwardRef(
|
|
|
24008
23478
|
const context = usePopperContext(ANCHOR_NAME$1, __scopePopper);
|
|
24009
23479
|
const ref = React__namespace.useRef(null);
|
|
24010
23480
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
24011
|
-
const anchorRef = React__namespace.useRef(null);
|
|
24012
23481
|
React__namespace.useEffect(() => {
|
|
24013
|
-
|
|
24014
|
-
anchorRef.current = virtualRef?.current || ref.current;
|
|
24015
|
-
if (previousAnchor !== anchorRef.current) {
|
|
24016
|
-
context.onAnchorChange(anchorRef.current);
|
|
24017
|
-
}
|
|
23482
|
+
context.onAnchorChange(virtualRef?.current || ref.current);
|
|
24018
23483
|
});
|
|
24019
23484
|
return virtualRef ? null : /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
|
|
24020
23485
|
}
|
|
@@ -24263,7 +23728,7 @@ var Content = PopperContent;
|
|
|
24263
23728
|
var Arrow = PopperArrow;
|
|
24264
23729
|
|
|
24265
23730
|
var POPOVER_NAME = "Popover";
|
|
24266
|
-
var [createPopoverContext] = createContextScope(POPOVER_NAME, [
|
|
23731
|
+
var [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [
|
|
24267
23732
|
createPopperScope
|
|
24268
23733
|
]);
|
|
24269
23734
|
var usePopperScope = createPopperScope();
|
|
@@ -30364,7 +29829,7 @@ var frRawCountries = [
|
|
|
30364
29829
|
id: 704,
|
|
30365
29830
|
alpha2: "vn",
|
|
30366
29831
|
alpha3: "vnm",
|
|
30367
|
-
name: "
|
|
29832
|
+
name: "Viêt Nam"
|
|
30368
29833
|
},
|
|
30369
29834
|
{
|
|
30370
29835
|
id: 887,
|
|
@@ -36476,10 +35941,10 @@ var hasRequiredReactStripe_umd;
|
|
|
36476
35941
|
function requireReactStripe_umd () {
|
|
36477
35942
|
if (hasRequiredReactStripe_umd) return reactStripe_umd$1.exports;
|
|
36478
35943
|
hasRequiredReactStripe_umd = 1;
|
|
36479
|
-
(function (module, exports
|
|
35944
|
+
(function (module, exports) {
|
|
36480
35945
|
(function (global, factory) {
|
|
36481
|
-
factory(exports
|
|
36482
|
-
})(reactStripe_umd, (function (exports
|
|
35946
|
+
factory(exports, React) ;
|
|
35947
|
+
})(reactStripe_umd, (function (exports, React) {
|
|
36483
35948
|
function ownKeys(object, enumerableOnly) {
|
|
36484
35949
|
var keys = Object.keys(object);
|
|
36485
35950
|
|
|
@@ -36914,12 +36379,12 @@ function requireReactStripe_umd () {
|
|
|
36914
36379
|
|
|
36915
36380
|
stripe._registerWrapper({
|
|
36916
36381
|
name: 'react-stripe-js',
|
|
36917
|
-
version: "3.
|
|
36382
|
+
version: "3.7.0"
|
|
36918
36383
|
});
|
|
36919
36384
|
|
|
36920
36385
|
stripe.registerAppInfo({
|
|
36921
36386
|
name: 'react-stripe-js',
|
|
36922
|
-
version: "3.
|
|
36387
|
+
version: "3.7.0",
|
|
36923
36388
|
url: 'https://stripe.com/docs/stripe-js/react'
|
|
36924
36389
|
});
|
|
36925
36390
|
};
|
|
@@ -36941,7 +36406,7 @@ function requireReactStripe_umd () {
|
|
|
36941
36406
|
* The `loadStripe` function will asynchronously load the Stripe.js script and initialize a `Stripe` object.
|
|
36942
36407
|
* Pass the returned `Promise` to `Elements`.
|
|
36943
36408
|
*
|
|
36944
|
-
* @docs https://
|
|
36409
|
+
* @docs https://stripe.com/docs/stripe-js/react#elements-provider
|
|
36945
36410
|
*/
|
|
36946
36411
|
|
|
36947
36412
|
var Elements = function Elements(_ref) {
|
|
@@ -37164,30 +36629,20 @@ function requireReactStripe_umd () {
|
|
|
37164
36629
|
var prevOptions = usePrevious(options);
|
|
37165
36630
|
var prevCheckoutSdk = usePrevious(ctx.checkoutSdk);
|
|
37166
36631
|
React.useEffect(function () {
|
|
37167
|
-
var _prevOptions$elements, _options$elementsOpti
|
|
36632
|
+
var _prevOptions$elements, _options$elementsOpti;
|
|
37168
36633
|
|
|
37169
36634
|
// Ignore changes while checkout sdk is not initialized.
|
|
37170
36635
|
if (!ctx.checkoutSdk) {
|
|
37171
36636
|
return;
|
|
37172
36637
|
}
|
|
37173
36638
|
|
|
37174
|
-
var hasSdkLoaded = Boolean(!prevCheckoutSdk && ctx.checkoutSdk); // Handle appearance changes
|
|
37175
|
-
|
|
37176
36639
|
var previousAppearance = prevOptions === null || prevOptions === void 0 ? void 0 : (_prevOptions$elements = prevOptions.elementsOptions) === null || _prevOptions$elements === void 0 ? void 0 : _prevOptions$elements.appearance;
|
|
37177
36640
|
var currentAppearance = options === null || options === void 0 ? void 0 : (_options$elementsOpti = options.elementsOptions) === null || _options$elementsOpti === void 0 ? void 0 : _options$elementsOpti.appearance;
|
|
37178
36641
|
var hasAppearanceChanged = !isEqual(currentAppearance, previousAppearance);
|
|
36642
|
+
var hasSdkLoaded = !prevCheckoutSdk && ctx.checkoutSdk;
|
|
37179
36643
|
|
|
37180
36644
|
if (currentAppearance && (hasAppearanceChanged || hasSdkLoaded)) {
|
|
37181
36645
|
ctx.checkoutSdk.changeAppearance(currentAppearance);
|
|
37182
|
-
} // Handle fonts changes
|
|
37183
|
-
|
|
37184
|
-
|
|
37185
|
-
var previousFonts = prevOptions === null || prevOptions === void 0 ? void 0 : (_prevOptions$elements2 = prevOptions.elementsOptions) === null || _prevOptions$elements2 === void 0 ? void 0 : _prevOptions$elements2.fonts;
|
|
37186
|
-
var currentFonts = options === null || options === void 0 ? void 0 : (_options$elementsOpti2 = options.elementsOptions) === null || _options$elementsOpti2 === void 0 ? void 0 : _options$elementsOpti2.fonts;
|
|
37187
|
-
var hasFontsChanged = !isEqual(previousFonts, currentFonts);
|
|
37188
|
-
|
|
37189
|
-
if (currentFonts && (hasFontsChanged || hasSdkLoaded)) {
|
|
37190
|
-
ctx.checkoutSdk.loadFonts(currentFonts);
|
|
37191
36646
|
}
|
|
37192
36647
|
}, [options, prevOptions, ctx.checkoutSdk, prevCheckoutSdk]); // Attach react-stripe-js version to stripe.js instance
|
|
37193
36648
|
|
|
@@ -37271,9 +36726,7 @@ function requireReactStripe_umd () {
|
|
|
37271
36726
|
onConfirm = _ref.onConfirm,
|
|
37272
36727
|
onCancel = _ref.onCancel,
|
|
37273
36728
|
onShippingAddressChange = _ref.onShippingAddressChange,
|
|
37274
|
-
onShippingRateChange = _ref.onShippingRateChange
|
|
37275
|
-
onSavedPaymentMethodRemove = _ref.onSavedPaymentMethodRemove,
|
|
37276
|
-
onSavedPaymentMethodUpdate = _ref.onSavedPaymentMethodUpdate;
|
|
36729
|
+
onShippingRateChange = _ref.onShippingRateChange;
|
|
37277
36730
|
var ctx = useElementsOrCheckoutSdkContextWithUseCase("mounts <".concat(displayName, ">"));
|
|
37278
36731
|
var elements = 'elements' in ctx ? ctx.elements : null;
|
|
37279
36732
|
var checkoutSdk = 'checkoutSdk' in ctx ? ctx.checkoutSdk : null;
|
|
@@ -37299,8 +36752,6 @@ function requireReactStripe_umd () {
|
|
|
37299
36752
|
useAttachEvent(element, 'cancel', onCancel);
|
|
37300
36753
|
useAttachEvent(element, 'shippingaddresschange', onShippingAddressChange);
|
|
37301
36754
|
useAttachEvent(element, 'shippingratechange', onShippingRateChange);
|
|
37302
|
-
useAttachEvent(element, 'savedpaymentmethodremove', onSavedPaymentMethodRemove);
|
|
37303
|
-
useAttachEvent(element, 'savedpaymentmethodupdate', onSavedPaymentMethodUpdate);
|
|
37304
36755
|
useAttachEvent(element, 'change', onChange);
|
|
37305
36756
|
var readyCallback;
|
|
37306
36757
|
|
|
@@ -37353,10 +36804,6 @@ function requireReactStripe_umd () {
|
|
|
37353
36804
|
newElement = checkoutSdk.createCurrencySelectorElement();
|
|
37354
36805
|
break;
|
|
37355
36806
|
|
|
37356
|
-
case 'taxId':
|
|
37357
|
-
newElement = checkoutSdk.createTaxIdElement(options);
|
|
37358
|
-
break;
|
|
37359
|
-
|
|
37360
36807
|
default:
|
|
37361
36808
|
throw new Error("Invalid Element type ".concat(displayName, ". You must use either the <PaymentElement />, <AddressElement options={{mode: 'shipping'}} />, <AddressElement options={{mode: 'billing'}} />, or <ExpressCheckoutElement />."));
|
|
37362
36809
|
}
|
|
@@ -37432,8 +36879,6 @@ function requireReactStripe_umd () {
|
|
|
37432
36879
|
onCancel: PropTypes.func,
|
|
37433
36880
|
onShippingAddressChange: PropTypes.func,
|
|
37434
36881
|
onShippingRateChange: PropTypes.func,
|
|
37435
|
-
onSavedPaymentMethodRemove: PropTypes.func,
|
|
37436
|
-
onSavedPaymentMethodUpdate: PropTypes.func,
|
|
37437
36882
|
options: PropTypes.object
|
|
37438
36883
|
};
|
|
37439
36884
|
Element.displayName = displayName;
|
|
@@ -37741,42 +37186,35 @@ function requireReactStripe_umd () {
|
|
|
37741
37186
|
*/
|
|
37742
37187
|
|
|
37743
37188
|
var AfterpayClearpayMessageElement = createElementComponent('afterpayClearpayMessage', isServer);
|
|
37744
|
-
/**
|
|
37745
|
-
* Requires beta access:
|
|
37746
|
-
* Contact [Stripe support](https://support.stripe.com/) for more information.
|
|
37747
|
-
*/
|
|
37748
37189
|
|
|
37749
|
-
|
|
37750
|
-
|
|
37751
|
-
exports
|
|
37752
|
-
exports
|
|
37753
|
-
exports
|
|
37754
|
-
exports
|
|
37755
|
-
exports
|
|
37756
|
-
exports
|
|
37757
|
-
exports
|
|
37758
|
-
exports
|
|
37759
|
-
exports
|
|
37760
|
-
exports
|
|
37761
|
-
exports
|
|
37762
|
-
exports
|
|
37763
|
-
exports
|
|
37764
|
-
exports
|
|
37765
|
-
exports
|
|
37766
|
-
exports
|
|
37767
|
-
exports
|
|
37768
|
-
exports
|
|
37769
|
-
exports
|
|
37770
|
-
exports
|
|
37771
|
-
exports
|
|
37772
|
-
exports
|
|
37773
|
-
exports
|
|
37774
|
-
exports
|
|
37775
|
-
exports
|
|
37776
|
-
exports
|
|
37777
|
-
exports$1.useCheckout = useCheckout;
|
|
37778
|
-
exports$1.useElements = useElements;
|
|
37779
|
-
exports$1.useStripe = useStripe;
|
|
37190
|
+
exports.AddressElement = AddressElement;
|
|
37191
|
+
exports.AffirmMessageElement = AffirmMessageElement;
|
|
37192
|
+
exports.AfterpayClearpayMessageElement = AfterpayClearpayMessageElement;
|
|
37193
|
+
exports.AuBankAccountElement = AuBankAccountElement;
|
|
37194
|
+
exports.CardCvcElement = CardCvcElement;
|
|
37195
|
+
exports.CardElement = CardElement;
|
|
37196
|
+
exports.CardExpiryElement = CardExpiryElement;
|
|
37197
|
+
exports.CardNumberElement = CardNumberElement;
|
|
37198
|
+
exports.CheckoutProvider = CheckoutProvider;
|
|
37199
|
+
exports.CurrencySelectorElement = CurrencySelectorElement;
|
|
37200
|
+
exports.Elements = Elements;
|
|
37201
|
+
exports.ElementsConsumer = ElementsConsumer;
|
|
37202
|
+
exports.EmbeddedCheckout = EmbeddedCheckout;
|
|
37203
|
+
exports.EmbeddedCheckoutProvider = EmbeddedCheckoutProvider;
|
|
37204
|
+
exports.EpsBankElement = EpsBankElement;
|
|
37205
|
+
exports.ExpressCheckoutElement = ExpressCheckoutElement;
|
|
37206
|
+
exports.FpxBankElement = FpxBankElement;
|
|
37207
|
+
exports.IbanElement = IbanElement;
|
|
37208
|
+
exports.IdealBankElement = IdealBankElement;
|
|
37209
|
+
exports.LinkAuthenticationElement = LinkAuthenticationElement;
|
|
37210
|
+
exports.P24BankElement = P24BankElement;
|
|
37211
|
+
exports.PaymentElement = PaymentElement;
|
|
37212
|
+
exports.PaymentMethodMessagingElement = PaymentMethodMessagingElement;
|
|
37213
|
+
exports.PaymentRequestButtonElement = PaymentRequestButtonElement;
|
|
37214
|
+
exports.ShippingAddressElement = ShippingAddressElement;
|
|
37215
|
+
exports.useCheckout = useCheckout;
|
|
37216
|
+
exports.useElements = useElements;
|
|
37217
|
+
exports.useStripe = useStripe;
|
|
37780
37218
|
|
|
37781
37219
|
}));
|
|
37782
37220
|
} (reactStripe_umd$1, reactStripe_umd$1.exports));
|
|
@@ -43005,6 +42443,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
|
|
|
43005
42443
|
pickupPointId: shipmentFormData.pickupPointId,
|
|
43006
42444
|
},
|
|
43007
42445
|
}));
|
|
42446
|
+
console.log("UPDATING CHECKOUT WITH SHIPMENTS: ", shipments);
|
|
43008
42447
|
yield storeClient.updateCheckout(clientSecret, checkoutId, {
|
|
43009
42448
|
shipments,
|
|
43010
42449
|
});
|