@tavus/embed 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3015,7 +3015,7 @@ var Mn = class extends Error {
3015
3015
  }
3016
3016
  }, Nn = {
3017
3017
  name: "@tavus/embed",
3018
- version: "0.15.0",
3018
+ version: "0.16.0",
3019
3019
  variant: "embed"
3020
3020
  }, Pn = /* @__PURE__ */ new Set([
3021
3021
  "Error",
@@ -28763,7 +28763,10 @@ function FF(e) {
28763
28763
  let t = NF(e)?.state;
28764
28764
  return t === "success" || t === "error";
28765
28765
  }
28766
- function IF(e, t, n) {
28766
+ function IF(e) {
28767
+ return NF(e)?.state === "error";
28768
+ }
28769
+ function LF(e, t, n) {
28767
28770
  let r = `${t + 8}px`;
28768
28771
  if (n === void 0 || !Number.isFinite(n) || n <= 0) return {
28769
28772
  left: "1rem",
@@ -28777,7 +28780,7 @@ function IF(e, t, n) {
28777
28780
  bottom: r
28778
28781
  };
28779
28782
  }
28780
- function LF(e) {
28783
+ function RF(e) {
28781
28784
  let t = e?.trim();
28782
28785
  if (!t) return kF * jF();
28783
28786
  let n = Number.parseFloat(t);
@@ -28785,8 +28788,8 @@ function LF(e) {
28785
28788
  if (t.endsWith("rem")) return n * jF();
28786
28789
  if (t.endsWith("px")) return n;
28787
28790
  }
28788
- function RF(e, t) {
28789
- let n = e["--color-neutral"], r = e["--color-neutral-content"], i = LF(e["--radius-field"]);
28791
+ function zF(e, t) {
28792
+ let n = e["--color-neutral"], r = e["--color-neutral-content"], i = RF(e["--radius-field"]);
28790
28793
  return {
28791
28794
  ...n ? { "--activity-bg": n } : {},
28792
28795
  ...r ? { "--activity-fg": r } : {},
@@ -28798,62 +28801,62 @@ function RF(e, t) {
28798
28801
  }
28799
28802
  //#endregion
28800
28803
  //#region ../core/src/magic-canvas/magic-canvas.tsx
28801
- var zF = 1e3, BF = 5e3, VF = 1200, HF = [2e3, 6e3];
28802
- async function UF(e, t, n) {
28803
- let r = new AbortController(), i = globalThis.setTimeout(() => r.abort(), BF);
28804
+ var BF = 1e3, VF = 5e3, HF = 1200, UF = [2e3, 6e3];
28805
+ async function WF(e, t, n) {
28806
+ let r = new AbortController(), i = globalThis.setTimeout(() => r.abort(), VF);
28804
28807
  try {
28805
28808
  await wn(e, t, n, { signal: r.signal });
28806
28809
  } finally {
28807
28810
  globalThis.clearTimeout(i);
28808
28811
  }
28809
28812
  }
28810
- function WF(e) {
28813
+ function GF(e) {
28811
28814
  return e instanceof vn && e.status >= 400 && e.status < 500 && e.status !== 408 && e.status !== 429;
28812
28815
  }
28813
- function GF(e, t) {
28816
+ function KF(e, t) {
28814
28817
  console.error("Magic Canvas interaction POST failed; this interaction may not have been recorded server-side.", e), t({
28815
28818
  lastInteractionPostResult: "error",
28816
- lastError: TI(e).message
28819
+ lastError: EI(e).message
28817
28820
  }, {
28818
28821
  error: e,
28819
28822
  operation: "canvas.bridge"
28820
28823
  });
28821
28824
  }
28822
- function KF(e) {
28825
+ function qF(e) {
28823
28826
  return e.content.some((e) => e.type === "text" && typeof e.text == "string" && e.text.trim() !== "");
28824
28827
  }
28825
- function qF(e, t, n, r) {
28828
+ function JF(e, t, n, r) {
28826
28829
  (async () => {
28827
28830
  let i;
28828
- for (let a of HF) {
28831
+ for (let a of UF) {
28829
28832
  await new Promise((e) => setTimeout(e, a));
28830
28833
  try {
28831
- await UF(e, t, n), r({
28834
+ await WF(e, t, n), r({
28832
28835
  lastInteractionPostResult: "recovered",
28833
28836
  lastError: void 0
28834
28837
  });
28835
28838
  return;
28836
28839
  } catch (e) {
28837
- if (i = e, WF(e)) break;
28840
+ if (i = e, GF(e)) break;
28838
28841
  }
28839
28842
  }
28840
- GF(i, r);
28843
+ KF(i, r);
28841
28844
  })();
28842
28845
  }
28843
- var JF = 2e3;
28844
- function YF(e) {
28845
- return e.correct_answer === void 0 ? VF : JF;
28846
+ var YF = 2e3;
28847
+ function XF(e) {
28848
+ return e.correct_answer === void 0 ? HF : YF;
28846
28849
  }
28847
- var XF = 48, ZF = 24, QF = "ui-monospace, SFMono-Regular, Menlo, monospace", $F = 160, eI = () => {}, tI = "allow-scripts", nI = {
28850
+ var ZF = 48, QF = 24, $F = "ui-monospace, SFMono-Regular, Menlo, monospace", eI = 160, tI = () => {}, nI = "allow-scripts", rI = {
28848
28851
  "canvas.scheduling_embed": "allow-scripts allow-same-origin allow-popups allow-forms",
28849
28852
  "canvas.text": "allow-scripts allow-popups allow-popups-to-escape-sandbox"
28850
28853
  };
28851
- function rI(e, t) {
28854
+ function iI(e, t) {
28852
28855
  if (!t.contentWindow || e.source !== t.contentWindow) return !1;
28853
28856
  let n = e.data;
28854
28857
  return !!n && typeof n == "object" && n?.jsonrpc === "2.0";
28855
28858
  }
28856
- var iI = class {
28859
+ var aI = class {
28857
28860
  onmessage;
28858
28861
  onerror;
28859
28862
  onclose;
@@ -28864,7 +28867,7 @@ var iI = class {
28864
28867
  }
28865
28868
  start() {
28866
28869
  let e = (e) => {
28867
- rI(e, this.#e) && this.onmessage?.(e.data);
28870
+ iI(e, this.#e) && this.onmessage?.(e.data);
28868
28871
  };
28869
28872
  return this.#t = e, globalThis.addEventListener("message", e), Promise.resolve();
28870
28873
  }
@@ -28875,12 +28878,12 @@ var iI = class {
28875
28878
  return this.#t && globalThis.removeEventListener("message", this.#t), this.#t = void 0, this.onclose?.(), Promise.resolve();
28876
28879
  }
28877
28880
  };
28878
- function aI(e) {
28879
- for (let t of fb) if (e.some((e) => xI(e) === t)) return t;
28881
+ function oI(e) {
28882
+ for (let t of fb) if (e.some((e) => SI(e) === t)) return t;
28880
28883
  return null;
28881
28884
  }
28882
- function oI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n = SI(), callPresence: r, callControlsVisible: i, callControlsRect: a, gridConfigEnabled: o, gridStartEnabled: s, onStatusStripChange: c } = {}) {
28883
- let { client: l, telemetry: u } = sh(), { dataTheme: d, cssVars: f } = cM(), p = If(), m = Lf(), [h, g] = j([]), [_, v] = j(null), [y, b] = j(!1), x = N(null), S = N(null), C = N(null), [w, T] = _I(), E = I(_t)?.surface, D = MF(E, T.width), ee = TF[D], O = y ? null : _, te = O ? ee + 8 : 0, ne = F(() => {
28885
+ function sI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n = CI(), callPresence: r, callControlsVisible: i, callControlsRect: a, gridConfigEnabled: o, gridStartEnabled: s, onStatusStripChange: c } = {}) {
28886
+ let { client: l, telemetry: u } = sh(), { isDark: d, cssVars: f } = cM(), p = If(), m = Lf(), [h, g] = j([]), [_, v] = j(null), [y, b] = j(!1), x = N(null), S = N(null), C = N(null), [w, T] = vI(), E = I(_t)?.surface, D = MF(E, T.width), ee = TF[D], O = y ? null : _, te = O ? ee + 8 : 0, ne = F(() => {
28884
28887
  S.current !== null && (clearTimeout(S.current), S.current = null);
28885
28888
  }, []), k = F(() => {
28886
28889
  C.current !== null && (clearTimeout(C.current), C.current = null);
@@ -28948,7 +28951,7 @@ function oI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28948
28951
  m,
28949
28952
  se
28950
28953
  ]), le = P(() => ({
28951
- theme: d.value === "dark" ? "dark" : "light",
28954
+ theme: d.value ? "dark" : "light",
28952
28955
  cssVars: f.value
28953
28956
  }), [d.value, f.value]);
28954
28957
  M(() => {
@@ -28972,13 +28975,10 @@ function oI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28972
28975
  try {
28973
28976
  let t = fx(e.data);
28974
28977
  if (!t) return;
28975
- let n = Ab(x.current, t);
28976
- if (n.consumed) {
28977
- if (!n.strip) re();
28978
- else if (FF(n.strip.arguments)) {
28979
- let e = x.current;
28980
- e !== null && e.tool_call_id === n.strip.tool_call_id && e.conversation_id === n.strip.conversation_id && ie();
28981
- } else ne(), k(), x.current = n.strip, b(!1), v(n.strip);
28978
+ let n = x.current, r = Ab(n, t);
28979
+ if (r.consumed) {
28980
+ let e = n !== null && r.strip !== null && n.tool_call_id === r.strip.tool_call_id && n.conversation_id === r.strip.conversation_id, t = C.current !== null;
28981
+ r.strip ? FF(r.strip.arguments) ? e && (IF(r.strip.arguments) && !t && (x.current = r.strip, v(r.strip)), ie()) : e && t || (ne(), k(), x.current = r.strip, b(!1), v(r.strip)) : re();
28982
28982
  } else g((e) => Eb(e, t));
28983
28983
  se({
28984
28984
  lastToolCall: e.data,
@@ -28989,7 +28989,7 @@ function oI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28989
28989
  } catch (e) {
28990
28990
  se({
28991
28991
  iframeLifecycleState: "error",
28992
- lastError: TI(e).message
28992
+ lastError: EI(e).message
28993
28993
  }, {
28994
28994
  error: e,
28995
28995
  operation: "canvas.validate"
@@ -29027,7 +29027,7 @@ function oI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
29027
29027
  de.safe_area?.width,
29028
29028
  de.safe_area?.height
29029
29029
  ]);
29030
- let pe = aI(ue.map(({ layout: e }) => e));
29030
+ let pe = oI(ue.map(({ layout: e }) => e));
29031
29031
  M(() => {
29032
29032
  t?.(pe);
29033
29033
  }, [t, pe]);
@@ -29036,7 +29036,7 @@ function oI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
29036
29036
  ref: w,
29037
29037
  "data-magic-canvas-root": !0,
29038
29038
  class: "pointer-events-none absolute inset-0 z-30",
29039
- style: `--mc-strip-band: ${te}px; --cvi-status-strip-drop: ${80 - ZF}px`,
29039
+ style: `--mc-strip-band: ${te}px; --cvi-status-strip-drop: ${80 - QF}px`,
29040
29040
  children: [
29041
29041
  me && fe && /* @__PURE__ */ L("div", { class: "absolute inset-0 bg-black/45" }),
29042
29042
  me && !fe && oe.sheetBottomPx !== null && /* @__PURE__ */ L("div", {
@@ -29047,15 +29047,15 @@ function oI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
29047
29047
  backgroundImage: "linear-gradient(to bottom, rgb(0 0 0 / 0.45) calc(100% - 64px), rgb(0 0 0 / 0))"
29048
29048
  }
29049
29049
  }),
29050
- me && ue.map(({ instance: e, layout: t, gridRect: n }) => /* @__PURE__ */ L(uI, {
29051
- slot: xI(t),
29050
+ me && ue.map(({ instance: e, layout: t, gridRect: n }) => /* @__PURE__ */ L(dI, {
29051
+ slot: SI(t),
29052
29052
  safeAreaTop: de.safe_area?.y,
29053
29053
  frameWidth: T.width,
29054
29054
  ...n ? {
29055
29055
  gridRect: n,
29056
29056
  gridAnimate: oe.animate
29057
29057
  } : {},
29058
- children: (r) => /* @__PURE__ */ L(dI, {
29058
+ children: (r) => /* @__PURE__ */ L(fI, {
29059
29059
  availableHeight: r,
29060
29060
  client: l,
29061
29061
  gridDriven: n !== null,
@@ -29081,7 +29081,7 @@ function oI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
29081
29081
  sendAppMessage: ce
29082
29082
  })
29083
29083
  }, e.id)),
29084
- _ && /* @__PURE__ */ L(sI, {
29084
+ _ && /* @__PURE__ */ L(cI, {
29085
29085
  client: l,
29086
29086
  controlsRect: a,
29087
29087
  density: D,
@@ -29101,7 +29101,7 @@ function oI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
29101
29101
  ]
29102
29102
  });
29103
29103
  }
29104
- function sI({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i, hostTheme: a, instance: o, onComplete: s, onDebug: c, sendAppMessage: l }) {
29104
+ function cI({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i, hostTheme: a, instance: o, onComplete: s, onDebug: c, sendAppMessage: l }) {
29105
29105
  let u = TF[n], d = {
29106
29106
  ...o.layout,
29107
29107
  preferred_slot: "safe-area-bottom",
@@ -29111,7 +29111,7 @@ function sI({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i,
29111
29111
  ...a,
29112
29112
  cssVars: {
29113
29113
  ...a.cssVars,
29114
- "--font-mono": QF
29114
+ "--font-mono": $F
29115
29115
  },
29116
29116
  activity: {
29117
29117
  density: n,
@@ -29120,13 +29120,13 @@ function sI({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i,
29120
29120
  }), [n, a]);
29121
29121
  return /* @__PURE__ */ L("div", {
29122
29122
  class: "cvi-status-strip absolute flex justify-center",
29123
- style: IF(t, 72, i),
29123
+ style: LF(t, 72, i),
29124
29124
  "data-canvas-status-strip": !0,
29125
- children: /* @__PURE__ */ L(cI, {
29125
+ children: /* @__PURE__ */ L(lI, {
29126
29126
  exiting: r,
29127
29127
  instanceId: o.id,
29128
- children: /* @__PURE__ */ L(dI, {
29129
- availableHeight: $F,
29128
+ children: /* @__PURE__ */ L(fI, {
29129
+ availableHeight: eI,
29130
29130
  client: e,
29131
29131
  fixedHeightPx: u,
29132
29132
  hostTheme: f,
@@ -29134,15 +29134,15 @@ function sI({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i,
29134
29134
  layout: d,
29135
29135
  onComplete: s,
29136
29136
  onDebug: c,
29137
- onDisplayModeChange: eI,
29138
- onNaturalHeightChange: eI,
29137
+ onDisplayModeChange: tI,
29138
+ onNaturalHeightChange: tI,
29139
29139
  sendAppMessage: l,
29140
29140
  variant: "strip"
29141
29141
  })
29142
29142
  })
29143
29143
  });
29144
29144
  }
29145
- function cI({ exiting: e, instanceId: t, children: n }) {
29145
+ function lI({ exiting: e, instanceId: t, children: n }) {
29146
29146
  let r = N(null);
29147
29147
  return Xe(() => {
29148
29148
  let t = r.current;
@@ -29178,9 +29178,9 @@ function cI({ exiting: e, instanceId: t, children: n }) {
29178
29178
  children: n
29179
29179
  });
29180
29180
  }
29181
- var lI = 16;
29182
- function uI({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate: i = !1, children: a }) {
29183
- let [o, s] = vI(), c = a(r ? r.height : e === "full" ? void 0 : s);
29181
+ var uI = 16;
29182
+ function dI({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate: i = !1, children: a }) {
29183
+ let [o, s] = yI(), c = a(r ? r.height : e === "full" ? void 0 : s);
29184
29184
  if (r) return /* @__PURE__ */ L("div", {
29185
29185
  ref: o,
29186
29186
  class: "pointer-events-auto absolute",
@@ -29196,7 +29196,7 @@ function uI({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
29196
29196
  let r = t == null ? "1rem" : `${t * 100}%`, i = n != null && n > 0 ? Math.max(0, n - 32) : void 0;
29197
29197
  return /* @__PURE__ */ L("div", {
29198
29198
  ref: o,
29199
- class: `cvi-strip-lift ${bI(e)}`,
29199
+ class: `cvi-strip-lift ${xI(e)}`,
29200
29200
  style: {
29201
29201
  top: r,
29202
29202
  bottom: "calc(72px + var(--mc-strip-band, 0px))",
@@ -29211,8 +29211,8 @@ function uI({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
29211
29211
  }
29212
29212
  return e === "safe-area-bottom" ? /* @__PURE__ */ L("div", {
29213
29213
  ref: o,
29214
- class: bI(e),
29215
- style: { top: `${lI}px` },
29214
+ class: xI(e),
29215
+ style: { top: `${uI}px` },
29216
29216
  "data-canvas-slot": e,
29217
29217
  children: /* @__PURE__ */ L("div", {
29218
29218
  class: "contents",
@@ -29220,7 +29220,7 @@ function uI({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
29220
29220
  })
29221
29221
  }) : /* @__PURE__ */ L("div", {
29222
29222
  ref: o,
29223
- class: bI(e),
29223
+ class: xI(e),
29224
29224
  "data-canvas-slot": e,
29225
29225
  children: /* @__PURE__ */ L("div", {
29226
29226
  class: "contents",
@@ -29228,7 +29228,7 @@ function uI({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
29228
29228
  })
29229
29229
  });
29230
29230
  }
29231
- function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard: r = !1, hostTheme: i, instance: a, layout: o, dimmed: s, onDebug: c, onComplete: l, onDisplayModeChange: u, onNaturalHeightChange: d, sendAppMessage: f, variant: p = "card", fixedHeightPx: m }) {
29231
+ function fI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard: r = !1, hostTheme: i, instance: a, layout: o, dimmed: s, onDebug: c, onComplete: l, onDisplayModeChange: u, onNaturalHeightChange: d, sendAppMessage: f, variant: p = "card", fixedHeightPx: m }) {
29232
29232
  let h = p === "strip", g = m ?? 720, _ = N(null), v = N(null), y = N(e), b = N(r), x = N(m ?? 320), S = N({
29233
29233
  fixed: m,
29234
29234
  max: g
@@ -29241,17 +29241,17 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29241
29241
  }, [m, g]), M(() => {
29242
29242
  w.current = a;
29243
29243
  }, [a]), M(() => {
29244
- x.current = ne, v.current?.setHostContext(hI(w.current, C.current, T.current, y.current, ne, b.current));
29244
+ x.current = ne, v.current?.setHostContext(gI(w.current, C.current, T.current, y.current, ne, b.current));
29245
29245
  }, [ne]), M(() => {
29246
29246
  y.current = e, b.current = r;
29247
- let t = mI(i, _.current);
29248
- C.current = t, v.current?.setHostContext(hI(w.current, t, T.current, e, x.current, r));
29247
+ let t = hI(i, _.current);
29248
+ C.current = t, v.current?.setHostContext(gI(w.current, t, T.current, e, x.current, r));
29249
29249
  }, [
29250
29250
  e,
29251
29251
  i,
29252
29252
  r
29253
29253
  ]), M(() => {
29254
- T.current = o, v.current?.setHostContext(hI(w.current, C.current, o, e, x.current, b.current));
29254
+ T.current = o, v.current?.setHostContext(gI(w.current, C.current, o, e, x.current, b.current));
29255
29255
  }, [e, o]), M(() => {
29256
29256
  D.current = l, ee.current = u, O.current = d, te.current = f;
29257
29257
  }, [
@@ -29265,7 +29265,7 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29265
29265
  let n = !1, r = null, i = null, o = null, s = null, l = new URL(a.canvas_config.sandbox_url, globalThis.location.href).href, u = (e) => {
29266
29266
  n || c({
29267
29267
  iframeLifecycleState: "error",
29268
- lastError: TI(e).message
29268
+ lastError: EI(e).message
29269
29269
  }, {
29270
29270
  error: e,
29271
29271
  operation: "canvas.bridge"
@@ -29302,18 +29302,18 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29302
29302
  text: {},
29303
29303
  structuredContent: {}
29304
29304
  }
29305
- }, { hostContext: hI(a, mI(C.current, e), T.current, y.current, x.current, b.current) });
29305
+ }, { hostContext: gI(a, hI(C.current, e), T.current, y.current, x.current, b.current) });
29306
29306
  r = f, v.current = f, f.oninitialized = () => {
29307
29307
  n || (c({ iframeLifecycleState: "ready" }), E.current = w.current.revision, f.sendToolInput({ arguments: w.current.arguments }).catch(u));
29308
29308
  }, f.onsizechange = ({ height: e }) => {
29309
29309
  if (!n && typeof e == "number" && Number.isFinite(e)) {
29310
- let { fixed: t, max: n } = S.current, r = t === void 0 ? Math.min(Math.max(e, XF), n) : e === t ? t : Math.min(e, $F);
29310
+ let { fixed: t, max: n } = S.current, r = t === void 0 ? Math.min(Math.max(e, ZF), n) : e === t ? t : Math.min(e, eI);
29311
29311
  k(r), O.current(w.current.id, r);
29312
29312
  }
29313
29313
  }, f.onmessage = async (e) => {
29314
29314
  let r = jb(e);
29315
29315
  if (!r) {
29316
- if (KF(e)) {
29316
+ if (qF(e)) {
29317
29317
  let e = "Magic Canvas message included text without interaction metadata; no interaction row was recorded.";
29318
29318
  return c({
29319
29319
  lastInteractionPostResult: "error",
@@ -29338,7 +29338,7 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29338
29338
  }
29339
29339
  })();
29340
29340
  if ("error" in a) {
29341
- let e = TI(a.error).message;
29341
+ let e = EI(a.error).message;
29342
29342
  return c({
29343
29343
  lastInteractionPostResult: "error",
29344
29344
  lastError: e
@@ -29355,19 +29355,19 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29355
29355
  try {
29356
29356
  u = Pb(e, o);
29357
29357
  } catch (e) {
29358
- c({ lastError: TI(e).message }), o.type === "submit" && console.warn("Magic Canvas dropped the response text of a submitted card.", e);
29358
+ c({ lastError: EI(e).message }), o.type === "submit" && console.warn("Magic Canvas dropped the response text of a submitted card.", e);
29359
29359
  }
29360
29360
  let d = !0;
29361
29361
  try {
29362
- await UF(t, o.conversation_id, l.body);
29362
+ await WF(t, o.conversation_id, l.body);
29363
29363
  } catch (e) {
29364
- d = !1, WF(e) ? GF(e, c) : (console.warn("Magic Canvas interaction POST failed; continuing without it and retrying in the background.", e), c({
29364
+ d = !1, GF(e) ? KF(e, c) : (console.warn("Magic Canvas interaction POST failed; continuing without it and retrying in the background.", e), c({
29365
29365
  lastInteractionPostResult: "failed_open",
29366
- lastError: TI(e).message
29366
+ lastError: EI(e).message
29367
29367
  }, {
29368
29368
  error: e,
29369
29369
  operation: "canvas.bridge"
29370
- }), qF(t, o.conversation_id, l.body, c));
29370
+ }), JF(t, o.conversation_id, l.body, c));
29371
29371
  }
29372
29372
  if (n) return {};
29373
29373
  if (u) try {
@@ -29378,7 +29378,7 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29378
29378
  properties: { text: u }
29379
29379
  });
29380
29380
  } catch (e) {
29381
- console.error("Magic Canvas respond send failed.", e), c({ lastError: TI(e).message }, {
29381
+ console.error("Magic Canvas respond send failed.", e), c({ lastError: EI(e).message }, {
29382
29382
  error: e,
29383
29383
  operation: "canvas.bridge"
29384
29384
  });
@@ -29388,18 +29388,18 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29388
29388
  lastError: void 0
29389
29389
  }), Nb(o) && (o.type === "submit" ? (s && clearTimeout(s), s = setTimeout(() => {
29390
29390
  s = null, n || D.current();
29391
- }, YF(i.arguments))) : D.current()), {};
29391
+ }, XF(i.arguments))) : D.current()), {};
29392
29392
  }, f.onupdatemodelcontext = async (e) => (i = e, o ||= setTimeout(() => {
29393
29393
  o = null, d();
29394
- }, zF), {}), f.onrequestdisplaymode = async ({ mode: e }) => {
29394
+ }, BF), {}), f.onrequestdisplaymode = async ({ mode: e }) => {
29395
29395
  if (h) return { mode: "inline" };
29396
29396
  let t = e === "fullscreen" ? "fullscreen" : "inline";
29397
29397
  return ee.current(t), T.current = {
29398
29398
  ...T.current,
29399
29399
  display_mode: t,
29400
29400
  viable_slot: t === "fullscreen" ? "full" : T.current.viable_slot
29401
- }, f.setHostContext(hI(w.current, C.current, T.current, y.current, x.current, b.current)), { mode: t };
29402
- }, f.connect(new iI(e)).then(() => void 0).catch(u);
29401
+ }, f.setHostContext(gI(w.current, C.current, T.current, y.current, x.current, b.current)), { mode: t };
29402
+ }, f.connect(new aI(e)).then(() => void 0).catch(u);
29403
29403
  };
29404
29404
  c({
29405
29405
  iframeLifecycleState: "mounting",
@@ -29421,7 +29421,7 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29421
29421
  a.revision !== 0 && (a.revision <= E.current || (E.current = a.revision, v.current?.sendToolInput({ arguments: a.arguments }).catch((e) => {
29422
29422
  c({
29423
29423
  iframeLifecycleState: "error",
29424
- lastError: TI(e).message
29424
+ lastError: EI(e).message
29425
29425
  }, {
29426
29426
  error: e,
29427
29427
  operation: "canvas.bridge"
@@ -29432,7 +29432,7 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29432
29432
  a.revision,
29433
29433
  c
29434
29434
  ]);
29435
- let re = o.viable_slot === "full" || o.display_mode === "fullscreen", ie = re ? null : gI(ne, e, r), ae = ie?.placeholderStyle, A = ie?.cardStyle, oe = re ? { height: "100%" } : ie?.iframeStyle ?? {
29435
+ let re = o.viable_slot === "full" || o.display_mode === "fullscreen", ie = re ? null : _I(ne, e, r), ae = ie?.placeholderStyle, A = ie?.cardStyle, oe = re ? { height: "100%" } : ie?.iframeStyle ?? {
29436
29436
  width: "100%",
29437
29437
  height: `${ne}px`
29438
29438
  }, se = h ? "pointer-events-auto w-full overflow-hidden" : [
@@ -29440,7 +29440,7 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29440
29440
  r ? "" : "shadow-xl",
29441
29441
  re ? "fixed inset-4 z-10 max-w-none" : n ? "max-w-none" : "max-w-md",
29442
29442
  s ? "scale-[0.98] opacity-40" : ""
29443
- ].filter(Boolean).join(" "), ce = nI[a.canvas_config.component] ?? tI, le = /* @__PURE__ */ L("div", {
29443
+ ].filter(Boolean).join(" "), ce = rI[a.canvas_config.component] ?? nI, le = /* @__PURE__ */ L("div", {
29444
29444
  class: se,
29445
29445
  style: A,
29446
29446
  ...h ? { "data-canvas-strip": o.viable_slot } : { "data-canvas-card": o.viable_slot },
@@ -29459,7 +29459,7 @@ function dI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29459
29459
  children: le
29460
29460
  });
29461
29461
  }
29462
- var fI = [
29462
+ var pI = [
29463
29463
  "--color-base-100",
29464
29464
  "--color-base-200",
29465
29465
  "--color-base-300",
@@ -29469,17 +29469,17 @@ var fI = [
29469
29469
  "--color-neutral",
29470
29470
  "--color-neutral-content"
29471
29471
  ];
29472
- function pI(e) {
29472
+ function mI(e) {
29473
29473
  if (!e || typeof getComputedStyle != "function") return {};
29474
29474
  let t = getComputedStyle(e), n = {};
29475
- for (let e of fI) {
29475
+ for (let e of pI) {
29476
29476
  let r = t.getPropertyValue(e).trim();
29477
29477
  r && (n[e] = r);
29478
29478
  }
29479
29479
  return n;
29480
29480
  }
29481
- function mI(e, t) {
29482
- let n = pI(t);
29481
+ function hI(e, t) {
29482
+ let n = mI(t);
29483
29483
  return Object.keys(n).length === 0 ? e : {
29484
29484
  ...e,
29485
29485
  cssVars: {
@@ -29488,20 +29488,20 @@ function mI(e, t) {
29488
29488
  }
29489
29489
  };
29490
29490
  }
29491
- function hI(e, t, n, r, i, a = !1) {
29492
- let o = mx(t, n), s = n.viable_slot === "full" || n.display_mode === "fullscreen", c = s ? void 0 : CI(r), l = t.activity ? RF(t.cssVars, t.activity) : {}, u = s ? 1 : gI(i ?? 0, r, a)?.displayScale ?? 1;
29491
+ function gI(e, t, n, r, i, a = !1) {
29492
+ let o = mx(t, n), s = n.viable_slot === "full" || n.display_mode === "fullscreen", c = s ? void 0 : wI(r), l = t.activity ? zF(t.cssVars, t.activity) : {}, u = s ? 1 : _I(i ?? 0, r, a)?.displayScale ?? 1;
29493
29493
  return {
29494
29494
  ...e.canvas_config.host_context,
29495
29495
  ...o,
29496
29496
  ...l,
29497
29497
  containerDimensions: {
29498
- ...wI(o.containerDimensions) ? o.containerDimensions : {},
29498
+ ...TI(o.containerDimensions) ? o.containerDimensions : {},
29499
29499
  ...c === void 0 ? {} : { maxHeight: c },
29500
29500
  displayScale: u
29501
29501
  }
29502
29502
  };
29503
29503
  }
29504
- function gI(e, t, n = !1) {
29504
+ function _I(e, t, n = !1) {
29505
29505
  if (t === void 0 || !Number.isFinite(t) || t <= 0) return null;
29506
29506
  let r = Math.min(e, 720);
29507
29507
  if (n) return {
@@ -29541,11 +29541,11 @@ function gI(e, t, n = !1) {
29541
29541
  }
29542
29542
  };
29543
29543
  }
29544
- function _I() {
29545
- let e = N(null), [t, n] = j(() => yI(null));
29544
+ function vI() {
29545
+ let e = N(null), [t, n] = j(() => bI(null));
29546
29546
  return M(() => {
29547
29547
  let t = () => n((t) => {
29548
- let n = yI(e.current);
29548
+ let n = bI(e.current);
29549
29549
  return t.width === n.width && t.height === n.height && t.visualViewportHeight === n.visualViewportHeight ? t : n;
29550
29550
  });
29551
29551
  t(), globalThis.addEventListener("resize", t), globalThis.visualViewport?.addEventListener("resize", t);
@@ -29555,7 +29555,7 @@ function _I() {
29555
29555
  };
29556
29556
  }, []), [e, t];
29557
29557
  }
29558
- function vI() {
29558
+ function yI() {
29559
29559
  let e = N(null), [t, n] = j();
29560
29560
  return M(() => {
29561
29561
  let t = e.current;
@@ -29571,7 +29571,7 @@ function vI() {
29571
29571
  return a.observe(t), () => a.disconnect();
29572
29572
  }, []), [e, t];
29573
29573
  }
29574
- function yI(e) {
29574
+ function bI(e) {
29575
29575
  let t = globalThis.visualViewport?.height, n = e?.getBoundingClientRect();
29576
29576
  if (n && n.width > 0 && n.height > 0) {
29577
29577
  let e = t === void 0 ? void 0 : Math.max(0, (globalThis.innerHeight || 0) - t);
@@ -29587,7 +29587,7 @@ function yI(e) {
29587
29587
  visualViewportHeight: t
29588
29588
  };
29589
29589
  }
29590
- function bI(e) {
29590
+ function xI(e) {
29591
29591
  let t = "absolute flex gap-2";
29592
29592
  switch (e) {
29593
29593
  case "safe-area-left": return `${t} left-4 w-[28rem] flex-col overflow-y-auto [scrollbar-gutter:stable]`;
@@ -29596,24 +29596,24 @@ function bI(e) {
29596
29596
  case "full": return `${t} inset-4 flex-col items-stretch justify-stretch`;
29597
29597
  }
29598
29598
  }
29599
- function xI(e) {
29599
+ function SI(e) {
29600
29600
  return e.display_mode === "fullscreen" && e.preferred_slot !== "full" ? e.preferred_slot : e.viable_slot;
29601
29601
  }
29602
- function SI() {
29602
+ function CI() {
29603
29603
  return !1;
29604
29604
  }
29605
- function CI(e) {
29605
+ function wI(e) {
29606
29606
  return e === void 0 || !Number.isFinite(e) || e <= 0 ? 720 : Math.min(Math.floor(e), 720);
29607
29607
  }
29608
- function wI(e) {
29608
+ function TI(e) {
29609
29609
  return typeof e == "object" && !!e && !Array.isArray(e);
29610
29610
  }
29611
- function TI(e) {
29611
+ function EI(e) {
29612
29612
  return e instanceof Error ? e : Error(String(e));
29613
29613
  }
29614
29614
  //#endregion
29615
29615
  //#region ../core/src/magic-canvas/grid-error-boundary.tsx
29616
- var EI = class extends D {
29616
+ var DI = class extends D {
29617
29617
  state = { errored: !1 };
29618
29618
  componentDidCatch(e) {
29619
29619
  this.props.onError(e), this.setState({ errored: !0 });
@@ -29621,8 +29621,8 @@ var EI = class extends D {
29621
29621
  render() {
29622
29622
  return this.state.errored ? null : this.props.children;
29623
29623
  }
29624
- }, DI = 1e4;
29625
- function OI(e, t = DI) {
29624
+ }, OI = 1e4;
29625
+ function kI(e, t = OI) {
29626
29626
  let [n, r] = j(!1), i = N(!1);
29627
29627
  return M(() => {
29628
29628
  if (!e) {
@@ -29637,7 +29637,7 @@ function OI(e, t = DI) {
29637
29637
  }
29638
29638
  //#endregion
29639
29639
  //#region ../core/src/hooks/use-call-presence.ts
29640
- function kI(e) {
29640
+ function AI(e) {
29641
29641
  let t = Rf(), n = Wf(t ?? ""), r = !Kf(t ?? "").isOff, i = Wy(e), a = i.phase === "ready" ? i.replicaId : "", o = Kf(a), s = !r && (o.state === "playable" || o.state === "loading"), c = i.phase === "ready" && !e && !i.videoState.isOff, l = !e && t !== null && !n.isOff, u = i.phase !== "ready" || i.videoState.isOff;
29642
29642
  return P(() => ({
29643
29643
  presence: i,
@@ -29659,7 +29659,7 @@ function kI(e) {
29659
29659
  }
29660
29660
  //#endregion
29661
29661
  //#region ../core/src/hooks/use-call-controls-visible.ts
29662
- function AI(e, t, n) {
29662
+ function jI(e, t, n) {
29663
29663
  let [r, i] = j(!0);
29664
29664
  return M(() => {
29665
29665
  if (!t) return;
@@ -29689,7 +29689,7 @@ function AI(e, t, n) {
29689
29689
  }
29690
29690
  //#endregion
29691
29691
  //#region ../core/src/hooks/use-call-controls-rect.ts
29692
- function jI(e, t, n, r, i) {
29692
+ function MI(e, t, n, r, i) {
29693
29693
  let [a, o] = j(void 0);
29694
29694
  return M(() => {
29695
29695
  if (!r) return;
@@ -29723,8 +29723,8 @@ function jI(e, t, n, r, i) {
29723
29723
  }
29724
29724
  //#endregion
29725
29725
  //#region ../core/src/hooks/use-replica-join-timeout.ts
29726
- var MI = 1e4;
29727
- function NI({ onTimeout: e, timeoutMs: t = MI, active: n = !0 }) {
29726
+ var NI = 1e4;
29727
+ function PI({ onTimeout: e, timeoutMs: t = NI, active: n = !0 }) {
29728
29728
  let r = Uy().length > 0, [i, a] = j(!1), o = N(e);
29729
29729
  return M(() => {
29730
29730
  o.current = e;
@@ -29748,39 +29748,39 @@ function NI({ onTimeout: e, timeoutMs: t = MI, active: n = !0 }) {
29748
29748
  }
29749
29749
  //#endregion
29750
29750
  //#region ../core/src/hooks/use-system-shutdown.ts
29751
- function PI(e) {
29751
+ function FI(e) {
29752
29752
  if (typeof e != "object" || !e) return !1;
29753
29753
  let t = e;
29754
29754
  return t.message_type === "system" && t.event_type === "system.shutdown";
29755
29755
  }
29756
- function FI({ onShutdown: e }) {
29756
+ function II({ onShutdown: e }) {
29757
29757
  let t = N(e);
29758
29758
  M(() => {
29759
29759
  t.current = e;
29760
29760
  }, [e]), Vf({ onAppMessage: F((e) => {
29761
- PI(e?.data) && t.current();
29761
+ FI(e?.data) && t.current();
29762
29762
  }, []) });
29763
29763
  }
29764
29764
  //#endregion
29765
29765
  //#region ../core/src/hooks/use-picture-in-picture.ts
29766
- var II = fn("PiP"), LI = 360, RI = 280;
29767
- function zI() {
29766
+ var LI = fn("PiP"), RI = 360, zI = 280;
29767
+ function BI() {
29768
29768
  return globalThis.window !== void 0 && "documentPictureInPicture" in globalThis.window;
29769
29769
  }
29770
- function BI(e) {
29771
- let { enabled: t, active: n } = e, [r, i] = j(null), a = zI(), o = I(Fh), s = F(() => {
29770
+ function VI(e) {
29771
+ let { enabled: t, active: n } = e, [r, i] = j(null), a = BI(), o = I(Fh), s = F(() => {
29772
29772
  i((e) => (e && !e.closed && e.close(), null));
29773
29773
  }, []), c = F(async () => {
29774
29774
  if (a && t && n && (!r || r.closed)) try {
29775
29775
  let e = await globalThis.window.documentPictureInPicture.requestWindow({
29776
- width: LI,
29777
- height: RI
29776
+ width: RI,
29777
+ height: zI
29778
29778
  }), t = Pe.replace(/:host(?=[\s,{])/g, ":host, :root"), n = e.document.createElement("style");
29779
29779
  n.textContent = t, e.document.head.appendChild(n), e.document.body.style.margin = "0", e.document.body.style.width = "100%", e.document.body.style.height = "100vh", e.document.body.style.overflow = "hidden", e.addEventListener("pagehide", () => {
29780
29780
  i((t) => t === e ? null : t);
29781
29781
  }, { once: !0 }), i(e);
29782
29782
  } catch (e) {
29783
- II.warn("Failed to open PiP window", e);
29783
+ LI.warn("Failed to open PiP window", e);
29784
29784
  }
29785
29785
  }, [
29786
29786
  a,
@@ -29801,13 +29801,13 @@ function BI(e) {
29801
29801
  try {
29802
29802
  e.metadata = new MediaMetadata({ title: "Tavus conversation" }), e.playbackState = "playing", l = !0;
29803
29803
  } catch (e) {
29804
- II.warn("mediaSession metadata setup failed", e);
29804
+ LI.warn("mediaSession metadata setup failed", e);
29805
29805
  }
29806
29806
  let t = (t, n) => {
29807
29807
  try {
29808
29808
  e.setActionHandler(t, n), r.push(t);
29809
29809
  } catch (e) {
29810
- II.info(`mediaSession.${t} not supported`, e);
29810
+ LI.info(`mediaSession.${t} not supported`, e);
29811
29811
  }
29812
29812
  };
29813
29813
  t("enterpictureinpicture", () => {
@@ -29861,11 +29861,11 @@ function BI(e) {
29861
29861
  }
29862
29862
  //#endregion
29863
29863
  //#region ../core/src/utils/device-preferences.ts
29864
- var VI = Lt(null), HI = {
29864
+ var HI = Lt(null), UI = {
29865
29865
  active: !1,
29866
29866
  video_shift_x: 0,
29867
29867
  backdrop: { type: "snapshot_mirror" }
29868
- }, UI = Qf(({ id: e, showAudioWave: t = !0 }) => {
29868
+ }, WI = Qf(({ id: e, showAudioWave: t = !0 }) => {
29869
29869
  let n = Wf(e).isOff;
29870
29870
  return /* @__PURE__ */ L("div", {
29871
29871
  class: `relative aspect-square w-32 @max-mobile:w-24 rounded-box overflow-hidden bg-black/30 z-10 ${n ? "hidden" : ""}`,
@@ -29880,16 +29880,16 @@ var VI = Lt(null), HI = {
29880
29880
  children: /* @__PURE__ */ L(Iy, { id: e })
29881
29881
  })]
29882
29882
  });
29883
- }), WI = Qf(() => {
29883
+ }), GI = Qf(() => {
29884
29884
  let e = Rf(), { isScreenSharing: t } = Yv(), n = Uy()[0];
29885
- return /* @__PURE__ */ L(E, { children: [t && n && /* @__PURE__ */ L(UI, { id: n }), e && /* @__PURE__ */ L(UI, {
29885
+ return /* @__PURE__ */ L(E, { children: [t && n && /* @__PURE__ */ L(WI, { id: n }), e && /* @__PURE__ */ L(WI, {
29886
29886
  id: e,
29887
29887
  showAudioWave: !1
29888
29888
  })] });
29889
- }), GI = Qf(() => /* @__PURE__ */ L("div", {
29889
+ }), KI = Qf(() => /* @__PURE__ */ L("div", {
29890
29890
  class: "cvi-strip-lift absolute bottom-4 @max-mobile:bottom-[calc(5rem_+_var(--cvi-status-strip,0px))] left-4 flex flex-col items-end gap-2 z-20",
29891
- children: /* @__PURE__ */ L(WI, {})
29892
- })), KI = Qf(({ personaSessionId: e, localId: t, isScreenSharing: n, avatarOff: r, effect: i, animate: a }) => /* @__PURE__ */ L(E, { children: [
29891
+ children: /* @__PURE__ */ L(GI, {})
29892
+ })), qI = Qf(({ personaSessionId: e, localId: t, isScreenSharing: n, avatarOff: r, effect: i, animate: a }) => /* @__PURE__ */ L(E, { children: [
29893
29893
  /* @__PURE__ */ L("div", { class: "absolute inset-0 bg-base-200" }),
29894
29894
  i.content && /* @__PURE__ */ L("div", {
29895
29895
  class: "absolute overflow-hidden rounded-box bg-black",
@@ -29911,7 +29911,7 @@ var VI = Lt(null), HI = {
29911
29911
  avatarOff: r
29912
29912
  })
29913
29913
  })
29914
- ] })), qI = Qf(() => {
29914
+ ] })), JI = Qf(() => {
29915
29915
  let { effect: e, animate: t } = pF.value, n = Rf();
29916
29916
  return n === null || e.selfView === null ? null : /* @__PURE__ */ L("div", {
29917
29917
  class: "absolute z-20 overflow-hidden rounded-box bg-black/30",
@@ -29924,23 +29924,23 @@ var VI = Lt(null), HI = {
29924
29924
  className: "h-full w-full object-cover"
29925
29925
  })
29926
29926
  });
29927
- }), JI = Qf(({ canvasRenderedSlot: e }) => {
29927
+ }), YI = Qf(({ canvasRenderedSlot: e }) => {
29928
29928
  let t = DN(pF.value.effect);
29929
- return t === "hidden" ? null : t === "engine" ? /* @__PURE__ */ L(EI, {
29929
+ return t === "hidden" ? null : t === "engine" ? /* @__PURE__ */ L(DI, {
29930
29930
  onError: yN,
29931
- children: /* @__PURE__ */ L(qI, {})
29932
- }) : e === "safe-area-bottom" ? null : /* @__PURE__ */ L(GI, {});
29933
- }), YI = Qf(() => {
29931
+ children: /* @__PURE__ */ L(JI, {})
29932
+ }) : e === "safe-area-bottom" ? null : /* @__PURE__ */ L(KI, {});
29933
+ }), XI = Qf(() => {
29934
29934
  let e = Uy()[0];
29935
29935
  return e ? /* @__PURE__ */ L(Kv, { sessionId: e }) : null;
29936
- }), XI = Qf((e) => /* @__PURE__ */ L(E, { children: [/* @__PURE__ */ L(YI, {}), /* @__PURE__ */ L(ZI, { ...e })] })), ZI = Qf(({ isAudioOnly: e, presence: t, canvasLayoutEffect: n, canvasRenderedSlot: r }) => {
29936
+ }), ZI = Qf((e) => /* @__PURE__ */ L(E, { children: [/* @__PURE__ */ L(XI, {}), /* @__PURE__ */ L(QI, { ...e })] })), QI = Qf(({ isAudioOnly: e, presence: t, canvasLayoutEffect: n, canvasRenderedSlot: r }) => {
29937
29937
  let { presence: i, localId: a, isScreenSharing: o, isPersonaPresenting: s } = t, c = pF.value, l = n.active && !o && (!e || s);
29938
29938
  return i.phase === "left" ? /* @__PURE__ */ L(Py, {}) : i.phase === "connecting" ? /* @__PURE__ */ L(Ny, {}) : e && !s ? /* @__PURE__ */ L("div", {
29939
29939
  class: "absolute inset-0 flex items-center justify-center",
29940
29940
  children: /* @__PURE__ */ L(By, { sessionId: i.replicaId })
29941
- }) : c.effect.driving ? /* @__PURE__ */ L(EI, {
29941
+ }) : c.effect.driving ? /* @__PURE__ */ L(DI, {
29942
29942
  onError: yN,
29943
- children: /* @__PURE__ */ L(KI, {
29943
+ children: /* @__PURE__ */ L(qI, {
29944
29944
  personaSessionId: i.replicaId,
29945
29945
  localId: a,
29946
29946
  isScreenSharing: o,
@@ -29954,7 +29954,7 @@ var VI = Lt(null), HI = {
29954
29954
  avatarOff: i.videoState.isOff,
29955
29955
  canvasLayoutEffect: n,
29956
29956
  smartSidecarActive: l
29957
- }) : /* @__PURE__ */ L(QI, {
29957
+ }) : /* @__PURE__ */ L($I, {
29958
29958
  personaSessionId: i.replicaId,
29959
29959
  localId: a,
29960
29960
  isScreenSharing: o,
@@ -29963,11 +29963,11 @@ var VI = Lt(null), HI = {
29963
29963
  canvasLayoutEffect: n,
29964
29964
  canvasRenderedSlot: r
29965
29965
  });
29966
- }), QI = Qf(({ personaSessionId: e, localId: t, isScreenSharing: n, avatarOff: r, smartSidecarActive: i, canvasLayoutEffect: a, canvasRenderedSlot: o }) => /* @__PURE__ */ L(Wx, {
29966
+ }), $I = Qf(({ personaSessionId: e, localId: t, isScreenSharing: n, avatarOff: r, smartSidecarActive: i, canvasLayoutEffect: a, canvasRenderedSlot: o }) => /* @__PURE__ */ L(Wx, {
29967
29967
  canvasLayoutEffect: a,
29968
29968
  smartSidecarActive: i,
29969
29969
  isScreenSharing: n,
29970
- captureSnapshot: nL,
29970
+ captureSnapshot: rL,
29971
29971
  personaMode: "auto",
29972
29972
  renderedSlot: o,
29973
29973
  fill: (i) => /* @__PURE__ */ L(Jy, {
@@ -29977,7 +29977,7 @@ var VI = Lt(null), HI = {
29977
29977
  avatarOff: r,
29978
29978
  videoRef: i
29979
29979
  })
29980
- })), $I = Qf(({ items: e }) => {
29980
+ })), eL = Qf(({ items: e }) => {
29981
29981
  let [t, n] = j(!1), r = N(null);
29982
29982
  return M(() => {
29983
29983
  if (!t) return;
@@ -30007,8 +30007,8 @@ var VI = Lt(null), HI = {
30007
30007
  children: e
30008
30008
  })]
30009
30009
  });
30010
- }), eL = Qf(({ items: e }) => e.length <= 1 ? /* @__PURE__ */ L(E, { children: e }) : /* @__PURE__ */ L($I, { items: e })), tL = Qf(({ onLeave: e }) => {
30011
- let t = Lf(), { config: n } = sh(), { session: r, end: i } = by(), a = Rf(), o = N(null), s = I(Dg)?.frameRef ?? o, [c, l] = j(!1), u = Sv() === "full-screen", [d, f] = j(!1), [p, m] = j(HI), [h, g] = j(null), [_, v] = j(null), y = n.value.customization.conversation, b = OI(y.show_fullscreen_hint && h !== null && !c && !u), x = N(null), S = N(null), C = r.value?.conversationUrl, w = r.value?.magicGrid === !0, T = AI(x, pN(y.magic_grid, w), C), E = jI(x, S, 72, !0, C), D = y.modality === "audio", ee = kI(D), O = y.modality === "chat", te = y.modality === "video", ne = y.enable_chat, k = y.enable_closed_captions, re = y.enable_picture_in_picture, { pipWindow: ie } = BI({
30010
+ }), tL = Qf(({ items: e }) => e.length <= 1 ? /* @__PURE__ */ L(E, { children: e }) : /* @__PURE__ */ L(eL, { items: e })), nL = Qf(({ onLeave: e }) => {
30011
+ let t = Lf(), { config: n } = sh(), { session: r, end: i } = by(), a = Rf(), o = N(null), s = I(Dg)?.frameRef ?? o, [c, l] = j(!1), u = Sv() === "full-screen", [d, f] = j(!1), [p, m] = j(UI), [h, g] = j(null), [_, v] = j(null), y = n.value.customization.conversation, b = kI(y.show_fullscreen_hint && h !== null && !c && !u), x = N(null), S = N(null), C = r.value?.conversationUrl, w = r.value?.magicGrid === !0, T = jI(x, pN(y.magic_grid, w), C), E = MI(x, S, 72, !0, C), D = y.modality === "audio", ee = AI(D), O = y.modality === "chat", te = y.modality === "video", ne = y.enable_chat, k = y.enable_closed_captions, re = y.enable_picture_in_picture, { pipWindow: ie } = VI({
30012
30012
  enabled: re && !O,
30013
30013
  active: t === "joined-meeting"
30014
30014
  });
@@ -30017,13 +30017,13 @@ var VI = Lt(null), HI = {
30017
30017
  }, [i]);
30018
30018
  let { camera: ae, requestCamera: A } = xh(), { isCamMuted: oe } = qv(), se = ae.isGranted && !oe;
30019
30019
  M(() => {
30020
- te && t === "joined-meeting" && (VI.value = se);
30020
+ te && t === "joined-meeting" && (HI.value = se);
30021
30021
  }, [
30022
30022
  te,
30023
30023
  t,
30024
30024
  se
30025
30025
  ]);
30026
- let ce = N(te && !a && VI.value === !0);
30026
+ let ce = N(te && !a && HI.value === !0);
30027
30027
  M(() => {
30028
30028
  t === "joined-meeting" && ce.current && (ce.current = !1, A());
30029
30029
  }, [t, A]), M(() => {
@@ -30047,10 +30047,10 @@ var VI = Lt(null), HI = {
30047
30047
  let ue = F(() => {
30048
30048
  i();
30049
30049
  }, [i]);
30050
- if (NI({
30050
+ if (PI({
30051
30051
  active: !O && t === "joined-meeting",
30052
30052
  onTimeout: ue
30053
- }), FI({ onShutdown: ue }), !C) return null;
30053
+ }), II({ onShutdown: ue }), !C) return null;
30054
30054
  if (O) return /* @__PURE__ */ L(Dy, {
30055
30055
  defaultOpen: !0,
30056
30056
  children: /* @__PURE__ */ L("div", {
@@ -30082,14 +30082,14 @@ var VI = Lt(null), HI = {
30082
30082
  /* @__PURE__ */ L("div", {
30083
30083
  class: "relative w-full h-full z-[5]",
30084
30084
  children: [
30085
- /* @__PURE__ */ L(XI, {
30085
+ /* @__PURE__ */ L(ZI, {
30086
30086
  isAudioOnly: D,
30087
30087
  presence: ee,
30088
30088
  canvasLayoutEffect: p,
30089
30089
  canvasRenderedSlot: h
30090
30090
  }),
30091
- !D && /* @__PURE__ */ L(JI, { canvasRenderedSlot: h }),
30092
- /* @__PURE__ */ L(oI, {
30091
+ !D && /* @__PURE__ */ L(YI, { canvasRenderedSlot: h }),
30092
+ /* @__PURE__ */ L(sI, {
30093
30093
  debugEnabled: d,
30094
30094
  callPresence: ee,
30095
30095
  callControlsVisible: T,
@@ -30127,7 +30127,7 @@ var VI = Lt(null), HI = {
30127
30127
  /* @__PURE__ */ L(my, { level: !0 }),
30128
30128
  !D && /* @__PURE__ */ L(gy, {}),
30129
30129
  k && /* @__PURE__ */ L(wy, {}),
30130
- /* @__PURE__ */ L(eL, { items: de }),
30130
+ /* @__PURE__ */ L(tL, { items: de }),
30131
30131
  /* @__PURE__ */ L("button", {
30132
30132
  type: "button",
30133
30133
  class: "btn btn-control btn-error",
@@ -30144,7 +30144,7 @@ var VI = Lt(null), HI = {
30144
30144
  ]
30145
30145
  }), ie && fp(/* @__PURE__ */ L(Ky, { onLeave: ue }), ie.document.body)] }) }) });
30146
30146
  });
30147
- function nL(e) {
30147
+ function rL(e) {
30148
30148
  if (!e || e.readyState < 2 || !e.videoWidth || !e.videoHeight) return null;
30149
30149
  let t = document.createElement("canvas"), n = Math.round(640 * (e.videoHeight / e.videoWidth));
30150
30150
  t.width = 640, t.height = n;
@@ -30159,7 +30159,7 @@ function nL(e) {
30159
30159
  }
30160
30160
  //#endregion
30161
30161
  //#region ../core/src/components/hair-check/index.tsx
30162
- function rL(e, t, n) {
30162
+ function iL(e, t, n) {
30163
30163
  switch (t) {
30164
30164
  case "granted": return n ? e?.cameraOptional ?? "Camera is optional — turn it on anytime." : e?.ready ?? "You're all set — join whenever you're ready.";
30165
30165
  case "blocked": return e?.denied ?? "Microphone is blocked. Click the mic to see how to allow it.";
@@ -30170,7 +30170,7 @@ function rL(e, t, n) {
30170
30170
  default: return e?.loading ?? "Getting your microphone ready...";
30171
30171
  }
30172
30172
  }
30173
- var iL = Qf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
30173
+ var aL = Qf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
30174
30174
  let i = If(), { config: a } = sh(), { cameraOnStart: o } = I(_t), { localSessionId: s, isCamMuted: c } = qv(), { mic: l, camera: u, requestMic: d, requestCamera: f } = xh(), p = a.value.customization.conversation.modality === "video", m = Y_(a.value), h = J_(a.value);
30175
30175
  M(() => {
30176
30176
  d();
@@ -30186,7 +30186,7 @@ var iL = Qf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
30186
30186
  u.isBlocked,
30187
30187
  f
30188
30188
  ]);
30189
- let v = p && g && !u.isGranted, y = rL(e, l.status, v);
30189
+ let v = p && g && !u.isGranted, y = iL(e, l.status, v);
30190
30190
  return /* @__PURE__ */ L(ny, { children: /* @__PURE__ */ L("div", {
30191
30191
  class: "absolute inset-0 motion-safe:animate-[tavusFadeUp_280ms_ease-out]",
30192
30192
  children: [u.isGranted && !c ? /* @__PURE__ */ L("div", {
@@ -30237,8 +30237,8 @@ var iL = Qf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
30237
30237
  })]
30238
30238
  })]
30239
30239
  }) });
30240
- }), aL = "Password required", oL = "Enter the password to start this conversation.", sL = "Password", cL = "Continue";
30241
- function lL({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
30240
+ }), oL = "Password required", sL = "Enter the password to start this conversation.", cL = "Password", lL = "Continue";
30241
+ function uL({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
30242
30242
  let [i, a] = j(""), o = Ze();
30243
30243
  return /* @__PURE__ */ L("div", {
30244
30244
  class: "absolute inset-0 z-30 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",
@@ -30258,18 +30258,18 @@ function lL({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
30258
30258
  /* @__PURE__ */ L("h3", {
30259
30259
  id: `${o}-title`,
30260
30260
  class: "card-title text-base-content",
30261
- children: t?.title ?? aL
30261
+ children: t?.title ?? oL
30262
30262
  }),
30263
30263
  /* @__PURE__ */ L("p", {
30264
30264
  class: "text-sm text-base-content/70",
30265
- children: t?.description ?? oL
30265
+ children: t?.description ?? sL
30266
30266
  }),
30267
30267
  /* @__PURE__ */ L("input", {
30268
30268
  id: o,
30269
30269
  type: "password",
30270
30270
  autocomplete: "current-password",
30271
30271
  class: "input input-bordered w-full",
30272
- placeholder: t?.placeholder ?? sL,
30272
+ placeholder: t?.placeholder ?? cL,
30273
30273
  value: i,
30274
30274
  disabled: n,
30275
30275
  onInput: (e) => a(e.target.value),
@@ -30285,7 +30285,7 @@ function lL({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
30285
30285
  type: "submit",
30286
30286
  disabled: !i.trim(),
30287
30287
  loading: n,
30288
- children: t?.submit ?? cL
30288
+ children: t?.submit ?? lL
30289
30289
  })
30290
30290
  ]
30291
30291
  })
@@ -30294,7 +30294,7 @@ function lL({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
30294
30294
  }
30295
30295
  //#endregion
30296
30296
  //#region ../core/src/components/welcome/index.tsx
30297
- function uL({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
30297
+ function dL({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
30298
30298
  let { config: i, deploymentId: a } = sh(), o = Sv() === "full-screen", s = I(Lm), c = Y_(i.value), l = c.btn_title ?? e?.fallback_button ?? "Start the conversation", u = i.value.customization.terms_content?.trim() ?? "", d = i.value.customization.terms_enabled === !0, f = u.length > 0, p = f && d, m = P(() => p && lm(a, u), [
30299
30299
  p,
30300
30300
  a,
@@ -30303,7 +30303,7 @@ function uL({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
30303
30303
  return /* @__PURE__ */ L(Fv, {
30304
30304
  title: c.title,
30305
30305
  description: c.description,
30306
- overlay: v && s ? /* @__PURE__ */ L(lL, { onSubmit: s.setPassword }) : null,
30306
+ overlay: v && s ? /* @__PURE__ */ L(uL, { onSubmit: s.setPassword }) : null,
30307
30307
  children: [/* @__PURE__ */ L("div", {
30308
30308
  class: "relative",
30309
30309
  children: [r && /* @__PURE__ */ L(wv, {
@@ -30341,28 +30341,28 @@ function uL({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
30341
30341
  }
30342
30342
  //#endregion
30343
30343
  //#region ../core/src/hooks/use-haircheck-text.ts
30344
- function dL(...e) {
30344
+ function fL(...e) {
30345
30345
  for (let t of e) {
30346
30346
  let e = t?.trim();
30347
30347
  if (e) return e;
30348
30348
  }
30349
30349
  }
30350
- function fL() {
30350
+ function pL() {
30351
30351
  let { config: e } = sh(), { haircheck: t } = e.value.customization;
30352
30352
  return P(() => ({
30353
- prompt: dL(t.permission_request_description, t.permission_request_title),
30354
- ready: dL(t.permission_granted_description, t.permission_granted_title),
30355
- denied: dL(t.permission_denied_description, t.permission_denied_title),
30356
- join: dL(t.join_button),
30357
- cancel: dL(t.cancel_btn)
30353
+ prompt: fL(t.permission_request_description, t.permission_request_title),
30354
+ ready: fL(t.permission_granted_description, t.permission_granted_title),
30355
+ denied: fL(t.permission_denied_description, t.permission_denied_title),
30356
+ join: fL(t.join_button),
30357
+ cancel: fL(t.cancel_btn)
30358
30358
  }), [t]);
30359
30359
  }
30360
30360
  //#endregion
30361
30361
  //#region ../core/src/shells/flow-state-body.tsx
30362
- function pL({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30363
- let r = fL();
30362
+ function mL({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30363
+ let r = pL();
30364
30364
  switch (e.state) {
30365
- case "idle": return /* @__PURE__ */ L(uL, {
30365
+ case "idle": return /* @__PURE__ */ L(dL, {
30366
30366
  text: t,
30367
30367
  onStart: () => {
30368
30368
  e.start();
@@ -30370,7 +30370,7 @@ function pL({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30370
30370
  isStarting: e.isStarting,
30371
30371
  permissionRequest: e.permissionRequest
30372
30372
  });
30373
- case "haircheck": return /* @__PURE__ */ L(iL, {
30373
+ case "haircheck": return /* @__PURE__ */ L(aL, {
30374
30374
  text: r,
30375
30375
  onJoin: () => {
30376
30376
  e.join();
@@ -30378,7 +30378,7 @@ function pL({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30378
30378
  onCancel: () => e.cancel(),
30379
30379
  isJoining: e.isStarting
30380
30380
  });
30381
- case "call": return /* @__PURE__ */ L(tL, { onLeave: () => e.leave() });
30381
+ case "call": return /* @__PURE__ */ L(nL, { onLeave: () => e.leave() });
30382
30382
  case "ended": return /* @__PURE__ */ L(Uv, {
30383
30383
  isStarting: e.isStarting,
30384
30384
  permissionRequest: e.permissionRequest,
@@ -30403,7 +30403,7 @@ function pL({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30403
30403
  }
30404
30404
  //#endregion
30405
30405
  //#region ../core/src/shells/embed/embed-shell.tsx
30406
- function mL() {
30406
+ function hL() {
30407
30407
  let { config: e, configError: t } = sh(), n = xv(), r = yv(), i = P(() => ({ fallback_button: n.start_button }), [n.start_button]), a = e.value.is_available, o = e.value.unavailable_reason;
30408
30408
  return /* @__PURE__ */ L(Og, { children: t.value ? /* @__PURE__ */ L(vv, {
30409
30409
  cause: "error",
@@ -30413,18 +30413,18 @@ function mL() {
30413
30413
  cause: o ?? "daily_limit",
30414
30414
  canRetry: !1,
30415
30415
  onRetry: () => {}
30416
- }) : /* @__PURE__ */ L(pL, {
30416
+ }) : /* @__PURE__ */ L(mL, {
30417
30417
  flow: r,
30418
30418
  welcomeText: i
30419
30419
  }) });
30420
30420
  }
30421
30421
  //#endregion
30422
30422
  //#region ../core/src/embed/tavus-embed.tsx
30423
- var hL = ":host {\n display: block;\n /* Containing block for the captcha overlay, which is owned by a provider\n above the shells and so has no positioned ancestor of its own. */\n position: relative;\n width: 100%;\n height: 100%;\n max-height: 100vh;\n overflow: hidden;\n background: transparent;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n}";
30424
- function gL(e) {
30423
+ var gL = ":host {\n display: block;\n /* Containing block for the captcha overlay, which is owned by a provider\n above the shells and so has no positioned ancestor of its own. */\n position: relative;\n width: 100%;\n height: 100%;\n max-height: 100vh;\n overflow: hidden;\n background: transparent;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n}";
30424
+ function _L(e) {
30425
30425
  return /* @__PURE__ */ L(E, { children: [
30426
30426
  /* @__PURE__ */ L("style", { dangerouslySetInnerHTML: { __html: Pe } }),
30427
- /* @__PURE__ */ L("style", { dangerouslySetInnerHTML: { __html: hL } }),
30427
+ /* @__PURE__ */ L("style", { dangerouslySetInnerHTML: { __html: gL } }),
30428
30428
  /* @__PURE__ */ L(yt, {
30429
30429
  surface: "embed",
30430
30430
  layout: e.layout,
@@ -30439,14 +30439,14 @@ function gL(e) {
30439
30439
  token: e.token,
30440
30440
  children: /* @__PURE__ */ L(Dr, {
30441
30441
  fallback: /* @__PURE__ */ L(Eg, {}),
30442
- children: /* @__PURE__ */ L(kr, { children: /* @__PURE__ */ L(Rm, { children: /* @__PURE__ */ L(oh, { children: /* @__PURE__ */ L(kh, { children: /* @__PURE__ */ L(Ph, { children: /* @__PURE__ */ L(Ih, { children: /* @__PURE__ */ L(_g, { children: /* @__PURE__ */ L(mL, {}) }) }) }) }) }) }) })
30442
+ children: /* @__PURE__ */ L(kr, { children: /* @__PURE__ */ L(Rm, { children: /* @__PURE__ */ L(oh, { children: /* @__PURE__ */ L(kh, { children: /* @__PURE__ */ L(Ph, { children: /* @__PURE__ */ L(Ih, { children: /* @__PURE__ */ L(_g, { children: /* @__PURE__ */ L(hL, {}) }) }) }) }) }) }) })
30443
30443
  })
30444
30444
  })
30445
30445
  ] });
30446
30446
  }
30447
- var _L;
30448
- function vL() {
30449
- _L ||= Ee(gL, "tavus-embed", [
30447
+ var vL;
30448
+ function yL() {
30449
+ vL ||= Ee(_L, "tavus-embed", [
30450
30450
  "layout",
30451
30451
  "camera-on-start",
30452
30452
  "deployment-id",
@@ -30465,7 +30465,7 @@ function vL() {
30465
30465
  fn("Widget");
30466
30466
  //#endregion
30467
30467
  //#region src/integration.ts
30468
- var yL = [
30468
+ var bL = [
30469
30469
  "tavus:chat-message",
30470
30470
  "tavus:conversation-created",
30471
30471
  "tavus:conversation-ended",
@@ -30477,7 +30477,7 @@ var yL = [
30477
30477
  "tavus:ready",
30478
30478
  "tavus:state-change",
30479
30479
  "tavus:tool-call"
30480
- ], bL = class {
30480
+ ], xL = class {
30481
30481
  element = null;
30482
30482
  tagName;
30483
30483
  constructor(e = "tavus-embed") {
@@ -30528,6 +30528,6 @@ var yL = [
30528
30528
  };
30529
30529
  //#endregion
30530
30530
  //#region src/index.ts
30531
- typeof window < "u" && vL();
30531
+ typeof window < "u" && yL();
30532
30532
  //#endregion
30533
- export { yL as TAVUS_EVENT_NAMES, bL as TavusIntegration };
30533
+ export { bL as TAVUS_EVENT_NAMES, xL as TavusIntegration };