funda-ui 4.6.222 → 4.6.344

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.
@@ -4202,14 +4202,14 @@ var useStreamController = function useStreamController() {
4202
4202
  ;// CONCATENATED MODULE: ./src/index.tsx
4203
4203
  function src_typeof(obj) { "@babel/helpers - typeof"; return src_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; }, src_typeof(obj); }
4204
4204
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = src_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
4205
- function src_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ src_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" == src_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; }
4206
- function src_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4207
- function src_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { src_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { src_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4208
4205
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4209
4206
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4210
4207
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4211
4208
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return src_typeof(key) === "symbol" ? key : String(key); }
4212
4209
  function _toPrimitive(input, hint) { if (src_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (src_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4210
+ function src_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ src_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" == src_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; }
4211
+ function src_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4212
+ function src_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { src_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { src_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4213
4213
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || src_unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4214
4214
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4215
4215
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
@@ -4415,9 +4415,13 @@ var Chatbox = function Chatbox(props) {
4415
4415
  maxHistoryLength = currentProps.maxHistoryLength,
4416
4416
  customRequest = currentProps.customRequest,
4417
4417
  onQuestionClick = currentProps.onQuestionClick,
4418
+ onCopyCallback = currentProps.onCopyCallback,
4418
4419
  renderParser = currentProps.renderParser,
4419
4420
  requestBodyFormatter = currentProps.requestBodyFormatter,
4421
+ copiedContentFormatter = currentProps.copiedContentFormatter,
4420
4422
  nameFormatter = currentProps.nameFormatter,
4423
+ showCopyBtn = currentProps.showCopyBtn,
4424
+ autoCopyReply = currentProps.autoCopyReply,
4421
4425
  onInputChange = currentProps.onInputChange,
4422
4426
  onInputCallback = currentProps.onInputCallback,
4423
4427
  onChunk = currentProps.onChunk,
@@ -4481,9 +4485,13 @@ var Chatbox = function Chatbox(props) {
4481
4485
  newChatButton: newChatButton,
4482
4486
  customRequest: customRequest,
4483
4487
  onQuestionClick: onQuestionClick,
4488
+ onCopyCallback: onCopyCallback,
4484
4489
  renderParser: renderParser,
4485
4490
  requestBodyFormatter: requestBodyFormatter,
4491
+ copiedContentFormatter: copiedContentFormatter,
4486
4492
  nameFormatter: nameFormatter,
4493
+ showCopyBtn: showCopyBtn,
4494
+ autoCopyReply: autoCopyReply,
4487
4495
  onInputChange: onInputChange,
4488
4496
  onInputCallback: onInputCallback,
4489
4497
  onChunk: onChunk,
@@ -4502,6 +4510,77 @@ var Chatbox = function Chatbox(props) {
4502
4510
  };
4503
4511
  };
4504
4512
 
4513
+ //================================================================
4514
+ // Clipboard
4515
+ //================================================================
4516
+ var chatboxCopyToClipboard = /*#__PURE__*/function () {
4517
+ var _ref = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee(text) {
4518
+ var _content, _args$onCopyCallback, _args, textArea, _args$onCopyCallback2, _args2, _args$onCopyCallback3, _args3;
4519
+ return src_regeneratorRuntime().wrap(function _callee$(_context) {
4520
+ while (1) switch (_context.prev = _context.next) {
4521
+ case 0:
4522
+ _content = text;
4523
+ if (typeof args().copiedContentFormatter === 'function') {
4524
+ _content = args().copiedContentFormatter(text);
4525
+ }
4526
+ _context.prev = 2;
4527
+ if (!(navigator.clipboard && window.isSecureContext)) {
4528
+ _context.next = 8;
4529
+ break;
4530
+ }
4531
+ _context.next = 6;
4532
+ return navigator.clipboard.writeText(_content);
4533
+ case 6:
4534
+ (_args$onCopyCallback = (_args = args()).onCopyCallback) === null || _args$onCopyCallback === void 0 ? void 0 : _args$onCopyCallback.call(_args, {
4535
+ success: true,
4536
+ message: 'Text copied to clipboard'
4537
+ });
4538
+ return _context.abrupt("return", true);
4539
+ case 8:
4540
+ // Fallback for older browsers
4541
+ textArea = document.createElement('textarea');
4542
+ textArea.value = _content;
4543
+ textArea.style.position = 'fixed';
4544
+ textArea.style.left = '-999999px';
4545
+ textArea.style.top = '-999999px';
4546
+ document.body.appendChild(textArea);
4547
+ textArea.focus();
4548
+ textArea.select();
4549
+ _context.prev = 16;
4550
+ document.execCommand('copy');
4551
+ textArea.remove();
4552
+ (_args$onCopyCallback2 = (_args2 = args()).onCopyCallback) === null || _args$onCopyCallback2 === void 0 ? void 0 : _args$onCopyCallback2.call(_args2, {
4553
+ success: true,
4554
+ message: 'Text copied to clipboard'
4555
+ });
4556
+ return _context.abrupt("return", true);
4557
+ case 23:
4558
+ _context.prev = 23;
4559
+ _context.t0 = _context["catch"](16);
4560
+ textArea.remove();
4561
+ return _context.abrupt("return", false);
4562
+ case 27:
4563
+ _context.next = 33;
4564
+ break;
4565
+ case 29:
4566
+ _context.prev = 29;
4567
+ _context.t1 = _context["catch"](2);
4568
+ (_args$onCopyCallback3 = (_args3 = args()).onCopyCallback) === null || _args$onCopyCallback3 === void 0 ? void 0 : _args$onCopyCallback3.call(_args3, {
4569
+ success: false,
4570
+ message: "Failed to copy text: ".concat(_context.t1)
4571
+ });
4572
+ return _context.abrupt("return", false);
4573
+ case 33:
4574
+ case "end":
4575
+ return _context.stop();
4576
+ }
4577
+ }, _callee, null, [[2, 29], [16, 23]]);
4578
+ }));
4579
+ return function chatboxCopyToClipboard(_x2) {
4580
+ return _ref.apply(this, arguments);
4581
+ };
4582
+ }();
4583
+
4505
4584
  //================================================================
4506
4585
  // Custom Questions
4507
4586
  //================================================================
@@ -4518,11 +4597,11 @@ var Chatbox = function Chatbox(props) {
4518
4597
  return args().defaultQuestionsRes && args().defaultQuestionsRes.list.length > 0;
4519
4598
  };
4520
4599
  var handleQuestionClick = function handleQuestionClick(text) {
4521
- var _args$onQuestionClick, _args;
4600
+ var _args$onQuestionClick, _args5;
4522
4601
  if (inputContentRef.current) {
4523
4602
  inputContentRef.current.set(text);
4524
4603
  }
4525
- (_args$onQuestionClick = (_args = args()).onQuestionClick) === null || _args$onQuestionClick === void 0 ? void 0 : _args$onQuestionClick.call(_args, text, exposedMethods());
4604
+ (_args$onQuestionClick = (_args5 = args()).onQuestionClick) === null || _args$onQuestionClick === void 0 ? void 0 : _args$onQuestionClick.call(_args5, text, exposedMethods());
4526
4605
  };
4527
4606
 
4528
4607
  //================================================================
@@ -4548,18 +4627,18 @@ var Chatbox = function Chatbox(props) {
4548
4627
  });
4549
4628
  };
4550
4629
  var executeButtonAction = /*#__PURE__*/function () {
4551
- var _ref = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee(actionStr, buttonId, buttonElement) {
4630
+ var _ref2 = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee2(actionStr, buttonId, buttonElement) {
4552
4631
  var actionFn, result, options, newState;
4553
- return src_regeneratorRuntime().wrap(function _callee$(_context) {
4554
- while (1) switch (_context.prev = _context.next) {
4632
+ return src_regeneratorRuntime().wrap(function _callee2$(_context2) {
4633
+ while (1) switch (_context2.prev = _context2.next) {
4555
4634
  case 0:
4556
- _context.prev = 0;
4635
+ _context2.prev = 0;
4557
4636
  actionFn = new Function('method', 'isActive', 'button', actionStr); // !!!REQUIRED "await"
4558
4637
  // "customMethods" may be asynchronous
4559
- _context.next = 4;
4638
+ _context2.next = 4;
4560
4639
  return actionFn(exposedMethods(), !activeButtons[buttonId], buttonElement);
4561
4640
  case 4:
4562
- result = _context.sent;
4641
+ result = _context2.sent;
4563
4642
  // If the returned result is an array, it is a dynamic option
4564
4643
  if (Array.isArray(result) && Object.keys(dynamicOptions).length === 0) {
4565
4644
  options = result.map(function (item) {
@@ -4589,19 +4668,19 @@ var Chatbox = function Chatbox(props) {
4589
4668
  setActiveButtons(function (prev) {
4590
4669
  return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, buttonId, newState));
4591
4670
  });
4592
- return _context.abrupt("return", result);
4671
+ return _context2.abrupt("return", result);
4593
4672
  case 11:
4594
- _context.prev = 11;
4595
- _context.t0 = _context["catch"](0);
4596
- console.error('Error executing button action:', _context.t0);
4673
+ _context2.prev = 11;
4674
+ _context2.t0 = _context2["catch"](0);
4675
+ console.error('Error executing button action:', _context2.t0);
4597
4676
  case 14:
4598
4677
  case "end":
4599
- return _context.stop();
4678
+ return _context2.stop();
4600
4679
  }
4601
- }, _callee, null, [[0, 11]]);
4680
+ }, _callee2, null, [[0, 11]]);
4602
4681
  }));
4603
- return function executeButtonAction(_x2, _x3, _x4) {
4604
- return _ref.apply(this, arguments);
4682
+ return function executeButtonAction(_x3, _x4, _x5) {
4683
+ return _ref2.apply(this, arguments);
4605
4684
  };
4606
4685
  }();
4607
4686
 
@@ -4721,25 +4800,25 @@ var Chatbox = function Chatbox(props) {
4721
4800
 
4722
4801
  // parse chunk data
4723
4802
  var parseChunkData = /*#__PURE__*/function () {
4724
- var _ref2 = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee2(chunk, index, complete) {
4803
+ var _ref3 = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee3(chunk, index, complete) {
4725
4804
  var lastContent, _args$responseExtract, extractPath, lines, _iterator, _step, line, _content, result, _iterator2, _step2, path, content, parsedContent, latestRes;
4726
- return src_regeneratorRuntime().wrap(function _callee2$(_context2) {
4727
- while (1) switch (_context2.prev = _context2.next) {
4805
+ return src_regeneratorRuntime().wrap(function _callee3$(_context3) {
4806
+ while (1) switch (_context3.prev = _context3.next) {
4728
4807
  case 0:
4729
4808
  // Store the final content and bind it to loading
4730
4809
  lastContent = '';
4731
- _context2.prev = 1;
4810
+ _context3.prev = 1;
4732
4811
  // Extract response using the path
4733
4812
  extractPath = (_args$responseExtract = args().responseExtractPath) === null || _args$responseExtract === void 0 ? void 0 : _args$responseExtract.slice(1); // Streaming data is JSON split by rows
4734
4813
  lines = chunk.split("\n").filter(function (line) {
4735
4814
  return line.trim() !== "";
4736
4815
  });
4737
4816
  _iterator = _createForOfIteratorHelper(lines);
4738
- _context2.prev = 5;
4817
+ _context3.prev = 5;
4739
4818
  _iterator.s();
4740
4819
  case 7:
4741
4820
  if ((_step = _iterator.n()).done) {
4742
- _context2.next = 45;
4821
+ _context3.next = 45;
4743
4822
  break;
4744
4823
  }
4745
4824
  line = _step.value;
@@ -4750,7 +4829,7 @@ var Chatbox = function Chatbox(props) {
4750
4829
 
4751
4830
  // Send the streamed data to the front end
4752
4831
  if (!(line.indexOf('[DONE]') < 0)) {
4753
- _context2.next = 40;
4832
+ _context3.next = 40;
4754
4833
  break;
4755
4834
  }
4756
4835
  // STEP 1:
@@ -4758,14 +4837,14 @@ var Chatbox = function Chatbox(props) {
4758
4837
  // Create a JSON string
4759
4838
  _content = "".concat(line.replace(/^data:\s*/, '')); // Determine whether it is in JSON format
4760
4839
  if (isValidJSON(_content)) {
4761
- _context2.next = 16;
4840
+ _context3.next = 16;
4762
4841
  break;
4763
4842
  }
4764
4843
  console.log('--> [ERROR] Wrong JSON format');
4765
4844
 
4766
4845
  //reset SSE
4767
4846
  closeSSE();
4768
- return _context2.abrupt("break", 45);
4847
+ return _context3.abrupt("break", 45);
4769
4848
  case 16:
4770
4849
  // STEP 2:
4771
4850
  // ------
@@ -4774,18 +4853,18 @@ var Chatbox = function Chatbox(props) {
4774
4853
  // for Ollama API (STREAM END)
4775
4854
  //*******
4776
4855
  if (!(typeof result.done !== 'undefined')) {
4777
- _context2.next = 22;
4856
+ _context3.next = 22;
4778
4857
  break;
4779
4858
  }
4780
4859
  if (!(result.done === true)) {
4781
- _context2.next = 22;
4860
+ _context3.next = 22;
4782
4861
  break;
4783
4862
  }
4784
4863
  console.log('--> [DONE]');
4785
4864
 
4786
4865
  //reset SSE
4787
4866
  closeSSE();
4788
- return _context2.abrupt("break", 45);
4867
+ return _context3.abrupt("break", 45);
4789
4868
  case 22:
4790
4869
  //*******
4791
4870
  // for OpenAI API
@@ -4807,10 +4886,10 @@ var Chatbox = function Chatbox(props) {
4807
4886
  // ------
4808
4887
  // 🚀 !! IMPORTANT: Skip the error content
4809
4888
  if (!(typeof content === 'undefined')) {
4810
- _context2.next = 26;
4889
+ _context3.next = 26;
4811
4890
  break;
4812
4891
  }
4813
- return _context2.abrupt("continue", 43);
4892
+ return _context3.abrupt("continue", 43);
4814
4893
  case 26:
4815
4894
  // STEP 4:
4816
4895
  // ------
@@ -4837,13 +4916,13 @@ var Chatbox = function Chatbox(props) {
4837
4916
  // ------
4838
4917
  parsedContent = tempLastContent.current; // If a render parser exists, it is used to process the string
4839
4918
  if (!(typeof args().renderParser === 'function')) {
4840
- _context2.next = 36;
4919
+ _context3.next = 36;
4841
4920
  break;
4842
4921
  }
4843
- _context2.next = 35;
4922
+ _context3.next = 35;
4844
4923
  return args().renderParser(parsedContent);
4845
4924
  case 35:
4846
- parsedContent = _context2.sent;
4925
+ parsedContent = _context3.sent;
4847
4926
  case 36:
4848
4927
  // STEP 8:
4849
4928
  // ------
@@ -4860,55 +4939,55 @@ var Chatbox = function Chatbox(props) {
4860
4939
  // ------
4861
4940
  // Scroll to the bottom
4862
4941
  scrollToBottom();
4863
- _context2.next = 43;
4942
+ _context3.next = 43;
4864
4943
  break;
4865
4944
  case 40:
4866
4945
  console.log('--> [DONE]');
4867
4946
 
4868
4947
  //reset SSE
4869
4948
  closeSSE();
4870
- return _context2.abrupt("break", 45);
4949
+ return _context3.abrupt("break", 45);
4871
4950
  case 43:
4872
- _context2.next = 7;
4951
+ _context3.next = 7;
4873
4952
  break;
4874
4953
  case 45:
4875
- _context2.next = 50;
4954
+ _context3.next = 50;
4876
4955
  break;
4877
4956
  case 47:
4878
- _context2.prev = 47;
4879
- _context2.t0 = _context2["catch"](5);
4880
- _iterator.e(_context2.t0);
4957
+ _context3.prev = 47;
4958
+ _context3.t0 = _context3["catch"](5);
4959
+ _iterator.e(_context3.t0);
4881
4960
  case 50:
4882
- _context2.prev = 50;
4961
+ _context3.prev = 50;
4883
4962
  _iterator.f();
4884
- return _context2.finish(50);
4963
+ return _context3.finish(50);
4885
4964
  case 53:
4886
- _context2.next = 58;
4965
+ _context3.next = 58;
4887
4966
  break;
4888
4967
  case 55:
4889
- _context2.prev = 55;
4890
- _context2.t1 = _context2["catch"](1);
4891
- console.error('--> Error processing chunk:', _context2.t1);
4968
+ _context3.prev = 55;
4969
+ _context3.t1 = _context3["catch"](1);
4970
+ console.error('--> Error processing chunk:', _context3.t1);
4892
4971
  case 58:
4893
4972
  latestRes = complete ? lastContent : tempLastContent.current; // If a render parser exists, it is used to process the string
4894
4973
  if (!(typeof args().renderParser === 'function')) {
4895
- _context2.next = 63;
4974
+ _context3.next = 63;
4896
4975
  break;
4897
4976
  }
4898
- _context2.next = 62;
4977
+ _context3.next = 62;
4899
4978
  return args().renderParser(latestRes);
4900
4979
  case 62:
4901
- latestRes = _context2.sent;
4980
+ latestRes = _context3.sent;
4902
4981
  case 63:
4903
- return _context2.abrupt("return", formatLatestDisplayContent(latestRes));
4982
+ return _context3.abrupt("return", formatLatestDisplayContent(latestRes));
4904
4983
  case 64:
4905
4984
  case "end":
4906
- return _context2.stop();
4985
+ return _context3.stop();
4907
4986
  }
4908
- }, _callee2, null, [[1, 55], [5, 47, 50, 53]]);
4987
+ }, _callee3, null, [[1, 55], [5, 47, 50, 53]]);
4909
4988
  }));
4910
- return function parseChunkData(_x5, _x6, _x7) {
4911
- return _ref2.apply(this, arguments);
4989
+ return function parseChunkData(_x6, _x7, _x8) {
4990
+ return _ref3.apply(this, arguments);
4912
4991
  };
4913
4992
  }();
4914
4993
 
@@ -4916,11 +4995,11 @@ var Chatbox = function Chatbox(props) {
4916
4995
  var tempLastContent = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)('');
4917
4996
  var streamController = src_useStreamController({
4918
4997
  onChunk: function () {
4919
- var _onChunk = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee3(chunk, index) {
4920
- var _args$onChunk, _args4;
4998
+ var _onChunk = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee4(chunk, index) {
4999
+ var _args$onChunk, _args8;
4921
5000
  var res;
4922
- return src_regeneratorRuntime().wrap(function _callee3$(_context3) {
4923
- while (1) switch (_context3.prev = _context3.next) {
5001
+ return src_regeneratorRuntime().wrap(function _callee4$(_context4) {
5002
+ while (1) switch (_context4.prev = _context4.next) {
4924
5003
  case 0:
4925
5004
  // start (Execute it only once)
4926
5005
  if (index === 0) {
@@ -4929,50 +5008,50 @@ var Chatbox = function Chatbox(props) {
4929
5008
  }
4930
5009
 
4931
5010
  //
4932
- _context3.next = 3;
5011
+ _context4.next = 3;
4933
5012
  return parseChunkData(chunk, index, false);
4934
5013
  case 3:
4935
- res = _context3.sent;
5014
+ res = _context4.sent;
4936
5015
  //
4937
- (_args$onChunk = (_args4 = args()).onChunk) === null || _args$onChunk === void 0 ? void 0 : _args$onChunk.call(_args4, inputContentRef.current, res, conversationHistory.current);
5016
+ (_args$onChunk = (_args8 = args()).onChunk) === null || _args$onChunk === void 0 ? void 0 : _args$onChunk.call(_args8, inputContentRef.current, res, conversationHistory.current);
4938
5017
  case 5:
4939
5018
  case "end":
4940
- return _context3.stop();
5019
+ return _context4.stop();
4941
5020
  }
4942
- }, _callee3);
5021
+ }, _callee4);
4943
5022
  }));
4944
- function onChunk(_x8, _x9) {
5023
+ function onChunk(_x9, _x10) {
4945
5024
  return _onChunk.apply(this, arguments);
4946
5025
  }
4947
5026
  return onChunk;
4948
5027
  }(),
4949
5028
  onComplete: function () {
4950
- var _onComplete = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee4(lastContent) {
4951
- var _args$onComplete, _args6;
5029
+ var _onComplete = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee5(lastContent) {
5030
+ var _args$onComplete, _args10;
4952
5031
  var res;
4953
- return src_regeneratorRuntime().wrap(function _callee4$(_context4) {
4954
- while (1) switch (_context4.prev = _context4.next) {
5032
+ return src_regeneratorRuntime().wrap(function _callee5$(_context5) {
5033
+ while (1) switch (_context5.prev = _context5.next) {
4955
5034
  case 0:
4956
5035
  console.log('--> Stream complete');
4957
- _context4.next = 3;
5036
+ _context5.next = 3;
4958
5037
  return parseChunkData(lastContent, 0, true);
4959
5038
  case 3:
4960
- res = _context4.sent;
5039
+ res = _context5.sent;
4961
5040
  // Display AI reply
4962
5041
  displayMessage(args().answerNameRes, res);
4963
5042
 
4964
5043
  //
4965
- (_args$onComplete = (_args6 = args()).onComplete) === null || _args$onComplete === void 0 ? void 0 : _args$onComplete.call(_args6, inputContentRef.current, res, conversationHistory.current);
5044
+ (_args$onComplete = (_args10 = args()).onComplete) === null || _args$onComplete === void 0 ? void 0 : _args$onComplete.call(_args10, inputContentRef.current, res, conversationHistory.current);
4966
5045
 
4967
5046
  //
4968
5047
  closeSSE();
4969
5048
  case 7:
4970
5049
  case "end":
4971
- return _context4.stop();
5050
+ return _context5.stop();
4972
5051
  }
4973
- }, _callee4);
5052
+ }, _callee5);
4974
5053
  }));
4975
- function onComplete(_x10) {
5054
+ function onComplete(_x11) {
4976
5055
  return _onComplete.apply(this, arguments);
4977
5056
  }
4978
5057
  return onComplete;
@@ -5019,36 +5098,41 @@ var Chatbox = function Chatbox(props) {
5019
5098
  setMsgList(function (prevMessages) {
5020
5099
  return [].concat(_toConsumableArray(prevMessages), [newMessage]);
5021
5100
  });
5101
+
5102
+ // Auto copy reply if enabled
5103
+ if (args().autoCopyReply && sender === args().answerNameRes) {
5104
+ chatboxCopyToClipboard(content);
5105
+ }
5022
5106
  };
5023
5107
  var sendMessage = /*#__PURE__*/function () {
5024
- var _ref3 = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee5() {
5025
- var messageInput, message, inputMsg, res, _args$onChunk2, _args8, _args$onComplete2, _args9, reply, replyRes;
5026
- return src_regeneratorRuntime().wrap(function _callee5$(_context5) {
5027
- while (1) switch (_context5.prev = _context5.next) {
5108
+ var _ref4 = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee6() {
5109
+ var messageInput, message, inputMsg, _res, _args$onChunk2, _args12, _args$onComplete2, _args13, reply, replyRes;
5110
+ return src_regeneratorRuntime().wrap(function _callee6$(_context6) {
5111
+ while (1) switch (_context6.prev = _context6.next) {
5028
5112
  case 0:
5029
5113
  if (!(rootRef.current === null || msgContainerRef.current === null || msInput.current === null)) {
5030
- _context5.next = 2;
5114
+ _context6.next = 2;
5031
5115
  break;
5032
5116
  }
5033
- return _context5.abrupt("return");
5117
+ return _context6.abrupt("return");
5034
5118
  case 2:
5035
5119
  messageInput = msInput.current;
5036
5120
  message = (0,sanitize.htmlEncode)(messageInput.value); // It fires in real time as the user enters
5037
5121
  // Sanitizing input is the process of securing/cleaning/filtering input data.
5038
5122
  if (!(typeof args().onInputCallback === 'function')) {
5039
- _context5.next = 8;
5123
+ _context6.next = 8;
5040
5124
  break;
5041
5125
  }
5042
- _context5.next = 7;
5126
+ _context6.next = 7;
5043
5127
  return args().onInputCallback(message);
5044
5128
  case 7:
5045
- message = _context5.sent;
5129
+ message = _context6.sent;
5046
5130
  case 8:
5047
5131
  if (!(message.trim() === '')) {
5048
- _context5.next = 10;
5132
+ _context6.next = 10;
5049
5133
  break;
5050
5134
  }
5051
- return _context5.abrupt("return");
5135
+ return _context6.abrupt("return");
5052
5136
  case 10:
5053
5137
  // Start the timer
5054
5138
  setElapsedTime(0); // Reset elapsed time
@@ -5061,13 +5145,13 @@ var Chatbox = function Chatbox(props) {
5061
5145
  // user message
5062
5146
  inputMsg = "".concat(message); // If a render parser exists, it is used to process the string
5063
5147
  if (!(typeof args().renderParser === 'function')) {
5064
- _context5.next = 17;
5148
+ _context6.next = 17;
5065
5149
  break;
5066
5150
  }
5067
- _context5.next = 16;
5151
+ _context6.next = 16;
5068
5152
  return args().renderParser(inputMsg);
5069
5153
  case 16:
5070
- inputMsg = _context5.sent;
5154
+ inputMsg = _context6.sent;
5071
5155
  case 17:
5072
5156
  displayMessage(args().questionNameRes, inputMsg); // Display user message
5073
5157
 
@@ -5079,48 +5163,48 @@ var Chatbox = function Chatbox(props) {
5079
5163
 
5080
5164
  // clear
5081
5165
  if (inputContentRef.current) inputContentRef.current.clear();
5082
- _context5.prev = 21;
5083
- _context5.next = 24;
5166
+ _context6.prev = 21;
5167
+ _context6.next = 24;
5084
5168
  return mainRequest(message);
5085
5169
  case 24:
5086
- res = _context5.sent;
5087
- if (res.useStreamRender) {
5088
- _context5.next = 36;
5170
+ _res = _context6.sent;
5171
+ if (_res.useStreamRender) {
5172
+ _context6.next = 36;
5089
5173
  break;
5090
5174
  }
5091
- reply = res.reply;
5175
+ reply = _res.reply;
5092
5176
  replyRes = "".concat(reply); // If a render parser exists, it is used to process the string
5093
5177
  if (!(typeof args().renderParser === 'function')) {
5094
- _context5.next = 32;
5178
+ _context6.next = 32;
5095
5179
  break;
5096
5180
  }
5097
- _context5.next = 31;
5181
+ _context6.next = 31;
5098
5182
  return args().renderParser(replyRes);
5099
5183
  case 31:
5100
- replyRes = _context5.sent;
5184
+ replyRes = _context6.sent;
5101
5185
  case 32:
5102
5186
  displayMessage(args().answerNameRes, replyRes); // Display AI reply
5103
5187
 
5104
5188
  //
5105
- (_args$onChunk2 = (_args8 = args()).onChunk) === null || _args$onChunk2 === void 0 ? void 0 : _args$onChunk2.call(_args8, inputContentRef.current, replyRes, conversationHistory.current);
5106
- (_args$onComplete2 = (_args9 = args()).onComplete) === null || _args$onComplete2 === void 0 ? void 0 : _args$onComplete2.call(_args9, inputContentRef.current, replyRes, conversationHistory.current);
5189
+ (_args$onChunk2 = (_args12 = args()).onChunk) === null || _args$onChunk2 === void 0 ? void 0 : _args$onChunk2.call(_args12, inputContentRef.current, replyRes, conversationHistory.current);
5190
+ (_args$onComplete2 = (_args13 = args()).onComplete) === null || _args$onComplete2 === void 0 ? void 0 : _args$onComplete2.call(_args13, inputContentRef.current, replyRes, conversationHistory.current);
5107
5191
 
5108
5192
  //reset SSE
5109
5193
  closeSSE();
5110
5194
  case 36:
5111
- _context5.next = 45;
5195
+ _context6.next = 45;
5112
5196
  break;
5113
5197
  case 38:
5114
- _context5.prev = 38;
5115
- _context5.t0 = _context5["catch"](21);
5198
+ _context6.prev = 38;
5199
+ _context6.t0 = _context6["catch"](21);
5116
5200
  // loading
5117
5201
  setLoading(false);
5118
5202
 
5119
5203
  // Stop the timer
5120
5204
  clearInterval(timer.current);
5121
5205
  timer.current = null;
5122
- console.error('--> Error sending message:', _context5.t0);
5123
- displayMessage(args().answerNameRes, "Error: Unable to send message: ".concat(String(_context5.t0))); // Display AI reply
5206
+ console.error('--> Error sending message:', _context6.t0);
5207
+ displayMessage(args().answerNameRes, "Error: Unable to send message: ".concat(String(_context6.t0))); // Display AI reply
5124
5208
  case 45:
5125
5209
  // clear
5126
5210
  messageInput.value = '';
@@ -5132,12 +5216,12 @@ var Chatbox = function Chatbox(props) {
5132
5216
  scrollToBottom();
5133
5217
  case 48:
5134
5218
  case "end":
5135
- return _context5.stop();
5219
+ return _context6.stop();
5136
5220
  }
5137
- }, _callee5, null, [[21, 38]]);
5221
+ }, _callee6, null, [[21, 38]]);
5138
5222
  }));
5139
5223
  return function sendMessage() {
5140
- return _ref3.apply(this, arguments);
5224
+ return _ref4.apply(this, arguments);
5141
5225
  };
5142
5226
  }();
5143
5227
  var handleClickSafe = useDebounce_default()(function () {
@@ -5149,25 +5233,25 @@ var Chatbox = function Chatbox(props) {
5149
5233
  setShow(false);
5150
5234
  };
5151
5235
  var mainRequest = /*#__PURE__*/function () {
5152
- var _ref4 = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee6(msg) {
5236
+ var _ref5 = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee7(msg) {
5153
5237
  var currentStreamMode, requestBodyRes, customResponse, content, isStream, contentRes, response, _errInfo, _args$responseExtract2, extractPath, _response, _errInfo2, jsonResponse, result, _iterator3, _step3, path, _content2, _err;
5154
- return src_regeneratorRuntime().wrap(function _callee6$(_context6) {
5155
- while (1) switch (_context6.prev = _context6.next) {
5238
+ return src_regeneratorRuntime().wrap(function _callee7$(_context7) {
5239
+ while (1) switch (_context7.prev = _context7.next) {
5156
5240
  case 0:
5157
5241
  currentStreamMode = args().isStream; // Update stream mode
5158
5242
  setEnableStreamMode(currentStreamMode);
5159
- _context6.prev = 2;
5243
+ _context7.prev = 2;
5160
5244
  // Parse and interpolate request body template
5161
5245
  requestBodyRes = JSON.parse((args().requestBodyTmpl || '{}').replace(/\{model\}/g, args().model).replace(/\{message\}/g, msg).replace(/\{token\}/g, chatId)); //
5162
5246
  // If a formatter function exists, it is used to process the request body
5163
5247
  if (!(typeof args().requestBodyFormatter === 'function')) {
5164
- _context6.next = 8;
5248
+ _context7.next = 8;
5165
5249
  break;
5166
5250
  }
5167
- _context6.next = 7;
5251
+ _context7.next = 7;
5168
5252
  return args().requestBodyFormatter(requestBodyRes, args().latestContextData, conversationHistory.current);
5169
5253
  case 7:
5170
- requestBodyRes = _context6.sent;
5254
+ requestBodyRes = _context7.sent;
5171
5255
  case 8:
5172
5256
  // Scroll to the bottom
5173
5257
  setTimeout(function () {
@@ -5175,19 +5259,19 @@ var Chatbox = function Chatbox(props) {
5175
5259
  scrollToBottom();
5176
5260
  }, 500);
5177
5261
  if (!(typeof args().customRequest === 'function')) {
5178
- _context6.next = 25;
5262
+ _context7.next = 25;
5179
5263
  break;
5180
5264
  }
5181
5265
  // Update stream mode
5182
5266
  setEnableStreamMode(false);
5183
- _context6.next = 13;
5267
+ _context7.next = 13;
5184
5268
  return args().customRequest(msg, {
5185
5269
  requestBody: requestBodyRes,
5186
5270
  apiUrl: args().requestApiUrl || '',
5187
5271
  headers: args().headerConfigRes
5188
5272
  });
5189
5273
  case 13:
5190
- customResponse = _context6.sent;
5274
+ customResponse = _context7.sent;
5191
5275
  content = customResponse.content, isStream = customResponse.isStream;
5192
5276
  contentRes = content; // Update stream mode
5193
5277
  setEnableStreamMode(isStream);
@@ -5195,24 +5279,24 @@ var Chatbox = function Chatbox(props) {
5195
5279
  // NORMAL
5196
5280
  //++++++++++++++++++++++++++++++++++++++++++++++++
5197
5281
  if (!(!isStream && typeof contentRes === 'string' && contentRes.trim() !== '')) {
5198
- _context6.next = 20;
5282
+ _context7.next = 20;
5199
5283
  break;
5200
5284
  }
5201
5285
  // Replace with a valid label
5202
5286
  contentRes = fixHtmlTags(contentRes, args().withReasoning, args().reasoningSwitchLabel);
5203
- return _context6.abrupt("return", {
5287
+ return _context7.abrupt("return", {
5204
5288
  reply: formatLatestDisplayContent(contentRes),
5205
5289
  useStreamRender: false
5206
5290
  });
5207
5291
  case 20:
5208
5292
  if (!(isStream && isStreamResponse(contentRes))) {
5209
- _context6.next = 24;
5293
+ _context7.next = 24;
5210
5294
  break;
5211
5295
  }
5212
- _context6.next = 23;
5296
+ _context7.next = 23;
5213
5297
  return streamController.start(contentRes);
5214
5298
  case 23:
5215
- return _context6.abrupt("return", {
5299
+ return _context7.abrupt("return", {
5216
5300
  reply: tempAnimText,
5217
5301
  // The final content will be in tempAnimText
5218
5302
  useStreamRender: true
@@ -5226,19 +5310,19 @@ var Chatbox = function Chatbox(props) {
5226
5310
  }
5227
5311
  case 25:
5228
5312
  if (!currentStreamMode) {
5229
- _context6.next = 39;
5313
+ _context7.next = 39;
5230
5314
  break;
5231
5315
  }
5232
- _context6.next = 28;
5316
+ _context7.next = 28;
5233
5317
  return fetch(args().requestApiUrl || '', {
5234
5318
  method: "POST",
5235
5319
  body: JSON.stringify(requestBodyRes),
5236
5320
  headers: args().headerConfigRes
5237
5321
  });
5238
5322
  case 28:
5239
- response = _context6.sent;
5323
+ response = _context7.sent;
5240
5324
  if (response.ok) {
5241
- _context6.next = 34;
5325
+ _context7.next = 34;
5242
5326
  break;
5243
5327
  }
5244
5328
  _errInfo = "[ERROR] HTTP Error ".concat(response.status, ": ").concat(response.statusText);
@@ -5246,15 +5330,15 @@ var Chatbox = function Chatbox(props) {
5246
5330
 
5247
5331
  // hide loader
5248
5332
  setLoaderDisplay(false);
5249
- return _context6.abrupt("return", {
5333
+ return _context7.abrupt("return", {
5250
5334
  reply: _errInfo,
5251
5335
  useStreamRender: false
5252
5336
  });
5253
5337
  case 34:
5254
- _context6.next = 36;
5338
+ _context7.next = 36;
5255
5339
  return streamController.start(response);
5256
5340
  case 36:
5257
- return _context6.abrupt("return", {
5341
+ return _context7.abrupt("return", {
5258
5342
  reply: tempAnimText,
5259
5343
  // The final content will be in tempAnimText
5260
5344
  useStreamRender: true
@@ -5262,7 +5346,7 @@ var Chatbox = function Chatbox(props) {
5262
5346
  case 39:
5263
5347
  // Extract response using the path
5264
5348
  extractPath = (_args$responseExtract2 = args().responseExtractPath) === null || _args$responseExtract2 === void 0 ? void 0 : _args$responseExtract2.slice(1);
5265
- _context6.next = 42;
5349
+ _context7.next = 42;
5266
5350
  return fetch(args().requestApiUrl || '', {
5267
5351
  method: "POST",
5268
5352
  headers: args().headerConfigRes,
@@ -5270,22 +5354,22 @@ var Chatbox = function Chatbox(props) {
5270
5354
  signal: abortController.current.signal
5271
5355
  });
5272
5356
  case 42:
5273
- _response = _context6.sent;
5357
+ _response = _context7.sent;
5274
5358
  if (_response.ok) {
5275
- _context6.next = 47;
5359
+ _context7.next = 47;
5276
5360
  break;
5277
5361
  }
5278
5362
  _errInfo2 = "[ERROR] HTTP Error ".concat(_response.status, ": ").concat(_response.statusText); // hide loader
5279
5363
  setLoaderDisplay(false);
5280
- return _context6.abrupt("return", {
5364
+ return _context7.abrupt("return", {
5281
5365
  reply: _errInfo2,
5282
5366
  useStreamRender: false
5283
5367
  });
5284
5368
  case 47:
5285
- _context6.next = 49;
5369
+ _context7.next = 49;
5286
5370
  return _response.json();
5287
5371
  case 49:
5288
- jsonResponse = _context6.sent;
5372
+ jsonResponse = _context7.sent;
5289
5373
  // hide loader
5290
5374
  setLoaderDisplay(false);
5291
5375
  result = jsonResponse;
@@ -5304,33 +5388,33 @@ var Chatbox = function Chatbox(props) {
5304
5388
  }
5305
5389
  _content2 = result; // Replace with a valid label
5306
5390
  _content2 = fixHtmlTags(_content2, args().withReasoning, args().reasoningSwitchLabel);
5307
- return _context6.abrupt("return", {
5391
+ return _context7.abrupt("return", {
5308
5392
  reply: formatLatestDisplayContent(_content2),
5309
5393
  useStreamRender: false
5310
5394
  });
5311
5395
  case 56:
5312
- _context6.next = 64;
5396
+ _context7.next = 64;
5313
5397
  break;
5314
5398
  case 58:
5315
- _context6.prev = 58;
5316
- _context6.t0 = _context6["catch"](2);
5317
- _err = "--> Error in mainRequest: ".concat(_context6.t0);
5399
+ _context7.prev = 58;
5400
+ _context7.t0 = _context7["catch"](2);
5401
+ _err = "--> Error in mainRequest: ".concat(_context7.t0);
5318
5402
  console.error(_err);
5319
5403
 
5320
5404
  //reset SSE
5321
5405
  closeSSE();
5322
- return _context6.abrupt("return", {
5406
+ return _context7.abrupt("return", {
5323
5407
  reply: _err,
5324
5408
  useStreamRender: false
5325
5409
  });
5326
5410
  case 64:
5327
5411
  case "end":
5328
- return _context6.stop();
5412
+ return _context7.stop();
5329
5413
  }
5330
- }, _callee6, null, [[2, 58]]);
5414
+ }, _callee7, null, [[2, 58]]);
5331
5415
  }));
5332
- return function mainRequest(_x11) {
5333
- return _ref4.apply(this, arguments);
5416
+ return function mainRequest(_x12) {
5417
+ return _ref5.apply(this, arguments);
5334
5418
  };
5335
5419
  }();
5336
5420
 
@@ -5363,6 +5447,10 @@ var Chatbox = function Chatbox(props) {
5363
5447
  setMsgList(props.defaultMessages);
5364
5448
  }
5365
5449
  }, [props.defaultMessages]);
5450
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
5451
+ // Bind chatboxCopyToClipboard to window so it can be called in HTML code
5452
+ window.chatboxCopyToClipboard = chatboxCopyToClipboard;
5453
+ }, []);
5366
5454
  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()), {
5367
5455
  show: true,
5368
5456
  containerClassName: "Chatbox"
@@ -5451,15 +5539,17 @@ var Chatbox = function Chatbox(props) {
5451
5539
  className: "messages",
5452
5540
  ref: msgContainerRef
5453
5541
  }, msgList.map(function (msg, index) {
5454
- var _msg$tag;
5542
+ var _msg$tag, _msg$tag2;
5543
+ var copyTargetId = "".concat(args().prefix || 'custom-', "chatbox-content--").concat(chatId).concat(index);
5455
5544
  var isAnimProgress = tempAnimText !== '' && msg.sender !== args().questionNameRes && index === msgList.length - 1 && loading;
5456
5545
  var hasAnimated = animatedMessagesRef.current.has(index);
5457
5546
 
5458
5547
  // Mark the message as animated;
5459
5548
  animatedMessagesRef.current.add(index);
5549
+ var timeShow = "<span class=\"qa-timestamp\">".concat(msg.timestamp, "</span>").concat(args().showCopyBtn && ((_msg$tag = msg.tag) === null || _msg$tag === void 0 ? void 0 : _msg$tag.indexOf('[reply]')) >= 0 ? "<button class=\"copy-btn\" onclick=\"window.chatboxCopyToClipboard(document.querySelector('#".concat(copyTargetId, " .qa-content-inner').innerHTML)\"><svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><path d=\"M8 4v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7.242a2 2 0 0 0-.602-1.43L16.083 2.57A2 2 0 0 0 14.685 2H10a2 2 0 0 0-2 2z\"/><path d=\"M16 18v2a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h2\"/></svg></button>") : '');
5460
5550
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
5461
5551
  key: index,
5462
- className: ((_msg$tag = msg.tag) === null || _msg$tag === void 0 ? void 0 : _msg$tag.indexOf('[reply]')) < 0 ? 'request' : 'reply',
5552
+ className: ((_msg$tag2 = msg.tag) === null || _msg$tag2 === void 0 ? void 0 : _msg$tag2.indexOf('[reply]')) < 0 ? 'request' : 'reply',
5463
5553
  style: {
5464
5554
  display: isAnimProgress ? 'none' : ''
5465
5555
  }
@@ -5470,25 +5560,28 @@ var Chatbox = function Chatbox(props) {
5470
5560
  }
5471
5561
  }), msg.sender === args().questionNameRes ? /*#__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", {
5472
5562
  className: "qa-content",
5563
+ id: copyTargetId,
5473
5564
  dangerouslySetInnerHTML: {
5474
- __html: "".concat(msg.content, " <span class=\"qa-timestamp\">").concat(msg.timestamp, "</span>")
5565
+ __html: "<div class=\"qa-content-inner\">".concat(msg.content, "</div> ").concat(timeShow)
5475
5566
  }
5476
5567
  })) : /*#__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", {
5477
5568
  className: "qa-content",
5569
+ id: copyTargetId,
5478
5570
  dangerouslySetInnerHTML: {
5479
- __html: "".concat(msg.content, " <span class=\"qa-timestamp\">").concat(msg.timestamp, "</span>")
5571
+ __html: "<div class=\"qa-content-inner\">".concat(msg.content, "</div> ").concat(timeShow)
5480
5572
  }
5481
5573
  })) : /*#__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", {
5482
- className: "qa-content"
5574
+ className: "qa-content",
5575
+ id: copyTargetId
5483
5576
  }, hasAnimated ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
5484
5577
  dangerouslySetInnerHTML: {
5485
- __html: "".concat(msg.content, " <span class=\"qa-timestamp\">").concat(msg.timestamp, "</span>")
5578
+ __html: "<div class=\"qa-content-inner\">".concat(msg.content, "</div> ").concat(timeShow)
5486
5579
  }
5487
5580
  }) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(src_TypingEffect, {
5488
5581
  onUpdate: function onUpdate() {
5489
5582
  scrollToBottom();
5490
5583
  },
5491
- content: "".concat(msg.content, " <span class=\"qa-timestamp\">").concat(msg.timestamp, "</span>"),
5584
+ content: "<div class=\"qa-content-inner\">".concat(msg.content, "</div> ").concat(timeShow),
5492
5585
  speed: 10
5493
5586
  })))));
5494
5587
  }), 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", {
@@ -5554,7 +5647,7 @@ var Chatbox = function Chatbox(props) {
5554
5647
  dangerouslySetInnerHTML: {
5555
5648
  __html: "".concat(tempAnimText)
5556
5649
  }
5557
- }))) : null)) : null) : null, args().newChatButton && msgList.length > 0 && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
5650
+ }))) : null)) : null) : null, args().newChatButton && msgList.length > 0 && !loading && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
5558
5651
  className: "newchat-btn"
5559
5652
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
5560
5653
  id: "".concat(args().prefix || 'custom-', "chatbox-btn-new-").concat(chatId),
@@ -5585,8 +5678,8 @@ var Chatbox = function Chatbox(props) {
5585
5678
  }
5586
5679
  },
5587
5680
  onChange: function onChange(e) {
5588
- var _args$onInputChange, _args12;
5589
- (_args$onInputChange = (_args12 = args()).onInputChange) === null || _args$onInputChange === void 0 ? void 0 : _args$onInputChange.call(_args12, inputContentRef.current, e.target.value);
5681
+ var _args$onInputChange, _args16;
5682
+ (_args$onInputChange = (_args16 = args()).onInputChange) === null || _args$onInputChange === void 0 ? void 0 : _args$onInputChange.call(_args16, inputContentRef.current, e.target.value);
5590
5683
  },
5591
5684
  rows: args().defaultRows || 3,
5592
5685
  autoSize: true,