@betterstore/react 0.6.11 → 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.
Files changed (27) hide show
  1. package/dist/components/checkout-embed/checkout-form.d.ts.map +1 -1
  2. package/dist/components/checkout-embed/steps/customer/address-utils.d.ts.map +1 -1
  3. package/dist/components/checkout-embed/steps/payment/form.d.ts +2 -1
  4. package/dist/components/checkout-embed/steps/payment/form.d.ts.map +1 -1
  5. package/dist/components/checkout-embed/steps/payment/icons.d.ts +8 -0
  6. package/dist/components/checkout-embed/steps/payment/icons.d.ts.map +1 -0
  7. package/dist/components/checkout-embed/useFormStore.d.ts +3 -5
  8. package/dist/components/checkout-embed/useFormStore.d.ts.map +1 -1
  9. package/dist/components/compounds/form/country-input/dropdown.d.ts +26 -0
  10. package/dist/components/compounds/form/country-input/dropdown.d.ts.map +1 -0
  11. package/dist/components/compounds/form/select-group/index.d.ts +14 -0
  12. package/dist/components/compounds/form/select-group/index.d.ts.map +1 -0
  13. package/dist/components/compounds/form/select-group/select.d.ts +14 -0
  14. package/dist/components/compounds/form/select-group/select.d.ts.map +1 -0
  15. package/dist/components/payment-element/betterstore-checkout-embed-payment-element.d.ts +2 -0
  16. package/dist/components/payment-element/betterstore-checkout-embed-payment-element.d.ts.map +1 -0
  17. package/dist/components/payment-element/checkout-form.d.ts.map +1 -1
  18. package/dist/components/payment-element/useCheckout.d.ts +3 -0
  19. package/dist/components/payment-element/useCheckout.d.ts.map +1 -1
  20. package/dist/components/shadow-wrapper.d.ts +8 -0
  21. package/dist/components/shadow-wrapper.d.ts.map +1 -0
  22. package/dist/components/ui/form.d.ts.map +1 -1
  23. package/dist/index.cjs.js +678 -1212
  24. package/dist/index.mjs +683 -1217
  25. package/dist/lib/betterstore.d.ts +6 -0
  26. package/dist/lib/betterstore.d.ts.map +1 -0
  27. 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 = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
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
- React.useCallback(() => selector(api.getState()), [api, selector]),
55
- React.useCallback(() => selector(api.getInitialState()), [api, selector])
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 = ((createState) => createState ? createImpl(createState) : createImpl);
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
- return setItem();
157
+ void setItem();
158
158
  };
159
159
  const configResult = config(
160
160
  (...args) => {
161
161
  set(...args);
162
- return setItem();
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 && options.bindI18n.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;
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 && bindI18n) bindI18n?.split(' ').forEach(e => i18n.off(e, boundReset));
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]);
@@ -3326,7 +3326,12 @@ const CheckoutEmbed$2 = {
3326
3326
  loading: "Načítání ...",
3327
3327
  Payment: {
3328
3328
  back: "Zpět na výběr dopravy",
3329
- button: "Dokončit objednávku",
3329
+ button: {
3330
+ "default": "Dokončit objednávku",
3331
+ apple_pay: "Zaplatit s Apple Pay",
3332
+ paypal: "Zaplatit s PayPal",
3333
+ google_pay: "Zaplatit s Google Pay"
3334
+ },
3330
3335
  description: "Všechny transakce jsou zabezpečené a šifrované.",
3331
3336
  title: "Platba"
3332
3337
  },
@@ -3443,7 +3448,12 @@ const CheckoutEmbed$1 = {
3443
3448
  title: "Payment",
3444
3449
  description: "All transactions are secure and encrypted.",
3445
3450
  back: "Back to shipping",
3446
- button: "Buy now"
3451
+ button: {
3452
+ "default": "Buy now",
3453
+ apple_pay: "Pay with Apple Pay",
3454
+ paypal: "Pay with PayPal",
3455
+ google_pay: "Pay with Google Pay"
3456
+ }
3447
3457
  }
3448
3458
  };
3449
3459
  const Errors = {
@@ -3476,13 +3486,6 @@ const createI18nInstance = (locale) => __awaiter(void 0, void 0, void 0, functio
3476
3486
  return instance;
3477
3487
  });
3478
3488
 
3479
- /**
3480
- * Create a bound version of a function with a specified `this` context
3481
- *
3482
- * @param {Function} fn - The function to bind
3483
- * @param {*} thisArg - The value to be passed as the `this` parameter
3484
- * @returns {Function} A new function that will call the original function with the specified `this` context
3485
- */
3486
3489
  function bind(fn, thisArg) {
3487
3490
  return function wrap() {
3488
3491
  return fn.apply(thisArg, arguments);
@@ -3534,7 +3537,7 @@ const isUndefined$1 = typeOfTest('undefined');
3534
3537
  */
3535
3538
  function isBuffer(val) {
3536
3539
  return val !== null && !isUndefined$1(val) && val.constructor !== null && !isUndefined$1(val.constructor)
3537
- && isFunction$3(val.constructor.isBuffer) && val.constructor.isBuffer(val);
3540
+ && isFunction$2(val.constructor.isBuffer) && val.constructor.isBuffer(val);
3538
3541
  }
3539
3542
 
3540
3543
  /**
@@ -3579,7 +3582,7 @@ const isString$1 = typeOfTest('string');
3579
3582
  * @param {*} val The value to test
3580
3583
  * @returns {boolean} True if value is a Function, otherwise false
3581
3584
  */
3582
- const isFunction$3 = typeOfTest('function');
3585
+ const isFunction$2 = typeOfTest('function');
3583
3586
 
3584
3587
  /**
3585
3588
  * Determine if a value is a Number
@@ -3623,27 +3626,6 @@ const isPlainObject$1 = (val) => {
3623
3626
  return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
3624
3627
  };
3625
3628
 
3626
- /**
3627
- * Determine if a value is an empty object (safely handles Buffers)
3628
- *
3629
- * @param {*} val The value to test
3630
- *
3631
- * @returns {boolean} True if value is an empty object, otherwise false
3632
- */
3633
- const isEmptyObject$1 = (val) => {
3634
- // Early return for non-objects or Buffers to prevent RangeError
3635
- if (!isObject$1(val) || isBuffer(val)) {
3636
- return false;
3637
- }
3638
-
3639
- try {
3640
- return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
3641
- } catch (e) {
3642
- // Fallback for any other objects that might cause RangeError with Object.keys()
3643
- return false;
3644
- }
3645
- };
3646
-
3647
3629
  /**
3648
3630
  * Determine if a value is a Date
3649
3631
  *
@@ -3687,7 +3669,7 @@ const isFileList = kindOfTest('FileList');
3687
3669
  *
3688
3670
  * @returns {boolean} True if value is a Stream, otherwise false
3689
3671
  */
3690
- const isStream = (val) => isObject$1(val) && isFunction$3(val.pipe);
3672
+ const isStream = (val) => isObject$1(val) && isFunction$2(val.pipe);
3691
3673
 
3692
3674
  /**
3693
3675
  * Determine if a value is a FormData
@@ -3700,10 +3682,10 @@ const isFormData = (thing) => {
3700
3682
  let kind;
3701
3683
  return thing && (
3702
3684
  (typeof FormData === 'function' && thing instanceof FormData) || (
3703
- isFunction$3(thing.append) && (
3685
+ isFunction$2(thing.append) && (
3704
3686
  (kind = kindOf(thing)) === 'formdata' ||
3705
3687
  // detect form-data instance
3706
- (kind === 'object' && isFunction$3(thing.toString) && thing.toString() === '[object FormData]')
3688
+ (kind === 'object' && isFunction$2(thing.toString) && thing.toString() === '[object FormData]')
3707
3689
  )
3708
3690
  )
3709
3691
  )
@@ -3766,11 +3748,6 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
3766
3748
  fn.call(null, obj[i], i, obj);
3767
3749
  }
3768
3750
  } else {
3769
- // Buffer check
3770
- if (isBuffer(obj)) {
3771
- return;
3772
- }
3773
-
3774
3751
  // Iterate over object keys
3775
3752
  const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
3776
3753
  const len = keys.length;
@@ -3784,10 +3761,6 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
3784
3761
  }
3785
3762
 
3786
3763
  function findKey(obj, key) {
3787
- if (isBuffer(obj)){
3788
- return null;
3789
- }
3790
-
3791
3764
  key = key.toLowerCase();
3792
3765
  const keys = Object.keys(obj);
3793
3766
  let i = keys.length;
@@ -3828,7 +3801,7 @@ const isContextDefined = (context) => !isUndefined$1(context) && context !== _gl
3828
3801
  * @returns {Object} Result of all merge properties
3829
3802
  */
3830
3803
  function merge(/* obj1, obj2, obj3, ... */) {
3831
- const {caseless, skipUndefined} = isContextDefined(this) && this || {};
3804
+ const {caseless} = isContextDefined(this) && this || {};
3832
3805
  const result = {};
3833
3806
  const assignValue = (val, key) => {
3834
3807
  const targetKey = caseless && findKey(result, key) || key;
@@ -3838,7 +3811,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
3838
3811
  result[targetKey] = merge({}, val);
3839
3812
  } else if (isArray(val)) {
3840
3813
  result[targetKey] = val.slice();
3841
- } else if (!skipUndefined || !isUndefined$1(val)) {
3814
+ } else {
3842
3815
  result[targetKey] = val;
3843
3816
  }
3844
3817
  };
@@ -3861,7 +3834,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
3861
3834
  */
3862
3835
  const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
3863
3836
  forEach(b, (val, key) => {
3864
- if (thisArg && isFunction$3(val)) {
3837
+ if (thisArg && isFunction$2(val)) {
3865
3838
  a[key] = bind(val, thisArg);
3866
3839
  } else {
3867
3840
  a[key] = val;
@@ -4077,13 +4050,13 @@ const reduceDescriptors = (obj, reducer) => {
4077
4050
  const freezeMethods = (obj) => {
4078
4051
  reduceDescriptors(obj, (descriptor, name) => {
4079
4052
  // skip restricted props in strict mode
4080
- if (isFunction$3(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
4053
+ if (isFunction$2(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
4081
4054
  return false;
4082
4055
  }
4083
4056
 
4084
4057
  const value = obj[name];
4085
4058
 
4086
- if (!isFunction$3(value)) return;
4059
+ if (!isFunction$2(value)) return;
4087
4060
 
4088
4061
  descriptor.enumerable = false;
4089
4062
 
@@ -4120,8 +4093,6 @@ const toFiniteNumber = (value, defaultValue) => {
4120
4093
  return value != null && Number.isFinite(value = +value) ? value : defaultValue;
4121
4094
  };
4122
4095
 
4123
-
4124
-
4125
4096
  /**
4126
4097
  * If the thing is a FormData object, return true, otherwise return false.
4127
4098
  *
@@ -4130,7 +4101,7 @@ const toFiniteNumber = (value, defaultValue) => {
4130
4101
  * @returns {boolean}
4131
4102
  */
4132
4103
  function isSpecCompliantForm(thing) {
4133
- return !!(thing && isFunction$3(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
4104
+ return !!(thing && isFunction$2(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
4134
4105
  }
4135
4106
 
4136
4107
  const toJSONObject = (obj) => {
@@ -4143,11 +4114,6 @@ const toJSONObject = (obj) => {
4143
4114
  return;
4144
4115
  }
4145
4116
 
4146
- //Buffer check
4147
- if (isBuffer(source)) {
4148
- return source;
4149
- }
4150
-
4151
4117
  if(!('toJSON' in source)) {
4152
4118
  stack[i] = source;
4153
4119
  const target = isArray(source) ? [] : {};
@@ -4172,7 +4138,7 @@ const toJSONObject = (obj) => {
4172
4138
  const isAsyncFn = kindOfTest('AsyncFunction');
4173
4139
 
4174
4140
  const isThenable = (thing) =>
4175
- thing && (isObject$1(thing) || isFunction$3(thing)) && isFunction$3(thing.then) && isFunction$3(thing.catch);
4141
+ thing && (isObject$1(thing) || isFunction$2(thing)) && isFunction$2(thing.then) && isFunction$2(thing.catch);
4176
4142
 
4177
4143
  // original code
4178
4144
  // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
@@ -4196,7 +4162,7 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
4196
4162
  })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
4197
4163
  })(
4198
4164
  typeof setImmediate === 'function',
4199
- isFunction$3(_global.postMessage)
4165
+ isFunction$2(_global.postMessage)
4200
4166
  );
4201
4167
 
4202
4168
  const asap = typeof queueMicrotask !== 'undefined' ?
@@ -4205,7 +4171,7 @@ const asap = typeof queueMicrotask !== 'undefined' ?
4205
4171
  // *********************
4206
4172
 
4207
4173
 
4208
- const isIterable = (thing) => thing != null && isFunction$3(thing[iterator]);
4174
+ const isIterable = (thing) => thing != null && isFunction$2(thing[iterator]);
4209
4175
 
4210
4176
 
4211
4177
  var utils$1 = {
@@ -4219,7 +4185,6 @@ var utils$1 = {
4219
4185
  isBoolean: isBoolean$1,
4220
4186
  isObject: isObject$1,
4221
4187
  isPlainObject: isPlainObject$1,
4222
- isEmptyObject: isEmptyObject$1,
4223
4188
  isReadableStream,
4224
4189
  isRequest,
4225
4190
  isResponse,
@@ -4229,7 +4194,7 @@ var utils$1 = {
4229
4194
  isFile,
4230
4195
  isBlob,
4231
4196
  isRegExp,
4232
- isFunction: isFunction$3,
4197
+ isFunction: isFunction$2,
4233
4198
  isStream,
4234
4199
  isURLSearchParams,
4235
4200
  isTypedArray,
@@ -4355,18 +4320,11 @@ AxiosError$1.from = (error, code, config, request, response, customProps) => {
4355
4320
  return prop !== 'isAxiosError';
4356
4321
  });
4357
4322
 
4358
- const msg = error && error.message ? error.message : 'Error';
4323
+ AxiosError$1.call(axiosError, error.message, code, config, request, response);
4359
4324
 
4360
- // Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
4361
- const errCode = code == null && error ? error.code : code;
4362
- AxiosError$1.call(axiosError, msg, errCode, config, request, response);
4325
+ axiosError.cause = error;
4363
4326
 
4364
- // Chain the original error on the standard field; non-enumerable to avoid JSON noise
4365
- if (error && axiosError.cause == null) {
4366
- Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
4367
- }
4368
-
4369
- axiosError.name = (error && error.name) || 'Error';
4327
+ axiosError.name = error.name;
4370
4328
 
4371
4329
  customProps && Object.assign(axiosError, customProps);
4372
4330
 
@@ -4657,7 +4615,9 @@ function encode(val) {
4657
4615
  replace(/%3A/gi, ':').
4658
4616
  replace(/%24/g, '$').
4659
4617
  replace(/%2C/gi, ',').
4660
- replace(/%20/g, '+');
4618
+ replace(/%20/g, '+').
4619
+ replace(/%5B/gi, '[').
4620
+ replace(/%5D/gi, ']');
4661
4621
  }
4662
4622
 
4663
4623
  /**
@@ -4735,7 +4695,7 @@ class InterceptorManager {
4735
4695
  *
4736
4696
  * @param {Number} id The ID that was returned by `use`
4737
4697
  *
4738
- * @returns {void}
4698
+ * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
4739
4699
  */
4740
4700
  eject(id) {
4741
4701
  if (this.handlers[id]) {
@@ -4854,7 +4814,7 @@ var platform$1 = {
4854
4814
  };
4855
4815
 
4856
4816
  function toURLEncodedForm(data, options) {
4857
- return toFormData$1(data, new platform$1.classes.URLSearchParams(), {
4817
+ return toFormData$1(data, new platform$1.classes.URLSearchParams(), Object.assign({
4858
4818
  visitor: function(value, key, path, helpers) {
4859
4819
  if (platform$1.isNode && utils$1.isBuffer(value)) {
4860
4820
  this.append(key, value.toString('base64'));
@@ -4862,9 +4822,8 @@ function toURLEncodedForm(data, options) {
4862
4822
  }
4863
4823
 
4864
4824
  return helpers.defaultVisitor.apply(this, arguments);
4865
- },
4866
- ...options
4867
- });
4825
+ }
4826
+ }, options));
4868
4827
  }
4869
4828
 
4870
4829
  /**
@@ -5060,7 +5019,7 @@ const defaults = {
5060
5019
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
5061
5020
 
5062
5021
  try {
5063
- return JSON.parse(data, this.parseReviver);
5022
+ return JSON.parse(data);
5064
5023
  } catch (e) {
5065
5024
  if (strictJSONParsing) {
5066
5025
  if (e.name === 'SyntaxError') {
@@ -5613,7 +5572,7 @@ function throttle(fn, freq) {
5613
5572
  clearTimeout(timer);
5614
5573
  timer = null;
5615
5574
  }
5616
- fn(...args);
5575
+ fn.apply(null, args);
5617
5576
  };
5618
5577
 
5619
5578
  const throttled = (...args) => {
@@ -5695,38 +5654,27 @@ var cookies = platform$1.hasStandardBrowserEnv ?
5695
5654
 
5696
5655
  // Standard browser envs support document.cookie
5697
5656
  {
5698
- write(name, value, expires, path, domain, secure, sameSite) {
5699
- if (typeof document === 'undefined') return;
5657
+ write(name, value, expires, path, domain, secure) {
5658
+ const cookie = [name + '=' + encodeURIComponent(value)];
5700
5659
 
5701
- const cookie = [`${name}=${encodeURIComponent(value)}`];
5660
+ utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
5702
5661
 
5703
- if (utils$1.isNumber(expires)) {
5704
- cookie.push(`expires=${new Date(expires).toUTCString()}`);
5705
- }
5706
- if (utils$1.isString(path)) {
5707
- cookie.push(`path=${path}`);
5708
- }
5709
- if (utils$1.isString(domain)) {
5710
- cookie.push(`domain=${domain}`);
5711
- }
5712
- if (secure === true) {
5713
- cookie.push('secure');
5714
- }
5715
- if (utils$1.isString(sameSite)) {
5716
- cookie.push(`SameSite=${sameSite}`);
5717
- }
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');
5718
5667
 
5719
5668
  document.cookie = cookie.join('; ');
5720
5669
  },
5721
5670
 
5722
5671
  read(name) {
5723
- if (typeof document === 'undefined') return null;
5724
- const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
5725
- return match ? decodeURIComponent(match[1]) : null;
5672
+ const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
5673
+ return (match ? decodeURIComponent(match[3]) : null);
5726
5674
  },
5727
5675
 
5728
5676
  remove(name) {
5729
- this.write(name, '', Date.now() - 86400000, '/');
5677
+ this.write(name, '', Date.now() - 86400000);
5730
5678
  }
5731
5679
  }
5732
5680
 
@@ -5815,11 +5763,11 @@ function mergeConfig$1(config1, config2) {
5815
5763
  }
5816
5764
 
5817
5765
  // eslint-disable-next-line consistent-return
5818
- function mergeDeepProperties(a, b, prop, caseless) {
5766
+ function mergeDeepProperties(a, b, prop , caseless) {
5819
5767
  if (!utils$1.isUndefined(b)) {
5820
- return getMergedValue(a, b, prop, caseless);
5768
+ return getMergedValue(a, b, prop , caseless);
5821
5769
  } else if (!utils$1.isUndefined(a)) {
5822
- return getMergedValue(undefined, a, prop, caseless);
5770
+ return getMergedValue(undefined, a, prop , caseless);
5823
5771
  }
5824
5772
  }
5825
5773
 
@@ -5877,10 +5825,10 @@ function mergeConfig$1(config1, config2) {
5877
5825
  socketPath: defaultToConfig2,
5878
5826
  responseEncoding: defaultToConfig2,
5879
5827
  validateStatus: mergeDirectKeys,
5880
- headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
5828
+ headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
5881
5829
  };
5882
5830
 
5883
- utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
5831
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
5884
5832
  const merge = mergeMap[prop] || mergeDeepProperties;
5885
5833
  const configValue = merge(config1[prop], config2[prop], prop);
5886
5834
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
@@ -5892,7 +5840,7 @@ function mergeConfig$1(config1, config2) {
5892
5840
  var resolveConfig = (config) => {
5893
5841
  const newConfig = mergeConfig$1({}, config);
5894
5842
 
5895
- let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
5843
+ let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
5896
5844
 
5897
5845
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
5898
5846
 
@@ -5905,21 +5853,17 @@ var resolveConfig = (config) => {
5905
5853
  );
5906
5854
  }
5907
5855
 
5856
+ let contentType;
5857
+
5908
5858
  if (utils$1.isFormData(data)) {
5909
5859
  if (platform$1.hasStandardBrowserEnv || platform$1.hasStandardBrowserWebWorkerEnv) {
5910
- headers.setContentType(undefined); // browser handles it
5911
- } else if (utils$1.isFunction(data.getHeaders)) {
5912
- // Node.js FormData (like form-data package)
5913
- const formHeaders = data.getHeaders();
5914
- // Only set safe headers to avoid overwriting security headers
5915
- const allowedHeaders = ['content-type', 'content-length'];
5916
- Object.entries(formHeaders).forEach(([key, val]) => {
5917
- if (allowedHeaders.includes(key.toLowerCase())) {
5918
- headers.set(key, val);
5919
- }
5920
- });
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('; '));
5921
5865
  }
5922
- }
5866
+ }
5923
5867
 
5924
5868
  // Add xsrf header
5925
5869
  // This is only done if running in a standard browser environment.
@@ -6036,18 +5980,15 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
6036
5980
  };
6037
5981
 
6038
5982
  // Handle low level network errors
6039
- request.onerror = function handleError(event) {
6040
- // Browsers deliver a ProgressEvent in XHR onerror
6041
- // (message may be empty; when present, surface it)
6042
- // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
6043
- const msg = event && event.message ? event.message : 'Network Error';
6044
- const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
6045
- // attach the underlying event for consumers who want details
6046
- err.event = event || null;
6047
- reject(err);
6048
- 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;
6049
5990
  };
6050
-
5991
+
6051
5992
  // Handle timeout
6052
5993
  request.ontimeout = function handleTimeout() {
6053
5994
  let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
@@ -6261,18 +6202,14 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
6261
6202
  })
6262
6203
  };
6263
6204
 
6264
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
6265
-
6266
- const {isFunction: isFunction$2} = utils$1;
6267
-
6268
- const globalFetchAPI = (({Request, Response}) => ({
6269
- Request, Response
6270
- }))(utils$1.global);
6271
-
6272
- const {
6273
- ReadableStream: ReadableStream$1, TextEncoder
6274
- } = utils$1.global;
6205
+ const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
6206
+ const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
6275
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
+ );
6276
6213
 
6277
6214
  const test = (fn, ...args) => {
6278
6215
  try {
@@ -6282,380 +6219,278 @@ const test = (fn, ...args) => {
6282
6219
  }
6283
6220
  };
6284
6221
 
6285
- const factory = (env) => {
6286
- env = utils$1.merge.call({
6287
- skipUndefined: true
6288
- }, globalFetchAPI, env);
6289
-
6290
- const {fetch: envFetch, Request, Response} = env;
6291
- const isFetchSupported = envFetch ? isFunction$2(envFetch) : typeof fetch === 'function';
6292
- const isRequestSupported = isFunction$2(Request);
6293
- const isResponseSupported = isFunction$2(Response);
6294
-
6295
- if (!isFetchSupported) {
6296
- return false;
6297
- }
6298
-
6299
- const isReadableStreamSupported = isFetchSupported && isFunction$2(ReadableStream$1);
6300
-
6301
- const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
6302
- ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
6303
- async (str) => new Uint8Array(await new Request(str).arrayBuffer())
6304
- );
6305
-
6306
- const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
6307
- let duplexAccessed = false;
6222
+ const supportsRequestStream = isReadableStreamSupported && test(() => {
6223
+ let duplexAccessed = false;
6308
6224
 
6309
- const hasContentType = new Request(platform$1.origin, {
6310
- body: new ReadableStream$1(),
6311
- method: 'POST',
6312
- get duplex() {
6313
- duplexAccessed = true;
6314
- return 'half';
6315
- },
6316
- }).headers.has('Content-Type');
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');
6317
6233
 
6318
- return duplexAccessed && !hasContentType;
6319
- });
6234
+ return duplexAccessed && !hasContentType;
6235
+ });
6320
6236
 
6321
- const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
6322
- test(() => utils$1.isReadableStream(new Response('').body));
6237
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
6323
6238
 
6324
- const resolvers = {
6325
- stream: supportsResponseStream && ((res) => res.body)
6326
- };
6239
+ const supportsResponseStream = isReadableStreamSupported &&
6240
+ test(() => utils$1.isReadableStream(new Response('').body));
6327
6241
 
6328
- isFetchSupported && ((() => {
6329
- ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
6330
- !resolvers[type] && (resolvers[type] = (res, config) => {
6331
- let method = res && res[type];
6332
6242
 
6333
- if (method) {
6334
- return method.call(res);
6335
- }
6243
+ const resolvers = {
6244
+ stream: supportsResponseStream && ((res) => res.body)
6245
+ };
6336
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) => {
6337
6251
  throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
6338
6252
  });
6339
- });
6340
- })());
6341
-
6342
- const getBodyLength = async (body) => {
6343
- if (body == null) {
6344
- return 0;
6345
- }
6346
-
6347
- if (utils$1.isBlob(body)) {
6348
- return body.size;
6349
- }
6350
-
6351
- if (utils$1.isSpecCompliantForm(body)) {
6352
- const _request = new Request(platform$1.origin, {
6353
- method: 'POST',
6354
- body,
6355
- });
6356
- return (await _request.arrayBuffer()).byteLength;
6357
- }
6358
-
6359
- if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
6360
- return body.byteLength;
6361
- }
6362
-
6363
- if (utils$1.isURLSearchParams(body)) {
6364
- body = body + '';
6365
- }
6366
-
6367
- if (utils$1.isString(body)) {
6368
- return (await encodeText(body)).byteLength;
6369
- }
6370
- };
6371
-
6372
- const resolveBodyLength = async (headers, body) => {
6373
- const length = utils$1.toFiniteNumber(headers.getContentLength());
6374
-
6375
- return length == null ? getBodyLength(body) : length;
6376
- };
6377
-
6378
- return async (config) => {
6379
- let {
6380
- url,
6381
- method,
6382
- data,
6383
- signal,
6384
- cancelToken,
6385
- timeout,
6386
- onDownloadProgress,
6387
- onUploadProgress,
6388
- responseType,
6389
- headers,
6390
- withCredentials = 'same-origin',
6391
- fetchOptions
6392
- } = resolveConfig(config);
6393
-
6394
- let _fetch = envFetch || fetch;
6395
-
6396
- responseType = responseType ? (responseType + '').toLowerCase() : 'text';
6253
+ });
6254
+ })(new Response));
6397
6255
 
6398
- let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
6256
+ const getBodyLength = async (body) => {
6257
+ if (body == null) {
6258
+ return 0;
6259
+ }
6399
6260
 
6400
- let request = null;
6261
+ if(utils$1.isBlob(body)) {
6262
+ return body.size;
6263
+ }
6401
6264
 
6402
- const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
6403
- composedSignal.unsubscribe();
6265
+ if(utils$1.isSpecCompliantForm(body)) {
6266
+ const _request = new Request(platform$1.origin, {
6267
+ method: 'POST',
6268
+ body,
6404
6269
  });
6270
+ return (await _request.arrayBuffer()).byteLength;
6271
+ }
6405
6272
 
6406
- let requestContentLength;
6407
-
6408
- try {
6409
- if (
6410
- onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
6411
- (requestContentLength = await resolveBodyLength(headers, data)) !== 0
6412
- ) {
6413
- let _request = new Request(url, {
6414
- method: 'POST',
6415
- body: data,
6416
- duplex: "half"
6417
- });
6273
+ if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
6274
+ return body.byteLength;
6275
+ }
6418
6276
 
6419
- let contentTypeHeader;
6277
+ if(utils$1.isURLSearchParams(body)) {
6278
+ body = body + '';
6279
+ }
6420
6280
 
6421
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
6422
- headers.setContentType(contentTypeHeader);
6423
- }
6281
+ if(utils$1.isString(body)) {
6282
+ return (await encodeText(body)).byteLength;
6283
+ }
6284
+ };
6424
6285
 
6425
- if (_request.body) {
6426
- const [onProgress, flush] = progressEventDecorator(
6427
- requestContentLength,
6428
- progressEventReducer(asyncDecorator(onUploadProgress))
6429
- );
6286
+ const resolveBodyLength = async (headers, body) => {
6287
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
6430
6288
 
6431
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
6432
- }
6433
- }
6289
+ return length == null ? getBodyLength(body) : length;
6290
+ };
6434
6291
 
6435
- if (!utils$1.isString(withCredentials)) {
6436
- withCredentials = withCredentials ? 'include' : 'omit';
6437
- }
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
+ });
6438
6317
 
6439
- // Cloudflare Workers throws when credentials are defined
6440
- // see https://github.com/cloudflare/workerd/issues/902
6441
- const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
6318
+ let requestContentLength;
6442
6319
 
6443
- const resolvedOptions = {
6444
- ...fetchOptions,
6445
- signal: composedSignal,
6446
- method: method.toUpperCase(),
6447
- headers: headers.normalize().toJSON(),
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',
6448
6327
  body: data,
6449
- duplex: "half",
6450
- credentials: isCredentialsSupported ? withCredentials : undefined
6451
- };
6452
-
6453
- request = isRequestSupported && new Request(url, resolvedOptions);
6328
+ duplex: "half"
6329
+ });
6454
6330
 
6455
- let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
6331
+ let contentTypeHeader;
6456
6332
 
6457
- const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
6333
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
6334
+ headers.setContentType(contentTypeHeader);
6335
+ }
6458
6336
 
6459
- if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
6460
- const options = {};
6337
+ if (_request.body) {
6338
+ const [onProgress, flush] = progressEventDecorator(
6339
+ requestContentLength,
6340
+ progressEventReducer(asyncDecorator(onUploadProgress))
6341
+ );
6461
6342
 
6462
- ['status', 'statusText', 'headers'].forEach(prop => {
6463
- options[prop] = response[prop];
6464
- });
6343
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
6344
+ }
6345
+ }
6465
6346
 
6466
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
6347
+ if (!utils$1.isString(withCredentials)) {
6348
+ withCredentials = withCredentials ? 'include' : 'omit';
6349
+ }
6467
6350
 
6468
- const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
6469
- responseContentLength,
6470
- progressEventReducer(asyncDecorator(onDownloadProgress), true)
6471
- ) || [];
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
+ });
6472
6363
 
6473
- response = new Response(
6474
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
6475
- flush && flush();
6476
- unsubscribe && unsubscribe();
6477
- }),
6478
- options
6479
- );
6480
- }
6364
+ let response = await fetch(request, fetchOptions);
6481
6365
 
6482
- responseType = responseType || 'text';
6366
+ const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
6483
6367
 
6484
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
6368
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
6369
+ const options = {};
6485
6370
 
6486
- !isStreamResponse && unsubscribe && unsubscribe();
6371
+ ['status', 'statusText', 'headers'].forEach(prop => {
6372
+ options[prop] = response[prop];
6373
+ });
6487
6374
 
6488
- return await new Promise((resolve, reject) => {
6489
- settle(resolve, reject, {
6490
- data: responseData,
6491
- headers: AxiosHeaders$1.from(response.headers),
6492
- status: response.status,
6493
- statusText: response.statusText,
6494
- config,
6495
- request
6496
- });
6497
- })
6498
- } catch (err) {
6499
- unsubscribe && unsubscribe();
6375
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
6500
6376
 
6501
- if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
6502
- throw Object.assign(
6503
- new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
6504
- {
6505
- cause: err.cause || err
6506
- }
6507
- )
6508
- }
6377
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
6378
+ responseContentLength,
6379
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
6380
+ ) || [];
6509
6381
 
6510
- throw AxiosError$1.from(err, err && err.code, config, request);
6382
+ response = new Response(
6383
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
6384
+ flush && flush();
6385
+ unsubscribe && unsubscribe();
6386
+ }),
6387
+ options
6388
+ );
6511
6389
  }
6512
- }
6513
- };
6514
6390
 
6515
- const seedCache = new Map();
6391
+ responseType = responseType || 'text';
6516
6392
 
6517
- const getFetch = (config) => {
6518
- let env = (config && config.env) || {};
6519
- const {fetch, Request, Response} = env;
6520
- const seeds = [
6521
- Request, Response, fetch
6522
- ];
6393
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
6523
6394
 
6524
- let len = seeds.length, i = len,
6525
- seed, target, map = seedCache;
6395
+ !isStreamResponse && unsubscribe && unsubscribe();
6526
6396
 
6527
- while (i--) {
6528
- seed = seeds[i];
6529
- target = map.get(seed);
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();
6530
6409
 
6531
- target === undefined && map.set(seed, target = (i ? new Map() : factory(env)));
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
+ }
6532
6418
 
6533
- map = target;
6419
+ throw AxiosError$1.from(err, err && err.code, config, request);
6534
6420
  }
6421
+ });
6535
6422
 
6536
- return target;
6537
- };
6538
-
6539
- getFetch();
6540
-
6541
- /**
6542
- * Known adapters mapping.
6543
- * Provides environment-specific adapters for Axios:
6544
- * - `http` for Node.js
6545
- * - `xhr` for browsers
6546
- * - `fetch` for fetch API-based requests
6547
- *
6548
- * @type {Object<string, Function|Object>}
6549
- */
6550
6423
  const knownAdapters = {
6551
6424
  http: httpAdapter,
6552
6425
  xhr: xhrAdapter,
6553
- fetch: {
6554
- get: getFetch,
6555
- }
6426
+ fetch: fetchAdapter
6556
6427
  };
6557
6428
 
6558
- // Assign adapter names for easier debugging and identification
6559
6429
  utils$1.forEach(knownAdapters, (fn, value) => {
6560
6430
  if (fn) {
6561
6431
  try {
6562
- Object.defineProperty(fn, 'name', { value });
6432
+ Object.defineProperty(fn, 'name', {value});
6563
6433
  } catch (e) {
6564
6434
  // eslint-disable-next-line no-empty
6565
6435
  }
6566
- Object.defineProperty(fn, 'adapterName', { value });
6436
+ Object.defineProperty(fn, 'adapterName', {value});
6567
6437
  }
6568
6438
  });
6569
6439
 
6570
- /**
6571
- * Render a rejection reason string for unknown or unsupported adapters
6572
- *
6573
- * @param {string} reason
6574
- * @returns {string}
6575
- */
6576
6440
  const renderReason = (reason) => `- ${reason}`;
6577
6441
 
6578
- /**
6579
- * Check if the adapter is resolved (function, null, or false)
6580
- *
6581
- * @param {Function|null|false} adapter
6582
- * @returns {boolean}
6583
- */
6584
6442
  const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
6585
6443
 
6586
- /**
6587
- * Get the first suitable adapter from the provided list.
6588
- * Tries each adapter in order until a supported one is found.
6589
- * Throws an AxiosError if no adapter is suitable.
6590
- *
6591
- * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
6592
- * @param {Object} config - Axios request configuration
6593
- * @throws {AxiosError} If no suitable adapter is available
6594
- * @returns {Function} The resolved adapter function
6595
- */
6596
- function getAdapter$1(adapters, config) {
6597
- adapters = utils$1.isArray(adapters) ? adapters : [adapters];
6444
+ var adapters = {
6445
+ getAdapter: (adapters) => {
6446
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
6598
6447
 
6599
- const { length } = adapters;
6600
- let nameOrAdapter;
6601
- let adapter;
6448
+ const {length} = adapters;
6449
+ let nameOrAdapter;
6450
+ let adapter;
6602
6451
 
6603
- const rejectedReasons = {};
6452
+ const rejectedReasons = {};
6604
6453
 
6605
- for (let i = 0; i < length; i++) {
6606
- nameOrAdapter = adapters[i];
6607
- let id;
6454
+ for (let i = 0; i < length; i++) {
6455
+ nameOrAdapter = adapters[i];
6456
+ let id;
6608
6457
 
6609
- adapter = nameOrAdapter;
6458
+ adapter = nameOrAdapter;
6610
6459
 
6611
- if (!isResolvedHandle(nameOrAdapter)) {
6612
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
6460
+ if (!isResolvedHandle(nameOrAdapter)) {
6461
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
6613
6462
 
6614
- if (adapter === undefined) {
6615
- throw new AxiosError$1(`Unknown adapter '${id}'`);
6463
+ if (adapter === undefined) {
6464
+ throw new AxiosError$1(`Unknown adapter '${id}'`);
6465
+ }
6616
6466
  }
6617
- }
6618
-
6619
- if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
6620
- break;
6621
- }
6622
6467
 
6623
- rejectedReasons[id || '#' + i] = adapter;
6624
- }
6468
+ if (adapter) {
6469
+ break;
6470
+ }
6625
6471
 
6626
- if (!adapter) {
6627
- const reasons = Object.entries(rejectedReasons)
6628
- .map(([id, state]) => `adapter ${id} ` +
6629
- (state === false ? 'is not supported by the environment' : 'is not available in the build')
6630
- );
6472
+ rejectedReasons[id || '#' + i] = adapter;
6473
+ }
6631
6474
 
6632
- let s = length ?
6633
- (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
6634
- 'as no adapter specified';
6475
+ if (!adapter) {
6635
6476
 
6636
- throw new AxiosError$1(
6637
- `There is no suitable adapter to dispatch the request ` + s,
6638
- 'ERR_NOT_SUPPORT'
6639
- );
6640
- }
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
+ );
6641
6481
 
6642
- return adapter;
6643
- }
6482
+ let s = length ?
6483
+ (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
6484
+ 'as no adapter specified';
6644
6485
 
6645
- /**
6646
- * Exports Axios adapters and utility to resolve an adapter
6647
- */
6648
- var adapters = {
6649
- /**
6650
- * Resolve an adapter from a list of adapter names or functions.
6651
- * @type {Function}
6652
- */
6653
- 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
+ }
6654
6491
 
6655
- /**
6656
- * Exposes all known adapters
6657
- * @type {Object<string, Function|Object>}
6658
- */
6492
+ return adapter;
6493
+ },
6659
6494
  adapters: knownAdapters
6660
6495
  };
6661
6496
 
@@ -6698,7 +6533,7 @@ function dispatchRequest(config) {
6698
6533
  config.headers.setContentType('application/x-www-form-urlencoded', false);
6699
6534
  }
6700
6535
 
6701
- const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
6536
+ const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
6702
6537
 
6703
6538
  return adapter(config).then(function onAdapterResolution(response) {
6704
6539
  throwIfCancellationRequested(config);
@@ -6732,7 +6567,7 @@ function dispatchRequest(config) {
6732
6567
  });
6733
6568
  }
6734
6569
 
6735
- const VERSION$1 = "1.13.2";
6570
+ const VERSION$1 = "1.10.0";
6736
6571
 
6737
6572
  const validators$1 = {};
6738
6573
 
@@ -6971,8 +6806,8 @@ let Axios$1 = class Axios {
6971
6806
 
6972
6807
  if (!synchronousRequestInterceptors) {
6973
6808
  const chain = [dispatchRequest.bind(this), undefined];
6974
- chain.unshift(...requestInterceptorChain);
6975
- chain.push(...responseInterceptorChain);
6809
+ chain.unshift.apply(chain, requestInterceptorChain);
6810
+ chain.push.apply(chain, responseInterceptorChain);
6976
6811
  len = chain.length;
6977
6812
 
6978
6813
  promise = Promise.resolve(config);
@@ -6988,6 +6823,8 @@ let Axios$1 = class Axios {
6988
6823
 
6989
6824
  let newConfig = config;
6990
6825
 
6826
+ i = 0;
6827
+
6991
6828
  while (i < len) {
6992
6829
  const onFulfilled = requestInterceptorChain[i++];
6993
6830
  const onRejected = requestInterceptorChain[i++];
@@ -7287,12 +7124,6 @@ const HttpStatusCode$1 = {
7287
7124
  LoopDetected: 508,
7288
7125
  NotExtended: 510,
7289
7126
  NetworkAuthenticationRequired: 511,
7290
- WebServerIsDown: 521,
7291
- ConnectionTimedOut: 522,
7292
- OriginIsUnreachable: 523,
7293
- TimeoutOccurred: 524,
7294
- SslHandshakeFailed: 525,
7295
- InvalidSslCertificate: 526,
7296
7127
  };
7297
7128
 
7298
7129
  Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
@@ -7632,9 +7463,8 @@ class ZodError extends Error {
7632
7463
  const formErrors = [];
7633
7464
  for (const sub of this.issues) {
7634
7465
  if (sub.path.length > 0) {
7635
- const firstEl = sub.path[0];
7636
- fieldErrors[firstEl] = fieldErrors[firstEl] || [];
7637
- fieldErrors[firstEl].push(mapper(sub));
7466
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
7467
+ fieldErrors[sub.path[0]].push(mapper(sub));
7638
7468
  }
7639
7469
  else {
7640
7470
  formErrors.push(mapper(sub));
@@ -7718,8 +7548,6 @@ const errorMap = (issue, _ctx) => {
7718
7548
  message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
7719
7549
  else if (issue.type === "number")
7720
7550
  message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
7721
- else if (issue.type === "bigint")
7722
- message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
7723
7551
  else if (issue.type === "date")
7724
7552
  message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
7725
7553
  else
@@ -8317,8 +8145,6 @@ function isValidJWT(jwt, alg) {
8317
8145
  return false;
8318
8146
  try {
8319
8147
  const [header] = jwt.split(".");
8320
- if (!header)
8321
- return false;
8322
8148
  // Convert base64url to base64
8323
8149
  const base64 = header
8324
8150
  .replace(/-/g, "+")
@@ -12283,41 +12109,29 @@ var createApiClient = (apiKey, proxy) => {
12283
12109
  baseURL: proxy ?? API_BASE_URL,
12284
12110
  headers: {
12285
12111
  "Content-Type": "application/json",
12286
- Authorization: `Bearer ${apiKey}`,
12287
- "Access-Control-Allow-Origin": "*",
12288
- "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
12289
- "Access-Control-Allow-Headers": "Content-Type, Authorization"
12112
+ Authorization: `Bearer ${apiKey}`
12290
12113
  }
12291
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
+ }
12292
12124
  client.interceptors.response.use(
12293
12125
  (response) => response.data,
12294
12126
  (error) => {
12295
12127
  const apiError = {
12296
12128
  isError: true,
12297
- status: 500,
12298
- message: "An unexpected error occurred"
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
12299
12133
  };
12300
- if (error.response) {
12301
- apiError.status = error.response.status;
12302
- apiError.message = error.response.data?.error || "Server error occurred";
12303
- apiError.code = error.response.data?.code;
12304
- apiError.details = error.response.data;
12305
- } else if (error.request) {
12306
- apiError.status = 503;
12307
- apiError.message = "Service unavailable - no response from server";
12308
- apiError.code = "SERVICE_UNAVAILABLE";
12309
- apiError.details = error;
12310
- } else {
12311
- apiError.status = 500;
12312
- apiError.message = "Request configuration error";
12313
- apiError.code = "REQUEST_SETUP_ERROR";
12314
- apiError.details = error;
12315
- }
12316
- console.error("API ERROR: ", apiError);
12317
- if (apiError.code === "REQUEST_SETUP_ERROR" || apiError.code === "SERVICE_UNAVAILABLE") {
12318
- throw apiError;
12319
- }
12320
- return apiError;
12134
+ throw apiError;
12321
12135
  }
12322
12136
  );
12323
12137
  return client;
@@ -12348,9 +12162,9 @@ var Client = class {
12348
12162
  */
12349
12163
  async updateCheckout(clientSecret, checkoutId, params) {
12350
12164
  const apiClient = createApiClient(clientSecret, this.proxy);
12351
- const data = await apiClient.put(
12352
- `/checkout/${checkoutId}`,
12353
- params
12165
+ const data = await apiClient.post(
12166
+ `/checkout/${checkoutId}/update`,
12167
+ { ...params }
12354
12168
  );
12355
12169
  if ("isError" in data && data.isError || !data || !("id" in data)) {
12356
12170
  console.error(`Checkout session with id ${checkoutId} not found`);
@@ -13173,7 +12987,6 @@ const Toast = (props)=>{
13173
12987
  "data-swipe-out": swipeOut,
13174
12988
  "data-swipe-direction": swipeOutDirection,
13175
12989
  "data-expanded": Boolean(expanded || expandByDefault && mounted),
13176
- "data-testid": toast.testId,
13177
12990
  style: {
13178
12991
  '--index': index,
13179
12992
  '--toasts-before': index,
@@ -13189,7 +13002,6 @@ const Toast = (props)=>{
13189
13002
  pointerStartRef.current = null;
13190
13003
  },
13191
13004
  onPointerDown: (event)=>{
13192
- if (event.button === 2) return; // Return early on right click
13193
13005
  if (disabled || !dismissible) return;
13194
13006
  dragStartTime.current = new Date();
13195
13007
  setOffsetBeforeRemove(offset.current);
@@ -13382,26 +13194,17 @@ function assignOffset(defaultOffset, mobileOffset) {
13382
13194
  return styles;
13383
13195
  }
13384
13196
  const Toaster$1 = /*#__PURE__*/ React.forwardRef(function Toaster(props, ref) {
13385
- const { id, invert, position = 'bottom-right', hotkey = [
13197
+ const { invert, position = 'bottom-right', hotkey = [
13386
13198
  'altKey',
13387
13199
  'KeyT'
13388
13200
  ], expand, closeButton, className, offset, mobileOffset, theme = 'light', richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = 'Notifications' } = props;
13389
13201
  const [toasts, setToasts] = React.useState([]);
13390
- const filteredToasts = React.useMemo(()=>{
13391
- if (id) {
13392
- return toasts.filter((toast)=>toast.toasterId === id);
13393
- }
13394
- return toasts.filter((toast)=>!toast.toasterId);
13395
- }, [
13396
- toasts,
13397
- id
13398
- ]);
13399
13202
  const possiblePositions = React.useMemo(()=>{
13400
13203
  return Array.from(new Set([
13401
13204
  position
13402
- ].concat(filteredToasts.filter((toast)=>toast.position).map((toast)=>toast.position))));
13205
+ ].concat(toasts.filter((toast)=>toast.position).map((toast)=>toast.position))));
13403
13206
  }, [
13404
- filteredToasts,
13207
+ toasts,
13405
13208
  position
13406
13209
  ]);
13407
13210
  const [heights, setHeights] = React.useState([]);
@@ -13556,7 +13359,7 @@ const Toaster$1 = /*#__PURE__*/ React.forwardRef(function Toaster(props, ref) {
13556
13359
  }, possiblePositions.map((position, index)=>{
13557
13360
  var _heights_;
13558
13361
  const [y, x] = position.split('-');
13559
- if (!filteredToasts.length) return null;
13362
+ if (!toasts.length) return null;
13560
13363
  return /*#__PURE__*/ React.createElement("ol", {
13561
13364
  key: position,
13562
13365
  dir: dir === 'auto' ? getDocumentDirection() : dir,
@@ -13608,7 +13411,7 @@ const Toaster$1 = /*#__PURE__*/ React.forwardRef(function Toaster(props, ref) {
13608
13411
  setInteracting(true);
13609
13412
  },
13610
13413
  onPointerUp: ()=>setInteracting(false)
13611
- }, filteredToasts.filter((toast)=>!toast.position && index === 0 || toast.position === position).map((toast, index)=>{
13414
+ }, toasts.filter((toast)=>!toast.position && index === 0 || toast.position === position).map((toast, index)=>{
13612
13415
  var _toastOptions_duration, _toastOptions_closeButton;
13613
13416
  return /*#__PURE__*/ React.createElement(Toast, {
13614
13417
  key: toast.id,
@@ -13631,7 +13434,7 @@ const Toaster$1 = /*#__PURE__*/ React.forwardRef(function Toaster(props, ref) {
13631
13434
  actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle,
13632
13435
  closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel,
13633
13436
  removeToast: removeToast,
13634
- toasts: filteredToasts.filter((t)=>t.position == toast.position),
13437
+ toasts: toasts.filter((t)=>t.position == toast.position),
13635
13438
  heights: heights.filter((h)=>h.position == toast.position),
13636
13439
  setHeights: setHeights,
13637
13440
  expandByDefault: expand,
@@ -13695,16 +13498,7 @@ objectType({
13695
13498
  });
13696
13499
 
13697
13500
  const formatAddress = (address) => {
13698
- const partWithoutComma = [address.province, address.zipCode]
13699
- .filter(Boolean)
13700
- .join(" ");
13701
- const parts = [
13702
- address.line1,
13703
- address.line2,
13704
- address.city,
13705
- partWithoutComma,
13706
- address.country,
13707
- ].filter(Boolean);
13501
+ const parts = [address.line1, address.zipCode, address.country].filter(Boolean);
13708
13502
  return parts.join(", ");
13709
13503
  };
13710
13504
 
@@ -13745,24 +13539,13 @@ function useComposedRefs(...refs) {
13745
13539
  }
13746
13540
 
13747
13541
  // src/slot.tsx
13748
- var REACT_LAZY_TYPE = Symbol.for("react.lazy");
13749
- var use = React__namespace[" use ".trim().toString()];
13750
- function isPromiseLike(value) {
13751
- return typeof value === "object" && value !== null && "then" in value;
13752
- }
13753
- function isLazyComponent(element) {
13754
- return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
13755
- }
13756
13542
  // @__NO_SIDE_EFFECTS__
13757
- function createSlot$1(ownerName) {
13758
- const SlotClone = /* @__PURE__ */ createSlotClone$1(ownerName);
13543
+ function createSlot(ownerName) {
13544
+ const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
13759
13545
  const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
13760
- let { children, ...slotProps } = props;
13761
- if (isLazyComponent(children) && typeof use === "function") {
13762
- children = use(children._payload);
13763
- }
13546
+ const { children, ...slotProps } = props;
13764
13547
  const childrenArray = React__namespace.Children.toArray(children);
13765
- const slottable = childrenArray.find(isSlottable$1);
13548
+ const slottable = childrenArray.find(isSlottable);
13766
13549
  if (slottable) {
13767
13550
  const newElement = slottable.props.children;
13768
13551
  const newChildren = childrenArray.map((child) => {
@@ -13780,17 +13563,14 @@ function createSlot$1(ownerName) {
13780
13563
  Slot2.displayName = `${ownerName}.Slot`;
13781
13564
  return Slot2;
13782
13565
  }
13783
- var Slot$2 = /* @__PURE__ */ createSlot$1("Slot");
13566
+ var Slot$2 = /* @__PURE__ */ createSlot("Slot");
13784
13567
  // @__NO_SIDE_EFFECTS__
13785
- function createSlotClone$1(ownerName) {
13568
+ function createSlotClone(ownerName) {
13786
13569
  const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
13787
- let { children, ...slotProps } = props;
13788
- if (isLazyComponent(children) && typeof use === "function") {
13789
- children = use(children._payload);
13790
- }
13570
+ const { children, ...slotProps } = props;
13791
13571
  if (React__namespace.isValidElement(children)) {
13792
- const childrenRef = getElementRef$2(children);
13793
- const props2 = mergeProps$1(slotProps, children.props);
13572
+ const childrenRef = getElementRef$1(children);
13573
+ const props2 = mergeProps(slotProps, children.props);
13794
13574
  if (children.type !== React__namespace.Fragment) {
13795
13575
  props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
13796
13576
  }
@@ -13801,11 +13581,11 @@ function createSlotClone$1(ownerName) {
13801
13581
  SlotClone.displayName = `${ownerName}.SlotClone`;
13802
13582
  return SlotClone;
13803
13583
  }
13804
- var SLOTTABLE_IDENTIFIER$1 = Symbol("radix.slottable");
13805
- function isSlottable$1(child) {
13806
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$1;
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;
13807
13587
  }
13808
- function mergeProps$1(slotProps, childProps) {
13588
+ function mergeProps(slotProps, childProps) {
13809
13589
  const overrideProps = { ...childProps };
13810
13590
  for (const propName in childProps) {
13811
13591
  const slotPropValue = slotProps[propName];
@@ -13829,7 +13609,7 @@ function mergeProps$1(slotProps, childProps) {
13829
13609
  }
13830
13610
  return { ...slotProps, ...overrideProps };
13831
13611
  }
13832
- function getElementRef$2(element) {
13612
+ function getElementRef$1(element) {
13833
13613
  let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
13834
13614
  let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
13835
13615
  if (mayWarn) {
@@ -13881,9 +13661,12 @@ function cloneObject(data) {
13881
13661
  if (data instanceof Date) {
13882
13662
  copy = new Date(data);
13883
13663
  }
13664
+ else if (data instanceof Set) {
13665
+ copy = new Set(data);
13666
+ }
13884
13667
  else if (!(isWeb && (data instanceof Blob || isFileListInstance)) &&
13885
13668
  (isArray || isObject(data))) {
13886
- copy = isArray ? [] : Object.create(Object.getPrototypeOf(data));
13669
+ copy = isArray ? [] : {};
13887
13670
  if (!isArray && !isPlainObject(data)) {
13888
13671
  copy = data;
13889
13672
  }
@@ -14004,7 +13787,7 @@ HookFormContext.displayName = 'HookFormContext';
14004
13787
  */
14005
13788
  const useFormContext = () => React.useContext(HookFormContext);
14006
13789
  /**
14007
- * A provider component that propagates the `useForm` methods to all children components via [React Context](https://react.dev/reference/react/useContext) API. To be used with {@link useFormContext}.
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}.
14008
13791
  *
14009
13792
  * @remarks
14010
13793
  * [API](https://react-hook-form.com/docs/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)
@@ -14057,7 +13840,7 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
14057
13840
  return result;
14058
13841
  };
14059
13842
 
14060
- const useIsomorphicLayoutEffect$1 = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
13843
+ const useIsomorphicLayoutEffect$1 = typeof window !== 'undefined' ? React__namespace.useLayoutEffect : React__namespace.useEffect;
14061
13844
 
14062
13845
  /**
14063
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.
@@ -14129,51 +13912,12 @@ var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) =>
14129
13912
  return get(formValues, names, defaultValue);
14130
13913
  }
14131
13914
  if (Array.isArray(names)) {
14132
- return names.map((fieldName) => (isGlobal && _names.watch.add(fieldName),
14133
- get(formValues, fieldName)));
13915
+ return names.map((fieldName) => (isGlobal && _names.watch.add(fieldName), get(formValues, fieldName)));
14134
13916
  }
14135
13917
  isGlobal && (_names.watchAll = true);
14136
13918
  return formValues;
14137
13919
  };
14138
13920
 
14139
- var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
14140
-
14141
- function deepEqual$1(object1, object2, _internal_visited = new WeakSet()) {
14142
- if (isPrimitive(object1) || isPrimitive(object2)) {
14143
- return Object.is(object1, object2);
14144
- }
14145
- if (isDateObject(object1) && isDateObject(object2)) {
14146
- return object1.getTime() === object2.getTime();
14147
- }
14148
- const keys1 = Object.keys(object1);
14149
- const keys2 = Object.keys(object2);
14150
- if (keys1.length !== keys2.length) {
14151
- return false;
14152
- }
14153
- if (_internal_visited.has(object1) || _internal_visited.has(object2)) {
14154
- return true;
14155
- }
14156
- _internal_visited.add(object1);
14157
- _internal_visited.add(object2);
14158
- for (const key of keys1) {
14159
- const val1 = object1[key];
14160
- if (!keys2.includes(key)) {
14161
- return false;
14162
- }
14163
- if (key !== 'ref') {
14164
- const val2 = object2[key];
14165
- if ((isDateObject(val1) && isDateObject(val2)) ||
14166
- (isObject(val1) && isObject(val2)) ||
14167
- (Array.isArray(val1) && Array.isArray(val2))
14168
- ? !deepEqual$1(val1, val2, _internal_visited)
14169
- : !Object.is(val1, val2)) {
14170
- return false;
14171
- }
14172
- }
14173
- }
14174
- return true;
14175
- }
14176
-
14177
13921
  /**
14178
13922
  * Custom hook to subscribe to field change and isolate re-rendering at the component level.
14179
13923
  *
@@ -14192,72 +13936,20 @@ function deepEqual$1(object1, object2, _internal_visited = new WeakSet()) {
14192
13936
  */
14193
13937
  function useWatch(props) {
14194
13938
  const methods = useFormContext();
14195
- const { control = methods.control, name, defaultValue, disabled, exact, compute, } = props || {};
13939
+ const { control = methods.control, name, defaultValue, disabled, exact, } = props || {};
14196
13940
  const _defaultValue = React.useRef(defaultValue);
14197
- const _compute = React.useRef(compute);
14198
- const _computeFormValues = React.useRef(undefined);
14199
- const _prevControl = React.useRef(control);
14200
- const _prevName = React.useRef(name);
14201
- _compute.current = compute;
14202
- const [value, updateValue] = React.useState(() => {
14203
- const defaultValue = control._getWatch(name, _defaultValue.current);
14204
- return _compute.current ? _compute.current(defaultValue) : defaultValue;
14205
- });
14206
- const getCurrentOutput = React.useCallback((values) => {
14207
- const formValues = generateWatchOutput(name, control._names, values || control._formValues, false, _defaultValue.current);
14208
- return _compute.current ? _compute.current(formValues) : formValues;
14209
- }, [control._formValues, control._names, name]);
14210
- const refreshValue = React.useCallback((values) => {
14211
- if (!disabled) {
14212
- const formValues = generateWatchOutput(name, control._names, values || control._formValues, false, _defaultValue.current);
14213
- if (_compute.current) {
14214
- const computedFormValues = _compute.current(formValues);
14215
- if (!deepEqual$1(computedFormValues, _computeFormValues.current)) {
14216
- updateValue(computedFormValues);
14217
- _computeFormValues.current = computedFormValues;
14218
- }
14219
- }
14220
- else {
14221
- updateValue(formValues);
14222
- }
14223
- }
14224
- }, [control._formValues, control._names, disabled, name]);
14225
- useIsomorphicLayoutEffect$1(() => {
14226
- if (_prevControl.current !== control ||
14227
- !deepEqual$1(_prevName.current, name)) {
14228
- _prevControl.current = control;
14229
- _prevName.current = name;
14230
- refreshValue();
14231
- }
14232
- return control._subscribe({
14233
- name,
14234
- formState: {
14235
- values: true,
14236
- },
14237
- exact,
14238
- callback: (formState) => {
14239
- refreshValue(formState.values);
14240
- },
14241
- });
14242
- }, [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]);
14243
13951
  React.useEffect(() => control._removeUnmounted());
14244
- // If name or control changed for this render, synchronously reflect the
14245
- // latest value so callers (like useController) see the correct value
14246
- // immediately on the same render.
14247
- // Optimize: Check control reference first before expensive deepEqual
14248
- const controlChanged = _prevControl.current !== control;
14249
- const prevName = _prevName.current;
14250
- // Cache the computed output to avoid duplicate calls within the same render
14251
- // We include shouldReturnImmediate in deps to ensure proper recomputation
14252
- const computedOutput = React.useMemo(() => {
14253
- if (disabled) {
14254
- return null;
14255
- }
14256
- const nameChanged = !controlChanged && !deepEqual$1(prevName, name);
14257
- const shouldReturnImmediate = controlChanged || nameChanged;
14258
- return shouldReturnImmediate ? getCurrentOutput() : null;
14259
- }, [disabled, controlChanged, name, prevName, getCurrentOutput]);
14260
- return computedOutput !== null ? computedOutput : value;
13952
+ return value;
14261
13953
  }
14262
13954
 
14263
13955
  /**
@@ -14286,13 +13978,12 @@ function useWatch(props) {
14286
13978
  */
14287
13979
  function useController(props) {
14288
13980
  const methods = useFormContext();
14289
- const { name, disabled, control = methods.control, shouldUnregister, defaultValue, } = props;
13981
+ const { name, disabled, control = methods.control, shouldUnregister } = props;
14290
13982
  const isArrayField = isNameInFieldArray(control._names.array, name);
14291
- const defaultValueMemo = React.useMemo(() => get(control._formValues, name, get(control._defaultValues, name, defaultValue)), [control, name, defaultValue]);
14292
13983
  const value = useWatch({
14293
13984
  control,
14294
13985
  name,
14295
- defaultValue: defaultValueMemo,
13986
+ defaultValue: get(control._formValues, name, get(control._defaultValues, name, props.defaultValue)),
14296
13987
  exact: true,
14297
13988
  });
14298
13989
  const formState = useFormState({
@@ -14301,13 +13992,11 @@ function useController(props) {
14301
13992
  exact: true,
14302
13993
  });
14303
13994
  const _props = React.useRef(props);
14304
- const _previousNameRef = React.useRef(undefined);
14305
13995
  const _registerProps = React.useRef(control.register(name, {
14306
13996
  ...props.rules,
14307
13997
  value,
14308
13998
  ...(isBoolean(props.disabled) ? { disabled: props.disabled } : {}),
14309
13999
  }));
14310
- _props.current = props;
14311
14000
  const fieldState = React.useMemo(() => Object.defineProperties({}, {
14312
14001
  invalid: {
14313
14002
  enumerable: true,
@@ -14367,10 +14056,6 @@ function useController(props) {
14367
14056
  }), [name, disabled, formState.disabled, onChange, onBlur, ref, value]);
14368
14057
  React.useEffect(() => {
14369
14058
  const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
14370
- const previousName = _previousNameRef.current;
14371
- if (previousName && previousName !== name && !isArrayField) {
14372
- control.unregister(previousName);
14373
- }
14374
14059
  control.register(name, {
14375
14060
  ..._props.current.rules,
14376
14061
  ...(isBoolean(_props.current.disabled)
@@ -14385,14 +14070,13 @@ function useController(props) {
14385
14070
  };
14386
14071
  updateMounted(name, true);
14387
14072
  if (_shouldUnregisterField) {
14388
- const value = cloneObject(get(control._options.defaultValues, name, _props.current.defaultValue));
14073
+ const value = cloneObject(get(control._options.defaultValues, name));
14389
14074
  set(control._defaultValues, name, value);
14390
14075
  if (isUndefined(get(control._formValues, name))) {
14391
14076
  set(control._formValues, name, value);
14392
14077
  }
14393
14078
  }
14394
14079
  !isArrayField && control.register(name);
14395
- _previousNameRef.current = name;
14396
14080
  return () => {
14397
14081
  (isArrayField
14398
14082
  ? _shouldUnregisterField && !control._state.action
@@ -14498,24 +14182,42 @@ var createSubject = () => {
14498
14182
  };
14499
14183
  };
14500
14184
 
14501
- function extractFormValues(fieldsState, formValues) {
14502
- const values = {};
14503
- for (const key in fieldsState) {
14504
- if (fieldsState.hasOwnProperty(key)) {
14505
- const fieldState = fieldsState[key];
14506
- const fieldValue = formValues[key];
14507
- if (fieldState && isObject(fieldState) && fieldValue) {
14508
- const nestedFieldsState = extractFormValues(fieldState, fieldValue);
14509
- if (isObject(nestedFieldsState)) {
14510
- values[key] = nestedFieldsState;
14511
- }
14512
- }
14513
- else if (fieldsState[key]) {
14514
- values[key] = fieldValue;
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;
14515
14217
  }
14516
14218
  }
14517
14219
  }
14518
- return values;
14220
+ return true;
14519
14221
  }
14520
14222
 
14521
14223
  var isEmptyObject = (value) => isObject(value) && !Object.keys(value).length;
@@ -14586,43 +14288,46 @@ var objectHasFunction = (data) => {
14586
14288
  return false;
14587
14289
  };
14588
14290
 
14589
- function isTraversable(value) {
14590
- return Array.isArray(value) || (isObject(value) && !objectHasFunction(value));
14591
- }
14592
14291
  function markFieldsDirty(data, fields = {}) {
14593
- for (const key in data) {
14594
- const value = data[key];
14595
- if (isTraversable(value)) {
14596
- fields[key] = Array.isArray(value) ? [] : {};
14597
- markFieldsDirty(value, fields[key]);
14598
- }
14599
- else if (!isUndefined(value)) {
14600
- fields[key] = true;
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
+ }
14601
14303
  }
14602
14304
  }
14603
14305
  return fields;
14604
14306
  }
14605
- function getDirtyFields(data, formValues, dirtyFieldsFromValues) {
14606
- if (!dirtyFieldsFromValues) {
14607
- dirtyFieldsFromValues = markFieldsDirty(formValues);
14608
- }
14609
- for (const key in data) {
14610
- const value = data[key];
14611
- if (isTraversable(value)) {
14612
- if (isUndefined(formValues) || isPrimitive(dirtyFieldsFromValues[key])) {
14613
- dirtyFieldsFromValues[key] = markFieldsDirty(value, Array.isArray(value) ? [] : {});
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
+ }
14614
14322
  }
14615
14323
  else {
14616
- getDirtyFields(value, isNullOrUndefined(formValues) ? {} : formValues[key], dirtyFieldsFromValues[key]);
14324
+ dirtyFieldsFromValues[key] = !deepEqual$1(data[key], formValues[key]);
14617
14325
  }
14618
14326
  }
14619
- else {
14620
- const formValue = formValues[key];
14621
- dirtyFieldsFromValues[key] = !deepEqual$1(value, formValue);
14622
- }
14623
14327
  }
14624
14328
  return dirtyFieldsFromValues;
14625
14329
  }
14330
+ var getDirtyFields = (defaultValues, formValues) => getDirtyFieldsFromDefaultValues(defaultValues, formValues, markFieldsDirty(formValues));
14626
14331
 
14627
14332
  const defaultResult = {
14628
14333
  value: false,
@@ -14856,13 +14561,15 @@ var updateFieldArrayRootError = (errors, error, name) => {
14856
14561
  return errors;
14857
14562
  };
14858
14563
 
14564
+ var isMessage = (value) => isString(value);
14565
+
14859
14566
  function getValidateError(result, ref, type = 'validate') {
14860
- if (isString(result) ||
14861
- (Array.isArray(result) && result.every(isString)) ||
14567
+ if (isMessage(result) ||
14568
+ (Array.isArray(result) && result.every(isMessage)) ||
14862
14569
  (isBoolean(result) && !result)) {
14863
14570
  return {
14864
14571
  type,
14865
- message: isString(result) ? result : '',
14572
+ message: isMessage(result) ? result : '',
14866
14573
  ref,
14867
14574
  };
14868
14575
  }
@@ -14915,7 +14622,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
14915
14622
  (isBoolean(inputValue) && !inputValue) ||
14916
14623
  (isCheckBox && !getCheckboxValue(refs).isValid) ||
14917
14624
  (isRadio && !getRadioValue(refs).isValid))) {
14918
- const { value, message } = isString(required)
14625
+ const { value, message } = isMessage(required)
14919
14626
  ? { value: !!required, message: required }
14920
14627
  : getValueAndMessage(required);
14921
14628
  if (value) {
@@ -15080,7 +14787,7 @@ function createFormControl(props = {}) {
15080
14787
  errors: _options.errors || {},
15081
14788
  disabled: _options.disabled || false,
15082
14789
  };
15083
- let _fields = {};
14790
+ const _fields = {};
15084
14791
  let _defaultValues = isObject(_options.defaultValues) || isObject(_options.values)
15085
14792
  ? cloneObject(_options.defaultValues || _options.values) || {}
15086
14793
  : {};
@@ -15213,7 +14920,7 @@ function createFormControl(props = {}) {
15213
14920
  shouldSkipSetValueAs
15214
14921
  ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f))
15215
14922
  : setFieldValue(name, defaultValue);
15216
- _state.mount && !_state.action && _setValid();
14923
+ _state.mount && _setValid();
15217
14924
  }
15218
14925
  };
15219
14926
  const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {
@@ -15321,11 +15028,11 @@ function createFormControl(props = {}) {
15321
15028
  const isFieldArrayRoot = _names.array.has(_f.name);
15322
15029
  const isPromiseFunction = field._f && hasPromiseValidation(field._f);
15323
15030
  if (isPromiseFunction && _proxyFormState.validatingFields) {
15324
- _updateIsValidating([_f.name], true);
15031
+ _updateIsValidating([name], true);
15325
15032
  }
15326
15033
  const fieldError = await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
15327
15034
  if (isPromiseFunction && _proxyFormState.validatingFields) {
15328
- _updateIsValidating([_f.name]);
15035
+ _updateIsValidating([name]);
15329
15036
  }
15330
15037
  if (fieldError[_f.name]) {
15331
15038
  context.valid = false;
@@ -15464,7 +15171,7 @@ function createFormControl(props = {}) {
15464
15171
  ? setValues(name, cloneValue, options)
15465
15172
  : setFieldValue(name, cloneValue, options);
15466
15173
  }
15467
- isWatched(name, _names) && _subjects.state.next({ ..._formState, name });
15174
+ isWatched(name, _names) && _subjects.state.next({ ..._formState });
15468
15175
  _subjects.state.next({
15469
15176
  name: _state.mount ? name : undefined,
15470
15177
  values: cloneObject(_formValues),
@@ -15499,10 +15206,8 @@ function createFormControl(props = {}) {
15499
15206
  const watched = isWatched(name, _names, isBlurEvent);
15500
15207
  set(_formValues, name, fieldValue);
15501
15208
  if (isBlurEvent) {
15502
- if (!target || !target.readOnly) {
15503
- field._f.onBlur && field._f.onBlur(event);
15504
- delayErrorCallback && delayErrorCallback(0);
15505
- }
15209
+ field._f.onBlur && field._f.onBlur(event);
15210
+ delayErrorCallback && delayErrorCallback(0);
15506
15211
  }
15507
15212
  else if (field._f.onChange) {
15508
15213
  field._f.onChange(event);
@@ -15558,7 +15263,6 @@ function createFormControl(props = {}) {
15558
15263
  }
15559
15264
  if (isFieldValueUpdated) {
15560
15265
  field._f.deps &&
15561
- (!Array.isArray(field._f.deps) || field._f.deps.length > 0) &&
15562
15266
  trigger(field._f.deps);
15563
15267
  shouldRenderByError(name, isValid, error, fieldState);
15564
15268
  }
@@ -15606,13 +15310,10 @@ function createFormControl(props = {}) {
15606
15310
  iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount);
15607
15311
  return validationResult;
15608
15312
  };
15609
- const getValues = (fieldNames, config) => {
15610
- let values = {
15313
+ const getValues = (fieldNames) => {
15314
+ const values = {
15611
15315
  ...(_state.mount ? _formValues : _defaultValues),
15612
15316
  };
15613
- if (config) {
15614
- values = extractFormValues(config.dirtyFields ? _formState.dirtyFields : _formState.touchedFields, values);
15615
- }
15616
15317
  return isUndefined(fieldNames)
15617
15318
  ? values
15618
15319
  : isString(fieldNames)
@@ -15652,8 +15353,7 @@ function createFormControl(props = {}) {
15652
15353
  };
15653
15354
  const watch = (name, defaultValue) => isFunction$1(name)
15654
15355
  ? _subjects.state.subscribe({
15655
- next: (payload) => 'values' in payload &&
15656
- name(_getWatch(undefined, defaultValue), payload),
15356
+ next: (payload) => name(_getWatch(undefined, defaultValue), payload),
15657
15357
  })
15658
15358
  : _getWatch(name, defaultValue, true);
15659
15359
  const _subscribe = (props) => _subjects.state.subscribe({
@@ -15664,7 +15364,6 @@ function createFormControl(props = {}) {
15664
15364
  values: { ..._formValues },
15665
15365
  ..._formState,
15666
15366
  ...formState,
15667
- defaultValues: _defaultValues,
15668
15367
  });
15669
15368
  }
15670
15369
  },
@@ -15934,20 +15633,15 @@ function createFormControl(props = {}) {
15934
15633
  }
15935
15634
  }
15936
15635
  }
15937
- if (keepStateOptions.keepFieldsRef) {
15938
- for (const fieldName of _names.mount) {
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);
15939
15640
  setValue(fieldName, get(values, fieldName));
15940
15641
  }
15941
15642
  }
15942
- else {
15943
- _fields = {};
15944
- }
15945
15643
  }
15946
- _formValues = _options.shouldUnregister
15947
- ? keepStateOptions.keepDefaultValues
15948
- ? cloneObject(_defaultValues)
15949
- : {}
15950
- : cloneObject(values);
15644
+ _formValues = cloneObject(values);
15951
15645
  _subjects.array.next({
15952
15646
  values: { ...values },
15953
15647
  });
@@ -15967,8 +15661,7 @@ function createFormControl(props = {}) {
15967
15661
  _state.mount =
15968
15662
  !_proxyFormState.isValid ||
15969
15663
  !!keepStateOptions.keepIsValid ||
15970
- !!keepStateOptions.keepDirtyValues ||
15971
- (!_options.shouldUnregister && !isEmptyObject(values));
15664
+ !!keepStateOptions.keepDirtyValues;
15972
15665
  _state.watch = !!_options.shouldUnregister;
15973
15666
  _subjects.state.next({
15974
15667
  submitCount: keepStateOptions.keepSubmitCount
@@ -16002,7 +15695,6 @@ function createFormControl(props = {}) {
16002
15695
  ? _formState.isSubmitSuccessful
16003
15696
  : false,
16004
15697
  isSubmitting: false,
16005
- defaultValues: _defaultValues,
16006
15698
  });
16007
15699
  };
16008
15700
  const reset = (formValues, keepStateOptions) => _reset(isFunction$1(formValues)
@@ -16230,15 +15922,8 @@ function useForm(props = {}) {
16230
15922
  }
16231
15923
  }, [control, formState.isDirty]);
16232
15924
  React.useEffect(() => {
16233
- var _a;
16234
15925
  if (props.values && !deepEqual$1(props.values, _values.current)) {
16235
- control._reset(props.values, {
16236
- keepFieldsRef: true,
16237
- ...control._options.resetOptions,
16238
- });
16239
- if (!((_a = control._options.resetOptions) === null || _a === void 0 ? void 0 : _a.keepIsValid)) {
16240
- control._setValid();
16241
- }
15926
+ control._reset(props.values, control._options.resetOptions);
16242
15927
  _values.current = props.values;
16243
15928
  updateFormState((state) => ({ ...state }));
16244
15929
  }
@@ -16262,7 +15947,7 @@ function useForm(props = {}) {
16262
15947
  }
16263
15948
 
16264
15949
  // src/primitive.tsx
16265
- var NODES$1 = [
15950
+ var NODES = [
16266
15951
  "a",
16267
15952
  "button",
16268
15953
  "div",
@@ -16281,8 +15966,8 @@ var NODES$1 = [
16281
15966
  "svg",
16282
15967
  "ul"
16283
15968
  ];
16284
- var Primitive$1 = NODES$1.reduce((primitive, node) => {
16285
- const Slot = createSlot$1(`Primitive.${node}`);
15969
+ var Primitive = NODES.reduce((primitive, node) => {
15970
+ const Slot = createSlot(`Primitive.${node}`);
16286
15971
  const Node = React__namespace.forwardRef((props, forwardedRef) => {
16287
15972
  const { asChild, ...primitiveProps } = props;
16288
15973
  const Comp = asChild ? Slot : node;
@@ -16294,11 +15979,14 @@ var Primitive$1 = NODES$1.reduce((primitive, node) => {
16294
15979
  Node.displayName = `Primitive.${node}`;
16295
15980
  return { ...primitive, [node]: Node };
16296
15981
  }, {});
15982
+ function dispatchDiscreteCustomEvent(target, event) {
15983
+ if (target) ReactDOM__namespace.flushSync(() => target.dispatchEvent(event));
15984
+ }
16297
15985
 
16298
15986
  var NAME$1 = "Label";
16299
15987
  var Label$1 = React__namespace.forwardRef((props, forwardedRef) => {
16300
15988
  return /* @__PURE__ */ jsxRuntime.jsx(
16301
- Primitive$1.label,
15989
+ Primitive.label,
16302
15990
  {
16303
15991
  ...props,
16304
15992
  ref: forwardedRef,
@@ -16316,36 +16004,7 @@ var Root$2 = Label$1;
16316
16004
 
16317
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}
16318
16006
 
16319
- /**
16320
- * Concatenates two arrays faster than the array spread operator.
16321
- */
16322
- const concatArrays = (array1, array2) => {
16323
- // Pre-allocate for better V8 optimization
16324
- const combinedArray = new Array(array1.length + array2.length);
16325
- for (let i = 0; i < array1.length; i++) {
16326
- combinedArray[i] = array1[i];
16327
- }
16328
- for (let i = 0; i < array2.length; i++) {
16329
- combinedArray[array1.length + i] = array2[i];
16330
- }
16331
- return combinedArray;
16332
- };
16333
-
16334
- // Factory function ensures consistent object shapes
16335
- const createClassValidatorObject = (classGroupId, validator) => ({
16336
- classGroupId,
16337
- validator
16338
- });
16339
- // Factory ensures consistent ClassPartObject shape
16340
- const createClassPartObject = (nextPart = new Map(), validators = null, classGroupId) => ({
16341
- nextPart,
16342
- validators,
16343
- classGroupId
16344
- });
16345
16007
  const CLASS_PART_SEPARATOR = '-';
16346
- const EMPTY_CONFLICTS = [];
16347
- // I use two dots here because one dot is used as prefix for class groups in plugins
16348
- const ARBITRARY_PROPERTY_PREFIX = 'arbitrary..';
16349
16008
  const createClassGroupUtils = config => {
16350
16009
  const classMap = createClassMap(config);
16351
16010
  const {
@@ -16353,73 +16012,54 @@ const createClassGroupUtils = config => {
16353
16012
  conflictingClassGroupModifiers
16354
16013
  } = config;
16355
16014
  const getClassGroupId = className => {
16356
- if (className.startsWith('[') && className.endsWith(']')) {
16357
- return getGroupIdForArbitraryProperty(className);
16358
- }
16359
16015
  const classParts = className.split(CLASS_PART_SEPARATOR);
16360
- // Classes like `-inset-1` produce an empty string as first classPart. We assume that classes for negative values are used correctly and skip it.
16361
- const startIndex = classParts[0] === '' && classParts.length > 1 ? 1 : 0;
16362
- return getGroupRecursive(classParts, startIndex, classMap);
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);
16363
16021
  };
16364
16022
  const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
16365
- if (hasPostfixModifier) {
16366
- const modifierConflicts = conflictingClassGroupModifiers[classGroupId];
16367
- const baseConflicts = conflictingClassGroups[classGroupId];
16368
- if (modifierConflicts) {
16369
- if (baseConflicts) {
16370
- // Merge base conflicts with modifier conflicts
16371
- return concatArrays(baseConflicts, modifierConflicts);
16372
- }
16373
- // Only modifier conflicts
16374
- return modifierConflicts;
16375
- }
16376
- // Fall back to without postfix if no modifier conflicts
16377
- return baseConflicts || EMPTY_CONFLICTS;
16023
+ const conflicts = conflictingClassGroups[classGroupId] || [];
16024
+ if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
16025
+ return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]];
16378
16026
  }
16379
- return conflictingClassGroups[classGroupId] || EMPTY_CONFLICTS;
16027
+ return conflicts;
16380
16028
  };
16381
16029
  return {
16382
16030
  getClassGroupId,
16383
16031
  getConflictingClassGroupIds
16384
16032
  };
16385
16033
  };
16386
- const getGroupRecursive = (classParts, startIndex, classPartObject) => {
16387
- const classPathsLength = classParts.length - startIndex;
16388
- if (classPathsLength === 0) {
16034
+ const getGroupRecursive = (classParts, classPartObject) => {
16035
+ if (classParts.length === 0) {
16389
16036
  return classPartObject.classGroupId;
16390
16037
  }
16391
- const currentClassPart = classParts[startIndex];
16038
+ const currentClassPart = classParts[0];
16392
16039
  const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
16393
- if (nextClassPartObject) {
16394
- const result = getGroupRecursive(classParts, startIndex + 1, nextClassPartObject);
16395
- if (result) return result;
16040
+ const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : undefined;
16041
+ if (classGroupFromNextClassPart) {
16042
+ return classGroupFromNextClassPart;
16396
16043
  }
16397
- const validators = classPartObject.validators;
16398
- if (validators === null) {
16044
+ if (classPartObject.validators.length === 0) {
16399
16045
  return undefined;
16400
16046
  }
16401
- // Build classRest string efficiently by joining from startIndex onwards
16402
- const classRest = startIndex === 0 ? classParts.join(CLASS_PART_SEPARATOR) : classParts.slice(startIndex).join(CLASS_PART_SEPARATOR);
16403
- const validatorsLength = validators.length;
16404
- for (let i = 0; i < validatorsLength; i++) {
16405
- const validatorObj = validators[i];
16406
- if (validatorObj.validator(classRest)) {
16407
- return validatorObj.classGroupId;
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;
16408
16060
  }
16409
16061
  }
16410
- return undefined;
16411
16062
  };
16412
- /**
16413
- * Get the class group ID for an arbitrary property.
16414
- *
16415
- * @param className - The class name to get the group ID for. Is expected to be string starting with `[` and ending with `]`.
16416
- */
16417
- const getGroupIdForArbitraryProperty = className => className.slice(1, -1).indexOf(':') === -1 ? undefined : (() => {
16418
- const content = className.slice(1, -1);
16419
- const colonIndex = content.indexOf(':');
16420
- const property = content.slice(0, colonIndex);
16421
- return property ? ARBITRARY_PROPERTY_PREFIX + property : undefined;
16422
- })();
16423
16063
  /**
16424
16064
  * Exported for testing only
16425
16065
  */
@@ -16428,77 +16068,54 @@ const createClassMap = config => {
16428
16068
  theme,
16429
16069
  classGroups
16430
16070
  } = config;
16431
- return processClassGroups(classGroups, theme);
16432
- };
16433
- // Split into separate functions to maintain monomorphic call sites
16434
- const processClassGroups = (classGroups, theme) => {
16435
- const classMap = createClassPartObject();
16071
+ const classMap = {
16072
+ nextPart: new Map(),
16073
+ validators: []
16074
+ };
16436
16075
  for (const classGroupId in classGroups) {
16437
- const group = classGroups[classGroupId];
16438
- processClassesRecursively(group, classMap, classGroupId, theme);
16076
+ processClassesRecursively(classGroups[classGroupId], classMap, classGroupId, theme);
16439
16077
  }
16440
16078
  return classMap;
16441
16079
  };
16442
16080
  const processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
16443
- const len = classGroup.length;
16444
- for (let i = 0; i < len; i++) {
16445
- const classDefinition = classGroup[i];
16446
- processClassDefinition(classDefinition, classPartObject, classGroupId, theme);
16447
- }
16448
- };
16449
- // Split into separate functions for each type to maintain monomorphic call sites
16450
- const processClassDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
16451
- if (typeof classDefinition === 'string') {
16452
- processStringDefinition(classDefinition, classPartObject, classGroupId);
16453
- return;
16454
- }
16455
- if (typeof classDefinition === 'function') {
16456
- processFunctionDefinition(classDefinition, classPartObject, classGroupId, theme);
16457
- return;
16458
- }
16459
- processObjectDefinition(classDefinition, classPartObject, classGroupId, theme);
16460
- };
16461
- const processStringDefinition = (classDefinition, classPartObject, classGroupId) => {
16462
- const classPartObjectToEdit = classDefinition === '' ? classPartObject : getPart(classPartObject, classDefinition);
16463
- classPartObjectToEdit.classGroupId = classGroupId;
16464
- };
16465
- const processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
16466
- if (isThemeGetter(classDefinition)) {
16467
- processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
16468
- return;
16469
- }
16470
- if (classPartObject.validators === null) {
16471
- classPartObject.validators = [];
16472
- }
16473
- classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
16474
- };
16475
- const processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
16476
- const entries = Object.entries(classDefinition);
16477
- const len = entries.length;
16478
- for (let i = 0; i < len; i++) {
16479
- const [key, value] = entries[i];
16480
- processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
16481
- }
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
+ });
16482
16102
  };
16483
16103
  const getPart = (classPartObject, path) => {
16484
- let current = classPartObject;
16485
- const parts = path.split(CLASS_PART_SEPARATOR);
16486
- const len = parts.length;
16487
- for (let i = 0; i < len; i++) {
16488
- const part = parts[i];
16489
- let next = current.nextPart.get(part);
16490
- if (!next) {
16491
- next = createClassPartObject();
16492
- 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
+ });
16493
16111
  }
16494
- current = next;
16495
- }
16496
- return current;
16112
+ currentClassPartObject = currentClassPartObject.nextPart.get(pathPart);
16113
+ });
16114
+ return currentClassPartObject;
16497
16115
  };
16498
- // Type guard maintains monomorphic check
16499
- const isThemeGetter = func => 'isThemeGetter' in func && func.isThemeGetter === true;
16116
+ const isThemeGetter = func => func.isThemeGetter;
16500
16117
 
16501
- // LRU cache implementation using plain objects for simplicity
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
16502
16119
  const createLruCache = maxCacheSize => {
16503
16120
  if (maxCacheSize < 1) {
16504
16121
  return {
@@ -16507,31 +16124,31 @@ const createLruCache = maxCacheSize => {
16507
16124
  };
16508
16125
  }
16509
16126
  let cacheSize = 0;
16510
- let cache = Object.create(null);
16511
- let previousCache = Object.create(null);
16127
+ let cache = new Map();
16128
+ let previousCache = new Map();
16512
16129
  const update = (key, value) => {
16513
- cache[key] = value;
16130
+ cache.set(key, value);
16514
16131
  cacheSize++;
16515
16132
  if (cacheSize > maxCacheSize) {
16516
16133
  cacheSize = 0;
16517
16134
  previousCache = cache;
16518
- cache = Object.create(null);
16135
+ cache = new Map();
16519
16136
  }
16520
16137
  };
16521
16138
  return {
16522
16139
  get(key) {
16523
- let value = cache[key];
16140
+ let value = cache.get(key);
16524
16141
  if (value !== undefined) {
16525
16142
  return value;
16526
16143
  }
16527
- if ((value = previousCache[key]) !== undefined) {
16144
+ if ((value = previousCache.get(key)) !== undefined) {
16528
16145
  update(key, value);
16529
16146
  return value;
16530
16147
  }
16531
16148
  },
16532
16149
  set(key, value) {
16533
- if (key in cache) {
16534
- cache[key] = value;
16150
+ if (cache.has(key)) {
16151
+ cache.set(key, value);
16535
16152
  } else {
16536
16153
  update(key, value);
16537
16154
  }
@@ -16540,15 +16157,7 @@ const createLruCache = maxCacheSize => {
16540
16157
  };
16541
16158
  const IMPORTANT_MODIFIER = '!';
16542
16159
  const MODIFIER_SEPARATOR = ':';
16543
- const EMPTY_MODIFIERS = [];
16544
- // Pre-allocated result object shape for consistency
16545
- const createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
16546
- modifiers,
16547
- hasImportantModifier,
16548
- baseClassName,
16549
- maybePostfixModifierPosition,
16550
- isExternal
16551
- });
16160
+ const MODIFIER_SEPARATOR_LENGTH = MODIFIER_SEPARATOR.length;
16552
16161
  const createParseClassName = config => {
16553
16162
  const {
16554
16163
  prefix,
@@ -16561,19 +16170,17 @@ const createParseClassName = config => {
16561
16170
  * @see https://github.com/tailwindlabs/tailwindcss/blob/v3.2.2/src/util/splitAtTopLevelOnly.js
16562
16171
  */
16563
16172
  let parseClassName = className => {
16564
- // Use simple array with push for better performance
16565
16173
  const modifiers = [];
16566
16174
  let bracketDepth = 0;
16567
16175
  let parenDepth = 0;
16568
16176
  let modifierStart = 0;
16569
16177
  let postfixModifierPosition;
16570
- const len = className.length;
16571
- for (let index = 0; index < len; index++) {
16572
- const currentCharacter = className[index];
16178
+ for (let index = 0; index < className.length; index++) {
16179
+ let currentCharacter = className[index];
16573
16180
  if (bracketDepth === 0 && parenDepth === 0) {
16574
16181
  if (currentCharacter === MODIFIER_SEPARATOR) {
16575
16182
  modifiers.push(className.slice(modifierStart, index));
16576
- modifierStart = index + 1;
16183
+ modifierStart = index + MODIFIER_SEPARATOR_LENGTH;
16577
16184
  continue;
16578
16185
  }
16579
16186
  if (currentCharacter === '/') {
@@ -16581,31 +16188,37 @@ const createParseClassName = config => {
16581
16188
  continue;
16582
16189
  }
16583
16190
  }
16584
- if (currentCharacter === '[') bracketDepth++;else if (currentCharacter === ']') bracketDepth--;else if (currentCharacter === '(') parenDepth++;else if (currentCharacter === ')') parenDepth--;
16585
- }
16586
- const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.slice(modifierStart);
16587
- // Inline important modifier check
16588
- let baseClassName = baseClassNameWithImportantModifier;
16589
- let hasImportantModifier = false;
16590
- if (baseClassNameWithImportantModifier.endsWith(IMPORTANT_MODIFIER)) {
16591
- baseClassName = baseClassNameWithImportantModifier.slice(0, -1);
16592
- hasImportantModifier = true;
16593
- } else if (
16594
- /**
16595
- * In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
16596
- * @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
16597
- */
16598
- baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)) {
16599
- baseClassName = baseClassNameWithImportantModifier.slice(1);
16600
- 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
+ }
16601
16200
  }
16201
+ const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart);
16202
+ const baseClassName = stripImportantModifier(baseClassNameWithImportantModifier);
16203
+ const hasImportantModifier = baseClassName !== baseClassNameWithImportantModifier;
16602
16204
  const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : undefined;
16603
- return createResultObject(modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition);
16205
+ return {
16206
+ modifiers,
16207
+ hasImportantModifier,
16208
+ baseClassName,
16209
+ maybePostfixModifierPosition
16210
+ };
16604
16211
  };
16605
16212
  if (prefix) {
16606
16213
  const fullPrefix = prefix + MODIFIER_SEPARATOR;
16607
16214
  const parseClassNameOriginal = parseClassName;
16608
- parseClassName = className => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.slice(fullPrefix.length)) : createResultObject(EMPTY_MODIFIERS, false, className, undefined, true);
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
+ };
16609
16222
  }
16610
16223
  if (experimentalParseClassName) {
16611
16224
  const parseClassNameOriginal = parseClassName;
@@ -16616,6 +16229,19 @@ const createParseClassName = config => {
16616
16229
  }
16617
16230
  return parseClassName;
16618
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
+ };
16619
16245
 
16620
16246
  /**
16621
16247
  * Sorts modifiers according to following schema:
@@ -16623,41 +16249,26 @@ const createParseClassName = config => {
16623
16249
  * - When an arbitrary variant appears, it must be preserved which modifiers are before and after it
16624
16250
  */
16625
16251
  const createSortModifiers = config => {
16626
- // Pre-compute weights for all known modifiers for O(1) comparison
16627
- const modifierWeights = new Map();
16628
- // Assign weights to sensitive modifiers (highest priority, but preserve order)
16629
- config.orderSensitiveModifiers.forEach((mod, index) => {
16630
- modifierWeights.set(mod, 1000000 + index); // High weights for sensitive mods
16631
- });
16632
- return modifiers => {
16633
- const result = [];
16634
- let currentSegment = [];
16635
- // Process modifiers in one pass
16636
- for (let i = 0; i < modifiers.length; i++) {
16637
- const modifier = modifiers[i];
16638
- // Check if modifier is sensitive (starts with '[' or in orderSensitiveModifiers)
16639
- const isArbitrary = modifier[0] === '[';
16640
- const isOrderSensitive = modifierWeights.has(modifier);
16641
- if (isArbitrary || isOrderSensitive) {
16642
- // Sort and flush current segment alphabetically
16643
- if (currentSegment.length > 0) {
16644
- currentSegment.sort();
16645
- result.push(...currentSegment);
16646
- currentSegment = [];
16647
- }
16648
- 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 = [];
16649
16264
  } else {
16650
- // Regular modifier - add to current segment for batch sorting
16651
- currentSegment.push(modifier);
16265
+ unsortedModifiers.push(modifier);
16652
16266
  }
16653
- }
16654
- // Sort and add any remaining segment items
16655
- if (currentSegment.length > 0) {
16656
- currentSegment.sort();
16657
- result.push(...currentSegment);
16658
- }
16659
- return result;
16267
+ });
16268
+ sortedModifiers.push(...unsortedModifiers.sort());
16269
+ return sortedModifiers;
16660
16270
  };
16271
+ return sortModifiers;
16661
16272
  };
16662
16273
  const createConfigUtils = config => ({
16663
16274
  cache: createLruCache(config.cacheSize),
@@ -16712,11 +16323,10 @@ const mergeClassList = (classList, configUtils) => {
16712
16323
  }
16713
16324
  hasPostfixModifier = false;
16714
16325
  }
16715
- // Fast path: skip sorting for empty or single modifier
16716
- const variantModifier = modifiers.length === 0 ? '' : modifiers.length === 1 ? modifiers[0] : sortModifiers(modifiers).join(':');
16326
+ const variantModifier = sortModifiers(modifiers).join(':');
16717
16327
  const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
16718
16328
  const classId = modifierId + classGroupId;
16719
- if (classGroupsInConflict.indexOf(classId) > -1) {
16329
+ if (classGroupsInConflict.includes(classId)) {
16720
16330
  // Tailwind class omitted due to conflict
16721
16331
  continue;
16722
16332
  }
@@ -16741,13 +16351,13 @@ const mergeClassList = (classList, configUtils) => {
16741
16351
  *
16742
16352
  * Original code has MIT license: Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
16743
16353
  */
16744
- const twJoin = (...classLists) => {
16354
+ function twJoin() {
16745
16355
  let index = 0;
16746
16356
  let argument;
16747
16357
  let resolvedValue;
16748
16358
  let string = '';
16749
- while (index < classLists.length) {
16750
- if (argument = classLists[index++]) {
16359
+ while (index < arguments.length) {
16360
+ if (argument = arguments[index++]) {
16751
16361
  if (resolvedValue = toValue(argument)) {
16752
16362
  string && (string += ' ');
16753
16363
  string += resolvedValue;
@@ -16755,9 +16365,8 @@ const twJoin = (...classLists) => {
16755
16365
  }
16756
16366
  }
16757
16367
  return string;
16758
- };
16368
+ }
16759
16369
  const toValue = mix => {
16760
- // Fast path for strings
16761
16370
  if (typeof mix === 'string') {
16762
16371
  return mix;
16763
16372
  }
@@ -16773,20 +16382,20 @@ const toValue = mix => {
16773
16382
  }
16774
16383
  return string;
16775
16384
  };
16776
- const createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
16385
+ function createTailwindMerge(createConfigFirst, ...createConfigRest) {
16777
16386
  let configUtils;
16778
16387
  let cacheGet;
16779
16388
  let cacheSet;
16780
- let functionToCall;
16781
- const initTailwindMerge = classList => {
16389
+ let functionToCall = initTailwindMerge;
16390
+ function initTailwindMerge(classList) {
16782
16391
  const config = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
16783
16392
  configUtils = createConfigUtils(config);
16784
16393
  cacheGet = configUtils.cache.get;
16785
16394
  cacheSet = configUtils.cache.set;
16786
16395
  functionToCall = tailwindMerge;
16787
16396
  return tailwindMerge(classList);
16788
- };
16789
- const tailwindMerge = classList => {
16397
+ }
16398
+ function tailwindMerge(classList) {
16790
16399
  const cachedResult = cacheGet(classList);
16791
16400
  if (cachedResult) {
16792
16401
  return cachedResult;
@@ -16794,13 +16403,13 @@ const createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
16794
16403
  const result = mergeClassList(classList, configUtils);
16795
16404
  cacheSet(classList, result);
16796
16405
  return result;
16406
+ }
16407
+ return function callTailwindMerge() {
16408
+ return functionToCall(twJoin.apply(null, arguments));
16797
16409
  };
16798
- functionToCall = initTailwindMerge;
16799
- return (...args) => functionToCall(twJoin(...args));
16800
- };
16801
- const fallbackThemeArr = [];
16410
+ }
16802
16411
  const fromTheme = key => {
16803
- const themeGetter = theme => theme[key] || fallbackThemeArr;
16412
+ const themeGetter = theme => theme[key] || [];
16804
16413
  themeGetter.isThemeGetter = true;
16805
16414
  return themeGetter;
16806
16415
  };
@@ -19508,7 +19117,7 @@ function Button(_a) {
19508
19117
 
19509
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,{})}
19510
19119
 
19511
- // src/primitive.tsx
19120
+ // packages/core/primitive/src/primitive.tsx
19512
19121
  function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
19513
19122
  return function handleEvent(event) {
19514
19123
  originalEventHandler?.(event);
@@ -19674,127 +19283,6 @@ function isFunction(value) {
19674
19283
  return typeof value === "function";
19675
19284
  }
19676
19285
 
19677
- // src/slot.tsx
19678
- // @__NO_SIDE_EFFECTS__
19679
- function createSlot(ownerName) {
19680
- const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
19681
- const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
19682
- const { children, ...slotProps } = props;
19683
- const childrenArray = React__namespace.Children.toArray(children);
19684
- const slottable = childrenArray.find(isSlottable);
19685
- if (slottable) {
19686
- const newElement = slottable.props.children;
19687
- const newChildren = childrenArray.map((child) => {
19688
- if (child === slottable) {
19689
- if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
19690
- return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
19691
- } else {
19692
- return child;
19693
- }
19694
- });
19695
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
19696
- }
19697
- return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
19698
- });
19699
- Slot2.displayName = `${ownerName}.Slot`;
19700
- return Slot2;
19701
- }
19702
- // @__NO_SIDE_EFFECTS__
19703
- function createSlotClone(ownerName) {
19704
- const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
19705
- const { children, ...slotProps } = props;
19706
- if (React__namespace.isValidElement(children)) {
19707
- const childrenRef = getElementRef$1(children);
19708
- const props2 = mergeProps(slotProps, children.props);
19709
- if (children.type !== React__namespace.Fragment) {
19710
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
19711
- }
19712
- return React__namespace.cloneElement(children, props2);
19713
- }
19714
- return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
19715
- });
19716
- SlotClone.displayName = `${ownerName}.SlotClone`;
19717
- return SlotClone;
19718
- }
19719
- var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
19720
- function isSlottable(child) {
19721
- return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
19722
- }
19723
- function mergeProps(slotProps, childProps) {
19724
- const overrideProps = { ...childProps };
19725
- for (const propName in childProps) {
19726
- const slotPropValue = slotProps[propName];
19727
- const childPropValue = childProps[propName];
19728
- const isHandler = /^on[A-Z]/.test(propName);
19729
- if (isHandler) {
19730
- if (slotPropValue && childPropValue) {
19731
- overrideProps[propName] = (...args) => {
19732
- const result = childPropValue(...args);
19733
- slotPropValue(...args);
19734
- return result;
19735
- };
19736
- } else if (slotPropValue) {
19737
- overrideProps[propName] = slotPropValue;
19738
- }
19739
- } else if (propName === "style") {
19740
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
19741
- } else if (propName === "className") {
19742
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
19743
- }
19744
- }
19745
- return { ...slotProps, ...overrideProps };
19746
- }
19747
- function getElementRef$1(element) {
19748
- let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
19749
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
19750
- if (mayWarn) {
19751
- return element.ref;
19752
- }
19753
- getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
19754
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
19755
- if (mayWarn) {
19756
- return element.props.ref;
19757
- }
19758
- return element.props.ref || element.ref;
19759
- }
19760
-
19761
- // src/primitive.tsx
19762
- var NODES = [
19763
- "a",
19764
- "button",
19765
- "div",
19766
- "form",
19767
- "h2",
19768
- "h3",
19769
- "img",
19770
- "input",
19771
- "label",
19772
- "li",
19773
- "nav",
19774
- "ol",
19775
- "p",
19776
- "select",
19777
- "span",
19778
- "svg",
19779
- "ul"
19780
- ];
19781
- var Primitive = NODES.reduce((primitive, node) => {
19782
- const Slot = createSlot(`Primitive.${node}`);
19783
- const Node = React__namespace.forwardRef((props, forwardedRef) => {
19784
- const { asChild, ...primitiveProps } = props;
19785
- const Comp = asChild ? Slot : node;
19786
- if (typeof window !== "undefined") {
19787
- window[Symbol.for("radix-ui")] = true;
19788
- }
19789
- return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
19790
- });
19791
- Node.displayName = `Primitive.${node}`;
19792
- return { ...primitive, [node]: Node };
19793
- }, {});
19794
- function dispatchDiscreteCustomEvent(target, event) {
19795
- if (target) ReactDOM__namespace.flushSync(() => target.dispatchEvent(event));
19796
- }
19797
-
19798
19286
  // packages/react/use-callback-ref/src/use-callback-ref.tsx
19799
19287
  function useCallbackRef$1(callback) {
19800
19288
  const callbackRef = React__namespace.useRef(callback);
@@ -20298,7 +19786,7 @@ function usePresence(present) {
20298
19786
  const ownerWindow = node.ownerDocument.defaultView ?? window;
20299
19787
  const handleAnimationEnd = (event) => {
20300
19788
  const currentAnimationName = getAnimationName(stylesRef.current);
20301
- const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
19789
+ const isCurrentAnimation = currentAnimationName.includes(event.animationName);
20302
19790
  if (event.target === node && isCurrentAnimation) {
20303
19791
  send("ANIMATION_END");
20304
19792
  if (!prevPresentRef.current) {
@@ -21214,7 +20702,7 @@ var hideOthers = function (originalTarget, parentNode, markerName) {
21214
20702
  };
21215
20703
 
21216
20704
  var DIALOG_NAME = "Dialog";
21217
- var [createDialogContext] = createContextScope(DIALOG_NAME);
20705
+ var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
21218
20706
  var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
21219
20707
  var Dialog = (props) => {
21220
20708
  const {
@@ -21512,7 +21000,7 @@ var Portal = DialogPortal;
21512
21000
  var Overlay = DialogOverlay;
21513
21001
  var Content$1 = DialogContent;
21514
21002
 
21515
- 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"};
21516
21004
 
21517
21005
  /**
21518
21006
  * @license lucide-react v0.479.0 - ISC
@@ -22244,7 +21732,7 @@ const flip$2 = function (options) {
22244
21732
  if (!ignoreCrossAxisOverflow ||
22245
21733
  // We leave the current main axis only if every placement on that axis
22246
21734
  // overflows the main axis.
22247
- overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
21735
+ overflowsData.every(d => d.overflows[0] > 0 && getSideAxis(d.placement) === initialSideAxis)) {
22248
21736
  // Try next placement and re-run the lifecycle.
22249
21737
  return {
22250
21738
  data: {
@@ -22983,9 +22471,14 @@ function getWindowScrollBarX(element, rect) {
22983
22471
  return rect.left + leftScroll;
22984
22472
  }
22985
22473
 
22986
- function getHTMLOffset(documentElement, scroll) {
22474
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
22475
+ if (ignoreScrollbarX === void 0) {
22476
+ ignoreScrollbarX = false;
22477
+ }
22987
22478
  const htmlRect = documentElement.getBoundingClientRect();
22988
- const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
22479
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
22480
+ // RTL <body> scrollbar.
22481
+ getWindowScrollBarX(documentElement, htmlRect));
22989
22482
  const y = htmlRect.top + scroll.scrollTop;
22990
22483
  return {
22991
22484
  x,
@@ -23024,7 +22517,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
23024
22517
  offsets.y = offsetRect.y + offsetParent.clientTop;
23025
22518
  }
23026
22519
  }
23027
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
22520
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
23028
22521
  return {
23029
22522
  width: rect.width * scale.x,
23030
22523
  height: rect.height * scale.y,
@@ -23058,10 +22551,6 @@ function getDocumentRect(element) {
23058
22551
  };
23059
22552
  }
23060
22553
 
23061
- // Safety check: ensure the scrollbar space is reasonable in case this
23062
- // calculation is affected by unusual styles.
23063
- // Most scrollbars leave 15-18px of space.
23064
- const SCROLLBAR_MAX = 25;
23065
22554
  function getViewportRect(element, strategy) {
23066
22555
  const win = getWindow(element);
23067
22556
  const html = getDocumentElement(element);
@@ -23079,24 +22568,6 @@ function getViewportRect(element, strategy) {
23079
22568
  y = visualViewport.offsetTop;
23080
22569
  }
23081
22570
  }
23082
- const windowScrollbarX = getWindowScrollBarX(html);
23083
- // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
23084
- // visual width of the <html> but this is not considered in the size
23085
- // of `html.clientWidth`.
23086
- if (windowScrollbarX <= 0) {
23087
- const doc = html.ownerDocument;
23088
- const body = doc.body;
23089
- const bodyStyles = getComputedStyle(body);
23090
- const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
23091
- const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
23092
- if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
23093
- width -= clippingStableScrollbarWidth;
23094
- }
23095
- } else if (windowScrollbarX <= SCROLLBAR_MAX) {
23096
- // If the <body> scrollbar is on the left, the width needs to be extended
23097
- // by the scrollbar amount so there isn't extra space on the right.
23098
- width += windowScrollbarX;
23099
- }
23100
22571
  return {
23101
22572
  width,
23102
22573
  height,
@@ -24007,13 +23478,8 @@ var PopperAnchor = React__namespace.forwardRef(
24007
23478
  const context = usePopperContext(ANCHOR_NAME$1, __scopePopper);
24008
23479
  const ref = React__namespace.useRef(null);
24009
23480
  const composedRefs = useComposedRefs(forwardedRef, ref);
24010
- const anchorRef = React__namespace.useRef(null);
24011
23481
  React__namespace.useEffect(() => {
24012
- const previousAnchor = anchorRef.current;
24013
- anchorRef.current = virtualRef?.current || ref.current;
24014
- if (previousAnchor !== anchorRef.current) {
24015
- context.onAnchorChange(anchorRef.current);
24016
- }
23482
+ context.onAnchorChange(virtualRef?.current || ref.current);
24017
23483
  });
24018
23484
  return virtualRef ? null : /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
24019
23485
  }
@@ -24262,7 +23728,7 @@ var Content = PopperContent;
24262
23728
  var Arrow = PopperArrow;
24263
23729
 
24264
23730
  var POPOVER_NAME = "Popover";
24265
- var [createPopoverContext] = createContextScope(POPOVER_NAME, [
23731
+ var [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [
24266
23732
  createPopperScope
24267
23733
  ]);
24268
23734
  var usePopperScope = createPopperScope();
@@ -30363,7 +29829,7 @@ var frRawCountries = [
30363
29829
  id: 704,
30364
29830
  alpha2: "vn",
30365
29831
  alpha3: "vnm",
30366
- name: "Vietnam"
29832
+ name: "Viêt Nam"
30367
29833
  },
30368
29834
  {
30369
29835
  id: 887,
@@ -36475,10 +35941,10 @@ var hasRequiredReactStripe_umd;
36475
35941
  function requireReactStripe_umd () {
36476
35942
  if (hasRequiredReactStripe_umd) return reactStripe_umd$1.exports;
36477
35943
  hasRequiredReactStripe_umd = 1;
36478
- (function (module, exports$1) {
35944
+ (function (module, exports) {
36479
35945
  (function (global, factory) {
36480
- factory(exports$1, React) ;
36481
- })(reactStripe_umd, (function (exports$1, React) {
35946
+ factory(exports, React) ;
35947
+ })(reactStripe_umd, (function (exports, React) {
36482
35948
  function ownKeys(object, enumerableOnly) {
36483
35949
  var keys = Object.keys(object);
36484
35950
 
@@ -36913,12 +36379,12 @@ function requireReactStripe_umd () {
36913
36379
 
36914
36380
  stripe._registerWrapper({
36915
36381
  name: 'react-stripe-js',
36916
- version: "3.10.0"
36382
+ version: "3.7.0"
36917
36383
  });
36918
36384
 
36919
36385
  stripe.registerAppInfo({
36920
36386
  name: 'react-stripe-js',
36921
- version: "3.10.0",
36387
+ version: "3.7.0",
36922
36388
  url: 'https://stripe.com/docs/stripe-js/react'
36923
36389
  });
36924
36390
  };
@@ -36940,7 +36406,7 @@ function requireReactStripe_umd () {
36940
36406
  * The `loadStripe` function will asynchronously load the Stripe.js script and initialize a `Stripe` object.
36941
36407
  * Pass the returned `Promise` to `Elements`.
36942
36408
  *
36943
- * @docs https://docs.stripe.com/sdks/stripejs-react?ui=elements#elements-provider
36409
+ * @docs https://stripe.com/docs/stripe-js/react#elements-provider
36944
36410
  */
36945
36411
 
36946
36412
  var Elements = function Elements(_ref) {
@@ -37163,30 +36629,20 @@ function requireReactStripe_umd () {
37163
36629
  var prevOptions = usePrevious(options);
37164
36630
  var prevCheckoutSdk = usePrevious(ctx.checkoutSdk);
37165
36631
  React.useEffect(function () {
37166
- var _prevOptions$elements, _options$elementsOpti, _prevOptions$elements2, _options$elementsOpti2;
36632
+ var _prevOptions$elements, _options$elementsOpti;
37167
36633
 
37168
36634
  // Ignore changes while checkout sdk is not initialized.
37169
36635
  if (!ctx.checkoutSdk) {
37170
36636
  return;
37171
36637
  }
37172
36638
 
37173
- var hasSdkLoaded = Boolean(!prevCheckoutSdk && ctx.checkoutSdk); // Handle appearance changes
37174
-
37175
36639
  var previousAppearance = prevOptions === null || prevOptions === void 0 ? void 0 : (_prevOptions$elements = prevOptions.elementsOptions) === null || _prevOptions$elements === void 0 ? void 0 : _prevOptions$elements.appearance;
37176
36640
  var currentAppearance = options === null || options === void 0 ? void 0 : (_options$elementsOpti = options.elementsOptions) === null || _options$elementsOpti === void 0 ? void 0 : _options$elementsOpti.appearance;
37177
36641
  var hasAppearanceChanged = !isEqual(currentAppearance, previousAppearance);
36642
+ var hasSdkLoaded = !prevCheckoutSdk && ctx.checkoutSdk;
37178
36643
 
37179
36644
  if (currentAppearance && (hasAppearanceChanged || hasSdkLoaded)) {
37180
36645
  ctx.checkoutSdk.changeAppearance(currentAppearance);
37181
- } // Handle fonts changes
37182
-
37183
-
37184
- var previousFonts = prevOptions === null || prevOptions === void 0 ? void 0 : (_prevOptions$elements2 = prevOptions.elementsOptions) === null || _prevOptions$elements2 === void 0 ? void 0 : _prevOptions$elements2.fonts;
37185
- var currentFonts = options === null || options === void 0 ? void 0 : (_options$elementsOpti2 = options.elementsOptions) === null || _options$elementsOpti2 === void 0 ? void 0 : _options$elementsOpti2.fonts;
37186
- var hasFontsChanged = !isEqual(previousFonts, currentFonts);
37187
-
37188
- if (currentFonts && (hasFontsChanged || hasSdkLoaded)) {
37189
- ctx.checkoutSdk.loadFonts(currentFonts);
37190
36646
  }
37191
36647
  }, [options, prevOptions, ctx.checkoutSdk, prevCheckoutSdk]); // Attach react-stripe-js version to stripe.js instance
37192
36648
 
@@ -37270,9 +36726,7 @@ function requireReactStripe_umd () {
37270
36726
  onConfirm = _ref.onConfirm,
37271
36727
  onCancel = _ref.onCancel,
37272
36728
  onShippingAddressChange = _ref.onShippingAddressChange,
37273
- onShippingRateChange = _ref.onShippingRateChange,
37274
- onSavedPaymentMethodRemove = _ref.onSavedPaymentMethodRemove,
37275
- onSavedPaymentMethodUpdate = _ref.onSavedPaymentMethodUpdate;
36729
+ onShippingRateChange = _ref.onShippingRateChange;
37276
36730
  var ctx = useElementsOrCheckoutSdkContextWithUseCase("mounts <".concat(displayName, ">"));
37277
36731
  var elements = 'elements' in ctx ? ctx.elements : null;
37278
36732
  var checkoutSdk = 'checkoutSdk' in ctx ? ctx.checkoutSdk : null;
@@ -37298,8 +36752,6 @@ function requireReactStripe_umd () {
37298
36752
  useAttachEvent(element, 'cancel', onCancel);
37299
36753
  useAttachEvent(element, 'shippingaddresschange', onShippingAddressChange);
37300
36754
  useAttachEvent(element, 'shippingratechange', onShippingRateChange);
37301
- useAttachEvent(element, 'savedpaymentmethodremove', onSavedPaymentMethodRemove);
37302
- useAttachEvent(element, 'savedpaymentmethodupdate', onSavedPaymentMethodUpdate);
37303
36755
  useAttachEvent(element, 'change', onChange);
37304
36756
  var readyCallback;
37305
36757
 
@@ -37352,10 +36804,6 @@ function requireReactStripe_umd () {
37352
36804
  newElement = checkoutSdk.createCurrencySelectorElement();
37353
36805
  break;
37354
36806
 
37355
- case 'taxId':
37356
- newElement = checkoutSdk.createTaxIdElement(options);
37357
- break;
37358
-
37359
36807
  default:
37360
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 />."));
37361
36809
  }
@@ -37431,8 +36879,6 @@ function requireReactStripe_umd () {
37431
36879
  onCancel: PropTypes.func,
37432
36880
  onShippingAddressChange: PropTypes.func,
37433
36881
  onShippingRateChange: PropTypes.func,
37434
- onSavedPaymentMethodRemove: PropTypes.func,
37435
- onSavedPaymentMethodUpdate: PropTypes.func,
37436
36882
  options: PropTypes.object
37437
36883
  };
37438
36884
  Element.displayName = displayName;
@@ -37740,42 +37186,35 @@ function requireReactStripe_umd () {
37740
37186
  */
37741
37187
 
37742
37188
  var AfterpayClearpayMessageElement = createElementComponent('afterpayClearpayMessage', isServer);
37743
- /**
37744
- * Requires beta access:
37745
- * Contact [Stripe support](https://support.stripe.com/) for more information.
37746
- */
37747
37189
 
37748
- var TaxIdElement = createElementComponent('taxId', isServer);
37749
-
37750
- exports$1.AddressElement = AddressElement;
37751
- exports$1.AffirmMessageElement = AffirmMessageElement;
37752
- exports$1.AfterpayClearpayMessageElement = AfterpayClearpayMessageElement;
37753
- exports$1.AuBankAccountElement = AuBankAccountElement;
37754
- exports$1.CardCvcElement = CardCvcElement;
37755
- exports$1.CardElement = CardElement;
37756
- exports$1.CardExpiryElement = CardExpiryElement;
37757
- exports$1.CardNumberElement = CardNumberElement;
37758
- exports$1.CheckoutProvider = CheckoutProvider;
37759
- exports$1.CurrencySelectorElement = CurrencySelectorElement;
37760
- exports$1.Elements = Elements;
37761
- exports$1.ElementsConsumer = ElementsConsumer;
37762
- exports$1.EmbeddedCheckout = EmbeddedCheckout;
37763
- exports$1.EmbeddedCheckoutProvider = EmbeddedCheckoutProvider;
37764
- exports$1.EpsBankElement = EpsBankElement;
37765
- exports$1.ExpressCheckoutElement = ExpressCheckoutElement;
37766
- exports$1.FpxBankElement = FpxBankElement;
37767
- exports$1.IbanElement = IbanElement;
37768
- exports$1.IdealBankElement = IdealBankElement;
37769
- exports$1.LinkAuthenticationElement = LinkAuthenticationElement;
37770
- exports$1.P24BankElement = P24BankElement;
37771
- exports$1.PaymentElement = PaymentElement;
37772
- exports$1.PaymentMethodMessagingElement = PaymentMethodMessagingElement;
37773
- exports$1.PaymentRequestButtonElement = PaymentRequestButtonElement;
37774
- exports$1.ShippingAddressElement = ShippingAddressElement;
37775
- exports$1.TaxIdElement = TaxIdElement;
37776
- exports$1.useCheckout = useCheckout;
37777
- exports$1.useElements = useElements;
37778
- 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;
37779
37218
 
37780
37219
  }));
37781
37220
  } (reactStripe_umd$1, reactStripe_umd$1.exports));
@@ -37976,13 +37415,19 @@ var loadStripe = function loadStripe() {
37976
37415
  const useCheckout = create((set) => ({
37977
37416
  isSubmitting: false,
37978
37417
  setIsSubmitting: (isSubmitting) => set({ isSubmitting }),
37418
+ paymentMethod: null,
37419
+ setPaymentMethod: (paymentMethod) => set({ paymentMethod }),
37979
37420
  }));
37980
37421
 
37981
37422
  const CheckoutForm$1 = ({ onSuccess, onError, children, setSubmitting, }) => {
37982
37423
  const stripe = reactStripe_umdExports.useStripe();
37983
37424
  const elements = reactStripe_umdExports.useElements();
37984
- const { setIsSubmitting } = useCheckout();
37425
+ const { setIsSubmitting, setPaymentMethod } = useCheckout();
37985
37426
  const [errorMessage, setErrorMessage] = React.useState(undefined);
37427
+ const handlePaymentMethodChange = (event) => {
37428
+ var _a, _b;
37429
+ setPaymentMethod((_b = (_a = event === null || event === void 0 ? void 0 : event.value) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : null);
37430
+ };
37986
37431
  const handleSubmit = (event) => __awaiter(void 0, void 0, void 0, function* () {
37987
37432
  event.preventDefault();
37988
37433
  if (!stripe || !elements) {
@@ -38007,7 +37452,7 @@ const CheckoutForm$1 = ({ onSuccess, onError, children, setSubmitting, }) => {
38007
37452
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
38008
37453
  }
38009
37454
  });
38010
- return (jsxRuntime.jsxs("form", { className: "w-full pb-40 sm:pb-0", onSubmit: handleSubmit, children: [jsxRuntime.jsx(reactStripe_umdExports.PaymentElement, {}), errorMessage && (jsxRuntime.jsx("p", { className: "text-destructive -mb-2 mt-2 text-sm", children: errorMessage })), children] }));
37455
+ return (jsxRuntime.jsxs("form", { className: "w-full pb-40 sm:pb-0", onSubmit: handleSubmit, children: [jsxRuntime.jsx(reactStripe_umdExports.PaymentElement, { onChange: handlePaymentMethodChange }), errorMessage && (jsxRuntime.jsx("p", { className: "text-destructive -mb-2 mt-2 text-sm", children: errorMessage })), children] }));
38011
37456
  };
38012
37457
  var CheckoutForm$2 = React.memo(CheckoutForm$1);
38013
37458
 
@@ -42680,10 +42125,30 @@ const convertCheckoutAppearanceToStripeAppearance = (appearance, fonts) => {
42680
42125
  return newAppearance;
42681
42126
  };
42682
42127
 
42683
- function PaymentForm({ paymentSecret, onSuccess, onError, onBack, onDoubleBack, contactEmail, shippingFormData, address, checkoutAppearance, fonts, locale, publicKey, paymentComponentKey, }) {
42128
+ const Icons = {
42129
+ apple: (props) => (jsxRuntime.jsxs("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, props, { role: "img", fill: "none", children: [jsxRuntime.jsxs("g", { clipPath: "url(#clip0_4418_8987)", children: [jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M19.1001 19.16C19.6901 18.26 19.9101 17.8 20.3601 16.79C17.0401 15.53 16.5101 10.8 19.7901 8.98999C18.7901 7.72999 17.3801 7 16.0501 7C15.0901 7 14.4301 7.25001 13.8401 7.48001C13.3401 7.67001 12.8901 7.84 12.3301 7.84C11.7301 7.84 11.2001 7.65001 10.6401 7.45001C10.0301 7.23001 9.39006 7 8.59006 7C7.10006 7 5.51007 7.91 4.50007 9.47C3.08007 11.67 3.33007 15.79 5.62007 19.31C6.44007 20.57 7.54007 21.98 8.97007 22C9.57007 22.01 9.96007 21.83 10.3901 21.64C10.8801 21.42 11.4101 21.18 12.3401 21.18C13.2701 21.17 13.7901 21.42 14.2801 21.64C14.7001 21.83 15.0801 22.01 15.6701 22C17.1201 21.98 18.2801 20.42 19.1001 19.16Z", fill: "currentColor" }), jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M15.8399 2C15.9999 3.1 15.5499 4.19001 14.9599 4.95001C14.3299 5.77001 13.2299 6.41 12.1699 6.37C11.9799 5.31 12.4699 4.21999 13.0699 3.48999C13.7399 2.68999 14.8699 2.07 15.8399 2Z", fill: "currentColor" })] }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_4418_8987", children: jsxRuntime.jsx("rect", { width: "24", height: "24", fill: "white" }) }) })] }))),
42130
+ google: (props) => (jsxRuntime.jsxs("svg", Object.assign({ viewBox: "-3 0 262 262" }, props, { role: "img", fill: "none", children: [jsxRuntime.jsx("path", { d: "M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622 38.755 30.023 2.685.268c24.659-22.774 38.875-56.282 38.875-96.027", fill: "#4285F4" }), jsxRuntime.jsx("path", { d: "M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055-34.523 0-63.824-22.773-74.269-54.25l-1.531.13-40.298 31.187-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1", fill: "#34A853" }), jsxRuntime.jsx("path", { d: "M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82 0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602l42.356-32.782", fill: "#FBBC05" }), jsxRuntime.jsx("path", { d: "M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0 79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251", fill: "#EB4335" })] }))),
42131
+ paypal: (props) => (jsxRuntime.jsx("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "584.798", height: "720", viewBox: "0 0 154.728 190.5" }, props, { role: "img", fill: "none", children: jsxRuntime.jsxs("g", { transform: "translate(898.192 276.071)", children: [jsxRuntime.jsx("path", { clipPath: "none", d: "M-837.663-237.968a5.49 5.49 0 0 0-5.423 4.633l-9.013 57.15-8.281 52.514-.005.044.01-.044 8.281-52.514c.421-2.669 2.719-4.633 5.42-4.633h26.404c26.573 0 49.127-19.387 53.246-45.658.314-1.996.482-3.973.52-5.924v-.003h-.003c-6.753-3.543-14.683-5.565-23.372-5.565z", fill: "#001c64" }), jsxRuntime.jsx("path", { clipPath: "none", d: "M-766.506-232.402c-.037 1.951-.207 3.93-.52 5.926-4.119 26.271-26.673 45.658-53.246 45.658h-26.404c-2.701 0-4.999 1.964-5.42 4.633l-8.281 52.514-5.197 32.947a4.46 4.46 0 0 0 4.405 5.153h28.66a5.49 5.49 0 0 0 5.423-4.633l7.55-47.881c.423-2.669 2.722-4.636 5.423-4.636h16.876c26.573 0 49.124-19.386 53.243-45.655 2.924-18.649-6.46-35.614-22.511-44.026z", fill: "#0070e0" }), jsxRuntime.jsx("path", { clipPath: "none", d: "M-870.225-276.071a5.49 5.49 0 0 0-5.423 4.636l-22.489 142.608a4.46 4.46 0 0 0 4.405 5.156h33.351l8.281-52.514 9.013-57.15a5.49 5.49 0 0 1 5.423-4.633h47.782c8.691 0 16.621 2.025 23.375 5.563.46-23.917-19.275-43.666-46.412-43.666z", fill: "#003087" })] }) }))),
42132
+ };
42133
+
42134
+ function PaymentForm({ paymentSecret, onSuccess, onError, onBack, onDoubleBack, currency, contactEmail, shippingFormData, address, checkoutAppearance, fonts, locale, publicKey, paymentComponentKey, }) {
42684
42135
  const [isSubmitting, setIsSubmitting] = React.useState(false);
42685
42136
  const { t } = useTranslation();
42686
- return (jsxRuntime.jsxs("div", { className: "space-y-6", children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("h2", { className: "mb-2", children: t("CheckoutEmbed.Payment.title") }), jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: t("CheckoutEmbed.Payment.description") })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxRuntime.jsxs("p", { children: [jsxRuntime.jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.contact") }), " ", jsxRuntime.jsx("span", { className: "text-muted-foreground", children: contactEmail })] }), jsxRuntime.jsx(Button, { variant: "link", size: "link", onClick: onDoubleBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxRuntime.jsxs("p", { children: [jsxRuntime.jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.address") }), " ", jsxRuntime.jsx("span", { className: "text-muted-foreground", children: address })] }), jsxRuntime.jsx(Button, { variant: "link", size: "link", onClick: onDoubleBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxRuntime.jsxs("div", { className: "flex gap-1", children: [jsxRuntime.jsx("p", { className: "font-medium", children: t("CheckoutEmbed.Shipping.shipping") }), " ", jsxRuntime.jsx("div", { className: "text-muted-foreground flex flex-col gap-1", children: Object.entries(shippingFormData).map(([id, shipmentFormData]) => (jsxRuntime.jsxs("p", { children: [shipmentFormData.displayName, " \u00B7", " ", shipmentFormData.priceInCents] }, id))) })] }), jsxRuntime.jsx(Button, { variant: "link", size: "link", onClick: onBack, children: t("CheckoutEmbed.Shipping.change") })] })] }), jsxRuntime.jsx("div", { className: "mt-8", children: paymentSecret && (jsxRuntime.jsx(PaymentElement$1, { fonts: fonts, checkoutAppearance: convertCheckoutAppearanceToStripeAppearance(checkoutAppearance, fonts), locale: locale, paymentSecret: paymentSecret, onSuccess: onSuccess, onError: onError, setSubmitting: setIsSubmitting, publicKey: publicKey, children: jsxRuntime.jsx("div", { className: "fixed bottom-0 left-0 right-0 z-50 mt-8 px-4 sm:static sm:px-0", children: jsxRuntime.jsxs("div", { className: "bg-background flex flex-col-reverse items-center justify-between gap-2 pb-4 sm:flex-row sm:bg-transparent sm:pb-0", children: [jsxRuntime.jsxs(Button, { className: "w-full sm:w-fit", type: "button", variant: "ghost", onClick: onBack, children: [jsxRuntime.jsx(ChevronLeft, {}), t("CheckoutEmbed.Payment.back")] }), jsxRuntime.jsx(SubmitButton, { className: "w-full max-sm:h-[52px] sm:w-fit", isValid: true, isSubmitting: isSubmitting, children: t("CheckoutEmbed.Payment.button") })] }) }) }, paymentComponentKey)) })] }));
42137
+ const { paymentMethod } = useCheckout();
42138
+ const submitButtonTextKey = paymentMethod === "apple_pay"
42139
+ ? "apple_pay"
42140
+ : paymentMethod === "card"
42141
+ ? "default"
42142
+ : paymentMethod === "paypal"
42143
+ ? "paypal"
42144
+ : paymentMethod === "google_pay"
42145
+ ? "google_pay"
42146
+ : "default";
42147
+ const submitButtonText = t(`CheckoutEmbed.Payment.button.${submitButtonTextKey}`);
42148
+ const renderButtonIcon = () => {
42149
+ return submitButtonTextKey === "apple_pay" ? (jsxRuntime.jsx(Icons.apple, { className: "size-5 max-sm:size-[22px]" })) : submitButtonTextKey === "google_pay" ? (jsxRuntime.jsx(Icons.google, { className: "ml-1 size-4 max-sm:size-5" })) : submitButtonTextKey === "paypal" ? (jsxRuntime.jsx(Icons.paypal, { className: "ml-1 size-4 max-sm:size-5" })) : null;
42150
+ };
42151
+ return (jsxRuntime.jsxs("div", { className: "space-y-6", children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("h2", { className: "mb-2", children: t("CheckoutEmbed.Payment.title") }), jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: t("CheckoutEmbed.Payment.description") })] }), jsxRuntime.jsxs("div", { className: "space-y-2", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxRuntime.jsxs("p", { children: [jsxRuntime.jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.contact") }), " ", jsxRuntime.jsx("span", { className: "text-muted-foreground", children: contactEmail })] }), jsxRuntime.jsx(Button, { variant: "link", size: "link", onClick: onDoubleBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxRuntime.jsxs("p", { children: [jsxRuntime.jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.address") }), " ", jsxRuntime.jsx("span", { className: "text-muted-foreground", children: address })] }), jsxRuntime.jsx(Button, { variant: "link", size: "link", onClick: onDoubleBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxRuntime.jsxs("div", { className: "flex gap-1", children: [jsxRuntime.jsx("p", { className: "font-medium", children: t("CheckoutEmbed.Shipping.shipping") }), " ", jsxRuntime.jsx("div", { className: "text-muted-foreground flex flex-col gap-1", children: Object.entries(shippingFormData).map(([id, shipmentFormData]) => (jsxRuntime.jsxs("p", { children: [shipmentFormData.displayName, " \u00B7", " ", formatPrice(shipmentFormData.priceInCents, currency)] }, id))) })] }), jsxRuntime.jsx(Button, { variant: "link", size: "link", onClick: onBack, children: t("CheckoutEmbed.Shipping.change") })] })] }), jsxRuntime.jsx("div", { className: "mt-8", children: paymentSecret && (jsxRuntime.jsx(PaymentElement$1, { fonts: fonts, checkoutAppearance: convertCheckoutAppearanceToStripeAppearance(checkoutAppearance, fonts), locale: locale, paymentSecret: paymentSecret, onSuccess: onSuccess, onError: onError, setSubmitting: setIsSubmitting, publicKey: publicKey, children: jsxRuntime.jsx("div", { className: "fixed bottom-0 left-0 right-0 z-50 mt-8 px-4 sm:static sm:px-0", children: jsxRuntime.jsxs("div", { className: "bg-background flex flex-col-reverse items-center justify-between gap-2 pb-4 sm:flex-row sm:bg-transparent sm:pb-0", children: [jsxRuntime.jsxs(Button, { className: "w-full max-sm:hidden sm:w-fit", type: "button", variant: "ghost", onClick: onBack, children: [jsxRuntime.jsx(ChevronLeft, {}), t("CheckoutEmbed.Payment.back")] }), jsxRuntime.jsxs(SubmitButton, { className: "w-full max-sm:h-[52px] max-sm:text-base sm:w-fit", isValid: true, isSubmitting: isSubmitting, children: [submitButtonText, renderButtonIcon()] })] }) }) }, paymentComponentKey)) })] }));
42687
42152
  }
42688
42153
 
42689
42154
  function Skeleton(_a) {
@@ -42978,6 +42443,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
42978
42443
  pickupPointId: shipmentFormData.pickupPointId,
42979
42444
  },
42980
42445
  }));
42446
+ console.log("UPDATING CHECKOUT WITH SHIPMENTS: ", shipments);
42981
42447
  yield storeClient.updateCheckout(clientSecret, checkoutId, {
42982
42448
  shipments,
42983
42449
  });
@@ -42999,7 +42465,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
42999
42465
  };
43000
42466
  const renderStep = () => {
43001
42467
  if (step === "payment" && formData.customer && formData.shipping) {
43002
- return (jsxRuntime.jsx(PaymentForm, { paymentComponentKey: paymentComponentKey, locale: locale, fonts: fonts, checkoutAppearance: checkoutAppearance, paymentSecret: paymentSecret, onSuccess: onSuccess, onError: onError, onBack: handleBack, onDoubleBack: handleDoubleBack, contactEmail: formData.customer.email, address: formatAddress(formData.customer.address), shippingFormData: formData.shipping, publicKey: publicKey }));
42468
+ return (jsxRuntime.jsx(PaymentForm, { paymentComponentKey: paymentComponentKey, locale: locale, fonts: fonts, checkoutAppearance: checkoutAppearance, paymentSecret: paymentSecret, onSuccess: onSuccess, onError: onError, onBack: handleBack, onDoubleBack: handleDoubleBack, contactEmail: formData.customer.email, address: formatAddress(formData.customer.address), shippingFormData: formData.shipping, publicKey: publicKey, currency: currency }));
43003
42469
  }
43004
42470
  if (step === "shipping" && formData.customer) {
43005
42471
  return (jsxRuntime.jsx(ShipmentsShippingMethodForm, { setFormData: setFormData, formData: formData, shippingRates: shippingRates, initialData: formData.shipping, onSubmit: handleShippingSubmit, onBack: handleBack, contactEmail: formData.customer.email, shippingAddress: formatAddress(formData.customer.address), currency: currency, exchangeRate: exchangeRate, locale: locale, countryCode: formData.customer.address.countryCode, shipments: shipments }));