funda-ui 4.5.777 → 4.5.899

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/Chatbox/index.js CHANGED
@@ -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) {
@@ -3212,10 +3459,10 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
3212
3459
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
3213
3460
 
3214
3461
  var TypingEffect = function TypingEffect(_ref) {
3215
- var messagesDiv = _ref.messagesDiv,
3216
- content = _ref.content,
3462
+ var content = _ref.content,
3217
3463
  speed = _ref.speed,
3218
- onComplete = _ref.onComplete;
3464
+ onComplete = _ref.onComplete,
3465
+ onUpdate = _ref.onUpdate;
3219
3466
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
3220
3467
  _useState2 = _slicedToArray(_useState, 2),
3221
3468
  displayedContent = _useState2[0],
@@ -3224,25 +3471,82 @@ var TypingEffect = function TypingEffect(_ref) {
3224
3471
  _useState4 = _slicedToArray(_useState3, 2),
3225
3472
  index = _useState4[0],
3226
3473
  setIndex = _useState4[1];
3474
+ var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
3475
+ _useState6 = _slicedToArray(_useState5, 2),
3476
+ imagePlaceholders = _useState6[0],
3477
+ setImagePlaceholders = _useState6[1];
3478
+ var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
3479
+ _useState8 = _slicedToArray(_useState7, 2),
3480
+ processedContent = _useState8[0],
3481
+ setProcessedContent = _useState8[1];
3482
+
3483
+ // Extract and replace image tags
3484
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
3485
+ var extractImages = function extractImages(html) {
3486
+ var placeholders = [];
3487
+ var processedHtml = html;
3488
+
3489
+ // <img>
3490
+ processedHtml = processedHtml.replace(/<img[^>]*>/g, function (match) {
3491
+ var placeholder = "[IMG_".concat(placeholders.length, "]");
3492
+ placeholders.push({
3493
+ original: match,
3494
+ placeholder: placeholder,
3495
+ type: 'img'
3496
+ });
3497
+ return placeholder;
3498
+ });
3499
+
3500
+ // <svg>
3501
+ processedHtml = processedHtml.replace(/<svg[^>]*>[\s\S]*?<\/svg>/g, function (match) {
3502
+ var placeholder = "[SVG_".concat(placeholders.length, "]");
3503
+ placeholders.push({
3504
+ original: match,
3505
+ placeholder: placeholder,
3506
+ type: 'svg'
3507
+ });
3508
+ return placeholder;
3509
+ });
3510
+ return {
3511
+ processedHtml: processedHtml,
3512
+ placeholders: placeholders
3513
+ };
3514
+ };
3515
+ var _extractImages = extractImages(content),
3516
+ processedHtml = _extractImages.processedHtml,
3517
+ placeholders = _extractImages.placeholders;
3518
+ setProcessedContent(processedHtml);
3519
+ setImagePlaceholders(placeholders);
3520
+ }, [content]);
3521
+
3522
+ // Handle typing effects
3227
3523
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
3228
3524
  var timer = setInterval(function () {
3229
- if (index < content.length) {
3230
- setDisplayedContent(function (prev) {
3231
- return prev + content[index];
3525
+ if (index < processedContent.length) {
3526
+ var newContent = processedContent.substring(0, index + 1);
3527
+
3528
+ // Replace the completed placeholder
3529
+ imagePlaceholders.forEach(function (_ref2) {
3530
+ var original = _ref2.original,
3531
+ placeholder = _ref2.placeholder;
3532
+ if (newContent.includes(placeholder)) {
3533
+ newContent = newContent.replace(placeholder, original);
3534
+ }
3232
3535
  });
3536
+ setDisplayedContent(newContent);
3233
3537
  setIndex(function (prev) {
3234
3538
  return prev + 1;
3235
3539
  });
3236
- if (messagesDiv !== null) messagesDiv.scrollTop = messagesDiv.scrollHeight; // Scroll to the bottom
3540
+ onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate();
3237
3541
  } else {
3238
3542
  clearInterval(timer);
3239
- onComplete === null || onComplete === void 0 ? void 0 : onComplete(); // Call the onComplete callback if provided
3543
+ onComplete === null || onComplete === void 0 ? void 0 : onComplete();
3240
3544
  }
3241
3545
  }, speed);
3242
3546
  return function () {
3243
3547
  return clearInterval(timer);
3244
- }; // Cleanup on unmount
3245
- }, [content, index, speed, onComplete]);
3548
+ };
3549
+ }, [processedContent, index, speed, onComplete, onUpdate, imagePlaceholders]);
3246
3550
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
3247
3551
  dangerouslySetInnerHTML: {
3248
3552
  __html: displayedContent
@@ -3285,11 +3589,12 @@ function formatName(str, isAnswer, props) {
3285
3589
  var questionNameIcon = props.questionNameIcon,
3286
3590
  answerNameIcon = props.answerNameIcon,
3287
3591
  nameFormatter = props.nameFormatter;
3592
+ var res = str.replace(/\{icon\}/g, "".concat(isAnswer ? answerNameIcon : questionNameIcon));
3288
3593
  if (typeof nameFormatter === 'function') {
3289
- return nameFormatter(str.replace(/\{icon\}/g, "".concat(isAnswer ? answerNameIcon : questionNameIcon)));
3290
- } else {
3291
- return str.replace(/\{icon\}/g, "".concat(isAnswer ? answerNameIcon : questionNameIcon));
3594
+ var newVal = nameFormatter(res);
3595
+ return newVal;
3292
3596
  }
3597
+ return res;
3293
3598
  }
3294
3599
  function typewriterEffect(messagesDiv, element, str) {
3295
3600
  var speed = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 50;
@@ -3336,6 +3641,57 @@ function fixHtmlTags(html, withReasoning, reasoningSwitchLabel) {
3336
3641
  // Replace with a valid label
3337
3642
  return html.replace('<think>', "<details class=\"think\" ".concat(withReasoning ? 'open' : '', "><summary>").concat(reasoningSwitchLabel, "</summary><div class=\"think-content\">")).replace('</think>', '</div></details> ');
3338
3643
  }
3644
+ function isStreamResponse(response) {
3645
+ // Method 1: Check Content-Type
3646
+ var contentType = response.headers.get('Content-Type');
3647
+ if (contentType) {
3648
+ return contentType.includes('text/event-stream') || contentType.includes('application/x-ndjson') || contentType.includes('application/stream+json');
3649
+ }
3650
+
3651
+ // Method 2: Check Transfer-Encoding
3652
+ var transferEncoding = response.headers.get('Transfer-Encoding');
3653
+ if (transferEncoding) {
3654
+ return transferEncoding.includes('chunked');
3655
+ }
3656
+
3657
+ // Method 3: Check if response.body is ReadableStream
3658
+ return response.body instanceof ReadableStream;
3659
+ }
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
+ }
3339
3695
  ;// CONCATENATED MODULE: ./src/useStreamController.tsx
3340
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); }
3341
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; }
@@ -3754,6 +4110,7 @@ function src_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
3754
4110
 
3755
4111
 
3756
4112
 
4113
+
3757
4114
  // loader
3758
4115
 
3759
4116
 
@@ -3809,6 +4166,11 @@ var Chatbox = function Chatbox(props) {
3809
4166
  _useState14 = src_slicedToArray(_useState13, 2),
3810
4167
  tempAnimText = _useState14[0],
3811
4168
  setTempAnimText = _useState14[1];
4169
+ var _useState15 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(true),
4170
+ _useState16 = src_slicedToArray(_useState15, 2),
4171
+ enableStreamMode = _useState16[0],
4172
+ setEnableStreamMode = _useState16[1];
4173
+ var animatedMessagesRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(new Set()); // Add a ref to keep track of messages that have already been animated
3812
4174
 
3813
4175
  //
3814
4176
  var timer = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
@@ -3816,6 +4178,18 @@ var Chatbox = function Chatbox(props) {
3816
4178
  //================================================================
3817
4179
  // helper
3818
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]);
3819
4193
  var exposedMethods = function exposedMethods() {
3820
4194
  return {
3821
4195
  chatOpen: function chatOpen() {
@@ -3851,6 +4225,33 @@ var Chatbox = function Chatbox(props) {
3851
4225
  },
3852
4226
  setContextData: function setContextData(v) {
3853
4227
  contextDataRef.current = v;
4228
+ },
4229
+ getMessages: function getMessages() {
4230
+ return msgList;
4231
+ },
4232
+ setMessages: function setMessages(v) {
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
+ }
3854
4255
  }
3855
4256
  };
3856
4257
  };
@@ -3887,10 +4288,12 @@ var Chatbox = function Chatbox(props) {
3887
4288
  toolkitButtons = currentProps.toolkitButtons,
3888
4289
  newChatButton = currentProps.newChatButton,
3889
4290
  maxHistoryLength = currentProps.maxHistoryLength,
4291
+ customRequest = currentProps.customRequest,
3890
4292
  renderParser = currentProps.renderParser,
3891
4293
  requestBodyFormatter = currentProps.requestBodyFormatter,
3892
4294
  nameFormatter = currentProps.nameFormatter,
3893
4295
  onInputChange = currentProps.onInputChange,
4296
+ onInputCallback = currentProps.onInputCallback,
3894
4297
  onChunk = currentProps.onChunk,
3895
4298
  onComplete = currentProps.onComplete;
3896
4299
  var _configRef$current = configRef.current,
@@ -3949,10 +4352,12 @@ var Chatbox = function Chatbox(props) {
3949
4352
  maxHistoryLength: maxHistoryLength,
3950
4353
  toolkitButtons: toolkitButtons,
3951
4354
  newChatButton: newChatButton,
4355
+ customRequest: customRequest,
3952
4356
  renderParser: renderParser,
3953
4357
  requestBodyFormatter: requestBodyFormatter,
3954
4358
  nameFormatter: nameFormatter,
3955
4359
  onInputChange: onInputChange,
4360
+ onInputCallback: onInputCallback,
3956
4361
  onChunk: onChunk,
3957
4362
  onComplete: onComplete,
3958
4363
  //
@@ -3971,10 +4376,25 @@ var Chatbox = function Chatbox(props) {
3971
4376
  //================================================================
3972
4377
  // Custom buttons
3973
4378
  //================================================================
3974
- var _useState15 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({}),
3975
- _useState16 = src_slicedToArray(_useState15, 2),
3976
- activeButtons = _useState16[0],
3977
- setActiveButtons = _useState16[1];
4379
+ var toolkitBtnsRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
4380
+ var _useState17 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({}),
4381
+ _useState18 = src_slicedToArray(_useState17, 2),
4382
+ activeButtons = _useState18[0],
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
+ };
3978
4398
  var executeButtonAction = function executeButtonAction(actionStr, buttonId, buttonElement) {
3979
4399
  try {
3980
4400
  // Create a new function to execute
@@ -3997,6 +4417,68 @@ var Chatbox = function Chatbox(props) {
3997
4417
  }
3998
4418
  };
3999
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
+
4000
4482
  //================================================================
4001
4483
  // Conversation History
4002
4484
  //================================================================
@@ -4350,13 +4832,23 @@ var Chatbox = function Chatbox(props) {
4350
4832
  return _context4.abrupt("return");
4351
4833
  case 2:
4352
4834
  messageInput = msInput.current;
4353
- 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:
4354
4846
  if (!(message.trim() === '')) {
4355
- _context4.next = 6;
4847
+ _context4.next = 10;
4356
4848
  break;
4357
4849
  }
4358
4850
  return _context4.abrupt("return");
4359
- case 6:
4851
+ case 10:
4360
4852
  // Start the timer
4361
4853
  setElapsedTime(0); // Reset elapsed time
4362
4854
  timer.current = setInterval(function () {
@@ -4368,14 +4860,14 @@ var Chatbox = function Chatbox(props) {
4368
4860
  // user message
4369
4861
  inputMsg = "".concat(message); // If a render parser exists, it is used to process the string
4370
4862
  if (!(typeof args().renderParser === 'function')) {
4371
- _context4.next = 13;
4863
+ _context4.next = 17;
4372
4864
  break;
4373
4865
  }
4374
- _context4.next = 12;
4866
+ _context4.next = 16;
4375
4867
  return args().renderParser(inputMsg);
4376
- case 12:
4868
+ case 16:
4377
4869
  inputMsg = _context4.sent;
4378
- case 13:
4870
+ case 17:
4379
4871
  displayMessage(args().questionNameRes, inputMsg); // Display user message
4380
4872
 
4381
4873
  // loading
@@ -4386,26 +4878,26 @@ var Chatbox = function Chatbox(props) {
4386
4878
 
4387
4879
  // clear
4388
4880
  if (inputContentRef.current) inputContentRef.current.clear();
4389
- _context4.prev = 17;
4390
- _context4.next = 20;
4881
+ _context4.prev = 21;
4882
+ _context4.next = 24;
4391
4883
  return mainRequest(message);
4392
- case 20:
4884
+ case 24:
4393
4885
  res = _context4.sent;
4394
- if (args().isStream) {
4395
- _context4.next = 32;
4886
+ if (res.useStreamRender) {
4887
+ _context4.next = 36;
4396
4888
  break;
4397
4889
  }
4398
4890
  reply = res.reply;
4399
4891
  replyRes = "".concat(reply); // If a render parser exists, it is used to process the string
4400
4892
  if (!(typeof args().renderParser === 'function')) {
4401
- _context4.next = 28;
4893
+ _context4.next = 32;
4402
4894
  break;
4403
4895
  }
4404
- _context4.next = 27;
4896
+ _context4.next = 31;
4405
4897
  return args().renderParser(replyRes);
4406
- case 27:
4898
+ case 31:
4407
4899
  replyRes = _context4.sent;
4408
- case 28:
4900
+ case 32:
4409
4901
  displayMessage(args().answerNameRes, replyRes); // Display AI reply
4410
4902
 
4411
4903
  //
@@ -4414,12 +4906,12 @@ var Chatbox = function Chatbox(props) {
4414
4906
 
4415
4907
  //reset SSE
4416
4908
  closeSSE();
4417
- case 32:
4418
- _context4.next = 41;
4909
+ case 36:
4910
+ _context4.next = 45;
4419
4911
  break;
4420
- case 34:
4421
- _context4.prev = 34;
4422
- _context4.t0 = _context4["catch"](17);
4912
+ case 38:
4913
+ _context4.prev = 38;
4914
+ _context4.t0 = _context4["catch"](21);
4423
4915
  // loading
4424
4916
  setLoading(false);
4425
4917
 
@@ -4428,7 +4920,7 @@ var Chatbox = function Chatbox(props) {
4428
4920
  timer.current = null;
4429
4921
  console.error('--> Error sending message:', _context4.t0);
4430
4922
  displayMessage(args().answerNameRes, "Error: Unable to send message: ".concat(String(_context4.t0))); // Display AI reply
4431
- case 41:
4923
+ case 45:
4432
4924
  // clear
4433
4925
  messageInput.value = '';
4434
4926
 
@@ -4437,11 +4929,11 @@ var Chatbox = function Chatbox(props) {
4437
4929
 
4438
4930
  // Scroll to the bottom
4439
4931
  scrollToBottom();
4440
- case 44:
4932
+ case 48:
4441
4933
  case "end":
4442
4934
  return _context4.stop();
4443
4935
  }
4444
- }, _callee4, null, [[17, 34]]);
4936
+ }, _callee4, null, [[21, 38]]);
4445
4937
  }));
4446
4938
  return function sendMessage() {
4447
4939
  return _ref2.apply(this, arguments);
@@ -4457,37 +4949,95 @@ var Chatbox = function Chatbox(props) {
4457
4949
  };
4458
4950
  var mainRequest = /*#__PURE__*/function () {
4459
4951
  var _ref3 = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee5(msg) {
4460
- var requestBodyRes, response, _errInfo, _args$responseExtract2, extractPath, _response, _errInfo2, jsonResponse, result, _iterator3, _step3, path, content, _err;
4952
+ var currentStreamMode, requestBodyRes, customResponse, content, isStream, contentRes, response, _errInfo, _args$responseExtract2, extractPath, _response, _errInfo2, jsonResponse, result, _iterator3, _step3, path, _content2, _err;
4461
4953
  return src_regeneratorRuntime().wrap(function _callee5$(_context5) {
4462
4954
  while (1) switch (_context5.prev = _context5.next) {
4463
4955
  case 0:
4464
- _context5.prev = 0;
4956
+ currentStreamMode = args().isStream; // Update stream mode
4957
+ setEnableStreamMode(currentStreamMode);
4958
+ _context5.prev = 2;
4465
4959
  // Parse and interpolate request body template
4466
4960
  requestBodyRes = JSON.parse((args().requestBodyTmpl || '{}').replace(/\{model\}/g, args().model).replace(/\{message\}/g, msg).replace(/\{token\}/g, chatId)); //
4467
4961
  // If a formatter function exists, it is used to process the request body
4468
- if (typeof args().requestBodyFormatter === 'function') {
4469
- requestBodyRes = args().requestBodyFormatter(requestBodyRes, args().latestContextData, conversationHistory.current);
4962
+ if (!(typeof args().requestBodyFormatter === 'function')) {
4963
+ _context5.next = 8;
4964
+ break;
4470
4965
  }
4471
-
4966
+ _context5.next = 7;
4967
+ return args().requestBodyFormatter(requestBodyRes, args().latestContextData, conversationHistory.current);
4968
+ case 7:
4969
+ requestBodyRes = _context5.sent;
4970
+ case 8:
4472
4971
  // Scroll to the bottom
4473
4972
  setTimeout(function () {
4474
4973
  // Scroll to the bottom
4475
4974
  scrollToBottom();
4476
4975
  }, 500);
4477
- if (!args().isStream) {
4478
- _context5.next = 18;
4976
+ if (!(typeof args().customRequest === 'function')) {
4977
+ _context5.next = 25;
4479
4978
  break;
4480
4979
  }
4481
- _context5.next = 7;
4980
+ // Update stream mode
4981
+ setEnableStreamMode(false);
4982
+ _context5.next = 13;
4983
+ return args().customRequest(msg, {
4984
+ requestBody: requestBodyRes,
4985
+ apiUrl: args().requestApiUrl || '',
4986
+ headers: args().headerConfigRes
4987
+ });
4988
+ case 13:
4989
+ customResponse = _context5.sent;
4990
+ content = customResponse.content, isStream = customResponse.isStream;
4991
+ contentRes = content; // Update stream mode
4992
+ setEnableStreamMode(isStream);
4993
+
4994
+ // NORMAL
4995
+ //++++++++++++++++++++++++++++++++++++++++++++++++
4996
+ if (!(!isStream && typeof contentRes === 'string' && contentRes.trim() !== '')) {
4997
+ _context5.next = 20;
4998
+ break;
4999
+ }
5000
+ // Replace with a valid label
5001
+ contentRes = fixHtmlTags(contentRes, args().withReasoning, args().reasoningSwitchLabel);
5002
+ return _context5.abrupt("return", {
5003
+ reply: formatLatestDisplayContent(contentRes),
5004
+ useStreamRender: false
5005
+ });
5006
+ case 20:
5007
+ if (!(isStream && isStreamResponse(contentRes))) {
5008
+ _context5.next = 24;
5009
+ break;
5010
+ }
5011
+ _context5.next = 23;
5012
+ return streamController.start(contentRes);
5013
+ case 23:
5014
+ return _context5.abrupt("return", {
5015
+ reply: tempAnimText,
5016
+ // The final content will be in tempAnimText
5017
+ useStreamRender: true
5018
+ });
5019
+ case 24:
5020
+ // DEFAULT
5021
+ //++++++++++++++++++++++++++++++++++++++++++++++++
5022
+ if (contentRes === null) {
5023
+ // Update stream mode
5024
+ setEnableStreamMode(currentStreamMode);
5025
+ }
5026
+ case 25:
5027
+ if (!currentStreamMode) {
5028
+ _context5.next = 39;
5029
+ break;
5030
+ }
5031
+ _context5.next = 28;
4482
5032
  return fetch(args().requestApiUrl || '', {
4483
5033
  method: "POST",
4484
5034
  body: JSON.stringify(requestBodyRes),
4485
5035
  headers: args().headerConfigRes
4486
5036
  });
4487
- case 7:
5037
+ case 28:
4488
5038
  response = _context5.sent;
4489
5039
  if (response.ok) {
4490
- _context5.next = 13;
5040
+ _context5.next = 34;
4491
5041
  break;
4492
5042
  }
4493
5043
  _errInfo = "[ERROR] HTTP Error ".concat(response.status, ": ").concat(response.statusText);
@@ -4496,40 +5046,44 @@ var Chatbox = function Chatbox(props) {
4496
5046
  // hide loader
4497
5047
  setLoaderDisplay(false);
4498
5048
  return _context5.abrupt("return", {
4499
- reply: _errInfo
5049
+ reply: _errInfo,
5050
+ useStreamRender: false
4500
5051
  });
4501
- case 13:
4502
- _context5.next = 15;
5052
+ case 34:
5053
+ _context5.next = 36;
4503
5054
  return streamController.start(response);
4504
- case 15:
5055
+ case 36:
4505
5056
  return _context5.abrupt("return", {
4506
- reply: tempAnimText // The final content will be in tempAnimText
5057
+ reply: tempAnimText,
5058
+ // The final content will be in tempAnimText
5059
+ useStreamRender: true
4507
5060
  });
4508
- case 18:
5061
+ case 39:
4509
5062
  // Extract response using the path
4510
5063
  extractPath = (_args$responseExtract2 = args().responseExtractPath) === null || _args$responseExtract2 === void 0 ? void 0 : _args$responseExtract2.slice(1);
4511
- _context5.next = 21;
5064
+ _context5.next = 42;
4512
5065
  return fetch(args().requestApiUrl || '', {
4513
5066
  method: "POST",
4514
5067
  headers: args().headerConfigRes,
4515
5068
  body: JSON.stringify(requestBodyRes),
4516
5069
  signal: abortController.current.signal
4517
5070
  });
4518
- case 21:
5071
+ case 42:
4519
5072
  _response = _context5.sent;
4520
5073
  if (_response.ok) {
4521
- _context5.next = 26;
5074
+ _context5.next = 47;
4522
5075
  break;
4523
5076
  }
4524
5077
  _errInfo2 = "[ERROR] HTTP Error ".concat(_response.status, ": ").concat(_response.statusText); // hide loader
4525
5078
  setLoaderDisplay(false);
4526
5079
  return _context5.abrupt("return", {
4527
- reply: _errInfo2
5080
+ reply: _errInfo2,
5081
+ useStreamRender: false
4528
5082
  });
4529
- case 26:
4530
- _context5.next = 28;
5083
+ case 47:
5084
+ _context5.next = 49;
4531
5085
  return _response.json();
4532
- case 28:
5086
+ case 49:
4533
5087
  jsonResponse = _context5.sent;
4534
5088
  // hide loader
4535
5089
  setLoaderDisplay(false);
@@ -4547,30 +5101,32 @@ var Chatbox = function Chatbox(props) {
4547
5101
  _iterator3.f();
4548
5102
  }
4549
5103
  }
4550
- content = result; // Replace with a valid label
4551
- content = fixHtmlTags(content, args().withReasoning, args().reasoningSwitchLabel);
5104
+ _content2 = result; // Replace with a valid label
5105
+ _content2 = fixHtmlTags(_content2, args().withReasoning, args().reasoningSwitchLabel);
4552
5106
  return _context5.abrupt("return", {
4553
- reply: formatLatestDisplayContent(content)
5107
+ reply: formatLatestDisplayContent(_content2),
5108
+ useStreamRender: false
4554
5109
  });
4555
- case 35:
4556
- _context5.next = 43;
5110
+ case 56:
5111
+ _context5.next = 64;
4557
5112
  break;
4558
- case 37:
4559
- _context5.prev = 37;
4560
- _context5.t0 = _context5["catch"](0);
5113
+ case 58:
5114
+ _context5.prev = 58;
5115
+ _context5.t0 = _context5["catch"](2);
4561
5116
  _err = "--> Error in mainRequest: ".concat(_context5.t0);
4562
5117
  console.error(_err);
4563
5118
 
4564
5119
  //reset SSE
4565
5120
  closeSSE();
4566
5121
  return _context5.abrupt("return", {
4567
- reply: _err
5122
+ reply: _err,
5123
+ useStreamRender: false
4568
5124
  });
4569
- case 43:
5125
+ case 64:
4570
5126
  case "end":
4571
5127
  return _context5.stop();
4572
5128
  }
4573
- }, _callee5, null, [[0, 37]]);
5129
+ }, _callee5, null, [[2, 58]]);
4574
5130
  }));
4575
5131
  return function mainRequest(_x8) {
4576
5132
  return _ref3.apply(this, arguments);
@@ -4580,7 +5136,7 @@ var Chatbox = function Chatbox(props) {
4580
5136
  // exposes the following methods
4581
5137
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(propsRef.current.contentRef, function () {
4582
5138
  return exposedMethods();
4583
- }, [propsRef.current.contentRef, inputContentRef, msInput]);
5139
+ }, [propsRef.current.contentRef, inputContentRef, msInput, msgList]);
4584
5140
 
4585
5141
  // Update ref when props change
4586
5142
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
@@ -4600,6 +5156,12 @@ var Chatbox = function Chatbox(props) {
4600
5156
  setMsgList(props.defaultMessages);
4601
5157
  }
4602
5158
  }, [props.defaultMessages]);
5159
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
5160
+ if (Array.isArray(props.defaultMessages) && props.defaultMessages.length > 0) {
5161
+ // Update the default messages
5162
+ setMsgList(props.defaultMessages);
5163
+ }
5164
+ }, [props.defaultMessages]);
4603
5165
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((dist_cjs_default()), {
4604
5166
  show: true,
4605
5167
  containerClassName: "Chatbox"
@@ -4672,6 +5234,10 @@ var Chatbox = function Chatbox(props) {
4672
5234
  }, msgList.map(function (msg, index) {
4673
5235
  var _msg$tag;
4674
5236
  var isAnimProgress = tempAnimText !== '' && msg.sender !== args().questionNameRes && index === msgList.length - 1 && loading;
5237
+ var hasAnimated = animatedMessagesRef.current.has(index);
5238
+
5239
+ // Mark the message as animated;
5240
+ animatedMessagesRef.current.add(index);
4675
5241
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
4676
5242
  key: index,
4677
5243
  className: ((_msg$tag = msg.tag) === null || _msg$tag === void 0 ? void 0 : _msg$tag.indexOf('[reply]')) < 0 ? 'request' : 'reply',
@@ -4688,19 +5254,25 @@ var Chatbox = function Chatbox(props) {
4688
5254
  dangerouslySetInnerHTML: {
4689
5255
  __html: "".concat(msg.content, " <span class=\"qa-timestamp\">").concat(msg.timestamp, "</span>")
4690
5256
  }
4691
- })) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, args().isStream ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
5257
+ })) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, enableStreamMode ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
4692
5258
  className: "qa-content",
4693
5259
  dangerouslySetInnerHTML: {
4694
5260
  __html: "".concat(msg.content, " <span class=\"qa-timestamp\">").concat(msg.timestamp, "</span>")
4695
5261
  }
4696
5262
  })) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
4697
5263
  className: "qa-content"
4698
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(src_TypingEffect, {
4699
- messagesDiv: msgContainerRef.current,
5264
+ }, hasAnimated ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
5265
+ dangerouslySetInnerHTML: {
5266
+ __html: "".concat(msg.content, " <span class=\"qa-timestamp\">").concat(msg.timestamp, "</span>")
5267
+ }
5268
+ }) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(src_TypingEffect, {
5269
+ onUpdate: function onUpdate() {
5270
+ scrollToBottom();
5271
+ },
4700
5272
  content: "".concat(msg.content, " <span class=\"qa-timestamp\">").concat(msg.timestamp, "</span>"),
4701
5273
  speed: 10
4702
5274
  })))));
4703
- }), args().isStream ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, args().verbose ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, tempAnimText !== '' && loading ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
5275
+ }), enableStreamMode ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, args().verbose ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, tempAnimText !== '' && loading ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
4704
5276
  className: "reply reply-waiting"
4705
5277
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
4706
5278
  className: "qa-name"
@@ -4742,7 +5314,7 @@ var Chatbox = function Chatbox(props) {
4742
5314
  dangerouslySetInnerHTML: {
4743
5315
  __html: "".concat(tempAnimText)
4744
5316
  }
4745
- }))) : null)) : null)) : null, !args().isStream ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, loading ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
5317
+ }))) : null)) : null)) : null, !enableStreamMode ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, loading ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
4746
5318
  className: "reply reply-waiting"
4747
5319
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
4748
5320
  className: "qa-name"
@@ -4766,6 +5338,7 @@ var Chatbox = function Chatbox(props) {
4766
5338
  }))) : null)) : null) : null, args().newChatButton && msgList.length > 0 && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
4767
5339
  className: "newchat-btn"
4768
5340
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
5341
+ id: "".concat(args().prefix || 'custom-', "chatbox-btn-new-").concat(chatId),
4769
5342
  onClick: function onClick(e) {
4770
5343
  return executeButtonAction(args().newChatButton.onClick, "".concat(args().prefix || 'custom-', "chatbox-btn-new-").concat(chatId), e.currentTarget);
4771
5344
  }
@@ -4799,7 +5372,7 @@ var Chatbox = function Chatbox(props) {
4799
5372
  onClick: function onClick(e) {
4800
5373
  e.preventDefault();
4801
5374
  e.stopPropagation();
4802
- if (!args().isStream) {
5375
+ if (!enableStreamMode) {
4803
5376
  // normal request
4804
5377
  abortNormalRequest();
4805
5378
  } else {
@@ -4820,7 +5393,7 @@ var Chatbox = function Chatbox(props) {
4820
5393
  e.stopPropagation();
4821
5394
 
4822
5395
  // normal request
4823
- if (!args().isStream) {
5396
+ if (!enableStreamMode) {
4824
5397
  if (abortController.current.signal.aborted) {
4825
5398
  reconnectNormalRequest();
4826
5399
  }
@@ -4840,12 +5413,68 @@ var Chatbox = function Chatbox(props) {
4840
5413
  customClassName: "w-100",
4841
5414
  txt: ""
4842
5415
  }))) : null, args().toolkitButtons && args().toolkitButtons.length > 0 && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
4843
- className: "toolkit-btns"
5416
+ className: "toolkit-btns",
5417
+ ref: toolkitBtnsRef
4844
5418
  }, args().toolkitButtons.map(function (btn, index) {
4845
5419
  var _id = "".concat(args().prefix || 'custom-', "chatbox-btn-tools-").concat(chatId).concat(index);
4846
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
4847
5475
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
4848
5476
  key: index,
5477
+ id: _id,
4849
5478
  className: "".concat(btn.value || '', " ").concat(isActive ? 'active' : ''),
4850
5479
  onClick: function onClick(e) {
4851
5480
  return executeButtonAction(btn.onClick, _id, e.currentTarget);