@apia/components 3.0.22 → 3.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
1
  import uniqueId$2 from 'lodash-es/uniqueId';
2
- import { findScrollContainer, useUpdateEffect, focus, focusSelector, getFocusSelector, addBoundary, useCombinedRefs, usePrevious, EventEmitter, useMount, getLabel, getSpecificParent, isChild, useUnmount, StatefulEmitter, debugDispatcher, customEvents, getDateFormat, persistentStorage, disableChildrenFocus, enableChildrenFocus, decodeHTMLEntities, useDebouncedCallback, getIndex, noNaN, useLatest, useSubscription } from '@apia/util';
2
+ import { findScrollContainer, useUpdateEffect, focus, focusSelector, getFocusSelector, addBoundary, useCombinedRefs, usePrevious, EventEmitter, useMount, getLabel, getSpecificParent, isChild, useUnmount, StatefulEmitter, debugDispatcher, customEvents, getDateFormat, persistentStorage, disableChildrenFocus, enableChildrenFocus, decodeHTMLEntities, useDebouncedCallback, getIndex, noNaN, useLatest, useSubscription, AudioRecorder } from '@apia/util';
3
3
  import { jsx, Fragment, jsxs } from '@apia/theme/jsx-runtime';
4
4
  import * as React from 'react';
5
5
  import React__default, { createContext, useContext, useMemo, useEffect, useState, useCallback, useRef, forwardRef, Fragment as Fragment$1, useDeferredValue, lazy, Suspense, useTransition, Children, memo, isValidElement, cloneElement } from 'react';
6
6
  import usePortal from 'react-cool-portal';
7
7
  import { CSSTransition } from 'react-transition-group';
8
- import { Box, getVariant, useBreakpointIndex, Close, responsive, spacing, Heading, Spinner, Button, createElement, Select, Input, Flex, IconButton as IconButton$1, Image, injectStyles, focusOutline, makeStyledComponent, useThemeUI, Label, Progress, Grid } from '@apia/theme';
8
+ import { Box, getVariant, useBreakpointIndex, Close, responsive, spacing, Heading, Spinner, Button, createElement, Select, Input, Flex, IconButton as IconButton$1, Image, injectStyles, focusOutline, makeStyledComponent, useThemeUI, Label, Progress, Grid, Form, Textarea } from '@apia/theme';
9
9
  import { uniqueId as uniqueId$1, defaultNotifier, NotificationsList } from '@apia/notifications';
10
10
  import ReactFocusLock, { FreeFocusInside } from 'react-focus-lock';
11
11
  import { useBreakpointIndex as useBreakpointIndex$1 } from '@theme-ui/match-media';
12
- import { isIconName, Icon as Icon$1, icons } from '@apia/icons';
12
+ import { isIconName, Icon as Icon$1, icons, FileIcon } from '@apia/icons';
13
13
  import { useMenuState, ControlledMenu, MenuItem, MenuDivider, SubMenu } from '@szhsin/react-menu';
14
- import { makeAutoObservable, observable, reaction } from 'mobx';
14
+ import { makeAutoObservable, observable, reaction, makeObservable, action } from 'mobx';
15
15
  import { shallowEqual } from '@apia/store';
16
16
  import AnimateHeight from 'react-animate-height';
17
17
  import { useUpdateEffect as useUpdateEffect$1 } from 'ahooks';
@@ -23,6 +23,8 @@ import { observer } from 'mobx-react-lite';
23
23
  import { createFAsomeStore } from '@apia/dom-store';
24
24
  import { BarLoader } from 'react-spinners';
25
25
  import { keyframes } from '@emotion/react';
26
+ import { Collector } from '@apia/validations';
27
+ import { IconButton as IconButton$2, ApiaUtil as ApiaUtil$1 } from '@apia/components';
26
28
 
27
29
  const AccordionContext = createContext(null);
28
30
  const AccordionItemContext = createContext(null);
@@ -33,10 +35,10 @@ const useAccordionContext = () => {
33
35
  return context;
34
36
  };
35
37
 
36
- var __defProp$h = Object.defineProperty;
37
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
38
- var __publicField$h = (obj, key, value) => {
39
- __defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value);
38
+ var __defProp$l = Object.defineProperty;
39
+ var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
40
+ var __publicField$l = (obj, key, value) => {
41
+ __defNormalProp$l(obj, typeof key !== "symbol" ? key + "" : key, value);
40
42
  return value;
41
43
  };
42
44
  function makeItemStateSelectorHook(handler) {
@@ -68,10 +70,10 @@ class AccordionHandler {
68
70
  constructor(id, props) {
69
71
  this.id = id;
70
72
  this.props = props;
71
- __publicField$h(this, "itemsState", {});
72
- __publicField$h(this, "itemsStateListeners", {});
73
- __publicField$h(this, "propsListeners", []);
74
- __publicField$h(this, "hooks", {
73
+ __publicField$l(this, "itemsState", {});
74
+ __publicField$l(this, "itemsStateListeners", {});
75
+ __publicField$l(this, "propsListeners", []);
76
+ __publicField$l(this, "hooks", {
75
77
  useAccordionContextProvider: () => {
76
78
  const Provider = useMemo(
77
79
  () => ({ children }) => /* @__PURE__ */ jsx(AccordionContext.Provider, { value: this, children }),
@@ -1007,10 +1009,10 @@ const WindowModal = forwardRef(
1007
1009
  }
1008
1010
  );
1009
1011
 
1010
- var __defProp$g = Object.defineProperty;
1011
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1012
- var __publicField$g = (obj, key, value) => {
1013
- __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
1012
+ var __defProp$k = Object.defineProperty;
1013
+ var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1014
+ var __publicField$k = (obj, key, value) => {
1015
+ __defNormalProp$k(obj, typeof key !== "symbol" ? key + "" : key, value);
1014
1016
  return value;
1015
1017
  };
1016
1018
  var __accessCheck$c = (obj, member, msg) => {
@@ -1075,7 +1077,7 @@ _onDestroyCb = new WeakMap();
1075
1077
  const BodyScrollLock = new (_a$1 = class {
1076
1078
  constructor() {
1077
1079
  __privateAdd$c(this, _evaluate);
1078
- __publicField$g(this, "lockers", []);
1080
+ __publicField$k(this, "lockers", []);
1079
1081
  }
1080
1082
  getLocker() {
1081
1083
  const locker = new BodyScrollLocker();
@@ -1402,10 +1404,10 @@ const OpenModal = (props) => {
1402
1404
  );
1403
1405
  };
1404
1406
 
1405
- var __defProp$f = Object.defineProperty;
1406
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1407
- var __publicField$f = (obj, key, value) => {
1408
- __defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
1407
+ var __defProp$j = Object.defineProperty;
1408
+ var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1409
+ var __publicField$j = (obj, key, value) => {
1410
+ __defNormalProp$j(obj, typeof key !== "symbol" ? key + "" : key, value);
1409
1411
  return value;
1410
1412
  };
1411
1413
  var __accessCheck$b = (obj, member, msg) => {
@@ -1486,7 +1488,7 @@ class ApiaUtilModals {
1486
1488
  });
1487
1489
  return modals;
1488
1490
  });
1489
- __publicField$f(this, "Component", () => {
1491
+ __publicField$j(this, "Component", () => {
1490
1492
  const modals = __privateGet$8(this, _useModalsList).call(this);
1491
1493
  return /* @__PURE__ */ jsx(Fragment, { children: modals.map((current) => /* @__PURE__ */ jsx(OpenModal, { ...current }, current.id)) });
1492
1494
  });
@@ -1510,29 +1512,29 @@ _emitter$4 = new WeakMap();
1510
1512
  _maxId$1 = new WeakMap();
1511
1513
  _useModalsList = new WeakMap();
1512
1514
 
1513
- var __defProp$e = Object.defineProperty;
1514
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1515
- var __publicField$e = (obj, key, value) => {
1516
- __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
1515
+ var __defProp$i = Object.defineProperty;
1516
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1517
+ var __publicField$i = (obj, key, value) => {
1518
+ __defNormalProp$i(obj, typeof key !== "symbol" ? key + "" : key, value);
1517
1519
  return value;
1518
1520
  };
1519
1521
  class ApiaUtilNotifications {
1520
1522
  constructor() {
1521
- __publicField$e(this, "close", (id) => {
1523
+ __publicField$i(this, "close", (id) => {
1522
1524
  defaultNotifier.close(id);
1523
1525
  });
1524
- __publicField$e(this, "closeAll", () => {
1526
+ __publicField$i(this, "closeAll", () => {
1525
1527
  defaultNotifier.closeAll();
1526
1528
  });
1527
- __publicField$e(this, "notify", (notification) => {
1529
+ __publicField$i(this, "notify", (notification) => {
1528
1530
  defaultNotifier.notify({
1529
1531
  ...notification,
1530
1532
  type: notification.type ?? "warning"
1531
1533
  });
1532
1534
  });
1533
1535
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1534
- __publicField$e(this, "useSelector", (selector) => defaultNotifier.useSelector(selector));
1535
- __publicField$e(this, "Component", () => {
1536
+ __publicField$i(this, "useSelector", (selector) => defaultNotifier.useSelector(selector));
1537
+ __publicField$i(this, "Component", () => {
1536
1538
  return /* @__PURE__ */ jsx(NotificationsList, {});
1537
1539
  });
1538
1540
  }
@@ -1863,10 +1865,10 @@ const TabsList = observer(
1863
1865
  }
1864
1866
  );
1865
1867
 
1866
- var __defProp$d = Object.defineProperty;
1867
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1868
- var __publicField$d = (obj, key, value) => {
1869
- __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
1868
+ var __defProp$h = Object.defineProperty;
1869
+ var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1870
+ var __publicField$h = (obj, key, value) => {
1871
+ __defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value);
1870
1872
  return value;
1871
1873
  };
1872
1874
  var __accessCheck$a = (obj, member, msg) => {
@@ -1907,7 +1909,7 @@ class TabsController {
1907
1909
  this.id = id;
1908
1910
  this.props = props;
1909
1911
  __privateAdd$a(this, _innerAppend);
1910
- __publicField$d(this, "state", {
1912
+ __publicField$h(this, "state", {
1911
1913
  openTabs: /* @__PURE__ */ new Set(),
1912
1914
  tabs: /* @__PURE__ */ new Map(),
1913
1915
  timestamp: 0
@@ -2554,10 +2556,10 @@ const AlertModal = ({ children, onClose, title }) => {
2554
2556
  );
2555
2557
  };
2556
2558
 
2557
- var __defProp$c = Object.defineProperty;
2558
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2559
- var __publicField$c = (obj, key, value) => {
2560
- __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
2559
+ var __defProp$g = Object.defineProperty;
2560
+ var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2561
+ var __publicField$g = (obj, key, value) => {
2562
+ __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
2561
2563
  return value;
2562
2564
  };
2563
2565
  var __accessCheck$9 = (obj, member, msg) => {
@@ -2592,7 +2594,7 @@ class ApiaUtilDialogs {
2592
2594
  __privateAdd$9(this, _emitter$3, new EventEmitter());
2593
2595
  __privateAdd$9(this, _maxIdAlert, 0);
2594
2596
  __privateAdd$9(this, _maxIdConfirm, 0);
2595
- __publicField$c(this, "Component", () => {
2597
+ __publicField$g(this, "Component", () => {
2596
2598
  const [confirmDialogs, setConfirmDialogs] = useState([]);
2597
2599
  const [alertsDialogs, setAlertsDialogs] = useState(
2598
2600
  []
@@ -2874,25 +2876,25 @@ parseCellValue_fn = function(cellValue) {
2874
2876
  return cellValue.match(/^\s*"?([^"]+)"?[\s\r\n]*$/)?.[1] ?? cellValue;
2875
2877
  };
2876
2878
 
2877
- var __defProp$b = Object.defineProperty;
2878
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2879
- var __publicField$b = (obj, key, value) => {
2880
- __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
2879
+ var __defProp$f = Object.defineProperty;
2880
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2881
+ var __publicField$f = (obj, key, value) => {
2882
+ __defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
2881
2883
  return value;
2882
2884
  };
2883
- let maxId = 0;
2885
+ let maxId$1 = 0;
2884
2886
  class ApiaUtilTooltip {
2885
2887
  constructor(props, close) {
2886
2888
  this.props = props;
2887
2889
  this.close = close;
2888
- __publicField$b(this, "id", `tooltip__${maxId++}`);
2890
+ __publicField$f(this, "id", `tooltip__${maxId$1++}`);
2889
2891
  }
2890
2892
  }
2891
2893
 
2892
- var __defProp$a = Object.defineProperty;
2893
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2894
- var __publicField$a = (obj, key, value) => {
2895
- __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
2894
+ var __defProp$e = Object.defineProperty;
2895
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2896
+ var __publicField$e = (obj, key, value) => {
2897
+ __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
2896
2898
  return value;
2897
2899
  };
2898
2900
  var __accessCheck$7 = (obj, member, msg) => {
@@ -2926,7 +2928,7 @@ class AutomaticTooltip {
2926
2928
  __privateAdd$7(this, _tooltipTimeout, 0);
2927
2929
  __privateAdd$7(this, _unsuscribe, null);
2928
2930
  __privateAdd$7(this, _tooltipController, null);
2929
- __publicField$a(this, "ref", (el) => {
2931
+ __publicField$e(this, "ref", (el) => {
2930
2932
  var _a, _b;
2931
2933
  (_a = __privateGet$6(this, _unsuscribe)) == null ? void 0 : _a.call(this);
2932
2934
  const listener = () => {
@@ -2944,9 +2946,6 @@ class AutomaticTooltip {
2944
2946
  };
2945
2947
  const reset = () => {
2946
2948
  clearTimeout(__privateGet$6(this, _tooltipTimeout));
2947
- if (__privateGet$6(this, _tooltip)?.closeOnMouseLeaveAttachedElement) {
2948
- __privateGet$6(this, _tooltipController)?.close();
2949
- }
2950
2949
  };
2951
2950
  if (el) {
2952
2951
  el.addEventListener("mousemove", listener);
@@ -2961,7 +2960,7 @@ class AutomaticTooltip {
2961
2960
  }
2962
2961
  });
2963
2962
  __privateAdd$7(this, _tooltip, null);
2964
- __publicField$a(this, "update", (tooltip) => {
2963
+ __publicField$e(this, "update", (tooltip) => {
2965
2964
  __privateSet$5(this, _tooltip, tooltip);
2966
2965
  });
2967
2966
  __privateSet$5(this, _tooltip, tooltip);
@@ -3313,10 +3312,10 @@ const Tooltip = ({
3313
3312
  );
3314
3313
  };
3315
3314
 
3316
- var __defProp$9 = Object.defineProperty;
3317
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3318
- var __publicField$9 = (obj, key, value) => {
3319
- __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
3315
+ var __defProp$d = Object.defineProperty;
3316
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3317
+ var __publicField$d = (obj, key, value) => {
3318
+ __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
3320
3319
  return value;
3321
3320
  };
3322
3321
  var __accessCheck$6 = (obj, member, msg) => {
@@ -3336,7 +3335,7 @@ var _emitter$2, _shoutChangedList;
3336
3335
  class ApiaUtilTooltips {
3337
3336
  constructor() {
3338
3337
  __privateAdd$6(this, _emitter$2, new EventEmitter());
3339
- __publicField$9(this, "tooltips", []);
3338
+ __publicField$d(this, "tooltips", []);
3340
3339
  __privateAdd$6(this, _shoutChangedList, () => {
3341
3340
  __privateGet$5(this, _emitter$2).emit("changedList", [...this.tooltips]);
3342
3341
  });
@@ -3344,7 +3343,7 @@ class ApiaUtilTooltips {
3344
3343
  * Permite crear un tooltip que se abrirá automáticamente al estar parado
3345
3344
  * sobre un elemento durante 300ms
3346
3345
  */
3347
- __publicField$9(this, "useHover", (tooltip) => {
3346
+ __publicField$d(this, "useHover", (tooltip) => {
3348
3347
  let tt = void 0;
3349
3348
  tt = useMemo(() => {
3350
3349
  tt?.ref(null);
@@ -3355,15 +3354,15 @@ class ApiaUtilTooltips {
3355
3354
  });
3356
3355
  return tt;
3357
3356
  });
3358
- __publicField$9(this, "close", (id) => {
3357
+ __publicField$d(this, "close", (id) => {
3359
3358
  this.tooltips = this.tooltips.filter((current) => current.id !== id);
3360
3359
  __privateGet$5(this, _shoutChangedList).call(this);
3361
3360
  });
3362
- __publicField$9(this, "closeAll", () => {
3361
+ __publicField$d(this, "closeAll", () => {
3363
3362
  this.tooltips = [];
3364
3363
  __privateGet$5(this, _shoutChangedList).call(this);
3365
3364
  });
3366
- __publicField$9(this, "open", (tooltip) => {
3365
+ __publicField$d(this, "open", (tooltip) => {
3367
3366
  const controller = new ApiaUtilTooltip(tooltip, () => {
3368
3367
  this.close(controller.id);
3369
3368
  controller.props.onClose?.();
@@ -3376,7 +3375,7 @@ class ApiaUtilTooltips {
3376
3375
  __privateGet$5(this, _shoutChangedList).call(this);
3377
3376
  return controller;
3378
3377
  });
3379
- __publicField$9(this, "Component", () => {
3378
+ __publicField$d(this, "Component", () => {
3380
3379
  const [tooltips, setTooltips] = useState(this.tooltips);
3381
3380
  useMount(() => {
3382
3381
  const unsuscribeToList = __privateGet$5(this, _emitter$2).on("changedList", (ev) => {
@@ -3412,10 +3411,10 @@ class ApiaUtilTooltips {
3412
3411
  _emitter$2 = new WeakMap();
3413
3412
  _shoutChangedList = new WeakMap();
3414
3413
 
3415
- var __defProp$8 = Object.defineProperty;
3416
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3417
- var __publicField$8 = (obj, key, value) => {
3418
- __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
3414
+ var __defProp$c = Object.defineProperty;
3415
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3416
+ var __publicField$c = (obj, key, value) => {
3417
+ __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
3419
3418
  return value;
3420
3419
  };
3421
3420
  var __accessCheck$5 = (obj, member, msg) => {
@@ -3452,7 +3451,7 @@ class ApiaUtilMenu {
3452
3451
  constructor() {
3453
3452
  __privateAdd$5(this, _emitter$1, new EventEmitter());
3454
3453
  __privateAdd$5(this, _items$1, []);
3455
- __publicField$8(this, "menuProps", null);
3454
+ __publicField$c(this, "menuProps", null);
3456
3455
  __privateAdd$5(this, _hooks, {
3457
3456
  useIsOpen: () => {
3458
3457
  const [isOpen, setIsOpen] = useState(false);
@@ -3467,10 +3466,10 @@ class ApiaUtilMenu {
3467
3466
  ];
3468
3467
  }
3469
3468
  });
3470
- __publicField$8(this, "close", () => {
3469
+ __publicField$c(this, "close", () => {
3471
3470
  __privateGet$4(this, _emitter$1).emit("toggle", false);
3472
3471
  });
3473
- __publicField$8(this, "open", ({
3472
+ __publicField$c(this, "open", ({
3474
3473
  menuProps,
3475
3474
  items
3476
3475
  }) => {
@@ -3494,7 +3493,7 @@ class ApiaUtilMenu {
3494
3493
  return /* @__PURE__ */ createElement(MenuItem, { ...current, key: current.key }, children);
3495
3494
  }) });
3496
3495
  });
3497
- __publicField$8(this, "Component", () => {
3496
+ __publicField$c(this, "Component", () => {
3498
3497
  const [isOpen, close] = __privateGet$4(this, _hooks).useIsOpen();
3499
3498
  if (!isOpen)
3500
3499
  return null;
@@ -3519,17 +3518,17 @@ _hooks = new WeakMap();
3519
3518
  _maxId = new WeakMap();
3520
3519
  _RenderMenu = new WeakMap();
3521
3520
 
3522
- var __defProp$7 = Object.defineProperty;
3523
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3524
- var __publicField$7 = (obj, key, value) => {
3525
- __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
3521
+ var __defProp$b = Object.defineProperty;
3522
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3523
+ var __publicField$b = (obj, key, value) => {
3524
+ __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
3526
3525
  return value;
3527
3526
  };
3528
3527
  class ApiaUtilMouse extends EventEmitter {
3529
3528
  constructor() {
3530
3529
  super();
3531
- __publicField$7(this, "x", 0);
3532
- __publicField$7(this, "y", 0);
3530
+ __publicField$b(this, "x", 0);
3531
+ __publicField$b(this, "y", 0);
3533
3532
  document.addEventListener("mousemove", (ev) => {
3534
3533
  this.x = ev.clientX;
3535
3534
  this.y = ev.clientY;
@@ -3541,10 +3540,10 @@ class ApiaUtilMouse extends EventEmitter {
3541
3540
  }
3542
3541
  }
3543
3542
 
3544
- var __defProp$6 = Object.defineProperty;
3545
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3546
- var __publicField$6 = (obj, key, value) => {
3547
- __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
3543
+ var __defProp$a = Object.defineProperty;
3544
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3545
+ var __publicField$a = (obj, key, value) => {
3546
+ __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
3548
3547
  return value;
3549
3548
  };
3550
3549
  var __accessCheck$4 = (obj, member, msg) => {
@@ -3568,15 +3567,15 @@ var __privateSet$3 = (obj, member, value, setter) => {
3568
3567
  var _instance;
3569
3568
  const _ApiaUtil = class _ApiaUtil {
3570
3569
  constructor() {
3571
- __publicField$6(this, "dialogs");
3572
- __publicField$6(this, "menu");
3573
- __publicField$6(this, "modals");
3574
- __publicField$6(this, "mouse");
3575
- __publicField$6(this, "notifications");
3576
- __publicField$6(this, "parsers");
3577
- __publicField$6(this, "tabs");
3578
- __publicField$6(this, "tooltips");
3579
- __publicField$6(this, "Component", () => {
3570
+ __publicField$a(this, "dialogs");
3571
+ __publicField$a(this, "menu");
3572
+ __publicField$a(this, "modals");
3573
+ __publicField$a(this, "mouse");
3574
+ __publicField$a(this, "notifications");
3575
+ __publicField$a(this, "parsers");
3576
+ __publicField$a(this, "tabs");
3577
+ __publicField$a(this, "tooltips");
3578
+ __publicField$a(this, "Component", () => {
3580
3579
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3581
3580
  /* @__PURE__ */ jsx(this.dialogs.Component, {}),
3582
3581
  /* @__PURE__ */ jsx(this.modals.Component, {}),
@@ -3605,22 +3604,22 @@ _instance = new WeakMap();
3605
3604
  __privateAdd$4(_ApiaUtil, _instance, void 0);
3606
3605
  let ApiaUtil = _ApiaUtil;
3607
3606
 
3608
- var __defProp$5 = Object.defineProperty;
3609
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3610
- var __publicField$5 = (obj, key, value) => {
3611
- __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
3607
+ var __defProp$9 = Object.defineProperty;
3608
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3609
+ var __publicField$9 = (obj, key, value) => {
3610
+ __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
3612
3611
  return value;
3613
3612
  };
3614
3613
  class ScreenLocker {
3615
3614
  constructor() {
3616
- __publicField$5(this, "emitter", new StatefulEmitter({
3615
+ __publicField$9(this, "emitter", new StatefulEmitter({
3617
3616
  locks: {
3618
3617
  common: { count: 0 },
3619
3618
  linear: { count: 0 },
3620
3619
  white: { count: 1 }
3621
3620
  }
3622
3621
  }));
3623
- __publicField$5(this, "lock", (options) => {
3622
+ __publicField$9(this, "lock", (options) => {
3624
3623
  this.emitter.setState("locks", (s) => {
3625
3624
  const key = options?.type ?? "common";
3626
3625
  return {
@@ -3636,11 +3635,11 @@ class ScreenLocker {
3636
3635
  };
3637
3636
  });
3638
3637
  });
3639
- __publicField$5(this, "hasReleased", false);
3638
+ __publicField$9(this, "hasReleased", false);
3640
3639
  /**
3641
3640
  * This method will work once, then, the action will be ignored. The ScreenLocker starts always locked on white, when this method is called, all listeners of onRelease will be called and the lock will be released.
3642
3641
  */
3643
- __publicField$5(this, "release", () => {
3642
+ __publicField$9(this, "release", () => {
3644
3643
  if (this.hasReleased)
3645
3644
  return;
3646
3645
  this.hasReleased = true;
@@ -3656,11 +3655,11 @@ class ScreenLocker {
3656
3655
  /**
3657
3656
  * This method notifies when the screenLock is released by the first time.
3658
3657
  */
3659
- __publicField$5(this, "onRelease", this.emitter.on.bind(this.emitter, "release"));
3658
+ __publicField$9(this, "onRelease", this.emitter.on.bind(this.emitter, "release"));
3660
3659
  /**
3661
3660
  * This component is the responsible for putting the lock courtain in the browser when it's required. It must be used once per application.
3662
3661
  */
3663
- __publicField$5(this, "Component", () => {
3662
+ __publicField$9(this, "Component", () => {
3664
3663
  const locks = this.emitter.useState("locks");
3665
3664
  const style = {
3666
3665
  alignItems: "center",
@@ -3730,10 +3729,10 @@ const OptionsBox = observer(() => {
3730
3729
  }) });
3731
3730
  });
3732
3731
 
3733
- var __defProp$4 = Object.defineProperty;
3734
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3735
- var __publicField$4 = (obj, key, value) => {
3736
- __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
3732
+ var __defProp$8 = Object.defineProperty;
3733
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3734
+ var __publicField$8 = (obj, key, value) => {
3735
+ __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
3737
3736
  return value;
3738
3737
  };
3739
3738
  var __accessCheck$3 = (obj, member, msg) => {
@@ -3757,7 +3756,7 @@ var __privateSet$2 = (obj, member, value, setter) => {
3757
3756
  var _actualSearch, _makeSearch, _search;
3758
3757
  class AutocompleteController {
3759
3758
  constructor(properties) {
3760
- __publicField$4(this, "state", {
3759
+ __publicField$8(this, "state", {
3761
3760
  disabled: false,
3762
3761
  id: uniqueId$3("autocomplete"),
3763
3762
  loading: false,
@@ -3782,7 +3781,7 @@ class AutocompleteController {
3782
3781
  return debounce(__privateGet$2(this, _actualSearch), this.state.searchDebounce);
3783
3782
  });
3784
3783
  __privateAdd$3(this, _search, __privateGet$2(this, _makeSearch).call(this));
3785
- __publicField$4(this, "tooltipRef", null);
3784
+ __publicField$8(this, "tooltipRef", null);
3786
3785
  Object.assign(this.state, properties);
3787
3786
  if (properties.value) {
3788
3787
  this.state.showValue = properties.value;
@@ -4442,10 +4441,10 @@ const Checkbox$1 = forwardRef(
4442
4441
  );
4443
4442
  Checkbox$1.displayName = "Checkbox";
4444
4443
 
4445
- var __defProp$3 = Object.defineProperty;
4446
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4447
- var __publicField$3 = (obj, key, value) => {
4448
- __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
4444
+ var __defProp$7 = Object.defineProperty;
4445
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4446
+ var __publicField$7 = (obj, key, value) => {
4447
+ __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
4449
4448
  return value;
4450
4449
  };
4451
4450
  var __accessCheck$2 = (obj, member, msg) => {
@@ -4470,7 +4469,7 @@ var _onFocusCallbacks, _a;
4470
4469
  const historySize = 50;
4471
4470
  const globalFocus = new (_a = class {
4472
4471
  constructor() {
4473
- __publicField$3(this, "focused", []);
4472
+ __publicField$7(this, "focused", []);
4474
4473
  __privateAdd$2(this, _onFocusCallbacks, []);
4475
4474
  debugDispatcher.on(
4476
4475
  "focusHistory",
@@ -4705,8 +4704,11 @@ const DateInput = React__default.forwardRef(
4705
4704
  const shoutOnChange = React__default.useCallback(
4706
4705
  (newValue) => {
4707
4706
  if (newValue !== lastEmittedValue.current && onChange) {
4708
- lastEmittedValue.current = newValue;
4709
- return onChange(newValue);
4707
+ const result = onChange(newValue);
4708
+ if (result) {
4709
+ lastEmittedValue.current = newValue;
4710
+ }
4711
+ return result;
4710
4712
  }
4711
4713
  return true;
4712
4714
  },
@@ -5942,10 +5944,10 @@ const ListboxItem = memo(
5942
5944
  );
5943
5945
  ListboxItem.displayName = "ListboxItem";
5944
5946
 
5945
- var __defProp$2 = Object.defineProperty;
5946
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5947
- var __publicField$2 = (obj, key, value) => {
5948
- __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
5947
+ var __defProp$6 = Object.defineProperty;
5948
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5949
+ var __publicField$6 = (obj, key, value) => {
5950
+ __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
5949
5951
  return value;
5950
5952
  };
5951
5953
  var __accessCheck$1 = (obj, member, msg) => {
@@ -5967,10 +5969,10 @@ class WaiTypeAhead extends EventEmitter {
5967
5969
  super();
5968
5970
  __privateAdd$1(this, _restoreTimeout);
5969
5971
  __privateAdd$1(this, _shout);
5970
- __publicField$2(this, "frequency", 2.5);
5972
+ __publicField$6(this, "frequency", 2.5);
5971
5973
  // Keys per second
5972
- __publicField$2(this, "timeout", 0);
5973
- __publicField$2(this, "typing", "");
5974
+ __publicField$6(this, "timeout", 0);
5975
+ __publicField$6(this, "typing", "");
5974
5976
  const { onMultipleKeys, onSingleKey, onTypeUpdate } = props ?? {};
5975
5977
  if (onMultipleKeys)
5976
5978
  this.on("multipleKeys", onMultipleKeys);
@@ -7542,18 +7544,18 @@ function importComponent(path) {
7542
7544
  });
7543
7545
  }
7544
7546
 
7545
- var __defProp$1 = Object.defineProperty;
7546
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7547
- var __publicField$1 = (obj, key, value) => {
7548
- __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
7547
+ var __defProp$5 = Object.defineProperty;
7548
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7549
+ var __publicField$5 = (obj, key, value) => {
7550
+ __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
7549
7551
  return value;
7550
7552
  };
7551
7553
  class ToolbarController extends EventEmitter {
7552
7554
  constructor() {
7553
7555
  super(...arguments);
7554
- __publicField$1(this, "eventListeners", {});
7555
- __publicField$1(this, "itemsState", {});
7556
- __publicField$1(this, "hooks", {
7556
+ __publicField$5(this, "eventListeners", {});
7557
+ __publicField$5(this, "itemsState", {});
7558
+ __publicField$5(this, "hooks", {
7557
7559
  useItemState: (id, initialState) => {
7558
7560
  const [state, setState] = useState(initialState);
7559
7561
  useEffect(() => {
@@ -7567,11 +7569,11 @@ class ToolbarController extends EventEmitter {
7567
7569
  return state;
7568
7570
  }
7569
7571
  });
7570
- __publicField$1(this, "setItemState", (id, newState) => {
7572
+ __publicField$5(this, "setItemState", (id, newState) => {
7571
7573
  this.itemsState[id] = { ...this.itemsState[id], ...newState };
7572
7574
  this.emit("updateItemState", id);
7573
7575
  });
7574
- __publicField$1(this, "Context", ({ children }) => {
7576
+ __publicField$5(this, "Context", ({ children }) => {
7575
7577
  return /* @__PURE__ */ jsx(ToolbarControllerContext.Provider, { value: this, children });
7576
7578
  });
7577
7579
  }
@@ -7742,10 +7744,10 @@ const Toolbar = ({
7742
7744
  ) });
7743
7745
  };
7744
7746
 
7745
- var __defProp = Object.defineProperty;
7746
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7747
- var __publicField = (obj, key, value) => {
7748
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7747
+ var __defProp$4 = Object.defineProperty;
7748
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7749
+ var __publicField$4 = (obj, key, value) => {
7750
+ __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
7749
7751
  return value;
7750
7752
  };
7751
7753
  var __accessCheck = (obj, member, msg) => {
@@ -7776,7 +7778,7 @@ class SortableListHandler {
7776
7778
  constructor() {
7777
7779
  __privateAdd(this, _emitter, new EventEmitter());
7778
7780
  __privateAdd(this, _items, []);
7779
- __publicField(this, "updateChildren", (items) => {
7781
+ __publicField$4(this, "updateChildren", (items) => {
7780
7782
  __privateSet(this, _items, Children.toArray(items).filter(
7781
7783
  (el) => isValidElement(el)
7782
7784
  ));
@@ -7794,7 +7796,7 @@ class SortableListHandler {
7794
7796
  __privateGet(this, _items).splice(insertIndex + (after ? 1 : 0), 0, item);
7795
7797
  __privateGet(this, _emitter).emit("sort", null);
7796
7798
  });
7797
- __publicField(this, "useItemEvents", () => {
7799
+ __publicField$4(this, "useItemEvents", () => {
7798
7800
  const unsuscribe = useRef(() => {
7799
7801
  });
7800
7802
  const ref = useCallback((el) => {
@@ -7836,7 +7838,7 @@ class SortableListHandler {
7836
7838
  }, []);
7837
7839
  return ref;
7838
7840
  });
7839
- __publicField(this, "useSortChange", (onSortChange) => {
7841
+ __publicField$4(this, "useSortChange", (onSortChange) => {
7840
7842
  useSubscription({
7841
7843
  makeSubscription: () => {
7842
7844
  return __privateGet(this, _emitter).on("sort", () => {
@@ -7845,7 +7847,7 @@ class SortableListHandler {
7845
7847
  }
7846
7848
  });
7847
7849
  });
7848
- __publicField(this, "useWrapperEvents", () => {
7850
+ __publicField$4(this, "useWrapperEvents", () => {
7849
7851
  const unsuscribe = useRef(() => {
7850
7852
  });
7851
7853
  const ref = useCallback((el) => {
@@ -7958,5 +7960,838 @@ const SortableList = makeStyledComponent(
7958
7960
  UnstyledSortableList
7959
7961
  );
7960
7962
 
7961
- export { Accordion, AccordionContext, AccordionItem, AccordionItemButton, AccordionItemContent, AccordionItemContext, AlertModal, ApiaFilter, ApiaUtil, ApiaUtilModalHandler, ApiaUtilTooltip, AutoEllipsis, Autocomplete, AutocompleteController, AutogrowTextarea, BaseButton, CalendarModal, Captcha, Checkbox$1 as Checkbox, CollapsiblePanel, Confirm, ConfirmModal, ContainerWithHeader, DateInput, DefaultIconRenderer, DefaultTabsLabelRenderer, DialogButtonBar, FieldErrorMessage, FieldLabel, IconButton, IconInput, IconsList, LabelBox, LinearLoader$1 as LinearLoader, ListSkeletonLoader, Listbox, ListboxItem, LoaderSpinner$1 as LoaderSpinner, Modal, NumberInput, Overlay, ProgressBar$1 as ProgressBar, RequiredMark, ScreenLocker, SimpleButton, SortableList, SortableListItem, Tab, Tabs, TabsContent, TabsController, TabsList, Toolbar, ToolbarController, ToolbarIconButton, ToolbarInput, ToolbarSelect, ToolbarSeparator, ToolbarTextButton, UnstyledSortableList, WaiTypeAhead, getFieldErrorStyles, getFieldTouchedStyles, importComponent, makeResponsiveComponent, parseNumberInputValueToNumber, parseNumberValueToNumberInput, useAccordionContext, useModal, useModalContext, useOtherTagButton };
7963
+ var __defProp$3 = Object.defineProperty;
7964
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7965
+ var __publicField$3 = (obj, key, value) => {
7966
+ __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
7967
+ return value;
7968
+ };
7969
+ let maxId = 0;
7970
+ class ChatMessage {
7971
+ constructor(message = "", messageType = "user", attachments = [], reference = null) {
7972
+ this.message = message;
7973
+ this.messageType = messageType;
7974
+ this.attachments = attachments;
7975
+ this.reference = reference;
7976
+ __publicField$3(this, "id");
7977
+ __publicField$3(this, "clone", () => new ChatMessage(
7978
+ this.message,
7979
+ this.messageType,
7980
+ this.attachments.map((x) => {
7981
+ return { ...x };
7982
+ }),
7983
+ this.reference
7984
+ ));
7985
+ this.id = maxId++;
7986
+ if (messageType === "response")
7987
+ this.messageType = "system";
7988
+ if (typeof message === "string")
7989
+ this.message = message;
7990
+ makeObservable(this, {
7991
+ attachments: observable,
7992
+ message: observable,
7993
+ messageType: observable,
7994
+ reference: observable
7995
+ });
7996
+ }
7997
+ removeAttachment(attachment) {
7998
+ this.attachments = this.attachments.filter(
7999
+ (current) => current !== attachment
8000
+ );
8001
+ }
8002
+ addAttachmentDescription(attachment, description) {
8003
+ const a = this.attachments.find((current) => current === attachment);
8004
+ if (a) {
8005
+ a.description = description;
8006
+ }
8007
+ }
8008
+ }
8009
+
8010
+ const AutoscrollContainer = ({ children }) => {
8011
+ const observer = useRef(null);
8012
+ const unsuscribe = useRef(null);
8013
+ const isFullScrolled = useRef(false);
8014
+ const hasInited = useRef(false);
8015
+ const ref = useCallback((el) => {
8016
+ if (!el)
8017
+ return;
8018
+ if (!hasInited.current) {
8019
+ hasInited.current = true;
8020
+ el.scrollTo({
8021
+ top: el.getBoundingClientRect().height,
8022
+ behavior: "auto"
8023
+ });
8024
+ isFullScrolled.current = true;
8025
+ }
8026
+ observer.current?.disconnect();
8027
+ unsuscribe.current?.();
8028
+ observer.current = new MutationObserver(([mutation]) => {
8029
+ if (mutation && mutation.target instanceof HTMLElement) {
8030
+ if (isFullScrolled.current && el.scrollTop !== el.scrollHeight - el.offsetHeight) {
8031
+ el.scrollTo({
8032
+ top: el.scrollHeight,
8033
+ behavior: "smooth"
8034
+ });
8035
+ }
8036
+ }
8037
+ });
8038
+ observer.current.observe(el, { childList: true, subtree: true });
8039
+ const handleScroll = (ev) => {
8040
+ if (ev.target === el && el instanceof HTMLElement) {
8041
+ setTimeout(() => {
8042
+ isFullScrolled.current = Math.abs(el.scrollTop - (el.scrollHeight - el.offsetHeight)) < 150;
8043
+ }, 100);
8044
+ }
8045
+ };
8046
+ el.addEventListener("scroll", handleScroll);
8047
+ unsuscribe.current = () => {
8048
+ el.removeEventListener("scroll", handleScroll);
8049
+ };
8050
+ }, []);
8051
+ return /* @__PURE__ */ jsx(
8052
+ Box,
8053
+ {
8054
+ ...getVariant("layout.common.components.autoscrollContainer"),
8055
+ className: "autoscrollContainer",
8056
+ ref,
8057
+ children
8058
+ }
8059
+ );
8060
+ };
8061
+
8062
+ function getBase64FromFile(f) {
8063
+ return ((f2) => new Promise((resolve, reject) => {
8064
+ const reader = new FileReader();
8065
+ reader.readAsDataURL(f2);
8066
+ reader.onload = () => resolve(reader.result);
8067
+ reader.onerror = () => reject();
8068
+ }))(f);
8069
+ }
8070
+ function getBase64FromBlob(b) {
8071
+ return ((blob) => new Promise((resolve, reject) => {
8072
+ const reader = new FileReader();
8073
+ reader.onloadend = () => {
8074
+ const base64String = reader.result;
8075
+ resolve(base64String);
8076
+ };
8077
+ reader.onerror = reject;
8078
+ reader.readAsDataURL(blob);
8079
+ }))(b);
8080
+ }
8081
+ function getFileExtension(name) {
8082
+ return name.split(".").at(-1);
8083
+ }
8084
+ function isImage(base64) {
8085
+ const imageRegex = /^data:image\/(png|jpeg|jpg|gif|webp|bmp|tiff);base64,/;
8086
+ return imageRegex.test(base64);
8087
+ }
8088
+
8089
+ const FileAttachment = observer(
8090
+ ({
8091
+ attachment,
8092
+ onAddDescription,
8093
+ onRemove
8094
+ }) => {
8095
+ const { ref } = ApiaUtil.instance.tooltips.useHover({
8096
+ preferredOrientationX: "left",
8097
+ preferredOrientationY: "top",
8098
+ minSize: {
8099
+ width: 200,
8100
+ height: 400
8101
+ },
8102
+ attachToMousePosition: true,
8103
+ closeOnMouseLeaveAttachedElement: true,
8104
+ children: /* @__PURE__ */ jsxs(
8105
+ Box,
8106
+ {
8107
+ sx: {
8108
+ display: "flex",
8109
+ alignItems: "center",
8110
+ flexDirection: "column"
8111
+ },
8112
+ children: [
8113
+ /* @__PURE__ */ jsx("h1", { children: attachment.name }),
8114
+ /* @__PURE__ */ jsx("img", { src: attachment.value }),
8115
+ attachment.description && /* @__PURE__ */ jsx(Label, { children: attachment.description })
8116
+ ]
8117
+ }
8118
+ )
8119
+ });
8120
+ return /* @__PURE__ */ jsxs(
8121
+ Box,
8122
+ {
8123
+ id: `file_box_${attachment.id}`,
8124
+ className: "file_box",
8125
+ ref: isImage(attachment.value) ? ref : null,
8126
+ children: [
8127
+ /* @__PURE__ */ jsx(FileIcon, { className: "file_box__icon", docName: attachment.name }),
8128
+ /* @__PURE__ */ jsx(Box, { className: "file_box__name", title: attachment.name, children: attachment.name }),
8129
+ onAddDescription && /* @__PURE__ */ jsx(
8130
+ IconButton,
8131
+ {
8132
+ icon: "Edit",
8133
+ className: "file_box__description",
8134
+ onClick: () => {
8135
+ const collector = new Collector();
8136
+ collector.add(
8137
+ new collector.fields.textarea(
8138
+ "desc",
8139
+ getLabel("lblDesc").text,
8140
+ { initialValue: attachment.description }
8141
+ )
8142
+ );
8143
+ collector.show({
8144
+ onConfirm: (ev) => {
8145
+ if (ev) {
8146
+ onAddDescription(attachment, ev.desc);
8147
+ }
8148
+ return true;
8149
+ }
8150
+ });
8151
+ },
8152
+ variant: "icon-only"
8153
+ }
8154
+ ),
8155
+ onRemove && /* @__PURE__ */ jsx(
8156
+ IconButton,
8157
+ {
8158
+ icon: "Close",
8159
+ className: "file_box__remove",
8160
+ onClick: onRemove,
8161
+ variant: "icon-only"
8162
+ }
8163
+ )
8164
+ ]
8165
+ }
8166
+ );
8167
+ }
8168
+ );
8169
+
8170
+ const Attachments = observer(
8171
+ ({
8172
+ attachments,
8173
+ onRemove,
8174
+ onAddDescription
8175
+ }) => {
8176
+ if (!attachments.length)
8177
+ return null;
8178
+ return /* @__PURE__ */ jsx(
8179
+ Box,
8180
+ {
8181
+ className: "attachments",
8182
+ ...getVariant("layout.common.newChat.attachments"),
8183
+ children: attachments.map((x) => /* @__PURE__ */ jsx(
8184
+ FileAttachment,
8185
+ {
8186
+ attachment: x,
8187
+ onRemove: onRemove ? () => onRemove(x) : void 0,
8188
+ onAddDescription
8189
+ },
8190
+ x.id
8191
+ ))
8192
+ }
8193
+ );
8194
+ }
8195
+ );
8196
+
8197
+ const Message = observer(
8198
+ ({
8199
+ className,
8200
+ type,
8201
+ id,
8202
+ message,
8203
+ attachments,
8204
+ reference
8205
+ }) => {
8206
+ return /* @__PURE__ */ jsxs(
8207
+ Box,
8208
+ {
8209
+ as: "pre",
8210
+ className: `history_message ${className || ""} ${type}`,
8211
+ children: [
8212
+ /* @__PURE__ */ jsx(
8213
+ Box,
8214
+ {
8215
+ className: "history_message__content",
8216
+ ...typeof message === "string" ? { dangerouslySetInnerHTML: { __html: message } } : { children: message }
8217
+ }
8218
+ ),
8219
+ attachments.length > 0 && /* @__PURE__ */ jsx(Attachments, { attachments }),
8220
+ reference && /* @__PURE__ */ jsx(Box, { className: "history_message__references", children: reference })
8221
+ ]
8222
+ },
8223
+ id
8224
+ );
8225
+ }
8226
+ );
8227
+
8228
+ const History = observer(({ messages }) => {
8229
+ let currentType = "";
8230
+ return /* @__PURE__ */ jsx(AutoscrollContainer, { children: /* @__PURE__ */ jsx(
8231
+ Box,
8232
+ {
8233
+ ...getVariant("layout.common.newChat.history"),
8234
+ className: "chat_history",
8235
+ children: messages.map((current, i) => {
8236
+ let first = false;
8237
+ let last = false;
8238
+ if (currentType !== current.messageType) {
8239
+ currentType = current.messageType;
8240
+ first = true;
8241
+ }
8242
+ if (i === messages.length - 1 || messages[i + 1].messageType !== current.messageType) {
8243
+ last = true;
8244
+ }
8245
+ return /* @__PURE__ */ jsx(
8246
+ Message,
8247
+ {
8248
+ className: first ? "first" : last ? "last" : void 0,
8249
+ type: current.messageType,
8250
+ id: String(current.id),
8251
+ attachments: current.attachments,
8252
+ reference: current.reference,
8253
+ message: current.message
8254
+ }
8255
+ );
8256
+ })
8257
+ }
8258
+ ) });
8259
+ });
8260
+
8261
+ const TextArea = observer(
8262
+ ({
8263
+ isLoading,
8264
+ isRecording,
8265
+ disablePrevButton,
8266
+ disableNextButton,
8267
+ onSubmit,
8268
+ onChange,
8269
+ onClearHistory,
8270
+ onAttach,
8271
+ onRecord,
8272
+ onVideoRecord,
8273
+ onPrev,
8274
+ onNext,
8275
+ value
8276
+ }) => {
8277
+ const fileInputRef = useRef(null);
8278
+ const searchControlsRef = useRef(null);
8279
+ const recordButton = /* @__PURE__ */ jsx(
8280
+ IconButton$2,
8281
+ {
8282
+ className: `${isRecording ? "isRecording" : ""}`,
8283
+ variant: "icon-only",
8284
+ onClick: onRecord,
8285
+ disabled: isLoading && !isRecording,
8286
+ sx: {
8287
+ color: isRecording ? "red" : void 0
8288
+ },
8289
+ icon: isRecording ? "Stop" : "Microphone",
8290
+ id: "transcribeAudio",
8291
+ iconSize: "Sm",
8292
+ title: getLabel("lblAiRecordAudio").text
8293
+ }
8294
+ );
8295
+ const handleAttachments = async (ev) => {
8296
+ if (ev.target.files) {
8297
+ for await (const f of ev.target.files) {
8298
+ const base64 = await getBase64FromFile(f);
8299
+ onAttach({
8300
+ value: base64,
8301
+ name: f.name,
8302
+ id: f.name
8303
+ });
8304
+ }
8305
+ ev.target.value = "";
8306
+ }
8307
+ };
8308
+ const menuItemsList = [
8309
+ {
8310
+ children: getLabel("btnUpload").text,
8311
+ title: getLabel("btnUpload").text,
8312
+ icon: "File",
8313
+ onClick: () => fileInputRef.current?.click(),
8314
+ key: "2"
8315
+ },
8316
+ {
8317
+ title: getLabel("lblOpenCamera").text,
8318
+ children: getLabel("lblOpenCamera").text,
8319
+ icon: "Camera",
8320
+ onClick: onVideoRecord,
8321
+ key: "3"
8322
+ },
8323
+ {
8324
+ title: getLabel("lblAiRecordAudio").text,
8325
+ children: getLabel("lblAiRecordAudio").text,
8326
+ key: "4",
8327
+ onClick: (event) => onRecord(event),
8328
+ icon: isRecording ? "Stop" : "Microphone"
8329
+ },
8330
+ "separator",
8331
+ {
8332
+ icon: "ArrowLeft",
8333
+ children: getLabel("btnAiPrevious").text,
8334
+ title: getLabel("btnAiPrevious").text,
8335
+ onClick: onPrev,
8336
+ disabled: disablePrevButton,
8337
+ key: "0"
8338
+ },
8339
+ {
8340
+ icon: "ArrowRight",
8341
+ children: getLabel("btnAiNext").text,
8342
+ title: getLabel("btnAiNext").text,
8343
+ onClick: onNext,
8344
+ disabled: disableNextButton,
8345
+ key: "1"
8346
+ },
8347
+ "separator",
8348
+ {
8349
+ icon: "Trash",
8350
+ onClick: onClearHistory,
8351
+ key: "5",
8352
+ children: getLabel("btnAiDeleteMessages").text,
8353
+ title: getLabel("btnAiDeleteMessages").text
8354
+ }
8355
+ ];
8356
+ return /* @__PURE__ */ jsxs(
8357
+ Form,
8358
+ {
8359
+ onSubmit: (ev) => {
8360
+ ev.preventDefault();
8361
+ onSubmit();
8362
+ },
8363
+ className: "search_controls",
8364
+ ...getVariant("layout.common.newChat.form"),
8365
+ children: [
8366
+ /* @__PURE__ */ jsx(
8367
+ Textarea,
8368
+ {
8369
+ ref: searchControlsRef,
8370
+ "aria-label": (
8371
+ /** TODO: Crear etiqueta para búsqueda */
8372
+ "Frase de b\xFAsqueda"
8373
+ ),
8374
+ value,
8375
+ className: "searchTextArea",
8376
+ onChange: (ev) => onChange(ev.target.value),
8377
+ onKeyDown: (ev) => {
8378
+ if (ev.code === "Enter" && !ev.shiftKey) {
8379
+ ev.preventDefault();
8380
+ ev.target.closest("form").querySelector('[type="submit"]').click();
8381
+ }
8382
+ }
8383
+ }
8384
+ ),
8385
+ /* @__PURE__ */ jsx(
8386
+ "input",
8387
+ {
8388
+ ref: fileInputRef,
8389
+ id: "invisible__attach__file",
8390
+ type: "file",
8391
+ multiple: true,
8392
+ onChange: handleAttachments,
8393
+ sx: { display: "none" }
8394
+ }
8395
+ ),
8396
+ /* @__PURE__ */ jsx(
8397
+ IconButton$2,
8398
+ {
8399
+ className: "ChatBarButton",
8400
+ disabled: isLoading,
8401
+ icon: "Ellipsis",
8402
+ variant: "icon-only",
8403
+ iconSize: "Sm",
8404
+ onClick: (ev) => {
8405
+ ApiaUtil$1.instance.menu.open({
8406
+ menuProps: {
8407
+ anchorPoint: { x: ev.clientX, y: ev.clientY }
8408
+ },
8409
+ items: menuItemsList
8410
+ });
8411
+ }
8412
+ }
8413
+ ),
8414
+ isRecording ? recordButton : /* @__PURE__ */ jsx(
8415
+ IconButton$2,
8416
+ {
8417
+ className: "ChatBarButton",
8418
+ isLoading,
8419
+ icon: "ArrowRight",
8420
+ variant: "icon-only",
8421
+ iconSize: "Sm",
8422
+ title: getLabel("btnBus").title,
8423
+ type: "submit"
8424
+ }
8425
+ )
8426
+ ]
8427
+ }
8428
+ );
8429
+ }
8430
+ );
8431
+
8432
+ var __defProp$2 = Object.defineProperty;
8433
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8434
+ var __publicField$2 = (obj, key, value) => {
8435
+ __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
8436
+ return value;
8437
+ };
8438
+ class CameraController {
8439
+ constructor() {
8440
+ __publicField$2(this, "state", {
8441
+ videoStream: null,
8442
+ isOpen: false
8443
+ });
8444
+ __publicField$2(this, "currentCapture", null);
8445
+ __publicField$2(this, "videoElement");
8446
+ __publicField$2(this, "Component", () => {
8447
+ return /* @__PURE__ */ jsx(
8448
+ "video",
8449
+ {
8450
+ ref: (el) => {
8451
+ if (el) {
8452
+ el.srcObject = this.videoElement.srcObject;
8453
+ el.autoplay = true;
8454
+ el.playsInline = true;
8455
+ }
8456
+ },
8457
+ style: { width: "100%", height: "auto" }
8458
+ }
8459
+ );
8460
+ });
8461
+ makeObservable(this, {
8462
+ state: observable,
8463
+ openCamera: action,
8464
+ closeCamera: action
8465
+ });
8466
+ this.videoElement = document.createElement("video");
8467
+ this.videoElement.autoplay = true;
8468
+ this.videoElement.playsInline = true;
8469
+ }
8470
+ async openCamera() {
8471
+ try {
8472
+ const stream = await navigator.mediaDevices.getUserMedia({ video: true });
8473
+ this.state.videoStream = stream;
8474
+ this.videoElement.srcObject = stream;
8475
+ this.state.isOpen = true;
8476
+ ApiaUtil$1.instance.modals.open({
8477
+ children: /* @__PURE__ */ jsx(this.Component, {}),
8478
+ onConfirm: () => {
8479
+ this.closeCamera();
8480
+ },
8481
+ onClose: () => {
8482
+ this.closeCamera();
8483
+ }
8484
+ });
8485
+ } catch (error) {
8486
+ console.error("Error while accessing the camera:", error);
8487
+ this.state.isOpen = false;
8488
+ this.closeCamera();
8489
+ }
8490
+ }
8491
+ async closeCamera() {
8492
+ if (!this.videoElement.srcObject)
8493
+ return null;
8494
+ const canvas = document.createElement("canvas");
8495
+ canvas.width = this.videoElement.videoWidth;
8496
+ canvas.height = this.videoElement.videoHeight;
8497
+ const ctx = canvas.getContext("2d");
8498
+ if (ctx)
8499
+ ctx.drawImage(this.videoElement, 0, 0, canvas.width, canvas.height);
8500
+ this.currentCapture = await new Promise((resolve) => {
8501
+ canvas.toBlob((blob) => {
8502
+ if (blob) {
8503
+ const file = new File([blob], "captured_image.jpg", {
8504
+ type: "image/jpeg"
8505
+ });
8506
+ resolve(file);
8507
+ } else {
8508
+ this.closeCamera();
8509
+ }
8510
+ }, "image/jpeg");
8511
+ }).finally(() => {
8512
+ this.state.videoStream?.getTracks().forEach((track) => track.stop());
8513
+ this.state.videoStream = null;
8514
+ this.videoElement.srcObject = null;
8515
+ this.state.isOpen = false;
8516
+ });
8517
+ }
8518
+ pop() {
8519
+ const returnFile = this.currentCapture;
8520
+ this.currentCapture = null;
8521
+ return returnFile;
8522
+ }
8523
+ }
8524
+
8525
+ var __defProp$1 = Object.defineProperty;
8526
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8527
+ var __publicField$1 = (obj, key, value) => {
8528
+ __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
8529
+ return value;
8530
+ };
8531
+ class ChatController {
8532
+ constructor(props, onMessageSubmit) {
8533
+ this.onMessageSubmit = onMessageSubmit;
8534
+ __publicField$1(this, "currentIndex", 0);
8535
+ __publicField$1(this, "state", {
8536
+ isLoading: false,
8537
+ canRecord: true,
8538
+ canAttach: true,
8539
+ maxAttachmentsSize: 100,
8540
+ messages: [],
8541
+ currentMessage: new ChatMessage("", "user")
8542
+ });
8543
+ __publicField$1(this, "internalAudioRecorder", new AudioRecorder());
8544
+ __publicField$1(this, "internalCameraRecorder", new CameraController());
8545
+ __publicField$1(this, "maxId", 0);
8546
+ __publicField$1(this, "audioRecorder", {
8547
+ start: () => {
8548
+ this.state.isLoading = true;
8549
+ this.internalAudioRecorder.start().then(async (blob) => {
8550
+ this.state.currentMessage.attachments.push({
8551
+ id: String(this.maxId++),
8552
+ name: `userRecord_${this.audioRecorder.record++}.wav`,
8553
+ value: await getBase64FromBlob(blob)
8554
+ });
8555
+ this.handleSubmit();
8556
+ }).finally(() => {
8557
+ this.state.isLoading = false;
8558
+ });
8559
+ },
8560
+ stop: async () => {
8561
+ this.internalAudioRecorder.stop();
8562
+ },
8563
+ record: 0,
8564
+ state: this.internalAudioRecorder.state
8565
+ });
8566
+ __publicField$1(this, "handleSubmit", async () => {
8567
+ if (this.state.currentMessage.message || this.state.currentMessage.attachments.length > 0) {
8568
+ this.state.isLoading = true;
8569
+ await this.onMessageSubmit({
8570
+ message: this.state.currentMessage,
8571
+ ...this.getAdditionalProps()
8572
+ });
8573
+ this.state.isLoading = false;
8574
+ this.state.currentMessage = new ChatMessage("", "user");
8575
+ }
8576
+ });
8577
+ __publicField$1(this, "History", observer(() => /* @__PURE__ */ jsx(History, { messages: this.state.messages })));
8578
+ __publicField$1(this, "Attachments", observer(() => /* @__PURE__ */ jsx(
8579
+ Attachments,
8580
+ {
8581
+ attachments: this.state.currentMessage.attachments,
8582
+ onRemove: (a) => {
8583
+ this.removeAttachment(a);
8584
+ },
8585
+ onAddDescription: (a, ev) => this.state.currentMessage.addAttachmentDescription(a, ev)
8586
+ }
8587
+ )));
8588
+ __publicField$1(this, "TextArea", observer(() => /* @__PURE__ */ jsx(
8589
+ TextArea,
8590
+ {
8591
+ value: this.state.currentMessage.message,
8592
+ isLoading: this.state.isLoading,
8593
+ isRecording: this.internalAudioRecorder.state.recording,
8594
+ disablePrevButton: !this.canGoPrev(),
8595
+ disableNextButton: !this.canGoNext(),
8596
+ onChange: (ev) => {
8597
+ this.state.currentMessage.message = ev;
8598
+ },
8599
+ onSubmit: () => this.handleSubmit(),
8600
+ onClearHistory: () => {
8601
+ this.clearHistory();
8602
+ },
8603
+ onAttach: async (ev) => {
8604
+ this.state.currentMessage.attachments.push({
8605
+ ...ev,
8606
+ id: String(this.maxId++)
8607
+ });
8608
+ },
8609
+ onRecord: () => {
8610
+ !this.internalAudioRecorder.state.recording ? this.audioRecorder.start() : this.audioRecorder.stop();
8611
+ },
8612
+ onVideoRecord: async () => {
8613
+ !this.internalCameraRecorder.state.isOpen && await this.internalCameraRecorder.openCamera();
8614
+ await new Promise((resolve, _) => {
8615
+ const checkCapture = async () => {
8616
+ if (!this.internalCameraRecorder.state.isOpen) {
8617
+ const capture = this.internalCameraRecorder.pop();
8618
+ if (capture) {
8619
+ this.state.currentMessage.attachments.push({
8620
+ id: String(this.maxId++),
8621
+ name: capture.name,
8622
+ value: await getBase64FromFile(capture)
8623
+ });
8624
+ return resolve();
8625
+ }
8626
+ } else {
8627
+ requestAnimationFrame(checkCapture);
8628
+ }
8629
+ };
8630
+ checkCapture();
8631
+ });
8632
+ },
8633
+ onPrev: () => {
8634
+ this.prevMessage();
8635
+ },
8636
+ onNext: () => {
8637
+ this.nextMessage();
8638
+ },
8639
+ attachments: []
8640
+ }
8641
+ )));
8642
+ __publicField$1(this, "Renderer", () => /* @__PURE__ */ jsxs(
8643
+ Box,
8644
+ {
8645
+ ...getVariant("layout.common.newChat.controller"),
8646
+ className: "chat_controller",
8647
+ children: [
8648
+ /* @__PURE__ */ jsx(this.History, {}),
8649
+ /* @__PURE__ */ jsx(this.Attachments, {}),
8650
+ /* @__PURE__ */ jsx(this.TextArea, {})
8651
+ ]
8652
+ }
8653
+ ));
8654
+ this.state = Object.assign({}, this.state, props);
8655
+ makeObservable(this, { state: observable });
8656
+ }
8657
+ removeMessage(idx) {
8658
+ this.state.messages = this.state.messages.filter((_, i) => i !== idx);
8659
+ }
8660
+ addMessage(message) {
8661
+ this.state.messages.push(message);
8662
+ this.currentIndex = this.state.messages.length;
8663
+ }
8664
+ clearHistory() {
8665
+ this.state.messages = [];
8666
+ }
8667
+ clearMessage() {
8668
+ this.state.currentMessage = new ChatMessage("", "user");
8669
+ }
8670
+ removeAttachment(attachment) {
8671
+ this.state.currentMessage.removeAttachment(attachment);
8672
+ }
8673
+ isForHistory(message) {
8674
+ return message && message.messageType === "user";
8675
+ }
8676
+ canGoNext() {
8677
+ let condition = false;
8678
+ const slice = this.state.messages.slice(
8679
+ this.currentIndex,
8680
+ this.state.messages.length
8681
+ );
8682
+ const n = slice.length;
8683
+ if (this.currentIndex + 1 > n) {
8684
+ return condition;
8685
+ }
8686
+ for (let i = 0; i < n && !condition; i++) {
8687
+ const current = slice[i];
8688
+ condition = current.messageType === "user";
8689
+ }
8690
+ return condition;
8691
+ }
8692
+ canGoPrev() {
8693
+ let condition = false;
8694
+ if (this.currentIndex - 1 === -1) {
8695
+ return condition;
8696
+ }
8697
+ for (let i = this.state.messages.slice(0, this.currentIndex).length - 1; i >= 0 && !condition; i--) {
8698
+ const current = this.state.messages[i];
8699
+ condition = current.messageType === "user";
8700
+ }
8701
+ return condition;
8702
+ }
8703
+ nextMessage() {
8704
+ let newCurrentMessage = void 0;
8705
+ let i = this.currentIndex;
8706
+ const n = this.state.messages.length;
8707
+ if (n === 0 || n - 1 === i) {
8708
+ return;
8709
+ }
8710
+ while (!newCurrentMessage && i < n - 1) {
8711
+ newCurrentMessage = this.state.messages[i + 1];
8712
+ i++;
8713
+ if (this.isForHistory(newCurrentMessage)) {
8714
+ this.state.currentMessage = newCurrentMessage.clone();
8715
+ break;
8716
+ } else {
8717
+ newCurrentMessage = void 0;
8718
+ }
8719
+ if (i === this.currentIndex) {
8720
+ break;
8721
+ }
8722
+ }
8723
+ this.currentIndex = i;
8724
+ }
8725
+ prevMessage() {
8726
+ let newCurrentMessage = void 0;
8727
+ let i = this.currentIndex;
8728
+ const n = this.state.messages.length;
8729
+ if (n === 0 || i === 0) {
8730
+ return;
8731
+ }
8732
+ while (!newCurrentMessage && i > 0) {
8733
+ newCurrentMessage = this.state.messages[i - 1];
8734
+ i--;
8735
+ if (this.isForHistory(newCurrentMessage)) {
8736
+ this.state.currentMessage = newCurrentMessage.clone();
8737
+ break;
8738
+ } else {
8739
+ newCurrentMessage = void 0;
8740
+ }
8741
+ if (i === this.currentIndex) {
8742
+ break;
8743
+ }
8744
+ }
8745
+ this.currentIndex = i;
8746
+ }
8747
+ getAdditionalProps() {
8748
+ return {};
8749
+ }
8750
+ }
8751
+
8752
+ var __defProp = Object.defineProperty;
8753
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8754
+ var __publicField = (obj, key, value) => {
8755
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8756
+ return value;
8757
+ };
8758
+ class FloatingChatController extends ChatController {
8759
+ constructor(props, onMessageSubmit, modalTitle) {
8760
+ super({ ...props, isVisible: true }, onMessageSubmit);
8761
+ this.modalTitle = modalTitle;
8762
+ __publicField(this, "Window", observer(() => {
8763
+ return this.state.isVisible ? /* @__PURE__ */ jsx(
8764
+ IconButton,
8765
+ {
8766
+ className: "chat_controller__open",
8767
+ icon: "Magic",
8768
+ size: "Md",
8769
+ variant: "icon-outline",
8770
+ onClick: () => {
8771
+ this.state.isVisible = false;
8772
+ this.open(() => {
8773
+ this.state.isVisible = true;
8774
+ });
8775
+ }
8776
+ }
8777
+ ) : null;
8778
+ }));
8779
+ makeObservable({ open: action });
8780
+ }
8781
+ open(onClose) {
8782
+ ApiaUtil.instance.modals.open({
8783
+ variant: "layout.common.newChat.assistant.floatingAssistant",
8784
+ defaultPosition: {
8785
+ bottom: "10px",
8786
+ right: "10px"
8787
+ },
8788
+ draggable: true,
8789
+ children: /* @__PURE__ */ jsx(this.Renderer, {}),
8790
+ onClose,
8791
+ title: this.modalTitle
8792
+ });
8793
+ }
8794
+ }
8795
+
8796
+ export { Accordion, AccordionContext, AccordionItem, AccordionItemButton, AccordionItemContent, AccordionItemContext, AlertModal, ApiaFilter, ApiaUtil, ApiaUtilModalHandler, ApiaUtilTooltip, AutoEllipsis, Autocomplete, AutocompleteController, AutogrowTextarea, AutoscrollContainer, BaseButton, CalendarModal, Captcha, ChatController, ChatMessage, Checkbox$1 as Checkbox, CollapsiblePanel, Confirm, ConfirmModal, ContainerWithHeader, DateInput, DefaultIconRenderer, DefaultTabsLabelRenderer, DialogButtonBar, FieldErrorMessage, FieldLabel, FloatingChatController, IconButton, IconInput, IconsList, LabelBox, LinearLoader$1 as LinearLoader, ListSkeletonLoader, Listbox, ListboxItem, LoaderSpinner$1 as LoaderSpinner, Modal, NumberInput, Overlay, ProgressBar$1 as ProgressBar, RequiredMark, ScreenLocker, SimpleButton, SortableList, SortableListItem, Tab, Tabs, TabsContent, TabsController, TabsList, Toolbar, ToolbarController, ToolbarIconButton, ToolbarInput, ToolbarSelect, ToolbarSeparator, ToolbarTextButton, UnstyledSortableList, WaiTypeAhead, getBase64FromBlob, getBase64FromFile, getFieldErrorStyles, getFieldTouchedStyles, getFileExtension, importComponent, isImage, makeResponsiveComponent, parseNumberInputValueToNumber, parseNumberValueToNumberInput, useAccordionContext, useModal, useModalContext, useOtherTagButton };
7962
8797
  //# sourceMappingURL=index.js.map