@ikonai/sdk 0.0.18 → 0.0.19

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 (2) hide show
  1. package/index.js +285 -265
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- function gi(e) {
1
+ function Ci(e) {
2
2
  return e;
3
3
  }
4
4
  function Ne(e) {
@@ -14508,6 +14508,15 @@ var $o;
14508
14508
  }
14509
14509
  e.fromProtocolMessage = h;
14510
14510
  })($o || ($o = {}));
14511
+ function Vn(e) {
14512
+ return new Worker(
14513
+ "/assets/protocol-worker-DZqyPqA2.js",
14514
+ {
14515
+ type: "module",
14516
+ name: e?.name
14517
+ }
14518
+ );
14519
+ }
14511
14520
  class ar extends Error {
14512
14521
  constructor(l, i) {
14513
14522
  super(l), this.cause = i, this.name = "ConnectionError";
@@ -14528,27 +14537,27 @@ class cr extends A {
14528
14537
  super(`No keepalive received within ${l}ms`), this.name = "KeepaliveTimeoutError";
14529
14538
  }
14530
14539
  }
14531
- class Vn extends ar {
14540
+ class Ln extends ar {
14532
14541
  constructor(l) {
14533
14542
  super(`Maximum reconnection attempts (${l}) exceeded`), this.name = "MaxRetriesExceededError";
14534
14543
  }
14535
14544
  }
14536
- class Ln extends H {
14545
+ class Dn extends H {
14537
14546
  constructor(l) {
14538
14547
  super(`Channel provisioning timeout after ${l}ms`), this.name = "ProvisioningTimeoutError";
14539
14548
  }
14540
14549
  }
14541
- class Mi extends H {
14550
+ class _i extends H {
14542
14551
  constructor(l) {
14543
14552
  super(`Channel not found: ${l}`), this.name = "ChannelNotFoundError";
14544
14553
  }
14545
14554
  }
14546
- class ki extends H {
14555
+ class Oi extends H {
14547
14556
  constructor(l) {
14548
14557
  super(`Space not found for domain: ${l}`), this.name = "SpaceNotFoundError";
14549
14558
  }
14550
14559
  }
14551
- class Si extends H {
14560
+ class Vi extends H {
14552
14561
  constructor() {
14553
14562
  super("No channels available in this space"), this.name = "NoChannelsError";
14554
14563
  }
@@ -14569,30 +14578,30 @@ function sn(e, l) {
14569
14578
  }
14570
14579
  var dn = /* @__PURE__ */ ((e) => (e[e.DEBUG = 0] = "DEBUG", e[e.INFO = 1] = "INFO", e[e.WARN = 2] = "WARN", e[e.ERROR = 3] = "ERROR", e[e.NONE = 4] = "NONE", e))(dn || {});
14571
14580
  let ur = 1, Oe = null;
14572
- function Pi(e) {
14581
+ function Li(e) {
14573
14582
  ur = e;
14574
14583
  }
14575
- function Ci() {
14584
+ function Di() {
14576
14585
  return ur;
14577
14586
  }
14578
- function Dn(e) {
14587
+ function vn(e) {
14579
14588
  Oe = e;
14580
14589
  }
14581
- function _i() {
14590
+ function vi() {
14582
14591
  return Oe;
14583
14592
  }
14584
- const vn = {
14593
+ const jn = {
14585
14594
  0: "DEBUG",
14586
14595
  1: "INFO",
14587
14596
  2: "WARN",
14588
14597
  3: "ERROR",
14589
14598
  4: "NONE"
14590
14599
  };
14591
- function jn(e, l) {
14600
+ function Hn(e, l) {
14592
14601
  return `[${e}] ${l}`;
14593
14602
  }
14594
14603
  function Fe(e, l, i, s) {
14595
- const d = (/* @__PURE__ */ new Date()).toISOString(), a = vn[e];
14604
+ const d = (/* @__PURE__ */ new Date()).toISOString(), a = jn[e];
14596
14605
  if (Oe && Oe({
14597
14606
  timestamp: d,
14598
14607
  level: e,
@@ -14601,7 +14610,7 @@ function Fe(e, l, i, s) {
14601
14610
  message: i,
14602
14611
  args: s
14603
14612
  }), ur <= e) {
14604
- const c = jn(l, i);
14613
+ const c = Hn(l, i);
14605
14614
  switch (e) {
14606
14615
  case 0:
14607
14616
  console.debug(c, ...s);
@@ -14634,8 +14643,8 @@ function z(e) {
14634
14643
  }
14635
14644
  };
14636
14645
  }
14637
- const be = z("WebSocketTransport"), Hn = 1e4;
14638
- class xn {
14646
+ const be = z("WebSocketTransport"), xn = 1e4;
14647
+ class Wn {
14639
14648
  ws = null;
14640
14649
  keepaliveTimeout = null;
14641
14650
  keepaliveTimeoutMs;
@@ -14660,7 +14669,7 @@ class xn {
14660
14669
  clearTimeout(w), this.ws && (this.ws.onopen = null, this.ws.onerror = null, this.ws.onclose = null, this.ws.onmessage = null);
14661
14670
  }, w = setTimeout(() => {
14662
14671
  c || (c = !0, f(), this.ws?.close(), d(new A("WebSocket connection timeout")));
14663
- }, Hn);
14672
+ }, xn);
14664
14673
  this.ws.onopen = () => {
14665
14674
  a = !0, clearTimeout(w), this.ws.send(i), this.resetKeepaliveTimeout(), c || (c = !0, s());
14666
14675
  }, this.ws.onerror = () => {
@@ -14708,7 +14717,7 @@ const Q = z("WebTransportTransport"), zo = 4;
14708
14717
  function an() {
14709
14718
  return typeof WebTransport < "u";
14710
14719
  }
14711
- class Wn {
14720
+ class Rn {
14712
14721
  transport = null;
14713
14722
  stream = null;
14714
14723
  reader = null;
@@ -14841,7 +14850,7 @@ class Wn {
14841
14850
  }
14842
14851
  }
14843
14852
  const me = z("Channel");
14844
- class Rn {
14853
+ class Gn {
14845
14854
  state = "disconnected";
14846
14855
  transport = null;
14847
14856
  config;
@@ -14918,13 +14927,13 @@ class Rn {
14918
14927
  switch (l.Type) {
14919
14928
  case K.WebSocket:
14920
14929
  case K.WebSocketProxy:
14921
- this.transport = new xn(i);
14930
+ this.transport = new Wn(i);
14922
14931
  break;
14923
14932
  case K.WebTransport:
14924
14933
  case K.WebTransportProxy:
14925
14934
  if (!an())
14926
14935
  throw new Error("WebTransport is not supported in this browser");
14927
- this.transport = new Wn(i);
14936
+ this.transport = new Rn(i);
14928
14937
  break;
14929
14938
  default:
14930
14939
  throw new Error(`Unsupported entrypoint type: ${K[l.Type]}`);
@@ -14966,7 +14975,7 @@ class Rn {
14966
14975
  }
14967
14976
  }
14968
14977
  const B = z("ChannelManager");
14969
- class Gn {
14978
+ class Kn {
14970
14979
  channels = /* @__PURE__ */ new Map();
14971
14980
  // keyed by opcode group
14972
14981
  activeType = null;
@@ -15068,7 +15077,7 @@ class Gn {
15068
15077
  * Connect a single channel.
15069
15078
  */
15070
15079
  async connectChannel(l) {
15071
- const i = new Rn({
15080
+ const i = new Gn({
15072
15081
  entrypoint: l,
15073
15082
  sessionId: this.config.sessionId,
15074
15083
  keepaliveTimeoutMs: this.config.keepaliveTimeoutMs,
@@ -15118,7 +15127,7 @@ class Gn {
15118
15127
  if (!this.shouldReconnect)
15119
15128
  return;
15120
15129
  if (this.reconnectAttempts >= this.config.maxReconnectAttempts) {
15121
- B.error(`Max reconnect attempts (${this.config.maxReconnectAttempts}) reached`), this.setState("offline"), this.config.onError?.(new Vn(this.config.maxReconnectAttempts));
15130
+ B.error(`Max reconnect attempts (${this.config.maxReconnectAttempts}) reached`), this.setState("offline"), this.config.onError?.(new Ln(this.config.maxReconnectAttempts));
15122
15131
  return;
15123
15132
  }
15124
15133
  this.setState("reconnecting"), this.reconnectAttempts++;
@@ -15145,7 +15154,7 @@ class Gn {
15145
15154
  this.state !== l && (this.state = l, this.config.onStateChange?.(l));
15146
15155
  }
15147
15156
  }
15148
- const Kn = 5e3, Jn = 3e4, Yo = 35e3, Xo = 500, Qo = 6, cn = 6e4, Ae = "ikon_device_id";
15157
+ const Jn = 5e3, $n = 3e4, Yo = 35e3, Xo = 500, Qo = 6, cn = 6e4, Ae = "ikon_device_id";
15149
15158
  function fr() {
15150
15159
  if (typeof window > "u" || typeof localStorage > "u")
15151
15160
  return crypto.randomUUID();
@@ -15156,14 +15165,14 @@ function fr() {
15156
15165
  return crypto.randomUUID();
15157
15166
  }
15158
15167
  }
15159
- function Oi() {
15168
+ function ji() {
15160
15169
  if (!(typeof localStorage > "u"))
15161
15170
  try {
15162
15171
  localStorage.removeItem(Ae);
15163
15172
  } catch {
15164
15173
  }
15165
15174
  }
15166
- function Vi(e) {
15175
+ function Hi(e) {
15167
15176
  try {
15168
15177
  const l = e.split(".");
15169
15178
  return l.length !== 3 ? null : JSON.parse(atob(l[1])).id ?? null;
@@ -15171,22 +15180,22 @@ function Vi(e) {
15171
15180
  return null;
15172
15181
  }
15173
15182
  }
15174
- const Ve = {}, Ue = "https://api.prod.ikon.live", Le = "https://api.dev.ikon.live", Zo = "https://auth.ikonai.com", qo = "https://auth.dev.ikonai.com", Li = "https://auth.ikonai.com";
15183
+ const Ve = {}, Ue = "https://api.prod.ikon.live", Le = "https://api.dev.ikon.live", Zo = "https://auth.ikonai.com", qo = "https://auth.dev.ikonai.com", xi = "https://auth.ikonai.com";
15175
15184
  function un(e) {
15176
15185
  return e === "development" ? Le : Ue;
15177
15186
  }
15178
- function Di() {
15187
+ function Wi() {
15179
15188
  const e = typeof import.meta < "u" ? Ve?.VITE_IKON_BACKEND_URL : void 0;
15180
15189
  return e || (typeof window > "u" ? Ue : !wr() || window.location.hostname.includes(".dev.") ? Le : Ue);
15181
15190
  }
15182
- function vi() {
15191
+ function Ri() {
15183
15192
  const e = typeof import.meta < "u" ? Ve?.VITE_IKON_BACKEND_TYPE : void 0;
15184
15193
  if (e === "development" || e === "production")
15185
15194
  return e;
15186
15195
  const l = typeof import.meta < "u" ? Ve?.VITE_IKON_BACKEND_URL : void 0;
15187
15196
  return l ? l.includes(".dev.") ? "development" : "production" : typeof window > "u" ? "production" : wr() ? window.location.hostname.includes(".dev.") ? "development" : "production" : "development";
15188
15197
  }
15189
- function ji() {
15198
+ function Gi() {
15190
15199
  const e = typeof import.meta < "u" ? Ve?.VITE_IKON_AUTH_URL : void 0;
15191
15200
  return e || (typeof window > "u" ? Zo : !wr() || window.location.hostname.includes(".dev.") ? qo : Zo);
15192
15201
  }
@@ -15198,8 +15207,8 @@ function fn() {
15198
15207
  l[i] = s;
15199
15208
  return l;
15200
15209
  }
15201
- const $n = ["ikon_token", "ikon_provider", "error"];
15202
- function Hi() {
15210
+ const zn = ["ikon_token", "ikon_provider", "error"];
15211
+ function Ki() {
15203
15212
  if (typeof window > "u")
15204
15213
  return { parameters: {} };
15205
15214
  const e = window.location.pathname;
@@ -15211,7 +15220,7 @@ function Hi() {
15211
15220
  throw new Error("URL cannot contain both /s/[sessionId] and /c/[channelKey]");
15212
15221
  const a = fn(), c = {};
15213
15222
  for (const [f, w] of Object.entries(a))
15214
- $n.includes(f) || (c[f] = w);
15223
+ zn.includes(f) || (c[f] = w);
15215
15224
  return { sessionId: l, channelKey: i, parameters: c };
15216
15225
  }
15217
15226
  function wr() {
@@ -15226,8 +15235,8 @@ function wr() {
15226
15235
  }
15227
15236
  return !0;
15228
15237
  }
15229
- const De = z("Authenticator"), de = j.GROUP_CORE | j.GROUP_KEEPALIVE | j.GROUP_EVENTS | j.GROUP_ACTIONS | j.GROUP_UI | j.GROUP_AUDIO | j.GROUP_VIDEO, zn = 1e3, Yn = 5e3;
15230
- async function Xn(e) {
15238
+ const De = z("Authenticator"), de = j.GROUP_CORE | j.GROUP_KEEPALIVE | j.GROUP_EVENTS | j.GROUP_ACTIONS | j.GROUP_UI | j.GROUP_AUDIO | j.GROUP_VIDEO, Yn = 1e3, Xn = 5e3;
15239
+ async function Qn(e) {
15231
15240
  try {
15232
15241
  const l = await fetch(`${Le}/users/me`, {
15233
15242
  credentials: "include",
@@ -15263,7 +15272,7 @@ async function hn(e, l, i, s, d, a, c) {
15263
15272
  }
15264
15273
  return await h.json();
15265
15274
  }
15266
- async function Qn(e, l, i, s) {
15275
+ async function Zn(e, l, i, s) {
15267
15276
  const d = `${e}/rooms/connect`, a = await fetch(d, wn(l, i, s));
15268
15277
  if (!a.ok) {
15269
15278
  const c = await a.text().catch(() => "Unknown error");
@@ -15273,17 +15282,17 @@ async function Qn(e, l, i, s) {
15273
15282
  }
15274
15283
  async function In(e, l, i, s, d) {
15275
15284
  const a = Date.now();
15276
- let c = zn;
15285
+ let c = Yn;
15277
15286
  for (; ; ) {
15278
15287
  if (d?.aborted)
15279
15288
  throw new H("Connection aborted");
15280
15289
  if (Date.now() - a >= i)
15281
- throw new Ln(i);
15282
- const w = await Qn(e, l, s, d), h = w.state?.toLowerCase();
15290
+ throw new Dn(i);
15291
+ const w = await Zn(e, l, s, d), h = w.state?.toLowerCase();
15283
15292
  if (h === "running")
15284
15293
  return w;
15285
15294
  if (h === "provisioning") {
15286
- await sn(c, d), c = Math.min(c * 1.5, Yn);
15295
+ await sn(c, d), c = Math.min(c * 1.5, Xn);
15287
15296
  continue;
15288
15297
  }
15289
15298
  throw new H(`Unexpected channel state: ${w.state}`);
@@ -15298,7 +15307,7 @@ async function hr(e, l) {
15298
15307
  const s = await i.arrayBuffer(), d = new Uint8Array(s);
15299
15308
  return { authResponse: Qe.fromProtocolMessage(d) };
15300
15309
  }
15301
- function Zn(e, l) {
15310
+ function qn(e, l) {
15302
15311
  return Ze.create({
15303
15312
  ServerSessionId: "",
15304
15313
  // Server will fill this in
@@ -15326,7 +15335,7 @@ function Zn(e, l) {
15326
15335
  Parameters: e.parameters ?? {}
15327
15336
  });
15328
15337
  }
15329
- function qn(e) {
15338
+ function Bn(e) {
15330
15339
  return {
15331
15340
  ServerSessionId: e.ServerSessionId,
15332
15341
  ContextType: e.ContextType,
@@ -15353,13 +15362,13 @@ function qn(e) {
15353
15362
  Parameters: e.Parameters
15354
15363
  };
15355
15364
  }
15356
- async function Bn(e, l) {
15365
+ async function An(e, l) {
15357
15366
  const i = `https://${e.host}:${e.httpsPort}`;
15358
15367
  De.debug(`Authenticating with local server: ${i}`);
15359
15368
  const d = { ...fn(), ...e.parameters };
15360
15369
  let a = e.userId;
15361
- a || (a = await Xn(l), a || (a = "local", De.warn('Could not determine user ID. Using fallback "local". To fix: either provide userId in config, or log in to the Ikon portal at https://portal.dev.ikon.live')));
15362
- const c = Zn({ ...e, parameters: d }, a), f = qn(c), w = await fetch(`${i}/connect-token`, {
15370
+ a || (a = await Qn(l), a || (a = "local", De.warn('Could not determine user ID. Using fallback "local". To fix: either provide userId in config, or log in to the Ikon portal at https://portal.dev.ikon.live')));
15371
+ const c = qn({ ...e, parameters: d }, a), f = Bn(c), w = await fetch(`${i}/connect-token`, {
15363
15372
  method: "POST",
15364
15373
  headers: {
15365
15374
  "Content-Type": "application/json"
@@ -15377,7 +15386,7 @@ async function Bn(e, l) {
15377
15386
  const r = `${i}/connect?token=${encodeURIComponent(o)}`;
15378
15387
  return hr(r, l);
15379
15388
  }
15380
- async function An(e, l) {
15389
+ async function Un(e, l) {
15381
15390
  if (e.sessionId && e.channelKey)
15382
15391
  throw new H("Cannot specify both sessionId and channelKey. Use sessionId for precomputed sessions or channelKey to select a channel.");
15383
15392
  const i = un(e.backendType);
@@ -15437,7 +15446,7 @@ async function An(e, l) {
15437
15446
  const r = o.configuration.url;
15438
15447
  return hr(r, l);
15439
15448
  }
15440
- async function Un(e, l) {
15449
+ async function el(e, l) {
15441
15450
  if (e.sessionId && e.channelKey)
15442
15451
  throw new H("Cannot specify both sessionId and channelKey. Use sessionId for precomputed sessions or channelKey to select a channel.");
15443
15452
  const i = un(e.backendType), s = e.token;
@@ -15478,22 +15487,22 @@ async function Un(e, l) {
15478
15487
  const h = w.configuration.url;
15479
15488
  return hr(h, l);
15480
15489
  }
15481
- const pn = "ikon.theme", er = "ikon.theme-user", el = "ikon.theme-change";
15490
+ const pn = "ikon.theme", er = "ikon.theme-user", rl = "ikon.theme-change";
15482
15491
  function Tn(e) {
15483
15492
  typeof document < "u" && document.documentElement && document.documentElement.setAttribute("data-theme", e);
15484
15493
  }
15485
- const rl = {
15494
+ const tl = {
15486
15495
  name: "ikon.client.getTheme",
15487
15496
  description: "Get the currently selected client theme",
15488
15497
  returnType: { kind: "string", nullable: !0 }
15489
15498
  };
15490
- function tl() {
15499
+ function ol() {
15491
15500
  if (typeof window > "u" || !window.localStorage)
15492
15501
  return null;
15493
15502
  const e = window.localStorage.getItem(er) ?? window.localStorage.getItem(pn) ?? "light";
15494
15503
  return Tn(e), e;
15495
15504
  }
15496
- const ol = {
15505
+ const nl = {
15497
15506
  name: "ikon.client.setTheme",
15498
15507
  description: "Update the client UI theme",
15499
15508
  returnType: { kind: "boolean" },
@@ -15502,7 +15511,7 @@ const ol = {
15502
15511
  { name: "persist", type: { kind: "boolean", nullable: !0 }, description: "Whether to persist as user preference" }
15503
15512
  ]
15504
15513
  };
15505
- function nl(e, l) {
15514
+ function ll(e, l) {
15506
15515
  if (typeof window > "u" || !window.localStorage || typeof e != "string")
15507
15516
  return !1;
15508
15517
  const i = e.trim().toLowerCase();
@@ -15511,12 +15520,12 @@ function nl(e, l) {
15511
15520
  const s = l === void 0 ? !0 : !!l, d = window.localStorage;
15512
15521
  s ? d.setItem(er, i) : d.removeItem(er), d.setItem(pn, i);
15513
15522
  try {
15514
- window.dispatchEvent(new CustomEvent(el, { detail: { mode: i } }));
15523
+ window.dispatchEvent(new CustomEvent(rl, { detail: { mode: i } }));
15515
15524
  } catch {
15516
15525
  }
15517
15526
  return Tn(i), !0;
15518
15527
  }
15519
- const ll = {
15528
+ const il = {
15520
15529
  name: "ikon.client.getLocation",
15521
15530
  description: "Retrieve the current geolocation coordinates from the browser",
15522
15531
  returnType: {
@@ -15526,7 +15535,7 @@ const ll = {
15526
15535
  nullable: !0
15527
15536
  }
15528
15537
  };
15529
- async function il() {
15538
+ async function sl() {
15530
15539
  if (typeof navigator > "u" || !navigator.geolocation)
15531
15540
  return null;
15532
15541
  try {
@@ -15545,7 +15554,7 @@ async function il() {
15545
15554
  return null;
15546
15555
  }
15547
15556
  }
15548
- const sl = {
15557
+ const dl = {
15549
15558
  name: "ikon.client.share",
15550
15559
  description: "Open the Web Share dialog when supported",
15551
15560
  returnType: { kind: "boolean" },
@@ -15555,7 +15564,7 @@ const sl = {
15555
15564
  { name: "url", type: { kind: "string", nullable: !0 }, description: "Share URL" }
15556
15565
  ]
15557
15566
  };
15558
- async function dl(e, l, i) {
15567
+ async function al(e, l, i) {
15559
15568
  if (typeof navigator > "u" || typeof navigator.share != "function")
15560
15569
  return !1;
15561
15570
  const s = typeof e == "string" ? e.trim() : "", d = typeof l == "string" ? l.trim() : "", a = typeof i == "string" ? i.trim() : "", c = {};
@@ -15567,13 +15576,13 @@ async function dl(e, l, i) {
15567
15576
  return !1;
15568
15577
  }
15569
15578
  }
15570
- const al = {
15579
+ const cl = {
15571
15580
  name: "ikon.client.pickContacts",
15572
15581
  description: "Launch the native contact picker when available",
15573
15582
  returnType: { kind: "string", nullable: !0 },
15574
15583
  parameters: [{ name: "multiple", type: { kind: "boolean", nullable: !0 }, description: "Allow multiple contacts" }]
15575
15584
  };
15576
- async function cl(e) {
15585
+ async function ul(e) {
15577
15586
  if (typeof navigator > "u")
15578
15587
  return null;
15579
15588
  const l = navigator, i = l.contacts?.select;
@@ -15592,33 +15601,33 @@ async function cl(e) {
15592
15601
  return null;
15593
15602
  }
15594
15603
  }
15595
- const ul = {
15604
+ const fl = {
15596
15605
  name: "ikon.client.getLanguage",
15597
15606
  description: "Get the browser language preference",
15598
15607
  returnType: { kind: "string" }
15599
15608
  };
15600
- function fl() {
15609
+ function wl() {
15601
15610
  return typeof navigator > "u" ? "en-US" : navigator.language || "en-US";
15602
15611
  }
15603
- const wl = {
15612
+ const hl = {
15604
15613
  name: "ikon.client.getTimezone",
15605
15614
  description: "Get the browser timezone (IANA format)",
15606
15615
  returnType: { kind: "string" }
15607
15616
  };
15608
- function hl() {
15617
+ function Il() {
15609
15618
  try {
15610
15619
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
15611
15620
  } catch {
15612
15621
  return "UTC";
15613
15622
  }
15614
15623
  }
15615
- const Il = {
15624
+ const pl = {
15616
15625
  name: "ikon.client.copyToClipboard",
15617
15626
  description: "Copy text to clipboard",
15618
15627
  returnType: { kind: "boolean" },
15619
15628
  parameters: [{ name: "text", type: { kind: "string" }, description: "Text to copy" }]
15620
15629
  };
15621
- async function pl(e) {
15630
+ async function Tl(e) {
15622
15631
  if (typeof navigator > "u" || !navigator.clipboard || typeof e != "string")
15623
15632
  return !1;
15624
15633
  try {
@@ -15627,15 +15636,15 @@ async function pl(e) {
15627
15636
  return !1;
15628
15637
  }
15629
15638
  }
15630
- const Tl = {
15639
+ const Fl = {
15631
15640
  name: "ikon.client.getUrl",
15632
15641
  description: "Get the current browser URL path and query string",
15633
15642
  returnType: { kind: "string", nullable: !0 }
15634
15643
  };
15635
- function Fl() {
15644
+ function bl() {
15636
15645
  return typeof window > "u" ? null : window.location.pathname + window.location.search;
15637
15646
  }
15638
- const bl = {
15647
+ const ml = {
15639
15648
  name: "ikon.client.setUrl",
15640
15649
  description: "Update the browser URL without triggering a page reload",
15641
15650
  returnType: { kind: "boolean" },
@@ -15644,7 +15653,7 @@ const bl = {
15644
15653
  { name: "replace", type: { kind: "boolean", nullable: !0 }, description: "If true, replaces current history entry instead of adding new one" }
15645
15654
  ]
15646
15655
  };
15647
- function ml(e, l) {
15656
+ function yl(e, l) {
15648
15657
  if (typeof window > "u" || !window.history || typeof e != "string")
15649
15658
  return !1;
15650
15659
  const i = e.trim();
@@ -15656,13 +15665,13 @@ function ml(e, l) {
15656
15665
  return !1;
15657
15666
  }
15658
15667
  }
15659
- const yl = {
15668
+ const El = {
15660
15669
  name: "ikon.client.vibrate",
15661
15670
  description: "Trigger haptic feedback on supported devices",
15662
15671
  returnType: { kind: "boolean" },
15663
15672
  parameters: [{ name: "pattern", type: { kind: "string" }, description: 'Duration in ms, or comma-separated pattern (e.g., "200" or "100,50,100")' }]
15664
15673
  };
15665
- function El(e) {
15674
+ function Nl(e) {
15666
15675
  if (typeof navigator > "u" || !navigator.vibrate || typeof e != "string")
15667
15676
  return !1;
15668
15677
  try {
@@ -15672,7 +15681,7 @@ function El(e) {
15672
15681
  return !1;
15673
15682
  }
15674
15683
  }
15675
- const Nl = {
15684
+ const gl = {
15676
15685
  name: "ikon.client.playSound",
15677
15686
  description: "Play audio from a URL",
15678
15687
  returnType: { kind: "boolean" },
@@ -15681,7 +15690,7 @@ const Nl = {
15681
15690
  { name: "volume", type: { kind: "number", nullable: !0 }, description: "Volume level from 0.0 to 1.0" }
15682
15691
  ]
15683
15692
  };
15684
- async function gl(e, l) {
15693
+ async function Ml(e, l) {
15685
15694
  if (typeof window > "u" || typeof Audio > "u" || typeof e != "string" || !e.trim())
15686
15695
  return !1;
15687
15696
  try {
@@ -15691,7 +15700,7 @@ async function gl(e, l) {
15691
15700
  return !1;
15692
15701
  }
15693
15702
  }
15694
- const Ml = {
15703
+ const kl = {
15695
15704
  name: "ikon.client.showNotification",
15696
15705
  description: "Show a browser notification (requests permission if needed)",
15697
15706
  returnType: { kind: "boolean" },
@@ -15701,7 +15710,7 @@ const Ml = {
15701
15710
  { name: "icon", type: { kind: "string", nullable: !0 }, description: "URL of notification icon" }
15702
15711
  ]
15703
15712
  };
15704
- async function kl(e, l, i) {
15713
+ async function Sl(e, l, i) {
15705
15714
  if (typeof window > "u" || !("Notification" in window) || typeof e != "string" || !e.trim())
15706
15715
  return !1;
15707
15716
  try {
@@ -15714,12 +15723,12 @@ async function kl(e, l, i) {
15714
15723
  return !1;
15715
15724
  }
15716
15725
  }
15717
- const Sl = {
15726
+ const Pl = {
15718
15727
  name: "ikon.client.requestFullscreen",
15719
15728
  description: "Enter fullscreen mode",
15720
15729
  returnType: { kind: "boolean" }
15721
15730
  };
15722
- async function Pl() {
15731
+ async function Cl() {
15723
15732
  if (typeof document > "u" || !document.documentElement)
15724
15733
  return !1;
15725
15734
  try {
@@ -15729,12 +15738,12 @@ async function Pl() {
15729
15738
  return !1;
15730
15739
  }
15731
15740
  }
15732
- const Cl = {
15741
+ const _l = {
15733
15742
  name: "ikon.client.exitFullscreen",
15734
15743
  description: "Exit fullscreen mode",
15735
15744
  returnType: { kind: "boolean" }
15736
15745
  };
15737
- function _l() {
15746
+ function Ol() {
15738
15747
  if (typeof document > "u")
15739
15748
  return !1;
15740
15749
  try {
@@ -15744,7 +15753,7 @@ function _l() {
15744
15753
  return !1;
15745
15754
  }
15746
15755
  }
15747
- const Ol = {
15756
+ const Vl = {
15748
15757
  name: "ikon.client.downloadFile",
15749
15758
  description: "Trigger a file download",
15750
15759
  returnType: { kind: "boolean" },
@@ -15753,7 +15762,7 @@ const Ol = {
15753
15762
  { name: "filename", type: { kind: "string", nullable: !0 }, description: "Suggested filename for the download" }
15754
15763
  ]
15755
15764
  };
15756
- function Vl(e, l) {
15765
+ function Ll(e, l) {
15757
15766
  if (typeof document > "u" || typeof e != "string" || !e.trim())
15758
15767
  return !1;
15759
15768
  try {
@@ -15764,13 +15773,13 @@ function Vl(e, l) {
15764
15773
  }
15765
15774
  }
15766
15775
  let ce = null;
15767
- const Ll = {
15776
+ const Dl = {
15768
15777
  name: "ikon.client.keepScreenAwake",
15769
15778
  description: "Prevent or allow the screen to sleep",
15770
15779
  returnType: { kind: "boolean" },
15771
15780
  parameters: [{ name: "enabled", type: { kind: "boolean" }, description: "Whether to keep the screen awake" }]
15772
15781
  };
15773
- async function Dl(e) {
15782
+ async function vl(e) {
15774
15783
  if (typeof navigator > "u" || !("wakeLock" in navigator))
15775
15784
  return !1;
15776
15785
  try {
@@ -15779,15 +15788,15 @@ async function Dl(e) {
15779
15788
  return !1;
15780
15789
  }
15781
15790
  }
15782
- const vl = {
15791
+ const jl = {
15783
15792
  name: "ikon.client.getVisibility",
15784
15793
  description: "Get the current page visibility state",
15785
15794
  returnType: { kind: "string", nullable: !0 }
15786
15795
  };
15787
- function jl() {
15796
+ function Hl() {
15788
15797
  return typeof document > "u" ? null : document.visibilityState || null;
15789
15798
  }
15790
- const Hl = {
15799
+ const xl = {
15791
15800
  name: "ikon.client.scrollTo",
15792
15801
  description: "Scroll the page to a specific position",
15793
15802
  returnType: { kind: "boolean" },
@@ -15797,7 +15806,7 @@ const Hl = {
15797
15806
  { name: "smooth", type: { kind: "boolean", nullable: !0 }, description: "Whether to animate the scroll" }
15798
15807
  ]
15799
15808
  };
15800
- function xl(e, l, i) {
15809
+ function Wl(e, l, i) {
15801
15810
  if (typeof window > "u" || typeof e != "number" || typeof l != "number")
15802
15811
  return !1;
15803
15812
  try {
@@ -15810,12 +15819,12 @@ function xl(e, l, i) {
15810
15819
  return !1;
15811
15820
  }
15812
15821
  }
15813
- const Wl = {
15822
+ const Rl = {
15814
15823
  name: "ikon.client.getBatteryLevel",
15815
15824
  description: "Get the current battery level (0-100)",
15816
15825
  returnType: { kind: "number", nullable: !0 }
15817
15826
  };
15818
- async function Rl() {
15827
+ async function Gl() {
15819
15828
  if (typeof navigator > "u" || !("getBattery" in navigator))
15820
15829
  return null;
15821
15830
  try {
@@ -15825,48 +15834,48 @@ async function Rl() {
15825
15834
  return null;
15826
15835
  }
15827
15836
  }
15828
- const Gl = {
15837
+ const Kl = {
15829
15838
  name: "ikon.client.getNetworkType",
15830
15839
  description: "Get the current network connection type",
15831
15840
  returnType: { kind: "string", nullable: !0 }
15832
15841
  };
15833
- function Kl() {
15842
+ function Jl() {
15834
15843
  if (typeof navigator > "u")
15835
15844
  return null;
15836
15845
  const e = navigator.connection;
15837
15846
  return e && (e.effectiveType || e.type) || null;
15838
15847
  }
15839
- const Jl = [
15840
- { definition: rl, handler: tl },
15841
- { definition: ol, handler: nl },
15842
- { definition: ll, handler: il },
15843
- { definition: sl, handler: dl },
15844
- { definition: al, handler: cl },
15845
- { definition: ul, handler: fl },
15846
- { definition: wl, handler: hl },
15847
- { definition: Il, handler: pl },
15848
- { definition: Tl, handler: Fl },
15849
- { definition: bl, handler: ml },
15850
- { definition: yl, handler: El },
15851
- { definition: Nl, handler: gl },
15852
- { definition: Ml, handler: kl },
15853
- { definition: Sl, handler: Pl },
15854
- { definition: Cl, handler: _l },
15855
- { definition: Ol, handler: Vl },
15856
- { definition: Ll, handler: Dl },
15857
- { definition: vl, handler: jl },
15858
- { definition: Hl, handler: xl },
15859
- { definition: Wl, handler: Rl },
15860
- { definition: Gl, handler: Kl }
15848
+ const $l = [
15849
+ { definition: tl, handler: ol },
15850
+ { definition: nl, handler: ll },
15851
+ { definition: il, handler: sl },
15852
+ { definition: dl, handler: al },
15853
+ { definition: cl, handler: ul },
15854
+ { definition: fl, handler: wl },
15855
+ { definition: hl, handler: Il },
15856
+ { definition: pl, handler: Tl },
15857
+ { definition: Fl, handler: bl },
15858
+ { definition: ml, handler: yl },
15859
+ { definition: El, handler: Nl },
15860
+ { definition: gl, handler: Ml },
15861
+ { definition: kl, handler: Sl },
15862
+ { definition: Pl, handler: Cl },
15863
+ { definition: _l, handler: Ol },
15864
+ { definition: Vl, handler: Ll },
15865
+ { definition: Dl, handler: vl },
15866
+ { definition: jl, handler: Hl },
15867
+ { definition: xl, handler: Wl },
15868
+ { definition: Rl, handler: Gl },
15869
+ { definition: Kl, handler: Jl }
15861
15870
  ];
15862
- function $l(e) {
15863
- const l = Jl.map(({ definition: i, handler: s }) => e.register(i, s));
15871
+ function zl(e) {
15872
+ const l = $l.map(({ definition: i, handler: s }) => e.register(i, s));
15864
15873
  return () => l.forEach((i) => i());
15865
15874
  }
15866
15875
  function Bo() {
15867
15876
  return typeof window < "u" && typeof navigator < "u";
15868
15877
  }
15869
- const zl = new Uint8Array(0);
15878
+ const Yl = new Uint8Array(0);
15870
15879
  function ve(e) {
15871
15880
  switch (e.kind) {
15872
15881
  case "array":
@@ -15926,7 +15935,7 @@ function Fn(e, l) {
15926
15935
  }
15927
15936
  return JSON.stringify(e);
15928
15937
  }
15929
- function Yl(e, l) {
15938
+ function Xl(e, l) {
15930
15939
  const i = (e.parameters ?? []).map((a) => {
15931
15940
  const c = ve(a.type), f = Object.prototype.hasOwnProperty.call(a, "defaultValue"), w = f ? Fn(a.defaultValue, c) : "";
15932
15941
  return {
@@ -15953,7 +15962,7 @@ function Yl(e, l) {
15953
15962
  TypeName: pe(a.descriptor),
15954
15963
  HasDefaultValue: a.hasDefaultValue,
15955
15964
  DefaultValueJson: a.defaultValueJson,
15956
- DefaultValueData: zl,
15965
+ DefaultValueData: Yl,
15957
15966
  IsEnumerable: !1,
15958
15967
  EnumerableItemTypeName: "",
15959
15968
  Description: a.description ?? ""
@@ -15967,11 +15976,11 @@ function Yl(e, l) {
15967
15976
  returnType: s
15968
15977
  };
15969
15978
  }
15970
- const Uo = z("FunctionRegistry"), Xl = new Uint8Array(0);
15971
- function Ql(e) {
15979
+ const Uo = z("FunctionRegistry"), Ql = new Uint8Array(0);
15980
+ function Zl(e) {
15972
15981
  return !e || typeof e != "object" ? !1 : e.data instanceof Uint8Array;
15973
15982
  }
15974
- class Zl {
15983
+ class ql {
15975
15984
  functions = /* @__PURE__ */ new Map();
15976
15985
  config = null;
15977
15986
  isConnected = !1;
@@ -15993,7 +16002,7 @@ class Zl {
15993
16002
  * If already connected, sends registration to server immediately.
15994
16003
  */
15995
16004
  register(l, i) {
15996
- const s = Yl(l, i);
16005
+ const s = Xl(l, i);
15997
16006
  return this.functions.set(l.name, s), this.isConnected && this.config && this.sendRegistration(s), () => this.unregister(l.name);
15998
16007
  }
15999
16008
  /**
@@ -16072,8 +16081,8 @@ class Zl {
16072
16081
  t === void 0 || t === "" ? o.hasDefaultValue ? d.push(Ao(o.defaultValueJson, o.descriptor)) : d.push(void 0) : d.push(Ao(t, o.descriptor));
16073
16082
  }
16074
16083
  const a = await l.handler(...d);
16075
- let c = a, f = Xl;
16076
- Ql(a) && (c = a.value, f = new Uint8Array(a.data));
16084
+ let c = a, f = Ql;
16085
+ Zl(a) && (c = a.value, f = new Uint8Array(a.data));
16077
16086
  const w = Fn(c, l.returnType);
16078
16087
  this.sendResult(i.CallId, i.InstanceId, s, l, w, f);
16079
16088
  } catch (d) {
@@ -16132,7 +16141,7 @@ class Zl {
16132
16141
  this.config.sendProtocolMessage(a);
16133
16142
  }
16134
16143
  }
16135
- function ql(e, l) {
16144
+ function Bl(e, l) {
16136
16145
  return { value: e, data: l };
16137
16146
  }
16138
16147
  function Ke(e) {
@@ -16148,7 +16157,7 @@ const Ge = {
16148
16157
  StartAudioCapture: "ikon.client.startAudioCapture",
16149
16158
  StopCapture: "ikon.client.stopCapture",
16150
16159
  CaptureImage: "ikon.client.captureImage"
16151
- }, Bl = {
16160
+ }, Al = {
16152
16161
  name: Ge.StartVideoCapture,
16153
16162
  description: "Start camera or screen capture and stream video frames to the server",
16154
16163
  returnType: { kind: "string" },
@@ -16156,26 +16165,26 @@ const Ge = {
16156
16165
  { name: "source", type: { kind: "string", nullable: !0 }, description: "camera or screen" },
16157
16166
  { name: "optionsJson", type: { kind: "string", nullable: !0 }, description: "JSON encoded capture options" }
16158
16167
  ]
16159
- }, Al = {
16168
+ }, Ul = {
16160
16169
  name: Ge.StartAudioCapture,
16161
16170
  description: "Start microphone capture and stream audio frames to the server",
16162
16171
  returnType: { kind: "string" },
16163
16172
  parameters: [{ name: "optionsJson", type: { kind: "string", nullable: !0 }, description: "JSON encoded capture options" }]
16164
- }, Ul = {
16173
+ }, ei = {
16165
16174
  name: Ge.StopCapture,
16166
16175
  description: "Stop a previously started capture by captureId",
16167
16176
  returnType: { kind: "boolean" },
16168
16177
  parameters: [{ name: "captureId", type: { kind: "string" }, description: "Capture ID to stop" }]
16169
- }, ei = {
16178
+ }, ri = {
16170
16179
  name: Ge.CaptureImage,
16171
16180
  description: "Capture a single image from the camera and return metadata (JSON) plus binary image data",
16172
16181
  returnType: { kind: "string" },
16173
16182
  parameters: [{ name: "optionsJson", type: { kind: "string", nullable: !0 }, description: "JSON encoded capture options" }]
16174
16183
  };
16175
- function ri(e, l) {
16184
+ function ti(e, l) {
16176
16185
  const i = [];
16177
16186
  return i.push(
16178
- e.register(Bl, async (s, d) => {
16187
+ e.register(Al, async (s, d) => {
16179
16188
  const a = l.mediaCapture;
16180
16189
  if (!a)
16181
16190
  throw new Error("Media capture is not available in this environment");
@@ -16183,7 +16192,7 @@ function ri(e, l) {
16183
16192
  return ((typeof s == "string" && s.trim().toLowerCase() === "screen" ? "screen" : "camera") === "screen" ? await a.video.startScreen({ userGesture: !1, options: c, constraints: c?.constraints }) : await a.video.startCamera({ userGesture: !1, options: c, constraints: c?.constraints })).captureId;
16184
16193
  })
16185
16194
  ), i.push(
16186
- e.register(Al, async (s) => {
16195
+ e.register(Ul, async (s) => {
16187
16196
  const d = l.mediaCapture;
16188
16197
  if (!d)
16189
16198
  throw new Error("Media capture is not available in this environment");
@@ -16191,7 +16200,7 @@ function ri(e, l) {
16191
16200
  return (await d.audio.startMic({ userGesture: !1, options: a, constraints: a?.constraints })).captureId;
16192
16201
  })
16193
16202
  ), i.push(
16194
- e.register(Ul, async (s) => {
16203
+ e.register(ei, async (s) => {
16195
16204
  const d = l.mediaCapture;
16196
16205
  if (!d || typeof s != "string" || !s.trim())
16197
16206
  return !1;
@@ -16199,7 +16208,7 @@ function ri(e, l) {
16199
16208
  return a || c;
16200
16209
  })
16201
16210
  ), i.push(
16202
- e.register(ei, async (s) => {
16211
+ e.register(ri, async (s) => {
16203
16212
  const d = l.mediaCapture;
16204
16213
  if (!d)
16205
16214
  throw new Error("Media capture is not available in this environment");
@@ -16211,16 +16220,16 @@ function ri(e, l) {
16211
16220
  width: a.width,
16212
16221
  height: a.height
16213
16222
  }), f = JSON.stringify({ mime: c.mime, width: c.width, height: c.height });
16214
- return ql(f, c.data);
16223
+ return Bl(f, c.data);
16215
16224
  })
16216
16225
  ), () => {
16217
16226
  for (const s of i)
16218
16227
  s();
16219
16228
  };
16220
16229
  }
16221
- const ti = globalThis;
16230
+ const oi = globalThis;
16222
16231
  function Ee() {
16223
- if (typeof SharedArrayBuffer > "u" || typeof Atomics > "u" || ti.crossOriginIsolated === !1)
16232
+ if (typeof SharedArrayBuffer > "u" || typeof Atomics > "u" || oi.crossOriginIsolated === !1)
16224
16233
  return !1;
16225
16234
  try {
16226
16235
  new SharedArrayBuffer(1);
@@ -16232,21 +16241,30 @@ function Ee() {
16232
16241
  function bn(e) {
16233
16242
  return typeof AudioWorkletNode != "function" ? !1 : typeof e.audioWorklet?.addModule == "function";
16234
16243
  }
16235
- const x = z("IkonAudioPlayback"), oi = () => {
16244
+ function ni(e) {
16245
+ return new Worker(
16246
+ "/assets/audio-worker-Ci3tYX2B.js",
16247
+ {
16248
+ type: "module",
16249
+ name: e?.name
16250
+ }
16251
+ );
16252
+ }
16253
+ const x = z("IkonAudioPlayback"), li = () => {
16236
16254
  const e = globalThis.navigator;
16237
16255
  if (!e) return !1;
16238
16256
  const l = e.platform ?? e.userAgentData?.platform ?? "", i = e.userAgent ?? "", s = e.maxTouchPoints, d = /iPad|iPhone|iPod/.test(l), a = /iPad|iPhone|iPod/.test(i), c = l === "MacIntel" && typeof s == "number" && s > 1;
16239
16257
  return d || a || c;
16240
- }, ni = {
16258
+ }, ii = {
16241
16259
  enabled: !0
16242
16260
  }, Je = {
16243
16261
  enabled: !1,
16244
16262
  statusInterval: 5
16245
- }, ue = 48e3, J = 2, li = 2, en = 512;
16263
+ }, ue = 48e3, J = 2, si = 2, en = 512;
16246
16264
  function fe(e) {
16247
16265
  return e instanceof Error ? `${e.name}: ${e.message}` : String(e);
16248
16266
  }
16249
- function ii(e) {
16267
+ function di(e) {
16250
16268
  return `
16251
16269
  // Jitter buffer constants
16252
16270
  const OUTPUT_SAMPLE_RATE_HZ = ${e.outputSampleRateHz};
@@ -16554,11 +16572,6 @@ class IkonAudioPlayerProcessor extends AudioWorkletProcessor {
16554
16572
  if (typeof data.frameSizeInterleavedSamples === 'number' && data.frameSizeInterleavedSamples > 0) {
16555
16573
  stream.frameSamplesPerChannel = Math.max(1, Math.round(data.frameSizeInterleavedSamples / this.channels));
16556
16574
  }
16557
-
16558
- // Mark stream as ending if this is the last frame
16559
- if (data.isLast) {
16560
- stream.streamEnding = true;
16561
- }
16562
16575
  return;
16563
16576
  }
16564
16577
  };
@@ -16839,7 +16852,7 @@ class Ir {
16839
16852
  config;
16840
16853
  enabled = !1;
16841
16854
  stateUnsubscribe = null;
16842
- isIos = oi();
16855
+ isIos = li();
16843
16856
  recreateOnNextResume = !1;
16844
16857
  boundVisibilityChange = null;
16845
16858
  unlockHandler = null;
@@ -16908,7 +16921,7 @@ class Ir {
16908
16921
  const l = this.config.output ?? {};
16909
16922
  return {
16910
16923
  multiStreamNormalization: {
16911
- enabled: l.multiStreamNormalization?.enabled ?? ni.enabled
16924
+ enabled: l.multiStreamNormalization?.enabled ?? ii.enabled
16912
16925
  },
16913
16926
  diagnostics: {
16914
16927
  enabled: l.diagnostics?.enabled ?? Je.enabled,
@@ -17025,7 +17038,7 @@ class Ir {
17025
17038
  } catch {
17026
17039
  }
17027
17040
  this.workletModuleKey = a, this.workletReady = null, this.workletModuleUrl = URL.createObjectURL(
17028
- new Blob([ii({ outputSampleRateHz: this.outputSampleRateHz, outputChannels: J })], { type: "text/javascript" })
17041
+ new Blob([di({ outputSampleRateHz: this.outputSampleRateHz, outputChannels: J })], { type: "text/javascript" })
17029
17042
  );
17030
17043
  }
17031
17044
  this.workletReady || (this.workletReady = l.audioWorklet.addModule(this.workletModuleUrl).catch((h) => {
@@ -17127,7 +17140,7 @@ class Ir {
17127
17140
  l.totalSamples < 0 && (l.totalSamples = 0), this.compactFallbackQueue(l);
17128
17141
  }
17129
17142
  trimFallbackQueue(l) {
17130
- const i = this.outputSampleRateHz * J * li, s = l.totalSamples - i;
17143
+ const i = this.outputSampleRateHz * J * si, s = l.totalSamples - i;
17131
17144
  s <= 0 || this.skipFromFallbackQueue(l, s);
17132
17145
  }
17133
17146
  stopScriptProcessorDiagnostics() {
@@ -17265,11 +17278,7 @@ class Ir {
17265
17278
  }
17266
17279
  this.protocolPort = l;
17267
17280
  try {
17268
- this.audioWorker = new Worker(new URL(
17269
- /* @vite-ignore */
17270
- "/assets/audio-worker-Ci3tYX2B.js",
17271
- import.meta.url
17272
- ), { type: "module" });
17281
+ this.audioWorker = new ni();
17273
17282
  } catch (r) {
17274
17283
  x.warn(`Failed to create audio worker: ${fe(r)}`), this.protocolPort.close(), this.protocolPort = null;
17275
17284
  return;
@@ -17432,11 +17441,20 @@ class Ir {
17432
17441
  }));
17433
17442
  }
17434
17443
  }
17444
+ function ai(e) {
17445
+ return new Worker(
17446
+ "/assets/video-worker-BoOfB8qz.js",
17447
+ {
17448
+ type: "module",
17449
+ name: e?.name
17450
+ }
17451
+ );
17452
+ }
17435
17453
  const ee = z("IkonVideoPlayback");
17436
17454
  function $e(e) {
17437
17455
  return e instanceof Error ? `${e.name}: ${e.message}` : String(e);
17438
17456
  }
17439
- class si {
17457
+ class ci {
17440
17458
  client;
17441
17459
  config;
17442
17460
  enabled = !0;
@@ -17526,11 +17544,7 @@ class si {
17526
17544
  }
17527
17545
  let l;
17528
17546
  try {
17529
- l = new Worker(new URL(
17530
- /* @vite-ignore */
17531
- "/assets/video-worker-BoOfB8qz.js",
17532
- import.meta.url
17533
- ), { type: "module" });
17547
+ l = new ai();
17534
17548
  } catch (i) {
17535
17549
  ee.warn(`Failed to create video worker: ${$e(i)}`);
17536
17550
  return;
@@ -17668,11 +17682,11 @@ class si {
17668
17682
  }));
17669
17683
  }
17670
17684
  }
17671
- class di {
17685
+ class ui {
17672
17686
  audio;
17673
17687
  video;
17674
17688
  constructor(l, i) {
17675
- this.audio = new Ir(l, i?.audio), this.video = new si(l, i?.video);
17689
+ this.audio = new Ir(l, i?.audio), this.video = new ci(l, i?.video);
17676
17690
  }
17677
17691
  /**
17678
17692
  * Releases media resources (workers, audio graph, decoders).
@@ -17683,7 +17697,7 @@ class di {
17683
17697
  this.audio.dispose(), this.video.dispose();
17684
17698
  }
17685
17699
  }
17686
- class ai {
17700
+ class fi {
17687
17701
  static getStorageForCapacity(l, i) {
17688
17702
  const s = Int32Array.BYTES_PER_ELEMENT * 2, d = i.BYTES_PER_ELEMENT * l;
17689
17703
  return new SharedArrayBuffer(s + d);
@@ -17737,12 +17751,21 @@ class ai {
17737
17751
  return s = (s + i) % this.capacity, Atomics.store(this.readWrite, 0, s), i;
17738
17752
  }
17739
17753
  }
17740
- const ci = z("IkonAudioCapture");
17741
- function ui() {
17754
+ function wi(e) {
17755
+ return new Worker(
17756
+ "/assets/audio-capture-worker-C5hNMTF7.js",
17757
+ {
17758
+ type: "module",
17759
+ name: e?.name
17760
+ }
17761
+ );
17762
+ }
17763
+ const hi = z("IkonAudioCapture");
17764
+ function Ii() {
17742
17765
  const e = globalThis.crypto;
17743
17766
  return e?.randomUUID ? e.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
17744
17767
  }
17745
- function fi() {
17768
+ function pi() {
17746
17769
  return `
17747
17770
  class RingBuffer {
17748
17771
  static getStorageForCapacity(capacity, type) {
@@ -17853,7 +17876,7 @@ class IkonAudioCaptureProcessor extends AudioWorkletProcessor {
17853
17876
  registerProcessor('ikon-audio-capture', IkonAudioCaptureProcessor);
17854
17877
  `;
17855
17878
  }
17856
- class wi {
17879
+ class Ti {
17857
17880
  constructor(l) {
17858
17881
  this.client = l;
17859
17882
  }
@@ -17872,14 +17895,10 @@ class wi {
17872
17895
  ensureWorker() {
17873
17896
  if (this.worker)
17874
17897
  return this.worker;
17875
- const l = new Worker(new URL(
17876
- /* @vite-ignore */
17877
- "/assets/audio-capture-worker-C5hNMTF7.js",
17878
- import.meta.url
17879
- ), { type: "module" });
17898
+ const l = new wi();
17880
17899
  return this.worker = l, l.addEventListener("message", (i) => {
17881
17900
  const s = i.data;
17882
- s?.type === "error" && ci.warn(`Audio capture worker error: ${s.error?.name ?? "Error"} ${s.error?.message ?? ""}`);
17901
+ s?.type === "error" && hi.warn(`Audio capture worker error: ${s.error?.name ?? "Error"} ${s.error?.message ?? ""}`);
17883
17902
  }), l;
17884
17903
  }
17885
17904
  ensureSendPort() {
@@ -17911,7 +17930,7 @@ class wi {
17911
17930
  async ensureWorklet(l) {
17912
17931
  if (!bn(l))
17913
17932
  throw new Error("AudioWorklet is not supported in this browser");
17914
- this.workletModuleUrl || (this.workletModuleUrl = URL.createObjectURL(new Blob([fi()], { type: "text/javascript" }))), (!this.workletReady || this.workletContext !== l) && (this.workletContext = l, this.workletReady = l.audioWorklet.addModule(this.workletModuleUrl));
17933
+ this.workletModuleUrl || (this.workletModuleUrl = URL.createObjectURL(new Blob([pi()], { type: "text/javascript" }))), (!this.workletReady || this.workletContext !== l) && (this.workletContext = l, this.workletReady = l.audioWorklet.addModule(this.workletModuleUrl));
17915
17934
  try {
17916
17935
  await this.workletReady;
17917
17936
  } catch (i) {
@@ -17927,13 +17946,13 @@ class wi {
17927
17946
  if (!a)
17928
17947
  throw d.getTracks().forEach((F) => F.stop()), new Error("No audio track available");
17929
17948
  await this.ensureWorklet(s);
17930
- const c = ui(), f = this.allocateTrackId(), w = s.createMediaStreamSource(d), h = s.createGain();
17949
+ const c = Ii(), f = this.allocateTrackId(), w = s.createMediaStreamSource(d), h = s.createGain();
17931
17950
  h.gain.value = 0, h.connect(s.destination);
17932
17951
  const t = Ee() ? "sab" : "pcm";
17933
17952
  let n;
17934
17953
  if (t === "sab") {
17935
17954
  const F = Math.floor(s.sampleRate * 2);
17936
- n = ai.getStorageForCapacity(F, Float32Array);
17955
+ n = fi.getStorageForCapacity(F, Float32Array);
17937
17956
  }
17938
17957
  const u = this.ensureWorker();
17939
17958
  u.postMessage({
@@ -18035,7 +18054,7 @@ class wi {
18035
18054
  }
18036
18055
  }
18037
18056
  }
18038
- async function hi(e, l) {
18057
+ async function Fi(e, l) {
18039
18058
  const i = l.mime ?? "image/jpeg", s = l.quality ?? 0.92;
18040
18059
  if (typeof OffscreenCanvas < "u" && e instanceof OffscreenCanvas)
18041
18060
  try {
@@ -18053,7 +18072,7 @@ async function hi(e, l) {
18053
18072
  );
18054
18073
  });
18055
18074
  }
18056
- class Ii {
18075
+ class bi {
18057
18076
  async acquireCameraStream(l) {
18058
18077
  if (!navigator.mediaDevices)
18059
18078
  throw new Error("Media devices are not available in this environment");
@@ -18090,7 +18109,7 @@ class Ii {
18090
18109
  if (!o)
18091
18110
  throw new Error("2D canvas context unavailable");
18092
18111
  o.drawImage(d, 0, 0, f, w);
18093
- const r = await hi(h, l), t = await r.arrayBuffer();
18112
+ const r = await Fi(h, l), t = await r.arrayBuffer();
18094
18113
  return {
18095
18114
  mime: r.type || l.mime || "image/jpeg",
18096
18115
  width: f,
@@ -18117,18 +18136,27 @@ class Ii {
18117
18136
  }
18118
18137
  }
18119
18138
  }
18139
+ function mi(e) {
18140
+ return new Worker(
18141
+ "/assets/video-capture-worker-OBl3bsvx.js",
18142
+ {
18143
+ type: "module",
18144
+ name: e?.name
18145
+ }
18146
+ );
18147
+ }
18120
18148
  const rn = z("IkonVideoCapture");
18121
- function pi() {
18149
+ function yi() {
18122
18150
  const e = globalThis.crypto;
18123
18151
  return e?.randomUUID ? e.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
18124
18152
  }
18125
- function Ti() {
18153
+ function Ei() {
18126
18154
  const e = globalThis.MediaStreamTrackProcessor;
18127
18155
  if (!e)
18128
18156
  throw new Error("MediaStreamTrackProcessor is not available in this browser");
18129
18157
  return e;
18130
18158
  }
18131
- class Fi {
18159
+ class Ni {
18132
18160
  constructor(l) {
18133
18161
  this.client = l;
18134
18162
  }
@@ -18144,11 +18172,7 @@ class Fi {
18144
18172
  ensureWorker() {
18145
18173
  if (this.worker)
18146
18174
  return this.worker;
18147
- const l = new Worker(new URL(
18148
- /* @vite-ignore */
18149
- "/assets/video-capture-worker-OBl3bsvx.js",
18150
- import.meta.url
18151
- ), { type: "module" });
18175
+ const l = new mi();
18152
18176
  return this.worker = l, l.addEventListener("message", (i) => {
18153
18177
  const s = i.data;
18154
18178
  s?.type === "error" && rn.warn(`Video capture worker error: ${s.error?.name ?? "Error"} ${s.error?.message ?? ""}`);
@@ -18180,10 +18204,10 @@ class Fi {
18180
18204
  if (!i)
18181
18205
  throw new Error("Cannot start video capture before client is connected");
18182
18206
  this.ensurePorts();
18183
- const s = pi(), d = await this.getMediaStream(l), a = d.getVideoTracks()[0];
18207
+ const s = yi(), d = await this.getMediaStream(l), a = d.getVideoTracks()[0];
18184
18208
  if (!a)
18185
18209
  throw d.getTracks().forEach((I) => I.stop()), new Error("No video track available");
18186
- const c = a.getSettings(), f = c.width ?? l.options?.width ?? 1280, w = c.height ?? l.options?.height ?? 720, h = Ti(), r = new h({ track: a }).readable.getReader(), t = this.allocateTrackId(), n = this.ensureWorker();
18210
+ const c = a.getSettings(), f = c.width ?? l.options?.width ?? 1280, w = c.height ?? l.options?.height ?? 720, h = Ei(), r = new h({ track: a }).readable.getReader(), t = this.allocateTrackId(), n = this.ensureWorker();
18187
18211
  n.postMessage({
18188
18212
  type: "start",
18189
18213
  captureId: s,
@@ -18264,12 +18288,12 @@ class Fi {
18264
18288
  }
18265
18289
  }
18266
18290
  }
18267
- class bi {
18291
+ class gi {
18268
18292
  audio;
18269
18293
  video;
18270
18294
  image;
18271
18295
  constructor(l) {
18272
- this.audio = new wi(l), this.video = new Fi(l), this.image = new Ii();
18296
+ this.audio = new Ti(l), this.video = new Ni(l), this.image = new bi();
18273
18297
  }
18274
18298
  dispose() {
18275
18299
  this.audio.dispose(), this.video.dispose();
@@ -18287,7 +18311,7 @@ const on = {
18287
18311
  [K.WebTransportProxy]: 2,
18288
18312
  [K.WebSocketProxy]: 3
18289
18313
  }, ze = "ikon_endpoint_type";
18290
- class mi {
18314
+ class Mi {
18291
18315
  isLocal;
18292
18316
  workingEndpointType = null;
18293
18317
  constructor(l) {
@@ -18349,7 +18373,7 @@ class mi {
18349
18373
  }
18350
18374
  }
18351
18375
  const v = z("IkonClient");
18352
- class xi {
18376
+ class Ji {
18353
18377
  channelManager = null;
18354
18378
  protocolWorker = null;
18355
18379
  workerManagerState = null;
@@ -18401,22 +18425,22 @@ class xi {
18401
18425
  return this._mediaCapture;
18402
18426
  }
18403
18427
  constructor(l) {
18404
- this.config = l, this.slowConnectionThresholdMs = l.timeouts?.slowConnectionThresholdMs ?? Kn, this.connectionTimeoutMs = l.timeouts?.connectionTimeoutMs ?? Jn;
18428
+ this.config = l, this.slowConnectionThresholdMs = l.timeouts?.slowConnectionThresholdMs ?? Jn, this.connectionTimeoutMs = l.timeouts?.connectionTimeoutMs ?? $n;
18405
18429
  const i = [l.local, l.apiKey, l.sessionToken].filter(Boolean).length;
18406
18430
  if (i === 0)
18407
18431
  throw new Error('IkonClient requires one of: "local", "apiKey", or "sessionToken" configuration');
18408
18432
  if (i > 1)
18409
18433
  throw new Error('IkonClient accepts only one of: "local", "apiKey", or "sessionToken" configuration');
18410
- if (this.endpointSelector = new mi({
18434
+ if (this.endpointSelector = new Mi({
18411
18435
  local: l.local
18412
- }), this._functionRegistry = new Zl(), Bo() && !l.disableBrowserFunctions && (this.unregisterBrowserFunctions = $l(this._functionRegistry)), l.media) {
18436
+ }), this._functionRegistry = new ql(), Bo() && !l.disableBrowserFunctions && (this.unregisterBrowserFunctions = zl(this._functionRegistry)), l.media) {
18413
18437
  const s = l.media.audio ? {
18414
18438
  output: l.media.audio.output,
18415
18439
  threading: l.media.audio.threading
18416
18440
  } : void 0, d = l.media.video ? { threading: l.media.video.threading } : void 0;
18417
- this._media = new di(this, { audio: s, video: d }), l.media.audio?.enabled && this._media.audio.setEnabled(!0), l.media.video?.enabled && this._media.video.prepare();
18441
+ this._media = new ui(this, { audio: s, video: d }), l.media.audio?.enabled && this._media.audio.setEnabled(!0), l.media.video?.enabled && this._media.video.prepare();
18418
18442
  }
18419
- Bo() && (this._mediaCapture = new bi(this), this.unregisterMediaCaptureFunctions = ri(this._functionRegistry, this));
18443
+ Bo() && (this._mediaCapture = new gi(this), this.unregisterMediaCaptureFunctions = ti(this._functionRegistry, this));
18420
18444
  }
18421
18445
  _lastError = void 0;
18422
18446
  /**
@@ -18652,11 +18676,11 @@ class xi {
18652
18676
  async authenticate() {
18653
18677
  const l = this.abortController?.signal;
18654
18678
  if (this.config.local)
18655
- return Bn(this.config.local, l);
18679
+ return An(this.config.local, l);
18656
18680
  if (this.config.apiKey)
18657
- return An(this.config.apiKey, l);
18681
+ return Un(this.config.apiKey, l);
18658
18682
  if (this.config.sessionToken)
18659
- return Un(this.config.sessionToken, l);
18683
+ return el(this.config.sessionToken, l);
18660
18684
  throw new Error("No connection configuration provided (need local, apiKey, or sessionToken)");
18661
18685
  }
18662
18686
  /**
@@ -18758,11 +18782,7 @@ class xi {
18758
18782
  }
18759
18783
  let d;
18760
18784
  try {
18761
- d = new Worker(new URL(
18762
- /* @vite-ignore */
18763
- "/assets/protocol-worker-DZqyPqA2.js",
18764
- import.meta.url
18765
- ), { type: "module" });
18785
+ d = new Vn();
18766
18786
  } catch (o) {
18767
18787
  v.warn(`Failed to create protocol worker, falling back to main thread: ${o}`), await this.connectProtocolOnMainThread(l);
18768
18788
  return;
@@ -18809,7 +18829,7 @@ class xi {
18809
18829
  }
18810
18830
  }
18811
18831
  async connectProtocolOnMainThread(l) {
18812
- this.workerManagerState = null, this.protocolWorker = null, this.channelManager = new Gn({
18832
+ this.workerManagerState = null, this.protocolWorker = null, this.channelManager = new Kn({
18813
18833
  sessionId: this._sessionId,
18814
18834
  keepaliveTimeoutMs: this.config.timeouts?.keepaliveTimeoutMs ?? Yo,
18815
18835
  reconnectBackoffMs: this.config.timeouts?.reconnectBackoffMs ?? Xo,
@@ -18940,117 +18960,117 @@ class xi {
18940
18960
  }
18941
18961
  }
18942
18962
  }
18943
- function Wi(e) {
18963
+ function $i(e) {
18944
18964
  return e === "connecting" || e === "connectingSlow" || e === "reconnecting";
18945
18965
  }
18946
- function Ri(e) {
18966
+ function zi(e) {
18947
18967
  return e === "connected";
18948
18968
  }
18949
- function Gi(e) {
18969
+ function Yi(e) {
18950
18970
  return e === "offline" || e === "offlineError" || e === "idle";
18951
18971
  }
18952
- function Ki(e) {
18972
+ function Xi(e) {
18953
18973
  return e === "offlineError";
18954
18974
  }
18955
18975
  const yn = 1e3, En = dn.INFO;
18956
18976
  let $ = [], rr = yn, Nn = En, tr = null;
18957
- function yi(e) {
18977
+ function ki(e) {
18958
18978
  e.level < Nn || ($.push(e), $.length > rr && ($ = $.slice(-rr)));
18959
18979
  }
18960
- function Ei(e) {
18961
- rr = e?.maxBufferSize ?? yn, Nn = e?.minLevel ?? En, $ = [], Dn(yi);
18980
+ function Si(e) {
18981
+ rr = e?.maxBufferSize ?? yn, Nn = e?.minLevel ?? En, $ = [], vn(ki);
18962
18982
  }
18963
- function Ji(e) {
18983
+ function Qi(e) {
18964
18984
  tr = e;
18965
18985
  }
18966
- function $i() {
18986
+ function Zi() {
18967
18987
  return $;
18968
18988
  }
18969
- function Ni() {
18989
+ function Pi() {
18970
18990
  const e = $;
18971
18991
  return $ = [], e;
18972
18992
  }
18973
- function zi() {
18993
+ function qi() {
18974
18994
  if (!tr || $.length === 0)
18975
18995
  return 0;
18976
- const e = Ni();
18996
+ const e = Pi();
18977
18997
  return tr(e), e.length;
18978
18998
  }
18979
- function Yi() {
18999
+ function Bi() {
18980
19000
  $ = [];
18981
19001
  }
18982
- function Xi() {
19002
+ function Ai() {
18983
19003
  return $.length;
18984
19004
  }
18985
- Ei();
19005
+ Si();
18986
19006
  export {
18987
19007
  H as AuthenticationError,
18988
- Rn as Channel,
18989
- Gn as ChannelManager,
18990
- Mi as ChannelNotFoundError,
19008
+ Gn as Channel,
19009
+ Kn as ChannelManager,
19010
+ _i as ChannelNotFoundError,
18991
19011
  te as ClientReady,
18992
19012
  He as ClientType,
18993
19013
  ar as ConnectionError,
18994
19014
  xe as ContextType,
18995
- mi as EndpointSelector,
19015
+ Mi as EndpointSelector,
18996
19016
  K as EntrypointType,
18997
- Zl as FunctionRegistry,
19017
+ ql as FunctionRegistry,
18998
19018
  Be as GlobalState,
18999
- Li as IKON_AUTH_BASE_URL,
19019
+ xi as IKON_AUTH_BASE_URL,
19000
19020
  qo as IKON_AUTH_URL_DEV,
19001
19021
  Zo as IKON_AUTH_URL_PROD,
19002
19022
  Le as IKON_BACKEND_URL_DEV,
19003
19023
  Ue as IKON_BACKEND_URL_PROD,
19004
- wi as IkonAudioCapture,
19024
+ Ti as IkonAudioCapture,
19005
19025
  Ir as IkonAudioPlayback,
19006
- xi as IkonClient,
19007
- Ii as IkonImageCapture,
19008
- di as IkonMedia,
19009
- bi as IkonMediaCapture,
19010
- Fi as IkonVideoCapture,
19011
- si as IkonVideoPlayback,
19026
+ Ji as IkonClient,
19027
+ bi as IkonImageCapture,
19028
+ ui as IkonMedia,
19029
+ gi as IkonMediaCapture,
19030
+ Ni as IkonVideoCapture,
19031
+ ci as IkonVideoPlayback,
19012
19032
  cr as KeepaliveTimeoutError,
19013
19033
  dn as LogLevel,
19014
- Vn as MaxRetriesExceededError,
19015
- Si as NoChannelsError,
19034
+ Ln as MaxRetriesExceededError,
19035
+ Vi as NoChannelsError,
19016
19036
  j as Opcode,
19017
- Ln as ProvisioningTimeoutError,
19018
- ki as SpaceNotFoundError,
19037
+ Dn as ProvisioningTimeoutError,
19038
+ Oi as SpaceNotFoundError,
19019
19039
  A as TransportError,
19020
19040
  Re as UserType,
19021
- gi as asProtocolMessage,
19022
- Oi as clearDeviceId,
19023
- Yi as clearLogBuffer,
19041
+ Ci as asProtocolMessage,
19042
+ ji as clearDeviceId,
19043
+ Bi as clearLogBuffer,
19024
19044
  z as createLogger,
19025
- ji as deriveAuthUrl,
19026
- vi as deriveBackendType,
19027
- Di as deriveBackendUrl,
19028
- Vi as extractUserIdFromToken,
19029
- zi as flushLogs,
19030
- $i as getBufferedLogs,
19031
- Xi as getLogBufferSize,
19032
- Ci as getLogLevel,
19033
- _i as getLogSink,
19045
+ Gi as deriveAuthUrl,
19046
+ Ri as deriveBackendType,
19047
+ Wi as deriveBackendUrl,
19048
+ Hi as extractUserIdFromToken,
19049
+ qi as flushLogs,
19050
+ Zi as getBufferedLogs,
19051
+ Ai as getLogBufferSize,
19052
+ Di as getLogLevel,
19053
+ vi as getLogSink,
19034
19054
  tn as getOpcodeName,
19035
19055
  fr as getOrCreateDeviceId,
19036
- Ei as initializeLogSink,
19056
+ Si as initializeLogSink,
19037
19057
  bn as isAudioWorkletSupported,
19038
19058
  Bo as isBrowserEnvironment,
19039
19059
  wr as isCloudEnvironment,
19040
- Ri as isConnected,
19041
- Wi as isConnecting,
19042
- Ki as isError,
19043
- Gi as isOffline,
19060
+ zi as isConnected,
19061
+ $i as isConnecting,
19062
+ Xi as isError,
19063
+ Yi as isOffline,
19044
19064
  Ee as isSharedArrayBufferSupported,
19045
19065
  an as isWebTransportSupported,
19046
- Hi as parseUrlParams,
19066
+ Ki as parseUrlParams,
19047
19067
  Ne as readOpcode,
19048
19068
  ye as readOpcodeGroup,
19049
19069
  U as readProtocolMessageHeaders,
19050
- $l as registerBrowserFunctions,
19051
- Pi as setLogLevel,
19052
- Dn as setLogSink,
19053
- Ji as setSendLogsCallback,
19054
- Ni as takeBufferedLogs,
19055
- ql as withResultData
19070
+ zl as registerBrowserFunctions,
19071
+ Li as setLogLevel,
19072
+ vn as setLogSink,
19073
+ Qi as setSendLogsCallback,
19074
+ Pi as takeBufferedLogs,
19075
+ Bl as withResultData
19056
19076
  };