@liforma/client 0.4.8 → 0.4.10

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 (101) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/next/index.js +516 -185
  3. package/dist/next/index.js.map +1 -1
  4. package/dist/next/next/createLiformaSessionRouteHandler.d.ts +4 -0
  5. package/dist/next/next/createLiformaSessionRouteHandler.d.ts.map +1 -1
  6. package/dist/next/v2/api/mintPublicSession.d.ts +1 -0
  7. package/dist/next/v2/api/mintPublicSession.d.ts.map +1 -1
  8. package/dist/next/v2/api/sessionEndpointRequest.d.ts +4 -0
  9. package/dist/next/v2/api/sessionEndpointRequest.d.ts.map +1 -1
  10. package/dist/next/v2/embed/iframeHost.d.ts +13 -1
  11. package/dist/next/v2/embed/iframeHost.d.ts.map +1 -1
  12. package/dist/next/v2/embed/protocol.d.ts +35 -1
  13. package/dist/next/v2/embed/protocol.d.ts.map +1 -1
  14. package/dist/next/v2/experience.d.ts +17 -2
  15. package/dist/next/v2/experience.d.ts.map +1 -1
  16. package/dist/next/v2/experienceEvents.d.ts +3 -1
  17. package/dist/next/v2/experienceEvents.d.ts.map +1 -1
  18. package/dist/next/v2/sdkRelease.d.ts +3 -0
  19. package/dist/next/v2/sdkRelease.d.ts.map +1 -0
  20. package/dist/next/v2/types/sessionInteraction.d.ts +29 -0
  21. package/dist/next/v2/types/sessionInteraction.d.ts.map +1 -1
  22. package/dist/next/v2/types/sessionManifest.d.ts +1 -0
  23. package/dist/next/v2/types/sessionManifest.d.ts.map +1 -1
  24. package/dist/next/widget/mountExperienceWidget.d.ts.map +1 -1
  25. package/dist/next/widget/types.d.ts +5 -0
  26. package/dist/next/widget/types.d.ts.map +1 -1
  27. package/dist/npm/index.js +542 -225
  28. package/dist/npm/index.js.map +1 -1
  29. package/dist/npm/svelte/experienceLoadError.d.ts.map +1 -1
  30. package/dist/npm/svelte/experienceLoadErrorStyles.d.ts +1 -1
  31. package/dist/npm/svelte/experienceLoadErrorStyles.d.ts.map +1 -1
  32. package/dist/npm/v2/api/mintPublicSession.d.ts +1 -0
  33. package/dist/npm/v2/api/mintPublicSession.d.ts.map +1 -1
  34. package/dist/npm/v2/api/sessionEndpointRequest.d.ts +4 -0
  35. package/dist/npm/v2/api/sessionEndpointRequest.d.ts.map +1 -1
  36. package/dist/npm/v2/embed/iframeHost.d.ts +13 -1
  37. package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -1
  38. package/dist/npm/v2/embed/protocol.d.ts +35 -1
  39. package/dist/npm/v2/embed/protocol.d.ts.map +1 -1
  40. package/dist/npm/v2/experience.d.ts +17 -2
  41. package/dist/npm/v2/experience.d.ts.map +1 -1
  42. package/dist/npm/v2/experienceEvents.d.ts +3 -1
  43. package/dist/npm/v2/experienceEvents.d.ts.map +1 -1
  44. package/dist/npm/v2/index.d.ts +1 -1
  45. package/dist/npm/v2/index.d.ts.map +1 -1
  46. package/dist/npm/v2/liforma-experience.d.ts +2 -0
  47. package/dist/npm/v2/liforma-experience.d.ts.map +1 -1
  48. package/dist/npm/v2/npm.d.ts +1 -1
  49. package/dist/npm/v2/npm.d.ts.map +1 -1
  50. package/dist/npm/v2/sdkRelease.d.ts +3 -0
  51. package/dist/npm/v2/sdkRelease.d.ts.map +1 -0
  52. package/dist/npm/v2/types/sessionInteraction.d.ts +29 -0
  53. package/dist/npm/v2/types/sessionInteraction.d.ts.map +1 -1
  54. package/dist/npm/v2/types/sessionManifest.d.ts +1 -0
  55. package/dist/npm/v2/types/sessionManifest.d.ts.map +1 -1
  56. package/dist/npm/v2/types/sessionManifestSchema.d.ts +17 -0
  57. package/dist/npm/v2/types/sessionManifestSchema.d.ts.map +1 -1
  58. package/dist/npm/widget/mountExperienceWidget.d.ts.map +1 -1
  59. package/dist/npm/widget/types.d.ts +5 -0
  60. package/dist/npm/widget/types.d.ts.map +1 -1
  61. package/dist/react/component/experienceComponentLaunch.d.ts.map +1 -1
  62. package/dist/react/component/experienceComponentRuntime.d.ts +1 -0
  63. package/dist/react/component/experienceComponentRuntime.d.ts.map +1 -1
  64. package/dist/react/component/experienceComponentTypes.d.ts +7 -0
  65. package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
  66. package/dist/react/index.js +977 -642
  67. package/dist/react/index.js.map +1 -1
  68. package/dist/react/react/Experience.d.ts.map +1 -1
  69. package/dist/react/svelte/experienceLoadError.d.ts.map +1 -1
  70. package/dist/react/svelte/experienceLoadErrorStyles.d.ts +1 -1
  71. package/dist/react/svelte/experienceLoadErrorStyles.d.ts.map +1 -1
  72. package/dist/react/v2/api/mintPublicSession.d.ts +1 -0
  73. package/dist/react/v2/api/mintPublicSession.d.ts.map +1 -1
  74. package/dist/react/v2/api/sessionEndpointRequest.d.ts +4 -0
  75. package/dist/react/v2/api/sessionEndpointRequest.d.ts.map +1 -1
  76. package/dist/react/v2/embed/iframeHost.d.ts +13 -1
  77. package/dist/react/v2/embed/iframeHost.d.ts.map +1 -1
  78. package/dist/react/v2/embed/protocol.d.ts +35 -1
  79. package/dist/react/v2/embed/protocol.d.ts.map +1 -1
  80. package/dist/react/v2/experience.d.ts +17 -2
  81. package/dist/react/v2/experience.d.ts.map +1 -1
  82. package/dist/react/v2/experienceEvents.d.ts +3 -1
  83. package/dist/react/v2/experienceEvents.d.ts.map +1 -1
  84. package/dist/react/v2/sdkRelease.d.ts +3 -0
  85. package/dist/react/v2/sdkRelease.d.ts.map +1 -0
  86. package/dist/react/v2/types/sessionInteraction.d.ts +29 -0
  87. package/dist/react/v2/types/sessionInteraction.d.ts.map +1 -1
  88. package/dist/react/v2/types/sessionManifest.d.ts +1 -0
  89. package/dist/react/v2/types/sessionManifest.d.ts.map +1 -1
  90. package/dist/react/widget/mountExperienceWidget.d.ts.map +1 -1
  91. package/dist/react/widget/types.d.ts +5 -0
  92. package/dist/react/widget/types.d.ts.map +1 -1
  93. package/dist/sdk/v2/client.js +2 -2
  94. package/dist/sdk/v2/client.js.map +1 -1
  95. package/dist/svelte/Experience.svelte +6 -0
  96. package/dist/svelte/experienceLoadError.js +37 -15
  97. package/dist/svelte/experienceLoadError.test.js +8 -0
  98. package/dist/svelte/experienceLoadErrorOverlay.js +1 -1
  99. package/dist/svelte/experienceLoadErrorStyles.d.ts +1 -1
  100. package/dist/svelte/experienceLoadErrorStyles.js +1 -0
  101. package/package.json +1 -1
@@ -57,7 +57,10 @@ 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()), l?.attribution && typeof l.attribution == "object" && (v.attribution = l.attribution);
60
+ if (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), l?.alreadyConverted !== void 0) {
61
+ if (!Array.isArray(l.alreadyConverted) || l.alreadyConverted.some((e) => typeof e != "string")) return c({ message: "Invalid alreadyConverted." }, 400);
62
+ l.alreadyConverted.length && (v.alreadyConverted = l.alreadyConverted);
63
+ }
61
64
  let b = i.headers.get("Idempotency-Key")?.trim(), x = await r(`${o}/v1/sessions`, {
62
65
  method: "POST",
63
66
  headers: {
@@ -69,12 +72,23 @@ function v(e = {}) {
69
72
  body: JSON.stringify(v)
70
73
  });
71
74
  if (!x.ok) {
72
- let e = _(x.status), t = "Could not start session.";
75
+ let e = _(x.status), t = "Could not start session.", n = "MINT_FAILED", r = x.headers.get("Liforma-Request-Id")?.trim() || void 0;
73
76
  try {
74
- let e = await x.json();
75
- typeof e.message == "string" && e.message.trim() && (t = e.message);
77
+ let e = await x.json(), i = e.error && typeof e.error == "object" ? e.error : void 0, a = i?.message ?? e.message;
78
+ typeof a == "string" && a.trim() && (t = a.trim());
79
+ let o = i?.code ?? e.code;
80
+ typeof o == "string" && o.trim() && (n = o.trim());
81
+ let s = i?.requestId ?? e.requestId;
82
+ typeof s == "string" && s.trim() && (r = s.trim());
76
83
  } catch {}
77
- return c({ message: t }, e);
84
+ return c({
85
+ message: t,
86
+ error: {
87
+ code: n,
88
+ message: t,
89
+ ...r ? { requestId: r } : {}
90
+ }
91
+ }, e);
78
92
  }
79
93
  let S = await x.json();
80
94
  return new Response(JSON.stringify(S), {
@@ -680,7 +694,8 @@ function ke(e, t) {
680
694
  ...(() => {
681
695
  let e = Ee(t.attribution);
682
696
  return e ? { attribution: e } : {};
683
- })()
697
+ })(),
698
+ ...t.alreadyConverted?.length ? { alreadyConverted: [...t.alreadyConverted] } : {}
684
699
  })
685
700
  }
686
701
  };
@@ -824,7 +839,7 @@ function He(e, t) {
824
839
  let i = Ve(t);
825
840
  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
841
  let a = Ee(t?.attribution);
827
- return a && (n.attribution = a), n;
842
+ return a && (n.attribution = a), t?.alreadyConverted?.length && (n.alreadyConverted = [...t.alreadyConverted]), n;
828
843
  }
829
844
  async function Ue(e, t) {
830
845
  let n = ve(), r = t?.idempotencyKey?.trim(), i = await fetch(`${n}/v1/browser-sessions`, {
@@ -942,7 +957,7 @@ var Qe = new Set([1, 2]);
942
957
  function $e(e) {
943
958
  return typeof e == "number" && Qe.has(e);
944
959
  }
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("."));
960
+ 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.interactionChange".split("."));
946
961
  function tt(e) {
947
962
  if (!e || typeof e != "object") return null;
948
963
  let t = e;
@@ -972,7 +987,7 @@ function tt(e) {
972
987
  function nt(e, t, n) {
973
988
  let r = e.trim();
974
989
  if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
975
- let i = n?.startButton, a = n?.theme, o = n?.showFeedback;
990
+ let i = n?.startButton, a = n?.theme, o = n?.showFeedback, s = n?.interaction;
976
991
  return {
977
992
  type: "launch",
978
993
  schemaVersion: 2,
@@ -981,7 +996,8 @@ function nt(e, t, n) {
981
996
  ...t === void 0 ? {} : { session: t },
982
997
  ...i ? { startButton: i } : {},
983
998
  ...a ? { theme: a } : {},
984
- ...o === void 0 ? {} : { showFeedback: o }
999
+ ...o === void 0 ? {} : { showFeedback: o },
1000
+ ...s ? { interaction: s } : {}
985
1001
  }
986
1002
  };
987
1003
  }
@@ -1168,6 +1184,9 @@ function ft(e) {
1168
1184
  case "fullWindow":
1169
1185
  s(i.payload.active);
1170
1186
  break;
1187
+ case "interactionChange":
1188
+ e.onInteractionChange?.(i.payload.interaction);
1189
+ break;
1171
1190
  }
1172
1191
  };
1173
1192
  if (window.addEventListener("message", x), t.replaceChildren(n), t.clientHeight < 2 && !t.style.minHeight) {
@@ -1414,6 +1433,23 @@ function ft(e) {
1414
1433
  }
1415
1434
  });
1416
1435
  },
1436
+ setInteraction(e) {
1437
+ return C({
1438
+ type: "setInteraction",
1439
+ schemaVersion: 2,
1440
+ payload: {
1441
+ correlationId: Z(),
1442
+ interaction: e
1443
+ }
1444
+ });
1445
+ },
1446
+ getInteraction() {
1447
+ return C({
1448
+ type: "getInteraction",
1449
+ schemaVersion: 2,
1450
+ payload: { correlationId: Z() }
1451
+ });
1452
+ },
1417
1453
  conversion(e) {
1418
1454
  return C({
1419
1455
  type: "conversion",
@@ -1431,6 +1467,21 @@ function ft(e) {
1431
1467
  payload: { correlationId: Z() }
1432
1468
  });
1433
1469
  },
1470
+ reportSdkError(e) {
1471
+ return C({
1472
+ type: "reportSdkError",
1473
+ schemaVersion: 2,
1474
+ payload: {
1475
+ correlationId: Z(),
1476
+ errorCode: e.errorCode,
1477
+ message: e.message,
1478
+ stack: e.stack,
1479
+ severity: e.severity,
1480
+ operation: e.operation,
1481
+ release: e.release
1482
+ }
1483
+ });
1484
+ },
1434
1485
  destroy() {
1435
1486
  if (!r) {
1436
1487
  r = !0, i && s(!1);
@@ -1456,51 +1507,272 @@ function pt(e) {
1456
1507
  };
1457
1508
  }
1458
1509
  //#endregion
1459
- //#region src/v2/shims/embedBaseUrl.ts
1460
- var mt = "https://player.liforma.ai/embed", ht = "http://localhost:3002/embed";
1461
- function gt() {
1510
+ //#region src/v2/sdkRelease.ts
1511
+ var mt = `sdk@${{
1512
+ name: "@liforma/client",
1513
+ version: "0.4.10",
1514
+ type: "module",
1515
+ description: "Liforma browser SDK — Experience sessions, speech API, and Svelte embed component.",
1516
+ license: "MIT",
1517
+ homepage: "https://docs.liforma.ai",
1518
+ repository: {
1519
+ type: "git",
1520
+ url: "git+https://github.com/LiformaLtd/cdn.liforma.ai.git"
1521
+ },
1522
+ bugs: { url: "https://github.com/LiformaLtd/cdn.liforma.ai/issues" },
1523
+ publishConfig: { access: "public" },
1524
+ sideEffects: !1,
1525
+ exports: {
1526
+ ".": {
1527
+ types: "./dist/npm/v2/npm.d.ts",
1528
+ import: "./dist/npm/index.js"
1529
+ },
1530
+ "./svelte": {
1531
+ types: "./dist/svelte/index.d.ts",
1532
+ import: "./dist/svelte/index.js",
1533
+ svelte: "./dist/svelte/index.js"
1534
+ },
1535
+ "./svelte/thumbnail": {
1536
+ types: "./dist/svelte/thumbnail.d.ts",
1537
+ import: "./dist/svelte/thumbnail.js",
1538
+ svelte: "./dist/svelte/thumbnail.js"
1539
+ },
1540
+ "./thumbnail": {
1541
+ types: "./dist/npm/thumbnail/index.d.ts",
1542
+ import: "./dist/npm/thumbnail/index.js"
1543
+ },
1544
+ "./react": {
1545
+ types: "./dist/react/react/index.d.ts",
1546
+ import: "./dist/react/index.js"
1547
+ },
1548
+ "./react/thumbnail": {
1549
+ types: "./dist/react/react/thumbnail.d.ts",
1550
+ import: "./dist/react/thumbnail.js"
1551
+ },
1552
+ "./next": {
1553
+ types: "./dist/next/next/index.d.ts",
1554
+ import: "./dist/next/index.js"
1555
+ },
1556
+ "./next/thumbnail": {
1557
+ types: "./dist/next/next/thumbnail.d.ts",
1558
+ import: "./dist/next/thumbnail.js"
1559
+ },
1560
+ "./byo": {
1561
+ types: "./dist/byo/index.d.ts",
1562
+ import: "./dist/byo/index.js"
1563
+ },
1564
+ "./elevenlabs": {
1565
+ types: "./dist/elevenlabs/index.d.ts",
1566
+ import: "./dist/elevenlabs/index.js"
1567
+ },
1568
+ "./openai": {
1569
+ types: "./dist/openai/index.d.ts",
1570
+ import: "./dist/openai/index.js"
1571
+ },
1572
+ "./deepgram": {
1573
+ types: "./dist/deepgram/index.d.ts",
1574
+ import: "./dist/deepgram/index.js"
1575
+ },
1576
+ "./google": {
1577
+ types: "./dist/google/index.d.ts",
1578
+ import: "./dist/google/index.js"
1579
+ },
1580
+ "./livekit": {
1581
+ types: "./dist/livekit/index.d.ts",
1582
+ import: "./dist/livekit/index.js"
1583
+ }
1584
+ },
1585
+ files: [
1586
+ "dist/npm",
1587
+ "dist/svelte",
1588
+ "dist/react",
1589
+ "dist/next",
1590
+ "dist/byo",
1591
+ "dist/elevenlabs",
1592
+ "dist/openai",
1593
+ "dist/deepgram",
1594
+ "dist/google",
1595
+ "dist/livekit",
1596
+ "dist/sdk",
1597
+ "README.md",
1598
+ "CHANGELOG.md",
1599
+ "LICENSE"
1600
+ ],
1601
+ peerDependencies: {
1602
+ "@elevenlabs/client": ">=1.0.0",
1603
+ "livekit-client": ">=2.0.0",
1604
+ react: "^18.0.0 || ^19.0.0",
1605
+ "react-dom": "^18.0.0 || ^19.0.0",
1606
+ svelte: "^5.0.0"
1607
+ },
1608
+ peerDependenciesMeta: {
1609
+ svelte: { optional: !0 },
1610
+ react: { optional: !0 },
1611
+ "react-dom": { optional: !0 },
1612
+ "@elevenlabs/client": { optional: !0 },
1613
+ "livekit-client": { optional: !0 }
1614
+ },
1615
+ scripts: {
1616
+ build: "npm run build:v2 && npm run build:npm && npm run build:svelte && npm run build:react && npm run build:next && npm run build:byo && npm run build:elevenlabs && npm run build:openai && npm run build:deepgram && npm run build:google && npm run build:livekit && npm run copy:preview",
1617
+ "build:react": "vite build --config vite.config.react.ts && vite build --config vite.config.react-thumbnail.ts && tsc -p tsconfig.react.json",
1618
+ "build:next": "vite build --config vite.config.next.ts && vite build --config vite.config.next-thumbnail.ts && tsc -p tsconfig.next.json",
1619
+ "build:byo": "vite build --config vite.config.byo.ts && tsc -p tsconfig.byo.json",
1620
+ "build:elevenlabs": "vite build --config vite.config.elevenlabs.ts && tsc -p tsconfig.elevenlabs.json",
1621
+ "build:openai": "vite build --config vite.config.openai.ts && tsc -p tsconfig.openai.json",
1622
+ "build:deepgram": "vite build --config vite.config.deepgram.ts && tsc -p tsconfig.deepgram.json",
1623
+ "build:google": "vite build --config vite.config.google.ts && tsc -p tsconfig.google.json",
1624
+ "build:livekit": "vite build --config vite.config.livekit.ts && tsc -p tsconfig.livekit.json",
1625
+ "copy:preview": "mkdir -p dist/preview && cp preview/v2-embed-test.html dist/preview/ && cp preview/v2-embed-test-redirect.html dist/preview/",
1626
+ "build:v2": "vite build --config vite.config.v2.ts && vite build --config vite.config.v2-thumbnail.ts",
1627
+ "build:npm": "vite build --config vite.config.npm.ts && vite build --config vite.config.thumbnail.ts && tsc -p tsconfig.npm.json",
1628
+ "build:svelte": "svelte-package -i src/svelte -o dist/svelte && vite build --config vite.config.svelte.ts",
1629
+ "check:consumer": "svelte-check --workspace test/consumer --tsconfig ./tsconfig.json",
1630
+ test: "vitest run",
1631
+ preview: "node scripts/preview-local.mjs",
1632
+ "dev:sdk": "npm run build:v2 && npm run copy:preview && npm run preview",
1633
+ dev: "npm run build && npm run preview",
1634
+ "publish:sdk": "node scripts/publish-sdk.mjs",
1635
+ "publish:npm": "node scripts/publish-npm.mjs",
1636
+ "publish:avatar": "node scripts/publish-avatar.mjs",
1637
+ "publish:avatars-dist": "node scripts/publish-avatars.mjs",
1638
+ "publish:avatars": "node scripts/republish-avatars.mjs",
1639
+ "build:avatars": "node scripts/build-avatars.mjs",
1640
+ "republish:avatars": "node scripts/republish-avatars.mjs",
1641
+ "catalogue:avatars": "node ../labs.liforma.ai/scripts/generate-avatar-index.mjs",
1642
+ "verify:avatars-dist": "node scripts/verify-avatars-dist.mjs",
1643
+ "verify:avatar-pack": "node scripts/verify-avatar-pack.mjs",
1644
+ "repair:render-plate-metadata": "node scripts/repair-render-plate-metadata.mjs",
1645
+ "verify:render-plate-crop": "node scripts/verify-render-plate-crop.mjs",
1646
+ "migrate:avatar-render-prep": "npm run migrate:avatar-render-prep --prefix ../labs.liforma.ai --",
1647
+ "convert:avatar-teeth": "node scripts/convert-avatar-teeth-webp.mjs",
1648
+ "warm:avatar-composites": "node scripts/warm-avatar-composites.mjs",
1649
+ "test:compose-costume": "node scripts/test-compose-costume-layers.mjs",
1650
+ "test:compose-costume-wasm": "node scripts/test-compose-costume-wasm.mjs",
1651
+ "test:parse-composite-filename": "node scripts/test-parse-composite-filename.mjs",
1652
+ "test:avatar-composite-rendered-path": "node scripts/test-avatar-composite-rendered-path.mjs",
1653
+ "test:avatar-compose-worker-cors": "node scripts/test-avatar-compose-worker-cors.mjs",
1654
+ "test:experience-thumb-url": "node scripts/test-experience-thumb-url.mjs",
1655
+ "test:compose-experience-thumb": "node scripts/test-compose-experience-thumb.mjs",
1656
+ "test:location-depth-paths": "node scripts/test-location-depth-paths.mjs",
1657
+ "test:location-binary-assets": "node scripts/test-location-binary-assets.mjs",
1658
+ "test:location-da3-depth": "node scripts/test-location-da3-depth.mjs",
1659
+ "test:location-interactions": "node scripts/test-location-interactions.mjs",
1660
+ "test:render-plate-chroma-key": "node scripts/test-render-plate-chroma-key.mjs",
1661
+ "test:sparse-plate": "node scripts/test-sparse-plate.mjs",
1662
+ "test:face-meshes-publish-depth": "node scripts/test-face-meshes-publish-depth.mjs",
1663
+ "test:avatar-avif-sibling": "node scripts/test-avatar-avif-sibling.mjs",
1664
+ "test:screen-chroma-key": "node scripts/test-screen-chroma-key.mjs",
1665
+ "pull:sources": "node scripts/sync-authoring-sources.mjs",
1666
+ "push:sources": "node scripts/sync-authoring-sources.mjs",
1667
+ "catalogue:locations": "node scripts/catalogue-locations.mjs",
1668
+ "generate:location-interactions": "node scripts/generate-location-interactions.mjs",
1669
+ "generate:location-depth": "node scripts/generate-location-depth.mjs",
1670
+ "generate:location-depth16-da3": "node scripts/generate-location-depth16-da3.mjs",
1671
+ "generate:location-discontinuities": "node scripts/generate-location-discontinuities.mjs",
1672
+ "build:locations": "node scripts/build-locations.mjs",
1673
+ "publish:locations": "node scripts/publish-locations.mjs",
1674
+ "verify:locations": "node scripts/verify-location-sources.mjs",
1675
+ "publish:models": "node scripts/publish-models.mjs",
1676
+ "publish:models:krea-int8": "node scripts/_upload-model-prefix.mjs text-to-image/lf-t2i-turbo-int8",
1677
+ "publish:models:ltx-int8": "node scripts/_upload-model-prefix.mjs text-to-video/lf-t2v-distill-int8",
1678
+ "publish:models:video-omni": "node scripts/_upload-model-prefix.mjs text-to-video/lf-video-omni-v1",
1679
+ "fetch:depth-anything-v2": "node scripts/fetch-depth-anything-v2.mjs",
1680
+ "fetch:video-depth-anything": "node scripts/fetch-video-depth-anything.mjs",
1681
+ "fetch:depth-pro": "node scripts/fetch-depth-pro.mjs",
1682
+ "fetch:face-landmarker": "node scripts/fetch-face-landmarker.mjs",
1683
+ "fetch:anime-face-detector": "node scripts/fetch-anime-face-detector.mjs",
1684
+ "fetch:face-parsing": "node scripts/fetch-face-parsing.mjs",
1685
+ "fetch:vitmatte": "node scripts/fetch-vitmatte.mjs",
1686
+ "fetch:liveportrait-mlx": "node scripts/fetch-liveportrait-mlx.mjs",
1687
+ "fetch:wav2vec-phoneme-ctc": "node scripts/fetch-wav2vec-phoneme-ctc.mjs",
1688
+ "fetch:lf-sta": "node scripts/fetch-wav2vec-phoneme-ctc.mjs",
1689
+ "fetch:supertonic-3": "node scripts/fetch-supertonic-3.mjs",
1690
+ "fetch:lf-tts": "node scripts/fetch-supertonic-3.mjs",
1691
+ "fetch:lf-t2i-turbo": "python3 ../tools/krea-2-salad/scripts/fetch_cdn_snapshot.py",
1692
+ "fetch:models": "npm run fetch:depth-anything-v2 && npm run fetch:video-depth-anything && npm run fetch:depth-pro && npm run fetch:face-landmarker && npm run fetch:anime-face-detector && npm run fetch:face-parsing && npm run fetch:vitmatte && npm run fetch:lf-sta && npm run fetch:lf-tts",
1693
+ locations: "npm run catalogue:locations && npm run build:locations",
1694
+ "configure:cors": "node scripts/configure-r2-cors.mjs",
1695
+ "verify:cors": "node scripts/verify-cdn-cors.mjs",
1696
+ "deploy:worker:avatar-compose": "node scripts/deploy-avatar-compose-worker.mjs",
1697
+ "deploy:worker:experience-thumb": "node scripts/deploy-experience-thumb-worker.mjs",
1698
+ deploy: "npm run build && npm run publish:sdk",
1699
+ verify: "npm run build && node scripts/check-sdk-size.mjs && node scripts/verify-thumbnail-light.mjs && node scripts/test-embed-protocol.mjs && node scripts/test-manifest-embed-url.mjs && node scripts/test-player-reachability.mjs && node scripts/test-session-endpoint.mjs && node scripts/verify-package.mjs",
1700
+ "preview:test": "npm run build && npm run preview"
1701
+ },
1702
+ dependencies: {
1703
+ "@jsquash/webp": "^1.5.0",
1704
+ zod: "^4.4.3"
1705
+ },
1706
+ devDependencies: {
1707
+ "@aws-sdk/client-s3": "^3.1000.0",
1708
+ "@aws-sdk/lib-storage": "^3.1110.0",
1709
+ "@elevenlabs/client": "^1.17.0",
1710
+ "@sveltejs/package": "^2.5.8",
1711
+ "@sveltejs/vite-plugin-svelte": "^7.0.0",
1712
+ "@testing-library/react": "^16.3.0",
1713
+ "@testing-library/svelte": "^5.4.2",
1714
+ "@types/node": "^25.9.3",
1715
+ "@types/react": "^19.1.12",
1716
+ "@types/react-dom": "^19.1.9",
1717
+ "@vitejs/plugin-react": "^5.0.2",
1718
+ "@webgpu/types": "^0.1.70",
1719
+ dotenv: "^17.2.3",
1720
+ jsdom: "^30.0.1",
1721
+ "livekit-client": "^2.21.0",
1722
+ react: "^19.1.1",
1723
+ "react-dom": "^19.1.1",
1724
+ sharp: "^0.34.2",
1725
+ svelte: "^5.55.2",
1726
+ "svelte-check": "^4.7.4",
1727
+ typescript: "^6.0.3",
1728
+ vite: "^8.0.16",
1729
+ vitest: "^4.1.10",
1730
+ wrangler: "^4.101.0"
1731
+ }
1732
+ }.version}`, ht = "https://player.liforma.ai/embed", gt = "http://localhost:3002/embed";
1733
+ function _t() {
1462
1734
  let e = globalThis.__LIFORMA_PLAYER_EMBED_URL;
1463
1735
  if (e?.trim()) return e.trim().replace(/\/$/, "");
1464
1736
  if (typeof document > "u") return null;
1465
1737
  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();
1466
1738
  return t ? t.replace(/\/$/, "") : null;
1467
1739
  }
1468
- function _t() {
1469
- let e = gt();
1470
- return e ? e.endsWith("/embed") ? e : `${e}/embed` : T() ? ht : mt;
1740
+ function vt() {
1741
+ let e = _t();
1742
+ return e ? e.endsWith("/embed") ? e : `${e}/embed` : T() ? gt : ht;
1471
1743
  }
1472
- function vt(e, t) {
1744
+ function yt(e, t) {
1473
1745
  return e?.trim() || t?.trim() || void 0;
1474
1746
  }
1475
- function yt(e, t, n, r, i, a, o, s) {
1476
- let c = (e ?? _t()).replace(/\/$/, ""), l = c.endsWith("/embed") ? c : `${c}/embed`, u = new URL(l), d = n?.trim();
1747
+ function bt(e, t, n, r, i, a, o, s) {
1748
+ let c = (e ?? vt()).replace(/\/$/, ""), l = c.endsWith("/embed") ? c : `${c}/embed`, u = new URL(l), d = n?.trim();
1477
1749
  d && (u.searchParams.set("backdropId", d), u.searchParams.set("locationId", d));
1478
1750
  let f = r?.trim();
1479
- 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());
1751
+ 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)), xt(u.toString());
1480
1752
  }
1481
- function bt(e) {
1753
+ function xt(e) {
1482
1754
  if (typeof location > "u") return e;
1483
1755
  let t = new URL(e);
1484
1756
  return t.searchParams.set("parentOrigin", location.origin), t.toString();
1485
1757
  }
1486
- function xt(e) {
1758
+ function St(e) {
1487
1759
  return new URL(e).origin;
1488
1760
  }
1489
1761
  //#endregion
1490
1762
  //#region src/v2/experienceEvents.ts
1491
- function St() {
1763
+ function Ct() {
1492
1764
  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)}`;
1493
1765
  }
1494
- function Ct(e, t, n) {
1766
+ function wt(e, t, n) {
1495
1767
  return {
1496
- id: St(),
1768
+ id: Ct(),
1497
1769
  type: e,
1498
1770
  sessionId: t,
1499
1771
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1500
1772
  data: n
1501
1773
  };
1502
1774
  }
1503
- function wt() {
1775
+ function Tt() {
1504
1776
  return {
1505
1777
  ready: /* @__PURE__ */ new Set(),
1506
1778
  started: /* @__PURE__ */ new Set(),
@@ -1515,44 +1787,45 @@ function wt() {
1515
1787
  message: /* @__PURE__ */ new Set(),
1516
1788
  listeningState: /* @__PURE__ */ new Set(),
1517
1789
  activityChange: /* @__PURE__ */ new Set(),
1790
+ interactionChange: /* @__PURE__ */ new Set(),
1518
1791
  feedback: /* @__PURE__ */ new Set(),
1519
1792
  feedbackFailed: /* @__PURE__ */ new Set(),
1520
1793
  conversationProcessorError: /* @__PURE__ */ new Set()
1521
1794
  };
1522
1795
  }
1523
- function Tt(e, t, n) {
1796
+ function Et(e, t, n) {
1524
1797
  return e[t].add(n), () => e[t].delete(n);
1525
1798
  }
1526
- function Et(e, t, n) {
1799
+ function Dt(e, t, n) {
1527
1800
  for (let r of e[t]) r(n);
1528
1801
  }
1529
- function Dt(e) {
1802
+ function Ot(e) {
1530
1803
  for (let t of Object.keys(e)) e[t].clear();
1531
1804
  }
1532
1805
  //#endregion
1533
1806
  //#region src/v2/speech/types.ts
1534
- function Ot(e) {
1807
+ function kt(e) {
1535
1808
  return "data" in e && "format" in e && e.format != null && !("track" in e);
1536
1809
  }
1537
- function kt(e) {
1810
+ function At(e) {
1538
1811
  return "url" in e && typeof e.url == "string";
1539
1812
  }
1540
- function At(e) {
1813
+ function jt(e) {
1541
1814
  if (!("track" in e)) return !1;
1542
1815
  let t = e.track;
1543
1816
  return typeof t != "object" || !t ? !1 : typeof MediaStreamTrack < "u" && t instanceof MediaStreamTrack ? !0 : "kind" in t && "readyState" in t;
1544
1817
  }
1545
- function jt(e) {
1546
- return !Ot(e) && !kt(e) && !At(e) && "encoding" in e && typeof e.encoding == "string";
1818
+ function Mt(e) {
1819
+ return !kt(e) && !At(e) && !jt(e) && "encoding" in e && typeof e.encoding == "string";
1547
1820
  }
1548
- var Mt = [
1821
+ var Nt = [
1549
1822
  8e3,
1550
1823
  16e3,
1551
1824
  22050,
1552
1825
  24e3,
1553
1826
  44100,
1554
1827
  48e3
1555
- ], Nt = {
1828
+ ], Pt = {
1556
1829
  MAX_CHUNK_BYTES: 64 * 1024,
1557
1830
  RECOMMENDED_CHUNK_MS_MIN: 20,
1558
1831
  RECOMMENDED_CHUNK_MS_MAX: 200,
@@ -1563,14 +1836,14 @@ var Mt = [
1563
1836
  MAX_UTTERANCE_DURATION_MS: 9e4,
1564
1837
  MAX_PENDING_WRITES: 8,
1565
1838
  DEFAULT_WRITE_TIMEOUT_MS: 5e3
1566
- }, Pt = class extends Error {
1839
+ }, Ft = class extends Error {
1567
1840
  operation;
1568
1841
  requiredCapability;
1569
1842
  name = "UnsupportedSpeechOperationError";
1570
1843
  constructor(e, t) {
1571
1844
  super(`Speech operation "${e}" requires capability "${t}".`), this.operation = e, this.requiredCapability = t;
1572
1845
  }
1573
- }, Ft = class extends Error {
1846
+ }, It = class extends Error {
1574
1847
  name = "SpeechUtteranceClosedError";
1575
1848
  constructor(e = "Cannot write to a closed or cancelled speech utterance.") {
1576
1849
  super(e);
@@ -1580,72 +1853,72 @@ var Mt = [
1580
1853
  constructor(e, t) {
1581
1854
  super(e, t);
1582
1855
  }
1583
- }, It = class extends Error {
1856
+ }, Lt = class extends Error {
1584
1857
  name = "SpeechBufferTimeoutError";
1585
1858
  constructor(e = "Timed out waiting for speech buffer capacity.") {
1586
1859
  super(e);
1587
1860
  }
1588
1861
  };
1589
- function Lt(e = "none") {
1862
+ function Rt(e = "none") {
1590
1863
  return {
1591
1864
  mode: e,
1592
1865
  trackedDurationMs: 0,
1593
1866
  fallbackDurationMs: 0
1594
1867
  };
1595
1868
  }
1596
- function Rt(e) {
1597
- return Mt.includes(e);
1598
- }
1599
1869
  function zt(e) {
1870
+ return Nt.includes(e);
1871
+ }
1872
+ function Bt(e) {
1600
1873
  if (e.encoding !== "pcm_s16le") throw new Q(`Unsupported audio encoding: ${e.encoding}`);
1601
1874
  if (e.channels !== 1) throw new Q(`Unsupported channel count: ${e.channels}`);
1602
- if (!Rt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1875
+ if (!zt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1603
1876
  }
1604
- function Bt(e) {
1605
- if (Ot(e)) {
1606
- zt(e.format);
1877
+ function Vt(e) {
1878
+ if (kt(e)) {
1879
+ Bt(e.format);
1607
1880
  return;
1608
1881
  }
1609
- if (kt(e)) {
1882
+ if (At(e)) {
1610
1883
  if (!e.url.trim()) throw new Q("Audio URL must be non-empty.");
1611
- if (e.sampleRate !== void 0 && !Rt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1884
+ if (e.sampleRate !== void 0 && !zt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1612
1885
  return;
1613
1886
  }
1614
- if (At(e)) {
1887
+ if (jt(e)) {
1615
1888
  if (e.track.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
1616
- if (e.sampleRate !== void 0 && !Rt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1889
+ if (e.sampleRate !== void 0 && !zt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1617
1890
  return;
1618
1891
  }
1619
- if (jt(e)) {
1892
+ if (Mt(e)) {
1620
1893
  let t = e.encoding.trim().toLowerCase();
1621
1894
  if (!t) throw new Q("Encoded audio MIME type is required.");
1622
1895
  if (t === "pcm_s16le") throw new Q("Use format: { encoding: \"pcm_s16le\", … } for raw PCM.");
1623
- if (e.sampleRate !== void 0 && !Rt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1896
+ if (e.sampleRate !== void 0 && !zt(e.sampleRate)) throw new Q(`Unsupported sample rate: ${e.sampleRate}`);
1624
1897
  return;
1625
1898
  }
1626
1899
  throw new Q("Unsupported speech.play audio shape.");
1627
1900
  }
1628
- function Vt(e) {
1629
- if (e.format) return zt(e.format), e.format;
1901
+ function Ht(e) {
1902
+ if (e.format) return Bt(e.format), e.format;
1630
1903
  if (e.track) {
1631
1904
  let t = {
1632
1905
  encoding: "pcm_s16le",
1633
1906
  sampleRate: e.sampleRate ?? 24e3,
1634
1907
  channels: 1
1635
1908
  };
1636
- return zt(t), t;
1909
+ return Bt(t), t;
1637
1910
  }
1638
1911
  throw new Q("createUtterance requires format or track.");
1639
1912
  }
1640
- function Ht(e) {
1913
+ function Ut(e) {
1641
1914
  return e instanceof Uint8Array ? e : new Uint8Array(e);
1642
1915
  }
1643
- function Ut(e) {
1916
+ function Wt(e) {
1644
1917
  return e === "replace-active" || e === "replace-all" ? "interrupt" : "enqueue";
1645
1918
  }
1646
1919
  //#endregion
1647
1920
  //#region src/byo/pcm.ts
1648
- function Wt(e) {
1921
+ function Gt(e) {
1649
1922
  let t = new Uint8Array(e.length * 2), n = new DataView(t.buffer);
1650
1923
  for (let t = 0; t < e.length; t++) {
1651
1924
  let r = Math.max(-1, Math.min(1, e[t]));
@@ -1655,11 +1928,11 @@ function Wt(e) {
1655
1928
  }
1656
1929
  //#endregion
1657
1930
  //#region src/byo/resample.ts
1658
- function Gt(e, t, n, r, i) {
1931
+ function Kt(e, t, n, r, i) {
1659
1932
  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;
1660
1933
  return ((a * i + o) * i + s) * i + c;
1661
1934
  }
1662
- function Kt(e, t) {
1935
+ function qt(e, t) {
1663
1936
  if (!(e > 0) || !(t > 0)) throw Error("Resampler rates must be positive");
1664
1937
  if (e === t) return {
1665
1938
  fromRate: e,
@@ -1682,7 +1955,7 @@ function Kt(e, t) {
1682
1955
  let a = [];
1683
1956
  for (; i + 2 < r.length - 1;) {
1684
1957
  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);
1685
- a.push(Gt(r[o], r[e], r[s], r[c], t)), i += n;
1958
+ a.push(Kt(r[o], r[e], r[s], r[c], t)), i += n;
1686
1959
  }
1687
1960
  let o = Math.max(0, Math.floor(i) - 1);
1688
1961
  return o > 0 && (r = r.subarray(o), i -= o), a.length ? Float32Array.from(a) : new Float32Array();
@@ -1694,7 +1967,7 @@ function Kt(e, t) {
1694
1967
  }
1695
1968
  //#endregion
1696
1969
  //#region src/byo/audioCapture.ts
1697
- var qt = "liforma-pcm-capture", Jt = `
1970
+ var Jt = "liforma-pcm-capture", Yt = `
1698
1971
  class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
1699
1972
  process(inputs) {
1700
1973
  const ch = inputs[0] && inputs[0][0];
@@ -1706,29 +1979,29 @@ class LiformaPcmCaptureProcessor extends AudioWorkletProcessor {
1706
1979
  return true;
1707
1980
  }
1708
1981
  }
1709
- registerProcessor('${qt}', LiformaPcmCaptureProcessor);
1710
- `, Yt = null;
1711
- function Xt() {
1712
- return Yt ||= URL.createObjectURL(new Blob([Jt], { type: "application/javascript" })), Yt;
1713
- }
1982
+ registerProcessor('${Jt}', LiformaPcmCaptureProcessor);
1983
+ `, Xt = null;
1714
1984
  function Zt() {
1985
+ return Xt ||= URL.createObjectURL(new Blob([Yt], { type: "application/javascript" })), Xt;
1986
+ }
1987
+ function Qt() {
1715
1988
  return window.AudioContext || window.webkitAudioContext || null;
1716
1989
  }
1717
- async function Qt(e) {
1718
- let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Zt();
1990
+ async function $t(e) {
1991
+ let { mediaStream: t, targetSampleRate: n, onPcm: r, shouldSend: i, onLog: a } = e, o = Qt();
1719
1992
  if (!o) throw Error("Web Audio is required for audio capture");
1720
1993
  let s = new o(), c = s.createMediaStreamSource(t), l = s.createGain();
1721
1994
  l.gain.value = 0;
1722
- let u = s.sampleRate, d = Kt(u, n), f = !1, p = !1, m = (e) => {
1995
+ let u = s.sampleRate, d = qt(u, n), f = !1, p = !1, m = (e) => {
1723
1996
  if (f || i && !i()) return;
1724
1997
  let t = d.push(e);
1725
- t.length !== 0 && r(Wt(t));
1998
+ t.length !== 0 && r(Gt(t));
1726
1999
  }, h = () => void 0;
1727
2000
  return await (async () => {
1728
2001
  if (typeof s.audioWorklet?.addModule != "function") return !1;
1729
2002
  try {
1730
- await s.audioWorklet.addModule(Xt());
1731
- let e = new AudioWorkletNode(s, qt, {
2003
+ await s.audioWorklet.addModule(Zt());
2004
+ let e = new AudioWorkletNode(s, Jt, {
1732
2005
  numberOfInputs: 1,
1733
2006
  numberOfOutputs: 1,
1734
2007
  outputChannelCount: [1]
@@ -1778,7 +2051,7 @@ async function Qt(e) {
1778
2051
  }
1779
2052
  //#endregion
1780
2053
  //#region src/v2/speech/captureMediaStreamTrack.ts
1781
- async function $t(e) {
2054
+ async function en(e) {
1782
2055
  let { track: t, utterance: n, sampleRate: r, signal: i } = e;
1783
2056
  if (typeof MediaStreamTrack > "u" || !(t instanceof MediaStreamTrack)) throw new Q("MediaStreamTrack is not available in this environment.");
1784
2057
  if (t.kind !== "audio") throw new Q("speech.play track must be an audio MediaStreamTrack.");
@@ -1787,18 +2060,18 @@ async function $t(e) {
1787
2060
  s || (s = !0, c?.stop(), c = null);
1788
2061
  };
1789
2062
  try {
1790
- c = await Qt({
2063
+ c = await $t({
1791
2064
  mediaStream: a,
1792
2065
  targetSampleRate: r,
1793
2066
  shouldSend: () => !s && !i?.aborted,
1794
2067
  onPcm: (e) => {
1795
2068
  if (s || i?.aborted) return;
1796
- let t = Ht(e);
2069
+ let t = Ut(e);
1797
2070
  o = o.then(async () => {
1798
2071
  if (s || i?.aborted) return;
1799
2072
  let e = 0;
1800
2073
  for (; e < t.byteLength;) {
1801
- let r = Math.min(e + Nt.MAX_CHUNK_BYTES, t.byteLength);
2074
+ let r = Math.min(e + Pt.MAX_CHUNK_BYTES, t.byteLength);
1802
2075
  if ((r - e) % 2 == 1 && --r, r <= e) break;
1803
2076
  let i = t.subarray(e, r);
1804
2077
  e = r, i.byteLength !== 0 && await n.write(i);
@@ -1822,10 +2095,10 @@ async function $t(e) {
1822
2095
  }
1823
2096
  //#endregion
1824
2097
  //#region src/v2/speech/speechController.ts
1825
- async function en(e, t) {
1826
- if (At(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
1827
- if (Ot(e)) {
1828
- let t = Ht(e.data);
2098
+ async function tn(e, t) {
2099
+ if (jt(e)) throw new Q("MediaStreamTrack play is handled on the host before embed.");
2100
+ if (kt(e)) {
2101
+ let t = Ut(e.data);
1829
2102
  if (t.byteLength & 1) throw new Q("PCM byte length must be even.");
1830
2103
  return {
1831
2104
  kind: "pcm",
@@ -1833,17 +2106,17 @@ async function en(e, t) {
1833
2106
  format: e.format
1834
2107
  };
1835
2108
  }
1836
- if (kt(e)) return {
2109
+ if (At(e)) return {
1837
2110
  kind: "url",
1838
2111
  url: e.url.trim(),
1839
2112
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
1840
2113
  };
1841
- if (!jt(e)) throw new Q("Unsupported speech.play audio shape.");
2114
+ if (!Mt(e)) throw new Q("Unsupported speech.play audio shape.");
1842
2115
  let n;
1843
2116
  if (typeof Blob < "u" && e.data instanceof Blob) {
1844
2117
  if (t?.aborted) throw new DOMException("Play aborted.", "AbortError");
1845
2118
  n = new Uint8Array(await e.data.arrayBuffer());
1846
- } else n = Ht(e.data);
2119
+ } else n = Ut(e.data);
1847
2120
  return {
1848
2121
  kind: "encoded",
1849
2122
  data: n.slice().buffer,
@@ -1851,10 +2124,10 @@ async function en(e, t) {
1851
2124
  ...e.sampleRate === void 0 ? {} : { sampleRate: e.sampleRate }
1852
2125
  };
1853
2126
  }
1854
- function tn() {
2127
+ function nn() {
1855
2128
  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)}`;
1856
2129
  }
1857
- function nn(e, t = "completed") {
2130
+ function rn(e, t = "completed") {
1858
2131
  return {
1859
2132
  utteranceId: e.speechId,
1860
2133
  characterId: e.characterId,
@@ -1868,13 +2141,13 @@ function nn(e, t = "completed") {
1868
2141
  }
1869
2142
  };
1870
2143
  }
1871
- function rn(e) {
2144
+ function an(e) {
1872
2145
  return e instanceof Error ? e : new Q(String(e));
1873
2146
  }
1874
- function an(e) {
2147
+ function on(e) {
1875
2148
  return e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError";
1876
2149
  }
1877
- var on = class {
2150
+ var sn = class {
1878
2151
  id;
1879
2152
  characterId;
1880
2153
  result;
@@ -1903,29 +2176,29 @@ var on = class {
1903
2176
  queue: e.queue,
1904
2177
  ...e.transcript === void 0 ? {} : { transcript: e.transcript }
1905
2178
  }).catch((e) => {
1906
- throw this.fail(rn(e)), rn(e);
2179
+ throw this.fail(an(e)), an(e);
1907
2180
  }), this.signal?.addEventListener("abort", () => {
1908
2181
  this.cancel();
1909
2182
  }, { once: !0 });
1910
2183
  }
1911
2184
  async write(e, t) {
1912
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new Ft();
1913
- let n = Ht(e);
2185
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new It();
2186
+ let n = Ut(e);
1914
2187
  if (n.byteLength & 1) throw new Q("PCM chunk byte length must be even (complete s16 samples).");
1915
- if (n.byteLength > Nt.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${Nt.MAX_CHUNK_BYTES}).`);
2188
+ if (n.byteLength > Pt.MAX_CHUNK_BYTES) throw new Q(`PCM chunk exceeds MAX_CHUNK_BYTES (${Pt.MAX_CHUNK_BYTES}).`);
1916
2189
  if (n.byteLength === 0) return;
1917
- let r = t?.timeoutMs ?? Nt.DEFAULT_WRITE_TIMEOUT_MS;
2190
+ let r = t?.timeoutMs ?? Pt.DEFAULT_WRITE_TIMEOUT_MS;
1918
2191
  await this.acquireWriteSlot(r);
1919
2192
  let i = n.byteLength / 2 / this.sampleRate * 1e3;
1920
- if (this.bufferedMs + i > Nt.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
2193
+ if (this.bufferedMs + i > Pt.MAX_UTTERANCE_DURATION_MS) throw this.releaseWriteSlot(), new Q("Utterance exceeds MAX_UTTERANCE_DURATION_MS.");
1921
2194
  let a = async () => {
1922
- if (this.closed || this.settled) throw new Ft();
2195
+ if (this.closed || this.settled) throw new It();
1923
2196
  let e = this.requireHost(), t = n.slice(), i = e.speechUtteranceWrite({
1924
2197
  utteranceId: this.id,
1925
2198
  audio: t.buffer,
1926
2199
  byteLength: t.byteLength
1927
2200
  }), a = await Promise.race([i, new Promise((e, t) => {
1928
- setTimeout(() => t(new It()), r);
2201
+ setTimeout(() => t(new Lt()), r);
1929
2202
  })]);
1930
2203
  this.bufferedMs = Math.max(0, a.bufferedMs);
1931
2204
  }, o = this.writeChain.then(a, a);
@@ -1937,7 +2210,7 @@ var on = class {
1937
2210
  }
1938
2211
  }
1939
2212
  async setTranscript(e) {
1940
- if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new Ft();
2213
+ if (this.closed || this.settled || (await this.beginPromise.catch(() => void 0), this.closed || this.settled)) throw new It();
1941
2214
  await this.requireHost().speechUtteranceSetTranscript({
1942
2215
  utteranceId: this.id,
1943
2216
  transcript: e
@@ -1954,7 +2227,7 @@ var on = class {
1954
2227
  });
1955
2228
  return this.resolve(t), t;
1956
2229
  } catch (e) {
1957
- let t = rn(e);
2230
+ let t = an(e);
1958
2231
  throw this.fail(t), t;
1959
2232
  }
1960
2233
  }
@@ -1972,11 +2245,11 @@ var on = class {
1972
2245
  characterId: this.characterId,
1973
2246
  status: "cancelled",
1974
2247
  durationMs: 0,
1975
- animation: Lt("none")
2248
+ animation: Rt("none")
1976
2249
  };
1977
2250
  return this.resolve(t), t;
1978
2251
  } catch (e) {
1979
- let t = rn(e);
2252
+ let t = an(e);
1980
2253
  throw this.fail(t), t;
1981
2254
  }
1982
2255
  }
@@ -1989,19 +2262,19 @@ var on = class {
1989
2262
  return e;
1990
2263
  }
1991
2264
  resolve(e) {
1992
- this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new Ft()));
2265
+ this.settled || (this.settled = !0, this.settleResolve(Object.freeze(e)), this.flushWriteWaiters(new It()));
1993
2266
  }
1994
2267
  fail(e) {
1995
2268
  this.settled || (this.settled = !0, this.settleReject(e), this.flushWriteWaiters(e));
1996
2269
  }
1997
2270
  async acquireWriteSlot(e) {
1998
- if (this.pendingWriteCount < Nt.MAX_PENDING_WRITES) {
2271
+ if (this.pendingWriteCount < Pt.MAX_PENDING_WRITES) {
1999
2272
  this.pendingWriteCount += 1;
2000
2273
  return;
2001
2274
  }
2002
2275
  await new Promise((t, n) => {
2003
2276
  let r = setTimeout(() => {
2004
- n(new It());
2277
+ n(new Lt());
2005
2278
  }, e);
2006
2279
  this.pendingWriteWaiters.push({
2007
2280
  resolve: () => {
@@ -2020,13 +2293,13 @@ var on = class {
2020
2293
  for (; this.pendingWriteWaiters.length > 0;) this.pendingWriteWaiters.shift()?.reject(e);
2021
2294
  }
2022
2295
  };
2023
- function sn(e) {
2296
+ function cn(e) {
2024
2297
  let t = null, n = (t, n) => {
2025
- if (!e.getCapabilities()[n]) throw new Pt(t, n);
2298
+ if (!e.getCapabilities()[n]) throw new Ft(t, n);
2026
2299
  }, r = {
2027
2300
  async speak(r) {
2028
2301
  if (e.assertSessionStarted(), n("speak", "textSpeech"), r.signal?.aborted) throw new DOMException("Speak aborted.", "AbortError");
2029
- let i = Ut(r.queue ?? "append");
2302
+ let i = Wt(r.queue ?? "append");
2030
2303
  i === "interrupt" && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null));
2031
2304
  let a = e.getIframeHost();
2032
2305
  if (!a) throw new Q("Speech session is not attached.");
@@ -2046,41 +2319,41 @@ function sn(e) {
2046
2319
  return;
2047
2320
  }
2048
2321
  t.addEventListener("abort", s, { once: !0 }), o.then((e) => {
2049
- t.removeEventListener("abort", s), n(nn(e, "completed"));
2322
+ t.removeEventListener("abort", s), n(rn(e, "completed"));
2050
2323
  }, (a) => {
2051
- if (t.removeEventListener("abort", s), an(a)) {
2324
+ if (t.removeEventListener("abort", s), on(a)) {
2052
2325
  n({
2053
2326
  utteranceId: "utt_interrupted",
2054
2327
  characterId: r.characterId ?? e.getActiveCharacterId(),
2055
2328
  status: "interrupted",
2056
2329
  durationMs: 0,
2057
2330
  transcript: r.text,
2058
- animation: Lt("none")
2331
+ animation: Rt("none")
2059
2332
  });
2060
2333
  return;
2061
2334
  }
2062
- i(rn(a));
2335
+ i(an(a));
2063
2336
  });
2064
2337
  });
2065
2338
  }
2066
2339
  try {
2067
- return nn(await o, "completed");
2340
+ return rn(await o, "completed");
2068
2341
  } catch (t) {
2069
- if (an(t)) return {
2342
+ if (on(t)) return {
2070
2343
  utteranceId: "utt_interrupted",
2071
2344
  characterId: r.characterId ?? e.getActiveCharacterId(),
2072
2345
  status: "interrupted",
2073
2346
  durationMs: 0,
2074
2347
  transcript: r.text,
2075
- animation: Lt("none")
2348
+ animation: Rt("none")
2076
2349
  };
2077
- throw rn(t);
2350
+ throw an(t);
2078
2351
  }
2079
2352
  },
2080
2353
  async play(i) {
2081
- if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), Bt(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
2354
+ if (e.assertSessionStarted(), n("play", "externalSpeechAudio"), Vt(i.audio), i.signal?.aborted) throw new DOMException("Play aborted.", "AbortError");
2082
2355
  let a = i.queue ?? "append";
2083
- if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), At(i.audio)) {
2356
+ if ((a === "replace-active" || a === "replace-all") && (e.onProcessorInterrupt?.(), t &&= (t.cancel(), null)), jt(i.audio)) {
2084
2357
  let e = i.audio.sampleRate ?? 24e3;
2085
2358
  return r.createUtterance({
2086
2359
  format: {
@@ -2096,7 +2369,7 @@ function sn(e) {
2096
2369
  }
2097
2370
  let o = e.getIframeHost();
2098
2371
  if (!o) throw new Q("Speech session is not attached.");
2099
- let s = await en(i.audio, i.signal);
2372
+ let s = await tn(i.audio, i.signal);
2100
2373
  return o.speechPlay({
2101
2374
  source: s,
2102
2375
  characterId: i.characterId,
@@ -2108,13 +2381,13 @@ function sn(e) {
2108
2381
  },
2109
2382
  createUtterance(r) {
2110
2383
  e.assertSessionStarted(), n("createUtterance", "externalSpeechAudio");
2111
- let i = Vt(r);
2384
+ let i = Ht(r);
2112
2385
  if (r.track && r.track.kind !== "audio") throw new Q("createUtterance track must be an audio MediaStreamTrack.");
2113
2386
  let a = r.queue ?? "replace-active";
2114
2387
  if (a !== "replace-active" && a !== "replace-all") throw new Q("createUtterance queue must be replace-active or replace-all.");
2115
2388
  e.onProcessorInterrupt?.(), t &&= (t.cancel(), null);
2116
- let o = new on({
2117
- id: tn(),
2389
+ let o = new sn({
2390
+ id: nn(),
2118
2391
  characterId: r.characterId ?? e.getActiveCharacterId(),
2119
2392
  format: i,
2120
2393
  queue: a,
@@ -2126,7 +2399,7 @@ function sn(e) {
2126
2399
  t === o && (t = null);
2127
2400
  }), r.track && (async () => {
2128
2401
  try {
2129
- if (await $t({
2402
+ if (await en({
2130
2403
  track: r.track,
2131
2404
  utterance: o,
2132
2405
  sampleRate: i.sampleRate,
@@ -2154,16 +2427,16 @@ function sn(e) {
2154
2427
  }
2155
2428
  //#endregion
2156
2429
  //#region src/v2/types/sessionInteraction.ts
2157
- function cn(e) {
2430
+ function ln(e) {
2158
2431
  let t = e?.trim();
2159
2432
  return t === "full" || t === "face" || t === "medium" ? t : void 0;
2160
2433
  }
2161
2434
  //#endregion
2162
2435
  //#region src/v2/experience.ts
2163
- function ln(e) {
2436
+ function un(e) {
2164
2437
  return !!(e.showClose === !0 || e.returnUrl?.trim() || e.closeButton === !0 || e.closeButton && typeof e.closeButton == "object" && e.closeButton.visible !== !1);
2165
2438
  }
2166
- var un = class e {
2439
+ var dn = class e {
2167
2440
  bootstrap;
2168
2441
  conversationProcessor;
2169
2442
  iframeHost = null;
@@ -2177,18 +2450,19 @@ var un = class e {
2177
2450
  closed = !1;
2178
2451
  attached = !1;
2179
2452
  pendingFit = null;
2453
+ lastInteraction = null;
2180
2454
  closeHandlers = [];
2181
- eventRegistry = wt();
2455
+ eventRegistry = Tt();
2182
2456
  readyEnvelope = null;
2183
2457
  startedEnvelope = null;
2184
2458
  sessionMintedEnvelope = null;
2185
2459
  conversationCache = [];
2186
2460
  speech;
2187
2461
  constructor(e) {
2188
- 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({
2462
+ 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 = cn({
2189
2463
  getIframeHost: () => this.iframeHost,
2190
2464
  assertSessionStarted: () => this.assertSessionStarted(),
2191
- getCapabilities: () => dn(this.resolvedSession),
2465
+ getCapabilities: () => fn(this.resolvedSession),
2192
2466
  getActiveCharacterId: () => "character_unknown",
2193
2467
  onProcessorInterrupt: () => {
2194
2468
  this.processorAbortController?.abort(), this.processorAbortController = null;
@@ -2233,6 +2507,7 @@ var un = class e {
2233
2507
  speechInputMode: t.speechInputMode,
2234
2508
  speechOnly: t.speechOnly,
2235
2509
  attribution: t.attribution,
2510
+ alreadyConverted: t.alreadyConverted,
2236
2511
  ui: t.ui,
2237
2512
  onStart: t.onStart,
2238
2513
  onUserTranscript: t.onUserTranscript,
@@ -2255,6 +2530,7 @@ var un = class e {
2255
2530
  speechInputMode: t.speechInputMode,
2256
2531
  speechOnly: t.speechOnly,
2257
2532
  attribution: t.attribution,
2533
+ alreadyConverted: t.alreadyConverted,
2258
2534
  ui: t.ui,
2259
2535
  onStart: t.onStart,
2260
2536
  onUserTranscript: t.onUserTranscript,
@@ -2269,7 +2545,7 @@ var un = class e {
2269
2545
  return null;
2270
2546
  }
2271
2547
  on(e, t) {
2272
- let n = Tt(this.eventRegistry, e, t);
2548
+ let n = Et(this.eventRegistry, e, t);
2273
2549
  return e === "ready" && this.readyEnvelope && queueMicrotask(() => t(this.readyEnvelope)), e === "started" && this.startedEnvelope && queueMicrotask(() => t(this.startedEnvelope)), e === "sessionMinted" && this.sessionMintedEnvelope && queueMicrotask(() => t(this.sessionMintedEnvelope)), n;
2274
2550
  }
2275
2551
  async attach(e) {
@@ -2283,7 +2559,7 @@ var un = class e {
2283
2559
  if (this.closed) throw Error("Session has ended.");
2284
2560
  if (this.attached && this.iframeHost) return this.createPlayerFacade();
2285
2561
  this.iframeHost &&= (this.iframeHost.destroy(), null), this.attachReturnUrl = e.returnUrl?.trim() || null;
2286
- 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) => {
2562
+ let t = this.bootstrap.embedBaseUrl ?? vt(), n = this.bootstrap.debug === !0, r = this.bootstrap.speechOnly === !0, i = bt(t, n, r ? void 0 : yt(this.bootstrap.backdropId, this.bootstrap.locationId), r ? void 0 : this.bootstrap.avatarId, e.fit, this.bootstrap.ui, un(e), this.bootstrap.kind === "launch" ? void 0 : this.bootstrap.castSize), a = St(i), o = null, s = new Promise((e) => {
2287
2563
  o = e;
2288
2564
  }), c = null, l = new Promise((e) => {
2289
2565
  c = e;
@@ -2328,6 +2604,9 @@ var un = class e {
2328
2604
  onActivityChange: (e) => {
2329
2605
  this.emitWrapped("activityChange", e);
2330
2606
  },
2607
+ onInteractionChange: (e) => {
2608
+ this.lastInteraction = e, this.emitWrapped("interactionChange", e);
2609
+ },
2331
2610
  onFeedback: (e) => {
2332
2611
  this.emitWrapped("feedback", e);
2333
2612
  },
@@ -2362,6 +2641,7 @@ var un = class e {
2362
2641
  speechInputMode: p.speechInputMode,
2363
2642
  speechOnly: this.bootstrap.speechOnly,
2364
2643
  attribution: this.bootstrap.attribution,
2644
+ alreadyConverted: this.bootstrap.alreadyConverted,
2365
2645
  signal: this.endpointAbortController.signal
2366
2646
  })) : this.bootstrap.kind === "public" ? Ue(this.bootstrap.experienceId, {
2367
2647
  locale: this.bootstrap.locale,
@@ -2371,7 +2651,8 @@ var un = class e {
2371
2651
  mode: p.mode,
2372
2652
  speechInputMode: p.speechInputMode,
2373
2653
  speechOnly: this.bootstrap.speechOnly,
2374
- attribution: this.bootstrap.attribution
2654
+ attribution: this.bootstrap.attribution,
2655
+ alreadyConverted: this.bootstrap.alreadyConverted
2375
2656
  }) : Promise.resolve(this.bootstrap.session ? {
2376
2657
  session: this.bootstrap.session,
2377
2658
  launch: this.bootstrap.launch
@@ -2379,6 +2660,16 @@ var un = class e {
2379
2660
  try {
2380
2661
  [, h] = await Promise.all([f.waitForLoad(), m]);
2381
2662
  } catch (e) {
2663
+ try {
2664
+ f.reportSdkError({
2665
+ errorCode: "sdk.session.attach_failed",
2666
+ severity: "error",
2667
+ operation: "attach",
2668
+ message: e instanceof Error ? e.message : String(e),
2669
+ stack: e instanceof Error ? e.stack : void 0,
2670
+ release: mt
2671
+ });
2672
+ } catch {}
2382
2673
  throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), e;
2383
2674
  } finally {
2384
2675
  this.endpointAbortController = null;
@@ -2391,16 +2682,42 @@ var un = class e {
2391
2682
  return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && Fe(_), f.postLaunch(g, _, {
2392
2683
  startButton: e.startButton,
2393
2684
  theme: e.theme,
2394
- showFeedback: e.showFeedback
2685
+ showFeedback: e.showFeedback,
2686
+ interaction: e.interaction
2395
2687
  }), u.setValue(_)) : f.postLaunch(g, void 0, {
2396
2688
  startButton: e.startButton,
2397
2689
  theme: e.theme,
2398
- showFeedback: e.showFeedback
2690
+ showFeedback: e.showFeedback,
2691
+ interaction: e.interaction
2399
2692
  }), await Promise.race([s, new Promise((e, t) => {
2400
2693
  setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player loading UI.")), 12e4);
2401
- })]), await Promise.race([l, new Promise((e, t) => {
2694
+ })]).catch((e) => {
2695
+ try {
2696
+ f.reportSdkError({
2697
+ errorCode: "sdk.session.attach_failed",
2698
+ severity: "error",
2699
+ operation: "attach",
2700
+ message: e instanceof Error ? e.message : String(e),
2701
+ stack: e instanceof Error ? e.stack : void 0,
2702
+ release: mt
2703
+ });
2704
+ } catch {}
2705
+ throw e;
2706
+ }), await Promise.race([l, new Promise((e, t) => {
2402
2707
  setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player ready state.")), 12e4);
2403
- })]), this.attached = !0, this.pendingFit && await f.setFit(this.pendingFit), this.createPlayerFacade();
2708
+ })]).catch((e) => {
2709
+ try {
2710
+ f.reportSdkError({
2711
+ errorCode: "sdk.session.attach_failed",
2712
+ severity: "error",
2713
+ operation: "attach",
2714
+ message: e instanceof Error ? e.message : String(e),
2715
+ stack: e instanceof Error ? e.stack : void 0,
2716
+ release: mt
2717
+ });
2718
+ } catch {}
2719
+ throw e;
2720
+ }), this.attached = !0, this.pendingFit && await f.setFit(this.pendingFit), this.createPlayerFacade();
2404
2721
  }
2405
2722
  async startListening() {
2406
2723
  this.assertSessionStarted(), await this.iframeHost.startListening();
@@ -2424,11 +2741,23 @@ var un = class e {
2424
2741
  this.assertSessionStarted(), await this.iframeHost.focusCharacter(e);
2425
2742
  }
2426
2743
  async setFit(e) {
2427
- let t = cn(e);
2744
+ let t = ln(e);
2428
2745
  if (!t) throw Error("setFit requires \"full\", \"medium\", or \"face\".");
2429
2746
  if (this.closed) throw Error("Session has ended.");
2430
2747
  this.pendingFit = t, !(!this.attached || !this.iframeHost) && await this.iframeHost.setFit(t);
2431
2748
  }
2749
+ async setInteraction(e) {
2750
+ if (this.closed) throw Error("Session has ended.");
2751
+ if (!this.iframeHost) throw Error("setInteraction() requires attach() first.");
2752
+ let t = await this.iframeHost.setInteraction(e);
2753
+ return this.lastInteraction = t, t;
2754
+ }
2755
+ async getInteraction() {
2756
+ if (this.closed) throw Error("Session has ended.");
2757
+ if (!this.iframeHost) throw Error("getInteraction() requires attach() first.");
2758
+ let e = await this.iframeHost.getInteraction();
2759
+ return this.lastInteraction = e, e;
2760
+ }
2432
2761
  async conversion(e) {
2433
2762
  if (this.closed) throw Error("Session has ended.");
2434
2763
  if (!this.iframeHost) throw Error("conversion() requires attach() first.");
@@ -2448,7 +2777,7 @@ var un = class e {
2448
2777
  this.close();
2449
2778
  }
2450
2779
  destroy() {
2451
- 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);
2780
+ 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, Ot(this.eventRegistry), this.readyEnvelope = null, this.startedEnvelope = null, this.closeHandlers.length = 0, this.lastInteraction = null, this.attached = !1);
2452
2781
  }
2453
2782
  resolveMintInteraction() {
2454
2783
  return this.bootstrap.kind === "launch" ? {} : {
@@ -2460,8 +2789,8 @@ var un = class e {
2460
2789
  return this.resolvedSession?.id ?? "";
2461
2790
  }
2462
2791
  emitWrapped(e, t) {
2463
- let n = Ct(e, this.getSessionId(), t);
2464
- return Et(this.eventRegistry, e, n), n;
2792
+ let n = wt(e, this.getSessionId(), t);
2793
+ return Dt(this.eventRegistry, e, n), n;
2465
2794
  }
2466
2795
  queueProcessorTurn(e) {
2467
2796
  if (!e.isFinal || !e.text.trim() || !this.conversationProcessor) return;
@@ -2520,7 +2849,7 @@ var un = class e {
2520
2849
  };
2521
2850
  }
2522
2851
  };
2523
- function dn(e) {
2852
+ function fn(e) {
2524
2853
  return e ? {
2525
2854
  textSpeech: e.capabilities.speech.output,
2526
2855
  externalSpeechAudio: e.capabilities.speech.externalAudio
@@ -2531,41 +2860,41 @@ function dn(e) {
2531
2860
  }
2532
2861
  //#endregion
2533
2862
  //#region src/widget/dockGeometry.ts
2534
- var fn = "(min-width: 768px)", pn = 24, mn = .5, hn = 1200, gn = .85, _n = 9 / 16;
2535
- function vn() {
2863
+ var pn = "(min-width: 768px)", mn = 24, hn = .5, gn = 1200, _n = .85, vn = 9 / 16;
2864
+ function yn() {
2536
2865
  if (typeof window > "u") return 800;
2537
2866
  let e = window.screen?.availHeight;
2538
2867
  return typeof e == "number" && e > 0 ? e : window.innerHeight;
2539
2868
  }
2540
- function yn(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = pn, r = typeof window < "u" ? vn() : 800) {
2541
- 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;
2542
- return s > a && (s = a, o = s / _n, o > i && (o = i, s = o * _n)), {
2869
+ function bn(e = typeof window < "u" ? window.innerWidth : 1280, t = typeof window < "u" ? window.innerHeight : 800, n = mn, r = typeof window < "u" ? yn() : 800) {
2870
+ let i = Math.max(160, Math.min(t - n * 2, t * _n)), a = Math.max(120, e - n * 2), o = Math.min(r * hn, gn, i), s = o * vn;
2871
+ return s > a && (s = a, o = s / vn, o > i && (o = i, s = o * vn)), {
2543
2872
  width: Math.round(s),
2544
2873
  height: Math.round(o)
2545
2874
  };
2546
2875
  }
2547
- function bn(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = pn) {
2876
+ function xn(e, t = typeof window < "u" ? window.innerWidth : 1280, n = typeof window < "u" ? window.innerHeight : 800, r = mn) {
2548
2877
  return {
2549
2878
  left: Math.max(r, t - e.width - r),
2550
2879
  top: Math.max(r, n - e.height - r)
2551
2880
  };
2552
2881
  }
2553
- function xn(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = pn) {
2882
+ function Sn(e, t, n, r = typeof window < "u" ? window.innerWidth : 1280, i = typeof window < "u" ? window.innerHeight : 800, a = mn) {
2554
2883
  let o = Math.max(a, r - n.width - a), s = Math.max(a, i - n.height - a);
2555
2884
  return {
2556
2885
  left: Math.min(Math.max(a, e), o),
2557
2886
  top: Math.min(Math.max(a, t), s)
2558
2887
  };
2559
2888
  }
2560
- function Sn(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
2561
- return e(fn).matches;
2889
+ function Cn(e = typeof window < "u" ? window.matchMedia.bind(window) : () => ({ matches: !0 })) {
2890
+ return e(pn).matches;
2562
2891
  }
2563
2892
  //#endregion
2564
2893
  //#region src/widget/mountExperienceWidget.ts
2565
- function Cn(e) {
2894
+ function wn(e) {
2566
2895
  return e === "bottom-right" || e === "bottom-left" ? e : "static";
2567
2896
  }
2568
- function wn(e) {
2897
+ function Tn(e) {
2569
2898
  if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
2570
2899
  let t = typeof e == "string" ? e.trim() : "";
2571
2900
  return t ? /^\d+(\.\d+)?$/.test(t) ? `${t}px` : t : "16px";
@@ -2573,8 +2902,8 @@ function wn(e) {
2573
2902
  function $(e) {
2574
2903
  return e === "expanded" || e === "docked";
2575
2904
  }
2576
- 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>";
2577
- function kn(e, t, n) {
2905
+ var En = "<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>", Dn = "<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>", 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=\"M18 10h-4V6m6-2l-6 6m-8 4h4v4m0-4l-6 6\"/></svg>", kn = "<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>";
2906
+ function An(e, t, n) {
2578
2907
  W(de);
2579
2908
  let r = w({
2580
2909
  galleryThumb: t.galleryThumb,
@@ -2604,7 +2933,7 @@ function kn(e, t, n) {
2604
2933
  }
2605
2934
  return e.replaceChildren(i), n?.parallax === !1 ? () => {} : ue(i);
2606
2935
  }
2607
- function An(e) {
2936
+ function jn(e) {
2608
2937
  return e.startButton ? {
2609
2938
  ...e.startButton,
2610
2939
  label: e.startButton.label ?? e.startButtonLabel ?? "Tap to talk",
@@ -2616,7 +2945,7 @@ function An(e) {
2616
2945
  variant: "primary"
2617
2946
  };
2618
2947
  }
2619
- function jn(e) {
2948
+ function Mn(e) {
2620
2949
  let t = !1, n = () => {
2621
2950
  t || e();
2622
2951
  }, r = () => {
@@ -2636,12 +2965,12 @@ function jn(e) {
2636
2965
  t = !0, window.removeEventListener("load", r), i?.();
2637
2966
  };
2638
2967
  }
2639
- function Mn(e, t) {
2968
+ function Nn(e, t) {
2640
2969
  he(me);
2641
2970
  let n = t.experienceId?.trim();
2642
2971
  if (!n) throw Error("ExperienceWidget requires experienceId.");
2643
- let r = t.prefetch ?? "onExpand", i = Cn(t.position), a = document.createElement("div");
2644
- 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));
2972
+ let r = t.prefetch ?? "onExpand", i = wn(t.position), a = document.createElement("div");
2973
+ 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", Tn(t.offset));
2645
2974
  let o = document.createElement("button");
2646
2975
  o.type = "button", o.className = "liforma-ew__hit", o.setAttribute("aria-label", t.alt), o.disabled = !0;
2647
2976
  let s = document.createElement("div");
@@ -2661,11 +2990,11 @@ function Mn(e, t) {
2661
2990
  let m = document.createElement("span");
2662
2991
  m.className = "liforma-ew__drag-grip", m.setAttribute("aria-hidden", "true");
2663
2992
  let h = document.createElement("button");
2664
- h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = Dn, h.setAttribute("aria-label", "Reduce");
2993
+ h.type = "button", h.className = "liforma-ew__icon-btn liforma-ew__dock-toggle", h.innerHTML = On, h.setAttribute("aria-label", "Reduce");
2665
2994
  let g = document.createElement("button");
2666
- 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");
2995
+ g.type = "button", g.className = "liforma-ew__icon-btn liforma-ew__settings", g.innerHTML = En, g.setAttribute("aria-label", "Audio settings"), g.setAttribute("aria-pressed", "false");
2667
2996
  let _ = document.createElement("button");
2668
- _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = En, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
2997
+ _.type = "button", _.className = "liforma-ew__icon-btn liforma-ew__close", _.innerHTML = Dn, _.setAttribute("aria-label", "Close"), p.append(m, h, g, _);
2669
2998
  let v = document.createElement("div");
2670
2999
  v.className = "liforma-ew__stage";
2671
3000
  let y = document.createElement("div");
@@ -2693,11 +3022,11 @@ function Mn(e, t) {
2693
3022
  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";
2694
3023
  }, oe = (e, t) => {
2695
3024
  if (R() !== "docked") return;
2696
- let n = yn(), r = xn(e - te, t - ne, n);
3025
+ let n = bn(), r = Sn(e - te, t - ne, n);
2697
3026
  N = r.left, P = r.top, V(r.left, r.top, n.width, n.height);
2698
3027
  }, se = (e, t) => {
2699
3028
  if (R() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
2700
- let n = yn(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = xn(r + e, i + t, n);
3029
+ let n = bn(), r = N ?? f.getBoundingClientRect().left, i = P ?? f.getBoundingClientRect().top, a = Sn(r + e, i + t, n);
2701
3030
  N = a.left, P = a.top, V(a.left, a.top, n.width, n.height);
2702
3031
  }, ce = (e) => {
2703
3032
  I === "toolbar" && (F === null || e.pointerId !== F || (e.preventDefault(), oe(e.clientX, e.clientY)));
@@ -2706,12 +3035,12 @@ function Mn(e, t) {
2706
3035
  let t = I;
2707
3036
  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));
2708
3037
  }, le = (e, t, n) => {
2709
- if (S || R() !== "docked" || !Sn() || F !== null) return;
3038
+ if (S || R() !== "docked" || !Cn() || F !== null) return;
2710
3039
  F = n, I = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2711
3040
  let r = f.getBoundingClientRect();
2712
3041
  te = e - r.left, ne = t - r.top, L || (L = !0, window.addEventListener("pointermove", ce), window.addEventListener("pointerup", H), window.addEventListener("pointercancel", H));
2713
3042
  }, ue = (e) => {
2714
- if (S || R() !== "docked" || !Sn() || F !== null) return;
3043
+ if (S || R() !== "docked" || !Cn() || F !== null) return;
2715
3044
  F = e.pointerId, I = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
2716
3045
  let t = f.getBoundingClientRect();
2717
3046
  N = t.left, P = t.top;
@@ -2720,15 +3049,15 @@ function Mn(e, t) {
2720
3049
  }, U = (e) => {
2721
3050
  I === "player" && (F === null || e.pointerId !== F || H());
2722
3051
  }, W = () => {
2723
- let e = Sn(), t = R();
3052
+ let e = Cn(), t = R();
2724
3053
  if (!e || t !== "expanded" && t !== "docked") {
2725
3054
  h.hidden = !0;
2726
3055
  return;
2727
3056
  }
2728
- h.hidden = !1, t === "docked" ? (h.innerHTML = On, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = Dn, h.setAttribute("aria-label", "Reduce"));
3057
+ h.hidden = !1, t === "docked" ? (h.innerHTML = kn, h.setAttribute("aria-label", "Maximize")) : (h.innerHTML = On, h.setAttribute("aria-label", "Reduce"));
2729
3058
  }, fe = (e) => {
2730
- let t = yn(), n = e && N !== null && P !== null ? xn(N, P, t) : bn(t);
2731
- n = xn(n.left, n.top, t), N = n.left, P = n.top, V(n.left, n.top, t.width, t.height), W();
3059
+ let t = bn(), n = e && N !== null && P !== null ? Sn(N, P, t) : xn(t);
3060
+ n = Sn(n.left, n.top, t), N = n.left, P = n.top, V(n.left, n.top, t.width, t.height), W();
2732
3061
  }, pe = () => {
2733
3062
  a.classList.remove("liforma-ew--session-revealed"), requestAnimationFrame(() => {
2734
3063
  requestAnimationFrame(() => {
@@ -2775,7 +3104,7 @@ function Mn(e, t) {
2775
3104
  w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
2776
3105
  }, xe = (e) => {
2777
3106
  A?.(), A = null;
2778
- let t = kn(s, e, { parallax: ie });
3107
+ let t = An(s, e, { parallax: ie });
2779
3108
  return t ? (A = t, !0) : !1;
2780
3109
  }, Se = () => {
2781
3110
  if (xe(_e)) {
@@ -2801,11 +3130,13 @@ function Mn(e, t) {
2801
3130
  ...t.mode ? { mode: t.mode } : {},
2802
3131
  ...t.speechInputMode ? { speechInputMode: t.speechInputMode } : {},
2803
3132
  ...t.speechOnly === void 0 ? {} : { speechOnly: t.speechOnly },
3133
+ ...t.alreadyConverted?.length ? { alreadyConverted: t.alreadyConverted } : {},
2804
3134
  ...t.embedBaseUrl ? { embedBaseUrl: t.embedBaseUrl } : {}
2805
3135
  }), we = () => ({
2806
3136
  ...t.fit ? { fit: t.fit } : {},
2807
- startButton: An(t),
2808
- ...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback }
3137
+ startButton: jn(t),
3138
+ ...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback },
3139
+ ...t.interaction ? { interaction: t.interaction } : {}
2809
3140
  }), J = (e = !0) => {
2810
3141
  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?.();
2811
3142
  }, Te = () => {
@@ -2836,7 +3167,7 @@ function Mn(e, t) {
2836
3167
  Oe(), De(), t.onCollapsed?.(), t.onClose?.();
2837
3168
  }
2838
3169
  }, Y = () => {
2839
- S || Sn() && R() === "expanded" && G(() => {
3170
+ S || Cn() && R() === "expanded" && G(() => {
2840
3171
  Te();
2841
3172
  });
2842
3173
  }, X = () => {
@@ -2855,7 +3186,7 @@ function Mn(e, t) {
2855
3186
  let e = O;
2856
3187
  l.hidden = !1, (async () => {
2857
3188
  try {
2858
- let t = await un.startSession(Ce());
3189
+ let t = await dn.startSession(Ce());
2859
3190
  if (S || e !== O) {
2860
3191
  t.destroy();
2861
3192
  return;
@@ -2914,7 +3245,7 @@ function Mn(e, t) {
2914
3245
  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 () => {
2915
3246
  try {
2916
3247
  J();
2917
- let t = await un.startSession(Ce());
3248
+ let t = await dn.startSession(Ce());
2918
3249
  if (S || e !== O) {
2919
3250
  t.destroy();
2920
3251
  return;
@@ -2981,13 +3312,13 @@ function Mn(e, t) {
2981
3312
  }, Re = (e) => {
2982
3313
  e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
2983
3314
  }, ze = (e) => {
2984
- R() === "docked" && Sn() && (e.target?.closest("button") || (e.preventDefault(), le(e.clientX, e.clientY, e.pointerId)));
3315
+ R() === "docked" && Cn() && (e.target?.closest("button") || (e.preventDefault(), le(e.clientX, e.clientY, e.pointerId)));
2985
3316
  }, Be = (e) => {
2986
3317
  e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), ke());
2987
3318
  }, Ve = () => {
2988
3319
  if (!S) {
2989
3320
  if (R() === "docked") {
2990
- if (!Sn()) {
3321
+ if (!Cn()) {
2991
3322
  X();
2992
3323
  return;
2993
3324
  }
@@ -2998,9 +3329,9 @@ function Mn(e, t) {
2998
3329
  }
2999
3330
  W();
3000
3331
  }
3001
- }, He = typeof window < "u" ? window.matchMedia(fn) : null, Ue = () => {
3332
+ }, He = typeof window < "u" ? window.matchMedia(pn) : null, Ue = () => {
3002
3333
  if (!S) {
3003
- if (R() === "docked" && !Sn()) {
3334
+ if (R() === "docked" && !Cn()) {
3004
3335
  X();
3005
3336
  return;
3006
3337
  }
@@ -3011,7 +3342,7 @@ function Mn(e, t) {
3011
3342
  e.stopPropagation(), ke();
3012
3343
  }), 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(() => {
3013
3344
  S || Ne();
3014
- }) : r === "idle" && (ee = jn(() => {
3345
+ }) : r === "idle" && (ee = Mn(() => {
3015
3346
  S || Ne();
3016
3347
  })), {
3017
3348
  root: a,
@@ -3033,12 +3364,12 @@ function Mn(e, t) {
3033
3364
  }
3034
3365
  //#endregion
3035
3366
  //#region src/react/ExperienceWidget.tsx
3036
- function Nn(t) {
3367
+ function Pn(t) {
3037
3368
  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";
3038
3369
  return e(() => {
3039
3370
  let e = r.current;
3040
3371
  if (!e || !i.trim()) return;
3041
- let t = Mn(e, {
3372
+ let t = Nn(e, {
3042
3373
  experienceId: i,
3043
3374
  alt: o,
3044
3375
  galleryThumb: s,
@@ -3116,11 +3447,11 @@ function Nn(t) {
3116
3447
  }
3117
3448
  //#endregion
3118
3449
  //#region src/next/index.ts
3119
- function Pn(e = {}) {
3450
+ function Fn(e = {}) {
3120
3451
  let t = v(e);
3121
3452
  return { POST: ({ request: e }) => t(e) };
3122
3453
  }
3123
3454
  //#endregion
3124
- export { pe as ExperienceThumbnail, Nn as ExperienceWidget, v as createLiformaSessionRouteHandler, Pn as createLiformaSvelteKitSessionHandler };
3455
+ export { pe as ExperienceThumbnail, Pn as ExperienceWidget, v as createLiformaSessionRouteHandler, Fn as createLiformaSvelteKitSessionHandler };
3125
3456
 
3126
3457
  //# sourceMappingURL=index.js.map