@ikonai/sdk 1.3.6 → 1.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +431 -431
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -3170,8 +3170,8 @@ function Xd() {
3170
3170
  }
3171
3171
  //#endregion
3172
3172
  //#region src/utils/embedded-oauth.ts
3173
- var Zd = S("EmbeddedAuth"), Qd = "/oauth/popup-callback", $d = "ikon-oauth-embedder-request", ef = "ikon-oauth-embedder-claim", tf = "ikon_pkce", nf = 800, rf = 3e5;
3174
- function af() {
3173
+ var Zd = S("EmbeddedAuth"), Qd = "/oauth/popup-callback", $d = "ikon-oauth-embedder-request", ef = "ikon-oauth-embedder-claim", tf = /* @__PURE__ */ new Set(), nf = "ikon_pkce", rf = 800, af = 3e5;
3174
+ function of() {
3175
3175
  if (typeof window > "u") return !1;
3176
3176
  try {
3177
3177
  return window.top !== window.self;
@@ -3179,7 +3179,7 @@ function af() {
3179
3179
  return !0;
3180
3180
  }
3181
3181
  }
3182
- async function of(e, t) {
3182
+ async function sf(e, t) {
3183
3183
  let n = await Jd(), r = Xd();
3184
3184
  return await new Promise((i) => {
3185
3185
  let a = !1, o = (e) => {
@@ -3197,19 +3197,19 @@ async function of(e, t) {
3197
3197
  codeChallenge: n,
3198
3198
  codeVerifier: r
3199
3199
  }, "*");
3200
- let c = window.setTimeout(() => o(!1), nf);
3200
+ let c = window.setTimeout(() => o(!1), rf);
3201
3201
  });
3202
3202
  }
3203
- async function sf(e, t) {
3204
- if (await of(e, t)) return !0;
3203
+ async function cf(e, t) {
3204
+ if (await sf(e, t)) return !0;
3205
3205
  try {
3206
- let { code: n, provider: r } = await cf(window.open("about:blank", "ikon-oauth", "popup,width=520,height=680"), e, t), i = new URL(window.location.href);
3206
+ let { code: n, provider: r } = await lf(window.open("about:blank", "ikon-oauth", "popup,width=520,height=680"), e, t), i = new URL(window.location.href);
3207
3207
  return i.searchParams.set("ikon_code", n), i.searchParams.set("ikon_provider", r), window.location.replace(i.toString()), !0;
3208
3208
  } catch (t) {
3209
3209
  return Zd.warn(`Embedded sign-in with ${e} did not complete: ${t instanceof Error ? t.message : String(t)}`), !1;
3210
3210
  }
3211
3211
  }
3212
- async function cf(e, t, n) {
3212
+ async function lf(e, t, n) {
3213
3213
  if (!e) throw Error("The sign-in window was blocked. Allow pop-ups for this site and try again.");
3214
3214
  let r;
3215
3215
  try {
@@ -3244,19 +3244,19 @@ async function cf(e, t, n) {
3244
3244
  o(() => {
3245
3245
  e.close(), r(/* @__PURE__ */ Error("The sign-in timed out"));
3246
3246
  });
3247
- }, rf);
3247
+ }, af);
3248
3248
  });
3249
3249
  }
3250
- function lf(e, t) {
3251
- if (typeof window > "u" || !af()) return () => void 0;
3250
+ function uf(e, t) {
3251
+ if (typeof window > "u" || !of()) return () => void 0;
3252
3252
  let n = (e) => {
3253
3253
  if (e.source !== window.parent) return;
3254
3254
  let n = e.data;
3255
- n?.source !== "ikon-oauth" || n.type !== "ikon-oauth-embedder-result" || typeof n.code != "string" || !n.code || t({
3255
+ n?.source !== "ikon-oauth" || n.type !== "ikon-oauth-embedder-result" || typeof n.code != "string" || !n.code || tf.has(n.code) || (tf.add(n.code), t({
3256
3256
  code: n.code,
3257
3257
  provider: typeof n.provider == "string" ? n.provider : "",
3258
3258
  codeVerifier: typeof n.codeVerifier == "string" ? n.codeVerifier : null
3259
- });
3259
+ }));
3260
3260
  };
3261
3261
  return window.addEventListener("message", n), window.parent.postMessage({
3262
3262
  source: "ikon-oauth",
@@ -3264,39 +3264,39 @@ function lf(e, t) {
3264
3264
  spaceId: e
3265
3265
  }, "*"), () => window.removeEventListener("message", n);
3266
3266
  }
3267
- function uf() {
3267
+ function df() {
3268
3268
  if (typeof window > "u") return;
3269
- let e = new URLSearchParams(window.location.search).get(tf);
3269
+ let e = new URLSearchParams(window.location.search).get(nf);
3270
3270
  e && Yd(e);
3271
3271
  }
3272
3272
  //#endregion
3273
3273
  //#region src/utils/user-gesture.ts
3274
- function df(e) {
3274
+ function ff(e) {
3275
3275
  if (!e || typeof e != "object") return !1;
3276
3276
  let t = e, n = typeof t.name == "string" ? t.name : "", r = typeof t.message == "string" ? t.message : "";
3277
3277
  return !!(n === "NotAllowedError" || n === "SecurityError" || r.toLowerCase().includes("permission") || r.toLowerCase().includes("user gesture"));
3278
3278
  }
3279
3279
  //#endregion
3280
3280
  //#region src/utils/app-routes.ts
3281
- var ff = ["/ikon", "/api"];
3282
- function pf(e) {
3281
+ var pf = ["/ikon", "/api"];
3282
+ function mf(e) {
3283
3283
  if (!e) return !1;
3284
3284
  let t = e.split(/[?#]/)[0], n = t.startsWith("/") ? t : "/" + t;
3285
- return ff.some((e) => n === e || n.startsWith(e + "/"));
3285
+ return pf.some((e) => n === e || n.startsWith(e + "/"));
3286
3286
  }
3287
3287
  //#endregion
3288
3288
  //#region src/functions/browser-functions.ts
3289
- var mf = "ikon-theme", hf = "ikon-theme-user", gf = "ikon-theme-change";
3290
- function _f(e) {
3289
+ var hf = "ikon-theme", gf = "ikon-theme-user", _f = "ikon-theme-change";
3290
+ function vf(e) {
3291
3291
  typeof document < "u" && document.documentElement && document.documentElement.setAttribute("data-theme", e);
3292
3292
  }
3293
- function vf() {
3294
- return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
3295
- }
3296
3293
  function yf() {
3297
- return typeof window > "u" || !window.localStorage ? "light" : window.localStorage.getItem(hf) || window.localStorage.getItem(mf) || vf();
3294
+ return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
3298
3295
  }
3299
3296
  function bf() {
3297
+ return typeof window > "u" || !window.localStorage ? "light" : window.localStorage.getItem(gf) || window.localStorage.getItem(hf) || yf();
3298
+ }
3299
+ function xf() {
3300
3300
  return typeof window > "u" ? {
3301
3301
  width: 0,
3302
3302
  height: 0
@@ -3305,17 +3305,17 @@ function bf() {
3305
3305
  height: window.innerHeight
3306
3306
  };
3307
3307
  }
3308
- function xf() {
3308
+ function Sf() {
3309
3309
  if (typeof window > "u" || !window.localStorage) return "light";
3310
- let e = window.localStorage.getItem(hf), t = window.localStorage.getItem(mf);
3310
+ let e = window.localStorage.getItem(gf), t = window.localStorage.getItem(hf);
3311
3311
  if (e || t) {
3312
3312
  let n = e ?? t;
3313
- return _f(n), n;
3313
+ return vf(n), n;
3314
3314
  }
3315
- let n = vf();
3316
- return window.localStorage.setItem(mf, n), _f(n), n;
3315
+ let n = yf();
3316
+ return window.localStorage.setItem(hf, n), vf(n), n;
3317
3317
  }
3318
- var Sf = {
3318
+ var Cf = {
3319
3319
  name: "ikon.client.getTheme",
3320
3320
  description: "Get the currently selected client theme",
3321
3321
  returnType: {
@@ -3323,12 +3323,12 @@ var Sf = {
3323
3323
  nullable: !0
3324
3324
  }
3325
3325
  };
3326
- function Cf() {
3326
+ function wf() {
3327
3327
  if (typeof window > "u" || !window.localStorage) return null;
3328
- let e = window.localStorage.getItem(hf), t = window.localStorage.getItem(mf);
3328
+ let e = window.localStorage.getItem(gf), t = window.localStorage.getItem(hf);
3329
3329
  return e ?? t ?? null;
3330
3330
  }
3331
- var wf = {
3331
+ var Tf = {
3332
3332
  name: "ikon.client.setTheme",
3333
3333
  description: "Update the client UI theme",
3334
3334
  returnType: { kind: "boolean" },
@@ -3345,38 +3345,38 @@ var wf = {
3345
3345
  description: "Whether to persist as user preference"
3346
3346
  }]
3347
3347
  };
3348
- function Tf(e, t) {
3348
+ function Ef(e, t) {
3349
3349
  if (typeof window > "u" || !window.localStorage || typeof e != "string") return !1;
3350
3350
  let n = e.trim().toLowerCase();
3351
3351
  if (!n) return !1;
3352
3352
  let r = t === void 0 || !!t, i = window.localStorage;
3353
- r ? i.setItem(hf, n) : i.removeItem(hf), i.setItem(mf, n);
3353
+ r ? i.setItem(gf, n) : i.removeItem(gf), i.setItem(hf, n);
3354
3354
  try {
3355
- window.dispatchEvent(new CustomEvent(gf, { detail: { mode: n } }));
3355
+ window.dispatchEvent(new CustomEvent(_f, { detail: { mode: n } }));
3356
3356
  } catch {}
3357
- return _f(n), !0;
3357
+ return vf(n), !0;
3358
3358
  }
3359
- var Ef = {
3359
+ var Df = {
3360
3360
  name: "ikon.client.getLanguage",
3361
3361
  description: "Get the browser language preference",
3362
3362
  returnType: { kind: "string" }
3363
3363
  };
3364
- function Df() {
3364
+ function Of() {
3365
3365
  return typeof navigator > "u" ? "en-US" : navigator.language || "en-US";
3366
3366
  }
3367
- var Of = {
3367
+ var kf = {
3368
3368
  name: "ikon.client.getTimezone",
3369
3369
  description: "Get the browser timezone (IANA format)",
3370
3370
  returnType: { kind: "string" }
3371
3371
  };
3372
- function kf() {
3372
+ function Af() {
3373
3373
  try {
3374
3374
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
3375
3375
  } catch {
3376
3376
  return "UTC";
3377
3377
  }
3378
3378
  }
3379
- function Af() {
3379
+ function jf() {
3380
3380
  if (typeof Intl > "u") return "";
3381
3381
  try {
3382
3382
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
@@ -3384,15 +3384,15 @@ function Af() {
3384
3384
  return "";
3385
3385
  }
3386
3386
  }
3387
- function jf() {
3387
+ function Mf() {
3388
3388
  return typeof navigator > "u" ? !1 : navigator.maxTouchPoints > 0;
3389
3389
  }
3390
- function Mf() {
3390
+ function Nf() {
3391
3391
  if (typeof navigator > "u" || typeof window > "u") return ne.Unknown;
3392
3392
  let e = navigator.maxTouchPoints > 0, t = window.innerWidth <= 1024;
3393
3393
  return e && t ? ne.MobileWeb : ne.DesktopWeb;
3394
3394
  }
3395
- var Nf = {
3395
+ var Pf = {
3396
3396
  name: "ikon.client.getUrl",
3397
3397
  description: "Get the current browser URL path and query string",
3398
3398
  returnType: {
@@ -3400,10 +3400,10 @@ var Nf = {
3400
3400
  nullable: !0
3401
3401
  }
3402
3402
  };
3403
- function Pf() {
3403
+ function Ff() {
3404
3404
  return typeof window > "u" ? null : window.location.pathname + window.location.search;
3405
3405
  }
3406
- var Ff = {
3406
+ var If = {
3407
3407
  name: "ikon.client.setUrl",
3408
3408
  description: "Update the browser URL without triggering a page reload",
3409
3409
  returnType: { kind: "boolean" },
@@ -3431,10 +3431,10 @@ var Ff = {
3431
3431
  }
3432
3432
  ]
3433
3433
  };
3434
- function If(e, t, n) {
3434
+ function Lf(e, t, n) {
3435
3435
  if (typeof window > "u" || !window.history || typeof e != "string") return !1;
3436
3436
  let r = e.trim();
3437
- if (!r || /^[a-z][a-z0-9+.-]*:/i.test(r) || r.startsWith("//") || pf(r)) return !1;
3437
+ if (!r || /^[a-z][a-z0-9+.-]*:/i.test(r) || r.startsWith("//") || mf(r)) return !1;
3438
3438
  try {
3439
3439
  let e = !!t, i = n && !r.includes("?") ? r + window.location.search : r;
3440
3440
  return e ? window.history.replaceState(null, "", i) : window.history.pushState(null, "", i), !0;
@@ -3442,7 +3442,7 @@ function If(e, t, n) {
3442
3442
  return !1;
3443
3443
  }
3444
3444
  }
3445
- var Lf = {
3445
+ var Rf = {
3446
3446
  name: "ikon.client.openExternalUrl",
3447
3447
  description: "Open an external URL in a new browser tab",
3448
3448
  returnType: { kind: "boolean" },
@@ -3452,7 +3452,7 @@ var Lf = {
3452
3452
  description: "The URL to open. Must be absolute (e.g., starts with https://)."
3453
3453
  }]
3454
3454
  };
3455
- function Rf(e) {
3455
+ function zf(e) {
3456
3456
  if (typeof window > "u" || typeof window.open != "function" || typeof e != "string") return !1;
3457
3457
  let t = e.trim();
3458
3458
  if (!t || /^javascript:/i.test(t)) return !1;
@@ -3462,7 +3462,7 @@ function Rf(e) {
3462
3462
  return !1;
3463
3463
  }
3464
3464
  }
3465
- var zf = {
3465
+ var Bf = {
3466
3466
  name: "ikon.client.vibrate",
3467
3467
  description: "Trigger haptic feedback on supported devices",
3468
3468
  returnType: { kind: "boolean" },
@@ -3472,7 +3472,7 @@ var zf = {
3472
3472
  description: "Duration in ms, or comma-separated pattern (e.g., \"200\" or \"100,50,100\")"
3473
3473
  }]
3474
3474
  };
3475
- function Bf(e) {
3475
+ function Vf(e) {
3476
3476
  if (typeof navigator > "u" || !navigator.vibrate || typeof e != "string") return !1;
3477
3477
  try {
3478
3478
  let t = e.split(",").map((e) => parseInt(e.trim(), 10));
@@ -3481,16 +3481,16 @@ function Bf(e) {
3481
3481
  return !1;
3482
3482
  }
3483
3483
  }
3484
- var L = null, Vf = !1, Hf = !1;
3485
- async function Uf() {
3484
+ var L = null, Hf = !1, Uf = !1;
3485
+ async function Wf() {
3486
3486
  if (!(typeof navigator > "u" || !("wakeLock" in navigator))) try {
3487
3487
  L = await navigator.wakeLock.request("screen");
3488
3488
  } catch {}
3489
3489
  }
3490
- function Wf() {
3491
- document.visibilityState === "visible" && Vf && (!L || L.released) && Uf();
3490
+ function Gf() {
3491
+ document.visibilityState === "visible" && Hf && (!L || L.released) && Wf();
3492
3492
  }
3493
- var Gf = {
3493
+ var Kf = {
3494
3494
  name: "ikon.client.keepScreenAwake",
3495
3495
  description: "Prevent or allow the screen to sleep",
3496
3496
  returnType: { kind: "boolean" },
@@ -3500,15 +3500,15 @@ var Gf = {
3500
3500
  description: "Whether to keep the screen awake"
3501
3501
  }]
3502
3502
  };
3503
- async function Kf(e) {
3503
+ async function qf(e) {
3504
3504
  if (typeof navigator > "u" || !("wakeLock" in navigator)) return !1;
3505
3505
  try {
3506
- return e ? (Vf = !0, (!L || L.released) && (L = await navigator.wakeLock.request("screen")), Hf ||= (document.addEventListener("visibilitychange", Wf), !0)) : (Vf = !1, Hf &&= (document.removeEventListener("visibilitychange", Wf), !1), L &&= (await L.release(), null)), !0;
3506
+ return e ? (Hf = !0, (!L || L.released) && (L = await navigator.wakeLock.request("screen")), Uf ||= (document.addEventListener("visibilitychange", Gf), !0)) : (Hf = !1, Uf &&= (document.removeEventListener("visibilitychange", Gf), !1), L &&= (await L.release(), null)), !0;
3507
3507
  } catch {
3508
3508
  return !1;
3509
3509
  }
3510
3510
  }
3511
- var qf = {
3511
+ var Jf = {
3512
3512
  name: "ikon.client.getVisibility",
3513
3513
  description: "Get the current page visibility state",
3514
3514
  returnType: {
@@ -3516,10 +3516,10 @@ var qf = {
3516
3516
  nullable: !0
3517
3517
  }
3518
3518
  };
3519
- function Jf() {
3519
+ function Yf() {
3520
3520
  return typeof document > "u" ? null : document.visibilityState || null;
3521
3521
  }
3522
- var Yf = {
3522
+ var Xf = {
3523
3523
  name: "ikon.client.scrollTo",
3524
3524
  description: "Scroll the page to a specific position",
3525
3525
  returnType: { kind: "boolean" },
@@ -3544,7 +3544,7 @@ var Yf = {
3544
3544
  }
3545
3545
  ]
3546
3546
  };
3547
- function Xf(e, t, n) {
3547
+ function Zf(e, t, n) {
3548
3548
  if (typeof window > "u" || typeof e != "number" || typeof t != "number") return !1;
3549
3549
  try {
3550
3550
  return window.scrollTo({
@@ -3556,7 +3556,7 @@ function Xf(e, t, n) {
3556
3556
  return !1;
3557
3557
  }
3558
3558
  }
3559
- var Zf = {
3559
+ var Qf = {
3560
3560
  name: "ikon.client.getBatteryLevel",
3561
3561
  description: "Get the current battery level (0-100)",
3562
3562
  returnType: {
@@ -3564,7 +3564,7 @@ var Zf = {
3564
3564
  nullable: !0
3565
3565
  }
3566
3566
  };
3567
- async function Qf() {
3567
+ async function $f() {
3568
3568
  if (typeof navigator > "u" || !("getBattery" in navigator)) return null;
3569
3569
  try {
3570
3570
  let e = await navigator.getBattery();
@@ -3573,7 +3573,7 @@ async function Qf() {
3573
3573
  return null;
3574
3574
  }
3575
3575
  }
3576
- var $f = {
3576
+ var ep = {
3577
3577
  name: "ikon.client.getNetworkType",
3578
3578
  description: "Get the current network connection type",
3579
3579
  returnType: {
@@ -3581,17 +3581,17 @@ var $f = {
3581
3581
  nullable: !0
3582
3582
  }
3583
3583
  };
3584
- function ep() {
3584
+ function tp() {
3585
3585
  if (typeof navigator > "u") return null;
3586
3586
  let e = navigator.connection;
3587
3587
  return e && (e.effectiveType || e.type) || null;
3588
3588
  }
3589
- var tp = {
3589
+ var np = {
3590
3590
  name: "ikon.client.requestFullscreen",
3591
3591
  description: "Request the browser to enter fullscreen mode",
3592
3592
  returnType: { kind: "boolean" }
3593
3593
  };
3594
- async function np() {
3594
+ async function rp() {
3595
3595
  if (typeof document > "u" || !document.documentElement) return !1;
3596
3596
  try {
3597
3597
  let e = document.documentElement, t = e.requestFullscreen?.bind(e) ?? e.webkitRequestFullscreen?.bind(e);
@@ -3600,12 +3600,12 @@ async function np() {
3600
3600
  return !1;
3601
3601
  }
3602
3602
  }
3603
- var rp = {
3603
+ var ip = {
3604
3604
  name: "ikon.client.exitFullscreen",
3605
3605
  description: "Exit browser fullscreen mode",
3606
3606
  returnType: { kind: "boolean" }
3607
3607
  };
3608
- function ip() {
3608
+ function ap() {
3609
3609
  if (typeof document > "u") return !1;
3610
3610
  try {
3611
3611
  let e = document.exitFullscreen?.bind(document) ?? document.webkitExitFullscreen?.bind(document);
@@ -3614,25 +3614,25 @@ function ip() {
3614
3614
  return !1;
3615
3615
  }
3616
3616
  }
3617
- var ap = {
3617
+ var op = {
3618
3618
  name: "ikon.client.logout",
3619
3619
  description: "Clear the auth session and return to the login screen at the site root",
3620
3620
  returnType: { kind: "boolean" }
3621
- }, op = ["ikon-auth-", "ikon-live-snapshot"];
3622
- function sp() {
3621
+ }, sp = ["ikon-auth-", "ikon-live-snapshot"];
3622
+ function cp() {
3623
3623
  if (typeof window > "u" || !window.localStorage) return !1;
3624
3624
  try {
3625
3625
  let e = [];
3626
3626
  for (let t = 0; t < window.localStorage.length; t++) {
3627
3627
  let n = window.localStorage.key(t);
3628
- n && op.some((e) => n.startsWith(e)) && e.push(n);
3628
+ n && sp.some((e) => n.startsWith(e)) && e.push(n);
3629
3629
  }
3630
3630
  return e.forEach((e) => window.localStorage.removeItem(e)), setTimeout(() => window.location.replace(window.location.origin + "/"), 100), !0;
3631
3631
  } catch {
3632
3632
  return !1;
3633
3633
  }
3634
3634
  }
3635
- var cp = {
3635
+ var lp = {
3636
3636
  name: "ikon.client.login",
3637
3637
  description: "Start the sign-in flow for an OAuth provider (e.g. google, microsoft)",
3638
3638
  parameters: [{
@@ -3641,15 +3641,15 @@ var cp = {
3641
3641
  }],
3642
3642
  returnType: { kind: "boolean" }
3643
3643
  };
3644
- async function lp(e) {
3644
+ async function up(e) {
3645
3645
  if (typeof window > "u" || typeof e != "string" || e.length === 0 || e === "guest" || e === "global" || e === "email" || e === "passkey") return !1;
3646
3646
  let t = window.__IKON_AUTH_CONFIG__, n = t?.spaceId;
3647
3647
  if (!n) return !1;
3648
- if (af()) return await sf(e, n);
3648
+ if (of()) return await cf(e, n);
3649
3649
  let r = await Fd(t?.authUrl), i = window.location.origin + window.location.pathname + window.location.search, a = await Jd(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
3650
3650
  return window.location.href = `${r}/oauth/${encodeURIComponent(e)}?space=${encodeURIComponent(n)}&return=${encodeURIComponent(i)}${o}`, !0;
3651
3651
  }
3652
- var up = {
3652
+ var dp = {
3653
3653
  name: "ikon.client.loginShow",
3654
3654
  description: "Show the login UI with an optional reason",
3655
3655
  parameters: [{
@@ -3658,15 +3658,15 @@ var up = {
3658
3658
  }],
3659
3659
  returnType: { kind: "boolean" }
3660
3660
  };
3661
- function dp(e) {
3661
+ function fp(e) {
3662
3662
  return typeof window > "u" ? !1 : (ud(typeof e == "string" ? e : null), !0);
3663
3663
  }
3664
- var fp = {
3664
+ var pp = {
3665
3665
  name: "ikon.client.getLocation",
3666
3666
  description: "Get the current GPS location",
3667
3667
  returnType: { kind: "string" }
3668
3668
  };
3669
- function pp() {
3669
+ function mp() {
3670
3670
  return typeof navigator > "u" || !navigator.geolocation ? Promise.resolve(null) : new Promise((e) => {
3671
3671
  navigator.geolocation.getCurrentPosition((t) => {
3672
3672
  e({
@@ -3680,15 +3680,15 @@ function pp() {
3680
3680
  });
3681
3681
  });
3682
3682
  }
3683
- var mp = [], hp = !1;
3684
- function gp() {
3683
+ var hp = [], gp = !1;
3684
+ function _p() {
3685
3685
  return typeof window < "u" && "Notification" in window;
3686
3686
  }
3687
- function _p(e, t, n, r) {
3687
+ function vp(e, t, n, r) {
3688
3688
  let i = {};
3689
3689
  return e?.trim() && (i.body = e.trim()), t?.trim() && (i.icon = t.trim()), n?.trim() && (i.tag = n.trim()), r && (i.data = r), i;
3690
3690
  }
3691
- function vp(e, t, n, r) {
3691
+ function yp(e, t, n, r) {
3692
3692
  try {
3693
3693
  let i = new Notification(e, t);
3694
3694
  i.onclick = () => {
@@ -3703,40 +3703,40 @@ function vp(e, t, n, r) {
3703
3703
  };
3704
3704
  } catch {}
3705
3705
  }
3706
- function yp() {
3706
+ function bp() {
3707
3707
  if (Notification.permission !== "granted") {
3708
- mp = [];
3708
+ hp = [];
3709
3709
  return;
3710
3710
  }
3711
- let e = mp;
3712
- mp = [];
3713
- for (let t of e) vp(t.title, t.options, t.launchUrl, t.data);
3711
+ let e = hp;
3712
+ hp = [];
3713
+ for (let t of e) yp(t.title, t.options, t.launchUrl, t.data);
3714
3714
  }
3715
- function bp() {
3716
- if (hp || typeof window > "u") return;
3717
- hp = !0;
3715
+ function xp() {
3716
+ if (gp || typeof window > "u") return;
3717
+ gp = !0;
3718
3718
  let e = async () => {
3719
3719
  try {
3720
3720
  if (await Notification.requestPermission() === "granted") {
3721
- yp();
3721
+ bp();
3722
3722
  return;
3723
3723
  }
3724
3724
  } catch {}
3725
- mp = [];
3725
+ hp = [];
3726
3726
  }, t = () => {
3727
- window.removeEventListener("pointerdown", t), window.removeEventListener("keydown", t), hp = !1, e();
3727
+ window.removeEventListener("pointerdown", t), window.removeEventListener("keydown", t), gp = !1, e();
3728
3728
  };
3729
3729
  window.addEventListener("pointerdown", t), window.addEventListener("keydown", t);
3730
3730
  }
3731
- var xp = {
3731
+ var Sp = {
3732
3732
  name: "ikon.client.getNotificationPermission",
3733
3733
  description: "Get the current notification permission state (granted, denied, default, or unsupported)",
3734
3734
  returnType: { kind: "string" }
3735
3735
  };
3736
- function Sp() {
3737
- return gp() ? Notification.permission : "unsupported";
3736
+ function Cp() {
3737
+ return _p() ? Notification.permission : "unsupported";
3738
3738
  }
3739
- var Cp = {
3739
+ var wp = {
3740
3740
  name: "ikon.client.showNotification",
3741
3741
  description: "Show a notification, requesting permission lazily on the first send",
3742
3742
  returnType: { kind: "string" },
@@ -3782,33 +3782,33 @@ var Cp = {
3782
3782
  }
3783
3783
  ]
3784
3784
  };
3785
- async function wp(e, t, n, r, i, a) {
3786
- if (!gp() || typeof e != "string" || !e.trim()) return "unsupported";
3787
- let o = e.trim(), s = _p(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;
3788
- if (Notification.permission === "granted") return vp(o, s, c, l), "granted";
3785
+ async function Tp(e, t, n, r, i, a) {
3786
+ if (!_p() || typeof e != "string" || !e.trim()) return "unsupported";
3787
+ let o = e.trim(), s = vp(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;
3788
+ if (Notification.permission === "granted") return yp(o, s, c, l), "granted";
3789
3789
  if (Notification.permission === "denied") return "denied";
3790
3790
  try {
3791
3791
  let e = await Notification.requestPermission();
3792
- return e === "granted" && vp(o, s, c, l), e;
3792
+ return e === "granted" && yp(o, s, c, l), e;
3793
3793
  } catch (e) {
3794
- return df(e) ? (mp.push({
3794
+ return ff(e) ? (hp.push({
3795
3795
  title: o,
3796
3796
  options: s,
3797
3797
  launchUrl: c,
3798
3798
  data: l
3799
- }), bp(), "default") : "denied";
3799
+ }), xp(), "default") : "denied";
3800
3800
  }
3801
3801
  }
3802
- var Tp = null;
3803
- function Ep(e) {
3804
- Tp = e ?? null;
3805
- }
3802
+ var Ep = null;
3806
3803
  function Dp(e) {
3804
+ Ep = e ?? null;
3805
+ }
3806
+ function Op(e) {
3807
3807
  let t = (e + "=".repeat((4 - e.length % 4) % 4)).replace(/-/g, "+").replace(/_/g, "/"), n = atob(t), r = new Uint8Array(n.length);
3808
3808
  for (let e = 0; e < n.length; e++) r[e] = n.charCodeAt(e);
3809
3809
  return r;
3810
3810
  }
3811
- var Op = {
3811
+ var kp = {
3812
3812
  name: "ikon.client.getPushSubscription",
3813
3813
  description: "Subscribe to Web Push and return the subscription, for offline push registration",
3814
3814
  returnType: {
@@ -3816,14 +3816,14 @@ var Op = {
3816
3816
  nullable: !0
3817
3817
  }
3818
3818
  };
3819
- async function kp() {
3820
- if (typeof window > "u" || !Tp?.enabled || !Tp.vapidPublicKey || !("serviceWorker" in navigator) || !("PushManager" in window) || !gp() || Notification.permission !== "granted") return null;
3819
+ async function Ap() {
3820
+ if (typeof window > "u" || !Ep?.enabled || !Ep.vapidPublicKey || !("serviceWorker" in navigator) || !("PushManager" in window) || !_p() || Notification.permission !== "granted") return null;
3821
3821
  try {
3822
3822
  let e = await navigator.serviceWorker.register("/push-service-worker.js");
3823
3823
  await navigator.serviceWorker.ready;
3824
3824
  let t = (await e.pushManager.getSubscription() ?? await e.pushManager.subscribe({
3825
3825
  userVisibleOnly: !0,
3826
- applicationServerKey: Dp(Tp.vapidPublicKey)
3826
+ applicationServerKey: Op(Ep.vapidPublicKey)
3827
3827
  })).toJSON();
3828
3828
  return !t.endpoint || !t.keys?.p256dh || !t.keys?.auth ? null : {
3829
3829
  Platform: "web",
@@ -3836,98 +3836,98 @@ async function kp() {
3836
3836
  return null;
3837
3837
  }
3838
3838
  }
3839
- var Ap = [
3839
+ var jp = [
3840
3840
  {
3841
- definition: Sf,
3842
- handler: Cf
3841
+ definition: Cf,
3842
+ handler: wf
3843
3843
  },
3844
3844
  {
3845
- definition: wf,
3846
- handler: Tf
3845
+ definition: Tf,
3846
+ handler: Ef
3847
3847
  },
3848
3848
  {
3849
- definition: Ef,
3850
- handler: Df
3849
+ definition: Df,
3850
+ handler: Of
3851
3851
  },
3852
3852
  {
3853
- definition: Of,
3854
- handler: kf
3853
+ definition: kf,
3854
+ handler: Af
3855
3855
  },
3856
3856
  {
3857
- definition: Nf,
3858
- handler: Pf
3857
+ definition: Pf,
3858
+ handler: Ff
3859
3859
  },
3860
3860
  {
3861
- definition: Ff,
3862
- handler: If
3861
+ definition: If,
3862
+ handler: Lf
3863
3863
  },
3864
3864
  {
3865
- definition: Lf,
3866
- handler: Rf
3865
+ definition: Rf,
3866
+ handler: zf
3867
3867
  },
3868
3868
  {
3869
- definition: zf,
3870
- handler: Bf
3869
+ definition: Bf,
3870
+ handler: Vf
3871
3871
  },
3872
3872
  {
3873
- definition: Gf,
3874
- handler: Kf
3873
+ definition: Kf,
3874
+ handler: qf
3875
3875
  },
3876
3876
  {
3877
- definition: qf,
3878
- handler: Jf
3877
+ definition: Jf,
3878
+ handler: Yf
3879
3879
  },
3880
3880
  {
3881
- definition: Yf,
3882
- handler: Xf
3881
+ definition: Xf,
3882
+ handler: Zf
3883
3883
  },
3884
3884
  {
3885
- definition: Zf,
3886
- handler: Qf
3885
+ definition: Qf,
3886
+ handler: $f
3887
3887
  },
3888
3888
  {
3889
- definition: $f,
3890
- handler: ep
3889
+ definition: ep,
3890
+ handler: tp
3891
3891
  },
3892
3892
  {
3893
- definition: tp,
3894
- handler: np
3893
+ definition: np,
3894
+ handler: rp
3895
3895
  },
3896
3896
  {
3897
- definition: rp,
3898
- handler: ip
3897
+ definition: ip,
3898
+ handler: ap
3899
3899
  },
3900
3900
  {
3901
- definition: ap,
3902
- handler: sp
3901
+ definition: op,
3902
+ handler: cp
3903
3903
  },
3904
3904
  {
3905
- definition: cp,
3906
- handler: lp
3905
+ definition: lp,
3906
+ handler: up
3907
3907
  },
3908
3908
  {
3909
- definition: up,
3910
- handler: dp
3909
+ definition: dp,
3910
+ handler: fp
3911
3911
  },
3912
3912
  {
3913
- definition: fp,
3914
- handler: pp
3913
+ definition: pp,
3914
+ handler: mp
3915
3915
  },
3916
3916
  {
3917
- definition: xp,
3918
- handler: Sp
3917
+ definition: Sp,
3918
+ handler: Cp
3919
3919
  },
3920
3920
  {
3921
- definition: Cp,
3922
- handler: wp
3921
+ definition: wp,
3922
+ handler: Tp
3923
3923
  },
3924
3924
  {
3925
- definition: Op,
3926
- handler: kp
3925
+ definition: kp,
3926
+ handler: Ap
3927
3927
  }
3928
3928
  ];
3929
- function jp(e) {
3930
- let t = Ap.map(({ definition: t, handler: n }) => e.register(t, n));
3929
+ function Mp(e) {
3930
+ let t = jp.map(({ definition: t, handler: n }) => e.register(t, n));
3931
3931
  return () => t.forEach((e) => e());
3932
3932
  }
3933
3933
  function R() {
@@ -3935,126 +3935,126 @@ function R() {
3935
3935
  }
3936
3936
  //#endregion
3937
3937
  //#region src/utils/log-sink.ts
3938
- var Mp = 1e3, Np = x.INFO, z = [], Pp = Mp, Fp = Np, Ip = null;
3939
- function Lp(e) {
3940
- e.level < Fp || (z.push(e), z.length > Pp && (z = z.slice(-Pp)));
3941
- }
3938
+ var Np = 1e3, Pp = x.INFO, z = [], Fp = Np, Ip = Pp, Lp = null;
3942
3939
  function Rp(e) {
3943
- Pp = e?.maxBufferSize ?? Mp, Fp = e?.minLevel ?? Np, z = [], ye(Lp);
3940
+ e.level < Ip || (z.push(e), z.length > Fp && (z = z.slice(-Fp)));
3944
3941
  }
3945
3942
  function zp(e) {
3946
- Ip = e;
3943
+ Fp = e?.maxBufferSize ?? Np, Ip = e?.minLevel ?? Pp, z = [], ye(Rp);
3947
3944
  }
3948
- function Bp() {
3949
- return z;
3945
+ function Bp(e) {
3946
+ Lp = e;
3950
3947
  }
3951
3948
  function Vp() {
3952
- let e = z;
3953
- return z = [], e;
3949
+ return z;
3954
3950
  }
3955
3951
  function Hp() {
3956
- if (!Ip || z.length === 0) return 0;
3957
- let e = Vp();
3958
- return Ip(e), e.length;
3952
+ let e = z;
3953
+ return z = [], e;
3959
3954
  }
3960
3955
  function Up() {
3961
- z = [];
3956
+ if (!Lp || z.length === 0) return 0;
3957
+ let e = Hp();
3958
+ return Lp(e), e.length;
3962
3959
  }
3963
3960
  function Wp() {
3961
+ z = [];
3962
+ }
3963
+ function Gp() {
3964
3964
  return z.length;
3965
3965
  }
3966
- Rp();
3966
+ zp();
3967
3967
  //#endregion
3968
3968
  //#region src/utils/log-sender.ts
3969
- var Gp = S("LogSender"), Kp = 1e3, qp = 6e4, Jp = 15e3, Yp = 10240, Xp = 409600, Zp = "…[truncated]", Qp = {
3969
+ var Kp = S("LogSender"), qp = 1e3, Jp = 6e4, Yp = 15e3, Xp = 10240, Zp = 409600, Qp = "…[truncated]", $p = {
3970
3970
  [x.DEBUG]: he.Debug,
3971
3971
  [x.INFO]: he.Info,
3972
3972
  [x.WARN]: he.Warning,
3973
3973
  [x.ERROR]: he.Error
3974
- }, B, $p, V, H = [], U = 0, em;
3975
- function tm(e) {
3976
- return e.length <= Yp ? e : e.slice(0, 10228) + Zp;
3977
- }
3974
+ }, B, em, V, H = [], U = 0, tm;
3978
3975
  function nm(e) {
3976
+ return e.length <= Xp ? e : e.slice(0, 10228) + Qp;
3977
+ }
3978
+ function rm(e) {
3979
3979
  return {
3980
3980
  Time: e.timestamp,
3981
- Type: Qp[e.level] ?? he.Info,
3982
- Message: tm(`[${e.component}] ${e.message}`),
3981
+ Type: $p[e.level] ?? he.Info,
3982
+ Message: nm(`[${e.component}] ${e.message}`),
3983
3983
  Parameters: "{}"
3984
3984
  };
3985
3985
  }
3986
- function rm(e) {
3986
+ function im(e) {
3987
3987
  return JSON.stringify({
3988
3988
  type: "sdk-typescript",
3989
3989
  event: { Logs: e }
3990
3990
  });
3991
3991
  }
3992
- function im(e) {
3992
+ function am(e) {
3993
3993
  if (e.length === 0) return [];
3994
- let t = Xp - rm([]).length, n = [], r = [], i = 0;
3994
+ let t = Zp - im([]).length, n = [], r = [], i = 0;
3995
3995
  for (let a of e) {
3996
3996
  let e = JSON.stringify(a).length + 1;
3997
3997
  r.length > 0 && i + e > t && (n.push(r), r = [], i = 0), r.push(a), i += e;
3998
3998
  }
3999
3999
  return r.length > 0 && n.push(r), n;
4000
4000
  }
4001
- async function am(e) {
4001
+ async function om(e) {
4002
4002
  if (e.length === 0 || !B) return;
4003
4003
  let t = `${B}/events/logs/json`, n = {
4004
4004
  "Content-Type": "application/json",
4005
- Authorization: `Bearer ${$p}`
4005
+ Authorization: `Bearer ${em}`
4006
4006
  }, r = await fetch(t, {
4007
4007
  method: "POST",
4008
4008
  headers: n,
4009
- body: rm(e),
4010
- signal: F(Jp)
4009
+ body: im(e),
4010
+ signal: F(Yp)
4011
4011
  });
4012
4012
  if (!r.ok) {
4013
4013
  if (r.status >= 400 && r.status < 500) {
4014
- Gp.warn(`Dropping ${e.length} log entries due to ${r.status}`);
4014
+ Kp.warn(`Dropping ${e.length} log entries due to ${r.status}`);
4015
4015
  return;
4016
4016
  }
4017
4017
  throw Error(`Failed to send logs: ${r.status}`);
4018
4018
  }
4019
4019
  }
4020
- function om() {
4021
- if (U === 0) return Kp;
4022
- let e = Kp * (1 << Math.min(U, 6));
4023
- return Math.min(e, qp);
4020
+ function sm() {
4021
+ if (U === 0) return qp;
4022
+ let e = qp * (1 << Math.min(U, 6));
4023
+ return Math.min(e, Jp);
4024
4024
  }
4025
- function sm(e) {
4026
- B && (V = setTimeout(() => void cm(), e));
4025
+ function cm(e) {
4026
+ B && (V = setTimeout(() => void lm(), e));
4027
4027
  }
4028
- async function cm() {
4028
+ async function lm() {
4029
4029
  V = void 0;
4030
- let e = Vp();
4031
- if (H = H.concat(e.map(nm)), typeof navigator < "u" && navigator.onLine === !1) {
4032
- sm(Kp);
4030
+ let e = Hp();
4031
+ if (H = H.concat(e.map(rm)), typeof navigator < "u" && navigator.onLine === !1) {
4032
+ cm(qp);
4033
4033
  return;
4034
4034
  }
4035
4035
  if (H.length === 0) {
4036
- sm(Kp);
4036
+ cm(qp);
4037
4037
  return;
4038
4038
  }
4039
4039
  let t = H;
4040
4040
  H = [];
4041
- let n = im(t), r = !1;
4041
+ let n = am(t), r = !1;
4042
4042
  for (let e = 0; e < n.length; e++) try {
4043
- await am(n[e]);
4043
+ await om(n[e]);
4044
4044
  } catch {
4045
4045
  H = n.slice(e).flat().concat(H), r = !0;
4046
4046
  break;
4047
4047
  }
4048
- r ? U++ : U = 0, sm(om());
4048
+ r ? U++ : U = 0, cm(sm());
4049
4049
  }
4050
- function lm() {
4051
- V !== void 0 && (clearTimeout(V), V = void 0), sm(0);
4052
- }
4053
- function um(e, t) {
4054
- fm(), B = e, $p = t, U = 0, typeof window < "u" && (em = lm, window.addEventListener("online", em)), sm(Kp);
4050
+ function um() {
4051
+ V !== void 0 && (clearTimeout(V), V = void 0), cm(0);
4055
4052
  }
4056
4053
  function dm(e, t) {
4057
- if (!B || !$p) return;
4054
+ pm(), B = e, em = t, U = 0, typeof window < "u" && (tm = um, window.addEventListener("online", tm)), cm(qp);
4055
+ }
4056
+ function fm(e, t) {
4057
+ if (!B || !em) return;
4058
4058
  let n = { Events: [{
4059
4059
  Time: (/* @__PURE__ */ new Date()).toISOString(),
4060
4060
  EventName: e,
@@ -4068,60 +4068,60 @@ function dm(e, t) {
4068
4068
  method: "POST",
4069
4069
  headers: {
4070
4070
  "Content-Type": "application/json",
4071
- Authorization: `Bearer ${$p}`
4071
+ Authorization: `Bearer ${em}`
4072
4072
  },
4073
4073
  body: r
4074
- }).catch((t) => Gp.warn(`Failed to send analytics event ${e}: ${t}`));
4074
+ }).catch((t) => Kp.warn(`Failed to send analytics event ${e}: ${t}`));
4075
4075
  }
4076
- function fm() {
4077
- V !== void 0 && (clearTimeout(V), V = void 0), em !== void 0 && typeof window < "u" && (window.removeEventListener("online", em), em = void 0), B = void 0, $p = void 0, H = [], U = 0;
4076
+ function pm() {
4077
+ V !== void 0 && (clearTimeout(V), V = void 0), tm !== void 0 && typeof window < "u" && (window.removeEventListener("online", tm), tm = void 0), B = void 0, em = void 0, H = [], U = 0;
4078
4078
  }
4079
4079
  //#endregion
4080
4080
  //#region src/utils/connect-timeline.ts
4081
- var pm = S("ConnectTimeline"), mm = "ikon-connect-trace-id", hm, gm = !1;
4082
- function _m() {
4081
+ var mm = S("ConnectTimeline"), hm = "ikon-connect-trace-id", gm, _m = !1;
4082
+ function vm() {
4083
4083
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`;
4084
4084
  }
4085
- function vm() {
4085
+ function ym() {
4086
4086
  try {
4087
- let e = sessionStorage.getItem(mm);
4087
+ let e = sessionStorage.getItem(hm);
4088
4088
  if (e) return e;
4089
- let t = _m();
4090
- return sessionStorage.setItem(mm, t), t;
4089
+ let t = vm();
4090
+ return sessionStorage.setItem(hm, t), t;
4091
4091
  } catch {
4092
- return hm ??= _m(), hm;
4092
+ return gm ??= vm(), gm;
4093
4093
  }
4094
4094
  }
4095
- function ym(e) {
4095
+ function bm(e) {
4096
4096
  if (typeof performance > "u" || typeof performance.getEntriesByType != "function") return;
4097
4097
  let t = performance.getEntriesByType("resource");
4098
4098
  for (let n = t.length - 1; n >= 0; n--) if (t[n].name.includes(e)) return Math.round(t[n].duration);
4099
4099
  }
4100
- function bm(e = {}) {
4101
- if (gm) return;
4102
- gm = !0;
4103
- let t = { connectTraceId: vm() };
4100
+ function xm(e = {}) {
4101
+ if (_m) return;
4102
+ _m = !0;
4103
+ let t = { connectTraceId: ym() };
4104
4104
  e.snapshotSeeded !== void 0 && (t.snapshotSeeded = String(e.snapshotSeeded));
4105
4105
  try {
4106
4106
  if (typeof performance < "u") {
4107
4107
  t.firstPaintMs = String(Math.round(performance.now()));
4108
4108
  let e = performance.getEntriesByType("navigation")[0];
4109
4109
  e && (t.cdnHtmlMs = String(Math.round(e.responseEnd - e.fetchStart)), t.domContentLoadedMs = String(Math.round(e.domContentLoadedEventEnd)));
4110
- let n = ym("/anonymous");
4110
+ let n = bm("/anonymous");
4111
4111
  n !== void 0 && (t.authMs = String(n));
4112
- let r = ym("/init");
4112
+ let r = bm("/init");
4113
4113
  r !== void 0 && (t.initMs = String(r));
4114
- let i = ym("/connect");
4114
+ let i = bm("/connect");
4115
4115
  i !== void 0 && (t.connectMs = String(i));
4116
4116
  }
4117
4117
  } catch (e) {
4118
- pm.warn(`Failed to read performance timeline: ${e}`);
4118
+ mm.warn(`Failed to read performance timeline: ${e}`);
4119
4119
  }
4120
- dm("client_connect_timeline", t);
4120
+ fm("client_connect_timeline", t);
4121
4121
  }
4122
4122
  //#endregion
4123
4123
  //#region src/utils/uuid.ts
4124
- function xm() {
4124
+ function Sm() {
4125
4125
  let e = globalThis.crypto;
4126
4126
  if (e && typeof e.randomUUID == "function") return e.randomUUID();
4127
4127
  let t = /* @__PURE__ */ new Uint8Array(16);
@@ -4134,34 +4134,34 @@ function xm() {
4134
4134
  }
4135
4135
  //#endregion
4136
4136
  //#region src/storage.ts
4137
- var Sm = "ikon-device-id";
4138
- function Cm() {
4139
- if (typeof window > "u" || typeof localStorage > "u") return xm();
4137
+ var Cm = "ikon-device-id";
4138
+ function wm() {
4139
+ if (typeof window > "u" || typeof localStorage > "u") return Sm();
4140
4140
  try {
4141
- let e = localStorage.getItem(Sm);
4142
- return e || (e = xm(), localStorage.setItem(Sm, e)), e;
4141
+ let e = localStorage.getItem(Cm);
4142
+ return e || (e = Sm(), localStorage.setItem(Cm, e)), e;
4143
4143
  } catch {
4144
- return xm();
4144
+ return Sm();
4145
4145
  }
4146
4146
  }
4147
- function wm() {
4147
+ function Tm() {
4148
4148
  if (!(typeof localStorage > "u")) try {
4149
- localStorage.removeItem(Sm);
4149
+ localStorage.removeItem(Cm);
4150
4150
  } catch {}
4151
4151
  }
4152
- function Tm(e) {
4153
- let t = Dm(e);
4152
+ function Em(e) {
4153
+ let t = Om(e);
4154
4154
  return typeof t?.id == "string" ? t.id : null;
4155
4155
  }
4156
- function Em(e) {
4157
- let t = Dm(e);
4156
+ function Dm(e) {
4157
+ let t = Om(e);
4158
4158
  return t ? {
4159
4159
  userId: typeof t.id == "string" ? t.id : null,
4160
4160
  authSession: typeof t.authSession == "string" ? t.authSession : null,
4161
4161
  role: typeof t.role == "string" ? t.role : null
4162
4162
  } : null;
4163
4163
  }
4164
- function Dm(e) {
4164
+ function Om(e) {
4165
4165
  try {
4166
4166
  let t = e.split(".");
4167
4167
  if (t.length !== 3) return null;
@@ -4173,8 +4173,8 @@ function Dm(e) {
4173
4173
  }
4174
4174
  //#endregion
4175
4175
  //#region src/connection/authenticator.ts
4176
- var W = S("Authenticator"), G = C.GROUP_CORE | C.GROUP_KEEPALIVE | C.GROUP_EVENTS | C.GROUP_ACTIONS | C.GROUP_UI | C.GROUP_AUDIO | C.GROUP_VIDEO | C.GROUP_ANALYTICS | C.GROUP_APP_LOCAL, Om = 2, km = 6e4, Am = 2e3, jm = 1e4, Mm = 3e3, Nm = 3e3, Pm = 3, Fm = "X-Ikon-Startup-Failed", Im = "startup_failed", Lm = 1e3, Rm = 4;
4177
- async function zm(e, t, n, r) {
4176
+ var W = S("Authenticator"), G = C.GROUP_CORE | C.GROUP_KEEPALIVE | C.GROUP_EVENTS | C.GROUP_ACTIONS | C.GROUP_UI | C.GROUP_AUDIO | C.GROUP_VIDEO | C.GROUP_ANALYTICS | C.GROUP_APP_LOCAL, km = 2, Am = 6e4, jm = 2e3, Mm = 1e4, Nm = 3e3, Pm = 3e3, Fm = 3, Im = "X-Ikon-Startup-Failed", Lm = "startup_failed", Rm = 1e3, zm = 4;
4177
+ async function Bm(e, t, n, r) {
4178
4178
  if (e) try {
4179
4179
  let i = await fetch(`${n}/anonymous`, {
4180
4180
  method: "POST",
@@ -4195,7 +4195,7 @@ async function zm(e, t, n, r) {
4195
4195
  W.warn("Anonymous auth returned no token");
4196
4196
  return;
4197
4197
  }
4198
- let o = Tm(a.token);
4198
+ let o = Em(a.token);
4199
4199
  if (!o) {
4200
4200
  W.warn("Anonymous auth token had no extractable userId");
4201
4201
  return;
@@ -4209,7 +4209,7 @@ async function zm(e, t, n, r) {
4209
4209
  return;
4210
4210
  }
4211
4211
  }
4212
- async function Bm(e, t, n, r) {
4212
+ async function Vm(e, t, n, r) {
4213
4213
  try {
4214
4214
  let i = await fetch(`${e}/profiles/me?space=${encodeURIComponent(t)}`, {
4215
4215
  method: "GET",
@@ -4221,7 +4221,7 @@ async function Bm(e, t, n, r) {
4221
4221
  W.warn("Failed to ensure profile:", e);
4222
4222
  }
4223
4223
  }
4224
- async function Vm(e) {
4224
+ async function Hm(e) {
4225
4225
  let t = await e.text().catch(() => "Unknown error");
4226
4226
  try {
4227
4227
  let e = JSON.parse(t);
@@ -4229,16 +4229,16 @@ async function Vm(e) {
4229
4229
  } catch {}
4230
4230
  return t;
4231
4231
  }
4232
- async function Hm(e) {
4232
+ async function Um(e) {
4233
4233
  if (e.ok) return;
4234
- let t = await Vm(e);
4235
- throw e.status === 403 ? new Pl(`Access denied: ${t}`, t) : Um("Failed to get or create profile", e.status, t);
4234
+ let t = await Hm(e);
4235
+ throw e.status === 403 ? new Pl(`Access denied: ${t}`, t) : Wm("Failed to get or create profile", e.status, t);
4236
4236
  }
4237
- function Um(e, t, n) {
4237
+ function Wm(e, t, n) {
4238
4238
  let r = `${e}: ${t} ${n}`;
4239
4239
  return t >= 500 ? new Ll(r, t) : new w(r);
4240
4240
  }
4241
- function Wm(e, t, n) {
4241
+ function Gm(e, t, n) {
4242
4242
  let r = {
4243
4243
  method: "POST",
4244
4244
  headers: {
@@ -4250,29 +4250,29 @@ function Wm(e, t, n) {
4250
4250
  };
4251
4251
  return t || (r.credentials = "include"), r;
4252
4252
  }
4253
- async function Gm(e, t, n, r) {
4254
- let i = `${e}/init`, a = await fetch(i, Wm(t, n, r));
4253
+ async function Km(e, t, n, r) {
4254
+ let i = `${e}/init`, a = await fetch(i, Gm(t, n, r));
4255
4255
  if (!a.ok) {
4256
- let e = await Vm(a);
4257
- throw a.status === 403 ? new Pl(`Access denied: ${e}`, e) : a.status === 404 && t.sessionIdentityHash ? new Fl(t.sessionIdentityHash) : Um("Backend init failed", a.status, e);
4256
+ let e = await Hm(a);
4257
+ throw a.status === 403 ? new Pl(`Access denied: ${e}`, e) : a.status === 404 && t.sessionIdentityHash ? new Fl(t.sessionIdentityHash) : Wm("Backend init failed", a.status, e);
4258
4258
  }
4259
4259
  return a.json();
4260
4260
  }
4261
- function Km(e, t) {
4261
+ function qm(e, t) {
4262
4262
  return e.startupFailed ? new Ml() : new jl(t);
4263
4263
  }
4264
- async function qm(e, t, n) {
4265
- let r = F(n ?? jm), i = t ? _d([t, r]) : r, a = Date.now(), o = await fetch(e, { signal: i });
4264
+ async function K(e, t, n) {
4265
+ let r = F(n ?? Mm), i = t ? _d([t, r]) : r, a = Date.now(), o = await fetch(e, { signal: i });
4266
4266
  if (!o.ok) {
4267
4267
  let e = await o.text().catch(() => "Unknown error");
4268
- throw o.status === 429 ? new Il(`Server is at capacity: ${e}`) : o.headers.get(Fm) || e.includes(Im) ? new Ml() : Um("Failed to connect", o.status, e);
4268
+ throw o.status === 429 ? new Il(`Server is at capacity: ${e}`) : o.headers.get(Im) || e.includes(Lm) ? new Ml() : Wm("Failed to connect", o.status, e);
4269
4269
  }
4270
4270
  let s = await o.arrayBuffer(), c = await jn(new Uint8Array(s));
4271
4271
  return W.debug(`Connect URL fetched in ${Date.now() - a}ms`), { authResponse: c };
4272
4272
  }
4273
4273
  async function Jm(e, t) {
4274
4274
  try {
4275
- let n = new URL(e), r = `${n.protocol}//${n.host}/health`, i = F(Nm), a = t ? _d([t, i]) : i;
4275
+ let n = new URL(e), r = `${n.protocol}//${n.host}/health`, i = F(Pm), a = t ? _d([t, i]) : i;
4276
4276
  return (await fetch(r, { signal: a })).ok;
4277
4277
  } catch {
4278
4278
  return !1;
@@ -4301,23 +4301,23 @@ async function Ym(e, t, n, r, i) {
4301
4301
  })), a.length === 0) throw new w("No connect URL available");
4302
4302
  W.debug(`Auth URL order: [${a.map((e) => e.isProxy ? "proxy" : "direct").join(", ")}], mode: ${n}, proxyPreferred: ${r}`);
4303
4303
  let o = n === "auto" && a.length > 1 && !a[0].isProxy, s = Date.now(), c = 0;
4304
- for (; c < Om || Date.now() - s < km;) {
4304
+ for (; c < km || Date.now() - s < Am;) {
4305
4305
  for (let t = 0; t < a.length; t++) {
4306
- let n = a[t], r = c === 0 && t === 0 && o ? Mm : jm;
4306
+ let n = a[t], r = c === 0 && t === 0 && o ? Nm : Mm;
4307
4307
  try {
4308
- let t = await qm(n.url, i, r);
4308
+ let t = await K(n.url, i, r);
4309
4309
  return t.usedProxyUrl = n.isProxy, t.directUrl = e, W.debug(`Auth succeeded via ${n.isProxy ? "proxy" : "direct"} URL`), t;
4310
4310
  } catch (e) {
4311
4311
  if (i?.aborted || e instanceof Il || e instanceof Ml) throw e;
4312
4312
  W.warn(`Auth via ${n.isProxy ? "proxy" : "direct"} URL failed (round ${c + 1}, timeout ${r}ms): ${e}`);
4313
4313
  }
4314
4314
  }
4315
- c++, await zl(Am, i);
4315
+ c++, await zl(jm, i);
4316
4316
  }
4317
4317
  throw new w("Failed to connect after exhausting all URL attempts");
4318
4318
  }
4319
4319
  function Xm(e, t, n = "", r = !0) {
4320
- let i = bf();
4320
+ let i = xf();
4321
4321
  return Qt({
4322
4322
  ServerSessionId: "",
4323
4323
  ContextType: m.Browser,
@@ -4327,7 +4327,7 @@ function Xm(e, t, n = "", r = !0) {
4327
4327
  IsSnapshot: vu(),
4328
4328
  Description: e.description ?? "Ikon SDK TypeScript",
4329
4329
  UserId: t,
4330
- DeviceId: e.deviceId ?? Cm(),
4330
+ DeviceId: e.deviceId ?? wm(),
4331
4331
  ProductId: e.productId ?? "ikon-sdk",
4332
4332
  VersionId: e.versionId ?? "1.0.0",
4333
4333
  InstallId: e.installId ?? "",
@@ -4335,20 +4335,20 @@ function Xm(e, t, n = "", r = !0) {
4335
4335
  OpcodeGroupsFromServer: e.opcodeGroupsFromServer ?? G,
4336
4336
  OpcodeGroupsToServer: e.opcodeGroupsToServer ?? G,
4337
4337
  ProtocolVersion: 1,
4338
- SdkCapability: Rm,
4338
+ SdkCapability: zm,
4339
4339
  HasInput: !1,
4340
4340
  AuthSessionId: n,
4341
4341
  IsAnonymous: r,
4342
4342
  IsGlobal: !1,
4343
4343
  ReceiveAllMessages: !1,
4344
4344
  UserAgent: typeof navigator < "u" ? navigator.userAgent : "",
4345
- ClientType: Mf(),
4345
+ ClientType: Nf(),
4346
4346
  Parameters: e.parameters ?? {},
4347
4347
  ViewportWidth: i.width,
4348
4348
  ViewportHeight: i.height,
4349
- Theme: yf(),
4350
- Timezone: Af(),
4351
- IsTouchDevice: jf(),
4349
+ Theme: bf(),
4350
+ Timezone: jf(),
4351
+ IsTouchDevice: Mf(),
4352
4352
  InitialPath: Hd(),
4353
4353
  InitialUrl: Ud(),
4354
4354
  SupportsCompression: ke()
@@ -4397,20 +4397,20 @@ async function Qm(e, t) {
4397
4397
  let r = {
4398
4398
  ...Ld(),
4399
4399
  ...e.parameters
4400
- }, i = e.deviceId ?? Cm(), a = e.userId, o = e.token;
4400
+ }, i = e.deviceId ?? wm(), a = e.userId, o = e.token;
4401
4401
  if (!a) {
4402
- let n = await zm(e.spaceId, i, await Fd(e.authUrl), t);
4402
+ let n = await Bm(e.spaceId, i, await Fd(e.authUrl), t);
4403
4403
  n && (a = n.userId, o = n.token);
4404
4404
  }
4405
4405
  if (a || (a = i, W.debug("Using deviceId as userId fallback")), e.spaceId && o) if (e.token) {
4406
4406
  let n = Md(e.backendUrl);
4407
- await Hm(await fetch(`${n}/profiles/me?space=${encodeURIComponent(e.spaceId)}`, {
4407
+ await Um(await fetch(`${n}/profiles/me?space=${encodeURIComponent(e.spaceId)}`, {
4408
4408
  method: "GET",
4409
4409
  headers: { Authorization: `Bearer ${o}` },
4410
4410
  signal: t
4411
4411
  }));
4412
- } else await Bm(Md(e.backendUrl), e.spaceId, o, t);
4413
- let s = e.token ?? e.identityToken ?? o, c = s ? Em(s) : null, l = c?.authSession ?? (e.token ? "authenticated" : ""), u = c?.role ? c.role === "anonymous" : !e.token, d = Zm(Xm({
4412
+ } else await Vm(Md(e.backendUrl), e.spaceId, o, t);
4413
+ let s = e.token ?? e.identityToken ?? o, c = s ? Dm(s) : null, l = c?.authSession ?? (e.token ? "authenticated" : ""), u = c?.role ? c.role === "anonymous" : !e.token, d = Zm(Xm({
4414
4414
  ...e,
4415
4415
  parameters: r
4416
4416
  }, a, l, u)), f = await fetch(`${n}/connect-token`, {
@@ -4421,11 +4421,11 @@ async function Qm(e, t) {
4421
4421
  });
4422
4422
  if (!f.ok) {
4423
4423
  let e = await f.text().catch(() => "Unknown error");
4424
- throw Um("Failed to get connect token", f.status, e);
4424
+ throw Wm("Failed to get connect token", f.status, e);
4425
4425
  }
4426
4426
  let p = (await f.json()).token;
4427
4427
  if (!p) throw new w("Server did not return a token");
4428
- let m = `${n}/connect?token=${encodeURIComponent(p)}`, h = await qm(m, t);
4428
+ let m = `${n}/connect?token=${encodeURIComponent(p)}`, h = await K(m, t);
4429
4429
  return h.directUrl = m, h.backendUrl = Md(e.backendUrl), h.authToken = o, h;
4430
4430
  }
4431
4431
  async function $m(e, t, n = "auto", r = !1) {
@@ -4443,14 +4443,14 @@ async function $m(e, t, n = "auto", r = !1) {
4443
4443
  });
4444
4444
  if (!a.ok) {
4445
4445
  let e = await a.text().catch(() => "Unknown error");
4446
- throw Um("API key authentication failed", a.status, e);
4446
+ throw Wm("API key authentication failed", a.status, e);
4447
4447
  }
4448
4448
  let o = (await a.json()).token;
4449
4449
  if (!o) throw new w("Backend did not return a token");
4450
4450
  let s = Ld(), c = e.provisioningTimeoutMs ?? 6e4, l = {
4451
4451
  ...s,
4452
4452
  ...e.parameters
4453
- }, u = bf(), d = k() ? Pm : 1;
4453
+ }, u = xf(), d = k() ? Fm : 1;
4454
4454
  for (let a = 0; a < d; a++) try {
4455
4455
  let a = {
4456
4456
  space: e.spaceId,
@@ -4458,13 +4458,13 @@ async function $m(e, t, n = "auto", r = !1) {
4458
4458
  params: e.parameters,
4459
4459
  waitForRunning: !0,
4460
4460
  waitForRunningTimeoutMs: c,
4461
- connectTraceId: vm(),
4461
+ connectTraceId: ym(),
4462
4462
  contextType: m.Plugin,
4463
4463
  userType: e.userType ?? p.Human,
4464
- clientType: e.clientType ?? Mf(),
4464
+ clientType: e.clientType ?? Nf(),
4465
4465
  payloadType: me.Teleport,
4466
4466
  description: e.description ?? "Ikon SDK TypeScript",
4467
- deviceId: e.deviceId ?? Cm(),
4467
+ deviceId: e.deviceId ?? wm(),
4468
4468
  productId: e.productId ?? "",
4469
4469
  versionId: e.versionId ?? "",
4470
4470
  installId: e.installId ?? "",
@@ -4476,22 +4476,22 @@ async function $m(e, t, n = "auto", r = !1) {
4476
4476
  launchParams: l,
4477
4477
  viewportWidth: u.width,
4478
4478
  viewportHeight: u.height,
4479
- theme: yf(),
4480
- timezone: Af(),
4481
- isTouchDevice: jf(),
4479
+ theme: bf(),
4480
+ timezone: jf(),
4481
+ isTouchDevice: Mf(),
4482
4482
  initialPath: Hd(),
4483
4483
  initialUrl: Ud(),
4484
4484
  sdkType: 2,
4485
- sdkCapability: Rm,
4485
+ sdkCapability: zm,
4486
4486
  supportsCompression: ke(),
4487
4487
  isSnapshot: vu()
4488
- }, s = t ? _d([t, F(c)]) : F(c), d = await Gm(i, a, o, s);
4489
- if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw Km(d, c);
4488
+ }, s = t ? _d([t, F(c)]) : F(c), d = await Km(i, a, o, s);
4489
+ if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw qm(d, c);
4490
4490
  let f = await Ym(d.configuration.url, d.configuration.proxyUrl, n, r, s);
4491
- return f.backendUrl = i, f.authToken = o, f.brandingRequired = d.configuration.brandingRequired ?? !1, Ep(d.configuration.push), f;
4491
+ return f.backendUrl = i, f.authToken = o, f.brandingRequired = d.configuration.brandingRequired ?? !1, Dp(d.configuration.push), f;
4492
4492
  } catch (e) {
4493
4493
  if (e instanceof Pl || e instanceof Il || e instanceof Fl || e instanceof Ml || a === d - 1) throw e;
4494
- W.debug(`Init attempt ${a + 1}/${d} failed, retrying: ${e}`), await zl(Lm * (a + 1), t);
4494
+ W.debug(`Init attempt ${a + 1}/${d} failed, retrying: ${e}`), await zl(Rm * (a + 1), t);
4495
4495
  }
4496
4496
  throw new w("Failed to init after all attempts");
4497
4497
  }
@@ -4501,7 +4501,7 @@ async function eh(e, t, n = "auto", r = !1) {
4501
4501
  let o = Ld(), s = e.provisioningTimeoutMs ?? 6e4, c = {
4502
4502
  ...o,
4503
4503
  ...e.parameters
4504
- }, l = bf(), u = k() ? Pm : 1;
4504
+ }, l = xf(), u = k() ? Fm : 1;
4505
4505
  for (let o = 0; o < u; o++) try {
4506
4506
  let o = {
4507
4507
  space: e.spaceId,
@@ -4509,13 +4509,13 @@ async function eh(e, t, n = "auto", r = !1) {
4509
4509
  params: e.parameters,
4510
4510
  waitForRunning: !0,
4511
4511
  waitForRunningTimeoutMs: s,
4512
- connectTraceId: vm(),
4512
+ connectTraceId: ym(),
4513
4513
  contextType: m.Browser,
4514
4514
  userType: p.Human,
4515
- clientType: Mf(),
4515
+ clientType: Nf(),
4516
4516
  payloadType: me.Teleport,
4517
4517
  description: e.description ?? "Ikon SDK TypeScript",
4518
- deviceId: e.deviceId ?? Cm(),
4518
+ deviceId: e.deviceId ?? wm(),
4519
4519
  productId: e.productId ?? "",
4520
4520
  versionId: e.versionId ?? "",
4521
4521
  installId: e.installId ?? "",
@@ -4527,22 +4527,22 @@ async function eh(e, t, n = "auto", r = !1) {
4527
4527
  launchParams: c,
4528
4528
  viewportWidth: l.width,
4529
4529
  viewportHeight: l.height,
4530
- theme: yf(),
4531
- timezone: Af(),
4532
- isTouchDevice: jf(),
4530
+ theme: bf(),
4531
+ timezone: jf(),
4532
+ isTouchDevice: Mf(),
4533
4533
  initialPath: Hd(),
4534
4534
  initialUrl: Ud(),
4535
4535
  sdkType: 2,
4536
- sdkCapability: Rm,
4536
+ sdkCapability: zm,
4537
4537
  supportsCompression: ke(),
4538
4538
  isSnapshot: vu()
4539
- }, u = t ? _d([t, F(s)]) : F(s), d = await Gm(i, o, a, u);
4540
- if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw Km(d, s);
4539
+ }, u = t ? _d([t, F(s)]) : F(s), d = await Km(i, o, a, u);
4540
+ if (d.state?.toLowerCase() !== "running" || !d.configuration?.url) throw qm(d, s);
4541
4541
  let f = await Ym(d.configuration.url, d.configuration.proxyUrl, n, r, u);
4542
- return f.backendUrl = i, f.authToken = a, f.brandingRequired = d.configuration.brandingRequired ?? !1, Ep(d.configuration.push), f;
4542
+ return f.backendUrl = i, f.authToken = a, f.brandingRequired = d.configuration.brandingRequired ?? !1, Dp(d.configuration.push), f;
4543
4543
  } catch (e) {
4544
4544
  if (e instanceof Pl || e instanceof Il || e instanceof Fl || e instanceof Ml || o === u - 1) throw e;
4545
- W.debug(`Init attempt ${o + 1}/${u} failed, retrying: ${e}`), await zl(Lm * (o + 1), t);
4545
+ W.debug(`Init attempt ${o + 1}/${u} failed, retrying: ${e}`), await zl(Rm * (o + 1), t);
4546
4546
  }
4547
4547
  throw new w("Failed to init after all attempts");
4548
4548
  }
@@ -5201,7 +5201,7 @@ function Mh(e, t) {
5201
5201
  var Nh = {
5202
5202
  PlaySound: "ikon.client.playSound",
5203
5203
  StopSound: "ikon.client.stopSound"
5204
- }, Ph = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Map(), Fh = 1, Ih = "data:audio/wav;base64,UklGRjIAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQYAAAAAAAAAAAA=", Lh = 8, Rh = [], zh = !1, q = null;
5204
+ }, Ph = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), Fh = 1, Ih = "data:audio/wav;base64,UklGRjIAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQYAAAAAAAAAAAA=", Lh = 8, Rh = [], zh = !1, J = null;
5205
5205
  function Bh() {
5206
5206
  if (!(Rh.length > 0 || typeof Audio > "u")) for (let e = 0; e < Lh; e++) {
5207
5207
  let e = new Audio();
@@ -5222,12 +5222,12 @@ function Vh() {
5222
5222
  }
5223
5223
  }
5224
5224
  function Hh() {
5225
- if (q || typeof window > "u") return;
5225
+ if (J || typeof window > "u") return;
5226
5226
  let e = () => Vh();
5227
- 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 });
5227
+ J = 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 });
5228
5228
  }
5229
5229
  function Uh() {
5230
- !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);
5230
+ !J || typeof window > "u" || (window.removeEventListener("pointerdown", J, { capture: !0 }), window.removeEventListener("touchend", J, { capture: !0 }), window.removeEventListener("mousedown", J, { capture: !0 }), window.removeEventListener("keydown", J, { capture: !0 }), J = null);
5231
5231
  }
5232
5232
  function Wh() {
5233
5233
  Bh();
@@ -5287,9 +5287,9 @@ function Kh(e, t, n, r) {
5287
5287
  let t = Wh();
5288
5288
  t.src = i, t.currentTime = 0, t.loop = r === !0, t.volume = typeof n == "number" ? Math.max(0, Math.min(1, n)) : 1;
5289
5289
  let a = `sound-${Fh++}`, o = () => {
5290
- K.delete(a), t.removeEventListener("ended", o), t.removeEventListener("error", o);
5290
+ q.delete(a), t.removeEventListener("ended", o), t.removeEventListener("error", o);
5291
5291
  };
5292
- t.addEventListener("ended", o), t.addEventListener("error", o), K.set(a, t), t.play().then(() => e(a), () => {
5292
+ t.addEventListener("ended", o), t.addEventListener("error", o), q.set(a, t), t.play().then(() => e(a), () => {
5293
5293
  o(), e(null);
5294
5294
  });
5295
5295
  } catch {
@@ -5309,21 +5309,21 @@ var qh = {
5309
5309
  };
5310
5310
  function Jh(e) {
5311
5311
  if (typeof e != "string") return !1;
5312
- let t = K.get(e);
5312
+ let t = q.get(e);
5313
5313
  if (!t) return !1;
5314
5314
  try {
5315
- return t.pause(), t.currentTime = 0, K.delete(e), !0;
5315
+ return t.pause(), t.currentTime = 0, q.delete(e), !0;
5316
5316
  } catch {
5317
5317
  return !1;
5318
5318
  }
5319
5319
  }
5320
5320
  function Yh() {
5321
5321
  Ph.clear();
5322
- for (let [e, t] of K) {
5322
+ for (let [e, t] of q) {
5323
5323
  try {
5324
5324
  t.pause(), t.currentTime = 0;
5325
5325
  } catch {}
5326
- K.delete(e);
5326
+ q.delete(e);
5327
5327
  }
5328
5328
  Uh();
5329
5329
  }
@@ -5520,15 +5520,15 @@ var $h = S("VisemeTracker"), eg = _e * 2, tg = class e {
5520
5520
  }
5521
5521
  }
5522
5522
  }
5523
- }, ng = S("DebugMode"), J = !1;
5523
+ }, ng = S("DebugMode"), Y = !1;
5524
5524
  function rg() {
5525
- return J ? !0 : (J = su(), J && (be(x.DEBUG), ng.info("Debug mode enabled")), J);
5525
+ return Y ? !0 : (Y = su(), Y && (be(x.DEBUG), ng.info("Debug mode enabled")), Y);
5526
5526
  }
5527
5527
  function ig() {
5528
- return J;
5528
+ return Y;
5529
5529
  }
5530
5530
  function ag() {
5531
- J || (J = !0, be(x.DEBUG), ng.info("Debug mode enabled"), ru(Ul, "true"));
5531
+ Y || (Y = !0, be(x.DEBUG), ng.info("Debug mode enabled"), ru(Ul, "true"));
5532
5532
  }
5533
5533
  //#endregion
5534
5534
  //#region src/utils/inspect-mode.ts
@@ -5680,12 +5680,12 @@ function wg(e) {
5680
5680
  }
5681
5681
  //#endregion
5682
5682
  //#region src/client/endpoint-selector.ts
5683
- var Y = {
5683
+ var Tg = {
5684
5684
  [b.WebTransport]: 0,
5685
5685
  [b.WebSocket]: 1,
5686
5686
  [b.WebTransportProxy]: 2,
5687
5687
  [b.WebSocketProxy]: 3
5688
- }, Tg = /* @__PURE__ */ new Set([b.WebTransportProxy, b.WebSocketProxy]), Eg = /* @__PURE__ */ new Set([b.WebTransport, b.WebSocket]), Dg = /* @__PURE__ */ new Set([b.WebSocket, b.WebSocketProxy]), Og = /* @__PURE__ */ new Set([b.WebTransport, b.WebTransportProxy]), X = S("EndpointSelector"), kg = "ikon-endpoint-type", Ag = "ikon-proxy-preferred", jg = "ikon-endpoint-timestamp", Mg = "ikon-endpoint-revalidated", Ng = 864e5, Pg = class {
5688
+ }, Eg = /* @__PURE__ */ new Set([b.WebTransportProxy, b.WebSocketProxy]), Dg = /* @__PURE__ */ new Set([b.WebTransport, b.WebSocket]), Og = /* @__PURE__ */ new Set([b.WebSocket, b.WebSocketProxy]), kg = /* @__PURE__ */ new Set([b.WebTransport, b.WebTransportProxy]), X = S("EndpointSelector"), Ag = "ikon-endpoint-type", jg = "ikon-proxy-preferred", Mg = "ikon-endpoint-timestamp", Ng = "ikon-endpoint-revalidated", Pg = 864e5, Fg = class {
5689
5689
  isLocal;
5690
5690
  _proxyMode;
5691
5691
  _websocket;
@@ -5707,27 +5707,27 @@ var Y = {
5707
5707
  markProxyPreferred() {
5708
5708
  this._proxyPreferred = !0;
5709
5709
  try {
5710
- localStorage.setItem(Ag, "true"), localStorage.setItem(jg, String(Date.now()));
5710
+ localStorage.setItem(jg, "true"), localStorage.setItem(Mg, String(Date.now()));
5711
5711
  } catch {}
5712
5712
  X.debug("Marked proxy as preferred");
5713
5713
  }
5714
5714
  clearProxyPreference() {
5715
5715
  this._proxyPreferred = !1;
5716
5716
  try {
5717
- localStorage.removeItem(Ag);
5717
+ localStorage.removeItem(jg);
5718
5718
  } catch {}
5719
5719
  }
5720
5720
  getOrderedTypes(e) {
5721
5721
  let t = Array.from(e.keys());
5722
5722
  if (this.isLocal) return t;
5723
5723
  let n;
5724
- n = this._proxyMode === "force-proxy" ? t.filter((e) => Tg.has(e)) : this._proxyMode === "force-direct" ? t.filter((e) => Eg.has(e)) : t, n = this.filterByTransport(n);
5725
- let r = [...n].sort((e, t) => (Y[e] ?? 999) - (Y[t] ?? 999));
5724
+ n = this._proxyMode === "force-proxy" ? t.filter((e) => Eg.has(e)) : this._proxyMode === "force-direct" ? t.filter((e) => Dg.has(e)) : t, n = this.filterByTransport(n);
5725
+ let r = [...n].sort((e, t) => (Tg[e] ?? 999) - (Tg[t] ?? 999));
5726
5726
  if (this._proxyMode === "auto" && this._proxyPreferred) {
5727
- let e = r.filter((e) => Tg.has(e)), t = r.filter((e) => Eg.has(e));
5727
+ let e = r.filter((e) => Eg.has(e)), t = r.filter((e) => Dg.has(e));
5728
5728
  r.length = 0, r.push(...e, ...t);
5729
5729
  }
5730
- if (this.workingEndpointType !== null && e.has(this.workingEndpointType) && (!this._proxyPreferred || Tg.has(this.workingEndpointType))) {
5730
+ if (this.workingEndpointType !== null && e.has(this.workingEndpointType) && (!this._proxyPreferred || Eg.has(this.workingEndpointType))) {
5731
5731
  let e = r.indexOf(this.workingEndpointType);
5732
5732
  e > 0 && (r.splice(e, 1), r.unshift(this.workingEndpointType));
5733
5733
  }
@@ -5741,17 +5741,17 @@ var Y = {
5741
5741
  }
5742
5742
  this.workingEndpointType = e;
5743
5743
  try {
5744
- localStorage.setItem(kg, String(e)), localStorage.setItem(jg, String(Date.now())), localStorage.getItem(Mg) === null && localStorage.setItem(Mg, String(Date.now()));
5744
+ localStorage.setItem(Ag, String(e)), localStorage.setItem(Mg, String(Date.now())), localStorage.getItem(Ng) === null && localStorage.setItem(Ng, String(Date.now()));
5745
5745
  } catch {}
5746
- if (Tg.has(e)) {
5746
+ if (Eg.has(e)) {
5747
5747
  this._proxyPreferred = !0;
5748
5748
  try {
5749
- localStorage.setItem(Ag, "true");
5749
+ localStorage.setItem(jg, "true");
5750
5750
  } catch {}
5751
- } else if (Eg.has(e)) {
5751
+ } else if (Dg.has(e)) {
5752
5752
  this._proxyPreferred = !1;
5753
5753
  try {
5754
- localStorage.removeItem(Ag);
5754
+ localStorage.removeItem(jg);
5755
5755
  } catch {}
5756
5756
  }
5757
5757
  X.debug(`Remembered working type: ${b[e]}`);
@@ -5760,37 +5760,37 @@ var Y = {
5760
5760
  clearRememberedType() {
5761
5761
  this.workingEndpointType = null;
5762
5762
  try {
5763
- localStorage.removeItem(kg);
5763
+ localStorage.removeItem(Ag);
5764
5764
  } catch {}
5765
5765
  }
5766
5766
  needsRevalidation() {
5767
5767
  if (this.isLocal || this._proxyMode !== "auto" || this.workingEndpointType === null && !this._proxyPreferred) return !1;
5768
5768
  let e = this.revalidationAgeMs();
5769
- return e !== null && e > Ng;
5769
+ return e !== null && e > Pg;
5770
5770
  }
5771
5771
  getFasterTypes(e, t) {
5772
- let n = Y[e] ?? 999;
5773
- return this.filterByTransport(Array.from(t.keys())).filter((e) => (Y[e] ?? 999) < n).sort((e, t) => (Y[e] ?? 999) - (Y[t] ?? 999));
5772
+ let n = Tg[e] ?? 999;
5773
+ return this.filterByTransport(Array.from(t.keys())).filter((e) => (Tg[e] ?? 999) < n).sort((e, t) => (Tg[e] ?? 999) - (Tg[t] ?? 999));
5774
5774
  }
5775
5775
  recordFasterTypeReachable(e) {
5776
5776
  X.debug(`Faster endpoint type ${b[e]} is reachable again, dropping learned preference`), this.clearRememberedType(), this.clearProxyPreference();
5777
5777
  try {
5778
- localStorage.removeItem(jg), localStorage.removeItem(Mg);
5778
+ localStorage.removeItem(Mg), localStorage.removeItem(Ng);
5779
5779
  } catch {}
5780
5780
  }
5781
5781
  recordFasterTypesUnreachable() {
5782
5782
  try {
5783
- localStorage.setItem(Mg, String(Date.now()));
5783
+ localStorage.setItem(Ng, String(Date.now()));
5784
5784
  } catch {}
5785
5785
  X.debug("Faster endpoint types still unreachable, keeping the learned preference");
5786
5786
  }
5787
5787
  filterByTransport(e) {
5788
5788
  let t = this._websocket, n = this._webtransport;
5789
- return t === void 0 && n === void 0 || t === !0 && n === !0 ? e : e.filter((e) => t === !0 && n === void 0 ? Dg.has(e) : n === !0 && t === void 0 ? Og.has(e) : t === !1 ? !Dg.has(e) : n !== !1 || !Og.has(e));
5789
+ return t === void 0 && n === void 0 || t === !0 && n === !0 ? e : e.filter((e) => t === !0 && n === void 0 ? Og.has(e) : n === !0 && t === void 0 ? kg.has(e) : t === !1 ? !Og.has(e) : n !== !1 || !kg.has(e));
5790
5790
  }
5791
5791
  revalidationAgeMs() {
5792
5792
  try {
5793
- let e = localStorage.getItem(Mg);
5793
+ let e = localStorage.getItem(Ng);
5794
5794
  if (e === null) return null;
5795
5795
  let t = Date.now() - Number(e);
5796
5796
  return Number.isFinite(t) ? t : null;
@@ -5800,12 +5800,12 @@ var Y = {
5800
5800
  }
5801
5801
  loadRememberedType() {
5802
5802
  try {
5803
- let e = localStorage.getItem(kg);
5803
+ let e = localStorage.getItem(Ag);
5804
5804
  if (e !== null) {
5805
5805
  let t = Number(e);
5806
5806
  if (b[t] !== void 0) {
5807
5807
  this.workingEndpointType = t;
5808
- let e = localStorage.getItem(jg), n = e ? Math.round((Date.now() - Number(e)) / 36e5) : "?";
5808
+ let e = localStorage.getItem(Mg), n = e ? Math.round((Date.now() - Number(e)) / 36e5) : "?";
5809
5809
  X.debug(`Loaded remembered type: ${b[t]} (age: ${n}h)`);
5810
5810
  }
5811
5811
  }
@@ -5813,14 +5813,14 @@ var Y = {
5813
5813
  }
5814
5814
  loadProxyPreference() {
5815
5815
  try {
5816
- this._proxyPreferred = localStorage.getItem(Ag) === "true", this._proxyPreferred && X.debug("Loaded proxy preference: preferred");
5816
+ this._proxyPreferred = localStorage.getItem(jg) === "true", this._proxyPreferred && X.debug("Loaded proxy preference: preferred");
5817
5817
  } catch {}
5818
5818
  }
5819
- }, Z = S("IkonClient"), Fg = [1e4, 3e4];
5820
- function Ig() {
5819
+ }, Z = S("IkonClient"), Ig = [1e4, 3e4];
5820
+ function Lg() {
5821
5821
  return typeof __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__ < "u" && __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__;
5822
5822
  }
5823
- var Lg = class {
5823
+ var Rg = class {
5824
5824
  channelManager = null;
5825
5825
  protocolWorker = null;
5826
5826
  preloadedWorker = null;
@@ -5900,7 +5900,7 @@ var Lg = class {
5900
5900
  _reconnectTimer = null;
5901
5901
  _serverStopped = !1;
5902
5902
  _hasBeenConnected = !1;
5903
- _waitForExternalConnectUrl = Ig();
5903
+ _waitForExternalConnectUrl = Lg();
5904
5904
  _externalConnectUrlCleanup = null;
5905
5905
  get media() {
5906
5906
  return this._media;
@@ -5917,7 +5917,7 @@ var Lg = class {
5917
5917
  return this._mediaCapture;
5918
5918
  }
5919
5919
  async ensureMediaCapture() {
5920
- return this._mediaCapture ? this._mediaCapture : R() ? (this._mediaCapturePromise ||= Promise.resolve().then(() => __).then(({ IkonMediaCapture: e }) => (this._mediaCapture = new e(this, this._mediaCaptureConfig), this._mediaCapture)), this._mediaCapturePromise) : null;
5920
+ return this._mediaCapture ? this._mediaCapture : R() ? (this._mediaCapturePromise ||= Promise.resolve().then(() => v_).then(({ IkonMediaCapture: e }) => (this._mediaCapture = new e(this, this._mediaCaptureConfig), this._mediaCapture)), this._mediaCapturePromise) : null;
5921
5921
  }
5922
5922
  async ensureMedia() {
5923
5923
  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);
@@ -5963,14 +5963,14 @@ var Lg = class {
5963
5963
  ].filter(Boolean).length;
5964
5964
  if (t === 0) throw Error("IkonClient requires one of: \"local\", \"apiKey\", or \"sessionToken\" configuration");
5965
5965
  if (t > 1) throw Error("IkonClient accepts only one of: \"local\", \"apiKey\", or \"sessionToken\" configuration");
5966
- rg(), R() && xf();
5966
+ rg(), R() && Sf();
5967
5967
  let n = e.local ? null : iu() ?? e.proxy ?? null, r = n === !0 ? "force-proxy" : n === !1 ? "force-direct" : "auto", i = e.local ? null : au(), a = e.local ? null : ou(), o = i ?? e.websocket, s = a ?? e.webtransport ?? !1;
5968
- this.endpointSelector = new Pg({
5968
+ this.endpointSelector = new Fg({
5969
5969
  local: e.local,
5970
5970
  proxyMode: r,
5971
5971
  websocket: o,
5972
5972
  webtransport: s
5973
- }), 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 ph(), this._reactiveRegistry = new vh(this._functionRegistry), R() && !e.disableBrowserFunctions && (this.unregisterBrowserFunctions = jp(this._functionRegistry), this.unregisterSoundFunctions = Zh(this._functionRegistry)), R() && (this.unregisterLoginInterceptor = this._functionRegistry.addErrorInterceptor(Sh));
5973
+ }), 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 ph(), this._reactiveRegistry = new vh(this._functionRegistry), R() && !e.disableBrowserFunctions && (this.unregisterBrowserFunctions = Mp(this._functionRegistry), this.unregisterSoundFunctions = Zh(this._functionRegistry)), R() && (this.unregisterLoginInterceptor = this._functionRegistry.addErrorInterceptor(Sh));
5974
5974
  let c = uu(), l = du();
5975
5975
  this._audioEnabled = c ?? e.audio?.enabled ?? !0, this._videoEnabled = l ?? e.video?.enabled ?? !0;
5976
5976
  let u = e.audio ? {
@@ -6043,7 +6043,7 @@ var Lg = class {
6043
6043
  this.setupLifecycleHandlers();
6044
6044
  let t = lu();
6045
6045
  if (t) {
6046
- Z.info("Found external connect URL in query parameter"), await this.executeConnection(() => qm(t, this.abortController.signal));
6046
+ Z.info("Found external connect URL in query parameter"), await this.executeConnection(() => K(t, this.abortController.signal));
6047
6047
  return;
6048
6048
  }
6049
6049
  if (this._waitForExternalConnectUrl) {
@@ -6061,7 +6061,7 @@ var Lg = class {
6061
6061
  }, this.connectionTimeoutMs);
6062
6062
  try {
6063
6063
  let t = await e();
6064
- 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 && um(t.backendUrl, t.authToken), t.usedProxyUrl && t.directUrl && this.endpointSelector.proxyMode === "auto") {
6064
+ 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 && dm(t.backendUrl, t.authToken), t.usedProxyUrl && t.directUrl && this.endpointSelector.proxyMode === "auto") {
6065
6065
  Z.debug("Auth fell back to proxy, marking proxy preferred");
6066
6066
  let e = t.directUrl;
6067
6067
  Jm(e).then((e) => {
@@ -6075,7 +6075,7 @@ var Lg = class {
6075
6075
  }
6076
6076
  }
6077
6077
  disconnect() {
6078
- Z.info("Disconnecting from Ikon server"), this.sendDisconnectSignal(), fm(), 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;
6078
+ Z.info("Disconnecting from Ikon server"), this.sendDisconnectSignal(), pm(), 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;
6079
6079
  for (let e of this._webRtcAudioElements.values()) e.pause(), e.srcObject = null, e.remove();
6080
6080
  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");
6081
6081
  }
@@ -6487,7 +6487,7 @@ var Lg = class {
6487
6487
  return;
6488
6488
  }
6489
6489
  if (o?.type === "refreshEntrypoints") {
6490
- this._connectUrl ? qm(this._connectUrl, this.abortController?.signal).then((e) => {
6490
+ this._connectUrl ? K(this._connectUrl, this.abortController?.signal).then((e) => {
6491
6491
  this.authResponse = e.authResponse, this._sessionId = e.authResponse.ClientContext.SessionId, n.postMessage({
6492
6492
  type: "refreshedEntrypoints",
6493
6493
  entrypoints: e.authResponse.Entrypoints,
@@ -6630,9 +6630,9 @@ var Lg = class {
6630
6630
  this._webRtcRetryTimer &&= (clearTimeout(this._webRtcRetryTimer), null);
6631
6631
  }
6632
6632
  scheduleWebRtcRetry() {
6633
- if (this._webRtcRetryTimer || this._webRtcRetryCount >= Fg.length) return;
6634
- let e = Fg[this._webRtcRetryCount++];
6635
- Z.info(`Retrying WebRTC in ${Math.round(e / 1e3)}s (attempt ${this._webRtcRetryCount}/${Fg.length})`), this._webRtcRetryTimer = setTimeout(() => {
6633
+ if (this._webRtcRetryTimer || this._webRtcRetryCount >= Ig.length) return;
6634
+ let e = Ig[this._webRtcRetryCount++];
6635
+ Z.info(`Retrying WebRTC in ${Math.round(e / 1e3)}s (attempt ${this._webRtcRetryCount}/${Ig.length})`), this._webRtcRetryTimer = setTimeout(() => {
6636
6636
  this._webRtcRetryTimer = null, !(this.currentState !== "connected" || this._webRtcSignaling || !this.isWebRtcEnabled) && this.setupWebRtcSignaling();
6637
6637
  }, e);
6638
6638
  }
@@ -6782,7 +6782,7 @@ var Lg = class {
6782
6782
  this.config.onError?.(e);
6783
6783
  },
6784
6784
  onRefreshEntrypoints: this._connectUrl ? async () => {
6785
- let e = await qm(this._connectUrl, this.abortController?.signal);
6785
+ let e = await K(this._connectUrl, this.abortController?.signal);
6786
6786
  return this.authResponse = e.authResponse, this._sessionId = e.authResponse.ClientContext.SessionId, {
6787
6787
  entrypoints: e.authResponse.Entrypoints,
6788
6788
  sessionId: this._sessionId
@@ -6974,7 +6974,7 @@ var Lg = class {
6974
6974
  } catch {
6975
6975
  return null;
6976
6976
  }
6977
- return n.origin !== window.location.origin || n.protocol !== "http:" && n.protocol !== "https:" || n.hash && n.pathname === window.location.pathname && n.search === window.location.search || pf(n.pathname) ? null : n;
6977
+ return n.origin !== window.location.origin || n.protocol !== "http:" && n.protocol !== "https:" || n.hash && n.pathname === window.location.pathname && n.search === window.location.search || mf(n.pathname) ? null : n;
6978
6978
  }
6979
6979
  sendDisconnectSignal() {
6980
6980
  if (this._sessionId !== void 0 && this.currentState === "connected") try {
@@ -7050,7 +7050,7 @@ var Lg = class {
7050
7050
  });
7051
7051
  }, 150);
7052
7052
  }), window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
7053
- this.sendUpdateClientContext({ theme: yf() });
7053
+ this.sendUpdateClientContext({ theme: bf() });
7054
7054
  });
7055
7055
  }
7056
7056
  setupExternalConnectUrlListener() {
@@ -7076,12 +7076,12 @@ var Lg = class {
7076
7076
  if (this.currentState !== "waitingForExternalConnectUrl") throw Error(`Cannot connect with external connect URL: already in state ${this.currentState}`);
7077
7077
  Z.info("Connecting with external connect URL");
7078
7078
  try {
7079
- await this.executeConnection(() => qm(e, this.abortController.signal));
7079
+ await this.executeConnection(() => K(e, this.abortController.signal));
7080
7080
  } finally {
7081
7081
  this._externalConnectUrlCleanup &&= (this._externalConnectUrlCleanup(), null);
7082
7082
  }
7083
7083
  }
7084
- }, Rg = class {
7084
+ }, zg = class {
7085
7085
  client;
7086
7086
  constructor(e) {
7087
7087
  this.client = e;
@@ -7099,45 +7099,45 @@ var Lg = class {
7099
7099
  }, { close: () => n.close() }) : { close: () => {} };
7100
7100
  }
7101
7101
  };
7102
- function zg(e) {
7103
- return new Rg(e);
7102
+ function Bg(e) {
7103
+ return new zg(e);
7104
7104
  }
7105
7105
  //#endregion
7106
7106
  //#region src/client/connection-state.ts
7107
- function Bg(e) {
7107
+ function Vg(e) {
7108
7108
  return e === "waitingForExternalConnectUrl" || e === "connecting" || e === "connectingSlow" || e === "reconnecting";
7109
7109
  }
7110
- function Vg(e) {
7110
+ function Hg(e) {
7111
7111
  return e === "connected";
7112
7112
  }
7113
- function Hg(e) {
7113
+ function Ug(e) {
7114
7114
  return e === "offline" || e === "offlineError";
7115
7115
  }
7116
- function Ug(e) {
7116
+ function Wg(e) {
7117
7117
  return e === "offlineError";
7118
7118
  }
7119
7119
  //#endregion
7120
7120
  //#region src/utils/opcode-names.ts
7121
- var Wg = /* @__PURE__ */ new Map();
7122
- for (let [e, t] of Object.entries(C)) typeof t == "number" && Wg.set(t, e);
7123
- function Gg(e) {
7124
- return Wg.get(e) ?? `UNKNOWN_${e}`;
7121
+ var Gg = /* @__PURE__ */ new Map();
7122
+ for (let [e, t] of Object.entries(C)) typeof t == "number" && Gg.set(t, e);
7123
+ function Kg(e) {
7124
+ return Gg.get(e) ?? `UNKNOWN_${e}`;
7125
7125
  }
7126
7126
  //#endregion
7127
7127
  //#region src/login/reprovision.ts
7128
- var Kg = "ikon-login-app-route";
7129
- function qg(e) {
7128
+ var qg = "ikon-login-app-route";
7129
+ function Jg(e) {
7130
7130
  if (typeof window > "u") return;
7131
7131
  try {
7132
- sessionStorage.setItem(Kg, window.location.pathname);
7132
+ sessionStorage.setItem(qg, window.location.pathname);
7133
7133
  } catch {}
7134
7134
  let t = new URL(window.location.href);
7135
7135
  t.searchParams.set(Gl, e), window.location.href = t.toString();
7136
7136
  }
7137
- function Jg() {
7137
+ function Yg() {
7138
7138
  let e = null;
7139
7139
  try {
7140
- e = sessionStorage.getItem(Kg), sessionStorage.removeItem(Kg);
7140
+ e = sessionStorage.getItem(qg), sessionStorage.removeItem(qg);
7141
7141
  } catch {}
7142
7142
  return {
7143
7143
  appRoute: e,
@@ -7146,7 +7146,7 @@ function Jg() {
7146
7146
  }
7147
7147
  //#endregion
7148
7148
  //#region src/media/ring-buffer.ts
7149
- var Yg = class {
7149
+ var Xg = class {
7150
7150
  static getStorageForCapacity(e, t) {
7151
7151
  let n = Int32Array.BYTES_PER_ELEMENT * 2, r = t.BYTES_PER_ELEMENT * e;
7152
7152
  return new SharedArrayBuffer(n + r);
@@ -7197,7 +7197,7 @@ var Yg = class {
7197
7197
  };
7198
7198
  //#endregion
7199
7199
  //#region src/worker/audio-capture-worker.ts?worker
7200
- function Xg(e) {
7200
+ function Zg(e) {
7201
7201
  return new Worker("" + new URL("assets/audio-capture-worker-CJ5S-nQt.js", import.meta.url).href, {
7202
7202
  type: "module",
7203
7203
  name: e?.name
@@ -7205,11 +7205,11 @@ function Xg(e) {
7205
7205
  }
7206
7206
  //#endregion
7207
7207
  //#region src/media/ikon-audio-capture.ts
7208
- var Q = S("IkonAudioCapture"), Zg = 3, Qg = 200, $g = 2e3, e_ = 5e3, t_ = 3e3;
7209
- function n_(e) {
7208
+ var Q = S("IkonAudioCapture"), Qg = 3, $g = 200, e_ = 2e3, t_ = 5e3, n_ = 3e3;
7209
+ function r_(e) {
7210
7210
  return new Promise((t) => setTimeout(t, e));
7211
7211
  }
7212
- function r_(e) {
7212
+ function i_(e) {
7213
7213
  switch (e.name) {
7214
7214
  case "NotReadableError": return {
7215
7215
  action: "retry",
@@ -7245,14 +7245,14 @@ function r_(e) {
7245
7245
  };
7246
7246
  }
7247
7247
  }
7248
- function i_() {
7248
+ function a_() {
7249
7249
  let e = globalThis.crypto;
7250
7250
  return e?.randomUUID ? e.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
7251
7251
  }
7252
- function a_() {
7252
+ function o_() {
7253
7253
  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";
7254
7254
  }
7255
- var o_ = class e {
7255
+ var s_ = class e {
7256
7256
  client;
7257
7257
  static RESUME_TIMEOUT_MS = 3e3;
7258
7258
  worker = null;
@@ -7313,7 +7313,7 @@ var o_ = class e {
7313
7313
  notifyError(e, t, n, r) {
7314
7314
  if (e.stopped) return;
7315
7315
  let i = Date.now(), a = t.name;
7316
- if (e.lastErrorReason === n && e.lastErrorName === a && i - e.lastErrorTime < e_) return;
7316
+ if (e.lastErrorReason === n && e.lastErrorName === a && i - e.lastErrorTime < t_) return;
7317
7317
  e.lastErrorTime = i, e.lastErrorReason = n, e.lastErrorName = a;
7318
7318
  let o = this.config.autoRestartPolicy;
7319
7319
  if (o?.enabled && r) {
@@ -7371,7 +7371,7 @@ var o_ = class e {
7371
7371
  if (e.ctx.state === "running") return !0;
7372
7372
  if (e.ctx.state !== "suspended") return !1;
7373
7373
  let r = Date.now();
7374
- if (!n && r - e.lastResumeAttemptTime < t_) return Q.debug(`Resume attempt from ${t} skipped (cooldown)`), !1;
7374
+ if (!n && r - e.lastResumeAttemptTime < n_) return Q.debug(`Resume attempt from ${t} skipped (cooldown)`), !1;
7375
7375
  e.lastResumeAttemptTime = r, this.emitDiagnostic({
7376
7376
  event: "resume-attempt",
7377
7377
  captureId: e.captureId,
@@ -7407,7 +7407,7 @@ var o_ = class e {
7407
7407
  attemptResume(e, t, n = !1) {
7408
7408
  if (e.stopped || e.ctx.state !== "suspended") return;
7409
7409
  let r = Date.now();
7410
- if (!n && r - e.lastResumeAttemptTime < t_) {
7410
+ if (!n && r - e.lastResumeAttemptTime < n_) {
7411
7411
  Q.debug(`Resume attempt from ${t} skipped (cooldown)`);
7412
7412
  return;
7413
7413
  }
@@ -7506,7 +7506,7 @@ var o_ = class e {
7506
7506
  }
7507
7507
  ensureWorker() {
7508
7508
  if (this.worker) return this.worker;
7509
- let e = new Xg();
7509
+ let e = new Zg();
7510
7510
  return this.worker = e, e.addEventListener("message", (e) => {
7511
7511
  let t = e.data;
7512
7512
  if (t?.type === "error") {
@@ -7604,25 +7604,25 @@ var o_ = class e {
7604
7604
  reason: "unknown",
7605
7605
  canRetry: !1
7606
7606
  };
7607
- for (let r = 0; r < Zg; r++) try {
7607
+ for (let r = 0; r < Qg; r++) try {
7608
7608
  return {
7609
7609
  stream: await navigator.mediaDevices.getUserMedia({ audio: e }),
7610
7610
  error: t,
7611
7611
  errorInfo: n
7612
7612
  };
7613
7613
  } catch (e) {
7614
- if (t = e instanceof Error ? e : Error(String(e)), n = r_(t), Q.debug(`getUserMedia attempt ${r + 1}/${Zg} failed: ${t.name} (action: ${n.action})`), this.emitDiagnostic({
7614
+ if (t = e instanceof Error ? e : Error(String(e)), n = i_(t), Q.debug(`getUserMedia attempt ${r + 1}/${Qg} failed: ${t.name} (action: ${n.action})`), this.emitDiagnostic({
7615
7615
  event: "retry",
7616
7616
  details: {
7617
7617
  attempt: r + 1,
7618
- maxAttempts: Zg,
7618
+ maxAttempts: Qg,
7619
7619
  errorName: t.name,
7620
7620
  action: n.action
7621
7621
  }
7622
7622
  }), n.action !== "retry") break;
7623
7623
  if (r < 2) {
7624
- let e = Qg * (r + 1);
7625
- Q.debug(`Retrying getUserMedia in ${e}ms`), await n_(e);
7624
+ let e = $g * (r + 1);
7625
+ Q.debug(`Retrying getUserMedia in ${e}ms`), await r_(e);
7626
7626
  }
7627
7627
  }
7628
7628
  return {
@@ -7633,7 +7633,7 @@ var o_ = class e {
7633
7633
  }
7634
7634
  async ensureWorklet(e) {
7635
7635
  if (!Ee(e)) throw Error("AudioWorklet is not supported in this browser");
7636
- if (this.workletModuleUrl ||= URL.createObjectURL(new Blob([a_()], { type: "text/javascript" })), this.workletReady && this.workletContext === e) try {
7636
+ if (this.workletModuleUrl ||= URL.createObjectURL(new Blob([o_()], { type: "text/javascript" })), this.workletReady && this.workletContext === e) try {
7637
7637
  await this.workletReady;
7638
7638
  return;
7639
7639
  } catch {
@@ -7660,7 +7660,7 @@ var o_ = class e {
7660
7660
  if (!t) throw Error("Cannot start audio capture before client is connected");
7661
7661
  if (this.client.isWebRtcCaptureAvailable) return this.startMicWebRtc(e);
7662
7662
  this.client.isWebRtcEnabled && Q.warn("WebRTC unavailable, capturing audio via protocol channel");
7663
- let n = i_(), r = {
7663
+ let n = a_(), r = {
7664
7664
  captureId: n,
7665
7665
  aborted: !1,
7666
7666
  stream: null,
@@ -7698,7 +7698,7 @@ var o_ = class e {
7698
7698
  let f = Ce() ? "sab" : "pcm", p;
7699
7699
  if (f === "sab") {
7700
7700
  let e = Math.floor(a.sampleRate * 10);
7701
- p = Yg.getStorageForCapacity(e, Float32Array);
7701
+ p = Xg.getStorageForCapacity(e, Float32Array);
7702
7702
  }
7703
7703
  let m = this.ensureWorker(), h = e.onStopped;
7704
7704
  m.postMessage({
@@ -7846,7 +7846,7 @@ var o_ = class e {
7846
7846
  };
7847
7847
  this.setupAudioContextStateListener(a, _), this.setupVisibilityChangeListener(_), this.setupBFCacheHandlers(_), _.healthCheckTimer = setInterval(() => {
7848
7848
  this.performHealthCheck(_);
7849
- }, $g);
7849
+ }, e_);
7850
7850
  let te = () => {
7851
7851
  _.stopped || (Q.warn(`Microphone track ended unexpectedly, captureId=${n.substring(0, 8)}`), this.handleRecoverableError(_, /* @__PURE__ */ Error("Microphone track ended unexpectedly"), "track-ended"));
7852
7852
  };
@@ -7995,8 +7995,8 @@ var o_ = class e {
7995
7995
  let t = this.captures.get(e);
7996
7996
  return !t || t.stopped ? !1 : this.attemptResumeAsync(t, "userGesture", !0);
7997
7997
  }
7998
- }, s_ = 3e3;
7999
- function c_(e, t, n, r) {
7998
+ }, c_ = 3e3;
7999
+ function l_(e, t, n, r) {
8000
8000
  if (!n && !r) return {
8001
8001
  width: e,
8002
8002
  height: t
@@ -8007,7 +8007,7 @@ function c_(e, t, n, r) {
8007
8007
  height: Math.max(1, Math.floor(t * o))
8008
8008
  };
8009
8009
  }
8010
- async function l_(e, t) {
8010
+ async function u_(e, t) {
8011
8011
  let n = t.mime ?? "image/jpeg", r = t.quality ?? .92;
8012
8012
  if (typeof OffscreenCanvas < "u" && e instanceof OffscreenCanvas) try {
8013
8013
  return await e.convertToBlob({
@@ -8022,7 +8022,7 @@ async function l_(e, t) {
8022
8022
  }, n, r);
8023
8023
  });
8024
8024
  }
8025
- var u_ = class {
8025
+ var d_ = class {
8026
8026
  async captureFromStream(e, t = {}) {
8027
8027
  let n = e.getVideoTracks()[0];
8028
8028
  if (!n) throw Error("No video track available in the provided stream");
@@ -8033,7 +8033,7 @@ var u_ = class {
8033
8033
  } catch {}
8034
8034
  try {
8035
8035
  await new Promise((e, t) => {
8036
- let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), s_);
8036
+ let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), c_);
8037
8037
  r.addEventListener("loadedmetadata", () => {
8038
8038
  clearTimeout(n), e();
8039
8039
  }, { once: !0 }), r.addEventListener("error", () => {
@@ -8043,7 +8043,7 @@ var u_ = class {
8043
8043
  try {
8044
8044
  await r.play();
8045
8045
  } catch {}
8046
- let { width: e, height: i } = c_(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), t.width, t.height), a;
8046
+ let { width: e, height: i } = l_(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), t.width, t.height), a;
8047
8047
  if (typeof OffscreenCanvas < "u") a = new OffscreenCanvas(e, i);
8048
8048
  else {
8049
8049
  let t = document.createElement("canvas");
@@ -8052,7 +8052,7 @@ var u_ = class {
8052
8052
  let o = a.getContext("2d", { alpha: !1 });
8053
8053
  if (!o) throw Error("2D canvas context unavailable");
8054
8054
  o.drawImage(r, 0, 0, e, i);
8055
- let s = await l_(a, t), c = await s.arrayBuffer();
8055
+ let s = await u_(a, t), c = await s.arrayBuffer();
8056
8056
  return {
8057
8057
  mime: s.type || t.mime || "image/jpeg",
8058
8058
  width: e,
@@ -8093,7 +8093,7 @@ var u_ = class {
8093
8093
  } catch {}
8094
8094
  try {
8095
8095
  await new Promise((e, t) => {
8096
- let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), s_);
8096
+ let n = setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for video metadata")), c_);
8097
8097
  r.addEventListener("loadedmetadata", () => {
8098
8098
  clearTimeout(n), e();
8099
8099
  }, { once: !0 }), r.addEventListener("error", () => {
@@ -8103,7 +8103,7 @@ var u_ = class {
8103
8103
  try {
8104
8104
  await r.play();
8105
8105
  } catch {}
8106
- let { width: t, height: i } = c_(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), e.width, e.height), a;
8106
+ let { width: t, height: i } = l_(r.videoWidth || (n.getSettings().width ?? 1280), r.videoHeight || (n.getSettings().height ?? 720), e.width, e.height), a;
8107
8107
  if (typeof OffscreenCanvas < "u") a = new OffscreenCanvas(t, i);
8108
8108
  else {
8109
8109
  let e = document.createElement("canvas");
@@ -8112,7 +8112,7 @@ var u_ = class {
8112
8112
  let o = a.getContext("2d", { alpha: !1 });
8113
8113
  if (!o) throw Error("2D canvas context unavailable");
8114
8114
  o.drawImage(r, 0, 0, t, i);
8115
- let s = await l_(a, e), c = await s.arrayBuffer();
8115
+ let s = await u_(a, e), c = await s.arrayBuffer();
8116
8116
  return {
8117
8117
  mime: s.type || e.mime || "image/jpeg",
8118
8118
  width: t,
@@ -8136,11 +8136,11 @@ var u_ = class {
8136
8136
  }
8137
8137
  async captureFromNativeCamera(e = {}) {
8138
8138
  if (typeof document > "u") throw Error("Native camera capture requires a DOM environment");
8139
- let t = await d_(e.facing);
8140
- return t ? await f_(t, e) : null;
8139
+ let t = await f_(e.facing);
8140
+ return t ? await p_(t, e) : null;
8141
8141
  }
8142
8142
  };
8143
- function d_(e) {
8143
+ function f_(e) {
8144
8144
  return new Promise((t) => {
8145
8145
  let n = document.createElement("input");
8146
8146
  n.type = "file", n.accept = "image/*", n.setAttribute("capture", e ?? "environment"), n.style.position = "fixed", n.style.left = "-99999px", n.style.top = "0";
@@ -8166,7 +8166,7 @@ function d_(e) {
8166
8166
  n.click();
8167
8167
  });
8168
8168
  }
8169
- async function f_(e, t) {
8169
+ async function p_(e, t) {
8170
8170
  let n = URL.createObjectURL(e), r;
8171
8171
  try {
8172
8172
  r = await new Promise((e, t) => {
@@ -8176,7 +8176,7 @@ async function f_(e, t) {
8176
8176
  } finally {
8177
8177
  URL.revokeObjectURL(n);
8178
8178
  }
8179
- let i = r.naturalWidth || r.width, a = r.naturalHeight || r.height, { width: o, height: s } = c_(i, a, t.width, t.height), c = t.mime ?? (e.type === "image/png" ? "image/png" : "image/jpeg"), l = t.quality ?? .92;
8179
+ let i = r.naturalWidth || r.width, a = r.naturalHeight || r.height, { width: o, height: s } = l_(i, a, t.width, t.height), c = t.mime ?? (e.type === "image/png" ? "image/png" : "image/jpeg"), l = t.quality ?? .92;
8180
8180
  if (o === i && s === a && e.type === c) {
8181
8181
  let t = await e.arrayBuffer();
8182
8182
  return {
@@ -8203,7 +8203,7 @@ async function f_(e, t) {
8203
8203
  }
8204
8204
  //#endregion
8205
8205
  //#region src/worker/video-capture-worker.ts?worker
8206
- function p_(e) {
8206
+ function m_(e) {
8207
8207
  return new Worker("" + new URL("assets/video-capture-worker-D5jsT6I4.js", import.meta.url).href, {
8208
8208
  type: "module",
8209
8209
  name: e?.name
@@ -8212,16 +8212,16 @@ function p_(e) {
8212
8212
  //#endregion
8213
8213
  //#region src/media/ikon-video-capture.ts
8214
8214
  var $ = S("IkonVideoCapture");
8215
- function m_() {
8215
+ function h_() {
8216
8216
  let e = globalThis.crypto;
8217
8217
  return e?.randomUUID ? e.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
8218
8218
  }
8219
- function h_() {
8219
+ function g_() {
8220
8220
  let e = globalThis.MediaStreamTrackProcessor;
8221
8221
  if (!e) throw Error("MediaStreamTrackProcessor is not available in this browser");
8222
8222
  return e;
8223
8223
  }
8224
- var g_ = class {
8224
+ var __ = class {
8225
8225
  client;
8226
8226
  worker = null;
8227
8227
  protocolPort = null;
@@ -8237,7 +8237,7 @@ var g_ = class {
8237
8237
  }
8238
8238
  ensureWorker() {
8239
8239
  if (this.worker) return this.worker;
8240
- let e = new p_();
8240
+ let e = new m_();
8241
8241
  return this.worker = e, e.addEventListener("message", (e) => {
8242
8242
  let t = e.data;
8243
8243
  if (t?.type === "error") {
@@ -8347,10 +8347,10 @@ var g_ = class {
8347
8347
  if (this.client.isWebRtcCaptureAvailable && e.sourceType === "camera") return this.startCameraWebRtc(e);
8348
8348
  if (this.client.isWebRtcCaptureAvailable && e.sourceType === "screen") return this.startScreenWebRtc(e);
8349
8349
  this.client.isWebRtcEnabled && $.warn("WebRTC unavailable, capturing video via protocol channel"), this.ensurePorts();
8350
- let n = m_(), r = await this.getMediaStream(e), i = r.getVideoTracks()[0];
8350
+ let n = h_(), r = await this.getMediaStream(e), i = r.getVideoTracks()[0];
8351
8351
  if (!i) throw r.getTracks().forEach((e) => e.stop()), Error("No video track available");
8352
8352
  e.sourceType === "screen" && await new Promise((e) => setTimeout(e, 200));
8353
- 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 (h_())({ track: i }).readable, l = this.allocateTrackId(), u = this.ensureWorker(), d = e.sourceType, f = e.onStopped;
8353
+ 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 (g_())({ track: i }).readable, l = this.allocateTrackId(), u = this.ensureWorker(), d = e.sourceType, f = e.onStopped;
8354
8354
  u.postMessage({
8355
8355
  type: "start",
8356
8356
  captureId: n,
@@ -8473,16 +8473,16 @@ var g_ = class {
8473
8473
  }
8474
8474
  this.protocolPort?.close(), this.protocolPort = null, this.sendPort?.close(), this.sendPort = null;
8475
8475
  }
8476
- }, __ = /* @__PURE__ */ d({ IkonMediaCapture: () => v_ }), v_ = class {
8476
+ }, v_ = /* @__PURE__ */ d({ IkonMediaCapture: () => y_ }), y_ = class {
8477
8477
  audio;
8478
8478
  video;
8479
8479
  image;
8480
8480
  constructor(e, t) {
8481
- this.audio = new o_(e, t?.audio), this.video = new g_(e), this.image = new u_();
8481
+ this.audio = new s_(e, t?.audio), this.video = new __(e), this.image = new d_();
8482
8482
  }
8483
8483
  dispose() {
8484
8484
  this.audio.dispose(), this.video.dispose();
8485
8485
  }
8486
8486
  };
8487
8487
  //#endregion
8488
- export { Pl as AccessDeniedError, Rg as AppMessaging, Ml as AppStartupFailedError, E as AuthRejectedError, w as AuthenticationError, Rl as BrowserNotSupportedError, Ou as Channel, Au as ChannelManager, ne as ClientType, Ol as ConnectionError, m as ContextType, Pg as EndpointSelector, b as EntrypointType, ch as FunctionCallError, ph as FunctionRegistry, Sd as IKON_AUTH_BASE_URL, xd as IKON_AUTH_URL_DEV, bd as IKON_AUTH_URL_PROD, yd as IKON_BACKEND_URL_DEV, vd as IKON_BACKEND_URL_PROD, og as IKON_INSPECT_MODE_CHANGED_EVENT, Kl as IKON_PARAM_AUDIO, Ql as IKON_PARAM_AUTH, Ul as IKON_PARAM_DEBUG, Zl as IKON_PARAM_DEBUG_OVERLAY, Xl as IKON_PARAM_INSPECT, Wl as IKON_PARAM_LANG, Bl as IKON_PARAM_PROXY, $l as IKON_PARAM_RETRY, Gl as IKON_PARAM_SERVER_URL, ql as IKON_PARAM_VIDEO, Jl as IKON_PARAM_WEBRTC, Vl as IKON_PARAM_WEBSOCKET, Hl as IKON_PARAM_WEBTRANSPORT, o_ as IkonAudioCapture, ie as IkonAudioPlayback, Lg as IkonClient, u_ as IkonImageCapture, de as IkonMedia, v_ as IkonMediaCapture, g_ as IkonVideoCapture, le as IkonVideoPlayback, kl as KeepaliveTimeoutError, x as LogLevel, Al as MaxRetriesExceededError, C as Opcode, tf as PKCE_URL_PARAM, jl as ProvisioningTimeoutError, Il as ServerFullError, Ll as ServerUnavailableError, Fl as SessionNotFoundError, Nl as SpaceNotFoundError, T as TransportError, p as UserType, tg as VisemeTracker, Pu as WEBRTC_AUDIO_BITRATE, Nu as WEBRTC_AUDIO_CHANNELS, ju as WEBRTC_AUDIO_CODEC, Fu as WEBRTC_AUDIO_JITTER_BUFFER_TARGET_MS, Mu as WEBRTC_AUDIO_SAMPLE_RATE, Bu as WEBRTC_BUNDLE_POLICY, Ku as WEBRTC_DATA_CHANNEL_LABEL, Ju as WEBRTC_DATA_CHANNEL_MAX_RETRANSMITS, qu as WEBRTC_DATA_CHANNEL_ORDERED, Wu as WEBRTC_MAX_AUDIO_TRACKS, Gu as WEBRTC_MAX_VIDEO_TRACKS, Vu as WEBRTC_RTCP_MUX_POLICY, Iu as WEBRTC_VIDEO_CODEC, Lu as WEBRTC_VIDEO_MAX_BITRATE, Ru as WEBRTC_VIDEO_MAX_FRAMERATE, Yu as WebRTCConnection, Xu as WebRTCSignaling, _d as abortSignalAny, F as abortSignalTimeout, uf as adoptPkceVerifierFromUrl, zg as appMessaging, v as asProtocolMessage, _g as checkBrowserSupport, wm as clearDeviceId, Up as clearLogBuffer, dd as clearLoginPrompt, Jg as consumeLoginHandoff, md as consumeLoginPendingCall, S as createLogger, Jd as createPkceChallenge, Fd as deriveAuthUrl, Nd as deriveBackendType, Md as deriveBackendUrl, Id as deriveCrossOriginAuthUrl, dg as enableInspectMode, Tm as extractUserIdFromToken, Hp as flushLogs, uu as getAudioParam, gu as getAuthSameOriginParam, Bp as getBufferedLogs, vm as getConnectTraceId, hu as getDebugOverlayParam, su as getDebugParam, mu as getInspectParam, cu as getLangParam, Wp as getLogBufferSize, we as getLogLevel, Se as getLogSink, ld as getLoginPromptState, Gg as getOpcodeName, Cm as getOrCreateDeviceId, iu as getProxyParam, k as getRetryParam, kd as getSameOriginAuthUrl, lu as getServerUrlParam, du as getVideoParam, fu as getWebRtcParam, au as getWebSocketParam, ou as getWebTransportParam, rg as initializeDebugMode, lg as initializeInspectMode, Rp as initializeLogSink, Ee as isAudioWorkletSupported, R as isBrowserEnvironment, I as isCloudEnvironment, Vg as isConnected, Bg as isConnecting, ig as isDebugModeEnabled, af as isEmbedded, Ug as isError, ug as isInspectModeEnabled, Ch as isMobileBrowserLikely, Hg as isOffline, qd as isPkceSupported, Ce as isSharedArrayBufferSupported, Tu as isWebTransportSupported, Sh as loginErrorInterceptor, lf as onEmbeddedOAuthResult, Vd as parseUrlParams, xm as randomUuid, c as readOpcode, u as readOpcodeGroup, i as readProtocolMessageHeaders, jp as registerBrowserFunctions, bm as reportConnectTimeline, qg as reprovisionAfterLogin, Yd as restorePkceVerifier, be as setLogLevel, ye as setLogSink, ud as setLoginPromptRequired, ru as setSdkUrlParam, zp as setSendLogsCallback, sf as startEmbeddedOAuthSignIn, um as startLogSender, fm as stopLogSender, fd as subscribeLoginPrompt, ge as subscribeToLogEvents, Vp as takeBufferedLogs, Xd as takePkceVerifier, sh as withResultData };
8488
+ export { Pl as AccessDeniedError, zg as AppMessaging, Ml as AppStartupFailedError, E as AuthRejectedError, w as AuthenticationError, Rl as BrowserNotSupportedError, Ou as Channel, Au as ChannelManager, ne as ClientType, Ol as ConnectionError, m as ContextType, Fg as EndpointSelector, b as EntrypointType, ch as FunctionCallError, ph as FunctionRegistry, Sd as IKON_AUTH_BASE_URL, xd as IKON_AUTH_URL_DEV, bd as IKON_AUTH_URL_PROD, yd as IKON_BACKEND_URL_DEV, vd as IKON_BACKEND_URL_PROD, og as IKON_INSPECT_MODE_CHANGED_EVENT, Kl as IKON_PARAM_AUDIO, Ql as IKON_PARAM_AUTH, Ul as IKON_PARAM_DEBUG, Zl as IKON_PARAM_DEBUG_OVERLAY, Xl as IKON_PARAM_INSPECT, Wl as IKON_PARAM_LANG, Bl as IKON_PARAM_PROXY, $l as IKON_PARAM_RETRY, Gl as IKON_PARAM_SERVER_URL, ql as IKON_PARAM_VIDEO, Jl as IKON_PARAM_WEBRTC, Vl as IKON_PARAM_WEBSOCKET, Hl as IKON_PARAM_WEBTRANSPORT, s_ as IkonAudioCapture, ie as IkonAudioPlayback, Rg as IkonClient, d_ as IkonImageCapture, de as IkonMedia, y_ as IkonMediaCapture, __ as IkonVideoCapture, le as IkonVideoPlayback, kl as KeepaliveTimeoutError, x as LogLevel, Al as MaxRetriesExceededError, C as Opcode, nf as PKCE_URL_PARAM, jl as ProvisioningTimeoutError, Il as ServerFullError, Ll as ServerUnavailableError, Fl as SessionNotFoundError, Nl as SpaceNotFoundError, T as TransportError, p as UserType, tg as VisemeTracker, Pu as WEBRTC_AUDIO_BITRATE, Nu as WEBRTC_AUDIO_CHANNELS, ju as WEBRTC_AUDIO_CODEC, Fu as WEBRTC_AUDIO_JITTER_BUFFER_TARGET_MS, Mu as WEBRTC_AUDIO_SAMPLE_RATE, Bu as WEBRTC_BUNDLE_POLICY, Ku as WEBRTC_DATA_CHANNEL_LABEL, Ju as WEBRTC_DATA_CHANNEL_MAX_RETRANSMITS, qu as WEBRTC_DATA_CHANNEL_ORDERED, Wu as WEBRTC_MAX_AUDIO_TRACKS, Gu as WEBRTC_MAX_VIDEO_TRACKS, Vu as WEBRTC_RTCP_MUX_POLICY, Iu as WEBRTC_VIDEO_CODEC, Lu as WEBRTC_VIDEO_MAX_BITRATE, Ru as WEBRTC_VIDEO_MAX_FRAMERATE, Yu as WebRTCConnection, Xu as WebRTCSignaling, _d as abortSignalAny, F as abortSignalTimeout, df as adoptPkceVerifierFromUrl, Bg as appMessaging, v as asProtocolMessage, _g as checkBrowserSupport, Tm as clearDeviceId, Wp as clearLogBuffer, dd as clearLoginPrompt, Yg as consumeLoginHandoff, md as consumeLoginPendingCall, S as createLogger, Jd as createPkceChallenge, Fd as deriveAuthUrl, Nd as deriveBackendType, Md as deriveBackendUrl, Id as deriveCrossOriginAuthUrl, dg as enableInspectMode, Em as extractUserIdFromToken, Up as flushLogs, uu as getAudioParam, gu as getAuthSameOriginParam, Vp as getBufferedLogs, ym as getConnectTraceId, hu as getDebugOverlayParam, su as getDebugParam, mu as getInspectParam, cu as getLangParam, Gp as getLogBufferSize, we as getLogLevel, Se as getLogSink, ld as getLoginPromptState, Kg as getOpcodeName, wm as getOrCreateDeviceId, iu as getProxyParam, k as getRetryParam, kd as getSameOriginAuthUrl, lu as getServerUrlParam, du as getVideoParam, fu as getWebRtcParam, au as getWebSocketParam, ou as getWebTransportParam, rg as initializeDebugMode, lg as initializeInspectMode, zp as initializeLogSink, Ee as isAudioWorkletSupported, R as isBrowserEnvironment, I as isCloudEnvironment, Hg as isConnected, Vg as isConnecting, ig as isDebugModeEnabled, of as isEmbedded, Wg as isError, ug as isInspectModeEnabled, Ch as isMobileBrowserLikely, Ug as isOffline, qd as isPkceSupported, Ce as isSharedArrayBufferSupported, Tu as isWebTransportSupported, Sh as loginErrorInterceptor, uf as onEmbeddedOAuthResult, Vd as parseUrlParams, Sm as randomUuid, c as readOpcode, u as readOpcodeGroup, i as readProtocolMessageHeaders, Mp as registerBrowserFunctions, xm as reportConnectTimeline, Jg as reprovisionAfterLogin, Yd as restorePkceVerifier, be as setLogLevel, ye as setLogSink, ud as setLoginPromptRequired, ru as setSdkUrlParam, Bp as setSendLogsCallback, cf as startEmbeddedOAuthSignIn, dm as startLogSender, pm as stopLogSender, fd as subscribeLoginPrompt, ge as subscribeToLogEvents, Hp as takeBufferedLogs, Xd as takePkceVerifier, sh as withResultData };