UNPKG

10xanswers

Version:

A fully customizable, draggable chatbot component built with React and Recoil for your next project.

1,180 lines (1,177 loc) 396 kB
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(`#root{--chat-background: #202020;--heading-color: #ffeaea;--color: #2e2e2e;--chat-text-color: #ffffff;--chat-gradient: linear-gradient(294deg, rgb(44 44 44 / 85%) 0%, rgb(47 47 47) 100%);--chat-gradient: linear-gradient(294deg, rgb(44 44 44 / 75%) 0%, rgb(47 47 47 / 21%) 100%);--chat-gradient: linear-gradient(180deg, rgba(96, 165, 250, .244) 0%, rgba(29, 79, 216, .283) 100%);--chat-gradient: linear-gradient(180deg, rgb(55 105 166 / 24%) 0%, rgb(53 50 74 / 18%) 100%);--chat-input-option-color: #d6d6d6;--chat-input-option-color-hover: #a7a7a7;--chat-input-option-background: #414141;--textarea-border: #4c4c4c;--textarea-background: #2c2c2c;--search-icon-color: #fff;--search-icon-bg: #2ea61d;--search-icon-bg-hover: #2c911f;--search-icon-bg-disabled: #2c911f4d;--input-option-bg: #2c2c2c;--input-option-color: #ffffff;--input-option-icon-bg: #f2f2f2;--input-option-icon-color: #3a3a3a;--skeleton-icon-gradient: linear-gradient(transparent 50%, rgb(39, 49, 63) 50%) 0% 0% / 18px 144px, linear-gradient(rgb(143, 168, 138), rgba(15, 170, 24, .39)) 0% 0% / 100% 44px;--skeleton-text-gradient: linear-gradient(transparent 50%, rgb(39, 49, 63) 50%) 0% 0% / 18px 20px, linear-gradient(rgb(143, 168, 138), rgba(15, 170, 24, .39)) 0% 0% / 100% 30px}.chat-section{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;box-sizing:border-box;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;border-radius:1.8rem;padding:.6rem;background-color:#fff;background-color:var(--chat-background);display:flex;align-items:center;justify-content:center;flex-direction:column;justify-content:flex-end;position:relative;width:100%;height:100%;min-width:270px;min-height:300px;z-index:9998}.chat-and-icon-container{display:flex;flex-direction:column;align-items:flex-end;justify-content:flex-end;height:630px;width:350px;max-width:600px;gap:.8rem;position:fixed;right:4px;bottom:4px}.chatbot-open-icon{border-radius:100%;width:3.8rem;aspect-ratio:1/1;background-size:cover;background-position:center;cursor:pointer;background-color:var(--textarea-background);display:flex;align-items:center;justify-content:center;font-size:2rem}.chatbot-open-icon span{background:linear-gradient(to bottom right,#f4f4f4,#d6d6d6d4);-webkit-background-clip:text;-webkit-text-fill-color:transparent}.chatbot-open-icon:hover{cursor:pointer;filter:grayscale(.2);transition-duration:.2s;transform:rotate(2deg)}.collapse{width:0;height:0;transition-duration:4s}.prompt-input{display:flex;flex-grow:1;height:5rem;border-radius:1.6rem;font-size:1rem;background-color:var(--textarea-background);padding:1rem;resize:none;color:var(--chat-input-option-color);border:none;font-family:inherit}.search-icon{position:absolute;width:2rem;height:2rem;border-radius:100%;background-color:#2e2e2e;background-color:var(--search-icon-bg);color:var(--search-icon-color);font-size:1rem;display:flex;justify-content:center;align-items:center;right:0;top:0;cursor:pointer;margin:.8rem}.disabled{opacity:.2;cursor:not-allowed}.search-icon:hover{background-color:var(--search-icon-bg-hover)}.prompt-input:focus-visible{outline:none}.input-area{width:100%;display:flex;flex-direction:column;border-radius:1.6rem;border:2px solid var(--textarea-border);background-color:var(--chat-input-option-background);position:relative;margin:.8rem 0 0}.input-options{background-color:#f2f2f2;background-color:var(--chat-input-option-background);border-radius:1.6rem;flex-grow:1;display:flex;align-items:center}.input-option{display:flex;align-items:center;gap:6px;border-radius:10rem;background-color:#fff;background-color:var(--textarea-background);color:#828181;color:#2e2e2e;color:var(--chat-text-color);font-size:.7rem;font-weight:500;padding:.3rem .6rem .3rem .3rem;margin:.4rem 0rem .4rem .4rem;cursor:pointer}.option-description{margin:0}.input-option-icon{padding:.4rem;width:8px;height:8px;background-color:#f2f2f2;background-color:var(--input-option-icon-bg);color:#3a3a3a;color:var(--input-option-icon-color);border-radius:100%;display:flex;align-items:center;justify-content:center;font-size:.8rem}.chat-area{flex-grow:1;height:100%;display:flex;flex-direction:column;overflow-y:scroll;padding:4rem 0;border-radius:1.6rem;width:100%;scroll-behavior:smooth;align-items:center;overflow-x:hidden;text-align:center;z-index:998;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.2) transparent}.chat-area::-webkit-scrollbar{width:8px;height:8px}.chat-area::-webkit-scrollbar-track{background:transparent}.chat-area::-webkit-scrollbar-thumb{background:#fff3;border-radius:10px;-webkit-transition:background .3s ease-in-out;transition:background .3s ease-in-out}.chat-area::-webkit-scrollbar-thumb:hover{background:#fff6}.chat-component-heading{box-sizing:border-box;position:absolute;top:0;color:var(--heading-color);margin:0;width:100%;border-top-left-radius:inherit;border-top-right-radius:inherit;padding:.8rem 2rem;display:flex;justify-content:space-between;z-index:9999;background:var(--text);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.chat-component-heading h3{margin:0;font-size:1rem;display:flex;gap:10px;align-items:center}.chat{background-color:#f0faf9;padding:.8rem;display:flex;gap:.5rem;border-radius:1.6rem;background:#f0faf9;background:linear-gradient(294deg,#f0faf9d8,#e7fffd);background:var(--chat-gradient);flex-grow:1;width:100%}.user-icon img{border-radius:100%;width:2.6rem;aspect-ratio:1/1;-o-object-fit:cover;object-fit:cover}.chat-and-options{margin:0;display:flex;flex-direction:column;width:100%}.chat-content{margin:0;font-size:.875rem;text-align:left;line-height:140%;padding:0 .5rem;color:#3f3f3f;color:var(--chat-text-color);font-family:sans-serif}.chat-options{display:flex;align-items:center;justify-content:flex-end;gap:8px;margin-top:.8rem}.chat-option{font-size:.7rem;display:flex;gap:4px;color:#2e2e2e;color:var(--chat-input-option-color);background-color:#fff;background-color:var(--chat-input-option-background);border-radius:.4rem;padding:.2rem .6rem;cursor:pointer}.chat-option:hover{color:#a7a7a7;color:var(--chat-input-option-color-hover)}.question-container{padding:1rem .8rem;background:transparent;display:flex;flex-direction:column;flex-grow:1;width:100%}.question{display:flex;gap:.5rem;align-items:center;width:100%}.bot-icon img{border-radius:100%;width:2.6rem;aspect-ratio:1/1;-o-object-fit:cover;object-fit:cover}.question-txt{margin:0;font-size:.875rem;text-align:left;line-height:140%;padding:0 .5rem;color:#3f3f3f;color:var(--chat-text-color);font-family:sans-serif}.edit-icon{font-weight:400;cursor:pointer;font-size:.7rem;padding:.2rem .6rem;border-radius:.4rem;background-color:var(--chat-input-option-background)}.edit-options{justify-content:flex-start;margin-left:3.2rem}.editing{background:var(--textarea-background);padding:.8rem;border-radius:1.6rem;flex-grow:1}.hero-section{margin-bottom:2rem;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:10px;cursor:crosshair;width:100%}.floating-icons{position:relative}.icon{padding:.1rem .6rem;background:var(--chat-gradient);border-radius:.6rem;filter:drop-shadow(0 10px 60px #45df09);box-shadow:0 60px 50px #45df09;box-shadow:0 10px 60px #68de44;box-shadow:0 10px 30px -10px #00000080,inset 0 0 0 1px #fff3;background:linear-gradient(to bottom right,#84e14e,transparent);position:absolute;z-index:0}.forward{font-size:2.25rem}.backward{font-size:1.5rem;padding:.3rem .6rem;box-shadow:0 10px 60px #68de44}.forward-first{left:-225px;top:130px;transform:rotate(-13deg);background:linear-gradient(to bottom right,#0078fc,#193fb4)}.forward-second{left:-210px;top:0;transform:rotate(347deg);filter:blur(1.1px);font-size:1rem;padding:.4rem .6rem;background:linear-gradient(to bottom right,#9370db,#1b00bccf);box-shadow:0 10px 60px #3e219f}.backward-first{transform:rotate(13deg);transform:rotate(349deg);filter:blur(.8px);font-size:1.5rem;left:180px;top:110px;background:#e78400;background:linear-gradient(to bottom right,#e78400,#e99c49b0);padding:.2rem .6rem;box-shadow:0 10px 60px #937d02ed}.backward-second{left:80px;top:-30px;transform:rotate(12deg);filter:blur(1px);font-size:1rem;padding:.4rem .6rem}.hero-title,.hero-sub-title,.hero-description,.hero-sup-title{line-height:normal;margin:0}.hero-title{font-size:2.4rem}.stylize{background:linear-gradient(180deg,#e4eaf20a,#007f0f0f);border-radius:.6rem;padding:.1rem .4rem;font-weight:800;margin:.1rem;box-shadow:0 3px #78c94a}.hero-sub-title{font-size:1.2rem;max-width:400px;font-weight:400;width:80%}.hero-description{font-size:.9rem;margin:0rem;font-weight:500}.hero-sub-title,.hero-description,.hero-sup-title{color:#f9fafbe6;background-image:linear-gradient(0deg,#f9fafbe6 28%,#f9fafb99 67%);background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent}.hero-sup-title{font-size:.8rem;margin:0}@keyframes loading{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}.skeleton{transition:opacity .5s,height 2s;animation:loading 2s infinite}.icon-placeholder{background:var(--skeleton-icon-gradient);border-radius:100%;width:2.6rem;aspect-ratio:1 / 1}.text-placeholder{background:var(--skeleton-text-gradient);height:7rem;border-radius:.6rem;flex-grow:1}pre{border-radius:.8rem;overflow-x:auto}pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*! Theme: GitHub Dark Description: Dark theme as seen on github.com Author: github.com Maintainer: @Hirse Updated: 2021-05-15 Outdated base version: https://github.com/primer/github-syntax-dark Current colors taken from GitHub's CSS */.hljs{color:#c9d1d9;background:#0d1117}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#ff7b72}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#d2a8ff}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-variable,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id{color:#79c0ff}.hljs-regexp,.hljs-string,.hljs-meta .hljs-string{color:#a5d6ff}.hljs-built_in,.hljs-symbol{color:#ffa657}.hljs-comment,.hljs-code,.hljs-formula{color:#8b949e}.hljs-name,.hljs-quote,.hljs-selector-tag,.hljs-selector-pseudo{color:#7ee787}.hljs-subst{color:#c9d1d9}.hljs-section{color:#1f6feb;font-weight:700}.hljs-bullet{color:#f2cc60}.hljs-emphasis{color:#c9d1d9;font-style:italic}.hljs-strong{color:#c9d1d9;font-weight:700}.hljs-addition{color:#aff5b4;background-color:#033a16}.hljs-deletion{color:#ffdcd7;background-color:#67060c}`)),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})(); import Zn, { useRef as Me, useState as Vn, useEffect as et } from "react"; import { atomFamily as jn, atom as Zt, useSetRecoilState as Xn, useRecoilState as at, useRecoilValue as kt, selectorFamily as _i, useRecoilStateLoadable as Ei, RecoilRoot as yi } from "recoil"; import { v4 as Je } from "uuid"; import wi from "react-markdown"; import { Rnd as Ni } from "react-rnd"; function vi(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } var Ht = { exports: {} }, Xe = {}; /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var bn; function ki() { if (bn) return Xe; bn = 1; var e = Zn, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, a = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, c = { key: !0, ref: !0, __self: !0, __source: !0 }; function i(s, o, l) { var d, u = {}, f = null, b = null; l !== void 0 && (f = "" + l), o.key !== void 0 && (f = "" + o.key), o.ref !== void 0 && (b = o.ref); for (d in o) r.call(o, d) && !c.hasOwnProperty(d) && (u[d] = o[d]); if (s && s.defaultProps) for (d in o = s.defaultProps, o) u[d] === void 0 && (u[d] = o[d]); return { $$typeof: t, type: s, key: f, ref: b, props: u, _owner: a.current }; } return Xe.Fragment = n, Xe.jsx = i, Xe.jsxs = i, Xe; } var Qe = {}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var mn; function Si() { return mn || (mn = 1, process.env.NODE_ENV !== "production" && function() { var e = Zn, t = Symbol.for("react.element"), n = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), c = Symbol.for("react.profiler"), i = Symbol.for("react.provider"), s = Symbol.for("react.context"), o = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), u = Symbol.for("react.memo"), f = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), p = Symbol.iterator, h = "@@iterator"; function _(g) { if (g === null || typeof g != "object") return null; var N = p && g[p] || g[h]; return typeof N == "function" ? N : null; } var y = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function v(g) { { for (var N = arguments.length, x = new Array(N > 1 ? N - 1 : 0), D = 1; D < N; D++) x[D - 1] = arguments[D]; T("error", g, x); } } function T(g, N, x) { { var D = y.ReactDebugCurrentFrame, W = D.getStackAddendum(); W !== "" && (N += "%s", x = x.concat([W])); var X = x.map(function($) { return String($); }); X.unshift("Warning: " + N), Function.prototype.apply.call(console[g], console, X); } } var A = !1, M = !1, O = !1, B = !1, j = !1, Z; Z = Symbol.for("react.module.reference"); function m(g) { return !!(typeof g == "string" || typeof g == "function" || g === r || g === c || j || g === a || g === l || g === d || B || g === b || A || M || O || typeof g == "object" && g !== null && (g.$$typeof === f || g.$$typeof === u || g.$$typeof === i || g.$$typeof === s || g.$$typeof === o || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. g.$$typeof === Z || g.getModuleId !== void 0)); } function ne(g, N, x) { var D = g.displayName; if (D) return D; var W = N.displayName || N.name || ""; return W !== "" ? x + "(" + W + ")" : x; } function se(g) { return g.displayName || "Context"; } function K(g) { if (g == null) return null; if (typeof g.tag == "number" && v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof g == "function") return g.displayName || g.name || null; if (typeof g == "string") return g; switch (g) { case r: return "Fragment"; case n: return "Portal"; case c: return "Profiler"; case a: return "StrictMode"; case l: return "Suspense"; case d: return "SuspenseList"; } if (typeof g == "object") switch (g.$$typeof) { case s: var N = g; return se(N) + ".Consumer"; case i: var x = g; return se(x._context) + ".Provider"; case o: return ne(g, g.render, "ForwardRef"); case u: var D = g.displayName || null; return D !== null ? D : K(g.type) || "Memo"; case f: { var W = g, X = W._payload, $ = W._init; try { return K($(X)); } catch { return null; } } } return null; } var G = Object.assign, Q = 0, pe, w, k, C, L, F, H; function re() { } re.__reactDisabledLog = !0; function Se() { { if (Q === 0) { pe = console.log, w = console.info, k = console.warn, C = console.error, L = console.group, F = console.groupCollapsed, H = console.groupEnd; var g = { configurable: !0, enumerable: !0, value: re, writable: !0 }; Object.defineProperties(console, { info: g, log: g, warn: g, error: g, group: g, groupCollapsed: g, groupEnd: g }); } Q++; } } function ae() { { if (Q--, Q === 0) { var g = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: G({}, g, { value: pe }), info: G({}, g, { value: w }), warn: G({}, g, { value: k }), error: G({}, g, { value: C }), group: G({}, g, { value: L }), groupCollapsed: G({}, g, { value: F }), groupEnd: G({}, g, { value: H }) }); } Q < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var ce = y.ReactCurrentDispatcher, Te; function _e(g, N, x) { { if (Te === void 0) try { throw Error(); } catch (W) { var D = W.stack.trim().match(/\n( *(at )?)/); Te = D && D[1] || ""; } return ` ` + Te + g; } } var xe = !1, Ae; { var je = typeof WeakMap == "function" ? WeakMap : Map; Ae = new je(); } function Be(g, N) { if (!g || xe) return ""; { var x = Ae.get(g); if (x !== void 0) return x; } var D; xe = !0; var W = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var X; X = ce.current, ce.current = null, Se(); try { if (N) { var $ = function() { throw Error(); }; if (Object.defineProperty($.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct($, []); } catch (ue) { D = ue; } Reflect.construct(g, [], $); } else { try { $.call(); } catch (ue) { D = ue; } g.call($.prototype); } } else { try { throw Error(); } catch (ue) { D = ue; } g(); } } catch (ue) { if (ue && D && typeof ue.stack == "string") { for (var U = ue.stack.split(` `), le = D.stack.split(` `), J = U.length - 1, te = le.length - 1; J >= 1 && te >= 0 && U[J] !== le[te]; ) te--; for (; J >= 1 && te >= 0; J--, te--) if (U[J] !== le[te]) { if (J !== 1 || te !== 1) do if (J--, te--, te < 0 || U[J] !== le[te]) { var be = ` ` + U[J].replace(" at new ", " at "); return g.displayName && be.includes("<anonymous>") && (be = be.replace("<anonymous>", g.displayName)), typeof g == "function" && Ae.set(g, be), be; } while (J >= 1 && te >= 0); break; } } } finally { xe = !1, ce.current = X, ae(), Error.prepareStackTrace = W; } var Ge = g ? g.displayName || g.name : "", Oe = Ge ? _e(Ge) : ""; return typeof g == "function" && Ae.set(g, Oe), Oe; } function q(g, N, x) { return Be(g, !1); } function me(g) { var N = g.prototype; return !!(N && N.isReactComponent); } function fe(g, N, x) { if (g == null) return ""; if (typeof g == "function") return Be(g, me(g)); if (typeof g == "string") return _e(g); switch (g) { case l: return _e("Suspense"); case d: return _e("SuspenseList"); } if (typeof g == "object") switch (g.$$typeof) { case o: return q(g.render); case u: return fe(g.type, N, x); case f: { var D = g, W = D._payload, X = D._init; try { return fe(X(W), N, x); } catch { } } } return ""; } var oe = Object.prototype.hasOwnProperty, lt = {}, Fe = y.ReactDebugCurrentFrame; function I(g) { if (g) { var N = g._owner, x = fe(g.type, g._source, N ? N.type : null); Fe.setExtraStackFrame(x); } else Fe.setExtraStackFrame(null); } function ut(g, N, x, D, W) { { var X = Function.call.bind(oe); for (var $ in g) if (X(g, $)) { var U = void 0; try { if (typeof g[$] != "function") { var le = Error((D || "React class") + ": " + x + " type `" + $ + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof g[$] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw le.name = "Invariant Violation", le; } U = g[$](N, $, D, x, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (J) { U = J; } U && !(U instanceof Error) && (I(W), v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", D || "React class", x, $, typeof U), I(null)), U instanceof Error && !(U.message in lt) && (lt[U.message] = !0, I(W), v("Failed %s type: %s", x, U.message), I(null)); } } } var ie = Array.isArray; function Y(g) { return ie(g); } function Ue(g) { { var N = typeof Symbol == "function" && Symbol.toStringTag, x = N && g[Symbol.toStringTag] || g.constructor.name || "Object"; return x; } } function ye(g) { try { return $e(g), !1; } catch { return !0; } } function $e(g) { return "" + g; } function ze(g) { if (ye(g)) return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ue(g)), $e(g); } var S = y.ReactCurrentOwner, R = { key: !0, ref: !0, __self: !0, __source: !0 }, P, z, ee; ee = {}; function he(g) { if (oe.call(g, "ref")) { var N = Object.getOwnPropertyDescriptor(g, "ref").get; if (N && N.isReactWarning) return !1; } return g.ref !== void 0; } function Rt(g) { if (oe.call(g, "key")) { var N = Object.getOwnPropertyDescriptor(g, "key").get; if (N && N.isReactWarning) return !1; } return g.key !== void 0; } function Ot(g, N) { if (typeof g.ref == "string" && S.current && N && S.current.stateNode !== N) { var x = K(S.current.type); ee[x] || (v('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', K(S.current.type), g.ref), ee[x] = !0); } } function ii(g, N) { { var x = function() { P || (P = !0, v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", N)); }; x.isReactWarning = !0, Object.defineProperty(g, "key", { get: x, configurable: !0 }); } } function ai(g, N) { { var x = function() { z || (z = !0, v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", N)); }; x.isReactWarning = !0, Object.defineProperty(g, "ref", { get: x, configurable: !0 }); } } var oi = function(g, N, x, D, W, X, $) { var U = { // This tag allows us to uniquely identify this as a React Element $$typeof: t, // Built-in properties that belong on the element type: g, key: N, ref: x, props: $, // Record the component responsible for creating this element. _owner: X }; return U._store = {}, Object.defineProperty(U._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: !1 }), Object.defineProperty(U, "_self", { configurable: !1, enumerable: !1, writable: !1, value: D }), Object.defineProperty(U, "_source", { configurable: !1, enumerable: !1, writable: !1, value: W }), Object.freeze && (Object.freeze(U.props), Object.freeze(U)), U; }; function si(g, N, x, D, W) { { var X, $ = {}, U = null, le = null; x !== void 0 && (ze(x), U = "" + x), Rt(N) && (ze(N.key), U = "" + N.key), he(N) && (le = N.ref, Ot(N, W)); for (X in N) oe.call(N, X) && !R.hasOwnProperty(X) && ($[X] = N[X]); if (g && g.defaultProps) { var J = g.defaultProps; for (X in J) $[X] === void 0 && ($[X] = J[X]); } if (U || le) { var te = typeof g == "function" ? g.displayName || g.name || "Unknown" : g; U && ii($, te), le && ai($, te); } return oi(g, U, le, W, D, S.current, $); } } var Ct = y.ReactCurrentOwner, cn = y.ReactDebugCurrentFrame; function Ke(g) { if (g) { var N = g._owner, x = fe(g.type, g._source, N ? N.type : null); cn.setExtraStackFrame(x); } else cn.setExtraStackFrame(null); } var Mt; Mt = !1; function It(g) { return typeof g == "object" && g !== null && g.$$typeof === t; } function ln() { { if (Ct.current) { var g = K(Ct.current.type); if (g) return ` Check the render method of \`` + g + "`."; } return ""; } } function ci(g) { return ""; } var un = {}; function li(g) { { var N = ln(); if (!N) { var x = typeof g == "string" ? g : g.displayName || g.name; x && (N = ` Check the top-level render call using <` + x + ">."); } return N; } } function dn(g, N) { { if (!g._store || g._store.validated || g.key != null) return; g._store.validated = !0; var x = li(N); if (un[x]) return; un[x] = !0; var D = ""; g && g._owner && g._owner !== Ct.current && (D = " It was passed a child from " + K(g._owner.type) + "."), Ke(g), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', x, D), Ke(null); } } function gn(g, N) { { if (typeof g != "object") return; if (Y(g)) for (var x = 0; x < g.length; x++) { var D = g[x]; It(D) && dn(D, N); } else if (It(g)) g._store && (g._store.validated = !0); else if (g) { var W = _(g); if (typeof W == "function" && W !== g.entries) for (var X = W.call(g), $; !($ = X.next()).done; ) It($.value) && dn($.value, N); } } } function ui(g) { { var N = g.type; if (N == null || typeof N == "string") return; var x; if (typeof N == "function") x = N.propTypes; else if (typeof N == "object" && (N.$$typeof === o || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. N.$$typeof === u)) x = N.propTypes; else return; if (x) { var D = K(N); ut(x, g.props, "prop", D, g); } else if (N.PropTypes !== void 0 && !Mt) { Mt = !0; var W = K(N); v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", W || "Unknown"); } typeof N.getDefaultProps == "function" && !N.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function di(g) { { for (var N = Object.keys(g.props), x = 0; x < N.length; x++) { var D = N[x]; if (D !== "children" && D !== "key") { Ke(g), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", D), Ke(null); break; } } g.ref !== null && (Ke(g), v("Invalid attribute `ref` supplied to `React.Fragment`."), Ke(null)); } } var fn = {}; function pn(g, N, x, D, W, X) { { var $ = m(g); if (!$) { var U = ""; (g === void 0 || typeof g == "object" && g !== null && Object.keys(g).length === 0) && (U += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); var le = ci(); le ? U += le : U += ln(); var J; g === null ? J = "null" : Y(g) ? J = "array" : g !== void 0 && g.$$typeof === t ? (J = "<" + (K(g.type) || "Unknown") + " />", U = " Did you accidentally export a JSX literal instead of a component?") : J = typeof g, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", J, U); } var te = si(g, N, x, W, X); if (te == null) return te; if ($) { var be = N.children; if (be !== void 0) if (D) if (Y(be)) { for (var Ge = 0; Ge < be.length; Ge++) gn(be[Ge], g); Object.freeze && Object.freeze(be); } else v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else gn(be, g); } if (oe.call(N, "key")) { var Oe = K(g), ue = Object.keys(N).filter(function(hi) { return hi !== "key"; }), Dt = ue.length > 0 ? "{key: someKey, " + ue.join(": ..., ") + ": ...}" : "{key: someKey}"; if (!fn[Oe + Dt]) { var mi = ue.length > 0 ? "{" + ue.join(": ..., ") + ": ...}" : "{}"; v(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, Dt, Oe, mi, Oe), fn[Oe + Dt] = !0; } } return g === r ? di(te) : ui(te), te; } } function gi(g, N, x) { return pn(g, N, x, !0); } function fi(g, N, x) { return pn(g, N, x, !1); } var pi = fi, bi = gi; Qe.Fragment = r, Qe.jsx = pi, Qe.jsxs = bi; }()), Qe; } process.env.NODE_ENV === "production" ? Ht.exports = ki() : Ht.exports = Si(); var E = Ht.exports; let Vt = jn({ key: "questionFamily", default: (e) => ({ id: e, question: "Ask whatever you want" }) }), jt = Zt({ key: "allChat", default: [] }); function hn() { let e = Me(), t = Me(), n = Me(Je()), r = Xn(Vt(n.current)), [a, c] = at(jt); function i(o) { e.current.value.trim().length != 0 ? t.current.classList.remove("disabled") : t.current.classList.add("disabled"), o.key === "shiftKey" && (o.preventDefault(), e.current.value.trim().length != 0 && (r((l) => ({ ...l, question: e.current.value })), c((l) => [...l, { question: n.current, answer: null }]), n.current = Je(), e.current.value = "", t.current.classList.add("disabled"))), o.key === "Enter" && (o.preventDefault(), e.current.value.trim().length != 0 && (r((l) => ({ ...l, question: e.current.value })), c((l) => [...l, { question: n.current, answer: null }]), n.current = Je(), e.current.value = "", t.current.classList.add("disabled"))); } function s() { e.current.value != "" && (r((o) => ({ ...o, question: e.current.value })), c((o) => [...o, { question: n.current, answer: null }]), n.current = Je(), e.current.value = "", t.current.classList.add("disabled")); } return /* @__PURE__ */ E.jsxs("div", { className: "input-area", children: [ /* @__PURE__ */ E.jsx("textarea", { ref: e, onKeyUp: i, placeholder: "Ask or search anything and press Enter", className: "prompt-input" }), /* @__PURE__ */ E.jsx("span", { ref: t, onClick: s, className: "search-icon disabled", title: "Send", children: /* @__PURE__ */ E.jsx("i", { class: "fa-solid fa-square-arrow-up-right" }) }), /* @__PURE__ */ E.jsx(Ti, {}) ] }); } function Ti() { return /* @__PURE__ */ E.jsxs("div", { className: "input-options", children: [ /* @__PURE__ */ E.jsxs("div", { className: "input-option", children: [ /* @__PURE__ */ E.jsx("span", { className: "input-option-icon", children: /* @__PURE__ */ E.jsx("i", { class: "fa-regular fa-file" }) }), /* @__PURE__ */ E.jsx("p", { className: "option-description", children: "Add Media" }) ] }), /* @__PURE__ */ E.jsxs("div", { className: "input-option", children: [ /* @__PURE__ */ E.jsx("span", { className: "input-option-icon", children: /* @__PURE__ */ E.jsx("i", { class: "fa-brands fa-soundcloud" }) }), /* @__PURE__ */ E.jsx("p", { className: "option-description", children: "Voice Chat" }) ] }) ] }); } function xi() { let [e, t] = Vn(navigator.onLine); return et(() => { function n() { t(navigator.onLine); } return window.addEventListener("online", n), window.addEventListener("offline", n), () => { window.removeEventListener("online", n), window.removeEventListener("offline", n); }; }, []), e; } function Ai() { let e = xi(), t = { padding: "0.3rem 1.1rem", borderRadius: "1rem", backgroundColor: "#15161d", fontSize: ".8rem", display: "flex", width: "max-content", justifyContents: "center", alignItems: "center", gap: "6px", color: "white", fontWeight: 500 }; return /* @__PURE__ */ E.jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "center" }, children: [ e && /* @__PURE__ */ E.jsxs("span", { style: t, children: [ /* @__PURE__ */ E.jsx("span", { style: { backgroundColor: "lightgreen", borderRadius: "100%", height: "8px", width: "8px", boxShadow: "0px 0px 216px 49px rgba(45,255,196,0.31)" } }), "Online" ] }), !e && /* @__PURE__ */ E.jsxs("span", { style: t, children: [ /* @__PURE__ */ E.jsx("span", { style: { backgroundColor: "red", borderRadius: "100%", height: "8px", width: "8px", boxShadow: "0px 0px 216px 49px rgb(255 99 45 / 31%)" } }), "OffLine" ] }) ] }); } let ot = Zt({ key: "chatBotAttributes", default: {} //default: {backendUrl:null,geminiApi:null,title:null,prompt:null,theme:null,botIcon:null,userIcon:null,stylizeTitle:null,description:null,cta:null} }); function Ri(e) { let { userIcon: t } = kt(ot), [n, r] = at(Vt(e.id)), [a, c] = Vn(!1), i = Me(), s = Me(); function o() { i.current.contentEditable = "true", i.current.classList.add("editing"), c((u) => !u), s.current = i.current.innerText; } function l() { i.current.contentEditable = "false", i.current.classList.remove("editing"), c((u) => !u), r((u) => ({ ...u, question: i.current.innerText })); } function d() { i.current.contentEditable = "false", i.current.classList.remove("editing"), c((u) => !u), i.current.innerText = s.current; } return /* @__PURE__ */ E.jsxs("div", { className: "question-container", children: [ /* @__PURE__ */ E.jsxs("div", { className: "question", children: [ /* @__PURE__ */ E.jsx("span", { className: "bot-icon", children: /* @__PURE__ */ E.jsx("img", { src: t || "/node_modules/10xanswers/dist/logoImg.jpg" }) }), /* @__PURE__ */ E.jsx("p", { className: "question-txt", ref: i, children: n.question }), !a && /* @__PURE__ */ E.jsx("span", { className: "edit-icon", onClick: o, children: /* @__PURE__ */ E.jsx("i", { class: "fa-solid fa-pen" }) }) ] }), a && /* @__PURE__ */ E.jsxs("div", { className: "chat-options edit-options", children: [ /* @__PURE__ */ E.jsxs("span", { onClick: l, className: "copy chat-option", children: [ /* @__PURE__ */ E.jsx("span", { className: "copy-icon", children: /* @__PURE__ */ E.jsx("i", { class: "fa-regular fa-clipboard" }) }), "Save" ] }), /* @__PURE__ */ E.jsxs("span", { onClick: d, className: "collection chat-option", children: [ /* @__PURE__ */ E.jsx("span", { className: "collection-icon", children: /* @__PURE__ */ E.jsx("i", { class: "fa-solid fa-xmark" }) }), "Cancel" ] }) ] }) ] }); } const st = ( // Note: overloads in JSDoc can’t yet use different `@template`s. /** * @type {( * (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) & * (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) & * (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) & * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) & * ((test?: Test) => Check) * )} */ /** * @param {Test} [test] * @returns {Check} */ function(e) { if (e == null) return Ii; if (typeof e == "function") return St(e); if (typeof e == "object") return Array.isArray(e) ? Oi(e) : Ci(e); if (typeof e == "string") return Mi(e); throw new Error("Expected function, string, or object as test"); } ); function Oi(e) { const t = []; let n = -1; for (; ++n < e.length; ) t[n] = st(e[n]); return St(r); function r(...a) { let c = -1; for (; ++c < t.length; ) if (t[c].apply(this, a)) return !0; return !1; } } function Ci(e) { const t = ( /** @type {Record<string, unknown>} */ e ); return St(n); function n(r) { const a = ( /** @type {Record<string, unknown>} */ /** @type {unknown} */ r ); let c; for (c in e) if (a[c] !== t[c]) return !1; return !0; } } function Mi(e) { return St(t); function t(n) { return n && n.type === e; } } function St(e) { return t; function t(n, r, a) { return !!(Di(n) && e.call( this, n, typeof r == "number" ? r : void 0, a || void 0 )); } } function Ii() { return !0; } function Di(e) { return e !== null && typeof e == "object" && "type" in e; } const _n = ( // Note: overloads like this are needed to support optional generics. /** * @type {( * (<Kind extends UnistParent, Check extends Test>(parent: Kind, index: Child<Kind> | number, test: Check) => Matches<Child<Kind>, Check> | undefined) & * (<Kind extends UnistParent>(parent: Kind, index: Child<Kind> | number, test?: null | undefined) => Child<Kind> | undefined) * )} */ /** * @param {UnistParent} parent * @param {UnistNode | number} index * @param {Test} [test] * @returns {UnistNode | undefined} */ function(e, t, n) { const r = st(n); if (!e || !e.type || !e.children) throw new Error("Expected parent node"); if (typeof t == "number") { if (t < 0 || t === Number.POSITIVE_INFINITY) throw new Error("Expected positive finite number as index"); } else if (t = e.children.indexOf(t), t < 0) throw new Error("Expected child node or index"); for (; ++t < e.children.length; ) if (r(e.children[t], t, e)) return e.children[t]; } ), Le = ( // Note: overloads in JSDoc can’t yet use different `@template`s. /** * @type {( * (<Condition extends TestFunction>(test: Condition) => (element: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & Predicate<Condition, Element>) & * (<Condition extends string>(test: Condition) => (element: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element & {tagName: Condition}) & * ((test?: null | undefined) => (element?: unknown, index?: number | null | undefined, parent?: Parents | null | undefined, context?: unknown) => element is Element) & * ((test?: Test) => Check) * )} */ /** * @param {Test | null | undefined} [test] * @returns {Check} */ function(e) { if (e == null) return Bi; if (typeof e == "string") return Pi(e); if (typeof e == "object") return Li(e); if (typeof e == "function") return Xt(e); throw new Error("Expected function, string, or array as `test`"); } ); function Li(e) { const t = []; let n = -1; for (; ++n < e.length; ) t[n] = Le(e[n]); return Xt(r); function r(...a) { let c = -1; for (; ++c < t.length; ) if (t[c].apply(this, a)) return !0; return !1; } } function Pi(e) { return Xt(t); function t(n) { return n.tagName === e; } } function Xt(e) { return t; function t(n, r, a) { return !!(Fi(n) && e.call( this, n, typeof r == "number" ? r : void 0, a || void 0 )); } } function Bi(e) { return !!(e && typeof e == "object" && "type" in e && e.type === "element" && "tagName" in e && typeof e.tagName == "string"); } function Fi(e) { return e !== null && typeof e == "object" && "type" in e && "tagName" in e; } const En = /\n/g, yn = /[\t ]+/g, qt = Le("br"), wn = Le(qi), Ui = Le("p"), Nn = Le("tr"), $i = Le([ // List from: <https://html.spec.whatwg.org/multipage/rendering.html#hidden-elements> "datalist", "head", "noembed", "noframes", "noscript", // Act as if we support scripting. "rp", "script", "style", "template", "title", // Hidden attribute. Hi, // From: <https://html.spec.whatwg.org/multipage/rendering.html#flow-content-3> Wi ]), Qn = Le([ "address", // Flow content "article", // Sections and headings "aside", // Sections and headings "blockquote", // Flow content "body", // Page "caption", // `table-caption` "center", // Flow content (legacy) "dd", // Lists "dialog", // Flow content "dir", // Lists (legacy) "dl", // Lists "dt", // Lists "div", // Flow content "figure", // Flow content "figcaption", // Flow content "footer", // Flow content "form,", // Flow content "h1", // Sections and headings "h2", // Sections and headings "h3", // Sections and headings "h4", // Sections and headings "h5", // Sections and headings "h6", // Sections and headings "header", // Flow content "hgroup", // Sections and headings "hr", // Flow content "html", // Page "legend", // Flow content "li", // Lists (as `display: list-item`) "listing", // Flow content (legacy) "main", // Flow content "menu", // Lists "nav", // Sections and headings "ol", // Lists "p", // Flow content "plaintext", // Flow content (legacy) "pre", // Flow content "section", // Sections and headings "ul", // Lists "xmp" // Flow content (legacy) ]); function vn(e, t) { const n = {}, r = "children" in e ? e.children : [], a = Qn(e), c = tr(e, { whitespace: n.whitespace || "normal", breakBefore: !1, breakAfter: !1 }), i = []; (e.type === "text" || e.type === "comment") && i.push( ...er(e, { whitespace: c, breakBefore: !0, breakAfter: !0 }) ); let s = -1; for (; ++s < r.length; ) i.push( ...Jn( r[s], // @ts-expect-error: `tree` is a parent if we’re here. e, { whitespace: c, breakBefore: s ? void 0 : a, breakAfter: s < r.length - 1 ? qt(r[s + 1]) : a } ) ); const o = []; let l; for (s = -1; ++s < i.length; ) { const d = i[s]; typeof d == "number" ? l !== void 0 && d > l && (l = d) : d && (l !== void 0 && l > -1 && o.push(` `.repeat(l) || " "), l = -1, o.push(d)); } return o.join(""); } function Jn(e, t, n) { return e.type === "element" ? zi(e, t, n) : e.type === "text" ? n.whitespace === "normal" ? er(e, n) : Ki(e) : []; } function zi(e, t, n) { const r = tr(e, n), a = e.children || []; let c = -1, i = []; if ($i(e)) return i; let s, o; for (qt(e) || Nn(e) && // @ts-expect-error: something up with types of parents. _n(t, e, Nn) ? o = ` ` : Ui(e) ? (s = 2, o = 2) : Qn(e) && (s = 1, o = 1); ++c < a.length; ) i = i.concat( Jn(a[c], e, { whitespace: r, breakBefore: c ? void 0 : s, breakAfter: c < a.length - 1 ? qt(a[c + 1]) : o }) ); return wn(e) && // @ts-expect-error: something up with types of parents. _n(t, e, wn) && i.push(" "), s && i.unshift(s), o && i.push(o), i; } function er(e, t) { const n = String(e.value), r = [], a = []; let c = 0; for (; c <= n.length; ) { En.lastIndex = c; const o = En.exec(n), l = o && "index" in o ? o.index : n.length; r.push( // Any sequence of collapsible spaces and tabs immediately preceding or // following a segment break is removed. Gi( // […] ignoring bidi formatting characters (characters with the // Bidi_Control property [UAX9]: ALM, LTR, RTL, LRE-RLO, LRI-PDI) as if // they were not there. n.slice(c, l).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g, ""), c === 0 ? t.breakBefore : !0, l === n.length ? t.breakAfter : !0 ) ), c = l + 1; } let i = -1, s; for (; ++i < r.length; ) r[i].charCodeAt(r[i].length - 1) === 8203 || i < r.length - 1 && r[i + 1].charCodeAt(0) === 8203 ? (a.push(r[i]), s = void 0) : r[i] ? (typeof s == "number" && a.push(s), a.push(r[i]), s = 0) : (i === 0 || i === r.length - 1) && a.push(0); return a; } function Ki(e) { return [String(e.value)]; } function Gi(e, t, n) { const r = []; let a = 0, c; for (; a < e.length; ) { yn.lastIndex = a; const i = yn.exec(e); c = i ? i.index : e.length, !a && !c && i && !t && r.push(""), a !== c && r.push(e.slice(a, c)), a = i ? c + i[0].length : c; } return a !== c && !n && r.push(""), r.join(" "); } function tr(e, t) { if (e.type === "element") { const n = e.properties || {}; switch (e.tagName) { case "listing": case "plaintext": case "xmp": return "pre"; case "nobr": return "nowrap"; case "pre": return n.wrap ? "pre-wrap" : "pre"; case "td": case "th": return n.noWrap ? "nowrap" : t.whitespace; case "textarea": return "pre-wrap"; } } return t.whitespace; } function Hi(e) { return !!(e.properties || {}).hidden; } function qi(e) { return e.tagName === "td" || e.tagName === "th"; } function Wi(e) { return e.tagName === "dialog" && !(e.properties || {}).open; } function Yi(e) { const t = e.regex, n = e.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] }), r = "decltype\\(auto\\)", a = "[a-zA-Z_]\\w*::", i = "(?!struct)(" + r + "|" + t.optional(a) + "[a-zA-Z_]\\w*" + t.optional("<[^<>]+>") + ")", s = { className: "type", begin: "\\b[a-z\\d_]*_t\\b" }, l = { className: "string", variants: [ { begin: '(u8?|U|L)?"', end: '"', illegal: "\\n", contains: [e.BACKSLASH_ESCAPE] }, { begin: "(u8?|U|L)?'(" + "\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)" + "|.)", end: "'", illegal: "." }, e.END_SAME_AS_BEGIN({ begin: /(?:u8?|U|L)?R"([^(