funda-ui 4.6.101 → 4.6.151

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
@@ -938,63 +938,63 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
938
938
  _ref$maxHeight = _ref.maxHeight,
939
939
  maxHeight = _ref$maxHeight === void 0 ? 0 : _ref$maxHeight,
940
940
  cb = _ref.cb;
941
- var _useState = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(0),
941
+ var _useState = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
942
942
  _useState2 = _slicedToArray(_useState, 2),
943
- defaultRowHeight = _useState2[0],
944
- setDefaultRowHeight = _useState2[1];
945
- var _useState3 = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
946
- _useState4 = _slicedToArray(_useState3, 2),
947
- defaultRowHeightInit = _useState4[0],
948
- setDefaultRowHeightInit = _useState4[1];
943
+ defaultRowHeightInit = _useState2[0],
944
+ setDefaultRowHeightInit = _useState2[1];
949
945
 
950
946
  // Reset function to restore default height
951
947
  var reset = (0, react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function () {
952
- if (el && defaultRowHeight > 0) {
953
- el.style.height = defaultRowHeight + "px";
954
-
955
- // Get current dimensions after reset
956
- var style = el.currentStyle || window.getComputedStyle(el);
957
- var _controlWidth = el.scrollWidth + parseInt(style.borderLeftWidth) + parseInt(style.borderRightWidth);
958
- cb === null || cb === void 0 ? void 0 : cb([_controlWidth, defaultRowHeight]);
959
- }
960
- }, [el, defaultRowHeight, cb]);
948
+ if (!el) return;
949
+ var scrollHeight = el.scrollHeight;
950
+ el.style.height = scrollHeight + "px";
951
+
952
+ // Get current dimensions after reset
953
+ var style = window.getComputedStyle(el);
954
+ var _controlWidth = el.scrollWidth + parseInt(style.borderLeftWidth) + parseInt(style.borderRightWidth);
955
+ cb === null || cb === void 0 ? void 0 : cb([_controlWidth, scrollHeight]);
956
+ }, [el, cb]);
961
957
  (0, react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
962
- if (el) {
963
- var style = el.currentStyle || window.getComputedStyle(el);
964
- var _controlWidth = el.scrollWidth + parseInt(style.borderLeftWidth) + parseInt(style.borderRightWidth);
965
-
966
- // initialize default row height
967
- if (el.scrollHeight > 0 && !defaultRowHeightInit) {
968
- var _defaultRowHeight = el.scrollHeight + parseInt(style.borderTopWidth) + parseInt(style.borderBottomWidth);
969
- if (maxHeight != 0 && _defaultRowHeight >= maxHeight) {
970
- _defaultRowHeight = maxHeight;
971
- }
972
- setDefaultRowHeight(_defaultRowHeight);
973
- setDefaultRowHeightInit(true);
958
+ if (!el) return;
959
+
960
+ // Initialize default height
961
+ if (!defaultRowHeightInit) {
962
+ el.style.height = 'auto';
963
+ var initialHeight = el.scrollHeight;
964
+ setDefaultRowHeightInit(true);
965
+
966
+ // If the height is 0, set it to "auto"
967
+ if (initialHeight === 0) {
968
+ el.style.height = "auto";
969
+ } else {
970
+ el.style.height = initialHeight + "px";
974
971
  }
972
+ }
975
973
 
976
- // restore default row height
977
- if (defaultRowHeight > 0) {
978
- el.style.height = defaultRowHeight + "px";
979
- }
974
+ // Get dimensions
975
+ var style = window.getComputedStyle(el);
976
+ var _controlWidth = el.scrollWidth + parseInt(style.borderLeftWidth) + parseInt(style.borderRightWidth);
980
977
 
981
- // reset the height momentarily to get the correct scrollHeight for the textarea
982
- var scrollHeight = el.scrollHeight;
978
+ // Calculate height
979
+ el.style.height = 'auto';
980
+ var finalHeight = el.scrollHeight;
983
981
 
984
- // then set the height directly, outside of the render loop
985
- // Trying to set this with state or a ref will product an incorrect value.
982
+ // Apply max height limit if needed
983
+ if (maxHeight > 0 && finalHeight > maxHeight) {
984
+ finalHeight = maxHeight;
985
+ }
986
986
 
987
- // !!! Compare initial height and changed height
988
- if (scrollHeight > defaultRowHeight && defaultRowHeight > 0) {
989
- var _scrollHeight = scrollHeight;
990
- if (maxHeight != 0 && _scrollHeight >= maxHeight) {
991
- _scrollHeight = maxHeight;
992
- }
993
- el.style.height = _scrollHeight + "px";
994
- }
995
- cb === null || cb === void 0 ? void 0 : cb([_controlWidth, scrollHeight]);
987
+ // Set final height
988
+ // If the height is 0, set it to "auto"
989
+ if (finalHeight === 0) {
990
+ el.style.height = "auto";
991
+ } else {
992
+ el.style.height = finalHeight + "px";
996
993
  }
997
- }, [el, value]);
994
+
995
+ // Callback
996
+ cb === null || cb === void 0 ? void 0 : cb([_controlWidth, finalHeight]);
997
+ }, [el, value, maxHeight, defaultRowHeightInit]);
998
998
  return {
999
999
  reset: reset
1000
1000
  };
@@ -1013,8 +1013,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1013
1013
  /***/
1014
1014
  },
1015
1015
 
1016
- /***/85: /***/function _(module, exports, __nested_webpack_require_39872__) {
1017
- /* module decorator */module = __nested_webpack_require_39872__.nmd(module);
1016
+ /***/85: /***/function _(module, exports, __nested_webpack_require_39270__) {
1017
+ /* module decorator */module = __nested_webpack_require_39270__.nmd(module);
1018
1018
  var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
1019
1019
  function _typeof(obj) {
1020
1020
  "@babel/helpers - typeof";
@@ -1026,7 +1026,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1026
1026
  }, _typeof(obj);
1027
1027
  }
1028
1028
  (function webpackUniversalModuleDefinition(root, factory) {
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 {}
1029
+ if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__nested_webpack_require_39270__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__nested_webpack_require_39270__(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 {}
1030
1030
  })(this, function (__WEBPACK_EXTERNAL_MODULE__787__) {
1031
1031
  return (/******/function () {
1032
1032
  // webpackBootstrap
@@ -1186,8 +1186,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1186
1186
  /***/
1187
1187
  },
1188
1188
 
1189
- /***/702: /***/function _(module, exports, __nested_webpack_require_47960__) {
1190
- /* module decorator */module = __nested_webpack_require_47960__.nmd(module);
1189
+ /***/702: /***/function _(module, exports, __nested_webpack_require_47358__) {
1190
+ /* module decorator */module = __nested_webpack_require_47358__.nmd(module);
1191
1191
  var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
1192
1192
  function _typeof(obj) {
1193
1193
  "@babel/helpers - typeof";
@@ -1199,7 +1199,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1199
1199
  }, _typeof(obj);
1200
1200
  }
1201
1201
  (function webpackUniversalModuleDefinition(root, factory) {
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 {}
1202
+ if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__nested_webpack_require_47358__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__nested_webpack_require_47358__(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 {}
1203
1203
  })(this, function (__WEBPACK_EXTERNAL_MODULE__787__) {
1204
1204
  return (/******/function () {
1205
1205
  // webpackBootstrap
@@ -1400,7 +1400,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1400
1400
  /******/
1401
1401
  /******/ // The require function
1402
1402
  /******/
1403
- function __nested_webpack_require_57581__(moduleId) {
1403
+ function __nested_webpack_require_56979__(moduleId) {
1404
1404
  /******/ // Check if module is in cache
1405
1405
  /******/var cachedModule = __webpack_module_cache__[moduleId];
1406
1406
  /******/
@@ -1419,7 +1419,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1419
1419
  /******/
1420
1420
  /******/ // Execute the module function
1421
1421
  /******/
1422
- __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_57581__);
1422
+ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_56979__);
1423
1423
  /******/
1424
1424
  /******/ // Flag the module as loaded
1425
1425
  /******/
@@ -1436,14 +1436,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1436
1436
  /******/
1437
1437
  (function () {
1438
1438
  /******/ // getDefaultExport function for compatibility with non-harmony modules
1439
- /******/__nested_webpack_require_57581__.n = function (module) {
1439
+ /******/__nested_webpack_require_56979__.n = function (module) {
1440
1440
  /******/var getter = module && module.__esModule ? /******/function () {
1441
1441
  return module['default'];
1442
1442
  } : /******/function () {
1443
1443
  return module;
1444
1444
  };
1445
1445
  /******/
1446
- __nested_webpack_require_57581__.d(getter, {
1446
+ __nested_webpack_require_56979__.d(getter, {
1447
1447
  a: getter
1448
1448
  });
1449
1449
  /******/
@@ -1457,9 +1457,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1457
1457
  /******/
1458
1458
  (function () {
1459
1459
  /******/ // define getter functions for harmony exports
1460
- /******/__nested_webpack_require_57581__.d = function (exports, definition) {
1460
+ /******/__nested_webpack_require_56979__.d = function (exports, definition) {
1461
1461
  /******/for (var key in definition) {
1462
- /******/if (__nested_webpack_require_57581__.o(definition, key) && !__nested_webpack_require_57581__.o(exports, key)) {
1462
+ /******/if (__nested_webpack_require_56979__.o(definition, key) && !__nested_webpack_require_56979__.o(exports, key)) {
1463
1463
  /******/Object.defineProperty(exports, key, {
1464
1464
  enumerable: true,
1465
1465
  get: definition[key]
@@ -1476,7 +1476,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1476
1476
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
1477
1477
  /******/
1478
1478
  (function () {
1479
- /******/__nested_webpack_require_57581__.o = function (obj, prop) {
1479
+ /******/__nested_webpack_require_56979__.o = function (obj, prop) {
1480
1480
  return Object.prototype.hasOwnProperty.call(obj, prop);
1481
1481
  };
1482
1482
  /******/
@@ -1486,7 +1486,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1486
1486
  /******/
1487
1487
  (function () {
1488
1488
  /******/ // define __esModule on exports
1489
- /******/__nested_webpack_require_57581__.r = function (exports) {
1489
+ /******/__nested_webpack_require_56979__.r = function (exports) {
1490
1490
  /******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
1491
1491
  /******/Object.defineProperty(exports, Symbol.toStringTag, {
1492
1492
  value: 'Module'
@@ -1505,7 +1505,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1505
1505
  /******/ /* webpack/runtime/node module decorator */
1506
1506
  /******/
1507
1507
  (function () {
1508
- /******/__nested_webpack_require_57581__.nmd = function (module) {
1508
+ /******/__nested_webpack_require_56979__.nmd = function (module) {
1509
1509
  /******/module.paths = [];
1510
1510
  /******/
1511
1511
  if (!module.children) module.children = [];
@@ -1522,38 +1522,38 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1522
1522
  (function () {
1523
1523
  "use strict";
1524
1524
 
1525
- __nested_webpack_require_57581__.r(__webpack_exports__);
1525
+ __nested_webpack_require_56979__.r(__webpack_exports__);
1526
1526
  /* harmony export */
1527
- __nested_webpack_require_57581__.d(__webpack_exports__, {
1527
+ __nested_webpack_require_56979__.d(__webpack_exports__, {
1528
1528
  /* harmony export */"default": function _default() {
1529
1529
  return __WEBPACK_DEFAULT_EXPORT__;
1530
1530
  }
1531
1531
  /* harmony export */
1532
1532
  });
1533
1533
  /* harmony import */
1534
- var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_57581__(787);
1534
+ var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_56979__(787);
1535
1535
  /* harmony import */
1536
- var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_57581__.n(react__WEBPACK_IMPORTED_MODULE_0__);
1536
+ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_56979__.n(react__WEBPACK_IMPORTED_MODULE_0__);
1537
1537
  /* harmony import */
1538
- var funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_57581__(85);
1538
+ var funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_56979__(85);
1539
1539
  /* harmony import */
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__);
1540
+ var funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nested_webpack_require_56979__.n(funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1__);
1541
1541
  /* harmony import */
1542
- var funda_utils_dist_cjs_useAutosizeTextArea__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_57581__(372);
1542
+ var funda_utils_dist_cjs_useAutosizeTextArea__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_56979__(372);
1543
1543
  /* harmony import */
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__);
1544
+ var funda_utils_dist_cjs_useAutosizeTextArea__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__nested_webpack_require_56979__.n(funda_utils_dist_cjs_useAutosizeTextArea__WEBPACK_IMPORTED_MODULE_2__);
1545
1545
  /* harmony import */
1546
- var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_57581__(188);
1546
+ var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_56979__(188);
1547
1547
  /* harmony import */
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__);
1548
+ var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nested_webpack_require_56979__.n(funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3__);
1549
1549
  /* harmony import */
1550
- var funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_57581__(954);
1550
+ var funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_56979__(954);
1551
1551
  /* harmony import */
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__);
1552
+ var funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__nested_webpack_require_56979__.n(funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_4__);
1553
1553
  /* harmony import */
1554
- var funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_57581__(702);
1554
+ var funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_56979__(702);
1555
1555
  /* harmony import */
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__);
1556
+ var funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__nested_webpack_require_56979__.n(funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_5__);
1557
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"];
1558
1558
  function _regeneratorRuntime() {
1559
1559
  "use strict";
@@ -2513,6 +2513,133 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
2513
2513
 
2514
2514
  /***/ }),
2515
2515
 
2516
+ /***/ 959:
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();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __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 () {
2527
+ return (/******/function () {
2528
+ // webpackBootstrap
2529
+ /******/
2530
+ "use strict";
2531
+
2532
+ /******/ // The require scope
2533
+ /******/
2534
+ var __nested_webpack_require_987__ = {};
2535
+ /******/
2536
+ /************************************************************************/
2537
+ /******/ /* webpack/runtime/define property getters */
2538
+ /******/
2539
+ (function () {
2540
+ /******/ // define getter functions for harmony exports
2541
+ /******/__nested_webpack_require_987__.d = function (exports, definition) {
2542
+ /******/for (var key in definition) {
2543
+ /******/if (__nested_webpack_require_987__.o(definition, key) && !__nested_webpack_require_987__.o(exports, key)) {
2544
+ /******/Object.defineProperty(exports, key, {
2545
+ enumerable: true,
2546
+ get: definition[key]
2547
+ });
2548
+ /******/
2549
+ }
2550
+ /******/
2551
+ }
2552
+ /******/
2553
+ };
2554
+ /******/
2555
+ })();
2556
+ /******/
2557
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
2558
+ /******/
2559
+ (function () {
2560
+ /******/__nested_webpack_require_987__.o = function (obj, prop) {
2561
+ return Object.prototype.hasOwnProperty.call(obj, prop);
2562
+ };
2563
+ /******/
2564
+ })();
2565
+ /******/
2566
+ /******/ /* webpack/runtime/make namespace object */
2567
+ /******/
2568
+ (function () {
2569
+ /******/ // define __esModule on exports
2570
+ /******/__nested_webpack_require_987__.r = function (exports) {
2571
+ /******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
2572
+ /******/Object.defineProperty(exports, Symbol.toStringTag, {
2573
+ value: 'Module'
2574
+ });
2575
+ /******/
2576
+ }
2577
+ /******/
2578
+ Object.defineProperty(exports, '__esModule', {
2579
+ value: true
2580
+ });
2581
+ /******/
2582
+ };
2583
+ /******/
2584
+ })();
2585
+ /******/
2586
+ /************************************************************************/
2587
+ var __webpack_exports__ = {};
2588
+ __nested_webpack_require_987__.r(__webpack_exports__);
2589
+ /* harmony export */
2590
+ __nested_webpack_require_987__.d(__webpack_exports__, {
2591
+ /* harmony export */"htmlDecode": function htmlDecode() {
2592
+ return (/* binding */_htmlDecode
2593
+ );
2594
+ },
2595
+ /* harmony export */"htmlEncode": function htmlEncode() {
2596
+ return (/* binding */_htmlEncode
2597
+ );
2598
+ }
2599
+ /* harmony export */
2600
+ });
2601
+ /**
2602
+ * HTML entities encode
2603
+ *
2604
+ * @param {String} str Input text
2605
+ * @return {String} Filtered text
2606
+ */
2607
+ function _htmlEncode(str) {
2608
+ return str.replace(/[&<>'"]/g, function (tag) {
2609
+ return {
2610
+ '&': '&amp;',
2611
+ '<': '&lt;',
2612
+ '>': '&gt;',
2613
+ "'": '&#39;',
2614
+ '"': '&quot;'
2615
+ }[tag];
2616
+ });
2617
+ }
2618
+
2619
+ /**
2620
+ * HTML entities decode
2621
+ *
2622
+ * @param {String} str Input text
2623
+ * @return {String} Filtered text
2624
+ */
2625
+ function _htmlDecode() {
2626
+ var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
2627
+ var entities = [['amp', '&'], ['apos', '\''], ['#x27', '\''], ['#x2F', '/'], ['#39', '\''], ['#47', '/'], ['lt', '<'], ['gt', '>'], ['nbsp', ' '], ['quot', '"'], ['#60', '<'], ['#62', '>']];
2628
+ for (var i = 0, max = entities.length; i < max; i++) {
2629
+ str = str.replace(new RegExp('&' + entities[i][0] + ';', 'g'), entities[i][1]);
2630
+ }
2631
+ return str;
2632
+ }
2633
+
2634
+ /******/
2635
+ return __webpack_exports__;
2636
+ /******/
2637
+ }()
2638
+ );
2639
+ });
2640
+
2641
+ /***/ }),
2642
+
2516
2643
  /***/ 761:
2517
2644
  /***/ (function(module, exports, __webpack_require__) {
2518
2645
 
@@ -3433,6 +3560,8 @@ var useThrottle_default = /*#__PURE__*/__webpack_require__.n(useThrottle);
3433
3560
  // EXTERNAL MODULE: ../Utils/dist/cjs/useClickOutside.js
3434
3561
  var useClickOutside = __webpack_require__(761);
3435
3562
  var useClickOutside_default = /*#__PURE__*/__webpack_require__.n(useClickOutside);
3563
+ // EXTERNAL MODULE: ../Utils/dist/cjs/sanitize.js
3564
+ var sanitize = __webpack_require__(959);
3436
3565
  ;// CONCATENATED MODULE: ./src/PureLoader.tsx
3437
3566
 
3438
3567
  var PureLoader = function PureLoader(props) {
@@ -3658,40 +3787,6 @@ function isStreamResponse(response) {
3658
3787
  return response.body instanceof ReadableStream;
3659
3788
  }
3660
3789
  ;
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
- }
3695
3790
  ;// CONCATENATED MODULE: ./src/useStreamController.tsx
3696
3791
  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); }
3697
3792
  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; }
@@ -4111,13 +4206,14 @@ function src_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
4111
4206
 
4112
4207
 
4113
4208
 
4209
+
4114
4210
  // loader
4115
4211
 
4116
4212
 
4117
4213
 
4118
4214
 
4119
4215
  var Chatbox = function Chatbox(props) {
4120
- var _args$newChatButton;
4216
+ var _list, _args$newChatButton;
4121
4217
  var chatId = useComId_default()().replace(/\-/g, '_');
4122
4218
 
4123
4219
  // Store latest props in refs
@@ -4266,6 +4362,7 @@ var Chatbox = function Chatbox(props) {
4266
4362
  return {};
4267
4363
  }
4268
4364
  var debug = currentProps.debug,
4365
+ defaultRows = currentProps.defaultRows,
4269
4366
  prefix = currentProps.prefix,
4270
4367
  contentRef = currentProps.contentRef,
4271
4368
  model = currentProps.model,
@@ -4289,6 +4386,7 @@ var Chatbox = function Chatbox(props) {
4289
4386
  newChatButton = currentProps.newChatButton,
4290
4387
  maxHistoryLength = currentProps.maxHistoryLength,
4291
4388
  customRequest = currentProps.customRequest,
4389
+ onQuestionClick = currentProps.onQuestionClick,
4292
4390
  renderParser = currentProps.renderParser,
4293
4391
  requestBodyFormatter = currentProps.requestBodyFormatter,
4294
4392
  nameFormatter = currentProps.nameFormatter,
@@ -4333,6 +4431,7 @@ var Chatbox = function Chatbox(props) {
4333
4431
  var responseExtractPath = responseExtractor.split('.');
4334
4432
  return {
4335
4433
  debug: debug,
4434
+ defaultRows: defaultRows,
4336
4435
  prefix: prefix,
4337
4436
  contentRef: contentRef,
4338
4437
  model: model,
@@ -4353,6 +4452,7 @@ var Chatbox = function Chatbox(props) {
4353
4452
  toolkitButtons: toolkitButtons,
4354
4453
  newChatButton: newChatButton,
4355
4454
  customRequest: customRequest,
4455
+ onQuestionClick: onQuestionClick,
4356
4456
  renderParser: renderParser,
4357
4457
  requestBodyFormatter: requestBodyFormatter,
4358
4458
  nameFormatter: nameFormatter,
@@ -4361,6 +4461,7 @@ var Chatbox = function Chatbox(props) {
4361
4461
  onChunk: onChunk,
4362
4462
  onComplete: onComplete,
4363
4463
  //
4464
+ defaultQuestionsRes: questions,
4364
4465
  latestContextData: latestContextData,
4365
4466
  questionNameRes: _questionName,
4366
4467
  answerNameRes: _answerName,
@@ -4373,14 +4474,37 @@ var Chatbox = function Chatbox(props) {
4373
4474
  };
4374
4475
  };
4375
4476
 
4477
+ //================================================================
4478
+ // Custom Questions
4479
+ //================================================================
4480
+ var _useState17 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(props.defaultQuestions),
4481
+ _useState18 = src_slicedToArray(_useState17, 2),
4482
+ questions = _useState18[0],
4483
+ setQuestions = _useState18[1];
4484
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
4485
+ if (props.defaultQuestions) {
4486
+ setQuestions(props.defaultQuestions);
4487
+ }
4488
+ }, [props.defaultQuestions]);
4489
+ var hasQuestion = function hasQuestion() {
4490
+ return args().defaultQuestionsRes && args().defaultQuestionsRes.list.length > 0;
4491
+ };
4492
+ var handleQuestionClick = function handleQuestionClick(text) {
4493
+ var _args$onQuestionClick, _args;
4494
+ if (inputContentRef.current) {
4495
+ inputContentRef.current.set(text);
4496
+ }
4497
+ (_args$onQuestionClick = (_args = args()).onQuestionClick) === null || _args$onQuestionClick === void 0 ? void 0 : _args$onQuestionClick.call(_args, text, exposedMethods());
4498
+ };
4499
+
4376
4500
  //================================================================
4377
4501
  // Custom buttons
4378
4502
  //================================================================
4379
4503
  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];
4504
+ var _useState19 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({}),
4505
+ _useState20 = src_slicedToArray(_useState19, 2),
4506
+ activeButtons = _useState20[0],
4507
+ setActiveButtons = _useState20[1];
4384
4508
  var closeDropdowns = function closeDropdowns() {
4385
4509
  setActiveButtons(function (prev) {
4386
4510
  var _args$toolkitButtons;
@@ -4418,10 +4542,10 @@ var Chatbox = function Chatbox(props) {
4418
4542
  };
4419
4543
 
4420
4544
  // 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];
4545
+ var _useState21 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({}),
4546
+ _useState22 = src_slicedToArray(_useState21, 2),
4547
+ selectedOpt = _useState22[0],
4548
+ setSelectedOpt = _useState22[1];
4425
4549
  var getButtonOptions = function getButtonOptions(btn) {
4426
4550
  var options = [];
4427
4551
  var index = 1;
@@ -4716,7 +4840,7 @@ var Chatbox = function Chatbox(props) {
4716
4840
  var streamController = src_useStreamController({
4717
4841
  onChunk: function () {
4718
4842
  var _onChunk = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee2(chunk, index) {
4719
- var _args$onChunk, _args2;
4843
+ var _args$onChunk, _args3;
4720
4844
  var res;
4721
4845
  return src_regeneratorRuntime().wrap(function _callee2$(_context2) {
4722
4846
  while (1) switch (_context2.prev = _context2.next) {
@@ -4733,7 +4857,7 @@ var Chatbox = function Chatbox(props) {
4733
4857
  case 3:
4734
4858
  res = _context2.sent;
4735
4859
  //
4736
- (_args$onChunk = (_args2 = args()).onChunk) === null || _args$onChunk === void 0 ? void 0 : _args$onChunk.call(_args2, inputContentRef.current, res, conversationHistory.current);
4860
+ (_args$onChunk = (_args3 = args()).onChunk) === null || _args$onChunk === void 0 ? void 0 : _args$onChunk.call(_args3, inputContentRef.current, res, conversationHistory.current);
4737
4861
  case 5:
4738
4862
  case "end":
4739
4863
  return _context2.stop();
@@ -4747,7 +4871,7 @@ var Chatbox = function Chatbox(props) {
4747
4871
  }(),
4748
4872
  onComplete: function () {
4749
4873
  var _onComplete = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee3(lastContent) {
4750
- var _args$onComplete, _args4;
4874
+ var _args$onComplete, _args5;
4751
4875
  var res;
4752
4876
  return src_regeneratorRuntime().wrap(function _callee3$(_context3) {
4753
4877
  while (1) switch (_context3.prev = _context3.next) {
@@ -4761,7 +4885,7 @@ var Chatbox = function Chatbox(props) {
4761
4885
  displayMessage(args().answerNameRes, res);
4762
4886
 
4763
4887
  //
4764
- (_args$onComplete = (_args4 = args()).onComplete) === null || _args$onComplete === void 0 ? void 0 : _args$onComplete.call(_args4, inputContentRef.current, res, conversationHistory.current);
4888
+ (_args$onComplete = (_args5 = args()).onComplete) === null || _args$onComplete === void 0 ? void 0 : _args$onComplete.call(_args5, inputContentRef.current, res, conversationHistory.current);
4765
4889
 
4766
4890
  //
4767
4891
  closeSSE();
@@ -4821,7 +4945,7 @@ var Chatbox = function Chatbox(props) {
4821
4945
  };
4822
4946
  var sendMessage = /*#__PURE__*/function () {
4823
4947
  var _ref2 = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee4() {
4824
- var messageInput, message, inputMsg, res, _args$onChunk2, _args6, _args$onComplete2, _args7, reply, replyRes;
4948
+ var messageInput, message, inputMsg, res, _args$onChunk2, _args7, _args$onComplete2, _args8, reply, replyRes;
4825
4949
  return src_regeneratorRuntime().wrap(function _callee4$(_context4) {
4826
4950
  while (1) switch (_context4.prev = _context4.next) {
4827
4951
  case 0:
@@ -4832,7 +4956,7 @@ var Chatbox = function Chatbox(props) {
4832
4956
  return _context4.abrupt("return");
4833
4957
  case 2:
4834
4958
  messageInput = msInput.current;
4835
- message = htmlEncode(messageInput.value); // It fires in real time as the user enters
4959
+ message = (0,sanitize.htmlEncode)(messageInput.value); // It fires in real time as the user enters
4836
4960
  // Sanitizing input is the process of securing/cleaning/filtering input data.
4837
4961
  if (!(typeof args().onInputCallback === 'function')) {
4838
4962
  _context4.next = 8;
@@ -4901,8 +5025,8 @@ var Chatbox = function Chatbox(props) {
4901
5025
  displayMessage(args().answerNameRes, replyRes); // Display AI reply
4902
5026
 
4903
5027
  //
4904
- (_args$onChunk2 = (_args6 = args()).onChunk) === null || _args$onChunk2 === void 0 ? void 0 : _args$onChunk2.call(_args6, inputContentRef.current, replyRes, conversationHistory.current);
4905
- (_args$onComplete2 = (_args7 = args()).onComplete) === null || _args$onComplete2 === void 0 ? void 0 : _args$onComplete2.call(_args7, inputContentRef.current, replyRes, conversationHistory.current);
5028
+ (_args$onChunk2 = (_args7 = args()).onChunk) === null || _args$onChunk2 === void 0 ? void 0 : _args$onChunk2.call(_args7, inputContentRef.current, replyRes, conversationHistory.current);
5029
+ (_args$onComplete2 = (_args8 = args()).onComplete) === null || _args$onComplete2 === void 0 ? void 0 : _args$onComplete2.call(_args8, inputContentRef.current, replyRes, conversationHistory.current);
4906
5030
 
4907
5031
  //reset SSE
4908
5032
  closeSSE();
@@ -5201,7 +5325,7 @@ var Chatbox = function Chatbox(props) {
5201
5325
  className: "".concat(args().prefix || 'custom-', "chatbox-container"),
5202
5326
  ref: rootRef
5203
5327
  }, msgList.length === 0 ? /*#__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", {
5204
- className: "d-flex flex-column align-items-center justify-content-center h-50"
5328
+ className: "d-flex flex-column align-items-center justify-content-center ".concat(hasQuestion() ? '' : 'h-50')
5205
5329
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("p", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
5206
5330
  width: "70px",
5207
5331
  height: "70px",
@@ -5228,7 +5352,25 @@ var Chatbox = function Chatbox(props) {
5228
5352
  dangerouslySetInnerHTML: {
5229
5353
  __html: "".concat(args().noDataPlaceholder)
5230
5354
  }
5231
- }))) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
5355
+ }), hasQuestion() && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
5356
+ className: "default-questions"
5357
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
5358
+ className: "default-questions-title",
5359
+ dangerouslySetInnerHTML: {
5360
+ __html: "".concat(args().defaultQuestionsRes.title)
5361
+ }
5362
+ }), (_list = args().defaultQuestionsRes.list) === null || _list === void 0 ? void 0 : _list.map(function (question, index) {
5363
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
5364
+ key: index,
5365
+ className: "default-question-item",
5366
+ onClick: function onClick() {
5367
+ return handleQuestionClick(question);
5368
+ },
5369
+ dangerouslySetInnerHTML: {
5370
+ __html: "".concat(question)
5371
+ }
5372
+ });
5373
+ })))) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
5232
5374
  className: "messages",
5233
5375
  ref: msgContainerRef
5234
5376
  }, msgList.map(function (msg, index) {
@@ -5356,16 +5498,20 @@ var Chatbox = function Chatbox(props) {
5356
5498
  placeholder: args().placeholder,
5357
5499
  disabled: loading ? true : false,
5358
5500
  onKeyDown: function onKeyDown(event) {
5359
- if (event.key === 'Enter') {
5360
- event.preventDefault();
5501
+ // line breaks
5502
+ if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {
5503
+ return;
5504
+ }
5505
+ if (event.key === 'Enter' && !event.shiftKey && !event.ctrlKey && !event.metaKey) {
5506
+ event.preventDefault(); // Prevent line breaks
5361
5507
  handleClickSafe();
5362
5508
  }
5363
5509
  },
5364
5510
  onChange: function onChange(e) {
5365
- var _args$onInputChange, _args10;
5366
- (_args$onInputChange = (_args10 = args()).onInputChange) === null || _args$onInputChange === void 0 ? void 0 : _args$onInputChange.call(_args10, inputContentRef.current, e.target.value);
5511
+ var _args$onInputChange, _args11;
5512
+ (_args$onInputChange = (_args11 = args()).onInputChange) === null || _args$onInputChange === void 0 ? void 0 : _args$onInputChange.call(_args11, inputContentRef.current, e.target.value);
5367
5513
  },
5368
- rows: 3,
5514
+ rows: args().defaultRows || 3,
5369
5515
  autoSize: true,
5370
5516
  autoSizeMaxHeight: 200
5371
5517
  }), 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("button", {