UNPKG

mind-link-ai-widget

Version:

A react widget for React Web and React-Native Mobile integrations.

592 lines (591 loc) 30.9 kB
import fe, { useState as x, useRef as C, useEffect as R, useMemo as X, useCallback as ye } from "react"; import { IoMic as le, IoArrowUp as Ie, IoAttach as ke, IoClose as Se, IoLocationSharp as Ce, IoCall as _e, IoMail as Te, IoGlobe as Ee, IoLanguage as Re, IoPersonAdd as Me, IoBus as Ae, IoAccessibility as De, IoVideocam as Pe, IoMedkit as $e } from "react-icons/io5"; var J = { exports: {} }, U = {}; /** * @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 de; function Ue() { if (de) return U; de = 1; var n = fe, a = Symbol.for("react.element"), l = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, w = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, I = { key: !0, ref: !0, __self: !0, __source: !0 }; function g(N, i, p) { var m, v = {}, f = null, c = null; p !== void 0 && (f = "" + p), i.key !== void 0 && (f = "" + i.key), i.ref !== void 0 && (c = i.ref); for (m in i) r.call(i, m) && !I.hasOwnProperty(m) && (v[m] = i[m]); if (N && N.defaultProps) for (m in i = N.defaultProps, i) v[m] === void 0 && (v[m] = i[m]); return { $$typeof: a, type: N, key: f, ref: c, props: v, _owner: w.current }; } return U.Fragment = l, U.jsx = g, U.jsxs = g, U; } var he; function Le() { return he || (he = 1, J.exports = Ue()), J.exports; } var e = Le(); const j = []; for (let n = 0; n < 256; ++n) j.push((n + 256).toString(16).slice(1)); function We(n, a = 0) { return (j[n[a + 0]] + j[n[a + 1]] + j[n[a + 2]] + j[n[a + 3]] + "-" + j[n[a + 4]] + j[n[a + 5]] + "-" + j[n[a + 6]] + j[n[a + 7]] + "-" + j[n[a + 8]] + j[n[a + 9]] + "-" + j[n[a + 10]] + j[n[a + 11]] + j[n[a + 12]] + j[n[a + 13]] + j[n[a + 14]] + j[n[a + 15]]).toLowerCase(); } let Y; const Oe = new Uint8Array(16); function qe() { if (!Y) { if (typeof crypto > "u" || !crypto.getRandomValues) throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); Y = crypto.getRandomValues.bind(crypto); } return Y(Oe); } const ze = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ue = { randomUUID: ze }; function Ve(n, a, l) { if (ue.randomUUID && !n) return ue.randomUUID(); n = n || {}; const r = n.random ?? n.rng?.() ?? qe(); if (r.length < 16) throw new Error("Random bytes length must be >= 16"); return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, We(r); } const Be = k(); function k() { return Ve(); } function He() { const n = (/* @__PURE__ */ new Date()).getHours(); return n < 12 ? "Good Morning" : n < 18 ? "Good Afternoon" : "Good Evening"; } function K(n, a = 1) { return n.slice().sort(() => 0.5 - Math.random()).slice(0, a); } function Fe(n) { const a = n.replace(/\D/g, ""); return a.length === 10 ? `(${a.slice(0, 3)}) ${a.slice(3, 6)}-${a.slice(6)}` : a.length === 11 && a.startsWith("1") ? `+1 (${a.slice(1, 4)}) ${a.slice(4, 7)}-${a.slice(7)}` : n; } function xe(n) { return n.replace(/\w\S*/g, (a) => a.charAt(0).toUpperCase() + a.slice(1).toLowerCase()); } const Q = "https://uat.api-az.carelonhealth.com/mindlink/api/v1", Z = "carelon-bh-mobile", ee = "2f8c1e7a-4b3d-4e2a-9c6a-8a1f7b2c5d9e"; async function Xe(n, a) { const l = `${Q}/behive/intents-and-entities`, r = await fetch(l, { method: "POST", headers: { Authorization: `Bearer ${n}`, apikey: ee, "sender-app": Z, "Content-Type": "application/json", accept: "application/json", "x-csid": Be }, body: JSON.stringify({ query: a }) }); if (!r.ok) throw new Error("Network error"); return r.json(); } async function me(n, a) { const l = `${Q}/behive/crediblemind/suggest`, r = await fetch(l, { method: "POST", headers: { Authorization: `Bearer ${n}`, apikey: ee, "sender-app": Z, "Content-Type": "application/json", accept: "application/json" }, body: JSON.stringify({ query: a }) }); if (!r.ok) throw new Error("Network error"); return r.json(); } async function Je(n, a) { const l = `${Q}/behive/providers/search`, r = await fetch(l, { method: "POST", headers: { Authorization: `Bearer ${n}`, apikey: ee, "sender-app": Z, "Content-Type": "application/json", accept: "application/json" }, body: JSON.stringify(a) }); if (!r.ok) throw new Error("Network error"); return r.json(); } const Ye = ({ children: n, className: a }) => /* @__PURE__ */ e.jsx("span", { className: a, onClick: () => console.warn("Navigation not supported"), children: n }), pe = "var(--carelon-purple)", G = (n = /* @__PURE__ */ new Date()) => n.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit", hour12: !1 }), Ge = ({ showGreeting: n, onStartChat: a, chipToSend: l, onChipSent: r, chips: w = [], selectedChipIdx: I = null, handleChipClick: g, token: N }) => { const [i, p] = x([]), [m, v] = x(""), [f, c] = x(!1), [t, d] = x(!1), [y, o] = x(!1), [_, L] = x(!1), [b, q] = x([]), [W, z] = x(null), [V, be] = x([]), [te, ne] = x(!0), se = 30, B = C(null), ge = C(null), ae = C(null), ie = C(null), H = C(null), O = async (s) => { if (!(s || m.trim()) || f) return; n && a(), L(!0); const h = s || m, M = { id: k() + "-user", sender: "user", text: h, timestamp: /* @__PURE__ */ new Date() }; p((u) => [...u, M]), v(""), c(!0), ne(!0); try { ge.current = ae.current, ie.current = H.current; const u = await Xe(N, M.text); ae.current = u.intent, H.current = u.slots.specialty; const T = u?.slots_fulfillment?.status ?? !0; ne(T); const P = u?.followup?.prompt ?? null, $ = u?.followup?.options ?? []; be($); const re = u.smalltalk, F = u.hybridtalk; if (T && u.intent !== "provider_search_intent" && p((S) => [...S, { id: k() + "-bot-smalltalk", sender: "bot", text: re || F, timestamp: /* @__PURE__ */ new Date() }]), T && u.intent === "health_content_intent" && u.slots.content_query) { const S = await me(N, u.slots.content_query); S?.crediblemind?.length ? p((A) => [...A, { id: k() + "-bot-healthcontent-richinfo", sender: "bot", crediblemind: S.crediblemind, timestamp: /* @__PURE__ */ new Date() }]) : p((A) => [...A, { id: k() + "-bot-smalltalk", sender: "bot", text: "Sorry! There are no health content suggestions for your query.", timestamp: /* @__PURE__ */ new Date() }]); } else if (T && u.intent === "provider_search_intent") { let S = null; ie.current !== H.current && (S = await me(N, u.query)), S?.crediblemind?.length ? p((E) => [...E, { id: k() + "-bot-healthcontent-richinfo-with-text", sender: "bot", text: F, crediblemind: S.crediblemind, timestamp: /* @__PURE__ */ new Date() }]) : p((E) => [...E, { id: k() + "-bot-smalltalk", sender: "bot", text: re || F, timestamp: /* @__PURE__ */ new Date() }]); const A = await Je(N, { gender: u.slots.gender, specialty: u.slots.specialty, provider_type: u.slots.provider_type, location: u.slots.location, language: u.slots.language }); A?.providers?.length ? p((E) => [...E, { id: k() + "-bot-providersearch-richinfo", sender: "bot", providers: A.providers, timestamp: /* @__PURE__ */ new Date() }]) : p((E) => [...E, { id: k() + "-bot-smalltalk", sender: "bot", text: "Sorry! There are no providers available for your search criteria.", timestamp: /* @__PURE__ */ new Date() }]); } p((S) => [...S, { id: k() + "-bot-followup", sender: "bot", text: P || void 0, timestamp: /* @__PURE__ */ new Date() }]); } catch { p((u) => [...u, { id: k() + "-bot-smalltalk", sender: "bot", text: "Sorry! There was a problem interacting with my system. Please try again in a while.", timestamp: /* @__PURE__ */ new Date() }]); } finally { c(!1); } }; R(() => { B.current?.scrollIntoView({ behavior: "smooth" }); }, [i, f]), R(() => { l && !_ && (O(l), L(!0), n && a(), typeof r == "function" && r()); }, [l]); const [ce, oe] = x(!1); R(() => { if (!ce) { if (!n && i.length > b.length) { const s = i[b.length]; if (s.sender === "bot") { let h = "", M = 0; oe(!0); const u = typeof s.text == "string" ? s.text : "", T = () => { u && M < u.length ? (h += u[M], q((P) => { const $ = [...P]; return $[$.length - 1] = { ...s, text: h }, $; }), M++, setTimeout(T, se)) : oe(!1); }; q((P) => [...P, { ...s, text: "" }]), setTimeout(T, se); } else q((h) => [...h, s]); } B.current?.scrollIntoView({ behavior: "smooth" }); } }, [i, n, b, b.length, ce]); const je = X(() => "John!", []), we = X(() => K(["Hi", "Hey", "Hello", He()]), []), Ne = X(() => K(["How can I help you today?", "What can I do for you today?"]), []), ve = (() => { if (!V || V.length === 0 || b.length === 0) return !1; const s = b[b.length - 1]; return s.sender === "bot" && s.id.includes("-bot-followup") && s.text && i.length === b.length && i[i.length - 1].id === s.id && i[i.length - 1].text === s.text; })(); return /* @__PURE__ */ e.jsxs("div", { className: "chat", children: [ !W && /* @__PURE__ */ e.jsxs("div", { className: "chat-area", children: [ /* @__PURE__ */ e.jsx("div", { className: "chat-header" }), /* @__PURE__ */ e.jsxs("div", { className: "chat-body", children: [ !n && /* @__PURE__ */ e.jsx("div", { className: "chat-conversations", children: !n && !W && /* @__PURE__ */ e.jsxs("div", { className: "chat-messages", children: [ b.map((s, h) => /* @__PURE__ */ e.jsx(fe.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: s.sender === "user" ? "chat-user-msg" : "chat-bot-msg", children: [ s.text && /* @__PURE__ */ e.jsxs("div", { className: "message-content", children: [ /* @__PURE__ */ e.jsx("div", { className: "message-text", children: s.text }), s.timestamp && (!s.id.includes("-bot-") || i.length > h && b.length > h && i[h].id === s.id && i[h].text === s.text && b[h].text === s.text) && /* @__PURE__ */ e.jsx("div", { className: "message-timestamp", children: G(new Date(s.timestamp)) }) ] }), te && s.crediblemind && Array.isArray(s.crediblemind) && s.crediblemind.length > 0 && (!s.id.includes("-bot-smalltalk") && !s.id.includes("-bot-healthcontent-richinfo-with-text") || i.length > h && b.length > h && i[h].id === s.id && i[h].text === s.text && b[h].text === s.text) && /* @__PURE__ */ e.jsxs("div", { className: "crediblemind-cards", children: [ /* @__PURE__ */ e.jsx("div", { className: "cards-header", children: /* @__PURE__ */ e.jsx("div", { className: "cards-title", children: "📚 Helpful Resources" }) }), /* @__PURE__ */ e.jsx(Ke, { items: s.crediblemind, onItemClick: z }), s.timestamp && /* @__PURE__ */ e.jsx("div", { className: "message-timestamp message-timestamp-cards", children: G(new Date(s.timestamp)) }) ] }), te && s.providers && Array.isArray(s.providers) && s.providers.length > 0 && (!s.id.includes("-bot-smalltalk") && !s.id.includes("-bot-healthcontent-richinfo") && !s.id.includes("-bot-healthcontent-richinfo-with-text") || i.length > h && b.length > h && i[h].id === s.id && i[h].text === s.text && b[h].text === s.text) && /* @__PURE__ */ e.jsxs("div", { className: "provider-cards", children: [ /* @__PURE__ */ e.jsx("div", { className: "cards-header", children: /* @__PURE__ */ e.jsx("div", { className: "cards-title", children: "👩‍⚕️ Healthcare Providers" }) }), /* @__PURE__ */ e.jsx(Qe, { providers: s.providers, setIframeUrl: z }), s.timestamp && /* @__PURE__ */ e.jsx("div", { className: "message-timestamp message-timestamp-cards", children: G(new Date(s.timestamp)) }) ] }) ] }) }, s.id + "-" + h)), ve && /* @__PURE__ */ e.jsx("div", { className: "chat-suggestion-options", children: /* @__PURE__ */ e.jsx("div", { className: "followup-suggestion-chips", children: V.map((s) => /* @__PURE__ */ e.jsx( "button", { className: "followup-suggestion-chip", tabIndex: 0, onClick: () => O(s), children: s }, s )) }) }), f && /* @__PURE__ */ e.jsxs("div", { className: "chat-bot-msg loading", children: [ /* @__PURE__ */ e.jsx("span", { className: "loader-dot", children: "•" }), /* @__PURE__ */ e.jsx("span", { className: "loader-dot", children: "•" }), /* @__PURE__ */ e.jsx("span", { className: "loader-dot", children: "•" }) ] }), /* @__PURE__ */ e.jsx("div", { ref: B }) ] }) }), n && /* @__PURE__ */ e.jsxs("div", { className: "chat-greeting-chips", children: [ /* @__PURE__ */ e.jsxs("div", { className: "chat-greeting", children: [ /* @__PURE__ */ e.jsxs("div", { className: "greeting-main", children: [ we, ",", /* @__PURE__ */ e.jsx("span", { className: "greeting-name", children: je }) ] }), /* @__PURE__ */ e.jsx("div", { className: "greeting-sub", children: Ne }) ] }), /* @__PURE__ */ e.jsx("div", { className: "chat-suggestion-chips chat-main-chips", children: /* @__PURE__ */ e.jsx("div", { className: "suggestion-chips", children: w.map((s, h) => /* @__PURE__ */ e.jsx( "button", { className: `suggestion-chip${I === h ? " selected" : ""}`, tabIndex: 0, onClick: () => g && g(h), children: s }, s )) }) }) ] }) ] }), /* @__PURE__ */ e.jsx("div", { className: "chat-footer", children: /* @__PURE__ */ e.jsxs("div", { className: "chat-actions", children: [ /* @__PURE__ */ e.jsxs("div", { className: "chat-input-row", children: [ /* @__PURE__ */ e.jsx("input", { className: "chat-input", type: "text", placeholder: "Ask anything", value: m, onChange: (s) => v(s.target.value), onKeyDown: (s) => { s.key === "Enter" && O(); }, disabled: f, "aria-label": "Type your message" }), /* @__PURE__ */ e.jsx( "button", { className: "chat-mic-btn", "aria-label": "Voice input", onClick: () => { o(!0), d(!1); }, disabled: f || n && !l, children: /* @__PURE__ */ e.jsx(le, { className: "chat-footer-icon" }) } ), /* @__PURE__ */ e.jsx( "button", { className: "chat-send-btn", onClick: () => O(), disabled: f || !m.trim() && n && !l, "aria-label": "Send message", children: /* @__PURE__ */ e.jsx(Ie, { className: "chat-footer-icon" }) } ) ] }), y && /* @__PURE__ */ e.jsx("div", { className: "chat-popup-overlay", tabIndex: -1, "aria-modal": "true", role: "dialog", children: /* @__PURE__ */ e.jsxs("div", { className: "chat-popup-modal", children: [ /* @__PURE__ */ e.jsx("button", { className: "chat-popup-close", onClick: () => { o(!1), typeof window.onChatBack == "function" && window.onChatBack(); }, "aria-label": "Close", children: "×" }), /* @__PURE__ */ e.jsx("div", { className: "chat-popup-icon animate-mic", children: /* @__PURE__ */ e.jsx(le, { size: 36, color: pe }) }), /* @__PURE__ */ e.jsx("div", { className: "chat-popup-title", children: "Listening..." }), /* @__PURE__ */ e.jsx("div", { className: "chat-popup-desc", children: "Speak your query and we'll convert it to text. (Animation here)" }) ] }) }), t && /* @__PURE__ */ e.jsx("div", { className: "chat-popup-overlay", tabIndex: -1, "aria-modal": "true", role: "dialog", children: /* @__PURE__ */ e.jsxs("div", { className: "chat-popup-modal", children: [ /* @__PURE__ */ e.jsx("button", { className: "chat-popup-close", onClick: () => { d(!1), typeof window.onChatBack == "function" && window.onChatBack(); }, "aria-label": "Close", children: "×" }), /* @__PURE__ */ e.jsx("div", { className: "chat-popup-icon animate-attachment", children: /* @__PURE__ */ e.jsx(ke, { size: 36, color: pe }) }), /* @__PURE__ */ e.jsx("div", { className: "chat-popup-title", children: "Upload a file or image" }), /* @__PURE__ */ e.jsx("input", { type: "file", className: "chat-popup-file" }), /* @__PURE__ */ e.jsx("div", { className: "chat-popup-desc", children: "Choose a file or image to upload. (Animation here)" }) ] }) }) ] }) }) ] }), /* @__PURE__ */ e.jsx("div", { className: "chat-ext-links-iframe", children: W && /* @__PURE__ */ e.jsx("div", { className: "iframe-modal-overlay", children: /* @__PURE__ */ e.jsxs("div", { className: "iframe-modal", children: [ /* @__PURE__ */ e.jsx("button", { className: "iframe-modal-close", onClick: () => { z(null), typeof window.onChatBack == "function" && window.onChatBack(); }, children: /* @__PURE__ */ e.jsx(Se, {}) }), /* @__PURE__ */ e.jsx("iframe", { src: W, title: "External Content", style: { width: "100%", height: "100vh", border: "none" } }) ] }) }) }) ] }); }; function Ke({ items: n, onItemClick: a }) { const [l, r] = x(0), [w, I] = x(window.innerWidth <= 768), g = C(null); R(() => { const c = () => I(window.innerWidth <= 768); return window.addEventListener("resize", c), () => window.removeEventListener("resize", c); }, []); const i = (() => { if (w) return 1; const c = window.innerWidth * 0.8, d = Math.floor(c / 288); return Math.min(d, n.length); })(), p = w ? n.length : i >= n.length ? 1 : Math.ceil(n.length / i), m = (c) => r(Math.min(c, p - 1)), v = C(0), f = (c) => { const t = v.current - c; Math.abs(t) > 50 && (t > 0 && l < p - 1 ? r((d) => d + 1) : t < 0 && l > 0 && r((d) => d - 1)); }; return /* @__PURE__ */ e.jsxs("div", { className: "cards-carousel", children: [ /* @__PURE__ */ e.jsx( "div", { className: "carousel-container", ref: g, onTouchStart: (c) => v.current = c.touches[0].clientX, onTouchEnd: (c) => f(c.changedTouches[0].clientX), onMouseDown: (c) => v.current = c.clientX, onMouseUp: (c) => f(c.clientX), children: /* @__PURE__ */ e.jsx("div", { className: "carousel-track", style: { transform: `translateX(-${l * (w ? 100 : i >= n.length ? 0 : 100 / i)}%)` }, children: n.map((c) => { const t = c.content_type === "Video"; return /* @__PURE__ */ e.jsx("div", { className: "carousel-item", children: /* @__PURE__ */ e.jsxs( "a", { href: c.content_url, className: "crediblemind-card", onClick: (d) => { d.preventDefault(), a(c.content_url); }, children: [ /* @__PURE__ */ e.jsxs("div", { className: "card-image", children: [ /* @__PURE__ */ e.jsx("img", { src: `${c.image_url}`, alt: "" }), /* @__PURE__ */ e.jsx("div", { className: "card-type-badge", children: c.content_type }) ] }), /* @__PURE__ */ e.jsxs("div", { className: `card-content card-content-${c.content_type.toLowerCase()}`, children: [ /* @__PURE__ */ e.jsx("h4", { className: "card-title", children: c.title }), /* @__PURE__ */ e.jsx("div", { className: "card-action", children: /* @__PURE__ */ e.jsxs("span", { className: "action-text", children: [ t ? "Watch" : "Read", " →" ] }) }) ] }) ] } ) }, c.entry_id); }) }) } ), p > 1 && /* @__PURE__ */ e.jsx("div", { className: "carousel-indicators", children: Array.from({ length: p }, (c, t) => /* @__PURE__ */ e.jsx( "button", { className: `carousel-indicator ${t === l ? "active" : ""}`, onClick: () => m(t) }, t )) }) ] }); } function Qe({ providers: n, setIframeUrl: a }) { const [l, r] = x(0), [w, I] = x(window.innerWidth <= 768), [g, N] = x(1), i = C(null), p = ye(() => { if (window.innerWidth <= 768) return 1; const t = window.innerWidth * 0.8, y = Math.floor(t / 312); return Math.max(1, Math.min(y, n.length)); }, [n.length]); R(() => { const t = () => { I(window.innerWidth <= 768), N(p()); }; return N(p()), window.addEventListener("resize", t), () => window.removeEventListener("resize", t); }, [p]), R(() => { const t = () => { if (i.current) { const y = i.current.querySelectorAll(".provider-card"); y.forEach((_) => _.style.height = "auto"); const o = Math.max(...Array.from(y).map((_) => _.scrollHeight)); y.forEach((_) => _.style.height = `${o}px`); } }, d = setTimeout(t, 100); return window.addEventListener("resize", t), () => { clearTimeout(d), window.removeEventListener("resize", t); }; }, [n]); const m = w ? n.length : g >= n.length ? 1 : Math.ceil(n.length / g), v = (t) => r(Math.min(t, m - 1)), f = C(0), c = (t) => { const d = f.current - t; Math.abs(d) > 50 && (d > 0 && l < m - 1 ? r((y) => y + 1) : d < 0 && l > 0 && r((y) => y - 1)); }; return /* @__PURE__ */ e.jsxs("div", { className: "provider-carousel", children: [ /* @__PURE__ */ e.jsx( "div", { className: "carousel-container", ref: i, onTouchStart: (t) => f.current = t.touches[0].clientX, onTouchEnd: (t) => c(t.changedTouches[0].clientX), onMouseDown: (t) => f.current = t.clientX, onMouseUp: (t) => c(t.clientX), children: /* @__PURE__ */ e.jsx("div", { className: "carousel-track", style: { transform: `translateX(-${l * (w ? 100 : g >= n.length ? 0 : 100 / g)}%)` }, children: n.map((t, d) => { const y = `${t.name.firstName?.[0] || ""}${t.name.lastName?.[0] || ""}`.toUpperCase(); return /* @__PURE__ */ e.jsx("div", { className: "carousel-item", children: /* @__PURE__ */ e.jsxs("div", { className: "provider-card", children: [ /* @__PURE__ */ e.jsxs("div", { className: "provider-header-horizontal", children: [ /* @__PURE__ */ e.jsx("span", { className: "provider-logo-circle fixed-width-span", children: y }), /* @__PURE__ */ e.jsxs("span", { className: "provider-name", children: [ t.name.firstName, " ", t.name.lastName ] }), /* @__PURE__ */ e.jsx("span", { className: "provider-title right-align", children: t.title }) ] }), /* @__PURE__ */ e.jsxs("div", { className: "provider-details", children: [ /* @__PURE__ */ e.jsxs("div", { className: "provider-address", children: [ /* @__PURE__ */ e.jsxs("span", { className: "provider-icon address-icon", children: [ /* @__PURE__ */ e.jsx(Ce, {}), " " ] }), /* @__PURE__ */ e.jsxs("span", { className: "provider-link", onClick: () => { const o = `${t.contact.address.addr1}, ${t.contact.address.city}, ${t.contact.address.state} ${t.contact.address.zip}`; window.open(`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(o)}`, "_blank"); }, children: [ t.contact.address.addr1, ", ", t.contact.address.city, ", ", t.contact.address.state, " ", t.contact.address.zip ] }) ] }), /* @__PURE__ */ e.jsxs("div", { className: "provider-contact", children: [ t.contact.phone && t.contact.phone !== "Not Available" && /* @__PURE__ */ e.jsxs("span", { children: [ /* @__PURE__ */ e.jsx(_e, { className: "provider-icon" }), /* @__PURE__ */ e.jsx("a", { href: `tel:${t.contact.phone}`, target: "_blank", rel: "noopener noreferrer", className: "provider-link", children: Fe(t.contact.phone) }) ] }), t.contact.officeEmail && t.contact.officeEmail !== "Not Available" && /* @__PURE__ */ e.jsxs("span", { children: [ /* @__PURE__ */ e.jsx(Te, { className: "provider-icon" }), /* @__PURE__ */ e.jsx("a", { href: `mailto:${t.contact.officeEmail}`, className: "provider-link-blank", children: t.contact.officeEmail }) ] }), t.contact.website && t.contact.website !== "Not Available" && (t.contact.website.startsWith("/") ? /* @__PURE__ */ e.jsx(Ye, { to: t.contact.website, className: "provider-link-blank", children: t.contact.website }) : /* @__PURE__ */ e.jsxs("span", { children: [ /* @__PURE__ */ e.jsx(Ee, { className: "provider-icon" }), /* @__PURE__ */ e.jsx( "a", { href: t.contact.website.startsWith("http") ? t.contact.website : `https://${t.contact.website}`, className: "provider-link-blank", onClick: (o) => { o.preventDefault(), a(t.contact.website.startsWith("http") ? t.contact.website : `https://${t.contact.website}`); }, children: t.contact.website } ) ] })) ] }), t.languages && t.languages.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "provider-languages", children: [ /* @__PURE__ */ e.jsx("span", { className: "provider-icon", children: /* @__PURE__ */ e.jsx(Re, {}) }), t.languages.map((o) => xe(o)).join(", ") ] }), t.yellowLabels && t.yellowLabels.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "provider-labels", children: t.yellowLabels.filter((o) => !o.notAvailable).map((o) => o.icon === "accepting-new-patients" ? /* @__PURE__ */ e.jsx(D, { icon: /* @__PURE__ */ e.jsx(Me, { className: "provider-label-icon" }), tooltip: o.label || "Accepting new patients" }, o.icon) : o.icon === "public-transportation" ? /* @__PURE__ */ e.jsx(D, { icon: /* @__PURE__ */ e.jsx(Ae, { className: "provider-label-icon" }), tooltip: o.label || "Public transportation available" }, o.icon) : o.icon === "wheelchair-accessible" ? /* @__PURE__ */ e.jsx(D, { icon: /* @__PURE__ */ e.jsx(De, { className: "provider-label-icon" }), tooltip: o.label || "Wheelchair accessible" }, o.icon) : o.icon === "telehealth-provider" ? /* @__PURE__ */ e.jsx(D, { icon: /* @__PURE__ */ e.jsx(Pe, { className: "provider-label-icon" }), tooltip: o.label || "Telehealth provider" }, o.icon) : o.icon === "medicaid-provider" ? /* @__PURE__ */ e.jsx(D, { icon: /* @__PURE__ */ e.jsx($e, { className: "provider-label-icon" }), tooltip: o.label || "Medicaid provider" }, o.icon) : /* @__PURE__ */ e.jsx(D, { icon: null, tooltip: o.label || o.icon, children: o.label || o.icon }, o.icon)) }) ] }), t.onlineAppointmentScheduleFlag == 1 && /* @__PURE__ */ e.jsx("button", { className: "provider-request-appt-btn", onClick: () => { }, children: " Request an appointment" }) ] }) }, (t.providerId ? t.providerId : `${t.name.firstName}-${t.name.lastName}`) + "-" + d); }) }) } ), m > 1 && /* @__PURE__ */ e.jsx("div", { className: "carousel-indicators", children: Array.from({ length: m }, (t, d) => /* @__PURE__ */ e.jsx( "button", { className: `carousel-indicator ${d === l ? "active" : ""}`, onClick: () => v(d) }, d )) }) ] }); } function D({ icon: n, tooltip: a, children: l }) { const [r, w] = x(!1); let I; const g = () => { w(!0), clearTimeout(I), I = setTimeout(() => w(!1), 5e3); }, N = () => { w(!1), clearTimeout(I); }; return /* @__PURE__ */ e.jsxs("span", { className: "provider-label", onClick: g, onMouseEnter: g, onMouseLeave: N, children: [ n, l, r && /* @__PURE__ */ e.jsx("span", { className: "provider-label-tooltip", children: xe(a) }) ] }); } function tt({ product: n = "eap", client: a = "bcbsnc", channel: l = "mobile", isLoggedIn: r = !1, token: w = "", user: I = {}, config: g = {} }) { const i = K([ "I feel stressed", "Tips for anxiety", "My benefits", "Work-life balance advice", "Mindfulness techniques", "Dealing with burnout", "Healthy habits", "Managing emotions", "Productivity tips", "Positive thinking", "Social support", "Self care routines", "Goal setting", "Time management", "Sleep hygiene", "Stress relief", "Mental wellness", "Emotional balance", "Find providers near me", "Find counselors near me", "Find therapists near me" ], 4), [p, m] = x(null), [v, f] = x(!1), [c, t] = x(null), d = C(null), y = () => { d.current && (f(d.current.chatStarted), m(d.current.selectedChipIdx), t(d.current.chipToSend)); }; R(() => (window.onChatBack = y, () => { window.onChatBack = void 0; }), []); const o = (b) => { m(b), t(i[b]), f(!0); }, _ = () => { m(null), t(null); }, L = () => f(!0); return /* @__PURE__ */ e.jsxs("div", { className: "mind-link-ai-widget theme-light app-root", children: [ /* @__PURE__ */ e.jsx("div", { className: "app-body", children: /* @__PURE__ */ e.jsx( Ge, { showGreeting: !v, onStartChat: L, chipToSend: c, onChipSent: _, chips: i, selectedChipIdx: p, handleChipClick: o, user: I, product: n, client: a, channel: l, isLoggedIn: r, token: w, config: g } ) }), /* @__PURE__ */ e.jsx("footer", { className: "app-footer" }) ] }); } export { tt as default };