@ikonai/sdk 1.3.3 → 1.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -3155,7 +3155,12 @@ async function Jd() {
3155
3155
  return null;
3156
3156
  }
3157
3157
  }
3158
- function Yd() {
3158
+ function Yd(e) {
3159
+ try {
3160
+ window.sessionStorage.setItem(Gd, e);
3161
+ } catch {}
3162
+ }
3163
+ function Xd() {
3159
3164
  try {
3160
3165
  let e = window.sessionStorage.getItem(Gd);
3161
3166
  return window.sessionStorage.removeItem(Gd), e;
@@ -3165,8 +3170,8 @@ function Yd() {
3165
3170
  }
3166
3171
  //#endregion
3167
3172
  //#region src/utils/embedded-oauth.ts
3168
- var Xd = C("EmbeddedAuth"), Zd = "/oauth/popup-callback", Qd = 3e5;
3169
- function $d() {
3173
+ var Zd = C("EmbeddedAuth"), Qd = "/oauth/popup-callback", $d = "ikon-oauth-embedder-request", ef = "ikon_pkce", tf = 1500, nf = 3e5;
3174
+ function rf() {
3170
3175
  if (typeof window > "u") return !1;
3171
3176
  try {
3172
3177
  return window.top !== window.self;
@@ -3174,103 +3179,108 @@ function $d() {
3174
3179
  return !0;
3175
3180
  }
3176
3181
  }
3177
- var ef = "ikon-oauth-embedder-request", tf = 1500;
3178
- async function nf(e, t) {
3179
- let n = await Jd();
3180
- return await new Promise((r) => {
3181
- let i = !1, a = (e) => {
3182
- i || (i = !0, window.removeEventListener("message", o), window.clearTimeout(s), r(e));
3183
- }, o = (e) => {
3182
+ async function af(e, t) {
3183
+ let n = await Jd(), r = Xd();
3184
+ return await new Promise((i) => {
3185
+ let a = !1, o = (e) => {
3186
+ a || (a = !0, window.removeEventListener("message", s), window.clearTimeout(c), i(e));
3187
+ }, s = (e) => {
3184
3188
  if (e.source !== window.parent) return;
3185
3189
  let t = e.data;
3186
- t?.source === "ikon-oauth" && t.type === "ikon-oauth-embedder-accepted" && a(!0);
3190
+ t?.source === "ikon-oauth" && t.type === "ikon-oauth-embedder-accepted" && o(!0);
3187
3191
  };
3188
- window.addEventListener("message", o), window.parent.postMessage({
3192
+ window.addEventListener("message", s), window.parent.postMessage({
3189
3193
  source: "ikon-oauth",
3190
- type: ef,
3194
+ type: $d,
3191
3195
  provider: e,
3192
3196
  spaceId: t,
3193
- codeChallenge: n
3197
+ codeChallenge: n,
3198
+ codeVerifier: r
3194
3199
  }, "*");
3195
- let s = window.setTimeout(() => a(!1), tf);
3200
+ let c = window.setTimeout(() => o(!1), tf);
3196
3201
  });
3197
3202
  }
3198
- async function rf(e, t) {
3199
- if (await nf(e, t)) return !0;
3203
+ async function of(e, t) {
3204
+ let n = window.open("about:blank", "ikon-oauth", "popup,width=520,height=680");
3205
+ if (await af(e, t)) return n?.close(), !0;
3200
3206
  try {
3201
- let { code: n, provider: r } = await af(e, t), i = new URL(window.location.href);
3202
- return i.searchParams.set("ikon_code", n), i.searchParams.set("ikon_provider", r), window.location.replace(i.toString()), !0;
3207
+ let { code: r, provider: i } = await sf(n, e, t), a = new URL(window.location.href);
3208
+ return a.searchParams.set("ikon_code", r), a.searchParams.set("ikon_provider", i), window.location.replace(a.toString()), !0;
3203
3209
  } catch (t) {
3204
- return Xd.warn(`Embedded sign-in with ${e} did not complete: ${t instanceof Error ? t.message : String(t)}`), !1;
3210
+ return Zd.warn(`Embedded sign-in with ${e} did not complete: ${t instanceof Error ? t.message : String(t)}`), !1;
3205
3211
  }
3206
3212
  }
3207
- async function af(e, t) {
3208
- let n = window.open("about:blank", "ikon-oauth", "popup,width=520,height=680");
3209
- if (!n) throw Error("The sign-in window was blocked. Allow pop-ups for this site and try again.");
3213
+ async function sf(e, t, n) {
3214
+ if (!e) throw Error("The sign-in window was blocked. Allow pop-ups for this site and try again.");
3210
3215
  let r;
3211
3216
  try {
3212
3217
  r = await Fd();
3213
- let i = `${r}${Zd}`, a = await Jd(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
3214
- n.location.href = `${r}/oauth/${encodeURIComponent(e)}?space=${encodeURIComponent(t)}&return=${encodeURIComponent(i)}${o}`;
3215
- } catch (e) {
3216
- throw n.close(), e;
3218
+ let i = `${r}${Qd}`, a = await Jd(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
3219
+ e.location.href = `${r}/oauth/${encodeURIComponent(t)}?space=${encodeURIComponent(n)}&return=${encodeURIComponent(i)}${o}`;
3220
+ } catch (t) {
3221
+ throw e.close(), t;
3217
3222
  }
3218
3223
  let i = r;
3219
- return await new Promise((t, r) => {
3224
+ return await new Promise((n, r) => {
3220
3225
  let a = !1, o = (e) => {
3221
3226
  a || (a = !0, window.removeEventListener("message", s), window.clearInterval(c), window.clearTimeout(l), e());
3222
- }, s = (n) => {
3223
- if (n.origin !== i) return;
3224
- let a = n.data;
3227
+ }, s = (e) => {
3228
+ if (e.origin !== i) return;
3229
+ let a = e.data;
3225
3230
  if (!a || a.source !== "ikon-oauth-popup") return;
3226
3231
  if (a.error || !a.code) {
3227
3232
  o(() => r(Error(a.error || "The sign-in did not complete")));
3228
3233
  return;
3229
3234
  }
3230
- let s = a.code, c = a.provider ?? e;
3231
- o(() => t({
3235
+ let s = a.code, c = a.provider ?? t;
3236
+ o(() => n({
3232
3237
  code: s,
3233
3238
  provider: c
3234
3239
  }));
3235
3240
  };
3236
3241
  window.addEventListener("message", s);
3237
3242
  let c = window.setInterval(() => {
3238
- n.closed && o(() => r(/* @__PURE__ */ Error("The sign-in window was closed before it finished")));
3243
+ e.closed && o(() => r(/* @__PURE__ */ Error("The sign-in window was closed before it finished")));
3239
3244
  }, 500), l = window.setTimeout(() => {
3240
3245
  o(() => {
3241
- n.close(), r(/* @__PURE__ */ Error("The sign-in timed out"));
3246
+ e.close(), r(/* @__PURE__ */ Error("The sign-in timed out"));
3242
3247
  });
3243
- }, Qd);
3248
+ }, nf);
3244
3249
  });
3245
3250
  }
3251
+ function cf() {
3252
+ if (typeof window > "u") return;
3253
+ let e = new URLSearchParams(window.location.search).get(ef);
3254
+ e && Yd(e);
3255
+ }
3246
3256
  //#endregion
3247
3257
  //#region src/utils/user-gesture.ts
3248
- function of(e) {
3258
+ function lf(e) {
3249
3259
  if (!e || typeof e != "object") return !1;
3250
3260
  let t = e, n = typeof t.name == "string" ? t.name : "", r = typeof t.message == "string" ? t.message : "";
3251
3261
  return !!(n === "NotAllowedError" || n === "SecurityError" || r.toLowerCase().includes("permission") || r.toLowerCase().includes("user gesture"));
3252
3262
  }
3253
3263
  //#endregion
3254
3264
  //#region src/utils/app-routes.ts
3255
- var sf = ["/ikon", "/api"];
3256
- function cf(e) {
3265
+ var uf = ["/ikon", "/api"];
3266
+ function df(e) {
3257
3267
  if (!e) return !1;
3258
3268
  let t = e.split(/[?#]/)[0], n = t.startsWith("/") ? t : "/" + t;
3259
- return sf.some((e) => n === e || n.startsWith(e + "/"));
3269
+ return uf.some((e) => n === e || n.startsWith(e + "/"));
3260
3270
  }
3261
3271
  //#endregion
3262
3272
  //#region src/functions/browser-functions.ts
3263
- var lf = "ikon-theme", uf = "ikon-theme-user", df = "ikon-theme-change";
3264
- function ff(e) {
3273
+ var ff = "ikon-theme", pf = "ikon-theme-user", mf = "ikon-theme-change";
3274
+ function hf(e) {
3265
3275
  typeof document < "u" && document.documentElement && document.documentElement.setAttribute("data-theme", e);
3266
3276
  }
3267
- function pf() {
3277
+ function gf() {
3268
3278
  return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
3269
3279
  }
3270
- function mf() {
3271
- return typeof window > "u" || !window.localStorage ? "light" : window.localStorage.getItem(uf) || window.localStorage.getItem(lf) || pf();
3280
+ function _f() {
3281
+ return typeof window > "u" || !window.localStorage ? "light" : window.localStorage.getItem(pf) || window.localStorage.getItem(ff) || gf();
3272
3282
  }
3273
- function hf() {
3283
+ function vf() {
3274
3284
  return typeof window > "u" ? {
3275
3285
  width: 0,
3276
3286
  height: 0
@@ -3279,17 +3289,17 @@ function hf() {
3279
3289
  height: window.innerHeight
3280
3290
  };
3281
3291
  }
3282
- function gf() {
3292
+ function yf() {
3283
3293
  if (typeof window > "u" || !window.localStorage) return "light";
3284
- let e = window.localStorage.getItem(uf), t = window.localStorage.getItem(lf);
3294
+ let e = window.localStorage.getItem(pf), t = window.localStorage.getItem(ff);
3285
3295
  if (e || t) {
3286
3296
  let n = e ?? t;
3287
- return ff(n), n;
3297
+ return hf(n), n;
3288
3298
  }
3289
- let n = pf();
3290
- return window.localStorage.setItem(lf, n), ff(n), n;
3299
+ let n = gf();
3300
+ return window.localStorage.setItem(ff, n), hf(n), n;
3291
3301
  }
3292
- var _f = {
3302
+ var bf = {
3293
3303
  name: "ikon.client.getTheme",
3294
3304
  description: "Get the currently selected client theme",
3295
3305
  returnType: {
@@ -3297,12 +3307,12 @@ var _f = {
3297
3307
  nullable: !0
3298
3308
  }
3299
3309
  };
3300
- function vf() {
3310
+ function xf() {
3301
3311
  if (typeof window > "u" || !window.localStorage) return null;
3302
- let e = window.localStorage.getItem(uf), t = window.localStorage.getItem(lf);
3312
+ let e = window.localStorage.getItem(pf), t = window.localStorage.getItem(ff);
3303
3313
  return e ?? t ?? null;
3304
3314
  }
3305
- var yf = {
3315
+ var Sf = {
3306
3316
  name: "ikon.client.setTheme",
3307
3317
  description: "Update the client UI theme",
3308
3318
  returnType: { kind: "boolean" },
@@ -3319,38 +3329,38 @@ var yf = {
3319
3329
  description: "Whether to persist as user preference"
3320
3330
  }]
3321
3331
  };
3322
- function bf(e, t) {
3332
+ function Cf(e, t) {
3323
3333
  if (typeof window > "u" || !window.localStorage || typeof e != "string") return !1;
3324
3334
  let n = e.trim().toLowerCase();
3325
3335
  if (!n) return !1;
3326
3336
  let r = t === void 0 || !!t, i = window.localStorage;
3327
- r ? i.setItem(uf, n) : i.removeItem(uf), i.setItem(lf, n);
3337
+ r ? i.setItem(pf, n) : i.removeItem(pf), i.setItem(ff, n);
3328
3338
  try {
3329
- window.dispatchEvent(new CustomEvent(df, { detail: { mode: n } }));
3339
+ window.dispatchEvent(new CustomEvent(mf, { detail: { mode: n } }));
3330
3340
  } catch {}
3331
- return ff(n), !0;
3341
+ return hf(n), !0;
3332
3342
  }
3333
- var xf = {
3343
+ var wf = {
3334
3344
  name: "ikon.client.getLanguage",
3335
3345
  description: "Get the browser language preference",
3336
3346
  returnType: { kind: "string" }
3337
3347
  };
3338
- function Sf() {
3348
+ function Tf() {
3339
3349
  return typeof navigator > "u" ? "en-US" : navigator.language || "en-US";
3340
3350
  }
3341
- var Cf = {
3351
+ var Ef = {
3342
3352
  name: "ikon.client.getTimezone",
3343
3353
  description: "Get the browser timezone (IANA format)",
3344
3354
  returnType: { kind: "string" }
3345
3355
  };
3346
- function wf() {
3356
+ function Df() {
3347
3357
  try {
3348
3358
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
3349
3359
  } catch {
3350
3360
  return "UTC";
3351
3361
  }
3352
3362
  }
3353
- function Tf() {
3363
+ function Of() {
3354
3364
  if (typeof Intl > "u") return "";
3355
3365
  try {
3356
3366
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
@@ -3358,15 +3368,15 @@ function Tf() {
3358
3368
  return "";
3359
3369
  }
3360
3370
  }
3361
- function Ef() {
3371
+ function kf() {
3362
3372
  return typeof navigator > "u" ? !1 : navigator.maxTouchPoints > 0;
3363
3373
  }
3364
- function Df() {
3374
+ function Af() {
3365
3375
  if (typeof navigator > "u" || typeof window > "u") return ne.Unknown;
3366
3376
  let e = navigator.maxTouchPoints > 0, t = window.innerWidth <= 1024;
3367
3377
  return e && t ? ne.MobileWeb : ne.DesktopWeb;
3368
3378
  }
3369
- var Of = {
3379
+ var jf = {
3370
3380
  name: "ikon.client.getUrl",
3371
3381
  description: "Get the current browser URL path and query string",
3372
3382
  returnType: {
@@ -3374,10 +3384,10 @@ var Of = {
3374
3384
  nullable: !0
3375
3385
  }
3376
3386
  };
3377
- function kf() {
3387
+ function Mf() {
3378
3388
  return typeof window > "u" ? null : window.location.pathname + window.location.search;
3379
3389
  }
3380
- var Af = {
3390
+ var Nf = {
3381
3391
  name: "ikon.client.setUrl",
3382
3392
  description: "Update the browser URL without triggering a page reload",
3383
3393
  returnType: { kind: "boolean" },
@@ -3405,10 +3415,10 @@ var Af = {
3405
3415
  }
3406
3416
  ]
3407
3417
  };
3408
- function jf(e, t, n) {
3418
+ function Pf(e, t, n) {
3409
3419
  if (typeof window > "u" || !window.history || typeof e != "string") return !1;
3410
3420
  let r = e.trim();
3411
- if (!r || /^[a-z][a-z0-9+.-]*:/i.test(r) || r.startsWith("//") || cf(r)) return !1;
3421
+ if (!r || /^[a-z][a-z0-9+.-]*:/i.test(r) || r.startsWith("//") || df(r)) return !1;
3412
3422
  try {
3413
3423
  let e = !!t, i = n && !r.includes("?") ? r + window.location.search : r;
3414
3424
  return e ? window.history.replaceState(null, "", i) : window.history.pushState(null, "", i), !0;
@@ -3416,7 +3426,7 @@ function jf(e, t, n) {
3416
3426
  return !1;
3417
3427
  }
3418
3428
  }
3419
- var Mf = {
3429
+ var Ff = {
3420
3430
  name: "ikon.client.openExternalUrl",
3421
3431
  description: "Open an external URL in a new browser tab",
3422
3432
  returnType: { kind: "boolean" },
@@ -3426,7 +3436,7 @@ var Mf = {
3426
3436
  description: "The URL to open. Must be absolute (e.g., starts with https://)."
3427
3437
  }]
3428
3438
  };
3429
- function Nf(e) {
3439
+ function If(e) {
3430
3440
  if (typeof window > "u" || typeof window.open != "function" || typeof e != "string") return !1;
3431
3441
  let t = e.trim();
3432
3442
  if (!t || /^javascript:/i.test(t)) return !1;
@@ -3436,7 +3446,7 @@ function Nf(e) {
3436
3446
  return !1;
3437
3447
  }
3438
3448
  }
3439
- var Pf = {
3449
+ var Lf = {
3440
3450
  name: "ikon.client.vibrate",
3441
3451
  description: "Trigger haptic feedback on supported devices",
3442
3452
  returnType: { kind: "boolean" },
@@ -3446,7 +3456,7 @@ var Pf = {
3446
3456
  description: "Duration in ms, or comma-separated pattern (e.g., \"200\" or \"100,50,100\")"
3447
3457
  }]
3448
3458
  };
3449
- function Ff(e) {
3459
+ function Rf(e) {
3450
3460
  if (typeof navigator > "u" || !navigator.vibrate || typeof e != "string") return !1;
3451
3461
  try {
3452
3462
  let t = e.split(",").map((e) => parseInt(e.trim(), 10));
@@ -3455,16 +3465,16 @@ function Ff(e) {
3455
3465
  return !1;
3456
3466
  }
3457
3467
  }
3458
- var L = null, If = !1, Lf = !1;
3459
- async function Rf() {
3468
+ var L = null, zf = !1, Bf = !1;
3469
+ async function Vf() {
3460
3470
  if (!(typeof navigator > "u" || !("wakeLock" in navigator))) try {
3461
3471
  L = await navigator.wakeLock.request("screen");
3462
3472
  } catch {}
3463
3473
  }
3464
- function zf() {
3465
- document.visibilityState === "visible" && If && (!L || L.released) && Rf();
3474
+ function Hf() {
3475
+ document.visibilityState === "visible" && zf && (!L || L.released) && Vf();
3466
3476
  }
3467
- var Bf = {
3477
+ var Uf = {
3468
3478
  name: "ikon.client.keepScreenAwake",
3469
3479
  description: "Prevent or allow the screen to sleep",
3470
3480
  returnType: { kind: "boolean" },
@@ -3474,15 +3484,15 @@ var Bf = {
3474
3484
  description: "Whether to keep the screen awake"
3475
3485
  }]
3476
3486
  };
3477
- async function Vf(e) {
3487
+ async function Wf(e) {
3478
3488
  if (typeof navigator > "u" || !("wakeLock" in navigator)) return !1;
3479
3489
  try {
3480
- return e ? (If = !0, (!L || L.released) && (L = await navigator.wakeLock.request("screen")), Lf ||= (document.addEventListener("visibilitychange", zf), !0)) : (If = !1, Lf &&= (document.removeEventListener("visibilitychange", zf), !1), L &&= (await L.release(), null)), !0;
3490
+ return e ? (zf = !0, (!L || L.released) && (L = await navigator.wakeLock.request("screen")), Bf ||= (document.addEventListener("visibilitychange", Hf), !0)) : (zf = !1, Bf &&= (document.removeEventListener("visibilitychange", Hf), !1), L &&= (await L.release(), null)), !0;
3481
3491
  } catch {
3482
3492
  return !1;
3483
3493
  }
3484
3494
  }
3485
- var Hf = {
3495
+ var Gf = {
3486
3496
  name: "ikon.client.getVisibility",
3487
3497
  description: "Get the current page visibility state",
3488
3498
  returnType: {
@@ -3490,10 +3500,10 @@ var Hf = {
3490
3500
  nullable: !0
3491
3501
  }
3492
3502
  };
3493
- function Uf() {
3503
+ function Kf() {
3494
3504
  return typeof document > "u" ? null : document.visibilityState || null;
3495
3505
  }
3496
- var Wf = {
3506
+ var qf = {
3497
3507
  name: "ikon.client.scrollTo",
3498
3508
  description: "Scroll the page to a specific position",
3499
3509
  returnType: { kind: "boolean" },
@@ -3518,7 +3528,7 @@ var Wf = {
3518
3528
  }
3519
3529
  ]
3520
3530
  };
3521
- function Gf(e, t, n) {
3531
+ function Jf(e, t, n) {
3522
3532
  if (typeof window > "u" || typeof e != "number" || typeof t != "number") return !1;
3523
3533
  try {
3524
3534
  return window.scrollTo({
@@ -3530,7 +3540,7 @@ function Gf(e, t, n) {
3530
3540
  return !1;
3531
3541
  }
3532
3542
  }
3533
- var Kf = {
3543
+ var Yf = {
3534
3544
  name: "ikon.client.getBatteryLevel",
3535
3545
  description: "Get the current battery level (0-100)",
3536
3546
  returnType: {
@@ -3538,7 +3548,7 @@ var Kf = {
3538
3548
  nullable: !0
3539
3549
  }
3540
3550
  };
3541
- async function qf() {
3551
+ async function Xf() {
3542
3552
  if (typeof navigator > "u" || !("getBattery" in navigator)) return null;
3543
3553
  try {
3544
3554
  let e = await navigator.getBattery();
@@ -3547,7 +3557,7 @@ async function qf() {
3547
3557
  return null;
3548
3558
  }
3549
3559
  }
3550
- var Jf = {
3560
+ var Zf = {
3551
3561
  name: "ikon.client.getNetworkType",
3552
3562
  description: "Get the current network connection type",
3553
3563
  returnType: {
@@ -3555,17 +3565,17 @@ var Jf = {
3555
3565
  nullable: !0
3556
3566
  }
3557
3567
  };
3558
- function Yf() {
3568
+ function Qf() {
3559
3569
  if (typeof navigator > "u") return null;
3560
3570
  let e = navigator.connection;
3561
3571
  return e && (e.effectiveType || e.type) || null;
3562
3572
  }
3563
- var Xf = {
3573
+ var $f = {
3564
3574
  name: "ikon.client.requestFullscreen",
3565
3575
  description: "Request the browser to enter fullscreen mode",
3566
3576
  returnType: { kind: "boolean" }
3567
3577
  };
3568
- async function Zf() {
3578
+ async function ep() {
3569
3579
  if (typeof document > "u" || !document.documentElement) return !1;
3570
3580
  try {
3571
3581
  let e = document.documentElement, t = e.requestFullscreen?.bind(e) ?? e.webkitRequestFullscreen?.bind(e);
@@ -3574,12 +3584,12 @@ async function Zf() {
3574
3584
  return !1;
3575
3585
  }
3576
3586
  }
3577
- var Qf = {
3587
+ var tp = {
3578
3588
  name: "ikon.client.exitFullscreen",
3579
3589
  description: "Exit browser fullscreen mode",
3580
3590
  returnType: { kind: "boolean" }
3581
3591
  };
3582
- function $f() {
3592
+ function np() {
3583
3593
  if (typeof document > "u") return !1;
3584
3594
  try {
3585
3595
  let e = document.exitFullscreen?.bind(document) ?? document.webkitExitFullscreen?.bind(document);
@@ -3588,25 +3598,25 @@ function $f() {
3588
3598
  return !1;
3589
3599
  }
3590
3600
  }
3591
- var ep = {
3601
+ var rp = {
3592
3602
  name: "ikon.client.logout",
3593
3603
  description: "Clear the auth session and return to the login screen at the site root",
3594
3604
  returnType: { kind: "boolean" }
3595
- }, tp = ["ikon-auth-", "ikon-live-snapshot"];
3596
- function np() {
3605
+ }, ip = ["ikon-auth-", "ikon-live-snapshot"];
3606
+ function ap() {
3597
3607
  if (typeof window > "u" || !window.localStorage) return !1;
3598
3608
  try {
3599
3609
  let e = [];
3600
3610
  for (let t = 0; t < window.localStorage.length; t++) {
3601
3611
  let n = window.localStorage.key(t);
3602
- n && tp.some((e) => n.startsWith(e)) && e.push(n);
3612
+ n && ip.some((e) => n.startsWith(e)) && e.push(n);
3603
3613
  }
3604
3614
  return e.forEach((e) => window.localStorage.removeItem(e)), setTimeout(() => window.location.replace(window.location.origin + "/"), 100), !0;
3605
3615
  } catch {
3606
3616
  return !1;
3607
3617
  }
3608
3618
  }
3609
- var rp = {
3619
+ var op = {
3610
3620
  name: "ikon.client.login",
3611
3621
  description: "Start the sign-in flow for an OAuth provider (e.g. google, microsoft)",
3612
3622
  parameters: [{
@@ -3615,15 +3625,15 @@ var rp = {
3615
3625
  }],
3616
3626
  returnType: { kind: "boolean" }
3617
3627
  };
3618
- async function ip(e) {
3628
+ async function sp(e) {
3619
3629
  if (typeof window > "u" || typeof e != "string" || e.length === 0 || e === "guest" || e === "global" || e === "email" || e === "passkey") return !1;
3620
3630
  let t = window.__IKON_AUTH_CONFIG__, n = t?.spaceId;
3621
3631
  if (!n) return !1;
3622
- if ($d()) return await rf(e, n);
3632
+ if (rf()) return await of(e, n);
3623
3633
  let r = await Pd(t?.authUrl), i = window.location.origin + window.location.pathname + window.location.search, a = await Jd(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
3624
3634
  return window.location.href = `${r}/oauth/${encodeURIComponent(e)}?space=${encodeURIComponent(n)}&return=${encodeURIComponent(i)}${o}`, !0;
3625
3635
  }
3626
- var ap = {
3636
+ var cp = {
3627
3637
  name: "ikon.client.loginShow",
3628
3638
  description: "Show the login UI with an optional reason",
3629
3639
  parameters: [{
@@ -3632,15 +3642,15 @@ var ap = {
3632
3642
  }],
3633
3643
  returnType: { kind: "boolean" }
3634
3644
  };
3635
- function op(e) {
3645
+ function lp(e) {
3636
3646
  return typeof window > "u" ? !1 : (ld(typeof e == "string" ? e : null), !0);
3637
3647
  }
3638
- var sp = {
3648
+ var up = {
3639
3649
  name: "ikon.client.getLocation",
3640
3650
  description: "Get the current GPS location",
3641
3651
  returnType: { kind: "string" }
3642
3652
  };
3643
- function cp() {
3653
+ function dp() {
3644
3654
  return typeof navigator > "u" || !navigator.geolocation ? Promise.resolve(null) : new Promise((e) => {
3645
3655
  navigator.geolocation.getCurrentPosition((t) => {
3646
3656
  e({
@@ -3654,15 +3664,15 @@ function cp() {
3654
3664
  });
3655
3665
  });
3656
3666
  }
3657
- var lp = [], up = !1;
3658
- function dp() {
3667
+ var fp = [], pp = !1;
3668
+ function mp() {
3659
3669
  return typeof window < "u" && "Notification" in window;
3660
3670
  }
3661
- function fp(e, t, n, r) {
3671
+ function hp(e, t, n, r) {
3662
3672
  let i = {};
3663
3673
  return e?.trim() && (i.body = e.trim()), t?.trim() && (i.icon = t.trim()), n?.trim() && (i.tag = n.trim()), r && (i.data = r), i;
3664
3674
  }
3665
- function pp(e, t, n, r) {
3675
+ function gp(e, t, n, r) {
3666
3676
  try {
3667
3677
  let i = new Notification(e, t);
3668
3678
  i.onclick = () => {
@@ -3677,40 +3687,40 @@ function pp(e, t, n, r) {
3677
3687
  };
3678
3688
  } catch {}
3679
3689
  }
3680
- function mp() {
3690
+ function _p() {
3681
3691
  if (Notification.permission !== "granted") {
3682
- lp = [];
3692
+ fp = [];
3683
3693
  return;
3684
3694
  }
3685
- let e = lp;
3686
- lp = [];
3687
- for (let t of e) pp(t.title, t.options, t.launchUrl, t.data);
3695
+ let e = fp;
3696
+ fp = [];
3697
+ for (let t of e) gp(t.title, t.options, t.launchUrl, t.data);
3688
3698
  }
3689
- function hp() {
3690
- if (up || typeof window > "u") return;
3691
- up = !0;
3699
+ function vp() {
3700
+ if (pp || typeof window > "u") return;
3701
+ pp = !0;
3692
3702
  let e = async () => {
3693
3703
  try {
3694
3704
  if (await Notification.requestPermission() === "granted") {
3695
- mp();
3705
+ _p();
3696
3706
  return;
3697
3707
  }
3698
3708
  } catch {}
3699
- lp = [];
3709
+ fp = [];
3700
3710
  }, t = () => {
3701
- window.removeEventListener("pointerdown", t), window.removeEventListener("keydown", t), up = !1, e();
3711
+ window.removeEventListener("pointerdown", t), window.removeEventListener("keydown", t), pp = !1, e();
3702
3712
  };
3703
3713
  window.addEventListener("pointerdown", t), window.addEventListener("keydown", t);
3704
3714
  }
3705
- var gp = {
3715
+ var yp = {
3706
3716
  name: "ikon.client.getNotificationPermission",
3707
3717
  description: "Get the current notification permission state (granted, denied, default, or unsupported)",
3708
3718
  returnType: { kind: "string" }
3709
3719
  };
3710
- function _p() {
3711
- return dp() ? Notification.permission : "unsupported";
3720
+ function bp() {
3721
+ return mp() ? Notification.permission : "unsupported";
3712
3722
  }
3713
- var vp = {
3723
+ var xp = {
3714
3724
  name: "ikon.client.showNotification",
3715
3725
  description: "Show a notification, requesting permission lazily on the first send",
3716
3726
  returnType: { kind: "string" },
@@ -3756,33 +3766,33 @@ var vp = {
3756
3766
  }
3757
3767
  ]
3758
3768
  };
3759
- async function yp(e, t, n, r, i, a) {
3760
- if (!dp() || typeof e != "string" || !e.trim()) return "unsupported";
3761
- let o = e.trim(), s = fp(typeof t == "string" ? t : void 0, typeof n == "string" ? n : void 0, typeof r == "string" ? r : void 0, typeof a == "string" ? a : void 0), c = typeof i == "string" && i.trim() ? i.trim() : void 0, l = typeof a == "string" && a ? a : void 0;
3762
- if (Notification.permission === "granted") return pp(o, s, c, l), "granted";
3769
+ async function Sp(e, t, n, r, i, a) {
3770
+ if (!mp() || typeof e != "string" || !e.trim()) return "unsupported";
3771
+ let o = e.trim(), s = hp(typeof t == "string" ? t : void 0, typeof n == "string" ? n : void 0, typeof r == "string" ? r : void 0, typeof a == "string" ? a : void 0), c = typeof i == "string" && i.trim() ? i.trim() : void 0, l = typeof a == "string" && a ? a : void 0;
3772
+ if (Notification.permission === "granted") return gp(o, s, c, l), "granted";
3763
3773
  if (Notification.permission === "denied") return "denied";
3764
3774
  try {
3765
3775
  let e = await Notification.requestPermission();
3766
- return e === "granted" && pp(o, s, c, l), e;
3776
+ return e === "granted" && gp(o, s, c, l), e;
3767
3777
  } catch (e) {
3768
- return of(e) ? (lp.push({
3778
+ return lf(e) ? (fp.push({
3769
3779
  title: o,
3770
3780
  options: s,
3771
3781
  launchUrl: c,
3772
3782
  data: l
3773
- }), hp(), "default") : "denied";
3783
+ }), vp(), "default") : "denied";
3774
3784
  }
3775
3785
  }
3776
- var bp = null;
3777
- function xp(e) {
3778
- bp = e ?? null;
3786
+ var Cp = null;
3787
+ function wp(e) {
3788
+ Cp = e ?? null;
3779
3789
  }
3780
- function Sp(e) {
3790
+ function Tp(e) {
3781
3791
  let t = (e + "=".repeat((4 - e.length % 4) % 4)).replace(/-/g, "+").replace(/_/g, "/"), n = atob(t), r = new Uint8Array(n.length);
3782
3792
  for (let e = 0; e < n.length; e++) r[e] = n.charCodeAt(e);
3783
3793
  return r;
3784
3794
  }
3785
- var Cp = {
3795
+ var Ep = {
3786
3796
  name: "ikon.client.getPushSubscription",
3787
3797
  description: "Subscribe to Web Push and return the subscription, for offline push registration",
3788
3798
  returnType: {
@@ -3790,14 +3800,14 @@ var Cp = {
3790
3800
  nullable: !0
3791
3801
  }
3792
3802
  };
3793
- async function wp() {
3794
- if (typeof window > "u" || !bp?.enabled || !bp.vapidPublicKey || !("serviceWorker" in navigator) || !("PushManager" in window) || !dp() || Notification.permission !== "granted") return null;
3803
+ async function Dp() {
3804
+ if (typeof window > "u" || !Cp?.enabled || !Cp.vapidPublicKey || !("serviceWorker" in navigator) || !("PushManager" in window) || !mp() || Notification.permission !== "granted") return null;
3795
3805
  try {
3796
3806
  let e = await navigator.serviceWorker.register("/push-service-worker.js");
3797
3807
  await navigator.serviceWorker.ready;
3798
3808
  let t = (await e.pushManager.getSubscription() ?? await e.pushManager.subscribe({
3799
3809
  userVisibleOnly: !0,
3800
- applicationServerKey: Sp(bp.vapidPublicKey)
3810
+ applicationServerKey: Tp(Cp.vapidPublicKey)
3801
3811
  })).toJSON();
3802
3812
  return !t.endpoint || !t.keys?.p256dh || !t.keys?.auth ? null : {
3803
3813
  Platform: "web",
@@ -3810,98 +3820,98 @@ async function wp() {
3810
3820
  return null;
3811
3821
  }
3812
3822
  }
3813
- var Tp = [
3814
- {
3815
- definition: _f,
3816
- handler: vf
3817
- },
3823
+ var Op = [
3818
3824
  {
3819
- definition: yf,
3820
- handler: bf
3825
+ definition: bf,
3826
+ handler: xf
3821
3827
  },
3822
3828
  {
3823
- definition: xf,
3824
- handler: Sf
3829
+ definition: Sf,
3830
+ handler: Cf
3825
3831
  },
3826
3832
  {
3827
- definition: Cf,
3828
- handler: wf
3833
+ definition: wf,
3834
+ handler: Tf
3829
3835
  },
3830
3836
  {
3831
- definition: Of,
3832
- handler: kf
3837
+ definition: Ef,
3838
+ handler: Df
3833
3839
  },
3834
3840
  {
3835
- definition: Af,
3836
- handler: jf
3841
+ definition: jf,
3842
+ handler: Mf
3837
3843
  },
3838
3844
  {
3839
- definition: Mf,
3840
- handler: Nf
3845
+ definition: Nf,
3846
+ handler: Pf
3841
3847
  },
3842
3848
  {
3843
- definition: Pf,
3844
- handler: Ff
3849
+ definition: Ff,
3850
+ handler: If
3845
3851
  },
3846
3852
  {
3847
- definition: Bf,
3848
- handler: Vf
3853
+ definition: Lf,
3854
+ handler: Rf
3849
3855
  },
3850
3856
  {
3851
- definition: Hf,
3852
- handler: Uf
3857
+ definition: Uf,
3858
+ handler: Wf
3853
3859
  },
3854
3860
  {
3855
- definition: Wf,
3856
- handler: Gf
3861
+ definition: Gf,
3862
+ handler: Kf
3857
3863
  },
3858
3864
  {
3859
- definition: Kf,
3860
- handler: qf
3865
+ definition: qf,
3866
+ handler: Jf
3861
3867
  },
3862
3868
  {
3863
- definition: Jf,
3864
- handler: Yf
3869
+ definition: Yf,
3870
+ handler: Xf
3865
3871
  },
3866
3872
  {
3867
- definition: Xf,
3868
- handler: Zf
3873
+ definition: Zf,
3874
+ handler: Qf
3869
3875
  },
3870
3876
  {
3871
- definition: Qf,
3872
- handler: $f
3877
+ definition: $f,
3878
+ handler: ep
3873
3879
  },
3874
3880
  {
3875
- definition: ep,
3881
+ definition: tp,
3876
3882
  handler: np
3877
3883
  },
3878
3884
  {
3879
3885
  definition: rp,
3880
- handler: ip
3886
+ handler: ap
3887
+ },
3888
+ {
3889
+ definition: op,
3890
+ handler: sp
3881
3891
  },
3882
3892
  {
3883
- definition: ap,
3884
- handler: op
3893
+ definition: cp,
3894
+ handler: lp
3885
3895
  },
3886
3896
  {
3887
- definition: sp,
3888
- handler: cp
3897
+ definition: up,
3898
+ handler: dp
3889
3899
  },
3890
3900
  {
3891
- definition: gp,
3892
- handler: _p
3901
+ definition: yp,
3902
+ handler: bp
3893
3903
  },
3894
3904
  {
3895
- definition: vp,
3896
- handler: yp
3905
+ definition: xp,
3906
+ handler: Sp
3897
3907
  },
3898
3908
  {
3899
- definition: Cp,
3900
- handler: wp
3909
+ definition: Ep,
3910
+ handler: Dp
3901
3911
  }
3902
3912
  ];
3903
- function Ep(e) {
3904
- let t = Tp.map(({ definition: t, handler: n }) => e.register(t, n));
3913
+ function kp(e) {
3914
+ let t = Op.map(({ definition: t, handler: n }) => e.register(t, n));
3905
3915
  return () => t.forEach((e) => e());
3906
3916
  }
3907
3917
  function R() {
@@ -3909,126 +3919,126 @@ function R() {
3909
3919
  }
3910
3920
  //#endregion
3911
3921
  //#region src/utils/log-sink.ts
3912
- var Dp = 1e3, Op = S.INFO, z = [], kp = Dp, Ap = Op, jp = null;
3913
- function Mp(e) {
3914
- e.level < Ap || (z.push(e), z.length > kp && (z = z.slice(-kp)));
3922
+ var Ap = 1e3, jp = S.INFO, z = [], Mp = Ap, Np = jp, Pp = null;
3923
+ function Fp(e) {
3924
+ e.level < Np || (z.push(e), z.length > Mp && (z = z.slice(-Mp)));
3915
3925
  }
3916
- function Np(e) {
3917
- kp = e?.maxBufferSize ?? Dp, Ap = e?.minLevel ?? Op, z = [], ve(Mp);
3926
+ function Ip(e) {
3927
+ Mp = e?.maxBufferSize ?? Ap, Np = e?.minLevel ?? jp, z = [], ve(Fp);
3918
3928
  }
3919
- function Pp(e) {
3920
- jp = e;
3929
+ function Lp(e) {
3930
+ Pp = e;
3921
3931
  }
3922
- function Fp() {
3932
+ function Rp() {
3923
3933
  return z;
3924
3934
  }
3925
- function Ip() {
3935
+ function zp() {
3926
3936
  let e = z;
3927
3937
  return z = [], e;
3928
3938
  }
3929
- function Lp() {
3930
- if (!jp || z.length === 0) return 0;
3931
- let e = Ip();
3932
- return jp(e), e.length;
3939
+ function Bp() {
3940
+ if (!Pp || z.length === 0) return 0;
3941
+ let e = zp();
3942
+ return Pp(e), e.length;
3933
3943
  }
3934
- function Rp() {
3944
+ function Vp() {
3935
3945
  z = [];
3936
3946
  }
3937
- function zp() {
3947
+ function Hp() {
3938
3948
  return z.length;
3939
3949
  }
3940
- Np();
3950
+ Ip();
3941
3951
  //#endregion
3942
3952
  //#region src/utils/log-sender.ts
3943
- var Bp = C("LogSender"), Vp = 1e3, Hp = 6e4, Up = 15e3, Wp = 10240, Gp = 409600, Kp = "…[truncated]", qp = {
3953
+ var Up = C("LogSender"), Wp = 1e3, Gp = 6e4, Kp = 15e3, qp = 10240, Jp = 409600, Yp = "…[truncated]", Xp = {
3944
3954
  [S.DEBUG]: he.Debug,
3945
3955
  [S.INFO]: he.Info,
3946
3956
  [S.WARN]: he.Warning,
3947
3957
  [S.ERROR]: he.Error
3948
- }, B, Jp, V, H = [], Yp = 0, Xp;
3949
- function Zp(e) {
3950
- return e.length <= Wp ? e : e.slice(0, 10228) + Kp;
3958
+ }, B, Zp, V, H = [], Qp = 0, $p;
3959
+ function em(e) {
3960
+ return e.length <= qp ? e : e.slice(0, 10228) + Yp;
3951
3961
  }
3952
- function Qp(e) {
3962
+ function tm(e) {
3953
3963
  return {
3954
3964
  Time: e.timestamp,
3955
- Type: qp[e.level] ?? he.Info,
3956
- Message: Zp(`[${e.component}] ${e.message}`),
3965
+ Type: Xp[e.level] ?? he.Info,
3966
+ Message: em(`[${e.component}] ${e.message}`),
3957
3967
  Parameters: "{}"
3958
3968
  };
3959
3969
  }
3960
- function $p(e) {
3970
+ function nm(e) {
3961
3971
  return JSON.stringify({
3962
3972
  type: "sdk-typescript",
3963
3973
  event: { Logs: e }
3964
3974
  });
3965
3975
  }
3966
- function em(e) {
3976
+ function rm(e) {
3967
3977
  if (e.length === 0) return [];
3968
- let t = Gp - $p([]).length, n = [], r = [], i = 0;
3978
+ let t = Jp - nm([]).length, n = [], r = [], i = 0;
3969
3979
  for (let a of e) {
3970
3980
  let e = JSON.stringify(a).length + 1;
3971
3981
  r.length > 0 && i + e > t && (n.push(r), r = [], i = 0), r.push(a), i += e;
3972
3982
  }
3973
3983
  return r.length > 0 && n.push(r), n;
3974
3984
  }
3975
- async function tm(e) {
3985
+ async function im(e) {
3976
3986
  if (e.length === 0 || !B) return;
3977
3987
  let t = `${B}/events/logs/json`, n = {
3978
3988
  "Content-Type": "application/json",
3979
- Authorization: `Bearer ${Jp}`
3989
+ Authorization: `Bearer ${Zp}`
3980
3990
  }, r = await fetch(t, {
3981
3991
  method: "POST",
3982
3992
  headers: n,
3983
- body: $p(e),
3984
- signal: I(Up)
3993
+ body: nm(e),
3994
+ signal: I(Kp)
3985
3995
  });
3986
3996
  if (!r.ok) {
3987
3997
  if (r.status >= 400 && r.status < 500) {
3988
- Bp.warn(`Dropping ${e.length} log entries due to ${r.status}`);
3998
+ Up.warn(`Dropping ${e.length} log entries due to ${r.status}`);
3989
3999
  return;
3990
4000
  }
3991
4001
  throw Error(`Failed to send logs: ${r.status}`);
3992
4002
  }
3993
4003
  }
3994
- function nm() {
3995
- if (Yp === 0) return Vp;
3996
- let e = Vp * (1 << Math.min(Yp, 6));
3997
- return Math.min(e, Hp);
4004
+ function am() {
4005
+ if (Qp === 0) return Wp;
4006
+ let e = Wp * (1 << Math.min(Qp, 6));
4007
+ return Math.min(e, Gp);
3998
4008
  }
3999
- function rm(e) {
4000
- B && (V = setTimeout(() => void im(), e));
4009
+ function om(e) {
4010
+ B && (V = setTimeout(() => void sm(), e));
4001
4011
  }
4002
- async function im() {
4012
+ async function sm() {
4003
4013
  V = void 0;
4004
- let e = Ip();
4005
- if (H = H.concat(e.map(Qp)), typeof navigator < "u" && navigator.onLine === !1) {
4006
- rm(Vp);
4014
+ let e = zp();
4015
+ if (H = H.concat(e.map(tm)), typeof navigator < "u" && navigator.onLine === !1) {
4016
+ om(Wp);
4007
4017
  return;
4008
4018
  }
4009
4019
  if (H.length === 0) {
4010
- rm(Vp);
4020
+ om(Wp);
4011
4021
  return;
4012
4022
  }
4013
4023
  let t = H;
4014
4024
  H = [];
4015
- let n = em(t), r = !1;
4025
+ let n = rm(t), r = !1;
4016
4026
  for (let e = 0; e < n.length; e++) try {
4017
- await tm(n[e]);
4027
+ await im(n[e]);
4018
4028
  } catch {
4019
4029
  H = n.slice(e).flat().concat(H), r = !0;
4020
4030
  break;
4021
4031
  }
4022
- r ? Yp++ : Yp = 0, rm(nm());
4032
+ r ? Qp++ : Qp = 0, om(am());
4023
4033
  }
4024
- function am() {
4025
- V !== void 0 && (clearTimeout(V), V = void 0), rm(0);
4034
+ function cm() {
4035
+ V !== void 0 && (clearTimeout(V), V = void 0), om(0);
4026
4036
  }
4027
- function om(e, t) {
4028
- cm(), B = e, Jp = t, Yp = 0, typeof window < "u" && (Xp = am, window.addEventListener("online", Xp)), rm(Vp);
4037
+ function lm(e, t) {
4038
+ dm(), B = e, Zp = t, Qp = 0, typeof window < "u" && ($p = cm, window.addEventListener("online", $p)), om(Wp);
4029
4039
  }
4030
- function sm(e, t) {
4031
- if (!B || !Jp) return;
4040
+ function um(e, t) {
4041
+ if (!B || !Zp) return;
4032
4042
  let n = { Events: [{
4033
4043
  Time: (/* @__PURE__ */ new Date()).toISOString(),
4034
4044
  EventName: e,
@@ -4042,60 +4052,60 @@ function sm(e, t) {
4042
4052
  method: "POST",
4043
4053
  headers: {
4044
4054
  "Content-Type": "application/json",
4045
- Authorization: `Bearer ${Jp}`
4055
+ Authorization: `Bearer ${Zp}`
4046
4056
  },
4047
4057
  body: r
4048
- }).catch((t) => Bp.warn(`Failed to send analytics event ${e}: ${t}`));
4058
+ }).catch((t) => Up.warn(`Failed to send analytics event ${e}: ${t}`));
4049
4059
  }
4050
- function cm() {
4051
- V !== void 0 && (clearTimeout(V), V = void 0), Xp !== void 0 && typeof window < "u" && (window.removeEventListener("online", Xp), Xp = void 0), B = void 0, Jp = void 0, H = [], Yp = 0;
4060
+ function dm() {
4061
+ V !== void 0 && (clearTimeout(V), V = void 0), $p !== void 0 && typeof window < "u" && (window.removeEventListener("online", $p), $p = void 0), B = void 0, Zp = void 0, H = [], Qp = 0;
4052
4062
  }
4053
4063
  //#endregion
4054
4064
  //#region src/utils/connect-timeline.ts
4055
- var lm = C("ConnectTimeline"), um = "ikon-connect-trace-id", dm, fm = !1;
4056
- function pm() {
4065
+ var fm = C("ConnectTimeline"), pm = "ikon-connect-trace-id", mm, hm = !1;
4066
+ function gm() {
4057
4067
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`;
4058
4068
  }
4059
- function mm() {
4069
+ function _m() {
4060
4070
  try {
4061
- let e = sessionStorage.getItem(um);
4071
+ let e = sessionStorage.getItem(pm);
4062
4072
  if (e) return e;
4063
- let t = pm();
4064
- return sessionStorage.setItem(um, t), t;
4073
+ let t = gm();
4074
+ return sessionStorage.setItem(pm, t), t;
4065
4075
  } catch {
4066
- return dm ??= pm(), dm;
4076
+ return mm ??= gm(), mm;
4067
4077
  }
4068
4078
  }
4069
- function hm(e) {
4079
+ function vm(e) {
4070
4080
  if (typeof performance > "u" || typeof performance.getEntriesByType != "function") return;
4071
4081
  let t = performance.getEntriesByType("resource");
4072
4082
  for (let n = t.length - 1; n >= 0; n--) if (t[n].name.includes(e)) return Math.round(t[n].duration);
4073
4083
  }
4074
- function gm(e = {}) {
4075
- if (fm) return;
4076
- fm = !0;
4077
- let t = { connectTraceId: mm() };
4084
+ function ym(e = {}) {
4085
+ if (hm) return;
4086
+ hm = !0;
4087
+ let t = { connectTraceId: _m() };
4078
4088
  e.snapshotSeeded !== void 0 && (t.snapshotSeeded = String(e.snapshotSeeded));
4079
4089
  try {
4080
4090
  if (typeof performance < "u") {
4081
4091
  t.firstPaintMs = String(Math.round(performance.now()));
4082
4092
  let e = performance.getEntriesByType("navigation")[0];
4083
4093
  e && (t.cdnHtmlMs = String(Math.round(e.responseEnd - e.fetchStart)), t.domContentLoadedMs = String(Math.round(e.domContentLoadedEventEnd)));
4084
- let n = hm("/anonymous");
4094
+ let n = vm("/anonymous");
4085
4095
  n !== void 0 && (t.authMs = String(n));
4086
- let r = hm("/init");
4096
+ let r = vm("/init");
4087
4097
  r !== void 0 && (t.initMs = String(r));
4088
- let i = hm("/connect");
4098
+ let i = vm("/connect");
4089
4099
  i !== void 0 && (t.connectMs = String(i));
4090
4100
  }
4091
4101
  } catch (e) {
4092
- lm.warn(`Failed to read performance timeline: ${e}`);
4102
+ fm.warn(`Failed to read performance timeline: ${e}`);
4093
4103
  }
4094
- sm("client_connect_timeline", t);
4104
+ um("client_connect_timeline", t);
4095
4105
  }
4096
4106
  //#endregion
4097
4107
  //#region src/utils/uuid.ts
4098
- function _m() {
4108
+ function bm() {
4099
4109
  let e = globalThis.crypto;
4100
4110
  if (e && typeof e.randomUUID == "function") return e.randomUUID();
4101
4111
  let t = /* @__PURE__ */ new Uint8Array(16);
@@ -4108,34 +4118,34 @@ function _m() {
4108
4118
  }
4109
4119
  //#endregion
4110
4120
  //#region src/storage.ts
4111
- var vm = "ikon-device-id";
4112
- function ym() {
4113
- if (typeof window > "u" || typeof localStorage > "u") return _m();
4121
+ var xm = "ikon-device-id";
4122
+ function Sm() {
4123
+ if (typeof window > "u" || typeof localStorage > "u") return bm();
4114
4124
  try {
4115
- let e = localStorage.getItem(vm);
4116
- return e || (e = _m(), localStorage.setItem(vm, e)), e;
4125
+ let e = localStorage.getItem(xm);
4126
+ return e || (e = bm(), localStorage.setItem(xm, e)), e;
4117
4127
  } catch {
4118
- return _m();
4128
+ return bm();
4119
4129
  }
4120
4130
  }
4121
- function bm() {
4131
+ function Cm() {
4122
4132
  if (!(typeof localStorage > "u")) try {
4123
- localStorage.removeItem(vm);
4133
+ localStorage.removeItem(xm);
4124
4134
  } catch {}
4125
4135
  }
4126
- function xm(e) {
4127
- let t = Cm(e);
4136
+ function wm(e) {
4137
+ let t = Em(e);
4128
4138
  return typeof t?.id == "string" ? t.id : null;
4129
4139
  }
4130
- function Sm(e) {
4131
- let t = Cm(e);
4140
+ function Tm(e) {
4141
+ let t = Em(e);
4132
4142
  return t ? {
4133
4143
  userId: typeof t.id == "string" ? t.id : null,
4134
4144
  authSession: typeof t.authSession == "string" ? t.authSession : null,
4135
4145
  role: typeof t.role == "string" ? t.role : null
4136
4146
  } : null;
4137
4147
  }
4138
- function Cm(e) {
4148
+ function Em(e) {
4139
4149
  try {
4140
4150
  let t = e.split(".");
4141
4151
  if (t.length !== 3) return null;
@@ -4147,8 +4157,8 @@ function Cm(e) {
4147
4157
  }
4148
4158
  //#endregion
4149
4159
  //#region src/connection/authenticator.ts
4150
- var U = C("Authenticator"), W = w.GROUP_CORE | w.GROUP_KEEPALIVE | w.GROUP_EVENTS | w.GROUP_ACTIONS | w.GROUP_UI | w.GROUP_AUDIO | w.GROUP_VIDEO | w.GROUP_ANALYTICS | w.GROUP_APP_LOCAL, wm = 2, Tm = 6e4, Em = 2e3, Dm = 1e4, Om = 3e3, km = 3e3, Am = 3, jm = "X-Ikon-Startup-Failed", Mm = "startup_failed", Nm = 1e3, Pm = 4;
4151
- async function Fm(e, t, n, r) {
4160
+ var U = C("Authenticator"), W = w.GROUP_CORE | w.GROUP_KEEPALIVE | w.GROUP_EVENTS | w.GROUP_ACTIONS | w.GROUP_UI | w.GROUP_AUDIO | w.GROUP_VIDEO | w.GROUP_ANALYTICS | w.GROUP_APP_LOCAL, Dm = 2, Om = 6e4, km = 2e3, Am = 1e4, jm = 3e3, Mm = 3e3, Nm = 3, Pm = "X-Ikon-Startup-Failed", Fm = "startup_failed", Im = 1e3, Lm = 4;
4161
+ async function Rm(e, t, n, r) {
4152
4162
  if (e) try {
4153
4163
  let i = await fetch(`${n}/anonymous`, {
4154
4164
  method: "POST",
@@ -4169,7 +4179,7 @@ async function Fm(e, t, n, r) {
4169
4179
  U.warn("Anonymous auth returned no token");
4170
4180
  return;
4171
4181
  }
4172
- let o = xm(a.token);
4182
+ let o = wm(a.token);
4173
4183
  if (!o) {
4174
4184
  U.warn("Anonymous auth token had no extractable userId");
4175
4185
  return;
@@ -4183,7 +4193,7 @@ async function Fm(e, t, n, r) {
4183
4193
  return;
4184
4194
  }
4185
4195
  }
4186
- async function Im(e, t, n, r) {
4196
+ async function zm(e, t, n, r) {
4187
4197
  try {
4188
4198
  let i = await fetch(`${e}/profiles/me?space=${encodeURIComponent(t)}`, {
4189
4199
  method: "GET",
@@ -4195,7 +4205,7 @@ async function Im(e, t, n, r) {
4195
4205
  U.warn("Failed to ensure profile:", e);
4196
4206
  }
4197
4207
  }
4198
- async function Lm(e) {
4208
+ async function Bm(e) {
4199
4209
  let t = await e.text().catch(() => "Unknown error");
4200
4210
  try {
4201
4211
  let e = JSON.parse(t);
@@ -4203,16 +4213,16 @@ async function Lm(e) {
4203
4213
  } catch {}
4204
4214
  return t;
4205
4215
  }
4206
- async function Rm(e) {
4216
+ async function Vm(e) {
4207
4217
  if (e.ok) return;
4208
- let t = await Lm(e);
4209
- throw e.status === 403 ? new Ml(`Access denied: ${t}`, t) : zm("Failed to get or create profile", e.status, t);
4218
+ let t = await Bm(e);
4219
+ throw e.status === 403 ? new Ml(`Access denied: ${t}`, t) : Hm("Failed to get or create profile", e.status, t);
4210
4220
  }
4211
- function zm(e, t, n) {
4221
+ function Hm(e, t, n) {
4212
4222
  let r = `${e}: ${t} ${n}`;
4213
4223
  return t >= 500 ? new Fl(r, t) : new T(r);
4214
4224
  }
4215
- function Bm(e, t, n) {
4225
+ function Um(e, t, n) {
4216
4226
  let r = {
4217
4227
  method: "POST",
4218
4228
  headers: {
@@ -4224,35 +4234,35 @@ function Bm(e, t, n) {
4224
4234
  };
4225
4235
  return t || (r.credentials = "include"), r;
4226
4236
  }
4227
- async function Vm(e, t, n, r) {
4228
- let i = `${e}/init`, a = await fetch(i, Bm(t, n, r));
4237
+ async function Wm(e, t, n, r) {
4238
+ let i = `${e}/init`, a = await fetch(i, Um(t, n, r));
4229
4239
  if (!a.ok) {
4230
- let e = await Lm(a);
4231
- throw a.status === 403 ? new Ml(`Access denied: ${e}`, e) : a.status === 404 && t.sessionIdentityHash ? new Nl(t.sessionIdentityHash) : zm("Backend init failed", a.status, e);
4240
+ let e = await Bm(a);
4241
+ throw a.status === 403 ? new Ml(`Access denied: ${e}`, e) : a.status === 404 && t.sessionIdentityHash ? new Nl(t.sessionIdentityHash) : Hm("Backend init failed", a.status, e);
4232
4242
  }
4233
4243
  return a.json();
4234
4244
  }
4235
- function Hm(e, t) {
4245
+ function Gm(e, t) {
4236
4246
  return e.startupFailed ? new O() : new Al(t);
4237
4247
  }
4238
4248
  async function G(e, t, n) {
4239
- let r = I(n ?? Dm), i = t ? gd([t, r]) : r, a = Date.now(), o = await fetch(e, { signal: i });
4249
+ let r = I(n ?? Am), i = t ? gd([t, r]) : r, a = Date.now(), o = await fetch(e, { signal: i });
4240
4250
  if (!o.ok) {
4241
4251
  let e = await o.text().catch(() => "Unknown error");
4242
- throw o.status === 429 ? new Pl(`Server is at capacity: ${e}`) : o.headers.get(jm) || e.includes(Mm) ? new O() : zm("Failed to connect", o.status, e);
4252
+ throw o.status === 429 ? new Pl(`Server is at capacity: ${e}`) : o.headers.get(Pm) || e.includes(Fm) ? new O() : Hm("Failed to connect", o.status, e);
4243
4253
  }
4244
4254
  let s = await o.arrayBuffer(), c = await An(new Uint8Array(s));
4245
4255
  return U.debug(`Connect URL fetched in ${Date.now() - a}ms`), { authResponse: c };
4246
4256
  }
4247
- async function Um(e, t) {
4257
+ async function Km(e, t) {
4248
4258
  try {
4249
- let n = new URL(e), r = `${n.protocol}//${n.host}/health`, i = I(km), a = t ? gd([t, i]) : i;
4259
+ let n = new URL(e), r = `${n.protocol}//${n.host}/health`, i = I(Mm), a = t ? gd([t, i]) : i;
4250
4260
  return (await fetch(r, { signal: a })).ok;
4251
4261
  } catch {
4252
4262
  return !1;
4253
4263
  }
4254
4264
  }
4255
- async function Wm(e, t, n, r, i) {
4265
+ async function qm(e, t, n, r, i) {
4256
4266
  let a = [];
4257
4267
  if (n === "force-proxy" ? t && a.push({
4258
4268
  url: t,
@@ -4275,9 +4285,9 @@ async function Wm(e, t, n, r, i) {
4275
4285
  })), a.length === 0) throw new T("No connect URL available");
4276
4286
  U.debug(`Auth URL order: [${a.map((e) => e.isProxy ? "proxy" : "direct").join(", ")}], mode: ${n}, proxyPreferred: ${r}`);
4277
4287
  let o = n === "auto" && a.length > 1 && !a[0].isProxy, s = Date.now(), c = 0;
4278
- for (; c < wm || Date.now() - s < Tm;) {
4288
+ for (; c < Dm || Date.now() - s < Om;) {
4279
4289
  for (let t = 0; t < a.length; t++) {
4280
- let n = a[t], r = c === 0 && t === 0 && o ? Om : Dm;
4290
+ let n = a[t], r = c === 0 && t === 0 && o ? jm : Am;
4281
4291
  try {
4282
4292
  let t = await G(n.url, i, r);
4283
4293
  return t.usedProxyUrl = n.isProxy, t.directUrl = e, U.debug(`Auth succeeded via ${n.isProxy ? "proxy" : "direct"} URL`), t;
@@ -4286,12 +4296,12 @@ async function Wm(e, t, n, r, i) {
4286
4296
  U.warn(`Auth via ${n.isProxy ? "proxy" : "direct"} URL failed (round ${c + 1}, timeout ${r}ms): ${e}`);
4287
4297
  }
4288
4298
  }
4289
- c++, await Ll(Em, i);
4299
+ c++, await Ll(km, i);
4290
4300
  }
4291
4301
  throw new T("Failed to connect after exhausting all URL attempts");
4292
4302
  }
4293
- function Gm(e, t, n = "", r = !0) {
4294
- let i = hf();
4303
+ function Jm(e, t, n = "", r = !0) {
4304
+ let i = vf();
4295
4305
  return Zt({
4296
4306
  ServerSessionId: "",
4297
4307
  ContextType: m.Browser,
@@ -4301,7 +4311,7 @@ function Gm(e, t, n = "", r = !0) {
4301
4311
  IsSnapshot: gu(),
4302
4312
  Description: e.description ?? "Ikon SDK TypeScript",
4303
4313
  UserId: t,
4304
- DeviceId: e.deviceId ?? ym(),
4314
+ DeviceId: e.deviceId ?? Sm(),
4305
4315
  ProductId: e.productId ?? "ikon-sdk",
4306
4316
  VersionId: e.versionId ?? "1.0.0",
4307
4317
  InstallId: e.installId ?? "",
@@ -4309,26 +4319,26 @@ function Gm(e, t, n = "", r = !0) {
4309
4319
  OpcodeGroupsFromServer: e.opcodeGroupsFromServer ?? W,
4310
4320
  OpcodeGroupsToServer: e.opcodeGroupsToServer ?? W,
4311
4321
  ProtocolVersion: 1,
4312
- SdkCapability: Pm,
4322
+ SdkCapability: Lm,
4313
4323
  HasInput: !1,
4314
4324
  AuthSessionId: n,
4315
4325
  IsAnonymous: r,
4316
4326
  IsGlobal: !1,
4317
4327
  ReceiveAllMessages: !1,
4318
4328
  UserAgent: typeof navigator < "u" ? navigator.userAgent : "",
4319
- ClientType: Df(),
4329
+ ClientType: Af(),
4320
4330
  Parameters: e.parameters ?? {},
4321
4331
  ViewportWidth: i.width,
4322
4332
  ViewportHeight: i.height,
4323
- Theme: mf(),
4324
- Timezone: Tf(),
4325
- IsTouchDevice: Ef(),
4333
+ Theme: _f(),
4334
+ Timezone: Of(),
4335
+ IsTouchDevice: kf(),
4326
4336
  InitialPath: Hd(),
4327
4337
  InitialUrl: Ud(),
4328
4338
  SupportsCompression: Oe()
4329
4339
  });
4330
4340
  }
4331
- function Km(e) {
4341
+ function Ym(e) {
4332
4342
  return {
4333
4343
  ServerSessionId: e.ServerSessionId,
4334
4344
  ContextType: e.ContextType,
@@ -4365,26 +4375,26 @@ function Km(e) {
4365
4375
  SupportsCompression: e.SupportsCompression
4366
4376
  };
4367
4377
  }
4368
- async function qm(e, t) {
4378
+ async function Xm(e, t) {
4369
4379
  let n = `https://${e.host}:${e.httpsPort}`;
4370
4380
  U.debug(`Authenticating with local server: ${n}`);
4371
4381
  let r = {
4372
4382
  ...Id(),
4373
4383
  ...e.parameters
4374
- }, i = e.deviceId ?? ym(), a = e.userId, o = e.token;
4384
+ }, i = e.deviceId ?? Sm(), a = e.userId, o = e.token;
4375
4385
  if (!a) {
4376
- let n = await Fm(e.spaceId, i, await Pd(e.authUrl), t);
4386
+ let n = await Rm(e.spaceId, i, await Pd(e.authUrl), t);
4377
4387
  n && (a = n.userId, o = n.token);
4378
4388
  }
4379
4389
  if (a || (a = i, U.debug("Using deviceId as userId fallback")), e.spaceId && o) if (e.token) {
4380
4390
  let n = jd(e.backendUrl);
4381
- await Rm(await fetch(`${n}/profiles/me?space=${encodeURIComponent(e.spaceId)}`, {
4391
+ await Vm(await fetch(`${n}/profiles/me?space=${encodeURIComponent(e.spaceId)}`, {
4382
4392
  method: "GET",
4383
4393
  headers: { Authorization: `Bearer ${o}` },
4384
4394
  signal: t
4385
4395
  }));
4386
- } else await Im(jd(e.backendUrl), e.spaceId, o, t);
4387
- let s = e.token ?? e.identityToken ?? o, c = s ? Sm(s) : null, l = c?.authSession ?? (e.token ? "authenticated" : ""), u = c?.role ? c.role === "anonymous" : !e.token, d = Km(Gm({
4396
+ } else await zm(jd(e.backendUrl), e.spaceId, o, t);
4397
+ let s = e.token ?? e.identityToken ?? o, c = s ? Tm(s) : null, l = c?.authSession ?? (e.token ? "authenticated" : ""), u = c?.role ? c.role === "anonymous" : !e.token, d = Ym(Jm({
4388
4398
  ...e,
4389
4399
  parameters: r
4390
4400
  }, a, l, u)), f = await fetch(`${n}/connect-token`, {
@@ -4395,14 +4405,14 @@ async function qm(e, t) {
4395
4405
  });
4396
4406
  if (!f.ok) {
4397
4407
  let e = await f.text().catch(() => "Unknown error");
4398
- throw zm("Failed to get connect token", f.status, e);
4408
+ throw Hm("Failed to get connect token", f.status, e);
4399
4409
  }
4400
4410
  let p = (await f.json()).token;
4401
4411
  if (!p) throw new T("Server did not return a token");
4402
4412
  let m = `${n}/connect?token=${encodeURIComponent(p)}`, h = await G(m, t);
4403
4413
  return h.directUrl = m, h.backendUrl = jd(e.backendUrl), h.authToken = o, h;
4404
4414
  }
4405
- async function Jm(e, t, n = "auto", r = !1) {
4415
+ async function Zm(e, t, n = "auto", r = !1) {
4406
4416
  let i = Ad(e.backendType);
4407
4417
  U.debug(`Authenticating with cloud server: ${i}, space ID: ${e.spaceId}`);
4408
4418
  let a = await fetch(`${i}/auth/api-key`, {
@@ -4417,14 +4427,14 @@ async function Jm(e, t, n = "auto", r = !1) {
4417
4427
  });
4418
4428
  if (!a.ok) {
4419
4429
  let e = await a.text().catch(() => "Unknown error");
4420
- throw zm("API key authentication failed", a.status, e);
4430
+ throw Hm("API key authentication failed", a.status, e);
4421
4431
  }
4422
4432
  let o = (await a.json()).token;
4423
4433
  if (!o) throw new T("Backend did not return a token");
4424
4434
  let s = Id(), c = e.provisioningTimeoutMs ?? 6e4, l = {
4425
4435
  ...s,
4426
4436
  ...e.parameters
4427
- }, u = hf(), d = j() ? Am : 1;
4437
+ }, u = vf(), d = j() ? Nm : 1;
4428
4438
  for (let a = 0; a < d; a++) try {
4429
4439
  let a = {
4430
4440
  space: e.spaceId,
@@ -4432,13 +4442,13 @@ async function Jm(e, t, n = "auto", r = !1) {
4432
4442
  params: e.parameters,
4433
4443
  waitForRunning: !0,
4434
4444
  waitForRunningTimeoutMs: c,
4435
- connectTraceId: mm(),
4445
+ connectTraceId: _m(),
4436
4446
  contextType: m.Plugin,
4437
4447
  userType: e.userType ?? p.Human,
4438
- clientType: e.clientType ?? Df(),
4448
+ clientType: e.clientType ?? Af(),
4439
4449
  payloadType: me.Teleport,
4440
4450
  description: e.description ?? "Ikon SDK TypeScript",
4441
- deviceId: e.deviceId ?? ym(),
4451
+ deviceId: e.deviceId ?? Sm(),
4442
4452
  productId: e.productId ?? "",
4443
4453
  versionId: e.versionId ?? "",
4444
4454
  installId: e.installId ?? "",
@@ -4450,32 +4460,32 @@ async function Jm(e, t, n = "auto", r = !1) {
4450
4460
  launchParams: l,
4451
4461
  viewportWidth: u.width,
4452
4462
  viewportHeight: u.height,
4453
- theme: mf(),
4454
- timezone: Tf(),
4455
- isTouchDevice: Ef(),
4463
+ theme: _f(),
4464
+ timezone: Of(),
4465
+ isTouchDevice: kf(),
4456
4466
  initialPath: Hd(),
4457
4467
  initialUrl: Ud(),
4458
4468
  sdkType: 2,
4459
- sdkCapability: Pm,
4469
+ sdkCapability: Lm,
4460
4470
  supportsCompression: Oe(),
4461
4471
  isSnapshot: gu()
4462
- }, s = t ? gd([t, I(c)]) : I(c), d = await Vm(i, a, o, s);
4463
- if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw Hm(d, c);
4464
- let f = await Wm(d.configuration.url, d.configuration.proxyUrl, n, r, s);
4465
- return f.backendUrl = i, f.authToken = o, f.brandingRequired = d.configuration.brandingRequired ?? !1, xp(d.configuration.push), f;
4472
+ }, s = t ? gd([t, I(c)]) : I(c), d = await Wm(i, a, o, s);
4473
+ if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw Gm(d, c);
4474
+ let f = await qm(d.configuration.url, d.configuration.proxyUrl, n, r, s);
4475
+ return f.backendUrl = i, f.authToken = o, f.brandingRequired = d.configuration.brandingRequired ?? !1, wp(d.configuration.push), f;
4466
4476
  } catch (e) {
4467
4477
  if (e instanceof Ml || e instanceof Pl || e instanceof Nl || e instanceof O || a === d - 1) throw e;
4468
- U.debug(`Init attempt ${a + 1}/${d} failed, retrying: ${e}`), await Ll(Nm * (a + 1), t);
4478
+ U.debug(`Init attempt ${a + 1}/${d} failed, retrying: ${e}`), await Ll(Im * (a + 1), t);
4469
4479
  }
4470
4480
  throw new T("Failed to init after all attempts");
4471
4481
  }
4472
- async function Ym(e, t, n = "auto", r = !1) {
4482
+ async function Qm(e, t, n = "auto", r = !1) {
4473
4483
  let i = Ad(e.backendType), a = e.token;
4474
4484
  U.debug(`Authenticating with session token to: ${i}, space ID: ${e.spaceId}`);
4475
4485
  let o = Id(), s = e.provisioningTimeoutMs ?? 6e4, c = {
4476
4486
  ...o,
4477
4487
  ...e.parameters
4478
- }, l = hf(), u = j() ? Am : 1;
4488
+ }, l = vf(), u = j() ? Nm : 1;
4479
4489
  for (let o = 0; o < u; o++) try {
4480
4490
  let o = {
4481
4491
  space: e.spaceId,
@@ -4483,13 +4493,13 @@ async function Ym(e, t, n = "auto", r = !1) {
4483
4493
  params: e.parameters,
4484
4494
  waitForRunning: !0,
4485
4495
  waitForRunningTimeoutMs: s,
4486
- connectTraceId: mm(),
4496
+ connectTraceId: _m(),
4487
4497
  contextType: m.Browser,
4488
4498
  userType: p.Human,
4489
- clientType: Df(),
4499
+ clientType: Af(),
4490
4500
  payloadType: me.Teleport,
4491
4501
  description: e.description ?? "Ikon SDK TypeScript",
4492
- deviceId: e.deviceId ?? ym(),
4502
+ deviceId: e.deviceId ?? Sm(),
4493
4503
  productId: e.productId ?? "",
4494
4504
  versionId: e.versionId ?? "",
4495
4505
  installId: e.installId ?? "",
@@ -4501,39 +4511,39 @@ async function Ym(e, t, n = "auto", r = !1) {
4501
4511
  launchParams: c,
4502
4512
  viewportWidth: l.width,
4503
4513
  viewportHeight: l.height,
4504
- theme: mf(),
4505
- timezone: Tf(),
4506
- isTouchDevice: Ef(),
4514
+ theme: _f(),
4515
+ timezone: Of(),
4516
+ isTouchDevice: kf(),
4507
4517
  initialPath: Hd(),
4508
4518
  initialUrl: Ud(),
4509
4519
  sdkType: 2,
4510
- sdkCapability: Pm,
4520
+ sdkCapability: Lm,
4511
4521
  supportsCompression: Oe(),
4512
4522
  isSnapshot: gu()
4513
- }, u = t ? gd([t, I(s)]) : I(s), d = await Vm(i, o, a, u);
4514
- if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw Hm(d, s);
4515
- let f = await Wm(d.configuration.url, d.configuration.proxyUrl, n, r, u);
4516
- return f.backendUrl = i, f.authToken = a, f.brandingRequired = d.configuration.brandingRequired ?? !1, xp(d.configuration.push), f;
4523
+ }, u = t ? gd([t, I(s)]) : I(s), d = await Wm(i, o, a, u);
4524
+ if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw Gm(d, s);
4525
+ let f = await qm(d.configuration.url, d.configuration.proxyUrl, n, r, u);
4526
+ return f.backendUrl = i, f.authToken = a, f.brandingRequired = d.configuration.brandingRequired ?? !1, wp(d.configuration.push), f;
4517
4527
  } catch (e) {
4518
4528
  if (e instanceof Ml || e instanceof Pl || e instanceof Nl || e instanceof O || o === u - 1) throw e;
4519
- U.debug(`Init attempt ${o + 1}/${u} failed, retrying: ${e}`), await Ll(Nm * (o + 1), t);
4529
+ U.debug(`Init attempt ${o + 1}/${u} failed, retrying: ${e}`), await Ll(Im * (o + 1), t);
4520
4530
  }
4521
4531
  throw new T("Failed to init after all attempts");
4522
4532
  }
4523
4533
  //#endregion
4524
4534
  //#region src/functions/type-conversion.ts
4525
- var Xm = /* @__PURE__ */ new Uint8Array();
4526
- function Zm(e) {
4535
+ var $m = /* @__PURE__ */ new Uint8Array();
4536
+ function eh(e) {
4527
4537
  switch (e.kind) {
4528
4538
  case "array": return {
4529
4539
  kind: "array",
4530
- element: Zm(e.element),
4540
+ element: eh(e.element),
4531
4541
  nullable: e.nullable ?? !1
4532
4542
  };
4533
4543
  case "dictionary": return {
4534
4544
  kind: "dictionary",
4535
4545
  keyType: e.keyType ?? "string",
4536
- value: Zm(e.value),
4546
+ value: eh(e.value),
4537
4547
  nullable: e.nullable ?? !1
4538
4548
  };
4539
4549
  default: return {
@@ -4542,17 +4552,17 @@ function Zm(e) {
4542
4552
  };
4543
4553
  }
4544
4554
  }
4545
- function Qm(e) {
4555
+ function th(e) {
4546
4556
  switch (e.kind) {
4547
4557
  case "boolean": return "System.Boolean";
4548
4558
  case "number": return "System.Double";
4549
4559
  case "string": return "System.String";
4550
- case "array": return `System.Collections.Generic.List\`1[${Qm(e.element)}]`;
4551
- case "dictionary": return `System.Collections.Generic.Dictionary\`2[${e.keyType === "int" ? "System.Int32" : "System.String"},${Qm(e.value)}]`;
4560
+ case "array": return `System.Collections.Generic.List\`1[${th(e.element)}]`;
4561
+ case "dictionary": return `System.Collections.Generic.Dictionary\`2[${e.keyType === "int" ? "System.Int32" : "System.String"},${th(e.value)}]`;
4552
4562
  default: return e;
4553
4563
  }
4554
4564
  }
4555
- function $m(e, t) {
4565
+ function nh(e, t) {
4556
4566
  if (e === void 0 || e === "") return;
4557
4567
  let n = JSON.parse(e);
4558
4568
  if (n === null) {
@@ -4561,7 +4571,7 @@ function $m(e, t) {
4561
4571
  }
4562
4572
  return n;
4563
4573
  }
4564
- function eh(e, t) {
4574
+ function rh(e, t) {
4565
4575
  if (e === void 0) return "null";
4566
4576
  if (e === null) {
4567
4577
  if (!t.nullable) throw Error("Value cannot be null for non-nullable type");
@@ -4569,9 +4579,9 @@ function eh(e, t) {
4569
4579
  }
4570
4580
  return JSON.stringify(e);
4571
4581
  }
4572
- function th(e, t) {
4582
+ function ih(e, t) {
4573
4583
  let r = (e.parameters ?? []).map((e) => {
4574
- let t = Zm(e.type), n = Object.prototype.hasOwnProperty.call(e, "defaultValue"), r = n ? eh(e.defaultValue, t) : "";
4584
+ let t = eh(e.type), n = Object.prototype.hasOwnProperty.call(e, "defaultValue"), r = n ? rh(e.defaultValue, t) : "";
4575
4585
  return {
4576
4586
  name: e.name,
4577
4587
  descriptor: t,
@@ -4579,7 +4589,7 @@ function th(e, t) {
4579
4589
  defaultValueJson: r,
4580
4590
  description: e.description
4581
4591
  };
4582
- }), i = Zm(e.returnType);
4592
+ }), i = eh(e.returnType);
4583
4593
  return {
4584
4594
  definition: e,
4585
4595
  handler: t,
@@ -4589,7 +4599,7 @@ function th(e, t) {
4589
4599
  Description: e.description ?? "",
4590
4600
  LlmInlineResult: e.llmInlineResult ?? !1,
4591
4601
  LlmCallOnlyOnce: e.llmCallOnlyOnce ?? !1,
4592
- ResultTypeName: Qm(i),
4602
+ ResultTypeName: th(i),
4593
4603
  IsEnumerable: !1,
4594
4604
  EnumerableItemTypeName: "",
4595
4605
  IsCancellable: !1,
@@ -4598,10 +4608,10 @@ function th(e, t) {
4598
4608
  Parameters: r.map((e, t) => ({
4599
4609
  ParameterIndex: t,
4600
4610
  ParameterName: e.name,
4601
- TypeName: Qm(e.descriptor),
4611
+ TypeName: th(e.descriptor),
4602
4612
  HasDefaultValue: e.hasDefaultValue,
4603
4613
  DefaultValueJson: e.defaultValueJson,
4604
- DefaultValueData: Xm,
4614
+ DefaultValueData: $m,
4605
4615
  IsEnumerable: !1,
4606
4616
  EnumerableItemTypeName: "",
4607
4617
  Description: e.description ?? ""
@@ -4613,24 +4623,24 @@ function th(e, t) {
4613
4623
  }
4614
4624
  //#endregion
4615
4625
  //#region src/functions/types.ts
4616
- function nh(e, t) {
4626
+ function ah(e, t) {
4617
4627
  return {
4618
4628
  value: e,
4619
4629
  data: t
4620
4630
  };
4621
4631
  }
4622
- var rh = class extends Error {
4632
+ var oh = class extends Error {
4623
4633
  remoteErrorType;
4624
4634
  remoteStackTrace;
4625
4635
  code;
4626
4636
  constructor(e, t, n, r = "") {
4627
4637
  super(e), this.remoteErrorType = t, this.remoteStackTrace = n, this.code = r, this.name = "FunctionCallError";
4628
4638
  }
4629
- }, ih = C("FunctionRegistry"), ah = /* @__PURE__ */ new Uint8Array(), oh = 3e4;
4630
- function sh(e) {
4639
+ }, sh = C("FunctionRegistry"), ch = /* @__PURE__ */ new Uint8Array(), lh = 3e4;
4640
+ function uh(e) {
4631
4641
  return !e || typeof e != "object" ? !1 : e.data instanceof Uint8Array;
4632
4642
  }
4633
- var ch = class {
4643
+ var dh = class {
4634
4644
  functions = /* @__PURE__ */ new Map();
4635
4645
  remoteFunctions = /* @__PURE__ */ new Map();
4636
4646
  pendingCalls = /* @__PURE__ */ new Map();
@@ -4652,7 +4662,7 @@ var ch = class {
4652
4662
  };
4653
4663
  }
4654
4664
  register(e, t) {
4655
- let n = th(e, t);
4665
+ let n = ih(e, t);
4656
4666
  return this.functions.set(e.name, n), this.isConnected && this.config && this.sendRegistration(n), () => this.unregister(e.name);
4657
4667
  }
4658
4668
  unregister(e) {
@@ -4693,7 +4703,7 @@ var ch = class {
4693
4703
  ParameterIndex: t,
4694
4704
  TypeName: n ? n.TypeName : this.inferTypeName(e),
4695
4705
  ValueJson: JSON.stringify(e ?? null),
4696
- ValueData: ah
4706
+ ValueData: ch
4697
4707
  });
4698
4708
  }), c = r?.instanceId ? n.fromString(r.instanceId) : n.createZero(), l = rr(Xn({
4699
4709
  FunctionId: n.fromString(i.id),
@@ -4706,8 +4716,8 @@ var ch = class {
4706
4716
  }), this.config.sessionId, { targetIds: [i.clientSessionId] });
4707
4717
  return new Promise((t, n) => {
4708
4718
  let r = setTimeout(() => {
4709
- this.pendingCalls.delete(o.toString()), n(/* @__PURE__ */ Error(`Function call '${e}' timed out after ${oh}ms`));
4710
- }, oh);
4719
+ this.pendingCalls.delete(o.toString()), n(/* @__PURE__ */ Error(`Function call '${e}' timed out after ${lh}ms`));
4720
+ }, lh);
4711
4721
  this.pendingCalls.set(o.toString(), {
4712
4722
  resolve: t,
4713
4723
  reject: n,
@@ -4774,7 +4784,7 @@ var ch = class {
4774
4784
  if (t === w.ACTION_FUNCTION_CALL) {
4775
4785
  let t = i(e);
4776
4786
  return this.handleFunctionCall(e, t.senderId).catch((e) => {
4777
- ih.error("Failed to handle function call:", e);
4787
+ sh.error("Failed to handle function call:", e);
4778
4788
  }), !0;
4779
4789
  }
4780
4790
  if (t === w.ACTION_FUNCTION_RESULT) return this.handleFunctionResult(e), !0;
@@ -4796,7 +4806,7 @@ var ch = class {
4796
4806
  handleFunctionResult(e) {
4797
4807
  let t = ra(e), n = t.CallId.toString(), r = this.pendingCalls.get(n);
4798
4808
  if (!r) {
4799
- ih.warn(`Received result for unknown call: ${n}`);
4809
+ sh.warn(`Received result for unknown call: ${n}`);
4800
4810
  return;
4801
4811
  }
4802
4812
  if (this.pendingCalls.delete(n), clearTimeout(r.timeout), t.ResultData && t.ResultData.length > 0 && !t.ResultJson) {
@@ -4809,11 +4819,11 @@ var ch = class {
4809
4819
  handleFunctionError(e) {
4810
4820
  let t = Gr(e), n = t.CallId.toString(), r = this.pendingCalls.get(n);
4811
4821
  if (!r) {
4812
- ih.warn(`Received error for unknown call: ${n}`);
4822
+ sh.warn(`Received error for unknown call: ${n}`);
4813
4823
  return;
4814
4824
  }
4815
4825
  this.pendingCalls.delete(n), clearTimeout(r.timeout);
4816
- let i = new rh(t.ErrorMessage, t.ErrorTypeName, t.StackTrace, t.ErrorCode), a = {
4826
+ let i = new oh(t.ErrorMessage, t.ErrorTypeName, t.StackTrace, t.ErrorCode), a = {
4817
4827
  functionName: r.functionName,
4818
4828
  args: r.args
4819
4829
  };
@@ -4849,7 +4859,7 @@ var ch = class {
4849
4859
  async handleFunctionCall(e, t) {
4850
4860
  let n = await ir(e), r = this.functions.get(n.FunctionName);
4851
4861
  if (!r) {
4852
- ih.warn(`Received call for unknown function: ${n.FunctionName}`), this.sendError(n.CallId, n.InstanceId, t, /* @__PURE__ */ Error(`Unknown function: ${n.FunctionName}`));
4862
+ sh.warn(`Received call for unknown function: ${n.FunctionName}`), this.sendError(n.CallId, n.InstanceId, t, /* @__PURE__ */ Error(`Unknown function: ${n.FunctionName}`));
4853
4863
  return;
4854
4864
  }
4855
4865
  this.sendAck(n.CallId, n.InstanceId, t), this.executeFunction(r, n, t);
@@ -4864,14 +4874,14 @@ var ch = class {
4864
4874
  continue;
4865
4875
  }
4866
4876
  let o = a?.ValueJson;
4867
- o === void 0 || o === "" ? i.hasDefaultValue ? r.push($m(i.defaultValueJson, i.descriptor)) : r.push(void 0) : r.push($m(o, i.descriptor));
4877
+ o === void 0 || o === "" ? i.hasDefaultValue ? r.push(nh(i.defaultValueJson, i.descriptor)) : r.push(void 0) : r.push(nh(o, i.descriptor));
4868
4878
  }
4869
- let i = await e.handler(...r), a = i, o = ah;
4870
- sh(i) && (a = i.value, o = new Uint8Array(i.data));
4871
- let s = eh(a, e.returnType);
4879
+ let i = await e.handler(...r), a = i, o = ch;
4880
+ uh(i) && (a = i.value, o = new Uint8Array(i.data));
4881
+ let s = rh(a, e.returnType);
4872
4882
  this.sendResult(t.CallId, t.InstanceId, n, e, s, o);
4873
4883
  } catch (e) {
4874
- ih.error(`Function ${t.FunctionName} execution failed:`, e), this.sendError(t.CallId, t.InstanceId, n, e instanceof Error ? e : Error(String(e)));
4884
+ sh.error(`Function ${t.FunctionName} execution failed:`, e), this.sendError(t.CallId, t.InstanceId, n, e instanceof Error ? e : Error(String(e)));
4875
4885
  }
4876
4886
  }
4877
4887
  sendAck(e, t, n) {
@@ -4887,7 +4897,7 @@ var ch = class {
4887
4897
  let o = na(Yi({
4888
4898
  CallId: e,
4889
4899
  InstanceId: t,
4890
- ResultTypeName: Qm(r.returnType),
4900
+ ResultTypeName: th(r.returnType),
4891
4901
  ResultJson: i,
4892
4902
  ResultData: a
4893
4903
  }), this.config.sessionId, { targetIds: [n] });
@@ -4904,7 +4914,7 @@ var ch = class {
4904
4914
  }), this.config.sessionId, { targetIds: [n] });
4905
4915
  this.config.sendProtocolMessage(i);
4906
4916
  }
4907
- }, lh = C("ReactiveRegistry"), uh = "Ikon.Reactive.Subscribe", dh = "Ikon.Reactive.Unsubscribe", fh = {
4917
+ }, fh = C("ReactiveRegistry"), ph = "Ikon.Reactive.Subscribe", mh = "Ikon.Reactive.Unsubscribe", hh = {
4908
4918
  name: "Ikon.Reactive.Update",
4909
4919
  description: "Receives reactive value updates pushed from the server when a subscribed reactive changes",
4910
4920
  returnType: { kind: "string" },
@@ -4922,7 +4932,7 @@ var ch = class {
4922
4932
  type: { kind: "string" }
4923
4933
  }
4924
4934
  ]
4925
- }, ph = class {
4935
+ }, gh = class {
4926
4936
  subscribersByKey = /* @__PURE__ */ new Map();
4927
4937
  functionRegistry;
4928
4938
  updateHandlerUnregister = null;
@@ -4930,9 +4940,9 @@ var ch = class {
4930
4940
  this.functionRegistry = e, this.registerUpdateHandler();
4931
4941
  }
4932
4942
  async subscribe(e, t, n) {
4933
- let r = n?.mount ?? "", i = mh(e, r), a = t, o = this.subscribersByKey.get(i), s = !o;
4943
+ let r = n?.mount ?? "", i = _h(e, r), a = t, o = this.subscribersByKey.get(i), s = !o;
4934
4944
  if (o || (o = /* @__PURE__ */ new Set(), this.subscribersByKey.set(i, o)), o.add(a), s) try {
4935
- t(hh(await this.functionRegistry.call(uh, [e, r])));
4945
+ t(vh(await this.functionRegistry.call(ph, [e, r])));
4936
4946
  } catch (e) {
4937
4947
  throw o.delete(a), o.size === 0 && this.subscribersByKey.delete(i), e;
4938
4948
  }
@@ -4944,46 +4954,46 @@ var ch = class {
4944
4954
  this.subscribersByKey.clear(), this.updateHandlerUnregister &&= (this.updateHandlerUnregister(), null);
4945
4955
  }
4946
4956
  unsubscribeOne(e, t, n) {
4947
- let r = mh(e, t), i = this.subscribersByKey.get(r);
4948
- i && (i.delete(n), !(i.size > 0) && (this.subscribersByKey.delete(r), this.functionRegistry.call(dh, [e, t]).catch((n) => {
4949
- lh.warn(`Failed to unsubscribe from '${e}' (mount='${t}'):`, n);
4957
+ let r = _h(e, t), i = this.subscribersByKey.get(r);
4958
+ i && (i.delete(n), !(i.size > 0) && (this.subscribersByKey.delete(r), this.functionRegistry.call(mh, [e, t]).catch((n) => {
4959
+ fh.warn(`Failed to unsubscribe from '${e}' (mount='${t}'):`, n);
4950
4960
  })));
4951
4961
  }
4952
4962
  registerUpdateHandler() {
4953
4963
  let e = (...e) => {
4954
- let t = e[0], n = e[1] ?? "", r = e[2], i = mh(t, n), a = this.subscribersByKey.get(i);
4964
+ let t = e[0], n = e[1] ?? "", r = e[2], i = _h(t, n), a = this.subscribersByKey.get(i);
4955
4965
  if (!a || a.size === 0) return "";
4956
- let o = hh(r);
4966
+ let o = vh(r);
4957
4967
  for (let e of a) try {
4958
4968
  e(o);
4959
4969
  } catch (e) {
4960
- lh.warn(`Reactive update callback for '${t}' (mount='${n}') threw:`, e);
4970
+ fh.warn(`Reactive update callback for '${t}' (mount='${n}') threw:`, e);
4961
4971
  }
4962
4972
  return "";
4963
4973
  };
4964
- this.updateHandlerUnregister = this.functionRegistry.register(fh, e);
4974
+ this.updateHandlerUnregister = this.functionRegistry.register(hh, e);
4965
4975
  }
4966
4976
  };
4967
- function mh(e, t) {
4977
+ function _h(e, t) {
4968
4978
  return t.length === 0 ? e : `${e}\0${t}`;
4969
4979
  }
4970
- function hh(e) {
4980
+ function vh(e) {
4971
4981
  if (e == null || e === "") return null;
4972
4982
  try {
4973
4983
  return JSON.parse(e);
4974
4984
  } catch (t) {
4975
- return lh.warn("Failed to parse reactive value JSON, returning raw string:", t), e;
4985
+ return fh.warn("Failed to parse reactive value JSON, returning raw string:", t), e;
4976
4986
  }
4977
4987
  }
4978
4988
  //#endregion
4979
4989
  //#region src/login/login-error-interceptor.ts
4980
- var gh = "login_required", _h = (e, t) => e.code === gh ? (fd({
4990
+ var yh = "login_required", bh = (e, t) => e.code === yh ? (fd({
4981
4991
  functionName: t.functionName,
4982
4992
  args: t.args
4983
4993
  }), ld(e.message), null) : null;
4984
4994
  //#endregion
4985
4995
  //#region src/media/device-detection.ts
4986
- function vh() {
4996
+ function xh() {
4987
4997
  if (typeof navigator > "u") return !1;
4988
4998
  let e = navigator.userAgentData;
4989
4999
  if (typeof e?.mobile == "boolean") return e.mobile;
@@ -4992,7 +5002,7 @@ function vh() {
4992
5002
  }
4993
5003
  //#endregion
4994
5004
  //#region src/functions/media-capture-functions.ts
4995
- function yh(e) {
5005
+ function Sh(e) {
4996
5006
  let t = e?.facingMode;
4997
5007
  if (typeof t == "string") return t === "user" || t === "environment" ? t : void 0;
4998
5008
  if (Array.isArray(t)) return t.find((e) => typeof e == "string" && (e === "user" || e === "environment")) ?? void 0;
@@ -5002,21 +5012,21 @@ function yh(e) {
5002
5012
  if (Array.isArray(e)) return e.find((e) => e === "user" || e === "environment") ?? void 0;
5003
5013
  }
5004
5014
  }
5005
- function bh(e) {
5015
+ function Ch(e) {
5006
5016
  if (!(typeof e != "string" || !e.trim())) try {
5007
5017
  return JSON.parse(e);
5008
5018
  } catch {
5009
5019
  return;
5010
5020
  }
5011
5021
  }
5012
- var xh = {
5022
+ var wh = {
5013
5023
  StartVideoCapture: "ikon.client.startVideoCapture",
5014
5024
  StartAudioCapture: "ikon.client.startAudioCapture",
5015
5025
  StopCapture: "ikon.client.stopCapture",
5016
5026
  CaptureImage: "ikon.client.captureImage",
5017
5027
  GetMediaDevices: "ikon.client.getMediaDevices"
5018
- }, Sh = {
5019
- name: xh.StartVideoCapture,
5028
+ }, Th = {
5029
+ name: wh.StartVideoCapture,
5020
5030
  description: "Start camera or screen capture and stream video frames to the server",
5021
5031
  returnType: { kind: "string" },
5022
5032
  parameters: [{
@@ -5034,8 +5044,8 @@ var xh = {
5034
5044
  },
5035
5045
  description: "JSON encoded capture options"
5036
5046
  }]
5037
- }, Ch = {
5038
- name: xh.StartAudioCapture,
5047
+ }, Eh = {
5048
+ name: wh.StartAudioCapture,
5039
5049
  description: "Start microphone capture and stream audio frames to the server",
5040
5050
  returnType: { kind: "string" },
5041
5051
  parameters: [{
@@ -5046,8 +5056,8 @@ var xh = {
5046
5056
  },
5047
5057
  description: "JSON encoded capture options"
5048
5058
  }]
5049
- }, wh = {
5050
- name: xh.StopCapture,
5059
+ }, Dh = {
5060
+ name: wh.StopCapture,
5051
5061
  description: "Stop a previously started capture by streamId",
5052
5062
  returnType: { kind: "boolean" },
5053
5063
  parameters: [{
@@ -5055,8 +5065,8 @@ var xh = {
5055
5065
  type: { kind: "string" },
5056
5066
  description: "Stream ID to stop"
5057
5067
  }]
5058
- }, Th = {
5059
- name: xh.CaptureImage,
5068
+ }, Oh = {
5069
+ name: wh.CaptureImage,
5060
5070
  description: "Capture a single image from the camera and return metadata (JSON) plus binary image data",
5061
5071
  returnType: { kind: "string" },
5062
5072
  parameters: [{
@@ -5067,24 +5077,24 @@ var xh = {
5067
5077
  },
5068
5078
  description: "JSON encoded capture options"
5069
5079
  }]
5070
- }, Eh = {
5071
- name: xh.GetMediaDevices,
5080
+ }, kh = {
5081
+ name: wh.GetMediaDevices,
5072
5082
  description: "Get list of available media input devices",
5073
5083
  returnType: { kind: "string" },
5074
5084
  parameters: []
5075
5085
  };
5076
- function Dh(e, t) {
5086
+ function Ah(e, t) {
5077
5087
  let n = [];
5078
- return n.push(e.register(Sh, async (e, n) => {
5088
+ return n.push(e.register(Th, async (e, n) => {
5079
5089
  if (t.isWebRtcCaptureAvailable) {
5080
5090
  let e = t.webRtcSignaling;
5081
5091
  if (!e) throw Error("WebRTC signaling is not connected");
5082
- let r = bh(n);
5092
+ let r = Ch(n);
5083
5093
  return await e.startVideoCapture(r?.constraints), "webrtc-video";
5084
5094
  }
5085
5095
  let r = await t.ensureMediaCapture();
5086
5096
  if (!r) throw Error("Media capture is not available in this environment");
5087
- let i = bh(n);
5097
+ let i = Ch(n);
5088
5098
  return ((typeof e == "string" && e.trim().toLowerCase() === "screen" ? "screen" : "camera") == "screen" ? await r.video.startScreen({
5089
5099
  userGesture: !1,
5090
5100
  options: i,
@@ -5094,22 +5104,22 @@ function Dh(e, t) {
5094
5104
  options: i,
5095
5105
  constraints: i?.constraints
5096
5106
  })).streamId;
5097
- })), n.push(e.register(Ch, async (e) => {
5107
+ })), n.push(e.register(Eh, async (e) => {
5098
5108
  if (t.isWebRtcCaptureAvailable) {
5099
5109
  let n = t.webRtcSignaling;
5100
5110
  if (!n) throw Error("WebRTC signaling is not connected");
5101
- let r = bh(e);
5111
+ let r = Ch(e);
5102
5112
  return await n.startAudioCapture(r?.constraints), "webrtc-audio";
5103
5113
  }
5104
5114
  let n = await t.ensureMediaCapture();
5105
5115
  if (!n) throw Error("Media capture is not available in this environment");
5106
- let r = bh(e);
5116
+ let r = Ch(e);
5107
5117
  return (await n.audio.startMic({
5108
5118
  userGesture: !1,
5109
5119
  options: r,
5110
5120
  constraints: r?.constraints
5111
5121
  })).streamId;
5112
- })), n.push(e.register(wh, async (e) => {
5122
+ })), n.push(e.register(Dh, async (e) => {
5113
5123
  if (t.isWebRtcCaptureAvailable) {
5114
5124
  let e = t.webRtcSignaling;
5115
5125
  return e && await e.stopCapture(), !0;
@@ -5118,20 +5128,20 @@ function Dh(e, t) {
5118
5128
  if (!n || typeof e != "string" || !e.trim()) return !1;
5119
5129
  let r = await n.video.stop(e), i = await n.audio.stop(e);
5120
5130
  return r || i;
5121
- })), n.push(e.register(Th, async (e) => {
5131
+ })), n.push(e.register(Oh, async (e) => {
5122
5132
  let n = await t.ensureMediaCapture();
5123
5133
  if (!n) throw Error("Media capture is not available in this environment");
5124
- let r = bh(e) ?? {};
5125
- if (r.mode === "native" && vh()) {
5134
+ let r = Ch(e) ?? {};
5135
+ if (r.mode === "native" && xh()) {
5126
5136
  let e = await n.image.captureFromNativeCamera({
5127
- facing: yh(r.constraints),
5137
+ facing: Sh(r.constraints),
5128
5138
  mime: r.mime,
5129
5139
  quality: r.quality,
5130
5140
  width: r.width,
5131
5141
  height: r.height
5132
5142
  });
5133
5143
  if (!e) throw Error("Native camera capture was cancelled");
5134
- return nh(JSON.stringify({
5144
+ return ah(JSON.stringify({
5135
5145
  mime: e.mime,
5136
5146
  width: e.width,
5137
5147
  height: e.height
@@ -5152,12 +5162,12 @@ function Dh(e, t) {
5152
5162
  quality: r.quality,
5153
5163
  width: r.width,
5154
5164
  height: r.height
5155
- }), nh(JSON.stringify({
5165
+ }), ah(JSON.stringify({
5156
5166
  mime: a.mime,
5157
5167
  width: a.width,
5158
5168
  height: a.height
5159
5169
  }), a.data);
5160
- })), n.push(e.register(Eh, async () => {
5170
+ })), n.push(e.register(kh, async () => {
5161
5171
  if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) return JSON.stringify([]);
5162
5172
  let e = (await navigator.mediaDevices.enumerateDevices()).filter((e) => e.kind === "audioinput" || e.kind === "videoinput").map((e) => ({
5163
5173
  deviceId: e.deviceId,
@@ -5172,45 +5182,45 @@ function Dh(e, t) {
5172
5182
  }
5173
5183
  //#endregion
5174
5184
  //#region src/functions/sound-functions.ts
5175
- var Oh = {
5185
+ var jh = {
5176
5186
  PlaySound: "ikon.client.playSound",
5177
5187
  StopSound: "ikon.client.stopSound"
5178
- }, kh = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Map(), Ah = 1, jh = "data:audio/wav;base64,UklGRjIAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQYAAAAAAAAAAAA=", Mh = 8, Nh = [], Ph = !1, q = null;
5179
- function Fh() {
5180
- if (!(Nh.length > 0 || typeof Audio > "u")) for (let e = 0; e < Mh; e++) {
5188
+ }, Mh = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Map(), Nh = 1, Ph = "data:audio/wav;base64,UklGRjIAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQYAAAAAAAAAAAA=", Fh = 8, Ih = [], Lh = !1, q = null;
5189
+ function Rh() {
5190
+ if (!(Ih.length > 0 || typeof Audio > "u")) for (let e = 0; e < Fh; e++) {
5181
5191
  let e = new Audio();
5182
- e.preload = "auto", Nh.push(e);
5192
+ e.preload = "auto", Ih.push(e);
5183
5193
  }
5184
5194
  }
5185
- function Ih() {
5186
- if (!Ph) {
5187
- Fh();
5188
- for (let e of Nh) try {
5189
- e.src = jh;
5195
+ function zh() {
5196
+ if (!Lh) {
5197
+ Rh();
5198
+ for (let e of Ih) try {
5199
+ e.src = Ph;
5190
5200
  let t = e.play();
5191
5201
  typeof t?.then == "function" ? t.then(() => {
5192
- e.pause(), e.currentTime = 0, Ph = !0, Rh();
5193
- }, () => {}) : Ph = !0;
5202
+ e.pause(), e.currentTime = 0, Lh = !0, Vh();
5203
+ }, () => {}) : Lh = !0;
5194
5204
  } catch {}
5195
- Ph && Rh();
5205
+ Lh && Vh();
5196
5206
  }
5197
5207
  }
5198
- function Lh() {
5208
+ function Bh() {
5199
5209
  if (q || typeof window > "u") return;
5200
- let e = () => Ih();
5210
+ let e = () => zh();
5201
5211
  q = e, window.addEventListener("pointerdown", e, { capture: !0 }), window.addEventListener("touchend", e, { capture: !0 }), window.addEventListener("mousedown", e, { capture: !0 }), window.addEventListener("keydown", e, { capture: !0 });
5202
5212
  }
5203
- function Rh() {
5213
+ function Vh() {
5204
5214
  !q || typeof window > "u" || (window.removeEventListener("pointerdown", q, { capture: !0 }), window.removeEventListener("touchend", q, { capture: !0 }), window.removeEventListener("mousedown", q, { capture: !0 }), window.removeEventListener("keydown", q, { capture: !0 }), q = null);
5205
5215
  }
5206
- function zh() {
5207
- Fh();
5208
- for (let e of Nh) if (e.paused || e.ended) return e;
5216
+ function Hh() {
5217
+ Rh();
5218
+ for (let e of Ih) if (e.paused || e.ended) return e;
5209
5219
  let e = new Audio();
5210
- return e.preload = "auto", Nh.push(e), e;
5220
+ return e.preload = "auto", Ih.push(e), e;
5211
5221
  }
5212
- var Bh = {
5213
- name: Oh.PlaySound,
5222
+ var Uh = {
5223
+ name: jh.PlaySound,
5214
5224
  description: "Play a sound effect",
5215
5225
  returnType: {
5216
5226
  kind: "string",
@@ -5248,19 +5258,19 @@ var Bh = {
5248
5258
  }
5249
5259
  ]
5250
5260
  };
5251
- function Vh(e, t, n, r) {
5261
+ function Wh(e, t, n, r) {
5252
5262
  if (typeof window > "u" || typeof Audio > "u" || typeof e != "string" || !e.trim()) return Promise.resolve(null);
5253
5263
  let i = e;
5254
- if (typeof t == "string" && t && kh.set(t, e), e.startsWith("sound:")) {
5255
- let t = e.slice(6), n = kh.get(t);
5264
+ if (typeof t == "string" && t && Mh.set(t, e), e.startsWith("sound:")) {
5265
+ let t = e.slice(6), n = Mh.get(t);
5256
5266
  if (!n) return Promise.resolve(null);
5257
5267
  i = n;
5258
5268
  }
5259
5269
  return new Promise((e) => {
5260
5270
  try {
5261
- let t = zh();
5271
+ let t = Hh();
5262
5272
  t.src = i, t.currentTime = 0, t.loop = r === !0, t.volume = typeof n == "number" ? Math.max(0, Math.min(1, n)) : 1;
5263
- let a = `sound-${Ah++}`, o = () => {
5273
+ let a = `sound-${Nh++}`, o = () => {
5264
5274
  K.delete(a), t.removeEventListener("ended", o), t.removeEventListener("error", o);
5265
5275
  };
5266
5276
  t.addEventListener("ended", o), t.addEventListener("error", o), K.set(a, t), t.play().then(() => e(a), () => {
@@ -5271,8 +5281,8 @@ function Vh(e, t, n, r) {
5271
5281
  }
5272
5282
  });
5273
5283
  }
5274
- var Hh = {
5275
- name: Oh.StopSound,
5284
+ var Gh = {
5285
+ name: jh.StopSound,
5276
5286
  description: "Stop a playing sound by ID",
5277
5287
  returnType: { kind: "boolean" },
5278
5288
  parameters: [{
@@ -5281,7 +5291,7 @@ var Hh = {
5281
5291
  description: "Playback ID from playSound"
5282
5292
  }]
5283
5293
  };
5284
- function Uh(e) {
5294
+ function Kh(e) {
5285
5295
  if (typeof e != "string") return !1;
5286
5296
  let t = K.get(e);
5287
5297
  if (!t) return !1;
@@ -5291,33 +5301,33 @@ function Uh(e) {
5291
5301
  return !1;
5292
5302
  }
5293
5303
  }
5294
- function Wh() {
5295
- kh.clear();
5304
+ function qh() {
5305
+ Mh.clear();
5296
5306
  for (let [e, t] of K) {
5297
5307
  try {
5298
5308
  t.pause(), t.currentTime = 0;
5299
5309
  } catch {}
5300
5310
  K.delete(e);
5301
5311
  }
5302
- Rh();
5312
+ Vh();
5303
5313
  }
5304
- var Gh = [{
5305
- definition: Bh,
5306
- handler: Vh
5314
+ var Jh = [{
5315
+ definition: Uh,
5316
+ handler: Wh
5307
5317
  }, {
5308
- definition: Hh,
5309
- handler: Uh
5318
+ definition: Gh,
5319
+ handler: Kh
5310
5320
  }];
5311
- function Kh(e) {
5312
- Lh();
5313
- let t = Gh.map(({ definition: t, handler: n }) => e.register(t, n));
5321
+ function Yh(e) {
5322
+ Bh();
5323
+ let t = Jh.map(({ definition: t, handler: n }) => e.register(t, n));
5314
5324
  return () => {
5315
- t.forEach((e) => e()), Wh();
5325
+ t.forEach((e) => e()), qh();
5316
5326
  };
5317
5327
  }
5318
5328
  //#endregion
5319
5329
  //#region src/worker/viseme-worker.ts?worker
5320
- function qh(e) {
5330
+ function Xh(e) {
5321
5331
  return new Worker("" + new URL("assets/viseme-worker-TOrhAq2M.js", import.meta.url).href, {
5322
5332
  type: "module",
5323
5333
  name: e?.name
@@ -5325,7 +5335,7 @@ function qh(e) {
5325
5335
  }
5326
5336
  //#endregion
5327
5337
  //#region src/media/viseme-tracker.ts
5328
- var Jh = C("VisemeTracker"), Yh = _e * 2, Xh = class e {
5338
+ var Zh = C("VisemeTracker"), Qh = _e * 2, $h = class e {
5329
5339
  static MAX_WORKER_REBUILD_ATTEMPTS = 3;
5330
5340
  client;
5331
5341
  worker = null;
@@ -5345,16 +5355,16 @@ var Jh = C("VisemeTracker"), Yh = _e * 2, Xh = class e {
5345
5355
  enable() {
5346
5356
  if (this.worker) return;
5347
5357
  if (typeof Worker > "u") {
5348
- Jh.warn("Viseme worker unavailable (Workers not supported)");
5358
+ Zh.warn("Viseme worker unavailable (Workers not supported)");
5349
5359
  return;
5350
5360
  }
5351
5361
  let t = this.client.createProtocolMessagePort({ opcodeGroupsMask: w.GROUP_AUDIO });
5352
5362
  if (!t) return;
5353
5363
  this.protocolPort = t;
5354
5364
  try {
5355
- this.worker = new qh();
5365
+ this.worker = new Xh();
5356
5366
  } catch (e) {
5357
- Jh.warn(`Failed to create viseme worker: ${e}`), this.protocolPort.close(), this.protocolPort = null;
5367
+ Zh.warn(`Failed to create viseme worker: ${e}`), this.protocolPort.close(), this.protocolPort = null;
5358
5368
  return;
5359
5369
  }
5360
5370
  let n = this.worker;
@@ -5365,7 +5375,7 @@ var Jh = C("VisemeTracker"), Yh = _e * 2, Xh = class e {
5365
5375
  t.lineno,
5366
5376
  t.colno
5367
5377
  ].filter((e) => e != null && String(e).length > 0);
5368
- Jh.error(`Viseme worker failed: ${n.join(" ")}`.trim()), this.dispose(), this.workerRebuildAttempts < e.MAX_WORKER_REBUILD_ATTEMPTS ? (this.workerRebuildAttempts++, this.enable()) : Jh.error("Viseme worker crashed repeatedly, giving up on rebuilds");
5378
+ Zh.error(`Viseme worker failed: ${n.join(" ")}`.trim()), this.dispose(), this.workerRebuildAttempts < e.MAX_WORKER_REBUILD_ATTEMPTS ? (this.workerRebuildAttempts++, this.enable()) : Zh.error("Viseme worker crashed repeatedly, giving up on rebuilds");
5369
5379
  }), n.postMessage({
5370
5380
  type: "attachProtocolPort",
5371
5381
  port: t.port
@@ -5420,7 +5430,7 @@ var Jh = C("VisemeTracker"), Yh = _e * 2, Xh = class e {
5420
5430
  if (!t.timingEstablished || t.count === 0) continue;
5421
5431
  let n = e - t.playbackStartTime;
5422
5432
  if (n < 0) continue;
5423
- let r = n * Yh, i = t.frames, a = t.count, o = (t.head - a + x) % x, s = null, c = null;
5433
+ let r = n * Qh, i = t.frames, a = t.count, o = (t.head - a + x) % x, s = null, c = null;
5424
5434
  for (let e = 0; e < a; e++) {
5425
5435
  let t = i[(o + e) % x], n = t.samplePosition + Math.max(t.frameSamples, 1);
5426
5436
  if (t.samplePosition <= r && (s = t), n > r && !c && (c = t, t.samplePosition <= r)) break;
@@ -5494,35 +5504,35 @@ var Jh = C("VisemeTracker"), Yh = _e * 2, Xh = class e {
5494
5504
  }
5495
5505
  }
5496
5506
  }
5497
- }, Zh = C("DebugMode"), J = !1;
5498
- function Qh() {
5499
- return J ? !0 : (J = au(), J && (ye(S.DEBUG), Zh.info("Debug mode enabled")), J);
5507
+ }, eg = C("DebugMode"), J = !1;
5508
+ function tg() {
5509
+ return J ? !0 : (J = au(), J && (ye(S.DEBUG), eg.info("Debug mode enabled")), J);
5500
5510
  }
5501
- function $h() {
5511
+ function ng() {
5502
5512
  return J;
5503
5513
  }
5504
- function eg() {
5505
- J || (J = !0, ye(S.DEBUG), Zh.info("Debug mode enabled"), tu(Vl, "true"));
5514
+ function rg() {
5515
+ J || (J = !0, ye(S.DEBUG), eg.info("Debug mode enabled"), tu(Vl, "true"));
5506
5516
  }
5507
5517
  //#endregion
5508
5518
  //#region src/utils/inspect-mode.ts
5509
- var tg = "ikon-inspect-mode-changed", Y = !1;
5510
- function ng() {
5511
- typeof window < "u" && window.dispatchEvent(new Event(tg));
5519
+ var ig = "ikon-inspect-mode-changed", Y = !1;
5520
+ function ag() {
5521
+ typeof window < "u" && window.dispatchEvent(new Event(ig));
5512
5522
  }
5513
- function rg() {
5523
+ function og() {
5514
5524
  let e = fu();
5515
- return e !== Y && (Y = e, ng()), Y;
5525
+ return e !== Y && (Y = e, ag()), Y;
5516
5526
  }
5517
- function ig() {
5527
+ function sg() {
5518
5528
  return Y;
5519
5529
  }
5520
- function ag() {
5521
- Y || (Y = !0, tu(Jl, "true"), ng());
5530
+ function cg() {
5531
+ Y || (Y = !0, tu(Jl, "true"), ag());
5522
5532
  }
5523
5533
  //#endregion
5524
5534
  //#region src/utils/external-link.ts
5525
- var og = /* @__PURE__ */ new Set([
5535
+ var lg = /* @__PURE__ */ new Set([
5526
5536
  "http",
5527
5537
  "https",
5528
5538
  "file",
@@ -5539,12 +5549,12 @@ var og = /* @__PURE__ */ new Set([
5539
5549
  "edge",
5540
5550
  "moz-extension",
5541
5551
  "safari-web-extension"
5542
- ]), sg = /^([a-z][a-z0-9+.-]*):/i;
5543
- function cg(e) {
5544
- let t = sg.exec(e.trim());
5545
- return t ? !og.has(t[1].toLowerCase()) : !1;
5552
+ ]), ug = /^([a-z][a-z0-9+.-]*):/i;
5553
+ function dg(e) {
5554
+ let t = ug.exec(e.trim());
5555
+ return t ? !lg.has(t[1].toLowerCase()) : !1;
5546
5556
  }
5547
- function lg(e) {
5557
+ function fg(e) {
5548
5558
  if (typeof document > "u") return;
5549
5559
  let t = document.createElement("iframe");
5550
5560
  t.setAttribute("aria-hidden", "true"), t.style.display = "none", document.body.appendChild(t);
@@ -5558,7 +5568,7 @@ function lg(e) {
5558
5568
  }
5559
5569
  //#endregion
5560
5570
  //#region src/utils/browser-support.ts
5561
- var ug = [
5571
+ var pg = [
5562
5572
  {
5563
5573
  name: "WebSocket",
5564
5574
  isPresent: () => typeof WebSocket < "u"
@@ -5580,9 +5590,9 @@ var ug = [
5580
5590
  isPresent: () => typeof Promise < "u" && typeof Promise.allSettled == "function"
5581
5591
  }
5582
5592
  ];
5583
- function dg() {
5593
+ function mg() {
5584
5594
  let e = [];
5585
- for (let t of ug) {
5595
+ for (let t of pg) {
5586
5596
  let n;
5587
5597
  try {
5588
5598
  n = t.isPresent();
@@ -5598,22 +5608,22 @@ function dg() {
5598
5608
  }
5599
5609
  //#endregion
5600
5610
  //#region src/transport/transport-probe.ts
5601
- var fg = C("TransportProbe"), pg = 3e3;
5602
- async function mg(e, t, n) {
5603
- let r = n?.timeoutMs ?? pg, i = n?.signal;
5611
+ var hg = C("TransportProbe"), gg = 3e3;
5612
+ async function _g(e, t, n) {
5613
+ let r = n?.timeoutMs ?? gg, i = n?.signal;
5604
5614
  if (i?.aborted) return !1;
5605
5615
  let a = Date.now();
5606
5616
  try {
5607
- let n = hg(e) ? await _g(t, r, i) : await gg(t, r, i);
5608
- return fg.debug(`Probe ${b[e]} ${t}: ${n ? "reachable" : "unreachable"} in ${Date.now() - a}ms`), n;
5617
+ let n = vg(e) ? await bg(t, r, i) : await yg(t, r, i);
5618
+ return hg.debug(`Probe ${b[e]} ${t}: ${n ? "reachable" : "unreachable"} in ${Date.now() - a}ms`), n;
5609
5619
  } catch (n) {
5610
- return fg.debug(`Probe ${b[e]} ${t} failed after ${Date.now() - a}ms: ${n instanceof Error ? n.message : n}`), !1;
5620
+ return hg.debug(`Probe ${b[e]} ${t} failed after ${Date.now() - a}ms: ${n instanceof Error ? n.message : n}`), !1;
5611
5621
  }
5612
5622
  }
5613
- function hg(e) {
5623
+ function vg(e) {
5614
5624
  return e === b.WebTransport || e === b.WebTransportProxy;
5615
5625
  }
5616
- function gg(e, t, n) {
5626
+ function yg(e, t, n) {
5617
5627
  return typeof WebSocket > "u" ? Promise.resolve(!1) : new Promise((r) => {
5618
5628
  let i = new WebSocket(e), a = !1, o = (e) => {
5619
5629
  if (!a) {
@@ -5627,7 +5637,7 @@ function gg(e, t, n) {
5627
5637
  n?.addEventListener("abort", s, { once: !0 }), i.onopen = () => o(!0), i.onerror = () => o(!1), i.onclose = () => o(!1);
5628
5638
  });
5629
5639
  }
5630
- async function _g(e, t, n) {
5640
+ async function bg(e, t, n) {
5631
5641
  if (!wu()) return !1;
5632
5642
  let r = new WebTransport(e), i;
5633
5643
  try {
@@ -5646,7 +5656,7 @@ async function _g(e, t, n) {
5646
5656
  }
5647
5657
  //#endregion
5648
5658
  //#region src/worker/protocol-worker.ts?worker
5649
- function vg(e) {
5659
+ function xg(e) {
5650
5660
  return new Worker("" + new URL("assets/protocol-worker-sC4mqNcM.js", import.meta.url).href, {
5651
5661
  type: "module",
5652
5662
  name: e?.name
@@ -5654,12 +5664,12 @@ function vg(e) {
5654
5664
  }
5655
5665
  //#endregion
5656
5666
  //#region src/client/endpoint-selector.ts
5657
- var yg = {
5667
+ var Sg = {
5658
5668
  [b.WebTransport]: 0,
5659
5669
  [b.WebSocket]: 1,
5660
5670
  [b.WebTransportProxy]: 2,
5661
5671
  [b.WebSocketProxy]: 3
5662
- }, bg = /* @__PURE__ */ new Set([b.WebTransportProxy, b.WebSocketProxy]), xg = /* @__PURE__ */ new Set([b.WebTransport, b.WebSocket]), Sg = /* @__PURE__ */ new Set([b.WebSocket, b.WebSocketProxy]), Cg = /* @__PURE__ */ new Set([b.WebTransport, b.WebTransportProxy]), X = C("EndpointSelector"), wg = "ikon-endpoint-type", Tg = "ikon-proxy-preferred", Eg = "ikon-endpoint-timestamp", Dg = "ikon-endpoint-revalidated", Og = 864e5, kg = class {
5672
+ }, Cg = /* @__PURE__ */ new Set([b.WebTransportProxy, b.WebSocketProxy]), wg = /* @__PURE__ */ new Set([b.WebTransport, b.WebSocket]), Tg = /* @__PURE__ */ new Set([b.WebSocket, b.WebSocketProxy]), Eg = /* @__PURE__ */ new Set([b.WebTransport, b.WebTransportProxy]), X = C("EndpointSelector"), Dg = "ikon-endpoint-type", Og = "ikon-proxy-preferred", kg = "ikon-endpoint-timestamp", Ag = "ikon-endpoint-revalidated", jg = 864e5, Mg = class {
5663
5673
  isLocal;
5664
5674
  _proxyMode;
5665
5675
  _websocket;
@@ -5681,27 +5691,27 @@ var yg = {
5681
5691
  markProxyPreferred() {
5682
5692
  this._proxyPreferred = !0;
5683
5693
  try {
5684
- localStorage.setItem(Tg, "true"), localStorage.setItem(Eg, String(Date.now()));
5694
+ localStorage.setItem(Og, "true"), localStorage.setItem(kg, String(Date.now()));
5685
5695
  } catch {}
5686
5696
  X.debug("Marked proxy as preferred");
5687
5697
  }
5688
5698
  clearProxyPreference() {
5689
5699
  this._proxyPreferred = !1;
5690
5700
  try {
5691
- localStorage.removeItem(Tg);
5701
+ localStorage.removeItem(Og);
5692
5702
  } catch {}
5693
5703
  }
5694
5704
  getOrderedTypes(e) {
5695
5705
  let t = Array.from(e.keys());
5696
5706
  if (this.isLocal) return t;
5697
5707
  let n;
5698
- n = this._proxyMode === "force-proxy" ? t.filter((e) => bg.has(e)) : this._proxyMode === "force-direct" ? t.filter((e) => xg.has(e)) : t, n = this.filterByTransport(n);
5699
- let r = [...n].sort((e, t) => (yg[e] ?? 999) - (yg[t] ?? 999));
5708
+ n = this._proxyMode === "force-proxy" ? t.filter((e) => Cg.has(e)) : this._proxyMode === "force-direct" ? t.filter((e) => wg.has(e)) : t, n = this.filterByTransport(n);
5709
+ let r = [...n].sort((e, t) => (Sg[e] ?? 999) - (Sg[t] ?? 999));
5700
5710
  if (this._proxyMode === "auto" && this._proxyPreferred) {
5701
- let e = r.filter((e) => bg.has(e)), t = r.filter((e) => xg.has(e));
5711
+ let e = r.filter((e) => Cg.has(e)), t = r.filter((e) => wg.has(e));
5702
5712
  r.length = 0, r.push(...e, ...t);
5703
5713
  }
5704
- if (this.workingEndpointType !== null && e.has(this.workingEndpointType) && (!this._proxyPreferred || bg.has(this.workingEndpointType))) {
5714
+ if (this.workingEndpointType !== null && e.has(this.workingEndpointType) && (!this._proxyPreferred || Cg.has(this.workingEndpointType))) {
5705
5715
  let e = r.indexOf(this.workingEndpointType);
5706
5716
  e > 0 && (r.splice(e, 1), r.unshift(this.workingEndpointType));
5707
5717
  }
@@ -5715,17 +5725,17 @@ var yg = {
5715
5725
  }
5716
5726
  this.workingEndpointType = e;
5717
5727
  try {
5718
- localStorage.setItem(wg, String(e)), localStorage.setItem(Eg, String(Date.now())), localStorage.getItem(Dg) === null && localStorage.setItem(Dg, String(Date.now()));
5728
+ localStorage.setItem(Dg, String(e)), localStorage.setItem(kg, String(Date.now())), localStorage.getItem(Ag) === null && localStorage.setItem(Ag, String(Date.now()));
5719
5729
  } catch {}
5720
- if (bg.has(e)) {
5730
+ if (Cg.has(e)) {
5721
5731
  this._proxyPreferred = !0;
5722
5732
  try {
5723
- localStorage.setItem(Tg, "true");
5733
+ localStorage.setItem(Og, "true");
5724
5734
  } catch {}
5725
- } else if (xg.has(e)) {
5735
+ } else if (wg.has(e)) {
5726
5736
  this._proxyPreferred = !1;
5727
5737
  try {
5728
- localStorage.removeItem(Tg);
5738
+ localStorage.removeItem(Og);
5729
5739
  } catch {}
5730
5740
  }
5731
5741
  X.debug(`Remembered working type: ${b[e]}`);
@@ -5734,37 +5744,37 @@ var yg = {
5734
5744
  clearRememberedType() {
5735
5745
  this.workingEndpointType = null;
5736
5746
  try {
5737
- localStorage.removeItem(wg);
5747
+ localStorage.removeItem(Dg);
5738
5748
  } catch {}
5739
5749
  }
5740
5750
  needsRevalidation() {
5741
5751
  if (this.isLocal || this._proxyMode !== "auto" || this.workingEndpointType === null && !this._proxyPreferred) return !1;
5742
5752
  let e = this.revalidationAgeMs();
5743
- return e !== null && e > Og;
5753
+ return e !== null && e > jg;
5744
5754
  }
5745
5755
  getFasterTypes(e, t) {
5746
- let n = yg[e] ?? 999;
5747
- return this.filterByTransport(Array.from(t.keys())).filter((e) => (yg[e] ?? 999) < n).sort((e, t) => (yg[e] ?? 999) - (yg[t] ?? 999));
5756
+ let n = Sg[e] ?? 999;
5757
+ return this.filterByTransport(Array.from(t.keys())).filter((e) => (Sg[e] ?? 999) < n).sort((e, t) => (Sg[e] ?? 999) - (Sg[t] ?? 999));
5748
5758
  }
5749
5759
  recordFasterTypeReachable(e) {
5750
5760
  X.debug(`Faster endpoint type ${b[e]} is reachable again, dropping learned preference`), this.clearRememberedType(), this.clearProxyPreference();
5751
5761
  try {
5752
- localStorage.removeItem(Eg), localStorage.removeItem(Dg);
5762
+ localStorage.removeItem(kg), localStorage.removeItem(Ag);
5753
5763
  } catch {}
5754
5764
  }
5755
5765
  recordFasterTypesUnreachable() {
5756
5766
  try {
5757
- localStorage.setItem(Dg, String(Date.now()));
5767
+ localStorage.setItem(Ag, String(Date.now()));
5758
5768
  } catch {}
5759
5769
  X.debug("Faster endpoint types still unreachable, keeping the learned preference");
5760
5770
  }
5761
5771
  filterByTransport(e) {
5762
5772
  let t = this._websocket, n = this._webtransport;
5763
- return t === void 0 && n === void 0 || t === !0 && n === !0 ? e : e.filter((e) => t === !0 && n === void 0 ? Sg.has(e) : n === !0 && t === void 0 ? Cg.has(e) : t === !1 ? !Sg.has(e) : n !== !1 || !Cg.has(e));
5773
+ return t === void 0 && n === void 0 || t === !0 && n === !0 ? e : e.filter((e) => t === !0 && n === void 0 ? Tg.has(e) : n === !0 && t === void 0 ? Eg.has(e) : t === !1 ? !Tg.has(e) : n !== !1 || !Eg.has(e));
5764
5774
  }
5765
5775
  revalidationAgeMs() {
5766
5776
  try {
5767
- let e = localStorage.getItem(Dg);
5777
+ let e = localStorage.getItem(Ag);
5768
5778
  if (e === null) return null;
5769
5779
  let t = Date.now() - Number(e);
5770
5780
  return Number.isFinite(t) ? t : null;
@@ -5774,12 +5784,12 @@ var yg = {
5774
5784
  }
5775
5785
  loadRememberedType() {
5776
5786
  try {
5777
- let e = localStorage.getItem(wg);
5787
+ let e = localStorage.getItem(Dg);
5778
5788
  if (e !== null) {
5779
5789
  let t = Number(e);
5780
5790
  if (b[t] !== void 0) {
5781
5791
  this.workingEndpointType = t;
5782
- let e = localStorage.getItem(Eg), n = e ? Math.round((Date.now() - Number(e)) / 36e5) : "?";
5792
+ let e = localStorage.getItem(kg), n = e ? Math.round((Date.now() - Number(e)) / 36e5) : "?";
5783
5793
  X.debug(`Loaded remembered type: ${b[t]} (age: ${n}h)`);
5784
5794
  }
5785
5795
  }
@@ -5787,14 +5797,14 @@ var yg = {
5787
5797
  }
5788
5798
  loadProxyPreference() {
5789
5799
  try {
5790
- this._proxyPreferred = localStorage.getItem(Tg) === "true", this._proxyPreferred && X.debug("Loaded proxy preference: preferred");
5800
+ this._proxyPreferred = localStorage.getItem(Og) === "true", this._proxyPreferred && X.debug("Loaded proxy preference: preferred");
5791
5801
  } catch {}
5792
5802
  }
5793
- }, Z = C("IkonClient"), Ag = [1e4, 3e4];
5794
- function jg() {
5803
+ }, Z = C("IkonClient"), Ng = [1e4, 3e4];
5804
+ function Pg() {
5795
5805
  return typeof __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__ < "u" && __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__;
5796
5806
  }
5797
- var Mg = class {
5807
+ var Fg = class {
5798
5808
  channelManager = null;
5799
5809
  protocolWorker = null;
5800
5810
  preloadedWorker = null;
@@ -5874,7 +5884,7 @@ var Mg = class {
5874
5884
  _reconnectTimer = null;
5875
5885
  _serverStopped = !1;
5876
5886
  _hasBeenConnected = !1;
5877
- _waitForExternalConnectUrl = jg();
5887
+ _waitForExternalConnectUrl = Pg();
5878
5888
  _externalConnectUrlCleanup = null;
5879
5889
  get media() {
5880
5890
  return this._media;
@@ -5891,7 +5901,7 @@ var Mg = class {
5891
5901
  return this._mediaCapture;
5892
5902
  }
5893
5903
  async ensureMediaCapture() {
5894
- return this._mediaCapture ? this._mediaCapture : R() ? (this._mediaCapturePromise ||= Promise.resolve().then(() => f_).then(({ IkonMediaCapture: e }) => (this._mediaCapture = new e(this, this._mediaCaptureConfig), this._mediaCapture)), this._mediaCapturePromise) : null;
5904
+ return this._mediaCapture ? this._mediaCapture : R() ? (this._mediaCapturePromise ||= Promise.resolve().then(() => h_).then(({ IkonMediaCapture: e }) => (this._mediaCapture = new e(this, this._mediaCaptureConfig), this._mediaCapture)), this._mediaCapturePromise) : null;
5895
5905
  }
5896
5906
  async ensureMedia() {
5897
5907
  return this._media ? this._media : (this._mediaPromise ||= import("./ikon-media--ap3vpXf.js").then((e) => e.n).then(({ IkonMedia: e }) => (this._media = new e(this, this._mediaConfig), this._media)), this._mediaPromise);
@@ -5937,14 +5947,14 @@ var Mg = class {
5937
5947
  ].filter(Boolean).length;
5938
5948
  if (t === 0) throw Error("IkonClient requires one of: \"local\", \"apiKey\", or \"sessionToken\" configuration");
5939
5949
  if (t > 1) throw Error("IkonClient accepts only one of: \"local\", \"apiKey\", or \"sessionToken\" configuration");
5940
- Qh(), R() && gf();
5950
+ tg(), R() && yf();
5941
5951
  let n = e.local ? null : nu() ?? e.proxy ?? null, r = n === !0 ? "force-proxy" : n === !1 ? "force-direct" : "auto", i = e.local ? null : ru(), a = e.local ? null : iu(), o = i ?? e.websocket, s = a ?? e.webtransport ?? !1;
5942
- this.endpointSelector = new kg({
5952
+ this.endpointSelector = new Mg({
5943
5953
  local: e.local,
5944
5954
  proxyMode: r,
5945
5955
  websocket: o,
5946
5956
  webtransport: s
5947
- }), r === "auto" ? this.endpointSelector.proxyPreferred && Z.debug("Proxy preferred (from previous session)") : Z.debug(`Proxy mode: ${r}`), (o !== void 0 || s !== void 0) && Z.debug(`Transport filter: websocket=${o ?? "auto"}, webtransport=${s ?? "auto"}`), this._functionRegistry = new ch(), this._reactiveRegistry = new ph(this._functionRegistry), R() && !e.disableBrowserFunctions && (this.unregisterBrowserFunctions = Ep(this._functionRegistry), this.unregisterSoundFunctions = Kh(this._functionRegistry)), R() && (this.unregisterLoginInterceptor = this._functionRegistry.addErrorInterceptor(_h));
5957
+ }), r === "auto" ? this.endpointSelector.proxyPreferred && Z.debug("Proxy preferred (from previous session)") : Z.debug(`Proxy mode: ${r}`), (o !== void 0 || s !== void 0) && Z.debug(`Transport filter: websocket=${o ?? "auto"}, webtransport=${s ?? "auto"}`), this._functionRegistry = new dh(), this._reactiveRegistry = new gh(this._functionRegistry), R() && !e.disableBrowserFunctions && (this.unregisterBrowserFunctions = kp(this._functionRegistry), this.unregisterSoundFunctions = Yh(this._functionRegistry)), R() && (this.unregisterLoginInterceptor = this._functionRegistry.addErrorInterceptor(bh));
5948
5958
  let c = cu(), l = lu();
5949
5959
  this._audioEnabled = c ?? e.audio?.enabled ?? !0, this._videoEnabled = l ?? e.video?.enabled ?? !0;
5950
5960
  let u = e.audio ? {
@@ -5956,7 +5966,7 @@ var Mg = class {
5956
5966
  audio: u,
5957
5967
  video: d,
5958
5968
  mediaSession: e.mediaSession
5959
- }, this._mediaCaptureConfig = { audio: { performance: { preferWebCodecs: e.audio?.performance?.preferWebCodecs } } }, R() && (this.unregisterMediaCaptureFunctions = Dh(this._functionRegistry, this));
5969
+ }, this._mediaCaptureConfig = { audio: { performance: { preferWebCodecs: e.audio?.performance?.preferWebCodecs } } }, R() && (this.unregisterMediaCaptureFunctions = Ah(this._functionRegistry, this));
5960
5970
  }
5961
5971
  _lastError = void 0;
5962
5972
  get lastError() {
@@ -6009,7 +6019,7 @@ var Mg = class {
6009
6019
  async connect() {
6010
6020
  if (this._connectStarted) throw Error(`Cannot connect: already started (state: ${this.currentState})`);
6011
6021
  this._connectStarted = !0;
6012
- let e = dg();
6022
+ let e = mg();
6013
6023
  if (!e.supported) {
6014
6024
  this.setErrorState(new Il(e.missingFeatures));
6015
6025
  return;
@@ -6028,17 +6038,17 @@ var Mg = class {
6028
6038
  }
6029
6039
  async executeConnection(e) {
6030
6040
  if (this._lastError = void 0, this.abortController = new AbortController(), typeof Worker < "u" && !this.preloadedWorker) try {
6031
- this.preloadedWorker = new vg();
6041
+ this.preloadedWorker = new xg();
6032
6042
  } catch {}
6033
6043
  this.setState("connecting"), this.connectionTimer = setTimeout(() => {
6034
6044
  this.currentState === "connecting" && (Z.error("Connection timeout"), this.abortController?.abort("Connection timeout"), this.setState("offline"), this.config.onError?.(/* @__PURE__ */ Error("Connection timeout")));
6035
6045
  }, this.connectionTimeoutMs);
6036
6046
  try {
6037
6047
  let t = await e();
6038
- if (this.authResponse = t.authResponse, this._sessionId = t.authResponse.ClientContext.SessionId, this._connectUrl = t.directUrl, this._brandingRequired = t.brandingRequired ?? !1, Z.info(`Authenticated to Ikon server (ikonServerId=${t.authResponse.IkonServerId}, appSessionId=${t.authResponse.AppSessionId})`), !this.config.local && t.backendUrl && t.authToken && om(t.backendUrl, t.authToken), t.usedProxyUrl && t.directUrl && this.endpointSelector.proxyMode === "auto") {
6048
+ if (this.authResponse = t.authResponse, this._sessionId = t.authResponse.ClientContext.SessionId, this._connectUrl = t.directUrl, this._brandingRequired = t.brandingRequired ?? !1, Z.info(`Authenticated to Ikon server (ikonServerId=${t.authResponse.IkonServerId}, appSessionId=${t.authResponse.AppSessionId})`), !this.config.local && t.backendUrl && t.authToken && lm(t.backendUrl, t.authToken), t.usedProxyUrl && t.directUrl && this.endpointSelector.proxyMode === "auto") {
6039
6049
  Z.debug("Auth fell back to proxy, marking proxy preferred");
6040
6050
  let e = t.directUrl;
6041
- Um(e).then((e) => {
6051
+ Km(e).then((e) => {
6042
6052
  e && (Z.debug("Background probe: direct server reachable, clearing proxy preference for next connection"), this.endpointSelector.clearProxyPreference());
6043
6053
  }).catch(() => {});
6044
6054
  }
@@ -6049,7 +6059,7 @@ var Mg = class {
6049
6059
  }
6050
6060
  }
6051
6061
  disconnect() {
6052
- Z.info("Disconnecting from Ikon server"), this.sendDisconnectSignal(), cm(), this.clearTimers(), this.cleanupLifecycleHandlers(), this._externalConnectUrlCleanup &&= (this._externalConnectUrlCleanup(), null), this._media?.dispose(), this._mediaCapture?.dispose(), this.unregisterMediaCaptureFunctions &&= (this.unregisterMediaCaptureFunctions(), null), this.unregisterSoundFunctions &&= (this.unregisterSoundFunctions(), null), this.unregisterBrowserFunctions &&= (this.unregisterBrowserFunctions(), null), this.unregisterLoginInterceptor &&= (this.unregisterLoginInterceptor(), null), this.abortController?.abort(), this.abortController = null, this._fullReauthAttempted = !1, this._softReconnectAttempted = !1, this._lastFailureWasAuthRejected = !1, this._reauthInProgress = !1, this._disconnectedAt = null, this._serverStopped = !1, this._hasBeenConnected = !1, this.releaseKeepaliveLock(), this.disconnectProtocol(), this.authResponse = null, this._sessionId = void 0, this._globalState = null, this._globalStateReceived = !1, this._channelsConnected = !1, this._joinedHandled = !1, this._environmentTrackingSetup = !1;
6062
+ Z.info("Disconnecting from Ikon server"), this.sendDisconnectSignal(), dm(), this.clearTimers(), this.cleanupLifecycleHandlers(), this._externalConnectUrlCleanup &&= (this._externalConnectUrlCleanup(), null), this._media?.dispose(), this._mediaCapture?.dispose(), this.unregisterMediaCaptureFunctions &&= (this.unregisterMediaCaptureFunctions(), null), this.unregisterSoundFunctions &&= (this.unregisterSoundFunctions(), null), this.unregisterBrowserFunctions &&= (this.unregisterBrowserFunctions(), null), this.unregisterLoginInterceptor &&= (this.unregisterLoginInterceptor(), null), this.abortController?.abort(), this.abortController = null, this._fullReauthAttempted = !1, this._softReconnectAttempted = !1, this._lastFailureWasAuthRejected = !1, this._reauthInProgress = !1, this._disconnectedAt = null, this._serverStopped = !1, this._hasBeenConnected = !1, this.releaseKeepaliveLock(), this.disconnectProtocol(), this.authResponse = null, this._sessionId = void 0, this._globalState = null, this._globalStateReceived = !1, this._channelsConnected = !1, this._joinedHandled = !1, this._environmentTrackingSetup = !1;
6053
6063
  for (let e of this._webRtcAudioElements.values()) e.pause(), e.srcObject = null, e.remove();
6054
6064
  this._webRtcAudioElements.clear(), this._webRtcAudioStreams.clear(), this._webRtcVideoStreams.clear(), this._webRtcTrackMap.clear(), this._pendingActiveAudioTracks.clear(), this.removeWebRtcAudioUnlockHandler(), this._webRtcMediaSession.cleanup(), this._functionRegistry.detach(), this._reactiveRegistry.detach(), this.setState("offline");
6055
6065
  }
@@ -6260,10 +6270,10 @@ var Mg = class {
6260
6270
  }
6261
6271
  async authenticate() {
6262
6272
  let e = this.abortController?.signal;
6263
- if (this.config.local) return qm(this.config.local, e);
6273
+ if (this.config.local) return Xm(this.config.local, e);
6264
6274
  let t = this.endpointSelector.proxyMode, n = this.endpointSelector.proxyPreferred, r;
6265
- if (this.config.apiKey) r = await Jm(this.config.apiKey, e, t, n);
6266
- else if (this.config.sessionToken) r = await Ym(this.config.sessionToken, e, t, n);
6275
+ if (this.config.apiKey) r = await Zm(this.config.apiKey, e, t, n);
6276
+ else if (this.config.sessionToken) r = await Qm(this.config.sessionToken, e, t, n);
6267
6277
  else throw Error("No connection configuration provided (need local, apiKey, or sessionToken)");
6268
6278
  return r.usedProxyUrl && t === "auto" && this.endpointSelector.markProxyPreferred(), r;
6269
6279
  }
@@ -6298,7 +6308,7 @@ var Mg = class {
6298
6308
  return;
6299
6309
  }
6300
6310
  if (t === w.CORE_GLOBAL_STATE && uo(e).then((e) => {
6301
- this._globalState = e, this._sessionId !== void 0 && this._functionRegistry.syncFromGlobalState(e, this._sessionId), this._media?.audio.syncStreamsFromGlobalState(e), this._media?.video.syncStreamsFromGlobalState(e), this._visemeTracker?.syncStreamsFromGlobalState(e), this._globalState.DebugMode && eg(), $h() && this.protocolWorker && (this.protocolWorker.postMessage({
6311
+ this._globalState = e, this._sessionId !== void 0 && this._functionRegistry.syncFromGlobalState(e, this._sessionId), this._media?.audio.syncStreamsFromGlobalState(e), this._media?.video.syncStreamsFromGlobalState(e), this._visemeTracker?.syncStreamsFromGlobalState(e), this._globalState.DebugMode && rg(), ng() && this.protocolWorker && (this.protocolWorker.postMessage({
6302
6312
  type: "enableDevtools",
6303
6313
  enabled: !0
6304
6314
  }), this.protocolWorker.postMessage({
@@ -6436,7 +6446,7 @@ var Mg = class {
6436
6446
  let n;
6437
6447
  if (this.preloadedWorker) n = this.preloadedWorker, this.preloadedWorker = null;
6438
6448
  else try {
6439
- n = new vg();
6449
+ n = new xg();
6440
6450
  } catch (n) {
6441
6451
  Z.warn(`Failed to create protocol worker, falling back to main thread: ${n}`), await this.connectProtocolOnMainThread(e, t);
6442
6452
  return;
@@ -6492,13 +6502,13 @@ var Mg = class {
6492
6502
  r || (i = void 0, t(/* @__PURE__ */ Error("Protocol worker connect timed out")));
6493
6503
  }, td);
6494
6504
  }), i = this.computeOrderedEndpointTypes(e), a = this.getServerKeepaliveTimeoutMs(), o = this.config.timeouts?.reconnectBackoffMs ?? 2e3, s = this.config.timeouts?.maxReconnectAttempts ?? 2;
6495
- this.updateWorkerInterestMask(), $h() && (n.postMessage({
6505
+ this.updateWorkerInterestMask(), ng() && (n.postMessage({
6496
6506
  type: "enableDevtools",
6497
6507
  enabled: !0
6498
6508
  }), n.postMessage({
6499
6509
  type: "setLogLevel",
6500
6510
  level: Ce()
6501
- })), rg();
6511
+ })), og();
6502
6512
  let c = uu() ?? this.config.webRtc?.enabled ?? !0;
6503
6513
  n.postMessage({
6504
6514
  type: "connect",
@@ -6526,7 +6536,7 @@ var Mg = class {
6526
6536
  }
6527
6537
  ensureVisemeTracker() {
6528
6538
  if (!this._visemeTracker) try {
6529
- this._visemeTracker = new Xh(this), this._visemeTracker.enable();
6539
+ this._visemeTracker = new $h(this), this._visemeTracker.enable();
6530
6540
  } catch (e) {
6531
6541
  Z.warn(`Viseme tracker setup failed: ${e}`), this._visemeTracker = null;
6532
6542
  }
@@ -6604,9 +6614,9 @@ var Mg = class {
6604
6614
  this._webRtcRetryTimer &&= (clearTimeout(this._webRtcRetryTimer), null);
6605
6615
  }
6606
6616
  scheduleWebRtcRetry() {
6607
- if (this._webRtcRetryTimer || this._webRtcRetryCount >= Ag.length) return;
6608
- let e = Ag[this._webRtcRetryCount++];
6609
- Z.info(`Retrying WebRTC in ${Math.round(e / 1e3)}s (attempt ${this._webRtcRetryCount}/${Ag.length})`), this._webRtcRetryTimer = setTimeout(() => {
6617
+ if (this._webRtcRetryTimer || this._webRtcRetryCount >= Ng.length) return;
6618
+ let e = Ng[this._webRtcRetryCount++];
6619
+ Z.info(`Retrying WebRTC in ${Math.round(e / 1e3)}s (attempt ${this._webRtcRetryCount}/${Ng.length})`), this._webRtcRetryTimer = setTimeout(() => {
6610
6620
  this._webRtcRetryTimer = null, !(this.currentState !== "connected" || this._webRtcSignaling || !this.isWebRtcEnabled) && this.setupWebRtcSignaling();
6611
6621
  }, e);
6612
6622
  }
@@ -6798,7 +6808,7 @@ var Mg = class {
6798
6808
  let n = this.groupEntrypointsByType(this._connectedEntrypoints), r = this.abortController?.signal;
6799
6809
  for (let e of t) {
6800
6810
  let t = n.get(e)?.[0]?.Uri;
6801
- if (!(t === void 0 || r?.aborted) && await mg(e, t, { signal: r })) {
6811
+ if (!(t === void 0 || r?.aborted) && await _g(e, t, { signal: r })) {
6802
6812
  this.endpointSelector.recordFasterTypeReachable(e);
6803
6813
  return;
6804
6814
  }
@@ -6928,8 +6938,8 @@ var Mg = class {
6928
6938
  let t = e.target?.closest?.("a[href]");
6929
6939
  if (!t || t.target && t.target !== "_self") return;
6930
6940
  let n = t.getAttribute("href") ?? "";
6931
- if (cg(n)) {
6932
- e.preventDefault(), lg(n);
6941
+ if (dg(n)) {
6942
+ e.preventDefault(), fg(n);
6933
6943
  return;
6934
6944
  }
6935
6945
  let r = this.resolveInPlaceDestination(t, n);
@@ -6948,7 +6958,7 @@ var Mg = class {
6948
6958
  } catch {
6949
6959
  return null;
6950
6960
  }
6951
- return n.origin !== window.location.origin || n.protocol !== "http:" && n.protocol !== "https:" || n.hash && n.pathname === window.location.pathname && n.search === window.location.search || cf(n.pathname) ? null : n;
6961
+ return n.origin !== window.location.origin || n.protocol !== "http:" && n.protocol !== "https:" || n.hash && n.pathname === window.location.pathname && n.search === window.location.search || df(n.pathname) ? null : n;
6952
6962
  }
6953
6963
  sendDisconnectSignal() {
6954
6964
  if (this._sessionId !== void 0 && this.currentState === "connected") try {
@@ -7024,7 +7034,7 @@ var Mg = class {
7024
7034
  });
7025
7035
  }, 150);
7026
7036
  }), window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
7027
- this.sendUpdateClientContext({ theme: mf() });
7037
+ this.sendUpdateClientContext({ theme: _f() });
7028
7038
  });
7029
7039
  }
7030
7040
  setupExternalConnectUrlListener() {
@@ -7055,7 +7065,7 @@ var Mg = class {
7055
7065
  this._externalConnectUrlCleanup &&= (this._externalConnectUrlCleanup(), null);
7056
7066
  }
7057
7067
  }
7058
- }, Ng = class {
7068
+ }, Ig = class {
7059
7069
  client;
7060
7070
  constructor(e) {
7061
7071
  this.client = e;
@@ -7073,45 +7083,45 @@ var Mg = class {
7073
7083
  }, { close: () => n.close() }) : { close: () => {} };
7074
7084
  }
7075
7085
  };
7076
- function Pg(e) {
7077
- return new Ng(e);
7086
+ function Lg(e) {
7087
+ return new Ig(e);
7078
7088
  }
7079
7089
  //#endregion
7080
7090
  //#region src/client/connection-state.ts
7081
- function Fg(e) {
7091
+ function Rg(e) {
7082
7092
  return e === "waitingForExternalConnectUrl" || e === "connecting" || e === "connectingSlow" || e === "reconnecting";
7083
7093
  }
7084
- function Ig(e) {
7094
+ function zg(e) {
7085
7095
  return e === "connected";
7086
7096
  }
7087
- function Lg(e) {
7097
+ function Bg(e) {
7088
7098
  return e === "offline" || e === "offlineError";
7089
7099
  }
7090
- function Rg(e) {
7100
+ function Vg(e) {
7091
7101
  return e === "offlineError";
7092
7102
  }
7093
7103
  //#endregion
7094
7104
  //#region src/utils/opcode-names.ts
7095
- var zg = /* @__PURE__ */ new Map();
7096
- for (let [e, t] of Object.entries(w)) typeof t == "number" && zg.set(t, e);
7097
- function Bg(e) {
7098
- return zg.get(e) ?? `UNKNOWN_${e}`;
7105
+ var Hg = /* @__PURE__ */ new Map();
7106
+ for (let [e, t] of Object.entries(w)) typeof t == "number" && Hg.set(t, e);
7107
+ function Ug(e) {
7108
+ return Hg.get(e) ?? `UNKNOWN_${e}`;
7099
7109
  }
7100
7110
  //#endregion
7101
7111
  //#region src/login/reprovision.ts
7102
- var Vg = "ikon-login-app-route";
7103
- function Hg(e) {
7112
+ var Wg = "ikon-login-app-route";
7113
+ function Gg(e) {
7104
7114
  if (typeof window > "u") return;
7105
7115
  try {
7106
- sessionStorage.setItem(Vg, window.location.pathname);
7116
+ sessionStorage.setItem(Wg, window.location.pathname);
7107
7117
  } catch {}
7108
7118
  let t = new URL(window.location.href);
7109
7119
  t.searchParams.set(Ul, e), window.location.href = t.toString();
7110
7120
  }
7111
- function Ug() {
7121
+ function Kg() {
7112
7122
  let e = null;
7113
7123
  try {
7114
- e = sessionStorage.getItem(Vg), sessionStorage.removeItem(Vg);
7124
+ e = sessionStorage.getItem(Wg), sessionStorage.removeItem(Wg);
7115
7125
  } catch {}
7116
7126
  return {
7117
7127
  appRoute: e,
@@ -7120,7 +7130,7 @@ function Ug() {
7120
7130
  }
7121
7131
  //#endregion
7122
7132
  //#region src/media/ring-buffer.ts
7123
- var Wg = class {
7133
+ var qg = class {
7124
7134
  static getStorageForCapacity(e, t) {
7125
7135
  let n = Int32Array.BYTES_PER_ELEMENT * 2, r = t.BYTES_PER_ELEMENT * e;
7126
7136
  return new SharedArrayBuffer(n + r);
@@ -7171,7 +7181,7 @@ var Wg = class {
7171
7181
  };
7172
7182
  //#endregion
7173
7183
  //#region src/worker/audio-capture-worker.ts?worker
7174
- function Gg(e) {
7184
+ function Jg(e) {
7175
7185
  return new Worker("" + new URL("assets/audio-capture-worker-CJ5S-nQt.js", import.meta.url).href, {
7176
7186
  type: "module",
7177
7187
  name: e?.name
@@ -7179,11 +7189,11 @@ function Gg(e) {
7179
7189
  }
7180
7190
  //#endregion
7181
7191
  //#region src/media/ikon-audio-capture.ts
7182
- var Q = C("IkonAudioCapture"), Kg = 3, qg = 200, Jg = 2e3, Yg = 5e3, Xg = 3e3;
7183
- function Zg(e) {
7192
+ var Q = C("IkonAudioCapture"), Yg = 3, Xg = 200, Zg = 2e3, Qg = 5e3, $g = 3e3;
7193
+ function e_(e) {
7184
7194
  return new Promise((t) => setTimeout(t, e));
7185
7195
  }
7186
- function Qg(e) {
7196
+ function t_(e) {
7187
7197
  switch (e.name) {
7188
7198
  case "NotReadableError": return {
7189
7199
  action: "retry",
@@ -7219,14 +7229,14 @@ function Qg(e) {
7219
7229
  };
7220
7230
  }
7221
7231
  }
7222
- function $g() {
7232
+ function n_() {
7223
7233
  let e = globalThis.crypto;
7224
7234
  return e?.randomUUID ? e.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
7225
7235
  }
7226
- function e_() {
7236
+ function r_() {
7227
7237
  return "\nclass RingBuffer {\n static getStorageForCapacity(capacity, type) {\n const indexBytes = Int32Array.BYTES_PER_ELEMENT * 2;\n const dataBytes = type.BYTES_PER_ELEMENT * capacity;\n return new SharedArrayBuffer(indexBytes + dataBytes);\n }\n\n constructor(sharedArrayBuffer, type) {\n this.buf = sharedArrayBuffer;\n this.readWrite = new Int32Array(sharedArrayBuffer, 0, 2);\n const dataOffset = Int32Array.BYTES_PER_ELEMENT * 2;\n const dataLength = (sharedArrayBuffer.byteLength - dataOffset) / Float32Array.BYTES_PER_ELEMENT;\n this.storage = new type(sharedArrayBuffer, dataOffset, dataLength);\n }\n\n get capacity() {\n return this.storage.length;\n }\n\n available_read() {\n const read = Atomics.load(this.readWrite, 0);\n const write = Atomics.load(this.readWrite, 1);\n if (write >= read) return write - read;\n return this.capacity - (read - write);\n }\n\n available_write() {\n return this.capacity - this.available_read() - 1;\n }\n\n push(input) {\n const writable = Math.min(this.available_write(), input.length);\n if (writable <= 0) return 0;\n\n const read = Atomics.load(this.readWrite, 0);\n let write = Atomics.load(this.readWrite, 1);\n\n const firstPart = Math.min(writable, this.capacity - write);\n this.storage.set(input.subarray(0, firstPart), write);\n const remaining = writable - firstPart;\n if (remaining > 0) {\n this.storage.set(input.subarray(firstPart, firstPart + remaining), 0);\n }\n\n write = (write + writable) % this.capacity;\n Atomics.store(this.readWrite, 1, write);\n Atomics.notify(this.readWrite, 1);\n if (this.available_read() > this.capacity - 2) {\n Atomics.store(this.readWrite, 0, read);\n }\n\n return writable;\n }\n}\n\nconst RENDER_QUANTUM_SIZE = 128;\n\nclass IkonAudioCaptureProcessor extends AudioWorkletProcessor {\n constructor(options) {\n super();\n const cfg = options?.processorOptions || {};\n this.channels = cfg.channels || 1;\n this.transport = cfg.transport || 'pcm';\n this.ring = null;\n this.temp = new Float32Array(RENDER_QUANTUM_SIZE * this.channels);\n\n if (this.transport === 'sab' && cfg.sharedArrayBuffer) {\n this.ring = new RingBuffer(cfg.sharedArrayBuffer, Float32Array);\n }\n\n // Pre-allocated rotating transfer buffers for PCM mode\n // We use two buffers and alternate between them since postMessage transfers ownership\n this.transferBuffers = [\n new Float32Array(RENDER_QUANTUM_SIZE),\n new Float32Array(RENDER_QUANTUM_SIZE)\n ];\n this.transferBufferIndex = 0;\n\n this.port.postMessage({ type: 'ready' });\n }\n\n process(inputs) {\n const input = inputs[0];\n if (!input || input.length === 0) {\n return true;\n }\n\n const frames = input[0]?.length || 0;\n if (frames === 0) {\n return true;\n }\n\n const channelCount = input.length;\n for (let i = 0; i < frames; i++) {\n let sum = 0;\n for (let ch = 0; ch < channelCount; ch++) {\n const channel = input[ch];\n sum += channel ? (channel[i] || 0) : 0;\n }\n this.temp[i] = sum / channelCount;\n }\n\n const out = this.temp.subarray(0, frames);\n if (this.transport === 'sab' && this.ring) {\n this.ring.push(out);\n return true;\n }\n\n // Use rotating pre-allocated transfer buffer\n let buffer = this.transferBuffers[this.transferBufferIndex];\n // If buffer was transferred (detached), recreate it\n if (buffer.byteLength === 0) {\n buffer = new Float32Array(RENDER_QUANTUM_SIZE);\n this.transferBuffers[this.transferBufferIndex] = buffer;\n }\n buffer.set(out);\n const toSend = buffer.subarray(0, frames);\n this.port.postMessage({ type: 'pcm', pcm: toSend }, [buffer.buffer]);\n // Flip to next buffer for next call\n this.transferBufferIndex = (this.transferBufferIndex + 1) % 2;\n return true;\n }\n}\n\nregisterProcessor('ikon-audio-capture', IkonAudioCaptureProcessor);\n";
7228
7238
  }
7229
- var t_ = class e {
7239
+ var i_ = class e {
7230
7240
  client;
7231
7241
  static RESUME_TIMEOUT_MS = 3e3;
7232
7242
  worker = null;
@@ -7287,7 +7297,7 @@ var t_ = class e {
7287
7297
  notifyError(e, t, n, r) {
7288
7298
  if (e.stopped) return;
7289
7299
  let i = Date.now(), a = t.name;
7290
- if (e.lastErrorReason === n && e.lastErrorName === a && i - e.lastErrorTime < Yg) return;
7300
+ if (e.lastErrorReason === n && e.lastErrorName === a && i - e.lastErrorTime < Qg) return;
7291
7301
  e.lastErrorTime = i, e.lastErrorReason = n, e.lastErrorName = a;
7292
7302
  let o = this.config.autoRestartPolicy;
7293
7303
  if (o?.enabled && r) {
@@ -7345,7 +7355,7 @@ var t_ = class e {
7345
7355
  if (e.ctx.state === "running") return !0;
7346
7356
  if (e.ctx.state !== "suspended") return !1;
7347
7357
  let r = Date.now();
7348
- if (!n && r - e.lastResumeAttemptTime < Xg) return Q.debug(`Resume attempt from ${t} skipped (cooldown)`), !1;
7358
+ if (!n && r - e.lastResumeAttemptTime < $g) return Q.debug(`Resume attempt from ${t} skipped (cooldown)`), !1;
7349
7359
  e.lastResumeAttemptTime = r, this.emitDiagnostic({
7350
7360
  event: "resume-attempt",
7351
7361
  captureId: e.captureId,
@@ -7381,7 +7391,7 @@ var t_ = class e {
7381
7391
  attemptResume(e, t, n = !1) {
7382
7392
  if (e.stopped || e.ctx.state !== "suspended") return;
7383
7393
  let r = Date.now();
7384
- if (!n && r - e.lastResumeAttemptTime < Xg) {
7394
+ if (!n && r - e.lastResumeAttemptTime < $g) {
7385
7395
  Q.debug(`Resume attempt from ${t} skipped (cooldown)`);
7386
7396
  return;
7387
7397
  }
@@ -7480,7 +7490,7 @@ var t_ = class e {
7480
7490
  }
7481
7491
  ensureWorker() {
7482
7492
  if (this.worker) return this.worker;
7483
- let e = new Gg();
7493
+ let e = new Jg();
7484
7494
  return this.worker = e, e.addEventListener("message", (e) => {
7485
7495
  let t = e.data;
7486
7496
  if (t?.type === "error") {
@@ -7578,25 +7588,25 @@ var t_ = class e {
7578
7588
  reason: "unknown",
7579
7589
  canRetry: !1
7580
7590
  };
7581
- for (let r = 0; r < Kg; r++) try {
7591
+ for (let r = 0; r < Yg; r++) try {
7582
7592
  return {
7583
7593
  stream: await navigator.mediaDevices.getUserMedia({ audio: e }),
7584
7594
  error: t,
7585
7595
  errorInfo: n
7586
7596
  };
7587
7597
  } catch (e) {
7588
- if (t = e instanceof Error ? e : Error(String(e)), n = Qg(t), Q.debug(`getUserMedia attempt ${r + 1}/${Kg} failed: ${t.name} (action: ${n.action})`), this.emitDiagnostic({
7598
+ if (t = e instanceof Error ? e : Error(String(e)), n = t_(t), Q.debug(`getUserMedia attempt ${r + 1}/${Yg} failed: ${t.name} (action: ${n.action})`), this.emitDiagnostic({
7589
7599
  event: "retry",
7590
7600
  details: {
7591
7601
  attempt: r + 1,
7592
- maxAttempts: Kg,
7602
+ maxAttempts: Yg,
7593
7603
  errorName: t.name,
7594
7604
  action: n.action
7595
7605
  }
7596
7606
  }), n.action !== "retry") break;
7597
7607
  if (r < 2) {
7598
- let e = qg * (r + 1);
7599
- Q.debug(`Retrying getUserMedia in ${e}ms`), await Zg(e);
7608
+ let e = Xg * (r + 1);
7609
+ Q.debug(`Retrying getUserMedia in ${e}ms`), await e_(e);
7600
7610
  }
7601
7611
  }
7602
7612
  return {
@@ -7607,7 +7617,7 @@ var t_ = class e {
7607
7617
  }
7608
7618
  async ensureWorklet(e) {
7609
7619
  if (!Te(e)) throw Error("AudioWorklet is not supported in this browser");
7610
- if (this.workletModuleUrl ||= URL.createObjectURL(new Blob([e_()], { type: "text/javascript" })), this.workletReady && this.workletContext === e) try {
7620
+ if (this.workletModuleUrl ||= URL.createObjectURL(new Blob([r_()], { type: "text/javascript" })), this.workletReady && this.workletContext === e) try {
7611
7621
  await this.workletReady;
7612
7622
  return;
7613
7623
  } catch {
@@ -7634,7 +7644,7 @@ var t_ = class e {
7634
7644
  if (!t) throw Error("Cannot start audio capture before client is connected");
7635
7645
  if (this.client.isWebRtcCaptureAvailable) return this.startMicWebRtc(e);
7636
7646
  this.client.isWebRtcEnabled && Q.warn("WebRTC unavailable, capturing audio via protocol channel");
7637
- let n = $g(), r = {
7647
+ let n = n_(), r = {
7638
7648
  captureId: n,
7639
7649
  aborted: !1,
7640
7650
  stream: null,
@@ -7672,7 +7682,7 @@ var t_ = class e {
7672
7682
  let f = Se() ? "sab" : "pcm", p;
7673
7683
  if (f === "sab") {
7674
7684
  let e = Math.floor(a.sampleRate * 10);
7675
- p = Wg.getStorageForCapacity(e, Float32Array);
7685
+ p = qg.getStorageForCapacity(e, Float32Array);
7676
7686
  }
7677
7687
  let m = this.ensureWorker(), h = e.onStopped;
7678
7688
  m.postMessage({
@@ -7820,7 +7830,7 @@ var t_ = class e {
7820
7830
  };
7821
7831
  this.setupAudioContextStateListener(a, _), this.setupVisibilityChangeListener(_), this.setupBFCacheHandlers(_), _.healthCheckTimer = setInterval(() => {
7822
7832
  this.performHealthCheck(_);
7823
- }, Jg);
7833
+ }, Zg);
7824
7834
  let te = () => {
7825
7835
  _.stopped || (Q.warn(`Microphone track ended unexpectedly, captureId=${n.substring(0, 8)}`), this.handleRecoverableError(_, /* @__PURE__ */ Error("Microphone track ended unexpectedly"), "track-ended"));
7826
7836
  };
@@ -7969,8 +7979,8 @@ var t_ = class e {
7969
7979
  let t = this.captures.get(e);
7970
7980
  return !t || t.stopped ? !1 : this.attemptResumeAsync(t, "userGesture", !0);
7971
7981
  }
7972
- }, n_ = 3e3;
7973
- function r_(e, t, n, r) {
7982
+ }, a_ = 3e3;
7983
+ function o_(e, t, n, r) {
7974
7984
  if (!n && !r) return {
7975
7985
  width: e,
7976
7986
  height: t
@@ -7981,7 +7991,7 @@ function r_(e, t, n, r) {
7981
7991
  height: Math.max(1, Math.floor(t * o))
7982
7992
  };
7983
7993
  }
7984
- async function i_(e, t) {
7994
+ async function s_(e, t) {
7985
7995
  let n = t.mime ?? "image/jpeg", r = t.quality ?? .92;
7986
7996
  if (typeof OffscreenCanvas < "u" && e instanceof OffscreenCanvas) try {
7987
7997
  return await e.convertToBlob({
@@ -7996,7 +8006,7 @@ async function i_(e, t) {
7996
8006
  }, n, r);
7997
8007
  });
7998
8008
  }
7999
- var a_ = class {
8009
+ var c_ = class {
8000
8010
  async captureFromStream(e, t = {}) {
8001
8011
  let n = e.getVideoTracks()[0];
8002
8012
  if (!n) throw Error("No video track available in the provided stream");
@@ -8007,7 +8017,7 @@ var a_ = class {
8007
8017
  } catch {}
8008
8018
  try {
8009
8019
  await new Promise((e, t) => {
8010
- let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), n_);
8020
+ let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), a_);
8011
8021
  r.addEventListener("loadedmetadata", () => {
8012
8022
  clearTimeout(n), e();
8013
8023
  }, { once: !0 }), r.addEventListener("error", () => {
@@ -8017,7 +8027,7 @@ var a_ = class {
8017
8027
  try {
8018
8028
  await r.play();
8019
8029
  } catch {}
8020
- let { width: e, height: i } = r_(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), t.width, t.height), a;
8030
+ let { width: e, height: i } = o_(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), t.width, t.height), a;
8021
8031
  if (typeof OffscreenCanvas < "u") a = new OffscreenCanvas(e, i);
8022
8032
  else {
8023
8033
  let t = document.createElement("canvas");
@@ -8026,7 +8036,7 @@ var a_ = class {
8026
8036
  let o = a.getContext("2d", { alpha: !1 });
8027
8037
  if (!o) throw Error("2D canvas context unavailable");
8028
8038
  o.drawImage(r, 0, 0, e, i);
8029
- let s = await i_(a, t), c = await s.arrayBuffer();
8039
+ let s = await s_(a, t), c = await s.arrayBuffer();
8030
8040
  return {
8031
8041
  mime: s.type || t.mime || "image/jpeg",
8032
8042
  width: e,
@@ -8067,7 +8077,7 @@ var a_ = class {
8067
8077
  } catch {}
8068
8078
  try {
8069
8079
  await new Promise((e, t) => {
8070
- let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), n_);
8080
+ let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), a_);
8071
8081
  r.addEventListener("loadedmetadata", () => {
8072
8082
  clearTimeout(n), e();
8073
8083
  }, { once: !0 }), r.addEventListener("error", () => {
@@ -8077,7 +8087,7 @@ var a_ = class {
8077
8087
  try {
8078
8088
  await r.play();
8079
8089
  } catch {}
8080
- let { width: t, height: i } = r_(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), e.width, e.height), a;
8090
+ let { width: t, height: i } = o_(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), e.width, e.height), a;
8081
8091
  if (typeof OffscreenCanvas < "u") a = new OffscreenCanvas(t, i);
8082
8092
  else {
8083
8093
  let e = document.createElement("canvas");
@@ -8086,7 +8096,7 @@ var a_ = class {
8086
8096
  let o = a.getContext("2d", { alpha: !1 });
8087
8097
  if (!o) throw Error("2D canvas context unavailable");
8088
8098
  o.drawImage(r, 0, 0, t, i);
8089
- let s = await i_(a, e), c = await s.arrayBuffer();
8099
+ let s = await s_(a, e), c = await s.arrayBuffer();
8090
8100
  return {
8091
8101
  mime: s.type || e.mime || "image/jpeg",
8092
8102
  width: t,
@@ -8110,11 +8120,11 @@ var a_ = class {
8110
8120
  }
8111
8121
  async captureFromNativeCamera(e = {}) {
8112
8122
  if (typeof document > "u") throw Error("Native camera capture requires a DOM environment");
8113
- let t = await o_(e.facing);
8114
- return t ? await s_(t, e) : null;
8123
+ let t = await l_(e.facing);
8124
+ return t ? await u_(t, e) : null;
8115
8125
  }
8116
8126
  };
8117
- function o_(e) {
8127
+ function l_(e) {
8118
8128
  return new Promise((t) => {
8119
8129
  let n = document.createElement("input");
8120
8130
  n.type = "file", n.accept = "image/*", n.setAttribute("capture", e ?? "environment"), n.style.position = "fixed", n.style.left = "-99999px", n.style.top = "0";
@@ -8140,7 +8150,7 @@ function o_(e) {
8140
8150
  n.click();
8141
8151
  });
8142
8152
  }
8143
- async function s_(e, t) {
8153
+ async function u_(e, t) {
8144
8154
  let n = URL.createObjectURL(e), r;
8145
8155
  try {
8146
8156
  r = await new Promise((e, t) => {
@@ -8150,7 +8160,7 @@ async function s_(e, t) {
8150
8160
  } finally {
8151
8161
  URL.revokeObjectURL(n);
8152
8162
  }
8153
- let i = r.naturalWidth || r.width, a = r.naturalHeight || r.height, { width: o, height: s } = r_(i, a, t.width, t.height), c = t.mime ?? (e.type === "image/png" ? "image/png" : "image/jpeg"), l = t.quality ?? .92;
8163
+ let i = r.naturalWidth || r.width, a = r.naturalHeight || r.height, { width: o, height: s } = o_(i, a, t.width, t.height), c = t.mime ?? (e.type === "image/png" ? "image/png" : "image/jpeg"), l = t.quality ?? .92;
8154
8164
  if (o === i && s === a && e.type === c) {
8155
8165
  let t = await e.arrayBuffer();
8156
8166
  return {
@@ -8177,7 +8187,7 @@ async function s_(e, t) {
8177
8187
  }
8178
8188
  //#endregion
8179
8189
  //#region src/worker/video-capture-worker.ts?worker
8180
- function c_(e) {
8190
+ function d_(e) {
8181
8191
  return new Worker("" + new URL("assets/video-capture-worker-D5jsT6I4.js", import.meta.url).href, {
8182
8192
  type: "module",
8183
8193
  name: e?.name
@@ -8186,16 +8196,16 @@ function c_(e) {
8186
8196
  //#endregion
8187
8197
  //#region src/media/ikon-video-capture.ts
8188
8198
  var $ = C("IkonVideoCapture");
8189
- function l_() {
8199
+ function f_() {
8190
8200
  let e = globalThis.crypto;
8191
8201
  return e?.randomUUID ? e.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
8192
8202
  }
8193
- function u_() {
8203
+ function p_() {
8194
8204
  let e = globalThis.MediaStreamTrackProcessor;
8195
8205
  if (!e) throw Error("MediaStreamTrackProcessor is not available in this browser");
8196
8206
  return e;
8197
8207
  }
8198
- var d_ = class {
8208
+ var m_ = class {
8199
8209
  client;
8200
8210
  worker = null;
8201
8211
  protocolPort = null;
@@ -8211,7 +8221,7 @@ var d_ = class {
8211
8221
  }
8212
8222
  ensureWorker() {
8213
8223
  if (this.worker) return this.worker;
8214
- let e = new c_();
8224
+ let e = new d_();
8215
8225
  return this.worker = e, e.addEventListener("message", (e) => {
8216
8226
  let t = e.data;
8217
8227
  if (t?.type === "error") {
@@ -8321,10 +8331,10 @@ var d_ = class {
8321
8331
  if (this.client.isWebRtcCaptureAvailable && e.sourceType === "camera") return this.startCameraWebRtc(e);
8322
8332
  if (this.client.isWebRtcCaptureAvailable && e.sourceType === "screen") return this.startScreenWebRtc(e);
8323
8333
  this.client.isWebRtcEnabled && $.warn("WebRTC unavailable, capturing video via protocol channel"), this.ensurePorts();
8324
- let n = l_(), r = await this.getMediaStream(e), i = r.getVideoTracks()[0];
8334
+ let n = f_(), r = await this.getMediaStream(e), i = r.getVideoTracks()[0];
8325
8335
  if (!i) throw r.getTracks().forEach((e) => e.stop()), Error("No video track available");
8326
8336
  e.sourceType === "screen" && await new Promise((e) => setTimeout(e, 200));
8327
- let a = i.getSettings(), o = e.sourceType === "screen" ? a.width ?? 1280 : e.options?.width ?? a.width ?? 1280, s = e.sourceType === "screen" ? a.height ?? 720 : e.options?.height ?? a.height ?? 720, c = new (u_())({ track: i }).readable, l = this.allocateTrackId(), u = this.ensureWorker(), d = e.sourceType, f = e.onStopped;
8337
+ let a = i.getSettings(), o = e.sourceType === "screen" ? a.width ?? 1280 : e.options?.width ?? a.width ?? 1280, s = e.sourceType === "screen" ? a.height ?? 720 : e.options?.height ?? a.height ?? 720, c = new (p_())({ track: i }).readable, l = this.allocateTrackId(), u = this.ensureWorker(), d = e.sourceType, f = e.onStopped;
8328
8338
  u.postMessage({
8329
8339
  type: "start",
8330
8340
  captureId: n,
@@ -8447,16 +8457,16 @@ var d_ = class {
8447
8457
  }
8448
8458
  this.protocolPort?.close(), this.protocolPort = null, this.sendPort?.close(), this.sendPort = null;
8449
8459
  }
8450
- }, f_ = /* @__PURE__ */ d({ IkonMediaCapture: () => p_ }), p_ = class {
8460
+ }, h_ = /* @__PURE__ */ d({ IkonMediaCapture: () => g_ }), g_ = class {
8451
8461
  audio;
8452
8462
  video;
8453
8463
  image;
8454
8464
  constructor(e, t) {
8455
- this.audio = new t_(e, t?.audio), this.video = new d_(e), this.image = new a_();
8465
+ this.audio = new i_(e, t?.audio), this.video = new m_(e), this.image = new c_();
8456
8466
  }
8457
8467
  dispose() {
8458
8468
  this.audio.dispose(), this.video.dispose();
8459
8469
  }
8460
8470
  };
8461
8471
  //#endregion
8462
- export { Ml as AccessDeniedError, Ng as AppMessaging, O as AppStartupFailedError, D as AuthRejectedError, T as AuthenticationError, Il as BrowserNotSupportedError, Du as Channel, ku as ChannelManager, ne as ClientType, Dl as ConnectionError, m as ContextType, kg as EndpointSelector, b as EntrypointType, rh as FunctionCallError, ch as FunctionRegistry, xd as IKON_AUTH_BASE_URL, bd as IKON_AUTH_URL_DEV, yd as IKON_AUTH_URL_PROD, vd as IKON_BACKEND_URL_DEV, _d as IKON_BACKEND_URL_PROD, tg as IKON_INSPECT_MODE_CHANGED_EVENT, Wl as IKON_PARAM_AUDIO, Xl as IKON_PARAM_AUTH, Vl as IKON_PARAM_DEBUG, Yl as IKON_PARAM_DEBUG_OVERLAY, Jl as IKON_PARAM_INSPECT, Hl as IKON_PARAM_LANG, Rl as IKON_PARAM_PROXY, Zl as IKON_PARAM_RETRY, Ul as IKON_PARAM_SERVER_URL, Gl as IKON_PARAM_VIDEO, Kl as IKON_PARAM_WEBRTC, zl as IKON_PARAM_WEBSOCKET, Bl as IKON_PARAM_WEBTRANSPORT, t_ as IkonAudioCapture, ie as IkonAudioPlayback, Mg as IkonClient, a_ as IkonImageCapture, de as IkonMedia, p_ as IkonMediaCapture, d_ as IkonVideoCapture, le as IkonVideoPlayback, Ol as KeepaliveTimeoutError, S as LogLevel, kl as MaxRetriesExceededError, w as Opcode, Al as ProvisioningTimeoutError, Pl as ServerFullError, Fl as ServerUnavailableError, Nl as SessionNotFoundError, jl as SpaceNotFoundError, E as TransportError, p as UserType, Xh as VisemeTracker, Nu as WEBRTC_AUDIO_BITRATE, Mu as WEBRTC_AUDIO_CHANNELS, Au as WEBRTC_AUDIO_CODEC, Pu as WEBRTC_AUDIO_JITTER_BUFFER_TARGET_MS, ju as WEBRTC_AUDIO_SAMPLE_RATE, zu as WEBRTC_BUNDLE_POLICY, Gu as WEBRTC_DATA_CHANNEL_LABEL, qu as WEBRTC_DATA_CHANNEL_MAX_RETRANSMITS, Ku as WEBRTC_DATA_CHANNEL_ORDERED, Uu as WEBRTC_MAX_AUDIO_TRACKS, Wu as WEBRTC_MAX_VIDEO_TRACKS, Bu as WEBRTC_RTCP_MUX_POLICY, Fu as WEBRTC_VIDEO_CODEC, Iu as WEBRTC_VIDEO_MAX_BITRATE, Lu as WEBRTC_VIDEO_MAX_FRAMERATE, Ju as WebRTCConnection, Yu as WebRTCSignaling, gd as abortSignalAny, I as abortSignalTimeout, Pg as appMessaging, v as asProtocolMessage, dg as checkBrowserSupport, bm as clearDeviceId, Rp as clearLogBuffer, ud as clearLoginPrompt, Ug as consumeLoginHandoff, pd as consumeLoginPendingCall, C as createLogger, Jd as createPkceChallenge, Pd as deriveAuthUrl, Md as deriveBackendType, jd as deriveBackendUrl, Fd as deriveCrossOriginAuthUrl, ag as enableInspectMode, xm as extractUserIdFromToken, Lp as flushLogs, cu as getAudioParam, mu as getAuthSameOriginParam, Fp as getBufferedLogs, mm as getConnectTraceId, pu as getDebugOverlayParam, au as getDebugParam, fu as getInspectParam, ou as getLangParam, zp as getLogBufferSize, Ce as getLogLevel, xe as getLogSink, cd as getLoginPromptState, Bg as getOpcodeName, ym as getOrCreateDeviceId, nu as getProxyParam, j as getRetryParam, Od as getSameOriginAuthUrl, su as getServerUrlParam, lu as getVideoParam, uu as getWebRtcParam, ru as getWebSocketParam, iu as getWebTransportParam, Qh as initializeDebugMode, rg as initializeInspectMode, Np as initializeLogSink, Te as isAudioWorkletSupported, R as isBrowserEnvironment, Vd as isCloudEnvironment, Ig as isConnected, Fg as isConnecting, $h as isDebugModeEnabled, $d as isEmbedded, Rg as isError, ig as isInspectModeEnabled, vh as isMobileBrowserLikely, Lg as isOffline, qd as isPkceSupported, Se as isSharedArrayBufferSupported, wu as isWebTransportSupported, _h as loginErrorInterceptor, Bd as parseUrlParams, _m as randomUuid, c as readOpcode, u as readOpcodeGroup, i as readProtocolMessageHeaders, Ep as registerBrowserFunctions, gm as reportConnectTimeline, Hg as reprovisionAfterLogin, ye as setLogLevel, ve as setLogSink, ld as setLoginPromptRequired, tu as setSdkUrlParam, Pp as setSendLogsCallback, rf as startEmbeddedOAuthSignIn, om as startLogSender, cm as stopLogSender, dd as subscribeLoginPrompt, ge as subscribeToLogEvents, Ip as takeBufferedLogs, Yd as takePkceVerifier, nh as withResultData };
8472
+ export { Ml as AccessDeniedError, Ig as AppMessaging, O as AppStartupFailedError, D as AuthRejectedError, T as AuthenticationError, Il as BrowserNotSupportedError, Du as Channel, ku as ChannelManager, ne as ClientType, Dl as ConnectionError, m as ContextType, Mg as EndpointSelector, b as EntrypointType, oh as FunctionCallError, dh as FunctionRegistry, xd as IKON_AUTH_BASE_URL, bd as IKON_AUTH_URL_DEV, yd as IKON_AUTH_URL_PROD, vd as IKON_BACKEND_URL_DEV, _d as IKON_BACKEND_URL_PROD, ig as IKON_INSPECT_MODE_CHANGED_EVENT, Wl as IKON_PARAM_AUDIO, Xl as IKON_PARAM_AUTH, Vl as IKON_PARAM_DEBUG, Yl as IKON_PARAM_DEBUG_OVERLAY, Jl as IKON_PARAM_INSPECT, Hl as IKON_PARAM_LANG, Rl as IKON_PARAM_PROXY, Zl as IKON_PARAM_RETRY, Ul as IKON_PARAM_SERVER_URL, Gl as IKON_PARAM_VIDEO, Kl as IKON_PARAM_WEBRTC, zl as IKON_PARAM_WEBSOCKET, Bl as IKON_PARAM_WEBTRANSPORT, i_ as IkonAudioCapture, ie as IkonAudioPlayback, Fg as IkonClient, c_ as IkonImageCapture, de as IkonMedia, g_ as IkonMediaCapture, m_ as IkonVideoCapture, le as IkonVideoPlayback, Ol as KeepaliveTimeoutError, S as LogLevel, kl as MaxRetriesExceededError, w as Opcode, ef as PKCE_URL_PARAM, Al as ProvisioningTimeoutError, Pl as ServerFullError, Fl as ServerUnavailableError, Nl as SessionNotFoundError, jl as SpaceNotFoundError, E as TransportError, p as UserType, $h as VisemeTracker, Nu as WEBRTC_AUDIO_BITRATE, Mu as WEBRTC_AUDIO_CHANNELS, Au as WEBRTC_AUDIO_CODEC, Pu as WEBRTC_AUDIO_JITTER_BUFFER_TARGET_MS, ju as WEBRTC_AUDIO_SAMPLE_RATE, zu as WEBRTC_BUNDLE_POLICY, Gu as WEBRTC_DATA_CHANNEL_LABEL, qu as WEBRTC_DATA_CHANNEL_MAX_RETRANSMITS, Ku as WEBRTC_DATA_CHANNEL_ORDERED, Uu as WEBRTC_MAX_AUDIO_TRACKS, Wu as WEBRTC_MAX_VIDEO_TRACKS, Bu as WEBRTC_RTCP_MUX_POLICY, Fu as WEBRTC_VIDEO_CODEC, Iu as WEBRTC_VIDEO_MAX_BITRATE, Lu as WEBRTC_VIDEO_MAX_FRAMERATE, Ju as WebRTCConnection, Yu as WebRTCSignaling, gd as abortSignalAny, I as abortSignalTimeout, cf as adoptPkceVerifierFromUrl, Lg as appMessaging, v as asProtocolMessage, mg as checkBrowserSupport, Cm as clearDeviceId, Vp as clearLogBuffer, ud as clearLoginPrompt, Kg as consumeLoginHandoff, pd as consumeLoginPendingCall, C as createLogger, Jd as createPkceChallenge, Pd as deriveAuthUrl, Md as deriveBackendType, jd as deriveBackendUrl, Fd as deriveCrossOriginAuthUrl, cg as enableInspectMode, wm as extractUserIdFromToken, Bp as flushLogs, cu as getAudioParam, mu as getAuthSameOriginParam, Rp as getBufferedLogs, _m as getConnectTraceId, pu as getDebugOverlayParam, au as getDebugParam, fu as getInspectParam, ou as getLangParam, Hp as getLogBufferSize, Ce as getLogLevel, xe as getLogSink, cd as getLoginPromptState, Ug as getOpcodeName, Sm as getOrCreateDeviceId, nu as getProxyParam, j as getRetryParam, Od as getSameOriginAuthUrl, su as getServerUrlParam, lu as getVideoParam, uu as getWebRtcParam, ru as getWebSocketParam, iu as getWebTransportParam, tg as initializeDebugMode, og as initializeInspectMode, Ip as initializeLogSink, Te as isAudioWorkletSupported, R as isBrowserEnvironment, Vd as isCloudEnvironment, zg as isConnected, Rg as isConnecting, ng as isDebugModeEnabled, rf as isEmbedded, Vg as isError, sg as isInspectModeEnabled, xh as isMobileBrowserLikely, Bg as isOffline, qd as isPkceSupported, Se as isSharedArrayBufferSupported, wu as isWebTransportSupported, bh as loginErrorInterceptor, Bd as parseUrlParams, bm as randomUuid, c as readOpcode, u as readOpcodeGroup, i as readProtocolMessageHeaders, kp as registerBrowserFunctions, ym as reportConnectTimeline, Gg as reprovisionAfterLogin, Yd as restorePkceVerifier, ye as setLogLevel, ve as setLogSink, ld as setLoginPromptRequired, tu as setSdkUrlParam, Lp as setSendLogsCallback, of as startEmbeddedOAuthSignIn, lm as startLogSender, dm as stopLogSender, dd as subscribeLoginPrompt, ge as subscribeToLogEvents, zp as takeBufferedLogs, Xd as takePkceVerifier, ah as withResultData };