@ikonai/sdk-react-ui 0.0.34 → 0.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { IkonUICore as Je, UiStreamStore as Ze } from "@ikonai/sdk-ui";
2
- import { UiStreamStore as Gr } from "@ikonai/sdk-ui";
3
- import Qe, { useSyncExternalStore as pe, useMemo as x, memo as j, useRef as I, useCallback as ae, Fragment as et, useEffect as q, useState as tt } from "react";
4
- import { createLogger as he } from "@ikonai/sdk";
5
- var K = { exports: {} }, F = {};
1
+ import { IkonUICore as pt, UiStreamStore as gt } from "@ikonai/sdk-ui";
2
+ import { UiStreamStore as On } from "@ikonai/sdk-ui";
3
+ import yt, { useSyncExternalStore as _e, useMemo as L, memo as U, useRef as E, useCallback as z, Fragment as St, useEffect as $, useState as Y, createContext as nt, use as Me } from "react";
4
+ import { createLogger as ye, getOrCreateDeviceId as me, deriveAuthUrl as Ne, parseUrlParams as bt, isCloudEnvironment as xe, extractUserIdFromToken as vt, deriveBackendType as $e, IkonClient as wt } from "@ikonai/sdk";
5
+ var he = { exports: {} }, ee = {};
6
6
  /**
7
7
  * @license React
8
8
  * react-jsx-runtime.production.js
@@ -12,17 +12,17 @@ var K = { exports: {} }, F = {};
12
12
  * This source code is licensed under the MIT license found in the
13
13
  * LICENSE file in the root directory of this source tree.
14
14
  */
15
- var Re;
16
- function rt() {
17
- if (Re) return F;
18
- Re = 1;
15
+ var Fe;
16
+ function Et() {
17
+ if (Fe) return ee;
18
+ Fe = 1;
19
19
  var r = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
20
20
  function t(n, o, s) {
21
21
  var i = null;
22
22
  if (s !== void 0 && (i = "" + s), o.key !== void 0 && (i = "" + o.key), "key" in o) {
23
23
  s = {};
24
- for (var c in o)
25
- c !== "key" && (s[c] = o[c]);
24
+ for (var a in o)
25
+ a !== "key" && (s[a] = o[a]);
26
26
  } else s = o;
27
27
  return o = s.ref, {
28
28
  $$typeof: r,
@@ -32,9 +32,9 @@ function rt() {
32
32
  props: s
33
33
  };
34
34
  }
35
- return F.Fragment = e, F.jsx = t, F.jsxs = t, F;
35
+ return ee.Fragment = e, ee.jsx = t, ee.jsxs = t, ee;
36
36
  }
37
- var V = {};
37
+ var te = {};
38
38
  /**
39
39
  * @license React
40
40
  * react-jsx-runtime.development.js
@@ -44,166 +44,166 @@ var V = {};
44
44
  * This source code is licensed under the MIT license found in the
45
45
  * LICENSE file in the root directory of this source tree.
46
46
  */
47
- var ke;
48
- function nt() {
49
- return ke || (ke = 1, process.env.NODE_ENV !== "production" && function() {
50
- function r(a) {
51
- if (a == null) return null;
52
- if (typeof a == "function")
53
- return a.$$typeof === Ke ? null : a.displayName || a.name || null;
54
- if (typeof a == "string") return a;
55
- switch (a) {
56
- case S:
47
+ var Be;
48
+ function kt() {
49
+ return Be || (Be = 1, process.env.NODE_ENV !== "production" && function() {
50
+ function r(c) {
51
+ if (c == null) return null;
52
+ if (typeof c == "function")
53
+ return c.$$typeof === ue ? null : c.displayName || c.name || null;
54
+ if (typeof c == "string") return c;
55
+ switch (c) {
56
+ case v:
57
57
  return "Fragment";
58
- case y:
58
+ case g:
59
59
  return "Profiler";
60
- case f:
60
+ case m:
61
61
  return "StrictMode";
62
- case P:
62
+ case x:
63
63
  return "Suspense";
64
- case G:
64
+ case D:
65
65
  return "SuspenseList";
66
- case Ge:
66
+ case ce:
67
67
  return "Activity";
68
68
  }
69
- if (typeof a == "object")
70
- switch (typeof a.tag == "number" && console.error(
69
+ if (typeof c == "object")
70
+ switch (typeof c.tag == "number" && console.error(
71
71
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
72
- ), a.$$typeof) {
73
- case N:
74
- return "Portal";
75
- case O:
76
- return (a.displayName || "Context") + ".Provider";
77
- case E:
78
- return (a._context.displayName || "Context") + ".Consumer";
72
+ ), c.$$typeof) {
79
73
  case C:
80
- var m = a.render;
81
- return a = a.displayName, a || (a = m.displayName || m.name || "", a = a !== "" ? "ForwardRef(" + a + ")" : "ForwardRef"), a;
82
- case Ye:
83
- return m = a.displayName || null, m !== null ? m : r(a.type) || "Memo";
84
- case ge:
85
- m = a._payload, a = a._init;
74
+ return "Portal";
75
+ case P:
76
+ return (c.displayName || "Context") + ".Provider";
77
+ case w:
78
+ return (c._context.displayName || "Context") + ".Consumer";
79
+ case T:
80
+ var h = c.render;
81
+ return c = c.displayName, c || (c = h.displayName || h.name || "", c = c !== "" ? "ForwardRef(" + c + ")" : "ForwardRef"), c;
82
+ case ae:
83
+ return h = c.displayName || null, h !== null ? h : r(c.type) || "Memo";
84
+ case H:
85
+ h = c._payload, c = c._init;
86
86
  try {
87
- return r(a(m));
87
+ return r(c(h));
88
88
  } catch {
89
89
  }
90
90
  }
91
91
  return null;
92
92
  }
93
- function e(a) {
94
- return "" + a;
93
+ function e(c) {
94
+ return "" + c;
95
95
  }
96
- function t(a) {
96
+ function t(c) {
97
97
  try {
98
- e(a);
99
- var m = !1;
98
+ e(c);
99
+ var h = !1;
100
100
  } catch {
101
- m = !0;
101
+ h = !0;
102
102
  }
103
- if (m) {
104
- m = console;
105
- var v = m.error, R = typeof Symbol == "function" && Symbol.toStringTag && a[Symbol.toStringTag] || a.constructor.name || "Object";
106
- return v.call(
107
- m,
103
+ if (h) {
104
+ h = console;
105
+ var S = h.error, R = typeof Symbol == "function" && Symbol.toStringTag && c[Symbol.toStringTag] || c.constructor.name || "Object";
106
+ return S.call(
107
+ h,
108
108
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
109
109
  R
110
- ), e(a);
110
+ ), e(c);
111
111
  }
112
112
  }
113
- function n(a) {
114
- if (a === S) return "<>";
115
- if (typeof a == "object" && a !== null && a.$$typeof === ge)
113
+ function n(c) {
114
+ if (c === v) return "<>";
115
+ if (typeof c == "object" && c !== null && c.$$typeof === H)
116
116
  return "<...>";
117
117
  try {
118
- var m = r(a);
119
- return m ? "<" + m + ">" : "<...>";
118
+ var h = r(c);
119
+ return h ? "<" + h + ">" : "<...>";
120
120
  } catch {
121
121
  return "<...>";
122
122
  }
123
123
  }
124
124
  function o() {
125
- var a = Z.A;
126
- return a === null ? null : a.getOwner();
125
+ var c = q.A;
126
+ return c === null ? null : c.getOwner();
127
127
  }
128
128
  function s() {
129
129
  return Error("react-stack-top-frame");
130
130
  }
131
- function i(a) {
132
- if (ye.call(a, "key")) {
133
- var m = Object.getOwnPropertyDescriptor(a, "key").get;
134
- if (m && m.isReactWarning) return !1;
131
+ function i(c) {
132
+ if (le.call(c, "key")) {
133
+ var h = Object.getOwnPropertyDescriptor(c, "key").get;
134
+ if (h && h.isReactWarning) return !1;
135
135
  }
136
- return a.key !== void 0;
136
+ return c.key !== void 0;
137
137
  }
138
- function c(a, m) {
139
- function v() {
140
- Se || (Se = !0, console.error(
138
+ function a(c, h) {
139
+ function S() {
140
+ X || (X = !0, console.error(
141
141
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
142
- m
142
+ h
143
143
  ));
144
144
  }
145
- v.isReactWarning = !0, Object.defineProperty(a, "key", {
146
- get: v,
145
+ S.isReactWarning = !0, Object.defineProperty(c, "key", {
146
+ get: S,
147
147
  configurable: !0
148
148
  });
149
149
  }
150
150
  function u() {
151
- var a = r(this.type);
152
- return be[a] || (be[a] = !0, console.error(
151
+ var c = r(this.type);
152
+ return de[c] || (de[c] = !0, console.error(
153
153
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
154
- )), a = this.props.ref, a !== void 0 ? a : null;
154
+ )), c = this.props.ref, c !== void 0 ? c : null;
155
155
  }
156
- function d(a, m, v, R, _, A, ee, te) {
157
- return v = A.ref, a = {
158
- $$typeof: w,
159
- type: a,
160
- key: m,
161
- props: A,
162
- _owner: _
163
- }, (v !== void 0 ? v : null) !== null ? Object.defineProperty(a, "ref", {
156
+ function d(c, h, S, R, M, j, W, Q) {
157
+ return S = j.ref, c = {
158
+ $$typeof: k,
159
+ type: c,
160
+ key: h,
161
+ props: j,
162
+ _owner: M
163
+ }, (S !== void 0 ? S : null) !== null ? Object.defineProperty(c, "ref", {
164
164
  enumerable: !1,
165
165
  get: u
166
- }) : Object.defineProperty(a, "ref", { enumerable: !1, value: null }), a._store = {}, Object.defineProperty(a._store, "validated", {
166
+ }) : Object.defineProperty(c, "ref", { enumerable: !1, value: null }), c._store = {}, Object.defineProperty(c._store, "validated", {
167
167
  configurable: !1,
168
168
  enumerable: !1,
169
169
  writable: !0,
170
170
  value: 0
171
- }), Object.defineProperty(a, "_debugInfo", {
171
+ }), Object.defineProperty(c, "_debugInfo", {
172
172
  configurable: !1,
173
173
  enumerable: !1,
174
174
  writable: !0,
175
175
  value: null
176
- }), Object.defineProperty(a, "_debugStack", {
176
+ }), Object.defineProperty(c, "_debugStack", {
177
177
  configurable: !1,
178
178
  enumerable: !1,
179
179
  writable: !0,
180
- value: ee
181
- }), Object.defineProperty(a, "_debugTask", {
180
+ value: W
181
+ }), Object.defineProperty(c, "_debugTask", {
182
182
  configurable: !1,
183
183
  enumerable: !1,
184
184
  writable: !0,
185
- value: te
186
- }), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
185
+ value: Q
186
+ }), Object.freeze && (Object.freeze(c.props), Object.freeze(c)), c;
187
187
  }
188
- function l(a, m, v, R, _, A, ee, te) {
189
- var k = m.children;
190
- if (k !== void 0)
188
+ function l(c, h, S, R, M, j, W, Q) {
189
+ var A = h.children;
190
+ if (A !== void 0)
191
191
  if (R)
192
- if (Xe(k)) {
193
- for (R = 0; R < k.length; R++)
194
- p(k[R]);
195
- Object.freeze && Object.freeze(k);
192
+ if (be(A)) {
193
+ for (R = 0; R < A.length; R++)
194
+ f(A[R]);
195
+ Object.freeze && Object.freeze(A);
196
196
  } else
197
197
  console.error(
198
198
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
199
199
  );
200
- else p(k);
201
- if (ye.call(m, "key")) {
202
- k = r(a);
203
- var L = Object.keys(m).filter(function(He) {
204
- return He !== "key";
200
+ else f(A);
201
+ if (le.call(h, "key")) {
202
+ A = r(c);
203
+ var V = Object.keys(h).filter(function(I) {
204
+ return I !== "key";
205
205
  });
206
- R = 0 < L.length ? "{key: someKey, " + L.join(": ..., ") + ": ...}" : "{key: someKey}", we[k + R] || (L = 0 < L.length ? "{" + L.join(": ..., ") + ": ...}" : "{}", console.error(
206
+ R = 0 < V.length ? "{key: someKey, " + V.join(": ..., ") + ": ...}" : "{key: someKey}", Z[A + R] || (V = 0 < V.length ? "{" + V.join(": ..., ") + ": ...}" : "{}", console.error(
207
207
  `A props object containing a "key" prop is being spread into JSX:
208
208
  let props = %s;
209
209
  <%s {...props} />
@@ -211,79 +211,79 @@ React keys must be passed directly to JSX without using spread:
211
211
  let props = %s;
212
212
  <%s key={someKey} {...props} />`,
213
213
  R,
214
- k,
215
- L,
216
- k
217
- ), we[k + R] = !0);
214
+ A,
215
+ V,
216
+ A
217
+ ), Z[A + R] = !0);
218
218
  }
219
- if (k = null, v !== void 0 && (t(v), k = "" + v), i(m) && (t(m.key), k = "" + m.key), "key" in m) {
220
- v = {};
221
- for (var re in m)
222
- re !== "key" && (v[re] = m[re]);
223
- } else v = m;
224
- return k && c(
225
- v,
226
- typeof a == "function" ? a.displayName || a.name || "Unknown" : a
219
+ if (A = null, S !== void 0 && (t(S), A = "" + S), i(h) && (t(h.key), A = "" + h.key), "key" in h) {
220
+ S = {};
221
+ for (var N in h)
222
+ N !== "key" && (S[N] = h[N]);
223
+ } else S = h;
224
+ return A && a(
225
+ S,
226
+ typeof c == "function" ? c.displayName || c.name || "Unknown" : c
227
227
  ), d(
228
- a,
229
- k,
228
+ c,
230
229
  A,
231
- _,
230
+ j,
231
+ M,
232
232
  o(),
233
- v,
234
- ee,
235
- te
233
+ S,
234
+ W,
235
+ Q
236
236
  );
237
237
  }
238
- function p(a) {
239
- typeof a == "object" && a !== null && a.$$typeof === w && a._store && (a._store.validated = 1);
238
+ function f(c) {
239
+ typeof c == "object" && c !== null && c.$$typeof === k && c._store && (c._store.validated = 1);
240
240
  }
241
- var h = Qe, w = Symbol.for("react.transitional.element"), N = Symbol.for("react.portal"), S = Symbol.for("react.fragment"), f = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), E = Symbol.for("react.consumer"), O = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), G = Symbol.for("react.suspense_list"), Ye = Symbol.for("react.memo"), ge = Symbol.for("react.lazy"), Ge = Symbol.for("react.activity"), Ke = Symbol.for("react.client.reference"), Z = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ye = Object.prototype.hasOwnProperty, Xe = Array.isArray, Q = console.createTask ? console.createTask : function() {
241
+ var p = yt, k = Symbol.for("react.transitional.element"), C = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), m = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), w = Symbol.for("react.consumer"), P = Symbol.for("react.context"), T = Symbol.for("react.forward_ref"), x = Symbol.for("react.suspense"), D = Symbol.for("react.suspense_list"), ae = Symbol.for("react.memo"), H = Symbol.for("react.lazy"), ce = Symbol.for("react.activity"), ue = Symbol.for("react.client.reference"), q = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, le = Object.prototype.hasOwnProperty, be = Array.isArray, J = console.createTask ? console.createTask : function() {
242
242
  return null;
243
243
  };
244
- h = {
245
- "react-stack-bottom-frame": function(a) {
246
- return a();
244
+ p = {
245
+ "react-stack-bottom-frame": function(c) {
246
+ return c();
247
247
  }
248
248
  };
249
- var Se, be = {}, ve = h["react-stack-bottom-frame"].bind(
250
- h,
249
+ var X, de = {}, B = p["react-stack-bottom-frame"].bind(
250
+ p,
251
251
  s
252
- )(), Ee = Q(n(s)), we = {};
253
- V.Fragment = S, V.jsx = function(a, m, v, R, _) {
254
- var A = 1e4 > Z.recentlyCreatedOwnerStacks++;
252
+ )(), fe = J(n(s)), Z = {};
253
+ te.Fragment = v, te.jsx = function(c, h, S, R, M) {
254
+ var j = 1e4 > q.recentlyCreatedOwnerStacks++;
255
255
  return l(
256
- a,
257
- m,
258
- v,
256
+ c,
257
+ h,
258
+ S,
259
259
  !1,
260
260
  R,
261
- _,
262
- A ? Error("react-stack-top-frame") : ve,
263
- A ? Q(n(a)) : Ee
261
+ M,
262
+ j ? Error("react-stack-top-frame") : B,
263
+ j ? J(n(c)) : fe
264
264
  );
265
- }, V.jsxs = function(a, m, v, R, _) {
266
- var A = 1e4 > Z.recentlyCreatedOwnerStacks++;
265
+ }, te.jsxs = function(c, h, S, R, M) {
266
+ var j = 1e4 > q.recentlyCreatedOwnerStacks++;
267
267
  return l(
268
- a,
269
- m,
270
- v,
268
+ c,
269
+ h,
270
+ S,
271
271
  !0,
272
272
  R,
273
- _,
274
- A ? Error("react-stack-top-frame") : ve,
275
- A ? Q(n(a)) : Ee
273
+ M,
274
+ j ? Error("react-stack-top-frame") : B,
275
+ j ? J(n(c)) : fe
276
276
  );
277
277
  };
278
- }()), V;
278
+ }()), te;
279
279
  }
280
- var Ne;
281
- function ot() {
282
- return Ne || (Ne = 1, process.env.NODE_ENV === "production" ? K.exports = rt() : K.exports = nt()), K.exports;
280
+ var Ve;
281
+ function Rt() {
282
+ return Ve || (Ve = 1, process.env.NODE_ENV === "production" ? he.exports = Et() : he.exports = kt()), he.exports;
283
283
  }
284
- var b = ot();
285
- function st(r, e) {
286
- const t = pe(
284
+ var b = Rt();
285
+ function At(r, e) {
286
+ const t = _e(
287
287
  (n) => r.subscribe(n),
288
288
  () => {
289
289
  const n = r.getSnapshot(), o = e ?? n.rootViewId, s = o ? n.views.get(o) : void 0;
@@ -294,7 +294,7 @@ function st(r, e) {
294
294
  return `${o ?? ""}:${s?.id ?? ""}`;
295
295
  }
296
296
  );
297
- return x(() => {
297
+ return L(() => {
298
298
  const [n, o] = t.split(":");
299
299
  return {
300
300
  rootViewId: n || void 0,
@@ -302,16 +302,16 @@ function st(r, e) {
302
302
  };
303
303
  }, [t]);
304
304
  }
305
- function M(r, e) {
306
- const t = pe(
305
+ function F(r, e) {
306
+ const t = _e(
307
307
  (n) => r.subscribeNode(e, n),
308
308
  () => r.getNodeVersion(e),
309
309
  () => r.getNodeVersion(e)
310
310
  );
311
- return x(() => r.getNode(e), [r, e, t]);
311
+ return L(() => r.getNode(e), [r, e, t]);
312
312
  }
313
- const it = he("UIRenderer");
314
- function at(r) {
313
+ const Nt = ye("UIRenderer");
314
+ function Ct(r) {
315
315
  if (r === void 0)
316
316
  return "{}";
317
317
  if (typeof r == "string")
@@ -322,18 +322,18 @@ function at(r) {
322
322
  return "{}";
323
323
  }
324
324
  }
325
- function ct(r) {
325
+ function It(r) {
326
326
  const e = r.styleIds;
327
327
  return Array.isArray(e) ? e : [];
328
328
  }
329
- function ut(r) {
329
+ function Tt(r) {
330
330
  const e = r.children;
331
331
  return Array.isArray(e) ? e : [];
332
332
  }
333
- function lt(r, e) {
333
+ function jt(r, e) {
334
334
  return r.nodeId === e.nodeId && r.context === e.context;
335
335
  }
336
- function dt(r) {
336
+ function Ot(r) {
337
337
  if (r.length === 0) return "";
338
338
  if (r.length === 1) return r[0].id;
339
339
  let e = r[0].id;
@@ -341,66 +341,66 @@ function dt(r) {
341
341
  e += "," + r[t].id;
342
342
  return e;
343
343
  }
344
- const ce = j(function r({ nodeId: e, context: t }) {
345
- const n = M(t.store, e), o = n ? ut(n) : [], s = dt(o), i = x(
346
- () => o.length === 0 ? null : o.map((p) => /* @__PURE__ */ b.jsx(r, { nodeId: p.id, context: t }, p.id)),
344
+ const Ce = U(function r({ nodeId: e, context: t }) {
345
+ const n = F(t.store, e), o = n ? Tt(n) : [], s = Ot(o), i = L(
346
+ () => o.length === 0 ? null : o.map((f) => /* @__PURE__ */ b.jsx(r, { nodeId: f.id, context: t }, f.id)),
347
347
  // eslint-disable-next-line react-hooks/exhaustive-deps
348
348
  [s, t]
349
349
  );
350
350
  if (!n)
351
351
  return null;
352
352
  if (n.type === "root")
353
- return /* @__PURE__ */ b.jsx(et, { children: i }, n.id);
354
- const c = t.library.resolve(n);
355
- if (!c)
356
- return it.warn(`No renderer for node type ${n.type}`), null;
357
- const u = ct(n), d = u.length > 0 ? u.join(" ") : void 0, l = c;
353
+ return /* @__PURE__ */ b.jsx(St, { children: i }, n.id);
354
+ const a = t.library.resolve(n);
355
+ if (!a)
356
+ return Nt.warn(`No renderer for node type ${n.type}`), null;
357
+ const u = It(n), d = u.length > 0 ? u.join(" ") : void 0, l = a;
358
358
  return /* @__PURE__ */ b.jsx(l, { nodeId: e, context: t, className: d });
359
- }, lt);
360
- function ft(r, e) {
361
- return !Array.isArray(r) || r.length === 0 ? null : r.map((t) => /* @__PURE__ */ b.jsx(ce, { nodeId: t.id, context: e }, t.id));
359
+ }, jt);
360
+ function Pt(r, e) {
361
+ return !Array.isArray(r) || r.length === 0 ? null : r.map((t) => /* @__PURE__ */ b.jsx(Ce, { nodeId: t.id, context: e }, t.id));
362
362
  }
363
- function mt(r, e) {
363
+ function _t(r, e) {
364
364
  return r.store === e.store && r.library === e.library && r.viewId === e.viewId && r.emptyFallback === e.emptyFallback;
365
365
  }
366
- const pt = j(function({ store: e, library: t, viewId: n, emptyFallback: o = null, onAction: s, client: i, video: c }) {
367
- const { rootViewId: u, rootNodeId: d } = st(e, n), l = I(s);
366
+ const Mt = U(function({ store: e, library: t, viewId: n, emptyFallback: o = null, onAction: s, client: i, video: a }) {
367
+ const { rootViewId: u, rootNodeId: d } = At(e, n), l = E(s);
368
368
  l.current = s;
369
- const p = I(i);
370
- p.current = i;
371
- const h = I(c);
372
- h.current = c;
373
- const w = ae((S, f) => {
374
- if (!S)
369
+ const f = E(i);
370
+ f.current = i;
371
+ const p = E(a);
372
+ p.current = a;
373
+ const k = z((v, m) => {
374
+ if (!v)
375
375
  return;
376
- const y = at(f);
377
- l.current?.(S, y);
378
- }, []), N = x(() => {
379
- const S = {
376
+ const g = Ct(m);
377
+ l.current?.(v, g);
378
+ }, []), C = L(() => {
379
+ const v = {
380
380
  store: e,
381
381
  library: t,
382
382
  handlerCache: e.handlerCache,
383
383
  // Access payloads from store at call time, not captured snapshot
384
- getPayload: (f) => e.getSnapshot().payloads.get(f),
385
- renderChildren: (f) => ft(f, S),
386
- renderView: (f) => {
387
- const y = e.getSnapshot().views.get(f);
388
- return y ? /* @__PURE__ */ b.jsx(ce, { nodeId: y.id, context: S }) : null;
384
+ getPayload: (m) => e.getSnapshot().payloads.get(m),
385
+ renderChildren: (m) => Pt(m, v),
386
+ renderView: (m) => {
387
+ const g = e.getSnapshot().views.get(m);
388
+ return g ? /* @__PURE__ */ b.jsx(Ce, { nodeId: g.id, context: v }) : null;
389
389
  },
390
- dispatchAction: w,
390
+ dispatchAction: k,
391
391
  // Access client/video via refs to avoid context recreation
392
392
  get client() {
393
- return p.current;
393
+ return f.current;
394
394
  },
395
395
  get video() {
396
- return h.current;
396
+ return p.current;
397
397
  }
398
398
  };
399
- return S;
400
- }, [e, t, w]);
401
- return !u || !d ? o : /* @__PURE__ */ b.jsx("div", { "data-ikon-view-id": u, style: { display: "contents" }, children: /* @__PURE__ */ b.jsx(ce, { nodeId: d, context: N }) });
402
- }, mt);
403
- class ht {
399
+ return v;
400
+ }, [e, t, k]);
401
+ return !u || !d ? o : /* @__PURE__ */ b.jsx("div", { "data-ikon-view-id": u, style: { display: "contents" }, children: /* @__PURE__ */ b.jsx(Ce, { nodeId: d, context: C }) });
402
+ }, _t);
403
+ class Lt {
404
404
  constructor(e, t) {
405
405
  if (this.fallback = t, e)
406
406
  for (const [n, o] of e)
@@ -417,60 +417,41 @@ class ht {
417
417
  return this.renderers.get(e.type) ?? this.fallback;
418
418
  }
419
419
  }
420
- function Pr(r, e) {
420
+ function hn(r, e) {
421
421
  const t = Object.entries(r);
422
- return new ht(t, e);
422
+ return new Lt(t, e);
423
423
  }
424
- function Lr(r) {
425
- return pe(
424
+ function mn(r) {
425
+ return _e(
426
426
  (e) => r.subscribe(e),
427
427
  () => r.getSnapshot(),
428
428
  () => r.getSnapshot()
429
429
  );
430
430
  }
431
- const ue = "ikon-ui";
432
- function gt(r, e) {
431
+ const Ie = "ikon-ui";
432
+ function Ut(r, e) {
433
433
  return r === e;
434
434
  }
435
- const xr = j(function({
436
- stores: e,
437
- library: t,
438
- category: n = ue,
439
- onAction: o,
440
- client: s,
441
- video: i
442
- }) {
443
- const c = x(() => Array.from(e.keys()).sort().join(","), [e]), u = I(o);
444
- u.current = o;
445
- const d = I(s);
446
- d.current = s;
447
- const l = I(i);
448
- l.current = i;
449
- const p = x(
435
+ const pn = U(function({ stores: e, registry: t, category: n = Ie, onAction: o, client: s }) {
436
+ const i = L(() => Array.from(e.keys()).sort().join(","), [e]), a = E(o);
437
+ a.current = o;
438
+ const u = E(s);
439
+ u.current = s;
440
+ const d = L(
450
441
  () => {
451
- const h = [];
452
- for (const [w, N] of e) {
453
- const S = N.store.getSnapshot();
454
- gt(N.category, n) && (!S.rootViewId || !S.views.has(S.rootViewId) || h.push({ key: w, store: N.store }));
442
+ const l = [];
443
+ for (const [f, p] of e) {
444
+ const k = p.store.getSnapshot();
445
+ Ut(p.category, n) && (!k.rootViewId || !k.views.has(k.rootViewId) || l.push({ key: f, store: p.store }));
455
446
  }
456
- return h;
447
+ return l;
457
448
  },
458
449
  // eslint-disable-next-line react-hooks/exhaustive-deps
459
- [e, n, c]
450
+ [e, n, i]
460
451
  );
461
- return p.length === 0 ? null : /* @__PURE__ */ b.jsx(b.Fragment, { children: p.map(({ key: h, store: w }) => /* @__PURE__ */ b.jsx(
462
- pt,
463
- {
464
- store: w,
465
- library: t,
466
- onAction: u.current,
467
- client: d.current,
468
- video: l.current
469
- },
470
- h
471
- )) });
452
+ return d.length === 0 ? null : /* @__PURE__ */ b.jsx(b.Fragment, { children: d.map(({ key: l, store: f }) => /* @__PURE__ */ b.jsx(Mt, { store: f, library: t, onAction: a.current, client: u.current, video: u.current?.media?.video }, l)) });
472
453
  });
473
- class Ur {
454
+ class xt {
474
455
  core;
475
456
  ownsCore;
476
457
  stores = /* @__PURE__ */ new Map();
@@ -478,7 +459,7 @@ class Ur {
478
459
  unsubscribeClears;
479
460
  unsubscribeStoreChanges;
480
461
  constructor(e) {
481
- this.core = e?.core ?? new Je({ client: e?.client }), this.ownsCore = !e?.core, this.unsubscribeClears = this.core.subscribeToUiStreamCleared(this.handleUiStreamCleared), this.unsubscribeStoreChanges = this.core.uiStore.subscribe(this.syncStreamSnapshot), this.syncAllStreams();
462
+ this.core = e?.core ?? new pt({ client: e?.client }), this.ownsCore = !e?.core, this.unsubscribeClears = this.core.subscribeToUiStreamCleared(this.handleUiStreamCleared), this.unsubscribeStoreChanges = this.core.uiStore.subscribe(this.syncStreamSnapshot), this.syncAllStreams();
482
463
  }
483
464
  dispose() {
484
465
  this.unsubscribeClears(), this.unsubscribeStoreChanges(), this.ownsCore && this.core.dispose(), this.listeners.clear(), this.stores.clear();
@@ -525,8 +506,8 @@ class Ur {
525
506
  if (t)
526
507
  return t;
527
508
  const n = {
528
- category: ue,
529
- store: new Ze()
509
+ category: Ie,
510
+ store: new gt()
530
511
  };
531
512
  return this.stores.set(e, n), n;
532
513
  }
@@ -534,7 +515,7 @@ class Ur {
534
515
  const n = this.stores.get(e);
535
516
  if (!n)
536
517
  return !1;
537
- const o = t ?? this.core.uiStore.getSnapshot(e)?.category ?? ue;
518
+ const o = t ?? this.core.uiStore.getSnapshot(e)?.category ?? Ie;
538
519
  return n.category === o ? !1 : (this.stores.set(e, { ...n, category: o }), !0);
539
520
  }
540
521
  notify(e) {
@@ -542,7 +523,7 @@ class Ur {
542
523
  t(e);
543
524
  }
544
525
  }
545
- function $(r) {
526
+ function G(r) {
546
527
  if (typeof r == "string") {
547
528
  const e = r.trim();
548
529
  return e.length > 0 ? e : void 0;
@@ -552,7 +533,7 @@ function $(r) {
552
533
  return e.length > 0 ? e.join(" ") : void 0;
553
534
  }
554
535
  }
555
- function W(...r) {
536
+ function se(...r) {
556
537
  let e = "";
557
538
  for (const t of r)
558
539
  if (t) {
@@ -561,29 +542,29 @@ function W(...r) {
561
542
  }
562
543
  return e || void 0;
563
544
  }
564
- const Te = /* @__PURE__ */ new WeakMap(), yt = {};
565
- function Y(r) {
545
+ const ze = /* @__PURE__ */ new WeakMap(), $t = {};
546
+ function ie(r) {
566
547
  if (!r)
567
- return yt;
568
- const e = Te.get(r);
548
+ return $t;
549
+ const e = ze.get(r);
569
550
  if (e)
570
551
  return e;
571
552
  const t = {};
572
553
  for (const [n, o] of Object.entries(r))
573
554
  o != null && (typeof o == "string" || typeof o == "number" || typeof o == "boolean") && (t[n] = o);
574
- return Te.set(r, t), t;
555
+ return ze.set(r, t), t;
575
556
  }
576
- function St() {
577
- const r = j(function({ nodeId: t, context: n }) {
578
- const o = M(n.store, t), s = I(null), i = $(o?.props?.targetViewId), c = o?.props?.focusOnly, u = typeof c == "boolean" ? c : void 0;
579
- return q(() => {
557
+ function Ft() {
558
+ const r = U(function({ nodeId: t, context: n }) {
559
+ const o = F(n.store, t), s = E(null), i = G(o?.props?.targetViewId), a = o?.props?.focusOnly, u = typeof a == "boolean" ? a : void 0;
560
+ return $(() => {
580
561
  if (typeof document > "u")
581
562
  return;
582
563
  const l = s.current;
583
564
  if (!l || i && l.closest("[data-ikon-view-id]")?.getAttribute("data-ikon-view-id") !== i)
584
565
  return;
585
- const p = u !== !0;
586
- if (p && typeof l.scrollIntoView == "function")
566
+ const f = u !== !0;
567
+ if (f && typeof l.scrollIntoView == "function")
587
568
  try {
588
569
  l.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
589
570
  } catch {
@@ -591,7 +572,7 @@ function St() {
591
572
  }
592
573
  if (typeof l.focus == "function")
593
574
  try {
594
- l.focus({ preventScroll: !p });
575
+ l.focus({ preventScroll: !f });
595
576
  } catch {
596
577
  l.focus();
597
578
  }
@@ -612,31 +593,31 @@ function St() {
612
593
  return r;
613
594
  };
614
595
  }
615
- function bt() {
616
- const r = j(function({ nodeId: t, context: n, className: o }) {
617
- const s = M(n.store, t);
596
+ function Bt() {
597
+ const r = U(function({ nodeId: t, context: n, className: o }) {
598
+ const s = F(n.store, t);
618
599
  if (!s)
619
600
  return null;
620
- const i = Y(s.props), c = W($(s.props?.className), o), u = s.children?.length ? n.renderChildren(s.children) : void 0;
621
- return /* @__PURE__ */ b.jsx("div", { ...i, "data-ikon-node-id": s.id, className: c, children: u });
601
+ const i = ie(s.props), a = se(G(s.props?.className), o), u = s.children?.length ? n.renderChildren(s.children) : void 0;
602
+ return /* @__PURE__ */ b.jsx("div", { ...i, "data-ikon-node-id": s.id, className: a, children: u });
622
603
  });
623
604
  return ({ type: e }) => {
624
605
  if (e === "common.div")
625
606
  return r;
626
607
  };
627
608
  }
628
- function vt() {
629
- const r = j(function({ nodeId: t, context: n, className: o }) {
630
- const s = M(n.store, t);
609
+ function Vt() {
610
+ const r = U(function({ nodeId: t, context: n, className: o }) {
611
+ const s = F(n.store, t);
631
612
  if (!s)
632
613
  return null;
633
- const i = Y(s.props), c = W($(s.props?.className), o), u = s.children?.length ? n.renderChildren(s.children) : void 0;
614
+ const i = ie(s.props), a = se(G(s.props?.className), o), u = s.children?.length ? n.renderChildren(s.children) : void 0;
634
615
  return /* @__PURE__ */ b.jsx(
635
616
  "form",
636
617
  {
637
618
  ...i,
638
619
  "data-ikon-node-id": s.id,
639
- className: c,
620
+ className: a,
640
621
  onSubmit: (d) => d.preventDefault(),
641
622
  children: u
642
623
  }
@@ -647,12 +628,12 @@ function vt() {
647
628
  return r;
648
629
  };
649
630
  }
650
- function Et() {
651
- const r = j(function({ nodeId: t, context: n, className: o }) {
652
- const s = M(n.store, t);
631
+ function zt() {
632
+ const r = U(function({ nodeId: t, context: n, className: o }) {
633
+ const s = F(n.store, t);
653
634
  if (!s)
654
635
  return null;
655
- const i = Y(s.props), c = W($(s.props?.className), o), u = s.children?.length ? n.renderChildren(s.children) : void 0;
636
+ const i = ie(s.props), a = se(G(s.props?.className), o), u = s.children?.length ? n.renderChildren(s.children) : void 0;
656
637
  return /* @__PURE__ */ b.jsx(
657
638
  "div",
658
639
  {
@@ -660,7 +641,7 @@ function Et() {
660
641
  "data-ikon-node-id": s.id,
661
642
  "data-ikon-view-type": "scroll-view",
662
643
  "data-ikon-scroll-container": "true",
663
- className: c,
644
+ className: a,
664
645
  children: u
665
646
  }
666
647
  );
@@ -670,47 +651,47 @@ function Et() {
670
651
  return r;
671
652
  };
672
653
  }
673
- function wt() {
674
- const r = j(function({ nodeId: t, context: n, className: o }) {
675
- const s = M(n.store, t);
654
+ function Dt() {
655
+ const r = U(function({ nodeId: t, context: n, className: o }) {
656
+ const s = F(n.store, t);
676
657
  if (!s)
677
658
  return null;
678
- const i = Y(s.props), c = W("relative", $(s.props?.className), o), u = s.children?.length ? n.renderChildren(s.children) : void 0;
679
- return /* @__PURE__ */ b.jsx("div", { ...i, "data-ikon-node-id": s.id, className: c, children: u });
659
+ const i = ie(s.props), a = se("relative", G(s.props?.className), o), u = s.children?.length ? n.renderChildren(s.children) : void 0;
660
+ return /* @__PURE__ */ b.jsx("div", { ...i, "data-ikon-node-id": s.id, className: a, children: u });
680
661
  });
681
662
  return ({ type: e }) => {
682
663
  if (e === "common.stack")
683
664
  return r;
684
665
  };
685
666
  }
686
- function Rt() {
687
- const r = j(function({ nodeId: t, context: n, className: o }) {
688
- const s = M(n.store, t);
667
+ function qt() {
668
+ const r = U(function({ nodeId: t, context: n, className: o }) {
669
+ const s = F(n.store, t);
689
670
  if (!s)
690
671
  return null;
691
- const i = Y(s.props), c = W("absolute", $(s.props?.className), o), u = s.children?.length ? n.renderChildren(s.children) : void 0;
692
- return /* @__PURE__ */ b.jsx("div", { ...i, "data-ikon-node-id": s.id, className: c, children: u });
672
+ const i = ie(s.props), a = se("absolute", G(s.props?.className), o), u = s.children?.length ? n.renderChildren(s.children) : void 0;
673
+ return /* @__PURE__ */ b.jsx("div", { ...i, "data-ikon-node-id": s.id, className: a, children: u });
693
674
  });
694
675
  return ({ type: e }) => {
695
676
  if (e === "common.layer")
696
677
  return r;
697
678
  };
698
679
  }
699
- function kt() {
680
+ function Wt() {
700
681
  return [
701
- bt(),
702
- vt(),
703
- Et(),
704
- wt(),
705
- Rt(),
706
- St()
682
+ Bt(),
683
+ Vt(),
684
+ zt(),
685
+ Dt(),
686
+ qt(),
687
+ Ft()
707
688
  ];
708
689
  }
709
- const Nt = "base", Tt = async () => kt();
710
- function Ct(r) {
711
- r.registerModule(Nt, Tt);
690
+ const Yt = "base", Jt = async () => Wt();
691
+ function Kt(r) {
692
+ r.registerModule(Yt, Jt);
712
693
  }
713
- function Ve(r) {
694
+ function ot(r) {
714
695
  if (typeof r == "string") {
715
696
  const e = r.trim();
716
697
  return e.length > 0 ? e : void 0;
@@ -720,13 +701,13 @@ function Ve(r) {
720
701
  return e.length > 0 ? e.join(" ") : void 0;
721
702
  }
722
703
  }
723
- function Be(...r) {
704
+ function st(...r) {
724
705
  const e = [];
725
706
  for (const t of r)
726
707
  t && t.trim() && e.push(t.trim());
727
708
  return e.length > 0 ? e.join(" ") : void 0;
728
709
  }
729
- function X(r) {
710
+ function pe(r) {
730
711
  if (typeof r == "number" && Number.isFinite(r))
731
712
  return Math.floor(r);
732
713
  if (typeof r == "string" && r.trim().length > 0) {
@@ -735,43 +716,43 @@ function X(r) {
735
716
  return Math.floor(e);
736
717
  }
737
718
  }
738
- function le(r) {
719
+ function Te(r) {
739
720
  if (typeof r != "string")
740
721
  return;
741
722
  const e = r.trim();
742
723
  return e.length > 0 ? e : void 0;
743
724
  }
744
- const jt = "media.video-canvas", Ot = "media.video-url-player";
745
- function At() {
746
- const r = j(function({ nodeId: t, context: n, className: o }) {
747
- const s = M(n.store, t), i = I(null), c = n.video, u = s ? le(s.props?.streamId) : void 0, d = s ? X(s.props?.width) : void 0, l = s ? X(s.props?.height) : void 0, p = s ? Be(Ve(s.props?.className), o) : o;
748
- return q(() => {
749
- const h = i.current;
750
- if (!(!c || !h || !u))
751
- return c.attachCanvas(u, h), () => {
752
- c.detachCanvas(u);
725
+ const Gt = "media.video-canvas", Ht = "media.video-url-player";
726
+ function Xt() {
727
+ const r = U(function({ nodeId: t, context: n, className: o }) {
728
+ const s = F(n.store, t), i = E(null), a = n.video, u = s ? Te(s.props?.streamId) : void 0, d = s ? pe(s.props?.width) : void 0, l = s ? pe(s.props?.height) : void 0, f = s ? st(ot(s.props?.className), o) : o;
729
+ return $(() => {
730
+ const p = i.current;
731
+ if (!(!a || !p || !u))
732
+ return a.attachCanvas(u, p), () => {
733
+ a.detachCanvas(u);
753
734
  };
754
- }, [c, u]), s ? /* @__PURE__ */ b.jsx(
735
+ }, [a, u]), s ? /* @__PURE__ */ b.jsx(
755
736
  "canvas",
756
737
  {
757
738
  ref: i,
758
739
  "data-ikon-node-id": s.id,
759
740
  "data-ikon-video-stream-id": u,
760
- className: p,
741
+ className: f,
761
742
  ...d ? { width: d } : {},
762
743
  ...l ? { height: l } : {}
763
744
  }
764
745
  ) : null;
765
746
  });
766
747
  return ({ type: e }) => {
767
- if (e === jt)
748
+ if (e === Gt)
768
749
  return r;
769
750
  };
770
751
  }
771
- function It() {
772
- return [At(), Mt()];
752
+ function Zt() {
753
+ return [Xt(), Qt()];
773
754
  }
774
- function B(r) {
755
+ function re(r) {
775
756
  if (typeof r == "boolean")
776
757
  return r;
777
758
  if (typeof r == "string") {
@@ -780,45 +761,45 @@ function B(r) {
780
761
  if (e === "false") return !1;
781
762
  }
782
763
  }
783
- function Mt() {
784
- const r = j(function({
764
+ function Qt() {
765
+ const r = U(function({
785
766
  nodeId: t,
786
767
  context: n,
787
768
  className: o
788
769
  }) {
789
- const s = M(n.store, t);
770
+ const s = F(n.store, t);
790
771
  if (!s)
791
772
  return null;
792
- const i = Be(Ve(s.props?.className), o), c = le(s.props?.src), u = le(s.props?.poster), d = B(s.props?.controls), l = B(s.props?.autoplay), p = B(s.props?.loop), h = B(s.props?.muted), w = B(s.props?.playsInline), N = X(s.props?.width), S = X(s.props?.height), f = s.children?.length ? n.renderChildren(s.children) : void 0;
773
+ const i = st(ot(s.props?.className), o), a = Te(s.props?.src), u = Te(s.props?.poster), d = re(s.props?.controls), l = re(s.props?.autoplay), f = re(s.props?.loop), p = re(s.props?.muted), k = re(s.props?.playsInline), C = pe(s.props?.width), v = pe(s.props?.height), m = s.children?.length ? n.renderChildren(s.children) : void 0;
793
774
  return /* @__PURE__ */ b.jsx(
794
775
  "video",
795
776
  {
796
- src: c,
777
+ src: a,
797
778
  poster: u,
798
779
  ...d !== void 0 ? { controls: d } : {},
799
780
  ...l !== void 0 ? { autoPlay: l } : {},
800
- ...p !== void 0 ? { loop: p } : {},
801
- ...h !== void 0 ? { muted: h } : {},
802
- ...w !== void 0 ? { playsInline: w } : {},
803
- ...N ? { width: N } : {},
804
- ...S ? { height: S } : {},
781
+ ...f !== void 0 ? { loop: f } : {},
782
+ ...p !== void 0 ? { muted: p } : {},
783
+ ...k !== void 0 ? { playsInline: k } : {},
784
+ ...C ? { width: C } : {},
785
+ ...v ? { height: v } : {},
805
786
  "data-ikon-node-id": s.id,
806
787
  className: i,
807
- children: f
788
+ children: m
808
789
  }
809
790
  );
810
791
  });
811
792
  return ({ type: e }) => {
812
- if (e === Ot)
793
+ if (e === Ht)
813
794
  return r;
814
795
  };
815
796
  }
816
- const _t = "media", Pt = async () => It();
817
- function Lt(r) {
818
- r.registerModule(_t, Pt);
797
+ const er = "media", tr = async () => Zt();
798
+ function rr(r) {
799
+ r.registerModule(er, tr);
819
800
  }
820
- const Ce = he("UIRegistry");
821
- class xt {
801
+ const De = ye("UIRegistry");
802
+ class nr {
822
803
  baseResolvers = [];
823
804
  moduleLoaders = /* @__PURE__ */ new Map();
824
805
  moduleResolvers = /* @__PURE__ */ new Map();
@@ -840,15 +821,15 @@ class xt {
840
821
  for (const [n, o] of this.moduleLoaders.entries())
841
822
  if (!this.moduleResolvers.has(n))
842
823
  try {
843
- const s = await o(), i = $t(s);
824
+ const s = await o(), i = ir(s);
844
825
  this.moduleResolvers.set(n, i), e = !0;
845
826
  } catch (s) {
846
- Ce.error(`[IkonUiRegistry] Failed to load module '${n}'.`, s);
827
+ De.error(`[IkonUiRegistry] Failed to load module '${n}'.`, s);
847
828
  }
848
829
  const t = [];
849
830
  for (const n of this.moduleLoaders.keys())
850
831
  this.moduleResolvers.has(n) && t.push(n);
851
- return Ft(t, this.activeModuleOrder) || (this.activeModuleOrder = t, e = !0), e;
832
+ return ar(t, this.activeModuleOrder) || (this.activeModuleOrder = t, e = !0), e;
852
833
  }
853
834
  resolve(e) {
854
835
  for (const t of this.baseResolvers) {
@@ -858,7 +839,7 @@ class xt {
858
839
  for (const t of this.activeModuleOrder) {
859
840
  const n = this.moduleResolvers.get(t);
860
841
  if (!n) {
861
- Ce.warn(`Missing resolvers for module ${t}`);
842
+ De.warn(`Missing resolvers for module ${t}`);
862
843
  continue;
863
844
  }
864
845
  for (const o of n) {
@@ -868,17 +849,17 @@ class xt {
868
849
  }
869
850
  }
870
851
  }
871
- function $r() {
872
- const r = new xt();
873
- return Ct(r), Lt(r), r.loadRegisteredModules(), r;
852
+ function or() {
853
+ const r = new nr();
854
+ return Kt(r), rr(r), r.loadRegisteredModules(), r;
874
855
  }
875
- function Ut(r) {
856
+ function sr(r) {
876
857
  return Array.isArray(r) ? r : [r];
877
858
  }
878
- function $t(r) {
879
- return r ? Ut(r).flatMap((e) => e ? Array.isArray(e) ? e.filter(Boolean) : [e] : []) : [];
859
+ function ir(r) {
860
+ return r ? sr(r).flatMap((e) => e ? Array.isArray(e) ? e.filter(Boolean) : [e] : []) : [];
880
861
  }
881
- function Ft(r, e) {
862
+ function ar(r, e) {
882
863
  if (r.length !== e.length)
883
864
  return !1;
884
865
  for (let t = 0; t < r.length; t += 1)
@@ -886,7 +867,7 @@ function Ft(r, e) {
886
867
  return !1;
887
868
  return !0;
888
869
  }
889
- const ne = he("MotionController"), je = {
870
+ const ve = ye("MotionController"), qe = {
890
871
  ease: [0.25, 0.1, 0.25, 1],
891
872
  "ease-in": [0.42, 0, 1, 1],
892
873
  "ease-out": [0, 0, 0.58, 1],
@@ -916,88 +897,88 @@ const ne = he("MotionController"), je = {
916
897
  "ease-out-back": [0.175, 0.885, 0.32, 1.275],
917
898
  "ease-in-out-back": [0.68, -0.55, 0.265, 1.55]
918
899
  };
919
- function T(r) {
900
+ function O(r) {
920
901
  return r <= 0 ? 0 : r >= 1 ? 1 : r;
921
902
  }
922
- function Oe(r) {
903
+ function We(r) {
923
904
  if (r == null) return;
924
905
  const e = `${r}`.trim();
925
906
  if (!e) return;
926
907
  const t = Number.parseFloat(e);
927
908
  return Number.isFinite(t) ? t : void 0;
928
909
  }
929
- function Ae(r) {
910
+ function Ye(r) {
930
911
  return typeof CSS < "u" && CSS.escape ? CSS.escape(r) : r.replace(/[^a-zA-Z0-9_-]/g, (e) => `\\${e}`);
931
912
  }
932
- function Ie(r, e, t, n) {
913
+ function Je(r, e, t, n) {
933
914
  const l = new Float32Array(11);
934
- function p(f, y, E) {
935
- return ((3 * y - 3 * E + 1) * f + (3 * E - 6 * y)) * f * f + 3 * y * f;
936
- }
937
- function h(f, y, E) {
938
- return 3 * (3 * y - 3 * E + 1) * f * f + 2 * (3 * E - 6 * y) * f + 3 * y;
939
- }
940
- function w(f, y) {
941
- for (let E = 0; E < 4; E += 1) {
942
- const O = h(y, r, t);
943
- if (O === 0)
944
- return y;
945
- const C = p(y, r, t) - f;
946
- y -= C / O;
915
+ function f(m, g, w) {
916
+ return ((3 * g - 3 * w + 1) * m + (3 * w - 6 * g)) * m * m + 3 * g * m;
917
+ }
918
+ function p(m, g, w) {
919
+ return 3 * (3 * g - 3 * w + 1) * m * m + 2 * (3 * w - 6 * g) * m + 3 * g;
920
+ }
921
+ function k(m, g) {
922
+ for (let w = 0; w < 4; w += 1) {
923
+ const P = p(g, r, t);
924
+ if (P === 0)
925
+ return g;
926
+ const T = f(g, r, t) - m;
927
+ g -= T / P;
947
928
  }
948
- return y;
929
+ return g;
949
930
  }
950
- function N(f, y, E) {
951
- let O = 0, C = 0, P = 0;
931
+ function C(m, g, w) {
932
+ let P = 0, T = 0, x = 0;
952
933
  do
953
- C = y + (E - y) / 2, O = p(C, r, t) - f, O > 0 ? E = C : y = C;
954
- while (Math.abs(O) > 1e-7 && ++P < 10);
955
- return C;
956
- }
957
- function S(f) {
958
- let y = 0, E = 1;
959
- const O = 10;
960
- for (; E !== O && l[E] <= f; E += 1)
961
- y += 0.1;
962
- E -= 1;
963
- const C = (f - l[E]) / (l[E + 1] - l[E]), P = y + C * 0.1, G = h(P, r, t);
964
- return G >= 1e-3 ? w(f, P) : G === 0 ? P : N(f, y, y + 0.1);
965
- }
966
- for (let f = 0; f < 11; f += 1)
967
- l[f] = p(f * 0.1, r, t);
968
- return (f) => f <= 0 ? 0 : f >= 1 ? 1 : p(S(f), e, n);
969
- }
970
- function Vt(r) {
934
+ T = g + (w - g) / 2, P = f(T, r, t) - m, P > 0 ? w = T : g = T;
935
+ while (Math.abs(P) > 1e-7 && ++x < 10);
936
+ return T;
937
+ }
938
+ function v(m) {
939
+ let g = 0, w = 1;
940
+ const P = 10;
941
+ for (; w !== P && l[w] <= m; w += 1)
942
+ g += 0.1;
943
+ w -= 1;
944
+ const T = (m - l[w]) / (l[w + 1] - l[w]), x = g + T * 0.1, D = p(x, r, t);
945
+ return D >= 1e-3 ? k(m, x) : D === 0 ? x : C(m, g, g + 0.1);
946
+ }
947
+ for (let m = 0; m < 11; m += 1)
948
+ l[m] = f(m * 0.1, r, t);
949
+ return (m) => m <= 0 ? 0 : m >= 1 ? 1 : f(v(m), e, n);
950
+ }
951
+ function cr(r) {
971
952
  const e = /steps\(\s*([0-9]+)\s*(?:,\s*([a-z-]+)\s*)?\)/i.exec(r);
972
953
  if (!e)
973
- return (o) => T(o);
954
+ return (o) => O(o);
974
955
  const t = Math.max(1, parseInt(e[1], 10)), n = (e[2] ?? "end").toLowerCase();
975
- return n === "start" || n === "jump-start" ? (o) => T(Math.ceil(o * t) / t) : n === "none" || n === "jump-none" ? (o) => T(Math.round(o * t) / t) : n === "both" || n === "jump-both" ? (o) => T((Math.floor(o * t) + 0.5) / t) : (o) => T(Math.floor(o * t) / t);
956
+ return n === "start" || n === "jump-start" ? (o) => O(Math.ceil(o * t) / t) : n === "none" || n === "jump-none" ? (o) => O(Math.round(o * t) / t) : n === "both" || n === "jump-both" ? (o) => O((Math.floor(o * t) + 0.5) / t) : (o) => O(Math.floor(o * t) / t);
976
957
  }
977
- function Bt(r) {
958
+ function ur(r) {
978
959
  if (!r)
979
- return (t) => T(t);
960
+ return (t) => O(t);
980
961
  const e = r.trim().toLowerCase();
981
962
  if (!e || e === "linear")
982
- return (t) => T(t);
983
- if (je[e]) {
984
- const [t, n, o, s] = je[e], i = Ie(t, n, o, s);
985
- return (c) => T(i(T(c)));
963
+ return (t) => O(t);
964
+ if (qe[e]) {
965
+ const [t, n, o, s] = qe[e], i = Je(t, n, o, s);
966
+ return (a) => O(i(O(a)));
986
967
  }
987
968
  if (e.startsWith("cubic-bezier(") && e.endsWith(")")) {
988
969
  const n = e.slice(13, -1).split(",").map((o) => Number.parseFloat(o.trim()));
989
970
  if (n.length === 4 && n.every((o) => Number.isFinite(o))) {
990
- const [o, s, i, c] = n, u = Ie(o, s, i, c);
991
- return (d) => T(u(T(d)));
971
+ const [o, s, i, a] = n, u = Je(o, s, i, a);
972
+ return (d) => O(u(O(d)));
992
973
  }
993
974
  }
994
975
  if (e.startsWith("steps(") && e.endsWith(")")) {
995
- const t = Vt(e);
996
- return (n) => t(T(n));
976
+ const t = cr(e);
977
+ return (n) => t(O(n));
997
978
  }
998
- return (t) => T(t);
979
+ return (t) => O(t);
999
980
  }
1000
- function zt(r) {
981
+ function lr(r) {
1001
982
  if (!r)
1002
983
  return;
1003
984
  const e = /(-?\d+(?:\.\d+)?)\s*\.\.\s*(-?\d+(?:\.\d+)?)\s*->\s*(-?\d+(?:\.\d+)?)\s*\.\.\s*(-?\d+(?:\.\d+)?)/.exec(r);
@@ -1007,7 +988,7 @@ function zt(r) {
1007
988
  if (![t, n, o, s].some((i) => !Number.isFinite(i)))
1008
989
  return { inStart: t, inEnd: n, outStart: o, outEnd: s };
1009
990
  }
1010
- class Dt {
991
+ class dr {
1011
992
  bindingsByStyle = /* @__PURE__ */ new Map();
1012
993
  observer;
1013
994
  observeScheduled = !1;
@@ -1031,7 +1012,7 @@ class Dt {
1031
1012
  try {
1032
1013
  e();
1033
1014
  } catch (t) {
1034
- ne.warn("Failed to cleanup binding listener", t);
1015
+ ve.warn("Failed to cleanup binding listener", t);
1035
1016
  }
1036
1017
  this.globalCleanups.clear(), this.elementStates.clear(), this.styleToElements.clear(), this.bindingsByStyle.clear(), this.pendingScanStyles.clear(), this.scanScheduled = !1, this.observer && (this.observer.disconnect(), this.observer = void 0);
1037
1018
  }
@@ -1041,7 +1022,7 @@ class Dt {
1041
1022
  const n = (JSON.parse(e).motionBindings ?? []).map((o) => this.parseBinding(o)).filter((o) => o !== void 0);
1042
1023
  return n.length === 0 ? void 0 : { bindings: n };
1043
1024
  } catch (t) {
1044
- ne.warn("Failed to parse motion metadata", t);
1025
+ ve.warn("Failed to parse motion metadata", t);
1045
1026
  return;
1046
1027
  }
1047
1028
  }
@@ -1049,13 +1030,13 @@ class Dt {
1049
1030
  const t = e.source?.trim();
1050
1031
  if (!t)
1051
1032
  return;
1052
- const n = Oe(e.min) ?? 0, o = Oe(e.max), s = o === void 0 ? n + 100 : o, i = (e.clamp ?? "clamp").trim().toLowerCase(), c = !!e.reverse, u = Bt(e.ease), d = zt(e.map), l = e.targetId?.trim() || void 0;
1033
+ const n = We(e.min) ?? 0, o = We(e.max), s = o === void 0 ? n + 100 : o, i = (e.clamp ?? "clamp").trim().toLowerCase(), a = !!e.reverse, u = ur(e.ease), d = lr(e.map), l = e.targetId?.trim() || void 0;
1053
1034
  return Number.isNaN(n) || Number.isNaN(s) ? void 0 : {
1054
1035
  source: t.toLowerCase(),
1055
1036
  min: n,
1056
1037
  max: s,
1057
1038
  clamp: i === "freeze-start" || i === "freeze-end" || i === "unclamped" ? i : "clamp",
1058
- reverse: c,
1039
+ reverse: a,
1059
1040
  ease: u,
1060
1041
  map: d,
1061
1042
  targetId: l
@@ -1107,7 +1088,7 @@ class Dt {
1107
1088
  const t = this.bindingsByStyle.get(e);
1108
1089
  if (!t || typeof document > "u")
1109
1090
  return;
1110
- const n = `.${Ae(e)}`;
1091
+ const n = `.${Ye(e)}`;
1111
1092
  document.querySelectorAll(n).forEach((s) => this.applyStyleToElement(s, e, t));
1112
1093
  }
1113
1094
  applyStyleToElement(e, t, n) {
@@ -1142,12 +1123,12 @@ class Dt {
1142
1123
  s();
1143
1124
  const i = new AbortController();
1144
1125
  o.addEventListener("scroll", s, { passive: !0, signal: i.signal }), this.registerCleanup(e, t, () => i.abort());
1145
- const c = () => s();
1146
- window.addEventListener("resize", c), this.registerCleanup(e, t, () => window.removeEventListener("resize", c));
1126
+ const a = () => s();
1127
+ window.addEventListener("resize", a), this.registerCleanup(e, t, () => window.removeEventListener("resize", a));
1147
1128
  }
1148
1129
  resolveScrollContainer(e, t) {
1149
1130
  if (t.targetId) {
1150
- const n = `[data-ikon-motion-source="${Ae(t.targetId)}"]`, o = typeof document < "u" ? document.querySelector(n) : null;
1131
+ const n = `[data-ikon-motion-source="${Ye(t.targetId)}"]`, o = typeof document < "u" ? document.querySelector(n) : null;
1151
1132
  if (o)
1152
1133
  return o;
1153
1134
  }
@@ -1157,7 +1138,7 @@ class Dt {
1157
1138
  const o = t.max - t.min, s = o === 0 ? n > t.min ? 1 : 0 : (n - t.min) / o;
1158
1139
  let i = this.applyClamp(s, t.clamp);
1159
1140
  t.reverse && (i = 1 - i);
1160
- const c = t.ease(i), u = Number.isFinite(c) ? c : 0, d = u * 100;
1141
+ const a = t.ease(i), u = Number.isFinite(a) ? a : 0, d = u * 100;
1161
1142
  if (e.style.setProperty("--tw-motion-bind-source-value", `${n}`), e.style.setProperty("--tw-motion-bind-progress-ratio", `${u}`), e.style.setProperty("--tw-motion-bind-progress", `${d}`), t.map) {
1162
1143
  const l = this.applyMap(d, t.map);
1163
1144
  l !== void 0 && e.style.setProperty("--tw-motion-bind-value", `${l}`);
@@ -1175,7 +1156,7 @@ class Dt {
1175
1156
  case "unclamped":
1176
1157
  return e;
1177
1158
  default:
1178
- return T(e);
1159
+ return O(e);
1179
1160
  }
1180
1161
  }
1181
1162
  applyMap(e, t) {
@@ -1216,8 +1197,8 @@ class Dt {
1216
1197
  for (const i of o) {
1217
1198
  try {
1218
1199
  i();
1219
- } catch (c) {
1220
- ne.warn("Failed to cleanup listener", c);
1200
+ } catch (a) {
1201
+ ve.warn("Failed to cleanup listener", a);
1221
1202
  }
1222
1203
  this.globalCleanups.delete(i);
1223
1204
  }
@@ -1262,16 +1243,16 @@ class Dt {
1262
1243
  }
1263
1244
  }
1264
1245
  }
1265
- const Me = new Dt(), oe = "ikon-ds";
1266
- function Fr(r) {
1267
- const e = ae(({ styleId: n, css: o, common: s }) => {
1246
+ const Ke = new dr(), we = "ikon-ds";
1247
+ function fr(r) {
1248
+ const e = z(({ styleId: n, css: o, common: s }) => {
1268
1249
  if (!n || typeof document > "u") return;
1269
- let i = document.getElementById(oe);
1270
- i || (i = document.createElement("style"), i.id = oe, document.head.appendChild(i)), o && (i.innerHTML += o), Me.registerStyle(n, s);
1271
- }, []), t = ae(() => {
1272
- typeof document < "u" && document.getElementById(oe)?.remove(), Me.reset();
1250
+ let i = document.getElementById(we);
1251
+ i || (i = document.createElement("style"), i.id = we, document.head.appendChild(i)), o && (i.innerHTML += o), Ke.registerStyle(n, s);
1252
+ }, []), t = z(() => {
1253
+ typeof document < "u" && document.getElementById(we)?.remove(), Ke.reset();
1273
1254
  }, []);
1274
- return q(() => {
1255
+ return $(() => {
1275
1256
  if (!r) return;
1276
1257
  for (const o of r.getUiStyles())
1277
1258
  e(o);
@@ -1279,9 +1260,9 @@ function Fr(r) {
1279
1260
  return () => {
1280
1261
  n?.(), t();
1281
1262
  };
1282
- }, [r, t, e]), q(() => () => t(), [t]), { setStyle: e, reset: t };
1263
+ }, [r, t, e]), $(() => () => t(), [t]), { setStyle: e, reset: t };
1283
1264
  }
1284
- function qt(r) {
1265
+ function hr(r) {
1285
1266
  const e = [];
1286
1267
  for (const [t, n] of r) {
1287
1268
  const o = n.store.getSnapshot(), s = o.rootViewId && o.views.has(o.rootViewId);
@@ -1289,62 +1270,62 @@ function qt(r) {
1289
1270
  }
1290
1271
  return e.sort(), e.join(",");
1291
1272
  }
1292
- function Vr(r) {
1293
- const [e, t] = tt(), n = I("");
1294
- return q(() => {
1273
+ function mr(r) {
1274
+ const [e, t] = Y(), n = E("");
1275
+ return $(() => {
1295
1276
  if (!r) {
1296
1277
  t(void 0), n.current = "";
1297
1278
  return;
1298
1279
  }
1299
1280
  const o = () => {
1300
- const s = r.getStores(), i = qt(s);
1281
+ const s = r.getStores(), i = hr(s);
1301
1282
  i !== n.current && (n.current = i, t(s));
1302
1283
  };
1303
1284
  return o(), r.subscribe(o);
1304
1285
  }, [r]), e;
1305
1286
  }
1306
- var Wt = typeof global == "object" && global && global.Object === Object && global, Yt = typeof self == "object" && self && self.Object === Object && self, Gt = Wt || Yt || Function("return this")(), H = Gt.Symbol, ze = Object.prototype, Kt = ze.hasOwnProperty, Xt = ze.toString, z = H ? H.toStringTag : void 0;
1307
- function Ht(r) {
1308
- var e = Kt.call(r, z), t = r[z];
1287
+ var pr = typeof global == "object" && global && global.Object === Object && global, gr = typeof self == "object" && self && self.Object === Object && self, yr = pr || gr || Function("return this")(), ge = yr.Symbol, it = Object.prototype, Sr = it.hasOwnProperty, br = it.toString, ne = ge ? ge.toStringTag : void 0;
1288
+ function vr(r) {
1289
+ var e = Sr.call(r, ne), t = r[ne];
1309
1290
  try {
1310
- r[z] = void 0;
1291
+ r[ne] = void 0;
1311
1292
  var n = !0;
1312
1293
  } catch {
1313
1294
  }
1314
- var o = Xt.call(r);
1315
- return n && (e ? r[z] = t : delete r[z]), o;
1295
+ var o = br.call(r);
1296
+ return n && (e ? r[ne] = t : delete r[ne]), o;
1316
1297
  }
1317
- var Jt = Object.prototype, Zt = Jt.toString;
1318
- function Qt(r) {
1319
- return Zt.call(r);
1298
+ var wr = Object.prototype, Er = wr.toString;
1299
+ function kr(r) {
1300
+ return Er.call(r);
1320
1301
  }
1321
- var er = "[object Null]", tr = "[object Undefined]", _e = H ? H.toStringTag : void 0;
1322
- function rr(r) {
1323
- return r == null ? r === void 0 ? tr : er : _e && _e in Object(r) ? Ht(r) : Qt(r);
1302
+ var Rr = "[object Null]", Ar = "[object Undefined]", Ge = ge ? ge.toStringTag : void 0;
1303
+ function Nr(r) {
1304
+ return r == null ? r === void 0 ? Ar : Rr : Ge && Ge in Object(r) ? vr(r) : kr(r);
1324
1305
  }
1325
- function nr(r) {
1306
+ function Cr(r) {
1326
1307
  return r != null && typeof r == "object";
1327
1308
  }
1328
- var or = Array.isArray, sr = "[object String]";
1329
- function ir(r) {
1330
- return typeof r == "string" || !or(r) && nr(r) && rr(r) == sr;
1309
+ var Ir = Array.isArray, Tr = "[object String]";
1310
+ function jr(r) {
1311
+ return typeof r == "string" || !Ir(r) && Cr(r) && Nr(r) == Tr;
1331
1312
  }
1332
- const Pe = "ikonUiModules";
1333
- function de(r) {
1313
+ const He = "ikonUiModules";
1314
+ function je(r) {
1334
1315
  return typeof r == "object" && r !== null && !Array.isArray(r);
1335
1316
  }
1336
- function ar(r) {
1317
+ function Or(r) {
1337
1318
  if (!Array.isArray(r))
1338
1319
  return;
1339
1320
  const e = /* @__PURE__ */ new Set();
1340
1321
  for (const t of r) {
1341
- if (!ir(t)) continue;
1322
+ if (!jr(t)) continue;
1342
1323
  const n = t.trim();
1343
1324
  n && (e.has(n) || e.add(n));
1344
1325
  }
1345
1326
  return Array.from(e);
1346
1327
  }
1347
- function Br(r, e) {
1328
+ function gn(r, e) {
1348
1329
  if (r === e)
1349
1330
  return !0;
1350
1331
  if (!r || !e)
@@ -1356,19 +1337,19 @@ function Br(r, e) {
1356
1337
  return !1;
1357
1338
  return !0;
1358
1339
  }
1359
- function cr(r) {
1360
- if (!(!de(r) || !Object.prototype.hasOwnProperty.call(r, Pe)))
1361
- return ar(r[Pe]);
1340
+ function Pr(r) {
1341
+ if (!(!je(r) || !Object.prototype.hasOwnProperty.call(r, He)))
1342
+ return Or(r[He]);
1362
1343
  }
1363
- function zr(...r) {
1344
+ function yn(...r) {
1364
1345
  for (const e of r) {
1365
- const t = cr(e);
1346
+ const t = Pr(e);
1366
1347
  if (t !== void 0)
1367
1348
  return t;
1368
1349
  }
1369
1350
  }
1370
- function Dr(r) {
1371
- if (!de(r))
1351
+ function Sn(r) {
1352
+ if (!je(r))
1372
1353
  return;
1373
1354
  const e = r, t = Object.keys(e).find((u) => u.toLowerCase() === "modules");
1374
1355
  if (!t)
@@ -1381,44 +1362,44 @@ function Dr(r) {
1381
1362
  const o = [], s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
1382
1363
  for (const u of n) {
1383
1364
  if (typeof u == "string") {
1384
- const S = u.trim();
1385
- if (!S || i.has(S))
1365
+ const v = u.trim();
1366
+ if (!v || i.has(v))
1386
1367
  continue;
1387
- o.push(S), i.add(S);
1368
+ o.push(v), i.add(v);
1388
1369
  continue;
1389
1370
  }
1390
- if (!de(u))
1371
+ if (!je(u))
1391
1372
  continue;
1392
- const d = u, l = Object.keys(d).find((S) => S.toLowerCase() === "name");
1373
+ const d = u, l = Object.keys(d).find((v) => v.toLowerCase() === "name");
1393
1374
  if (!l)
1394
1375
  continue;
1395
- const p = d[l];
1396
- if (typeof p != "string")
1376
+ const f = d[l];
1377
+ if (typeof f != "string")
1397
1378
  continue;
1398
- const h = p.trim();
1399
- if (!h)
1379
+ const p = f.trim();
1380
+ if (!p)
1400
1381
  continue;
1401
- const w = Object.keys(d).find((S) => S.toLowerCase() === "javascript"), N = w ? d[w] : void 0;
1402
- typeof N == "string" && s.set(h, N), i.has(h) || (o.push(h), i.add(h));
1382
+ const k = Object.keys(d).find((v) => v.toLowerCase() === "javascript"), C = k ? d[k] : void 0;
1383
+ typeof C == "string" && s.set(p, C), i.has(p) || (o.push(p), i.add(p));
1403
1384
  }
1404
1385
  if (!o.length && s.size === 0)
1405
1386
  return { modules: [] };
1406
- const c = Array.from(s.entries()).map(([u, d]) => ({
1387
+ const a = Array.from(s.entries()).map(([u, d]) => ({
1407
1388
  name: u,
1408
1389
  javascript: d
1409
1390
  }));
1410
- return c.length > 0 ? { modules: o, inlineModules: c } : { modules: o };
1391
+ return a.length > 0 ? { modules: o, inlineModules: a } : { modules: o };
1411
1392
  }
1412
- const g = {
1393
+ const y = {
1413
1394
  None: 0,
1414
1395
  Letter: 1,
1415
1396
  Word: 2,
1416
1397
  Line: 4,
1417
1398
  Paragraph: 8,
1418
1399
  Emoji: 16
1419
- }, ur = [
1400
+ }, _r = [
1420
1401
  {
1421
- flag: g.Letter,
1402
+ flag: y.Letter,
1422
1403
  hints: [
1423
1404
  "[data-motion-letter]",
1424
1405
  "[data-letter]",
@@ -1427,7 +1408,7 @@ const g = {
1427
1408
  ]
1428
1409
  },
1429
1410
  {
1430
- flag: g.Word,
1411
+ flag: y.Word,
1431
1412
  hints: [
1432
1413
  "[data-motion-word]",
1433
1414
  "[data-word]",
@@ -1436,7 +1417,7 @@ const g = {
1436
1417
  ]
1437
1418
  },
1438
1419
  {
1439
- flag: g.Line,
1420
+ flag: y.Line,
1440
1421
  hints: [
1441
1422
  "[data-motion-line]",
1442
1423
  "[data-line]",
@@ -1445,7 +1426,7 @@ const g = {
1445
1426
  ]
1446
1427
  },
1447
1428
  {
1448
- flag: g.Paragraph,
1429
+ flag: y.Paragraph,
1449
1430
  hints: [
1450
1431
  "[data-motion-paragraph]",
1451
1432
  "[data-paragraph]",
@@ -1456,7 +1437,7 @@ const g = {
1456
1437
  ]
1457
1438
  },
1458
1439
  {
1459
- flag: g.Emoji,
1440
+ flag: y.Emoji,
1460
1441
  hints: [
1461
1442
  ":is([data-motion-emoji],[data-emoji],.tw-motion-emoji,.tw-emoji)",
1462
1443
  "[data-motion-emoji]",
@@ -1465,42 +1446,42 @@ const g = {
1465
1446
  "[data-emoji]"
1466
1447
  ]
1467
1448
  }
1468
- ], fe = g.Letter | g.Word | g.Line | g.Paragraph | g.Emoji, lr = g.Letter | g.Word | g.Line | g.Paragraph, Le = /* @__PURE__ */ new Map(), dr = 16384;
1469
- function qr(r, e) {
1470
- if (!r || r.length > dr)
1449
+ ], Oe = y.Letter | y.Word | y.Line | y.Paragraph | y.Emoji, Mr = y.Letter | y.Word | y.Line | y.Paragraph, Xe = /* @__PURE__ */ new Map(), Lr = 16384;
1450
+ function bn(r, e) {
1451
+ if (!r || r.length > Lr)
1471
1452
  return r;
1472
- const t = jr(e), n = U(t, g.Emoji), o = t & lr;
1473
- if (o === g.None && !n)
1453
+ const t = Zr(e), n = K(t, y.Emoji), o = t & Mr;
1454
+ if (o === y.None && !n)
1474
1455
  return r;
1475
1456
  const s = r.replace(/\r\n/g, `
1476
1457
  `).replace(/\r/g, `
1477
1458
  `);
1478
- if (o === g.None)
1479
- return Fe(s);
1480
- const i = Tr(s);
1459
+ if (o === y.None)
1460
+ return tt(s);
1461
+ const i = Hr(s);
1481
1462
  if (i.length === 0)
1482
- return n ? Fe(s) : r;
1483
- const c = Cr(i), u = { letter: 0, word: 0, line: 0, paragraph: 0, br: 0, emoji: 0 }, d = [];
1484
- for (const l of c) {
1485
- const p = fr(l, t, u);
1486
- d.push(...p);
1463
+ return n ? tt(s) : r;
1464
+ const a = Xr(i), u = { letter: 0, word: 0, line: 0, paragraph: 0, br: 0, emoji: 0 }, d = [];
1465
+ for (const l of a) {
1466
+ const f = Ur(l, t, u);
1467
+ d.push(...f);
1487
1468
  }
1488
1469
  return d;
1489
1470
  }
1490
- function fr(r, e, t) {
1471
+ function Ur(r, e, t) {
1491
1472
  const n = [];
1492
1473
  for (const o of r) {
1493
- const s = mr(o, e, t);
1474
+ const s = xr(o, e, t);
1494
1475
  n.push(...s);
1495
1476
  }
1496
- if (U(e, g.Paragraph)) {
1477
+ if (K(e, y.Paragraph)) {
1497
1478
  const o = t.paragraph++;
1498
1479
  return [
1499
1480
  /* @__PURE__ */ b.jsx(
1500
1481
  "span",
1501
1482
  {
1502
1483
  "data-motion-paragraph": !0,
1503
- style: J(o),
1484
+ style: Se(o),
1504
1485
  children: n
1505
1486
  },
1506
1487
  `motion-paragraph-${o}`
@@ -1509,12 +1490,12 @@ function fr(r, e, t) {
1509
1490
  }
1510
1491
  return n;
1511
1492
  }
1512
- function mr(r, e, t) {
1513
- const n = pr(r.text, e, t), o = [];
1514
- if (U(e, g.Line)) {
1493
+ function xr(r, e, t) {
1494
+ const n = $r(r.text, e, t), o = [];
1495
+ if (K(e, y.Line)) {
1515
1496
  const s = t.line++;
1516
1497
  o.push(
1517
- /* @__PURE__ */ b.jsx("span", { "data-motion-line": !0, style: J(s), children: n }, `motion-line-${s}`)
1498
+ /* @__PURE__ */ b.jsx("span", { "data-motion-line": !0, style: Se(s), children: n }, `motion-line-${s}`)
1518
1499
  );
1519
1500
  } else
1520
1501
  o.push(...n);
@@ -1522,103 +1503,103 @@ function mr(r, e, t) {
1522
1503
  o.push(/* @__PURE__ */ b.jsx("br", {}, `motion-break-${t.br++}`));
1523
1504
  return o;
1524
1505
  }
1525
- function pr(r, e, t) {
1506
+ function $r(r, e, t) {
1526
1507
  if (!r)
1527
1508
  return [];
1528
- const n = U(e, g.Word), o = [], s = /(\s+)/g;
1529
- let i = 0, c;
1530
- for (; (c = s.exec(r)) !== null; ) {
1531
- if (c.index > i) {
1532
- const u = r.slice(i, c.index);
1533
- o.push(xe(u, t, e, n));
1509
+ const n = K(e, y.Word), o = [], s = /(\s+)/g;
1510
+ let i = 0, a;
1511
+ for (; (a = s.exec(r)) !== null; ) {
1512
+ if (a.index > i) {
1513
+ const u = r.slice(i, a.index);
1514
+ o.push(Ze(u, t, e, n));
1534
1515
  }
1535
- o.push(c[0]), i = c.index + c[0].length;
1516
+ o.push(a[0]), i = a.index + a[0].length;
1536
1517
  }
1537
1518
  if (i < r.length) {
1538
1519
  const u = r.slice(i);
1539
- o.push(xe(u, t, e, n));
1520
+ o.push(Ze(u, t, e, n));
1540
1521
  }
1541
1522
  return o;
1542
1523
  }
1543
- function xe(r, e, t, n) {
1544
- const o = e.word++, s = gr(r, t, e), i = `motion-word-${o}`, c = hr(o, n);
1545
- return n ? /* @__PURE__ */ b.jsx("span", { "data-motion-word": !0, style: c, children: s }, i) : /* @__PURE__ */ b.jsx("span", { style: c, children: s }, i);
1524
+ function Ze(r, e, t, n) {
1525
+ const o = e.word++, s = Br(r, t, e), i = `motion-word-${o}`, a = Fr(o, n);
1526
+ return n ? /* @__PURE__ */ b.jsx("span", { "data-motion-word": !0, style: a, children: s }, i) : /* @__PURE__ */ b.jsx("span", { style: a, children: s }, i);
1546
1527
  }
1547
- function hr(r, e) {
1548
- return e ? { ...J(r), whiteSpace: "nowrap" } : { whiteSpace: "nowrap" };
1528
+ function Fr(r, e) {
1529
+ return e ? { ...Se(r), whiteSpace: "nowrap" } : { whiteSpace: "nowrap" };
1549
1530
  }
1550
- function gr(r, e, t) {
1531
+ function Br(r, e, t) {
1551
1532
  if (!r)
1552
1533
  return [];
1553
- const n = U(e, g.Letter), o = U(e, g.Emoji);
1534
+ const n = K(e, y.Letter), o = K(e, y.Emoji);
1554
1535
  if (!n) {
1555
1536
  if (!o)
1556
1537
  return [r];
1557
- const c = me(r);
1558
- if (c.length === 0)
1538
+ const a = Pe(r);
1539
+ if (a.length === 0)
1559
1540
  return [r];
1560
- const { nodes: u } = qe(c, t);
1541
+ const { nodes: u } = ct(a, t);
1561
1542
  return u;
1562
1543
  }
1563
- const s = [], i = me(r);
1564
- for (const c of i) {
1565
- const u = t.letter++, d = `motion-letter-${u}`, l = J(u);
1566
- if (c === `
1544
+ const s = [], i = Pe(r);
1545
+ for (const a of i) {
1546
+ const u = t.letter++, d = `motion-letter-${u}`, l = Se(u);
1547
+ if (a === `
1567
1548
  `) {
1568
1549
  s.push(
1569
1550
  /* @__PURE__ */ b.jsx("span", { "data-motion-letter": !0, style: l, children: /* @__PURE__ */ b.jsx("br", {}) }, d)
1570
1551
  );
1571
1552
  continue;
1572
1553
  }
1573
- const h = o && De(c) ? { "data-motion-emoji": !0 } : void 0, w = c === " " ? " " : c;
1554
+ const p = o && at(a) ? { "data-motion-emoji": !0 } : void 0, k = a === " " ? " " : a;
1574
1555
  s.push(
1575
- /* @__PURE__ */ b.jsx("span", { "data-motion-letter": !0, style: l, ...h, children: w }, d)
1556
+ /* @__PURE__ */ b.jsx("span", { "data-motion-letter": !0, style: l, ...p, children: k }, d)
1576
1557
  );
1577
1558
  }
1578
1559
  return s;
1579
1560
  }
1580
- function me(r) {
1561
+ function Pe(r) {
1581
1562
  if (!r)
1582
1563
  return [];
1583
- const e = yr();
1584
- return e ? Array.from(e.segment(r), (t) => t.segment) : Sr(r);
1564
+ const e = Vr();
1565
+ return e ? Array.from(e.segment(r), (t) => t.segment) : zr(r);
1585
1566
  }
1586
- let D;
1587
- function yr() {
1588
- return D !== void 0 || (typeof Intl < "u" && typeof Intl.Segmenter == "function" ? D = new Intl.Segmenter(void 0, { granularity: "grapheme" }) : D = null), D;
1567
+ let oe;
1568
+ function Vr() {
1569
+ return oe !== void 0 || (typeof Intl < "u" && typeof Intl.Segmenter == "function" ? oe = new Intl.Segmenter(void 0, { granularity: "grapheme" }) : oe = null), oe;
1589
1570
  }
1590
- function Sr(r) {
1571
+ function zr(r) {
1591
1572
  const e = [], t = Array.from(r);
1592
1573
  let n = "";
1593
1574
  for (let o = 0; o < t.length; o++) {
1594
1575
  const s = t[o], i = t[o + 1];
1595
- n += s, !(i && br(s, i)) && (e.push(n), n = "");
1576
+ n += s, !(i && Dr(s, i)) && (e.push(n), n = "");
1596
1577
  }
1597
1578
  return n && e.push(n), e;
1598
1579
  }
1599
- function br(r, e) {
1600
- return e ? !!(Ue(r) || Ue(e) || wr(e) || vr(e) || Er(e) || $e(r) && $e(e)) : !1;
1580
+ function Dr(r, e) {
1581
+ return e ? !!(Qe(r) || Qe(e) || Yr(e) || qr(e) || Wr(e) || et(r) && et(e)) : !1;
1601
1582
  }
1602
- function Ue(r) {
1583
+ function Qe(r) {
1603
1584
  return r.codePointAt(0) === 8205;
1604
1585
  }
1605
- function vr(r) {
1586
+ function qr(r) {
1606
1587
  const e = r.codePointAt(0);
1607
1588
  return e === void 0 ? !1 : e >= 65024 && e <= 65039 || e >= 917760 && e <= 917999;
1608
1589
  }
1609
- function Er(r) {
1590
+ function Wr(r) {
1610
1591
  const e = r.codePointAt(0);
1611
1592
  return e === void 0 ? !1 : e >= 127995 && e <= 127999;
1612
1593
  }
1613
- function $e(r) {
1594
+ function et(r) {
1614
1595
  const e = r.codePointAt(0);
1615
1596
  return e === void 0 ? !1 : e >= 127462 && e <= 127487;
1616
1597
  }
1617
- let se;
1618
- function wr(r) {
1619
- return r ? (se || (se = Rr()), se(r)) : !1;
1598
+ let Ee;
1599
+ function Yr(r) {
1600
+ return r ? (Ee || (Ee = Jr()), Ee(r)) : !1;
1620
1601
  }
1621
- function Rr() {
1602
+ function Jr() {
1622
1603
  try {
1623
1604
  const r = new RegExp("\\p{Mark}", "u");
1624
1605
  return (e) => r.test(e);
@@ -1629,19 +1610,19 @@ function Rr() {
1629
1610
  };
1630
1611
  }
1631
1612
  }
1632
- let ie;
1633
- function De(r) {
1634
- return r ? (ie || (ie = kr()), ie(r)) : !1;
1613
+ let ke;
1614
+ function at(r) {
1615
+ return r ? (ke || (ke = Kr()), ke(r)) : !1;
1635
1616
  }
1636
- function kr() {
1617
+ function Kr() {
1637
1618
  try {
1638
1619
  const r = new RegExp("\\p{Extended_Pictographic}", "u");
1639
1620
  return (e) => r.test(e);
1640
1621
  } catch {
1641
- return Nr;
1622
+ return Gr;
1642
1623
  }
1643
1624
  }
1644
- function Nr(r) {
1625
+ function Gr(r) {
1645
1626
  if (!r)
1646
1627
  return !1;
1647
1628
  for (const e of Array.from(r)) {
@@ -1651,7 +1632,7 @@ function Nr(r) {
1651
1632
  }
1652
1633
  return !1;
1653
1634
  }
1654
- function Tr(r) {
1635
+ function Hr(r) {
1655
1636
  const e = [];
1656
1637
  let t = "", n = 0;
1657
1638
  for (let o = 0; o < r.length; o++) {
@@ -1665,7 +1646,7 @@ function Tr(r) {
1665
1646
  }
1666
1647
  return (n > 0 || t.length > 0) && e.push({ text: t, breaks: n }), e;
1667
1648
  }
1668
- function Cr(r) {
1649
+ function Xr(r) {
1669
1650
  if (r.length === 0)
1670
1651
  return [];
1671
1652
  const e = [];
@@ -1674,10 +1655,10 @@ function Cr(r) {
1674
1655
  t.push(n), n.breaks >= 2 && (e.push(t), t = []);
1675
1656
  return t.length > 0 && e.push(t), e;
1676
1657
  }
1677
- function U(r, e) {
1658
+ function K(r, e) {
1678
1659
  return (r & e) === e;
1679
1660
  }
1680
- function J(r) {
1661
+ function Se(r) {
1681
1662
  return {
1682
1663
  "--tw-motion-seq-index": r.toString(),
1683
1664
  backgroundColor: "inherit",
@@ -1694,52 +1675,52 @@ function J(r) {
1694
1675
  WebkitTextFillColor: "inherit"
1695
1676
  };
1696
1677
  }
1697
- function Fe(r) {
1678
+ function tt(r) {
1698
1679
  if (!r)
1699
1680
  return r;
1700
- const e = me(r);
1681
+ const e = Pe(r);
1701
1682
  if (e.length === 0)
1702
1683
  return r;
1703
- const { nodes: t, sawEmoji: n } = qe(e);
1684
+ const { nodes: t, sawEmoji: n } = ct(e);
1704
1685
  return n ? t.length === 1 ? t[0] ?? r : t : r;
1705
1686
  }
1706
- function qe(r, e) {
1687
+ function ct(r, e) {
1707
1688
  const t = [];
1708
1689
  let n = "", o = !1, s = e?.emoji ?? 0;
1709
1690
  const i = () => {
1710
1691
  n && (t.push(n), n = "");
1711
1692
  };
1712
- for (const c of r) {
1713
- if (De(c)) {
1693
+ for (const a of r) {
1694
+ if (at(a)) {
1714
1695
  o = !0, i();
1715
1696
  const d = `motion-emoji-${e ? e.emoji++ : s++}`;
1716
1697
  t.push(
1717
- /* @__PURE__ */ b.jsx("span", { "data-motion-emoji": !0, children: c }, d)
1698
+ /* @__PURE__ */ b.jsx("span", { "data-motion-emoji": !0, children: a }, d)
1718
1699
  );
1719
1700
  continue;
1720
1701
  }
1721
- n += c;
1702
+ n += a;
1722
1703
  }
1723
1704
  return i(), o ? { nodes: t, sawEmoji: !0 } : { nodes: [r.join("")], sawEmoji: !1 };
1724
1705
  }
1725
- function jr(r) {
1706
+ function Zr(r) {
1726
1707
  if (!r)
1727
- return g.None;
1708
+ return y.None;
1728
1709
  const e = r.trim();
1729
1710
  if (!e)
1730
- return g.None;
1731
- const t = Le.get(e);
1711
+ return y.None;
1712
+ const t = Xe.get(e);
1732
1713
  if (typeof t == "number")
1733
1714
  return t;
1734
1715
  if (typeof document > "u")
1735
- return g.None;
1716
+ return y.None;
1736
1717
  const n = e.split(/\s+/).filter(Boolean);
1737
1718
  if (n.length === 0)
1738
- return g.None;
1739
- const s = n.map((u) => `.${Or(u)}`).map(
1740
- (u) => new RegExp(`(^|[^a-zA-Z0-9_-])${Ar(u)}(?![a-zA-Z0-9_-])`)
1719
+ return y.None;
1720
+ const s = n.map((u) => `.${Qr(u)}`).map(
1721
+ (u) => new RegExp(`(^|[^a-zA-Z0-9_-])${en(u)}(?![a-zA-Z0-9_-])`)
1741
1722
  );
1742
- let i = g.None, c = !1;
1723
+ let i = y.None, a = !1;
1743
1724
  for (const u of Array.from(document.styleSheets)) {
1744
1725
  let d;
1745
1726
  try {
@@ -1747,31 +1728,31 @@ function jr(r) {
1747
1728
  } catch {
1748
1729
  continue;
1749
1730
  }
1750
- const l = We(d, s);
1751
- if (l.mask && (i |= l.mask, i === fe))
1731
+ const l = ut(d, s);
1732
+ if (l.mask && (i |= l.mask, i === Oe))
1752
1733
  break;
1753
- c ||= l.sawStyleRule;
1734
+ a ||= l.sawStyleRule;
1754
1735
  }
1755
- return (i !== g.None || c) && Le.set(e, i), i;
1736
+ return (i !== y.None || a) && Xe.set(e, i), i;
1756
1737
  }
1757
- function We(r, e) {
1738
+ function ut(r, e) {
1758
1739
  if (!r)
1759
- return { mask: g.None, sawStyleRule: !1 };
1760
- let t = g.None, n = !1;
1740
+ return { mask: y.None, sawStyleRule: !1 };
1741
+ let t = y.None, n = !1;
1761
1742
  for (let o = 0; o < r.length; o++) {
1762
1743
  const s = r[o];
1763
1744
  if (s) {
1764
1745
  if (s.type === CSSRule.STYLE_RULE) {
1765
- const c = s.selectorText ?? "";
1766
- if (!c || !e.some((d) => d.test(c))) continue;
1746
+ const a = s.selectorText ?? "";
1747
+ if (!a || !e.some((d) => d.test(a))) continue;
1767
1748
  n = !0;
1768
- for (const d of ur)
1769
- d.hints.some((l) => c.includes(l)) && (t |= d.flag);
1770
- if (t === fe)
1749
+ for (const d of _r)
1750
+ d.hints.some((l) => a.includes(l)) && (t |= d.flag);
1751
+ if (t === Oe)
1771
1752
  return { mask: t, sawStyleRule: !0 };
1772
1753
  } else if ("cssRules" in s) {
1773
- const i = We(s.cssRules, e);
1774
- if (i.mask && (t |= i.mask, t === fe))
1754
+ const i = ut(s.cssRules, e);
1755
+ if (i.mask && (t |= i.mask, t === Oe))
1775
1756
  return { mask: t, sawStyleRule: !0 };
1776
1757
  n ||= i.sawStyleRule;
1777
1758
  }
@@ -1779,42 +1760,471 @@ function We(r, e) {
1779
1760
  }
1780
1761
  return { mask: t, sawStyleRule: n };
1781
1762
  }
1782
- function Or(r) {
1763
+ function Qr(r) {
1783
1764
  return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(r) : r.replace(/[^a-zA-Z0-9_-]/g, (e) => `\\${e}`);
1784
1765
  }
1785
- function Ar(r) {
1766
+ function en(r) {
1786
1767
  return r.replace(/[.*+?^${}()|[\]\\]/g, (e) => `\\${e}`);
1787
1768
  }
1769
+ const Le = "ikon_auth_session", tn = 7 * 24 * 60 * 60 * 1e3;
1770
+ function lt(r) {
1771
+ try {
1772
+ localStorage.setItem(Le, JSON.stringify(r));
1773
+ } catch {
1774
+ console.warn("Failed to save auth session to localStorage");
1775
+ }
1776
+ }
1777
+ function dt() {
1778
+ try {
1779
+ const r = localStorage.getItem(Le);
1780
+ if (!r) return null;
1781
+ const e = JSON.parse(r);
1782
+ return Date.now() - e.authenticatedAt > tn ? (ft(), null) : e;
1783
+ } catch {
1784
+ return console.warn("Failed to load auth session from localStorage"), null;
1785
+ }
1786
+ }
1787
+ function ft() {
1788
+ try {
1789
+ localStorage.removeItem(Le);
1790
+ } catch {
1791
+ console.warn("Failed to clear auth session from localStorage");
1792
+ }
1793
+ }
1794
+ function Re(r) {
1795
+ return {
1796
+ id: "",
1797
+ provider: r.provider,
1798
+ token: r.token,
1799
+ authenticatedAt: r.authenticatedAt
1800
+ };
1801
+ }
1802
+ async function ht(r, e) {
1803
+ const t = me(), n = await fetch(`${e}/anonymous`, {
1804
+ method: "POST",
1805
+ headers: { "Content-Type": "application/json" },
1806
+ body: JSON.stringify({ deviceId: t, space: r })
1807
+ });
1808
+ if (!n.ok) {
1809
+ const i = await n.text().catch(() => "Unknown error");
1810
+ throw new Error(`Anonymous auth failed: ${n.status} ${i}`);
1811
+ }
1812
+ const { token: o } = await n.json(), s = {
1813
+ token: o,
1814
+ provider: "anonymous",
1815
+ authenticatedAt: Date.now()
1816
+ };
1817
+ return lt(s), s;
1818
+ }
1819
+ async function vn(r) {
1820
+ const { email: e, spaceId: t, authUrl: n, returnUrl: o = window.location.origin + window.location.pathname } = r, s = await fetch(`${n}/email/send`, {
1821
+ method: "POST",
1822
+ headers: { "Content-Type": "application/json" },
1823
+ body: JSON.stringify({
1824
+ email: e.trim(),
1825
+ space: t,
1826
+ return: o
1827
+ })
1828
+ });
1829
+ if (!s.ok) {
1830
+ const i = await s.text().catch(() => "Failed to send email");
1831
+ throw new Error(i);
1832
+ }
1833
+ }
1834
+ function rn() {
1835
+ const r = new URLSearchParams(window.location.search), e = r.get("ikon_token"), t = r.get("ikon_provider");
1836
+ return e && t ? { token: e, provider: t } : null;
1837
+ }
1838
+ function nn() {
1839
+ const e = new URLSearchParams(window.location.search).get("error");
1840
+ return e ? decodeURIComponent(e) : null;
1841
+ }
1842
+ function rt() {
1843
+ window.history.replaceState({}, "", window.location.pathname);
1844
+ }
1845
+ function on(r, e, t, n) {
1846
+ const o = n ?? window.location.origin + window.location.pathname + window.location.search;
1847
+ return `${t}/oauth/${r}?space=${encodeURIComponent(e)}&return=${encodeURIComponent(o)}`;
1848
+ }
1849
+ const Ue = nt(null);
1850
+ function wn({ children: r, config: e }) {
1851
+ const [t, n] = Y({
1852
+ isAuthenticated: !1,
1853
+ isLoading: !0,
1854
+ user: null,
1855
+ error: null
1856
+ });
1857
+ $(() => {
1858
+ (() => {
1859
+ const d = nn();
1860
+ if (d) {
1861
+ rt(), n({
1862
+ isAuthenticated: !1,
1863
+ isLoading: !1,
1864
+ user: null,
1865
+ error: d
1866
+ });
1867
+ return;
1868
+ }
1869
+ const l = rn();
1870
+ if (l) {
1871
+ const p = {
1872
+ token: l.token,
1873
+ provider: l.provider,
1874
+ authenticatedAt: Date.now()
1875
+ };
1876
+ lt(p), rt(), n({
1877
+ isAuthenticated: !0,
1878
+ isLoading: !1,
1879
+ user: Re(p),
1880
+ error: null
1881
+ });
1882
+ return;
1883
+ }
1884
+ const f = dt();
1885
+ if (f) {
1886
+ n({
1887
+ isAuthenticated: !0,
1888
+ isLoading: !1,
1889
+ user: Re(f),
1890
+ error: null
1891
+ });
1892
+ return;
1893
+ }
1894
+ n({
1895
+ isAuthenticated: !1,
1896
+ isLoading: !1,
1897
+ user: null,
1898
+ error: null
1899
+ });
1900
+ })();
1901
+ }, []);
1902
+ const o = z(
1903
+ async (u) => {
1904
+ if (!e.spaceId) {
1905
+ n((f) => ({
1906
+ ...f,
1907
+ error: "Space ID is not configured"
1908
+ }));
1909
+ return;
1910
+ }
1911
+ if (u === "guest") {
1912
+ n((f) => ({ ...f, isLoading: !0 }));
1913
+ try {
1914
+ const f = e.authUrl ?? Ne(), p = await ht(e.spaceId, f);
1915
+ n({
1916
+ isAuthenticated: !0,
1917
+ isLoading: !1,
1918
+ user: Re(p),
1919
+ error: null
1920
+ });
1921
+ } catch (f) {
1922
+ n((p) => ({
1923
+ ...p,
1924
+ isLoading: !1,
1925
+ error: f instanceof Error ? f.message : "Guest login failed"
1926
+ }));
1927
+ }
1928
+ return;
1929
+ }
1930
+ const d = e.authUrl ?? Ne(), l = on(u, e.spaceId, d);
1931
+ window.location.href = l;
1932
+ },
1933
+ [e.authUrl, e.spaceId]
1934
+ ), s = z(() => {
1935
+ ft(), n({
1936
+ isAuthenticated: !1,
1937
+ isLoading: !1,
1938
+ user: null,
1939
+ error: null
1940
+ });
1941
+ }, []), i = z(() => t.user?.token ?? null, [t.user]), a = L(
1942
+ () => ({
1943
+ state: t,
1944
+ login: o,
1945
+ logout: s,
1946
+ getToken: i
1947
+ }),
1948
+ [t, o, s, i]
1949
+ );
1950
+ return /* @__PURE__ */ b.jsx(Ue, { value: a, children: r });
1951
+ }
1952
+ function sn() {
1953
+ const r = Me(Ue);
1954
+ if (!r)
1955
+ throw new Error("useAuth must be used within an AuthProvider");
1956
+ return r;
1957
+ }
1958
+ function En() {
1959
+ return Me(Ue);
1960
+ }
1961
+ function kn(r) {
1962
+ const { config: e, guestUrlParam: t } = r, { state: n, login: o } = sn(), s = E(!1);
1963
+ return $(() => {
1964
+ if (!t || n.isAuthenticated || n.isLoading || s.current || !e.methods.includes("guest"))
1965
+ return;
1966
+ const i = new URLSearchParams(window.location.search), a = i.get(t);
1967
+ if (a === "true" || a === "1" || a === "") {
1968
+ i.delete(t);
1969
+ const u = i.toString(), d = window.location.pathname + (u ? `?${u}` : "");
1970
+ window.history.replaceState({}, "", d), s.current = !0, o("guest");
1971
+ }
1972
+ }, [t, n.isAuthenticated, n.isLoading, e.methods, o]), {
1973
+ shouldRenderChildren: n.isAuthenticated,
1974
+ isCheckingAuth: n.isLoading,
1975
+ isAuthenticated: n.isAuthenticated,
1976
+ error: n.error
1977
+ };
1978
+ }
1979
+ function Rn({
1980
+ connectionState: r,
1981
+ error: e,
1982
+ isReady: t,
1983
+ stores: n,
1984
+ registry: o,
1985
+ client: s,
1986
+ onAction: i,
1987
+ renderIdle: a,
1988
+ renderConnecting: u,
1989
+ renderConnectingSlow: d,
1990
+ renderConnected: l,
1991
+ renderOffline: f,
1992
+ renderError: p
1993
+ }) {
1994
+ switch (r) {
1995
+ case "idle":
1996
+ return a();
1997
+ case "connecting":
1998
+ return u();
1999
+ case "connectingSlow":
2000
+ return d();
2001
+ case "connected":
2002
+ case "reconnecting":
2003
+ return !t || !n || !o ? null : l({
2004
+ stores: n,
2005
+ registry: o,
2006
+ client: s,
2007
+ onAction: i,
2008
+ isReconnecting: r === "reconnecting"
2009
+ });
2010
+ case "offline":
2011
+ return f();
2012
+ case "offlineError":
2013
+ return p(e ?? s?.lastError?.message ?? null);
2014
+ default:
2015
+ return null;
2016
+ }
2017
+ }
2018
+ const Ae = ye("useIkonApp");
2019
+ function An(r) {
2020
+ const { authConfig: e, localServer: t, modules: n, registerModules: o, onJoined: s, onConnectionStateChange: i, onError: a, updateUrlOnJoin: u = !0, timeouts: d, audio: l, video: f, mediaSession: p, debug: k } = r, C = E(null), v = E(null), m = E(null), g = E(!1), w = E(l), P = E(f), T = E(p), x = E(k), D = E(d), ae = E(i), H = E(a), ce = E(s), ue = E(u);
2021
+ w.current = l, P.current = f, T.current = p, x.current = k, D.current = d, ae.current = i, H.current = a, ce.current = s, ue.current = u;
2022
+ const [q, le] = Y("idle"), [be, J] = Y(null), [X, de] = Y(null), [B, fe] = Y(null), [Z, c] = Y(!1), h = L(() => {
2023
+ try {
2024
+ return bt();
2025
+ } catch {
2026
+ return { parameters: {} };
2027
+ }
2028
+ }, []), S = L(() => e?.enabled ? dt() : null, [e?.enabled]), R = t?.enabled ?? !1, M = t?.host ?? "localhost", j = t?.httpsPort ?? 8443;
2029
+ $(() => {
2030
+ !R && xe() && e && !e.enabled && e.spaceId && !B && !Z && (c(!0), ht(e.spaceId, e.authUrl ?? Ne()).then((I) => {
2031
+ fe(I.token);
2032
+ }).catch((I) => {
2033
+ Ae.error("Anonymous auth failed:", I), J(I instanceof Error ? I.message : "Anonymous auth failed");
2034
+ }).finally(() => {
2035
+ c(!1);
2036
+ }));
2037
+ }, [R, e, B, Z]);
2038
+ const W = L(() => {
2039
+ if (R) {
2040
+ const N = S?.token ? vt(S.token) ?? me() : me();
2041
+ return {
2042
+ local: {
2043
+ host: M,
2044
+ httpsPort: j,
2045
+ userId: N
2046
+ }
2047
+ };
2048
+ }
2049
+ return S?.token && e?.spaceId ? {
2050
+ sessionToken: {
2051
+ token: S.token,
2052
+ spaceId: e.spaceId,
2053
+ backendType: $e(),
2054
+ sessionId: h.sessionId,
2055
+ channelKey: h.channelKey,
2056
+ parameters: h.parameters
2057
+ }
2058
+ } : B && e?.spaceId ? {
2059
+ sessionToken: {
2060
+ token: B,
2061
+ spaceId: e.spaceId,
2062
+ backendType: $e(),
2063
+ sessionId: h.sessionId,
2064
+ channelKey: h.channelKey,
2065
+ parameters: h.parameters
2066
+ }
2067
+ } : xe() ? null : {
2068
+ local: {
2069
+ host: M,
2070
+ httpsPort: j,
2071
+ userId: me()
2072
+ }
2073
+ };
2074
+ }, [R, M, j, S?.token, e?.spaceId, B, h.sessionId, h.channelKey, h.parameters]);
2075
+ fr(X);
2076
+ const Q = mr(X);
2077
+ $(() => {
2078
+ if (!g.current) {
2079
+ if (g.current = !0, m.current = or(), n)
2080
+ for (const N of n)
2081
+ N(m.current);
2082
+ o?.(m.current), m.current.loadRegisteredModules().catch((N) => {
2083
+ Ae.error("Failed to load UI modules", N);
2084
+ });
2085
+ }
2086
+ }, []), $(() => {
2087
+ if (!W) return;
2088
+ const N = new wt({
2089
+ ...W,
2090
+ debug: x.current,
2091
+ timeouts: D.current,
2092
+ audio: w.current,
2093
+ video: P.current,
2094
+ mediaSession: T.current,
2095
+ onConnectionStateChange: (_) => {
2096
+ le(_), ae.current?.(_);
2097
+ },
2098
+ onError: (_) => {
2099
+ J(_.message), H.current?.(_);
2100
+ },
2101
+ onJoined: () => {
2102
+ const _ = N.globalState?.SessionId;
2103
+ ue.current && _ && window.history.replaceState(null, "", `/s/${_}${window.location.search}`), ce.current?.(_);
2104
+ }
2105
+ });
2106
+ C.current = N;
2107
+ const I = new xt({ client: N });
2108
+ return v.current = I, de(I), N.connect().catch((_) => {
2109
+ Ae.error("Connection failed:", _);
2110
+ }), () => {
2111
+ N.disconnect(), C.current = null, I.dispose(), v.current = null;
2112
+ };
2113
+ }, [W]);
2114
+ const A = z((N, I) => {
2115
+ const _ = typeof I == "string" ? I : JSON.stringify(I ?? {});
2116
+ C.current?.sendActionCall(N, _);
2117
+ }, []), V = q === "connected" || q === "reconnecting";
2118
+ return {
2119
+ connectionState: q,
2120
+ error: be,
2121
+ stores: Q,
2122
+ client: C.current,
2123
+ registry: m.current,
2124
+ clientRef: C,
2125
+ uiRef: v,
2126
+ registryRef: m,
2127
+ onAction: A,
2128
+ isReady: V
2129
+ };
2130
+ }
2131
+ function Nn(r) {
2132
+ const e = E(!1);
2133
+ return z(() => {
2134
+ if (e.current) return;
2135
+ e.current = !0;
2136
+ const t = document.createElement("link");
2137
+ t.rel = "stylesheet", t.href = r, document.head.appendChild(t);
2138
+ }, [r]);
2139
+ }
2140
+ const mt = nt(null);
2141
+ function an(r, e) {
2142
+ return e ? r.replace(/\{(\w+)\}/g, (t, n) => e[n] ?? `{${n}}`) : r;
2143
+ }
2144
+ function cn(r, e) {
2145
+ const n = new URLSearchParams(window.location.search).get("lang");
2146
+ if (n && r.includes(n))
2147
+ return n;
2148
+ const o = navigator.language.split("-")[0];
2149
+ return r.includes(o) ? o : e && r.includes(e) ? e : "en";
2150
+ }
2151
+ function un(r, e, t) {
2152
+ return e ? cn(r, t) : t && r.includes(t) ? t : "en";
2153
+ }
2154
+ function Cn({
2155
+ children: r,
2156
+ translations: e,
2157
+ defaultLanguage: t,
2158
+ detectLanguage: n = !1
2159
+ }) {
2160
+ const o = Object.keys(e), s = un(o, n, t), i = e[s] ?? e.en, a = L(
2161
+ () => ({
2162
+ t: (u, d) => {
2163
+ const l = i[u];
2164
+ return an(l, d);
2165
+ },
2166
+ locale: s,
2167
+ translations: i
2168
+ }),
2169
+ [i, s]
2170
+ );
2171
+ return /* @__PURE__ */ b.jsx(mt, { value: a, children: r });
2172
+ }
2173
+ function In() {
2174
+ const r = Me(mt);
2175
+ if (!r)
2176
+ throw new Error("useI18n must be used within an I18nProvider");
2177
+ return r;
2178
+ }
1788
2179
  export {
1789
- Nt as IKON_UI_BASE_MODULE,
1790
- _t as IKON_UI_MEDIA_MODULE,
1791
- ue as IKON_UI_STREAM_CATEGORY,
1792
- jt as IKON_UI_VIDEO_CANVAS_TYPE,
1793
- Ot as IKON_UI_VIDEO_URL_PLAYER_TYPE,
1794
- Ur as IkonUi,
1795
- xt as IkonUiRegistry,
1796
- xr as IkonUiSurface,
1797
- ht as UiComponentRegistry,
1798
- pt as UiRenderer,
1799
- Gr as UiStreamStore,
1800
- Br as areIkonUiModuleListsEqual,
1801
- kt as createBaseResolvers,
1802
- Pr as createComponentLibrary,
1803
- $r as createIkonUiRegistry,
1804
- It as createMediaResolvers,
1805
- gt as isIkonUiCategoryMatch,
1806
- Tt as loadBaseModule,
1807
- Pt as loadMediaModule,
1808
- ar as normalizeIkonUiModuleList,
1809
- Dr as parseIkonUiInitPayload,
1810
- cr as readIkonUiModules,
1811
- zr as readIkonUiModulesFromSources,
1812
- Ct as registerBaseModule,
1813
- Lt as registerMediaModule,
1814
- ft as renderChildren,
1815
- qr as renderMotionLetters,
1816
- Fr as useIkonStyles,
1817
- Vr as useIkonUiStores,
1818
- M as useUiNode,
1819
- Lr as useUiStore
2180
+ wn as AuthProvider,
2181
+ Rn as ConnectionStateRenderer,
2182
+ Cn as I18nProvider,
2183
+ Yt as IKON_UI_BASE_MODULE,
2184
+ er as IKON_UI_MEDIA_MODULE,
2185
+ Ie as IKON_UI_STREAM_CATEGORY,
2186
+ Gt as IKON_UI_VIDEO_CANVAS_TYPE,
2187
+ Ht as IKON_UI_VIDEO_URL_PLAYER_TYPE,
2188
+ xt as IkonUi,
2189
+ nr as IkonUiRegistry,
2190
+ pn as IkonUiSurface,
2191
+ Lt as UiComponentRegistry,
2192
+ Mt as UiRenderer,
2193
+ On as UiStreamStore,
2194
+ gn as areIkonUiModuleListsEqual,
2195
+ ht as authenticateAnonymous,
2196
+ on as buildOAuthRedirectUrl,
2197
+ ft as clearAuthSession,
2198
+ rt as clearOAuthParams,
2199
+ Wt as createBaseResolvers,
2200
+ hn as createComponentLibrary,
2201
+ or as createIkonUiRegistry,
2202
+ Zt as createMediaResolvers,
2203
+ Ut as isIkonUiCategoryMatch,
2204
+ dt as loadAuthSession,
2205
+ Jt as loadBaseModule,
2206
+ tr as loadMediaModule,
2207
+ Or as normalizeIkonUiModuleList,
2208
+ Sn as parseIkonUiInitPayload,
2209
+ rn as parseOAuthCallback,
2210
+ nn as parseOAuthError,
2211
+ Pr as readIkonUiModules,
2212
+ yn as readIkonUiModulesFromSources,
2213
+ Kt as registerBaseModule,
2214
+ rr as registerMediaModule,
2215
+ Pt as renderChildren,
2216
+ bn as renderMotionLetters,
2217
+ lt as saveAuthSession,
2218
+ vn as sendMagicLink,
2219
+ Re as sessionToUser,
2220
+ sn as useAuth,
2221
+ kn as useAuthGuard,
2222
+ En as useAuthOptional,
2223
+ In as useI18n,
2224
+ An as useIkonApp,
2225
+ fr as useIkonStyles,
2226
+ mr as useIkonUiStores,
2227
+ Nn as useLazyFont,
2228
+ F as useUiNode,
2229
+ mn as useUiStore
1820
2230
  };