@tavus/embed 0.19.5 → 0.19.6

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
@@ -3101,7 +3101,7 @@ var jn = class extends Error {
3101
3101
  }
3102
3102
  }, Mn = {
3103
3103
  name: "@tavus/embed",
3104
- version: "0.19.5",
3104
+ version: "0.19.6",
3105
3105
  variant: "embed"
3106
3106
  }, Nn = /* @__PURE__ */ new Set([
3107
3107
  "Error",
@@ -3804,11 +3804,7 @@ function Pr({ children: e, fallback: t }) {
3804
3804
  y("pending");
3805
3805
  return;
3806
3806
  }
3807
- if (!t) {
3808
- y("done");
3809
- return;
3810
- }
3811
- if (globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1) {
3807
+ if (!t || (globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1)) {
3812
3808
  y("done");
3813
3809
  return;
3814
3810
  }
@@ -3902,11 +3898,11 @@ function Br(e) {
3902
3898
  if (zr(e) != "object" || !e) return e;
3903
3899
  var n = e[Symbol.toPrimitive];
3904
3900
  if (n !== void 0) {
3905
- var r = n.call(e, t || "default");
3901
+ var r = n.call(e, t);
3906
3902
  if (zr(r) != "object") return r;
3907
3903
  throw TypeError("@@toPrimitive must return a primitive value.");
3908
3904
  }
3909
- return (t === "string" ? String : Number)(e);
3905
+ return String(e);
3910
3906
  }(e, "string");
3911
3907
  return zr(t) == "symbol" ? t : t + "";
3912
3908
  }
@@ -7337,7 +7333,7 @@ var ss = class extends Error {
7337
7333
  }
7338
7334
  _prepareEvent(e, t, n = ao(), r = oo()) {
7339
7335
  let i = this.getOptions(), a = Object.keys(this._integrations);
7340
- return !t.integrations && a.length > 0 && (t.integrations = a), this.emit("preprocessEvent", e, t), e.type || r.setLastEventId(e.event_id || t.event_id), Yo(i, e, t, n, this, r).then((e) => e === null ? e : (e.contexts = {
7336
+ return !t.integrations && a.length > 0 && (t.integrations = a), this.emit("preprocessEvent", e, t), e.type || r.setLastEventId(e.event_id || t.event_id), Yo(i, e, t, n, this, r).then((e) => (e === null || (e.contexts = {
7341
7337
  trace: co(n),
7342
7338
  ...e.contexts
7343
7339
  }, e.sdkProcessingMetadata = {
@@ -7346,7 +7342,7 @@ var ss = class extends Error {
7346
7342
  return n.dsc || Co(n.traceId, e);
7347
7343
  }(this, n),
7348
7344
  ...e.sdkProcessingMetadata
7349
- }, e));
7345
+ }), e));
7350
7346
  }
7351
7347
  _captureEvent(e, t = {}, n) {
7352
7348
  return this._processEvent(e, t, n).then((e) => e.event_id, (e) => {
@@ -8194,10 +8190,10 @@ function yc() {
8194
8190
  } }), e.apply(t, n);
8195
8191
  } }), e.send = new Proxy(e.send, { apply(e, t, n) {
8196
8192
  let r = t[vc];
8197
- return r ? (n[0] !== void 0 && (r.body = n[0]), Xi("xhr", {
8193
+ return r && (n[0] !== void 0 && (r.body = n[0]), Xi("xhr", {
8198
8194
  startTimestamp: 1e3 * Na(),
8199
8195
  xhr: t
8200
- }), e.apply(t, n)) : e.apply(t, n);
8196
+ })), e.apply(t, n);
8201
8197
  } });
8202
8198
  }
8203
8199
  function bc(e, t = function(e) {
@@ -11360,9 +11356,7 @@ var rf = function() {
11360
11356
  if (delete n.action, delete n.callbackStamp, n.error) {
11361
11357
  var i = Error(n.error.message);
11362
11358
  i.type = n.error.type, r(i);
11363
- return;
11364
- }
11365
- n.returnPreloadCache ? e(t._devicesFromInputSettings(t._inputSettings)) : e(n);
11359
+ } else n.returnPreloadCache ? e(t._devicesFromInputSettings(t._inputSettings)) : e(n);
11366
11360
  });
11367
11361
  });
11368
11362
  }), function(e) {
@@ -11500,16 +11494,16 @@ var rf = function() {
11500
11494
  },
11501
11495
  preserveIframe: !0
11502
11496
  }), r(o);
11503
- return;
11497
+ } else {
11498
+ var s, c = n[i++];
11499
+ t._iframe.src = wi(c, t.properties.dailyConfig);
11500
+ var l = setTimeout(function() {
11501
+ t._loadedCallback && (t._loadedCallback = null, a());
11502
+ }, 25e3);
11503
+ t._loadedCallback = function(n) {
11504
+ clearTimeout(l), t._callState === "error" ? r(n) : (Si(Ci(c)), t._updateCallState(Wc), (t.properties.cssFile || t.properties.cssText) && t.loadCss(t.properties), e());
11505
+ };
11504
11506
  }
11505
- var s, c = n[i++];
11506
- t._iframe.src = wi(c, t.properties.dailyConfig);
11507
- var l = setTimeout(function() {
11508
- t._loadedCallback && (t._loadedCallback = null, a());
11509
- }, 25e3);
11510
- t._loadedCallback = function(n) {
11511
- clearTimeout(l), t._callState === "error" ? r(n) : (Si(Ci(c)), t._updateCallState(Wc), (t.properties.cssFile || t.properties.cssText) && t.loadCss(t.properties), e());
11512
- };
11513
11507
  };
11514
11508
  a();
11515
11509
  });
@@ -12401,10 +12395,10 @@ var rf = function() {
12401
12395
  {
12402
12396
  key: "setCustomIntegrations",
12403
12397
  value: function(e) {
12404
- return mf(), pf(this._callObjectMode, "setCustomIntegrations()"), sf(this._callState, "setCustomIntegrations()"), Df(e) ? (this.sendMessageToCallMachine({
12398
+ return mf(), pf(this._callObjectMode, "setCustomIntegrations()"), sf(this._callState, "setCustomIntegrations()"), Df(e) && (this.sendMessageToCallMachine({
12405
12399
  action: "set-custom-integrations",
12406
12400
  integrations: e
12407
- }), this._customIntegrations = e, this) : this;
12401
+ }), this._customIntegrations = e), this;
12408
12402
  }
12409
12403
  },
12410
12404
  {
@@ -13631,13 +13625,10 @@ function Ff(e, t) {
13631
13625
  let n = It(void 0), r = It(void 0), i = It("idle"), a = It("idle"), o = It([]), s = It([]), c = It([]), l = 0, u = 0, d = !1;
13632
13626
  async function f() {
13633
13627
  let t = ++l;
13634
- if (!navigator.mediaDevices?.getUserMedia || !navigator.mediaDevices?.enumerateDevices) {
13635
- Ct(() => {
13636
- i.value = "not-supported", a.value = "not-supported";
13637
- });
13638
- return;
13639
- }
13640
- try {
13628
+ if (!navigator.mediaDevices?.getUserMedia || !navigator.mediaDevices?.enumerateDevices) Ct(() => {
13629
+ i.value = "not-supported", a.value = "not-supported";
13630
+ });
13631
+ else try {
13641
13632
  let { devices: n } = await e.enumerateDevices(), { camera: r, mic: i, speaker: a } = await e.getInputDevices();
13642
13633
  if (d || t !== l) return;
13643
13634
  Ct(() => {
@@ -14295,11 +14286,8 @@ var Rp = dp(mp(function({ automirror: e, fit: t = "contain", mirror: n, onResize
14295
14286
  }, []), N(function() {
14296
14287
  let e = m.current;
14297
14288
  if (e && y) {
14298
- if (typeof MediaStream > "u") {
14299
- console.warn(`MediaStream API not available. Can't setup ${c} for ${o}`);
14300
- return;
14301
- }
14302
- return e.srcObject = new MediaStream([y]), e.load(), () => {
14289
+ if (typeof MediaStream > "u") console.warn(`MediaStream API not available. Can't setup ${c} for ${o}`);
14290
+ else return e.srcObject = new MediaStream([y]), e.load(), () => {
14303
14291
  e.srcObject = null, e.load();
14304
14292
  };
14305
14293
  }
@@ -15372,16 +15360,12 @@ function hh({ children: e }) {
15372
15360
  let Ee = I((e) => {
15373
15361
  if (!l) return;
15374
15362
  let t = h.peek();
15375
- if (!t) {
15376
- $m.warn("sendChat called before session was established; dropping message");
15377
- return;
15378
- }
15379
- k.markSent(e), l.sendAppMessage(Lm(t.conversationId, e, r.peek().customization.conversation.modality === "chat"), "*"), _.value = [..._.peek(), {
15363
+ t ? (k.markSent(e), l.sendAppMessage(Lm(t.conversationId, e, r.peek().customization.conversation.modality === "chat"), "*"), _.value = [..._.peek(), {
15380
15364
  id: crypto.randomUUID(),
15381
15365
  sender: "user",
15382
15366
  text: e,
15383
15367
  timestamp: Date.now()
15384
- }];
15368
+ }]) : $m.warn("sendChat called before session was established; dropping message");
15385
15369
  }, [
15386
15370
  l,
15387
15371
  _,
@@ -15394,11 +15378,7 @@ function hh({ children: e }) {
15394
15378
  return;
15395
15379
  }
15396
15380
  let t = h.peek();
15397
- if (!t) {
15398
- $m.warn("sendMessage called before session was established; dropping message");
15399
- return;
15400
- }
15401
- e.event_type === "conversation.respond" && k.markSent(e.properties.text), l.sendAppMessage(Xm(t.conversationId, e, r.peek().customization.conversation.modality === "chat"), "*");
15381
+ t ? (e.event_type === "conversation.respond" && k.markSent(e.properties.text), l.sendAppMessage(Xm(t.conversationId, e, r.peek().customization.conversation.modality === "chat"), "*")) : $m.warn("sendMessage called before session was established; dropping message");
15402
15382
  }, [
15403
15383
  l,
15404
15384
  h,
@@ -15546,49 +15526,17 @@ function wh({ captcha: e, deploymentId: t, onToken: n, onFallback: r, onInteract
15546
15526
  return;
15547
15527
  }
15548
15528
  gh.warn("Captcha error keeps recurring, falling back to no-token mode"), h(!0), r(y.current >= 2 ? "unsupported" : "exhausted");
15549
- return;
15550
- }
15551
- gh.warn("Captcha error is not retryable, falling back to no-token mode"), h(!0), r(yh.has(e) ? "unsupported" : "broken");
15529
+ } else gh.warn("Captcha error is not retryable, falling back to no-token mode"), h(!0), r(yh.has(e) ? "unsupported" : "broken");
15552
15530
  }
15553
15531
  function s(s) {
15554
15532
  if (m || s.origin !== d) return;
15555
15533
  let c = b.current?.contentWindow;
15556
15534
  if (!c || s.source !== c) return;
15557
15535
  let u = s.data;
15558
- if (xh(u) && u.deployment_uuid === t) {
15559
- if (u.type === "ready") {
15560
- a?.(!0);
15561
- return;
15562
- }
15563
- if (u.type === "load-error") {
15564
- h(!0), o?.();
15565
- return;
15566
- }
15567
- if (u.type === "interactive") {
15568
- _(!0), i?.(!0);
15569
- return;
15570
- }
15571
- if (u.type === "interaction-ended") {
15572
- _(!1), i?.(!1);
15573
- return;
15574
- }
15575
- if (u.type === "unsupported") {
15576
- h(!0), r("unsupported");
15577
- return;
15578
- }
15579
- if (u.type === "token" && u.token) {
15580
- gh.info("Captcha token received"), _(!1), i?.(!1), n(u.token);
15581
- return;
15582
- }
15583
- if (u.type === "expired") {
15584
- l?.record({
15585
- stage: "captcha",
15586
- outcome: "expired"
15587
- }), gh.info("Captcha token expired, reloading iframe"), C();
15588
- return;
15589
- }
15590
- u.type === "error" && e(String(u.code ?? ""));
15591
- }
15536
+ xh(u) && u.deployment_uuid === t && (u.type === "ready" ? a?.(!0) : u.type === "load-error" ? (h(!0), o?.()) : u.type === "interactive" ? (_(!0), i?.(!0)) : u.type === "interaction-ended" ? (_(!1), i?.(!1)) : u.type === "unsupported" ? (h(!0), r("unsupported")) : u.type === "token" && u.token ? (gh.info("Captcha token received"), _(!1), i?.(!1), n(u.token)) : u.type === "expired" ? (l?.record({
15537
+ stage: "captcha",
15538
+ outcome: "expired"
15539
+ }), gh.info("Captcha token expired, reloading iframe"), C()) : u.type === "error" && e(String(u.code ?? "")));
15592
15540
  }
15593
15541
  return window.addEventListener("message", s), () => window.removeEventListener("message", s);
15594
15542
  }, [
@@ -15695,22 +15643,14 @@ function Oh({ children: e }) {
15695
15643
  kind: "unavailable",
15696
15644
  reason: "cancelled"
15697
15645
  });
15698
- if (d.current.push(l), c = u.subscribe((e) => {
15699
- if (clearTimeout(o), e && !n) {
15700
- m({
15701
- kind: "unavailable",
15702
- reason: "interactive"
15703
- });
15704
- return;
15705
- }
15706
- e || (o = setTimeout(() => b("Captcha mint timed out", "timeout", p.current ? "captcha.execute" : "captcha.load"), Eh));
15707
- }), a) {
15708
- c();
15709
- return;
15710
- }
15711
- s = i?.captchaToken.subscribe((e) => {
15646
+ d.current.push(l), c = u.subscribe((e) => {
15647
+ clearTimeout(o), e && !n ? m({
15648
+ kind: "unavailable",
15649
+ reason: "interactive"
15650
+ }) : e || (o = setTimeout(() => b("Captcha mint timed out", "timeout", p.current ? "captcha.execute" : "captcha.load"), Eh));
15651
+ }), a ? c() : (s = i?.captchaToken.subscribe((e) => {
15712
15652
  e !== null && l({ kind: "token" });
15713
- }), e?.aborted ? h() : e?.addEventListener("abort", h, { once: !0 });
15653
+ }), e?.aborted ? h() : e?.addEventListener("abort", h, { once: !0 }));
15714
15654
  })) : { kind: "token" }, [
15715
15655
  s,
15716
15656
  t,
@@ -15843,11 +15783,7 @@ function Uh() {
15843
15783
  });
15844
15784
  });
15845
15785
  }, [g, e]), w = I(() => {
15846
- if (v(!0), !t) {
15847
- S(!0);
15848
- return;
15849
- }
15850
- C(t);
15786
+ v(!0), t ? C(t) : S(!0);
15851
15787
  }, [t, C]);
15852
15788
  N(() => {
15853
15789
  x && t && (S(!1), C(t));
@@ -15858,22 +15794,21 @@ function Uh() {
15858
15794
  ]);
15859
15795
  let T = I(async () => {
15860
15796
  if (t) {
15861
- if (b(!0), p) {
15797
+ if (b(!0), p) t.setLocalVideo(!0);
15798
+ else {
15799
+ try {
15800
+ await t.setInputDevicesAsync({ videoSource: !0 });
15801
+ } catch (t) {
15802
+ Er(e, t, {
15803
+ stage: "permissions",
15804
+ outcome: "failed",
15805
+ operation: "media.camera",
15806
+ component: "permissions",
15807
+ handled: !0
15808
+ });
15809
+ }
15862
15810
  t.setLocalVideo(!0);
15863
- return;
15864
- }
15865
- try {
15866
- await t.setInputDevicesAsync({ videoSource: !0 });
15867
- } catch (t) {
15868
- Er(e, t, {
15869
- stage: "permissions",
15870
- outcome: "failed",
15871
- operation: "media.camera",
15872
- component: "permissions",
15873
- handled: !0
15874
- });
15875
15811
  }
15876
- t.setLocalVideo(!0);
15877
15812
  }
15878
15813
  }, [
15879
15814
  t,
@@ -16113,18 +16048,12 @@ function Qh({ children: e }) {
16113
16048
  }
16114
16049
  }, [ye]), Se = I(() => {
16115
16050
  let e = ge.current;
16116
- if (e && !e.proceeding) {
16117
- if (e.proceeding = !0, t.peek().customization.conversation.modality === "video" && i === "on" && !ie.isGranted && !ie.isBlocked) {
16118
- k({
16119
- kind: "camera",
16120
- status: ie.status
16121
- }), ae().finally(() => {
16122
- xe();
16123
- });
16124
- return;
16125
- }
16051
+ e && !e.proceeding && (e.proceeding = !0, t.peek().customization.conversation.modality === "video" && i === "on" && !ie.isGranted && !ie.isBlocked ? (k({
16052
+ kind: "camera",
16053
+ status: ie.status
16054
+ }), ae().finally(() => {
16126
16055
  xe();
16127
- }
16056
+ })) : xe());
16128
16057
  }, [
16129
16058
  t,
16130
16059
  i,
@@ -16137,11 +16066,8 @@ function Qh({ children: e }) {
16137
16066
  if (O.status !== re.status && k({
16138
16067
  kind: "microphone",
16139
16068
  status: re.status
16140
- }), re.isGranted) {
16141
- Se();
16142
- return;
16143
- }
16144
- if (re.isBlocked) {
16069
+ }), re.isGranted) Se();
16070
+ else if (re.isBlocked) {
16145
16071
  let e = ge.current;
16146
16072
  ge.current = null, D(!1), e.resolve();
16147
16073
  }
@@ -16196,11 +16122,8 @@ function Qh({ children: e }) {
16196
16122
  }
16197
16123
  let u = g();
16198
16124
  if (u && !o && await u, !e.signal.aborted) {
16199
- if (f(), s && !pe.current) {
16200
- T("haircheck");
16201
- return;
16202
- }
16203
- return c ? Ce(e) : ye(e);
16125
+ if (f(), s && !pe.current) T("haircheck");
16126
+ else return c ? Ce(e) : ye(e);
16204
16127
  }
16205
16128
  }, [
16206
16129
  w,
@@ -16330,10 +16253,10 @@ function rg({ children: e }) {
16330
16253
  try {
16331
16254
  return { conversationId: (await (e ? e.create() : t.create())).conversationId };
16332
16255
  } catch (e) {
16333
- throw e instanceof DOMException && e.name === "AbortError" ? e : (eg.error("createConversation failed", e), f("tavus:error", {
16256
+ throw e instanceof DOMException && e.name === "AbortError" || (eg.error("createConversation failed", e), f("tavus:error", {
16334
16257
  code: "CONVERSATION_CREATE_FAILED",
16335
16258
  message: e instanceof Error ? e.message : String(e)
16336
- }), e);
16259
+ })), e;
16337
16260
  }
16338
16261
  },
16339
16262
  startConversation: async (e) => {
@@ -16855,13 +16778,7 @@ function e_(e, t, n = []) {
16855
16778
  //#region ../../node_modules/lucide-preact/dist/esm/shared/src/utils/toCamelCase.mjs
16856
16779
  var t_ = (e) => {
16857
16780
  let t = "", n = !1;
16858
- for (let r of e) {
16859
- if (r === "-" || r === "_" || r <= " ") {
16860
- n = t.length > 0;
16861
- continue;
16862
- }
16863
- t.length === 0 ? t += r.toLowerCase() : t += n ? r.toUpperCase() : r, n = !1;
16864
- }
16781
+ for (let r of e) r === "-" || r === "_" || r <= " " ? n = t.length > 0 : (t.length === 0 ? t += r.toLowerCase() : t += n ? r.toUpperCase() : r, n = !1);
16865
16782
  return t;
16866
16783
  }, n_ = (e) => {
16867
16784
  let t = t_(e);
@@ -17590,11 +17507,7 @@ function Ov({ url: e, onError: t }) {
17590
17507
  alt: "",
17591
17508
  onLoad: () => s(!0),
17592
17509
  onError: () => {
17593
- if (t) {
17594
- t();
17595
- return;
17596
- }
17597
- Tv(n, "degraded", e, r), a(!0);
17510
+ t ? t() : (Tv(n, "degraded", e, r), a(!0));
17598
17511
  }
17599
17512
  })] });
17600
17513
  }
@@ -19907,11 +19820,7 @@ function mS({ canvasLayoutEffect: e, smartSidecarActive: t, isScreenSharing: n,
19907
19820
  let e = !1, t = 0, n, r = 0, a = () => {
19908
19821
  if (e) return;
19909
19822
  let t = i(d.current);
19910
- if (t) {
19911
- p(t);
19912
- return;
19913
- }
19914
- r += 1, r < 8 && (n = globalThis.setTimeout(a, 150));
19823
+ t ? p(t) : (r += 1, r < 8 && (n = globalThis.setTimeout(a, 150)));
19915
19824
  };
19916
19825
  return typeof globalThis.requestAnimationFrame == "function" ? t = globalThis.requestAnimationFrame(a) : n = globalThis.setTimeout(a, 0), () => {
19917
19826
  e = !0, t && globalThis.cancelAnimationFrame?.(t), n && globalThis.clearTimeout(n);
@@ -20011,6 +19920,7 @@ var hS = 480, gS = dp(({ personaSessionId: e, isAudioOnly: t, avatarOff: n, canv
20011
19920
  })
20012
19921
  });
20013
19922
  }), _S;
19923
+ /* @__NO_SIDE_EFFECTS__ */
20014
19924
  function K(e, t, n) {
20015
19925
  function r(n, r) {
20016
19926
  if (n._zod || Object.defineProperty(n, "_zod", {
@@ -20332,7 +20242,7 @@ var iC = (e, t) => {
20332
20242
  value: () => e.message,
20333
20243
  enumerable: !1
20334
20244
  });
20335
- }, aC = K("$ZodError", iC), oC = K("$ZodError", iC, { Parent: Error });
20245
+ }, aC = /* @__PURE__ */ K("$ZodError", iC), oC = /* @__PURE__ */ K("$ZodError", iC, { Parent: Error });
20336
20246
  function sC(e, t = (e) => e.message) {
20337
20247
  let n = {}, r = [];
20338
20248
  for (let i of e.issues) i.path.length > 0 ? (n[i.path[0]] = n[i.path[0]] || [], n[i.path[0]].push(t(i))) : r.push(t(i));
@@ -21122,16 +21032,12 @@ function aT(e, t, n, r, i, a) {
21122
21032
  if (i && a && !o) return;
21123
21033
  t.issues.push(...$S(n, e.issues));
21124
21034
  }
21125
- if (!o && !i) {
21126
- e.issues.length || t.issues.push({
21127
- code: "invalid_type",
21128
- expected: "nonoptional",
21129
- input: void 0,
21130
- path: [n]
21131
- });
21132
- return;
21133
- }
21134
- e.value === void 0 ? o && (t.value[n] = void 0) : t.value[n] = e.value;
21035
+ !o && !i ? e.issues.length || t.issues.push({
21036
+ code: "invalid_type",
21037
+ expected: "nonoptional",
21038
+ input: void 0,
21039
+ path: [n]
21040
+ }) : e.value === void 0 ? o && (t.value[n] = void 0) : t.value[n] = e.value;
21135
21041
  }
21136
21042
  function oT(e) {
21137
21043
  let t = Object.keys(e.shape);
@@ -22345,28 +22251,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
22345
22251
  }
22346
22252
  for (let n of e.seen.entries()) {
22347
22253
  let r = n[1];
22348
- if (t === n[0]) {
22349
- a(n);
22350
- continue;
22351
- }
22352
- if (e.external) {
22353
- let r = e.external.registry.get(n[0])?.id;
22354
- if (t !== n[0] && r) {
22355
- a(n);
22356
- continue;
22254
+ if (t === n[0]) a(n);
22255
+ else {
22256
+ if (e.external) {
22257
+ let r = e.external.registry.get(n[0])?.id;
22258
+ if (t !== n[0] && r) {
22259
+ a(n);
22260
+ continue;
22261
+ }
22357
22262
  }
22358
- }
22359
- if (e.metadataRegistry.get(n[0])?.id) {
22360
- a(n);
22361
- continue;
22362
- }
22363
- if (r.cycle) {
22364
- a(n);
22365
- continue;
22366
- }
22367
- if (r.count > 1 && e.reused === "ref") {
22368
- a(n);
22369
- continue;
22263
+ (e.metadataRegistry.get(n[0])?.id || r.cycle || r.count > 1 && e.reused === "ref") && a(n);
22370
22264
  }
22371
22265
  }
22372
22266
  }
@@ -24010,23 +23904,19 @@ var rM = class {
24010
23904
  if (!await this._taskStore.getTask(r, t.sessionId)) throw new Jj(Ik.InvalidParams, `Task not found: ${r}`);
24011
23905
  if (this._taskMessageQueue) {
24012
23906
  let e;
24013
- for (; e = await this._taskMessageQueue.dequeue(r, t.sessionId);) {
24014
- if (e.type === "response" || e.type === "error") {
24015
- let t = e.message, n = t.id, r = this._requestResolvers.get(n);
24016
- if (r) {
24017
- if (this._requestResolvers.delete(n), e.type === "response") r(t);
24018
- else {
24019
- let e = t;
24020
- r(new Jj(e.error.code, e.error.message, e.error.data));
24021
- }
24022
- } else {
24023
- let t = e.type === "response" ? "Response" : "Error";
24024
- this._onerror(/* @__PURE__ */ Error(`${t} handler missing for request ${n}`));
23907
+ for (; e = await this._taskMessageQueue.dequeue(r, t.sessionId);) if (e.type === "response" || e.type === "error") {
23908
+ let t = e.message, n = t.id, r = this._requestResolvers.get(n);
23909
+ if (r) {
23910
+ if (this._requestResolvers.delete(n), e.type === "response") r(t);
23911
+ else {
23912
+ let e = t;
23913
+ r(new Jj(e.error.code, e.error.message, e.error.data));
24025
23914
  }
24026
- continue;
23915
+ } else {
23916
+ let t = e.type === "response" ? "Response" : "Error";
23917
+ this._onerror(/* @__PURE__ */ Error(`${t} handler missing for request ${n}`));
24027
23918
  }
24028
- await this._transport?.send(e.message, { relatedRequestId: t.requestId });
24029
- }
23919
+ } else await this._transport?.send(e.message, { relatedRequestId: t.requestId });
24030
23920
  }
24031
23921
  let i = await this._taskStore.getTask(r, t.sessionId);
24032
23922
  if (!i) throw new Jj(Ik.InvalidParams, `Task not found: ${r}`);
@@ -27285,24 +27175,12 @@ var dP = (e, t) => {
27285
27175
  CP(i, t, n, r);
27286
27176
  }
27287
27177
  }, CP = (e, t, n, r) => {
27288
- if (typeof e == "string") {
27289
- wP(e, t, n);
27290
- return;
27291
- }
27292
- if (typeof e == "function") {
27293
- TP(e, t, n, r);
27294
- return;
27295
- }
27296
- EP(e, t, n, r);
27178
+ typeof e == "string" ? wP(e, t, n) : typeof e == "function" ? TP(e, t, n, r) : EP(e, t, n, r);
27297
27179
  }, wP = (e, t, n) => {
27298
27180
  let r = e === "" ? t : DP(t, e);
27299
27181
  r.classGroupId = n;
27300
27182
  }, TP = (e, t, n, r) => {
27301
- if (OP(e)) {
27302
- SP(e(r), t, n, r);
27303
- return;
27304
- }
27305
- t.validators === null && (t.validators = []), t.validators.push(fP(n, e));
27183
+ OP(e) ? SP(e(r), t, n, r) : (t.validators === null && (t.validators = []), t.validators.push(fP(n, e)));
27306
27184
  }, EP = (e, t, n, r) => {
27307
27185
  let i = Object.entries(e), a = i.length;
27308
27186
  for (let e = 0; e < a; e++) {
@@ -27411,11 +27289,7 @@ var dP = (e, t) => {
27411
27289
  e && e !== g && (g = e, h = !1);
27412
27290
  } else g = r(p);
27413
27291
  if (!g) {
27414
- if (!h) {
27415
- l = t + (l.length > 0 ? " " + l : l);
27416
- continue;
27417
- }
27418
- if (g = r(p), !g) {
27292
+ if (!h || (g = r(p), !g)) {
27419
27293
  l = t + (l.length > 0 ? " " + l : l);
27420
27294
  continue;
27421
27295
  }
@@ -29539,11 +29413,7 @@ function FI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
29539
29413
  ...e
29540
29414
  }));
29541
29415
  }, [u]), se = I((e, t = "*") => {
29542
- if (m !== "joined-meeting") {
29543
- oe({ lastError: "Dropped Magic Canvas app message because the Daily meeting is not joined." });
29544
- return;
29545
- }
29546
- p?.sendAppMessage(e, t);
29416
+ m === "joined-meeting" ? p?.sendAppMessage(e, t) : oe({ lastError: "Dropped Magic Canvas app message because the Daily meeting is not joined." });
29547
29417
  }, [
29548
29418
  p,
29549
29419
  m,
@@ -29558,19 +29428,13 @@ function FI({ onLayoutEffectChange: e, onRenderedSlotChange: t, debugEnabled: n
29558
29428
  enabled: n
29559
29429
  });
29560
29430
  }, [n]), ep({ onAppMessage: I((e) => {
29561
- if (m !== "joined-meeting") {
29562
- oe({
29563
- lastToolCall: e.data,
29564
- iframeLifecycleState: "idle",
29565
- lastError: "Dropped Magic Canvas tool call because the Daily meeting is not joined."
29566
- });
29567
- return;
29568
- }
29569
- if (Ym(e.data)) {
29570
- C.current !== null && ne();
29571
- return;
29572
- }
29573
- try {
29431
+ if (m !== "joined-meeting") oe({
29432
+ lastToolCall: e.data,
29433
+ iframeLifecycleState: "idle",
29434
+ lastError: "Dropped Magic Canvas tool call because the Daily meeting is not joined."
29435
+ });
29436
+ else if (Ym(e.data)) C.current !== null && ne();
29437
+ else try {
29574
29438
  let t = Ix(e.data);
29575
29439
  if (!t) return;
29576
29440
  let n = x.current, r = ex(n, t);
@@ -29759,11 +29623,7 @@ function LI({ exiting: e, instanceId: t, children: n }) {
29759
29623
  t.style.transition = "", u();
29760
29624
  let d = (e) => {
29761
29625
  let r = Math.min((e - c) / 1e3, 1 / 30);
29762
- if (c = e, s += (n * (1 - o) - i * s) / a * r, o += s * r, Math.abs(1 - o) < .002 && Math.abs(s) < .02) {
29763
- t.style.transform = "", t.style.opacity = "";
29764
- return;
29765
- }
29766
- u(), l = globalThis.requestAnimationFrame(d);
29626
+ c = e, s += (n * (1 - o) - i * s) / a * r, o += s * r, Math.abs(1 - o) < .002 && Math.abs(s) < .02 ? (t.style.transform = "", t.style.opacity = "") : (u(), l = globalThis.requestAnimationFrame(d));
29767
29627
  };
29768
29628
  return l = globalThis.requestAnimationFrame(d), () => globalThis.cancelAnimationFrame(l);
29769
29629
  }, [e, t]), N(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tavus/embed",
3
- "version": "0.19.5",
3
+ "version": "0.19.6",
4
4
  "description": "Drop a face-to-face Tavus PAL into any page with the <tavus-embed> custom element. Fully managed conversational video, no backend or API key in the browser.",
5
5
  "keywords": [
6
6
  "ai-agent",