@ikonai/sdk-react-ui 1.3.1 → 1.3.2
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/auth/auth-service.d.ts +0 -19
- package/auth/oauth-continuation.d.ts +12 -4
- package/auth/use-auth-guard.d.ts +7 -0
- package/index.js +624 -673
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IkonUiCore as e, LiveSnapshotCache as t, UiStreamStore as n, UiStreamStore as r, isPrerenderVisible as i, prefetchBootSnapshot as a } from "@ikonai/sdk-ui";
|
|
2
|
-
import { AccessDeniedError as o, AppStartupFailedError as s, AuthenticationError as c, IKON_INSPECT_MODE_CHANGED_EVENT as l, IkonClient as u, LogLevel as d, ProvisioningTimeoutError as f, ServerFullError as p, ServerUnavailableError as m, SessionNotFoundError as h, abortSignalTimeout as g, clearLoginPrompt as _, createLogger as v, createPkceChallenge as y, deriveAuthUrl as b, deriveBackendType as x, deriveCrossOriginAuthUrl as S, extractUserIdFromToken as ee, getDebugOverlayParam as te, getLangParam as ne, getLoginPromptState as re, getOrCreateDeviceId as ie, getSameOriginAuthUrl as C, isCloudEnvironment as ae, isDebugModeEnabled as oe,
|
|
3
|
-
import { Fragment as
|
|
4
|
-
import { Fragment as
|
|
2
|
+
import { AccessDeniedError as o, AppStartupFailedError as s, AuthenticationError as c, IKON_INSPECT_MODE_CHANGED_EVENT as l, IkonClient as u, LogLevel as d, ProvisioningTimeoutError as f, ServerFullError as p, ServerUnavailableError as m, SessionNotFoundError as h, abortSignalTimeout as g, clearLoginPrompt as _, createLogger as v, createPkceChallenge as y, deriveAuthUrl as b, deriveBackendType as x, deriveCrossOriginAuthUrl as S, extractUserIdFromToken as ee, getDebugOverlayParam as te, getLangParam as ne, getLoginPromptState as re, getOrCreateDeviceId as ie, getSameOriginAuthUrl as C, isCloudEnvironment as ae, isDebugModeEnabled as oe, isEmbedded as w, isInspectModeEnabled as se, parseUrlParams as ce, randomUuid as T, reportConnectTimeline as le, setLoginPromptRequired as ue, startEmbeddedOAuthSignIn as E, subscribeLoginPrompt as de, subscribeToLogEvents as fe, takePkceVerifier as pe } from "@ikonai/sdk";
|
|
3
|
+
import { Fragment as me, createContext as he, memo as D, use as ge, useCallback as O, useEffect as k, useLayoutEffect as _e, useMemo as A, useReducer as ve, useRef as j, useState as M, useSyncExternalStore as N } from "react";
|
|
4
|
+
import { Fragment as ye, jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
5
5
|
//#region src/renderer/use-root-view.ts
|
|
6
|
-
function
|
|
6
|
+
function be(e, t) {
|
|
7
7
|
let n = N((t) => e.subscribe(t), () => {
|
|
8
8
|
let n = e.getSnapshot(), r = t ?? n.rootViewId, i = r ? n.views.get(r) : void 0;
|
|
9
9
|
return `${r ?? ""}:${i?.id ?? ""}`;
|
|
@@ -31,8 +31,8 @@ function I(e, t) {
|
|
|
31
31
|
}
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/renderer/ui-renderer.tsx
|
|
34
|
-
var
|
|
35
|
-
function
|
|
34
|
+
var xe = v("UIRenderer");
|
|
35
|
+
function Se(e) {
|
|
36
36
|
if (e === void 0) return "{}";
|
|
37
37
|
if (typeof e == "string") return e;
|
|
38
38
|
try {
|
|
@@ -41,28 +41,28 @@ function L(e) {
|
|
|
41
41
|
return "{}";
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function Ce(e) {
|
|
45
45
|
let t = e.styleIds;
|
|
46
46
|
return Array.isArray(t) ? t : [];
|
|
47
47
|
}
|
|
48
|
-
var
|
|
49
|
-
function
|
|
48
|
+
var we = 1500;
|
|
49
|
+
function Te(e) {
|
|
50
50
|
let [t, n] = M(0);
|
|
51
51
|
return k(() => {
|
|
52
52
|
if (e.subscribe) return e.subscribe(() => n((e) => e + 1));
|
|
53
53
|
}, [e]), t;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
let [i, a] = M(!1), o = I(n.store, t), s =
|
|
55
|
+
function Ee({ nodeType: e, nodeId: t, context: n, className: r }) {
|
|
56
|
+
let [i, a] = M(!1), o = I(n.store, t), s = Te(n.library), c = A(() => o ? n.library.resolve(o) : void 0, [
|
|
57
57
|
n.library,
|
|
58
58
|
o,
|
|
59
59
|
s
|
|
60
60
|
]);
|
|
61
61
|
return k(() => {
|
|
62
|
-
let e = setTimeout(() => a(!0),
|
|
62
|
+
let e = setTimeout(() => a(!0), we);
|
|
63
63
|
return () => clearTimeout(e);
|
|
64
64
|
}, [e]), k(() => {
|
|
65
|
-
!i || c ||
|
|
65
|
+
!i || c || xe.error(`No React resolver is registered for node type '${e}', so it renders as an error placeholder instead of the component you expected. A custom node needs all four parts: (1) the React component, (2) a resolver that matches '${e}', (3) a registerModule(...) call for it in app.tsx, and (4) the C# view.AddNode("${e}", ...) extension. Prefer native view.* components where they fit.`);
|
|
66
66
|
}, [
|
|
67
67
|
i,
|
|
68
68
|
c,
|
|
@@ -87,50 +87,50 @@ function Ce({ nodeType: e, nodeId: t, context: n, className: r }) {
|
|
|
87
87
|
children: `Unregistered node type: ${e}\nNo React resolver is registered for it — register the component's module in app.tsx (see the console for details).`
|
|
88
88
|
}) : null;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function De(e) {
|
|
91
91
|
let t = e.children;
|
|
92
92
|
return Array.isArray(t) ? t : [];
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function Oe(e, t) {
|
|
95
95
|
return e.nodeId === t.nodeId && e.context === t.context;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function ke(e) {
|
|
98
98
|
if (e.length === 0) return "";
|
|
99
99
|
if (e.length === 1) return e[0].id;
|
|
100
100
|
let t = e[0].id;
|
|
101
101
|
for (let n = 1; n < e.length; n++) t += "," + e[n].id;
|
|
102
102
|
return t;
|
|
103
103
|
}
|
|
104
|
-
var
|
|
105
|
-
let r = I(n.store, t), i = r ?
|
|
104
|
+
var Ae = D(function e({ nodeId: t, context: n }) {
|
|
105
|
+
let r = I(n.store, t), i = r ? De(r) : [], a = ke(i), o = A(() => i.length === 0 ? null : i.map((t) => /* @__PURE__ */ P(e, {
|
|
106
106
|
nodeId: t.id,
|
|
107
107
|
context: n
|
|
108
108
|
}, t.id)), [a, n]);
|
|
109
109
|
if (!r) return null;
|
|
110
|
-
if (r.type === "root") return /* @__PURE__ */ P(
|
|
111
|
-
let s =
|
|
110
|
+
if (r.type === "root") return /* @__PURE__ */ P(me, { children: o }, r.id);
|
|
111
|
+
let s = Ce(r), c = s.length > 0 ? s.join(" ") : void 0, l = n.library.resolve(r);
|
|
112
112
|
return l ? /* @__PURE__ */ P(l, {
|
|
113
113
|
nodeId: t,
|
|
114
114
|
context: n,
|
|
115
115
|
className: c
|
|
116
|
-
}) : /* @__PURE__ */ P(
|
|
116
|
+
}) : /* @__PURE__ */ P(Ee, {
|
|
117
117
|
nodeType: r.type,
|
|
118
118
|
nodeId: r.id,
|
|
119
119
|
context: n,
|
|
120
120
|
className: c
|
|
121
121
|
});
|
|
122
|
-
},
|
|
123
|
-
function
|
|
124
|
-
return !Array.isArray(e) || e.length === 0 ? null : e.map((e) => /* @__PURE__ */ P(
|
|
122
|
+
}, Oe);
|
|
123
|
+
function je(e, t) {
|
|
124
|
+
return !Array.isArray(e) || e.length === 0 ? null : e.map((e) => /* @__PURE__ */ P(Ae, {
|
|
125
125
|
nodeId: e.id,
|
|
126
126
|
context: t
|
|
127
127
|
}, e.id));
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function Me(e, t) {
|
|
130
130
|
return e.store === t.store && e.library === t.library && e.viewId === t.viewId && e.emptyFallback === t.emptyFallback;
|
|
131
131
|
}
|
|
132
|
-
var
|
|
133
|
-
let { rootViewId: s, rootNodeId: c } =
|
|
132
|
+
var Ne = D(function({ store: e, library: t, viewId: n, emptyFallback: r = null, onAction: i, client: a, video: o }) {
|
|
133
|
+
let { rootViewId: s, rootNodeId: c } = be(e, n), l = j(i);
|
|
134
134
|
l.current = i;
|
|
135
135
|
let u = j(a);
|
|
136
136
|
u.current = a;
|
|
@@ -138,7 +138,7 @@ var Ae = D(function({ store: e, library: t, viewId: n, emptyFallback: r = null,
|
|
|
138
138
|
d.current = o;
|
|
139
139
|
let f = O((e, t) => {
|
|
140
140
|
if (!e) return;
|
|
141
|
-
let n =
|
|
141
|
+
let n = Se(t);
|
|
142
142
|
l.current?.(e, n);
|
|
143
143
|
}, []), p = A(() => {
|
|
144
144
|
let n = {
|
|
@@ -146,10 +146,10 @@ var Ae = D(function({ store: e, library: t, viewId: n, emptyFallback: r = null,
|
|
|
146
146
|
library: t,
|
|
147
147
|
handlerCache: e.handlerCache,
|
|
148
148
|
getPayload: (t) => e.getSnapshot().payloads.get(t),
|
|
149
|
-
renderChildren: (e) =>
|
|
149
|
+
renderChildren: (e) => je(e, n),
|
|
150
150
|
renderView: (t) => {
|
|
151
151
|
let r = e.getSnapshot().views.get(t);
|
|
152
|
-
return r ? /* @__PURE__ */ P(
|
|
152
|
+
return r ? /* @__PURE__ */ P(Ae, {
|
|
153
153
|
nodeId: r.id,
|
|
154
154
|
context: n
|
|
155
155
|
}) : null;
|
|
@@ -171,12 +171,12 @@ var Ae = D(function({ store: e, library: t, viewId: n, emptyFallback: r = null,
|
|
|
171
171
|
return !s || !c ? r : /* @__PURE__ */ P("div", {
|
|
172
172
|
"data-ikon-view-id": s,
|
|
173
173
|
style: { display: "contents" },
|
|
174
|
-
children: /* @__PURE__ */ P(
|
|
174
|
+
children: /* @__PURE__ */ P(Ae, {
|
|
175
175
|
nodeId: c,
|
|
176
176
|
context: p
|
|
177
177
|
})
|
|
178
178
|
});
|
|
179
|
-
},
|
|
179
|
+
}, Me), Pe = class {
|
|
180
180
|
fallback;
|
|
181
181
|
renderers = /* @__PURE__ */ new Map();
|
|
182
182
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -201,22 +201,22 @@ var Ae = D(function({ store: e, library: t, viewId: n, emptyFallback: r = null,
|
|
|
201
201
|
for (let e of this.listeners) e();
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
|
-
function
|
|
205
|
-
return new
|
|
204
|
+
function Fe(e, t) {
|
|
205
|
+
return new Pe(Object.entries(e), t);
|
|
206
206
|
}
|
|
207
207
|
//#endregion
|
|
208
208
|
//#region src/renderer/use-ui-store.ts
|
|
209
|
-
function
|
|
209
|
+
function Ie(e) {
|
|
210
210
|
return N((t) => e.subscribe(t), () => e.getSnapshot(), () => e.getSnapshot());
|
|
211
211
|
}
|
|
212
212
|
//#endregion
|
|
213
213
|
//#region src/inspect/inspect-overlay.tsx
|
|
214
|
-
function
|
|
215
|
-
let [e, t] = M(
|
|
214
|
+
function Le() {
|
|
215
|
+
let [e, t] = M(se), n = j(!1);
|
|
216
216
|
return k(() => {
|
|
217
217
|
if (e) return;
|
|
218
218
|
let r = () => {
|
|
219
|
-
|
|
219
|
+
se() && t(!0);
|
|
220
220
|
}, i = (e) => {
|
|
221
221
|
e.data?.type === "ikon-inspect-mode" && e.data.enabled && (n.current = !0, t(!0));
|
|
222
222
|
};
|
|
@@ -351,11 +351,11 @@ function Pe() {
|
|
|
351
351
|
}
|
|
352
352
|
//#endregion
|
|
353
353
|
//#region src/surface.tsx
|
|
354
|
-
var
|
|
355
|
-
function
|
|
354
|
+
var L = v("IkonUiSurface"), Re = "ikon-ui";
|
|
355
|
+
function ze(e, t) {
|
|
356
356
|
return e === t;
|
|
357
357
|
}
|
|
358
|
-
var
|
|
358
|
+
var Be = D(function({ stores: e, registry: t, category: n = Re, onAction: r, client: i }) {
|
|
359
359
|
let a = A(() => Array.from(e.keys()).sort().join(","), [e]), o = j(r);
|
|
360
360
|
o.current = r;
|
|
361
361
|
let s = j(i);
|
|
@@ -364,7 +364,7 @@ var Le = D(function({ stores: e, registry: t, category: n = Ie, onAction: r, cli
|
|
|
364
364
|
let t = [];
|
|
365
365
|
for (let [r, i] of e) {
|
|
366
366
|
let e = i.store.getSnapshot();
|
|
367
|
-
|
|
367
|
+
ze(i.category, n) && (!e.rootViewId || !e.views.has(e.rootViewId) || t.push({
|
|
368
368
|
key: r,
|
|
369
369
|
store: i.store
|
|
370
370
|
}));
|
|
@@ -376,15 +376,15 @@ var Le = D(function({ stores: e, registry: t, category: n = Ie, onAction: r, cli
|
|
|
376
376
|
a
|
|
377
377
|
]), l = j(!1), u = c.length > 0;
|
|
378
378
|
return k(() => {
|
|
379
|
-
u && !l.current && (l.current = !0,
|
|
380
|
-
}, [u]), u ? /* @__PURE__ */ F(
|
|
379
|
+
u && !l.current && (l.current = !0, L.debug("First UI render"));
|
|
380
|
+
}, [u]), u ? /* @__PURE__ */ F(ye, { children: [/* @__PURE__ */ P(Le, {}), c.map(({ key: e, store: n }) => /* @__PURE__ */ P(Ne, {
|
|
381
381
|
store: n,
|
|
382
382
|
library: t,
|
|
383
383
|
onAction: o.current,
|
|
384
384
|
client: s.current,
|
|
385
385
|
video: s.current?.media?.video
|
|
386
386
|
}, e))] }) : null;
|
|
387
|
-
}),
|
|
387
|
+
}), Ve = class {
|
|
388
388
|
core;
|
|
389
389
|
ownsCore;
|
|
390
390
|
stores = /* @__PURE__ */ new Map();
|
|
@@ -456,7 +456,7 @@ var Le = D(function({ stores: e, registry: t, category: n = Ie, onAction: r, cli
|
|
|
456
456
|
let t = this.stores.get(e);
|
|
457
457
|
if (t) return t;
|
|
458
458
|
let n = {
|
|
459
|
-
category:
|
|
459
|
+
category: Re,
|
|
460
460
|
store: new r()
|
|
461
461
|
};
|
|
462
462
|
return this.stores.set(e, n), n;
|
|
@@ -476,13 +476,13 @@ var Le = D(function({ stores: e, registry: t, category: n = Ie, onAction: r, cli
|
|
|
476
476
|
};
|
|
477
477
|
//#endregion
|
|
478
478
|
//#region src/base/base-div.tsx
|
|
479
|
-
function
|
|
479
|
+
function He(e) {
|
|
480
480
|
if (typeof e == "string") {
|
|
481
481
|
let t = e.trim();
|
|
482
482
|
return t.length > 0 ? t : void 0;
|
|
483
483
|
}
|
|
484
484
|
}
|
|
485
|
-
function
|
|
485
|
+
function R(e) {
|
|
486
486
|
if (typeof e == "string") {
|
|
487
487
|
let t = e.trim();
|
|
488
488
|
return t.length > 0 ? t : void 0;
|
|
@@ -492,7 +492,7 @@ function z(e) {
|
|
|
492
492
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function Ue(...e) {
|
|
496
496
|
let t = "";
|
|
497
497
|
for (let n of e) if (n) {
|
|
498
498
|
let e = n.trim();
|
|
@@ -500,8 +500,8 @@ function Be(...e) {
|
|
|
500
500
|
}
|
|
501
501
|
return t || void 0;
|
|
502
502
|
}
|
|
503
|
-
var
|
|
504
|
-
function
|
|
503
|
+
var z = /* @__PURE__ */ new WeakMap(), We = {};
|
|
504
|
+
function B(e) {
|
|
505
505
|
let t = {};
|
|
506
506
|
for (let n of e.split(";")) {
|
|
507
507
|
let e = n.indexOf(":");
|
|
@@ -513,28 +513,28 @@ function Ue(e) {
|
|
|
513
513
|
}
|
|
514
514
|
return t;
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function Ge(e, t) {
|
|
517
517
|
let n = e && typeof e == "object" ? e : void 0;
|
|
518
518
|
return t ? {
|
|
519
519
|
...n ?? {},
|
|
520
520
|
cursor: t
|
|
521
521
|
} : n;
|
|
522
522
|
}
|
|
523
|
-
function
|
|
524
|
-
if (!e) return
|
|
525
|
-
let t =
|
|
523
|
+
function Ke(e) {
|
|
524
|
+
if (!e) return We;
|
|
525
|
+
let t = z.get(e);
|
|
526
526
|
if (t) return t;
|
|
527
527
|
let n = {};
|
|
528
528
|
for (let [t, r] of Object.entries(e)) if (r != null) {
|
|
529
529
|
if (t === "style" && typeof r == "string") {
|
|
530
|
-
n[t] =
|
|
530
|
+
n[t] = B(r);
|
|
531
531
|
continue;
|
|
532
532
|
}
|
|
533
533
|
(typeof r == "string" || typeof r == "number" || typeof r == "boolean") && (n[t] = r);
|
|
534
534
|
}
|
|
535
|
-
return
|
|
535
|
+
return z.set(e, n), n;
|
|
536
536
|
}
|
|
537
|
-
function
|
|
537
|
+
function V(e) {
|
|
538
538
|
let t = e.parentElement;
|
|
539
539
|
for (; t;) {
|
|
540
540
|
let e = window.getComputedStyle(t).overflowY;
|
|
@@ -543,34 +543,34 @@ function Ge(e) {
|
|
|
543
543
|
}
|
|
544
544
|
return null;
|
|
545
545
|
}
|
|
546
|
-
var
|
|
547
|
-
function
|
|
546
|
+
var H = 1.5;
|
|
547
|
+
function qe(e, t) {
|
|
548
548
|
requestAnimationFrame(() => {
|
|
549
|
-
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = e.scrollTop + (r.bottom - n.bottom) + 16, a = Math.abs(i - e.scrollTop) > e.clientHeight *
|
|
549
|
+
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = e.scrollTop + (r.bottom - n.bottom) + 16, a = Math.abs(i - e.scrollTop) > e.clientHeight * H ? "auto" : "smooth";
|
|
550
550
|
"scrollBehavior" in document.documentElement.style ? e.scrollTo({
|
|
551
551
|
top: i,
|
|
552
552
|
behavior: a
|
|
553
553
|
}) : e.scrollTop = i;
|
|
554
554
|
});
|
|
555
555
|
}
|
|
556
|
-
var
|
|
557
|
-
function Je(e) {
|
|
558
|
-
return Math.max(e.clientHeight * qe, 20);
|
|
559
|
-
}
|
|
556
|
+
var U = "data-ikon-scroll-indicator", Je = .15, W = "data-ikon-at-bottom";
|
|
560
557
|
function Ye(e) {
|
|
561
|
-
return e.
|
|
558
|
+
return Math.max(e.clientHeight * Je, 20);
|
|
562
559
|
}
|
|
563
560
|
function Xe(e) {
|
|
564
|
-
e.getAttribute(
|
|
565
|
-
let { scrollTop: t, scrollHeight: n, clientHeight: r } = e, i = n - t - r <= Je(e);
|
|
566
|
-
e.setAttribute(U, i ? "true" : "false");
|
|
567
|
-
}, { passive: !0 }));
|
|
561
|
+
return e.getAttribute(W) !== "false";
|
|
568
562
|
}
|
|
569
563
|
function Ze(e) {
|
|
570
|
-
|
|
564
|
+
e.getAttribute(W) === null && (e.setAttribute(W, "true"), e.addEventListener("scroll", () => {
|
|
565
|
+
let { scrollTop: t, scrollHeight: n, clientHeight: r } = e, i = n - t - r <= Ye(e);
|
|
566
|
+
e.setAttribute(W, i ? "true" : "false");
|
|
567
|
+
}, { passive: !0 }));
|
|
568
|
+
}
|
|
569
|
+
function Qe(e) {
|
|
570
|
+
let t = e.parentElement ?? e, n = t.querySelector(`[${U}]`);
|
|
571
571
|
if (n) return n;
|
|
572
572
|
let r = document.createElement("button");
|
|
573
|
-
return r.setAttribute(
|
|
573
|
+
return r.setAttribute(U, "true"), r.setAttribute("aria-label", "Scroll to latest"), r.textContent = "↓", Object.assign(r.style, {
|
|
574
574
|
position: "absolute",
|
|
575
575
|
bottom: "12px",
|
|
576
576
|
left: "50%",
|
|
@@ -598,36 +598,36 @@ function Ze(e) {
|
|
|
598
598
|
r.style.opacity = "0.9";
|
|
599
599
|
}), t.appendChild(r), r;
|
|
600
600
|
}
|
|
601
|
-
function
|
|
602
|
-
let n =
|
|
601
|
+
function $e(e, t) {
|
|
602
|
+
let n = Qe(e);
|
|
603
603
|
n.style.display = "flex";
|
|
604
604
|
let r = () => {
|
|
605
|
-
|
|
605
|
+
qe(e, t), n.style.display = "none";
|
|
606
606
|
}, i = () => {
|
|
607
607
|
let { scrollTop: t, scrollHeight: r, clientHeight: i } = e;
|
|
608
|
-
r - t - i <=
|
|
608
|
+
r - t - i <= Ye(e) && (n.style.display = "none");
|
|
609
609
|
};
|
|
610
610
|
return n.addEventListener("click", r), e.addEventListener("scroll", i, { passive: !0 }), () => {
|
|
611
611
|
n.removeEventListener("click", r), e.removeEventListener("scroll", i);
|
|
612
612
|
};
|
|
613
613
|
}
|
|
614
|
-
function
|
|
614
|
+
function et() {
|
|
615
615
|
let e = D(function({ nodeId: e, context: t }) {
|
|
616
|
-
let n = I(t.store, e), r = j(null), i =
|
|
616
|
+
let n = I(t.store, e), r = j(null), i = R(n?.props?.targetViewId), a = n?.props?.focusOnly, o = typeof a == "boolean" ? a : void 0, s = R(n?.props?.priority), c = R(n?.props?.key), l = n?.props?.preciseGeneratedAt;
|
|
617
617
|
return k(() => {
|
|
618
618
|
if (typeof document > "u") return;
|
|
619
619
|
let e = r.current;
|
|
620
620
|
if (!e || i && e.closest("[data-ikon-view-id]")?.getAttribute("data-ikon-view-id") !== i) return;
|
|
621
621
|
let t;
|
|
622
622
|
if (o !== !0) {
|
|
623
|
-
let n =
|
|
624
|
-
if (n) if (
|
|
623
|
+
let n = V(e);
|
|
624
|
+
if (n) if (Ze(n), s === "Polite" && !Xe(n)) t = $e(n, e);
|
|
625
625
|
else {
|
|
626
|
-
let t = (n.parentElement ?? n).querySelector(`[${
|
|
627
|
-
t && (t.style.display = "none"),
|
|
626
|
+
let t = (n.parentElement ?? n).querySelector(`[${U}]`);
|
|
627
|
+
t && (t.style.display = "none"), qe(n, e);
|
|
628
628
|
}
|
|
629
629
|
else typeof e.scrollIntoView == "function" && requestAnimationFrame(() => {
|
|
630
|
-
let t = e.getBoundingClientRect().top, n = typeof window < "u" ? window.innerHeight : 0, r = Math.abs(t) > n *
|
|
630
|
+
let t = e.getBoundingClientRect().top, n = typeof window < "u" ? window.innerHeight : 0, r = Math.abs(t) > n * H ? "auto" : "smooth";
|
|
631
631
|
try {
|
|
632
632
|
e.scrollIntoView({
|
|
633
633
|
behavior: r,
|
|
@@ -670,15 +670,15 @@ function $e() {
|
|
|
670
670
|
if (t === "std.focus-hint") return e;
|
|
671
671
|
};
|
|
672
672
|
}
|
|
673
|
-
function
|
|
673
|
+
function tt() {
|
|
674
674
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
675
|
-
let r = I(t.store, e), i =
|
|
675
|
+
let r = I(t.store, e), i = He(r?.props?.onInvokeId), a = O(() => {
|
|
676
676
|
i && t.dispatchAction(i);
|
|
677
677
|
}, [i, t]);
|
|
678
678
|
if (!r) return null;
|
|
679
|
-
let o =
|
|
679
|
+
let o = Ke(r.props);
|
|
680
680
|
delete o.onInvokeId;
|
|
681
|
-
let s =
|
|
681
|
+
let s = Ue(R(r.props?.className), n), c = r.children?.length ? t.renderChildren(r.children) : void 0;
|
|
682
682
|
return /* @__PURE__ */ P("div", {
|
|
683
683
|
...o,
|
|
684
684
|
"data-ikon-node-id": r.id,
|
|
@@ -690,7 +690,7 @@ function et() {
|
|
|
690
690
|
onKeyDown: i ? (e) => {
|
|
691
691
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), a());
|
|
692
692
|
} : void 0,
|
|
693
|
-
style:
|
|
693
|
+
style: Ge(o.style, i ? "pointer" : void 0),
|
|
694
694
|
children: c
|
|
695
695
|
});
|
|
696
696
|
});
|
|
@@ -698,11 +698,11 @@ function et() {
|
|
|
698
698
|
if (t === "std.div") return e;
|
|
699
699
|
};
|
|
700
700
|
}
|
|
701
|
-
function
|
|
701
|
+
function nt() {
|
|
702
702
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
703
703
|
let r = I(t.store, e);
|
|
704
704
|
if (!r) return null;
|
|
705
|
-
let i =
|
|
705
|
+
let i = Ke(r.props), a = Ue("relative", R(r.props?.className), n), o = r.children?.length ? t.renderChildren(r.children) : void 0;
|
|
706
706
|
return /* @__PURE__ */ P("div", {
|
|
707
707
|
...i,
|
|
708
708
|
"data-ikon-node-id": r.id,
|
|
@@ -715,11 +715,11 @@ function tt() {
|
|
|
715
715
|
if (t === "std.stack") return e;
|
|
716
716
|
};
|
|
717
717
|
}
|
|
718
|
-
function
|
|
718
|
+
function rt() {
|
|
719
719
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
720
720
|
let r = I(t.store, e);
|
|
721
721
|
if (!r) return null;
|
|
722
|
-
let i =
|
|
722
|
+
let i = Ke(r.props), a = Ue("absolute", R(r.props?.className), n), o = r.children?.length ? t.renderChildren(r.children) : void 0;
|
|
723
723
|
return /* @__PURE__ */ P("div", {
|
|
724
724
|
...i,
|
|
725
725
|
"data-ikon-node-id": r.id,
|
|
@@ -732,23 +732,23 @@ function nt() {
|
|
|
732
732
|
if (t === "std.layer") return e;
|
|
733
733
|
};
|
|
734
734
|
}
|
|
735
|
-
function
|
|
735
|
+
function it() {
|
|
736
736
|
return [
|
|
737
|
-
et(),
|
|
738
737
|
tt(),
|
|
739
738
|
nt(),
|
|
740
|
-
|
|
739
|
+
rt(),
|
|
740
|
+
et()
|
|
741
741
|
];
|
|
742
742
|
}
|
|
743
743
|
//#endregion
|
|
744
744
|
//#region src/base/base-module.ts
|
|
745
|
-
var
|
|
746
|
-
function
|
|
747
|
-
e.registerModule(
|
|
745
|
+
var at = "base", ot = async () => it();
|
|
746
|
+
function st(e) {
|
|
747
|
+
e.registerModule(at, ot);
|
|
748
748
|
}
|
|
749
749
|
//#endregion
|
|
750
750
|
//#region src/media/audio-player.tsx
|
|
751
|
-
function
|
|
751
|
+
function ct(e) {
|
|
752
752
|
if (typeof e == "string") {
|
|
753
753
|
let t = e.trim();
|
|
754
754
|
return t.length > 0 ? t : void 0;
|
|
@@ -758,17 +758,17 @@ function st(e) {
|
|
|
758
758
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
759
759
|
}
|
|
760
760
|
}
|
|
761
|
-
function
|
|
761
|
+
function lt(...e) {
|
|
762
762
|
let t = [];
|
|
763
763
|
for (let n of e) n && n.trim() && t.push(n.trim());
|
|
764
764
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
765
765
|
}
|
|
766
|
-
function
|
|
766
|
+
function ut(e) {
|
|
767
767
|
if (typeof e != "string") return;
|
|
768
768
|
let t = e.trim();
|
|
769
769
|
return t.length > 0 ? t : void 0;
|
|
770
770
|
}
|
|
771
|
-
function
|
|
771
|
+
function dt(e) {
|
|
772
772
|
if (typeof e == "boolean") return e;
|
|
773
773
|
if (typeof e == "string") {
|
|
774
774
|
let t = e.trim().toLowerCase();
|
|
@@ -776,13 +776,13 @@ function ut(e) {
|
|
|
776
776
|
if (t === "false") return !1;
|
|
777
777
|
}
|
|
778
778
|
}
|
|
779
|
-
function
|
|
779
|
+
function ft() {
|
|
780
780
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
781
|
-
let r = I(t.store, e), i = j(null), a = r ?
|
|
781
|
+
let r = I(t.store, e), i = j(null), a = r ? dt(r.props?.autoplay) : void 0, o = r ? ut(r.props?.src) : void 0;
|
|
782
782
|
if (k(() => {
|
|
783
783
|
a && i.current && i.current.play().catch(() => {});
|
|
784
784
|
}, [a, o]), !r) return null;
|
|
785
|
-
let s = ct(
|
|
785
|
+
let s = lt(ct(r.props?.className), n), c = ut(r.props?.preload), l = dt(r.props?.controls), u = dt(r.props?.loop), d = dt(r.props?.muted);
|
|
786
786
|
return /* @__PURE__ */ P("audio", {
|
|
787
787
|
ref: i,
|
|
788
788
|
src: o,
|
|
@@ -802,7 +802,7 @@ function dt() {
|
|
|
802
802
|
}
|
|
803
803
|
//#endregion
|
|
804
804
|
//#region src/media/video-canvas.tsx
|
|
805
|
-
function
|
|
805
|
+
function pt(e) {
|
|
806
806
|
if (typeof e == "string") {
|
|
807
807
|
let t = e.trim();
|
|
808
808
|
return t.length > 0 ? t : void 0;
|
|
@@ -812,27 +812,27 @@ function ft(e) {
|
|
|
812
812
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
813
813
|
}
|
|
814
814
|
}
|
|
815
|
-
function
|
|
815
|
+
function mt(...e) {
|
|
816
816
|
let t = [];
|
|
817
817
|
for (let n of e) n && n.trim() && t.push(n.trim());
|
|
818
818
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
819
819
|
}
|
|
820
|
-
function
|
|
820
|
+
function ht(e) {
|
|
821
821
|
if (typeof e == "number" && Number.isFinite(e)) return Math.floor(e);
|
|
822
822
|
if (typeof e == "string" && e.trim().length > 0) {
|
|
823
823
|
let t = Number(e);
|
|
824
824
|
if (Number.isFinite(t)) return Math.floor(t);
|
|
825
825
|
}
|
|
826
826
|
}
|
|
827
|
-
function
|
|
827
|
+
function gt(e) {
|
|
828
828
|
if (typeof e != "string") return;
|
|
829
829
|
let t = e.trim();
|
|
830
830
|
return t.length > 0 ? t : void 0;
|
|
831
831
|
}
|
|
832
|
-
var
|
|
833
|
-
function
|
|
832
|
+
var _t = v("IkonVideoCanvas"), vt = 100, yt = 50, bt = "std.video-canvas", xt = "std.video-url-player";
|
|
833
|
+
function St() {
|
|
834
834
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
835
|
-
let r = I(t.store, e), i = j(null), a = j(null), o = t.client, s = r ?
|
|
835
|
+
let r = I(t.store, e), i = j(null), a = j(null), o = t.client, s = r ? gt(r.props?.streamId) : void 0, c = r ? ht(r.props?.width) : void 0, l = r ? ht(r.props?.height) : void 0, u = r ? mt(pt(r.props?.className), n) : n, [, d] = M(0);
|
|
836
836
|
k(() => {
|
|
837
837
|
if (!o?.isWebRtcEnabled) return;
|
|
838
838
|
let e = o.onWebRtcTrackMapChanged;
|
|
@@ -850,15 +850,15 @@ function xt() {
|
|
|
850
850
|
if (n) return;
|
|
851
851
|
let i = t.video ?? t.client?.media?.video;
|
|
852
852
|
if (!i) {
|
|
853
|
-
if (a++ >=
|
|
854
|
-
|
|
853
|
+
if (a++ >= yt) {
|
|
854
|
+
_t.warn(`Gave up attaching the canvas for stream ${s}: video playback never became available`);
|
|
855
855
|
return;
|
|
856
856
|
}
|
|
857
|
-
r = setTimeout(o,
|
|
857
|
+
r = setTimeout(o, vt);
|
|
858
858
|
return;
|
|
859
859
|
}
|
|
860
860
|
i.attachCanvas(s, e).catch((e) => {
|
|
861
|
-
|
|
861
|
+
_t.error(`Failed to attach the canvas for stream ${s}, it will stay blank: ${String(e)}`);
|
|
862
862
|
});
|
|
863
863
|
};
|
|
864
864
|
return o(), () => {
|
|
@@ -898,14 +898,14 @@ function xt() {
|
|
|
898
898
|
if (t === "std.video-canvas") return e;
|
|
899
899
|
};
|
|
900
900
|
}
|
|
901
|
-
function
|
|
901
|
+
function Ct() {
|
|
902
902
|
return [
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
903
|
+
St(),
|
|
904
|
+
Tt(),
|
|
905
|
+
ft()
|
|
906
906
|
];
|
|
907
907
|
}
|
|
908
|
-
function
|
|
908
|
+
function wt(e) {
|
|
909
909
|
if (typeof e == "boolean") return e;
|
|
910
910
|
if (typeof e == "string") {
|
|
911
911
|
let t = e.trim().toLowerCase();
|
|
@@ -913,13 +913,13 @@ function Ct(e) {
|
|
|
913
913
|
if (t === "false") return !1;
|
|
914
914
|
}
|
|
915
915
|
}
|
|
916
|
-
function
|
|
916
|
+
function Tt() {
|
|
917
917
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
918
|
-
let r = I(t.store, e), i = j(null), a = r ?
|
|
918
|
+
let r = I(t.store, e), i = j(null), a = r ? wt(r.props?.autoplay) : void 0, o = r ? gt(r.props?.src) : void 0;
|
|
919
919
|
if (k(() => {
|
|
920
920
|
a && i.current && i.current.play().catch(() => {});
|
|
921
921
|
}, [a, o]), !r) return null;
|
|
922
|
-
let s = pt(
|
|
922
|
+
let s = mt(pt(r.props?.className), n), c = gt(r.props?.poster), l = wt(r.props?.controls), u = wt(r.props?.loop), d = wt(r.props?.muted), f = wt(r.props?.playsInline), p = ht(r.props?.width), m = ht(r.props?.height), h = r.children?.length ? t.renderChildren(r.children) : void 0;
|
|
923
923
|
return /* @__PURE__ */ P("video", {
|
|
924
924
|
ref: i,
|
|
925
925
|
src: o,
|
|
@@ -943,20 +943,20 @@ function wt() {
|
|
|
943
943
|
}
|
|
944
944
|
//#endregion
|
|
945
945
|
//#region src/media/media-module.ts
|
|
946
|
-
var
|
|
947
|
-
function
|
|
948
|
-
e.registerModule(
|
|
946
|
+
var Et = "media", Dt = async () => Ct();
|
|
947
|
+
function Ot(e) {
|
|
948
|
+
e.registerModule(Et, Dt);
|
|
949
949
|
}
|
|
950
950
|
//#endregion
|
|
951
951
|
//#region src/shadertoy/shadertoy-gl.ts
|
|
952
|
-
var
|
|
953
|
-
function
|
|
952
|
+
var kt = "#version 300 es\nin vec4 a_position;\nvoid main() {\n gl_Position = a_position;\n}\n", At = 4;
|
|
953
|
+
function jt(e, t) {
|
|
954
954
|
return RegExp(`\\buniform\\s+\\w+\\s+${t}\\s*;`, "g").test(e);
|
|
955
955
|
}
|
|
956
|
-
function
|
|
956
|
+
function Mt(e, t) {
|
|
957
957
|
let n = [];
|
|
958
958
|
for (let [r, i] of Object.entries(t)) {
|
|
959
|
-
if (
|
|
959
|
+
if (jt(e, r)) continue;
|
|
960
960
|
let t;
|
|
961
961
|
switch (i.type) {
|
|
962
962
|
case "float":
|
|
@@ -1014,7 +1014,7 @@ void main() {
|
|
|
1014
1014
|
}
|
|
1015
1015
|
`;
|
|
1016
1016
|
}
|
|
1017
|
-
var
|
|
1017
|
+
var Nt = class {
|
|
1018
1018
|
gl;
|
|
1019
1019
|
program = null;
|
|
1020
1020
|
positionBuffer = null;
|
|
@@ -1030,7 +1030,7 @@ var Mt = class {
|
|
|
1030
1030
|
mouseClickY = 0;
|
|
1031
1031
|
channels = [];
|
|
1032
1032
|
channelResolution = /* @__PURE__ */ new Float32Array(12);
|
|
1033
|
-
channelTime = new Float32Array(
|
|
1033
|
+
channelTime = new Float32Array(At);
|
|
1034
1034
|
lastError = null;
|
|
1035
1035
|
currentShaderSource = "";
|
|
1036
1036
|
constructor(e) {
|
|
@@ -1065,7 +1065,7 @@ var Mt = class {
|
|
|
1065
1065
|
}
|
|
1066
1066
|
initializeChannels() {
|
|
1067
1067
|
let e = this.gl;
|
|
1068
|
-
for (let t = 0; t <
|
|
1068
|
+
for (let t = 0; t < At; t++) {
|
|
1069
1069
|
let t = e.createTexture();
|
|
1070
1070
|
e.bindTexture(e.TEXTURE_2D, t), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, 1, 1, 0, e.RGBA, e.UNSIGNED_BYTE, new Uint8Array([
|
|
1071
1071
|
0,
|
|
@@ -1082,7 +1082,7 @@ var Mt = class {
|
|
|
1082
1082
|
e.bindTexture(e.TEXTURE_2D, null);
|
|
1083
1083
|
}
|
|
1084
1084
|
setChannels(e) {
|
|
1085
|
-
for (let t = 0; t <
|
|
1085
|
+
for (let t = 0; t < At; t++) {
|
|
1086
1086
|
let n = e[t] ?? null, r = this.channels[t];
|
|
1087
1087
|
if (r.url !== n) {
|
|
1088
1088
|
if (r.url = n, !n) {
|
|
@@ -1113,9 +1113,9 @@ var Mt = class {
|
|
|
1113
1113
|
}
|
|
1114
1114
|
compile(e, t = {}) {
|
|
1115
1115
|
this.lastError = null, this.customUniforms = t, this.currentShaderSource = e;
|
|
1116
|
-
let n = this.gl, r = this.compileShader(n.VERTEX_SHADER,
|
|
1116
|
+
let n = this.gl, r = this.compileShader(n.VERTEX_SHADER, kt);
|
|
1117
1117
|
if (!r) return !1;
|
|
1118
|
-
let i =
|
|
1118
|
+
let i = Mt(e, t), a = this.compileShader(n.FRAGMENT_SHADER, i);
|
|
1119
1119
|
if (!a) return n.deleteShader(r), !1;
|
|
1120
1120
|
let o = n.createProgram();
|
|
1121
1121
|
return o ? (n.attachShader(o, r), n.attachShader(o, a), n.linkProgram(o), n.deleteShader(r), n.deleteShader(a), n.getProgramParameter(o, n.LINK_STATUS) ? (this.program && n.deleteProgram(this.program), this.program = o, this.cacheUniformLocations(), !0) : (this.lastError = n.getProgramInfoLog(o) || "Program link failed", n.deleteProgram(o), !1)) : (this.lastError = "Failed to create program", n.deleteShader(r), n.deleteShader(a), !1);
|
|
@@ -1139,7 +1139,7 @@ var Mt = class {
|
|
|
1139
1139
|
"iMouse",
|
|
1140
1140
|
"iDate"
|
|
1141
1141
|
]) this.uniformLocations.set(t, e.getUniformLocation(this.program, t));
|
|
1142
|
-
for (let t = 0; t <
|
|
1142
|
+
for (let t = 0; t < At; t++) this.uniformLocations.set(`iChannel${t}`, e.getUniformLocation(this.program, `iChannel${t}`));
|
|
1143
1143
|
this.uniformLocations.set("iChannelResolution", e.getUniformLocation(this.program, "iChannelResolution[0]")), this.uniformLocations.set("iChannelTime", e.getUniformLocation(this.program, "iChannelTime[0]"));
|
|
1144
1144
|
for (let t of Object.keys(this.customUniforms)) this.uniformLocations.set(t, e.getUniformLocation(this.program, t));
|
|
1145
1145
|
}
|
|
@@ -1171,7 +1171,7 @@ var Mt = class {
|
|
|
1171
1171
|
let t = /* @__PURE__ */ new Date();
|
|
1172
1172
|
e.uniform4f(p, t.getFullYear(), t.getMonth(), t.getDate(), t.getHours() * 3600 + t.getMinutes() * 60 + t.getSeconds() + t.getMilliseconds() / 1e3);
|
|
1173
1173
|
}
|
|
1174
|
-
for (let t = 0; t <
|
|
1174
|
+
for (let t = 0; t < At; t++) {
|
|
1175
1175
|
e.activeTexture(e.TEXTURE0 + t), e.bindTexture(e.TEXTURE_2D, this.channels[t].texture);
|
|
1176
1176
|
let n = this.uniformLocations.get(`iChannel${t}`);
|
|
1177
1177
|
n && e.uniform1i(n, t);
|
|
@@ -1221,7 +1221,7 @@ var Mt = class {
|
|
|
1221
1221
|
};
|
|
1222
1222
|
//#endregion
|
|
1223
1223
|
//#region src/shadertoy/shadertoy-renderer.tsx
|
|
1224
|
-
function
|
|
1224
|
+
function Pt(e) {
|
|
1225
1225
|
if (typeof e == "string") {
|
|
1226
1226
|
let t = e.trim();
|
|
1227
1227
|
return t.length > 0 ? t : void 0;
|
|
@@ -1231,22 +1231,22 @@ function Nt(e) {
|
|
|
1231
1231
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
1232
1232
|
}
|
|
1233
1233
|
}
|
|
1234
|
-
function
|
|
1234
|
+
function Ft(...e) {
|
|
1235
1235
|
let t = [];
|
|
1236
1236
|
for (let n of e) n && n.trim() && t.push(n.trim());
|
|
1237
1237
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
1238
1238
|
}
|
|
1239
|
-
function
|
|
1239
|
+
function It(e) {
|
|
1240
1240
|
if (typeof e == "number" && Number.isFinite(e)) return Math.floor(e);
|
|
1241
1241
|
if (typeof e == "string" && e.trim().length > 0) {
|
|
1242
1242
|
let t = Number(e);
|
|
1243
1243
|
if (Number.isFinite(t)) return Math.floor(t);
|
|
1244
1244
|
}
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1246
|
+
function Lt(e) {
|
|
1247
1247
|
return typeof e == "string" ? e : "";
|
|
1248
1248
|
}
|
|
1249
|
-
function
|
|
1249
|
+
function Rt(e) {
|
|
1250
1250
|
if (typeof e == "boolean") return e;
|
|
1251
1251
|
if (typeof e == "string") {
|
|
1252
1252
|
let t = e.trim().toLowerCase();
|
|
@@ -1254,7 +1254,7 @@ function Lt(e) {
|
|
|
1254
1254
|
if (t === "false") return !1;
|
|
1255
1255
|
}
|
|
1256
1256
|
}
|
|
1257
|
-
function
|
|
1257
|
+
function zt(e) {
|
|
1258
1258
|
if (!e || typeof e != "object") return {};
|
|
1259
1259
|
let t = {}, n = e;
|
|
1260
1260
|
for (let [e, r] of Object.entries(n)) {
|
|
@@ -1274,10 +1274,10 @@ function Rt(e) {
|
|
|
1274
1274
|
}
|
|
1275
1275
|
return t;
|
|
1276
1276
|
}
|
|
1277
|
-
function
|
|
1277
|
+
function Bt(e) {
|
|
1278
1278
|
return Array.isArray(e) ? e.map((e) => typeof e == "string" ? e : null) : [];
|
|
1279
1279
|
}
|
|
1280
|
-
function
|
|
1280
|
+
function Vt(e, t) {
|
|
1281
1281
|
let n = Object.keys(e), r = Object.keys(t);
|
|
1282
1282
|
if (n.length !== r.length) return !1;
|
|
1283
1283
|
for (let r of n) {
|
|
@@ -1291,8 +1291,8 @@ function Bt(e, t) {
|
|
|
1291
1291
|
}
|
|
1292
1292
|
return !0;
|
|
1293
1293
|
}
|
|
1294
|
-
var
|
|
1295
|
-
function
|
|
1294
|
+
var Ht = "std.shadertoy-canvas";
|
|
1295
|
+
function Ut() {
|
|
1296
1296
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
1297
1297
|
let r = I(t.store, e), i = j(null), a = j(null), o = j(null), s = j(0), c = j(""), l = j({}), u = j({
|
|
1298
1298
|
x: 0,
|
|
@@ -1300,12 +1300,12 @@ function Ht() {
|
|
|
1300
1300
|
clickX: 0,
|
|
1301
1301
|
clickY: 0,
|
|
1302
1302
|
isDown: !1
|
|
1303
|
-
}), d = r ?
|
|
1303
|
+
}), d = r ? Lt(r.props?.shaderSource) : "", f = r ? It(r.props?.fps) ?? 60 : 60, p = r?.props?.uniforms, m = A(() => zt(p), [p]), h = r?.props?.channels, g = A(() => Bt(h), [h]), _ = r ? Rt(r.props?.enableMouse) ?? !0 : !0, v = r ? It(r.props?.width) : void 0, y = r ? It(r.props?.height) : void 0, b = r ? Ft(Pt(r.props?.className), n) : n;
|
|
1304
1304
|
k(() => {
|
|
1305
1305
|
let e = i.current;
|
|
1306
1306
|
if (e) {
|
|
1307
1307
|
try {
|
|
1308
|
-
let t = new
|
|
1308
|
+
let t = new Nt(e);
|
|
1309
1309
|
a.current = t;
|
|
1310
1310
|
} catch (e) {
|
|
1311
1311
|
console.error("[ShadertoyRenderer] Failed to create WebGL2 context:", e);
|
|
@@ -1323,7 +1323,7 @@ function Ht() {
|
|
|
1323
1323
|
}
|
|
1324
1324
|
}, [d, m]), k(() => {
|
|
1325
1325
|
let e = a.current;
|
|
1326
|
-
!e || !c.current ||
|
|
1326
|
+
!e || !c.current || Vt(l.current, m) || (e.setCustomUniforms(m), l.current = m);
|
|
1327
1327
|
}, [m]), k(() => {
|
|
1328
1328
|
let e = a.current;
|
|
1329
1329
|
e && e.setChannels(g);
|
|
@@ -1372,13 +1372,13 @@ function Ht() {
|
|
|
1372
1372
|
}
|
|
1373
1373
|
//#endregion
|
|
1374
1374
|
//#region src/shadertoy/shadertoy-module.ts
|
|
1375
|
-
var
|
|
1376
|
-
function
|
|
1377
|
-
e.registerModule(
|
|
1375
|
+
var Wt = "shadertoy", Gt = async () => Ut();
|
|
1376
|
+
function Kt(e) {
|
|
1377
|
+
e.registerModule(Wt, Gt);
|
|
1378
1378
|
}
|
|
1379
1379
|
//#endregion
|
|
1380
1380
|
//#region src/ikon-ui-registry.ts
|
|
1381
|
-
var
|
|
1381
|
+
var qt = v("UIRegistry"), Jt = class {
|
|
1382
1382
|
baseResolvers = [];
|
|
1383
1383
|
moduleLoaders = /* @__PURE__ */ new Map();
|
|
1384
1384
|
moduleResolvers = /* @__PURE__ */ new Map();
|
|
@@ -1404,14 +1404,14 @@ var Kt = v("UIRegistry"), qt = class {
|
|
|
1404
1404
|
async loadRegisteredModules() {
|
|
1405
1405
|
let e = !1;
|
|
1406
1406
|
for (let [t, n] of this.moduleLoaders.entries()) if (!this.moduleResolvers.has(t)) try {
|
|
1407
|
-
let r =
|
|
1407
|
+
let r = Zt(await n());
|
|
1408
1408
|
this.moduleResolvers.set(t, r), e = !0;
|
|
1409
1409
|
} catch (e) {
|
|
1410
|
-
|
|
1410
|
+
qt.error(`[IkonUiRegistry] Failed to load module '${t}'.`, e);
|
|
1411
1411
|
}
|
|
1412
1412
|
let t = [];
|
|
1413
1413
|
for (let e of this.moduleLoaders.keys()) this.moduleResolvers.has(e) && t.push(e);
|
|
1414
|
-
return
|
|
1414
|
+
return Qt(t, this.activeModuleOrder) || (this.activeModuleOrder = t, e = !0), e && this.notify(), e;
|
|
1415
1415
|
}
|
|
1416
1416
|
resolve(e) {
|
|
1417
1417
|
for (let t of this.baseResolvers) {
|
|
@@ -1421,7 +1421,7 @@ var Kt = v("UIRegistry"), qt = class {
|
|
|
1421
1421
|
for (let t of this.activeModuleOrder) {
|
|
1422
1422
|
let n = this.moduleResolvers.get(t);
|
|
1423
1423
|
if (!n) {
|
|
1424
|
-
|
|
1424
|
+
qt.warn(`Missing resolvers for module ${t}`);
|
|
1425
1425
|
continue;
|
|
1426
1426
|
}
|
|
1427
1427
|
for (let t of n) {
|
|
@@ -1434,25 +1434,25 @@ var Kt = v("UIRegistry"), qt = class {
|
|
|
1434
1434
|
for (let e of this.listeners) e();
|
|
1435
1435
|
}
|
|
1436
1436
|
};
|
|
1437
|
-
function
|
|
1438
|
-
let e = new
|
|
1439
|
-
return
|
|
1437
|
+
function Yt() {
|
|
1438
|
+
let e = new Jt();
|
|
1439
|
+
return st(e), Ot(e), Kt(e), e.loadRegisteredModules(), e;
|
|
1440
1440
|
}
|
|
1441
|
-
function
|
|
1441
|
+
function Xt(e) {
|
|
1442
1442
|
return Array.isArray(e) ? e : [e];
|
|
1443
1443
|
}
|
|
1444
|
-
function
|
|
1445
|
-
return e ?
|
|
1444
|
+
function Zt(e) {
|
|
1445
|
+
return e ? Xt(e).flatMap((e) => e ? Array.isArray(e) ? e.filter(Boolean) : [e] : []) : [];
|
|
1446
1446
|
}
|
|
1447
|
-
function
|
|
1447
|
+
function Qt(e, t) {
|
|
1448
1448
|
if (e.length !== t.length) return !1;
|
|
1449
1449
|
for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
|
|
1450
1450
|
return !0;
|
|
1451
1451
|
}
|
|
1452
1452
|
//#endregion
|
|
1453
1453
|
//#region src/parallax-view.tsx
|
|
1454
|
-
function
|
|
1455
|
-
return /* @__PURE__ */ P(
|
|
1454
|
+
function $t({ mount: e, stores: t, registry: n, client: r, onAction: i }) {
|
|
1455
|
+
return /* @__PURE__ */ P(Be, {
|
|
1456
1456
|
stores: t,
|
|
1457
1457
|
registry: n,
|
|
1458
1458
|
category: e,
|
|
@@ -1462,7 +1462,7 @@ function Qt({ mount: e, stores: t, registry: n, client: r, onAction: i }) {
|
|
|
1462
1462
|
}
|
|
1463
1463
|
//#endregion
|
|
1464
1464
|
//#region src/motion/motion-controller.ts
|
|
1465
|
-
var
|
|
1465
|
+
var en = v("MotionController"), tn = {
|
|
1466
1466
|
ease: [
|
|
1467
1467
|
.25,
|
|
1468
1468
|
.1,
|
|
@@ -1632,20 +1632,20 @@ var $t = v("MotionController"), en = {
|
|
|
1632
1632
|
1.55
|
|
1633
1633
|
]
|
|
1634
1634
|
};
|
|
1635
|
-
function
|
|
1635
|
+
function G(e) {
|
|
1636
1636
|
return e <= 0 ? 0 : e >= 1 ? 1 : e;
|
|
1637
1637
|
}
|
|
1638
|
-
function
|
|
1638
|
+
function nn(e) {
|
|
1639
1639
|
if (e == null) return;
|
|
1640
1640
|
let t = e.trim();
|
|
1641
1641
|
if (!t) return;
|
|
1642
1642
|
let n = Number.parseFloat(t);
|
|
1643
1643
|
return Number.isFinite(n) ? n : void 0;
|
|
1644
1644
|
}
|
|
1645
|
-
function
|
|
1645
|
+
function rn(e) {
|
|
1646
1646
|
return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/[^a-zA-Z0-9_-]/g, (e) => `\\${e}`);
|
|
1647
1647
|
}
|
|
1648
|
-
function
|
|
1648
|
+
function an(e, t, n, r) {
|
|
1649
1649
|
let i = 1 / 10, a = /* @__PURE__ */ new Float32Array(11);
|
|
1650
1650
|
function o(e, t, n) {
|
|
1651
1651
|
return ((3 * t - 3 * n + 1) * e + (3 * n - 6 * t)) * e * e + 3 * t * e;
|
|
@@ -1679,34 +1679,34 @@ function rn(e, t, n, r) {
|
|
|
1679
1679
|
for (let t = 0; t < 11; t += 1) a[t] = o(t * i, e, n);
|
|
1680
1680
|
return (e) => e <= 0 ? 0 : e >= 1 ? 1 : o(u(e), t, r);
|
|
1681
1681
|
}
|
|
1682
|
-
function
|
|
1682
|
+
function on(e) {
|
|
1683
1683
|
let t = /steps\(\s*([0-9]+)\s*(?:,\s*([a-z-]+)\s*)?\)/i.exec(e);
|
|
1684
|
-
if (!t) return (e) =>
|
|
1684
|
+
if (!t) return (e) => G(e);
|
|
1685
1685
|
let n = Math.max(1, parseInt(t[1], 10)), r = (t[2] ?? "end").toLowerCase();
|
|
1686
|
-
return r === "start" || r === "jump-start" ? (e) =>
|
|
1686
|
+
return r === "start" || r === "jump-start" ? (e) => G(Math.ceil(e * n) / n) : r === "none" || r === "jump-none" ? (e) => G(Math.round(e * n) / n) : r === "both" || r === "jump-both" ? (e) => G((Math.floor(e * n) + .5) / n) : (e) => G(Math.floor(e * n) / n);
|
|
1687
1687
|
}
|
|
1688
|
-
function
|
|
1689
|
-
if (!e) return (e) =>
|
|
1688
|
+
function sn(e) {
|
|
1689
|
+
if (!e) return (e) => G(e);
|
|
1690
1690
|
let t = e.trim().toLowerCase();
|
|
1691
|
-
if (!t || t === "linear") return (e) =>
|
|
1692
|
-
if (
|
|
1693
|
-
let [e, n, r, i] =
|
|
1694
|
-
return (e) =>
|
|
1691
|
+
if (!t || t === "linear") return (e) => G(e);
|
|
1692
|
+
if (tn[t]) {
|
|
1693
|
+
let [e, n, r, i] = tn[t], a = an(e, n, r, i);
|
|
1694
|
+
return (e) => G(a(G(e)));
|
|
1695
1695
|
}
|
|
1696
1696
|
if (t.startsWith("cubic-bezier(") && t.endsWith(")")) {
|
|
1697
1697
|
let e = t.slice(13, -1).split(",").map((e) => Number.parseFloat(e.trim()));
|
|
1698
1698
|
if (e.length === 4 && e.every((e) => Number.isFinite(e))) {
|
|
1699
|
-
let [t, n, r, i] = e, a =
|
|
1700
|
-
return (e) =>
|
|
1699
|
+
let [t, n, r, i] = e, a = an(t, n, r, i);
|
|
1700
|
+
return (e) => G(a(G(e)));
|
|
1701
1701
|
}
|
|
1702
1702
|
}
|
|
1703
1703
|
if (t.startsWith("steps(") && t.endsWith(")")) {
|
|
1704
|
-
let e =
|
|
1705
|
-
return (t) => e(
|
|
1704
|
+
let e = on(t);
|
|
1705
|
+
return (t) => e(G(t));
|
|
1706
1706
|
}
|
|
1707
|
-
return (e) =>
|
|
1707
|
+
return (e) => G(e);
|
|
1708
1708
|
}
|
|
1709
|
-
function
|
|
1709
|
+
function cn(e) {
|
|
1710
1710
|
if (!e) return;
|
|
1711
1711
|
let t = /(-?\d+(?:\.\d+)?)\s*\.\.\s*(-?\d+(?:\.\d+)?)\s*->\s*(-?\d+(?:\.\d+)?)\s*\.\.\s*(-?\d+(?:\.\d+)?)/.exec(e);
|
|
1712
1712
|
if (!t) return;
|
|
@@ -1723,7 +1723,7 @@ function sn(e) {
|
|
|
1723
1723
|
outEnd: a
|
|
1724
1724
|
};
|
|
1725
1725
|
}
|
|
1726
|
-
var
|
|
1726
|
+
var ln = new class {
|
|
1727
1727
|
bindingsByStyle = /* @__PURE__ */ new Map();
|
|
1728
1728
|
observer;
|
|
1729
1729
|
observeScheduled = !1;
|
|
@@ -1748,7 +1748,7 @@ var cn = new class {
|
|
|
1748
1748
|
for (let e of Array.from(this.globalCleanups)) try {
|
|
1749
1749
|
e();
|
|
1750
1750
|
} catch (e) {
|
|
1751
|
-
|
|
1751
|
+
en.warn("Failed to cleanup binding listener", e);
|
|
1752
1752
|
}
|
|
1753
1753
|
this.globalCleanups.clear(), this.elementStates.clear(), this.styleToElements.clear(), this.bindingsByStyle.clear(), this.pendingScanStyles.clear(), this.scanScheduled = !1, this.observer &&= (this.observer.disconnect(), void 0);
|
|
1754
1754
|
}
|
|
@@ -1757,14 +1757,14 @@ var cn = new class {
|
|
|
1757
1757
|
let t = (JSON.parse(e).motionBindings ?? []).map((e) => this.parseBinding(e)).filter((e) => e !== void 0);
|
|
1758
1758
|
return t.length === 0 ? void 0 : { bindings: t };
|
|
1759
1759
|
} catch (e) {
|
|
1760
|
-
|
|
1760
|
+
en.warn("Failed to parse motion metadata", e);
|
|
1761
1761
|
return;
|
|
1762
1762
|
}
|
|
1763
1763
|
}
|
|
1764
1764
|
parseBinding(e) {
|
|
1765
1765
|
let t = e.source?.trim();
|
|
1766
1766
|
if (!t) return;
|
|
1767
|
-
let n =
|
|
1767
|
+
let n = nn(e.min) ?? 0, r = nn(e.max), i = r === void 0 ? n + 100 : r, a = (e.clamp ?? "clamp").trim().toLowerCase(), o = !!e.reverse, s = sn(e.ease), c = cn(e.map), l = e.targetId?.trim() || void 0;
|
|
1768
1768
|
if (!(Number.isNaN(n) || Number.isNaN(i))) return {
|
|
1769
1769
|
source: t.toLowerCase(),
|
|
1770
1770
|
min: n,
|
|
@@ -1810,7 +1810,7 @@ var cn = new class {
|
|
|
1810
1810
|
scanExistingNodes(e) {
|
|
1811
1811
|
let t = this.bindingsByStyle.get(e);
|
|
1812
1812
|
if (!t || typeof document > "u") return;
|
|
1813
|
-
let n = `.${
|
|
1813
|
+
let n = `.${rn(e)}`;
|
|
1814
1814
|
document.querySelectorAll(n).forEach((n) => this.applyStyleToElement(n, e, t));
|
|
1815
1815
|
}
|
|
1816
1816
|
applyStyleToElement(e, t, n) {
|
|
@@ -1846,7 +1846,7 @@ var cn = new class {
|
|
|
1846
1846
|
}
|
|
1847
1847
|
resolveScrollContainer(e, t) {
|
|
1848
1848
|
if (t.targetId) {
|
|
1849
|
-
let e = `[data-ikon-motion-source="${
|
|
1849
|
+
let e = `[data-ikon-motion-source="${rn(t.targetId)}"]`, n = typeof document < "u" ? document.querySelector(e) : null;
|
|
1850
1850
|
if (n) return n;
|
|
1851
1851
|
}
|
|
1852
1852
|
return e.closest("[data-ikon-view-type=\"scroll-view\"]");
|
|
@@ -1866,7 +1866,7 @@ var cn = new class {
|
|
|
1866
1866
|
case "freeze-start": return e < 0 ? 0 : e;
|
|
1867
1867
|
case "freeze-end": return e > 1 ? 1 : e;
|
|
1868
1868
|
case "unclamped": return e;
|
|
1869
|
-
default: return
|
|
1869
|
+
default: return G(e);
|
|
1870
1870
|
}
|
|
1871
1871
|
}
|
|
1872
1872
|
applyMap(e, t) {
|
|
@@ -1901,7 +1901,7 @@ var cn = new class {
|
|
|
1901
1901
|
try {
|
|
1902
1902
|
e();
|
|
1903
1903
|
} catch (e) {
|
|
1904
|
-
|
|
1904
|
+
en.warn("Failed to cleanup listener", e);
|
|
1905
1905
|
}
|
|
1906
1906
|
this.globalCleanups.delete(e);
|
|
1907
1907
|
}
|
|
@@ -1941,26 +1941,26 @@ var cn = new class {
|
|
|
1941
1941
|
}();
|
|
1942
1942
|
//#endregion
|
|
1943
1943
|
//#region src/use-ikon-styles.ts
|
|
1944
|
-
function
|
|
1944
|
+
function un(e) {
|
|
1945
1945
|
let t = j(/* @__PURE__ */ new Map()), n = O(({ styleId: e, css: n, common: r }) => {
|
|
1946
1946
|
if (!(!e || typeof document > "u")) {
|
|
1947
1947
|
if (n) {
|
|
1948
1948
|
let r = t.current.get(e);
|
|
1949
1949
|
r || (r = document.createElement("style"), r.setAttribute("data-ikon-style-id", e), document.head.appendChild(r), t.current.set(e, r)), r.textContent = n;
|
|
1950
1950
|
}
|
|
1951
|
-
|
|
1951
|
+
ln.registerStyle(e, r);
|
|
1952
1952
|
}
|
|
1953
1953
|
}, []), r = O((e) => {
|
|
1954
1954
|
if (!(typeof document > "u")) for (let n of e) {
|
|
1955
1955
|
let e = t.current.get(n);
|
|
1956
|
-
e && (e.remove(), t.current.delete(n)),
|
|
1956
|
+
e && (e.remove(), t.current.delete(n)), ln.unregisterStyle(n);
|
|
1957
1957
|
}
|
|
1958
1958
|
}, []), i = O(() => {
|
|
1959
1959
|
if (typeof document < "u") {
|
|
1960
1960
|
for (let e of t.current.values()) e.remove();
|
|
1961
1961
|
t.current.clear();
|
|
1962
1962
|
}
|
|
1963
|
-
|
|
1963
|
+
ln.reset();
|
|
1964
1964
|
}, []);
|
|
1965
1965
|
return k(() => {
|
|
1966
1966
|
if (!e) return;
|
|
@@ -1982,7 +1982,7 @@ function ln(e) {
|
|
|
1982
1982
|
}
|
|
1983
1983
|
//#endregion
|
|
1984
1984
|
//#region src/use-ikon-ui-stores.ts
|
|
1985
|
-
function
|
|
1985
|
+
function dn(e) {
|
|
1986
1986
|
let t = [];
|
|
1987
1987
|
for (let [n, r] of e) {
|
|
1988
1988
|
let e = r.store.getSnapshot(), i = e.rootViewId && e.views.has(e.rootViewId);
|
|
@@ -1990,7 +1990,7 @@ function un(e) {
|
|
|
1990
1990
|
}
|
|
1991
1991
|
return t.sort(), t.join(",");
|
|
1992
1992
|
}
|
|
1993
|
-
function
|
|
1993
|
+
function fn(e) {
|
|
1994
1994
|
let [t, n] = M(), r = j("");
|
|
1995
1995
|
return k(() => {
|
|
1996
1996
|
if (!e) {
|
|
@@ -1998,7 +1998,7 @@ function dn(e) {
|
|
|
1998
1998
|
return;
|
|
1999
1999
|
}
|
|
2000
2000
|
let t = () => {
|
|
2001
|
-
let t = e.getStores(), i =
|
|
2001
|
+
let t = e.getStores(), i = dn(t);
|
|
2002
2002
|
i !== r.current && (r.current = i, n(t));
|
|
2003
2003
|
};
|
|
2004
2004
|
return t(), e.subscribe(t);
|
|
@@ -2006,16 +2006,16 @@ function dn(e) {
|
|
|
2006
2006
|
}
|
|
2007
2007
|
//#endregion
|
|
2008
2008
|
//#region src/shared/render-motion-letters.tsx
|
|
2009
|
-
var
|
|
2009
|
+
var K = {
|
|
2010
2010
|
None: 0,
|
|
2011
2011
|
Letter: 1,
|
|
2012
2012
|
Word: 2,
|
|
2013
2013
|
Line: 4,
|
|
2014
2014
|
Paragraph: 8,
|
|
2015
2015
|
Emoji: 16
|
|
2016
|
-
},
|
|
2016
|
+
}, pn = [
|
|
2017
2017
|
{
|
|
2018
|
-
flag:
|
|
2018
|
+
flag: K.Letter,
|
|
2019
2019
|
hints: [
|
|
2020
2020
|
"[data-motion-letter]",
|
|
2021
2021
|
"[data-letter]",
|
|
@@ -2024,7 +2024,7 @@ var G = {
|
|
|
2024
2024
|
]
|
|
2025
2025
|
},
|
|
2026
2026
|
{
|
|
2027
|
-
flag:
|
|
2027
|
+
flag: K.Word,
|
|
2028
2028
|
hints: [
|
|
2029
2029
|
"[data-motion-word]",
|
|
2030
2030
|
"[data-word]",
|
|
@@ -2033,7 +2033,7 @@ var G = {
|
|
|
2033
2033
|
]
|
|
2034
2034
|
},
|
|
2035
2035
|
{
|
|
2036
|
-
flag:
|
|
2036
|
+
flag: K.Line,
|
|
2037
2037
|
hints: [
|
|
2038
2038
|
"[data-motion-line]",
|
|
2039
2039
|
"[data-line]",
|
|
@@ -2042,7 +2042,7 @@ var G = {
|
|
|
2042
2042
|
]
|
|
2043
2043
|
},
|
|
2044
2044
|
{
|
|
2045
|
-
flag:
|
|
2045
|
+
flag: K.Paragraph,
|
|
2046
2046
|
hints: [
|
|
2047
2047
|
"[data-motion-paragraph]",
|
|
2048
2048
|
"[data-paragraph]",
|
|
@@ -2053,7 +2053,7 @@ var G = {
|
|
|
2053
2053
|
]
|
|
2054
2054
|
},
|
|
2055
2055
|
{
|
|
2056
|
-
flag:
|
|
2056
|
+
flag: K.Emoji,
|
|
2057
2057
|
hints: [
|
|
2058
2058
|
":is([data-motion-emoji],[data-emoji],.tw-motion-emoji,.tw-emoji)",
|
|
2059
2059
|
"[data-motion-emoji]",
|
|
@@ -2062,16 +2062,16 @@ var G = {
|
|
|
2062
2062
|
"[data-emoji]"
|
|
2063
2063
|
]
|
|
2064
2064
|
}
|
|
2065
|
-
],
|
|
2066
|
-
function
|
|
2067
|
-
if (!e || e.length >
|
|
2068
|
-
let n =
|
|
2069
|
-
if (i ===
|
|
2065
|
+
], mn = K.Letter | K.Word | K.Line | K.Paragraph | K.Emoji, hn = K.Letter | K.Word | K.Line | K.Paragraph, gn = /* @__PURE__ */ new Map(), _n = 16384;
|
|
2066
|
+
function vn(e, t) {
|
|
2067
|
+
if (!e || e.length > _n) return e;
|
|
2068
|
+
let n = qn(t), r = Un(n, K.Emoji), i = n & hn;
|
|
2069
|
+
if (i === K.None && !r) return e;
|
|
2070
2070
|
let a = e.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
2071
|
-
if (i ===
|
|
2072
|
-
let o =
|
|
2073
|
-
if (o.length === 0) return r ?
|
|
2074
|
-
let s =
|
|
2071
|
+
if (i === K.None) return Gn(a);
|
|
2072
|
+
let o = Vn(a);
|
|
2073
|
+
if (o.length === 0) return r ? Gn(a) : e;
|
|
2074
|
+
let s = Hn(o), c = {
|
|
2075
2075
|
letter: 0,
|
|
2076
2076
|
word: 0,
|
|
2077
2077
|
line: 0,
|
|
@@ -2080,58 +2080,58 @@ function _n(e, t) {
|
|
|
2080
2080
|
emoji: 0
|
|
2081
2081
|
}, l = [];
|
|
2082
2082
|
for (let e of s) {
|
|
2083
|
-
let t =
|
|
2083
|
+
let t = yn(e, n, c);
|
|
2084
2084
|
l.push(...t);
|
|
2085
2085
|
}
|
|
2086
2086
|
return l;
|
|
2087
2087
|
}
|
|
2088
|
-
function
|
|
2088
|
+
function yn(e, t, n) {
|
|
2089
2089
|
let r = [];
|
|
2090
2090
|
for (let i of e) {
|
|
2091
|
-
let e =
|
|
2091
|
+
let e = bn(i, t, n);
|
|
2092
2092
|
r.push(...e);
|
|
2093
2093
|
}
|
|
2094
|
-
if (
|
|
2094
|
+
if (Un(t, K.Paragraph)) {
|
|
2095
2095
|
let e = n.paragraph++;
|
|
2096
2096
|
return [/* @__PURE__ */ P("span", {
|
|
2097
2097
|
"data-motion-paragraph": !0,
|
|
2098
|
-
style:
|
|
2098
|
+
style: Wn(e),
|
|
2099
2099
|
children: r
|
|
2100
2100
|
}, `motion-paragraph-${e}`)];
|
|
2101
2101
|
}
|
|
2102
2102
|
return r;
|
|
2103
2103
|
}
|
|
2104
|
-
function
|
|
2105
|
-
let r =
|
|
2106
|
-
if (
|
|
2104
|
+
function bn(e, t, n) {
|
|
2105
|
+
let r = xn(e.text, t, n), i = [];
|
|
2106
|
+
if (Un(t, K.Line)) {
|
|
2107
2107
|
let e = n.line++;
|
|
2108
2108
|
i.push(/* @__PURE__ */ P("span", {
|
|
2109
2109
|
"data-motion-line": !0,
|
|
2110
|
-
style:
|
|
2110
|
+
style: Wn(e),
|
|
2111
2111
|
children: r
|
|
2112
2112
|
}, `motion-line-${e}`));
|
|
2113
2113
|
} else i.push(...r);
|
|
2114
2114
|
for (let t = 0; t < e.breaks; t++) i.push(/* @__PURE__ */ P("br", {}, `motion-break-${n.br++}`));
|
|
2115
2115
|
return i;
|
|
2116
2116
|
}
|
|
2117
|
-
function
|
|
2117
|
+
function xn(e, t, n) {
|
|
2118
2118
|
if (!e) return [];
|
|
2119
|
-
let r =
|
|
2119
|
+
let r = Un(t, K.Word), i = [], a = /(\s+)/g, o = 0, s;
|
|
2120
2120
|
for (; (s = a.exec(e)) !== null;) {
|
|
2121
2121
|
if (s.index > o) {
|
|
2122
2122
|
let a = e.slice(o, s.index);
|
|
2123
|
-
i.push(
|
|
2123
|
+
i.push(Sn(a, n, t, r));
|
|
2124
2124
|
}
|
|
2125
2125
|
i.push(s[0]), o = s.index + s[0].length;
|
|
2126
2126
|
}
|
|
2127
2127
|
if (o < e.length) {
|
|
2128
2128
|
let a = e.slice(o);
|
|
2129
|
-
i.push(
|
|
2129
|
+
i.push(Sn(a, n, t, r));
|
|
2130
2130
|
}
|
|
2131
2131
|
return i;
|
|
2132
2132
|
}
|
|
2133
|
-
function
|
|
2134
|
-
let i = t.word++, a =
|
|
2133
|
+
function Sn(e, t, n, r) {
|
|
2134
|
+
let i = t.word++, a = wn(e, n, t), o = `motion-word-${i}`, s = Cn(i, r);
|
|
2135
2135
|
return r ? /* @__PURE__ */ P("span", {
|
|
2136
2136
|
"data-motion-word": !0,
|
|
2137
2137
|
style: s,
|
|
@@ -2141,25 +2141,25 @@ function xn(e, t, n, r) {
|
|
|
2141
2141
|
children: a
|
|
2142
2142
|
}, o);
|
|
2143
2143
|
}
|
|
2144
|
-
function
|
|
2144
|
+
function Cn(e, t) {
|
|
2145
2145
|
return t ? {
|
|
2146
|
-
...
|
|
2146
|
+
...Wn(e),
|
|
2147
2147
|
whiteSpace: "nowrap"
|
|
2148
2148
|
} : { whiteSpace: "nowrap" };
|
|
2149
2149
|
}
|
|
2150
|
-
function
|
|
2150
|
+
function wn(e, t, n) {
|
|
2151
2151
|
if (!e) return [];
|
|
2152
|
-
let r =
|
|
2152
|
+
let r = Un(t, K.Letter), i = Un(t, K.Emoji);
|
|
2153
2153
|
if (!r) {
|
|
2154
2154
|
if (!i) return [e];
|
|
2155
|
-
let t =
|
|
2155
|
+
let t = Tn(e);
|
|
2156
2156
|
if (t.length === 0) return [e];
|
|
2157
|
-
let { nodes: r } =
|
|
2157
|
+
let { nodes: r } = Kn(t, n);
|
|
2158
2158
|
return r;
|
|
2159
2159
|
}
|
|
2160
|
-
let a = [], o =
|
|
2160
|
+
let a = [], o = Tn(e);
|
|
2161
2161
|
for (let e of o) {
|
|
2162
|
-
let t = n.letter++, r = `motion-letter-${t}`, o =
|
|
2162
|
+
let t = n.letter++, r = `motion-letter-${t}`, o = Wn(t);
|
|
2163
2163
|
if (e === "\n") {
|
|
2164
2164
|
a.push(/* @__PURE__ */ P("span", {
|
|
2165
2165
|
"data-motion-letter": !0,
|
|
@@ -2168,7 +2168,7 @@ function Cn(e, t, n) {
|
|
|
2168
2168
|
}, r));
|
|
2169
2169
|
continue;
|
|
2170
2170
|
}
|
|
2171
|
-
let s = i &&
|
|
2171
|
+
let s = i && Rn(e) ? { "data-motion-emoji": !0 } : void 0, c = e === " " ? "\xA0" : e;
|
|
2172
2172
|
a.push(/* @__PURE__ */ P("span", {
|
|
2173
2173
|
"data-motion-letter": !0,
|
|
2174
2174
|
style: o,
|
|
@@ -2178,46 +2178,46 @@ function Cn(e, t, n) {
|
|
|
2178
2178
|
}
|
|
2179
2179
|
return a;
|
|
2180
2180
|
}
|
|
2181
|
-
function
|
|
2181
|
+
function Tn(e) {
|
|
2182
2182
|
if (!e) return [];
|
|
2183
|
-
let t =
|
|
2184
|
-
return t ? Array.from(t.segment(e), (e) => e.segment) :
|
|
2183
|
+
let t = Dn();
|
|
2184
|
+
return t ? Array.from(t.segment(e), (e) => e.segment) : On(e);
|
|
2185
2185
|
}
|
|
2186
|
-
var
|
|
2187
|
-
function
|
|
2188
|
-
return
|
|
2186
|
+
var En;
|
|
2187
|
+
function Dn() {
|
|
2188
|
+
return En === void 0 && (En = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null), En;
|
|
2189
2189
|
}
|
|
2190
|
-
function
|
|
2190
|
+
function On(e) {
|
|
2191
2191
|
let t = [], n = Array.from(e), r = "";
|
|
2192
2192
|
for (let e = 0; e < n.length; e++) {
|
|
2193
2193
|
let i = n[e], a = n[e + 1];
|
|
2194
|
-
r += i, !(a &&
|
|
2194
|
+
r += i, !(a && kn(i, a)) && (t.push(r), r = "");
|
|
2195
2195
|
}
|
|
2196
2196
|
return r && t.push(r), t;
|
|
2197
2197
|
}
|
|
2198
|
-
function
|
|
2199
|
-
return t ? !!(
|
|
2198
|
+
function kn(e, t) {
|
|
2199
|
+
return t ? !!(An(e) || An(t) || Fn(t) || jn(t) || Mn(t) || Nn(e) && Nn(t)) : !1;
|
|
2200
2200
|
}
|
|
2201
|
-
function
|
|
2201
|
+
function An(e) {
|
|
2202
2202
|
return e.codePointAt(0) === 8205;
|
|
2203
2203
|
}
|
|
2204
|
-
function
|
|
2204
|
+
function jn(e) {
|
|
2205
2205
|
let t = e.codePointAt(0);
|
|
2206
2206
|
return t === void 0 ? !1 : t >= 65024 && t <= 65039 || t >= 917760 && t <= 917999;
|
|
2207
2207
|
}
|
|
2208
|
-
function
|
|
2208
|
+
function Mn(e) {
|
|
2209
2209
|
let t = e.codePointAt(0);
|
|
2210
2210
|
return t !== void 0 && t >= 127995 && t <= 127999;
|
|
2211
2211
|
}
|
|
2212
|
-
function
|
|
2212
|
+
function Nn(e) {
|
|
2213
2213
|
let t = e.codePointAt(0);
|
|
2214
2214
|
return t !== void 0 && t >= 127462 && t <= 127487;
|
|
2215
2215
|
}
|
|
2216
|
-
var
|
|
2217
|
-
function
|
|
2218
|
-
return e ? (
|
|
2216
|
+
var Pn;
|
|
2217
|
+
function Fn(e) {
|
|
2218
|
+
return e ? (Pn ||= In(), Pn(e)) : !1;
|
|
2219
2219
|
}
|
|
2220
|
-
function
|
|
2220
|
+
function In() {
|
|
2221
2221
|
try {
|
|
2222
2222
|
let e = /\p{Mark}/u;
|
|
2223
2223
|
return (t) => e.test(t);
|
|
@@ -2228,19 +2228,19 @@ function Fn() {
|
|
|
2228
2228
|
};
|
|
2229
2229
|
}
|
|
2230
2230
|
}
|
|
2231
|
-
var
|
|
2232
|
-
function
|
|
2233
|
-
return e ? (
|
|
2231
|
+
var Ln;
|
|
2232
|
+
function Rn(e) {
|
|
2233
|
+
return e ? (Ln ||= zn(), Ln(e)) : !1;
|
|
2234
2234
|
}
|
|
2235
|
-
function
|
|
2235
|
+
function zn() {
|
|
2236
2236
|
try {
|
|
2237
2237
|
let e = /\p{Extended_Pictographic}/u;
|
|
2238
2238
|
return (t) => e.test(t);
|
|
2239
2239
|
} catch {
|
|
2240
|
-
return
|
|
2240
|
+
return Bn;
|
|
2241
2241
|
}
|
|
2242
2242
|
}
|
|
2243
|
-
function
|
|
2243
|
+
function Bn(e) {
|
|
2244
2244
|
if (!e) return !1;
|
|
2245
2245
|
for (let t of Array.from(e)) {
|
|
2246
2246
|
let e = t.codePointAt(0);
|
|
@@ -2248,7 +2248,7 @@ function zn(e) {
|
|
|
2248
2248
|
}
|
|
2249
2249
|
return !1;
|
|
2250
2250
|
}
|
|
2251
|
-
function
|
|
2251
|
+
function Vn(e) {
|
|
2252
2252
|
let t = [], n = "", r = 0;
|
|
2253
2253
|
for (let i = 0; i < e.length; i++) {
|
|
2254
2254
|
let a = e[i];
|
|
@@ -2266,16 +2266,16 @@ function Bn(e) {
|
|
|
2266
2266
|
breaks: r
|
|
2267
2267
|
}), t;
|
|
2268
2268
|
}
|
|
2269
|
-
function
|
|
2269
|
+
function Hn(e) {
|
|
2270
2270
|
if (e.length === 0) return [];
|
|
2271
2271
|
let t = [], n = [];
|
|
2272
2272
|
for (let r of e) n.push(r), r.breaks >= 2 && (t.push(n), n = []);
|
|
2273
2273
|
return n.length > 0 && t.push(n), t;
|
|
2274
2274
|
}
|
|
2275
|
-
function
|
|
2275
|
+
function Un(e, t) {
|
|
2276
2276
|
return (e & t) === t;
|
|
2277
2277
|
}
|
|
2278
|
-
function
|
|
2278
|
+
function Wn(e) {
|
|
2279
2279
|
return {
|
|
2280
2280
|
"--tw-motion-seq-index": e.toString(),
|
|
2281
2281
|
backgroundColor: "inherit",
|
|
@@ -2292,19 +2292,19 @@ function Hn(e) {
|
|
|
2292
2292
|
WebkitTextFillColor: "inherit"
|
|
2293
2293
|
};
|
|
2294
2294
|
}
|
|
2295
|
-
function
|
|
2295
|
+
function Gn(e) {
|
|
2296
2296
|
if (!e) return e;
|
|
2297
|
-
let t =
|
|
2297
|
+
let t = Tn(e);
|
|
2298
2298
|
if (t.length === 0) return e;
|
|
2299
|
-
let { nodes: n, sawEmoji: r } =
|
|
2299
|
+
let { nodes: n, sawEmoji: r } = Kn(t);
|
|
2300
2300
|
return r ? n.length === 1 ? n[0] ?? e : n : e;
|
|
2301
2301
|
}
|
|
2302
|
-
function
|
|
2302
|
+
function Kn(e, t) {
|
|
2303
2303
|
let n = [], r = "", i = !1, a = t?.emoji ?? 0, o = () => {
|
|
2304
2304
|
r &&= (n.push(r), "");
|
|
2305
2305
|
};
|
|
2306
2306
|
for (let s of e) {
|
|
2307
|
-
if (
|
|
2307
|
+
if (Rn(s)) {
|
|
2308
2308
|
i = !0, o();
|
|
2309
2309
|
let e = `motion-emoji-${t ? t.emoji++ : a++}`;
|
|
2310
2310
|
n.push(/* @__PURE__ */ P("span", {
|
|
@@ -2323,16 +2323,16 @@ function Wn(e, t) {
|
|
|
2323
2323
|
sawEmoji: !1
|
|
2324
2324
|
};
|
|
2325
2325
|
}
|
|
2326
|
-
function
|
|
2327
|
-
if (!e) return
|
|
2326
|
+
function qn(e) {
|
|
2327
|
+
if (!e) return K.None;
|
|
2328
2328
|
let t = e.trim();
|
|
2329
|
-
if (!t) return
|
|
2330
|
-
let n =
|
|
2329
|
+
if (!t) return K.None;
|
|
2330
|
+
let n = gn.get(t);
|
|
2331
2331
|
if (typeof n == "number") return n;
|
|
2332
|
-
if (typeof document > "u") return
|
|
2332
|
+
if (typeof document > "u") return K.None;
|
|
2333
2333
|
let r = t.split(/\s+/).filter(Boolean);
|
|
2334
|
-
if (r.length === 0) return
|
|
2335
|
-
let i = r.map((e) => `.${
|
|
2334
|
+
if (r.length === 0) return K.None;
|
|
2335
|
+
let i = r.map((e) => `.${Yn(e)}`).map((e) => RegExp(`(^|[^a-zA-Z0-9_-])${Xn(e)}(?![a-zA-Z0-9_-])`)), a = K.None, o = !1;
|
|
2336
2336
|
for (let e of Array.from(document.styleSheets)) {
|
|
2337
2337
|
let t;
|
|
2338
2338
|
try {
|
|
@@ -2340,18 +2340,18 @@ function Gn(e) {
|
|
|
2340
2340
|
} catch {
|
|
2341
2341
|
continue;
|
|
2342
2342
|
}
|
|
2343
|
-
let n =
|
|
2344
|
-
if (n.mask && (a |= n.mask, a ===
|
|
2343
|
+
let n = Jn(t, i);
|
|
2344
|
+
if (n.mask && (a |= n.mask, a === mn)) break;
|
|
2345
2345
|
o ||= n.sawStyleRule;
|
|
2346
2346
|
}
|
|
2347
|
-
return (a !==
|
|
2347
|
+
return (a !== K.None || o) && gn.set(t, a), a;
|
|
2348
2348
|
}
|
|
2349
|
-
function
|
|
2349
|
+
function Jn(e, t) {
|
|
2350
2350
|
if (!e) return {
|
|
2351
|
-
mask:
|
|
2351
|
+
mask: K.None,
|
|
2352
2352
|
sawStyleRule: !1
|
|
2353
2353
|
};
|
|
2354
|
-
let n =
|
|
2354
|
+
let n = K.None, r = !1;
|
|
2355
2355
|
for (let i = 0; i < e.length; i++) {
|
|
2356
2356
|
let a = e[i];
|
|
2357
2357
|
if (a) {
|
|
@@ -2359,14 +2359,14 @@ function Kn(e, t) {
|
|
|
2359
2359
|
let e = a.selectorText ?? "";
|
|
2360
2360
|
if (!e || !t.some((t) => t.test(e))) continue;
|
|
2361
2361
|
r = !0;
|
|
2362
|
-
for (let t of
|
|
2363
|
-
if (n ===
|
|
2362
|
+
for (let t of pn) t.hints.some((t) => e.includes(t)) && (n |= t.flag);
|
|
2363
|
+
if (n === mn) return {
|
|
2364
2364
|
mask: n,
|
|
2365
2365
|
sawStyleRule: !0
|
|
2366
2366
|
};
|
|
2367
2367
|
} else if ("cssRules" in a) {
|
|
2368
|
-
let e =
|
|
2369
|
-
if (e.mask && (n |= e.mask, n ===
|
|
2368
|
+
let e = Jn(a.cssRules, t);
|
|
2369
|
+
if (e.mask && (n |= e.mask, n === mn)) return {
|
|
2370
2370
|
mask: n,
|
|
2371
2371
|
sawStyleRule: !0
|
|
2372
2372
|
};
|
|
@@ -2379,101 +2379,101 @@ function Kn(e, t) {
|
|
|
2379
2379
|
sawStyleRule: r
|
|
2380
2380
|
};
|
|
2381
2381
|
}
|
|
2382
|
-
function
|
|
2382
|
+
function Yn(e) {
|
|
2383
2383
|
return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/[^a-zA-Z0-9_-]/g, (e) => `\\${e}`);
|
|
2384
2384
|
}
|
|
2385
|
-
function
|
|
2385
|
+
function Xn(e) {
|
|
2386
2386
|
return e.replace(/[.*+?^${}()|[\]\\]/g, (e) => `\\${e}`);
|
|
2387
2387
|
}
|
|
2388
2388
|
//#endregion
|
|
2389
2389
|
//#region src/auth/storage.ts
|
|
2390
|
-
var
|
|
2391
|
-
function
|
|
2390
|
+
var Zn = "ikon-auth-session", Qn = "ikon-auth-refreshable", $n = "ikon-auth-auto-login-attempted-run", er = 6048e5, tr = 6e4;
|
|
2391
|
+
function nr(e) {
|
|
2392
2392
|
try {
|
|
2393
2393
|
let t = e.split(".");
|
|
2394
2394
|
if (t.length !== 3) return !0;
|
|
2395
2395
|
let n = t[1].replace(/-/g, "+").replace(/_/g, "/"), r = n + "=".repeat((4 - n.length % 4) % 4), i = JSON.parse(atob(r));
|
|
2396
|
-
return typeof i.exp == "number" && Date.now() >= i.exp * 1e3 -
|
|
2396
|
+
return typeof i.exp == "number" && Date.now() >= i.exp * 1e3 - tr;
|
|
2397
2397
|
} catch {
|
|
2398
2398
|
return !0;
|
|
2399
2399
|
}
|
|
2400
2400
|
}
|
|
2401
2401
|
function q(e) {
|
|
2402
2402
|
try {
|
|
2403
|
-
localStorage.setItem(
|
|
2403
|
+
localStorage.setItem(Zn, JSON.stringify(e));
|
|
2404
2404
|
} catch {
|
|
2405
2405
|
console.warn("Failed to save auth session to localStorage");
|
|
2406
2406
|
}
|
|
2407
2407
|
}
|
|
2408
|
-
function
|
|
2408
|
+
function rr() {
|
|
2409
2409
|
try {
|
|
2410
|
-
let e = localStorage.getItem(
|
|
2410
|
+
let e = localStorage.getItem(Zn);
|
|
2411
2411
|
if (!e) return null;
|
|
2412
2412
|
let t = JSON.parse(e);
|
|
2413
|
-
return Date.now() - t.authenticatedAt >
|
|
2413
|
+
return Date.now() - t.authenticatedAt > er || nr(t.token) ? (ur(), null) : t;
|
|
2414
2414
|
} catch {
|
|
2415
2415
|
return console.warn("Failed to load auth session from localStorage"), null;
|
|
2416
2416
|
}
|
|
2417
2417
|
}
|
|
2418
|
-
function
|
|
2418
|
+
function ir(e) {
|
|
2419
2419
|
try {
|
|
2420
|
-
localStorage.removeItem(
|
|
2420
|
+
localStorage.removeItem(Zn), localStorage.setItem(Qn, JSON.stringify(e));
|
|
2421
2421
|
} catch {
|
|
2422
2422
|
console.warn("Failed to save the auth session marker to localStorage");
|
|
2423
2423
|
}
|
|
2424
2424
|
}
|
|
2425
|
-
function
|
|
2425
|
+
function ar() {
|
|
2426
2426
|
try {
|
|
2427
|
-
let e = localStorage.getItem(
|
|
2427
|
+
let e = localStorage.getItem(Qn);
|
|
2428
2428
|
if (!e) return null;
|
|
2429
2429
|
let t = JSON.parse(e);
|
|
2430
|
-
return Date.now() - t.renewedAt >
|
|
2430
|
+
return Date.now() - t.renewedAt > er ? (sr(), null) : t;
|
|
2431
2431
|
} catch {
|
|
2432
2432
|
return console.warn("Failed to load the auth session marker from localStorage"), null;
|
|
2433
2433
|
}
|
|
2434
2434
|
}
|
|
2435
|
-
function
|
|
2436
|
-
let e =
|
|
2437
|
-
e &&
|
|
2435
|
+
function or() {
|
|
2436
|
+
let e = ar();
|
|
2437
|
+
e && ir({
|
|
2438
2438
|
...e,
|
|
2439
2439
|
renewedAt: Date.now()
|
|
2440
2440
|
});
|
|
2441
2441
|
}
|
|
2442
|
-
function
|
|
2442
|
+
function sr() {
|
|
2443
2443
|
try {
|
|
2444
|
-
localStorage.removeItem(
|
|
2444
|
+
localStorage.removeItem(Qn);
|
|
2445
2445
|
} catch {
|
|
2446
2446
|
console.warn("Failed to clear the auth session marker from localStorage");
|
|
2447
2447
|
}
|
|
2448
2448
|
}
|
|
2449
|
-
function
|
|
2450
|
-
|
|
2449
|
+
function cr() {
|
|
2450
|
+
rr()?.provider === "anonymous" && ur(), ar()?.provider === "anonymous" && sr();
|
|
2451
2451
|
}
|
|
2452
|
-
function
|
|
2452
|
+
function lr() {
|
|
2453
2453
|
try {
|
|
2454
2454
|
let e = typeof window < "u" ? new URLSearchParams(window.location.search) : void 0;
|
|
2455
2455
|
if (e?.get("ikon_token") || e?.get("ikon_code")) return !0;
|
|
2456
2456
|
} catch {}
|
|
2457
|
-
let e =
|
|
2457
|
+
let e = rr()?.provider ?? ar()?.provider;
|
|
2458
2458
|
return e !== void 0 && e !== "anonymous";
|
|
2459
2459
|
}
|
|
2460
|
-
function
|
|
2460
|
+
function ur() {
|
|
2461
2461
|
try {
|
|
2462
|
-
localStorage.removeItem(
|
|
2462
|
+
localStorage.removeItem(Zn);
|
|
2463
2463
|
} catch {
|
|
2464
2464
|
console.warn("Failed to clear auth session from localStorage");
|
|
2465
2465
|
}
|
|
2466
2466
|
}
|
|
2467
|
-
function
|
|
2467
|
+
function dr(e) {
|
|
2468
2468
|
if (e) try {
|
|
2469
|
-
sessionStorage.setItem(
|
|
2469
|
+
sessionStorage.setItem($n, e);
|
|
2470
2470
|
} catch {
|
|
2471
2471
|
console.warn("Failed to record auto-login attempt in sessionStorage");
|
|
2472
2472
|
}
|
|
2473
2473
|
}
|
|
2474
|
-
function
|
|
2474
|
+
function fr() {
|
|
2475
2475
|
try {
|
|
2476
|
-
return sessionStorage.getItem(
|
|
2476
|
+
return sessionStorage.getItem($n);
|
|
2477
2477
|
} catch {
|
|
2478
2478
|
return null;
|
|
2479
2479
|
}
|
|
@@ -2489,8 +2489,8 @@ function J(e) {
|
|
|
2489
2489
|
}
|
|
2490
2490
|
//#endregion
|
|
2491
2491
|
//#region src/auth/auth-service.ts
|
|
2492
|
-
var
|
|
2493
|
-
async function
|
|
2492
|
+
var pr = 15e3, mr = 15e3, Y = v("AuthService");
|
|
2493
|
+
async function hr(e) {
|
|
2494
2494
|
try {
|
|
2495
2495
|
return await fetch(e, {
|
|
2496
2496
|
method: "GET",
|
|
@@ -2500,9 +2500,9 @@ async function pr(e) {
|
|
|
2500
2500
|
return `no-cors probe ALSO FAILED (${e instanceof Error ? e.name : "Error"}) → origin is unreachable: TLS handshake / certificate, DNS, or network (old browser may not trust this host's cert)`;
|
|
2501
2501
|
}
|
|
2502
2502
|
}
|
|
2503
|
-
var
|
|
2504
|
-
function
|
|
2505
|
-
if (e.headers.get(
|
|
2503
|
+
var gr = "x-ikon-auth-service";
|
|
2504
|
+
function _r(e) {
|
|
2505
|
+
if (e.headers.get(gr) !== null) return !1;
|
|
2506
2506
|
if (e.status === 404 || e.status === 405) return !0;
|
|
2507
2507
|
let t = e.headers.get("content-type") ?? "";
|
|
2508
2508
|
return e.status === 200 && t.includes("text/html");
|
|
@@ -2514,20 +2514,20 @@ async function X(e, t, n) {
|
|
|
2514
2514
|
} catch (i) {
|
|
2515
2515
|
let a = i instanceof Error ? `${i.name}: ${i.message}` : String(i);
|
|
2516
2516
|
if (!s) {
|
|
2517
|
-
let n = await
|
|
2517
|
+
let n = await hr(e);
|
|
2518
2518
|
throw Y.error(`Auth request ${t} could not reach ${r} — ${a}. ${n}`), Error(`Auth request could not reach ${r} (${a}). ${n}`, { cause: i });
|
|
2519
2519
|
}
|
|
2520
2520
|
Y.warn(`Auth request ${t} could not reach ${r} (${a}); falling back to ${s}`);
|
|
2521
2521
|
try {
|
|
2522
2522
|
return await fetch(s, n);
|
|
2523
2523
|
} catch (n) {
|
|
2524
|
-
let i = n instanceof Error ? `${n.name}: ${n.message}` : String(n), o = await
|
|
2524
|
+
let i = n instanceof Error ? `${n.name}: ${n.message}` : String(n), o = await hr(e);
|
|
2525
2525
|
throw Y.error(`Auth request ${t} failed on both ${r} (${a}) and ${s} (${i}). ${o}`), Error(`Auth request unreachable: ${r} (${a}) and ${s} (${i})`, { cause: n });
|
|
2526
2526
|
}
|
|
2527
2527
|
}
|
|
2528
|
-
return a && s !== null &&
|
|
2528
|
+
return a && s !== null && _r(c) ? (Y.warn(`Auth request ${t} got a non-auth-service answer from ${r} (${c.status}); this LB has no /ikon/auth route, falling back to ${s}`), fetch(s, n)) : c;
|
|
2529
2529
|
}
|
|
2530
|
-
async function
|
|
2530
|
+
async function vr(e, t, n) {
|
|
2531
2531
|
let r = ie(), i = n === "guest" ? "anonymous" : n, a = {
|
|
2532
2532
|
method: "POST",
|
|
2533
2533
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2550,7 +2550,7 @@ async function gr(e, t, n) {
|
|
|
2550
2550
|
};
|
|
2551
2551
|
return q(l), l;
|
|
2552
2552
|
}
|
|
2553
|
-
async function
|
|
2553
|
+
async function yr({ email: e, spaceId: t, authUrl: n }) {
|
|
2554
2554
|
let r = await X(n, "/email/send", {
|
|
2555
2555
|
method: "POST",
|
|
2556
2556
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2558,14 +2558,14 @@ async function _r({ email: e, spaceId: t, authUrl: n }) {
|
|
|
2558
2558
|
email: e.trim(),
|
|
2559
2559
|
space: t
|
|
2560
2560
|
}),
|
|
2561
|
-
signal: g(
|
|
2561
|
+
signal: g(pr)
|
|
2562
2562
|
});
|
|
2563
2563
|
if (!r.ok) {
|
|
2564
2564
|
let e = await r.text().catch(() => "Failed to send login code");
|
|
2565
2565
|
throw Error(e);
|
|
2566
2566
|
}
|
|
2567
2567
|
}
|
|
2568
|
-
async function
|
|
2568
|
+
async function br({ email: e, code: t, authUrl: n }) {
|
|
2569
2569
|
let r = await X(n, "/email/code", {
|
|
2570
2570
|
method: "POST",
|
|
2571
2571
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2573,7 +2573,7 @@ async function vr({ email: e, code: t, authUrl: n }) {
|
|
|
2573
2573
|
email: e.trim(),
|
|
2574
2574
|
code: t.trim()
|
|
2575
2575
|
}),
|
|
2576
|
-
signal: g(
|
|
2576
|
+
signal: g(pr)
|
|
2577
2577
|
});
|
|
2578
2578
|
if (!r.ok) {
|
|
2579
2579
|
let e = await r.text().catch(() => "Invalid code");
|
|
@@ -2586,22 +2586,22 @@ async function vr({ email: e, code: t, authUrl: n }) {
|
|
|
2586
2586
|
};
|
|
2587
2587
|
return q(a), a;
|
|
2588
2588
|
}
|
|
2589
|
-
function
|
|
2589
|
+
function xr() {
|
|
2590
2590
|
let e = new URLSearchParams(window.location.search), t = e.get("ikon_token"), n = e.get("ikon_provider");
|
|
2591
2591
|
return t && n ? {
|
|
2592
2592
|
token: t,
|
|
2593
2593
|
provider: n
|
|
2594
2594
|
} : null;
|
|
2595
2595
|
}
|
|
2596
|
-
function
|
|
2596
|
+
function Sr() {
|
|
2597
2597
|
let e = new URLSearchParams(window.location.search), t = e.get("ikon_code"), n = e.get("ikon_provider");
|
|
2598
2598
|
return t && n ? {
|
|
2599
2599
|
code: t,
|
|
2600
2600
|
provider: n
|
|
2601
2601
|
} : null;
|
|
2602
2602
|
}
|
|
2603
|
-
async function
|
|
2604
|
-
let r =
|
|
2603
|
+
async function Cr(e, t, n) {
|
|
2604
|
+
let r = pe();
|
|
2605
2605
|
if (!r) throw Error("This sign-in was started in a different browser or tab");
|
|
2606
2606
|
let i = await X(await b(n), "/oauth/exchange", {
|
|
2607
2607
|
method: "POST",
|
|
@@ -2611,7 +2611,7 @@ async function xr(e, t, n) {
|
|
|
2611
2611
|
codeVerifier: r,
|
|
2612
2612
|
supportsRefresh: !0
|
|
2613
2613
|
}),
|
|
2614
|
-
signal: g(
|
|
2614
|
+
signal: g(pr)
|
|
2615
2615
|
});
|
|
2616
2616
|
if (!i.ok) throw Error("Could not complete the sign-in");
|
|
2617
2617
|
let { token: a, expiresAt: o } = await i.json(), s = {
|
|
@@ -2620,20 +2620,20 @@ async function xr(e, t, n) {
|
|
|
2620
2620
|
authenticatedAt: Date.now(),
|
|
2621
2621
|
expiresAt: o
|
|
2622
2622
|
};
|
|
2623
|
-
return o ?
|
|
2623
|
+
return o ? ir({
|
|
2624
2624
|
provider: t,
|
|
2625
2625
|
authenticatedAt: s.authenticatedAt,
|
|
2626
2626
|
renewedAt: s.authenticatedAt
|
|
2627
2627
|
}) : q(s), s;
|
|
2628
2628
|
}
|
|
2629
|
-
async function
|
|
2629
|
+
async function wr(e) {
|
|
2630
2630
|
let t = C();
|
|
2631
2631
|
if (t === null) return null;
|
|
2632
2632
|
let n;
|
|
2633
2633
|
try {
|
|
2634
2634
|
n = await fetch(`${t}/session/refresh`, {
|
|
2635
2635
|
method: "POST",
|
|
2636
|
-
signal: g(
|
|
2636
|
+
signal: g(mr)
|
|
2637
2637
|
});
|
|
2638
2638
|
} catch (e) {
|
|
2639
2639
|
let n = e instanceof Error ? `${e.name}: ${e.message}` : String(e);
|
|
@@ -2649,25 +2649,25 @@ async function Sr(e) {
|
|
|
2649
2649
|
expiresAt: i
|
|
2650
2650
|
};
|
|
2651
2651
|
}
|
|
2652
|
-
function
|
|
2652
|
+
function Tr() {
|
|
2653
2653
|
let e = new URLSearchParams(window.location.search), t = e.get("error");
|
|
2654
2654
|
return t ? {
|
|
2655
2655
|
code: t,
|
|
2656
2656
|
provider: e.get("ikon_provider")
|
|
2657
2657
|
} : null;
|
|
2658
2658
|
}
|
|
2659
|
-
function
|
|
2659
|
+
function Er() {
|
|
2660
2660
|
return typeof window > "u" ? !1 : new URLSearchParams(window.location.search).has("ikon-signed-out");
|
|
2661
2661
|
}
|
|
2662
|
-
var
|
|
2662
|
+
var Dr = {
|
|
2663
2663
|
google: "Google",
|
|
2664
2664
|
facebook: "Facebook",
|
|
2665
2665
|
apple: "Apple",
|
|
2666
2666
|
microsoft: "Microsoft",
|
|
2667
2667
|
signicat: "eID"
|
|
2668
2668
|
};
|
|
2669
|
-
function
|
|
2670
|
-
let r = t ?
|
|
2669
|
+
function Or(e, t, n) {
|
|
2670
|
+
let r = t ? Dr[t] ?? t : "this provider";
|
|
2671
2671
|
switch (e) {
|
|
2672
2672
|
case "account_exists_unverified_email": {
|
|
2673
2673
|
let e = `This email address already has an account on this app that uses a different sign-in method. For security, ${r} sign-in can't be connected to it automatically.`;
|
|
@@ -2678,7 +2678,7 @@ function Er(e, t, n) {
|
|
|
2678
2678
|
default: return e;
|
|
2679
2679
|
}
|
|
2680
2680
|
}
|
|
2681
|
-
function
|
|
2681
|
+
function kr() {
|
|
2682
2682
|
let e = new URLSearchParams(window.location.search);
|
|
2683
2683
|
for (let t of [
|
|
2684
2684
|
"ikon_token",
|
|
@@ -2689,11 +2689,11 @@ function Dr() {
|
|
|
2689
2689
|
let t = e.toString();
|
|
2690
2690
|
window.history.replaceState({}, "", t.length > 0 ? `${window.location.pathname}?${t}` : window.location.pathname);
|
|
2691
2691
|
}
|
|
2692
|
-
async function
|
|
2692
|
+
async function Ar(e, t, n, r) {
|
|
2693
2693
|
let i = r ?? window.location.origin + window.location.pathname + window.location.search, a = await y(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
|
|
2694
2694
|
return `${n}/oauth/${e}?space=${encodeURIComponent(t)}&return=${encodeURIComponent(i)}${o}`;
|
|
2695
2695
|
}
|
|
2696
|
-
async function
|
|
2696
|
+
async function jr(e) {
|
|
2697
2697
|
let t = await X(e, "/passkey/registration/options", {
|
|
2698
2698
|
method: "POST",
|
|
2699
2699
|
headers: { "Content-Type": "application/json" }
|
|
@@ -2704,7 +2704,7 @@ async function kr(e) {
|
|
|
2704
2704
|
}
|
|
2705
2705
|
return t.json();
|
|
2706
2706
|
}
|
|
2707
|
-
async function
|
|
2707
|
+
async function Mr(e, t, n) {
|
|
2708
2708
|
let r = await X(e, "/passkey/registration/verify", {
|
|
2709
2709
|
method: "POST",
|
|
2710
2710
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2724,7 +2724,7 @@ async function Ar(e, t, n) {
|
|
|
2724
2724
|
};
|
|
2725
2725
|
return q(a), a;
|
|
2726
2726
|
}
|
|
2727
|
-
async function
|
|
2727
|
+
async function Nr(e, t) {
|
|
2728
2728
|
let n = await X(e, "/passkey/authentication/options", {
|
|
2729
2729
|
method: "POST",
|
|
2730
2730
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2736,7 +2736,7 @@ async function jr(e, t) {
|
|
|
2736
2736
|
}
|
|
2737
2737
|
return n.json();
|
|
2738
2738
|
}
|
|
2739
|
-
async function
|
|
2739
|
+
async function Pr(e, t) {
|
|
2740
2740
|
let n = await X(e, "/passkey/authentication/verify", {
|
|
2741
2741
|
method: "POST",
|
|
2742
2742
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2753,62 +2753,15 @@ async function Mr(e, t) {
|
|
|
2753
2753
|
};
|
|
2754
2754
|
return q(i), i;
|
|
2755
2755
|
}
|
|
2756
|
-
async function
|
|
2756
|
+
async function Fr(e, t) {
|
|
2757
2757
|
try {
|
|
2758
2758
|
await X(await b(t), "/logout", {
|
|
2759
2759
|
method: "POST",
|
|
2760
2760
|
headers: { Authorization: `Bearer ${e}` },
|
|
2761
|
-
signal: g(
|
|
2761
|
+
signal: g(pr)
|
|
2762
2762
|
});
|
|
2763
2763
|
} catch {}
|
|
2764
2764
|
}
|
|
2765
|
-
var Pr = "/oauth/popup-callback", Fr = 3e5;
|
|
2766
|
-
function Ir() {
|
|
2767
|
-
try {
|
|
2768
|
-
return window.top !== window.self;
|
|
2769
|
-
} catch {
|
|
2770
|
-
return !0;
|
|
2771
|
-
}
|
|
2772
|
-
}
|
|
2773
|
-
async function Lr(e, t) {
|
|
2774
|
-
let n = window.open("about:blank", "ikon-oauth", "popup,width=520,height=680");
|
|
2775
|
-
if (!n) throw Error("The sign-in window was blocked. Allow pop-ups for this site and try again.");
|
|
2776
|
-
let r;
|
|
2777
|
-
try {
|
|
2778
|
-
r = await S();
|
|
2779
|
-
let i = `${r}${Pr}`;
|
|
2780
|
-
n.location.href = await Or(e, t, r, i);
|
|
2781
|
-
} catch (e) {
|
|
2782
|
-
throw n.close(), e;
|
|
2783
|
-
}
|
|
2784
|
-
let i = r;
|
|
2785
|
-
return await new Promise((t, r) => {
|
|
2786
|
-
let a = !1, o = (e) => {
|
|
2787
|
-
a || (a = !0, window.removeEventListener("message", s), window.clearInterval(c), window.clearTimeout(l), e());
|
|
2788
|
-
}, s = (n) => {
|
|
2789
|
-
if (n.origin !== i) return;
|
|
2790
|
-
let a = n.data;
|
|
2791
|
-
if (!a || a.source !== "ikon-oauth-popup") return;
|
|
2792
|
-
if (a.error || !a.code) {
|
|
2793
|
-
o(() => r(Error(a.error || "The sign-in did not complete")));
|
|
2794
|
-
return;
|
|
2795
|
-
}
|
|
2796
|
-
let s = a.code, c = a.provider ?? e;
|
|
2797
|
-
o(() => t({
|
|
2798
|
-
code: s,
|
|
2799
|
-
provider: c
|
|
2800
|
-
}));
|
|
2801
|
-
};
|
|
2802
|
-
window.addEventListener("message", s);
|
|
2803
|
-
let c = window.setInterval(() => {
|
|
2804
|
-
n.closed && o(() => r(/* @__PURE__ */ Error("The sign-in window was closed before it finished")));
|
|
2805
|
-
}, 500), l = window.setTimeout(() => {
|
|
2806
|
-
o(() => {
|
|
2807
|
-
n.close(), r(/* @__PURE__ */ Error("The sign-in timed out"));
|
|
2808
|
-
});
|
|
2809
|
-
}, Fr);
|
|
2810
|
-
});
|
|
2811
|
-
}
|
|
2812
2765
|
//#endregion
|
|
2813
2766
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/bufferToBase64URLString.js
|
|
2814
2767
|
function Z(e) {
|
|
@@ -2818,30 +2771,30 @@ function Z(e) {
|
|
|
2818
2771
|
}
|
|
2819
2772
|
//#endregion
|
|
2820
2773
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/base64URLStringToBuffer.js
|
|
2821
|
-
function
|
|
2774
|
+
function Ir(e) {
|
|
2822
2775
|
let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = (4 - t.length % 4) % 4, r = t.padEnd(t.length + n, "="), i = atob(r), a = new ArrayBuffer(i.length), o = new Uint8Array(a);
|
|
2823
2776
|
for (let e = 0; e < i.length; e++) o[e] = i.charCodeAt(e);
|
|
2824
2777
|
return a;
|
|
2825
2778
|
}
|
|
2826
2779
|
//#endregion
|
|
2827
2780
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthn.js
|
|
2828
|
-
function
|
|
2829
|
-
return
|
|
2781
|
+
function Lr() {
|
|
2782
|
+
return Rr.stubThis(globalThis?.PublicKeyCredential !== void 0 && typeof globalThis.PublicKeyCredential == "function");
|
|
2830
2783
|
}
|
|
2831
|
-
var
|
|
2784
|
+
var Rr = { stubThis: (e) => e };
|
|
2832
2785
|
//#endregion
|
|
2833
2786
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/toPublicKeyCredentialDescriptor.js
|
|
2834
|
-
function
|
|
2787
|
+
function zr(e) {
|
|
2835
2788
|
let { id: t } = e;
|
|
2836
2789
|
return {
|
|
2837
2790
|
...e,
|
|
2838
|
-
id:
|
|
2791
|
+
id: Ir(t),
|
|
2839
2792
|
transports: e.transports
|
|
2840
2793
|
};
|
|
2841
2794
|
}
|
|
2842
2795
|
//#endregion
|
|
2843
2796
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/isValidDomain.js
|
|
2844
|
-
function
|
|
2797
|
+
function Br(e) {
|
|
2845
2798
|
return e === "localhost" || /^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e);
|
|
2846
2799
|
}
|
|
2847
2800
|
//#endregion
|
|
@@ -2858,7 +2811,7 @@ var Q = class extends Error {
|
|
|
2858
2811
|
};
|
|
2859
2812
|
//#endregion
|
|
2860
2813
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/identifyRegistrationError.js
|
|
2861
|
-
function
|
|
2814
|
+
function Vr({ error: e, options: t }) {
|
|
2862
2815
|
let { publicKey: n } = t;
|
|
2863
2816
|
if (!n) throw Error("options was missing required publicKey property");
|
|
2864
2817
|
if (e.name === "AbortError") {
|
|
@@ -2904,7 +2857,7 @@ function Ur({ error: e, options: t }) {
|
|
|
2904
2857
|
});
|
|
2905
2858
|
else if (e.name === "SecurityError") {
|
|
2906
2859
|
let t = globalThis.location.hostname;
|
|
2907
|
-
if (!
|
|
2860
|
+
if (!Br(t)) return new Q({
|
|
2908
2861
|
message: `${globalThis.location.hostname} is an invalid domain`,
|
|
2909
2862
|
code: "ERROR_INVALID_DOMAIN",
|
|
2910
2863
|
cause: e
|
|
@@ -2927,7 +2880,7 @@ function Ur({ error: e, options: t }) {
|
|
|
2927
2880
|
});
|
|
2928
2881
|
return e;
|
|
2929
2882
|
}
|
|
2930
|
-
var
|
|
2883
|
+
var Hr = new class {
|
|
2931
2884
|
constructor() {
|
|
2932
2885
|
Object.defineProperty(this, "controller", {
|
|
2933
2886
|
enumerable: !0,
|
|
@@ -2950,31 +2903,31 @@ var Wr = new class {
|
|
|
2950
2903
|
e.name = "AbortError", this.controller.abort(e), this.controller = void 0;
|
|
2951
2904
|
}
|
|
2952
2905
|
}
|
|
2953
|
-
}(),
|
|
2954
|
-
function
|
|
2955
|
-
if (e && !(
|
|
2906
|
+
}(), Ur = ["cross-platform", "platform"];
|
|
2907
|
+
function Wr(e) {
|
|
2908
|
+
if (e && !(Ur.indexOf(e) < 0)) return e;
|
|
2956
2909
|
}
|
|
2957
2910
|
//#endregion
|
|
2958
2911
|
//#region ../../node_modules/@simplewebauthn/browser/esm/methods/startRegistration.js
|
|
2959
|
-
async function
|
|
2912
|
+
async function Gr(e) {
|
|
2960
2913
|
!e.optionsJSON && e.challenge && (console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."), e = { optionsJSON: e });
|
|
2961
2914
|
let { optionsJSON: t, useAutoRegister: n = !1 } = e;
|
|
2962
|
-
if (!
|
|
2915
|
+
if (!Lr()) throw Error("WebAuthn is not supported in this browser");
|
|
2963
2916
|
let r = {
|
|
2964
2917
|
...t,
|
|
2965
|
-
challenge:
|
|
2918
|
+
challenge: Ir(t.challenge),
|
|
2966
2919
|
user: {
|
|
2967
2920
|
...t.user,
|
|
2968
|
-
id:
|
|
2921
|
+
id: Ir(t.user.id)
|
|
2969
2922
|
},
|
|
2970
|
-
excludeCredentials: t.excludeCredentials?.map(
|
|
2923
|
+
excludeCredentials: t.excludeCredentials?.map(zr)
|
|
2971
2924
|
}, i = {};
|
|
2972
|
-
n && (i.mediation = "conditional"), i.publicKey = r, i.signal =
|
|
2925
|
+
n && (i.mediation = "conditional"), i.publicKey = r, i.signal = Hr.createNewAbortSignal();
|
|
2973
2926
|
let a;
|
|
2974
2927
|
try {
|
|
2975
2928
|
a = await navigator.credentials.create(i);
|
|
2976
2929
|
} catch (e) {
|
|
2977
|
-
throw
|
|
2930
|
+
throw Vr({
|
|
2978
2931
|
error: e,
|
|
2979
2932
|
options: i
|
|
2980
2933
|
});
|
|
@@ -2986,20 +2939,20 @@ async function qr(e) {
|
|
|
2986
2939
|
if (typeof c.getPublicKeyAlgorithm == "function") try {
|
|
2987
2940
|
d = c.getPublicKeyAlgorithm();
|
|
2988
2941
|
} catch (e) {
|
|
2989
|
-
|
|
2942
|
+
Kr("getPublicKeyAlgorithm()", e);
|
|
2990
2943
|
}
|
|
2991
2944
|
let f;
|
|
2992
2945
|
if (typeof c.getPublicKey == "function") try {
|
|
2993
2946
|
let e = c.getPublicKey();
|
|
2994
2947
|
e !== null && (f = Z(e));
|
|
2995
2948
|
} catch (e) {
|
|
2996
|
-
|
|
2949
|
+
Kr("getPublicKey()", e);
|
|
2997
2950
|
}
|
|
2998
2951
|
let p;
|
|
2999
2952
|
if (typeof c.getAuthenticatorData == "function") try {
|
|
3000
2953
|
p = Z(c.getAuthenticatorData());
|
|
3001
2954
|
} catch (e) {
|
|
3002
|
-
|
|
2955
|
+
Kr("getAuthenticatorData()", e);
|
|
3003
2956
|
}
|
|
3004
2957
|
return {
|
|
3005
2958
|
id: o,
|
|
@@ -3014,23 +2967,23 @@ async function qr(e) {
|
|
|
3014
2967
|
},
|
|
3015
2968
|
type: l,
|
|
3016
2969
|
clientExtensionResults: a.getClientExtensionResults(),
|
|
3017
|
-
authenticatorAttachment:
|
|
2970
|
+
authenticatorAttachment: Wr(a.authenticatorAttachment)
|
|
3018
2971
|
};
|
|
3019
2972
|
}
|
|
3020
|
-
function
|
|
2973
|
+
function Kr(e, t) {
|
|
3021
2974
|
console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`, t);
|
|
3022
2975
|
}
|
|
3023
2976
|
//#endregion
|
|
3024
2977
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthnAutofill.js
|
|
3025
|
-
function
|
|
3026
|
-
if (!
|
|
2978
|
+
function qr() {
|
|
2979
|
+
if (!Lr()) return Jr.stubThis(new Promise((e) => e(!1)));
|
|
3027
2980
|
let e = globalThis.PublicKeyCredential;
|
|
3028
|
-
return e?.isConditionalMediationAvailable === void 0 ?
|
|
2981
|
+
return e?.isConditionalMediationAvailable === void 0 ? Jr.stubThis(new Promise((e) => e(!1))) : Jr.stubThis(e.isConditionalMediationAvailable());
|
|
3029
2982
|
}
|
|
3030
|
-
var
|
|
2983
|
+
var Jr = { stubThis: (e) => e };
|
|
3031
2984
|
//#endregion
|
|
3032
2985
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/identifyAuthenticationError.js
|
|
3033
|
-
function
|
|
2986
|
+
function Yr({ error: e, options: t }) {
|
|
3034
2987
|
let { publicKey: n } = t;
|
|
3035
2988
|
if (!n) throw Error("options was missing required publicKey property");
|
|
3036
2989
|
if (e.name === "AbortError") {
|
|
@@ -3046,7 +2999,7 @@ function Zr({ error: e, options: t }) {
|
|
|
3046
2999
|
});
|
|
3047
3000
|
else if (e.name === "SecurityError") {
|
|
3048
3001
|
let t = globalThis.location.hostname;
|
|
3049
|
-
if (!
|
|
3002
|
+
if (!Br(t)) return new Q({
|
|
3050
3003
|
message: `${globalThis.location.hostname} is an invalid domain`,
|
|
3051
3004
|
code: "ERROR_INVALID_DOMAIN",
|
|
3052
3005
|
cause: e
|
|
@@ -3065,28 +3018,28 @@ function Zr({ error: e, options: t }) {
|
|
|
3065
3018
|
}
|
|
3066
3019
|
//#endregion
|
|
3067
3020
|
//#region ../../node_modules/@simplewebauthn/browser/esm/methods/startAuthentication.js
|
|
3068
|
-
async function
|
|
3021
|
+
async function Xr(e) {
|
|
3069
3022
|
!e.optionsJSON && e.challenge && (console.warn("startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."), e = { optionsJSON: e });
|
|
3070
3023
|
let { optionsJSON: t, useBrowserAutofill: n = !1, verifyBrowserAutofillInput: r = !0 } = e;
|
|
3071
|
-
if (!
|
|
3024
|
+
if (!Lr()) throw Error("WebAuthn is not supported in this browser");
|
|
3072
3025
|
let i;
|
|
3073
|
-
t.allowCredentials?.length !== 0 && (i = t.allowCredentials?.map(
|
|
3026
|
+
t.allowCredentials?.length !== 0 && (i = t.allowCredentials?.map(zr));
|
|
3074
3027
|
let a = {
|
|
3075
3028
|
...t,
|
|
3076
|
-
challenge:
|
|
3029
|
+
challenge: Ir(t.challenge),
|
|
3077
3030
|
allowCredentials: i
|
|
3078
3031
|
}, o = {};
|
|
3079
3032
|
if (n) {
|
|
3080
|
-
if (!await
|
|
3033
|
+
if (!await qr()) throw Error("Browser does not support WebAuthn autofill");
|
|
3081
3034
|
if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1 && r) throw Error("No <input> with \"webauthn\" as the only or last value in its `autocomplete` attribute was detected");
|
|
3082
3035
|
o.mediation = "conditional", a.allowCredentials = [];
|
|
3083
3036
|
}
|
|
3084
|
-
o.publicKey = a, o.signal =
|
|
3037
|
+
o.publicKey = a, o.signal = Hr.createNewAbortSignal();
|
|
3085
3038
|
let s;
|
|
3086
3039
|
try {
|
|
3087
3040
|
s = await navigator.credentials.get(o);
|
|
3088
3041
|
} catch (e) {
|
|
3089
|
-
throw
|
|
3042
|
+
throw Yr({
|
|
3090
3043
|
error: e,
|
|
3091
3044
|
options: o
|
|
3092
3045
|
});
|
|
@@ -3104,13 +3057,13 @@ async function Qr(e) {
|
|
|
3104
3057
|
},
|
|
3105
3058
|
type: d,
|
|
3106
3059
|
clientExtensionResults: s.getClientExtensionResults(),
|
|
3107
|
-
authenticatorAttachment:
|
|
3060
|
+
authenticatorAttachment: Wr(s.authenticatorAttachment)
|
|
3108
3061
|
};
|
|
3109
3062
|
}
|
|
3110
3063
|
//#endregion
|
|
3111
3064
|
//#region src/auth/auth-context.tsx
|
|
3112
|
-
var
|
|
3113
|
-
function
|
|
3065
|
+
var Zr = he(null), Qr = 12e4;
|
|
3066
|
+
function $r({ children: e, config: n }) {
|
|
3114
3067
|
let [r, i] = M({
|
|
3115
3068
|
isAuthenticated: !1,
|
|
3116
3069
|
isLoading: !0,
|
|
@@ -3120,9 +3073,9 @@ function ti({ children: e, config: n }) {
|
|
|
3120
3073
|
if (!c.current) {
|
|
3121
3074
|
c.current = !0;
|
|
3122
3075
|
try {
|
|
3123
|
-
let t = await
|
|
3076
|
+
let t = await wr(e);
|
|
3124
3077
|
if (t === null) {
|
|
3125
|
-
|
|
3078
|
+
sr(), i({
|
|
3126
3079
|
isAuthenticated: !1,
|
|
3127
3080
|
isLoading: !1,
|
|
3128
3081
|
user: null,
|
|
@@ -3130,7 +3083,7 @@ function ti({ children: e, config: n }) {
|
|
|
3130
3083
|
});
|
|
3131
3084
|
return;
|
|
3132
3085
|
}
|
|
3133
|
-
|
|
3086
|
+
or(), i({
|
|
3134
3087
|
isAuthenticated: !0,
|
|
3135
3088
|
isLoading: !1,
|
|
3136
3089
|
user: J(t),
|
|
@@ -3144,23 +3097,23 @@ function ti({ children: e, config: n }) {
|
|
|
3144
3097
|
k(() => {
|
|
3145
3098
|
(() => {
|
|
3146
3099
|
if (s.current) return;
|
|
3147
|
-
let e = n.devLoginRunId, t = !!e &&
|
|
3148
|
-
e && !
|
|
3149
|
-
let r = !!n.devLoginToken && !!e && !t && !
|
|
3150
|
-
o ||
|
|
3151
|
-
let c =
|
|
3100
|
+
let e = n.devLoginRunId, t = !!e && fr() === e;
|
|
3101
|
+
e && !Er() && dr(e);
|
|
3102
|
+
let r = !!n.devLoginToken && !!e && !t && !nr(n.devLoginToken) && !Er();
|
|
3103
|
+
o || cr();
|
|
3104
|
+
let c = Tr();
|
|
3152
3105
|
if (c) {
|
|
3153
|
-
|
|
3106
|
+
kr(), i({
|
|
3154
3107
|
isAuthenticated: !1,
|
|
3155
3108
|
isLoading: !1,
|
|
3156
3109
|
user: null,
|
|
3157
|
-
error:
|
|
3110
|
+
error: Or(c.code, c.provider, { emailSignInAvailable: a })
|
|
3158
3111
|
});
|
|
3159
3112
|
return;
|
|
3160
3113
|
}
|
|
3161
|
-
let l =
|
|
3114
|
+
let l = Sr();
|
|
3162
3115
|
if (l) {
|
|
3163
|
-
s.current = !0,
|
|
3116
|
+
s.current = !0, kr(), Cr(l.code, l.provider, n.authUrl).then((e) => {
|
|
3164
3117
|
i({
|
|
3165
3118
|
isAuthenticated: !0,
|
|
3166
3119
|
isLoading: !1,
|
|
@@ -3177,14 +3130,14 @@ function ti({ children: e, config: n }) {
|
|
|
3177
3130
|
});
|
|
3178
3131
|
return;
|
|
3179
3132
|
}
|
|
3180
|
-
let u =
|
|
3133
|
+
let u = xr();
|
|
3181
3134
|
if (u) {
|
|
3182
3135
|
let e = {
|
|
3183
3136
|
token: u.token,
|
|
3184
3137
|
provider: u.provider,
|
|
3185
3138
|
authenticatedAt: Date.now()
|
|
3186
3139
|
};
|
|
3187
|
-
q(e),
|
|
3140
|
+
q(e), kr(), i({
|
|
3188
3141
|
isAuthenticated: !0,
|
|
3189
3142
|
isLoading: !1,
|
|
3190
3143
|
user: J(e),
|
|
@@ -3192,11 +3145,11 @@ function ti({ children: e, config: n }) {
|
|
|
3192
3145
|
});
|
|
3193
3146
|
return;
|
|
3194
3147
|
}
|
|
3195
|
-
let d =
|
|
3148
|
+
let d = ar();
|
|
3196
3149
|
if (d) {
|
|
3197
|
-
s.current = !0,
|
|
3150
|
+
s.current = !0, wr(d).then((e) => {
|
|
3198
3151
|
if (e === null) {
|
|
3199
|
-
|
|
3152
|
+
sr(), i({
|
|
3200
3153
|
isAuthenticated: !1,
|
|
3201
3154
|
isLoading: !1,
|
|
3202
3155
|
user: null,
|
|
@@ -3204,7 +3157,7 @@ function ti({ children: e, config: n }) {
|
|
|
3204
3157
|
});
|
|
3205
3158
|
return;
|
|
3206
3159
|
}
|
|
3207
|
-
|
|
3160
|
+
or(), i({
|
|
3208
3161
|
isAuthenticated: !0,
|
|
3209
3162
|
isLoading: !1,
|
|
3210
3163
|
user: J(e),
|
|
@@ -3220,7 +3173,7 @@ function ti({ children: e, config: n }) {
|
|
|
3220
3173
|
});
|
|
3221
3174
|
return;
|
|
3222
3175
|
}
|
|
3223
|
-
let f =
|
|
3176
|
+
let f = rr();
|
|
3224
3177
|
if (f && !(r && f.provider === "anonymous")) {
|
|
3225
3178
|
i({
|
|
3226
3179
|
isAuthenticated: !0,
|
|
@@ -3260,9 +3213,9 @@ function ti({ children: e, config: n }) {
|
|
|
3260
3213
|
]), k(() => {
|
|
3261
3214
|
let e = r.user?.expiresAt;
|
|
3262
3215
|
if (!e) return;
|
|
3263
|
-
let t =
|
|
3216
|
+
let t = ar();
|
|
3264
3217
|
if (!t) return;
|
|
3265
|
-
let n = Date.parse(e) -
|
|
3218
|
+
let n = Date.parse(e) - Qr, i = setTimeout(() => void l(t), Math.max(0, n - Date.now())), a = () => {
|
|
3266
3219
|
document.visibilityState === "visible" && Date.now() >= n && l(t);
|
|
3267
3220
|
};
|
|
3268
3221
|
return document.addEventListener("visibilitychange", a), () => {
|
|
@@ -3294,7 +3247,7 @@ function ti({ children: e, config: n }) {
|
|
|
3294
3247
|
isLoading: !0
|
|
3295
3248
|
}));
|
|
3296
3249
|
try {
|
|
3297
|
-
let r = await
|
|
3250
|
+
let r = await vr(n.spaceId, t, e);
|
|
3298
3251
|
i({
|
|
3299
3252
|
isAuthenticated: !0,
|
|
3300
3253
|
isLoading: !1,
|
|
@@ -3317,7 +3270,7 @@ function ti({ children: e, config: n }) {
|
|
|
3317
3270
|
error: null
|
|
3318
3271
|
}));
|
|
3319
3272
|
try {
|
|
3320
|
-
let e = await
|
|
3273
|
+
let e = await Xr({ optionsJSON: await Nr(t) }), n = await Pr(t, e);
|
|
3321
3274
|
i({
|
|
3322
3275
|
isAuthenticated: !0,
|
|
3323
3276
|
isLoading: !1,
|
|
@@ -3334,32 +3287,22 @@ function ti({ children: e, config: n }) {
|
|
|
3334
3287
|
return;
|
|
3335
3288
|
}
|
|
3336
3289
|
if (e === "email") throw Error("login('email') is not supported. Use requestEmailCode()/submitEmailCode() from useAuth() instead.");
|
|
3337
|
-
if (
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
user: J(a),
|
|
3344
|
-
error: null
|
|
3345
|
-
});
|
|
3346
|
-
} catch (e) {
|
|
3347
|
-
i((t) => ({
|
|
3348
|
-
...t,
|
|
3349
|
-
isLoading: !1,
|
|
3350
|
-
error: e instanceof Error ? e.message : "Sign-in failed"
|
|
3351
|
-
}));
|
|
3352
|
-
}
|
|
3290
|
+
if (w()) {
|
|
3291
|
+
await E(e, n.spaceId) || i((e) => ({
|
|
3292
|
+
...e,
|
|
3293
|
+
isLoading: !1,
|
|
3294
|
+
error: "The sign-in window did not complete. Allow pop-ups for this site and try again."
|
|
3295
|
+
}));
|
|
3353
3296
|
return;
|
|
3354
3297
|
}
|
|
3355
|
-
window.location.href = await
|
|
3298
|
+
window.location.href = await Ar(e, n.spaceId, t);
|
|
3356
3299
|
}, [n.authUrl, n.spaceId]), d = O(async (e) => {
|
|
3357
3300
|
if (!n.spaceId) throw i((e) => ({
|
|
3358
3301
|
...e,
|
|
3359
3302
|
error: "Space ID is not configured"
|
|
3360
3303
|
})), Error("Space ID is not configured");
|
|
3361
3304
|
let t = await b(n.authUrl);
|
|
3362
|
-
await
|
|
3305
|
+
await yr({
|
|
3363
3306
|
email: e,
|
|
3364
3307
|
spaceId: n.spaceId,
|
|
3365
3308
|
authUrl: t
|
|
@@ -3371,7 +3314,7 @@ function ti({ children: e, config: n }) {
|
|
|
3371
3314
|
error: null
|
|
3372
3315
|
}));
|
|
3373
3316
|
try {
|
|
3374
|
-
let r = await
|
|
3317
|
+
let r = await br({
|
|
3375
3318
|
email: e,
|
|
3376
3319
|
code: t,
|
|
3377
3320
|
authUrl: await b(n.authUrl)
|
|
@@ -3392,7 +3335,7 @@ function ti({ children: e, config: n }) {
|
|
|
3392
3335
|
}
|
|
3393
3336
|
}, [n.authUrl]), p = O(() => {
|
|
3394
3337
|
let e = r.user?.token;
|
|
3395
|
-
e &&
|
|
3338
|
+
e && Fr(e, n.authUrl), ur(), sr(), t.clearAll(), i({
|
|
3396
3339
|
isAuthenticated: !1,
|
|
3397
3340
|
isLoading: !1,
|
|
3398
3341
|
user: null,
|
|
@@ -3406,7 +3349,7 @@ function ti({ children: e, config: n }) {
|
|
|
3406
3349
|
error: null
|
|
3407
3350
|
}));
|
|
3408
3351
|
try {
|
|
3409
|
-
let n = await
|
|
3352
|
+
let n = await Mr(t, await Gr({ optionsJSON: await jr(t) }), e);
|
|
3410
3353
|
i({
|
|
3411
3354
|
isAuthenticated: !0,
|
|
3412
3355
|
isLoading: !1,
|
|
@@ -3437,36 +3380,39 @@ function ti({ children: e, config: n }) {
|
|
|
3437
3380
|
d,
|
|
3438
3381
|
f
|
|
3439
3382
|
]);
|
|
3440
|
-
return /* @__PURE__ */ P(
|
|
3383
|
+
return /* @__PURE__ */ P(Zr, {
|
|
3441
3384
|
value: g,
|
|
3442
3385
|
children: e
|
|
3443
3386
|
});
|
|
3444
3387
|
}
|
|
3445
|
-
function
|
|
3446
|
-
let e =
|
|
3388
|
+
function ei() {
|
|
3389
|
+
let e = ge(Zr);
|
|
3447
3390
|
if (!e) throw Error("useAuth must be used within an AuthProvider");
|
|
3448
3391
|
return e;
|
|
3449
3392
|
}
|
|
3450
|
-
function
|
|
3451
|
-
return
|
|
3393
|
+
function ti() {
|
|
3394
|
+
return ge(Zr);
|
|
3452
3395
|
}
|
|
3453
3396
|
//#endregion
|
|
3454
3397
|
//#region src/auth/oauth-continuation.ts
|
|
3455
|
-
var
|
|
3456
|
-
function
|
|
3398
|
+
var ni = "ikon-oauth", ri = "ikon-oauth-continue";
|
|
3399
|
+
function ii() {
|
|
3457
3400
|
if (typeof window > "u") return !1;
|
|
3458
|
-
let e = new URL(window.location.href)
|
|
3459
|
-
return
|
|
3401
|
+
let e = new URL(window.location.href).searchParams.get(ni);
|
|
3402
|
+
return e ? (li(e), !0) : ci() !== null;
|
|
3460
3403
|
}
|
|
3461
|
-
function
|
|
3462
|
-
return
|
|
3404
|
+
function ai() {
|
|
3405
|
+
return oi() !== null;
|
|
3463
3406
|
}
|
|
3464
|
-
|
|
3465
|
-
|
|
3407
|
+
function oi() {
|
|
3408
|
+
return typeof window > "u" ? null : new URL(window.location.href).searchParams.get("ikon-oauth") ?? ci();
|
|
3409
|
+
}
|
|
3410
|
+
async function si() {
|
|
3411
|
+
let e = oi();
|
|
3466
3412
|
if (!e) return !1;
|
|
3467
|
-
|
|
3413
|
+
ui();
|
|
3468
3414
|
try {
|
|
3469
|
-
let t =
|
|
3415
|
+
let t = rr();
|
|
3470
3416
|
if (!t?.token) return !1;
|
|
3471
3417
|
let n = await fetch("/ikon/oauth/continue", {
|
|
3472
3418
|
method: "POST",
|
|
@@ -3483,33 +3429,37 @@ async function ci() {
|
|
|
3483
3429
|
return !1;
|
|
3484
3430
|
}
|
|
3485
3431
|
}
|
|
3486
|
-
function
|
|
3432
|
+
function ci() {
|
|
3487
3433
|
try {
|
|
3488
|
-
return sessionStorage.getItem(
|
|
3434
|
+
return sessionStorage.getItem(ri);
|
|
3489
3435
|
} catch {
|
|
3490
3436
|
return null;
|
|
3491
3437
|
}
|
|
3492
3438
|
}
|
|
3493
|
-
function
|
|
3439
|
+
function li(e) {
|
|
3494
3440
|
try {
|
|
3495
|
-
sessionStorage.setItem(
|
|
3441
|
+
sessionStorage.setItem(ri, e);
|
|
3496
3442
|
} catch {}
|
|
3497
3443
|
}
|
|
3498
|
-
function
|
|
3444
|
+
function ui() {
|
|
3499
3445
|
try {
|
|
3500
|
-
sessionStorage.removeItem(
|
|
3446
|
+
sessionStorage.removeItem(ri);
|
|
3447
|
+
} catch {}
|
|
3448
|
+
try {
|
|
3449
|
+
let e = new URL(window.location.href);
|
|
3450
|
+
e.searchParams.has("ikon-oauth") && (e.searchParams.delete(ni), window.history.replaceState(null, "", e.toString()));
|
|
3501
3451
|
} catch {}
|
|
3502
3452
|
}
|
|
3503
3453
|
//#endregion
|
|
3504
3454
|
//#region src/auth/use-auth-guard.ts
|
|
3505
|
-
function
|
|
3506
|
-
let { config: t, guestUrlParam: n } = e, { state: r, login: i } =
|
|
3455
|
+
function di(e) {
|
|
3456
|
+
let { config: t, guestUrlParam: n } = e, { state: r, login: i } = ei(), a = j(!1), o = N(de, re, re), s = o.required;
|
|
3507
3457
|
k(() => {
|
|
3508
|
-
|
|
3458
|
+
ii() && ue("An application is asking to act as you. Sign in to review what it wants.");
|
|
3509
3459
|
}, []), k(() => {
|
|
3510
|
-
|
|
3460
|
+
s && r.isAuthenticated && r.user && r.user.provider !== "anonymous" && (_(), ai() && si());
|
|
3511
3461
|
}, [
|
|
3512
|
-
|
|
3462
|
+
s,
|
|
3513
3463
|
r.isAuthenticated,
|
|
3514
3464
|
r.user
|
|
3515
3465
|
]), k(() => {
|
|
@@ -3517,7 +3467,7 @@ function fi(e) {
|
|
|
3517
3467
|
let e = t.methods.includes("global") ? "global" : t.methods.includes("guest") ? "guest" : null;
|
|
3518
3468
|
if (!e) return;
|
|
3519
3469
|
let o = new URLSearchParams(window.location.search), s = o.get(n);
|
|
3520
|
-
if (s === "true" || s === "1" || s === "" ||
|
|
3470
|
+
if (s === "true" || s === "1" || s === "" || Er()) {
|
|
3521
3471
|
o.delete(n);
|
|
3522
3472
|
let t = o.toString(), r = window.location.pathname + (t ? `?${t}` : "");
|
|
3523
3473
|
window.history.replaceState({}, "", r), a.current = !0, i(e);
|
|
@@ -3529,29 +3479,30 @@ function fi(e) {
|
|
|
3529
3479
|
t.methods,
|
|
3530
3480
|
i
|
|
3531
3481
|
]);
|
|
3532
|
-
let
|
|
3482
|
+
let c = t.methods.includes("guest") || t.methods.includes("global"), l = r.isAuthenticated && (c || r.user?.provider !== "anonymous"), u = !!t.requireSignIn && !l;
|
|
3533
3483
|
return {
|
|
3534
|
-
shouldRenderChildren: !
|
|
3484
|
+
shouldRenderChildren: !u && !s,
|
|
3535
3485
|
isCheckingAuth: r.isLoading,
|
|
3536
3486
|
isAuthenticated: r.isAuthenticated,
|
|
3537
3487
|
error: r.error,
|
|
3538
|
-
isLoginPrompt:
|
|
3539
|
-
dismissLoginPrompt: _
|
|
3488
|
+
isLoginPrompt: s && !u,
|
|
3489
|
+
dismissLoginPrompt: _,
|
|
3490
|
+
loginPromptReason: s ? o.reason : null
|
|
3540
3491
|
};
|
|
3541
3492
|
}
|
|
3542
3493
|
//#endregion
|
|
3543
3494
|
//#region src/debug/debug-overlay.tsx
|
|
3544
|
-
var
|
|
3495
|
+
var fi = (() => {
|
|
3545
3496
|
try {
|
|
3546
3497
|
return te();
|
|
3547
3498
|
} catch {
|
|
3548
3499
|
return !1;
|
|
3549
3500
|
}
|
|
3550
|
-
})(),
|
|
3551
|
-
function
|
|
3552
|
-
$.push(`[+${((Date.now() -
|
|
3501
|
+
})(), pi = Date.now(), $ = [], mi = 300;
|
|
3502
|
+
function hi(e) {
|
|
3503
|
+
$.push(`[+${((Date.now() - pi) / 1e3).toFixed(1)}s] ${e}`), $.length > mi && $.shift();
|
|
3553
3504
|
}
|
|
3554
|
-
function
|
|
3505
|
+
function gi(e) {
|
|
3555
3506
|
if (typeof e == "string") return e;
|
|
3556
3507
|
if (e instanceof Error) return `${e.name}: ${e.message}`;
|
|
3557
3508
|
try {
|
|
@@ -3560,10 +3511,10 @@ function _i(e) {
|
|
|
3560
3511
|
return String(e);
|
|
3561
3512
|
}
|
|
3562
3513
|
}
|
|
3563
|
-
var
|
|
3564
|
-
function
|
|
3565
|
-
if (
|
|
3566
|
-
|
|
3514
|
+
var _i = !1;
|
|
3515
|
+
function vi() {
|
|
3516
|
+
if (_i || typeof window > "u") return;
|
|
3517
|
+
_i = !0, window.addEventListener("error", (e) => hi(`window.error: ${e.message} @ ${e.filename ?? "?"}:${e.lineno ?? "?"}:${e.colno ?? "?"}`)), window.addEventListener("unhandledrejection", (e) => hi(`unhandledRejection: ${gi(e.reason)}`));
|
|
3567
3518
|
let e = console;
|
|
3568
3519
|
for (let t of [
|
|
3569
3520
|
"error",
|
|
@@ -3574,17 +3525,17 @@ function yi() {
|
|
|
3574
3525
|
let n = e[t]?.bind(console) ?? (() => void 0);
|
|
3575
3526
|
e[t] = (...e) => {
|
|
3576
3527
|
try {
|
|
3577
|
-
|
|
3528
|
+
hi(`console.${t}: ${e.map(gi).join(" ")}`);
|
|
3578
3529
|
} catch {}
|
|
3579
3530
|
n(...e);
|
|
3580
3531
|
};
|
|
3581
3532
|
}
|
|
3582
3533
|
try {
|
|
3583
|
-
|
|
3534
|
+
fe((e) => hi(`${e.levelName} [${e.component}] ${e.message}`), { minLevel: d.DEBUG });
|
|
3584
3535
|
} catch {}
|
|
3585
3536
|
}
|
|
3586
|
-
|
|
3587
|
-
function
|
|
3537
|
+
fi && vi();
|
|
3538
|
+
function yi() {
|
|
3588
3539
|
let e = !1;
|
|
3589
3540
|
try {
|
|
3590
3541
|
let t = URL.createObjectURL(new Blob([""]));
|
|
@@ -3594,11 +3545,11 @@ function bi() {
|
|
|
3594
3545
|
} catch {}
|
|
3595
3546
|
return e;
|
|
3596
3547
|
}
|
|
3597
|
-
function
|
|
3548
|
+
function bi() {
|
|
3598
3549
|
let e = globalThis;
|
|
3599
3550
|
return [
|
|
3600
3551
|
`Worker=${typeof Worker < "u"}`,
|
|
3601
|
-
`moduleWorker=${
|
|
3552
|
+
`moduleWorker=${yi()}`,
|
|
3602
3553
|
`WebSocket=${typeof WebSocket < "u"}`,
|
|
3603
3554
|
`WebTransport=${e.WebTransport !== void 0}`,
|
|
3604
3555
|
`RTCPeerConnection=${typeof RTCPeerConnection < "u"}`,
|
|
@@ -3611,14 +3562,14 @@ function xi() {
|
|
|
3611
3562
|
`online=${typeof navigator < "u" ? navigator.onLine : "?"}`
|
|
3612
3563
|
].join(" ");
|
|
3613
3564
|
}
|
|
3614
|
-
function
|
|
3565
|
+
function xi(e) {
|
|
3615
3566
|
return /ERROR|error:|Rejection/.test(e) ? "#f88" : /WARN|warn:/.test(e) ? "#fc6" : "#9d9";
|
|
3616
3567
|
}
|
|
3617
|
-
function
|
|
3618
|
-
let n =
|
|
3568
|
+
function Si({ state: e = "", forceVisible: t = !1 }) {
|
|
3569
|
+
let n = fi || t, r = e === "connected" || e === "reconnecting", [, i] = ve((e) => e + 1, 0), [a, o] = M(!0);
|
|
3619
3570
|
return k(() => {
|
|
3620
3571
|
if (!n) return;
|
|
3621
|
-
|
|
3572
|
+
vi();
|
|
3622
3573
|
let e = setInterval(i, 1e3);
|
|
3623
3574
|
return () => clearInterval(e);
|
|
3624
3575
|
}, [n]), n ? r && a ? /* @__PURE__ */ F("button", {
|
|
@@ -3672,7 +3623,7 @@ function Ci({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3672
3623
|
"Ikon debug overlay — state: ",
|
|
3673
3624
|
e || "?",
|
|
3674
3625
|
", +",
|
|
3675
|
-
Math.round((Date.now() -
|
|
3626
|
+
Math.round((Date.now() - pi) / 1e3),
|
|
3676
3627
|
"s, ",
|
|
3677
3628
|
$.length,
|
|
3678
3629
|
" entries",
|
|
@@ -3713,7 +3664,7 @@ function Ci({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3713
3664
|
color: "#8cf",
|
|
3714
3665
|
marginBottom: "4px"
|
|
3715
3666
|
},
|
|
3716
|
-
children:
|
|
3667
|
+
children: bi()
|
|
3717
3668
|
}),
|
|
3718
3669
|
/* @__PURE__ */ P("div", {
|
|
3719
3670
|
style: {
|
|
@@ -3724,7 +3675,7 @@ function Ci({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3724
3675
|
}),
|
|
3725
3676
|
/* @__PURE__ */ P("div", { children: $.length === 0 ? "(nothing captured yet)" : $.map((e, t) => /* @__PURE__ */ P("div", {
|
|
3726
3677
|
style: {
|
|
3727
|
-
color:
|
|
3678
|
+
color: xi(e),
|
|
3728
3679
|
wordBreak: "break-all"
|
|
3729
3680
|
},
|
|
3730
3681
|
children: e
|
|
@@ -3734,7 +3685,7 @@ function Ci({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3734
3685
|
}
|
|
3735
3686
|
//#endregion
|
|
3736
3687
|
//#region src/app/connection-state-renderer.tsx
|
|
3737
|
-
function
|
|
3688
|
+
function Ci({ connectionState: e, error: t, isReady: n, isConnectingSlow: r, stores: i, registry: a, client: o, onAction: s, renderIdle: c, renderConnecting: l, renderConnectingSlow: u, renderConnected: d, renderOffline: f, renderError: p }) {
|
|
3738
3689
|
let m = j(!1), h = (() => {
|
|
3739
3690
|
switch (e) {
|
|
3740
3691
|
case "waitingForExternalConnectUrl":
|
|
@@ -3760,38 +3711,38 @@ function wi({ connectionState: e, error: t, isReady: n, isConnectingSlow: r, sto
|
|
|
3760
3711
|
default: return null;
|
|
3761
3712
|
}
|
|
3762
3713
|
})();
|
|
3763
|
-
return /* @__PURE__ */ F(
|
|
3714
|
+
return /* @__PURE__ */ F(ye, { children: [h, /* @__PURE__ */ P(Si, { state: e })] });
|
|
3764
3715
|
}
|
|
3765
3716
|
//#endregion
|
|
3766
3717
|
//#region src/app/boot-snapshot-variant.ts
|
|
3767
|
-
function
|
|
3718
|
+
function wi(e, t) {
|
|
3768
3719
|
return e === !1 ? !1 : t ? "signed-in" : "guest";
|
|
3769
3720
|
}
|
|
3770
3721
|
//#endregion
|
|
3771
3722
|
//#region src/app/use-ikon-app.ts
|
|
3772
|
-
var
|
|
3773
|
-
function
|
|
3723
|
+
var Ti = v("useIkonApp");
|
|
3724
|
+
function Ei() {
|
|
3774
3725
|
if (typeof window < "u" && window.__IKON_AUTH_CONFIG__) return window.__IKON_AUTH_CONFIG__;
|
|
3775
3726
|
}
|
|
3776
|
-
function
|
|
3727
|
+
function Di() {
|
|
3777
3728
|
if (typeof window < "u" && window.__IKON_LOCAL_IKON_SERVER_CONFIG__) return window.__IKON_LOCAL_IKON_SERVER_CONFIG__;
|
|
3778
3729
|
}
|
|
3779
|
-
function
|
|
3730
|
+
function Oi(e, t) {
|
|
3780
3731
|
return {
|
|
3781
3732
|
...e,
|
|
3782
3733
|
...t ?? {}
|
|
3783
3734
|
};
|
|
3784
3735
|
}
|
|
3785
|
-
function
|
|
3786
|
-
let { authConfig: n, modules: r, parameters: l, timeouts: d, backgroundAudio: g, webRtc: _, audio: v, video: y, websocket: S, webtransport: te, proxy: ne, liveSnapshot: re, bootSnapshot: ie } = e, C = n === void 0 ?
|
|
3787
|
-
pe.current = g,
|
|
3788
|
-
let [
|
|
3736
|
+
function ki(e) {
|
|
3737
|
+
let { authConfig: n, modules: r, parameters: l, timeouts: d, backgroundAudio: g, webRtc: _, audio: v, video: y, websocket: S, webtransport: te, proxy: ne, liveSnapshot: re, bootSnapshot: ie } = e, C = n === void 0 ? Ei() ?? null : n, oe = Di(), w = ti(), se = !!w && w.state.isLoading, T = j(null), ue = j(null), E = j(null), de = j(!1), fe = j(!1), pe = j(g), me = j(d), he = j(_), D = j(v), ge = j(y), _e = j(S), ve = j(te), N = j(ne), ye = j(re), P = j(ie), F = j("local"), be = j(void 0);
|
|
3738
|
+
pe.current = g, me.current = d, he.current = _, D.current = v, ge.current = y, _e.current = S, ve.current = te, N.current = ne, ye.current = re, P.current = ie;
|
|
3739
|
+
let [I, xe] = M("connecting"), [Se, Ce] = M(!1), [we, Te] = M(!1), [Ee, De] = M(null), [Oe, ke] = M(null), [Ae, je] = M(!1), [Me, Ne] = M(!1), [Pe, Fe] = M(!1), [Ie, Le] = M(null), [L, Re] = M(null), [ze, Be] = M(!1), He = j(!1), [R, Ue] = M(0), z = A(() => {
|
|
3789
3740
|
try {
|
|
3790
|
-
return
|
|
3741
|
+
return ce();
|
|
3791
3742
|
} catch {
|
|
3792
3743
|
return { parameters: {} };
|
|
3793
3744
|
}
|
|
3794
|
-
}, []), We = JSON.stringify(l ?? {}), B = A(() =>
|
|
3745
|
+
}, []), We = JSON.stringify(l ?? {}), B = A(() => Oi(z.parameters, l), [z.parameters, We]), Ge = (C?.methods?.length ?? 0) > 0, Ke = wi(ie, Ge && lr());
|
|
3795
3746
|
Ke !== !1 && !i() && a(Ke);
|
|
3796
3747
|
let V = A(() => {
|
|
3797
3748
|
if (!C?.spaceId) return null;
|
|
@@ -3800,24 +3751,24 @@ function Ai(e) {
|
|
|
3800
3751
|
token: e.token,
|
|
3801
3752
|
provider: e.provider,
|
|
3802
3753
|
authenticatedAt: e.authenticatedAt
|
|
3803
|
-
} :
|
|
3754
|
+
} : rr();
|
|
3804
3755
|
}, [
|
|
3805
3756
|
C?.spaceId,
|
|
3806
|
-
|
|
3757
|
+
R,
|
|
3807
3758
|
w?.state.isLoading,
|
|
3808
3759
|
w?.state.isAuthenticated,
|
|
3809
3760
|
w?.state.user?.token
|
|
3810
|
-
]), H = oe?.enabled ?? !1, qe = oe?.host ?? "localhost", U = oe?.port ?? 8443, Je = !
|
|
3811
|
-
Je && !
|
|
3812
|
-
|
|
3761
|
+
]), H = oe?.enabled ?? !1, qe = oe?.host ?? "localhost", U = oe?.port ?? 8443, Je = !se && !!C && !V && !C.requireSignIn && !!C.spaceId && (ae() || H);
|
|
3762
|
+
Je && !L && !ze && !He.current && (He.current = !0, b(C.authUrl).then((e) => vr(C.spaceId, e)).then((e) => {
|
|
3763
|
+
Re(e.token), Be(!0);
|
|
3813
3764
|
}).catch((e) => {
|
|
3814
|
-
|
|
3765
|
+
Ti.error("Anonymous auth failed:", e), He.current = !1, H ? Be(!0) : De(e instanceof Error ? e.message : "Anonymous auth failed");
|
|
3815
3766
|
}));
|
|
3816
|
-
let
|
|
3817
|
-
if (
|
|
3767
|
+
let W = A(() => {
|
|
3768
|
+
if (se) return null;
|
|
3818
3769
|
if (H) {
|
|
3819
3770
|
if (Je && !ze) return null;
|
|
3820
|
-
let e = V?.token ??
|
|
3771
|
+
let e = V?.token ?? L ?? void 0, t = e ? ee(e) ?? void 0 : void 0;
|
|
3821
3772
|
return { local: {
|
|
3822
3773
|
host: qe,
|
|
3823
3774
|
httpsPort: U,
|
|
@@ -3834,13 +3785,13 @@ function Ai(e) {
|
|
|
3834
3785
|
token: V.token,
|
|
3835
3786
|
spaceId: C.spaceId,
|
|
3836
3787
|
backendType: x(),
|
|
3837
|
-
sessionIdentityHash:
|
|
3788
|
+
sessionIdentityHash: z.sessionIdentityHash,
|
|
3838
3789
|
parameters: B
|
|
3839
|
-
} } :
|
|
3840
|
-
token:
|
|
3790
|
+
} } : L && C?.spaceId ? { sessionToken: {
|
|
3791
|
+
token: L,
|
|
3841
3792
|
spaceId: C.spaceId,
|
|
3842
3793
|
backendType: x(),
|
|
3843
|
-
sessionIdentityHash:
|
|
3794
|
+
sessionIdentityHash: z.sessionIdentityHash,
|
|
3844
3795
|
parameters: B
|
|
3845
3796
|
} } : ae() ? null : { local: {
|
|
3846
3797
|
host: qe,
|
|
@@ -3851,7 +3802,7 @@ function Ai(e) {
|
|
|
3851
3802
|
parameters: B
|
|
3852
3803
|
} };
|
|
3853
3804
|
}, [
|
|
3854
|
-
|
|
3805
|
+
se,
|
|
3855
3806
|
H,
|
|
3856
3807
|
qe,
|
|
3857
3808
|
U,
|
|
@@ -3859,28 +3810,28 @@ function Ai(e) {
|
|
|
3859
3810
|
C?.spaceId,
|
|
3860
3811
|
C?.backendUrl,
|
|
3861
3812
|
C?.authUrl,
|
|
3862
|
-
|
|
3813
|
+
L,
|
|
3863
3814
|
Je,
|
|
3864
3815
|
ze,
|
|
3865
|
-
|
|
3816
|
+
z.sessionIdentityHash,
|
|
3866
3817
|
B
|
|
3867
3818
|
]);
|
|
3868
|
-
|
|
3869
|
-
let
|
|
3819
|
+
F.current = C?.spaceId ?? "local", be.current = V?.token ?? L ?? void 0, un(Ie);
|
|
3820
|
+
let Ye = fn(Ie);
|
|
3870
3821
|
k(() => {
|
|
3871
3822
|
if (!de.current) {
|
|
3872
|
-
if (de.current = !0, E.current =
|
|
3823
|
+
if (de.current = !0, E.current = Yt(), r) for (let e of r) e(E.current);
|
|
3873
3824
|
E.current.loadRegisteredModules().catch((e) => {
|
|
3874
|
-
|
|
3825
|
+
Ti.error("Failed to load UI modules", e);
|
|
3875
3826
|
});
|
|
3876
3827
|
}
|
|
3877
3828
|
}, []), k(() => {
|
|
3878
|
-
if (!
|
|
3829
|
+
if (!W) return;
|
|
3879
3830
|
let e = new u({
|
|
3880
|
-
...
|
|
3881
|
-
timeouts:
|
|
3882
|
-
audio:
|
|
3883
|
-
enabled:
|
|
3831
|
+
...W,
|
|
3832
|
+
timeouts: me.current,
|
|
3833
|
+
audio: D.current !== void 0 || pe.current ? {
|
|
3834
|
+
enabled: D.current,
|
|
3884
3835
|
...pe.current ? { background: {
|
|
3885
3836
|
allowOnDesktop: !0,
|
|
3886
3837
|
allowOnMobile: !0
|
|
@@ -3891,104 +3842,104 @@ function Ai(e) {
|
|
|
3891
3842
|
title: document.title || void 0,
|
|
3892
3843
|
artist: document.title || void 0
|
|
3893
3844
|
},
|
|
3894
|
-
webRtc:
|
|
3895
|
-
websocket:
|
|
3896
|
-
webtransport:
|
|
3897
|
-
proxy:
|
|
3845
|
+
webRtc: he.current === !1 ? { enabled: !1 } : void 0,
|
|
3846
|
+
websocket: _e.current,
|
|
3847
|
+
webtransport: ve.current,
|
|
3848
|
+
proxy: N.current,
|
|
3898
3849
|
onConnectionStateChange: (e) => {
|
|
3899
|
-
|
|
3850
|
+
xe(e);
|
|
3900
3851
|
},
|
|
3901
3852
|
onError: (e) => {
|
|
3902
|
-
|
|
3853
|
+
De(e.message);
|
|
3903
3854
|
}
|
|
3904
3855
|
});
|
|
3905
3856
|
T.current = e;
|
|
3906
|
-
let n =
|
|
3857
|
+
let n = ye.current ?? !0, r = be.current, i = r ? ee(r) ?? null : null, a = n && i ? {
|
|
3907
3858
|
enabled: !0,
|
|
3908
|
-
appId:
|
|
3859
|
+
appId: F.current,
|
|
3909
3860
|
userId: i
|
|
3910
|
-
} : void 0, l = V != null && V.provider !== "anonymous", d = Ge && (l ||
|
|
3861
|
+
} : void 0, l = V != null && V.provider !== "anonymous", d = Ge && (l || lr()), g = new Ve({
|
|
3911
3862
|
client: e,
|
|
3912
3863
|
liveSnapshot: a,
|
|
3913
|
-
bootSnapshot:
|
|
3864
|
+
bootSnapshot: wi(P.current, d)
|
|
3914
3865
|
});
|
|
3915
|
-
ue.current = g,
|
|
3866
|
+
ue.current = g, Le(g), Te(!1);
|
|
3916
3867
|
let _ = g.subscribeToUiUpdates(() => {
|
|
3917
|
-
|
|
3868
|
+
Te(!0), le();
|
|
3918
3869
|
});
|
|
3919
3870
|
return e.connect().catch((e) => {
|
|
3920
|
-
if (
|
|
3921
|
-
|
|
3871
|
+
if (Ti.error("Connection failed:", e), e instanceof o) {
|
|
3872
|
+
ke(e.reason);
|
|
3922
3873
|
return;
|
|
3923
3874
|
}
|
|
3924
3875
|
if (e instanceof p) {
|
|
3925
|
-
|
|
3876
|
+
je(!0);
|
|
3926
3877
|
return;
|
|
3927
3878
|
}
|
|
3928
3879
|
if (e instanceof h) {
|
|
3929
|
-
|
|
3880
|
+
Ne(!0);
|
|
3930
3881
|
return;
|
|
3931
3882
|
}
|
|
3932
3883
|
if (!(e instanceof m)) {
|
|
3933
3884
|
if (e instanceof s) {
|
|
3934
|
-
|
|
3885
|
+
Fe(!0);
|
|
3935
3886
|
return;
|
|
3936
3887
|
}
|
|
3937
|
-
e instanceof f || e instanceof c && !fe.current && (fe.current = !0,
|
|
3888
|
+
e instanceof f || e instanceof c && !fe.current && (fe.current = !0, Ti.warn("Auth session appears stale, clearing and retrying"), t.clearAll(), w ? w.logout() : (ur(), Ue((e) => e + 1)));
|
|
3938
3889
|
}
|
|
3939
3890
|
}), () => {
|
|
3940
3891
|
_(), e.disconnect(), T.current = null, g.dispose(), ue.current = null;
|
|
3941
3892
|
};
|
|
3942
|
-
}, [
|
|
3943
|
-
let
|
|
3893
|
+
}, [W]);
|
|
3894
|
+
let Xe = O((e, t) => {
|
|
3944
3895
|
let n = typeof t == "string" ? t : JSON.stringify(t ?? {});
|
|
3945
3896
|
T.current?.sendActionCall(e, n);
|
|
3946
3897
|
}, []);
|
|
3947
3898
|
k(() => {
|
|
3948
|
-
if (
|
|
3949
|
-
|
|
3899
|
+
if (I !== "connecting") {
|
|
3900
|
+
Ce(!1);
|
|
3950
3901
|
return;
|
|
3951
3902
|
}
|
|
3952
|
-
let e = T.current?.slowConnectionThresholdMs ?? 5e3, t = setTimeout(() =>
|
|
3903
|
+
let e = T.current?.slowConnectionThresholdMs ?? 5e3, t = setTimeout(() => Ce(!0), e);
|
|
3953
3904
|
return () => clearTimeout(t);
|
|
3954
|
-
}, [
|
|
3955
|
-
let
|
|
3905
|
+
}, [I]);
|
|
3906
|
+
let Ze = I === "connected" || I === "reconnecting", Qe = we && I !== "offline";
|
|
3956
3907
|
return k(() => {
|
|
3957
|
-
typeof document > "u" || (document.documentElement.dataset.ikonLive = String(
|
|
3958
|
-
}, [
|
|
3959
|
-
connectionState:
|
|
3960
|
-
error:
|
|
3961
|
-
accessDeniedReason:
|
|
3962
|
-
isServerFull:
|
|
3963
|
-
isSessionExpired:
|
|
3964
|
-
isStartupFailed:
|
|
3965
|
-
stores:
|
|
3908
|
+
typeof document > "u" || (document.documentElement.dataset.ikonLive = String(Qe));
|
|
3909
|
+
}, [Qe]), {
|
|
3910
|
+
connectionState: I,
|
|
3911
|
+
error: Ee,
|
|
3912
|
+
accessDeniedReason: Oe,
|
|
3913
|
+
isServerFull: Ae,
|
|
3914
|
+
isSessionExpired: Me,
|
|
3915
|
+
isStartupFailed: Pe,
|
|
3916
|
+
stores: Ye,
|
|
3966
3917
|
client: T.current,
|
|
3967
3918
|
registry: E.current,
|
|
3968
3919
|
clientRef: T,
|
|
3969
3920
|
uiRef: ue,
|
|
3970
3921
|
registryRef: E,
|
|
3971
|
-
onAction:
|
|
3972
|
-
isReady:
|
|
3973
|
-
isLive:
|
|
3922
|
+
onAction: Xe,
|
|
3923
|
+
isReady: Ze,
|
|
3924
|
+
isLive: Qe,
|
|
3974
3925
|
brandingRequired: T.current?.brandingRequired ?? !1,
|
|
3975
|
-
isConnectingSlow:
|
|
3926
|
+
isConnectingSlow: Se,
|
|
3976
3927
|
webRtcVideoStreams: T.current?.webRtcVideoStreams ?? /* @__PURE__ */ new Map(),
|
|
3977
3928
|
webRtcTrackMap: T.current?.webRtcTrackMap ?? /* @__PURE__ */ new Map()
|
|
3978
3929
|
};
|
|
3979
3930
|
}
|
|
3980
3931
|
//#endregion
|
|
3981
3932
|
//#region src/hooks/use-toasts.ts
|
|
3982
|
-
var
|
|
3983
|
-
function
|
|
3933
|
+
var Ai = 0;
|
|
3934
|
+
function ji(e = 5, t = 5e3) {
|
|
3984
3935
|
let [n, r] = M([]), i = j(/* @__PURE__ */ new Map()), a = O((e) => {
|
|
3985
3936
|
let t = i.current.get(e);
|
|
3986
3937
|
t && (clearTimeout(t), i.current.delete(e)), r((t) => t.filter((t) => t.id !== e));
|
|
3987
3938
|
}, []);
|
|
3988
3939
|
return k(() => {
|
|
3989
|
-
let n = i.current, o =
|
|
3940
|
+
let n = i.current, o = fe((i) => {
|
|
3990
3941
|
if (!oe()) return;
|
|
3991
|
-
let o = `toast-${++
|
|
3942
|
+
let o = `toast-${++Ai}`, s = {
|
|
3992
3943
|
id: o,
|
|
3993
3944
|
level: i.level === d.ERROR ? "error" : "warn",
|
|
3994
3945
|
message: i.message,
|
|
@@ -4016,7 +3967,7 @@ function Mi(e = 5, t = 5e3) {
|
|
|
4016
3967
|
}
|
|
4017
3968
|
//#endregion
|
|
4018
3969
|
//#region src/hooks/use-ikon-reactive.ts
|
|
4019
|
-
function
|
|
3970
|
+
function Mi(e, t, n) {
|
|
4020
3971
|
let [r, i] = M(n);
|
|
4021
3972
|
return k(() => {
|
|
4022
3973
|
if (!e) return;
|
|
@@ -4034,7 +3985,7 @@ function Ni(e, t, n) {
|
|
|
4034
3985
|
}
|
|
4035
3986
|
//#endregion
|
|
4036
3987
|
//#region src/hooks/use-reactive.ts
|
|
4037
|
-
function
|
|
3988
|
+
function Ni(e, t, n) {
|
|
4038
3989
|
let [r, i] = M(null);
|
|
4039
3990
|
return k(() => {
|
|
4040
3991
|
if (!e) return;
|
|
@@ -4046,48 +3997,48 @@ function Pi(e, t, n) {
|
|
|
4046
3997
|
}), () => {
|
|
4047
3998
|
n = !1;
|
|
4048
3999
|
};
|
|
4049
|
-
}, [e, t]),
|
|
4000
|
+
}, [e, t]), Mi(r ? e : null, r ?? "", n);
|
|
4050
4001
|
}
|
|
4051
4002
|
//#endregion
|
|
4052
4003
|
//#region src/app/use-ikon-debug.ts
|
|
4053
|
-
var
|
|
4004
|
+
var Pi = v("IkonDebug"), Fi = {
|
|
4054
4005
|
Digit1: "connecting",
|
|
4055
4006
|
Digit2: "connected",
|
|
4056
4007
|
Digit3: "reconnecting",
|
|
4057
4008
|
Digit4: "offline",
|
|
4058
4009
|
Digit5: "offline",
|
|
4059
4010
|
Digit0: "clear"
|
|
4060
|
-
},
|
|
4061
|
-
function
|
|
4011
|
+
}, Ii = "Digit5", Li = "Digit6", Ri = "Synthetic debug error (Ctrl+Shift+5)", zi = "Synthetic debug access-denied (Ctrl+Shift+6)", Bi = 5e3;
|
|
4012
|
+
function Vi(e) {
|
|
4062
4013
|
let t = oe(), [n, r] = M(null), [i, a] = M(!1), [o, s] = M(null), [c, l] = M(null), [u, d] = M(!1), [f, p] = M(!1), [m, h] = M(!1);
|
|
4063
4014
|
return k(() => {
|
|
4064
4015
|
if (!t) return;
|
|
4065
4016
|
let e = (e) => {
|
|
4066
4017
|
if (!e.ctrlKey || !e.shiftKey) return;
|
|
4067
4018
|
if (e.code === "KeyE") {
|
|
4068
|
-
e.preventDefault(), d((e) => (
|
|
4019
|
+
e.preventDefault(), d((e) => (Pi.warn(`Empty-stores override: ${e ? "off" : "on"}`), !e));
|
|
4069
4020
|
return;
|
|
4070
4021
|
}
|
|
4071
4022
|
if (e.code === "Digit7") {
|
|
4072
|
-
e.preventDefault(), p((e) => (
|
|
4023
|
+
e.preventDefault(), p((e) => (Pi.warn(`Branding-banner override: ${e ? "off" : "on"}`), !e));
|
|
4073
4024
|
return;
|
|
4074
4025
|
}
|
|
4075
4026
|
if (e.code === "Digit8") {
|
|
4076
|
-
e.preventDefault(), h((e) => (
|
|
4027
|
+
e.preventDefault(), h((e) => (Pi.warn(`Debug-overlay override: ${e ? "off" : "on"}`), !e));
|
|
4077
4028
|
return;
|
|
4078
4029
|
}
|
|
4079
|
-
if (e.code ===
|
|
4080
|
-
e.preventDefault(), l(
|
|
4030
|
+
if (e.code === Li) {
|
|
4031
|
+
e.preventDefault(), l(zi), r(null), s(null), Pi.warn("Forced access denied");
|
|
4081
4032
|
return;
|
|
4082
4033
|
}
|
|
4083
|
-
let t =
|
|
4034
|
+
let t = Fi[e.code];
|
|
4084
4035
|
if (t === void 0) return;
|
|
4085
4036
|
if (e.preventDefault(), t === "clear") {
|
|
4086
|
-
r(null), s(null), l(null),
|
|
4037
|
+
r(null), s(null), l(null), Pi.warn("Cleared forced state");
|
|
4087
4038
|
return;
|
|
4088
4039
|
}
|
|
4089
|
-
let n = e.code ===
|
|
4090
|
-
r(t), s(n ?
|
|
4040
|
+
let n = e.code === Ii;
|
|
4041
|
+
r(t), s(n ? Ri : null), l(null), Pi.warn(`Forced state: ${t}${n ? " (with error)" : ""}`);
|
|
4091
4042
|
};
|
|
4092
4043
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
4093
4044
|
}, [t]), k(() => {
|
|
@@ -4095,7 +4046,7 @@ function Hi(e) {
|
|
|
4095
4046
|
a(!1);
|
|
4096
4047
|
return;
|
|
4097
4048
|
}
|
|
4098
|
-
let e = setTimeout(() => a(!0),
|
|
4049
|
+
let e = setTimeout(() => a(!0), Bi);
|
|
4099
4050
|
return () => clearTimeout(e);
|
|
4100
4051
|
}, [n]), !t || n === null && !u && c === null && !f && !m ? {
|
|
4101
4052
|
app: e,
|
|
@@ -4126,64 +4077,64 @@ function Hi(e) {
|
|
|
4126
4077
|
}
|
|
4127
4078
|
//#endregion
|
|
4128
4079
|
//#region src/app/ikon-app.tsx
|
|
4129
|
-
function
|
|
4080
|
+
function Hi(e, t) {
|
|
4130
4081
|
return e === void 0 ? null : typeof e == "function" ? e(t) : e;
|
|
4131
4082
|
}
|
|
4132
|
-
function
|
|
4083
|
+
function Ui(e) {
|
|
4133
4084
|
return e === void 0 ? null : typeof e == "function" ? e() : e;
|
|
4134
4085
|
}
|
|
4135
|
-
function
|
|
4086
|
+
function Wi(e, t) {
|
|
4136
4087
|
return e === void 0 ? null : typeof e == "function" ? e(t) : e;
|
|
4137
4088
|
}
|
|
4138
|
-
function
|
|
4089
|
+
function Gi(e, t) {
|
|
4139
4090
|
return e === void 0 ? null : typeof e == "function" ? e(t) : e;
|
|
4140
4091
|
}
|
|
4141
|
-
function
|
|
4142
|
-
let { connectingOverlay: t, reconnectingOverlay: n, offlineOverlay: r, accessDeniedScreen: i, ...a } = e, o =
|
|
4092
|
+
function Ki(e) {
|
|
4093
|
+
let { connectingOverlay: t, reconnectingOverlay: n, offlineOverlay: r, accessDeniedScreen: i, ...a } = e, o = Vi(a), { app: s } = o, { connectionState: c, isConnectingSlow: l, stores: u, registry: d, client: f, onAction: p, isReady: m, error: h, accessDeniedReason: g, brandingRequired: _ } = s, v = _ || o.forcedBranding, y = j(null);
|
|
4143
4094
|
u && d && (m || u.size > 0) && (y.current = {
|
|
4144
4095
|
stores: u,
|
|
4145
4096
|
registry: d,
|
|
4146
4097
|
client: f
|
|
4147
4098
|
});
|
|
4148
4099
|
let b = y.current != null || !!g;
|
|
4149
|
-
if (
|
|
4100
|
+
if (_e(() => {
|
|
4150
4101
|
!b || typeof document > "u" || document.querySelectorAll("[data-ikon-prerender]").forEach((e) => e.remove());
|
|
4151
|
-
}, [b]), g) return
|
|
4102
|
+
}, [b]), g) return Gi(i, g);
|
|
4152
4103
|
let x = y.current, S;
|
|
4153
4104
|
switch (c) {
|
|
4154
4105
|
case "waitingForExternalConnectUrl":
|
|
4155
4106
|
case "connecting":
|
|
4156
|
-
S =
|
|
4107
|
+
S = Hi(t, l);
|
|
4157
4108
|
break;
|
|
4158
4109
|
case "reconnecting":
|
|
4159
|
-
S =
|
|
4110
|
+
S = Ui(n);
|
|
4160
4111
|
break;
|
|
4161
4112
|
case "offline":
|
|
4162
|
-
S =
|
|
4113
|
+
S = Wi(r, h);
|
|
4163
4114
|
break;
|
|
4164
4115
|
default: S = null;
|
|
4165
4116
|
}
|
|
4166
|
-
return /* @__PURE__ */ F(
|
|
4167
|
-
x && /* @__PURE__ */ P(
|
|
4117
|
+
return /* @__PURE__ */ F(ye, { children: [
|
|
4118
|
+
x && /* @__PURE__ */ P(Be, {
|
|
4168
4119
|
stores: x.stores,
|
|
4169
4120
|
registry: x.registry,
|
|
4170
4121
|
client: x.client,
|
|
4171
4122
|
onAction: p
|
|
4172
4123
|
}),
|
|
4173
4124
|
S,
|
|
4174
|
-
v && /* @__PURE__ */ P(
|
|
4175
|
-
/* @__PURE__ */ P(
|
|
4176
|
-
/* @__PURE__ */ P(
|
|
4125
|
+
v && /* @__PURE__ */ P(Ji, {}),
|
|
4126
|
+
/* @__PURE__ */ P(Yi, {}),
|
|
4127
|
+
/* @__PURE__ */ P(Si, {
|
|
4177
4128
|
state: c,
|
|
4178
4129
|
forceVisible: o.forcedDebugOverlay
|
|
4179
4130
|
})
|
|
4180
4131
|
] });
|
|
4181
4132
|
}
|
|
4182
|
-
var
|
|
4183
|
-
function
|
|
4133
|
+
var qi = "https://ikonai.com";
|
|
4134
|
+
function Ji() {
|
|
4184
4135
|
return /* @__PURE__ */ F("a", {
|
|
4185
4136
|
className: "ikon-branding-banner",
|
|
4186
|
-
href:
|
|
4137
|
+
href: qi,
|
|
4187
4138
|
target: "_blank",
|
|
4188
4139
|
rel: "noopener noreferrer",
|
|
4189
4140
|
style: {
|
|
@@ -4213,17 +4164,17 @@ function Yi() {
|
|
|
4213
4164
|
})]
|
|
4214
4165
|
});
|
|
4215
4166
|
}
|
|
4216
|
-
function
|
|
4217
|
-
let { toasts: e, dismissToast: t } =
|
|
4167
|
+
function Yi() {
|
|
4168
|
+
let { toasts: e, dismissToast: t } = ji();
|
|
4218
4169
|
return e.length === 0 ? null : /* @__PURE__ */ P("div", {
|
|
4219
4170
|
className: "ikon-toast-overlay",
|
|
4220
|
-
children: e.map((e) => /* @__PURE__ */ P(
|
|
4171
|
+
children: e.map((e) => /* @__PURE__ */ P(Xi, {
|
|
4221
4172
|
toast: e,
|
|
4222
4173
|
onDismiss: t
|
|
4223
4174
|
}, e.id))
|
|
4224
4175
|
});
|
|
4225
4176
|
}
|
|
4226
|
-
function
|
|
4177
|
+
function Xi({ toast: e, onDismiss: t }) {
|
|
4227
4178
|
return /* @__PURE__ */ F("div", {
|
|
4228
4179
|
className: `ikon-toast-overlay-chip ikon-toast-overlay-chip--${e.level}`,
|
|
4229
4180
|
onClick: () => t(e.id),
|
|
@@ -4249,37 +4200,37 @@ function Zi({ toast: e, onDismiss: t }) {
|
|
|
4249
4200
|
}
|
|
4250
4201
|
//#endregion
|
|
4251
4202
|
//#region src/i18n/i18n.tsx
|
|
4252
|
-
var
|
|
4253
|
-
function
|
|
4203
|
+
var Zi = he(null);
|
|
4204
|
+
function Qi(e, t) {
|
|
4254
4205
|
return t ? e.replace(/\{(\w+)\}/g, (e, n) => t[n] ?? `{${n}}`) : e;
|
|
4255
4206
|
}
|
|
4256
|
-
function
|
|
4207
|
+
function $i(e, t) {
|
|
4257
4208
|
let n = ne();
|
|
4258
4209
|
if (n && e.includes(n)) return n;
|
|
4259
4210
|
let r = navigator.language.split("-")[0];
|
|
4260
4211
|
return e.includes(r) ? r : t && e.includes(t) ? t : "en";
|
|
4261
4212
|
}
|
|
4262
|
-
function
|
|
4263
|
-
return t ?
|
|
4213
|
+
function ea(e, t, n) {
|
|
4214
|
+
return t ? $i(e, n) : n && e.includes(n) ? n : "en";
|
|
4264
4215
|
}
|
|
4265
|
-
function
|
|
4266
|
-
let i =
|
|
4216
|
+
function ta({ children: e, translations: t, defaultLanguage: n, detectLanguage: r = !1 }) {
|
|
4217
|
+
let i = ea(Object.keys(t), r, n), a = t[i] ?? t.en, o = A(() => ({
|
|
4267
4218
|
t: (e, t) => {
|
|
4268
4219
|
let n = a[e];
|
|
4269
|
-
return
|
|
4220
|
+
return Qi(n, t);
|
|
4270
4221
|
},
|
|
4271
4222
|
locale: i,
|
|
4272
4223
|
translations: a
|
|
4273
4224
|
}), [a, i]);
|
|
4274
|
-
return /* @__PURE__ */ P(
|
|
4225
|
+
return /* @__PURE__ */ P(Zi, {
|
|
4275
4226
|
value: o,
|
|
4276
4227
|
children: e
|
|
4277
4228
|
});
|
|
4278
4229
|
}
|
|
4279
|
-
function
|
|
4280
|
-
let e =
|
|
4230
|
+
function na() {
|
|
4231
|
+
let e = ge(Zi);
|
|
4281
4232
|
if (!e) throw Error("useI18n must be used within an I18nProvider");
|
|
4282
4233
|
return e;
|
|
4283
4234
|
}
|
|
4284
4235
|
//#endregion
|
|
4285
|
-
export {
|
|
4236
|
+
export { $r as AuthProvider, Ci as ConnectionStateRenderer, fi as DEBUG_OVERLAY_ENABLED, Si as DebugOverlay, ta as I18nProvider, at as IKON_UI_BASE_MODULE, Et as IKON_UI_MEDIA_MODULE, Wt as IKON_UI_SHADERTOY_MODULE, Ht as IKON_UI_SHADERTOY_TYPE, Re as IKON_UI_STREAM_CATEGORY, bt as IKON_UI_VIDEO_CANVAS_TYPE, xt as IKON_UI_VIDEO_URL_PLAYER_TYPE, Ki as IkonApp, Ve as IkonUi, Jt as IkonUiRegistry, Be as IkonUiSurface, Le as InspectOverlay, $t as ParallaxView, Pe as UiComponentRegistry, Ne as UiRenderer, n as UiStreamStore, vr as authenticateAnonymous, Ar as buildOAuthRedirectUrl, ur as clearAuthSession, kr as clearOAuthParams, it as createBaseResolvers, Fe as createComponentLibrary, Yt as createIkonUiRegistry, Ct as createMediaResolvers, Ut as createShadertoyRendererResolver, ze as isIkonUiCategoryMatch, rr as loadAuthSession, ot as loadBaseModule, Dt as loadMediaModule, Gt as loadShadertoyModule, xr as parseOAuthCallback, Tr as parseOAuthError, T as randomUuid, st as registerBaseModule, Ot as registerMediaModule, Kt as registerShadertoyModule, je as renderChildren, vn as renderMotionLetters, q as saveAuthSession, yr as sendLoginCode, J as sessionToUser, ei as useAuth, di as useAuthGuard, ti as useAuthOptional, na as useI18n, ki as useIkonApp, Vi as useIkonDebug, Mi as useIkonReactive, un as useIkonStyles, fn as useIkonUiStores, Ni as useReactive, ji as useToasts, I as useUiNode, Ie as useUiStore, br as verifyLoginCode };
|