@tavus/embed 0.15.1 → 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.1",
3018
+ version: "0.16.0",
3019
3019
  variant: "embed"
3020
3020
  }, Pn = /* @__PURE__ */ new Set([
3021
3021
  "Error",
@@ -28738,27 +28738,35 @@ var TF = {
28738
28738
  stiffness: 2822,
28739
28739
  damping: 84,
28740
28740
  mass: 3.5
28741
- };
28742
- function kF(e, t) {
28741
+ }, kF = .25, AF = 16;
28742
+ function jF() {
28743
+ if (typeof document > "u" || typeof getComputedStyle != "function") return AF;
28744
+ let e = Number.parseFloat(getComputedStyle(document.documentElement).fontSize);
28745
+ return Number.isFinite(e) ? e : AF;
28746
+ }
28747
+ function MF(e, t) {
28743
28748
  return e === "widget" || t !== void 0 && t > 0 && t < 640 ? "compact" : "regular";
28744
28749
  }
28745
- function AF(e) {
28750
+ function NF(e) {
28746
28751
  if (typeof e == "string") try {
28747
28752
  let t = JSON.parse(e);
28748
- return jF(t) ? t : null;
28753
+ return PF(t) ? t : null;
28749
28754
  } catch {
28750
28755
  return null;
28751
28756
  }
28752
- return jF(e) ? e : null;
28757
+ return PF(e) ? e : null;
28753
28758
  }
28754
- function jF(e) {
28759
+ function PF(e) {
28755
28760
  return typeof e == "object" && !!e && !Array.isArray(e);
28756
28761
  }
28757
- function MF(e) {
28758
- let t = AF(e)?.state;
28762
+ function FF(e) {
28763
+ let t = NF(e)?.state;
28759
28764
  return t === "success" || t === "error";
28760
28765
  }
28761
- function NF(e, t, n) {
28766
+ function IF(e) {
28767
+ return NF(e)?.state === "error";
28768
+ }
28769
+ function LF(e, t, n) {
28762
28770
  let r = `${t + 8}px`;
28763
28771
  if (n === void 0 || !Number.isFinite(n) || n <= 0) return {
28764
28772
  left: "1rem",
@@ -28772,75 +28780,83 @@ function NF(e, t, n) {
28772
28780
  bottom: r
28773
28781
  };
28774
28782
  }
28775
- var PF = "rgb(0 0 0 / 50%)", FF = "oklch(98.5% 0 0)", IF = 1.5;
28776
- function LF(e, t) {
28783
+ function RF(e) {
28784
+ let t = e?.trim();
28785
+ if (!t) return kF * jF();
28786
+ let n = Number.parseFloat(t);
28787
+ if (!Number.isFinite(n)) return kF * jF();
28788
+ if (t.endsWith("rem")) return n * jF();
28789
+ if (t.endsWith("px")) return n;
28790
+ }
28791
+ function zF(e, t) {
28792
+ let n = e["--color-neutral"], r = e["--color-neutral-content"], i = RF(e["--radius-field"]);
28777
28793
  return {
28778
- "--activity-bg": PF,
28779
- "--activity-fg": FF,
28794
+ ...n ? { "--activity-bg": n } : {},
28795
+ ...r ? { "--activity-fg": r } : {},
28780
28796
  "--activity-border": "transparent",
28781
- "--activity-radius": `${IF}px`,
28797
+ ...i === void 0 ? {} : { "--activity-radius": `${i}px` },
28782
28798
  "--activity-height": `${TF[t.density]}px`,
28783
28799
  "--activity-align": t.align
28784
28800
  };
28785
28801
  }
28786
28802
  //#endregion
28787
28803
  //#region ../core/src/magic-canvas/magic-canvas.tsx
28788
- var RF = 1e3, zF = 5e3, BF = 1200, VF = [2e3, 6e3];
28789
- async function HF(e, t, n) {
28790
- let r = new AbortController(), i = globalThis.setTimeout(() => r.abort(), zF);
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);
28791
28807
  try {
28792
28808
  await wn(e, t, n, { signal: r.signal });
28793
28809
  } finally {
28794
28810
  globalThis.clearTimeout(i);
28795
28811
  }
28796
28812
  }
28797
- function UF(e) {
28813
+ function GF(e) {
28798
28814
  return e instanceof vn && e.status >= 400 && e.status < 500 && e.status !== 408 && e.status !== 429;
28799
28815
  }
28800
- function WF(e, t) {
28816
+ function KF(e, t) {
28801
28817
  console.error("Magic Canvas interaction POST failed; this interaction may not have been recorded server-side.", e), t({
28802
28818
  lastInteractionPostResult: "error",
28803
- lastError: wI(e).message
28819
+ lastError: EI(e).message
28804
28820
  }, {
28805
28821
  error: e,
28806
28822
  operation: "canvas.bridge"
28807
28823
  });
28808
28824
  }
28809
- function GF(e) {
28825
+ function qF(e) {
28810
28826
  return e.content.some((e) => e.type === "text" && typeof e.text == "string" && e.text.trim() !== "");
28811
28827
  }
28812
- function KF(e, t, n, r) {
28828
+ function JF(e, t, n, r) {
28813
28829
  (async () => {
28814
28830
  let i;
28815
- for (let a of VF) {
28831
+ for (let a of UF) {
28816
28832
  await new Promise((e) => setTimeout(e, a));
28817
28833
  try {
28818
- await HF(e, t, n), r({
28834
+ await WF(e, t, n), r({
28819
28835
  lastInteractionPostResult: "recovered",
28820
28836
  lastError: void 0
28821
28837
  });
28822
28838
  return;
28823
28839
  } catch (e) {
28824
- if (i = e, UF(e)) break;
28840
+ if (i = e, GF(e)) break;
28825
28841
  }
28826
28842
  }
28827
- WF(i, r);
28843
+ KF(i, r);
28828
28844
  })();
28829
28845
  }
28830
- var qF = 2e3;
28831
- function JF(e) {
28832
- return e.correct_answer === void 0 ? BF : qF;
28846
+ var YF = 2e3;
28847
+ function XF(e) {
28848
+ return e.correct_answer === void 0 ? HF : YF;
28833
28849
  }
28834
- var YF = 48, XF = 24, ZF = "ui-monospace, SFMono-Regular, Menlo, monospace", QF = 160, $F = () => {}, eI = "allow-scripts", tI = {
28850
+ var ZF = 48, QF = 24, $F = "ui-monospace, SFMono-Regular, Menlo, monospace", eI = 160, tI = () => {}, nI = "allow-scripts", rI = {
28835
28851
  "canvas.scheduling_embed": "allow-scripts allow-same-origin allow-popups allow-forms",
28836
28852
  "canvas.text": "allow-scripts allow-popups allow-popups-to-escape-sandbox"
28837
28853
  };
28838
- function nI(e, t) {
28854
+ function iI(e, t) {
28839
28855
  if (!t.contentWindow || e.source !== t.contentWindow) return !1;
28840
28856
  let n = e.data;
28841
28857
  return !!n && typeof n == "object" && n?.jsonrpc === "2.0";
28842
28858
  }
28843
- var rI = class {
28859
+ var aI = class {
28844
28860
  onmessage;
28845
28861
  onerror;
28846
28862
  onclose;
@@ -28851,7 +28867,7 @@ var rI = class {
28851
28867
  }
28852
28868
  start() {
28853
28869
  let e = (e) => {
28854
- nI(e, this.#e) && this.onmessage?.(e.data);
28870
+ iI(e, this.#e) && this.onmessage?.(e.data);
28855
28871
  };
28856
28872
  return this.#t = e, globalThis.addEventListener("message", e), Promise.resolve();
28857
28873
  }
@@ -28862,12 +28878,12 @@ var rI = class {
28862
28878
  return this.#t && globalThis.removeEventListener("message", this.#t), this.#t = void 0, this.onclose?.(), Promise.resolve();
28863
28879
  }
28864
28880
  };
28865
- function iI(e) {
28866
- for (let t of fb) if (e.some((e) => bI(e) === t)) return t;
28881
+ function oI(e) {
28882
+ for (let t of fb) if (e.some((e) => SI(e) === t)) return t;
28867
28883
  return null;
28868
28884
  }
28869
- function aI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n = xI(), callPresence: r, callControlsVisible: i, callControlsRect: a, gridConfigEnabled: o, gridStartEnabled: s, onStatusStripChange: c } = {}) {
28870
- 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] = gI(), E = I(_t)?.surface, D = kF(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(() => {
28871
28887
  S.current !== null && (clearTimeout(S.current), S.current = null);
28872
28888
  }, []), k = F(() => {
28873
28889
  C.current !== null && (clearTimeout(C.current), C.current = null);
@@ -28959,13 +28975,10 @@ function aI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28959
28975
  try {
28960
28976
  let t = fx(e.data);
28961
28977
  if (!t) return;
28962
- let n = Ab(x.current, t);
28963
- if (n.consumed) {
28964
- if (!n.strip) re();
28965
- else if (MF(n.strip.arguments)) {
28966
- let e = x.current;
28967
- e !== null && e.tool_call_id === n.strip.tool_call_id && e.conversation_id === n.strip.conversation_id && ie();
28968
- } 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();
28969
28982
  } else g((e) => Eb(e, t));
28970
28983
  se({
28971
28984
  lastToolCall: e.data,
@@ -28976,7 +28989,7 @@ function aI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
28976
28989
  } catch (e) {
28977
28990
  se({
28978
28991
  iframeLifecycleState: "error",
28979
- lastError: wI(e).message
28992
+ lastError: EI(e).message
28980
28993
  }, {
28981
28994
  error: e,
28982
28995
  operation: "canvas.validate"
@@ -29014,7 +29027,7 @@ function aI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
29014
29027
  de.safe_area?.width,
29015
29028
  de.safe_area?.height
29016
29029
  ]);
29017
- let pe = iI(ue.map(({ layout: e }) => e));
29030
+ let pe = oI(ue.map(({ layout: e }) => e));
29018
29031
  M(() => {
29019
29032
  t?.(pe);
29020
29033
  }, [t, pe]);
@@ -29023,7 +29036,7 @@ function aI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
29023
29036
  ref: w,
29024
29037
  "data-magic-canvas-root": !0,
29025
29038
  class: "pointer-events-none absolute inset-0 z-30",
29026
- style: `--mc-strip-band: ${te}px; --cvi-status-strip-drop: ${80 - XF}px`,
29039
+ style: `--mc-strip-band: ${te}px; --cvi-status-strip-drop: ${80 - QF}px`,
29027
29040
  children: [
29028
29041
  me && fe && /* @__PURE__ */ L("div", { class: "absolute inset-0 bg-black/45" }),
29029
29042
  me && !fe && oe.sheetBottomPx !== null && /* @__PURE__ */ L("div", {
@@ -29034,15 +29047,15 @@ function aI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
29034
29047
  backgroundImage: "linear-gradient(to bottom, rgb(0 0 0 / 0.45) calc(100% - 64px), rgb(0 0 0 / 0))"
29035
29048
  }
29036
29049
  }),
29037
- me && ue.map(({ instance: e, layout: t, gridRect: n }) => /* @__PURE__ */ L(lI, {
29038
- slot: bI(t),
29050
+ me && ue.map(({ instance: e, layout: t, gridRect: n }) => /* @__PURE__ */ L(dI, {
29051
+ slot: SI(t),
29039
29052
  safeAreaTop: de.safe_area?.y,
29040
29053
  frameWidth: T.width,
29041
29054
  ...n ? {
29042
29055
  gridRect: n,
29043
29056
  gridAnimate: oe.animate
29044
29057
  } : {},
29045
- children: (r) => /* @__PURE__ */ L(uI, {
29058
+ children: (r) => /* @__PURE__ */ L(fI, {
29046
29059
  availableHeight: r,
29047
29060
  client: l,
29048
29061
  gridDriven: n !== null,
@@ -29068,7 +29081,7 @@ function aI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
29068
29081
  sendAppMessage: ce
29069
29082
  })
29070
29083
  }, e.id)),
29071
- _ && /* @__PURE__ */ L(oI, {
29084
+ _ && /* @__PURE__ */ L(cI, {
29072
29085
  client: l,
29073
29086
  controlsRect: a,
29074
29087
  density: D,
@@ -29088,7 +29101,7 @@ function aI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
29088
29101
  ]
29089
29102
  });
29090
29103
  }
29091
- function oI({ 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 }) {
29092
29105
  let u = TF[n], d = {
29093
29106
  ...o.layout,
29094
29107
  preferred_slot: "safe-area-bottom",
@@ -29098,7 +29111,7 @@ function oI({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i,
29098
29111
  ...a,
29099
29112
  cssVars: {
29100
29113
  ...a.cssVars,
29101
- "--font-mono": ZF
29114
+ "--font-mono": $F
29102
29115
  },
29103
29116
  activity: {
29104
29117
  density: n,
@@ -29107,13 +29120,13 @@ function oI({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i,
29107
29120
  }), [n, a]);
29108
29121
  return /* @__PURE__ */ L("div", {
29109
29122
  class: "cvi-status-strip absolute flex justify-center",
29110
- style: NF(t, 72, i),
29123
+ style: LF(t, 72, i),
29111
29124
  "data-canvas-status-strip": !0,
29112
- children: /* @__PURE__ */ L(sI, {
29125
+ children: /* @__PURE__ */ L(lI, {
29113
29126
  exiting: r,
29114
29127
  instanceId: o.id,
29115
- children: /* @__PURE__ */ L(uI, {
29116
- availableHeight: QF,
29128
+ children: /* @__PURE__ */ L(fI, {
29129
+ availableHeight: eI,
29117
29130
  client: e,
29118
29131
  fixedHeightPx: u,
29119
29132
  hostTheme: f,
@@ -29121,15 +29134,15 @@ function oI({ client: e, controlsRect: t, density: n, exiting: r, frameWidth: i,
29121
29134
  layout: d,
29122
29135
  onComplete: s,
29123
29136
  onDebug: c,
29124
- onDisplayModeChange: $F,
29125
- onNaturalHeightChange: $F,
29137
+ onDisplayModeChange: tI,
29138
+ onNaturalHeightChange: tI,
29126
29139
  sendAppMessage: l,
29127
29140
  variant: "strip"
29128
29141
  })
29129
29142
  })
29130
29143
  });
29131
29144
  }
29132
- function sI({ exiting: e, instanceId: t, children: n }) {
29145
+ function lI({ exiting: e, instanceId: t, children: n }) {
29133
29146
  let r = N(null);
29134
29147
  return Xe(() => {
29135
29148
  let t = r.current;
@@ -29165,9 +29178,9 @@ function sI({ exiting: e, instanceId: t, children: n }) {
29165
29178
  children: n
29166
29179
  });
29167
29180
  }
29168
- var cI = 16;
29169
- function lI({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate: i = !1, children: a }) {
29170
- let [o, s] = _I(), 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);
29171
29184
  if (r) return /* @__PURE__ */ L("div", {
29172
29185
  ref: o,
29173
29186
  class: "pointer-events-auto absolute",
@@ -29183,7 +29196,7 @@ function lI({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
29183
29196
  let r = t == null ? "1rem" : `${t * 100}%`, i = n != null && n > 0 ? Math.max(0, n - 32) : void 0;
29184
29197
  return /* @__PURE__ */ L("div", {
29185
29198
  ref: o,
29186
- class: `cvi-strip-lift ${yI(e)}`,
29199
+ class: `cvi-strip-lift ${xI(e)}`,
29187
29200
  style: {
29188
29201
  top: r,
29189
29202
  bottom: "calc(72px + var(--mc-strip-band, 0px))",
@@ -29198,8 +29211,8 @@ function lI({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
29198
29211
  }
29199
29212
  return e === "safe-area-bottom" ? /* @__PURE__ */ L("div", {
29200
29213
  ref: o,
29201
- class: yI(e),
29202
- style: { top: `${cI}px` },
29214
+ class: xI(e),
29215
+ style: { top: `${uI}px` },
29203
29216
  "data-canvas-slot": e,
29204
29217
  children: /* @__PURE__ */ L("div", {
29205
29218
  class: "contents",
@@ -29207,7 +29220,7 @@ function lI({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
29207
29220
  })
29208
29221
  }) : /* @__PURE__ */ L("div", {
29209
29222
  ref: o,
29210
- class: yI(e),
29223
+ class: xI(e),
29211
29224
  "data-canvas-slot": e,
29212
29225
  children: /* @__PURE__ */ L("div", {
29213
29226
  class: "contents",
@@ -29215,7 +29228,7 @@ function lI({ slot: e, safeAreaTop: t, frameWidth: n, gridRect: r, gridAnimate:
29215
29228
  })
29216
29229
  });
29217
29230
  }
29218
- function uI({ 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 }) {
29219
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({
29220
29233
  fixed: m,
29221
29234
  max: g
@@ -29228,17 +29241,17 @@ function uI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29228
29241
  }, [m, g]), M(() => {
29229
29242
  w.current = a;
29230
29243
  }, [a]), M(() => {
29231
- x.current = ne, v.current?.setHostContext(mI(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));
29232
29245
  }, [ne]), M(() => {
29233
29246
  y.current = e, b.current = r;
29234
- let t = pI(i, _.current);
29235
- C.current = t, v.current?.setHostContext(mI(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));
29236
29249
  }, [
29237
29250
  e,
29238
29251
  i,
29239
29252
  r
29240
29253
  ]), M(() => {
29241
- T.current = o, v.current?.setHostContext(mI(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));
29242
29255
  }, [e, o]), M(() => {
29243
29256
  D.current = l, ee.current = u, O.current = d, te.current = f;
29244
29257
  }, [
@@ -29252,7 +29265,7 @@ function uI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29252
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) => {
29253
29266
  n || c({
29254
29267
  iframeLifecycleState: "error",
29255
- lastError: wI(e).message
29268
+ lastError: EI(e).message
29256
29269
  }, {
29257
29270
  error: e,
29258
29271
  operation: "canvas.bridge"
@@ -29289,18 +29302,18 @@ function uI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29289
29302
  text: {},
29290
29303
  structuredContent: {}
29291
29304
  }
29292
- }, { hostContext: mI(a, pI(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) });
29293
29306
  r = f, v.current = f, f.oninitialized = () => {
29294
29307
  n || (c({ iframeLifecycleState: "ready" }), E.current = w.current.revision, f.sendToolInput({ arguments: w.current.arguments }).catch(u));
29295
29308
  }, f.onsizechange = ({ height: e }) => {
29296
29309
  if (!n && typeof e == "number" && Number.isFinite(e)) {
29297
- let { fixed: t, max: n } = S.current, r = t === void 0 ? Math.min(Math.max(e, YF), n) : e === t ? t : Math.min(e, QF);
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);
29298
29311
  k(r), O.current(w.current.id, r);
29299
29312
  }
29300
29313
  }, f.onmessage = async (e) => {
29301
29314
  let r = jb(e);
29302
29315
  if (!r) {
29303
- if (GF(e)) {
29316
+ if (qF(e)) {
29304
29317
  let e = "Magic Canvas message included text without interaction metadata; no interaction row was recorded.";
29305
29318
  return c({
29306
29319
  lastInteractionPostResult: "error",
@@ -29325,7 +29338,7 @@ function uI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29325
29338
  }
29326
29339
  })();
29327
29340
  if ("error" in a) {
29328
- let e = wI(a.error).message;
29341
+ let e = EI(a.error).message;
29329
29342
  return c({
29330
29343
  lastInteractionPostResult: "error",
29331
29344
  lastError: e
@@ -29342,19 +29355,19 @@ function uI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29342
29355
  try {
29343
29356
  u = Pb(e, o);
29344
29357
  } catch (e) {
29345
- c({ lastError: wI(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);
29346
29359
  }
29347
29360
  let d = !0;
29348
29361
  try {
29349
- await HF(t, o.conversation_id, l.body);
29362
+ await WF(t, o.conversation_id, l.body);
29350
29363
  } catch (e) {
29351
- d = !1, UF(e) ? WF(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({
29352
29365
  lastInteractionPostResult: "failed_open",
29353
- lastError: wI(e).message
29366
+ lastError: EI(e).message
29354
29367
  }, {
29355
29368
  error: e,
29356
29369
  operation: "canvas.bridge"
29357
- }), KF(t, o.conversation_id, l.body, c));
29370
+ }), JF(t, o.conversation_id, l.body, c));
29358
29371
  }
29359
29372
  if (n) return {};
29360
29373
  if (u) try {
@@ -29365,7 +29378,7 @@ function uI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29365
29378
  properties: { text: u }
29366
29379
  });
29367
29380
  } catch (e) {
29368
- console.error("Magic Canvas respond send failed.", e), c({ lastError: wI(e).message }, {
29381
+ console.error("Magic Canvas respond send failed.", e), c({ lastError: EI(e).message }, {
29369
29382
  error: e,
29370
29383
  operation: "canvas.bridge"
29371
29384
  });
@@ -29375,18 +29388,18 @@ function uI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29375
29388
  lastError: void 0
29376
29389
  }), Nb(o) && (o.type === "submit" ? (s && clearTimeout(s), s = setTimeout(() => {
29377
29390
  s = null, n || D.current();
29378
- }, JF(i.arguments))) : D.current()), {};
29391
+ }, XF(i.arguments))) : D.current()), {};
29379
29392
  }, f.onupdatemodelcontext = async (e) => (i = e, o ||= setTimeout(() => {
29380
29393
  o = null, d();
29381
- }, RF), {}), f.onrequestdisplaymode = async ({ mode: e }) => {
29394
+ }, BF), {}), f.onrequestdisplaymode = async ({ mode: e }) => {
29382
29395
  if (h) return { mode: "inline" };
29383
29396
  let t = e === "fullscreen" ? "fullscreen" : "inline";
29384
29397
  return ee.current(t), T.current = {
29385
29398
  ...T.current,
29386
29399
  display_mode: t,
29387
29400
  viable_slot: t === "fullscreen" ? "full" : T.current.viable_slot
29388
- }, f.setHostContext(mI(w.current, C.current, T.current, y.current, x.current, b.current)), { mode: t };
29389
- }, f.connect(new rI(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);
29390
29403
  };
29391
29404
  c({
29392
29405
  iframeLifecycleState: "mounting",
@@ -29408,7 +29421,7 @@ function uI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29408
29421
  a.revision !== 0 && (a.revision <= E.current || (E.current = a.revision, v.current?.sendToolInput({ arguments: a.arguments }).catch((e) => {
29409
29422
  c({
29410
29423
  iframeLifecycleState: "error",
29411
- lastError: wI(e).message
29424
+ lastError: EI(e).message
29412
29425
  }, {
29413
29426
  error: e,
29414
29427
  operation: "canvas.bridge"
@@ -29419,7 +29432,7 @@ function uI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29419
29432
  a.revision,
29420
29433
  c
29421
29434
  ]);
29422
- let re = o.viable_slot === "full" || o.display_mode === "fullscreen", ie = re ? null : hI(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 ?? {
29423
29436
  width: "100%",
29424
29437
  height: `${ne}px`
29425
29438
  }, se = h ? "pointer-events-auto w-full overflow-hidden" : [
@@ -29427,7 +29440,7 @@ function uI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29427
29440
  r ? "" : "shadow-xl",
29428
29441
  re ? "fixed inset-4 z-10 max-w-none" : n ? "max-w-none" : "max-w-md",
29429
29442
  s ? "scale-[0.98] opacity-40" : ""
29430
- ].filter(Boolean).join(" "), ce = tI[a.canvas_config.component] ?? eI, le = /* @__PURE__ */ L("div", {
29443
+ ].filter(Boolean).join(" "), ce = rI[a.canvas_config.component] ?? nI, le = /* @__PURE__ */ L("div", {
29431
29444
  class: se,
29432
29445
  style: A,
29433
29446
  ...h ? { "data-canvas-strip": o.viable_slot } : { "data-canvas-card": o.viable_slot },
@@ -29446,7 +29459,7 @@ function uI({ availableHeight: e, client: t, gridDriven: n = !1, gridKioskCard:
29446
29459
  children: le
29447
29460
  });
29448
29461
  }
29449
- var dI = [
29462
+ var pI = [
29450
29463
  "--color-base-100",
29451
29464
  "--color-base-200",
29452
29465
  "--color-base-300",
@@ -29456,17 +29469,17 @@ var dI = [
29456
29469
  "--color-neutral",
29457
29470
  "--color-neutral-content"
29458
29471
  ];
29459
- function fI(e) {
29472
+ function mI(e) {
29460
29473
  if (!e || typeof getComputedStyle != "function") return {};
29461
29474
  let t = getComputedStyle(e), n = {};
29462
- for (let e of dI) {
29475
+ for (let e of pI) {
29463
29476
  let r = t.getPropertyValue(e).trim();
29464
29477
  r && (n[e] = r);
29465
29478
  }
29466
29479
  return n;
29467
29480
  }
29468
- function pI(e, t) {
29469
- let n = fI(t);
29481
+ function hI(e, t) {
29482
+ let n = mI(t);
29470
29483
  return Object.keys(n).length === 0 ? e : {
29471
29484
  ...e,
29472
29485
  cssVars: {
@@ -29475,20 +29488,20 @@ function pI(e, t) {
29475
29488
  }
29476
29489
  };
29477
29490
  }
29478
- function mI(e, t, n, r, i, a = !1) {
29479
- let o = mx(t, n), s = n.viable_slot === "full" || n.display_mode === "fullscreen", c = s ? void 0 : SI(r), l = t.activity ? LF(t.cssVars, t.activity) : {}, u = s ? 1 : hI(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;
29480
29493
  return {
29481
29494
  ...e.canvas_config.host_context,
29482
29495
  ...o,
29483
29496
  ...l,
29484
29497
  containerDimensions: {
29485
- ...CI(o.containerDimensions) ? o.containerDimensions : {},
29498
+ ...TI(o.containerDimensions) ? o.containerDimensions : {},
29486
29499
  ...c === void 0 ? {} : { maxHeight: c },
29487
29500
  displayScale: u
29488
29501
  }
29489
29502
  };
29490
29503
  }
29491
- function hI(e, t, n = !1) {
29504
+ function _I(e, t, n = !1) {
29492
29505
  if (t === void 0 || !Number.isFinite(t) || t <= 0) return null;
29493
29506
  let r = Math.min(e, 720);
29494
29507
  if (n) return {
@@ -29528,11 +29541,11 @@ function hI(e, t, n = !1) {
29528
29541
  }
29529
29542
  };
29530
29543
  }
29531
- function gI() {
29532
- let e = N(null), [t, n] = j(() => vI(null));
29544
+ function vI() {
29545
+ let e = N(null), [t, n] = j(() => bI(null));
29533
29546
  return M(() => {
29534
29547
  let t = () => n((t) => {
29535
- let n = vI(e.current);
29548
+ let n = bI(e.current);
29536
29549
  return t.width === n.width && t.height === n.height && t.visualViewportHeight === n.visualViewportHeight ? t : n;
29537
29550
  });
29538
29551
  t(), globalThis.addEventListener("resize", t), globalThis.visualViewport?.addEventListener("resize", t);
@@ -29542,7 +29555,7 @@ function gI() {
29542
29555
  };
29543
29556
  }, []), [e, t];
29544
29557
  }
29545
- function _I() {
29558
+ function yI() {
29546
29559
  let e = N(null), [t, n] = j();
29547
29560
  return M(() => {
29548
29561
  let t = e.current;
@@ -29558,7 +29571,7 @@ function _I() {
29558
29571
  return a.observe(t), () => a.disconnect();
29559
29572
  }, []), [e, t];
29560
29573
  }
29561
- function vI(e) {
29574
+ function bI(e) {
29562
29575
  let t = globalThis.visualViewport?.height, n = e?.getBoundingClientRect();
29563
29576
  if (n && n.width > 0 && n.height > 0) {
29564
29577
  let e = t === void 0 ? void 0 : Math.max(0, (globalThis.innerHeight || 0) - t);
@@ -29574,7 +29587,7 @@ function vI(e) {
29574
29587
  visualViewportHeight: t
29575
29588
  };
29576
29589
  }
29577
- function yI(e) {
29590
+ function xI(e) {
29578
29591
  let t = "absolute flex gap-2";
29579
29592
  switch (e) {
29580
29593
  case "safe-area-left": return `${t} left-4 w-[28rem] flex-col overflow-y-auto [scrollbar-gutter:stable]`;
@@ -29583,24 +29596,24 @@ function yI(e) {
29583
29596
  case "full": return `${t} inset-4 flex-col items-stretch justify-stretch`;
29584
29597
  }
29585
29598
  }
29586
- function bI(e) {
29599
+ function SI(e) {
29587
29600
  return e.display_mode === "fullscreen" && e.preferred_slot !== "full" ? e.preferred_slot : e.viable_slot;
29588
29601
  }
29589
- function xI() {
29602
+ function CI() {
29590
29603
  return !1;
29591
29604
  }
29592
- function SI(e) {
29605
+ function wI(e) {
29593
29606
  return e === void 0 || !Number.isFinite(e) || e <= 0 ? 720 : Math.min(Math.floor(e), 720);
29594
29607
  }
29595
- function CI(e) {
29608
+ function TI(e) {
29596
29609
  return typeof e == "object" && !!e && !Array.isArray(e);
29597
29610
  }
29598
- function wI(e) {
29611
+ function EI(e) {
29599
29612
  return e instanceof Error ? e : Error(String(e));
29600
29613
  }
29601
29614
  //#endregion
29602
29615
  //#region ../core/src/magic-canvas/grid-error-boundary.tsx
29603
- var TI = class extends D {
29616
+ var DI = class extends D {
29604
29617
  state = { errored: !1 };
29605
29618
  componentDidCatch(e) {
29606
29619
  this.props.onError(e), this.setState({ errored: !0 });
@@ -29608,8 +29621,8 @@ var TI = class extends D {
29608
29621
  render() {
29609
29622
  return this.state.errored ? null : this.props.children;
29610
29623
  }
29611
- }, EI = 1e4;
29612
- function DI(e, t = EI) {
29624
+ }, OI = 1e4;
29625
+ function kI(e, t = OI) {
29613
29626
  let [n, r] = j(!1), i = N(!1);
29614
29627
  return M(() => {
29615
29628
  if (!e) {
@@ -29624,7 +29637,7 @@ function DI(e, t = EI) {
29624
29637
  }
29625
29638
  //#endregion
29626
29639
  //#region ../core/src/hooks/use-call-presence.ts
29627
- function OI(e) {
29640
+ function AI(e) {
29628
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;
29629
29642
  return P(() => ({
29630
29643
  presence: i,
@@ -29646,7 +29659,7 @@ function OI(e) {
29646
29659
  }
29647
29660
  //#endregion
29648
29661
  //#region ../core/src/hooks/use-call-controls-visible.ts
29649
- function kI(e, t, n) {
29662
+ function jI(e, t, n) {
29650
29663
  let [r, i] = j(!0);
29651
29664
  return M(() => {
29652
29665
  if (!t) return;
@@ -29676,7 +29689,7 @@ function kI(e, t, n) {
29676
29689
  }
29677
29690
  //#endregion
29678
29691
  //#region ../core/src/hooks/use-call-controls-rect.ts
29679
- function AI(e, t, n, r, i) {
29692
+ function MI(e, t, n, r, i) {
29680
29693
  let [a, o] = j(void 0);
29681
29694
  return M(() => {
29682
29695
  if (!r) return;
@@ -29710,8 +29723,8 @@ function AI(e, t, n, r, i) {
29710
29723
  }
29711
29724
  //#endregion
29712
29725
  //#region ../core/src/hooks/use-replica-join-timeout.ts
29713
- var jI = 1e4;
29714
- function MI({ onTimeout: e, timeoutMs: t = jI, active: n = !0 }) {
29726
+ var NI = 1e4;
29727
+ function PI({ onTimeout: e, timeoutMs: t = NI, active: n = !0 }) {
29715
29728
  let r = Uy().length > 0, [i, a] = j(!1), o = N(e);
29716
29729
  return M(() => {
29717
29730
  o.current = e;
@@ -29735,39 +29748,39 @@ function MI({ onTimeout: e, timeoutMs: t = jI, active: n = !0 }) {
29735
29748
  }
29736
29749
  //#endregion
29737
29750
  //#region ../core/src/hooks/use-system-shutdown.ts
29738
- function NI(e) {
29751
+ function FI(e) {
29739
29752
  if (typeof e != "object" || !e) return !1;
29740
29753
  let t = e;
29741
29754
  return t.message_type === "system" && t.event_type === "system.shutdown";
29742
29755
  }
29743
- function PI({ onShutdown: e }) {
29756
+ function II({ onShutdown: e }) {
29744
29757
  let t = N(e);
29745
29758
  M(() => {
29746
29759
  t.current = e;
29747
29760
  }, [e]), Vf({ onAppMessage: F((e) => {
29748
- NI(e?.data) && t.current();
29761
+ FI(e?.data) && t.current();
29749
29762
  }, []) });
29750
29763
  }
29751
29764
  //#endregion
29752
29765
  //#region ../core/src/hooks/use-picture-in-picture.ts
29753
- var FI = fn("PiP"), II = 360, LI = 280;
29754
- function RI() {
29766
+ var LI = fn("PiP"), RI = 360, zI = 280;
29767
+ function BI() {
29755
29768
  return globalThis.window !== void 0 && "documentPictureInPicture" in globalThis.window;
29756
29769
  }
29757
- function zI(e) {
29758
- let { enabled: t, active: n } = e, [r, i] = j(null), a = RI(), 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(() => {
29759
29772
  i((e) => (e && !e.closed && e.close(), null));
29760
29773
  }, []), c = F(async () => {
29761
29774
  if (a && t && n && (!r || r.closed)) try {
29762
29775
  let e = await globalThis.window.documentPictureInPicture.requestWindow({
29763
- width: II,
29764
- height: LI
29776
+ width: RI,
29777
+ height: zI
29765
29778
  }), t = Pe.replace(/:host(?=[\s,{])/g, ":host, :root"), n = e.document.createElement("style");
29766
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", () => {
29767
29780
  i((t) => t === e ? null : t);
29768
29781
  }, { once: !0 }), i(e);
29769
29782
  } catch (e) {
29770
- FI.warn("Failed to open PiP window", e);
29783
+ LI.warn("Failed to open PiP window", e);
29771
29784
  }
29772
29785
  }, [
29773
29786
  a,
@@ -29788,13 +29801,13 @@ function zI(e) {
29788
29801
  try {
29789
29802
  e.metadata = new MediaMetadata({ title: "Tavus conversation" }), e.playbackState = "playing", l = !0;
29790
29803
  } catch (e) {
29791
- FI.warn("mediaSession metadata setup failed", e);
29804
+ LI.warn("mediaSession metadata setup failed", e);
29792
29805
  }
29793
29806
  let t = (t, n) => {
29794
29807
  try {
29795
29808
  e.setActionHandler(t, n), r.push(t);
29796
29809
  } catch (e) {
29797
- FI.info(`mediaSession.${t} not supported`, e);
29810
+ LI.info(`mediaSession.${t} not supported`, e);
29798
29811
  }
29799
29812
  };
29800
29813
  t("enterpictureinpicture", () => {
@@ -29848,11 +29861,11 @@ function zI(e) {
29848
29861
  }
29849
29862
  //#endregion
29850
29863
  //#region ../core/src/utils/device-preferences.ts
29851
- var BI = Lt(null), VI = {
29864
+ var HI = Lt(null), UI = {
29852
29865
  active: !1,
29853
29866
  video_shift_x: 0,
29854
29867
  backdrop: { type: "snapshot_mirror" }
29855
- }, HI = Qf(({ id: e, showAudioWave: t = !0 }) => {
29868
+ }, WI = Qf(({ id: e, showAudioWave: t = !0 }) => {
29856
29869
  let n = Wf(e).isOff;
29857
29870
  return /* @__PURE__ */ L("div", {
29858
29871
  class: `relative aspect-square w-32 @max-mobile:w-24 rounded-box overflow-hidden bg-black/30 z-10 ${n ? "hidden" : ""}`,
@@ -29867,16 +29880,16 @@ var BI = Lt(null), VI = {
29867
29880
  children: /* @__PURE__ */ L(Iy, { id: e })
29868
29881
  })]
29869
29882
  });
29870
- }), UI = Qf(() => {
29883
+ }), GI = Qf(() => {
29871
29884
  let e = Rf(), { isScreenSharing: t } = Yv(), n = Uy()[0];
29872
- return /* @__PURE__ */ L(E, { children: [t && n && /* @__PURE__ */ L(HI, { id: n }), e && /* @__PURE__ */ L(HI, {
29885
+ return /* @__PURE__ */ L(E, { children: [t && n && /* @__PURE__ */ L(WI, { id: n }), e && /* @__PURE__ */ L(WI, {
29873
29886
  id: e,
29874
29887
  showAudioWave: !1
29875
29888
  })] });
29876
- }), WI = Qf(() => /* @__PURE__ */ L("div", {
29889
+ }), KI = Qf(() => /* @__PURE__ */ L("div", {
29877
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",
29878
- children: /* @__PURE__ */ L(UI, {})
29879
- })), GI = 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: [
29880
29893
  /* @__PURE__ */ L("div", { class: "absolute inset-0 bg-base-200" }),
29881
29894
  i.content && /* @__PURE__ */ L("div", {
29882
29895
  class: "absolute overflow-hidden rounded-box bg-black",
@@ -29898,7 +29911,7 @@ var BI = Lt(null), VI = {
29898
29911
  avatarOff: r
29899
29912
  })
29900
29913
  })
29901
- ] })), KI = Qf(() => {
29914
+ ] })), JI = Qf(() => {
29902
29915
  let { effect: e, animate: t } = pF.value, n = Rf();
29903
29916
  return n === null || e.selfView === null ? null : /* @__PURE__ */ L("div", {
29904
29917
  class: "absolute z-20 overflow-hidden rounded-box bg-black/30",
@@ -29911,23 +29924,23 @@ var BI = Lt(null), VI = {
29911
29924
  className: "h-full w-full object-cover"
29912
29925
  })
29913
29926
  });
29914
- }), qI = Qf(({ canvasRenderedSlot: e }) => {
29927
+ }), YI = Qf(({ canvasRenderedSlot: e }) => {
29915
29928
  let t = DN(pF.value.effect);
29916
- return t === "hidden" ? null : t === "engine" ? /* @__PURE__ */ L(TI, {
29929
+ return t === "hidden" ? null : t === "engine" ? /* @__PURE__ */ L(DI, {
29917
29930
  onError: yN,
29918
- children: /* @__PURE__ */ L(KI, {})
29919
- }) : e === "safe-area-bottom" ? null : /* @__PURE__ */ L(WI, {});
29920
- }), JI = Qf(() => {
29931
+ children: /* @__PURE__ */ L(JI, {})
29932
+ }) : e === "safe-area-bottom" ? null : /* @__PURE__ */ L(KI, {});
29933
+ }), XI = Qf(() => {
29921
29934
  let e = Uy()[0];
29922
29935
  return e ? /* @__PURE__ */ L(Kv, { sessionId: e }) : null;
29923
- }), YI = Qf((e) => /* @__PURE__ */ L(E, { children: [/* @__PURE__ */ L(JI, {}), /* @__PURE__ */ L(XI, { ...e })] })), XI = 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 }) => {
29924
29937
  let { presence: i, localId: a, isScreenSharing: o, isPersonaPresenting: s } = t, c = pF.value, l = n.active && !o && (!e || s);
29925
29938
  return i.phase === "left" ? /* @__PURE__ */ L(Py, {}) : i.phase === "connecting" ? /* @__PURE__ */ L(Ny, {}) : e && !s ? /* @__PURE__ */ L("div", {
29926
29939
  class: "absolute inset-0 flex items-center justify-center",
29927
29940
  children: /* @__PURE__ */ L(By, { sessionId: i.replicaId })
29928
- }) : c.effect.driving ? /* @__PURE__ */ L(TI, {
29941
+ }) : c.effect.driving ? /* @__PURE__ */ L(DI, {
29929
29942
  onError: yN,
29930
- children: /* @__PURE__ */ L(GI, {
29943
+ children: /* @__PURE__ */ L(qI, {
29931
29944
  personaSessionId: i.replicaId,
29932
29945
  localId: a,
29933
29946
  isScreenSharing: o,
@@ -29941,7 +29954,7 @@ var BI = Lt(null), VI = {
29941
29954
  avatarOff: i.videoState.isOff,
29942
29955
  canvasLayoutEffect: n,
29943
29956
  smartSidecarActive: l
29944
- }) : /* @__PURE__ */ L(ZI, {
29957
+ }) : /* @__PURE__ */ L($I, {
29945
29958
  personaSessionId: i.replicaId,
29946
29959
  localId: a,
29947
29960
  isScreenSharing: o,
@@ -29950,11 +29963,11 @@ var BI = Lt(null), VI = {
29950
29963
  canvasLayoutEffect: n,
29951
29964
  canvasRenderedSlot: r
29952
29965
  });
29953
- }), ZI = 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, {
29954
29967
  canvasLayoutEffect: a,
29955
29968
  smartSidecarActive: i,
29956
29969
  isScreenSharing: n,
29957
- captureSnapshot: tL,
29970
+ captureSnapshot: rL,
29958
29971
  personaMode: "auto",
29959
29972
  renderedSlot: o,
29960
29973
  fill: (i) => /* @__PURE__ */ L(Jy, {
@@ -29964,7 +29977,7 @@ var BI = Lt(null), VI = {
29964
29977
  avatarOff: r,
29965
29978
  videoRef: i
29966
29979
  })
29967
- })), QI = Qf(({ items: e }) => {
29980
+ })), eL = Qf(({ items: e }) => {
29968
29981
  let [t, n] = j(!1), r = N(null);
29969
29982
  return M(() => {
29970
29983
  if (!t) return;
@@ -29994,8 +30007,8 @@ var BI = Lt(null), VI = {
29994
30007
  children: e
29995
30008
  })]
29996
30009
  });
29997
- }), $I = Qf(({ items: e }) => e.length <= 1 ? /* @__PURE__ */ L(E, { children: e }) : /* @__PURE__ */ L(QI, { items: e })), eL = Qf(({ onLeave: e }) => {
29998
- 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(VI), [h, g] = j(null), [_, v] = j(null), y = n.value.customization.conversation, b = DI(y.show_fullscreen_hint && h !== null && !c && !u), x = N(null), S = N(null), C = r.value?.conversationUrl, w = r.value?.magicGrid === !0, T = kI(x, pN(y.magic_grid, w), C), E = AI(x, S, 72, !0, C), D = y.modality === "audio", ee = OI(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 } = zI({
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({
29999
30012
  enabled: re && !O,
30000
30013
  active: t === "joined-meeting"
30001
30014
  });
@@ -30004,13 +30017,13 @@ var BI = Lt(null), VI = {
30004
30017
  }, [i]);
30005
30018
  let { camera: ae, requestCamera: A } = xh(), { isCamMuted: oe } = qv(), se = ae.isGranted && !oe;
30006
30019
  M(() => {
30007
- te && t === "joined-meeting" && (BI.value = se);
30020
+ te && t === "joined-meeting" && (HI.value = se);
30008
30021
  }, [
30009
30022
  te,
30010
30023
  t,
30011
30024
  se
30012
30025
  ]);
30013
- let ce = N(te && !a && BI.value === !0);
30026
+ let ce = N(te && !a && HI.value === !0);
30014
30027
  M(() => {
30015
30028
  t === "joined-meeting" && ce.current && (ce.current = !1, A());
30016
30029
  }, [t, A]), M(() => {
@@ -30034,10 +30047,10 @@ var BI = Lt(null), VI = {
30034
30047
  let ue = F(() => {
30035
30048
  i();
30036
30049
  }, [i]);
30037
- if (MI({
30050
+ if (PI({
30038
30051
  active: !O && t === "joined-meeting",
30039
30052
  onTimeout: ue
30040
- }), PI({ onShutdown: ue }), !C) return null;
30053
+ }), II({ onShutdown: ue }), !C) return null;
30041
30054
  if (O) return /* @__PURE__ */ L(Dy, {
30042
30055
  defaultOpen: !0,
30043
30056
  children: /* @__PURE__ */ L("div", {
@@ -30069,14 +30082,14 @@ var BI = Lt(null), VI = {
30069
30082
  /* @__PURE__ */ L("div", {
30070
30083
  class: "relative w-full h-full z-[5]",
30071
30084
  children: [
30072
- /* @__PURE__ */ L(YI, {
30085
+ /* @__PURE__ */ L(ZI, {
30073
30086
  isAudioOnly: D,
30074
30087
  presence: ee,
30075
30088
  canvasLayoutEffect: p,
30076
30089
  canvasRenderedSlot: h
30077
30090
  }),
30078
- !D && /* @__PURE__ */ L(qI, { canvasRenderedSlot: h }),
30079
- /* @__PURE__ */ L(aI, {
30091
+ !D && /* @__PURE__ */ L(YI, { canvasRenderedSlot: h }),
30092
+ /* @__PURE__ */ L(sI, {
30080
30093
  debugEnabled: d,
30081
30094
  callPresence: ee,
30082
30095
  callControlsVisible: T,
@@ -30114,7 +30127,7 @@ var BI = Lt(null), VI = {
30114
30127
  /* @__PURE__ */ L(my, { level: !0 }),
30115
30128
  !D && /* @__PURE__ */ L(gy, {}),
30116
30129
  k && /* @__PURE__ */ L(wy, {}),
30117
- /* @__PURE__ */ L($I, { items: de }),
30130
+ /* @__PURE__ */ L(tL, { items: de }),
30118
30131
  /* @__PURE__ */ L("button", {
30119
30132
  type: "button",
30120
30133
  class: "btn btn-control btn-error",
@@ -30131,7 +30144,7 @@ var BI = Lt(null), VI = {
30131
30144
  ]
30132
30145
  }), ie && fp(/* @__PURE__ */ L(Ky, { onLeave: ue }), ie.document.body)] }) }) });
30133
30146
  });
30134
- function tL(e) {
30147
+ function rL(e) {
30135
30148
  if (!e || e.readyState < 2 || !e.videoWidth || !e.videoHeight) return null;
30136
30149
  let t = document.createElement("canvas"), n = Math.round(640 * (e.videoHeight / e.videoWidth));
30137
30150
  t.width = 640, t.height = n;
@@ -30146,7 +30159,7 @@ function tL(e) {
30146
30159
  }
30147
30160
  //#endregion
30148
30161
  //#region ../core/src/components/hair-check/index.tsx
30149
- function nL(e, t, n) {
30162
+ function iL(e, t, n) {
30150
30163
  switch (t) {
30151
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.";
30152
30165
  case "blocked": return e?.denied ?? "Microphone is blocked. Click the mic to see how to allow it.";
@@ -30157,7 +30170,7 @@ function nL(e, t, n) {
30157
30170
  default: return e?.loading ?? "Getting your microphone ready...";
30158
30171
  }
30159
30172
  }
30160
- var rL = Qf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
30173
+ var aL = Qf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
30161
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);
30162
30175
  M(() => {
30163
30176
  d();
@@ -30173,7 +30186,7 @@ var rL = Qf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
30173
30186
  u.isBlocked,
30174
30187
  f
30175
30188
  ]);
30176
- let v = p && g && !u.isGranted, y = nL(e, l.status, v);
30189
+ let v = p && g && !u.isGranted, y = iL(e, l.status, v);
30177
30190
  return /* @__PURE__ */ L(ny, { children: /* @__PURE__ */ L("div", {
30178
30191
  class: "absolute inset-0 motion-safe:animate-[tavusFadeUp_280ms_ease-out]",
30179
30192
  children: [u.isGranted && !c ? /* @__PURE__ */ L("div", {
@@ -30224,8 +30237,8 @@ var rL = Qf(({ text: e, isJoining: t = !1, onJoin: n, onCancel: r }) => {
30224
30237
  })]
30225
30238
  })]
30226
30239
  }) });
30227
- }), iL = "Password required", aL = "Enter the password to start this conversation.", oL = "Password", sL = "Continue";
30228
- function cL({ 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 }) {
30229
30242
  let [i, a] = j(""), o = Ze();
30230
30243
  return /* @__PURE__ */ L("div", {
30231
30244
  class: "absolute inset-0 z-30 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",
@@ -30245,18 +30258,18 @@ function cL({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
30245
30258
  /* @__PURE__ */ L("h3", {
30246
30259
  id: `${o}-title`,
30247
30260
  class: "card-title text-base-content",
30248
- children: t?.title ?? iL
30261
+ children: t?.title ?? oL
30249
30262
  }),
30250
30263
  /* @__PURE__ */ L("p", {
30251
30264
  class: "text-sm text-base-content/70",
30252
- children: t?.description ?? aL
30265
+ children: t?.description ?? sL
30253
30266
  }),
30254
30267
  /* @__PURE__ */ L("input", {
30255
30268
  id: o,
30256
30269
  type: "password",
30257
30270
  autocomplete: "current-password",
30258
30271
  class: "input input-bordered w-full",
30259
- placeholder: t?.placeholder ?? oL,
30272
+ placeholder: t?.placeholder ?? cL,
30260
30273
  value: i,
30261
30274
  disabled: n,
30262
30275
  onInput: (e) => a(e.target.value),
@@ -30272,7 +30285,7 @@ function cL({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
30272
30285
  type: "submit",
30273
30286
  disabled: !i.trim(),
30274
30287
  loading: n,
30275
- children: t?.submit ?? sL
30288
+ children: t?.submit ?? lL
30276
30289
  })
30277
30290
  ]
30278
30291
  })
@@ -30281,7 +30294,7 @@ function cL({ onSubmit: e, text: t, isSubmitting: n = !1, errorMessage: r }) {
30281
30294
  }
30282
30295
  //#endregion
30283
30296
  //#region ../core/src/components/welcome/index.tsx
30284
- function lL({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
30297
+ function dL({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
30285
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), [
30286
30299
  p,
30287
30300
  a,
@@ -30290,7 +30303,7 @@ function lL({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
30290
30303
  return /* @__PURE__ */ L(Fv, {
30291
30304
  title: c.title,
30292
30305
  description: c.description,
30293
- overlay: v && s ? /* @__PURE__ */ L(cL, { onSubmit: s.setPassword }) : null,
30306
+ overlay: v && s ? /* @__PURE__ */ L(uL, { onSubmit: s.setPassword }) : null,
30294
30307
  children: [/* @__PURE__ */ L("div", {
30295
30308
  class: "relative",
30296
30309
  children: [r && /* @__PURE__ */ L(wv, {
@@ -30328,28 +30341,28 @@ function lL({ text: e, onStart: t, isStarting: n, permissionRequest: r }) {
30328
30341
  }
30329
30342
  //#endregion
30330
30343
  //#region ../core/src/hooks/use-haircheck-text.ts
30331
- function uL(...e) {
30344
+ function fL(...e) {
30332
30345
  for (let t of e) {
30333
30346
  let e = t?.trim();
30334
30347
  if (e) return e;
30335
30348
  }
30336
30349
  }
30337
- function dL() {
30350
+ function pL() {
30338
30351
  let { config: e } = sh(), { haircheck: t } = e.value.customization;
30339
30352
  return P(() => ({
30340
- prompt: uL(t.permission_request_description, t.permission_request_title),
30341
- ready: uL(t.permission_granted_description, t.permission_granted_title),
30342
- denied: uL(t.permission_denied_description, t.permission_denied_title),
30343
- join: uL(t.join_button),
30344
- cancel: uL(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)
30345
30358
  }), [t]);
30346
30359
  }
30347
30360
  //#endregion
30348
30361
  //#region ../core/src/shells/flow-state-body.tsx
30349
- function fL({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30350
- let r = dL();
30362
+ function mL({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30363
+ let r = pL();
30351
30364
  switch (e.state) {
30352
- case "idle": return /* @__PURE__ */ L(lL, {
30365
+ case "idle": return /* @__PURE__ */ L(dL, {
30353
30366
  text: t,
30354
30367
  onStart: () => {
30355
30368
  e.start();
@@ -30357,7 +30370,7 @@ function fL({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30357
30370
  isStarting: e.isStarting,
30358
30371
  permissionRequest: e.permissionRequest
30359
30372
  });
30360
- case "haircheck": return /* @__PURE__ */ L(rL, {
30373
+ case "haircheck": return /* @__PURE__ */ L(aL, {
30361
30374
  text: r,
30362
30375
  onJoin: () => {
30363
30376
  e.join();
@@ -30365,7 +30378,7 @@ function fL({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30365
30378
  onCancel: () => e.cancel(),
30366
30379
  isJoining: e.isStarting
30367
30380
  });
30368
- case "call": return /* @__PURE__ */ L(eL, { onLeave: () => e.leave() });
30381
+ case "call": return /* @__PURE__ */ L(nL, { onLeave: () => e.leave() });
30369
30382
  case "ended": return /* @__PURE__ */ L(Uv, {
30370
30383
  isStarting: e.isStarting,
30371
30384
  permissionRequest: e.permissionRequest,
@@ -30390,7 +30403,7 @@ function fL({ flow: e, welcomeText: t, onUnavailableCancel: n }) {
30390
30403
  }
30391
30404
  //#endregion
30392
30405
  //#region ../core/src/shells/embed/embed-shell.tsx
30393
- function pL() {
30406
+ function hL() {
30394
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;
30395
30408
  return /* @__PURE__ */ L(Og, { children: t.value ? /* @__PURE__ */ L(vv, {
30396
30409
  cause: "error",
@@ -30400,18 +30413,18 @@ function pL() {
30400
30413
  cause: o ?? "daily_limit",
30401
30414
  canRetry: !1,
30402
30415
  onRetry: () => {}
30403
- }) : /* @__PURE__ */ L(fL, {
30416
+ }) : /* @__PURE__ */ L(mL, {
30404
30417
  flow: r,
30405
30418
  welcomeText: i
30406
30419
  }) });
30407
30420
  }
30408
30421
  //#endregion
30409
30422
  //#region ../core/src/embed/tavus-embed.tsx
30410
- var mL = ":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}";
30411
- function hL(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) {
30412
30425
  return /* @__PURE__ */ L(E, { children: [
30413
30426
  /* @__PURE__ */ L("style", { dangerouslySetInnerHTML: { __html: Pe } }),
30414
- /* @__PURE__ */ L("style", { dangerouslySetInnerHTML: { __html: mL } }),
30427
+ /* @__PURE__ */ L("style", { dangerouslySetInnerHTML: { __html: gL } }),
30415
30428
  /* @__PURE__ */ L(yt, {
30416
30429
  surface: "embed",
30417
30430
  layout: e.layout,
@@ -30426,14 +30439,14 @@ function hL(e) {
30426
30439
  token: e.token,
30427
30440
  children: /* @__PURE__ */ L(Dr, {
30428
30441
  fallback: /* @__PURE__ */ L(Eg, {}),
30429
- 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(pL, {}) }) }) }) }) }) }) })
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, {}) }) }) }) }) }) }) })
30430
30443
  })
30431
30444
  })
30432
30445
  ] });
30433
30446
  }
30434
- var gL;
30435
- function _L() {
30436
- gL ||= Ee(hL, "tavus-embed", [
30447
+ var vL;
30448
+ function yL() {
30449
+ vL ||= Ee(_L, "tavus-embed", [
30437
30450
  "layout",
30438
30451
  "camera-on-start",
30439
30452
  "deployment-id",
@@ -30452,7 +30465,7 @@ function _L() {
30452
30465
  fn("Widget");
30453
30466
  //#endregion
30454
30467
  //#region src/integration.ts
30455
- var vL = [
30468
+ var bL = [
30456
30469
  "tavus:chat-message",
30457
30470
  "tavus:conversation-created",
30458
30471
  "tavus:conversation-ended",
@@ -30464,7 +30477,7 @@ var vL = [
30464
30477
  "tavus:ready",
30465
30478
  "tavus:state-change",
30466
30479
  "tavus:tool-call"
30467
- ], yL = class {
30480
+ ], xL = class {
30468
30481
  element = null;
30469
30482
  tagName;
30470
30483
  constructor(e = "tavus-embed") {
@@ -30515,6 +30528,6 @@ var vL = [
30515
30528
  };
30516
30529
  //#endregion
30517
30530
  //#region src/index.ts
30518
- typeof window < "u" && _L();
30531
+ typeof window < "u" && yL();
30519
30532
  //#endregion
30520
- export { vL as TAVUS_EVENT_NAMES, yL as TavusIntegration };
30533
+ export { bL as TAVUS_EVENT_NAMES, xL as TavusIntegration };