@ikonai/sdk-react-ui 1.8.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/connection-state-renderer.d.ts +4 -4
- package/app/connection-state-renderer.spec.d.ts +1 -0
- package/app/ikon-app.d.ts +3 -3
- package/app/ikon-app.spec.d.ts +1 -0
- package/app/use-ikon-app.d.ts +6 -8
- package/app/use-ikon-debug.d.ts +1 -1
- package/auth/index.d.ts +1 -1
- package/auth/oauth-continuation.d.ts +15 -1
- package/index.d.ts +1 -1
- package/index.js +679 -630
- package/package.json +1 -1
- package/parallax-view.d.ts +2 -2
- package/renderer/index.d.ts +1 -1
- package/renderer/types.d.ts +12 -1
- package/renderer/ui-renderer.d.ts +2 -2
- package/surface.d.ts +2 -2
- package/theme/ikon-app.css +3 -1
package/index.js
CHANGED
|
@@ -77,6 +77,7 @@ function ze({ nodeType: e, nodeId: t, context: n, className: r }) {
|
|
|
77
77
|
"data-ikon-node-id": t,
|
|
78
78
|
"data-ikon-unresolved-node": e,
|
|
79
79
|
role: "alert",
|
|
80
|
+
className: r,
|
|
80
81
|
style: {
|
|
81
82
|
padding: "12px 16px",
|
|
82
83
|
border: "2px dashed #ef4444",
|
|
@@ -138,10 +139,10 @@ var Ge = D(function({ store: e, library: t, viewId: n, emptyFallback: r = null,
|
|
|
138
139
|
u.current = a;
|
|
139
140
|
let d = M(o);
|
|
140
141
|
d.current = o;
|
|
141
|
-
let f = O((e, t) => {
|
|
142
|
+
let f = O((e, t, n) => {
|
|
142
143
|
if (!e) return;
|
|
143
|
-
let
|
|
144
|
-
l.current?.(e, n);
|
|
144
|
+
let r = Pe(t);
|
|
145
|
+
l.current?.(e, r, n);
|
|
145
146
|
}, []), p = j(() => {
|
|
146
147
|
let n = {
|
|
147
148
|
store: e,
|
|
@@ -564,7 +565,7 @@ function st(e, t) {
|
|
|
564
565
|
e.addEventListener("wheel", r, i), e.addEventListener("touchmove", r, i), e.addEventListener("keydown", r, i);
|
|
565
566
|
let a = e.scrollHeight, o = new ResizeObserver(() => {
|
|
566
567
|
let r = e.scrollHeight > a;
|
|
567
|
-
a = e.scrollHeight, !(!r || n || !
|
|
568
|
+
a = e.scrollHeight, !(!r || n || !ft(e)) && at(e, t, "auto");
|
|
568
569
|
});
|
|
569
570
|
for (let t of Array.from(e.children)) o.observe(t);
|
|
570
571
|
let s = setTimeout(r, ot);
|
|
@@ -572,24 +573,24 @@ function st(e, t) {
|
|
|
572
573
|
clearTimeout(s), o.disconnect(), e.removeEventListener("wheel", r), e.removeEventListener("touchmove", r), e.removeEventListener("keydown", r);
|
|
573
574
|
};
|
|
574
575
|
}
|
|
575
|
-
var
|
|
576
|
-
function ut(e) {
|
|
577
|
-
return Math.max(e.clientHeight * ct, 20);
|
|
578
|
-
}
|
|
576
|
+
var ct = "data-ikon-scroll-indicator", lt = .15, ut = "data-ikon-at-bottom";
|
|
579
577
|
function dt(e) {
|
|
580
|
-
return e.
|
|
578
|
+
return Math.max(e.clientHeight * lt, 20);
|
|
581
579
|
}
|
|
582
580
|
function ft(e) {
|
|
583
|
-
e.getAttribute(
|
|
584
|
-
let { scrollTop: t, scrollHeight: n, clientHeight: r } = e, i = n - t - r <= ut(e);
|
|
585
|
-
e.setAttribute(lt, i ? "true" : "false");
|
|
586
|
-
}, { passive: !0 }));
|
|
581
|
+
return e.getAttribute(ut) !== "false";
|
|
587
582
|
}
|
|
588
583
|
function pt(e) {
|
|
589
|
-
|
|
584
|
+
e.getAttribute(ut) === null && (e.setAttribute(ut, "true"), e.addEventListener("scroll", () => {
|
|
585
|
+
let { scrollTop: t, scrollHeight: n, clientHeight: r } = e, i = n - t - r <= dt(e);
|
|
586
|
+
e.setAttribute(ut, i ? "true" : "false");
|
|
587
|
+
}, { passive: !0 }));
|
|
588
|
+
}
|
|
589
|
+
function mt(e) {
|
|
590
|
+
let t = e.parentElement ?? e, n = t.querySelector(`[${ct}]`);
|
|
590
591
|
if (n) return n;
|
|
591
592
|
let r = document.createElement("button");
|
|
592
|
-
return r.setAttribute(
|
|
593
|
+
return r.setAttribute(ct, "true"), r.setAttribute("aria-label", "Scroll to latest"), r.textContent = "↓", Object.assign(r.style, {
|
|
593
594
|
position: "absolute",
|
|
594
595
|
bottom: "12px",
|
|
595
596
|
left: "50%",
|
|
@@ -617,20 +618,20 @@ function pt(e) {
|
|
|
617
618
|
r.style.opacity = "0.9";
|
|
618
619
|
}), t.appendChild(r), r;
|
|
619
620
|
}
|
|
620
|
-
function
|
|
621
|
-
let n =
|
|
621
|
+
function ht(e, t) {
|
|
622
|
+
let n = mt(e);
|
|
622
623
|
n.style.display = "flex";
|
|
623
624
|
let r = () => {
|
|
624
625
|
at(e, t), n.style.display = "none";
|
|
625
626
|
}, i = () => {
|
|
626
627
|
let { scrollTop: t, scrollHeight: r, clientHeight: i } = e;
|
|
627
|
-
r - t - i <=
|
|
628
|
+
r - t - i <= dt(e) && (n.style.display = "none");
|
|
628
629
|
};
|
|
629
630
|
return n.addEventListener("click", r), e.addEventListener("scroll", i, { passive: !0 }), () => {
|
|
630
631
|
n.removeEventListener("click", r), e.removeEventListener("scroll", i);
|
|
631
632
|
};
|
|
632
633
|
}
|
|
633
|
-
function
|
|
634
|
+
function gt() {
|
|
634
635
|
let e = D(function({ nodeId: e, context: t }) {
|
|
635
636
|
let n = I(t.store, e), r = M(null), i = B(n?.props?.targetViewId), a = n?.props?.focusOnly, o = typeof a == "boolean" ? a : void 0, s = B(n?.props?.priority), c = B(n?.props?.key), l = n?.props?.preciseGeneratedAt;
|
|
636
637
|
return k(() => {
|
|
@@ -641,9 +642,9 @@ function ht() {
|
|
|
641
642
|
if (o !== !0) {
|
|
642
643
|
let r = U(e);
|
|
643
644
|
if (r) {
|
|
644
|
-
if (
|
|
645
|
+
if (pt(r), s === "Polite" && !ft(r)) t = ht(r, e);
|
|
645
646
|
else {
|
|
646
|
-
let t = (r.parentElement ?? r).querySelector(`[${
|
|
647
|
+
let t = (r.parentElement ?? r).querySelector(`[${ct}]`);
|
|
647
648
|
t && (t.style.display = "none"), at(r, e), n = st(r, e);
|
|
648
649
|
}
|
|
649
650
|
} else typeof e.scrollIntoView == "function" && requestAnimationFrame(() => {
|
|
@@ -692,7 +693,7 @@ function ht() {
|
|
|
692
693
|
if (t === "std.focus-hint") return e;
|
|
693
694
|
};
|
|
694
695
|
}
|
|
695
|
-
function
|
|
696
|
+
function _t() {
|
|
696
697
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
697
698
|
let r = I(t.store, e), i = $e(r?.props?.onInvokeId), a = O(() => {
|
|
698
699
|
i && t.dispatchAction(i);
|
|
@@ -720,7 +721,7 @@ function gt() {
|
|
|
720
721
|
if (t === "std.div") return e;
|
|
721
722
|
};
|
|
722
723
|
}
|
|
723
|
-
function
|
|
724
|
+
function vt() {
|
|
724
725
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
725
726
|
let r = I(t.store, e);
|
|
726
727
|
if (!r) return null;
|
|
@@ -737,7 +738,7 @@ function _t() {
|
|
|
737
738
|
if (t === "std.stack") return e;
|
|
738
739
|
};
|
|
739
740
|
}
|
|
740
|
-
function
|
|
741
|
+
function yt() {
|
|
741
742
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
742
743
|
let r = I(t.store, e);
|
|
743
744
|
if (!r) return null;
|
|
@@ -754,23 +755,23 @@ function vt() {
|
|
|
754
755
|
if (t === "std.layer") return e;
|
|
755
756
|
};
|
|
756
757
|
}
|
|
757
|
-
function
|
|
758
|
+
function bt() {
|
|
758
759
|
return [
|
|
759
|
-
gt(),
|
|
760
760
|
_t(),
|
|
761
761
|
vt(),
|
|
762
|
-
|
|
762
|
+
yt(),
|
|
763
|
+
gt()
|
|
763
764
|
];
|
|
764
765
|
}
|
|
765
766
|
//#endregion
|
|
766
767
|
//#region src/base/base-module.ts
|
|
767
|
-
var
|
|
768
|
-
function
|
|
769
|
-
e.registerModule(
|
|
768
|
+
var xt = "base", St = async () => bt();
|
|
769
|
+
function Ct(e) {
|
|
770
|
+
e.registerModule(xt, St);
|
|
770
771
|
}
|
|
771
772
|
//#endregion
|
|
772
773
|
//#region src/media/audio-player.tsx
|
|
773
|
-
function
|
|
774
|
+
function wt(e) {
|
|
774
775
|
if (typeof e == "string") {
|
|
775
776
|
let t = e.trim();
|
|
776
777
|
return t.length > 0 ? t : void 0;
|
|
@@ -780,17 +781,17 @@ function Ct(e) {
|
|
|
780
781
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
781
782
|
}
|
|
782
783
|
}
|
|
783
|
-
function
|
|
784
|
+
function Tt(...e) {
|
|
784
785
|
let t = [];
|
|
785
786
|
for (let n of e) n && n.trim() && t.push(n.trim());
|
|
786
787
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
787
788
|
}
|
|
788
|
-
function
|
|
789
|
+
function Et(e) {
|
|
789
790
|
if (typeof e != "string") return;
|
|
790
791
|
let t = e.trim();
|
|
791
792
|
return t.length > 0 ? t : void 0;
|
|
792
793
|
}
|
|
793
|
-
function
|
|
794
|
+
function Dt(e) {
|
|
794
795
|
if (typeof e == "boolean") return e;
|
|
795
796
|
if (typeof e == "string") {
|
|
796
797
|
let t = e.trim().toLowerCase();
|
|
@@ -798,13 +799,13 @@ function Et(e) {
|
|
|
798
799
|
if (t === "false") return !1;
|
|
799
800
|
}
|
|
800
801
|
}
|
|
801
|
-
function
|
|
802
|
+
function Ot() {
|
|
802
803
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
803
|
-
let r = I(t.store, e), i = M(null), a = r ?
|
|
804
|
+
let r = I(t.store, e), i = M(null), a = r ? Dt(r.props?.autoplay) : void 0, o = r ? Et(r.props?.src) : void 0;
|
|
804
805
|
if (k(() => {
|
|
805
806
|
a && i.current && i.current.play().catch(() => {});
|
|
806
807
|
}, [a, o]), !r) return null;
|
|
807
|
-
let s = wt(
|
|
808
|
+
let s = Tt(wt(r.props?.className), n), c = Et(r.props?.preload), l = Dt(r.props?.controls), u = Dt(r.props?.loop), d = Dt(r.props?.muted);
|
|
808
809
|
return /* @__PURE__ */ P("audio", {
|
|
809
810
|
ref: i,
|
|
810
811
|
src: o,
|
|
@@ -824,7 +825,7 @@ function Dt() {
|
|
|
824
825
|
}
|
|
825
826
|
//#endregion
|
|
826
827
|
//#region src/media/video-stream-view.tsx
|
|
827
|
-
var
|
|
828
|
+
var kt = S("IkonVideoStreamView"), At = D(function({ client: e, streamId: t, className: n, style: r, width: i, height: a, attributes: o, getPlayback: s }) {
|
|
828
829
|
let c = M(null), l = M(null), [, u] = N(0);
|
|
829
830
|
k(() => {
|
|
830
831
|
if (e?.isWebRtcEnabled) return e.addWebRtcTrackMapListener((e) => {
|
|
@@ -840,14 +841,14 @@ var Ot = S("IkonVideoStreamView"), kt = D(function({ client: e, streamId: t, cla
|
|
|
840
841
|
let e = o();
|
|
841
842
|
if (!e) {
|
|
842
843
|
if (a++ >= 50) {
|
|
843
|
-
|
|
844
|
+
kt.warn(`Gave up attaching the canvas for stream ${t}: video playback never became available`);
|
|
844
845
|
return;
|
|
845
846
|
}
|
|
846
847
|
i = setTimeout(l, 100);
|
|
847
848
|
return;
|
|
848
849
|
}
|
|
849
850
|
e.attachCanvas(t, n).catch((e) => {
|
|
850
|
-
|
|
851
|
+
kt.error(`Failed to attach the canvas for stream ${t}, it will stay blank: ${String(e)}`);
|
|
851
852
|
});
|
|
852
853
|
};
|
|
853
854
|
return l(), () => {
|
|
@@ -885,7 +886,7 @@ var Ot = S("IkonVideoStreamView"), kt = D(function({ client: e, streamId: t, cla
|
|
|
885
886
|
});
|
|
886
887
|
//#endregion
|
|
887
888
|
//#region src/media/video-canvas.tsx
|
|
888
|
-
function
|
|
889
|
+
function jt(e) {
|
|
889
890
|
if (typeof e == "string") {
|
|
890
891
|
let t = e.trim();
|
|
891
892
|
return t.length > 0 ? t : void 0;
|
|
@@ -895,27 +896,27 @@ function At(e) {
|
|
|
895
896
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
896
897
|
}
|
|
897
898
|
}
|
|
898
|
-
function
|
|
899
|
+
function Mt(...e) {
|
|
899
900
|
let t = [];
|
|
900
901
|
for (let n of e) n && n.trim() && t.push(n.trim());
|
|
901
902
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
902
903
|
}
|
|
903
|
-
function
|
|
904
|
+
function Nt(e) {
|
|
904
905
|
if (typeof e == "number" && Number.isFinite(e)) return Math.floor(e);
|
|
905
906
|
if (typeof e == "string" && e.trim().length > 0) {
|
|
906
907
|
let t = Number(e);
|
|
907
908
|
if (Number.isFinite(t)) return Math.floor(t);
|
|
908
909
|
}
|
|
909
910
|
}
|
|
910
|
-
function
|
|
911
|
+
function Pt(e) {
|
|
911
912
|
if (typeof e != "string") return;
|
|
912
913
|
let t = e.trim();
|
|
913
914
|
return t.length > 0 ? t : void 0;
|
|
914
915
|
}
|
|
915
|
-
var
|
|
916
|
-
function
|
|
916
|
+
var Ft = "std.video-canvas", It = "std.video-url-player";
|
|
917
|
+
function Lt() {
|
|
917
918
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
918
|
-
let r = I(t.store, e), i = r ?
|
|
919
|
+
let r = I(t.store, e), i = r ? Pt(r.props?.streamId) : void 0, a = r ? Pt(r.props?.onTapId) : void 0, o = r ? Nt(r.props?.width) : void 0, s = r ? Nt(r.props?.height) : void 0, c = r ? Mt(jt(r.props?.className), n) : n, l = O(() => t.video ?? t.client?.media?.video, [t]), u = O((e) => {
|
|
919
920
|
if (!a) return;
|
|
920
921
|
let n = e.target.getBoundingClientRect();
|
|
921
922
|
n.width <= 0 || n.height <= 0 || t.dispatchAction(a, {
|
|
@@ -924,7 +925,7 @@ function It() {
|
|
|
924
925
|
});
|
|
925
926
|
}, [a, t]);
|
|
926
927
|
if (!r) return null;
|
|
927
|
-
let d = /* @__PURE__ */ P(
|
|
928
|
+
let d = /* @__PURE__ */ P(At, {
|
|
928
929
|
client: t.client,
|
|
929
930
|
streamId: i,
|
|
930
931
|
className: c,
|
|
@@ -949,14 +950,14 @@ function It() {
|
|
|
949
950
|
if (t === "std.video-canvas") return e;
|
|
950
951
|
};
|
|
951
952
|
}
|
|
952
|
-
function
|
|
953
|
+
function Rt() {
|
|
953
954
|
return [
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
955
|
+
Lt(),
|
|
956
|
+
Bt(),
|
|
957
|
+
Ot()
|
|
957
958
|
];
|
|
958
959
|
}
|
|
959
|
-
function
|
|
960
|
+
function zt(e) {
|
|
960
961
|
if (typeof e == "boolean") return e;
|
|
961
962
|
if (typeof e == "string") {
|
|
962
963
|
let t = e.trim().toLowerCase();
|
|
@@ -964,13 +965,13 @@ function Rt(e) {
|
|
|
964
965
|
if (t === "false") return !1;
|
|
965
966
|
}
|
|
966
967
|
}
|
|
967
|
-
function
|
|
968
|
+
function Bt() {
|
|
968
969
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
969
|
-
let r = I(t.store, e), i = M(null), a = r ?
|
|
970
|
+
let r = I(t.store, e), i = M(null), a = r ? zt(r.props?.autoplay) : void 0, o = r ? Pt(r.props?.src) : void 0;
|
|
970
971
|
if (k(() => {
|
|
971
972
|
a && i.current && i.current.play().catch(() => {});
|
|
972
973
|
}, [a, o]), !r) return null;
|
|
973
|
-
let s = jt(
|
|
974
|
+
let s = Mt(jt(r.props?.className), n), c = Pt(r.props?.poster), l = zt(r.props?.controls), u = zt(r.props?.loop), d = zt(r.props?.muted), f = zt(r.props?.playsInline), p = Nt(r.props?.width), m = Nt(r.props?.height), h = r.children?.length ? t.renderChildren(r.children) : void 0;
|
|
974
975
|
return /* @__PURE__ */ P("video", {
|
|
975
976
|
ref: i,
|
|
976
977
|
src: o,
|
|
@@ -994,20 +995,20 @@ function zt() {
|
|
|
994
995
|
}
|
|
995
996
|
//#endregion
|
|
996
997
|
//#region src/media/media-module.ts
|
|
997
|
-
var
|
|
998
|
-
function
|
|
999
|
-
e.registerModule(
|
|
998
|
+
var Vt = "media", Ht = async () => Rt();
|
|
999
|
+
function Ut(e) {
|
|
1000
|
+
e.registerModule(Vt, Ht);
|
|
1000
1001
|
}
|
|
1001
1002
|
//#endregion
|
|
1002
1003
|
//#region src/shadertoy/shadertoy-gl.ts
|
|
1003
|
-
var
|
|
1004
|
-
function
|
|
1004
|
+
var Wt = "#version 300 es\nin vec4 a_position;\nvoid main() {\n gl_Position = a_position;\n}\n", Gt = 4;
|
|
1005
|
+
function Kt(e, t) {
|
|
1005
1006
|
return RegExp(`\\buniform\\s+\\w+\\s+${t}\\s*;`, "g").test(e);
|
|
1006
1007
|
}
|
|
1007
|
-
function
|
|
1008
|
+
function qt(e, t) {
|
|
1008
1009
|
let n = [];
|
|
1009
1010
|
for (let [r, i] of Object.entries(t)) {
|
|
1010
|
-
if (
|
|
1011
|
+
if (Kt(e, r)) continue;
|
|
1011
1012
|
let t;
|
|
1012
1013
|
switch (i.type) {
|
|
1013
1014
|
case "float":
|
|
@@ -1065,7 +1066,7 @@ void main() {
|
|
|
1065
1066
|
}
|
|
1066
1067
|
`;
|
|
1067
1068
|
}
|
|
1068
|
-
var
|
|
1069
|
+
var Jt = class {
|
|
1069
1070
|
gl;
|
|
1070
1071
|
program = null;
|
|
1071
1072
|
positionBuffer = null;
|
|
@@ -1081,7 +1082,7 @@ var qt = class {
|
|
|
1081
1082
|
mouseClickY = 0;
|
|
1082
1083
|
channels = [];
|
|
1083
1084
|
channelResolution = /* @__PURE__ */ new Float32Array(12);
|
|
1084
|
-
channelTime = new Float32Array(
|
|
1085
|
+
channelTime = new Float32Array(Gt);
|
|
1085
1086
|
lastError = null;
|
|
1086
1087
|
currentShaderSource = "";
|
|
1087
1088
|
constructor(e) {
|
|
@@ -1116,7 +1117,7 @@ var qt = class {
|
|
|
1116
1117
|
}
|
|
1117
1118
|
initializeChannels() {
|
|
1118
1119
|
let e = this.gl;
|
|
1119
|
-
for (let t = 0; t <
|
|
1120
|
+
for (let t = 0; t < Gt; t++) {
|
|
1120
1121
|
let t = e.createTexture();
|
|
1121
1122
|
e.bindTexture(e.TEXTURE_2D, t), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, 1, 1, 0, e.RGBA, e.UNSIGNED_BYTE, new Uint8Array([
|
|
1122
1123
|
0,
|
|
@@ -1133,7 +1134,7 @@ var qt = class {
|
|
|
1133
1134
|
e.bindTexture(e.TEXTURE_2D, null);
|
|
1134
1135
|
}
|
|
1135
1136
|
setChannels(e) {
|
|
1136
|
-
for (let t = 0; t <
|
|
1137
|
+
for (let t = 0; t < Gt; t++) {
|
|
1137
1138
|
let n = e[t] ?? null, r = this.channels[t];
|
|
1138
1139
|
if (r.url !== n) {
|
|
1139
1140
|
if (r.url = n, !n) {
|
|
@@ -1164,9 +1165,9 @@ var qt = class {
|
|
|
1164
1165
|
}
|
|
1165
1166
|
compile(e, t = {}) {
|
|
1166
1167
|
this.lastError = null, this.customUniforms = t, this.currentShaderSource = e;
|
|
1167
|
-
let n = this.gl, r = this.compileShader(n.VERTEX_SHADER,
|
|
1168
|
+
let n = this.gl, r = this.compileShader(n.VERTEX_SHADER, Wt);
|
|
1168
1169
|
if (!r) return !1;
|
|
1169
|
-
let i =
|
|
1170
|
+
let i = qt(e, t), a = this.compileShader(n.FRAGMENT_SHADER, i);
|
|
1170
1171
|
if (!a) return n.deleteShader(r), !1;
|
|
1171
1172
|
let o = n.createProgram();
|
|
1172
1173
|
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);
|
|
@@ -1190,7 +1191,7 @@ var qt = class {
|
|
|
1190
1191
|
"iMouse",
|
|
1191
1192
|
"iDate"
|
|
1192
1193
|
]) this.uniformLocations.set(t, e.getUniformLocation(this.program, t));
|
|
1193
|
-
for (let t = 0; t <
|
|
1194
|
+
for (let t = 0; t < Gt; t++) this.uniformLocations.set(`iChannel${t}`, e.getUniformLocation(this.program, `iChannel${t}`));
|
|
1194
1195
|
this.uniformLocations.set("iChannelResolution", e.getUniformLocation(this.program, "iChannelResolution[0]")), this.uniformLocations.set("iChannelTime", e.getUniformLocation(this.program, "iChannelTime[0]"));
|
|
1195
1196
|
for (let t of Object.keys(this.customUniforms)) this.uniformLocations.set(t, e.getUniformLocation(this.program, t));
|
|
1196
1197
|
}
|
|
@@ -1222,7 +1223,7 @@ var qt = class {
|
|
|
1222
1223
|
let t = /* @__PURE__ */ new Date();
|
|
1223
1224
|
e.uniform4f(p, t.getFullYear(), t.getMonth(), t.getDate(), t.getHours() * 3600 + t.getMinutes() * 60 + t.getSeconds() + t.getMilliseconds() / 1e3);
|
|
1224
1225
|
}
|
|
1225
|
-
for (let t = 0; t <
|
|
1226
|
+
for (let t = 0; t < Gt; t++) {
|
|
1226
1227
|
e.activeTexture(e.TEXTURE0 + t), e.bindTexture(e.TEXTURE_2D, this.channels[t].texture);
|
|
1227
1228
|
let n = this.uniformLocations.get(`iChannel${t}`);
|
|
1228
1229
|
n && e.uniform1i(n, t);
|
|
@@ -1272,7 +1273,7 @@ var qt = class {
|
|
|
1272
1273
|
};
|
|
1273
1274
|
//#endregion
|
|
1274
1275
|
//#region src/shadertoy/shadertoy-renderer.tsx
|
|
1275
|
-
function
|
|
1276
|
+
function Yt(e) {
|
|
1276
1277
|
if (typeof e == "string") {
|
|
1277
1278
|
let t = e.trim();
|
|
1278
1279
|
return t.length > 0 ? t : void 0;
|
|
@@ -1282,22 +1283,22 @@ function Jt(e) {
|
|
|
1282
1283
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
1283
1284
|
}
|
|
1284
1285
|
}
|
|
1285
|
-
function
|
|
1286
|
+
function Xt(...e) {
|
|
1286
1287
|
let t = [];
|
|
1287
1288
|
for (let n of e) n && n.trim() && t.push(n.trim());
|
|
1288
1289
|
return t.length > 0 ? t.join(" ") : void 0;
|
|
1289
1290
|
}
|
|
1290
|
-
function
|
|
1291
|
+
function Zt(e) {
|
|
1291
1292
|
if (typeof e == "number" && Number.isFinite(e)) return Math.floor(e);
|
|
1292
1293
|
if (typeof e == "string" && e.trim().length > 0) {
|
|
1293
1294
|
let t = Number(e);
|
|
1294
1295
|
if (Number.isFinite(t)) return Math.floor(t);
|
|
1295
1296
|
}
|
|
1296
1297
|
}
|
|
1297
|
-
function
|
|
1298
|
+
function Qt(e) {
|
|
1298
1299
|
return typeof e == "string" ? e : "";
|
|
1299
1300
|
}
|
|
1300
|
-
function
|
|
1301
|
+
function $t(e) {
|
|
1301
1302
|
if (typeof e == "boolean") return e;
|
|
1302
1303
|
if (typeof e == "string") {
|
|
1303
1304
|
let t = e.trim().toLowerCase();
|
|
@@ -1305,7 +1306,7 @@ function Qt(e) {
|
|
|
1305
1306
|
if (t === "false") return !1;
|
|
1306
1307
|
}
|
|
1307
1308
|
}
|
|
1308
|
-
function
|
|
1309
|
+
function en(e) {
|
|
1309
1310
|
if (!e || typeof e != "object") return {};
|
|
1310
1311
|
let t = {}, n = e;
|
|
1311
1312
|
for (let [e, r] of Object.entries(n)) {
|
|
@@ -1325,10 +1326,10 @@ function $t(e) {
|
|
|
1325
1326
|
}
|
|
1326
1327
|
return t;
|
|
1327
1328
|
}
|
|
1328
|
-
function
|
|
1329
|
+
function tn(e) {
|
|
1329
1330
|
return Array.isArray(e) ? e.map((e) => typeof e == "string" ? e : null) : [];
|
|
1330
1331
|
}
|
|
1331
|
-
function
|
|
1332
|
+
function nn(e, t) {
|
|
1332
1333
|
let n = Object.keys(e), r = Object.keys(t);
|
|
1333
1334
|
if (n.length !== r.length) return !1;
|
|
1334
1335
|
for (let r of n) {
|
|
@@ -1342,8 +1343,8 @@ function tn(e, t) {
|
|
|
1342
1343
|
}
|
|
1343
1344
|
return !0;
|
|
1344
1345
|
}
|
|
1345
|
-
var
|
|
1346
|
-
function
|
|
1346
|
+
var rn = "std.shadertoy-canvas";
|
|
1347
|
+
function an() {
|
|
1347
1348
|
let e = D(function({ nodeId: e, context: t, className: n }) {
|
|
1348
1349
|
let r = I(t.store, e), i = M(null), a = M(null), o = M(null), s = M(0), c = M(""), l = M({}), u = M({
|
|
1349
1350
|
x: 0,
|
|
@@ -1351,12 +1352,12 @@ function rn() {
|
|
|
1351
1352
|
clickX: 0,
|
|
1352
1353
|
clickY: 0,
|
|
1353
1354
|
isDown: !1
|
|
1354
|
-
}), d = r ?
|
|
1355
|
+
}), d = r ? Qt(r.props?.shaderSource) : "", f = r ? Zt(r.props?.fps) ?? 60 : 60, p = r?.props?.uniforms, m = j(() => en(p), [p]), h = r?.props?.channels, g = j(() => tn(h), [h]), _ = r ? $t(r.props?.enableMouse) ?? !0 : !0, v = r ? Zt(r.props?.width) : void 0, y = r ? Zt(r.props?.height) : void 0, ee = r ? Xt(Yt(r.props?.className), n) : n;
|
|
1355
1356
|
k(() => {
|
|
1356
1357
|
let e = i.current;
|
|
1357
1358
|
if (e) {
|
|
1358
1359
|
try {
|
|
1359
|
-
let t = new
|
|
1360
|
+
let t = new Jt(e);
|
|
1360
1361
|
a.current = t;
|
|
1361
1362
|
} catch (e) {
|
|
1362
1363
|
console.error("[ShadertoyRenderer] Failed to create WebGL2 context:", e);
|
|
@@ -1376,7 +1377,7 @@ function rn() {
|
|
|
1376
1377
|
}
|
|
1377
1378
|
}, [d, m]), k(() => {
|
|
1378
1379
|
let e = a.current;
|
|
1379
|
-
!e || !c.current ||
|
|
1380
|
+
!e || !c.current || nn(l.current, m) || (e.setCustomUniforms(m), l.current = m);
|
|
1380
1381
|
}, [m]), k(() => {
|
|
1381
1382
|
let e = a.current;
|
|
1382
1383
|
e && e.setChannels(g);
|
|
@@ -1425,13 +1426,13 @@ function rn() {
|
|
|
1425
1426
|
}
|
|
1426
1427
|
//#endregion
|
|
1427
1428
|
//#region src/shadertoy/shadertoy-module.ts
|
|
1428
|
-
var
|
|
1429
|
-
function
|
|
1430
|
-
e.registerModule(
|
|
1429
|
+
var on = "shadertoy", sn = async () => an();
|
|
1430
|
+
function cn(e) {
|
|
1431
|
+
e.registerModule(on, sn);
|
|
1431
1432
|
}
|
|
1432
1433
|
//#endregion
|
|
1433
1434
|
//#region src/ikon-ui-registry.ts
|
|
1434
|
-
var
|
|
1435
|
+
var ln = S("UIRegistry"), un = class {
|
|
1435
1436
|
baseResolvers = [];
|
|
1436
1437
|
moduleLoaders = /* @__PURE__ */ new Map();
|
|
1437
1438
|
moduleResolvers = /* @__PURE__ */ new Map();
|
|
@@ -1457,14 +1458,14 @@ var cn = S("UIRegistry"), ln = class {
|
|
|
1457
1458
|
async loadRegisteredModules() {
|
|
1458
1459
|
let e = !1;
|
|
1459
1460
|
for (let [t, n] of this.moduleLoaders.entries()) if (!this.moduleResolvers.has(t)) try {
|
|
1460
|
-
let r =
|
|
1461
|
+
let r = pn(await n());
|
|
1461
1462
|
this.moduleResolvers.set(t, r), e = !0;
|
|
1462
1463
|
} catch (e) {
|
|
1463
|
-
|
|
1464
|
+
ln.error(`[IkonUiRegistry] Failed to load module '${t}'.`, e);
|
|
1464
1465
|
}
|
|
1465
1466
|
let t = [];
|
|
1466
1467
|
for (let e of this.moduleLoaders.keys()) this.moduleResolvers.has(e) && t.push(e);
|
|
1467
|
-
return
|
|
1468
|
+
return mn(t, this.activeModuleOrder) || (this.activeModuleOrder = t, e = !0), e && this.notify(), e;
|
|
1468
1469
|
}
|
|
1469
1470
|
resolve(e) {
|
|
1470
1471
|
for (let t of this.baseResolvers) {
|
|
@@ -1474,7 +1475,7 @@ var cn = S("UIRegistry"), ln = class {
|
|
|
1474
1475
|
for (let t of this.activeModuleOrder) {
|
|
1475
1476
|
let n = this.moduleResolvers.get(t);
|
|
1476
1477
|
if (!n) {
|
|
1477
|
-
|
|
1478
|
+
ln.warn(`Missing resolvers for module ${t}`);
|
|
1478
1479
|
continue;
|
|
1479
1480
|
}
|
|
1480
1481
|
for (let t of n) {
|
|
@@ -1487,24 +1488,24 @@ var cn = S("UIRegistry"), ln = class {
|
|
|
1487
1488
|
for (let e of this.listeners) e();
|
|
1488
1489
|
}
|
|
1489
1490
|
};
|
|
1490
|
-
function
|
|
1491
|
-
let e = new
|
|
1492
|
-
return
|
|
1491
|
+
function dn() {
|
|
1492
|
+
let e = new un();
|
|
1493
|
+
return Ct(e), Ut(e), cn(e), e.loadRegisteredModules(), e;
|
|
1493
1494
|
}
|
|
1494
|
-
function
|
|
1495
|
+
function fn(e) {
|
|
1495
1496
|
return Array.isArray(e) ? e : [e];
|
|
1496
1497
|
}
|
|
1497
|
-
function
|
|
1498
|
-
return e ?
|
|
1498
|
+
function pn(e) {
|
|
1499
|
+
return e ? fn(e).flatMap((e) => e ? Array.isArray(e) ? e.filter(Boolean) : [e] : []) : [];
|
|
1499
1500
|
}
|
|
1500
|
-
function
|
|
1501
|
+
function mn(e, t) {
|
|
1501
1502
|
if (e.length !== t.length) return !1;
|
|
1502
1503
|
for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
|
|
1503
1504
|
return !0;
|
|
1504
1505
|
}
|
|
1505
1506
|
//#endregion
|
|
1506
1507
|
//#region src/parallax-view.tsx
|
|
1507
|
-
function
|
|
1508
|
+
function hn({ mount: e, stores: t, registry: n, client: r, onAction: i }) {
|
|
1508
1509
|
return /* @__PURE__ */ P(z, {
|
|
1509
1510
|
stores: t,
|
|
1510
1511
|
registry: n,
|
|
@@ -1515,7 +1516,7 @@ function mn({ mount: e, stores: t, registry: n, client: r, onAction: i }) {
|
|
|
1515
1516
|
}
|
|
1516
1517
|
//#endregion
|
|
1517
1518
|
//#region src/motion/motion-controller.ts
|
|
1518
|
-
var
|
|
1519
|
+
var gn = S("MotionController"), _n = {
|
|
1519
1520
|
ease: [
|
|
1520
1521
|
.25,
|
|
1521
1522
|
.1,
|
|
@@ -1685,20 +1686,20 @@ var hn = S("MotionController"), gn = {
|
|
|
1685
1686
|
1.55
|
|
1686
1687
|
]
|
|
1687
1688
|
};
|
|
1688
|
-
function
|
|
1689
|
+
function W(e) {
|
|
1689
1690
|
return e <= 0 ? 0 : e >= 1 ? 1 : e;
|
|
1690
1691
|
}
|
|
1691
|
-
function
|
|
1692
|
+
function vn(e) {
|
|
1692
1693
|
if (e == null) return;
|
|
1693
1694
|
let t = e.trim();
|
|
1694
1695
|
if (!t) return;
|
|
1695
1696
|
let n = Number.parseFloat(t);
|
|
1696
1697
|
return Number.isFinite(n) ? n : void 0;
|
|
1697
1698
|
}
|
|
1698
|
-
function
|
|
1699
|
+
function yn(e) {
|
|
1699
1700
|
return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/[^a-zA-Z0-9_-]/g, (e) => `\\${e}`);
|
|
1700
1701
|
}
|
|
1701
|
-
function
|
|
1702
|
+
function bn(e, t, n, r) {
|
|
1702
1703
|
let i = 1 / 10, a = /* @__PURE__ */ new Float32Array(11);
|
|
1703
1704
|
function o(e, t, n) {
|
|
1704
1705
|
return ((3 * t - 3 * n + 1) * e + (3 * n - 6 * t)) * e * e + 3 * t * e;
|
|
@@ -1732,34 +1733,34 @@ function yn(e, t, n, r) {
|
|
|
1732
1733
|
for (let t = 0; t < 11; t += 1) a[t] = o(t * i, e, n);
|
|
1733
1734
|
return (e) => e <= 0 ? 0 : e >= 1 ? 1 : o(u(e), t, r);
|
|
1734
1735
|
}
|
|
1735
|
-
function
|
|
1736
|
+
function xn(e) {
|
|
1736
1737
|
let t = /steps\(\s*([0-9]+)\s*(?:,\s*([a-z-]+)\s*)?\)/i.exec(e);
|
|
1737
|
-
if (!t) return (e) =>
|
|
1738
|
+
if (!t) return (e) => W(e);
|
|
1738
1739
|
let n = Math.max(1, parseInt(t[1], 10)), r = (t[2] ?? "end").toLowerCase();
|
|
1739
|
-
return r === "start" || r === "jump-start" ? (e) =>
|
|
1740
|
+
return r === "start" || r === "jump-start" ? (e) => W(Math.ceil(e * n) / n) : r === "none" || r === "jump-none" ? (e) => W(Math.round(e * n) / n) : r === "both" || r === "jump-both" ? (e) => W((Math.floor(e * n) + .5) / n) : (e) => W(Math.floor(e * n) / n);
|
|
1740
1741
|
}
|
|
1741
|
-
function
|
|
1742
|
-
if (!e) return (e) =>
|
|
1742
|
+
function Sn(e) {
|
|
1743
|
+
if (!e) return (e) => W(e);
|
|
1743
1744
|
let t = e.trim().toLowerCase();
|
|
1744
|
-
if (!t || t === "linear") return (e) =>
|
|
1745
|
-
if (
|
|
1746
|
-
let [e, n, r, i] =
|
|
1747
|
-
return (e) =>
|
|
1745
|
+
if (!t || t === "linear") return (e) => W(e);
|
|
1746
|
+
if (_n[t]) {
|
|
1747
|
+
let [e, n, r, i] = _n[t], a = bn(e, n, r, i);
|
|
1748
|
+
return (e) => W(a(W(e)));
|
|
1748
1749
|
}
|
|
1749
1750
|
if (t.startsWith("cubic-bezier(") && t.endsWith(")")) {
|
|
1750
1751
|
let e = t.slice(13, -1).split(",").map((e) => Number.parseFloat(e.trim()));
|
|
1751
1752
|
if (e.length === 4 && e.every((e) => Number.isFinite(e))) {
|
|
1752
|
-
let [t, n, r, i] = e, a =
|
|
1753
|
-
return (e) =>
|
|
1753
|
+
let [t, n, r, i] = e, a = bn(t, n, r, i);
|
|
1754
|
+
return (e) => W(a(W(e)));
|
|
1754
1755
|
}
|
|
1755
1756
|
}
|
|
1756
1757
|
if (t.startsWith("steps(") && t.endsWith(")")) {
|
|
1757
|
-
let e =
|
|
1758
|
-
return (t) => e(
|
|
1758
|
+
let e = xn(t);
|
|
1759
|
+
return (t) => e(W(t));
|
|
1759
1760
|
}
|
|
1760
|
-
return (e) =>
|
|
1761
|
+
return (e) => W(e);
|
|
1761
1762
|
}
|
|
1762
|
-
function
|
|
1763
|
+
function Cn(e) {
|
|
1763
1764
|
if (!e) return;
|
|
1764
1765
|
let t = /(-?\d+(?:\.\d+)?)\s*\.\.\s*(-?\d+(?:\.\d+)?)\s*->\s*(-?\d+(?:\.\d+)?)\s*\.\.\s*(-?\d+(?:\.\d+)?)/.exec(e);
|
|
1765
1766
|
if (!t) return;
|
|
@@ -1776,7 +1777,7 @@ function Sn(e) {
|
|
|
1776
1777
|
outEnd: a
|
|
1777
1778
|
};
|
|
1778
1779
|
}
|
|
1779
|
-
var
|
|
1780
|
+
var wn = new class {
|
|
1780
1781
|
bindingsByStyle = /* @__PURE__ */ new Map();
|
|
1781
1782
|
observer;
|
|
1782
1783
|
observeScheduled = !1;
|
|
@@ -1787,7 +1788,7 @@ var Cn = new class {
|
|
|
1787
1788
|
globalCleanups = /* @__PURE__ */ new Set();
|
|
1788
1789
|
registerStyle(e, t) {
|
|
1789
1790
|
if (!e) return;
|
|
1790
|
-
let n = this.parseMetadata(t);
|
|
1791
|
+
let n = this.parseMetadata(e, t);
|
|
1791
1792
|
if (!n) {
|
|
1792
1793
|
this.bindingsByStyle.delete(e), this.cleanupStyle(e);
|
|
1793
1794
|
return;
|
|
@@ -1801,32 +1802,43 @@ var Cn = new class {
|
|
|
1801
1802
|
for (let e of Array.from(this.globalCleanups)) try {
|
|
1802
1803
|
e();
|
|
1803
1804
|
} catch (e) {
|
|
1804
|
-
|
|
1805
|
+
gn.warn("Failed to cleanup binding listener", e);
|
|
1805
1806
|
}
|
|
1806
1807
|
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);
|
|
1807
1808
|
}
|
|
1808
|
-
parseMetadata(e) {
|
|
1809
|
-
if (
|
|
1810
|
-
let
|
|
1811
|
-
|
|
1809
|
+
parseMetadata(e, t) {
|
|
1810
|
+
if (t) try {
|
|
1811
|
+
let n = JSON.parse(t).motionBindings ?? [], r = n.map((t) => this.parseBinding(e, t)).filter((e) => e !== void 0);
|
|
1812
|
+
if (r.length === 0) {
|
|
1813
|
+
n.length > 0 && gn.warn(`Style ${e} declares ${n.length} motion binding(s) but none are usable; it will not animate`);
|
|
1814
|
+
return;
|
|
1815
|
+
}
|
|
1816
|
+
return { bindings: r };
|
|
1812
1817
|
} catch (e) {
|
|
1813
|
-
|
|
1818
|
+
gn.warn("Failed to parse motion metadata", e);
|
|
1814
1819
|
return;
|
|
1815
1820
|
}
|
|
1816
1821
|
}
|
|
1817
|
-
parseBinding(e) {
|
|
1818
|
-
let
|
|
1819
|
-
if (!
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1822
|
+
parseBinding(e, t) {
|
|
1823
|
+
let n = t.source?.trim();
|
|
1824
|
+
if (!n) {
|
|
1825
|
+
gn.warn(`Style ${e} has a motion binding with no source; discarding it`);
|
|
1826
|
+
return;
|
|
1827
|
+
}
|
|
1828
|
+
let r = vn(t.min) ?? 0, i = vn(t.max), a = i === void 0 ? r + 100 : i, o = (t.clamp ?? "clamp").trim().toLowerCase(), s = !!t.reverse, c = Sn(t.ease), l = Cn(t.map), u = t.targetId?.trim() || void 0;
|
|
1829
|
+
if (Number.isNaN(r) || Number.isNaN(a)) {
|
|
1830
|
+
gn.warn(`Style ${e} has a motion binding on '${n}' with an unreadable range; discarding it`);
|
|
1831
|
+
return;
|
|
1832
|
+
}
|
|
1833
|
+
return {
|
|
1834
|
+
source: n.toLowerCase(),
|
|
1835
|
+
min: r,
|
|
1836
|
+
max: a,
|
|
1837
|
+
clamp: o === "freeze-start" || o === "freeze-end" || o === "unclamped" ? o : "clamp",
|
|
1838
|
+
reverse: s,
|
|
1839
|
+
ease: c,
|
|
1840
|
+
map: l,
|
|
1841
|
+
targetId: u
|
|
1830
1842
|
};
|
|
1831
1843
|
}
|
|
1832
1844
|
ensureObserver() {
|
|
@@ -1863,7 +1875,7 @@ var Cn = new class {
|
|
|
1863
1875
|
scanExistingNodes(e) {
|
|
1864
1876
|
let t = this.bindingsByStyle.get(e);
|
|
1865
1877
|
if (!t || typeof document > "u") return;
|
|
1866
|
-
let n = `.${
|
|
1878
|
+
let n = `.${yn(e)}`;
|
|
1867
1879
|
document.querySelectorAll(n).forEach((n) => this.applyStyleToElement(n, e, t));
|
|
1868
1880
|
}
|
|
1869
1881
|
applyStyleToElement(e, t, n) {
|
|
@@ -1899,7 +1911,7 @@ var Cn = new class {
|
|
|
1899
1911
|
}
|
|
1900
1912
|
resolveScrollContainer(e, t) {
|
|
1901
1913
|
if (t.targetId) {
|
|
1902
|
-
let e = `[data-ikon-motion-source="${
|
|
1914
|
+
let e = `[data-ikon-motion-source="${yn(t.targetId)}"]`, n = typeof document < "u" ? document.querySelector(e) : null;
|
|
1903
1915
|
if (n) return n;
|
|
1904
1916
|
}
|
|
1905
1917
|
return e.closest("[data-ikon-view-type=\"scroll-view\"]");
|
|
@@ -1919,7 +1931,7 @@ var Cn = new class {
|
|
|
1919
1931
|
case "freeze-start": return e < 0 ? 0 : e;
|
|
1920
1932
|
case "freeze-end": return e > 1 ? 1 : e;
|
|
1921
1933
|
case "unclamped": return e;
|
|
1922
|
-
default: return
|
|
1934
|
+
default: return W(e);
|
|
1923
1935
|
}
|
|
1924
1936
|
}
|
|
1925
1937
|
applyMap(e, t) {
|
|
@@ -1954,7 +1966,7 @@ var Cn = new class {
|
|
|
1954
1966
|
try {
|
|
1955
1967
|
e();
|
|
1956
1968
|
} catch (e) {
|
|
1957
|
-
|
|
1969
|
+
gn.warn("Failed to cleanup listener", e);
|
|
1958
1970
|
}
|
|
1959
1971
|
this.globalCleanups.delete(e);
|
|
1960
1972
|
}
|
|
@@ -1994,26 +2006,26 @@ var Cn = new class {
|
|
|
1994
2006
|
}();
|
|
1995
2007
|
//#endregion
|
|
1996
2008
|
//#region src/use-ikon-styles.ts
|
|
1997
|
-
function
|
|
2009
|
+
function Tn(e) {
|
|
1998
2010
|
let t = M(/* @__PURE__ */ new Map()), n = O(({ styleId: e, css: n, common: r }) => {
|
|
1999
2011
|
if (!(!e || typeof document > "u")) {
|
|
2000
2012
|
if (n) {
|
|
2001
2013
|
let r = t.current.get(e);
|
|
2002
2014
|
r || (r = document.createElement("style"), r.setAttribute("data-ikon-style-id", e), document.head.appendChild(r), t.current.set(e, r)), r.textContent = n;
|
|
2003
2015
|
}
|
|
2004
|
-
|
|
2016
|
+
wn.registerStyle(e, r);
|
|
2005
2017
|
}
|
|
2006
2018
|
}, []), r = O((e) => {
|
|
2007
2019
|
if (!(typeof document > "u")) for (let n of e) {
|
|
2008
2020
|
let e = t.current.get(n);
|
|
2009
|
-
e && (e.remove(), t.current.delete(n)),
|
|
2021
|
+
e && (e.remove(), t.current.delete(n)), wn.unregisterStyle(n);
|
|
2010
2022
|
}
|
|
2011
2023
|
}, []), i = O(() => {
|
|
2012
2024
|
if (typeof document < "u") {
|
|
2013
2025
|
for (let e of t.current.values()) e.remove();
|
|
2014
2026
|
t.current.clear();
|
|
2015
2027
|
}
|
|
2016
|
-
|
|
2028
|
+
wn.reset();
|
|
2017
2029
|
}, []);
|
|
2018
2030
|
return k(() => {
|
|
2019
2031
|
if (!e) return;
|
|
@@ -2035,7 +2047,7 @@ function wn(e) {
|
|
|
2035
2047
|
}
|
|
2036
2048
|
//#endregion
|
|
2037
2049
|
//#region src/use-ikon-ui-stores.ts
|
|
2038
|
-
function
|
|
2050
|
+
function En(e) {
|
|
2039
2051
|
let t = [];
|
|
2040
2052
|
for (let [n, r] of e) {
|
|
2041
2053
|
let e = r.store.getSnapshot(), i = e.rootViewId && e.views.has(e.rootViewId);
|
|
@@ -2043,7 +2055,7 @@ function Tn(e) {
|
|
|
2043
2055
|
}
|
|
2044
2056
|
return t.sort(), t.join(",");
|
|
2045
2057
|
}
|
|
2046
|
-
function
|
|
2058
|
+
function Dn(e) {
|
|
2047
2059
|
let [t, n] = N(), r = M("");
|
|
2048
2060
|
return k(() => {
|
|
2049
2061
|
if (!e) {
|
|
@@ -2051,7 +2063,7 @@ function En(e) {
|
|
|
2051
2063
|
return;
|
|
2052
2064
|
}
|
|
2053
2065
|
let t = () => {
|
|
2054
|
-
let t = e.getStores(), i =
|
|
2066
|
+
let t = e.getStores(), i = En(t);
|
|
2055
2067
|
i !== r.current && (r.current = i, n(t));
|
|
2056
2068
|
};
|
|
2057
2069
|
return t(), e.subscribe(t);
|
|
@@ -2059,7 +2071,7 @@ function En(e) {
|
|
|
2059
2071
|
}
|
|
2060
2072
|
//#endregion
|
|
2061
2073
|
//#region src/media/use-sibling-client.ts
|
|
2062
|
-
function
|
|
2074
|
+
function On(e, t, n) {
|
|
2063
2075
|
let [r, i] = N(null), [a, o] = N(null), s = M(n);
|
|
2064
2076
|
s.current = n;
|
|
2065
2077
|
let c = t ? JSON.stringify(Object.entries(t).sort(([e], [t]) => e < t ? -1 : +(e > t))) : null;
|
|
@@ -2080,8 +2092,8 @@ function Dn(e, t, n) {
|
|
|
2080
2092
|
}
|
|
2081
2093
|
//#endregion
|
|
2082
2094
|
//#region src/media/use-media-capture.ts
|
|
2083
|
-
var
|
|
2084
|
-
function
|
|
2095
|
+
var kn = S("IkonMediaCaptureHooks");
|
|
2096
|
+
function An(e, t, n, r) {
|
|
2085
2097
|
let [i, a] = N(null), o = M(r);
|
|
2086
2098
|
return o.current = r, k(() => {
|
|
2087
2099
|
if (!e || !t) return;
|
|
@@ -2096,7 +2108,7 @@ function kn(e, t, n, r) {
|
|
|
2096
2108
|
try {
|
|
2097
2109
|
i = await o.current(t);
|
|
2098
2110
|
} catch (e) {
|
|
2099
|
-
r || (
|
|
2111
|
+
r || (kn.error(`${n} capture start failed: ${String(e)}`), a(e instanceof Error ? e : Error(String(e))));
|
|
2100
2112
|
return;
|
|
2101
2113
|
}
|
|
2102
2114
|
r && i.stop();
|
|
@@ -2110,30 +2122,30 @@ function kn(e, t, n, r) {
|
|
|
2110
2122
|
n
|
|
2111
2123
|
]), { error: i };
|
|
2112
2124
|
}
|
|
2113
|
-
function An(e, t, n) {
|
|
2114
|
-
let r = M(n);
|
|
2115
|
-
return r.current = n, kn(e, t, "microphone", O((e) => e.audio.startMic(r.current ?? {}), []));
|
|
2116
|
-
}
|
|
2117
2125
|
function jn(e, t, n) {
|
|
2118
2126
|
let r = M(n);
|
|
2119
|
-
return r.current = n,
|
|
2127
|
+
return r.current = n, An(e, t, "microphone", O((e) => e.audio.startMic(r.current ?? {}), []));
|
|
2120
2128
|
}
|
|
2121
2129
|
function Mn(e, t, n) {
|
|
2122
2130
|
let r = M(n);
|
|
2123
|
-
return r.current = n,
|
|
2131
|
+
return r.current = n, An(e, t, "camera", O((e) => e.video.startCamera(r.current), []));
|
|
2132
|
+
}
|
|
2133
|
+
function Nn(e, t, n) {
|
|
2134
|
+
let r = M(n);
|
|
2135
|
+
return r.current = n, An(e, t, "screen", O((e) => e.video.startScreen(r.current), []));
|
|
2124
2136
|
}
|
|
2125
2137
|
//#endregion
|
|
2126
2138
|
//#region src/shared/render-motion-letters.tsx
|
|
2127
|
-
var
|
|
2139
|
+
var G = {
|
|
2128
2140
|
None: 0,
|
|
2129
2141
|
Letter: 1,
|
|
2130
2142
|
Word: 2,
|
|
2131
2143
|
Line: 4,
|
|
2132
2144
|
Paragraph: 8,
|
|
2133
2145
|
Emoji: 16
|
|
2134
|
-
},
|
|
2146
|
+
}, Pn = [
|
|
2135
2147
|
{
|
|
2136
|
-
flag:
|
|
2148
|
+
flag: G.Letter,
|
|
2137
2149
|
hints: [
|
|
2138
2150
|
"[data-motion-letter]",
|
|
2139
2151
|
"[data-letter]",
|
|
@@ -2142,7 +2154,7 @@ var K = {
|
|
|
2142
2154
|
]
|
|
2143
2155
|
},
|
|
2144
2156
|
{
|
|
2145
|
-
flag:
|
|
2157
|
+
flag: G.Word,
|
|
2146
2158
|
hints: [
|
|
2147
2159
|
"[data-motion-word]",
|
|
2148
2160
|
"[data-word]",
|
|
@@ -2151,7 +2163,7 @@ var K = {
|
|
|
2151
2163
|
]
|
|
2152
2164
|
},
|
|
2153
2165
|
{
|
|
2154
|
-
flag:
|
|
2166
|
+
flag: G.Line,
|
|
2155
2167
|
hints: [
|
|
2156
2168
|
"[data-motion-line]",
|
|
2157
2169
|
"[data-line]",
|
|
@@ -2160,7 +2172,7 @@ var K = {
|
|
|
2160
2172
|
]
|
|
2161
2173
|
},
|
|
2162
2174
|
{
|
|
2163
|
-
flag:
|
|
2175
|
+
flag: G.Paragraph,
|
|
2164
2176
|
hints: [
|
|
2165
2177
|
"[data-motion-paragraph]",
|
|
2166
2178
|
"[data-paragraph]",
|
|
@@ -2171,7 +2183,7 @@ var K = {
|
|
|
2171
2183
|
]
|
|
2172
2184
|
},
|
|
2173
2185
|
{
|
|
2174
|
-
flag:
|
|
2186
|
+
flag: G.Emoji,
|
|
2175
2187
|
hints: [
|
|
2176
2188
|
":is([data-motion-emoji],[data-emoji],.tw-motion-emoji,.tw-emoji)",
|
|
2177
2189
|
"[data-motion-emoji]",
|
|
@@ -2180,16 +2192,16 @@ var K = {
|
|
|
2180
2192
|
"[data-emoji]"
|
|
2181
2193
|
]
|
|
2182
2194
|
}
|
|
2183
|
-
],
|
|
2184
|
-
function
|
|
2185
|
-
if (!e || e.length >
|
|
2186
|
-
let n =
|
|
2187
|
-
if (i ===
|
|
2195
|
+
], Fn = G.Letter | G.Word | G.Line | G.Paragraph | G.Emoji, In = G.Letter | G.Word | G.Line | G.Paragraph, Ln = /* @__PURE__ */ new Map(), Rn = 16384;
|
|
2196
|
+
function zn(e, t) {
|
|
2197
|
+
if (!e || e.length > Rn) return e;
|
|
2198
|
+
let n = mr(t), r = ur(n, G.Emoji), i = n & In;
|
|
2199
|
+
if (i === G.None && !r) return e;
|
|
2188
2200
|
let a = e.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
2189
|
-
if (i ===
|
|
2190
|
-
let o =
|
|
2191
|
-
if (o.length === 0) return r ?
|
|
2192
|
-
let s =
|
|
2201
|
+
if (i === G.None) return fr(a);
|
|
2202
|
+
let o = cr(a);
|
|
2203
|
+
if (o.length === 0) return r ? fr(a) : e;
|
|
2204
|
+
let s = lr(o), c = {
|
|
2193
2205
|
letter: 0,
|
|
2194
2206
|
word: 0,
|
|
2195
2207
|
line: 0,
|
|
@@ -2198,58 +2210,58 @@ function Rn(e, t) {
|
|
|
2198
2210
|
emoji: 0
|
|
2199
2211
|
}, l = [];
|
|
2200
2212
|
for (let e of s) {
|
|
2201
|
-
let t =
|
|
2213
|
+
let t = Bn(e, n, c);
|
|
2202
2214
|
l.push(...t);
|
|
2203
2215
|
}
|
|
2204
2216
|
return l;
|
|
2205
2217
|
}
|
|
2206
|
-
function
|
|
2218
|
+
function Bn(e, t, n) {
|
|
2207
2219
|
let r = [];
|
|
2208
2220
|
for (let i of e) {
|
|
2209
|
-
let e =
|
|
2221
|
+
let e = Vn(i, t, n);
|
|
2210
2222
|
r.push(...e);
|
|
2211
2223
|
}
|
|
2212
|
-
if (
|
|
2224
|
+
if (ur(t, G.Paragraph)) {
|
|
2213
2225
|
let e = n.paragraph++;
|
|
2214
2226
|
return [/* @__PURE__ */ P("span", {
|
|
2215
2227
|
"data-motion-paragraph": !0,
|
|
2216
|
-
style:
|
|
2228
|
+
style: dr(e),
|
|
2217
2229
|
children: r
|
|
2218
2230
|
}, `motion-paragraph-${e}`)];
|
|
2219
2231
|
}
|
|
2220
2232
|
return r;
|
|
2221
2233
|
}
|
|
2222
|
-
function
|
|
2223
|
-
let r =
|
|
2224
|
-
if (
|
|
2234
|
+
function Vn(e, t, n) {
|
|
2235
|
+
let r = Hn(e.text, t, n), i = [];
|
|
2236
|
+
if (ur(t, G.Line)) {
|
|
2225
2237
|
let e = n.line++;
|
|
2226
2238
|
i.push(/* @__PURE__ */ P("span", {
|
|
2227
2239
|
"data-motion-line": !0,
|
|
2228
|
-
style:
|
|
2240
|
+
style: dr(e),
|
|
2229
2241
|
children: r
|
|
2230
2242
|
}, `motion-line-${e}`));
|
|
2231
2243
|
} else i.push(...r);
|
|
2232
2244
|
for (let t = 0; t < e.breaks; t++) i.push(/* @__PURE__ */ P("br", {}, `motion-break-${n.br++}`));
|
|
2233
2245
|
return i;
|
|
2234
2246
|
}
|
|
2235
|
-
function
|
|
2247
|
+
function Hn(e, t, n) {
|
|
2236
2248
|
if (!e) return [];
|
|
2237
|
-
let r =
|
|
2249
|
+
let r = ur(t, G.Word), i = [], a = /(\s+)/g, o = 0, s;
|
|
2238
2250
|
for (; (s = a.exec(e)) !== null;) {
|
|
2239
2251
|
if (s.index > o) {
|
|
2240
2252
|
let a = e.slice(o, s.index);
|
|
2241
|
-
i.push(
|
|
2253
|
+
i.push(Un(a, n, t, r));
|
|
2242
2254
|
}
|
|
2243
2255
|
i.push(s[0]), o = s.index + s[0].length;
|
|
2244
2256
|
}
|
|
2245
2257
|
if (o < e.length) {
|
|
2246
2258
|
let a = e.slice(o);
|
|
2247
|
-
i.push(
|
|
2259
|
+
i.push(Un(a, n, t, r));
|
|
2248
2260
|
}
|
|
2249
2261
|
return i;
|
|
2250
2262
|
}
|
|
2251
|
-
function
|
|
2252
|
-
let i = t.word++, a =
|
|
2263
|
+
function Un(e, t, n, r) {
|
|
2264
|
+
let i = t.word++, a = Gn(e, n, t), o = `motion-word-${i}`, s = Wn(i, r);
|
|
2253
2265
|
return r ? /* @__PURE__ */ P("span", {
|
|
2254
2266
|
"data-motion-word": !0,
|
|
2255
2267
|
style: s,
|
|
@@ -2259,25 +2271,25 @@ function Hn(e, t, n, r) {
|
|
|
2259
2271
|
children: a
|
|
2260
2272
|
}, o);
|
|
2261
2273
|
}
|
|
2262
|
-
function
|
|
2274
|
+
function Wn(e, t) {
|
|
2263
2275
|
return t ? {
|
|
2264
|
-
...
|
|
2276
|
+
...dr(e),
|
|
2265
2277
|
whiteSpace: "nowrap"
|
|
2266
2278
|
} : { whiteSpace: "nowrap" };
|
|
2267
2279
|
}
|
|
2268
|
-
function
|
|
2280
|
+
function Gn(e, t, n) {
|
|
2269
2281
|
if (!e) return [];
|
|
2270
|
-
let r =
|
|
2282
|
+
let r = ur(t, G.Letter), i = ur(t, G.Emoji);
|
|
2271
2283
|
if (!r) {
|
|
2272
2284
|
if (!i) return [e];
|
|
2273
|
-
let t =
|
|
2285
|
+
let t = Kn(e);
|
|
2274
2286
|
if (t.length === 0) return [e];
|
|
2275
|
-
let { nodes: r } =
|
|
2287
|
+
let { nodes: r } = pr(t, n);
|
|
2276
2288
|
return r;
|
|
2277
2289
|
}
|
|
2278
|
-
let a = [], o =
|
|
2290
|
+
let a = [], o = Kn(e);
|
|
2279
2291
|
for (let e of o) {
|
|
2280
|
-
let t = n.letter++, r = `motion-letter-${t}`, o =
|
|
2292
|
+
let t = n.letter++, r = `motion-letter-${t}`, o = dr(t);
|
|
2281
2293
|
if (e === "\n") {
|
|
2282
2294
|
a.push(/* @__PURE__ */ P("span", {
|
|
2283
2295
|
"data-motion-letter": !0,
|
|
@@ -2286,7 +2298,7 @@ function Wn(e, t, n) {
|
|
|
2286
2298
|
}, r));
|
|
2287
2299
|
continue;
|
|
2288
2300
|
}
|
|
2289
|
-
let s = i &&
|
|
2301
|
+
let s = i && ar(e) ? { "data-motion-emoji": !0 } : void 0, c = e === " " ? "\xA0" : e;
|
|
2290
2302
|
a.push(/* @__PURE__ */ P("span", {
|
|
2291
2303
|
"data-motion-letter": !0,
|
|
2292
2304
|
style: o,
|
|
@@ -2296,46 +2308,46 @@ function Wn(e, t, n) {
|
|
|
2296
2308
|
}
|
|
2297
2309
|
return a;
|
|
2298
2310
|
}
|
|
2299
|
-
function
|
|
2311
|
+
function Kn(e) {
|
|
2300
2312
|
if (!e) return [];
|
|
2301
|
-
let t =
|
|
2302
|
-
return t ? Array.from(t.segment(e), (e) => e.segment) :
|
|
2313
|
+
let t = Jn();
|
|
2314
|
+
return t ? Array.from(t.segment(e), (e) => e.segment) : Yn(e);
|
|
2303
2315
|
}
|
|
2304
|
-
var
|
|
2305
|
-
function
|
|
2306
|
-
return
|
|
2316
|
+
var qn;
|
|
2317
|
+
function Jn() {
|
|
2318
|
+
return qn === void 0 && (qn = typeof Intl < "u" && typeof Intl.Segmenter == "function" ? new Intl.Segmenter(void 0, { granularity: "grapheme" }) : null), qn;
|
|
2307
2319
|
}
|
|
2308
|
-
function
|
|
2320
|
+
function Yn(e) {
|
|
2309
2321
|
let t = [], n = Array.from(e), r = "";
|
|
2310
2322
|
for (let e = 0; e < n.length; e++) {
|
|
2311
2323
|
let i = n[e], a = n[e + 1];
|
|
2312
|
-
r += i, !(a &&
|
|
2324
|
+
r += i, !(a && Xn(i, a)) && (t.push(r), r = "");
|
|
2313
2325
|
}
|
|
2314
2326
|
return r && t.push(r), t;
|
|
2315
2327
|
}
|
|
2316
|
-
function
|
|
2317
|
-
return t ? !!(
|
|
2328
|
+
function Xn(e, t) {
|
|
2329
|
+
return t ? !!(Zn(e) || Zn(t) || nr(t) || Qn(t) || $n(t) || er(e) && er(t)) : !1;
|
|
2318
2330
|
}
|
|
2319
|
-
function
|
|
2331
|
+
function Zn(e) {
|
|
2320
2332
|
return e.codePointAt(0) === 8205;
|
|
2321
2333
|
}
|
|
2322
|
-
function
|
|
2334
|
+
function Qn(e) {
|
|
2323
2335
|
let t = e.codePointAt(0);
|
|
2324
2336
|
return t === void 0 ? !1 : t >= 65024 && t <= 65039 || t >= 917760 && t <= 917999;
|
|
2325
2337
|
}
|
|
2326
|
-
function
|
|
2338
|
+
function $n(e) {
|
|
2327
2339
|
let t = e.codePointAt(0);
|
|
2328
2340
|
return t !== void 0 && t >= 127995 && t <= 127999;
|
|
2329
2341
|
}
|
|
2330
|
-
function
|
|
2342
|
+
function er(e) {
|
|
2331
2343
|
let t = e.codePointAt(0);
|
|
2332
2344
|
return t !== void 0 && t >= 127462 && t <= 127487;
|
|
2333
2345
|
}
|
|
2334
|
-
var
|
|
2335
|
-
function
|
|
2336
|
-
return e ? (
|
|
2346
|
+
var tr;
|
|
2347
|
+
function nr(e) {
|
|
2348
|
+
return e ? (tr ||= rr(), tr(e)) : !1;
|
|
2337
2349
|
}
|
|
2338
|
-
function
|
|
2350
|
+
function rr() {
|
|
2339
2351
|
try {
|
|
2340
2352
|
let e = /\p{Mark}/u;
|
|
2341
2353
|
return (t) => e.test(t);
|
|
@@ -2346,19 +2358,19 @@ function nr() {
|
|
|
2346
2358
|
};
|
|
2347
2359
|
}
|
|
2348
2360
|
}
|
|
2349
|
-
var
|
|
2350
|
-
function
|
|
2351
|
-
return e ? (
|
|
2361
|
+
var ir;
|
|
2362
|
+
function ar(e) {
|
|
2363
|
+
return e ? (ir ||= or(), ir(e)) : !1;
|
|
2352
2364
|
}
|
|
2353
|
-
function
|
|
2365
|
+
function or() {
|
|
2354
2366
|
try {
|
|
2355
2367
|
let e = /\p{Extended_Pictographic}/u;
|
|
2356
2368
|
return (t) => e.test(t);
|
|
2357
2369
|
} catch {
|
|
2358
|
-
return
|
|
2370
|
+
return sr;
|
|
2359
2371
|
}
|
|
2360
2372
|
}
|
|
2361
|
-
function
|
|
2373
|
+
function sr(e) {
|
|
2362
2374
|
if (!e) return !1;
|
|
2363
2375
|
for (let t of Array.from(e)) {
|
|
2364
2376
|
let e = t.codePointAt(0);
|
|
@@ -2366,7 +2378,7 @@ function or(e) {
|
|
|
2366
2378
|
}
|
|
2367
2379
|
return !1;
|
|
2368
2380
|
}
|
|
2369
|
-
function
|
|
2381
|
+
function cr(e) {
|
|
2370
2382
|
let t = [], n = "", r = 0;
|
|
2371
2383
|
for (let i = 0; i < e.length; i++) {
|
|
2372
2384
|
let a = e[i];
|
|
@@ -2384,16 +2396,16 @@ function sr(e) {
|
|
|
2384
2396
|
breaks: r
|
|
2385
2397
|
}), t;
|
|
2386
2398
|
}
|
|
2387
|
-
function
|
|
2399
|
+
function lr(e) {
|
|
2388
2400
|
if (e.length === 0) return [];
|
|
2389
2401
|
let t = [], n = [];
|
|
2390
2402
|
for (let r of e) n.push(r), r.breaks >= 2 && (t.push(n), n = []);
|
|
2391
2403
|
return n.length > 0 && t.push(n), t;
|
|
2392
2404
|
}
|
|
2393
|
-
function
|
|
2405
|
+
function ur(e, t) {
|
|
2394
2406
|
return (e & t) === t;
|
|
2395
2407
|
}
|
|
2396
|
-
function
|
|
2408
|
+
function dr(e) {
|
|
2397
2409
|
return {
|
|
2398
2410
|
"--tw-motion-seq-index": e.toString(),
|
|
2399
2411
|
backgroundColor: "inherit",
|
|
@@ -2410,19 +2422,19 @@ function ur(e) {
|
|
|
2410
2422
|
WebkitTextFillColor: "inherit"
|
|
2411
2423
|
};
|
|
2412
2424
|
}
|
|
2413
|
-
function
|
|
2425
|
+
function fr(e) {
|
|
2414
2426
|
if (!e) return e;
|
|
2415
|
-
let t =
|
|
2427
|
+
let t = Kn(e);
|
|
2416
2428
|
if (t.length === 0) return e;
|
|
2417
|
-
let { nodes: n, sawEmoji: r } =
|
|
2429
|
+
let { nodes: n, sawEmoji: r } = pr(t);
|
|
2418
2430
|
return r ? n.length === 1 ? n[0] ?? e : n : e;
|
|
2419
2431
|
}
|
|
2420
|
-
function
|
|
2432
|
+
function pr(e, t) {
|
|
2421
2433
|
let n = [], r = "", i = !1, a = t?.emoji ?? 0, o = () => {
|
|
2422
2434
|
r &&= (n.push(r), "");
|
|
2423
2435
|
};
|
|
2424
2436
|
for (let s of e) {
|
|
2425
|
-
if (
|
|
2437
|
+
if (ar(s)) {
|
|
2426
2438
|
i = !0, o();
|
|
2427
2439
|
let e = `motion-emoji-${t ? t.emoji++ : a++}`;
|
|
2428
2440
|
n.push(/* @__PURE__ */ P("span", {
|
|
@@ -2441,16 +2453,16 @@ function fr(e, t) {
|
|
|
2441
2453
|
sawEmoji: !1
|
|
2442
2454
|
};
|
|
2443
2455
|
}
|
|
2444
|
-
function
|
|
2445
|
-
if (!e) return
|
|
2456
|
+
function mr(e) {
|
|
2457
|
+
if (!e) return G.None;
|
|
2446
2458
|
let t = e.trim();
|
|
2447
|
-
if (!t) return
|
|
2448
|
-
let n =
|
|
2459
|
+
if (!t) return G.None;
|
|
2460
|
+
let n = Ln.get(t);
|
|
2449
2461
|
if (typeof n == "number") return n;
|
|
2450
|
-
if (typeof document > "u") return
|
|
2462
|
+
if (typeof document > "u") return G.None;
|
|
2451
2463
|
let r = t.split(/\s+/).filter(Boolean);
|
|
2452
|
-
if (r.length === 0) return
|
|
2453
|
-
let i = r.map((e) => `.${
|
|
2464
|
+
if (r.length === 0) return G.None;
|
|
2465
|
+
let i = r.map((e) => `.${gr(e)}`).map((e) => RegExp(`(^|[^a-zA-Z0-9_-])${_r(e)}(?![a-zA-Z0-9_-])`)), a = G.None, o = !1;
|
|
2454
2466
|
for (let e of Array.from(document.styleSheets)) {
|
|
2455
2467
|
let t;
|
|
2456
2468
|
try {
|
|
@@ -2458,18 +2470,18 @@ function pr(e) {
|
|
|
2458
2470
|
} catch {
|
|
2459
2471
|
continue;
|
|
2460
2472
|
}
|
|
2461
|
-
let n =
|
|
2462
|
-
if (n.mask && (a |= n.mask, a ===
|
|
2473
|
+
let n = hr(t, i);
|
|
2474
|
+
if (n.mask && (a |= n.mask, a === Fn)) break;
|
|
2463
2475
|
o ||= n.sawStyleRule;
|
|
2464
2476
|
}
|
|
2465
|
-
return (a !==
|
|
2477
|
+
return (a !== G.None || o) && Ln.set(t, a), a;
|
|
2466
2478
|
}
|
|
2467
|
-
function
|
|
2479
|
+
function hr(e, t) {
|
|
2468
2480
|
if (!e) return {
|
|
2469
|
-
mask:
|
|
2481
|
+
mask: G.None,
|
|
2470
2482
|
sawStyleRule: !1
|
|
2471
2483
|
};
|
|
2472
|
-
let n =
|
|
2484
|
+
let n = G.None, r = !1;
|
|
2473
2485
|
for (let i = 0; i < e.length; i++) {
|
|
2474
2486
|
let a = e[i];
|
|
2475
2487
|
if (a) {
|
|
@@ -2477,14 +2489,14 @@ function mr(e, t) {
|
|
|
2477
2489
|
let e = a.selectorText ?? "";
|
|
2478
2490
|
if (!e || !t.some((t) => t.test(e))) continue;
|
|
2479
2491
|
r = !0;
|
|
2480
|
-
for (let t of
|
|
2481
|
-
if (n ===
|
|
2492
|
+
for (let t of Pn) t.hints.some((t) => e.includes(t)) && (n |= t.flag);
|
|
2493
|
+
if (n === Fn) return {
|
|
2482
2494
|
mask: n,
|
|
2483
2495
|
sawStyleRule: !0
|
|
2484
2496
|
};
|
|
2485
2497
|
} else if ("cssRules" in a) {
|
|
2486
|
-
let e =
|
|
2487
|
-
if (e.mask && (n |= e.mask, n ===
|
|
2498
|
+
let e = hr(a.cssRules, t);
|
|
2499
|
+
if (e.mask && (n |= e.mask, n === Fn)) return {
|
|
2488
2500
|
mask: n,
|
|
2489
2501
|
sawStyleRule: !0
|
|
2490
2502
|
};
|
|
@@ -2497,16 +2509,16 @@ function mr(e, t) {
|
|
|
2497
2509
|
sawStyleRule: r
|
|
2498
2510
|
};
|
|
2499
2511
|
}
|
|
2500
|
-
function
|
|
2512
|
+
function gr(e) {
|
|
2501
2513
|
return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/[^a-zA-Z0-9_-]/g, (e) => `\\${e}`);
|
|
2502
2514
|
}
|
|
2503
|
-
function
|
|
2515
|
+
function _r(e) {
|
|
2504
2516
|
return e.replace(/[.*+?^${}()|[\]\\]/g, (e) => `\\${e}`);
|
|
2505
2517
|
}
|
|
2506
2518
|
//#endregion
|
|
2507
2519
|
//#region src/auth/storage.ts
|
|
2508
|
-
var
|
|
2509
|
-
function
|
|
2520
|
+
var vr = "ikon-auth-session", yr = "ikon-auth-refreshable", br = "ikon-auth-auto-login-attempted-run", xr = 6048e5, Sr = 6e4;
|
|
2521
|
+
function Cr(e) {
|
|
2510
2522
|
try {
|
|
2511
2523
|
let t = e.split(".");
|
|
2512
2524
|
if (t.length !== 3) return;
|
|
@@ -2516,105 +2528,105 @@ function Sr(e) {
|
|
|
2516
2528
|
return;
|
|
2517
2529
|
}
|
|
2518
2530
|
}
|
|
2519
|
-
function Cr(e) {
|
|
2520
|
-
let t = Sr(e);
|
|
2521
|
-
return !t || typeof t.exp == "number" && Date.now() >= t.exp * 1e3 - xr;
|
|
2522
|
-
}
|
|
2523
2531
|
function wr(e) {
|
|
2524
|
-
let t =
|
|
2532
|
+
let t = Cr(e);
|
|
2533
|
+
return !t || typeof t.exp == "number" && Date.now() >= t.exp * 1e3 - Sr;
|
|
2534
|
+
}
|
|
2535
|
+
function Tr(e) {
|
|
2536
|
+
let t = Cr(e)?.exp;
|
|
2525
2537
|
return typeof t == "number" ? (/* @__PURE__ */ new Date(t * 1e3)).toISOString() : void 0;
|
|
2526
2538
|
}
|
|
2527
|
-
function
|
|
2539
|
+
function K(e) {
|
|
2528
2540
|
try {
|
|
2529
|
-
localStorage.setItem(
|
|
2541
|
+
localStorage.setItem(vr, JSON.stringify(e));
|
|
2530
2542
|
} catch {
|
|
2531
2543
|
console.warn("Failed to save auth session to localStorage");
|
|
2532
2544
|
}
|
|
2533
2545
|
}
|
|
2534
|
-
function
|
|
2546
|
+
function Er() {
|
|
2535
2547
|
try {
|
|
2536
|
-
let e = localStorage.getItem(
|
|
2548
|
+
let e = localStorage.getItem(vr);
|
|
2537
2549
|
if (!e) return null;
|
|
2538
2550
|
let t = JSON.parse(e);
|
|
2539
|
-
return Date.now() - t.authenticatedAt >
|
|
2551
|
+
return Date.now() - t.authenticatedAt > xr || wr(t.token) ? (Pr(), null) : t;
|
|
2540
2552
|
} catch {
|
|
2541
2553
|
return console.warn("Failed to load auth session from localStorage"), null;
|
|
2542
2554
|
}
|
|
2543
2555
|
}
|
|
2544
|
-
function
|
|
2556
|
+
function Dr() {
|
|
2545
2557
|
try {
|
|
2546
|
-
let e = localStorage.getItem(
|
|
2558
|
+
let e = localStorage.getItem(vr);
|
|
2547
2559
|
if (!e) return !1;
|
|
2548
2560
|
let t = JSON.parse(e);
|
|
2549
|
-
return t.provider === "dev" &&
|
|
2561
|
+
return t.provider === "dev" && wr(t.token);
|
|
2550
2562
|
} catch {
|
|
2551
2563
|
return !1;
|
|
2552
2564
|
}
|
|
2553
2565
|
}
|
|
2554
|
-
function
|
|
2566
|
+
function Or(e) {
|
|
2555
2567
|
try {
|
|
2556
|
-
localStorage.removeItem(
|
|
2568
|
+
localStorage.removeItem(vr), localStorage.setItem(yr, JSON.stringify(e));
|
|
2557
2569
|
} catch {
|
|
2558
2570
|
console.warn("Failed to save the auth session marker to localStorage");
|
|
2559
2571
|
}
|
|
2560
2572
|
}
|
|
2561
|
-
function
|
|
2573
|
+
function kr() {
|
|
2562
2574
|
try {
|
|
2563
|
-
let e = localStorage.getItem(
|
|
2575
|
+
let e = localStorage.getItem(yr);
|
|
2564
2576
|
if (!e) return null;
|
|
2565
2577
|
let t = JSON.parse(e);
|
|
2566
|
-
return Date.now() - t.renewedAt >
|
|
2578
|
+
return Date.now() - t.renewedAt > xr ? (jr(), null) : t;
|
|
2567
2579
|
} catch {
|
|
2568
2580
|
return console.warn("Failed to load the auth session marker from localStorage"), null;
|
|
2569
2581
|
}
|
|
2570
2582
|
}
|
|
2571
|
-
function
|
|
2572
|
-
let e =
|
|
2573
|
-
e &&
|
|
2583
|
+
function Ar() {
|
|
2584
|
+
let e = kr();
|
|
2585
|
+
e && Or({
|
|
2574
2586
|
...e,
|
|
2575
2587
|
renewedAt: Date.now()
|
|
2576
2588
|
});
|
|
2577
2589
|
}
|
|
2578
|
-
function
|
|
2590
|
+
function jr() {
|
|
2579
2591
|
try {
|
|
2580
|
-
localStorage.removeItem(
|
|
2592
|
+
localStorage.removeItem(yr);
|
|
2581
2593
|
} catch {
|
|
2582
2594
|
console.warn("Failed to clear the auth session marker from localStorage");
|
|
2583
2595
|
}
|
|
2584
2596
|
}
|
|
2585
|
-
function jr() {
|
|
2586
|
-
Tr()?.provider === "anonymous" && Nr(), Or()?.provider === "anonymous" && Ar();
|
|
2587
|
-
}
|
|
2588
2597
|
function Mr() {
|
|
2598
|
+
Er()?.provider === "anonymous" && Pr(), kr()?.provider === "anonymous" && jr();
|
|
2599
|
+
}
|
|
2600
|
+
function Nr() {
|
|
2589
2601
|
try {
|
|
2590
2602
|
let e = typeof window < "u" ? new URLSearchParams(window.location.search) : void 0;
|
|
2591
2603
|
if (e?.get("ikon_token") || e?.get("ikon_code")) return !0;
|
|
2592
2604
|
} catch {}
|
|
2593
|
-
let e =
|
|
2605
|
+
let e = Er()?.provider ?? kr()?.provider;
|
|
2594
2606
|
return e !== void 0 && e !== "anonymous";
|
|
2595
2607
|
}
|
|
2596
|
-
function
|
|
2608
|
+
function Pr() {
|
|
2597
2609
|
try {
|
|
2598
|
-
localStorage.removeItem(
|
|
2610
|
+
localStorage.removeItem(vr);
|
|
2599
2611
|
} catch {
|
|
2600
2612
|
console.warn("Failed to clear auth session from localStorage");
|
|
2601
2613
|
}
|
|
2602
2614
|
}
|
|
2603
|
-
function
|
|
2615
|
+
function Fr(e) {
|
|
2604
2616
|
if (e) try {
|
|
2605
|
-
sessionStorage.setItem(
|
|
2617
|
+
sessionStorage.setItem(br, e);
|
|
2606
2618
|
} catch {
|
|
2607
2619
|
console.warn("Failed to record auto-login attempt in sessionStorage");
|
|
2608
2620
|
}
|
|
2609
2621
|
}
|
|
2610
|
-
function
|
|
2622
|
+
function Ir() {
|
|
2611
2623
|
try {
|
|
2612
|
-
return sessionStorage.getItem(
|
|
2624
|
+
return sessionStorage.getItem(br);
|
|
2613
2625
|
} catch {
|
|
2614
2626
|
return null;
|
|
2615
2627
|
}
|
|
2616
2628
|
}
|
|
2617
|
-
function
|
|
2629
|
+
function q(e) {
|
|
2618
2630
|
return {
|
|
2619
2631
|
id: "",
|
|
2620
2632
|
provider: e.provider,
|
|
@@ -2625,8 +2637,8 @@ function J(e) {
|
|
|
2625
2637
|
}
|
|
2626
2638
|
//#endregion
|
|
2627
2639
|
//#region src/auth/auth-service.ts
|
|
2628
|
-
var
|
|
2629
|
-
async function
|
|
2640
|
+
var Lr = 15e3, Rr = 15e3, J = S("AuthService");
|
|
2641
|
+
async function zr(e) {
|
|
2630
2642
|
try {
|
|
2631
2643
|
return await fetch(e, {
|
|
2632
2644
|
method: "GET",
|
|
@@ -2636,34 +2648,47 @@ async function Rr(e) {
|
|
|
2636
2648
|
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)`;
|
|
2637
2649
|
}
|
|
2638
2650
|
}
|
|
2639
|
-
var
|
|
2640
|
-
function
|
|
2641
|
-
if (e.headers.get(
|
|
2651
|
+
var Br = "x-ikon-auth-service";
|
|
2652
|
+
function Vr(e) {
|
|
2653
|
+
if (e.headers.get(Br) !== null) return !1;
|
|
2642
2654
|
if (e.status === 404 || e.status === 405) return !0;
|
|
2643
2655
|
let t = e.headers.get("content-type") ?? "";
|
|
2644
2656
|
return e.status === 200 && t.includes("text/html");
|
|
2645
2657
|
}
|
|
2646
|
-
async function
|
|
2658
|
+
async function Y(e, t, n) {
|
|
2647
2659
|
let r = `${e}${t}`, i = E(), a = i !== null && e === i, o = a ? await oe() : i, s = o !== null && o !== e ? `${o}${t}` : null, c;
|
|
2648
2660
|
try {
|
|
2649
2661
|
c = await fetch(r, n);
|
|
2650
2662
|
} catch (i) {
|
|
2651
2663
|
let a = i instanceof Error ? `${i.name}: ${i.message}` : String(i);
|
|
2652
2664
|
if (!s) {
|
|
2653
|
-
let n = await
|
|
2654
|
-
throw
|
|
2665
|
+
let n = await zr(e);
|
|
2666
|
+
throw J.error(`Auth request ${t} could not reach ${r} — ${a}. ${n}`), Error(`Auth request could not reach ${r} (${a}). ${n}`, { cause: i });
|
|
2655
2667
|
}
|
|
2656
|
-
|
|
2668
|
+
J.warn(`Auth request ${t} could not reach ${r} (${a}); falling back to ${s}`);
|
|
2657
2669
|
try {
|
|
2658
2670
|
return await fetch(s, n);
|
|
2659
2671
|
} catch (n) {
|
|
2660
|
-
let i = n instanceof Error ? `${n.name}: ${n.message}` : String(n), o = await
|
|
2661
|
-
throw
|
|
2672
|
+
let i = n instanceof Error ? `${n.name}: ${n.message}` : String(n), o = await zr(e);
|
|
2673
|
+
throw J.error(`Auth request ${t} failed on both ${r} (${a}) and ${s} (${i}). ${o}`), Error(`Auth request unreachable: ${r} (${a}) and ${s} (${i})`, { cause: n });
|
|
2662
2674
|
}
|
|
2663
2675
|
}
|
|
2664
|
-
return a && s !== null &&
|
|
2676
|
+
return a && s !== null && Vr(c) ? (J.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;
|
|
2677
|
+
}
|
|
2678
|
+
async function Hr(e, t) {
|
|
2679
|
+
let n;
|
|
2680
|
+
try {
|
|
2681
|
+
n = await e.json();
|
|
2682
|
+
} catch (e) {
|
|
2683
|
+
throw Error(`${t} returned a body that is not JSON`, { cause: e });
|
|
2684
|
+
}
|
|
2685
|
+
if (typeof n.token != "string" || n.token.length === 0) throw Error(`${t} returned no token`);
|
|
2686
|
+
return {
|
|
2687
|
+
token: n.token,
|
|
2688
|
+
...typeof n.expiresAt == "string" && n.expiresAt.length > 0 ? { expiresAt: n.expiresAt } : {}
|
|
2689
|
+
};
|
|
2665
2690
|
}
|
|
2666
|
-
async function
|
|
2691
|
+
async function Ur(e, t, n) {
|
|
2667
2692
|
let r = le(), i = n === "guest" ? "anonymous" : n, a = {
|
|
2668
2693
|
method: "POST",
|
|
2669
2694
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2673,73 +2698,73 @@ async function Vr(e, t, n) {
|
|
|
2673
2698
|
...i ? { method: i } : {}
|
|
2674
2699
|
})
|
|
2675
2700
|
}, o = typeof window < "u" ? window.location.origin : "?";
|
|
2676
|
-
|
|
2677
|
-
let s = await
|
|
2701
|
+
J.debug(`Anonymous auth: POST ${t}/anonymous (space=${e}, origin=${o})`);
|
|
2702
|
+
let s = await Y(t, "/anonymous", a);
|
|
2678
2703
|
if (!s.ok) {
|
|
2679
2704
|
let e = await s.text().catch(() => "Unknown error");
|
|
2680
|
-
throw
|
|
2705
|
+
throw J.error(`Anonymous auth HTTP ${s.status} from ${s.url}: ${e}`), Error(`Anonymous auth failed: ${s.status} ${e}`);
|
|
2681
2706
|
}
|
|
2682
|
-
let { token: c } = await s
|
|
2707
|
+
let { token: c } = await Hr(s, `Anonymous auth for space ${e}`), l = {
|
|
2683
2708
|
token: c,
|
|
2684
2709
|
provider: "anonymous",
|
|
2685
2710
|
authenticatedAt: Date.now()
|
|
2686
2711
|
};
|
|
2687
|
-
return
|
|
2712
|
+
return K(l), l;
|
|
2688
2713
|
}
|
|
2689
|
-
async function
|
|
2690
|
-
let r = await
|
|
2714
|
+
async function Wr({ email: e, spaceId: t, authUrl: n }) {
|
|
2715
|
+
let r = await Y(n, "/email/send", {
|
|
2691
2716
|
method: "POST",
|
|
2692
2717
|
headers: { "Content-Type": "application/json" },
|
|
2693
2718
|
body: JSON.stringify({
|
|
2694
2719
|
email: e.trim(),
|
|
2695
2720
|
space: t
|
|
2696
2721
|
}),
|
|
2697
|
-
signal: x(
|
|
2722
|
+
signal: x(Lr)
|
|
2698
2723
|
});
|
|
2699
2724
|
if (!r.ok) {
|
|
2700
2725
|
let e = await r.text().catch(() => "Failed to send login code");
|
|
2701
2726
|
throw Error(e);
|
|
2702
2727
|
}
|
|
2703
2728
|
}
|
|
2704
|
-
async function
|
|
2705
|
-
let r = await
|
|
2729
|
+
async function Gr({ email: e, code: t, authUrl: n }) {
|
|
2730
|
+
let r = await Y(n, "/email/code", {
|
|
2706
2731
|
method: "POST",
|
|
2707
2732
|
headers: { "Content-Type": "application/json" },
|
|
2708
2733
|
body: JSON.stringify({
|
|
2709
2734
|
email: e.trim(),
|
|
2710
2735
|
code: t.trim()
|
|
2711
2736
|
}),
|
|
2712
|
-
signal: x(
|
|
2737
|
+
signal: x(Lr)
|
|
2713
2738
|
});
|
|
2714
2739
|
if (!r.ok) {
|
|
2715
2740
|
let e = await r.text().catch(() => "Invalid code");
|
|
2716
2741
|
throw Error(e);
|
|
2717
2742
|
}
|
|
2718
|
-
let { token: i } = await r
|
|
2743
|
+
let { token: i } = await Hr(r, "Login-code verification"), a = {
|
|
2719
2744
|
token: i,
|
|
2720
2745
|
provider: "email",
|
|
2721
2746
|
authenticatedAt: Date.now()
|
|
2722
2747
|
};
|
|
2723
|
-
return
|
|
2748
|
+
return K(a), a;
|
|
2724
2749
|
}
|
|
2725
|
-
function
|
|
2750
|
+
function Kr() {
|
|
2726
2751
|
let e = new URLSearchParams(window.location.search), t = e.get(g), n = e.get(h);
|
|
2727
2752
|
return t && n ? {
|
|
2728
2753
|
token: t,
|
|
2729
2754
|
provider: n
|
|
2730
2755
|
} : null;
|
|
2731
2756
|
}
|
|
2732
|
-
function
|
|
2757
|
+
function qr() {
|
|
2733
2758
|
let e = new URLSearchParams(window.location.search), t = e.get(p), n = e.get(h);
|
|
2734
2759
|
return t && n ? {
|
|
2735
2760
|
code: t,
|
|
2736
2761
|
provider: n
|
|
2737
2762
|
} : null;
|
|
2738
2763
|
}
|
|
2739
|
-
async function
|
|
2764
|
+
async function Jr(e, t, n) {
|
|
2740
2765
|
let r = Te();
|
|
2741
2766
|
if (!r) throw Error("This sign-in was started in a different browser or tab");
|
|
2742
|
-
let i = await
|
|
2767
|
+
let i = await Y(await C(n), "/oauth/exchange", {
|
|
2743
2768
|
method: "POST",
|
|
2744
2769
|
headers: { "Content-Type": "application/json" },
|
|
2745
2770
|
body: JSON.stringify({
|
|
@@ -2747,37 +2772,38 @@ async function Kr(e, t, n) {
|
|
|
2747
2772
|
codeVerifier: r,
|
|
2748
2773
|
supportsRefresh: !0
|
|
2749
2774
|
}),
|
|
2750
|
-
signal: x(
|
|
2775
|
+
signal: x(Lr)
|
|
2751
2776
|
});
|
|
2752
2777
|
if (!i.ok) throw Error("Could not complete the sign-in");
|
|
2753
|
-
let { token: a, expiresAt: o } = await i
|
|
2778
|
+
let { token: a, expiresAt: o } = await Hr(i, `OAuth code exchange for ${t}`), s = {
|
|
2754
2779
|
token: a,
|
|
2755
2780
|
provider: t,
|
|
2756
2781
|
authenticatedAt: Date.now(),
|
|
2757
2782
|
expiresAt: o
|
|
2758
2783
|
};
|
|
2759
|
-
return o ?
|
|
2784
|
+
return o ? Or({
|
|
2760
2785
|
provider: t,
|
|
2761
2786
|
authenticatedAt: s.authenticatedAt,
|
|
2762
2787
|
renewedAt: s.authenticatedAt
|
|
2763
|
-
}) :
|
|
2788
|
+
}) : K(s), s;
|
|
2764
2789
|
}
|
|
2765
|
-
async function
|
|
2790
|
+
async function Yr(e) {
|
|
2766
2791
|
let t = E();
|
|
2767
2792
|
if (t === null) return null;
|
|
2768
2793
|
let n;
|
|
2769
2794
|
try {
|
|
2770
2795
|
n = await fetch(`${t}/session/refresh`, {
|
|
2771
2796
|
method: "POST",
|
|
2772
|
-
signal: x(
|
|
2797
|
+
signal: x(Rr)
|
|
2773
2798
|
});
|
|
2774
2799
|
} catch (e) {
|
|
2775
2800
|
let n = e instanceof Error ? `${e.name}: ${e.message}` : String(e);
|
|
2776
|
-
throw
|
|
2801
|
+
throw J.warn(`Session renewal could not reach ${t}/session/refresh (${n})`), Error(`Session renewal could not reach the auth service (${n})`, { cause: e });
|
|
2777
2802
|
}
|
|
2778
2803
|
if (n.status === 401) return null;
|
|
2779
2804
|
if (!n.ok) throw Error(`Session renewal failed: ${n.status}`);
|
|
2780
|
-
let { token: r, expiresAt: i } = await n
|
|
2805
|
+
let { token: r, expiresAt: i } = await Hr(n, "Session renewal");
|
|
2806
|
+
if (!i) throw Error("Session renewal returned a token with no expiry");
|
|
2781
2807
|
return {
|
|
2782
2808
|
token: r,
|
|
2783
2809
|
provider: e.provider,
|
|
@@ -2785,25 +2811,25 @@ async function qr(e) {
|
|
|
2785
2811
|
expiresAt: i
|
|
2786
2812
|
};
|
|
2787
2813
|
}
|
|
2788
|
-
function
|
|
2814
|
+
function Xr() {
|
|
2789
2815
|
let e = new URLSearchParams(window.location.search), t = e.get("error");
|
|
2790
2816
|
return t ? {
|
|
2791
2817
|
code: t,
|
|
2792
2818
|
provider: e.get(h)
|
|
2793
2819
|
} : null;
|
|
2794
2820
|
}
|
|
2795
|
-
function
|
|
2821
|
+
function Zr() {
|
|
2796
2822
|
return ue();
|
|
2797
2823
|
}
|
|
2798
|
-
var
|
|
2824
|
+
var Qr = {
|
|
2799
2825
|
google: "Google",
|
|
2800
2826
|
facebook: "Facebook",
|
|
2801
2827
|
apple: "Apple",
|
|
2802
2828
|
microsoft: "Microsoft",
|
|
2803
2829
|
signicat: "eID"
|
|
2804
2830
|
};
|
|
2805
|
-
function
|
|
2806
|
-
let r = t ?
|
|
2831
|
+
function $r(e, t, n) {
|
|
2832
|
+
let r = t ? Qr[t] ?? t : "this provider";
|
|
2807
2833
|
switch (e) {
|
|
2808
2834
|
case "account_exists_unverified_email": {
|
|
2809
2835
|
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.`;
|
|
@@ -2814,7 +2840,7 @@ function Zr(e, t, n) {
|
|
|
2814
2840
|
default: return e;
|
|
2815
2841
|
}
|
|
2816
2842
|
}
|
|
2817
|
-
function
|
|
2843
|
+
function ei() {
|
|
2818
2844
|
let e = new URLSearchParams(window.location.search);
|
|
2819
2845
|
for (let t of [
|
|
2820
2846
|
g,
|
|
@@ -2826,12 +2852,12 @@ function Qr() {
|
|
|
2826
2852
|
let t = e.toString();
|
|
2827
2853
|
window.history.replaceState({}, "", t.length > 0 ? `${window.location.pathname}?${t}` : window.location.pathname);
|
|
2828
2854
|
}
|
|
2829
|
-
async function
|
|
2855
|
+
async function ti(e, t, n, r) {
|
|
2830
2856
|
let i = r ?? window.location.origin + window.location.pathname + window.location.search, a = await ie(), o = a ? `&code_challenge=${encodeURIComponent(a)}` : "";
|
|
2831
2857
|
return `${n}/oauth/${e}?space=${encodeURIComponent(t)}&return=${encodeURIComponent(i)}${o}`;
|
|
2832
2858
|
}
|
|
2833
|
-
async function
|
|
2834
|
-
let t = await
|
|
2859
|
+
async function ni(e) {
|
|
2860
|
+
let t = await Y(e, "/passkey/registration/options", {
|
|
2835
2861
|
method: "POST",
|
|
2836
2862
|
headers: { "Content-Type": "application/json" }
|
|
2837
2863
|
});
|
|
@@ -2841,8 +2867,8 @@ async function ei(e) {
|
|
|
2841
2867
|
}
|
|
2842
2868
|
return t.json();
|
|
2843
2869
|
}
|
|
2844
|
-
async function
|
|
2845
|
-
let r = await
|
|
2870
|
+
async function ri(e, t, n) {
|
|
2871
|
+
let r = await Y(e, "/passkey/registration/verify", {
|
|
2846
2872
|
method: "POST",
|
|
2847
2873
|
headers: { "Content-Type": "application/json" },
|
|
2848
2874
|
body: JSON.stringify({
|
|
@@ -2854,15 +2880,15 @@ async function ti(e, t, n) {
|
|
|
2854
2880
|
let e = await r.text().catch(() => "Registration verification failed");
|
|
2855
2881
|
throw Error(e);
|
|
2856
2882
|
}
|
|
2857
|
-
let { token: i } = await r
|
|
2883
|
+
let { token: i } = await Hr(r, "Passkey registration verification"), a = {
|
|
2858
2884
|
token: i,
|
|
2859
2885
|
provider: "passkey",
|
|
2860
2886
|
authenticatedAt: Date.now()
|
|
2861
2887
|
};
|
|
2862
|
-
return
|
|
2888
|
+
return K(a), a;
|
|
2863
2889
|
}
|
|
2864
|
-
async function
|
|
2865
|
-
let n = await
|
|
2890
|
+
async function ii(e, t) {
|
|
2891
|
+
let n = await Y(e, "/passkey/authentication/options", {
|
|
2866
2892
|
method: "POST",
|
|
2867
2893
|
headers: { "Content-Type": "application/json" },
|
|
2868
2894
|
body: JSON.stringify({ email: t })
|
|
@@ -2873,8 +2899,8 @@ async function ni(e, t) {
|
|
|
2873
2899
|
}
|
|
2874
2900
|
return n.json();
|
|
2875
2901
|
}
|
|
2876
|
-
async function
|
|
2877
|
-
let n = await
|
|
2902
|
+
async function ai(e, t) {
|
|
2903
|
+
let n = await Y(e, "/passkey/authentication/verify", {
|
|
2878
2904
|
method: "POST",
|
|
2879
2905
|
headers: { "Content-Type": "application/json" },
|
|
2880
2906
|
body: JSON.stringify({ response: t })
|
|
@@ -2883,60 +2909,61 @@ async function ri(e, t) {
|
|
|
2883
2909
|
let e = await n.text().catch(() => "Authentication verification failed");
|
|
2884
2910
|
throw Error(e);
|
|
2885
2911
|
}
|
|
2886
|
-
let { token: r } = await n
|
|
2912
|
+
let { token: r } = await Hr(n, "Passkey authentication verification"), i = {
|
|
2887
2913
|
token: r,
|
|
2888
2914
|
provider: "passkey",
|
|
2889
2915
|
authenticatedAt: Date.now()
|
|
2890
2916
|
};
|
|
2891
|
-
return
|
|
2917
|
+
return K(i), i;
|
|
2892
2918
|
}
|
|
2893
|
-
async function
|
|
2919
|
+
async function oi(e, t) {
|
|
2894
2920
|
try {
|
|
2895
|
-
await
|
|
2921
|
+
await Y(await C(t), "/logout", {
|
|
2896
2922
|
method: "POST",
|
|
2897
2923
|
headers: { Authorization: `Bearer ${e}` },
|
|
2898
|
-
signal: x(
|
|
2924
|
+
signal: x(Lr)
|
|
2899
2925
|
});
|
|
2900
2926
|
} catch {}
|
|
2901
2927
|
}
|
|
2902
2928
|
//#endregion
|
|
2903
2929
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/bufferToBase64URLString.js
|
|
2904
|
-
function
|
|
2930
|
+
function X(e) {
|
|
2905
2931
|
let t = new Uint8Array(e), n = "";
|
|
2906
2932
|
for (let e of t) n += String.fromCharCode(e);
|
|
2907
2933
|
return btoa(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
2908
2934
|
}
|
|
2909
2935
|
//#endregion
|
|
2910
2936
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/base64URLStringToBuffer.js
|
|
2911
|
-
function
|
|
2937
|
+
function si(e) {
|
|
2912
2938
|
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);
|
|
2913
2939
|
for (let e = 0; e < i.length; e++) o[e] = i.charCodeAt(e);
|
|
2914
2940
|
return a;
|
|
2915
2941
|
}
|
|
2916
2942
|
//#endregion
|
|
2917
2943
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthn.js
|
|
2918
|
-
function
|
|
2919
|
-
return
|
|
2944
|
+
function ci() {
|
|
2945
|
+
return li.stubThis(globalThis?.PublicKeyCredential !== void 0 && typeof globalThis.PublicKeyCredential == "function");
|
|
2920
2946
|
}
|
|
2921
|
-
var
|
|
2947
|
+
var li = { stubThis: (e) => e };
|
|
2922
2948
|
//#endregion
|
|
2923
2949
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/toPublicKeyCredentialDescriptor.js
|
|
2924
|
-
function
|
|
2950
|
+
function ui(e) {
|
|
2925
2951
|
let { id: t } = e;
|
|
2926
2952
|
return {
|
|
2927
2953
|
...e,
|
|
2928
|
-
id:
|
|
2929
|
-
transports: e.transports
|
|
2954
|
+
id: si(t),
|
|
2955
|
+
transports: e.transports,
|
|
2956
|
+
type: e.type
|
|
2930
2957
|
};
|
|
2931
2958
|
}
|
|
2932
2959
|
//#endregion
|
|
2933
2960
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/isValidDomain.js
|
|
2934
|
-
function
|
|
2961
|
+
function di(e) {
|
|
2935
2962
|
return e === "localhost" || /^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e);
|
|
2936
2963
|
}
|
|
2937
2964
|
//#endregion
|
|
2938
2965
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/webAuthnError.js
|
|
2939
|
-
var
|
|
2966
|
+
var Z = class extends Error {
|
|
2940
2967
|
constructor({ message: e, code: t, cause: n, name: r }) {
|
|
2941
2968
|
super(e, { cause: n }), Object.defineProperty(this, "code", {
|
|
2942
2969
|
enumerable: !0,
|
|
@@ -2948,76 +2975,76 @@ var Q = class extends Error {
|
|
|
2948
2975
|
};
|
|
2949
2976
|
//#endregion
|
|
2950
2977
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/identifyRegistrationError.js
|
|
2951
|
-
function
|
|
2978
|
+
function fi({ error: e, options: t }) {
|
|
2952
2979
|
let { publicKey: n } = t;
|
|
2953
2980
|
if (!n) throw Error("options was missing required publicKey property");
|
|
2954
2981
|
if (e.name === "AbortError") {
|
|
2955
|
-
if (t.signal instanceof AbortSignal) return new
|
|
2982
|
+
if (t.signal instanceof AbortSignal) return new Z({
|
|
2956
2983
|
message: "Registration ceremony was sent an abort signal",
|
|
2957
2984
|
code: "ERROR_CEREMONY_ABORTED",
|
|
2958
2985
|
cause: e
|
|
2959
2986
|
});
|
|
2960
2987
|
} else if (e.name === "ConstraintError") {
|
|
2961
|
-
if (n.authenticatorSelection?.requireResidentKey === !0) return new
|
|
2988
|
+
if (n.authenticatorSelection?.requireResidentKey === !0) return new Z({
|
|
2962
2989
|
message: "Discoverable credentials were required but no available authenticator supported it",
|
|
2963
2990
|
code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
|
|
2964
2991
|
cause: e
|
|
2965
2992
|
});
|
|
2966
|
-
if (t.mediation === "conditional" && n.authenticatorSelection?.userVerification === "required") return new
|
|
2993
|
+
if (t.mediation === "conditional" && n.authenticatorSelection?.userVerification === "required") return new Z({
|
|
2967
2994
|
message: "User verification was required during automatic registration but it could not be performed",
|
|
2968
2995
|
code: "ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",
|
|
2969
2996
|
cause: e
|
|
2970
2997
|
});
|
|
2971
|
-
if (n.authenticatorSelection?.userVerification === "required") return new
|
|
2998
|
+
if (n.authenticatorSelection?.userVerification === "required") return new Z({
|
|
2972
2999
|
message: "User verification was required but no available authenticator supported it",
|
|
2973
3000
|
code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
|
|
2974
3001
|
cause: e
|
|
2975
3002
|
});
|
|
2976
|
-
} else if (e.name === "InvalidStateError") return new
|
|
3003
|
+
} else if (e.name === "InvalidStateError") return new Z({
|
|
2977
3004
|
message: "The authenticator was previously registered",
|
|
2978
3005
|
code: "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",
|
|
2979
3006
|
cause: e
|
|
2980
3007
|
});
|
|
2981
|
-
else if (e.name === "NotAllowedError") return new
|
|
3008
|
+
else if (e.name === "NotAllowedError") return new Z({
|
|
2982
3009
|
message: e.message,
|
|
2983
3010
|
code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
|
|
2984
3011
|
cause: e
|
|
2985
3012
|
});
|
|
2986
|
-
else if (e.name === "NotSupportedError") return n.pubKeyCredParams.filter((e) => e.type === "public-key").length === 0 ? new
|
|
3013
|
+
else if (e.name === "NotSupportedError") return n.pubKeyCredParams.filter((e) => e.type === "public-key").length === 0 ? new Z({
|
|
2987
3014
|
message: "No entry in pubKeyCredParams was of type \"public-key\"",
|
|
2988
3015
|
code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
|
|
2989
3016
|
cause: e
|
|
2990
|
-
}) : new
|
|
3017
|
+
}) : new Z({
|
|
2991
3018
|
message: "No available authenticator supported any of the specified pubKeyCredParams algorithms",
|
|
2992
3019
|
code: "ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",
|
|
2993
3020
|
cause: e
|
|
2994
3021
|
});
|
|
2995
3022
|
else if (e.name === "SecurityError") {
|
|
2996
3023
|
let t = globalThis.location.hostname;
|
|
2997
|
-
if (!
|
|
3024
|
+
if (!di(t)) return new Z({
|
|
2998
3025
|
message: `${globalThis.location.hostname} is an invalid domain`,
|
|
2999
3026
|
code: "ERROR_INVALID_DOMAIN",
|
|
3000
3027
|
cause: e
|
|
3001
3028
|
});
|
|
3002
|
-
if (n.rp.id !== t) return new
|
|
3029
|
+
if (n.rp.id !== t) return new Z({
|
|
3003
3030
|
message: `The RP ID "${n.rp.id}" is invalid for this domain`,
|
|
3004
3031
|
code: "ERROR_INVALID_RP_ID",
|
|
3005
3032
|
cause: e
|
|
3006
3033
|
});
|
|
3007
3034
|
} else if (e.name === "TypeError") {
|
|
3008
|
-
if (n.user.id.byteLength < 1 || n.user.id.byteLength > 64) return new
|
|
3035
|
+
if (n.user.id.byteLength < 1 || n.user.id.byteLength > 64) return new Z({
|
|
3009
3036
|
message: "User ID was not between 1 and 64 characters",
|
|
3010
3037
|
code: "ERROR_INVALID_USER_ID_LENGTH",
|
|
3011
3038
|
cause: e
|
|
3012
3039
|
});
|
|
3013
|
-
} else if (e.name === "UnknownError") return new
|
|
3040
|
+
} else if (e.name === "UnknownError") return new Z({
|
|
3014
3041
|
message: "The authenticator was unable to process the specified options, or could not create a new credential",
|
|
3015
3042
|
code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
|
|
3016
3043
|
cause: e
|
|
3017
3044
|
});
|
|
3018
3045
|
return e;
|
|
3019
3046
|
}
|
|
3020
|
-
var
|
|
3047
|
+
var pi = new class {
|
|
3021
3048
|
constructor() {
|
|
3022
3049
|
Object.defineProperty(this, "controller", {
|
|
3023
3050
|
enumerable: !0,
|
|
@@ -3040,31 +3067,31 @@ var di = new class {
|
|
|
3040
3067
|
e.name = "AbortError", this.controller.abort(e), this.controller = void 0;
|
|
3041
3068
|
}
|
|
3042
3069
|
}
|
|
3043
|
-
}(),
|
|
3044
|
-
function
|
|
3045
|
-
if (e && !(
|
|
3070
|
+
}(), mi = ["cross-platform", "platform"];
|
|
3071
|
+
function hi(e) {
|
|
3072
|
+
if (e && !(mi.indexOf(e) < 0)) return e;
|
|
3046
3073
|
}
|
|
3047
3074
|
//#endregion
|
|
3048
3075
|
//#region ../../node_modules/@simplewebauthn/browser/esm/methods/startRegistration.js
|
|
3049
|
-
async function
|
|
3076
|
+
async function gi(e) {
|
|
3050
3077
|
!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 });
|
|
3051
3078
|
let { optionsJSON: t, useAutoRegister: n = !1 } = e;
|
|
3052
|
-
if (!
|
|
3079
|
+
if (!ci()) throw Error("WebAuthn is not supported in this browser");
|
|
3053
3080
|
let r = {
|
|
3054
3081
|
...t,
|
|
3055
|
-
challenge:
|
|
3082
|
+
challenge: si(t.challenge),
|
|
3056
3083
|
user: {
|
|
3057
3084
|
...t.user,
|
|
3058
|
-
id:
|
|
3085
|
+
id: si(t.user.id)
|
|
3059
3086
|
},
|
|
3060
|
-
excludeCredentials: t.excludeCredentials?.map(
|
|
3087
|
+
excludeCredentials: t.excludeCredentials?.map(ui)
|
|
3061
3088
|
}, i = {};
|
|
3062
|
-
n && (i.mediation = "conditional"), i.publicKey = r, i.signal =
|
|
3089
|
+
n && (i.mediation = "conditional"), i.publicKey = r, i.signal = pi.createNewAbortSignal();
|
|
3063
3090
|
let a;
|
|
3064
3091
|
try {
|
|
3065
3092
|
a = await navigator.credentials.create(i);
|
|
3066
3093
|
} catch (e) {
|
|
3067
|
-
throw
|
|
3094
|
+
throw fi({
|
|
3068
3095
|
error: e,
|
|
3069
3096
|
options: i
|
|
3070
3097
|
});
|
|
@@ -3076,27 +3103,27 @@ async function mi(e) {
|
|
|
3076
3103
|
if (typeof c.getPublicKeyAlgorithm == "function") try {
|
|
3077
3104
|
d = c.getPublicKeyAlgorithm();
|
|
3078
3105
|
} catch (e) {
|
|
3079
|
-
|
|
3106
|
+
_i("getPublicKeyAlgorithm()", e);
|
|
3080
3107
|
}
|
|
3081
3108
|
let f;
|
|
3082
3109
|
if (typeof c.getPublicKey == "function") try {
|
|
3083
3110
|
let e = c.getPublicKey();
|
|
3084
|
-
e !== null && (f =
|
|
3111
|
+
e !== null && (f = X(e));
|
|
3085
3112
|
} catch (e) {
|
|
3086
|
-
|
|
3113
|
+
_i("getPublicKey()", e);
|
|
3087
3114
|
}
|
|
3088
3115
|
let p;
|
|
3089
3116
|
if (typeof c.getAuthenticatorData == "function") try {
|
|
3090
|
-
p =
|
|
3117
|
+
p = X(c.getAuthenticatorData());
|
|
3091
3118
|
} catch (e) {
|
|
3092
|
-
|
|
3119
|
+
_i("getAuthenticatorData()", e);
|
|
3093
3120
|
}
|
|
3094
3121
|
return {
|
|
3095
3122
|
id: o,
|
|
3096
|
-
rawId:
|
|
3123
|
+
rawId: X(s),
|
|
3097
3124
|
response: {
|
|
3098
|
-
attestationObject:
|
|
3099
|
-
clientDataJSON:
|
|
3125
|
+
attestationObject: X(c.attestationObject),
|
|
3126
|
+
clientDataJSON: X(c.clientDataJSON),
|
|
3100
3127
|
transports: u,
|
|
3101
3128
|
publicKeyAlgorithm: d,
|
|
3102
3129
|
publicKey: f,
|
|
@@ -3104,49 +3131,49 @@ async function mi(e) {
|
|
|
3104
3131
|
},
|
|
3105
3132
|
type: l,
|
|
3106
3133
|
clientExtensionResults: a.getClientExtensionResults(),
|
|
3107
|
-
authenticatorAttachment:
|
|
3134
|
+
authenticatorAttachment: hi(a.authenticatorAttachment)
|
|
3108
3135
|
};
|
|
3109
3136
|
}
|
|
3110
|
-
function
|
|
3137
|
+
function _i(e, t) {
|
|
3111
3138
|
console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`, t);
|
|
3112
3139
|
}
|
|
3113
3140
|
//#endregion
|
|
3114
3141
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthnAutofill.js
|
|
3115
|
-
function
|
|
3116
|
-
if (!
|
|
3142
|
+
function vi() {
|
|
3143
|
+
if (!ci()) return yi.stubThis(new Promise((e) => e(!1)));
|
|
3117
3144
|
let e = globalThis.PublicKeyCredential;
|
|
3118
|
-
return e?.isConditionalMediationAvailable === void 0 ?
|
|
3145
|
+
return e?.isConditionalMediationAvailable === void 0 ? yi.stubThis(new Promise((e) => e(!1))) : yi.stubThis(e.isConditionalMediationAvailable());
|
|
3119
3146
|
}
|
|
3120
|
-
var
|
|
3147
|
+
var yi = { stubThis: (e) => e };
|
|
3121
3148
|
//#endregion
|
|
3122
3149
|
//#region ../../node_modules/@simplewebauthn/browser/esm/helpers/identifyAuthenticationError.js
|
|
3123
|
-
function
|
|
3150
|
+
function bi({ error: e, options: t }) {
|
|
3124
3151
|
let { publicKey: n } = t;
|
|
3125
3152
|
if (!n) throw Error("options was missing required publicKey property");
|
|
3126
3153
|
if (e.name === "AbortError") {
|
|
3127
|
-
if (t.signal instanceof AbortSignal) return new
|
|
3154
|
+
if (t.signal instanceof AbortSignal) return new Z({
|
|
3128
3155
|
message: "Authentication ceremony was sent an abort signal",
|
|
3129
3156
|
code: "ERROR_CEREMONY_ABORTED",
|
|
3130
3157
|
cause: e
|
|
3131
3158
|
});
|
|
3132
|
-
} else if (e.name === "NotAllowedError") return new
|
|
3159
|
+
} else if (e.name === "NotAllowedError") return new Z({
|
|
3133
3160
|
message: e.message,
|
|
3134
3161
|
code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
|
|
3135
3162
|
cause: e
|
|
3136
3163
|
});
|
|
3137
3164
|
else if (e.name === "SecurityError") {
|
|
3138
3165
|
let t = globalThis.location.hostname;
|
|
3139
|
-
if (!
|
|
3166
|
+
if (!di(t)) return new Z({
|
|
3140
3167
|
message: `${globalThis.location.hostname} is an invalid domain`,
|
|
3141
3168
|
code: "ERROR_INVALID_DOMAIN",
|
|
3142
3169
|
cause: e
|
|
3143
3170
|
});
|
|
3144
|
-
if (n.rpId !== t) return new
|
|
3171
|
+
if (n.rpId !== t) return new Z({
|
|
3145
3172
|
message: `The RP ID "${n.rpId}" is invalid for this domain`,
|
|
3146
3173
|
code: "ERROR_INVALID_RP_ID",
|
|
3147
3174
|
cause: e
|
|
3148
3175
|
});
|
|
3149
|
-
} else if (e.name === "UnknownError") return new
|
|
3176
|
+
} else if (e.name === "UnknownError") return new Z({
|
|
3150
3177
|
message: "The authenticator was unable to process the specified options, or could not create a new assertion signature",
|
|
3151
3178
|
code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
|
|
3152
3179
|
cause: e
|
|
@@ -3155,65 +3182,65 @@ function vi({ error: e, options: t }) {
|
|
|
3155
3182
|
}
|
|
3156
3183
|
//#endregion
|
|
3157
3184
|
//#region ../../node_modules/@simplewebauthn/browser/esm/methods/startAuthentication.js
|
|
3158
|
-
async function
|
|
3185
|
+
async function xi(e) {
|
|
3159
3186
|
!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 });
|
|
3160
3187
|
let { optionsJSON: t, useBrowserAutofill: n = !1, verifyBrowserAutofillInput: r = !0 } = e;
|
|
3161
|
-
if (!
|
|
3188
|
+
if (!ci()) throw Error("WebAuthn is not supported in this browser");
|
|
3162
3189
|
let i;
|
|
3163
|
-
t.allowCredentials?.length !== 0 && (i = t.allowCredentials?.map(
|
|
3190
|
+
t.allowCredentials?.length !== 0 && (i = t.allowCredentials?.map(ui));
|
|
3164
3191
|
let a = {
|
|
3165
3192
|
...t,
|
|
3166
|
-
challenge:
|
|
3193
|
+
challenge: si(t.challenge),
|
|
3167
3194
|
allowCredentials: i
|
|
3168
3195
|
}, o = {};
|
|
3169
3196
|
if (n) {
|
|
3170
|
-
if (!await
|
|
3197
|
+
if (!await vi()) throw Error("Browser does not support WebAuthn autofill");
|
|
3171
3198
|
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");
|
|
3172
3199
|
o.mediation = "conditional", a.allowCredentials = [];
|
|
3173
3200
|
}
|
|
3174
|
-
o.publicKey = a, o.signal =
|
|
3201
|
+
o.publicKey = a, o.signal = pi.createNewAbortSignal();
|
|
3175
3202
|
let s;
|
|
3176
3203
|
try {
|
|
3177
3204
|
s = await navigator.credentials.get(o);
|
|
3178
3205
|
} catch (e) {
|
|
3179
|
-
throw
|
|
3206
|
+
throw bi({
|
|
3180
3207
|
error: e,
|
|
3181
3208
|
options: o
|
|
3182
3209
|
});
|
|
3183
3210
|
}
|
|
3184
3211
|
if (!s) throw Error("Authentication was not completed");
|
|
3185
3212
|
let { id: c, rawId: l, response: u, type: d } = s, f;
|
|
3186
|
-
return u.userHandle && (f =
|
|
3213
|
+
return u.userHandle && (f = X(u.userHandle)), {
|
|
3187
3214
|
id: c,
|
|
3188
|
-
rawId:
|
|
3215
|
+
rawId: X(l),
|
|
3189
3216
|
response: {
|
|
3190
|
-
authenticatorData:
|
|
3191
|
-
clientDataJSON:
|
|
3192
|
-
signature:
|
|
3217
|
+
authenticatorData: X(u.authenticatorData),
|
|
3218
|
+
clientDataJSON: X(u.clientDataJSON),
|
|
3219
|
+
signature: X(u.signature),
|
|
3193
3220
|
userHandle: f
|
|
3194
3221
|
},
|
|
3195
3222
|
type: d,
|
|
3196
3223
|
clientExtensionResults: s.getClientExtensionResults(),
|
|
3197
|
-
authenticatorAttachment:
|
|
3224
|
+
authenticatorAttachment: hi(s.authenticatorAttachment)
|
|
3198
3225
|
};
|
|
3199
3226
|
}
|
|
3200
3227
|
//#endregion
|
|
3201
3228
|
//#region src/auth/auth-context.tsx
|
|
3202
|
-
var
|
|
3203
|
-
async function
|
|
3229
|
+
var Si = "/dev-login-token", Ci = "X-Ikon-Dev-Login-Run";
|
|
3230
|
+
async function wi(e) {
|
|
3204
3231
|
let t = typeof window < "u" ? window.__IKON_LOCAL_IKON_SERVER_CONFIG__ : void 0;
|
|
3205
3232
|
if (!(!t?.enabled || !t.host || !t.port)) try {
|
|
3206
|
-
let n = await fetch(`https://${t.host}:${t.port}${
|
|
3233
|
+
let n = await fetch(`https://${t.host}:${t.port}${Si}`, {
|
|
3207
3234
|
cache: "no-store",
|
|
3208
|
-
headers: { [
|
|
3235
|
+
headers: { [Ci]: e }
|
|
3209
3236
|
});
|
|
3210
3237
|
return n.ok && (await n.json()).token || void 0;
|
|
3211
3238
|
} catch {
|
|
3212
3239
|
return;
|
|
3213
3240
|
}
|
|
3214
3241
|
}
|
|
3215
|
-
var
|
|
3216
|
-
function
|
|
3242
|
+
var Ti = De(null), Ei = 12e4, Di = 6e4;
|
|
3243
|
+
function Oi({ children: e, config: n }) {
|
|
3217
3244
|
let [r, i] = N({
|
|
3218
3245
|
isAuthenticated: !1,
|
|
3219
3246
|
isLoading: !0,
|
|
@@ -3223,9 +3250,9 @@ function Ei({ children: e, config: n }) {
|
|
|
3223
3250
|
if (!c.current) {
|
|
3224
3251
|
c.current = !0;
|
|
3225
3252
|
try {
|
|
3226
|
-
let t = await
|
|
3253
|
+
let t = await Yr(e);
|
|
3227
3254
|
if (t === null) {
|
|
3228
|
-
|
|
3255
|
+
jr(), i({
|
|
3229
3256
|
isAuthenticated: !1,
|
|
3230
3257
|
isLoading: !1,
|
|
3231
3258
|
user: null,
|
|
@@ -3233,10 +3260,10 @@ function Ei({ children: e, config: n }) {
|
|
|
3233
3260
|
});
|
|
3234
3261
|
return;
|
|
3235
3262
|
}
|
|
3236
|
-
|
|
3263
|
+
Ar(), i({
|
|
3237
3264
|
isAuthenticated: !0,
|
|
3238
3265
|
isLoading: !1,
|
|
3239
|
-
user:
|
|
3266
|
+
user: q(t),
|
|
3240
3267
|
error: null
|
|
3241
3268
|
});
|
|
3242
3269
|
} catch {} finally {
|
|
@@ -3247,28 +3274,28 @@ function Ei({ children: e, config: n }) {
|
|
|
3247
3274
|
k(() => {
|
|
3248
3275
|
(() => {
|
|
3249
3276
|
if (s.current) return;
|
|
3250
|
-
let e = n.devLoginRunId, t = !!e &&
|
|
3251
|
-
e && !
|
|
3252
|
-
let r = !!n.devLoginToken && !!e && !t && !
|
|
3253
|
-
o ||
|
|
3254
|
-
let c =
|
|
3277
|
+
let e = n.devLoginRunId, t = !!e && Ir() === e && !Dr();
|
|
3278
|
+
e && !Zr() && Fr(e);
|
|
3279
|
+
let r = !!n.devLoginToken && !!e && !t && !Zr();
|
|
3280
|
+
o || Mr();
|
|
3281
|
+
let c = Xr();
|
|
3255
3282
|
if (c) {
|
|
3256
|
-
|
|
3283
|
+
ei(), i({
|
|
3257
3284
|
isAuthenticated: !1,
|
|
3258
3285
|
isLoading: !1,
|
|
3259
3286
|
user: null,
|
|
3260
|
-
error:
|
|
3287
|
+
error: $r(c.code, c.provider, { emailSignInAvailable: a })
|
|
3261
3288
|
});
|
|
3262
3289
|
return;
|
|
3263
3290
|
}
|
|
3264
3291
|
ne();
|
|
3265
|
-
let l =
|
|
3292
|
+
let l = qr();
|
|
3266
3293
|
if (l) {
|
|
3267
|
-
s.current = !0,
|
|
3294
|
+
s.current = !0, ei(), Jr(l.code, l.provider, n.authUrl).then((e) => {
|
|
3268
3295
|
i({
|
|
3269
3296
|
isAuthenticated: !0,
|
|
3270
3297
|
isLoading: !1,
|
|
3271
|
-
user:
|
|
3298
|
+
user: q(e),
|
|
3272
3299
|
error: null
|
|
3273
3300
|
});
|
|
3274
3301
|
}).catch((e) => {
|
|
@@ -3281,26 +3308,26 @@ function Ei({ children: e, config: n }) {
|
|
|
3281
3308
|
});
|
|
3282
3309
|
return;
|
|
3283
3310
|
}
|
|
3284
|
-
let u =
|
|
3311
|
+
let u = Kr();
|
|
3285
3312
|
if (u) {
|
|
3286
3313
|
let e = {
|
|
3287
3314
|
token: u.token,
|
|
3288
3315
|
provider: u.provider,
|
|
3289
3316
|
authenticatedAt: Date.now()
|
|
3290
3317
|
};
|
|
3291
|
-
|
|
3318
|
+
K(e), ei(), i({
|
|
3292
3319
|
isAuthenticated: !0,
|
|
3293
3320
|
isLoading: !1,
|
|
3294
|
-
user:
|
|
3321
|
+
user: q(e),
|
|
3295
3322
|
error: null
|
|
3296
3323
|
});
|
|
3297
3324
|
return;
|
|
3298
3325
|
}
|
|
3299
|
-
let d =
|
|
3326
|
+
let d = kr();
|
|
3300
3327
|
if (d) {
|
|
3301
|
-
s.current = !0,
|
|
3328
|
+
s.current = !0, Yr(d).then((e) => {
|
|
3302
3329
|
if (e === null) {
|
|
3303
|
-
|
|
3330
|
+
jr(), i({
|
|
3304
3331
|
isAuthenticated: !1,
|
|
3305
3332
|
isLoading: !1,
|
|
3306
3333
|
user: null,
|
|
@@ -3308,10 +3335,10 @@ function Ei({ children: e, config: n }) {
|
|
|
3308
3335
|
});
|
|
3309
3336
|
return;
|
|
3310
3337
|
}
|
|
3311
|
-
|
|
3338
|
+
Ar(), i({
|
|
3312
3339
|
isAuthenticated: !0,
|
|
3313
3340
|
isLoading: !1,
|
|
3314
|
-
user:
|
|
3341
|
+
user: q(e),
|
|
3315
3342
|
error: null
|
|
3316
3343
|
});
|
|
3317
3344
|
}).catch(() => {
|
|
@@ -3324,12 +3351,12 @@ function Ei({ children: e, config: n }) {
|
|
|
3324
3351
|
});
|
|
3325
3352
|
return;
|
|
3326
3353
|
}
|
|
3327
|
-
let f =
|
|
3354
|
+
let f = Er();
|
|
3328
3355
|
if (f && !(r && f.provider === "anonymous")) {
|
|
3329
3356
|
i({
|
|
3330
3357
|
isAuthenticated: !0,
|
|
3331
3358
|
isLoading: !1,
|
|
3332
|
-
user:
|
|
3359
|
+
user: q(f),
|
|
3333
3360
|
error: null
|
|
3334
3361
|
});
|
|
3335
3362
|
return;
|
|
@@ -3340,21 +3367,21 @@ function Ei({ children: e, config: n }) {
|
|
|
3340
3367
|
token: e,
|
|
3341
3368
|
provider: "dev",
|
|
3342
3369
|
authenticatedAt: Date.now(),
|
|
3343
|
-
expiresAt:
|
|
3370
|
+
expiresAt: Tr(e)
|
|
3344
3371
|
};
|
|
3345
|
-
|
|
3372
|
+
K(t), i({
|
|
3346
3373
|
isAuthenticated: !0,
|
|
3347
3374
|
isLoading: !1,
|
|
3348
|
-
user:
|
|
3375
|
+
user: q(t),
|
|
3349
3376
|
error: null
|
|
3350
3377
|
});
|
|
3351
3378
|
};
|
|
3352
|
-
if (!
|
|
3379
|
+
if (!wr(n.devLoginToken)) {
|
|
3353
3380
|
t(n.devLoginToken);
|
|
3354
3381
|
return;
|
|
3355
3382
|
}
|
|
3356
|
-
|
|
3357
|
-
if (e && !
|
|
3383
|
+
wi(e).then((e) => {
|
|
3384
|
+
if (e && !wr(e)) {
|
|
3358
3385
|
t(e);
|
|
3359
3386
|
return;
|
|
3360
3387
|
}
|
|
@@ -3382,11 +3409,11 @@ function Ei({ children: e, config: n }) {
|
|
|
3382
3409
|
o
|
|
3383
3410
|
]), k(() => {
|
|
3384
3411
|
if (n.spaceId) return ge(n.spaceId, (e) => {
|
|
3385
|
-
s.current = !0, e.codeVerifier && be(e.codeVerifier),
|
|
3412
|
+
s.current = !0, e.codeVerifier && be(e.codeVerifier), Jr(e.code, e.provider, n.authUrl).then((e) => {
|
|
3386
3413
|
i({
|
|
3387
3414
|
isAuthenticated: !0,
|
|
3388
3415
|
isLoading: !1,
|
|
3389
|
-
user:
|
|
3416
|
+
user: q(e),
|
|
3390
3417
|
error: null
|
|
3391
3418
|
});
|
|
3392
3419
|
}).catch((e) => {
|
|
@@ -3401,9 +3428,9 @@ function Ei({ children: e, config: n }) {
|
|
|
3401
3428
|
}, [n.spaceId, n.authUrl]), k(() => {
|
|
3402
3429
|
let e = r.user?.expiresAt;
|
|
3403
3430
|
if (!e || r.user?.provider === "dev") return;
|
|
3404
|
-
let t =
|
|
3431
|
+
let t = kr();
|
|
3405
3432
|
if (!t) return;
|
|
3406
|
-
let n = Date.parse(e) -
|
|
3433
|
+
let n = Date.parse(e) - Ei, i = setTimeout(() => void l(t), Math.max(0, n - Date.now())), a = () => {
|
|
3407
3434
|
document.visibilityState === "visible" && Date.now() >= n && l(t);
|
|
3408
3435
|
};
|
|
3409
3436
|
return document.addEventListener("visibilitychange", a), () => {
|
|
@@ -3419,25 +3446,25 @@ function Ei({ children: e, config: n }) {
|
|
|
3419
3446
|
if (!e) return;
|
|
3420
3447
|
let t = r.user.expiresAt;
|
|
3421
3448
|
if (!t) return;
|
|
3422
|
-
let a = r.user.token, o = Date.parse(t) -
|
|
3449
|
+
let a = r.user.token, o = Date.parse(t) - Ei, s, c = !1, l = !1, u = async () => {
|
|
3423
3450
|
if (c || l) return;
|
|
3424
3451
|
l = !0;
|
|
3425
|
-
let t = await
|
|
3452
|
+
let t = await wi(e);
|
|
3426
3453
|
if (l = !1, c) return;
|
|
3427
|
-
if (!t || t === a ||
|
|
3428
|
-
s = setTimeout(() => void u(),
|
|
3454
|
+
if (!t || t === a || wr(t)) {
|
|
3455
|
+
s = setTimeout(() => void u(), Di);
|
|
3429
3456
|
return;
|
|
3430
3457
|
}
|
|
3431
3458
|
let n = {
|
|
3432
3459
|
token: t,
|
|
3433
3460
|
provider: "dev",
|
|
3434
3461
|
authenticatedAt: Date.now(),
|
|
3435
|
-
expiresAt:
|
|
3462
|
+
expiresAt: Tr(t)
|
|
3436
3463
|
};
|
|
3437
|
-
|
|
3464
|
+
K(n), i({
|
|
3438
3465
|
isAuthenticated: !0,
|
|
3439
3466
|
isLoading: !1,
|
|
3440
|
-
user:
|
|
3467
|
+
user: q(n),
|
|
3441
3468
|
error: null
|
|
3442
3469
|
});
|
|
3443
3470
|
};
|
|
@@ -3479,11 +3506,11 @@ function Ei({ children: e, config: n }) {
|
|
|
3479
3506
|
isLoading: !0
|
|
3480
3507
|
}));
|
|
3481
3508
|
try {
|
|
3482
|
-
let r = await
|
|
3509
|
+
let r = await Ur(n.spaceId, t, e);
|
|
3483
3510
|
i({
|
|
3484
3511
|
isAuthenticated: !0,
|
|
3485
3512
|
isLoading: !1,
|
|
3486
|
-
user:
|
|
3513
|
+
user: q(r),
|
|
3487
3514
|
error: null
|
|
3488
3515
|
});
|
|
3489
3516
|
} catch (e) {
|
|
@@ -3502,11 +3529,11 @@ function Ei({ children: e, config: n }) {
|
|
|
3502
3529
|
error: null
|
|
3503
3530
|
}));
|
|
3504
3531
|
try {
|
|
3505
|
-
let e = await
|
|
3532
|
+
let e = await xi({ optionsJSON: await ii(t) }), n = await ai(t, e);
|
|
3506
3533
|
i({
|
|
3507
3534
|
isAuthenticated: !0,
|
|
3508
3535
|
isLoading: !1,
|
|
3509
|
-
user:
|
|
3536
|
+
user: q(n),
|
|
3510
3537
|
error: null
|
|
3511
3538
|
});
|
|
3512
3539
|
} catch (e) {
|
|
@@ -3527,14 +3554,14 @@ function Ei({ children: e, config: n }) {
|
|
|
3527
3554
|
}));
|
|
3528
3555
|
return;
|
|
3529
3556
|
}
|
|
3530
|
-
window.location.href = await
|
|
3557
|
+
window.location.href = await ti(e, n.spaceId, t);
|
|
3531
3558
|
}, [n.authUrl, n.spaceId]), d = O(async (e) => {
|
|
3532
3559
|
if (!n.spaceId) throw i((e) => ({
|
|
3533
3560
|
...e,
|
|
3534
3561
|
error: "Space ID is not configured"
|
|
3535
3562
|
})), Error("Space ID is not configured");
|
|
3536
3563
|
let t = await C(n.authUrl);
|
|
3537
|
-
await
|
|
3564
|
+
await Wr({
|
|
3538
3565
|
email: e,
|
|
3539
3566
|
spaceId: n.spaceId,
|
|
3540
3567
|
authUrl: t
|
|
@@ -3546,7 +3573,7 @@ function Ei({ children: e, config: n }) {
|
|
|
3546
3573
|
error: null
|
|
3547
3574
|
}));
|
|
3548
3575
|
try {
|
|
3549
|
-
let r = await
|
|
3576
|
+
let r = await Gr({
|
|
3550
3577
|
email: e,
|
|
3551
3578
|
code: t,
|
|
3552
3579
|
authUrl: await C(n.authUrl)
|
|
@@ -3554,7 +3581,7 @@ function Ei({ children: e, config: n }) {
|
|
|
3554
3581
|
i({
|
|
3555
3582
|
isAuthenticated: !0,
|
|
3556
3583
|
isLoading: !1,
|
|
3557
|
-
user:
|
|
3584
|
+
user: q(r),
|
|
3558
3585
|
error: null
|
|
3559
3586
|
});
|
|
3560
3587
|
} catch (e) {
|
|
@@ -3567,7 +3594,7 @@ function Ei({ children: e, config: n }) {
|
|
|
3567
3594
|
}
|
|
3568
3595
|
}, [n.authUrl]), p = O(() => {
|
|
3569
3596
|
let e = r.user?.token;
|
|
3570
|
-
e &&
|
|
3597
|
+
e && oi(e, n.authUrl), Pr(), jr(), t.clearAll(), i({
|
|
3571
3598
|
isAuthenticated: !1,
|
|
3572
3599
|
isLoading: !1,
|
|
3573
3600
|
user: null,
|
|
@@ -3581,11 +3608,11 @@ function Ei({ children: e, config: n }) {
|
|
|
3581
3608
|
error: null
|
|
3582
3609
|
}));
|
|
3583
3610
|
try {
|
|
3584
|
-
let n = await
|
|
3611
|
+
let n = await ri(t, await gi({ optionsJSON: await ni(t) }), e);
|
|
3585
3612
|
i({
|
|
3586
3613
|
isAuthenticated: !0,
|
|
3587
3614
|
isLoading: !1,
|
|
3588
|
-
user:
|
|
3615
|
+
user: q(n),
|
|
3589
3616
|
error: null
|
|
3590
3617
|
});
|
|
3591
3618
|
} catch (e) {
|
|
@@ -3612,37 +3639,38 @@ function Ei({ children: e, config: n }) {
|
|
|
3612
3639
|
d,
|
|
3613
3640
|
f
|
|
3614
3641
|
]);
|
|
3615
|
-
return /* @__PURE__ */ P(
|
|
3642
|
+
return /* @__PURE__ */ P(Ti, {
|
|
3616
3643
|
value: g,
|
|
3617
3644
|
children: e
|
|
3618
3645
|
});
|
|
3619
3646
|
}
|
|
3620
|
-
function
|
|
3621
|
-
let e = Oe(
|
|
3647
|
+
function ki() {
|
|
3648
|
+
let e = Oe(Ti);
|
|
3622
3649
|
if (!e) throw Error("useAuth must be used within an AuthProvider");
|
|
3623
3650
|
return e;
|
|
3624
3651
|
}
|
|
3625
|
-
function
|
|
3626
|
-
return Oe(
|
|
3652
|
+
function Ai() {
|
|
3653
|
+
return Oe(Ti);
|
|
3627
3654
|
}
|
|
3628
3655
|
//#endregion
|
|
3629
3656
|
//#region src/auth/oauth-continuation.ts
|
|
3630
|
-
var
|
|
3631
|
-
function
|
|
3657
|
+
var ji = "ikon-oauth", Mi = "ikon-oauth-continue", Ni = "ikon-oauth-continue-attempts", Pi = 5, Fi = 6e5;
|
|
3658
|
+
function Ii() {
|
|
3632
3659
|
if (typeof window > "u") return !1;
|
|
3633
|
-
let e = new URL(window.location.href).searchParams.get(
|
|
3634
|
-
return e ? (
|
|
3660
|
+
let e = new URL(window.location.href).searchParams.get(ji);
|
|
3661
|
+
return e ? (Wi(e), !0) : Ui() !== null;
|
|
3635
3662
|
}
|
|
3636
|
-
function
|
|
3637
|
-
return
|
|
3663
|
+
function Li() {
|
|
3664
|
+
return Ri() !== null;
|
|
3638
3665
|
}
|
|
3639
|
-
function
|
|
3640
|
-
return typeof window > "u" ? null : new URL(window.location.href).searchParams.get("ikon-oauth") ??
|
|
3666
|
+
function Ri() {
|
|
3667
|
+
return typeof window > "u" ? null : new URL(window.location.href).searchParams.get("ikon-oauth") ?? Ui();
|
|
3641
3668
|
}
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
if (!
|
|
3669
|
+
var zi = "You are not allowed to connect an application to this app with this account.";
|
|
3670
|
+
async function Bi(e) {
|
|
3671
|
+
let t = Ri();
|
|
3672
|
+
if (!t) return { status: "pending" };
|
|
3673
|
+
if (!e) return Hi() < Pi ? (console.warn("[ikon] Waiting for the signed-in session before continuing the authorization that sent you here."), { status: "pending" }) : (Gi(), console.warn("[ikon] Gave up continuing the authorization that sent you here: no signed-in session became readable. Start the connection again from the application."), { status: "pending" });
|
|
3646
3674
|
try {
|
|
3647
3675
|
let n = await fetch("/ikon/oauth/continue", {
|
|
3648
3676
|
method: "POST",
|
|
@@ -3652,68 +3680,89 @@ async function Li(e) {
|
|
|
3652
3680
|
},
|
|
3653
3681
|
body: JSON.stringify({ continueId: t })
|
|
3654
3682
|
});
|
|
3655
|
-
if (!n.ok)
|
|
3683
|
+
if (!n.ok) {
|
|
3684
|
+
if (Gi(), n.status === 403) {
|
|
3685
|
+
let e = await Vi(n);
|
|
3686
|
+
return console.warn(`[ikon] The authorization that sent you here was refused: ${e}`), {
|
|
3687
|
+
status: "refused",
|
|
3688
|
+
message: e
|
|
3689
|
+
};
|
|
3690
|
+
}
|
|
3691
|
+
return console.warn(`[ikon] Could not continue the authorization that sent you here (${n.status}). Start the connection again from the application.`), { status: "pending" };
|
|
3692
|
+
}
|
|
3656
3693
|
let { consentUrl: r } = await n.json();
|
|
3657
|
-
return r ? (
|
|
3694
|
+
return r ? (Gi(), window.location.href = r, { status: "handed-off" }) : (Gi(), console.warn("[ikon] The authorization that sent you here returned no consent step. Start the connection again from the application."), { status: "pending" });
|
|
3658
3695
|
} catch {
|
|
3659
|
-
return
|
|
3696
|
+
return { status: "pending" };
|
|
3660
3697
|
}
|
|
3661
3698
|
}
|
|
3662
|
-
function
|
|
3699
|
+
async function Vi(e) {
|
|
3700
|
+
try {
|
|
3701
|
+
let t = await e.json(), n = Array.isArray(t?.message) ? t.message.join(", ") : t?.message;
|
|
3702
|
+
return typeof n == "string" && n.trim().length > 0 ? n : zi;
|
|
3703
|
+
} catch {
|
|
3704
|
+
return zi;
|
|
3705
|
+
}
|
|
3706
|
+
}
|
|
3707
|
+
function Hi() {
|
|
3663
3708
|
try {
|
|
3664
|
-
let e = Number(sessionStorage.getItem(
|
|
3665
|
-
return sessionStorage.setItem(
|
|
3709
|
+
let e = Number(sessionStorage.getItem(Ni) ?? "0") + 1;
|
|
3710
|
+
return sessionStorage.setItem(Ni, String(e)), e;
|
|
3666
3711
|
} catch {
|
|
3667
|
-
return
|
|
3712
|
+
return Pi;
|
|
3668
3713
|
}
|
|
3669
3714
|
}
|
|
3670
|
-
function
|
|
3715
|
+
function Ui() {
|
|
3671
3716
|
try {
|
|
3672
|
-
let e = sessionStorage.getItem(
|
|
3717
|
+
let e = sessionStorage.getItem(Mi);
|
|
3673
3718
|
if (!e) return null;
|
|
3674
3719
|
let { id: t, at: n } = JSON.parse(e);
|
|
3675
|
-
return !t || typeof n != "number" || Date.now() - n >
|
|
3720
|
+
return !t || typeof n != "number" || Date.now() - n > Fi ? (Gi(), null) : t;
|
|
3676
3721
|
} catch {
|
|
3677
|
-
return
|
|
3722
|
+
return Gi(), null;
|
|
3678
3723
|
}
|
|
3679
3724
|
}
|
|
3680
|
-
function
|
|
3725
|
+
function Wi(e) {
|
|
3681
3726
|
try {
|
|
3682
|
-
sessionStorage.setItem(
|
|
3727
|
+
sessionStorage.setItem(Mi, JSON.stringify({
|
|
3683
3728
|
id: e,
|
|
3684
3729
|
at: Date.now()
|
|
3685
3730
|
}));
|
|
3686
3731
|
} catch {}
|
|
3687
3732
|
}
|
|
3688
|
-
function
|
|
3733
|
+
function Gi() {
|
|
3689
3734
|
try {
|
|
3690
|
-
sessionStorage.removeItem(
|
|
3735
|
+
sessionStorage.removeItem(Mi), sessionStorage.removeItem(Ni);
|
|
3691
3736
|
} catch {}
|
|
3692
3737
|
try {
|
|
3693
3738
|
let e = new URL(window.location.href);
|
|
3694
|
-
e.searchParams.has("ikon-oauth") && (e.searchParams.delete(
|
|
3739
|
+
e.searchParams.has("ikon-oauth") && (e.searchParams.delete(ji), window.history.replaceState(null, "", e.toString()));
|
|
3695
3740
|
} catch {}
|
|
3696
3741
|
}
|
|
3697
3742
|
//#endregion
|
|
3698
3743
|
//#region src/auth/use-auth-guard.ts
|
|
3699
|
-
function
|
|
3700
|
-
let { config: t, guestUrlParam: n } = e, { state: r, login: i, getToken: a } =
|
|
3744
|
+
function Ki(e) {
|
|
3745
|
+
let { config: t, guestUrlParam: n } = e, { state: r, login: i, getToken: a } = ki(), o = M(!1), s = M(!1), c = M(null), l = Ae(Ce, T, T), u = l.required;
|
|
3701
3746
|
k(() => {
|
|
3702
|
-
|
|
3747
|
+
Ii() && xe("An application is asking to act as you. Sign in to review what it wants.");
|
|
3703
3748
|
}, []), k(() => {
|
|
3704
|
-
if (!(!
|
|
3705
|
-
if (!
|
|
3706
|
-
re();
|
|
3749
|
+
if (!(!u || !r.isAuthenticated || !r.user || r.user.provider === "anonymous")) {
|
|
3750
|
+
if (!Li()) {
|
|
3751
|
+
c.current || re();
|
|
3707
3752
|
return;
|
|
3708
3753
|
}
|
|
3709
|
-
s.current || (s.current = !0,
|
|
3710
|
-
(e
|
|
3754
|
+
s.current || (s.current = !0, Bi(a()).then((e) => {
|
|
3755
|
+
if (e.status === "refused") {
|
|
3756
|
+
c.current = e.message, xe(e.message);
|
|
3757
|
+
return;
|
|
3758
|
+
}
|
|
3759
|
+
(e.status === "handed-off" || !Li()) && re();
|
|
3711
3760
|
}).finally(() => {
|
|
3712
3761
|
s.current = !1;
|
|
3713
3762
|
}));
|
|
3714
3763
|
}
|
|
3715
3764
|
}, [
|
|
3716
|
-
|
|
3765
|
+
u,
|
|
3717
3766
|
r.isAuthenticated,
|
|
3718
3767
|
r.user,
|
|
3719
3768
|
a
|
|
@@ -3722,7 +3771,7 @@ function Hi(e) {
|
|
|
3722
3771
|
let e = t.methods.includes("global") ? "global" : t.methods.includes("guest") ? "guest" : null;
|
|
3723
3772
|
if (!e) return;
|
|
3724
3773
|
let a = new URLSearchParams(window.location.search), s = a.get(n);
|
|
3725
|
-
if (s === "true" || s === "1" || s === "" ||
|
|
3774
|
+
if (s === "true" || s === "1" || s === "" || Zr()) {
|
|
3726
3775
|
a.delete(n);
|
|
3727
3776
|
let t = a.toString(), r = window.location.pathname + (t ? `?${t}` : "");
|
|
3728
3777
|
window.history.replaceState({}, "", r), o.current = !0, i(e);
|
|
@@ -3734,30 +3783,30 @@ function Hi(e) {
|
|
|
3734
3783
|
t.methods,
|
|
3735
3784
|
i
|
|
3736
3785
|
]);
|
|
3737
|
-
let
|
|
3786
|
+
let d = t.methods.includes("guest") || t.methods.includes("global"), f = r.isAuthenticated && (d || r.user?.provider !== "anonymous"), p = !!t.requireSignIn && !f;
|
|
3738
3787
|
return {
|
|
3739
|
-
shouldRenderChildren: !
|
|
3788
|
+
shouldRenderChildren: !p && !u,
|
|
3740
3789
|
isCheckingAuth: r.isLoading,
|
|
3741
3790
|
isAuthenticated: r.isAuthenticated,
|
|
3742
3791
|
error: r.error,
|
|
3743
|
-
isLoginPrompt:
|
|
3792
|
+
isLoginPrompt: u && !p,
|
|
3744
3793
|
dismissLoginPrompt: re,
|
|
3745
|
-
loginPromptReason:
|
|
3794
|
+
loginPromptReason: u ? l.reason : null
|
|
3746
3795
|
};
|
|
3747
3796
|
}
|
|
3748
3797
|
//#endregion
|
|
3749
3798
|
//#region src/debug/debug-overlay.tsx
|
|
3750
|
-
var
|
|
3799
|
+
var qi = (() => {
|
|
3751
3800
|
try {
|
|
3752
3801
|
return w();
|
|
3753
3802
|
} catch {
|
|
3754
3803
|
return !1;
|
|
3755
3804
|
}
|
|
3756
|
-
})(),
|
|
3757
|
-
function
|
|
3758
|
-
|
|
3805
|
+
})(), Ji = Date.now(), Q = [], Yi = 300;
|
|
3806
|
+
function Xi(e) {
|
|
3807
|
+
Q.push(`[+${((Date.now() - Ji) / 1e3).toFixed(1)}s] ${e}`), Q.length > Yi && Q.shift();
|
|
3759
3808
|
}
|
|
3760
|
-
function
|
|
3809
|
+
function Zi(e) {
|
|
3761
3810
|
if (typeof e == "string") return e;
|
|
3762
3811
|
if (e instanceof Error) return `${e.name}: ${e.message}`;
|
|
3763
3812
|
try {
|
|
@@ -3766,10 +3815,10 @@ function qi(e) {
|
|
|
3766
3815
|
return String(e);
|
|
3767
3816
|
}
|
|
3768
3817
|
}
|
|
3769
|
-
var
|
|
3770
|
-
function
|
|
3771
|
-
if (
|
|
3772
|
-
|
|
3818
|
+
var Qi = !1;
|
|
3819
|
+
function $i() {
|
|
3820
|
+
if (Qi || typeof window > "u") return;
|
|
3821
|
+
Qi = !0, window.addEventListener("error", (e) => Xi(`window.error: ${e.message} @ ${e.filename ?? "?"}:${e.lineno ?? "?"}:${e.colno ?? "?"}`)), window.addEventListener("unhandledrejection", (e) => Xi(`unhandledRejection: ${Zi(e.reason)}`));
|
|
3773
3822
|
let e = console;
|
|
3774
3823
|
for (let t of [
|
|
3775
3824
|
"error",
|
|
@@ -3780,17 +3829,17 @@ function Yi() {
|
|
|
3780
3829
|
let n = e[t]?.bind(console) ?? (() => void 0);
|
|
3781
3830
|
e[t] = (...e) => {
|
|
3782
3831
|
try {
|
|
3783
|
-
|
|
3832
|
+
Xi(`console.${t}: ${e.map(Zi).join(" ")}`);
|
|
3784
3833
|
} catch {}
|
|
3785
3834
|
n(...e);
|
|
3786
3835
|
};
|
|
3787
3836
|
}
|
|
3788
3837
|
try {
|
|
3789
|
-
we((e) =>
|
|
3838
|
+
we((e) => Xi(`${e.levelName} [${e.component}] ${e.message}`), { minLevel: v.DEBUG });
|
|
3790
3839
|
} catch {}
|
|
3791
3840
|
}
|
|
3792
|
-
|
|
3793
|
-
function
|
|
3841
|
+
qi && $i();
|
|
3842
|
+
function ea() {
|
|
3794
3843
|
let e = !1;
|
|
3795
3844
|
try {
|
|
3796
3845
|
let t = URL.createObjectURL(new Blob([""]));
|
|
@@ -3800,11 +3849,11 @@ function Xi() {
|
|
|
3800
3849
|
} catch {}
|
|
3801
3850
|
return e;
|
|
3802
3851
|
}
|
|
3803
|
-
function
|
|
3852
|
+
function ta() {
|
|
3804
3853
|
let e = globalThis;
|
|
3805
3854
|
return [
|
|
3806
3855
|
`Worker=${typeof Worker < "u"}`,
|
|
3807
|
-
`moduleWorker=${
|
|
3856
|
+
`moduleWorker=${ea()}`,
|
|
3808
3857
|
`WebSocket=${typeof WebSocket < "u"}`,
|
|
3809
3858
|
`WebTransport=${e.WebTransport !== void 0}`,
|
|
3810
3859
|
`RTCPeerConnection=${typeof RTCPeerConnection < "u"}`,
|
|
@@ -3817,14 +3866,14 @@ function Zi() {
|
|
|
3817
3866
|
`online=${typeof navigator < "u" ? navigator.onLine : "?"}`
|
|
3818
3867
|
].join(" ");
|
|
3819
3868
|
}
|
|
3820
|
-
function
|
|
3869
|
+
function na(e) {
|
|
3821
3870
|
return /ERROR|error:|Rejection/.test(e) ? "#f88" : /WARN|warn:/.test(e) ? "#fc6" : "#9d9";
|
|
3822
3871
|
}
|
|
3823
|
-
function
|
|
3824
|
-
let n =
|
|
3872
|
+
function ra({ state: e = "", forceVisible: t = !1 }) {
|
|
3873
|
+
let n = qi || t, r = e === "connected" || e === "reconnecting", [, i] = ke((e) => e + 1, 0), [a, o] = N(!0);
|
|
3825
3874
|
return k(() => {
|
|
3826
3875
|
if (!n) return;
|
|
3827
|
-
|
|
3876
|
+
$i();
|
|
3828
3877
|
let e = setInterval(i, 1e3);
|
|
3829
3878
|
return () => clearInterval(e);
|
|
3830
3879
|
}, [n]), n ? r && a ? /* @__PURE__ */ F("button", {
|
|
@@ -3844,7 +3893,7 @@ function $i({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3844
3893
|
},
|
|
3845
3894
|
children: [
|
|
3846
3895
|
"🐞 debug (",
|
|
3847
|
-
|
|
3896
|
+
Q.length,
|
|
3848
3897
|
")"
|
|
3849
3898
|
]
|
|
3850
3899
|
}) : /* @__PURE__ */ F("div", {
|
|
@@ -3878,9 +3927,9 @@ function $i({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3878
3927
|
"Ikon debug overlay — state: ",
|
|
3879
3928
|
e || "?",
|
|
3880
3929
|
", +",
|
|
3881
|
-
Math.round((Date.now() -
|
|
3930
|
+
Math.round((Date.now() - Ji) / 1e3),
|
|
3882
3931
|
"s, ",
|
|
3883
|
-
|
|
3932
|
+
Q.length,
|
|
3884
3933
|
" entries",
|
|
3885
3934
|
r && /* @__PURE__ */ P("button", {
|
|
3886
3935
|
type: "button",
|
|
@@ -3919,7 +3968,7 @@ function $i({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3919
3968
|
color: "#8cf",
|
|
3920
3969
|
marginBottom: "4px"
|
|
3921
3970
|
},
|
|
3922
|
-
children:
|
|
3971
|
+
children: ta()
|
|
3923
3972
|
}),
|
|
3924
3973
|
/* @__PURE__ */ P("div", {
|
|
3925
3974
|
style: {
|
|
@@ -3928,9 +3977,9 @@ function $i({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3928
3977
|
},
|
|
3929
3978
|
children: typeof window < "u" ? `viewport=${window.innerWidth}x${window.innerHeight} dpr=${window.devicePixelRatio}` : ""
|
|
3930
3979
|
}),
|
|
3931
|
-
/* @__PURE__ */ P("div", { children:
|
|
3980
|
+
/* @__PURE__ */ P("div", { children: Q.length === 0 ? "(nothing captured yet)" : Q.map((e, t) => /* @__PURE__ */ P("div", {
|
|
3932
3981
|
style: {
|
|
3933
|
-
color:
|
|
3982
|
+
color: na(e),
|
|
3934
3983
|
wordBreak: "break-all"
|
|
3935
3984
|
},
|
|
3936
3985
|
children: e
|
|
@@ -3940,7 +3989,7 @@ function $i({ state: e = "", forceVisible: t = !1 }) {
|
|
|
3940
3989
|
}
|
|
3941
3990
|
//#endregion
|
|
3942
3991
|
//#region src/app/connection-state-renderer.tsx
|
|
3943
|
-
function
|
|
3992
|
+
function ia({ 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 }) {
|
|
3944
3993
|
let m = M(!1), h = (() => {
|
|
3945
3994
|
switch (e) {
|
|
3946
3995
|
case "waitingForExternalConnectUrl":
|
|
@@ -3966,33 +4015,33 @@ function ea({ connectionState: e, error: t, isReady: n, isConnectingSlow: r, sto
|
|
|
3966
4015
|
default: return null;
|
|
3967
4016
|
}
|
|
3968
4017
|
})();
|
|
3969
|
-
return /* @__PURE__ */ F(je, { children: [h, /* @__PURE__ */ P(
|
|
4018
|
+
return /* @__PURE__ */ F(je, { children: [h, /* @__PURE__ */ P(ra, { state: e })] });
|
|
3970
4019
|
}
|
|
3971
4020
|
//#endregion
|
|
3972
4021
|
//#region src/app/boot-snapshot-variant.ts
|
|
3973
|
-
function
|
|
4022
|
+
function aa(e, t) {
|
|
3974
4023
|
return e === !1 ? !1 : t ? "signed-in" : "guest";
|
|
3975
4024
|
}
|
|
3976
4025
|
//#endregion
|
|
3977
4026
|
//#region src/app/use-ikon-app.ts
|
|
3978
|
-
var
|
|
3979
|
-
function
|
|
4027
|
+
var oa = S("useIkonApp");
|
|
4028
|
+
function sa() {
|
|
3980
4029
|
if (typeof window < "u" && window.__IKON_AUTH_CONFIG__) return window.__IKON_AUTH_CONFIG__;
|
|
3981
4030
|
}
|
|
3982
|
-
function
|
|
4031
|
+
function ca() {
|
|
3983
4032
|
if (typeof window < "u" && window.__IKON_LOCAL_IKON_SERVER_CONFIG__) return window.__IKON_LOCAL_IKON_SERVER_CONFIG__;
|
|
3984
4033
|
}
|
|
3985
|
-
function
|
|
4034
|
+
function la(e, t) {
|
|
3986
4035
|
return {
|
|
3987
4036
|
...e,
|
|
3988
4037
|
...t ?? {}
|
|
3989
4038
|
};
|
|
3990
4039
|
}
|
|
3991
|
-
function
|
|
4040
|
+
function ua(e) {
|
|
3992
4041
|
return e?.token ? `${e.provider}:${se(e.token) ?? e.token}` : null;
|
|
3993
4042
|
}
|
|
3994
|
-
function
|
|
3995
|
-
let { authConfig: n, modules: r, parameters: f, timeouts: p, backgroundAudio: m, webRtc: h, audio: g, video: v, websocket: x, webtransport: ne, httpstream: re, proxy: S, liveSnapshot: ie, bootSnapshot: oe } = e, w = n === void 0 ?
|
|
4043
|
+
function da(e) {
|
|
4044
|
+
let { authConfig: n, modules: r, parameters: f, timeouts: p, backgroundAudio: m, webRtc: h, audio: g, video: v, websocket: x, webtransport: ne, httpstream: re, proxy: S, liveSnapshot: ie, bootSnapshot: oe } = e, w = n === void 0 ? sa() ?? null : n, ce = ca(), T = Ai(), le = !!T && T.state.isLoading, E = M(null), ue = M(null), de = M(null), pe = M(!1), me = M(!1), he = M(m), ge = M(p), ve = M(h), be = M(g), xe = M(v), Se = M(x), Ce = M(ne), we = M(re), Te = M(S), Ee = M(ie), De = M(oe), D = M("local"), Oe = M(void 0);
|
|
3996
4045
|
he.current = m, ge.current = p, ve.current = h, be.current = g, xe.current = v, Se.current = x, Ce.current = ne, we.current = re, Te.current = S, Ee.current = ie, De.current = oe;
|
|
3997
4046
|
let [A, ke] = N("connecting"), [Ae, je] = N(!1), [P, F] = N(!1), [Me, I] = N(null), [Ne, Pe] = N(null), [Fe, Ie] = N(!1), [Le, Re] = N(!1), [ze, Be] = N(!1), [Ve, He] = N(null), [L, Ue] = N(null), [We, Ge] = N(!1), Ke = M(!1), [qe, Je] = N(0), [Ye, Xe] = N(0), R = j(() => {
|
|
3998
4047
|
try {
|
|
@@ -4000,7 +4049,7 @@ function sa(e) {
|
|
|
4000
4049
|
} catch {
|
|
4001
4050
|
return { parameters: {} };
|
|
4002
4051
|
}
|
|
4003
|
-
}, []), Ze = JSON.stringify(f ?? {}), z = j(() =>
|
|
4052
|
+
}, []), Ze = JSON.stringify(f ?? {}), z = j(() => la(R.parameters, f), [R.parameters, Ze]), $e = (w?.methods?.length ?? 0) > 0, B = aa(oe, $e && Nr());
|
|
4004
4053
|
B !== !1 && !i() && a(B);
|
|
4005
4054
|
let V = j(() => {
|
|
4006
4055
|
if (!w?.spaceId) return null;
|
|
@@ -4009,7 +4058,7 @@ function sa(e) {
|
|
|
4009
4058
|
token: e.token,
|
|
4010
4059
|
provider: e.provider,
|
|
4011
4060
|
authenticatedAt: e.authenticatedAt
|
|
4012
|
-
} :
|
|
4061
|
+
} : Er();
|
|
4013
4062
|
}, [
|
|
4014
4063
|
w?.spaceId,
|
|
4015
4064
|
qe,
|
|
@@ -4017,12 +4066,12 @@ function sa(e) {
|
|
|
4017
4066
|
T?.state.isAuthenticated,
|
|
4018
4067
|
T?.state.user?.token
|
|
4019
4068
|
]), H = ce?.enabled ?? !1, et = ce?.host ?? l, tt = ce?.port ?? u, nt = !le && !!w && !V && !w.requireSignIn && !!w.spaceId && (fe() || H);
|
|
4020
|
-
nt && !L && !We && !Ke.current && (Ke.current = !0, C(w.authUrl).then((e) =>
|
|
4069
|
+
nt && !L && !We && !Ke.current && (Ke.current = !0, C(w.authUrl).then((e) => Ur(w.spaceId, e)).then((e) => {
|
|
4021
4070
|
Ue(e.token), Ge(!0);
|
|
4022
4071
|
}).catch((e) => {
|
|
4023
|
-
|
|
4072
|
+
oa.error("Anonymous auth failed:", e), Ke.current = !1, H ? Ge(!0) : I(e instanceof Error ? e.message : "Anonymous auth failed");
|
|
4024
4073
|
}));
|
|
4025
|
-
let rt =
|
|
4074
|
+
let rt = ua(V), U = M(void 0);
|
|
4026
4075
|
U.current = V?.token ?? void 0;
|
|
4027
4076
|
let it = j(() => {
|
|
4028
4077
|
if (le) return null;
|
|
@@ -4076,13 +4125,13 @@ function sa(e) {
|
|
|
4076
4125
|
R.sessionIdentityHash,
|
|
4077
4126
|
z
|
|
4078
4127
|
]);
|
|
4079
|
-
D.current = w?.spaceId ?? "local", Oe.current = V?.token ?? L ?? void 0,
|
|
4080
|
-
let at =
|
|
4128
|
+
D.current = w?.spaceId ?? "local", Oe.current = V?.token ?? L ?? void 0, Tn(Ve);
|
|
4129
|
+
let at = Dn(Ve);
|
|
4081
4130
|
k(() => {
|
|
4082
4131
|
if (!pe.current) {
|
|
4083
|
-
if (pe.current = !0, de.current =
|
|
4132
|
+
if (pe.current = !0, de.current = dn(), r) for (let e of r) e(de.current);
|
|
4084
4133
|
de.current.loadRegisteredModules().catch((e) => {
|
|
4085
|
-
|
|
4134
|
+
oa.error("Failed to load UI modules", e);
|
|
4086
4135
|
});
|
|
4087
4136
|
}
|
|
4088
4137
|
}, []), k(() => {
|
|
@@ -4119,17 +4168,17 @@ function sa(e) {
|
|
|
4119
4168
|
enabled: !0,
|
|
4120
4169
|
appId: D.current,
|
|
4121
4170
|
userId: i
|
|
4122
|
-
} : void 0, l = V != null && V.provider !== "anonymous", u = $e && (l ||
|
|
4171
|
+
} : void 0, l = V != null && V.provider !== "anonymous", u = $e && (l || Nr()), d = new Qe({
|
|
4123
4172
|
client: e,
|
|
4124
4173
|
liveSnapshot: a,
|
|
4125
|
-
bootSnapshot:
|
|
4174
|
+
bootSnapshot: aa(De.current, u)
|
|
4126
4175
|
});
|
|
4127
4176
|
ue.current = d, He(d), F(!1);
|
|
4128
4177
|
let f = d.subscribeToUiUpdates(() => {
|
|
4129
4178
|
F(!0), ye();
|
|
4130
4179
|
});
|
|
4131
4180
|
return e.connect().catch((e) => {
|
|
4132
|
-
if (
|
|
4181
|
+
if (oa.error("Connection failed:", e), e instanceof o) {
|
|
4133
4182
|
Pe(e.reason);
|
|
4134
4183
|
return;
|
|
4135
4184
|
}
|
|
@@ -4146,7 +4195,7 @@ function sa(e) {
|
|
|
4146
4195
|
Be(!0);
|
|
4147
4196
|
return;
|
|
4148
4197
|
}
|
|
4149
|
-
e instanceof y || e instanceof c && !me.current && (me.current = !0,
|
|
4198
|
+
e instanceof y || e instanceof c && !me.current && (me.current = !0, oa.warn("Auth session appears stale, clearing and retrying"), t.clearAll(), T ? T.logout() : (Pr(), Je((e) => e + 1)));
|
|
4150
4199
|
}
|
|
4151
4200
|
}), () => {
|
|
4152
4201
|
f(), e.disconnect(), E.current = null, d.dispose(), ue.current = null;
|
|
@@ -4161,22 +4210,22 @@ function sa(e) {
|
|
|
4161
4210
|
t.updateAuthToken(e);
|
|
4162
4211
|
}
|
|
4163
4212
|
}, [V?.token]);
|
|
4164
|
-
let ot = O((e, t) => {
|
|
4165
|
-
let
|
|
4166
|
-
E.current?.sendActionCall(e, n);
|
|
4213
|
+
let ot = O((e, t, n) => {
|
|
4214
|
+
let r = typeof t == "string" ? t : JSON.stringify(t ?? {});
|
|
4215
|
+
E.current?.sendActionCall(e, r, n);
|
|
4167
4216
|
}, []);
|
|
4168
4217
|
k(() => {
|
|
4169
|
-
if (A !== "connecting") {
|
|
4218
|
+
if (A !== "connecting" && A !== "waitingForExternalConnectUrl") {
|
|
4170
4219
|
je(!1);
|
|
4171
4220
|
return;
|
|
4172
4221
|
}
|
|
4173
4222
|
let e = E.current?.slowConnectionThresholdMs ?? d, t = setTimeout(() => je(!0), e);
|
|
4174
4223
|
return () => clearTimeout(t);
|
|
4175
4224
|
}, [A]);
|
|
4176
|
-
let st = A === "connected" || A === "reconnecting",
|
|
4225
|
+
let st = A === "connected" || A === "reconnecting", ct = P && A !== "offline";
|
|
4177
4226
|
return k(() => {
|
|
4178
|
-
typeof document > "u" || (document.documentElement.dataset.ikonLive = String(
|
|
4179
|
-
}, [
|
|
4227
|
+
typeof document > "u" || (document.documentElement.dataset.ikonLive = String(ct));
|
|
4228
|
+
}, [ct]), {
|
|
4180
4229
|
connectionState: A,
|
|
4181
4230
|
error: Me,
|
|
4182
4231
|
accessDeniedReason: Ne,
|
|
@@ -4191,7 +4240,7 @@ function sa(e) {
|
|
|
4191
4240
|
registryRef: de,
|
|
4192
4241
|
onAction: ot,
|
|
4193
4242
|
isReady: st,
|
|
4194
|
-
isLive:
|
|
4243
|
+
isLive: ct,
|
|
4195
4244
|
brandingRequired: E.current?.brandingRequired ?? !1,
|
|
4196
4245
|
isConnectingSlow: Ae,
|
|
4197
4246
|
webRtcVideoStreams: E.current?.webRtcVideoStreams ?? /* @__PURE__ */ new Map(),
|
|
@@ -4200,8 +4249,8 @@ function sa(e) {
|
|
|
4200
4249
|
}
|
|
4201
4250
|
//#endregion
|
|
4202
4251
|
//#region src/hooks/use-toasts.ts
|
|
4203
|
-
var
|
|
4204
|
-
function
|
|
4252
|
+
var fa = 0;
|
|
4253
|
+
function pa(e = 5, t = 5e3) {
|
|
4205
4254
|
let [n, r] = N([]), i = M(/* @__PURE__ */ new Map()), a = O((e) => {
|
|
4206
4255
|
let t = i.current.get(e);
|
|
4207
4256
|
t && (clearTimeout(t), i.current.delete(e)), r((t) => t.filter((t) => t.id !== e));
|
|
@@ -4209,7 +4258,7 @@ function la(e = 5, t = 5e3) {
|
|
|
4209
4258
|
return k(() => {
|
|
4210
4259
|
let n = i.current, o = we((i) => {
|
|
4211
4260
|
if (!pe()) return;
|
|
4212
|
-
let o = `toast-${++
|
|
4261
|
+
let o = `toast-${++fa}`, s = {
|
|
4213
4262
|
id: o,
|
|
4214
4263
|
level: i.level === v.ERROR ? "error" : "warn",
|
|
4215
4264
|
message: i.message,
|
|
@@ -4237,7 +4286,7 @@ function la(e = 5, t = 5e3) {
|
|
|
4237
4286
|
}
|
|
4238
4287
|
//#endregion
|
|
4239
4288
|
//#region src/hooks/use-ikon-reactive.ts
|
|
4240
|
-
function
|
|
4289
|
+
function ma(e, t, n) {
|
|
4241
4290
|
let [r, i] = N(n);
|
|
4242
4291
|
return k(() => {
|
|
4243
4292
|
if (!e) return;
|
|
@@ -4255,7 +4304,7 @@ function ua(e, t, n) {
|
|
|
4255
4304
|
}
|
|
4256
4305
|
//#endregion
|
|
4257
4306
|
//#region src/hooks/use-reactive.ts
|
|
4258
|
-
function
|
|
4307
|
+
function ha(e, t, n) {
|
|
4259
4308
|
let [r, i] = N(null);
|
|
4260
4309
|
return k(() => {
|
|
4261
4310
|
if (!e) return;
|
|
@@ -4267,48 +4316,48 @@ function da(e, t, n) {
|
|
|
4267
4316
|
}), () => {
|
|
4268
4317
|
n = !1;
|
|
4269
4318
|
};
|
|
4270
|
-
}, [e, t]),
|
|
4319
|
+
}, [e, t]), ma(r ? e : null, r ?? "", n);
|
|
4271
4320
|
}
|
|
4272
4321
|
//#endregion
|
|
4273
4322
|
//#region src/app/use-ikon-debug.ts
|
|
4274
|
-
var
|
|
4323
|
+
var $ = S("IkonDebug"), ga = {
|
|
4275
4324
|
Digit1: "connecting",
|
|
4276
4325
|
Digit2: "connected",
|
|
4277
4326
|
Digit3: "reconnecting",
|
|
4278
4327
|
Digit4: "offline",
|
|
4279
4328
|
Digit5: "offline",
|
|
4280
4329
|
Digit0: "clear"
|
|
4281
|
-
},
|
|
4282
|
-
function
|
|
4330
|
+
}, _a = "Digit5", va = "Digit6", ya = "Synthetic debug error (Ctrl+Shift+5)", ba = "Synthetic debug access-denied (Ctrl+Shift+6)", xa = 5e3;
|
|
4331
|
+
function Sa(e) {
|
|
4283
4332
|
let t = pe(), [n, r] = N(null), [i, a] = N(!1), [o, s] = N(null), [c, l] = N(null), [u, d] = N(!1), [f, p] = N(!1), [m, h] = N(!1);
|
|
4284
4333
|
return k(() => {
|
|
4285
4334
|
if (!t) return;
|
|
4286
4335
|
let e = (e) => {
|
|
4287
4336
|
if (!e.ctrlKey || !e.shiftKey) return;
|
|
4288
4337
|
if (e.code === "KeyE") {
|
|
4289
|
-
e.preventDefault(), d((e) => (
|
|
4338
|
+
e.preventDefault(), d((e) => ($.warn(`Empty-stores override: ${e ? "off" : "on"}`), !e));
|
|
4290
4339
|
return;
|
|
4291
4340
|
}
|
|
4292
4341
|
if (e.code === "Digit7") {
|
|
4293
|
-
e.preventDefault(), p((e) => (
|
|
4342
|
+
e.preventDefault(), p((e) => ($.warn(`Branding-banner override: ${e ? "off" : "on"}`), !e));
|
|
4294
4343
|
return;
|
|
4295
4344
|
}
|
|
4296
4345
|
if (e.code === "Digit8") {
|
|
4297
|
-
e.preventDefault(), h((e) => (
|
|
4346
|
+
e.preventDefault(), h((e) => ($.warn(`Debug-overlay override: ${e ? "off" : "on"}`), !e));
|
|
4298
4347
|
return;
|
|
4299
4348
|
}
|
|
4300
|
-
if (e.code ===
|
|
4301
|
-
e.preventDefault(), l(
|
|
4349
|
+
if (e.code === va) {
|
|
4350
|
+
e.preventDefault(), l(ba), r(null), s(null), $.warn("Forced access denied");
|
|
4302
4351
|
return;
|
|
4303
4352
|
}
|
|
4304
|
-
let t =
|
|
4353
|
+
let t = ga[e.code];
|
|
4305
4354
|
if (t === void 0) return;
|
|
4306
4355
|
if (e.preventDefault(), t === "clear") {
|
|
4307
|
-
r(null), s(null), l(null),
|
|
4356
|
+
r(null), s(null), l(null), $.warn("Cleared forced state");
|
|
4308
4357
|
return;
|
|
4309
4358
|
}
|
|
4310
|
-
let n = e.code ===
|
|
4311
|
-
r(t), s(n ?
|
|
4359
|
+
let n = e.code === _a;
|
|
4360
|
+
r(t), s(n ? ya : null), l(null), $.warn(`Forced state: ${t}${n ? " (with error)" : ""}`);
|
|
4312
4361
|
};
|
|
4313
4362
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
4314
4363
|
}, [t]), k(() => {
|
|
@@ -4316,7 +4365,7 @@ function ya(e) {
|
|
|
4316
4365
|
a(!1);
|
|
4317
4366
|
return;
|
|
4318
4367
|
}
|
|
4319
|
-
let e = setTimeout(() => a(!0),
|
|
4368
|
+
let e = setTimeout(() => a(!0), xa);
|
|
4320
4369
|
return () => clearTimeout(e);
|
|
4321
4370
|
}, [n]), !t || n === null && !u && c === null && !f && !m ? {
|
|
4322
4371
|
app: e,
|
|
@@ -4347,20 +4396,20 @@ function ya(e) {
|
|
|
4347
4396
|
}
|
|
4348
4397
|
//#endregion
|
|
4349
4398
|
//#region src/app/ikon-app.tsx
|
|
4350
|
-
function
|
|
4399
|
+
function Ca(e, t) {
|
|
4351
4400
|
return e === void 0 ? null : typeof e == "function" ? e(t) : e;
|
|
4352
4401
|
}
|
|
4353
|
-
function
|
|
4402
|
+
function wa(e) {
|
|
4354
4403
|
return e === void 0 ? null : typeof e == "function" ? e() : e;
|
|
4355
4404
|
}
|
|
4356
|
-
function
|
|
4405
|
+
function Ta(e, t) {
|
|
4357
4406
|
return e === void 0 ? null : typeof e == "function" ? e(t) : e;
|
|
4358
4407
|
}
|
|
4359
|
-
function
|
|
4408
|
+
function Ea(e, t) {
|
|
4360
4409
|
return e === void 0 ? null : typeof e == "function" ? e(t) : e;
|
|
4361
4410
|
}
|
|
4362
|
-
function
|
|
4363
|
-
let { connectingOverlay: t, reconnectingOverlay: n, offlineOverlay: r, accessDeniedScreen: i, ...a } = e, o =
|
|
4411
|
+
function Da(e) {
|
|
4412
|
+
let { connectingOverlay: t, reconnectingOverlay: n, offlineOverlay: r, accessDeniedScreen: i, ...a } = e, o = Sa(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 = M(null);
|
|
4364
4413
|
u && d && (m || u.size > 0) && (y.current = {
|
|
4365
4414
|
stores: u,
|
|
4366
4415
|
registry: d,
|
|
@@ -4369,18 +4418,18 @@ function wa(e) {
|
|
|
4369
4418
|
let ee = y.current != null || !!g;
|
|
4370
4419
|
if (A(() => {
|
|
4371
4420
|
!ee || typeof document > "u" || document.querySelectorAll("[data-ikon-prerender]").forEach((e) => e.remove());
|
|
4372
|
-
}, [ee]), g) return
|
|
4421
|
+
}, [ee]), g) return Ea(i, g);
|
|
4373
4422
|
let te = y.current, b;
|
|
4374
4423
|
switch (c) {
|
|
4375
4424
|
case "waitingForExternalConnectUrl":
|
|
4376
4425
|
case "connecting":
|
|
4377
|
-
b =
|
|
4426
|
+
b = Ca(t, l);
|
|
4378
4427
|
break;
|
|
4379
4428
|
case "reconnecting":
|
|
4380
|
-
b =
|
|
4429
|
+
b = wa(n);
|
|
4381
4430
|
break;
|
|
4382
4431
|
case "offline":
|
|
4383
|
-
b =
|
|
4432
|
+
b = Ta(r, h);
|
|
4384
4433
|
break;
|
|
4385
4434
|
default: b = null;
|
|
4386
4435
|
}
|
|
@@ -4392,19 +4441,19 @@ function wa(e) {
|
|
|
4392
4441
|
onAction: p
|
|
4393
4442
|
}),
|
|
4394
4443
|
b,
|
|
4395
|
-
v && /* @__PURE__ */ P(
|
|
4396
|
-
/* @__PURE__ */ P(
|
|
4397
|
-
/* @__PURE__ */ P(
|
|
4444
|
+
v && /* @__PURE__ */ P(ka, {}),
|
|
4445
|
+
/* @__PURE__ */ P(Aa, {}),
|
|
4446
|
+
/* @__PURE__ */ P(ra, {
|
|
4398
4447
|
state: c,
|
|
4399
4448
|
forceVisible: o.forcedDebugOverlay
|
|
4400
4449
|
})
|
|
4401
4450
|
] });
|
|
4402
4451
|
}
|
|
4403
|
-
var
|
|
4404
|
-
function
|
|
4452
|
+
var Oa = "https://ikonai.com";
|
|
4453
|
+
function ka() {
|
|
4405
4454
|
return /* @__PURE__ */ F("a", {
|
|
4406
4455
|
className: "ikon-branding-banner",
|
|
4407
|
-
href:
|
|
4456
|
+
href: Oa,
|
|
4408
4457
|
target: "_blank",
|
|
4409
4458
|
rel: "noopener noreferrer",
|
|
4410
4459
|
style: {
|
|
@@ -4434,17 +4483,17 @@ function Ea() {
|
|
|
4434
4483
|
})]
|
|
4435
4484
|
});
|
|
4436
4485
|
}
|
|
4437
|
-
function
|
|
4438
|
-
let { toasts: e, dismissToast: t } =
|
|
4486
|
+
function Aa() {
|
|
4487
|
+
let { toasts: e, dismissToast: t } = pa();
|
|
4439
4488
|
return e.length === 0 ? null : /* @__PURE__ */ P("div", {
|
|
4440
4489
|
className: "ikon-toast-overlay",
|
|
4441
|
-
children: e.map((e) => /* @__PURE__ */ P(
|
|
4490
|
+
children: e.map((e) => /* @__PURE__ */ P(ja, {
|
|
4442
4491
|
toast: e,
|
|
4443
4492
|
onDismiss: t
|
|
4444
4493
|
}, e.id))
|
|
4445
4494
|
});
|
|
4446
4495
|
}
|
|
4447
|
-
function
|
|
4496
|
+
function ja({ toast: e, onDismiss: t }) {
|
|
4448
4497
|
return /* @__PURE__ */ F("div", {
|
|
4449
4498
|
className: `ikon-toast-overlay-chip ikon-toast-overlay-chip--${e.level}`,
|
|
4450
4499
|
onClick: () => t(e.id),
|
|
@@ -4470,7 +4519,7 @@ function Oa({ toast: e, onDismiss: t }) {
|
|
|
4470
4519
|
}
|
|
4471
4520
|
//#endregion
|
|
4472
4521
|
//#region src/app/connection-recovery.ts
|
|
4473
|
-
function
|
|
4522
|
+
function Ma({ isSessionExpired: e }) {
|
|
4474
4523
|
if (e) {
|
|
4475
4524
|
let e = de();
|
|
4476
4525
|
if (e) return {
|
|
@@ -4489,37 +4538,37 @@ function ka({ isSessionExpired: e }) {
|
|
|
4489
4538
|
}
|
|
4490
4539
|
//#endregion
|
|
4491
4540
|
//#region src/i18n/i18n.tsx
|
|
4492
|
-
var
|
|
4493
|
-
function
|
|
4541
|
+
var Na = De(null);
|
|
4542
|
+
function Pa(e, t) {
|
|
4494
4543
|
return t ? e.replace(/\{(\w+)\}/g, (e, n) => t[n] ?? `{${n}}`) : e;
|
|
4495
4544
|
}
|
|
4496
|
-
function
|
|
4545
|
+
function Fa(e, t) {
|
|
4497
4546
|
let n = ce();
|
|
4498
4547
|
if (n && e.includes(n)) return n;
|
|
4499
4548
|
let r = navigator.language.split("-")[0];
|
|
4500
4549
|
return e.includes(r) ? r : t && e.includes(t) ? t : "en";
|
|
4501
4550
|
}
|
|
4502
|
-
function
|
|
4503
|
-
return t ?
|
|
4551
|
+
function Ia(e, t, n) {
|
|
4552
|
+
return t ? Fa(e, n) : n && e.includes(n) ? n : "en";
|
|
4504
4553
|
}
|
|
4505
|
-
function
|
|
4506
|
-
let i =
|
|
4554
|
+
function La({ children: e, translations: t, defaultLanguage: n, detectLanguage: r = !1 }) {
|
|
4555
|
+
let i = Ia(Object.keys(t), r, n), a = t[i] ?? t.en, o = j(() => ({
|
|
4507
4556
|
t: (e, t) => {
|
|
4508
4557
|
let n = a[e];
|
|
4509
|
-
return
|
|
4558
|
+
return Pa(n, t);
|
|
4510
4559
|
},
|
|
4511
4560
|
locale: i,
|
|
4512
4561
|
translations: a
|
|
4513
4562
|
}), [a, i]);
|
|
4514
|
-
return /* @__PURE__ */ P(
|
|
4563
|
+
return /* @__PURE__ */ P(Na, {
|
|
4515
4564
|
value: o,
|
|
4516
4565
|
children: e
|
|
4517
4566
|
});
|
|
4518
4567
|
}
|
|
4519
|
-
function
|
|
4520
|
-
let e = Oe(
|
|
4568
|
+
function Ra() {
|
|
4569
|
+
let e = Oe(Na);
|
|
4521
4570
|
if (!e) throw Error("useI18n must be used within an I18nProvider");
|
|
4522
4571
|
return e;
|
|
4523
4572
|
}
|
|
4524
4573
|
//#endregion
|
|
4525
|
-
export {
|
|
4574
|
+
export { Oi as AuthProvider, ia as ConnectionStateRenderer, qi as DEBUG_OVERLAY_ENABLED, ra as DebugOverlay, La as I18nProvider, xt as IKON_UI_BASE_MODULE, Vt as IKON_UI_MEDIA_MODULE, on as IKON_UI_SHADERTOY_MODULE, rn as IKON_UI_SHADERTOY_TYPE, R as IKON_UI_STREAM_CATEGORY, Ft as IKON_UI_VIDEO_CANVAS_TYPE, It as IKON_UI_VIDEO_URL_PLAYER_TYPE, Da as IkonApp, Qe as IkonUi, un as IkonUiRegistry, z as IkonUiSurface, Ye as InspectOverlay, hn as ParallaxView, Ke as UiComponentRegistry, Ge as UiRenderer, n as UiStreamStore, At as VideoStreamView, Ur as authenticateAnonymous, ti as buildOAuthRedirectUrl, Pr as clearAuthSession, ei as clearOAuthParams, bt as createBaseResolvers, qe as createComponentLibrary, dn as createIkonUiRegistry, Rt as createMediaResolvers, an as createShadertoyRendererResolver, Ma as getConnectionRecovery, Ze as isIkonUiCategoryMatch, Er as loadAuthSession, St as loadBaseModule, Ht as loadMediaModule, sn as loadShadertoyModule, Kr as parseOAuthCallback, Xr as parseOAuthError, ve as randomUuid, Ct as registerBaseModule, Ut as registerMediaModule, cn as registerShadertoyModule, Ue as renderChildren, zn as renderMotionLetters, K as saveAuthSession, Wr as sendLoginCode, q as sessionToUser, ki as useAuth, Ki as useAuthGuard, Ai as useAuthOptional, Mn as useCameraCapture, Ra as useI18n, da as useIkonApp, Sa as useIkonDebug, ma as useIkonReactive, Tn as useIkonStyles, Dn as useIkonUiStores, jn as useMicrophoneCapture, ha as useReactive, Nn as useScreenCapture, On as useSiblingClient, pa as useToasts, I as useUiNode, Je as useUiStore, Gr as verifyLoginCode };
|