@ikonai/sdk-react-ui 1.0.33 → 1.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +146 -142
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { IkonUiCore as It, UiStreamStore as Ot } from "@ikonai/sdk-ui";
2
2
  import { UiStreamStore as Mo } from "@ikonai/sdk-ui";
3
- import _t, { useSyncExternalStore as Fe, useMemo as K, memo as W, useRef as v, useCallback as D, Fragment as Nt, useEffect as U, useState as G, createContext as ht, use as Be } from "react";
4
- import { createLogger as Re, getOrCreateDeviceId as Pt, deriveAuthUrl as Pe, parseUrlParams as Mt, clearSessionParamsFromUrl as jt, isCloudEnvironment as ze, extractUserIdFromToken as Ut, deriveBackendType as qe, IkonClient as Lt, AuthenticationError as xt, subscribeToLogEvents as Dt, isDebugModeEnabled as Ft, LogLevel as Ge, getLangParam as Bt } from "@ikonai/sdk";
3
+ import _t, { useSyncExternalStore as Fe, useMemo as K, memo as z, useRef as w, useCallback as D, Fragment as Nt, useEffect as U, useState as G, createContext as ht, use as Be } from "react";
4
+ import { createLogger as Re, getOrCreateDeviceId as Pt, deriveAuthUrl as Pe, parseUrlParams as Mt, clearSessionParamsFromUrl as jt, isCloudEnvironment as We, extractUserIdFromToken as Ut, deriveBackendType as qe, IkonClient as Lt, AuthenticationError as xt, subscribeToLogEvents as Dt, isDebugModeEnabled as Ft, LogLevel as Ge, getLangParam as Bt } from "@ikonai/sdk";
5
5
  var pe = { exports: {} }, ie = {};
6
6
  /**
7
7
  * @license React
@@ -57,11 +57,11 @@ function Vt() {
57
57
  return "Fragment";
58
58
  case g:
59
59
  return "Profiler";
60
- case m:
60
+ case p:
61
61
  return "StrictMode";
62
62
  case M:
63
63
  return "Suspense";
64
- case z:
64
+ case W:
65
65
  return "SuspenseList";
66
66
  case _:
67
67
  return "Activity";
@@ -74,7 +74,7 @@ function Vt() {
74
74
  return "Portal";
75
75
  case k:
76
76
  return (l.displayName || "Context") + ".Provider";
77
- case w:
77
+ case v:
78
78
  return (l._context.displayName || "Context") + ".Consumer";
79
79
  case O:
80
80
  var b = l.render;
@@ -155,7 +155,7 @@ function Vt() {
155
155
  }
156
156
  function d(l, b, R, C, V, B, ee, se) {
157
157
  return R = B.ref, l = {
158
- $$typeof: p,
158
+ $$typeof: m,
159
159
  type: l,
160
160
  key: b,
161
161
  props: B,
@@ -236,9 +236,9 @@ React keys must be passed directly to JSX without using spread:
236
236
  );
237
237
  }
238
238
  function h(l) {
239
- typeof l == "object" && l !== null && l.$$typeof === p && l._store && (l._store.validated = 1);
239
+ typeof l == "object" && l !== null && l.$$typeof === m && l._store && (l._store.validated = 1);
240
240
  }
241
- var f = _t, p = Symbol.for("react.transitional.element"), y = Symbol.for("react.portal"), S = Symbol.for("react.fragment"), m = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), w = Symbol.for("react.consumer"), k = Symbol.for("react.context"), O = Symbol.for("react.forward_ref"), M = Symbol.for("react.suspense"), z = Symbol.for("react.suspense_list"), Q = Symbol.for("react.memo"), T = Symbol.for("react.lazy"), _ = Symbol.for("react.activity"), F = Symbol.for("react.client.reference"), j = f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, L = Object.prototype.hasOwnProperty, Y = Array.isArray, re = console.createTask ? console.createTask : function() {
241
+ var f = _t, m = Symbol.for("react.transitional.element"), y = Symbol.for("react.portal"), S = Symbol.for("react.fragment"), p = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), v = Symbol.for("react.consumer"), k = Symbol.for("react.context"), O = Symbol.for("react.forward_ref"), M = Symbol.for("react.suspense"), W = Symbol.for("react.suspense_list"), Q = Symbol.for("react.memo"), T = Symbol.for("react.lazy"), _ = Symbol.for("react.activity"), F = Symbol.for("react.client.reference"), j = f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, L = Object.prototype.hasOwnProperty, Y = Array.isArray, re = console.createTask ? console.createTask : function() {
242
242
  return null;
243
243
  };
244
244
  f = {
@@ -310,8 +310,8 @@ function H(t, e) {
310
310
  );
311
311
  return K(() => t.getNode(e), [t, e, r]);
312
312
  }
313
- const Wt = Re("UIRenderer");
314
- function zt(t) {
313
+ const zt = Re("UIRenderer");
314
+ function Wt(t) {
315
315
  if (t === void 0)
316
316
  return "{}";
317
317
  if (typeof t == "string")
@@ -341,7 +341,7 @@ function Jt(t) {
341
341
  e += "," + t[r].id;
342
342
  return e;
343
343
  }
344
- const Me = W(function t({ nodeId: e, context: r }) {
344
+ const Me = z(function t({ nodeId: e, context: r }) {
345
345
  const n = H(r.store, e), o = n ? Gt(n) : [], s = Jt(o), i = K(
346
346
  () => o.length === 0 ? null : o.map((h) => /* @__PURE__ */ A.jsx(t, { nodeId: h.id, context: r }, h.id)),
347
347
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -353,7 +353,7 @@ const Me = W(function t({ nodeId: e, context: r }) {
353
353
  return /* @__PURE__ */ A.jsx(Nt, { children: i }, n.id);
354
354
  const a = r.library.resolve(n);
355
355
  if (!a)
356
- return Wt.warn(`No renderer for node type ${n.type}`), null;
356
+ return zt.warn(`No renderer for node type ${n.type}`), null;
357
357
  const c = qt(n), d = c.length > 0 ? c.join(" ") : void 0, u = a;
358
358
  return /* @__PURE__ */ A.jsx(u, { nodeId: e, context: r, className: d });
359
359
  }, Ht);
@@ -363,17 +363,17 @@ function Xt(t, e) {
363
363
  function Zt(t, e) {
364
364
  return t.store === e.store && t.library === e.library && t.viewId === e.viewId && t.emptyFallback === e.emptyFallback;
365
365
  }
366
- const Qt = W(function({ store: e, library: r, viewId: n, emptyFallback: o = null, onAction: s, client: i, video: a }) {
367
- const { rootViewId: c, rootNodeId: d } = Yt(e, n), u = v(s);
366
+ const Qt = z(function({ store: e, library: r, viewId: n, emptyFallback: o = null, onAction: s, client: i, video: a }) {
367
+ const { rootViewId: c, rootNodeId: d } = Yt(e, n), u = w(s);
368
368
  u.current = s;
369
- const h = v(i);
369
+ const h = w(i);
370
370
  h.current = i;
371
- const f = v(a);
371
+ const f = w(a);
372
372
  f.current = a;
373
- const p = D((S, m) => {
373
+ const m = D((S, p) => {
374
374
  if (!S)
375
375
  return;
376
- const g = zt(m);
376
+ const g = Wt(p);
377
377
  u.current?.(S, g);
378
378
  }, []), y = K(() => {
379
379
  const S = {
@@ -381,13 +381,13 @@ const Qt = W(function({ store: e, library: r, viewId: n, emptyFallback: o = null
381
381
  library: r,
382
382
  handlerCache: e.handlerCache,
383
383
  // Access payloads from store at call time, not captured snapshot
384
- getPayload: (m) => e.getSnapshot().payloads.get(m),
385
- renderChildren: (m) => Xt(m, S),
386
- renderView: (m) => {
387
- const g = e.getSnapshot().views.get(m);
384
+ getPayload: (p) => e.getSnapshot().payloads.get(p),
385
+ renderChildren: (p) => Xt(p, S),
386
+ renderView: (p) => {
387
+ const g = e.getSnapshot().views.get(p);
388
388
  return g ? /* @__PURE__ */ A.jsx(Me, { nodeId: g.id, context: S }) : null;
389
389
  },
390
- dispatchAction: p,
390
+ dispatchAction: m,
391
391
  // Access client/video via refs to avoid context recreation
392
392
  get client() {
393
393
  return h.current;
@@ -397,7 +397,7 @@ const Qt = W(function({ store: e, library: r, viewId: n, emptyFallback: o = null
397
397
  }
398
398
  };
399
399
  return S;
400
- }, [e, r, p]);
400
+ }, [e, r, m]);
401
401
  return !c || !d ? o : /* @__PURE__ */ A.jsx("div", { "data-ikon-view-id": c, style: { display: "contents" }, children: /* @__PURE__ */ A.jsx(Me, { nodeId: d, context: y }) });
402
402
  }, Zt);
403
403
  class er {
@@ -432,17 +432,17 @@ const je = "ikon-ui";
432
432
  function tr(t, e) {
433
433
  return t === e;
434
434
  }
435
- const yo = W(function({ stores: e, registry: r, category: n = je, onAction: o, client: s }) {
436
- const i = K(() => Array.from(e.keys()).sort().join(","), [e]), a = v(o);
435
+ const yo = z(function({ stores: e, registry: r, category: n = je, onAction: o, client: s }) {
436
+ const i = K(() => Array.from(e.keys()).sort().join(","), [e]), a = w(o);
437
437
  a.current = o;
438
- const c = v(s);
438
+ const c = w(s);
439
439
  c.current = s;
440
440
  const d = K(
441
441
  () => {
442
442
  const u = [];
443
443
  for (const [h, f] of e) {
444
- const p = f.store.getSnapshot();
445
- tr(f.category, n) && (!p.rootViewId || !p.views.has(p.rootViewId) || u.push({ key: h, store: f.store }));
444
+ const m = f.store.getSnapshot();
445
+ tr(f.category, n) && (!m.rootViewId || !m.views.has(m.rootViewId) || u.push({ key: h, store: f.store }));
446
446
  }
447
447
  return u;
448
448
  },
@@ -564,18 +564,17 @@ function Ve(t) {
564
564
  return Ze.set(t, r), r;
565
565
  }
566
566
  function sr() {
567
- const t = W(function({ nodeId: r, context: n }) {
568
- const o = H(n.store, r), s = v(null), i = fe(o?.props?.targetViewId), a = o?.props?.focusOnly, c = typeof a == "boolean" ? a : void 0, d = fe(o?.props?.key), u = o?.props?.preciseGeneratedAt;
567
+ const t = z(function({ nodeId: r, context: n }) {
568
+ const o = H(n.store, r), s = w(null), i = fe(o?.props?.targetViewId), a = o?.props?.focusOnly, c = typeof a == "boolean" ? a : void 0, d = fe(o?.props?.key), u = o?.props?.preciseGeneratedAt;
569
569
  return U(() => {
570
570
  if (typeof document > "u")
571
571
  return;
572
572
  const f = s.current;
573
573
  if (!f || i && f.closest("[data-ikon-view-id]")?.getAttribute("data-ikon-view-id") !== i)
574
574
  return;
575
- const p = c !== !0;
576
- if (p) {
577
- const g = ((w) => {
578
- let k = w.parentElement;
575
+ if (c !== !0) {
576
+ const g = ((v) => {
577
+ let k = v.parentElement;
579
578
  for (; k; ) {
580
579
  const M = window.getComputedStyle(k).overflowY;
581
580
  if (M === "auto" || M === "scroll" || k.hasAttribute("data-radix-scroll-area-viewport"))
@@ -585,7 +584,7 @@ function sr() {
585
584
  return null;
586
585
  })(f);
587
586
  g ? requestAnimationFrame(() => {
588
- const w = g.getBoundingClientRect(), k = f.getBoundingClientRect(), O = g.scrollTop + (k.bottom - w.bottom) + 16;
587
+ const v = g.getBoundingClientRect(), k = f.getBoundingClientRect(), O = g.scrollTop + (k.bottom - v.bottom) + 16;
589
588
  "scrollBehavior" in document.documentElement.style ? g.scrollTo({ top: O, behavior: "smooth" }) : g.scrollTop = O;
590
589
  }) : typeof f.scrollIntoView == "function" && requestAnimationFrame(() => {
591
590
  try {
@@ -598,7 +597,7 @@ function sr() {
598
597
  const y = document.activeElement;
599
598
  if (!(y instanceof HTMLInputElement || y instanceof HTMLTextAreaElement || y?.getAttribute("contenteditable") === "true") && typeof f.focus == "function")
600
599
  try {
601
- f.focus({ preventScroll: !p });
600
+ f.focus({ preventScroll: !0 });
602
601
  } catch {
603
602
  f.focus();
604
603
  }
@@ -620,7 +619,7 @@ function sr() {
620
619
  };
621
620
  }
622
621
  function ir() {
623
- const t = W(function({ nodeId: r, context: n, className: o }) {
622
+ const t = z(function({ nodeId: r, context: n, className: o }) {
624
623
  const s = H(n.store, r), i = nr(s?.props?.onInvokeId), a = D(() => {
625
624
  i && n.dispatchAction(i);
626
625
  }, [i, n]);
@@ -647,7 +646,7 @@ function ir() {
647
646
  };
648
647
  }
649
648
  function ar() {
650
- const t = W(function({ nodeId: r, context: n, className: o }) {
649
+ const t = z(function({ nodeId: r, context: n, className: o }) {
651
650
  const s = H(n.store, r);
652
651
  if (!s)
653
652
  return null;
@@ -660,7 +659,7 @@ function ar() {
660
659
  };
661
660
  }
662
661
  function cr() {
663
- const t = W(function({ nodeId: r, context: n, className: o }) {
662
+ const t = z(function({ nodeId: r, context: n, className: o }) {
664
663
  const s = H(n.store, r);
665
664
  if (!s)
666
665
  return null;
@@ -717,7 +716,7 @@ function ge(t) {
717
716
  }
718
717
  const pr = "std.audio-url-player";
719
718
  function gr() {
720
- const t = W(function({
719
+ const t = z(function({
721
720
  nodeId: r,
722
721
  context: n,
723
722
  className: o
@@ -778,8 +777,8 @@ function Ue(t) {
778
777
  }
779
778
  const yr = "std.video-canvas", br = "std.video-url-player";
780
779
  function Sr() {
781
- const t = W(function({ nodeId: r, context: n, className: o }) {
782
- const s = H(n.store, r), i = v(null), a = v(null), c = n.video, d = n.client, u = s ? Ue(s.props?.streamId) : void 0, h = s ? be(s.props?.width) : void 0, f = s ? be(s.props?.height) : void 0, p = s ? pt(mt(s.props?.className), o) : o, y = d?.isWebRtcEnabled && u ? d.getWebRtcVideoStreamByStreamId(u) : null;
780
+ const t = z(function({ nodeId: r, context: n, className: o }) {
781
+ const s = H(n.store, r), i = w(null), a = w(null), c = n.video, d = n.client, u = s ? Ue(s.props?.streamId) : void 0, h = s ? be(s.props?.width) : void 0, f = s ? be(s.props?.height) : void 0, m = s ? pt(mt(s.props?.className), o) : o, y = d?.isWebRtcEnabled && u ? d.getWebRtcVideoStreamByStreamId(u) : null;
783
782
  return U(() => {
784
783
  const S = i.current;
785
784
  if (!(!c || !S || !u || y))
@@ -801,7 +800,7 @@ function Sr() {
801
800
  muted: !0,
802
801
  "data-ikon-node-id": s.id,
803
802
  "data-ikon-video-stream-id": u,
804
- className: p,
803
+ className: m,
805
804
  ...h ? { width: h } : {},
806
805
  ...f ? { height: f } : {}
807
806
  },
@@ -812,7 +811,7 @@ function Sr() {
812
811
  ref: i,
813
812
  "data-ikon-node-id": s.id,
814
813
  "data-ikon-video-stream-id": u,
815
- className: p,
814
+ className: m,
816
815
  ...h ? { width: h } : {},
817
816
  ...f ? { height: f } : {}
818
817
  },
@@ -837,7 +836,7 @@ function ce(t) {
837
836
  }
838
837
  }
839
838
  function vr() {
840
- const t = W(function({
839
+ const t = z(function({
841
840
  nodeId: r,
842
841
  context: n,
843
842
  className: o
@@ -845,7 +844,7 @@ function vr() {
845
844
  const s = H(n.store, r);
846
845
  if (!s)
847
846
  return null;
848
- const i = pt(mt(s.props?.className), o), a = Ue(s.props?.src), c = Ue(s.props?.poster), d = ce(s.props?.controls), u = ce(s.props?.autoplay), h = ce(s.props?.loop), f = ce(s.props?.muted), p = ce(s.props?.playsInline), y = be(s.props?.width), S = be(s.props?.height), m = s.children?.length ? n.renderChildren(s.children) : void 0;
847
+ const i = pt(mt(s.props?.className), o), a = Ue(s.props?.src), c = Ue(s.props?.poster), d = ce(s.props?.controls), u = ce(s.props?.autoplay), h = ce(s.props?.loop), f = ce(s.props?.muted), m = ce(s.props?.playsInline), y = be(s.props?.width), S = be(s.props?.height), p = s.children?.length ? n.renderChildren(s.children) : void 0;
849
848
  return /* @__PURE__ */ A.jsx(
850
849
  "video",
851
850
  {
@@ -855,12 +854,12 @@ function vr() {
855
854
  ...u !== void 0 ? { autoPlay: u } : {},
856
855
  ...h !== void 0 ? { loop: h } : {},
857
856
  ...f !== void 0 ? { muted: f } : {},
858
- ...p !== void 0 ? { playsInline: p } : {},
857
+ ...m !== void 0 ? { playsInline: m } : {},
859
858
  ...y ? { width: y } : {},
860
859
  ...S ? { height: S } : {},
861
860
  "data-ikon-node-id": s.id,
862
861
  className: i,
863
- children: m
862
+ children: p
864
863
  }
865
864
  );
866
865
  });
@@ -1023,38 +1022,38 @@ class Ir {
1023
1022
  h && e.uniform1i(h, this.frameCount);
1024
1023
  const f = this.uniformLocations.get("iMouse");
1025
1024
  f && e.uniform4f(f, this.mouseX, this.mouseY, this.mouseClickX, this.mouseClickY);
1026
- const p = this.uniformLocations.get("iDate");
1027
- if (p) {
1025
+ const m = this.uniformLocations.get("iDate");
1026
+ if (m) {
1028
1027
  const y = /* @__PURE__ */ new Date();
1029
- e.uniform4f(p, y.getFullYear(), y.getMonth(), y.getDate(), y.getHours() * 3600 + y.getMinutes() * 60 + y.getSeconds() + y.getMilliseconds() / 1e3);
1028
+ e.uniform4f(m, y.getFullYear(), y.getMonth(), y.getDate(), y.getHours() * 3600 + y.getMinutes() * 60 + y.getSeconds() + y.getMilliseconds() / 1e3);
1030
1029
  }
1031
1030
  for (const [y, S] of Object.entries(this.customUniforms)) {
1032
- const m = this.uniformLocations.get(y);
1033
- if (m)
1031
+ const p = this.uniformLocations.get(y);
1032
+ if (p)
1034
1033
  switch (S.type) {
1035
1034
  case "float":
1036
- e.uniform1f(m, S.value);
1035
+ e.uniform1f(p, S.value);
1037
1036
  break;
1038
1037
  case "vec2": {
1039
1038
  const g = S.value;
1040
- e.uniform2f(m, g[0], g[1]);
1039
+ e.uniform2f(p, g[0], g[1]);
1041
1040
  break;
1042
1041
  }
1043
1042
  case "vec3": {
1044
1043
  const g = S.value;
1045
- e.uniform3f(m, g[0], g[1], g[2]);
1044
+ e.uniform3f(p, g[0], g[1], g[2]);
1046
1045
  break;
1047
1046
  }
1048
1047
  case "vec4": {
1049
1048
  const g = S.value;
1050
- e.uniform4f(m, g[0], g[1], g[2], g[3]);
1049
+ e.uniform4f(p, g[0], g[1], g[2], g[3]);
1051
1050
  break;
1052
1051
  }
1053
1052
  case "int":
1054
- e.uniform1i(m, S.value);
1053
+ e.uniform1i(p, S.value);
1055
1054
  break;
1056
1055
  case "bool":
1057
- e.uniform1i(m, S.value ? 1 : 0);
1056
+ e.uniform1i(p, S.value ? 1 : 0);
1058
1057
  break;
1059
1058
  }
1060
1059
  }
@@ -1143,14 +1142,14 @@ function jr(t, e) {
1143
1142
  }
1144
1143
  const Ur = "std.shadertoy-canvas";
1145
1144
  function Lr() {
1146
- const t = W(function({ nodeId: r, context: n, className: o }) {
1147
- const s = H(n.store, r), i = v(null), a = v(null), c = v(null), d = v(0), u = v(""), h = v({}), f = v({
1145
+ const t = z(function({ nodeId: r, context: n, className: o }) {
1146
+ const s = H(n.store, r), i = w(null), a = w(null), c = w(null), d = w(0), u = w(""), h = w({}), f = w({
1148
1147
  x: 0,
1149
1148
  y: 0,
1150
1149
  clickX: 0,
1151
1150
  clickY: 0,
1152
1151
  isDown: !1
1153
- }), p = s ? Nr(s.props?.shaderSource) : "", y = s ? ke(s.props?.fps) ?? 60 : 60, S = s?.props?.uniforms, m = K(() => Mr(S), [S]), g = s ? Pr(s.props?.enableMouse) ?? !0 : !0, w = s ? ke(s.props?.width) : void 0, k = s ? ke(s.props?.height) : void 0, O = s ? _r(Or(s.props?.className), o) : o;
1152
+ }), m = s ? Nr(s.props?.shaderSource) : "", y = s ? ke(s.props?.fps) ?? 60 : 60, S = s?.props?.uniforms, p = K(() => Mr(S), [S]), g = s ? Pr(s.props?.enableMouse) ?? !0 : !0, v = s ? ke(s.props?.width) : void 0, k = s ? ke(s.props?.height) : void 0, O = s ? _r(Or(s.props?.className), o) : o;
1154
1153
  U(() => {
1155
1154
  const T = i.current;
1156
1155
  if (T) {
@@ -1166,17 +1165,17 @@ function Lr() {
1166
1165
  }
1167
1166
  }, []), U(() => {
1168
1167
  const T = a.current;
1169
- if (!(!T || !p) && u.current !== p)
1170
- if (T.compile(p, m))
1171
- u.current = p, h.current = m;
1168
+ if (!(!T || !m) && u.current !== m)
1169
+ if (T.compile(m, p))
1170
+ u.current = m, h.current = p;
1172
1171
  else {
1173
1172
  const F = T.getError();
1174
1173
  console.error("[ShadertoyRenderer] Shader compilation failed:", F);
1175
1174
  }
1176
- }, [p, m]), U(() => {
1175
+ }, [m, p]), U(() => {
1177
1176
  const T = a.current;
1178
- !T || !u.current || jr(h.current, m) || (T.setCustomUniforms(m), h.current = m);
1179
- }, [m]), U(() => {
1177
+ !T || !u.current || jr(h.current, p) || (T.setCustomUniforms(p), h.current = p);
1178
+ }, [p]), U(() => {
1180
1179
  const T = a.current;
1181
1180
  if (!T || !u.current) return;
1182
1181
  const _ = 1e3 / y, F = (j) => {
@@ -1196,7 +1195,7 @@ function Lr() {
1196
1195
  f.current.x = L, f.current.y = Y, F.setMouse(L, Y, f.current.clickX, f.current.clickY);
1197
1196
  },
1198
1197
  [g]
1199
- ), z = D(
1198
+ ), W = D(
1200
1199
  (T) => {
1201
1200
  if (!g) return;
1202
1201
  const _ = i.current, F = a.current;
@@ -1214,10 +1213,10 @@ function Lr() {
1214
1213
  ref: i,
1215
1214
  "data-ikon-node-id": s.id,
1216
1215
  className: O,
1217
- ...w ? { width: w } : {},
1216
+ ...v ? { width: v } : {},
1218
1217
  ...k ? { height: k } : {},
1219
1218
  onMouseMove: M,
1220
- onMouseDown: z,
1219
+ onMouseDown: W,
1221
1220
  onMouseUp: Q,
1222
1221
  onMouseLeave: Q
1223
1222
  }
@@ -1346,50 +1345,50 @@ function nt(t) {
1346
1345
  }
1347
1346
  function ot(t, e, r, n) {
1348
1347
  const u = new Float32Array(11);
1349
- function h(m, g, w) {
1350
- return ((3 * g - 3 * w + 1) * m + (3 * w - 6 * g)) * m * m + 3 * g * m;
1348
+ function h(p, g, v) {
1349
+ return ((3 * g - 3 * v + 1) * p + (3 * v - 6 * g)) * p * p + 3 * g * p;
1351
1350
  }
1352
- function f(m, g, w) {
1353
- return 3 * (3 * g - 3 * w + 1) * m * m + 2 * (3 * w - 6 * g) * m + 3 * g;
1351
+ function f(p, g, v) {
1352
+ return 3 * (3 * g - 3 * v + 1) * p * p + 2 * (3 * v - 6 * g) * p + 3 * g;
1354
1353
  }
1355
- function p(m, g) {
1356
- for (let w = 0; w < 4; w += 1) {
1354
+ function m(p, g) {
1355
+ for (let v = 0; v < 4; v += 1) {
1357
1356
  const k = f(g, t, r);
1358
1357
  if (k === 0)
1359
1358
  return g;
1360
- const O = h(g, t, r) - m;
1359
+ const O = h(g, t, r) - p;
1361
1360
  g -= O / k;
1362
1361
  }
1363
1362
  return g;
1364
1363
  }
1365
- function y(m, g, w) {
1364
+ function y(p, g, v) {
1366
1365
  let k = 0, O = 0, M = 0;
1367
1366
  do
1368
- O = g + (w - g) / 2, k = h(O, t, r) - m, k > 0 ? w = O : g = O;
1367
+ O = g + (v - g) / 2, k = h(O, t, r) - p, k > 0 ? v = O : g = O;
1369
1368
  while (Math.abs(k) > 1e-7 && ++M < 10);
1370
1369
  return O;
1371
1370
  }
1372
- function S(m) {
1373
- let g = 0, w = 1;
1371
+ function S(p) {
1372
+ let g = 0, v = 1;
1374
1373
  const k = 10;
1375
- for (; w !== k && u[w] <= m; w += 1)
1374
+ for (; v !== k && u[v] <= p; v += 1)
1376
1375
  g += 0.1;
1377
- w -= 1;
1378
- const O = (m - u[w]) / (u[w + 1] - u[w]), M = g + O * 0.1, z = f(M, t, r);
1379
- return z >= 1e-3 ? p(m, M) : z === 0 ? M : y(m, g, g + 0.1);
1376
+ v -= 1;
1377
+ const O = (p - u[v]) / (u[v + 1] - u[v]), M = g + O * 0.1, W = f(M, t, r);
1378
+ return W >= 1e-3 ? m(p, M) : W === 0 ? M : y(p, g, g + 0.1);
1380
1379
  }
1381
- for (let m = 0; m < 11; m += 1)
1382
- u[m] = h(m * 0.1, t, r);
1383
- return (m) => m <= 0 ? 0 : m >= 1 ? 1 : h(S(m), e, n);
1380
+ for (let p = 0; p < 11; p += 1)
1381
+ u[p] = h(p * 0.1, t, r);
1382
+ return (p) => p <= 0 ? 0 : p >= 1 ? 1 : h(S(p), e, n);
1384
1383
  }
1385
- function Wr(t) {
1384
+ function zr(t) {
1386
1385
  const e = /steps\(\s*([0-9]+)\s*(?:,\s*([a-z-]+)\s*)?\)/i.exec(t);
1387
1386
  if (!e)
1388
1387
  return (o) => $(o);
1389
1388
  const r = Math.max(1, parseInt(e[1], 10)), n = (e[2] ?? "end").toLowerCase();
1390
1389
  return n === "start" || n === "jump-start" ? (o) => $(Math.ceil(o * r) / r) : n === "none" || n === "jump-none" ? (o) => $(Math.round(o * r) / r) : n === "both" || n === "jump-both" ? (o) => $((Math.floor(o * r) + 0.5) / r) : (o) => $(Math.floor(o * r) / r);
1391
1390
  }
1392
- function zr(t) {
1391
+ function Wr(t) {
1393
1392
  if (!t)
1394
1393
  return (r) => $(r);
1395
1394
  const e = t.trim().toLowerCase();
@@ -1407,7 +1406,7 @@ function zr(t) {
1407
1406
  }
1408
1407
  }
1409
1408
  if (e.startsWith("steps(") && e.endsWith(")")) {
1410
- const r = Wr(e);
1409
+ const r = zr(e);
1411
1410
  return (n) => r($(n));
1412
1411
  }
1413
1412
  return (r) => $(r);
@@ -1467,7 +1466,7 @@ class Gr {
1467
1466
  const r = e.source?.trim();
1468
1467
  if (!r)
1469
1468
  return;
1470
- const n = rt(e.min) ?? 0, o = rt(e.max), s = o === void 0 ? n + 100 : o, i = (e.clamp ?? "clamp").trim().toLowerCase(), a = !!e.reverse, c = zr(e.ease), d = qr(e.map), u = e.targetId?.trim() || void 0;
1469
+ const n = rt(e.min) ?? 0, o = rt(e.max), s = o === void 0 ? n + 100 : o, i = (e.clamp ?? "clamp").trim().toLowerCase(), a = !!e.reverse, c = Wr(e.ease), d = qr(e.map), u = e.targetId?.trim() || void 0;
1471
1470
  return Number.isNaN(n) || Number.isNaN(s) ? void 0 : {
1472
1471
  source: r.toLowerCase(),
1473
1472
  min: n,
@@ -1682,7 +1681,7 @@ class Gr {
1682
1681
  }
1683
1682
  const Ce = new Gr();
1684
1683
  function Hr(t) {
1685
- const e = v(/* @__PURE__ */ new Map()), r = D(({ styleId: s, css: i, common: a }) => {
1684
+ const e = w(/* @__PURE__ */ new Map()), r = D(({ styleId: s, css: i, common: a }) => {
1686
1685
  if (!(!s || typeof document > "u")) {
1687
1686
  if (i) {
1688
1687
  let c = e.current.get(s);
@@ -1723,7 +1722,7 @@ function Jr(t) {
1723
1722
  return e.sort(), e.join(",");
1724
1723
  }
1725
1724
  function Xr(t) {
1726
- const [e, r] = G(), n = v("");
1725
+ const [e, r] = G(), n = w("");
1727
1726
  return U(() => {
1728
1727
  if (!t) {
1729
1728
  r(void 0), n.current = "";
@@ -1831,7 +1830,7 @@ function wo(t) {
1831
1830
  const f = h.trim();
1832
1831
  if (!f)
1833
1832
  continue;
1834
- const p = Object.keys(d).find((S) => S.toLowerCase() === "javascript"), y = p ? d[p] : void 0;
1833
+ const m = Object.keys(d).find((S) => S.toLowerCase() === "javascript"), y = m ? d[m] : void 0;
1835
1834
  typeof y == "string" && s.set(f, y), i.has(f) || (o.push(f), i.add(f));
1836
1835
  }
1837
1836
  if (!o.length && s.size === 0)
@@ -2003,9 +2002,9 @@ function An(t, e, r) {
2003
2002
  );
2004
2003
  continue;
2005
2004
  }
2006
- const f = o && yt(a) ? { "data-motion-emoji": !0 } : void 0, p = a === " " ? " " : a;
2005
+ const f = o && yt(a) ? { "data-motion-emoji": !0 } : void 0, m = a === " " ? " " : a;
2007
2006
  s.push(
2008
- /* @__PURE__ */ A.jsx("span", { "data-motion-letter": !0, style: u, ...f, children: p }, d)
2007
+ /* @__PURE__ */ A.jsx("span", { "data-motion-letter": !0, style: u, ...f, children: m }, d)
2009
2008
  );
2010
2009
  }
2011
2010
  return s;
@@ -2308,7 +2307,7 @@ function Yn(t, e, r, n) {
2308
2307
  const o = n ?? window.location.origin + window.location.pathname + window.location.search;
2309
2308
  return `${r}/oauth/${t}?space=${encodeURIComponent(e)}&return=${encodeURIComponent(o)}`;
2310
2309
  }
2311
- async function Wn(t) {
2310
+ async function zn(t) {
2312
2311
  const e = await fetch(`${t}/passkey/registration/options`, {
2313
2312
  method: "POST",
2314
2313
  headers: { "Content-Type": "application/json" }
@@ -2319,7 +2318,7 @@ async function Wn(t) {
2319
2318
  }
2320
2319
  return e.json();
2321
2320
  }
2322
- async function zn(t, e, r) {
2321
+ async function Wn(t, e, r) {
2323
2322
  const n = await fetch(`${t}/passkey/registration/verify`, {
2324
2323
  method: "POST",
2325
2324
  headers: { "Content-Type": "application/json" },
@@ -2569,10 +2568,10 @@ async function Qn(t) {
2569
2568
  } catch (y) {
2570
2569
  _e("getPublicKey()", y);
2571
2570
  }
2572
- let p;
2571
+ let m;
2573
2572
  if (typeof c.getAuthenticatorData == "function")
2574
2573
  try {
2575
- p = q(c.getAuthenticatorData());
2574
+ m = q(c.getAuthenticatorData());
2576
2575
  } catch (y) {
2577
2576
  _e("getAuthenticatorData()", y);
2578
2577
  }
@@ -2585,7 +2584,7 @@ async function Qn(t) {
2585
2584
  transports: u,
2586
2585
  publicKeyAlgorithm: h,
2587
2586
  publicKey: f,
2588
- authenticatorData: p
2587
+ authenticatorData: m
2589
2588
  },
2590
2589
  type: d,
2591
2590
  clientExtensionResults: s.getClientExtensionResults(),
@@ -2669,8 +2668,8 @@ async function ro(t) {
2669
2668
  let a;
2670
2669
  try {
2671
2670
  a = await navigator.credentials.get(i);
2672
- } catch (p) {
2673
- throw to({ error: p, options: i });
2671
+ } catch (m) {
2672
+ throw to({ error: m, options: i });
2674
2673
  }
2675
2674
  if (!a)
2676
2675
  throw new Error("Authentication was not completed");
@@ -2690,7 +2689,7 @@ async function ro(t) {
2690
2689
  authenticatorAttachment: kt(a.authenticatorAttachment)
2691
2690
  };
2692
2691
  }
2693
- const We = ht(null);
2692
+ const ze = ht(null);
2694
2693
  function Eo({ children: t, config: e }) {
2695
2694
  const [r, n] = G({
2696
2695
  isAuthenticated: !1,
@@ -2712,15 +2711,15 @@ function Eo({ children: t, config: e }) {
2712
2711
  }
2713
2712
  const h = Vn();
2714
2713
  if (h) {
2715
- const p = {
2714
+ const m = {
2716
2715
  token: h.token,
2717
2716
  provider: h.provider,
2718
2717
  authenticatedAt: Date.now()
2719
2718
  };
2720
- Ae(p), ft(), n({
2719
+ Ae(m), ft(), n({
2721
2720
  isAuthenticated: !0,
2722
2721
  isLoading: !1,
2723
- user: de(p),
2722
+ user: de(m),
2724
2723
  error: null
2725
2724
  });
2726
2725
  return;
@@ -2775,11 +2774,11 @@ function Eo({ children: t, config: e }) {
2775
2774
  if (d === "passkey") {
2776
2775
  n((h) => ({ ...h, isLoading: !0, error: null }));
2777
2776
  try {
2778
- const h = await qn(u), f = await ro({ optionsJSON: h }), p = await Gn(u, f);
2777
+ const h = await qn(u), f = await ro({ optionsJSON: h }), m = await Gn(u, f);
2779
2778
  n({
2780
2779
  isAuthenticated: !0,
2781
2780
  isLoading: !1,
2782
- user: de(p),
2781
+ user: de(m),
2783
2782
  error: null
2784
2783
  });
2785
2784
  } catch (h) {
@@ -2806,11 +2805,11 @@ function Eo({ children: t, config: e }) {
2806
2805
  const u = Pe(e.authUrl);
2807
2806
  n((h) => ({ ...h, isLoading: !0, error: null }));
2808
2807
  try {
2809
- const h = await Wn(u), f = await Qn({ optionsJSON: h }), p = await zn(u, f, d);
2808
+ const h = await zn(u), f = await Qn({ optionsJSON: h }), m = await Wn(u, f, d);
2810
2809
  n({
2811
2810
  isAuthenticated: !0,
2812
2811
  isLoading: !1,
2813
- user: de(p),
2812
+ user: de(m),
2814
2813
  error: null
2815
2814
  });
2816
2815
  } catch (h) {
@@ -2832,19 +2831,19 @@ function Eo({ children: t, config: e }) {
2832
2831
  }),
2833
2832
  [r, o, s, a, i]
2834
2833
  );
2835
- return /* @__PURE__ */ A.jsx(We, { value: c, children: t });
2834
+ return /* @__PURE__ */ A.jsx(ze, { value: c, children: t });
2836
2835
  }
2837
2836
  function no() {
2838
- const t = Be(We);
2837
+ const t = Be(ze);
2839
2838
  if (!t)
2840
2839
  throw new Error("useAuth must be used within an AuthProvider");
2841
2840
  return t;
2842
2841
  }
2843
2842
  function oo() {
2844
- return Be(We);
2843
+ return Be(ze);
2845
2844
  }
2846
2845
  function Ao(t) {
2847
- const { config: e, guestUrlParam: r } = t, { state: n, login: o } = no(), s = v(!1);
2846
+ const { config: e, guestUrlParam: r } = t, { state: n, login: o } = no(), s = w(!1);
2848
2847
  return U(() => {
2849
2848
  if (!r || n.isAuthenticated || n.isLoading || s.current || !e.methods.includes("guest"))
2850
2849
  return;
@@ -2876,6 +2875,7 @@ function ko({
2876
2875
  renderOffline: h,
2877
2876
  renderError: f
2878
2877
  }) {
2878
+ const m = w(!1);
2879
2879
  switch (t) {
2880
2880
  case "idle":
2881
2881
  return a();
@@ -2884,18 +2884,22 @@ function ko({
2884
2884
  case "connectingSlow":
2885
2885
  return d();
2886
2886
  case "connected":
2887
- case "reconnecting":
2888
- return !r || !n || !o ? null : u({
2887
+ case "reconnecting": {
2888
+ if (!r || !n || !o) return null;
2889
+ t === "reconnecting" && (m.current = !0);
2890
+ const y = n.size > 0;
2891
+ return y && (m.current = !1), u({
2889
2892
  stores: n,
2890
2893
  registry: o,
2891
2894
  client: s,
2892
2895
  onAction: i,
2893
- isReconnecting: t === "reconnecting"
2896
+ isReconnecting: t === "reconnecting" || m.current && !y
2894
2897
  });
2898
+ }
2895
2899
  case "offline":
2896
- return h();
2900
+ return m.current = !1, h();
2897
2901
  case "offlineError":
2898
- return f(e ?? s?.lastError?.message ?? null);
2902
+ return m.current = !1, f(e ?? s?.lastError?.message ?? null);
2899
2903
  default:
2900
2904
  return null;
2901
2905
  }
@@ -2910,8 +2914,8 @@ function io() {
2910
2914
  return window.__IKON_LOCAL_IKON_SERVER_CONFIG__;
2911
2915
  }
2912
2916
  function To(t) {
2913
- const { authConfig: e, modules: r, timeouts: n, backgroundAudio: o, webRtc: s, audio: i, video: a, websocket: c, webtransport: d } = t, u = e === void 0 ? so() ?? null : e, h = io(), f = oo(), p = v(null), y = v(null), S = v(null), m = v(!1), g = v(!1), w = v(o), k = v(n), O = v(s), M = v(i), z = v(a), Q = v(c), T = v(d);
2914
- w.current = o, k.current = n, O.current = s, M.current = i, z.current = a, Q.current = c, T.current = d;
2917
+ const { authConfig: e, modules: r, timeouts: n, backgroundAudio: o, webRtc: s, audio: i, video: a, websocket: c, webtransport: d } = t, u = e === void 0 ? so() ?? null : e, h = io(), f = oo(), m = w(null), y = w(null), S = w(null), p = w(!1), g = w(!1), v = w(o), k = w(n), O = w(s), M = w(i), W = w(a), Q = w(c), T = w(d);
2918
+ v.current = o, k.current = n, O.current = s, M.current = i, W.current = a, Q.current = c, T.current = d;
2915
2919
  const [_, F] = G("idle"), [j, L] = G(null), [Y, re] = G(null), [J, he] = G(null), [ne, oe] = G(!1), [me, l] = G(0), b = K(() => {
2916
2920
  try {
2917
2921
  const I = Mt();
@@ -2921,7 +2925,7 @@ function To(t) {
2921
2925
  }
2922
2926
  }, []), R = K(() => u?.enabled ? wt() : null, [u?.enabled, me]), C = h?.enabled ?? !1, V = h?.host ?? "localhost", B = h?.port ?? 8443;
2923
2927
  U(() => {
2924
- !C && ze() && u && !u.enabled && u.spaceId && !J && !ne && (oe(!0), vt(u.spaceId, Pe(u.authUrl)).then((x) => {
2928
+ !C && We() && u && !u.enabled && u.spaceId && !J && !ne && (oe(!0), vt(u.spaceId, Pe(u.authUrl)).then((x) => {
2925
2929
  he(x.token);
2926
2930
  }).catch((x) => {
2927
2931
  ye.error("Anonymous auth failed:", x), L(x instanceof Error ? x.message : "Anonymous auth failed");
@@ -2963,7 +2967,7 @@ function To(t) {
2963
2967
  channelKey: b.channelKey,
2964
2968
  parameters: b.parameters
2965
2969
  }
2966
- } : ze() ? null : {
2970
+ } : We() ? null : {
2967
2971
  local: {
2968
2972
  host: V,
2969
2973
  httpsPort: B,
@@ -2977,8 +2981,8 @@ function To(t) {
2977
2981
  Hr(Y);
2978
2982
  const se = Xr(Y);
2979
2983
  U(() => {
2980
- if (!m.current) {
2981
- if (m.current = !0, S.current = $r(), r)
2984
+ if (!p.current) {
2985
+ if (p.current = !0, S.current = $r(), r)
2982
2986
  for (const I of r)
2983
2987
  I(S.current);
2984
2988
  S.current.loadRegisteredModules().catch((I) => {
@@ -2990,11 +2994,11 @@ function To(t) {
2990
2994
  const I = new Lt({
2991
2995
  ...ee,
2992
2996
  timeouts: k.current,
2993
- audio: M.current !== void 0 || w.current ? {
2997
+ audio: M.current !== void 0 || v.current ? {
2994
2998
  enabled: M.current,
2995
- ...w.current ? { background: { allowOnDesktop: !0, allowOnMobile: !0 } } : {}
2999
+ ...v.current ? { background: { allowOnDesktop: !0, allowOnMobile: !0 } } : {}
2996
3000
  } : void 0,
2997
- video: z.current !== void 0 ? { enabled: z.current } : void 0,
3001
+ video: W.current !== void 0 ? { enabled: W.current } : void 0,
2998
3002
  mediaSession: { title: document.title || void 0, artist: document.title || void 0 },
2999
3003
  webRtc: O.current ? { enabled: !0 } : void 0,
3000
3004
  websocket: Q.current,
@@ -3006,35 +3010,35 @@ function To(t) {
3006
3010
  L(Z.message);
3007
3011
  }
3008
3012
  });
3009
- p.current = I;
3013
+ m.current = I;
3010
3014
  const x = new rr({ client: I });
3011
3015
  return y.current = x, re(x), I.connect().catch((Z) => {
3012
3016
  ye.error("Connection failed:", Z), Z instanceof xt && !g.current && (g.current = !0, ye.warn("Auth session appears stale, clearing and retrying"), f ? f.logout() : (we(), l((Ct) => Ct + 1)));
3013
3017
  }), () => {
3014
- I.disconnect(), p.current = null, x.dispose(), y.current = null;
3018
+ I.disconnect(), m.current = null, x.dispose(), y.current = null;
3015
3019
  };
3016
3020
  }, [ee]);
3017
3021
  const N = D((I, x) => {
3018
3022
  const Z = typeof x == "string" ? x : JSON.stringify(x ?? {});
3019
- p.current?.sendActionCall(I, Z);
3023
+ m.current?.sendActionCall(I, Z);
3020
3024
  }, []), X = _ === "connected" || _ === "reconnecting";
3021
3025
  return {
3022
3026
  connectionState: _,
3023
3027
  error: j,
3024
3028
  stores: se,
3025
- client: p.current,
3029
+ client: m.current,
3026
3030
  registry: S.current,
3027
- clientRef: p,
3031
+ clientRef: m,
3028
3032
  uiRef: y,
3029
3033
  registryRef: S,
3030
3034
  onAction: N,
3031
3035
  isReady: X,
3032
- webRtcVideoStreams: p.current?.webRtcVideoStreams ?? /* @__PURE__ */ new Map(),
3033
- webRtcTrackMap: p.current?.webRtcTrackMap ?? /* @__PURE__ */ new Map()
3036
+ webRtcVideoStreams: m.current?.webRtcVideoStreams ?? /* @__PURE__ */ new Map(),
3037
+ webRtcTrackMap: m.current?.webRtcTrackMap ?? /* @__PURE__ */ new Map()
3034
3038
  };
3035
3039
  }
3036
3040
  function Co(t) {
3037
- const e = v(!1);
3041
+ const e = w(!1);
3038
3042
  return D(() => {
3039
3043
  if (e.current) return;
3040
3044
  e.current = !0;
@@ -3044,7 +3048,7 @@ function Co(t) {
3044
3048
  }
3045
3049
  let ao = 0;
3046
3050
  function Io(t = 5, e = 5e3) {
3047
- const [r, n] = G([]), o = v(/* @__PURE__ */ new Map()), s = D((i) => {
3051
+ const [r, n] = G([]), o = w(/* @__PURE__ */ new Map()), s = D((i) => {
3048
3052
  const a = o.current.get(i);
3049
3053
  a && (clearTimeout(a), o.current.delete(i)), n((c) => c.filter((d) => d.id !== i));
3050
3054
  }, []);
@@ -3059,7 +3063,7 @@ function Io(t = 5, e = 5e3) {
3059
3063
  message: c.message,
3060
3064
  component: c.component
3061
3065
  };
3062
- n((p) => [...p, h].slice(-t));
3066
+ n((m) => [...m, h].slice(-t));
3063
3067
  const f = setTimeout(() => {
3064
3068
  s(d);
3065
3069
  }, e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikonai/sdk-react-ui",
3
- "version": "1.0.33",
3
+ "version": "1.0.34",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",