funda-ui 4.5.888 → 4.6.101

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.
@@ -965,7 +965,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
965
965
 
966
966
  // initialize default row height
967
967
  if (el.scrollHeight > 0 && !defaultRowHeightInit) {
968
- setDefaultRowHeight(el.scrollHeight + parseInt(style.borderTopWidth) + parseInt(style.borderBottomWidth));
968
+ var _defaultRowHeight = el.scrollHeight + parseInt(style.borderTopWidth) + parseInt(style.borderBottomWidth);
969
+ if (maxHeight != 0 && _defaultRowHeight >= maxHeight) {
970
+ _defaultRowHeight = maxHeight;
971
+ }
972
+ setDefaultRowHeight(_defaultRowHeight);
969
973
  setDefaultRowHeightInit(true);
970
974
  }
971
975
 
@@ -982,11 +986,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
982
986
 
983
987
  // !!! Compare initial height and changed height
984
988
  if (scrollHeight > defaultRowHeight && defaultRowHeight > 0) {
985
- if (maxHeight != 0 && scrollHeight >= maxHeight) {
986
- el.style.height = maxHeight + "px";
987
- } else {
988
- el.style.height = scrollHeight + "px";
989
+ var _scrollHeight = scrollHeight;
990
+ if (maxHeight != 0 && _scrollHeight >= maxHeight) {
991
+ _scrollHeight = maxHeight;
989
992
  }
993
+ el.style.height = _scrollHeight + "px";
990
994
  }
991
995
  cb === null || cb === void 0 ? void 0 : cb([_controlWidth, scrollHeight]);
992
996
  }
@@ -1009,8 +1013,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1009
1013
  /***/
1010
1014
  },
1011
1015
 
1012
- /***/85: /***/function _(module, exports, __nested_webpack_require_39618__) {
1013
- /* module decorator */module = __nested_webpack_require_39618__.nmd(module);
1016
+ /***/85: /***/function _(module, exports, __nested_webpack_require_39872__) {
1017
+ /* module decorator */module = __nested_webpack_require_39872__.nmd(module);
1014
1018
  var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
1015
1019
  function _typeof(obj) {
1016
1020
  "@babel/helpers - typeof";
@@ -1022,7 +1026,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1022
1026
  }, _typeof(obj);
1023
1027
  }
1024
1028
  (function webpackUniversalModuleDefinition(root, factory) {
1025
- if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__nested_webpack_require_39618__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__nested_webpack_require_39618__(787)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
1029
+ if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__nested_webpack_require_39872__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__nested_webpack_require_39872__(787)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
1026
1030
  })(this, function (__WEBPACK_EXTERNAL_MODULE__787__) {
1027
1031
  return (/******/function () {
1028
1032
  // webpackBootstrap
@@ -1182,8 +1186,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1182
1186
  /***/
1183
1187
  },
1184
1188
 
1185
- /***/702: /***/function _(module, exports, __nested_webpack_require_47706__) {
1186
- /* module decorator */module = __nested_webpack_require_47706__.nmd(module);
1189
+ /***/702: /***/function _(module, exports, __nested_webpack_require_47960__) {
1190
+ /* module decorator */module = __nested_webpack_require_47960__.nmd(module);
1187
1191
  var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
1188
1192
  function _typeof(obj) {
1189
1193
  "@babel/helpers - typeof";
@@ -1195,7 +1199,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1195
1199
  }, _typeof(obj);
1196
1200
  }
1197
1201
  (function webpackUniversalModuleDefinition(root, factory) {
1198
- if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__nested_webpack_require_47706__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__nested_webpack_require_47706__(787)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
1202
+ if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__nested_webpack_require_47960__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__nested_webpack_require_47960__(787)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
1199
1203
  })(this, function (__WEBPACK_EXTERNAL_MODULE__787__) {
1200
1204
  return (/******/function () {
1201
1205
  // webpackBootstrap
@@ -1396,7 +1400,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1396
1400
  /******/
1397
1401
  /******/ // The require function
1398
1402
  /******/
1399
- function __nested_webpack_require_57327__(moduleId) {
1403
+ function __nested_webpack_require_57581__(moduleId) {
1400
1404
  /******/ // Check if module is in cache
1401
1405
  /******/var cachedModule = __webpack_module_cache__[moduleId];
1402
1406
  /******/
@@ -1415,7 +1419,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1415
1419
  /******/
1416
1420
  /******/ // Execute the module function
1417
1421
  /******/
1418
- __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_57327__);
1422
+ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_57581__);
1419
1423
  /******/
1420
1424
  /******/ // Flag the module as loaded
1421
1425
  /******/
@@ -1432,14 +1436,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1432
1436
  /******/
1433
1437
  (function () {
1434
1438
  /******/ // getDefaultExport function for compatibility with non-harmony modules
1435
- /******/__nested_webpack_require_57327__.n = function (module) {
1439
+ /******/__nested_webpack_require_57581__.n = function (module) {
1436
1440
  /******/var getter = module && module.__esModule ? /******/function () {
1437
1441
  return module['default'];
1438
1442
  } : /******/function () {
1439
1443
  return module;
1440
1444
  };
1441
1445
  /******/
1442
- __nested_webpack_require_57327__.d(getter, {
1446
+ __nested_webpack_require_57581__.d(getter, {
1443
1447
  a: getter
1444
1448
  });
1445
1449
  /******/
@@ -1453,9 +1457,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1453
1457
  /******/
1454
1458
  (function () {
1455
1459
  /******/ // define getter functions for harmony exports
1456
- /******/__nested_webpack_require_57327__.d = function (exports, definition) {
1460
+ /******/__nested_webpack_require_57581__.d = function (exports, definition) {
1457
1461
  /******/for (var key in definition) {
1458
- /******/if (__nested_webpack_require_57327__.o(definition, key) && !__nested_webpack_require_57327__.o(exports, key)) {
1462
+ /******/if (__nested_webpack_require_57581__.o(definition, key) && !__nested_webpack_require_57581__.o(exports, key)) {
1459
1463
  /******/Object.defineProperty(exports, key, {
1460
1464
  enumerable: true,
1461
1465
  get: definition[key]
@@ -1472,7 +1476,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1472
1476
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
1473
1477
  /******/
1474
1478
  (function () {
1475
- /******/__nested_webpack_require_57327__.o = function (obj, prop) {
1479
+ /******/__nested_webpack_require_57581__.o = function (obj, prop) {
1476
1480
  return Object.prototype.hasOwnProperty.call(obj, prop);
1477
1481
  };
1478
1482
  /******/
@@ -1482,7 +1486,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1482
1486
  /******/
1483
1487
  (function () {
1484
1488
  /******/ // define __esModule on exports
1485
- /******/__nested_webpack_require_57327__.r = function (exports) {
1489
+ /******/__nested_webpack_require_57581__.r = function (exports) {
1486
1490
  /******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
1487
1491
  /******/Object.defineProperty(exports, Symbol.toStringTag, {
1488
1492
  value: 'Module'
@@ -1501,7 +1505,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1501
1505
  /******/ /* webpack/runtime/node module decorator */
1502
1506
  /******/
1503
1507
  (function () {
1504
- /******/__nested_webpack_require_57327__.nmd = function (module) {
1508
+ /******/__nested_webpack_require_57581__.nmd = function (module) {
1505
1509
  /******/module.paths = [];
1506
1510
  /******/
1507
1511
  if (!module.children) module.children = [];
@@ -1518,38 +1522,38 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1518
1522
  (function () {
1519
1523
  "use strict";
1520
1524
 
1521
- __nested_webpack_require_57327__.r(__webpack_exports__);
1525
+ __nested_webpack_require_57581__.r(__webpack_exports__);
1522
1526
  /* harmony export */
1523
- __nested_webpack_require_57327__.d(__webpack_exports__, {
1527
+ __nested_webpack_require_57581__.d(__webpack_exports__, {
1524
1528
  /* harmony export */"default": function _default() {
1525
1529
  return __WEBPACK_DEFAULT_EXPORT__;
1526
1530
  }
1527
1531
  /* harmony export */
1528
1532
  });
1529
1533
  /* harmony import */
1530
- var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_57327__(787);
1534
+ var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_57581__(787);
1531
1535
  /* harmony import */
1532
- var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_57327__.n(react__WEBPACK_IMPORTED_MODULE_0__);
1536
+ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_57581__.n(react__WEBPACK_IMPORTED_MODULE_0__);
1533
1537
  /* harmony import */
1534
- var funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_57327__(85);
1538
+ var funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_57581__(85);
1535
1539
  /* harmony import */
1536
- var funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nested_webpack_require_57327__.n(funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1__);
1540
+ var funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nested_webpack_require_57581__.n(funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1__);
1537
1541
  /* harmony import */
1538
- var funda_utils_dist_cjs_useAutosizeTextArea__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_57327__(372);
1542
+ var funda_utils_dist_cjs_useAutosizeTextArea__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_57581__(372);
1539
1543
  /* harmony import */
1540
- var funda_utils_dist_cjs_useAutosizeTextArea__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__nested_webpack_require_57327__.n(funda_utils_dist_cjs_useAutosizeTextArea__WEBPACK_IMPORTED_MODULE_2__);
1544
+ var funda_utils_dist_cjs_useAutosizeTextArea__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__nested_webpack_require_57581__.n(funda_utils_dist_cjs_useAutosizeTextArea__WEBPACK_IMPORTED_MODULE_2__);
1541
1545
  /* harmony import */
1542
- var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_57327__(188);
1546
+ var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_57581__(188);
1543
1547
  /* harmony import */
1544
- var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nested_webpack_require_57327__.n(funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3__);
1548
+ var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nested_webpack_require_57581__.n(funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3__);
1545
1549
  /* harmony import */
1546
- var funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_57327__(954);
1550
+ var funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_57581__(954);
1547
1551
  /* harmony import */
1548
- var funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__nested_webpack_require_57327__.n(funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_4__);
1552
+ var funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__nested_webpack_require_57581__.n(funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_4__);
1549
1553
  /* harmony import */
1550
- var funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_57327__(702);
1554
+ var funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_57581__(702);
1551
1555
  /* harmony import */
1552
- var funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__nested_webpack_require_57327__.n(funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_5__);
1556
+ var funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__nested_webpack_require_57581__.n(funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_5__);
1553
1557
  var _excluded = ["contentRef", "wrapperClassName", "controlClassName", "controlExClassName", "controlGroupWrapperClassName", "controlGroupTextClassName", "cols", "rows", "disabled", "required", "placeholder", "autoSize", "autoSizeMaxHeight", "iconLeft", "iconRight", "aiPredict", "aiPredictRemainingTextRGB", "aiPredictConfirmKey", "aiPredictFetchFuncAsync", "aiPredictFetchFuncMethod", "aiPredictFetchFuncMethodParams", "aiPredictFetchCallback", "readOnly", "defaultValue", "value", "requiredLabel", "label", "name", "id", "minLength", "maxLength", "style", "tabIndex", "onChangeCallback", "onInputCallback", "onKeyPressedCallback", "onChange", "onBlur", "onFocus", "onPressEnter", "onKeyDown", "onKeyUp", "onResize"];
1554
1558
  function _regeneratorRuntime() {
1555
1559
  "use strict";
@@ -2509,6 +2513,246 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
2509
2513
 
2510
2514
  /***/ }),
2511
2515
 
2516
+ /***/ 761:
2517
+ /***/ (function(module, exports, __webpack_require__) {
2518
+
2519
+ /* module decorator */ module = __webpack_require__.nmd(module);
2520
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2521
+ (function webpackUniversalModuleDefinition(root, factory) {
2522
+ if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__webpack_require__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(787)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
2523
+ __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
2524
+ (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
2525
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
2526
+ })(this, function (__WEBPACK_EXTERNAL_MODULE__787__) {
2527
+ return (/******/function () {
2528
+ // webpackBootstrap
2529
+ /******/
2530
+ "use strict";
2531
+
2532
+ /******/
2533
+ var __webpack_modules__ = {
2534
+ /***/787: /***/function _(module) {
2535
+ module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
2536
+
2537
+ /***/
2538
+ }
2539
+
2540
+ /******/
2541
+ };
2542
+ /************************************************************************/
2543
+ /******/ // The module cache
2544
+ /******/
2545
+ var __webpack_module_cache__ = {};
2546
+ /******/
2547
+ /******/ // The require function
2548
+ /******/
2549
+ function __nested_webpack_require_1465__(moduleId) {
2550
+ /******/ // Check if module is in cache
2551
+ /******/var cachedModule = __webpack_module_cache__[moduleId];
2552
+ /******/
2553
+ if (cachedModule !== undefined) {
2554
+ /******/return cachedModule.exports;
2555
+ /******/
2556
+ }
2557
+ /******/ // Create a new module (and put it into the cache)
2558
+ /******/
2559
+ var module = __webpack_module_cache__[moduleId] = {
2560
+ /******/ // no module.id needed
2561
+ /******/ // no module.loaded needed
2562
+ /******/exports: {}
2563
+ /******/
2564
+ };
2565
+ /******/
2566
+ /******/ // Execute the module function
2567
+ /******/
2568
+ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_1465__);
2569
+ /******/
2570
+ /******/ // Return the exports of the module
2571
+ /******/
2572
+ return module.exports;
2573
+ /******/
2574
+ }
2575
+ /******/
2576
+ /************************************************************************/
2577
+ /******/ /* webpack/runtime/compat get default export */
2578
+ /******/
2579
+ (function () {
2580
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
2581
+ /******/__nested_webpack_require_1465__.n = function (module) {
2582
+ /******/var getter = module && module.__esModule ? /******/function () {
2583
+ return module['default'];
2584
+ } : /******/function () {
2585
+ return module;
2586
+ };
2587
+ /******/
2588
+ __nested_webpack_require_1465__.d(getter, {
2589
+ a: getter
2590
+ });
2591
+ /******/
2592
+ return getter;
2593
+ /******/
2594
+ };
2595
+ /******/
2596
+ })();
2597
+ /******/
2598
+ /******/ /* webpack/runtime/define property getters */
2599
+ /******/
2600
+ (function () {
2601
+ /******/ // define getter functions for harmony exports
2602
+ /******/__nested_webpack_require_1465__.d = function (exports, definition) {
2603
+ /******/for (var key in definition) {
2604
+ /******/if (__nested_webpack_require_1465__.o(definition, key) && !__nested_webpack_require_1465__.o(exports, key)) {
2605
+ /******/Object.defineProperty(exports, key, {
2606
+ enumerable: true,
2607
+ get: definition[key]
2608
+ });
2609
+ /******/
2610
+ }
2611
+ /******/
2612
+ }
2613
+ /******/
2614
+ };
2615
+ /******/
2616
+ })();
2617
+ /******/
2618
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
2619
+ /******/
2620
+ (function () {
2621
+ /******/__nested_webpack_require_1465__.o = function (obj, prop) {
2622
+ return Object.prototype.hasOwnProperty.call(obj, prop);
2623
+ };
2624
+ /******/
2625
+ })();
2626
+ /******/
2627
+ /******/ /* webpack/runtime/make namespace object */
2628
+ /******/
2629
+ (function () {
2630
+ /******/ // define __esModule on exports
2631
+ /******/__nested_webpack_require_1465__.r = function (exports) {
2632
+ /******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
2633
+ /******/Object.defineProperty(exports, Symbol.toStringTag, {
2634
+ value: 'Module'
2635
+ });
2636
+ /******/
2637
+ }
2638
+ /******/
2639
+ Object.defineProperty(exports, '__esModule', {
2640
+ value: true
2641
+ });
2642
+ /******/
2643
+ };
2644
+ /******/
2645
+ })();
2646
+ /******/
2647
+ /************************************************************************/
2648
+ var __webpack_exports__ = {};
2649
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
2650
+ (function () {
2651
+ __nested_webpack_require_1465__.r(__webpack_exports__);
2652
+ /* harmony export */
2653
+ __nested_webpack_require_1465__.d(__webpack_exports__, {
2654
+ /* harmony export */"default": function _default() {
2655
+ return __WEBPACK_DEFAULT_EXPORT__;
2656
+ }
2657
+ /* harmony export */
2658
+ });
2659
+ /* harmony import */
2660
+ var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1465__(787);
2661
+ /* harmony import */
2662
+ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_1465__.n(react__WEBPACK_IMPORTED_MODULE_0__);
2663
+ function _toConsumableArray(arr) {
2664
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
2665
+ }
2666
+ function _nonIterableSpread() {
2667
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2668
+ }
2669
+ function _unsupportedIterableToArray(o, minLen) {
2670
+ if (!o) return;
2671
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
2672
+ var n = Object.prototype.toString.call(o).slice(8, -1);
2673
+ if (n === "Object" && o.constructor) n = o.constructor.name;
2674
+ if (n === "Map" || n === "Set") return Array.from(o);
2675
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
2676
+ }
2677
+ function _iterableToArray(iter) {
2678
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2679
+ }
2680
+ function _arrayWithoutHoles(arr) {
2681
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
2682
+ }
2683
+ function _arrayLikeToArray(arr, len) {
2684
+ if (len == null || len > arr.length) len = arr.length;
2685
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
2686
+ return arr2;
2687
+ }
2688
+ /**
2689
+ * Handles the event of clicking outside of the wrapped component
2690
+ *
2691
+ * @usage:
2692
+
2693
+ const App = () => {
2694
+
2695
+ const [show, setShow] = useState<boolean>(false);
2696
+ const dropdownRef = useRef<HTMLDivElement>(null);
2697
+
2698
+ useClickOutside({
2699
+ enabled: show && dropdownRef.current,
2700
+ isOutside: (event: any) => {
2701
+ return event.target.closest(`.test__wrapper`) === null && event.target.closest(`.test__wrapper2`) === null;
2702
+ },
2703
+ handle: (event: any) => {
2704
+ // do something
2705
+ //...
2706
+ },
2707
+ spyElement: document
2708
+ }, [show, dropdownRef]);
2709
+ };
2710
+
2711
+ */
2712
+
2713
+ function useClickOutside(_ref, deps) {
2714
+ var enabled = _ref.enabled,
2715
+ isOutside = _ref.isOutside,
2716
+ handle = _ref.handle,
2717
+ _ref$spyElement = _ref.spyElement,
2718
+ spyElement = _ref$spyElement === void 0 ? typeof document === 'undefined' ? null : document : _ref$spyElement;
2719
+ var isOutsideRef = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(isOutside);
2720
+ var handleRef = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(handle);
2721
+ (0, react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
2722
+ isOutsideRef.current = isOutside;
2723
+
2724
+ // fix possible issue if clicking on a focusable element
2725
+ handleRef.current = handle;
2726
+ }, [isOutside, handle]);
2727
+ (0, react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
2728
+ if (enabled) {
2729
+ var eventHandler = function eventHandler(event) {
2730
+ var _isOutsideRef$current;
2731
+ if ((_isOutsideRef$current = isOutsideRef.current) !== null && _isOutsideRef$current !== void 0 && _isOutsideRef$current.call(isOutsideRef, event)) {
2732
+ var _handleRef$current;
2733
+ (_handleRef$current = handleRef.current) === null || _handleRef$current === void 0 ? void 0 : _handleRef$current.call(handleRef, event);
2734
+ }
2735
+ };
2736
+ spyElement === null || spyElement === void 0 ? void 0 : spyElement.addEventListener('pointerdown', eventHandler);
2737
+ return function () {
2738
+ spyElement === null || spyElement === void 0 ? void 0 : spyElement.removeEventListener('pointerdown', eventHandler);
2739
+ };
2740
+ }
2741
+ }, [enabled].concat(_toConsumableArray(deps)));
2742
+ }
2743
+ /* harmony default export */
2744
+ var __WEBPACK_DEFAULT_EXPORT__ = useClickOutside;
2745
+ })();
2746
+
2747
+ /******/
2748
+ return __webpack_exports__;
2749
+ /******/
2750
+ }()
2751
+ );
2752
+ });
2753
+
2754
+ /***/ }),
2755
+
2512
2756
  /***/ 85:
2513
2757
  /***/ (function(module, exports, __webpack_require__) {
2514
2758
 
@@ -3186,6 +3430,9 @@ var useDebounce_default = /*#__PURE__*/__webpack_require__.n(useDebounce);
3186
3430
  // EXTERNAL MODULE: ../Utils/dist/cjs/useThrottle.js
3187
3431
  var useThrottle = __webpack_require__(195);
3188
3432
  var useThrottle_default = /*#__PURE__*/__webpack_require__.n(useThrottle);
3433
+ // EXTERNAL MODULE: ../Utils/dist/cjs/useClickOutside.js
3434
+ var useClickOutside = __webpack_require__(761);
3435
+ var useClickOutside_default = /*#__PURE__*/__webpack_require__.n(useClickOutside);
3189
3436
  ;// CONCATENATED MODULE: ./src/PureLoader.tsx
3190
3437
 
3191
3438
  var PureLoader = function PureLoader(props) {
@@ -3342,11 +3589,12 @@ function formatName(str, isAnswer, props) {
3342
3589
  var questionNameIcon = props.questionNameIcon,
3343
3590
  answerNameIcon = props.answerNameIcon,
3344
3591
  nameFormatter = props.nameFormatter;
3592
+ var res = str.replace(/\{icon\}/g, "".concat(isAnswer ? answerNameIcon : questionNameIcon));
3345
3593
  if (typeof nameFormatter === 'function') {
3346
- return nameFormatter(str.replace(/\{icon\}/g, "".concat(isAnswer ? answerNameIcon : questionNameIcon)));
3347
- } else {
3348
- return str.replace(/\{icon\}/g, "".concat(isAnswer ? answerNameIcon : questionNameIcon));
3594
+ var newVal = nameFormatter(res);
3595
+ return newVal;
3349
3596
  }
3597
+ return res;
3350
3598
  }
3351
3599
  function typewriterEffect(messagesDiv, element, str) {
3352
3600
  var speed = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 50;
@@ -3410,6 +3658,40 @@ function isStreamResponse(response) {
3410
3658
  return response.body instanceof ReadableStream;
3411
3659
  }
3412
3660
  ;
3661
+
3662
+ /**
3663
+ * HTML entities encode
3664
+ *
3665
+ * @param {String} str Input text
3666
+ * @return {String} Filtered text
3667
+ */
3668
+ function htmlEncode(str) {
3669
+ return str.replace(/[&<>'"]/g, function (tag) {
3670
+ return {
3671
+ '&': '&amp;',
3672
+ '<': '&lt;',
3673
+ '>': '&gt;',
3674
+ "'": '&#39;',
3675
+ '"': '&quot;'
3676
+ }[tag];
3677
+ });
3678
+ }
3679
+
3680
+ /**
3681
+ * HTML entities decode
3682
+ *
3683
+ * @param {String} str Input text
3684
+ * @return {String} Filtered text
3685
+ */
3686
+ function htmlDecode(str) {
3687
+ var res = '';
3688
+ var entities = [['amp', '&'], ['apos', '\''], ['#x27', '\''], ['#x2F', '/'], ['#39', '\''], ['#47', '/'], ['lt', '<'], ['gt', '>'], ['nbsp', ' '], ['quot', '"'], ['#60', '<'], ['#62', '>']];
3689
+ for (var i = 0, max = entities.length; i < max; i++) {
3690
+ str = str.replace(new RegExp('&' + entities[i][0] + ';', 'g'), entities[i][1]);
3691
+ }
3692
+ res = str;
3693
+ return res;
3694
+ }
3413
3695
  ;// CONCATENATED MODULE: ./src/useStreamController.tsx
3414
3696
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3415
3697
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
@@ -3828,6 +4110,7 @@ function src_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
3828
4110
 
3829
4111
 
3830
4112
 
4113
+
3831
4114
  // loader
3832
4115
 
3833
4116
 
@@ -3895,6 +4178,18 @@ var Chatbox = function Chatbox(props) {
3895
4178
  //================================================================
3896
4179
  // helper
3897
4180
  //================================================================
4181
+ var customMethodsRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({});
4182
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
4183
+ if (props.customMethods && Array.isArray(props.customMethods)) {
4184
+ var methodsMap = {};
4185
+ props.customMethods.forEach(function (method) {
4186
+ if (typeof method.func === 'function') {
4187
+ methodsMap[method.name] = method.func;
4188
+ }
4189
+ });
4190
+ customMethodsRef.current = methodsMap;
4191
+ }
4192
+ }, [props.customMethods]);
3898
4193
  var exposedMethods = function exposedMethods() {
3899
4194
  return {
3900
4195
  chatOpen: function chatOpen() {
@@ -3936,6 +4231,27 @@ var Chatbox = function Chatbox(props) {
3936
4231
  },
3937
4232
  setMessages: function setMessages(v) {
3938
4233
  setMsgList(v);
4234
+ },
4235
+ //
4236
+ getCustomMethods: function getCustomMethods() {
4237
+ return Object.keys(customMethodsRef.current);
4238
+ },
4239
+ executeCustomMethod: function executeCustomMethod(methodName) {
4240
+ if (methodName in customMethodsRef.current) {
4241
+ try {
4242
+ var _customMethodsRef$cur;
4243
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
4244
+ args[_key - 1] = arguments[_key];
4245
+ }
4246
+ return (_customMethodsRef$cur = customMethodsRef.current)[methodName].apply(_customMethodsRef$cur, args);
4247
+ } catch (error) {
4248
+ console.error("Error executing custom method ".concat(methodName, ":"), error);
4249
+ return null;
4250
+ }
4251
+ } else {
4252
+ console.warn("Custom method ".concat(methodName, " not found"));
4253
+ return null;
4254
+ }
3939
4255
  }
3940
4256
  };
3941
4257
  };
@@ -3977,6 +4293,7 @@ var Chatbox = function Chatbox(props) {
3977
4293
  requestBodyFormatter = currentProps.requestBodyFormatter,
3978
4294
  nameFormatter = currentProps.nameFormatter,
3979
4295
  onInputChange = currentProps.onInputChange,
4296
+ onInputCallback = currentProps.onInputCallback,
3980
4297
  onChunk = currentProps.onChunk,
3981
4298
  onComplete = currentProps.onComplete;
3982
4299
  var _configRef$current = configRef.current,
@@ -4040,6 +4357,7 @@ var Chatbox = function Chatbox(props) {
4040
4357
  requestBodyFormatter: requestBodyFormatter,
4041
4358
  nameFormatter: nameFormatter,
4042
4359
  onInputChange: onInputChange,
4360
+ onInputCallback: onInputCallback,
4043
4361
  onChunk: onChunk,
4044
4362
  onComplete: onComplete,
4045
4363
  //
@@ -4058,10 +4376,25 @@ var Chatbox = function Chatbox(props) {
4058
4376
  //================================================================
4059
4377
  // Custom buttons
4060
4378
  //================================================================
4379
+ var toolkitBtnsRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
4061
4380
  var _useState17 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({}),
4062
4381
  _useState18 = src_slicedToArray(_useState17, 2),
4063
4382
  activeButtons = _useState18[0],
4064
4383
  setActiveButtons = _useState18[1];
4384
+ var closeDropdowns = function closeDropdowns() {
4385
+ setActiveButtons(function (prev) {
4386
+ var _args$toolkitButtons;
4387
+ var newState = _objectSpread({}, prev);
4388
+ // Turn off only buttons with "isSelect"
4389
+ (_args$toolkitButtons = args().toolkitButtons) === null || _args$toolkitButtons === void 0 ? void 0 : _args$toolkitButtons.forEach(function (btn, index) {
4390
+ if (btn.isSelect) {
4391
+ var _id = "".concat(args().prefix || 'custom-', "chatbox-btn-tools-").concat(chatId).concat(index);
4392
+ newState[_id] = false;
4393
+ }
4394
+ });
4395
+ return newState;
4396
+ });
4397
+ };
4065
4398
  var executeButtonAction = function executeButtonAction(actionStr, buttonId, buttonElement) {
4066
4399
  try {
4067
4400
  // Create a new function to execute
@@ -4084,6 +4417,68 @@ var Chatbox = function Chatbox(props) {
4084
4417
  }
4085
4418
  };
4086
4419
 
4420
+ // options
4421
+ var _useState19 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({}),
4422
+ _useState20 = src_slicedToArray(_useState19, 2),
4423
+ selectedOpt = _useState20[0],
4424
+ setSelectedOpt = _useState20[1];
4425
+ var getButtonOptions = function getButtonOptions(btn) {
4426
+ var options = [];
4427
+ var index = 1;
4428
+ while (true) {
4429
+ var optionKey = "onSelect__".concat(index);
4430
+ if (!(optionKey in btn)) break;
4431
+ var _btn$optionKey$split$ = btn[optionKey].split('{#}').map(function (s) {
4432
+ return s.trim();
4433
+ }),
4434
+ _btn$optionKey$split$2 = src_slicedToArray(_btn$optionKey$split$, 3),
4435
+ label = _btn$optionKey$split$2[0],
4436
+ value = _btn$optionKey$split$2[1],
4437
+ onClick = _btn$optionKey$split$2[2];
4438
+ options.push({
4439
+ label: label,
4440
+ value: value,
4441
+ onClick: onClick
4442
+ });
4443
+ index++;
4444
+ }
4445
+ return options;
4446
+ };
4447
+ var handleExecuteButtonSelect = function handleExecuteButtonSelect(buttonId, option, index, value) {
4448
+ if (option.value === "cancel") {
4449
+ setSelectedOpt(function (prev) {
4450
+ var newLabels = _objectSpread({}, prev);
4451
+ delete newLabels[buttonId]; // Deletes the saved selected label, which displays the default label
4452
+ return _objectSpread(_objectSpread({}, newLabels), {}, {
4453
+ curIndex: index,
4454
+ curValue: value
4455
+ });
4456
+ });
4457
+ } else {
4458
+ setSelectedOpt(function (prev) {
4459
+ var _objectSpread3;
4460
+ return _objectSpread(_objectSpread({}, prev), {}, (_objectSpread3 = {}, _defineProperty(_objectSpread3, buttonId, option.label), _defineProperty(_objectSpread3, "curIndex", index), _defineProperty(_objectSpread3, "curValue", value), _objectSpread3));
4461
+ });
4462
+ }
4463
+ executeButtonAction(option.onClick, buttonId, document.getElementById(buttonId));
4464
+
4465
+ // Close the drop-down
4466
+ closeDropdowns();
4467
+ };
4468
+
4469
+ // click outside
4470
+ useClickOutside_default()({
4471
+ enabled: Object.values(activeButtons).some(function (isActive) {
4472
+ return isActive;
4473
+ }),
4474
+ isOutside: function isOutside(event) {
4475
+ return event.target.closest('.toolkit-select-wrapper') === null;
4476
+ },
4477
+ handle: function handle(event) {
4478
+ closeDropdowns();
4479
+ }
4480
+ }, [toolkitBtnsRef, activeButtons]);
4481
+
4087
4482
  //================================================================
4088
4483
  // Conversation History
4089
4484
  //================================================================
@@ -4437,13 +4832,23 @@ var Chatbox = function Chatbox(props) {
4437
4832
  return _context4.abrupt("return");
4438
4833
  case 2:
4439
4834
  messageInput = msInput.current;
4440
- message = messageInput.value;
4835
+ message = htmlEncode(messageInput.value); // It fires in real time as the user enters
4836
+ // Sanitizing input is the process of securing/cleaning/filtering input data.
4837
+ if (!(typeof args().onInputCallback === 'function')) {
4838
+ _context4.next = 8;
4839
+ break;
4840
+ }
4841
+ _context4.next = 7;
4842
+ return args().onInputCallback(message);
4843
+ case 7:
4844
+ message = _context4.sent;
4845
+ case 8:
4441
4846
  if (!(message.trim() === '')) {
4442
- _context4.next = 6;
4847
+ _context4.next = 10;
4443
4848
  break;
4444
4849
  }
4445
4850
  return _context4.abrupt("return");
4446
- case 6:
4851
+ case 10:
4447
4852
  // Start the timer
4448
4853
  setElapsedTime(0); // Reset elapsed time
4449
4854
  timer.current = setInterval(function () {
@@ -4455,14 +4860,14 @@ var Chatbox = function Chatbox(props) {
4455
4860
  // user message
4456
4861
  inputMsg = "".concat(message); // If a render parser exists, it is used to process the string
4457
4862
  if (!(typeof args().renderParser === 'function')) {
4458
- _context4.next = 13;
4863
+ _context4.next = 17;
4459
4864
  break;
4460
4865
  }
4461
- _context4.next = 12;
4866
+ _context4.next = 16;
4462
4867
  return args().renderParser(inputMsg);
4463
- case 12:
4868
+ case 16:
4464
4869
  inputMsg = _context4.sent;
4465
- case 13:
4870
+ case 17:
4466
4871
  displayMessage(args().questionNameRes, inputMsg); // Display user message
4467
4872
 
4468
4873
  // loading
@@ -4473,26 +4878,26 @@ var Chatbox = function Chatbox(props) {
4473
4878
 
4474
4879
  // clear
4475
4880
  if (inputContentRef.current) inputContentRef.current.clear();
4476
- _context4.prev = 17;
4477
- _context4.next = 20;
4881
+ _context4.prev = 21;
4882
+ _context4.next = 24;
4478
4883
  return mainRequest(message);
4479
- case 20:
4884
+ case 24:
4480
4885
  res = _context4.sent;
4481
4886
  if (res.useStreamRender) {
4482
- _context4.next = 32;
4887
+ _context4.next = 36;
4483
4888
  break;
4484
4889
  }
4485
4890
  reply = res.reply;
4486
4891
  replyRes = "".concat(reply); // If a render parser exists, it is used to process the string
4487
4892
  if (!(typeof args().renderParser === 'function')) {
4488
- _context4.next = 28;
4893
+ _context4.next = 32;
4489
4894
  break;
4490
4895
  }
4491
- _context4.next = 27;
4896
+ _context4.next = 31;
4492
4897
  return args().renderParser(replyRes);
4493
- case 27:
4898
+ case 31:
4494
4899
  replyRes = _context4.sent;
4495
- case 28:
4900
+ case 32:
4496
4901
  displayMessage(args().answerNameRes, replyRes); // Display AI reply
4497
4902
 
4498
4903
  //
@@ -4501,12 +4906,12 @@ var Chatbox = function Chatbox(props) {
4501
4906
 
4502
4907
  //reset SSE
4503
4908
  closeSSE();
4504
- case 32:
4505
- _context4.next = 41;
4909
+ case 36:
4910
+ _context4.next = 45;
4506
4911
  break;
4507
- case 34:
4508
- _context4.prev = 34;
4509
- _context4.t0 = _context4["catch"](17);
4912
+ case 38:
4913
+ _context4.prev = 38;
4914
+ _context4.t0 = _context4["catch"](21);
4510
4915
  // loading
4511
4916
  setLoading(false);
4512
4917
 
@@ -4515,7 +4920,7 @@ var Chatbox = function Chatbox(props) {
4515
4920
  timer.current = null;
4516
4921
  console.error('--> Error sending message:', _context4.t0);
4517
4922
  displayMessage(args().answerNameRes, "Error: Unable to send message: ".concat(String(_context4.t0))); // Display AI reply
4518
- case 41:
4923
+ case 45:
4519
4924
  // clear
4520
4925
  messageInput.value = '';
4521
4926
 
@@ -4524,11 +4929,11 @@ var Chatbox = function Chatbox(props) {
4524
4929
 
4525
4930
  // Scroll to the bottom
4526
4931
  scrollToBottom();
4527
- case 44:
4932
+ case 48:
4528
4933
  case "end":
4529
4934
  return _context4.stop();
4530
4935
  }
4531
- }, _callee4, null, [[17, 34]]);
4936
+ }, _callee4, null, [[21, 38]]);
4532
4937
  }));
4533
4938
  return function sendMessage() {
4534
4939
  return _ref2.apply(this, arguments);
@@ -5008,10 +5413,65 @@ var Chatbox = function Chatbox(props) {
5008
5413
  customClassName: "w-100",
5009
5414
  txt: ""
5010
5415
  }))) : null, args().toolkitButtons && args().toolkitButtons.length > 0 && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
5011
- className: "toolkit-btns"
5416
+ className: "toolkit-btns",
5417
+ ref: toolkitBtnsRef
5012
5418
  }, args().toolkitButtons.map(function (btn, index) {
5013
5419
  var _id = "".concat(args().prefix || 'custom-', "chatbox-btn-tools-").concat(chatId).concat(index);
5014
5420
  var isActive = activeButtons[_id];
5421
+ if (btn.isSelect) {
5422
+ var options = getButtonOptions(btn);
5423
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
5424
+ key: index,
5425
+ className: "toolkit-select-wrapper"
5426
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
5427
+ id: _id,
5428
+ className: "toolkit-select-btn ".concat(btn.value || '', " ").concat(isActive ? 'active' : '', " ").concat(selectedOpt.curValue !== 'cancel' && typeof selectedOpt.curValue !== 'undefined' && selectedOpt.curValue !== '' ? 'opt-active' : ''),
5429
+ onClick: function onClick(e) {
5430
+ e.preventDefault();
5431
+ setActiveButtons(function (prev) {
5432
+ return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, _id, !prev[_id]));
5433
+ });
5434
+ }
5435
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
5436
+ dangerouslySetInnerHTML: {
5437
+ __html: selectedOpt[_id] || btn.label
5438
+ }
5439
+ }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
5440
+ className: "toolkit-select-arrow"
5441
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
5442
+ width: "5px",
5443
+ height: "5px",
5444
+ viewBox: "0 -4.5 20 20"
5445
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", {
5446
+ stroke: "none",
5447
+ strokeWidth: "1",
5448
+ fill: "none"
5449
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", {
5450
+ transform: "translate(-180.000000, -6684.000000)",
5451
+ className: "arrow-fill-g",
5452
+ fill: "currentColor"
5453
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", {
5454
+ transform: "translate(56.000000, 160.000000)"
5455
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
5456
+ d: "M144,6525.39 L142.594,6524 L133.987,6532.261 L133.069,6531.38 L133.074,6531.385 L125.427,6524.045 L124,6525.414 C126.113,6527.443 132.014,6533.107 133.987,6535 C135.453,6533.594 134.024,6534.965 144,6525.39"
5457
+ }))))))), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
5458
+ className: "toolkit-select-options ".concat(isActive ? 'active' : '')
5459
+ }, options.map(function (option, optIndex) {
5460
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
5461
+ key: optIndex,
5462
+ className: "toolkit-select-option ".concat(option.value || '', " ").concat(selectedOpt.curIndex === optIndex ? 'selected' : ''),
5463
+ onClick: function onClick() {
5464
+ return handleExecuteButtonSelect(_id, option, optIndex, option.value);
5465
+ }
5466
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
5467
+ dangerouslySetInnerHTML: {
5468
+ __html: option.label
5469
+ }
5470
+ }));
5471
+ })));
5472
+ }
5473
+
5474
+ // The rendering of the normal button
5015
5475
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
5016
5476
  key: index,
5017
5477
  id: _id,