@ikonai/sdk 1.0.6 → 1.0.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.
- package/index.js +187 -180
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2292,15 +2292,6 @@ function Na(t, e, r) {
|
|
|
2292
2292
|
const n = ya();
|
|
2293
2293
|
return F(wa, n, Ir, e, r);
|
|
2294
2294
|
}
|
|
2295
|
-
function ga(t) {
|
|
2296
|
-
return new Worker(
|
|
2297
|
-
"" + new URL("assets/protocol-worker-DIKCgk1A.js", import.meta.url).href,
|
|
2298
|
-
{
|
|
2299
|
-
type: "module",
|
|
2300
|
-
name: t?.name
|
|
2301
|
-
}
|
|
2302
|
-
);
|
|
2303
|
-
}
|
|
2304
2295
|
class He extends Error {
|
|
2305
2296
|
constructor(e, r) {
|
|
2306
2297
|
super(e), this.cause = r, this.name = "ConnectionError";
|
|
@@ -2321,12 +2312,12 @@ class Ke extends W {
|
|
|
2321
2312
|
super(`No keepalive received within ${e}ms`), this.name = "KeepaliveTimeoutError";
|
|
2322
2313
|
}
|
|
2323
2314
|
}
|
|
2324
|
-
class
|
|
2315
|
+
class ga extends He {
|
|
2325
2316
|
constructor(e) {
|
|
2326
2317
|
super(`Maximum reconnection attempts (${e}) exceeded`), this.name = "MaxRetriesExceededError";
|
|
2327
2318
|
}
|
|
2328
2319
|
}
|
|
2329
|
-
class
|
|
2320
|
+
class Ca extends y {
|
|
2330
2321
|
constructor(e) {
|
|
2331
2322
|
super(`Channel provisioning timeout after ${e}ms`), this.name = "ProvisioningTimeoutError";
|
|
2332
2323
|
}
|
|
@@ -2368,24 +2359,24 @@ function Al(t) {
|
|
|
2368
2359
|
function yl() {
|
|
2369
2360
|
return $e;
|
|
2370
2361
|
}
|
|
2371
|
-
function
|
|
2362
|
+
function ba(t) {
|
|
2372
2363
|
fe = t;
|
|
2373
2364
|
}
|
|
2374
2365
|
function Nl() {
|
|
2375
2366
|
return fe;
|
|
2376
2367
|
}
|
|
2377
|
-
const
|
|
2368
|
+
const Ra = {
|
|
2378
2369
|
0: "DEBUG",
|
|
2379
2370
|
1: "INFO",
|
|
2380
2371
|
2: "WARN",
|
|
2381
2372
|
3: "ERROR",
|
|
2382
2373
|
4: "NONE"
|
|
2383
2374
|
};
|
|
2384
|
-
function
|
|
2375
|
+
function ka(t, e) {
|
|
2385
2376
|
return `[${t}] ${e}`;
|
|
2386
2377
|
}
|
|
2387
2378
|
function ie(t, e, r, n) {
|
|
2388
|
-
const s = (/* @__PURE__ */ new Date()).toISOString(), i =
|
|
2379
|
+
const s = (/* @__PURE__ */ new Date()).toISOString(), i = Ra[t];
|
|
2389
2380
|
if (fe && fe({
|
|
2390
2381
|
timestamp: s,
|
|
2391
2382
|
level: t,
|
|
@@ -2394,7 +2385,7 @@ function ie(t, e, r, n) {
|
|
|
2394
2385
|
message: r,
|
|
2395
2386
|
args: n
|
|
2396
2387
|
}), $e <= t) {
|
|
2397
|
-
const o =
|
|
2388
|
+
const o = ka(e, r);
|
|
2398
2389
|
switch (t) {
|
|
2399
2390
|
case 0:
|
|
2400
2391
|
console.debug(o, ...n);
|
|
@@ -2427,8 +2418,8 @@ function L(t) {
|
|
|
2427
2418
|
}
|
|
2428
2419
|
};
|
|
2429
2420
|
}
|
|
2430
|
-
const oe = L("WebSocketTransport"),
|
|
2431
|
-
class
|
|
2421
|
+
const oe = L("WebSocketTransport"), Ua = 1e4;
|
|
2422
|
+
class Da {
|
|
2432
2423
|
ws = null;
|
|
2433
2424
|
keepaliveTimeout = null;
|
|
2434
2425
|
// Pre-allocated keepalive response message to avoid allocation per keepalive
|
|
@@ -2455,7 +2446,7 @@ class Ma {
|
|
|
2455
2446
|
clearTimeout(c), this.ws && (this.ws.onopen = null, this.ws.onerror = null, this.ws.onclose = null, this.ws.onmessage = null);
|
|
2456
2447
|
}, c = setTimeout(() => {
|
|
2457
2448
|
o || (o = !0, a(), this.ws?.close(), s(new W("WebSocket connection timeout")));
|
|
2458
|
-
},
|
|
2449
|
+
}, Ua);
|
|
2459
2450
|
this.ws.onopen = () => {
|
|
2460
2451
|
i = !0, clearTimeout(c), this.ws.send(r), this.resetKeepaliveTimeout(), o || (o = !0, n());
|
|
2461
2452
|
}, this.ws.onerror = () => {
|
|
@@ -2504,11 +2495,11 @@ class Ma {
|
|
|
2504
2495
|
this.keepaliveTimeout && (clearTimeout(this.keepaliveTimeout), this.keepaliveTimeout = null);
|
|
2505
2496
|
}
|
|
2506
2497
|
}
|
|
2507
|
-
const B = L("WebTransportTransport"), Ze = 4,
|
|
2498
|
+
const B = L("WebTransportTransport"), Ze = 4, Ma = 65536;
|
|
2508
2499
|
function Tr() {
|
|
2509
2500
|
return typeof WebTransport < "u";
|
|
2510
2501
|
}
|
|
2511
|
-
class
|
|
2502
|
+
class Oa {
|
|
2512
2503
|
transport = null;
|
|
2513
2504
|
stream = null;
|
|
2514
2505
|
reader = null;
|
|
@@ -2516,7 +2507,7 @@ class La {
|
|
|
2516
2507
|
keepaliveTimeout = null;
|
|
2517
2508
|
readLoopActive = !1;
|
|
2518
2509
|
// Grow-only receive buffer with offset/length tracking to minimize allocations
|
|
2519
|
-
receiveBuffer = new Uint8Array(
|
|
2510
|
+
receiveBuffer = new Uint8Array(Ma);
|
|
2520
2511
|
receiveBufferOffset = 0;
|
|
2521
2512
|
receiveBufferLength = 0;
|
|
2522
2513
|
// Cached DataView to avoid allocation per message
|
|
@@ -2671,7 +2662,7 @@ class La {
|
|
|
2671
2662
|
}
|
|
2672
2663
|
}
|
|
2673
2664
|
const ee = L("Channel");
|
|
2674
|
-
class
|
|
2665
|
+
class La {
|
|
2675
2666
|
state = "disconnected";
|
|
2676
2667
|
transport = null;
|
|
2677
2668
|
config;
|
|
@@ -2748,13 +2739,13 @@ class va {
|
|
|
2748
2739
|
switch (e.Type) {
|
|
2749
2740
|
case k.WebSocket:
|
|
2750
2741
|
case k.WebSocketProxy:
|
|
2751
|
-
this.transport = new
|
|
2742
|
+
this.transport = new Da(r);
|
|
2752
2743
|
break;
|
|
2753
2744
|
case k.WebTransport:
|
|
2754
2745
|
case k.WebTransportProxy:
|
|
2755
2746
|
if (!Tr())
|
|
2756
2747
|
throw new Error("WebTransport is not supported in this browser");
|
|
2757
|
-
this.transport = new
|
|
2748
|
+
this.transport = new Oa(r);
|
|
2758
2749
|
break;
|
|
2759
2750
|
default:
|
|
2760
2751
|
throw new Error(`Unsupported entrypoint type: ${k[e.Type]}`);
|
|
@@ -2796,7 +2787,7 @@ class va {
|
|
|
2796
2787
|
}
|
|
2797
2788
|
}
|
|
2798
2789
|
const x = L("ChannelManager");
|
|
2799
|
-
class
|
|
2790
|
+
class va {
|
|
2800
2791
|
channels = /* @__PURE__ */ new Map();
|
|
2801
2792
|
// keyed by opcode group
|
|
2802
2793
|
activeType = null;
|
|
@@ -2898,7 +2889,7 @@ class Pa {
|
|
|
2898
2889
|
* Connect a single channel.
|
|
2899
2890
|
*/
|
|
2900
2891
|
async connectChannel(e) {
|
|
2901
|
-
const r = new
|
|
2892
|
+
const r = new La({
|
|
2902
2893
|
entrypoint: e,
|
|
2903
2894
|
sessionId: this.config.sessionId,
|
|
2904
2895
|
keepaliveTimeoutMs: this.config.keepaliveTimeoutMs,
|
|
@@ -2953,7 +2944,7 @@ class Pa {
|
|
|
2953
2944
|
if (!this.shouldReconnect)
|
|
2954
2945
|
return;
|
|
2955
2946
|
if (this.reconnectAttempts >= this.config.maxReconnectAttempts) {
|
|
2956
|
-
x.error(`Max reconnect attempts (${this.config.maxReconnectAttempts}) reached`), this.setState("offline"), this.config.onError?.(new
|
|
2947
|
+
x.error(`Max reconnect attempts (${this.config.maxReconnectAttempts}) reached`), this.setState("offline"), this.config.onError?.(new ga(this.config.maxReconnectAttempts));
|
|
2957
2948
|
return;
|
|
2958
2949
|
}
|
|
2959
2950
|
this.setState("reconnecting"), this.reconnectAttempts++;
|
|
@@ -2980,7 +2971,7 @@ class Pa {
|
|
|
2980
2971
|
this.state !== e && (this.state = e, this.config.onStateChange?.(e));
|
|
2981
2972
|
}
|
|
2982
2973
|
}
|
|
2983
|
-
const
|
|
2974
|
+
const Pa = 5e3, Fa = 3e4, qe = 35e3, et = 500, tt = 6, Sr = 6e4, Re = "ikon_device_id";
|
|
2984
2975
|
function Ye() {
|
|
2985
2976
|
if (typeof window > "u" || typeof localStorage > "u")
|
|
2986
2977
|
return crypto.randomUUID();
|
|
@@ -3033,7 +3024,7 @@ function Ar() {
|
|
|
3033
3024
|
e[r] = n;
|
|
3034
3025
|
return e;
|
|
3035
3026
|
}
|
|
3036
|
-
const
|
|
3027
|
+
const Ba = ["ikon_token", "ikon_provider", "error"];
|
|
3037
3028
|
function Dl() {
|
|
3038
3029
|
if (typeof window > "u")
|
|
3039
3030
|
return { parameters: {} };
|
|
@@ -3046,7 +3037,7 @@ function Dl() {
|
|
|
3046
3037
|
throw new Error("URL cannot contain both /s/[sessionId] and /c/[channelKey]");
|
|
3047
3038
|
const i = Ar(), o = {};
|
|
3048
3039
|
for (const [a, c] of Object.entries(i))
|
|
3049
|
-
|
|
3040
|
+
Ba.includes(a) || (o[a] = c);
|
|
3050
3041
|
return { sessionId: e, channelKey: r, parameters: o };
|
|
3051
3042
|
}
|
|
3052
3043
|
function je() {
|
|
@@ -3061,8 +3052,8 @@ function je() {
|
|
|
3061
3052
|
}
|
|
3062
3053
|
return !0;
|
|
3063
3054
|
}
|
|
3064
|
-
const Ie = L("Authenticator"), j = S.GROUP_CORE | S.GROUP_KEEPALIVE | S.GROUP_EVENTS | S.GROUP_ACTIONS | S.GROUP_UI | S.GROUP_AUDIO | S.GROUP_VIDEO | S.GROUP_ANALYTICS,
|
|
3065
|
-
async function
|
|
3055
|
+
const Ie = L("Authenticator"), j = S.GROUP_CORE | S.GROUP_KEEPALIVE | S.GROUP_EVENTS | S.GROUP_ACTIONS | S.GROUP_UI | S.GROUP_AUDIO | S.GROUP_VIDEO | S.GROUP_ANALYTICS, xa = 1e3, Ga = 5e3;
|
|
3056
|
+
async function Va(t) {
|
|
3066
3057
|
try {
|
|
3067
3058
|
const e = await fetch(`${pe}/users/me`, {
|
|
3068
3059
|
credentials: "include",
|
|
@@ -3098,7 +3089,7 @@ async function Nr(t, e, r, n, s, i, o) {
|
|
|
3098
3089
|
}
|
|
3099
3090
|
return await l.json();
|
|
3100
3091
|
}
|
|
3101
|
-
async function
|
|
3092
|
+
async function Wa(t, e, r, n) {
|
|
3102
3093
|
const s = `${t}/rooms/connect`, i = await fetch(s, yr(e, r, n));
|
|
3103
3094
|
if (!i.ok) {
|
|
3104
3095
|
const o = await i.text().catch(() => "Unknown error");
|
|
@@ -3108,17 +3099,17 @@ async function Ha(t, e, r, n) {
|
|
|
3108
3099
|
}
|
|
3109
3100
|
async function gr(t, e, r, n, s) {
|
|
3110
3101
|
const i = Date.now();
|
|
3111
|
-
let o =
|
|
3102
|
+
let o = xa;
|
|
3112
3103
|
for (; ; ) {
|
|
3113
3104
|
if (s?.aborted)
|
|
3114
3105
|
throw new y("Connection aborted");
|
|
3115
3106
|
if (Date.now() - i >= r)
|
|
3116
|
-
throw new
|
|
3117
|
-
const c = await
|
|
3107
|
+
throw new Ca(r);
|
|
3108
|
+
const c = await Wa(t, e, n, s), l = c.state?.toLowerCase();
|
|
3118
3109
|
if (l === "running")
|
|
3119
3110
|
return c;
|
|
3120
3111
|
if (l === "provisioning") {
|
|
3121
|
-
await mr(o, s), o = Math.min(o * 1.5,
|
|
3112
|
+
await mr(o, s), o = Math.min(o * 1.5, Ga);
|
|
3122
3113
|
continue;
|
|
3123
3114
|
}
|
|
3124
3115
|
throw new y(`Unexpected channel state: ${c.state}`);
|
|
@@ -3133,7 +3124,7 @@ async function Te(t, e) {
|
|
|
3133
3124
|
const n = await r.arrayBuffer(), s = new Uint8Array(n);
|
|
3134
3125
|
return { authResponse: await Cs(s) };
|
|
3135
3126
|
}
|
|
3136
|
-
function
|
|
3127
|
+
function Ha(t, e) {
|
|
3137
3128
|
return ks({
|
|
3138
3129
|
ServerSessionId: "",
|
|
3139
3130
|
// Server will fill this in
|
|
@@ -3161,7 +3152,7 @@ function Ka(t, e) {
|
|
|
3161
3152
|
Parameters: t.parameters ?? {}
|
|
3162
3153
|
});
|
|
3163
3154
|
}
|
|
3164
|
-
function
|
|
3155
|
+
function Ka(t) {
|
|
3165
3156
|
return {
|
|
3166
3157
|
ServerSessionId: t.ServerSessionId,
|
|
3167
3158
|
ContextType: t.ContextType,
|
|
@@ -3188,13 +3179,13 @@ function $a(t) {
|
|
|
3188
3179
|
Parameters: t.Parameters
|
|
3189
3180
|
};
|
|
3190
3181
|
}
|
|
3191
|
-
async function
|
|
3182
|
+
async function $a(t, e) {
|
|
3192
3183
|
const r = `https://${t.host}:${t.httpsPort}`;
|
|
3193
3184
|
Ie.debug(`Authenticating with local server: ${r}`);
|
|
3194
3185
|
const s = { ...Ar(), ...t.parameters };
|
|
3195
3186
|
let i = t.userId;
|
|
3196
|
-
i || (i = await
|
|
3197
|
-
const o =
|
|
3187
|
+
i || (i = await Va(e), i || (i = "local", Ie.warn('Could not determine user ID. Using fallback "local". To fix: either provide userId in config, or log in to the Ikon portal at https://portal.dev.ikon.live')));
|
|
3188
|
+
const o = Ha({ ...t, parameters: s }, i), a = Ka(o), c = await fetch(`${r}/connect-token`, {
|
|
3198
3189
|
method: "POST",
|
|
3199
3190
|
headers: {
|
|
3200
3191
|
"Content-Type": "application/json"
|
|
@@ -3212,7 +3203,7 @@ async function Ya(t, e) {
|
|
|
3212
3203
|
const d = `${r}/connect?token=${encodeURIComponent(f)}`;
|
|
3213
3204
|
return Te(d, e);
|
|
3214
3205
|
}
|
|
3215
|
-
async function
|
|
3206
|
+
async function Ya(t, e) {
|
|
3216
3207
|
if (t.sessionId && t.channelKey)
|
|
3217
3208
|
throw new y("Cannot specify both sessionId and channelKey. Use sessionId for precomputed sessions or channelKey to select a channel.");
|
|
3218
3209
|
const r = wr(t.backendType);
|
|
@@ -3272,7 +3263,7 @@ async function ja(t, e) {
|
|
|
3272
3263
|
const d = f.configuration.url;
|
|
3273
3264
|
return Te(d, e);
|
|
3274
3265
|
}
|
|
3275
|
-
async function
|
|
3266
|
+
async function ja(t, e) {
|
|
3276
3267
|
if (t.sessionId && t.channelKey)
|
|
3277
3268
|
throw new y("Cannot specify both sessionId and channelKey. Use sessionId for precomputed sessions or channelKey to select a channel.");
|
|
3278
3269
|
const r = wr(t.backendType), n = t.token;
|
|
@@ -3313,22 +3304,22 @@ async function za(t, e) {
|
|
|
3313
3304
|
const l = c.configuration.url;
|
|
3314
3305
|
return Te(l, e);
|
|
3315
3306
|
}
|
|
3316
|
-
const Cr = "ikon.theme", Ue = "ikon.theme-user",
|
|
3307
|
+
const Cr = "ikon.theme", Ue = "ikon.theme-user", za = "ikon.theme-change";
|
|
3317
3308
|
function br(t) {
|
|
3318
3309
|
typeof document < "u" && document.documentElement && document.documentElement.setAttribute("data-theme", t);
|
|
3319
3310
|
}
|
|
3320
|
-
const
|
|
3311
|
+
const Xa = {
|
|
3321
3312
|
name: "ikon.client.getTheme",
|
|
3322
3313
|
description: "Get the currently selected client theme",
|
|
3323
3314
|
returnType: { kind: "string", nullable: !0 }
|
|
3324
3315
|
};
|
|
3325
|
-
function
|
|
3316
|
+
function Ja() {
|
|
3326
3317
|
if (typeof window > "u" || !window.localStorage)
|
|
3327
3318
|
return null;
|
|
3328
3319
|
const t = window.localStorage.getItem(Ue) ?? window.localStorage.getItem(Cr) ?? "light";
|
|
3329
3320
|
return br(t), t;
|
|
3330
3321
|
}
|
|
3331
|
-
const
|
|
3322
|
+
const Qa = {
|
|
3332
3323
|
name: "ikon.client.setTheme",
|
|
3333
3324
|
description: "Update the client UI theme",
|
|
3334
3325
|
returnType: { kind: "boolean" },
|
|
@@ -3337,7 +3328,7 @@ const Za = {
|
|
|
3337
3328
|
{ name: "persist", type: { kind: "boolean", nullable: !0 }, description: "Whether to persist as user preference" }
|
|
3338
3329
|
]
|
|
3339
3330
|
};
|
|
3340
|
-
function
|
|
3331
|
+
function Za(t, e) {
|
|
3341
3332
|
if (typeof window > "u" || !window.localStorage || typeof t != "string")
|
|
3342
3333
|
return !1;
|
|
3343
3334
|
const r = t.trim().toLowerCase();
|
|
@@ -3346,40 +3337,40 @@ function qa(t, e) {
|
|
|
3346
3337
|
const n = e === void 0 ? !0 : !!e, s = window.localStorage;
|
|
3347
3338
|
n ? s.setItem(Ue, r) : s.removeItem(Ue), s.setItem(Cr, r);
|
|
3348
3339
|
try {
|
|
3349
|
-
window.dispatchEvent(new CustomEvent(
|
|
3340
|
+
window.dispatchEvent(new CustomEvent(za, { detail: { mode: r } }));
|
|
3350
3341
|
} catch {
|
|
3351
3342
|
}
|
|
3352
3343
|
return br(r), !0;
|
|
3353
3344
|
}
|
|
3354
|
-
const
|
|
3345
|
+
const qa = {
|
|
3355
3346
|
name: "ikon.client.getLanguage",
|
|
3356
3347
|
description: "Get the browser language preference",
|
|
3357
3348
|
returnType: { kind: "string" }
|
|
3358
3349
|
};
|
|
3359
|
-
function
|
|
3350
|
+
function ec() {
|
|
3360
3351
|
return typeof navigator > "u" ? "en-US" : navigator.language || "en-US";
|
|
3361
3352
|
}
|
|
3362
|
-
const
|
|
3353
|
+
const tc = {
|
|
3363
3354
|
name: "ikon.client.getTimezone",
|
|
3364
3355
|
description: "Get the browser timezone (IANA format)",
|
|
3365
3356
|
returnType: { kind: "string" }
|
|
3366
3357
|
};
|
|
3367
|
-
function
|
|
3358
|
+
function rc() {
|
|
3368
3359
|
try {
|
|
3369
3360
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
3370
3361
|
} catch {
|
|
3371
3362
|
return "UTC";
|
|
3372
3363
|
}
|
|
3373
3364
|
}
|
|
3374
|
-
const
|
|
3365
|
+
const nc = {
|
|
3375
3366
|
name: "ikon.client.getUrl",
|
|
3376
3367
|
description: "Get the current browser URL path and query string",
|
|
3377
3368
|
returnType: { kind: "string", nullable: !0 }
|
|
3378
3369
|
};
|
|
3379
|
-
function
|
|
3370
|
+
function sc() {
|
|
3380
3371
|
return typeof window > "u" ? null : window.location.pathname + window.location.search;
|
|
3381
3372
|
}
|
|
3382
|
-
const
|
|
3373
|
+
const ic = {
|
|
3383
3374
|
name: "ikon.client.setUrl",
|
|
3384
3375
|
description: "Update the browser URL without triggering a page reload",
|
|
3385
3376
|
returnType: { kind: "boolean" },
|
|
@@ -3388,7 +3379,7 @@ const oc = {
|
|
|
3388
3379
|
{ name: "replace", type: { kind: "boolean", nullable: !0 }, description: "If true, replaces current history entry instead of adding new one" }
|
|
3389
3380
|
]
|
|
3390
3381
|
};
|
|
3391
|
-
function
|
|
3382
|
+
function oc(t, e) {
|
|
3392
3383
|
if (typeof window > "u" || !window.history || typeof t != "string")
|
|
3393
3384
|
return !1;
|
|
3394
3385
|
const r = t.trim();
|
|
@@ -3400,13 +3391,13 @@ function ac(t, e) {
|
|
|
3400
3391
|
return !1;
|
|
3401
3392
|
}
|
|
3402
3393
|
}
|
|
3403
|
-
const
|
|
3394
|
+
const ac = {
|
|
3404
3395
|
name: "ikon.client.vibrate",
|
|
3405
3396
|
description: "Trigger haptic feedback on supported devices",
|
|
3406
3397
|
returnType: { kind: "boolean" },
|
|
3407
3398
|
parameters: [{ name: "pattern", type: { kind: "string" }, description: 'Duration in ms, or comma-separated pattern (e.g., "200" or "100,50,100")' }]
|
|
3408
3399
|
};
|
|
3409
|
-
function
|
|
3400
|
+
function cc(t) {
|
|
3410
3401
|
if (typeof navigator > "u" || !navigator.vibrate || typeof t != "string")
|
|
3411
3402
|
return !1;
|
|
3412
3403
|
try {
|
|
@@ -3417,13 +3408,13 @@ function lc(t) {
|
|
|
3417
3408
|
}
|
|
3418
3409
|
}
|
|
3419
3410
|
let te = null;
|
|
3420
|
-
const
|
|
3411
|
+
const lc = {
|
|
3421
3412
|
name: "ikon.client.keepScreenAwake",
|
|
3422
3413
|
description: "Prevent or allow the screen to sleep",
|
|
3423
3414
|
returnType: { kind: "boolean" },
|
|
3424
3415
|
parameters: [{ name: "enabled", type: { kind: "boolean" }, description: "Whether to keep the screen awake" }]
|
|
3425
3416
|
};
|
|
3426
|
-
async function
|
|
3417
|
+
async function uc(t) {
|
|
3427
3418
|
if (typeof navigator > "u" || !("wakeLock" in navigator))
|
|
3428
3419
|
return !1;
|
|
3429
3420
|
try {
|
|
@@ -3432,15 +3423,15 @@ async function hc(t) {
|
|
|
3432
3423
|
return !1;
|
|
3433
3424
|
}
|
|
3434
3425
|
}
|
|
3435
|
-
const
|
|
3426
|
+
const hc = {
|
|
3436
3427
|
name: "ikon.client.getVisibility",
|
|
3437
3428
|
description: "Get the current page visibility state",
|
|
3438
3429
|
returnType: { kind: "string", nullable: !0 }
|
|
3439
3430
|
};
|
|
3440
|
-
function
|
|
3431
|
+
function dc() {
|
|
3441
3432
|
return typeof document > "u" ? null : document.visibilityState || null;
|
|
3442
3433
|
}
|
|
3443
|
-
const
|
|
3434
|
+
const fc = {
|
|
3444
3435
|
name: "ikon.client.scrollTo",
|
|
3445
3436
|
description: "Scroll the page to a specific position",
|
|
3446
3437
|
returnType: { kind: "boolean" },
|
|
@@ -3450,7 +3441,7 @@ const Ec = {
|
|
|
3450
3441
|
{ name: "smooth", type: { kind: "boolean", nullable: !0 }, description: "Whether to animate the scroll" }
|
|
3451
3442
|
]
|
|
3452
3443
|
};
|
|
3453
|
-
function
|
|
3444
|
+
function Ec(t, e, r) {
|
|
3454
3445
|
if (typeof window > "u" || typeof t != "number" || typeof e != "number")
|
|
3455
3446
|
return !1;
|
|
3456
3447
|
try {
|
|
@@ -3463,12 +3454,12 @@ function pc(t, e, r) {
|
|
|
3463
3454
|
return !1;
|
|
3464
3455
|
}
|
|
3465
3456
|
}
|
|
3466
|
-
const
|
|
3457
|
+
const pc = {
|
|
3467
3458
|
name: "ikon.client.getBatteryLevel",
|
|
3468
3459
|
description: "Get the current battery level (0-100)",
|
|
3469
3460
|
returnType: { kind: "number", nullable: !0 }
|
|
3470
3461
|
};
|
|
3471
|
-
async function
|
|
3462
|
+
async function Ic() {
|
|
3472
3463
|
if (typeof navigator > "u" || !("getBattery" in navigator))
|
|
3473
3464
|
return null;
|
|
3474
3465
|
try {
|
|
@@ -3478,39 +3469,39 @@ async function mc() {
|
|
|
3478
3469
|
return null;
|
|
3479
3470
|
}
|
|
3480
3471
|
}
|
|
3481
|
-
const
|
|
3472
|
+
const mc = {
|
|
3482
3473
|
name: "ikon.client.getNetworkType",
|
|
3483
3474
|
description: "Get the current network connection type",
|
|
3484
3475
|
returnType: { kind: "string", nullable: !0 }
|
|
3485
3476
|
};
|
|
3486
|
-
function
|
|
3477
|
+
function _c() {
|
|
3487
3478
|
if (typeof navigator > "u")
|
|
3488
3479
|
return null;
|
|
3489
3480
|
const t = navigator.connection;
|
|
3490
3481
|
return t && (t.effectiveType || t.type) || null;
|
|
3491
3482
|
}
|
|
3492
|
-
const
|
|
3493
|
-
{ definition:
|
|
3494
|
-
{ definition:
|
|
3495
|
-
{ definition:
|
|
3496
|
-
{ definition:
|
|
3497
|
-
{ definition:
|
|
3498
|
-
{ definition:
|
|
3499
|
-
{ definition:
|
|
3500
|
-
{ definition:
|
|
3501
|
-
{ definition:
|
|
3502
|
-
{ definition:
|
|
3503
|
-
{ definition:
|
|
3504
|
-
{ definition:
|
|
3483
|
+
const Tc = [
|
|
3484
|
+
{ definition: Xa, handler: Ja },
|
|
3485
|
+
{ definition: Qa, handler: Za },
|
|
3486
|
+
{ definition: qa, handler: ec },
|
|
3487
|
+
{ definition: tc, handler: rc },
|
|
3488
|
+
{ definition: nc, handler: sc },
|
|
3489
|
+
{ definition: ic, handler: oc },
|
|
3490
|
+
{ definition: ac, handler: cc },
|
|
3491
|
+
{ definition: lc, handler: uc },
|
|
3492
|
+
{ definition: hc, handler: dc },
|
|
3493
|
+
{ definition: fc, handler: Ec },
|
|
3494
|
+
{ definition: pc, handler: Ic },
|
|
3495
|
+
{ definition: mc, handler: _c }
|
|
3505
3496
|
];
|
|
3506
|
-
function
|
|
3507
|
-
const e =
|
|
3497
|
+
function Sc(t) {
|
|
3498
|
+
const e = Tc.map(({ definition: r, handler: n }) => t.register(r, n));
|
|
3508
3499
|
return () => e.forEach((r) => r());
|
|
3509
3500
|
}
|
|
3510
3501
|
function st() {
|
|
3511
3502
|
return typeof window < "u" && typeof navigator < "u";
|
|
3512
3503
|
}
|
|
3513
|
-
const
|
|
3504
|
+
const wc = new Uint8Array(0);
|
|
3514
3505
|
function me(t) {
|
|
3515
3506
|
switch (t.kind) {
|
|
3516
3507
|
case "array":
|
|
@@ -3570,7 +3561,7 @@ function Rr(t, e) {
|
|
|
3570
3561
|
}
|
|
3571
3562
|
return JSON.stringify(t);
|
|
3572
3563
|
}
|
|
3573
|
-
function
|
|
3564
|
+
function Ac(t, e) {
|
|
3574
3565
|
const r = (t.parameters ?? []).map((i) => {
|
|
3575
3566
|
const o = me(i.type), a = Object.prototype.hasOwnProperty.call(i, "defaultValue"), c = a ? Rr(i.defaultValue, o) : "";
|
|
3576
3567
|
return {
|
|
@@ -3597,7 +3588,7 @@ function yc(t, e) {
|
|
|
3597
3588
|
TypeName: re(i.descriptor),
|
|
3598
3589
|
HasDefaultValue: i.hasDefaultValue,
|
|
3599
3590
|
DefaultValueJson: i.defaultValueJson,
|
|
3600
|
-
DefaultValueData:
|
|
3591
|
+
DefaultValueData: wc,
|
|
3601
3592
|
IsEnumerable: !1,
|
|
3602
3593
|
EnumerableItemTypeName: "",
|
|
3603
3594
|
Description: i.description ?? ""
|
|
@@ -3611,11 +3602,11 @@ function yc(t, e) {
|
|
|
3611
3602
|
returnType: n
|
|
3612
3603
|
};
|
|
3613
3604
|
}
|
|
3614
|
-
const we = L("FunctionRegistry"),
|
|
3615
|
-
function
|
|
3605
|
+
const we = L("FunctionRegistry"), yc = new Uint8Array(0);
|
|
3606
|
+
function Nc(t) {
|
|
3616
3607
|
return !t || typeof t != "object" ? !1 : t.data instanceof Uint8Array;
|
|
3617
3608
|
}
|
|
3618
|
-
class
|
|
3609
|
+
class gc {
|
|
3619
3610
|
functions = /* @__PURE__ */ new Map();
|
|
3620
3611
|
config = null;
|
|
3621
3612
|
isConnected = !1;
|
|
@@ -3637,7 +3628,7 @@ class Cc {
|
|
|
3637
3628
|
* If already connected, sends registration to server immediately.
|
|
3638
3629
|
*/
|
|
3639
3630
|
register(e, r) {
|
|
3640
|
-
const n =
|
|
3631
|
+
const n = Ac(e, r);
|
|
3641
3632
|
return this.functions.set(e.name, n), this.isConnected && this.config && this.sendRegistration(n), () => this.unregister(e.name);
|
|
3642
3633
|
}
|
|
3643
3634
|
/**
|
|
@@ -3718,8 +3709,8 @@ class Cc {
|
|
|
3718
3709
|
h === void 0 || h === "" ? f.hasDefaultValue ? s.push(it(f.defaultValueJson, f.descriptor)) : s.push(void 0) : s.push(it(h, f.descriptor));
|
|
3719
3710
|
}
|
|
3720
3711
|
const i = await e.handler(...s);
|
|
3721
|
-
let o = i, a =
|
|
3722
|
-
|
|
3712
|
+
let o = i, a = yc;
|
|
3713
|
+
Nc(i) && (o = i.value, a = new Uint8Array(i.data));
|
|
3723
3714
|
const c = Rr(o, e.returnType);
|
|
3724
3715
|
this.sendResult(r.CallId, r.InstanceId, n, e, c, a);
|
|
3725
3716
|
} catch (s) {
|
|
@@ -3774,7 +3765,7 @@ class Cc {
|
|
|
3774
3765
|
this.config.sendProtocolMessage(i);
|
|
3775
3766
|
}
|
|
3776
3767
|
}
|
|
3777
|
-
function
|
|
3768
|
+
function Cc(t, e) {
|
|
3778
3769
|
return { value: t, data: e };
|
|
3779
3770
|
}
|
|
3780
3771
|
function Ae(t) {
|
|
@@ -3790,7 +3781,7 @@ const Se = {
|
|
|
3790
3781
|
StartAudioCapture: "ikon.client.startAudioCapture",
|
|
3791
3782
|
StopCapture: "ikon.client.stopCapture",
|
|
3792
3783
|
CaptureImage: "ikon.client.captureImage"
|
|
3793
|
-
},
|
|
3784
|
+
}, bc = {
|
|
3794
3785
|
name: Se.StartVideoCapture,
|
|
3795
3786
|
description: "Start camera or screen capture and stream video frames to the server",
|
|
3796
3787
|
returnType: { kind: "string" },
|
|
@@ -3798,26 +3789,26 @@ const Se = {
|
|
|
3798
3789
|
{ name: "source", type: { kind: "string", nullable: !0 }, description: "camera or screen" },
|
|
3799
3790
|
{ name: "optionsJson", type: { kind: "string", nullable: !0 }, description: "JSON encoded capture options" }
|
|
3800
3791
|
]
|
|
3801
|
-
},
|
|
3792
|
+
}, Rc = {
|
|
3802
3793
|
name: Se.StartAudioCapture,
|
|
3803
3794
|
description: "Start microphone capture and stream audio frames to the server",
|
|
3804
3795
|
returnType: { kind: "string" },
|
|
3805
3796
|
parameters: [{ name: "optionsJson", type: { kind: "string", nullable: !0 }, description: "JSON encoded capture options" }]
|
|
3806
|
-
},
|
|
3797
|
+
}, kc = {
|
|
3807
3798
|
name: Se.StopCapture,
|
|
3808
3799
|
description: "Stop a previously started capture by captureId",
|
|
3809
3800
|
returnType: { kind: "boolean" },
|
|
3810
3801
|
parameters: [{ name: "captureId", type: { kind: "string" }, description: "Capture ID to stop" }]
|
|
3811
|
-
},
|
|
3802
|
+
}, Uc = {
|
|
3812
3803
|
name: Se.CaptureImage,
|
|
3813
3804
|
description: "Capture a single image from the camera and return metadata (JSON) plus binary image data",
|
|
3814
3805
|
returnType: { kind: "string" },
|
|
3815
3806
|
parameters: [{ name: "optionsJson", type: { kind: "string", nullable: !0 }, description: "JSON encoded capture options" }]
|
|
3816
3807
|
};
|
|
3817
|
-
function
|
|
3808
|
+
function Dc(t, e) {
|
|
3818
3809
|
const r = [];
|
|
3819
3810
|
return r.push(
|
|
3820
|
-
t.register(
|
|
3811
|
+
t.register(bc, async (n, s) => {
|
|
3821
3812
|
const i = e.mediaCapture;
|
|
3822
3813
|
if (!i)
|
|
3823
3814
|
throw new Error("Media capture is not available in this environment");
|
|
@@ -3825,7 +3816,7 @@ function Mc(t, e) {
|
|
|
3825
3816
|
return ((typeof n == "string" && n.trim().toLowerCase() === "screen" ? "screen" : "camera") === "screen" ? await i.video.startScreen({ userGesture: !1, options: o, constraints: o?.constraints }) : await i.video.startCamera({ userGesture: !1, options: o, constraints: o?.constraints })).captureId;
|
|
3826
3817
|
})
|
|
3827
3818
|
), r.push(
|
|
3828
|
-
t.register(
|
|
3819
|
+
t.register(Rc, async (n) => {
|
|
3829
3820
|
const s = e.mediaCapture;
|
|
3830
3821
|
if (!s)
|
|
3831
3822
|
throw new Error("Media capture is not available in this environment");
|
|
@@ -3833,7 +3824,7 @@ function Mc(t, e) {
|
|
|
3833
3824
|
return (await s.audio.startMic({ userGesture: !1, options: i, constraints: i?.constraints })).captureId;
|
|
3834
3825
|
})
|
|
3835
3826
|
), r.push(
|
|
3836
|
-
t.register(
|
|
3827
|
+
t.register(kc, async (n) => {
|
|
3837
3828
|
const s = e.mediaCapture;
|
|
3838
3829
|
if (!s || typeof n != "string" || !n.trim())
|
|
3839
3830
|
return !1;
|
|
@@ -3841,7 +3832,7 @@ function Mc(t, e) {
|
|
|
3841
3832
|
return i || o;
|
|
3842
3833
|
})
|
|
3843
3834
|
), r.push(
|
|
3844
|
-
t.register(
|
|
3835
|
+
t.register(Uc, async (n) => {
|
|
3845
3836
|
const s = e.mediaCapture;
|
|
3846
3837
|
if (!s)
|
|
3847
3838
|
throw new Error("Media capture is not available in this environment");
|
|
@@ -3853,7 +3844,7 @@ function Mc(t, e) {
|
|
|
3853
3844
|
width: i.width,
|
|
3854
3845
|
height: i.height
|
|
3855
3846
|
}), a = JSON.stringify({ mime: o.mime, width: o.width, height: o.height });
|
|
3856
|
-
return
|
|
3847
|
+
return Cc(a, o.data);
|
|
3857
3848
|
})
|
|
3858
3849
|
), () => {
|
|
3859
3850
|
for (const n of r)
|
|
@@ -3865,9 +3856,9 @@ const kr = () => {
|
|
|
3865
3856
|
return !1;
|
|
3866
3857
|
const t = navigator.userAgent, e = /iPad|iPhone|iPod/.test(t), r = t.includes("Macintosh") && typeof navigator.maxTouchPoints == "number" && navigator.maxTouchPoints > 1;
|
|
3867
3858
|
return e || r;
|
|
3868
|
-
},
|
|
3859
|
+
}, Mc = globalThis;
|
|
3869
3860
|
function le() {
|
|
3870
|
-
if (typeof SharedArrayBuffer > "u" || typeof Atomics > "u" ||
|
|
3861
|
+
if (typeof SharedArrayBuffer > "u" || typeof Atomics > "u" || Mc.crossOriginIsolated === !1)
|
|
3871
3862
|
return !1;
|
|
3872
3863
|
try {
|
|
3873
3864
|
new SharedArrayBuffer(1);
|
|
@@ -3879,7 +3870,7 @@ function le() {
|
|
|
3879
3870
|
function Ur(t) {
|
|
3880
3871
|
return typeof AudioWorkletNode != "function" ? !1 : typeof t.audioWorklet?.addModule == "function";
|
|
3881
3872
|
}
|
|
3882
|
-
function
|
|
3873
|
+
function Oc(t) {
|
|
3883
3874
|
return new Worker(
|
|
3884
3875
|
"" + new URL("assets/audio-playback-worker-DPybcm1k.js", import.meta.url).href,
|
|
3885
3876
|
{
|
|
@@ -3888,7 +3879,7 @@ function Lc(t) {
|
|
|
3888
3879
|
}
|
|
3889
3880
|
);
|
|
3890
3881
|
}
|
|
3891
|
-
const ae = 48e3, R = 2, Dr = 1500, ot = 512, at = "playback",
|
|
3882
|
+
const ae = 48e3, R = 2, Dr = 1500, ot = 512, at = "playback", Lc = 120, vc = 300, Pc = 4, Fc = 200, Bc = 100, xc = 8e3, Gc = 10, Mr = 100, De = 50, Or = 128, Vc = 20, Wc = !0, G = 1500, Hc = -20, Kc = -100, $c = 200, g = L("IkonAudioPlayback"), Yc = () => {
|
|
3892
3883
|
if (typeof navigator > "u" || typeof window > "u")
|
|
3893
3884
|
return !1;
|
|
3894
3885
|
const t = navigator.userAgent, e = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(t), r = t.includes("Macintosh") && typeof navigator.maxTouchPoints == "number" && navigator.maxTouchPoints > 1;
|
|
@@ -3900,19 +3891,19 @@ const ae = 48e3, R = 2, Dr = 1500, ot = 512, at = "playback", vc = 120, Pc = 300
|
|
|
3900
3891
|
function $(t) {
|
|
3901
3892
|
return t instanceof Error ? `${t.name}: ${t.message}` : String(t);
|
|
3902
3893
|
}
|
|
3903
|
-
function
|
|
3894
|
+
function jc(t) {
|
|
3904
3895
|
return `
|
|
3905
3896
|
// Audio buffer constants
|
|
3906
3897
|
const OUTPUT_SAMPLE_RATE_HZ = ${t.outputSampleRateHz};
|
|
3907
3898
|
const DEFAULT_FRAME_SAMPLES_PER_CHANNEL = Math.max(1, Math.round(OUTPUT_SAMPLE_RATE_HZ * 0.02));
|
|
3908
|
-
const BUFFER_TARGET_MIN_MS = ${
|
|
3909
|
-
const BUFFER_TARGET_MAX_MS = ${
|
|
3910
|
-
const JITTER_MULTIPLIER = ${
|
|
3899
|
+
const BUFFER_TARGET_MIN_MS = ${Lc};
|
|
3900
|
+
const BUFFER_TARGET_MAX_MS = ${vc};
|
|
3901
|
+
const JITTER_MULTIPLIER = ${Pc};
|
|
3911
3902
|
const LOCAL_BUFFER_MAX_MS = ${Dr};
|
|
3912
|
-
const CONTROL_PERIOD_MS = ${
|
|
3913
|
-
const UNDERRUN_JUMP_MS = ${
|
|
3914
|
-
const STABLE_TIME_TO_DECREASE_MS = ${
|
|
3915
|
-
const DECREASE_STEP_MS = ${
|
|
3903
|
+
const CONTROL_PERIOD_MS = ${Fc};
|
|
3904
|
+
const UNDERRUN_JUMP_MS = ${Bc};
|
|
3905
|
+
const STABLE_TIME_TO_DECREASE_MS = ${xc};
|
|
3906
|
+
const DECREASE_STEP_MS = ${Gc};
|
|
3916
3907
|
const DEFAULT_STATS_INTERVAL_SAMPLES = OUTPUT_SAMPLE_RATE_HZ;
|
|
3917
3908
|
|
|
3918
3909
|
// Pre-computed reciprocals for division-free calculations
|
|
@@ -3931,7 +3922,7 @@ const FADE_OUT_INCREMENT = 1.0 / FADE_OUT_DURATION_SAMPLES;
|
|
|
3931
3922
|
const RENDER_QUANTUM_SIZE = ${Or};
|
|
3932
3923
|
|
|
3933
3924
|
// Buffer reduction crossfade constants (align to quantum boundary to avoid partial quanta)
|
|
3934
|
-
const BUFFER_REDUCTION_CROSSFADE_MS = ${
|
|
3925
|
+
const BUFFER_REDUCTION_CROSSFADE_MS = ${Vc};
|
|
3935
3926
|
const BUFFER_REDUCTION_CROSSFADE_SAMPLES_RAW = Math.round(OUTPUT_SAMPLE_RATE_HZ * BUFFER_REDUCTION_CROSSFADE_MS / 1000);
|
|
3936
3927
|
const BUFFER_REDUCTION_CROSSFADE_SAMPLES = Math.ceil(BUFFER_REDUCTION_CROSSFADE_SAMPLES_RAW / RENDER_QUANTUM_SIZE) * RENDER_QUANTUM_SIZE;
|
|
3937
3928
|
|
|
@@ -4142,7 +4133,7 @@ class IkonAudioPlayerProcessor extends AudioWorkletProcessor {
|
|
|
4142
4133
|
this.statsIntervalSamples = Math.max(1, Math.round((OUTPUT_SAMPLE_RATE_HZ * statusIntervalMs) / 1000));
|
|
4143
4134
|
|
|
4144
4135
|
// Normalization config (hardcoded)
|
|
4145
|
-
this.normalizationEnabled = ${
|
|
4136
|
+
this.normalizationEnabled = ${Wc};
|
|
4146
4137
|
|
|
4147
4138
|
// Stream states for audio buffer
|
|
4148
4139
|
this.streams = new Map();
|
|
@@ -4818,7 +4809,7 @@ class ze {
|
|
|
4818
4809
|
config;
|
|
4819
4810
|
enabled = !1;
|
|
4820
4811
|
stateUnsubscribe = null;
|
|
4821
|
-
isMobile =
|
|
4812
|
+
isMobile = Yc();
|
|
4822
4813
|
boundVisibilityChange = null;
|
|
4823
4814
|
boundPageHide = null;
|
|
4824
4815
|
unlockHandler = null;
|
|
@@ -5252,7 +5243,7 @@ class ze {
|
|
|
5252
5243
|
URL.revokeObjectURL(this.workletModuleUrl);
|
|
5253
5244
|
} catch {
|
|
5254
5245
|
}
|
|
5255
|
-
this.workletModuleKey = i, this.workletReady = null, this.workletModuleUrl = URL.createObjectURL(new Blob([
|
|
5246
|
+
this.workletModuleKey = i, this.workletReady = null, this.workletModuleUrl = URL.createObjectURL(new Blob([jc({ outputSampleRateHz: this.outputSampleRateHz, outputChannels: R })], { type: "text/javascript" }));
|
|
5256
5247
|
}
|
|
5257
5248
|
this.workletReady || (this.workletReady = e.audioWorklet.addModule(this.workletModuleUrl).catch((f) => {
|
|
5258
5249
|
throw g.warn(`Failed to load AudioWorklet module, falling back: ${$(f)}`), f;
|
|
@@ -5498,7 +5489,7 @@ class ze {
|
|
|
5498
5489
|
}
|
|
5499
5490
|
this.protocolPort = e;
|
|
5500
5491
|
try {
|
|
5501
|
-
this.audioWorker = new
|
|
5492
|
+
this.audioWorker = new Oc();
|
|
5502
5493
|
} catch (d) {
|
|
5503
5494
|
g.warn(`Failed to create audio worker: ${$(d)}`), this.protocolPort.close(), this.protocolPort = null;
|
|
5504
5495
|
return;
|
|
@@ -5582,7 +5573,7 @@ class ze {
|
|
|
5582
5573
|
s.epochTimestampSamples = e.timestampInterleavedSamples;
|
|
5583
5574
|
const c = this.audioContext;
|
|
5584
5575
|
if (c) {
|
|
5585
|
-
const l = (c.outputLatency ?? 0) + (c.baseLatency ?? 0), f =
|
|
5576
|
+
const l = (c.outputLatency ?? 0) + (c.baseLatency ?? 0), f = Hc + l * 1e3, d = Math.min($c, Math.max(Kc, f));
|
|
5586
5577
|
s.playbackStartContextTime = c.currentTime + d / 1e3;
|
|
5587
5578
|
}
|
|
5588
5579
|
s.timingEstablished = !0;
|
|
@@ -5705,7 +5696,7 @@ class ze {
|
|
|
5705
5696
|
}));
|
|
5706
5697
|
}
|
|
5707
5698
|
}
|
|
5708
|
-
function
|
|
5699
|
+
function zc(t) {
|
|
5709
5700
|
return new Worker(
|
|
5710
5701
|
"" + new URL("assets/video-playback-worker-qauTQ7Et.js", import.meta.url).href,
|
|
5711
5702
|
{
|
|
@@ -5718,7 +5709,7 @@ const V = L("IkonVideoPlayback");
|
|
|
5718
5709
|
function ye(t) {
|
|
5719
5710
|
return t instanceof Error ? `${t.name}: ${t.message}` : String(t);
|
|
5720
5711
|
}
|
|
5721
|
-
class
|
|
5712
|
+
class Xc {
|
|
5722
5713
|
client;
|
|
5723
5714
|
config;
|
|
5724
5715
|
enabled = !0;
|
|
@@ -5793,7 +5784,7 @@ class Jc {
|
|
|
5793
5784
|
}
|
|
5794
5785
|
let e;
|
|
5795
5786
|
try {
|
|
5796
|
-
e = new
|
|
5787
|
+
e = new zc();
|
|
5797
5788
|
} catch (r) {
|
|
5798
5789
|
V.warn(`Failed to create video worker: ${ye(r)}`);
|
|
5799
5790
|
return;
|
|
@@ -5942,11 +5933,11 @@ class Jc {
|
|
|
5942
5933
|
}));
|
|
5943
5934
|
}
|
|
5944
5935
|
}
|
|
5945
|
-
class
|
|
5936
|
+
class Jc {
|
|
5946
5937
|
audio;
|
|
5947
5938
|
video;
|
|
5948
5939
|
constructor(e, r) {
|
|
5949
|
-
this.audio = new ze(e, r?.audio), this.video = new
|
|
5940
|
+
this.audio = new ze(e, r?.audio), this.video = new Xc(e, r?.video), r?.mediaSession && this.audio.setMediaSession(r.mediaSession);
|
|
5950
5941
|
}
|
|
5951
5942
|
/**
|
|
5952
5943
|
* Releases media resources (workers, audio graph, decoders).
|
|
@@ -5957,7 +5948,7 @@ class Qc {
|
|
|
5957
5948
|
this.audio.dispose(), this.video.dispose();
|
|
5958
5949
|
}
|
|
5959
5950
|
}
|
|
5960
|
-
class
|
|
5951
|
+
class Qc {
|
|
5961
5952
|
static getStorageForCapacity(e, r) {
|
|
5962
5953
|
const n = Int32Array.BYTES_PER_ELEMENT * 2, s = r.BYTES_PER_ELEMENT * e;
|
|
5963
5954
|
return new SharedArrayBuffer(n + s);
|
|
@@ -6011,7 +6002,7 @@ class Zc {
|
|
|
6011
6002
|
return n = (n + r) % this.capacity, Atomics.store(this.readWrite, 0, n), r;
|
|
6012
6003
|
}
|
|
6013
6004
|
}
|
|
6014
|
-
function
|
|
6005
|
+
function Zc(t) {
|
|
6015
6006
|
return new Worker(
|
|
6016
6007
|
"" + new URL("assets/audio-capture-worker-kpORDYGU.js", import.meta.url).href,
|
|
6017
6008
|
{
|
|
@@ -6020,12 +6011,12 @@ function qc(t) {
|
|
|
6020
6011
|
}
|
|
6021
6012
|
);
|
|
6022
6013
|
}
|
|
6023
|
-
const
|
|
6024
|
-
function
|
|
6014
|
+
const qc = L("IkonAudioCapture");
|
|
6015
|
+
function el() {
|
|
6025
6016
|
const t = globalThis.crypto;
|
|
6026
6017
|
return t?.randomUUID ? t.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
|
|
6027
6018
|
}
|
|
6028
|
-
function
|
|
6019
|
+
function tl() {
|
|
6029
6020
|
return `
|
|
6030
6021
|
class RingBuffer {
|
|
6031
6022
|
static getStorageForCapacity(capacity, type) {
|
|
@@ -6154,7 +6145,7 @@ class IkonAudioCaptureProcessor extends AudioWorkletProcessor {
|
|
|
6154
6145
|
registerProcessor('ikon-audio-capture', IkonAudioCaptureProcessor);
|
|
6155
6146
|
`;
|
|
6156
6147
|
}
|
|
6157
|
-
class
|
|
6148
|
+
class rl {
|
|
6158
6149
|
constructor(e, r) {
|
|
6159
6150
|
this.client = e, this.config = r ?? {};
|
|
6160
6151
|
}
|
|
@@ -6174,12 +6165,12 @@ class nl {
|
|
|
6174
6165
|
ensureWorker() {
|
|
6175
6166
|
if (this.worker)
|
|
6176
6167
|
return this.worker;
|
|
6177
|
-
const e = new
|
|
6168
|
+
const e = new Zc();
|
|
6178
6169
|
return this.worker = e, e.addEventListener("message", (r) => {
|
|
6179
6170
|
const n = r.data;
|
|
6180
6171
|
if (n?.type === "error") {
|
|
6181
6172
|
const s = n.error;
|
|
6182
|
-
|
|
6173
|
+
qc.warn(`Audio capture worker error: ${s?.name ?? "Error"} ${s?.message ?? ""}`);
|
|
6183
6174
|
}
|
|
6184
6175
|
}), e;
|
|
6185
6176
|
}
|
|
@@ -6217,7 +6208,7 @@ class nl {
|
|
|
6217
6208
|
async ensureWorklet(e) {
|
|
6218
6209
|
if (!Ur(e))
|
|
6219
6210
|
throw new Error("AudioWorklet is not supported in this browser");
|
|
6220
|
-
this.workletModuleUrl || (this.workletModuleUrl = URL.createObjectURL(new Blob([
|
|
6211
|
+
this.workletModuleUrl || (this.workletModuleUrl = URL.createObjectURL(new Blob([tl()], { type: "text/javascript" }))), (!this.workletReady || this.workletContext !== e) && (this.workletContext = e, this.workletReady = e.audioWorklet.addModule(this.workletModuleUrl));
|
|
6221
6212
|
try {
|
|
6222
6213
|
await this.workletReady;
|
|
6223
6214
|
} catch (r) {
|
|
@@ -6233,13 +6224,13 @@ class nl {
|
|
|
6233
6224
|
if (!i)
|
|
6234
6225
|
throw s.getTracks().forEach((p) => p.stop()), new Error("No audio track available");
|
|
6235
6226
|
await this.ensureWorklet(n);
|
|
6236
|
-
const o =
|
|
6227
|
+
const o = el(), a = this.allocateTrackId(), c = n.createMediaStreamSource(s), l = n.createGain();
|
|
6237
6228
|
l.gain.value = 0, l.connect(n.destination);
|
|
6238
6229
|
const h = le() ? "sab" : "pcm";
|
|
6239
6230
|
let E;
|
|
6240
6231
|
if (h === "sab") {
|
|
6241
6232
|
const p = Math.floor(n.sampleRate * 2);
|
|
6242
|
-
E =
|
|
6233
|
+
E = Qc.getStorageForCapacity(p, Float32Array);
|
|
6243
6234
|
}
|
|
6244
6235
|
const m = this.ensureWorker();
|
|
6245
6236
|
m.postMessage({
|
|
@@ -6380,9 +6371,9 @@ class nl {
|
|
|
6380
6371
|
}
|
|
6381
6372
|
}
|
|
6382
6373
|
}
|
|
6383
|
-
const Lr = 1280, vr = 720,
|
|
6384
|
-
async function
|
|
6385
|
-
const r = e.mime ?? Pr, n = e.quality ??
|
|
6374
|
+
const Lr = 1280, vr = 720, nl = 30, Pr = "image/jpeg", sl = 0.92;
|
|
6375
|
+
async function il(t, e) {
|
|
6376
|
+
const r = e.mime ?? Pr, n = e.quality ?? sl;
|
|
6386
6377
|
if (typeof OffscreenCanvas < "u" && t instanceof OffscreenCanvas)
|
|
6387
6378
|
try {
|
|
6388
6379
|
return await t.convertToBlob({ type: r, quality: n });
|
|
@@ -6399,7 +6390,7 @@ async function ol(t, e) {
|
|
|
6399
6390
|
);
|
|
6400
6391
|
});
|
|
6401
6392
|
}
|
|
6402
|
-
class
|
|
6393
|
+
class ol {
|
|
6403
6394
|
async acquireCameraStream(e) {
|
|
6404
6395
|
if (!navigator.mediaDevices)
|
|
6405
6396
|
throw new Error("Media devices are not available in this environment");
|
|
@@ -6436,7 +6427,7 @@ class al {
|
|
|
6436
6427
|
if (!f)
|
|
6437
6428
|
throw new Error("2D canvas context unavailable");
|
|
6438
6429
|
f.drawImage(s, 0, 0, a, c);
|
|
6439
|
-
const d = await
|
|
6430
|
+
const d = await il(l, e), h = await d.arrayBuffer();
|
|
6440
6431
|
return {
|
|
6441
6432
|
mime: d.type || e.mime || Pr,
|
|
6442
6433
|
width: a,
|
|
@@ -6463,7 +6454,7 @@ class al {
|
|
|
6463
6454
|
}
|
|
6464
6455
|
}
|
|
6465
6456
|
}
|
|
6466
|
-
function
|
|
6457
|
+
function al(t) {
|
|
6467
6458
|
return new Worker(
|
|
6468
6459
|
"" + new URL("assets/video-capture-worker-DP3lFDjq.js", import.meta.url).href,
|
|
6469
6460
|
{
|
|
@@ -6473,17 +6464,17 @@ function cl(t) {
|
|
|
6473
6464
|
);
|
|
6474
6465
|
}
|
|
6475
6466
|
const lt = L("IkonVideoCapture");
|
|
6476
|
-
function
|
|
6467
|
+
function cl() {
|
|
6477
6468
|
const t = globalThis.crypto;
|
|
6478
6469
|
return t?.randomUUID ? t.randomUUID() : `cap_${Date.now()}_${Math.floor(Math.random() * 1e9)}`;
|
|
6479
6470
|
}
|
|
6480
|
-
function
|
|
6471
|
+
function ll() {
|
|
6481
6472
|
const t = globalThis.MediaStreamTrackProcessor;
|
|
6482
6473
|
if (!t)
|
|
6483
6474
|
throw new Error("MediaStreamTrackProcessor is not available in this browser");
|
|
6484
6475
|
return t;
|
|
6485
6476
|
}
|
|
6486
|
-
class
|
|
6477
|
+
class ul {
|
|
6487
6478
|
constructor(e) {
|
|
6488
6479
|
this.client = e;
|
|
6489
6480
|
}
|
|
@@ -6499,7 +6490,7 @@ class hl {
|
|
|
6499
6490
|
ensureWorker() {
|
|
6500
6491
|
if (this.worker)
|
|
6501
6492
|
return this.worker;
|
|
6502
|
-
const e = new
|
|
6493
|
+
const e = new al();
|
|
6503
6494
|
return this.worker = e, e.addEventListener("message", (r) => {
|
|
6504
6495
|
const n = r.data;
|
|
6505
6496
|
if (n?.type === "error") {
|
|
@@ -6526,7 +6517,7 @@ class hl {
|
|
|
6526
6517
|
async getMediaStream(e) {
|
|
6527
6518
|
if (!navigator.mediaDevices)
|
|
6528
6519
|
throw new Error("Media devices are not available in this environment");
|
|
6529
|
-
const r = e.constraints ?? {}, n = e.options?.framerate ??
|
|
6520
|
+
const r = e.constraints ?? {}, n = e.options?.framerate ?? nl, s = {
|
|
6530
6521
|
...r,
|
|
6531
6522
|
frameRate: r.frameRate ?? { ideal: n }
|
|
6532
6523
|
};
|
|
@@ -6537,10 +6528,10 @@ class hl {
|
|
|
6537
6528
|
if (!r)
|
|
6538
6529
|
throw new Error("Cannot start video capture before client is connected");
|
|
6539
6530
|
this.ensurePorts();
|
|
6540
|
-
const n =
|
|
6531
|
+
const n = cl(), s = await this.getMediaStream(e), i = s.getVideoTracks()[0];
|
|
6541
6532
|
if (!i)
|
|
6542
6533
|
throw s.getTracks().forEach((I) => I.stop()), new Error("No video track available");
|
|
6543
|
-
const o = i.getSettings(), a = e.options?.width ?? o.width ?? Lr, c = e.options?.height ?? o.height ?? vr, l =
|
|
6534
|
+
const o = i.getSettings(), a = e.options?.width ?? o.width ?? Lr, c = e.options?.height ?? o.height ?? vr, l = ll(), d = new l({ track: i }).readable, h = this.allocateTrackId(), E = this.ensureWorker();
|
|
6544
6535
|
E.postMessage(
|
|
6545
6536
|
{
|
|
6546
6537
|
type: "start",
|
|
@@ -6608,17 +6599,26 @@ class hl {
|
|
|
6608
6599
|
this.protocolPort?.close(), this.protocolPort = null, this.sendPort?.close(), this.sendPort = null;
|
|
6609
6600
|
}
|
|
6610
6601
|
}
|
|
6611
|
-
class
|
|
6602
|
+
class hl {
|
|
6612
6603
|
audio;
|
|
6613
6604
|
video;
|
|
6614
6605
|
image;
|
|
6615
6606
|
constructor(e, r) {
|
|
6616
|
-
this.audio = new
|
|
6607
|
+
this.audio = new rl(e, r?.audio), this.video = new ul(e), this.image = new ol();
|
|
6617
6608
|
}
|
|
6618
6609
|
dispose() {
|
|
6619
6610
|
this.audio.dispose(), this.video.dispose();
|
|
6620
6611
|
}
|
|
6621
6612
|
}
|
|
6613
|
+
function dl(t) {
|
|
6614
|
+
return new Worker(
|
|
6615
|
+
"" + new URL("assets/protocol-worker-DIKCgk1A.js", import.meta.url).href,
|
|
6616
|
+
{
|
|
6617
|
+
type: "module",
|
|
6618
|
+
name: t?.name
|
|
6619
|
+
}
|
|
6620
|
+
);
|
|
6621
|
+
}
|
|
6622
6622
|
const ut = {
|
|
6623
6623
|
[k.WebTransport]: 0,
|
|
6624
6624
|
[k.WebSocket]: 1,
|
|
@@ -6748,7 +6748,7 @@ class Ml {
|
|
|
6748
6748
|
return this._mediaCapture;
|
|
6749
6749
|
}
|
|
6750
6750
|
constructor(e) {
|
|
6751
|
-
this.config = e, this.slowConnectionThresholdMs = e.timeouts?.slowConnectionThresholdMs ??
|
|
6751
|
+
this.config = e, this.slowConnectionThresholdMs = e.timeouts?.slowConnectionThresholdMs ?? Pa, this.connectionTimeoutMs = e.timeouts?.connectionTimeoutMs ?? Fa;
|
|
6752
6752
|
const r = [e.local, e.apiKey, e.sessionToken].filter(Boolean).length;
|
|
6753
6753
|
if (r === 0)
|
|
6754
6754
|
throw new Error('IkonClient requires one of: "local", "apiKey", or "sessionToken" configuration');
|
|
@@ -6756,19 +6756,19 @@ class Ml {
|
|
|
6756
6756
|
throw new Error('IkonClient accepts only one of: "local", "apiKey", or "sessionToken" configuration');
|
|
6757
6757
|
this.endpointSelector = new fl({
|
|
6758
6758
|
local: e.local
|
|
6759
|
-
}), this._functionRegistry = new
|
|
6759
|
+
}), this._functionRegistry = new gc(), st() && !e.disableBrowserFunctions && (this.unregisterBrowserFunctions = Sc(this._functionRegistry));
|
|
6760
6760
|
const n = e.audio ? {
|
|
6761
6761
|
performance: e.audio.performance,
|
|
6762
6762
|
background: e.audio.background,
|
|
6763
6763
|
diagnostics: e.audio.diagnostics
|
|
6764
6764
|
} : void 0, s = e.video ? { performance: e.video.performance } : void 0;
|
|
6765
|
-
this._media = new
|
|
6765
|
+
this._media = new Jc(this, { audio: n, video: s, mediaSession: e.mediaSession }), this._media.audio.setEnabled(!0), this._media.video.setEnabled(!0), st() && (this._mediaCapture = new hl(this, {
|
|
6766
6766
|
audio: {
|
|
6767
6767
|
performance: {
|
|
6768
6768
|
preferWebCodecs: e.audio?.performance?.preferWebCodecs
|
|
6769
6769
|
}
|
|
6770
6770
|
}
|
|
6771
|
-
}), this.unregisterMediaCaptureFunctions =
|
|
6771
|
+
}), this.unregisterMediaCaptureFunctions = Dc(this._functionRegistry, this));
|
|
6772
6772
|
}
|
|
6773
6773
|
_lastError = void 0;
|
|
6774
6774
|
/**
|
|
@@ -7019,11 +7019,11 @@ class Ml {
|
|
|
7019
7019
|
async authenticate() {
|
|
7020
7020
|
const e = this.abortController?.signal;
|
|
7021
7021
|
if (this.config.local)
|
|
7022
|
-
return
|
|
7022
|
+
return $a(this.config.local, e);
|
|
7023
7023
|
if (this.config.apiKey)
|
|
7024
|
-
return
|
|
7024
|
+
return Ya(this.config.apiKey, e);
|
|
7025
7025
|
if (this.config.sessionToken)
|
|
7026
|
-
return
|
|
7026
|
+
return ja(this.config.sessionToken, e);
|
|
7027
7027
|
throw new Error("No connection configuration provided (need local, apiKey, or sessionToken)");
|
|
7028
7028
|
}
|
|
7029
7029
|
/**
|
|
@@ -7123,7 +7123,7 @@ class Ml {
|
|
|
7123
7123
|
}
|
|
7124
7124
|
let r;
|
|
7125
7125
|
try {
|
|
7126
|
-
r = new
|
|
7126
|
+
r = new dl();
|
|
7127
7127
|
} catch (h) {
|
|
7128
7128
|
w.warn(`Failed to create protocol worker, falling back to main thread: ${h}`), await this.connectProtocolOnMainThread(e);
|
|
7129
7129
|
return;
|
|
@@ -7174,7 +7174,7 @@ class Ml {
|
|
|
7174
7174
|
}
|
|
7175
7175
|
}
|
|
7176
7176
|
async connectProtocolOnMainThread(e) {
|
|
7177
|
-
this.workerManagerState = null, this.protocolWorker = null, this.channelManager = new
|
|
7177
|
+
this.workerManagerState = null, this.protocolWorker = null, this.channelManager = new va({
|
|
7178
7178
|
sessionId: this._sessionId,
|
|
7179
7179
|
keepaliveTimeoutMs: this.config.timeouts?.keepaliveTimeoutMs ?? qe,
|
|
7180
7180
|
reconnectBackoffMs: this.config.timeouts?.reconnectBackoffMs ?? et,
|
|
@@ -7322,7 +7322,14 @@ class Ml {
|
|
|
7322
7322
|
* Handle external token injection from parent window.
|
|
7323
7323
|
*/
|
|
7324
7324
|
async handleExternalToken(e) {
|
|
7325
|
-
|
|
7325
|
+
if (this.currentState !== "waitingForToken")
|
|
7326
|
+
throw new Error(`Cannot connect with external token: already in state ${this.currentState}`);
|
|
7327
|
+
w.info("Connecting with external token");
|
|
7328
|
+
try {
|
|
7329
|
+
await this.executeConnection(() => Te(e, this.abortController.signal));
|
|
7330
|
+
} finally {
|
|
7331
|
+
this._externalTokenCleanup && (this._externalTokenCleanup(), this._externalTokenCleanup = null);
|
|
7332
|
+
}
|
|
7326
7333
|
}
|
|
7327
7334
|
}
|
|
7328
7335
|
function Ol(t) {
|
|
@@ -7349,7 +7356,7 @@ function pl(t) {
|
|
|
7349
7356
|
t.level < Gr || (O.push(t), O.length > Me && (O = O.slice(-Me)));
|
|
7350
7357
|
}
|
|
7351
7358
|
function Il(t) {
|
|
7352
|
-
Me = t?.maxBufferSize ?? Br, Gr = t?.minLevel ?? xr, O = [],
|
|
7359
|
+
Me = t?.maxBufferSize ?? Br, Gr = t?.minLevel ?? xr, O = [], ba(pl);
|
|
7353
7360
|
}
|
|
7354
7361
|
function Bl(t) {
|
|
7355
7362
|
Oe = t;
|
|
@@ -7376,34 +7383,34 @@ function Wl() {
|
|
|
7376
7383
|
Il();
|
|
7377
7384
|
export {
|
|
7378
7385
|
y as AuthenticationError,
|
|
7379
|
-
|
|
7380
|
-
|
|
7386
|
+
La as Channel,
|
|
7387
|
+
va as ChannelManager,
|
|
7381
7388
|
Tl as ChannelNotFoundError,
|
|
7382
7389
|
X as ClientType,
|
|
7383
7390
|
He as ConnectionError,
|
|
7384
7391
|
J as ContextType,
|
|
7385
7392
|
fl as EndpointSelector,
|
|
7386
7393
|
k as EntrypointType,
|
|
7387
|
-
|
|
7394
|
+
gc as FunctionRegistry,
|
|
7388
7395
|
bl as IKON_AUTH_BASE_URL,
|
|
7389
7396
|
nt as IKON_AUTH_URL_DEV,
|
|
7390
7397
|
rt as IKON_AUTH_URL_PROD,
|
|
7391
7398
|
pe as IKON_BACKEND_URL_DEV,
|
|
7392
7399
|
ke as IKON_BACKEND_URL_PROD,
|
|
7393
|
-
|
|
7400
|
+
rl as IkonAudioCapture,
|
|
7394
7401
|
ze as IkonAudioPlayback,
|
|
7395
7402
|
Ml as IkonClient,
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7403
|
+
ol as IkonImageCapture,
|
|
7404
|
+
Jc as IkonMedia,
|
|
7405
|
+
hl as IkonMediaCapture,
|
|
7406
|
+
ul as IkonVideoCapture,
|
|
7407
|
+
Xc as IkonVideoPlayback,
|
|
7401
7408
|
Ke as KeepaliveTimeoutError,
|
|
7402
7409
|
_r as LogLevel,
|
|
7403
|
-
|
|
7410
|
+
ga as MaxRetriesExceededError,
|
|
7404
7411
|
wl as NoChannelsError,
|
|
7405
7412
|
S as Opcode,
|
|
7406
|
-
|
|
7413
|
+
Ca as ProvisioningTimeoutError,
|
|
7407
7414
|
Sl as SpaceNotFoundError,
|
|
7408
7415
|
W as TransportError,
|
|
7409
7416
|
Z as UserType,
|
|
@@ -7436,10 +7443,10 @@ export {
|
|
|
7436
7443
|
ue as readOpcode,
|
|
7437
7444
|
ce as readOpcodeGroup,
|
|
7438
7445
|
ne as readProtocolMessageHeaders,
|
|
7439
|
-
|
|
7446
|
+
Sc as registerBrowserFunctions,
|
|
7440
7447
|
Al as setLogLevel,
|
|
7441
|
-
|
|
7448
|
+
ba as setLogSink,
|
|
7442
7449
|
Bl as setSendLogsCallback,
|
|
7443
7450
|
ml as takeBufferedLogs,
|
|
7444
|
-
|
|
7451
|
+
Cc as withResultData
|
|
7445
7452
|
};
|