@trii/components 2.0.27 → 2.0.29

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 (30) hide show
  1. package/dist/cjs/index.js +2773 -100
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/EditContactModal/EditContactModal.d.ts +3 -2
  4. package/dist/cjs/types/components/EditContactModal/components/Header/Header.d.ts +13 -2
  5. package/dist/cjs/types/components/EditContactModal/components/Header/components/AvatarWithActions/AvatarWithActions.d.ts +12 -0
  6. package/dist/cjs/types/components/EditContactModal/components/Header/components/Tags/Tags.d.ts +8 -0
  7. package/dist/cjs/types/components/EditContactModal/components/Header/components/Tags/index.d.ts +1 -0
  8. package/dist/cjs/types/components/EditContactModal/components/Header/components/index.d.ts +1 -0
  9. package/dist/cjs/types/components/EditContactModal/components/TagsEditor/TagsEditor.d.ts +12 -0
  10. package/dist/cjs/types/components/EditContactModal/hooks/useEditContactModalController.d.ts +9 -2
  11. package/dist/cjs/types/components/EditContactModal/hooks/useImage.d.ts +27 -0
  12. package/dist/cjs/types/components/EditContactModal/services/api.d.ts +46 -3
  13. package/dist/cjs/types/components/EditContactModal/services/http.d.ts +8 -0
  14. package/dist/cjs/types/components/EditContactModal/services/urls.d.ts +6 -0
  15. package/dist/esm/index.js +2775 -102
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/types/components/EditContactModal/EditContactModal.d.ts +3 -2
  18. package/dist/esm/types/components/EditContactModal/components/Header/Header.d.ts +13 -2
  19. package/dist/esm/types/components/EditContactModal/components/Header/components/AvatarWithActions/AvatarWithActions.d.ts +12 -0
  20. package/dist/esm/types/components/EditContactModal/components/Header/components/Tags/Tags.d.ts +8 -0
  21. package/dist/esm/types/components/EditContactModal/components/Header/components/Tags/index.d.ts +1 -0
  22. package/dist/esm/types/components/EditContactModal/components/Header/components/index.d.ts +1 -0
  23. package/dist/esm/types/components/EditContactModal/components/TagsEditor/TagsEditor.d.ts +12 -0
  24. package/dist/esm/types/components/EditContactModal/hooks/useEditContactModalController.d.ts +9 -2
  25. package/dist/esm/types/components/EditContactModal/hooks/useImage.d.ts +27 -0
  26. package/dist/esm/types/components/EditContactModal/services/api.d.ts +46 -3
  27. package/dist/esm/types/components/EditContactModal/services/http.d.ts +8 -0
  28. package/dist/esm/types/components/EditContactModal/services/urls.d.ts +6 -0
  29. package/dist/index.d.ts +3 -2
  30. package/package.json +2 -2
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import React__default, { useCallback, useEffect, useRef, useState, useMemo } from 'react';
3
- import { styled as styled$3, Box, IconButton, Avatar, Typography, CircularProgress, Tooltip, Chip, Popper, ClickAwayListener, CardContent, Modal, Backdrop, Fade } from '@mui/material';
2
+ import React__default, { useCallback, useEffect, useState, useMemo, useRef, Children, isValidElement, cloneElement } from 'react';
3
+ import { styled as styled$3, Box, IconButton, Avatar, Typography, CircularProgress as CircularProgress$2, Tooltip, Chip, Popper, ClickAwayListener, CardContent, Stack, Popover, Autocomplete, TextField, Modal, Backdrop, Fade, Slide } from '@mui/material';
4
4
  import { withEmotionCache, ThemeContext, CacheProvider, Global, css, keyframes } from '@emotion/react';
5
5
 
6
6
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -1407,6 +1407,15 @@ if (process.env.NODE_ENV === 'production') {
1407
1407
 
1408
1408
  var jsxRuntimeExports = jsxRuntime.exports;
1409
1409
 
1410
+ function chainPropTypes(propType1, propType2) {
1411
+ if (process.env.NODE_ENV === 'production') {
1412
+ return () => null;
1413
+ }
1414
+ return function validate(...args) {
1415
+ return propType1(...args) || propType2(...args);
1416
+ };
1417
+ }
1418
+
1410
1419
  function _extends$1() {
1411
1420
  _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
1412
1421
  for (var i = 1; i < arguments.length; i++) {
@@ -2652,6 +2661,45 @@ if (process.env.NODE_ENV !== 'production') {
2652
2661
  var propTypesExports = propTypes.exports;
2653
2662
  var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
2654
2663
 
2664
+ function isClassComponent(elementType) {
2665
+ // elementType.prototype?.isReactComponent
2666
+ const {
2667
+ prototype = {}
2668
+ } = elementType;
2669
+ return Boolean(prototype.isReactComponent);
2670
+ }
2671
+ function elementTypeAcceptingRef(props, propName, componentName, location, propFullName) {
2672
+ const propValue = props[propName];
2673
+ const safePropName = propFullName || propName;
2674
+ if (propValue == null ||
2675
+ // When server-side rendering React doesn't warn either.
2676
+ // This is not an accurate check for SSR.
2677
+ // This is only in place for emotion compat.
2678
+ // TODO: Revisit once https://github.com/facebook/react/issues/20047 is resolved.
2679
+ typeof window === 'undefined') {
2680
+ return null;
2681
+ }
2682
+ let warningHint;
2683
+
2684
+ /**
2685
+ * Blacklisting instead of whitelisting
2686
+ *
2687
+ * Blacklisting will miss some components, such as React.Fragment. Those will at least
2688
+ * trigger a warning in React.
2689
+ * We can't whitelist because there is no safe way to detect React.forwardRef
2690
+ * or class components. "Safe" means there's no public API.
2691
+ *
2692
+ */
2693
+ if (typeof propValue === 'function' && !isClassComponent(propValue)) {
2694
+ warningHint = 'Did you accidentally provide a plain function component instead?';
2695
+ }
2696
+ if (warningHint !== undefined) {
2697
+ return new Error(`Invalid ${location} \`${safePropName}\` supplied to \`${componentName}\`. ` + `Expected an element type that can hold a ref. ${warningHint} ` + 'For more information see https://mui.com/r/caveat-with-refs-guide');
2698
+ }
2699
+ return null;
2700
+ }
2701
+ var elementTypeAcceptingRef$1 = chainPropTypes(PropTypes.elementType, elementTypeAcceptingRef);
2702
+
2655
2703
  /**
2656
2704
  * WARNING: Don't import this directly.
2657
2705
  * Use `MuiError` from `@mui/internal-babel-macros/MuiError.macro` instead.
@@ -3018,6 +3066,9 @@ var getDisplayName = /*#__PURE__*/Object.freeze({
3018
3066
  getFunctionName: getFunctionName
3019
3067
  });
3020
3068
 
3069
+ const refType = PropTypes.oneOfType([PropTypes.func, PropTypes.object]);
3070
+ var refType$1 = refType;
3071
+
3021
3072
  // It should to be noted that this function isn't equivalent to `text-transform: capitalize`.
3022
3073
  //
3023
3074
  // A strict capitalization should uppercase the first letter of each word in the sentence.
@@ -3270,6 +3321,34 @@ function useForkRef(...refs) {
3270
3321
  }, refs);
3271
3322
  }
3272
3323
 
3324
+ const UNINITIALIZED = {};
3325
+
3326
+ /**
3327
+ * A React.useRef() that is initialized lazily with a function. Note that it accepts an optional
3328
+ * initialization argument, so the initialization function doesn't need to be an inline closure.
3329
+ *
3330
+ * @usage
3331
+ * const ref = useLazyRef(sortColumns, columns)
3332
+ */
3333
+ function useLazyRef(init, initArg) {
3334
+ const ref = React.useRef(UNINITIALIZED);
3335
+ if (ref.current === UNINITIALIZED) {
3336
+ ref.current = init(initArg);
3337
+ }
3338
+ return ref;
3339
+ }
3340
+
3341
+ const EMPTY = [];
3342
+
3343
+ /**
3344
+ * A React.useEffect equivalent that runs once, when the component is mounted.
3345
+ */
3346
+ function useOnMount(fn) {
3347
+ /* eslint-disable react-hooks/exhaustive-deps */
3348
+ React.useEffect(fn, EMPTY);
3349
+ /* eslint-enable react-hooks/exhaustive-deps */
3350
+ }
3351
+
3273
3352
  class Timeout {
3274
3353
  constructor() {
3275
3354
  this.currentId = null;
@@ -3297,6 +3376,11 @@ class Timeout {
3297
3376
  }, delay);
3298
3377
  }
3299
3378
  }
3379
+ function useTimeout() {
3380
+ const timeout = useLazyRef(Timeout.create).current;
3381
+ useOnMount(timeout.disposeEffect);
3382
+ return timeout;
3383
+ }
3300
3384
 
3301
3385
  let hadKeyboardEvent = true;
3302
3386
  let hadFocusVisibleRecently = false;
@@ -5706,7 +5790,7 @@ var styledEngine = /*#__PURE__*/Object.freeze({
5706
5790
  keyframes: keyframes
5707
5791
  });
5708
5792
 
5709
- var require$$3 = /*@__PURE__*/getAugmentedNamespace(styledEngine);
5793
+ var require$$1$1 = /*@__PURE__*/getAugmentedNamespace(styledEngine);
5710
5794
 
5711
5795
  var require$$4 = /*@__PURE__*/getAugmentedNamespace(deepmerge);
5712
5796
 
@@ -5714,7 +5798,7 @@ var require$$5 = /*@__PURE__*/getAugmentedNamespace(capitalize);
5714
5798
 
5715
5799
  var require$$6 = /*@__PURE__*/getAugmentedNamespace(getDisplayName);
5716
5800
 
5717
- const _excluded$8 = ["values", "unit", "step"];
5801
+ const _excluded$d = ["values", "unit", "step"];
5718
5802
  const sortBreakpointsValues = values => {
5719
5803
  const breakpointsAsArray = Object.keys(values).map(key => ({
5720
5804
  key,
@@ -5748,7 +5832,7 @@ function createBreakpoints(breakpoints) {
5748
5832
  unit = 'px',
5749
5833
  step = 5
5750
5834
  } = breakpoints,
5751
- other = _objectWithoutPropertiesLoose(breakpoints, _excluded$8);
5835
+ other = _objectWithoutPropertiesLoose(breakpoints, _excluded$d);
5752
5836
  const sortedValues = sortBreakpointsValues(values);
5753
5837
  const keys = Object.keys(sortedValues);
5754
5838
  function up(key) {
@@ -5811,7 +5895,7 @@ function merge(acc, item) {
5811
5895
 
5812
5896
  // The breakpoint **start** at this value.
5813
5897
  // For instance with the first breakpoint xs: [xs, sm[.
5814
- const values = {
5898
+ const values$1 = {
5815
5899
  xs: 0,
5816
5900
  // phone
5817
5901
  sm: 600,
@@ -5826,7 +5910,7 @@ const defaultBreakpoints = {
5826
5910
  // Sorted ASC by size. That's important.
5827
5911
  // It can't be configured as it's used statically for propTypes.
5828
5912
  keys: ['xs', 'sm', 'md', 'lg', 'xl'],
5829
- up: key => `@media (min-width:${values[key]}px)`
5913
+ up: key => `@media (min-width:${values$1[key]}px)`
5830
5914
  };
5831
5915
  function handleBreakpoints(props, propValue, styleFromPropValue) {
5832
5916
  const theme = props.theme || {};
@@ -5841,7 +5925,7 @@ function handleBreakpoints(props, propValue, styleFromPropValue) {
5841
5925
  const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
5842
5926
  return Object.keys(propValue).reduce((acc, breakpoint) => {
5843
5927
  // key is breakpoint
5844
- if (Object.keys(themeBreakpoints.values || values).indexOf(breakpoint) !== -1) {
5928
+ if (Object.keys(themeBreakpoints.values || values$1).indexOf(breakpoint) !== -1) {
5845
5929
  const mediaKey = themeBreakpoints.up(breakpoint);
5846
5930
  acc[mediaKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
5847
5931
  } else {
@@ -6305,7 +6389,7 @@ const maxWidth = props => {
6305
6389
  if (props.maxWidth !== undefined && props.maxWidth !== null) {
6306
6390
  const styleFromPropValue = propValue => {
6307
6391
  var _props$theme, _props$theme2;
6308
- const breakpoint = ((_props$theme = props.theme) == null || (_props$theme = _props$theme.breakpoints) == null || (_props$theme = _props$theme.values) == null ? void 0 : _props$theme[propValue]) || values[propValue];
6392
+ const breakpoint = ((_props$theme = props.theme) == null || (_props$theme = _props$theme.breakpoints) == null || (_props$theme = _props$theme.values) == null ? void 0 : _props$theme[propValue]) || values$1[propValue];
6309
6393
  if (!breakpoint) {
6310
6394
  return {
6311
6395
  maxWidth: sizingTransform(propValue)
@@ -6848,7 +6932,7 @@ function applyStyles(key, styles) {
6848
6932
  return {};
6849
6933
  }
6850
6934
 
6851
- const _excluded$7 = ["breakpoints", "palette", "spacing", "shape"];
6935
+ const _excluded$c = ["breakpoints", "palette", "spacing", "shape"];
6852
6936
  function createTheme$2(options = {}, ...args) {
6853
6937
  const {
6854
6938
  breakpoints: breakpointsInput = {},
@@ -6856,7 +6940,7 @@ function createTheme$2(options = {}, ...args) {
6856
6940
  spacing: spacingInput,
6857
6941
  shape: shapeInput = {}
6858
6942
  } = options,
6859
- other = _objectWithoutPropertiesLoose(options, _excluded$7);
6943
+ other = _objectWithoutPropertiesLoose(options, _excluded$c);
6860
6944
  const breakpoints = createBreakpoints(breakpointsInput);
6861
6945
  const spacing = createSpacing(spacingInput);
6862
6946
  let muiTheme = deepmerge$1({
@@ -6891,7 +6975,7 @@ var createTheme$1 = /*#__PURE__*/Object.freeze({
6891
6975
 
6892
6976
  var require$$7 = /*@__PURE__*/getAugmentedNamespace(createTheme$1);
6893
6977
 
6894
- const _excluded$6 = ["sx"];
6978
+ const _excluded$b = ["sx"];
6895
6979
  const splitProps = props => {
6896
6980
  var _props$theme$unstable, _props$theme;
6897
6981
  const result = {
@@ -6912,7 +6996,7 @@ function extendSxProp(props) {
6912
6996
  const {
6913
6997
  sx: inSx
6914
6998
  } = props,
6915
- other = _objectWithoutPropertiesLoose(props, _excluded$6);
6999
+ other = _objectWithoutPropertiesLoose(props, _excluded$b);
6916
7000
  const {
6917
7001
  systemProps,
6918
7002
  otherProps
@@ -6946,22 +7030,22 @@ var styleFunctionSx = /*#__PURE__*/Object.freeze({
6946
7030
 
6947
7031
  var require$$8 = /*@__PURE__*/getAugmentedNamespace(styleFunctionSx);
6948
7032
 
6949
- var _interopRequireDefault$3 = interopRequireDefaultExports;
7033
+ var _interopRequireDefault$9 = interopRequireDefaultExports;
6950
7034
  Object.defineProperty(createStyled$2, "__esModule", {
6951
7035
  value: true
6952
7036
  });
6953
7037
  var _default = createStyled$2.default = createStyled;
6954
7038
  createStyled$2.shouldForwardProp = shouldForwardProp;
6955
7039
  createStyled$2.systemDefaultTheme = void 0;
6956
- var _extends2 = _interopRequireDefault$3(require_extends());
6957
- var _objectWithoutPropertiesLoose2 = _interopRequireDefault$3(requireObjectWithoutPropertiesLoose());
6958
- var _styledEngine = _interopRequireWildcard(require$$3);
7040
+ var _extends2 = _interopRequireDefault$9(require_extends());
7041
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault$9(requireObjectWithoutPropertiesLoose());
7042
+ var _styledEngine = _interopRequireWildcard(require$$1$1);
6959
7043
  var _deepmerge = require$$4;
6960
- var _capitalize = _interopRequireDefault$3(require$$5);
6961
- var _getDisplayName = _interopRequireDefault$3(require$$6);
6962
- var _createTheme = _interopRequireDefault$3(require$$7);
6963
- var _styleFunctionSx = _interopRequireDefault$3(require$$8);
6964
- const _excluded$5 = ["ownerState"],
7044
+ var _capitalize = _interopRequireDefault$9(require$$5);
7045
+ var _getDisplayName = _interopRequireDefault$9(require$$6);
7046
+ var _createTheme = _interopRequireDefault$9(require$$7);
7047
+ var _styleFunctionSx = _interopRequireDefault$9(require$$8);
7048
+ const _excluded$a = ["ownerState"],
6965
7049
  _excluded2 = ["variants"],
6966
7050
  _excluded3 = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"];
6967
7051
  /* eslint-disable no-underscore-dangle */
@@ -7015,7 +7099,7 @@ function processStyleArg(callableStyle, _ref, layerName) {
7015
7099
  let {
7016
7100
  ownerState
7017
7101
  } = _ref,
7018
- props = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded$5);
7102
+ props = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded$a);
7019
7103
  const resolvedStylesArg = typeof callableStyle === 'function' ? callableStyle((0, _extends2.default)({
7020
7104
  ownerState
7021
7105
  }, props)) : callableStyle;
@@ -7230,11 +7314,11 @@ var require$$1 = /*@__PURE__*/getAugmentedNamespace(formatMuiErrorMessage);
7230
7314
 
7231
7315
  var require$$2 = /*@__PURE__*/getAugmentedNamespace(clamp);
7232
7316
 
7233
- var _interopRequireDefault$2 = interopRequireDefaultExports;
7317
+ var _interopRequireDefault$8 = interopRequireDefaultExports;
7234
7318
  Object.defineProperty(colorManipulator, "__esModule", {
7235
7319
  value: true
7236
7320
  });
7237
- colorManipulator.alpha = alpha;
7321
+ var alpha_1 = colorManipulator.alpha = alpha;
7238
7322
  colorManipulator.blend = blend;
7239
7323
  colorManipulator.colorChannel = void 0;
7240
7324
  var darken_1 = colorManipulator.darken = darken;
@@ -7252,8 +7336,8 @@ colorManipulator.private_safeEmphasize = private_safeEmphasize;
7252
7336
  colorManipulator.private_safeLighten = private_safeLighten;
7253
7337
  colorManipulator.recomposeColor = recomposeColor;
7254
7338
  colorManipulator.rgbToHex = rgbToHex;
7255
- var _formatMuiErrorMessage2 = _interopRequireDefault$2(require$$1);
7256
- var _clamp = _interopRequireDefault$2(require$$2);
7339
+ var _formatMuiErrorMessage2 = _interopRequireDefault$8(require$$1);
7340
+ var _clamp = _interopRequireDefault$8(require$$2);
7257
7341
  /* eslint-disable @typescript-eslint/naming-convention */
7258
7342
 
7259
7343
  /**
@@ -7733,7 +7817,7 @@ const green = {
7733
7817
  };
7734
7818
  var green$1 = green;
7735
7819
 
7736
- const _excluded$4 = ["mode", "contrastThreshold", "tonalOffset"];
7820
+ const _excluded$9 = ["mode", "contrastThreshold", "tonalOffset"];
7737
7821
  const light = {
7738
7822
  // The colors used to style the text.
7739
7823
  text: {
@@ -7902,7 +7986,7 @@ function createPalette(palette) {
7902
7986
  contrastThreshold = 3,
7903
7987
  tonalOffset = 0.2
7904
7988
  } = palette,
7905
- other = _objectWithoutPropertiesLoose(palette, _excluded$4);
7989
+ other = _objectWithoutPropertiesLoose(palette, _excluded$9);
7906
7990
  const primary = palette.primary || getDefaultPrimary(mode);
7907
7991
  const secondary = palette.secondary || getDefaultSecondary(mode);
7908
7992
  const error = palette.error || getDefaultError(mode);
@@ -8026,7 +8110,7 @@ const theme2 = createTheme({ palette: {
8026
8110
  return paletteOutput;
8027
8111
  }
8028
8112
 
8029
- const _excluded$3 = ["fontFamily", "fontSize", "fontWeightLight", "fontWeightRegular", "fontWeightMedium", "fontWeightBold", "htmlFontSize", "allVariants", "pxToRem"];
8113
+ const _excluded$8 = ["fontFamily", "fontSize", "fontWeightLight", "fontWeightRegular", "fontWeightMedium", "fontWeightBold", "htmlFontSize", "allVariants", "pxToRem"];
8030
8114
  function round(value) {
8031
8115
  return Math.round(value * 1e5) / 1e5;
8032
8116
  }
@@ -8057,7 +8141,7 @@ function createTypography(palette, typography) {
8057
8141
  allVariants,
8058
8142
  pxToRem: pxToRem2
8059
8143
  } = _ref,
8060
- other = _objectWithoutPropertiesLoose(_ref, _excluded$3);
8144
+ other = _objectWithoutPropertiesLoose(_ref, _excluded$8);
8061
8145
  if (process.env.NODE_ENV !== 'production') {
8062
8146
  if (typeof fontSize !== 'number') {
8063
8147
  console.error('MUI: `fontSize` is required to be a number.');
@@ -8125,7 +8209,7 @@ function createShadow(...px) {
8125
8209
  const shadows = ['none', createShadow(0, 2, 1, -1, 0, 1, 1, 0, 0, 1, 3, 0), createShadow(0, 3, 1, -2, 0, 2, 2, 0, 0, 1, 5, 0), createShadow(0, 3, 3, -2, 0, 3, 4, 0, 0, 1, 8, 0), createShadow(0, 2, 4, -1, 0, 4, 5, 0, 0, 1, 10, 0), createShadow(0, 3, 5, -1, 0, 5, 8, 0, 0, 1, 14, 0), createShadow(0, 3, 5, -1, 0, 6, 10, 0, 0, 1, 18, 0), createShadow(0, 4, 5, -2, 0, 7, 10, 1, 0, 2, 16, 1), createShadow(0, 5, 5, -3, 0, 8, 10, 1, 0, 3, 14, 2), createShadow(0, 5, 6, -3, 0, 9, 12, 1, 0, 3, 16, 2), createShadow(0, 6, 6, -3, 0, 10, 14, 1, 0, 4, 18, 3), createShadow(0, 6, 7, -4, 0, 11, 15, 1, 0, 4, 20, 3), createShadow(0, 7, 8, -4, 0, 12, 17, 2, 0, 5, 22, 4), createShadow(0, 7, 8, -4, 0, 13, 19, 2, 0, 5, 24, 4), createShadow(0, 7, 9, -4, 0, 14, 21, 2, 0, 5, 26, 4), createShadow(0, 8, 9, -5, 0, 15, 22, 2, 0, 6, 28, 5), createShadow(0, 8, 10, -5, 0, 16, 24, 2, 0, 6, 30, 5), createShadow(0, 8, 11, -5, 0, 17, 26, 2, 0, 6, 32, 5), createShadow(0, 9, 11, -5, 0, 18, 28, 2, 0, 7, 34, 6), createShadow(0, 9, 12, -6, 0, 19, 29, 2, 0, 7, 36, 6), createShadow(0, 10, 13, -6, 0, 20, 31, 3, 0, 8, 38, 7), createShadow(0, 10, 13, -6, 0, 21, 33, 3, 0, 8, 40, 7), createShadow(0, 10, 14, -6, 0, 22, 35, 3, 0, 8, 42, 7), createShadow(0, 11, 14, -7, 0, 23, 36, 3, 0, 9, 44, 8), createShadow(0, 11, 15, -7, 0, 24, 38, 3, 0, 9, 46, 8)];
8126
8210
  var shadows$1 = shadows;
8127
8211
 
8128
- const _excluded$2 = ["duration", "easing", "delay"];
8212
+ const _excluded$7 = ["duration", "easing", "delay"];
8129
8213
  // Follow https://material.google.com/motion/duration-easing.html#duration-easing-natural-easing-curves
8130
8214
  // to learn the context in which each easing should be used.
8131
8215
  const easing = {
@@ -8176,7 +8260,7 @@ function createTransitions(inputTransitions) {
8176
8260
  easing: easingOption = mergedEasing.easeInOut,
8177
8261
  delay = 0
8178
8262
  } = options,
8179
- other = _objectWithoutPropertiesLoose(options, _excluded$2);
8263
+ other = _objectWithoutPropertiesLoose(options, _excluded$7);
8180
8264
  if (process.env.NODE_ENV !== 'production') {
8181
8265
  const isString = value => typeof value === 'string';
8182
8266
  // IE11 support, replace with Number.isNaN
@@ -8226,7 +8310,7 @@ const zIndex = {
8226
8310
  };
8227
8311
  var zIndex$1 = zIndex;
8228
8312
 
8229
- const _excluded$1 = ["breakpoints", "mixins", "spacing", "palette", "transitions", "typography", "shape"];
8313
+ const _excluded$6 = ["breakpoints", "mixins", "spacing", "palette", "transitions", "typography", "shape"];
8230
8314
  function createTheme(options = {}, ...args) {
8231
8315
  const {
8232
8316
  mixins: mixinsInput = {},
@@ -8234,7 +8318,7 @@ function createTheme(options = {}, ...args) {
8234
8318
  transitions: transitionsInput = {},
8235
8319
  typography: typographyInput = {}
8236
8320
  } = options,
8237
- other = _objectWithoutPropertiesLoose(options, _excluded$1);
8321
+ other = _objectWithoutPropertiesLoose(options, _excluded$6);
8238
8322
  if (options.vars &&
8239
8323
  // The error should throw only for the root theme creation because user is not allowed to use a custom node `vars`.
8240
8324
  // `generateCssVars` is the closest identifier for checking that the `options` is a result of `extendTheme` with CSS variables so that user can create new theme for nested ThemeProvider.
@@ -8305,13 +8389,13 @@ function slotShouldForwardProp(prop) {
8305
8389
  return prop !== 'ownerState' && prop !== 'theme' && prop !== 'sx' && prop !== 'as';
8306
8390
  }
8307
8391
 
8308
- const rootShouldForwardProp = prop => slotShouldForwardProp(prop) && prop !== 'classes';
8309
- var rootShouldForwardProp$1 = rootShouldForwardProp;
8392
+ const rootShouldForwardProp$1 = prop => slotShouldForwardProp(prop) && prop !== 'classes';
8393
+ var rootShouldForwardProp$2 = rootShouldForwardProp$1;
8310
8394
 
8311
8395
  const styled = _default({
8312
8396
  themeId: THEME_ID,
8313
8397
  defaultTheme: defaultTheme$1,
8314
- rootShouldForwardProp: rootShouldForwardProp$1
8398
+ rootShouldForwardProp: rootShouldForwardProp$2
8315
8399
  });
8316
8400
  var styled$1 = styled;
8317
8401
 
@@ -8320,8 +8404,8 @@ function getSvgIconUtilityClass(slot) {
8320
8404
  }
8321
8405
  generateUtilityClasses('MuiSvgIcon', ['root', 'colorPrimary', 'colorSecondary', 'colorAction', 'colorError', 'colorDisabled', 'fontSizeInherit', 'fontSizeSmall', 'fontSizeMedium', 'fontSizeLarge']);
8322
8406
 
8323
- const _excluded = ["children", "className", "color", "component", "fontSize", "htmlColor", "inheritViewBox", "titleAccess", "viewBox"];
8324
- const useUtilityClasses = ownerState => {
8407
+ const _excluded$5 = ["children", "className", "color", "component", "fontSize", "htmlColor", "inheritViewBox", "titleAccess", "viewBox"];
8408
+ const useUtilityClasses$4 = ownerState => {
8325
8409
  const {
8326
8410
  color,
8327
8411
  fontSize,
@@ -8388,7 +8472,7 @@ const SvgIcon = /*#__PURE__*/React.forwardRef(function SvgIcon(inProps, ref) {
8388
8472
  titleAccess,
8389
8473
  viewBox = '0 0 24 24'
8390
8474
  } = props,
8391
- other = _objectWithoutPropertiesLoose(props, _excluded);
8475
+ other = _objectWithoutPropertiesLoose(props, _excluded$5);
8392
8476
  const hasSvgAsChild = /*#__PURE__*/React.isValidElement(children) && children.type === 'svg';
8393
8477
  const ownerState = _extends$1({}, props, {
8394
8478
  color,
@@ -8403,7 +8487,7 @@ const SvgIcon = /*#__PURE__*/React.forwardRef(function SvgIcon(inProps, ref) {
8403
8487
  if (!inheritViewBox) {
8404
8488
  more.viewBox = viewBox;
8405
8489
  }
8406
- const classes = useUtilityClasses(ownerState);
8490
+ const classes = useUtilityClasses$4(ownerState);
8407
8491
  return /*#__PURE__*/jsxRuntimeExports.jsxs(SvgIconRoot, _extends$1({
8408
8492
  as: component,
8409
8493
  className: clsx(classes.root, className),
@@ -8603,27 +8687,27 @@ function requireCreateSvgIcon () {
8603
8687
  return createSvgIcon;
8604
8688
  }
8605
8689
 
8606
- var _interopRequireDefault$1 = interopRequireDefaultExports;
8690
+ var _interopRequireDefault$7 = interopRequireDefaultExports;
8607
8691
  Object.defineProperty(ArrowForward, "__esModule", {
8608
8692
  value: true
8609
8693
  });
8610
- var default_1$1 = ArrowForward.default = void 0;
8611
- var _createSvgIcon$1 = _interopRequireDefault$1(requireCreateSvgIcon());
8612
- var _jsxRuntime$1 = jsxRuntimeExports;
8613
- default_1$1 = ArrowForward.default = (0, _createSvgIcon$1.default)( /*#__PURE__*/(0, _jsxRuntime$1.jsx)("path", {
8694
+ var default_1$7 = ArrowForward.default = void 0;
8695
+ var _createSvgIcon$7 = _interopRequireDefault$7(requireCreateSvgIcon());
8696
+ var _jsxRuntime$7 = jsxRuntimeExports;
8697
+ default_1$7 = ArrowForward.default = (0, _createSvgIcon$7.default)( /*#__PURE__*/(0, _jsxRuntime$7.jsx)("path", {
8614
8698
  d: "m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"
8615
8699
  }), 'ArrowForward');
8616
8700
 
8617
8701
  var Message = {};
8618
8702
 
8619
- var _interopRequireDefault = interopRequireDefaultExports;
8703
+ var _interopRequireDefault$6 = interopRequireDefaultExports;
8620
8704
  Object.defineProperty(Message, "__esModule", {
8621
8705
  value: true
8622
8706
  });
8623
- var default_1 = Message.default = void 0;
8624
- var _createSvgIcon = _interopRequireDefault(requireCreateSvgIcon());
8625
- var _jsxRuntime = jsxRuntimeExports;
8626
- default_1 = Message.default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
8707
+ var default_1$6 = Message.default = void 0;
8708
+ var _createSvgIcon$6 = _interopRequireDefault$6(requireCreateSvgIcon());
8709
+ var _jsxRuntime$6 = jsxRuntimeExports;
8710
+ default_1$6 = Message.default = (0, _createSvgIcon$6.default)( /*#__PURE__*/(0, _jsxRuntime$6.jsx)("path", {
8627
8711
  d: "M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-2 12H6v-2h12zm0-3H6V9h12zm0-3H6V6h12z"
8628
8712
  }), 'Message');
8629
8713
 
@@ -8648,7 +8732,7 @@ const HeaderContainer$1 = styled$3(Box)({
8648
8732
  marginBottom: '16px',
8649
8733
  position: 'relative',
8650
8734
  });
8651
- const ContactAvatar$1 = styled$3(Avatar)({
8735
+ const ContactAvatar = styled$3(Avatar)({
8652
8736
  width: 60,
8653
8737
  height: 60,
8654
8738
  marginBottom: 8,
@@ -8703,7 +8787,7 @@ const Header$1 = ({ imgUrl, name, contactId, navigate, isLoading = false, onErro
8703
8787
  handleNavigateToContacts(e);
8704
8788
  onClose();
8705
8789
  }
8706
- }, disabled: !contactId, "aria-label": "View contact details", children: jsxRuntimeExports.jsx(default_1$1, { fontSize: "small" }) }), jsxRuntimeExports.jsx(SmallIconButton, { color: "info", size: "small", onClick: (e) => {
8790
+ }, disabled: !contactId, "aria-label": "View contact details", children: jsxRuntimeExports.jsx(default_1$7, { fontSize: "small" }) }), jsxRuntimeExports.jsx(SmallIconButton, { color: "info", size: "small", onClick: (e) => {
8707
8791
  handleNavigateToConversations(e);
8708
8792
  onClose();
8709
8793
  }, onMouseDown: (e) => {
@@ -8712,7 +8796,7 @@ const Header$1 = ({ imgUrl, name, contactId, navigate, isLoading = false, onErro
8712
8796
  handleNavigateToConversations(e);
8713
8797
  onClose();
8714
8798
  }
8715
- }, "aria-label": "Go to conversations", children: jsxRuntimeExports.jsx(default_1, { fontSize: "small" }) })] }), isLoading ? (jsxRuntimeExports.jsx(LoadingContainer, { children: jsxRuntimeExports.jsx(CircularProgress, { size: 24 }) })) : (jsxRuntimeExports.jsx(ContactAvatar$1, { src: imgUrl, alt: avatarAlt, onError: () => onError?.(new Error('Failed to load avatar')) })), jsxRuntimeExports.jsx(ContactName$1, { variant: "h6", title: displayName, children: displayName })] }));
8799
+ }, "aria-label": "Go to conversations", children: jsxRuntimeExports.jsx(default_1$6, { fontSize: "small" }) })] }), isLoading ? (jsxRuntimeExports.jsx(LoadingContainer, { children: jsxRuntimeExports.jsx(CircularProgress$2, { size: 24 }) })) : (jsxRuntimeExports.jsx(ContactAvatar, { src: imgUrl, alt: avatarAlt, onError: () => onError?.(new Error('Failed to load avatar')) })), jsxRuntimeExports.jsx(ContactName$1, { variant: "h6", title: displayName, children: displayName })] }));
8716
8800
  };
8717
8801
 
8718
8802
  const Container$1 = styled$3(Box)({
@@ -8777,6 +8861,12 @@ const ContactMethod = ({ icon, contactList, title, showTitle = true, }) => {
8777
8861
  return (jsxRuntimeExports.jsxs(Container$1, { children: [showTitle && (jsxRuntimeExports.jsx(TitleBox, { children: jsxRuntimeExports.jsx(Typography, { variant: "subtitle1", fontWeight: "bold", gutterBottom: true, mt: 2, children: title }) })), contactList?.map(renderContactInfo)] }));
8778
8862
  };
8779
8863
 
8864
+ var Contacts = {};
8865
+
8866
+ var contacts = {};
8867
+
8868
+ Object.defineProperty(contacts, "__esModule", { value: true });
8869
+ contacts.GoogleAccountInfo = contacts.GooglePeopleIntegration = contacts.IntegrationButton_format = contacts.IntegrationButton_method = contacts.ContactField_type = contacts.ContactOrigin = void 0;
8780
8870
  var ContactOrigin;
8781
8871
  (function (ContactOrigin) {
8782
8872
  ContactOrigin[ContactOrigin["MANUAL"] = 0] = "MANUAL";
@@ -8784,7 +8874,7 @@ var ContactOrigin;
8784
8874
  ContactOrigin[ContactOrigin["CALL"] = 2] = "CALL";
8785
8875
  ContactOrigin[ContactOrigin["TICKET"] = 3] = "TICKET";
8786
8876
  ContactOrigin[ContactOrigin["FORM"] = 4] = "FORM";
8787
- })(ContactOrigin || (ContactOrigin = {}));
8877
+ })(ContactOrigin || (contacts.ContactOrigin = ContactOrigin = {}));
8788
8878
  var ContactField_type;
8789
8879
  (function (ContactField_type) {
8790
8880
  ContactField_type[ContactField_type["TEXT"] = 0] = "TEXT";
@@ -8800,19 +8890,30 @@ var ContactField_type;
8800
8890
  ContactField_type[ContactField_type["NUMBER_DECIMAL"] = 22] = "NUMBER_DECIMAL";
8801
8891
  ContactField_type[ContactField_type["NUMBER_CURRENCY"] = 23] = "NUMBER_CURRENCY";
8802
8892
  ContactField_type[ContactField_type["NUMBER_ACCOUNTING"] = 24] = "NUMBER_ACCOUNTING";
8803
- })(ContactField_type || (ContactField_type = {}));
8893
+ })(ContactField_type || (contacts.ContactField_type = ContactField_type = {}));
8804
8894
  var IntegrationButton_method;
8805
8895
  (function (IntegrationButton_method) {
8806
8896
  IntegrationButton_method[IntegrationButton_method["GET"] = 1] = "GET";
8807
8897
  IntegrationButton_method[IntegrationButton_method["POST"] = 2] = "POST";
8808
- })(IntegrationButton_method || (IntegrationButton_method = {}));
8898
+ })(IntegrationButton_method || (contacts.IntegrationButton_method = IntegrationButton_method = {}));
8809
8899
  var IntegrationButton_format;
8810
8900
  (function (IntegrationButton_format) {
8811
8901
  IntegrationButton_format[IntegrationButton_format["JSON"] = 1] = "JSON";
8812
8902
  IntegrationButton_format[IntegrationButton_format["HTML"] = 2] = "HTML";
8813
8903
  IntegrationButton_format[IntegrationButton_format["HTML_newtab"] = 3] = "HTML_newtab";
8814
- })(IntegrationButton_format || (IntegrationButton_format = {}));
8904
+ })(IntegrationButton_format || (contacts.IntegrationButton_format = IntegrationButton_format = {}));
8905
+ class GooglePeopleIntegration {
8906
+ }
8907
+ contacts.GooglePeopleIntegration = GooglePeopleIntegration;
8908
+ class GoogleAccountInfo {
8909
+ }
8910
+ contacts.GoogleAccountInfo = GoogleAccountInfo;
8815
8911
 
8912
+ var segments = {};
8913
+
8914
+ Object.defineProperty(segments, "__esModule", { value: true });
8915
+ segments.Segment_Filter_Account = segments.Segment_Filter_Geography = segments.Segment_Filter_Details = segments.Segment_Filter_Operator = void 0;
8916
+ const contacts_1 = contacts;
8816
8917
  var Segment_Filter_Operator;
8817
8918
  (function (Segment_Filter_Operator) {
8818
8919
  Segment_Filter_Operator[Segment_Filter_Operator["NULL"] = 0] = "NULL";
@@ -8826,42 +8927,83 @@ var Segment_Filter_Operator;
8826
8927
  Segment_Filter_Operator[Segment_Filter_Operator["CONTAINS"] = 8] = "CONTAINS";
8827
8928
  Segment_Filter_Operator[Segment_Filter_Operator["NOT_CONTAINS"] = 9] = "NOT_CONTAINS";
8828
8929
  Segment_Filter_Operator[Segment_Filter_Operator["ANY_VALUE"] = 10] = "ANY_VALUE";
8829
- })(Segment_Filter_Operator || (Segment_Filter_Operator = {}));
8830
- [
8930
+ Segment_Filter_Operator[Segment_Filter_Operator["NOT_EQUAL"] = 11] = "NOT_EQUAL";
8931
+ })(Segment_Filter_Operator || (segments.Segment_Filter_Operator = Segment_Filter_Operator = {}));
8932
+ segments.Segment_Filter_Details = [
8831
8933
  {
8832
8934
  key: "details.name",
8833
- type: ContactField_type.TEXT
8935
+ type: contacts_1.ContactField_type.TEXT
8834
8936
  },
8835
8937
  {
8836
8938
  key: "details.email",
8837
- type: ContactField_type.TEXT
8939
+ type: contacts_1.ContactField_type.TEXT
8838
8940
  },
8839
8941
  ];
8840
- [
8942
+ segments.Segment_Filter_Geography = [
8841
8943
  {
8842
8944
  key: "geography.country",
8843
- type: ContactField_type.TEXT
8945
+ type: contacts_1.ContactField_type.TEXT
8844
8946
  },
8845
8947
  {
8846
8948
  key: "details.city",
8847
- type: ContactField_type.TEXT
8949
+ type: contacts_1.ContactField_type.TEXT
8848
8950
  }
8849
8951
  ];
8850
- [
8952
+ segments.Segment_Filter_Account = [
8851
8953
  {
8852
8954
  key: "account.name",
8853
- type: ContactField_type.TEXT
8955
+ type: contacts_1.ContactField_type.TEXT
8854
8956
  },
8855
8957
  {
8856
8958
  key: "account.email",
8857
- type: ContactField_type.TEXT
8959
+ type: contacts_1.ContactField_type.TEXT
8858
8960
  },
8859
8961
  {
8860
8962
  key: "account.numberOfEmployees",
8861
- type: ContactField_type.NUMBER_INTEGER
8963
+ type: contacts_1.ContactField_type.NUMBER_INTEGER
8862
8964
  }
8863
8965
  ];
8864
8966
 
8967
+ var Label$1 = {};
8968
+
8969
+ Object.defineProperty(Label$1, "__esModule", { value: true });
8970
+
8971
+ var Note = {};
8972
+
8973
+ Object.defineProperty(Note, "__esModule", { value: true });
8974
+
8975
+ var File = {};
8976
+
8977
+ Object.defineProperty(File, "__esModule", { value: true });
8978
+
8979
+ var Import = {};
8980
+
8981
+ Object.defineProperty(Import, "__esModule", { value: true });
8982
+
8983
+ (function (exports) {
8984
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8985
+ if (k2 === undefined) k2 = k;
8986
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8987
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8988
+ desc = { enumerable: true, get: function() { return m[k]; } };
8989
+ }
8990
+ Object.defineProperty(o, k2, desc);
8991
+ }) : (function(o, m, k, k2) {
8992
+ if (k2 === undefined) k2 = k;
8993
+ o[k2] = m[k];
8994
+ }));
8995
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
8996
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
8997
+ };
8998
+ Object.defineProperty(exports, "__esModule", { value: true });
8999
+ __exportStar(contacts, exports);
9000
+ __exportStar(segments, exports);
9001
+ __exportStar(Label$1, exports);
9002
+ __exportStar(Note, exports);
9003
+ __exportStar(File, exports);
9004
+ __exportStar(Import, exports);
9005
+ } (Contacts));
9006
+
8865
9007
  function commonjsRequire(path) {
8866
9008
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
8867
9009
  }
@@ -14590,24 +14732,24 @@ const Properties = ({ properties, title }) => {
14590
14732
  const isValidDate = moment(value, moment.ISO_8601).isValid();
14591
14733
  const format = (formatStr) => moment(value).format(formatStr);
14592
14734
  switch (type) {
14593
- case ContactField_type.TIME:
14735
+ case Contacts.ContactField_type.TIME:
14594
14736
  return isValidDate ? format('HH:mm') : value;
14595
- case ContactField_type.DATE:
14737
+ case Contacts.ContactField_type.DATE:
14596
14738
  return isValidDate ? format('DD/MM/YYYY') : value;
14597
- case ContactField_type.TIMERANGE:
14598
- case ContactField_type.DATERANGE:
14739
+ case Contacts.ContactField_type.TIMERANGE:
14740
+ case Contacts.ContactField_type.DATERANGE:
14599
14741
  if (isValidDate) {
14600
- return type === ContactField_type.TIMERANGE
14742
+ return type === Contacts.ContactField_type.TIMERANGE
14601
14743
  ? format('HH:mm')
14602
14744
  : format('DD/MM/YYYY');
14603
14745
  }
14604
14746
  const parts = value.split(' ');
14605
14747
  if (parts.length === 2) {
14606
14748
  const [start, end] = parts;
14607
- const startFormatted = type === ContactField_type.TIMERANGE
14749
+ const startFormatted = type === Contacts.ContactField_type.TIMERANGE
14608
14750
  ? moment(start).format('HH:mm')
14609
14751
  : moment(start).format('DD/MM/YYYY');
14610
- const endFormatted = type === ContactField_type.TIMERANGE
14752
+ const endFormatted = type === Contacts.ContactField_type.TIMERANGE
14611
14753
  ? moment(end).format('HH:mm')
14612
14754
  : moment(end).format('DD/MM/YYYY');
14613
14755
  return `${startFormatted} - ${endFormatted}`;
@@ -14831,6 +14973,142 @@ const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl,
14831
14973
  return (jsxRuntimeExports.jsx(Popper, { sx: { zIndex: 1300 }, open: open, anchorEl: anchorEl, placement: "bottom-start", "data-popper-child": "true", children: jsxRuntimeExports.jsx(ClickAwayListener, { onClickAway: onClose, children: jsxRuntimeExports.jsx(PopupContainer, { children: jsxRuntimeExports.jsxs(CardContent, { children: [jsxRuntimeExports.jsx(Header$1, { navigate: navigate, contactId: contactData?.id, imgUrl: avatarImgUrl, name: contactData?.name, onClose: onClose, isBusiness: dataIsBusiness }), jsxRuntimeExports.jsx(LabelsSection, { contactData: contactData, title: t('labels') }), dataIsContact && (jsxRuntimeExports.jsx(BusinessSection, { contactData: contactData, title: t('business') })), dataIsBusiness && (jsxRuntimeExports.jsx(MembersSection, { contactData: contactData, title: t('businessMembers'), navigate: navigate })), contactMethods.map((method, index) => (jsxRuntimeExports.jsx(ContactMethod, { icon: method.icon, title: method.title, contactList: method.contactList, showTitle: method.showTitle }, index))), jsxRuntimeExports.jsx(Properties, { properties: contactData?.properties, title: t('properties') })] }) }) }) }));
14832
14974
  };
14833
14975
 
14976
+ var Edit = {};
14977
+
14978
+ var _interopRequireDefault$5 = interopRequireDefaultExports;
14979
+ Object.defineProperty(Edit, "__esModule", {
14980
+ value: true
14981
+ });
14982
+ var default_1$5 = Edit.default = void 0;
14983
+ var _createSvgIcon$5 = _interopRequireDefault$5(requireCreateSvgIcon());
14984
+ var _jsxRuntime$5 = jsxRuntimeExports;
14985
+ default_1$5 = Edit.default = (0, _createSvgIcon$5.default)( /*#__PURE__*/(0, _jsxRuntime$5.jsx)("path", {
14986
+ d: "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"
14987
+ }), 'Edit');
14988
+
14989
+ var Label = {};
14990
+
14991
+ var _interopRequireDefault$4 = interopRequireDefaultExports;
14992
+ Object.defineProperty(Label, "__esModule", {
14993
+ value: true
14994
+ });
14995
+ var default_1$4 = Label.default = void 0;
14996
+ var _createSvgIcon$4 = _interopRequireDefault$4(requireCreateSvgIcon());
14997
+ var _jsxRuntime$4 = jsxRuntimeExports;
14998
+ default_1$4 = Label.default = (0, _createSvgIcon$4.default)( /*#__PURE__*/(0, _jsxRuntime$4.jsx)("path", {
14999
+ d: "M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12z"
15000
+ }), 'Label');
15001
+
15002
+ const Tags = ({ tags, t, onEditTags }) => {
15003
+ const [anchorEl, setAnchorEl] = useState(null);
15004
+ const safeTags = useMemo(() => tags ?? [], [tags]);
15005
+ const MAX_VISIBLE = 4;
15006
+ const visibleTags = safeTags.slice(0, MAX_VISIBLE);
15007
+ const hiddenCount = Math.max(safeTags.length - visibleTags.length, 0);
15008
+ const handleOpen = (event) => {
15009
+ setAnchorEl(event.currentTarget);
15010
+ };
15011
+ const handleClose = () => {
15012
+ setAnchorEl(null);
15013
+ };
15014
+ const open = Boolean(anchorEl);
15015
+ return (jsxRuntimeExports.jsxs(Box, { sx: {
15016
+ width: '100%',
15017
+ mt: 1,
15018
+ position: 'relative',
15019
+ '&:hover .tags-action, &:focus-within .tags-action': {
15020
+ opacity: 1,
15021
+ },
15022
+ }, children: [jsxRuntimeExports.jsx(Box, { sx: { maxWidth: 320, mx: 'auto', pr: 4 }, children: jsxRuntimeExports.jsxs(Stack, { direction: "row", spacing: 1, useFlexGap: true, flexWrap: "wrap", justifyContent: "center", children: [visibleTags.map((tag) => (jsxRuntimeExports.jsx(Chip, { label: tag.name, size: "small", variant: "outlined", sx: {
15023
+ borderRadius: 999,
15024
+ maxWidth: 140,
15025
+ '& .MuiChip-label': {
15026
+ overflow: 'hidden',
15027
+ textOverflow: 'ellipsis',
15028
+ },
15029
+ } }, tag.id))), hiddenCount > 0 ? (jsxRuntimeExports.jsx(Chip, { label: `+${hiddenCount}`, size: "small", variant: "outlined", onClick: handleOpen, sx: { borderRadius: 999 } })) : null] }) }), jsxRuntimeExports.jsx(IconButton, { className: "tags-action", size: "small", "aria-label": safeTags.length ? t('tags.edit') : t('tags.add'), onClick: onEditTags, sx: {
15030
+ position: 'absolute',
15031
+ right: 0,
15032
+ top: '50%',
15033
+ transform: 'translateY(-50%)',
15034
+ opacity: 0,
15035
+ transition: 'opacity 0.2s ease-in-out',
15036
+ }, children: safeTags.length ? (jsxRuntimeExports.jsx(default_1$5, { fontSize: "small" })) : (jsxRuntimeExports.jsx(default_1$4, { fontSize: "small" })) }), jsxRuntimeExports.jsx(Popover, { open: open, anchorEl: anchorEl, onClose: handleClose, anchorOrigin: { vertical: 'bottom', horizontal: 'center' }, transformOrigin: { vertical: 'top', horizontal: 'center' }, children: jsxRuntimeExports.jsxs(Box, { sx: { p: 1.5, maxWidth: 320, maxHeight: 240, overflowY: 'auto' }, children: [jsxRuntimeExports.jsx(Typography, { variant: "subtitle2", sx: { mb: 1 }, children: t('tags') }), jsxRuntimeExports.jsx(Stack, { direction: "row", spacing: 1, useFlexGap: true, flexWrap: "wrap", children: safeTags.map((tag) => (jsxRuntimeExports.jsx(Chip, { label: tag.name, size: "small", variant: "outlined", sx: {
15037
+ borderRadius: 999,
15038
+ maxWidth: 160,
15039
+ '& .MuiChip-label': {
15040
+ overflow: 'hidden',
15041
+ textOverflow: 'ellipsis',
15042
+ },
15043
+ } }, tag.id))) })] }) })] }));
15044
+ };
15045
+
15046
+ var Delete = {};
15047
+
15048
+ var _interopRequireDefault$3 = interopRequireDefaultExports;
15049
+ Object.defineProperty(Delete, "__esModule", {
15050
+ value: true
15051
+ });
15052
+ var default_1$3 = Delete.default = void 0;
15053
+ var _createSvgIcon$3 = _interopRequireDefault$3(requireCreateSvgIcon());
15054
+ var _jsxRuntime$3 = jsxRuntimeExports;
15055
+ default_1$3 = Delete.default = (0, _createSvgIcon$3.default)( /*#__PURE__*/(0, _jsxRuntime$3.jsx)("path", {
15056
+ d: "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"
15057
+ }), 'Delete');
15058
+
15059
+ var PhotoCamera = {};
15060
+
15061
+ var _interopRequireDefault$2 = interopRequireDefaultExports;
15062
+ Object.defineProperty(PhotoCamera, "__esModule", {
15063
+ value: true
15064
+ });
15065
+ var default_1$2 = PhotoCamera.default = void 0;
15066
+ var _createSvgIcon$2 = _interopRequireDefault$2(requireCreateSvgIcon());
15067
+ var _jsxRuntime$2 = jsxRuntimeExports;
15068
+ default_1$2 = PhotoCamera.default = (0, _createSvgIcon$2.default)([/*#__PURE__*/(0, _jsxRuntime$2.jsx)("circle", {
15069
+ cx: "12",
15070
+ cy: "12",
15071
+ r: "3.2"
15072
+ }, "0"), /*#__PURE__*/(0, _jsxRuntime$2.jsx)("path", {
15073
+ d: "M9 2 7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5"
15074
+ }, "1")], 'PhotoCamera');
15075
+
15076
+ const AvatarWithActions = ({ src, alt, onError, onUpload, onDelete, isUploading, isDeleting, t, }) => {
15077
+ return (jsxRuntimeExports.jsxs(Box, { sx: {
15078
+ width: 60,
15079
+ height: 60,
15080
+ mb: 1,
15081
+ position: 'relative',
15082
+ '&:hover .avatar-actions, &:focus-within .avatar-actions': {
15083
+ opacity: 1,
15084
+ pointerEvents: 'auto',
15085
+ },
15086
+ }, children: [jsxRuntimeExports.jsx(Avatar, { src: src, alt: alt, onError: onError, sx: {
15087
+ width: 60,
15088
+ height: 60,
15089
+ } }), jsxRuntimeExports.jsxs(Box, { className: "avatar-actions", sx: {
15090
+ position: 'absolute',
15091
+ inset: 0,
15092
+ borderRadius: '50%',
15093
+ display: 'flex',
15094
+ alignItems: 'center',
15095
+ justifyContent: 'center',
15096
+ gap: 0.5,
15097
+ bgcolor: 'rgba(0, 0, 0, 0.35)',
15098
+ opacity: 0,
15099
+ pointerEvents: 'none',
15100
+ transition: 'opacity 0.2s ease-in-out',
15101
+ }, children: [jsxRuntimeExports.jsx(IconButton, { size: "small", "aria-label": t('avatar.upload'), onClick: onUpload, disabled: Boolean(isUploading), sx: {
15102
+ color: 'common.white',
15103
+ bgcolor: 'rgba(0, 0, 0, 0.25)',
15104
+ '&:hover': { bgcolor: 'rgba(0, 0, 0, 0.35)' },
15105
+ }, children: jsxRuntimeExports.jsx(default_1$2, { fontSize: "small" }) }), jsxRuntimeExports.jsx(IconButton, { size: "small", "aria-label": t('avatar.delete'), onClick: onDelete, disabled: Boolean(isDeleting), sx: {
15106
+ color: 'common.white',
15107
+ bgcolor: 'rgba(0, 0, 0, 0.25)',
15108
+ '&:hover': { bgcolor: 'rgba(0, 0, 0, 0.35)' },
15109
+ }, children: jsxRuntimeExports.jsx(default_1$3, { fontSize: "small" }) })] })] }));
15110
+ };
15111
+
14834
15112
  const HeaderContainer = styled$3(Box)({
14835
15113
  display: 'flex',
14836
15114
  flexDirection: 'column',
@@ -14838,11 +15116,6 @@ const HeaderContainer = styled$3(Box)({
14838
15116
  marginBottom: '16px',
14839
15117
  position: 'relative',
14840
15118
  });
14841
- const ContactAvatar = styled$3(Avatar)({
14842
- width: 60,
14843
- height: 60,
14844
- marginBottom: 8,
14845
- });
14846
15119
  const ContactName = styled$3(Typography)({
14847
15120
  whiteSpace: 'nowrap',
14848
15121
  overflow: 'hidden',
@@ -14850,9 +15123,9 @@ const ContactName = styled$3(Typography)({
14850
15123
  maxWidth: 200,
14851
15124
  textAlign: 'center',
14852
15125
  });
14853
- const Header = ({ imgUrl, displayName = 'Unknown Contact', onError, }) => {
15126
+ const Header = ({ imgUrl, displayName, onError, tags, t, onEditTags, onUploadPhoto, onPhotoFileChange, photoInputRef, isUploadingPhoto, onDeletePhoto, isDeletingPhoto, }) => {
14854
15127
  const avatarAlt = `Avatar for ${displayName}`;
14855
- return (jsxRuntimeExports.jsxs(HeaderContainer, { children: [jsxRuntimeExports.jsx(ContactAvatar, { src: imgUrl, alt: avatarAlt, onError: () => onError?.(new Error('Failed to load avatar')) }), jsxRuntimeExports.jsx(ContactName, { variant: "h6", title: displayName, children: displayName })] }));
15128
+ return (jsxRuntimeExports.jsxs(HeaderContainer, { children: [jsxRuntimeExports.jsx("input", { ref: photoInputRef, type: "file", accept: "image/*", onChange: onPhotoFileChange, style: { display: 'none' } }), jsxRuntimeExports.jsx(AvatarWithActions, { src: imgUrl, alt: avatarAlt, onError: () => onError?.(new Error('Failed to load avatar')), onUpload: onUploadPhoto, isUploading: isUploadingPhoto, onDelete: onDeletePhoto, isDeleting: isDeletingPhoto, t: t }), jsxRuntimeExports.jsx(ContactName, { variant: "h6", title: displayName, children: displayName }), jsxRuntimeExports.jsx(Tags, { tags: tags, t: t, onEditTags: onEditTags })] }));
14856
15129
  };
14857
15130
 
14858
15131
  class ApiError extends Error {
@@ -14886,16 +15159,79 @@ async function requestJson({ url, method = 'GET', headers, body, signal, }) {
14886
15159
  }
14887
15160
  return parsedBody;
14888
15161
  }
15162
+ async function requestFormData({ url, method = 'POST', headers, formData, signal, }) {
15163
+ const res = await globalThis.fetch(url, {
15164
+ method,
15165
+ headers: {
15166
+ ...(headers ?? {}),
15167
+ },
15168
+ body: formData,
15169
+ signal,
15170
+ });
15171
+ const contentType = res.headers.get('content-type') || '';
15172
+ const isJson = contentType.includes('application/json');
15173
+ const parsedBody = isJson ? await res.json().catch(() => null) : await res.text().catch(() => null);
15174
+ if (!res.ok) {
15175
+ const message = typeof parsedBody === 'object' && parsedBody && 'message' in parsedBody
15176
+ ? String(parsedBody.message)
15177
+ : `Request failed with status ${res.status}`;
15178
+ throw new ApiError(message, res.status, parsedBody);
15179
+ }
15180
+ return parsedBody;
15181
+ }
14889
15182
 
14890
15183
  function joinUrl(baseUrl, path) {
14891
15184
  const normalizedBase = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl;
14892
15185
  const normalizedPath = path.startsWith('/') ? path : `/${path}`;
14893
15186
  return `${normalizedBase}${normalizedPath}`;
14894
15187
  }
14895
- async function fetchContact({ baseUrl, contactId, signal }) {
14896
- const url = joinUrl(baseUrl, `/contacts/${encodeURIComponent(contactId)}`);
15188
+ function getApiUrls(baseUrl, spaceId) {
15189
+ const encodedSpaceId = encodeURIComponent(spaceId);
15190
+ return {
15191
+ CONTACTS: joinUrl(baseUrl, `/contacts/${encodedSpaceId}`),
15192
+ MEDIA: joinUrl(baseUrl, `/media/${encodedSpaceId}`),
15193
+ SETTINGS: joinUrl(baseUrl, `/settings/${encodedSpaceId}`),
15194
+ };
15195
+ }
15196
+
15197
+ async function fetchLabels({ baseUrl, spaceId, signal }) {
15198
+ const urls = getApiUrls(baseUrl, spaceId);
15199
+ const url = joinUrl(urls.CONTACTS, '/labels');
15200
+ return requestJson({ url, signal });
15201
+ }
15202
+ async function fetchContact({ baseUrl, spaceId, contactId, signal }) {
15203
+ const urls = getApiUrls(baseUrl, spaceId);
15204
+ const url = joinUrl(urls.CONTACTS, `/contacts/${encodeURIComponent(contactId)}`);
15205
+ return requestJson({ url, signal });
15206
+ }
15207
+ async function updateEntity({ baseUrl, spaceId, entityType, entityId, body, signal }) {
15208
+ const path = entityType === 'business'
15209
+ ? `/business/${encodeURIComponent(entityId)}`
15210
+ : `/${encodeURIComponent(entityId)}`;
15211
+ const urls = getApiUrls(baseUrl, spaceId);
15212
+ const url = joinUrl(urls.CONTACTS, path);
15213
+ return requestJson({ url, method: 'PUT', body, signal });
15214
+ }
15215
+ async function deleteEntityPhoto({ baseUrl, spaceId, entityType, entityId, signal }) {
15216
+ const path = entityType === 'business'
15217
+ ? `/business/${encodeURIComponent(entityId)}/photo`
15218
+ : `/${encodeURIComponent(entityId)}/photo`;
15219
+ const urls = getApiUrls(baseUrl, spaceId);
15220
+ const url = joinUrl(urls.CONTACTS, path);
15221
+ return requestJson({ url, method: 'DELETE', signal });
15222
+ }
15223
+ async function fetchUserTrii({ baseUrl, spaceId, signal }) {
15224
+ const urls = getApiUrls(baseUrl, spaceId);
15225
+ const url = joinUrl(urls.SETTINGS, `/user`);
14897
15226
  return requestJson({ url, signal });
14898
15227
  }
15228
+ async function uploadAvatar({ baseUrl, spaceId, contactId, file, signal }) {
15229
+ const urls = getApiUrls(baseUrl, spaceId);
15230
+ const fd = new FormData();
15231
+ fd.append('file', file, file.name);
15232
+ const url = joinUrl(urls.MEDIA, `/upload?module=contacts&folderType=avatars&contactId=${encodeURIComponent(contactId)}`);
15233
+ return requestFormData({ url, formData: fd, signal });
15234
+ }
14899
15235
 
14900
15236
  /**
14901
15237
  * Type guard to check if an object is an IBusiness
@@ -14945,20 +15281,50 @@ function isContact(obj) {
14945
15281
  (!obj.businessId || typeof obj.businessId === 'string'));
14946
15282
  }
14947
15283
 
14948
- function useEditContactModalController({ open, baseUrl, contactId, }) {
15284
+ function useEditContactModalController({ open, baseUrl, spaceId, contactId, }) {
14949
15285
  const abortRef = useRef(null);
14950
15286
  const [state, setState] = useState({
14951
15287
  isLoading: false,
14952
15288
  error: null,
14953
15289
  contactData: null,
15290
+ labels: [],
15291
+ labelsLoading: false,
15292
+ labelsError: null,
14954
15293
  });
14955
- const canFetch = useMemo(() => Boolean(open && baseUrl && contactId), [open, baseUrl, contactId]);
15294
+ const canFetch = useMemo(() => Boolean(open && baseUrl && spaceId && contactId), [open, baseUrl, spaceId, contactId]);
14956
15295
  useEffect(() => {
14957
15296
  if (open)
14958
15297
  return;
14959
15298
  abortRef.current?.abort();
14960
- setState({ isLoading: false, error: null, contactData: null });
15299
+ setState({
15300
+ isLoading: false,
15301
+ error: null,
15302
+ contactData: null,
15303
+ labels: [],
15304
+ labelsLoading: false,
15305
+ labelsError: null,
15306
+ });
14961
15307
  }, [open]);
15308
+ const canFetchLabels = useMemo(() => Boolean(open && baseUrl && spaceId), [open, baseUrl, spaceId]);
15309
+ useEffect(() => {
15310
+ if (!canFetchLabels) {
15311
+ return;
15312
+ }
15313
+ const controller = new AbortController();
15314
+ setState((prev) => ({ ...prev, labelsLoading: true, labelsError: null }));
15315
+ fetchLabels({ baseUrl: baseUrl, spaceId: spaceId, signal: controller.signal })
15316
+ .then((labels) => {
15317
+ setState((prev) => ({ ...prev, labels, labelsLoading: false, labelsError: null }));
15318
+ })
15319
+ .catch((err) => {
15320
+ if (controller.signal.aborted)
15321
+ return;
15322
+ setState((prev) => ({ ...prev, labelsLoading: false, labelsError: err }));
15323
+ });
15324
+ return () => {
15325
+ controller.abort();
15326
+ };
15327
+ }, [canFetchLabels, baseUrl, spaceId]);
14962
15328
  useEffect(() => {
14963
15329
  if (!canFetch) {
14964
15330
  return;
@@ -14966,10 +15332,10 @@ function useEditContactModalController({ open, baseUrl, contactId, }) {
14966
15332
  abortRef.current?.abort();
14967
15333
  const controller = new AbortController();
14968
15334
  abortRef.current = controller;
14969
- setState({ isLoading: true, error: null, contactData: null });
14970
- fetchContact({ baseUrl: baseUrl, contactId: contactId, signal: controller.signal })
15335
+ setState((prev) => ({ ...prev, isLoading: true, error: null, contactData: null }));
15336
+ fetchContact({ baseUrl: baseUrl, spaceId: spaceId, contactId: contactId, signal: controller.signal })
14971
15337
  .then((data) => {
14972
- setState({ isLoading: false, error: null, contactData: data });
15338
+ setState((prev) => ({ ...prev, isLoading: false, error: null, contactData: data }));
14973
15339
  })
14974
15340
  .catch((err) => {
14975
15341
  if (controller.signal.aborted)
@@ -14979,7 +15345,7 @@ function useEditContactModalController({ open, baseUrl, contactId, }) {
14979
15345
  return () => {
14980
15346
  controller.abort();
14981
15347
  };
14982
- }, [canFetch, baseUrl, contactId]);
15348
+ }, [canFetch, baseUrl, spaceId, contactId]);
14983
15349
  const selectors = useMemo(() => {
14984
15350
  const contactData = state.contactData;
14985
15351
  const business = isBusiness(contactData);
@@ -14996,13 +15362,16 @@ function useEditContactModalController({ open, baseUrl, contactId, }) {
14996
15362
  else if (contact) {
14997
15363
  displayName = `${contactData.firstName} ${contactData.lastName}`.trim();
14998
15364
  }
15365
+ const tags = contactData?.tags ?? [];
14999
15366
  return {
15000
15367
  isBusiness: business,
15001
15368
  isContact: contact,
15002
15369
  contactType,
15003
15370
  displayName,
15371
+ tags,
15372
+ labels: state.labels,
15004
15373
  };
15005
- }, [state.contactData]);
15374
+ }, [state.contactData, state.labels]);
15006
15375
  return {
15007
15376
  state,
15008
15377
  selectors,
@@ -15013,14 +15382,2316 @@ function useEditContactModalController({ open, baseUrl, contactId, }) {
15013
15382
  };
15014
15383
  }
15015
15384
 
15016
- const EditContactModal = ({ open, onClose, baseUrl, contactId, sx,
15017
- // t
15018
- }) => {
15019
- const { state, selectors } = useEditContactModalController({
15020
- open,
15021
- baseUrl,
15022
- contactId,
15385
+ var ArrowBack = {};
15386
+
15387
+ var _interopRequireDefault$1 = interopRequireDefaultExports;
15388
+ Object.defineProperty(ArrowBack, "__esModule", {
15389
+ value: true
15390
+ });
15391
+ var default_1$1 = ArrowBack.default = void 0;
15392
+ var _createSvgIcon$1 = _interopRequireDefault$1(requireCreateSvgIcon());
15393
+ var _jsxRuntime$1 = jsxRuntimeExports;
15394
+ default_1$1 = ArrowBack.default = (0, _createSvgIcon$1.default)( /*#__PURE__*/(0, _jsxRuntime$1.jsx)("path", {
15395
+ d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"
15396
+ }), 'ArrowBack');
15397
+
15398
+ var Save = {};
15399
+
15400
+ var _interopRequireDefault = interopRequireDefaultExports;
15401
+ Object.defineProperty(Save, "__esModule", {
15402
+ value: true
15403
+ });
15404
+ var default_1 = Save.default = void 0;
15405
+ var _createSvgIcon = _interopRequireDefault(requireCreateSvgIcon());
15406
+ var _jsxRuntime = jsxRuntimeExports;
15407
+ default_1 = Save.default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
15408
+ d: "M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z"
15409
+ }), 'Save');
15410
+
15411
+ function _setPrototypeOf(o, p) {
15412
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
15413
+ o.__proto__ = p;
15414
+ return o;
15415
+ };
15416
+ return _setPrototypeOf(o, p);
15417
+ }
15418
+
15419
+ function _inheritsLoose(subClass, superClass) {
15420
+ subClass.prototype = Object.create(superClass.prototype);
15421
+ subClass.prototype.constructor = subClass;
15422
+ _setPrototypeOf(subClass, superClass);
15423
+ }
15424
+
15425
+ var TransitionGroupContext = React__default.createContext(null);
15426
+
15427
+ function _assertThisInitialized(self) {
15428
+ if (self === void 0) {
15429
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15430
+ }
15431
+ return self;
15432
+ }
15433
+
15434
+ /**
15435
+ * Given `this.props.children`, return an object mapping key to child.
15436
+ *
15437
+ * @param {*} children `this.props.children`
15438
+ * @return {object} Mapping of key to child
15439
+ */
15440
+
15441
+ function getChildMapping(children, mapFn) {
15442
+ var mapper = function mapper(child) {
15443
+ return mapFn && isValidElement(child) ? mapFn(child) : child;
15444
+ };
15445
+
15446
+ var result = Object.create(null);
15447
+ if (children) Children.map(children, function (c) {
15448
+ return c;
15449
+ }).forEach(function (child) {
15450
+ // run the map function here instead so that the key is the computed one
15451
+ result[child.key] = mapper(child);
15452
+ });
15453
+ return result;
15454
+ }
15455
+ /**
15456
+ * When you're adding or removing children some may be added or removed in the
15457
+ * same render pass. We want to show *both* since we want to simultaneously
15458
+ * animate elements in and out. This function takes a previous set of keys
15459
+ * and a new set of keys and merges them with its best guess of the correct
15460
+ * ordering. In the future we may expose some of the utilities in
15461
+ * ReactMultiChild to make this easy, but for now React itself does not
15462
+ * directly have this concept of the union of prevChildren and nextChildren
15463
+ * so we implement it here.
15464
+ *
15465
+ * @param {object} prev prev children as returned from
15466
+ * `ReactTransitionChildMapping.getChildMapping()`.
15467
+ * @param {object} next next children as returned from
15468
+ * `ReactTransitionChildMapping.getChildMapping()`.
15469
+ * @return {object} a key set that contains all keys in `prev` and all keys
15470
+ * in `next` in a reasonable order.
15471
+ */
15472
+
15473
+ function mergeChildMappings(prev, next) {
15474
+ prev = prev || {};
15475
+ next = next || {};
15476
+
15477
+ function getValueForKey(key) {
15478
+ return key in next ? next[key] : prev[key];
15479
+ } // For each key of `next`, the list of keys to insert before that key in
15480
+ // the combined list
15481
+
15482
+
15483
+ var nextKeysPending = Object.create(null);
15484
+ var pendingKeys = [];
15485
+
15486
+ for (var prevKey in prev) {
15487
+ if (prevKey in next) {
15488
+ if (pendingKeys.length) {
15489
+ nextKeysPending[prevKey] = pendingKeys;
15490
+ pendingKeys = [];
15491
+ }
15492
+ } else {
15493
+ pendingKeys.push(prevKey);
15494
+ }
15495
+ }
15496
+
15497
+ var i;
15498
+ var childMapping = {};
15499
+
15500
+ for (var nextKey in next) {
15501
+ if (nextKeysPending[nextKey]) {
15502
+ for (i = 0; i < nextKeysPending[nextKey].length; i++) {
15503
+ var pendingNextKey = nextKeysPending[nextKey][i];
15504
+ childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
15505
+ }
15506
+ }
15507
+
15508
+ childMapping[nextKey] = getValueForKey(nextKey);
15509
+ } // Finally, add the keys which didn't appear before any key in `next`
15510
+
15511
+
15512
+ for (i = 0; i < pendingKeys.length; i++) {
15513
+ childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
15514
+ }
15515
+
15516
+ return childMapping;
15517
+ }
15518
+
15519
+ function getProp(child, prop, props) {
15520
+ return props[prop] != null ? props[prop] : child.props[prop];
15521
+ }
15522
+
15523
+ function getInitialChildMapping(props, onExited) {
15524
+ return getChildMapping(props.children, function (child) {
15525
+ return cloneElement(child, {
15526
+ onExited: onExited.bind(null, child),
15527
+ in: true,
15528
+ appear: getProp(child, 'appear', props),
15529
+ enter: getProp(child, 'enter', props),
15530
+ exit: getProp(child, 'exit', props)
15531
+ });
15532
+ });
15533
+ }
15534
+ function getNextChildMapping(nextProps, prevChildMapping, onExited) {
15535
+ var nextChildMapping = getChildMapping(nextProps.children);
15536
+ var children = mergeChildMappings(prevChildMapping, nextChildMapping);
15537
+ Object.keys(children).forEach(function (key) {
15538
+ var child = children[key];
15539
+ if (!isValidElement(child)) return;
15540
+ var hasPrev = (key in prevChildMapping);
15541
+ var hasNext = (key in nextChildMapping);
15542
+ var prevChild = prevChildMapping[key];
15543
+ var isLeaving = isValidElement(prevChild) && !prevChild.props.in; // item is new (entering)
15544
+
15545
+ if (hasNext && (!hasPrev || isLeaving)) {
15546
+ // console.log('entering', key)
15547
+ children[key] = cloneElement(child, {
15548
+ onExited: onExited.bind(null, child),
15549
+ in: true,
15550
+ exit: getProp(child, 'exit', nextProps),
15551
+ enter: getProp(child, 'enter', nextProps)
15552
+ });
15553
+ } else if (!hasNext && hasPrev && !isLeaving) {
15554
+ // item is old (exiting)
15555
+ // console.log('leaving', key)
15556
+ children[key] = cloneElement(child, {
15557
+ in: false
15558
+ });
15559
+ } else if (hasNext && hasPrev && isValidElement(prevChild)) {
15560
+ // item hasn't changed transition states
15561
+ // copy over the last transition props;
15562
+ // console.log('unchanged', key)
15563
+ children[key] = cloneElement(child, {
15564
+ onExited: onExited.bind(null, child),
15565
+ in: prevChild.props.in,
15566
+ exit: getProp(child, 'exit', nextProps),
15567
+ enter: getProp(child, 'enter', nextProps)
15568
+ });
15569
+ }
15570
+ });
15571
+ return children;
15572
+ }
15573
+
15574
+ var values = Object.values || function (obj) {
15575
+ return Object.keys(obj).map(function (k) {
15576
+ return obj[k];
15577
+ });
15578
+ };
15579
+
15580
+ var defaultProps = {
15581
+ component: 'div',
15582
+ childFactory: function childFactory(child) {
15583
+ return child;
15584
+ }
15585
+ };
15586
+ /**
15587
+ * The `<TransitionGroup>` component manages a set of transition components
15588
+ * (`<Transition>` and `<CSSTransition>`) in a list. Like with the transition
15589
+ * components, `<TransitionGroup>` is a state machine for managing the mounting
15590
+ * and unmounting of components over time.
15591
+ *
15592
+ * Consider the example below. As items are removed or added to the TodoList the
15593
+ * `in` prop is toggled automatically by the `<TransitionGroup>`.
15594
+ *
15595
+ * Note that `<TransitionGroup>` does not define any animation behavior!
15596
+ * Exactly _how_ a list item animates is up to the individual transition
15597
+ * component. This means you can mix and match animations across different list
15598
+ * items.
15599
+ */
15600
+
15601
+ var TransitionGroup = /*#__PURE__*/function (_React$Component) {
15602
+ _inheritsLoose(TransitionGroup, _React$Component);
15603
+
15604
+ function TransitionGroup(props, context) {
15605
+ var _this;
15606
+
15607
+ _this = _React$Component.call(this, props, context) || this;
15608
+
15609
+ var handleExited = _this.handleExited.bind(_assertThisInitialized(_this)); // Initial children should all be entering, dependent on appear
15610
+
15611
+
15612
+ _this.state = {
15613
+ contextValue: {
15614
+ isMounting: true
15615
+ },
15616
+ handleExited: handleExited,
15617
+ firstRender: true
15618
+ };
15619
+ return _this;
15620
+ }
15621
+
15622
+ var _proto = TransitionGroup.prototype;
15623
+
15624
+ _proto.componentDidMount = function componentDidMount() {
15625
+ this.mounted = true;
15626
+ this.setState({
15627
+ contextValue: {
15628
+ isMounting: false
15629
+ }
15023
15630
  });
15631
+ };
15632
+
15633
+ _proto.componentWillUnmount = function componentWillUnmount() {
15634
+ this.mounted = false;
15635
+ };
15636
+
15637
+ TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
15638
+ var prevChildMapping = _ref.children,
15639
+ handleExited = _ref.handleExited,
15640
+ firstRender = _ref.firstRender;
15641
+ return {
15642
+ children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited),
15643
+ firstRender: false
15644
+ };
15645
+ } // node is `undefined` when user provided `nodeRef` prop
15646
+ ;
15647
+
15648
+ _proto.handleExited = function handleExited(child, node) {
15649
+ var currentChildMapping = getChildMapping(this.props.children);
15650
+ if (child.key in currentChildMapping) return;
15651
+
15652
+ if (child.props.onExited) {
15653
+ child.props.onExited(node);
15654
+ }
15655
+
15656
+ if (this.mounted) {
15657
+ this.setState(function (state) {
15658
+ var children = _extends$1({}, state.children);
15659
+
15660
+ delete children[child.key];
15661
+ return {
15662
+ children: children
15663
+ };
15664
+ });
15665
+ }
15666
+ };
15667
+
15668
+ _proto.render = function render() {
15669
+ var _this$props = this.props,
15670
+ Component = _this$props.component,
15671
+ childFactory = _this$props.childFactory,
15672
+ props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
15673
+
15674
+ var contextValue = this.state.contextValue;
15675
+ var children = values(this.state.children).map(childFactory);
15676
+ delete props.appear;
15677
+ delete props.enter;
15678
+ delete props.exit;
15679
+
15680
+ if (Component === null) {
15681
+ return /*#__PURE__*/React__default.createElement(TransitionGroupContext.Provider, {
15682
+ value: contextValue
15683
+ }, children);
15684
+ }
15685
+
15686
+ return /*#__PURE__*/React__default.createElement(TransitionGroupContext.Provider, {
15687
+ value: contextValue
15688
+ }, /*#__PURE__*/React__default.createElement(Component, props, children));
15689
+ };
15690
+
15691
+ return TransitionGroup;
15692
+ }(React__default.Component);
15693
+
15694
+ TransitionGroup.propTypes = process.env.NODE_ENV !== "production" ? {
15695
+ /**
15696
+ * `<TransitionGroup>` renders a `<div>` by default. You can change this
15697
+ * behavior by providing a `component` prop.
15698
+ * If you use React v16+ and would like to avoid a wrapping `<div>` element
15699
+ * you can pass in `component={null}`. This is useful if the wrapping div
15700
+ * borks your css styles.
15701
+ */
15702
+ component: PropTypes.any,
15703
+
15704
+ /**
15705
+ * A set of `<Transition>` components, that are toggled `in` and out as they
15706
+ * leave. the `<TransitionGroup>` will inject specific transition props, so
15707
+ * remember to spread them through if you are wrapping the `<Transition>` as
15708
+ * with our `<Fade>` example.
15709
+ *
15710
+ * While this component is meant for multiple `Transition` or `CSSTransition`
15711
+ * children, sometimes you may want to have a single transition child with
15712
+ * content that you want to be transitioned out and in when you change it
15713
+ * (e.g. routes, images etc.) In that case you can change the `key` prop of
15714
+ * the transition child as you change its content, this will cause
15715
+ * `TransitionGroup` to transition the child out and back in.
15716
+ */
15717
+ children: PropTypes.node,
15718
+
15719
+ /**
15720
+ * A convenience prop that enables or disables appear animations
15721
+ * for all children. Note that specifying this will override any defaults set
15722
+ * on individual children Transitions.
15723
+ */
15724
+ appear: PropTypes.bool,
15725
+
15726
+ /**
15727
+ * A convenience prop that enables or disables enter animations
15728
+ * for all children. Note that specifying this will override any defaults set
15729
+ * on individual children Transitions.
15730
+ */
15731
+ enter: PropTypes.bool,
15732
+
15733
+ /**
15734
+ * A convenience prop that enables or disables exit animations
15735
+ * for all children. Note that specifying this will override any defaults set
15736
+ * on individual children Transitions.
15737
+ */
15738
+ exit: PropTypes.bool,
15739
+
15740
+ /**
15741
+ * You may need to apply reactive updates to a child as it is exiting.
15742
+ * This is generally done by using `cloneElement` however in the case of an exiting
15743
+ * child the element has already been removed and not accessible to the consumer.
15744
+ *
15745
+ * If you do need to update a child as it leaves you can provide a `childFactory`
15746
+ * to wrap every child, even the ones that are leaving.
15747
+ *
15748
+ * @type Function(child: ReactElement) -> ReactElement
15749
+ */
15750
+ childFactory: PropTypes.func
15751
+ } : {};
15752
+ TransitionGroup.defaultProps = defaultProps;
15753
+ var TransitionGroup$1 = TransitionGroup;
15754
+
15755
+ function Ripple(props) {
15756
+ const {
15757
+ className,
15758
+ classes,
15759
+ pulsate = false,
15760
+ rippleX,
15761
+ rippleY,
15762
+ rippleSize,
15763
+ in: inProp,
15764
+ onExited,
15765
+ timeout
15766
+ } = props;
15767
+ const [leaving, setLeaving] = React.useState(false);
15768
+ const rippleClassName = clsx(className, classes.ripple, classes.rippleVisible, pulsate && classes.ripplePulsate);
15769
+ const rippleStyles = {
15770
+ width: rippleSize,
15771
+ height: rippleSize,
15772
+ top: -(rippleSize / 2) + rippleY,
15773
+ left: -(rippleSize / 2) + rippleX
15774
+ };
15775
+ const childClassName = clsx(classes.child, leaving && classes.childLeaving, pulsate && classes.childPulsate);
15776
+ if (!inProp && !leaving) {
15777
+ setLeaving(true);
15778
+ }
15779
+ React.useEffect(() => {
15780
+ if (!inProp && onExited != null) {
15781
+ // react-transition-group#onExited
15782
+ const timeoutId = setTimeout(onExited, timeout);
15783
+ return () => {
15784
+ clearTimeout(timeoutId);
15785
+ };
15786
+ }
15787
+ return undefined;
15788
+ }, [onExited, inProp, timeout]);
15789
+ return /*#__PURE__*/jsxRuntimeExports.jsx("span", {
15790
+ className: rippleClassName,
15791
+ style: rippleStyles,
15792
+ children: /*#__PURE__*/jsxRuntimeExports.jsx("span", {
15793
+ className: childClassName
15794
+ })
15795
+ });
15796
+ }
15797
+ process.env.NODE_ENV !== "production" ? Ripple.propTypes = {
15798
+ /**
15799
+ * Override or extend the styles applied to the component.
15800
+ */
15801
+ classes: PropTypes.object.isRequired,
15802
+ className: PropTypes.string,
15803
+ /**
15804
+ * @ignore - injected from TransitionGroup
15805
+ */
15806
+ in: PropTypes.bool,
15807
+ /**
15808
+ * @ignore - injected from TransitionGroup
15809
+ */
15810
+ onExited: PropTypes.func,
15811
+ /**
15812
+ * If `true`, the ripple pulsates, typically indicating the keyboard focus state of an element.
15813
+ */
15814
+ pulsate: PropTypes.bool,
15815
+ /**
15816
+ * Diameter of the ripple.
15817
+ */
15818
+ rippleSize: PropTypes.number,
15819
+ /**
15820
+ * Horizontal position of the ripple center.
15821
+ */
15822
+ rippleX: PropTypes.number,
15823
+ /**
15824
+ * Vertical position of the ripple center.
15825
+ */
15826
+ rippleY: PropTypes.number,
15827
+ /**
15828
+ * exit delay
15829
+ */
15830
+ timeout: PropTypes.number.isRequired
15831
+ } : void 0;
15832
+
15833
+ const touchRippleClasses = generateUtilityClasses('MuiTouchRipple', ['root', 'ripple', 'rippleVisible', 'ripplePulsate', 'child', 'childLeaving', 'childPulsate']);
15834
+ var touchRippleClasses$1 = touchRippleClasses;
15835
+
15836
+ const _excluded$4 = ["center", "classes", "className"];
15837
+ let _$1 = t => t,
15838
+ _t$1,
15839
+ _t2$1,
15840
+ _t3$1,
15841
+ _t4$1;
15842
+ const DURATION = 550;
15843
+ const DELAY_RIPPLE = 80;
15844
+ const enterKeyframe = keyframes(_t$1 || (_t$1 = _$1`
15845
+ 0% {
15846
+ transform: scale(0);
15847
+ opacity: 0.1;
15848
+ }
15849
+
15850
+ 100% {
15851
+ transform: scale(1);
15852
+ opacity: 0.3;
15853
+ }
15854
+ `));
15855
+ const exitKeyframe = keyframes(_t2$1 || (_t2$1 = _$1`
15856
+ 0% {
15857
+ opacity: 1;
15858
+ }
15859
+
15860
+ 100% {
15861
+ opacity: 0;
15862
+ }
15863
+ `));
15864
+ const pulsateKeyframe = keyframes(_t3$1 || (_t3$1 = _$1`
15865
+ 0% {
15866
+ transform: scale(1);
15867
+ }
15868
+
15869
+ 50% {
15870
+ transform: scale(0.92);
15871
+ }
15872
+
15873
+ 100% {
15874
+ transform: scale(1);
15875
+ }
15876
+ `));
15877
+ const TouchRippleRoot = styled$1('span', {
15878
+ name: 'MuiTouchRipple',
15879
+ slot: 'Root'
15880
+ })({
15881
+ overflow: 'hidden',
15882
+ pointerEvents: 'none',
15883
+ position: 'absolute',
15884
+ zIndex: 0,
15885
+ top: 0,
15886
+ right: 0,
15887
+ bottom: 0,
15888
+ left: 0,
15889
+ borderRadius: 'inherit'
15890
+ });
15891
+
15892
+ // This `styled()` function invokes keyframes. `styled-components` only supports keyframes
15893
+ // in string templates. Do not convert these styles in JS object as it will break.
15894
+ const TouchRippleRipple = styled$1(Ripple, {
15895
+ name: 'MuiTouchRipple',
15896
+ slot: 'Ripple'
15897
+ })(_t4$1 || (_t4$1 = _$1`
15898
+ opacity: 0;
15899
+ position: absolute;
15900
+
15901
+ &.${0} {
15902
+ opacity: 0.3;
15903
+ transform: scale(1);
15904
+ animation-name: ${0};
15905
+ animation-duration: ${0}ms;
15906
+ animation-timing-function: ${0};
15907
+ }
15908
+
15909
+ &.${0} {
15910
+ animation-duration: ${0}ms;
15911
+ }
15912
+
15913
+ & .${0} {
15914
+ opacity: 1;
15915
+ display: block;
15916
+ width: 100%;
15917
+ height: 100%;
15918
+ border-radius: 50%;
15919
+ background-color: currentColor;
15920
+ }
15921
+
15922
+ & .${0} {
15923
+ opacity: 0;
15924
+ animation-name: ${0};
15925
+ animation-duration: ${0}ms;
15926
+ animation-timing-function: ${0};
15927
+ }
15928
+
15929
+ & .${0} {
15930
+ position: absolute;
15931
+ /* @noflip */
15932
+ left: 0px;
15933
+ top: 0;
15934
+ animation-name: ${0};
15935
+ animation-duration: 2500ms;
15936
+ animation-timing-function: ${0};
15937
+ animation-iteration-count: infinite;
15938
+ animation-delay: 200ms;
15939
+ }
15940
+ `), touchRippleClasses$1.rippleVisible, enterKeyframe, DURATION, ({
15941
+ theme
15942
+ }) => theme.transitions.easing.easeInOut, touchRippleClasses$1.ripplePulsate, ({
15943
+ theme
15944
+ }) => theme.transitions.duration.shorter, touchRippleClasses$1.child, touchRippleClasses$1.childLeaving, exitKeyframe, DURATION, ({
15945
+ theme
15946
+ }) => theme.transitions.easing.easeInOut, touchRippleClasses$1.childPulsate, pulsateKeyframe, ({
15947
+ theme
15948
+ }) => theme.transitions.easing.easeInOut);
15949
+
15950
+ /**
15951
+ * @ignore - internal component.
15952
+ *
15953
+ * TODO v5: Make private
15954
+ */
15955
+ const TouchRipple = /*#__PURE__*/React.forwardRef(function TouchRipple(inProps, ref) {
15956
+ const props = useDefaultProps({
15957
+ props: inProps,
15958
+ name: 'MuiTouchRipple'
15959
+ });
15960
+ const {
15961
+ center: centerProp = false,
15962
+ classes = {},
15963
+ className
15964
+ } = props,
15965
+ other = _objectWithoutPropertiesLoose(props, _excluded$4);
15966
+ const [ripples, setRipples] = React.useState([]);
15967
+ const nextKey = React.useRef(0);
15968
+ const rippleCallback = React.useRef(null);
15969
+ React.useEffect(() => {
15970
+ if (rippleCallback.current) {
15971
+ rippleCallback.current();
15972
+ rippleCallback.current = null;
15973
+ }
15974
+ }, [ripples]);
15975
+
15976
+ // Used to filter out mouse emulated events on mobile.
15977
+ const ignoringMouseDown = React.useRef(false);
15978
+ // We use a timer in order to only show the ripples for touch "click" like events.
15979
+ // We don't want to display the ripple for touch scroll events.
15980
+ const startTimer = useTimeout();
15981
+
15982
+ // This is the hook called once the previous timeout is ready.
15983
+ const startTimerCommit = React.useRef(null);
15984
+ const container = React.useRef(null);
15985
+ const startCommit = React.useCallback(params => {
15986
+ const {
15987
+ pulsate,
15988
+ rippleX,
15989
+ rippleY,
15990
+ rippleSize,
15991
+ cb
15992
+ } = params;
15993
+ setRipples(oldRipples => [...oldRipples, /*#__PURE__*/jsxRuntimeExports.jsx(TouchRippleRipple, {
15994
+ classes: {
15995
+ ripple: clsx(classes.ripple, touchRippleClasses$1.ripple),
15996
+ rippleVisible: clsx(classes.rippleVisible, touchRippleClasses$1.rippleVisible),
15997
+ ripplePulsate: clsx(classes.ripplePulsate, touchRippleClasses$1.ripplePulsate),
15998
+ child: clsx(classes.child, touchRippleClasses$1.child),
15999
+ childLeaving: clsx(classes.childLeaving, touchRippleClasses$1.childLeaving),
16000
+ childPulsate: clsx(classes.childPulsate, touchRippleClasses$1.childPulsate)
16001
+ },
16002
+ timeout: DURATION,
16003
+ pulsate: pulsate,
16004
+ rippleX: rippleX,
16005
+ rippleY: rippleY,
16006
+ rippleSize: rippleSize
16007
+ }, nextKey.current)]);
16008
+ nextKey.current += 1;
16009
+ rippleCallback.current = cb;
16010
+ }, [classes]);
16011
+ const start = React.useCallback((event = {}, options = {}, cb = () => {}) => {
16012
+ const {
16013
+ pulsate = false,
16014
+ center = centerProp || options.pulsate,
16015
+ fakeElement = false // For test purposes
16016
+ } = options;
16017
+ if ((event == null ? void 0 : event.type) === 'mousedown' && ignoringMouseDown.current) {
16018
+ ignoringMouseDown.current = false;
16019
+ return;
16020
+ }
16021
+ if ((event == null ? void 0 : event.type) === 'touchstart') {
16022
+ ignoringMouseDown.current = true;
16023
+ }
16024
+ const element = fakeElement ? null : container.current;
16025
+ const rect = element ? element.getBoundingClientRect() : {
16026
+ width: 0,
16027
+ height: 0,
16028
+ left: 0,
16029
+ top: 0
16030
+ };
16031
+
16032
+ // Get the size of the ripple
16033
+ let rippleX;
16034
+ let rippleY;
16035
+ let rippleSize;
16036
+ if (center || event === undefined || event.clientX === 0 && event.clientY === 0 || !event.clientX && !event.touches) {
16037
+ rippleX = Math.round(rect.width / 2);
16038
+ rippleY = Math.round(rect.height / 2);
16039
+ } else {
16040
+ const {
16041
+ clientX,
16042
+ clientY
16043
+ } = event.touches && event.touches.length > 0 ? event.touches[0] : event;
16044
+ rippleX = Math.round(clientX - rect.left);
16045
+ rippleY = Math.round(clientY - rect.top);
16046
+ }
16047
+ if (center) {
16048
+ rippleSize = Math.sqrt((2 * rect.width ** 2 + rect.height ** 2) / 3);
16049
+
16050
+ // For some reason the animation is broken on Mobile Chrome if the size is even.
16051
+ if (rippleSize % 2 === 0) {
16052
+ rippleSize += 1;
16053
+ }
16054
+ } else {
16055
+ const sizeX = Math.max(Math.abs((element ? element.clientWidth : 0) - rippleX), rippleX) * 2 + 2;
16056
+ const sizeY = Math.max(Math.abs((element ? element.clientHeight : 0) - rippleY), rippleY) * 2 + 2;
16057
+ rippleSize = Math.sqrt(sizeX ** 2 + sizeY ** 2);
16058
+ }
16059
+
16060
+ // Touche devices
16061
+ if (event != null && event.touches) {
16062
+ // check that this isn't another touchstart due to multitouch
16063
+ // otherwise we will only clear a single timer when unmounting while two
16064
+ // are running
16065
+ if (startTimerCommit.current === null) {
16066
+ // Prepare the ripple effect.
16067
+ startTimerCommit.current = () => {
16068
+ startCommit({
16069
+ pulsate,
16070
+ rippleX,
16071
+ rippleY,
16072
+ rippleSize,
16073
+ cb
16074
+ });
16075
+ };
16076
+ // Delay the execution of the ripple effect.
16077
+ // We have to make a tradeoff with this delay value.
16078
+ startTimer.start(DELAY_RIPPLE, () => {
16079
+ if (startTimerCommit.current) {
16080
+ startTimerCommit.current();
16081
+ startTimerCommit.current = null;
16082
+ }
16083
+ });
16084
+ }
16085
+ } else {
16086
+ startCommit({
16087
+ pulsate,
16088
+ rippleX,
16089
+ rippleY,
16090
+ rippleSize,
16091
+ cb
16092
+ });
16093
+ }
16094
+ }, [centerProp, startCommit, startTimer]);
16095
+ const pulsate = React.useCallback(() => {
16096
+ start({}, {
16097
+ pulsate: true
16098
+ });
16099
+ }, [start]);
16100
+ const stop = React.useCallback((event, cb) => {
16101
+ startTimer.clear();
16102
+
16103
+ // The touch interaction occurs too quickly.
16104
+ // We still want to show ripple effect.
16105
+ if ((event == null ? void 0 : event.type) === 'touchend' && startTimerCommit.current) {
16106
+ startTimerCommit.current();
16107
+ startTimerCommit.current = null;
16108
+ startTimer.start(0, () => {
16109
+ stop(event, cb);
16110
+ });
16111
+ return;
16112
+ }
16113
+ startTimerCommit.current = null;
16114
+ setRipples(oldRipples => {
16115
+ if (oldRipples.length > 0) {
16116
+ return oldRipples.slice(1);
16117
+ }
16118
+ return oldRipples;
16119
+ });
16120
+ rippleCallback.current = cb;
16121
+ }, [startTimer]);
16122
+ React.useImperativeHandle(ref, () => ({
16123
+ pulsate,
16124
+ start,
16125
+ stop
16126
+ }), [pulsate, start, stop]);
16127
+ return /*#__PURE__*/jsxRuntimeExports.jsx(TouchRippleRoot, _extends$1({
16128
+ className: clsx(touchRippleClasses$1.root, classes.root, className),
16129
+ ref: container
16130
+ }, other, {
16131
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(TransitionGroup$1, {
16132
+ component: null,
16133
+ exit: true,
16134
+ children: ripples
16135
+ })
16136
+ }));
16137
+ });
16138
+ process.env.NODE_ENV !== "production" ? TouchRipple.propTypes = {
16139
+ /**
16140
+ * If `true`, the ripple starts at the center of the component
16141
+ * rather than at the point of interaction.
16142
+ */
16143
+ center: PropTypes.bool,
16144
+ /**
16145
+ * Override or extend the styles applied to the component.
16146
+ */
16147
+ classes: PropTypes.object,
16148
+ /**
16149
+ * @ignore
16150
+ */
16151
+ className: PropTypes.string
16152
+ } : void 0;
16153
+ var TouchRipple$1 = TouchRipple;
16154
+
16155
+ function getButtonBaseUtilityClass(slot) {
16156
+ return generateUtilityClass('MuiButtonBase', slot);
16157
+ }
16158
+ const buttonBaseClasses = generateUtilityClasses('MuiButtonBase', ['root', 'disabled', 'focusVisible']);
16159
+ var buttonBaseClasses$1 = buttonBaseClasses;
16160
+
16161
+ const _excluded$3 = ["action", "centerRipple", "children", "className", "component", "disabled", "disableRipple", "disableTouchRipple", "focusRipple", "focusVisibleClassName", "LinkComponent", "onBlur", "onClick", "onContextMenu", "onDragLeave", "onFocus", "onFocusVisible", "onKeyDown", "onKeyUp", "onMouseDown", "onMouseLeave", "onMouseUp", "onTouchEnd", "onTouchMove", "onTouchStart", "tabIndex", "TouchRippleProps", "touchRippleRef", "type"];
16162
+ const useUtilityClasses$3 = ownerState => {
16163
+ const {
16164
+ disabled,
16165
+ focusVisible,
16166
+ focusVisibleClassName,
16167
+ classes
16168
+ } = ownerState;
16169
+ const slots = {
16170
+ root: ['root', disabled && 'disabled', focusVisible && 'focusVisible']
16171
+ };
16172
+ const composedClasses = composeClasses(slots, getButtonBaseUtilityClass, classes);
16173
+ if (focusVisible && focusVisibleClassName) {
16174
+ composedClasses.root += ` ${focusVisibleClassName}`;
16175
+ }
16176
+ return composedClasses;
16177
+ };
16178
+ const ButtonBaseRoot = styled$1('button', {
16179
+ name: 'MuiButtonBase',
16180
+ slot: 'Root',
16181
+ overridesResolver: (props, styles) => styles.root
16182
+ })({
16183
+ display: 'inline-flex',
16184
+ alignItems: 'center',
16185
+ justifyContent: 'center',
16186
+ position: 'relative',
16187
+ boxSizing: 'border-box',
16188
+ WebkitTapHighlightColor: 'transparent',
16189
+ backgroundColor: 'transparent',
16190
+ // Reset default value
16191
+ // We disable the focus ring for mouse, touch and keyboard users.
16192
+ outline: 0,
16193
+ border: 0,
16194
+ margin: 0,
16195
+ // Remove the margin in Safari
16196
+ borderRadius: 0,
16197
+ padding: 0,
16198
+ // Remove the padding in Firefox
16199
+ cursor: 'pointer',
16200
+ userSelect: 'none',
16201
+ verticalAlign: 'middle',
16202
+ MozAppearance: 'none',
16203
+ // Reset
16204
+ WebkitAppearance: 'none',
16205
+ // Reset
16206
+ textDecoration: 'none',
16207
+ // So we take precedent over the style of a native <a /> element.
16208
+ color: 'inherit',
16209
+ '&::-moz-focus-inner': {
16210
+ borderStyle: 'none' // Remove Firefox dotted outline.
16211
+ },
16212
+ [`&.${buttonBaseClasses$1.disabled}`]: {
16213
+ pointerEvents: 'none',
16214
+ // Disable link interactions
16215
+ cursor: 'default'
16216
+ },
16217
+ '@media print': {
16218
+ colorAdjust: 'exact'
16219
+ }
16220
+ });
16221
+
16222
+ /**
16223
+ * `ButtonBase` contains as few styles as possible.
16224
+ * It aims to be a simple building block for creating a button.
16225
+ * It contains a load of style reset and some focus/ripple logic.
16226
+ */
16227
+ const ButtonBase = /*#__PURE__*/React.forwardRef(function ButtonBase(inProps, ref) {
16228
+ const props = useDefaultProps({
16229
+ props: inProps,
16230
+ name: 'MuiButtonBase'
16231
+ });
16232
+ const {
16233
+ action,
16234
+ centerRipple = false,
16235
+ children,
16236
+ className,
16237
+ component = 'button',
16238
+ disabled = false,
16239
+ disableRipple = false,
16240
+ disableTouchRipple = false,
16241
+ focusRipple = false,
16242
+ LinkComponent = 'a',
16243
+ onBlur,
16244
+ onClick,
16245
+ onContextMenu,
16246
+ onDragLeave,
16247
+ onFocus,
16248
+ onFocusVisible,
16249
+ onKeyDown,
16250
+ onKeyUp,
16251
+ onMouseDown,
16252
+ onMouseLeave,
16253
+ onMouseUp,
16254
+ onTouchEnd,
16255
+ onTouchMove,
16256
+ onTouchStart,
16257
+ tabIndex = 0,
16258
+ TouchRippleProps,
16259
+ touchRippleRef,
16260
+ type
16261
+ } = props,
16262
+ other = _objectWithoutPropertiesLoose(props, _excluded$3);
16263
+ const buttonRef = React.useRef(null);
16264
+ const rippleRef = React.useRef(null);
16265
+ const handleRippleRef = useForkRef(rippleRef, touchRippleRef);
16266
+ const {
16267
+ isFocusVisibleRef,
16268
+ onFocus: handleFocusVisible,
16269
+ onBlur: handleBlurVisible,
16270
+ ref: focusVisibleRef
16271
+ } = useIsFocusVisible();
16272
+ const [focusVisible, setFocusVisible] = React.useState(false);
16273
+ if (disabled && focusVisible) {
16274
+ setFocusVisible(false);
16275
+ }
16276
+ React.useImperativeHandle(action, () => ({
16277
+ focusVisible: () => {
16278
+ setFocusVisible(true);
16279
+ buttonRef.current.focus();
16280
+ }
16281
+ }), []);
16282
+ const [mountedState, setMountedState] = React.useState(false);
16283
+ React.useEffect(() => {
16284
+ setMountedState(true);
16285
+ }, []);
16286
+ const enableTouchRipple = mountedState && !disableRipple && !disabled;
16287
+ React.useEffect(() => {
16288
+ if (focusVisible && focusRipple && !disableRipple && mountedState) {
16289
+ rippleRef.current.pulsate();
16290
+ }
16291
+ }, [disableRipple, focusRipple, focusVisible, mountedState]);
16292
+ function useRippleHandler(rippleAction, eventCallback, skipRippleAction = disableTouchRipple) {
16293
+ return useEventCallback(event => {
16294
+ if (eventCallback) {
16295
+ eventCallback(event);
16296
+ }
16297
+ const ignore = skipRippleAction;
16298
+ if (!ignore && rippleRef.current) {
16299
+ rippleRef.current[rippleAction](event);
16300
+ }
16301
+ return true;
16302
+ });
16303
+ }
16304
+ const handleMouseDown = useRippleHandler('start', onMouseDown);
16305
+ const handleContextMenu = useRippleHandler('stop', onContextMenu);
16306
+ const handleDragLeave = useRippleHandler('stop', onDragLeave);
16307
+ const handleMouseUp = useRippleHandler('stop', onMouseUp);
16308
+ const handleMouseLeave = useRippleHandler('stop', event => {
16309
+ if (focusVisible) {
16310
+ event.preventDefault();
16311
+ }
16312
+ if (onMouseLeave) {
16313
+ onMouseLeave(event);
16314
+ }
16315
+ });
16316
+ const handleTouchStart = useRippleHandler('start', onTouchStart);
16317
+ const handleTouchEnd = useRippleHandler('stop', onTouchEnd);
16318
+ const handleTouchMove = useRippleHandler('stop', onTouchMove);
16319
+ const handleBlur = useRippleHandler('stop', event => {
16320
+ handleBlurVisible(event);
16321
+ if (isFocusVisibleRef.current === false) {
16322
+ setFocusVisible(false);
16323
+ }
16324
+ if (onBlur) {
16325
+ onBlur(event);
16326
+ }
16327
+ }, false);
16328
+ const handleFocus = useEventCallback(event => {
16329
+ // Fix for https://github.com/facebook/react/issues/7769
16330
+ if (!buttonRef.current) {
16331
+ buttonRef.current = event.currentTarget;
16332
+ }
16333
+ handleFocusVisible(event);
16334
+ if (isFocusVisibleRef.current === true) {
16335
+ setFocusVisible(true);
16336
+ if (onFocusVisible) {
16337
+ onFocusVisible(event);
16338
+ }
16339
+ }
16340
+ if (onFocus) {
16341
+ onFocus(event);
16342
+ }
16343
+ });
16344
+ const isNonNativeButton = () => {
16345
+ const button = buttonRef.current;
16346
+ return component && component !== 'button' && !(button.tagName === 'A' && button.href);
16347
+ };
16348
+
16349
+ /**
16350
+ * IE11 shim for https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat
16351
+ */
16352
+ const keydownRef = React.useRef(false);
16353
+ const handleKeyDown = useEventCallback(event => {
16354
+ // Check if key is already down to avoid repeats being counted as multiple activations
16355
+ if (focusRipple && !keydownRef.current && focusVisible && rippleRef.current && event.key === ' ') {
16356
+ keydownRef.current = true;
16357
+ rippleRef.current.stop(event, () => {
16358
+ rippleRef.current.start(event);
16359
+ });
16360
+ }
16361
+ if (event.target === event.currentTarget && isNonNativeButton() && event.key === ' ') {
16362
+ event.preventDefault();
16363
+ }
16364
+ if (onKeyDown) {
16365
+ onKeyDown(event);
16366
+ }
16367
+
16368
+ // Keyboard accessibility for non interactive elements
16369
+ if (event.target === event.currentTarget && isNonNativeButton() && event.key === 'Enter' && !disabled) {
16370
+ event.preventDefault();
16371
+ if (onClick) {
16372
+ onClick(event);
16373
+ }
16374
+ }
16375
+ });
16376
+ const handleKeyUp = useEventCallback(event => {
16377
+ // calling preventDefault in keyUp on a <button> will not dispatch a click event if Space is pressed
16378
+ // https://codesandbox.io/p/sandbox/button-keyup-preventdefault-dn7f0
16379
+ if (focusRipple && event.key === ' ' && rippleRef.current && focusVisible && !event.defaultPrevented) {
16380
+ keydownRef.current = false;
16381
+ rippleRef.current.stop(event, () => {
16382
+ rippleRef.current.pulsate(event);
16383
+ });
16384
+ }
16385
+ if (onKeyUp) {
16386
+ onKeyUp(event);
16387
+ }
16388
+
16389
+ // Keyboard accessibility for non interactive elements
16390
+ if (onClick && event.target === event.currentTarget && isNonNativeButton() && event.key === ' ' && !event.defaultPrevented) {
16391
+ onClick(event);
16392
+ }
16393
+ });
16394
+ let ComponentProp = component;
16395
+ if (ComponentProp === 'button' && (other.href || other.to)) {
16396
+ ComponentProp = LinkComponent;
16397
+ }
16398
+ const buttonProps = {};
16399
+ if (ComponentProp === 'button') {
16400
+ buttonProps.type = type === undefined ? 'button' : type;
16401
+ buttonProps.disabled = disabled;
16402
+ } else {
16403
+ if (!other.href && !other.to) {
16404
+ buttonProps.role = 'button';
16405
+ }
16406
+ if (disabled) {
16407
+ buttonProps['aria-disabled'] = disabled;
16408
+ }
16409
+ }
16410
+ const handleRef = useForkRef(ref, focusVisibleRef, buttonRef);
16411
+ if (process.env.NODE_ENV !== 'production') {
16412
+ // eslint-disable-next-line react-hooks/rules-of-hooks
16413
+ React.useEffect(() => {
16414
+ if (enableTouchRipple && !rippleRef.current) {
16415
+ console.error(['MUI: The `component` prop provided to ButtonBase is invalid.', 'Please make sure the children prop is rendered in this custom component.'].join('\n'));
16416
+ }
16417
+ }, [enableTouchRipple]);
16418
+ }
16419
+ const ownerState = _extends$1({}, props, {
16420
+ centerRipple,
16421
+ component,
16422
+ disabled,
16423
+ disableRipple,
16424
+ disableTouchRipple,
16425
+ focusRipple,
16426
+ tabIndex,
16427
+ focusVisible
16428
+ });
16429
+ const classes = useUtilityClasses$3(ownerState);
16430
+ return /*#__PURE__*/jsxRuntimeExports.jsxs(ButtonBaseRoot, _extends$1({
16431
+ as: ComponentProp,
16432
+ className: clsx(classes.root, className),
16433
+ ownerState: ownerState,
16434
+ onBlur: handleBlur,
16435
+ onClick: onClick,
16436
+ onContextMenu: handleContextMenu,
16437
+ onFocus: handleFocus,
16438
+ onKeyDown: handleKeyDown,
16439
+ onKeyUp: handleKeyUp,
16440
+ onMouseDown: handleMouseDown,
16441
+ onMouseLeave: handleMouseLeave,
16442
+ onMouseUp: handleMouseUp,
16443
+ onDragLeave: handleDragLeave,
16444
+ onTouchEnd: handleTouchEnd,
16445
+ onTouchMove: handleTouchMove,
16446
+ onTouchStart: handleTouchStart,
16447
+ ref: handleRef,
16448
+ tabIndex: disabled ? -1 : tabIndex,
16449
+ type: type
16450
+ }, buttonProps, other, {
16451
+ children: [children, enableTouchRipple ?
16452
+ /*#__PURE__*/
16453
+ /* TouchRipple is only needed client-side, x2 boost on the server. */
16454
+ jsxRuntimeExports.jsx(TouchRipple$1, _extends$1({
16455
+ ref: handleRippleRef,
16456
+ center: centerRipple
16457
+ }, TouchRippleProps)) : null]
16458
+ }));
16459
+ });
16460
+ process.env.NODE_ENV !== "production" ? ButtonBase.propTypes /* remove-proptypes */ = {
16461
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
16462
+ // │ These PropTypes are generated from the TypeScript type definitions. │
16463
+ // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
16464
+ // └─────────────────────────────────────────────────────────────────────┘
16465
+ /**
16466
+ * A ref for imperative actions.
16467
+ * It currently only supports `focusVisible()` action.
16468
+ */
16469
+ action: refType$1,
16470
+ /**
16471
+ * If `true`, the ripples are centered.
16472
+ * They won't start at the cursor interaction position.
16473
+ * @default false
16474
+ */
16475
+ centerRipple: PropTypes.bool,
16476
+ /**
16477
+ * The content of the component.
16478
+ */
16479
+ children: PropTypes.node,
16480
+ /**
16481
+ * Override or extend the styles applied to the component.
16482
+ */
16483
+ classes: PropTypes.object,
16484
+ /**
16485
+ * @ignore
16486
+ */
16487
+ className: PropTypes.string,
16488
+ /**
16489
+ * The component used for the root node.
16490
+ * Either a string to use a HTML element or a component.
16491
+ */
16492
+ component: elementTypeAcceptingRef$1,
16493
+ /**
16494
+ * If `true`, the component is disabled.
16495
+ * @default false
16496
+ */
16497
+ disabled: PropTypes.bool,
16498
+ /**
16499
+ * If `true`, the ripple effect is disabled.
16500
+ *
16501
+ * ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
16502
+ * to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
16503
+ * @default false
16504
+ */
16505
+ disableRipple: PropTypes.bool,
16506
+ /**
16507
+ * If `true`, the touch ripple effect is disabled.
16508
+ * @default false
16509
+ */
16510
+ disableTouchRipple: PropTypes.bool,
16511
+ /**
16512
+ * If `true`, the base button will have a keyboard focus ripple.
16513
+ * @default false
16514
+ */
16515
+ focusRipple: PropTypes.bool,
16516
+ /**
16517
+ * This prop can help identify which element has keyboard focus.
16518
+ * The class name will be applied when the element gains the focus through keyboard interaction.
16519
+ * It's a polyfill for the [CSS :focus-visible selector](https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo).
16520
+ * The rationale for using this feature [is explained here](https://github.com/WICG/focus-visible/blob/HEAD/explainer.md).
16521
+ * A [polyfill can be used](https://github.com/WICG/focus-visible) to apply a `focus-visible` class to other components
16522
+ * if needed.
16523
+ */
16524
+ focusVisibleClassName: PropTypes.string,
16525
+ /**
16526
+ * @ignore
16527
+ */
16528
+ href: PropTypes /* @typescript-to-proptypes-ignore */.any,
16529
+ /**
16530
+ * The component used to render a link when the `href` prop is provided.
16531
+ * @default 'a'
16532
+ */
16533
+ LinkComponent: PropTypes.elementType,
16534
+ /**
16535
+ * @ignore
16536
+ */
16537
+ onBlur: PropTypes.func,
16538
+ /**
16539
+ * @ignore
16540
+ */
16541
+ onClick: PropTypes.func,
16542
+ /**
16543
+ * @ignore
16544
+ */
16545
+ onContextMenu: PropTypes.func,
16546
+ /**
16547
+ * @ignore
16548
+ */
16549
+ onDragLeave: PropTypes.func,
16550
+ /**
16551
+ * @ignore
16552
+ */
16553
+ onFocus: PropTypes.func,
16554
+ /**
16555
+ * Callback fired when the component is focused with a keyboard.
16556
+ * We trigger a `onFocus` callback too.
16557
+ */
16558
+ onFocusVisible: PropTypes.func,
16559
+ /**
16560
+ * @ignore
16561
+ */
16562
+ onKeyDown: PropTypes.func,
16563
+ /**
16564
+ * @ignore
16565
+ */
16566
+ onKeyUp: PropTypes.func,
16567
+ /**
16568
+ * @ignore
16569
+ */
16570
+ onMouseDown: PropTypes.func,
16571
+ /**
16572
+ * @ignore
16573
+ */
16574
+ onMouseLeave: PropTypes.func,
16575
+ /**
16576
+ * @ignore
16577
+ */
16578
+ onMouseUp: PropTypes.func,
16579
+ /**
16580
+ * @ignore
16581
+ */
16582
+ onTouchEnd: PropTypes.func,
16583
+ /**
16584
+ * @ignore
16585
+ */
16586
+ onTouchMove: PropTypes.func,
16587
+ /**
16588
+ * @ignore
16589
+ */
16590
+ onTouchStart: PropTypes.func,
16591
+ /**
16592
+ * The system prop that allows defining system overrides as well as additional CSS styles.
16593
+ */
16594
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
16595
+ /**
16596
+ * @default 0
16597
+ */
16598
+ tabIndex: PropTypes.number,
16599
+ /**
16600
+ * Props applied to the `TouchRipple` element.
16601
+ */
16602
+ TouchRippleProps: PropTypes.object,
16603
+ /**
16604
+ * A ref that points to the `TouchRipple` element.
16605
+ */
16606
+ touchRippleRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
16607
+ current: PropTypes.shape({
16608
+ pulsate: PropTypes.func.isRequired,
16609
+ start: PropTypes.func.isRequired,
16610
+ stop: PropTypes.func.isRequired
16611
+ })
16612
+ })]),
16613
+ /**
16614
+ * @ignore
16615
+ */
16616
+ type: PropTypes.oneOfType([PropTypes.oneOf(['button', 'reset', 'submit']), PropTypes.string])
16617
+ } : void 0;
16618
+ var ButtonBase$1 = ButtonBase;
16619
+
16620
+ function getButtonUtilityClass(slot) {
16621
+ return generateUtilityClass('MuiButton', slot);
16622
+ }
16623
+ const buttonClasses = generateUtilityClasses('MuiButton', ['root', 'text', 'textInherit', 'textPrimary', 'textSecondary', 'textSuccess', 'textError', 'textInfo', 'textWarning', 'outlined', 'outlinedInherit', 'outlinedPrimary', 'outlinedSecondary', 'outlinedSuccess', 'outlinedError', 'outlinedInfo', 'outlinedWarning', 'contained', 'containedInherit', 'containedPrimary', 'containedSecondary', 'containedSuccess', 'containedError', 'containedInfo', 'containedWarning', 'disableElevation', 'focusVisible', 'disabled', 'colorInherit', 'colorPrimary', 'colorSecondary', 'colorSuccess', 'colorError', 'colorInfo', 'colorWarning', 'textSizeSmall', 'textSizeMedium', 'textSizeLarge', 'outlinedSizeSmall', 'outlinedSizeMedium', 'outlinedSizeLarge', 'containedSizeSmall', 'containedSizeMedium', 'containedSizeLarge', 'sizeMedium', 'sizeSmall', 'sizeLarge', 'fullWidth', 'startIcon', 'endIcon', 'icon', 'iconSizeSmall', 'iconSizeMedium', 'iconSizeLarge']);
16624
+ var buttonClasses$1 = buttonClasses;
16625
+
16626
+ /**
16627
+ * @ignore - internal component.
16628
+ */
16629
+ const ButtonGroupContext = /*#__PURE__*/React.createContext({});
16630
+ if (process.env.NODE_ENV !== 'production') {
16631
+ ButtonGroupContext.displayName = 'ButtonGroupContext';
16632
+ }
16633
+ var ButtonGroupContext$1 = ButtonGroupContext;
16634
+
16635
+ /**
16636
+ * @ignore - internal component.
16637
+ */
16638
+ const ButtonGroupButtonContext = /*#__PURE__*/React.createContext(undefined);
16639
+ if (process.env.NODE_ENV !== 'production') {
16640
+ ButtonGroupButtonContext.displayName = 'ButtonGroupButtonContext';
16641
+ }
16642
+ var ButtonGroupButtonContext$1 = ButtonGroupButtonContext;
16643
+
16644
+ const _excluded$2 = ["children", "color", "component", "className", "disabled", "disableElevation", "disableFocusRipple", "endIcon", "focusVisibleClassName", "fullWidth", "size", "startIcon", "type", "variant"];
16645
+ const useUtilityClasses$2 = ownerState => {
16646
+ const {
16647
+ color,
16648
+ disableElevation,
16649
+ fullWidth,
16650
+ size,
16651
+ variant,
16652
+ classes
16653
+ } = ownerState;
16654
+ const slots = {
16655
+ root: ['root', variant, `${variant}${capitalize$1(color)}`, `size${capitalize$1(size)}`, `${variant}Size${capitalize$1(size)}`, `color${capitalize$1(color)}`, disableElevation && 'disableElevation', fullWidth && 'fullWidth'],
16656
+ label: ['label'],
16657
+ startIcon: ['icon', 'startIcon', `iconSize${capitalize$1(size)}`],
16658
+ endIcon: ['icon', 'endIcon', `iconSize${capitalize$1(size)}`]
16659
+ };
16660
+ const composedClasses = composeClasses(slots, getButtonUtilityClass, classes);
16661
+ return _extends$1({}, classes, composedClasses);
16662
+ };
16663
+ const commonIconStyles = ownerState => _extends$1({}, ownerState.size === 'small' && {
16664
+ '& > *:nth-of-type(1)': {
16665
+ fontSize: 18
16666
+ }
16667
+ }, ownerState.size === 'medium' && {
16668
+ '& > *:nth-of-type(1)': {
16669
+ fontSize: 20
16670
+ }
16671
+ }, ownerState.size === 'large' && {
16672
+ '& > *:nth-of-type(1)': {
16673
+ fontSize: 22
16674
+ }
16675
+ });
16676
+ const ButtonRoot = styled$1(ButtonBase$1, {
16677
+ shouldForwardProp: prop => rootShouldForwardProp$2(prop) || prop === 'classes',
16678
+ name: 'MuiButton',
16679
+ slot: 'Root',
16680
+ overridesResolver: (props, styles) => {
16681
+ const {
16682
+ ownerState
16683
+ } = props;
16684
+ return [styles.root, styles[ownerState.variant], styles[`${ownerState.variant}${capitalize$1(ownerState.color)}`], styles[`size${capitalize$1(ownerState.size)}`], styles[`${ownerState.variant}Size${capitalize$1(ownerState.size)}`], ownerState.color === 'inherit' && styles.colorInherit, ownerState.disableElevation && styles.disableElevation, ownerState.fullWidth && styles.fullWidth];
16685
+ }
16686
+ })(({
16687
+ theme,
16688
+ ownerState
16689
+ }) => {
16690
+ var _theme$palette$getCon, _theme$palette;
16691
+ const inheritContainedBackgroundColor = theme.palette.mode === 'light' ? theme.palette.grey[300] : theme.palette.grey[800];
16692
+ const inheritContainedHoverBackgroundColor = theme.palette.mode === 'light' ? theme.palette.grey.A100 : theme.palette.grey[700];
16693
+ return _extends$1({}, theme.typography.button, {
16694
+ minWidth: 64,
16695
+ padding: '6px 16px',
16696
+ borderRadius: (theme.vars || theme).shape.borderRadius,
16697
+ transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color', 'color'], {
16698
+ duration: theme.transitions.duration.short
16699
+ }),
16700
+ '&:hover': _extends$1({
16701
+ textDecoration: 'none',
16702
+ backgroundColor: theme.vars ? `rgba(${theme.vars.palette.text.primaryChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha_1(theme.palette.text.primary, theme.palette.action.hoverOpacity),
16703
+ // Reset on touch devices, it doesn't add specificity
16704
+ '@media (hover: none)': {
16705
+ backgroundColor: 'transparent'
16706
+ }
16707
+ }, ownerState.variant === 'text' && ownerState.color !== 'inherit' && {
16708
+ backgroundColor: theme.vars ? `rgba(${theme.vars.palette[ownerState.color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha_1(theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),
16709
+ // Reset on touch devices, it doesn't add specificity
16710
+ '@media (hover: none)': {
16711
+ backgroundColor: 'transparent'
16712
+ }
16713
+ }, ownerState.variant === 'outlined' && ownerState.color !== 'inherit' && {
16714
+ border: `1px solid ${(theme.vars || theme).palette[ownerState.color].main}`,
16715
+ backgroundColor: theme.vars ? `rgba(${theme.vars.palette[ownerState.color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha_1(theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),
16716
+ // Reset on touch devices, it doesn't add specificity
16717
+ '@media (hover: none)': {
16718
+ backgroundColor: 'transparent'
16719
+ }
16720
+ }, ownerState.variant === 'contained' && {
16721
+ backgroundColor: theme.vars ? theme.vars.palette.Button.inheritContainedHoverBg : inheritContainedHoverBackgroundColor,
16722
+ boxShadow: (theme.vars || theme).shadows[4],
16723
+ // Reset on touch devices, it doesn't add specificity
16724
+ '@media (hover: none)': {
16725
+ boxShadow: (theme.vars || theme).shadows[2],
16726
+ backgroundColor: (theme.vars || theme).palette.grey[300]
16727
+ }
16728
+ }, ownerState.variant === 'contained' && ownerState.color !== 'inherit' && {
16729
+ backgroundColor: (theme.vars || theme).palette[ownerState.color].dark,
16730
+ // Reset on touch devices, it doesn't add specificity
16731
+ '@media (hover: none)': {
16732
+ backgroundColor: (theme.vars || theme).palette[ownerState.color].main
16733
+ }
16734
+ }),
16735
+ '&:active': _extends$1({}, ownerState.variant === 'contained' && {
16736
+ boxShadow: (theme.vars || theme).shadows[8]
16737
+ }),
16738
+ [`&.${buttonClasses$1.focusVisible}`]: _extends$1({}, ownerState.variant === 'contained' && {
16739
+ boxShadow: (theme.vars || theme).shadows[6]
16740
+ }),
16741
+ [`&.${buttonClasses$1.disabled}`]: _extends$1({
16742
+ color: (theme.vars || theme).palette.action.disabled
16743
+ }, ownerState.variant === 'outlined' && {
16744
+ border: `1px solid ${(theme.vars || theme).palette.action.disabledBackground}`
16745
+ }, ownerState.variant === 'contained' && {
16746
+ color: (theme.vars || theme).palette.action.disabled,
16747
+ boxShadow: (theme.vars || theme).shadows[0],
16748
+ backgroundColor: (theme.vars || theme).palette.action.disabledBackground
16749
+ })
16750
+ }, ownerState.variant === 'text' && {
16751
+ padding: '6px 8px'
16752
+ }, ownerState.variant === 'text' && ownerState.color !== 'inherit' && {
16753
+ color: (theme.vars || theme).palette[ownerState.color].main
16754
+ }, ownerState.variant === 'outlined' && {
16755
+ padding: '5px 15px',
16756
+ border: '1px solid currentColor'
16757
+ }, ownerState.variant === 'outlined' && ownerState.color !== 'inherit' && {
16758
+ color: (theme.vars || theme).palette[ownerState.color].main,
16759
+ border: theme.vars ? `1px solid rgba(${theme.vars.palette[ownerState.color].mainChannel} / 0.5)` : `1px solid ${alpha_1(theme.palette[ownerState.color].main, 0.5)}`
16760
+ }, ownerState.variant === 'contained' && {
16761
+ color: theme.vars ?
16762
+ // this is safe because grey does not change between default light/dark mode
16763
+ theme.vars.palette.text.primary : (_theme$palette$getCon = (_theme$palette = theme.palette).getContrastText) == null ? void 0 : _theme$palette$getCon.call(_theme$palette, theme.palette.grey[300]),
16764
+ backgroundColor: theme.vars ? theme.vars.palette.Button.inheritContainedBg : inheritContainedBackgroundColor,
16765
+ boxShadow: (theme.vars || theme).shadows[2]
16766
+ }, ownerState.variant === 'contained' && ownerState.color !== 'inherit' && {
16767
+ color: (theme.vars || theme).palette[ownerState.color].contrastText,
16768
+ backgroundColor: (theme.vars || theme).palette[ownerState.color].main
16769
+ }, ownerState.color === 'inherit' && {
16770
+ color: 'inherit',
16771
+ borderColor: 'currentColor'
16772
+ }, ownerState.size === 'small' && ownerState.variant === 'text' && {
16773
+ padding: '4px 5px',
16774
+ fontSize: theme.typography.pxToRem(13)
16775
+ }, ownerState.size === 'large' && ownerState.variant === 'text' && {
16776
+ padding: '8px 11px',
16777
+ fontSize: theme.typography.pxToRem(15)
16778
+ }, ownerState.size === 'small' && ownerState.variant === 'outlined' && {
16779
+ padding: '3px 9px',
16780
+ fontSize: theme.typography.pxToRem(13)
16781
+ }, ownerState.size === 'large' && ownerState.variant === 'outlined' && {
16782
+ padding: '7px 21px',
16783
+ fontSize: theme.typography.pxToRem(15)
16784
+ }, ownerState.size === 'small' && ownerState.variant === 'contained' && {
16785
+ padding: '4px 10px',
16786
+ fontSize: theme.typography.pxToRem(13)
16787
+ }, ownerState.size === 'large' && ownerState.variant === 'contained' && {
16788
+ padding: '8px 22px',
16789
+ fontSize: theme.typography.pxToRem(15)
16790
+ }, ownerState.fullWidth && {
16791
+ width: '100%'
16792
+ });
16793
+ }, ({
16794
+ ownerState
16795
+ }) => ownerState.disableElevation && {
16796
+ boxShadow: 'none',
16797
+ '&:hover': {
16798
+ boxShadow: 'none'
16799
+ },
16800
+ [`&.${buttonClasses$1.focusVisible}`]: {
16801
+ boxShadow: 'none'
16802
+ },
16803
+ '&:active': {
16804
+ boxShadow: 'none'
16805
+ },
16806
+ [`&.${buttonClasses$1.disabled}`]: {
16807
+ boxShadow: 'none'
16808
+ }
16809
+ });
16810
+ const ButtonStartIcon = styled$1('span', {
16811
+ name: 'MuiButton',
16812
+ slot: 'StartIcon',
16813
+ overridesResolver: (props, styles) => {
16814
+ const {
16815
+ ownerState
16816
+ } = props;
16817
+ return [styles.startIcon, styles[`iconSize${capitalize$1(ownerState.size)}`]];
16818
+ }
16819
+ })(({
16820
+ ownerState
16821
+ }) => _extends$1({
16822
+ display: 'inherit',
16823
+ marginRight: 8,
16824
+ marginLeft: -4
16825
+ }, ownerState.size === 'small' && {
16826
+ marginLeft: -2
16827
+ }, commonIconStyles(ownerState)));
16828
+ const ButtonEndIcon = styled$1('span', {
16829
+ name: 'MuiButton',
16830
+ slot: 'EndIcon',
16831
+ overridesResolver: (props, styles) => {
16832
+ const {
16833
+ ownerState
16834
+ } = props;
16835
+ return [styles.endIcon, styles[`iconSize${capitalize$1(ownerState.size)}`]];
16836
+ }
16837
+ })(({
16838
+ ownerState
16839
+ }) => _extends$1({
16840
+ display: 'inherit',
16841
+ marginRight: -4,
16842
+ marginLeft: 8
16843
+ }, ownerState.size === 'small' && {
16844
+ marginRight: -2
16845
+ }, commonIconStyles(ownerState)));
16846
+ const Button = /*#__PURE__*/React.forwardRef(function Button(inProps, ref) {
16847
+ // props priority: `inProps` > `contextProps` > `themeDefaultProps`
16848
+ const contextProps = React.useContext(ButtonGroupContext$1);
16849
+ const buttonGroupButtonContextPositionClassName = React.useContext(ButtonGroupButtonContext$1);
16850
+ const resolvedProps = resolveProps(contextProps, inProps);
16851
+ const props = useDefaultProps({
16852
+ props: resolvedProps,
16853
+ name: 'MuiButton'
16854
+ });
16855
+ const {
16856
+ children,
16857
+ color = 'primary',
16858
+ component = 'button',
16859
+ className,
16860
+ disabled = false,
16861
+ disableElevation = false,
16862
+ disableFocusRipple = false,
16863
+ endIcon: endIconProp,
16864
+ focusVisibleClassName,
16865
+ fullWidth = false,
16866
+ size = 'medium',
16867
+ startIcon: startIconProp,
16868
+ type,
16869
+ variant = 'text'
16870
+ } = props,
16871
+ other = _objectWithoutPropertiesLoose(props, _excluded$2);
16872
+ const ownerState = _extends$1({}, props, {
16873
+ color,
16874
+ component,
16875
+ disabled,
16876
+ disableElevation,
16877
+ disableFocusRipple,
16878
+ fullWidth,
16879
+ size,
16880
+ type,
16881
+ variant
16882
+ });
16883
+ const classes = useUtilityClasses$2(ownerState);
16884
+ const startIcon = startIconProp && /*#__PURE__*/jsxRuntimeExports.jsx(ButtonStartIcon, {
16885
+ className: classes.startIcon,
16886
+ ownerState: ownerState,
16887
+ children: startIconProp
16888
+ });
16889
+ const endIcon = endIconProp && /*#__PURE__*/jsxRuntimeExports.jsx(ButtonEndIcon, {
16890
+ className: classes.endIcon,
16891
+ ownerState: ownerState,
16892
+ children: endIconProp
16893
+ });
16894
+ const positionClassName = buttonGroupButtonContextPositionClassName || '';
16895
+ return /*#__PURE__*/jsxRuntimeExports.jsxs(ButtonRoot, _extends$1({
16896
+ ownerState: ownerState,
16897
+ className: clsx(contextProps.className, classes.root, className, positionClassName),
16898
+ component: component,
16899
+ disabled: disabled,
16900
+ focusRipple: !disableFocusRipple,
16901
+ focusVisibleClassName: clsx(classes.focusVisible, focusVisibleClassName),
16902
+ ref: ref,
16903
+ type: type
16904
+ }, other, {
16905
+ classes: classes,
16906
+ children: [startIcon, children, endIcon]
16907
+ }));
16908
+ });
16909
+ process.env.NODE_ENV !== "production" ? Button.propTypes /* remove-proptypes */ = {
16910
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
16911
+ // │ These PropTypes are generated from the TypeScript type definitions. │
16912
+ // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
16913
+ // └─────────────────────────────────────────────────────────────────────┘
16914
+ /**
16915
+ * The content of the component.
16916
+ */
16917
+ children: PropTypes.node,
16918
+ /**
16919
+ * Override or extend the styles applied to the component.
16920
+ */
16921
+ classes: PropTypes.object,
16922
+ /**
16923
+ * @ignore
16924
+ */
16925
+ className: PropTypes.string,
16926
+ /**
16927
+ * The color of the component.
16928
+ * It supports both default and custom theme colors, which can be added as shown in the
16929
+ * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
16930
+ * @default 'primary'
16931
+ */
16932
+ color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['inherit', 'primary', 'secondary', 'success', 'error', 'info', 'warning']), PropTypes.string]),
16933
+ /**
16934
+ * The component used for the root node.
16935
+ * Either a string to use a HTML element or a component.
16936
+ */
16937
+ component: PropTypes.elementType,
16938
+ /**
16939
+ * If `true`, the component is disabled.
16940
+ * @default false
16941
+ */
16942
+ disabled: PropTypes.bool,
16943
+ /**
16944
+ * If `true`, no elevation is used.
16945
+ * @default false
16946
+ */
16947
+ disableElevation: PropTypes.bool,
16948
+ /**
16949
+ * If `true`, the keyboard focus ripple is disabled.
16950
+ * @default false
16951
+ */
16952
+ disableFocusRipple: PropTypes.bool,
16953
+ /**
16954
+ * If `true`, the ripple effect is disabled.
16955
+ *
16956
+ * ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
16957
+ * to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
16958
+ * @default false
16959
+ */
16960
+ disableRipple: PropTypes.bool,
16961
+ /**
16962
+ * Element placed after the children.
16963
+ */
16964
+ endIcon: PropTypes.node,
16965
+ /**
16966
+ * @ignore
16967
+ */
16968
+ focusVisibleClassName: PropTypes.string,
16969
+ /**
16970
+ * If `true`, the button will take up the full width of its container.
16971
+ * @default false
16972
+ */
16973
+ fullWidth: PropTypes.bool,
16974
+ /**
16975
+ * The URL to link to when the button is clicked.
16976
+ * If defined, an `a` element will be used as the root node.
16977
+ */
16978
+ href: PropTypes.string,
16979
+ /**
16980
+ * The size of the component.
16981
+ * `small` is equivalent to the dense button styling.
16982
+ * @default 'medium'
16983
+ */
16984
+ size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['small', 'medium', 'large']), PropTypes.string]),
16985
+ /**
16986
+ * Element placed before the children.
16987
+ */
16988
+ startIcon: PropTypes.node,
16989
+ /**
16990
+ * The system prop that allows defining system overrides as well as additional CSS styles.
16991
+ */
16992
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
16993
+ /**
16994
+ * @ignore
16995
+ */
16996
+ type: PropTypes.oneOfType([PropTypes.oneOf(['button', 'reset', 'submit']), PropTypes.string]),
16997
+ /**
16998
+ * The variant to use.
16999
+ * @default 'text'
17000
+ */
17001
+ variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['contained', 'outlined', 'text']), PropTypes.string])
17002
+ } : void 0;
17003
+ var Button$1 = Button;
17004
+
17005
+ function getCircularProgressUtilityClass(slot) {
17006
+ return generateUtilityClass('MuiCircularProgress', slot);
17007
+ }
17008
+ generateUtilityClasses('MuiCircularProgress', ['root', 'determinate', 'indeterminate', 'colorPrimary', 'colorSecondary', 'svg', 'circle', 'circleDeterminate', 'circleIndeterminate', 'circleDisableShrink']);
17009
+
17010
+ const _excluded$1 = ["className", "color", "disableShrink", "size", "style", "thickness", "value", "variant"];
17011
+ let _ = t => t,
17012
+ _t,
17013
+ _t2,
17014
+ _t3,
17015
+ _t4;
17016
+ const SIZE = 44;
17017
+ const circularRotateKeyframe = keyframes(_t || (_t = _`
17018
+ 0% {
17019
+ transform: rotate(0deg);
17020
+ }
17021
+
17022
+ 100% {
17023
+ transform: rotate(360deg);
17024
+ }
17025
+ `));
17026
+ const circularDashKeyframe = keyframes(_t2 || (_t2 = _`
17027
+ 0% {
17028
+ stroke-dasharray: 1px, 200px;
17029
+ stroke-dashoffset: 0;
17030
+ }
17031
+
17032
+ 50% {
17033
+ stroke-dasharray: 100px, 200px;
17034
+ stroke-dashoffset: -15px;
17035
+ }
17036
+
17037
+ 100% {
17038
+ stroke-dasharray: 100px, 200px;
17039
+ stroke-dashoffset: -125px;
17040
+ }
17041
+ `));
17042
+ const useUtilityClasses$1 = ownerState => {
17043
+ const {
17044
+ classes,
17045
+ variant,
17046
+ color,
17047
+ disableShrink
17048
+ } = ownerState;
17049
+ const slots = {
17050
+ root: ['root', variant, `color${capitalize$1(color)}`],
17051
+ svg: ['svg'],
17052
+ circle: ['circle', `circle${capitalize$1(variant)}`, disableShrink && 'circleDisableShrink']
17053
+ };
17054
+ return composeClasses(slots, getCircularProgressUtilityClass, classes);
17055
+ };
17056
+ const CircularProgressRoot = styled$1('span', {
17057
+ name: 'MuiCircularProgress',
17058
+ slot: 'Root',
17059
+ overridesResolver: (props, styles) => {
17060
+ const {
17061
+ ownerState
17062
+ } = props;
17063
+ return [styles.root, styles[ownerState.variant], styles[`color${capitalize$1(ownerState.color)}`]];
17064
+ }
17065
+ })(({
17066
+ ownerState,
17067
+ theme
17068
+ }) => _extends$1({
17069
+ display: 'inline-block'
17070
+ }, ownerState.variant === 'determinate' && {
17071
+ transition: theme.transitions.create('transform')
17072
+ }, ownerState.color !== 'inherit' && {
17073
+ color: (theme.vars || theme).palette[ownerState.color].main
17074
+ }), ({
17075
+ ownerState
17076
+ }) => ownerState.variant === 'indeterminate' && css(_t3 || (_t3 = _`
17077
+ animation: ${0} 1.4s linear infinite;
17078
+ `), circularRotateKeyframe));
17079
+ const CircularProgressSVG = styled$1('svg', {
17080
+ name: 'MuiCircularProgress',
17081
+ slot: 'Svg',
17082
+ overridesResolver: (props, styles) => styles.svg
17083
+ })({
17084
+ display: 'block' // Keeps the progress centered
17085
+ });
17086
+ const CircularProgressCircle = styled$1('circle', {
17087
+ name: 'MuiCircularProgress',
17088
+ slot: 'Circle',
17089
+ overridesResolver: (props, styles) => {
17090
+ const {
17091
+ ownerState
17092
+ } = props;
17093
+ return [styles.circle, styles[`circle${capitalize$1(ownerState.variant)}`], ownerState.disableShrink && styles.circleDisableShrink];
17094
+ }
17095
+ })(({
17096
+ ownerState,
17097
+ theme
17098
+ }) => _extends$1({
17099
+ stroke: 'currentColor'
17100
+ }, ownerState.variant === 'determinate' && {
17101
+ transition: theme.transitions.create('stroke-dashoffset')
17102
+ }, ownerState.variant === 'indeterminate' && {
17103
+ // Some default value that looks fine waiting for the animation to kicks in.
17104
+ strokeDasharray: '80px, 200px',
17105
+ strokeDashoffset: 0 // Add the unit to fix a Edge 16 and below bug.
17106
+ }), ({
17107
+ ownerState
17108
+ }) => ownerState.variant === 'indeterminate' && !ownerState.disableShrink && css(_t4 || (_t4 = _`
17109
+ animation: ${0} 1.4s ease-in-out infinite;
17110
+ `), circularDashKeyframe));
17111
+
17112
+ /**
17113
+ * ## ARIA
17114
+ *
17115
+ * If the progress bar is describing the loading progress of a particular region of a page,
17116
+ * you should use `aria-describedby` to point to the progress bar, and set the `aria-busy`
17117
+ * attribute to `true` on that region until it has finished loading.
17118
+ */
17119
+ const CircularProgress = /*#__PURE__*/React.forwardRef(function CircularProgress(inProps, ref) {
17120
+ const props = useDefaultProps({
17121
+ props: inProps,
17122
+ name: 'MuiCircularProgress'
17123
+ });
17124
+ const {
17125
+ className,
17126
+ color = 'primary',
17127
+ disableShrink = false,
17128
+ size = 40,
17129
+ style,
17130
+ thickness = 3.6,
17131
+ value = 0,
17132
+ variant = 'indeterminate'
17133
+ } = props,
17134
+ other = _objectWithoutPropertiesLoose(props, _excluded$1);
17135
+ const ownerState = _extends$1({}, props, {
17136
+ color,
17137
+ disableShrink,
17138
+ size,
17139
+ thickness,
17140
+ value,
17141
+ variant
17142
+ });
17143
+ const classes = useUtilityClasses$1(ownerState);
17144
+ const circleStyle = {};
17145
+ const rootStyle = {};
17146
+ const rootProps = {};
17147
+ if (variant === 'determinate') {
17148
+ const circumference = 2 * Math.PI * ((SIZE - thickness) / 2);
17149
+ circleStyle.strokeDasharray = circumference.toFixed(3);
17150
+ rootProps['aria-valuenow'] = Math.round(value);
17151
+ circleStyle.strokeDashoffset = `${((100 - value) / 100 * circumference).toFixed(3)}px`;
17152
+ rootStyle.transform = 'rotate(-90deg)';
17153
+ }
17154
+ return /*#__PURE__*/jsxRuntimeExports.jsx(CircularProgressRoot, _extends$1({
17155
+ className: clsx(classes.root, className),
17156
+ style: _extends$1({
17157
+ width: size,
17158
+ height: size
17159
+ }, rootStyle, style),
17160
+ ownerState: ownerState,
17161
+ ref: ref,
17162
+ role: "progressbar"
17163
+ }, rootProps, other, {
17164
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(CircularProgressSVG, {
17165
+ className: classes.svg,
17166
+ ownerState: ownerState,
17167
+ viewBox: `${SIZE / 2} ${SIZE / 2} ${SIZE} ${SIZE}`,
17168
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(CircularProgressCircle, {
17169
+ className: classes.circle,
17170
+ style: circleStyle,
17171
+ ownerState: ownerState,
17172
+ cx: SIZE,
17173
+ cy: SIZE,
17174
+ r: (SIZE - thickness) / 2,
17175
+ fill: "none",
17176
+ strokeWidth: thickness
17177
+ })
17178
+ })
17179
+ }));
17180
+ });
17181
+ process.env.NODE_ENV !== "production" ? CircularProgress.propTypes /* remove-proptypes */ = {
17182
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
17183
+ // │ These PropTypes are generated from the TypeScript type definitions. │
17184
+ // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
17185
+ // └─────────────────────────────────────────────────────────────────────┘
17186
+ /**
17187
+ * Override or extend the styles applied to the component.
17188
+ */
17189
+ classes: PropTypes.object,
17190
+ /**
17191
+ * @ignore
17192
+ */
17193
+ className: PropTypes.string,
17194
+ /**
17195
+ * The color of the component.
17196
+ * It supports both default and custom theme colors, which can be added as shown in the
17197
+ * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
17198
+ * @default 'primary'
17199
+ */
17200
+ color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['inherit', 'primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),
17201
+ /**
17202
+ * If `true`, the shrink animation is disabled.
17203
+ * This only works if variant is `indeterminate`.
17204
+ * @default false
17205
+ */
17206
+ disableShrink: chainPropTypes(PropTypes.bool, props => {
17207
+ if (props.disableShrink && props.variant && props.variant !== 'indeterminate') {
17208
+ return new Error('MUI: You have provided the `disableShrink` prop ' + 'with a variant other than `indeterminate`. This will have no effect.');
17209
+ }
17210
+ return null;
17211
+ }),
17212
+ /**
17213
+ * The size of the component.
17214
+ * If using a number, the pixel unit is assumed.
17215
+ * If using a string, you need to provide the CSS unit, for example '3rem'.
17216
+ * @default 40
17217
+ */
17218
+ size: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
17219
+ /**
17220
+ * @ignore
17221
+ */
17222
+ style: PropTypes.object,
17223
+ /**
17224
+ * The system prop that allows defining system overrides as well as additional CSS styles.
17225
+ */
17226
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
17227
+ /**
17228
+ * The thickness of the circle.
17229
+ * @default 3.6
17230
+ */
17231
+ thickness: PropTypes.number,
17232
+ /**
17233
+ * The value of the progress indicator for the determinate variant.
17234
+ * Value between 0 and 100.
17235
+ * @default 0
17236
+ */
17237
+ value: PropTypes.number,
17238
+ /**
17239
+ * The variant to use.
17240
+ * Use indeterminate when there is no progress value.
17241
+ * @default 'indeterminate'
17242
+ */
17243
+ variant: PropTypes.oneOf(['determinate', 'indeterminate'])
17244
+ } : void 0;
17245
+ var CircularProgress$1 = CircularProgress;
17246
+
17247
+ function getLoadingButtonUtilityClass(slot) {
17248
+ return generateUtilityClass('MuiLoadingButton', slot);
17249
+ }
17250
+ const loadingButtonClasses = generateUtilityClasses('MuiLoadingButton', ['root', 'loading', 'loadingIndicator', 'loadingIndicatorCenter', 'loadingIndicatorStart', 'loadingIndicatorEnd', 'endIconLoadingEnd', 'startIconLoadingStart']);
17251
+ var loadingButtonClasses$1 = loadingButtonClasses;
17252
+
17253
+ const _excluded = ["children", "disabled", "id", "loading", "loadingIndicator", "loadingPosition", "variant"];
17254
+ const useUtilityClasses = ownerState => {
17255
+ const {
17256
+ loading,
17257
+ loadingPosition,
17258
+ classes
17259
+ } = ownerState;
17260
+ const slots = {
17261
+ root: ['root', loading && 'loading'],
17262
+ startIcon: [loading && `startIconLoading${capitalize$1(loadingPosition)}`],
17263
+ endIcon: [loading && `endIconLoading${capitalize$1(loadingPosition)}`],
17264
+ loadingIndicator: ['loadingIndicator', loading && `loadingIndicator${capitalize$1(loadingPosition)}`]
17265
+ };
17266
+ const composedClasses = composeClasses(slots, getLoadingButtonUtilityClass, classes);
17267
+ return _extends$1({}, classes, composedClasses);
17268
+ };
17269
+
17270
+ // TODO use `import { rootShouldForwardProp } from '../styles/styled';` once move to core
17271
+ const rootShouldForwardProp = prop => prop !== 'ownerState' && prop !== 'theme' && prop !== 'sx' && prop !== 'as' && prop !== 'classes';
17272
+ const LoadingButtonRoot = styled$1(Button$1, {
17273
+ shouldForwardProp: prop => rootShouldForwardProp(prop) || prop === 'classes',
17274
+ name: 'MuiLoadingButton',
17275
+ slot: 'Root',
17276
+ overridesResolver: (props, styles) => {
17277
+ return [styles.root, styles.startIconLoadingStart && {
17278
+ [`& .${loadingButtonClasses$1.startIconLoadingStart}`]: styles.startIconLoadingStart
17279
+ }, styles.endIconLoadingEnd && {
17280
+ [`& .${loadingButtonClasses$1.endIconLoadingEnd}`]: styles.endIconLoadingEnd
17281
+ }];
17282
+ }
17283
+ })(({
17284
+ ownerState,
17285
+ theme
17286
+ }) => _extends$1({
17287
+ [`& .${loadingButtonClasses$1.startIconLoadingStart}, & .${loadingButtonClasses$1.endIconLoadingEnd}`]: {
17288
+ transition: theme.transitions.create(['opacity'], {
17289
+ duration: theme.transitions.duration.short
17290
+ }),
17291
+ opacity: 0
17292
+ }
17293
+ }, ownerState.loadingPosition === 'center' && {
17294
+ transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color'], {
17295
+ duration: theme.transitions.duration.short
17296
+ }),
17297
+ [`&.${loadingButtonClasses$1.loading}`]: {
17298
+ color: 'transparent'
17299
+ }
17300
+ }, ownerState.loadingPosition === 'start' && ownerState.fullWidth && {
17301
+ [`& .${loadingButtonClasses$1.startIconLoadingStart}, & .${loadingButtonClasses$1.endIconLoadingEnd}`]: {
17302
+ transition: theme.transitions.create(['opacity'], {
17303
+ duration: theme.transitions.duration.short
17304
+ }),
17305
+ opacity: 0,
17306
+ marginRight: -8
17307
+ }
17308
+ }, ownerState.loadingPosition === 'end' && ownerState.fullWidth && {
17309
+ [`& .${loadingButtonClasses$1.startIconLoadingStart}, & .${loadingButtonClasses$1.endIconLoadingEnd}`]: {
17310
+ transition: theme.transitions.create(['opacity'], {
17311
+ duration: theme.transitions.duration.short
17312
+ }),
17313
+ opacity: 0,
17314
+ marginLeft: -8
17315
+ }
17316
+ }));
17317
+ const LoadingButtonLoadingIndicator = styled$1('span', {
17318
+ name: 'MuiLoadingButton',
17319
+ slot: 'LoadingIndicator',
17320
+ overridesResolver: (props, styles) => {
17321
+ const {
17322
+ ownerState
17323
+ } = props;
17324
+ return [styles.loadingIndicator, styles[`loadingIndicator${capitalize$1(ownerState.loadingPosition)}`]];
17325
+ }
17326
+ })(({
17327
+ theme,
17328
+ ownerState
17329
+ }) => _extends$1({
17330
+ position: 'absolute',
17331
+ visibility: 'visible',
17332
+ display: 'flex'
17333
+ }, ownerState.loadingPosition === 'start' && (ownerState.variant === 'outlined' || ownerState.variant === 'contained') && {
17334
+ left: ownerState.size === 'small' ? 10 : 14
17335
+ }, ownerState.loadingPosition === 'start' && ownerState.variant === 'text' && {
17336
+ left: 6
17337
+ }, ownerState.loadingPosition === 'center' && {
17338
+ left: '50%',
17339
+ transform: 'translate(-50%)',
17340
+ color: (theme.vars || theme).palette.action.disabled
17341
+ }, ownerState.loadingPosition === 'end' && (ownerState.variant === 'outlined' || ownerState.variant === 'contained') && {
17342
+ right: ownerState.size === 'small' ? 10 : 14
17343
+ }, ownerState.loadingPosition === 'end' && ownerState.variant === 'text' && {
17344
+ right: 6
17345
+ }, ownerState.loadingPosition === 'start' && ownerState.fullWidth && {
17346
+ position: 'relative',
17347
+ left: -10
17348
+ }, ownerState.loadingPosition === 'end' && ownerState.fullWidth && {
17349
+ position: 'relative',
17350
+ right: -10
17351
+ }));
17352
+ const LoadingButton = /*#__PURE__*/React.forwardRef(function LoadingButton(inProps, ref) {
17353
+ const contextProps = React.useContext(ButtonGroupContext$1);
17354
+ const resolvedProps = resolveProps(contextProps, inProps);
17355
+ const props = useDefaultProps({
17356
+ props: resolvedProps,
17357
+ name: 'MuiLoadingButton'
17358
+ });
17359
+ const {
17360
+ children,
17361
+ disabled = false,
17362
+ id: idProp,
17363
+ loading = false,
17364
+ loadingIndicator: loadingIndicatorProp,
17365
+ loadingPosition = 'center',
17366
+ variant = 'text'
17367
+ } = props,
17368
+ other = _objectWithoutPropertiesLoose(props, _excluded);
17369
+ const id = useId(idProp);
17370
+ const loadingIndicator = loadingIndicatorProp != null ? loadingIndicatorProp : /*#__PURE__*/jsxRuntimeExports.jsx(CircularProgress$1, {
17371
+ "aria-labelledby": id,
17372
+ color: "inherit",
17373
+ size: 16
17374
+ });
17375
+ const ownerState = _extends$1({}, props, {
17376
+ disabled,
17377
+ loading,
17378
+ loadingIndicator,
17379
+ loadingPosition,
17380
+ variant
17381
+ });
17382
+ const classes = useUtilityClasses(ownerState);
17383
+ const loadingButtonLoadingIndicator = loading ? /*#__PURE__*/jsxRuntimeExports.jsx(LoadingButtonLoadingIndicator, {
17384
+ className: classes.loadingIndicator,
17385
+ ownerState: ownerState,
17386
+ children: loadingIndicator
17387
+ }) : null;
17388
+ return /*#__PURE__*/jsxRuntimeExports.jsxs(LoadingButtonRoot, _extends$1({
17389
+ disabled: disabled || loading,
17390
+ id: id,
17391
+ ref: ref
17392
+ }, other, {
17393
+ variant: variant,
17394
+ classes: classes,
17395
+ ownerState: ownerState,
17396
+ children: [ownerState.loadingPosition === 'end' ? children : loadingButtonLoadingIndicator, ownerState.loadingPosition === 'end' ? loadingButtonLoadingIndicator : children]
17397
+ }));
17398
+ });
17399
+ process.env.NODE_ENV !== "production" ? LoadingButton.propTypes /* remove-proptypes */ = {
17400
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
17401
+ // │ These PropTypes are generated from the TypeScript type definitions. │
17402
+ // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
17403
+ // └─────────────────────────────────────────────────────────────────────┘
17404
+ /**
17405
+ * The content of the component.
17406
+ */
17407
+ children: PropTypes.node,
17408
+ /**
17409
+ * Override or extend the styles applied to the component.
17410
+ */
17411
+ classes: PropTypes.object,
17412
+ /**
17413
+ * If `true`, the component is disabled.
17414
+ * @default false
17415
+ */
17416
+ disabled: PropTypes.bool,
17417
+ /**
17418
+ * @ignore
17419
+ */
17420
+ id: PropTypes.string,
17421
+ /**
17422
+ * If `true`, the loading indicator is shown and the button becomes disabled.
17423
+ * @default false
17424
+ */
17425
+ loading: PropTypes.bool,
17426
+ /**
17427
+ * Element placed before the children if the button is in loading state.
17428
+ * The node should contain an element with `role="progressbar"` with an accessible name.
17429
+ * By default we render a `CircularProgress` that is labelled by the button itself.
17430
+ * @default <CircularProgress color="inherit" size={16} />
17431
+ */
17432
+ loadingIndicator: PropTypes.node,
17433
+ /**
17434
+ * The loading indicator can be positioned on the start, end, or the center of the button.
17435
+ * @default 'center'
17436
+ */
17437
+ loadingPosition: chainPropTypes(PropTypes.oneOf(['start', 'end', 'center']), props => {
17438
+ if (props.loadingPosition === 'start' && !props.startIcon) {
17439
+ return new Error(`MUI: The loadingPosition="start" should be used in combination with startIcon.`);
17440
+ }
17441
+ if (props.loadingPosition === 'end' && !props.endIcon) {
17442
+ return new Error(`MUI: The loadingPosition="end" should be used in combination with endIcon.`);
17443
+ }
17444
+ return null;
17445
+ }),
17446
+ /**
17447
+ * The system prop that allows defining system overrides as well as additional CSS styles.
17448
+ */
17449
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
17450
+ /**
17451
+ * The variant to use.
17452
+ * @default 'text'
17453
+ */
17454
+ variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['contained', 'outlined', 'text']), PropTypes.string])
17455
+ } : void 0;
17456
+ var LoadingButton$1 = LoadingButton;
17457
+
17458
+ const PAGE_SIZE = 20;
17459
+ const TagsEditor = ({ value, options, onChange, onBack, onSave, isSaving, t }) => {
17460
+ const [searchValue, setSearchValue] = useState('');
17461
+ const [limit, setLimit] = useState(PAGE_SIZE);
17462
+ const safeOptions = useMemo(() => options ?? [], [options]);
17463
+ const visibleOptions = useMemo(() => safeOptions.slice(0, limit), [safeOptions, limit]);
17464
+ const handleSearchChange = (_, newInputValue) => {
17465
+ setSearchValue(newInputValue ?? '');
17466
+ setLimit(PAGE_SIZE);
17467
+ };
17468
+ const onListboxScroll = (event) => {
17469
+ const element = event;
17470
+ const nearBottom = element.scrollTop + element.clientHeight >= element.scrollHeight - 24;
17471
+ if (nearBottom)
17472
+ setLimit((l) => l + PAGE_SIZE);
17473
+ };
17474
+ return (jsxRuntimeExports.jsxs(Box, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsxs(Stack, { direction: "row", alignItems: "center", spacing: 1, sx: { mb: 2 }, children: [jsxRuntimeExports.jsx(IconButton, { size: "small", onClick: onBack, "aria-label": t('global.back'), disabled: isSaving, children: jsxRuntimeExports.jsx(default_1$1, { fontSize: "small" }) }), jsxRuntimeExports.jsx(Typography, { variant: "subtitle1", children: t('tags') }), jsxRuntimeExports.jsx(Box, { sx: { flex: 1 } }), jsxRuntimeExports.jsx(LoadingButton$1, { variant: "contained", size: "small", startIcon: jsxRuntimeExports.jsx(default_1, {}), onClick: onSave, loading: isSaving, disabled: isSaving, children: t('global.save') })] }), jsxRuntimeExports.jsx(Autocomplete, { multiple: true, value: value, onChange: (_, newValue) => onChange(newValue), options: visibleOptions, filterOptions: (x) => x, inputValue: searchValue, onInputChange: handleSearchChange, getOptionLabel: (option) => option?.name ?? '', isOptionEqualToValue: (o, v) => String(o?.id) === String(v?.id), renderOption: (props, option) => (jsxRuntimeExports.jsx("li", { ...props, children: option.name ?? '' })), renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => (jsxRuntimeExports.jsx(Chip, { label: option.name ?? '', ...getTagProps({ index }) }))), size: "small", disablePortal: true, renderInput: (params) => jsxRuntimeExports.jsx(TextField, { ...params, size: "small" }), ListboxProps: {
17475
+ onScroll: onListboxScroll,
17476
+ sx: { maxHeight: 280, overflowY: 'auto' },
17477
+ }, noOptionsText: t('global.noOptions'), sx: { width: '100%' } })] }));
17478
+ };
17479
+
17480
+ const useImage = ({ baseUrl, spaceId, entityType, entityId, initialImageUrl, onEntityUpdated, }) => {
17481
+ const [imageUrl, setImageUrl] = useState(initialImageUrl ?? '');
17482
+ const [userTrii, setUserTrii] = useState(null);
17483
+ const [isUploading, setIsUploading] = useState(false);
17484
+ const [isDeleting, setIsDeleting] = useState(false);
17485
+ const ref = useRef(null);
17486
+ const canRequest = useMemo(() => Boolean(baseUrl && spaceId && entityType && entityId), [baseUrl, spaceId, entityType, entityId]);
17487
+ function removeSasToken(url) {
17488
+ return url.split('?sv=')[0];
17489
+ }
17490
+ function removeCacheId(url) {
17491
+ return url.split('&cacheId=')[0];
17492
+ }
17493
+ function removeParams(url) {
17494
+ let result = removeSasToken(url);
17495
+ if (!result)
17496
+ return '';
17497
+ result = removeCacheId(result);
17498
+ if (!result)
17499
+ return '';
17500
+ return result;
17501
+ }
17502
+ const ensureUserTrii = async () => {
17503
+ if (!baseUrl || !spaceId)
17504
+ return null;
17505
+ const next = await fetchUserTrii({ baseUrl, spaceId });
17506
+ setUserTrii(next);
17507
+ return next;
17508
+ };
17509
+ const getImageURLWithAccessToken = async (rawUrl) => {
17510
+ const nextUser = userTrii ?? (await ensureUserTrii());
17511
+ const storageAzureSAS = nextUser?.storageAzureSAS;
17512
+ const expireAt = storageAzureSAS?.expireAt;
17513
+ const expiredAtDate = expireAt ? new Date(expireAt) : null;
17514
+ let sas = storageAzureSAS?.sas ?? '';
17515
+ if (!sas || (expiredAtDate && expiredAtDate < new Date())) {
17516
+ const refreshed = await ensureUserTrii();
17517
+ const refreshedSas = refreshed?.storageAzureSAS?.sas;
17518
+ sas = refreshedSas ?? '';
17519
+ }
17520
+ if (!sas) {
17521
+ return rawUrl;
17522
+ }
17523
+ const cacheId = `${Date.now()}`;
17524
+ return `${rawUrl}${sas}&cacheId=${cacheId}`;
17525
+ };
17526
+ const setAccessImageUrl = async (url) => {
17527
+ if (!url) {
17528
+ setImageUrl('');
17529
+ return;
17530
+ }
17531
+ const rawUrl = removeSasToken(url);
17532
+ if (!rawUrl)
17533
+ return;
17534
+ const withSas = await getImageURLWithAccessToken(rawUrl);
17535
+ setImageUrl(withSas);
17536
+ };
17537
+ const onChange = async (event) => {
17538
+ const file = event.target.files?.[0];
17539
+ if (!file)
17540
+ return;
17541
+ if (!canRequest)
17542
+ return;
17543
+ if (ref.current) {
17544
+ ref.current.value = '';
17545
+ }
17546
+ setIsUploading(true);
17547
+ try {
17548
+ const uploadedUrl = await uploadAvatar({
17549
+ baseUrl: baseUrl,
17550
+ spaceId: spaceId,
17551
+ contactId: entityId,
17552
+ file,
17553
+ });
17554
+ const updated = await updateEntity({
17555
+ baseUrl: baseUrl,
17556
+ spaceId: spaceId,
17557
+ entityType: entityType,
17558
+ entityId: entityId,
17559
+ body: { imageUrl: uploadedUrl },
17560
+ });
17561
+ onEntityUpdated?.(updated);
17562
+ await setAccessImageUrl(uploadedUrl);
17563
+ }
17564
+ finally {
17565
+ setIsUploading(false);
17566
+ }
17567
+ };
17568
+ const uploadImage = () => {
17569
+ ref.current?.click();
17570
+ };
17571
+ const deleteImage = async () => {
17572
+ if (!canRequest)
17573
+ return;
17574
+ if (isDeleting)
17575
+ return;
17576
+ setIsDeleting(true);
17577
+ try {
17578
+ await deleteEntityPhoto({
17579
+ baseUrl: baseUrl,
17580
+ spaceId: spaceId,
17581
+ entityType: entityType,
17582
+ entityId: entityId,
17583
+ });
17584
+ onEntityUpdated?.({ imageUrl: undefined });
17585
+ setImageUrl('');
17586
+ }
17587
+ finally {
17588
+ setIsDeleting(false);
17589
+ }
17590
+ };
17591
+ useEffect(() => {
17592
+ if (!initialImageUrl) {
17593
+ setImageUrl('');
17594
+ return;
17595
+ }
17596
+ void setAccessImageUrl(initialImageUrl);
17597
+ }, [initialImageUrl]);
17598
+ return {
17599
+ inputAtributes: {
17600
+ onChange,
17601
+ ref,
17602
+ type: 'file',
17603
+ accept: 'image/*',
17604
+ },
17605
+ action: {
17606
+ uploadImage,
17607
+ deleteImage,
17608
+ },
17609
+ imageUrl,
17610
+ removeParams,
17611
+ isUploading,
17612
+ isDeleting,
17613
+ };
17614
+ };
17615
+
17616
+ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, }) => {
17617
+ const { state, selectors, actions } = useEditContactModalController({
17618
+ open,
17619
+ baseUrl,
17620
+ spaceId,
17621
+ contactId,
17622
+ });
17623
+ const [view, setView] = useState("main");
17624
+ const [draftLabels, setDraftLabels] = useState([]);
17625
+ const [tagsEditorInitialized, setTagsEditorInitialized] = useState(false);
17626
+ const [isSavingTags, setIsSavingTags] = useState(false);
17627
+ const image = useImage({
17628
+ baseUrl,
17629
+ spaceId,
17630
+ entityType: selectors.contactType === 'business' || selectors.contactType === 'contact'
17631
+ ? selectors.contactType
17632
+ : undefined,
17633
+ entityId: state.contactData ? String(state.contactData.id) : undefined,
17634
+ initialImageUrl: state.contactData?.imageUrl,
17635
+ onEntityUpdated: (entity) => {
17636
+ if (!entity || typeof entity !== 'object')
17637
+ return;
17638
+ if (!state.contactData)
17639
+ return;
17640
+ actions.setContactData({ ...state.contactData, ...entity });
17641
+ },
17642
+ });
17643
+ useEffect(() => {
17644
+ if (!open) {
17645
+ setView('main');
17646
+ setDraftLabels([]);
17647
+ setTagsEditorInitialized(false);
17648
+ setIsSavingTags(false);
17649
+ }
17650
+ }, [open]);
17651
+ const handleSaveTags = async () => {
17652
+ if (isSavingTags)
17653
+ return;
17654
+ if (!baseUrl)
17655
+ return;
17656
+ if (!spaceId)
17657
+ return;
17658
+ if (!state.contactData)
17659
+ return;
17660
+ if (selectors.contactType !== 'business' && selectors.contactType !== 'contact')
17661
+ return;
17662
+ const tags = draftLabels
17663
+ .filter((l) => l?.id && l?.name)
17664
+ .map((l) => ({ id: String(l.id), name: String(l.name) }));
17665
+ setIsSavingTags(true);
17666
+ try {
17667
+ await updateEntity({
17668
+ baseUrl,
17669
+ spaceId,
17670
+ entityType: selectors.contactType,
17671
+ entityId: String(state.contactData.id),
17672
+ body: { tags },
17673
+ });
17674
+ actions.setContactData({ ...state.contactData, tags });
17675
+ setView('main');
17676
+ }
17677
+ finally {
17678
+ setIsSavingTags(false);
17679
+ }
17680
+ };
17681
+ useEffect(() => {
17682
+ if (view !== 'tags') {
17683
+ setTagsEditorInitialized(false);
17684
+ return;
17685
+ }
17686
+ if (tagsEditorInitialized)
17687
+ return;
17688
+ if (!selectors.labels.length)
17689
+ return;
17690
+ const selectedTagIds = new Set(selectors.tags.map((t) => String(t.id)));
17691
+ const initialSelectedLabels = selectors.labels.filter((l) => selectedTagIds.has(String(l?.id)));
17692
+ setDraftLabels(initialSelectedLabels);
17693
+ setTagsEditorInitialized(true);
17694
+ }, [view, tagsEditorInitialized, selectors.labels, selectors.tags]);
15024
17695
  const handleClose = (event, reason) => {
15025
17696
  if (reason === 'escapeKeyDown') {
15026
17697
  const maybeEvent = event;
@@ -15055,7 +17726,9 @@ const EditContactModal = ({ open, onClose, baseUrl, contactId, sx,
15055
17726
  justifyContent: 'center',
15056
17727
  alignItems: 'center',
15057
17728
  minHeight: 180,
15058
- }, children: jsxRuntimeExports.jsx(CircularProgress, {}) })) : state.error ? (jsxRuntimeExports.jsx(Box, { sx: { mb: 2 }, children: "Failed to load contact" })) : state.contactData ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Header, { imgUrl: state.contactData.imageUrl, displayName: selectors.displayName }), jsxRuntimeExports.jsx(Box, { sx: { minHeight: 120 } })] })) : null }) }) }));
17729
+ }, children: jsxRuntimeExports.jsx(CircularProgress$2, {}) })) : state.error ? (jsxRuntimeExports.jsx(Box, { sx: { mb: 2 }, children: "Failed to load contact" })) : state.contactData ? (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(Box, { sx: { position: 'relative', overflow: 'hidden' }, children: [jsxRuntimeExports.jsx(Slide, { direction: "right", in: view === 'main', mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsxs(Box, { children: [jsxRuntimeExports.jsx(Header, { imgUrl: image.imageUrl, displayName: selectors.displayName, tags: selectors.tags, t: t, onEditTags: () => {
17730
+ setView('tags');
17731
+ }, onUploadPhoto: image.action.uploadImage, onPhotoFileChange: image.inputAtributes.onChange, photoInputRef: image.inputAtributes.ref, isUploadingPhoto: image.isUploading, onDeletePhoto: image.action.deleteImage, isDeletingPhoto: image.isDeleting }), jsxRuntimeExports.jsx(Box, { sx: { minHeight: 120 } })] }) }), jsxRuntimeExports.jsx(Slide, { direction: "left", in: view === 'tags', mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsx(Box, { children: jsxRuntimeExports.jsx(TagsEditor, { value: draftLabels, options: selectors.labels, onChange: setDraftLabels, onBack: () => setView('main'), onSave: handleSaveTags, isSaving: isSavingTags, t: t }) }) })] }) })) : null }) }) }));
15059
17732
  };
15060
17733
 
15061
17734
  export { ContactInfoPopup, EditContactModal };