@ikonai/sdk 1.11.0 → 1.11.3
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/app-messaging.d.ts +1 -1
- package/client/ikon-client.d.ts +13 -2
- package/client/ikon-client.d.ts.map +1 -1
- package/connection/urls.d.ts +8 -0
- package/connection/urls.d.ts.map +1 -1
- package/functions/browser-functions.d.ts.map +1 -1
- package/functions/media-capture-functions.d.ts.map +1 -1
- package/{ikon-media-capture-BiGydwdg.js → ikon-media-capture-4aEsbGgC.js} +2 -2
- package/index.js +1080 -1017
- package/media/ikon-audio-capture.d.ts.map +1 -1
- package/media/ikon-video-capture.d.ts.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as e, S as t, T as n, _ as r, a as i, b as a, c as o, d as s, f as c, g as l, h as u, i as d, l as f, n as p, o as m, p as h, r as g, s as ee, u as te, v as _, w as v, x as y, y as
|
|
2
|
-
import { a as
|
|
3
|
-
import { c as
|
|
4
|
-
import { $ as
|
|
1
|
+
import { C as e, S as t, T as n, _ as r, a as i, b as a, c as o, d as s, f as c, g as l, h as u, i as d, l as f, n as p, o as m, p as h, r as g, s as ee, u as te, v as _, w as v, x as y, y as b } from "./log-type-DewKVFaU.js";
|
|
2
|
+
import { a as ne, c as x, i as re, n as S, o as ie, r as ae, s as oe, t as C } from "./logger-gjegmH6K.js";
|
|
3
|
+
import { c as se, d as ce, f as le, g as ue, h as de, i as fe, n as pe, o as me, p as he, r as ge, s as _e, t as ve, u as ye } from "./capabilities-ljRyAKpA.js";
|
|
4
|
+
import { $ as be, A as xe, B as Se, C as Ce, D as we, E as Te, F as Ee, G as De, H as Oe, I as w, J as ke, K as Ae, L as je, M as Me, N as Ne, O as Pe, P as Fe, Q as Ie, R as Le, S as Re, T as ze, U as Be, V as Ve, W as He, X as Ue, Y as T, Z as We, _ as Ge, a as Ke, at as qe, b as Je, c as Ye, ct as Xe, d as Ze, et as Qe, f as $e, g as et, h as tt, i as nt, it as rt, j as it, k as at, l as ot, m as st, n as ct, nt as lt, o as ut, ot as dt, p as ft, q as pt, r as mt, rt as ht, s as gt, st as _t, t as vt, tt as yt, u as bt, v as xt, w as St, x as Ct, y as wt, z as Tt } from "./web-transport-support-Cdyk4mQe.js";
|
|
5
5
|
import { t as Et } from "./media-session-helper-Do-OxyU6.js";
|
|
6
6
|
//#region src/utils/browser-compat.ts
|
|
7
7
|
function E(e, t, n) {
|
|
@@ -442,7 +442,7 @@ function Ci(e) {
|
|
|
442
442
|
return wi(t), e && Object.assign(t, e), t;
|
|
443
443
|
}
|
|
444
444
|
function wi(e) {
|
|
445
|
-
return e.ExpiresAt = 0, e.ContextType = d.Unknown, e.UserType = c.Unknown, e.IsInternal = !1, e.UserId = "", e.AuthSessionId = "", e.IsAnonymous = !1, e.IsGlobal = !1, e.AuthProvider = "", e.SsoConnectionId = "", e.TestLinkId = "", e.TestLinkName = "", e.OpcodeGroupsFromServer =
|
|
445
|
+
return e.ExpiresAt = 0, e.ContextType = d.Unknown, e.UserType = c.Unknown, e.IsInternal = !1, e.UserId = "", e.AuthSessionId = "", e.IsAnonymous = !1, e.IsGlobal = !1, e.AuthProvider = "", e.SsoConnectionId = "", e.TestLinkId = "", e.TestLinkName = "", e.OpcodeGroupsFromServer = x.NONE, e.OpcodeGroupsToServer = x.NONE, e.Parameters = Object.create(null), e.Description = "", e.DeviceId = "", e.ProductId = "", e.VersionId = "", e.InstallId = "", e.Locale = "", e.UserAgent = "", e.ClientType = g.Unknown, e.SdkType = f.Unknown, e.SdkCapability = 0, e.ProtocolVersion = 0, e.PayloadType = o.Unknown, e.StyleFormat = s.Css, e.SupportsCompression = !0, e.HasInput = !1, e.ReceiveAllMessages = !1, e.ViewportWidth = 0, e.ViewportHeight = 0, e.Theme = "", e.Timezone = "", e.IsTouchDevice = !1, e.InitialPath = "", e.InitialUrl = "", e.IsSnapshot = !1, e.SnapshotVariant = "", e.retiredFields = void 0, e;
|
|
446
446
|
}
|
|
447
447
|
var Ti = 746516514, Ei = 877841741, Di = 1175184220, Oi = 1368629611, ki = 2341021724, Ai = 3167053791, ji = 3632106223, Mi = 3686066300;
|
|
448
448
|
function Ni(e) {
|
|
@@ -450,7 +450,7 @@ function Ni(e) {
|
|
|
450
450
|
return Pi(t), e && Object.assign(t, e), t;
|
|
451
451
|
}
|
|
452
452
|
function Pi(e) {
|
|
453
|
-
return e.Type = i.None, e.Uri = "", e.OpcodeGroupsFromServer =
|
|
453
|
+
return e.Type = i.None, e.Uri = "", e.OpcodeGroupsFromServer = x.NONE, e.OpcodeGroupsToServer = x.NONE, e.Priority = 0, e.Description = "", e.AuthTicket = /* @__PURE__ */ new Uint8Array(), e.IsUnreliable = !1, e;
|
|
454
454
|
}
|
|
455
455
|
function Fi(e, t) {
|
|
456
456
|
let n = t ?? Ni();
|
|
@@ -1601,7 +1601,7 @@ function Zl(e) {
|
|
|
1601
1601
|
return Ql(t), e && Object.assign(t, e), t;
|
|
1602
1602
|
}
|
|
1603
1603
|
function Ql(e) {
|
|
1604
|
-
return e.StreamId = "", e.ClientSessionId = 0, e.TrackId = 0, e.Info =
|
|
1604
|
+
return e.StreamId = "", e.ClientSessionId = 0, e.TrackId = 0, e.Info = he(), e;
|
|
1605
1605
|
}
|
|
1606
1606
|
function $l(e, t) {
|
|
1607
1607
|
let n = t ?? Zl();
|
|
@@ -1624,7 +1624,7 @@ function eu(e, t) {
|
|
|
1624
1624
|
break;
|
|
1625
1625
|
case Xl:
|
|
1626
1626
|
if (n.isNull) throw Error();
|
|
1627
|
-
t.Info =
|
|
1627
|
+
t.Info = de(n.asObject());
|
|
1628
1628
|
}
|
|
1629
1629
|
}
|
|
1630
1630
|
var tu = 161083277, nu = 325678206, ru = 3469892363, iu = 3645544153;
|
|
@@ -1633,7 +1633,7 @@ function au(e) {
|
|
|
1633
1633
|
return ou(t), e && Object.assign(t, e), t;
|
|
1634
1634
|
}
|
|
1635
1635
|
function ou(e) {
|
|
1636
|
-
return e.StreamId = "", e.ClientSessionId = 0, e.TrackId = 0, e.Info =
|
|
1636
|
+
return e.StreamId = "", e.ClientSessionId = 0, e.TrackId = 0, e.Info = me(), e;
|
|
1637
1637
|
}
|
|
1638
1638
|
function su(e, t) {
|
|
1639
1639
|
let n = t ?? au();
|
|
@@ -1656,7 +1656,7 @@ function cu(e, t) {
|
|
|
1656
1656
|
break;
|
|
1657
1657
|
case iu:
|
|
1658
1658
|
if (n.isNull) throw Error();
|
|
1659
|
-
t.Info =
|
|
1659
|
+
t.Info = se(n.asObject());
|
|
1660
1660
|
}
|
|
1661
1661
|
}
|
|
1662
1662
|
var lu = 65561;
|
|
@@ -1966,7 +1966,7 @@ function lf(e) {
|
|
|
1966
1966
|
return uf(t), e && Object.assign(t, e), t;
|
|
1967
1967
|
}
|
|
1968
1968
|
function uf(e) {
|
|
1969
|
-
return e.Sdp = "", e.OpcodeGroupsFromServer =
|
|
1969
|
+
return e.Sdp = "", e.OpcodeGroupsFromServer = x.NONE, e.OpcodeGroupsToServer = x.NONE, e.UseAudioTrack = !1, e.UseVideoTrack = !1, e.UseDataChannel = !1, e;
|
|
1970
1970
|
}
|
|
1971
1971
|
function df(e) {
|
|
1972
1972
|
let t = new r(1);
|
|
@@ -2081,7 +2081,7 @@ function Wf(e, t, n) {
|
|
|
2081
2081
|
}
|
|
2082
2082
|
//#endregion
|
|
2083
2083
|
//#region src/webrtc/webrtc-config.ts
|
|
2084
|
-
var Gf = "opus", Kf = 48e3, qf = 2, Jf = 64e3, Yf = 150, Xf = "VP8", Zf = 5e6, Qf = 30, $f = .05, ep = "max-bundle", tp = "require", np = 5e3, rp = 8e3, ip = 16, ap = 16, op = "ikon-data", sp = !1, cp = 0, D =
|
|
2084
|
+
var Gf = "opus", Kf = 48e3, qf = 2, Jf = 64e3, Yf = 150, Xf = "VP8", Zf = 5e6, Qf = 30, $f = .05, ep = "max-bundle", tp = "require", np = 5e3, rp = 8e3, ip = 16, ap = 16, op = "ikon-data", sp = !1, cp = 0, D = S("WebRTCConnection"), lp = class {
|
|
2085
2085
|
pc = null;
|
|
2086
2086
|
dataChannel = null;
|
|
2087
2087
|
_state = "new";
|
|
@@ -2234,7 +2234,7 @@ var Gf = "opus", Kf = 48e3, qf = 2, Jf = 64e3, Yf = 150, Xf = "VP8", Zf = 5e6, Q
|
|
|
2234
2234
|
setState(e) {
|
|
2235
2235
|
this._state !== e && (this._state = e, this.config.onStateChange?.(e));
|
|
2236
2236
|
}
|
|
2237
|
-
}, O =
|
|
2237
|
+
}, O = S("WebRTCSignaling"), up = class {
|
|
2238
2238
|
onAudioCaptureError = null;
|
|
2239
2239
|
config;
|
|
2240
2240
|
connection = null;
|
|
@@ -2295,7 +2295,7 @@ var Gf = "opus", Kf = 48e3, qf = 2, Jf = 64e3, Yf = 150, Xf = "VP8", Zf = 5e6, Q
|
|
|
2295
2295
|
}
|
|
2296
2296
|
}
|
|
2297
2297
|
handleProtocolMessage(e) {
|
|
2298
|
-
let t = (e instanceof Uint8Array, e), n =
|
|
2298
|
+
let t = (e instanceof Uint8Array, e), n = b(t);
|
|
2299
2299
|
switch (y(n)) {
|
|
2300
2300
|
case qd: return this.handleIceServersResponse(n), !0;
|
|
2301
2301
|
case ld: return this.handleAnswer(n), !0;
|
|
@@ -2350,7 +2350,7 @@ var Gf = "opus", Kf = 48e3, qf = 2, Jf = 64e3, Yf = 150, Xf = "VP8", Zf = 5e6, Q
|
|
|
2350
2350
|
this.audioSegmentActive = !0;
|
|
2351
2351
|
let t = this.audioCaptureStream?.getAudioTracks()[0];
|
|
2352
2352
|
t && t.readyState === "live" ? t.enabled = !0 : this.acquireAudioTrack().then((e) => {
|
|
2353
|
-
e && (this.audioSegmentActive ? e.enabled = !0 :
|
|
2353
|
+
e && (this.audioSegmentActive ? e.enabled = !0 : ge() && this.releaseAudioTrack());
|
|
2354
2354
|
}).catch((t) => {
|
|
2355
2355
|
O.warn(`Failed to re-acquire microphone for audio segment, ending the segment: ${String(t)}`), this.audioSegmentActive && this.endAudioSegment(e), this.onAudioCaptureError?.(t instanceof Error ? t : Error(String(t)));
|
|
2356
2356
|
});
|
|
@@ -2372,7 +2372,7 @@ var Gf = "opus", Kf = 48e3, qf = 2, Jf = 64e3, Yf = 150, Xf = "VP8", Zf = 5e6, Q
|
|
|
2372
2372
|
}), this.config.sessionId);
|
|
2373
2373
|
this.sendMessage(t);
|
|
2374
2374
|
let n = this.audioCaptureStream?.getAudioTracks()[0];
|
|
2375
|
-
n && (n.enabled = !1,
|
|
2375
|
+
n && (n.enabled = !1, ge() && this.releaseAudioTrack()), O.debug("Ended audio segment");
|
|
2376
2376
|
}
|
|
2377
2377
|
async acquireAudioTrack() {
|
|
2378
2378
|
let e = await navigator.mediaDevices.getUserMedia({
|
|
@@ -2448,7 +2448,7 @@ var Gf = "opus", Kf = 48e3, qf = 2, Jf = 64e3, Yf = 150, Xf = "VP8", Zf = 5e6, Q
|
|
|
2448
2448
|
}
|
|
2449
2449
|
sendVideoStreamBegin(e, t, n, r, i, a) {
|
|
2450
2450
|
if (!this.sendMessage) return;
|
|
2451
|
-
let o =
|
|
2451
|
+
let o = me({
|
|
2452
2452
|
StreamId: `webrtc_video_${this.config.sessionId}_${t}`,
|
|
2453
2453
|
Description: `webrtc_${e}`,
|
|
2454
2454
|
SourceType: e,
|
|
@@ -2459,12 +2459,12 @@ var Gf = "opus", Kf = 48e3, qf = 2, Jf = 64e3, Yf = 150, Xf = "VP8", Zf = 5e6, Q
|
|
|
2459
2459
|
Framerate: i,
|
|
2460
2460
|
CorrelationId: a
|
|
2461
2461
|
});
|
|
2462
|
-
this.sendMessage(
|
|
2462
|
+
this.sendMessage(ye(o, this.config.sessionId, { trackId: t }));
|
|
2463
2463
|
}
|
|
2464
2464
|
sendVideoStreamEnd(e) {
|
|
2465
2465
|
if (!this.sendMessage) return;
|
|
2466
|
-
let t =
|
|
2467
|
-
this.sendMessage(
|
|
2466
|
+
let t = _e({});
|
|
2467
|
+
this.sendMessage(ce(t, this.config.sessionId, { trackId: e }));
|
|
2468
2468
|
}
|
|
2469
2469
|
stopAudioCapture() {
|
|
2470
2470
|
this.audioSegmentActive = !1, this.releaseAudioTrack(), this.audioCaptureConstraints = void 0, O.debug("Stopped audio capture");
|
|
@@ -2578,7 +2578,7 @@ var Gf = "opus", Kf = 48e3, qf = 2, Jf = 64e3, Yf = 150, Xf = "VP8", Zf = 5e6, Q
|
|
|
2578
2578
|
O.error("Failed to handle WebRTC track map:", e);
|
|
2579
2579
|
}
|
|
2580
2580
|
}
|
|
2581
|
-
}, dp =
|
|
2581
|
+
}, dp = S("WebRtcReachability"), fp = "ikon-webrtc-reachability", pp = /* @__PURE__ */ new Set([
|
|
2582
2582
|
"direct",
|
|
2583
2583
|
"relay",
|
|
2584
2584
|
"failed"
|
|
@@ -2670,7 +2670,7 @@ var kp = {
|
|
|
2670
2670
|
i.WebTransport,
|
|
2671
2671
|
i.WebSocket,
|
|
2672
2672
|
i.HttpStream
|
|
2673
|
-
]), Mp = /* @__PURE__ */ new Set([i.WebSocket, i.WebSocketProxy]), Np = /* @__PURE__ */ new Set([i.WebTransport, i.WebTransportProxy]), Pp = /* @__PURE__ */ new Set([i.HttpStream, i.HttpStreamProxy]), A =
|
|
2673
|
+
]), Mp = /* @__PURE__ */ new Set([i.WebSocket, i.WebSocketProxy]), Np = /* @__PURE__ */ new Set([i.WebTransport, i.WebTransportProxy]), Pp = /* @__PURE__ */ new Set([i.HttpStream, i.HttpStreamProxy]), A = S("EndpointSelector"), Fp = "ikon-endpoint-type", Ip = "ikon-proxy-preferred", Lp = "ikon-connect-tier", Rp = "ikon-httpstream-mode", zp = "ikon-endpoint-timestamp", Bp = "ikon-endpoint-revalidated", Vp = 864e5, Hp = class {
|
|
2674
2674
|
isLocal;
|
|
2675
2675
|
_proxyMode;
|
|
2676
2676
|
_websocket;
|
|
@@ -2907,7 +2907,7 @@ function tm(e) {
|
|
|
2907
2907
|
}
|
|
2908
2908
|
//#endregion
|
|
2909
2909
|
//#region src/connection/urls.ts
|
|
2910
|
-
var nm =
|
|
2910
|
+
var nm = S("Urls"), rm = "https://api.prod.ikon.live", im = "https://api.dev.ikon.live", am = "https://auth.ikonai.com", om = "https://auth.dev.ikonai.com", sm = "https://auth.ikonai.com", cm = [
|
|
2911
2911
|
".ikonai.app",
|
|
2912
2912
|
".ikonai.com",
|
|
2913
2913
|
".ikon.live"
|
|
@@ -2931,7 +2931,7 @@ async function fm() {
|
|
|
2931
2931
|
})(), dm));
|
|
2932
2932
|
}
|
|
2933
2933
|
function pm() {
|
|
2934
|
-
return typeof window > "u" ||
|
|
2934
|
+
return typeof window > "u" || je() === !1 ? !1 : N();
|
|
2935
2935
|
}
|
|
2936
2936
|
function mm() {
|
|
2937
2937
|
return pm() ? `${window.location.origin}/ikon/api` : null;
|
|
@@ -2981,7 +2981,7 @@ async function bm(e) {
|
|
|
2981
2981
|
return e.startsWith("/") ? typeof window > "u" ? await Sm() : `${window.location.origin}${e}` : e;
|
|
2982
2982
|
}
|
|
2983
2983
|
async function xm(e) {
|
|
2984
|
-
if (
|
|
2984
|
+
if (je() === !0) {
|
|
2985
2985
|
let e = hm();
|
|
2986
2986
|
if (e) return e;
|
|
2987
2987
|
}
|
|
@@ -3007,25 +3007,30 @@ function Cm() {
|
|
|
3007
3007
|
for (let [n, r] of e.entries()) t[n] = r;
|
|
3008
3008
|
return t;
|
|
3009
3009
|
}
|
|
3010
|
-
|
|
3010
|
+
function wm() {
|
|
3011
|
+
let e = {};
|
|
3012
|
+
for (let [t, n] of Object.entries(Cm())) (!Nm(t) || t === "ikon-debug") && (e[t] = n);
|
|
3013
|
+
return e;
|
|
3014
|
+
}
|
|
3015
|
+
var Tm = [
|
|
3011
3016
|
st,
|
|
3012
3017
|
Ze,
|
|
3013
3018
|
ft,
|
|
3014
3019
|
"error"
|
|
3015
|
-
],
|
|
3016
|
-
function
|
|
3020
|
+
], Em = [xt, xt.replace(/-/g, "_")];
|
|
3021
|
+
function Dm() {
|
|
3017
3022
|
let e = window.location.pathname.match(/^\/(s|c)\/([^/]+)(.*)$/);
|
|
3018
3023
|
if (!e) return;
|
|
3019
3024
|
let t = new URL(window.location.href);
|
|
3020
3025
|
t.pathname = e[3] || "/", t.searchParams.set(xt, decodeURIComponent(e[2])), window.history.replaceState(null, "", t.toString());
|
|
3021
3026
|
}
|
|
3022
|
-
function
|
|
3027
|
+
function Om() {
|
|
3023
3028
|
if (typeof window > "u") return { parameters: {} };
|
|
3024
|
-
|
|
3029
|
+
Dm();
|
|
3025
3030
|
let e = Cm(), t = {};
|
|
3026
|
-
for (let [n, r] of Object.entries(e)) !
|
|
3031
|
+
for (let [n, r] of Object.entries(e)) !Tm.includes(n) && !Em.includes(n) && (t[n] = r);
|
|
3027
3032
|
return {
|
|
3028
|
-
sessionIdentityHash:
|
|
3033
|
+
sessionIdentityHash: Le() ?? void 0,
|
|
3029
3034
|
parameters: t
|
|
3030
3035
|
};
|
|
3031
3036
|
}
|
|
@@ -3039,64 +3044,68 @@ function N() {
|
|
|
3039
3044
|
}
|
|
3040
3045
|
return !0;
|
|
3041
3046
|
}
|
|
3042
|
-
function
|
|
3047
|
+
function km() {
|
|
3043
3048
|
if (typeof window > "u") return "";
|
|
3044
|
-
let e = window.location.pathname || "/", t =
|
|
3049
|
+
let e = window.location.pathname || "/", t = Mm(window.location.search);
|
|
3045
3050
|
return t.length > 0 ? `${e}?${t}` : e;
|
|
3046
3051
|
}
|
|
3047
|
-
function
|
|
3052
|
+
function Am() {
|
|
3048
3053
|
if (typeof window > "u") return "";
|
|
3049
3054
|
let e = window.location.origin;
|
|
3050
|
-
return !e || e === "null" ? "" : `${e}${
|
|
3055
|
+
return !e || e === "null" ? "" : `${e}${km()}`;
|
|
3051
3056
|
}
|
|
3052
|
-
function
|
|
3057
|
+
function jm() {
|
|
3053
3058
|
if (typeof window > "u") return "";
|
|
3054
3059
|
let e = new URL(window.location.href);
|
|
3055
|
-
for (let t of
|
|
3060
|
+
for (let t of Em) e.searchParams.delete(t);
|
|
3056
3061
|
return e.toString();
|
|
3057
3062
|
}
|
|
3058
|
-
function
|
|
3063
|
+
function Mm(e) {
|
|
3059
3064
|
let t = new URLSearchParams(e);
|
|
3060
|
-
for (let e of [...t.keys()]) (e
|
|
3065
|
+
for (let e of [...t.keys()]) Nm(e) && t.delete(e);
|
|
3061
3066
|
return t.toString();
|
|
3062
3067
|
}
|
|
3068
|
+
function Nm(e) {
|
|
3069
|
+
let t = e.toLowerCase();
|
|
3070
|
+
return t.startsWith("ikon-") || t.startsWith("ikon_");
|
|
3071
|
+
}
|
|
3063
3072
|
//#endregion
|
|
3064
3073
|
//#region src/utils/pkce.ts
|
|
3065
|
-
var
|
|
3066
|
-
function
|
|
3074
|
+
var Pm = "ikon-auth-pkce-verifier";
|
|
3075
|
+
function Fm(e) {
|
|
3067
3076
|
let t = e instanceof Uint8Array ? e : new Uint8Array(e), n = "";
|
|
3068
3077
|
for (let e of t) n += String.fromCharCode(e);
|
|
3069
3078
|
return btoa(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
3070
3079
|
}
|
|
3071
|
-
function
|
|
3080
|
+
function Im() {
|
|
3072
3081
|
return typeof window < "u" && !!window.crypto?.subtle && !!window.sessionStorage;
|
|
3073
3082
|
}
|
|
3074
|
-
async function
|
|
3075
|
-
if (!
|
|
3083
|
+
async function Lm() {
|
|
3084
|
+
if (!Im()) return null;
|
|
3076
3085
|
try {
|
|
3077
|
-
let e =
|
|
3078
|
-
return window.sessionStorage.setItem(
|
|
3086
|
+
let e = Fm(window.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(32))), t = await window.crypto.subtle.digest("SHA-256", new TextEncoder().encode(e));
|
|
3087
|
+
return window.sessionStorage.setItem(Pm, e), Fm(t);
|
|
3079
3088
|
} catch {
|
|
3080
3089
|
return null;
|
|
3081
3090
|
}
|
|
3082
3091
|
}
|
|
3083
|
-
function
|
|
3092
|
+
function Rm(e) {
|
|
3084
3093
|
try {
|
|
3085
|
-
window.sessionStorage.setItem(
|
|
3094
|
+
window.sessionStorage.setItem(Pm, e);
|
|
3086
3095
|
} catch {}
|
|
3087
3096
|
}
|
|
3088
|
-
function
|
|
3097
|
+
function zm() {
|
|
3089
3098
|
try {
|
|
3090
|
-
let e = window.sessionStorage.getItem(
|
|
3091
|
-
return window.sessionStorage.removeItem(
|
|
3099
|
+
let e = window.sessionStorage.getItem(Pm);
|
|
3100
|
+
return window.sessionStorage.removeItem(Pm), e;
|
|
3092
3101
|
} catch {
|
|
3093
3102
|
return null;
|
|
3094
3103
|
}
|
|
3095
3104
|
}
|
|
3096
3105
|
//#endregion
|
|
3097
3106
|
//#region src/utils/embedded-oauth.ts
|
|
3098
|
-
var
|
|
3099
|
-
function
|
|
3107
|
+
var Bm = S("EmbeddedAuth"), Vm = "/oauth/popup-callback", Hm = "ikon-oauth-embedder-request", Um = "ikon-oauth-embedder-claim", Wm = /* @__PURE__ */ new Set(), Gm = 800, Km = 3e5;
|
|
3108
|
+
function qm() {
|
|
3100
3109
|
if (typeof window > "u") return !1;
|
|
3101
3110
|
try {
|
|
3102
3111
|
return window.top !== window.self;
|
|
@@ -3104,8 +3113,8 @@ function Gm() {
|
|
|
3104
3113
|
return !0;
|
|
3105
3114
|
}
|
|
3106
3115
|
}
|
|
3107
|
-
async function
|
|
3108
|
-
let n = await
|
|
3116
|
+
async function Jm(e, t) {
|
|
3117
|
+
let n = await Lm(), r = zm();
|
|
3109
3118
|
return await new Promise((i) => {
|
|
3110
3119
|
let a = !1, o = (e) => {
|
|
3111
3120
|
a || (a = !0, window.removeEventListener("message", s), window.clearTimeout(c), i(e));
|
|
@@ -3116,30 +3125,30 @@ async function Km(e, t) {
|
|
|
3116
3125
|
};
|
|
3117
3126
|
window.addEventListener("message", s), window.parent.postMessage({
|
|
3118
3127
|
source: "ikon-oauth",
|
|
3119
|
-
type:
|
|
3128
|
+
type: Hm,
|
|
3120
3129
|
provider: e,
|
|
3121
3130
|
spaceId: t,
|
|
3122
3131
|
codeChallenge: n,
|
|
3123
3132
|
codeVerifier: r
|
|
3124
3133
|
}, "*");
|
|
3125
|
-
let c = window.setTimeout(() => o(!1),
|
|
3134
|
+
let c = window.setTimeout(() => o(!1), Gm);
|
|
3126
3135
|
});
|
|
3127
3136
|
}
|
|
3128
|
-
async function
|
|
3129
|
-
if (await
|
|
3137
|
+
async function Ym(e, t) {
|
|
3138
|
+
if (await Jm(e, t)) return !0;
|
|
3130
3139
|
try {
|
|
3131
|
-
let { code: n, provider: r } = await
|
|
3140
|
+
let { code: n, provider: r } = await Xm(window.open("about:blank", "ikon-oauth", "popup,width=520,height=680"), e, t), i = new URL(window.location.href);
|
|
3132
3141
|
return i.searchParams.set(Ze, n), i.searchParams.set(ft, r), window.location.replace(i.toString()), !0;
|
|
3133
3142
|
} catch (t) {
|
|
3134
|
-
return
|
|
3143
|
+
return Bm.warn(`Embedded sign-in with ${e} did not complete: ${t instanceof Error ? t.message : String(t)}`), !1;
|
|
3135
3144
|
}
|
|
3136
3145
|
}
|
|
3137
|
-
async function
|
|
3146
|
+
async function Xm(e, t, n) {
|
|
3138
3147
|
if (!e) throw Error("The sign-in window was blocked. Allow pop-ups for this site and try again.");
|
|
3139
3148
|
let r;
|
|
3140
3149
|
try {
|
|
3141
3150
|
r = await Sm();
|
|
3142
|
-
let i = `${r}${
|
|
3151
|
+
let i = `${r}${Vm}`, a = await Lm(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
|
|
3143
3152
|
e.location.href = `${r}/oauth/${encodeURIComponent(t)}?space=${encodeURIComponent(n)}&return=${encodeURIComponent(i)}${o}`;
|
|
3144
3153
|
} catch (t) {
|
|
3145
3154
|
throw e.close(), t;
|
|
@@ -3169,15 +3178,15 @@ async function Jm(e, t, n) {
|
|
|
3169
3178
|
o(() => {
|
|
3170
3179
|
e.close(), r(/* @__PURE__ */ Error("The sign-in timed out"));
|
|
3171
3180
|
});
|
|
3172
|
-
},
|
|
3181
|
+
}, Km);
|
|
3173
3182
|
});
|
|
3174
3183
|
}
|
|
3175
|
-
function
|
|
3176
|
-
if (typeof window > "u" || !
|
|
3184
|
+
function Zm(e, t) {
|
|
3185
|
+
if (typeof window > "u" || !qm()) return () => void 0;
|
|
3177
3186
|
let n = (e) => {
|
|
3178
3187
|
if (e.source !== window.parent) return;
|
|
3179
3188
|
let n = e.data;
|
|
3180
|
-
n?.source !== "ikon-oauth" || n.type !== "ikon-oauth-embedder-result" || typeof n.code != "string" || !n.code ||
|
|
3189
|
+
n?.source !== "ikon-oauth" || n.type !== "ikon-oauth-embedder-result" || typeof n.code != "string" || !n.code || Wm.has(n.code) || (Wm.add(n.code), t({
|
|
3181
3190
|
code: n.code,
|
|
3182
3191
|
provider: typeof n.provider == "string" ? n.provider : "",
|
|
3183
3192
|
codeVerifier: typeof n.codeVerifier == "string" ? n.codeVerifier : null
|
|
@@ -3185,60 +3194,60 @@ function Ym(e, t) {
|
|
|
3185
3194
|
};
|
|
3186
3195
|
return window.addEventListener("message", n), window.parent.postMessage({
|
|
3187
3196
|
source: "ikon-oauth",
|
|
3188
|
-
type:
|
|
3197
|
+
type: Um,
|
|
3189
3198
|
spaceId: e
|
|
3190
3199
|
}, "*"), () => window.removeEventListener("message", n);
|
|
3191
3200
|
}
|
|
3192
|
-
function
|
|
3201
|
+
function Qm() {
|
|
3193
3202
|
if (typeof window > "u") return;
|
|
3194
3203
|
let e = new URLSearchParams(window.location.search).get($e);
|
|
3195
|
-
e &&
|
|
3204
|
+
e && Rm(e);
|
|
3196
3205
|
}
|
|
3197
3206
|
//#endregion
|
|
3198
3207
|
//#region src/utils/oauth-start-url.ts
|
|
3199
|
-
var
|
|
3200
|
-
function
|
|
3208
|
+
var $m = "sso:";
|
|
3209
|
+
function eh(e) {
|
|
3201
3210
|
if (!e.startsWith("sso:")) return;
|
|
3202
3211
|
let t = e.slice(4);
|
|
3203
3212
|
return t.length > 0 ? t : void 0;
|
|
3204
3213
|
}
|
|
3205
|
-
function
|
|
3206
|
-
let t =
|
|
3214
|
+
function th(e) {
|
|
3215
|
+
let t = eh(e.provider), n = t ? "/oauth/sso" : `/oauth/${encodeURIComponent(e.provider)}`, r = new URLSearchParams();
|
|
3207
3216
|
return t && r.set("connection", t), r.set("space", e.spaceId), r.set("return", e.returnUrl), e.codeChallenge && r.set("code_challenge", e.codeChallenge), t && e.linkTicket && r.set("link_ticket", e.linkTicket), `${e.authUrl}${n}?${r.toString()}`;
|
|
3208
3217
|
}
|
|
3209
3218
|
//#endregion
|
|
3210
3219
|
//#region src/utils/user-gesture.ts
|
|
3211
|
-
function
|
|
3220
|
+
function nh(e) {
|
|
3212
3221
|
if (!e || typeof e != "object") return !1;
|
|
3213
3222
|
let t = e, n = typeof t.name == "string" ? t.name : "", r = typeof t.message == "string" ? t.message : "";
|
|
3214
3223
|
return !!(n === "NotAllowedError" || n === "SecurityError" || r.toLowerCase().includes("permission") || r.toLowerCase().includes("user gesture"));
|
|
3215
3224
|
}
|
|
3216
3225
|
//#endregion
|
|
3217
3226
|
//#region src/utils/app-routes.ts
|
|
3218
|
-
var
|
|
3219
|
-
function
|
|
3227
|
+
var rh = ["/ikon", "/api"];
|
|
3228
|
+
function ih(e) {
|
|
3220
3229
|
if (!e) return !1;
|
|
3221
3230
|
let t = e.split(/[?#]/)[0], n = t.startsWith("/") ? t : "/" + t;
|
|
3222
|
-
return
|
|
3231
|
+
return rh.some((e) => n === e || n.startsWith(e + "/"));
|
|
3223
3232
|
}
|
|
3224
3233
|
//#endregion
|
|
3225
3234
|
//#region src/functions/browser-functions.ts
|
|
3226
|
-
var P =
|
|
3227
|
-
function
|
|
3228
|
-
|
|
3229
|
-
e.data?.type ===
|
|
3235
|
+
var P = S("BrowserFunctions"), ah = "ikon-theme", oh = "ikon-theme-user", sh = "ikon-theme-change", ch = "ikon-set-theme", lh = !1;
|
|
3236
|
+
function uh() {
|
|
3237
|
+
lh || typeof window > "u" || window.parent === window || (lh = !0, window.addEventListener("message", (e) => {
|
|
3238
|
+
e.data?.type === ch && yh((typeof e.data.theme == "string" ? e.data.theme.trim().toLowerCase() : "") || fh(), !1);
|
|
3230
3239
|
}));
|
|
3231
3240
|
}
|
|
3232
|
-
function
|
|
3241
|
+
function dh(e) {
|
|
3233
3242
|
typeof document < "u" && document.documentElement && document.documentElement.setAttribute("data-theme", e);
|
|
3234
3243
|
}
|
|
3235
|
-
function
|
|
3244
|
+
function fh() {
|
|
3236
3245
|
return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
3237
3246
|
}
|
|
3238
|
-
function
|
|
3239
|
-
return typeof window > "u" || !window.localStorage ? "light" : window.localStorage.getItem(
|
|
3247
|
+
function ph() {
|
|
3248
|
+
return typeof window > "u" || !window.localStorage ? "light" : window.localStorage.getItem(oh) || window.localStorage.getItem(ah) || fh();
|
|
3240
3249
|
}
|
|
3241
|
-
function
|
|
3250
|
+
function mh() {
|
|
3242
3251
|
return typeof window > "u" ? {
|
|
3243
3252
|
width: 0,
|
|
3244
3253
|
height: 0
|
|
@@ -3247,18 +3256,18 @@ function fh() {
|
|
|
3247
3256
|
height: window.innerHeight
|
|
3248
3257
|
};
|
|
3249
3258
|
}
|
|
3250
|
-
function
|
|
3259
|
+
function hh() {
|
|
3251
3260
|
if (typeof window > "u" || !window.localStorage) return "light";
|
|
3252
|
-
|
|
3253
|
-
let e = window.localStorage.getItem(
|
|
3261
|
+
uh();
|
|
3262
|
+
let e = window.localStorage.getItem(oh), t = window.localStorage.getItem(ah);
|
|
3254
3263
|
if (e || t) {
|
|
3255
3264
|
let n = e ?? t;
|
|
3256
|
-
return
|
|
3265
|
+
return dh(n), n;
|
|
3257
3266
|
}
|
|
3258
|
-
let n =
|
|
3259
|
-
return window.localStorage.setItem(
|
|
3267
|
+
let n = fh();
|
|
3268
|
+
return window.localStorage.setItem(ah, n), dh(n), n;
|
|
3260
3269
|
}
|
|
3261
|
-
var
|
|
3270
|
+
var gh = {
|
|
3262
3271
|
name: "ikon.client.getTheme",
|
|
3263
3272
|
description: "Get the currently selected client theme",
|
|
3264
3273
|
returnType: {
|
|
@@ -3266,12 +3275,12 @@ var mh = {
|
|
|
3266
3275
|
nullable: !0
|
|
3267
3276
|
}
|
|
3268
3277
|
};
|
|
3269
|
-
function
|
|
3278
|
+
function _h() {
|
|
3270
3279
|
if (typeof window > "u" || !window.localStorage) return null;
|
|
3271
|
-
let e = window.localStorage.getItem(
|
|
3280
|
+
let e = window.localStorage.getItem(oh), t = window.localStorage.getItem(ah);
|
|
3272
3281
|
return e ?? t ?? null;
|
|
3273
3282
|
}
|
|
3274
|
-
var
|
|
3283
|
+
var vh = {
|
|
3275
3284
|
name: "ikon.client.setTheme",
|
|
3276
3285
|
description: "Update the client UI theme",
|
|
3277
3286
|
returnType: { kind: "boolean" },
|
|
@@ -3288,38 +3297,38 @@ var gh = {
|
|
|
3288
3297
|
description: "Whether to persist as user preference"
|
|
3289
3298
|
}]
|
|
3290
3299
|
};
|
|
3291
|
-
function
|
|
3300
|
+
function yh(e, t) {
|
|
3292
3301
|
if (typeof window > "u" || !window.localStorage || typeof e != "string") return !1;
|
|
3293
3302
|
let n = e.trim().toLowerCase();
|
|
3294
3303
|
if (!n) return !1;
|
|
3295
3304
|
let r = t === void 0 || !!t, i = window.localStorage;
|
|
3296
|
-
r ? i.setItem(
|
|
3305
|
+
r ? i.setItem(oh, n) : i.removeItem(oh), i.setItem(ah, n);
|
|
3297
3306
|
try {
|
|
3298
|
-
window.dispatchEvent(new CustomEvent(
|
|
3307
|
+
window.dispatchEvent(new CustomEvent(sh, { detail: { mode: n } }));
|
|
3299
3308
|
} catch {}
|
|
3300
|
-
return
|
|
3309
|
+
return dh(n), !0;
|
|
3301
3310
|
}
|
|
3302
|
-
var
|
|
3311
|
+
var bh = {
|
|
3303
3312
|
name: "ikon.client.getLanguage",
|
|
3304
3313
|
description: "Get the browser language preference",
|
|
3305
3314
|
returnType: { kind: "string" }
|
|
3306
3315
|
};
|
|
3307
|
-
function
|
|
3316
|
+
function xh() {
|
|
3308
3317
|
return typeof navigator > "u" ? "en-US" : navigator.language || "en-US";
|
|
3309
3318
|
}
|
|
3310
|
-
var
|
|
3319
|
+
var Sh = {
|
|
3311
3320
|
name: "ikon.client.getTimezone",
|
|
3312
3321
|
description: "Get the browser timezone (IANA format)",
|
|
3313
3322
|
returnType: { kind: "string" }
|
|
3314
3323
|
};
|
|
3315
|
-
function
|
|
3324
|
+
function Ch() {
|
|
3316
3325
|
try {
|
|
3317
3326
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
3318
3327
|
} catch {
|
|
3319
3328
|
return "UTC";
|
|
3320
3329
|
}
|
|
3321
3330
|
}
|
|
3322
|
-
function
|
|
3331
|
+
function wh() {
|
|
3323
3332
|
if (typeof Intl > "u") return "";
|
|
3324
3333
|
try {
|
|
3325
3334
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
@@ -3327,15 +3336,15 @@ function Sh() {
|
|
|
3327
3336
|
return "";
|
|
3328
3337
|
}
|
|
3329
3338
|
}
|
|
3330
|
-
function
|
|
3339
|
+
function Th() {
|
|
3331
3340
|
return typeof navigator > "u" ? !1 : navigator.maxTouchPoints > 0;
|
|
3332
3341
|
}
|
|
3333
|
-
function
|
|
3342
|
+
function Eh() {
|
|
3334
3343
|
if (typeof navigator > "u" || typeof window > "u") return g.Unknown;
|
|
3335
3344
|
let e = navigator.maxTouchPoints > 0, t = window.innerWidth <= 1024;
|
|
3336
3345
|
return e && t ? g.MobileWeb : g.DesktopWeb;
|
|
3337
3346
|
}
|
|
3338
|
-
var
|
|
3347
|
+
var Dh = {
|
|
3339
3348
|
name: "ikon.client.getUrl",
|
|
3340
3349
|
description: "Get the current browser URL path and query string",
|
|
3341
3350
|
returnType: {
|
|
@@ -3343,10 +3352,10 @@ var Th = {
|
|
|
3343
3352
|
nullable: !0
|
|
3344
3353
|
}
|
|
3345
3354
|
};
|
|
3346
|
-
function
|
|
3355
|
+
function Oh() {
|
|
3347
3356
|
return typeof window > "u" ? null : window.location.pathname + window.location.search;
|
|
3348
3357
|
}
|
|
3349
|
-
var
|
|
3358
|
+
var kh = {
|
|
3350
3359
|
name: "ikon.client.setUrl",
|
|
3351
3360
|
description: "Update the browser URL without triggering a page reload",
|
|
3352
3361
|
returnType: { kind: "boolean" },
|
|
@@ -3374,10 +3383,10 @@ var Dh = {
|
|
|
3374
3383
|
}
|
|
3375
3384
|
]
|
|
3376
3385
|
};
|
|
3377
|
-
function
|
|
3386
|
+
function Ah(e, t, n) {
|
|
3378
3387
|
if (typeof window > "u" || !window.history || typeof e != "string") return !1;
|
|
3379
3388
|
let r = e.trim();
|
|
3380
|
-
if (!r || /^[a-z][a-z0-9+.-]*:/i.test(r) || r.startsWith("//") ||
|
|
3389
|
+
if (!r || /^[a-z][a-z0-9+.-]*:/i.test(r) || r.startsWith("//") || ih(r)) return !1;
|
|
3381
3390
|
try {
|
|
3382
3391
|
let e = !!t, i = n && !r.includes("?") ? r + window.location.search : r;
|
|
3383
3392
|
return e ? window.history.replaceState(null, "", i) : window.history.pushState(null, "", i), !0;
|
|
@@ -3385,7 +3394,7 @@ function Oh(e, t, n) {
|
|
|
3385
3394
|
return !1;
|
|
3386
3395
|
}
|
|
3387
3396
|
}
|
|
3388
|
-
var
|
|
3397
|
+
var jh = {
|
|
3389
3398
|
name: "ikon.client.openExternalUrl",
|
|
3390
3399
|
description: "Open an external URL in a new browser tab",
|
|
3391
3400
|
returnType: { kind: "boolean" },
|
|
@@ -3395,7 +3404,7 @@ var kh = {
|
|
|
3395
3404
|
description: "The URL to open. Must be absolute (e.g., starts with https://)."
|
|
3396
3405
|
}]
|
|
3397
3406
|
};
|
|
3398
|
-
function
|
|
3407
|
+
function Mh(e) {
|
|
3399
3408
|
if (typeof window > "u" || typeof window.open != "function" || typeof e != "string") return !1;
|
|
3400
3409
|
let t = e.trim();
|
|
3401
3410
|
if (!t || /^javascript:/i.test(t)) return !1;
|
|
@@ -3405,7 +3414,7 @@ function Ah(e) {
|
|
|
3405
3414
|
return !1;
|
|
3406
3415
|
}
|
|
3407
3416
|
}
|
|
3408
|
-
var
|
|
3417
|
+
var Nh = {
|
|
3409
3418
|
name: "ikon.client.navigateTo",
|
|
3410
3419
|
description: "Leave the app for an absolute http(s) URL in this tab. The page unloads and the client session ends; the platform's step-up and signing ceremonies use it and come back through a landing route.",
|
|
3411
3420
|
returnType: { kind: "boolean" },
|
|
@@ -3415,12 +3424,12 @@ var jh = {
|
|
|
3415
3424
|
description: "The absolute http(s) URL to go to."
|
|
3416
3425
|
}]
|
|
3417
3426
|
};
|
|
3418
|
-
function
|
|
3427
|
+
function Ph(e) {
|
|
3419
3428
|
if (typeof window > "u" || typeof e != "string") return !1;
|
|
3420
3429
|
let t = e.trim();
|
|
3421
3430
|
return /^https?:\/\//i.test(t) ? (window.location.assign(t), !0) : !1;
|
|
3422
3431
|
}
|
|
3423
|
-
var
|
|
3432
|
+
var Fh = {
|
|
3424
3433
|
name: "ikon.client.vibrate",
|
|
3425
3434
|
description: "Trigger haptic feedback on supported devices",
|
|
3426
3435
|
returnType: { kind: "boolean" },
|
|
@@ -3430,7 +3439,7 @@ var Nh = {
|
|
|
3430
3439
|
description: "Duration in ms, or comma-separated pattern (e.g., \"200\" or \"100,50,100\")"
|
|
3431
3440
|
}]
|
|
3432
3441
|
};
|
|
3433
|
-
function
|
|
3442
|
+
function Ih(e) {
|
|
3434
3443
|
if (typeof navigator > "u" || !navigator.vibrate || typeof e != "string") return !1;
|
|
3435
3444
|
try {
|
|
3436
3445
|
let t = e.split(",").map((e) => parseInt(e.trim(), 10));
|
|
@@ -3439,16 +3448,16 @@ function Ph(e) {
|
|
|
3439
3448
|
return !1;
|
|
3440
3449
|
}
|
|
3441
3450
|
}
|
|
3442
|
-
var F = null,
|
|
3443
|
-
async function
|
|
3451
|
+
var F = null, Lh = !1, Rh = !1;
|
|
3452
|
+
async function zh() {
|
|
3444
3453
|
if (!(typeof navigator > "u" || !("wakeLock" in navigator))) try {
|
|
3445
3454
|
F = await navigator.wakeLock.request("screen");
|
|
3446
3455
|
} catch {}
|
|
3447
3456
|
}
|
|
3448
|
-
function
|
|
3449
|
-
document.visibilityState === "visible" &&
|
|
3457
|
+
function Bh() {
|
|
3458
|
+
document.visibilityState === "visible" && Lh && (!F || F.released) && zh();
|
|
3450
3459
|
}
|
|
3451
|
-
var
|
|
3460
|
+
var Vh = {
|
|
3452
3461
|
name: "ikon.client.keepScreenAwake",
|
|
3453
3462
|
description: "Prevent or allow the screen to sleep",
|
|
3454
3463
|
returnType: { kind: "boolean" },
|
|
@@ -3458,15 +3467,15 @@ var zh = {
|
|
|
3458
3467
|
description: "Whether to keep the screen awake"
|
|
3459
3468
|
}]
|
|
3460
3469
|
};
|
|
3461
|
-
async function
|
|
3470
|
+
async function Hh(e) {
|
|
3462
3471
|
if (typeof navigator > "u" || !("wakeLock" in navigator)) return !1;
|
|
3463
3472
|
try {
|
|
3464
|
-
return e ? (
|
|
3473
|
+
return e ? (Lh = !0, (!F || F.released) && (F = await navigator.wakeLock.request("screen")), Rh ||= (document.addEventListener("visibilitychange", Bh), !0)) : (Lh = !1, Rh &&= (document.removeEventListener("visibilitychange", Bh), !1), F &&= (await F.release(), null)), !0;
|
|
3465
3474
|
} catch {
|
|
3466
3475
|
return !1;
|
|
3467
3476
|
}
|
|
3468
3477
|
}
|
|
3469
|
-
var
|
|
3478
|
+
var Uh = {
|
|
3470
3479
|
name: "ikon.client.getVisibility",
|
|
3471
3480
|
description: "Get the current page visibility state",
|
|
3472
3481
|
returnType: {
|
|
@@ -3474,10 +3483,10 @@ var Vh = {
|
|
|
3474
3483
|
nullable: !0
|
|
3475
3484
|
}
|
|
3476
3485
|
};
|
|
3477
|
-
function
|
|
3486
|
+
function Wh() {
|
|
3478
3487
|
return typeof document > "u" ? null : document.visibilityState || null;
|
|
3479
3488
|
}
|
|
3480
|
-
var
|
|
3489
|
+
var Gh = {
|
|
3481
3490
|
name: "ikon.client.scrollTo",
|
|
3482
3491
|
description: "Scroll the page to a specific position",
|
|
3483
3492
|
returnType: { kind: "boolean" },
|
|
@@ -3502,7 +3511,7 @@ var Uh = {
|
|
|
3502
3511
|
}
|
|
3503
3512
|
]
|
|
3504
3513
|
};
|
|
3505
|
-
function
|
|
3514
|
+
function Kh(e, t, n) {
|
|
3506
3515
|
if (typeof window > "u" || typeof e != "number" || typeof t != "number") return !1;
|
|
3507
3516
|
try {
|
|
3508
3517
|
return window.scrollTo({
|
|
@@ -3514,7 +3523,7 @@ function Wh(e, t, n) {
|
|
|
3514
3523
|
return !1;
|
|
3515
3524
|
}
|
|
3516
3525
|
}
|
|
3517
|
-
var
|
|
3526
|
+
var qh = {
|
|
3518
3527
|
name: "ikon.client.getBatteryLevel",
|
|
3519
3528
|
description: "Get the current battery level (0-100)",
|
|
3520
3529
|
returnType: {
|
|
@@ -3522,7 +3531,7 @@ var Gh = {
|
|
|
3522
3531
|
nullable: !0
|
|
3523
3532
|
}
|
|
3524
3533
|
};
|
|
3525
|
-
async function
|
|
3534
|
+
async function Jh() {
|
|
3526
3535
|
if (typeof navigator > "u" || !("getBattery" in navigator)) return null;
|
|
3527
3536
|
try {
|
|
3528
3537
|
let e = await navigator.getBattery();
|
|
@@ -3531,7 +3540,7 @@ async function Kh() {
|
|
|
3531
3540
|
return null;
|
|
3532
3541
|
}
|
|
3533
3542
|
}
|
|
3534
|
-
var
|
|
3543
|
+
var Yh = {
|
|
3535
3544
|
name: "ikon.client.getNetworkType",
|
|
3536
3545
|
description: "Get the current network connection type",
|
|
3537
3546
|
returnType: {
|
|
@@ -3539,17 +3548,57 @@ var qh = {
|
|
|
3539
3548
|
nullable: !0
|
|
3540
3549
|
}
|
|
3541
3550
|
};
|
|
3542
|
-
function
|
|
3551
|
+
function Xh() {
|
|
3543
3552
|
if (typeof navigator > "u") return null;
|
|
3544
3553
|
let e = navigator.connection;
|
|
3545
3554
|
return e && (e.effectiveType || e.type) || null;
|
|
3546
3555
|
}
|
|
3547
|
-
var
|
|
3556
|
+
var Zh = {
|
|
3557
|
+
name: "ikon.client.getPlatform",
|
|
3558
|
+
description: "Get the operating system, its version, the processor architecture and the browser",
|
|
3559
|
+
returnType: {
|
|
3560
|
+
kind: "string",
|
|
3561
|
+
nullable: !0
|
|
3562
|
+
}
|
|
3563
|
+
};
|
|
3564
|
+
async function Qh() {
|
|
3565
|
+
if (typeof navigator > "u") return null;
|
|
3566
|
+
let e = {
|
|
3567
|
+
UserAgent: navigator.userAgent ?? "",
|
|
3568
|
+
IsTouchDevice: Th(),
|
|
3569
|
+
Platform: "",
|
|
3570
|
+
PlatformVersion: "",
|
|
3571
|
+
Architecture: "",
|
|
3572
|
+
Bitness: "",
|
|
3573
|
+
Brands: []
|
|
3574
|
+
}, t = navigator.userAgentData;
|
|
3575
|
+
if (!t) return e;
|
|
3576
|
+
e.Platform = t.platform ?? "", e.Brands = (t.brands ?? []).map((e) => ({
|
|
3577
|
+
Brand: e.brand,
|
|
3578
|
+
Version: e.version
|
|
3579
|
+
}));
|
|
3580
|
+
try {
|
|
3581
|
+
let n = await t.getHighEntropyValues?.([
|
|
3582
|
+
"platformVersion",
|
|
3583
|
+
"architecture",
|
|
3584
|
+
"bitness",
|
|
3585
|
+
"fullVersionList"
|
|
3586
|
+
]);
|
|
3587
|
+
n && (e.Platform = n.platform ?? e.Platform, e.PlatformVersion = n.platformVersion ?? "", e.Architecture = n.architecture ?? "", e.Bitness = n.bitness ?? "", n.fullVersionList?.length && (e.Brands = n.fullVersionList.map((e) => ({
|
|
3588
|
+
Brand: e.brand,
|
|
3589
|
+
Version: e.version
|
|
3590
|
+
}))));
|
|
3591
|
+
} catch (e) {
|
|
3592
|
+
P.debug(`getPlatform: high-entropy client hints refused: ${e}`);
|
|
3593
|
+
}
|
|
3594
|
+
return e;
|
|
3595
|
+
}
|
|
3596
|
+
var $h = {
|
|
3548
3597
|
name: "ikon.client.requestFullscreen",
|
|
3549
3598
|
description: "Request the browser to enter fullscreen mode",
|
|
3550
3599
|
returnType: { kind: "boolean" }
|
|
3551
3600
|
};
|
|
3552
|
-
async function
|
|
3601
|
+
async function eg() {
|
|
3553
3602
|
if (typeof document > "u" || !document.documentElement) return !1;
|
|
3554
3603
|
try {
|
|
3555
3604
|
let e = document.documentElement, t = e.requestFullscreen?.bind(e) ?? e.webkitRequestFullscreen?.bind(e);
|
|
@@ -3558,12 +3607,12 @@ async function Xh() {
|
|
|
3558
3607
|
return !1;
|
|
3559
3608
|
}
|
|
3560
3609
|
}
|
|
3561
|
-
var
|
|
3610
|
+
var tg = {
|
|
3562
3611
|
name: "ikon.client.exitFullscreen",
|
|
3563
3612
|
description: "Exit browser fullscreen mode",
|
|
3564
3613
|
returnType: { kind: "boolean" }
|
|
3565
3614
|
};
|
|
3566
|
-
function
|
|
3615
|
+
function ng() {
|
|
3567
3616
|
if (typeof document > "u") return !1;
|
|
3568
3617
|
try {
|
|
3569
3618
|
let e = document.exitFullscreen?.bind(document) ?? document.webkitExitFullscreen?.bind(document);
|
|
@@ -3572,25 +3621,25 @@ function Qh() {
|
|
|
3572
3621
|
return !1;
|
|
3573
3622
|
}
|
|
3574
3623
|
}
|
|
3575
|
-
var
|
|
3624
|
+
var rg = {
|
|
3576
3625
|
name: "ikon.client.logout",
|
|
3577
3626
|
description: "Clear the auth session and return to the login screen at the site root",
|
|
3578
3627
|
returnType: { kind: "boolean" }
|
|
3579
|
-
},
|
|
3580
|
-
function
|
|
3628
|
+
}, ig = ["ikon-auth-", "ikon-live-snapshot"];
|
|
3629
|
+
function ag() {
|
|
3581
3630
|
if (typeof window > "u" || !window.localStorage) return !1;
|
|
3582
3631
|
try {
|
|
3583
3632
|
let e = [];
|
|
3584
3633
|
for (let t = 0; t < window.localStorage.length; t++) {
|
|
3585
3634
|
let n = window.localStorage.key(t);
|
|
3586
|
-
n &&
|
|
3635
|
+
n && ig.some((e) => n.startsWith(e)) && e.push(n);
|
|
3587
3636
|
}
|
|
3588
3637
|
return e.forEach((e) => window.localStorage.removeItem(e)), setTimeout(() => window.location.replace(window.location.origin + "/"), 100), !0;
|
|
3589
3638
|
} catch {
|
|
3590
3639
|
return !1;
|
|
3591
3640
|
}
|
|
3592
3641
|
}
|
|
3593
|
-
var
|
|
3642
|
+
var og = {
|
|
3594
3643
|
name: "ikon.client.login",
|
|
3595
3644
|
description: "Start the sign-in flow for an OAuth provider (e.g. google, microsoft)",
|
|
3596
3645
|
parameters: [{
|
|
@@ -3599,14 +3648,14 @@ var ng = {
|
|
|
3599
3648
|
}],
|
|
3600
3649
|
returnType: { kind: "boolean" }
|
|
3601
3650
|
};
|
|
3602
|
-
async function
|
|
3651
|
+
async function sg(e) {
|
|
3603
3652
|
if (typeof window > "u" || typeof e != "string" || e.length === 0 || e === "guest" || e === "global" || e === "email" || e === "passkey") return !1;
|
|
3604
3653
|
let t = window.__IKON_AUTH_CONFIG__, n = t?.spaceId;
|
|
3605
3654
|
if (!n) return !1;
|
|
3606
|
-
let r =
|
|
3607
|
-
if (
|
|
3608
|
-
let i = await xm(t?.authUrl), a = window.location.origin + window.location.pathname + window.location.search, o = await
|
|
3609
|
-
return r && !o ? !1 : (window.location.href =
|
|
3655
|
+
let r = eh(e) !== void 0;
|
|
3656
|
+
if (qm()) return !r && await Ym(e, n);
|
|
3657
|
+
let i = await xm(t?.authUrl), a = window.location.origin + window.location.pathname + window.location.search, o = await Lm();
|
|
3658
|
+
return r && !o ? !1 : (window.location.href = th({
|
|
3610
3659
|
authUrl: i,
|
|
3611
3660
|
provider: e,
|
|
3612
3661
|
spaceId: n,
|
|
@@ -3614,7 +3663,7 @@ async function rg(e) {
|
|
|
3614
3663
|
codeChallenge: o ?? void 0
|
|
3615
3664
|
}), !0);
|
|
3616
3665
|
}
|
|
3617
|
-
var
|
|
3666
|
+
var cg = {
|
|
3618
3667
|
name: "ikon.client.loginShow",
|
|
3619
3668
|
description: "Show the login UI with an optional reason",
|
|
3620
3669
|
parameters: [{
|
|
@@ -3623,10 +3672,10 @@ var ig = {
|
|
|
3623
3672
|
}],
|
|
3624
3673
|
returnType: { kind: "boolean" }
|
|
3625
3674
|
};
|
|
3626
|
-
function
|
|
3675
|
+
function lg(e) {
|
|
3627
3676
|
return typeof window > "u" ? !1 : (Jp(typeof e == "string" ? e : null), !0);
|
|
3628
3677
|
}
|
|
3629
|
-
var
|
|
3678
|
+
var ug = {
|
|
3630
3679
|
name: "ikon.client.getLocation",
|
|
3631
3680
|
description: "Get the current GPS location",
|
|
3632
3681
|
returnType: {
|
|
@@ -3634,7 +3683,7 @@ var og = {
|
|
|
3634
3683
|
nullable: !0
|
|
3635
3684
|
}
|
|
3636
3685
|
};
|
|
3637
|
-
function
|
|
3686
|
+
function dg() {
|
|
3638
3687
|
return typeof navigator > "u" || !navigator.geolocation ? (P.warn("getLocation: geolocation is not available in this browser"), Promise.resolve(null)) : new Promise((e) => {
|
|
3639
3688
|
navigator.geolocation.getCurrentPosition((t) => {
|
|
3640
3689
|
e({
|
|
@@ -3650,15 +3699,15 @@ function sg() {
|
|
|
3650
3699
|
});
|
|
3651
3700
|
});
|
|
3652
3701
|
}
|
|
3653
|
-
var
|
|
3654
|
-
function
|
|
3702
|
+
var fg = [], pg = !1;
|
|
3703
|
+
function mg() {
|
|
3655
3704
|
return typeof window < "u" && "Notification" in window;
|
|
3656
3705
|
}
|
|
3657
|
-
function
|
|
3706
|
+
function hg(e, t, n, r, i) {
|
|
3658
3707
|
let a = {};
|
|
3659
3708
|
return e?.trim() && (a.body = e.trim()), t?.trim() && (a.icon = t.trim()), n?.trim() && (a.tag = n.trim()), r && (a.data = r), i === "High" ? a.requireInteraction = !0 : i === "Low" && (a.silent = !0), a;
|
|
3660
3709
|
}
|
|
3661
|
-
function
|
|
3710
|
+
function gg(e, t, n, r) {
|
|
3662
3711
|
try {
|
|
3663
3712
|
let i = new Notification(e, t);
|
|
3664
3713
|
return i.onclick = () => {
|
|
@@ -3676,18 +3725,18 @@ function fg(e, t, n, r) {
|
|
|
3676
3725
|
return P.debug(`Page-context Notification failed: ${e}`), !1;
|
|
3677
3726
|
}
|
|
3678
3727
|
}
|
|
3679
|
-
var
|
|
3680
|
-
async function
|
|
3728
|
+
var _g = null, vg = !1;
|
|
3729
|
+
async function yg() {
|
|
3681
3730
|
if (typeof navigator > "u" || !("serviceWorker" in navigator)) return null;
|
|
3682
|
-
if (
|
|
3731
|
+
if (_g) return _g;
|
|
3683
3732
|
try {
|
|
3684
|
-
return
|
|
3733
|
+
return _g = await navigator.serviceWorker.register("/push-service-worker.js"), await navigator.serviceWorker.ready, _g;
|
|
3685
3734
|
} catch (e) {
|
|
3686
3735
|
return P.warn(`Push service worker registration failed: ${e}`), null;
|
|
3687
3736
|
}
|
|
3688
3737
|
}
|
|
3689
|
-
function
|
|
3690
|
-
|
|
3738
|
+
function bg() {
|
|
3739
|
+
vg || typeof navigator > "u" || !("serviceWorker" in navigator) || (vg = !0, navigator.serviceWorker.addEventListener("message", (e) => {
|
|
3691
3740
|
let t = e.data;
|
|
3692
3741
|
t && t.type === "ikon.notification-click" && window.dispatchEvent(new CustomEvent("ikon.notification-click", { detail: {
|
|
3693
3742
|
launchUrl: t.launchUrl ?? null,
|
|
@@ -3697,8 +3746,8 @@ function gg() {
|
|
|
3697
3746
|
} }));
|
|
3698
3747
|
}));
|
|
3699
3748
|
}
|
|
3700
|
-
async function
|
|
3701
|
-
let a = await
|
|
3749
|
+
async function xg(e, t, n, r, i) {
|
|
3750
|
+
let a = await yg();
|
|
3702
3751
|
if (!a) return !1;
|
|
3703
3752
|
try {
|
|
3704
3753
|
let o = {
|
|
@@ -3718,43 +3767,43 @@ async function _g(e, t, n, r, i) {
|
|
|
3718
3767
|
return P.debug(`Service worker notification failed: ${e}`), !1;
|
|
3719
3768
|
}
|
|
3720
3769
|
}
|
|
3721
|
-
async function
|
|
3722
|
-
return i && i.length > 0 && await
|
|
3770
|
+
async function Sg(e, t, n, r, i) {
|
|
3771
|
+
return i && i.length > 0 && await xg(e, t, n, r, i) || gg(e, t, n, r) || await xg(e, t, n, r, i ?? []) ? !0 : (P.warn(`Notification "${e}" was not displayed: neither the page nor a service worker could show it`), !1);
|
|
3723
3772
|
}
|
|
3724
|
-
function
|
|
3773
|
+
function Cg() {
|
|
3725
3774
|
if (Notification.permission !== "granted") {
|
|
3726
|
-
|
|
3775
|
+
fg = [];
|
|
3727
3776
|
return;
|
|
3728
3777
|
}
|
|
3729
|
-
let e =
|
|
3730
|
-
|
|
3731
|
-
for (let t of e)
|
|
3778
|
+
let e = fg;
|
|
3779
|
+
fg = [];
|
|
3780
|
+
for (let t of e) Sg(t.title, t.options, t.launchUrl, t.data, t.actions);
|
|
3732
3781
|
}
|
|
3733
|
-
function
|
|
3734
|
-
if (
|
|
3735
|
-
|
|
3782
|
+
function wg() {
|
|
3783
|
+
if (pg || typeof window > "u") return;
|
|
3784
|
+
pg = !0;
|
|
3736
3785
|
let e = async () => {
|
|
3737
3786
|
try {
|
|
3738
3787
|
if (await Notification.requestPermission() === "granted") {
|
|
3739
|
-
|
|
3788
|
+
Cg();
|
|
3740
3789
|
return;
|
|
3741
3790
|
}
|
|
3742
3791
|
} catch {}
|
|
3743
|
-
|
|
3792
|
+
fg = [];
|
|
3744
3793
|
}, t = () => {
|
|
3745
|
-
window.removeEventListener("pointerdown", t), window.removeEventListener("keydown", t),
|
|
3794
|
+
window.removeEventListener("pointerdown", t), window.removeEventListener("keydown", t), pg = !1, e();
|
|
3746
3795
|
};
|
|
3747
3796
|
window.addEventListener("pointerdown", t), window.addEventListener("keydown", t);
|
|
3748
3797
|
}
|
|
3749
|
-
var
|
|
3798
|
+
var Tg = {
|
|
3750
3799
|
name: "ikon.client.getNotificationPermission",
|
|
3751
3800
|
description: "Get the current notification permission state (granted, denied, default, or unsupported)",
|
|
3752
3801
|
returnType: { kind: "string" }
|
|
3753
3802
|
};
|
|
3754
|
-
function
|
|
3755
|
-
return
|
|
3803
|
+
function Eg() {
|
|
3804
|
+
return mg() ? Notification.permission : "unsupported";
|
|
3756
3805
|
}
|
|
3757
|
-
var
|
|
3806
|
+
var Dg = {
|
|
3758
3807
|
name: "ikon.client.showNotification",
|
|
3759
3808
|
description: "Show a notification, requesting permission lazily on the first send",
|
|
3760
3809
|
returnType: { kind: "string" },
|
|
@@ -3814,40 +3863,40 @@ var Cg = {
|
|
|
3814
3863
|
}
|
|
3815
3864
|
]
|
|
3816
3865
|
};
|
|
3817
|
-
async function
|
|
3818
|
-
if (!
|
|
3819
|
-
let c = e.trim(), l =
|
|
3866
|
+
async function Og(e, t, n, r, i, a, o, s) {
|
|
3867
|
+
if (!mg() || typeof e != "string" || !e.trim()) return "unsupported";
|
|
3868
|
+
let c = e.trim(), l = hg(typeof t == "string" ? t : void 0, typeof n == "string" ? n : void 0, typeof r == "string" ? r : void 0, typeof a == "string" ? a : void 0, typeof o == "string" ? o : void 0), u = typeof i == "string" && i.trim() ? i.trim() : void 0, d = typeof a == "string" && a ? a : void 0, f;
|
|
3820
3869
|
if (typeof s == "string" && s.trim()) try {
|
|
3821
3870
|
let e = JSON.parse(s);
|
|
3822
3871
|
Array.isArray(e) && e.length > 0 && (f = e);
|
|
3823
3872
|
} catch (e) {
|
|
3824
3873
|
P.warn(`Notification actions JSON is malformed, showing "${c}" without buttons: ${e}`);
|
|
3825
3874
|
}
|
|
3826
|
-
if (Notification.permission === "granted") return await
|
|
3875
|
+
if (Notification.permission === "granted") return await Sg(c, l, u, d, f) ? "granted" : "failed";
|
|
3827
3876
|
if (Notification.permission === "denied") return "denied";
|
|
3828
3877
|
try {
|
|
3829
3878
|
let e = await Notification.requestPermission();
|
|
3830
|
-
return e === "granted" ? await
|
|
3879
|
+
return e === "granted" ? await Sg(c, l, u, d, f) ? "granted" : "failed" : e;
|
|
3831
3880
|
} catch (e) {
|
|
3832
|
-
return
|
|
3881
|
+
return nh(e) ? (fg.push({
|
|
3833
3882
|
title: c,
|
|
3834
3883
|
options: l,
|
|
3835
3884
|
launchUrl: u,
|
|
3836
3885
|
data: d,
|
|
3837
3886
|
actions: f
|
|
3838
|
-
}),
|
|
3887
|
+
}), wg(), "default") : "denied";
|
|
3839
3888
|
}
|
|
3840
3889
|
}
|
|
3841
|
-
var
|
|
3842
|
-
function
|
|
3843
|
-
|
|
3890
|
+
var kg = null;
|
|
3891
|
+
function Ag(e) {
|
|
3892
|
+
kg = e ?? null;
|
|
3844
3893
|
}
|
|
3845
|
-
function
|
|
3894
|
+
function jg(e) {
|
|
3846
3895
|
let t = (e + "=".repeat((4 - e.length % 4) % 4)).replace(/-/g, "+").replace(/_/g, "/"), n = atob(t), r = new Uint8Array(n.length);
|
|
3847
3896
|
for (let e = 0; e < n.length; e++) r[e] = n.charCodeAt(e);
|
|
3848
3897
|
return r;
|
|
3849
3898
|
}
|
|
3850
|
-
var
|
|
3899
|
+
var Mg = {
|
|
3851
3900
|
name: "ikon.client.getPushSubscription",
|
|
3852
3901
|
description: "Subscribe to Web Push and return the subscription, for offline push registration",
|
|
3853
3902
|
returnType: {
|
|
@@ -3855,14 +3904,14 @@ var Og = {
|
|
|
3855
3904
|
nullable: !0
|
|
3856
3905
|
}
|
|
3857
3906
|
};
|
|
3858
|
-
async function
|
|
3859
|
-
if (typeof window > "u" || !
|
|
3907
|
+
async function Ng() {
|
|
3908
|
+
if (typeof window > "u" || !kg?.enabled || !kg.vapidPublicKey || !("serviceWorker" in navigator) || !("PushManager" in window) || !mg() || Notification.permission !== "granted") return null;
|
|
3860
3909
|
try {
|
|
3861
3910
|
let e = await navigator.serviceWorker.register("/push-service-worker.js");
|
|
3862
3911
|
await navigator.serviceWorker.ready;
|
|
3863
3912
|
let t = (await e.pushManager.getSubscription() ?? await e.pushManager.subscribe({
|
|
3864
3913
|
userVisibleOnly: !0,
|
|
3865
|
-
applicationServerKey:
|
|
3914
|
+
applicationServerKey: jg(kg.vapidPublicKey)
|
|
3866
3915
|
})).toJSON();
|
|
3867
3916
|
if (!t.endpoint || !t.keys?.p256dh || !t.keys?.auth) throw Error("Push subscription is missing its endpoint or keys");
|
|
3868
3917
|
return {
|
|
@@ -3876,11 +3925,7 @@ async function kg() {
|
|
|
3876
3925
|
throw Error(`Web Push subscription failed: ${e instanceof Error ? e.message : String(e)}`, { cause: e });
|
|
3877
3926
|
}
|
|
3878
3927
|
}
|
|
3879
|
-
var
|
|
3880
|
-
{
|
|
3881
|
-
definition: mh,
|
|
3882
|
-
handler: hh
|
|
3883
|
-
},
|
|
3928
|
+
var Pg = [
|
|
3884
3929
|
{
|
|
3885
3930
|
definition: gh,
|
|
3886
3931
|
handler: _h
|
|
@@ -3894,8 +3939,8 @@ var Ag = [
|
|
|
3894
3939
|
handler: xh
|
|
3895
3940
|
},
|
|
3896
3941
|
{
|
|
3897
|
-
definition:
|
|
3898
|
-
handler:
|
|
3942
|
+
definition: Sh,
|
|
3943
|
+
handler: Ch
|
|
3899
3944
|
},
|
|
3900
3945
|
{
|
|
3901
3946
|
definition: Dh,
|
|
@@ -3914,8 +3959,8 @@ var Ag = [
|
|
|
3914
3959
|
handler: Ph
|
|
3915
3960
|
},
|
|
3916
3961
|
{
|
|
3917
|
-
definition:
|
|
3918
|
-
handler:
|
|
3962
|
+
definition: Fh,
|
|
3963
|
+
handler: Ih
|
|
3919
3964
|
},
|
|
3920
3965
|
{
|
|
3921
3966
|
definition: Vh,
|
|
@@ -3943,14 +3988,14 @@ var Ag = [
|
|
|
3943
3988
|
},
|
|
3944
3989
|
{
|
|
3945
3990
|
definition: $h,
|
|
3946
|
-
handler:
|
|
3991
|
+
handler: eg
|
|
3947
3992
|
},
|
|
3948
3993
|
{
|
|
3949
|
-
definition:
|
|
3950
|
-
handler:
|
|
3994
|
+
definition: tg,
|
|
3995
|
+
handler: ng
|
|
3951
3996
|
},
|
|
3952
3997
|
{
|
|
3953
|
-
definition:
|
|
3998
|
+
definition: rg,
|
|
3954
3999
|
handler: ag
|
|
3955
4000
|
},
|
|
3956
4001
|
{
|
|
@@ -3958,21 +4003,29 @@ var Ag = [
|
|
|
3958
4003
|
handler: sg
|
|
3959
4004
|
},
|
|
3960
4005
|
{
|
|
3961
|
-
definition:
|
|
3962
|
-
handler:
|
|
4006
|
+
definition: cg,
|
|
4007
|
+
handler: lg
|
|
3963
4008
|
},
|
|
3964
4009
|
{
|
|
3965
|
-
definition:
|
|
3966
|
-
handler:
|
|
4010
|
+
definition: ug,
|
|
4011
|
+
handler: dg
|
|
3967
4012
|
},
|
|
3968
4013
|
{
|
|
3969
|
-
definition:
|
|
3970
|
-
handler:
|
|
4014
|
+
definition: Tg,
|
|
4015
|
+
handler: Eg
|
|
4016
|
+
},
|
|
4017
|
+
{
|
|
4018
|
+
definition: Dg,
|
|
4019
|
+
handler: Og
|
|
4020
|
+
},
|
|
4021
|
+
{
|
|
4022
|
+
definition: Mg,
|
|
4023
|
+
handler: Ng
|
|
3971
4024
|
}
|
|
3972
4025
|
];
|
|
3973
|
-
function
|
|
3974
|
-
|
|
3975
|
-
let t =
|
|
4026
|
+
function Fg(e) {
|
|
4027
|
+
bg();
|
|
4028
|
+
let t = Pg.map(({ definition: t, handler: n }) => e.register(t, n)), n = null, r = () => {
|
|
3976
4029
|
n !== null && typeof navigator < "u" && navigator.geolocation && navigator.geolocation.clearWatch(n), n = null;
|
|
3977
4030
|
};
|
|
3978
4031
|
return t.push(e.register({
|
|
@@ -4014,64 +4067,64 @@ function I() {
|
|
|
4014
4067
|
}
|
|
4015
4068
|
//#endregion
|
|
4016
4069
|
//#region src/utils/client-identity.ts
|
|
4017
|
-
var
|
|
4070
|
+
var Ig = "1.11.3", Lg = "X-Ikon-Client", Rg = `ikon-sdk-typescript/${Ig}`;
|
|
4018
4071
|
function L() {
|
|
4019
|
-
return { [
|
|
4072
|
+
return { [Lg]: Rg };
|
|
4020
4073
|
}
|
|
4021
4074
|
//#endregion
|
|
4022
4075
|
//#region src/utils/log-sink.ts
|
|
4023
|
-
var
|
|
4024
|
-
function
|
|
4025
|
-
e.level <
|
|
4076
|
+
var zg = 1e3, Bg = C.INFO, R = [], Vg = zg, Hg = Bg, Ug = null;
|
|
4077
|
+
function Wg(e) {
|
|
4078
|
+
e.level < Hg || (R.push(e), R.length > Vg && (R = R.slice(-Vg)));
|
|
4026
4079
|
}
|
|
4027
|
-
function
|
|
4028
|
-
|
|
4080
|
+
function Gg(e) {
|
|
4081
|
+
Vg = e?.maxBufferSize ?? zg, Hg = e?.minLevel ?? Bg, R = [], ie(Wg);
|
|
4029
4082
|
}
|
|
4030
|
-
function
|
|
4031
|
-
|
|
4083
|
+
function Kg(e) {
|
|
4084
|
+
Ug = e;
|
|
4032
4085
|
}
|
|
4033
|
-
function
|
|
4086
|
+
function qg() {
|
|
4034
4087
|
return R;
|
|
4035
4088
|
}
|
|
4036
|
-
function
|
|
4089
|
+
function Jg() {
|
|
4037
4090
|
let e = R;
|
|
4038
4091
|
return R = [], e;
|
|
4039
4092
|
}
|
|
4040
|
-
function
|
|
4041
|
-
if (!
|
|
4042
|
-
let e =
|
|
4043
|
-
return
|
|
4093
|
+
function Yg() {
|
|
4094
|
+
if (!Ug || R.length === 0) return 0;
|
|
4095
|
+
let e = Jg();
|
|
4096
|
+
return Ug(e), e.length;
|
|
4044
4097
|
}
|
|
4045
|
-
function
|
|
4098
|
+
function Xg() {
|
|
4046
4099
|
R = [];
|
|
4047
4100
|
}
|
|
4048
|
-
function
|
|
4101
|
+
function Zg() {
|
|
4049
4102
|
return R.length;
|
|
4050
4103
|
}
|
|
4051
|
-
|
|
4104
|
+
Gg();
|
|
4052
4105
|
//#endregion
|
|
4053
4106
|
//#region src/utils/log-sender.ts
|
|
4054
|
-
var
|
|
4055
|
-
[
|
|
4056
|
-
[
|
|
4057
|
-
[
|
|
4058
|
-
[
|
|
4059
|
-
},
|
|
4060
|
-
function
|
|
4061
|
-
return e.length <= t ? e : e.slice(0, Math.max(0, t - 12)) +
|
|
4062
|
-
}
|
|
4063
|
-
function
|
|
4064
|
-
return
|
|
4065
|
-
}
|
|
4066
|
-
function
|
|
4107
|
+
var Qg = "LogSender", $g = S(Qg), e_ = 1e3, t_ = 6e4, n_ = 15e3, r_ = 10240, i_ = 10240, a_ = 409600, o_ = "…[truncated]", s_ = {
|
|
4108
|
+
[C.DEBUG]: m.Debug,
|
|
4109
|
+
[C.INFO]: m.Info,
|
|
4110
|
+
[C.WARN]: m.Warning,
|
|
4111
|
+
[C.ERROR]: m.Error
|
|
4112
|
+
}, z, c_, B, V = [], H = 0, l_, u_ = !1, d_ = 0;
|
|
4113
|
+
function f_(e, t) {
|
|
4114
|
+
return e.length <= t ? e : e.slice(0, Math.max(0, t - 12)) + o_;
|
|
4115
|
+
}
|
|
4116
|
+
function p_(e) {
|
|
4117
|
+
return f_(e, r_);
|
|
4118
|
+
}
|
|
4119
|
+
function m_(e) {
|
|
4067
4120
|
if (e.length === 0) return "{}";
|
|
4068
|
-
let t =
|
|
4121
|
+
let t = i_;
|
|
4069
4122
|
return `{"args":[${e.map((e) => {
|
|
4070
|
-
let n =
|
|
4123
|
+
let n = h_(e, t);
|
|
4071
4124
|
return t -= n.length, n;
|
|
4072
4125
|
}).join(",")}]}`;
|
|
4073
4126
|
}
|
|
4074
|
-
function
|
|
4127
|
+
function h_(e, t) {
|
|
4075
4128
|
let n = e instanceof Error ? {
|
|
4076
4129
|
name: e.name,
|
|
4077
4130
|
message: e.message,
|
|
@@ -4080,111 +4133,111 @@ function l_(e, t) {
|
|
|
4080
4133
|
try {
|
|
4081
4134
|
r = JSON.stringify(n);
|
|
4082
4135
|
} catch {
|
|
4083
|
-
return JSON.stringify(
|
|
4136
|
+
return JSON.stringify(f_(g_(e), t));
|
|
4084
4137
|
}
|
|
4085
|
-
return r === void 0 ? "null" : r.length <= t ? r : JSON.stringify(
|
|
4138
|
+
return r === void 0 ? "null" : r.length <= t ? r : JSON.stringify(f_(typeof n == "string" ? n : r, t));
|
|
4086
4139
|
}
|
|
4087
|
-
function
|
|
4140
|
+
function g_(e) {
|
|
4088
4141
|
try {
|
|
4089
4142
|
return String(e);
|
|
4090
4143
|
} catch {
|
|
4091
4144
|
return `[unstringifiable ${typeof e}]`;
|
|
4092
4145
|
}
|
|
4093
4146
|
}
|
|
4094
|
-
function
|
|
4147
|
+
function __(e) {
|
|
4095
4148
|
return {
|
|
4096
4149
|
Time: e.timestamp,
|
|
4097
|
-
Type:
|
|
4098
|
-
Message:
|
|
4099
|
-
Parameters:
|
|
4150
|
+
Type: s_[e.level] ?? m.Info,
|
|
4151
|
+
Message: p_(`[${e.component}] ${e.message}`),
|
|
4152
|
+
Parameters: m_(e.args)
|
|
4100
4153
|
};
|
|
4101
4154
|
}
|
|
4102
|
-
function
|
|
4155
|
+
function v_(e) {
|
|
4103
4156
|
return JSON.stringify({
|
|
4104
4157
|
type: "sdk-typescript",
|
|
4105
4158
|
event: { Logs: e }
|
|
4106
4159
|
});
|
|
4107
4160
|
}
|
|
4108
|
-
function
|
|
4161
|
+
function y_(e) {
|
|
4109
4162
|
if (e.length === 0) return [];
|
|
4110
|
-
let t =
|
|
4163
|
+
let t = a_ - v_([]).length, n = [], r = [], i = 0;
|
|
4111
4164
|
for (let a of e) {
|
|
4112
4165
|
let e = JSON.stringify(a).length + 1;
|
|
4113
4166
|
r.length > 0 && i + e > t && (n.push(r), r = [], i = 0), r.push(a), i += e;
|
|
4114
4167
|
}
|
|
4115
4168
|
return r.length > 0 && n.push(r), n;
|
|
4116
4169
|
}
|
|
4117
|
-
var
|
|
4118
|
-
async function
|
|
4119
|
-
if (e.length === 0 || !
|
|
4120
|
-
let t = `${
|
|
4170
|
+
var b_ = class extends Error {};
|
|
4171
|
+
async function x_(e) {
|
|
4172
|
+
if (e.length === 0 || !z) return;
|
|
4173
|
+
let t = `${z}/events/logs/json`, n = {
|
|
4121
4174
|
"Content-Type": "application/json",
|
|
4122
4175
|
...L(),
|
|
4123
|
-
Authorization: `Bearer ${
|
|
4176
|
+
Authorization: `Bearer ${c_}`
|
|
4124
4177
|
}, r = await fetch(t, {
|
|
4125
4178
|
method: "POST",
|
|
4126
4179
|
headers: n,
|
|
4127
|
-
body:
|
|
4128
|
-
signal: j(
|
|
4180
|
+
body: v_(e),
|
|
4181
|
+
signal: j(n_)
|
|
4129
4182
|
});
|
|
4130
4183
|
if (!r.ok) {
|
|
4131
|
-
if (r.status === 401 || r.status === 403) throw new
|
|
4184
|
+
if (r.status === 401 || r.status === 403) throw new b_(`Log shipping rejected with ${r.status}`);
|
|
4132
4185
|
if (r.status >= 400 && r.status < 500) {
|
|
4133
|
-
|
|
4186
|
+
$g.warn(`Dropping ${e.length} log entries due to ${r.status}`);
|
|
4134
4187
|
return;
|
|
4135
4188
|
}
|
|
4136
4189
|
throw Error(`Failed to send logs: ${r.status}`);
|
|
4137
4190
|
}
|
|
4138
4191
|
}
|
|
4139
|
-
function
|
|
4140
|
-
if (
|
|
4141
|
-
let e =
|
|
4142
|
-
return Math.min(e,
|
|
4192
|
+
function S_() {
|
|
4193
|
+
if (H === 0) return e_;
|
|
4194
|
+
let e = e_ * (1 << Math.min(H, 6));
|
|
4195
|
+
return Math.min(e, t_);
|
|
4143
4196
|
}
|
|
4144
|
-
function
|
|
4145
|
-
!
|
|
4197
|
+
function C_(e) {
|
|
4198
|
+
!z || u_ || (B = setTimeout(() => void w_(), e));
|
|
4146
4199
|
}
|
|
4147
|
-
async function
|
|
4148
|
-
|
|
4149
|
-
let e =
|
|
4150
|
-
if (
|
|
4151
|
-
|
|
4200
|
+
async function w_() {
|
|
4201
|
+
B = void 0;
|
|
4202
|
+
let e = Jg().filter((e) => e.component !== Qg);
|
|
4203
|
+
if (V = V.concat(e.map(__)), typeof navigator < "u" && navigator.onLine === !1) {
|
|
4204
|
+
C_(e_);
|
|
4152
4205
|
return;
|
|
4153
4206
|
}
|
|
4154
|
-
if (
|
|
4155
|
-
|
|
4207
|
+
if (V.length === 0) {
|
|
4208
|
+
C_(e_);
|
|
4156
4209
|
return;
|
|
4157
4210
|
}
|
|
4158
|
-
let t =
|
|
4159
|
-
|
|
4160
|
-
let n =
|
|
4211
|
+
let t = V;
|
|
4212
|
+
V = [];
|
|
4213
|
+
let n = y_(t), r = !1;
|
|
4161
4214
|
for (let e = 0; e < n.length; e++) try {
|
|
4162
|
-
await
|
|
4215
|
+
await x_(n[e]);
|
|
4163
4216
|
} catch (t) {
|
|
4164
|
-
|
|
4217
|
+
V = n.slice(e).flat().concat(V), r = !0, t instanceof b_ && (u_ = !0, $g.warn(`${t.message}; pausing log shipping until the token is refreshed`));
|
|
4165
4218
|
break;
|
|
4166
4219
|
}
|
|
4167
|
-
r ?
|
|
4220
|
+
r ? H++ : H = 0, C_(S_());
|
|
4168
4221
|
}
|
|
4169
|
-
function
|
|
4170
|
-
|
|
4222
|
+
function T_() {
|
|
4223
|
+
B !== void 0 && (clearTimeout(B), B = void 0), C_(0);
|
|
4171
4224
|
}
|
|
4172
|
-
function
|
|
4173
|
-
|
|
4225
|
+
function E_() {
|
|
4226
|
+
u_ && (u_ = !1, C_(e_));
|
|
4174
4227
|
}
|
|
4175
|
-
function
|
|
4176
|
-
let n =
|
|
4177
|
-
if (
|
|
4178
|
-
|
|
4228
|
+
function D_(e, t) {
|
|
4229
|
+
let n = d_ === 0;
|
|
4230
|
+
if (d_++, z = e, c_ = t, H = 0, !n) {
|
|
4231
|
+
E_();
|
|
4179
4232
|
return;
|
|
4180
4233
|
}
|
|
4181
|
-
|
|
4234
|
+
u_ = !1, V = [], typeof window < "u" && (l_ = T_, window.addEventListener("online", l_)), C_(e_);
|
|
4182
4235
|
}
|
|
4183
|
-
function
|
|
4184
|
-
|
|
4236
|
+
function O_(e) {
|
|
4237
|
+
z && (c_ = e, H = 0, E_());
|
|
4185
4238
|
}
|
|
4186
|
-
function
|
|
4187
|
-
if (!
|
|
4239
|
+
function k_(e, t) {
|
|
4240
|
+
if (!z || !c_) return;
|
|
4188
4241
|
let n = { Events: [{
|
|
4189
4242
|
Time: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4190
4243
|
EventName: e,
|
|
@@ -4194,48 +4247,48 @@ function C_(e, t) {
|
|
|
4194
4247
|
type: "sdk-typescript",
|
|
4195
4248
|
event: n
|
|
4196
4249
|
});
|
|
4197
|
-
fetch(`${
|
|
4250
|
+
fetch(`${z}/events/analytics/json`, {
|
|
4198
4251
|
method: "POST",
|
|
4199
4252
|
headers: {
|
|
4200
4253
|
"Content-Type": "application/json",
|
|
4201
4254
|
...L(),
|
|
4202
|
-
Authorization: `Bearer ${
|
|
4255
|
+
Authorization: `Bearer ${c_}`
|
|
4203
4256
|
},
|
|
4204
4257
|
body: r
|
|
4205
|
-
}).catch((t) =>
|
|
4258
|
+
}).catch((t) => $g.warn(`Failed to send analytics event ${e}: ${t}`));
|
|
4206
4259
|
}
|
|
4207
|
-
function
|
|
4208
|
-
|
|
4260
|
+
function A_() {
|
|
4261
|
+
d_ > 0 && d_--, !(d_ > 0) && (B !== void 0 && (clearTimeout(B), B = void 0), l_ !== void 0 && typeof window < "u" && (window.removeEventListener("online", l_), l_ = void 0), z = void 0, c_ = void 0, V = [], H = 0, u_ = !1);
|
|
4209
4262
|
}
|
|
4210
4263
|
//#endregion
|
|
4211
4264
|
//#region src/utils/connect-timeline.ts
|
|
4212
|
-
var
|
|
4213
|
-
function
|
|
4265
|
+
var j_ = S("ConnectTimeline"), M_ = "ikon-connect-trace-id", N_, P_ = !1;
|
|
4266
|
+
function F_() {
|
|
4214
4267
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`;
|
|
4215
4268
|
}
|
|
4216
|
-
function
|
|
4269
|
+
function I_() {
|
|
4217
4270
|
try {
|
|
4218
|
-
let e = sessionStorage.getItem(
|
|
4271
|
+
let e = sessionStorage.getItem(M_);
|
|
4219
4272
|
if (e) return e;
|
|
4220
|
-
let t =
|
|
4221
|
-
return sessionStorage.setItem(
|
|
4273
|
+
let t = F_();
|
|
4274
|
+
return sessionStorage.setItem(M_, t), t;
|
|
4222
4275
|
} catch {
|
|
4223
|
-
return
|
|
4276
|
+
return N_ ??= F_(), N_;
|
|
4224
4277
|
}
|
|
4225
4278
|
}
|
|
4226
|
-
function
|
|
4279
|
+
function L_(e) {
|
|
4227
4280
|
if (typeof performance > "u" || typeof performance.getEntriesByType != "function") return;
|
|
4228
4281
|
let t = performance.getEntriesByType("resource");
|
|
4229
4282
|
for (let n = t.length - 1; n >= 0; n--) if (t[n].name.includes(e)) return Math.round(t[n].duration);
|
|
4230
4283
|
}
|
|
4231
|
-
var
|
|
4284
|
+
var R_ = [
|
|
4232
4285
|
"/anonymous",
|
|
4233
4286
|
"/init",
|
|
4234
4287
|
"/connect"
|
|
4235
4288
|
];
|
|
4236
|
-
function
|
|
4289
|
+
function z_() {
|
|
4237
4290
|
if (typeof performance > "u" || typeof performance.getEntriesByType != "function") return;
|
|
4238
|
-
let e = performance.getEntriesByType("resource").filter((e) => !
|
|
4291
|
+
let e = performance.getEntriesByType("resource").filter((e) => !R_.some((t) => e.name.includes(t)));
|
|
4239
4292
|
if (e.length === 0) return;
|
|
4240
4293
|
let t = [], n = 0, r = 0, i = 0;
|
|
4241
4294
|
for (let a of e) t.push(a.duration), a.transferSize === 0 && a.decodedBodySize === 0 ? i++ : a.transferSize === 0 ? r++ : n += a.transferSize;
|
|
@@ -4248,33 +4301,33 @@ function N_() {
|
|
|
4248
4301
|
assetOpaqueCount: i
|
|
4249
4302
|
};
|
|
4250
4303
|
}
|
|
4251
|
-
function
|
|
4252
|
-
if (
|
|
4253
|
-
|
|
4254
|
-
let t = { connectTraceId:
|
|
4304
|
+
function B_(e = {}) {
|
|
4305
|
+
if (P_) return;
|
|
4306
|
+
P_ = !0;
|
|
4307
|
+
let t = { connectTraceId: I_() };
|
|
4255
4308
|
e.snapshotSeeded !== void 0 && (t.snapshotSeeded = String(e.snapshotSeeded));
|
|
4256
4309
|
try {
|
|
4257
4310
|
if (typeof performance < "u") {
|
|
4258
4311
|
t.firstPaintMs = String(Math.round(performance.now()));
|
|
4259
4312
|
let e = performance.getEntriesByType("navigation")[0];
|
|
4260
4313
|
e && (t.cdnHtmlMs = String(Math.round(e.responseEnd - e.fetchStart)), t.domContentLoadedMs = String(Math.round(e.domContentLoadedEventEnd)));
|
|
4261
|
-
let n =
|
|
4314
|
+
let n = L_("/anonymous");
|
|
4262
4315
|
n !== void 0 && (t.authMs = String(n));
|
|
4263
|
-
let r =
|
|
4316
|
+
let r = L_("/init");
|
|
4264
4317
|
r !== void 0 && (t.initMs = String(r));
|
|
4265
|
-
let i =
|
|
4318
|
+
let i = L_("/connect");
|
|
4266
4319
|
i !== void 0 && (t.connectMs = String(i));
|
|
4267
|
-
let a =
|
|
4320
|
+
let a = z_();
|
|
4268
4321
|
if (a) for (let [e, n] of Object.entries(a)) t[e] = String(n);
|
|
4269
4322
|
}
|
|
4270
4323
|
} catch (e) {
|
|
4271
|
-
|
|
4324
|
+
j_.warn(`Failed to read performance timeline: ${e}`);
|
|
4272
4325
|
}
|
|
4273
|
-
|
|
4326
|
+
k_("client_connect_timeline", t);
|
|
4274
4327
|
}
|
|
4275
4328
|
//#endregion
|
|
4276
4329
|
//#region src/utils/uuid.ts
|
|
4277
|
-
function
|
|
4330
|
+
function V_() {
|
|
4278
4331
|
let e = globalThis.crypto;
|
|
4279
4332
|
if (e && typeof e.randomUUID == "function") return e.randomUUID();
|
|
4280
4333
|
let t = /* @__PURE__ */ new Uint8Array(16);
|
|
@@ -4287,37 +4340,37 @@ function F_() {
|
|
|
4287
4340
|
}
|
|
4288
4341
|
//#endregion
|
|
4289
4342
|
//#region src/storage.ts
|
|
4290
|
-
var
|
|
4291
|
-
function
|
|
4292
|
-
if (typeof window > "u" || typeof localStorage > "u") return
|
|
4343
|
+
var H_ = S("Storage"), U_ = "ikon-device-id", W_ = null, G_ = !1;
|
|
4344
|
+
function K_() {
|
|
4345
|
+
if (typeof window > "u" || typeof localStorage > "u") return W_ ??= V_();
|
|
4293
4346
|
try {
|
|
4294
|
-
let e = localStorage.getItem(
|
|
4295
|
-
return e || (e =
|
|
4347
|
+
let e = localStorage.getItem(U_);
|
|
4348
|
+
return e || (e = W_ ?? V_(), localStorage.setItem(U_, e)), e;
|
|
4296
4349
|
} catch (e) {
|
|
4297
|
-
return
|
|
4350
|
+
return G_ || (G_ = !0, H_.warn(`localStorage is unavailable; the device id will not survive this page: ${e}`)), W_ ??= V_();
|
|
4298
4351
|
}
|
|
4299
4352
|
}
|
|
4300
|
-
function
|
|
4353
|
+
function q_() {
|
|
4301
4354
|
if (!(typeof localStorage > "u")) {
|
|
4302
|
-
|
|
4355
|
+
W_ = null;
|
|
4303
4356
|
try {
|
|
4304
|
-
localStorage.removeItem(
|
|
4357
|
+
localStorage.removeItem(U_);
|
|
4305
4358
|
} catch {}
|
|
4306
4359
|
}
|
|
4307
4360
|
}
|
|
4308
|
-
function
|
|
4309
|
-
let t =
|
|
4361
|
+
function J_(e) {
|
|
4362
|
+
let t = X_(e);
|
|
4310
4363
|
return typeof t?.id == "string" ? t.id : null;
|
|
4311
4364
|
}
|
|
4312
|
-
function
|
|
4313
|
-
let t =
|
|
4365
|
+
function Y_(e) {
|
|
4366
|
+
let t = X_(e);
|
|
4314
4367
|
return t ? {
|
|
4315
4368
|
userId: typeof t.id == "string" ? t.id : null,
|
|
4316
4369
|
authSession: typeof t.authSession == "string" ? t.authSession : null,
|
|
4317
4370
|
role: typeof t.role == "string" ? t.role : null
|
|
4318
4371
|
} : null;
|
|
4319
4372
|
}
|
|
4320
|
-
function
|
|
4373
|
+
function X_(e) {
|
|
4321
4374
|
try {
|
|
4322
4375
|
let t = e.split(".");
|
|
4323
4376
|
if (t.length !== 3) return null;
|
|
@@ -4329,8 +4382,8 @@ function W_(e) {
|
|
|
4329
4382
|
}
|
|
4330
4383
|
//#endregion
|
|
4331
4384
|
//#region src/connection/authenticator.ts
|
|
4332
|
-
var
|
|
4333
|
-
function
|
|
4385
|
+
var U = S("Authenticator"), Z_ = x.GROUP_CORE | x.GROUP_KEEPALIVE | x.GROUP_EVENTS | x.GROUP_ACTIONS | x.GROUP_UI | x.GROUP_AUDIO | x.GROUP_VIDEO | x.GROUP_ANALYTICS | x.GROUP_APP_LOCAL, Q_ = 2, $_ = 6e4, ev = 2e3, tv = 1e4, nv = 3e3, rv = 3e3, iv = 3, av = "X-Ikon-Startup-Failed", ov = "startup_failed", sv = 1e3, cv = 5, lv = "env";
|
|
4386
|
+
function uv(e) {
|
|
4334
4387
|
let t = e.streamPath ? gm(e.streamPath) : null;
|
|
4335
4388
|
return {
|
|
4336
4389
|
direct: e.url,
|
|
@@ -4338,10 +4391,10 @@ function iv(e) {
|
|
|
4338
4391
|
lb: t ?? void 0
|
|
4339
4392
|
};
|
|
4340
4393
|
}
|
|
4341
|
-
function
|
|
4394
|
+
function dv(e) {
|
|
4342
4395
|
if (!(typeof e != "object" || !e)) return { showButton: e.showButton === !0 };
|
|
4343
4396
|
}
|
|
4344
|
-
async function
|
|
4397
|
+
async function fv(e, t, n, r) {
|
|
4345
4398
|
if (!e) return;
|
|
4346
4399
|
let i;
|
|
4347
4400
|
try {
|
|
@@ -4351,7 +4404,7 @@ async function ov(e, t, n, r) {
|
|
|
4351
4404
|
body: JSON.stringify({
|
|
4352
4405
|
deviceId: t,
|
|
4353
4406
|
space: e,
|
|
4354
|
-
testLink:
|
|
4407
|
+
testLink: Ve() ?? void 0
|
|
4355
4408
|
}),
|
|
4356
4409
|
signal: r
|
|
4357
4410
|
});
|
|
@@ -4364,14 +4417,14 @@ async function ov(e, t, n, r) {
|
|
|
4364
4417
|
}
|
|
4365
4418
|
let a = await i.json();
|
|
4366
4419
|
if (!a.token) throw new T(`Anonymous auth for space ${e} returned no token`);
|
|
4367
|
-
let o =
|
|
4420
|
+
let o = J_(a.token);
|
|
4368
4421
|
if (!o) throw new T(`Anonymous auth token for space ${e} had no extractable userId`);
|
|
4369
4422
|
return {
|
|
4370
4423
|
userId: o,
|
|
4371
4424
|
token: a.token
|
|
4372
4425
|
};
|
|
4373
4426
|
}
|
|
4374
|
-
async function
|
|
4427
|
+
async function pv(e, t, n, r) {
|
|
4375
4428
|
try {
|
|
4376
4429
|
let i = await fetch(`${e}/profiles/me?space=${encodeURIComponent(t)}`, {
|
|
4377
4430
|
method: "GET",
|
|
@@ -4381,15 +4434,15 @@ async function sv(e, t, n, r) {
|
|
|
4381
4434
|
},
|
|
4382
4435
|
signal: r
|
|
4383
4436
|
});
|
|
4384
|
-
i.ok ||
|
|
4437
|
+
i.ok || U.warn(`Failed to ensure profile: ${i.status}`);
|
|
4385
4438
|
} catch (e) {
|
|
4386
|
-
|
|
4439
|
+
U.warn("Failed to ensure profile:", e);
|
|
4387
4440
|
}
|
|
4388
4441
|
}
|
|
4389
|
-
async function
|
|
4390
|
-
return (await
|
|
4442
|
+
async function mv(e) {
|
|
4443
|
+
return (await hv(e)).message;
|
|
4391
4444
|
}
|
|
4392
|
-
async function
|
|
4445
|
+
async function hv(e) {
|
|
4393
4446
|
let t = await e.text().catch(() => "Unknown error");
|
|
4394
4447
|
try {
|
|
4395
4448
|
let e = JSON.parse(t);
|
|
@@ -4401,16 +4454,16 @@ async function lv(e) {
|
|
|
4401
4454
|
} catch {}
|
|
4402
4455
|
return { message: t };
|
|
4403
4456
|
}
|
|
4404
|
-
async function
|
|
4457
|
+
async function gv(e) {
|
|
4405
4458
|
if (e.ok) return;
|
|
4406
|
-
let t = await
|
|
4407
|
-
throw e.status === 403 ? new
|
|
4459
|
+
let t = await mv(e);
|
|
4460
|
+
throw e.status === 403 ? new Ae(`Access denied: ${t}`, t) : _v("Failed to get or create profile", e.status, t);
|
|
4408
4461
|
}
|
|
4409
|
-
function
|
|
4462
|
+
function _v(e, t, n) {
|
|
4410
4463
|
let r = `${e}: ${t} ${n}`;
|
|
4411
4464
|
return t >= 500 ? new rt(r, t) : new T(r);
|
|
4412
4465
|
}
|
|
4413
|
-
function
|
|
4466
|
+
function vv(e, t, n) {
|
|
4414
4467
|
let r = {
|
|
4415
4468
|
method: "POST",
|
|
4416
4469
|
headers: {
|
|
@@ -4423,110 +4476,110 @@ function fv(e, t, n) {
|
|
|
4423
4476
|
};
|
|
4424
4477
|
return t || (r.credentials = "include"), r;
|
|
4425
4478
|
}
|
|
4426
|
-
async function
|
|
4427
|
-
let i = `${e}/init`, a = await fetch(i,
|
|
4479
|
+
async function yv(e, t, n, r) {
|
|
4480
|
+
let i = `${e}/init`, a = await fetch(i, vv(t, n, r));
|
|
4428
4481
|
if (!a.ok) {
|
|
4429
|
-
let { message: e, code: n, connectionId: r } = await
|
|
4430
|
-
throw a.status === 401 ? new
|
|
4482
|
+
let { message: e, code: n, connectionId: r } = await hv(a);
|
|
4483
|
+
throw a.status === 401 ? new Ie(`Backend rejected the credential: ${e}`) : a.status === 403 && n === "SSO_REQUIRED" && r ? new _t(`Access denied: ${e}`, e, r) : a.status === 403 ? new Ae(`Access denied: ${e}`, e) : a.status === 404 && t.sessionIdentityHash ? new qe(t.sessionIdentityHash) : _v("Backend init failed", a.status, e);
|
|
4431
4484
|
}
|
|
4432
4485
|
return a.json();
|
|
4433
4486
|
}
|
|
4434
|
-
function
|
|
4487
|
+
function bv(e, t) {
|
|
4435
4488
|
return e.startupFailed ? new pt() : new lt(t);
|
|
4436
4489
|
}
|
|
4437
|
-
async function
|
|
4438
|
-
e =
|
|
4439
|
-
let i = j(n ??
|
|
4490
|
+
async function xv(e, t, n, r) {
|
|
4491
|
+
e = Tv(e, r);
|
|
4492
|
+
let i = j(n ?? tv), a = t ? tm([t, i]) : i, o = Date.now(), s = await fetch(e, { signal: a });
|
|
4440
4493
|
if (!s.ok) {
|
|
4441
4494
|
let e = await s.text().catch(() => "Unknown error");
|
|
4442
|
-
throw s.status === 429 ? new ht(`Server is at capacity: ${e}`) : s.headers.get(
|
|
4495
|
+
throw s.status === 429 ? new ht(`Server is at capacity: ${e}`) : s.headers.get(av) || e.includes(ov) ? new pt() : _v("Failed to connect", s.status, e);
|
|
4443
4496
|
}
|
|
4444
4497
|
let c = await s.arrayBuffer(), l = await Xa(new Uint8Array(c));
|
|
4445
|
-
return
|
|
4498
|
+
return U.debug(`Connect URL fetched in ${Date.now() - o}ms`), { authResponse: l };
|
|
4446
4499
|
}
|
|
4447
|
-
async function
|
|
4500
|
+
async function Sv(e, t) {
|
|
4448
4501
|
try {
|
|
4449
|
-
let n = new URL(e), r = `${n.protocol}//${n.host}/health`, i = j(
|
|
4502
|
+
let n = new URL(e), r = `${n.protocol}//${n.host}/health`, i = j(rv), a = t ? tm([t, i]) : i;
|
|
4450
4503
|
return (await fetch(r, { signal: a })).ok;
|
|
4451
4504
|
} catch {
|
|
4452
4505
|
return !1;
|
|
4453
4506
|
}
|
|
4454
4507
|
}
|
|
4455
|
-
async function
|
|
4508
|
+
async function Cv(e, t, n, r) {
|
|
4456
4509
|
let i = Op(k.filter((t) => e[t]), n, t).map((t) => ({
|
|
4457
4510
|
tier: t,
|
|
4458
4511
|
url: e[t]
|
|
4459
4512
|
}));
|
|
4460
4513
|
if (i.length === 0) throw new T("No connect URL available");
|
|
4461
|
-
|
|
4514
|
+
U.debug(`Auth URL order: [${i.map((e) => e.tier).join(", ")}], mode: ${t}, learned tier: ${n}`);
|
|
4462
4515
|
let a = t === "auto" && i.length > 1 && i[0].tier === "direct", o = Date.now(), s = 0, c;
|
|
4463
|
-
for (; s <
|
|
4516
|
+
for (; s < Q_ || Date.now() - o < $_;) {
|
|
4464
4517
|
let t = [];
|
|
4465
4518
|
for (let n = 0; n < i.length; n++) {
|
|
4466
|
-
let o = i[n], l = s === 0 && n === 0 && a ?
|
|
4519
|
+
let o = i[n], l = s === 0 && n === 0 && a ? nv : tv;
|
|
4467
4520
|
try {
|
|
4468
|
-
let t = await
|
|
4469
|
-
return t.usedProxyUrl = o.tier !== "direct", t.connectTier = o.tier, t.connectTierUrls = e, t.directUrl = e.direct,
|
|
4521
|
+
let t = await xv(o.url, r, l);
|
|
4522
|
+
return t.usedProxyUrl = o.tier !== "direct", t.connectTier = o.tier, t.connectTierUrls = e, t.directUrl = e.direct, U.debug(`Auth succeeded via the ${o.tier} URL`), t;
|
|
4470
4523
|
} catch (e) {
|
|
4471
4524
|
if (r?.aborted || e instanceof ht || e instanceof pt) throw e;
|
|
4472
|
-
|
|
4525
|
+
U.debug(`Auth via the ${o.tier} URL failed (round ${s + 1}, timeout ${l}ms): ${e}`), c = e, t.push(`${o.tier}: ${e}`);
|
|
4473
4526
|
}
|
|
4474
4527
|
}
|
|
4475
|
-
s === 1 &&
|
|
4528
|
+
s === 1 && U.warn(`Auth failed on every connect URL for two rounds (${t.join("; ")})`), s++, await ct(ev, r);
|
|
4476
4529
|
}
|
|
4477
4530
|
throw new T("Failed to connect after exhausting all URL attempts", c instanceof Error ? c : void 0);
|
|
4478
4531
|
}
|
|
4479
|
-
function
|
|
4480
|
-
let t =
|
|
4532
|
+
function wv(e = {}) {
|
|
4533
|
+
let t = mh();
|
|
4481
4534
|
return yi({
|
|
4482
4535
|
Description: "Ikon SDK TypeScript",
|
|
4483
4536
|
ProductId: "ikon-sdk",
|
|
4484
4537
|
VersionId: "1.0.0",
|
|
4485
|
-
DeviceId:
|
|
4538
|
+
DeviceId: K_(),
|
|
4486
4539
|
Locale: typeof navigator < "u" ? navigator.language : "en-US",
|
|
4487
4540
|
UserAgent: typeof navigator < "u" ? navigator.userAgent : "",
|
|
4488
|
-
ClientType:
|
|
4489
|
-
SdkCapability:
|
|
4541
|
+
ClientType: Eh(),
|
|
4542
|
+
SdkCapability: cv,
|
|
4490
4543
|
ProtocolVersion: 1,
|
|
4491
4544
|
PayloadType: o.Teleport,
|
|
4492
4545
|
SupportsCompression: Nt(),
|
|
4493
4546
|
ViewportWidth: t.width,
|
|
4494
4547
|
ViewportHeight: t.height,
|
|
4495
|
-
Theme:
|
|
4496
|
-
Timezone:
|
|
4497
|
-
IsTouchDevice:
|
|
4498
|
-
InitialPath:
|
|
4499
|
-
InitialUrl:
|
|
4500
|
-
IsSnapshot:
|
|
4548
|
+
Theme: ph(),
|
|
4549
|
+
Timezone: wh(),
|
|
4550
|
+
IsTouchDevice: Th(),
|
|
4551
|
+
InitialPath: km(),
|
|
4552
|
+
InitialUrl: Am(),
|
|
4553
|
+
IsSnapshot: Se(),
|
|
4501
4554
|
...e
|
|
4502
4555
|
});
|
|
4503
4556
|
}
|
|
4504
|
-
function
|
|
4505
|
-
if (e.includes(`${
|
|
4506
|
-
let n =
|
|
4507
|
-
return `${e}${e.includes("?") ? "&" : "?"}${
|
|
4557
|
+
function Tv(e, t) {
|
|
4558
|
+
if (e.includes(`${lv}=`)) return e;
|
|
4559
|
+
let n = Ev(xi(t ?? wv()));
|
|
4560
|
+
return `${e}${e.includes("?") ? "&" : "?"}${lv}=${n}`;
|
|
4508
4561
|
}
|
|
4509
|
-
function
|
|
4562
|
+
function Ev(e) {
|
|
4510
4563
|
let t = "";
|
|
4511
4564
|
for (let n of e) t += String.fromCharCode(n);
|
|
4512
4565
|
return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
4513
4566
|
}
|
|
4514
|
-
function
|
|
4567
|
+
function Dv(e, t, n = "", r = !0) {
|
|
4515
4568
|
return Ci({
|
|
4516
4569
|
ContextType: d.Browser,
|
|
4517
4570
|
UserType: c.Human,
|
|
4518
4571
|
IsInternal: !1,
|
|
4519
4572
|
UserId: t,
|
|
4520
|
-
OpcodeGroupsFromServer: e.opcodeGroupsFromServer ??
|
|
4521
|
-
OpcodeGroupsToServer: e.opcodeGroupsToServer ??
|
|
4573
|
+
OpcodeGroupsFromServer: e.opcodeGroupsFromServer ?? Z_,
|
|
4574
|
+
OpcodeGroupsToServer: e.opcodeGroupsToServer ?? Z_,
|
|
4522
4575
|
AuthSessionId: n,
|
|
4523
4576
|
IsAnonymous: r,
|
|
4524
4577
|
IsGlobal: !1,
|
|
4525
4578
|
Parameters: e.parameters ?? {}
|
|
4526
4579
|
});
|
|
4527
4580
|
}
|
|
4528
|
-
function
|
|
4529
|
-
return
|
|
4581
|
+
function Ov(e) {
|
|
4582
|
+
return wv({
|
|
4530
4583
|
...e.description === void 0 ? {} : { Description: e.description },
|
|
4531
4584
|
...e.deviceId === void 0 ? {} : { DeviceId: e.deviceId },
|
|
4532
4585
|
...e.productId === void 0 ? {} : { ProductId: e.productId },
|
|
@@ -4535,7 +4588,7 @@ function Sv(e) {
|
|
|
4535
4588
|
...e.locale === void 0 ? {} : { Locale: e.locale }
|
|
4536
4589
|
});
|
|
4537
4590
|
}
|
|
4538
|
-
function
|
|
4591
|
+
function kv(e) {
|
|
4539
4592
|
return {
|
|
4540
4593
|
ContextType: e.ContextType,
|
|
4541
4594
|
UserType: e.UserType,
|
|
@@ -4549,21 +4602,21 @@ function Cv(e) {
|
|
|
4549
4602
|
Parameters: e.Parameters
|
|
4550
4603
|
};
|
|
4551
4604
|
}
|
|
4552
|
-
async function
|
|
4605
|
+
async function Av(e, t) {
|
|
4553
4606
|
let n = `https://${e.host}:${e.httpsPort}`;
|
|
4554
|
-
|
|
4607
|
+
U.debug(`Authenticating with local server: ${n}`);
|
|
4555
4608
|
let r = {
|
|
4556
|
-
...
|
|
4609
|
+
...wm(),
|
|
4557
4610
|
...e.parameters
|
|
4558
|
-
}, i = e.deviceId ??
|
|
4611
|
+
}, i = e.deviceId ?? K_(), a = e.userId, o = e.token;
|
|
4559
4612
|
if (!a) {
|
|
4560
|
-
let n = await
|
|
4613
|
+
let n = await fv(e.spaceId, i, await xm(e.authUrl), t);
|
|
4561
4614
|
n && (a = n.userId, o = n.token);
|
|
4562
4615
|
}
|
|
4563
|
-
if (a || (a = i,
|
|
4616
|
+
if (a || (a = i, U.debug("No spaceId configured; using deviceId as userId")), e.spaceId && o) {
|
|
4564
4617
|
if (e.token) {
|
|
4565
4618
|
let n = M(e.backendUrl);
|
|
4566
|
-
await
|
|
4619
|
+
await gv(await fetch(`${n}/profiles/me?space=${encodeURIComponent(e.spaceId)}`, {
|
|
4567
4620
|
method: "GET",
|
|
4568
4621
|
headers: {
|
|
4569
4622
|
...L(),
|
|
@@ -4571,9 +4624,9 @@ async function wv(e, t) {
|
|
|
4571
4624
|
},
|
|
4572
4625
|
signal: t
|
|
4573
4626
|
}));
|
|
4574
|
-
} else await
|
|
4627
|
+
} else await pv(M(e.backendUrl), e.spaceId, o, t);
|
|
4575
4628
|
}
|
|
4576
|
-
let s = e.token ?? e.identityToken ?? o, c = s ?
|
|
4629
|
+
let s = e.token ?? e.identityToken ?? o, c = s ? Y_(s) : null, l = c?.authSession ?? (e.token ? "authenticated" : ""), u = c?.role ? c.role === "anonymous" : !e.token, d = kv(Dv({
|
|
4577
4630
|
...e,
|
|
4578
4631
|
parameters: r
|
|
4579
4632
|
}, a, l, u)), f = await fetch(`${n}/connect-token`, {
|
|
@@ -4584,66 +4637,66 @@ async function wv(e, t) {
|
|
|
4584
4637
|
});
|
|
4585
4638
|
if (!f.ok) {
|
|
4586
4639
|
let e = await f.text().catch(() => "Unknown error");
|
|
4587
|
-
throw
|
|
4640
|
+
throw _v("Failed to get connect token", f.status, e);
|
|
4588
4641
|
}
|
|
4589
4642
|
let p = (await f.json()).token;
|
|
4590
4643
|
if (!p) throw new T("Server did not return a token");
|
|
4591
|
-
let m = `${n}/connect?token=${encodeURIComponent(p)}`, h = await
|
|
4644
|
+
let m = `${n}/connect?token=${encodeURIComponent(p)}`, h = await xv(m, t, void 0, Ov(e));
|
|
4592
4645
|
return h.directUrl = m, h.backendUrl = M(e.backendUrl), h.authToken = o, h;
|
|
4593
4646
|
}
|
|
4594
|
-
async function
|
|
4595
|
-
let u =
|
|
4647
|
+
async function jv(e, t, n, r, i, a, s, c = "auto", l = "direct") {
|
|
4648
|
+
let u = wm(), d = n.provisioningTimeoutMs ?? 6e4, f = {
|
|
4596
4649
|
...u,
|
|
4597
4650
|
...n.parameters
|
|
4598
|
-
}, p =
|
|
4651
|
+
}, p = mh(), m = w() ? iv : 1;
|
|
4599
4652
|
for (let u = 0; u < m; u++) try {
|
|
4600
4653
|
let u = {
|
|
4601
4654
|
space: n.spaceId,
|
|
4602
4655
|
sessionIdentityHash: n.sessionIdentityHash,
|
|
4603
|
-
testLink:
|
|
4656
|
+
testLink: Ve() ?? void 0,
|
|
4604
4657
|
params: n.parameters,
|
|
4605
4658
|
waitForRunning: !0,
|
|
4606
4659
|
waitForRunningTimeoutMs: d,
|
|
4607
|
-
connectTraceId:
|
|
4660
|
+
connectTraceId: I_(),
|
|
4608
4661
|
contextType: r,
|
|
4609
4662
|
userType: i,
|
|
4610
4663
|
clientType: a,
|
|
4611
4664
|
payloadType: o.Teleport,
|
|
4612
4665
|
description: n.description ?? "Ikon SDK TypeScript",
|
|
4613
|
-
deviceId: n.deviceId ??
|
|
4666
|
+
deviceId: n.deviceId ?? K_(),
|
|
4614
4667
|
productId: n.productId ?? "",
|
|
4615
4668
|
versionId: n.versionId ?? "",
|
|
4616
4669
|
installId: n.installId ?? "",
|
|
4617
4670
|
locale: n.locale ?? (typeof navigator < "u" ? navigator.language : "en-US"),
|
|
4618
|
-
opcodeGroupsFromServer: n.opcodeGroupsFromServer ??
|
|
4619
|
-
opcodeGroupsToServer: n.opcodeGroupsToServer ??
|
|
4671
|
+
opcodeGroupsFromServer: n.opcodeGroupsFromServer ?? Z_,
|
|
4672
|
+
opcodeGroupsToServer: n.opcodeGroupsToServer ?? Z_,
|
|
4620
4673
|
protocolVersion: 1,
|
|
4621
4674
|
userAgent: typeof navigator < "u" ? navigator.userAgent : "",
|
|
4622
4675
|
launchParams: f,
|
|
4623
4676
|
viewportWidth: p.width,
|
|
4624
4677
|
viewportHeight: p.height,
|
|
4625
|
-
theme:
|
|
4626
|
-
timezone:
|
|
4627
|
-
isTouchDevice:
|
|
4628
|
-
initialPath:
|
|
4629
|
-
initialUrl:
|
|
4678
|
+
theme: ph(),
|
|
4679
|
+
timezone: wh(),
|
|
4680
|
+
isTouchDevice: Th(),
|
|
4681
|
+
initialPath: km(),
|
|
4682
|
+
initialUrl: Am(),
|
|
4630
4683
|
sdkType: 2,
|
|
4631
|
-
sdkCapability:
|
|
4684
|
+
sdkCapability: cv,
|
|
4632
4685
|
supportsCompression: Nt(),
|
|
4633
|
-
isSnapshot:
|
|
4634
|
-
}, m = s ? tm([s, j(d)]) : j(d), h = await
|
|
4635
|
-
if (h.state?.toLowerCase() !== "running" || !h.configuration?.url) throw
|
|
4636
|
-
let g = await
|
|
4637
|
-
return g.backendUrl = e, g.authToken = t, g.brandingRequired = h.configuration.brandingRequired ?? !1, g.feedback =
|
|
4686
|
+
isSnapshot: Se()
|
|
4687
|
+
}, m = s ? tm([s, j(d)]) : j(d), h = await yv(e, u, t, m);
|
|
4688
|
+
if (h.state?.toLowerCase() !== "running" || !h.configuration?.url) throw bv(h, d);
|
|
4689
|
+
let g = await Cv(uv(h.configuration), c, l, m);
|
|
4690
|
+
return g.backendUrl = e, g.authToken = t, g.brandingRequired = h.configuration.brandingRequired ?? !1, g.feedback = dv(h.configuration.feedback), Ag(h.configuration.push), g;
|
|
4638
4691
|
} catch (e) {
|
|
4639
|
-
if (e instanceof
|
|
4640
|
-
|
|
4692
|
+
if (e instanceof Ie || e instanceof Ae || e instanceof ht || e instanceof qe || e instanceof pt || u === m - 1) throw e;
|
|
4693
|
+
U.debug(`Init attempt ${u + 1}/${m} failed, retrying: ${e}`), await ct(sv * (u + 1), s);
|
|
4641
4694
|
}
|
|
4642
4695
|
throw new T("Failed to init after all attempts");
|
|
4643
4696
|
}
|
|
4644
|
-
async function
|
|
4697
|
+
async function Mv(e, t, n = "auto", r = "direct") {
|
|
4645
4698
|
let i = vm(e.backendType);
|
|
4646
|
-
|
|
4699
|
+
U.debug(`Authenticating with cloud server: ${i}, space ID: ${e.spaceId}`);
|
|
4647
4700
|
let a = await fetch(`${i}/auth/api-key`, {
|
|
4648
4701
|
method: "POST",
|
|
4649
4702
|
headers: { "Content-Type": "application/json" },
|
|
@@ -4656,30 +4709,30 @@ async function Ev(e, t, n = "auto", r = "direct") {
|
|
|
4656
4709
|
});
|
|
4657
4710
|
if (!a.ok) {
|
|
4658
4711
|
let e = await a.text().catch(() => "Unknown error");
|
|
4659
|
-
throw
|
|
4712
|
+
throw _v("API key authentication failed", a.status, e);
|
|
4660
4713
|
}
|
|
4661
4714
|
let o = (await a.json()).token;
|
|
4662
4715
|
if (!o) throw new T("Backend did not return a token");
|
|
4663
|
-
return
|
|
4716
|
+
return jv(i, o, e, d.Plugin, e.userType ?? c.Human, e.clientType ?? Eh(), t, n, r);
|
|
4664
4717
|
}
|
|
4665
|
-
async function
|
|
4718
|
+
async function Nv(e, t, n = "auto", r = "direct") {
|
|
4666
4719
|
let i = vm(e.backendType), a = e.token;
|
|
4667
|
-
return
|
|
4720
|
+
return U.debug(`Authenticating with session token to: ${i}, space ID: ${e.spaceId}`), jv(i, a, e, d.Browser, c.Human, Eh(), t, n, r);
|
|
4668
4721
|
}
|
|
4669
4722
|
//#endregion
|
|
4670
4723
|
//#region src/functions/type-conversion.ts
|
|
4671
|
-
var
|
|
4672
|
-
function
|
|
4724
|
+
var Pv = /* @__PURE__ */ new Uint8Array();
|
|
4725
|
+
function Fv(e) {
|
|
4673
4726
|
switch (e.kind) {
|
|
4674
4727
|
case "array": return {
|
|
4675
4728
|
kind: "array",
|
|
4676
|
-
element:
|
|
4729
|
+
element: Fv(e.element),
|
|
4677
4730
|
nullable: e.nullable ?? !1
|
|
4678
4731
|
};
|
|
4679
4732
|
case "dictionary": return {
|
|
4680
4733
|
kind: "dictionary",
|
|
4681
4734
|
keyType: e.keyType ?? "string",
|
|
4682
|
-
value:
|
|
4735
|
+
value: Fv(e.value),
|
|
4683
4736
|
nullable: e.nullable ?? !1
|
|
4684
4737
|
};
|
|
4685
4738
|
default: return {
|
|
@@ -4688,17 +4741,17 @@ function kv(e) {
|
|
|
4688
4741
|
};
|
|
4689
4742
|
}
|
|
4690
4743
|
}
|
|
4691
|
-
function
|
|
4744
|
+
function Iv(e) {
|
|
4692
4745
|
switch (e.kind) {
|
|
4693
4746
|
case "boolean": return "System.Boolean";
|
|
4694
4747
|
case "number": return "System.Double";
|
|
4695
4748
|
case "string": return "System.String";
|
|
4696
|
-
case "array": return `System.Collections.Generic.List\`1[${
|
|
4697
|
-
case "dictionary": return `System.Collections.Generic.Dictionary\`2[${e.keyType === "int" ? "System.Int32" : "System.String"},${
|
|
4749
|
+
case "array": return `System.Collections.Generic.List\`1[${Iv(e.element)}]`;
|
|
4750
|
+
case "dictionary": return `System.Collections.Generic.Dictionary\`2[${e.keyType === "int" ? "System.Int32" : "System.String"},${Iv(e.value)}]`;
|
|
4698
4751
|
default: return e;
|
|
4699
4752
|
}
|
|
4700
4753
|
}
|
|
4701
|
-
function
|
|
4754
|
+
function Lv(e, t) {
|
|
4702
4755
|
if (e === void 0 || e === "") return;
|
|
4703
4756
|
let n = JSON.parse(e);
|
|
4704
4757
|
if (n === null) {
|
|
@@ -4707,7 +4760,7 @@ function jv(e, t) {
|
|
|
4707
4760
|
}
|
|
4708
4761
|
return n;
|
|
4709
4762
|
}
|
|
4710
|
-
function
|
|
4763
|
+
function Rv(e, t) {
|
|
4711
4764
|
if (e === void 0) return "null";
|
|
4712
4765
|
if (e === null) {
|
|
4713
4766
|
if (!t.nullable) throw Error("Value cannot be null for non-nullable type");
|
|
@@ -4715,9 +4768,9 @@ function Mv(e, t) {
|
|
|
4715
4768
|
}
|
|
4716
4769
|
return JSON.stringify(e);
|
|
4717
4770
|
}
|
|
4718
|
-
function
|
|
4771
|
+
function zv(e, t) {
|
|
4719
4772
|
let n = (e.parameters ?? []).map((e) => {
|
|
4720
|
-
let t =
|
|
4773
|
+
let t = Fv(e.type), n = Object.prototype.hasOwnProperty.call(e, "defaultValue"), r = n ? Rv(e.defaultValue, t) : "";
|
|
4721
4774
|
return {
|
|
4722
4775
|
name: e.name,
|
|
4723
4776
|
descriptor: t,
|
|
@@ -4725,7 +4778,7 @@ function Nv(e, t) {
|
|
|
4725
4778
|
defaultValueJson: r,
|
|
4726
4779
|
description: e.description
|
|
4727
4780
|
};
|
|
4728
|
-
}), r =
|
|
4781
|
+
}), r = Fv(e.returnType);
|
|
4729
4782
|
return {
|
|
4730
4783
|
definition: e,
|
|
4731
4784
|
handler: t,
|
|
@@ -4735,7 +4788,7 @@ function Nv(e, t) {
|
|
|
4735
4788
|
Description: e.description ?? "",
|
|
4736
4789
|
LlmInlineResult: e.llmInlineResult ?? !1,
|
|
4737
4790
|
LlmCallOnlyOnce: e.llmCallOnlyOnce ?? !1,
|
|
4738
|
-
ResultTypeName:
|
|
4791
|
+
ResultTypeName: Iv(r),
|
|
4739
4792
|
IsEnumerable: !1,
|
|
4740
4793
|
EnumerableItemTypeName: "",
|
|
4741
4794
|
IsCancellable: !1,
|
|
@@ -4744,10 +4797,10 @@ function Nv(e, t) {
|
|
|
4744
4797
|
Parameters: n.map((e, t) => ({
|
|
4745
4798
|
ParameterIndex: t,
|
|
4746
4799
|
ParameterName: e.name,
|
|
4747
|
-
TypeName:
|
|
4800
|
+
TypeName: Iv(e.descriptor),
|
|
4748
4801
|
HasDefaultValue: e.hasDefaultValue,
|
|
4749
4802
|
DefaultValueJson: e.defaultValueJson,
|
|
4750
|
-
DefaultValueData:
|
|
4803
|
+
DefaultValueData: Pv,
|
|
4751
4804
|
IsEnumerable: !1,
|
|
4752
4805
|
EnumerableItemTypeName: "",
|
|
4753
4806
|
Description: e.description ?? ""
|
|
@@ -4759,24 +4812,24 @@ function Nv(e, t) {
|
|
|
4759
4812
|
}
|
|
4760
4813
|
//#endregion
|
|
4761
4814
|
//#region src/functions/types.ts
|
|
4762
|
-
function
|
|
4815
|
+
function Bv(e, t) {
|
|
4763
4816
|
return {
|
|
4764
4817
|
value: e,
|
|
4765
4818
|
data: t
|
|
4766
4819
|
};
|
|
4767
4820
|
}
|
|
4768
|
-
var
|
|
4821
|
+
var Vv = class extends Error {
|
|
4769
4822
|
remoteErrorType;
|
|
4770
4823
|
remoteStackTrace;
|
|
4771
4824
|
code;
|
|
4772
4825
|
constructor(e, t, n, r = "") {
|
|
4773
4826
|
super(e), this.remoteErrorType = t, this.remoteStackTrace = n, this.code = r, this.name = "FunctionCallError";
|
|
4774
4827
|
}
|
|
4775
|
-
},
|
|
4776
|
-
function
|
|
4828
|
+
}, W = S("FunctionRegistry"), Hv = /* @__PURE__ */ new Uint8Array(), Uv = 3e4;
|
|
4829
|
+
function Wv(e) {
|
|
4777
4830
|
return !e || typeof e != "object" ? !1 : e.data instanceof Uint8Array;
|
|
4778
4831
|
}
|
|
4779
|
-
var
|
|
4832
|
+
var Gv = class {
|
|
4780
4833
|
functions = /* @__PURE__ */ new Map();
|
|
4781
4834
|
remoteFunctions = /* @__PURE__ */ new Map();
|
|
4782
4835
|
pendingCalls = /* @__PURE__ */ new Map();
|
|
@@ -4798,8 +4851,8 @@ var zv = class {
|
|
|
4798
4851
|
};
|
|
4799
4852
|
}
|
|
4800
4853
|
register(e, t) {
|
|
4801
|
-
let n =
|
|
4802
|
-
return this.functions.has(e.name) &&
|
|
4854
|
+
let n = zv(e, t);
|
|
4855
|
+
return this.functions.has(e.name) && W.warn(`Function ${e.name} registered twice; the later handler replaces the earlier one`), this.functions.set(e.name, n), this.isConnected && this.config && this.sendRegistration(n), () => this.unregister(e.name);
|
|
4803
4856
|
}
|
|
4804
4857
|
unregister(e) {
|
|
4805
4858
|
return this.functions.delete(e);
|
|
@@ -4839,7 +4892,7 @@ var zv = class {
|
|
|
4839
4892
|
ParameterIndex: t,
|
|
4840
4893
|
TypeName: n ? n.TypeName : this.inferTypeName(e),
|
|
4841
4894
|
ValueJson: JSON.stringify(e ?? null),
|
|
4842
|
-
ValueData:
|
|
4895
|
+
ValueData: Hv
|
|
4843
4896
|
});
|
|
4844
4897
|
}), s = n?.instanceId ? u.fromString(n.instanceId) : u.createZero(), c = wo(_o({
|
|
4845
4898
|
FunctionId: u.fromString(r.id),
|
|
@@ -4852,8 +4905,8 @@ var zv = class {
|
|
|
4852
4905
|
}), this.config.sessionId, { targetIds: [r.clientSessionId] });
|
|
4853
4906
|
return new Promise((t, n) => {
|
|
4854
4907
|
let r = setTimeout(() => {
|
|
4855
|
-
this.pendingCalls.delete(a.toString()), n(/* @__PURE__ */ Error(`Function call '${e}' timed out after ${
|
|
4856
|
-
},
|
|
4908
|
+
this.pendingCalls.delete(a.toString()), n(/* @__PURE__ */ Error(`Function call '${e}' timed out after ${Uv}ms`));
|
|
4909
|
+
}, Uv);
|
|
4857
4910
|
this.pendingCalls.set(a.toString(), {
|
|
4858
4911
|
resolve: t,
|
|
4859
4912
|
reject: n,
|
|
@@ -4917,19 +4970,19 @@ var zv = class {
|
|
|
4917
4970
|
for (let [t, n] of this.remoteFunctions.entries()) e.has(n.id) || this.remoteFunctions.delete(t);
|
|
4918
4971
|
}
|
|
4919
4972
|
handleProtocolMessage(t, n) {
|
|
4920
|
-
if (n ===
|
|
4973
|
+
if (n === x.ACTION_FUNCTION_CALL) {
|
|
4921
4974
|
let n = e(t);
|
|
4922
4975
|
return this.handleFunctionCall(t, n.senderId).catch((e) => {
|
|
4923
|
-
|
|
4976
|
+
W.error("Failed to handle function call:", e);
|
|
4924
4977
|
}), !0;
|
|
4925
4978
|
}
|
|
4926
|
-
if (n ===
|
|
4927
|
-
if (n ===
|
|
4928
|
-
if (n ===
|
|
4979
|
+
if (n === x.ACTION_FUNCTION_RESULT) return this.handleFunctionResult(t), !0;
|
|
4980
|
+
if (n === x.ACTION_FUNCTION_ERROR) return this.handleFunctionError(t), !0;
|
|
4981
|
+
if (n === x.ACTION_FUNCTION_REGISTER) {
|
|
4929
4982
|
let n = e(t);
|
|
4930
4983
|
return n.senderId !== this.config?.sessionId && this.registerRemoteFunction(Fs(t), n.senderId), !0;
|
|
4931
4984
|
}
|
|
4932
|
-
if (n ===
|
|
4985
|
+
if (n === x.ACTION_FUNCTION_REGISTER_BATCH) {
|
|
4933
4986
|
let n = e(t);
|
|
4934
4987
|
if (n.senderId !== this.config?.sessionId) {
|
|
4935
4988
|
let e = cc(t);
|
|
@@ -4942,7 +4995,7 @@ var zv = class {
|
|
|
4942
4995
|
handleFunctionResult(e) {
|
|
4943
4996
|
let t = Tc(e), n = t.CallId.toString(), r = this.pendingCalls.get(n);
|
|
4944
4997
|
if (!r) {
|
|
4945
|
-
|
|
4998
|
+
W.warn(`Received result for unknown call: ${n}`);
|
|
4946
4999
|
return;
|
|
4947
5000
|
}
|
|
4948
5001
|
if (this.pendingCalls.delete(n), clearTimeout(r.timeout), t.ResultData && t.ResultData.length > 0 && !t.ResultJson) {
|
|
@@ -4953,7 +5006,7 @@ var zv = class {
|
|
|
4953
5006
|
try {
|
|
4954
5007
|
i = t.ResultJson ? JSON.parse(t.ResultJson) : void 0;
|
|
4955
5008
|
} catch (e) {
|
|
4956
|
-
r.reject(new
|
|
5009
|
+
r.reject(new Vv(`Malformed result JSON for ${r.functionName}: ${e instanceof Error ? e.message : String(e)}`, "MalformedResult", ""));
|
|
4957
5010
|
return;
|
|
4958
5011
|
}
|
|
4959
5012
|
r.resolve(i);
|
|
@@ -4961,11 +5014,11 @@ var zv = class {
|
|
|
4961
5014
|
handleFunctionError(e) {
|
|
4962
5015
|
let t = ps(e), n = t.CallId.toString(), r = this.pendingCalls.get(n);
|
|
4963
5016
|
if (!r) {
|
|
4964
|
-
|
|
5017
|
+
W.warn(`Received error for unknown call: ${n}`);
|
|
4965
5018
|
return;
|
|
4966
5019
|
}
|
|
4967
5020
|
this.pendingCalls.delete(n), clearTimeout(r.timeout);
|
|
4968
|
-
let i = new
|
|
5021
|
+
let i = new Vv(t.ErrorMessage, t.ErrorTypeName, t.StackTrace, t.ErrorCode), a = {
|
|
4969
5022
|
functionName: r.functionName,
|
|
4970
5023
|
args: r.args
|
|
4971
5024
|
};
|
|
@@ -5001,12 +5054,12 @@ var zv = class {
|
|
|
5001
5054
|
async handleFunctionCall(e, t) {
|
|
5002
5055
|
let n = await To(e);
|
|
5003
5056
|
if (!this.config) {
|
|
5004
|
-
|
|
5057
|
+
W.warn(`Dropping call to '${n.FunctionName}' CallId=${n.CallId.toString()}: the function registry is detached, so the session has not finished joining`);
|
|
5005
5058
|
return;
|
|
5006
5059
|
}
|
|
5007
5060
|
let r = this.functions.get(n.FunctionName);
|
|
5008
5061
|
if (!r) {
|
|
5009
|
-
|
|
5062
|
+
W.warn(`Received call for unknown function: ${n.FunctionName}`), this.sendError(n.CallId, n.InstanceId, t, /* @__PURE__ */ Error(`Unknown function: ${n.FunctionName}`));
|
|
5010
5063
|
return;
|
|
5011
5064
|
}
|
|
5012
5065
|
this.sendAck(n.CallId, n.InstanceId, t), this.executeFunction(r, n, t);
|
|
@@ -5021,14 +5074,14 @@ var zv = class {
|
|
|
5021
5074
|
continue;
|
|
5022
5075
|
}
|
|
5023
5076
|
let o = a?.ValueJson;
|
|
5024
|
-
o === void 0 || o === "" ? i.hasDefaultValue ? r.push(
|
|
5077
|
+
o === void 0 || o === "" ? i.hasDefaultValue ? r.push(Lv(i.defaultValueJson, i.descriptor)) : (W.warn(`Function ${t.FunctionName} was called without required parameter ${i.name}`), r.push(void 0)) : r.push(Lv(o, i.descriptor));
|
|
5025
5078
|
}
|
|
5026
|
-
let i = await e.handler(...r), a = i, o =
|
|
5027
|
-
|
|
5028
|
-
let s =
|
|
5079
|
+
let i = await e.handler(...r), a = i, o = Hv;
|
|
5080
|
+
Wv(i) && (a = i.value, o = new Uint8Array(i.data)), a === void 0 && !e.returnType.nullable && W.warn(`Function ${t.FunctionName} returned undefined for non-nullable ${Iv(e.returnType)}; sending null`);
|
|
5081
|
+
let s = Rv(a, e.returnType);
|
|
5029
5082
|
this.sendResult(t.CallId, t.InstanceId, n, e, s, o);
|
|
5030
5083
|
} catch (e) {
|
|
5031
|
-
|
|
5084
|
+
W.error(`Function ${t.FunctionName} execution failed:`, e), this.sendError(t.CallId, t.InstanceId, n, e instanceof Error ? e : Error(String(e)));
|
|
5032
5085
|
}
|
|
5033
5086
|
}
|
|
5034
5087
|
sendAck(e, t, n) {
|
|
@@ -5044,7 +5097,7 @@ var zv = class {
|
|
|
5044
5097
|
let o = wc(_c({
|
|
5045
5098
|
CallId: e,
|
|
5046
5099
|
InstanceId: t,
|
|
5047
|
-
ResultTypeName:
|
|
5100
|
+
ResultTypeName: Iv(r.returnType),
|
|
5048
5101
|
ResultJson: i,
|
|
5049
5102
|
ResultData: a
|
|
5050
5103
|
}), this.config.sessionId, { targetIds: [n] });
|
|
@@ -5061,7 +5114,7 @@ var zv = class {
|
|
|
5061
5114
|
}), this.config.sessionId, { targetIds: [n] });
|
|
5062
5115
|
this.config.sendProtocolMessage(i);
|
|
5063
5116
|
}
|
|
5064
|
-
},
|
|
5117
|
+
}, Kv = S("ReactiveRegistry"), qv = "Ikon.Reactive.Subscribe", Jv = "Ikon.Reactive.Unsubscribe", Yv = {
|
|
5065
5118
|
name: "Ikon.Reactive.Update",
|
|
5066
5119
|
description: "Receives reactive value updates pushed from the server when a subscribed reactive changes",
|
|
5067
5120
|
returnType: { kind: "string" },
|
|
@@ -5079,7 +5132,7 @@ var zv = class {
|
|
|
5079
5132
|
type: { kind: "string" }
|
|
5080
5133
|
}
|
|
5081
5134
|
]
|
|
5082
|
-
},
|
|
5135
|
+
}, Xv = class {
|
|
5083
5136
|
subscribersByKey = /* @__PURE__ */ new Map();
|
|
5084
5137
|
functionRegistry;
|
|
5085
5138
|
updateHandlerUnregister = null;
|
|
@@ -5087,9 +5140,9 @@ var zv = class {
|
|
|
5087
5140
|
this.functionRegistry = e, this.registerUpdateHandler();
|
|
5088
5141
|
}
|
|
5089
5142
|
async subscribe(e, t, n) {
|
|
5090
|
-
let r = n?.mount ?? "", i =
|
|
5143
|
+
let r = n?.mount ?? "", i = Zv(e, r), a = t, o = this.subscribersByKey.get(i), s = !o;
|
|
5091
5144
|
if (o || (o = /* @__PURE__ */ new Set(), this.subscribersByKey.set(i, o)), o.add(a), s) try {
|
|
5092
|
-
t(
|
|
5145
|
+
t(Qv(await this.functionRegistry.call(qv, [e, r])));
|
|
5093
5146
|
} catch (e) {
|
|
5094
5147
|
throw o.delete(a), o.size === 0 && this.subscribersByKey.delete(i), e;
|
|
5095
5148
|
}
|
|
@@ -5101,46 +5154,46 @@ var zv = class {
|
|
|
5101
5154
|
this.subscribersByKey.clear(), this.updateHandlerUnregister &&= (this.updateHandlerUnregister(), null);
|
|
5102
5155
|
}
|
|
5103
5156
|
unsubscribeOne(e, t, n) {
|
|
5104
|
-
let r =
|
|
5105
|
-
i && (i.delete(n), !(i.size > 0) && (this.subscribersByKey.delete(r), this.functionRegistry.call(
|
|
5106
|
-
|
|
5157
|
+
let r = Zv(e, t), i = this.subscribersByKey.get(r);
|
|
5158
|
+
i && (i.delete(n), !(i.size > 0) && (this.subscribersByKey.delete(r), this.functionRegistry.call(Jv, [e, t]).catch((n) => {
|
|
5159
|
+
Kv.warn(`Failed to unsubscribe from '${e}' (mount='${t}'):`, n);
|
|
5107
5160
|
})));
|
|
5108
5161
|
}
|
|
5109
5162
|
registerUpdateHandler() {
|
|
5110
5163
|
let e = (...e) => {
|
|
5111
|
-
let t = e[0], n = e[1] ?? "", r = e[2], i =
|
|
5164
|
+
let t = e[0], n = e[1] ?? "", r = e[2], i = Zv(t, n), a = this.subscribersByKey.get(i);
|
|
5112
5165
|
if (!a || a.size === 0) return "";
|
|
5113
|
-
let o =
|
|
5166
|
+
let o = Qv(r);
|
|
5114
5167
|
for (let e of a) try {
|
|
5115
5168
|
e(o);
|
|
5116
5169
|
} catch (e) {
|
|
5117
|
-
|
|
5170
|
+
Kv.warn(`Reactive update callback for '${t}' (mount='${n}') threw:`, e);
|
|
5118
5171
|
}
|
|
5119
5172
|
return "";
|
|
5120
5173
|
};
|
|
5121
|
-
this.updateHandlerUnregister = this.functionRegistry.register(
|
|
5174
|
+
this.updateHandlerUnregister = this.functionRegistry.register(Yv, e);
|
|
5122
5175
|
}
|
|
5123
5176
|
};
|
|
5124
|
-
function
|
|
5177
|
+
function Zv(e, t) {
|
|
5125
5178
|
return t.length === 0 ? e : `${e}\0${t}`;
|
|
5126
5179
|
}
|
|
5127
|
-
function
|
|
5180
|
+
function Qv(e) {
|
|
5128
5181
|
if (e == null || e === "") return null;
|
|
5129
5182
|
try {
|
|
5130
5183
|
return JSON.parse(e);
|
|
5131
5184
|
} catch (t) {
|
|
5132
|
-
return
|
|
5185
|
+
return Kv.warn("Failed to parse reactive value JSON, returning raw string:", t), e;
|
|
5133
5186
|
}
|
|
5134
5187
|
}
|
|
5135
5188
|
//#endregion
|
|
5136
5189
|
//#region src/login/login-error-interceptor.ts
|
|
5137
|
-
var
|
|
5190
|
+
var $v = "login_required", ey = (e, t) => e.code === $v ? (Zp({
|
|
5138
5191
|
functionName: t.functionName,
|
|
5139
5192
|
args: t.args
|
|
5140
5193
|
}), Jp(e.message), null) : null;
|
|
5141
5194
|
//#endregion
|
|
5142
5195
|
//#region src/media/device-detection.ts
|
|
5143
|
-
function
|
|
5196
|
+
function ty() {
|
|
5144
5197
|
if (typeof navigator > "u") return !1;
|
|
5145
5198
|
let e = navigator.userAgentData;
|
|
5146
5199
|
if (typeof e?.mobile == "boolean") return e.mobile;
|
|
@@ -5149,7 +5202,7 @@ function Yv() {
|
|
|
5149
5202
|
}
|
|
5150
5203
|
//#endregion
|
|
5151
5204
|
//#region src/functions/media-capture-functions.ts
|
|
5152
|
-
function
|
|
5205
|
+
function ny(e) {
|
|
5153
5206
|
let t = e?.facingMode;
|
|
5154
5207
|
if (typeof t == "string") return t === "user" || t === "environment" ? t : void 0;
|
|
5155
5208
|
if (Array.isArray(t)) return t.find((e) => typeof e == "string" && (e === "user" || e === "environment")) ?? void 0;
|
|
@@ -5159,21 +5212,21 @@ function Xv(e) {
|
|
|
5159
5212
|
if (Array.isArray(e)) return e.find((e) => e === "user" || e === "environment") ?? void 0;
|
|
5160
5213
|
}
|
|
5161
5214
|
}
|
|
5162
|
-
function
|
|
5215
|
+
function ry(e) {
|
|
5163
5216
|
if (!(typeof e != "string" || !e.trim())) try {
|
|
5164
5217
|
return JSON.parse(e);
|
|
5165
5218
|
} catch (e) {
|
|
5166
5219
|
throw Error(`Malformed capture options JSON: ${e instanceof Error ? e.message : String(e)}`, { cause: e });
|
|
5167
5220
|
}
|
|
5168
5221
|
}
|
|
5169
|
-
var
|
|
5222
|
+
var iy = {
|
|
5170
5223
|
StartVideoCapture: "ikon.client.startVideoCapture",
|
|
5171
5224
|
StartAudioCapture: "ikon.client.startAudioCapture",
|
|
5172
5225
|
StopCapture: "ikon.client.stopCapture",
|
|
5173
5226
|
CaptureImage: "ikon.client.captureImage",
|
|
5174
5227
|
GetMediaDevices: "ikon.client.getMediaDevices"
|
|
5175
|
-
},
|
|
5176
|
-
name:
|
|
5228
|
+
}, ay = {
|
|
5229
|
+
name: iy.StartVideoCapture,
|
|
5177
5230
|
description: "Start camera or screen capture and stream video frames to the server",
|
|
5178
5231
|
returnType: { kind: "string" },
|
|
5179
5232
|
parameters: [{
|
|
@@ -5191,8 +5244,8 @@ var Qv = {
|
|
|
5191
5244
|
},
|
|
5192
5245
|
description: "JSON encoded capture options"
|
|
5193
5246
|
}]
|
|
5194
|
-
},
|
|
5195
|
-
name:
|
|
5247
|
+
}, oy = {
|
|
5248
|
+
name: iy.StartAudioCapture,
|
|
5196
5249
|
description: "Start microphone capture and stream audio frames to the server",
|
|
5197
5250
|
returnType: { kind: "string" },
|
|
5198
5251
|
parameters: [{
|
|
@@ -5203,8 +5256,8 @@ var Qv = {
|
|
|
5203
5256
|
},
|
|
5204
5257
|
description: "JSON encoded capture options"
|
|
5205
5258
|
}]
|
|
5206
|
-
},
|
|
5207
|
-
name:
|
|
5259
|
+
}, sy = {
|
|
5260
|
+
name: iy.StopCapture,
|
|
5208
5261
|
description: "Stop a previously started capture by streamId",
|
|
5209
5262
|
returnType: { kind: "boolean" },
|
|
5210
5263
|
parameters: [{
|
|
@@ -5212,8 +5265,8 @@ var Qv = {
|
|
|
5212
5265
|
type: { kind: "string" },
|
|
5213
5266
|
description: "Stream ID to stop"
|
|
5214
5267
|
}]
|
|
5215
|
-
},
|
|
5216
|
-
name:
|
|
5268
|
+
}, cy = {
|
|
5269
|
+
name: iy.CaptureImage,
|
|
5217
5270
|
description: "Capture a single image from the camera and return metadata (JSON) plus binary image data",
|
|
5218
5271
|
returnType: { kind: "string" },
|
|
5219
5272
|
parameters: [{
|
|
@@ -5224,24 +5277,24 @@ var Qv = {
|
|
|
5224
5277
|
},
|
|
5225
5278
|
description: "JSON encoded capture options"
|
|
5226
5279
|
}]
|
|
5227
|
-
},
|
|
5228
|
-
name:
|
|
5280
|
+
}, ly = {
|
|
5281
|
+
name: iy.GetMediaDevices,
|
|
5229
5282
|
description: "Get list of available media input devices",
|
|
5230
5283
|
returnType: { kind: "string" },
|
|
5231
5284
|
parameters: []
|
|
5232
5285
|
};
|
|
5233
|
-
function
|
|
5234
|
-
let n = [];
|
|
5235
|
-
return n.push(e.register(
|
|
5286
|
+
function uy(e, t) {
|
|
5287
|
+
let n = [], r = null;
|
|
5288
|
+
return n.push(e.register(ay, async (e, n) => {
|
|
5236
5289
|
if (t.isWebRtcCaptureAvailable) {
|
|
5237
5290
|
let e = t.webRtcSignaling;
|
|
5238
5291
|
if (!e) throw Error("WebRTC signaling is not connected");
|
|
5239
|
-
let r =
|
|
5292
|
+
let r = ry(n);
|
|
5240
5293
|
return await e.startVideoCapture(r?.constraints), "webrtc-video";
|
|
5241
5294
|
}
|
|
5242
5295
|
let r = await t.ensureMediaCapture();
|
|
5243
5296
|
if (!r) throw Error("Media capture is not available in this environment");
|
|
5244
|
-
let i =
|
|
5297
|
+
let i = ry(n);
|
|
5245
5298
|
return ((typeof e == "string" && e.trim().toLowerCase() === "screen" ? "screen" : "camera") == "screen" ? await r.video.startScreen({
|
|
5246
5299
|
userGesture: !1,
|
|
5247
5300
|
options: i,
|
|
@@ -5251,44 +5304,45 @@ function iy(e, t) {
|
|
|
5251
5304
|
options: i,
|
|
5252
5305
|
constraints: i?.constraints
|
|
5253
5306
|
})).streamId;
|
|
5254
|
-
})), n.push(e.register(
|
|
5307
|
+
})), n.push(e.register(oy, async (e) => {
|
|
5255
5308
|
if (t.isWebRtcCaptureAvailable) {
|
|
5256
5309
|
let n = t.webRtcSignaling;
|
|
5257
5310
|
if (!n) throw Error("WebRTC signaling is not connected");
|
|
5258
|
-
let
|
|
5259
|
-
return await n.startAudioCapture(
|
|
5311
|
+
let i = ry(e);
|
|
5312
|
+
return await n.startAudioCapture(i?.constraints), n.startAudioSegment(i?.correlationId), r = { correlationId: i?.correlationId }, "webrtc-audio";
|
|
5260
5313
|
}
|
|
5261
5314
|
let n = await t.ensureMediaCapture();
|
|
5262
5315
|
if (!n) throw Error("Media capture is not available in this environment");
|
|
5263
|
-
let
|
|
5316
|
+
let i = ry(e);
|
|
5264
5317
|
return (await n.audio.startMic({
|
|
5265
5318
|
userGesture: !1,
|
|
5266
|
-
options:
|
|
5267
|
-
constraints:
|
|
5319
|
+
options: i,
|
|
5320
|
+
constraints: i?.constraints,
|
|
5321
|
+
correlationId: i?.correlationId
|
|
5268
5322
|
})).streamId;
|
|
5269
|
-
})), n.push(e.register(
|
|
5323
|
+
})), n.push(e.register(sy, async (e) => {
|
|
5270
5324
|
if (t.isWebRtcCaptureAvailable) {
|
|
5271
5325
|
let e = t.webRtcSignaling;
|
|
5272
|
-
return e && await e.stopCapture(), !0;
|
|
5326
|
+
return e && (r && e.endAudioSegment(r.correlationId), await e.stopCapture()), r = null, !0;
|
|
5273
5327
|
}
|
|
5274
5328
|
let n = await t.ensureMediaCapture();
|
|
5275
5329
|
if (!n || typeof e != "string" || !e.trim()) return !1;
|
|
5276
|
-
let
|
|
5277
|
-
return
|
|
5278
|
-
})), n.push(e.register(
|
|
5330
|
+
let i = await n.video.stop(e), a = await n.audio.stop(e);
|
|
5331
|
+
return i || a;
|
|
5332
|
+
})), n.push(e.register(cy, async (e) => {
|
|
5279
5333
|
let n = await t.ensureMediaCapture();
|
|
5280
5334
|
if (!n) throw Error("Media capture is not available in this environment");
|
|
5281
|
-
let r =
|
|
5282
|
-
if (r.mode === "native" &&
|
|
5335
|
+
let r = ry(e) ?? {};
|
|
5336
|
+
if (r.mode === "native" && ty()) {
|
|
5283
5337
|
let e = await n.image.captureFromNativeCamera({
|
|
5284
|
-
facing:
|
|
5338
|
+
facing: ny(r.constraints),
|
|
5285
5339
|
mime: r.mime,
|
|
5286
5340
|
quality: r.quality,
|
|
5287
5341
|
width: r.width,
|
|
5288
5342
|
height: r.height
|
|
5289
5343
|
});
|
|
5290
5344
|
if (!e) throw Error("Native camera capture was cancelled");
|
|
5291
|
-
return
|
|
5345
|
+
return Bv(JSON.stringify({
|
|
5292
5346
|
mime: e.mime,
|
|
5293
5347
|
width: e.width,
|
|
5294
5348
|
height: e.height
|
|
@@ -5309,12 +5363,12 @@ function iy(e, t) {
|
|
|
5309
5363
|
quality: r.quality,
|
|
5310
5364
|
width: r.width,
|
|
5311
5365
|
height: r.height
|
|
5312
|
-
}),
|
|
5366
|
+
}), Bv(JSON.stringify({
|
|
5313
5367
|
mime: a.mime,
|
|
5314
5368
|
width: a.width,
|
|
5315
5369
|
height: a.height
|
|
5316
5370
|
}), a.data);
|
|
5317
|
-
})), n.push(e.register(
|
|
5371
|
+
})), n.push(e.register(ly, async () => {
|
|
5318
5372
|
if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) return JSON.stringify([]);
|
|
5319
5373
|
let e = (await navigator.mediaDevices.enumerateDevices()).filter((e) => e.kind === "audioinput" || e.kind === "videoinput").map((e) => ({
|
|
5320
5374
|
deviceId: e.deviceId,
|
|
@@ -5329,134 +5383,134 @@ function iy(e, t) {
|
|
|
5329
5383
|
}
|
|
5330
5384
|
//#endregion
|
|
5331
5385
|
//#region src/functions/sound-functions.ts
|
|
5332
|
-
var
|
|
5386
|
+
var G = S("SoundFunctions"), dy = {
|
|
5333
5387
|
PlaySound: "ikon.client.playSound",
|
|
5334
5388
|
StopSound: "ikon.client.stopSound"
|
|
5335
|
-
},
|
|
5389
|
+
}, fy = [
|
|
5336
5390
|
"pointerup",
|
|
5337
5391
|
"touchend",
|
|
5338
5392
|
"mousedown",
|
|
5339
5393
|
"keydown"
|
|
5340
|
-
],
|
|
5341
|
-
function
|
|
5394
|
+
], py = 100, my = 33554432, hy = /* @__PURE__ */ new Map(), K = /* @__PURE__ */ new Map(), gy = /* @__PURE__ */ new Map(), _y = 0, q = /* @__PURE__ */ new Map(), vy = 1, J = null, yy = null, by = 0;
|
|
5395
|
+
function xy() {
|
|
5342
5396
|
return typeof window < "u" && typeof AudioContext < "u";
|
|
5343
5397
|
}
|
|
5344
|
-
function
|
|
5398
|
+
function Sy(e) {
|
|
5345
5399
|
return e.state === "running";
|
|
5346
5400
|
}
|
|
5347
|
-
function
|
|
5348
|
-
if (
|
|
5349
|
-
if (!
|
|
5401
|
+
function Cy() {
|
|
5402
|
+
if (J) return J;
|
|
5403
|
+
if (!xy()) return null;
|
|
5350
5404
|
try {
|
|
5351
5405
|
let e = new AudioContext({ latencyHint: "interactive" });
|
|
5352
5406
|
return e.addEventListener("statechange", () => {
|
|
5353
|
-
|
|
5354
|
-
}),
|
|
5407
|
+
J === e && (Sy(e) ? Ey() : e.state !== "closed" && by > 0 && Ty());
|
|
5408
|
+
}), J = e, e;
|
|
5355
5409
|
} catch (e) {
|
|
5356
|
-
return
|
|
5410
|
+
return G.warn(`Sound effects are unavailable: AudioContext could not be created: ${String(e)}`), null;
|
|
5357
5411
|
}
|
|
5358
5412
|
}
|
|
5359
|
-
function
|
|
5360
|
-
let e =
|
|
5413
|
+
function wy() {
|
|
5414
|
+
let e = Cy();
|
|
5361
5415
|
if (!e) {
|
|
5362
|
-
|
|
5416
|
+
Ey();
|
|
5363
5417
|
return;
|
|
5364
5418
|
}
|
|
5365
|
-
if (
|
|
5366
|
-
|
|
5419
|
+
if (Sy(e)) {
|
|
5420
|
+
Ey();
|
|
5367
5421
|
return;
|
|
5368
5422
|
}
|
|
5369
5423
|
e.resume().catch((e) => {
|
|
5370
|
-
|
|
5424
|
+
G.debug(`Sound AudioContext did not resume on this gesture: ${String(e)}`);
|
|
5371
5425
|
});
|
|
5372
5426
|
}
|
|
5373
|
-
function
|
|
5374
|
-
if (
|
|
5375
|
-
let e = () =>
|
|
5376
|
-
|
|
5377
|
-
for (let t of
|
|
5427
|
+
function Ty() {
|
|
5428
|
+
if (yy || typeof window > "u") return;
|
|
5429
|
+
let e = () => wy();
|
|
5430
|
+
yy = e;
|
|
5431
|
+
for (let t of fy) window.addEventListener(t, e, {
|
|
5378
5432
|
capture: !0,
|
|
5379
5433
|
passive: !0
|
|
5380
5434
|
});
|
|
5381
5435
|
}
|
|
5382
|
-
function
|
|
5383
|
-
if (!(!
|
|
5384
|
-
for (let e of
|
|
5385
|
-
|
|
5436
|
+
function Ey() {
|
|
5437
|
+
if (!(!yy || typeof window > "u")) {
|
|
5438
|
+
for (let e of fy) window.removeEventListener(e, yy, { capture: !0 });
|
|
5439
|
+
yy = null;
|
|
5386
5440
|
}
|
|
5387
5441
|
}
|
|
5388
|
-
async function
|
|
5389
|
-
if (
|
|
5442
|
+
async function Dy(e) {
|
|
5443
|
+
if (Sy(e)) return !0;
|
|
5390
5444
|
let t;
|
|
5391
5445
|
try {
|
|
5392
5446
|
await Promise.race([e.resume(), new Promise((e) => {
|
|
5393
|
-
t = setTimeout(e,
|
|
5447
|
+
t = setTimeout(e, py);
|
|
5394
5448
|
})]);
|
|
5395
5449
|
} catch (e) {
|
|
5396
|
-
|
|
5450
|
+
G.debug(`Sound AudioContext resume refused: ${String(e)}`);
|
|
5397
5451
|
} finally {
|
|
5398
5452
|
clearTimeout(t);
|
|
5399
5453
|
}
|
|
5400
|
-
return
|
|
5454
|
+
return Sy(e);
|
|
5401
5455
|
}
|
|
5402
|
-
function
|
|
5403
|
-
|
|
5456
|
+
function Oy(e, t) {
|
|
5457
|
+
K.delete(e), K.set(e, t);
|
|
5404
5458
|
}
|
|
5405
|
-
function
|
|
5459
|
+
function ky(e, t) {
|
|
5406
5460
|
let n = t.length * t.numberOfChannels * 4;
|
|
5407
|
-
if (n >
|
|
5408
|
-
let r =
|
|
5409
|
-
r && (
|
|
5461
|
+
if (n > my) return;
|
|
5462
|
+
let r = K.get(e);
|
|
5463
|
+
r && (_y -= r.bytes, K.delete(e)), K.set(e, {
|
|
5410
5464
|
buffer: t,
|
|
5411
5465
|
bytes: n
|
|
5412
|
-
}),
|
|
5413
|
-
for (let [e, t] of
|
|
5414
|
-
if (
|
|
5415
|
-
|
|
5466
|
+
}), _y += n;
|
|
5467
|
+
for (let [e, t] of K) {
|
|
5468
|
+
if (_y <= my) break;
|
|
5469
|
+
K.delete(e), _y -= t.bytes;
|
|
5416
5470
|
}
|
|
5417
5471
|
}
|
|
5418
|
-
var
|
|
5419
|
-
async function
|
|
5472
|
+
var Ay = class extends Error {};
|
|
5473
|
+
async function jy(e, t) {
|
|
5420
5474
|
let n;
|
|
5421
5475
|
try {
|
|
5422
5476
|
n = await fetch(t);
|
|
5423
5477
|
} catch (e) {
|
|
5424
|
-
throw new
|
|
5478
|
+
throw new Ay(String(e));
|
|
5425
5479
|
}
|
|
5426
5480
|
if (!n.ok) throw Error(`HTTP ${n.status}`);
|
|
5427
5481
|
return e.decodeAudioData(await n.arrayBuffer());
|
|
5428
5482
|
}
|
|
5429
|
-
function
|
|
5483
|
+
function My(e, t, n) {
|
|
5430
5484
|
let r = new Audio(e);
|
|
5431
5485
|
r.volume = t, r.loop = n;
|
|
5432
|
-
let i = `sound-${
|
|
5433
|
-
|
|
5486
|
+
let i = `sound-${vy++}`, a = () => {
|
|
5487
|
+
q.delete(i), r.removeEventListener("ended", a), r.removeEventListener("error", a);
|
|
5434
5488
|
};
|
|
5435
|
-
return r.addEventListener("ended", a), r.addEventListener("error", a),
|
|
5489
|
+
return r.addEventListener("ended", a), r.addEventListener("error", a), q.set(i, () => {
|
|
5436
5490
|
r.pause(), a();
|
|
5437
|
-
}), r.play().then(() => i, (t) => (a(),
|
|
5491
|
+
}), r.play().then(() => i, (t) => (a(), G.warn(`Sound ${e} not played: the browser refused the media element: ${String(t)}`), null));
|
|
5438
5492
|
}
|
|
5439
|
-
function
|
|
5440
|
-
if (n === null) return
|
|
5441
|
-
let r =
|
|
5442
|
-
if (r) return
|
|
5443
|
-
let i =
|
|
5493
|
+
function Ny(e, t, n) {
|
|
5494
|
+
if (n === null) return jy(e, t);
|
|
5495
|
+
let r = K.get(n);
|
|
5496
|
+
if (r) return Oy(n, r), Promise.resolve(r.buffer);
|
|
5497
|
+
let i = gy.get(n);
|
|
5444
5498
|
if (i) return i;
|
|
5445
|
-
let a =
|
|
5446
|
-
return
|
|
5499
|
+
let a = jy(e, t).then((e) => (ky(n, e), e)).finally(() => gy.delete(n));
|
|
5500
|
+
return gy.set(n, a), a;
|
|
5447
5501
|
}
|
|
5448
|
-
function
|
|
5502
|
+
function Py(e, t, n, r) {
|
|
5449
5503
|
let i = e.createBufferSource();
|
|
5450
5504
|
i.buffer = t, i.loop = r;
|
|
5451
5505
|
let a = e.createGain();
|
|
5452
5506
|
a.gain.value = n, i.connect(a), a.connect(e.destination);
|
|
5453
|
-
let o = `sound-${
|
|
5507
|
+
let o = `sound-${vy++}`;
|
|
5454
5508
|
return i.onended = () => {
|
|
5455
|
-
|
|
5456
|
-
},
|
|
5509
|
+
q.delete(o), i.disconnect(), a.disconnect();
|
|
5510
|
+
}, q.set(o, () => i.stop()), i.start(), o;
|
|
5457
5511
|
}
|
|
5458
|
-
var
|
|
5459
|
-
name:
|
|
5512
|
+
var Fy = {
|
|
5513
|
+
name: dy.PlaySound,
|
|
5460
5514
|
description: "Play a sound effect",
|
|
5461
5515
|
returnType: {
|
|
5462
5516
|
kind: "string",
|
|
@@ -5494,31 +5548,31 @@ var Ay = {
|
|
|
5494
5548
|
}
|
|
5495
5549
|
]
|
|
5496
5550
|
};
|
|
5497
|
-
async function
|
|
5551
|
+
async function Iy(e, t, n, r) {
|
|
5498
5552
|
if (typeof e != "string" || !e.trim()) return null;
|
|
5499
5553
|
let i = e, a = e.startsWith("data:") ? null : e;
|
|
5500
|
-
if (typeof t == "string" && t && (
|
|
5501
|
-
let t =
|
|
5502
|
-
if (!t) return
|
|
5554
|
+
if (typeof t == "string" && t && (hy.set(t, e), a = `sound:${t}`), e.startsWith("sound:")) {
|
|
5555
|
+
let t = hy.get(e.slice(6));
|
|
5556
|
+
if (!t) return G.debug(`Sound ${e} not played: its bytes were never received`), null;
|
|
5503
5557
|
i = t, a = e;
|
|
5504
5558
|
}
|
|
5505
|
-
let o =
|
|
5559
|
+
let o = Cy();
|
|
5506
5560
|
if (!o) return null;
|
|
5507
|
-
if (!await
|
|
5561
|
+
if (!await Dy(o)) return G.debug("Sound not played: audio starts after the first user interaction"), null;
|
|
5508
5562
|
let s = typeof n == "number" ? Math.max(0, Math.min(1, n)) : 1, c;
|
|
5509
5563
|
try {
|
|
5510
|
-
c = await
|
|
5564
|
+
c = await Ny(o, i, a);
|
|
5511
5565
|
} catch (e) {
|
|
5512
|
-
return e instanceof
|
|
5566
|
+
return e instanceof Ay ? (G.debug(`Sound ${i} is not readable by fetch, playing it through a media element: ${e.message}`), My(i, s, r === !0)) : (G.warn(`Sound ${a ?? "data URL"} not played: it could not be loaded or decoded: ${String(e)}`), null);
|
|
5513
5567
|
}
|
|
5514
5568
|
try {
|
|
5515
|
-
return
|
|
5569
|
+
return Py(o, c, s, r === !0);
|
|
5516
5570
|
} catch (e) {
|
|
5517
|
-
return
|
|
5571
|
+
return G.warn(`Sound ${a ?? "data URL"} not played: ${String(e)}`), null;
|
|
5518
5572
|
}
|
|
5519
5573
|
}
|
|
5520
|
-
var
|
|
5521
|
-
name:
|
|
5574
|
+
var Ly = {
|
|
5575
|
+
name: dy.StopSound,
|
|
5522
5576
|
description: "Stop a playing sound by ID",
|
|
5523
5577
|
returnType: { kind: "boolean" },
|
|
5524
5578
|
parameters: [{
|
|
@@ -5527,40 +5581,40 @@ var My = {
|
|
|
5527
5581
|
description: "Playback ID from playSound"
|
|
5528
5582
|
}]
|
|
5529
5583
|
};
|
|
5530
|
-
function
|
|
5584
|
+
function Ry(e) {
|
|
5531
5585
|
if (typeof e != "string") return !1;
|
|
5532
|
-
let t =
|
|
5586
|
+
let t = q.get(e);
|
|
5533
5587
|
if (!t) return !1;
|
|
5534
|
-
|
|
5588
|
+
q.delete(e);
|
|
5535
5589
|
try {
|
|
5536
5590
|
return t(), !0;
|
|
5537
5591
|
} catch {
|
|
5538
5592
|
return !1;
|
|
5539
5593
|
}
|
|
5540
5594
|
}
|
|
5541
|
-
function
|
|
5542
|
-
for (let e of
|
|
5595
|
+
function zy() {
|
|
5596
|
+
for (let e of q.values()) try {
|
|
5543
5597
|
e();
|
|
5544
5598
|
} catch {}
|
|
5545
|
-
|
|
5546
|
-
let e =
|
|
5547
|
-
|
|
5599
|
+
q.clear(), hy.clear(), K.clear(), gy.clear(), _y = 0, Ey();
|
|
5600
|
+
let e = J;
|
|
5601
|
+
J = null, e && e.state !== "closed" && e.close().catch(() => {});
|
|
5548
5602
|
}
|
|
5549
|
-
var
|
|
5550
|
-
definition:
|
|
5551
|
-
handler:
|
|
5603
|
+
var By = [{
|
|
5604
|
+
definition: Fy,
|
|
5605
|
+
handler: Iy
|
|
5552
5606
|
}, {
|
|
5553
|
-
definition:
|
|
5554
|
-
handler:
|
|
5607
|
+
definition: Ly,
|
|
5608
|
+
handler: Ry
|
|
5555
5609
|
}];
|
|
5556
|
-
function
|
|
5557
|
-
|
|
5558
|
-
let t =
|
|
5610
|
+
function Vy(e) {
|
|
5611
|
+
xy() && (by++, Ty());
|
|
5612
|
+
let t = By.map(({ definition: t, handler: n }) => e.register(t, n)), n = !1;
|
|
5559
5613
|
return () => {
|
|
5560
|
-
n || (n = !0, t.forEach((e) => e()),
|
|
5614
|
+
n || (n = !0, t.forEach((e) => e()), by > 0 && --by === 0 && zy());
|
|
5561
5615
|
};
|
|
5562
5616
|
}
|
|
5563
|
-
var
|
|
5617
|
+
var Hy = {
|
|
5564
5618
|
name: { DownloadFile: "ikon.client.downloadFile" }.DownloadFile,
|
|
5565
5619
|
description: "Save a file to the user’s downloads",
|
|
5566
5620
|
returnType: { kind: "boolean" },
|
|
@@ -5577,31 +5631,31 @@ var Ly = {
|
|
|
5577
5631
|
description: "Name to save the file under"
|
|
5578
5632
|
}]
|
|
5579
5633
|
};
|
|
5580
|
-
async function
|
|
5634
|
+
async function Uy(e, t) {
|
|
5581
5635
|
if (typeof document > "u" || typeof e != "string" || !e.trim()) return !1;
|
|
5582
5636
|
let n = typeof t == "string" && t.trim() ? t.trim() : "", r = e.trim();
|
|
5583
5637
|
try {
|
|
5584
5638
|
if (r.startsWith("data:")) {
|
|
5585
|
-
let e =
|
|
5586
|
-
return e ?
|
|
5639
|
+
let e = Wy(r);
|
|
5640
|
+
return e ? Ky(URL.createObjectURL(e), n, !0) : Ky(r, n, !1);
|
|
5587
5641
|
}
|
|
5588
|
-
if (!
|
|
5589
|
-
let e = await
|
|
5590
|
-
if (e) return
|
|
5642
|
+
if (!qy(r)) return Ky(r, n, !1);
|
|
5643
|
+
let e = await Gy(r);
|
|
5644
|
+
if (e) return Ky(URL.createObjectURL(e), n, !0);
|
|
5591
5645
|
let t = window.open(r, "_blank");
|
|
5592
5646
|
return t ? (t.opener = null, !0) : !1;
|
|
5593
5647
|
} catch {
|
|
5594
5648
|
return !1;
|
|
5595
5649
|
}
|
|
5596
5650
|
}
|
|
5597
|
-
function
|
|
5651
|
+
function Wy(e) {
|
|
5598
5652
|
let t = e.indexOf(","), n = e.slice(5, t);
|
|
5599
5653
|
if (t <= 0 || !n.endsWith(";base64")) return null;
|
|
5600
5654
|
let r = n.slice(0, -7) || "application/octet-stream", i = atob(e.slice(t + 1)), a = new Uint8Array(i.length);
|
|
5601
5655
|
for (let e = 0; e < i.length; e++) a[e] = i.charCodeAt(e);
|
|
5602
5656
|
return new Blob([a], { type: r });
|
|
5603
5657
|
}
|
|
5604
|
-
async function
|
|
5658
|
+
async function Gy(e) {
|
|
5605
5659
|
try {
|
|
5606
5660
|
let t = await fetch(e);
|
|
5607
5661
|
return t.ok ? await t.blob() : null;
|
|
@@ -5609,11 +5663,11 @@ async function By(e) {
|
|
|
5609
5663
|
return null;
|
|
5610
5664
|
}
|
|
5611
5665
|
}
|
|
5612
|
-
function
|
|
5666
|
+
function Ky(e, t, n) {
|
|
5613
5667
|
let r = document.createElement("a");
|
|
5614
5668
|
return r.href = e, r.download = t, r.style.display = "none", document.body.appendChild(r), r.click(), document.body.removeChild(r), n && setTimeout(() => URL.revokeObjectURL(e), 6e4), !0;
|
|
5615
5669
|
}
|
|
5616
|
-
function
|
|
5670
|
+
function qy(e) {
|
|
5617
5671
|
if (e.startsWith("blob:") || e.startsWith("data:")) return !1;
|
|
5618
5672
|
try {
|
|
5619
5673
|
return new URL(e, window.location.href).origin !== window.location.origin;
|
|
@@ -5621,30 +5675,30 @@ function Hy(e) {
|
|
|
5621
5675
|
return !1;
|
|
5622
5676
|
}
|
|
5623
5677
|
}
|
|
5624
|
-
var
|
|
5625
|
-
definition:
|
|
5626
|
-
handler:
|
|
5678
|
+
var Jy = [{
|
|
5679
|
+
definition: Hy,
|
|
5680
|
+
handler: Uy
|
|
5627
5681
|
}];
|
|
5628
|
-
function
|
|
5629
|
-
let t =
|
|
5682
|
+
function Yy(e) {
|
|
5683
|
+
let t = Jy.map(({ definition: t, handler: n }) => e.register(t, n));
|
|
5630
5684
|
return () => t.forEach((e) => e());
|
|
5631
5685
|
}
|
|
5632
5686
|
//#endregion
|
|
5633
5687
|
//#region src/upload/file-upload.ts
|
|
5634
|
-
var
|
|
5688
|
+
var Y = S("FileUpload"), Xy = 1048576, Zy = 8, Qy = 3e4, $y = 6e4, eb = 6e4, tb = 45e3, X = class extends Error {
|
|
5635
5689
|
retriable;
|
|
5636
5690
|
constructor(e, t) {
|
|
5637
5691
|
super(e), this.name = "UploadFailedError", this.retriable = t;
|
|
5638
5692
|
}
|
|
5639
|
-
},
|
|
5693
|
+
}, nb = class extends Error {
|
|
5640
5694
|
constructor() {
|
|
5641
5695
|
super("Connection lost during upload"), this.name = "UploadDisconnectedError";
|
|
5642
5696
|
}
|
|
5643
5697
|
};
|
|
5644
|
-
function
|
|
5645
|
-
return e.Success === void 0 || e.Success === null || e.Success ? null : new
|
|
5698
|
+
function rb(e) {
|
|
5699
|
+
return e.Success === void 0 || e.Success === null || e.Success ? null : new X(e.Error || "The server rejected the upload", !1);
|
|
5646
5700
|
}
|
|
5647
|
-
async function
|
|
5701
|
+
async function ib(e) {
|
|
5648
5702
|
let { sha256: t } = await import("./sha2-DPTGfEM2.js"), n = t.create(), r = e.stream().getReader(), i = 0;
|
|
5649
5703
|
for (;;) {
|
|
5650
5704
|
let { done: e, value: t } = await r.read();
|
|
@@ -5653,16 +5707,16 @@ async function $y(e) {
|
|
|
5653
5707
|
}
|
|
5654
5708
|
return Array.from(n.digest()).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
5655
5709
|
}
|
|
5656
|
-
async function
|
|
5710
|
+
async function ab(e, t) {
|
|
5657
5711
|
let { file: n, uploadId: r, uploadActionId: i } = t, a = e.sessionId;
|
|
5658
|
-
if (!a) throw new
|
|
5712
|
+
if (!a) throw new X("Session not ready", !0);
|
|
5659
5713
|
let o = new AbortController(), s = { verdict: null }, c = e.subscribeToProtocolMessages((e) => {
|
|
5660
5714
|
y(e) === 1048650 && mn(e).then((e) => {
|
|
5661
|
-
e.UploadId === r && (s.verdict =
|
|
5715
|
+
e.UploadId === r && (s.verdict = rb(e), o.abort());
|
|
5662
5716
|
}).catch((e) => {
|
|
5663
|
-
|
|
5717
|
+
Y.warn(`Ignoring an unreadable file upload message for ${r}:`, e);
|
|
5664
5718
|
});
|
|
5665
|
-
}, { opcodeGroupsMask:
|
|
5719
|
+
}, { opcodeGroupsMask: x.GROUP_ACTIONS });
|
|
5666
5720
|
try {
|
|
5667
5721
|
if (await l(e, a), s.verdict) throw s.verdict;
|
|
5668
5722
|
} finally {
|
|
@@ -5677,21 +5731,21 @@ async function eb(e, t) {
|
|
|
5677
5731
|
ByteCount: BigInt(n.size)
|
|
5678
5732
|
}), t);
|
|
5679
5733
|
e.sendProtocolMessage(c);
|
|
5680
|
-
let l = await
|
|
5734
|
+
let l = await lb(e, r, o.signal);
|
|
5681
5735
|
if (o.signal.aborted) return;
|
|
5682
|
-
if (!l.Accepted) throw new
|
|
5736
|
+
if (!l.Accepted) throw new X("The app rejected the upload", !1);
|
|
5683
5737
|
if (o.signal.aborted) return;
|
|
5684
|
-
let u = await
|
|
5738
|
+
let u = await ib(n);
|
|
5685
5739
|
if (o.signal.aborted) return;
|
|
5686
5740
|
let d = xr(_r({
|
|
5687
5741
|
UploadId: r,
|
|
5688
5742
|
Hash: u
|
|
5689
5743
|
}), t);
|
|
5690
5744
|
e.sendProtocolMessage(d);
|
|
5691
|
-
let f = await
|
|
5745
|
+
let f = await ub(e, r, o.signal);
|
|
5692
5746
|
if (o.signal.aborted) return;
|
|
5693
|
-
if (!f.Accepted) throw new
|
|
5694
|
-
let p = Math.ceil(n.size /
|
|
5747
|
+
if (!f.Accepted) throw new X("The app rejected the upload", !1);
|
|
5748
|
+
let p = Math.ceil(n.size / Xy), m = new db(e, r, o.signal), h = !1, g = e.subscribeToState((e) => {
|
|
5695
5749
|
e !== "connected" && (h = !0, m.disconnected());
|
|
5696
5750
|
});
|
|
5697
5751
|
try {
|
|
@@ -5699,25 +5753,25 @@ async function eb(e, t) {
|
|
|
5699
5753
|
for (;;) {
|
|
5700
5754
|
if (o.signal.aborted) return;
|
|
5701
5755
|
if (h) {
|
|
5702
|
-
h = !1, i = await
|
|
5756
|
+
h = !1, i = await ob(e, r, o.signal, m), t = e.sessionId ?? t;
|
|
5703
5757
|
continue;
|
|
5704
5758
|
}
|
|
5705
5759
|
if (i > p) try {
|
|
5706
5760
|
await m.waitFor(p);
|
|
5707
5761
|
break;
|
|
5708
5762
|
} catch (e) {
|
|
5709
|
-
if (!(e instanceof
|
|
5763
|
+
if (!(e instanceof nb)) throw e;
|
|
5710
5764
|
continue;
|
|
5711
5765
|
}
|
|
5712
|
-
let a = (i - 1) *
|
|
5766
|
+
let a = (i - 1) * Xy, s = Math.min(i * Xy, n.size), c = new Uint8Array(await n.slice(a, s).arrayBuffer()), l = Cn(yn({
|
|
5713
5767
|
UploadId: r,
|
|
5714
5768
|
Data: c,
|
|
5715
5769
|
SequenceId: i
|
|
5716
5770
|
}), t);
|
|
5717
|
-
if (e.sendProtocolMessage(l), i >
|
|
5718
|
-
await m.waitFor(i -
|
|
5771
|
+
if (e.sendProtocolMessage(l), i > Zy) try {
|
|
5772
|
+
await m.waitFor(i - Zy);
|
|
5719
5773
|
} catch (e) {
|
|
5720
|
-
if (!(e instanceof
|
|
5774
|
+
if (!(e instanceof nb)) throw e;
|
|
5721
5775
|
continue;
|
|
5722
5776
|
}
|
|
5723
5777
|
i++;
|
|
@@ -5729,28 +5783,28 @@ async function eb(e, t) {
|
|
|
5729
5783
|
if (o.signal.aborted) return;
|
|
5730
5784
|
let ee = An(En({ UploadId: r }), t);
|
|
5731
5785
|
e.sendProtocolMessage(ee);
|
|
5732
|
-
let te = await
|
|
5733
|
-
te && (s.verdict =
|
|
5786
|
+
let te = await fb(e, r, o.signal);
|
|
5787
|
+
te && (s.verdict = rb(te));
|
|
5734
5788
|
}
|
|
5735
5789
|
}
|
|
5736
|
-
async function
|
|
5737
|
-
if (await
|
|
5790
|
+
async function ob(e, t, n, r) {
|
|
5791
|
+
if (await sb(e, n), n.aborted) return 2 ** 53 - 1;
|
|
5738
5792
|
let i = e.sessionId;
|
|
5739
|
-
if (!i) throw new
|
|
5793
|
+
if (!i) throw new X("Session not ready after reconnect", !0);
|
|
5740
5794
|
e.sendProtocolMessage(rr($n({ UploadId: t }), i));
|
|
5741
|
-
let a = await
|
|
5742
|
-
if (!a.Resumable) throw new
|
|
5743
|
-
return
|
|
5795
|
+
let a = await cb(e, t, n);
|
|
5796
|
+
if (!a.Resumable) throw new X("Upload expired while disconnected and cannot be resumed", !0);
|
|
5797
|
+
return Y.info(`Resuming upload ${t} from sequence ${a.NextSequenceId}`), r.rewindTo(a.NextSequenceId - 1), a.NextSequenceId;
|
|
5744
5798
|
}
|
|
5745
|
-
function
|
|
5799
|
+
function sb(e, t) {
|
|
5746
5800
|
return new Promise((n, r) => {
|
|
5747
5801
|
if (t.aborted || e.connectionState === "connected") {
|
|
5748
5802
|
n();
|
|
5749
5803
|
return;
|
|
5750
5804
|
}
|
|
5751
5805
|
let i = setTimeout(() => {
|
|
5752
|
-
s(), r(new
|
|
5753
|
-
},
|
|
5806
|
+
s(), r(new X(`Still disconnected after ${tb / 1e3}s`, !0));
|
|
5807
|
+
}, tb), a = () => {
|
|
5754
5808
|
s(), n();
|
|
5755
5809
|
}, o = e.subscribeToState((e) => {
|
|
5756
5810
|
e === "connected" && (s(), n());
|
|
@@ -5761,7 +5815,7 @@ function nb(e, t) {
|
|
|
5761
5815
|
t.addEventListener("abort", a, { once: !0 });
|
|
5762
5816
|
});
|
|
5763
5817
|
}
|
|
5764
|
-
function
|
|
5818
|
+
function cb(e, t, n) {
|
|
5765
5819
|
return new Promise((r, i) => {
|
|
5766
5820
|
if (n.aborted) {
|
|
5767
5821
|
r({
|
|
@@ -5771,8 +5825,8 @@ function rb(e, t, n) {
|
|
|
5771
5825
|
return;
|
|
5772
5826
|
}
|
|
5773
5827
|
let a = setTimeout(() => {
|
|
5774
|
-
s(), i(new
|
|
5775
|
-
},
|
|
5828
|
+
s(), i(new X("Timed out waiting for the upload to resume", !0));
|
|
5829
|
+
}, Qy), o = () => {
|
|
5776
5830
|
clearTimeout(a), s(), r({
|
|
5777
5831
|
Resumable: !1,
|
|
5778
5832
|
NextSequenceId: 0
|
|
@@ -5786,20 +5840,20 @@ function rb(e, t, n) {
|
|
|
5786
5840
|
NextSequenceId: e.NextSequenceId
|
|
5787
5841
|
}));
|
|
5788
5842
|
}).catch((e) => {
|
|
5789
|
-
|
|
5843
|
+
Y.warn(`Ignoring an unreadable file upload message for ${t}:`, e);
|
|
5790
5844
|
});
|
|
5791
|
-
}, { opcodeGroupsMask:
|
|
5845
|
+
}, { opcodeGroupsMask: x.GROUP_ACTIONS });
|
|
5792
5846
|
});
|
|
5793
5847
|
}
|
|
5794
|
-
function
|
|
5848
|
+
function lb(e, t, n) {
|
|
5795
5849
|
return new Promise((r, i) => {
|
|
5796
5850
|
if (n.aborted) {
|
|
5797
5851
|
r({ Accepted: !1 });
|
|
5798
5852
|
return;
|
|
5799
5853
|
}
|
|
5800
5854
|
let a = setTimeout(() => {
|
|
5801
|
-
s(), i(new
|
|
5802
|
-
},
|
|
5855
|
+
s(), i(new X("Timed out waiting for the upload to be accepted", !0));
|
|
5856
|
+
}, Qy), o = () => {
|
|
5803
5857
|
clearTimeout(a), s(), r({ Accepted: !1 });
|
|
5804
5858
|
};
|
|
5805
5859
|
n.addEventListener("abort", o, { once: !0 });
|
|
@@ -5807,20 +5861,20 @@ function ib(e, t, n) {
|
|
|
5807
5861
|
y(e) === 1048644 && Xn(e).then((e) => {
|
|
5808
5862
|
e.UploadId === t && (clearTimeout(a), n.removeEventListener("abort", o), s(), r(e));
|
|
5809
5863
|
}).catch((e) => {
|
|
5810
|
-
|
|
5864
|
+
Y.warn(`Ignoring an unreadable file upload message for ${t}:`, e);
|
|
5811
5865
|
});
|
|
5812
|
-
}, { opcodeGroupsMask:
|
|
5866
|
+
}, { opcodeGroupsMask: x.GROUP_ACTIONS });
|
|
5813
5867
|
});
|
|
5814
5868
|
}
|
|
5815
|
-
function
|
|
5869
|
+
function ub(e, t, n) {
|
|
5816
5870
|
return new Promise((r, i) => {
|
|
5817
5871
|
if (n.aborted) {
|
|
5818
5872
|
r({ Accepted: !1 });
|
|
5819
5873
|
return;
|
|
5820
5874
|
}
|
|
5821
5875
|
let a = setTimeout(() => {
|
|
5822
|
-
s(), i(new
|
|
5823
|
-
},
|
|
5876
|
+
s(), i(new X("Timed out waiting for the upload to start", !0));
|
|
5877
|
+
}, Qy), o = () => {
|
|
5824
5878
|
clearTimeout(a), s(), r({ Accepted: !1 });
|
|
5825
5879
|
};
|
|
5826
5880
|
n.addEventListener("abort", o, { once: !0 });
|
|
@@ -5828,12 +5882,12 @@ function ab(e, t, n) {
|
|
|
5828
5882
|
y(e) === 1048646 && Ar(e).then((e) => {
|
|
5829
5883
|
e.UploadId === t && (clearTimeout(a), n.removeEventListener("abort", o), s(), r(e));
|
|
5830
5884
|
}).catch((e) => {
|
|
5831
|
-
|
|
5885
|
+
Y.warn(`Ignoring an unreadable file upload message for ${t}:`, e);
|
|
5832
5886
|
});
|
|
5833
|
-
}, { opcodeGroupsMask:
|
|
5887
|
+
}, { opcodeGroupsMask: x.GROUP_ACTIONS });
|
|
5834
5888
|
});
|
|
5835
5889
|
}
|
|
5836
|
-
var
|
|
5890
|
+
var db = class {
|
|
5837
5891
|
uploadId;
|
|
5838
5892
|
signal;
|
|
5839
5893
|
waiters = /* @__PURE__ */ new Map();
|
|
@@ -5848,9 +5902,9 @@ var ob = class {
|
|
|
5848
5902
|
y(e) === 1048648 && rn(e).then((e) => {
|
|
5849
5903
|
e.UploadId === this.uploadId && this.onAck(e.SequenceId);
|
|
5850
5904
|
}).catch((e) => {
|
|
5851
|
-
|
|
5905
|
+
Y.warn(`Ignoring an unreadable file upload ACK for ${this.uploadId}:`, e);
|
|
5852
5906
|
});
|
|
5853
|
-
}, { opcodeGroupsMask:
|
|
5907
|
+
}, { opcodeGroupsMask: x.GROUP_ACTIONS }), this.resetIdleTimer();
|
|
5854
5908
|
}
|
|
5855
5909
|
waitFor(e) {
|
|
5856
5910
|
return this.failure ? Promise.reject(this.failure) : this.signal.aborted || e <= this.highestAcked ? Promise.resolve() : new Promise((t, n) => {
|
|
@@ -5862,7 +5916,7 @@ var ob = class {
|
|
|
5862
5916
|
}
|
|
5863
5917
|
disconnected() {
|
|
5864
5918
|
this.clearIdleTimer();
|
|
5865
|
-
for (let e of [...this.waiters.values()]) e.reject(new
|
|
5919
|
+
for (let e of [...this.waiters.values()]) e.reject(new nb());
|
|
5866
5920
|
this.waiters.clear();
|
|
5867
5921
|
}
|
|
5868
5922
|
rewindTo(e) {
|
|
@@ -5877,8 +5931,8 @@ var ob = class {
|
|
|
5877
5931
|
}
|
|
5878
5932
|
resetIdleTimer() {
|
|
5879
5933
|
this.clearIdleTimer(), this.idleTimer = setTimeout(() => {
|
|
5880
|
-
this.fail(new
|
|
5881
|
-
},
|
|
5934
|
+
this.fail(new X(`Upload stalled: no acknowledgement for ${$y / 1e3}s after sequence ${this.highestAcked}`, !0));
|
|
5935
|
+
}, $y);
|
|
5882
5936
|
}
|
|
5883
5937
|
clearIdleTimer() {
|
|
5884
5938
|
this.idleTimer &&= (clearTimeout(this.idleTimer), null);
|
|
@@ -5894,15 +5948,15 @@ var ob = class {
|
|
|
5894
5948
|
this.waiters.clear();
|
|
5895
5949
|
}
|
|
5896
5950
|
};
|
|
5897
|
-
function
|
|
5951
|
+
function fb(e, t, n) {
|
|
5898
5952
|
return new Promise((r, i) => {
|
|
5899
5953
|
if (n.aborted) {
|
|
5900
5954
|
r(null);
|
|
5901
5955
|
return;
|
|
5902
5956
|
}
|
|
5903
5957
|
let a = setTimeout(() => {
|
|
5904
|
-
s(), i(new
|
|
5905
|
-
},
|
|
5958
|
+
s(), i(new X(`No upload result received in ${eb / 1e3}s`, !0));
|
|
5959
|
+
}, eb), o = () => {
|
|
5906
5960
|
clearTimeout(a), s(), r(null);
|
|
5907
5961
|
};
|
|
5908
5962
|
n.addEventListener("abort", o, { once: !0 });
|
|
@@ -5910,43 +5964,43 @@ function sb(e, t, n) {
|
|
|
5910
5964
|
y(e) === 1048650 && mn(e).then((e) => {
|
|
5911
5965
|
e.UploadId === t && (clearTimeout(a), n.removeEventListener("abort", o), s(), r(e));
|
|
5912
5966
|
}).catch((e) => {
|
|
5913
|
-
|
|
5967
|
+
Y.warn(`Ignoring an unreadable file upload message for ${t}:`, e);
|
|
5914
5968
|
});
|
|
5915
|
-
}, { opcodeGroupsMask:
|
|
5969
|
+
}, { opcodeGroupsMask: x.GROUP_ACTIONS });
|
|
5916
5970
|
});
|
|
5917
5971
|
}
|
|
5918
5972
|
//#endregion
|
|
5919
5973
|
//#region src/capture/view-capture.ts
|
|
5920
|
-
var
|
|
5921
|
-
function
|
|
5922
|
-
let t =
|
|
5923
|
-
return
|
|
5974
|
+
var pb = S("ViewCapture"), mb = "data-ikon-capture-exclude", hb = "data-ikon-inspect-outline", gb = 4096, _b = 2, vb = 1e4, yb = 3e4, bb = 250, xb = 16, Sb = 1e3, Cb = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACklEQVR4nGOYBwAAoACfz3DXOgAAAABJRU5ErkJggg==", wb = null;
|
|
5975
|
+
function Tb(e) {
|
|
5976
|
+
let t = Db(e);
|
|
5977
|
+
return wb = {
|
|
5924
5978
|
image: t,
|
|
5925
5979
|
takenAtMs: Date.now()
|
|
5926
5980
|
}, t;
|
|
5927
5981
|
}
|
|
5928
|
-
function
|
|
5929
|
-
let e =
|
|
5930
|
-
return
|
|
5982
|
+
function Eb() {
|
|
5983
|
+
let e = wb;
|
|
5984
|
+
return wb = null, !e || Date.now() - e.takenAtMs > yb ? null : e.image;
|
|
5931
5985
|
}
|
|
5932
|
-
async function
|
|
5933
|
-
let t = /* @__PURE__ */ new Set(), n = await
|
|
5986
|
+
async function Db(e = document.body) {
|
|
5987
|
+
let t = /* @__PURE__ */ new Set(), n = await Pb(e, t), { createContext: r, destroyContext: i, domToBlob: a } = await import("./dist-BrkppKKs.js"), o = Ab(), s = await r(e, {
|
|
5934
5988
|
type: "image/png",
|
|
5935
|
-
includeStyleProperties:
|
|
5936
|
-
scale: Math.min(typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1,
|
|
5937
|
-
maximumCanvasSize:
|
|
5938
|
-
timeout:
|
|
5939
|
-
backgroundColor:
|
|
5989
|
+
includeStyleProperties: Ob(e),
|
|
5990
|
+
scale: Math.min(typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, _b),
|
|
5991
|
+
maximumCanvasSize: gb,
|
|
5992
|
+
timeout: vb,
|
|
5993
|
+
backgroundColor: Nb(e),
|
|
5940
5994
|
features: { restoreScrollPosition: !0 },
|
|
5941
|
-
filter: (e) => !
|
|
5942
|
-
fetch: { placeholderImage: () => (t.add("an image the page may not read (cross-origin without CORS, or failed to load)"),
|
|
5943
|
-
onCloneEachNode: (e) => (
|
|
5995
|
+
filter: (e) => !Mb(e),
|
|
5996
|
+
fetch: { placeholderImage: () => (t.add("an image the page may not read (cross-origin without CORS, or failed to load)"), Cb) },
|
|
5997
|
+
onCloneEachNode: (e) => (jb(e), o()),
|
|
5944
5998
|
onCloneNode: (e) => {
|
|
5945
|
-
|
|
5999
|
+
Rb(e, n, t);
|
|
5946
6000
|
}
|
|
5947
6001
|
});
|
|
5948
6002
|
try {
|
|
5949
|
-
return s.sandbox = await
|
|
6003
|
+
return s.sandbox = await kb(e.ownerDocument), {
|
|
5950
6004
|
png: await a(s),
|
|
5951
6005
|
lostContent: t.size > 0,
|
|
5952
6006
|
lostReasons: [...t]
|
|
@@ -5955,7 +6009,7 @@ async function Sb(e = document.body) {
|
|
|
5955
6009
|
i(s);
|
|
5956
6010
|
}
|
|
5957
6011
|
}
|
|
5958
|
-
function
|
|
6012
|
+
function Ob(e) {
|
|
5959
6013
|
let t = getComputedStyle(e), n = [];
|
|
5960
6014
|
for (let e = 0; e < t.length; e++) {
|
|
5961
6015
|
let r = t.item(e);
|
|
@@ -5963,28 +6017,28 @@ function Cb(e) {
|
|
|
5963
6017
|
}
|
|
5964
6018
|
return n;
|
|
5965
6019
|
}
|
|
5966
|
-
function
|
|
6020
|
+
function kb(e) {
|
|
5967
6021
|
return new Promise((t) => {
|
|
5968
|
-
let n = e.createElement("iframe"), r = setTimeout(() => t(n),
|
|
5969
|
-
n.width = "0", n.height = "0", n.style.visibility = "hidden", n.style.position = "fixed", n.setAttribute(
|
|
6022
|
+
let n = e.createElement("iframe"), r = setTimeout(() => t(n), Sb);
|
|
6023
|
+
n.width = "0", n.height = "0", n.style.visibility = "hidden", n.style.position = "fixed", n.setAttribute(mb, ""), n.addEventListener("load", () => {
|
|
5970
6024
|
clearTimeout(r), t(n);
|
|
5971
6025
|
}, { once: !0 }), n.srcdoc = "<!DOCTYPE html><meta charset=\"UTF-8\"><title></title><body>", e.body.appendChild(n);
|
|
5972
6026
|
});
|
|
5973
6027
|
}
|
|
5974
|
-
function
|
|
6028
|
+
function Ab() {
|
|
5975
6029
|
let e = performance.now();
|
|
5976
6030
|
return () => {
|
|
5977
|
-
if (!(performance.now() - e <
|
|
6031
|
+
if (!(performance.now() - e < xb)) return new Promise((t) => {
|
|
5978
6032
|
setTimeout(() => {
|
|
5979
6033
|
e = performance.now(), t();
|
|
5980
6034
|
}, 0);
|
|
5981
6035
|
});
|
|
5982
6036
|
};
|
|
5983
6037
|
}
|
|
5984
|
-
function
|
|
6038
|
+
function jb(e) {
|
|
5985
6039
|
if (e.nodeType !== Node.ELEMENT_NODE || !e.hasAttribute("data-ikon-inspect-outline")) return;
|
|
5986
6040
|
let t = e;
|
|
5987
|
-
t.removeAttribute(
|
|
6041
|
+
t.removeAttribute(hb);
|
|
5988
6042
|
for (let e of [
|
|
5989
6043
|
"outline",
|
|
5990
6044
|
"outline-color",
|
|
@@ -5993,36 +6047,36 @@ function Eb(e) {
|
|
|
5993
6047
|
"outline-offset"
|
|
5994
6048
|
]) t.style.removeProperty(e);
|
|
5995
6049
|
}
|
|
5996
|
-
function
|
|
6050
|
+
function Mb(e) {
|
|
5997
6051
|
return e.nodeType === Node.ELEMENT_NODE && e.hasAttribute("data-ikon-capture-exclude");
|
|
5998
6052
|
}
|
|
5999
|
-
function
|
|
6053
|
+
function Nb(e) {
|
|
6000
6054
|
for (let t of [e, e.ownerDocument.documentElement]) {
|
|
6001
6055
|
let e = getComputedStyle(t).backgroundColor;
|
|
6002
6056
|
if (e && e !== "transparent" && e !== "rgba(0, 0, 0, 0)") return e;
|
|
6003
6057
|
}
|
|
6004
6058
|
return null;
|
|
6005
6059
|
}
|
|
6006
|
-
function
|
|
6060
|
+
function Pb(e, t) {
|
|
6007
6061
|
return new Promise((n, r) => {
|
|
6008
6062
|
let i = !1, a = (a) => {
|
|
6009
6063
|
if (!i) {
|
|
6010
6064
|
i = !0, clearTimeout(o);
|
|
6011
6065
|
try {
|
|
6012
|
-
let r =
|
|
6066
|
+
let r = Ib(e, t);
|
|
6013
6067
|
!a && r.some((e) => e.tagName === "CANVAS") && t.add("canvas content (the page was not rendering, so a WebGL canvas may be blank)"), n(r.map((e) => ({
|
|
6014
6068
|
element: e,
|
|
6015
|
-
dataUrl:
|
|
6069
|
+
dataUrl: Fb(e, t)
|
|
6016
6070
|
})));
|
|
6017
6071
|
} catch (e) {
|
|
6018
6072
|
r(e instanceof Error ? e : Error(String(e)));
|
|
6019
6073
|
}
|
|
6020
6074
|
}
|
|
6021
|
-
}, o = setTimeout(() => a(!1),
|
|
6075
|
+
}, o = setTimeout(() => a(!1), bb);
|
|
6022
6076
|
requestAnimationFrame(() => a(!0));
|
|
6023
6077
|
});
|
|
6024
6078
|
}
|
|
6025
|
-
function
|
|
6079
|
+
function Fb(e, t) {
|
|
6026
6080
|
let n = e.tagName;
|
|
6027
6081
|
if (n !== "CANVAS" && n !== "VIDEO") return null;
|
|
6028
6082
|
let r = e, i = n === "CANVAS" ? r.width : r.videoWidth, a = n === "CANVAS" ? r.height : r.videoHeight;
|
|
@@ -6030,14 +6084,14 @@ function Ab(e, t) {
|
|
|
6030
6084
|
let o = e.ownerDocument.createElement("canvas");
|
|
6031
6085
|
o.width = i, o.height = a;
|
|
6032
6086
|
let s = o.getContext("2d");
|
|
6033
|
-
if (!s) return t.add("a canvas or video (no 2D context to copy it into)"),
|
|
6087
|
+
if (!s) return t.add("a canvas or video (no 2D context to copy it into)"), Cb;
|
|
6034
6088
|
try {
|
|
6035
6089
|
return s.drawImage(r, 0, 0, i, a), o.toDataURL("image/png");
|
|
6036
6090
|
} catch (e) {
|
|
6037
|
-
return
|
|
6091
|
+
return pb.debug(`Could not read ${n.toLowerCase()} pixels for the view capture: ${String(e)}`), t.add(n === "VIDEO" ? "a video the page may not read (cross-origin without CORS)" : "a canvas the page may not read (drawn from cross-origin content)"), Cb;
|
|
6038
6092
|
}
|
|
6039
6093
|
}
|
|
6040
|
-
function
|
|
6094
|
+
function Ib(e, t) {
|
|
6041
6095
|
let n = [], r = (e) => {
|
|
6042
6096
|
for (let t = e.firstChild; t; t = t.nextSibling) {
|
|
6043
6097
|
if (t.nodeType !== Node.ELEMENT_NODE) continue;
|
|
@@ -6050,9 +6104,9 @@ function jb(e, t) {
|
|
|
6050
6104
|
}
|
|
6051
6105
|
}, i = (e) => {
|
|
6052
6106
|
let a = e.tagName;
|
|
6053
|
-
if (!(a === "STYLE" || a === "SCRIPT" ||
|
|
6107
|
+
if (!(a === "STYLE" || a === "SCRIPT" || Mb(e))) {
|
|
6054
6108
|
if (a === "IFRAME") {
|
|
6055
|
-
let n =
|
|
6109
|
+
let n = Lb(e);
|
|
6056
6110
|
n ? i(n) : t.add("an embedded frame from another origin");
|
|
6057
6111
|
return;
|
|
6058
6112
|
}
|
|
@@ -6061,35 +6115,35 @@ function jb(e, t) {
|
|
|
6061
6115
|
};
|
|
6062
6116
|
return r(e.shadowRoot ?? e), n;
|
|
6063
6117
|
}
|
|
6064
|
-
function
|
|
6118
|
+
function Lb(e) {
|
|
6065
6119
|
try {
|
|
6066
6120
|
return e.contentDocument?.documentElement ?? null;
|
|
6067
6121
|
} catch {
|
|
6068
6122
|
return null;
|
|
6069
6123
|
}
|
|
6070
6124
|
}
|
|
6071
|
-
function
|
|
6125
|
+
function Rb(e, t, n) {
|
|
6072
6126
|
if (t.length === 0 || e.nodeType !== Node.ELEMENT_NODE) return;
|
|
6073
6127
|
let r = Array.from(e.querySelectorAll("img, canvas, video"));
|
|
6074
6128
|
if (r.length !== t.length) {
|
|
6075
|
-
|
|
6129
|
+
pb.warn(`View capture could not place ${t.length} media frames onto ${r.length} cloned elements, canvases and videos may be blank`), n.add("canvas or video content (the page changed while it was captured)");
|
|
6076
6130
|
return;
|
|
6077
6131
|
}
|
|
6078
6132
|
t.forEach((e, t) => {
|
|
6079
6133
|
if (e.dataUrl === null) return;
|
|
6080
|
-
let n = r[t], i = n.tagName === "IMG" ? n :
|
|
6134
|
+
let n = r[t], i = n.tagName === "IMG" ? n : zb(n);
|
|
6081
6135
|
i.removeAttribute("srcset"), i.src = e.dataUrl;
|
|
6082
6136
|
});
|
|
6083
6137
|
}
|
|
6084
|
-
function
|
|
6138
|
+
function zb(e) {
|
|
6085
6139
|
let t = e.ownerDocument.createElement("img");
|
|
6086
6140
|
for (let n of Array.from(e.attributes)) n.name !== "src" && n.name !== "poster" && t.setAttribute(n.name, n.value);
|
|
6087
6141
|
return e.replaceWith(t), t;
|
|
6088
6142
|
}
|
|
6089
6143
|
//#endregion
|
|
6090
6144
|
//#region src/capture/capture-functions.ts
|
|
6091
|
-
var
|
|
6092
|
-
name:
|
|
6145
|
+
var Bb = S("CaptureFunctions"), Vb = "ikon.client.captureView", Hb = "ikon.client.setFeedback", Ub = "ikon.client.setFeedbackButton", Wb = "ikon.client.openFeedback", Gb = "screenshot.png", Kb = {
|
|
6146
|
+
name: Vb,
|
|
6093
6147
|
description: "Capture what the user sees of the app as a PNG and upload it through the given upload action",
|
|
6094
6148
|
returnType: {
|
|
6095
6149
|
kind: "string",
|
|
@@ -6100,8 +6154,8 @@ var Fb = x("CaptureFunctions"), Ib = "ikon.client.captureView", Lb = "ikon.clien
|
|
|
6100
6154
|
type: { kind: "string" },
|
|
6101
6155
|
description: "The upload action that receives the PNG"
|
|
6102
6156
|
}]
|
|
6103
|
-
},
|
|
6104
|
-
name:
|
|
6157
|
+
}, qb = {
|
|
6158
|
+
name: Hb,
|
|
6105
6159
|
description: "Offer or withdraw the feedback overlay for this client, and set whether its button shows",
|
|
6106
6160
|
returnType: { kind: "boolean" },
|
|
6107
6161
|
parameters: [{
|
|
@@ -6113,8 +6167,8 @@ var Fb = x("CaptureFunctions"), Ib = "ikon.client.captureView", Lb = "ikon.clien
|
|
|
6113
6167
|
type: { kind: "boolean" },
|
|
6114
6168
|
description: "Whether the always-visible button shows by default"
|
|
6115
6169
|
}]
|
|
6116
|
-
},
|
|
6117
|
-
name:
|
|
6170
|
+
}, Jb = {
|
|
6171
|
+
name: Ub,
|
|
6118
6172
|
description: "Show or hide the floating feedback button, saving the choice as the person's preference for this app",
|
|
6119
6173
|
returnType: { kind: "boolean" },
|
|
6120
6174
|
parameters: [{
|
|
@@ -6122,54 +6176,54 @@ var Fb = x("CaptureFunctions"), Ib = "ikon.client.captureView", Lb = "ikon.clien
|
|
|
6122
6176
|
type: { kind: "boolean" },
|
|
6123
6177
|
description: "Whether the button shows"
|
|
6124
6178
|
}]
|
|
6125
|
-
},
|
|
6126
|
-
name:
|
|
6179
|
+
}, Yb = {
|
|
6180
|
+
name: Wb,
|
|
6127
6181
|
description: "Open the feedback sheet as the feedback button does, taking the screenshot now",
|
|
6128
6182
|
returnType: { kind: "boolean" },
|
|
6129
6183
|
parameters: []
|
|
6130
6184
|
};
|
|
6131
|
-
function
|
|
6132
|
-
return typeof t != "boolean" || typeof n != "boolean" ? (
|
|
6185
|
+
function Xb(e, t, n) {
|
|
6186
|
+
return typeof t != "boolean" || typeof n != "boolean" ? (Bb.warn(`Ignoring ${Hb} with non-boolean arguments (${typeof t}, ${typeof n})`), !1) : (e.setFeedback(t ? { showButton: n } : null), !0);
|
|
6133
6187
|
}
|
|
6134
|
-
var
|
|
6135
|
-
async function
|
|
6188
|
+
var Zb = "No capture was requested from this screen";
|
|
6189
|
+
async function Qb(e, t) {
|
|
6136
6190
|
if (typeof t != "string" || !t) return {
|
|
6137
6191
|
Uploaded: !1,
|
|
6138
6192
|
UploadId: "",
|
|
6139
6193
|
LostContent: !1,
|
|
6140
6194
|
Reason: "No upload action was given"
|
|
6141
6195
|
};
|
|
6142
|
-
let n =
|
|
6196
|
+
let n = Eb();
|
|
6143
6197
|
if (!n) return {
|
|
6144
6198
|
Uploaded: !1,
|
|
6145
6199
|
UploadId: "",
|
|
6146
6200
|
LostContent: !1,
|
|
6147
|
-
Reason:
|
|
6201
|
+
Reason: Zb
|
|
6148
6202
|
};
|
|
6149
6203
|
let r;
|
|
6150
6204
|
try {
|
|
6151
6205
|
r = await n;
|
|
6152
6206
|
} catch (e) {
|
|
6153
|
-
return
|
|
6207
|
+
return Bb.warn(`View capture for upload action ${t} failed, the report has no screenshot:`, e), {
|
|
6154
6208
|
Uploaded: !1,
|
|
6155
6209
|
UploadId: "",
|
|
6156
6210
|
LostContent: !1,
|
|
6157
|
-
Reason: `Capture failed: ${
|
|
6211
|
+
Reason: `Capture failed: ${nx(e)}`
|
|
6158
6212
|
};
|
|
6159
6213
|
}
|
|
6160
|
-
let i =
|
|
6214
|
+
let i = V_(), a = r.lostReasons.length > 0 ? `Not captured: ${r.lostReasons.join("; ")}` : "";
|
|
6161
6215
|
try {
|
|
6162
|
-
await
|
|
6163
|
-
file: new File([r.png],
|
|
6216
|
+
await ab(e, {
|
|
6217
|
+
file: new File([r.png], Gb, { type: "image/png" }),
|
|
6164
6218
|
uploadId: i,
|
|
6165
6219
|
uploadActionId: t
|
|
6166
6220
|
});
|
|
6167
6221
|
} catch (e) {
|
|
6168
|
-
return
|
|
6222
|
+
return Bb.warn(`Uploading the view capture ${i} through upload action ${t} failed, the report has no screenshot:`, e), {
|
|
6169
6223
|
Uploaded: !1,
|
|
6170
6224
|
UploadId: i,
|
|
6171
6225
|
LostContent: r.lostContent,
|
|
6172
|
-
Reason: `Upload failed: ${
|
|
6226
|
+
Reason: `Upload failed: ${nx(e)}`
|
|
6173
6227
|
};
|
|
6174
6228
|
}
|
|
6175
6229
|
return {
|
|
@@ -6179,29 +6233,29 @@ async function qb(e, t) {
|
|
|
6179
6233
|
Reason: a
|
|
6180
6234
|
};
|
|
6181
6235
|
}
|
|
6182
|
-
function
|
|
6183
|
-
return e.register(
|
|
6236
|
+
function $b(e, t) {
|
|
6237
|
+
return e.register(qb, (e, n) => Xb(t, e, n));
|
|
6184
6238
|
}
|
|
6185
|
-
function
|
|
6239
|
+
function ex(e, t) {
|
|
6186
6240
|
let n = [
|
|
6187
|
-
e.register(
|
|
6188
|
-
e.register(
|
|
6189
|
-
e.register(
|
|
6241
|
+
e.register(Kb, (e) => Qb(t, e)),
|
|
6242
|
+
e.register(Yb, () => t.requestFeedback()),
|
|
6243
|
+
e.register(Jb, (e) => tx(t, e))
|
|
6190
6244
|
];
|
|
6191
6245
|
return () => {
|
|
6192
6246
|
for (let e of n) e();
|
|
6193
6247
|
};
|
|
6194
6248
|
}
|
|
6195
|
-
function
|
|
6196
|
-
return typeof t == "boolean" ? e.setFeedbackButtonShown(t) : (
|
|
6249
|
+
function tx(e, t) {
|
|
6250
|
+
return typeof t == "boolean" ? e.setFeedbackButtonShown(t) : (Bb.warn(`Ignoring ${Ub} with a non-boolean argument (${typeof t})`), !1);
|
|
6197
6251
|
}
|
|
6198
|
-
function
|
|
6252
|
+
function nx(e) {
|
|
6199
6253
|
return e instanceof Error ? e.message : String(e);
|
|
6200
6254
|
}
|
|
6201
6255
|
//#endregion
|
|
6202
6256
|
//#region src/backend/user-account.ts
|
|
6203
|
-
var
|
|
6204
|
-
async function
|
|
6257
|
+
var rx = 14;
|
|
6258
|
+
async function ix(e, t) {
|
|
6205
6259
|
if (!e.ok) {
|
|
6206
6260
|
let n = await e.text().catch(() => ""), r = n;
|
|
6207
6261
|
try {
|
|
@@ -6212,8 +6266,8 @@ async function $b(e, t) {
|
|
|
6212
6266
|
}
|
|
6213
6267
|
return await e.json();
|
|
6214
6268
|
}
|
|
6215
|
-
async function
|
|
6216
|
-
return
|
|
6269
|
+
async function ax(e, t, n, r) {
|
|
6270
|
+
return ix(await fetch(`${M(r.backendUrl)}${t}`, {
|
|
6217
6271
|
method: e,
|
|
6218
6272
|
headers: {
|
|
6219
6273
|
...L(),
|
|
@@ -6222,19 +6276,19 @@ async function ex(e, t, n, r) {
|
|
|
6222
6276
|
signal: r.signal
|
|
6223
6277
|
}), n);
|
|
6224
6278
|
}
|
|
6225
|
-
function
|
|
6226
|
-
return
|
|
6279
|
+
function ox(e) {
|
|
6280
|
+
return ax("GET", "/users/me", "Reading the current user", e);
|
|
6227
6281
|
}
|
|
6228
|
-
function
|
|
6229
|
-
return
|
|
6282
|
+
function sx(e) {
|
|
6283
|
+
return ax("POST", "/users/me/removal", "Requesting account removal", e);
|
|
6230
6284
|
}
|
|
6231
|
-
function
|
|
6232
|
-
return
|
|
6285
|
+
function cx(e) {
|
|
6286
|
+
return ax("DELETE", "/users/me/removal", "Cancelling account removal", e);
|
|
6233
6287
|
}
|
|
6234
6288
|
//#endregion
|
|
6235
6289
|
//#region src/backend/account-functions.ts
|
|
6236
|
-
var
|
|
6237
|
-
function
|
|
6290
|
+
var lx = S("AccountFunctions"), ux = "ikon.client.getAccountRemoval", dx = "ikon.client.requestAccountRemoval", fx = "ikon.client.cancelAccountRemoval";
|
|
6291
|
+
function px(e, t) {
|
|
6238
6292
|
return {
|
|
6239
6293
|
name: e,
|
|
6240
6294
|
description: t,
|
|
@@ -6245,8 +6299,8 @@ function cx(e, t) {
|
|
|
6245
6299
|
parameters: []
|
|
6246
6300
|
};
|
|
6247
6301
|
}
|
|
6248
|
-
var
|
|
6249
|
-
async function
|
|
6302
|
+
var mx = px(ux, "Read the signed-in user's scheduled account erasure"), hx = px(dx, "Schedule erasure of the signed-in user's account after the grace period"), gx = px(fx, "Cancel a scheduled erasure of the signed-in user's account");
|
|
6303
|
+
async function _x(e, t, n) {
|
|
6250
6304
|
let r = e.backendAccess;
|
|
6251
6305
|
if (!r) return {
|
|
6252
6306
|
Succeeded: !1,
|
|
@@ -6267,7 +6321,7 @@ async function fx(e, t, n) {
|
|
|
6267
6321
|
};
|
|
6268
6322
|
} catch (e) {
|
|
6269
6323
|
let t = e instanceof Error ? e.message : String(e);
|
|
6270
|
-
return
|
|
6324
|
+
return lx.debug(`${n} failed: ${t}`), {
|
|
6271
6325
|
Succeeded: !1,
|
|
6272
6326
|
ScheduledFor: "",
|
|
6273
6327
|
RequestedAt: "",
|
|
@@ -6275,11 +6329,11 @@ async function fx(e, t, n) {
|
|
|
6275
6329
|
};
|
|
6276
6330
|
}
|
|
6277
6331
|
}
|
|
6278
|
-
function
|
|
6332
|
+
function vx(e, t) {
|
|
6279
6333
|
let n = [
|
|
6280
|
-
e.register(
|
|
6281
|
-
e.register(
|
|
6282
|
-
e.register(
|
|
6334
|
+
e.register(mx, () => _x(t, ox, ux)),
|
|
6335
|
+
e.register(hx, () => _x(t, sx, dx)),
|
|
6336
|
+
e.register(gx, () => _x(t, cx, fx))
|
|
6283
6337
|
];
|
|
6284
6338
|
return () => {
|
|
6285
6339
|
for (let e of n) e();
|
|
@@ -6287,39 +6341,39 @@ function px(e, t) {
|
|
|
6287
6341
|
}
|
|
6288
6342
|
//#endregion
|
|
6289
6343
|
//#region src/feedback/feedback-api.ts
|
|
6290
|
-
var
|
|
6344
|
+
var yx = "ikon.platform.feedback.open", bx = [
|
|
6291
6345
|
"bug",
|
|
6292
6346
|
"idea",
|
|
6293
6347
|
"confusing",
|
|
6294
6348
|
"praise"
|
|
6295
|
-
],
|
|
6349
|
+
], xx = class extends Error {
|
|
6296
6350
|
status;
|
|
6297
6351
|
constructor(e, t) {
|
|
6298
6352
|
super(e), this.name = "FeedbackRequestError", this.status = t;
|
|
6299
6353
|
}
|
|
6300
|
-
},
|
|
6301
|
-
function
|
|
6354
|
+
}, Sx = 12e4, Cx = 64, wx = /^[0-9a-f]{24}$/i;
|
|
6355
|
+
function Tx() {
|
|
6302
6356
|
return {
|
|
6303
6357
|
route: typeof window < "u" ? `${window.location.pathname}${window.location.hash}` : "",
|
|
6304
|
-
viewport:
|
|
6358
|
+
viewport: mh(),
|
|
6305
6359
|
locale: typeof navigator < "u" ? navigator.language : "",
|
|
6306
|
-
theme:
|
|
6307
|
-
sdk: `typescript/${
|
|
6360
|
+
theme: ph(),
|
|
6361
|
+
sdk: `typescript/${Ig}`,
|
|
6308
6362
|
userAgent: typeof navigator < "u" ? navigator.userAgent : ""
|
|
6309
6363
|
};
|
|
6310
6364
|
}
|
|
6311
|
-
async function
|
|
6365
|
+
async function Ex(e, t, n, r) {
|
|
6312
6366
|
let { draftId: i } = r;
|
|
6313
|
-
if (!i || i.length >
|
|
6367
|
+
if (!i || i.length > Cx) throw Error(`A feedback draft id must be 1-${Cx} characters, got ${i.length}`);
|
|
6314
6368
|
let a = new FormData();
|
|
6315
|
-
a.append("kind", t.kind), a.append("text", t.text), a.append("context", JSON.stringify(t.context)), t.appSession &&
|
|
6369
|
+
a.append("kind", t.kind), a.append("text", t.text), a.append("context", JSON.stringify(t.context)), t.appSession && wx.test(t.appSession) && a.append("appSession", t.appSession), t.clientSession && a.append("clientSession", t.clientSession), n.screenshot && a.append("screenshot", n.screenshot, "screenshot.png");
|
|
6316
6370
|
for (let e of n.files) a.append("files", e, e.name);
|
|
6317
|
-
let o = `${
|
|
6371
|
+
let o = `${Ox(e)}/feedback?draft=${encodeURIComponent(i)}`, s = new AbortController(), c = setTimeout(() => s.abort(), Sx), l = r.signal ? tm([r.signal, s.signal]) : s.signal, u;
|
|
6318
6372
|
try {
|
|
6319
|
-
u = await
|
|
6373
|
+
u = await Ax(o, {
|
|
6320
6374
|
method: "POST",
|
|
6321
6375
|
body: a,
|
|
6322
|
-
headers:
|
|
6376
|
+
headers: kx(e),
|
|
6323
6377
|
signal: l
|
|
6324
6378
|
}, () => s.signal.aborted);
|
|
6325
6379
|
} finally {
|
|
@@ -6328,78 +6382,78 @@ async function xx(e, t, n, r) {
|
|
|
6328
6382
|
let d = await u.json().catch(() => null);
|
|
6329
6383
|
return typeof d?.id == "string" ? d.id : "";
|
|
6330
6384
|
}
|
|
6331
|
-
async function
|
|
6332
|
-
await
|
|
6385
|
+
async function Dx(e, t, n) {
|
|
6386
|
+
await Ax(`${Ox(e)}/feedback/preference`, {
|
|
6333
6387
|
method: "PUT",
|
|
6334
6388
|
body: JSON.stringify({ showButton: t }),
|
|
6335
6389
|
headers: {
|
|
6336
|
-
...
|
|
6390
|
+
...kx(e),
|
|
6337
6391
|
"Content-Type": "application/json"
|
|
6338
6392
|
},
|
|
6339
6393
|
signal: n
|
|
6340
6394
|
});
|
|
6341
6395
|
}
|
|
6342
|
-
function
|
|
6396
|
+
function Ox(e) {
|
|
6343
6397
|
return `${e.backendUrl.replace(/\/+$/, "")}/spaces/${encodeURIComponent(e.spaceId)}`;
|
|
6344
6398
|
}
|
|
6345
|
-
function
|
|
6399
|
+
function kx(e) {
|
|
6346
6400
|
return {
|
|
6347
6401
|
...L(),
|
|
6348
6402
|
Authorization: `Bearer ${e.token}`
|
|
6349
6403
|
};
|
|
6350
6404
|
}
|
|
6351
|
-
async function
|
|
6405
|
+
async function Ax(e, t, n = () => !1) {
|
|
6352
6406
|
let r;
|
|
6353
6407
|
try {
|
|
6354
6408
|
r = await fetch(e, t);
|
|
6355
6409
|
} catch (e) {
|
|
6356
|
-
throw n() ? new
|
|
6410
|
+
throw n() ? new xx(`The feedback service did not answer within ${Sx / 1e3} s`, 0) : e instanceof DOMException && e.name === "AbortError" ? e : new xx(`The feedback service could not be reached: ${e instanceof Error ? e.message : String(e)}`, 0);
|
|
6357
6411
|
}
|
|
6358
|
-
if (!r.ok) throw new
|
|
6412
|
+
if (!r.ok) throw new xx(await jx(r), r.status);
|
|
6359
6413
|
return r;
|
|
6360
6414
|
}
|
|
6361
|
-
async function
|
|
6415
|
+
async function jx(e) {
|
|
6362
6416
|
let t = await e.json().catch(() => null);
|
|
6363
6417
|
return (Array.isArray(t?.message) ? t.message.join(", ") : typeof t?.message == "string" ? t.message : "") || `The feedback service answered ${e.status}`;
|
|
6364
6418
|
}
|
|
6365
6419
|
//#endregion
|
|
6366
6420
|
//#region src/utils/debug-mode.ts
|
|
6367
|
-
var
|
|
6368
|
-
function
|
|
6369
|
-
return
|
|
6421
|
+
var Mx = S("DebugMode"), Z = !1;
|
|
6422
|
+
function Nx() {
|
|
6423
|
+
return Z ? !0 : (Z = at(), Z && (ne(C.DEBUG), Mx.info("Debug mode enabled")), Z);
|
|
6370
6424
|
}
|
|
6371
|
-
function
|
|
6372
|
-
return
|
|
6425
|
+
function Px() {
|
|
6426
|
+
return Z;
|
|
6373
6427
|
}
|
|
6374
|
-
function
|
|
6375
|
-
|
|
6428
|
+
function Fx() {
|
|
6429
|
+
Z || (Z = !0, ne(C.DEBUG), Mx.info("Debug mode enabled"), De(Ke, "true"));
|
|
6376
6430
|
}
|
|
6377
6431
|
//#endregion
|
|
6378
6432
|
//#region src/utils/inspect-mode.ts
|
|
6379
|
-
var
|
|
6380
|
-
function
|
|
6381
|
-
typeof window < "u" && window.dispatchEvent(new Event(
|
|
6433
|
+
var Ix = "ikon-inspect-mode-changed", Q = !1;
|
|
6434
|
+
function Lx() {
|
|
6435
|
+
typeof window < "u" && window.dispatchEvent(new Event(Ix));
|
|
6382
6436
|
}
|
|
6383
|
-
function
|
|
6384
|
-
let e =
|
|
6385
|
-
return e !==
|
|
6437
|
+
function Rx() {
|
|
6438
|
+
let e = Me();
|
|
6439
|
+
return e !== Q && (Q = e, Lx()), Q;
|
|
6386
6440
|
}
|
|
6387
|
-
function
|
|
6388
|
-
return
|
|
6441
|
+
function zx() {
|
|
6442
|
+
return Q;
|
|
6389
6443
|
}
|
|
6390
|
-
function
|
|
6391
|
-
|
|
6444
|
+
function Bx() {
|
|
6445
|
+
Q || (Q = !0, De(ot, "true"), Lx());
|
|
6392
6446
|
}
|
|
6393
6447
|
//#endregion
|
|
6394
6448
|
//#region src/utils/parent-log-forward.ts
|
|
6395
|
-
var
|
|
6396
|
-
function
|
|
6449
|
+
var Vx = "IKON_CLIENT_LOG", Hx = 250, Ux = 200, Wx = 2e3, Gx = !1;
|
|
6450
|
+
function Kx() {
|
|
6397
6451
|
try {
|
|
6398
6452
|
if (typeof document < "u" && document.referrer) return new URL(document.referrer).origin;
|
|
6399
6453
|
} catch {}
|
|
6400
6454
|
return "*";
|
|
6401
6455
|
}
|
|
6402
|
-
function
|
|
6456
|
+
function qx(e) {
|
|
6403
6457
|
if (e instanceof Error) return e.stack || `${e.name}: ${e.message}`;
|
|
6404
6458
|
if (typeof e == "string") return e;
|
|
6405
6459
|
try {
|
|
@@ -6408,53 +6462,53 @@ function Ux(e) {
|
|
|
6408
6462
|
return String(e);
|
|
6409
6463
|
}
|
|
6410
6464
|
}
|
|
6411
|
-
function
|
|
6412
|
-
return e.length >
|
|
6465
|
+
function Jx(e) {
|
|
6466
|
+
return e.length > Wx ? `${e.slice(0, Wx)}…` : e;
|
|
6413
6467
|
}
|
|
6414
|
-
function
|
|
6468
|
+
function Yx(e) {
|
|
6415
6469
|
switch (e) {
|
|
6416
|
-
case
|
|
6417
|
-
case
|
|
6418
|
-
case
|
|
6470
|
+
case C.ERROR: return "error";
|
|
6471
|
+
case C.WARN: return "warn";
|
|
6472
|
+
case C.INFO: return "info";
|
|
6419
6473
|
default: return "debug";
|
|
6420
6474
|
}
|
|
6421
6475
|
}
|
|
6422
|
-
function
|
|
6423
|
-
let t = [e.message, ...e.args.map(
|
|
6476
|
+
function Xx(e) {
|
|
6477
|
+
let t = [e.message, ...e.args.map(qx)];
|
|
6424
6478
|
return {
|
|
6425
6479
|
timestamp: e.timestamp,
|
|
6426
|
-
level:
|
|
6480
|
+
level: Yx(e.level),
|
|
6427
6481
|
component: e.component,
|
|
6428
|
-
message:
|
|
6482
|
+
message: Jx(t.join(" "))
|
|
6429
6483
|
};
|
|
6430
6484
|
}
|
|
6431
|
-
function
|
|
6485
|
+
function Zx(e) {
|
|
6432
6486
|
let t = e.target;
|
|
6433
6487
|
return !t || !t.tagName ? `${e.message} @ ${e.filename || "?"}:${e.lineno}` : t.tagName === "SCRIPT" || t.tagName === "LINK" && t.rel === "stylesheet" ? `Could not load ${t.src || t.href}` : null;
|
|
6434
6488
|
}
|
|
6435
|
-
function
|
|
6436
|
-
if (
|
|
6437
|
-
|
|
6489
|
+
function Qx() {
|
|
6490
|
+
if (Gx || typeof window > "u" || !window.parent || window.parent === window) return () => void 0;
|
|
6491
|
+
Gx = !0;
|
|
6438
6492
|
let e = [], t = null, n = () => {
|
|
6439
6493
|
if (t = null, e.length === 0) return;
|
|
6440
6494
|
let n = e;
|
|
6441
6495
|
e = [];
|
|
6442
6496
|
try {
|
|
6443
6497
|
let e = {
|
|
6444
|
-
type:
|
|
6498
|
+
type: Vx,
|
|
6445
6499
|
entries: n
|
|
6446
6500
|
};
|
|
6447
|
-
window.parent.postMessage(e,
|
|
6501
|
+
window.parent.postMessage(e, Kx());
|
|
6448
6502
|
} catch {}
|
|
6449
6503
|
}, r = (r) => {
|
|
6450
|
-
e.length >=
|
|
6451
|
-
}, i =
|
|
6452
|
-
let t =
|
|
6504
|
+
e.length >= Ux && e.shift(), e.push(r), t === null && (t = setTimeout(n, Hx));
|
|
6505
|
+
}, i = oe((e) => r(Xx(e)), { minLevel: C.INFO }), a = (e) => {
|
|
6506
|
+
let t = Zx(e);
|
|
6453
6507
|
t !== null && r({
|
|
6454
6508
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6455
6509
|
level: "error",
|
|
6456
6510
|
component: "window",
|
|
6457
|
-
message:
|
|
6511
|
+
message: Jx(t)
|
|
6458
6512
|
});
|
|
6459
6513
|
}, o = (e) => {
|
|
6460
6514
|
let t = e.reason;
|
|
@@ -6462,16 +6516,16 @@ function Jx() {
|
|
|
6462
6516
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6463
6517
|
level: "error",
|
|
6464
6518
|
component: "window",
|
|
6465
|
-
message:
|
|
6519
|
+
message: Jx(`Unhandled rejection: ${qx(t)}`)
|
|
6466
6520
|
});
|
|
6467
6521
|
};
|
|
6468
6522
|
return window.addEventListener("error", a, !0), window.addEventListener("unhandledrejection", o), () => {
|
|
6469
|
-
i(), window.removeEventListener("error", a, !0), window.removeEventListener("unhandledrejection", o), t !== null && (clearTimeout(t), t = null), e = [],
|
|
6523
|
+
i(), window.removeEventListener("error", a, !0), window.removeEventListener("unhandledrejection", o), t !== null && (clearTimeout(t), t = null), e = [], Gx = !1;
|
|
6470
6524
|
};
|
|
6471
6525
|
}
|
|
6472
6526
|
//#endregion
|
|
6473
6527
|
//#region src/utils/external-link.ts
|
|
6474
|
-
var
|
|
6528
|
+
var $x = /* @__PURE__ */ new Set([
|
|
6475
6529
|
"http",
|
|
6476
6530
|
"https",
|
|
6477
6531
|
"file",
|
|
@@ -6488,12 +6542,12 @@ var Yx = /* @__PURE__ */ new Set([
|
|
|
6488
6542
|
"edge",
|
|
6489
6543
|
"moz-extension",
|
|
6490
6544
|
"safari-web-extension"
|
|
6491
|
-
]),
|
|
6492
|
-
function
|
|
6493
|
-
let t =
|
|
6494
|
-
return t ?
|
|
6545
|
+
]), eS = /^([a-z][a-z0-9+.-]*):/i;
|
|
6546
|
+
function tS(e) {
|
|
6547
|
+
let t = eS.exec(e.trim());
|
|
6548
|
+
return t ? !$x.has(t[1].toLowerCase()) : !1;
|
|
6495
6549
|
}
|
|
6496
|
-
function
|
|
6550
|
+
function nS(e) {
|
|
6497
6551
|
if (typeof document > "u") return;
|
|
6498
6552
|
let t = document.createElement("iframe");
|
|
6499
6553
|
t.setAttribute("aria-hidden", "true"), t.style.display = "none", document.body.appendChild(t);
|
|
@@ -6507,7 +6561,7 @@ function Qx(e) {
|
|
|
6507
6561
|
}
|
|
6508
6562
|
//#endregion
|
|
6509
6563
|
//#region src/utils/browser-support.ts
|
|
6510
|
-
var
|
|
6564
|
+
var rS = [
|
|
6511
6565
|
{
|
|
6512
6566
|
name: "WebSocket",
|
|
6513
6567
|
isPresent: () => typeof WebSocket < "u"
|
|
@@ -6521,9 +6575,9 @@ var $x = [
|
|
|
6521
6575
|
isPresent: () => typeof BigInt < "u"
|
|
6522
6576
|
}
|
|
6523
6577
|
];
|
|
6524
|
-
function
|
|
6578
|
+
function iS() {
|
|
6525
6579
|
let e = [];
|
|
6526
|
-
for (let t of
|
|
6580
|
+
for (let t of rS) {
|
|
6527
6581
|
let n;
|
|
6528
6582
|
try {
|
|
6529
6583
|
n = t.isPresent();
|
|
@@ -6539,22 +6593,22 @@ function eS() {
|
|
|
6539
6593
|
}
|
|
6540
6594
|
//#endregion
|
|
6541
6595
|
//#region src/transport/transport-probe.ts
|
|
6542
|
-
var
|
|
6543
|
-
async function
|
|
6544
|
-
let r = n?.timeoutMs ??
|
|
6596
|
+
var aS = S("TransportProbe"), oS = 3e3;
|
|
6597
|
+
async function sS(e, t, n) {
|
|
6598
|
+
let r = n?.timeoutMs ?? oS, a = n?.signal;
|
|
6545
6599
|
if (a?.aborted) return !1;
|
|
6546
6600
|
let o = Date.now();
|
|
6547
6601
|
try {
|
|
6548
|
-
let n =
|
|
6549
|
-
return
|
|
6602
|
+
let n = cS(e) ? await uS(t, r, a) : await lS(t, r, a);
|
|
6603
|
+
return aS.debug(`Probe ${i[e]} ${t}: ${n ? "reachable" : "unreachable"} in ${Date.now() - o}ms`), n;
|
|
6550
6604
|
} catch (n) {
|
|
6551
|
-
return
|
|
6605
|
+
return aS.debug(`Probe ${i[e]} ${t} failed after ${Date.now() - o}ms: ${n instanceof Error ? n.message : n}`), !1;
|
|
6552
6606
|
}
|
|
6553
6607
|
}
|
|
6554
|
-
function
|
|
6608
|
+
function cS(e) {
|
|
6555
6609
|
return e === i.WebTransport || e === i.WebTransportProxy;
|
|
6556
6610
|
}
|
|
6557
|
-
function
|
|
6611
|
+
function lS(e, t, n) {
|
|
6558
6612
|
return typeof WebSocket > "u" ? Promise.resolve(!1) : new Promise((r) => {
|
|
6559
6613
|
let i = new WebSocket(e), a = !1, o = (e) => {
|
|
6560
6614
|
if (!a) {
|
|
@@ -6568,7 +6622,7 @@ function aS(e, t, n) {
|
|
|
6568
6622
|
n?.addEventListener("abort", s, { once: !0 }), i.onopen = () => o(!0), i.onerror = () => o(!1), i.onclose = () => o(!1);
|
|
6569
6623
|
});
|
|
6570
6624
|
}
|
|
6571
|
-
async function
|
|
6625
|
+
async function uS(e, t, n) {
|
|
6572
6626
|
if (!vt()) return !1;
|
|
6573
6627
|
let r = new WebTransport(e), i;
|
|
6574
6628
|
try {
|
|
@@ -6587,7 +6641,7 @@ async function oS(e, t, n) {
|
|
|
6587
6641
|
}
|
|
6588
6642
|
//#endregion
|
|
6589
6643
|
//#region src/worker/protocol-worker.ts?worker
|
|
6590
|
-
function
|
|
6644
|
+
function dS(e) {
|
|
6591
6645
|
return new Worker(new URL("assets/protocol-worker-Byc-OmNW.js", import.meta.url).href, {
|
|
6592
6646
|
type: "module",
|
|
6593
6647
|
name: e?.name
|
|
@@ -6595,11 +6649,11 @@ function sS(e) {
|
|
|
6595
6649
|
}
|
|
6596
6650
|
//#endregion
|
|
6597
6651
|
//#region src/client/ikon-client.ts
|
|
6598
|
-
var $ =
|
|
6599
|
-
function
|
|
6652
|
+
var $ = S("IkonClient"), fS = [1e4, 3e4], pS = 3e3, mS = 2;
|
|
6653
|
+
function hS() {
|
|
6600
6654
|
return typeof __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__ < "u" && __IKON_WAIT_FOR_EXTERNAL_CONNECT_URL__;
|
|
6601
6655
|
}
|
|
6602
|
-
var
|
|
6656
|
+
var gS = 500, _S = class n {
|
|
6603
6657
|
channelManager = null;
|
|
6604
6658
|
protocolWorker = null;
|
|
6605
6659
|
preloadedWorker = null;
|
|
@@ -6713,7 +6767,7 @@ var fS = 500, pS = class n {
|
|
|
6713
6767
|
_serverStopped = !1;
|
|
6714
6768
|
_credentialRejected = !1;
|
|
6715
6769
|
_hasBeenConnected = !1;
|
|
6716
|
-
_waitForExternalConnectUrl =
|
|
6770
|
+
_waitForExternalConnectUrl = hS() && !we();
|
|
6717
6771
|
_externalConnectUrlCleanup = null;
|
|
6718
6772
|
get media() {
|
|
6719
6773
|
return this._media;
|
|
@@ -6730,7 +6784,7 @@ var fS = 500, pS = class n {
|
|
|
6730
6784
|
return this._mediaCapture;
|
|
6731
6785
|
}
|
|
6732
6786
|
async ensureMediaCapture() {
|
|
6733
|
-
return this._mediaCapture ? this._mediaCapture : I() ? (this._mediaCapturePromise ||= import("./ikon-media-capture-
|
|
6787
|
+
return this._mediaCapture ? this._mediaCapture : I() ? (this._mediaCapturePromise ||= import("./ikon-media-capture-4aEsbGgC.js").then(({ IkonMediaCapture: e }) => (this._mediaCapture = new e(this, this._mediaCaptureConfig), this._mediaCapture)), this._mediaCapturePromise) : null;
|
|
6734
6788
|
}
|
|
6735
6789
|
async ensureMedia() {
|
|
6736
6790
|
return this._media ? this._media : (this._mediaPromise ||= import("./ikon-media-BQjL59S_.js").then(({ IkonMedia: e }) => (this._media = new e(this, this._mediaConfig), this._media)), this._mediaPromise);
|
|
@@ -6742,7 +6796,7 @@ var fS = 500, pS = class n {
|
|
|
6742
6796
|
return this._videoEnabled;
|
|
6743
6797
|
}
|
|
6744
6798
|
get isWebRtcEnabled() {
|
|
6745
|
-
return (
|
|
6799
|
+
return (He() ?? this.config.webRtc?.enabled ?? !0) && (this._audioEnabled || this._videoEnabled);
|
|
6746
6800
|
}
|
|
6747
6801
|
get isWebRtcMediaActive() {
|
|
6748
6802
|
return this.isWebRtcEnabled && !this._webRtcFallbackActive;
|
|
@@ -6750,6 +6804,10 @@ var fS = 500, pS = class n {
|
|
|
6750
6804
|
get isWebRtcCaptureAvailable() {
|
|
6751
6805
|
return this.isWebRtcEnabled && this._webRtcSignaling?.state === "connected";
|
|
6752
6806
|
}
|
|
6807
|
+
get isWebRtcFirstConnecting() {
|
|
6808
|
+
let e = this._webRtcSignaling?.state;
|
|
6809
|
+
return this.isWebRtcEnabled && !this._webRtcFallbackActive && this._webRtcRetryCount === 0 && (e === "new" || e === "connecting");
|
|
6810
|
+
}
|
|
6753
6811
|
get webRtcVideoStreams() {
|
|
6754
6812
|
return this._webRtcVideoStreams;
|
|
6755
6813
|
}
|
|
@@ -6762,6 +6820,11 @@ var fS = 500, pS = class n {
|
|
|
6762
6820
|
this._webRtcTrackMapListeners.delete(e);
|
|
6763
6821
|
};
|
|
6764
6822
|
}
|
|
6823
|
+
handleWebRtcVideoTrack(e, t) {
|
|
6824
|
+
this._webRtcVideoStreams.set(e, t);
|
|
6825
|
+
let n = this._webRtcTrackMap.get(`video:${e}`);
|
|
6826
|
+
n && this.notifyWebRtcTrackMapChanged(n);
|
|
6827
|
+
}
|
|
6765
6828
|
notifyWebRtcTrackMapChanged(e) {
|
|
6766
6829
|
this.onWebRtcTrackMapChanged?.(e);
|
|
6767
6830
|
for (let t of [...this._webRtcTrackMapListeners]) t(e);
|
|
@@ -6785,8 +6848,8 @@ var fS = 500, pS = class n {
|
|
|
6785
6848
|
].filter(Boolean).length;
|
|
6786
6849
|
if (t === 0) throw Error("IkonClient requires one of: \"local\", \"apiKey\", or \"sessionToken\" configuration");
|
|
6787
6850
|
if (t > 1) throw Error("IkonClient accepts only one of: \"local\", \"apiKey\", or \"sessionToken\" configuration");
|
|
6788
|
-
|
|
6789
|
-
let n = e.proxy === !0 ? "proxy" : e.proxy === !1 ? "direct" : e.proxy ?? null, r = e.local ? null :
|
|
6851
|
+
Nx(), hS() && I() && Qx(), I() && hh();
|
|
6852
|
+
let n = e.proxy === !0 ? "proxy" : e.proxy === !1 ? "direct" : e.proxy ?? null, r = e.local ? null : Fe() ?? n, i = r === "proxy" ? "force-proxy" : r === "direct" ? "force-direct" : r === "lb" ? "force-lb" : "auto", a = Oe(), o = a ? a.family === "websocket" : null, s = a ? a.family === "webtransport" : null, c = a ? a.family === "httpstream" : null;
|
|
6790
6853
|
this.httpStreamMode = a?.mode;
|
|
6791
6854
|
let l = o ?? e.websocket, u = s ?? e.webtransport ?? !1, d = c ?? e.httpstream;
|
|
6792
6855
|
if (this.endpointSelector = new Hp({
|
|
@@ -6799,8 +6862,8 @@ var fS = 500, pS = class n {
|
|
|
6799
6862
|
let e = a ? ` (pinned: ${a.family}${a.mode ? `/${a.mode}` : ""})` : "";
|
|
6800
6863
|
$.debug(`Transport filter: websocket=${l ?? "auto"}, webtransport=${u ?? "auto"}, httpstream=${d ?? "auto"}${e}`);
|
|
6801
6864
|
}
|
|
6802
|
-
this._functionRegistry = new
|
|
6803
|
-
let f =
|
|
6865
|
+
this._functionRegistry = new Gv(), this._reactiveRegistry = new Xv(this._functionRegistry), I() && !e.disableBrowserFunctions && (this.unregisterBrowserFunctions = Fg(this._functionRegistry), this.unregisterDownloadFunctions = Yy(this._functionRegistry), e.disableSoundFunctions || (this.unregisterSoundFunctions = Vy(this._functionRegistry))), I() && (this.unregisterLoginInterceptor = this._functionRegistry.addErrorInterceptor(ey));
|
|
6866
|
+
let f = Te(), p = Be();
|
|
6804
6867
|
this._audioEnabled = f ?? e.audio?.enabled ?? !0, this._videoEnabled = p ?? e.video?.enabled ?? !0;
|
|
6805
6868
|
let m = e.audio ? {
|
|
6806
6869
|
performance: e.audio.performance,
|
|
@@ -6811,7 +6874,7 @@ var fS = 500, pS = class n {
|
|
|
6811
6874
|
audio: m,
|
|
6812
6875
|
video: h,
|
|
6813
6876
|
mediaSession: e.mediaSession
|
|
6814
|
-
}, this._mediaCaptureConfig = { audio: { performance: { preferWebCodecs: e.audio?.performance?.preferWebCodecs } } }, I() && (this.unregisterMediaCaptureFunctions =
|
|
6877
|
+
}, this._mediaCaptureConfig = { audio: { performance: { preferWebCodecs: e.audio?.performance?.preferWebCodecs } } }, I() && (this.unregisterMediaCaptureFunctions = uy(this._functionRegistry, this), this.unregisterFeedbackFunctions = $b(this._functionRegistry, this), this.unregisterAccountFunctions = vx(this._functionRegistry, this)), this.captureFunctionsSupported = I();
|
|
6815
6878
|
}
|
|
6816
6879
|
_lastError = void 0;
|
|
6817
6880
|
get lastError() {
|
|
@@ -6887,20 +6950,20 @@ var fS = 500, pS = class n {
|
|
|
6887
6950
|
async connect() {
|
|
6888
6951
|
if (this._connectStarted) throw Error(`Cannot connect: already started (state: ${this.currentState})`);
|
|
6889
6952
|
this._connectStarted = !0;
|
|
6890
|
-
let e =
|
|
6953
|
+
let e = iS();
|
|
6891
6954
|
if (!e.supported) {
|
|
6892
6955
|
this.setErrorState(new Ue(e.missingFeatures));
|
|
6893
6956
|
return;
|
|
6894
6957
|
}
|
|
6895
6958
|
this.setupLifecycleHandlers();
|
|
6896
|
-
let t =
|
|
6959
|
+
let t = Ee();
|
|
6897
6960
|
if (t) {
|
|
6898
6961
|
$.info("Found a handed-over AuthResponse, joining its session"), this._resumedSession = !0, await this.executeConnection(async () => ({ authResponse: await Xa(t) }));
|
|
6899
6962
|
return;
|
|
6900
6963
|
}
|
|
6901
|
-
let n =
|
|
6964
|
+
let n = we();
|
|
6902
6965
|
if (n) {
|
|
6903
|
-
$.info("Found external connect URL in query parameter"), await this.executeConnection(() =>
|
|
6966
|
+
$.info("Found external connect URL in query parameter"), await this.executeConnection(() => xv(n, this.abortController.signal));
|
|
6904
6967
|
return;
|
|
6905
6968
|
}
|
|
6906
6969
|
if (this._waitForExternalConnectUrl) {
|
|
@@ -6911,14 +6974,14 @@ var fS = 500, pS = class n {
|
|
|
6911
6974
|
}
|
|
6912
6975
|
async executeConnection(e) {
|
|
6913
6976
|
if (this._lastError = void 0, this.abortController = new AbortController(), typeof Worker < "u" && !this.preloadedWorker) try {
|
|
6914
|
-
this.preloadedWorker = new
|
|
6977
|
+
this.preloadedWorker = new dS();
|
|
6915
6978
|
} catch {}
|
|
6916
6979
|
this.setState("connecting"), this.connectionTimer = setTimeout(() => {
|
|
6917
6980
|
this.currentState === "connecting" && ($.error("Connection timeout"), this.abortController?.abort("Connection timeout"), this.setState("offline"), this.config.onError?.(/* @__PURE__ */ Error("Connection timeout")));
|
|
6918
6981
|
}, this.connectionTimeoutMs);
|
|
6919
6982
|
try {
|
|
6920
6983
|
let t = await e();
|
|
6921
|
-
this.authResponse = t.authResponse, this._sessionId = t.authResponse.ClientContext.SessionId, this._connectUrl = t.directUrl, this._brandingRequired = t.brandingRequired ?? !1, this.recordBackendConfiguration(t), $.info(`Authenticated to Ikon server (ikonServerId=${t.authResponse.IkonServerId}, appSessionId=${t.authResponse.AppSessionId})`), !this.config.local && t.backendUrl && t.authToken && (
|
|
6984
|
+
this.authResponse = t.authResponse, this._sessionId = t.authResponse.ClientContext.SessionId, this._connectUrl = t.directUrl, this._brandingRequired = t.brandingRequired ?? !1, this.recordBackendConfiguration(t), $.info(`Authenticated to Ikon server (ikonServerId=${t.authResponse.IkonServerId}, appSessionId=${t.authResponse.AppSessionId})`), !this.config.local && t.backendUrl && t.authToken && (D_(t.backendUrl, t.authToken), this._logSenderStarted = !0), this.probeFasterConnectTiers(t), await this.connectProtocol(this.authResponse.Entrypoints);
|
|
6922
6985
|
} catch (e) {
|
|
6923
6986
|
if (e instanceof DOMException && e.name === "AbortError") return;
|
|
6924
6987
|
throw $.error("Connection failed:", e), this.clearTimers(), this.setState("offline"), this.config.onError?.(e instanceof Error ? e : Error(String(e))), e;
|
|
@@ -6930,7 +6993,7 @@ var fS = 500, pS = class n {
|
|
|
6930
6993
|
return;
|
|
6931
6994
|
}
|
|
6932
6995
|
let t = this.config.sessionToken?.token ?? this.config.local?.token;
|
|
6933
|
-
if (t &&
|
|
6996
|
+
if (t && J_(e) !== J_(t)) {
|
|
6934
6997
|
$.error("Ignoring an auth token for a different user; the client must be rebuilt for a new identity");
|
|
6935
6998
|
return;
|
|
6936
6999
|
}
|
|
@@ -6944,7 +7007,7 @@ var fS = 500, pS = class n {
|
|
|
6944
7007
|
};
|
|
6945
7008
|
this.config.local.identityToken === this.config.local.token && (t.identityToken = e), this.config.local = t;
|
|
6946
7009
|
}
|
|
6947
|
-
this._logSenderStarted &&
|
|
7010
|
+
this._logSenderStarted && O_(e), this._credentialRejected && (this._credentialRejected = !1, this._fullReauthAttempted = !1, $.info("New token after a refused credential, resuming"), this.setState("reconnecting"), this.attemptReconnect());
|
|
6948
7011
|
for (let t of this._siblings) t.updateAuthToken(e);
|
|
6949
7012
|
}
|
|
6950
7013
|
createSibling(e, t) {
|
|
@@ -6952,7 +7015,7 @@ var fS = 500, pS = class n {
|
|
|
6952
7015
|
return r._tokenOwner = this, this._siblings.add(r), r;
|
|
6953
7016
|
}
|
|
6954
7017
|
disconnect() {
|
|
6955
|
-
$.info("Disconnecting from Ikon server"), this.sendDisconnectSignal(), this._logSenderStarted &&= (
|
|
7018
|
+
$.info("Disconnecting from Ikon server"), this.sendDisconnectSignal(), this._logSenderStarted &&= (A_(), !1), this._tokenOwner?._siblings.delete(this), this._tokenOwner = null, this._siblings.clear(), this.clearTimers(), this.cleanupLifecycleHandlers(), this._externalConnectUrlCleanup &&= (this._externalConnectUrlCleanup(), null), this._media?.dispose(), this._mediaCapture?.dispose(), this.unregisterMediaCaptureFunctions &&= (this.unregisterMediaCaptureFunctions(), null), this.unregisterFeedbackFunctions &&= (this.unregisterFeedbackFunctions(), null), this.unregisterAccountFunctions &&= (this.unregisterAccountFunctions(), null), this.unregisterOfferedFeedbackFunctions?.(), this.unregisterOfferedFeedbackFunctions = null, this.unregisterSoundFunctions &&= (this.unregisterSoundFunctions(), null), this.unregisterDownloadFunctions &&= (this.unregisterDownloadFunctions(), 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._credentialRejected = !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, this._environmentTrackingCleanup?.(), this._environmentTrackingCleanup = null;
|
|
6956
7019
|
for (let e of this._webRtcAudioElements.values()) e.pause(), e.srcObject = null, e.remove();
|
|
6957
7020
|
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");
|
|
6958
7021
|
}
|
|
@@ -7066,11 +7129,11 @@ var fS = 500, pS = class n {
|
|
|
7066
7129
|
$.warn("Cannot send UpdateClientContext: not connected");
|
|
7067
7130
|
return;
|
|
7068
7131
|
}
|
|
7069
|
-
let t =
|
|
7132
|
+
let t = mh(), n = cd(id({
|
|
7070
7133
|
ViewportWidth: e.viewportWidth ?? t.width,
|
|
7071
7134
|
ViewportHeight: e.viewportHeight ?? t.height,
|
|
7072
|
-
Theme: e.theme ??
|
|
7073
|
-
Timezone: e.timezone ??
|
|
7135
|
+
Theme: e.theme ?? ph(),
|
|
7136
|
+
Timezone: e.timezone ?? wh()
|
|
7074
7137
|
}), this._sessionId);
|
|
7075
7138
|
this.sendProtocolMessage(n);
|
|
7076
7139
|
}
|
|
@@ -7153,7 +7216,7 @@ var fS = 500, pS = class n {
|
|
|
7153
7216
|
let a = (n) => {
|
|
7154
7217
|
let r = n.data;
|
|
7155
7218
|
if (!(!r || typeof r != "object") && !(r.type !== "send" || !(r.message instanceof ArrayBuffer))) try {
|
|
7156
|
-
let n =
|
|
7219
|
+
let n = b(new Uint8Array(r.message));
|
|
7157
7220
|
if ((t(n) & e.opcodeGroupsMask) === 0) return;
|
|
7158
7221
|
this.channelManager?.sendProtocolMessage(n);
|
|
7159
7222
|
} catch (e) {
|
|
@@ -7202,7 +7265,7 @@ var fS = 500, pS = class n {
|
|
|
7202
7265
|
showButton: e
|
|
7203
7266
|
}, this._feedbackSource ?? "server");
|
|
7204
7267
|
let t = this.backendAccess;
|
|
7205
|
-
return t &&
|
|
7268
|
+
return t && Dx(t, e).catch((e) => {
|
|
7206
7269
|
$.warn(`Saving the feedback button preference for space ${t.spaceId} failed, the choice lasts for this page only:`, e);
|
|
7207
7270
|
}), !0;
|
|
7208
7271
|
}
|
|
@@ -7226,7 +7289,7 @@ var fS = 500, pS = class n {
|
|
|
7226
7289
|
}
|
|
7227
7290
|
}
|
|
7228
7291
|
syncOfferedFeedbackFunctions(e) {
|
|
7229
|
-
e && !this.unregisterOfferedFeedbackFunctions && this.captureFunctionsSupported ? this.unregisterOfferedFeedbackFunctions =
|
|
7292
|
+
e && !this.unregisterOfferedFeedbackFunctions && this.captureFunctionsSupported ? this.unregisterOfferedFeedbackFunctions = ex(this._functionRegistry, this) : !e && this.unregisterOfferedFeedbackFunctions && (this.unregisterOfferedFeedbackFunctions(), this.unregisterOfferedFeedbackFunctions = null);
|
|
7230
7293
|
}
|
|
7231
7294
|
configuredBackendUrl() {
|
|
7232
7295
|
return this.config.sessionToken ? vm(this.config.sessionToken.backendType) : this.config.local ? M(this.config.local.backendUrl) : void 0;
|
|
@@ -7236,10 +7299,10 @@ var fS = 500, pS = class n {
|
|
|
7236
7299
|
}
|
|
7237
7300
|
async authenticate() {
|
|
7238
7301
|
let e = this.abortController?.signal;
|
|
7239
|
-
if (this.config.local) return
|
|
7302
|
+
if (this.config.local) return Av(this.config.local, e);
|
|
7240
7303
|
let t = this.endpointSelector.proxyMode, n = this.endpointSelector.connectTier, r;
|
|
7241
|
-
if (this.config.apiKey) r = await
|
|
7242
|
-
else if (this.config.sessionToken) r = await
|
|
7304
|
+
if (this.config.apiKey) r = await Mv(this.config.apiKey, e, t, n);
|
|
7305
|
+
else if (this.config.sessionToken) r = await Nv(this.config.sessionToken, e, t, n);
|
|
7243
7306
|
else throw Error("No connection configuration provided (need local, apiKey, or sessionToken)");
|
|
7244
7307
|
return r.connectTier && t === "auto" && this.endpointSelector.recordWorkingConnectTier(r.connectTier), r;
|
|
7245
7308
|
}
|
|
@@ -7249,7 +7312,7 @@ var fS = 500, pS = class n {
|
|
|
7249
7312
|
for (let n of this.endpointSelector.getFasterConnectTiers(t)) {
|
|
7250
7313
|
let t = e.connectTierUrls?.[n];
|
|
7251
7314
|
if (t) try {
|
|
7252
|
-
if (await
|
|
7315
|
+
if (await Sv(t)) {
|
|
7253
7316
|
$.debug(`Background probe: the ${n} tier is reachable, stepping up to it for the next connection`), this.endpointSelector.recordReachableConnectTier(n);
|
|
7254
7317
|
return;
|
|
7255
7318
|
}
|
|
@@ -7264,7 +7327,7 @@ var fS = 500, pS = class n {
|
|
|
7264
7327
|
this.notifyMessageSubscribers(n, r, i);
|
|
7265
7328
|
return;
|
|
7266
7329
|
}
|
|
7267
|
-
if (r ===
|
|
7330
|
+
if (r === x.ACTION_CALL_ACK) {
|
|
7268
7331
|
Jt(n).then((e) => {
|
|
7269
7332
|
let t = e.CallId.toString(), n = this._pendingActionAcks.get(t);
|
|
7270
7333
|
n !== void 0 && (clearTimeout(n.timer), this._pendingActionAcks.delete(t), this.recordAckRtt(Date.now() - n.sentAt));
|
|
@@ -7273,7 +7336,7 @@ var fS = 500, pS = class n {
|
|
|
7273
7336
|
});
|
|
7274
7337
|
return;
|
|
7275
7338
|
}
|
|
7276
|
-
if (r ===
|
|
7339
|
+
if (r === x.ACTION_RESULT) {
|
|
7277
7340
|
Br(n).then((e) => {
|
|
7278
7341
|
let t = e.CallId.toString(), n = this._actionIdByCallId.get(t);
|
|
7279
7342
|
this._actionIdByCallId.delete(t);
|
|
@@ -7290,21 +7353,21 @@ var fS = 500, pS = class n {
|
|
|
7290
7353
|
}), this.notifyMessageSubscribers(n, r, i);
|
|
7291
7354
|
return;
|
|
7292
7355
|
}
|
|
7293
|
-
if (r ===
|
|
7294
|
-
this._globalState = e, this._sessionId !== void 0 && this._functionRegistry.syncFromGlobalState(e, this._sessionId), this._media?.audio.syncStreamsFromGlobalState(e), this._media?.video.syncStreamsFromGlobalState(e), this._visemeTracker?.syncStreamsFromGlobalState(e), this._globalState.DebugMode &&
|
|
7356
|
+
if (r === x.CORE_GLOBAL_STATE && Ml(n).then((e) => {
|
|
7357
|
+
this._globalState = e, this._sessionId !== void 0 && this._functionRegistry.syncFromGlobalState(e, this._sessionId), this._media?.audio.syncStreamsFromGlobalState(e), this._media?.video.syncStreamsFromGlobalState(e), this._visemeTracker?.syncStreamsFromGlobalState(e), this._globalState.DebugMode && Fx(), Px() && this.protocolWorker && (this.protocolWorker.postMessage({
|
|
7295
7358
|
type: "enableDevtools",
|
|
7296
7359
|
enabled: !0
|
|
7297
7360
|
}), this.protocolWorker.postMessage({
|
|
7298
7361
|
type: "setLogLevel",
|
|
7299
|
-
level:
|
|
7362
|
+
level: ae()
|
|
7300
7363
|
})), this._globalStateReceived || (this._globalStateReceived = !0, this.tryHandleJoined());
|
|
7301
7364
|
}).catch((e) => {
|
|
7302
7365
|
$.error("Failed to parse GlobalState:", e);
|
|
7303
|
-
}), r ===
|
|
7366
|
+
}), r === x.CORE_CLIENT_INITIALIZATION && Kc(n).then((e) => {
|
|
7304
7367
|
this._sessionId !== void 0 && this._functionRegistry.registerFromClientInitialization(e, this._sessionId);
|
|
7305
7368
|
}).catch((e) => {
|
|
7306
7369
|
$.error("Failed to parse ClientInitialization:", e);
|
|
7307
|
-
}), r ===
|
|
7370
|
+
}), r === x.CORE_CLIENT_LIFECYCLE_BATCH) {
|
|
7308
7371
|
let t = bu(n), r = e(n).senderId;
|
|
7309
7372
|
for (let e of t.Events) {
|
|
7310
7373
|
if (e.ClientContext.SessionId === this._sessionId) continue;
|
|
@@ -7313,7 +7376,7 @@ var fS = 500, pS = class n {
|
|
|
7313
7376
|
}
|
|
7314
7377
|
return;
|
|
7315
7378
|
}
|
|
7316
|
-
if (r ===
|
|
7379
|
+
if (r === x.CORE_ON_FRONTEND_RELOADED) {
|
|
7317
7380
|
$.info("Frontend rebuilt — reloading the page"), typeof window < "u" && window.location.reload();
|
|
7318
7381
|
return;
|
|
7319
7382
|
}
|
|
@@ -7321,17 +7384,17 @@ var fS = 500, pS = class n {
|
|
|
7321
7384
|
}
|
|
7322
7385
|
buildLifecycleMessageFromEvent(e, t) {
|
|
7323
7386
|
switch (e.EventOpcode) {
|
|
7324
|
-
case
|
|
7325
|
-
case
|
|
7326
|
-
case
|
|
7327
|
-
case
|
|
7328
|
-
case
|
|
7387
|
+
case x.CORE_ON_CLIENT_JOINED: return Mu({ ClientContext: e.ClientContext }, t);
|
|
7388
|
+
case x.CORE_ON_CLIENT_READY: return Hu({ ClientContext: e.ClientContext }, t);
|
|
7389
|
+
case x.CORE_ON_CLIENT_LEFT: return Lu({ ClientContext: e.ClientContext }, t);
|
|
7390
|
+
case x.CORE_ON_USER_JOINED: return qu({ ClientContext: e.ClientContext }, t);
|
|
7391
|
+
case x.CORE_ON_USER_LEFT: return Qu({ ClientContext: e.ClientContext }, t);
|
|
7329
7392
|
default: return;
|
|
7330
7393
|
}
|
|
7331
7394
|
}
|
|
7332
7395
|
handleDataChannelMessage(e) {
|
|
7333
7396
|
try {
|
|
7334
|
-
let t =
|
|
7397
|
+
let t = b(new Uint8Array(e));
|
|
7335
7398
|
if (this._deliveringViaDataChannel = !0, this.protocolWorker) {
|
|
7336
7399
|
let e = t.slice().buffer;
|
|
7337
7400
|
this.protocolWorker.postMessage({
|
|
@@ -7380,7 +7443,7 @@ var fS = 500, pS = class n {
|
|
|
7380
7443
|
break;
|
|
7381
7444
|
case "offline":
|
|
7382
7445
|
if (this._reauthInProgress) break;
|
|
7383
|
-
if (this._hasBeenConnected && !this._serverStopped &&
|
|
7446
|
+
if (this._hasBeenConnected && !this._serverStopped && w()) {
|
|
7384
7447
|
this.currentState === "connected" && (this._channelsConnected = !1, this._globalStateReceived = !1, this._joinedHandled = !1, this._functionRegistry.detach(), this._reactiveRegistry.detach(), this.releaseKeepaliveLock(), this.setState("reconnecting")), this.attemptReconnect();
|
|
7385
7448
|
break;
|
|
7386
7449
|
}
|
|
@@ -7396,7 +7459,7 @@ var fS = 500, pS = class n {
|
|
|
7396
7459
|
}
|
|
7397
7460
|
setState(e) {
|
|
7398
7461
|
if (!this._isUnloading) {
|
|
7399
|
-
if (e === "offline" && this._hasBeenConnected && !this._serverStopped && !this._credentialRejected &&
|
|
7462
|
+
if (e === "offline" && this._hasBeenConnected && !this._serverStopped && !this._credentialRejected && w()) {
|
|
7400
7463
|
$.error("Refusing to set offline state from connected session — scheduling reconnect retry instead. This is a bug; investigate the call site."), this.setState("reconnecting"), this.scheduleReconnectRetry();
|
|
7401
7464
|
return;
|
|
7402
7465
|
}
|
|
@@ -7405,7 +7468,7 @@ var fS = 500, pS = class n {
|
|
|
7405
7468
|
window.parent.postMessage({
|
|
7406
7469
|
type: "IKON_CLIENT_CONNECTION_STATE",
|
|
7407
7470
|
state: e
|
|
7408
|
-
},
|
|
7471
|
+
}, Kx());
|
|
7409
7472
|
} catch {}
|
|
7410
7473
|
e !== "offline" && (this._lastError = void 0), e === "reconnecting" ? this._disconnectedAt === null && (this._disconnectedAt = Date.now()) : this._disconnectedAt = null, e !== "connected" && this.clearPendingActionAcks();
|
|
7411
7474
|
for (let t of this.stateSubscribers) try {
|
|
@@ -7431,15 +7494,15 @@ var fS = 500, pS = class n {
|
|
|
7431
7494
|
}
|
|
7432
7495
|
async connectProtocol(e, t = !1) {
|
|
7433
7496
|
if (this._connectedEntrypoints = e, this.assertPinnedTransportIsAvailable(e), typeof Worker > "u") {
|
|
7434
|
-
await this.connectProtocolOnMainThread(e, t), await this.finishMediaSetup(
|
|
7497
|
+
await this.connectProtocolOnMainThread(e, t), await this.finishMediaSetup(He() ?? this.config.webRtc?.enabled ?? !0);
|
|
7435
7498
|
return;
|
|
7436
7499
|
}
|
|
7437
7500
|
let n;
|
|
7438
7501
|
if (this.preloadedWorker) n = this.preloadedWorker, this.preloadedWorker = null;
|
|
7439
7502
|
else try {
|
|
7440
|
-
n = new
|
|
7503
|
+
n = new dS();
|
|
7441
7504
|
} catch (n) {
|
|
7442
|
-
$.warn(`Failed to create protocol worker, falling back to main thread: ${n}`), await this.connectProtocolOnMainThread(e, t), await this.finishMediaSetup(
|
|
7505
|
+
$.warn(`Failed to create protocol worker, falling back to main thread: ${n}`), await this.connectProtocolOnMainThread(e, t), await this.finishMediaSetup(He() ?? this.config.webRtc?.enabled ?? !0);
|
|
7443
7506
|
return;
|
|
7444
7507
|
}
|
|
7445
7508
|
this.channelManager = null, this.protocolWorker = n, this.workerManagerState = "idle";
|
|
@@ -7450,7 +7513,7 @@ var fS = 500, pS = class n {
|
|
|
7450
7513
|
n.addEventListener("message", (i) => {
|
|
7451
7514
|
let o = i.data;
|
|
7452
7515
|
if (o?.type === "protocol" && o.message instanceof ArrayBuffer) {
|
|
7453
|
-
let e =
|
|
7516
|
+
let e = b(new Uint8Array(o.message));
|
|
7454
7517
|
this.handleProtocolMessage(e);
|
|
7455
7518
|
return;
|
|
7456
7519
|
}
|
|
@@ -7460,11 +7523,11 @@ var fS = 500, pS = class n {
|
|
|
7460
7523
|
let n = o.activeType;
|
|
7461
7524
|
n !== void 0 && (this._activeEndpointType = n, this.endpointSelector.rememberWorkingType(n));
|
|
7462
7525
|
let i = o.httpStreamMode;
|
|
7463
|
-
i !== void 0 && this.rememberHttpStreamModeUnlessPinned(i), t === "connected" &&
|
|
7526
|
+
i !== void 0 && this.rememberHttpStreamModeUnlessPinned(i), t === "connected" && vS(n) && this.warnAboutFallbackTransport(i), this.handleChannelManagerStateChange(t), t === "connected" && !r && (r = !0, a(), e());
|
|
7464
7527
|
return;
|
|
7465
7528
|
}
|
|
7466
7529
|
if (o?.type === "refreshEntrypoints") {
|
|
7467
|
-
this._connectUrl ?
|
|
7530
|
+
this._connectUrl ? xv(this._connectUrl, this.abortController?.signal).then((e) => {
|
|
7468
7531
|
this.authResponse = e.authResponse, this._sessionId = e.authResponse.ClientContext.SessionId, n.postMessage({
|
|
7469
7532
|
type: "refreshedEntrypoints",
|
|
7470
7533
|
entrypoints: e.authResponse.Entrypoints,
|
|
@@ -7499,14 +7562,14 @@ var fS = 500, pS = class n {
|
|
|
7499
7562
|
r || (i = void 0, t(/* @__PURE__ */ Error("Protocol worker connect timed out")));
|
|
7500
7563
|
}, yp);
|
|
7501
7564
|
}), i = this.computeOrderedEndpointTypes(e), a = this.getServerKeepaliveTimeoutMs(), o = this.config.timeouts?.reconnectBackoffMs ?? 2e3, s = this.config.timeouts?.maxReconnectAttempts ?? 2;
|
|
7502
|
-
this.updateWorkerInterestMask(),
|
|
7565
|
+
this.updateWorkerInterestMask(), Px() && (n.postMessage({
|
|
7503
7566
|
type: "enableDevtools",
|
|
7504
7567
|
enabled: !0
|
|
7505
7568
|
}), n.postMessage({
|
|
7506
7569
|
type: "setLogLevel",
|
|
7507
|
-
level:
|
|
7508
|
-
})),
|
|
7509
|
-
let c =
|
|
7570
|
+
level: ae()
|
|
7571
|
+
})), Rx();
|
|
7572
|
+
let c = He() ?? this.config.webRtc?.enabled ?? !0;
|
|
7510
7573
|
n.postMessage({
|
|
7511
7574
|
type: "connect",
|
|
7512
7575
|
sessionId: this._sessionId,
|
|
@@ -7561,8 +7624,8 @@ var fS = 500, pS = class n {
|
|
|
7561
7624
|
this._audioEnabled && t.audio.setEnabled(!0).catch((t) => e("Audio playback setup", t)), this._videoEnabled && t.video.setEnabled(!0).catch((t) => e("Video playback setup", t));
|
|
7562
7625
|
}
|
|
7563
7626
|
async setupWebRtcSignaling() {
|
|
7564
|
-
let e =
|
|
7565
|
-
this._audioEnabled && (e |=
|
|
7627
|
+
let e = x.NONE;
|
|
7628
|
+
this._audioEnabled && (e |= x.GROUP_AUDIO), this._videoEnabled && (e |= x.GROUP_VIDEO);
|
|
7566
7629
|
let t = {
|
|
7567
7630
|
sessionId: this._sessionId,
|
|
7568
7631
|
opcodeGroupsFromServer: e,
|
|
@@ -7583,7 +7646,7 @@ var fS = 500, pS = class n {
|
|
|
7583
7646
|
this._webRtcAudioStreams.set(e, n), this._pendingActiveAudioTracks.has(e) && (this._pendingActiveAudioTracks.delete(e), this.createWebRtcAudioElement(e, n));
|
|
7584
7647
|
} : void 0,
|
|
7585
7648
|
onVideoTrack: this._videoEnabled ? (e, t, n) => {
|
|
7586
|
-
this.
|
|
7649
|
+
this.handleWebRtcVideoTrack(e, n);
|
|
7587
7650
|
} : void 0,
|
|
7588
7651
|
onTrackMap: (e) => {
|
|
7589
7652
|
let t = {
|
|
@@ -7631,25 +7694,25 @@ var fS = 500, pS = class n {
|
|
|
7631
7694
|
}
|
|
7632
7695
|
scheduleWebRtcIceRestart() {
|
|
7633
7696
|
if (!(this._webRtcIceRestartTimer || this._webRtcFallbackActive)) {
|
|
7634
|
-
if (this._webRtcIceRestartCount >=
|
|
7697
|
+
if (this._webRtcIceRestartCount >= mS) {
|
|
7635
7698
|
$.info(`WebRTC disconnected after ${this._webRtcIceRestartCount} ICE restarts, falling back to protocol-channel media`), this.fallbackToCustomPlayback("webrtc ice restarts exhausted");
|
|
7636
7699
|
return;
|
|
7637
7700
|
}
|
|
7638
7701
|
this._webRtcIceRestartTimer = setTimeout(() => {
|
|
7639
7702
|
this._webRtcIceRestartTimer = null;
|
|
7640
7703
|
let e = this._webRtcSignaling;
|
|
7641
|
-
!e || e.state !== "disconnected" || this.currentState !== "connected" || (this._webRtcIceRestartCount++, $.info(`WebRTC still disconnected, restarting ICE (attempt ${this._webRtcIceRestartCount}/${
|
|
7704
|
+
!e || e.state !== "disconnected" || this.currentState !== "connected" || (this._webRtcIceRestartCount++, $.info(`WebRTC still disconnected, restarting ICE (attempt ${this._webRtcIceRestartCount}/${mS})`), e.restartIce().then((e) => {
|
|
7642
7705
|
e || this.fallbackToCustomPlayback("webrtc ice restart had nothing to restart");
|
|
7643
7706
|
}, (e) => {
|
|
7644
7707
|
$.warn(`WebRTC ICE restart failed: ${e instanceof Error ? e.message : e}`), this.fallbackToCustomPlayback("webrtc ice restart failed");
|
|
7645
7708
|
}));
|
|
7646
|
-
},
|
|
7709
|
+
}, pS);
|
|
7647
7710
|
}
|
|
7648
7711
|
}
|
|
7649
7712
|
scheduleWebRtcRetry() {
|
|
7650
|
-
if (this._webRtcRetryTimer || this._webRtcRetryCount >=
|
|
7651
|
-
let e =
|
|
7652
|
-
$.info(`Retrying WebRTC in ${Math.round(e / 1e3)}s (attempt ${this._webRtcRetryCount}/${
|
|
7713
|
+
if (this._webRtcRetryTimer || this._webRtcRetryCount >= fS.length) return;
|
|
7714
|
+
let e = fS[this._webRtcRetryCount++];
|
|
7715
|
+
$.info(`Retrying WebRTC in ${Math.round(e / 1e3)}s (attempt ${this._webRtcRetryCount}/${fS.length})`), this._webRtcRetryTimer = setTimeout(() => {
|
|
7653
7716
|
this._webRtcRetryTimer = null, !(this.currentState !== "connected" || this._webRtcSignaling || !this.isWebRtcEnabled) && this.setupWebRtcSignaling();
|
|
7654
7717
|
}, e);
|
|
7655
7718
|
}
|
|
@@ -7684,7 +7747,7 @@ var fS = 500, pS = class n {
|
|
|
7684
7747
|
this.ensureWebRtcAudioUnlockHandler();
|
|
7685
7748
|
}), this.scheduleWebRtcAudioPlaybackVerification(e));
|
|
7686
7749
|
};
|
|
7687
|
-
n.addEventListener("pause", r), n.addEventListener("stalled", r), n.addEventListener("error", r),
|
|
7750
|
+
n.addEventListener("pause", r), n.addEventListener("stalled", r), n.addEventListener("error", r), fe() && this.ensureWebRtcAudioUnlockHandler(), n.play().then(() => {
|
|
7688
7751
|
setTimeout(() => {
|
|
7689
7752
|
this._webRtcAudioElements.has(e) && (n.volume = 0, n.muted = !1, n.play().then(() => {
|
|
7690
7753
|
let t = 0, r = setInterval(() => {
|
|
@@ -7725,13 +7788,13 @@ var fS = 500, pS = class n {
|
|
|
7725
7788
|
sendWebRtcAudioPlaybackReport(e, t) {
|
|
7726
7789
|
let n = this._webRtcTrackMap.get(`audio:${e}`);
|
|
7727
7790
|
if (n) try {
|
|
7728
|
-
let e =
|
|
7791
|
+
let e = le({
|
|
7729
7792
|
Epoch: 0,
|
|
7730
7793
|
PlayedSeconds: -1,
|
|
7731
7794
|
BufferedMs: 0,
|
|
7732
7795
|
State: t ? p.Playing : p.Blocked
|
|
7733
7796
|
});
|
|
7734
|
-
this.sendProtocolMessage(
|
|
7797
|
+
this.sendProtocolMessage(ue(e, this._sessionId ?? 0, {
|
|
7735
7798
|
trackId: n.senderTrackId,
|
|
7736
7799
|
targetIds: [n.senderId]
|
|
7737
7800
|
}));
|
|
@@ -7781,7 +7844,7 @@ var fS = 500, pS = class n {
|
|
|
7781
7844
|
}
|
|
7782
7845
|
async connectProtocolOnMainThread(e, t = !1) {
|
|
7783
7846
|
this.workerManagerState = null, this.protocolWorker = null;
|
|
7784
|
-
let n =
|
|
7847
|
+
let n = He() ?? this.config.webRtc?.enabled ?? !0;
|
|
7785
7848
|
$.debug(`Connecting on main thread (webRtcEnabled=${n}, entrypoints=${e.length})`);
|
|
7786
7849
|
let r = this.abortController?.signal, { ChannelManager: i } = await import("./channel-manager-ehgy3BJp.js");
|
|
7787
7850
|
if (r?.aborted) throw Error("The client disconnected while the main-thread transport was loading");
|
|
@@ -7799,13 +7862,13 @@ var fS = 500, pS = class n {
|
|
|
7799
7862
|
},
|
|
7800
7863
|
onStateChange: (e) => {
|
|
7801
7864
|
let t = this.channelManager?.activeHttpStreamMode;
|
|
7802
|
-
t && this.rememberHttpStreamModeUnlessPinned(t), e === "connected" &&
|
|
7865
|
+
t && this.rememberHttpStreamModeUnlessPinned(t), e === "connected" && vS(this.channelManager?.activeEndpointType ?? void 0) && this.warnAboutFallbackTransport(t ?? void 0), this.handleChannelManagerStateChange(e);
|
|
7803
7866
|
},
|
|
7804
7867
|
onError: (e) => {
|
|
7805
7868
|
this.config.onError?.(e);
|
|
7806
7869
|
},
|
|
7807
7870
|
onRefreshEntrypoints: this._connectUrl ? async () => {
|
|
7808
|
-
let e = await
|
|
7871
|
+
let e = await xv(this._connectUrl, this.abortController?.signal);
|
|
7809
7872
|
return this.authResponse = e.authResponse, this._sessionId = e.authResponse.ClientContext.SessionId, {
|
|
7810
7873
|
entrypoints: e.authResponse.Entrypoints,
|
|
7811
7874
|
sessionId: this._sessionId
|
|
@@ -7840,7 +7903,7 @@ var fS = 500, pS = class n {
|
|
|
7840
7903
|
warnAboutFallbackTransport(e) {
|
|
7841
7904
|
if (this._fallbackTransportWarned) return;
|
|
7842
7905
|
this._fallbackTransportWarned = !0;
|
|
7843
|
-
let t = this.httpStreamMode !== void 0 ||
|
|
7906
|
+
let t = this.httpStreamMode !== void 0 || Oe() !== null, n = typeof window < "u" ? window.location.origin : null, r = t ? "[pinned transport, not a network restriction] " : "";
|
|
7844
7907
|
if (t) {
|
|
7845
7908
|
$.info(`${r}${this.fallbackTransportMessage(n, e)}`);
|
|
7846
7909
|
return;
|
|
@@ -7859,8 +7922,8 @@ var fS = 500, pS = class n {
|
|
|
7859
7922
|
assertPinnedTransportIsAvailable(e) {
|
|
7860
7923
|
let t = this.groupEntrypointsByType(e);
|
|
7861
7924
|
if (t.size === 0 || this.computeOrderedEndpointTypes(e).length > 0) return;
|
|
7862
|
-
let n =
|
|
7863
|
-
throw new yt(n ? `${n.family}${n.mode ? `-${n.mode}` : ""}` : null,
|
|
7925
|
+
let n = Oe();
|
|
7926
|
+
throw new yt(n ? `${n.family}${n.mode ? `-${n.mode}` : ""}` : null, Fe(), [...t.keys()].map((e) => i[e]));
|
|
7864
7927
|
}
|
|
7865
7928
|
async revalidateEndpointPreference() {
|
|
7866
7929
|
if (this._revalidationDone || !this.endpointSelector.needsRevalidation()) return;
|
|
@@ -7872,7 +7935,7 @@ var fS = 500, pS = class n {
|
|
|
7872
7935
|
let n = this.groupEntrypointsByType(this._connectedEntrypoints), r = this.abortController?.signal;
|
|
7873
7936
|
for (let e of t) {
|
|
7874
7937
|
let t = n.get(e)?.[0]?.Uri;
|
|
7875
|
-
if (!(t === void 0 || r?.aborted) && await
|
|
7938
|
+
if (!(t === void 0 || r?.aborted) && await sS(e, t, { signal: r })) {
|
|
7876
7939
|
this.endpointSelector.recordFasterTypeReachable(e);
|
|
7877
7940
|
return;
|
|
7878
7941
|
}
|
|
@@ -7888,7 +7951,7 @@ var fS = 500, pS = class n {
|
|
|
7888
7951
|
});
|
|
7889
7952
|
return;
|
|
7890
7953
|
}
|
|
7891
|
-
let e =
|
|
7954
|
+
let e = x.GROUP_CORE | x.GROUP_ACTIONS;
|
|
7892
7955
|
for (let [, t] of this.messageSubscribers.entries()) {
|
|
7893
7956
|
if (!t || t.opcodeGroupsMask === void 0) {
|
|
7894
7957
|
this.protocolWorker.postMessage({
|
|
@@ -7929,16 +7992,16 @@ var fS = 500, pS = class n {
|
|
|
7929
7992
|
let e = 3e4, t = await Promise.race([this.authenticate(), new Promise((t, n) => {
|
|
7930
7993
|
setTimeout(() => n(/* @__PURE__ */ Error(`Re-authentication timed out after ${e / 1e3} s`)), e);
|
|
7931
7994
|
})]);
|
|
7932
|
-
this.authResponse = t.authResponse, this._sessionId = t.authResponse.ClientContext.SessionId, this._connectUrl = t.directUrl, this.recordBackendConfiguration(t), this._logSenderStarted && t.authToken &&
|
|
7995
|
+
this.authResponse = t.authResponse, this._sessionId = t.authResponse.ClientContext.SessionId, this._connectUrl = t.directUrl, this.recordBackendConfiguration(t), this._logSenderStarted && t.authToken && O_(t.authToken), $.info("Re-authenticated, connecting to new server"), await this.connectProtocol(this.authResponse.Entrypoints);
|
|
7933
7996
|
} catch (e) {
|
|
7934
7997
|
if (e instanceof DOMException && e.name === "AbortError") return;
|
|
7935
|
-
this.config.onError?.(e instanceof Error ? e : Error(String(e))), e instanceof
|
|
7998
|
+
this.config.onError?.(e instanceof Error ? e : Error(String(e))), e instanceof Ie || e instanceof Ae ? (this._credentialRejected = !0, $.error("Backend refused the credential during re-authentication, waiting for a new token:", e), this.clearTimers(), this.setState("offline")) : this._hasBeenConnected ? ($.warn("Full re-authentication failed, retrying:", e), this.scheduleReconnectRetry()) : ($.error("Full re-authentication failed, going offline:", e), this.clearTimers(), this.setState("offline"));
|
|
7936
7999
|
} finally {
|
|
7937
8000
|
this._reauthInProgress = !1;
|
|
7938
8001
|
}
|
|
7939
8002
|
}
|
|
7940
8003
|
attemptReconnect() {
|
|
7941
|
-
if (!
|
|
8004
|
+
if (!w()) {
|
|
7942
8005
|
$.warn("Retry disabled via ikon-retry=false, going offline"), this.clearTimers(), this.setState("offline");
|
|
7943
8006
|
return;
|
|
7944
8007
|
}
|
|
@@ -7965,7 +8028,7 @@ var fS = 500, pS = class n {
|
|
|
7965
8028
|
this.attemptFullReauth();
|
|
7966
8029
|
}
|
|
7967
8030
|
scheduleReconnectRetry() {
|
|
7968
|
-
if (!
|
|
8031
|
+
if (!w()) {
|
|
7969
8032
|
$.warn("Retry disabled via ikon-retry=false, going offline instead of scheduling retry"), this.clearTimers(), this.setState("offline");
|
|
7970
8033
|
return;
|
|
7971
8034
|
}
|
|
@@ -7991,7 +8054,7 @@ var fS = 500, pS = class n {
|
|
|
7991
8054
|
if (e !== null && t !== void 0) {
|
|
7992
8055
|
this._offlineProbeInFlight = !0;
|
|
7993
8056
|
try {
|
|
7994
|
-
let n = await
|
|
8057
|
+
let n = await sS(e, t, {
|
|
7995
8058
|
timeoutMs: Ep,
|
|
7996
8059
|
signal: this.abortController?.signal
|
|
7997
8060
|
});
|
|
@@ -8024,8 +8087,8 @@ var fS = 500, pS = class n {
|
|
|
8024
8087
|
let t = e.target?.closest?.("a[href]");
|
|
8025
8088
|
if (!t || t.target && t.target !== "_self") return;
|
|
8026
8089
|
let n = t.getAttribute("href") ?? "";
|
|
8027
|
-
if (
|
|
8028
|
-
e.preventDefault(),
|
|
8090
|
+
if (tS(n)) {
|
|
8091
|
+
e.preventDefault(), nS(n);
|
|
8029
8092
|
return;
|
|
8030
8093
|
}
|
|
8031
8094
|
let r = this.resolveInPlaceDestination(t, n);
|
|
@@ -8040,7 +8103,7 @@ var fS = 500, pS = class n {
|
|
|
8040
8103
|
} catch {
|
|
8041
8104
|
return;
|
|
8042
8105
|
}
|
|
8043
|
-
if (!(n.origin !== window.location.origin ||
|
|
8106
|
+
if (!(n.origin !== window.location.origin || ih(n.pathname) || n.protocol !== "http:" && n.protocol !== "https:")) {
|
|
8044
8107
|
if (this.config.interceptInternalLinks === !1 || this.currentState !== "connected" || this._sessionId === void 0) {
|
|
8045
8108
|
window.location.assign(n.href);
|
|
8046
8109
|
return;
|
|
@@ -8064,7 +8127,7 @@ var fS = 500, pS = class n {
|
|
|
8064
8127
|
} catch {
|
|
8065
8128
|
return null;
|
|
8066
8129
|
}
|
|
8067
|
-
return n.origin !== window.location.origin || n.protocol !== "http:" && n.protocol !== "https:" || n.hash && n.pathname === window.location.pathname && n.search === window.location.search ||
|
|
8130
|
+
return n.origin !== window.location.origin || n.protocol !== "http:" && n.protocol !== "https:" || n.hash && n.pathname === window.location.pathname && n.search === window.location.search || ih(n.pathname) ? null : n;
|
|
8068
8131
|
}
|
|
8069
8132
|
sendDisconnectSignal() {
|
|
8070
8133
|
if (this._sessionId !== void 0 && this.currentState === "connected") try {
|
|
@@ -8108,7 +8171,7 @@ var fS = 500, pS = class n {
|
|
|
8108
8171
|
$.info(`Verifying link liveness (${e})${t === void 0 ? "" : ` within ${t}ms`}`), this.checkConnectionHealth(), this.protocolWorker && (this.protocolWorker.postMessage({
|
|
8109
8172
|
type: "checkHealth",
|
|
8110
8173
|
maxSilenceMs: t
|
|
8111
|
-
}), setTimeout(() => this.checkConnectionHealth(),
|
|
8174
|
+
}), setTimeout(() => this.checkConnectionHealth(), gS)), this.channelManager?.checkHealth(t);
|
|
8112
8175
|
}
|
|
8113
8176
|
getLivenessBudgetMs() {
|
|
8114
8177
|
return Math.max(wp, Math.floor(this.getServerKeepaliveTimeoutMs() / 3));
|
|
@@ -8158,7 +8221,7 @@ var fS = 500, pS = class n {
|
|
|
8158
8221
|
};
|
|
8159
8222
|
window.addEventListener("resize", t);
|
|
8160
8223
|
let n = window.matchMedia("(prefers-color-scheme: dark)"), r = () => {
|
|
8161
|
-
this.sendUpdateClientContext({ theme:
|
|
8224
|
+
this.sendUpdateClientContext({ theme: ph() });
|
|
8162
8225
|
};
|
|
8163
8226
|
n.addEventListener("change", r), this._environmentTrackingCleanup = () => {
|
|
8164
8227
|
clearTimeout(e), window.removeEventListener("resize", t), n.removeEventListener("change", r);
|
|
@@ -8168,7 +8231,7 @@ var fS = 500, pS = class n {
|
|
|
8168
8231
|
let e = (e) => {
|
|
8169
8232
|
e.source === window.parent && e.data?.type === "IKON_EXTERNAL_CONNECT_URL" && typeof e.data.serverUrl == "string" && ($.info("Received external connect URL from parent window"), this.handleExternalConnectUrl(e.data.serverUrl).catch((e) => {
|
|
8170
8233
|
if (!(e instanceof DOMException && e.name === "AbortError")) {
|
|
8171
|
-
if (this._hasBeenConnected &&
|
|
8234
|
+
if (this._hasBeenConnected && w()) {
|
|
8172
8235
|
$.warn("External connect URL connection failed, scheduling retry:", e), this.scheduleReconnectRetry();
|
|
8173
8236
|
return;
|
|
8174
8237
|
}
|
|
@@ -8180,7 +8243,7 @@ var fS = 500, pS = class n {
|
|
|
8180
8243
|
window.parent.postMessage({
|
|
8181
8244
|
type: "IKON_CLIENT_READY_FOR_CONNECT_URL",
|
|
8182
8245
|
parameters: Cm()
|
|
8183
|
-
},
|
|
8246
|
+
}, Kx()), $.debug("Posted IKON_CLIENT_READY_FOR_CONNECT_URL to parent window");
|
|
8184
8247
|
} catch {}
|
|
8185
8248
|
return () => {
|
|
8186
8249
|
window.removeEventListener("message", e), $.debug("External connect URL listener removed");
|
|
@@ -8190,18 +8253,18 @@ var fS = 500, pS = class n {
|
|
|
8190
8253
|
if (this.currentState !== "waitingForExternalConnectUrl") throw Error(`Cannot connect with external connect URL: already in state ${this.currentState}`);
|
|
8191
8254
|
$.info("Connecting with external connect URL");
|
|
8192
8255
|
try {
|
|
8193
|
-
await this.executeConnection(() =>
|
|
8256
|
+
await this.executeConnection(() => xv(e, this.abortController.signal));
|
|
8194
8257
|
} finally {
|
|
8195
8258
|
this._externalConnectUrlCleanup &&= (this._externalConnectUrlCleanup(), null);
|
|
8196
8259
|
}
|
|
8197
8260
|
}
|
|
8198
8261
|
};
|
|
8199
|
-
function
|
|
8262
|
+
function vS(e) {
|
|
8200
8263
|
return e === i.HttpStream || e === i.HttpStreamProxy;
|
|
8201
8264
|
}
|
|
8202
8265
|
//#endregion
|
|
8203
8266
|
//#region src/app-messaging.ts
|
|
8204
|
-
var
|
|
8267
|
+
var yS = class {
|
|
8205
8268
|
client;
|
|
8206
8269
|
constructor(e) {
|
|
8207
8270
|
this.client = e;
|
|
@@ -8210,54 +8273,54 @@ var hS = class {
|
|
|
8210
8273
|
this.client.sendProtocolMessage(e.toProtocolMessage(t, this.client.sessionId ?? 0));
|
|
8211
8274
|
}
|
|
8212
8275
|
on(e, t) {
|
|
8213
|
-
let n = this.client.createProtocolMessagePort({ opcodeGroupsMask:
|
|
8276
|
+
let n = this.client.createProtocolMessagePort({ opcodeGroupsMask: x.GROUP_APP_LOCAL });
|
|
8214
8277
|
return n ? (n.port.onmessage = async (n) => {
|
|
8215
8278
|
let r = n.data;
|
|
8216
8279
|
if (r?.type !== "protocol" || r.headers?.opcode !== e.opcode) return;
|
|
8217
|
-
let i =
|
|
8280
|
+
let i = b(new Uint8Array(r.message)), a = { viaDataChannel: r.headers.viaDataChannel === !0 };
|
|
8218
8281
|
t(await e.fromProtocolMessage(i), r.headers.senderId, a);
|
|
8219
8282
|
}, { close: () => n.close() }) : { close: () => {} };
|
|
8220
8283
|
}
|
|
8221
8284
|
};
|
|
8222
|
-
function
|
|
8223
|
-
return new
|
|
8285
|
+
function bS(e) {
|
|
8286
|
+
return new yS(e);
|
|
8224
8287
|
}
|
|
8225
8288
|
//#endregion
|
|
8226
8289
|
//#region src/client/connection-state.ts
|
|
8227
|
-
function
|
|
8290
|
+
function xS(e) {
|
|
8228
8291
|
return e === "waitingForExternalConnectUrl" || e === "connecting" || e === "connectingSlow" || e === "reconnecting";
|
|
8229
8292
|
}
|
|
8230
|
-
function
|
|
8293
|
+
function SS(e) {
|
|
8231
8294
|
return e === "connected";
|
|
8232
8295
|
}
|
|
8233
|
-
function
|
|
8296
|
+
function CS(e) {
|
|
8234
8297
|
return e === "offline" || e === "offlineError";
|
|
8235
8298
|
}
|
|
8236
|
-
function
|
|
8299
|
+
function wS(e) {
|
|
8237
8300
|
return e === "offlineError";
|
|
8238
8301
|
}
|
|
8239
8302
|
//#endregion
|
|
8240
8303
|
//#region src/utils/opcode-names.ts
|
|
8241
|
-
var
|
|
8242
|
-
for (let [e, t] of Object.entries(
|
|
8243
|
-
function
|
|
8244
|
-
return
|
|
8304
|
+
var TS = /* @__PURE__ */ new Map();
|
|
8305
|
+
for (let [e, t] of Object.entries(x)) typeof t == "number" && TS.set(t, e);
|
|
8306
|
+
function ES(e) {
|
|
8307
|
+
return TS.get(e) ?? `UNKNOWN_${e}`;
|
|
8245
8308
|
}
|
|
8246
8309
|
//#endregion
|
|
8247
8310
|
//#region src/login/reprovision.ts
|
|
8248
|
-
var
|
|
8249
|
-
function
|
|
8311
|
+
var DS = "ikon-login-app-route";
|
|
8312
|
+
function OS(e) {
|
|
8250
8313
|
if (typeof window > "u") return;
|
|
8251
8314
|
try {
|
|
8252
|
-
sessionStorage.setItem(
|
|
8315
|
+
sessionStorage.setItem(DS, window.location.pathname);
|
|
8253
8316
|
} catch {}
|
|
8254
8317
|
let t = new URL(window.location.href);
|
|
8255
8318
|
t.searchParams.set(nt, e), window.location.href = t.toString();
|
|
8256
8319
|
}
|
|
8257
|
-
function
|
|
8320
|
+
function kS() {
|
|
8258
8321
|
let e = null;
|
|
8259
8322
|
try {
|
|
8260
|
-
e = sessionStorage.getItem(
|
|
8323
|
+
e = sessionStorage.getItem(DS), sessionStorage.removeItem(DS);
|
|
8261
8324
|
} catch {}
|
|
8262
8325
|
return {
|
|
8263
8326
|
appRoute: e,
|
|
@@ -8266,8 +8329,8 @@ function TS() {
|
|
|
8266
8329
|
}
|
|
8267
8330
|
//#endregion
|
|
8268
8331
|
//#region src/consent/consent-api.ts
|
|
8269
|
-
var
|
|
8270
|
-
function
|
|
8332
|
+
var AS = "ikon.platform.consent.list", jS = "ikon.platform.consent.grant", MS = "ikon.platform.consent.revoke", NS = "usage-measurement", PS = "ai-provider-personal-data";
|
|
8333
|
+
function FS(e) {
|
|
8271
8334
|
return {
|
|
8272
8335
|
purpose: e,
|
|
8273
8336
|
state: "not-asked",
|
|
@@ -8275,13 +8338,13 @@ function jS(e) {
|
|
|
8275
8338
|
decidedAt: null
|
|
8276
8339
|
};
|
|
8277
8340
|
}
|
|
8278
|
-
function
|
|
8341
|
+
function IS(e, t) {
|
|
8279
8342
|
return e?.[t]?.granted === !0;
|
|
8280
8343
|
}
|
|
8281
|
-
function
|
|
8282
|
-
return e?.[t] ??
|
|
8344
|
+
function LS(e, t) {
|
|
8345
|
+
return e?.[t] ?? FS(t);
|
|
8283
8346
|
}
|
|
8284
|
-
function
|
|
8347
|
+
function RS(e) {
|
|
8285
8348
|
switch (e) {
|
|
8286
8349
|
case "Granted":
|
|
8287
8350
|
case "granted": return "granted";
|
|
@@ -8290,11 +8353,11 @@ function PS(e) {
|
|
|
8290
8353
|
default: return "not-asked";
|
|
8291
8354
|
}
|
|
8292
8355
|
}
|
|
8293
|
-
function
|
|
8356
|
+
function zS(e) {
|
|
8294
8357
|
if (typeof e != "object" || !e) return null;
|
|
8295
8358
|
let t = e, n = t.purpose ?? t.Purpose;
|
|
8296
8359
|
if (typeof n != "string" || n.length === 0) return null;
|
|
8297
|
-
let r =
|
|
8360
|
+
let r = RS(t.state ?? t.State), i = t.decidedAt ?? t.DecidedAt;
|
|
8298
8361
|
return {
|
|
8299
8362
|
purpose: n,
|
|
8300
8363
|
state: r,
|
|
@@ -8302,44 +8365,44 @@ function FS(e) {
|
|
|
8302
8365
|
decidedAt: typeof i == "string" ? i : null
|
|
8303
8366
|
};
|
|
8304
8367
|
}
|
|
8305
|
-
function
|
|
8368
|
+
function BS(e) {
|
|
8306
8369
|
if (!Array.isArray(e)) return {};
|
|
8307
8370
|
let t = {};
|
|
8308
8371
|
for (let n of e) {
|
|
8309
|
-
let e =
|
|
8372
|
+
let e = zS(n);
|
|
8310
8373
|
e && (t[e.purpose] = e);
|
|
8311
8374
|
}
|
|
8312
8375
|
return t;
|
|
8313
8376
|
}
|
|
8314
|
-
async function
|
|
8315
|
-
return
|
|
8377
|
+
async function VS(e) {
|
|
8378
|
+
return BS(await e.call(AS, []));
|
|
8316
8379
|
}
|
|
8317
|
-
async function
|
|
8318
|
-
let n =
|
|
8380
|
+
async function HS(e, t) {
|
|
8381
|
+
let n = zS(await e.call(jS, [t]));
|
|
8319
8382
|
if (!n) throw Error(`Granting consent for '${t}' returned no record, so nothing was recorded`);
|
|
8320
8383
|
return n;
|
|
8321
8384
|
}
|
|
8322
|
-
async function
|
|
8323
|
-
let n =
|
|
8385
|
+
async function US(e, t) {
|
|
8386
|
+
let n = zS(await e.call(MS, [t]));
|
|
8324
8387
|
if (!n) throw Error(`Withdrawing consent for '${t}' returned no record, so nothing was recorded`);
|
|
8325
8388
|
return n;
|
|
8326
8389
|
}
|
|
8327
8390
|
//#endregion
|
|
8328
8391
|
//#region src/media/media-permission.ts
|
|
8329
|
-
var
|
|
8392
|
+
var WS = {
|
|
8330
8393
|
microphone: "audioinput",
|
|
8331
8394
|
camera: "videoinput"
|
|
8332
8395
|
};
|
|
8333
|
-
function
|
|
8396
|
+
function GS() {
|
|
8334
8397
|
return typeof navigator < "u" && !!navigator.mediaDevices?.getUserMedia;
|
|
8335
8398
|
}
|
|
8336
|
-
async function
|
|
8399
|
+
async function KS(e) {
|
|
8337
8400
|
if (!navigator.mediaDevices?.enumerateDevices) return {
|
|
8338
8401
|
present: !0,
|
|
8339
8402
|
labelled: !1
|
|
8340
8403
|
};
|
|
8341
8404
|
try {
|
|
8342
|
-
let t = (await navigator.mediaDevices.enumerateDevices()).filter((t) => t.kind ===
|
|
8405
|
+
let t = (await navigator.mediaDevices.enumerateDevices()).filter((t) => t.kind === WS[e]);
|
|
8343
8406
|
return {
|
|
8344
8407
|
present: t.length > 0,
|
|
8345
8408
|
labelled: t.some((e) => e.label !== "")
|
|
@@ -8351,9 +8414,9 @@ async function HS(e) {
|
|
|
8351
8414
|
};
|
|
8352
8415
|
}
|
|
8353
8416
|
}
|
|
8354
|
-
async function
|
|
8355
|
-
if (!
|
|
8356
|
-
let t = await
|
|
8417
|
+
async function qS(e) {
|
|
8418
|
+
if (!GS()) return "unavailable";
|
|
8419
|
+
let t = await KS(e);
|
|
8357
8420
|
if (!t.present) return "unavailable";
|
|
8358
8421
|
if (navigator.permissions?.query) try {
|
|
8359
8422
|
let t = await navigator.permissions.query({ name: e });
|
|
@@ -8361,8 +8424,8 @@ async function US(e) {
|
|
|
8361
8424
|
} catch {}
|
|
8362
8425
|
return t.labelled ? "granted" : "prompt";
|
|
8363
8426
|
}
|
|
8364
|
-
async function
|
|
8365
|
-
if (!
|
|
8427
|
+
async function JS(e) {
|
|
8428
|
+
if (!GS()) return "unavailable";
|
|
8366
8429
|
try {
|
|
8367
8430
|
let t = e === "microphone" ? { audio: !0 } : { video: !0 }, n = await navigator.mediaDevices.getUserMedia(t);
|
|
8368
8431
|
for (let e of n.getTracks()) e.stop();
|
|
@@ -8372,10 +8435,10 @@ async function WS(e) {
|
|
|
8372
8435
|
return t === "NotAllowedError" || t === "SecurityError" ? "denied" : t === "NotFoundError" || t === "OverconstrainedError" ? "unavailable" : "prompt";
|
|
8373
8436
|
}
|
|
8374
8437
|
}
|
|
8375
|
-
function
|
|
8376
|
-
if (!
|
|
8438
|
+
function YS(e, t) {
|
|
8439
|
+
if (!GS()) return () => void 0;
|
|
8377
8440
|
let n = !1, r = () => {
|
|
8378
|
-
|
|
8441
|
+
qS(e).then((e) => {
|
|
8379
8442
|
n || t(e);
|
|
8380
8443
|
});
|
|
8381
8444
|
}, i = () => r();
|
|
@@ -8389,4 +8452,4 @@ function GS(e, t) {
|
|
|
8389
8452
|
}
|
|
8390
8453
|
kt(), jt();
|
|
8391
8454
|
//#endregion
|
|
8392
|
-
export {
|
|
8455
|
+
export { Ae as AccessDeniedError, yS as AppMessaging, pt as AppStartupFailedError, ke as AuthRejectedError, T as AuthenticationError, Ue as BrowserNotSupportedError, Vb as CAPTURE_VIEW_FUNCTION_NAME, k as CONNECT_TIER_LADDER, PS as CONSENT_AI_PROVIDER_PERSONAL_DATA, jS as CONSENT_GRANT_FUNCTION_NAME, AS as CONSENT_LIST_FUNCTION_NAME, MS as CONSENT_REVOKE_FUNCTION_NAME, NS as CONSENT_USAGE_MEASUREMENT, g as ClientType, We as ConnectionError, d as ContextType, Ie as CredentialRejectedError, gp as DEFAULT_LOCAL_SERVER_HOST, _p as DEFAULT_LOCAL_SERVER_PORT, vp as DEFAULT_SLOW_CONNECTION_THRESHOLD_MS, Hp as EndpointSelector, i as EntrypointType, bx as FEEDBACK_KINDS, yx as FEEDBACK_OPEN_FUNCTION_NAME, xx as FeedbackRequestError, Vv as FunctionCallError, Gv as FunctionRegistry, sm as IKON_AUTH_BASE_URL, om as IKON_AUTH_URL_DEV, am as IKON_AUTH_URL_PROD, im as IKON_BACKEND_URL_DEV, rm as IKON_BACKEND_URL_PROD, mb as IKON_CAPTURE_EXCLUDE_ATTRIBUTE, Ix as IKON_INSPECT_MODE_CHANGED_EVENT, hb as IKON_INSPECT_OUTLINE_ATTRIBUTE, mt as IKON_PARAM_AUDIO, nt as IKON_PARAM_CONNECT, Ke as IKON_PARAM_DEBUG, ut as IKON_PARAM_DEBUG_OVERLAY, gt as IKON_PARAM_FEEDBACK, Ye as IKON_PARAM_ICE_TRANSPORT, ot as IKON_PARAM_INSPECT, bt as IKON_PARAM_LANG, Ze as IKON_PARAM_OAUTH_CODE, $e as IKON_PARAM_OAUTH_PKCE, ft as IKON_PARAM_OAUTH_PROVIDER, st as IKON_PARAM_OAUTH_TOKEN, tt as IKON_PARAM_PROXY, et as IKON_PARAM_RETRY, Ge as IKON_PARAM_SAME_ORIGIN, xt as IKON_PARAM_SESSION, wt as IKON_PARAM_SIGNED_OUT, Je as IKON_PARAM_SNAPSHOT, Ct as IKON_PARAM_TEST, Re as IKON_PARAM_TRANSPORT, Ce as IKON_PARAM_VIDEO, St as IKON_PARAM_WEBRTC, _S as IkonClient, be as KeepaliveTimeoutError, C as LogLevel, Qe as MaxRetriesExceededError, yt as NoMatchingEndpointTypeError, x as Opcode, lt as ProvisioningTimeoutError, Hb as SET_FEEDBACK_FUNCTION_NAME, $m as SSO_PROVIDER_PREFIX, ht as ServerFullError, rt as ServerUnavailableError, qe as SessionNotFoundError, dt as SpaceNotFoundError, _t as SsoRequiredError, Xe as TransportError, rx as USER_REMOVAL_GRACE_DAYS, X as UploadFailedError, c as UserType, Jf as WEBRTC_AUDIO_BITRATE, qf as WEBRTC_AUDIO_CHANNELS, Gf as WEBRTC_AUDIO_CODEC, Yf as WEBRTC_AUDIO_JITTER_BUFFER_TARGET_MS, Kf as WEBRTC_AUDIO_SAMPLE_RATE, ep as WEBRTC_BUNDLE_POLICY, op as WEBRTC_DATA_CHANNEL_LABEL, cp as WEBRTC_DATA_CHANNEL_MAX_RETRANSMITS, sp as WEBRTC_DATA_CHANNEL_ORDERED, ip as WEBRTC_MAX_AUDIO_TRACKS, ap as WEBRTC_MAX_VIDEO_TRACKS, tp as WEBRTC_RTCP_MUX_POLICY, Xf as WEBRTC_VIDEO_CODEC, Zf as WEBRTC_VIDEO_MAX_BITRATE, Qf as WEBRTC_VIDEO_MAX_FRAMERATE, lp as WebRTCConnection, up as WebRTCSignaling, tm as abortSignalAny, j as abortSignalTimeout, Qm as adoptPkceVerifierFromUrl, bS as appMessaging, b as asProtocolMessage, th as buildOAuthStartUrl, cx as cancelOwnRemoval, Tb as captureViewAtTap, Db as captureViewImage, iS as checkBrowserSupport, q_ as clearDeviceId, ze as clearFeedbackParam, Xg as clearLogBuffer, Yp as clearLoginPrompt, Tx as collectFeedbackContext, LS as consentFor, kS as consumeLoginHandoff, Qp as consumeLoginPendingCall, S as createLogger, Lm as createPkceChallenge, xm as deriveAuthUrl, ym as deriveBackendType, M as deriveBackendUrl, Sm as deriveCrossOriginAuthUrl, Bx as enableInspectMode, J_ as extractUserIdFromToken, Yg as flushLogs, Te as getAudioParam, qg as getBufferedLogs, we as getConnectParam, I_ as getConnectTraceId, ox as getCurrentUser, Pe as getDebugOverlayParam, at as getDebugParam, xe as getFeedbackParam, it as getIceTransportPolicyParam, Me as getInspectParam, Ne as getLangParam, Zg as getLogBufferSize, ae as getLogLevel, re as getLogSink, qp as getLoginPromptState, ES as getOpcodeName, K_ as getOrCreateDeviceId, Fe as getProxyTierParam, Ee as getResumeHandoff, w as getRetryParam, hm as getSameOriginAuthUrl, je as getSameOriginParam, Le as getSessionParam, Tt as getSignedOutParam, Se as getSnapshotParam, Ve as getTestLinkParam, Oe as getTransportParam, jm as getUrlWithoutSession, Be as getVideoParam, He as getWebRtcParam, HS as grantConsent, Nx as initializeDebugMode, Rx as initializeInspectMode, Gg as initializeLogSink, ve as isAudioWorkletSupported, I as isBrowserEnvironment, N as isCloudEnvironment, SS as isConnected, xS as isConnecting, IS as isConsentGranted, Px as isDebugModeEnabled, qm as isEmbedded, wS as isError, zx as isInspectModeEnabled, ty as isMobileBrowserLikely, CS as isOffline, Im as isPkceSupported, pe as isSharedArrayBufferSupported, vt as isWebTransportSupported, ey as loginErrorInterceptor, FS as notAskedConsent, Zm as onEmbeddedOAuthResult, Op as orderConnectTiers, Om as parseUrlParams, qS as queryMediaPermission, V_ as randomUuid, VS as readConsent, y as readOpcode, t as readOpcodeGroup, e as readProtocolMessageHeaders, Fg as registerBrowserFunctions, B_ as reportConnectTimeline, OS as reprovisionAfterLogin, JS as requestMediaPermission, sx as requestOwnRemoval, Rm as restorePkceVerifier, US as revokeConsent, Uy as saveFileFromUrl, Dx as setFeedbackButtonPreference, ne as setLogLevel, ie as setLogSink, Jp as setLoginPromptRequired, De as setSdkUrlParam, Kg as setSendLogsCallback, eh as ssoConnectionOf, Ym as startEmbeddedOAuthSignIn, D_ as startLogSender, A_ as stopLogSender, Ex as submitFeedbackReport, Xp as subscribeLoginPrompt, oe as subscribeToLogEvents, Jg as takeBufferedLogs, zm as takePkceVerifier, rb as uploadFailureFromComplete, ab as uploadFile, YS as watchMediaPermission, Bv as withResultData };
|