bstp-agent-widget 0.2.70 → 0.2.71

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.
@@ -23917,10 +23917,10 @@ function UO(e = {}) {
23917
23917
  };
23918
23918
  }
23919
23919
  var WO = {
23920
- root: "_root_76f4f_2",
23921
- button: "_button_76f4f_7",
23922
- icon: "_icon_76f4f_24",
23923
- label: "_label_76f4f_30"
23920
+ root: "_root_qxd5o_1",
23921
+ button: "_button_qxd5o_7",
23922
+ icon: "_icon_qxd5o_28",
23923
+ label: "_label_qxd5o_34"
23924
23924
  };
23925
23925
  //#endregion
23926
23926
  //#region src/components/AgentChat/AgentChatFab.tsx
@@ -29047,29 +29047,21 @@ var BF = {
29047
29047
  ];
29048
29048
  function UF({ ui: e }) {
29049
29049
  RF();
29050
- let t = e?.panelWidth ?? 420, n = e?.panelHeight ?? "100%", r = e?.panelHeaderHeight ?? 56, i = e?.zIndex ?? VF, a = e?.fabBottomOffset ?? BF.bottom, o = e?.fabRightOffset ?? BF.right, [s, c] = y(a), l = {
29051
- bottom: s,
29052
- right: o
29053
- }, { isOpen: d, open: p, close: m } = zF({
29050
+ let t = e?.panelWidth ?? 420, n = e?.panelHeight ?? "100%", r = e?.panelHeaderHeight ?? 56, i = e?.zIndex ?? VF, a = {
29051
+ bottom: e?.fabBottomOffset ?? BF.bottom,
29052
+ right: e?.fabRightOffset ?? BF.right
29053
+ }, { isOpen: o, open: s, close: c } = zF({
29054
29054
  defaultOpen: !1,
29055
29055
  persist: !0
29056
- }), { messages: h, composerText: g, setComposerText: b, isLoading: x, error: S, sendMessage: C, sendInitialMessage: D, canSend: O } = OF(), { runtimeInfo: k, refreshRuntimeInfo: A } = kF(), j = MF([h.length, x]), { isListening: M, isSupported: N, startListening: P, stopListening: F, reset: ee } = NF({
29056
+ }), { messages: l, composerText: d, setComposerText: p, isLoading: m, error: h, sendMessage: g, sendInitialMessage: y, canSend: b } = OF(), { runtimeInfo: x, refreshRuntimeInfo: S } = kF(), C = MF([l.length, m]), { isListening: D, isSupported: O, startListening: k, stopListening: A, reset: j } = NF({
29057
29057
  lang: PF(),
29058
29058
  continuous: !0,
29059
29059
  pauseOnSubmit: !0,
29060
- onTextChange: b
29061
- }), te = _(() => /* @__PURE__ */ T(Xd, {
29060
+ onTextChange: p
29061
+ }), M = _(() => /* @__PURE__ */ T(Xd, {
29062
29062
  fw: 800,
29063
29063
  children: e?.panelTitle ?? "Agent Chat"
29064
- }), [e?.panelTitle]), I = v(Math.max(280, t)), L = v(null), R = u((e) => {
29065
- if (typeof window > "u") return;
29066
- if (!e) {
29067
- c(a);
29068
- return;
29069
- }
29070
- let t = e.getBoundingClientRect();
29071
- c(a + Math.max(0, window.innerHeight - t.bottom));
29072
- }, [a]), ne = u(() => {
29064
+ }), [e?.panelTitle]), N = v(Math.max(280, t)), P = v(null), F = u(() => {
29073
29065
  if (typeof document > "u") return null;
29074
29066
  let t = [...typeof e?.hostContainerSelector == "string" ? e.hostContainerSelector.split(",").map((e) => e.trim()).filter(Boolean) : [], ...HF];
29075
29067
  for (let e of t) {
@@ -29077,101 +29069,93 @@ function UF({ ui: e }) {
29077
29069
  if (t) return t;
29078
29070
  }
29079
29071
  return document.body;
29080
- }, [e?.hostContainerSelector]), re = u((e) => {
29072
+ }, [e?.hostContainerSelector]), ee = u((e) => {
29081
29073
  if (typeof document > "u") return;
29082
29074
  let t = document.documentElement;
29083
29075
  if (e === null ? t.style.removeProperty("--agent-widget-panel-width") : t.style.setProperty("--agent-widget-panel-width", `${e}px`), typeof window > "u") return;
29084
29076
  if (e === null) {
29085
- if (L.current) {
29086
- let { element: e, inlinePaddingBefore: t, inlineWidthBefore: n } = L.current;
29087
- e.style.paddingRight = t, e.style.width = n, L.current = null;
29077
+ if (P.current) {
29078
+ let { element: e, inlinePaddingBefore: t } = P.current;
29079
+ e.style.paddingRight = t, P.current = null;
29088
29080
  }
29089
- R(null);
29090
29081
  return;
29091
29082
  }
29092
- let n = L.current?.element ?? null;
29093
- if ((!n || !document.contains(n)) && (n = ne(), L.current = null), !n) {
29094
- R(null);
29095
- return;
29083
+ if (!P.current || !document.contains(P.current.element)) {
29084
+ let e = F();
29085
+ if (!e) return;
29086
+ P.current = {
29087
+ element: e,
29088
+ inlinePaddingBefore: e.style.paddingRight,
29089
+ widthApplied: 0
29090
+ };
29096
29091
  }
29097
- L.current ||= {
29098
- element: n,
29099
- inlinePaddingBefore: n.style.paddingRight,
29100
- inlineWidthBefore: n.style.width
29101
- }, n.style.paddingRight = "", n.style.width = `max(0px, calc(100vw - ${e}px))`, R(n);
29102
- }, [ne, R]), ie = v(!1), ae = () => {
29103
- M && F(), ee(), C(g);
29104
- }, oe = () => {
29105
- M ? F() : (b(""), P());
29106
- }, z = () => {
29107
- M && F(), m();
29108
- }, se = async () => {
29109
- p(), ie.current || (ie.current = !0, await A(), await D());
29092
+ let { element: n, inlinePaddingBefore: r, widthApplied: i } = P.current;
29093
+ e !== i && (n.style.paddingRight = r, n.style.paddingRight = `calc(${r || "0px"} + ${e}px)`, P.current.widthApplied = e);
29094
+ }, [F]), te = v(!1), I = () => {
29095
+ D && A(), j(), g(d);
29096
+ }, L = () => {
29097
+ D ? A() : (p(""), k());
29098
+ }, R = () => {
29099
+ D && A(), c();
29100
+ }, ne = async () => {
29101
+ s(), te.current || (te.current = !0, await S(), await y());
29110
29102
  };
29111
29103
  f(() => {
29112
- d && !ie.current && (ie.current = !0, (async () => {
29113
- await A(), await D();
29104
+ o && !te.current && (te.current = !0, (async () => {
29105
+ await S(), await y();
29114
29106
  })());
29115
- }, [d]);
29116
- let ce = AF({
29107
+ }, [o]);
29108
+ let re = AF({
29117
29109
  axis: "x",
29118
29110
  direction: -1,
29119
29111
  onResizeChange: u((e) => {
29120
29112
  let n = Math.max(280, t + e);
29121
- I.current = n, re(n);
29122
- }, [t, re])
29113
+ N.current = n, ee(n);
29114
+ }, [t, ee])
29123
29115
  });
29124
29116
  return f(() => {
29125
29117
  let e = Math.max(280, t);
29126
- I.current = e, d && re(e);
29118
+ N.current = e, o && ee(e);
29127
29119
  }, [
29128
29120
  t,
29129
- d,
29130
- re
29121
+ o,
29122
+ ee
29131
29123
  ]), f(() => {
29132
29124
  if (!(typeof document > "u")) {
29133
- if (!d) {
29134
- re(null), document.documentElement.removeAttribute("data-agent-widget-open");
29125
+ if (!o) {
29126
+ ee(null), document.documentElement.removeAttribute("data-agent-widget-open");
29135
29127
  return;
29136
29128
  }
29137
29129
  return document.documentElement.setAttribute("data-agent-widget-open", "true"), () => {
29138
- re(null), document.documentElement.removeAttribute("data-agent-widget-open");
29130
+ ee(null), document.documentElement.removeAttribute("data-agent-widget-open");
29139
29131
  };
29140
29132
  }
29141
- }, [d, re]), f(() => {
29142
- if (typeof window > "u") return;
29143
- let e = () => {
29144
- R(L.current?.element ?? ne() ?? null);
29145
- };
29146
- return window.addEventListener("resize", e), () => {
29147
- window.removeEventListener("resize", e);
29148
- };
29149
- }, [ne, R]), /* @__PURE__ */ E(w, { children: [!d && /* @__PURE__ */ T(GO, {
29150
- onClick: () => void se(),
29133
+ }, [o, ee]), /* @__PURE__ */ E(w, { children: [!o && /* @__PURE__ */ T(GO, {
29134
+ onClick: () => void ne(),
29151
29135
  zIndex: i,
29152
- position: l,
29136
+ position: a,
29153
29137
  color: e?.accentColor,
29154
29138
  label: e?.fabButtonLabel
29155
- }), d && /* @__PURE__ */ T(zO, {
29139
+ }), o && /* @__PURE__ */ T(zO, {
29156
29140
  visible: !0,
29157
- onClose: z,
29158
- messages: h,
29159
- composerText: g,
29160
- onComposerTextChange: b,
29161
- isLoading: x,
29162
- error: S,
29163
- canSend: O,
29164
- onSubmit: ae,
29165
- isListening: M,
29166
- isVoiceSupported: N,
29167
- onToggleVoice: oe,
29168
- panelTitle: te,
29169
- runtimeInfo: k,
29170
- scrollViewportRef: j,
29141
+ onClose: R,
29142
+ messages: l,
29143
+ composerText: d,
29144
+ onComposerTextChange: p,
29145
+ isLoading: m,
29146
+ error: h,
29147
+ canSend: b,
29148
+ onSubmit: I,
29149
+ isListening: D,
29150
+ isVoiceSupported: O,
29151
+ onToggleVoice: L,
29152
+ panelTitle: M,
29153
+ runtimeInfo: x,
29154
+ scrollViewportRef: C,
29171
29155
  panelWidth: t,
29172
29156
  panelHeight: n,
29173
29157
  panelHeaderHeight: r,
29174
- panelResizableWidth: ce,
29158
+ panelResizableWidth: re,
29175
29159
  zIndex: i
29176
29160
  })] });
29177
29161
  }