@liforma/client 0.4.4 → 0.4.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.
Files changed (76) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/next/index.js +467 -379
  3. package/dist/next/index.js.map +1 -1
  4. package/dist/next/next/createLiformaSessionRouteHandler.d.ts +8 -0
  5. package/dist/next/next/createLiformaSessionRouteHandler.d.ts.map +1 -1
  6. package/dist/next/next/index.d.ts +8 -1
  7. package/dist/next/next/index.d.ts.map +1 -1
  8. package/dist/next/v2/api/captureAttribution.d.ts +10 -0
  9. package/dist/next/v2/api/captureAttribution.d.ts.map +1 -0
  10. package/dist/next/v2/api/mintPublicSession.d.ts +1 -0
  11. package/dist/next/v2/api/mintPublicSession.d.ts.map +1 -1
  12. package/dist/next/v2/api/sessionEndpointRequest.d.ts +1 -0
  13. package/dist/next/v2/api/sessionEndpointRequest.d.ts.map +1 -1
  14. package/dist/next/v2/embed/fullWindowHost.d.ts +20 -0
  15. package/dist/next/v2/embed/fullWindowHost.d.ts.map +1 -0
  16. package/dist/next/v2/embed/iframeHost.d.ts +4 -1
  17. package/dist/next/v2/embed/iframeHost.d.ts.map +1 -1
  18. package/dist/next/v2/embed/protocol.d.ts +18 -1
  19. package/dist/next/v2/embed/protocol.d.ts.map +1 -1
  20. package/dist/next/v2/experience.d.ts +14 -2
  21. package/dist/next/v2/experience.d.ts.map +1 -1
  22. package/dist/next/v2/types/sessionInteraction.d.ts +49 -0
  23. package/dist/next/v2/types/sessionInteraction.d.ts.map +1 -1
  24. package/dist/npm/index.js +559 -477
  25. package/dist/npm/index.js.map +1 -1
  26. package/dist/npm/v2/api/captureAttribution.d.ts +10 -0
  27. package/dist/npm/v2/api/captureAttribution.d.ts.map +1 -0
  28. package/dist/npm/v2/api/mintPublicSession.d.ts +1 -0
  29. package/dist/npm/v2/api/mintPublicSession.d.ts.map +1 -1
  30. package/dist/npm/v2/api/sessionEndpointRequest.d.ts +1 -0
  31. package/dist/npm/v2/api/sessionEndpointRequest.d.ts.map +1 -1
  32. package/dist/npm/v2/embed/fullWindowHost.d.ts +20 -0
  33. package/dist/npm/v2/embed/fullWindowHost.d.ts.map +1 -0
  34. package/dist/npm/v2/embed/iframeHost.d.ts +4 -1
  35. package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -1
  36. package/dist/npm/v2/embed/protocol.d.ts +18 -1
  37. package/dist/npm/v2/embed/protocol.d.ts.map +1 -1
  38. package/dist/npm/v2/experience.d.ts +14 -2
  39. package/dist/npm/v2/experience.d.ts.map +1 -1
  40. package/dist/npm/v2/index.d.ts +1 -1
  41. package/dist/npm/v2/index.d.ts.map +1 -1
  42. package/dist/npm/v2/npm.d.ts +2 -1
  43. package/dist/npm/v2/npm.d.ts.map +1 -1
  44. package/dist/npm/v2/types/sessionInteraction.d.ts +49 -0
  45. package/dist/npm/v2/types/sessionInteraction.d.ts.map +1 -1
  46. package/dist/npm/v2/types/sessionManifestSchema.d.ts +9 -0
  47. package/dist/npm/v2/types/sessionManifestSchema.d.ts.map +1 -1
  48. package/dist/react/component/experienceComponentLaunch.d.ts.map +1 -1
  49. package/dist/react/component/experienceComponentRuntime.d.ts +1 -0
  50. package/dist/react/component/experienceComponentRuntime.d.ts.map +1 -1
  51. package/dist/react/component/experienceComponentTypes.d.ts +7 -0
  52. package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
  53. package/dist/react/index.js +710 -621
  54. package/dist/react/index.js.map +1 -1
  55. package/dist/react/react/Experience.d.ts.map +1 -1
  56. package/dist/react/v2/api/captureAttribution.d.ts +10 -0
  57. package/dist/react/v2/api/captureAttribution.d.ts.map +1 -0
  58. package/dist/react/v2/api/mintPublicSession.d.ts +1 -0
  59. package/dist/react/v2/api/mintPublicSession.d.ts.map +1 -1
  60. package/dist/react/v2/api/sessionEndpointRequest.d.ts +1 -0
  61. package/dist/react/v2/api/sessionEndpointRequest.d.ts.map +1 -1
  62. package/dist/react/v2/embed/fullWindowHost.d.ts +20 -0
  63. package/dist/react/v2/embed/fullWindowHost.d.ts.map +1 -0
  64. package/dist/react/v2/embed/iframeHost.d.ts +4 -1
  65. package/dist/react/v2/embed/iframeHost.d.ts.map +1 -1
  66. package/dist/react/v2/embed/protocol.d.ts +18 -1
  67. package/dist/react/v2/embed/protocol.d.ts.map +1 -1
  68. package/dist/react/v2/experience.d.ts +14 -2
  69. package/dist/react/v2/experience.d.ts.map +1 -1
  70. package/dist/react/v2/types/sessionInteraction.d.ts +49 -0
  71. package/dist/react/v2/types/sessionInteraction.d.ts.map +1 -1
  72. package/dist/sdk/v2/client.js +6 -6
  73. package/dist/sdk/v2/client.js.map +1 -1
  74. package/dist/svelte/Experience.svelte +10 -0
  75. package/dist/svelte/Experience.svelte.d.ts +1 -0
  76. package/package.json +1 -1
@@ -57,7 +57,7 @@ function v(e = {}) {
57
57
  if (t instanceof Response) return t;
58
58
  }
59
59
  let v = { experienceId: u }, y = l?.locale?.trim() || l?.language?.trim();
60
- y && (v.locale = y), l?.mode && (v.mode = l.mode), l?.speechInputMode && (v.speechInputMode = l.speechInputMode), l?.speechOnly === !0 && (v.speechOnly = !0), l?.speechOnly === !1 && (v.speechOnly = !1), l?.processorId?.trim() && (v.processorId = l.processorId.trim());
60
+ y && (v.locale = y), l?.mode && (v.mode = l.mode), l?.speechInputMode && (v.speechInputMode = l.speechInputMode), l?.speechOnly === !0 && (v.speechOnly = !0), l?.speechOnly === !1 && (v.speechOnly = !1), l?.processorId?.trim() && (v.processorId = l.processorId.trim()), l?.attribution && typeof l.attribution == "object" && (v.attribution = l.attribution);
61
61
  let b = i.headers.get("Idempotency-Key")?.trim(), x = await r(`${o}/v1/sessions`, {
62
62
  method: "POST",
63
63
  headers: {
@@ -470,11 +470,11 @@ function pe(s) {
470
470
  onPointerLeave: () => {
471
471
  P.current || (I(!1), L || (B(0), V(0)));
472
472
  }
473
- }, Y = (e) => {
473
+ }, Te = (e) => {
474
474
  N.current = e;
475
475
  };
476
476
  return k === "anchor" && G ? /* @__PURE__ */ a("a", {
477
- ref: Y,
477
+ ref: Te,
478
478
  className: xe,
479
479
  style: Se,
480
480
  href: G,
@@ -486,7 +486,7 @@ function pe(s) {
486
486
  children: we
487
487
  }) : k === "button" ? /* @__PURE__ */ a("button", {
488
488
  type: "button",
489
- ref: Y,
489
+ ref: Te,
490
490
  className: xe,
491
491
  style: Se,
492
492
  "aria-label": f,
@@ -494,7 +494,7 @@ function pe(s) {
494
494
  ...J,
495
495
  children: we
496
496
  }) : /* @__PURE__ */ a("div", {
497
- ref: Y,
497
+ ref: Te,
498
498
  className: xe,
499
499
  style: Se,
500
500
  role: f ? "img" : void 0,
@@ -600,20 +600,58 @@ function Se(e, t, n) {
600
600
  });
601
601
  }
602
602
  //#endregion
603
+ //#region src/v2/api/captureAttribution.ts
604
+ var Ce = 128, we = /[\u0000-\u001f\u007f]/g;
605
+ function J(e) {
606
+ if (!e) return;
607
+ let t = e.replace(we, "").trim();
608
+ if (t) return t.slice(0, Ce);
609
+ }
610
+ function Te(e) {
611
+ let t = new URLSearchParams((e ?? "").startsWith("?") ? (e ?? "").slice(1) : e ?? "");
612
+ return {
613
+ ...J(t.get("utm_source")) ? { utmSource: J(t.get("utm_source")) } : {},
614
+ ...J(t.get("utm_medium")) ? { utmMedium: J(t.get("utm_medium")) } : {},
615
+ ...J(t.get("utm_campaign")) ? { utmCampaign: J(t.get("utm_campaign")) } : {},
616
+ ...J(t.get("utm_content")) ? { utmContent: J(t.get("utm_content")) } : {},
617
+ ...J(t.get("utm_term")) ? { utmTerm: J(t.get("utm_term")) } : {}
618
+ };
619
+ }
620
+ function Ee(e) {
621
+ if (e === !1) return;
622
+ if (e && typeof e == "object") {
623
+ let t = {
624
+ ...J(e.utmSource) ? { utmSource: J(e.utmSource) } : {},
625
+ ...J(e.utmMedium) ? { utmMedium: J(e.utmMedium) } : {},
626
+ ...J(e.utmCampaign) ? { utmCampaign: J(e.utmCampaign) } : {},
627
+ ...J(e.utmContent) ? { utmContent: J(e.utmContent) } : {},
628
+ ...J(e.utmTerm) ? { utmTerm: J(e.utmTerm) } : {},
629
+ ...J(e.referrer) ? { referrer: J(e.referrer) } : {}
630
+ };
631
+ return Object.keys(t).length ? t : void 0;
632
+ }
633
+ if (typeof window > "u") return;
634
+ let t = Te(window.location?.search), n = J(document.referrer || void 0), r = {
635
+ ...t,
636
+ ...n ? { referrer: n } : {}
637
+ };
638
+ return Object.keys(r).length ? r : void 0;
639
+ }
640
+ //#endregion
603
641
  //#region src/v2/api/sessionEndpointRequest.ts
604
- function Ce(e) {
642
+ function De(e) {
605
643
  let t = e.locale?.trim();
606
644
  if (t) return t;
607
645
  let n = e.language?.trim();
608
646
  if (n) return n;
609
647
  if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
610
648
  }
611
- function we(e) {
649
+ function Oe(e) {
612
650
  let t = e.secondaryLocale?.trim(), n = e.learningLocale?.trim();
613
651
  if (t && n && t !== n) throw Error("secondaryLocale and learningLocale disagree; pass only one or make them equal.");
614
652
  return t || n || void 0;
615
653
  }
616
- function J(e, t) {
654
+ function ke(e, t) {
617
655
  let n = e.trim();
618
656
  if (!n) throw Error("sessionEndpoint must not be empty.");
619
657
  if (typeof location > "u") throw Error("sessionEndpoint is only available in a browser.");
@@ -621,7 +659,7 @@ function J(e, t) {
621
659
  if (r.origin !== location.origin) throw Error("sessionEndpoint must be same-origin.");
622
660
  let i = t.experienceId.trim();
623
661
  if (!i) throw Error("sessionEndpoint requires experienceId.");
624
- let a = Ce(t), o = we(t), s = t.idempotencyKey?.trim();
662
+ let a = De(t), o = Oe(t), s = t.idempotencyKey?.trim();
625
663
  return {
626
664
  url: r.toString(),
627
665
  init: {
@@ -638,7 +676,11 @@ function J(e, t) {
638
676
  ...o ? { secondaryLocale: o } : {},
639
677
  ...t.mode ? { mode: t.mode } : {},
640
678
  ...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
641
- ...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly }
679
+ ...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
680
+ ...(() => {
681
+ let e = Ee(t.attribution);
682
+ return e ? { attribution: e } : {};
683
+ })()
642
684
  })
643
685
  }
644
686
  };
@@ -651,7 +693,7 @@ function Y(e) {
651
693
  function X(e) {
652
694
  return typeof e == "boolean";
653
695
  }
654
- function Te(e) {
696
+ function Ae(e) {
655
697
  if (!Y(e)) return null;
656
698
  let t = e.speech, n = e.conversation, r = e.avatar, i = e.tools;
657
699
  return !Y(t) || !Y(n) || !Y(r) || !Y(i) || !X(t.input) || !X(t.output) || !X(t.externalAudio) || !X(n.managed) || !X(r.enabled) || !X(i.enabled) ? null : {
@@ -665,7 +707,7 @@ function Te(e) {
665
707
  tools: { enabled: i.enabled }
666
708
  };
667
709
  }
668
- function Ee(e) {
710
+ function je(e) {
669
711
  return !Y(e) || !X(e.avatar) || !X(e.speechInput) || !X(e.speechOutput) || !X(e.tools) || !X(e.externalAudio) ? null : {
670
712
  speech: {
671
713
  input: e.speechInput,
@@ -677,12 +719,12 @@ function Ee(e) {
677
719
  tools: { enabled: e.tools }
678
720
  };
679
721
  }
680
- function De(e) {
681
- return Te(e) ?? Ee(e);
722
+ function Me(e) {
723
+ return Ae(e) ?? je(e);
682
724
  }
683
- function Oe(e) {
725
+ function Ne(e) {
684
726
  if (!Y(e)) throw Error("Session Launch response is missing session.");
685
- let t = typeof e.id == "string" ? e.id.trim() : "", n = typeof e.experienceId == "string" ? e.experienceId.trim() : "", r = typeof e.experienceRevisionId == "string" ? e.experienceRevisionId.trim() : "", i = typeof e.expiresAt == "string" ? e.expiresAt.trim() : "", a = typeof e.locale == "string" ? e.locale.trim() : "", o = typeof e.secondaryLocale == "string" && e.secondaryLocale.trim() ? e.secondaryLocale.trim() : void 0, s = e.mode === "conversation" || e.mode === "presenter" ? e.mode : null, c = De(e.capabilities), l = ke(e.localeVoiceFallbacks), u = e.status === "active" || e.status === "ended" ? e.status : void 0, d = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt.trim() : void 0;
727
+ let t = typeof e.id == "string" ? e.id.trim() : "", n = typeof e.experienceId == "string" ? e.experienceId.trim() : "", r = typeof e.experienceRevisionId == "string" ? e.experienceRevisionId.trim() : "", i = typeof e.expiresAt == "string" ? e.expiresAt.trim() : "", a = typeof e.locale == "string" ? e.locale.trim() : "", o = typeof e.secondaryLocale == "string" && e.secondaryLocale.trim() ? e.secondaryLocale.trim() : void 0, s = e.mode === "conversation" || e.mode === "presenter" ? e.mode : null, c = Me(e.capabilities), l = Pe(e.localeVoiceFallbacks), u = e.status === "active" || e.status === "ended" ? e.status : void 0, d = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt.trim() : void 0;
686
728
  if (!t || !n || !r || !i || !a || !s || !c) throw Error("Session Launch response has an invalid session object.");
687
729
  return {
688
730
  id: t,
@@ -698,7 +740,7 @@ function Oe(e) {
698
740
  ...d ? { createdAt: d } : {}
699
741
  };
700
742
  }
701
- function ke(e) {
743
+ function Pe(e) {
702
744
  if (!Array.isArray(e) || e.length === 0) return;
703
745
  let t = [];
704
746
  for (let n of e) {
@@ -713,35 +755,35 @@ function ke(e) {
713
755
  }
714
756
  return t.length > 0 ? t : void 0;
715
757
  }
716
- function Ae(e) {
758
+ function Fe(e) {
717
759
  let t = e.localeVoiceFallbacks;
718
760
  if (t?.length) for (let e of t) {
719
761
  let t = e.axis === "secondaryLocale" ? "secondaryLocale" : "locale";
720
762
  console.warn(`[liforma] Session ${t} fell back to ${e.resolved} because the voice does not support ${e.requested}.`);
721
763
  }
722
764
  }
723
- function je(e) {
765
+ function Ie(e) {
724
766
  if (!Y(e)) throw Error("Session Launch response must be a JSON object.");
725
767
  let t = typeof e.launch == "string" ? e.launch.trim() : "";
726
768
  if (!t) throw Error("Session Launch response is missing launch.");
727
- let n = Oe(e.session);
728
- return Ae(n), {
769
+ let n = Ne(e.session);
770
+ return Fe(n), {
729
771
  session: n,
730
772
  launch: t
731
773
  };
732
774
  }
733
775
  //#endregion
734
776
  //#region src/v2/api/mintPublicSession.ts
735
- function Me() {
777
+ function Le() {
736
778
  try {
737
779
  if (typeof globalThis.location?.origin == "string" && globalThis.location.origin) return globalThis.location.origin;
738
780
  } catch {}
739
781
  }
740
- function Ne(e) {
782
+ function Re(e) {
741
783
  return e ? e.trim().toUpperCase().replace(/-/g, "_") : "";
742
784
  }
743
- function Pe(e, t) {
744
- let n = Me(), r = Ne(t.code), i = t.message.trim(), a = t.details ?? {};
785
+ function ze(e, t) {
786
+ let n = Le(), r = Re(t.code), i = t.message.trim(), a = t.details ?? {};
745
787
  if (r === "ORIGIN_NOT_ALLOWED" || /^Origin not allowed/i.test(i) && n) {
746
788
  if (i.includes(e) && i.includes("allowed origin")) return t;
747
789
  let r = typeof a.origin == "string" && a.origin || n || "(unknown origin)";
@@ -764,36 +806,38 @@ function Pe(e, t) {
764
806
  details: a
765
807
  }) : t;
766
808
  }
767
- function Fe(e) {
809
+ function Be(e) {
768
810
  let t = e?.locale?.trim();
769
811
  if (t) return t;
770
812
  let n = e?.language?.trim();
771
813
  if (n) return n;
772
814
  if (typeof navigator < "u" && navigator.language?.trim()) return navigator.language.trim();
773
815
  }
774
- function Ie(e) {
816
+ function Ve(e) {
775
817
  let t = e?.secondaryLocale?.trim(), n = e?.learningLocale?.trim();
776
818
  if (t && n && t !== n) throw new q("secondaryLocale and learningLocale disagree; pass only one or make them equal.", { code: "INVALID_BODY" });
777
819
  return t || n || void 0;
778
820
  }
779
- function Le(e, t) {
780
- let n = { experienceId: e }, r = Fe(t);
821
+ function He(e, t) {
822
+ let n = { experienceId: e }, r = Be(t);
781
823
  r && (n.locale = r);
782
- let i = Ie(t);
783
- return i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly), n;
824
+ let i = Ve(t);
825
+ i && (n.secondaryLocale = i), t?.mode && (n.mode = t.mode), t?.speechInputMode && (n.speechInputMode = t.speechInputMode), t?.speechOnly !== void 0 && (n.speechOnly = t.speechOnly);
826
+ let a = Ee(t?.attribution);
827
+ return a && (n.attribution = a), n;
784
828
  }
785
- async function Re(e, t) {
829
+ async function Ue(e, t) {
786
830
  let n = ve(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
787
831
  method: "POST",
788
832
  headers: {
789
833
  "Content-Type": "application/json",
790
834
  ...r ? { "Idempotency-Key": r } : {}
791
835
  },
792
- body: JSON.stringify(Le(e, t))
836
+ body: JSON.stringify(He(e, t))
793
837
  });
794
838
  if (!i.ok) {
795
839
  let t = await i.text();
796
- throw Pe(e, Se(i.status, t, i.headers));
840
+ throw ze(e, Se(i.status, t, i.headers));
797
841
  }
798
842
  let a;
799
843
  try {
@@ -805,10 +849,10 @@ async function Re(e, t) {
805
849
  requestId: i.headers.get("Liforma-Request-Id") ?? void 0
806
850
  });
807
851
  }
808
- return je(a);
852
+ return Ie(a);
809
853
  }
810
- async function ze(e, t) {
811
- let n = J(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
854
+ async function We(e, t) {
855
+ let n = ke(e, t), r = new AbortController(), i = () => r.abort(t.signal?.reason);
812
856
  t.signal?.aborted ? i() : t.signal?.addEventListener("abort", i, { once: !0 });
813
857
  let a = globalThis.setTimeout(() => r.abort(new DOMException("Session endpoint timed out.", "TimeoutError")), t.timeoutMs ?? 3e4), o;
814
858
  try {
@@ -838,14 +882,14 @@ async function ze(e, t) {
838
882
  requestId: o.headers.get("Liforma-Request-Id") ?? void 0
839
883
  });
840
884
  }
841
- return je(s);
885
+ return Ie(s);
842
886
  }
843
887
  //#endregion
844
888
  //#region src/v2/conversationProcessor.ts
845
- function Be(e) {
889
+ function Ge(e) {
846
890
  return typeof e != "object" || !e ? !1 : typeof e[Symbol.asyncIterator] == "function";
847
891
  }
848
- function Ve(e) {
892
+ function Ke(e) {
849
893
  if (typeof e == "string") {
850
894
  let t = e.trim();
851
895
  if (!t) throw Error("conversationProcessor returned empty text.");
@@ -859,24 +903,24 @@ function Ve(e) {
859
903
  ...e.behavior ? { behavior: e.behavior } : {}
860
904
  };
861
905
  }
862
- async function He(e, t) {
906
+ async function qe(e, t) {
863
907
  let n = await e(t);
864
- return Be(n) ? {
908
+ return Ge(n) ? {
865
909
  kind: "stream",
866
910
  stream: n
867
911
  } : {
868
912
  kind: "complete",
869
- speech: Ve(n)
913
+ speech: Ke(n)
870
914
  };
871
915
  }
872
916
  //#endregion
873
917
  //#region src/v2/embed/playerReachability.ts
874
- var Ue = "3002";
875
- function We(e) {
918
+ var Je = "3002";
919
+ function Ye(e) {
876
920
  let t = new URL(e);
877
- return t.hostname === "localhost" || t.hostname === "127.0.0.1" ? `Cannot connect to the Liforma player at ${e} — nothing is listening on port ${t.port || Ue}. Start the player dev server in player.liforma.ai (npm run dev).` : `Cannot connect to the Liforma player at ${e}. The embed did not load; check your network connection and player URL configuration.`;
921
+ return t.hostname === "localhost" || t.hostname === "127.0.0.1" ? `Cannot connect to the Liforma player at ${e} — nothing is listening on port ${t.port || Je}. Start the player dev server in player.liforma.ai (npm run dev).` : `Cannot connect to the Liforma player at ${e}. The embed did not load; check your network connection and player URL configuration.`;
878
922
  }
879
- async function Ge(e, t) {
923
+ async function Xe(e, t) {
880
924
  try {
881
925
  await fetch(e, {
882
926
  method: "GET",
@@ -884,52 +928,30 @@ async function Ge(e, t) {
884
928
  signal: AbortSignal.timeout(8e3)
885
929
  });
886
930
  } catch {
887
- throw Error(We(t));
931
+ throw Error(Ye(t));
888
932
  }
889
933
  }
890
- function Ke(e, t, n, r) {
934
+ function Ze(e, t, n, r) {
891
935
  try {
892
936
  r && r.length > 0 ? e.postMessage(t, n, r) : e.postMessage(t, n);
893
937
  } catch (e) {
894
- throw e instanceof DOMException && e.name === "SecurityError" ? Error(We(n), { cause: e }) : e;
895
- }
896
- }
897
- var qe = new Set([1, 2]);
898
- function Je(e) {
899
- return typeof e == "number" && qe.has(e);
900
- }
901
- var Ye = new Set([
902
- "close",
903
- "stateUpdate",
904
- "commandResult",
905
- "userTranscript",
906
- "characterSpeechStarted",
907
- "characterSpeechEnded",
908
- "characterFocusChanged",
909
- "conversationUpdate",
910
- "listeningState",
911
- "userSpeechStarted",
912
- "userSpeechEnded",
913
- "modeChange",
914
- "activityChange",
915
- "feedback",
916
- "feedbackFailed",
917
- "message",
918
- "started",
919
- "embedReady",
920
- "widgetReady",
921
- "widgetExpand",
922
- "widgetCollapse",
923
- "widgetAudioSettings",
924
- "widgetDragStart",
925
- "widgetDragMove",
926
- "widgetDragEnd"
927
- ]);
928
- function Xe(e) {
938
+ throw e instanceof DOMException && e.name === "SecurityError" ? Error(Ye(n), { cause: e }) : e;
939
+ }
940
+ }
941
+ var Qe = new Set([1, 2]);
942
+ function $e(e) {
943
+ return typeof e == "number" && Qe.has(e);
944
+ }
945
+ var et = new Set(/* @__PURE__ */ "close.stateUpdate.commandResult.userTranscript.characterSpeechStarted.characterSpeechEnded.characterFocusChanged.conversationUpdate.listeningState.userSpeechStarted.userSpeechEnded.modeChange.activityChange.feedback.feedbackFailed.message.started.embedReady.widgetReady.widgetExpand.widgetCollapse.widgetAudioSettings.widgetDragStart.widgetDragMove.widgetDragEnd.fullWindow".split("."));
946
+ function tt(e) {
929
947
  if (!e || typeof e != "object") return null;
930
948
  let t = e;
931
- if (!Je(t.schemaVersion) || !t.type || !Ye.has(t.type)) return null;
949
+ if (!$e(t.schemaVersion) || !t.type || !et.has(t.type)) return null;
932
950
  if (t.type === "embedReady" || t.type === "widgetReady" || t.type === "widgetExpand" || t.type === "widgetCollapse") return t;
951
+ if (t.type === "fullWindow") {
952
+ let e = t.payload;
953
+ return !e || typeof e != "object" || typeof e.active != "boolean" ? null : t;
954
+ }
933
955
  if (t.type === "widgetAudioSettings") {
934
956
  let e = t.payload;
935
957
  return !e || typeof e != "object" || typeof e.open != "boolean" ? null : t;
@@ -947,10 +969,10 @@ function Xe(e) {
947
969
  let n = t.payload;
948
970
  return !n || typeof n != "object" ? null : t;
949
971
  }
950
- function Ze(e, t, n) {
972
+ function nt(e, t, n) {
951
973
  let r = e.trim();
952
974
  if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
953
- let i = n?.startButton, a = n?.showFeedback;
975
+ let i = n?.startButton, a = n?.theme, o = n?.showFeedback;
954
976
  return {
955
977
  type: "launch",
956
978
  schemaVersion: 2,
@@ -958,24 +980,25 @@ function Ze(e, t, n) {
958
980
  launch: r,
959
981
  ...t === void 0 ? {} : { session: t },
960
982
  ...i ? { startButton: i } : {},
961
- ...a === void 0 ? {} : { showFeedback: a }
983
+ ...a ? { theme: a } : {},
984
+ ...o === void 0 ? {} : { showFeedback: o }
962
985
  }
963
986
  };
964
987
  }
965
- function Qe() {
988
+ function rt() {
966
989
  return {
967
990
  type: "parentHello",
968
991
  schemaVersion: 2
969
992
  };
970
993
  }
971
- function $e(e) {
994
+ function it(e) {
972
995
  return {
973
996
  type: "widgetSetChrome",
974
997
  schemaVersion: 2,
975
998
  payload: { mode: e }
976
999
  };
977
1000
  }
978
- function et() {
1001
+ function at() {
979
1002
  return {
980
1003
  type: "widgetToggleAudioSettings",
981
1004
  schemaVersion: 2,
@@ -983,108 +1006,143 @@ function et() {
983
1006
  };
984
1007
  }
985
1008
  //#endregion
1009
+ //#region src/v2/embed/fullWindowHost.ts
1010
+ var ot = "2147483000";
1011
+ function st(e) {
1012
+ let { style: t } = e;
1013
+ return {
1014
+ position: t.position,
1015
+ top: t.top,
1016
+ right: t.right,
1017
+ bottom: t.bottom,
1018
+ left: t.left,
1019
+ inset: t.inset,
1020
+ width: t.width,
1021
+ height: t.height,
1022
+ zIndex: t.zIndex,
1023
+ margin: t.margin,
1024
+ borderRadius: t.borderRadius,
1025
+ maxWidth: t.maxWidth,
1026
+ maxHeight: t.maxHeight
1027
+ };
1028
+ }
1029
+ function ct(e) {
1030
+ let { style: t } = e;
1031
+ t.position = "fixed", t.top = "0", t.right = "0", t.bottom = "0", t.left = "0", t.inset = "0", t.width = "100vw", t.width = "100dvw", t.height = "100vh", t.height = "100dvh", t.zIndex = ot, t.margin = "0", t.borderRadius = "0", t.maxWidth = "none", t.maxHeight = "none", e.dataset.liformaFullWindow = "1";
1032
+ }
1033
+ function lt(e, t) {
1034
+ if (delete e.dataset.liformaFullWindow, !t) {
1035
+ e.style.position = "", e.style.top = "", e.style.right = "", e.style.bottom = "", e.style.left = "", e.style.inset = "", e.style.width = "", e.style.height = "", e.style.zIndex = "", e.style.margin = "", e.style.borderRadius = "", e.style.maxWidth = "", e.style.maxHeight = "";
1036
+ return;
1037
+ }
1038
+ let { style: n } = e;
1039
+ n.position = t.position, n.top = t.top, n.right = t.right, n.bottom = t.bottom, n.left = t.left, n.inset = t.inset, n.width = t.width, n.height = t.height, n.zIndex = t.zIndex, n.margin = t.margin, n.borderRadius = t.borderRadius, n.maxWidth = t.maxWidth, n.maxHeight = t.maxHeight;
1040
+ }
1041
+ //#endregion
986
1042
  //#region src/v2/embed/iframeHost.ts
987
- function tt(e) {
1043
+ function ut(e) {
988
1044
  return e;
989
1045
  }
990
1046
  function Z() {
991
1047
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `cmd_${crypto.randomUUID().replace(/-/g, "").slice(0, 12)}` : `cmd_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
992
1048
  }
993
- var nt = 3e4;
994
- function rt(e) {
1049
+ var dt = 3e4;
1050
+ function ft(e) {
995
1051
  let t = e.container;
996
1052
  getComputedStyle(t).position === "static" && (t.style.position = "relative");
997
1053
  let n = document.createElement("iframe");
998
1054
  n.src = e.src, n.title = "Liforma experience", n.setAttribute("allow", "microphone; autoplay; clipboard-read; clipboard-write"), n.style.cssText = e.transparent ? "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent;" : "display:block;position:absolute;inset:0;width:100%;height:100%;border:0;background:#030508;", e.transparent && n.setAttribute("allowtransparency", "true");
999
- let r = !1, i = /* @__PURE__ */ new Map(), a = null, o = 0, s = 0, c = [], l = null, u = null, d = new Promise((e, t) => {
1000
- l = e, u = t;
1001
- }), f = () => {
1002
- for (let e of c) window.clearTimeout(e);
1003
- c.length = 0;
1004
- }, p = (t) => {
1055
+ let r = !1, i = !1, a = null, o = t.closest(".liforma-experience-shell") instanceof HTMLElement ? t.closest(".liforma-experience-shell") : t, s = (t) => {
1056
+ i !== t && (i = t, t ? (a = st(o), ct(o)) : (lt(o, a), a = null), e.onFullWindowChange?.(t));
1057
+ }, c = /* @__PURE__ */ new Map(), l = null, u = 0, d = 0, f = [], p = null, m = null, h = new Promise((e, t) => {
1058
+ p = e, m = t;
1059
+ }), g = () => {
1060
+ for (let e of f) window.clearTimeout(e);
1061
+ f.length = 0;
1062
+ }, _ = (t) => {
1005
1063
  if (r) return;
1006
1064
  let i = Date.now();
1007
- if (s > 0 && i - s < 250) return;
1008
- s = i, f();
1009
- let a = Ze(t.launch, t.session, t.chrome), o = () => {
1065
+ if (d > 0 && i - d < 250) return;
1066
+ d = i, g();
1067
+ let a = nt(t.launch, t.session, t.chrome), o = () => {
1010
1068
  if (r) return;
1011
1069
  let t = n.contentWindow;
1012
- t && Ke(t, a, e.playerOrigin);
1070
+ t && Ze(t, a, e.playerOrigin);
1013
1071
  };
1014
1072
  o();
1015
- for (let e = 1; e <= 12; e += 1) c.push(window.setTimeout(o, e * 75));
1016
- }, m = () => {
1017
- r || !a || p(a);
1018
- }, h = () => {
1019
- if (o += 1, o === 1) {
1020
- Ge(e.src, e.playerOrigin).then(() => l?.(), (e) => u?.(e instanceof Error ? e : Error(String(e))));
1073
+ for (let e = 1; e <= 12; e += 1) f.push(window.setTimeout(o, e * 75));
1074
+ }, v = () => {
1075
+ r || !l || _(l);
1076
+ }, y = () => {
1077
+ if (u += 1, u === 1) {
1078
+ Xe(e.src, e.playerOrigin).then(() => p?.(), (e) => m?.(e instanceof Error ? e : Error(String(e))));
1021
1079
  return;
1022
1080
  }
1023
- s = 0, m();
1024
- }, g = () => {
1025
- o > 0 || u?.(Error(We(e.playerOrigin)));
1081
+ d = 0, v();
1082
+ }, b = () => {
1083
+ u > 0 || m?.(Error(Ye(e.playerOrigin)));
1026
1084
  };
1027
- n.addEventListener("load", h), n.addEventListener("error", g);
1028
- let _ = (t) => {
1085
+ n.addEventListener("load", y), n.addEventListener("error", b);
1086
+ let x = (t) => {
1029
1087
  if (r || t.source !== n.contentWindow || t.origin !== e.playerOrigin) return;
1030
- let a = Xe(t.data);
1031
- if (a) switch (a.type) {
1088
+ let i = tt(t.data);
1089
+ if (i) switch (i.type) {
1032
1090
  case "close":
1033
- e.onClose?.(a.payload);
1091
+ e.onClose?.(i.payload);
1034
1092
  break;
1035
1093
  case "stateUpdate":
1036
- e.onPlayerStatusChange?.(a.payload.state), e.onStateUpdate?.(a.payload.state);
1094
+ e.onPlayerStatusChange?.(i.payload.state), e.onStateUpdate?.(i.payload.state);
1037
1095
  break;
1038
1096
  case "commandResult": {
1039
- let e = i.get(a.payload.correlationId);
1097
+ let e = c.get(i.payload.correlationId);
1040
1098
  if (!e) return;
1041
- i.delete(a.payload.correlationId), a.payload.ok ? e.resolve(a.payload.result) : e.reject(Error(a.payload.error ?? "Command failed."));
1099
+ c.delete(i.payload.correlationId), i.payload.ok ? e.resolve(i.payload.result) : e.reject(Error(i.payload.error ?? "Command failed."));
1042
1100
  break;
1043
1101
  }
1044
1102
  case "userTranscript":
1045
- e.onUserTranscript?.(a.payload);
1103
+ e.onUserTranscript?.(i.payload);
1046
1104
  break;
1047
1105
  case "characterSpeechStarted":
1048
- e.onCharacterSpeechStarted?.(a.payload);
1106
+ e.onCharacterSpeechStarted?.(i.payload);
1049
1107
  break;
1050
1108
  case "characterSpeechEnded":
1051
- e.onCharacterSpeechEnded?.(a.payload);
1109
+ e.onCharacterSpeechEnded?.(i.payload);
1052
1110
  break;
1053
1111
  case "characterFocusChanged":
1054
- e.onCharacterFocusChanged?.(a.payload);
1112
+ e.onCharacterFocusChanged?.(i.payload);
1055
1113
  break;
1056
1114
  case "conversationUpdate":
1057
- e.onConversationUpdate?.(a.payload.conversation);
1115
+ e.onConversationUpdate?.(i.payload.conversation);
1058
1116
  break;
1059
1117
  case "listeningState":
1060
- e.onListeningState?.(a.payload.listening);
1118
+ e.onListeningState?.(i.payload.listening);
1061
1119
  break;
1062
1120
  case "userSpeechStarted":
1063
- e.onUserSpeechStarted?.(a.payload);
1121
+ e.onUserSpeechStarted?.(i.payload);
1064
1122
  break;
1065
1123
  case "userSpeechEnded":
1066
- e.onUserSpeechEnded?.(a.payload);
1124
+ e.onUserSpeechEnded?.(i.payload);
1067
1125
  break;
1068
1126
  case "modeChange":
1069
- e.onActivityChange?.(tt(a.payload.mode));
1127
+ e.onActivityChange?.(ut(i.payload.mode));
1070
1128
  break;
1071
1129
  case "activityChange":
1072
- e.onActivityChange?.(a.payload.activity);
1130
+ e.onActivityChange?.(i.payload.activity);
1073
1131
  break;
1074
1132
  case "feedback":
1075
- e.onFeedback?.(a.payload);
1133
+ e.onFeedback?.(i.payload);
1076
1134
  break;
1077
1135
  case "feedbackFailed":
1078
- e.onFeedbackFailed?.(a.payload);
1136
+ e.onFeedbackFailed?.(i.payload);
1079
1137
  break;
1080
1138
  case "message":
1081
- e.onMessage?.(a.payload);
1139
+ e.onMessage?.(i.payload);
1082
1140
  break;
1083
1141
  case "started":
1084
- e.onStarted?.(a.payload);
1142
+ e.onStarted?.(i.payload);
1085
1143
  break;
1086
1144
  case "embedReady":
1087
- m();
1145
+ v();
1088
1146
  break;
1089
1147
  case "widgetReady":
1090
1148
  e.onWidgetReady?.();
@@ -1096,52 +1154,55 @@ function rt(e) {
1096
1154
  e.onWidgetCollapse?.();
1097
1155
  break;
1098
1156
  case "widgetAudioSettings":
1099
- e.onWidgetAudioSettings?.(a.payload.open);
1157
+ e.onWidgetAudioSettings?.(i.payload.open);
1100
1158
  break;
1101
1159
  case "widgetDragStart":
1102
- e.onWidgetDragStart?.(a.payload);
1160
+ e.onWidgetDragStart?.(i.payload);
1103
1161
  break;
1104
1162
  case "widgetDragMove":
1105
- e.onWidgetDragMove?.(a.payload);
1163
+ e.onWidgetDragMove?.(i.payload);
1106
1164
  break;
1107
1165
  case "widgetDragEnd":
1108
- e.onWidgetDragEnd?.(a.payload);
1166
+ e.onWidgetDragEnd?.(i.payload);
1167
+ break;
1168
+ case "fullWindow":
1169
+ s(i.payload.active);
1109
1170
  break;
1110
1171
  }
1111
1172
  };
1112
- if (window.addEventListener("message", _), t.replaceChildren(n), t.clientHeight < 2 && !t.style.minHeight) {
1173
+ if (window.addEventListener("message", x), t.replaceChildren(n), t.clientHeight < 2 && !t.style.minHeight) {
1113
1174
  let e = getComputedStyle(t).minHeight;
1114
1175
  (e === "0px" || e === "auto") && (t.style.minHeight = "480px");
1115
1176
  }
1116
- let v = (t, i) => {
1177
+ let S = (t, i) => {
1117
1178
  if (r) return;
1118
1179
  let a = n.contentWindow;
1119
- if (!a) throw Error(We(e.playerOrigin));
1120
- Ke(a, t, e.playerOrigin, i);
1121
- }, y = (e, t = 12e4, n) => {
1180
+ if (!a) throw Error(Ye(e.playerOrigin));
1181
+ Ze(a, t, e.playerOrigin, i);
1182
+ }, C = (e, t = 12e4, n) => {
1122
1183
  let r = e.type !== "parentHello" && e.payload && "correlationId" in e.payload ? e.payload.correlationId : Z();
1123
- return e.type !== "parentHello" && e.payload && "correlationId" in e.payload || e.type !== "parentHello" && e.payload && (e.payload.correlationId = r), new Promise((a, o) => {
1124
- i.set(r, {
1125
- resolve: (e) => a(e),
1126
- reject: o
1127
- }), v(e, n), setTimeout(() => {
1128
- i.has(r) && (i.delete(r), o(/* @__PURE__ */ Error("Timed out waiting for player command result.")));
1184
+ return e.type !== "parentHello" && e.payload && "correlationId" in e.payload || e.type !== "parentHello" && e.payload && (e.payload.correlationId = r), new Promise((i, a) => {
1185
+ c.set(r, {
1186
+ resolve: (e) => i(e),
1187
+ reject: a
1188
+ }), S(e, n), setTimeout(() => {
1189
+ c.has(r) && (c.delete(r), a(/* @__PURE__ */ Error("Timed out waiting for player command result.")));
1129
1190
  }, t);
1130
1191
  });
1131
1192
  };
1132
1193
  return {
1133
1194
  waitForLoad() {
1134
- return d;
1195
+ return h;
1135
1196
  },
1136
1197
  postParentHello() {
1137
- v(Qe());
1198
+ S(rt());
1138
1199
  },
1139
1200
  postLaunch(e, t, n) {
1140
- r || (a = {
1201
+ r || (l = {
1141
1202
  launch: e,
1142
1203
  session: t,
1143
1204
  chrome: n
1144
- }, s = 0, p(a));
1205
+ }, d = 0, _(l));
1145
1206
  },
1146
1207
  postManifest(e) {
1147
1208
  if (typeof e == "string") {
@@ -1156,13 +1217,13 @@ function rt(e) {
1156
1217
  throw Error("postManifest is deprecated; use postLaunch with an opaque launch string from SessionLaunchResponse.");
1157
1218
  },
1158
1219
  postWidgetSetChrome(e) {
1159
- v($e(e));
1220
+ S(it(e));
1160
1221
  },
1161
1222
  postWidgetToggleAudioSettings() {
1162
- v(et());
1223
+ S(at());
1163
1224
  },
1164
1225
  speak(e) {
1165
- return y({
1226
+ return C({
1166
1227
  type: "speak",
1167
1228
  schemaVersion: 2,
1168
1229
  payload: {
@@ -1174,21 +1235,21 @@ function rt(e) {
1174
1235
  });
1175
1236
  },
1176
1237
  startListening() {
1177
- return y({
1238
+ return C({
1178
1239
  type: "startListening",
1179
1240
  schemaVersion: 2,
1180
1241
  payload: { correlationId: Z() }
1181
1242
  });
1182
1243
  },
1183
1244
  stopListening() {
1184
- return y({
1245
+ return C({
1185
1246
  type: "stopListening",
1186
1247
  schemaVersion: 2,
1187
1248
  payload: { correlationId: Z() }
1188
1249
  });
1189
1250
  },
1190
1251
  listenOnce(e) {
1191
- return y({
1252
+ return C({
1192
1253
  type: "listenOnce",
1193
1254
  schemaVersion: 2,
1194
1255
  payload: {
@@ -1198,7 +1259,7 @@ function rt(e) {
1198
1259
  });
1199
1260
  },
1200
1261
  async speakProcessorStream(e, t) {
1201
- let n = Z(), r = Z(), i = (await y({
1262
+ let n = Z(), r = Z(), i = (await C({
1202
1263
  type: "speakStreamStart",
1203
1264
  schemaVersion: 2,
1204
1265
  payload: {
@@ -1210,7 +1271,7 @@ function rt(e) {
1210
1271
  try {
1211
1272
  for await (let n of e) {
1212
1273
  if (t?.signal?.aborted) throw new DOMException("Processor stream aborted.", "AbortError");
1213
- n && v({
1274
+ n && S({
1214
1275
  type: "speakStreamChunk",
1215
1276
  schemaVersion: 2,
1216
1277
  payload: {
@@ -1220,7 +1281,7 @@ function rt(e) {
1220
1281
  });
1221
1282
  }
1222
1283
  if (t?.signal?.aborted) throw new DOMException("Processor stream aborted.", "AbortError");
1223
- return await y({
1284
+ return await C({
1224
1285
  type: "speakStreamEnd",
1225
1286
  schemaVersion: 2,
1226
1287
  payload: {
@@ -1230,7 +1291,7 @@ function rt(e) {
1230
1291
  });
1231
1292
  } catch (e) {
1232
1293
  try {
1233
- await y({
1294
+ await C({
1234
1295
  type: "speakStreamEnd",
1235
1296
  schemaVersion: 2,
1236
1297
  payload: {
@@ -1244,7 +1305,7 @@ function rt(e) {
1244
1305
  },
1245
1306
  speechPlay(e) {
1246
1307
  let t = Z(), n = [];
1247
- return (e.source.kind === "pcm" || e.source.kind === "encoded") && n.push(e.source.data), y({
1308
+ return (e.source.kind === "pcm" || e.source.kind === "encoded") && n.push(e.source.data), C({
1248
1309
  type: "speechPlay",
1249
1310
  schemaVersion: 2,
1250
1311
  payload: {
@@ -1258,7 +1319,7 @@ function rt(e) {
1258
1319
  }, 12e4, n);
1259
1320
  },
1260
1321
  speechUtteranceBegin(e) {
1261
- return y({
1322
+ return C({
1262
1323
  type: "speechUtteranceBegin",
1263
1324
  schemaVersion: 2,
1264
1325
  payload: {
@@ -1272,7 +1333,7 @@ function rt(e) {
1272
1333
  });
1273
1334
  },
1274
1335
  speechUtteranceWrite(e) {
1275
- return y({
1336
+ return C({
1276
1337
  type: "speechUtteranceWrite",
1277
1338
  schemaVersion: 2,
1278
1339
  payload: {
@@ -1281,10 +1342,10 @@ function rt(e) {
1281
1342
  audio: e.audio,
1282
1343
  byteLength: e.byteLength
1283
1344
  }
1284
- }, nt, [e.audio]);
1345
+ }, dt, [e.audio]);
1285
1346
  },
1286
1347
  speechUtteranceSetTranscript(e) {
1287
- return y({
1348
+ return C({
1288
1349
  type: "speechUtteranceSetTranscript",
1289
1350
  schemaVersion: 2,
1290
1351
  payload: {
@@ -1295,7 +1356,7 @@ function rt(e) {
1295
1356
  });
1296
1357
  },
1297
1358
  speechUtteranceClose(e) {
1298
- return y({
1359
+ return C({
1299
1360
  type: "speechUtteranceClose",
1300
1361
  schemaVersion: 2,
1301
1362
  payload: {
@@ -1307,7 +1368,7 @@ function rt(e) {
1307
1368
  });
1308
1369
  },
1309
1370
  speechUtteranceCancel(e) {
1310
- return y({
1371
+ return C({
1311
1372
  type: "speechUtteranceCancel",
1312
1373
  schemaVersion: 2,
1313
1374
  payload: {
@@ -1317,7 +1378,7 @@ function rt(e) {
1317
1378
  });
1318
1379
  },
1319
1380
  speechInterrupt(e) {
1320
- return y({
1381
+ return C({
1321
1382
  type: "speechInterrupt",
1322
1383
  schemaVersion: 2,
1323
1384
  payload: {
@@ -1327,14 +1388,14 @@ function rt(e) {
1327
1388
  });
1328
1389
  },
1329
1390
  getConversation() {
1330
- return y({
1391
+ return C({
1331
1392
  type: "getConversation",
1332
1393
  schemaVersion: 2,
1333
1394
  payload: { correlationId: Z() }
1334
1395
  });
1335
1396
  },
1336
1397
  focusCharacter(e) {
1337
- return y({
1398
+ return C({
1338
1399
  type: "focusCharacter",
1339
1400
  schemaVersion: 2,
1340
1401
  payload: {
@@ -1344,7 +1405,7 @@ function rt(e) {
1344
1405
  });
1345
1406
  },
1346
1407
  setFit(e) {
1347
- return y({
1408
+ return C({
1348
1409
  type: "setFit",
1349
1410
  schemaVersion: 2,
1350
1411
  payload: {
@@ -1353,18 +1414,28 @@ function rt(e) {
1353
1414
  }
1354
1415
  });
1355
1416
  },
1417
+ conversion(e) {
1418
+ return C({
1419
+ type: "conversion",
1420
+ schemaVersion: 2,
1421
+ payload: {
1422
+ correlationId: Z(),
1423
+ key: e
1424
+ }
1425
+ });
1426
+ },
1356
1427
  destroy() {
1357
1428
  if (!r) {
1358
- r = !0;
1359
- for (let e of i.values()) e.reject(/* @__PURE__ */ Error("Iframe host destroyed."));
1360
- i.clear(), f(), a = null, n.removeEventListener("load", h), n.removeEventListener("error", g), window.removeEventListener("message", _), n.remove();
1429
+ r = !0, i && s(!1);
1430
+ for (let e of c.values()) e.reject(/* @__PURE__ */ Error("Iframe host destroyed."));
1431
+ c.clear(), g(), l = null, n.removeEventListener("load", y), n.removeEventListener("error", b), window.removeEventListener("message", x), n.remove();
1361
1432
  }
1362
1433
  }
1363
1434
  };
1364
1435
  }
1365
1436
  //#endregion
1366
1437
  //#region src/v2/embed/readyGate.ts
1367
- function it(e) {
1438
+ function pt(e) {
1368
1439
  let t, n = !1, r = !1, i = () => {
1369
1440
  r || !n || t === void 0 || (r = !0, e(t));
1370
1441
  };
@@ -1379,50 +1450,50 @@ function it(e) {
1379
1450
  }
1380
1451
  //#endregion
1381
1452
  //#region src/v2/shims/embedBaseUrl.ts
1382
- var at = "https://player.liforma.ai/embed", ot = "http://localhost:3002/embed";
1383
- function st() {
1453
+ var mt = "https://player.liforma.ai/embed", ht = "http://localhost:3002/embed";
1454
+ function gt() {
1384
1455
  let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
1385
1456
  if (e?.trim()) return e.trim().replace(/\/$/, "");
1386
1457
  if (typeof document > "u") return null;
1387
1458
  let t = (document.querySelector("script[data-liforma-sdk][src*=\"client.js\"]") ?? document.querySelector("script[src*=\"/sdk/v2/client.js\"]"))?.getAttribute("data-player-embed-url")?.trim();
1388
1459
  return t ? t.replace(/\/$/, "") : null;
1389
1460
  }
1390
- function ct() {
1391
- let e = st();
1392
- return e ? e.endsWith("/embed") ? e : `${e}/embed` : T() ? ot : at;
1461
+ function _t() {
1462
+ let e = gt();
1463
+ return e ? e.endsWith("/embed") ? e : `${e}/embed` : T() ? ht : mt;
1393
1464
  }
1394
- function lt(e, t) {
1465
+ function vt(e, t) {
1395
1466
  return e?.trim() || t?.trim() || void 0;
1396
1467
  }
1397
- function ut(e, t, n, r, i, a, o, s) {
1398
- let c = (e ?? ct()).replace(/\/$/, ""), l = c.endsWith("/embed") ? c : `${c}/embed`, u = new URL(l), d = n?.trim();
1468
+ function yt(e, t, n, r, i, a, o, s) {
1469
+ let c = (e ?? _t()).replace(/\/$/, ""), l = c.endsWith("/embed") ? c : `${c}/embed`, u = new URL(l), d = n?.trim();
1399
1470
  d && (u.searchParams.set("backdropId", d), u.searchParams.set("locationId", d));
1400
1471
  let f = r?.trim();
1401
- return f && u.searchParams.set("avatarId", f), (i === "face" || i === "medium") && u.searchParams.set("fit", i), a === "widget" && u.searchParams.set("ui", "widget"), o && u.searchParams.set("close", "1"), t && u.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && u.searchParams.set("cast", String(s)), dt(u.toString());
1472
+ return f && u.searchParams.set("avatarId", f), (i === "face" || i === "medium") && u.searchParams.set("fit", i), a === "widget" && u.searchParams.set("ui", "widget"), o && u.searchParams.set("close", "1"), t && u.searchParams.set("debug", "true"), (s === 2 || s === 3 || s === 4) && u.searchParams.set("cast", String(s)), bt(u.toString());
1402
1473
  }
1403
- function dt(e) {
1474
+ function bt(e) {
1404
1475
  if (typeof location > "u") return e;
1405
1476
  let t = new URL(e);
1406
1477
  return t.searchParams.set("parentOrigin", location.origin), t.toString();
1407
1478
  }
1408
- function ft(e) {
1479
+ function xt(e) {
1409
1480
  return new URL(e).origin;
1410
1481
  }
1411
1482
  //#endregion
1412
1483
  //#region src/v2/experienceEvents.ts
1413
- function pt() {
1484
+ function St() {
1414
1485
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `evt_${crypto.randomUUID().replace(/-/g, "").slice(0, 12)}` : `evt_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
1415
1486
  }
1416
- function mt(e, t, n) {
1487
+ function Ct(e, t, n) {
1417
1488
  return {
1418
- id: pt(),
1489
+ id: St(),
1419
1490
  type: e,
1420
1491
  sessionId: t,
1421
1492
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1422
1493
  data: n
1423
1494
  };
1424
1495
  }
1425
- function ht() {
1496
+ function wt() {
1426
1497
  return {
1427
1498
  ready: /* @__PURE__ */ new Set(),
1428
1499
  started: /* @__PURE__ */ new Set(),
@@ -1441,39 +1512,39 @@ function ht() {
1441
1512
  conversationProcessorError: /* @__PURE__ */ new Set()
1442
1513
  };
1443
1514
  }
1444
- function gt(e, t, n) {
1515
+ function Tt(e, t, n) {
1445
1516
  return e[t].add(n), () => e[t].delete(n);
1446
1517
  }
1447
- function _t(e, t, n) {
1518
+ function Et(e, t, n) {
1448
1519
  for (let r of e[t]) r(n);
1449
1520
  }
1450
- function vt(e) {
1521
+ function Dt(e) {
1451
1522
  for (let t of Object.keys(e)) e[t].clear();
1452
1523
  }
1453
1524
  //#endregion
1454
1525
  //#region src/v2/speech/types.ts
1455
- function yt(e) {
1526
+ function Ot(e) {
1456
1527
  return "data" in e && "format" in e && e.format != null && !("track" in e);
1457
1528
  }
1458
- function bt(e) {
1529
+ function kt(e) {
1459
1530
  return "url" in e && typeof e.url == "string";
1460
1531
  }
1461
- function xt(e) {
1532
+ function At(e) {
1462
1533
  if (!("track" in e)) return !1;
1463
1534
  let t = e.track;
1464
1535
  return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
1465
1536
  }
1466
- function St(e) {
1467
- return !yt(e) && !bt(e) && !xt(e) && "encoding" in e && typeof e.encoding == "string";
1537
+ function jt(e) {
1538
+ return !Ot(e) && !kt(e) && !At(e) && "encoding" in e && typeof e.encoding == "string";
1468
1539
  }
1469
- var Ct = [
1540
+ var Mt = [
1470
1541
  8e3,
1471
1542
  16e3,
1472
1543
  22050,
1473
1544
  24e3,
1474
1545
  44100,
1475
1546
  48e3
1476
- ], wt = {
1547
+ ], Nt = {
1477
1548
  MAX_CHUNK_BYTES: 64 * 1024,
1478
1549
  RECOMMENDED_CHUNK_MS_MIN: 20,
1479
1550
  RECOMMENDED_CHUNK_MS_MAX: 200,
@@ -1484,14 +1555,14 @@ var Ct = [
1484
1555
  MAX_UTTERANCE_DURATION_MS: 9e4,
1485
1556
  MAX_PENDING_WRITES: 8,
1486
1557
  DEFAULT_WRITE_TIMEOUT_MS: 5e3
1487
- }, Tt = class extends Error {
1558
+ }, Pt = class extends Error {
1488
1559
  operation;
1489
1560
  requiredCapability;
1490
1561
  name = "UnsupportedSpeechOperationError";
1491
1562
  constructor(e, t) {
1492
1563
  super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
1493
1564
  }
1494
- }, Et = class extends Error {
1565
+ }, Ft = class extends Error {
1495
1566
  name = "SpeechUtteranceClosedError";
1496
1567
  constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
1497
1568
  super(e);
@@ -1501,72 +1572,72 @@ var Ct = [
1501
1572
  constructor(e, t) {
1502
1573
  super(e, t);
1503
1574
  }
1504
- }, Dt = class extends Error {
1575
+ }, It = class extends Error {
1505
1576
  name = "SpeechBufferTimeoutError";
1506
1577
  constructor(e = "Timed out waiting for speech buffer capacity.") {
1507
1578
  super(e);
1508
1579
  }
1509
1580
  };
1510
- function Ot(e = "none") {
1581
+ function Lt(e = "none") {
1511
1582
  return {
1512
1583
  mode: e,
1513
1584
  trackedDurationMs: 0,
1514
1585
  fallbackDurationMs: 0
1515
1586
  };
1516
1587
  }
1517
- function kt(e) {
1518
- return Ct.includes(e);
1588
+ function Rt(e) {
1589
+ return Mt.includes(e);
1519
1590
  }
1520
- function At(e) {
1591
+ function zt(e) {
1521
1592
  if (e.encoding !== "pcm_s16le") throw new Q(`Unsupported audio encoding: ${e.encoding}`);
1522
1593
  if (e.channels !== 1) throw new Q(`Unsupported channel count: ${e.channels}`);
1523
- if (!kt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1594
+ if (!Rt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1524
1595
  }
1525
- function jt(e) {
1526
- if (yt(e)) {
1527
- At(e.format);
1596
+ function Bt(e) {
1597
+ if (Ot(e)) {
1598
+ zt(e.format);
1528
1599
  return;
1529
1600
  }
1530
- if (bt(e)) {
1601
+ if (kt(e)) {
1531
1602
  if (!e.url.trim()) throw new Q("Audio URL must be non-empty.");
1532
- if (e.sampleRate !== void 0 && !kt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1603
+ if (e.sampleRate !== void 0 && !Rt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1533
1604
  return;
1534
1605
  }
1535
- if (xt(e)) {
1606
+ if (At(e)) {
1536
1607
  if (e.track.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
1537
- if (e.sampleRate !== void 0 && !kt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1608
+ if (e.sampleRate !== void 0 && !Rt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1538
1609
  return;
1539
1610
  }
1540
- if (St(e)) {
1611
+ if (jt(e)) {
1541
1612
  let t = e.encoding.trim().toLowerCase();
1542
1613
  if (!t) throw new Q("Encoded audio MIME type is required.");
1543
1614
  if (t === "pcm_s16le") throw new Q("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
1544
- if (e.sampleRate !== void 0 && !kt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1615
+ if (e.sampleRate !== void 0 && !Rt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1545
1616
  return;
1546
1617
  }
1547
1618
  throw new Q("Unsupported speech.play audio shape.");
1548
1619
  }
1549
- function Mt(e) {
1550
- if (e.format) return At(e.format), e.format;
1620
+ function Vt(e) {
1621
+ if (e.format) return zt(e.format), e.format;
1551
1622
  if (e.track) {
1552
1623
  let t = {
1553
1624
  encoding: "pcm_s16le",
1554
1625
  sampleRate: e.sampleRate ?? 24e3,
1555
1626
  channels: 1
1556
1627
  };
1557
- return At(t), t;
1628
+ return zt(t), t;
1558
1629
  }
1559
1630
  throw new Q("createUtterance requires format or track.");
1560
1631
  }
1561
- function Nt(e) {
1632
+ function Ht(e) {
1562
1633
  return e instanceof Uint8Array ? e : new Uint8Array(e);
1563
1634
  }
1564
- function Pt(e) {
1635
+ function Ut(e) {
1565
1636
  return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
1566
1637
  }
1567
1638
  //#endregion
1568
1639
  //#region src/byo/pcm.ts
1569
- function Ft(e) {
1640
+ function Wt(e) {
1570
1641
  let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
1571
1642
  for (let t = 0; t < e.length; t++) {
1572
1643
  let r = Math.max(-1, Math.min(1, e[t]));
@@ -1576,11 +1647,11 @@ function Ft(e) {
1576
1647
  }
1577
1648
  //#endregion
1578
1649
  //#region src/byo/resample.ts
1579
- function It(e, t, n, r, i) {
1650
+ function Gt(e, t, n, r, i) {
1580
1651
  let a = -.5 * e + 1.5 * t - 1.5 * n + .5 * r, o = e - 2.5 * t + 2 * n - .5 * r, s = -.5 * e + .5 * n, c = t;
1581
1652
  return ((a * i + o) * i + s) * i + c;
1582
1653
  }
1583
- function Lt(e, t) {
1654
+ function Kt(e, t) {
1584
1655
  if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
1585
1656
  if (e === t) return {
1586
1657
  fromRate: e,
@@ -1603,7 +1674,7 @@ function Lt(e, t) {
1603
1674
  let a = [];
1604
1675
  for (; i + 2 < r.length - 1;) {
1605
1676
  let e = Math.floor(i), t = i - e, o = Math.max(0, e - 1), s = Math.min(r.length - 1, e + 1), c = Math.min(r.length - 1, e + 2);
1606
- a.push(It(r[o], r[e], r[s], r[c], t)), i += n;
1677
+ a.push(Gt(r[o], r[e], r[s], r[c], t)), i += n;
1607
1678
  }
1608
1679
  let o = Math.max(0, Math.floor(i) - 1);
1609
1680
  return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
@@ -1615,7 +1686,7 @@ function Lt(e, t) {
1615
1686
  }
1616
1687
  //#endregion
1617
1688
  //#region src/byo/audioCapture.ts
1618
- var Rt = "liforma-pcm-capture", zt = `
1689
+ var qt = "liforma-pcm-capture", Jt = `
1619
1690
  class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
1620
1691
  process(inputs) {
1621
1692
  const ch = inputs[0] && inputs[0][0];
@@ -1627,29 +1698,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
1627
1698
  return true;
1628
1699
  }
1629
1700
  }
1630
- registerProcessor('${Rt}', LiformaPcmCaptureProcessor);
1631
- `, Bt = null;
1632
- function Vt() {
1633
- return Bt ||= URL.createObjectURL(new Blob([zt], { type: "application/javascript" })), Bt;
1701
+ registerProcessor('${qt}', LiformaPcmCaptureProcessor);
1702
+ `, Yt = null;
1703
+ function Xt() {
1704
+ return Yt ||= URL.createObjectURL(new Blob([Jt], { type: "application/javascript" })), Yt;
1634
1705
  }
1635
- function Ht() {
1706
+ function Zt() {
1636
1707
  return window.AudioContext || window.webkitAudioContext || null;
1637
1708
  }
1638
- async function Ut(e) {
1639
- let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Ht();
1709
+ async function Qt(e) {
1710
+ let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Zt();
1640
1711
  if (!o) throw Error("Web Audio is required for audio capture");
1641
1712
  let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
1642
1713
  l.gain.value = 0;
1643
- let u = s.sampleRate, d = Lt(u, n), f = !1, p = !1, m = (e) => {
1714
+ let u = s.sampleRate, d = Kt(u, n), f = !1, p = !1, m = (e) => {
1644
1715
  if (f || i && !i()) return;
1645
1716
  let t = d.push(e);
1646
- t.length !== 0 && r(Ft(t));
1717
+ t.length !== 0 && r(Wt(t));
1647
1718
  }, h = () => void 0;
1648
1719
  return await (async () => {
1649
1720
  if (typeof s.audioWorklet?.addModule != "function") return !1;
1650
1721
  try {
1651
- await s.audioWorklet.addModule(Vt());
1652
- let e = new AudioWorkletNode(s, Rt, {
1722
+ await s.audioWorklet.addModule(Xt());
1723
+ let e = new AudioWorkletNode(s, qt, {
1653
1724
  numberOfInputs: 1,
1654
1725
  numberOfOutputs: 1,
1655
1726
  outputChannelCount: [1]
@@ -1699,7 +1770,7 @@ async function Ut(e) {
1699
1770
  }
1700
1771
  //#endregion
1701
1772
  //#region src/v2/speech/captureMediaStreamTrack.ts
1702
- async function Wt(e) {
1773
+ async function $t(e) {
1703
1774
  let { track: t, utterance: n, sampleRate: r, signal: i } = e;
1704
1775
  if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Q("MediaStreamTrack is not available in this environment.");
1705
1776
  if (t.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
@@ -1708,18 +1779,18 @@ async function Wt(e) {
1708
1779
  s || (s = !0, c?.stop(), c = null);
1709
1780
  };
1710
1781
  try {
1711
- c = await Ut({
1782
+ c = await Qt({
1712
1783
  mediaStream: a,
1713
1784
  targetSampleRate: r,
1714
1785
  shouldSend: () => !s && !i?.aborted,
1715
1786
  onPcm: (e) => {
1716
1787
  if (s || i?.aborted) return;
1717
- let t = Nt(e);
1788
+ let t = Ht(e);
1718
1789
  o = o.then(async () => {
1719
1790
  if (s || i?.aborted) return;
1720
1791
  let e = 0;
1721
1792
  for (; e < t.byteLength;) {
1722
- let r = Math.min(e + wt.MAX_CHUNK_BYTES, t.byteLength);
1793
+ let r = Math.min(e + Nt.MAX_CHUNK_BYTES, t.byteLength);
1723
1794
  if ((r - e) % 2 == 1 && --r, r <= e) break;
1724
1795
  let i = t.subarray(e, r);
1725
1796
  e = r, i.byteLength !== 0 && await n.write(i);
@@ -1743,10 +1814,10 @@ async function Wt(e) {
1743
1814
  }
1744
1815
  //#endregion
1745
1816
  //#region src/v2/speech/speechController.ts
1746
- async function Gt(e, t) {
1747
- if (xt(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
1748
- if (yt(e)) {
1749
- let t = Nt(e.data);
1817
+ async function en(e, t) {
1818
+ if (At(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
1819
+ if (Ot(e)) {
1820
+ let t = Ht(e.data);
1750
1821
  if (t.byteLength & 1) throw new Q("PCM byte length must be even.");
1751
1822
  return {
1752
1823
  kind: "pcm",
@@ -1754,17 +1825,17 @@ async function Gt(e, t) {
1754
1825
  format: e.format
1755
1826
  };
1756
1827
  }
1757
- if (bt(e)) return {
1828
+ if (kt(e)) return {
1758
1829
  kind: "url",
1759
1830
  url: e.url.trim(),
1760
1831
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
1761
1832
  };
1762
- if (!St(e)) throw new Q("Unsupported speech.play audio shape.");
1833
+ if (!jt(e)) throw new Q("Unsupported speech.play audio shape.");
1763
1834
  let n;
1764
1835
  if (typeof Blob < "u" && e.data instanceof Blob) {
1765
1836
  if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
1766
1837
  n = new Uint8Array(await e.data.arrayBuffer());
1767
- } else n = Nt(e.data);
1838
+ } else n = Ht(e.data);
1768
1839
  return {
1769
1840
  kind: "encoded",
1770
1841
  data: n.slice().buffer,
@@ -1772,10 +1843,10 @@ async function Gt(e, t) {
1772
1843
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
1773
1844
  };
1774
1845
  }
1775
- function Kt() {
1846
+ function tn() {
1776
1847
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `utt_${crypto.randomUUID().replace(/-/g, "").slice(0, 12)}` : `utt_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
1777
1848
  }
1778
- function qt(e, t = "completed") {
1849
+ function nn(e, t = "completed") {
1779
1850
  return {
1780
1851
  utteranceId: e.speechId,
1781
1852
  characterId: e.characterId,
@@ -1789,13 +1860,13 @@ function qt(e, t = "completed") {
1789
1860
  }
1790
1861
  };
1791
1862
  }
1792
- function Jt(e) {
1863
+ function rn(e) {
1793
1864
  return e instanceof Error ? e : new Q(String(e));
1794
1865
  }
1795
- function Yt(e) {
1866
+ function an(e) {
1796
1867
  return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
1797
1868
  }
1798
- var Xt = class {
1869
+ var on = class {
1799
1870
  id;
1800
1871
  characterId;
1801
1872
  result;
@@ -1824,29 +1895,29 @@ var Xt = class {
1824
1895
  queue: e.queue,
1825
1896
  ...e.transcript === void 0 ? {} : { transcript: e.transcript }
1826
1897
  }).catch((e) => {
1827
- throw this.fail(Jt(e)), Jt(e);
1898
+ throw this.fail(rn(e)), rn(e);
1828
1899
  }), this.signal?.addEventListener("abort", () => {
1829
1900
  this.cancel();
1830
1901
  }, { once: !0 });
1831
1902
  }
1832
1903
  async write(e, t) {
1833
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new Et();
1834
- let n = Nt(e);
1904
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new Ft();
1905
+ let n = Ht(e);
1835
1906
  if (n.byteLength & 1) throw new Q("PCM chunk byte length must be even (complete s16 samples).");
1836
- if (n.byteLength > wt.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${wt.MAX_CHUNK_BYTES}).`);
1907
+ if (n.byteLength > Nt.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${Nt.MAX_CHUNK_BYTES}).`);
1837
1908
  if (n.byteLength === 0) return;
1838
- let r = t?.timeoutMs ?? wt.DEFAULT_WRITE_TIMEOUT_MS;
1909
+ let r = t?.timeoutMs ?? Nt.DEFAULT_WRITE_TIMEOUT_MS;
1839
1910
  await this.acquireWriteSlot(r);
1840
1911
  let i = n.byteLength / 2 / this.sampleRate * 1e3;
1841
- if (this.bufferedMs + i > wt.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
1912
+ if (this.bufferedMs + i > Nt.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
1842
1913
  let a = async () => {
1843
- if (this.closed || this.settled) throw new Et();
1914
+ if (this.closed || this.settled) throw new Ft();
1844
1915
  let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
1845
1916
  utteranceId: this.id,
1846
1917
  audio: t.buffer,
1847
1918
  byteLength: t.byteLength
1848
1919
  }), a = await Promise.race([i, new Promise((e, t) => {
1849
- setTimeout(() => t(new Dt()), r);
1920
+ setTimeout(() => t(new It()), r);
1850
1921
  })]);
1851
1922
  this.bufferedMs = Math.max(0, a.bufferedMs);
1852
1923
  }, o = this.writeChain.then(a, a);
@@ -1858,7 +1929,7 @@ var Xt = class {
1858
1929
  }
1859
1930
  }
1860
1931
  async setTranscript(e) {
1861
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new Et();
1932
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new Ft();
1862
1933
  await this.requireHost().speechUtteranceSetTranscript({
1863
1934
  utteranceId: this.id,
1864
1935
  transcript: e
@@ -1875,7 +1946,7 @@ var Xt = class {
1875
1946
  });
1876
1947
  return this.resolve(t), t;
1877
1948
  } catch (e) {
1878
- let t = Jt(e);
1949
+ let t = rn(e);
1879
1950
  throw this.fail(t), t;
1880
1951
  }
1881
1952
  }
@@ -1893,11 +1964,11 @@ var Xt = class {
1893
1964
  characterId: this.characterId,
1894
1965
  status: "cancelled",
1895
1966
  durationMs: 0,
1896
- animation: Ot("none")
1967
+ animation: Lt("none")
1897
1968
  };
1898
1969
  return this.resolve(t), t;
1899
1970
  } catch (e) {
1900
- let t = Jt(e);
1971
+ let t = rn(e);
1901
1972
  throw this.fail(t), t;
1902
1973
  }
1903
1974
  }
@@ -1910,19 +1981,19 @@ var Xt = class {
1910
1981
  return e;
1911
1982
  }
1912
1983
  resolve(e) {
1913
- this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new Et()));
1984
+ this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new Ft()));
1914
1985
  }
1915
1986
  fail(e) {
1916
1987
  this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
1917
1988
  }
1918
1989
  async acquireWriteSlot(e) {
1919
- if (this.pendingWriteCount < wt.MAX_PENDING_WRITES) {
1990
+ if (this.pendingWriteCount < Nt.MAX_PENDING_WRITES) {
1920
1991
  this.pendingWriteCount += 1;
1921
1992
  return;
1922
1993
  }
1923
1994
  await new Promise((t, n) => {
1924
1995
  let r = setTimeout(() => {
1925
- n(new Dt());
1996
+ n(new It());
1926
1997
  }, e);
1927
1998
  this.pendingWriteWaiters.push({
1928
1999
  resolve: () => {
@@ -1941,13 +2012,13 @@ var Xt = class {
1941
2012
  for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
1942
2013
  }
1943
2014
  };
1944
- function Zt(e) {
2015
+ function sn(e) {
1945
2016
  let t = null, n = (t, n) => {
1946
- if (!e.getCapabilities()[n]) throw new Tt(t, n);
2017
+ if (!e.getCapabilities()[n]) throw new Pt(t, n);
1947
2018
  }, r = {
1948
2019
  async speak(r) {
1949
2020
  if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
1950
- let i = Pt(r.queue ?? "append");
2021
+ let i = Ut(r.queue ?? "append");
1951
2022
  i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
1952
2023
  let a = e.getIframeHost();
1953
2024
  if (!a) throw new Q("Speech session is not attached.");
@@ -1967,41 +2038,41 @@ function Zt(e) {
1967
2038
  return;
1968
2039
  }
1969
2040
  t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
1970
- t.removeEventListener("abort", s), n(qt(e, "completed"));
2041
+ t.removeEventListener("abort", s), n(nn(e, "completed"));
1971
2042
  }, (a) => {
1972
- if (t.removeEventListener("abort", s), Yt(a)) {
2043
+ if (t.removeEventListener("abort", s), an(a)) {
1973
2044
  n({
1974
2045
  utteranceId: "utt_interrupted",
1975
2046
  characterId: r.characterId ?? e.getActiveCharacterId(),
1976
2047
  status: "interrupted",
1977
2048
  durationMs: 0,
1978
2049
  transcript: r.text,
1979
- animation: Ot("none")
2050
+ animation: Lt("none")
1980
2051
  });
1981
2052
  return;
1982
2053
  }
1983
- i(Jt(a));
2054
+ i(rn(a));
1984
2055
  });
1985
2056
  });
1986
2057
  }
1987
2058
  try {
1988
- return qt(await o, "completed");
2059
+ return nn(await o, "completed");
1989
2060
  } catch (t) {
1990
- if (Yt(t)) return {
2061
+ if (an(t)) return {
1991
2062
  utteranceId: "utt_interrupted",
1992
2063
  characterId: r.characterId ?? e.getActiveCharacterId(),
1993
2064
  status: "interrupted",
1994
2065
  durationMs: 0,
1995
2066
  transcript: r.text,
1996
- animation: Ot("none")
2067
+ animation: Lt("none")
1997
2068
  };
1998
- throw Jt(t);
2069
+ throw rn(t);
1999
2070
  }
2000
2071
  },
2001
2072
  async play(i) {
2002
- if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), jt(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
2073
+ if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), Bt(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
2003
2074
  let a = i.queue ?? "append";
2004
- if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), xt(i.audio)) {
2075
+ if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), At(i.audio)) {
2005
2076
  let e = i.audio.sampleRate ?? 24e3;
2006
2077
  return r.createUtterance({
2007
2078
  format: {
@@ -2017,7 +2088,7 @@ function Zt(e) {
2017
2088
  }
2018
2089
  let o = e.getIframeHost();
2019
2090
  if (!o) throw new Q("Speech session is not attached.");
2020
- let s = await Gt(i.audio, i.signal);
2091
+ let s = await en(i.audio, i.signal);
2021
2092
  return o.speechPlay({
2022
2093
  source: s,
2023
2094
  characterId: i.characterId,
@@ -2029,13 +2100,13 @@ function Zt(e) {
2029
2100
  },
2030
2101
  createUtterance(r) {
2031
2102
  e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
2032
- let i = Mt(r);
2103
+ let i = Vt(r);
2033
2104
  if (r.track && r.track.kind !== "audio") throw new Q("createUtterance track must be an audio MediaStreamTrack.");
2034
2105
  let a = r.queue ?? "replace-active";
2035
2106
  if (a !== "replace-active" && a !== "replace-all") throw new Q("createUtterance queue must be replace-active or replace-all.");
2036
2107
  e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
2037
- let o = new Xt({
2038
- id: Kt(),
2108
+ let o = new on({
2109
+ id: tn(),
2039
2110
  characterId: r.characterId ?? e.getActiveCharacterId(),
2040
2111
  format: i,
2041
2112
  queue: a,
@@ -2047,7 +2118,7 @@ function Zt(e) {
2047
2118
  t === o && (t = null);
2048
2119
  }), r.track && (async () => {
2049
2120
  try {
2050
- if (await Wt({
2121
+ if (await $t({
2051
2122
  track: r.track,
2052
2123
  utterance: o,
2053
2124
  sampleRate: i.sampleRate,
@@ -2075,16 +2146,16 @@ function Zt(e) {
2075
2146
  }
2076
2147
  //#endregion
2077
2148
  //#region src/v2/types/sessionInteraction.ts
2078
- function Qt(e) {
2149
+ function cn(e) {
2079
2150
  let t = e?.trim();
2080
2151
  return t === "full" || t === "face" || t === "medium" ? t : void 0;
2081
2152
  }
2082
2153
  //#endregion
2083
2154
  //#region src/v2/experience.ts
2084
- function $t(e) {
2155
+ function ln(e) {
2085
2156
  return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
2086
2157
  }
2087
- var en = class e {
2158
+ var un = class e {
2088
2159
  bootstrap;
2089
2160
  conversationProcessor;
2090
2161
  iframeHost = null;
@@ -2099,16 +2170,16 @@ var en = class e {
2099
2170
  attached = !1;
2100
2171
  pendingFit = null;
2101
2172
  closeHandlers = [];
2102
- eventRegistry = ht();
2173
+ eventRegistry = wt();
2103
2174
  readyEnvelope = null;
2104
2175
  startedEnvelope = null;
2105
2176
  conversationCache = [];
2106
2177
  speech;
2107
2178
  constructor(e) {
2108
- this.bootstrap = e, this.conversationProcessor = e.conversationProcessor ?? null, this.resolvedSession = e.kind === "launch" ? e.session ?? null : null, this.launchToken = e.kind === "launch" ? e.launch : null, this.speech = Zt({
2179
+ this.bootstrap = e, this.conversationProcessor = e.conversationProcessor ?? null, this.resolvedSession = e.kind === "launch" ? e.session ?? null : null, this.launchToken = e.kind === "launch" ? e.launch : null, this.speech = sn({
2109
2180
  getIframeHost: () => this.iframeHost,
2110
2181
  assertSessionStarted: () => this.assertSessionStarted(),
2111
- getCapabilities: () => tn(this.resolvedSession),
2182
+ getCapabilities: () => dn(this.resolvedSession),
2112
2183
  getActiveCharacterId: () => "character_unknown",
2113
2184
  onProcessorInterrupt: () => {
2114
2185
  this.processorAbortController?.abort(), this.processorAbortController = null;
@@ -2152,6 +2223,7 @@ var en = class e {
2152
2223
  mode: t.mode,
2153
2224
  speechInputMode: t.speechInputMode,
2154
2225
  speechOnly: t.speechOnly,
2226
+ attribution: t.attribution,
2155
2227
  ui: t.ui,
2156
2228
  onStart: t.onStart,
2157
2229
  onUserTranscript: t.onUserTranscript,
@@ -2173,6 +2245,7 @@ var en = class e {
2173
2245
  mode: t.mode,
2174
2246
  speechInputMode: t.speechInputMode,
2175
2247
  speechOnly: t.speechOnly,
2248
+ attribution: t.attribution,
2176
2249
  ui: t.ui,
2177
2250
  onStart: t.onStart,
2178
2251
  onUserTranscript: t.onUserTranscript,
@@ -2187,7 +2260,7 @@ var en = class e {
2187
2260
  return null;
2188
2261
  }
2189
2262
  on(e, t) {
2190
- let n = gt(this.eventRegistry, e, t);
2263
+ let n = Tt(this.eventRegistry, e, t);
2191
2264
  return e === "ready" && this.readyEnvelope && queueMicrotask(() => t(this.readyEnvelope)), e === "started" && this.startedEnvelope && queueMicrotask(() => t(this.startedEnvelope)), n;
2192
2265
  }
2193
2266
  async attach(e) {
@@ -2201,13 +2274,13 @@ var en = class e {
2201
2274
  if (this.closed) throw Error("Session has ended.");
2202
2275
  if (this.attached && this.iframeHost) return this.createPlayerFacade();
2203
2276
  this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
2204
- let t = this.bootstrap.embedBaseUrl ?? ct(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = ut(t, n, r ? void 0 : lt(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, $t(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize), a = ft(i), o = null, s = new Promise((e) => {
2277
+ let t = this.bootstrap.embedBaseUrl ?? _t(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = yt(t, n, r ? void 0 : vt(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, ln(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize), a = xt(i), o = null, s = new Promise((e) => {
2205
2278
  o = e;
2206
2279
  }), c = null, l = new Promise((e) => {
2207
2280
  c = e;
2208
- }), u = it((e) => {
2281
+ }), u = pt((e) => {
2209
2282
  this.readyEnvelope ||= (this.resolvedSession = e, this.emitWrapped("ready", { session: e }));
2210
- }), d = this.bootstrap.onUserTranscript, f = rt({
2283
+ }), d = this.bootstrap.onUserTranscript, f = ft({
2211
2284
  container: e.container,
2212
2285
  src: i,
2213
2286
  playerOrigin: a,
@@ -2270,7 +2343,7 @@ var en = class e {
2270
2343
  onWidgetDragEnd: (t) => e.onWidgetDragEnd?.(t)
2271
2344
  });
2272
2345
  this.iframeHost = f;
2273
- let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), ze(this.bootstrap.sessionEndpoint, {
2346
+ let p = this.resolveMintInteraction(), m = this.bootstrap.kind === "sessionEndpoint" ? (this.endpointAbortController = new AbortController(), We(this.bootstrap.sessionEndpoint, {
2274
2347
  experienceId: this.bootstrap.experienceId,
2275
2348
  locale: this.bootstrap.locale,
2276
2349
  secondaryLocale: this.bootstrap.secondaryLocale,
@@ -2279,15 +2352,17 @@ var en = class e {
2279
2352
  mode: p.mode,
2280
2353
  speechInputMode: p.speechInputMode,
2281
2354
  speechOnly: this.bootstrap.speechOnly,
2355
+ attribution: this.bootstrap.attribution,
2282
2356
  signal: this.endpointAbortController.signal
2283
- })) : this.bootstrap.kind === "public" ? Re(this.bootstrap.experienceId, {
2357
+ })) : this.bootstrap.kind === "public" ? Ue(this.bootstrap.experienceId, {
2284
2358
  locale: this.bootstrap.locale,
2285
2359
  secondaryLocale: this.bootstrap.secondaryLocale,
2286
2360
  learningLocale: this.bootstrap.learningLocale,
2287
2361
  language: this.bootstrap.language,
2288
2362
  mode: p.mode,
2289
2363
  speechInputMode: p.speechInputMode,
2290
- speechOnly: this.bootstrap.speechOnly
2364
+ speechOnly: this.bootstrap.speechOnly,
2365
+ attribution: this.bootstrap.attribution
2291
2366
  }) : Promise.resolve(this.bootstrap.session ? {
2292
2367
  session: this.bootstrap.session,
2293
2368
  launch: this.bootstrap.launch
@@ -2302,11 +2377,13 @@ var en = class e {
2302
2377
  f.postParentHello();
2303
2378
  let g = h?.launch ?? (this.bootstrap.kind === "launch" ? this.bootstrap.launch : null), _ = h?.session ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
2304
2379
  if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
2305
- return this.launchToken = g, _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && Ae(_), f.postLaunch(g, _, {
2380
+ return this.launchToken = g, _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && Fe(_), f.postLaunch(g, _, {
2306
2381
  startButton: e.startButton,
2382
+ theme: e.theme,
2307
2383
  showFeedback: e.showFeedback
2308
2384
  }), u.setValue(_)) : f.postLaunch(g, void 0, {
2309
2385
  startButton: e.startButton,
2386
+ theme: e.theme,
2310
2387
  showFeedback: e.showFeedback
2311
2388
  }), await Promise.race([s, new Promise((e, t) => {
2312
2389
  setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player loading UI.")), 12e4);
@@ -2336,11 +2413,16 @@ var en = class e {
2336
2413
  this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
2337
2414
  }
2338
2415
  async setFit(e) {
2339
- let t = Qt(e);
2416
+ let t = cn(e);
2340
2417
  if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
2341
2418
  if (this.closed) throw Error("Session has ended.");
2342
2419
  this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
2343
2420
  }
2421
+ async conversion(e) {
2422
+ if (this.closed) throw Error("Session has ended.");
2423
+ if (!this.iframeHost) throw Error("conversion() requires attach() first.");
2424
+ await this.iframeHost.conversion(e);
2425
+ }
2344
2426
  getLastTurn() {
2345
2427
  if (this.conversationCache.length === 0) return [];
2346
2428
  let e = this.conversationCache[this.conversationCache.length - 1].turnId;
@@ -2350,7 +2432,7 @@ var en = class e {
2350
2432
  this.close();
2351
2433
  }
2352
2434
  destroy() {
2353
- this.closed || (this.closed = !0, this.processorAbortController?.abort(), this.processorAbortController = null, this.endpointAbortController?.abort(), this.endpointAbortController = null, this.attachInFlight = null, this.iframeHost?.destroy(), this.iframeHost = null, vt(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.attached = !1);
2435
+ this.closed || (this.closed = !0, this.processorAbortController?.abort(), this.processorAbortController = null, this.endpointAbortController?.abort(), this.endpointAbortController = null, this.attachInFlight = null, this.iframeHost?.destroy(), this.iframeHost = null, Dt(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.attached = !1);
2354
2436
  }
2355
2437
  resolveMintInteraction() {
2356
2438
  return this.bootstrap.kind === "launch" ? {} : {
@@ -2362,8 +2444,8 @@ var en = class e {
2362
2444
  return this.resolvedSession?.id ?? "";
2363
2445
  }
2364
2446
  emitWrapped(e, t) {
2365
- let n = mt(e, this.getSessionId(), t);
2366
- return _t(this.eventRegistry, e, n), n;
2447
+ let n = Ct(e, this.getSessionId(), t);
2448
+ return Et(this.eventRegistry, e, n), n;
2367
2449
  }
2368
2450
  queueProcessorTurn(e) {
2369
2451
  if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
@@ -2372,7 +2454,7 @@ var en = class e {
2372
2454
  let n = this.processorAbortController.signal;
2373
2455
  this.processorChain = this.processorChain.then(async () => {
2374
2456
  if (!n.aborted) try {
2375
- let r = await He(t, {
2457
+ let r = await qe(t, {
2376
2458
  utteranceId: e.utteranceId,
2377
2459
  text: e.text,
2378
2460
  conversation: this.conversationCache,
@@ -2422,7 +2504,7 @@ var en = class e {
2422
2504
  };
2423
2505
  }
2424
2506
  };
2425
- function tn(e) {
2507
+ function dn(e) {
2426
2508
  return e ? {
2427
2509
  textSpeech: e.capabilities.speech.output,
2428
2510
  externalSpeechAudio: e.capabilities.speech.externalAudio
@@ -2433,41 +2515,41 @@ function tn(e) {
2433
2515
  }
2434
2516
  //#endregion
2435
2517
  //#region src/widget/dockGeometry.ts
2436
- var nn = "(min-width: 768px)", rn = 24, an = .5, on = 1200, sn = .85, cn = 9 / 16;
2437
- function ln() {
2518
+ var fn = "(min-width: 768px)", pn = 24, mn = .5, hn = 1200, gn = .85, _n = 9 / 16;
2519
+ function vn() {
2438
2520
  if (typeof window > "u") return 800;
2439
2521
  let e = window.screen?.availHeight;
2440
2522
  return typeof e == "number" && e > 0 ? e : window.innerHeight;
2441
2523
  }
2442
- function un(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = rn, r = typeof window < "u" ? ln() : 800) {
2443
- let i = Math.max(160, Math.min(t - n * 2, t * sn)), a = Math.max(120, e - n * 2), o = Math.min(r * an, on, i), s = o * cn;
2444
- return s > a && (s = a, o = s / cn, o > i && (o = i, s = o * cn)), {
2524
+ function yn(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = pn, r = typeof window < "u" ? vn() : 800) {
2525
+ let i = Math.max(160, Math.min(t - n * 2, t * gn)), a = Math.max(120, e - n * 2), o = Math.min(r * mn, hn, i), s = o * _n;
2526
+ return s > a && (s = a, o = s / _n, o > i && (o = i, s = o * _n)), {
2445
2527
  width: Math.round(s),
2446
2528
  height: Math.round(o)
2447
2529
  };
2448
2530
  }
2449
- function dn(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = rn) {
2531
+ function bn(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = pn) {
2450
2532
  return {
2451
2533
  left: Math.max(r, t - e.width - r),
2452
2534
  top: Math.max(r, n - e.height - r)
2453
2535
  };
2454
2536
  }
2455
- function fn(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = rn) {
2537
+ function xn(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = pn) {
2456
2538
  let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
2457
2539
  return {
2458
2540
  left: Math.min(Math.max(a, e), o),
2459
2541
  top: Math.min(Math.max(a, t), s)
2460
2542
  };
2461
2543
  }
2462
- function pn(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
2463
- return e(nn).matches;
2544
+ function Sn(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
2545
+ return e(fn).matches;
2464
2546
  }
2465
2547
  //#endregion
2466
2548
  //#region src/widget/mountExperienceWidget.ts
2467
- function mn(e) {
2549
+ function Cn(e) {
2468
2550
  return e === "bottom-right" || e === "bottom-left" ? e : "static";
2469
2551
  }
2470
- function hn(e) {
2552
+ function wn(e) {
2471
2553
  if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
2472
2554
  let t = typeof e == "string" ? e.trim() : "";
2473
2555
  return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
@@ -2475,8 +2557,8 @@ function hn(e) {
2475
2557
  function $(e) {
2476
2558
  return e === "expanded" || e === "docked";
2477
2559
  }
2478
- var gn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065\"/><path d=\"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0\"/></svg>", _n = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12l-4.9 4.89a1 1 0 1 0 1.42 1.42L12 13.41l4.89 4.9a1 1 0 0 0 1.42-1.42L13.41 12l4.9-4.89a1 1 0 0 0-.01-1.4Z\"/></svg>", vn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 10h-4V6m6-2l-6 6m-8 4h4v4m0-4l-6 6\"/></svg>", yn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M16 4h4v4m-6 2l6-6M8 20H4v-4m0 4l6-6\"/></svg>";
2479
- function bn(e, t, n) {
2560
+ var Tn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065\"/><path d=\"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0\"/></svg>", En = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12l-4.9 4.89a1 1 0 1 0 1.42 1.42L12 13.41l4.89 4.9a1 1 0 0 0 1.42-1.42L13.41 12l4.9-4.89a1 1 0 0 0-.01-1.4Z\"/></svg>", Dn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 10h-4V6m6-2l-6 6m-8 4h4v4m0-4l-6 6\"/></svg>", On = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M16 4h4v4m-6 2l6-6M8 20H4v-4m0 4l6-6\"/></svg>";
2561
+ function kn(e, t, n) {
2480
2562
  W(de);
2481
2563
  let r = w({
2482
2564
  galleryThumb: t.galleryThumb,
@@ -2506,7 +2588,7 @@ function bn(e, t, n) {
2506
2588
  }
2507
2589
  return e.replaceChildren(i), n?.parallax === !1 ? () => {} : ue(i);
2508
2590
  }
2509
- function xn(e) {
2591
+ function An(e) {
2510
2592
  return e.startButton ? {
2511
2593
  ...e.startButton,
2512
2594
  label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
@@ -2518,7 +2600,7 @@ function xn(e) {
2518
2600
  variant: "primary"
2519
2601
  };
2520
2602
  }
2521
- function Sn(e) {
2603
+ function jn(e) {
2522
2604
  let t = !1, n = () => {
2523
2605
  t || e();
2524
2606
  }, r = () => {
@@ -2538,12 +2620,12 @@ function Sn(e) {
2538
2620
  t = !0, window.removeEventListener("load", r), i?.();
2539
2621
  };
2540
2622
  }
2541
- function Cn(e, t) {
2623
+ function Mn(e, t) {
2542
2624
  he(me);
2543
2625
  let n = t.experienceId?.trim();
2544
2626
  if (!n) throw Error("ExperienceWidget requires experienceId.");
2545
- let r = t.prefetch ?? "onExpand", i = mn(t.position), a = document.createElement("div");
2546
- a.className = "liforma-ew", a.dataset.state = "collapsed", a.dataset.prefetch = r, a.dataset.position = i, a.style.setProperty("--liforma-ew-max-w", t.expandedMaxWidth ?? "100%"), a.style.setProperty("--liforma-ew-max-h", t.expandedMaxHeight ?? "100%"), i !== "static" && a.style.setProperty("--liforma-ew-offset", hn(t.offset));
2627
+ let r = t.prefetch ?? "onExpand", i = Cn(t.position), a = document.createElement("div");
2628
+ a.className = "liforma-ew", a.dataset.state = "collapsed", a.dataset.prefetch = r, a.dataset.position = i, a.style.setProperty("--liforma-ew-max-w", t.expandedMaxWidth ?? "100%"), a.style.setProperty("--liforma-ew-max-h", t.expandedMaxHeight ?? "100%"), i !== "static" && a.style.setProperty("--liforma-ew-offset", wn(t.offset));
2547
2629
  let o = document.createElement("button");
2548
2630
  o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
2549
2631
  let s = document.createElement("div");
@@ -2563,11 +2645,11 @@ function Cn(e, t) {
2563
2645
  let m = document.createElement("span");
2564
2646
  m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
2565
2647
  let h = document.createElement("button");
2566
- h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = vn, h.setAttribute("aria-label", "Reduce");
2648
+ h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = Dn, h.setAttribute("aria-label", "Reduce");
2567
2649
  let g = document.createElement("button");
2568
- g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = gn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
2650
+ g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = Tn, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
2569
2651
  let _ = document.createElement("button");
2570
- _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = _n, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
2652
+ _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = En, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
2571
2653
  let v = document.createElement("div");
2572
2654
  v.className = "liforma-ew__stage";
2573
2655
  let y = document.createElement("div");
@@ -2595,11 +2677,11 @@ function Cn(e, t) {
2595
2677
  p.style.left = `${e + n - a - 10}px`, p.style.top = `${t + 10}px`, p.style.right = "auto", p.style.bottom = "auto", p.style.width = "auto", p.style.height = "auto";
2596
2678
  }, oe = (e, t) => {
2597
2679
  if (R() !== "docked") return;
2598
- let n = un(), r = fn(e - te, t - ne, n);
2680
+ let n = yn(), r = xn(e - te, t - ne, n);
2599
2681
  N = r.left, P = r.top, V(r.left, r.top, n.width, n.height);
2600
2682
  }, se = (e, t) => {
2601
2683
  if (R() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
2602
- let n = un(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = fn(r + e, i + t, n);
2684
+ let n = yn(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = xn(r + e, i + t, n);
2603
2685
  N = a.left, P = a.top, V(a.left, a.top, n.width, n.height);
2604
2686
  }, ce = (e) => {
2605
2687
  I === "toolbar" && (F === null || e.pointerId !== F || (e.preventDefault(), oe(e.clientX, e.clientY)));
@@ -2608,12 +2690,12 @@ function Cn(e, t) {
2608
2690
  let t = I;
2609
2691
  F = null, I = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && L && (L = !1, window.removeEventListener("pointermove", ce), window.removeEventListener("pointerup", H), window.removeEventListener("pointercancel", H));
2610
2692
  }, le = (e, t, n) => {
2611
- if (S || R() !== "docked" || !pn() || F !== null) return;
2693
+ if (S || R() !== "docked" || !Sn() || F !== null) return;
2612
2694
  F = n, I = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2613
2695
  let r = f.getBoundingClientRect();
2614
2696
  te = e - r.left, ne = t - r.top, L || (L = !0, window.addEventListener("pointermove", ce), window.addEventListener("pointerup", H), window.addEventListener("pointercancel", H));
2615
2697
  }, ue = (e) => {
2616
- if (S || R() !== "docked" || !pn() || F !== null) return;
2698
+ if (S || R() !== "docked" || !Sn() || F !== null) return;
2617
2699
  F = e.pointerId, I = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2618
2700
  let t = f.getBoundingClientRect();
2619
2701
  N = t.left, P = t.top;
@@ -2622,15 +2704,15 @@ function Cn(e, t) {
2622
2704
  }, U = (e) => {
2623
2705
  I === "player" && (F === null || e.pointerId !== F || H());
2624
2706
  }, W = () => {
2625
- let e = pn(), t = R();
2707
+ let e = Sn(), t = R();
2626
2708
  if (!e || t !== "expanded" && t !== "docked") {
2627
2709
  h.hidden = !0;
2628
2710
  return;
2629
2711
  }
2630
- h.hidden = !1, t === "docked" ? (h.innerHTML = yn, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = vn, h.setAttribute("aria-label", "Reduce"));
2712
+ h.hidden = !1, t === "docked" ? (h.innerHTML = On, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = Dn, h.setAttribute("aria-label", "Reduce"));
2631
2713
  }, fe = (e) => {
2632
- let t = un(), n = e && N !== null && P !== null ? fn(N, P, t) : dn(t);
2633
- n = fn(n.left, n.top, t), N = n.left, P = n.top, V(n.left, n.top, t.width, t.height), W();
2714
+ let t = yn(), n = e && N !== null && P !== null ? xn(N, P, t) : bn(t);
2715
+ n = xn(n.left, n.top, t), N = n.left, P = n.top, V(n.left, n.top, t.width, t.height), W();
2634
2716
  }, pe = () => {
2635
2717
  a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
2636
2718
  requestAnimationFrame(() => {
@@ -2677,7 +2759,7 @@ function Cn(e, t) {
2677
2759
  w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
2678
2760
  }, xe = (e) => {
2679
2761
  A?.(), A = null;
2680
- let t = bn(s, e, { parallax: ie });
2762
+ let t = kn(s, e, { parallax: ie });
2681
2763
  return t ? (A = t, !0) : !1;
2682
2764
  }, Se = () => {
2683
2765
  if (xe(_e)) {
@@ -2706,13 +2788,13 @@ function Cn(e, t) {
2706
2788
  ...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
2707
2789
  }), we = () => ({
2708
2790
  ...t.fit ? { fit: t.fit } : {},
2709
- startButton: xn(t),
2791
+ startButton: An(t),
2710
2792
  ...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback }
2711
2793
  }), J = (e = !0) => {
2712
2794
  o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), ae(), a.dataset.state = "expanded", K(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), W(), e && t.onExpanded?.();
2713
- }, Y = () => {
2795
+ }, Te = () => {
2714
2796
  o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", K(null), typeof document < "u" && (document.body.style.overflow = k), fe(!0), W(), b?.setWidgetChrome("docked");
2715
- }, X = (e) => {
2797
+ }, Ee = (e) => {
2716
2798
  e.on("started", () => {
2717
2799
  S || (D = !0, a.dataset.live = "true", K(null), t.onStarted?.(), $(a.dataset.state) && pe());
2718
2800
  }), e.on("feedback", (e) => {
@@ -2720,28 +2802,28 @@ function Cn(e, t) {
2720
2802
  }), e.on("feedbackFailed", (e) => {
2721
2803
  S || t.onFeedbackFailed?.(e);
2722
2804
  });
2723
- }, Te = () => {
2805
+ }, De = () => {
2724
2806
  B(), u.hidden = !0, p.hidden = !0, ae(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), g.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), C && (o.disabled = !1), K(null), typeof document < "u" && (document.body.style.overflow = k), W();
2725
- }, Ee = () => {
2807
+ }, Oe = () => {
2726
2808
  z(), B(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
2727
2809
  let e = b;
2728
2810
  b = null, e?.destroy(), v.replaceChildren(), l.replaceChildren(), l.hidden = !0, delete a.dataset.warm, delete a.dataset.live, a.classList.remove("liforma-ew--session-revealed");
2729
- }, De = () => {
2811
+ }, ke = () => {
2730
2812
  if (!S && $(a.dataset.state)) {
2731
2813
  if (H(), x = !1, b && E) {
2732
2814
  let e = b;
2733
2815
  (async () => {
2734
- D && (await ge(), S || b !== e) || (w && e.setWidgetChrome("collapsed"), Te(), D ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : w && q(), t.onCollapsed?.(), t.onClose?.());
2816
+ D && (await ge(), S || b !== e) || (w && e.setWidgetChrome("collapsed"), De(), D ? (a.dataset.live = "true", o.tabIndex = 0, o.removeAttribute("aria-hidden"), o.disabled = !1) : w && q(), t.onCollapsed?.(), t.onClose?.());
2735
2817
  })();
2736
2818
  return;
2737
2819
  }
2738
- Ee(), Te(), t.onCollapsed?.(), t.onClose?.();
2820
+ Oe(), De(), t.onCollapsed?.(), t.onClose?.();
2739
2821
  }
2740
- }, Oe = () => {
2741
- S || pn() && R() === "expanded" && G(() => {
2742
- Y();
2822
+ }, Y = () => {
2823
+ S || Sn() && R() === "expanded" && G(() => {
2824
+ Te();
2743
2825
  });
2744
- }, ke = () => {
2826
+ }, X = () => {
2745
2827
  S || R() === "docked" && (H(), G(() => {
2746
2828
  ae(), J(!1), b?.setWidgetChrome("expanded");
2747
2829
  }));
@@ -2757,12 +2839,12 @@ function Cn(e, t) {
2757
2839
  let e = O;
2758
2840
  l.hidden = !1, (async () => {
2759
2841
  try {
2760
- let t = await en.startSession(Ce());
2842
+ let t = await un.startSession(Ce());
2761
2843
  if (S || e !== O) {
2762
2844
  t.destroy();
2763
2845
  return;
2764
2846
  }
2765
- b = t, X(t);
2847
+ b = t, Ee(t);
2766
2848
  let n = await t.attach({
2767
2849
  container: l,
2768
2850
  ...we(),
@@ -2793,7 +2875,7 @@ function Cn(e, t) {
2793
2875
  return;
2794
2876
  }
2795
2877
  n.on("close", () => {
2796
- S || De();
2878
+ S || ke();
2797
2879
  });
2798
2880
  } catch (n) {
2799
2881
  if (S || e !== O) return;
@@ -2816,12 +2898,12 @@ function Cn(e, t) {
2816
2898
  x = !0, w = !1, T = !1, E = !1, D = !1, delete a.dataset.warm, delete a.dataset.live, l.hidden = !0, l.replaceChildren(), b &&= (b.destroy(), null), (async () => {
2817
2899
  try {
2818
2900
  J();
2819
- let t = await en.startSession(Ce());
2901
+ let t = await un.startSession(Ce());
2820
2902
  if (S || e !== O) {
2821
2903
  t.destroy();
2822
2904
  return;
2823
2905
  }
2824
- b = t, X(t);
2906
+ b = t, Ee(t);
2825
2907
  let n = await t.attach({
2826
2908
  container: v,
2827
2909
  ...we(),
@@ -2846,7 +2928,7 @@ function Cn(e, t) {
2846
2928
  return;
2847
2929
  }
2848
2930
  E = !0, t.setWidgetChrome("expanded"), n.on("close", () => {
2849
- S || De();
2931
+ S || ke();
2850
2932
  });
2851
2933
  } catch (n) {
2852
2934
  if (S || e !== O) return;
@@ -2874,23 +2956,23 @@ function Cn(e, t) {
2874
2956
  }
2875
2957
  }, Ie = (e) => {
2876
2958
  if (e.stopPropagation(), R() === "expanded") {
2877
- Oe();
2959
+ Y();
2878
2960
  return;
2879
2961
  }
2880
- R() === "docked" && ke();
2962
+ R() === "docked" && X();
2881
2963
  }, Le = (e) => {
2882
2964
  g.setAttribute("aria-pressed", e ? "true" : "false");
2883
2965
  }, Re = (e) => {
2884
2966
  e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
2885
2967
  }, ze = (e) => {
2886
- R() === "docked" && pn() && (e.target?.closest("button") || (e.preventDefault(), le(e.clientX, e.clientY, e.pointerId)));
2968
+ R() === "docked" && Sn() && (e.target?.closest("button") || (e.preventDefault(), le(e.clientX, e.clientY, e.pointerId)));
2887
2969
  }, Be = (e) => {
2888
- e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), De());
2970
+ e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), ke());
2889
2971
  }, Ve = () => {
2890
2972
  if (!S) {
2891
2973
  if (R() === "docked") {
2892
- if (!pn()) {
2893
- ke();
2974
+ if (!Sn()) {
2975
+ X();
2894
2976
  return;
2895
2977
  }
2896
2978
  D ? G(() => {
@@ -2900,27 +2982,27 @@ function Cn(e, t) {
2900
2982
  }
2901
2983
  W();
2902
2984
  }
2903
- }, He = typeof window < "u" ? window.matchMedia(nn) : null, Ue = () => {
2985
+ }, He = typeof window < "u" ? window.matchMedia(fn) : null, Ue = () => {
2904
2986
  if (!S) {
2905
- if (R() === "docked" && !pn()) {
2906
- ke();
2987
+ if (R() === "docked" && !Sn()) {
2988
+ X();
2907
2989
  return;
2908
2990
  }
2909
2991
  W();
2910
2992
  }
2911
2993
  };
2912
- return o.addEventListener("click", Fe), d.addEventListener("click", De), _.addEventListener("click", (e) => {
2913
- e.stopPropagation(), De();
2994
+ return o.addEventListener("click", Fe), d.addEventListener("click", ke), _.addEventListener("click", (e) => {
2995
+ e.stopPropagation(), ke();
2914
2996
  }), h.addEventListener("click", Ie), g.addEventListener("click", Re), p.addEventListener("pointerdown", ze), window.addEventListener("keydown", Be), window.addEventListener("resize", Ve), He?.addEventListener("change", Ue), Se(), W(), r === "eager" ? queueMicrotask(() => {
2915
2997
  S || Ne();
2916
- }) : r === "idle" && (ee = Sn(() => {
2998
+ }) : r === "idle" && (ee = jn(() => {
2917
2999
  S || Ne();
2918
3000
  })), {
2919
3001
  root: a,
2920
3002
  expand: Fe,
2921
- collapse: De,
2922
- dock: Oe,
2923
- maximize: ke,
3003
+ collapse: ke,
3004
+ dock: Y,
3005
+ maximize: X,
2924
3006
  prefetch() {
2925
3007
  if (r === "onExpand") {
2926
3008
  Ne();
@@ -2929,18 +3011,18 @@ function Cn(e, t) {
2929
3011
  Ne();
2930
3012
  },
2931
3013
  destroy() {
2932
- S || (S = !0, H(), ee?.(), ee = null, re.abort(), A?.(), A = null, window.removeEventListener("keydown", Be), window.removeEventListener("resize", Ve), He?.removeEventListener("change", Ue), Ee(), Te(), e.replaceChildren());
3014
+ S || (S = !0, H(), ee?.(), ee = null, re.abort(), A?.(), A = null, window.removeEventListener("keydown", Be), window.removeEventListener("resize", Ve), He?.removeEventListener("change", Ue), Oe(), De(), e.replaceChildren());
2933
3015
  }
2934
3016
  };
2935
3017
  }
2936
3018
  //#endregion
2937
3019
  //#region src/react/ExperienceWidget.tsx
2938
- function wn(t) {
3020
+ function Nn(t) {
2939
3021
  let r = n(null), { experienceId: i, alt: o, galleryThumb: s, avatarImage: c, backgroundImage: l, foregroundImage: u, fallbackImage: d, prefetch: f = "onExpand", parallax: p = !0, position: m = "static", offset: h, sessionEndpoint: g, language: _, mode: v, speechInputMode: y, speechOnly: b, fit: x, embedBaseUrl: S, expandedMaxWidth: C, expandedMaxHeight: w, startButtonLabel: T, startButton: E, showFeedback: D, className: O = "", onExpanded: k, onCollapsed: A, onStarted: ee, onClose: j, onError: M, onPrefetchReady: N, onFeedback: P, onFeedbackFailed: F } = t, te = m === "bottom-right" || m === "bottom-left";
2940
3022
  return e(() => {
2941
3023
  let e = r.current;
2942
3024
  if (!e || !i.trim()) return;
2943
- let t = Cn(e, {
3025
+ let t = Mn(e, {
2944
3026
  experienceId: i,
2945
3027
  alt: o,
2946
3028
  galleryThumb: s,
@@ -3017,6 +3099,12 @@ function wn(t) {
3017
3099
  });
3018
3100
  }
3019
3101
  //#endregion
3020
- export { pe as ExperienceThumbnail, wn as ExperienceWidget, v as createLiformaSessionRouteHandler };
3102
+ //#region src/next/index.ts
3103
+ function Pn(e = {}) {
3104
+ let t = v(e);
3105
+ return { POST: ({ request: e }) => t(e) };
3106
+ }
3107
+ //#endregion
3108
+ export { pe as ExperienceThumbnail, Nn as ExperienceWidget, v as createLiformaSessionRouteHandler, Pn as createLiformaSvelteKitSessionHandler };
3021
3109
 
3022
3110
  //# sourceMappingURL=index.js.map